@cedros/login-react 0.0.45 → 0.0.47

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.
Files changed (137) hide show
  1. package/README.md +32 -2
  2. package/dist/{AuthenticationSettings-bNQiNQ9g.cjs → AuthenticationSettings-BBOjHR6j.cjs} +1 -1
  3. package/dist/{AuthenticationSettings-bNQiNQ9g.cjs.map → AuthenticationSettings-BBOjHR6j.cjs.map} +1 -1
  4. package/dist/{AuthenticationSettings-BlYOmaEG.cjs → AuthenticationSettings-BXZRBZqc.cjs} +1 -1
  5. package/dist/{AuthenticationSettings-BlYOmaEG.cjs.map → AuthenticationSettings-BXZRBZqc.cjs.map} +1 -1
  6. package/dist/{AuthenticationSettings-BsuwWKbT.js → AuthenticationSettings-Bc_qT4nV.js} +1 -1
  7. package/dist/{AuthenticationSettings-BsuwWKbT.js.map → AuthenticationSettings-Bc_qT4nV.js.map} +1 -1
  8. package/dist/{AuthenticationSettings-DrHqtD7p.js → AuthenticationSettings-DXWCVZxS.js} +1 -1
  9. package/dist/{AuthenticationSettings-DrHqtD7p.js.map → AuthenticationSettings-DXWCVZxS.js.map} +1 -1
  10. package/dist/{AutosaveStatus-CZSwtgrL.cjs → AutosaveStatus-DfMPudTQ.cjs} +1 -1
  11. package/dist/AutosaveStatus-DfMPudTQ.cjs.map +1 -0
  12. package/dist/{AutosaveStatus-D-roPsRx.js → AutosaveStatus-DhGM3UUx.js} +103 -36
  13. package/dist/AutosaveStatus-DhGM3UUx.js.map +1 -0
  14. package/dist/{CreditSystemSettings-BTqZFn4K.js → CreditSystemSettings-B59-gOQT.js} +1 -1
  15. package/dist/{CreditSystemSettings-BTqZFn4K.js.map → CreditSystemSettings-B59-gOQT.js.map} +1 -1
  16. package/dist/{CreditSystemSettings-3R6crxvW.cjs → CreditSystemSettings-Badz4iAc.cjs} +1 -1
  17. package/dist/{CreditSystemSettings-3R6crxvW.cjs.map → CreditSystemSettings-Badz4iAc.cjs.map} +1 -1
  18. package/dist/{CreditSystemSettings-BskW_NKx.cjs → CreditSystemSettings-BxSoDwEi.cjs} +1 -1
  19. package/dist/{CreditSystemSettings-BskW_NKx.cjs.map → CreditSystemSettings-BxSoDwEi.cjs.map} +1 -1
  20. package/dist/{CreditSystemSettings-SL45GRH3.js → CreditSystemSettings-DxFpOeBW.js} +1 -1
  21. package/dist/{CreditSystemSettings-SL45GRH3.js.map → CreditSystemSettings-DxFpOeBW.js.map} +1 -1
  22. package/dist/EmailRegisterForm-ByYQ43yL.cjs +1 -0
  23. package/dist/EmailRegisterForm-ByYQ43yL.cjs.map +1 -0
  24. package/dist/EmailRegisterForm-DMUcNQT-.js +781 -0
  25. package/dist/EmailRegisterForm-DMUcNQT-.js.map +1 -0
  26. package/dist/{EmailSettings-XETM8FdS.js → EmailSettings-0y8D1QzF.js} +1 -1
  27. package/dist/{EmailSettings-XETM8FdS.js.map → EmailSettings-0y8D1QzF.js.map} +1 -1
  28. package/dist/{EmailSettings-BUAQji4I.js → EmailSettings-BA722mhf.js} +1 -1
  29. package/dist/{EmailSettings-BUAQji4I.js.map → EmailSettings-BA722mhf.js.map} +1 -1
  30. package/dist/{EmailSettings-CihElRkc.cjs → EmailSettings-BwZvdOYB.cjs} +1 -1
  31. package/dist/{EmailSettings-CihElRkc.cjs.map → EmailSettings-BwZvdOYB.cjs.map} +1 -1
  32. package/dist/{EmailSettings-CEC1rhrm.cjs → EmailSettings-DIjo3aJo.cjs} +1 -1
  33. package/dist/{EmailSettings-CEC1rhrm.cjs.map → EmailSettings-DIjo3aJo.cjs.map} +1 -1
  34. package/dist/{EmbeddedWalletSettings-CCT9DwmL.js → EmbeddedWalletSettings-BDbPpqWD.js} +1 -1
  35. package/dist/{EmbeddedWalletSettings-CCT9DwmL.js.map → EmbeddedWalletSettings-BDbPpqWD.js.map} +1 -1
  36. package/dist/{EmbeddedWalletSettings-MtwR81WH.cjs → EmbeddedWalletSettings-Db9a0D5l.cjs} +1 -1
  37. package/dist/{EmbeddedWalletSettings-MtwR81WH.cjs.map → EmbeddedWalletSettings-Db9a0D5l.cjs.map} +1 -1
  38. package/dist/{EmbeddedWalletSettings-B-083zu6.js → EmbeddedWalletSettings-MH4A6e6S.js} +1 -1
  39. package/dist/{EmbeddedWalletSettings-B-083zu6.js.map → EmbeddedWalletSettings-MH4A6e6S.js.map} +1 -1
  40. package/dist/{EmbeddedWalletSettings-DXIjansC.cjs → EmbeddedWalletSettings-T7LwbGok.cjs} +1 -1
  41. package/dist/{EmbeddedWalletSettings-DXIjansC.cjs.map → EmbeddedWalletSettings-T7LwbGok.cjs.map} +1 -1
  42. package/dist/GoogleLoginButton-DEwtBp56.cjs +1 -0
  43. package/dist/GoogleLoginButton-DEwtBp56.cjs.map +1 -0
  44. package/dist/{GoogleLoginButton-C1WNu7W3.js → GoogleLoginButton-DwyxvhnL.js} +82 -80
  45. package/dist/GoogleLoginButton-DwyxvhnL.js.map +1 -0
  46. package/dist/{PermissionsSection-mm9hfp-u.js → PermissionsSection-0oNHPZzL.js} +383 -415
  47. package/dist/PermissionsSection-0oNHPZzL.js.map +1 -0
  48. package/dist/PermissionsSection-CZsJuxo4.cjs +1 -0
  49. package/dist/PermissionsSection-CZsJuxo4.cjs.map +1 -0
  50. package/dist/{ServerSettings-DBpbRihl.js → ServerSettings-CwCkkU50.js} +1 -1
  51. package/dist/{ServerSettings-DBpbRihl.js.map → ServerSettings-CwCkkU50.js.map} +1 -1
  52. package/dist/{ServerSettings-24DA_BOI.js → ServerSettings-DKzWaqjC.js} +1 -1
  53. package/dist/{ServerSettings-24DA_BOI.js.map → ServerSettings-DKzWaqjC.js.map} +1 -1
  54. package/dist/{ServerSettings-BTEuzdrf.cjs → ServerSettings-DptlzQAu.cjs} +1 -1
  55. package/dist/{ServerSettings-BTEuzdrf.cjs.map → ServerSettings-DptlzQAu.cjs.map} +1 -1
  56. package/dist/{ServerSettings-BNc4LEs4.cjs → ServerSettings-j5Lu5D-R.cjs} +1 -1
  57. package/dist/{ServerSettings-BNc4LEs4.cjs.map → ServerSettings-j5Lu5D-R.cjs.map} +1 -1
  58. package/dist/SolanaLoginButton-2504p6cr.cjs +1 -0
  59. package/dist/SolanaLoginButton-2504p6cr.cjs.map +1 -0
  60. package/dist/SolanaLoginButton-C7Kc_m6n.js +234 -0
  61. package/dist/SolanaLoginButton-C7Kc_m6n.js.map +1 -0
  62. package/dist/{TeamSection-Km7EwLWD.cjs → TeamSection-DN8PEHH3.cjs} +1 -1
  63. package/dist/{TeamSection-Km7EwLWD.cjs.map → TeamSection-DN8PEHH3.cjs.map} +1 -1
  64. package/dist/{TeamSection-C_eODdLU.js → TeamSection-gUyP4YDM.js} +1 -1
  65. package/dist/{TeamSection-C_eODdLU.js.map → TeamSection-gUyP4YDM.js.map} +1 -1
  66. package/dist/{UsersSection-C1Tt0ePx.cjs → UsersSection-8wLuD0fr.cjs} +1 -1
  67. package/dist/{UsersSection-C1Tt0ePx.cjs.map → UsersSection-8wLuD0fr.cjs.map} +1 -1
  68. package/dist/{UsersSection-Ct_E-MBF.js → UsersSection-CnsFrG-6.js} +1 -1
  69. package/dist/{UsersSection-Ct_E-MBF.js.map → UsersSection-CnsFrG-6.js.map} +1 -1
  70. package/dist/{WebhookSettings-D9IsXZJN.js → WebhookSettings-2hlLLyGd.js} +1 -1
  71. package/dist/{WebhookSettings-D9IsXZJN.js.map → WebhookSettings-2hlLLyGd.js.map} +1 -1
  72. package/dist/{WebhookSettings-C6X_JJcD.cjs → WebhookSettings-CoEoVRRO.cjs} +1 -1
  73. package/dist/{WebhookSettings-C6X_JJcD.cjs.map → WebhookSettings-CoEoVRRO.cjs.map} +1 -1
  74. package/dist/{WebhookSettings-H1x6IKOj.cjs → WebhookSettings-DOaydSWQ.cjs} +1 -1
  75. package/dist/{WebhookSettings-H1x6IKOj.cjs.map → WebhookSettings-DOaydSWQ.cjs.map} +1 -1
  76. package/dist/{WebhookSettings-BhIwucKb.js → WebhookSettings-LS_wUimF.js} +1 -1
  77. package/dist/{WebhookSettings-BhIwucKb.js.map → WebhookSettings-LS_wUimF.js.map} +1 -1
  78. package/dist/admin-only.cjs +1 -1
  79. package/dist/admin-only.js +1 -1
  80. package/dist/email-only.cjs +1 -1
  81. package/dist/email-only.d.ts +10 -2
  82. package/dist/email-only.js +2 -2
  83. package/dist/google-only.cjs +1 -1
  84. package/dist/google-only.d.ts +7 -2
  85. package/dist/google-only.js +2 -2
  86. package/dist/index.cjs +12 -12
  87. package/dist/index.cjs.map +1 -1
  88. package/dist/index.d.ts +182 -11
  89. package/dist/index.js +5221 -4657
  90. package/dist/index.js.map +1 -1
  91. package/dist/login-react.css +1 -1
  92. package/dist/{plugin-BwwJh2cY.cjs → plugin-DNFjEfYp.cjs} +1 -1
  93. package/dist/{plugin-BwwJh2cY.cjs.map → plugin-DNFjEfYp.cjs.map} +1 -1
  94. package/dist/{plugin-CetHtdLq.js → plugin-WYMrRNbz.js} +1 -1
  95. package/dist/{plugin-CetHtdLq.js.map → plugin-WYMrRNbz.js.map} +1 -1
  96. package/dist/solana-only.cjs +1 -1
  97. package/dist/solana-only.d.ts +6 -1
  98. package/dist/solana-only.js +2 -2
  99. package/dist/useAuth-2vgrAH-M.cjs +1 -0
  100. package/dist/useAuth-2vgrAH-M.cjs.map +1 -0
  101. package/dist/{useAuth-l-itM5am.js → useAuth-CNflw856.js} +465 -469
  102. package/dist/useAuth-CNflw856.js.map +1 -0
  103. package/dist/useServerFeatures-9_aNPaa6.cjs +1 -0
  104. package/dist/useServerFeatures-9_aNPaa6.cjs.map +1 -0
  105. package/dist/useServerFeatures-DSkYdan-.js +82 -0
  106. package/dist/useServerFeatures-DSkYdan-.js.map +1 -0
  107. package/dist/{useUsersStatsSummary-BGeh3RnI.js → useUsersStatsSummary-B4_RBEYy.js} +504 -442
  108. package/dist/useUsersStatsSummary-B4_RBEYy.js.map +1 -0
  109. package/dist/useUsersStatsSummary-CHRMrlk4.cjs +1 -0
  110. package/dist/useUsersStatsSummary-CHRMrlk4.cjs.map +1 -0
  111. package/package.json +1 -1
  112. package/dist/AutosaveStatus-CZSwtgrL.cjs.map +0 -1
  113. package/dist/AutosaveStatus-D-roPsRx.js.map +0 -1
  114. package/dist/EmailRegisterForm-p2X5QP58.js +0 -750
  115. package/dist/EmailRegisterForm-p2X5QP58.js.map +0 -1
  116. package/dist/EmailRegisterForm-xFb6MaVA.cjs +0 -1
  117. package/dist/EmailRegisterForm-xFb6MaVA.cjs.map +0 -1
  118. package/dist/GoogleLoginButton-2zNTIKMm.cjs +0 -1
  119. package/dist/GoogleLoginButton-2zNTIKMm.cjs.map +0 -1
  120. package/dist/GoogleLoginButton-C1WNu7W3.js.map +0 -1
  121. package/dist/PermissionsSection-4zcE9Zs9.cjs +0 -1
  122. package/dist/PermissionsSection-4zcE9Zs9.cjs.map +0 -1
  123. package/dist/PermissionsSection-mm9hfp-u.js.map +0 -1
  124. package/dist/SolanaLoginButton-CqdzSSeJ.cjs +0 -1
  125. package/dist/SolanaLoginButton-CqdzSSeJ.cjs.map +0 -1
  126. package/dist/SolanaLoginButton-CyeX35eU.js +0 -232
  127. package/dist/SolanaLoginButton-CyeX35eU.js.map +0 -1
  128. package/dist/sanitization-Bo_tn-L2.cjs +0 -1
  129. package/dist/sanitization-Bo_tn-L2.cjs.map +0 -1
  130. package/dist/sanitization-CQ-H1MSg.js +0 -39
  131. package/dist/sanitization-CQ-H1MSg.js.map +0 -1
  132. package/dist/useAuth-B1yS_YiD.cjs +0 -1
  133. package/dist/useAuth-B1yS_YiD.cjs.map +0 -1
  134. package/dist/useAuth-l-itM5am.js.map +0 -1
  135. package/dist/useUsersStatsSummary-BGeh3RnI.js.map +0 -1
  136. package/dist/useUsersStatsSummary-DnsYtFGX.cjs +0 -1
  137. package/dist/useUsersStatsSummary-DnsYtFGX.cjs.map +0 -1
