@cedros/login-react 0.0.41 → 0.0.43

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 (128) hide show
  1. package/dist/{AuthenticationSettings-CSoFp-_2.js → AuthenticationSettings-CxAubcoz.js} +1 -1
  2. package/dist/{AuthenticationSettings-CSoFp-_2.js.map → AuthenticationSettings-CxAubcoz.js.map} +1 -1
  3. package/dist/{AuthenticationSettings-Cu5Z2mTC.cjs → AuthenticationSettings-DPr882lj.cjs} +1 -1
  4. package/dist/{AuthenticationSettings-Cu5Z2mTC.cjs.map → AuthenticationSettings-DPr882lj.cjs.map} +1 -1
  5. package/dist/{AuthenticationSettings-DABzZHuI.cjs → AuthenticationSettings-Y40T1djV.cjs} +1 -1
  6. package/dist/{AuthenticationSettings-DABzZHuI.cjs.map → AuthenticationSettings-Y40T1djV.cjs.map} +1 -1
  7. package/dist/{AuthenticationSettings-D4ExU-2a.js → AuthenticationSettings-aVBFKKZ-.js} +1 -1
  8. package/dist/{AuthenticationSettings-D4ExU-2a.js.map → AuthenticationSettings-aVBFKKZ-.js.map} +1 -1
  9. package/dist/AutosaveStatus-ByD01ENa.cjs +1 -0
  10. package/dist/AutosaveStatus-ByD01ENa.cjs.map +1 -0
  11. package/dist/{AutosaveStatus-DMjvXzP2.js → AutosaveStatus-DtF_58rC.js} +608 -279
  12. package/dist/AutosaveStatus-DtF_58rC.js.map +1 -0
  13. package/dist/{CreditSystemSettings-BjQdysRS.js → CreditSystemSettings-BQek2Ux2.js} +1 -1
  14. package/dist/{CreditSystemSettings-BjQdysRS.js.map → CreditSystemSettings-BQek2Ux2.js.map} +1 -1
  15. package/dist/{CreditSystemSettings-DfSfQVE8.cjs → CreditSystemSettings-CbuCce29.cjs} +1 -1
  16. package/dist/{CreditSystemSettings-DfSfQVE8.cjs.map → CreditSystemSettings-CbuCce29.cjs.map} +1 -1
  17. package/dist/{CreditSystemSettings-BWuiRTtA.cjs → CreditSystemSettings-DHG_jhz9.cjs} +1 -1
  18. package/dist/{CreditSystemSettings-BWuiRTtA.cjs.map → CreditSystemSettings-DHG_jhz9.cjs.map} +1 -1
  19. package/dist/{CreditSystemSettings-Du3ac0ID.js → CreditSystemSettings-GDKgYc7I.js} +1 -1
  20. package/dist/{CreditSystemSettings-Du3ac0ID.js.map → CreditSystemSettings-GDKgYc7I.js.map} +1 -1
  21. package/dist/{EmailRegisterForm-CMXsa-_r.js → EmailRegisterForm-p2X5QP58.js} +147 -147
  22. package/dist/EmailRegisterForm-p2X5QP58.js.map +1 -0
  23. package/dist/EmailRegisterForm-xFb6MaVA.cjs +1 -0
  24. package/dist/EmailRegisterForm-xFb6MaVA.cjs.map +1 -0
  25. package/dist/{EmailSettings-CswtKXhb.cjs → EmailSettings-Cg4Z7139.cjs} +1 -1
  26. package/dist/{EmailSettings-CswtKXhb.cjs.map → EmailSettings-Cg4Z7139.cjs.map} +1 -1
  27. package/dist/{EmailSettings-BcHo0cqk.cjs → EmailSettings-CjxBg0cE.cjs} +1 -1
  28. package/dist/{EmailSettings-BcHo0cqk.cjs.map → EmailSettings-CjxBg0cE.cjs.map} +1 -1
  29. package/dist/{EmailSettings-CjngJwDS.js → EmailSettings-Ct6nFslP.js} +1 -1
  30. package/dist/{EmailSettings-CjngJwDS.js.map → EmailSettings-Ct6nFslP.js.map} +1 -1
  31. package/dist/{EmailSettings-ASDHfI0K.js → EmailSettings-D2pCqTKC.js} +1 -1
  32. package/dist/{EmailSettings-ASDHfI0K.js.map → EmailSettings-D2pCqTKC.js.map} +1 -1
  33. package/dist/{EmbeddedWalletSettings-CUY_X7Vj.js → EmbeddedWalletSettings-Bus7UyOX.js} +1 -1
  34. package/dist/{EmbeddedWalletSettings-CUY_X7Vj.js.map → EmbeddedWalletSettings-Bus7UyOX.js.map} +1 -1
  35. package/dist/{EmbeddedWalletSettings-BXlboZ9-.cjs → EmbeddedWalletSettings-CfzvFYnn.cjs} +1 -1
  36. package/dist/{EmbeddedWalletSettings-BXlboZ9-.cjs.map → EmbeddedWalletSettings-CfzvFYnn.cjs.map} +1 -1
  37. package/dist/{EmbeddedWalletSettings-CPLbqlxJ.js → EmbeddedWalletSettings-PwFgtGmK.js} +1 -1
  38. package/dist/{EmbeddedWalletSettings-CPLbqlxJ.js.map → EmbeddedWalletSettings-PwFgtGmK.js.map} +1 -1
  39. package/dist/{EmbeddedWalletSettings-BkwIbTkL.cjs → EmbeddedWalletSettings-t0_5poBu.cjs} +1 -1
  40. package/dist/{EmbeddedWalletSettings-BkwIbTkL.cjs.map → EmbeddedWalletSettings-t0_5poBu.cjs.map} +1 -1
  41. package/dist/GoogleLoginButton-2zNTIKMm.cjs +1 -0
  42. package/dist/GoogleLoginButton-2zNTIKMm.cjs.map +1 -0
  43. package/dist/{GoogleLoginButton-qf4A_A3G.js → GoogleLoginButton-C1WNu7W3.js} +41 -40
  44. package/dist/GoogleLoginButton-C1WNu7W3.js.map +1 -0
  45. package/dist/LoadingSpinner-6vml-zwr.js.map +1 -1
  46. package/dist/LoadingSpinner-d6sSxgQN.cjs.map +1 -1
  47. package/dist/{PermissionsSection-BeFhIgQy.js → PermissionsSection-BDDiEfho.js} +81 -77
  48. package/dist/{PermissionsSection-BeFhIgQy.js.map → PermissionsSection-BDDiEfho.js.map} +1 -1
  49. package/dist/PermissionsSection-CSB_Ikj9.cjs +1 -0
  50. package/dist/{PermissionsSection-B-6DJnN8.cjs.map → PermissionsSection-CSB_Ikj9.cjs.map} +1 -1
  51. package/dist/{ServerSettings-BygCxOTY.cjs → ServerSettings-BjLFs_sb.cjs} +1 -1
  52. package/dist/{ServerSettings-BygCxOTY.cjs.map → ServerSettings-BjLFs_sb.cjs.map} +1 -1
  53. package/dist/{ServerSettings-B9PNMse1.js → ServerSettings-COkhan4u.js} +1 -1
  54. package/dist/{ServerSettings-B9PNMse1.js.map → ServerSettings-COkhan4u.js.map} +1 -1
  55. package/dist/{ServerSettings-BLoWX7KG.js → ServerSettings-D7WJDTbZ.js} +1 -1
  56. package/dist/{ServerSettings-BLoWX7KG.js.map → ServerSettings-D7WJDTbZ.js.map} +1 -1
  57. package/dist/{ServerSettings-CgBdYspU.cjs → ServerSettings-Dmw2rpFA.cjs} +1 -1
  58. package/dist/{ServerSettings-CgBdYspU.cjs.map → ServerSettings-Dmw2rpFA.cjs.map} +1 -1
  59. package/dist/SolanaLoginButton-CqdzSSeJ.cjs +1 -0
  60. package/dist/SolanaLoginButton-CqdzSSeJ.cjs.map +1 -0
  61. package/dist/{SolanaLoginButton-B04dib6X.js → SolanaLoginButton-CyeX35eU.js} +41 -40
  62. package/dist/SolanaLoginButton-CyeX35eU.js.map +1 -0
  63. package/dist/{TeamSection-DbSYDRdI.js → TeamSection-BhsBEckR.js} +1 -1
  64. package/dist/{TeamSection-DbSYDRdI.js.map → TeamSection-BhsBEckR.js.map} +1 -1
  65. package/dist/{TeamSection-B1t1tU-_.cjs → TeamSection-DLxtRmta.cjs} +1 -1
  66. package/dist/{TeamSection-B1t1tU-_.cjs.map → TeamSection-DLxtRmta.cjs.map} +1 -1
  67. package/dist/{UsersSection-C7aRNkK2.cjs → UsersSection-BEKfbhQ4.cjs} +1 -1
  68. package/dist/{UsersSection-C7aRNkK2.cjs.map → UsersSection-BEKfbhQ4.cjs.map} +1 -1
  69. package/dist/{UsersSection--PAE1XRh.js → UsersSection-DbGkmxty.js} +1 -1
  70. package/dist/{UsersSection--PAE1XRh.js.map → UsersSection-DbGkmxty.js.map} +1 -1
  71. package/dist/{WebhookSettings-C-7Yxueu.js → WebhookSettings-CpPvGmV7.js} +1 -1
  72. package/dist/{WebhookSettings-C-7Yxueu.js.map → WebhookSettings-CpPvGmV7.js.map} +1 -1
  73. package/dist/{WebhookSettings-C923ZSKa.js → WebhookSettings-DEHV2ptf.js} +1 -1
  74. package/dist/{WebhookSettings-C923ZSKa.js.map → WebhookSettings-DEHV2ptf.js.map} +1 -1
  75. package/dist/{WebhookSettings-CbU3cfTJ.cjs → WebhookSettings-DbyPJ8V2.cjs} +1 -1
  76. package/dist/{WebhookSettings-CbU3cfTJ.cjs.map → WebhookSettings-DbyPJ8V2.cjs.map} +1 -1
  77. package/dist/{WebhookSettings-D19u9Uok.cjs → WebhookSettings-Rq_nNJuw.cjs} +1 -1
  78. package/dist/{WebhookSettings-D19u9Uok.cjs.map → WebhookSettings-Rq_nNJuw.cjs.map} +1 -1
  79. package/dist/admin-only.cjs +1 -1
  80. package/dist/admin-only.js +1 -1
  81. package/dist/email-only.cjs +1 -1
  82. package/dist/email-only.d.ts +6 -0
  83. package/dist/email-only.js +2 -2
  84. package/dist/google-only.cjs +1 -1
  85. package/dist/google-only.d.ts +6 -0
  86. package/dist/google-only.js +2 -2
  87. package/dist/index.cjs +13 -13
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.ts +500 -1
  90. package/dist/index.js +5656 -4205
  91. package/dist/index.js.map +1 -1
  92. package/dist/{plugin-BiftIhZe.js → plugin-Bwwe7_ZO.js} +3 -2
  93. package/dist/plugin-Bwwe7_ZO.js.map +1 -0
  94. package/dist/plugin-C4bijrSr.cjs +1 -0
  95. package/dist/plugin-C4bijrSr.cjs.map +1 -0
  96. package/dist/solana-only.cjs +1 -1
  97. package/dist/solana-only.d.ts +6 -0
  98. package/dist/solana-only.js +2 -2
  99. package/dist/useAuth-B1yS_YiD.cjs +1 -0
  100. package/dist/{useAuth-U5CYsHEU.cjs.map → useAuth-B1yS_YiD.cjs.map} +1 -1
  101. package/dist/{useAuth-C-Vw-ggy.js → useAuth-l-itM5am.js} +440 -433
  102. package/dist/{useAuth-C-Vw-ggy.js.map → useAuth-l-itM5am.js.map} +1 -1
  103. package/dist/useUsersStatsSummary-9HQDKBU5.js +1879 -0
  104. package/dist/useUsersStatsSummary-9HQDKBU5.js.map +1 -0
  105. package/dist/useUsersStatsSummary-DiRC8sGs.cjs +1 -0
  106. package/dist/useUsersStatsSummary-DiRC8sGs.cjs.map +1 -0
  107. package/package.json +1 -1
  108. package/dist/AutosaveStatus-B1A1zORa.cjs +0 -1
  109. package/dist/AutosaveStatus-B1A1zORa.cjs.map +0 -1
  110. package/dist/AutosaveStatus-DMjvXzP2.js.map +0 -1
  111. package/dist/EmailRegisterForm-CMXsa-_r.js.map +0 -1
  112. package/dist/EmailRegisterForm-i7f4St2N.cjs +0 -1
  113. package/dist/EmailRegisterForm-i7f4St2N.cjs.map +0 -1
  114. package/dist/GoogleLoginButton-JtRViYWS.cjs +0 -1
  115. package/dist/GoogleLoginButton-JtRViYWS.cjs.map +0 -1
  116. package/dist/GoogleLoginButton-qf4A_A3G.js.map +0 -1
  117. package/dist/PermissionsSection-B-6DJnN8.cjs +0 -1
  118. package/dist/SolanaLoginButton-B04dib6X.js.map +0 -1
  119. package/dist/SolanaLoginButton-nSJHVFpZ.cjs +0 -1
  120. package/dist/SolanaLoginButton-nSJHVFpZ.cjs.map +0 -1
  121. package/dist/plugin-BiftIhZe.js.map +0 -1
  122. package/dist/plugin-BtQdI_Ay.cjs +0 -1
  123. package/dist/plugin-BtQdI_Ay.cjs.map +0 -1
  124. package/dist/useAuth-U5CYsHEU.cjs +0 -1
  125. package/dist/useUsersStatsSummary-5DJwzntC.js +0 -1246
  126. package/dist/useUsersStatsSummary-5DJwzntC.js.map +0 -1
  127. package/dist/useUsersStatsSummary-DgKaUIfs.cjs +0 -1
  128. package/dist/useUsersStatsSummary-DgKaUIfs.cjs.map +0 -1
