@alfadocs/ui-kit-debug 1.46.0 → 1.47.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 (159) hide show
  1. package/dist/_chunks/booking-C4MwImkS.js +3362 -0
  2. package/dist/_chunks/booking-C4MwImkS.js.map +1 -0
  3. package/dist/_chunks/calendar-workspace-DDnQmiIL.js +12427 -0
  4. package/dist/_chunks/calendar-workspace-DDnQmiIL.js.map +1 -0
  5. package/dist/_chunks/{freemium-paywall-Cz-O9lQD.js → freemium-paywall-BaW5ODc9.js} +2 -2
  6. package/dist/_chunks/{freemium-paywall-Cz-O9lQD.js.map → freemium-paywall-BaW5ODc9.js.map} +1 -1
  7. package/dist/_chunks/{patient-details-DUj1htsH.js → patient-details-yrgkSeEY.js} +2 -2
  8. package/dist/_chunks/{patient-details-DUj1htsH.js.map → patient-details-yrgkSeEY.js.map} +1 -1
  9. package/dist/_chunks/{patient-field-row-CO0WR7yA.js → patient-field-row-DCMkFGqI.js} +2 -2
  10. package/dist/_chunks/{patient-field-row-CO0WR7yA.js.map → patient-field-row-DCMkFGqI.js.map} +1 -1
  11. package/dist/_chunks/{patient-summary-card-DNzdYjxE.js → patient-summary-card-CmEFflGS.js} +2 -2
  12. package/dist/_chunks/{patient-summary-card-DNzdYjxE.js.map → patient-summary-card-CmEFflGS.js.map} +1 -1
  13. package/dist/_chunks/payment-form-DqJFiplX.js +881 -0
  14. package/dist/_chunks/payment-form-DqJFiplX.js.map +1 -0
  15. package/dist/_chunks/{phone-input-BsZIoE36.js → phone-input-IWrGOCwm.js} +40 -39
  16. package/dist/_chunks/{phone-input-BsZIoE36.js.map → phone-input-IWrGOCwm.js.map} +1 -1
  17. package/dist/_chunks/{stepper-accordion-DmVykr5F.js → stepper-accordion-jMR8NaOB.js} +2 -1
  18. package/dist/_chunks/{stepper-accordion-DmVykr5F.js.map → stepper-accordion-jMR8NaOB.js.map} +1 -1
  19. package/dist/agent-catalog.json +5 -4
  20. package/dist/agent-i18n/en.json +2 -2
  21. package/dist/components/booking/booking-types.d.ts +60 -1
  22. package/dist/components/booking/booking-types.d.ts.map +1 -1
  23. package/dist/components/booking/booking.agent.d.ts.map +1 -1
  24. package/dist/components/booking/booking.d.ts +1 -1
  25. package/dist/components/booking/booking.d.ts.map +1 -1
  26. package/dist/components/booking/details-form.d.ts +5 -1
  27. package/dist/components/booking/details-form.d.ts.map +1 -1
  28. package/dist/components/booking/index.d.ts +1 -1
  29. package/dist/components/booking/index.d.ts.map +1 -1
  30. package/dist/components/booking/index.js +1 -1
  31. package/dist/components/booking/payment.d.ts +9 -0
  32. package/dist/components/booking/payment.d.ts.map +1 -0
  33. package/dist/components/booking/use-booking-payment.d.ts +14 -0
  34. package/dist/components/booking/use-booking-payment.d.ts.map +1 -0
  35. package/dist/components/freemium-paywall/index.js +1 -1
  36. package/dist/components/patient-details/index.js +1 -1
  37. package/dist/components/patient-summary-card/index.js +1 -1
  38. package/dist/components/payment-form/index.d.ts +1 -1
  39. package/dist/components/payment-form/index.d.ts.map +1 -1
  40. package/dist/components/payment-form/index.js +1 -1
  41. package/dist/components/payment-form/payment-form.d.ts +35 -3
  42. package/dist/components/payment-form/payment-form.d.ts.map +1 -1
  43. package/dist/components/phone-input/index.js +1 -1
  44. package/dist/components/phone-input/phone-input.d.ts.map +1 -1
  45. package/dist/components/stepper-accordion/index.js +1 -1
  46. package/dist/components/stepper-accordion/stepper-accordion.d.ts.map +1 -1
  47. package/dist/i18n/locales/ar.d.ts +36 -1
  48. package/dist/i18n/locales/ar.d.ts.map +1 -1
  49. package/dist/i18n/locales/ar.js +36 -1
  50. package/dist/i18n/locales/ar.js.map +1 -1
  51. package/dist/i18n/locales/de.d.ts +36 -1
  52. package/dist/i18n/locales/de.d.ts.map +1 -1
  53. package/dist/i18n/locales/de.js +36 -1
  54. package/dist/i18n/locales/de.js.map +1 -1
  55. package/dist/i18n/locales/el.d.ts +36 -1
  56. package/dist/i18n/locales/el.d.ts.map +1 -1
  57. package/dist/i18n/locales/el.js +36 -1
  58. package/dist/i18n/locales/el.js.map +1 -1
  59. package/dist/i18n/locales/en.d.ts +36 -1
  60. package/dist/i18n/locales/en.d.ts.map +1 -1
  61. package/dist/i18n/locales/en.js +36 -1
  62. package/dist/i18n/locales/en.js.map +1 -1
  63. package/dist/i18n/locales/es.d.ts +36 -1
  64. package/dist/i18n/locales/es.d.ts.map +1 -1
  65. package/dist/i18n/locales/es.js +36 -1
  66. package/dist/i18n/locales/es.js.map +1 -1
  67. package/dist/i18n/locales/fr.d.ts +36 -1
  68. package/dist/i18n/locales/fr.d.ts.map +1 -1
  69. package/dist/i18n/locales/fr.js +36 -1
  70. package/dist/i18n/locales/fr.js.map +1 -1
  71. package/dist/i18n/locales/hi.d.ts +36 -1
  72. package/dist/i18n/locales/hi.d.ts.map +1 -1
  73. package/dist/i18n/locales/hi.js +36 -1
  74. package/dist/i18n/locales/hi.js.map +1 -1
  75. package/dist/i18n/locales/it.d.ts +36 -1
  76. package/dist/i18n/locales/it.d.ts.map +1 -1
  77. package/dist/i18n/locales/it.js +36 -1
  78. package/dist/i18n/locales/it.js.map +1 -1
  79. package/dist/i18n/locales/ja.d.ts +36 -1
  80. package/dist/i18n/locales/ja.d.ts.map +1 -1
  81. package/dist/i18n/locales/ja.js +36 -1
  82. package/dist/i18n/locales/ja.js.map +1 -1
  83. package/dist/i18n/locales/nl.d.ts +36 -1
  84. package/dist/i18n/locales/nl.d.ts.map +1 -1
  85. package/dist/i18n/locales/nl.js +36 -1
  86. package/dist/i18n/locales/nl.js.map +1 -1
  87. package/dist/i18n/locales/pl.d.ts +36 -1
  88. package/dist/i18n/locales/pl.d.ts.map +1 -1
  89. package/dist/i18n/locales/pl.js +36 -1
  90. package/dist/i18n/locales/pl.js.map +1 -1
  91. package/dist/i18n/locales/pt.d.ts +36 -1
  92. package/dist/i18n/locales/pt.d.ts.map +1 -1
  93. package/dist/i18n/locales/pt.js +36 -1
  94. package/dist/i18n/locales/pt.js.map +1 -1
  95. package/dist/i18n/locales/ro.d.ts +36 -1
  96. package/dist/i18n/locales/ro.d.ts.map +1 -1
  97. package/dist/i18n/locales/ro.js +36 -1
  98. package/dist/i18n/locales/ro.js.map +1 -1
  99. package/dist/i18n/locales/ru.d.ts +36 -1
  100. package/dist/i18n/locales/ru.d.ts.map +1 -1
  101. package/dist/i18n/locales/ru.js +36 -1
  102. package/dist/i18n/locales/ru.js.map +1 -1
  103. package/dist/i18n/locales/sq.d.ts +36 -1
  104. package/dist/i18n/locales/sq.d.ts.map +1 -1
  105. package/dist/i18n/locales/sq.js +36 -1
  106. package/dist/i18n/locales/sq.js.map +1 -1
  107. package/dist/i18n/locales/sv.d.ts +36 -1
  108. package/dist/i18n/locales/sv.d.ts.map +1 -1
  109. package/dist/i18n/locales/sv.js +36 -1
  110. package/dist/i18n/locales/sv.js.map +1 -1
  111. package/dist/i18n/locales/tr.d.ts +36 -1
  112. package/dist/i18n/locales/tr.d.ts.map +1 -1
  113. package/dist/i18n/locales/tr.js +36 -1
  114. package/dist/i18n/locales/tr.js.map +1 -1
  115. package/dist/i18n/locales/zh.d.ts +36 -1
  116. package/dist/i18n/locales/zh.d.ts.map +1 -1
  117. package/dist/i18n/locales/zh.js +36 -1
  118. package/dist/i18n/locales/zh.js.map +1 -1
  119. package/dist/index.js +8 -8
  120. package/dist/locales/ar.json +36 -1
  121. package/dist/locales/de.json +36 -1
  122. package/dist/locales/el.json +36 -1
  123. package/dist/locales/en.json +36 -1
  124. package/dist/locales/es.json +36 -1
  125. package/dist/locales/fr.json +36 -1
  126. package/dist/locales/hi.json +36 -1
  127. package/dist/locales/it.json +36 -1
  128. package/dist/locales/ja.json +36 -1
  129. package/dist/locales/nl.json +36 -1
  130. package/dist/locales/pl.json +36 -1
  131. package/dist/locales/pt.json +36 -1
  132. package/dist/locales/ro.json +36 -1
  133. package/dist/locales/ru.json +36 -1
  134. package/dist/locales/sq.json +36 -1
  135. package/dist/locales/sv.json +36 -1
  136. package/dist/locales/tr.json +36 -1
  137. package/dist/locales/zh.json +36 -1
  138. package/dist/patterns/calendar/calendar-bookings-panel.d.ts.map +1 -1
  139. package/dist/patterns/calendar/calendar-editor-fields.d.ts +33 -0
  140. package/dist/patterns/calendar/calendar-editor-fields.d.ts.map +1 -0
  141. package/dist/patterns/calendar/calendar-sticky-offset.d.ts +20 -0
  142. package/dist/patterns/calendar/calendar-sticky-offset.d.ts.map +1 -0
  143. package/dist/patterns/calendar/calendar-task-editor.d.ts.map +1 -1
  144. package/dist/patterns/calendar/calendar-workspace.d.ts.map +1 -1
  145. package/dist/patterns/calendar/calendar.data.d.ts +17 -0
  146. package/dist/patterns/calendar/calendar.data.d.ts.map +1 -1
  147. package/dist/patterns/calendar/calendar.sheets.d.ts.map +1 -1
  148. package/dist/patterns/calendar/calendar.surface.d.ts.map +1 -1
  149. package/dist/patterns/calendar/calendar.types.d.ts +24 -10
  150. package/dist/patterns/calendar/calendar.types.d.ts.map +1 -1
  151. package/dist/patterns/calendar/index.js +1 -1
  152. package/dist/tokens.css +1 -1
  153. package/package.json +1 -1
  154. package/dist/_chunks/booking-B7gA9gFB.js +0 -3017
  155. package/dist/_chunks/booking-B7gA9gFB.js.map +0 -1
  156. package/dist/_chunks/calendar-workspace-BB-BZT7W.js +0 -12251
  157. package/dist/_chunks/calendar-workspace-BB-BZT7W.js.map +0 -1
  158. package/dist/_chunks/payment-form-BHMDqW9C.js +0 -767
  159. package/dist/_chunks/payment-form-BHMDqW9C.js.map +0 -1
