@alfadocs/ui-kit-debug 1.78.0 → 1.79.0

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 (199) hide show
  1. package/dist/_chunks/{address-fields-BUPRs3n-.js → address-fields-GnoSkvh6.js} +2 -2
  2. package/dist/_chunks/{address-fields-BUPRs3n-.js.map → address-fields-GnoSkvh6.js.map} +1 -1
  3. package/dist/_chunks/{anamnesis-summary-rows-vNDyE5HW.js → anamnesis-summary-rows-lONg-zja.js} +2 -2
  4. package/dist/_chunks/{anamnesis-summary-rows-vNDyE5HW.js.map → anamnesis-summary-rows-lONg-zja.js.map} +1 -1
  5. package/dist/_chunks/{bishop-score-CdbU9Nl4.js → bishop-score-C5di6oAV.js} +2 -2
  6. package/dist/_chunks/{bishop-score-CdbU9Nl4.js.map → bishop-score-C5di6oAV.js.map} +1 -1
  7. package/dist/_chunks/{bmi-calculator-DnfiDh4Q.js → bmi-calculator-BIExHBZV.js} +2 -2
  8. package/dist/_chunks/{bmi-calculator-DnfiDh4Q.js.map → bmi-calculator-BIExHBZV.js.map} +1 -1
  9. package/dist/_chunks/{booking-Cz_QjIJe.js → booking-BV2s2J3C.js} +3 -3
  10. package/dist/_chunks/{booking-Cz_QjIJe.js.map → booking-BV2s2J3C.js.map} +1 -1
  11. package/dist/_chunks/{calendar-appointment-editor-dialog-cvUpUjj-.js → calendar-appointment-editor-dialog-DhTTWgXw.js} +3 -3
  12. package/dist/_chunks/{calendar-appointment-editor-dialog-cvUpUjj-.js.map → calendar-appointment-editor-dialog-DhTTWgXw.js.map} +1 -1
  13. package/dist/_chunks/{cycle-calculator-HO3s5InI.js → cycle-calculator-CQkjVSD2.js} +2 -2
  14. package/dist/_chunks/{cycle-calculator-HO3s5InI.js.map → cycle-calculator-CQkjVSD2.js.map} +1 -1
  15. package/dist/_chunks/{due-date-calculator-CDWTSblh.js → due-date-calculator-NjTlmoFK.js} +2 -2
  16. package/dist/_chunks/{due-date-calculator-CDWTSblh.js.map → due-date-calculator-NjTlmoFK.js.map} +1 -1
  17. package/dist/_chunks/{fetal-weight-CrtBFJl-.js → fetal-weight-Brl3n4LN.js} +2 -2
  18. package/dist/_chunks/{fetal-weight-CrtBFJl-.js.map → fetal-weight-Brl3n4LN.js.map} +1 -1
  19. package/dist/_chunks/{forgot-password-form-BSOZVrZG.js → forgot-password-form-BQPvDS7i.js} +2 -2
  20. package/dist/_chunks/{forgot-password-form-BSOZVrZG.js.map → forgot-password-form-BQPvDS7i.js.map} +1 -1
  21. package/dist/_chunks/form-field-CyHfOVKF.js +185 -0
  22. package/dist/_chunks/form-field-CyHfOVKF.js.map +1 -0
  23. package/dist/_chunks/{gestational-age-calculator-CTHeJJdb.js → gestational-age-calculator-Dr9hdDta.js} +2 -2
  24. package/dist/_chunks/{gestational-age-calculator-CTHeJJdb.js.map → gestational-age-calculator-Dr9hdDta.js.map} +1 -1
  25. package/dist/_chunks/{hcg-doubling-BBk-a33g.js → hcg-doubling-K41Wy7LB.js} +2 -2
  26. package/dist/_chunks/{hcg-doubling-BBk-a33g.js.map → hcg-doubling-K41Wy7LB.js.map} +1 -1
  27. package/dist/_chunks/{help-me-write-templates-Ds1FY-WY.js → help-me-write-templates-BJSf24xS.js} +2 -2
  28. package/dist/_chunks/{help-me-write-templates-Ds1FY-WY.js.map → help-me-write-templates-BJSf24xS.js.map} +1 -1
  29. package/dist/_chunks/key-round-DIgsnJSg.js +21 -0
  30. package/dist/_chunks/key-round-DIgsnJSg.js.map +1 -0
  31. package/dist/_chunks/{kit-extensions-sNTZWkoo.js → kit-extensions-a0G4COFH.js} +6 -6
  32. package/dist/_chunks/{kit-extensions-sNTZWkoo.js.map → kit-extensions-a0G4COFH.js.map} +1 -1
  33. package/dist/_chunks/login-dev-card-CvLHj-_N.js +353 -0
  34. package/dist/_chunks/login-dev-card-CvLHj-_N.js.map +1 -0
  35. package/dist/_chunks/{pregnancy-dating-JBAUbM40.js → pregnancy-dating-BHvfDxz4.js} +2 -2
  36. package/dist/_chunks/{pregnancy-dating-JBAUbM40.js.map → pregnancy-dating-BHvfDxz4.js.map} +1 -1
  37. package/dist/_chunks/{pregnancy-weight-gain--Bqv6AWu.js → pregnancy-weight-gain-BeQRxwdP.js} +2 -2
  38. package/dist/_chunks/{pregnancy-weight-gain--Bqv6AWu.js.map → pregnancy-weight-gain-BeQRxwdP.js.map} +1 -1
  39. package/dist/_chunks/{radiograph-panel.agent-DQh2SX8G.js → radiograph-panel.agent-BQ95uFCd.js} +2 -2
  40. package/dist/_chunks/{radiograph-panel.agent-DQh2SX8G.js.map → radiograph-panel.agent-BQ95uFCd.js.map} +1 -1
  41. package/dist/_chunks/registration-form-CNBfUduG.js +1337 -0
  42. package/dist/_chunks/registration-form-CNBfUduG.js.map +1 -0
  43. package/dist/_chunks/reset-password-form-Cf9QPEJu.js +367 -0
  44. package/dist/_chunks/reset-password-form-Cf9QPEJu.js.map +1 -0
  45. package/dist/_chunks/{send-registration-link-form-__DWY62q.js → send-registration-link-form-vTn1HxjA.js} +2 -2
  46. package/dist/_chunks/{send-registration-link-form-__DWY62q.js.map → send-registration-link-form-vTn1HxjA.js.map} +1 -1
  47. package/dist/_chunks/{task-editor-CRhfwP9T.js → task-editor-Cpw-NmND.js} +2 -2
  48. package/dist/_chunks/{task-editor-CRhfwP9T.js.map → task-editor-Cpw-NmND.js.map} +1 -1
  49. package/dist/_chunks/{unit-converter-D59L-gkf.js → unit-converter-BH5ueIhT.js} +2 -2
  50. package/dist/_chunks/{unit-converter-D59L-gkf.js.map → unit-converter-BH5ueIhT.js.map} +1 -1
  51. package/dist/_chunks/{voice-control-panel-DQJwe6_Q.js → voice-control-panel-BziKE-KK.js} +2 -2
  52. package/dist/_chunks/{voice-control-panel-DQJwe6_Q.js.map → voice-control-panel-BziKE-KK.js.map} +1 -1
  53. package/dist/_chunks/{workflow-webhook-action-BvVPZVpG.js → workflow-webhook-action-DulCpCRz.js} +96 -111
  54. package/dist/_chunks/workflow-webhook-action-DulCpCRz.js.map +1 -0
  55. package/dist/agent-catalog.json +89 -3
  56. package/dist/agent-i18n/en.json +11 -2
  57. package/dist/components/address-fields/index.js +1 -1
  58. package/dist/components/bishop-score/index.js +1 -1
  59. package/dist/components/bmi-calculator/index.js +1 -1
  60. package/dist/components/booking/index.js +1 -1
  61. package/dist/components/cycle-calculator/index.js +1 -1
  62. package/dist/components/due-date-calculator/index.js +1 -1
  63. package/dist/components/fetal-weight/index.js +1 -1
  64. package/dist/components/form-field/form-field.d.ts +6 -0
  65. package/dist/components/form-field/form-field.d.ts.map +1 -1
  66. package/dist/components/form-field/index.js +1 -1
  67. package/dist/components/gestational-age-calculator/index.js +1 -1
  68. package/dist/components/hcg-doubling/index.js +1 -1
  69. package/dist/components/index.d.ts +1 -0
  70. package/dist/components/index.d.ts.map +1 -1
  71. package/dist/components/pregnancy-dating/index.js +1 -1
  72. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  73. package/dist/components/radiograph-panel/index.js +1 -1
  74. package/dist/components/rich-text-editor/index.js +1 -1
  75. package/dist/components/task-editor/index.js +1 -1
  76. package/dist/components/unit-converter/index.js +1 -1
  77. package/dist/components/voice-control-panel/index.js +1 -1
  78. package/dist/i18n/locales/ar.d.ts +26 -0
  79. package/dist/i18n/locales/ar.d.ts.map +1 -1
  80. package/dist/i18n/locales/ar.js +27 -1
  81. package/dist/i18n/locales/ar.js.map +1 -1
  82. package/dist/i18n/locales/de.d.ts +26 -0
  83. package/dist/i18n/locales/de.d.ts.map +1 -1
  84. package/dist/i18n/locales/de.js +27 -1
  85. package/dist/i18n/locales/de.js.map +1 -1
  86. package/dist/i18n/locales/el.d.ts +26 -0
  87. package/dist/i18n/locales/el.d.ts.map +1 -1
  88. package/dist/i18n/locales/el.js +27 -1
  89. package/dist/i18n/locales/el.js.map +1 -1
  90. package/dist/i18n/locales/en.d.ts +26 -0
  91. package/dist/i18n/locales/en.d.ts.map +1 -1
  92. package/dist/i18n/locales/en.js +26 -0
  93. package/dist/i18n/locales/en.js.map +1 -1
  94. package/dist/i18n/locales/es.d.ts +26 -0
  95. package/dist/i18n/locales/es.d.ts.map +1 -1
  96. package/dist/i18n/locales/es.js +27 -1
  97. package/dist/i18n/locales/es.js.map +1 -1
  98. package/dist/i18n/locales/fr.d.ts +26 -0
  99. package/dist/i18n/locales/fr.d.ts.map +1 -1
  100. package/dist/i18n/locales/fr.js +27 -1
  101. package/dist/i18n/locales/fr.js.map +1 -1
  102. package/dist/i18n/locales/hi.d.ts +26 -0
  103. package/dist/i18n/locales/hi.d.ts.map +1 -1
  104. package/dist/i18n/locales/hi.js +27 -1
  105. package/dist/i18n/locales/hi.js.map +1 -1
  106. package/dist/i18n/locales/it.d.ts +26 -0
  107. package/dist/i18n/locales/it.d.ts.map +1 -1
  108. package/dist/i18n/locales/it.js +27 -1
  109. package/dist/i18n/locales/it.js.map +1 -1
  110. package/dist/i18n/locales/ja.d.ts +26 -0
  111. package/dist/i18n/locales/ja.d.ts.map +1 -1
  112. package/dist/i18n/locales/ja.js +27 -1
  113. package/dist/i18n/locales/ja.js.map +1 -1
  114. package/dist/i18n/locales/nl.d.ts +26 -0
  115. package/dist/i18n/locales/nl.d.ts.map +1 -1
  116. package/dist/i18n/locales/nl.js +27 -1
  117. package/dist/i18n/locales/nl.js.map +1 -1
  118. package/dist/i18n/locales/pl.d.ts +26 -0
  119. package/dist/i18n/locales/pl.d.ts.map +1 -1
  120. package/dist/i18n/locales/pl.js +27 -1
  121. package/dist/i18n/locales/pl.js.map +1 -1
  122. package/dist/i18n/locales/pt.d.ts +26 -0
  123. package/dist/i18n/locales/pt.d.ts.map +1 -1
  124. package/dist/i18n/locales/pt.js +27 -1
  125. package/dist/i18n/locales/pt.js.map +1 -1
  126. package/dist/i18n/locales/ro.d.ts +26 -0
  127. package/dist/i18n/locales/ro.d.ts.map +1 -1
  128. package/dist/i18n/locales/ro.js +27 -1
  129. package/dist/i18n/locales/ro.js.map +1 -1
  130. package/dist/i18n/locales/ru.d.ts +26 -0
  131. package/dist/i18n/locales/ru.d.ts.map +1 -1
  132. package/dist/i18n/locales/ru.js +27 -1
  133. package/dist/i18n/locales/ru.js.map +1 -1
  134. package/dist/i18n/locales/sq.d.ts +26 -0
  135. package/dist/i18n/locales/sq.d.ts.map +1 -1
  136. package/dist/i18n/locales/sq.js +27 -1
  137. package/dist/i18n/locales/sq.js.map +1 -1
  138. package/dist/i18n/locales/sv.d.ts +26 -0
  139. package/dist/i18n/locales/sv.d.ts.map +1 -1
  140. package/dist/i18n/locales/sv.js +27 -1
  141. package/dist/i18n/locales/sv.js.map +1 -1
  142. package/dist/i18n/locales/tr.d.ts +26 -0
  143. package/dist/i18n/locales/tr.d.ts.map +1 -1
  144. package/dist/i18n/locales/tr.js +27 -1
  145. package/dist/i18n/locales/tr.js.map +1 -1
  146. package/dist/i18n/locales/zh.d.ts +26 -0
  147. package/dist/i18n/locales/zh.d.ts.map +1 -1
  148. package/dist/i18n/locales/zh.js +27 -1
  149. package/dist/i18n/locales/zh.js.map +1 -1
  150. package/dist/index.js +89 -86
  151. package/dist/index.js.map +1 -1
  152. package/dist/locales/ar.json +27 -1
  153. package/dist/locales/de.json +27 -1
  154. package/dist/locales/el.json +27 -1
  155. package/dist/locales/en.json +26 -0
  156. package/dist/locales/es.json +27 -1
  157. package/dist/locales/fr.json +27 -1
  158. package/dist/locales/hi.json +27 -1
  159. package/dist/locales/it.json +27 -1
  160. package/dist/locales/ja.json +27 -1
  161. package/dist/locales/nl.json +27 -1
  162. package/dist/locales/pl.json +27 -1
  163. package/dist/locales/pt.json +27 -1
  164. package/dist/locales/ro.json +27 -1
  165. package/dist/locales/ru.json +27 -1
  166. package/dist/locales/sq.json +27 -1
  167. package/dist/locales/sv.json +27 -1
  168. package/dist/locales/tr.json +27 -1
  169. package/dist/locales/zh.json +27 -1
  170. package/dist/patterns/_shared/password-policy.d.ts +3 -0
  171. package/dist/patterns/_shared/password-policy.d.ts.map +1 -0
  172. package/dist/patterns/anamnesis/index.js +1 -1
  173. package/dist/patterns/calendar/index.js +1 -1
  174. package/dist/patterns/forgot-password-form/index.js +1 -1
  175. package/dist/patterns/help-me-write-templates/index.js +1 -1
  176. package/dist/patterns/login-form/index.js +1 -1
  177. package/dist/patterns/login-form/login-form.d.ts +24 -7
  178. package/dist/patterns/login-form/login-form.d.ts.map +1 -1
  179. package/dist/patterns/registration-form/index.d.ts +1 -1
  180. package/dist/patterns/registration-form/index.d.ts.map +1 -1
  181. package/dist/patterns/registration-form/index.js +1 -1
  182. package/dist/patterns/registration-form/registration-form.d.ts +27 -0
  183. package/dist/patterns/registration-form/registration-form.d.ts.map +1 -1
  184. package/dist/patterns/reset-password-form/index.d.ts +3 -0
  185. package/dist/patterns/reset-password-form/index.d.ts.map +1 -0
  186. package/dist/patterns/reset-password-form/index.js +6 -0
  187. package/dist/patterns/reset-password-form/index.js.map +1 -0
  188. package/dist/patterns/reset-password-form/reset-password-form.d.ts +108 -0
  189. package/dist/patterns/reset-password-form/reset-password-form.d.ts.map +1 -0
  190. package/dist/patterns/send-registration-link-form/index.js +1 -1
  191. package/dist/patterns/workflow-webhook-action/index.js +1 -1
  192. package/package.json +5 -1
  193. package/dist/_chunks/form-field-Ani72sVY.js +0 -176
  194. package/dist/_chunks/form-field-Ani72sVY.js.map +0 -1
  195. package/dist/_chunks/login-dev-card-DRxTPkE9.js +0 -332
  196. package/dist/_chunks/login-dev-card-DRxTPkE9.js.map +0 -1
  197. package/dist/_chunks/registration-form-xORq2s4p.js +0 -1310
  198. package/dist/_chunks/registration-form-xORq2s4p.js.map +0 -1
  199. package/dist/_chunks/workflow-webhook-action-BvVPZVpG.js.map +0 -1
