@cedros/login-react 0.0.34 → 0.0.36
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 +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +314 -307
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2410,40 +2410,40 @@ function Pc({
|
|
|
2410
2410
|
);
|
|
2411
2411
|
_(() => {
|
|
2412
2412
|
if (!f) return;
|
|
2413
|
-
const
|
|
2413
|
+
const v = (L) => {
|
|
2414
2414
|
h.current && !h.current.contains(L.target) && (g(!1), p(-1));
|
|
2415
2415
|
}, S = (L) => {
|
|
2416
2416
|
L.key === "Escape" && (g(!1), p(-1), y.current?.focus());
|
|
2417
2417
|
};
|
|
2418
|
-
return document.addEventListener("mousedown",
|
|
2419
|
-
document.removeEventListener("mousedown",
|
|
2418
|
+
return document.addEventListener("mousedown", v), document.addEventListener("keydown", S), () => {
|
|
2419
|
+
document.removeEventListener("mousedown", v), document.removeEventListener("keydown", S);
|
|
2420
2420
|
};
|
|
2421
2421
|
}, [f]);
|
|
2422
|
-
const
|
|
2423
|
-
(
|
|
2422
|
+
const A = x(
|
|
2423
|
+
(v) => {
|
|
2424
2424
|
if (!(!f || b.length === 0))
|
|
2425
|
-
switch (
|
|
2425
|
+
switch (v.key) {
|
|
2426
2426
|
case "ArrowDown":
|
|
2427
|
-
|
|
2427
|
+
v.preventDefault(), p((S) => (S + 1) % b.length);
|
|
2428
2428
|
break;
|
|
2429
2429
|
case "ArrowUp":
|
|
2430
|
-
|
|
2430
|
+
v.preventDefault(), p((S) => (S - 1 + b.length) % b.length);
|
|
2431
2431
|
break;
|
|
2432
2432
|
case "Home":
|
|
2433
|
-
|
|
2433
|
+
v.preventDefault(), p(0);
|
|
2434
2434
|
break;
|
|
2435
2435
|
case "End":
|
|
2436
|
-
|
|
2436
|
+
v.preventDefault(), p(b.length - 1);
|
|
2437
2437
|
break;
|
|
2438
2438
|
case "Enter":
|
|
2439
2439
|
case " ":
|
|
2440
|
-
w >= 0 && (
|
|
2440
|
+
w >= 0 && (v.preventDefault(), b[w].onClick(), g(!1), p(-1));
|
|
2441
2441
|
break;
|
|
2442
2442
|
}
|
|
2443
2443
|
},
|
|
2444
2444
|
[f, w, b]
|
|
2445
2445
|
), N = x(() => {
|
|
2446
|
-
b.length !== 0 && (g((
|
|
2446
|
+
b.length !== 0 && (g((v) => !v), p(-1));
|
|
2447
2447
|
}, [b.length]), E = {
|
|
2448
2448
|
sm: "cedros-button-sm",
|
|
2449
2449
|
md: "cedros-button-md",
|
|
@@ -2464,10 +2464,10 @@ function Pc({
|
|
|
2464
2464
|
}
|
|
2465
2465
|
);
|
|
2466
2466
|
if (c && l) {
|
|
2467
|
-
const
|
|
2467
|
+
const v = l.name || l.email || "User", S = Gr(l.picture);
|
|
2468
2468
|
return (
|
|
2469
2469
|
// L-08: Added keyboard handler and ref for accessibility
|
|
2470
|
-
/* @__PURE__ */ i("div", { className: "cedros-user-menu", ref: h, onKeyDown:
|
|
2470
|
+
/* @__PURE__ */ i("div", { className: "cedros-user-menu", ref: h, onKeyDown: A, children: [
|
|
2471
2471
|
/* @__PURE__ */ i(
|
|
2472
2472
|
"button",
|
|
2473
2473
|
{
|
|
@@ -2476,20 +2476,20 @@ function Pc({
|
|
|
2476
2476
|
className: `cedros-button cedros-user-button ${E[o]} ${t}`,
|
|
2477
2477
|
"aria-haspopup": "menu",
|
|
2478
2478
|
"aria-expanded": f,
|
|
2479
|
-
"aria-label": `User menu for ${
|
|
2479
|
+
"aria-label": `User menu for ${v}`,
|
|
2480
2480
|
onClick: N,
|
|
2481
2481
|
children: [
|
|
2482
2482
|
S ? /* @__PURE__ */ e(
|
|
2483
2483
|
"img",
|
|
2484
2484
|
{
|
|
2485
2485
|
src: S,
|
|
2486
|
-
alt:
|
|
2486
|
+
alt: v,
|
|
2487
2487
|
className: "cedros-user-avatar",
|
|
2488
2488
|
referrerPolicy: "no-referrer",
|
|
2489
2489
|
crossOrigin: "anonymous"
|
|
2490
2490
|
}
|
|
2491
|
-
) : /* @__PURE__ */ e("div", { className: "cedros-user-avatar-placeholder", children: (
|
|
2492
|
-
/* @__PURE__ */ e("span", { className: "cedros-user-name", children:
|
|
2491
|
+
) : /* @__PURE__ */ e("div", { className: "cedros-user-avatar-placeholder", children: (v[0] || "?").toUpperCase() }),
|
|
2492
|
+
/* @__PURE__ */ e("span", { className: "cedros-user-name", children: v })
|
|
2493
2493
|
]
|
|
2494
2494
|
}
|
|
2495
2495
|
),
|
|
@@ -2905,11 +2905,11 @@ function bn() {
|
|
|
2905
2905
|
const y = await window.AppleID.auth.signIn();
|
|
2906
2906
|
if (h = y.authorization?.id_token, !h)
|
|
2907
2907
|
throw new Error("No ID token received from Apple");
|
|
2908
|
-
const b = y.user?.name ? `${y.user.name.firstName || ""} ${y.user.name.lastName || ""}`.trim() : void 0,
|
|
2908
|
+
const b = y.user?.name ? `${y.user.name.firstName || ""} ${y.user.name.lastName || ""}`.trim() : void 0, A = await f.post("/apple", {
|
|
2909
2909
|
idToken: h,
|
|
2910
2910
|
name: b || void 0
|
|
2911
2911
|
});
|
|
2912
|
-
return m.current.callbacks?.onLoginSuccess?.(
|
|
2912
|
+
return m.current.callbacks?.onLoginSuccess?.(A.user, "apple"), r?.handleLoginSuccess(A.user, A.tokens), a(!1), A;
|
|
2913
2913
|
} catch (y) {
|
|
2914
2914
|
if (y.error === "popup_closed_by_user") {
|
|
2915
2915
|
const N = {
|
|
@@ -2918,8 +2918,8 @@ function bn() {
|
|
|
2918
2918
|
};
|
|
2919
2919
|
throw c(N), a(!1), N;
|
|
2920
2920
|
}
|
|
2921
|
-
const
|
|
2922
|
-
throw
|
|
2921
|
+
const A = W(y, "Unable to sign in with Apple. Please try again.");
|
|
2922
|
+
throw A.code === "ACCOUNT_LINK_REQUIRED" && h && u(h), c(A), a(!1), A;
|
|
2923
2923
|
}
|
|
2924
2924
|
}, [t.appleClientId, s, f, r]), w = x(() => c(null), []), p = x(() => u(null), []);
|
|
2925
2925
|
return {
|
|
@@ -3240,25 +3240,32 @@ function fs() {
|
|
|
3240
3240
|
} catch (w) {
|
|
3241
3241
|
if (w instanceof Error && (w.name === "NotAllowedError" || w.name === "InvalidStateError"))
|
|
3242
3242
|
try {
|
|
3243
|
-
const
|
|
3243
|
+
const A = await l.post(
|
|
3244
3244
|
"/webauthn/signup/options",
|
|
3245
3245
|
{}
|
|
3246
|
-
),
|
|
3247
|
-
publicKey:
|
|
3246
|
+
), N = ut(A.options), E = await navigator.credentials.create({
|
|
3247
|
+
publicKey: N
|
|
3248
3248
|
});
|
|
3249
|
-
if (!
|
|
3249
|
+
if (!E)
|
|
3250
3250
|
throw new Error("Passkey signup returned no credential");
|
|
3251
|
-
const
|
|
3252
|
-
challengeId:
|
|
3253
|
-
credential: Te(
|
|
3251
|
+
const P = await l.post("/webauthn/signup/verify", {
|
|
3252
|
+
challengeId: A.challengeId,
|
|
3253
|
+
credential: Te(E)
|
|
3254
3254
|
});
|
|
3255
|
-
return t.callbacks?.onLoginSuccess?.(
|
|
3256
|
-
} catch (
|
|
3257
|
-
const
|
|
3258
|
-
throw n(
|
|
3259
|
-
}
|
|
3260
|
-
|
|
3261
|
-
|
|
3255
|
+
return t.callbacks?.onLoginSuccess?.(P.user, "webauthn"), r?.handleLoginSuccess(P.user, P.tokens), P;
|
|
3256
|
+
} catch (A) {
|
|
3257
|
+
const E = Be(A) ?? W(A, "Unable to create passkey. Please try again.");
|
|
3258
|
+
throw n(E), E;
|
|
3259
|
+
}
|
|
3260
|
+
if (typeof w == "object" && w !== null && "isApiError" in w && w.data?.code === "INVALID_CREDENTIALS") {
|
|
3261
|
+
const A = {
|
|
3262
|
+
code: "INVALID_CREDENTIALS",
|
|
3263
|
+
message: "This passkey is not recognized. Please remove old passkeys for this site and try again, or sign in another way."
|
|
3264
|
+
};
|
|
3265
|
+
throw n(A), A;
|
|
3266
|
+
}
|
|
3267
|
+
const b = Be(w) ?? W(w, "Unable to sign in with passkey. Please try again.");
|
|
3268
|
+
throw n(b), b;
|
|
3262
3269
|
} finally {
|
|
3263
3270
|
a(!1);
|
|
3264
3271
|
}
|
|
@@ -3338,16 +3345,16 @@ function Kt({ onSuccess: t, className: r = "", defaultTab: o = "login" }) {
|
|
|
3338
3345
|
}, []);
|
|
3339
3346
|
const g = a.forms?.forgotPassword?.mode ?? (a.features?.instantLink ? "instantLink" : "reset"), w = x(
|
|
3340
3347
|
(P) => {
|
|
3341
|
-
const
|
|
3342
|
-
let S =
|
|
3348
|
+
const v = Re.indexOf(n);
|
|
3349
|
+
let S = v;
|
|
3343
3350
|
switch (P.key) {
|
|
3344
3351
|
case "ArrowLeft":
|
|
3345
3352
|
case "ArrowUp":
|
|
3346
|
-
S =
|
|
3353
|
+
S = v === 0 ? Re.length - 1 : v - 1;
|
|
3347
3354
|
break;
|
|
3348
3355
|
case "ArrowRight":
|
|
3349
3356
|
case "ArrowDown":
|
|
3350
|
-
S =
|
|
3357
|
+
S = v === Re.length - 1 ? 0 : v + 1;
|
|
3351
3358
|
break;
|
|
3352
3359
|
case "Home":
|
|
3353
3360
|
S = 0;
|
|
@@ -3369,14 +3376,14 @@ function Kt({ onSuccess: t, className: r = "", defaultTab: o = "login" }) {
|
|
|
3369
3376
|
apple: !0,
|
|
3370
3377
|
solana: !0,
|
|
3371
3378
|
webauthn: !0
|
|
3372
|
-
}, h = p.email !== !1, y = p.google !== !1 && a.googleClientId, b = p.apple !== !1 && a.appleClientId && f,
|
|
3379
|
+
}, h = p.email !== !1, y = p.google !== !1 && a.googleClientId, b = p.apple !== !1 && a.appleClientId && f, A = p.solana !== !1 && u, N = p.webauthn !== !1, E = h && (y || b || A || N);
|
|
3373
3380
|
return c === "forgotPassword" ? /* @__PURE__ */ e("div", { className: `cedros-login-form ${r}`, children: /* @__PURE__ */ e(wn, { mode: g, onCancel: () => d("form") }) }) : /* @__PURE__ */ i("div", { className: `cedros-login-form ${r}`, children: [
|
|
3374
|
-
(N || y || b ||
|
|
3381
|
+
(N || y || b || A) && (() => {
|
|
3375
3382
|
const P = {
|
|
3376
3383
|
webauthn: N ? /* @__PURE__ */ e(Nn, { onSuccess: t }) : null,
|
|
3377
3384
|
google: y ? /* @__PURE__ */ e(co, { onSuccess: t }) : null,
|
|
3378
3385
|
apple: b ? /* @__PURE__ */ e(An, { onSuccess: t }) : null,
|
|
3379
|
-
solana:
|
|
3386
|
+
solana: A ? /* @__PURE__ */ e(lo, { onSuccess: t }) : null
|
|
3380
3387
|
};
|
|
3381
3388
|
return /* @__PURE__ */ e("div", { className: "cedros-social-buttons", children: (s ?? ["webauthn", "google", "apple", "solana"]).map((S) => {
|
|
3382
3389
|
const L = P[S];
|
|
@@ -3581,8 +3588,8 @@ function Mc({
|
|
|
3581
3588
|
onLoginClick: o,
|
|
3582
3589
|
className: a = ""
|
|
3583
3590
|
}) {
|
|
3584
|
-
const [s, n] = k(""), [l, c] = k(""), [d, u] = k(null), { resetPassword: m, isLoading: f, isSuccess: g, error: w, clearError: p } = Qt(), h = s === l, y = d?.isValid && h && s.length > 0, b = async (
|
|
3585
|
-
if (
|
|
3591
|
+
const [s, n] = k(""), [l, c] = k(""), [d, u] = k(null), { resetPassword: m, isLoading: f, isSuccess: g, error: w, clearError: p } = Qt(), h = s === l, y = d?.isValid && h && s.length > 0, b = async (A) => {
|
|
3592
|
+
if (A.preventDefault(), !!y)
|
|
3586
3593
|
try {
|
|
3587
3594
|
await m(t, s), r?.();
|
|
3588
3595
|
} catch {
|
|
@@ -3635,8 +3642,8 @@ function Mc({
|
|
|
3635
3642
|
{
|
|
3636
3643
|
label: "New password",
|
|
3637
3644
|
value: s,
|
|
3638
|
-
onChange: (
|
|
3639
|
-
n(
|
|
3645
|
+
onChange: (A) => {
|
|
3646
|
+
n(A.target.value), u(rt(A.target.value));
|
|
3640
3647
|
},
|
|
3641
3648
|
showStrengthMeter: !0,
|
|
3642
3649
|
onValidationChange: u,
|
|
@@ -3650,7 +3657,7 @@ function Mc({
|
|
|
3650
3657
|
{
|
|
3651
3658
|
label: "Confirm password",
|
|
3652
3659
|
value: l,
|
|
3653
|
-
onChange: (
|
|
3660
|
+
onChange: (A) => c(A.target.value),
|
|
3654
3661
|
disabled: f,
|
|
3655
3662
|
autoComplete: "new-password",
|
|
3656
3663
|
error: l && !h ? "Passwords do not match" : void 0
|
|
@@ -4083,8 +4090,8 @@ function In({
|
|
|
4083
4090
|
if (y.key === "Tab" && m.current) {
|
|
4084
4091
|
const b = m.current.querySelectorAll(
|
|
4085
4092
|
'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
4086
|
-
),
|
|
4087
|
-
y.shiftKey ? document.activeElement ===
|
|
4093
|
+
), A = b[0], N = b[b.length - 1];
|
|
4094
|
+
y.shiftKey ? document.activeElement === A && (y.preventDefault(), N?.focus()) : document.activeElement === N && (y.preventDefault(), A?.focus());
|
|
4088
4095
|
}
|
|
4089
4096
|
};
|
|
4090
4097
|
return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
|
|
@@ -4399,9 +4406,9 @@ function zn({
|
|
|
4399
4406
|
className: s = ""
|
|
4400
4407
|
}) {
|
|
4401
4408
|
const [n, l] = k(Array(le).fill("")), [c, d] = k(null), [u, m] = k([]), [f, g] = k(null), w = Yr(), p = J(null), h = x(
|
|
4402
|
-
(
|
|
4409
|
+
(v, S) => {
|
|
4403
4410
|
const L = [...n];
|
|
4404
|
-
if (L[
|
|
4411
|
+
if (L[v] = S.toLowerCase().trim(), l(L), S.length > 0) {
|
|
4405
4412
|
const C = un(S, 5);
|
|
4406
4413
|
m(C);
|
|
4407
4414
|
} else
|
|
@@ -4409,13 +4416,13 @@ function zn({
|
|
|
4409
4416
|
g(null);
|
|
4410
4417
|
},
|
|
4411
4418
|
[n]
|
|
4412
|
-
), y = x((
|
|
4413
|
-
d(
|
|
4419
|
+
), y = x((v) => {
|
|
4420
|
+
d(v), m([]);
|
|
4414
4421
|
}, []), b = x(
|
|
4415
|
-
(
|
|
4416
|
-
const S = n[
|
|
4417
|
-
S && !qe(S) && g(`Word ${
|
|
4418
|
-
c ===
|
|
4422
|
+
(v) => {
|
|
4423
|
+
const S = n[v];
|
|
4424
|
+
S && !qe(S) && g(`Word ${v + 1} is not in the wordlist`), p.current !== null && window.clearTimeout(p.current), p.current = window.setTimeout(() => {
|
|
4425
|
+
c === v && m([]);
|
|
4419
4426
|
}, 200);
|
|
4420
4427
|
},
|
|
4421
4428
|
[n, c]
|
|
@@ -4423,22 +4430,22 @@ function zn({
|
|
|
4423
4430
|
_(() => () => {
|
|
4424
4431
|
p.current !== null && (window.clearTimeout(p.current), p.current = null);
|
|
4425
4432
|
}, []);
|
|
4426
|
-
const
|
|
4427
|
-
(
|
|
4433
|
+
const A = x(
|
|
4434
|
+
(v) => {
|
|
4428
4435
|
if (c !== null) {
|
|
4429
4436
|
const S = [...n];
|
|
4430
|
-
S[c] =
|
|
4437
|
+
S[c] = v, l(S), m([]), document.querySelector(
|
|
4431
4438
|
`[data-word-index="${c + 1}"]`
|
|
4432
4439
|
)?.focus();
|
|
4433
4440
|
}
|
|
4434
4441
|
},
|
|
4435
4442
|
[c, n]
|
|
4436
|
-
), N = x((
|
|
4437
|
-
const S =
|
|
4438
|
-
L.length === le && (
|
|
4443
|
+
), N = x((v) => {
|
|
4444
|
+
const S = v.clipboardData.getData("text"), L = pn(S);
|
|
4445
|
+
L.length === le && (v.preventDefault(), l(L), g(null));
|
|
4439
4446
|
}, []), E = x(
|
|
4440
|
-
(
|
|
4441
|
-
if (
|
|
4447
|
+
(v) => {
|
|
4448
|
+
if (v.preventDefault(), n.filter((C) => !C).length > 0) {
|
|
4442
4449
|
g(`Please enter all ${le} words`);
|
|
4443
4450
|
return;
|
|
4444
4451
|
}
|
|
@@ -4466,7 +4473,7 @@ function zn({
|
|
|
4466
4473
|
/* @__PURE__ */ e("h3", { className: "cedros-recovery-input-title", children: "Enter Recovery Phrase" }),
|
|
4467
4474
|
/* @__PURE__ */ e("p", { className: "cedros-recovery-input-description", children: "Enter your 12-word recovery phrase. You can paste the entire phrase at once." })
|
|
4468
4475
|
] }),
|
|
4469
|
-
/* @__PURE__ */ e("div", { className: "cedros-word-inputs", children: Array.from({ length: le }, (
|
|
4476
|
+
/* @__PURE__ */ e("div", { className: "cedros-word-inputs", children: Array.from({ length: le }, (v, S) => /* @__PURE__ */ i("div", { className: "cedros-word-input-wrapper", children: [
|
|
4470
4477
|
/* @__PURE__ */ i("label", { className: "cedros-word-label", children: [
|
|
4471
4478
|
S + 1,
|
|
4472
4479
|
"."
|
|
@@ -4489,16 +4496,16 @@ function zn({
|
|
|
4489
4496
|
}
|
|
4490
4497
|
)
|
|
4491
4498
|
] }, S)) }),
|
|
4492
|
-
c !== null && u.length > 0 && /* @__PURE__ */ e("div", { className: "cedros-suggestions", role: "listbox", id: `${w}-suggestions`, children: u.map((
|
|
4499
|
+
c !== null && u.length > 0 && /* @__PURE__ */ e("div", { className: "cedros-suggestions", role: "listbox", id: `${w}-suggestions`, children: u.map((v) => /* @__PURE__ */ e(
|
|
4493
4500
|
"button",
|
|
4494
4501
|
{
|
|
4495
4502
|
type: "button",
|
|
4496
4503
|
className: "cedros-suggestion",
|
|
4497
|
-
onClick: () => v
|
|
4504
|
+
onClick: () => A(v),
|
|
4498
4505
|
role: "option",
|
|
4499
|
-
children:
|
|
4506
|
+
children: v
|
|
4500
4507
|
},
|
|
4501
|
-
|
|
4508
|
+
v
|
|
4502
4509
|
)) }),
|
|
4503
4510
|
P && /* @__PURE__ */ e("p", { className: "cedros-input-error", role: "alert", children: P }),
|
|
4504
4511
|
/* @__PURE__ */ i("div", { className: "cedros-recovery-input-actions", children: [
|
|
@@ -4668,17 +4675,17 @@ function Kn() {
|
|
|
4668
4675
|
const u = x(
|
|
4669
4676
|
async (p, h, y, b) => {
|
|
4670
4677
|
s({ step: "generating_seed" });
|
|
4671
|
-
const
|
|
4672
|
-
c.current.push(
|
|
4673
|
-
const { shareA: N, shareB: E, shareC: P } = rs(
|
|
4678
|
+
const A = Zs();
|
|
4679
|
+
c.current.push(A), s({ step: "splitting_shares" });
|
|
4680
|
+
const { shareA: N, shareB: E, shareC: P } = rs(A);
|
|
4674
4681
|
c.current.push(N, E, P), s({ step: "encrypting_shares" });
|
|
4675
|
-
const
|
|
4682
|
+
const v = await jr(N, zr(h)), S = ss(A), L = os(S);
|
|
4676
4683
|
s({ step: "uploading" });
|
|
4677
4684
|
const C = {
|
|
4678
4685
|
solanaPubkey: L,
|
|
4679
4686
|
shareAAuthMethod: p,
|
|
4680
|
-
shareACiphertext:
|
|
4681
|
-
shareANonce:
|
|
4687
|
+
shareACiphertext: v.ciphertext,
|
|
4688
|
+
shareANonce: v.nonce,
|
|
4682
4689
|
// Share B is now plaintext (SSS math protects it)
|
|
4683
4690
|
shareB: we(E)
|
|
4684
4691
|
};
|
|
@@ -4692,7 +4699,7 @@ function Kn() {
|
|
|
4692
4699
|
solanaPubkey: L
|
|
4693
4700
|
});
|
|
4694
4701
|
else {
|
|
4695
|
-
const B = o === "full_seed" ? ln(
|
|
4702
|
+
const B = o === "full_seed" ? ln(A) : an(He(P));
|
|
4696
4703
|
s({
|
|
4697
4704
|
step: "showing_recovery",
|
|
4698
4705
|
recoveryPhrase: B,
|
|
@@ -4732,16 +4739,16 @@ function Kn() {
|
|
|
4732
4739
|
s({ step: "registering_passkey" });
|
|
4733
4740
|
let y;
|
|
4734
4741
|
try {
|
|
4735
|
-
const
|
|
4742
|
+
const A = new TextEncoder().encode(t.id), N = t.name ?? t.email ?? "User", E = t.email ?? t.id;
|
|
4736
4743
|
y = (await eo(
|
|
4737
|
-
|
|
4744
|
+
A,
|
|
4738
4745
|
E,
|
|
4739
4746
|
N,
|
|
4740
4747
|
p
|
|
4741
4748
|
)).prfOutput;
|
|
4742
|
-
} catch (
|
|
4743
|
-
if (
|
|
4744
|
-
throw
|
|
4749
|
+
} catch (A) {
|
|
4750
|
+
if (A?.name !== "InvalidStateError")
|
|
4751
|
+
throw A;
|
|
4745
4752
|
y = (await zt(h)).prfOutput;
|
|
4746
4753
|
}
|
|
4747
4754
|
c.current.push(y);
|
|
@@ -4786,7 +4793,7 @@ function Yn({
|
|
|
4786
4793
|
confirmRecoveryPhrase: d,
|
|
4787
4794
|
cancel: u,
|
|
4788
4795
|
isEnrolling: m
|
|
4789
|
-
} = Kn(), f = () => a || "password", [g, w] = k(f), [p, h] = k(""), [y, b] = k(""), [
|
|
4796
|
+
} = Kn(), f = () => a || "password", [g, w] = k(f), [p, h] = k(""), [y, b] = k(""), [A, N] = k(null);
|
|
4790
4797
|
_(() => {
|
|
4791
4798
|
w(f());
|
|
4792
4799
|
}, [s?.id, a]);
|
|
@@ -4807,7 +4814,7 @@ function Yn({
|
|
|
4807
4814
|
[p, y, l]
|
|
4808
4815
|
), P = x(async () => {
|
|
4809
4816
|
await c();
|
|
4810
|
-
}, [c]),
|
|
4817
|
+
}, [c]), v = x(() => {
|
|
4811
4818
|
d(), n.solanaPubkey && t?.(n.solanaPubkey);
|
|
4812
4819
|
}, [d, n.solanaPubkey, t]), S = x(() => {
|
|
4813
4820
|
u(), r?.();
|
|
@@ -4851,7 +4858,7 @@ function Yn({
|
|
|
4851
4858
|
] }) }) }) : n.step === "uploading" ? /* @__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: [
|
|
4852
4859
|
/* @__PURE__ */ e("div", { className: "cedros-spinner", "aria-hidden": "true" }),
|
|
4853
4860
|
/* @__PURE__ */ e("p", { children: "Saving wallet..." })
|
|
4854
|
-
] }) }) : n.step === "showing_recovery" && n.recoveryPhrase ? /* @__PURE__ */ e("div", { className: `cedros-wallet-enrollment ${o}`, children: /* @__PURE__ */ e(jn, { words: n.recoveryPhrase, onConfirm:
|
|
4861
|
+
] }) }) : n.step === "showing_recovery" && n.recoveryPhrase ? /* @__PURE__ */ e("div", { className: `cedros-wallet-enrollment ${o}`, children: /* @__PURE__ */ e(jn, { words: n.recoveryPhrase, onConfirm: v }) }) : n.step === "complete" ? /* @__PURE__ */ e("div", { className: `cedros-wallet-enrollment ${o}`, children: /* @__PURE__ */ i("div", { className: "cedros-enrollment-complete", children: [
|
|
4855
4862
|
/* @__PURE__ */ i(
|
|
4856
4863
|
"svg",
|
|
4857
4864
|
{
|
|
@@ -4988,7 +4995,7 @@ function Yn({
|
|
|
4988
4995
|
label: "Confirm Password",
|
|
4989
4996
|
value: y,
|
|
4990
4997
|
onChange: (L) => b(L.target.value),
|
|
4991
|
-
error:
|
|
4998
|
+
error: A ?? void 0,
|
|
4992
4999
|
disabled: m,
|
|
4993
5000
|
required: !0,
|
|
4994
5001
|
minLength: 8,
|
|
@@ -5271,7 +5278,7 @@ function ta({
|
|
|
5271
5278
|
_(() => {
|
|
5272
5279
|
a !== void 0 && w(a);
|
|
5273
5280
|
}, [a]);
|
|
5274
|
-
const
|
|
5281
|
+
const A = g === "password", N = g === "passkey", E = x(async () => {
|
|
5275
5282
|
if (f("credential"), b(null), !g)
|
|
5276
5283
|
try {
|
|
5277
5284
|
const T = await l();
|
|
@@ -5284,7 +5291,7 @@ function ta({
|
|
|
5284
5291
|
T.preventDefault(), b(null), f("unlocking");
|
|
5285
5292
|
try {
|
|
5286
5293
|
let M;
|
|
5287
|
-
if (
|
|
5294
|
+
if (A)
|
|
5288
5295
|
M = { type: "password", password: p };
|
|
5289
5296
|
else
|
|
5290
5297
|
throw new Error("Invalid auth method");
|
|
@@ -5293,8 +5300,8 @@ function ta({
|
|
|
5293
5300
|
b(M instanceof Error ? M.message : "Failed to unlock wallet"), f("error");
|
|
5294
5301
|
}
|
|
5295
5302
|
},
|
|
5296
|
-
[
|
|
5297
|
-
),
|
|
5303
|
+
[A, p, n, t]
|
|
5304
|
+
), v = x(async () => {
|
|
5298
5305
|
b(null), f("unlocking");
|
|
5299
5306
|
try {
|
|
5300
5307
|
const T = await d();
|
|
@@ -5328,7 +5335,7 @@ function ta({
|
|
|
5328
5335
|
)
|
|
5329
5336
|
] });
|
|
5330
5337
|
case "credential":
|
|
5331
|
-
return
|
|
5338
|
+
return A ? /* @__PURE__ */ i("form", { className: "cedros-wallet-unlock-form", onSubmit: P, children: [
|
|
5332
5339
|
/* @__PURE__ */ e("h3", { className: "cedros-wallet-unlock-title", children: "Enter Password" }),
|
|
5333
5340
|
/* @__PURE__ */ e("p", { className: "cedros-wallet-unlock-description", children: "Enter your wallet password to unlock." }),
|
|
5334
5341
|
/* @__PURE__ */ e(
|
|
@@ -5372,8 +5379,8 @@ function ta({
|
|
|
5372
5379
|
mode: "authenticate",
|
|
5373
5380
|
isLoading: C,
|
|
5374
5381
|
error: y ?? void 0,
|
|
5375
|
-
onPrompt:
|
|
5376
|
-
onRetry:
|
|
5382
|
+
onPrompt: v,
|
|
5383
|
+
onRetry: v,
|
|
5377
5384
|
onCancel: o ? S : void 0
|
|
5378
5385
|
}
|
|
5379
5386
|
)
|
|
@@ -5513,8 +5520,8 @@ function na() {
|
|
|
5513
5520
|
c.current.push(T), p = Ho(He(T), He(L)), c.current.push(p);
|
|
5514
5521
|
} else
|
|
5515
5522
|
p = dn(f), c.current.push(p);
|
|
5516
|
-
const h = ss(p), y = os(h), { shareA: b, shareB:
|
|
5517
|
-
c.current.push(b,
|
|
5523
|
+
const h = ss(p), y = os(h), { shareA: b, shareB: A } = rs(p);
|
|
5524
|
+
c.current.push(b, A), s({ step: "encrypting" });
|
|
5518
5525
|
let N, E, P;
|
|
5519
5526
|
if (g === "passkey") {
|
|
5520
5527
|
const L = Hr();
|
|
@@ -5523,14 +5530,14 @@ function na() {
|
|
|
5523
5530
|
c.current.push(C.prfOutput), N = await Qr(C.prfOutput, L), c.current.push(N);
|
|
5524
5531
|
} else
|
|
5525
5532
|
E = Vr(), N = await ns(w, E, Qe), c.current.push(N);
|
|
5526
|
-
const
|
|
5533
|
+
const v = await jr(b, zr(N));
|
|
5527
5534
|
s({ step: "uploading" });
|
|
5528
5535
|
const S = {
|
|
5529
5536
|
solanaPubkey: y,
|
|
5530
5537
|
shareAAuthMethod: g,
|
|
5531
|
-
shareACiphertext:
|
|
5532
|
-
shareANonce:
|
|
5533
|
-
shareB: we(
|
|
5538
|
+
shareACiphertext: v.ciphertext,
|
|
5539
|
+
shareANonce: v.nonce,
|
|
5540
|
+
shareB: we(A)
|
|
5534
5541
|
};
|
|
5535
5542
|
g === "password" && (S.shareAKdfSalt = we(E), S.shareAKdfParams = Qe), g === "passkey" && (S.prfSalt = P), await t(S), d(), s({ step: "complete" });
|
|
5536
5543
|
} catch (p) {
|
|
@@ -5559,7 +5566,7 @@ function aa({
|
|
|
5559
5566
|
className: o = "",
|
|
5560
5567
|
defaultAuthMethod: a = "password"
|
|
5561
5568
|
}) {
|
|
5562
|
-
const { state: s, startRecovery: n, cancel: l, isRecovering: c } = na(), [d, u] = k([]), [m, f] = k(!1), [g, w] = k(a), [p, h] = k(""), [y, b] = k(""), [
|
|
5569
|
+
const { state: s, startRecovery: n, cancel: l, isRecovering: c } = na(), [d, u] = k([]), [m, f] = k(!1), [g, w] = k(a), [p, h] = k(""), [y, b] = k(""), [A, N] = k(null), E = x((C) => {
|
|
5563
5570
|
u(C), f(!0);
|
|
5564
5571
|
}, []), P = x(
|
|
5565
5572
|
async (C) => {
|
|
@@ -5576,7 +5583,7 @@ function aa({
|
|
|
5576
5583
|
await n(d, g, p);
|
|
5577
5584
|
},
|
|
5578
5585
|
[d, g, p, y, n]
|
|
5579
|
-
),
|
|
5586
|
+
), v = x(() => {
|
|
5580
5587
|
l(), u([]), f(!1), h(""), b(""), r?.();
|
|
5581
5588
|
}, [l, r]), S = x(() => {
|
|
5582
5589
|
f(!1), h(""), b("");
|
|
@@ -5622,7 +5629,7 @@ function aa({
|
|
|
5622
5629
|
{
|
|
5623
5630
|
type: "button",
|
|
5624
5631
|
className: "cedros-button cedros-button-primary",
|
|
5625
|
-
onClick:
|
|
5632
|
+
onClick: v,
|
|
5626
5633
|
children: "Start Over"
|
|
5627
5634
|
}
|
|
5628
5635
|
) })
|
|
@@ -5689,11 +5696,11 @@ function aa({
|
|
|
5689
5696
|
value: y,
|
|
5690
5697
|
onChange: (C) => b(C.target.value),
|
|
5691
5698
|
disabled: c,
|
|
5692
|
-
"aria-invalid":
|
|
5699
|
+
"aria-invalid": A ? "true" : void 0,
|
|
5693
5700
|
placeholder: "Confirm your password"
|
|
5694
5701
|
}
|
|
5695
5702
|
),
|
|
5696
|
-
|
|
5703
|
+
A && /* @__PURE__ */ e("p", { className: "cedros-input-error", role: "alert", children: A })
|
|
5697
5704
|
] })
|
|
5698
5705
|
] }),
|
|
5699
5706
|
g === "passkey" && /* @__PURE__ */ i("div", { className: "cedros-passkey-info", children: [
|
|
@@ -5730,7 +5737,7 @@ function aa({
|
|
|
5730
5737
|
zn,
|
|
5731
5738
|
{
|
|
5732
5739
|
onSubmit: E,
|
|
5733
|
-
onCancel:
|
|
5740
|
+
onCancel: v,
|
|
5734
5741
|
isSubmitting: !1
|
|
5735
5742
|
}
|
|
5736
5743
|
)
|
|
@@ -5851,7 +5858,7 @@ function ua({
|
|
|
5851
5858
|
const l = ve(), [c, d] = k(!1), [u, m] = k(null), [f, g] = k(!1), w = J(null), p = l?.config.solana?.network ?? "mainnet-beta", h = q(() => {
|
|
5852
5859
|
const N = `https://explorer.solana.com/address/${t}`;
|
|
5853
5860
|
return p === "mainnet-beta" ? N : `${N}?cluster=${encodeURIComponent(p)}`;
|
|
5854
|
-
}, [t, p]), y = s && t.length > 18, b = q(() => !y || f ? t : `${t.slice(0, 8)}...${t.slice(-8)}`, [t, y, f]),
|
|
5861
|
+
}, [t, p]), y = s && t.length > 18, b = q(() => !y || f ? t : `${t.slice(0, 8)}...${t.slice(-8)}`, [t, y, f]), A = x(async () => {
|
|
5855
5862
|
try {
|
|
5856
5863
|
m(null), await navigator.clipboard.writeText(t), d(!0), w.current !== null && window.clearTimeout(w.current), w.current = window.setTimeout(() => {
|
|
5857
5864
|
d(!1), w.current = null;
|
|
@@ -5953,7 +5960,7 @@ function ua({
|
|
|
5953
5960
|
{
|
|
5954
5961
|
type: "button",
|
|
5955
5962
|
className: "cedros-button cedros-button-sm cedros-button-outline",
|
|
5956
|
-
onClick:
|
|
5963
|
+
onClick: A,
|
|
5957
5964
|
"aria-label": "Copy wallet address",
|
|
5958
5965
|
children: c ? "Copied" : "Copy"
|
|
5959
5966
|
}
|
|
@@ -6304,22 +6311,22 @@ function Dc({
|
|
|
6304
6311
|
return () => clearTimeout(P);
|
|
6305
6312
|
}
|
|
6306
6313
|
}, [w]);
|
|
6307
|
-
const h = x((P,
|
|
6308
|
-
m((S) => ({ ...S, [P]:
|
|
6314
|
+
const h = x((P, v) => {
|
|
6315
|
+
m((S) => ({ ...S, [P]: v })), g(null), p(!1);
|
|
6309
6316
|
}, []), y = x(async () => {
|
|
6310
|
-
const P = Object.entries(u).map(([
|
|
6311
|
-
key:
|
|
6317
|
+
const P = Object.entries(u).map(([v, S]) => ({
|
|
6318
|
+
key: v,
|
|
6312
6319
|
value: S
|
|
6313
6320
|
}));
|
|
6314
6321
|
if (P.length !== 0)
|
|
6315
6322
|
try {
|
|
6316
6323
|
await d(P), m({}), g(null), p(!0), o?.();
|
|
6317
|
-
} catch (
|
|
6318
|
-
g(
|
|
6324
|
+
} catch (v) {
|
|
6325
|
+
g(v instanceof Error ? v.message : "Failed to save settings");
|
|
6319
6326
|
}
|
|
6320
6327
|
}, [u, d, o]), b = x(() => {
|
|
6321
6328
|
m({}), g(null), p(!1);
|
|
6322
|
-
}, []),
|
|
6329
|
+
}, []), A = Object.keys(u).length > 0, N = Object.keys(u).length;
|
|
6323
6330
|
if (s && Object.keys(a).length === 0)
|
|
6324
6331
|
return /* @__PURE__ */ i("div", { className: `cedros-system-settings cedros-system-settings-loading ${r}`, children: [
|
|
6325
6332
|
/* @__PURE__ */ e(j, {}),
|
|
@@ -6343,7 +6350,7 @@ function Dc({
|
|
|
6343
6350
|
P
|
|
6344
6351
|
)),
|
|
6345
6352
|
/* @__PURE__ */ i("div", { className: "cedros-system-settings-actions", children: [
|
|
6346
|
-
|
|
6353
|
+
A && /* @__PURE__ */ i("span", { className: "cedros-settings-change-count", children: [
|
|
6347
6354
|
N,
|
|
6348
6355
|
" unsaved change",
|
|
6349
6356
|
N !== 1 ? "s" : ""
|
|
@@ -6354,7 +6361,7 @@ function Dc({
|
|
|
6354
6361
|
type: "button",
|
|
6355
6362
|
className: "cedros-button cedros-button-secondary",
|
|
6356
6363
|
onClick: b,
|
|
6357
|
-
disabled: !
|
|
6364
|
+
disabled: !A || n,
|
|
6358
6365
|
children: "Reset"
|
|
6359
6366
|
}
|
|
6360
6367
|
),
|
|
@@ -6364,7 +6371,7 @@ function Dc({
|
|
|
6364
6371
|
type: "button",
|
|
6365
6372
|
className: "cedros-button cedros-button-primary",
|
|
6366
6373
|
onClick: y,
|
|
6367
|
-
disabled: !
|
|
6374
|
+
disabled: !A || n,
|
|
6368
6375
|
children: n ? /* @__PURE__ */ e(j, { size: "sm" }) : "Save Changes"
|
|
6369
6376
|
}
|
|
6370
6377
|
)
|
|
@@ -6487,7 +6494,7 @@ function Aa({ onComplete: t, className: r = "" }) {
|
|
|
6487
6494
|
}, [l]);
|
|
6488
6495
|
const p = x(
|
|
6489
6496
|
(y) => (b) => {
|
|
6490
|
-
u((
|
|
6497
|
+
u((A) => ({ ...A, [y]: b.target.value })), f((A) => ({ ...A, [y]: void 0 }));
|
|
6491
6498
|
},
|
|
6492
6499
|
[]
|
|
6493
6500
|
), h = x(
|
|
@@ -6714,15 +6721,15 @@ function ka({ className: t }) {
|
|
|
6714
6721
|
_(() => {
|
|
6715
6722
|
c();
|
|
6716
6723
|
}, [c]);
|
|
6717
|
-
const g = lr.find((E) => E.id === m), w = g?.category ?? "", h = (u("email_provider") || "custom") === "custom", y = u("email_smtp_host"), b = !h || y != null && y !== "",
|
|
6724
|
+
const g = lr.find((E) => E.id === m), w = g?.category ?? "", h = (u("email_provider") || "custom") === "custom", y = u("email_smtp_host"), b = !h || y != null && y !== "", A = q(() => {
|
|
6718
6725
|
const E = r[w] ?? [];
|
|
6719
6726
|
if (m !== "email") return E;
|
|
6720
6727
|
const P = h ? _o : Wo;
|
|
6721
|
-
return E.filter((
|
|
6728
|
+
return E.filter((v) => P.includes(v.key)).sort((v, S) => P.indexOf(v.key) - P.indexOf(S.key));
|
|
6722
6729
|
}, [r, w, m, h]), N = (E, P) => {
|
|
6723
6730
|
if (d(E, P), E === "email_provider" && P !== "custom") {
|
|
6724
|
-
const
|
|
6725
|
-
|
|
6731
|
+
const v = Oo[P];
|
|
6732
|
+
v && (d("email_smtp_host", v), d("email_smtp_port", "587"), d("email_smtp_tls", "true"));
|
|
6726
6733
|
}
|
|
6727
6734
|
};
|
|
6728
6735
|
return a && Object.keys(r).length === 0 ? /* @__PURE__ */ i("div", { className: `cedros-system-settings cedros-system-settings-loading ${t ?? ""}`, children: [
|
|
@@ -6749,14 +6756,14 @@ function ka({ className: t }) {
|
|
|
6749
6756
|
},
|
|
6750
6757
|
E.id
|
|
6751
6758
|
)) }),
|
|
6752
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-tab-content", role: "tabpanel", children:
|
|
6759
|
+
/* @__PURE__ */ e("div", { className: "cedros-admin-tab-content", role: "tabpanel", children: A.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-system-settings-empty", children: /* @__PURE__ */ i("p", { children: [
|
|
6753
6760
|
"No settings found for ",
|
|
6754
6761
|
g?.label ?? "this section",
|
|
6755
6762
|
"."
|
|
6756
6763
|
] }) }) : /* @__PURE__ */ e(
|
|
6757
6764
|
es,
|
|
6758
6765
|
{
|
|
6759
|
-
settings:
|
|
6766
|
+
settings: A,
|
|
6760
6767
|
edits: o,
|
|
6761
6768
|
onChange: m === "email" ? N : d
|
|
6762
6769
|
}
|
|
@@ -6987,17 +6994,17 @@ function Fc({
|
|
|
6987
6994
|
onLogoutClick: c,
|
|
6988
6995
|
className: d = ""
|
|
6989
6996
|
}) {
|
|
6990
|
-
const [u, m] = k(o), [f, g] = k(!0), { user: w, logout: p } = te(), { activeOrg: h, role: y, isLoading: b, fetchOrgs:
|
|
6997
|
+
const [u, m] = k(o), [f, g] = k(!0), { user: w, logout: p } = te(), { activeOrg: h, role: y, isLoading: b, fetchOrgs: A, hasPermission: N } = Co(), { status: E, isLoading: P, checkStatus: v } = ws(), { features: S, isLoading: L } = uo(), { canAccess: C } = ho(), B = x(
|
|
6991
6998
|
(U) => {
|
|
6992
6999
|
m(U), n?.(U);
|
|
6993
7000
|
},
|
|
6994
7001
|
[n]
|
|
6995
7002
|
), T = Na.filter((U) => !(!r.includes(U.id) || U.requiredFeature && !S[U.requiredFeature] || !C(U.id))), M = T.find((U) => U.id === u), R = !M && !L;
|
|
6996
7003
|
return _(() => {
|
|
6997
|
-
|
|
6998
|
-
}, [
|
|
7004
|
+
A(), v();
|
|
7005
|
+
}, [A, v]), _(() => {
|
|
6999
7006
|
R && T.length > 0 && m("users");
|
|
7000
|
-
}, [R, T.length]), !P && E?.needsSetup ? /* @__PURE__ */ e("div", { className: `cedros-admin cedros-dashboard cedros-dashboard--setup ${d}`, children: /* @__PURE__ */ e(Aa, { onComplete: () =>
|
|
7007
|
+
}, [R, T.length]), !P && E?.needsSetup ? /* @__PURE__ */ e("div", { className: `cedros-admin cedros-dashboard cedros-dashboard--setup ${d}`, children: /* @__PURE__ */ e(Aa, { onComplete: () => v() }) }) : (b || P || L) && !h ? /* @__PURE__ */ i("div", { className: `cedros-admin cedros-dashboard cedros-dashboard--loading ${d}`, children: [
|
|
7001
7008
|
/* @__PURE__ */ e(j, {}),
|
|
7002
7009
|
/* @__PURE__ */ e("span", { className: "cedros-dashboard__loading-text", children: "Loading..." })
|
|
7003
7010
|
] }) : u === "team" && !h ? /* @__PURE__ */ e("div", { className: `cedros-admin cedros-dashboard ${d}`, children: /* @__PURE__ */ e(X, { error: "No organization selected. Please select an organization first." }) }) : /* @__PURE__ */ i("div", { className: `cedros-admin cedros-dashboard ${d}`, children: [
|
|
@@ -7136,15 +7143,15 @@ function Ea({ orgId: t, currentUserId: r, hasPermission: o, role: a }) {
|
|
|
7136
7143
|
fetchInvites: h,
|
|
7137
7144
|
createInvite: y,
|
|
7138
7145
|
cancelInvite: b,
|
|
7139
|
-
resendInvite:
|
|
7146
|
+
resendInvite: A
|
|
7140
7147
|
} = mo(t);
|
|
7141
7148
|
_(() => {
|
|
7142
7149
|
u(), h();
|
|
7143
7150
|
}, [u, h]);
|
|
7144
|
-
const N = o("invite:create"), E = o("invite:cancel"), P = g.length,
|
|
7151
|
+
const N = o("invite:create"), E = o("invite:cancel"), P = g.length, v = l.reduce(
|
|
7145
7152
|
(B, T) => (B[T.role] = (B[T.role] ?? 0) + 1, B),
|
|
7146
7153
|
{}
|
|
7147
|
-
), S =
|
|
7154
|
+
), S = v.owner ?? 0, L = v.admin ?? 0, C = v.member ?? 0;
|
|
7148
7155
|
return /* @__PURE__ */ i("div", { className: "cedros-dashboard__team", children: [
|
|
7149
7156
|
/* @__PURE__ */ e(
|
|
7150
7157
|
ts,
|
|
@@ -7229,7 +7236,7 @@ function Ea({ orgId: t, currentUserId: r, hasPermission: o, role: a }) {
|
|
|
7229
7236
|
error: p?.message,
|
|
7230
7237
|
canManage: E || N,
|
|
7231
7238
|
onCancel: E ? b : void 0,
|
|
7232
|
-
onResend: N ?
|
|
7239
|
+
onResend: N ? A : void 0
|
|
7233
7240
|
}
|
|
7234
7241
|
) })
|
|
7235
7242
|
] }),
|
|
@@ -8126,9 +8133,9 @@ function Fa() {
|
|
|
8126
8133
|
if (!n.isValid(w))
|
|
8127
8134
|
throw new Error("Invalid QR Code version");
|
|
8128
8135
|
typeof h > "u" && (h = s.BYTE);
|
|
8129
|
-
const y = r.getSymbolTotalCodewords(w), b = o.getTotalCodewordsCount(w, p),
|
|
8130
|
-
if (h === s.MIXED) return
|
|
8131
|
-
const N =
|
|
8136
|
+
const y = r.getSymbolTotalCodewords(w), b = o.getTotalCodewordsCount(w, p), A = (y - b) * 8;
|
|
8137
|
+
if (h === s.MIXED) return A;
|
|
8138
|
+
const N = A - u(h, w);
|
|
8132
8139
|
switch (h) {
|
|
8133
8140
|
case s.NUMERIC:
|
|
8134
8141
|
return Math.floor(N / 10 * 3);
|
|
@@ -8391,22 +8398,22 @@ function Va() {
|
|
|
8391
8398
|
function u(b) {
|
|
8392
8399
|
return unescape(encodeURIComponent(b)).length;
|
|
8393
8400
|
}
|
|
8394
|
-
function m(b,
|
|
8401
|
+
function m(b, A, N) {
|
|
8395
8402
|
const E = [];
|
|
8396
8403
|
let P;
|
|
8397
8404
|
for (; (P = b.exec(N)) !== null; )
|
|
8398
8405
|
E.push({
|
|
8399
8406
|
data: P[0],
|
|
8400
8407
|
index: P.index,
|
|
8401
|
-
mode:
|
|
8408
|
+
mode: A,
|
|
8402
8409
|
length: P[0].length
|
|
8403
8410
|
});
|
|
8404
8411
|
return E;
|
|
8405
8412
|
}
|
|
8406
8413
|
function f(b) {
|
|
8407
|
-
const
|
|
8414
|
+
const A = m(l.NUMERIC, r.NUMERIC, b), N = m(l.ALPHANUMERIC, r.ALPHANUMERIC, b);
|
|
8408
8415
|
let E, P;
|
|
8409
|
-
return c.isKanjiModeEnabled() ? (E = m(l.BYTE, r.BYTE, b), P = m(l.KANJI, r.KANJI, b)) : (E = m(l.BYTE_KANJI, r.BYTE, b), P = []),
|
|
8416
|
+
return c.isKanjiModeEnabled() ? (E = m(l.BYTE, r.BYTE, b), P = m(l.KANJI, r.KANJI, b)) : (E = m(l.BYTE_KANJI, r.BYTE, b), P = []), A.concat(N, E, P).sort(function(S, L) {
|
|
8410
8417
|
return S.index - L.index;
|
|
8411
8418
|
}).map(function(S) {
|
|
8412
8419
|
return {
|
|
@@ -8416,8 +8423,8 @@ function Va() {
|
|
|
8416
8423
|
};
|
|
8417
8424
|
});
|
|
8418
8425
|
}
|
|
8419
|
-
function g(b,
|
|
8420
|
-
switch (
|
|
8426
|
+
function g(b, A) {
|
|
8427
|
+
switch (A) {
|
|
8421
8428
|
case r.NUMERIC:
|
|
8422
8429
|
return o.getBitsLength(b);
|
|
8423
8430
|
case r.ALPHANUMERIC:
|
|
@@ -8429,66 +8436,66 @@ function Va() {
|
|
|
8429
8436
|
}
|
|
8430
8437
|
}
|
|
8431
8438
|
function w(b) {
|
|
8432
|
-
return b.reduce(function(
|
|
8433
|
-
const E =
|
|
8434
|
-
return E && E.mode === N.mode ? (
|
|
8439
|
+
return b.reduce(function(A, N) {
|
|
8440
|
+
const E = A.length - 1 >= 0 ? A[A.length - 1] : null;
|
|
8441
|
+
return E && E.mode === N.mode ? (A[A.length - 1].data += N.data, A) : (A.push(N), A);
|
|
8435
8442
|
}, []);
|
|
8436
8443
|
}
|
|
8437
8444
|
function p(b) {
|
|
8438
|
-
const
|
|
8445
|
+
const A = [];
|
|
8439
8446
|
for (let N = 0; N < b.length; N++) {
|
|
8440
8447
|
const E = b[N];
|
|
8441
8448
|
switch (E.mode) {
|
|
8442
8449
|
case r.NUMERIC:
|
|
8443
|
-
|
|
8450
|
+
A.push([
|
|
8444
8451
|
E,
|
|
8445
8452
|
{ data: E.data, mode: r.ALPHANUMERIC, length: E.length },
|
|
8446
8453
|
{ data: E.data, mode: r.BYTE, length: E.length }
|
|
8447
8454
|
]);
|
|
8448
8455
|
break;
|
|
8449
8456
|
case r.ALPHANUMERIC:
|
|
8450
|
-
|
|
8457
|
+
A.push([
|
|
8451
8458
|
E,
|
|
8452
8459
|
{ data: E.data, mode: r.BYTE, length: E.length }
|
|
8453
8460
|
]);
|
|
8454
8461
|
break;
|
|
8455
8462
|
case r.KANJI:
|
|
8456
|
-
|
|
8463
|
+
A.push([
|
|
8457
8464
|
E,
|
|
8458
8465
|
{ data: E.data, mode: r.BYTE, length: u(E.data) }
|
|
8459
8466
|
]);
|
|
8460
8467
|
break;
|
|
8461
8468
|
case r.BYTE:
|
|
8462
|
-
|
|
8469
|
+
A.push([
|
|
8463
8470
|
{ data: E.data, mode: r.BYTE, length: u(E.data) }
|
|
8464
8471
|
]);
|
|
8465
8472
|
}
|
|
8466
8473
|
}
|
|
8467
|
-
return
|
|
8474
|
+
return A;
|
|
8468
8475
|
}
|
|
8469
|
-
function h(b,
|
|
8476
|
+
function h(b, A) {
|
|
8470
8477
|
const N = {}, E = { start: {} };
|
|
8471
8478
|
let P = ["start"];
|
|
8472
|
-
for (let
|
|
8473
|
-
const S = b[
|
|
8479
|
+
for (let v = 0; v < b.length; v++) {
|
|
8480
|
+
const S = b[v], L = [];
|
|
8474
8481
|
for (let C = 0; C < S.length; C++) {
|
|
8475
|
-
const B = S[C], T = "" +
|
|
8482
|
+
const B = S[C], T = "" + v + C;
|
|
8476
8483
|
L.push(T), N[T] = { node: B, lastCount: 0 }, E[T] = {};
|
|
8477
8484
|
for (let M = 0; M < P.length; M++) {
|
|
8478
8485
|
const R = P[M];
|
|
8479
|
-
N[R] && N[R].node.mode === B.mode ? (E[R][T] = g(N[R].lastCount + B.length, B.mode) - g(N[R].lastCount, B.mode), N[R].lastCount += B.length) : (N[R] && (N[R].lastCount = B.length), E[R][T] = g(B.length, B.mode) + 4 + r.getCharCountIndicator(B.mode,
|
|
8486
|
+
N[R] && N[R].node.mode === B.mode ? (E[R][T] = g(N[R].lastCount + B.length, B.mode) - g(N[R].lastCount, B.mode), N[R].lastCount += B.length) : (N[R] && (N[R].lastCount = B.length), E[R][T] = g(B.length, B.mode) + 4 + r.getCharCountIndicator(B.mode, A));
|
|
8480
8487
|
}
|
|
8481
8488
|
}
|
|
8482
8489
|
P = L;
|
|
8483
8490
|
}
|
|
8484
|
-
for (let
|
|
8485
|
-
E[P[
|
|
8491
|
+
for (let v = 0; v < P.length; v++)
|
|
8492
|
+
E[P[v]].end = 0;
|
|
8486
8493
|
return { map: E, table: N };
|
|
8487
8494
|
}
|
|
8488
|
-
function y(b,
|
|
8495
|
+
function y(b, A) {
|
|
8489
8496
|
let N;
|
|
8490
8497
|
const E = r.getBestModeForData(b);
|
|
8491
|
-
if (N = r.from(
|
|
8498
|
+
if (N = r.from(A, E), N !== r.BYTE && N.bit < E.bit)
|
|
8492
8499
|
throw new Error('"' + b + '" cannot be encoded with mode ' + r.toString(N) + `.
|
|
8493
8500
|
Suggested mode is: ` + r.toString(E));
|
|
8494
8501
|
switch (N === r.KANJI && !c.isKanjiModeEnabled() && (N = r.BYTE), N) {
|
|
@@ -8502,18 +8509,18 @@ function Va() {
|
|
|
8502
8509
|
return new s(b);
|
|
8503
8510
|
}
|
|
8504
8511
|
}
|
|
8505
|
-
t.fromArray = function(
|
|
8506
|
-
return
|
|
8512
|
+
t.fromArray = function(A) {
|
|
8513
|
+
return A.reduce(function(N, E) {
|
|
8507
8514
|
return typeof E == "string" ? N.push(y(E, null)) : E.data && N.push(y(E.data, E.mode)), N;
|
|
8508
8515
|
}, []);
|
|
8509
|
-
}, t.fromString = function(
|
|
8510
|
-
const E = f(
|
|
8516
|
+
}, t.fromString = function(A, N) {
|
|
8517
|
+
const E = f(A, c.isKanjiModeEnabled()), P = p(E), v = h(P, N), S = d.find_path(v.map, "start", "end"), L = [];
|
|
8511
8518
|
for (let C = 1; C < S.length - 1; C++)
|
|
8512
|
-
L.push(
|
|
8519
|
+
L.push(v.table[S[C]].node);
|
|
8513
8520
|
return t.fromArray(w(L));
|
|
8514
|
-
}, t.rawSplit = function(
|
|
8521
|
+
}, t.rawSplit = function(A) {
|
|
8515
8522
|
return t.fromArray(
|
|
8516
|
-
f(
|
|
8523
|
+
f(A, c.isKanjiModeEnabled())
|
|
8517
8524
|
);
|
|
8518
8525
|
};
|
|
8519
8526
|
})(St)), St;
|
|
@@ -8523,54 +8530,54 @@ function Ha() {
|
|
|
8523
8530
|
if (Rr) return pt;
|
|
8524
8531
|
Rr = 1;
|
|
8525
8532
|
const t = ke(), r = Yt(), o = La(), a = Ma(), s = Ta(), n = Ba(), l = Ra(), c = ys(), d = Ua(), u = Fa(), m = _a(), f = Ne(), g = Va();
|
|
8526
|
-
function w(
|
|
8527
|
-
const L =
|
|
8533
|
+
function w(v, S) {
|
|
8534
|
+
const L = v.size, C = n.getPositions(S);
|
|
8528
8535
|
for (let B = 0; B < C.length; B++) {
|
|
8529
8536
|
const T = C[B][0], M = C[B][1];
|
|
8530
8537
|
for (let R = -1; R <= 7; R++)
|
|
8531
8538
|
if (!(T + R <= -1 || L <= T + R))
|
|
8532
8539
|
for (let I = -1; I <= 7; I++)
|
|
8533
|
-
M + I <= -1 || L <= M + I || (R >= 0 && R <= 6 && (I === 0 || I === 6) || I >= 0 && I <= 6 && (R === 0 || R === 6) || R >= 2 && R <= 4 && I >= 2 && I <= 4 ?
|
|
8540
|
+
M + I <= -1 || L <= M + I || (R >= 0 && R <= 6 && (I === 0 || I === 6) || I >= 0 && I <= 6 && (R === 0 || R === 6) || R >= 2 && R <= 4 && I >= 2 && I <= 4 ? v.set(T + R, M + I, !0, !0) : v.set(T + R, M + I, !1, !0));
|
|
8534
8541
|
}
|
|
8535
8542
|
}
|
|
8536
|
-
function p(
|
|
8537
|
-
const S =
|
|
8543
|
+
function p(v) {
|
|
8544
|
+
const S = v.size;
|
|
8538
8545
|
for (let L = 8; L < S - 8; L++) {
|
|
8539
8546
|
const C = L % 2 === 0;
|
|
8540
|
-
|
|
8547
|
+
v.set(L, 6, C, !0), v.set(6, L, C, !0);
|
|
8541
8548
|
}
|
|
8542
8549
|
}
|
|
8543
|
-
function h(
|
|
8550
|
+
function h(v, S) {
|
|
8544
8551
|
const L = s.getPositions(S);
|
|
8545
8552
|
for (let C = 0; C < L.length; C++) {
|
|
8546
8553
|
const B = L[C][0], T = L[C][1];
|
|
8547
8554
|
for (let M = -2; M <= 2; M++)
|
|
8548
8555
|
for (let R = -2; R <= 2; R++)
|
|
8549
|
-
M === -2 || M === 2 || R === -2 || R === 2 || M === 0 && R === 0 ?
|
|
8556
|
+
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);
|
|
8550
8557
|
}
|
|
8551
8558
|
}
|
|
8552
|
-
function y(
|
|
8553
|
-
const L =
|
|
8559
|
+
function y(v, S) {
|
|
8560
|
+
const L = v.size, C = u.getEncodedBits(S);
|
|
8554
8561
|
let B, T, M;
|
|
8555
8562
|
for (let R = 0; R < 18; R++)
|
|
8556
|
-
B = Math.floor(R / 3), T = R % 3 + L - 8 - 3, M = (C >> R & 1) === 1,
|
|
8563
|
+
B = Math.floor(R / 3), T = R % 3 + L - 8 - 3, M = (C >> R & 1) === 1, v.set(B, T, M, !0), v.set(T, B, M, !0);
|
|
8557
8564
|
}
|
|
8558
|
-
function b(
|
|
8559
|
-
const C =
|
|
8565
|
+
function b(v, S, L) {
|
|
8566
|
+
const C = v.size, B = m.getEncodedBits(S, L);
|
|
8560
8567
|
let T, M;
|
|
8561
8568
|
for (T = 0; T < 15; T++)
|
|
8562
|
-
M = (B >> T & 1) === 1, T < 6 ?
|
|
8563
|
-
|
|
8569
|
+
M = (B >> T & 1) === 1, T < 6 ? v.set(T, 8, M, !0) : T < 8 ? v.set(T + 1, 8, M, !0) : v.set(C - 15 + T, 8, M, !0), T < 8 ? v.set(8, C - T - 1, M, !0) : T < 9 ? v.set(8, 15 - T - 1 + 1, M, !0) : v.set(8, 15 - T - 1, M, !0);
|
|
8570
|
+
v.set(C - 8, 8, 1, !0);
|
|
8564
8571
|
}
|
|
8565
|
-
function v
|
|
8566
|
-
const L =
|
|
8572
|
+
function A(v, S) {
|
|
8573
|
+
const L = v.size;
|
|
8567
8574
|
let C = -1, B = L - 1, T = 7, M = 0;
|
|
8568
8575
|
for (let R = L - 1; R > 0; R -= 2)
|
|
8569
8576
|
for (R === 6 && R--; ; ) {
|
|
8570
8577
|
for (let I = 0; I < 2; I++)
|
|
8571
|
-
if (!
|
|
8578
|
+
if (!v.isReserved(B, R - I)) {
|
|
8572
8579
|
let U = !1;
|
|
8573
|
-
M < S.length && (U = (S[M] >>> T & 1) === 1),
|
|
8580
|
+
M < S.length && (U = (S[M] >>> T & 1) === 1), v.set(B, R - I, U), T--, T === -1 && (M++, T = 7);
|
|
8574
8581
|
}
|
|
8575
8582
|
if (B += C, B < 0 || L <= B) {
|
|
8576
8583
|
B -= C, C = -C;
|
|
@@ -8578,25 +8585,25 @@ function Ha() {
|
|
|
8578
8585
|
}
|
|
8579
8586
|
}
|
|
8580
8587
|
}
|
|
8581
|
-
function N(
|
|
8588
|
+
function N(v, S, L) {
|
|
8582
8589
|
const C = new o();
|
|
8583
8590
|
L.forEach(function(I) {
|
|
8584
|
-
C.put(I.mode.bit, 4), C.put(I.getLength(), f.getCharCountIndicator(I.mode,
|
|
8591
|
+
C.put(I.mode.bit, 4), C.put(I.getLength(), f.getCharCountIndicator(I.mode, v)), I.write(C);
|
|
8585
8592
|
});
|
|
8586
|
-
const B = t.getSymbolTotalCodewords(
|
|
8593
|
+
const B = t.getSymbolTotalCodewords(v), T = c.getTotalCodewordsCount(v, S), M = (B - T) * 8;
|
|
8587
8594
|
for (C.getLengthInBits() + 4 <= M && C.put(0, 4); C.getLengthInBits() % 8 !== 0; )
|
|
8588
8595
|
C.putBit(0);
|
|
8589
8596
|
const R = (M - C.getLengthInBits()) / 8;
|
|
8590
8597
|
for (let I = 0; I < R; I++)
|
|
8591
8598
|
C.put(I % 2 ? 17 : 236, 8);
|
|
8592
|
-
return E(C,
|
|
8599
|
+
return E(C, v, S);
|
|
8593
8600
|
}
|
|
8594
|
-
function E(
|
|
8601
|
+
function E(v, S, L) {
|
|
8595
8602
|
const C = t.getSymbolTotalCodewords(S), B = c.getTotalCodewordsCount(S, L), T = C - B, M = c.getBlocksCount(S, L), R = C % M, I = M - R, U = Math.floor(C / M), ee = Math.floor(T / M), pe = ee + 1, re = U - ee, Q = new d(re);
|
|
8596
8603
|
let D = 0;
|
|
8597
8604
|
const F = new Array(M), K = new Array(M);
|
|
8598
8605
|
let se = 0;
|
|
8599
|
-
const ne = new Uint8Array(
|
|
8606
|
+
const ne = new Uint8Array(v.buffer);
|
|
8600
8607
|
for (let G = 0; G < M; G++) {
|
|
8601
8608
|
const de = G < I ? ee : pe;
|
|
8602
8609
|
F[G] = ne.slice(D, D + de), K[G] = Q.encode(F[G]), D += de, se = Math.max(se, de);
|
|
@@ -8611,17 +8618,17 @@ function Ha() {
|
|
|
8611
8618
|
ge[me++] = K[z][V];
|
|
8612
8619
|
return ge;
|
|
8613
8620
|
}
|
|
8614
|
-
function P(
|
|
8621
|
+
function P(v, S, L, C) {
|
|
8615
8622
|
let B;
|
|
8616
|
-
if (Array.isArray(
|
|
8617
|
-
B = g.fromArray(
|
|
8618
|
-
else if (typeof
|
|
8623
|
+
if (Array.isArray(v))
|
|
8624
|
+
B = g.fromArray(v);
|
|
8625
|
+
else if (typeof v == "string") {
|
|
8619
8626
|
let U = S;
|
|
8620
8627
|
if (!U) {
|
|
8621
|
-
const ee = g.rawSplit(
|
|
8628
|
+
const ee = g.rawSplit(v);
|
|
8622
8629
|
U = u.getBestVersionForData(ee, L);
|
|
8623
8630
|
}
|
|
8624
|
-
B = g.fromString(
|
|
8631
|
+
B = g.fromString(v, U || 40);
|
|
8625
8632
|
} else
|
|
8626
8633
|
throw new Error("Invalid data");
|
|
8627
8634
|
const T = u.getBestVersionForData(B, L);
|
|
@@ -8637,7 +8644,7 @@ Minimum version required to store current data is: ` + T + `.
|
|
|
8637
8644
|
`
|
|
8638
8645
|
);
|
|
8639
8646
|
const M = N(S, L, B), R = t.getSymbolSize(S), I = new a(R);
|
|
8640
|
-
return w(I, S), p(I), h(I, S), b(I, L, 0), S >= 7 && y(I, S),
|
|
8647
|
+
return w(I, S), p(I), h(I, S), b(I, L, 0), S >= 7 && y(I, S), A(I, M), isNaN(C) && (C = l.getBestMask(
|
|
8641
8648
|
I,
|
|
8642
8649
|
b.bind(null, I, L)
|
|
8643
8650
|
)), l.applyMask(C, I), b(I, L, C), {
|
|
@@ -8887,8 +8894,8 @@ function ks() {
|
|
|
8887
8894
|
a({ enabled: !0, recoveryCodesRemaining: 0 });
|
|
8888
8895
|
}
|
|
8889
8896
|
} catch (P) {
|
|
8890
|
-
const
|
|
8891
|
-
throw f(
|
|
8897
|
+
const v = W(P, "Incorrect verification code. Please check and try again.");
|
|
8898
|
+
throw f(v), n("error"), v;
|
|
8892
8899
|
} finally {
|
|
8893
8900
|
u(!1);
|
|
8894
8901
|
}
|
|
@@ -8907,8 +8914,8 @@ function ks() {
|
|
|
8907
8914
|
try {
|
|
8908
8915
|
await g.post("/mfa/disable", { password: E }), a({ enabled: !1, recoveryCodesRemaining: 0 }), c(null), n("idle");
|
|
8909
8916
|
} catch (P) {
|
|
8910
|
-
const
|
|
8911
|
-
throw f(
|
|
8917
|
+
const v = W(P, "Unable to disable two-factor authentication. Please try again.");
|
|
8918
|
+
throw f(v), v;
|
|
8912
8919
|
} finally {
|
|
8913
8920
|
u(!1);
|
|
8914
8921
|
}
|
|
@@ -8930,14 +8937,14 @@ function ks() {
|
|
|
8930
8937
|
{ code: E }
|
|
8931
8938
|
);
|
|
8932
8939
|
} catch (P) {
|
|
8933
|
-
const
|
|
8934
|
-
throw f(
|
|
8940
|
+
const v = W(P, "Unable to regenerate recovery codes. Please try again.");
|
|
8941
|
+
throw f(v), v;
|
|
8935
8942
|
} finally {
|
|
8936
8943
|
u(!1);
|
|
8937
8944
|
}
|
|
8938
8945
|
},
|
|
8939
8946
|
[g]
|
|
8940
|
-
),
|
|
8947
|
+
), A = x(() => f(null), []), N = x(() => {
|
|
8941
8948
|
f(null), c(null), n("idle"), u(!1);
|
|
8942
8949
|
}, []);
|
|
8943
8950
|
return {
|
|
@@ -8951,12 +8958,12 @@ function ks() {
|
|
|
8951
8958
|
enableTotp: h,
|
|
8952
8959
|
disableTotp: y,
|
|
8953
8960
|
regenerateBackupCodes: b,
|
|
8954
|
-
clearError:
|
|
8961
|
+
clearError: A,
|
|
8955
8962
|
reset: N
|
|
8956
8963
|
};
|
|
8957
8964
|
}
|
|
8958
8965
|
function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
8959
|
-
const { setupState: a, setupData: s, isLoading: n, error: l, beginSetup: c, enableTotp: d, clearError: u, reset: m } = ks(), [f, g] = k("qr"), [w, p] = k(""), [h, y] = k(!1), [b,
|
|
8966
|
+
const { setupState: a, setupData: s, isLoading: n, error: l, beginSetup: c, enableTotp: d, clearError: u, reset: m } = ks(), [f, g] = k("qr"), [w, p] = k(""), [h, y] = k(!1), [b, A] = k(!1), N = J(null);
|
|
8960
8967
|
_(() => {
|
|
8961
8968
|
a === "idle" && c().catch(() => {
|
|
8962
8969
|
});
|
|
@@ -8971,7 +8978,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
8971
8978
|
`);
|
|
8972
8979
|
await navigator.clipboard.writeText(L);
|
|
8973
8980
|
}
|
|
8974
|
-
},
|
|
8981
|
+
}, v = async () => {
|
|
8975
8982
|
try {
|
|
8976
8983
|
await d(w);
|
|
8977
8984
|
} catch {
|
|
@@ -9093,7 +9100,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9093
9100
|
type: "checkbox",
|
|
9094
9101
|
className: "cedros-checkbox",
|
|
9095
9102
|
checked: b,
|
|
9096
|
-
onChange: (L) =>
|
|
9103
|
+
onChange: (L) => A(L.target.checked)
|
|
9097
9104
|
}
|
|
9098
9105
|
),
|
|
9099
9106
|
/* @__PURE__ */ e("span", { className: "cedros-checkbox-text", children: "I have saved these recovery codes" })
|
|
@@ -9128,7 +9135,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9128
9135
|
{
|
|
9129
9136
|
value: w,
|
|
9130
9137
|
onChange: p,
|
|
9131
|
-
onComplete:
|
|
9138
|
+
onComplete: v,
|
|
9132
9139
|
disabled: n,
|
|
9133
9140
|
error: l?.message,
|
|
9134
9141
|
autoFocus: !0
|
|
@@ -9150,7 +9157,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9150
9157
|
{
|
|
9151
9158
|
type: "button",
|
|
9152
9159
|
className: "cedros-button cedros-button-primary cedros-button-md",
|
|
9153
|
-
onClick:
|
|
9160
|
+
onClick: v,
|
|
9154
9161
|
disabled: n || w.length !== 6,
|
|
9155
9162
|
children: n ? /* @__PURE__ */ i($, { children: [
|
|
9156
9163
|
/* @__PURE__ */ e(j, { size: "sm" }),
|
|
@@ -9163,31 +9170,31 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9163
9170
|
] }) : null;
|
|
9164
9171
|
}
|
|
9165
9172
|
function Xa({ onStatusChange: t, className: r = "" }) {
|
|
9166
|
-
const { status: o, isLoading: a, error: s, getStatus: n, disableTotp: l, regenerateBackupCodes: c, clearError: d } = ks(), [u, m] = k("status"), [f, g] = k(""), [w, p] = k(""), [h, y] = k(null), [b,
|
|
9173
|
+
const { status: o, isLoading: a, error: s, getStatus: n, disableTotp: l, regenerateBackupCodes: c, clearError: d } = ks(), [u, m] = k("status"), [f, g] = k(""), [w, p] = k(""), [h, y] = k(null), [b, A] = k(!1), [N, E] = k(null);
|
|
9167
9174
|
_(() => {
|
|
9168
9175
|
n().catch(() => {
|
|
9169
9176
|
});
|
|
9170
9177
|
}, [n]);
|
|
9171
9178
|
const P = x(() => {
|
|
9172
9179
|
m("status"), t?.(!0);
|
|
9173
|
-
}, [t]),
|
|
9174
|
-
|
|
9180
|
+
}, [t]), v = async () => {
|
|
9181
|
+
A(!0), E(null);
|
|
9175
9182
|
try {
|
|
9176
9183
|
await l(f), m("status"), g(""), t?.(!1);
|
|
9177
9184
|
} catch (C) {
|
|
9178
9185
|
E(C instanceof Error ? C.message : "Failed to disable 2FA"), g("");
|
|
9179
9186
|
} finally {
|
|
9180
|
-
|
|
9187
|
+
A(!1);
|
|
9181
9188
|
}
|
|
9182
9189
|
}, S = async () => {
|
|
9183
|
-
|
|
9190
|
+
A(!0), E(null);
|
|
9184
9191
|
try {
|
|
9185
9192
|
const C = await c(w);
|
|
9186
9193
|
y(C.recoveryCodes), p("");
|
|
9187
9194
|
} catch (C) {
|
|
9188
9195
|
E(C instanceof Error ? C.message : "Failed to regenerate codes"), p("");
|
|
9189
9196
|
} finally {
|
|
9190
|
-
|
|
9197
|
+
A(!1);
|
|
9191
9198
|
}
|
|
9192
9199
|
}, L = async () => {
|
|
9193
9200
|
h && await navigator.clipboard.writeText(h.join(`
|
|
@@ -9243,7 +9250,7 @@ function Xa({ onStatusChange: t, className: r = "" }) {
|
|
|
9243
9250
|
{
|
|
9244
9251
|
type: "button",
|
|
9245
9252
|
className: "cedros-button cedros-button-destructive cedros-button-md",
|
|
9246
|
-
onClick:
|
|
9253
|
+
onClick: v,
|
|
9247
9254
|
disabled: b || f.length === 0,
|
|
9248
9255
|
children: b ? /* @__PURE__ */ i($, { children: [
|
|
9249
9256
|
/* @__PURE__ */ e(j, { size: "sm" }),
|
|
@@ -9458,8 +9465,8 @@ function _c({
|
|
|
9458
9465
|
onClose: r,
|
|
9459
9466
|
className: o = ""
|
|
9460
9467
|
}) {
|
|
9461
|
-
const { user: a } = et(), { isLoading: s, error: n, changePassword: l, clearError: c } = st(), [d, u] = k("main"), [m, f] = k(""), [g, w] = k(""), [p, h] = k(""), [y, b] = k(null), [
|
|
9462
|
-
if (
|
|
9468
|
+
const { user: a } = et(), { isLoading: s, error: n, changePassword: l, clearError: c } = st(), [d, u] = k("main"), [m, f] = k(""), [g, w] = k(""), [p, h] = k(""), [y, b] = k(null), [A, N] = k(null), E = rt(g), P = g === p, v = m.length > 0 && g.length > 0 && p.length > 0 && E.isValid && P, S = x(async () => {
|
|
9469
|
+
if (v) {
|
|
9463
9470
|
b(null), N(null);
|
|
9464
9471
|
try {
|
|
9465
9472
|
await l({
|
|
@@ -9472,7 +9479,7 @@ function _c({
|
|
|
9472
9479
|
b(B instanceof Error ? B.message : "Failed to change password");
|
|
9473
9480
|
}
|
|
9474
9481
|
}
|
|
9475
|
-
}, [
|
|
9482
|
+
}, [v, m, g, l, t]), L = x(() => {
|
|
9476
9483
|
u("main"), f(""), w(""), h(""), b(null), c();
|
|
9477
9484
|
}, [c]), C = () => a?.name ? a.name.split(" ").map((B) => B[0]).join("").toUpperCase().slice(0, 2) : a?.email ? a.email[0].toUpperCase() : "?";
|
|
9478
9485
|
return d === "change-password" ? /* @__PURE__ */ e("div", { className: `cedros-profile-settings ${o}`, children: /* @__PURE__ */ i("div", { className: "cedros-profile-panel", children: [
|
|
@@ -9487,9 +9494,9 @@ function _c({
|
|
|
9487
9494
|
}
|
|
9488
9495
|
}
|
|
9489
9496
|
) }),
|
|
9490
|
-
|
|
9497
|
+
A && /* @__PURE__ */ i("div", { className: "cedros-profile-success", children: [
|
|
9491
9498
|
/* @__PURE__ */ e("span", { className: "cedros-profile-success-icon", children: "✓" }),
|
|
9492
|
-
|
|
9499
|
+
A
|
|
9493
9500
|
] }),
|
|
9494
9501
|
/* @__PURE__ */ i("div", { className: "cedros-profile-form", children: [
|
|
9495
9502
|
/* @__PURE__ */ e("div", { className: "cedros-profile-field", children: /* @__PURE__ */ e(
|
|
@@ -9543,7 +9550,7 @@ function _c({
|
|
|
9543
9550
|
type: "button",
|
|
9544
9551
|
className: "cedros-button cedros-button-primary cedros-button-md",
|
|
9545
9552
|
onClick: S,
|
|
9546
|
-
disabled: s || !
|
|
9553
|
+
disabled: s || !v,
|
|
9547
9554
|
children: s ? /* @__PURE__ */ i($, { children: [
|
|
9548
9555
|
/* @__PURE__ */ e(j, { size: "sm" }),
|
|
9549
9556
|
/* @__PURE__ */ e("span", { children: "Changing..." })
|
|
@@ -9682,13 +9689,13 @@ function ti({
|
|
|
9682
9689
|
onCancel: r,
|
|
9683
9690
|
className: o = ""
|
|
9684
9691
|
}) {
|
|
9685
|
-
const { isLoading: a, error: s, changePassword: n, clearError: l } = st(), [c, d] = k(""), [u, m] = k(""), [f, g] = k(""), [w, p] = k(null), [h, y] = k(null), b = rt(u),
|
|
9692
|
+
const { isLoading: a, error: s, changePassword: n, clearError: l } = st(), [c, d] = k(""), [u, m] = k(""), [f, g] = k(""), [w, p] = k(null), [h, y] = k(null), b = rt(u), A = u === f, N = c.length > 0 && u.length > 0 && f.length > 0 && b.isValid && A, E = x(async () => {
|
|
9686
9693
|
if (N) {
|
|
9687
9694
|
p(null), y(null);
|
|
9688
9695
|
try {
|
|
9689
9696
|
await n({ currentPassword: c, newPassword: u }), d(""), m(""), g(""), y("Password changed successfully. Other sessions have been logged out."), t?.(), setTimeout(() => r(), 2e3);
|
|
9690
|
-
} catch (
|
|
9691
|
-
p(
|
|
9697
|
+
} catch (v) {
|
|
9698
|
+
p(v instanceof Error ? v.message : "Failed to change password");
|
|
9692
9699
|
}
|
|
9693
9700
|
}
|
|
9694
9701
|
}, [N, c, u, n, t, r]), P = x(() => {
|
|
@@ -9717,7 +9724,7 @@ function ti({
|
|
|
9717
9724
|
label: "Current password",
|
|
9718
9725
|
placeholder: "Enter your current password",
|
|
9719
9726
|
value: c,
|
|
9720
|
-
onChange: (
|
|
9727
|
+
onChange: (v) => d(v.target.value),
|
|
9721
9728
|
disabled: a,
|
|
9722
9729
|
autoFocus: !0
|
|
9723
9730
|
}
|
|
@@ -9728,7 +9735,7 @@ function ti({
|
|
|
9728
9735
|
label: "New password",
|
|
9729
9736
|
placeholder: "Enter new password",
|
|
9730
9737
|
value: u,
|
|
9731
|
-
onChange: (
|
|
9738
|
+
onChange: (v) => m(v.target.value),
|
|
9732
9739
|
disabled: a,
|
|
9733
9740
|
showStrengthMeter: !0
|
|
9734
9741
|
}
|
|
@@ -9739,9 +9746,9 @@ function ti({
|
|
|
9739
9746
|
label: "Confirm new password",
|
|
9740
9747
|
placeholder: "Confirm new password",
|
|
9741
9748
|
value: f,
|
|
9742
|
-
onChange: (
|
|
9749
|
+
onChange: (v) => g(v.target.value),
|
|
9743
9750
|
disabled: a,
|
|
9744
|
-
error: f.length > 0 && !
|
|
9751
|
+
error: f.length > 0 && !A ? "Passwords do not match" : void 0
|
|
9745
9752
|
}
|
|
9746
9753
|
) })
|
|
9747
9754
|
] }),
|
|
@@ -9778,9 +9785,9 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9778
9785
|
isLoading: m,
|
|
9779
9786
|
isSuccess: f,
|
|
9780
9787
|
reset: g
|
|
9781
|
-
} = Qt(), w = d.some((C) => C.credentialType === "password"), [p, h] = k("view"), [y, b] = k(""), [
|
|
9788
|
+
} = Qt(), w = d.some((C) => C.credentialType === "password"), [p, h] = k("view"), [y, b] = k(""), [A, N] = k(null), E = () => o?.name ? o.name.split(" ").map((C) => C[0]).join("").toUpperCase().slice(0, 2) : o?.email ? o.email[0].toUpperCase() : "?", P = x(() => {
|
|
9782
9789
|
b(o?.name || ""), h("edit"), N(null);
|
|
9783
|
-
}, [o?.name]),
|
|
9790
|
+
}, [o?.name]), v = x(async () => {
|
|
9784
9791
|
const C = y.trim();
|
|
9785
9792
|
if (C) {
|
|
9786
9793
|
N(null);
|
|
@@ -9831,7 +9838,7 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9831
9838
|
disabled: s,
|
|
9832
9839
|
autoFocus: !0,
|
|
9833
9840
|
onKeyDown: (C) => {
|
|
9834
|
-
C.key === "Enter" &&
|
|
9841
|
+
C.key === "Enter" && v(), C.key === "Escape" && S();
|
|
9835
9842
|
}
|
|
9836
9843
|
}
|
|
9837
9844
|
),
|
|
@@ -9841,7 +9848,7 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9841
9848
|
{
|
|
9842
9849
|
type: "button",
|
|
9843
9850
|
className: "cedros-button cedros-button-primary cedros-button-sm",
|
|
9844
|
-
onClick:
|
|
9851
|
+
onClick: v,
|
|
9845
9852
|
disabled: s || !y.trim(),
|
|
9846
9853
|
children: s ? /* @__PURE__ */ e(j, { size: "sm" }) : "Save"
|
|
9847
9854
|
}
|
|
@@ -9874,10 +9881,10 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9874
9881
|
/* @__PURE__ */ e("p", { className: "cedros-profile-email", children: o?.email })
|
|
9875
9882
|
] })
|
|
9876
9883
|
] }),
|
|
9877
|
-
(
|
|
9884
|
+
(A || n) && /* @__PURE__ */ e("div", { className: "cedros-profile-error", children: /* @__PURE__ */ e(
|
|
9878
9885
|
X,
|
|
9879
9886
|
{
|
|
9880
|
-
error: { code: "UNKNOWN_ERROR", message:
|
|
9887
|
+
error: { code: "UNKNOWN_ERROR", message: A || n?.message || "" },
|
|
9881
9888
|
onDismiss: () => {
|
|
9882
9889
|
N(null), c();
|
|
9883
9890
|
}
|
|
@@ -9983,7 +9990,7 @@ function oi({
|
|
|
9983
9990
|
} finally {
|
|
9984
9991
|
y(!1);
|
|
9985
9992
|
}
|
|
9986
|
-
}, [o, f, m]),
|
|
9993
|
+
}, [o, f, m]), A = x(
|
|
9987
9994
|
async (C) => {
|
|
9988
9995
|
const B = C.label || Es[C.credentialType];
|
|
9989
9996
|
if (window.confirm(
|
|
@@ -9999,7 +10006,7 @@ function oi({
|
|
|
9999
10006
|
}
|
|
10000
10007
|
},
|
|
10001
10008
|
[d]
|
|
10002
|
-
), N = new Set(n.map((C) => C.credentialType)), E = t && !N.has("oauth_google"), P = r && !N.has("oauth_apple"),
|
|
10009
|
+
), N = new Set(n.map((C) => C.credentialType)), E = t && !N.has("oauth_google"), P = r && !N.has("oauth_apple"), v = (o || g) && !N.has("webauthn_passkey"), S = a && !N.has("solana"), L = E || P || v || S;
|
|
10003
10010
|
return l && n.length === 0 ? /* @__PURE__ */ i("div", { className: `cedros-linked-accounts ${s}`, children: [
|
|
10004
10011
|
/* @__PURE__ */ e(j, {}),
|
|
10005
10012
|
/* @__PURE__ */ e("span", { children: "Loading linked accounts..." })
|
|
@@ -10017,7 +10024,7 @@ function oi({
|
|
|
10017
10024
|
{
|
|
10018
10025
|
credential: C,
|
|
10019
10026
|
isUnlinking: w === C.id,
|
|
10020
|
-
onUnlink:
|
|
10027
|
+
onUnlink: A
|
|
10021
10028
|
},
|
|
10022
10029
|
C.id
|
|
10023
10030
|
)) }),
|
|
@@ -10048,7 +10055,7 @@ function oi({
|
|
|
10048
10055
|
]
|
|
10049
10056
|
}
|
|
10050
10057
|
),
|
|
10051
|
-
|
|
10058
|
+
v && /* @__PURE__ */ e(
|
|
10052
10059
|
"button",
|
|
10053
10060
|
{
|
|
10054
10061
|
type: "button",
|
|
@@ -10557,32 +10564,32 @@ function Ls({
|
|
|
10557
10564
|
}) {
|
|
10558
10565
|
const [d, u] = k(!1), [m, f] = k(""), g = J(null), w = J(null), p = q(() => {
|
|
10559
10566
|
if (!m.trim()) return t;
|
|
10560
|
-
const
|
|
10567
|
+
const A = m.toLowerCase();
|
|
10561
10568
|
return t.filter(
|
|
10562
|
-
(N) => N.symbol.toLowerCase().includes(
|
|
10569
|
+
(N) => N.symbol.toLowerCase().includes(A) || N.name.toLowerCase().includes(A) || N.mint.toLowerCase().includes(A)
|
|
10563
10570
|
);
|
|
10564
10571
|
}, [t, m]);
|
|
10565
10572
|
_(() => {
|
|
10566
|
-
const
|
|
10573
|
+
const A = (N) => {
|
|
10567
10574
|
g.current && !g.current.contains(N.target) && (u(!1), f(""));
|
|
10568
10575
|
};
|
|
10569
10576
|
if (d)
|
|
10570
|
-
return document.addEventListener("mousedown",
|
|
10577
|
+
return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
|
|
10571
10578
|
}, [d]), _(() => {
|
|
10572
10579
|
d && c && w.current && w.current.focus();
|
|
10573
10580
|
}, [d, c]), _(() => {
|
|
10574
10581
|
a === void 0 || n || (u(!0), f(""));
|
|
10575
10582
|
}, [a, n]);
|
|
10576
10583
|
const h = x(() => {
|
|
10577
|
-
n || (u((
|
|
10584
|
+
n || (u((A) => !A), d && f(""));
|
|
10578
10585
|
}, [n, d]), y = x(
|
|
10579
|
-
(
|
|
10580
|
-
o(
|
|
10586
|
+
(A) => {
|
|
10587
|
+
o(A), u(!1), f("");
|
|
10581
10588
|
},
|
|
10582
10589
|
[o]
|
|
10583
10590
|
), b = x(
|
|
10584
|
-
(
|
|
10585
|
-
|
|
10591
|
+
(A) => {
|
|
10592
|
+
A.key === "Escape" ? (u(!1), f("")) : A.key === "Enter" && p.length === 1 && y(p[0]);
|
|
10586
10593
|
},
|
|
10587
10594
|
[p, y]
|
|
10588
10595
|
);
|
|
@@ -10610,8 +10617,8 @@ function Ls({
|
|
|
10610
10617
|
src: r.logoUrl,
|
|
10611
10618
|
alt: r.symbol,
|
|
10612
10619
|
className: "cedros-token-icon",
|
|
10613
|
-
onError: (
|
|
10614
|
-
|
|
10620
|
+
onError: (A) => {
|
|
10621
|
+
A.target.style.display = "none";
|
|
10615
10622
|
}
|
|
10616
10623
|
}
|
|
10617
10624
|
),
|
|
@@ -10628,25 +10635,25 @@ function Ls({
|
|
|
10628
10635
|
ref: w,
|
|
10629
10636
|
type: "text",
|
|
10630
10637
|
value: m,
|
|
10631
|
-
onChange: (
|
|
10638
|
+
onChange: (A) => f(A.target.value),
|
|
10632
10639
|
placeholder: "Search tokens...",
|
|
10633
10640
|
className: "cedros-token-search-input"
|
|
10634
10641
|
}
|
|
10635
10642
|
) }),
|
|
10636
|
-
/* @__PURE__ */ e("div", { className: "cedros-token-list", children: p.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-token-empty", children: "No tokens found" }) : /* @__PURE__ */ e($, { children: p.map((
|
|
10643
|
+
/* @__PURE__ */ e("div", { className: "cedros-token-list", children: p.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-token-empty", children: "No tokens found" }) : /* @__PURE__ */ e($, { children: p.map((A) => /* @__PURE__ */ i(
|
|
10637
10644
|
"button",
|
|
10638
10645
|
{
|
|
10639
10646
|
type: "button",
|
|
10640
|
-
className: `cedros-token-option ${r?.mint ===
|
|
10641
|
-
onClick: () => y(
|
|
10647
|
+
className: `cedros-token-option ${r?.mint === A.mint ? "cedros-token-option-selected" : ""}`,
|
|
10648
|
+
onClick: () => y(A),
|
|
10642
10649
|
role: "option",
|
|
10643
|
-
"aria-selected": r?.mint ===
|
|
10650
|
+
"aria-selected": r?.mint === A.mint,
|
|
10644
10651
|
children: [
|
|
10645
|
-
|
|
10652
|
+
A.logoUrl && /* @__PURE__ */ e(
|
|
10646
10653
|
"img",
|
|
10647
10654
|
{
|
|
10648
|
-
src:
|
|
10649
|
-
alt:
|
|
10655
|
+
src: A.logoUrl,
|
|
10656
|
+
alt: A.symbol,
|
|
10650
10657
|
className: "cedros-token-icon",
|
|
10651
10658
|
onError: (N) => {
|
|
10652
10659
|
N.target.style.display = "none";
|
|
@@ -10654,13 +10661,13 @@ function Ls({
|
|
|
10654
10661
|
}
|
|
10655
10662
|
),
|
|
10656
10663
|
/* @__PURE__ */ i("span", { className: "cedros-token-info", children: [
|
|
10657
|
-
/* @__PURE__ */ e("span", { className: "cedros-token-symbol", children:
|
|
10658
|
-
/* @__PURE__ */ e("span", { className: "cedros-token-name", children:
|
|
10664
|
+
/* @__PURE__ */ e("span", { className: "cedros-token-symbol", children: A.symbol }),
|
|
10665
|
+
/* @__PURE__ */ e("span", { className: "cedros-token-name", children: A.name })
|
|
10659
10666
|
] }),
|
|
10660
|
-
r?.mint ===
|
|
10667
|
+
r?.mint === A.mint && /* @__PURE__ */ e("span", { className: "cedros-token-check", children: "✓" })
|
|
10661
10668
|
]
|
|
10662
10669
|
},
|
|
10663
|
-
|
|
10670
|
+
A.mint
|
|
10664
10671
|
)) }) })
|
|
10665
10672
|
] })
|
|
10666
10673
|
]
|
|
@@ -10815,8 +10822,8 @@ function Is(t, r, o) {
|
|
|
10815
10822
|
if (a.length === 0)
|
|
10816
10823
|
return `Total: $${s.toFixed(2)}`;
|
|
10817
10824
|
const n = a.reduce((p, h) => p + h.solAmount, 0), l = a.reduce((p, h) => p + h.percent, 0), c = { fee: 7, sol: 8, rate: 7, usd: 8 }, d = (p) => {
|
|
10818
|
-
const h = p.label.padEnd(c.fee), y = p.solAmount.toFixed(4).padStart(6).padEnd(c.sol), b = (p.percent.toFixed(2) + "%").padStart(5).padEnd(c.rate),
|
|
10819
|
-
return `${h} │ ${y} │ ${b} │ ${
|
|
10825
|
+
const h = p.label.padEnd(c.fee), y = p.solAmount.toFixed(4).padStart(6).padEnd(c.sol), b = (p.percent.toFixed(2) + "%").padStart(5).padEnd(c.rate), A = ("$" + Math.max(p.usdAmount, 0.01).toFixed(2)).padEnd(c.usd);
|
|
10826
|
+
return `${h} │ ${y} │ ${b} │ ${A}`;
|
|
10820
10827
|
}, u = `${"Fee".padEnd(c.fee)} │ ${"SOL".padEnd(c.sol)} │ ${"+ Rate".padEnd(c.rate)} │ ${"= Total".padEnd(c.usd)}`, m = `${"─".repeat(c.fee)}─┼─${"─".repeat(c.sol)}─┼─${"─".repeat(c.rate)}─┼─${"─".repeat(c.usd)}`, f = ("$" + s.toFixed(2)).padEnd(c.usd), g = `${"TOTAL".padEnd(c.fee)} │ ${n.toFixed(4).padStart(6).padEnd(c.sol)} │ ${(l.toFixed(2) + "%").padStart(5).padEnd(c.rate)} │ ${f}`;
|
|
10821
10828
|
return [u, m, ...a.map(d), m, g].join(`
|
|
10822
10829
|
`);
|
|
@@ -10871,11 +10878,11 @@ function jc({
|
|
|
10871
10878
|
demoMode: h = !1,
|
|
10872
10879
|
demoAutoConfirmMs: y,
|
|
10873
10880
|
tokenPriceUsd: b,
|
|
10874
|
-
showExplainer:
|
|
10881
|
+
showExplainer: A = !1,
|
|
10875
10882
|
siteName: N,
|
|
10876
10883
|
explainerConfig: E
|
|
10877
10884
|
}) {
|
|
10878
|
-
const { deposit: P, getStatus:
|
|
10885
|
+
const { deposit: P, getStatus: v, error: S, clearError: L } = fi(), C = tt(), B = Or(t.quickActionTokens), T = Or(t.customTokenSymbols), M = q(() => {
|
|
10879
10886
|
const O = t.customTokens ?? [];
|
|
10880
10887
|
if (O.length === 0) return a;
|
|
10881
10888
|
const H = new Set(a.map((Z) => Z.symbol)), Y = [...a];
|
|
@@ -10893,7 +10900,7 @@ function jc({
|
|
|
10893
10900
|
if (T.length === 0) return M;
|
|
10894
10901
|
const O = M.filter((H) => T.includes(H.symbol));
|
|
10895
10902
|
return O.length > 0 ? O : M;
|
|
10896
|
-
}, [M, T]), I = t.privateDepositsEnabled, U = o ? o === "sign" && !I ? "receive" : o : I && C.hasExternalWallet ? "sign" : "receive", ee = B[0] ? M.find((O) => O.symbol === B[0]) : void 0, pe = r === "sol" ? Se : r === "single-token" ? ee ?? M.find((O) => O.symbol === "USDC") ?? M[0] ?? Se : s ?? ee ?? M.find((O) => O.symbol === "USDC") ?? M.find((O) => O.symbol !== "SOL") ?? M[0] ?? Se, re = x(() =>
|
|
10903
|
+
}, [M, T]), I = t.privateDepositsEnabled, U = o ? o === "sign" && !I ? "receive" : o : I && C.hasExternalWallet ? "sign" : "receive", ee = B[0] ? M.find((O) => O.symbol === B[0]) : void 0, pe = r === "sol" ? Se : r === "single-token" ? ee ?? M.find((O) => O.symbol === "USDC") ?? M[0] ?? Se : s ?? ee ?? M.find((O) => O.symbol === "USDC") ?? M.find((O) => O.symbol !== "SOL") ?? M[0] ?? Se, re = x(() => A ? "explainer" : "unlock", [A]), [Q, D] = k(re), [F, K] = k(pe), [se, ne] = k(""), [ge, me] = k(null), [V, z] = k(null), [G, de] = k(null), [be, Zt] = k(null), [nt, Me] = k(!1), [js, at] = k(!1), [De, er] = k(null);
|
|
10897
10904
|
_(() => {
|
|
10898
10905
|
D(re()), K(pe), ne(""), me(null), z(null), de(null), Zt(null), Me(!1), at(!1), er(null), L();
|
|
10899
10906
|
}, [r, U, pe, L, re]);
|
|
@@ -10909,8 +10916,8 @@ function jc({
|
|
|
10909
10916
|
{ key: "waiting", label: "Confirming" },
|
|
10910
10917
|
{ key: "success", label: "Complete" }
|
|
10911
10918
|
];
|
|
10912
|
-
return
|
|
10913
|
-
}, [U,
|
|
10919
|
+
return A && (Y = [{ key: "explainer", label: "Info" }, ...Y]), Y;
|
|
10920
|
+
}, [U, A])(), Hs = rr.findIndex((O) => O.key === Q), sr = x((O) => {
|
|
10914
10921
|
K(O);
|
|
10915
10922
|
}, []), Qs = x(
|
|
10916
10923
|
async (O) => {
|
|
@@ -11014,7 +11021,7 @@ function jc({
|
|
|
11014
11021
|
if (!(H || Y >= Z)) {
|
|
11015
11022
|
Y++;
|
|
11016
11023
|
try {
|
|
11017
|
-
const ie = await
|
|
11024
|
+
const ie = await v(G);
|
|
11018
11025
|
if (ie.status === "completed" || ie.status === "detected") {
|
|
11019
11026
|
const Fe = ie.amountLamports ? ie.amountLamports / Math.pow(10, F.decimals) : 0, _e = ie.amountLamports || 0, We = {
|
|
11020
11027
|
token: r === "sol" ? null : F,
|
|
@@ -11041,7 +11048,7 @@ function jc({
|
|
|
11041
11048
|
Q,
|
|
11042
11049
|
G,
|
|
11043
11050
|
h,
|
|
11044
|
-
|
|
11051
|
+
v,
|
|
11045
11052
|
F,
|
|
11046
11053
|
r,
|
|
11047
11054
|
C.solanaPubkey,
|
|
@@ -11130,7 +11137,7 @@ function jc({
|
|
|
11130
11137
|
isAuthorizing: js,
|
|
11131
11138
|
error: V,
|
|
11132
11139
|
onAuthorize: Qs,
|
|
11133
|
-
onBack:
|
|
11140
|
+
onBack: A ? () => D("explainer") : void 0,
|
|
11134
11141
|
onCancel: u
|
|
11135
11142
|
}
|
|
11136
11143
|
),
|
|
@@ -11348,10 +11355,10 @@ function Pi({
|
|
|
11348
11355
|
onConfirm: y,
|
|
11349
11356
|
onBack: b
|
|
11350
11357
|
}) {
|
|
11351
|
-
const [
|
|
11358
|
+
const [A, N] = k(g.privateMinUsd), [E, P] = k(!1), [v, S] = k(!1), [L, C] = k(0), [B, T] = k(null), R = $t(A, g) === "sol_micro", I = t.symbol === xe.symbol, U = q(() => {
|
|
11352
11359
|
const V = a.length === 0 ? r : r.filter((de) => a.includes(de.symbol)), z = V.length > 0 ? V : r;
|
|
11353
11360
|
return z.some((de) => de.symbol === xe.symbol) ? z : [...z, xe];
|
|
11354
|
-
}, [r, a]), ee = ot(g,
|
|
11361
|
+
}, [r, a]), ee = ot(g, A), pe = ee < 0.01 ? 0.01 : ee, re = I ? "Fees: calculated after deposit" : `Fees: $${pe.toFixed(2)} total`, Q = I ? "" : Is(g, A, ee), D = Fs(R ? Se : t, g), F = D ? A / D : t.symbol === "SOL" && g.solPriceUsd > 0 ? A / g.solPriceUsd : A, K = F ? _s(F, R ? "SOL" : t.symbol) : null, ne = A - ee <= 0 && A > 0, ge = !I && A > 0 && !ne && F >= n && F <= l;
|
|
11355
11362
|
_(() => {
|
|
11356
11363
|
if (s === "multi-token")
|
|
11357
11364
|
if (R && t.symbol !== "SOL") {
|
|
@@ -11421,7 +11428,7 @@ function Pi({
|
|
|
11421
11428
|
Bs,
|
|
11422
11429
|
{
|
|
11423
11430
|
config: g,
|
|
11424
|
-
valueUsd:
|
|
11431
|
+
valueUsd: A,
|
|
11425
11432
|
onChange: N,
|
|
11426
11433
|
maxUsd: Rs
|
|
11427
11434
|
}
|
|
@@ -11471,11 +11478,11 @@ function Pi({
|
|
|
11471
11478
|
"button",
|
|
11472
11479
|
{
|
|
11473
11480
|
type: "button",
|
|
11474
|
-
className: `cedros-deposit-flow-fee-info ${
|
|
11481
|
+
className: `cedros-deposit-flow-fee-info ${v ? "is-open" : ""}`,
|
|
11475
11482
|
"data-tooltip": Q,
|
|
11476
11483
|
"aria-label": `Fee breakdown: ${Q.replaceAll(`
|
|
11477
11484
|
`, ", ")}`,
|
|
11478
|
-
"aria-expanded":
|
|
11485
|
+
"aria-expanded": v,
|
|
11479
11486
|
onClick: (V) => {
|
|
11480
11487
|
V.stopPropagation(), S((z) => !z);
|
|
11481
11488
|
},
|
|
@@ -11562,7 +11569,7 @@ function Mi({
|
|
|
11562
11569
|
onSent: w,
|
|
11563
11570
|
onBack: p
|
|
11564
11571
|
}) {
|
|
11565
|
-
const [h, y] = k(u.privateMinUsd), [b,
|
|
11572
|
+
const [h, y] = k(u.privateMinUsd), [b, A] = k(!1), [N, E] = k(!1), [P, v] = k(0), [S, L] = k(null), B = $t(h, u) === "sol_micro", T = t.symbol === xe.symbol, M = q(() => {
|
|
11566
11573
|
const F = a.length === 0 ? r : r.filter((ne) => a.includes(ne.symbol)), K = F.length > 0 ? F : r;
|
|
11567
11574
|
return K.some((ne) => ne.symbol === xe.symbol) ? K : [...K, xe];
|
|
11568
11575
|
}, [r, a]), R = ot(u, h), I = R < 0.01 ? 0.01 : R, U = T ? "Fees: calculated after deposit" : `Fees: $${I.toFixed(2)} total`, ee = T ? "" : Is(u, h, R), pe = T || h > 0, re = Fs(B ? Se : t, u, s), Q = re ? h / re : null, D = Q ? _s(Q, t.symbol) : null;
|
|
@@ -11589,7 +11596,7 @@ function Mi({
|
|
|
11589
11596
|
type: "button",
|
|
11590
11597
|
className: `cedros-deposit-flow-token-quick-btn ${se ? "is-active" : ""}`,
|
|
11591
11598
|
onClick: () => {
|
|
11592
|
-
K && (
|
|
11599
|
+
K && (A(!1), f(K));
|
|
11593
11600
|
},
|
|
11594
11601
|
disabled: !K,
|
|
11595
11602
|
children: [
|
|
@@ -11613,7 +11620,7 @@ function Mi({
|
|
|
11613
11620
|
type: "button",
|
|
11614
11621
|
className: `cedros-deposit-flow-token-quick-btn ${b ? "is-active" : ""}`,
|
|
11615
11622
|
onClick: () => {
|
|
11616
|
-
|
|
11623
|
+
A(!0), v((F) => F + 1);
|
|
11617
11624
|
},
|
|
11618
11625
|
children: "Custom"
|
|
11619
11626
|
}
|
|
@@ -12157,10 +12164,10 @@ function Vc({
|
|
|
12157
12164
|
onLoad: s,
|
|
12158
12165
|
onTransactionClick: n
|
|
12159
12166
|
}) {
|
|
12160
|
-
const { getHistory: l, isLoading: c, error: d, clearError: u } = Ws(), [m, f] = k(t), [g, w] = k([]), [p, h] = k(0), [y, b] = k(0), [
|
|
12167
|
+
const { getHistory: l, isLoading: c, error: d, clearError: u } = Ws(), [m, f] = k(t), [g, w] = k([]), [p, h] = k(0), [y, b] = k(0), [A, N] = k(null), E = Dt.find((M) => M.key === m) || Dt[0], P = q(() => E.txTypes === null ? g : g.filter((M) => {
|
|
12161
12168
|
const R = M.txType || "";
|
|
12162
12169
|
return E.txTypes.some((I) => R.toLowerCase().includes(I.toLowerCase()));
|
|
12163
|
-
}), [g, E.txTypes]),
|
|
12170
|
+
}), [g, E.txTypes]), v = x(async () => {
|
|
12164
12171
|
try {
|
|
12165
12172
|
const M = await l({ limit: r * 3, offset: y });
|
|
12166
12173
|
w(M.transactions), h(M.total), s?.(M), N(null);
|
|
@@ -12171,28 +12178,28 @@ function Vc({
|
|
|
12171
12178
|
_(() => {
|
|
12172
12179
|
b(0);
|
|
12173
12180
|
}, [m]), _(() => {
|
|
12174
|
-
|
|
12175
|
-
}, [
|
|
12181
|
+
v();
|
|
12182
|
+
}, [v]), _(() => {
|
|
12176
12183
|
if (o <= 0) return;
|
|
12177
|
-
const M = setInterval(
|
|
12184
|
+
const M = setInterval(v, o);
|
|
12178
12185
|
return () => clearInterval(M);
|
|
12179
|
-
}, [o,
|
|
12186
|
+
}, [o, v]);
|
|
12180
12187
|
const S = Math.ceil(p / r), L = Math.floor(y / r) + 1, C = (M) => {
|
|
12181
12188
|
const R = (M - 1) * r;
|
|
12182
12189
|
b(Math.max(0, Math.min(R, Math.max(0, p - 1))));
|
|
12183
12190
|
}, B = (M) => {
|
|
12184
12191
|
f(M);
|
|
12185
12192
|
};
|
|
12186
|
-
if (
|
|
12193
|
+
if (A || d)
|
|
12187
12194
|
return /* @__PURE__ */ i("div", { className: `cedros-tx-history cedros-tx-history-error ${a}`, children: [
|
|
12188
|
-
/* @__PURE__ */ e("p", { className: "cedros-tx-error", children:
|
|
12195
|
+
/* @__PURE__ */ e("p", { className: "cedros-tx-error", children: A || d }),
|
|
12189
12196
|
/* @__PURE__ */ e(
|
|
12190
12197
|
"button",
|
|
12191
12198
|
{
|
|
12192
12199
|
type: "button",
|
|
12193
12200
|
className: "cedros-tx-retry",
|
|
12194
12201
|
onClick: () => {
|
|
12195
|
-
u(), N(null),
|
|
12202
|
+
u(), N(null), v();
|
|
12196
12203
|
},
|
|
12197
12204
|
children: "Retry"
|
|
12198
12205
|
}
|
|
@@ -12215,7 +12222,7 @@ function Vc({
|
|
|
12215
12222
|
{
|
|
12216
12223
|
type: "button",
|
|
12217
12224
|
className: "cedros-tx-refresh",
|
|
12218
|
-
onClick:
|
|
12225
|
+
onClick: v,
|
|
12219
12226
|
disabled: c,
|
|
12220
12227
|
title: "Refresh",
|
|
12221
12228
|
children: c ? "..." : "↻"
|
|
@@ -12429,7 +12436,7 @@ function Hc({
|
|
|
12429
12436
|
onCancel: o,
|
|
12430
12437
|
className: a = ""
|
|
12431
12438
|
}) {
|
|
12432
|
-
const s = ve(), { withdrawSol: n, withdrawSpl: l, getBalances: c, isSubmitting: d, error: u, clearError: m } = Os(), [f, g] = k("loading"), [w, p] = k([]), [h, y] = k(null), [b,
|
|
12439
|
+
const s = ve(), { withdrawSol: n, withdrawSpl: l, getBalances: c, isSubmitting: d, error: u, clearError: m } = Os(), [f, g] = k("loading"), [w, p] = k([]), [h, y] = k(null), [b, A] = k(""), [N, E] = k(""), [P, v] = k(null), [S, L] = k(null), [C, B] = k(null), T = s?.config.solana?.network ?? "mainnet-beta", M = q(() => {
|
|
12433
12440
|
if (!P?.txSignature) return "";
|
|
12434
12441
|
const D = `https://explorer.solana.com/tx/${P.txSignature}`;
|
|
12435
12442
|
return T === "mainnet-beta" ? D : `${D}?cluster=${encodeURIComponent(T)}`;
|
|
@@ -12503,7 +12510,7 @@ function Hc({
|
|
|
12503
12510
|
g("processing"), m();
|
|
12504
12511
|
try {
|
|
12505
12512
|
let D;
|
|
12506
|
-
h.mint === Ut ? D = await n(b.trim(), Number(R)) : D = await l(b.trim(), h.mint, R),
|
|
12513
|
+
h.mint === Ut ? D = await n(b.trim(), Number(R)) : D = await l(b.trim(), h.mint, R), v(D), g("success"), t?.(D);
|
|
12507
12514
|
} catch (D) {
|
|
12508
12515
|
g("confirm"), r?.(D instanceof Error ? D : new Error(String(D)));
|
|
12509
12516
|
}
|
|
@@ -12518,9 +12525,9 @@ function Hc({
|
|
|
12518
12525
|
t,
|
|
12519
12526
|
r
|
|
12520
12527
|
]), re = x(() => {
|
|
12521
|
-
m(), L(null), f === "form" ? (g("select"), y(null), E(""),
|
|
12528
|
+
m(), L(null), f === "form" ? (g("select"), y(null), E(""), A("")) : f === "confirm" && g("form");
|
|
12522
12529
|
}, [f, m]), Q = x(() => {
|
|
12523
|
-
g("select"), y(null),
|
|
12530
|
+
g("select"), y(null), A(""), E(""), v(null), m(), L(null);
|
|
12524
12531
|
}, [m]);
|
|
12525
12532
|
return s ? /* @__PURE__ */ i("div", { className: `cedros-withdrawal ${a}`, children: [
|
|
12526
12533
|
f === "loading" && /* @__PURE__ */ i("div", { className: "cedros-withdrawal-processing", children: [
|
|
@@ -12589,7 +12596,7 @@ function Hc({
|
|
|
12589
12596
|
className: "cedros-input",
|
|
12590
12597
|
placeholder: "Solana address (base58)",
|
|
12591
12598
|
value: b,
|
|
12592
|
-
onChange: (D) =>
|
|
12599
|
+
onChange: (D) => A(D.target.value),
|
|
12593
12600
|
autoComplete: "off",
|
|
12594
12601
|
spellCheck: !1
|
|
12595
12602
|
}
|
|
@@ -12785,9 +12792,9 @@ function Qc({
|
|
|
12785
12792
|
_(() => {
|
|
12786
12793
|
b();
|
|
12787
12794
|
}, [b]);
|
|
12788
|
-
const
|
|
12789
|
-
const
|
|
12790
|
-
g(Math.max(0, Math.min(
|
|
12795
|
+
const A = Math.ceil(u / t), N = Math.floor(f / t) + 1, E = (P) => {
|
|
12796
|
+
const v = (P - 1) * t;
|
|
12797
|
+
g(Math.max(0, Math.min(v, Math.max(0, u - 1))));
|
|
12791
12798
|
};
|
|
12792
12799
|
return h || n ? /* @__PURE__ */ i("div", { className: `cedros-withdrawal-history cedros-withdrawal-history-error ${r}`, children: [
|
|
12793
12800
|
/* @__PURE__ */ e("p", { className: "cedros-withdrawal-error", children: h || n }),
|
|
@@ -12822,7 +12829,7 @@ function Qc({
|
|
|
12822
12829
|
] }),
|
|
12823
12830
|
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($, { children: [
|
|
12824
12831
|
/* @__PURE__ */ e("div", { className: "cedros-tx-list", children: c.map((P) => {
|
|
12825
|
-
const
|
|
12832
|
+
const v = Gi(P.tokenType, P.tokenMint);
|
|
12826
12833
|
return /* @__PURE__ */ i(
|
|
12827
12834
|
"div",
|
|
12828
12835
|
{
|
|
@@ -12838,13 +12845,13 @@ function Qc({
|
|
|
12838
12845
|
/* @__PURE__ */ i("div", { className: "cedros-tx-content", children: [
|
|
12839
12846
|
/* @__PURE__ */ i("div", { className: "cedros-tx-row-main", children: [
|
|
12840
12847
|
/* @__PURE__ */ i("span", { className: "cedros-tx-type", children: [
|
|
12841
|
-
|
|
12848
|
+
v,
|
|
12842
12849
|
" Withdrawal"
|
|
12843
12850
|
] }),
|
|
12844
12851
|
/* @__PURE__ */ i("span", { className: "cedros-tx-amount cedros-tx-amount-negative", children: [
|
|
12845
12852
|
P.amount,
|
|
12846
12853
|
" ",
|
|
12847
|
-
|
|
12854
|
+
v === "SOL" ? "lamports" : ""
|
|
12848
12855
|
] })
|
|
12849
12856
|
] }),
|
|
12850
12857
|
/* @__PURE__ */ i("div", { className: "cedros-tx-row-details", children: [
|
|
@@ -12881,7 +12888,7 @@ function Qc({
|
|
|
12881
12888
|
P.id
|
|
12882
12889
|
);
|
|
12883
12890
|
}) }),
|
|
12884
|
-
|
|
12891
|
+
A > 1 && /* @__PURE__ */ i("div", { className: "cedros-tx-pagination", children: [
|
|
12885
12892
|
/* @__PURE__ */ e(
|
|
12886
12893
|
"button",
|
|
12887
12894
|
{
|
|
@@ -12896,7 +12903,7 @@ function Qc({
|
|
|
12896
12903
|
"Page ",
|
|
12897
12904
|
N,
|
|
12898
12905
|
" of ",
|
|
12899
|
-
|
|
12906
|
+
A
|
|
12900
12907
|
] }),
|
|
12901
12908
|
/* @__PURE__ */ e(
|
|
12902
12909
|
"button",
|
|
@@ -12904,7 +12911,7 @@ function Qc({
|
|
|
12904
12911
|
type: "button",
|
|
12905
12912
|
className: "cedros-tx-page-btn",
|
|
12906
12913
|
onClick: () => E(N + 1),
|
|
12907
|
-
disabled: N >=
|
|
12914
|
+
disabled: N >= A,
|
|
12908
12915
|
children: "Next"
|
|
12909
12916
|
}
|
|
12910
12917
|
)
|