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