@cedros/login-react 0.0.28 → 0.0.29
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.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +598 -601
- package/dist/index.js.map +1 -1
- package/dist/login-react.css +1 -1
- package/dist/mobileWalletAdapter-B6ELaZp1.cjs +1 -0
- package/dist/mobileWalletAdapter-B6ELaZp1.cjs.map +1 -0
- package/dist/{mobileWalletAdapter-Ds4-7Snb.js → mobileWalletAdapter-Cm_AUXhg.js} +52 -52
- package/dist/mobileWalletAdapter-Cm_AUXhg.js.map +1 -0
- package/dist/solana-only.cjs +1 -1
- package/dist/solana-only.js +1 -1
- package/package.json +1 -1
- package/dist/mobileWalletAdapter-BhzZHGIl.cjs +0 -1
- package/dist/mobileWalletAdapter-BhzZHGIl.cjs.map +0 -1
- package/dist/mobileWalletAdapter-Ds4-7Snb.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { C as Dc, x as Ic, s as Fc } from "./useAuth-m5Hf89v8.js";
|
|
|
3
3
|
import { u as ne, A as ue, h as O, a as ve } from "./useCedrosLogin-_94MmGGq.js";
|
|
4
4
|
import { b as _c, c as Wc } from "./useCedrosLogin-_94MmGGq.js";
|
|
5
5
|
import { jsx as e, jsxs as i, Fragment as X } from "react/jsx-runtime";
|
|
6
|
-
import { useState as k, useRef as $, useMemo as q, useEffect as _, useCallback as
|
|
6
|
+
import { useState as k, useRef as $, useMemo as q, useEffect as _, useCallback as x, useId as Hr, Component as Hs, createContext as Qs, useContext as Qr } from "react";
|
|
7
7
|
import { L as Y } from "./LoadingSpinner-6vml-zwr.js";
|
|
8
8
|
import { a as Kr, s as Ks } from "./sanitization-CQ-H1MSg.js";
|
|
9
9
|
import { b as Ys, E as Gs, a as $s, P as we, O as Yr } from "./EmailRegisterForm-BAX_uBIt.js";
|
|
@@ -12,8 +12,8 @@ import { b as Js, v as Ot } from "./validation-B8kMV3BL.js";
|
|
|
12
12
|
import { E as ee } from "./ErrorMessage-CcEK0pYO.js";
|
|
13
13
|
import { G as Xs } from "./GoogleLoginButton-B6qnNMZp.js";
|
|
14
14
|
import { u as Qc } from "./GoogleLoginButton-B6qnNMZp.js";
|
|
15
|
-
import { S as Zs } from "./mobileWalletAdapter-
|
|
16
|
-
import { r as Yc, u as Gc } from "./mobileWalletAdapter-
|
|
15
|
+
import { S as Zs } from "./mobileWalletAdapter-Cm_AUXhg.js";
|
|
16
|
+
import { r as Yc, u as Gc } from "./mobileWalletAdapter-Cm_AUXhg.js";
|
|
17
17
|
import { c as eo, d as to, u as ro, a as so, M as oo, I as no, b as ao, P as io } from "./PermissionsSection-CighC1p6.js";
|
|
18
18
|
import { u as co } from "./useSystemSettings-DBlAMjFi.js";
|
|
19
19
|
import { C as lo, S as Gr, a as uo, u as ho, A as po } from "./AutosaveStatus-vkJxtuEw.js";
|
|
@@ -2410,24 +2410,24 @@ function oc({
|
|
|
2410
2410
|
);
|
|
2411
2411
|
_(() => {
|
|
2412
2412
|
if (!f) return;
|
|
2413
|
-
const v = (
|
|
2414
|
-
u.current && !u.current.contains(
|
|
2415
|
-
},
|
|
2416
|
-
|
|
2413
|
+
const v = (L) => {
|
|
2414
|
+
u.current && !u.current.contains(L.target) && (g(!1), m(-1));
|
|
2415
|
+
}, E = (L) => {
|
|
2416
|
+
L.key === "Escape" && (g(!1), m(-1), y.current?.focus());
|
|
2417
2417
|
};
|
|
2418
|
-
return document.addEventListener("mousedown", v), document.addEventListener("keydown",
|
|
2419
|
-
document.removeEventListener("mousedown", v), document.removeEventListener("keydown",
|
|
2418
|
+
return document.addEventListener("mousedown", v), document.addEventListener("keydown", E), () => {
|
|
2419
|
+
document.removeEventListener("mousedown", v), document.removeEventListener("keydown", E);
|
|
2420
2420
|
};
|
|
2421
2421
|
}, [f]);
|
|
2422
|
-
const b =
|
|
2422
|
+
const b = x(
|
|
2423
2423
|
(v) => {
|
|
2424
2424
|
if (!(!f || A.length === 0))
|
|
2425
2425
|
switch (v.key) {
|
|
2426
2426
|
case "ArrowDown":
|
|
2427
|
-
v.preventDefault(), m((
|
|
2427
|
+
v.preventDefault(), m((E) => (E + 1) % A.length);
|
|
2428
2428
|
break;
|
|
2429
2429
|
case "ArrowUp":
|
|
2430
|
-
v.preventDefault(), m((
|
|
2430
|
+
v.preventDefault(), m((E) => (E - 1 + A.length) % A.length);
|
|
2431
2431
|
break;
|
|
2432
2432
|
case "Home":
|
|
2433
2433
|
v.preventDefault(), m(0);
|
|
@@ -2442,13 +2442,13 @@ function oc({
|
|
|
2442
2442
|
}
|
|
2443
2443
|
},
|
|
2444
2444
|
[f, w, A]
|
|
2445
|
-
),
|
|
2445
|
+
), C = x(() => {
|
|
2446
2446
|
A.length !== 0 && (g((v) => !v), m(-1));
|
|
2447
|
-
}, [A.length]),
|
|
2447
|
+
}, [A.length]), N = {
|
|
2448
2448
|
sm: "cedros-button-sm",
|
|
2449
2449
|
md: "cedros-button-md",
|
|
2450
2450
|
lg: "cedros-button-lg"
|
|
2451
|
-
},
|
|
2451
|
+
}, P = {
|
|
2452
2452
|
default: "cedros-button-primary",
|
|
2453
2453
|
outline: "cedros-button-outline",
|
|
2454
2454
|
ghost: "cedros-button-ghost"
|
|
@@ -2458,13 +2458,13 @@ function oc({
|
|
|
2458
2458
|
"button",
|
|
2459
2459
|
{
|
|
2460
2460
|
type: "button",
|
|
2461
|
-
className: `cedros-button ${
|
|
2461
|
+
className: `cedros-button ${P[r]} ${N[o]} ${t}`,
|
|
2462
2462
|
disabled: !0,
|
|
2463
2463
|
children: /* @__PURE__ */ e(Y, { size: "sm" })
|
|
2464
2464
|
}
|
|
2465
2465
|
);
|
|
2466
2466
|
if (c && l) {
|
|
2467
|
-
const v = l.name || l.email || "User",
|
|
2467
|
+
const v = l.name || l.email || "User", E = Kr(l.picture);
|
|
2468
2468
|
return (
|
|
2469
2469
|
// L-08: Added keyboard handler and ref for accessibility
|
|
2470
2470
|
/* @__PURE__ */ i("div", { className: "cedros-user-menu", ref: u, onKeyDown: b, children: [
|
|
@@ -2473,16 +2473,16 @@ function oc({
|
|
|
2473
2473
|
{
|
|
2474
2474
|
ref: y,
|
|
2475
2475
|
type: "button",
|
|
2476
|
-
className: `cedros-button cedros-user-button ${
|
|
2476
|
+
className: `cedros-button cedros-user-button ${N[o]} ${t}`,
|
|
2477
2477
|
"aria-haspopup": "menu",
|
|
2478
2478
|
"aria-expanded": f,
|
|
2479
2479
|
"aria-label": `User menu for ${v}`,
|
|
2480
|
-
onClick:
|
|
2480
|
+
onClick: C,
|
|
2481
2481
|
children: [
|
|
2482
|
-
|
|
2482
|
+
E ? /* @__PURE__ */ e(
|
|
2483
2483
|
"img",
|
|
2484
2484
|
{
|
|
2485
|
-
src:
|
|
2485
|
+
src: E,
|
|
2486
2486
|
alt: v,
|
|
2487
2487
|
className: "cedros-user-avatar",
|
|
2488
2488
|
referrerPolicy: "no-referrer",
|
|
@@ -2494,7 +2494,7 @@ function oc({
|
|
|
2494
2494
|
}
|
|
2495
2495
|
),
|
|
2496
2496
|
f && /* @__PURE__ */ i("div", { className: "cedros-dropdown cedros-dropdown-open", role: "menu", children: [
|
|
2497
|
-
s.map((
|
|
2497
|
+
s.map((L, S) => /* @__PURE__ */ i(
|
|
2498
2498
|
"button",
|
|
2499
2499
|
{
|
|
2500
2500
|
type: "button",
|
|
@@ -2502,11 +2502,11 @@ function oc({
|
|
|
2502
2502
|
role: "menuitem",
|
|
2503
2503
|
tabIndex: w === S ? 0 : -1,
|
|
2504
2504
|
onClick: () => {
|
|
2505
|
-
|
|
2505
|
+
L.onClick(), g(!1);
|
|
2506
2506
|
},
|
|
2507
2507
|
children: [
|
|
2508
|
-
|
|
2509
|
-
|
|
2508
|
+
L.icon && /* @__PURE__ */ e("span", { className: "cedros-dropdown-icon", children: L.icon }),
|
|
2509
|
+
L.label
|
|
2510
2510
|
]
|
|
2511
2511
|
},
|
|
2512
2512
|
S
|
|
@@ -2533,7 +2533,7 @@ function oc({
|
|
|
2533
2533
|
"button",
|
|
2534
2534
|
{
|
|
2535
2535
|
type: "button",
|
|
2536
|
-
className: `cedros-button ${
|
|
2536
|
+
className: `cedros-button ${P[r]} ${N[o]} ${t}`,
|
|
2537
2537
|
onClick: h,
|
|
2538
2538
|
children: a || "Sign in"
|
|
2539
2539
|
}
|
|
@@ -2550,7 +2550,7 @@ function cs() {
|
|
|
2550
2550
|
), { checkLimit: d, getRemainingAttempts: h } = Ys({
|
|
2551
2551
|
maxAttempts: 3,
|
|
2552
2552
|
windowMs: 3e5
|
|
2553
|
-
}), p =
|
|
2553
|
+
}), p = x(
|
|
2554
2554
|
async (m) => {
|
|
2555
2555
|
if (!Js(m)) {
|
|
2556
2556
|
const u = {
|
|
@@ -2579,7 +2579,7 @@ function cs() {
|
|
|
2579
2579
|
}
|
|
2580
2580
|
},
|
|
2581
2581
|
[c, d]
|
|
2582
|
-
), f =
|
|
2582
|
+
), f = x(
|
|
2583
2583
|
async (m, u) => {
|
|
2584
2584
|
o(!0), l(null), s(!1);
|
|
2585
2585
|
try {
|
|
@@ -2592,7 +2592,7 @@ function cs() {
|
|
|
2592
2592
|
}
|
|
2593
2593
|
},
|
|
2594
2594
|
[c]
|
|
2595
|
-
), g =
|
|
2595
|
+
), g = x(() => l(null), []), w = x(() => {
|
|
2596
2596
|
l(null), s(!1), o(!1);
|
|
2597
2597
|
}, []);
|
|
2598
2598
|
return {
|
|
@@ -2784,7 +2784,7 @@ function nn() {
|
|
|
2784
2784
|
u = !1;
|
|
2785
2785
|
};
|
|
2786
2786
|
}, [t.appleClientId]);
|
|
2787
|
-
const g =
|
|
2787
|
+
const g = x(async () => {
|
|
2788
2788
|
if (!t.appleClientId) {
|
|
2789
2789
|
const y = {
|
|
2790
2790
|
code: "VALIDATION_ERROR",
|
|
@@ -2812,16 +2812,16 @@ function nn() {
|
|
|
2812
2812
|
return p.current.callbacks?.onLoginSuccess?.(b.user, "apple"), r?.handleLoginSuccess(b.user, b.tokens), a(!1), b;
|
|
2813
2813
|
} catch (y) {
|
|
2814
2814
|
if (y.error === "popup_closed_by_user") {
|
|
2815
|
-
const
|
|
2815
|
+
const C = {
|
|
2816
2816
|
code: "SERVER_ERROR",
|
|
2817
2817
|
message: "Apple Sign In was cancelled"
|
|
2818
2818
|
};
|
|
2819
|
-
throw c(
|
|
2819
|
+
throw c(C), a(!1), C;
|
|
2820
2820
|
}
|
|
2821
2821
|
const b = O(y, "Apple sign-in failed");
|
|
2822
2822
|
throw b.code === "ACCOUNT_LINK_REQUIRED" && u && h(u), c(b), a(!1), b;
|
|
2823
2823
|
}
|
|
2824
|
-
}, [t.appleClientId, s, f, r]), w =
|
|
2824
|
+
}, [t.appleClientId, s, f, r]), w = x(() => c(null), []), m = x(() => h(null), []);
|
|
2825
2825
|
return {
|
|
2826
2826
|
signIn: g,
|
|
2827
2827
|
isLoading: o,
|
|
@@ -3012,7 +3012,7 @@ function dn() {
|
|
|
3012
3012
|
getAccessToken: r?.getAccessToken
|
|
3013
3013
|
}),
|
|
3014
3014
|
[r?.getAccessToken, t.serverUrl, t.requestTimeout, t.retryAttempts]
|
|
3015
|
-
), c =
|
|
3015
|
+
), c = x(() => n(null), []), d = ln(), h = x(
|
|
3016
3016
|
async (w) => {
|
|
3017
3017
|
if (!d) {
|
|
3018
3018
|
const m = {
|
|
@@ -3044,7 +3044,7 @@ function dn() {
|
|
|
3044
3044
|
}
|
|
3045
3045
|
},
|
|
3046
3046
|
[l, t.callbacks, r, d]
|
|
3047
|
-
), p =
|
|
3047
|
+
), p = x(
|
|
3048
3048
|
async (w) => {
|
|
3049
3049
|
if (!d) {
|
|
3050
3050
|
const m = {
|
|
@@ -3079,7 +3079,7 @@ function dn() {
|
|
|
3079
3079
|
}
|
|
3080
3080
|
},
|
|
3081
3081
|
[l, d]
|
|
3082
|
-
), f =
|
|
3082
|
+
), f = x(
|
|
3083
3083
|
async (w) => {
|
|
3084
3084
|
if (!d) {
|
|
3085
3085
|
const m = {
|
|
@@ -3114,7 +3114,7 @@ function dn() {
|
|
|
3114
3114
|
}
|
|
3115
3115
|
},
|
|
3116
3116
|
[l, t.callbacks, r, d]
|
|
3117
|
-
), g =
|
|
3117
|
+
), g = x(async () => {
|
|
3118
3118
|
if (!d) {
|
|
3119
3119
|
const w = {
|
|
3120
3120
|
code: "VALIDATION_ERROR",
|
|
@@ -3148,11 +3148,11 @@ function dn() {
|
|
|
3148
3148
|
});
|
|
3149
3149
|
if (!b)
|
|
3150
3150
|
throw new Error("Passkey authentication returned no credential");
|
|
3151
|
-
const
|
|
3151
|
+
const C = await l.post("/webauthn/auth/verify", {
|
|
3152
3152
|
challengeId: y.challengeId,
|
|
3153
3153
|
credential: Te(b)
|
|
3154
3154
|
});
|
|
3155
|
-
return t.callbacks?.onLoginSuccess?.(
|
|
3155
|
+
return t.callbacks?.onLoginSuccess?.(C.user, "webauthn"), r?.handleLoginSuccess(C.user, C.tokens), C;
|
|
3156
3156
|
} catch (y) {
|
|
3157
3157
|
const b = Be(y) ?? O(y, "Passkey sign-in failed");
|
|
3158
3158
|
throw n(b), b;
|
|
@@ -3267,59 +3267,56 @@ function rr() {
|
|
|
3267
3267
|
}
|
|
3268
3268
|
const Re = ["login", "register"];
|
|
3269
3269
|
function zt({ onSuccess: t, className: r = "", defaultTab: o = "login" }) {
|
|
3270
|
-
const { config: a } = ne(), [s, n] = k(o), [l, c] = k("form"), [d, h] = k(() => rr()), [p] = k(() => ls())
|
|
3270
|
+
const { config: a } = ne(), [s, n] = k(o), [l, c] = k("form"), [d, h] = k(() => rr()), [p] = k(() => ls());
|
|
3271
3271
|
_(() => {
|
|
3272
|
-
const
|
|
3273
|
-
return
|
|
3274
|
-
window.removeEventListener("load",
|
|
3272
|
+
const N = () => h(rr());
|
|
3273
|
+
return N(), window.addEventListener("load", N), window.addEventListener("focus", N), () => {
|
|
3274
|
+
window.removeEventListener("load", N), window.removeEventListener("focus", N);
|
|
3275
3275
|
};
|
|
3276
3276
|
}, []);
|
|
3277
|
-
const
|
|
3278
|
-
(
|
|
3279
|
-
const
|
|
3280
|
-
let
|
|
3281
|
-
switch (
|
|
3277
|
+
const f = a.forms?.forgotPassword?.mode ?? (a.features?.instantLink ? "instantLink" : "reset"), g = x(
|
|
3278
|
+
(N) => {
|
|
3279
|
+
const P = Re.indexOf(s);
|
|
3280
|
+
let v = P;
|
|
3281
|
+
switch (N.key) {
|
|
3282
3282
|
case "ArrowLeft":
|
|
3283
3283
|
case "ArrowUp":
|
|
3284
|
-
|
|
3284
|
+
v = P === 0 ? Re.length - 1 : P - 1;
|
|
3285
3285
|
break;
|
|
3286
3286
|
case "ArrowRight":
|
|
3287
3287
|
case "ArrowDown":
|
|
3288
|
-
|
|
3288
|
+
v = P === Re.length - 1 ? 0 : P + 1;
|
|
3289
3289
|
break;
|
|
3290
3290
|
case "Home":
|
|
3291
|
-
|
|
3291
|
+
v = 0;
|
|
3292
3292
|
break;
|
|
3293
3293
|
case "End":
|
|
3294
|
-
|
|
3294
|
+
v = Re.length - 1;
|
|
3295
3295
|
break;
|
|
3296
3296
|
default:
|
|
3297
3297
|
return;
|
|
3298
3298
|
}
|
|
3299
|
-
|
|
3300
|
-
const
|
|
3301
|
-
n(
|
|
3299
|
+
N.preventDefault();
|
|
3300
|
+
const E = Re[v];
|
|
3301
|
+
n(E), document.getElementById(`cedros-tab-${E}`)?.focus();
|
|
3302
3302
|
},
|
|
3303
3303
|
[s]
|
|
3304
|
-
),
|
|
3304
|
+
), w = a.features ?? {
|
|
3305
3305
|
email: !0,
|
|
3306
3306
|
google: !0,
|
|
3307
3307
|
apple: !0,
|
|
3308
3308
|
solana: !0,
|
|
3309
3309
|
webauthn: !0
|
|
3310
|
-
},
|
|
3311
|
-
return l === "forgotPassword" ? /* @__PURE__ */ e("div", { className: `cedros-login-form ${r}`, children: /* @__PURE__ */ e(sn, { onCancel: () => c("form") }) }) : /* @__PURE__ */ i("div", { className: `cedros-login-form ${
|
|
3312
|
-
(
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
/* @__PURE__ */ e(Zs, { onSuccess: t, onLoadingChange: g }),
|
|
3318
|
-
f && /* @__PURE__ */ e("p", { className: "cedros-solana-status", children: "Connecting to Solana wallet…" })
|
|
3319
|
-
] })
|
|
3310
|
+
}, m = w.email !== !1, u = w.google !== !1 && a.googleClientId, y = w.apple !== !1 && a.appleClientId && p, A = w.solana !== !1 && d, b = w.webauthn !== !1, C = m && (u || y || A || b);
|
|
3311
|
+
return l === "forgotPassword" ? /* @__PURE__ */ e("div", { className: `cedros-login-form ${r}`, children: /* @__PURE__ */ e(sn, { onCancel: () => c("form") }) }) : /* @__PURE__ */ i("div", { className: `cedros-login-form ${r}`, children: [
|
|
3312
|
+
(b || u || y || A) && /* @__PURE__ */ i("div", { className: "cedros-social-buttons", children: [
|
|
3313
|
+
b && /* @__PURE__ */ e(un, { onSuccess: t }),
|
|
3314
|
+
u && /* @__PURE__ */ e(Xs, { onSuccess: t }),
|
|
3315
|
+
y && /* @__PURE__ */ e(an, { onSuccess: t }),
|
|
3316
|
+
A && /* @__PURE__ */ e(Zs, { onSuccess: t })
|
|
3320
3317
|
] }),
|
|
3321
|
-
|
|
3322
|
-
|
|
3318
|
+
C && /* @__PURE__ */ e("div", { className: "cedros-divider", children: /* @__PURE__ */ e("span", { children: "Or continue with" }) }),
|
|
3319
|
+
m && /* @__PURE__ */ i(X, { children: [
|
|
3323
3320
|
/* @__PURE__ */ i("div", { className: "cedros-tabs", role: "tablist", "aria-label": "Authentication method", children: [
|
|
3324
3321
|
/* @__PURE__ */ e(
|
|
3325
3322
|
"button",
|
|
@@ -3329,7 +3326,7 @@ function zt({ onSuccess: t, className: r = "", defaultTab: o = "login" }) {
|
|
|
3329
3326
|
id: "cedros-tab-login",
|
|
3330
3327
|
className: `cedros-tab ${s === "login" ? "cedros-tab-active" : ""}`,
|
|
3331
3328
|
onClick: () => n("login"),
|
|
3332
|
-
onKeyDown:
|
|
3329
|
+
onKeyDown: g,
|
|
3333
3330
|
"aria-selected": s === "login",
|
|
3334
3331
|
"aria-controls": "cedros-tabpanel-login",
|
|
3335
3332
|
tabIndex: s === "login" ? 0 : -1,
|
|
@@ -3344,7 +3341,7 @@ function zt({ onSuccess: t, className: r = "", defaultTab: o = "login" }) {
|
|
|
3344
3341
|
id: "cedros-tab-register",
|
|
3345
3342
|
className: `cedros-tab ${s === "register" ? "cedros-tab-active" : ""}`,
|
|
3346
3343
|
onClick: () => n("register"),
|
|
3347
|
-
onKeyDown:
|
|
3344
|
+
onKeyDown: g,
|
|
3348
3345
|
"aria-selected": s === "register",
|
|
3349
3346
|
"aria-controls": "cedros-tabpanel-register",
|
|
3350
3347
|
tabIndex: s === "register" ? 0 : -1,
|
|
@@ -3363,7 +3360,7 @@ function zt({ onSuccess: t, className: r = "", defaultTab: o = "login" }) {
|
|
|
3363
3360
|
{
|
|
3364
3361
|
onSuccess: t,
|
|
3365
3362
|
onSwitchToRegister: () => n("register"),
|
|
3366
|
-
onForgotPassword:
|
|
3363
|
+
onForgotPassword: f === "reset" ? () => c("forgotPassword") : void 0
|
|
3367
3364
|
}
|
|
3368
3365
|
) : /* @__PURE__ */ e(
|
|
3369
3366
|
$s,
|
|
@@ -3651,14 +3648,14 @@ function ic({
|
|
|
3651
3648
|
if (c)
|
|
3652
3649
|
return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
|
|
3653
3650
|
}, [c]);
|
|
3654
|
-
const p =
|
|
3651
|
+
const p = x(
|
|
3655
3652
|
(w) => {
|
|
3656
3653
|
a(w), d(!1);
|
|
3657
3654
|
},
|
|
3658
3655
|
[a]
|
|
3659
|
-
), f =
|
|
3656
|
+
), f = x(() => {
|
|
3660
3657
|
d(!1), s?.();
|
|
3661
|
-
}, [s]), g =
|
|
3658
|
+
}, [s]), g = x(() => {
|
|
3662
3659
|
d((w) => !w);
|
|
3663
3660
|
}, []);
|
|
3664
3661
|
return o ? /* @__PURE__ */ i(
|
|
@@ -3886,11 +3883,11 @@ function kn({
|
|
|
3886
3883
|
] });
|
|
3887
3884
|
}
|
|
3888
3885
|
function Nn({ isLoading: t, onSubmit: r, onCancel: o }) {
|
|
3889
|
-
const [a, s] = k(""), [n, l] = k(""), [c, d] = k(null), h =
|
|
3886
|
+
const [a, s] = k(""), [n, l] = k(""), [c, d] = k(null), h = x((f) => {
|
|
3890
3887
|
s(f);
|
|
3891
3888
|
const g = f.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").substring(0, 50);
|
|
3892
3889
|
l(g);
|
|
3893
|
-
}, []), p =
|
|
3890
|
+
}, []), p = x(
|
|
3894
3891
|
async (f) => {
|
|
3895
3892
|
if (f.preventDefault(), d(null), !a.trim()) {
|
|
3896
3893
|
d("Organization name is required");
|
|
@@ -4018,23 +4015,23 @@ function Cn({
|
|
|
4018
4015
|
if (y.key === "Tab" && p.current) {
|
|
4019
4016
|
const A = p.current.querySelectorAll(
|
|
4020
4017
|
'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
4021
|
-
), b = A[0],
|
|
4022
|
-
y.shiftKey ? document.activeElement === b && (y.preventDefault(),
|
|
4018
|
+
), b = A[0], C = A[A.length - 1];
|
|
4019
|
+
y.shiftKey ? document.activeElement === b && (y.preventDefault(), C?.focus()) : document.activeElement === C && (y.preventDefault(), b?.focus());
|
|
4023
4020
|
}
|
|
4024
4021
|
};
|
|
4025
4022
|
return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
|
|
4026
4023
|
}, [t]);
|
|
4027
|
-
const g =
|
|
4024
|
+
const g = x(
|
|
4028
4025
|
(u) => {
|
|
4029
4026
|
u.target === u.currentTarget && t();
|
|
4030
4027
|
},
|
|
4031
4028
|
[t]
|
|
4032
|
-
), w =
|
|
4029
|
+
), w = x(
|
|
4033
4030
|
(u) => {
|
|
4034
4031
|
n(u), t();
|
|
4035
4032
|
},
|
|
4036
4033
|
[n, t]
|
|
4037
|
-
), m =
|
|
4034
|
+
), m = x(
|
|
4038
4035
|
async (u) => {
|
|
4039
4036
|
await l?.(u), t();
|
|
4040
4037
|
},
|
|
@@ -4084,7 +4081,7 @@ function lc({
|
|
|
4084
4081
|
onRevokeAll: a,
|
|
4085
4082
|
className: s = ""
|
|
4086
4083
|
}) {
|
|
4087
|
-
const [n, l] = k(!1), [c, d] = k(!1), h = $(null), p = q(() => t.filter((g) => !g.isCurrent).length, [t]), f =
|
|
4084
|
+
const [n, l] = k(!1), [c, d] = k(!1), h = $(null), p = q(() => t.filter((g) => !g.isCurrent).length, [t]), f = x(async () => {
|
|
4088
4085
|
if (!a) return;
|
|
4089
4086
|
const g = t.filter((m) => !m.isCurrent).length;
|
|
4090
4087
|
if (!(g === 0 || !window.confirm(
|
|
@@ -4233,7 +4230,7 @@ function Tn({
|
|
|
4233
4230
|
onConfirm: r,
|
|
4234
4231
|
className: o = ""
|
|
4235
4232
|
}) {
|
|
4236
|
-
const [a, s] = k(!1), [n, l] = k(!1), c = $(null), d = tn(t), h =
|
|
4233
|
+
const [a, s] = k(!1), [n, l] = k(!1), c = $(null), d = tn(t), h = x(async () => {
|
|
4237
4234
|
try {
|
|
4238
4235
|
await navigator.clipboard.writeText(t.join(" ")), s(!0), c.current !== null && window.clearTimeout(c.current), c.current = window.setTimeout(() => s(!1), 2e3);
|
|
4239
4236
|
} catch {
|
|
@@ -4242,7 +4239,7 @@ function Tn({
|
|
|
4242
4239
|
_(() => () => {
|
|
4243
4240
|
c.current !== null && (window.clearTimeout(c.current), c.current = null);
|
|
4244
4241
|
}, []);
|
|
4245
|
-
const p =
|
|
4242
|
+
const p = x(() => {
|
|
4246
4243
|
n && r();
|
|
4247
4244
|
}, [n, r]);
|
|
4248
4245
|
return /* @__PURE__ */ i("div", { className: `cedros-recovery-phrase-display ${o}`, children: [
|
|
@@ -4333,23 +4330,23 @@ function Bn({
|
|
|
4333
4330
|
error: a,
|
|
4334
4331
|
className: s = ""
|
|
4335
4332
|
}) {
|
|
4336
|
-
const [n, l] = k(Array(ce).fill("")), [c, d] = k(null), [h, p] = k([]), [f, g] = k(null), w = Hr(), m = $(null), u =
|
|
4337
|
-
(v,
|
|
4338
|
-
const
|
|
4339
|
-
if (
|
|
4340
|
-
const S = en(
|
|
4333
|
+
const [n, l] = k(Array(ce).fill("")), [c, d] = k(null), [h, p] = k([]), [f, g] = k(null), w = Hr(), m = $(null), u = x(
|
|
4334
|
+
(v, E) => {
|
|
4335
|
+
const L = [...n];
|
|
4336
|
+
if (L[v] = E.toLowerCase().trim(), l(L), E.length > 0) {
|
|
4337
|
+
const S = en(E, 5);
|
|
4341
4338
|
p(S);
|
|
4342
4339
|
} else
|
|
4343
4340
|
p([]);
|
|
4344
4341
|
g(null);
|
|
4345
4342
|
},
|
|
4346
4343
|
[n]
|
|
4347
|
-
), y =
|
|
4344
|
+
), y = x((v) => {
|
|
4348
4345
|
d(v), p([]);
|
|
4349
|
-
}, []), A =
|
|
4346
|
+
}, []), A = x(
|
|
4350
4347
|
(v) => {
|
|
4351
|
-
const
|
|
4352
|
-
|
|
4348
|
+
const E = n[v];
|
|
4349
|
+
E && !qe(E) && g(`Word ${v + 1} is not in the wordlist`), m.current !== null && window.clearTimeout(m.current), m.current = window.setTimeout(() => {
|
|
4353
4350
|
c === v && p([]);
|
|
4354
4351
|
}, 200);
|
|
4355
4352
|
},
|
|
@@ -4358,28 +4355,28 @@ function Bn({
|
|
|
4358
4355
|
_(() => () => {
|
|
4359
4356
|
m.current !== null && (window.clearTimeout(m.current), m.current = null);
|
|
4360
4357
|
}, []);
|
|
4361
|
-
const b =
|
|
4358
|
+
const b = x(
|
|
4362
4359
|
(v) => {
|
|
4363
4360
|
if (c !== null) {
|
|
4364
|
-
const
|
|
4365
|
-
|
|
4361
|
+
const E = [...n];
|
|
4362
|
+
E[c] = v, l(E), p([]), document.querySelector(
|
|
4366
4363
|
`[data-word-index="${c + 1}"]`
|
|
4367
4364
|
)?.focus();
|
|
4368
4365
|
}
|
|
4369
4366
|
},
|
|
4370
4367
|
[c, n]
|
|
4371
|
-
),
|
|
4372
|
-
const
|
|
4373
|
-
|
|
4374
|
-
}, []),
|
|
4368
|
+
), C = x((v) => {
|
|
4369
|
+
const E = v.clipboardData.getData("text"), L = rn(E);
|
|
4370
|
+
L.length === ce && (v.preventDefault(), l(L), g(null));
|
|
4371
|
+
}, []), N = x(
|
|
4375
4372
|
(v) => {
|
|
4376
4373
|
if (v.preventDefault(), n.filter((S) => !S).length > 0) {
|
|
4377
4374
|
g(`Please enter all ${ce} words`);
|
|
4378
4375
|
return;
|
|
4379
4376
|
}
|
|
4380
|
-
const
|
|
4381
|
-
if (
|
|
4382
|
-
g(`Invalid words: ${
|
|
4377
|
+
const L = n.map((S, B) => ({ word: S, index: B + 1 })).filter(({ word: S }) => !qe(S));
|
|
4378
|
+
if (L.length > 0) {
|
|
4379
|
+
g(`Invalid words: ${L.map((S) => `#${S.index}`).join(", ")}`);
|
|
4383
4380
|
return;
|
|
4384
4381
|
}
|
|
4385
4382
|
if (!is(n)) {
|
|
@@ -4389,41 +4386,41 @@ function Bn({
|
|
|
4389
4386
|
t(n);
|
|
4390
4387
|
},
|
|
4391
4388
|
[n, t]
|
|
4392
|
-
),
|
|
4389
|
+
), P = a || f;
|
|
4393
4390
|
return /* @__PURE__ */ i(
|
|
4394
4391
|
"form",
|
|
4395
4392
|
{
|
|
4396
4393
|
className: `cedros-recovery-phrase-input ${s}`,
|
|
4397
|
-
onSubmit:
|
|
4398
|
-
onPaste:
|
|
4394
|
+
onSubmit: N,
|
|
4395
|
+
onPaste: C,
|
|
4399
4396
|
children: [
|
|
4400
4397
|
/* @__PURE__ */ i("div", { className: "cedros-recovery-input-header", children: [
|
|
4401
4398
|
/* @__PURE__ */ e("h3", { className: "cedros-recovery-input-title", children: "Enter Recovery Phrase" }),
|
|
4402
4399
|
/* @__PURE__ */ e("p", { className: "cedros-recovery-input-description", children: "Enter your 12-word recovery phrase. You can paste the entire phrase at once." })
|
|
4403
4400
|
] }),
|
|
4404
|
-
/* @__PURE__ */ e("div", { className: "cedros-word-inputs", children: Array.from({ length: ce }, (v,
|
|
4401
|
+
/* @__PURE__ */ e("div", { className: "cedros-word-inputs", children: Array.from({ length: ce }, (v, E) => /* @__PURE__ */ i("div", { className: "cedros-word-input-wrapper", children: [
|
|
4405
4402
|
/* @__PURE__ */ i("label", { className: "cedros-word-label", children: [
|
|
4406
|
-
|
|
4403
|
+
E + 1,
|
|
4407
4404
|
"."
|
|
4408
4405
|
] }),
|
|
4409
4406
|
/* @__PURE__ */ e(
|
|
4410
4407
|
"input",
|
|
4411
4408
|
{
|
|
4412
4409
|
type: "text",
|
|
4413
|
-
className: `cedros-word-input ${n[
|
|
4414
|
-
value: n[
|
|
4415
|
-
onChange: (
|
|
4416
|
-
onFocus: () => y(
|
|
4417
|
-
onBlur: () => A(
|
|
4418
|
-
"data-word-index":
|
|
4410
|
+
className: `cedros-word-input ${n[E] && !qe(n[E]) ? "cedros-word-invalid" : n[E] && qe(n[E]) ? "cedros-word-valid" : ""}`,
|
|
4411
|
+
value: n[E],
|
|
4412
|
+
onChange: (L) => u(E, L.target.value),
|
|
4413
|
+
onFocus: () => y(E),
|
|
4414
|
+
onBlur: () => A(E),
|
|
4415
|
+
"data-word-index": E,
|
|
4419
4416
|
autoComplete: "off",
|
|
4420
4417
|
autoCapitalize: "none",
|
|
4421
4418
|
spellCheck: !1,
|
|
4422
4419
|
disabled: o,
|
|
4423
|
-
"aria-label": `Word ${
|
|
4420
|
+
"aria-label": `Word ${E + 1}`
|
|
4424
4421
|
}
|
|
4425
4422
|
)
|
|
4426
|
-
] },
|
|
4423
|
+
] }, E)) }),
|
|
4427
4424
|
c !== null && h.length > 0 && /* @__PURE__ */ e("div", { className: "cedros-suggestions", role: "listbox", id: `${w}-suggestions`, children: h.map((v) => /* @__PURE__ */ e(
|
|
4428
4425
|
"button",
|
|
4429
4426
|
{
|
|
@@ -4435,7 +4432,7 @@ function Bn({
|
|
|
4435
4432
|
},
|
|
4436
4433
|
v
|
|
4437
4434
|
)) }),
|
|
4438
|
-
|
|
4435
|
+
P && /* @__PURE__ */ e("p", { className: "cedros-input-error", role: "alert", children: P }),
|
|
4439
4436
|
/* @__PURE__ */ i("div", { className: "cedros-recovery-input-actions", children: [
|
|
4440
4437
|
r && /* @__PURE__ */ e(
|
|
4441
4438
|
"button",
|
|
@@ -4556,7 +4553,7 @@ function us() {
|
|
|
4556
4553
|
baseUrl: t.config.serverUrl,
|
|
4557
4554
|
timeoutMs: t.config.requestTimeout,
|
|
4558
4555
|
retryAttempts: t.config.retryAttempts
|
|
4559
|
-
}) : null, [t]), d =
|
|
4556
|
+
}) : null, [t]), d = x(async () => {
|
|
4560
4557
|
if (c) {
|
|
4561
4558
|
s(!0), l(null);
|
|
4562
4559
|
try {
|
|
@@ -4594,28 +4591,28 @@ function us() {
|
|
|
4594
4591
|
} : In;
|
|
4595
4592
|
}
|
|
4596
4593
|
function Fn() {
|
|
4597
|
-
const { user: t } = ne(), { enroll: r } = Pe(), { recoveryMode: o } = us(), [a, s] = k({ step: "idle" }), [n, l] = k(!1), c = $([]), d =
|
|
4594
|
+
const { user: t } = ne(), { enroll: r } = Pe(), { recoveryMode: o } = us(), [a, s] = k({ step: "idle" }), [n, l] = k(!1), c = $([]), d = x(() => {
|
|
4598
4595
|
_r(...c.current), c.current = [];
|
|
4599
4596
|
}, []);
|
|
4600
4597
|
_(() => () => {
|
|
4601
4598
|
d();
|
|
4602
4599
|
}, [d]);
|
|
4603
|
-
const h =
|
|
4600
|
+
const h = x(
|
|
4604
4601
|
async (m, u, y, A) => {
|
|
4605
4602
|
s({ step: "generating_seed" });
|
|
4606
4603
|
const b = js();
|
|
4607
4604
|
c.current.push(b), s({ step: "splitting_shares" });
|
|
4608
|
-
const { shareA:
|
|
4609
|
-
c.current.push(
|
|
4610
|
-
const v = await Wr(
|
|
4605
|
+
const { shareA: C, shareB: N, shareC: P } = Jr(b);
|
|
4606
|
+
c.current.push(C, N, P), s({ step: "encrypting_shares" });
|
|
4607
|
+
const v = await Wr(C, Or(u)), E = Xr(b), L = Zr(E);
|
|
4611
4608
|
s({ step: "uploading" });
|
|
4612
4609
|
const S = {
|
|
4613
|
-
solanaPubkey:
|
|
4610
|
+
solanaPubkey: L,
|
|
4614
4611
|
shareAAuthMethod: m,
|
|
4615
4612
|
shareACiphertext: v.ciphertext,
|
|
4616
4613
|
shareANonce: v.nonce,
|
|
4617
4614
|
// Share B is now plaintext (SSS math protects it)
|
|
4618
|
-
shareB: ge(
|
|
4615
|
+
shareB: ge(N)
|
|
4619
4616
|
};
|
|
4620
4617
|
if (m === "password") {
|
|
4621
4618
|
if (!y) throw new Error("KDF salt required for password method");
|
|
@@ -4624,19 +4621,19 @@ function Fn() {
|
|
|
4624
4621
|
if (m === "passkey" && A && (S.prfSalt = A), await r(S), o === "none")
|
|
4625
4622
|
d(), s({
|
|
4626
4623
|
step: "complete",
|
|
4627
|
-
solanaPubkey:
|
|
4624
|
+
solanaPubkey: L
|
|
4628
4625
|
});
|
|
4629
4626
|
else {
|
|
4630
|
-
const B = o === "full_seed" ? Xo(b) : $o(He(
|
|
4627
|
+
const B = o === "full_seed" ? Xo(b) : $o(He(P));
|
|
4631
4628
|
s({
|
|
4632
4629
|
step: "showing_recovery",
|
|
4633
4630
|
recoveryPhrase: B,
|
|
4634
|
-
solanaPubkey:
|
|
4631
|
+
solanaPubkey: L
|
|
4635
4632
|
});
|
|
4636
4633
|
}
|
|
4637
4634
|
},
|
|
4638
4635
|
[r, o, d]
|
|
4639
|
-
), p =
|
|
4636
|
+
), p = x(
|
|
4640
4637
|
async (m) => {
|
|
4641
4638
|
if (!t) {
|
|
4642
4639
|
s({ step: "error", error: "User not authenticated" });
|
|
@@ -4656,7 +4653,7 @@ function Fn() {
|
|
|
4656
4653
|
}
|
|
4657
4654
|
},
|
|
4658
4655
|
[t, d, h]
|
|
4659
|
-
), f =
|
|
4656
|
+
), f = x(async () => {
|
|
4660
4657
|
if (!t) {
|
|
4661
4658
|
s({ step: "error", error: "User not authenticated" });
|
|
4662
4659
|
return;
|
|
@@ -4667,11 +4664,11 @@ function Fn() {
|
|
|
4667
4664
|
s({ step: "registering_passkey" });
|
|
4668
4665
|
let y;
|
|
4669
4666
|
try {
|
|
4670
|
-
const b = new TextEncoder().encode(t.id),
|
|
4667
|
+
const b = new TextEncoder().encode(t.id), C = t.name ?? t.email ?? "User", N = t.email ?? t.id;
|
|
4671
4668
|
y = (await zs(
|
|
4672
4669
|
b,
|
|
4673
|
-
E,
|
|
4674
4670
|
N,
|
|
4671
|
+
C,
|
|
4675
4672
|
m
|
|
4676
4673
|
)).prfOutput;
|
|
4677
4674
|
} catch (b) {
|
|
@@ -4690,13 +4687,13 @@ function Fn() {
|
|
|
4690
4687
|
} finally {
|
|
4691
4688
|
l(!1);
|
|
4692
4689
|
}
|
|
4693
|
-
}, [t, d, h]), g =
|
|
4690
|
+
}, [t, d, h]), g = x(() => {
|
|
4694
4691
|
const m = a.solanaPubkey;
|
|
4695
4692
|
d(), s({
|
|
4696
4693
|
step: "complete",
|
|
4697
4694
|
solanaPubkey: m
|
|
4698
4695
|
});
|
|
4699
|
-
}, [a.solanaPubkey, d]), w =
|
|
4696
|
+
}, [a.solanaPubkey, d]), w = x(() => {
|
|
4700
4697
|
d(), s({ step: "idle" }), l(!1);
|
|
4701
4698
|
}, [d]);
|
|
4702
4699
|
return {
|
|
@@ -4721,30 +4718,30 @@ function Un({
|
|
|
4721
4718
|
confirmRecoveryPhrase: d,
|
|
4722
4719
|
cancel: h,
|
|
4723
4720
|
isEnrolling: p
|
|
4724
|
-
} = Fn(), f = () => a || "password", [g, w] = k(f), [m, u] = k(""), [y, A] = k(""), [b,
|
|
4721
|
+
} = Fn(), f = () => a || "password", [g, w] = k(f), [m, u] = k(""), [y, A] = k(""), [b, C] = k(null);
|
|
4725
4722
|
_(() => {
|
|
4726
4723
|
w(f());
|
|
4727
4724
|
}, [s?.id, a]);
|
|
4728
|
-
const
|
|
4729
|
-
async (
|
|
4730
|
-
if (
|
|
4731
|
-
|
|
4725
|
+
const N = x(
|
|
4726
|
+
async (L) => {
|
|
4727
|
+
if (L.preventDefault(), m !== y) {
|
|
4728
|
+
C("Passwords do not match");
|
|
4732
4729
|
return;
|
|
4733
4730
|
}
|
|
4734
4731
|
const S = Ot(m);
|
|
4735
4732
|
if (!S.isValid) {
|
|
4736
4733
|
const B = Object.values(S.errors)[0];
|
|
4737
|
-
|
|
4734
|
+
C(B ?? "Password does not meet requirements");
|
|
4738
4735
|
return;
|
|
4739
4736
|
}
|
|
4740
|
-
|
|
4737
|
+
C(null), await l(m);
|
|
4741
4738
|
},
|
|
4742
4739
|
[m, y, l]
|
|
4743
|
-
),
|
|
4740
|
+
), P = x(async () => {
|
|
4744
4741
|
await c();
|
|
4745
|
-
}, [c]), v =
|
|
4742
|
+
}, [c]), v = x(() => {
|
|
4746
4743
|
d(), n.solanaPubkey && t?.(n.solanaPubkey);
|
|
4747
|
-
}, [d, n.solanaPubkey, t]),
|
|
4744
|
+
}, [d, n.solanaPubkey, t]), E = x(() => {
|
|
4748
4745
|
h(), r?.();
|
|
4749
4746
|
}, [h, r]);
|
|
4750
4747
|
return n.step === "generating_seed" || n.step === "splitting_shares" ? /* @__PURE__ */ e("div", { className: `cedros-wallet-enrollment ${o}`, "aria-busy": "true", children: /* @__PURE__ */ i("div", { className: "cedros-enrollment-progress", role: "status", "aria-live": "polite", children: [
|
|
@@ -4850,7 +4847,7 @@ function Un({
|
|
|
4850
4847
|
{
|
|
4851
4848
|
type: "button",
|
|
4852
4849
|
className: "cedros-button cedros-button-secondary",
|
|
4853
|
-
onClick:
|
|
4850
|
+
onClick: E,
|
|
4854
4851
|
children: "Cancel"
|
|
4855
4852
|
}
|
|
4856
4853
|
),
|
|
@@ -4903,13 +4900,13 @@ function Un({
|
|
|
4903
4900
|
/* @__PURE__ */ e("span", { children: "Passkey" })
|
|
4904
4901
|
] })
|
|
4905
4902
|
] }),
|
|
4906
|
-
g === "password" && /* @__PURE__ */ i("form", { onSubmit:
|
|
4903
|
+
g === "password" && /* @__PURE__ */ i("form", { onSubmit: N, className: "cedros-enrollment-form", children: [
|
|
4907
4904
|
/* @__PURE__ */ e(
|
|
4908
4905
|
we,
|
|
4909
4906
|
{
|
|
4910
4907
|
label: "Password",
|
|
4911
4908
|
value: m,
|
|
4912
|
-
onChange: (
|
|
4909
|
+
onChange: (L) => u(L.target.value),
|
|
4913
4910
|
showStrengthMeter: !0,
|
|
4914
4911
|
disabled: p,
|
|
4915
4912
|
required: !0,
|
|
@@ -4922,7 +4919,7 @@ function Un({
|
|
|
4922
4919
|
{
|
|
4923
4920
|
label: "Confirm Password",
|
|
4924
4921
|
value: y,
|
|
4925
|
-
onChange: (
|
|
4922
|
+
onChange: (L) => A(L.target.value),
|
|
4926
4923
|
error: b ?? void 0,
|
|
4927
4924
|
disabled: p,
|
|
4928
4925
|
required: !0,
|
|
@@ -4937,7 +4934,7 @@ function Un({
|
|
|
4937
4934
|
{
|
|
4938
4935
|
type: "button",
|
|
4939
4936
|
className: "cedros-button cedros-button-secondary",
|
|
4940
|
-
onClick:
|
|
4937
|
+
onClick: E,
|
|
4941
4938
|
disabled: p,
|
|
4942
4939
|
children: "Cancel"
|
|
4943
4940
|
}
|
|
@@ -4991,7 +4988,7 @@ function Un({
|
|
|
4991
4988
|
{
|
|
4992
4989
|
type: "button",
|
|
4993
4990
|
className: "cedros-button cedros-button-secondary",
|
|
4994
|
-
onClick:
|
|
4991
|
+
onClick: E,
|
|
4995
4992
|
disabled: p,
|
|
4996
4993
|
children: "Cancel"
|
|
4997
4994
|
}
|
|
@@ -5001,7 +4998,7 @@ function Un({
|
|
|
5001
4998
|
{
|
|
5002
4999
|
type: "button",
|
|
5003
5000
|
className: "cedros-button cedros-button-primary",
|
|
5004
|
-
onClick:
|
|
5001
|
+
onClick: P,
|
|
5005
5002
|
disabled: p,
|
|
5006
5003
|
children: p ? "Creating..." : "Use Passkey"
|
|
5007
5004
|
}
|
|
@@ -5011,7 +5008,7 @@ function Un({
|
|
|
5011
5008
|
] });
|
|
5012
5009
|
}
|
|
5013
5010
|
function _n() {
|
|
5014
|
-
const { user: t } = ne(), { signTransaction: r } = Pe(), [o, a] = k(!1), [s, n] = k(null), l =
|
|
5011
|
+
const { user: t } = ne(), { signTransaction: r } = Pe(), [o, a] = k(!1), [s, n] = k(null), l = x(
|
|
5015
5012
|
async (d, h) => {
|
|
5016
5013
|
if (!t) {
|
|
5017
5014
|
const p = "User not authenticated";
|
|
@@ -5032,7 +5029,7 @@ function _n() {
|
|
|
5032
5029
|
}
|
|
5033
5030
|
},
|
|
5034
5031
|
[t, r]
|
|
5035
|
-
), c =
|
|
5032
|
+
), c = x(() => n(null), []);
|
|
5036
5033
|
return {
|
|
5037
5034
|
signTransaction: l,
|
|
5038
5035
|
isSigning: o,
|
|
@@ -5041,7 +5038,7 @@ function _n() {
|
|
|
5041
5038
|
};
|
|
5042
5039
|
}
|
|
5043
5040
|
function Wn() {
|
|
5044
|
-
const { getMaterial: t } = Pe(), [r, o] = k(!1), [a, s] = k(null), n =
|
|
5041
|
+
const { getMaterial: t } = Pe(), [r, o] = k(!1), [a, s] = k(null), n = x(async () => {
|
|
5045
5042
|
o(!0), s(null);
|
|
5046
5043
|
try {
|
|
5047
5044
|
const c = await t();
|
|
@@ -5066,7 +5063,7 @@ function Wn() {
|
|
|
5066
5063
|
} finally {
|
|
5067
5064
|
o(!1);
|
|
5068
5065
|
}
|
|
5069
|
-
}, [t]), l =
|
|
5066
|
+
}, [t]), l = x(() => s(null), []);
|
|
5070
5067
|
return {
|
|
5071
5068
|
getPasskeyCredential: n,
|
|
5072
5069
|
isAuthenticating: r,
|
|
@@ -5085,9 +5082,9 @@ function On({
|
|
|
5085
5082
|
description: c,
|
|
5086
5083
|
className: d = ""
|
|
5087
5084
|
}) {
|
|
5088
|
-
const h =
|
|
5085
|
+
const h = x(() => {
|
|
5089
5086
|
r || a?.();
|
|
5090
|
-
}, [r, a]), p =
|
|
5087
|
+
}, [r, a]), p = x(() => {
|
|
5091
5088
|
s?.();
|
|
5092
5089
|
}, [s]), f = t === "register" ? "Set Up Passkey" : "Verify with Passkey", g = t === "register" ? "Create a passkey to securely encrypt your wallet on this device. You will use your fingerprint, face, or device PIN." : "Use your passkey to unlock your wallet. You will be prompted for biometric verification.";
|
|
5093
5090
|
return /* @__PURE__ */ i("div", { className: `cedros-passkey-prompt ${d}`, children: [
|
|
@@ -5206,7 +5203,7 @@ function Vn({
|
|
|
5206
5203
|
_(() => {
|
|
5207
5204
|
a !== void 0 && w(a);
|
|
5208
5205
|
}, [a]);
|
|
5209
|
-
const b = g === "password",
|
|
5206
|
+
const b = g === "password", C = g === "passkey", N = x(async () => {
|
|
5210
5207
|
if (f("credential"), A(null), !g)
|
|
5211
5208
|
try {
|
|
5212
5209
|
const T = await l();
|
|
@@ -5214,7 +5211,7 @@ function Vn({
|
|
|
5214
5211
|
} catch (T) {
|
|
5215
5212
|
A(T instanceof Error ? T.message : "Failed to get wallet info"), f("error");
|
|
5216
5213
|
}
|
|
5217
|
-
}, [g, l]),
|
|
5214
|
+
}, [g, l]), P = x(
|
|
5218
5215
|
async (T) => {
|
|
5219
5216
|
T.preventDefault(), A(null), f("unlocking");
|
|
5220
5217
|
try {
|
|
@@ -5229,7 +5226,7 @@ function Vn({
|
|
|
5229
5226
|
}
|
|
5230
5227
|
},
|
|
5231
5228
|
[b, m, n, t]
|
|
5232
|
-
), v =
|
|
5229
|
+
), v = x(async () => {
|
|
5233
5230
|
A(null), f("unlocking");
|
|
5234
5231
|
try {
|
|
5235
5232
|
const T = await d();
|
|
@@ -5241,9 +5238,9 @@ function Vn({
|
|
|
5241
5238
|
} catch (T) {
|
|
5242
5239
|
A(T instanceof Error ? T.message : "Failed to unlock wallet"), f("error");
|
|
5243
5240
|
}
|
|
5244
|
-
}, [d, n, t]),
|
|
5241
|
+
}, [d, n, t]), E = x(() => {
|
|
5245
5242
|
u(""), f("idle"), A(null), r?.();
|
|
5246
|
-
}, [r]),
|
|
5243
|
+
}, [r]), L = x(() => {
|
|
5247
5244
|
u(""), f("credential"), A(null);
|
|
5248
5245
|
}, []), S = c || h, B = () => {
|
|
5249
5246
|
switch (p) {
|
|
@@ -5257,13 +5254,13 @@ function Vn({
|
|
|
5257
5254
|
{
|
|
5258
5255
|
type: "button",
|
|
5259
5256
|
className: "cedros-button cedros-button-primary",
|
|
5260
|
-
onClick:
|
|
5257
|
+
onClick: N,
|
|
5261
5258
|
children: "Unlock Wallet"
|
|
5262
5259
|
}
|
|
5263
5260
|
)
|
|
5264
5261
|
] });
|
|
5265
5262
|
case "credential":
|
|
5266
|
-
return b ? /* @__PURE__ */ i("form", { className: "cedros-wallet-unlock-form", onSubmit:
|
|
5263
|
+
return b ? /* @__PURE__ */ i("form", { className: "cedros-wallet-unlock-form", onSubmit: P, children: [
|
|
5267
5264
|
/* @__PURE__ */ e("h3", { className: "cedros-wallet-unlock-title", children: "Enter Password" }),
|
|
5268
5265
|
/* @__PURE__ */ e("p", { className: "cedros-wallet-unlock-description", children: "Enter your wallet password to unlock." }),
|
|
5269
5266
|
/* @__PURE__ */ e(
|
|
@@ -5292,13 +5289,13 @@ function Vn({
|
|
|
5292
5289
|
{
|
|
5293
5290
|
type: "button",
|
|
5294
5291
|
className: "cedros-button cedros-button-secondary",
|
|
5295
|
-
onClick:
|
|
5292
|
+
onClick: E,
|
|
5296
5293
|
disabled: S,
|
|
5297
5294
|
children: "Cancel"
|
|
5298
5295
|
}
|
|
5299
5296
|
)
|
|
5300
5297
|
] })
|
|
5301
|
-
] }) :
|
|
5298
|
+
] }) : C ? /* @__PURE__ */ i("div", { className: "cedros-wallet-unlock-passkey", children: [
|
|
5302
5299
|
/* @__PURE__ */ e("h3", { className: "cedros-wallet-unlock-title", children: "Verify with Passkey" }),
|
|
5303
5300
|
/* @__PURE__ */ e("p", { className: "cedros-wallet-unlock-description", children: "Use your passkey to unlock your wallet." }),
|
|
5304
5301
|
/* @__PURE__ */ e(
|
|
@@ -5309,7 +5306,7 @@ function Vn({
|
|
|
5309
5306
|
error: y ?? void 0,
|
|
5310
5307
|
onPrompt: v,
|
|
5311
5308
|
onRetry: v,
|
|
5312
|
-
onCancel: o ?
|
|
5309
|
+
onCancel: o ? E : void 0
|
|
5313
5310
|
}
|
|
5314
5311
|
)
|
|
5315
5312
|
] }) : /* @__PURE__ */ i("div", { className: "cedros-wallet-unlock-loading", children: [
|
|
@@ -5339,7 +5336,7 @@ function Vn({
|
|
|
5339
5336
|
{
|
|
5340
5337
|
type: "button",
|
|
5341
5338
|
className: "cedros-button cedros-button-primary",
|
|
5342
|
-
onClick:
|
|
5339
|
+
onClick: L,
|
|
5343
5340
|
children: "Try Again"
|
|
5344
5341
|
}
|
|
5345
5342
|
),
|
|
@@ -5348,7 +5345,7 @@ function Vn({
|
|
|
5348
5345
|
{
|
|
5349
5346
|
type: "button",
|
|
5350
5347
|
className: "cedros-button cedros-button-secondary",
|
|
5351
|
-
onClick:
|
|
5348
|
+
onClick: E,
|
|
5352
5349
|
children: "Cancel"
|
|
5353
5350
|
}
|
|
5354
5351
|
)
|
|
@@ -5428,13 +5425,13 @@ function Kn() {
|
|
|
5428
5425
|
] });
|
|
5429
5426
|
}
|
|
5430
5427
|
function Yn() {
|
|
5431
|
-
const { recover: t, getShareBForRecovery: r } = Pe(), { recoveryMode: o } = us(), [a, s] = k({ step: "idle" }), [n, l] = k(!1), c = $([]), d =
|
|
5428
|
+
const { recover: t, getShareBForRecovery: r } = Pe(), { recoveryMode: o } = us(), [a, s] = k({ step: "idle" }), [n, l] = k(!1), c = $([]), d = x(() => {
|
|
5432
5429
|
_r(...c.current), c.current = [];
|
|
5433
5430
|
}, []);
|
|
5434
5431
|
_(() => () => {
|
|
5435
5432
|
d();
|
|
5436
5433
|
}, [d]);
|
|
5437
|
-
const h =
|
|
5434
|
+
const h = x(
|
|
5438
5435
|
async (f, g, w) => {
|
|
5439
5436
|
l(!0), d();
|
|
5440
5437
|
try {
|
|
@@ -5442,32 +5439,32 @@ function Yn() {
|
|
|
5442
5439
|
throw new Error("Invalid recovery phrase. Please check your words.");
|
|
5443
5440
|
let m;
|
|
5444
5441
|
if (o === "share_c_only") {
|
|
5445
|
-
const
|
|
5446
|
-
c.current.push(
|
|
5447
|
-
const S = ge(
|
|
5448
|
-
c.current.push(T), m = Io(He(T), He(
|
|
5442
|
+
const L = Jo(f);
|
|
5443
|
+
c.current.push(L);
|
|
5444
|
+
const S = ge(L), B = await r({ shareC: S }), T = Vr(B.shareB);
|
|
5445
|
+
c.current.push(T), m = Io(He(T), He(L)), c.current.push(m);
|
|
5449
5446
|
} else
|
|
5450
5447
|
m = Zo(f), c.current.push(m);
|
|
5451
5448
|
const u = Xr(m), y = Zr(u), { shareA: A, shareB: b } = Jr(m);
|
|
5452
5449
|
c.current.push(A, b), s({ step: "encrypting" });
|
|
5453
|
-
let
|
|
5450
|
+
let C, N, P;
|
|
5454
5451
|
if (g === "passkey") {
|
|
5455
|
-
const
|
|
5456
|
-
|
|
5457
|
-
const S = await Wt(
|
|
5458
|
-
c.current.push(S.prfOutput),
|
|
5452
|
+
const L = jr();
|
|
5453
|
+
P = ge(L);
|
|
5454
|
+
const S = await Wt(P);
|
|
5455
|
+
c.current.push(S.prfOutput), C = await zr(S.prfOutput, L), c.current.push(C);
|
|
5459
5456
|
} else
|
|
5460
|
-
|
|
5461
|
-
const v = await Wr(A, Or(
|
|
5457
|
+
N = qr(), C = await es(w, N, Qe), c.current.push(C);
|
|
5458
|
+
const v = await Wr(A, Or(C));
|
|
5462
5459
|
s({ step: "uploading" });
|
|
5463
|
-
const
|
|
5460
|
+
const E = {
|
|
5464
5461
|
solanaPubkey: y,
|
|
5465
5462
|
shareAAuthMethod: g,
|
|
5466
5463
|
shareACiphertext: v.ciphertext,
|
|
5467
5464
|
shareANonce: v.nonce,
|
|
5468
5465
|
shareB: ge(b)
|
|
5469
5466
|
};
|
|
5470
|
-
g === "password" && (
|
|
5467
|
+
g === "password" && (E.shareAKdfSalt = ge(N), E.shareAKdfParams = Qe), g === "passkey" && (E.prfSalt = P), await t(E), d(), s({ step: "complete" });
|
|
5471
5468
|
} catch (m) {
|
|
5472
5469
|
d(), s({
|
|
5473
5470
|
step: "error",
|
|
@@ -5478,7 +5475,7 @@ function Yn() {
|
|
|
5478
5475
|
}
|
|
5479
5476
|
},
|
|
5480
5477
|
[t, r, o, d]
|
|
5481
|
-
), p =
|
|
5478
|
+
), p = x(() => {
|
|
5482
5479
|
d(), s({ step: "idle" }), l(!1);
|
|
5483
5480
|
}, [d]);
|
|
5484
5481
|
return {
|
|
@@ -5494,28 +5491,28 @@ function Gn({
|
|
|
5494
5491
|
className: o = "",
|
|
5495
5492
|
defaultAuthMethod: a = "password"
|
|
5496
5493
|
}) {
|
|
5497
|
-
const { state: s, startRecovery: n, cancel: l, isRecovering: c } = Yn(), [d, h] = k([]), [p, f] = k(!1), [g, w] = k(a), [m, u] = k(""), [y, A] = k(""), [b,
|
|
5494
|
+
const { state: s, startRecovery: n, cancel: l, isRecovering: c } = Yn(), [d, h] = k([]), [p, f] = k(!1), [g, w] = k(a), [m, u] = k(""), [y, A] = k(""), [b, C] = k(null), N = x((S) => {
|
|
5498
5495
|
h(S), f(!0);
|
|
5499
|
-
}, []),
|
|
5496
|
+
}, []), P = x(
|
|
5500
5497
|
async (S) => {
|
|
5501
|
-
if (S.preventDefault(),
|
|
5498
|
+
if (S.preventDefault(), C(null), g !== "passkey") {
|
|
5502
5499
|
if (m !== y) {
|
|
5503
|
-
|
|
5500
|
+
C("Passwords do not match");
|
|
5504
5501
|
return;
|
|
5505
5502
|
}
|
|
5506
5503
|
if (g === "password" && m.length < 8) {
|
|
5507
|
-
|
|
5504
|
+
C("Password must be at least 8 characters");
|
|
5508
5505
|
return;
|
|
5509
5506
|
}
|
|
5510
5507
|
}
|
|
5511
5508
|
await n(d, g, m);
|
|
5512
5509
|
},
|
|
5513
5510
|
[d, g, m, y, n]
|
|
5514
|
-
), v =
|
|
5511
|
+
), v = x(() => {
|
|
5515
5512
|
l(), h([]), f(!1), u(""), A(""), r?.();
|
|
5516
|
-
}, [l, r]),
|
|
5513
|
+
}, [l, r]), E = x(() => {
|
|
5517
5514
|
f(!1), u(""), A("");
|
|
5518
|
-
}, []),
|
|
5515
|
+
}, []), L = x(() => {
|
|
5519
5516
|
t?.();
|
|
5520
5517
|
}, [t]);
|
|
5521
5518
|
return s.step === "validating" || s.step === "encrypting" || s.step === "uploading" ? /* @__PURE__ */ e("div", { className: `cedros-wallet-recovery ${o}`, children: /* @__PURE__ */ i("div", { className: "cedros-wallet-recovery-progress", children: [
|
|
@@ -5544,7 +5541,7 @@ function Gn({
|
|
|
5544
5541
|
{
|
|
5545
5542
|
type: "button",
|
|
5546
5543
|
className: "cedros-button cedros-button-primary",
|
|
5547
|
-
onClick:
|
|
5544
|
+
onClick: L,
|
|
5548
5545
|
children: "Done"
|
|
5549
5546
|
}
|
|
5550
5547
|
) })
|
|
@@ -5561,7 +5558,7 @@ function Gn({
|
|
|
5561
5558
|
children: "Start Over"
|
|
5562
5559
|
}
|
|
5563
5560
|
) })
|
|
5564
|
-
] }) }) : p ? /* @__PURE__ */ e("div", { className: `cedros-wallet-recovery ${o}`, children: /* @__PURE__ */ i("form", { className: "cedros-wallet-recovery-credential", onSubmit:
|
|
5561
|
+
] }) }) : p ? /* @__PURE__ */ e("div", { className: `cedros-wallet-recovery ${o}`, children: /* @__PURE__ */ i("form", { className: "cedros-wallet-recovery-credential", onSubmit: P, children: [
|
|
5565
5562
|
/* @__PURE__ */ i("div", { className: "cedros-wallet-recovery-header", children: [
|
|
5566
5563
|
/* @__PURE__ */ e("h3", { className: "cedros-wallet-recovery-title", children: "Set New Security" }),
|
|
5567
5564
|
/* @__PURE__ */ e("p", { className: "cedros-wallet-recovery-description", children: "Choose how to secure your recovered wallet." })
|
|
@@ -5641,7 +5638,7 @@ function Gn({
|
|
|
5641
5638
|
{
|
|
5642
5639
|
type: "button",
|
|
5643
5640
|
className: "cedros-button cedros-button-secondary",
|
|
5644
|
-
onClick:
|
|
5641
|
+
onClick: E,
|
|
5645
5642
|
disabled: c,
|
|
5646
5643
|
children: "Back"
|
|
5647
5644
|
}
|
|
@@ -5664,7 +5661,7 @@ function Gn({
|
|
|
5664
5661
|
/* @__PURE__ */ e(
|
|
5665
5662
|
Bn,
|
|
5666
5663
|
{
|
|
5667
|
-
onSubmit:
|
|
5664
|
+
onSubmit: N,
|
|
5668
5665
|
onCancel: v,
|
|
5669
5666
|
isSubmitting: !1
|
|
5670
5667
|
}
|
|
@@ -5784,15 +5781,15 @@ function ea({
|
|
|
5784
5781
|
className: n = ""
|
|
5785
5782
|
}) {
|
|
5786
5783
|
const l = ve(), [c, d] = k(!1), [h, p] = k(null), [f, g] = k(!1), w = $(null), m = l?.config.solana?.network ?? "mainnet-beta", u = q(() => {
|
|
5787
|
-
const
|
|
5788
|
-
return m === "mainnet-beta" ?
|
|
5789
|
-
}, [t, m]), y = s && t.length > 18, A = q(() => !y || f ? t : `${t.slice(0, 8)}...${t.slice(-8)}`, [t, y, f]), b =
|
|
5784
|
+
const C = `https://explorer.solana.com/address/${t}`;
|
|
5785
|
+
return m === "mainnet-beta" ? C : `${C}?cluster=${encodeURIComponent(m)}`;
|
|
5786
|
+
}, [t, m]), y = s && t.length > 18, A = q(() => !y || f ? t : `${t.slice(0, 8)}...${t.slice(-8)}`, [t, y, f]), b = x(async () => {
|
|
5790
5787
|
try {
|
|
5791
5788
|
p(null), await navigator.clipboard.writeText(t), d(!0), w.current !== null && window.clearTimeout(w.current), w.current = window.setTimeout(() => {
|
|
5792
5789
|
d(!1), w.current = null;
|
|
5793
5790
|
}, 2e3);
|
|
5794
|
-
} catch (
|
|
5795
|
-
d(!1), p(
|
|
5791
|
+
} catch (C) {
|
|
5792
|
+
d(!1), p(C instanceof Error ? C.message : "Copy failed");
|
|
5796
5793
|
}
|
|
5797
5794
|
}, [t]);
|
|
5798
5795
|
return _(() => () => {
|
|
@@ -5806,7 +5803,7 @@ function ea({
|
|
|
5806
5803
|
{
|
|
5807
5804
|
type: "button",
|
|
5808
5805
|
className: "cedros-button cedros-button-sm cedros-button-ghost",
|
|
5809
|
-
onClick: () => g((
|
|
5806
|
+
onClick: () => g((C) => !C),
|
|
5810
5807
|
"aria-label": f ? "Hide full wallet address" : "Show full wallet address",
|
|
5811
5808
|
children: f ? /* @__PURE__ */ i("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
5812
5809
|
/* @__PURE__ */ e(
|
|
@@ -6136,11 +6133,11 @@ function uc({ className: t = "", showActions: r = !0 }) {
|
|
|
6136
6133
|
default:
|
|
6137
6134
|
return null;
|
|
6138
6135
|
}
|
|
6139
|
-
}, [a]), l =
|
|
6136
|
+
}, [a]), l = x(() => s("status"), []), c = x(async () => {
|
|
6140
6137
|
s("status"), await o.refresh();
|
|
6141
|
-
}, [o]), d =
|
|
6138
|
+
}, [o]), d = x(async () => {
|
|
6142
6139
|
s("status"), await o.refresh();
|
|
6143
|
-
}, [o]), h =
|
|
6140
|
+
}, [o]), h = x(async () => {
|
|
6144
6141
|
s("status"), await o.refresh();
|
|
6145
6142
|
}, [o]);
|
|
6146
6143
|
return /* @__PURE__ */ i("div", { className: `cedros-wallet-manager ${t}`, children: [
|
|
@@ -6235,26 +6232,26 @@ function hc({
|
|
|
6235
6232
|
c();
|
|
6236
6233
|
}, [c]), _(() => {
|
|
6237
6234
|
if (w) {
|
|
6238
|
-
const
|
|
6239
|
-
return () => clearTimeout(
|
|
6235
|
+
const P = setTimeout(() => m(!1), 3e3);
|
|
6236
|
+
return () => clearTimeout(P);
|
|
6240
6237
|
}
|
|
6241
6238
|
}, [w]);
|
|
6242
|
-
const u =
|
|
6243
|
-
p((
|
|
6244
|
-
}, []), y =
|
|
6245
|
-
const
|
|
6239
|
+
const u = x((P, v) => {
|
|
6240
|
+
p((E) => ({ ...E, [P]: v })), g(null), m(!1);
|
|
6241
|
+
}, []), y = x(async () => {
|
|
6242
|
+
const P = Object.entries(h).map(([v, E]) => ({
|
|
6246
6243
|
key: v,
|
|
6247
|
-
value:
|
|
6244
|
+
value: E
|
|
6248
6245
|
}));
|
|
6249
|
-
if (
|
|
6246
|
+
if (P.length !== 0)
|
|
6250
6247
|
try {
|
|
6251
|
-
await d(
|
|
6248
|
+
await d(P), p({}), g(null), m(!0), o?.();
|
|
6252
6249
|
} catch (v) {
|
|
6253
6250
|
g(v instanceof Error ? v.message : "Failed to save settings");
|
|
6254
6251
|
}
|
|
6255
|
-
}, [h, d, o]), A =
|
|
6252
|
+
}, [h, d, o]), A = x(() => {
|
|
6256
6253
|
p({}), g(null), m(!1);
|
|
6257
|
-
}, []), b = Object.keys(h).length > 0,
|
|
6254
|
+
}, []), b = Object.keys(h).length > 0, C = Object.keys(h).length;
|
|
6258
6255
|
if (s && Object.keys(a).length === 0)
|
|
6259
6256
|
return /* @__PURE__ */ i("div", { className: `cedros-system-settings cedros-system-settings-loading ${r}`, children: [
|
|
6260
6257
|
/* @__PURE__ */ e(Y, {}),
|
|
@@ -6262,26 +6259,26 @@ function hc({
|
|
|
6262
6259
|
] });
|
|
6263
6260
|
if (l)
|
|
6264
6261
|
return /* @__PURE__ */ e("div", { className: `cedros-system-settings ${r}`, children: /* @__PURE__ */ e(ee, { error: l.message }) });
|
|
6265
|
-
const
|
|
6266
|
-
return
|
|
6262
|
+
const N = Object.keys(a).sort();
|
|
6263
|
+
return N.length === 0 ? /* @__PURE__ */ e("div", { className: `cedros-system-settings cedros-system-settings-empty ${r}`, children: /* @__PURE__ */ e("p", { children: "No system settings found." }) }) : /* @__PURE__ */ i("div", { className: `cedros-system-settings ${r}`, children: [
|
|
6267
6264
|
f && /* @__PURE__ */ e(ee, { error: f }),
|
|
6268
6265
|
w && /* @__PURE__ */ e("div", { className: "cedros-settings-success", children: "Settings saved successfully." }),
|
|
6269
|
-
|
|
6266
|
+
N.map((P) => /* @__PURE__ */ e(
|
|
6270
6267
|
na,
|
|
6271
6268
|
{
|
|
6272
|
-
category:
|
|
6273
|
-
settings: a[
|
|
6269
|
+
category: P,
|
|
6270
|
+
settings: a[P],
|
|
6274
6271
|
edits: h,
|
|
6275
6272
|
showDescription: t,
|
|
6276
6273
|
onChange: u
|
|
6277
6274
|
},
|
|
6278
|
-
|
|
6275
|
+
P
|
|
6279
6276
|
)),
|
|
6280
6277
|
/* @__PURE__ */ i("div", { className: "cedros-system-settings-actions", children: [
|
|
6281
6278
|
b && /* @__PURE__ */ i("span", { className: "cedros-settings-change-count", children: [
|
|
6282
|
-
|
|
6279
|
+
C,
|
|
6283
6280
|
" unsaved change",
|
|
6284
|
-
|
|
6281
|
+
C !== 1 ? "s" : ""
|
|
6285
6282
|
] }),
|
|
6286
6283
|
/* @__PURE__ */ e(
|
|
6287
6284
|
"button",
|
|
@@ -6367,7 +6364,7 @@ function hs() {
|
|
|
6367
6364
|
[t.serverUrl, t.requestTimeout, t.retryAttempts]
|
|
6368
6365
|
), f = $(p);
|
|
6369
6366
|
f.current = p;
|
|
6370
|
-
const g =
|
|
6367
|
+
const g = x(async () => {
|
|
6371
6368
|
s(!0), d(null);
|
|
6372
6369
|
const m = ++h.current;
|
|
6373
6370
|
try {
|
|
@@ -6380,7 +6377,7 @@ function hs() {
|
|
|
6380
6377
|
} finally {
|
|
6381
6378
|
m === h.current && s(!1);
|
|
6382
6379
|
}
|
|
6383
|
-
}, []), w =
|
|
6380
|
+
}, []), w = x(
|
|
6384
6381
|
async (m) => {
|
|
6385
6382
|
l(!0), d(null);
|
|
6386
6383
|
try {
|
|
@@ -6420,12 +6417,12 @@ function la({ onComplete: t, className: r = "" }) {
|
|
|
6420
6417
|
_(() => {
|
|
6421
6418
|
l();
|
|
6422
6419
|
}, [l]);
|
|
6423
|
-
const m =
|
|
6420
|
+
const m = x(
|
|
6424
6421
|
(y) => (A) => {
|
|
6425
6422
|
h((b) => ({ ...b, [y]: A.target.value })), f((b) => ({ ...b, [y]: void 0 }));
|
|
6426
6423
|
},
|
|
6427
6424
|
[]
|
|
6428
|
-
), u =
|
|
6425
|
+
), u = x(
|
|
6429
6426
|
async (y) => {
|
|
6430
6427
|
y.preventDefault();
|
|
6431
6428
|
const A = ca(d);
|
|
@@ -6649,14 +6646,14 @@ function ua({ className: t }) {
|
|
|
6649
6646
|
_(() => {
|
|
6650
6647
|
c();
|
|
6651
6648
|
}, [c]);
|
|
6652
|
-
const g = ar.find((
|
|
6653
|
-
const
|
|
6654
|
-
if (p !== "email") return
|
|
6655
|
-
const
|
|
6656
|
-
return
|
|
6657
|
-
}, [r, w, p, u]),
|
|
6658
|
-
if (d(
|
|
6659
|
-
const v = Mo[
|
|
6649
|
+
const g = ar.find((N) => N.id === p), w = g?.category ?? "", u = (h("email_provider") || "custom") === "custom", y = h("email_smtp_host"), A = !u || y != null && y !== "", b = q(() => {
|
|
6650
|
+
const N = r[w] ?? [];
|
|
6651
|
+
if (p !== "email") return N;
|
|
6652
|
+
const P = u ? Po : Lo;
|
|
6653
|
+
return N.filter((v) => P.includes(v.key)).sort((v, E) => P.indexOf(v.key) - P.indexOf(E.key));
|
|
6654
|
+
}, [r, w, p, u]), C = (N, P) => {
|
|
6655
|
+
if (d(N, P), N === "email_provider" && P !== "custom") {
|
|
6656
|
+
const v = Mo[P];
|
|
6660
6657
|
v && (d("email_smtp_host", v), d("email_smtp_port", "587"), d("email_smtp_tls", "true"));
|
|
6661
6658
|
}
|
|
6662
6659
|
};
|
|
@@ -6672,17 +6669,17 @@ function ua({ className: t }) {
|
|
|
6672
6669
|
/* @__PURE__ */ e(po, { status: s, error: n })
|
|
6673
6670
|
] }),
|
|
6674
6671
|
p === "email" && !A && /* @__PURE__ */ e("div", { className: "cedros-settings-warning-banner", children: "Email features (verification, password reset, instant link) are disabled until SMTP is configured. Select a provider or enter custom SMTP settings below." }),
|
|
6675
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-tabs cedros-admin-tabs--line", children: ar.map((
|
|
6672
|
+
/* @__PURE__ */ e("div", { className: "cedros-admin-tabs cedros-admin-tabs--line", children: ar.map((N) => /* @__PURE__ */ e(
|
|
6676
6673
|
"button",
|
|
6677
6674
|
{
|
|
6678
6675
|
type: "button",
|
|
6679
|
-
className: `cedros-admin-tab ${p ===
|
|
6680
|
-
onClick: () => f(
|
|
6681
|
-
"aria-selected": p ===
|
|
6676
|
+
className: `cedros-admin-tab ${p === N.id ? "cedros-admin-tab-active" : ""}`,
|
|
6677
|
+
onClick: () => f(N.id),
|
|
6678
|
+
"aria-selected": p === N.id,
|
|
6682
6679
|
role: "tab",
|
|
6683
|
-
children:
|
|
6680
|
+
children: N.label
|
|
6684
6681
|
},
|
|
6685
|
-
|
|
6682
|
+
N.id
|
|
6686
6683
|
)) }),
|
|
6687
6684
|
/* @__PURE__ */ e("div", { className: "cedros-admin-tab-content", role: "tabpanel", children: b.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-system-settings-empty", children: /* @__PURE__ */ i("p", { children: [
|
|
6688
6685
|
"No settings found for ",
|
|
@@ -6693,7 +6690,7 @@ function ua({ className: t }) {
|
|
|
6693
6690
|
{
|
|
6694
6691
|
settings: b,
|
|
6695
6692
|
edits: o,
|
|
6696
|
-
onChange: p === "email" ?
|
|
6693
|
+
onChange: p === "email" ? C : d
|
|
6697
6694
|
}
|
|
6698
6695
|
) })
|
|
6699
6696
|
] });
|
|
@@ -6922,17 +6919,17 @@ function mc({
|
|
|
6922
6919
|
onLogoutClick: c,
|
|
6923
6920
|
className: d = ""
|
|
6924
6921
|
}) {
|
|
6925
|
-
const [h, p] = k(o), [f, g] = k(!0), { user: w, logout: m } = ne(), { activeOrg: u, role: y, isLoading: A, fetchOrgs: b, hasPermission:
|
|
6922
|
+
const [h, p] = k(o), [f, g] = k(!0), { user: w, logout: m } = ne(), { activeOrg: u, role: y, isLoading: A, fetchOrgs: b, hasPermission: C } = mo(), { status: N, isLoading: P, checkStatus: v } = hs(), { features: E, isLoading: L } = eo(), { canAccess: S } = to(), B = x(
|
|
6926
6923
|
(F) => {
|
|
6927
6924
|
p(F), n?.(F);
|
|
6928
6925
|
},
|
|
6929
6926
|
[n]
|
|
6930
|
-
), T = ha.filter((F) => !(!r.includes(F.id) || F.requiredFeature && !
|
|
6927
|
+
), T = ha.filter((F) => !(!r.includes(F.id) || F.requiredFeature && !E[F.requiredFeature] || !S(F.id))), M = T.find((F) => F.id === h), R = !M && !L;
|
|
6931
6928
|
return _(() => {
|
|
6932
6929
|
b(), v();
|
|
6933
6930
|
}, [b, v]), _(() => {
|
|
6934
6931
|
R && T.length > 0 && p("users");
|
|
6935
|
-
}, [R, T.length]), !
|
|
6932
|
+
}, [R, T.length]), !P && N?.needsSetup ? /* @__PURE__ */ e("div", { className: `cedros-admin cedros-dashboard cedros-dashboard--setup ${d}`, children: /* @__PURE__ */ e(la, { onComplete: () => v() }) }) : (A || P || L) && !u ? /* @__PURE__ */ i("div", { className: `cedros-admin cedros-dashboard cedros-dashboard--loading ${d}`, children: [
|
|
6936
6933
|
/* @__PURE__ */ e(Y, {}),
|
|
6937
6934
|
/* @__PURE__ */ e("span", { className: "cedros-dashboard__loading-text", children: "Loading..." })
|
|
6938
6935
|
] }) : h === "team" && !u ? /* @__PURE__ */ e("div", { className: `cedros-admin cedros-dashboard ${d}`, children: /* @__PURE__ */ e(ee, { error: "No organization selected. Please select an organization first." }) }) : /* @__PURE__ */ i("div", { className: `cedros-admin cedros-dashboard ${d}`, children: [
|
|
@@ -7019,7 +7016,7 @@ function mc({
|
|
|
7019
7016
|
{
|
|
7020
7017
|
orgId: u.id,
|
|
7021
7018
|
currentUserId: w?.id,
|
|
7022
|
-
hasPermission:
|
|
7019
|
+
hasPermission: C,
|
|
7023
7020
|
role: y
|
|
7024
7021
|
}
|
|
7025
7022
|
),
|
|
@@ -7076,19 +7073,19 @@ function ma({ orgId: t, currentUserId: r, hasPermission: o, role: a }) {
|
|
|
7076
7073
|
_(() => {
|
|
7077
7074
|
h(), u();
|
|
7078
7075
|
}, [h, u]);
|
|
7079
|
-
const
|
|
7076
|
+
const C = o("invite:create"), N = o("invite:cancel"), P = g.length, v = l.reduce(
|
|
7080
7077
|
(B, T) => (B[T.role] = (B[T.role] ?? 0) + 1, B),
|
|
7081
7078
|
{}
|
|
7082
|
-
),
|
|
7079
|
+
), E = v.owner ?? 0, L = v.admin ?? 0, S = v.member ?? 0;
|
|
7083
7080
|
return /* @__PURE__ */ i("div", { className: "cedros-dashboard__team", children: [
|
|
7084
7081
|
/* @__PURE__ */ e(
|
|
7085
7082
|
$r,
|
|
7086
7083
|
{
|
|
7087
7084
|
stats: [
|
|
7088
|
-
{ label: "Owners", value:
|
|
7089
|
-
{ label: "Admins", value:
|
|
7085
|
+
{ label: "Owners", value: E },
|
|
7086
|
+
{ label: "Admins", value: L },
|
|
7090
7087
|
{ label: "Members", value: S },
|
|
7091
|
-
{ label: "Pending Invites", value:
|
|
7088
|
+
{ label: "Pending Invites", value: P }
|
|
7092
7089
|
]
|
|
7093
7090
|
}
|
|
7094
7091
|
),
|
|
@@ -7114,7 +7111,7 @@ function ma({ orgId: t, currentUserId: r, hasPermission: o, role: a }) {
|
|
|
7114
7111
|
role: "tab",
|
|
7115
7112
|
children: [
|
|
7116
7113
|
"Pending Invites",
|
|
7117
|
-
|
|
7114
|
+
P > 0 && ` (${P})`
|
|
7118
7115
|
]
|
|
7119
7116
|
}
|
|
7120
7117
|
),
|
|
@@ -7145,7 +7142,7 @@ function ma({ orgId: t, currentUserId: r, hasPermission: o, role: a }) {
|
|
|
7145
7142
|
}
|
|
7146
7143
|
),
|
|
7147
7144
|
s === "invites" && /* @__PURE__ */ i("div", { className: "cedros-dashboard__invites", children: [
|
|
7148
|
-
|
|
7145
|
+
C && /* @__PURE__ */ i("div", { className: "cedros-dashboard__section", children: [
|
|
7149
7146
|
/* @__PURE__ */ e("div", { className: "cedros-dashboard__section-header", children: /* @__PURE__ */ e("h3", { className: "cedros-dashboard__section-title", children: "Send Invitation" }) }),
|
|
7150
7147
|
/* @__PURE__ */ e(
|
|
7151
7148
|
no,
|
|
@@ -7162,9 +7159,9 @@ function ma({ orgId: t, currentUserId: r, hasPermission: o, role: a }) {
|
|
|
7162
7159
|
invites: g,
|
|
7163
7160
|
isLoading: w,
|
|
7164
7161
|
error: m?.message,
|
|
7165
|
-
canManage:
|
|
7166
|
-
onCancel:
|
|
7167
|
-
onResend:
|
|
7162
|
+
canManage: N || C,
|
|
7163
|
+
onCancel: N ? A : void 0,
|
|
7164
|
+
onResend: C ? b : void 0
|
|
7168
7165
|
}
|
|
7169
7166
|
) })
|
|
7170
7167
|
] }),
|
|
@@ -8063,17 +8060,17 @@ function Sa() {
|
|
|
8063
8060
|
typeof u > "u" && (u = s.BYTE);
|
|
8064
8061
|
const y = r.getSymbolTotalCodewords(w), A = o.getTotalCodewordsCount(w, m), b = (y - A) * 8;
|
|
8065
8062
|
if (u === s.MIXED) return b;
|
|
8066
|
-
const
|
|
8063
|
+
const C = b - h(u, w);
|
|
8067
8064
|
switch (u) {
|
|
8068
8065
|
case s.NUMERIC:
|
|
8069
|
-
return Math.floor(
|
|
8066
|
+
return Math.floor(C / 10 * 3);
|
|
8070
8067
|
case s.ALPHANUMERIC:
|
|
8071
|
-
return Math.floor(
|
|
8068
|
+
return Math.floor(C / 11 * 2);
|
|
8072
8069
|
case s.KANJI:
|
|
8073
|
-
return Math.floor(
|
|
8070
|
+
return Math.floor(C / 13);
|
|
8074
8071
|
case s.BYTE:
|
|
8075
8072
|
default:
|
|
8076
|
-
return Math.floor(
|
|
8073
|
+
return Math.floor(C / 8);
|
|
8077
8074
|
}
|
|
8078
8075
|
}, t.getBestVersionForData = function(w, m) {
|
|
8079
8076
|
let u;
|
|
@@ -8326,28 +8323,28 @@ function Ra() {
|
|
|
8326
8323
|
function h(A) {
|
|
8327
8324
|
return unescape(encodeURIComponent(A)).length;
|
|
8328
8325
|
}
|
|
8329
|
-
function p(A, b,
|
|
8330
|
-
const
|
|
8331
|
-
let
|
|
8332
|
-
for (; (
|
|
8333
|
-
|
|
8334
|
-
data:
|
|
8335
|
-
index:
|
|
8326
|
+
function p(A, b, C) {
|
|
8327
|
+
const N = [];
|
|
8328
|
+
let P;
|
|
8329
|
+
for (; (P = A.exec(C)) !== null; )
|
|
8330
|
+
N.push({
|
|
8331
|
+
data: P[0],
|
|
8332
|
+
index: P.index,
|
|
8336
8333
|
mode: b,
|
|
8337
|
-
length:
|
|
8334
|
+
length: P[0].length
|
|
8338
8335
|
});
|
|
8339
|
-
return
|
|
8336
|
+
return N;
|
|
8340
8337
|
}
|
|
8341
8338
|
function f(A) {
|
|
8342
|
-
const b = p(l.NUMERIC, r.NUMERIC, A),
|
|
8343
|
-
let
|
|
8344
|
-
return c.isKanjiModeEnabled() ? (
|
|
8345
|
-
return
|
|
8346
|
-
}).map(function(
|
|
8339
|
+
const b = p(l.NUMERIC, r.NUMERIC, A), C = p(l.ALPHANUMERIC, r.ALPHANUMERIC, A);
|
|
8340
|
+
let N, P;
|
|
8341
|
+
return c.isKanjiModeEnabled() ? (N = p(l.BYTE, r.BYTE, A), P = p(l.KANJI, r.KANJI, A)) : (N = p(l.BYTE_KANJI, r.BYTE, A), P = []), b.concat(C, N, P).sort(function(E, L) {
|
|
8342
|
+
return E.index - L.index;
|
|
8343
|
+
}).map(function(E) {
|
|
8347
8344
|
return {
|
|
8348
|
-
data:
|
|
8349
|
-
mode:
|
|
8350
|
-
length:
|
|
8345
|
+
data: E.data,
|
|
8346
|
+
mode: E.mode,
|
|
8347
|
+
length: E.length
|
|
8351
8348
|
};
|
|
8352
8349
|
});
|
|
8353
8350
|
}
|
|
@@ -8364,69 +8361,69 @@ function Ra() {
|
|
|
8364
8361
|
}
|
|
8365
8362
|
}
|
|
8366
8363
|
function w(A) {
|
|
8367
|
-
return A.reduce(function(b,
|
|
8368
|
-
const
|
|
8369
|
-
return
|
|
8364
|
+
return A.reduce(function(b, C) {
|
|
8365
|
+
const N = b.length - 1 >= 0 ? b[b.length - 1] : null;
|
|
8366
|
+
return N && N.mode === C.mode ? (b[b.length - 1].data += C.data, b) : (b.push(C), b);
|
|
8370
8367
|
}, []);
|
|
8371
8368
|
}
|
|
8372
8369
|
function m(A) {
|
|
8373
8370
|
const b = [];
|
|
8374
|
-
for (let
|
|
8375
|
-
const
|
|
8376
|
-
switch (
|
|
8371
|
+
for (let C = 0; C < A.length; C++) {
|
|
8372
|
+
const N = A[C];
|
|
8373
|
+
switch (N.mode) {
|
|
8377
8374
|
case r.NUMERIC:
|
|
8378
8375
|
b.push([
|
|
8379
|
-
|
|
8380
|
-
{ data:
|
|
8381
|
-
{ data:
|
|
8376
|
+
N,
|
|
8377
|
+
{ data: N.data, mode: r.ALPHANUMERIC, length: N.length },
|
|
8378
|
+
{ data: N.data, mode: r.BYTE, length: N.length }
|
|
8382
8379
|
]);
|
|
8383
8380
|
break;
|
|
8384
8381
|
case r.ALPHANUMERIC:
|
|
8385
8382
|
b.push([
|
|
8386
|
-
|
|
8387
|
-
{ data:
|
|
8383
|
+
N,
|
|
8384
|
+
{ data: N.data, mode: r.BYTE, length: N.length }
|
|
8388
8385
|
]);
|
|
8389
8386
|
break;
|
|
8390
8387
|
case r.KANJI:
|
|
8391
8388
|
b.push([
|
|
8392
|
-
|
|
8393
|
-
{ data:
|
|
8389
|
+
N,
|
|
8390
|
+
{ data: N.data, mode: r.BYTE, length: h(N.data) }
|
|
8394
8391
|
]);
|
|
8395
8392
|
break;
|
|
8396
8393
|
case r.BYTE:
|
|
8397
8394
|
b.push([
|
|
8398
|
-
{ data:
|
|
8395
|
+
{ data: N.data, mode: r.BYTE, length: h(N.data) }
|
|
8399
8396
|
]);
|
|
8400
8397
|
}
|
|
8401
8398
|
}
|
|
8402
8399
|
return b;
|
|
8403
8400
|
}
|
|
8404
8401
|
function u(A, b) {
|
|
8405
|
-
const
|
|
8406
|
-
let
|
|
8402
|
+
const C = {}, N = { start: {} };
|
|
8403
|
+
let P = ["start"];
|
|
8407
8404
|
for (let v = 0; v < A.length; v++) {
|
|
8408
|
-
const
|
|
8409
|
-
for (let S = 0; S <
|
|
8410
|
-
const B =
|
|
8411
|
-
|
|
8412
|
-
for (let M = 0; M <
|
|
8413
|
-
const R =
|
|
8414
|
-
|
|
8405
|
+
const E = A[v], L = [];
|
|
8406
|
+
for (let S = 0; S < E.length; S++) {
|
|
8407
|
+
const B = E[S], T = "" + v + S;
|
|
8408
|
+
L.push(T), C[T] = { node: B, lastCount: 0 }, N[T] = {};
|
|
8409
|
+
for (let M = 0; M < P.length; M++) {
|
|
8410
|
+
const R = P[M];
|
|
8411
|
+
C[R] && C[R].node.mode === B.mode ? (N[R][T] = g(C[R].lastCount + B.length, B.mode) - g(C[R].lastCount, B.mode), C[R].lastCount += B.length) : (C[R] && (C[R].lastCount = B.length), N[R][T] = g(B.length, B.mode) + 4 + r.getCharCountIndicator(B.mode, b));
|
|
8415
8412
|
}
|
|
8416
8413
|
}
|
|
8417
|
-
|
|
8414
|
+
P = L;
|
|
8418
8415
|
}
|
|
8419
|
-
for (let v = 0; v <
|
|
8420
|
-
|
|
8421
|
-
return { map:
|
|
8416
|
+
for (let v = 0; v < P.length; v++)
|
|
8417
|
+
N[P[v]].end = 0;
|
|
8418
|
+
return { map: N, table: C };
|
|
8422
8419
|
}
|
|
8423
8420
|
function y(A, b) {
|
|
8424
|
-
let
|
|
8425
|
-
const
|
|
8426
|
-
if (
|
|
8427
|
-
throw new Error('"' + A + '" cannot be encoded with mode ' + r.toString(
|
|
8428
|
-
Suggested mode is: ` + r.toString(
|
|
8429
|
-
switch (
|
|
8421
|
+
let C;
|
|
8422
|
+
const N = r.getBestModeForData(A);
|
|
8423
|
+
if (C = r.from(b, N), C !== r.BYTE && C.bit < N.bit)
|
|
8424
|
+
throw new Error('"' + A + '" cannot be encoded with mode ' + r.toString(C) + `.
|
|
8425
|
+
Suggested mode is: ` + r.toString(N));
|
|
8426
|
+
switch (C === r.KANJI && !c.isKanjiModeEnabled() && (C = r.BYTE), C) {
|
|
8430
8427
|
case r.NUMERIC:
|
|
8431
8428
|
return new o(A);
|
|
8432
8429
|
case r.ALPHANUMERIC:
|
|
@@ -8438,14 +8435,14 @@ function Ra() {
|
|
|
8438
8435
|
}
|
|
8439
8436
|
}
|
|
8440
8437
|
t.fromArray = function(b) {
|
|
8441
|
-
return b.reduce(function(
|
|
8442
|
-
return typeof
|
|
8438
|
+
return b.reduce(function(C, N) {
|
|
8439
|
+
return typeof N == "string" ? C.push(y(N, null)) : N.data && C.push(y(N.data, N.mode)), C;
|
|
8443
8440
|
}, []);
|
|
8444
|
-
}, t.fromString = function(b,
|
|
8445
|
-
const
|
|
8446
|
-
for (let S = 1; S <
|
|
8447
|
-
|
|
8448
|
-
return t.fromArray(w(
|
|
8441
|
+
}, t.fromString = function(b, C) {
|
|
8442
|
+
const N = f(b, c.isKanjiModeEnabled()), P = m(N), v = u(P, C), E = d.find_path(v.map, "start", "end"), L = [];
|
|
8443
|
+
for (let S = 1; S < E.length - 1; S++)
|
|
8444
|
+
L.push(v.table[E[S]].node);
|
|
8445
|
+
return t.fromArray(w(L));
|
|
8449
8446
|
}, t.rawSplit = function(b) {
|
|
8450
8447
|
return t.fromArray(
|
|
8451
8448
|
f(b, c.isKanjiModeEnabled())
|
|
@@ -8458,76 +8455,76 @@ function Da() {
|
|
|
8458
8455
|
if (Mr) return dt;
|
|
8459
8456
|
Mr = 1;
|
|
8460
8457
|
const t = ke(), r = Vt(), o = ya(), a = ba(), s = Aa(), n = va(), l = ka(), c = ps(), d = Ea(), h = Sa(), p = xa(), f = Ne(), g = Ra();
|
|
8461
|
-
function w(v,
|
|
8462
|
-
const
|
|
8458
|
+
function w(v, E) {
|
|
8459
|
+
const L = v.size, S = n.getPositions(E);
|
|
8463
8460
|
for (let B = 0; B < S.length; B++) {
|
|
8464
8461
|
const T = S[B][0], M = S[B][1];
|
|
8465
8462
|
for (let R = -1; R <= 7; R++)
|
|
8466
|
-
if (!(T + R <= -1 ||
|
|
8463
|
+
if (!(T + R <= -1 || L <= T + R))
|
|
8467
8464
|
for (let D = -1; D <= 7; D++)
|
|
8468
|
-
M + D <= -1 ||
|
|
8465
|
+
M + D <= -1 || L <= M + D || (R >= 0 && R <= 6 && (D === 0 || D === 6) || D >= 0 && D <= 6 && (R === 0 || R === 6) || R >= 2 && R <= 4 && D >= 2 && D <= 4 ? v.set(T + R, M + D, !0, !0) : v.set(T + R, M + D, !1, !0));
|
|
8469
8466
|
}
|
|
8470
8467
|
}
|
|
8471
8468
|
function m(v) {
|
|
8472
|
-
const
|
|
8473
|
-
for (let
|
|
8474
|
-
const S =
|
|
8475
|
-
v.set(
|
|
8469
|
+
const E = v.size;
|
|
8470
|
+
for (let L = 8; L < E - 8; L++) {
|
|
8471
|
+
const S = L % 2 === 0;
|
|
8472
|
+
v.set(L, 6, S, !0), v.set(6, L, S, !0);
|
|
8476
8473
|
}
|
|
8477
8474
|
}
|
|
8478
|
-
function u(v,
|
|
8479
|
-
const
|
|
8480
|
-
for (let S = 0; S <
|
|
8481
|
-
const B =
|
|
8475
|
+
function u(v, E) {
|
|
8476
|
+
const L = s.getPositions(E);
|
|
8477
|
+
for (let S = 0; S < L.length; S++) {
|
|
8478
|
+
const B = L[S][0], T = L[S][1];
|
|
8482
8479
|
for (let M = -2; M <= 2; M++)
|
|
8483
8480
|
for (let R = -2; R <= 2; R++)
|
|
8484
8481
|
M === -2 || M === 2 || R === -2 || R === 2 || M === 0 && R === 0 ? v.set(B + M, T + R, !0, !0) : v.set(B + M, T + R, !1, !0);
|
|
8485
8482
|
}
|
|
8486
8483
|
}
|
|
8487
|
-
function y(v,
|
|
8488
|
-
const
|
|
8484
|
+
function y(v, E) {
|
|
8485
|
+
const L = v.size, S = h.getEncodedBits(E);
|
|
8489
8486
|
let B, T, M;
|
|
8490
8487
|
for (let R = 0; R < 18; R++)
|
|
8491
|
-
B = Math.floor(R / 3), T = R % 3 +
|
|
8488
|
+
B = Math.floor(R / 3), T = R % 3 + L - 8 - 3, M = (S >> R & 1) === 1, v.set(B, T, M, !0), v.set(T, B, M, !0);
|
|
8492
8489
|
}
|
|
8493
|
-
function A(v,
|
|
8494
|
-
const S = v.size, B = p.getEncodedBits(
|
|
8490
|
+
function A(v, E, L) {
|
|
8491
|
+
const S = v.size, B = p.getEncodedBits(E, L);
|
|
8495
8492
|
let T, M;
|
|
8496
8493
|
for (T = 0; T < 15; T++)
|
|
8497
8494
|
M = (B >> T & 1) === 1, T < 6 ? v.set(T, 8, M, !0) : T < 8 ? v.set(T + 1, 8, M, !0) : v.set(S - 15 + T, 8, M, !0), T < 8 ? v.set(8, S - T - 1, M, !0) : T < 9 ? v.set(8, 15 - T - 1 + 1, M, !0) : v.set(8, 15 - T - 1, M, !0);
|
|
8498
8495
|
v.set(S - 8, 8, 1, !0);
|
|
8499
8496
|
}
|
|
8500
|
-
function b(v,
|
|
8501
|
-
const
|
|
8502
|
-
let S = -1, B =
|
|
8503
|
-
for (let R =
|
|
8497
|
+
function b(v, E) {
|
|
8498
|
+
const L = v.size;
|
|
8499
|
+
let S = -1, B = L - 1, T = 7, M = 0;
|
|
8500
|
+
for (let R = L - 1; R > 0; R -= 2)
|
|
8504
8501
|
for (R === 6 && R--; ; ) {
|
|
8505
8502
|
for (let D = 0; D < 2; D++)
|
|
8506
8503
|
if (!v.isReserved(B, R - D)) {
|
|
8507
8504
|
let F = !1;
|
|
8508
|
-
M <
|
|
8505
|
+
M < E.length && (F = (E[M] >>> T & 1) === 1), v.set(B, R - D, F), T--, T === -1 && (M++, T = 7);
|
|
8509
8506
|
}
|
|
8510
|
-
if (B += S, B < 0 ||
|
|
8507
|
+
if (B += S, B < 0 || L <= B) {
|
|
8511
8508
|
B -= S, S = -S;
|
|
8512
8509
|
break;
|
|
8513
8510
|
}
|
|
8514
8511
|
}
|
|
8515
8512
|
}
|
|
8516
|
-
function
|
|
8513
|
+
function C(v, E, L) {
|
|
8517
8514
|
const S = new o();
|
|
8518
|
-
|
|
8515
|
+
L.forEach(function(D) {
|
|
8519
8516
|
S.put(D.mode.bit, 4), S.put(D.getLength(), f.getCharCountIndicator(D.mode, v)), D.write(S);
|
|
8520
8517
|
});
|
|
8521
|
-
const B = t.getSymbolTotalCodewords(v), T = c.getTotalCodewordsCount(v,
|
|
8518
|
+
const B = t.getSymbolTotalCodewords(v), T = c.getTotalCodewordsCount(v, E), M = (B - T) * 8;
|
|
8522
8519
|
for (S.getLengthInBits() + 4 <= M && S.put(0, 4); S.getLengthInBits() % 8 !== 0; )
|
|
8523
8520
|
S.putBit(0);
|
|
8524
8521
|
const R = (M - S.getLengthInBits()) / 8;
|
|
8525
8522
|
for (let D = 0; D < R; D++)
|
|
8526
8523
|
S.put(D % 2 ? 17 : 236, 8);
|
|
8527
|
-
return
|
|
8524
|
+
return N(S, v, E);
|
|
8528
8525
|
}
|
|
8529
|
-
function
|
|
8530
|
-
const S = t.getSymbolTotalCodewords(
|
|
8526
|
+
function N(v, E, L) {
|
|
8527
|
+
const S = t.getSymbolTotalCodewords(E), B = c.getTotalCodewordsCount(E, L), T = S - B, M = c.getBlocksCount(E, L), R = S % M, D = M - R, F = Math.floor(S / M), Z = Math.floor(T / M), he = Z + 1, te = F - Z, H = new d(te);
|
|
8531
8528
|
let I = 0;
|
|
8532
8529
|
const U = new Array(M), Q = new Array(M);
|
|
8533
8530
|
let re = 0;
|
|
@@ -8546,48 +8543,48 @@ function Da() {
|
|
|
8546
8543
|
fe[pe++] = Q[j][z];
|
|
8547
8544
|
return fe;
|
|
8548
8545
|
}
|
|
8549
|
-
function
|
|
8546
|
+
function P(v, E, L, S) {
|
|
8550
8547
|
let B;
|
|
8551
8548
|
if (Array.isArray(v))
|
|
8552
8549
|
B = g.fromArray(v);
|
|
8553
8550
|
else if (typeof v == "string") {
|
|
8554
|
-
let F =
|
|
8551
|
+
let F = E;
|
|
8555
8552
|
if (!F) {
|
|
8556
8553
|
const Z = g.rawSplit(v);
|
|
8557
|
-
F = h.getBestVersionForData(Z,
|
|
8554
|
+
F = h.getBestVersionForData(Z, L);
|
|
8558
8555
|
}
|
|
8559
8556
|
B = g.fromString(v, F || 40);
|
|
8560
8557
|
} else
|
|
8561
8558
|
throw new Error("Invalid data");
|
|
8562
|
-
const T = h.getBestVersionForData(B,
|
|
8559
|
+
const T = h.getBestVersionForData(B, L);
|
|
8563
8560
|
if (!T)
|
|
8564
8561
|
throw new Error("The amount of data is too big to be stored in a QR Code");
|
|
8565
|
-
if (!
|
|
8566
|
-
|
|
8567
|
-
else if (
|
|
8562
|
+
if (!E)
|
|
8563
|
+
E = T;
|
|
8564
|
+
else if (E < T)
|
|
8568
8565
|
throw new Error(
|
|
8569
8566
|
`
|
|
8570
8567
|
The chosen QR Code version cannot contain this amount of data.
|
|
8571
8568
|
Minimum version required to store current data is: ` + T + `.
|
|
8572
8569
|
`
|
|
8573
8570
|
);
|
|
8574
|
-
const M =
|
|
8575
|
-
return w(D,
|
|
8571
|
+
const M = C(E, L, B), R = t.getSymbolSize(E), D = new a(R);
|
|
8572
|
+
return w(D, E), m(D), u(D, E), A(D, L, 0), E >= 7 && y(D, E), b(D, M), isNaN(S) && (S = l.getBestMask(
|
|
8576
8573
|
D,
|
|
8577
|
-
A.bind(null, D,
|
|
8578
|
-
)), l.applyMask(S, D), A(D,
|
|
8574
|
+
A.bind(null, D, L)
|
|
8575
|
+
)), l.applyMask(S, D), A(D, L, S), {
|
|
8579
8576
|
modules: D,
|
|
8580
|
-
version:
|
|
8581
|
-
errorCorrectionLevel:
|
|
8577
|
+
version: E,
|
|
8578
|
+
errorCorrectionLevel: L,
|
|
8582
8579
|
maskPattern: S,
|
|
8583
8580
|
segments: B
|
|
8584
8581
|
};
|
|
8585
8582
|
}
|
|
8586
|
-
return dt.create = function(
|
|
8587
|
-
if (typeof
|
|
8583
|
+
return dt.create = function(E, L) {
|
|
8584
|
+
if (typeof E > "u" || E === "")
|
|
8588
8585
|
throw new Error("No input text");
|
|
8589
8586
|
let S = r.M, B, T;
|
|
8590
|
-
return typeof
|
|
8587
|
+
return typeof L < "u" && (S = r.from(L.errorCorrectionLevel, r.M), B = h.from(L.version), T = l.from(L.maskPattern), L.toSJISFunc && t.setToSJISFunction(L.toSJISFunc)), P(E, B, S, T);
|
|
8591
8588
|
}, dt;
|
|
8592
8589
|
}
|
|
8593
8590
|
var Lt = {}, Mt = {}, Tr;
|
|
@@ -8781,98 +8778,98 @@ function ws() {
|
|
|
8781
8778
|
getAccessToken: r?.getAccessToken
|
|
8782
8779
|
}),
|
|
8783
8780
|
[t.serverUrl, t.requestTimeout, t.retryAttempts, r]
|
|
8784
|
-
), w =
|
|
8781
|
+
), w = x(async () => {
|
|
8785
8782
|
h(!0), f(null);
|
|
8786
8783
|
try {
|
|
8787
|
-
const
|
|
8788
|
-
return a(
|
|
8789
|
-
} catch (
|
|
8790
|
-
const
|
|
8791
|
-
throw f(
|
|
8784
|
+
const N = await g.get("/mfa/status");
|
|
8785
|
+
return a(N), N;
|
|
8786
|
+
} catch (N) {
|
|
8787
|
+
const P = O(N, "Failed to get TOTP status");
|
|
8788
|
+
throw f(P), P;
|
|
8792
8789
|
} finally {
|
|
8793
8790
|
h(!1);
|
|
8794
8791
|
}
|
|
8795
|
-
}, [g]), m =
|
|
8792
|
+
}, [g]), m = x(async () => {
|
|
8796
8793
|
h(!0), f(null), n("loading");
|
|
8797
8794
|
try {
|
|
8798
|
-
const
|
|
8799
|
-
return c(
|
|
8800
|
-
} catch (
|
|
8801
|
-
const
|
|
8802
|
-
throw f(
|
|
8795
|
+
const N = await g.post("/mfa/setup", {});
|
|
8796
|
+
return c(N), n("setup"), N;
|
|
8797
|
+
} catch (N) {
|
|
8798
|
+
const P = O(N, "Failed to start TOTP setup");
|
|
8799
|
+
throw f(P), n("error"), P;
|
|
8803
8800
|
} finally {
|
|
8804
8801
|
h(!1);
|
|
8805
8802
|
}
|
|
8806
|
-
}, [g]), u =
|
|
8807
|
-
async (
|
|
8808
|
-
if (!/^\d{6}$/.test(
|
|
8809
|
-
const
|
|
8803
|
+
}, [g]), u = x(
|
|
8804
|
+
async (N) => {
|
|
8805
|
+
if (!/^\d{6}$/.test(N)) {
|
|
8806
|
+
const P = {
|
|
8810
8807
|
code: "VALIDATION_ERROR",
|
|
8811
8808
|
message: "Please enter a 6-digit code"
|
|
8812
8809
|
};
|
|
8813
|
-
throw f(
|
|
8810
|
+
throw f(P), P;
|
|
8814
8811
|
}
|
|
8815
8812
|
h(!0), f(null), n("verifying");
|
|
8816
8813
|
try {
|
|
8817
|
-
await g.post("/mfa/enable", { code:
|
|
8814
|
+
await g.post("/mfa/enable", { code: N }), n("success");
|
|
8818
8815
|
try {
|
|
8819
|
-
const
|
|
8820
|
-
a(
|
|
8816
|
+
const P = await g.get("/mfa/status");
|
|
8817
|
+
a(P);
|
|
8821
8818
|
} catch {
|
|
8822
8819
|
a({ enabled: !0, recoveryCodesRemaining: 0 });
|
|
8823
8820
|
}
|
|
8824
|
-
} catch (
|
|
8825
|
-
const v = O(
|
|
8821
|
+
} catch (P) {
|
|
8822
|
+
const v = O(P, "Invalid verification code");
|
|
8826
8823
|
throw f(v), n("error"), v;
|
|
8827
8824
|
} finally {
|
|
8828
8825
|
h(!1);
|
|
8829
8826
|
}
|
|
8830
8827
|
},
|
|
8831
8828
|
[g]
|
|
8832
|
-
), y =
|
|
8833
|
-
async (
|
|
8834
|
-
if (!
|
|
8835
|
-
const
|
|
8829
|
+
), y = x(
|
|
8830
|
+
async (N) => {
|
|
8831
|
+
if (!N) {
|
|
8832
|
+
const P = {
|
|
8836
8833
|
code: "VALIDATION_ERROR",
|
|
8837
8834
|
message: "Please enter your password"
|
|
8838
8835
|
};
|
|
8839
|
-
throw f(
|
|
8836
|
+
throw f(P), P;
|
|
8840
8837
|
}
|
|
8841
8838
|
h(!0), f(null);
|
|
8842
8839
|
try {
|
|
8843
|
-
await g.post("/mfa/disable", { password:
|
|
8844
|
-
} catch (
|
|
8845
|
-
const v = O(
|
|
8840
|
+
await g.post("/mfa/disable", { password: N }), a({ enabled: !1, recoveryCodesRemaining: 0 }), c(null), n("idle");
|
|
8841
|
+
} catch (P) {
|
|
8842
|
+
const v = O(P, "Failed to disable TOTP");
|
|
8846
8843
|
throw f(v), v;
|
|
8847
8844
|
} finally {
|
|
8848
8845
|
h(!1);
|
|
8849
8846
|
}
|
|
8850
8847
|
},
|
|
8851
8848
|
[g]
|
|
8852
|
-
), A =
|
|
8853
|
-
async (
|
|
8854
|
-
if (!/^\d{6}$/.test(
|
|
8855
|
-
const
|
|
8849
|
+
), A = x(
|
|
8850
|
+
async (N) => {
|
|
8851
|
+
if (!/^\d{6}$/.test(N)) {
|
|
8852
|
+
const P = {
|
|
8856
8853
|
code: "VALIDATION_ERROR",
|
|
8857
8854
|
message: "Please enter a 6-digit code"
|
|
8858
8855
|
};
|
|
8859
|
-
throw f(
|
|
8856
|
+
throw f(P), P;
|
|
8860
8857
|
}
|
|
8861
8858
|
h(!0), f(null);
|
|
8862
8859
|
try {
|
|
8863
8860
|
return await g.post(
|
|
8864
8861
|
"/mfa/recovery-codes/regenerate",
|
|
8865
|
-
{ code:
|
|
8862
|
+
{ code: N }
|
|
8866
8863
|
);
|
|
8867
|
-
} catch (
|
|
8868
|
-
const v = O(
|
|
8864
|
+
} catch (P) {
|
|
8865
|
+
const v = O(P, "Failed to regenerate recovery codes");
|
|
8869
8866
|
throw f(v), v;
|
|
8870
8867
|
} finally {
|
|
8871
8868
|
h(!1);
|
|
8872
8869
|
}
|
|
8873
8870
|
},
|
|
8874
8871
|
[g]
|
|
8875
|
-
), b =
|
|
8872
|
+
), b = x(() => f(null), []), C = x(() => {
|
|
8876
8873
|
f(null), c(null), n("idle"), h(!1);
|
|
8877
8874
|
}, []);
|
|
8878
8875
|
return {
|
|
@@ -8887,24 +8884,24 @@ function ws() {
|
|
|
8887
8884
|
disableTotp: y,
|
|
8888
8885
|
regenerateBackupCodes: A,
|
|
8889
8886
|
clearError: b,
|
|
8890
|
-
reset:
|
|
8887
|
+
reset: C
|
|
8891
8888
|
};
|
|
8892
8889
|
}
|
|
8893
8890
|
function qa({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
8894
|
-
const { setupState: a, setupData: s, isLoading: n, error: l, beginSetup: c, enableTotp: d, clearError: h, reset: p } = ws(), [f, g] = k("qr"), [w, m] = k(""), [u, y] = k(!1), [A, b] = k(!1),
|
|
8891
|
+
const { setupState: a, setupData: s, isLoading: n, error: l, beginSetup: c, enableTotp: d, clearError: h, reset: p } = ws(), [f, g] = k("qr"), [w, m] = k(""), [u, y] = k(!1), [A, b] = k(!1), C = $(null);
|
|
8895
8892
|
_(() => {
|
|
8896
8893
|
a === "idle" && c().catch(() => {
|
|
8897
8894
|
});
|
|
8898
8895
|
}, [a, c]), _(() => {
|
|
8899
8896
|
a === "success" && t?.();
|
|
8900
8897
|
}, [a, t]);
|
|
8901
|
-
const
|
|
8902
|
-
s?.secret && (await navigator.clipboard.writeText(s.secret), y(!0),
|
|
8903
|
-
},
|
|
8898
|
+
const N = async () => {
|
|
8899
|
+
s?.secret && (await navigator.clipboard.writeText(s.secret), y(!0), C.current !== null && window.clearTimeout(C.current), C.current = window.setTimeout(() => y(!1), 2e3));
|
|
8900
|
+
}, P = async () => {
|
|
8904
8901
|
if (s?.recoveryCodes) {
|
|
8905
|
-
const
|
|
8902
|
+
const L = s.recoveryCodes.join(`
|
|
8906
8903
|
`);
|
|
8907
|
-
await navigator.clipboard.writeText(
|
|
8904
|
+
await navigator.clipboard.writeText(L);
|
|
8908
8905
|
}
|
|
8909
8906
|
}, v = async () => {
|
|
8910
8907
|
try {
|
|
@@ -8912,11 +8909,11 @@ function qa({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
8912
8909
|
} catch {
|
|
8913
8910
|
m("");
|
|
8914
8911
|
}
|
|
8915
|
-
},
|
|
8912
|
+
}, E = () => {
|
|
8916
8913
|
p(), r?.();
|
|
8917
8914
|
};
|
|
8918
8915
|
return _(() => () => {
|
|
8919
|
-
|
|
8916
|
+
C.current !== null && (window.clearTimeout(C.current), C.current = null);
|
|
8920
8917
|
}, []), a === "loading" || a === "idle" && n ? /* @__PURE__ */ e("div", { className: `cedros-totp-setup ${o}`, children: /* @__PURE__ */ e("div", { className: "cedros-totp-loading", children: /* @__PURE__ */ e(Y, { size: "lg", label: "Setting up two-factor authentication" }) }) }) : a === "error" && !s ? /* @__PURE__ */ i("div", { className: `cedros-totp-setup ${o}`, children: [
|
|
8921
8918
|
/* @__PURE__ */ e(ee, { error: l, onDismiss: h }),
|
|
8922
8919
|
/* @__PURE__ */ i("div", { className: "cedros-totp-actions", children: [
|
|
@@ -8925,7 +8922,7 @@ function qa({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
8925
8922
|
{
|
|
8926
8923
|
type: "button",
|
|
8927
8924
|
className: "cedros-button cedros-button-outline cedros-button-md",
|
|
8928
|
-
onClick:
|
|
8925
|
+
onClick: E,
|
|
8929
8926
|
children: "Cancel"
|
|
8930
8927
|
}
|
|
8931
8928
|
),
|
|
@@ -8980,7 +8977,7 @@ function qa({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
8980
8977
|
{
|
|
8981
8978
|
type: "button",
|
|
8982
8979
|
className: "cedros-button cedros-button-ghost cedros-button-sm",
|
|
8983
|
-
onClick:
|
|
8980
|
+
onClick: N,
|
|
8984
8981
|
"aria-label": "Copy secret",
|
|
8985
8982
|
children: u ? "Copied!" : "Copy"
|
|
8986
8983
|
}
|
|
@@ -8993,7 +8990,7 @@ function qa({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
8993
8990
|
{
|
|
8994
8991
|
type: "button",
|
|
8995
8992
|
className: "cedros-button cedros-button-outline cedros-button-md",
|
|
8996
|
-
onClick:
|
|
8993
|
+
onClick: E,
|
|
8997
8994
|
children: "Cancel"
|
|
8998
8995
|
}
|
|
8999
8996
|
),
|
|
@@ -9011,13 +9008,13 @@ function qa({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9011
9008
|
f === "backup" && /* @__PURE__ */ i("div", { className: "cedros-totp-step", children: [
|
|
9012
9009
|
/* @__PURE__ */ e("h3", { className: "cedros-totp-title", children: "Save recovery codes" }),
|
|
9013
9010
|
/* @__PURE__ */ e("p", { className: "cedros-totp-description", children: "Save these codes in a secure place. You can use them to access your account if you lose your authenticator device." }),
|
|
9014
|
-
/* @__PURE__ */ e("div", { className: "cedros-totp-backup-codes", children: s.recoveryCodes.map((
|
|
9011
|
+
/* @__PURE__ */ e("div", { className: "cedros-totp-backup-codes", children: s.recoveryCodes.map((L, S) => /* @__PURE__ */ e("code", { className: "cedros-totp-backup-code", children: L }, S)) }),
|
|
9015
9012
|
/* @__PURE__ */ e(
|
|
9016
9013
|
"button",
|
|
9017
9014
|
{
|
|
9018
9015
|
type: "button",
|
|
9019
9016
|
className: "cedros-button cedros-button-outline cedros-button-md cedros-button-full",
|
|
9020
|
-
onClick:
|
|
9017
|
+
onClick: P,
|
|
9021
9018
|
children: "Copy all codes"
|
|
9022
9019
|
}
|
|
9023
9020
|
),
|
|
@@ -9028,7 +9025,7 @@ function qa({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9028
9025
|
type: "checkbox",
|
|
9029
9026
|
className: "cedros-checkbox",
|
|
9030
9027
|
checked: A,
|
|
9031
|
-
onChange: (
|
|
9028
|
+
onChange: (L) => b(L.target.checked)
|
|
9032
9029
|
}
|
|
9033
9030
|
),
|
|
9034
9031
|
/* @__PURE__ */ e("span", { className: "cedros-checkbox-text", children: "I have saved these recovery codes" })
|
|
@@ -9098,33 +9095,33 @@ function qa({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9098
9095
|
] }) : null;
|
|
9099
9096
|
}
|
|
9100
9097
|
function fc({ onStatusChange: t, className: r = "" }) {
|
|
9101
|
-
const { status: o, isLoading: a, error: s, getStatus: n, disableTotp: l, regenerateBackupCodes: c, clearError: d } = ws(), [h, p] = k("status"), [f, g] = k(""), [w, m] = k(""), [u, y] = k(null), [A, b] = k(!1), [
|
|
9098
|
+
const { status: o, isLoading: a, error: s, getStatus: n, disableTotp: l, regenerateBackupCodes: c, clearError: d } = ws(), [h, p] = k("status"), [f, g] = k(""), [w, m] = k(""), [u, y] = k(null), [A, b] = k(!1), [C, N] = k(null);
|
|
9102
9099
|
_(() => {
|
|
9103
9100
|
n().catch(() => {
|
|
9104
9101
|
});
|
|
9105
9102
|
}, [n]);
|
|
9106
|
-
const
|
|
9103
|
+
const P = x(() => {
|
|
9107
9104
|
p("status"), t?.(!0);
|
|
9108
9105
|
}, [t]), v = async () => {
|
|
9109
|
-
b(!0),
|
|
9106
|
+
b(!0), N(null);
|
|
9110
9107
|
try {
|
|
9111
9108
|
await l(f), p("status"), g(""), t?.(!1);
|
|
9112
9109
|
} catch (S) {
|
|
9113
|
-
|
|
9110
|
+
N(S instanceof Error ? S.message : "Failed to disable 2FA"), g("");
|
|
9114
9111
|
} finally {
|
|
9115
9112
|
b(!1);
|
|
9116
9113
|
}
|
|
9117
|
-
},
|
|
9118
|
-
b(!0),
|
|
9114
|
+
}, E = async () => {
|
|
9115
|
+
b(!0), N(null);
|
|
9119
9116
|
try {
|
|
9120
9117
|
const S = await c(w);
|
|
9121
9118
|
y(S.recoveryCodes), m("");
|
|
9122
9119
|
} catch (S) {
|
|
9123
|
-
|
|
9120
|
+
N(S instanceof Error ? S.message : "Failed to regenerate codes"), m("");
|
|
9124
9121
|
} finally {
|
|
9125
9122
|
b(!1);
|
|
9126
9123
|
}
|
|
9127
|
-
},
|
|
9124
|
+
}, L = async () => {
|
|
9128
9125
|
u && await navigator.clipboard.writeText(u.join(`
|
|
9129
9126
|
`));
|
|
9130
9127
|
};
|
|
@@ -9139,14 +9136,14 @@ function fc({ onStatusChange: t, className: r = "" }) {
|
|
|
9139
9136
|
children: "Retry"
|
|
9140
9137
|
}
|
|
9141
9138
|
)
|
|
9142
|
-
] }) : h === "setup" ? /* @__PURE__ */ e("div", { className: `cedros-totp-settings ${r}`, children: /* @__PURE__ */ e(qa, { onSuccess:
|
|
9139
|
+
] }) : h === "setup" ? /* @__PURE__ */ e("div", { className: `cedros-totp-settings ${r}`, children: /* @__PURE__ */ e(qa, { onSuccess: P, onCancel: () => p("status") }) }) : h === "disable" ? /* @__PURE__ */ e("div", { className: `cedros-totp-settings ${r}`, children: /* @__PURE__ */ i("div", { className: "cedros-totp-panel", children: [
|
|
9143
9140
|
/* @__PURE__ */ e("h3", { className: "cedros-totp-title", children: "Disable two-factor authentication" }),
|
|
9144
9141
|
/* @__PURE__ */ e("p", { className: "cedros-totp-description cedros-totp-warning", children: "This will make your account less secure. Enter your password to confirm." }),
|
|
9145
|
-
|
|
9142
|
+
C && /* @__PURE__ */ e("div", { className: "cedros-totp-error", children: /* @__PURE__ */ e(
|
|
9146
9143
|
ee,
|
|
9147
9144
|
{
|
|
9148
|
-
error: { code: "UNKNOWN_ERROR", message:
|
|
9149
|
-
onDismiss: () =>
|
|
9145
|
+
error: { code: "UNKNOWN_ERROR", message: C },
|
|
9146
|
+
onDismiss: () => N(null)
|
|
9150
9147
|
}
|
|
9151
9148
|
) }),
|
|
9152
9149
|
/* @__PURE__ */ e("div", { className: "cedros-totp-verify-input", children: /* @__PURE__ */ e(
|
|
@@ -9167,7 +9164,7 @@ function fc({ onStatusChange: t, className: r = "" }) {
|
|
|
9167
9164
|
type: "button",
|
|
9168
9165
|
className: "cedros-button cedros-button-outline cedros-button-md",
|
|
9169
9166
|
onClick: () => {
|
|
9170
|
-
p("status"), g(""),
|
|
9167
|
+
p("status"), g(""), N(null);
|
|
9171
9168
|
},
|
|
9172
9169
|
disabled: A,
|
|
9173
9170
|
children: "Cancel"
|
|
@@ -9196,7 +9193,7 @@ function fc({ onStatusChange: t, className: r = "" }) {
|
|
|
9196
9193
|
{
|
|
9197
9194
|
type: "button",
|
|
9198
9195
|
className: "cedros-button cedros-button-outline cedros-button-md cedros-button-full",
|
|
9199
|
-
onClick:
|
|
9196
|
+
onClick: L,
|
|
9200
9197
|
children: "Copy all codes"
|
|
9201
9198
|
}
|
|
9202
9199
|
),
|
|
@@ -9214,11 +9211,11 @@ function fc({ onStatusChange: t, className: r = "" }) {
|
|
|
9214
9211
|
] }) }) : /* @__PURE__ */ e("div", { className: `cedros-totp-settings ${r}`, children: /* @__PURE__ */ i("div", { className: "cedros-totp-panel", children: [
|
|
9215
9212
|
/* @__PURE__ */ e("h3", { className: "cedros-totp-title", children: "Regenerate recovery codes" }),
|
|
9216
9213
|
/* @__PURE__ */ e("p", { className: "cedros-totp-description", children: "This will invalidate all existing recovery codes. Enter your authenticator code to confirm." }),
|
|
9217
|
-
|
|
9214
|
+
C && /* @__PURE__ */ e("div", { className: "cedros-totp-error", children: /* @__PURE__ */ e(
|
|
9218
9215
|
ee,
|
|
9219
9216
|
{
|
|
9220
|
-
error: { code: "UNKNOWN_ERROR", message:
|
|
9221
|
-
onDismiss: () =>
|
|
9217
|
+
error: { code: "UNKNOWN_ERROR", message: C },
|
|
9218
|
+
onDismiss: () => N(null)
|
|
9222
9219
|
}
|
|
9223
9220
|
) }),
|
|
9224
9221
|
/* @__PURE__ */ e("div", { className: "cedros-totp-verify-input", children: /* @__PURE__ */ e(
|
|
@@ -9226,7 +9223,7 @@ function fc({ onStatusChange: t, className: r = "" }) {
|
|
|
9226
9223
|
{
|
|
9227
9224
|
value: w,
|
|
9228
9225
|
onChange: m,
|
|
9229
|
-
onComplete:
|
|
9226
|
+
onComplete: E,
|
|
9230
9227
|
disabled: A,
|
|
9231
9228
|
autoFocus: !0
|
|
9232
9229
|
}
|
|
@@ -9238,7 +9235,7 @@ function fc({ onStatusChange: t, className: r = "" }) {
|
|
|
9238
9235
|
type: "button",
|
|
9239
9236
|
className: "cedros-button cedros-button-outline cedros-button-md",
|
|
9240
9237
|
onClick: () => {
|
|
9241
|
-
p("status"), m(""),
|
|
9238
|
+
p("status"), m(""), N(null);
|
|
9242
9239
|
},
|
|
9243
9240
|
disabled: A,
|
|
9244
9241
|
children: "Cancel"
|
|
@@ -9249,7 +9246,7 @@ function fc({ onStatusChange: t, className: r = "" }) {
|
|
|
9249
9246
|
{
|
|
9250
9247
|
type: "button",
|
|
9251
9248
|
className: "cedros-button cedros-button-primary cedros-button-md",
|
|
9252
|
-
onClick:
|
|
9249
|
+
onClick: E,
|
|
9253
9250
|
disabled: A || w.length !== 6,
|
|
9254
9251
|
children: A ? /* @__PURE__ */ i(X, { children: [
|
|
9255
9252
|
/* @__PURE__ */ e(Y, { size: "sm" }),
|
|
@@ -9347,9 +9344,9 @@ function za() {
|
|
|
9347
9344
|
o?.getAccessToken
|
|
9348
9345
|
),
|
|
9349
9346
|
[t.serverUrl, t.requestTimeout, t.retryAttempts, o]
|
|
9350
|
-
), d =
|
|
9347
|
+
), d = x(() => {
|
|
9351
9348
|
l(null);
|
|
9352
|
-
}, []), h =
|
|
9349
|
+
}, []), h = x(
|
|
9353
9350
|
async (f) => {
|
|
9354
9351
|
if (r !== "authenticated")
|
|
9355
9352
|
throw new Error("Must be authenticated to update profile");
|
|
@@ -9364,7 +9361,7 @@ function za() {
|
|
|
9364
9361
|
}
|
|
9365
9362
|
},
|
|
9366
9363
|
[r, c]
|
|
9367
|
-
), p =
|
|
9364
|
+
), p = x(
|
|
9368
9365
|
async (f) => {
|
|
9369
9366
|
if (r !== "authenticated")
|
|
9370
9367
|
throw new Error("Must be authenticated to change password");
|
|
@@ -9393,21 +9390,21 @@ function gc({
|
|
|
9393
9390
|
onClose: r,
|
|
9394
9391
|
className: o = ""
|
|
9395
9392
|
}) {
|
|
9396
|
-
const { user: a } = Ur(), { isLoading: s, error: n, changePassword: l, clearError: c } = za(), [d, h] = k("main"), [p, f] = k(""), [g, w] = k(""), [m, u] = k(""), [y, A] = k(null), [b,
|
|
9393
|
+
const { user: a } = Ur(), { isLoading: s, error: n, changePassword: l, clearError: c } = za(), [d, h] = k("main"), [p, f] = k(""), [g, w] = k(""), [m, u] = k(""), [y, A] = k(null), [b, C] = k(null), N = Ot(g), P = g === m, v = p.length > 0 && g.length > 0 && m.length > 0 && N.isValid && P, E = x(async () => {
|
|
9397
9394
|
if (v) {
|
|
9398
|
-
A(null),
|
|
9395
|
+
A(null), C(null);
|
|
9399
9396
|
try {
|
|
9400
9397
|
await l({
|
|
9401
9398
|
currentPassword: p,
|
|
9402
9399
|
newPassword: g
|
|
9403
|
-
}), f(""), w(""), u(""),
|
|
9404
|
-
h("main"),
|
|
9400
|
+
}), f(""), w(""), u(""), C("Password changed successfully. Other sessions have been logged out."), t?.(), setTimeout(() => {
|
|
9401
|
+
h("main"), C(null);
|
|
9405
9402
|
}, 2e3);
|
|
9406
9403
|
} catch (B) {
|
|
9407
9404
|
A(B instanceof Error ? B.message : "Failed to change password");
|
|
9408
9405
|
}
|
|
9409
9406
|
}
|
|
9410
|
-
}, [v, p, g, l, t]),
|
|
9407
|
+
}, [v, p, g, l, t]), L = x(() => {
|
|
9411
9408
|
h("main"), f(""), w(""), u(""), A(null), c();
|
|
9412
9409
|
}, [c]), S = () => a?.name ? a.name.split(" ").map((B) => B[0]).join("").toUpperCase().slice(0, 2) : a?.email ? a.email[0].toUpperCase() : "?";
|
|
9413
9410
|
return d === "change-password" ? /* @__PURE__ */ e("div", { className: `cedros-profile-settings ${o}`, children: /* @__PURE__ */ i("div", { className: "cedros-profile-panel", children: [
|
|
@@ -9457,7 +9454,7 @@ function gc({
|
|
|
9457
9454
|
value: m,
|
|
9458
9455
|
onChange: (B) => u(B.target.value),
|
|
9459
9456
|
disabled: s,
|
|
9460
|
-
error: m.length > 0 && !
|
|
9457
|
+
error: m.length > 0 && !P ? "Passwords do not match" : void 0
|
|
9461
9458
|
}
|
|
9462
9459
|
) })
|
|
9463
9460
|
] }),
|
|
@@ -9467,7 +9464,7 @@ function gc({
|
|
|
9467
9464
|
{
|
|
9468
9465
|
type: "button",
|
|
9469
9466
|
className: "cedros-button cedros-button-outline cedros-button-md",
|
|
9470
|
-
onClick:
|
|
9467
|
+
onClick: L,
|
|
9471
9468
|
disabled: s,
|
|
9472
9469
|
children: "Cancel"
|
|
9473
9470
|
}
|
|
@@ -9477,7 +9474,7 @@ function gc({
|
|
|
9477
9474
|
{
|
|
9478
9475
|
type: "button",
|
|
9479
9476
|
className: "cedros-button cedros-button-primary cedros-button-md",
|
|
9480
|
-
onClick:
|
|
9477
|
+
onClick: E,
|
|
9481
9478
|
disabled: s || !v,
|
|
9482
9479
|
children: s ? /* @__PURE__ */ i(X, { children: [
|
|
9483
9480
|
/* @__PURE__ */ e(Y, { size: "sm" }),
|
|
@@ -9540,9 +9537,9 @@ function Va() {
|
|
|
9540
9537
|
timeoutMs: t.config.requestTimeout,
|
|
9541
9538
|
retryAttempts: t.config.retryAttempts,
|
|
9542
9539
|
getAccessToken: t._internal?.getAccessToken
|
|
9543
|
-
}) : null, [t]), l =
|
|
9540
|
+
}) : null, [t]), l = x(() => {
|
|
9544
9541
|
s(null);
|
|
9545
|
-
}, []), c =
|
|
9542
|
+
}, []), c = x(
|
|
9546
9543
|
async (m) => {
|
|
9547
9544
|
if (!n)
|
|
9548
9545
|
throw new Error("useDeposit must be used within a CedrosLoginProvider");
|
|
@@ -9565,7 +9562,7 @@ function Va() {
|
|
|
9565
9562
|
}
|
|
9566
9563
|
},
|
|
9567
9564
|
[n]
|
|
9568
|
-
), d =
|
|
9565
|
+
), d = x(
|
|
9569
9566
|
async (m) => {
|
|
9570
9567
|
if (!n)
|
|
9571
9568
|
throw new Error("useDeposit must be used within a CedrosLoginProvider");
|
|
@@ -9580,7 +9577,7 @@ function Va() {
|
|
|
9580
9577
|
}
|
|
9581
9578
|
},
|
|
9582
9579
|
[n]
|
|
9583
|
-
), h =
|
|
9580
|
+
), h = x(async () => {
|
|
9584
9581
|
if (!n)
|
|
9585
9582
|
throw new Error("useDeposit must be used within a CedrosLoginProvider");
|
|
9586
9583
|
o(!0), s(null);
|
|
@@ -9592,7 +9589,7 @@ function Va() {
|
|
|
9592
9589
|
} finally {
|
|
9593
9590
|
o(!1);
|
|
9594
9591
|
}
|
|
9595
|
-
}, [n]), p =
|
|
9592
|
+
}, [n]), p = x(
|
|
9596
9593
|
async (m) => {
|
|
9597
9594
|
if (!n)
|
|
9598
9595
|
throw new Error("useDeposit must be used within a CedrosLoginProvider");
|
|
@@ -9610,7 +9607,7 @@ function Va() {
|
|
|
9610
9607
|
}
|
|
9611
9608
|
},
|
|
9612
9609
|
[n]
|
|
9613
|
-
), f =
|
|
9610
|
+
), f = x(
|
|
9614
9611
|
async (m) => {
|
|
9615
9612
|
if (!n)
|
|
9616
9613
|
throw new Error("useDeposit must be used within a CedrosLoginProvider");
|
|
@@ -9630,7 +9627,7 @@ function Va() {
|
|
|
9630
9627
|
}
|
|
9631
9628
|
},
|
|
9632
9629
|
[n]
|
|
9633
|
-
), g =
|
|
9630
|
+
), g = x(
|
|
9634
9631
|
async (m) => {
|
|
9635
9632
|
if (!n)
|
|
9636
9633
|
throw new Error("useDeposit must be used within a CedrosLoginProvider");
|
|
@@ -9645,7 +9642,7 @@ function Va() {
|
|
|
9645
9642
|
}
|
|
9646
9643
|
},
|
|
9647
9644
|
[n]
|
|
9648
|
-
), w =
|
|
9645
|
+
), w = x(
|
|
9649
9646
|
async (m) => {
|
|
9650
9647
|
if (!n)
|
|
9651
9648
|
throw new Error("useDeposit must be used within a CedrosLoginProvider");
|
|
@@ -9688,12 +9685,12 @@ function ys({
|
|
|
9688
9685
|
if (!p.trim()) return t;
|
|
9689
9686
|
const b = p.toLowerCase();
|
|
9690
9687
|
return t.filter(
|
|
9691
|
-
(
|
|
9688
|
+
(C) => C.symbol.toLowerCase().includes(b) || C.name.toLowerCase().includes(b) || C.mint.toLowerCase().includes(b)
|
|
9692
9689
|
);
|
|
9693
9690
|
}, [t, p]);
|
|
9694
9691
|
_(() => {
|
|
9695
|
-
const b = (
|
|
9696
|
-
g.current && !g.current.contains(
|
|
9692
|
+
const b = (C) => {
|
|
9693
|
+
g.current && !g.current.contains(C.target) && (h(!1), f(""));
|
|
9697
9694
|
};
|
|
9698
9695
|
if (d)
|
|
9699
9696
|
return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
|
|
@@ -9702,14 +9699,14 @@ function ys({
|
|
|
9702
9699
|
}, [d, c]), _(() => {
|
|
9703
9700
|
a === void 0 || n || (h(!0), f(""));
|
|
9704
9701
|
}, [a, n]);
|
|
9705
|
-
const u =
|
|
9702
|
+
const u = x(() => {
|
|
9706
9703
|
n || (h((b) => !b), d && f(""));
|
|
9707
|
-
}, [n, d]), y =
|
|
9704
|
+
}, [n, d]), y = x(
|
|
9708
9705
|
(b) => {
|
|
9709
9706
|
o(b), h(!1), f("");
|
|
9710
9707
|
},
|
|
9711
9708
|
[o]
|
|
9712
|
-
), A =
|
|
9709
|
+
), A = x(
|
|
9713
9710
|
(b) => {
|
|
9714
9711
|
b.key === "Escape" ? (h(!1), f("")) : b.key === "Enter" && m.length === 1 && y(m[0]);
|
|
9715
9712
|
},
|
|
@@ -9777,8 +9774,8 @@ function ys({
|
|
|
9777
9774
|
src: b.logoUrl,
|
|
9778
9775
|
alt: b.symbol,
|
|
9779
9776
|
className: "cedros-token-icon",
|
|
9780
|
-
onError: (
|
|
9781
|
-
|
|
9777
|
+
onError: (C) => {
|
|
9778
|
+
C.target.style.display = "none";
|
|
9782
9779
|
}
|
|
9783
9780
|
}
|
|
9784
9781
|
),
|
|
@@ -10001,10 +9998,10 @@ function wc({
|
|
|
10001
9998
|
demoAutoConfirmMs: y,
|
|
10002
9999
|
tokenPriceUsd: A,
|
|
10003
10000
|
showExplainer: b = !1,
|
|
10004
|
-
siteName:
|
|
10005
|
-
explainerConfig:
|
|
10001
|
+
siteName: C,
|
|
10002
|
+
explainerConfig: N
|
|
10006
10003
|
}) {
|
|
10007
|
-
const { deposit:
|
|
10004
|
+
const { deposit: P, getStatus: v, error: E, clearError: L } = Va(), S = et(), B = Fr(t.quickActionTokens), T = Fr(t.customTokenSymbols), M = q(() => {
|
|
10008
10005
|
const W = t.customTokens ?? [];
|
|
10009
10006
|
if (W.length === 0) return a;
|
|
10010
10007
|
const V = new Set(a.map((J) => J.symbol)), K = [...a];
|
|
@@ -10022,11 +10019,11 @@ function wc({
|
|
|
10022
10019
|
if (T.length === 0) return M;
|
|
10023
10020
|
const W = M.filter((V) => T.includes(V.symbol));
|
|
10024
10021
|
return W.length > 0 ? W : M;
|
|
10025
|
-
}, [M, T]), D = t.privateDepositsEnabled, F = o ? o === "sign" && !D ? "receive" : o : D && S.hasExternalWallet ? "sign" : "receive", Z = B[0] ? M.find((W) => W.symbol === B[0]) : void 0, he = r === "sol" ? Se : r === "single-token" ? Z ?? M.find((W) => W.symbol === "USDC") ?? M[0] ?? Se : s ?? Z ?? M.find((W) => W.symbol === "USDC") ?? M.find((W) => W.symbol !== "SOL") ?? M[0] ?? Se, te =
|
|
10022
|
+
}, [M, T]), D = t.privateDepositsEnabled, F = o ? o === "sign" && !D ? "receive" : o : D && S.hasExternalWallet ? "sign" : "receive", Z = B[0] ? M.find((W) => W.symbol === B[0]) : void 0, he = r === "sol" ? Se : r === "single-token" ? Z ?? M.find((W) => W.symbol === "USDC") ?? M[0] ?? Se : s ?? Z ?? M.find((W) => W.symbol === "USDC") ?? M.find((W) => W.symbol !== "SOL") ?? M[0] ?? Se, te = x(() => b ? "explainer" : "unlock", [b]), [H, I] = k(te), [U, Q] = k(he), [re, oe] = k(""), [fe, pe] = k(null), [z, j] = k(null), [G, le] = k(null), [be, Gt] = k(null), [rt, Me] = k(!1), [Ts, st] = k(!1), [Ie, $t] = k(null);
|
|
10026
10023
|
_(() => {
|
|
10027
|
-
I(te()), Q(he), oe(""), pe(null), j(null), le(null), Gt(null), Me(!1), st(!1), $t(null),
|
|
10028
|
-
}, [r, F, he,
|
|
10029
|
-
const Bs = n ?? t.privateMinSol, Rs = l, Fe = parseFloat(re), Jt = S.status === "enrolled_locked" || S.status === "enrolled_unlocked" || S.status === "unlocked", ot = Jt && S.isUnlocked, nt = Jt && !S.isUnlocked, Xt =
|
|
10024
|
+
I(te()), Q(he), oe(""), pe(null), j(null), le(null), Gt(null), Me(!1), st(!1), $t(null), L();
|
|
10025
|
+
}, [r, F, he, L, te]);
|
|
10026
|
+
const Bs = n ?? t.privateMinSol, Rs = l, Fe = parseFloat(re), Jt = S.status === "enrolled_locked" || S.status === "enrolled_unlocked" || S.status === "unlocked", ot = Jt && S.isUnlocked, nt = Jt && !S.isUnlocked, Xt = x(() => {
|
|
10030
10027
|
let K = F === "sign" ? [
|
|
10031
10028
|
{ key: "unlock", label: "Authorize" },
|
|
10032
10029
|
{ key: "confirm", label: "Send" },
|
|
@@ -10039,9 +10036,9 @@ function wc({
|
|
|
10039
10036
|
{ key: "success", label: "Complete" }
|
|
10040
10037
|
];
|
|
10041
10038
|
return b && (K = [{ key: "explainer", label: "Info" }, ...K]), K;
|
|
10042
|
-
}, [F, b])(), Ds = Xt.findIndex((W) => W.key === H), Zt =
|
|
10039
|
+
}, [F, b])(), Ds = Xt.findIndex((W) => W.key === H), Zt = x((W) => {
|
|
10043
10040
|
Q(W);
|
|
10044
|
-
}, []), Is =
|
|
10041
|
+
}, []), Is = x(
|
|
10045
10042
|
async (W) => {
|
|
10046
10043
|
if (!f) {
|
|
10047
10044
|
I(F === "sign" ? "confirm" : "show-address");
|
|
@@ -10059,9 +10056,9 @@ function wc({
|
|
|
10059
10056
|
}
|
|
10060
10057
|
},
|
|
10061
10058
|
[f, F, Fe, U]
|
|
10062
|
-
), Fs =
|
|
10059
|
+
), Fs = x(
|
|
10063
10060
|
async (W, V) => {
|
|
10064
|
-
|
|
10061
|
+
L(), j(null), I("signing");
|
|
10065
10062
|
const K = W ?? Fe, J = V ?? U;
|
|
10066
10063
|
if (!u) {
|
|
10067
10064
|
if (nt && p) {
|
|
@@ -10095,7 +10092,7 @@ function wc({
|
|
|
10095
10092
|
pe(_e), I("success"), c?.(_e);
|
|
10096
10093
|
return;
|
|
10097
10094
|
}
|
|
10098
|
-
const ae = await
|
|
10095
|
+
const ae = await P(ie), Ue = {
|
|
10099
10096
|
token: r === "sol" ? null : J,
|
|
10100
10097
|
amount: K,
|
|
10101
10098
|
amountSmallestUnit: ie,
|
|
@@ -10111,7 +10108,7 @@ function wc({
|
|
|
10111
10108
|
}
|
|
10112
10109
|
},
|
|
10113
10110
|
[
|
|
10114
|
-
|
|
10111
|
+
P,
|
|
10115
10112
|
Fe,
|
|
10116
10113
|
U,
|
|
10117
10114
|
r,
|
|
@@ -10122,11 +10119,11 @@ function wc({
|
|
|
10122
10119
|
p,
|
|
10123
10120
|
c,
|
|
10124
10121
|
d,
|
|
10125
|
-
|
|
10122
|
+
L
|
|
10126
10123
|
]
|
|
10127
|
-
), Us =
|
|
10124
|
+
), Us = x(() => {
|
|
10128
10125
|
I("waiting");
|
|
10129
|
-
}, []), at =
|
|
10126
|
+
}, []), at = x(async () => {
|
|
10130
10127
|
const W = be || S.solanaPubkey;
|
|
10131
10128
|
if (W)
|
|
10132
10129
|
try {
|
|
@@ -10211,9 +10208,9 @@ function wc({
|
|
|
10211
10208
|
G,
|
|
10212
10209
|
c
|
|
10213
10210
|
]);
|
|
10214
|
-
const _s =
|
|
10215
|
-
I(te()), oe(""), pe(null), j(null),
|
|
10216
|
-
}, [te,
|
|
10211
|
+
const _s = x(() => {
|
|
10212
|
+
I(te()), oe(""), pe(null), j(null), L();
|
|
10213
|
+
}, [te, L]);
|
|
10217
10214
|
return t.enabled ? /* @__PURE__ */ i("div", { className: `cedros-deposit-flow ${g}`, children: [
|
|
10218
10215
|
w && H !== "error" && /* @__PURE__ */ e("div", { className: "cedros-deposit-flow-steps", children: Xt.map((W, V) => {
|
|
10219
10216
|
const K = Ds >= V, J = W.key === H;
|
|
@@ -10239,8 +10236,8 @@ function wc({
|
|
|
10239
10236
|
H === "explainer" && /* @__PURE__ */ e(
|
|
10240
10237
|
ti,
|
|
10241
10238
|
{
|
|
10242
|
-
siteName:
|
|
10243
|
-
config:
|
|
10239
|
+
siteName: C,
|
|
10240
|
+
config: N,
|
|
10244
10241
|
depositConfig: t,
|
|
10245
10242
|
currencyMode: r,
|
|
10246
10243
|
token: U,
|
|
@@ -10323,7 +10320,7 @@ function wc({
|
|
|
10323
10320
|
H === "error" && /* @__PURE__ */ e(
|
|
10324
10321
|
ci,
|
|
10325
10322
|
{
|
|
10326
|
-
error: z ||
|
|
10323
|
+
error: z || E || "An error occurred",
|
|
10327
10324
|
onRetry: () => I("confirm"),
|
|
10328
10325
|
onCancel: h
|
|
10329
10326
|
}
|
|
@@ -10477,7 +10474,7 @@ function si({
|
|
|
10477
10474
|
onConfirm: y,
|
|
10478
10475
|
onBack: A
|
|
10479
10476
|
}) {
|
|
10480
|
-
const [b,
|
|
10477
|
+
const [b, C] = k(g.privateMinUsd), [N, P] = k(!1), [v, E] = k(!1), [L, S] = k(0), [B, T] = k(null), R = Ht(b, g) === "sol_micro", D = t.symbol === xe.symbol, F = q(() => {
|
|
10481
10478
|
const z = a.length === 0 ? r : r.filter((le) => a.includes(le.symbol)), j = z.length > 0 ? z : r;
|
|
10482
10479
|
return j.some((le) => le.symbol === xe.symbol) ? j : [...j, xe];
|
|
10483
10480
|
}, [r, a]), Z = tt(g, b), he = Z < 0.01 ? 0.01 : Z, te = D ? "Fees: calculated after deposit" : `Fees: $${he.toFixed(2)} total`, H = D ? "" : Ns(g, b, Z), I = Ss(R ? Se : t, g), U = I ? b / I : t.symbol === "SOL" && g.solPriceUsd > 0 ? b / g.solPriceUsd : b, Q = U ? xs(U, R ? "SOL" : t.symbol) : null, oe = b - Z <= 0 && b > 0, fe = !D && b > 0 && !oe && U >= n && U <= l;
|
|
@@ -10506,7 +10503,7 @@ function si({
|
|
|
10506
10503
|
type: "button",
|
|
10507
10504
|
className: `cedros-deposit-flow-token-quick-btn ${G ? "is-active" : ""}`,
|
|
10508
10505
|
onClick: () => {
|
|
10509
|
-
j && (
|
|
10506
|
+
j && (P(!1), m(j));
|
|
10510
10507
|
},
|
|
10511
10508
|
disabled: !j,
|
|
10512
10509
|
children: [
|
|
@@ -10528,21 +10525,21 @@ function si({
|
|
|
10528
10525
|
"button",
|
|
10529
10526
|
{
|
|
10530
10527
|
type: "button",
|
|
10531
|
-
className: `cedros-deposit-flow-token-quick-btn ${
|
|
10528
|
+
className: `cedros-deposit-flow-token-quick-btn ${N ? "is-active" : ""}`,
|
|
10532
10529
|
onClick: () => {
|
|
10533
|
-
|
|
10530
|
+
P(!0), S((z) => z + 1);
|
|
10534
10531
|
},
|
|
10535
10532
|
children: "Custom"
|
|
10536
10533
|
}
|
|
10537
10534
|
)
|
|
10538
10535
|
] }),
|
|
10539
|
-
|
|
10536
|
+
N && /* @__PURE__ */ e("div", { className: "cedros-deposit-flow-token-custom", children: /* @__PURE__ */ e(
|
|
10540
10537
|
ys,
|
|
10541
10538
|
{
|
|
10542
10539
|
tokens: F,
|
|
10543
10540
|
selectedToken: t,
|
|
10544
10541
|
onSelect: m,
|
|
10545
|
-
openSignal:
|
|
10542
|
+
openSignal: L
|
|
10546
10543
|
}
|
|
10547
10544
|
) })
|
|
10548
10545
|
] }),
|
|
@@ -10551,7 +10548,7 @@ function si({
|
|
|
10551
10548
|
{
|
|
10552
10549
|
config: g,
|
|
10553
10550
|
valueUsd: b,
|
|
10554
|
-
onChange:
|
|
10551
|
+
onChange: C,
|
|
10555
10552
|
maxUsd: ks
|
|
10556
10553
|
}
|
|
10557
10554
|
) }),
|
|
@@ -10606,11 +10603,11 @@ function si({
|
|
|
10606
10603
|
`, ", ")}`,
|
|
10607
10604
|
"aria-expanded": v,
|
|
10608
10605
|
onClick: (z) => {
|
|
10609
|
-
z.stopPropagation(),
|
|
10606
|
+
z.stopPropagation(), E((j) => !j);
|
|
10610
10607
|
},
|
|
10611
|
-
onBlur: () =>
|
|
10608
|
+
onBlur: () => E(!1),
|
|
10612
10609
|
onKeyDown: (z) => {
|
|
10613
|
-
z.key === "Escape" &&
|
|
10610
|
+
z.key === "Escape" && E(!1);
|
|
10614
10611
|
},
|
|
10615
10612
|
children: "i"
|
|
10616
10613
|
}
|
|
@@ -10691,18 +10688,18 @@ function ni({
|
|
|
10691
10688
|
onSent: w,
|
|
10692
10689
|
onBack: m
|
|
10693
10690
|
}) {
|
|
10694
|
-
const [u, y] = k(h.privateMinUsd), [A, b] = k(!1), [
|
|
10691
|
+
const [u, y] = k(h.privateMinUsd), [A, b] = k(!1), [C, N] = k(!1), [P, v] = k(0), [E, L] = k(null), B = Ht(u, h) === "sol_micro", T = t.symbol === xe.symbol, M = q(() => {
|
|
10695
10692
|
const U = a.length === 0 ? r : r.filter((oe) => a.includes(oe.symbol)), Q = U.length > 0 ? U : r;
|
|
10696
10693
|
return Q.some((oe) => oe.symbol === xe.symbol) ? Q : [...Q, xe];
|
|
10697
10694
|
}, [r, a]), R = tt(h, u), D = R < 0.01 ? 0.01 : R, F = T ? "Fees: calculated after deposit" : `Fees: $${D.toFixed(2)} total`, Z = T ? "" : Ns(h, u, R), he = T || u > 0, te = Ss(B ? Se : t, h, s), H = te ? u / te : null, I = H ? xs(H, t.symbol) : null;
|
|
10698
10695
|
return _(() => {
|
|
10699
10696
|
if (n === "multi-token")
|
|
10700
10697
|
if (B && t.symbol !== "SOL") {
|
|
10701
|
-
|
|
10698
|
+
L(t);
|
|
10702
10699
|
const U = r.find((Q) => Q.symbol === "SOL");
|
|
10703
10700
|
U && f(U);
|
|
10704
|
-
} else !B &&
|
|
10705
|
-
}, [B, t.symbol, n, r, f,
|
|
10701
|
+
} else !B && E && t.symbol === "SOL" && (f(E), L(null));
|
|
10702
|
+
}, [B, t.symbol, n, r, f, E, t]), _(() => {
|
|
10706
10703
|
g(u);
|
|
10707
10704
|
}, [u, g]), l ? /* @__PURE__ */ i("div", { className: "cedros-deposit-flow-step", children: [
|
|
10708
10705
|
/* @__PURE__ */ e("h4", { className: "cedros-deposit-flow-step-title", children: "Send Deposit" }),
|
|
@@ -10754,7 +10751,7 @@ function ni({
|
|
|
10754
10751
|
tokens: M,
|
|
10755
10752
|
selectedToken: t,
|
|
10756
10753
|
onSelect: f,
|
|
10757
|
-
openSignal:
|
|
10754
|
+
openSignal: P
|
|
10758
10755
|
}
|
|
10759
10756
|
) })
|
|
10760
10757
|
] }),
|
|
@@ -10801,17 +10798,17 @@ function ni({
|
|
|
10801
10798
|
"button",
|
|
10802
10799
|
{
|
|
10803
10800
|
type: "button",
|
|
10804
|
-
className: `cedros-deposit-flow-fee-info ${
|
|
10801
|
+
className: `cedros-deposit-flow-fee-info ${C ? "is-open" : ""}`,
|
|
10805
10802
|
"data-tooltip": Z,
|
|
10806
10803
|
"aria-label": `Fee breakdown: ${Z.replaceAll(`
|
|
10807
10804
|
`, ", ")}`,
|
|
10808
|
-
"aria-expanded":
|
|
10805
|
+
"aria-expanded": C,
|
|
10809
10806
|
onClick: (U) => {
|
|
10810
|
-
U.stopPropagation(),
|
|
10807
|
+
U.stopPropagation(), N((Q) => !Q);
|
|
10811
10808
|
},
|
|
10812
|
-
onBlur: () =>
|
|
10809
|
+
onBlur: () => N(!1),
|
|
10813
10810
|
onKeyDown: (U) => {
|
|
10814
|
-
U.key === "Escape" &&
|
|
10811
|
+
U.key === "Escape" && N(!1);
|
|
10815
10812
|
},
|
|
10816
10813
|
children: "i"
|
|
10817
10814
|
}
|
|
@@ -11093,9 +11090,9 @@ function Ps() {
|
|
|
11093
11090
|
timeoutMs: t.config.requestTimeout,
|
|
11094
11091
|
retryAttempts: t.config.retryAttempts,
|
|
11095
11092
|
getAccessToken: t._internal?.getAccessToken
|
|
11096
|
-
}) : null, [t]), l =
|
|
11093
|
+
}) : null, [t]), l = x(() => {
|
|
11097
11094
|
s(null);
|
|
11098
|
-
}, []), c =
|
|
11095
|
+
}, []), c = x(async () => {
|
|
11099
11096
|
if (!n)
|
|
11100
11097
|
throw new Error("useCredits must be used within a CedrosLoginProvider");
|
|
11101
11098
|
o(!0), s(null);
|
|
@@ -11107,7 +11104,7 @@ function Ps() {
|
|
|
11107
11104
|
} finally {
|
|
11108
11105
|
o(!1);
|
|
11109
11106
|
}
|
|
11110
|
-
}, [n]), d =
|
|
11107
|
+
}, [n]), d = x(async () => {
|
|
11111
11108
|
if (!n)
|
|
11112
11109
|
throw new Error("useCredits must be used within a CedrosLoginProvider");
|
|
11113
11110
|
o(!0), s(null);
|
|
@@ -11119,7 +11116,7 @@ function Ps() {
|
|
|
11119
11116
|
} finally {
|
|
11120
11117
|
o(!1);
|
|
11121
11118
|
}
|
|
11122
|
-
}, [n]), h =
|
|
11119
|
+
}, [n]), h = x(
|
|
11123
11120
|
async (p) => {
|
|
11124
11121
|
if (!n)
|
|
11125
11122
|
throw new Error("useCredits must be used within a CedrosLoginProvider");
|
|
@@ -11154,7 +11151,7 @@ function yc({
|
|
|
11154
11151
|
className: a = "",
|
|
11155
11152
|
onLoad: s
|
|
11156
11153
|
}) {
|
|
11157
|
-
const { getBalance: n, getAllBalances: l, isLoading: c, error: d, clearError: h } = Ps(), [p, f] = k([]), [g, w] = k(null), m =
|
|
11154
|
+
const { getBalance: n, getAllBalances: l, isLoading: c, error: d, clearError: h } = Ps(), [p, f] = k([]), [g, w] = k(null), m = x(async () => {
|
|
11158
11155
|
try {
|
|
11159
11156
|
if (t) {
|
|
11160
11157
|
const u = await l();
|
|
@@ -11286,15 +11283,15 @@ function bc({
|
|
|
11286
11283
|
onLoad: s,
|
|
11287
11284
|
onTransactionClick: n
|
|
11288
11285
|
}) {
|
|
11289
|
-
const { getHistory: l, isLoading: c, error: d, clearError: h } = Ps(), [p, f] = k(t), [g, w] = k([]), [m, u] = k(0), [y, A] = k(0), [b,
|
|
11286
|
+
const { getHistory: l, isLoading: c, error: d, clearError: h } = Ps(), [p, f] = k(t), [g, w] = k([]), [m, u] = k(0), [y, A] = k(0), [b, C] = k(null), N = Bt.find((M) => M.key === p) || Bt[0], P = q(() => N.txTypes === null ? g : g.filter((M) => {
|
|
11290
11287
|
const R = M.txType || "";
|
|
11291
|
-
return
|
|
11292
|
-
}), [g,
|
|
11288
|
+
return N.txTypes.some((D) => R.toLowerCase().includes(D.toLowerCase()));
|
|
11289
|
+
}), [g, N.txTypes]), v = x(async () => {
|
|
11293
11290
|
try {
|
|
11294
11291
|
const M = await l({ limit: r * 3, offset: y });
|
|
11295
|
-
w(M.transactions), u(M.total), s?.(M),
|
|
11292
|
+
w(M.transactions), u(M.total), s?.(M), C(null);
|
|
11296
11293
|
} catch (M) {
|
|
11297
|
-
|
|
11294
|
+
C(M instanceof Error ? M.message : "Failed to load history");
|
|
11298
11295
|
}
|
|
11299
11296
|
}, [r, y, l, s]);
|
|
11300
11297
|
_(() => {
|
|
@@ -11306,7 +11303,7 @@ function bc({
|
|
|
11306
11303
|
const M = setInterval(v, o);
|
|
11307
11304
|
return () => clearInterval(M);
|
|
11308
11305
|
}, [o, v]);
|
|
11309
|
-
const
|
|
11306
|
+
const E = Math.ceil(m / r), L = Math.floor(y / r) + 1, S = (M) => {
|
|
11310
11307
|
const R = (M - 1) * r;
|
|
11311
11308
|
A(Math.max(0, Math.min(R, Math.max(0, m - 1))));
|
|
11312
11309
|
}, B = (M) => {
|
|
@@ -11321,7 +11318,7 @@ function bc({
|
|
|
11321
11318
|
type: "button",
|
|
11322
11319
|
className: "cedros-tx-retry",
|
|
11323
11320
|
onClick: () => {
|
|
11324
|
-
h(),
|
|
11321
|
+
h(), C(null), v();
|
|
11325
11322
|
},
|
|
11326
11323
|
children: "Retry"
|
|
11327
11324
|
}
|
|
@@ -11367,11 +11364,11 @@ function bc({
|
|
|
11367
11364
|
M.key
|
|
11368
11365
|
);
|
|
11369
11366
|
}) }),
|
|
11370
|
-
|
|
11371
|
-
/* @__PURE__ */ e("p", { className: "cedros-tx-empty-message", children: p === "all" ? "No transactions yet." : `No ${
|
|
11367
|
+
P.length === 0 ? /* @__PURE__ */ i("div", { className: "cedros-tx-empty", children: [
|
|
11368
|
+
/* @__PURE__ */ e("p", { className: "cedros-tx-empty-message", children: p === "all" ? "No transactions yet." : `No ${N.label.toLowerCase()} found.` }),
|
|
11372
11369
|
p === "all" && /* @__PURE__ */ e("p", { className: "cedros-tx-empty-hint", children: "Make a deposit to get started." })
|
|
11373
11370
|
] }) : /* @__PURE__ */ i(X, { children: [
|
|
11374
|
-
/* @__PURE__ */ e("div", { className: "cedros-tx-list", children:
|
|
11371
|
+
/* @__PURE__ */ e("div", { className: "cedros-tx-list", children: P.slice(0, r).map((M) => {
|
|
11375
11372
|
const R = M.amountLamports >= 0;
|
|
11376
11373
|
return /* @__PURE__ */ i(
|
|
11377
11374
|
"div",
|
|
@@ -11412,30 +11409,30 @@ function bc({
|
|
|
11412
11409
|
M.id
|
|
11413
11410
|
);
|
|
11414
11411
|
}) }),
|
|
11415
|
-
|
|
11412
|
+
E > 1 && /* @__PURE__ */ i("div", { className: "cedros-tx-pagination", children: [
|
|
11416
11413
|
/* @__PURE__ */ e(
|
|
11417
11414
|
"button",
|
|
11418
11415
|
{
|
|
11419
11416
|
type: "button",
|
|
11420
11417
|
className: "cedros-tx-page-btn",
|
|
11421
|
-
onClick: () => S(
|
|
11422
|
-
disabled:
|
|
11418
|
+
onClick: () => S(L - 1),
|
|
11419
|
+
disabled: L <= 1,
|
|
11423
11420
|
children: "Previous"
|
|
11424
11421
|
}
|
|
11425
11422
|
),
|
|
11426
11423
|
/* @__PURE__ */ i("span", { className: "cedros-tx-page-info", children: [
|
|
11427
11424
|
"Page ",
|
|
11428
|
-
|
|
11425
|
+
L,
|
|
11429
11426
|
" of ",
|
|
11430
|
-
|
|
11427
|
+
E
|
|
11431
11428
|
] }),
|
|
11432
11429
|
/* @__PURE__ */ e(
|
|
11433
11430
|
"button",
|
|
11434
11431
|
{
|
|
11435
11432
|
type: "button",
|
|
11436
11433
|
className: "cedros-tx-page-btn",
|
|
11437
|
-
onClick: () => S(
|
|
11438
|
-
disabled:
|
|
11434
|
+
onClick: () => S(L + 1),
|
|
11435
|
+
disabled: L >= E,
|
|
11439
11436
|
children: "Next"
|
|
11440
11437
|
}
|
|
11441
11438
|
)
|
|
@@ -11449,9 +11446,9 @@ function Ls() {
|
|
|
11449
11446
|
timeoutMs: t.config.requestTimeout,
|
|
11450
11447
|
retryAttempts: t.config.retryAttempts,
|
|
11451
11448
|
getAccessToken: t._internal?.getAccessToken
|
|
11452
|
-
}) : null, [t]), d =
|
|
11449
|
+
}) : null, [t]), d = x(() => {
|
|
11453
11450
|
s(null);
|
|
11454
|
-
}, []), h =
|
|
11451
|
+
}, []), h = x(async () => {
|
|
11455
11452
|
if (!c)
|
|
11456
11453
|
throw new Error("useWithdrawal must be used within a CedrosLoginProvider");
|
|
11457
11454
|
try {
|
|
@@ -11460,7 +11457,7 @@ function Ls() {
|
|
|
11460
11457
|
const m = O(w, "Failed to fetch wallet balances");
|
|
11461
11458
|
throw s(m.message), m;
|
|
11462
11459
|
}
|
|
11463
|
-
}, [c]), p =
|
|
11460
|
+
}, [c]), p = x(
|
|
11464
11461
|
async (w, m) => {
|
|
11465
11462
|
if (!c)
|
|
11466
11463
|
throw new Error("useWithdrawal must be used within a CedrosLoginProvider");
|
|
@@ -11479,7 +11476,7 @@ function Ls() {
|
|
|
11479
11476
|
}
|
|
11480
11477
|
},
|
|
11481
11478
|
[c]
|
|
11482
|
-
), f =
|
|
11479
|
+
), f = x(
|
|
11483
11480
|
async (w, m, u) => {
|
|
11484
11481
|
if (!c)
|
|
11485
11482
|
throw new Error("useWithdrawal must be used within a CedrosLoginProvider");
|
|
@@ -11499,7 +11496,7 @@ function Ls() {
|
|
|
11499
11496
|
}
|
|
11500
11497
|
},
|
|
11501
11498
|
[c]
|
|
11502
|
-
), g =
|
|
11499
|
+
), g = x(
|
|
11503
11500
|
async (w = 10, m = 0) => {
|
|
11504
11501
|
if (!c)
|
|
11505
11502
|
throw new Error("useWithdrawal must be used within a CedrosLoginProvider");
|
|
@@ -11558,15 +11555,15 @@ function Ac({
|
|
|
11558
11555
|
onCancel: o,
|
|
11559
11556
|
className: a = ""
|
|
11560
11557
|
}) {
|
|
11561
|
-
const s = ve(), { withdrawSol: n, withdrawSpl: l, getBalances: c, isSubmitting: d, error: h, clearError: p } = Ls(), [f, g] = k("loading"), [w, m] = k([]), [u, y] = k(null), [A, b] = k(""), [
|
|
11562
|
-
if (!
|
|
11563
|
-
const I = `https://explorer.solana.com/tx/${
|
|
11558
|
+
const s = ve(), { withdrawSol: n, withdrawSpl: l, getBalances: c, isSubmitting: d, error: h, clearError: p } = Ls(), [f, g] = k("loading"), [w, m] = k([]), [u, y] = k(null), [A, b] = k(""), [C, N] = k(""), [P, v] = k(null), [E, L] = k(null), [S, B] = k(null), T = s?.config.solana?.network ?? "mainnet-beta", M = q(() => {
|
|
11559
|
+
if (!P?.txSignature) return "";
|
|
11560
|
+
const I = `https://explorer.solana.com/tx/${P.txSignature}`;
|
|
11564
11561
|
return T === "mainnet-beta" ? I : `${I}?cluster=${encodeURIComponent(T)}`;
|
|
11565
|
-
}, [
|
|
11566
|
-
if (!u || !
|
|
11567
|
-
const I = parseFloat(
|
|
11562
|
+
}, [P, T]), R = q(() => {
|
|
11563
|
+
if (!u || !C) return "0";
|
|
11564
|
+
const I = parseFloat(C);
|
|
11568
11565
|
return isNaN(I) || I <= 0 ? "0" : Math.floor(I * Math.pow(10, u.decimals)).toString();
|
|
11569
|
-
}, [
|
|
11566
|
+
}, [C, u]);
|
|
11570
11567
|
_(() => {
|
|
11571
11568
|
if (!s) return;
|
|
11572
11569
|
let I = !1;
|
|
@@ -11600,34 +11597,34 @@ function Ac({
|
|
|
11600
11597
|
I = !0;
|
|
11601
11598
|
};
|
|
11602
11599
|
}, [s, c]);
|
|
11603
|
-
const D =
|
|
11600
|
+
const D = x(
|
|
11604
11601
|
(I) => {
|
|
11605
|
-
y(I), g("form"), p(),
|
|
11602
|
+
y(I), g("form"), p(), L(null), N("");
|
|
11606
11603
|
},
|
|
11607
11604
|
[p]
|
|
11608
|
-
), F =
|
|
11605
|
+
), F = x(() => {
|
|
11609
11606
|
if (!u) return;
|
|
11610
11607
|
const I = Number(u.rawBalance) / Math.pow(10, u.decimals);
|
|
11611
|
-
u.mint === Rt ?
|
|
11612
|
-
}, [u]), Z =
|
|
11613
|
-
if (
|
|
11614
|
-
|
|
11608
|
+
u.mint === Rt ? N(String(Math.max(0, I - 0.01))) : N(String(I));
|
|
11609
|
+
}, [u]), Z = x(() => {
|
|
11610
|
+
if (L(null), !A.trim()) {
|
|
11611
|
+
L("Destination address is required");
|
|
11615
11612
|
return;
|
|
11616
11613
|
}
|
|
11617
11614
|
if (!Ci(A.trim())) {
|
|
11618
|
-
|
|
11615
|
+
L("Invalid Solana address");
|
|
11619
11616
|
return;
|
|
11620
11617
|
}
|
|
11621
|
-
if (!
|
|
11622
|
-
|
|
11618
|
+
if (!C || parseFloat(C) <= 0 || isNaN(parseFloat(C))) {
|
|
11619
|
+
L("Please enter a valid amount");
|
|
11623
11620
|
return;
|
|
11624
11621
|
}
|
|
11625
11622
|
if (R === "0") {
|
|
11626
|
-
|
|
11623
|
+
L("Amount is too small");
|
|
11627
11624
|
return;
|
|
11628
11625
|
}
|
|
11629
11626
|
g("confirm");
|
|
11630
|
-
}, [A,
|
|
11627
|
+
}, [A, C, R]), he = x(async () => {
|
|
11631
11628
|
if (u) {
|
|
11632
11629
|
g("processing"), p();
|
|
11633
11630
|
try {
|
|
@@ -11646,10 +11643,10 @@ function Ac({
|
|
|
11646
11643
|
p,
|
|
11647
11644
|
t,
|
|
11648
11645
|
r
|
|
11649
|
-
]), te =
|
|
11650
|
-
p(),
|
|
11651
|
-
}, [f, p]), H =
|
|
11652
|
-
g("select"), y(null), b(""),
|
|
11646
|
+
]), te = x(() => {
|
|
11647
|
+
p(), L(null), f === "form" ? (g("select"), y(null), N(""), b("")) : f === "confirm" && g("form");
|
|
11648
|
+
}, [f, p]), H = x(() => {
|
|
11649
|
+
g("select"), y(null), b(""), N(""), v(null), p(), L(null);
|
|
11653
11650
|
}, [p]);
|
|
11654
11651
|
return s ? /* @__PURE__ */ i("div", { className: `cedros-withdrawal ${a}`, children: [
|
|
11655
11652
|
f === "loading" && /* @__PURE__ */ i("div", { className: "cedros-withdrawal-processing", children: [
|
|
@@ -11738,8 +11735,8 @@ function Ac({
|
|
|
11738
11735
|
type: "number",
|
|
11739
11736
|
className: "cedros-input",
|
|
11740
11737
|
placeholder: "0.00",
|
|
11741
|
-
value:
|
|
11742
|
-
onChange: (I) =>
|
|
11738
|
+
value: C,
|
|
11739
|
+
onChange: (I) => N(I.target.value),
|
|
11743
11740
|
min: "0",
|
|
11744
11741
|
step: "any"
|
|
11745
11742
|
}
|
|
@@ -11755,7 +11752,7 @@ function Ac({
|
|
|
11755
11752
|
)
|
|
11756
11753
|
] })
|
|
11757
11754
|
] }),
|
|
11758
|
-
(
|
|
11755
|
+
(E || h) && /* @__PURE__ */ e(ee, { error: E || h || "" }),
|
|
11759
11756
|
/* @__PURE__ */ e(
|
|
11760
11757
|
"button",
|
|
11761
11758
|
{
|
|
@@ -11834,7 +11831,7 @@ function Ac({
|
|
|
11834
11831
|
"..."
|
|
11835
11832
|
] })
|
|
11836
11833
|
] }),
|
|
11837
|
-
f === "success" &&
|
|
11834
|
+
f === "success" && P && /* @__PURE__ */ i("div", { className: "cedros-withdrawal-success", children: [
|
|
11838
11835
|
/* @__PURE__ */ e("div", { className: "cedros-withdrawal-success-icon", children: "✓" }),
|
|
11839
11836
|
/* @__PURE__ */ e("h3", { className: "cedros-withdrawal-title", children: "Withdrawal Complete" }),
|
|
11840
11837
|
/* @__PURE__ */ i("p", { className: "cedros-withdrawal-subtitle", children: [
|
|
@@ -11853,7 +11850,7 @@ function Ac({
|
|
|
11853
11850
|
href: M,
|
|
11854
11851
|
target: "_blank",
|
|
11855
11852
|
rel: "noreferrer",
|
|
11856
|
-
children: Dt(
|
|
11853
|
+
children: Dt(P.txSignature)
|
|
11857
11854
|
}
|
|
11858
11855
|
)
|
|
11859
11856
|
] }),
|
|
@@ -11900,13 +11897,13 @@ function vc({
|
|
|
11900
11897
|
onTransactionClick: o,
|
|
11901
11898
|
explorerUrl: a = "https://solscan.io"
|
|
11902
11899
|
}) {
|
|
11903
|
-
const { getHistory: s, error: n, clearError: l } = Ls(), [c, d] = k([]), [h, p] = k(0), [f, g] = k(0), [w, m] = k(!1), [u, y] = k(null), A =
|
|
11900
|
+
const { getHistory: s, error: n, clearError: l } = Ls(), [c, d] = k([]), [h, p] = k(0), [f, g] = k(0), [w, m] = k(!1), [u, y] = k(null), A = x(async () => {
|
|
11904
11901
|
m(!0);
|
|
11905
11902
|
try {
|
|
11906
|
-
const
|
|
11907
|
-
d(
|
|
11908
|
-
} catch (
|
|
11909
|
-
y(
|
|
11903
|
+
const P = await s(t, f);
|
|
11904
|
+
d(P.items), p(P.total), y(null);
|
|
11905
|
+
} catch (P) {
|
|
11906
|
+
y(P instanceof Error ? P.message : "Failed to load withdrawal history");
|
|
11910
11907
|
} finally {
|
|
11911
11908
|
m(!1);
|
|
11912
11909
|
}
|
|
@@ -11914,8 +11911,8 @@ function vc({
|
|
|
11914
11911
|
_(() => {
|
|
11915
11912
|
A();
|
|
11916
11913
|
}, [A]);
|
|
11917
|
-
const b = Math.ceil(h / t),
|
|
11918
|
-
const v = (
|
|
11914
|
+
const b = Math.ceil(h / t), C = Math.floor(f / t) + 1, N = (P) => {
|
|
11915
|
+
const v = (P - 1) * t;
|
|
11919
11916
|
g(Math.max(0, Math.min(v, Math.max(0, h - 1))));
|
|
11920
11917
|
};
|
|
11921
11918
|
return u || n ? /* @__PURE__ */ i("div", { className: `cedros-withdrawal-history cedros-withdrawal-history-error ${r}`, children: [
|
|
@@ -11950,15 +11947,15 @@ function vc({
|
|
|
11950
11947
|
)
|
|
11951
11948
|
] }),
|
|
11952
11949
|
c.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-tx-empty", children: /* @__PURE__ */ e("p", { className: "cedros-tx-empty-message", children: "No withdrawal history yet." }) }) : /* @__PURE__ */ i(X, { children: [
|
|
11953
|
-
/* @__PURE__ */ e("div", { className: "cedros-tx-list", children: c.map((
|
|
11954
|
-
const v = Ei(
|
|
11950
|
+
/* @__PURE__ */ e("div", { className: "cedros-tx-list", children: c.map((P) => {
|
|
11951
|
+
const v = Ei(P.tokenType, P.tokenMint);
|
|
11955
11952
|
return /* @__PURE__ */ i(
|
|
11956
11953
|
"div",
|
|
11957
11954
|
{
|
|
11958
11955
|
className: "cedros-tx-item cedros-tx-item-negative",
|
|
11959
|
-
onClick: () => o?.(
|
|
11960
|
-
onKeyDown: (
|
|
11961
|
-
(
|
|
11956
|
+
onClick: () => o?.(P),
|
|
11957
|
+
onKeyDown: (E) => {
|
|
11958
|
+
(E.key === "Enter" || E.key === " ") && (E.preventDefault(), o?.(P));
|
|
11962
11959
|
},
|
|
11963
11960
|
role: o ? "button" : void 0,
|
|
11964
11961
|
tabIndex: o ? 0 : void 0,
|
|
@@ -11971,7 +11968,7 @@ function vc({
|
|
|
11971
11968
|
" Withdrawal"
|
|
11972
11969
|
] }),
|
|
11973
11970
|
/* @__PURE__ */ i("span", { className: "cedros-tx-amount cedros-tx-amount-negative", children: [
|
|
11974
|
-
|
|
11971
|
+
P.amount,
|
|
11975
11972
|
" ",
|
|
11976
11973
|
v === "SOL" ? "lamports" : ""
|
|
11977
11974
|
] })
|
|
@@ -11983,31 +11980,31 @@ function vc({
|
|
|
11983
11980
|
/* @__PURE__ */ e(
|
|
11984
11981
|
"a",
|
|
11985
11982
|
{
|
|
11986
|
-
href: `${a}/account/${
|
|
11983
|
+
href: `${a}/account/${P.destination}`,
|
|
11987
11984
|
target: "_blank",
|
|
11988
11985
|
rel: "noopener noreferrer",
|
|
11989
|
-
onClick: (
|
|
11990
|
-
children: Si(
|
|
11986
|
+
onClick: (E) => E.stopPropagation(),
|
|
11987
|
+
children: Si(P.destination)
|
|
11991
11988
|
}
|
|
11992
11989
|
),
|
|
11993
11990
|
" · ",
|
|
11994
11991
|
/* @__PURE__ */ e(
|
|
11995
11992
|
"a",
|
|
11996
11993
|
{
|
|
11997
|
-
href: `${a}/tx/${
|
|
11994
|
+
href: `${a}/tx/${P.txSignature}`,
|
|
11998
11995
|
target: "_blank",
|
|
11999
11996
|
rel: "noopener noreferrer",
|
|
12000
|
-
onClick: (
|
|
11997
|
+
onClick: (E) => E.stopPropagation(),
|
|
12001
11998
|
children: "tx"
|
|
12002
11999
|
}
|
|
12003
12000
|
)
|
|
12004
12001
|
] }),
|
|
12005
|
-
/* @__PURE__ */ e("span", { className: "cedros-tx-date", children: xi(
|
|
12002
|
+
/* @__PURE__ */ e("span", { className: "cedros-tx-date", children: xi(P.createdAt) })
|
|
12006
12003
|
] })
|
|
12007
12004
|
] })
|
|
12008
12005
|
]
|
|
12009
12006
|
},
|
|
12010
|
-
|
|
12007
|
+
P.id
|
|
12011
12008
|
);
|
|
12012
12009
|
}) }),
|
|
12013
12010
|
b > 1 && /* @__PURE__ */ i("div", { className: "cedros-tx-pagination", children: [
|
|
@@ -12016,14 +12013,14 @@ function vc({
|
|
|
12016
12013
|
{
|
|
12017
12014
|
type: "button",
|
|
12018
12015
|
className: "cedros-tx-page-btn",
|
|
12019
|
-
onClick: () =>
|
|
12020
|
-
disabled:
|
|
12016
|
+
onClick: () => N(C - 1),
|
|
12017
|
+
disabled: C <= 1,
|
|
12021
12018
|
children: "Previous"
|
|
12022
12019
|
}
|
|
12023
12020
|
),
|
|
12024
12021
|
/* @__PURE__ */ i("span", { className: "cedros-tx-page-info", children: [
|
|
12025
12022
|
"Page ",
|
|
12026
|
-
|
|
12023
|
+
C,
|
|
12027
12024
|
" of ",
|
|
12028
12025
|
b
|
|
12029
12026
|
] }),
|
|
@@ -12032,8 +12029,8 @@ function vc({
|
|
|
12032
12029
|
{
|
|
12033
12030
|
type: "button",
|
|
12034
12031
|
className: "cedros-tx-page-btn",
|
|
12035
|
-
onClick: () =>
|
|
12036
|
-
disabled:
|
|
12032
|
+
onClick: () => N(C + 1),
|
|
12033
|
+
disabled: C >= b,
|
|
12037
12034
|
children: "Next"
|
|
12038
12035
|
}
|
|
12039
12036
|
)
|
|
@@ -12126,7 +12123,7 @@ function Cc() {
|
|
|
12126
12123
|
o?.getAccessToken
|
|
12127
12124
|
),
|
|
12128
12125
|
[t.serverUrl, t.requestTimeout, t.retryAttempts, o]
|
|
12129
|
-
), p =
|
|
12126
|
+
), p = x(async () => {
|
|
12130
12127
|
if (r !== "authenticated") {
|
|
12131
12128
|
s([]);
|
|
12132
12129
|
return;
|
|
@@ -12144,7 +12141,7 @@ function Cc() {
|
|
|
12144
12141
|
_(() => {
|
|
12145
12142
|
r === "authenticated" ? p() : s([]);
|
|
12146
12143
|
}, [r, p]);
|
|
12147
|
-
const f =
|
|
12144
|
+
const f = x(async () => {
|
|
12148
12145
|
l(!0), d(null);
|
|
12149
12146
|
try {
|
|
12150
12147
|
const w = await h.revokeAllSessions();
|
|
@@ -12178,7 +12175,7 @@ function Ec() {
|
|
|
12178
12175
|
r?.getAccessToken
|
|
12179
12176
|
),
|
|
12180
12177
|
[t.serverUrl, t.requestTimeout, t.retryAttempts, r]
|
|
12181
|
-
), n =
|
|
12178
|
+
), n = x(
|
|
12182
12179
|
async (d) => {
|
|
12183
12180
|
a((h) => ({ ...h, isLoading: !0, error: null }));
|
|
12184
12181
|
try {
|
|
@@ -12200,10 +12197,10 @@ function Ec() {
|
|
|
12200
12197
|
}
|
|
12201
12198
|
},
|
|
12202
12199
|
[s]
|
|
12203
|
-
), l =
|
|
12200
|
+
), l = x(
|
|
12204
12201
|
async (d) => (await n(d)).allowed,
|
|
12205
12202
|
[n]
|
|
12206
|
-
), c =
|
|
12203
|
+
), c = x(() => {
|
|
12207
12204
|
a({
|
|
12208
12205
|
allowed: !1,
|
|
12209
12206
|
reason: void 0,
|
|
@@ -12219,7 +12216,7 @@ function Ec() {
|
|
|
12219
12216
|
};
|
|
12220
12217
|
}
|
|
12221
12218
|
function Sc() {
|
|
12222
|
-
const { listAllWallets: t, createDerivedWallet: r, deleteDerivedWallet: o } = Pe(), [a, s] = k([]), [n, l] = k(!1), [c, d] = k(null), h =
|
|
12219
|
+
const { listAllWallets: t, createDerivedWallet: r, deleteDerivedWallet: o } = Pe(), [a, s] = k([]), [n, l] = k(!1), [c, d] = k(null), h = x(async () => {
|
|
12223
12220
|
l(!0), d(null);
|
|
12224
12221
|
try {
|
|
12225
12222
|
const w = await t();
|
|
@@ -12230,7 +12227,7 @@ function Sc() {
|
|
|
12230
12227
|
} finally {
|
|
12231
12228
|
l(!1);
|
|
12232
12229
|
}
|
|
12233
|
-
}, [t]), p =
|
|
12230
|
+
}, [t]), p = x(
|
|
12234
12231
|
async (w) => {
|
|
12235
12232
|
l(!0), d(null);
|
|
12236
12233
|
try {
|
|
@@ -12244,7 +12241,7 @@ function Sc() {
|
|
|
12244
12241
|
}
|
|
12245
12242
|
},
|
|
12246
12243
|
[r, h]
|
|
12247
|
-
), f =
|
|
12244
|
+
), f = x(
|
|
12248
12245
|
async (w) => {
|
|
12249
12246
|
l(!0), d(null);
|
|
12250
12247
|
try {
|
|
@@ -12257,7 +12254,7 @@ function Sc() {
|
|
|
12257
12254
|
}
|
|
12258
12255
|
},
|
|
12259
12256
|
[o, h]
|
|
12260
|
-
), g =
|
|
12257
|
+
), g = x(() => d(null), []);
|
|
12261
12258
|
return {
|
|
12262
12259
|
wallets: a,
|
|
12263
12260
|
isLoading: n,
|
|
@@ -12274,7 +12271,7 @@ function xc() {
|
|
|
12274
12271
|
timeoutMs: t.config.requestTimeout,
|
|
12275
12272
|
retryAttempts: t.config.retryAttempts,
|
|
12276
12273
|
getAccessToken: t._internal?.getAccessToken
|
|
12277
|
-
}) : null, [t]), d =
|
|
12274
|
+
}) : null, [t]), d = x(async () => {
|
|
12278
12275
|
if (!c)
|
|
12279
12276
|
throw new Error("usePendingRecovery must be used within a CedrosLoginProvider");
|
|
12280
12277
|
o(!0), s(null);
|
|
@@ -12287,7 +12284,7 @@ function xc() {
|
|
|
12287
12284
|
} finally {
|
|
12288
12285
|
o(!1);
|
|
12289
12286
|
}
|
|
12290
|
-
}, [c]), h =
|
|
12287
|
+
}, [c]), h = x(async () => {
|
|
12291
12288
|
if (!c)
|
|
12292
12289
|
throw new Error("usePendingRecovery must be used within a CedrosLoginProvider");
|
|
12293
12290
|
o(!0), s(null);
|
|
@@ -12300,7 +12297,7 @@ function xc() {
|
|
|
12300
12297
|
} finally {
|
|
12301
12298
|
o(!1);
|
|
12302
12299
|
}
|
|
12303
|
-
}, [c]), p =
|
|
12300
|
+
}, [c]), p = x(() => s(null), []);
|
|
12304
12301
|
return _(() => {
|
|
12305
12302
|
c && t?.authState === "authenticated" && d().catch(() => {
|
|
12306
12303
|
});
|
|
@@ -12324,7 +12321,7 @@ function Pc(t = {}) {
|
|
|
12324
12321
|
clearError: h
|
|
12325
12322
|
} = _n(), p = q(() => a && r ? "external" : s === "enrolled_locked" || s === "enrolled_unlocked" ? "sss" : "none", [a, r, s]), f = p !== "none", g = s === "enrolled_locked" || s === "enrolled_unlocked";
|
|
12326
12323
|
return {
|
|
12327
|
-
signTransaction:
|
|
12324
|
+
signTransaction: x(
|
|
12328
12325
|
async (m, u) => {
|
|
12329
12326
|
if (p === "external") {
|
|
12330
12327
|
if (!r)
|