@@ -0,0 +1,3362 @@
1
+ import { jsxs as b, jsx as s, Fragment as ce } from "react/jsx-runtime";
2
+ import { forwardRef as Zt, useId as gt, useRef as E, useState as ie, useCallback as ke, useEffect as z, useMemo as M, useImperativeHandle as Ds } from "react";
3
+ import { c as ht } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as q, Trans as Ms } from "react-i18next";
5
+ import { u as Ts } from "./registry-DvAUVLHh.js";
6
+ import { A as X } from "./alert-CiQ5Pa3Q.js";
7
+ import { B as Ve } from "./button-CaUe1uyd.js";
8
+ import { C as et } from "./checkbox-CZkipDn7.js";
9
+ import { C as Os } from "./checkbox-group-DomUzpkF.js";
10
+ import { D as Bs } from "./date-picker-6tFnKFty.js";
11
+ import { E as _s } from "./email-input-Dpe63k0K.js";
12
+ import { F as Be } from "./form-field-CahJzTxp.js";
13
+ import { P as Rs } from "./phone-input-IWrGOCwm.js";
14
+ import { T as Es } from "./text-area-Bt3p7Pt0.js";
15
+ import { T as ot } from "./text-input-CUvCb6ST.js";
16
+ import { S as Xt } from "./spinner-hbwuKwMf.js";
17
+ import { a as st } from "./format-price-DAbh61Lz.js";
18
+ import { B as Qt } from "./badge-BudgzTe_.js";
19
+ import { I as qt } from "./icon-button-CehAeZoP.js";
20
+ import { S as vt } from "./select-CLSUnKjF.js";
21
+ import { C as wt } from "./combobox-DnSdYssy.js";
22
+ import { M as Ct } from "./multi-select-CtPd7g4x.js";
23
+ import { S as mt } from "./skeleton-B1KTdJ4N.js";
24
+ import { E as es } from "./empty-state-BUN_UAWf.js";
25
+ import { S as Ls } from "./stepper-accordion-jMR8NaOB.js";
26
+ import { S as Ps } from "./stepper-progress-Bv0njx4g.js";
27
+ import { S as Fs } from "./slot-grid-B3eOPkKD.js";
28
+ import { p as le } from "./parseISO-fOGpHKXm.js";
29
+ import { C as Vs } from "./chevron-down-DWE7GSq9.js";
30
+ import { l as qe, f as pt, b as Jt } from "./format-4HNwNGrN.js";
31
+ import { w as ts, c as Je, a as xt, i as $s, s as tt, l as Ks, x as dt } from "./date-picker-variants-B9NLAfUK.js";
32
+ import { s as zs } from "./subDays-HPvBuvq3.js";
33
+ import { C as js } from "./chevron-left-B8cOyH-V.js";
34
+ import { C as qs } from "./chevron-right-I9AeSxH2.js";
35
+ import { c as he } from "./createLucideIcon-DhHxpK9K.js";
36
+ import { M as Js, S as Hs } from "./sun-Bj9Mr553.js";
37
+ import { S as Gs } from "./stethoscope-sZXGC43m.js";
38
+ import { H as Us } from "./heart-pulse-BCppJyN2.js";
39
+ import { E as Ys } from "./eye-BjhN2nYf.js";
40
+ import { B as Ws } from "./baby-Dku-Xvg9.js";
41
+ import { S as Zs } from "./scan-line-CNseIHQ0.js";
42
+ import { A as Xs } from "./astroid-BN4f5VXU.js";
43
+ import { C as Qs } from "./clipboard-check-BeAGxDVT.js";
44
+ /**
45
+ * @license lucide-react v1.22.0 - ISC
46
+ *
47
+ * This source code is licensed under the ISC license.
48
+ * See the LICENSE file in the root directory of this source tree.
49
+ */
50
+ const en = [
51
+ [
52
+ "path",
53
+ {
54
+ d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
55
+ key: "169zse"
56
+ }
57
+ ]
58
+ ], tn = he("activity", en);
59
+ /**
60
+ * @license lucide-react v1.22.0 - ISC
61
+ *
62
+ * This source code is licensed under the ISC license.
63
+ * See the LICENSE file in the root directory of this source tree.
64
+ */
65
+ const sn = [
66
+ [
67
+ "path",
68
+ {
69
+ d: "M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",
70
+ key: "w610uw"
71
+ }
72
+ ]
73
+ ], nn = he("bone", sn);
74
+ /**
75
+ * @license lucide-react v1.22.0 - ISC
76
+ *
77
+ * This source code is licensed under the ISC license.
78
+ * See the LICENSE file in the root directory of this source tree.
79
+ */
80
+ const an = [
81
+ ["path", { d: "M12 18V5", key: "adv99a" }],
82
+ ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
83
+ ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
84
+ ["path", { d: "M17.997 5.125a4 4 0 0 1 2.526 5.77", key: "iwvgf7" }],
85
+ ["path", { d: "M18 18a4 4 0 0 0 2-7.464", key: "efp6ie" }],
86
+ ["path", { d: "M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517", key: "1gq6am" }],
87
+ ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
88
+ ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
89
+ ], rn = he("brain", an);
90
+ /**
91
+ * @license lucide-react v1.22.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */
96
+ const on = [
97
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
98
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
99
+ ["path", { d: "M3 10h18", key: "8toen8" }],
100
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
101
+ ["path", { d: "M17 14h-6", key: "bkmgh3" }],
102
+ ["path", { d: "M13 18H7", key: "bb0bb7" }],
103
+ ["path", { d: "M7 14h.01", key: "1qa3f1" }],
104
+ ["path", { d: "M17 18h.01", key: "1bdyru" }]
105
+ ], dn = he("calendar-range", on);
106
+ /**
107
+ * @license lucide-react v1.22.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */
112
+ const cn = [
113
+ ["path", { d: "M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0", key: "1dfaln" }],
114
+ ["path", { d: "M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4", key: "1qnva7" }]
115
+ ], ln = he("ear", cn);
116
+ /**
117
+ * @license lucide-react v1.22.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */
122
+ const un = [
123
+ ["path", { d: "M6 18h8", key: "1borvv" }],
124
+ ["path", { d: "M3 22h18", key: "8prr45" }],
125
+ ["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
126
+ ["path", { d: "M9 14h2", key: "197e7h" }],
127
+ ["path", { d: "M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z", key: "1bmzmy" }],
128
+ ["path", { d: "M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3", key: "1drr47" }]
129
+ ], pn = he("microscope", un);
130
+ /**
131
+ * @license lucide-react v1.22.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */
136
+ const mn = [
137
+ [
138
+ "path",
139
+ { d: "m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z", key: "wa1lgi" }
140
+ ],
141
+ ["path", { d: "m8.5 8.5 7 7", key: "rvfmvr" }]
142
+ ], fn = he("pill", mn);
143
+ /**
144
+ * @license lucide-react v1.22.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */
149
+ const gn = [
150
+ ["circle", { cx: "6", cy: "6", r: "3", key: "1lh9wr" }],
151
+ ["path", { d: "M8.12 8.12 12 12", key: "1alkpv" }],
152
+ ["path", { d: "M20 4 8.12 15.88", key: "xgtan2" }],
153
+ ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
154
+ ["path", { d: "M14.8 14.8 20 20", key: "ptml3r" }]
155
+ ], hn = he("scissors", gn);
156
+ /**
157
+ * @license lucide-react v1.22.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */
162
+ const vn = [
163
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
164
+ ["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
165
+ ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
166
+ ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
167
+ ], bn = he("smile", vn);
168
+ /**
169
+ * @license lucide-react v1.22.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */
174
+ const yn = [
175
+ ["path", { d: "M12 10V2", key: "16sf7g" }],
176
+ ["path", { d: "m4.93 10.93 1.41 1.41", key: "2a7f42" }],
177
+ ["path", { d: "M2 18h2", key: "j10viu" }],
178
+ ["path", { d: "M20 18h2", key: "wocana" }],
179
+ ["path", { d: "m19.07 10.93-1.41 1.41", key: "15zs5n" }],
180
+ ["path", { d: "M22 22H2", key: "19qnx5" }],
181
+ ["path", { d: "m16 6-4 4-4-4", key: "6wukr" }],
182
+ ["path", { d: "M16 18a4 4 0 0 0-8 0", key: "1lzouq" }]
183
+ ], kn = he("sunset", yn);
184
+ /**
185
+ * @license lucide-react v1.22.0 - ISC
186
+ *
187
+ * This source code is licensed under the ISC license.
188
+ * See the LICENSE file in the root directory of this source tree.
189
+ */
190
+ const Sn = [
191
+ ["path", { d: "m18 2 4 4", key: "22kx64" }],
192
+ ["path", { d: "m17 7 3-3", key: "1w1zoj" }],
193
+ ["path", { d: "M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5", key: "1exhtz" }],
194
+ ["path", { d: "m9 11 4 4", key: "rovt3i" }],
195
+ ["path", { d: "m5 19-3 3", key: "59f2uf" }],
196
+ ["path", { d: "m14 4 6 6", key: "yqp9t2" }]
197
+ ], Ht = he("syringe", Sn);
198
+ function xn(e, t, n) {
199
+ return ts(e, -1, n);
200
+ }
201
+ const In = {
202
+ id: "booking",
203
+ // `view_change` removed (0.69): the layout `variant` is a fixed prop — the
204
+ // handle exposes only `getVariant` (state), no action mutates it. The flow's
205
+ // only navigation is step-to-step (`goto_step` → `navigate`).
206
+ capabilities: ["navigate"],
207
+ state: {
208
+ variant: {
209
+ type: "string",
210
+ descriptionKey: "ui.agent.booking.state.variant",
211
+ description: "Active variant — one of `inline-list`, `accordion`, `calendar`, `flexible`, `progress`.",
212
+ read: (e) => e.getVariant()
213
+ },
214
+ currentStep: {
215
+ type: "number",
216
+ descriptionKey: "ui.agent.booking.state.currentStep",
217
+ description: "The step the flow is on — 1 insurance, 2 specialty, 3 service, 4 provider, 5 date, 6 time, 7 patient details, 8 confirmation (after a successful submit). Read this back after `goto_step` to see where the clamp landed.",
218
+ read: (e) => e.getCurrentStep()
219
+ }
220
+ },
221
+ actions: {
222
+ reset: {
223
+ // destructive: clears the whole in-progress booking value (patient
224
+ // identity, contact, slot choice) — irreversibly loses user input.
225
+ safety: "destructive",
226
+ idempotent: !0,
227
+ descriptionKey: "ui.agent.booking.actions.reset",
228
+ description: "Clear the booking value back to an empty state. Use to abandon an in-progress flow.",
229
+ errors: [
230
+ "Resetting after submit has no effect — the flow is on step 8.",
231
+ "Refused while a payment session is open (step 7): the consumer must cancel the hold first."
232
+ ],
233
+ invoke: (e) => {
234
+ e.reset();
235
+ }
236
+ },
237
+ goto_step: {
238
+ safety: "read",
239
+ argsType: "{ step: 1 | 2 | 3 | 4 | 5 | 6 | 7 }",
240
+ argsSchema: {
241
+ type: "object",
242
+ properties: {
243
+ step: {
244
+ type: "integer",
245
+ enum: [1, 2, 3, 4, 5, 6, 7],
246
+ description: "Target step (1-7)."
247
+ }
248
+ },
249
+ required: ["step"]
250
+ },
251
+ idempotent: !0,
252
+ descriptionKey: "ui.agent.booking.actions.gotoStep",
253
+ description: "Jump to the given step. A step that is hidden for this practice, or that sits ahead of the first incomplete step, clamps to that first incomplete step — read `currentStep` back to see where it landed.",
254
+ errors: [
255
+ "Requested step is not yet reachable — clamped to the first incomplete step.",
256
+ "Requested step is hidden for this practice (e.g. insurance outside Germany, or provider choice turned off) — clamped to the first incomplete step."
257
+ ],
258
+ examples: [{ args: { step: 1 }, note: "Return to the first step." }],
259
+ invoke: (e, t) => {
260
+ e.goToStep(t.step);
261
+ }
262
+ }
263
+ },
264
+ domHooks: {
265
+ root: {
266
+ attr: "data-component",
267
+ value: "booking",
268
+ description: "Marks the Booking root region."
269
+ },
270
+ instanceId: {
271
+ attr: "data-component-id",
272
+ sourceProp: "id",
273
+ description: "Sourced from the id prop."
274
+ }
275
+ }
276
+ }, Nt = [
277
+ "email",
278
+ "whatsapp",
279
+ "sms"
280
+ ], ge = "all", Nn = "de";
281
+ function wn(e) {
282
+ const t = e.lockedOperatorId;
283
+ return [...t ? e.operatorsByService ? e.specialties.filter(
284
+ (i) => e.services.some(
285
+ (a) => {
286
+ var r;
287
+ return a.specialtyId === i.id && ((r = a.operatorIds) == null ? void 0 : r.includes(t));
288
+ }
289
+ )
290
+ ) : e.specialties.filter((i) => {
291
+ var a;
292
+ return (a = i.operatorIds) == null ? void 0 : a.includes(t);
293
+ }) : e.specialties].sort((i, a) => {
294
+ const r = i.sequenceNumber ?? Number.POSITIVE_INFINITY, c = a.sequenceNumber ?? Number.POSITIVE_INFINITY;
295
+ return r - c;
296
+ });
297
+ }
298
+ function Cn(e) {
299
+ let t = e.services;
300
+ if (e.lockedOperatorId && (t = t.filter(
301
+ (i) => {
302
+ var a;
303
+ return (a = i.operatorIds) == null ? void 0 : a.includes(e.lockedOperatorId);
304
+ }
305
+ )), e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) {
306
+ const i = Ce(e.value);
307
+ i.length > 0 && (t = t.filter(
308
+ (a) => a.specialtyId !== void 0 && i.includes(a.specialtyId)
309
+ ));
310
+ }
311
+ return t;
312
+ }
313
+ function An(e) {
314
+ const t = e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties, n = Se(e.value);
315
+ if ((!t || e.operatorsByService) && n.length > 0)
316
+ return e.operators.filter(
317
+ (i) => {
318
+ var a;
319
+ return (a = i.appointmentBookingReasonIds) == null ? void 0 : a.some((r) => n.includes(r));
320
+ }
321
+ );
322
+ if (t) {
323
+ const i = Ce(e.value);
324
+ if (i.length > 0)
325
+ return e.operators.filter(
326
+ (a) => {
327
+ var r;
328
+ return (r = a.specialtyIds) == null ? void 0 : r.some((c) => i.includes(c));
329
+ }
330
+ );
331
+ }
332
+ return [];
333
+ }
334
+ function Dn(e, t) {
335
+ const n = e.country === Nn, i = !n || e.value.insuranceType !== void 0, r = (e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) && i, c = Ce(e.value).length > 0, f = !r || c, u = Se(e.value).length > 0, g = !f || u, o = t.operators, p = !!e.allowOperatorSelection && g && u && !e.lockedOperatorId && o.length > 1, m = g && u, y = (!m || e.value.date !== void 0) && e.value.date !== void 0, _ = (!y || e.value.slotKey !== void 0) && e.value.slotKey !== void 0, I = u && o.length === 0;
336
+ return {
337
+ insurance: n,
338
+ specialty: r,
339
+ service: f,
340
+ operator: p,
341
+ date: m,
342
+ slot: y,
343
+ details: _,
344
+ onboardingIncomplete: I
345
+ };
346
+ }
347
+ function Mn(e, t) {
348
+ const n = [];
349
+ t.insurance && n.push(1), t.specialty && n.push(2), n.push(3), t.operator && n.push(4), n.push(5), n.push(6), n.push(7);
350
+ const i = {
351
+ 1: e.value.insuranceType !== void 0,
352
+ // 0.34.0: array-or-single — satisfied when EITHER form is present.
353
+ 2: Ce(e.value).length > 0,
354
+ 3: Se(e.value).length > 0,
355
+ 4: e.value.operatorId !== void 0 || e.value.operatorIds !== void 0 && e.value.operatorIds.length > 0,
356
+ 5: e.value.date !== void 0,
357
+ 6: e.value.slotKey !== void 0,
358
+ 7: !1
359
+ // details fulfilment is owned by the form's own validation
360
+ };
361
+ return {
362
+ currentStep: n.find((r) => !i[r]) ?? 7,
363
+ visibleSteps: n
364
+ };
365
+ }
366
+ function Tn(e) {
367
+ const t = {
368
+ specialties: wn(e),
369
+ services: Cn(e),
370
+ operators: An(e)
371
+ }, n = Dn(e, t), { currentStep: i, visibleSteps: a } = Mn(e, n);
372
+ let r;
373
+ if (e.value.date && e.value.slotKey) {
374
+ const g = e.availableSlots[e.value.date];
375
+ g && (r = g.find((o) => o.key === e.value.slotKey));
376
+ }
377
+ const c = Se(e.value), l = c.length > 0 ? e.services.find((g) => g.id === c[0]) : void 0, f = Ce(e.value).length > 0, u = c.length > 0 && e.value.date !== void 0 && e.value.slotKey !== void 0 && (!n.insurance || e.value.insuranceType !== void 0) && (!n.specialty || f);
378
+ return {
379
+ gates: n,
380
+ filtered: t,
381
+ currentStep: i,
382
+ totalSteps: a.length,
383
+ visibleSteps: a,
384
+ isReadyToSubmit: u,
385
+ durationMin: l == null ? void 0 : l.durationMin,
386
+ selectedSlot: r
387
+ };
388
+ }
389
+ function ss(e, t) {
390
+ return {
391
+ ...e,
392
+ insuranceType: t,
393
+ specialtyId: void 0,
394
+ serviceId: void 0,
395
+ operatorId: void 0,
396
+ date: void 0,
397
+ slotKey: void 0,
398
+ details: void 0
399
+ };
400
+ }
401
+ function ns(e, t) {
402
+ return {
403
+ ...e,
404
+ specialtyId: t,
405
+ specialtyIds: void 0,
406
+ serviceId: void 0,
407
+ serviceIds: void 0,
408
+ operatorId: void 0,
409
+ operatorIds: void 0,
410
+ date: void 0,
411
+ slotKey: void 0,
412
+ details: void 0
413
+ };
414
+ }
415
+ function is(e, t) {
416
+ return {
417
+ ...e,
418
+ specialtyId: void 0,
419
+ specialtyIds: t,
420
+ serviceId: void 0,
421
+ serviceIds: void 0,
422
+ operatorId: void 0,
423
+ operatorIds: void 0,
424
+ date: void 0,
425
+ slotKey: void 0,
426
+ details: void 0
427
+ };
428
+ }
429
+ function as(e, t) {
430
+ return {
431
+ ...e,
432
+ serviceId: t,
433
+ serviceIds: void 0,
434
+ // Default the operator to the "All operators" sentinel so a patient
435
+ // who doesn't care about picking lands on a satisfied step 4 without
436
+ // any further input.
437
+ operatorId: t ? ge : void 0,
438
+ operatorIds: void 0,
439
+ date: void 0,
440
+ slotKey: void 0,
441
+ details: void 0
442
+ };
443
+ }
444
+ function rs(e, t) {
445
+ const n = !!t && t.length > 0;
446
+ return {
447
+ ...e,
448
+ serviceId: void 0,
449
+ serviceIds: t,
450
+ operatorId: n ? ge : void 0,
451
+ operatorIds: void 0,
452
+ date: void 0,
453
+ slotKey: void 0,
454
+ details: void 0
455
+ };
456
+ }
457
+ function os(e, t) {
458
+ return {
459
+ ...e,
460
+ operatorId: t,
461
+ operatorIds: void 0,
462
+ date: void 0,
463
+ slotKey: void 0,
464
+ details: void 0
465
+ };
466
+ }
467
+ function ds(e, t) {
468
+ return {
469
+ ...e,
470
+ operatorId: void 0,
471
+ operatorIds: t,
472
+ date: void 0,
473
+ slotKey: void 0,
474
+ details: void 0
475
+ };
476
+ }
477
+ function Ce(e) {
478
+ return e.specialtyIds && e.specialtyIds.length > 0 ? e.specialtyIds : e.specialtyId ? [e.specialtyId] : [];
479
+ }
480
+ function Se(e) {
481
+ return e.serviceIds && e.serviceIds.length > 0 ? e.serviceIds : e.serviceId ? [e.serviceId] : [];
482
+ }
483
+ function At(e) {
484
+ return e.operatorIds && e.operatorIds.length > 0 ? e.operatorIds : e.operatorId ? [e.operatorId] : [];
485
+ }
486
+ function bt(e, t) {
487
+ return {
488
+ ...e,
489
+ date: t,
490
+ slotKey: void 0
491
+ // Keep details — date/slot changes shouldn't wipe the patient form
492
+ // since the user has already filled some fields.
493
+ };
494
+ }
495
+ function cs(e, t) {
496
+ return {
497
+ ...e,
498
+ slotKey: t
499
+ };
500
+ }
501
+ function On(e, t) {
502
+ let n = e;
503
+ if (t.lockedOperatorId && n.operatorId !== t.lockedOperatorId && (n = { ...n, operatorId: t.lockedOperatorId }), (t.useSpecialties === void 0 ? t.specialties.length > 0 : t.useSpecialties) && t.specialties.length === 1 && n.specialtyId === void 0 && n.specialtyIds === void 0 && (n = { ...n, specialtyId: t.specialties[0].id }), t.autoSelectSingleService) {
504
+ const a = Ce(n), r = a.length > 0 ? t.services.filter(
505
+ (c) => c.specialtyId && a.includes(c.specialtyId)
506
+ ) : t.services;
507
+ r.length === 1 && n.serviceId === void 0 && n.serviceIds === void 0 && (n = { ...n, serviceId: r[0].id }, n.operatorId === void 0 && n.operatorIds === void 0 && (n = { ...n, operatorId: ge }));
508
+ }
509
+ return n;
510
+ }
511
+ function ls(e) {
512
+ if (e.operatorId && e.operatorId !== ge)
513
+ return e.operatorId;
514
+ }
515
+ function Bn(e) {
516
+ if (!e) return !1;
517
+ const t = e.trim();
518
+ return /^\+?\d[\d\s\-()]{6,}$/.test(t);
519
+ }
520
+ function us(e) {
521
+ const t = e && e.length > 0 ? e : ["email"], n = new Set(t);
522
+ return Nt.filter((i) => n.has(i));
523
+ }
524
+ function _n(e, t, n) {
525
+ const i = us(e), a = new Set(i);
526
+ if (n)
527
+ return Nt.filter(
528
+ (u) => n.includes(u) && a.has(u)
529
+ );
530
+ const r = [];
531
+ a.has("email") && r.push("email");
532
+ const c = Bn(t), l = a.has("whatsapp");
533
+ l && c && r.push("whatsapp"), !l && a.has("sms") && r.push("sms");
534
+ const f = new Set(r);
535
+ return Nt.filter((u) => f.has(u));
536
+ }
537
+ const Gt = 500, Rn = /^[A-Z0-9]{16}$/, En = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, Ut = 300, ct = { state: "idle" }, Dt = Zt(
538
+ ({
539
+ value: e,
540
+ onChange: t,
541
+ onSubmit: n,
542
+ requireCodiceFiscale: i = !1,
543
+ requireDateOfBirth: a = !1,
544
+ requireInsuranceNumber: r = !1,
545
+ insuranceType: c,
546
+ showNote: l = !1,
547
+ showReturningPatientFlag: f = !1,
548
+ privacyPolicyUrl: u,
549
+ termsUrl: g,
550
+ payment: o,
551
+ paymentTermsUrl: p,
552
+ paymentBlocked: m = !1,
553
+ criticalInformationToAccept: S,
554
+ validateCodiceFiscale: y,
555
+ validateInsuranceNumber: N,
556
+ submitting: _ = !1,
557
+ summarySlot: I,
558
+ defaultPhoneCountry: v,
559
+ confirmationChannels: x,
560
+ defaultConfirmationChannels: w,
561
+ submitError: A
562
+ }, h) => {
563
+ var Ue, me;
564
+ const { t: d, i18n: T } = q(), F = gt(), V = E(!1), [D, O] = ie(!1), [J, Q] = ie(!1), Ae = _ || D, [ae, Z] = ie(ct), [ue, ve] = ie(ct), [K, Re] = ie({}), se = ke(
565
+ (k) => Re(($) => ({ ...$, [k]: !0 })),
566
+ []
567
+ ), H = E(null), re = E(
568
+ null
569
+ );
570
+ z(
571
+ () => () => {
572
+ H.current && clearTimeout(H.current), re.current && clearTimeout(re.current);
573
+ },
574
+ []
575
+ );
576
+ const P = ke(
577
+ (k) => {
578
+ Q(!1), t({ ...e, ...k });
579
+ },
580
+ [e, t]
581
+ ), oe = o ? JSON.stringify([
582
+ o.serviceId,
583
+ o.kind,
584
+ o.amountCents,
585
+ o.currencyCode,
586
+ p
587
+ ]) : void 0, [$e, De] = ie(
588
+ () => e.paymentAccepted ? oe : void 0
589
+ ), Me = E(oe), Ee = !!(o && e.paymentAccepted && $e === oe);
590
+ z(() => {
591
+ Me.current !== oe && (Me.current = oe, De(void 0), e.paymentAccepted !== void 0 && P({ paymentAccepted: o ? !1 : void 0 }));
592
+ }, [oe, o, P, e.paymentAccepted]);
593
+ const G = o ? st(o.amountCents, o.currencyCode, T.language) : "", pe = p && /^https?:\/\//i.test(p) ? p : void 0, Te = M(
594
+ () => us(x),
595
+ [x]
596
+ ), be = !o && !m && Te.length >= 2, nt = E(!1);
597
+ z(() => {
598
+ if (o || m) return;
599
+ if (!be) {
600
+ e.confirmationChannels !== void 0 && P({ confirmationChannels: void 0 });
601
+ return;
602
+ }
603
+ if (e.confirmationChannels !== void 0) {
604
+ nt.current = !0;
605
+ return;
606
+ }
607
+ const k = _n(
608
+ Te,
609
+ e.mobilePhone,
610
+ w
611
+ );
612
+ nt.current = !0, P({ confirmationChannels: k });
613
+ }, [
614
+ be,
615
+ o,
616
+ m,
617
+ Te,
618
+ e.mobilePhone,
619
+ w
620
+ ]);
621
+ const Ke = M(
622
+ () => e.confirmationChannels ?? [],
623
+ [e.confirmationChannels]
624
+ ), ee = be && Ke.length === 0;
625
+ z(() => {
626
+ const k = e.codiceFiscale;
627
+ if (!i || !y || !k) {
628
+ Z(ct);
629
+ return;
630
+ }
631
+ if (!Rn.test(k)) {
632
+ Z({
633
+ state: "invalid",
634
+ hint: d("booking.details.codiceFiscale.invalidFormat")
635
+ });
636
+ return;
637
+ }
638
+ Z({ state: "pending" });
639
+ let $ = !0;
640
+ return H.current && clearTimeout(H.current), H.current = setTimeout(async () => {
641
+ try {
642
+ const Pe = await y(k);
643
+ $ && Z({
644
+ state: Pe.valid ? "valid" : "invalid",
645
+ hint: Pe.hint,
646
+ value: k
647
+ });
648
+ } catch {
649
+ $ && Z({
650
+ state: "invalid",
651
+ hint: d("booking.details.codiceFiscale.unavailable"),
652
+ value: k
653
+ });
654
+ }
655
+ }, Ut), () => {
656
+ $ = !1, H.current && clearTimeout(H.current);
657
+ };
658
+ }, [i, y, e.codiceFiscale, d]);
659
+ const Le = r && c === "public";
660
+ z(() => {
661
+ const k = e.insuranceNumber;
662
+ if (!Le || !N || !k) {
663
+ ve(ct);
664
+ return;
665
+ }
666
+ ve({ state: "pending" }), re.current && clearTimeout(re.current), re.current = setTimeout(() => {
667
+ N(k).then(
668
+ ($) => ve(
669
+ $.valid ? { state: "valid" } : { state: "invalid", hint: $.hint }
670
+ )
671
+ ).catch(
672
+ () => ve({
673
+ state: "invalid",
674
+ hint: d("booking.details.insuranceNumber.unavailable")
675
+ })
676
+ );
677
+ }, Ut);
678
+ }, [Le, N, e.insuranceNumber, d]);
679
+ const te = M(
680
+ () => !!(e.email && En.test(e.email)),
681
+ [e.email]
682
+ ), Oe = M(
683
+ () => !!(e.mobilePhone && e.mobilePhone.length >= 6),
684
+ [e.mobilePhone]
685
+ ), xe = M(() => {
686
+ var k, $;
687
+ return !(!((k = e.firstName) != null && k.trim()) || !(($ = e.lastName) != null && $.trim()) || !te || !Oe || i && (ae.state !== "valid" || ae.value !== e.codiceFiscale) || a && !e.dateOfBirth || Le && ue.state !== "valid");
688
+ }, [
689
+ e.firstName,
690
+ e.lastName,
691
+ te,
692
+ Oe,
693
+ i,
694
+ ae.state,
695
+ ae.value,
696
+ e.codiceFiscale,
697
+ a,
698
+ e.dateOfBirth,
699
+ Le,
700
+ ue.state
701
+ ]), Ie = S != null && S.trim() ? S : void 0, L = Ie !== void 0, ze = !L || !!e.criticalInformationAccepted, je = !!(e.privacyConsent && e.termsConsent && ze), it = !be || Ke.length > 0, ne = xe && je && it && (!o || Ee) && !m && !Ae, Ne = async (k) => {
702
+ if (k.preventDefault(), Re({
703
+ firstName: !0,
704
+ lastName: !0,
705
+ email: !0,
706
+ mobilePhone: !0,
707
+ codiceFiscale: !0,
708
+ dateOfBirth: !0,
709
+ insuranceNumber: !0
710
+ }), !ne || V.current) return;
711
+ const $ = {
712
+ firstName: e.firstName.trim(),
713
+ lastName: e.lastName.trim(),
714
+ email: e.email.trim(),
715
+ mobilePhone: e.mobilePhone,
716
+ privacyConsent: !0,
717
+ termsConsent: !0,
718
+ // Only present when the service carried text to accept — a
719
+ // reason without it leaves the key out of the payload entirely.
720
+ ...L ? { criticalInformationAccepted: !0 } : {},
721
+ ...o ? { paymentAccepted: !0 } : {},
722
+ codiceFiscale: e.codiceFiscale,
723
+ dateOfBirth: e.dateOfBirth,
724
+ insuranceNumber: e.insuranceNumber,
725
+ note: e.note,
726
+ returningPatient: e.returningPatient,
727
+ // Only include when the picker was visible; otherwise the single
728
+ // implicit channel is inferred backend-side from the practice
729
+ // config.
730
+ confirmationChannels: be ? Ke : void 0
731
+ };
732
+ V.current = !0, O(!0), Q(!1);
733
+ try {
734
+ await n($);
735
+ } catch {
736
+ Q(!0);
737
+ } finally {
738
+ V.current = !1, O(!1);
739
+ }
740
+ }, Ge = (k, $) => {
741
+ const Pe = $ && /^https?:\/\//i.test($) ? $ : void 0;
742
+ return Pe ? /* @__PURE__ */ s(
743
+ Ms,
744
+ {
745
+ i18nKey: k,
746
+ components: {
747
+ // The `<Trans>` runtime injects link text from the i18n
748
+ // string. The anchor renders empty at static-analysis time,
749
+ // so `jsx-a11y/anchor-has-content` would false-flag — silence
750
+ // it; the runtime content is the localised policy / terms
751
+ // label.
752
+ policyLink: (
753
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
754
+ /* @__PURE__ */ s(
755
+ "a",
756
+ {
757
+ href: Pe,
758
+ target: "_blank",
759
+ rel: "noopener noreferrer",
760
+ className: "ds:underline ds:text-[var(--primary)]"
761
+ }
762
+ )
763
+ )
764
+ }
765
+ }
766
+ ) : d(k);
767
+ };
768
+ return /* @__PURE__ */ b(
769
+ "form",
770
+ {
771
+ ref: h,
772
+ id: F,
773
+ noValidate: !0,
774
+ onSubmit: Ne,
775
+ "aria-busy": Ae || void 0,
776
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
777
+ children: [
778
+ I,
779
+ /* @__PURE__ */ b("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
780
+ /* @__PURE__ */ s(
781
+ Be,
782
+ {
783
+ label: d("booking.details.firstName.label"),
784
+ required: !0,
785
+ error: K.firstName && !((Ue = e.firstName) != null && Ue.trim()) ? d("booking.details.firstName.required") : void 0,
786
+ children: /* @__PURE__ */ s(
787
+ ot,
788
+ {
789
+ autoComplete: "given-name",
790
+ value: e.firstName ?? "",
791
+ onChange: (k) => P({ firstName: k.target.value }),
792
+ onBlur: () => se("firstName")
793
+ }
794
+ )
795
+ }
796
+ ),
797
+ /* @__PURE__ */ s(
798
+ Be,
799
+ {
800
+ label: d("booking.details.lastName.label"),
801
+ required: !0,
802
+ error: K.lastName && !((me = e.lastName) != null && me.trim()) ? d("booking.details.lastName.required") : void 0,
803
+ children: /* @__PURE__ */ s(
804
+ ot,
805
+ {
806
+ autoComplete: "family-name",
807
+ value: e.lastName ?? "",
808
+ onChange: (k) => P({ lastName: k.target.value }),
809
+ onBlur: () => se("lastName")
810
+ }
811
+ )
812
+ }
813
+ )
814
+ ] }),
815
+ /* @__PURE__ */ b("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
816
+ /* @__PURE__ */ s(
817
+ Be,
818
+ {
819
+ label: d("booking.details.email.label"),
820
+ required: !0,
821
+ error: K.email && !te ? d("booking.details.email.invalid") : void 0,
822
+ children: /* @__PURE__ */ s(
823
+ _s,
824
+ {
825
+ value: e.email ?? "",
826
+ onChange: (k) => P({ email: k.target.value }),
827
+ onBlur: () => se("email")
828
+ }
829
+ )
830
+ }
831
+ ),
832
+ /* @__PURE__ */ s(
833
+ Be,
834
+ {
835
+ label: d("booking.details.mobilePhone.label"),
836
+ required: !0,
837
+ error: K.mobilePhone && !Oe ? d("booking.details.mobilePhone.invalid") : void 0,
838
+ children: /* @__PURE__ */ s(
839
+ Rs,
840
+ {
841
+ value: e.mobilePhone ?? "",
842
+ defaultCountry: v == null ? void 0 : v.toUpperCase(),
843
+ onChange: (k) => {
844
+ P({ mobilePhone: k }), se("mobilePhone");
845
+ }
846
+ }
847
+ )
848
+ }
849
+ )
850
+ ] }),
851
+ i || a ? /* @__PURE__ */ b("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
852
+ i ? /* @__PURE__ */ s(
853
+ Be,
854
+ {
855
+ label: d("booking.details.codiceFiscale.label"),
856
+ required: !0,
857
+ description: ae.state === "pending" ? d("booking.details.codiceFiscale.checking") : d("booking.details.codiceFiscale.helper"),
858
+ error: K.codiceFiscale && ae.state === "invalid" ? ae.hint ?? d("booking.details.codiceFiscale.invalid") : void 0,
859
+ children: /* @__PURE__ */ s(
860
+ ot,
861
+ {
862
+ value: e.codiceFiscale ?? "",
863
+ maxLength: 16,
864
+ onChange: (k) => P({
865
+ codiceFiscale: k.target.value.slice(0, 16).toUpperCase()
866
+ }),
867
+ onBlur: () => se("codiceFiscale")
868
+ }
869
+ )
870
+ }
871
+ ) : null,
872
+ a ? /* @__PURE__ */ s(
873
+ Be,
874
+ {
875
+ label: d("booking.details.dateOfBirth.label"),
876
+ required: !0,
877
+ error: K.dateOfBirth && !e.dateOfBirth ? d("booking.details.dateOfBirth.required") : void 0,
878
+ children: /* @__PURE__ */ s(
879
+ Bs,
880
+ {
881
+ value: e.dateOfBirth ? new Date(e.dateOfBirth) : void 0,
882
+ onChange: (k) => {
883
+ P({
884
+ dateOfBirth: k ? k.toISOString().slice(0, 10) : void 0
885
+ }), se("dateOfBirth");
886
+ }
887
+ }
888
+ )
889
+ }
890
+ ) : null
891
+ ] }) : null,
892
+ Le ? /* @__PURE__ */ s(
893
+ Be,
894
+ {
895
+ label: d("booking.details.insuranceNumber.label"),
896
+ required: !0,
897
+ description: ue.state === "pending" ? d("booking.details.insuranceNumber.checking") : void 0,
898
+ error: K.insuranceNumber && ue.state === "invalid" ? ue.hint ?? d("booking.details.insuranceNumber.invalid") : void 0,
899
+ children: /* @__PURE__ */ s(
900
+ ot,
901
+ {
902
+ value: e.insuranceNumber ?? "",
903
+ onChange: (k) => P({ insuranceNumber: k.target.value }),
904
+ onBlur: () => se("insuranceNumber")
905
+ }
906
+ )
907
+ }
908
+ ) : null,
909
+ l ? /* @__PURE__ */ s(
910
+ Be,
911
+ {
912
+ label: d("booking.details.note.label"),
913
+ description: d("booking.details.note.helper", {
914
+ max: Gt
915
+ }),
916
+ children: /* @__PURE__ */ s(
917
+ Es,
918
+ {
919
+ value: e.note ?? "",
920
+ maxLength: Gt,
921
+ rows: 3,
922
+ onChange: (k) => P({ note: k.target.value })
923
+ }
924
+ )
925
+ }
926
+ ) : null,
927
+ f ? /* @__PURE__ */ s(
928
+ et,
929
+ {
930
+ checked: !!e.returningPatient,
931
+ onCheckedChange: (k) => P({ returningPatient: k === !0 }),
932
+ label: d("booking.details.returningPatient.label")
933
+ }
934
+ ) : null,
935
+ Ie !== void 0 ? /* @__PURE__ */ b(
936
+ "div",
937
+ {
938
+ "data-component": "booking-critical-information",
939
+ role: "group",
940
+ "aria-labelledby": `${F}-critical-information-heading`,
941
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-md)] ds:border ds:border-[var(--border)] ds:bg-[var(--muted)] ds:p-[var(--spacing-sm)]",
942
+ children: [
943
+ /* @__PURE__ */ s(
944
+ "h3",
945
+ {
946
+ id: `${F}-critical-information-heading`,
947
+ className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0",
948
+ children: d("booking.details.criticalInformation.heading")
949
+ }
950
+ ),
951
+ /* @__PURE__ */ s("p", { className: "type-body-sm ds:m-0 ds:whitespace-pre-wrap ds:break-words ds:text-[var(--foreground)]", children: Ie }),
952
+ /* @__PURE__ */ s(
953
+ et,
954
+ {
955
+ checked: !!e.criticalInformationAccepted,
956
+ onCheckedChange: (k) => P({ criticalInformationAccepted: k === !0 }),
957
+ "aria-required": !0,
958
+ label: /* @__PURE__ */ b(ce, { children: [
959
+ d("booking.details.criticalInformation.accept"),
960
+ /* @__PURE__ */ s(
961
+ "span",
962
+ {
963
+ "aria-hidden": "true",
964
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
965
+ children: "*"
966
+ }
967
+ )
968
+ ] })
969
+ }
970
+ )
971
+ ]
972
+ }
973
+ ) : null,
974
+ o ? /* @__PURE__ */ b(
975
+ "div",
976
+ {
977
+ "data-component": "booking-payment-notice",
978
+ role: "group",
979
+ "aria-labelledby": `${F}-payment-heading`,
980
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-md)] ds:border ds:border-[var(--border)] ds:bg-[var(--muted)] ds:p-[var(--spacing-sm)]",
981
+ children: [
982
+ /* @__PURE__ */ s("h3", { id: `${F}-payment-heading`, className: "type-label ds:m-0", children: d("booking.payment.noticeTitle") }),
983
+ /* @__PURE__ */ s("p", { className: "type-body-sm ds:m-0", children: d("booking.payment.noticeBody", { amount: G }) }),
984
+ pe ? /* @__PURE__ */ s(
985
+ "a",
986
+ {
987
+ href: pe,
988
+ target: "_blank",
989
+ rel: "noopener noreferrer",
990
+ className: "type-body-sm ds:inline-flex ds:items-center ds:self-start ds:min-h-[var(--min-target-size)] ds:rounded-[var(--radius-sm)] ds:underline 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)]",
991
+ children: d("booking.payment.terms")
992
+ }
993
+ ) : null,
994
+ /* @__PURE__ */ s(
995
+ et,
996
+ {
997
+ checked: Ee,
998
+ onCheckedChange: (k) => {
999
+ De(
1000
+ k === !0 ? oe : void 0
1001
+ ), P({ paymentAccepted: k === !0 });
1002
+ },
1003
+ "aria-required": !0,
1004
+ label: d("booking.payment.accept", { amount: G })
1005
+ }
1006
+ )
1007
+ ]
1008
+ }
1009
+ ) : null,
1010
+ /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1011
+ /* @__PURE__ */ s(
1012
+ et,
1013
+ {
1014
+ checked: !!e.privacyConsent,
1015
+ onCheckedChange: (k) => P({ privacyConsent: k === !0 }),
1016
+ label: /* @__PURE__ */ b(ce, { children: [
1017
+ Ge(
1018
+ "booking.details.consent.privacy.label",
1019
+ u
1020
+ ),
1021
+ /* @__PURE__ */ s(
1022
+ "span",
1023
+ {
1024
+ "aria-hidden": "true",
1025
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1026
+ children: "*"
1027
+ }
1028
+ )
1029
+ ] })
1030
+ }
1031
+ ),
1032
+ /* @__PURE__ */ s(
1033
+ et,
1034
+ {
1035
+ checked: !!e.termsConsent,
1036
+ onCheckedChange: (k) => P({ termsConsent: k === !0 }),
1037
+ label: /* @__PURE__ */ b(ce, { children: [
1038
+ Ge(
1039
+ "booking.details.consent.terms.label",
1040
+ g
1041
+ ),
1042
+ /* @__PURE__ */ s(
1043
+ "span",
1044
+ {
1045
+ "aria-hidden": "true",
1046
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1047
+ children: "*"
1048
+ }
1049
+ )
1050
+ ] })
1051
+ }
1052
+ )
1053
+ ] }),
1054
+ be ? /* @__PURE__ */ s(
1055
+ "div",
1056
+ {
1057
+ "data-component": "booking-confirmation-channels",
1058
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1059
+ children: /* @__PURE__ */ s(
1060
+ Os,
1061
+ {
1062
+ label: d("booking.confirmation.heading"),
1063
+ helperText: d("booking.confirmation.helper"),
1064
+ value: Ke,
1065
+ onChange: (k) => P({
1066
+ confirmationChannels: k
1067
+ }),
1068
+ orientation: "vertical",
1069
+ options: Te.map((k) => ({
1070
+ value: k,
1071
+ label: d(`booking.confirmation.channel.${k}`)
1072
+ })),
1073
+ error: ee ? d("booking.confirmation.atLeastOne") : void 0
1074
+ }
1075
+ )
1076
+ }
1077
+ ) : null,
1078
+ A || J || m ? /* @__PURE__ */ s(X, { variant: "error", children: /* @__PURE__ */ s(X.Description, { children: A ?? d(
1079
+ m ? "booking.payment.unavailable" : "booking.payment.submitFailed"
1080
+ ) }) }) : null,
1081
+ /* @__PURE__ */ s(
1082
+ Ve,
1083
+ {
1084
+ intent: "primary",
1085
+ size: "md",
1086
+ type: "submit",
1087
+ disabled: !ne,
1088
+ startIcon: Ae ? /* @__PURE__ */ s(Xt, { variant: "pulse", size: "sm" }) : void 0,
1089
+ children: o ? d("booking.payment.submit", { amount: G }) : d("booking.details.submit")
1090
+ }
1091
+ )
1092
+ ]
1093
+ }
1094
+ );
1095
+ }
1096
+ );
1097
+ Dt.displayName = "BookingDetailsForm";
1098
+ function Mt(e) {
1099
+ const t = e.payment;
1100
+ if (!t) return;
1101
+ const n = (t.currencyCode ?? "EUR").toUpperCase();
1102
+ if (!(!Number.isSafeInteger(t.amountCents) || t.amountCents <= 0 || !["full", "deposit"].includes(t.kind) || !/^[A-Z]{3}$/.test(n)))
1103
+ return {
1104
+ serviceId: e.id,
1105
+ kind: t.kind,
1106
+ amountCents: t.amountCents,
1107
+ currencyCode: n
1108
+ };
1109
+ }
1110
+ function Ln(e, t, n) {
1111
+ const i = e.filter(
1112
+ (r) => t.includes(r.id)
1113
+ ), a = (n == null ? void 0 : n.serviceId) ?? (t.length === 1 ? t[0] : void 0);
1114
+ if (a) {
1115
+ const r = i.find((l) => l.id === a);
1116
+ if (!r) return { blocked: !0 };
1117
+ const c = Mt(r);
1118
+ return { payment: c, blocked: !!(r.payment && !c) };
1119
+ }
1120
+ return { blocked: i.some((r) => !!r.payment) };
1121
+ }
1122
+ function lt(e) {
1123
+ return e ? JSON.stringify([
1124
+ e.serviceId,
1125
+ e.kind,
1126
+ e.amountCents,
1127
+ e.currencyCode
1128
+ ]) : "";
1129
+ }
1130
+ function Pn({
1131
+ services: e,
1132
+ value: t,
1133
+ availableSlots: n,
1134
+ onSubmit: i,
1135
+ onChange: a,
1136
+ paymentState: r,
1137
+ submitting: c,
1138
+ paymentTermsUrl: l,
1139
+ renderPayment: f
1140
+ }) {
1141
+ var Z, ue, ve;
1142
+ const u = JSON.stringify([
1143
+ t.insuranceType,
1144
+ t.specialtyId,
1145
+ t.specialtyIds,
1146
+ Se(t),
1147
+ t.operatorId,
1148
+ t.operatorIds,
1149
+ t.date,
1150
+ t.slotKey
1151
+ ]), g = E(
1152
+ void 0
1153
+ ), p = (t.date ? (Z = n[t.date]) == null ? void 0 : Z.find((K) => K.key === t.slotKey) : void 0) ?? (((ue = g.current) == null ? void 0 : ue.selection) === u ? g.current.slot : void 0), m = Ln(
1154
+ e,
1155
+ Se(t),
1156
+ p
1157
+ ), S = m.blocked || !!(m.payment && !f), y = JSON.stringify([
1158
+ u,
1159
+ p == null ? void 0 : p.serviceId,
1160
+ lt(m.payment),
1161
+ l,
1162
+ S
1163
+ ]), N = m.payment ? JSON.stringify([lt(m.payment), l]) : "", _ = E(void 0), I = !!((ve = t.details) != null && ve.paymentAccepted);
1164
+ z(() => {
1165
+ if (!I) _.current = void 0;
1166
+ else if (N) _.current === void 0 ? _.current = N : _.current !== N && (_.current = void 0, a({
1167
+ ...t,
1168
+ details: { ...t.details, paymentAccepted: !1 }
1169
+ }));
1170
+ else return;
1171
+ }, [I, N, a, t]);
1172
+ const v = E(y);
1173
+ v.current = y;
1174
+ const [x, w] = ie({ status: "idle" }), A = E(0), h = E(!1), d = E(!0), T = E(!1), F = E(void 0), V = E(y);
1175
+ z(() => (d.current = !0, () => {
1176
+ d.current = !1, A.current += 1;
1177
+ }), []);
1178
+ const D = x.status === "payment" || x.status === "success";
1179
+ z(() => {
1180
+ V.current === y || T.current || D || (V.current = y, A.current += 1, h.current = !1, w({ status: "idle" }));
1181
+ }, [y, D]);
1182
+ const O = D || V.current === y ? x.session : void 0, J = M(
1183
+ () => O && (r == null ? void 0 : r.sessionId) === O.id ? r : O ? { sessionId: O.id, status: "ready" } : void 0,
1184
+ [O, r]
1185
+ );
1186
+ O && J && "phase" in J && J.phase === "completion" && (F.current = O.id);
1187
+ const Q = M(
1188
+ () => O && F.current === O.id && J && J.status !== "paid" && (!("phase" in J) || J.phase !== "completion") ? {
1189
+ sessionId: O.id,
1190
+ status: "processing",
1191
+ phase: "completion"
1192
+ } : J,
1193
+ [O, J]
1194
+ );
1195
+ z(() => {
1196
+ !O || !Q || T.current || (Q.status === "paid" ? (T.current = !0, w((K) => ({ ...K, status: "success" }))) : Q.status === "cancelled" && (A.current += 1, h.current = !1, g.current = void 0, a({
1197
+ ...t,
1198
+ details: { ...t.details, paymentAccepted: !1 }
1199
+ }), w({ status: "idle", cancelled: !0 })));
1200
+ }, [O, Q, a, t]);
1201
+ const Ae = () => {
1202
+ A.current += 1, h.current = !1, T.current = !1, F.current = void 0, g.current = void 0, V.current = v.current, w({ status: "idle" });
1203
+ }, ae = async (K) => {
1204
+ var oe, $e, De, Me, Ee;
1205
+ if (!(p != null && p.available) || S || c || h.current || x.status === "payment" || T.current || m.payment && !K.paymentAccepted) return;
1206
+ h.current = !0, g.current = { selection: u, slot: { ...p } };
1207
+ const Re = ++A.current, se = y;
1208
+ V.current = se;
1209
+ const H = {
1210
+ slot: { ...p, meta: p.meta ? { ...p.meta } : void 0 },
1211
+ value: {
1212
+ ...t,
1213
+ serviceIds: (oe = t.serviceIds) == null ? void 0 : oe.slice(),
1214
+ specialtyIds: ($e = t.specialtyIds) == null ? void 0 : $e.slice(),
1215
+ operatorIds: (De = t.operatorIds) == null ? void 0 : De.slice(),
1216
+ operatorId: ls(t) ?? t.operatorId,
1217
+ details: { ...K }
1218
+ },
1219
+ details: {
1220
+ ...K,
1221
+ confirmationChannels: (Me = K.confirmationChannels) == null ? void 0 : Me.slice()
1222
+ },
1223
+ ...m.payment ? { payment: { ...m.payment } } : {}
1224
+ }, re = () => d.current && A.current === Re && v.current === se;
1225
+ w({ status: "submitting" });
1226
+ let P = !1;
1227
+ try {
1228
+ const G = await i(H);
1229
+ if (!re()) return;
1230
+ if (H.payment) {
1231
+ const pe = G == null ? void 0 : G.paymentSession;
1232
+ if (!((Ee = pe == null ? void 0 : pe.id) != null && Ee.trim()) || lt(pe.payment) !== lt(H.payment)) {
1233
+ w({ status: "error" });
1234
+ return;
1235
+ }
1236
+ P = !0, w({
1237
+ status: "payment",
1238
+ snapshot: H,
1239
+ session: { id: pe.id, payment: { ...pe.payment } }
1240
+ });
1241
+ } else G != null && G.paymentSession ? w({ status: "error" }) : (T.current = !0, w({ status: "success", snapshot: H }));
1242
+ } catch {
1243
+ re() && w({ status: "error" });
1244
+ } finally {
1245
+ re() && !P && (h.current = !1);
1246
+ }
1247
+ };
1248
+ return {
1249
+ ...x,
1250
+ payment: m.payment,
1251
+ blocked: S,
1252
+ state: Q,
1253
+ activeSession: O,
1254
+ submit: ae,
1255
+ reset: Ae
1256
+ };
1257
+ }
1258
+ const Fn = ht(
1259
+ "ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]",
1260
+ {
1261
+ variants: {
1262
+ variant: {
1263
+ "inline-list": "ds:gap-[var(--spacing-md)]",
1264
+ accordion: "ds:gap-[var(--spacing-md)]",
1265
+ calendar: "ds:gap-[var(--spacing-md)]",
1266
+ flexible: "ds:gap-[var(--spacing-lg)]",
1267
+ progress: "ds:gap-[var(--spacing-sm)]"
1268
+ },
1269
+ // `surface="elevated"` matches `Card variant="elevated"` — same
1270
+ // tokens, same padding, same boundary behaviour — so consumers can
1271
+ // drop their own Card wraps without a double-card look. Default
1272
+ // `'flat'` preserves 0.30.x rendering.
1273
+ surface: {
1274
+ flat: "",
1275
+ elevated: [
1276
+ "ds:rounded-[var(--radius-lg)]",
1277
+ "ds:bg-[var(--card)] ds:text-[var(--card-foreground)]",
1278
+ "ds:border ds:border-[color:var(--card-border)]",
1279
+ "ds:shadow-[var(--shadow-card)]",
1280
+ "ds:p-[var(--spacing-md)]"
1281
+ ].join(" ")
1282
+ }
1283
+ },
1284
+ defaultVariants: { variant: "inline-list", surface: "flat" }
1285
+ }
1286
+ ), Vn = [
1287
+ [
1288
+ /\b(estetic|aesthetic|botox|filler|mesoterap|chirurgia\s*plastic)/i,
1289
+ Ht
1290
+ ],
1291
+ [/\b(cardio|ecg|elettrocardio|ecocardio|cuore|heart)/i, Us],
1292
+ [/\b(dent|odonto|tooth|teeth|pulizia|igien|smile)/i, bn],
1293
+ [/\b(oftalmo|ocul|ophthal|vision|occhi|eye)/i, Ys],
1294
+ [/\b(otorin|udito|orecchi|hearing|ear)/i, ln],
1295
+ [/\b(neuro|brain|cervello)/i, rn],
1296
+ [/\b(pediatr|child|bambin)/i, Ws],
1297
+ [/\b(ortop|ortho|osteo|skeleton|ossa|bone)/i, nn],
1298
+ [/\b(lab|analis|test|sang|esami)/i, pn],
1299
+ [/\b(farmaco|pharm|pillol|refill)/i, fn],
1300
+ [/\b(chirurg|surg|intervent|operat)/i, hn],
1301
+ [/\b(scan|rx|x-?ray|raggi|imag|radio|risonan|ecograf|ultras)/i, Zs],
1302
+ [/\b(vacc|inject|inie|punto)/i, Ht],
1303
+ [/\b(derma|skin|pelle)/i, Xs],
1304
+ [/\b(prima\s*visit|first\s*visit|consult|consulto|valutaz)/i, Qs],
1305
+ [/\b(general|medicin|family|control|check[-\s]?up)/i, tn]
1306
+ ];
1307
+ function $n(e) {
1308
+ for (const [t, n] of Vn)
1309
+ if (t.test(e)) return n;
1310
+ return null;
1311
+ }
1312
+ function Kn(e) {
1313
+ const t = $n(e.label) ?? Gs;
1314
+ return /* @__PURE__ */ s(t, { "aria-hidden": "true", className: "ds:size-5" });
1315
+ }
1316
+ function ps(e) {
1317
+ var t;
1318
+ return (t = e.priceLabel) != null && t.trim() ? e.priceLabel : void 0;
1319
+ }
1320
+ function Fe(e) {
1321
+ return pt(e, "yyyy-MM-dd");
1322
+ }
1323
+ const zn = [
1324
+ "ds:relative ds:flex ds:items-center ds:justify-center",
1325
+ "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
1326
+ "ds:rounded-[var(--radius-sm)]",
1327
+ "ds:text-[length:var(--font-size-sm)]",
1328
+ "ds:transition-colors ds:duration-[var(--animation-duration)]",
1329
+ "ds:motion-reduce:transition-none",
1330
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1331
+ "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1332
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
1333
+ ].join(" "), jn = ht(zn, {
1334
+ variants: {
1335
+ state: {
1336
+ available: "ds:cursor-pointer ds:text-[var(--foreground)] ds:hover:bg-[var(--muted)]/30",
1337
+ unavailable: "ds:cursor-not-allowed ds:text-[var(--muted-foreground)]/60",
1338
+ selected: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:font-[var(--font-weight-semibold)]",
1339
+ outside: "ds:text-[var(--muted-foreground)]/40"
1340
+ }
1341
+ },
1342
+ defaultVariants: { state: "unavailable" }
1343
+ });
1344
+ function qn({
1345
+ availableDates: e,
1346
+ selectedDate: t,
1347
+ onSelectDate: n,
1348
+ locale: i,
1349
+ loading: a
1350
+ }) {
1351
+ const { t: r } = q(), c = M(() => t ? tt(le(t)) : e.length > 0 ? tt(le(e[0])) : tt(/* @__PURE__ */ new Date()), [t, e]), [l, f] = ie(c), [u, g] = ie(null), o = M(() => {
1352
+ const I = tt(l), v = Ks(l), x = I.getDay(), w = v.getDate(), A = [];
1353
+ for (let h = x; h > 0; h -= 1) {
1354
+ const d = new Date(I);
1355
+ d.setDate(I.getDate() - h), A.push(d);
1356
+ }
1357
+ for (let h = 0; h < w; h += 1) {
1358
+ const d = new Date(I);
1359
+ d.setDate(I.getDate() + h), A.push(d);
1360
+ }
1361
+ for (; A.length < 42; ) {
1362
+ const h = A[A.length - 1], d = new Date(h);
1363
+ d.setDate(h.getDate() + 1), A.push(d);
1364
+ }
1365
+ return A;
1366
+ }, [l]), p = M(() => {
1367
+ try {
1368
+ return new Intl.DateTimeFormat(i, {
1369
+ month: "long",
1370
+ year: "numeric"
1371
+ }).format(l);
1372
+ } catch {
1373
+ return pt(l, "MMMM yyyy");
1374
+ }
1375
+ }, [l, i]), m = M(() => {
1376
+ const I = new Date(2024, 0, 7);
1377
+ return Array.from({ length: 7 }, (v, x) => {
1378
+ const w = new Date(I);
1379
+ w.setDate(I.getDate() + x);
1380
+ try {
1381
+ return new Intl.DateTimeFormat(i, { weekday: "short" }).format(w);
1382
+ } catch {
1383
+ return pt(w, "EEE");
1384
+ }
1385
+ });
1386
+ }, [i]), S = M(() => new Set(e), [e]), y = ke(
1387
+ (I) => S.has(Fe(I)),
1388
+ [S]
1389
+ ), N = M(() => {
1390
+ if (u) return u;
1391
+ if (t) return le(t);
1392
+ const I = o.find(
1393
+ (v) => dt(v, l) && y(v)
1394
+ );
1395
+ return I || (o.find((v) => dt(v, l)) ?? null);
1396
+ }, [u, t, o, l, y]), _ = ke(
1397
+ (I, v) => {
1398
+ let x = null;
1399
+ switch (I.key) {
1400
+ case "ArrowLeft":
1401
+ x = new Date(v), x.setDate(v.getDate() - 1);
1402
+ break;
1403
+ case "ArrowRight":
1404
+ x = new Date(v), x.setDate(v.getDate() + 1);
1405
+ break;
1406
+ case "ArrowUp":
1407
+ x = new Date(v), x.setDate(v.getDate() - 7);
1408
+ break;
1409
+ case "ArrowDown":
1410
+ x = new Date(v), x.setDate(v.getDate() + 7);
1411
+ break;
1412
+ case "Home":
1413
+ x = new Date(v), x.setDate(v.getDate() - v.getDay());
1414
+ break;
1415
+ case "End":
1416
+ x = new Date(v), x.setDate(v.getDate() + (6 - v.getDay()));
1417
+ break;
1418
+ case "Enter":
1419
+ case " ": {
1420
+ I.preventDefault(), y(v) && n(Fe(v));
1421
+ return;
1422
+ }
1423
+ default:
1424
+ return;
1425
+ }
1426
+ x && (I.preventDefault(), dt(x, l) || f(tt(x)), g(x));
1427
+ },
1428
+ [y, n, l]
1429
+ );
1430
+ return a ? /* @__PURE__ */ b(
1431
+ "div",
1432
+ {
1433
+ role: "status",
1434
+ "aria-live": "polite",
1435
+ "aria-label": r("common.loading"),
1436
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1437
+ children: [
1438
+ /* @__PURE__ */ s(mt, { variant: "text", width: "40%" }),
1439
+ /* @__PURE__ */ s("div", { className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]", children: Array.from({ length: 42 }, (I, v) => /* @__PURE__ */ s(mt, { variant: "rounded", height: "2.5rem" }, `mg-skel-${v}`)) })
1440
+ ]
1441
+ }
1442
+ ) : /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1443
+ /* @__PURE__ */ b("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
1444
+ /* @__PURE__ */ s(
1445
+ qt,
1446
+ {
1447
+ icon: /* @__PURE__ */ s(js, {}),
1448
+ "aria-label": r("booking.previousMonth"),
1449
+ size: "sm",
1450
+ intent: "ghost",
1451
+ flipIconInRtl: !0,
1452
+ onClick: () => {
1453
+ f((I) => xn(I)), g(null);
1454
+ }
1455
+ }
1456
+ ),
1457
+ /* @__PURE__ */ s(
1458
+ "span",
1459
+ {
1460
+ className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]",
1461
+ "aria-live": "polite",
1462
+ children: p
1463
+ }
1464
+ ),
1465
+ /* @__PURE__ */ s(
1466
+ qt,
1467
+ {
1468
+ icon: /* @__PURE__ */ s(qs, {}),
1469
+ "aria-label": r("booking.nextMonth"),
1470
+ size: "sm",
1471
+ intent: "ghost",
1472
+ flipIconInRtl: !0,
1473
+ onClick: () => {
1474
+ f((I) => ts(I, 1)), g(null);
1475
+ }
1476
+ }
1477
+ )
1478
+ ] }),
1479
+ /* @__PURE__ */ b(
1480
+ "div",
1481
+ {
1482
+ role: "grid",
1483
+ "aria-label": r("booking.monthGridLabel"),
1484
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
1485
+ children: [
1486
+ /* @__PURE__ */ s(
1487
+ "div",
1488
+ {
1489
+ role: "row",
1490
+ className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
1491
+ children: m.map((I, v) => /* @__PURE__ */ s(
1492
+ "div",
1493
+ {
1494
+ role: "columnheader",
1495
+ className: "type-meta ds:text-center ds:text-[var(--muted-foreground)] ds:font-[var(--font-weight-medium)]",
1496
+ children: I
1497
+ },
1498
+ `wd-${v}`
1499
+ ))
1500
+ }
1501
+ ),
1502
+ Array.from({ length: 6 }, (I, v) => /* @__PURE__ */ s(
1503
+ "div",
1504
+ {
1505
+ role: "row",
1506
+ className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
1507
+ children: o.slice(v * 7, v * 7 + 7).map((x, w) => {
1508
+ const A = v * 7 + w, h = dt(x, l), d = h && y(x), T = t ? Jt(x, le(t)) : !1, F = h ? T ? "selected" : d ? "available" : "unavailable" : "outside", V = N ? Jt(N, x) : !1, D = (() => {
1509
+ try {
1510
+ return new Intl.DateTimeFormat(i, {
1511
+ dateStyle: "full"
1512
+ }).format(x);
1513
+ } catch {
1514
+ return pt(x, "PPP");
1515
+ }
1516
+ })();
1517
+ return /* @__PURE__ */ s(
1518
+ "button",
1519
+ {
1520
+ type: "button",
1521
+ role: "gridcell",
1522
+ "aria-label": D,
1523
+ "aria-selected": T || void 0,
1524
+ "aria-disabled": !d || void 0,
1525
+ tabIndex: V ? 0 : -1,
1526
+ disabled: !d,
1527
+ onClick: () => {
1528
+ d && n(Fe(x));
1529
+ },
1530
+ onKeyDown: (O) => _(O, x),
1531
+ className: jn({ state: F }),
1532
+ children: /* @__PURE__ */ s("span", { "aria-hidden": "true", children: x.getDate() })
1533
+ },
1534
+ `mg-cell-${A}`
1535
+ );
1536
+ })
1537
+ },
1538
+ `mg-row-${v}`
1539
+ ))
1540
+ ]
1541
+ }
1542
+ )
1543
+ ] });
1544
+ }
1545
+ const Jn = ht(
1546
+ [
1547
+ "ds:relative ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-md)]",
1548
+ "ds:min-h-[var(--min-target-size)]",
1549
+ "ds:rounded-[var(--radius-md)]",
1550
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
1551
+ "ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]",
1552
+ "ds:text-start",
1553
+ "ds:transition-[background-color,box-shadow]",
1554
+ "ds:duration-[var(--animation-duration)]",
1555
+ "ds:motion-reduce:transition-none",
1556
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1557
+ "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1558
+ "ds:forced-colors:[outline:1px_solid_CanvasText]",
1559
+ "ds:cursor-pointer"
1560
+ ].join(" "),
1561
+ {
1562
+ variants: {
1563
+ state: {
1564
+ idle: "ds:bg-[var(--card)] ds:shadow-[var(--shadow-sm)] ds:hover:shadow-[var(--shadow-md)]",
1565
+ selected: "ds:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] ds:shadow-[var(--shadow-sm)]"
1566
+ }
1567
+ },
1568
+ defaultVariants: { state: "idle" }
1569
+ }
1570
+ );
1571
+ function Hn({
1572
+ services: e,
1573
+ selectedServiceId: t,
1574
+ onSelect: n
1575
+ }) {
1576
+ const { t: i, i18n: a } = q(), r = gt(), [c, l] = ie(() => {
1577
+ if (t) {
1578
+ const o = e.findIndex((p) => p.id === t);
1579
+ if (o >= 0) return o;
1580
+ }
1581
+ return 0;
1582
+ }), f = E(/* @__PURE__ */ new Map()), u = ke((o) => {
1583
+ var p;
1584
+ (p = f.current.get(o)) == null || p.focus();
1585
+ }, []), g = ke(
1586
+ (o, p, m) => {
1587
+ const S = e.length;
1588
+ if (S !== 0)
1589
+ switch (o.key) {
1590
+ case "ArrowDown":
1591
+ case "ArrowRight": {
1592
+ o.preventDefault();
1593
+ const y = (p + 1) % S;
1594
+ l(y), u(y);
1595
+ break;
1596
+ }
1597
+ case "ArrowUp":
1598
+ case "ArrowLeft": {
1599
+ o.preventDefault();
1600
+ const y = (p - 1 + S) % S;
1601
+ l(y), u(y);
1602
+ break;
1603
+ }
1604
+ case "Home": {
1605
+ o.preventDefault(), l(0), u(0);
1606
+ break;
1607
+ }
1608
+ case "End": {
1609
+ o.preventDefault();
1610
+ const y = S - 1;
1611
+ l(y), u(y);
1612
+ break;
1613
+ }
1614
+ case "Enter":
1615
+ case " ": {
1616
+ o.preventDefault(), n(m);
1617
+ break;
1618
+ }
1619
+ }
1620
+ },
1621
+ [e.length, u, n]
1622
+ );
1623
+ return e.length === 0 ? null : /* @__PURE__ */ s(
1624
+ "div",
1625
+ {
1626
+ role: "radiogroup",
1627
+ "aria-label": i("booking.serviceListLabel"),
1628
+ id: r,
1629
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1630
+ children: e.map((o, p) => {
1631
+ const m = t === o.id, S = c === p, y = Mt(o), N = o.payment ? y ? i(`booking.payment.${y.kind}`, {
1632
+ amount: st(
1633
+ y.amountCents,
1634
+ y.currencyCode,
1635
+ a.language
1636
+ )
1637
+ }) : i("booking.payment.unavailable") : ps(o), _ = N ? i("booking.serviceCardLabelPrice", {
1638
+ label: o.label,
1639
+ price: N
1640
+ }) : i("booking.serviceCardLabel", {
1641
+ label: o.label,
1642
+ duration: o.durationMin
1643
+ }), I = Kn(o);
1644
+ return /* @__PURE__ */ b(
1645
+ "button",
1646
+ {
1647
+ ref: (v) => {
1648
+ v ? f.current.set(p, v) : f.current.delete(p);
1649
+ },
1650
+ type: "button",
1651
+ role: "radio",
1652
+ "aria-checked": m,
1653
+ "aria-label": _,
1654
+ tabIndex: S ? 0 : -1,
1655
+ onClick: () => n(o.id),
1656
+ onFocus: () => l(p),
1657
+ onKeyDown: (v) => g(v, p, o.id),
1658
+ className: Jn({
1659
+ state: m ? "selected" : "idle"
1660
+ }),
1661
+ children: [
1662
+ /* @__PURE__ */ s(
1663
+ "span",
1664
+ {
1665
+ "aria-hidden": "true",
1666
+ className: "ds:flex ds:size-10 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)] ds:bg-[var(--primary)]/10 ds:text-[var(--primary)]",
1667
+ children: I
1668
+ }
1669
+ ),
1670
+ /* @__PURE__ */ b("span", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
1671
+ /* @__PURE__ */ s("span", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]", children: o.label }),
1672
+ N ? null : /* @__PURE__ */ s("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: i("booking.serviceSummary", {
1673
+ minutes: o.durationMin
1674
+ }) })
1675
+ ] }),
1676
+ N ? /* @__PURE__ */ s(
1677
+ "span",
1678
+ {
1679
+ "aria-hidden": "true",
1680
+ className: "ds:inline-flex ds:shrink-0 ds:items-center ds:ms-auto",
1681
+ children: /* @__PURE__ */ s(Qt, { variant: "accentSoft", size: "lg", children: N })
1682
+ }
1683
+ ) : null
1684
+ ]
1685
+ },
1686
+ o.id
1687
+ );
1688
+ })
1689
+ }
1690
+ );
1691
+ }
1692
+ const Gn = ht(
1693
+ [
1694
+ "ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-2xs)]",
1695
+ "ds:min-h-[var(--min-target-size)]",
1696
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
1697
+ "ds:pt-[var(--spacing-2xs)] ds:pb-[var(--spacing-2xs)]",
1698
+ "ds:rounded-[var(--radius-md)]",
1699
+ "ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-medium)]",
1700
+ "ds:transition-[background-color,color,box-shadow] ds:duration-[var(--animation-duration)]",
1701
+ "ds:motion-reduce:transition-none",
1702
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1703
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1704
+ "ds:disabled:cursor-not-allowed ds:disabled:opacity-50",
1705
+ "ds:forced-colors:[border:1px_solid_ButtonText] ds:forced-colors:text-[ButtonText]"
1706
+ ].join(" "),
1707
+ {
1708
+ variants: {
1709
+ state: {
1710
+ idle: "ds:bg-[color:var(--card)] ds:text-[color:var(--foreground)] ds:shadow-[var(--shadow-sm)] ds:hover:enabled:bg-[color:var(--muted)]/40 ds:hover:enabled:shadow-[var(--shadow-md)]",
1711
+ selected: "ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:shadow-[var(--shadow-sm)]",
1712
+ unavailable: "ds:[outline:1px_dashed_color:var(--border)] ds:[outline-offset:-1px] ds:bg-transparent ds:text-[color:var(--muted-foreground)]"
1713
+ }
1714
+ },
1715
+ defaultVariants: { state: "idle" }
1716
+ }
1717
+ );
1718
+ function Un(e) {
1719
+ const [t] = e.split(":").map((i) => parseInt(i, 10)), n = Number.isFinite(t) ? t : 0;
1720
+ return n < 12 ? "morning" : n < 17 ? "afternoon" : "evening";
1721
+ }
1722
+ const Yn = {
1723
+ morning: Hs,
1724
+ afternoon: kn,
1725
+ evening: Js
1726
+ };
1727
+ function Wn({
1728
+ date: e,
1729
+ slots: t,
1730
+ selectedSlotKey: n,
1731
+ onSelect: i,
1732
+ loading: a,
1733
+ locale: r
1734
+ }) {
1735
+ const { t: c } = q(), l = M(() => {
1736
+ try {
1737
+ return new Intl.DateTimeFormat(r, {
1738
+ weekday: "long",
1739
+ day: "numeric",
1740
+ month: "long"
1741
+ }).format(le(e));
1742
+ } catch {
1743
+ return e;
1744
+ }
1745
+ }, [e, r]), f = M(() => {
1746
+ const o = {
1747
+ morning: [],
1748
+ afternoon: [],
1749
+ evening: []
1750
+ };
1751
+ for (const p of t)
1752
+ o[Un(p.time)].push(p);
1753
+ return o;
1754
+ }, [t]), u = t.filter((o) => o.available).length, g = ["morning", "afternoon", "evening"];
1755
+ return a ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1756
+ /* @__PURE__ */ s(mt, { variant: "text", width: "60%" }),
1757
+ [0, 1].map((o) => /* @__PURE__ */ s(
1758
+ "div",
1759
+ {
1760
+ className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)]",
1761
+ children: [0, 1, 2].map((p) => /* @__PURE__ */ s(mt, { variant: "rounded", height: "44px" }, p))
1762
+ },
1763
+ o
1764
+ ))
1765
+ ] }) : u === 0 ? /* @__PURE__ */ s(es, { variant: "no-results", title: c("booking.noSlotsForDate") }) : /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1766
+ /* @__PURE__ */ b("div", { className: "ds:flex ds:items-baseline ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
1767
+ /* @__PURE__ */ b("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
1768
+ /* @__PURE__ */ s(
1769
+ dn,
1770
+ {
1771
+ "aria-hidden": "true",
1772
+ className: "ds:size-4 ds:text-[color:var(--accent)]"
1773
+ }
1774
+ ),
1775
+ /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: l })
1776
+ ] }),
1777
+ /* @__PURE__ */ s("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: c("booking.slotsAvailable", { count: u }) })
1778
+ ] }),
1779
+ g.map((o) => {
1780
+ const p = f[o];
1781
+ if (p.length === 0) return null;
1782
+ const m = Yn[o];
1783
+ return /* @__PURE__ */ b(
1784
+ "div",
1785
+ {
1786
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1787
+ children: [
1788
+ /* @__PURE__ */ b("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
1789
+ /* @__PURE__ */ s(m, { "aria-hidden": "true", className: "ds:size-3.5" }),
1790
+ /* @__PURE__ */ s("span", { className: "type-meta ds:font-[var(--font-weight-semibold)] ds:uppercase", children: c(`booking.timeOfDay.${o}`) })
1791
+ ] }),
1792
+ /* @__PURE__ */ s(
1793
+ "div",
1794
+ {
1795
+ role: "group",
1796
+ "aria-label": c(`booking.timeOfDay.${o}`),
1797
+ className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)] ds:sm:grid-cols-4",
1798
+ children: p.map((S) => {
1799
+ const y = S.key === n, N = S.available ? y ? "selected" : "idle" : "unavailable";
1800
+ return /* @__PURE__ */ s(
1801
+ "button",
1802
+ {
1803
+ type: "button",
1804
+ "data-slot-id": S.key,
1805
+ disabled: !S.available,
1806
+ "aria-pressed": y,
1807
+ "aria-label": c("booking.slotAvailableLabel", {
1808
+ time: S.time
1809
+ }),
1810
+ onClick: () => S.available && i(S),
1811
+ className: Gn({ state: N }),
1812
+ children: S.time
1813
+ },
1814
+ S.key
1815
+ );
1816
+ })
1817
+ }
1818
+ )
1819
+ ]
1820
+ },
1821
+ o
1822
+ );
1823
+ })
1824
+ ] });
1825
+ }
1826
+ const ut = 4;
1827
+ function Zn({
1828
+ availableDates: e,
1829
+ availableSlots: t,
1830
+ value: n,
1831
+ onChange: i,
1832
+ onDateSelect: a,
1833
+ onWindowChange: r,
1834
+ loadingDates: c,
1835
+ loadingSlots: l,
1836
+ locale: f,
1837
+ agentIdBase: u
1838
+ }) {
1839
+ const g = M(() => qe(/* @__PURE__ */ new Date()), []), [o, p] = ie(() => {
1840
+ if (n.date) {
1841
+ const d = qe(le(n.date));
1842
+ if (!Je(g, d)) return d;
1843
+ }
1844
+ if (e.length > 0) {
1845
+ const d = qe(le(e[0]));
1846
+ if (Je(d, g)) return d;
1847
+ }
1848
+ return g;
1849
+ }), m = M(
1850
+ () => xt(o, ut - 1),
1851
+ [o]
1852
+ ), S = M(() => Array.from({ length: ut }, (d, T) => {
1853
+ const F = xt(o, T), V = Fe(F), O = (t[V] ?? []).map((J) => ({
1854
+ id: J.key,
1855
+ // SlotGrid formats `start` as a time via Intl.DateTimeFormat —
1856
+ // compose a full ISO from the column's date + the slot's HH:mm
1857
+ // so the locale-formatter has a real timestamp to work with.
1858
+ start: `${V}T${J.time}:00`,
1859
+ available: J.available
1860
+ }));
1861
+ return { date: V, slots: O };
1862
+ }), [o, t]), y = Je(o, g), N = !0, _ = ke(() => {
1863
+ p((d) => {
1864
+ const T = zs(d, ut);
1865
+ return Je(g, T) ? g : T;
1866
+ });
1867
+ }, [g]), I = ke(() => {
1868
+ p((d) => xt(d, ut));
1869
+ }, []);
1870
+ z(() => {
1871
+ if (e.length === 0) return;
1872
+ const d = qe(le(e[0]));
1873
+ !Je(d, g) || e.some((F) => {
1874
+ const V = qe(le(F));
1875
+ return !Je(V, m) && !$s(V, o);
1876
+ }) || p(d);
1877
+ }, [e]), z(() => {
1878
+ r == null || r(Fe(o), Fe(m));
1879
+ }, [o, m, r]);
1880
+ const v = ke(
1881
+ (d, T) => {
1882
+ const F = typeof T.date == "string" ? T.date : Fe(T.date);
1883
+ i({
1884
+ ...cs(bt(n, F), d.id)
1885
+ }), a == null || a(F);
1886
+ },
1887
+ [i, a, n]
1888
+ ), x = c || l ? "loading" : "default", w = S.some((d) => d.slots.length > 0), A = e[0];
1889
+ return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1890
+ !w && !!A ? /* @__PURE__ */ s(
1891
+ Tt,
1892
+ {
1893
+ nextAvailableDate: A,
1894
+ onJump: () => p(qe(le(A))),
1895
+ locale: f
1896
+ }
1897
+ ) : null,
1898
+ /* @__PURE__ */ s(
1899
+ Fs,
1900
+ {
1901
+ id: u ? `${u}-slots` : void 0,
1902
+ days: S,
1903
+ state: x,
1904
+ selectedSlotId: n.slotKey,
1905
+ maxInitialSlotsPerDay: 6,
1906
+ locale: f,
1907
+ hasPrevious: y,
1908
+ hasNext: N,
1909
+ onSlotSelect: v,
1910
+ onPreviousDays: _,
1911
+ onNextDays: I
1912
+ }
1913
+ )
1914
+ ] });
1915
+ }
1916
+ function ms(e) {
1917
+ const {
1918
+ inputs: t,
1919
+ value: n,
1920
+ onChange: i,
1921
+ onDateSelect: a,
1922
+ onWindowChange: r,
1923
+ loadingDates: c,
1924
+ loadingSlots: l,
1925
+ locale: f,
1926
+ datePickerStyle: u,
1927
+ agentIdBase: g
1928
+ } = e;
1929
+ return u === "four-day-grid" ? /* @__PURE__ */ s(
1930
+ Zn,
1931
+ {
1932
+ availableDates: t.availableDates,
1933
+ availableSlots: t.availableSlots,
1934
+ value: n,
1935
+ onChange: i,
1936
+ onDateSelect: a,
1937
+ onWindowChange: r,
1938
+ loadingDates: c,
1939
+ loadingSlots: l,
1940
+ locale: f,
1941
+ agentIdBase: g
1942
+ }
1943
+ ) : /* @__PURE__ */ s(
1944
+ qn,
1945
+ {
1946
+ availableDates: t.availableDates,
1947
+ selectedDate: n.date,
1948
+ onSelectDate: (o) => {
1949
+ i(bt(n, o)), a == null || a(o);
1950
+ },
1951
+ locale: f,
1952
+ loading: c ?? l
1953
+ }
1954
+ );
1955
+ }
1956
+ function fs(e) {
1957
+ const { inputs: t, value: n, onChange: i, loadingSlots: a, locale: r, datePickerStyle: c } = e;
1958
+ return c === "four-day-grid" || !n.date ? null : /* @__PURE__ */ s(
1959
+ Wn,
1960
+ {
1961
+ date: n.date,
1962
+ slots: t.availableSlots[n.date] ?? [],
1963
+ selectedSlotKey: n.slotKey,
1964
+ onSelect: (l) => i(cs(n, l.key)),
1965
+ loading: a,
1966
+ locale: r
1967
+ }
1968
+ );
1969
+ }
1970
+ function gs({ value: e, onChange: t }) {
1971
+ const { t: n } = q(), i = [
1972
+ { value: "private", label: n("booking.insurance.private") },
1973
+ { value: "public", label: n("booking.insurance.public") }
1974
+ ];
1975
+ return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1976
+ /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: n("booking.insurance.heading") }),
1977
+ /* @__PURE__ */ s(
1978
+ vt,
1979
+ {
1980
+ options: i,
1981
+ value: e ?? "",
1982
+ onValueChange: (a) => {
1983
+ (a === "private" || a === "public") && t(a);
1984
+ },
1985
+ placeholder: n("booking.insurance.placeholder"),
1986
+ "aria-label": n("booking.insurance.heading")
1987
+ }
1988
+ )
1989
+ ] });
1990
+ }
1991
+ function hs({
1992
+ specialties: e,
1993
+ value: t,
1994
+ valueIds: n,
1995
+ onChange: i,
1996
+ onChangeIds: a,
1997
+ pickerStyle: r = "select"
1998
+ }) {
1999
+ const { t: c } = q(), l = e.map((u) => ({
2000
+ value: u.id,
2001
+ label: u.label
2002
+ })), f = /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: c("booking.specialty.heading") });
2003
+ return r === "multi-select" && a ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2004
+ f,
2005
+ /* @__PURE__ */ s(
2006
+ Ct,
2007
+ {
2008
+ options: l,
2009
+ value: n ?? [],
2010
+ onChange: a,
2011
+ placeholder: c("booking.specialty.placeholder"),
2012
+ "aria-label": c("booking.specialty.heading"),
2013
+ allowClear: !0
2014
+ }
2015
+ )
2016
+ ] }) : r === "combobox" ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2017
+ f,
2018
+ /* @__PURE__ */ s(
2019
+ wt,
2020
+ {
2021
+ options: l,
2022
+ value: t ?? "",
2023
+ onValueChange: (u) => i(u === "" ? "" : u),
2024
+ placeholder: c("booking.specialty.placeholder"),
2025
+ "aria-label": c("booking.specialty.heading"),
2026
+ clearable: !0
2027
+ }
2028
+ )
2029
+ ] }) : /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2030
+ f,
2031
+ /* @__PURE__ */ s(
2032
+ vt,
2033
+ {
2034
+ options: l,
2035
+ value: t ?? "",
2036
+ onValueChange: (u) => i(u),
2037
+ placeholder: c("booking.specialty.placeholder"),
2038
+ "aria-label": c("booking.specialty.heading")
2039
+ }
2040
+ )
2041
+ ] });
2042
+ }
2043
+ function vs({
2044
+ services: e,
2045
+ value: t,
2046
+ valueIds: n,
2047
+ onChange: i,
2048
+ onChangeIds: a,
2049
+ pickerStyle: r,
2050
+ compact: c
2051
+ }) {
2052
+ const { t: l, i18n: f } = q(), u = r ?? (c ? "select" : "cards"), g = e.map((p) => {
2053
+ const m = Mt(p), S = p.payment ? m ? l(`booking.payment.${m.kind}`, {
2054
+ amount: st(
2055
+ m.amountCents,
2056
+ m.currencyCode,
2057
+ f.language
2058
+ )
2059
+ }) : l("booking.payment.unavailable") : ps(p);
2060
+ return S ? {
2061
+ value: p.id,
2062
+ label: p.label,
2063
+ endContent: /* @__PURE__ */ s(Qt, { variant: "accentSoft", size: "lg", children: S })
2064
+ } : {
2065
+ value: p.id,
2066
+ label: `${p.label} · ${l("booking.serviceSummary", {
2067
+ minutes: p.durationMin
2068
+ })}`
2069
+ };
2070
+ }), o = /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: l("booking.service.heading") });
2071
+ return u === "multi-select" && a ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2072
+ o,
2073
+ /* @__PURE__ */ s(
2074
+ Ct,
2075
+ {
2076
+ options: g,
2077
+ value: n ?? [],
2078
+ onChange: a,
2079
+ placeholder: l("booking.service.placeholder"),
2080
+ "aria-label": l("booking.service.heading"),
2081
+ allowClear: !0
2082
+ }
2083
+ )
2084
+ ] }) : u === "combobox" ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2085
+ o,
2086
+ /* @__PURE__ */ s(
2087
+ wt,
2088
+ {
2089
+ options: g,
2090
+ value: t ?? "",
2091
+ onValueChange: (p) => i(p === "" ? "" : p),
2092
+ placeholder: l("booking.service.placeholder"),
2093
+ "aria-label": l("booking.service.heading"),
2094
+ clearable: !0
2095
+ }
2096
+ )
2097
+ ] }) : u === "select" ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2098
+ o,
2099
+ /* @__PURE__ */ s(
2100
+ vt,
2101
+ {
2102
+ options: g,
2103
+ value: t ?? "",
2104
+ onValueChange: (p) => i(p),
2105
+ placeholder: l("booking.service.placeholder"),
2106
+ "aria-label": l("booking.service.heading")
2107
+ }
2108
+ )
2109
+ ] }) : /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2110
+ o,
2111
+ /* @__PURE__ */ s(
2112
+ Hn,
2113
+ {
2114
+ services: e,
2115
+ selectedServiceId: t,
2116
+ onSelect: i
2117
+ }
2118
+ )
2119
+ ] });
2120
+ }
2121
+ function bs({
2122
+ operators: e,
2123
+ value: t,
2124
+ valueIds: n,
2125
+ onChange: i,
2126
+ onChangeIds: a,
2127
+ pickerStyle: r = "select"
2128
+ }) {
2129
+ const { t: c } = q(), l = /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: c("booking.operator.heading") });
2130
+ if (r === "multi-select" && a) {
2131
+ const u = e.map((g) => ({
2132
+ value: g.id,
2133
+ label: g.name
2134
+ }));
2135
+ return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2136
+ l,
2137
+ /* @__PURE__ */ s(
2138
+ Ct,
2139
+ {
2140
+ options: u,
2141
+ value: n ?? [],
2142
+ onChange: a,
2143
+ placeholder: c("booking.operator.placeholder"),
2144
+ "aria-label": c("booking.operator.heading"),
2145
+ allowClear: !0
2146
+ }
2147
+ )
2148
+ ] });
2149
+ }
2150
+ const f = [
2151
+ { value: ge, label: c("booking.operator.all") },
2152
+ ...e.map((u) => ({ value: u.id, label: u.name }))
2153
+ ];
2154
+ return r === "combobox" ? /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2155
+ l,
2156
+ /* @__PURE__ */ s(
2157
+ wt,
2158
+ {
2159
+ options: f,
2160
+ value: t ?? ge,
2161
+ onValueChange: (u) => i(u === "" ? ge : u),
2162
+ placeholder: c("booking.operator.placeholder"),
2163
+ "aria-label": c("booking.operator.heading"),
2164
+ clearable: !0
2165
+ }
2166
+ )
2167
+ ] }) : /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2168
+ l,
2169
+ /* @__PURE__ */ s(
2170
+ vt,
2171
+ {
2172
+ options: f,
2173
+ value: t ?? ge,
2174
+ onValueChange: (u) => i(u),
2175
+ placeholder: c("booking.operator.placeholder"),
2176
+ "aria-label": c("booking.operator.heading")
2177
+ }
2178
+ )
2179
+ ] });
2180
+ }
2181
+ function ys({
2182
+ customSlot: e
2183
+ }) {
2184
+ const { t } = q();
2185
+ return e ? /* @__PURE__ */ s(ce, { children: e }) : /* @__PURE__ */ b(X, { variant: "warning", children: [
2186
+ /* @__PURE__ */ s(X.Title, { as: "h4", children: t("booking.onboardingIncomplete.title") }),
2187
+ /* @__PURE__ */ s(X.Description, { children: t("booking.onboardingIncomplete.description") })
2188
+ ] });
2189
+ }
2190
+ function Tt({
2191
+ nextAvailableDate: e,
2192
+ onJump: t,
2193
+ locale: n
2194
+ }) {
2195
+ const { t: i } = q(), a = M(() => {
2196
+ try {
2197
+ return new Intl.DateTimeFormat(n, { dateStyle: "long" }).format(
2198
+ le(e)
2199
+ );
2200
+ } catch {
2201
+ return e;
2202
+ }
2203
+ }, [e, n]);
2204
+ return /* @__PURE__ */ b(X, { variant: "info", children: [
2205
+ /* @__PURE__ */ s(X.Description, { children: i("booking.nextAvailable.description", { date: a }) }),
2206
+ /* @__PURE__ */ s(X.Action, { children: /* @__PURE__ */ s(Ve, { intent: "secondary", size: "sm", onClick: t, children: i("booking.nextAvailable.cta") }) })
2207
+ ] });
2208
+ }
2209
+ function Xn({
2210
+ payment: e,
2211
+ snapshot: t,
2212
+ operators: n,
2213
+ specialties: i,
2214
+ services: a,
2215
+ locale: r,
2216
+ mode: c,
2217
+ showModify: l,
2218
+ onReset: f,
2219
+ onModify: u,
2220
+ focusWasLost: g
2221
+ }) {
2222
+ const { t: o } = q(), p = E(null);
2223
+ z(() => {
2224
+ const w = p.current, A = document.activeElement, h = w == null ? void 0 : w.closest('[data-component="booking"]');
2225
+ !e || !w || (A && (h != null && h.contains(A)) || g()) && w.focus();
2226
+ }, []);
2227
+ const S = (t.details.confirmationChannels ?? ["email"]).map(
2228
+ (w) => o(`booking.confirmation.channel.${w}`)
2229
+ ), y = e ? st(e.amountCents, e.currencyCode, r) : "", N = e ? o(
2230
+ c === "demo" ? "booking.payment.paidDemo" : "booking.payment.paidBody",
2231
+ { amount: y }
2232
+ ) : c === "demo" ? o("booking.success.descriptionDemo") : S.length > 1 ? o("booking.success.descriptionMultiple", {
2233
+ channels: S.join(" · ")
2234
+ }) : o("booking.success.descriptionSingle", { channel: S[0] }), _ = M(() => {
2235
+ if (t.date)
2236
+ try {
2237
+ return new Intl.DateTimeFormat(r, {
2238
+ weekday: "long",
2239
+ day: "numeric",
2240
+ month: "long"
2241
+ }).format(le(t.date));
2242
+ } catch {
2243
+ return t.date;
2244
+ }
2245
+ }, [t.date, r]), I = M(() => {
2246
+ const A = (t.operatorIds && t.operatorIds.length > 0 ? t.operatorIds : t.operatorId ? [t.operatorId] : []).filter((h) => h !== ge).map((h) => {
2247
+ var d;
2248
+ return (d = n.find((T) => T.id === h)) == null ? void 0 : d.name;
2249
+ }).filter((h) => h !== void 0);
2250
+ if (A.length === 0) return "";
2251
+ try {
2252
+ return new Intl.ListFormat(r === "en" ? "en-GB" : r, {
2253
+ style: "long",
2254
+ type: "conjunction"
2255
+ }).format(A);
2256
+ } catch {
2257
+ return A.join(", ");
2258
+ }
2259
+ }, [t.operatorIds, t.operatorId, n, r]), v = t.specialtyId ? i.find((w) => w.id === t.specialtyId) : void 0, x = t.serviceId ? a.find((w) => w.id === t.serviceId) : void 0;
2260
+ return /* @__PURE__ */ b(
2261
+ "div",
2262
+ {
2263
+ "data-component": "booking-success",
2264
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
2265
+ children: [
2266
+ /* @__PURE__ */ b(X, { variant: "success", children: [
2267
+ /* @__PURE__ */ s(
2268
+ X.Title,
2269
+ {
2270
+ as: "h3",
2271
+ ref: p,
2272
+ tabIndex: e ? -1 : void 0,
2273
+ className: e ? ft : void 0,
2274
+ children: o(
2275
+ e ? c === "demo" ? "booking.payment.paidDemoTitle" : "booking.payment.paidTitle" : "booking.success.heading"
2276
+ )
2277
+ }
2278
+ ),
2279
+ /* @__PURE__ */ s(X.Description, { children: N })
2280
+ ] }),
2281
+ /* @__PURE__ */ s("div", { className: "ds:rounded-[var(--radius-md)] ds:bg-[var(--secondary)] ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ b("dl", { className: "ds:grid ds:grid-cols-[auto_minmax(0,1fr)] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] ds:m-0", children: [
2282
+ e && c !== "demo" ? /* @__PURE__ */ b(ce, { children: [
2283
+ /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.payment.summaryPaid") }),
2284
+ /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: y })
2285
+ ] }) : null,
2286
+ v ? /* @__PURE__ */ b(ce, { children: [
2287
+ /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summarySpecialty") }),
2288
+ /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: v.label })
2289
+ ] }) : null,
2290
+ x ? /* @__PURE__ */ b(ce, { children: [
2291
+ /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summaryService") }),
2292
+ /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: x.label })
2293
+ ] }) : null,
2294
+ _ ? /* @__PURE__ */ b(ce, { children: [
2295
+ /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summaryDate") }),
2296
+ /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: _ })
2297
+ ] }) : null,
2298
+ /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summaryTime") }),
2299
+ /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: t.slot.time }),
2300
+ I ? /* @__PURE__ */ b(ce, { children: [
2301
+ /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summaryProvider") }),
2302
+ /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: I })
2303
+ ] }) : null
2304
+ ] }) }),
2305
+ /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
2306
+ /* @__PURE__ */ s(Ve, { intent: "secondary", size: "md", onClick: f, children: o("booking.success.bookAnother") }),
2307
+ l ? /* @__PURE__ */ s(Ve, { intent: "ghost", size: "md", onClick: u, children: o("booking.success.modifyBooking") }) : null
2308
+ ] })
2309
+ ]
2310
+ }
2311
+ );
2312
+ }
2313
+ function ks({ customSlot: e }) {
2314
+ const { t } = q();
2315
+ return e ? /* @__PURE__ */ s(ce, { children: e }) : /* @__PURE__ */ s(
2316
+ es,
2317
+ {
2318
+ variant: "no-results",
2319
+ title: t("booking.emptyServices.title"),
2320
+ description: t("booking.emptyServices.description")
2321
+ }
2322
+ );
2323
+ }
2324
+ const Ss = "data-booking-step-active", Qn = `[${Ss}]`, ft = [
2325
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
2326
+ "ds:focus-visible:outline-solid",
2327
+ "ds:focus-visible:outline-[var(--ring)]",
2328
+ "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
2329
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
2330
+ ].join(" ");
2331
+ function j({
2332
+ step: e,
2333
+ active: t,
2334
+ className: n,
2335
+ id: i,
2336
+ children: a
2337
+ }) {
2338
+ return /* @__PURE__ */ s(
2339
+ "div",
2340
+ {
2341
+ id: i,
2342
+ "data-booking-step": String(e),
2343
+ ...t ? { [Ss]: "" } : null,
2344
+ tabIndex: -1,
2345
+ className: n ? `${n} ${ft}` : ft,
2346
+ children: a
2347
+ }
2348
+ );
2349
+ }
2350
+ function Ot(e, t) {
2351
+ return t === "four-day-grid" ? e.filter((n) => n !== 6) : e;
2352
+ }
2353
+ function ei(e) {
2354
+ const {
2355
+ cascade: t,
2356
+ inputs: n,
2357
+ value: i,
2358
+ onChange: a,
2359
+ onSubmit: r,
2360
+ emptyServicesSlot: c,
2361
+ onboardingIncompleteSlot: l,
2362
+ loadingDates: f,
2363
+ loadingSlots: u,
2364
+ onDateSelect: g,
2365
+ onWindowChange: o,
2366
+ datePickerStyle: p,
2367
+ specialtyPickerStyle: m,
2368
+ servicePickerStyle: S,
2369
+ operatorPickerStyle: y,
2370
+ submitting: N,
2371
+ locale: _,
2372
+ detailsProps: I,
2373
+ agentIdBase: v,
2374
+ activeStep: x
2375
+ } = e, { t: w } = q(), A = He(x, p), h = (d, T) => ({
2376
+ step: d,
2377
+ active: d === A,
2378
+ className: T
2379
+ });
2380
+ return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2381
+ t.gates.insurance ? /* @__PURE__ */ s(j, { ...h(1), children: /* @__PURE__ */ s(
2382
+ gs,
2383
+ {
2384
+ value: i.insuranceType,
2385
+ onChange: (d) => a(ss(i, d))
2386
+ }
2387
+ ) }) : null,
2388
+ t.gates.specialty ? /* @__PURE__ */ s(j, { ...h(2), children: /* @__PURE__ */ s(
2389
+ hs,
2390
+ {
2391
+ specialties: t.filtered.specialties,
2392
+ value: i.specialtyId,
2393
+ valueIds: i.specialtyIds,
2394
+ onChange: (d) => a(ns(i, d)),
2395
+ onChangeIds: (d) => a(is(i, d)),
2396
+ pickerStyle: m
2397
+ }
2398
+ ) }) : null,
2399
+ t.gates.service ? /* @__PURE__ */ s(j, { ...h(3), children: t.filtered.services.length === 0 ? /* @__PURE__ */ s(ks, { customSlot: c }) : /* @__PURE__ */ s(
2400
+ vs,
2401
+ {
2402
+ services: t.filtered.services,
2403
+ value: i.serviceId,
2404
+ valueIds: i.serviceIds,
2405
+ onChange: (d) => a(as(i, d)),
2406
+ onChangeIds: (d) => a(rs(i, d)),
2407
+ pickerStyle: S
2408
+ }
2409
+ ) }) : null,
2410
+ t.gates.onboardingIncomplete ? /* @__PURE__ */ s(ys, { customSlot: l }) : null,
2411
+ t.gates.operator ? /* @__PURE__ */ s(j, { ...h(4), children: /* @__PURE__ */ s(
2412
+ bs,
2413
+ {
2414
+ operators: t.filtered.operators,
2415
+ value: i.operatorId,
2416
+ valueIds: i.operatorIds,
2417
+ onChange: (d) => a(os(i, d)),
2418
+ onChangeIds: (d) => a(ds(i, d)),
2419
+ pickerStyle: y
2420
+ }
2421
+ ) }) : null,
2422
+ t.gates.date ? /* @__PURE__ */ b(
2423
+ j,
2424
+ {
2425
+ ...h(5, "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"),
2426
+ children: [
2427
+ /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: w("booking.date.heading") }),
2428
+ n.availableDates.length === 0 && n.nextAvailableDate ? /* @__PURE__ */ s(
2429
+ Tt,
2430
+ {
2431
+ nextAvailableDate: n.nextAvailableDate,
2432
+ onJump: () => a(bt(i, n.nextAvailableDate)),
2433
+ locale: _
2434
+ }
2435
+ ) : ms({
2436
+ inputs: n,
2437
+ value: i,
2438
+ onChange: a,
2439
+ onDateSelect: g,
2440
+ onWindowChange: o,
2441
+ loadingDates: f,
2442
+ loadingSlots: u,
2443
+ locale: _,
2444
+ datePickerStyle: p,
2445
+ agentIdBase: v
2446
+ })
2447
+ ]
2448
+ }
2449
+ ) : null,
2450
+ t.gates.slot && i.date && p === "month-calendar" ? /* @__PURE__ */ b(
2451
+ j,
2452
+ {
2453
+ ...h(6, "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"),
2454
+ children: [
2455
+ /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: w("booking.slot.heading") }),
2456
+ fs({
2457
+ inputs: n,
2458
+ value: i,
2459
+ onChange: a,
2460
+ loadingSlots: u,
2461
+ locale: _,
2462
+ datePickerStyle: p
2463
+ })
2464
+ ]
2465
+ }
2466
+ ) : null,
2467
+ t.gates.details && t.selectedSlot ? /* @__PURE__ */ s(j, { ...h(7), children: /* @__PURE__ */ s(
2468
+ Dt,
2469
+ {
2470
+ ...I,
2471
+ value: i.details ?? {},
2472
+ onChange: (d) => a({ ...i, details: d }),
2473
+ onSubmit: r,
2474
+ submitting: N,
2475
+ defaultPhoneCountry: e.policy.country
2476
+ }
2477
+ ) }) : null
2478
+ ] });
2479
+ }
2480
+ function fe(e, t, n = {}) {
2481
+ const {
2482
+ cascade: i,
2483
+ inputs: a,
2484
+ value: r,
2485
+ onChange: c,
2486
+ onSubmit: l,
2487
+ emptyServicesSlot: f,
2488
+ onboardingIncompleteSlot: u,
2489
+ loadingDates: g,
2490
+ loadingSlots: o,
2491
+ onDateSelect: p,
2492
+ onWindowChange: m,
2493
+ datePickerStyle: S,
2494
+ specialtyPickerStyle: y,
2495
+ servicePickerStyle: N,
2496
+ operatorPickerStyle: _,
2497
+ submitting: I,
2498
+ locale: v,
2499
+ detailsProps: x,
2500
+ policy: w,
2501
+ agentIdBase: A
2502
+ } = t;
2503
+ switch (e) {
2504
+ case 1:
2505
+ return /* @__PURE__ */ s(
2506
+ gs,
2507
+ {
2508
+ value: r.insuranceType,
2509
+ onChange: (h) => c(ss(r, h))
2510
+ }
2511
+ );
2512
+ case 2:
2513
+ return /* @__PURE__ */ s(
2514
+ hs,
2515
+ {
2516
+ specialties: i.filtered.specialties,
2517
+ value: r.specialtyId,
2518
+ valueIds: r.specialtyIds,
2519
+ onChange: (h) => c(ns(r, h)),
2520
+ onChangeIds: (h) => c(is(r, h)),
2521
+ pickerStyle: y
2522
+ }
2523
+ );
2524
+ case 3:
2525
+ return i.filtered.services.length === 0 ? /* @__PURE__ */ s(ks, { customSlot: f }) : i.gates.onboardingIncomplete ? /* @__PURE__ */ s(ys, { customSlot: u }) : /* @__PURE__ */ s(
2526
+ vs,
2527
+ {
2528
+ services: i.filtered.services,
2529
+ value: r.serviceId,
2530
+ valueIds: r.serviceIds,
2531
+ onChange: (h) => c(as(r, h)),
2532
+ onChangeIds: (h) => c(rs(r, h)),
2533
+ pickerStyle: N,
2534
+ compact: n.compactService
2535
+ }
2536
+ );
2537
+ case 4:
2538
+ return /* @__PURE__ */ s(
2539
+ bs,
2540
+ {
2541
+ operators: i.filtered.operators,
2542
+ value: r.operatorId,
2543
+ valueIds: r.operatorIds,
2544
+ onChange: (h) => c(os(r, h)),
2545
+ onChangeIds: (h) => c(ds(r, h)),
2546
+ pickerStyle: _
2547
+ }
2548
+ );
2549
+ case 5:
2550
+ return a.availableDates.length === 0 && a.nextAvailableDate ? /* @__PURE__ */ s(
2551
+ Tt,
2552
+ {
2553
+ nextAvailableDate: a.nextAvailableDate,
2554
+ onJump: () => c(bt(r, a.nextAvailableDate)),
2555
+ locale: v
2556
+ }
2557
+ ) : ms({
2558
+ inputs: a,
2559
+ value: r,
2560
+ onChange: c,
2561
+ onDateSelect: p,
2562
+ onWindowChange: m,
2563
+ loadingDates: g,
2564
+ loadingSlots: o,
2565
+ locale: v,
2566
+ datePickerStyle: S,
2567
+ agentIdBase: A
2568
+ });
2569
+ case 6:
2570
+ return fs({
2571
+ inputs: a,
2572
+ value: r,
2573
+ onChange: c,
2574
+ loadingSlots: o,
2575
+ locale: v,
2576
+ datePickerStyle: S
2577
+ });
2578
+ case 7:
2579
+ return i.selectedSlot ? /* @__PURE__ */ s(
2580
+ Dt,
2581
+ {
2582
+ ...x,
2583
+ value: r.details ?? {},
2584
+ onChange: (h) => c({ ...r, details: h }),
2585
+ onSubmit: l,
2586
+ submitting: I,
2587
+ defaultPhoneCountry: w.country
2588
+ }
2589
+ ) : null;
2590
+ /* c8 ignore next 2 */
2591
+ default:
2592
+ return null;
2593
+ }
2594
+ }
2595
+ function yt() {
2596
+ const { t: e } = q();
2597
+ return M(
2598
+ () => ({
2599
+ 1: e("booking.insurance.heading"),
2600
+ 2: e("booking.specialty.heading"),
2601
+ 3: e("booking.service.heading"),
2602
+ 4: e("booking.operator.heading"),
2603
+ 5: e("booking.date.heading"),
2604
+ 6: e("booking.slot.heading"),
2605
+ 7: e("booking.details.heading")
2606
+ }),
2607
+ [e]
2608
+ );
2609
+ }
2610
+ function He(e, t) {
2611
+ return t === "four-day-grid" && e === 6 ? 5 : e;
2612
+ }
2613
+ function ti(e) {
2614
+ const { cascade: t, value: n, activeStep: i, setActiveStep: a, datePickerStyle: r } = e, c = yt(), { t: l } = q(), f = l("booking.operator.all"), u = M(
2615
+ () => Ot(t.visibleSteps, r),
2616
+ [t.visibleSteps, r]
2617
+ ), g = He(i, r), o = Math.max(0, u.indexOf(g)), p = M(
2618
+ () => u.map((m) => ({
2619
+ label: c[m],
2620
+ summary: xs(m, n, t, f),
2621
+ status: si(m, n, t),
2622
+ content: /* @__PURE__ */ s(j, { step: m, active: m === g, children: fe(m, e, { compactService: !0 }) })
2623
+ })),
2624
+ [
2625
+ u,
2626
+ n,
2627
+ c,
2628
+ t,
2629
+ e,
2630
+ g,
2631
+ f
2632
+ ]
2633
+ );
2634
+ return /* @__PURE__ */ s(
2635
+ Ls,
2636
+ {
2637
+ activeStep: o,
2638
+ steps: p,
2639
+ onStepChange: (m) => {
2640
+ const S = u[m];
2641
+ S && a(S);
2642
+ }
2643
+ }
2644
+ );
2645
+ }
2646
+ function si(e, t, n) {
2647
+ return _e(e, t) && e < n.currentStep ? "completed" : e <= n.currentStep ? "unlocked" : void 0;
2648
+ }
2649
+ function _e(e, t) {
2650
+ switch (e) {
2651
+ case 1:
2652
+ return t.insuranceType !== void 0;
2653
+ case 2:
2654
+ return Ce(t).length > 0;
2655
+ case 3:
2656
+ return Se(t).length > 0;
2657
+ case 4:
2658
+ return At(t).length > 0;
2659
+ case 5:
2660
+ return t.date !== void 0;
2661
+ case 6:
2662
+ return t.slotKey !== void 0;
2663
+ case 7:
2664
+ return !1;
2665
+ }
2666
+ }
2667
+ function Yt(e, t) {
2668
+ return e !== 4 ? _e(e, t) : t.operatorIds && t.operatorIds.length > 0 ? !0 : ls(t) !== void 0;
2669
+ }
2670
+ function It(e, t) {
2671
+ const n = e.map((i) => {
2672
+ var a;
2673
+ return (a = t.find((r) => r.id === i)) == null ? void 0 : a.label;
2674
+ }).filter((i) => i !== void 0);
2675
+ return n.length > 0 ? n.join(", ") : void 0;
2676
+ }
2677
+ function xs(e, t, n, i) {
2678
+ var a;
2679
+ if (_e(e, t))
2680
+ switch (e) {
2681
+ case 1:
2682
+ return t.insuranceType;
2683
+ case 2:
2684
+ return It(
2685
+ Ce(t),
2686
+ n.filtered.specialties
2687
+ );
2688
+ case 3:
2689
+ return It(Se(t), n.filtered.services);
2690
+ case 4: {
2691
+ const r = At(t), c = r.filter((f) => f !== ge), l = It(
2692
+ c,
2693
+ n.filtered.operators.map((f) => ({
2694
+ id: f.id,
2695
+ label: f.name
2696
+ }))
2697
+ );
2698
+ return l !== void 0 ? l : r.includes(ge) ? i : void 0;
2699
+ }
2700
+ case 5:
2701
+ return t.date;
2702
+ case 6:
2703
+ return (a = n.selectedSlot) == null ? void 0 : a.time;
2704
+ case 7:
2705
+ return;
2706
+ }
2707
+ }
2708
+ function ni(e) {
2709
+ const { cascade: t, value: n, activeStep: i, setActiveStep: a } = e, { t: r } = q(), c = yt(), l = r("booking.operator.all"), f = `${gt()}-filter`, u = He(i, e.datePickerStyle), g = t.visibleSteps.filter(
2710
+ (m) => m === 1 || m === 2 || m === 3 || m === 4
2711
+ ), o = g.some(
2712
+ (m) => !_e(m, n)
2713
+ ), p = g.some(
2714
+ (m) => m === i
2715
+ ) ? i : g.find((m) => !_e(m, n));
2716
+ return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2717
+ g.length > 0 ? /* @__PURE__ */ s(
2718
+ "div",
2719
+ {
2720
+ role: "group",
2721
+ "aria-label": r("booking.filtersLabel"),
2722
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
2723
+ children: g.map((m) => {
2724
+ const S = xs(
2725
+ m,
2726
+ n,
2727
+ t,
2728
+ l
2729
+ ), y = m === p, N = _e(m, n);
2730
+ return /* @__PURE__ */ s(
2731
+ Ve,
2732
+ {
2733
+ intent: y ? "primary" : "outline",
2734
+ size: "sm",
2735
+ endIcon: /* @__PURE__ */ s(
2736
+ Vs,
2737
+ {
2738
+ "aria-hidden": "true",
2739
+ className: y ? "ds:rotate-180" : void 0
2740
+ }
2741
+ ),
2742
+ "aria-expanded": N ? y : void 0,
2743
+ "aria-controls": N && y ? f : void 0,
2744
+ "aria-current": !N && y ? "step" : void 0,
2745
+ onClick: () => a(
2746
+ N && y ? t.currentStep : m
2747
+ ),
2748
+ children: S ? /* @__PURE__ */ b(ce, { children: [
2749
+ c[m],
2750
+ ": ",
2751
+ S
2752
+ ] }) : c[m]
2753
+ },
2754
+ `csc-${m}`
2755
+ );
2756
+ })
2757
+ }
2758
+ ) : null,
2759
+ p !== void 0 ? /* @__PURE__ */ s(
2760
+ j,
2761
+ {
2762
+ step: p,
2763
+ active: p === u,
2764
+ id: f,
2765
+ children: fe(p, e, { compactService: !0 })
2766
+ }
2767
+ ) : null,
2768
+ !o && t.gates.date ? (
2769
+ // four-day-grid embeds slots inline with the day strip — the
2770
+ // historic 2-col date|slot split collapses to a single column
2771
+ // so the picker spans the full width instead of orphaning an
2772
+ // empty right cell.
2773
+ e.datePickerStyle === "four-day-grid" ? /* @__PURE__ */ s(j, { step: 5, active: u === 5, children: fe(5, e) }) : /* @__PURE__ */ b("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2", children: [
2774
+ /* @__PURE__ */ s(
2775
+ j,
2776
+ {
2777
+ step: 5,
2778
+ active: u === 5,
2779
+ className: "ds:min-w-0",
2780
+ children: fe(5, e)
2781
+ }
2782
+ ),
2783
+ n.date ? /* @__PURE__ */ s(
2784
+ j,
2785
+ {
2786
+ step: 6,
2787
+ active: u === 6,
2788
+ className: "ds:min-w-0",
2789
+ children: fe(6, e)
2790
+ }
2791
+ ) : /* @__PURE__ */ s("div", { className: "ds:min-w-0" })
2792
+ ] })
2793
+ ) : null,
2794
+ t.gates.details ? /* @__PURE__ */ s(j, { step: 7, active: u === 7, children: fe(7, e) }) : null
2795
+ ] });
2796
+ }
2797
+ function ii(e) {
2798
+ const { cascade: t, datePickerStyle: n, activeStep: i } = e, a = He(i, n), r = t.visibleSteps.filter(
2799
+ (l) => l === 1 || l === 2 || l === 3 || l === 4
2800
+ );
2801
+ return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2802
+ /* @__PURE__ */ b(
2803
+ "div",
2804
+ {
2805
+ className: n === "four-day-grid" ? "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]" : "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2",
2806
+ children: [
2807
+ /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: r.map((l) => /* @__PURE__ */ s(j, { step: l, active: l === a, children: fe(l, e, { compactService: !0 }) }, `fbf-${l}`)) }),
2808
+ /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2809
+ t.gates.date ? /* @__PURE__ */ s(j, { step: 5, active: a === 5, children: fe(5, e) }) : null,
2810
+ t.gates.slot && e.value.date && n === "month-calendar" ? /* @__PURE__ */ s(j, { step: 6, active: a === 6, children: fe(6, e) }) : null
2811
+ ] })
2812
+ ]
2813
+ }
2814
+ ),
2815
+ t.gates.details ? /* @__PURE__ */ s(j, { step: 7, active: a === 7, children: fe(7, e) }) : null
2816
+ ] });
2817
+ }
2818
+ function ai(e) {
2819
+ const { cascade: t, value: n, activeStep: i, setActiveStep: a, datePickerStyle: r } = e, { t: c } = q(), l = yt(), f = M(
2820
+ () => Ot(t.visibleSteps, r),
2821
+ [t.visibleSteps, r]
2822
+ ), u = He(i, r), g = Math.max(0, f.indexOf(u)), o = f.length, p = M(
2823
+ () => f.map((N) => ({ label: l[N] })),
2824
+ [f, l]
2825
+ ), m = g > 0, S = u === 5 && r === "four-day-grid", y = g < o - 1 && _e(u, n) && (!S || _e(6, n));
2826
+ return /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2827
+ /* @__PURE__ */ s(Ps, { activeStep: g, steps: p }),
2828
+ /* @__PURE__ */ s(j, { step: u, active: !0, children: fe(u, e, { compactService: !0 }) }),
2829
+ /* @__PURE__ */ b("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
2830
+ /* @__PURE__ */ s(
2831
+ Ve,
2832
+ {
2833
+ intent: "ghost",
2834
+ size: "md",
2835
+ disabled: !m,
2836
+ onClick: () => {
2837
+ const N = f[g - 1];
2838
+ N && a(N);
2839
+ },
2840
+ children: c("booking.actions.back")
2841
+ }
2842
+ ),
2843
+ u < 7 ? /* @__PURE__ */ s(
2844
+ Ve,
2845
+ {
2846
+ intent: "primary",
2847
+ size: "md",
2848
+ disabled: !y,
2849
+ onClick: () => {
2850
+ const N = f[g + 1];
2851
+ N && a(N);
2852
+ },
2853
+ children: c("booking.actions.next")
2854
+ }
2855
+ ) : null
2856
+ ] })
2857
+ ] });
2858
+ }
2859
+ const ri = [], oi = [];
2860
+ function Wt() {
2861
+ return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2862
+ }
2863
+ const di = Zt(
2864
+ ({
2865
+ variant: e = "inline-list",
2866
+ country: t,
2867
+ // No default — the cascade engine treats `undefined` as "auto-on
2868
+ // when `specialties` has items" so consumers who pass specialty
2869
+ // data without the explicit flag still get the step.
2870
+ useSpecialties: n,
2871
+ allowOperatorSelection: i = !1,
2872
+ lockedOperatorId: a,
2873
+ operatorsByService: r = !1,
2874
+ autoSelectSingleService: c = !1,
2875
+ specialties: l,
2876
+ services: f,
2877
+ operators: u,
2878
+ availableDates: g,
2879
+ availableSlots: o,
2880
+ nextAvailableDate: p,
2881
+ requireCodiceFiscale: m,
2882
+ requireDateOfBirth: S,
2883
+ requireInsuranceNumber: y,
2884
+ showNote: N,
2885
+ showReturningPatientFlag: _,
2886
+ privacyPolicyUrl: I,
2887
+ termsUrl: v,
2888
+ paymentTermsUrl: x,
2889
+ paymentState: w,
2890
+ renderPayment: A,
2891
+ renderPaymentCompletion: h,
2892
+ validateCodiceFiscale: d,
2893
+ validateInsuranceNumber: T,
2894
+ confirmationChannels: F,
2895
+ defaultConfirmationChannels: V,
2896
+ value: D,
2897
+ onChange: O,
2898
+ onSubmit: J,
2899
+ onStepChange: Q,
2900
+ onDateSelect: Ae,
2901
+ onWindowChange: ae,
2902
+ datePickerStyle: Z = "month-calendar",
2903
+ specialtyPickerStyle: ue,
2904
+ servicePickerStyle: ve,
2905
+ operatorPickerStyle: K,
2906
+ loadingDates: Re,
2907
+ loadingSlots: se,
2908
+ submitting: H,
2909
+ submitError: re,
2910
+ mode: P = "live",
2911
+ showModifyOnSuccess: oe = !0,
2912
+ surface: $e = "flat",
2913
+ emptyServicesSlot: De,
2914
+ onboardingIncompleteSlot: Me,
2915
+ "aria-label": Ee,
2916
+ id: G,
2917
+ className: pe,
2918
+ onFocus: Te,
2919
+ onBlur: be,
2920
+ ...nt
2921
+ }, Ke) => {
2922
+ var Kt, zt;
2923
+ const { t: ee, i18n: Le } = q(), te = e ?? "inline-list", Oe = Le.language ?? "en", xe = l ?? ri, Ie = u ?? oi;
2924
+ z(() => {
2925
+ const C = On(D, {
2926
+ useSpecialties: n,
2927
+ lockedOperatorId: a,
2928
+ autoSelectSingleService: c,
2929
+ specialties: xe,
2930
+ services: f
2931
+ });
2932
+ (C.specialtyId !== D.specialtyId || C.operatorId !== D.operatorId || C.serviceId !== D.serviceId) && O(C);
2933
+ }, [
2934
+ a,
2935
+ n,
2936
+ c,
2937
+ xe,
2938
+ f
2939
+ ]);
2940
+ const L = M(
2941
+ () => Tn({
2942
+ country: t,
2943
+ useSpecialties: n,
2944
+ allowOperatorSelection: i,
2945
+ lockedOperatorId: a,
2946
+ operatorsByService: r,
2947
+ specialties: xe,
2948
+ services: f,
2949
+ operators: Ie,
2950
+ availableSlots: o,
2951
+ value: D
2952
+ }),
2953
+ [
2954
+ t,
2955
+ n,
2956
+ i,
2957
+ a,
2958
+ r,
2959
+ c,
2960
+ xe,
2961
+ f,
2962
+ Ie,
2963
+ g,
2964
+ o,
2965
+ D
2966
+ ]
2967
+ ), ze = M(
2968
+ () => [
2969
+ JSON.stringify(D.insuranceType),
2970
+ JSON.stringify(Ce(D)),
2971
+ JSON.stringify(Se(D)),
2972
+ JSON.stringify(At(D)),
2973
+ JSON.stringify(D.date),
2974
+ JSON.stringify(D.slotKey)
2975
+ ],
2976
+ [D]
2977
+ ), je = te === "progress", it = ke(
2978
+ (C) => {
2979
+ if (!je) return L.currentStep;
2980
+ const B = L.visibleSteps.find(
2981
+ (R) => R > C && !Yt(R, D)
2982
+ );
2983
+ return B === void 0 ? L.currentStep : Math.min(B, L.currentStep);
2984
+ },
2985
+ [je, L.visibleSteps, L.currentStep, D]
2986
+ ), [ne, Ne] = ie(
2987
+ L.currentStep
2988
+ ), Ge = E(ze), Ue = E(L.visibleSteps);
2989
+ z(() => {
2990
+ const C = Ge.current, B = Ue.current;
2991
+ Ge.current = ze, Ue.current = L.visibleSteps;
2992
+ const R = ze.findIndex(
2993
+ (de, jt) => de !== C[jt]
2994
+ );
2995
+ if (R !== -1) {
2996
+ Ne(it(R + 1));
2997
+ return;
2998
+ }
2999
+ const W = je ? L.visibleSteps.find(
3000
+ (de) => de < ne && !B.includes(de) && !Yt(de, D)
3001
+ ) : void 0;
3002
+ if (W !== void 0) {
3003
+ Ne(W);
3004
+ return;
3005
+ }
3006
+ L.visibleSteps.includes(ne) || Ne(L.currentStep);
3007
+ }, [
3008
+ ze,
3009
+ it,
3010
+ je,
3011
+ L.currentStep,
3012
+ L.visibleSteps,
3013
+ ne,
3014
+ D
3015
+ ]);
3016
+ const me = E(null), k = M(
3017
+ () => Ot(L.visibleSteps, Z),
3018
+ [L.visibleSteps, Z]
3019
+ ), $ = yt(), [Pe, Is] = ie(""), Ye = E(null), at = E(null);
3020
+ z(() => {
3021
+ const C = He(ne, Z);
3022
+ if (at.current === null) {
3023
+ at.current = C;
3024
+ return;
3025
+ }
3026
+ if (at.current === C) return;
3027
+ at.current = C;
3028
+ const B = k.indexOf(C);
3029
+ Is(
3030
+ B === -1 ? "" : ee("booking.stepAnnouncement", {
3031
+ current: B + 1,
3032
+ total: k.length,
3033
+ label: $[C]
3034
+ })
3035
+ );
3036
+ const R = Ye.current;
3037
+ if (!R || R.isConnected) return;
3038
+ const W = me.current;
3039
+ if (!W) return;
3040
+ const de = document.activeElement;
3041
+ if (!(de === null || de === document.body || !W.contains(de))) return;
3042
+ const rt = W.querySelector(Qn) ?? W;
3043
+ if (rt.focus({ preventScroll: !0 }), typeof rt.scrollIntoView == "function")
3044
+ try {
3045
+ rt.scrollIntoView({
3046
+ behavior: Wt() ? "auto" : "smooth",
3047
+ block: "nearest"
3048
+ });
3049
+ } catch {
3050
+ rt.scrollIntoView();
3051
+ }
3052
+ }, [ne, Z, k, $, ee]);
3053
+ const U = Pn({
3054
+ services: f,
3055
+ value: D,
3056
+ availableSlots: o,
3057
+ onSubmit: J,
3058
+ onChange: O,
3059
+ paymentState: w,
3060
+ submitting: H,
3061
+ paymentTermsUrl: x,
3062
+ renderPayment: A
3063
+ }), Y = U.status, Bt = U.submit, kt = E(U.reset);
3064
+ kt.current = U.reset;
3065
+ const _t = gt(), Rt = E(null), Et = E(null), Lt = ((Kt = U.state) == null ? void 0 : Kt.status) === "failed", Pt = U.state && "phase" in U.state && U.state.phase === "completion";
3066
+ z(() => {
3067
+ var C, B;
3068
+ if (Y === "payment") {
3069
+ const R = document.activeElement;
3070
+ (!Pt || !R || R === document.body || !((C = me.current) != null && C.contains(R))) && ((B = Rt.current) == null || B.focus());
3071
+ }
3072
+ }, [Y, Pt]), z(() => {
3073
+ var C;
3074
+ Y === "payment" && Lt && ((C = Et.current) == null || C.focus());
3075
+ }, [Y, Lt]), Ds(Ke, () => me.current, []);
3076
+ const We = Y === "success" ? 8 : Y === "payment" ? 7 : L.currentStep, Ft = E(null);
3077
+ z(() => {
3078
+ if (We !== Ft.current && (Ft.current = We, Q == null || Q(We), We === 8 && me.current))
3079
+ try {
3080
+ me.current.scrollIntoView({
3081
+ behavior: Wt() ? "auto" : "smooth",
3082
+ block: "start"
3083
+ });
3084
+ } catch {
3085
+ me.current.scrollIntoView();
3086
+ }
3087
+ }, [We, Q]);
3088
+ const Ze = E({ activeStep: ne, cascade: L, submitState: Y });
3089
+ z(() => {
3090
+ Ze.current = { activeStep: ne, cascade: L, submitState: Y };
3091
+ }, [ne, L, Y]);
3092
+ const Vt = M(
3093
+ () => ({
3094
+ getVariant: () => te,
3095
+ getCurrentStep: () => {
3096
+ const C = Ze.current;
3097
+ return C.submitState === "success" ? 8 : C.submitState === "payment" ? 7 : C.activeStep;
3098
+ },
3099
+ reset: () => {
3100
+ Ze.current.submitState !== "payment" && (O({}), kt.current(), Ne(1));
3101
+ },
3102
+ goToStep: (C) => {
3103
+ const B = Ze.current, R = B.cascade.visibleSteps.includes(C), W = B.cascade.currentStep, de = B.submitState === "payment" ? 7 : !R || C > W ? W : C;
3104
+ Ze.current = { ...B, activeStep: de }, Ne(de);
3105
+ }
3106
+ }),
3107
+ [te, O]
3108
+ );
3109
+ Ts(In, Vt, G);
3110
+ const Ns = Ee ?? ee("booking.regionLabel"), we = U.snapshot, ws = Y === "success" && we ? /* @__PURE__ */ s(
3111
+ Xn,
3112
+ {
3113
+ payment: we.payment,
3114
+ snapshot: {
3115
+ ...we.value,
3116
+ slot: we.slot,
3117
+ details: we.details,
3118
+ serviceId: ((zt = we.payment) == null ? void 0 : zt.serviceId) ?? we.slot.serviceId ?? we.value.serviceId
3119
+ },
3120
+ operators: Ie,
3121
+ specialties: xe,
3122
+ services: f,
3123
+ locale: Oe,
3124
+ mode: P,
3125
+ showModify: oe && !we.payment,
3126
+ onReset: () => Vt.reset(),
3127
+ focusWasLost: () => {
3128
+ const C = Ye.current, B = document.activeElement;
3129
+ return !!(C && !C.isConnected) && (!B || B === document.body);
3130
+ },
3131
+ onModify: () => {
3132
+ kt.current(), Ne(7);
3133
+ }
3134
+ }
3135
+ ) : null, St = U.activeSession, Xe = U.state, ye = St && Xe ? { session: St, payment: St.payment, state: Xe } : void 0, Qe = Xe && "phase" in Xe && Xe.phase === "completion", Cs = Y === "payment" && ye ? /* @__PURE__ */ b(
3136
+ "section",
3137
+ {
3138
+ "aria-labelledby": _t,
3139
+ "data-component": "booking-payment",
3140
+ "data-payment-status": ye.state.status,
3141
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
3142
+ children: [
3143
+ /* @__PURE__ */ s(
3144
+ "h3",
3145
+ {
3146
+ ref: Rt,
3147
+ id: _t,
3148
+ tabIndex: -1,
3149
+ className: "type-title-card ds:m-0",
3150
+ children: ee(
3151
+ Qe ? "booking.payment.confirming" : "booking.payment.heading"
3152
+ )
3153
+ }
3154
+ ),
3155
+ Qe ? null : /* @__PURE__ */ s("p", { className: "type-body ds:m-0", children: ee("booking.payment.noticeBody", {
3156
+ amount: st(
3157
+ ye.payment.amountCents,
3158
+ ye.payment.currencyCode,
3159
+ Oe
3160
+ )
3161
+ }) }),
3162
+ /* @__PURE__ */ s(
3163
+ "p",
3164
+ {
3165
+ role: "status",
3166
+ className: ye.state.status === "processing" ? "type-body ds:m-0 ds:flex ds:items-center ds:gap-[var(--spacing-sm)]" : "ds:sr-only",
3167
+ children: ye.state.status === "processing" ? /* @__PURE__ */ b(ce, { children: [
3168
+ /* @__PURE__ */ s(Xt, { variant: "pulse", size: "lg", "aria-hidden": "true" }),
3169
+ /* @__PURE__ */ s("span", { children: ee(
3170
+ Qe ? "booking.payment.confirming" : "booking.payment.processing"
3171
+ ) })
3172
+ ] }) : null
3173
+ }
3174
+ ),
3175
+ ye.state.status === "failed" ? /* @__PURE__ */ s(
3176
+ X,
3177
+ {
3178
+ ref: Et,
3179
+ variant: "error",
3180
+ tabIndex: -1,
3181
+ className: ft,
3182
+ children: /* @__PURE__ */ s(X.Description, { children: ye.state.error ?? ee(
3183
+ Qe ? "booking.payment.completionFailed" : "booking.payment.failed"
3184
+ ) })
3185
+ }
3186
+ ) : null,
3187
+ Qe ? h == null ? void 0 : h(ye) : A == null ? void 0 : A(ye)
3188
+ ]
3189
+ }
3190
+ ) : null, $t = M(() => {
3191
+ const C = new Set(Se(D)), B = f.filter((R) => C.has(R.id)).map((R) => {
3192
+ var W;
3193
+ return {
3194
+ label: R.label,
3195
+ text: ((W = R.criticalInformationToAccept) == null ? void 0 : W.trim()) ?? ""
3196
+ };
3197
+ }).filter((R) => R.text.length > 0);
3198
+ if (B.length !== 0)
3199
+ return B.length === 1 ? B[0].text : B.map((R) => `${R.label}: ${R.text}`).join(`
3200
+
3201
+ `);
3202
+ }, [f, D]), As = M(() => {
3203
+ if (Y === "success" || Y === "payment") return null;
3204
+ const C = te === "accordion" ? ti : te === "calendar" ? ni : te === "flexible" ? ii : te === "progress" ? ai : ei, B = {
3205
+ cascade: L,
3206
+ inputs: {
3207
+ specialties: xe,
3208
+ services: f,
3209
+ operators: Ie,
3210
+ availableDates: g,
3211
+ availableSlots: o,
3212
+ nextAvailableDate: p
3213
+ },
3214
+ value: D,
3215
+ onChange: O,
3216
+ onSubmit: Bt,
3217
+ policy: { country: t, lockedOperatorId: a },
3218
+ detailsProps: {
3219
+ requireCodiceFiscale: m,
3220
+ requireDateOfBirth: S,
3221
+ requireInsuranceNumber: y,
3222
+ insuranceType: D.insuranceType,
3223
+ showNote: N,
3224
+ showReturningPatientFlag: _,
3225
+ privacyPolicyUrl: I,
3226
+ termsUrl: v,
3227
+ criticalInformationToAccept: $t,
3228
+ payment: U.payment,
3229
+ paymentTermsUrl: x,
3230
+ paymentBlocked: U.blocked,
3231
+ validateCodiceFiscale: d,
3232
+ validateInsuranceNumber: T,
3233
+ confirmationChannels: F,
3234
+ defaultConfirmationChannels: V,
3235
+ submitError: re ?? (Y === "error" ? ee("booking.payment.submitFailed") : void 0)
3236
+ },
3237
+ emptyServicesSlot: De,
3238
+ onboardingIncompleteSlot: Me,
3239
+ loadingDates: Re,
3240
+ loadingSlots: se,
3241
+ onDateSelect: Ae,
3242
+ onWindowChange: ae,
3243
+ datePickerStyle: Z,
3244
+ specialtyPickerStyle: ue,
3245
+ servicePickerStyle: ve,
3246
+ operatorPickerStyle: K,
3247
+ submitting: H || Y === "submitting",
3248
+ locale: Oe,
3249
+ activeStep: ne,
3250
+ setActiveStep: Ne,
3251
+ agentIdBase: G
3252
+ };
3253
+ return /* @__PURE__ */ s(C, { ...B });
3254
+ }, [
3255
+ Y,
3256
+ U.payment,
3257
+ U.blocked,
3258
+ x,
3259
+ ee,
3260
+ te,
3261
+ L,
3262
+ xe,
3263
+ f,
3264
+ Ie,
3265
+ g,
3266
+ o,
3267
+ p,
3268
+ D,
3269
+ O,
3270
+ Bt,
3271
+ t,
3272
+ a,
3273
+ m,
3274
+ S,
3275
+ y,
3276
+ re,
3277
+ N,
3278
+ _,
3279
+ I,
3280
+ v,
3281
+ $t,
3282
+ d,
3283
+ T,
3284
+ F,
3285
+ V,
3286
+ De,
3287
+ Me,
3288
+ Re,
3289
+ se,
3290
+ Ae,
3291
+ ae,
3292
+ Z,
3293
+ ue,
3294
+ ve,
3295
+ K,
3296
+ H,
3297
+ Oe,
3298
+ ne,
3299
+ G
3300
+ ]);
3301
+ return /* @__PURE__ */ b(
3302
+ "div",
3303
+ {
3304
+ ref: me,
3305
+ role: "region",
3306
+ "aria-label": Ns,
3307
+ id: G,
3308
+ "data-component": "booking",
3309
+ "data-component-id": G,
3310
+ "data-variant": te,
3311
+ className: Fn({
3312
+ variant: te,
3313
+ surface: $e,
3314
+ className: pe
3315
+ }),
3316
+ tabIndex: -1,
3317
+ onFocus: (C) => {
3318
+ Ye.current = C.target, Te == null || Te(C);
3319
+ },
3320
+ onBlur: (C) => {
3321
+ const B = C.target;
3322
+ window.setTimeout(() => {
3323
+ var W;
3324
+ const R = document.activeElement;
3325
+ Ye.current === B && B.isConnected && !(R && ((W = me.current) != null && W.contains(R))) && (Ye.current = null);
3326
+ }), be == null || be(C);
3327
+ },
3328
+ ...nt,
3329
+ children: [
3330
+ /* @__PURE__ */ s("div", { role: "status", className: "ds:sr-only", children: Pe }),
3331
+ /* @__PURE__ */ b(
3332
+ "div",
3333
+ {
3334
+ className: [
3335
+ "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
3336
+ "ds:rounded-[var(--radius-md)]",
3337
+ "ds:bg-[color-mix(in_srgb,var(--primary)_35%,var(--background))]",
3338
+ "ds:bg-[image:var(--gradient-hero-brand)]",
3339
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
3340
+ "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]"
3341
+ ].join(" "),
3342
+ children: [
3343
+ /* @__PURE__ */ s("h2", { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: ee("booking.regionLabel") }),
3344
+ /* @__PURE__ */ s("p", { className: "type-body-sm ds:text-[var(--foreground)] ds:m-0", children: ee("booking.headingSubtitle") })
3345
+ ]
3346
+ }
3347
+ ),
3348
+ U.cancelled ? /* @__PURE__ */ s(X, { variant: "info", children: /* @__PURE__ */ s(X.Description, { children: ee("booking.payment.cancelled") }) }) : null,
3349
+ ws ?? Cs ?? As
3350
+ ]
3351
+ }
3352
+ );
3353
+ }
3354
+ );
3355
+ di.displayName = "Booking";
3356
+ export {
3357
+ di as B,
3358
+ Nt as C,
3359
+ ge as O,
3360
+ In as b
3361
+ };
3362
+ //# sourceMappingURL=booking-C4MwImkS.js.map