@@ -1,1310 +0,0 @@
1
- import { jsx as s, jsxs as g, Fragment as er } from "react/jsx-runtime";
2
- import { useState as C, useRef as R, useEffect as S, useCallback as ge, forwardRef as hn, useId as Ce, useMemo as vn, Fragment as gn } from "react";
3
- import { useTranslation as le, Trans as Sr } from "react-i18next";
4
- import { c as V } from "./index-D2ZczOXr.js";
5
- import { parsePhoneNumberFromString as Cn } from "libphonenumber-js/min";
6
- import { i as Ze, E as Er } from "./email-input-C7THAwh2.js";
7
- import { A as ce } from "./alert-9kEwDza3.js";
8
- import { B as oe } from "./button-DohK_Ak_.js";
9
- import { C as kr } from "./card-BA4Ig_kn.js";
10
- import { C as wn } from "./checkbox-BjDv-r3o.js";
11
- import { D as bn } from "./dev-bypass-button-B7ePcJcg.js";
12
- import { E as Nn } from "./error-summary-mGxIyDAY.js";
13
- import { F as z } from "./form-field-Ani72sVY.js";
14
- import { L as Ir } from "./list-CNnn7DOD.js";
15
- import { P as Rr } from "./password-input-BokZ_rnT.js";
16
- import { u as yn } from "./use-password-requirements-C8DdwPEy.js";
17
- import { P as Fn } from "./phone-input-C3NrD-nl.js";
18
- import { R as xn } from "./recaptcha-widget-iglUBIF3.js";
19
- import { S as Sn } from "./select-4S-eYZUf.js";
20
- import { S as Ar } from "./state-backed-text-input-Cgh4ms3p.js";
21
- import { i as Kr } from "./is-development-CLUAnsU7.js";
22
- import { u as Lr } from "./use-state-backed-input-DhRQo6gM.js";
23
- import { a as Xr, i as En } from "./safe-href-5dbsfbQn.js";
24
- import { u as qr } from "./use-field-match-C8ug3sdQ.js";
25
- import { B as kn } from "./brand-mark-DLk9kD8g.js";
26
- import { u as In, b as Rn, a as An } from "./use-registration-submit-CLGHxwoT.js";
27
- import { O as Ln } from "./otp-input-BgEZi0py.js";
28
- import { C as qn } from "./circle-check-BN6rz4NV.js";
29
- import { P as Jr } from "./pencil-B1sKKyuT.js";
30
- import { C as Pn } from "./check-DrFSN__t.js";
31
- import { C as Tn } from "./circle-alert-rGDZ73Wh.js";
32
- const Dn = [
33
- "invalid",
34
- "expired",
35
- "rate_limited",
36
- "error"
37
- ], we = { ok: !1, reason: "error" }, Pr = (n) => typeof n == "number" && Number.isFinite(n) && n >= 0 ? n : void 0;
38
- function Bn(n) {
39
- if (typeof n != "object" || n === null) return null;
40
- const r = n;
41
- if (typeof r.ok != "boolean") return null;
42
- const c = { ok: r.ok };
43
- typeof r.message == "string" && (c.message = r.message), Dn.includes(r.reason) && (c.reason = r.reason);
44
- const t = Pr(r.retryAfterSeconds);
45
- t !== void 0 && (c.retryAfterSeconds = t);
46
- const d = Pr(r.resendAfterSeconds);
47
- return d !== void 0 && (c.resendAfterSeconds = d), typeof r.devCode == "string" && (c.devCode = r.devCode), typeof r.value == "string" && (c.value = r.value), c;
48
- }
49
- function On(n) {
50
- const r = n.headers.get("Retry-After");
51
- if (!(!r || !/^\d+$/.test(r.trim())))
52
- return Number(r.trim());
53
- }
54
- async function Tr(n, r) {
55
- if (!Xr(n))
56
- return Kr() && console.warn(
57
- `RegistrationForm: verification URL "${n}" is not a path or an address on this site, so no request was sent.`
58
- ), we;
59
- try {
60
- const c = await fetch(n, {
61
- method: "POST",
62
- credentials: "same-origin",
63
- headers: {
64
- "Content-Type": "application/json",
65
- Accept: "application/json",
66
- "X-Requested-With": "XMLHttpRequest"
67
- },
68
- body: JSON.stringify(r)
69
- }), t = c.status === 429;
70
- if (!t && (c.status < 200 || c.status >= 500))
71
- return we;
72
- let d = null;
73
- try {
74
- d = await c.json();
75
- } catch {
76
- d = null;
77
- }
78
- const w = Bn(d);
79
- if (t) {
80
- const l = w ?? { ok: !1 }, a = l.retryAfterSeconds ?? On(c) ?? void 0;
81
- return {
82
- ...l,
83
- ok: !1,
84
- reason: "rate_limited",
85
- ...a !== void 0 ? { retryAfterSeconds: a } : {}
86
- };
87
- }
88
- return w ? c.status >= 400 ? w.ok ? we : { ...w, reason: w.reason ?? "error" } : w : we;
89
- } catch {
90
- return we;
91
- }
92
- }
93
- function Dr(n) {
94
- if ("sendUrl" in n && n.sendUrl !== void 0) {
95
- const { sendUrl: r, verifyUrl: c } = n;
96
- return {
97
- onSendCode: (t) => Tr(r, { value: t }),
98
- onVerifyCode: (t, d) => Tr(c, { value: t, code: d })
99
- };
100
- }
101
- return {
102
- onSendCode: n.onSendCode,
103
- onVerifyCode: n.onVerifyCode
104
- };
105
- }
106
- const Br = 6, Mn = 30, Or = (n) => ({
107
- reason: n.reason ?? "error",
108
- message: n.message
109
- });
110
- function Mr({
111
- config: n,
112
- value: r
113
- }) {
114
- const c = (n == null ? void 0 : n.codeLength) ?? Br, [t, d] = C("idle"), [w, l] = C(""), [a, b] = C(
115
- null
116
- ), [ee, N] = C(0), [U, E] = C(), [q, B] = C(""), W = R({ config: n, value: r });
117
- W.current = { config: n, value: r };
118
- const A = R(0), [k] = C(
119
- () => (n == null ? void 0 : n.verified) === !0 ? r : null
120
- ), [G, O] = C(!1), K = (n == null ? void 0 : n.verified) === !0 && !G, X = K || t === "verified", J = R(!1);
121
- S(() => {
122
- var v, p;
123
- t === "verified" && !J.current && (J.current = !0, (p = (v = W.current.config) == null ? void 0 : v.onVerifiedChange) == null || p.call(v, !0));
124
- }, [t]), S(() => {
125
- if (ee <= 0) return;
126
- const v = setTimeout(() => N((p) => p - 1), 1e3);
127
- return () => clearTimeout(v);
128
- }, [ee]);
129
- const I = (v, p) => v.trim().toLowerCase() === p.trim().toLowerCase();
130
- S(() => {
131
- G && k !== null && I(r, k) && O(!1);
132
- }, [r]);
133
- const P = ge(() => {
134
- A.current += 1, d((v) => v === "verified" ? v : "idle"), l(""), b(null), E(void 0), B(""), N(0);
135
- }, []);
136
- S(() => {
137
- t !== "verified" && (t === "sent" || t === "verifying" || t === "sending") && r !== q && P();
138
- }, [r, q, t, P]);
139
- const be = R(r);
140
- S(() => {
141
- be.current !== r && (be.current = r, t === "idle" && b(null));
142
- }, [r, t]);
143
- const Ie = ge(() => {
144
- const { config: v, value: p } = W.current;
145
- if (!v) return;
146
- const te = A.current += 1;
147
- d("sending"), b(null), l(""), B(p), Dr(v).onSendCode(p).then(
148
- (x) => x,
149
- () => ({ ok: !1, reason: "error" })
150
- ).then((x) => {
151
- if (te === A.current) {
152
- if (x.ok) {
153
- d("sent"), E(x.devCode), N(x.resendAfterSeconds ?? Mn);
154
- return;
155
- }
156
- d("idle"), B(""), b(Or(x)), x.reason === "rate_limited" && x.retryAfterSeconds && N(x.retryAfterSeconds);
157
- }
158
- });
159
- }, []), y = ge(
160
- (v) => {
161
- const { config: p, value: te } = W.current;
162
- if (!p) return;
163
- const x = p.codeLength ?? Br, Ne = v ?? w;
164
- if (Ne.length !== x) return;
165
- const Re = A.current += 1;
166
- d("verifying"), b(null), Dr(p).onVerifyCode(te, Ne).then(
167
- (m) => m,
168
- () => ({ ok: !1, reason: "error" })
169
- ).then((m) => {
170
- if (Re === A.current) {
171
- if (m.ok) {
172
- d("verified"), l(""), E(void 0), N(0);
173
- return;
174
- }
175
- d("sent"), l(""), b(Or(m)), m.reason === "rate_limited" && m.retryAfterSeconds && N(m.retryAfterSeconds), m.reason === "expired" && N(0);
176
- }
177
- });
178
- },
179
- [w]
180
- ), me = K && (n == null ? void 0 : n.allowChange) === !0, M = ge(() => {
181
- A.current += 1, O(!0), d("idle"), l(""), b(null), E(void 0), B(""), N(0);
182
- }, []), fe = ge((v) => {
183
- l(v), b((p) => p && null);
184
- }, []);
185
- return {
186
- enabled: n !== void 0,
187
- status: K ? "verified" : t,
188
- verified: X,
189
- codeLength: c,
190
- code: w,
191
- setCode: fe,
192
- failure: a,
193
- cooldown: ee,
194
- devCode: U,
195
- sentTo: q,
196
- send: Ie,
197
- verify: y,
198
- reset: P,
199
- changeable: me,
200
- unlock: M
201
- };
202
- }
203
- function Yr(n) {
204
- const { t: r } = le("ui");
205
- if (n) {
206
- if (n.message) return n.message;
207
- switch (n.reason) {
208
- case "invalid":
209
- return r("registrationForm.verification.invalidCode");
210
- case "expired":
211
- return r("registrationForm.verification.expiredCode");
212
- case "rate_limited":
213
- return r("registrationForm.verification.rateLimited");
214
- default:
215
- return r("registrationForm.verification.sendFailed");
216
- }
217
- }
218
- }
219
- function _r(n) {
220
- const r = Yr(n.failure);
221
- return n.status === "idle" ? r : void 0;
222
- }
223
- function jr({
224
- state: n,
225
- canSend: r
226
- }) {
227
- const { t: c } = le("ui"), t = n.status === "sending";
228
- if (n.status !== "idle" && !t) return null;
229
- const d = n.cooldown > 0;
230
- return /* @__PURE__ */ s(
231
- oe,
232
- {
233
- type: "button",
234
- intent: "secondary",
235
- loading: t,
236
- disabled: !r,
237
- "aria-disabled": d || void 0,
238
- "data-action": "send-code",
239
- className: "ds:shrink-0",
240
- onClick: () => {
241
- d || n.send();
242
- },
243
- children: t ? c("registrationForm.verification.sendingCode") : d ? c("registrationForm.verification.resendIn", {
244
- seconds: n.cooldown
245
- }) : c("registrationForm.verification.sendCode")
246
- }
247
- );
248
- }
249
- function Hr({
250
- field: n,
251
- state: r,
252
- canChange: c = !0,
253
- changeWhenVerified: t = !1,
254
- onUnlocked: d,
255
- onVerified: w
256
- }) {
257
- const { t: l } = le("ui"), a = R(null), b = Yr(r.failure), ee = r.status === "sent" || r.status === "verifying", N = r.status === "verifying", U = r.code.length === r.codeLength, E = () => {
258
- var I, P;
259
- return (P = (I = a.current) == null ? void 0 : I.querySelector("input")) == null ? void 0 : P.focus();
260
- }, q = R(r.status), B = R(r.failure);
261
- S(() => {
262
- const I = q.current;
263
- q.current = r.status, r.status === "sent" && I === "sending" && E(), r.status === "sent" && I === "verifying" && r.failure && E(), r.status === "verified" && I === "verifying" && w();
264
- }, [r.status]), S(() => {
265
- r.failure && r.failure !== B.current && r.status === "sent" && E(), B.current = r.failure;
266
- }, [r.failure, r.status]);
267
- const [W, A] = C(""), k = r.cooldown > 0, G = R(!1);
268
- S(() => {
269
- k && !G.current ? A(
270
- l("registrationForm.verification.resendIn", {
271
- seconds: r.cooldown
272
- })
273
- ) : !k && G.current && A(l("registrationForm.verification.resendCode")), G.current = k;
274
- }, [k, l]);
275
- const O = n === "email", K = O ? l("registrationForm.verification.codeSentEmail", {
276
- value: r.sentTo
277
- }) : l("registrationForm.verification.codeSentPhone", {
278
- value: r.sentTo
279
- }), X = l(O ? "registrationForm.verification.changeEmail" : "registrationForm.verification.changePhone"), J = l(O ? "registrationForm.verification.verifiedEmail" : "registrationForm.verification.verifiedPhone");
280
- return /* @__PURE__ */ g(
281
- "div",
282
- {
283
- ref: a,
284
- "data-slot": "verification",
285
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
286
- children: [
287
- /* @__PURE__ */ s("div", { role: "status", className: r.verified ? void 0 : "ds:sr-only", children: r.verified ? /* @__PURE__ */ g("p", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-success", children: [
288
- /* @__PURE__ */ s(qn, { "aria-hidden": "true", className: "ds:size-4 ds:shrink-0" }),
289
- /* @__PURE__ */ s("span", { children: J })
290
- ] }) : W }),
291
- t && r.changeable && /* @__PURE__ */ s(
292
- oe,
293
- {
294
- type: "button",
295
- intent: "secondary",
296
- startIcon: /* @__PURE__ */ s(Jr, { "aria-hidden": "true" }),
297
- "data-action": "change-value",
298
- className: "ds:self-start",
299
- onClick: () => {
300
- r.unlock(), d == null || d();
301
- },
302
- children: X
303
- }
304
- ),
305
- ee && /* @__PURE__ */ g(er, { children: [
306
- /* @__PURE__ */ s("p", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: K }),
307
- r.devCode && /* @__PURE__ */ s(ce, { variant: "info", announce: "off", children: /* @__PURE__ */ s(ce.Description, { children: l("registrationForm.verification.devCode", {
308
- code: r.devCode
309
- }) }) }),
310
- /* @__PURE__ */ s(
311
- z,
312
- {
313
- label: l("registrationForm.verification.codeLabel"),
314
- error: b,
315
- children: /* @__PURE__ */ s(
316
- Ln,
317
- {
318
- length: r.codeLength,
319
- mode: "numeric",
320
- webOtp: n === "phone",
321
- value: r.code,
322
- onChange: r.setCode,
323
- onComplete: (I) => r.verify(I),
324
- disabled: N
325
- }
326
- )
327
- }
328
- ),
329
- /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
330
- /* @__PURE__ */ s(
331
- oe,
332
- {
333
- type: "button",
334
- intent: "primary",
335
- size: "md",
336
- loading: N,
337
- "aria-disabled": !U || void 0,
338
- "data-action": "verify-code",
339
- onClick: () => {
340
- U && r.verify();
341
- },
342
- children: l(N ? "registrationForm.verification.verifying" : "registrationForm.verification.verify")
343
- }
344
- ),
345
- /* @__PURE__ */ s(
346
- oe,
347
- {
348
- type: "button",
349
- intent: "outline",
350
- size: "md",
351
- disabled: N,
352
- "aria-disabled": k || void 0,
353
- "data-action": "resend-code",
354
- onClick: () => {
355
- k || r.send();
356
- },
357
- children: k ? l("registrationForm.verification.resendIn", {
358
- seconds: r.cooldown
359
- }) : l("registrationForm.verification.resendCode")
360
- }
361
- ),
362
- c && /* @__PURE__ */ s(
363
- oe,
364
- {
365
- type: "button",
366
- intent: "link",
367
- size: "md",
368
- disabled: N,
369
- "data-action": "change-value",
370
- onClick: r.reset,
371
- children: X
372
- }
373
- )
374
- ] })
375
- ] })
376
- ]
377
- }
378
- );
379
- }
380
- function _n({
381
- field: n,
382
- state: r,
383
- onUnlocked: c
384
- }) {
385
- const { t } = le("ui");
386
- return /* @__PURE__ */ g(
387
- "div",
388
- {
389
- "data-slot": "change-slot",
390
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
391
- children: [
392
- /* @__PURE__ */ s(
393
- "span",
394
- {
395
- "aria-hidden": "true",
396
- className: "type-label ds:invisible ds:hidden ds:@[544px]/registration:block",
397
- children: " "
398
- }
399
- ),
400
- /* @__PURE__ */ s(
401
- oe,
402
- {
403
- type: "button",
404
- intent: "secondary",
405
- startIcon: /* @__PURE__ */ s(Jr, { "aria-hidden": "true" }),
406
- "data-action": "change-value",
407
- className: "ds:self-start",
408
- onClick: () => {
409
- r.unlock(), c();
410
- },
411
- children: t(n === "email" ? "registrationForm.verification.changeEmail" : "registrationForm.verification.changePhone")
412
- }
413
- )
414
- ]
415
- }
416
- );
417
- }
418
- const $r = [
419
- "firstName",
420
- "lastName",
421
- "email",
422
- "emailConfirm",
423
- "password",
424
- "passwordConfirm",
425
- "phone",
426
- "branch",
427
- "terms"
428
- ], jn = V(
429
- "ds:@container/registration ds:w-full ds:text-start ds:text-[var(--foreground)]"
430
- ), Hn = V(
431
- "ds:grid ds:grid-cols-1 ds:items-start ds:gap-[var(--spacing-md)]",
432
- {
433
- variants: {
434
- columns: {
435
- /** A field alone in its row takes the full width. */
436
- one: "",
437
- /** Two fields side by side once the card is wide enough. */
438
- two: "ds:@[544px]/registration:grid-cols-2"
439
- }
440
- },
441
- defaultVariants: { columns: "two" }
442
- }
443
- ), $n = V("ds:relative ds:flex ds:gap-[var(--spacing-sm)]", {
444
- variants: {
445
- logo: {
446
- /** A centred column under the mark. */
447
- true: "ds:flex-col ds:items-center",
448
- /** The heading at the start edge, the shortcut at the end. */
449
- false: "ds:items-start ds:justify-between"
450
- }
451
- },
452
- defaultVariants: { logo: !0 }
453
- }), zn = V(
454
- "ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-xs)]",
455
- {
456
- variants: {
457
- centred: { true: "ds:items-center ds:text-center", false: "" }
458
- },
459
- defaultVariants: { centred: !0 }
460
- }
461
- ), Un = V("ds:shrink-0", {
462
- variants: {
463
- corner: { true: "ds:absolute ds:top-0 ds:end-0", false: "" }
464
- },
465
- defaultVariants: { corner: !0 }
466
- }), Wn = V(
467
- "ds:rounded-[var(--radius-sm)] ds:underline ds:underline-offset-4 ds:text-[var(--foreground)] ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
468
- {
469
- variants: {
470
- weight: { normal: "", strong: "ds:font-semibold" }
471
- },
472
- defaultVariants: { weight: "normal" }
473
- }
474
- ), Gn = V(
475
- "ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
476
- ), Kn = V(
477
- "ds:text-destructive ds:ms-[var(--spacing-xs)]"
478
- ), Xn = {
479
- minLength: 12,
480
- uppercase: !0,
481
- lowercase: !0,
482
- digit: !0,
483
- charset: "ascii"
484
- }, Jn = "Alfadocs", Yn = /<(terms|privacy)>([\s\S]*?)<\/\1>/, Qn = /<\/?(?!(?:terms|privacy)\b)[a-z][^>]*>/gi, Ve = (n) => n && En(n) ? n : void 0, zr = (n) => Object.values(n).some(Boolean), Ur = (n) => {
485
- var r;
486
- return ((r = Cn(n)) == null ? void 0 : r.isPossible()) ?? !1;
487
- };
488
- function ke({
489
- href: n,
490
- newTab: r = !1,
491
- weight: c,
492
- action: t,
493
- children: d
494
- }) {
495
- const { t: w } = le("ui");
496
- return /* @__PURE__ */ g(
497
- "a",
498
- {
499
- href: n,
500
- target: r ? "_blank" : void 0,
501
- rel: r ? "noopener noreferrer" : void 0,
502
- "data-action": t,
503
- className: Wn({ weight: c }),
504
- children: [
505
- d,
506
- r && /* @__PURE__ */ s("span", { className: "ds:sr-only", children: w("link.opensInNewTab") })
507
- ]
508
- }
509
- );
510
- }
511
- function Wr({ children: n }) {
512
- return /* @__PURE__ */ s(er, { children: n });
513
- }
514
- function Gr(n) {
515
- if (n.enabled)
516
- return n.verified ? "verified" : n.status === "sent" || n.status === "verifying" ? "sent" : "idle";
517
- }
518
- const Zn = [
519
- ["firstName", "lastName"],
520
- ["email", "emailConfirm"],
521
- ["password", "passwordConfirm"],
522
- ["phone", "branch"]
523
- ];
524
- function Vn(n) {
525
- const r = [];
526
- for (const c of Zn) {
527
- const t = c.filter(n);
528
- if (t.length === 0) continue;
529
- const d = r[r.length - 1];
530
- t.length === 1 && (d == null ? void 0 : d.length) === 1 ? d.push(t[0]) : r.push(t);
531
- }
532
- return r;
533
- }
534
- const es = hn(
535
- ({
536
- title: n,
537
- description: r,
538
- headingLevel: c = 2,
539
- showLogo: t = !0,
540
- logoMotion: d = "assemble",
541
- children: w,
542
- fields: l,
543
- initialValues: a,
544
- errors: b,
545
- emailReadOnly: ee = !1,
546
- emailDescription: N,
547
- blockPaste: U,
548
- blockCopy: E,
549
- branches: q,
550
- passwordPolicy: B = Xn,
551
- termsHref: W,
552
- privacyHref: A,
553
- termsLabel: k,
554
- termsDescription: G,
555
- termsLabelText: O,
556
- termsDescriptionText: K,
557
- notice: X,
558
- benefits: J,
559
- loginHref: I,
560
- recaptchaSiteKey: P,
561
- submitLabel: be,
562
- submitting: Ie = !1,
563
- devBypass: y,
564
- onSubmit: me,
565
- fieldNames: M,
566
- action: fe,
567
- hiddenFields: v,
568
- verification: p,
569
- requireVerification: te = !0,
570
- className: x,
571
- ...Ne
572
- }, Re) => {
573
- const { t: m, i18n: rr } = le("ui"), nr = Ce(), Qr = Ce(), T = (e) => `${Qr}-${e}`, sr = Ce(), or = Ce(), tr = Ce(), Y = M !== void 0, Zr = !!(q && q.length > 0), [Vr] = C(() => !!(a != null && a.email)), Q = ee && Vr, f = (e) => e === "email" || e === "password" ? !0 : l && !l.includes(e) ? !1 : e === "branch" ? Zr : e === "emailConfirm" ? !Q && !pe : !0, [i, Ae] = C(() => ({
574
- firstName: (a == null ? void 0 : a.firstName) ?? "",
575
- lastName: (a == null ? void 0 : a.lastName) ?? "",
576
- email: (a == null ? void 0 : a.email) ?? "",
577
- emailConfirm: (a == null ? void 0 : a.emailConfirm) ?? "",
578
- password: "",
579
- passwordConfirm: "",
580
- phone: (a == null ? void 0 : a.phone) ?? "",
581
- branch: (a == null ? void 0 : a.branch) ?? "",
582
- terms: (a == null ? void 0 : a.terms) ?? !1
583
- })), [Le, ir] = C(
584
- () => Ur((a == null ? void 0 : a.phone) ?? "")
585
- ), [en, qe] = C(() => ({
586
- email: !!(a != null && a.email)
587
- })), [ue, ar] = C(!1), [Pe, Te] = C(
588
- () => b ?? {}
589
- ), _ = Mr({
590
- config: p == null ? void 0 : p.email,
591
- value: i.email
592
- }), re = Mr({
593
- config: f("phone") ? p == null ? void 0 : p.phone : void 0,
594
- value: i.phone
595
- }), pe = _.verified, De = re.verified, ye = $r.filter(f), dr = !Q && pe && _.changeable, Be = te && _.enabled && !pe, Oe = te && re.enabled && !De, rn = _r(_), nn = _r(re), D = (e, o) => {
596
- Ae((u) => ({ ...u, [e]: o })), Te(
597
- (u) => u[e] ? { ...u, [e]: void 0 } : u
598
- );
599
- }, ie = (e) => qe(
600
- (o) => o[e] ? o : { ...o, [e]: !0 }
601
- ), cr = () => {
602
- Ae((e) => ({
603
- ...e,
604
- password: "",
605
- passwordConfirm: ""
606
- })), qe((e) => ({
607
- ...e,
608
- password: !1,
609
- passwordConfirm: !1
610
- }));
611
- }, ae = (e) => ({
612
- blockPaste: (U == null ? void 0 : U.includes(e)) ?? !1,
613
- blockCopy: (E == null ? void 0 : E.includes(e)) ?? !1
614
- }), lr = yn(B), Me = qr({
615
- value: i.email,
616
- confirmValue: i.emailConfirm,
617
- kind: "email",
618
- submitted: ue
619
- }), _e = qr({
620
- value: i.password,
621
- confirmValue: i.passwordConfirm,
622
- kind: "password",
623
- submitted: ue
624
- }), mr = {
625
- firstName: f("firstName") && i.firstName.trim() === "",
626
- lastName: f("lastName") && i.lastName.trim() === "",
627
- // The user cannot fix a locked address, so the server judges it.
628
- email: !Q && !Ze(i.email) || Be,
629
- emailConfirm: f("emailConfirm") && (i.emailConfirm === "" || !Me.matches),
630
- password: i.password === "" || !lr.every((e) => e.test(i.password)),
631
- passwordConfirm: f("passwordConfirm") && (i.passwordConfirm === "" || !_e.matches),
632
- phone: f("phone") && (i.phone === "" || !Le || Oe),
633
- branch: f("branch") && i.branch === "",
634
- terms: f("terms") && !i.terms
635
- }, je = (e) => ue || e !== "terms" && en[e] === !0, j = m("registrationForm.required"), H = {
636
- firstName: m("registrationForm.firstName"),
637
- lastName: m("registrationForm.lastName"),
638
- email: m("registrationForm.email"),
639
- emailConfirm: m("registrationForm.emailConfirm"),
640
- password: m("registrationForm.password"),
641
- passwordConfirm: m("registrationForm.passwordConfirm"),
642
- phone: m("registrationForm.phone"),
643
- branch: m("registrationForm.branch")
644
- }, ne = (e, o) => je(e) && mr[e] ? o : void 0, sn = {
645
- firstName: ne("firstName", j),
646
- lastName: ne("lastName", j),
647
- email: je("email") && !Q && !Ze(i.email) ? i.email === "" ? j : m("inputs.email.invalid") : ue && Be ? m("registrationForm.verification.emailRequired") : void 0,
648
- emailConfirm: i.emailConfirm === "" ? ne("emailConfirm", j) : Me.error,
649
- password: ne(
650
- "password",
651
- i.password === "" ? j : m("registrationForm.passwordInvalid")
652
- ),
653
- passwordConfirm: i.passwordConfirm === "" ? ne("passwordConfirm", j) : _e.error,
654
- phone: je("phone") && f("phone") && (i.phone === "" || !Le) ? i.phone === "" ? j : m("registrationForm.phoneInvalid") : ue && Oe ? m("registrationForm.verification.phoneRequired") : void 0,
655
- branch: ne("branch", j),
656
- terms: ne("terms", m("registrationForm.termsRequired"))
657
- }, on = {
658
- email: rn,
659
- phone: nn
660
- }, L = (e) => Pe[e] ?? on[e] ?? sn[e], se = R({}), $ = vn(() => {
661
- const e = (o) => (u) => {
662
- se.current[o] = u;
663
- };
664
- return {
665
- firstName: e("firstName"),
666
- lastName: e("lastName"),
667
- email: e("email"),
668
- emailConfirm: e("emailConfirm"),
669
- password: e("password"),
670
- passwordConfirm: e("passwordConfirm"),
671
- phone: e("phone"),
672
- branch: e("branch"),
673
- terms: e("terms")
674
- };
675
- }, []), fr = Lr(i.email, $.email), ur = Lr(
676
- i.emailConfirm,
677
- $.emailConfirm
678
- ), pr = R(null), hr = (e) => ye.find((o) => e[o]) ?? (zr(e) ? "form" : void 0), [vr] = C(
679
- () => ye.some((e) => !!(b != null && b[e]))
680
- ), F = In(ye, L, vr), [Fe, He] = C(() => {
681
- const e = vr ? void 0 : hr(b ?? {});
682
- return e ? { target: e } : null;
683
- });
684
- S(() => {
685
- var e, o;
686
- Fe && (Fe.target === "form" ? (e = pr.current) == null || e.focus() : (o = se.current[Fe.target]) == null || o.focus());
687
- }, [Fe]);
688
- const $e = f("phone");
689
- S(() => {
690
- const e = se.current.phone;
691
- if (!$e || !e) return;
692
- const o = () => qe(
693
- (u) => u.phone ? u : { ...u, phone: !0 }
694
- );
695
- return e.addEventListener("blur", o), () => e.removeEventListener("blur", o);
696
- }, [$e]);
697
- const ze = R(null), Ue = R(null), [gr, tn] = C(null);
698
- S(() => {
699
- var e;
700
- gr && ((e = ze.current) == null || e.requestSubmit());
701
- }, [gr]);
702
- const an = () => {
703
- var o;
704
- const e = y == null ? void 0 : y.values;
705
- if (e) {
706
- const u = Q || pe ? void 0 : e.email, h = {};
707
- f("firstName") && e.firstName !== void 0 && (h.firstName = e.firstName), f("lastName") && e.lastName !== void 0 && (h.lastName = e.lastName), u !== void 0 && (h.email = u), f("emailConfirm") && u !== void 0 && (h.emailConfirm = u), e.password !== void 0 && (h.password = e.password), f("passwordConfirm") && e.password !== void 0 && (h.passwordConfirm = e.password), f("phone") && !De && e.phone !== void 0 && (h.phone = e.phone), f("branch") && e.branch !== void 0 && (h.branch = e.branch), f("terms") && e.terms !== void 0 && (h.terms = e.terms), Ae((de) => ({ ...de, ...h })), h.phone !== void 0 && ir(Ur(h.phone)), Te((de) => {
708
- const ve = { ...de };
709
- for (const Ee of Object.keys(h))
710
- ve[Ee] = void 0;
711
- return ve;
712
- }), y.submit && tn({});
713
- }
714
- (o = y == null ? void 0 : y.onClick) == null || o.call(y);
715
- }, he = Rn({
716
- errors: b,
717
- submitting: Ie,
718
- native: Y,
719
- captcha: !!P,
720
- firstProblem: () => ye.find((e) => mr[e]),
721
- onRefused: (e) => {
722
- ar(!0), F.open(() => He({ target: e }));
723
- },
724
- deliver: (e) => {
725
- var u;
726
- if (Y) {
727
- Ue.current && e && (Ue.current.value = e), (u = ze.current) == null || u.submit();
728
- return;
729
- }
730
- const o = (h) => f(h) ? i[h] : "";
731
- me == null || me({
732
- firstName: o("firstName"),
733
- lastName: o("lastName"),
734
- email: i.email,
735
- emailConfirm: o("emailConfirm"),
736
- password: i.password,
737
- passwordConfirm: o("passwordConfirm"),
738
- phone: o("phone"),
739
- branch: o("branch"),
740
- terms: f("terms") && i.terms,
741
- captchaToken: e
742
- });
743
- },
744
- onAnswer: (e) => {
745
- const o = e;
746
- Te(o), zr(o) && (cr(), ar(!1), F.open(() => {
747
- const u = hr(o);
748
- u && He({ target: u });
749
- }));
750
- },
751
- // The page came back from the browser's cache as it was left:
752
- // the passwords must not come back with it.
753
- onRestore: cr
754
- }), { busy: We, captchaFailed: Ge } = he;
755
- S(() => {
756
- Ge && He({ target: "form" });
757
- }, [Ge]);
758
- const Z = (e) => Y ? M[e] : e, dn = `h${c}`, Ke = Ve(W), Xe = Ve(A), Cr = Ve(I), wr = (e) => {
759
- const o = e.replace(Qn, "").split(Yn);
760
- return o.map((u, h) => {
761
- if (h % 3 !== 0) return null;
762
- const de = o[h + 1], ve = o[h + 2], Ee = de === "terms" ? Ke : Xe;
763
- return /* @__PURE__ */ g(gn, { children: [
764
- u,
765
- de === void 0 ? null : Ee ? /* @__PURE__ */ s(ke, { href: Ee, newTab: !0, children: ve }) : ve
766
- ] }, h);
767
- });
768
- }, cn = k ?? (O ? wr(O) : void 0), Je = G ?? (K ? wr(K) : void 0), Ye = (J == null ? void 0 : J.filter(Boolean)) ?? [], ln = !!X || Ye.length > 0 || !!w, mn = Y && fe && Xr(fe) ? fe : void 0, xe = [
769
- Pe.form,
770
- ...$r.filter((e) => !f(e)).map(
771
- (e) => Pe[e]
772
- ),
773
- Ge ? m("inputs.recaptcha.error") : void 0
774
- ].filter(Boolean).join(" ") || void 0, fn = An(
775
- xe,
776
- F.listed.length > 0
777
- ), Se = L("terms"), un = [
778
- Je ? or : void 0,
779
- Se ? sr : void 0
780
- ].filter(Boolean).join(" ") || void 0, br = new Set(Object.values(M ?? {})), Nr = Y ? Object.entries(v ?? {}) : [], Qe = Nr.filter(([e]) => br.has(e)).map(([e]) => e).join(", ");
781
- S(() => {
782
- Qe && Kr() && console.warn(
783
- `RegistrationForm: hiddenFields "${Qe}" is also named in fieldNames and was left out. The form's own field wins.`
784
- );
785
- }, [Qe]);
786
- const yr = Q || pe, Fr = /* @__PURE__ */ s(
787
- Er,
788
- {
789
- ref: fr.ref,
790
- name: Z("email"),
791
- errorMessage: null,
792
- disableBuiltInValidation: yr,
793
- readOnly: yr,
794
- onChange: fr.quiet((e) => D("email", e.target.value)),
795
- onBlur: () => ie("email"),
796
- ...ae("email")
797
- }
798
- ), xr = /* @__PURE__ */ s(
799
- Fn,
800
- {
801
- ref: $.phone,
802
- name: Y ? void 0 : "phone",
803
- value: i.phone,
804
- readOnly: De,
805
- onChange: (e, o) => {
806
- D("phone", e), ir(o.isPossible);
807
- }
808
- }
809
- ), pn = (e) => {
810
- switch (e) {
811
- case "firstName":
812
- return /* @__PURE__ */ s(
813
- z,
814
- {
815
- id: T(e),
816
- label: H.firstName,
817
- required: !0,
818
- error: L("firstName"),
819
- announceError: !F.lists("firstName"),
820
- "data-field": "firstName",
821
- children: /* @__PURE__ */ s(
822
- Ar,
823
- {
824
- ref: $.firstName,
825
- name: Z("firstName"),
826
- autoComplete: "given-name",
827
- value: i.firstName,
828
- onChange: (o) => D("firstName", o.target.value),
829
- onBlur: () => ie("firstName"),
830
- ...ae("firstName")
831
- }
832
- )
833
- },
834
- e
835
- );
836
- case "lastName":
837
- return /* @__PURE__ */ s(
838
- z,
839
- {
840
- id: T(e),
841
- label: H.lastName,
842
- required: !0,
843
- error: L("lastName"),
844
- announceError: !F.lists("lastName"),
845
- "data-field": "lastName",
846
- children: /* @__PURE__ */ s(
847
- Ar,
848
- {
849
- ref: $.lastName,
850
- name: Z("lastName"),
851
- autoComplete: "family-name",
852
- value: i.lastName,
853
- onChange: (o) => D("lastName", o.target.value),
854
- onBlur: () => ie("lastName"),
855
- ...ae("lastName")
856
- }
857
- )
858
- },
859
- e
860
- );
861
- case "email":
862
- return /* @__PURE__ */ s(
863
- z,
864
- {
865
- id: T(e),
866
- label: H.email,
867
- required: !Q,
868
- description: N,
869
- error: L("email"),
870
- announceError: !F.lists("email"),
871
- "data-field": "email",
872
- "data-verification": Gr(_),
873
- children: _.enabled ? /* @__PURE__ */ g("div", { className: "ds:@container/verify ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
874
- /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-sm)] ds:@[384px]/verify:flex-row", children: [
875
- /* @__PURE__ */ s("div", { className: "ds:min-w-0 ds:w-full ds:@[384px]/verify:w-auto ds:@[384px]/verify:flex-1", children: Fr }),
876
- /* @__PURE__ */ s(
877
- jr,
878
- {
879
- state: _,
880
- canSend: Ze(i.email)
881
- }
882
- )
883
- ] }),
884
- /* @__PURE__ */ s(
885
- Hr,
886
- {
887
- field: "email",
888
- state: _,
889
- canChange: !Q,
890
- onVerified: () => {
891
- var o;
892
- return (o = se.current.email) == null ? void 0 : o.focus();
893
- }
894
- }
895
- )
896
- ] }) : Fr
897
- },
898
- e
899
- );
900
- case "emailConfirm":
901
- return dr ? /* @__PURE__ */ s(
902
- _n,
903
- {
904
- field: "email",
905
- state: _,
906
- onUnlocked: () => {
907
- var o;
908
- D("emailConfirm", ""), (o = se.current.email) == null || o.focus();
909
- }
910
- },
911
- e
912
- ) : /* @__PURE__ */ s(
913
- z,
914
- {
915
- id: T(e),
916
- label: H.emailConfirm,
917
- required: !0,
918
- error: L("emailConfirm"),
919
- announceError: !F.lists("emailConfirm"),
920
- "data-field": "emailConfirm",
921
- children: /* @__PURE__ */ s(
922
- Er,
923
- {
924
- ref: ur.ref,
925
- name: Z("emailConfirm"),
926
- disableBuiltInValidation: !0,
927
- onChange: ur.quiet(
928
- (o) => D("emailConfirm", o.target.value)
929
- ),
930
- onBlur: () => {
931
- ie("emailConfirm"), Me.confirmProps.onBlur();
932
- },
933
- ...ae("emailConfirm")
934
- }
935
- )
936
- },
937
- e
938
- );
939
- case "password":
940
- return /* @__PURE__ */ s(
941
- z,
942
- {
943
- id: T(e),
944
- label: H.password,
945
- required: !0,
946
- error: L("password"),
947
- announceError: !F.lists("password"),
948
- "data-field": "password",
949
- children: /* @__PURE__ */ s(
950
- Rr,
951
- {
952
- ref: $.password,
953
- name: Z("password") ?? "",
954
- autoComplete: "new-password",
955
- requirements: lr,
956
- value: i.password,
957
- onChange: (o) => D("password", o.target.value),
958
- onBlur: () => ie("password"),
959
- ...ae("password")
960
- }
961
- )
962
- },
963
- e
964
- );
965
- case "passwordConfirm":
966
- return /* @__PURE__ */ s(
967
- z,
968
- {
969
- id: T(e),
970
- label: H.passwordConfirm,
971
- required: !0,
972
- error: L("passwordConfirm"),
973
- announceError: !F.lists("passwordConfirm"),
974
- "data-field": "passwordConfirm",
975
- children: /* @__PURE__ */ s(
976
- Rr,
977
- {
978
- ref: $.passwordConfirm,
979
- name: Z("passwordConfirm") ?? "",
980
- autoComplete: "new-password",
981
- value: i.passwordConfirm,
982
- onChange: (o) => D("passwordConfirm", o.target.value),
983
- onBlur: () => {
984
- ie("passwordConfirm"), _e.confirmProps.onBlur();
985
- },
986
- ...ae("passwordConfirm")
987
- }
988
- )
989
- },
990
- e
991
- );
992
- case "phone":
993
- return /* @__PURE__ */ s(
994
- z,
995
- {
996
- id: T(e),
997
- label: H.phone,
998
- required: !0,
999
- error: L("phone"),
1000
- announceError: !F.lists("phone"),
1001
- "data-field": "phone",
1002
- "data-verification": Gr(re),
1003
- children: re.enabled ? /* @__PURE__ */ g("div", { className: "ds:@container/verify ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1004
- /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-sm)] ds:@[384px]/verify:flex-row", children: [
1005
- /* @__PURE__ */ s("div", { className: "ds:min-w-0 ds:w-full ds:@[384px]/verify:w-auto ds:@[384px]/verify:flex-1", children: xr }),
1006
- /* @__PURE__ */ s(
1007
- jr,
1008
- {
1009
- state: re,
1010
- canSend: i.phone !== "" && Le
1011
- }
1012
- )
1013
- ] }),
1014
- /* @__PURE__ */ s(
1015
- Hr,
1016
- {
1017
- field: "phone",
1018
- state: re,
1019
- changeWhenVerified: !0,
1020
- onUnlocked: () => {
1021
- var o;
1022
- return (o = se.current.phone) == null ? void 0 : o.focus();
1023
- },
1024
- onVerified: () => {
1025
- var o;
1026
- return (o = se.current.phone) == null ? void 0 : o.focus();
1027
- }
1028
- }
1029
- )
1030
- ] }) : xr
1031
- },
1032
- e
1033
- );
1034
- case "branch":
1035
- return /* @__PURE__ */ s(
1036
- z,
1037
- {
1038
- id: T(e),
1039
- label: H.branch,
1040
- required: !0,
1041
- error: L("branch"),
1042
- announceError: !F.lists("branch"),
1043
- "data-field": "branch",
1044
- children: /* @__PURE__ */ s(
1045
- Sn,
1046
- {
1047
- ref: $.branch,
1048
- name: Z("branch"),
1049
- options: q ?? [],
1050
- value: i.branch,
1051
- onValueChange: (o) => D("branch", o)
1052
- }
1053
- )
1054
- },
1055
- e
1056
- );
1057
- }
1058
- };
1059
- return /* @__PURE__ */ s(
1060
- "div",
1061
- {
1062
- ref: Re,
1063
- ...Ne,
1064
- "data-component": "registration-form",
1065
- className: jn({ className: x }),
1066
- children: /* @__PURE__ */ s(kr, { variant: "elevated", children: /* @__PURE__ */ g(kr.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", children: [
1067
- /* @__PURE__ */ g("div", { className: $n({ logo: t }), children: [
1068
- /* @__PURE__ */ g("div", { className: zn({ centred: t }), children: [
1069
- t && /* @__PURE__ */ s(kn, { motion: d, label: Jn }),
1070
- /* @__PURE__ */ s(dn, { id: nr, className: "type-title-card", children: n ?? m("registrationForm.title") }),
1071
- r && /* @__PURE__ */ s("p", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: r })
1072
- ] }),
1073
- y && (y.values || y.onClick) && /* @__PURE__ */ s("div", { className: Un({ corner: t }), children: /* @__PURE__ */ s(
1074
- bn,
1075
- {
1076
- label: y.label,
1077
- onClick: an
1078
- }
1079
- ) })
1080
- ] }),
1081
- ln ? /* @__PURE__ */ g(
1082
- "div",
1083
- {
1084
- "data-slot": "host-content",
1085
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1086
- children: [
1087
- X ? /* @__PURE__ */ s(ce, { variant: "info", announce: "off", children: /* @__PURE__ */ s(ce.Description, { children: X }) }) : null,
1088
- Ye.length > 0 ? /* @__PURE__ */ s(Ir, { density: "compact", children: Ye.map((e, o) => /* @__PURE__ */ s(
1089
- Ir.Item,
1090
- {
1091
- leading: /* @__PURE__ */ s(Pn, { "aria-hidden": "true" }),
1092
- title: e
1093
- },
1094
- `${o}-${e}`
1095
- )) }) : null,
1096
- w
1097
- ]
1098
- }
1099
- ) : null,
1100
- /* @__PURE__ */ g(
1101
- "form",
1102
- {
1103
- ref: ze,
1104
- noValidate: !0,
1105
- method: "post",
1106
- action: mn,
1107
- "aria-labelledby": nr,
1108
- "aria-busy": We || void 0,
1109
- onSubmit: he.handleSubmit,
1110
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1111
- children: [
1112
- /* @__PURE__ */ s(
1113
- Nn,
1114
- {
1115
- ref: F.ref,
1116
- headingLevel: c + 1,
1117
- "aria-describedby": xe ? tr : void 0,
1118
- errors: F.listed.map((e) => {
1119
- const o = L(e) ?? "";
1120
- return {
1121
- field: e,
1122
- message: o,
1123
- // "This field is required." does not say which field:
1124
- // the summary names it.
1125
- label: o === j && e !== "terms" ? H[e] : void 0,
1126
- targetId: T(e)
1127
- };
1128
- })
1129
- }
1130
- ),
1131
- xe && /* @__PURE__ */ s(
1132
- ce,
1133
- {
1134
- ref: pr,
1135
- id: tr,
1136
- variant: "error",
1137
- announce: fn,
1138
- tabIndex: -1,
1139
- "data-field": "form",
1140
- className: Gn(),
1141
- children: /* @__PURE__ */ s(ce.Description, { children: xe })
1142
- }
1143
- ),
1144
- Vn(
1145
- (e) => e === "emailConfirm" ? f(e) || dr : f(e)
1146
- ).map((e) => /* @__PURE__ */ s(
1147
- "div",
1148
- {
1149
- className: Hn({
1150
- columns: e.length === 2 ? "two" : "one"
1151
- }),
1152
- children: e.map(pn)
1153
- },
1154
- e[0]
1155
- )),
1156
- Y && $e && M.phone && /* @__PURE__ */ s(
1157
- "input",
1158
- {
1159
- type: "hidden",
1160
- name: M.phone,
1161
- value: i.phone
1162
- }
1163
- ),
1164
- Y && M.captcha && /* @__PURE__ */ s(
1165
- "input",
1166
- {
1167
- ref: Ue,
1168
- type: "hidden",
1169
- name: M.captcha,
1170
- defaultValue: ""
1171
- }
1172
- ),
1173
- Nr.filter(([e]) => !br.has(e)).map(([e, o]) => /* @__PURE__ */ s(
1174
- "input",
1175
- {
1176
- type: "hidden",
1177
- name: e,
1178
- value: o
1179
- },
1180
- e
1181
- )),
1182
- f("terms") && /* @__PURE__ */ g(
1183
- "div",
1184
- {
1185
- id: T("terms"),
1186
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1187
- "data-field": "terms",
1188
- children: [
1189
- Je && /* @__PURE__ */ s(
1190
- "p",
1191
- {
1192
- id: or,
1193
- className: "type-body-sm ds:text-[var(--muted-foreground)]",
1194
- children: Je
1195
- }
1196
- ),
1197
- /* @__PURE__ */ s(
1198
- wn,
1199
- {
1200
- ref: $.terms,
1201
- name: Z("terms"),
1202
- value: "1",
1203
- checked: i.terms,
1204
- onCheckedChange: (e) => D("terms", e === !0),
1205
- "aria-required": "true",
1206
- "aria-invalid": Se ? !0 : void 0,
1207
- "aria-describedby": un,
1208
- label: /* @__PURE__ */ g(er, { children: [
1209
- cn ?? /* @__PURE__ */ s(
1210
- Sr,
1211
- {
1212
- i18n: rr,
1213
- ns: "ui",
1214
- i18nKey: "registrationForm.terms",
1215
- components: {
1216
- terms: Ke ? /* @__PURE__ */ s(ke, { href: Ke, newTab: !0 }) : /* @__PURE__ */ s(Wr, {}),
1217
- privacy: Xe ? /* @__PURE__ */ s(ke, { href: Xe, newTab: !0 }) : /* @__PURE__ */ s(Wr, {})
1218
- }
1219
- }
1220
- ),
1221
- /* @__PURE__ */ s(
1222
- "span",
1223
- {
1224
- "aria-hidden": "true",
1225
- className: Kn(),
1226
- children: "*"
1227
- }
1228
- )
1229
- ] })
1230
- }
1231
- ),
1232
- Se && /* @__PURE__ */ g(
1233
- "p",
1234
- {
1235
- id: sr,
1236
- role: F.lists("terms") ? void 0 : "alert",
1237
- "data-slot": "error",
1238
- className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-destructive",
1239
- children: [
1240
- /* @__PURE__ */ s(
1241
- Tn,
1242
- {
1243
- "aria-hidden": "true",
1244
- className: "ds:size-4 ds:shrink-0"
1245
- }
1246
- ),
1247
- /* @__PURE__ */ s("span", { children: Se })
1248
- ]
1249
- }
1250
- )
1251
- ]
1252
- }
1253
- ),
1254
- /* @__PURE__ */ s(
1255
- oe,
1256
- {
1257
- type: "submit",
1258
- intent: "primary",
1259
- size: "lg",
1260
- loading: We,
1261
- className: "ds:w-full",
1262
- "data-action": "submit",
1263
- "aria-disabled": Be || Oe || void 0,
1264
- children: be ?? m("registrationForm.submit")
1265
- }
1266
- ),
1267
- /* @__PURE__ */ s("p", { role: "status", className: "ds:sr-only", children: We ? m("chat.message.status.sending") : "" }),
1268
- Cr && /* @__PURE__ */ s("p", { className: "type-body-sm ds:text-center ds:text-[var(--muted-foreground)]", children: /* @__PURE__ */ s(
1269
- Sr,
1270
- {
1271
- i18n: rr,
1272
- ns: "ui",
1273
- i18nKey: "registrationForm.login",
1274
- components: {
1275
- login: /* @__PURE__ */ s(
1276
- ke,
1277
- {
1278
- href: Cr,
1279
- weight: "strong",
1280
- action: "login"
1281
- }
1282
- )
1283
- }
1284
- }
1285
- ) }),
1286
- P && /* @__PURE__ */ s("div", { className: "ds:absolute", children: /* @__PURE__ */ s(
1287
- xn,
1288
- {
1289
- ref: he.captcha.ref,
1290
- siteKey: P,
1291
- size: "invisible",
1292
- announceStatus: !1,
1293
- onChange: he.captcha.onChange,
1294
- onError: he.captcha.onError
1295
- }
1296
- ) })
1297
- ]
1298
- }
1299
- )
1300
- ] }) })
1301
- }
1302
- );
1303
- }
1304
- );
1305
- es.displayName = "RegistrationForm";
1306
- export {
1307
- $r as R,
1308
- es as a
1309
- };
1310
- //# sourceMappingURL=registration-form-xORq2s4p.js.map