@@ -1,43 +1,43 @@
1
- import { jsxs as f, jsx as t, Fragment as R } from "react/jsx-runtime";
1
+ import { jsxs as f, jsx as t, Fragment as L } from "react/jsx-runtime";
2
2
  import { useRef as F, useState as w, useCallback as E, useEffect as M, useMemo as z, useId as W } from "react";
3
3
  import { L as O } from "./LoadingSpinner-6vml-zwr.js";
4
4
  import { E as j } from "./ErrorMessage-CcEK0pYO.js";
5
5
  import { u as U, A as H, h as P } from "./useCedrosLogin-CFfID-0i.js";
6
6
  import { b as B, v as ce } from "./validation-B8kMV3BL.js";
7
7
  import { s as ie } from "./sanitization-CQ-H1MSg.js";
8
- function K(c = {}) {
9
- const { maxAttempts: m = 5, windowMs: C = 6e4, showCountdown: p = !1 } = c, u = F([]), [o, v] = w(!1), [, b] = w(0), l = E(() => {
10
- b((n) => n + 1);
11
- }, []), i = E(() => {
12
- const n = Date.now();
13
- u.current = u.current.filter((e) => n - e < C);
8
+ function K(i = {}) {
9
+ const { maxAttempts: u = 5, windowMs: C = 6e4, showCountdown: p = !1 } = i, m = F([]), [o, v] = w(!1), [, b] = w(0), d = E(() => {
10
+ b((c) => c + 1);
11
+ }, []), l = E(() => {
12
+ const c = Date.now();
13
+ m.current = m.current.filter((e) => c - e < C);
14
14
  }, [C]), g = E(() => {
15
- i(), v((n) => u.current.length === 0 && n ? !1 : n);
16
- }, [i]), a = E(() => (i(), Math.max(0, m - u.current.length)), [i, m]), h = E(() => {
17
- if (i(), u.current.length === 0)
15
+ l(), v((c) => m.current.length === 0 && c ? !1 : c);
16
+ }, [l]), a = E(() => (l(), Math.max(0, u - m.current.length)), [l, u]), h = E(() => {
17
+ if (l(), m.current.length === 0)
18
18
  return 0;
19
- const e = u.current[0] + C;
19
+ const e = m.current[0] + C;
20
20
  return Math.max(0, e - Date.now());
21
- }, [i, C]), k = E(() => (i(), u.current.length < m), [i, m]), N = E(() => {
22
- if (g(), u.current.length >= m) {
23
- const n = h(), e = Math.ceil(n / 1e3);
21
+ }, [l, C]), k = E(() => (l(), m.current.length < u), [l, u]), N = E(() => {
22
+ if (g(), m.current.length >= u) {
23
+ const c = h(), e = Math.ceil(c / 1e3);
24
24
  throw new Error(
25
25
  `Too many attempts. Please wait ${e} second${e === 1 ? "" : "s"} before trying again.`
26
26
  );
27
27
  }
28
- u.current.push(Date.now()), v((n) => n || !0), l();
29
- }, [g, m, h, l]), y = E(() => {
30
- u.current = [], v((n) => n && !1), l();
31
- }, [l]);
28
+ m.current.push(Date.now()), v((c) => c || !0), d();
29
+ }, [g, u, h, d]), y = E(() => {
30
+ m.current = [], v((c) => c && !1), d();
31
+ }, [d]);
32
32
  return M(() => {
33
33
  if (!o || !p) return;
34
- const n = window.setInterval(() => {
35
- g(), l();
34
+ const c = window.setInterval(() => {
35
+ g(), d();
36
36
  }, 1e3);
37
37
  return () => {
38
- window.clearInterval(n);
38
+ window.clearInterval(c);
39
39
  };
40
- }, [o, p, l, g]), {
40
+ }, [o, p, d, g]), {
41
41
  checkLimit: N,
42
42
  isAllowed: k,
43
43
  getRemainingAttempts: a,
@@ -45,24 +45,24 @@ function K(c = {}) {
45
45
  reset: y
46
46
  };
47
47
  }
48
- function le(c) {
49
- return "mfaRequired" in c && c.mfaRequired === !0;
48
+ function le(i) {
49
+ return "mfaRequired" in i && i.mfaRequired === !0;
50
50
  }
51
51
  function Z() {
52
- const { config: c, _internal: m } = U(), [C, p] = w(!1), [u, o] = w(null), {
52
+ const { config: i, _internal: u } = U(), [C, p] = w(!1), [m, o] = w(null), {
53
53
  checkLimit: v,
54
54
  getRemainingAttempts: b,
55
- getTimeUntilReset: l,
56
- reset: i
55
+ getTimeUntilReset: d,
56
+ reset: l
57
57
  } = K({ maxAttempts: 5, windowMs: 6e4 }), g = z(
58
58
  () => new H({
59
- baseUrl: c.serverUrl,
60
- timeoutMs: c.requestTimeout,
61
- retryAttempts: c.retryAttempts
59
+ baseUrl: i.serverUrl,
60
+ timeoutMs: i.requestTimeout,
61
+ retryAttempts: i.retryAttempts
62
62
  }),
63
- [c.serverUrl, c.requestTimeout, c.retryAttempts]
64
- ), a = c.callbacks, h = E(
65
- async (y, n) => {
63
+ [i.serverUrl, i.requestTimeout, i.retryAttempts]
64
+ ), a = i.callbacks, h = E(
65
+ async (y, c) => {
66
66
  if (!B(y)) {
67
67
  const e = {
68
68
  code: "VALIDATION_ERROR",
@@ -83,7 +83,7 @@ function Z() {
83
83
  try {
84
84
  const e = await g.post("/login", {
85
85
  email: y,
86
- password: n
86
+ password: c
87
87
  });
88
88
  if (le(e))
89
89
  return {
@@ -93,7 +93,7 @@ function Z() {
93
93
  userId: e.userId
94
94
  };
95
95
  const r = e;
96
- return a?.onLoginSuccess?.(r.user, "email"), m?.handleLoginSuccess(r.user, r.tokens), i(), {
96
+ return a?.onLoginSuccess?.(r.user, "email"), u?.handleLoginSuccess(r.user, r.tokens), l(), {
97
97
  mfaRequired: !1,
98
98
  response: r
99
99
  };
@@ -104,9 +104,9 @@ function Z() {
104
104
  p(!1);
105
105
  }
106
106
  },
107
- [g, a, m, v, i]
107
+ [g, a, u, v, l]
108
108
  ), k = E(
109
- async (y, n, e, r) => {
109
+ async (y, c, e, r) => {
110
110
  if (!B(y)) {
111
111
  const s = {
112
112
  code: "VALIDATION_ERROR",
@@ -117,54 +117,54 @@ function Z() {
117
117
  try {
118
118
  v();
119
119
  } catch (s) {
120
- const d = {
120
+ const n = {
121
121
  code: "RATE_LIMITED",
122
122
  message: s instanceof Error ? s.message : "Too many attempts"
123
123
  };
124
- throw o(d), d;
124
+ throw o(n), n;
125
125
  }
126
126
  p(!0), o(null);
127
127
  try {
128
- const s = await g.post("/register", { email: y, password: n, name: e, referral: r });
129
- return a?.onLoginSuccess?.(s.user, "email"), m?.handleLoginSuccess(s.user, s.tokens), i(), s;
128
+ const s = r ?? u?.getReferralCode?.() ?? void 0, n = await g.post("/register", { email: y, password: c, name: e, referral: s });
129
+ return a?.onLoginSuccess?.(n.user, "email"), u?.handleLoginSuccess(n.user, n.tokens), l(), n;
130
130
  } catch (s) {
131
- const d = P(s, "Unable to create your account. Please try again.");
132
- throw o(d), d;
131
+ const n = P(s, "Unable to create your account. Please try again.");
132
+ throw o(n), n;
133
133
  } finally {
134
134
  p(!1);
135
135
  }
136
136
  },
137
- [g, a, m, v, i]
137
+ [g, a, u, v, l]
138
138
  ), N = E(() => o(null), []);
139
139
  return {
140
140
  login: h,
141
141
  register: k,
142
142
  isLoading: C,
143
- error: u,
143
+ error: m,
144
144
  clearError: N,
145
145
  // M-10: Point-in-time snapshots for UI display (see interface JSDoc)
146
146
  remainingAttempts: b(),
147
- timeUntilReset: l()
147
+ timeUntilReset: d()
148
148
  };
149
149
  }
150
150
  function q({
151
- label: c = "Password",
152
- labelAction: m,
151
+ label: i = "Password",
152
+ labelAction: u,
153
153
  showStrengthMeter: C = !1,
154
154
  onValidationChange: p,
155
- error: u,
155
+ error: m,
156
156
  className: o = "",
157
157
  onChange: v,
158
158
  value: b,
159
- ...l
159
+ ...d
160
160
  }) {
161
- const [i, g] = w(!1), [a, h] = w(null), k = W(), N = (n) => {
162
- const e = n.target.value;
161
+ const [l, g] = w(!1), [a, h] = w(null), k = W(), N = (c) => {
162
+ const e = c.target.value;
163
163
  if (C || p) {
164
164
  const r = ce(e);
165
165
  h(r), p?.(r);
166
166
  }
167
- v?.(n);
167
+ v?.(c);
168
168
  }, y = {
169
169
  weak: "var(--cedros-destructive, #ef4444)",
170
170
  fair: "var(--cedros-warning, #f59e0b)",
@@ -173,21 +173,21 @@ function q({
173
173
  };
174
174
  return /* @__PURE__ */ f("div", { className: `cedros-password-input ${o}`, children: [
175
175
  /* @__PURE__ */ f("div", { className: "cedros-label-row", children: [
176
- /* @__PURE__ */ t("label", { htmlFor: k, className: "cedros-label", children: c }),
177
- m
176
+ /* @__PURE__ */ t("label", { htmlFor: k, className: "cedros-label", children: i }),
177
+ u
178
178
  ] }),
179
179
  /* @__PURE__ */ f("div", { className: "cedros-password-wrapper", children: [
180
180
  /* @__PURE__ */ t(
181
181
  "input",
182
182
  {
183
183
  id: k,
184
- type: i ? "text" : "password",
184
+ type: l ? "text" : "password",
185
185
  className: "cedros-input",
186
186
  onChange: N,
187
187
  value: b,
188
- "aria-invalid": u ? "true" : void 0,
189
- "aria-describedby": u ? `${k}-error` : void 0,
190
- ...l
188
+ "aria-invalid": m ? "true" : void 0,
189
+ "aria-describedby": m ? `${k}-error` : void 0,
190
+ ...d
191
191
  }
192
192
  ),
193
193
  /* @__PURE__ */ t(
@@ -195,10 +195,10 @@ function q({
195
195
  {
196
196
  type: "button",
197
197
  className: "cedros-password-toggle",
198
- onClick: () => g(!i),
199
- "aria-label": i ? "Hide password" : "Show password",
200
- "aria-pressed": i,
201
- children: i ? /* @__PURE__ */ f("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
198
+ onClick: () => g(!l),
199
+ "aria-label": l ? "Hide password" : "Show password",
200
+ "aria-pressed": l,
201
+ children: l ? /* @__PURE__ */ f("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
202
202
  /* @__PURE__ */ t(
203
203
  "path",
204
204
  {
@@ -223,7 +223,7 @@ function q({
223
223
  }
224
224
  )
225
225
  ] }),
226
- u && /* @__PURE__ */ t("p", { id: `${k}-error`, className: "cedros-input-error", children: u }),
226
+ m && /* @__PURE__ */ t("p", { id: `${k}-error`, className: "cedros-input-error", children: m }),
227
227
  C && a && b?.length > 0 && /* @__PURE__ */ f("div", { className: "cedros-password-strength", children: [
228
228
  /* @__PURE__ */ t("div", { className: "cedros-strength-bar", children: /* @__PURE__ */ t(
229
229
  "div",
@@ -240,104 +240,104 @@ function q({
240
240
  ] });
241
241
  }
242
242
  function de() {
243
- const { config: c, _internal: m } = U(), [C, p] = w("idle"), [u, o] = w(!1), [v, b] = w(null), {
244
- checkLimit: l,
245
- getRemainingAttempts: i,
243
+ const { config: i, _internal: u } = U(), [C, p] = w("idle"), [m, o] = w(!1), [v, b] = w(null), {
244
+ checkLimit: d,
245
+ getRemainingAttempts: l,
246
246
  getTimeUntilReset: g,
247
247
  reset: a
248
248
  } = K({ maxAttempts: 5, windowMs: 12e4 }), h = z(
249
249
  () => new H({
250
- baseUrl: c.serverUrl,
251
- timeoutMs: c.requestTimeout,
252
- retryAttempts: c.retryAttempts
250
+ baseUrl: i.serverUrl,
251
+ timeoutMs: i.requestTimeout,
252
+ retryAttempts: i.retryAttempts
253
253
  }),
254
- [c.serverUrl, c.requestTimeout, c.retryAttempts]
254
+ [i.serverUrl, i.requestTimeout, i.retryAttempts]
255
255
  ), k = E(
256
- async (n, e) => {
256
+ async (c, e) => {
257
257
  const r = /^[A-Z0-9]{16}$/i.test(e) || /^[A-Z0-9]{4}(-[A-Z0-9]{4}){3}$/i.test(e);
258
258
  if (!(/^\d{6}$/.test(e) || r)) {
259
- const d = {
259
+ const n = {
260
260
  code: "VALIDATION_ERROR",
261
261
  message: "Please enter a valid 6-digit code or recovery code"
262
262
  };
263
- throw b(d), d;
263
+ throw b(n), n;
264
264
  }
265
265
  try {
266
- l();
267
- } catch (d) {
268
- const L = {
266
+ d();
267
+ } catch (n) {
268
+ const R = {
269
269
  code: "RATE_LIMITED",
270
- message: d instanceof Error ? d.message : "Too many attempts"
270
+ message: n instanceof Error ? n.message : "Too many attempts"
271
271
  };
272
- throw b(L), L;
272
+ throw b(R), R;
273
273
  }
274
274
  o(!0), b(null), p("verifying");
275
275
  try {
276
- const d = await h.post("/login/mfa", { mfaToken: n, code: e });
277
- return p("success"), a(), m && d.user && d.tokens && m.handleLoginSuccess(d.user, d.tokens), d;
278
- } catch (d) {
279
- const L = P(d, "Incorrect verification code. Please check and try again.");
280
- throw b(L), p("error"), L;
276
+ const n = await h.post("/login/mfa", { mfaToken: c, code: e });
277
+ return p("success"), a(), u && n.user && n.tokens && u.handleLoginSuccess(n.user, n.tokens), n;
278
+ } catch (n) {
279
+ const R = P(n, "Incorrect verification code. Please check and try again.");
280
+ throw b(R), p("error"), R;
281
281
  } finally {
282
282
  o(!1);
283
283
  }
284
284
  },
285
- [h, m, l, a]
285
+ [h, u, d, a]
286
286
  ), N = E(() => b(null), []), y = E(() => {
287
287
  b(null), p("idle"), o(!1);
288
288
  }, []);
289
289
  return {
290
290
  state: C,
291
- isLoading: u,
291
+ isLoading: m,
292
292
  error: v,
293
293
  verifyTotp: k,
294
294
  clearError: N,
295
295
  reset: y,
296
296
  // Point-in-time snapshots for UI display
297
- remainingAttempts: i(),
297
+ remainingAttempts: l(),
298
298
  timeUntilReset: g()
299
299
  };
300
300
  }
301
301
  const T = 6;
302
302
  function ue({
303
- value: c = "",
304
- onChange: m,
303
+ value: i = "",
304
+ onChange: u,
305
305
  onComplete: C,
306
306
  disabled: p = !1,
307
- error: u,
307
+ error: m,
308
308
  autoFocus: o = !1,
309
309
  className: v = ""
310
310
  }) {
311
- const b = F([]), [l, i] = w(c.padEnd(T, "")), g = W();
311
+ const b = F([]), [d, l] = w(i.padEnd(T, "")), g = W();
312
312
  M(() => {
313
- i(c.padEnd(T, ""));
314
- }, [c]);
313
+ l(i.padEnd(T, ""));
314
+ }, [i]);
315
315
  const a = E((e) => {
316
316
  e >= 0 && e < T && b.current[e]?.focus();
317
317
  }, []), h = E(
318
318
  (e) => {
319
319
  const r = e.replace(/\D/g, "").slice(0, T);
320
- i(r.padEnd(T, "")), m?.(r), r.length === T && C?.(r);
320
+ l(r.padEnd(T, "")), u?.(r), r.length === T && C?.(r);
321
321
  },
322
- [m, C]
322
+ [u, C]
323
323
  ), k = E(
324
324
  (e, r) => {
325
325
  if (!/^\d?$/.test(r)) return;
326
- const s = l.split("");
326
+ const s = d.split("");
327
327
  s[e] = r;
328
- const d = s.join("").replace(/ /g, "");
329
- h(d), r && e < T - 1 && a(e + 1);
328
+ const n = s.join("").replace(/ /g, "");
329
+ h(n), r && e < T - 1 && a(e + 1);
330
330
  },
331
- [l, h, a]
331
+ [d, h, a]
332
332
  ), N = E(
333
333
  (e, r) => {
334
334
  if (r.key === "Backspace") {
335
335
  r.preventDefault();
336
- const s = l.split("");
336
+ const s = d.split("");
337
337
  s[e] && s[e] !== " " ? (s[e] = " ", h(s.join("").replace(/ /g, ""))) : e > 0 && (s[e - 1] = " ", h(s.join("").replace(/ /g, "")), a(e - 1));
338
338
  } else r.key === "ArrowLeft" && e > 0 ? (r.preventDefault(), a(e - 1)) : r.key === "ArrowRight" && e < T - 1 && (r.preventDefault(), a(e + 1));
339
339
  },
340
- [l, h, a]
340
+ [d, h, a]
341
341
  ), y = E(
342
342
  (e) => {
343
343
  e.preventDefault();
@@ -345,7 +345,7 @@ function ue({
345
345
  s && (h(s), a(Math.min(s.length, T - 1)));
346
346
  },
347
347
  [h, a]
348
- ), n = E((e) => {
348
+ ), c = E((e) => {
349
349
  e.target.select();
350
350
  }, []);
351
351
  return M(() => {
@@ -362,43 +362,43 @@ function ue({
362
362
  inputMode: "numeric",
363
363
  pattern: "[0-9]*",
364
364
  maxLength: 1,
365
- className: `cedros-otp-slot ${u ? "cedros-otp-slot-error" : ""}`,
366
- value: l[r] === " " ? "" : l[r] || "",
365
+ className: `cedros-otp-slot ${m ? "cedros-otp-slot-error" : ""}`,
366
+ value: d[r] === " " ? "" : d[r] || "",
367
367
  onChange: (s) => k(r, s.target.value),
368
368
  onKeyDown: (s) => N(r, s),
369
369
  onPaste: y,
370
- onFocus: n,
370
+ onFocus: c,
371
371
  disabled: p,
372
372
  autoComplete: "one-time-code",
373
373
  "aria-label": `Digit ${r + 1}`,
374
- "aria-invalid": u ? "true" : void 0
374
+ "aria-invalid": m ? "true" : void 0
375
375
  },
376
376
  r
377
377
  )) }),
378
- u && /* @__PURE__ */ t("p", { className: "cedros-otp-error", role: "alert", children: u })
378
+ m && /* @__PURE__ */ t("p", { className: "cedros-otp-error", role: "alert", children: m })
379
379
  ] });
380
380
  }
381
381
  function me({
382
- mfaToken: c,
383
- email: m,
382
+ mfaToken: i,
383
+ email: u,
384
384
  onSuccess: C,
385
385
  onBack: p,
386
- className: u = ""
386
+ className: m = ""
387
387
  }) {
388
- const { verifyTotp: o, isLoading: v, error: b, clearError: l } = de(), [i, g] = w(""), [a, h] = w(!1), [k, N] = w(""), y = async (r) => {
389
- const s = r || (a ? k : i);
388
+ const { verifyTotp: o, isLoading: v, error: b, clearError: d } = de(), [l, g] = w(""), [a, h] = w(!1), [k, N] = w(""), y = async (r) => {
389
+ const s = r || (a ? k : l);
390
390
  if (s)
391
391
  try {
392
- await o(c, s), C?.();
392
+ await o(i, s), C?.();
393
393
  } catch {
394
394
  a ? N("") : g("");
395
395
  }
396
- }, n = (r) => {
396
+ }, c = (r) => {
397
397
  y(r);
398
398
  }, e = () => {
399
- h(!a), l(), g(""), N("");
399
+ h(!a), d(), g(""), N("");
400
400
  };
401
- return /* @__PURE__ */ f("div", { className: `cedros-totp-verify ${u}`, children: [
401
+ return /* @__PURE__ */ f("div", { className: `cedros-totp-verify ${m}`, children: [
402
402
  /* @__PURE__ */ f("div", { className: "cedros-totp-verify-header", children: [
403
403
  /* @__PURE__ */ f(
404
404
  "svg",
@@ -426,7 +426,7 @@ function me({
426
426
  ),
427
427
  /* @__PURE__ */ t("h3", { className: "cedros-totp-title", children: "Two-factor authentication" }),
428
428
  /* @__PURE__ */ t("p", { className: "cedros-totp-description", children: a ? "Enter one of your recovery codes to sign in." : "Enter the 6-digit code from your authenticator app." }),
429
- m && /* @__PURE__ */ t("p", { className: "cedros-totp-email", children: m })
429
+ u && /* @__PURE__ */ t("p", { className: "cedros-totp-email", children: u })
430
430
  ] }),
431
431
  a ? /* @__PURE__ */ f("div", { className: "cedros-totp-backup-input", children: [
432
432
  /* @__PURE__ */ t(
@@ -437,7 +437,7 @@ function me({
437
437
  placeholder: "Enter recovery code",
438
438
  value: k,
439
439
  onChange: (r) => {
440
- N(r.target.value.toUpperCase()), l();
440
+ N(r.target.value.toUpperCase()), d();
441
441
  },
442
442
  onKeyDown: (r) => {
443
443
  r.key === "Enter" && k && y();
@@ -451,11 +451,11 @@ function me({
451
451
  ] }) : /* @__PURE__ */ t(
452
452
  ue,
453
453
  {
454
- value: i,
454
+ value: l,
455
455
  onChange: (r) => {
456
- g(r), l();
456
+ g(r), d();
457
457
  },
458
- onComplete: n,
458
+ onComplete: c,
459
459
  disabled: v,
460
460
  error: b?.message,
461
461
  autoFocus: !0
@@ -467,8 +467,8 @@ function me({
467
467
  type: "button",
468
468
  className: "cedros-button cedros-button-primary cedros-button-md cedros-button-full",
469
469
  onClick: () => y(),
470
- disabled: v || (a ? !k : i.length !== 6),
471
- children: v ? /* @__PURE__ */ f(R, { children: [
470
+ disabled: v || (a ? !k : l.length !== 6),
471
+ children: v ? /* @__PURE__ */ f(L, { children: [
472
472
  /* @__PURE__ */ t(O, { size: "sm" }),
473
473
  /* @__PURE__ */ t("span", { children: "Verifying..." })
474
474
  ] }) : "Verify"
@@ -485,7 +485,7 @@ function me({
485
485
  children: a ? "Use authenticator app" : "Use a recovery code"
486
486
  }
487
487
  ),
488
- p && /* @__PURE__ */ f(R, { children: [
488
+ p && /* @__PURE__ */ f(L, { children: [
489
489
  /* @__PURE__ */ t("span", { className: "cedros-totp-verify-divider", children: "•" }),
490
490
  /* @__PURE__ */ t(
491
491
  "button",
@@ -502,20 +502,20 @@ function me({
502
502
  ] });
503
503
  }
504
504
  function ke({
505
- onSuccess: c,
506
- onSwitchToRegister: m,
505
+ onSuccess: i,
506
+ onSwitchToRegister: u,
507
507
  onForgotPassword: C,
508
508
  className: p = ""
509
509
  }) {
510
- const { login: u, isLoading: o, error: v, clearError: b } = Z(), [l, i] = w(""), [g, a] = w(""), [h, k] = w(null), [N, y] = w(""), n = async (s) => {
510
+ const { login: m, isLoading: o, error: v, clearError: b } = Z(), [d, l] = w(""), [g, a] = w(""), [h, k] = w(null), [N, y] = w(""), c = async (s) => {
511
511
  s.preventDefault();
512
512
  try {
513
- const d = await u(l, g);
514
- d.mfaRequired ? (k(d.mfaToken), y(d.email)) : c?.();
513
+ const n = await m(d, g);
514
+ n.mfaRequired ? (k(n.mfaToken), y(n.email)) : i?.();
515
515
  } catch {
516
516
  }
517
517
  }, e = () => {
518
- k(null), y(""), c?.();
518
+ k(null), y(""), i?.();
519
519
  }, r = () => {
520
520
  k(null), y(""), a("");
521
521
  };
@@ -528,7 +528,7 @@ function ke({
528
528
  onBack: r,
529
529
  className: p
530
530
  }
531
- ) : /* @__PURE__ */ f("form", { onSubmit: n, className: `cedros-form ${p}`, children: [
531
+ ) : /* @__PURE__ */ f("form", { onSubmit: c, className: `cedros-form ${p}`, children: [
532
532
  /* @__PURE__ */ f("div", { className: "cedros-form-field", children: [
533
533
  /* @__PURE__ */ t("label", { htmlFor: "email", className: "cedros-label", children: "Email" }),
534
534
  /* @__PURE__ */ t(
@@ -537,8 +537,8 @@ function ke({
537
537
  id: "email",
538
538
  type: "email",
539
539
  className: "cedros-input",
540
- value: l,
541
- onChange: (s) => i(s.target.value),
540
+ value: d,
541
+ onChange: (s) => l(s.target.value),
542
542
  placeholder: "you@example.com",
543
543
  required: !0,
544
544
  "aria-required": "true",
@@ -573,27 +573,27 @@ function ke({
573
573
  {
574
574
  type: "submit",
575
575
  className: "cedros-button cedros-button-primary cedros-button-md cedros-button-full",
576
- disabled: o || !l || !g,
576
+ disabled: o || !d || !g,
577
577
  "aria-busy": o,
578
- children: o ? /* @__PURE__ */ f(R, { children: [
578
+ children: o ? /* @__PURE__ */ f(L, { children: [
579
579
  /* @__PURE__ */ t(O, { size: "sm", announce: !0, label: "Signing in" }),
580
580
  /* @__PURE__ */ t("span", { children: "Signing in..." })
581
581
  ] }) : "Sign in"
582
582
  }
583
583
  ),
584
- m && /* @__PURE__ */ f("p", { className: "cedros-form-footer", children: [
584
+ u && /* @__PURE__ */ f("p", { className: "cedros-form-footer", children: [
585
585
  "Don't have an account?",
586
586
  " ",
587
- /* @__PURE__ */ t("button", { type: "button", className: "cedros-link cedros-link-muted", onClick: m, children: "Sign up" })
587
+ /* @__PURE__ */ t("button", { type: "button", className: "cedros-link cedros-link-muted", onClick: u, children: "Sign up" })
588
588
  ] })
589
589
  ] });
590
590
  }
591
591
  function Ce({
592
- onSuccess: c,
593
- onSwitchToLogin: m,
592
+ onSuccess: i,
593
+ onSwitchToLogin: u,
594
594
  className: C = ""
595
595
  }) {
596
- const { config: p } = U(), { register: u, isLoading: o, error: v, clearError: b } = Z(), [l, i] = w(""), [g, a] = w(""), [h, k] = w(""), [N, y] = w(""), [n, e] = w(null), [r, s] = w(null), d = p.forms?.termsOfService, L = p.forms?.emailOptIn, D = d?.show ?? !1, I = d?.required ?? !0, Y = d?.defaultChecked ?? !1, $ = d?.label ?? "I agree to the Terms of Service", G = d?.url, x = ie(G), J = L?.show ?? !1, Q = L?.defaultChecked ?? !1, X = L?.label ?? "Send me updates and news", [S, ee] = w(Y), [te, re] = w(Q), V = h === N, se = n?.isValid ?? !1, _ = g && h && N && V && se && (!D || !I || S) && !o, oe = async (A) => {
596
+ const { config: p } = U(), { register: m, isLoading: o, error: v, clearError: b } = Z(), [d, l] = w(""), [g, a] = w(""), [h, k] = w(""), [N, y] = w(""), [c, e] = w(null), [r, s] = w(null), n = p.forms?.termsOfService, R = p.forms?.emailOptIn, D = n?.show ?? !1, I = n?.required ?? !0, Y = n?.defaultChecked ?? !1, $ = n?.label ?? "I agree to the Terms of Service", G = n?.url, x = ie(G), J = R?.show ?? !1, Q = R?.defaultChecked ?? !1, X = R?.label ?? "Send me updates and news", [S, ee] = w(Y), [te, re] = w(Q), V = h === N, se = c?.isValid ?? !1, _ = g && h && N && V && se && (!D || !I || S) && !o, oe = async (A) => {
597
597
  if (A.preventDefault(), s(null), D && I && !S) {
598
598
  s({
599
599
  code: "VALIDATION_ERROR",
@@ -603,7 +603,7 @@ function Ce({
603
603
  }
604
604
  if (_)
605
605
  try {
606
- await u(g, h, l || void 0), c?.();
606
+ await m(g, h, d || void 0), i?.();
607
607
  } catch {
608
608
  }
609
609
  }, ae = v || r, ne = () => {
@@ -621,8 +621,8 @@ function Ce({
621
621
  id: "name",
622
622
  type: "text",
623
623
  className: "cedros-input",
624
- value: l,
625
- onChange: (A) => i(A.target.value),
624
+ value: d,
625
+ onChange: (A) => l(A.target.value),
626
626
  placeholder: "Your name",
627
627
  autoComplete: "name",
628
628
  disabled: o
@@ -687,7 +687,7 @@ function Ce({
687
687
  }
688
688
  ),
689
689
  /* @__PURE__ */ f("span", { className: "cedros-checkbox-text", children: [
690
- x ? /* @__PURE__ */ f(R, { children: [
690
+ x ? /* @__PURE__ */ f(L, { children: [
691
691
  $.replace("Terms of Service", "").trim() || "I agree to the",
692
692
  " ",
693
693
  /* @__PURE__ */ t(
@@ -725,16 +725,16 @@ function Ce({
725
725
  className: "cedros-button cedros-button-primary cedros-button-md cedros-button-full",
726
726
  disabled: !_,
727
727
  "aria-busy": o,
728
- children: o ? /* @__PURE__ */ f(R, { children: [
728
+ children: o ? /* @__PURE__ */ f(L, { children: [
729
729
  /* @__PURE__ */ t(O, { size: "sm", announce: !0, label: "Creating account" }),
730
730
  /* @__PURE__ */ t("span", { children: "Creating account..." })
731
731
  ] }) : "Create account"
732
732
  }
733
733
  ),
734
- m && /* @__PURE__ */ f("p", { className: "cedros-form-footer", children: [
734
+ u && /* @__PURE__ */ f("p", { className: "cedros-form-footer", children: [
735
735
  "Already have an account?",
736
736
  " ",
737
- /* @__PURE__ */ t("button", { type: "button", className: "cedros-link cedros-link-muted", onClick: m, children: "Sign in" })
737
+ /* @__PURE__ */ t("button", { type: "button", className: "cedros-link cedros-link-muted", onClick: u, children: "Sign in" })
738
738
  ] })
739
739
  ] });
740
740
  }