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