@@ -1,31 +1,28 @@
1
- import { jsx as ie, jsxs as Ke } from "react/jsx-runtime";
2
- import { useEffect as x, useState as F, useRef as N, useCallback as d, useMemo as Y } from "react";
1
+ import { jsx as $, jsxs as Ke } from "react/jsx-runtime";
2
+ import { useMemo as M, useEffect as P, useState as F, useRef as N, useCallback as E } from "react";
3
3
  import { A as He, a as Je, C as Me } from "./LoadingSpinner-6vml-zwr.js";
4
- import { A as pe, g as re, a as ye, h as P, u as ke } from "./useCedrosLogin-CFfID-0i.js";
5
- let q = 0;
4
+ import { A as ye, g as oe, a as ke, h as V, u as Se } from "./useCedrosLogin-CFfID-0i.js";
5
+ let z = 0;
6
6
  function Ve({ theme: e, themeOverrides: A }) {
7
- x(() => {
8
- if (typeof document > "u" || typeof window > "u")
9
- return;
10
- const t = document.documentElement;
11
- let i = !1;
12
- e === "dark" ? i = !0 : e === "light" ? i = !1 : i = window.matchMedia("(prefers-color-scheme: dark)").matches;
13
- let r = !1;
14
- i ? (q++, r = !0, t.classList.add("cedros-dark")) : q === 0 && t.classList.remove("cedros-dark");
15
- const n = /* @__PURE__ */ new Map();
16
- return A && Object.entries(A).forEach(([o, a]) => {
17
- if (a) {
18
- const C = t.style.getPropertyValue(o);
19
- n.set(o, C), t.style.setProperty(o, a);
20
- }
21
- }), () => {
22
- r && (q--, q === 0 && t.classList.remove("cedros-dark")), n.forEach((o, a) => {
23
- o ? t.style.setProperty(a, o) : t.style.removeProperty(a);
24
- });
7
+ const t = M(() => typeof window > "u" ? !1 : e === "dark" ? !0 : e === "light" ? !1 : window.matchMedia("(prefers-color-scheme: dark)").matches, [e]);
8
+ P(() => {
9
+ if (typeof document > "u") return;
10
+ const n = document.documentElement;
11
+ let s = !1;
12
+ return t ? (z++, s = !0, n.classList.add("cedros-dark")) : z === 0 && n.classList.remove("cedros-dark"), () => {
13
+ s && (z--, z === 0 && n.classList.remove("cedros-dark"));
25
14
  };
26
- }, [e, A]);
15
+ }, [t]);
16
+ const i = t ? "cedros-dark" : "", r = M(() => {
17
+ if (!A) return {};
18
+ const n = {};
19
+ for (const [s, l] of Object.entries(A))
20
+ l && (n[s] = l);
21
+ return n;
22
+ }, [A]);
23
+ return { className: i, style: r };
27
24
  }
28
- const Pe = {
25
+ const Ne = {
29
26
  email: !0,
30
27
  google: !0,
31
28
  apple: !0,
@@ -33,32 +30,32 @@ const Pe = {
33
30
  webauthn: !0,
34
31
  instantLink: !0
35
32
  };
36
- function Ne(e, A, t) {
37
- const [i, r] = F(null), [n, o] = F(), [a, C] = F(), [s, p] = F(), [y, Q] = F(), [m, U] = F(), [c, B] = F(), [u, b] = F(A), k = N(!1);
38
- return x(() => {
33
+ function Ye(e, A, t) {
34
+ const [i, r] = F(null), [n, s] = F(), [l, h] = F(), [o, p] = F(), [y, Q] = F(), [m, U] = F(), [c, B] = F(), [u, b] = F(A), k = N(!1);
35
+ return P(() => {
39
36
  if (!A || k.current) return;
40
- k.current = !0, new pe({
37
+ k.current = !0, new ye({
41
38
  baseUrl: e,
42
39
  timeoutMs: t ?? 5e3,
43
40
  retryAttempts: 1
44
- }).get("/features", { credentials: "omit" }).then((h) => {
41
+ }).get("/features", { credentials: "omit" }).then((C) => {
45
42
  r({
46
- email: h.email,
47
- google: h.google,
48
- apple: h.apple,
49
- solana: h.solana,
50
- webauthn: h.webauthn,
51
- instantLink: h.instantLink
52
- }), o(h.googleClientId), C(h.appleClientId), p(h.usernameEnabled), Q(h.walletEnrollEnabled), U(h.showRecoveryEnabled), B(h.socialButtonOrder);
43
+ email: C.email,
44
+ google: C.google,
45
+ apple: C.apple,
46
+ solana: C.solana,
47
+ webauthn: C.webauthn,
48
+ instantLink: C.instantLink
49
+ }), s(C.googleClientId), h(C.appleClientId), p(C.usernameEnabled), Q(C.walletEnrollEnabled), U(C.showRecoveryEnabled), B(C.socialButtonOrder);
53
50
  }).catch(() => {
54
- r(Pe);
51
+ r(Ne);
55
52
  }).finally(() => {
56
53
  b(!1);
57
54
  });
58
- }, [A, e, t]), { features: i, googleClientId: n, appleClientId: a, usernameEnabled: s, walletEnrollEnabled: y, showRecoveryEnabled: m, socialButtonOrder: c, isLoading: u };
55
+ }, [A, e, t]), { features: i, googleClientId: n, appleClientId: l, usernameEnabled: o, walletEnrollEnabled: y, showRecoveryEnabled: m, socialButtonOrder: c, isLoading: u };
59
56
  }
60
- const Ye = "cedros_tokens", Oe = 6e4;
61
- class xe {
57
+ const Oe = "cedros_tokens", Pe = 6e4;
58
+ class ve {
62
59
  storage;
63
60
  requestedStorage;
64
61
  storageKey;
@@ -73,7 +70,7 @@ class xe {
73
70
  // S-13: Prevent onSessionExpired from firing multiple times
74
71
  sessionExpiredFired = !1;
75
72
  allowWebStorage;
76
- constructor(A = "cookie", t = Ye, i = {}) {
73
+ constructor(A = "cookie", t = Oe, i = {}) {
77
74
  this.requestedStorage = A, this.storage = A, this.storageKey = t, this.allowWebStorage = i.allowWebStorage ?? !1, this.warnIfLocalStorage(), !this.allowWebStorage && (this.requestedStorage === "localStorage" || this.requestedStorage === "sessionStorage") && (this.storage = "memory"), this.loadFromStorage();
78
75
  }
79
76
  /**
@@ -165,7 +162,7 @@ class xe {
165
162
  }
166
163
  scheduleRefresh() {
167
164
  if (this.cancelRefresh(), !this.tokens || !this.onRefreshNeeded) return;
168
- const A = this.getTimeUntilExpiry(), t = Math.max(0, A - Oe);
165
+ const A = this.getTimeUntilExpiry(), t = Math.max(0, A - Pe);
169
166
  if (t <= 0) {
170
167
  if (this.isDestroyed) return;
171
168
  this.onRefreshNeeded().catch((i) => {
@@ -237,13 +234,13 @@ class xe {
237
234
  }
238
235
  }
239
236
  }
240
- const ve = "cedros_auth_sync";
237
+ const xe = "cedros_auth_sync";
241
238
  class Te {
242
239
  channel = null;
243
240
  callback = null;
244
241
  boundHandler = null;
245
242
  constructor() {
246
- typeof window < "u" && "BroadcastChannel" in window && (this.channel = new BroadcastChannel(ve), this.boundHandler = this.handleMessage.bind(this), this.channel.addEventListener("message", this.boundHandler));
243
+ typeof window < "u" && "BroadcastChannel" in window && (this.channel = new BroadcastChannel(xe), this.boundHandler = this.handleMessage.bind(this), this.channel.addEventListener("message", this.boundHandler));
247
244
  }
248
245
  /**
249
246
  * Handle incoming sync messages.
@@ -292,7 +289,7 @@ class Te {
292
289
  this.channel && (this.boundHandler && (this.channel.removeEventListener("message", this.boundHandler), this.boundHandler = null), this.channel.close(), this.channel = null), this.callback = null;
293
290
  }
294
291
  }
295
- function _(e) {
292
+ function ee(e) {
296
293
  if (typeof e != "object" || e === null) return !1;
297
294
  const A = e;
298
295
  if (typeof A.user != "object" || A.user === null) return !1;
@@ -310,18 +307,18 @@ function Le({
310
307
  callbacks: t,
311
308
  requestTimeoutMs: i
312
309
  }) {
313
- const [r, n] = F(null), [o, a] = F("idle"), C = N(null), s = N(null), p = N(t), y = N(!0), Q = N(null), m = N(() => Promise.resolve()), U = N(() => {
310
+ const [r, n] = F(null), [s, l] = F("idle"), h = N(null), o = N(null), p = N(t), y = N(!0), Q = N(null), m = N(() => Promise.resolve()), U = N(() => {
314
311
  });
315
- x(() => {
312
+ P(() => {
316
313
  p.current = t;
317
- }, [t]), x(() => (y.current = !0, () => {
314
+ }, [t]), P(() => (y.current = !0, () => {
318
315
  y.current = !1;
319
316
  }), []);
320
- const c = d((f) => {
317
+ const c = E((f) => {
321
318
  y.current && n(f);
322
- }, []), B = d((f) => {
323
- y.current && a(f);
324
- }, []), u = Y(
319
+ }, []), B = E((f) => {
320
+ y.current && l(f);
321
+ }, []), u = M(
325
322
  () => ({
326
323
  storage: A?.storage ?? "cookie",
327
324
  autoRefresh: A?.autoRefresh ?? !0,
@@ -337,12 +334,12 @@ function Le({
337
334
  A?.allowWebStorage
338
335
  ]
339
336
  );
340
- x(() => {
341
- const f = new xe(u.storage, u.persistKey, {
337
+ P(() => {
338
+ const f = new ve(u.storage, u.persistKey, {
342
339
  allowWebStorage: u.allowWebStorage
343
340
  });
344
- return C.current = f, u.autoRefresh && f.setRefreshCallback(() => m.current()), f.setSessionExpiredCallback(() => U.current()), u.syncTabs && (s.current = new Te()), () => {
345
- f.destroy(), C.current = null, s.current?.close();
341
+ return h.current = f, u.autoRefresh && f.setRefreshCallback(() => m.current()), f.setSessionExpiredCallback(() => U.current()), u.syncTabs && (o.current = new Te()), () => {
342
+ f.destroy(), h.current = null, o.current?.close();
346
343
  };
347
344
  }, [
348
345
  u.storage,
@@ -351,62 +348,62 @@ function Le({
351
348
  u.allowWebStorage,
352
349
  u.autoRefresh
353
350
  ]);
354
- const b = d(async () => {
351
+ const b = E(async () => {
355
352
  if (Q.current)
356
353
  return Q.current;
357
- const f = C.current?.getRefreshToken(), S = !!f, G = re(), H = {};
354
+ const f = h.current?.getRefreshToken(), S = !!f, G = oe(), H = {};
358
355
  S && (H["Content-Type"] = "application/json"), G && (H["X-CSRF-Token"] = G);
359
356
  let K, J;
360
- const V = new Promise((M, L) => {
361
- K = M, J = L;
357
+ const Y = new Promise((R, j) => {
358
+ K = R, J = j;
362
359
  });
363
- Q.current = V, (async () => {
364
- const M = new AbortController(), L = i ?? 1e4, Ge = window.setTimeout(() => M.abort(), L);
360
+ Q.current = Y, (async () => {
361
+ const R = new AbortController(), j = i ?? 1e4, v = window.setTimeout(() => R.abort(), j);
365
362
  try {
366
- const W = await fetch(`${e}/refresh`, {
363
+ const L = await fetch(`${e}/refresh`, {
367
364
  method: "POST",
368
365
  headers: Object.keys(H).length > 0 ? H : void 0,
369
366
  credentials: "include",
370
367
  body: S ? JSON.stringify({ refreshToken: f }) : void 0,
371
- signal: M.signal
368
+ signal: R.signal
372
369
  });
373
- if (!W.ok)
370
+ if (!L.ok)
374
371
  throw new Error("Token refresh failed");
375
- const te = await W.json();
376
- if (te.tokens) {
377
- if (!Re(te.tokens))
372
+ const ne = await L.json();
373
+ if (ne.tokens) {
374
+ if (!Re(ne.tokens))
378
375
  throw new Error("Invalid token response structure");
379
- C.current?.setTokens(te.tokens);
376
+ h.current?.setTokens(ne.tokens);
380
377
  } else if (u.storage !== "cookie")
381
378
  throw new Error("Token refresh failed");
382
- s.current?.broadcastRefresh(), K();
383
- } catch (W) {
384
- throw J(W), W;
379
+ o.current?.broadcastRefresh(), K();
380
+ } catch (L) {
381
+ throw J(L), L;
385
382
  } finally {
386
- window.clearTimeout(Ge);
383
+ window.clearTimeout(v);
387
384
  }
388
385
  })().catch(() => {
389
386
  });
390
387
  try {
391
- await V;
388
+ await Y;
392
389
  } finally {
393
390
  Q.current = null;
394
391
  }
395
- }, [e, u.storage, i]), k = d(() => {
392
+ }, [e, u.storage, i]), k = E(() => {
396
393
  if (u.storage === "cookie") return;
397
- const f = C.current?.getAccessToken();
394
+ const f = h.current?.getAccessToken();
398
395
  if (f)
399
396
  return { Authorization: `Bearer ${f}` };
400
- }, [u.storage]), E = d(() => {
401
- C.current?.clear(), c(null), B("unauthenticated"), p.current?.onSessionExpired?.();
397
+ }, [u.storage]), d = E(() => {
398
+ h.current?.clear(), c(null), B("unauthenticated"), p.current?.onSessionExpired?.();
402
399
  }, [B, c]);
403
- m.current = b, U.current = E;
404
- const h = d(
400
+ m.current = b, U.current = d;
401
+ const C = E(
405
402
  (f) => {
406
403
  const S = new AbortController(), G = i ?? 1e4, H = window.setTimeout(() => S.abort(), G), K = {}, J = k();
407
404
  J && Object.assign(K, J);
408
- const V = re();
409
- return V && (K["X-CSRF-Token"] = V), {
405
+ const Y = oe();
406
+ return Y && (K["X-CSRF-Token"] = Y), {
410
407
  promise: fetch(f, {
411
408
  credentials: "include",
412
409
  headers: Object.keys(K).length > 0 ? K : void 0,
@@ -416,13 +413,13 @@ function Le({
416
413
  };
417
414
  },
418
415
  [k, i]
419
- ), g = d(async () => {
420
- const f = h(`${e}/user`);
416
+ ), a = E(async () => {
417
+ const f = C(`${e}/user`);
421
418
  try {
422
419
  const S = await f.promise;
423
420
  if (S.ok) {
424
421
  const G = await S.json();
425
- if (_(G)) {
422
+ if (ee(G)) {
426
423
  c(G.user), B("authenticated");
427
424
  return;
428
425
  }
@@ -431,15 +428,15 @@ function Le({
431
428
  try {
432
429
  await b();
433
430
  } catch {
434
- E();
431
+ d();
435
432
  return;
436
433
  }
437
- const G = h(`${e}/user`);
434
+ const G = C(`${e}/user`);
438
435
  try {
439
436
  const H = await G.promise;
440
437
  if (H.ok) {
441
438
  const K = await H.json();
442
- if (_(K)) {
439
+ if (ee(K)) {
443
440
  c(K.user), B("authenticated");
444
441
  return;
445
442
  }
@@ -458,28 +455,28 @@ function Le({
458
455
  e,
459
456
  u.autoRefresh,
460
457
  b,
461
- h,
462
- E,
458
+ C,
459
+ d,
463
460
  B,
464
461
  c
465
462
  ]);
466
- x(() => {
467
- !s.current || !u.syncTabs || s.current.setCallback((f) => {
463
+ P(() => {
464
+ !o.current || !u.syncTabs || o.current.setCallback((f) => {
468
465
  switch (f.type) {
469
466
  case "login":
470
467
  c(f.user), B("authenticated");
471
468
  break;
472
469
  case "logout":
473
- c(null), B("unauthenticated"), C.current?.clear();
470
+ c(null), B("unauthenticated"), h.current?.clear();
474
471
  break;
475
472
  case "refresh":
476
- g();
473
+ a();
477
474
  break;
478
475
  default:
479
476
  console.warn("[Cedros Login] Unhandled tab sync event:", f);
480
477
  }
481
478
  });
482
- }, [u.syncTabs, g, B, c]), x(() => {
479
+ }, [u.syncTabs, a, B, c]), P(() => {
483
480
  const f = new AbortController(), S = i ?? 1e4, G = window.setTimeout(() => f.abort(), S);
484
481
  return (async () => {
485
482
  B("loading");
@@ -491,7 +488,7 @@ function Le({
491
488
  });
492
489
  if (K.ok) {
493
490
  const J = await K.json();
494
- if (_(J)) {
491
+ if (ee(J)) {
495
492
  c(J.user), B("authenticated");
496
493
  return;
497
494
  }
@@ -500,7 +497,7 @@ function Le({
500
497
  try {
501
498
  await b();
502
499
  } catch {
503
- E();
500
+ d();
504
501
  return;
505
502
  }
506
503
  const J = await fetch(`${e}/user`, {
@@ -509,9 +506,9 @@ function Le({
509
506
  signal: f.signal
510
507
  });
511
508
  if (J.ok) {
512
- const V = await J.json();
513
- if (_(V)) {
514
- c(V.user), B("authenticated");
509
+ const Y = await J.json();
510
+ if (ee(Y)) {
511
+ c(Y.user), B("authenticated");
515
512
  return;
516
513
  }
517
514
  }
@@ -528,18 +525,18 @@ function Le({
528
525
  u.autoRefresh,
529
526
  b,
530
527
  k,
531
- E,
528
+ d,
532
529
  B,
533
530
  c,
534
531
  i
535
532
  ]);
536
- const I = d(
533
+ const I = E(
537
534
  (f, S) => {
538
- c(f), B("authenticated"), S && C.current?.setTokens(S), y.current && s.current?.broadcastLogin(f);
535
+ c(f), B("authenticated"), S && h.current?.setTokens(S), y.current && o.current?.broadcastLogin(f);
539
536
  },
540
537
  [c, B]
541
- ), l = d(async () => {
542
- const f = re(), S = new AbortController(), G = i ?? 1e4, H = window.setTimeout(() => S.abort(), G);
538
+ ), g = E(async () => {
539
+ const f = oe(), S = new AbortController(), G = i ?? 1e4, H = window.setTimeout(() => S.abort(), G);
543
540
  try {
544
541
  await fetch(`${e}/logout`, {
545
542
  method: "POST",
@@ -552,15 +549,15 @@ function Le({
552
549
  });
553
550
  } catch {
554
551
  } finally {
555
- window.clearTimeout(H), c(null), B("unauthenticated"), C.current?.clear(), s.current?.broadcastLogout(), p.current?.onLogout?.();
552
+ window.clearTimeout(H), c(null), B("unauthenticated"), h.current?.clear(), o.current?.broadcastLogout(), p.current?.onLogout?.();
556
553
  }
557
- }, [e, k, c, B, i]), w = d(() => C.current?.getAccessToken() ?? null, []);
554
+ }, [e, k, c, B, i]), w = E(() => h.current?.getAccessToken() ?? null, []);
558
555
  return {
559
556
  user: r,
560
- authState: o,
557
+ authState: s,
561
558
  handleLoginSuccess: I,
562
- logout: l,
563
- refreshUser: g,
559
+ logout: g,
560
+ refreshUser: a,
564
561
  getAccessToken: w
565
562
  };
566
563
  }
@@ -601,7 +598,7 @@ function qA(e) {
601
598
  throw new Error(`Invalid share length: expected >=16, got ${e.length}`);
602
599
  return e;
603
600
  }
604
- function Se(e) {
601
+ function De(e) {
605
602
  if (!Ze(e))
606
603
  throw new Error(`Invalid key length: expected 32, got ${e.length}`);
607
604
  return e;
@@ -621,10 +618,10 @@ function tA(e) {
621
618
  throw new Error(`Invalid PRF salt length: expected 32, got ${e.length}`);
622
619
  return e;
623
620
  }
624
- function X(e) {
621
+ function W(e) {
625
622
  return new Uint8Array(e);
626
623
  }
627
- function ee(e) {
624
+ function ie(e) {
628
625
  if (typeof crypto > "u" || !crypto.getRandomValues)
629
626
  throw new Error(
630
627
  "WebCrypto API not available. Secure random generation requires a modern browser."
@@ -633,18 +630,18 @@ function ee(e) {
633
630
  return crypto.getRandomValues(A), A;
634
631
  }
635
632
  function _A() {
636
- return ze(ee(16));
633
+ return ze(ie(16));
637
634
  }
638
635
  function iA() {
639
- return eA(ee(12));
636
+ return eA(ie(12));
640
637
  }
641
638
  function $A() {
642
- return AA(ee(16));
639
+ return AA(ie(16));
643
640
  }
644
641
  function zA() {
645
- return tA(ee(32));
642
+ return tA(ie(32));
646
643
  }
647
- function De(e) {
644
+ function Fe(e) {
648
645
  if (!(!e || e.length === 0)) {
649
646
  if (typeof globalThis.crypto?.getRandomValues == "function")
650
647
  globalThis.crypto.getRandomValues(e);
@@ -656,12 +653,12 @@ function De(e) {
656
653
  }
657
654
  function et(...e) {
658
655
  for (const A of e)
659
- A && De(A);
656
+ A && Fe(A);
660
657
  }
661
658
  async function rA(e) {
662
659
  return crypto.subtle.importKey(
663
660
  "raw",
664
- X(e),
661
+ W(e),
665
662
  { name: "AES-GCM", length: 256 },
666
663
  !1,
667
664
  // not extractable
@@ -670,9 +667,9 @@ async function rA(e) {
670
667
  }
671
668
  async function nA(e, A, t) {
672
669
  const i = t ?? iA(), r = await rA(A), n = await crypto.subtle.encrypt(
673
- { name: "AES-GCM", iv: X(i) },
670
+ { name: "AES-GCM", iv: W(i) },
674
671
  r,
675
- X(e)
672
+ W(e)
676
673
  );
677
674
  return {
678
675
  ciphertext: new Uint8Array(n),
@@ -682,11 +679,11 @@ async function nA(e, A, t) {
682
679
  async function At(e, A) {
683
680
  const t = await nA(e, A);
684
681
  return {
685
- ciphertext: ue(t.ciphertext),
686
- nonce: ue(t.nonce)
682
+ ciphertext: we(t.ciphertext),
683
+ nonce: we(t.nonce)
687
684
  };
688
685
  }
689
- function ue(e) {
686
+ function we(e) {
690
687
  const t = [];
691
688
  for (let i = 0; i < e.length; i += 32768) {
692
689
  const r = e.subarray(i, Math.min(i + 32768, e.length));
@@ -709,27 +706,27 @@ function oA(e) {
709
706
  async function sA(e, A, t, i = 32) {
710
707
  const r = await crypto.subtle.importKey(
711
708
  "raw",
712
- X(e),
709
+ W(e),
713
710
  "HKDF",
714
711
  !1,
715
712
  ["deriveBits"]
716
- ), n = new TextEncoder().encode(t), o = await crypto.subtle.deriveBits(
713
+ ), n = new TextEncoder().encode(t), s = await crypto.subtle.deriveBits(
717
714
  {
718
715
  name: "HKDF",
719
716
  hash: "SHA-256",
720
- salt: X(A ?? new Uint8Array(32)),
717
+ salt: W(A ?? new Uint8Array(32)),
721
718
  // Zero salt if not provided
722
- info: X(n)
719
+ info: W(n)
723
720
  },
724
721
  r,
725
722
  i * 8
726
723
  // bits
727
724
  );
728
- return new Uint8Array(o);
725
+ return new Uint8Array(s);
729
726
  }
730
727
  async function tt(e, A) {
731
728
  const t = await sA(e, A, "cedros-wallet-share-b-encryption", 32);
732
- return Se(t);
729
+ return De(t);
733
730
  }
734
731
  async function IA() {
735
732
  try {
@@ -750,31 +747,31 @@ async function IA() {
750
747
  return !1;
751
748
  }
752
749
  }
753
- function R(e, A, t, i) {
750
+ function X(e, A, t, i) {
754
751
  function r(n) {
755
- return n instanceof t ? n : new t(function(o) {
756
- o(n);
752
+ return n instanceof t ? n : new t(function(s) {
753
+ s(n);
757
754
  });
758
755
  }
759
- return new (t || (t = Promise))(function(n, o) {
760
- function a(p) {
756
+ return new (t || (t = Promise))(function(n, s) {
757
+ function l(p) {
761
758
  try {
762
- s(i.next(p));
759
+ o(i.next(p));
763
760
  } catch (y) {
764
- o(y);
761
+ s(y);
765
762
  }
766
763
  }
767
- function C(p) {
764
+ function h(p) {
768
765
  try {
769
- s(i.throw(p));
766
+ o(i.throw(p));
770
767
  } catch (y) {
771
- o(y);
768
+ s(y);
772
769
  }
773
770
  }
774
- function s(p) {
775
- p.done ? n(p.value) : r(p.value).then(a, C);
771
+ function o(p) {
772
+ p.done ? n(p.value) : r(p.value).then(l, h);
776
773
  }
777
- s((i = i.apply(e, [])).next());
774
+ o((i = i.apply(e, [])).next());
778
775
  });
779
776
  }
780
777
  class D {
@@ -789,7 +786,7 @@ class D {
789
786
  });
790
787
  }
791
788
  dispatch(A) {
792
- return R(this, void 0, void 0, function* () {
789
+ return X(this, void 0, void 0, function* () {
793
790
  const t = yield this.lock();
794
791
  try {
795
792
  return yield Promise.resolve(A());
@@ -799,19 +796,19 @@ class D {
799
796
  });
800
797
  }
801
798
  }
802
- var ne;
799
+ var se;
803
800
  function aA() {
804
801
  return typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global;
805
802
  }
806
- const le = aA(), oe = (ne = le.Buffer) !== null && ne !== void 0 ? ne : null, gA = le.TextEncoder ? new le.TextEncoder() : null;
807
- function Fe(e, A) {
803
+ const Ce = aA(), Ie = (se = Ce.Buffer) !== null && se !== void 0 ? se : null, gA = Ce.TextEncoder ? new Ce.TextEncoder() : null;
804
+ function Ue(e, A) {
808
805
  return (e & 15) + (e >> 6 | e >> 3 & 8) << 4 | (A & 15) + (A >> 6 | A >> 3 & 8);
809
806
  }
810
- function Ue(e, A) {
807
+ function me(e, A) {
811
808
  const t = A.length >> 1;
812
809
  for (let i = 0; i < t; i++) {
813
810
  const r = i << 1;
814
- e[i] = Fe(A.charCodeAt(r), A.charCodeAt(r + 1));
811
+ e[i] = Ue(A.charCodeAt(r), A.charCodeAt(r + 1));
815
812
  }
816
813
  }
817
814
  function lA(e, A) {
@@ -819,26 +816,26 @@ function lA(e, A) {
819
816
  return !1;
820
817
  for (let t = 0; t < A.length; t++) {
821
818
  const i = t << 1;
822
- if (A[t] !== Fe(e.charCodeAt(i), e.charCodeAt(i + 1)))
819
+ if (A[t] !== Ue(e.charCodeAt(i), e.charCodeAt(i + 1)))
823
820
  return !1;
824
821
  }
825
822
  return !0;
826
823
  }
827
- const we = 87, Qe = 48;
828
- function ce(e, A, t) {
824
+ const Qe = 87, Be = 48;
825
+ function he(e, A, t) {
829
826
  let i = 0;
830
827
  for (let r = 0; r < t; r++) {
831
828
  let n = A[r] >>> 4;
832
- e[i++] = n > 9 ? n + we : n + Qe, n = A[r] & 15, e[i++] = n > 9 ? n + we : n + Qe;
829
+ e[i++] = n > 9 ? n + Qe : n + Be, n = A[r] & 15, e[i++] = n > 9 ? n + Qe : n + Be;
833
830
  }
834
831
  return String.fromCharCode.apply(null, e);
835
832
  }
836
- const T = oe !== null ? (e) => {
833
+ const T = Ie !== null ? (e) => {
837
834
  if (typeof e == "string") {
838
- const A = oe.from(e, "utf8");
835
+ const A = Ie.from(e, "utf8");
839
836
  return new Uint8Array(A.buffer, A.byteOffset, A.length);
840
837
  }
841
- if (oe.isBuffer(e))
838
+ if (Ie.isBuffer(e))
842
839
  return new Uint8Array(e.buffer, e.byteOffset, e.length);
843
840
  if (ArrayBuffer.isView(e))
844
841
  return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
@@ -849,21 +846,21 @@ const T = oe !== null ? (e) => {
849
846
  if (ArrayBuffer.isView(e))
850
847
  return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
851
848
  throw new Error("Invalid data type!");
852
- }, O = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Z = new Uint8Array(256);
849
+ }, O = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", q = new Uint8Array(256);
853
850
  for (let e = 0; e < O.length; e++)
854
- Z[O.charCodeAt(e)] = e;
855
- function Be(e, A = !0) {
851
+ q[O.charCodeAt(e)] = e;
852
+ function de(e, A = !0) {
856
853
  const t = e.length, i = t % 3, r = [], n = t - i;
857
- for (let o = 0; o < n; o += 3) {
858
- const a = (e[o] << 16 & 16711680) + (e[o + 1] << 8 & 65280) + (e[o + 2] & 255), C = O.charAt(a >> 18 & 63) + O.charAt(a >> 12 & 63) + O.charAt(a >> 6 & 63) + O.charAt(a & 63);
859
- r.push(C);
854
+ for (let s = 0; s < n; s += 3) {
855
+ const l = (e[s] << 16 & 16711680) + (e[s + 1] << 8 & 65280) + (e[s + 2] & 255), h = O.charAt(l >> 18 & 63) + O.charAt(l >> 12 & 63) + O.charAt(l >> 6 & 63) + O.charAt(l & 63);
856
+ r.push(h);
860
857
  }
861
858
  if (i === 1) {
862
- const o = e[t - 1], a = O.charAt(o >> 2), C = O.charAt(o << 4 & 63);
863
- r.push(`${a}${C}`), A && r.push("==");
859
+ const s = e[t - 1], l = O.charAt(s >> 2), h = O.charAt(s << 4 & 63);
860
+ r.push(`${l}${h}`), A && r.push("==");
864
861
  } else if (i === 2) {
865
- const o = (e[t - 2] << 8) + e[t - 1], a = O.charAt(o >> 10), C = O.charAt(o >> 4 & 63), s = O.charAt(o << 2 & 63);
866
- r.push(`${a}${C}${s}`), A && r.push("=");
862
+ const s = (e[t - 2] << 8) + e[t - 1], l = O.charAt(s >> 10), h = O.charAt(s >> 4 & 63), o = O.charAt(s << 2 & 63);
863
+ r.push(`${l}${h}${o}`), A && r.push("=");
867
864
  }
868
865
  return r.join("");
869
866
  }
@@ -876,30 +873,30 @@ function CA(e) {
876
873
  const A = cA(e), t = e.length, i = new Uint8Array(A);
877
874
  let r = 0;
878
875
  for (let n = 0; n < t; n += 4) {
879
- const o = Z[e.charCodeAt(n)], a = Z[e.charCodeAt(n + 1)], C = Z[e.charCodeAt(n + 2)], s = Z[e.charCodeAt(n + 3)];
880
- i[r] = o << 2 | a >> 4, r += 1, i[r] = (a & 15) << 4 | C >> 2, r += 1, i[r] = (C & 3) << 6 | s & 63, r += 1;
876
+ const s = q[e.charCodeAt(n)], l = q[e.charCodeAt(n + 1)], h = q[e.charCodeAt(n + 2)], o = q[e.charCodeAt(n + 3)];
877
+ i[r] = s << 2 | l >> 4, r += 1, i[r] = (l & 15) << 4 | h >> 2, r += 1, i[r] = (h & 3) << 6 | o & 63, r += 1;
881
878
  }
882
879
  return i;
883
880
  }
884
- const $ = 16 * 1024, j = 4, hA = new D(), se = /* @__PURE__ */ new Map();
885
- function me(e, A) {
886
- return R(this, void 0, void 0, function* () {
881
+ const Ae = 16 * 1024, Z = 4, hA = new D(), ae = /* @__PURE__ */ new Map();
882
+ function be(e, A) {
883
+ return X(this, void 0, void 0, function* () {
887
884
  let t = null, i = null, r = !1;
888
885
  if (typeof WebAssembly > "u")
889
886
  throw new Error("WebAssembly is not supported in this environment!");
890
- const n = (g, I = 0) => {
891
- i.set(g, I);
892
- }, o = () => i, a = () => t.exports, C = (g) => {
893
- t.exports.Hash_SetMemorySize(g);
894
- const I = t.exports.Hash_GetBuffer(), l = t.exports.memory.buffer;
895
- i = new Uint8Array(l, I, g);
896
- }, s = () => new DataView(t.exports.memory.buffer).getUint32(t.exports.STATE_SIZE, !0), p = hA.dispatch(() => R(this, void 0, void 0, function* () {
897
- if (!se.has(e.name)) {
898
- const I = CA(e.data), l = WebAssembly.compile(I);
899
- se.set(e.name, l);
887
+ const n = (a, I = 0) => {
888
+ i.set(a, I);
889
+ }, s = () => i, l = () => t.exports, h = (a) => {
890
+ t.exports.Hash_SetMemorySize(a);
891
+ const I = t.exports.Hash_GetBuffer(), g = t.exports.memory.buffer;
892
+ i = new Uint8Array(g, I, a);
893
+ }, o = () => new DataView(t.exports.memory.buffer).getUint32(t.exports.STATE_SIZE, !0), p = hA.dispatch(() => X(this, void 0, void 0, function* () {
894
+ if (!ae.has(e.name)) {
895
+ const I = CA(e.data), g = WebAssembly.compile(I);
896
+ ae.set(e.name, g);
900
897
  }
901
- const g = yield se.get(e.name);
902
- t = yield WebAssembly.instantiate(g, {
898
+ const a = yield ae.get(e.name);
899
+ t = yield WebAssembly.instantiate(a, {
903
900
  // env: {
904
901
  // emscripten_memcpy_big: (dest, src, num) => {
905
902
  // const memoryBuffer = wasmInstance.exports.memory.buffer;
@@ -913,81 +910,81 @@ function me(e, A) {
913
910
  // },
914
911
  // },
915
912
  });
916
- })), y = () => R(this, void 0, void 0, function* () {
913
+ })), y = () => X(this, void 0, void 0, function* () {
917
914
  t || (yield p);
918
- const g = t.exports.Hash_GetBuffer(), I = t.exports.memory.buffer;
919
- i = new Uint8Array(I, g, $);
920
- }), Q = (g = null) => {
921
- r = !0, t.exports.Hash_Init(g);
922
- }, m = (g) => {
915
+ const a = t.exports.Hash_GetBuffer(), I = t.exports.memory.buffer;
916
+ i = new Uint8Array(I, a, Ae);
917
+ }), Q = (a = null) => {
918
+ r = !0, t.exports.Hash_Init(a);
919
+ }, m = (a) => {
923
920
  let I = 0;
924
- for (; I < g.length; ) {
925
- const l = g.subarray(I, I + $);
926
- I += l.length, i.set(l), t.exports.Hash_Update(l.length);
921
+ for (; I < a.length; ) {
922
+ const g = a.subarray(I, I + Ae);
923
+ I += g.length, i.set(g), t.exports.Hash_Update(g.length);
927
924
  }
928
- }, U = (g) => {
925
+ }, U = (a) => {
929
926
  if (!r)
930
927
  throw new Error("update() called before init()");
931
- const I = T(g);
928
+ const I = T(a);
932
929
  m(I);
933
- }, c = new Uint8Array(A * 2), B = (g, I = null) => {
930
+ }, c = new Uint8Array(A * 2), B = (a, I = null) => {
934
931
  if (!r)
935
932
  throw new Error("digest() called before init()");
936
- return r = !1, t.exports.Hash_Final(I), g === "binary" ? i.slice(0, A) : ce(c, i, A);
933
+ return r = !1, t.exports.Hash_Final(I), a === "binary" ? i.slice(0, A) : he(c, i, A);
937
934
  }, u = () => {
938
935
  if (!r)
939
936
  throw new Error("save() can only be called after init() and before digest()");
940
- const g = t.exports.Hash_GetState(), I = s(), l = t.exports.memory.buffer, w = new Uint8Array(l, g, I), f = new Uint8Array(j + I);
941
- return Ue(f, e.hash), f.set(w, j), f;
942
- }, b = (g) => {
943
- if (!(g instanceof Uint8Array))
937
+ const a = t.exports.Hash_GetState(), I = o(), g = t.exports.memory.buffer, w = new Uint8Array(g, a, I), f = new Uint8Array(Z + I);
938
+ return me(f, e.hash), f.set(w, Z), f;
939
+ }, b = (a) => {
940
+ if (!(a instanceof Uint8Array))
944
941
  throw new Error("load() expects an Uint8Array generated by save()");
945
- const I = t.exports.Hash_GetState(), l = s(), w = j + l, f = t.exports.memory.buffer;
946
- if (g.length !== w)
947
- throw new Error(`Bad state length (expected ${w} bytes, got ${g.length})`);
948
- if (!lA(e.hash, g.subarray(0, j)))
942
+ const I = t.exports.Hash_GetState(), g = o(), w = Z + g, f = t.exports.memory.buffer;
943
+ if (a.length !== w)
944
+ throw new Error(`Bad state length (expected ${w} bytes, got ${a.length})`);
945
+ if (!lA(e.hash, a.subarray(0, Z)))
949
946
  throw new Error("This state was written by an incompatible hash implementation");
950
- const S = g.subarray(j);
951
- new Uint8Array(f, I, l).set(S), r = !0;
952
- }, k = (g) => typeof g == "string" ? g.length < $ / 4 : g.byteLength < $;
953
- let E = k;
947
+ const S = a.subarray(Z);
948
+ new Uint8Array(f, I, g).set(S), r = !0;
949
+ }, k = (a) => typeof a == "string" ? a.length < Ae / 4 : a.byteLength < Ae;
950
+ let d = k;
954
951
  switch (e.name) {
955
952
  case "argon2":
956
953
  case "scrypt":
957
- E = () => !0;
954
+ d = () => !0;
958
955
  break;
959
956
  case "blake2b":
960
957
  case "blake2s":
961
- E = (g, I) => I <= 512 && k(g);
958
+ d = (a, I) => I <= 512 && k(a);
962
959
  break;
963
960
  case "blake3":
964
- E = (g, I) => I === 0 && k(g);
961
+ d = (a, I) => I === 0 && k(a);
965
962
  break;
966
963
  case "xxhash64":
967
964
  // cannot simplify
968
965
  case "xxhash3":
969
966
  case "xxhash128":
970
967
  case "crc64":
971
- E = () => !1;
968
+ d = () => !1;
972
969
  break;
973
970
  }
974
- const h = (g, I = null, l = null) => {
975
- if (!E(g, I))
976
- return Q(I), U(g), B("hex", l);
977
- const w = T(g);
978
- return i.set(w), t.exports.Hash_Calculate(w.length, I, l), ce(c, i, A);
971
+ const C = (a, I = null, g = null) => {
972
+ if (!d(a, I))
973
+ return Q(I), U(a), B("hex", g);
974
+ const w = T(a);
975
+ return i.set(w), t.exports.Hash_Calculate(w.length, I, g), he(c, i, A);
979
976
  };
980
977
  return yield y(), {
981
- getMemory: o,
978
+ getMemory: s,
982
979
  writeMemory: n,
983
- getExports: a,
984
- setMemorySize: C,
980
+ getExports: l,
981
+ setMemorySize: h,
985
982
  init: Q,
986
983
  update: U,
987
984
  digest: B,
988
985
  save: u,
989
986
  load: b,
990
- calculate: h,
987
+ calculate: C,
991
988
  hashLength: A
992
989
  };
993
990
  });
@@ -1003,15 +1000,15 @@ var fA = "argon2", uA = "AGFzbQEAAAABKQVgAX8Bf2AAAX9gEH9/f39/f39/f39/f39/f38AYAR
1003
1000
  hash: EA
1004
1001
  };
1005
1002
  new D();
1006
- function de(e) {
1003
+ function Ee(e) {
1007
1004
  return !Number.isInteger(e) || e < 8 || e > 512 || e % 8 !== 0 ? new Error("Invalid variant! Valid values: 8, 16, ..., 512") : null;
1008
1005
  }
1009
1006
  function yA(e, A) {
1010
1007
  return e | A << 16;
1011
1008
  }
1012
- function Ce(e = 512, A = null) {
1013
- if (de(e))
1014
- return Promise.reject(de(e));
1009
+ function fe(e = 512, A = null) {
1010
+ if (Ee(e))
1011
+ return Promise.reject(Ee(e));
1015
1012
  let t = null, i = e;
1016
1013
  if (A !== null) {
1017
1014
  if (t = T(A), t.length > 64)
@@ -1019,19 +1016,19 @@ function Ce(e = 512, A = null) {
1019
1016
  i = yA(e, t.length);
1020
1017
  }
1021
1018
  const r = e / 8;
1022
- return me(pA, r).then((n) => {
1019
+ return be(pA, r).then((n) => {
1023
1020
  i > 512 && n.writeMemory(t), n.init(i);
1024
- const o = {
1025
- init: i > 512 ? () => (n.writeMemory(t), n.init(i), o) : () => (n.init(i), o),
1026
- update: (a) => (n.update(a), o),
1021
+ const s = {
1022
+ init: i > 512 ? () => (n.writeMemory(t), n.init(i), s) : () => (n.init(i), s),
1023
+ update: (l) => (n.update(l), s),
1027
1024
  // biome-ignore lint/suspicious/noExplicitAny: Conflict with IHasher type
1028
- digest: (a) => n.digest(a),
1025
+ digest: (l) => n.digest(l),
1029
1026
  save: () => n.save(),
1030
- load: (a) => (n.load(a), o),
1027
+ load: (l) => (n.load(l), s),
1031
1028
  blockSize: 128,
1032
1029
  digestSize: r
1033
1030
  };
1034
- return o;
1031
+ return s;
1035
1032
  });
1036
1033
  }
1037
1034
  function kA(e, A, t) {
@@ -1040,27 +1037,27 @@ function kA(e, A, t) {
1040
1037
  `t=${A.iterations}`,
1041
1038
  `p=${A.parallelism}`
1042
1039
  ].join(",");
1043
- return `$argon2${A.hashType}$v=19$${i}$${Be(e, !1)}$${Be(t, !1)}`;
1040
+ return `$argon2${A.hashType}$v=19$${i}$${de(e, !1)}$${de(t, !1)}`;
1044
1041
  }
1045
- const Ee = new DataView(new ArrayBuffer(4));
1046
- function v(e) {
1047
- return Ee.setInt32(0, e, !0), new Uint8Array(Ee.buffer);
1042
+ const pe = new DataView(new ArrayBuffer(4));
1043
+ function x(e) {
1044
+ return pe.setInt32(0, e, !0), new Uint8Array(pe.buffer);
1048
1045
  }
1049
- function Ie(e, A, t) {
1050
- return R(this, void 0, void 0, function* () {
1046
+ function ge(e, A, t) {
1047
+ return X(this, void 0, void 0, function* () {
1051
1048
  if (t <= 64) {
1052
- const C = yield Ce(t * 8);
1053
- return C.update(v(t)), C.update(A), C.digest("binary");
1049
+ const h = yield fe(t * 8);
1050
+ return h.update(x(t)), h.update(A), h.digest("binary");
1054
1051
  }
1055
1052
  const i = Math.ceil(t / 32) - 2, r = new Uint8Array(t);
1056
- e.init(), e.update(v(t)), e.update(A);
1053
+ e.init(), e.update(x(t)), e.update(A);
1057
1054
  let n = e.digest("binary");
1058
1055
  r.set(n.subarray(0, 32), 0);
1059
- for (let C = 1; C < i; C++)
1060
- e.init(), e.update(n), n = e.digest("binary"), r.set(n.subarray(0, 32), C * 32);
1061
- const o = t - 32 * i;
1062
- let a;
1063
- return o === 64 ? (a = e, a.init()) : a = yield Ce(o * 8), a.update(n), n = a.digest("binary"), r.set(n.subarray(0, o), i * 32), r;
1056
+ for (let h = 1; h < i; h++)
1057
+ e.init(), e.update(n), n = e.digest("binary"), r.set(n.subarray(0, 32), h * 32);
1058
+ const s = t - 32 * i;
1059
+ let l;
1060
+ return s === 64 ? (l = e, l.init()) : l = yield fe(s * 8), l.update(n), n = l.digest("binary"), r.set(n.subarray(0, s), i * 32), r;
1064
1061
  });
1065
1062
  }
1066
1063
  function SA(e) {
@@ -1074,30 +1071,30 @@ function SA(e) {
1074
1071
  }
1075
1072
  }
1076
1073
  function DA(e) {
1077
- return R(this, void 0, void 0, function* () {
1074
+ return X(this, void 0, void 0, function* () {
1078
1075
  var A;
1079
- const { parallelism: t, iterations: i, hashLength: r } = e, n = T(e.password), o = T(e.salt), a = 19, C = SA(e.hashType), { memorySize: s } = e, p = T((A = e.secret) !== null && A !== void 0 ? A : ""), [y, Q] = yield Promise.all([
1080
- me(QA, 1024),
1081
- Ce(512)
1076
+ const { parallelism: t, iterations: i, hashLength: r } = e, n = T(e.password), s = T(e.salt), l = 19, h = SA(e.hashType), { memorySize: o } = e, p = T((A = e.secret) !== null && A !== void 0 ? A : ""), [y, Q] = yield Promise.all([
1077
+ be(QA, 1024),
1078
+ fe(512)
1082
1079
  ]);
1083
- y.setMemorySize(s * 1024 + 1024);
1080
+ y.setMemorySize(o * 1024 + 1024);
1084
1081
  const m = new Uint8Array(24), U = new DataView(m.buffer);
1085
- U.setInt32(0, t, !0), U.setInt32(4, r, !0), U.setInt32(8, s, !0), U.setInt32(12, i, !0), U.setInt32(16, a, !0), U.setInt32(20, C, !0), y.writeMemory(m, s * 1024), Q.init(), Q.update(m), Q.update(v(n.length)), Q.update(n), Q.update(v(o.length)), Q.update(o), Q.update(v(p.length)), Q.update(p), Q.update(v(0));
1086
- const B = Math.floor(s / (t * 4)) * 4, u = new Uint8Array(72), b = Q.digest("binary");
1082
+ U.setInt32(0, t, !0), U.setInt32(4, r, !0), U.setInt32(8, o, !0), U.setInt32(12, i, !0), U.setInt32(16, l, !0), U.setInt32(20, h, !0), y.writeMemory(m, o * 1024), Q.init(), Q.update(m), Q.update(x(n.length)), Q.update(n), Q.update(x(s.length)), Q.update(s), Q.update(x(p.length)), Q.update(p), Q.update(x(0));
1083
+ const B = Math.floor(o / (t * 4)) * 4, u = new Uint8Array(72), b = Q.digest("binary");
1087
1084
  u.set(b);
1088
- for (let h = 0; h < t; h++) {
1089
- u.set(v(0), 64), u.set(v(h), 68);
1090
- let g = h * B, I = yield Ie(Q, u, 1024);
1091
- y.writeMemory(I, g * 1024), g += 1, u.set(v(1), 64), I = yield Ie(Q, u, 1024), y.writeMemory(I, g * 1024);
1085
+ for (let C = 0; C < t; C++) {
1086
+ u.set(x(0), 64), u.set(x(C), 68);
1087
+ let a = C * B, I = yield ge(Q, u, 1024);
1088
+ y.writeMemory(I, a * 1024), a += 1, u.set(x(1), 64), I = yield ge(Q, u, 1024), y.writeMemory(I, a * 1024);
1092
1089
  }
1093
1090
  const k = new Uint8Array(1024);
1094
- Ue(k, y.calculate(new Uint8Array([]), s));
1095
- const E = yield Ie(Q, k, r);
1091
+ me(k, y.calculate(new Uint8Array([]), o));
1092
+ const d = yield ge(Q, k, r);
1096
1093
  if (e.outputType === "hex") {
1097
- const h = new Uint8Array(r * 2);
1098
- return ce(h, E, r);
1094
+ const C = new Uint8Array(r * 2);
1095
+ return he(C, d, r);
1099
1096
  }
1100
- return e.outputType === "encoded" ? kA(o, e, E) : E;
1097
+ return e.outputType === "encoded" ? kA(s, e, d) : d;
1101
1098
  });
1102
1099
  }
1103
1100
  const FA = (e) => {
@@ -1125,8 +1122,8 @@ const FA = (e) => {
1125
1122
  if (e.outputType === void 0 && (e.outputType = "hex"), !["hex", "binary", "encoded"].includes(e.outputType))
1126
1123
  throw new Error(`Insupported output type ${e.outputType}. Valid values: ['hex', 'binary', 'encoded']`);
1127
1124
  };
1128
- function be(e) {
1129
- return R(this, void 0, void 0, function* () {
1125
+ function Ge(e) {
1126
+ return X(this, void 0, void 0, function* () {
1130
1127
  return FA(e), DA(Object.assign(Object.assign({}, e), { hashType: "id" }));
1131
1128
  });
1132
1129
  }
@@ -1154,7 +1151,7 @@ const UA = 32;
1154
1151
  async function it(e, A, t = Xe) {
1155
1152
  mA(t);
1156
1153
  try {
1157
- const i = await be({
1154
+ const i = await Ge({
1158
1155
  password: e,
1159
1156
  salt: A,
1160
1157
  iterations: t.tCost,
@@ -1163,7 +1160,7 @@ async function it(e, A, t = Xe) {
1163
1160
  hashLength: UA,
1164
1161
  outputType: "binary"
1165
1162
  });
1166
- return Se(i);
1163
+ return De(i);
1167
1164
  } catch {
1168
1165
  throw new Error("Key derivation failed");
1169
1166
  }
@@ -1184,7 +1181,7 @@ function mA(e) {
1184
1181
  }
1185
1182
  async function bA() {
1186
1183
  try {
1187
- const e = await be({
1184
+ const e = await Ge({
1188
1185
  password: "test",
1189
1186
  salt: new Uint8Array(16),
1190
1187
  iterations: 1,
@@ -1194,7 +1191,7 @@ async function bA() {
1194
1191
  hashLength: 32,
1195
1192
  outputType: "binary"
1196
1193
  });
1197
- return e.length !== 32 ? !1 : (De(e), !0);
1194
+ return e.length !== 32 ? !1 : (Fe(e), !0);
1198
1195
  } catch {
1199
1196
  return !1;
1200
1197
  }
@@ -1211,11 +1208,11 @@ function KA(e) {
1211
1208
  "[Cedros] WebAuthn RP domain validation is not configured. Set wallet.allowedRpDomains to a non-empty list of allowed domains."
1212
1209
  );
1213
1210
  }
1214
- function he() {
1211
+ function ue() {
1215
1212
  return typeof window < "u" && typeof window.PublicKeyCredential < "u" && typeof navigator.credentials < "u";
1216
1213
  }
1217
1214
  async function HA() {
1218
- if (!he())
1215
+ if (!ue())
1219
1216
  return !1;
1220
1217
  try {
1221
1218
  if (!await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())
@@ -1231,7 +1228,7 @@ async function HA() {
1231
1228
  }
1232
1229
  }
1233
1230
  async function rt(e, A) {
1234
- if (!he())
1231
+ if (!ue())
1235
1232
  throw new Error("WebAuthn is not available in this browser");
1236
1233
  KA();
1237
1234
  const t = oA(e), i = await navigator.credentials.get({
@@ -1256,20 +1253,20 @@ async function rt(e, A) {
1256
1253
  const n = i.getClientExtensionResults().prf?.results?.first;
1257
1254
  if (!n)
1258
1255
  throw new Error("PRF extension did not return a result during authentication");
1259
- const o = new Uint8Array(n);
1260
- if (o.length !== 32)
1256
+ const s = new Uint8Array(n);
1257
+ if (s.length !== 32)
1261
1258
  throw new Error(
1262
- `Unexpected PRF output length: expected 32 bytes, got ${o.length}. The authenticator may not be compatible.`
1259
+ `Unexpected PRF output length: expected 32 bytes, got ${s.length}. The authenticator may not be compatible.`
1263
1260
  );
1264
- return { prfOutput: o };
1261
+ return { prfOutput: s };
1265
1262
  }
1266
1263
  async function JA() {
1267
- const [e, A, t, i, r, n, o] = await Promise.all([
1264
+ const [e, A, t, i, r, n, s] = await Promise.all([
1268
1265
  MA(),
1269
1266
  VA(),
1270
1267
  IA(),
1271
- PA(),
1272
- Promise.resolve(he()),
1268
+ NA(),
1269
+ Promise.resolve(ue()),
1273
1270
  HA(),
1274
1271
  bA()
1275
1272
  ]);
@@ -1280,8 +1277,8 @@ async function JA() {
1280
1277
  ed25519: i,
1281
1278
  webAuthn: r,
1282
1279
  webAuthnPrf: n,
1283
- argon2: o,
1284
- allSupported: e && A && t && r && n && o
1280
+ argon2: s,
1281
+ allSupported: e && A && t && r && n && s
1285
1282
  };
1286
1283
  }
1287
1284
  async function MA() {
@@ -1297,12 +1294,12 @@ async function VA() {
1297
1294
  "encrypt",
1298
1295
  "decrypt"
1299
1296
  ]), A = new Uint8Array([1, 2, 3, 4]), t = crypto.getRandomValues(new Uint8Array(12)), i = await crypto.subtle.encrypt({ name: "AES-GCM", iv: t }, e, A), r = await crypto.subtle.decrypt({ name: "AES-GCM", iv: t }, e, i), n = new Uint8Array(r);
1300
- return n.length === A.length && n.every((o, a) => o === A[a]);
1297
+ return n.length === A.length && n.every((s, l) => s === A[l]);
1301
1298
  } catch {
1302
1299
  return !1;
1303
1300
  }
1304
1301
  }
1305
- async function PA() {
1302
+ async function NA() {
1306
1303
  try {
1307
1304
  return await crypto.subtle.generateKey("Ed25519", !1, ["sign", "verify"]), !0;
1308
1305
  } catch {
@@ -1357,13 +1354,13 @@ function ot() {
1357
1354
  likelySupported: !1
1358
1355
  };
1359
1356
  }
1360
- let z = null, ae = null;
1361
- const NA = 6e4;
1362
- async function YA(e = !1) {
1363
- const A = Date.now(), t = ae === null || A - ae > NA;
1364
- return !e && !(typeof window > "u") && !t && z !== null || (z = await JA(), ae = Date.now()), z;
1357
+ let te = null, le = null;
1358
+ const YA = 6e4;
1359
+ async function OA(e = !1) {
1360
+ const A = Date.now(), t = le === null || A - le > YA;
1361
+ return !e && !(typeof window > "u") && !t && te !== null || (te = await JA(), le = Date.now()), te;
1365
1362
  }
1366
- function OA(e) {
1363
+ function PA(e) {
1367
1364
  switch (e.type) {
1368
1365
  case "password":
1369
1366
  return { password: e.password };
@@ -1371,186 +1368,186 @@ function OA(e) {
1371
1368
  return { prfOutput: e.prfOutput };
1372
1369
  }
1373
1370
  }
1374
- function xA() {
1375
- const e = ye(), [A, t] = F(!1), [i, r] = F(null), n = e?.config.serverUrl, o = e?.config.requestTimeout, a = e?.config.retryAttempts, C = e?._internal?.getAccessToken, s = Y(() => e ? new pe({
1371
+ function vA() {
1372
+ const e = ke(), [A, t] = F(!1), [i, r] = F(null), n = e?.config.serverUrl, s = e?.config.requestTimeout, l = e?.config.retryAttempts, h = e?._internal?.getAccessToken, o = M(() => e ? new ye({
1376
1373
  baseUrl: n,
1377
- timeoutMs: o,
1378
- retryAttempts: a,
1379
- getAccessToken: C
1380
- }) : null, [e, n, o, a, C]), p = d(async () => {
1381
- if (!s)
1374
+ timeoutMs: s,
1375
+ retryAttempts: l,
1376
+ getAccessToken: h
1377
+ }) : null, [e, n, s, l, h]), p = E(async () => {
1378
+ if (!o)
1382
1379
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1383
1380
  t(!0), r(null);
1384
1381
  try {
1385
- return await s.get("/wallet/status");
1382
+ return await o.get("/wallet/status");
1386
1383
  } catch (I) {
1387
- const l = P(I, "Failed to fetch wallet status");
1388
- throw r(l.message), l;
1384
+ const g = V(I, "Failed to fetch wallet status");
1385
+ throw r(g.message), g;
1389
1386
  } finally {
1390
1387
  t(!1);
1391
1388
  }
1392
- }, [s]), y = d(async () => {
1393
- if (!s)
1389
+ }, [o]), y = E(async () => {
1390
+ if (!o)
1394
1391
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1395
1392
  t(!0), r(null);
1396
1393
  try {
1397
- return await s.get("/wallet/material");
1394
+ return await o.get("/wallet/material");
1398
1395
  } catch (I) {
1399
- const l = P(I, "Failed to fetch wallet material");
1400
- if (l.code === "NOT_FOUND")
1396
+ const g = V(I, "Failed to fetch wallet material");
1397
+ if (g.code === "NOT_FOUND")
1401
1398
  return null;
1402
- throw r(l.message), l;
1399
+ throw r(g.message), g;
1403
1400
  } finally {
1404
1401
  t(!1);
1405
1402
  }
1406
- }, [s]), Q = d(
1403
+ }, [o]), Q = E(
1407
1404
  async (I) => {
1408
- if (!s)
1405
+ if (!o)
1409
1406
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1410
1407
  t(!0), r(null);
1411
1408
  try {
1412
- await s.post("/wallet/enroll", I);
1413
- } catch (l) {
1414
- const w = P(l, "Failed to enroll wallet");
1409
+ await o.post("/wallet/enroll", I);
1410
+ } catch (g) {
1411
+ const w = V(g, "Failed to enroll wallet");
1415
1412
  throw r(w.message), w;
1416
1413
  } finally {
1417
1414
  t(!1);
1418
1415
  }
1419
1416
  },
1420
- [s]
1421
- ), m = d(
1417
+ [o]
1418
+ ), m = E(
1422
1419
  async (I) => {
1423
- if (!s)
1420
+ if (!o)
1424
1421
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1425
1422
  t(!0), r(null);
1426
1423
  try {
1427
- await s.post("/wallet/recover", I);
1428
- } catch (l) {
1429
- const w = P(l, "Failed to recover wallet");
1424
+ await o.post("/wallet/recover", I);
1425
+ } catch (g) {
1426
+ const w = V(g, "Failed to recover wallet");
1430
1427
  throw r(w.message), w;
1431
1428
  } finally {
1432
1429
  t(!1);
1433
1430
  }
1434
1431
  },
1435
- [s]
1436
- ), U = d(
1432
+ [o]
1433
+ ), U = E(
1437
1434
  async (I) => {
1438
- if (!s)
1435
+ if (!o)
1439
1436
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1440
1437
  t(!0), r(null);
1441
1438
  try {
1442
- return await s.post("/wallet/sign", I);
1443
- } catch (l) {
1444
- const w = P(l, "Failed to sign transaction");
1439
+ return await o.post("/wallet/sign", I);
1440
+ } catch (g) {
1441
+ const w = V(g, "Failed to sign transaction");
1445
1442
  throw r(w.message), w;
1446
1443
  } finally {
1447
1444
  t(!1);
1448
1445
  }
1449
1446
  },
1450
- [s]
1451
- ), c = d(
1447
+ [o]
1448
+ ), c = E(
1452
1449
  async (I) => {
1453
- if (!s)
1450
+ if (!o)
1454
1451
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1455
1452
  t(!0), r(null);
1456
1453
  try {
1457
- await s.post("/wallet/rotate-user-secret", I);
1458
- } catch (l) {
1459
- const w = P(l, "Failed to rotate user secret");
1454
+ await o.post("/wallet/rotate-user-secret", I);
1455
+ } catch (g) {
1456
+ const w = V(g, "Failed to rotate user secret");
1460
1457
  throw r(w.message), w;
1461
1458
  } finally {
1462
1459
  t(!1);
1463
1460
  }
1464
1461
  },
1465
- [s]
1466
- ), B = d(
1462
+ [o]
1463
+ ), B = E(
1467
1464
  async (I) => {
1468
- if (!s)
1465
+ if (!o)
1469
1466
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1470
1467
  t(!0), r(null);
1471
1468
  try {
1472
- return await s.post(
1469
+ return await o.post(
1473
1470
  "/wallet/unlock",
1474
- OA(I)
1471
+ PA(I)
1475
1472
  );
1476
- } catch (l) {
1477
- const w = P(l, "Failed to unlock wallet");
1473
+ } catch (g) {
1474
+ const w = V(g, "Failed to unlock wallet");
1478
1475
  throw r(w.message), w;
1479
1476
  } finally {
1480
1477
  t(!1);
1481
1478
  }
1482
1479
  },
1483
- [s]
1484
- ), u = d(async () => {
1485
- if (!s)
1480
+ [o]
1481
+ ), u = E(async () => {
1482
+ if (!o)
1486
1483
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1487
1484
  t(!0), r(null);
1488
1485
  try {
1489
- await s.post("/wallet/lock", {});
1486
+ await o.post("/wallet/lock", {});
1490
1487
  } catch (I) {
1491
- const l = P(I, "Failed to lock wallet");
1492
- throw r(l.message), l;
1488
+ const g = V(I, "Failed to lock wallet");
1489
+ throw r(g.message), g;
1493
1490
  } finally {
1494
1491
  t(!1);
1495
1492
  }
1496
- }, [s]), b = d(
1493
+ }, [o]), b = E(
1497
1494
  async (I) => {
1498
- if (!s)
1495
+ if (!o)
1499
1496
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1500
1497
  t(!0), r(null);
1501
1498
  try {
1502
- return await s.post("/wallet/share-b", I);
1503
- } catch (l) {
1504
- const w = P(l, "Failed to get Share B for recovery");
1499
+ return await o.post("/wallet/share-b", I);
1500
+ } catch (g) {
1501
+ const w = V(g, "Failed to get Share B for recovery");
1505
1502
  throw r(w.message), w;
1506
1503
  } finally {
1507
1504
  t(!1);
1508
1505
  }
1509
1506
  },
1510
- [s]
1511
- ), k = d(
1507
+ [o]
1508
+ ), k = E(
1512
1509
  async (I) => {
1513
- if (!s)
1510
+ if (!o)
1514
1511
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1515
1512
  t(!0), r(null);
1516
1513
  try {
1517
- return await s.post("/wallet/derived", I);
1518
- } catch (l) {
1519
- const w = P(l, "Failed to create derived wallet");
1514
+ return await o.post("/wallet/derived", I);
1515
+ } catch (g) {
1516
+ const w = V(g, "Failed to create derived wallet");
1520
1517
  throw r(w.message), w;
1521
1518
  } finally {
1522
1519
  t(!1);
1523
1520
  }
1524
1521
  },
1525
- [s]
1526
- ), E = d(async () => {
1527
- if (!s)
1522
+ [o]
1523
+ ), d = E(async () => {
1524
+ if (!o)
1528
1525
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1529
1526
  t(!0), r(null);
1530
1527
  try {
1531
- return await s.get("/wallet/derived");
1528
+ return await o.get("/wallet/derived");
1532
1529
  } catch (I) {
1533
- const l = P(I, "Failed to list wallets");
1534
- throw r(l.message), l;
1530
+ const g = V(I, "Failed to list wallets");
1531
+ throw r(g.message), g;
1535
1532
  } finally {
1536
1533
  t(!1);
1537
1534
  }
1538
- }, [s]), h = d(
1535
+ }, [o]), C = E(
1539
1536
  async (I) => {
1540
- if (!s)
1537
+ if (!o)
1541
1538
  throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");
1542
1539
  t(!0), r(null);
1543
1540
  try {
1544
- await s.delete(`/wallet/derived/${I}`);
1545
- } catch (l) {
1546
- const w = P(l, "Failed to delete derived wallet");
1541
+ await o.delete(`/wallet/derived/${I}`);
1542
+ } catch (g) {
1543
+ const w = V(g, "Failed to delete derived wallet");
1547
1544
  throw r(w.message), w;
1548
1545
  } finally {
1549
1546
  t(!1);
1550
1547
  }
1551
1548
  },
1552
- [s]
1553
- ), g = d(() => r(null), []);
1549
+ [o]
1550
+ ), a = E(() => r(null), []);
1554
1551
  return {
1555
1552
  getStatus: p,
1556
1553
  getMaterial: y,
@@ -1562,14 +1559,14 @@ function xA() {
1562
1559
  lock: u,
1563
1560
  getShareBForRecovery: b,
1564
1561
  createDerivedWallet: k,
1565
- listAllWallets: E,
1566
- deleteDerivedWallet: h,
1562
+ listAllWallets: d,
1563
+ deleteDerivedWallet: C,
1567
1564
  isLoading: A,
1568
1565
  error: i,
1569
- clearError: g
1566
+ clearError: a
1570
1567
  };
1571
1568
  }
1572
- const vA = {
1569
+ const xA = {
1573
1570
  status: "not_enrolled",
1574
1571
  solanaPubkey: null,
1575
1572
  authMethod: null,
@@ -1584,121 +1581,121 @@ const vA = {
1584
1581
  }
1585
1582
  };
1586
1583
  function TA() {
1587
- const A = ye() !== null, [t, i] = F("loading"), [r, n] = F(null), [o, a] = F(null), [C, s] = F(!1), [p, y] = F(!1), [Q, m] = F(null), [U, c] = F(null), { getStatus: B, isLoading: u } = xA(), b = N(!1);
1588
- x(() => {
1584
+ const A = ke() !== null, [t, i] = F("loading"), [r, n] = F(null), [s, l] = F(null), [h, o] = F(!1), [p, y] = F(!1), [Q, m] = F(null), [U, c] = F(null), { getStatus: B, isLoading: u } = vA(), b = N(!1);
1585
+ P(() => {
1589
1586
  if (!A) return;
1590
- let h = !1;
1587
+ let C = !1;
1591
1588
  return (async () => {
1592
1589
  try {
1593
- const I = await YA();
1594
- if (h) return;
1590
+ const I = await OA();
1591
+ if (C) return;
1595
1592
  m(I), I.allSupported || (i("error"), c(
1596
1593
  "Your browser or device does not support all required features. Please use a modern browser with a platform authenticator."
1597
1594
  ));
1598
1595
  } catch {
1599
- if (h) return;
1596
+ if (C) return;
1600
1597
  m(null), i("error"), c("Failed to check crypto capabilities");
1601
1598
  }
1602
1599
  })(), () => {
1603
- h = !0;
1600
+ C = !0;
1604
1601
  };
1605
1602
  }, [A]);
1606
- const k = d(async () => {
1603
+ const k = E(async () => {
1607
1604
  if (!(!A || !Q?.allSupported)) {
1608
1605
  i("loading"), c(null);
1609
1606
  try {
1610
- const h = await B();
1611
- n(h.solanaPubkey ?? null), a(h.authMethod ?? null), s(h.hasExternalWallet), y(h.unlocked), h.hasExternalWallet ? i("enrolled_unlocked") : h.enrolled ? i(h.unlocked ? "enrolled_unlocked" : "enrolled_locked") : i("not_enrolled");
1612
- } catch (h) {
1613
- i("error"), c(h instanceof Error ? h.message : "Failed to fetch wallet status");
1607
+ const C = await B();
1608
+ n(C.solanaPubkey ?? null), l(C.authMethod ?? null), o(C.hasExternalWallet), y(C.unlocked), C.hasExternalWallet ? i("enrolled_unlocked") : C.enrolled ? i(C.unlocked ? "enrolled_unlocked" : "enrolled_locked") : i("not_enrolled");
1609
+ } catch (C) {
1610
+ i("error"), c(C instanceof Error ? C.message : "Failed to fetch wallet status");
1614
1611
  }
1615
1612
  }
1616
1613
  }, [A, Q?.allSupported, B]);
1617
- x(() => {
1614
+ P(() => {
1618
1615
  A && Q?.allSupported && !u && !b.current && (b.current = !0, k());
1619
1616
  }, [A, Q?.allSupported, u, k]);
1620
- const E = d(() => c(null), []);
1617
+ const d = E(() => c(null), []);
1621
1618
  return A ? {
1622
1619
  status: t,
1623
1620
  solanaPubkey: r,
1624
- authMethod: o,
1625
- hasExternalWallet: C,
1621
+ authMethod: s,
1622
+ hasExternalWallet: h,
1626
1623
  isUnlocked: p,
1627
1624
  capabilities: Q,
1628
1625
  isSupported: Q?.allSupported ?? !1,
1629
1626
  error: U,
1630
1627
  refresh: k,
1631
- clearError: E
1632
- } : vA;
1628
+ clearError: d
1629
+ } : xA;
1633
1630
  }
1634
- const Ae = "__CEDROS_EMBEDDED_WALLET__";
1631
+ const re = "__CEDROS_EMBEDDED_WALLET__";
1635
1632
  function RA(e) {
1636
- typeof window < "u" && (window[Ae] = e);
1633
+ typeof window < "u" && (window[re] = e);
1637
1634
  }
1638
- function ge() {
1639
- typeof window < "u" && delete window[Ae];
1635
+ function ce() {
1636
+ typeof window < "u" && delete window[re];
1640
1637
  }
1641
1638
  function st() {
1642
- return typeof window > "u" ? !1 : window[Ae]?.available ?? !1;
1639
+ return typeof window > "u" ? !1 : window[re]?.available ?? !1;
1643
1640
  }
1644
1641
  function It() {
1645
- return typeof window > "u" ? null : window[Ae] ?? null;
1642
+ return typeof window > "u" ? null : window[re] ?? null;
1646
1643
  }
1647
1644
  function LA() {
1648
- const { config: e, user: A } = ke(), { status: t, solanaPubkey: i, hasExternalWallet: r } = TA(), n = e.wallet?.exposeAvailability ?? !1, o = e.wallet?.exposePublicKey ?? !1;
1649
- return x(() => {
1645
+ const { config: e, user: A } = Se(), { status: t, solanaPubkey: i, hasExternalWallet: r } = TA(), n = e.wallet?.exposeAvailability ?? !1, s = e.wallet?.exposePublicKey ?? !1;
1646
+ return P(() => {
1650
1647
  if (!n || !A) {
1651
- ge();
1648
+ ce();
1652
1649
  return;
1653
1650
  }
1654
1651
  if (r) {
1655
- ge();
1652
+ ce();
1656
1653
  return;
1657
1654
  }
1658
1655
  if (t === "loading")
1659
1656
  return;
1660
- const a = t === "enrolled_locked" || t === "enrolled_unlocked";
1657
+ const l = t === "enrolled_locked" || t === "enrolled_unlocked";
1661
1658
  return RA({
1662
- available: a,
1663
- publicKey: o && a ? i : null
1659
+ available: l,
1660
+ publicKey: s && l ? i : null
1664
1661
  }), () => {
1665
- ge();
1662
+ ce();
1666
1663
  };
1667
- }, [n, o, A, t, i, r]), null;
1664
+ }, [n, s, A, t, i, r]), null;
1668
1665
  }
1669
1666
  function at({ config: e, children: A }) {
1670
- const [t, i] = F(null), [r, n] = F(!1), o = N(e.callbacks);
1671
- o.current = e.callbacks;
1672
- const a = N({
1673
- onLoginSuccess: (...M) => o.current?.onLoginSuccess?.(...M),
1674
- onLoginError: (...M) => o.current?.onLoginError?.(...M),
1675
- onLogout: () => o.current?.onLogout?.(),
1676
- onSessionExpired: () => o.current?.onSessionExpired?.()
1677
- }), C = N(null);
1678
- x(() => {
1667
+ const [t, i] = F(null), [r, n] = F(!1), s = N(e.callbacks);
1668
+ s.current = e.callbacks;
1669
+ const l = N({
1670
+ onLoginSuccess: (...v) => s.current?.onLoginSuccess?.(...v),
1671
+ onLoginError: (...v) => s.current?.onLoginError?.(...v),
1672
+ onLogout: () => s.current?.onLogout?.(),
1673
+ onSessionExpired: () => s.current?.onSessionExpired?.()
1674
+ }), h = N(null);
1675
+ P(() => {
1679
1676
  if (typeof window > "u") return;
1680
- const M = new URLSearchParams(window.location.search), L = M.get("ref") || M.get("referral");
1681
- L && (C.current = L);
1677
+ const v = new URLSearchParams(window.location.search), L = v.get("ref") || v.get("referral");
1678
+ L && (h.current = L);
1682
1679
  }, []);
1683
- const s = e.features === "auto", {
1680
+ const o = e.features === "auto", {
1684
1681
  features: p,
1685
1682
  googleClientId: y,
1686
1683
  appleClientId: Q,
1687
1684
  socialButtonOrder: m,
1688
1685
  isLoading: U
1689
- } = Ne(
1686
+ } = Ye(
1690
1687
  e.serverUrl,
1691
- s,
1688
+ o,
1692
1689
  e.requestTimeout
1693
- ), c = Y(() => !s || !p ? e : {
1690
+ ), c = M(() => !o || !p ? e : {
1694
1691
  ...e,
1695
1692
  features: p,
1696
1693
  googleClientId: e.googleClientId ?? y,
1697
1694
  appleClientId: e.appleClientId ?? Q
1698
- }, [e, s, p, y, Q]), B = Y(
1695
+ }, [e, o, p, y, Q]), B = M(
1699
1696
  () => JSON.stringify(c.themeOverrides ?? null),
1700
1697
  [c.themeOverrides]
1701
- ), u = Y(() => JSON.stringify(c.session ?? null), [c.session]), b = Y(() => JSON.stringify(c.features ?? null), [c.features]), k = Y(() => JSON.stringify(c.forms ?? null), [c.forms]), E = Y(
1698
+ ), u = M(() => JSON.stringify(c.session ?? null), [c.session]), b = M(() => JSON.stringify(c.features ?? null), [c.features]), k = M(() => JSON.stringify(c.forms ?? null), [c.forms]), d = M(
1702
1699
  () => c,
1703
1700
  // eslint-disable-next-line react-hooks/exhaustive-deps -- Using serialized keys for deep comparison; callbacks excluded (see UI-06)
1704
1701
  [
@@ -1713,64 +1710,62 @@ function at({ config: e, children: A }) {
1713
1710
  b,
1714
1711
  k
1715
1712
  ]
1716
- );
1717
- Ve({
1718
- theme: E.theme,
1719
- themeOverrides: E.themeOverrides
1720
- });
1721
- const {
1722
- user: h,
1713
+ ), C = d.unstyled ?? !1, a = Ve({
1714
+ theme: C ? void 0 : d.theme,
1715
+ themeOverrides: C ? void 0 : d.themeOverrides
1716
+ }), {
1717
+ user: I,
1723
1718
  authState: g,
1724
- handleLoginSuccess: I,
1725
- logout: l,
1726
- refreshUser: w,
1727
- getAccessToken: f
1719
+ handleLoginSuccess: w,
1720
+ logout: f,
1721
+ refreshUser: S,
1722
+ getAccessToken: G
1728
1723
  } = Le({
1729
- serverUrl: E.serverUrl,
1730
- session: E.session,
1731
- callbacks: a.current,
1732
- requestTimeoutMs: E.requestTimeout
1733
- }), S = d(async () => {
1734
- i(null), await l();
1735
- }, [l]), G = d(
1736
- (...M) => {
1737
- i(null), I(...M);
1724
+ serverUrl: d.serverUrl,
1725
+ session: d.session,
1726
+ callbacks: l.current,
1727
+ requestTimeoutMs: d.requestTimeout
1728
+ }), H = E(async () => {
1729
+ i(null), await f();
1730
+ }, [f]), K = E(
1731
+ (...v) => {
1732
+ i(null), w(...v);
1738
1733
  },
1739
- [I]
1740
- ), H = d(() => n(!0), []), K = d(() => n(!1), []), J = Y(
1734
+ [w]
1735
+ ), J = E(() => n(!0), []), Y = E(() => n(!1), []), _ = M(
1741
1736
  () => ({
1742
- config: E,
1743
- user: h,
1737
+ config: d,
1738
+ user: I,
1744
1739
  authState: g,
1745
- logout: S,
1746
- refreshUser: w,
1747
- socialButtonOrder: s ? m : void 0,
1740
+ logout: H,
1741
+ refreshUser: S,
1742
+ socialButtonOrder: o ? m : void 0,
1748
1743
  _internal: {
1749
- handleLoginSuccess: G,
1750
- getAccessToken: f,
1751
- getReferralCode: () => C.current
1744
+ handleLoginSuccess: K,
1745
+ getAccessToken: G,
1746
+ getReferralCode: () => h.current
1752
1747
  }
1753
1748
  }),
1754
- [E, h, g, S, w, s, m, G, f]
1755
- ), V = Y(
1749
+ [d, I, g, H, S, o, m, K, G]
1750
+ ), R = M(
1756
1751
  () => ({
1757
1752
  error: t,
1758
1753
  isModalOpen: r,
1759
- openModal: H,
1760
- closeModal: K
1754
+ openModal: J,
1755
+ closeModal: Y
1761
1756
  }),
1762
- [t, r, H, K]
1763
- ), fe = Y(
1764
- () => ({ ...J, ...V }),
1765
- [J, V]
1757
+ [t, r, J, Y]
1758
+ ), j = M(
1759
+ () => ({ ..._, ...R }),
1760
+ [_, R]
1766
1761
  );
1767
- return s && U ? null : /* @__PURE__ */ ie(He.Provider, { value: J, children: /* @__PURE__ */ ie(Je.Provider, { value: V, children: /* @__PURE__ */ Ke(Me.Provider, { value: fe, children: [
1768
- /* @__PURE__ */ ie(LA, {}),
1762
+ return o && U ? null : /* @__PURE__ */ $(He.Provider, { value: _, children: /* @__PURE__ */ $(Je.Provider, { value: R, children: /* @__PURE__ */ $(Me.Provider, { value: j, children: /* @__PURE__ */ Ke("div", { className: a.className, style: a.style, children: [
1763
+ /* @__PURE__ */ $(LA, {}),
1769
1764
  A
1770
- ] }) }) });
1765
+ ] }) }) }) });
1771
1766
  }
1772
1767
  function gt() {
1773
- const { user: e, authState: A, error: t, logout: i, refreshUser: r, openModal: n, closeModal: o } = ke();
1768
+ const { user: e, authState: A, error: t, logout: i, refreshUser: r, openModal: n, closeModal: s } = Se();
1774
1769
  return {
1775
1770
  user: e,
1776
1771
  authState: A,
@@ -1780,7 +1775,7 @@ function gt() {
1780
1775
  logout: i,
1781
1776
  refreshUser: r,
1782
1777
  openLoginModal: n,
1783
- closeLoginModal: o
1778
+ closeLoginModal: s
1784
1779
  };
1785
1780
  }
1786
1781
  export {
@@ -1790,23 +1785,24 @@ export {
1790
1785
  ze as b,
1791
1786
  et as c,
1792
1787
  ot as d,
1793
- xA as e,
1788
+ vA as e,
1794
1789
  _A as f,
1795
1790
  nt as g,
1796
1791
  At as h,
1797
- Se as i,
1798
- ue as j,
1792
+ De as i,
1793
+ we as j,
1799
1794
  $A as k,
1800
1795
  zA as l,
1801
1796
  rt as m,
1802
1797
  tt as n,
1803
- OA as o,
1798
+ PA as o,
1804
1799
  oA as p,
1805
1800
  TA as q,
1806
- It as r,
1807
- st as s,
1801
+ Ve as r,
1802
+ It as s,
1808
1803
  qA as t,
1809
1804
  gt as u,
1810
1805
  mA as v,
1811
- De as w
1806
+ Fe as w,
1807
+ st as x
1812
1808
  };