@alfadocs/ui-kit-debug 1.81.0 → 1.83.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 (143) hide show
  1. package/dist/_chunks/{anamnesis-summary-rows-BYtpwCyn.js → anamnesis-summary-rows-6gMuu0ZK.js} +2 -2
  2. package/dist/_chunks/{anamnesis-summary-rows-BYtpwCyn.js.map → anamnesis-summary-rows-6gMuu0ZK.js.map} +1 -1
  3. package/dist/_chunks/{balance-badge-cell-NoEPeFdj.js → balance-badge-cell-BHXJS8Ga.js} +2 -2
  4. package/dist/_chunks/{balance-badge-cell-NoEPeFdj.js.map → balance-badge-cell-BHXJS8Ga.js.map} +1 -1
  5. package/dist/_chunks/booking-dsgiuhKg.js +4304 -0
  6. package/dist/_chunks/booking-dsgiuhKg.js.map +1 -0
  7. package/dist/_chunks/{link-cell-renderer-Dwp_DCYT.js → link-cell-renderer-C0ynDik7.js} +2 -2
  8. package/dist/_chunks/{link-cell-renderer-Dwp_DCYT.js.map → link-cell-renderer-C0ynDik7.js.map} +1 -1
  9. package/dist/_chunks/login-dev-card-DYwbL5sD.js +385 -0
  10. package/dist/_chunks/login-dev-card-DYwbL5sD.js.map +1 -0
  11. package/dist/_chunks/{multi-select-IOVnOGlP.js → multi-select-i5MFRpXg.js} +153 -146
  12. package/dist/_chunks/multi-select-i5MFRpXg.js.map +1 -0
  13. package/dist/_chunks/{otp-input-BgEZi0py.js → otp-input-gV1446Dw.js} +70 -70
  14. package/dist/_chunks/otp-input-gV1446Dw.js.map +1 -0
  15. package/dist/_chunks/{registration-form-e9oYscB7.js → registration-form-DmP3YUfp.js} +2 -2
  16. package/dist/_chunks/{registration-form-e9oYscB7.js.map → registration-form-DmP3YUfp.js.map} +1 -1
  17. package/dist/agent-catalog.json +5 -5
  18. package/dist/agent-i18n/en.json +2 -2
  19. package/dist/components/booking/booking-types.d.ts +35 -2
  20. package/dist/components/booking/booking-types.d.ts.map +1 -1
  21. package/dist/components/booking/booking.d.ts.map +1 -1
  22. package/dist/components/booking/code-step.d.ts +4 -2
  23. package/dist/components/booking/code-step.d.ts.map +1 -1
  24. package/dist/components/booking/details-form.d.ts +2 -0
  25. package/dist/components/booking/details-form.d.ts.map +1 -1
  26. package/dist/components/booking/handover.d.ts +12 -0
  27. package/dist/components/booking/handover.d.ts.map +1 -0
  28. package/dist/components/booking/index.js +1 -1
  29. package/dist/components/booking/reserved.d.ts +24 -0
  30. package/dist/components/booking/reserved.d.ts.map +1 -0
  31. package/dist/components/booking/use-booking-payment.d.ts +3 -1
  32. package/dist/components/booking/use-booking-payment.d.ts.map +1 -1
  33. package/dist/components/data-table/index.js +1 -1
  34. package/dist/components/multi-select/index.js +1 -1
  35. package/dist/components/multi-select/multi-select.d.ts.map +1 -1
  36. package/dist/components/otp-input/index.js +1 -1
  37. package/dist/components/otp-input/otp-input.d.ts +1 -1
  38. package/dist/components/otp-input/otp-input.d.ts.map +1 -1
  39. package/dist/components/patient-table/index.js +1 -1
  40. package/dist/i18n/locales/ar.d.ts +8 -0
  41. package/dist/i18n/locales/ar.d.ts.map +1 -1
  42. package/dist/i18n/locales/ar.js +8 -0
  43. package/dist/i18n/locales/ar.js.map +1 -1
  44. package/dist/i18n/locales/de.d.ts +8 -0
  45. package/dist/i18n/locales/de.d.ts.map +1 -1
  46. package/dist/i18n/locales/de.js +8 -0
  47. package/dist/i18n/locales/de.js.map +1 -1
  48. package/dist/i18n/locales/el.d.ts +8 -0
  49. package/dist/i18n/locales/el.d.ts.map +1 -1
  50. package/dist/i18n/locales/el.js +8 -0
  51. package/dist/i18n/locales/el.js.map +1 -1
  52. package/dist/i18n/locales/en.d.ts +8 -0
  53. package/dist/i18n/locales/en.d.ts.map +1 -1
  54. package/dist/i18n/locales/en.js +8 -0
  55. package/dist/i18n/locales/en.js.map +1 -1
  56. package/dist/i18n/locales/es.d.ts +8 -0
  57. package/dist/i18n/locales/es.d.ts.map +1 -1
  58. package/dist/i18n/locales/es.js +8 -0
  59. package/dist/i18n/locales/es.js.map +1 -1
  60. package/dist/i18n/locales/fr.d.ts +8 -0
  61. package/dist/i18n/locales/fr.d.ts.map +1 -1
  62. package/dist/i18n/locales/fr.js +8 -0
  63. package/dist/i18n/locales/fr.js.map +1 -1
  64. package/dist/i18n/locales/hi.d.ts +8 -0
  65. package/dist/i18n/locales/hi.d.ts.map +1 -1
  66. package/dist/i18n/locales/hi.js +8 -0
  67. package/dist/i18n/locales/hi.js.map +1 -1
  68. package/dist/i18n/locales/it.d.ts +8 -0
  69. package/dist/i18n/locales/it.d.ts.map +1 -1
  70. package/dist/i18n/locales/it.js +8 -0
  71. package/dist/i18n/locales/it.js.map +1 -1
  72. package/dist/i18n/locales/ja.d.ts +8 -0
  73. package/dist/i18n/locales/ja.d.ts.map +1 -1
  74. package/dist/i18n/locales/ja.js +8 -0
  75. package/dist/i18n/locales/ja.js.map +1 -1
  76. package/dist/i18n/locales/nl.d.ts +8 -0
  77. package/dist/i18n/locales/nl.d.ts.map +1 -1
  78. package/dist/i18n/locales/nl.js +8 -0
  79. package/dist/i18n/locales/nl.js.map +1 -1
  80. package/dist/i18n/locales/pl.d.ts +8 -0
  81. package/dist/i18n/locales/pl.d.ts.map +1 -1
  82. package/dist/i18n/locales/pl.js +8 -0
  83. package/dist/i18n/locales/pl.js.map +1 -1
  84. package/dist/i18n/locales/pt.d.ts +8 -0
  85. package/dist/i18n/locales/pt.d.ts.map +1 -1
  86. package/dist/i18n/locales/pt.js +8 -0
  87. package/dist/i18n/locales/pt.js.map +1 -1
  88. package/dist/i18n/locales/ro.d.ts +8 -0
  89. package/dist/i18n/locales/ro.d.ts.map +1 -1
  90. package/dist/i18n/locales/ro.js +8 -0
  91. package/dist/i18n/locales/ro.js.map +1 -1
  92. package/dist/i18n/locales/ru.d.ts +8 -0
  93. package/dist/i18n/locales/ru.d.ts.map +1 -1
  94. package/dist/i18n/locales/ru.js +8 -0
  95. package/dist/i18n/locales/ru.js.map +1 -1
  96. package/dist/i18n/locales/sq.d.ts +8 -0
  97. package/dist/i18n/locales/sq.d.ts.map +1 -1
  98. package/dist/i18n/locales/sq.js +8 -0
  99. package/dist/i18n/locales/sq.js.map +1 -1
  100. package/dist/i18n/locales/sv.d.ts +8 -0
  101. package/dist/i18n/locales/sv.d.ts.map +1 -1
  102. package/dist/i18n/locales/sv.js +8 -0
  103. package/dist/i18n/locales/sv.js.map +1 -1
  104. package/dist/i18n/locales/tr.d.ts +8 -0
  105. package/dist/i18n/locales/tr.d.ts.map +1 -1
  106. package/dist/i18n/locales/tr.js +8 -0
  107. package/dist/i18n/locales/tr.js.map +1 -1
  108. package/dist/i18n/locales/zh.d.ts +8 -0
  109. package/dist/i18n/locales/zh.d.ts.map +1 -1
  110. package/dist/i18n/locales/zh.js +8 -0
  111. package/dist/i18n/locales/zh.js.map +1 -1
  112. package/dist/index.js +8 -8
  113. package/dist/locales/ar.json +8 -0
  114. package/dist/locales/de.json +8 -0
  115. package/dist/locales/el.json +8 -0
  116. package/dist/locales/en.json +8 -0
  117. package/dist/locales/es.json +8 -0
  118. package/dist/locales/fr.json +8 -0
  119. package/dist/locales/hi.json +8 -0
  120. package/dist/locales/it.json +8 -0
  121. package/dist/locales/ja.json +8 -0
  122. package/dist/locales/nl.json +8 -0
  123. package/dist/locales/pl.json +8 -0
  124. package/dist/locales/pt.json +8 -0
  125. package/dist/locales/ro.json +8 -0
  126. package/dist/locales/ru.json +8 -0
  127. package/dist/locales/sq.json +8 -0
  128. package/dist/locales/sv.json +8 -0
  129. package/dist/locales/tr.json +8 -0
  130. package/dist/locales/zh.json +8 -0
  131. package/dist/patterns/anamnesis/index.js +1 -1
  132. package/dist/patterns/login-form/index.js +1 -1
  133. package/dist/patterns/login-form/login-form.d.ts +7 -0
  134. package/dist/patterns/login-form/login-form.d.ts.map +1 -1
  135. package/dist/patterns/registration-form/index.js +1 -1
  136. package/dist/tokens.css +1 -1
  137. package/package.json +1 -1
  138. package/dist/_chunks/booking-CxrB0e6d.js +0 -4079
  139. package/dist/_chunks/booking-CxrB0e6d.js.map +0 -1
  140. package/dist/_chunks/login-dev-card-CvLHj-_N.js +0 -353
  141. package/dist/_chunks/login-dev-card-CvLHj-_N.js.map +0 -1
  142. package/dist/_chunks/multi-select-IOVnOGlP.js.map +0 -1
  143. package/dist/_chunks/otp-input-BgEZi0py.js.map +0 -1
@@ -0,0 +1,4304 @@
1
+ import { jsx as n, jsxs as k, Fragment as oe } from "react/jsx-runtime";
2
+ import { forwardRef as wn, useId as at, useRef as M, useCallback as ye, useState as H, useEffect as z, useMemo as q, Fragment as es, useLayoutEffect as ts, useImperativeHandle as ns } from "react";
3
+ import { c as Tt } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as Q, Trans as Cn } from "react-i18next";
5
+ import { u as ss } from "./registry-DvAUVLHh.js";
6
+ import { A as ae } from "./alert-9kEwDza3.js";
7
+ import { B as Ne } from "./button-DohK_Ak_.js";
8
+ import { C as ht } from "./checkbox-BjDv-r3o.js";
9
+ import { C as rs } from "./checkbox-group-Cw2H5qaq.js";
10
+ import { R as is } from "./radio-BZQs6_36.js";
11
+ import { R as os } from "./radio-group-ChIKyeSJ.js";
12
+ import { D as as } from "./date-picker-CdhXlgVI.js";
13
+ import { E as cs } from "./email-input-C7THAwh2.js";
14
+ import { F as qe } from "./form-field-CyHfOVKF.js";
15
+ import { P as ds } from "./phone-input-DJ4BN8tG.js";
16
+ import { T as ls } from "./text-area-COMVJ1yE.js";
17
+ import { T as $t } from "./text-input-CaG9ApoE.js";
18
+ import { A as us } from "./address-fields-CfnXK8RT.js";
19
+ import { S as Tn } from "./spinner-CoflYlEx.js";
20
+ import { a as Wt } from "./format-price-BcFBa-WP.js";
21
+ import { C as ms } from "./credit-card-D9XZsHGA.js";
22
+ import { O as ps } from "./otp-input-gV1446Dw.js";
23
+ import { i as fs } from "./safe-href-5dbsfbQn.js";
24
+ import { B as An } from "./badge-BUk4RjTS.js";
25
+ import { I as gn } from "./icon-button-S8_weU3g.js";
26
+ import { S as Yt } from "./select-4S-eYZUf.js";
27
+ import { C as cn } from "./combobox-CDPm_n0p.js";
28
+ import { M as dn } from "./multi-select-i5MFRpXg.js";
29
+ import { c as gs } from "./option-row-Dc7BrbK8.js";
30
+ import { S as Gt } from "./skeleton-tTWJpvAq.js";
31
+ import { E as Dn } from "./empty-state-DwJ5YNzz.js";
32
+ import { S as hs } from "./stepper-accordion-DDTSOUHc.js";
33
+ import { S as vs } from "./stepper-progress-D6H8wQiV.js";
34
+ import { S as bs } from "./slot-grid-Bb13H9Rl.js";
35
+ import { p as he } from "./parseISO-DZZ5a-zK.js";
36
+ import { C as ys } from "./chevron-down-DWE7GSq9.js";
37
+ import { s as vt, f as Ht, d as hn } from "./format--x5jypvH.js";
38
+ import { x as On, a as bt, b as nn, i as ks, s as Ct, m as Ss, y as qt } from "./date-picker-variants-Dt6UbonG.js";
39
+ import { s as xs } from "./subDays-DKISP2nE.js";
40
+ import { C as Is } from "./chevron-left-B8cOyH-V.js";
41
+ import { C as Ns } from "./chevron-right-I9AeSxH2.js";
42
+ import { c as we } from "./createLucideIcon-DhHxpK9K.js";
43
+ import { M as ws, S as Cs } from "./sun-Bj9Mr553.js";
44
+ import { S as Ts } from "./stethoscope-sZXGC43m.js";
45
+ import { H as As } from "./heart-pulse-BCppJyN2.js";
46
+ import { E as Ds } from "./eye-BjhN2nYf.js";
47
+ import { B as Os } from "./baby-Dku-Xvg9.js";
48
+ import { S as Ms } from "./scan-line-CNseIHQ0.js";
49
+ import { A as Es } from "./astroid-BN4f5VXU.js";
50
+ import { C as Fs } from "./clipboard-check-BeAGxDVT.js";
51
+ /**
52
+ * @license lucide-react v1.22.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */
57
+ const _s = [
58
+ [
59
+ "path",
60
+ {
61
+ 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",
62
+ key: "169zse"
63
+ }
64
+ ]
65
+ ], Rs = we("activity", _s);
66
+ /**
67
+ * @license lucide-react v1.22.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */
72
+ const Ls = [
73
+ [
74
+ "path",
75
+ {
76
+ 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",
77
+ key: "w610uw"
78
+ }
79
+ ]
80
+ ], Bs = we("bone", Ls);
81
+ /**
82
+ * @license lucide-react v1.22.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */
87
+ const Ps = [
88
+ ["path", { d: "M12 18V5", key: "adv99a" }],
89
+ ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
90
+ ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
91
+ ["path", { d: "M17.997 5.125a4 4 0 0 1 2.526 5.77", key: "iwvgf7" }],
92
+ ["path", { d: "M18 18a4 4 0 0 0 2-7.464", key: "efp6ie" }],
93
+ ["path", { d: "M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517", key: "1gq6am" }],
94
+ ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
95
+ ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
96
+ ], Vs = we("brain", Ps);
97
+ /**
98
+ * @license lucide-react v1.22.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */
103
+ const $s = [
104
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
105
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
106
+ ["path", { d: "M3 10h18", key: "8toen8" }],
107
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
108
+ ["path", { d: "M17 14h-6", key: "bkmgh3" }],
109
+ ["path", { d: "M13 18H7", key: "bb0bb7" }],
110
+ ["path", { d: "M7 14h.01", key: "1qa3f1" }],
111
+ ["path", { d: "M17 18h.01", key: "1bdyru" }]
112
+ ], qs = we("calendar-range", $s);
113
+ /**
114
+ * @license lucide-react v1.22.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */
119
+ const zs = [
120
+ ["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" }],
121
+ ["path", { d: "M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4", key: "1qnva7" }]
122
+ ], Ks = we("ear", zs);
123
+ /**
124
+ * @license lucide-react v1.22.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */
129
+ const js = [
130
+ ["path", { d: "M6 18h8", key: "1borvv" }],
131
+ ["path", { d: "M3 22h18", key: "8prr45" }],
132
+ ["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
133
+ ["path", { d: "M9 14h2", key: "197e7h" }],
134
+ ["path", { d: "M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z", key: "1bmzmy" }],
135
+ ["path", { d: "M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3", key: "1drr47" }]
136
+ ], Us = we("microscope", js);
137
+ /**
138
+ * @license lucide-react v1.22.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */
143
+ const Hs = [
144
+ [
145
+ "path",
146
+ { 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" }
147
+ ],
148
+ ["path", { d: "m8.5 8.5 7 7", key: "rvfmvr" }]
149
+ ], Gs = we("pill", Hs);
150
+ /**
151
+ * @license lucide-react v1.22.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */
156
+ const Js = [
157
+ ["circle", { cx: "6", cy: "6", r: "3", key: "1lh9wr" }],
158
+ ["path", { d: "M8.12 8.12 12 12", key: "1alkpv" }],
159
+ ["path", { d: "M20 4 8.12 15.88", key: "xgtan2" }],
160
+ ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
161
+ ["path", { d: "M14.8 14.8 20 20", key: "ptml3r" }]
162
+ ], Ws = we("scissors", Js);
163
+ /**
164
+ * @license lucide-react v1.22.0 - ISC
165
+ *
166
+ * This source code is licensed under the ISC license.
167
+ * See the LICENSE file in the root directory of this source tree.
168
+ */
169
+ const Ys = [
170
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
171
+ ["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
172
+ ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
173
+ ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
174
+ ], Zs = we("smile", Ys);
175
+ /**
176
+ * @license lucide-react v1.22.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */
181
+ const Xs = [
182
+ ["path", { d: "M12 10V2", key: "16sf7g" }],
183
+ ["path", { d: "m4.93 10.93 1.41 1.41", key: "2a7f42" }],
184
+ ["path", { d: "M2 18h2", key: "j10viu" }],
185
+ ["path", { d: "M20 18h2", key: "wocana" }],
186
+ ["path", { d: "m19.07 10.93-1.41 1.41", key: "15zs5n" }],
187
+ ["path", { d: "M22 22H2", key: "19qnx5" }],
188
+ ["path", { d: "m16 6-4 4-4-4", key: "6wukr" }],
189
+ ["path", { d: "M16 18a4 4 0 0 0-8 0", key: "1lzouq" }]
190
+ ], Qs = we("sunset", Xs);
191
+ /**
192
+ * @license lucide-react v1.22.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */
197
+ const er = [
198
+ ["path", { d: "m18 2 4 4", key: "22kx64" }],
199
+ ["path", { d: "m17 7 3-3", key: "1w1zoj" }],
200
+ ["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" }],
201
+ ["path", { d: "m9 11 4 4", key: "rovt3i" }],
202
+ ["path", { d: "m5 19-3 3", key: "59f2uf" }],
203
+ ["path", { d: "m14 4 6 6", key: "yqp9t2" }]
204
+ ], vn = we("syringe", er);
205
+ function tr(e, t, s) {
206
+ return On(e, -1, s);
207
+ }
208
+ const nr = {
209
+ id: "booking",
210
+ // `view_change` removed (0.69): the layout `variant` is a fixed prop — the
211
+ // handle exposes only `getVariant` (state), no action mutates it. The flow's
212
+ // only navigation is step-to-step (`goto_step` → `navigate`).
213
+ capabilities: ["navigate"],
214
+ state: {
215
+ variant: {
216
+ type: "string",
217
+ descriptionKey: "ui.agent.booking.state.variant",
218
+ description: "Active variant — one of `inline-list`, `accordion`, `calendar`, `flexible`, `progress`.",
219
+ read: (e) => e.getVariant()
220
+ },
221
+ currentStep: {
222
+ type: "number",
223
+ descriptionKey: "ui.agent.booking.state.currentStep",
224
+ description: 'The step the flow is on: 1 insurance, 2 specialty, 3 service, 4 provider, 5 date, 6 time, 7 patient details, payment or optional SMS code verification, 8 confirmation after all required steps succeed, including the "Time reserved" view that opens a host address after a short delay. Read this back after `goto_step` to see where the clamp landed.',
225
+ read: (e) => e.getCurrentStep()
226
+ }
227
+ },
228
+ actions: {
229
+ reset: {
230
+ // destructive: clears the whole in-progress booking value (patient
231
+ // identity, contact, slot choice) — irreversibly loses user input.
232
+ safety: "destructive",
233
+ idempotent: !0,
234
+ descriptionKey: "ui.agent.booking.actions.reset",
235
+ description: "Clear the booking value back to an empty state. Use to abandon an in-progress flow.",
236
+ errors: [
237
+ "Refused while a payment session is open (step 7): the consumer must cancel the hold first.",
238
+ "Refused while SMS code verification is pending (step 7): the locked form and code box stay, and the submitted booking remains active. The host owns cancellation."
239
+ ],
240
+ invoke: (e) => {
241
+ e.reset();
242
+ }
243
+ },
244
+ goto_step: {
245
+ safety: "read",
246
+ argsType: "{ step: 1 | 2 | 3 | 4 | 5 | 6 | 7 }",
247
+ argsSchema: {
248
+ type: "object",
249
+ properties: {
250
+ step: {
251
+ type: "integer",
252
+ enum: [1, 2, 3, 4, 5, 6, 7],
253
+ description: "Target step (1-7)."
254
+ }
255
+ },
256
+ required: ["step"]
257
+ },
258
+ idempotent: !0,
259
+ descriptionKey: "ui.agent.booking.actions.gotoStep",
260
+ 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.",
261
+ errors: [
262
+ "Navigation stays on step 7 while payment or SMS code verification is pending.",
263
+ "Requested step is not yet reachable — clamped to the first incomplete step.",
264
+ "Requested step is hidden for this practice (e.g. insurance outside Germany, or provider choice turned off) — clamped to the first incomplete step."
265
+ ],
266
+ examples: [{ args: { step: 1 }, note: "Return to the first step." }],
267
+ invoke: (e, t) => {
268
+ e.goToStep(t.step);
269
+ }
270
+ }
271
+ },
272
+ domHooks: {
273
+ root: {
274
+ attr: "data-component",
275
+ value: "booking",
276
+ description: 'Marks the Booking root region. The host prop hideEmail (boolean, default false) hides the email field, skips its validation and omits email from submission. The host prop emailOptional (boolean, default false) keeps email visible and optional unless used for confirmation. Email is marked and validated as required when selected in the channel picker or singleConfirmationChannel radio, or when the effective confirmation channel is email. With a hidden picker, the form and success screen use the sole enabled channel, or email when multiple channels are enabled. This includes payment and blocked-payment flows, which omit stored selections from submission. Omitting confirmationChannels also defaults to email. Selecting SMS without email makes the field optional again. The optional/required marker updates visually when the channel changes, with no announcement of that change. Validation updates immediately using the existing email error. With emailOptional, surrounding spaces are trimmed before validation, even when email is required for confirmation. Optional blank values are omitted from submission; filled values are sent trimmed. hideEmail takes precedence over emailOptional. Neither prop changes confirmation channels; pair with confirmationChannels ["sms"] for SMS-only confirmation with no channel picker. The optional codeStep prop adds SMS verification after submission and before any payment: the submitted form stays in place but locked (controls disabled, text still readable, not hidden), the code box opens below it, and a Change button, for the patient only (no agent action unlocks it), unlocks the form for a new booking request (the host keeps the earlier request until it expires; the kit cannot cancel it). With payment, a correct code opens the payment stage, and the step remains 7 until payment succeeds; without payment it remains 7 until verification succeeds. It then becomes 8. Patient contact details and verification codes are never exposed through this adapter.'
277
+ },
278
+ instanceId: {
279
+ attr: "data-component-id",
280
+ sourceProp: "id",
281
+ description: "Sourced from the id prop."
282
+ }
283
+ }
284
+ }, on = [
285
+ "email",
286
+ "whatsapp",
287
+ "sms"
288
+ ], Ee = "all", sr = "de";
289
+ function rr(e) {
290
+ const t = e.lockedOperatorId;
291
+ return [...t ? e.operatorsByService ? e.specialties.filter(
292
+ (i) => e.services.some(
293
+ (r) => {
294
+ var a;
295
+ return r.specialtyId === i.id && ((a = r.operatorIds) == null ? void 0 : a.includes(t));
296
+ }
297
+ )
298
+ ) : e.specialties.filter((i) => {
299
+ var r;
300
+ return (r = i.operatorIds) == null ? void 0 : r.includes(t);
301
+ }) : e.specialties].sort((i, r) => {
302
+ const a = i.sequenceNumber ?? Number.POSITIVE_INFINITY, c = r.sequenceNumber ?? Number.POSITIVE_INFINITY;
303
+ return a - c;
304
+ });
305
+ }
306
+ function ir(e) {
307
+ let t = e.services;
308
+ if (e.lockedOperatorId && (t = t.filter(
309
+ (i) => {
310
+ var r;
311
+ return (r = i.operatorIds) == null ? void 0 : r.includes(e.lockedOperatorId);
312
+ }
313
+ )), e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) {
314
+ const i = Qe(e.value);
315
+ i.length > 0 && (t = t.filter(
316
+ (r) => r.specialtyId !== void 0 && i.includes(r.specialtyId)
317
+ ));
318
+ }
319
+ return t;
320
+ }
321
+ function or(e) {
322
+ const t = e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties, s = Ke(e.value);
323
+ if ((!t || e.operatorsByService) && s.length > 0)
324
+ return e.operators.filter(
325
+ (i) => {
326
+ var r;
327
+ return (r = i.appointmentBookingReasonIds) == null ? void 0 : r.some((a) => s.includes(a));
328
+ }
329
+ );
330
+ if (t) {
331
+ const i = Qe(e.value);
332
+ if (i.length > 0)
333
+ return e.operators.filter(
334
+ (r) => {
335
+ var a;
336
+ return (a = r.specialtyIds) == null ? void 0 : a.some((c) => i.includes(c));
337
+ }
338
+ );
339
+ }
340
+ return [];
341
+ }
342
+ function ar(e, t) {
343
+ const s = e.country === sr, i = !s || e.value.insuranceType !== void 0, a = (e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) && i, c = Qe(e.value).length > 0, m = !a || c, p = Ke(e.value).length > 0, f = !m || p, v = t.operators, h = !!e.allowOperatorSelection && f && p && !e.lockedOperatorId && v.length > 1, d = f && p, I = (!d || e.value.date !== void 0) && e.value.date !== void 0, F = (!I || e.value.slotKey !== void 0) && e.value.slotKey !== void 0, N = p && v.length === 0;
344
+ return {
345
+ insurance: s,
346
+ specialty: a,
347
+ service: m,
348
+ operator: h,
349
+ date: d,
350
+ slot: I,
351
+ details: F,
352
+ onboardingIncomplete: N
353
+ };
354
+ }
355
+ function cr(e, t) {
356
+ const s = [];
357
+ return 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), {
358
+ currentStep: s.find(
359
+ (r) => !ze(r, e.value)
360
+ ) ?? 7,
361
+ visibleSteps: s
362
+ };
363
+ }
364
+ function ze(e, t) {
365
+ switch (e) {
366
+ case 1:
367
+ return t.insuranceType !== void 0;
368
+ // 0.34.0: array-or-single — satisfied when EITHER form is present.
369
+ case 2:
370
+ return Qe(t).length > 0;
371
+ case 3:
372
+ return Ke(t).length > 0;
373
+ // Always satisfied, like its gate: "no preference" is a valid answer,
374
+ // whether it is the `'all'` sentinel or an empty multi-select.
375
+ case 4:
376
+ return !0;
377
+ case 5:
378
+ return t.date !== void 0;
379
+ case 6:
380
+ return t.slotKey !== void 0;
381
+ // Details fulfilment is owned by the form's own validation.
382
+ case 7:
383
+ return !1;
384
+ }
385
+ }
386
+ function dr(e) {
387
+ const t = {
388
+ specialties: rr(e),
389
+ services: ir(e),
390
+ operators: or(e)
391
+ }, s = ar(e, t), { currentStep: i, visibleSteps: r } = cr(e, s);
392
+ let a;
393
+ if (e.value.date && e.value.slotKey) {
394
+ const f = e.availableSlots[e.value.date];
395
+ f && (a = f.find((v) => v.key === e.value.slotKey));
396
+ }
397
+ const c = Ke(e.value), l = c.length > 0 ? e.services.find((f) => f.id === c[0]) : void 0, m = Qe(e.value).length > 0, p = c.length > 0 && e.value.date !== void 0 && e.value.slotKey !== void 0 && (!s.insurance || e.value.insuranceType !== void 0) && (!s.specialty || m);
398
+ return {
399
+ gates: s,
400
+ filtered: t,
401
+ currentStep: i,
402
+ totalSteps: r.length,
403
+ visibleSteps: r,
404
+ isReadyToSubmit: p,
405
+ durationMin: l == null ? void 0 : l.durationMin,
406
+ selectedSlot: a
407
+ };
408
+ }
409
+ function Mn(e, t) {
410
+ return {
411
+ ...e,
412
+ insuranceType: t,
413
+ specialtyId: void 0,
414
+ serviceId: void 0,
415
+ operatorId: void 0,
416
+ date: void 0,
417
+ slotKey: void 0,
418
+ details: void 0
419
+ };
420
+ }
421
+ function En(e, t) {
422
+ return {
423
+ ...e,
424
+ specialtyId: t,
425
+ specialtyIds: void 0,
426
+ serviceId: void 0,
427
+ serviceIds: void 0,
428
+ operatorId: void 0,
429
+ operatorIds: void 0,
430
+ date: void 0,
431
+ slotKey: void 0,
432
+ details: void 0
433
+ };
434
+ }
435
+ function Fn(e, t) {
436
+ return {
437
+ ...e,
438
+ specialtyId: void 0,
439
+ specialtyIds: t,
440
+ serviceId: void 0,
441
+ serviceIds: void 0,
442
+ operatorId: void 0,
443
+ operatorIds: void 0,
444
+ date: void 0,
445
+ slotKey: void 0,
446
+ details: void 0
447
+ };
448
+ }
449
+ function _n(e, t) {
450
+ return {
451
+ ...e,
452
+ serviceId: t,
453
+ serviceIds: void 0,
454
+ // Default the operator to the "All operators" sentinel so a patient
455
+ // who doesn't care about picking lands on a satisfied step 4 without
456
+ // any further input.
457
+ operatorId: t ? Ee : void 0,
458
+ operatorIds: void 0,
459
+ date: void 0,
460
+ slotKey: void 0,
461
+ details: void 0
462
+ };
463
+ }
464
+ function Rn(e, t) {
465
+ const s = !!t && t.length > 0;
466
+ return {
467
+ ...e,
468
+ serviceId: void 0,
469
+ serviceIds: t,
470
+ operatorId: s ? Ee : void 0,
471
+ operatorIds: void 0,
472
+ date: void 0,
473
+ slotKey: void 0,
474
+ details: void 0
475
+ };
476
+ }
477
+ function Ln(e, t) {
478
+ return {
479
+ ...e,
480
+ operatorId: t,
481
+ operatorIds: void 0,
482
+ date: void 0,
483
+ slotKey: void 0,
484
+ details: void 0
485
+ };
486
+ }
487
+ function Bn(e, t) {
488
+ return {
489
+ ...e,
490
+ operatorId: void 0,
491
+ operatorIds: t,
492
+ date: void 0,
493
+ slotKey: void 0,
494
+ details: void 0
495
+ };
496
+ }
497
+ function Qe(e) {
498
+ return e.specialtyIds && e.specialtyIds.length > 0 ? e.specialtyIds : e.specialtyId ? [e.specialtyId] : [];
499
+ }
500
+ function Ke(e) {
501
+ return e.serviceIds && e.serviceIds.length > 0 ? e.serviceIds : e.serviceId ? [e.serviceId] : [];
502
+ }
503
+ function an(e) {
504
+ return e.operatorIds && e.operatorIds.length > 0 ? e.operatorIds : e.operatorId ? [e.operatorId] : [];
505
+ }
506
+ function Zt(e, t) {
507
+ return {
508
+ ...e,
509
+ date: t,
510
+ slotKey: void 0
511
+ // Keep details — date/slot changes shouldn't wipe the patient form
512
+ // since the user has already filled some fields.
513
+ };
514
+ }
515
+ function Pn(e, t) {
516
+ return {
517
+ ...e,
518
+ slotKey: t
519
+ };
520
+ }
521
+ function lr(e, t) {
522
+ let s = e;
523
+ 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) {
524
+ const r = Qe(s), a = r.length > 0 ? t.services.filter(
525
+ (c) => c.specialtyId && r.includes(c.specialtyId)
526
+ ) : t.services;
527
+ a.length === 1 && s.serviceId === void 0 && s.serviceIds === void 0 && (s = { ...s, serviceId: a[0].id }, s.operatorId === void 0 && s.operatorIds === void 0 && (s = { ...s, operatorId: Ee }));
528
+ }
529
+ return s;
530
+ }
531
+ function Vn(e) {
532
+ if (e.operatorId && e.operatorId !== Ee)
533
+ return e.operatorId;
534
+ }
535
+ function ur(e) {
536
+ if (!e) return !1;
537
+ const t = e.trim();
538
+ return /^\+?\d[\d\s\-()]{6,}$/.test(t);
539
+ }
540
+ function ln(e) {
541
+ const t = e && e.length > 0 ? e : ["email"], s = new Set(t);
542
+ return on.filter((i) => s.has(i));
543
+ }
544
+ function $n(e, t) {
545
+ return t ?? (e.length === 1 ? e : ["email"]);
546
+ }
547
+ function mr(e, t, s) {
548
+ const i = ln(e), r = new Set(i);
549
+ if (s)
550
+ return on.filter(
551
+ (p) => s.includes(p) && r.has(p)
552
+ );
553
+ const a = [];
554
+ r.has("email") && a.push("email");
555
+ const c = ur(t), l = r.has("whatsapp");
556
+ l && c && a.push("whatsapp"), !l && r.has("sms") && a.push("sms");
557
+ const m = new Set(a);
558
+ return on.filter((p) => m.has(p));
559
+ }
560
+ const pr = /https?:\/\/(?:(?![.,;:!?'»›]https?:\/\/)[^\s<>"\u060C\u061B\u061F\u06D4\u2000-\u206F\u3000-\u303F\uFF00-\uFFEF])+/gi, fr = /* @__PURE__ */ new Set([
561
+ ".",
562
+ ",",
563
+ ";",
564
+ ":",
565
+ "!",
566
+ "?",
567
+ "'",
568
+ "»",
569
+ "›"
570
+ ]), gr = { ")": "(", "]": "[", "}": "{" }, bn = (e, t) => e.split(t).length - 1;
571
+ function hr(e) {
572
+ const t = {};
573
+ for (const [i, r] of Object.entries(gr))
574
+ t[i] = bn(e, i) - bn(e, r);
575
+ let s = e.length;
576
+ for (; s > 0; ) {
577
+ const i = e[s - 1];
578
+ if (fr.has(i))
579
+ s -= 1;
580
+ else if (i in t && t[i] > 0)
581
+ t[i] -= 1, s -= 1;
582
+ else
583
+ break;
584
+ }
585
+ return e.slice(0, s);
586
+ }
587
+ const vr = /[\u0600-\u06FF\u3040-\u30FF\u3400-\u9FFF\uAC00-\uD7AF]/, br = /[A-Za-z0-9]/;
588
+ function yr(e) {
589
+ const t = e.search(vr);
590
+ return t > 0 && br.test(e[t - 1]) ? e.slice(0, t) : e;
591
+ }
592
+ function kr(e) {
593
+ try {
594
+ const { protocol: t, hostname: s } = new URL(e);
595
+ return (t === "http:" || t === "https:") && s !== "";
596
+ } catch {
597
+ return !1;
598
+ }
599
+ }
600
+ function Sr(e) {
601
+ const t = [];
602
+ let s = 0;
603
+ const i = (r) => {
604
+ if (r === "") return;
605
+ const a = t[t.length - 1];
606
+ (a == null ? void 0 : a.kind) === "text" ? a.text += r : t.push({ kind: "text", text: r });
607
+ };
608
+ for (const r of e.matchAll(pr)) {
609
+ const a = r.index ?? 0, c = hr(yr(r[0]));
610
+ kr(c) && (i(e.slice(s, a)), t.push({ kind: "link", text: c, href: c }), s = a + c.length);
611
+ }
612
+ return i(e.slice(s)), t;
613
+ }
614
+ const yn = 500, xr = /^[A-Z0-9]{16}$/, Ir = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, kn = 300, sn = "ds:rounded-[var(--radius-sm)] ds:underline ds:text-[var(--foreground)] ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]", zt = (e) => e && /^https?:\/\//i.test(e) ? e : void 0, Nr = (e, t) => ({
615
+ street: (e == null ? void 0 : e.address.line1) ?? "",
616
+ city: (e == null ? void 0 : e.address.city) ?? "",
617
+ postcode: (e == null ? void 0 : e.address.postalCode) ?? "",
618
+ province: (e == null ? void 0 : e.address.state) ?? "",
619
+ // The practice's country only until the patient has an address at all.
620
+ country: (e ? e.address.country : t).toLowerCase(),
621
+ formatted: ""
622
+ }), wr = (e, t, s = null) => ({
623
+ name: t,
624
+ address: {
625
+ line1: e.street,
626
+ line2: s,
627
+ city: e.city,
628
+ state: e.province,
629
+ postalCode: e.postcode,
630
+ country: e.country.toUpperCase()
631
+ }
632
+ }), Cr = Tt("ds:flex ds:flex-col ds:border", {
633
+ variants: {
634
+ noticeStyle: {
635
+ plain: "ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-md)] ds:border-[var(--border)] ds:bg-[var(--muted)] ds:p-[var(--spacing-sm)]",
636
+ highlighted: "ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-lg)] ds:border-[color-mix(in_srgb,var(--primary)_30%,var(--border))] ds:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] ds:p-[var(--spacing-md)]"
637
+ }
638
+ },
639
+ defaultVariants: { noticeStyle: "highlighted" }
640
+ }), Tr = ["it", "ch", "de", "at", "fr", "sm"], J = {
641
+ country: "billing.country",
642
+ street: "billing.street",
643
+ city: "billing.city",
644
+ postcode: "billing.postcode",
645
+ province: "billing.province"
646
+ }, qn = /^\d{5}$/, Ar = (e) => {
647
+ if (!e) return !1;
648
+ const { line1: t, city: s, postalCode: i, country: r, state: a } = e.address;
649
+ return !t.trim() || !s.trim() || !i.trim() || !r.trim() ? !1 : r.toUpperCase() !== "IT" ? !0 : !!a.trim() && qn.test(i.trim());
650
+ }, Dr = (e, t) => {
651
+ var s;
652
+ return {
653
+ name: t,
654
+ address: {
655
+ line1: e.address.line1.trim(),
656
+ line2: ((s = e.address.line2) == null ? void 0 : s.trim()) || null,
657
+ city: e.address.city.trim(),
658
+ state: e.address.state.trim(),
659
+ postalCode: e.address.postalCode.trim(),
660
+ country: e.address.country.trim().toUpperCase()
661
+ }
662
+ };
663
+ }, Kt = { state: "idle" }, Sn = [
664
+ "firstName",
665
+ "lastName",
666
+ "email",
667
+ "mobilePhone",
668
+ "codiceFiscale",
669
+ "dateOfBirth",
670
+ "insuranceNumber",
671
+ J.country,
672
+ J.street,
673
+ J.city,
674
+ J.postcode,
675
+ J.province
676
+ ], Or = /* @__PURE__ */ new Set(), un = wn(
677
+ ({
678
+ value: e,
679
+ onChange: t,
680
+ onSubmit: s,
681
+ hideEmail: i = !1,
682
+ emailOptional: r = !1,
683
+ requireCodiceFiscale: a = !1,
684
+ requireDateOfBirth: c = !1,
685
+ requireInsuranceNumber: l = !1,
686
+ insuranceType: m,
687
+ showNote: p = !1,
688
+ showReturningPatientFlag: f = !1,
689
+ privacyPolicyUrl: v,
690
+ termsUrl: h,
691
+ practiceConsent: d,
692
+ payment: g,
693
+ paymentTermsUrl: I,
694
+ paymentBlocked: u = !1,
695
+ billingInDetails: F = !1,
696
+ paymentNoticeStyle: N = "highlighted",
697
+ criticalInformationToAccept: w,
698
+ validateCodiceFiscale: x,
699
+ validateInsuranceNumber: A,
700
+ submitting: _ = !1,
701
+ locked: R = !1,
702
+ summarySlot: b,
703
+ defaultPhoneCountry: C,
704
+ confirmationChannels: V,
705
+ defaultConfirmationChannels: D,
706
+ singleConfirmationChannel: B = !1,
707
+ submitError: P
708
+ }, O) => {
709
+ var xt, It, Nt, wt, T;
710
+ const { t: y, i18n: X } = Q("ui"), ee = at(), Fe = M(null), _e = ye(
711
+ (o) => {
712
+ Fe.current = o, typeof O == "function" ? O(o) : O && (O.current = o);
713
+ },
714
+ [O]
715
+ ), [E, K] = H(0);
716
+ z(() => {
717
+ var S;
718
+ if (E === 0) return;
719
+ const o = (S = Fe.current) == null ? void 0 : S.querySelectorAll(
720
+ '[aria-invalid="true"], [role="checkbox"][aria-required="true"][aria-checked="false"], [data-unanswered] [role="checkbox"]'
721
+ );
722
+ for (const L of o ?? [])
723
+ if (L.focus(), document.activeElement === L) return;
724
+ }, [E]);
725
+ const G = M(!1), [te, Re] = H(!1), [et, ve] = H(!1), se = _ || te, [fe, ke] = H(Kt), [Se, Ce] = H(Kt), [de, Le] = H({}), ne = ye(
726
+ (o) => Le((S) => ({ ...S, [o]: !0 })),
727
+ []
728
+ ), [ue, At] = H(Or), Be = M(null), tt = M(
729
+ null
730
+ );
731
+ z(
732
+ () => () => {
733
+ Be.current && clearTimeout(Be.current), tt.current && clearTimeout(tt.current);
734
+ },
735
+ []
736
+ );
737
+ const j = ye(
738
+ (o) => {
739
+ ve(!1), t({ ...e, ...o });
740
+ },
741
+ [e, t]
742
+ ), Te = g ? JSON.stringify([
743
+ g.serviceId,
744
+ g.kind,
745
+ g.amountCents,
746
+ g.currencyCode,
747
+ I
748
+ ]) : void 0, [Qt, je] = H(
749
+ () => e.paymentAccepted ? Te : void 0
750
+ ), Dt = M(Te), ct = !!(g && e.paymentAccepted && Qt === Te);
751
+ z(() => {
752
+ Dt.current !== Te && (Dt.current = Te, je(void 0), e.paymentAccepted !== void 0 && j({ paymentAccepted: g ? !1 : void 0 }));
753
+ }, [Te, g, j, e.paymentAccepted]);
754
+ const Ue = typeof (d == null ? void 0 : d.label) == "string" && d.label.trim() !== "", Ae = d && Ue ? JSON.stringify([
755
+ d.label,
756
+ d.url ?? null,
757
+ d.required
758
+ ]) : void 0, [en, ce] = H(
759
+ () => e.practiceConsentAccepted ? Ae : void 0
760
+ ), Ot = M(Ae), me = !!(Ae !== void 0 && e.practiceConsentAccepted && en === Ae);
761
+ z(() => {
762
+ Ot.current !== Ae && (Ot.current = Ae, ce(void 0), e.practiceConsentAccepted !== void 0 && j({ practiceConsentAccepted: void 0 }));
763
+ }, [Ae, j, e.practiceConsentAccepted]);
764
+ const Pe = g ? Wt(g.amountCents, g.currencyCode, X.language) : "", De = zt(I), be = F && !!g && !u, $ = a, dt = (C || "it").toLowerCase(), nt = !be || Ar(e.billing), st = Nr(e.billing, dt), le = st.country === "it", Oe = M(null), He = M(
765
+ null
766
+ ), Ge = (xt = e.billing) == null ? void 0 : xt.address.line1.trim(), ge = ((Nt = (It = e.billing) == null ? void 0 : It.address.line2) == null ? void 0 : Nt.trim()) || null;
767
+ z(() => {
768
+ var o;
769
+ Ge !== void 0 && ge ? He.current = { street: Ge, line2: ge } : (Ge === void 0 || Ge === ((o = He.current) == null ? void 0 : o.street)) && (He.current = null);
770
+ }, [Ge, ge]);
771
+ const Ve = (o) => (
772
+ // Nothing for a block not shown, nor for a province outside Italy.
773
+ !be || !de[J[o]] || o === "province" && !le ? void 0 : st[o].trim() ? (
774
+ // The one format the block itself checks: an Italian CAP.
775
+ o === "postcode" && le && !qn.test(st.postcode.trim()) ? y("inputs.postalCode.invalid") : void 0
776
+ ) : y("booking.details.fieldRequired")
777
+ ), Mt = ye(
778
+ () => Le(
779
+ (o) => o[J.province] ? o : {
780
+ ...o,
781
+ codiceFiscale: !0,
782
+ ...Object.fromEntries(
783
+ Object.values(J).map((S) => [S, !0])
784
+ )
785
+ }
786
+ ),
787
+ []
788
+ ), Me = q(
789
+ () => ln(V),
790
+ [V]
791
+ ), $e = !g && !u && Me.length >= 2, Je = M(!1);
792
+ z(() => {
793
+ if (g || u) return;
794
+ if (!$e) {
795
+ e.confirmationChannels !== void 0 && j({ confirmationChannels: void 0 });
796
+ return;
797
+ }
798
+ if (e.confirmationChannels !== void 0) {
799
+ Je.current = !0, B && e.confirmationChannels.length > 1 && j({
800
+ confirmationChannels: e.confirmationChannels.slice(0, 1)
801
+ });
802
+ return;
803
+ }
804
+ const o = B ? [
805
+ (D == null ? void 0 : D.find(
806
+ (S) => Me.includes(S)
807
+ )) ?? Me[0]
808
+ ] : mr(
809
+ Me,
810
+ e.mobilePhone,
811
+ D
812
+ );
813
+ Je.current = !0, j({ confirmationChannels: o });
814
+ }, [
815
+ $e,
816
+ g,
817
+ u,
818
+ Me,
819
+ e.mobilePhone,
820
+ D,
821
+ B
822
+ ]);
823
+ const xe = q(
824
+ () => e.confirmationChannels ?? [],
825
+ [e.confirmationChannels]
826
+ ), U = $e && xe.length === 0, W = $n(
827
+ Me,
828
+ $e ? xe : void 0
829
+ ), lt = !r || W.includes("email"), rt = M(x), ut = M(A);
830
+ z(() => {
831
+ rt.current = x, ut.current = A;
832
+ }, [x, A]);
833
+ const Et = !!x, Ft = !!A;
834
+ z(() => {
835
+ const o = e.codiceFiscale;
836
+ if (!$ || !Et || !o) {
837
+ ke(Kt);
838
+ return;
839
+ }
840
+ if (!xr.test(o)) {
841
+ ke({
842
+ state: "invalid",
843
+ hint: y("booking.details.codiceFiscale.invalidFormat")
844
+ });
845
+ return;
846
+ }
847
+ ke({ state: "pending" });
848
+ let S = !0;
849
+ return Be.current && clearTimeout(Be.current), Be.current = setTimeout(async () => {
850
+ try {
851
+ const L = rt.current;
852
+ if (!L) return;
853
+ const Z = await L(o);
854
+ S && ke({
855
+ state: Z.valid ? "valid" : "invalid",
856
+ hint: Z.hint,
857
+ value: o
858
+ });
859
+ } catch {
860
+ S && ke({
861
+ state: "invalid",
862
+ hint: y("booking.details.codiceFiscale.unavailable"),
863
+ value: o
864
+ });
865
+ }
866
+ }, kn), () => {
867
+ S = !1, Be.current && clearTimeout(Be.current);
868
+ };
869
+ }, [$, Et, e.codiceFiscale, y]);
870
+ const We = l && m === "public";
871
+ z(() => {
872
+ const o = e.insuranceNumber;
873
+ if (!We || !Ft || !o) {
874
+ Ce(Kt);
875
+ return;
876
+ }
877
+ Ce({ state: "pending" }), tt.current && clearTimeout(tt.current), tt.current = setTimeout(() => {
878
+ const S = ut.current;
879
+ S && S(o).then(
880
+ (L) => Ce(
881
+ L.valid ? { state: "valid" } : { state: "invalid", hint: L.hint }
882
+ )
883
+ ).catch(
884
+ () => Ce({
885
+ state: "invalid",
886
+ hint: y("booking.details.insuranceNumber.unavailable")
887
+ })
888
+ );
889
+ }, kn);
890
+ }, [We, Ft, e.insuranceNumber, y]);
891
+ const mt = q(() => {
892
+ var S;
893
+ if (i) return !0;
894
+ const o = r ? (S = e.email) == null ? void 0 : S.trim() : e.email;
895
+ return !lt && !o ? !0 : !!(o && Ir.test(o));
896
+ }, [i, r, lt, e.email]), pt = q(
897
+ () => !!(e.mobilePhone && e.mobilePhone.length >= 6),
898
+ [e.mobilePhone]
899
+ ), _t = q(() => {
900
+ var o, S;
901
+ return !(!((o = e.firstName) != null && o.trim()) || !((S = e.lastName) != null && S.trim()) || !mt || !pt || $ && (fe.state !== "valid" || fe.value !== e.codiceFiscale) || !nt || c && !e.dateOfBirth || We && Se.state !== "valid");
902
+ }, [
903
+ e.firstName,
904
+ e.lastName,
905
+ mt,
906
+ pt,
907
+ $,
908
+ nt,
909
+ fe.state,
910
+ fe.value,
911
+ e.codiceFiscale,
912
+ c,
913
+ e.dateOfBirth,
914
+ We,
915
+ Se.state
916
+ ]), ft = w != null && w.trim() ? w : void 0, Ye = ft !== void 0, Rt = !Ye || !!e.criticalInformationAccepted, Ze = !Ue || !(d != null && d.required) || me, Lt = !!(e.privacyConsent && e.termsConsent && Rt && Ze), tn = !$e || xe.length > 0, pe = _t && Lt && tn && (!g || ct) && !u && !se, Bt = !pe && !se && !u, gt = `${ee}-submit-hint`, re = {
917
+ firstName: de.firstName && !((wt = e.firstName) != null && wt.trim()) ? y("booking.details.firstName.required") : void 0,
918
+ lastName: de.lastName && !((T = e.lastName) != null && T.trim()) ? y("booking.details.lastName.required") : void 0,
919
+ email: !i && de.email && !mt ? y("booking.details.email.invalid") : void 0,
920
+ mobilePhone: de.mobilePhone && !pt ? y("booking.details.mobilePhone.invalid") : void 0,
921
+ codiceFiscale: de.codiceFiscale && fe.state === "invalid" ? fe.hint ?? y("booking.details.codiceFiscale.invalid") : de.codiceFiscale && !e.codiceFiscale ? y("booking.details.fieldRequired") : void 0,
922
+ dateOfBirth: de.dateOfBirth && !e.dateOfBirth ? y("booking.details.dateOfBirth.required") : void 0,
923
+ insuranceNumber: de.insuranceNumber && Se.state === "invalid" ? Se.hint ?? y("booking.details.insuranceNumber.invalid") : void 0,
924
+ [J.country]: Ve("country"),
925
+ [J.street]: Ve("street"),
926
+ [J.city]: Ve("city"),
927
+ [J.postcode]: Ve("postcode"),
928
+ [J.province]: Ve("province")
929
+ }, Xe = Sn.filter(
930
+ (o) => ue.has(o) && re[o] !== void 0
931
+ );
932
+ Xe.length !== ue.size && At(new Set(Xe));
933
+ const Y = (o) => !ue.has(o), it = async (o) => {
934
+ var L;
935
+ if (o.preventDefault(), !se && !G.current && !pe && At(
936
+ new Set(
937
+ Sn.filter(
938
+ (Z) => ue.has(Z) || !re[Z]
939
+ )
940
+ )
941
+ ), Le({
942
+ firstName: !0,
943
+ lastName: !0,
944
+ email: !i,
945
+ mobilePhone: !0,
946
+ codiceFiscale: !0,
947
+ dateOfBirth: !0,
948
+ insuranceNumber: !0,
949
+ ...Object.fromEntries(
950
+ Object.values(J).map((Z) => [Z, !0])
951
+ )
952
+ }), se || G.current) return;
953
+ if (!pe) {
954
+ K((Z) => Z + 1);
955
+ return;
956
+ }
957
+ const S = {
958
+ firstName: e.firstName.trim(),
959
+ lastName: e.lastName.trim(),
960
+ ...!i && ((L = e.email) != null && L.trim()) ? { email: e.email.trim() } : {},
961
+ mobilePhone: e.mobilePhone,
962
+ privacyConsent: !0,
963
+ termsConsent: !0,
964
+ // Only present when the service carried text to accept — a
965
+ // reason without it leaves the key out of the payload entirely.
966
+ ...Ye ? { criticalInformationAccepted: !0 } : {},
967
+ // Sent whenever the practice's box is shown, ticked or not, so the
968
+ // server can record the answer; left out when there is no box.
969
+ ...Ue ? { practiceConsentAccepted: me } : {},
970
+ ...g ? { paymentAccepted: !0 } : {},
971
+ codiceFiscale: e.codiceFiscale,
972
+ dateOfBirth: e.dateOfBirth,
973
+ insuranceNumber: e.insuranceNumber,
974
+ note: e.note,
975
+ returningPatient: e.returningPatient,
976
+ // Only include when the picker was visible; otherwise the single
977
+ // implicit channel is inferred backend-side from the practice
978
+ // config.
979
+ confirmationChannels: $e ? xe : void 0,
980
+ ...be && e.billing ? {
981
+ billing: Dr(
982
+ e.billing,
983
+ `${e.firstName.trim()} ${e.lastName.trim()}`
984
+ )
985
+ } : {}
986
+ };
987
+ G.current = !0, Re(!0), ve(!1);
988
+ try {
989
+ await s(S);
990
+ } catch {
991
+ ve(!0);
992
+ } finally {
993
+ G.current = !1, Re(!1);
994
+ }
995
+ }, Pt = /* @__PURE__ */ n(
996
+ qe,
997
+ {
998
+ label: y("booking.details.codiceFiscale.label"),
999
+ required: !0,
1000
+ description: fe.state === "pending" ? y("booking.details.codiceFiscale.checking") : y("booking.details.codiceFiscale.helper"),
1001
+ error: re.codiceFiscale,
1002
+ announceError: Y("codiceFiscale"),
1003
+ children: /* @__PURE__ */ n(
1004
+ $t,
1005
+ {
1006
+ value: e.codiceFiscale ?? "",
1007
+ maxLength: 16,
1008
+ onChange: (o) => j({
1009
+ codiceFiscale: o.target.value.slice(0, 16).toUpperCase()
1010
+ }),
1011
+ onBlur: () => ne("codiceFiscale")
1012
+ }
1013
+ )
1014
+ }
1015
+ ), St = (o, S) => {
1016
+ const L = zt(S);
1017
+ return L ? /* @__PURE__ */ n(
1018
+ Cn,
1019
+ {
1020
+ ns: "ui",
1021
+ i18nKey: o,
1022
+ components: {
1023
+ // The `<Trans>` runtime injects link text from the i18n
1024
+ // string. The anchor renders empty at static-analysis time,
1025
+ // so `jsx-a11y/anchor-has-content` would false-flag — silence
1026
+ // it; the runtime content is the localised policy / terms
1027
+ // label.
1028
+ policyLink: (
1029
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
1030
+ /* @__PURE__ */ n(
1031
+ "a",
1032
+ {
1033
+ href: L,
1034
+ target: "_blank",
1035
+ rel: "noopener noreferrer",
1036
+ className: sn
1037
+ }
1038
+ )
1039
+ )
1040
+ }
1041
+ }
1042
+ ) : y(o);
1043
+ };
1044
+ return /* @__PURE__ */ k(
1045
+ "form",
1046
+ {
1047
+ ref: _e,
1048
+ id: ee,
1049
+ noValidate: !0,
1050
+ onSubmit: it,
1051
+ onFocus: (o) => {
1052
+ const S = Oe.current;
1053
+ !S || !o.currentTarget.contains(o.target) || !S.contains(o.target) && S.compareDocumentPosition(o.target) & Node.DOCUMENT_POSITION_FOLLOWING && Mt();
1054
+ },
1055
+ "aria-busy": se || void 0,
1056
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1057
+ children: [
1058
+ b,
1059
+ /* @__PURE__ */ k("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
1060
+ /* @__PURE__ */ n(
1061
+ qe,
1062
+ {
1063
+ label: y("booking.details.firstName.label"),
1064
+ required: !0,
1065
+ error: re.firstName,
1066
+ announceError: Y("firstName"),
1067
+ children: /* @__PURE__ */ n(
1068
+ $t,
1069
+ {
1070
+ autoComplete: "given-name",
1071
+ value: e.firstName ?? "",
1072
+ onChange: (o) => j({ firstName: o.target.value }),
1073
+ onBlur: () => ne("firstName")
1074
+ }
1075
+ )
1076
+ }
1077
+ ),
1078
+ /* @__PURE__ */ n(
1079
+ qe,
1080
+ {
1081
+ label: y("booking.details.lastName.label"),
1082
+ required: !0,
1083
+ error: re.lastName,
1084
+ announceError: Y("lastName"),
1085
+ children: /* @__PURE__ */ n(
1086
+ $t,
1087
+ {
1088
+ autoComplete: "family-name",
1089
+ value: e.lastName ?? "",
1090
+ onChange: (o) => j({ lastName: o.target.value }),
1091
+ onBlur: () => ne("lastName")
1092
+ }
1093
+ )
1094
+ }
1095
+ )
1096
+ ] }),
1097
+ /* @__PURE__ */ k(
1098
+ "div",
1099
+ {
1100
+ className: `ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)]${i ? "" : " ds:sm:grid-cols-2"}`,
1101
+ children: [
1102
+ !i && /* @__PURE__ */ n(
1103
+ qe,
1104
+ {
1105
+ label: y("booking.details.email.label"),
1106
+ ...lt ? { required: !0 } : { optional: !0 },
1107
+ error: re.email,
1108
+ announceError: Y("email"),
1109
+ children: /* @__PURE__ */ n(
1110
+ cs,
1111
+ {
1112
+ disableBuiltInValidation: r,
1113
+ value: e.email ?? "",
1114
+ onChange: (o) => j({ email: o.target.value }),
1115
+ onBlur: () => ne("email")
1116
+ }
1117
+ )
1118
+ }
1119
+ ),
1120
+ /* @__PURE__ */ n(
1121
+ qe,
1122
+ {
1123
+ label: y("booking.details.mobilePhone.label"),
1124
+ required: !0,
1125
+ error: re.mobilePhone,
1126
+ announceError: Y("mobilePhone"),
1127
+ children: /* @__PURE__ */ n(
1128
+ ds,
1129
+ {
1130
+ value: e.mobilePhone ?? "",
1131
+ defaultCountry: C == null ? void 0 : C.toUpperCase(),
1132
+ onChange: (o) => {
1133
+ j({ mobilePhone: o }), ne("mobilePhone");
1134
+ }
1135
+ }
1136
+ )
1137
+ }
1138
+ )
1139
+ ]
1140
+ }
1141
+ ),
1142
+ $ && !be || c ? /* @__PURE__ */ k("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
1143
+ $ && !be ? Pt : null,
1144
+ c ? /* @__PURE__ */ n(
1145
+ qe,
1146
+ {
1147
+ label: y("booking.details.dateOfBirth.label"),
1148
+ required: !0,
1149
+ error: re.dateOfBirth,
1150
+ announceError: Y("dateOfBirth"),
1151
+ children: /* @__PURE__ */ n(
1152
+ as,
1153
+ {
1154
+ value: e.dateOfBirth ? new Date(e.dateOfBirth) : void 0,
1155
+ onChange: (o) => {
1156
+ j({
1157
+ dateOfBirth: o ? o.toISOString().slice(0, 10) : void 0
1158
+ }), ne("dateOfBirth");
1159
+ }
1160
+ }
1161
+ )
1162
+ }
1163
+ ) : null
1164
+ ] }) : null,
1165
+ We ? /* @__PURE__ */ n(
1166
+ qe,
1167
+ {
1168
+ label: y("booking.details.insuranceNumber.label"),
1169
+ required: !0,
1170
+ description: Se.state === "pending" ? y("booking.details.insuranceNumber.checking") : void 0,
1171
+ error: re.insuranceNumber,
1172
+ announceError: Y("insuranceNumber"),
1173
+ children: /* @__PURE__ */ n(
1174
+ $t,
1175
+ {
1176
+ value: e.insuranceNumber ?? "",
1177
+ onChange: (o) => j({ insuranceNumber: o.target.value }),
1178
+ onBlur: () => ne("insuranceNumber")
1179
+ }
1180
+ )
1181
+ }
1182
+ ) : null,
1183
+ be ? /* @__PURE__ */ k(
1184
+ "div",
1185
+ {
1186
+ ref: Oe,
1187
+ "data-component": "booking-billing",
1188
+ role: "group",
1189
+ "aria-labelledby": `${ee}-billing-heading`,
1190
+ "aria-describedby": `${ee}-billing-intro`,
1191
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-md)] ds:border ds:border-[var(--border)] ds:p-[var(--spacing-sm)]",
1192
+ onBlur: (o) => {
1193
+ var L;
1194
+ const S = (L = o.target.closest("[data-address-field]")) == null ? void 0 : L.getAttribute("data-address-field");
1195
+ (S === "street" || S === "city" || S === "postcode") && ne(J[S]);
1196
+ },
1197
+ children: [
1198
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
1199
+ /* @__PURE__ */ n(
1200
+ "h3",
1201
+ {
1202
+ id: `${ee}-billing-heading`,
1203
+ className: "type-label ds:m-0 ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]",
1204
+ children: y("booking.details.billing.heading")
1205
+ }
1206
+ ),
1207
+ /* @__PURE__ */ n(
1208
+ "p",
1209
+ {
1210
+ id: `${ee}-billing-intro`,
1211
+ className: "type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]",
1212
+ children: y("booking.details.billing.intro")
1213
+ }
1214
+ )
1215
+ ] }),
1216
+ $ ? Pt : null,
1217
+ /* @__PURE__ */ n(
1218
+ us,
1219
+ {
1220
+ value: st,
1221
+ onChange: (o) => {
1222
+ var S;
1223
+ return (
1224
+ // The name is set from the patient's own on submit.
1225
+ j({
1226
+ billing: wr(
1227
+ o,
1228
+ "",
1229
+ // A second line belongs to its street: it goes when the
1230
+ // patient writes another, and returns with the first.
1231
+ o.street.trim() === ((S = He.current) == null ? void 0 : S.street) ? He.current.line2 : null
1232
+ )
1233
+ })
1234
+ );
1235
+ },
1236
+ popularCountries: Tr,
1237
+ layout: "grid",
1238
+ fields: le ? void 0 : ["street", "city", "postcode"],
1239
+ required: le ? ["country", "street", "city", "postcode", "province"] : ["country", "street", "city", "postcode"],
1240
+ errors: {
1241
+ country: re[J.country],
1242
+ street: re[J.street],
1243
+ city: re[J.city],
1244
+ postcode: re[J.postcode],
1245
+ province: re[J.province]
1246
+ },
1247
+ announceErrors: {
1248
+ country: Y(J.country),
1249
+ street: Y(J.street),
1250
+ city: Y(J.city),
1251
+ postcode: Y(J.postcode),
1252
+ province: Y(J.province)
1253
+ }
1254
+ }
1255
+ )
1256
+ ]
1257
+ }
1258
+ ) : null,
1259
+ p ? /* @__PURE__ */ n(
1260
+ qe,
1261
+ {
1262
+ label: y("booking.details.note.label"),
1263
+ description: y("booking.details.note.helper", {
1264
+ max: yn
1265
+ }),
1266
+ children: /* @__PURE__ */ n(
1267
+ ls,
1268
+ {
1269
+ value: e.note ?? "",
1270
+ maxLength: yn,
1271
+ rows: 3,
1272
+ onChange: (o) => j({ note: o.target.value })
1273
+ }
1274
+ )
1275
+ }
1276
+ ) : null,
1277
+ f ? /* @__PURE__ */ n(
1278
+ ht,
1279
+ {
1280
+ checked: !!e.returningPatient,
1281
+ onCheckedChange: (o) => j({ returningPatient: o === !0 }),
1282
+ label: y("booking.details.returningPatient.label")
1283
+ }
1284
+ ) : null,
1285
+ ft !== void 0 ? /* @__PURE__ */ k(
1286
+ "div",
1287
+ {
1288
+ "data-component": "booking-critical-information",
1289
+ role: "group",
1290
+ "aria-labelledby": `${ee}-critical-information-heading`,
1291
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-md)] ds:border ds:border-[var(--border)] ds:bg-[var(--muted)] ds:p-[var(--spacing-sm)]",
1292
+ children: [
1293
+ /* @__PURE__ */ n(
1294
+ "h3",
1295
+ {
1296
+ id: `${ee}-critical-information-heading`,
1297
+ className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0",
1298
+ children: y("booking.details.criticalInformation.heading")
1299
+ }
1300
+ ),
1301
+ /* @__PURE__ */ n(
1302
+ "p",
1303
+ {
1304
+ dir: "auto",
1305
+ className: "type-body-sm ds:m-0 ds:whitespace-pre-wrap ds:break-words ds:text-[var(--foreground)]",
1306
+ children: Sr(ft).map(
1307
+ (o, S) => o.kind === "link" ? /* @__PURE__ */ n(
1308
+ "a",
1309
+ {
1310
+ href: o.href,
1311
+ target: "_blank",
1312
+ rel: "noopener noreferrer",
1313
+ dir: "ltr",
1314
+ className: sn,
1315
+ children: o.text
1316
+ },
1317
+ S
1318
+ ) : /* @__PURE__ */ n(es, { children: o.text }, S)
1319
+ )
1320
+ }
1321
+ ),
1322
+ /* @__PURE__ */ n(
1323
+ ht,
1324
+ {
1325
+ checked: !!e.criticalInformationAccepted,
1326
+ onCheckedChange: (o) => j({ criticalInformationAccepted: o === !0 }),
1327
+ "aria-required": !0,
1328
+ label: /* @__PURE__ */ k(oe, { children: [
1329
+ y("booking.details.criticalInformation.accept"),
1330
+ /* @__PURE__ */ n(
1331
+ "span",
1332
+ {
1333
+ "aria-hidden": "true",
1334
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1335
+ children: "*"
1336
+ }
1337
+ )
1338
+ ] })
1339
+ }
1340
+ )
1341
+ ]
1342
+ }
1343
+ ) : null,
1344
+ g ? /* @__PURE__ */ k(
1345
+ "div",
1346
+ {
1347
+ "data-component": "booking-payment-notice",
1348
+ role: "group",
1349
+ "aria-labelledby": `${ee}-payment-heading`,
1350
+ "data-notice-style": N,
1351
+ className: Cr({
1352
+ noticeStyle: N
1353
+ }),
1354
+ children: [
1355
+ N === "highlighted" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
1356
+ /* @__PURE__ */ n("span", { className: "ds:flex ds:size-9 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-full ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]", children: /* @__PURE__ */ n(ms, { "aria-hidden": "true", className: "ds:size-5" }) }),
1357
+ /* @__PURE__ */ n(
1358
+ "h3",
1359
+ {
1360
+ id: `${ee}-payment-heading`,
1361
+ className: "type-title-item ds:m-0 ds:flex-1",
1362
+ children: y("booking.payment.noticeTitle")
1363
+ }
1364
+ ),
1365
+ /* @__PURE__ */ n(
1366
+ "span",
1367
+ {
1368
+ "aria-hidden": "true",
1369
+ className: "type-title-card ds:shrink-0 ds:text-[var(--foreground)]",
1370
+ children: Pe
1371
+ }
1372
+ )
1373
+ ] }) : /* @__PURE__ */ n(
1374
+ "h3",
1375
+ {
1376
+ id: `${ee}-payment-heading`,
1377
+ className: "type-label ds:m-0",
1378
+ children: y("booking.payment.noticeTitle")
1379
+ }
1380
+ ),
1381
+ /* @__PURE__ */ n("p", { className: "type-body-sm ds:m-0", children: y("booking.payment.noticeBody", { amount: Pe }) }),
1382
+ De ? /* @__PURE__ */ n(
1383
+ "a",
1384
+ {
1385
+ href: De,
1386
+ target: "_blank",
1387
+ rel: "noopener noreferrer",
1388
+ className: "type-body-sm ds:inline-flex ds:items-center ds:self-start ds:min-h-[var(--min-target-size)] ds:rounded-[var(--radius-sm)] ds:underline ds:text-[var(--foreground)] ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1389
+ children: y("booking.payment.terms")
1390
+ }
1391
+ ) : null,
1392
+ /* @__PURE__ */ n(
1393
+ ht,
1394
+ {
1395
+ checked: ct,
1396
+ onCheckedChange: (o) => {
1397
+ je(
1398
+ o === !0 ? Te : void 0
1399
+ ), j({ paymentAccepted: o === !0 });
1400
+ },
1401
+ "aria-required": !0,
1402
+ label: /* @__PURE__ */ k(oe, { children: [
1403
+ y("booking.payment.accept", { amount: Pe }),
1404
+ /* @__PURE__ */ n(
1405
+ "span",
1406
+ {
1407
+ "aria-hidden": "true",
1408
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1409
+ children: "*"
1410
+ }
1411
+ )
1412
+ ] })
1413
+ }
1414
+ )
1415
+ ]
1416
+ }
1417
+ ) : null,
1418
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1419
+ /* @__PURE__ */ n(
1420
+ ht,
1421
+ {
1422
+ checked: !!e.privacyConsent,
1423
+ onCheckedChange: (o) => j({ privacyConsent: o === !0 }),
1424
+ "aria-required": !0,
1425
+ label: /* @__PURE__ */ k(oe, { children: [
1426
+ St(
1427
+ "booking.details.consent.privacy.label",
1428
+ v
1429
+ ),
1430
+ /* @__PURE__ */ n(
1431
+ "span",
1432
+ {
1433
+ "aria-hidden": "true",
1434
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1435
+ children: "*"
1436
+ }
1437
+ )
1438
+ ] })
1439
+ }
1440
+ ),
1441
+ /* @__PURE__ */ n(
1442
+ ht,
1443
+ {
1444
+ checked: !!e.termsConsent,
1445
+ onCheckedChange: (o) => j({ termsConsent: o === !0 }),
1446
+ "aria-required": !0,
1447
+ label: /* @__PURE__ */ k(oe, { children: [
1448
+ St(
1449
+ "booking.details.consent.terms.label",
1450
+ h
1451
+ ),
1452
+ /* @__PURE__ */ n(
1453
+ "span",
1454
+ {
1455
+ "aria-hidden": "true",
1456
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1457
+ children: "*"
1458
+ }
1459
+ )
1460
+ ] })
1461
+ }
1462
+ ),
1463
+ d && Ue ? /* @__PURE__ */ n(
1464
+ ht,
1465
+ {
1466
+ checked: me,
1467
+ onCheckedChange: (o) => {
1468
+ ce(
1469
+ o === !0 ? Ae : void 0
1470
+ ), j({ practiceConsentAccepted: o === !0 });
1471
+ },
1472
+ "aria-required": d.required || void 0,
1473
+ label: /* @__PURE__ */ k(oe, { children: [
1474
+ zt(d.url) ? /* @__PURE__ */ n(
1475
+ "a",
1476
+ {
1477
+ dir: "auto",
1478
+ href: zt(d.url),
1479
+ target: "_blank",
1480
+ rel: "noopener noreferrer",
1481
+ className: sn,
1482
+ children: d.label
1483
+ }
1484
+ ) : /* @__PURE__ */ n("span", { dir: "auto", children: d.label }),
1485
+ d.required ? /* @__PURE__ */ n(
1486
+ "span",
1487
+ {
1488
+ "aria-hidden": "true",
1489
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1490
+ children: "*"
1491
+ }
1492
+ ) : null
1493
+ ] })
1494
+ }
1495
+ ) : null
1496
+ ] }),
1497
+ $e ? /* @__PURE__ */ n(
1498
+ "div",
1499
+ {
1500
+ "data-component": "booking-confirmation-channels",
1501
+ "data-unanswered": U || void 0,
1502
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1503
+ children: B ? /* @__PURE__ */ n(
1504
+ os,
1505
+ {
1506
+ variant: "horizontal",
1507
+ label: y("booking.confirmation.heading"),
1508
+ value: xe[0] ?? "",
1509
+ onValueChange: (o) => j({
1510
+ confirmationChannels: [o]
1511
+ }),
1512
+ error: U ? y("booking.confirmation.atLeastOne") : void 0,
1513
+ children: Me.map((o) => /* @__PURE__ */ n(
1514
+ is,
1515
+ {
1516
+ value: o,
1517
+ label: y(`booking.confirmation.channel.${o}`)
1518
+ },
1519
+ o
1520
+ ))
1521
+ }
1522
+ ) : /* @__PURE__ */ n(
1523
+ rs,
1524
+ {
1525
+ label: y("booking.confirmation.heading"),
1526
+ helperText: y("booking.confirmation.helper"),
1527
+ value: xe,
1528
+ onChange: (o) => j({
1529
+ confirmationChannels: o
1530
+ }),
1531
+ orientation: "vertical",
1532
+ options: Me.map((o) => ({
1533
+ value: o,
1534
+ label: y(`booking.confirmation.channel.${o}`)
1535
+ })),
1536
+ error: U ? y("booking.confirmation.atLeastOne") : void 0
1537
+ }
1538
+ )
1539
+ }
1540
+ ) : null,
1541
+ !R && (P || et || u) ? /* @__PURE__ */ n(ae, { variant: "error", children: /* @__PURE__ */ n(ae.Description, { children: P ?? y(
1542
+ u ? "booking.payment.unavailable" : "booking.payment.submitFailed"
1543
+ ) }) }) : null,
1544
+ R ? null : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1545
+ Bt ? /* @__PURE__ */ n(
1546
+ "p",
1547
+ {
1548
+ id: gt,
1549
+ "data-slot": "submit-hint",
1550
+ className: "type-body-sm ds:m-0 ds:text-[var(--muted-foreground)]",
1551
+ children: y("booking.details.submitHint")
1552
+ }
1553
+ ) : null,
1554
+ /* @__PURE__ */ n(
1555
+ Ne,
1556
+ {
1557
+ intent: "primary",
1558
+ size: "md",
1559
+ type: "submit",
1560
+ disabled: se || u,
1561
+ "aria-disabled": !pe || void 0,
1562
+ "aria-describedby": Bt ? gt : void 0,
1563
+ startIcon: se ? /* @__PURE__ */ n(Tn, { variant: "pulse", size: "sm" }) : void 0,
1564
+ children: g ? y("booking.payment.submit", { amount: Pe }) : y("booking.details.submit")
1565
+ }
1566
+ )
1567
+ ] })
1568
+ ]
1569
+ }
1570
+ );
1571
+ }
1572
+ );
1573
+ un.displayName = "BookingDetailsForm";
1574
+ const yt = [
1575
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1576
+ "ds:focus-visible:outline-solid",
1577
+ "ds:focus-visible:outline-[var(--ring)]",
1578
+ "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1579
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
1580
+ ].join(" ");
1581
+ function Mr({
1582
+ length: e = 5,
1583
+ onVerify: t,
1584
+ onResend: s,
1585
+ resendSeconds: i = 60,
1586
+ phoneHint: r,
1587
+ onVerified: a,
1588
+ onBusyChange: c
1589
+ }) {
1590
+ const { t: l, i18n: m } = Q("ui"), p = at(), f = at(), v = M(null), h = M(null), d = M(null), g = M(null), I = M(!1), u = M(!1), [F, N] = H(null), [w, x] = H(!1), [A, _] = H(null), [R, b] = H(
1591
+ null
1592
+ ), [C, V] = H(0), D = Number.isFinite(i) ? Math.max(0, Math.ceil(i)) : 60, [B, P] = H(
1593
+ () => Date.now() + D * 1e3
1594
+ ), [O, y] = H(D), X = A === "too-many-attempts";
1595
+ z(() => {
1596
+ c == null || c(!!F);
1597
+ }, [F, c]), z(() => (I.current = !0, () => {
1598
+ I.current = !1;
1599
+ }), []), z(() => {
1600
+ var E, K, G;
1601
+ (E = d.current) == null || E.focus({ preventScroll: !0 }), (G = (K = h.current) == null ? void 0 : K.scrollIntoView) == null || G.call(K, { block: "nearest" });
1602
+ }, [C]), z(() => {
1603
+ var G, te;
1604
+ if (F || !X && R !== "resend") return;
1605
+ const E = document.activeElement, K = (G = v.current) == null ? void 0 : G.closest("section");
1606
+ E && E !== document.body && !(K != null && K.contains(E)) || (g.current && !g.current.disabled ? g.current.focus() : (te = v.current) == null || te.focus());
1607
+ }, [F, X, R]), z(() => {
1608
+ if (O === 0) return;
1609
+ const E = setTimeout(() => {
1610
+ y(Math.max(0, Math.ceil((B - Date.now()) / 1e3)));
1611
+ }, 1e3);
1612
+ return () => clearTimeout(E);
1613
+ }, [B, O]);
1614
+ const ee = async (E) => {
1615
+ if (!(u.current || X)) {
1616
+ u.current = !0, N("verify"), x(!1), _(null), b(null);
1617
+ try {
1618
+ const K = await t(E);
1619
+ if (!I.current) return;
1620
+ K.ok ? a(K.redirectUrl) : (_(K.reason), K.reason !== "too-many-attempts" && V((G) => G + 1));
1621
+ } catch {
1622
+ if (!I.current) return;
1623
+ b("verify"), V((K) => K + 1);
1624
+ } finally {
1625
+ u.current = !1, I.current && N(null);
1626
+ }
1627
+ }
1628
+ }, Fe = async () => {
1629
+ if (!(u.current || Date.now() < B)) {
1630
+ u.current = !0, N("resend"), x(!1), b(null);
1631
+ try {
1632
+ if (await s(), !I.current) return;
1633
+ P(Date.now() + D * 1e3), y(D), _(null), x(!0), V((E) => E + 1);
1634
+ } catch {
1635
+ I.current && b("resend");
1636
+ } finally {
1637
+ u.current = !1, I.current && N(null);
1638
+ }
1639
+ }
1640
+ }, _e = A === "wrong" ? l("booking.code.wrong") : A === "expired" ? l("booking.code.expired") : X ? l("booking.code.tooManyAttempts") : void 0;
1641
+ return /* @__PURE__ */ k(
1642
+ "section",
1643
+ {
1644
+ ref: h,
1645
+ "aria-labelledby": p,
1646
+ "data-component": "booking-code-step",
1647
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1648
+ children: [
1649
+ /* @__PURE__ */ n(
1650
+ "h3",
1651
+ {
1652
+ ref: v,
1653
+ id: p,
1654
+ tabIndex: -1,
1655
+ className: `type-title-card ds:m-0 ${yt}`,
1656
+ children: l("booking.code.heading")
1657
+ }
1658
+ ),
1659
+ /* @__PURE__ */ n("p", { id: f, className: "type-body ds:m-0", children: r ? /* @__PURE__ */ n(
1660
+ Cn,
1661
+ {
1662
+ t: l,
1663
+ ns: "ui",
1664
+ i18nKey: "booking.code.instructionWithPhone",
1665
+ values: { phone: r },
1666
+ components: { phone: /* @__PURE__ */ n("bdi", {}) }
1667
+ }
1668
+ ) : l("booking.code.instruction") }),
1669
+ /* @__PURE__ */ n(qe, { label: l("booking.code.label"), error: _e, children: /* @__PURE__ */ n("div", { dir: "ltr", children: /* @__PURE__ */ n(
1670
+ ps,
1671
+ {
1672
+ ref: d,
1673
+ length: e,
1674
+ mode: "alphanumeric",
1675
+ "aria-describedby": f,
1676
+ disabled: !!F || X,
1677
+ onComplete: ee
1678
+ },
1679
+ C
1680
+ ) }) }),
1681
+ R ? /* @__PURE__ */ n(ae, { variant: "error", children: /* @__PURE__ */ n(ae.Description, { children: l(R === "verify" ? "booking.code.verifyFailed" : "booking.code.resendFailed") }) }) : null,
1682
+ /* @__PURE__ */ n("p", { role: "status", className: "type-body ds:m-0", children: F === "verify" ? l("booking.code.verifying") : w ? l("booking.code.resent") : null }),
1683
+ /* @__PURE__ */ n(
1684
+ Ne,
1685
+ {
1686
+ ref: g,
1687
+ type: "button",
1688
+ intent: "secondary",
1689
+ className: "ds:self-start",
1690
+ disabled: O > 0 || !!F,
1691
+ loading: F === "resend",
1692
+ onClick: Fe,
1693
+ children: O > 0 ? l("booking.code.resendCountdown", {
1694
+ seconds: new Intl.NumberFormat(m.language).format(O)
1695
+ }) : l("booking.code.resend")
1696
+ }
1697
+ )
1698
+ ]
1699
+ }
1700
+ );
1701
+ }
1702
+ function zn(e) {
1703
+ const t = e.payment;
1704
+ if (!t) return;
1705
+ const s = (t.currencyCode ?? "EUR").toUpperCase();
1706
+ if (!(!Number.isSafeInteger(t.amountCents) || t.amountCents <= 0 || !["full", "deposit"].includes(t.kind) || !/^[A-Z]{3}$/.test(s)))
1707
+ return {
1708
+ serviceId: e.id,
1709
+ kind: t.kind,
1710
+ amountCents: t.amountCents,
1711
+ currencyCode: s
1712
+ };
1713
+ }
1714
+ function Er(e) {
1715
+ var r;
1716
+ const t = (r = e.priceLabel) != null && r.trim() ? e.priceLabel : void 0, s = t ? { label: t } : void 0;
1717
+ if (!e.payment) return { price: s };
1718
+ const i = zn(e);
1719
+ return i ? {
1720
+ price: s ?? (i.kind === "full" ? { amount: i } : void 0),
1721
+ payment: i
1722
+ } : { price: s, payment: "unavailable" };
1723
+ }
1724
+ function Fr(e, t, s) {
1725
+ const i = e.filter(
1726
+ (a) => t.includes(a.id)
1727
+ ), r = (s == null ? void 0 : s.serviceId) ?? (t.length === 1 ? t[0] : void 0);
1728
+ if (r) {
1729
+ const a = i.find((l) => l.id === r);
1730
+ if (!a) return { blocked: !0 };
1731
+ const c = zn(a);
1732
+ return { payment: c, blocked: !!(a.payment && !c) };
1733
+ }
1734
+ return { blocked: i.some((a) => !!a.payment) };
1735
+ }
1736
+ function jt(e) {
1737
+ return e ? JSON.stringify([
1738
+ e.serviceId,
1739
+ e.kind,
1740
+ e.amountCents,
1741
+ e.currencyCode
1742
+ ]) : "";
1743
+ }
1744
+ function _r({
1745
+ services: e,
1746
+ value: t,
1747
+ availableSlots: s,
1748
+ onSubmit: i,
1749
+ onChange: r,
1750
+ paymentState: a,
1751
+ submitting: c,
1752
+ paymentTermsUrl: l,
1753
+ renderPayment: m,
1754
+ codeStep: p
1755
+ }) {
1756
+ var _e, E, K;
1757
+ const f = JSON.stringify([
1758
+ t.insuranceType,
1759
+ t.specialtyId,
1760
+ t.specialtyIds,
1761
+ Ke(t),
1762
+ t.operatorId,
1763
+ t.operatorIds,
1764
+ t.date,
1765
+ t.slotKey
1766
+ ]), v = M(
1767
+ void 0
1768
+ ), d = (t.date ? (_e = s[t.date]) == null ? void 0 : _e.find((G) => G.key === t.slotKey) : void 0) ?? (((E = v.current) == null ? void 0 : E.selection) === f ? v.current.slot : void 0), g = Fr(
1769
+ e,
1770
+ Ke(t),
1771
+ d
1772
+ ), I = g.blocked || !!(g.payment && !m), u = JSON.stringify([
1773
+ f,
1774
+ d == null ? void 0 : d.serviceId,
1775
+ jt(g.payment),
1776
+ l,
1777
+ I
1778
+ ]), F = g.payment ? JSON.stringify([jt(g.payment), l]) : "", N = M(void 0), w = !!((K = t.details) != null && K.paymentAccepted);
1779
+ z(() => {
1780
+ if (!w) N.current = void 0;
1781
+ else if (F) N.current === void 0 ? N.current = F : N.current !== F && (N.current = void 0, r({
1782
+ ...t,
1783
+ details: { ...t.details, paymentAccepted: !1 }
1784
+ }));
1785
+ else return;
1786
+ }, [w, F, r, t]);
1787
+ const x = M(u);
1788
+ x.current = u;
1789
+ const [A, _] = H({ status: "idle" }), R = M(0), b = M(!1), C = M(!0), V = M(!1), D = M(void 0), B = M(u);
1790
+ z(() => (C.current = !0, () => {
1791
+ C.current = !1, R.current += 1;
1792
+ }), []);
1793
+ const P = A.status === "payment" || A.status === "code" || A.status === "success";
1794
+ z(() => {
1795
+ B.current === u || V.current || P || (B.current = u, R.current += 1, b.current = !1, _({ status: "idle" }));
1796
+ }, [u, P]);
1797
+ const O = P || B.current === u ? A.session : void 0, y = q(
1798
+ () => O && (a == null ? void 0 : a.sessionId) === O.id ? a : O ? { sessionId: O.id, status: "ready" } : void 0,
1799
+ [O, a]
1800
+ );
1801
+ O && y && "phase" in y && y.phase === "completion" && (D.current = O.id);
1802
+ const X = q(
1803
+ () => O && D.current === O.id && y && y.status !== "paid" && (!("phase" in y) || y.phase !== "completion") ? {
1804
+ sessionId: O.id,
1805
+ status: "processing",
1806
+ phase: "completion"
1807
+ } : y,
1808
+ [O, y]
1809
+ );
1810
+ z(() => {
1811
+ if (!(!O || !X || V.current))
1812
+ if (X.status === "paid") {
1813
+ if (A.status !== "payment") return;
1814
+ V.current = !0, _((G) => ({
1815
+ ...G,
1816
+ status: "success",
1817
+ redirectUrl: X.redirectUrl
1818
+ }));
1819
+ } else X.status === "cancelled" && (R.current += 1, b.current = !1, v.current = void 0, r({
1820
+ ...t,
1821
+ details: { ...t.details, paymentAccepted: !1 }
1822
+ }), _({ status: "idle", cancelled: !0 }));
1823
+ }, [O, X, r, t, A.status]);
1824
+ const ee = () => {
1825
+ R.current += 1, b.current = !1, V.current = !1, D.current = void 0, v.current = void 0, B.current = x.current, _({ status: "idle" });
1826
+ }, Fe = async (G) => {
1827
+ var ke, Se, Ce, de, Le;
1828
+ if (!(d != null && d.available) || I || c || b.current || A.status === "payment" || A.status === "code" || V.current || g.payment && !G.paymentAccepted) return;
1829
+ b.current = !0;
1830
+ const te = p ? { ...p } : void 0;
1831
+ v.current = { selection: f, slot: { ...d } };
1832
+ const Re = ++R.current, et = u;
1833
+ B.current = et;
1834
+ const ve = {
1835
+ slot: { ...d, meta: d.meta ? { ...d.meta } : void 0 },
1836
+ value: {
1837
+ ...t,
1838
+ serviceIds: (ke = t.serviceIds) == null ? void 0 : ke.slice(),
1839
+ specialtyIds: (Se = t.specialtyIds) == null ? void 0 : Se.slice(),
1840
+ operatorIds: (Ce = t.operatorIds) == null ? void 0 : Ce.slice(),
1841
+ operatorId: Vn(t) ?? t.operatorId,
1842
+ details: { ...G }
1843
+ },
1844
+ details: {
1845
+ ...G,
1846
+ confirmationChannels: (de = G.confirmationChannels) == null ? void 0 : de.slice()
1847
+ },
1848
+ ...g.payment ? { payment: { ...g.payment } } : {}
1849
+ }, se = () => C.current && R.current === Re && x.current === et;
1850
+ _({ status: "submitting" });
1851
+ let fe = !1;
1852
+ try {
1853
+ const ne = await i(ve);
1854
+ if (!se()) return;
1855
+ if (ve.payment) {
1856
+ const ue = ne == null ? void 0 : ne.paymentSession;
1857
+ if (!((Le = ue == null ? void 0 : ue.id) != null && Le.trim()) || jt(ue.payment) !== jt(ve.payment)) {
1858
+ _({ status: "error" });
1859
+ return;
1860
+ }
1861
+ fe = !0, _({
1862
+ status: te ? "code" : "payment",
1863
+ snapshot: ve,
1864
+ session: { id: ue.id, payment: { ...ue.payment } },
1865
+ codeStep: te
1866
+ });
1867
+ } else ne != null && ne.paymentSession ? _({ status: "error" }) : (V.current = !0, _({
1868
+ status: te ? "code" : "success",
1869
+ snapshot: ve,
1870
+ codeStep: te
1871
+ }));
1872
+ } catch {
1873
+ se() && _({ status: "error" });
1874
+ } finally {
1875
+ se() && !fe && (b.current = !1);
1876
+ }
1877
+ };
1878
+ return {
1879
+ ...A,
1880
+ payment: g.payment,
1881
+ blocked: I,
1882
+ state: X,
1883
+ activeSession: O,
1884
+ submit: Fe,
1885
+ reset: ee,
1886
+ completeCode: (G) => {
1887
+ _(
1888
+ (te) => te.status !== "code" ? te : te.session ? { ...te, status: "payment", codeVerified: !0 } : {
1889
+ ...te,
1890
+ status: "success",
1891
+ codeVerified: !0,
1892
+ redirectUrl: G
1893
+ }
1894
+ );
1895
+ }
1896
+ };
1897
+ }
1898
+ const Rr = 5e3, Lr = "ds:[stroke-dasharray:1] ds:[stroke-dashoffset:1] ds:animate-[stepper-icon-draw_calc(var(--animation-duration)*3)_var(--ease-out)_forwards]", Br = "ds:block ds:[block-size:100%] ds:rounded-full ds:bg-[var(--primary)] ds:animate-[reserved-bar-fill_linear_forwards] ds:[animation-duration:var(--handover-ms)]";
1899
+ function xn(e) {
1900
+ if (typeof window > "u") return !1;
1901
+ if (typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches)
1902
+ return !0;
1903
+ if (!e) return !1;
1904
+ if (e.closest(".theme-accessible")) return !0;
1905
+ const t = getComputedStyle(e).getPropertyValue(
1906
+ "--animation-duration"
1907
+ );
1908
+ return t.trim() !== "" && parseFloat(t) === 0;
1909
+ }
1910
+ function Pr({
1911
+ url: e,
1912
+ delayMs: t,
1913
+ onNavigate: s,
1914
+ date: i,
1915
+ time: r,
1916
+ details: a,
1917
+ shouldTakeFocus: c
1918
+ }) {
1919
+ const { t: l } = Q("ui"), m = M(null), p = M(null), f = M(void 0), v = at(), h = M(null), [d, g] = H(!1), [I, u] = H(() => xn(null)), F = () => {
1920
+ clearTimeout(f.current);
1921
+ try {
1922
+ s ? s(e) : window.location.assign(e);
1923
+ } catch {
1924
+ }
1925
+ }, N = () => {
1926
+ var x;
1927
+ clearTimeout(f.current), g(!0), (x = h.current) == null || x.focus({ preventScroll: !0 });
1928
+ }, w = M(F);
1929
+ return w.current = F, ts(() => {
1930
+ u(xn(m.current));
1931
+ }, []), z(() => {
1932
+ var A;
1933
+ const x = p.current;
1934
+ x && m.current && c(m.current) && (x.focus({ preventScroll: !0 }), (A = x.scrollIntoView) == null || A.call(x, { block: "nearest" }));
1935
+ }, []), z(() => (f.current = setTimeout(() => w.current(), t), () => clearTimeout(f.current)), [e, t]), /* @__PURE__ */ k(
1936
+ "div",
1937
+ {
1938
+ ref: m,
1939
+ "data-component": "booking-reserved",
1940
+ className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-md)] ds:text-center",
1941
+ children: [
1942
+ /* @__PURE__ */ n(
1943
+ "span",
1944
+ {
1945
+ "aria-hidden": "true",
1946
+ className: "ds:flex ds:size-[var(--spacing-2xl)] ds:items-center ds:justify-center ds:rounded-full ds:bg-[color-mix(in_srgb,var(--success)_10%,transparent)] ds:text-[var(--success)]",
1947
+ children: /* @__PURE__ */ n(
1948
+ "svg",
1949
+ {
1950
+ viewBox: "0 0 24 24",
1951
+ fill: "none",
1952
+ stroke: "currentColor",
1953
+ strokeWidth: "3",
1954
+ strokeLinecap: "round",
1955
+ strokeLinejoin: "round",
1956
+ className: "ds:size-[var(--spacing-lg)]",
1957
+ children: /* @__PURE__ */ n("path", { pathLength: "1", d: "M5 12l5 5L20 7", className: Lr })
1958
+ }
1959
+ )
1960
+ }
1961
+ ),
1962
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1963
+ /* @__PURE__ */ n(
1964
+ "h3",
1965
+ {
1966
+ ref: p,
1967
+ tabIndex: -1,
1968
+ "aria-describedby": v,
1969
+ className: `type-title-card ds:m-0 ${yt}`,
1970
+ children: l("booking.reserved.heading")
1971
+ }
1972
+ ),
1973
+ /* @__PURE__ */ n("p", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: i ? l("booking.reserved.when", { date: i, time: r }) : r }),
1974
+ a ? /* @__PURE__ */ n("p", { className: "type-body ds:m-0 ds:text-[var(--muted-foreground)]", children: a }) : null
1975
+ ] }),
1976
+ /* @__PURE__ */ n("p", { id: v, role: "status", className: "type-body ds:m-0", children: l(d ? "booking.reserved.stayed" : "booking.reserved.redirecting") }),
1977
+ I || d || t > Rr ? null : (
1978
+ // Decorative: the sentence above already says a redirect is coming,
1979
+ // and a progressbar with no value to read would only add noise.
1980
+ /* @__PURE__ */ n(
1981
+ "div",
1982
+ {
1983
+ "aria-hidden": "true",
1984
+ "data-slot": "booking-reserved-bar",
1985
+ className: "ds:[block-size:var(--spacing-xs)] ds:[inline-size:100%] ds:[max-inline-size:calc(var(--spacing-2xl)*5)] ds:overflow-hidden ds:rounded-full ds:bg-[var(--secondary)]",
1986
+ children: /* @__PURE__ */ n(
1987
+ "span",
1988
+ {
1989
+ className: Br,
1990
+ style: { "--handover-ms": `${t}ms` }
1991
+ }
1992
+ )
1993
+ }
1994
+ )
1995
+ ),
1996
+ /* @__PURE__ */ n(
1997
+ Ne,
1998
+ {
1999
+ ref: h,
2000
+ type: "button",
2001
+ intent: "secondary",
2002
+ size: "lg",
2003
+ onClick: F,
2004
+ children: l("booking.reserved.goNow")
2005
+ }
2006
+ ),
2007
+ d ? null : /* @__PURE__ */ n(Ne, { type: "button", intent: "ghost", size: "md", onClick: N, children: l("booking.reserved.stay") })
2008
+ ]
2009
+ }
2010
+ );
2011
+ }
2012
+ const Vr = 3e3;
2013
+ function $r(e) {
2014
+ if (typeof e != "string") return;
2015
+ const t = e.trim();
2016
+ try {
2017
+ const { protocol: s } = new URL(t);
2018
+ return (s === "https:" || s === "http:") && fs(t) ? t : void 0;
2019
+ } catch {
2020
+ return;
2021
+ }
2022
+ }
2023
+ const qr = 2 ** 31 - 1;
2024
+ function zr(e) {
2025
+ return typeof e == "number" && Number.isFinite(e) && e >= 0 ? Math.min(e, qr) : Vr;
2026
+ }
2027
+ const Kr = Tt(
2028
+ "ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]",
2029
+ {
2030
+ variants: {
2031
+ variant: {
2032
+ "inline-list": "ds:gap-[var(--spacing-md)]",
2033
+ accordion: "ds:gap-[var(--spacing-md)]",
2034
+ calendar: "ds:gap-[var(--spacing-md)]",
2035
+ flexible: "ds:gap-[var(--spacing-lg)]",
2036
+ progress: "ds:gap-[var(--spacing-sm)]"
2037
+ },
2038
+ // `surface="elevated"` matches `Card variant="elevated"` — same
2039
+ // tokens, same padding, same boundary behaviour — so consumers can
2040
+ // drop their own Card wraps without a double-card look. Default
2041
+ // `'flat'` preserves 0.30.x rendering.
2042
+ surface: {
2043
+ flat: "",
2044
+ elevated: [
2045
+ "ds:rounded-[var(--radius-lg)]",
2046
+ "ds:bg-[var(--card)] ds:text-[var(--card-foreground)]",
2047
+ "ds:border ds:border-[color:var(--card-border)]",
2048
+ "ds:shadow-[var(--shadow-card)]",
2049
+ "ds:p-[var(--spacing-md)]"
2050
+ ].join(" ")
2051
+ }
2052
+ },
2053
+ defaultVariants: { variant: "inline-list", surface: "flat" }
2054
+ }
2055
+ ), jr = [
2056
+ [
2057
+ /\b(estetic|aesthetic|botox|filler|mesoterap|chirurgia\s*plastic)/i,
2058
+ vn
2059
+ ],
2060
+ [/\b(cardio|ecg|elettrocardio|ecocardio|cuore|heart)/i, As],
2061
+ [/\b(dent|odonto|tooth|teeth|pulizia|igien|smile)/i, Zs],
2062
+ [/\b(oftalmo|ocul|ophthal|vision|occhi|eye)/i, Ds],
2063
+ [/\b(otorin|udito|orecchi|hearing|ear)/i, Ks],
2064
+ [/\b(neuro|brain|cervello)/i, Vs],
2065
+ [/\b(pediatr|child|bambin)/i, Os],
2066
+ [/\b(ortop|ortho|osteo|skeleton|ossa|bone)/i, Bs],
2067
+ [/\b(lab|analis|test|sang|esami)/i, Us],
2068
+ [/\b(farmaco|pharm|pillol|refill)/i, Gs],
2069
+ [/\b(chirurg|surg|intervent|operat)/i, Ws],
2070
+ [/\b(scan|rx|x-?ray|raggi|imag|radio|risonan|ecograf|ultras)/i, Ms],
2071
+ [/\b(vacc|inject|inie|punto)/i, vn],
2072
+ [/\b(derma|skin|pelle)/i, Es],
2073
+ [/\b(prima\s*visit|first\s*visit|consult|consulto|valutaz)/i, Fs],
2074
+ [/\b(general|medicin|family|control|check[-\s]?up)/i, Rs]
2075
+ ];
2076
+ function Ur(e) {
2077
+ for (const [t, s] of jr)
2078
+ if (t.test(e)) return s;
2079
+ return null;
2080
+ }
2081
+ function Hr(e) {
2082
+ const t = Ur(e.label) ?? Ts;
2083
+ return /* @__PURE__ */ n(t, { "aria-hidden": "true", className: "ds:size-5" });
2084
+ }
2085
+ function Kn() {
2086
+ const { t: e, i18n: t } = Q("ui");
2087
+ return (s) => {
2088
+ const i = Er(s), r = (c) => Wt(c.amountCents, c.currencyCode, t.language), a = i.price ? "label" in i.price ? i.price.label : r(i.price.amount) : void 0;
2089
+ return i.payment === "unavailable" ? {
2090
+ price: a,
2091
+ payment: e("booking.payment.unavailable"),
2092
+ paymentTone: "error"
2093
+ } : {
2094
+ price: a,
2095
+ payment: i.payment ? e(`booking.payment.${i.payment.kind}`, {
2096
+ amount: r(i.payment)
2097
+ }) : void 0,
2098
+ paymentTone: "default"
2099
+ };
2100
+ };
2101
+ }
2102
+ function ot(e) {
2103
+ return Ht(e, "yyyy-MM-dd");
2104
+ }
2105
+ const Gr = [
2106
+ "ds:relative ds:flex ds:items-center ds:justify-center",
2107
+ "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
2108
+ "ds:rounded-[var(--radius-sm)]",
2109
+ "ds:text-[length:var(--font-size-sm)]",
2110
+ "ds:transition-colors ds:duration-[var(--animation-duration)]",
2111
+ "ds:motion-reduce:transition-none",
2112
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
2113
+ "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
2114
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
2115
+ ].join(" "), Jr = Tt(Gr, {
2116
+ variants: {
2117
+ state: {
2118
+ available: "ds:cursor-pointer ds:text-[var(--foreground)] ds:hover:bg-[var(--muted)]/30",
2119
+ unavailable: "ds:cursor-not-allowed ds:text-[var(--muted-foreground)]/60",
2120
+ selected: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:font-[var(--font-weight-semibold)]",
2121
+ outside: "ds:text-[var(--muted-foreground)]/40"
2122
+ }
2123
+ },
2124
+ defaultVariants: { state: "unavailable" }
2125
+ });
2126
+ function Wr({
2127
+ availableDates: e,
2128
+ selectedDate: t,
2129
+ onSelectDate: s,
2130
+ locale: i,
2131
+ loading: r
2132
+ }) {
2133
+ const { t: a } = Q("ui"), c = q(() => t ? Ct(he(t)) : e.length > 0 ? Ct(he(e[0])) : Ct(/* @__PURE__ */ new Date()), [t, e]), [l, m] = H(c), [p, f] = H(null), v = q(() => {
2134
+ const N = Ct(l), w = Ss(l), x = N.getDay(), A = w.getDate(), _ = [];
2135
+ for (let R = x; R > 0; R -= 1) {
2136
+ const b = new Date(N);
2137
+ b.setDate(N.getDate() - R), _.push(b);
2138
+ }
2139
+ for (let R = 0; R < A; R += 1) {
2140
+ const b = new Date(N);
2141
+ b.setDate(N.getDate() + R), _.push(b);
2142
+ }
2143
+ for (; _.length < 42; ) {
2144
+ const R = _[_.length - 1], b = new Date(R);
2145
+ b.setDate(R.getDate() + 1), _.push(b);
2146
+ }
2147
+ return _;
2148
+ }, [l]), h = q(() => {
2149
+ try {
2150
+ return new Intl.DateTimeFormat(i, {
2151
+ month: "long",
2152
+ year: "numeric"
2153
+ }).format(l);
2154
+ } catch {
2155
+ return Ht(l, "MMMM yyyy");
2156
+ }
2157
+ }, [l, i]), d = q(() => {
2158
+ const N = new Date(2024, 0, 7);
2159
+ return Array.from({ length: 7 }, (w, x) => {
2160
+ const A = new Date(N);
2161
+ A.setDate(N.getDate() + x);
2162
+ try {
2163
+ return new Intl.DateTimeFormat(i, { weekday: "short" }).format(A);
2164
+ } catch {
2165
+ return Ht(A, "EEE");
2166
+ }
2167
+ });
2168
+ }, [i]), g = q(() => new Set(e), [e]), I = ye(
2169
+ (N) => g.has(ot(N)),
2170
+ [g]
2171
+ ), u = q(() => {
2172
+ if (p) return p;
2173
+ if (t) return he(t);
2174
+ const N = v.find(
2175
+ (w) => qt(w, l) && I(w)
2176
+ );
2177
+ return N || (v.find((w) => qt(w, l)) ?? null);
2178
+ }, [p, t, v, l, I]), F = ye(
2179
+ (N, w) => {
2180
+ let x = null;
2181
+ switch (N.key) {
2182
+ case "ArrowLeft":
2183
+ x = new Date(w), x.setDate(w.getDate() - 1);
2184
+ break;
2185
+ case "ArrowRight":
2186
+ x = new Date(w), x.setDate(w.getDate() + 1);
2187
+ break;
2188
+ case "ArrowUp":
2189
+ x = new Date(w), x.setDate(w.getDate() - 7);
2190
+ break;
2191
+ case "ArrowDown":
2192
+ x = new Date(w), x.setDate(w.getDate() + 7);
2193
+ break;
2194
+ case "Home":
2195
+ x = new Date(w), x.setDate(w.getDate() - w.getDay());
2196
+ break;
2197
+ case "End":
2198
+ x = new Date(w), x.setDate(w.getDate() + (6 - w.getDay()));
2199
+ break;
2200
+ case "Enter":
2201
+ case " ": {
2202
+ N.preventDefault(), I(w) && s(ot(w));
2203
+ return;
2204
+ }
2205
+ default:
2206
+ return;
2207
+ }
2208
+ x && (N.preventDefault(), qt(x, l) || m(Ct(x)), f(x));
2209
+ },
2210
+ [I, s, l]
2211
+ );
2212
+ return r ? /* @__PURE__ */ k(
2213
+ "div",
2214
+ {
2215
+ role: "status",
2216
+ "aria-live": "polite",
2217
+ "aria-label": a("common.loading"),
2218
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
2219
+ children: [
2220
+ /* @__PURE__ */ n(Gt, { variant: "text", width: "40%" }),
2221
+ /* @__PURE__ */ n("div", { className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]", children: Array.from({ length: 42 }, (N, w) => /* @__PURE__ */ n(Gt, { variant: "rounded", height: "2.5rem" }, `mg-skel-${w}`)) })
2222
+ ]
2223
+ }
2224
+ ) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2225
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
2226
+ /* @__PURE__ */ n(
2227
+ gn,
2228
+ {
2229
+ icon: /* @__PURE__ */ n(Is, {}),
2230
+ "aria-label": a("booking.previousMonth"),
2231
+ size: "sm",
2232
+ intent: "ghost",
2233
+ flipIconInRtl: !0,
2234
+ onClick: () => {
2235
+ m((N) => tr(N)), f(null);
2236
+ }
2237
+ }
2238
+ ),
2239
+ /* @__PURE__ */ n(
2240
+ "span",
2241
+ {
2242
+ className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]",
2243
+ "aria-live": "polite",
2244
+ children: h
2245
+ }
2246
+ ),
2247
+ /* @__PURE__ */ n(
2248
+ gn,
2249
+ {
2250
+ icon: /* @__PURE__ */ n(Ns, {}),
2251
+ "aria-label": a("booking.nextMonth"),
2252
+ size: "sm",
2253
+ intent: "ghost",
2254
+ flipIconInRtl: !0,
2255
+ onClick: () => {
2256
+ m((N) => On(N, 1)), f(null);
2257
+ }
2258
+ }
2259
+ )
2260
+ ] }),
2261
+ /* @__PURE__ */ k(
2262
+ "div",
2263
+ {
2264
+ role: "grid",
2265
+ "aria-label": a("booking.monthGridLabel"),
2266
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
2267
+ children: [
2268
+ /* @__PURE__ */ n(
2269
+ "div",
2270
+ {
2271
+ role: "row",
2272
+ className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
2273
+ children: d.map((N, w) => /* @__PURE__ */ n(
2274
+ "div",
2275
+ {
2276
+ role: "columnheader",
2277
+ className: "type-meta ds:text-center ds:text-[var(--muted-foreground)] ds:font-[var(--font-weight-medium)]",
2278
+ children: N
2279
+ },
2280
+ `wd-${w}`
2281
+ ))
2282
+ }
2283
+ ),
2284
+ Array.from({ length: 6 }, (N, w) => /* @__PURE__ */ n(
2285
+ "div",
2286
+ {
2287
+ role: "row",
2288
+ className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
2289
+ children: v.slice(w * 7, w * 7 + 7).map((x, A) => {
2290
+ const _ = w * 7 + A, R = qt(x, l), b = R && I(x), C = t ? hn(x, he(t)) : !1, V = R ? C ? "selected" : b ? "available" : "unavailable" : "outside", D = u ? hn(u, x) : !1, B = (() => {
2291
+ try {
2292
+ return new Intl.DateTimeFormat(i, {
2293
+ dateStyle: "full"
2294
+ }).format(x);
2295
+ } catch {
2296
+ return Ht(x, "PPP");
2297
+ }
2298
+ })();
2299
+ return /* @__PURE__ */ n(
2300
+ "button",
2301
+ {
2302
+ type: "button",
2303
+ role: "gridcell",
2304
+ "aria-label": B,
2305
+ "aria-selected": C || void 0,
2306
+ "aria-disabled": !b || void 0,
2307
+ tabIndex: D ? 0 : -1,
2308
+ disabled: !b,
2309
+ onClick: () => {
2310
+ b && s(ot(x));
2311
+ },
2312
+ onKeyDown: (P) => F(P, x),
2313
+ className: Jr({ state: V }),
2314
+ children: /* @__PURE__ */ n("span", { "aria-hidden": "true", children: x.getDate() })
2315
+ },
2316
+ `mg-cell-${_}`
2317
+ );
2318
+ })
2319
+ },
2320
+ `mg-row-${w}`
2321
+ ))
2322
+ ]
2323
+ }
2324
+ )
2325
+ ] });
2326
+ }
2327
+ const Yr = Tt(
2328
+ [
2329
+ "ds:relative ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-md)]",
2330
+ "ds:min-h-[var(--min-target-size)]",
2331
+ "ds:rounded-[var(--radius-md)]",
2332
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
2333
+ "ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]",
2334
+ "ds:text-start",
2335
+ "ds:transition-[background-color,box-shadow]",
2336
+ "ds:duration-[var(--animation-duration)]",
2337
+ "ds:motion-reduce:transition-none",
2338
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
2339
+ "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
2340
+ "ds:forced-colors:[outline:1px_solid_CanvasText]",
2341
+ "ds:cursor-pointer"
2342
+ ].join(" "),
2343
+ {
2344
+ variants: {
2345
+ state: {
2346
+ idle: "ds:bg-[var(--card)] ds:shadow-[var(--shadow-sm)] ds:hover:shadow-[var(--shadow-md)]",
2347
+ selected: "ds:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] ds:shadow-[var(--shadow-sm)]"
2348
+ }
2349
+ },
2350
+ defaultVariants: { state: "idle" }
2351
+ }
2352
+ );
2353
+ function Zr({
2354
+ services: e,
2355
+ selectedServiceId: t,
2356
+ onSelect: s,
2357
+ showDuration: i
2358
+ }) {
2359
+ const { t: r } = Q("ui"), a = Kn(), c = at(), [l, m] = H(() => {
2360
+ if (t) {
2361
+ const h = e.findIndex((d) => d.id === t);
2362
+ if (h >= 0) return h;
2363
+ }
2364
+ return 0;
2365
+ }), p = M(/* @__PURE__ */ new Map()), f = ye((h) => {
2366
+ var d;
2367
+ (d = p.current.get(h)) == null || d.focus();
2368
+ }, []), v = ye(
2369
+ (h, d, g) => {
2370
+ const I = e.length;
2371
+ if (I !== 0)
2372
+ switch (h.key) {
2373
+ case "ArrowDown":
2374
+ case "ArrowRight": {
2375
+ h.preventDefault();
2376
+ const u = (d + 1) % I;
2377
+ m(u), f(u);
2378
+ break;
2379
+ }
2380
+ case "ArrowUp":
2381
+ case "ArrowLeft": {
2382
+ h.preventDefault();
2383
+ const u = (d - 1 + I) % I;
2384
+ m(u), f(u);
2385
+ break;
2386
+ }
2387
+ case "Home": {
2388
+ h.preventDefault(), m(0), f(0);
2389
+ break;
2390
+ }
2391
+ case "End": {
2392
+ h.preventDefault();
2393
+ const u = I - 1;
2394
+ m(u), f(u);
2395
+ break;
2396
+ }
2397
+ case "Enter":
2398
+ case " ": {
2399
+ h.preventDefault(), s(g);
2400
+ break;
2401
+ }
2402
+ }
2403
+ },
2404
+ [e.length, f, s]
2405
+ );
2406
+ return e.length === 0 ? null : /* @__PURE__ */ n(
2407
+ "div",
2408
+ {
2409
+ role: "radiogroup",
2410
+ "aria-label": r("booking.serviceListLabel"),
2411
+ id: c,
2412
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
2413
+ children: e.map((h, d) => {
2414
+ const g = t === h.id, I = l === d, { price: u, payment: F, paymentTone: N } = a(h), w = u ? F ? r("booking.serviceCardLabelPayment", {
2415
+ label: h.label,
2416
+ price: u,
2417
+ payment: F
2418
+ }) : r("booking.serviceCardLabelPrice", {
2419
+ label: h.label,
2420
+ price: u
2421
+ }) : F ? r("booking.serviceCardLabelPaymentNoPrice", {
2422
+ label: h.label,
2423
+ payment: F
2424
+ }) : i ? r("booking.serviceCardLabel", {
2425
+ label: h.label,
2426
+ duration: h.durationMin
2427
+ }) : h.label, x = Hr(h);
2428
+ return /* @__PURE__ */ k(
2429
+ "button",
2430
+ {
2431
+ ref: (A) => {
2432
+ A ? p.current.set(d, A) : p.current.delete(d);
2433
+ },
2434
+ type: "button",
2435
+ role: "radio",
2436
+ "aria-checked": g,
2437
+ "aria-label": w,
2438
+ tabIndex: I ? 0 : -1,
2439
+ onClick: () => s(h.id),
2440
+ onFocus: () => m(d),
2441
+ onKeyDown: (A) => v(A, d, h.id),
2442
+ className: Yr({
2443
+ state: g ? "selected" : "idle"
2444
+ }),
2445
+ children: [
2446
+ /* @__PURE__ */ n(
2447
+ "span",
2448
+ {
2449
+ "aria-hidden": "true",
2450
+ 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)]",
2451
+ children: x
2452
+ }
2453
+ ),
2454
+ /* @__PURE__ */ k("span", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
2455
+ /* @__PURE__ */ n(
2456
+ "span",
2457
+ {
2458
+ dir: "auto",
2459
+ className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:break-words",
2460
+ children: h.label
2461
+ }
2462
+ ),
2463
+ F ? /* @__PURE__ */ n(
2464
+ "span",
2465
+ {
2466
+ className: gs({ tone: N }),
2467
+ children: F
2468
+ }
2469
+ ) : u || !i ? null : /* @__PURE__ */ n("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: r("booking.serviceSummary", {
2470
+ minutes: h.durationMin
2471
+ }) })
2472
+ ] }),
2473
+ u ? /* @__PURE__ */ n(
2474
+ "span",
2475
+ {
2476
+ "aria-hidden": "true",
2477
+ className: "ds:inline-flex ds:shrink-0 ds:items-center ds:ms-auto",
2478
+ children: /* @__PURE__ */ n(An, { variant: "accentSoft", size: "lg", children: u })
2479
+ }
2480
+ ) : null
2481
+ ]
2482
+ },
2483
+ h.id
2484
+ );
2485
+ })
2486
+ }
2487
+ );
2488
+ }
2489
+ const Xr = Tt(
2490
+ [
2491
+ "ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-2xs)]",
2492
+ "ds:min-h-[var(--min-target-size)]",
2493
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
2494
+ "ds:pt-[var(--spacing-2xs)] ds:pb-[var(--spacing-2xs)]",
2495
+ "ds:rounded-[var(--radius-md)]",
2496
+ "ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-medium)]",
2497
+ "ds:transition-[background-color,color,box-shadow] ds:duration-[var(--animation-duration)]",
2498
+ "ds:motion-reduce:transition-none",
2499
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
2500
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
2501
+ "ds:disabled:cursor-not-allowed ds:disabled:opacity-50",
2502
+ "ds:forced-colors:[border:1px_solid_ButtonText] ds:forced-colors:text-[ButtonText]"
2503
+ ].join(" "),
2504
+ {
2505
+ variants: {
2506
+ state: {
2507
+ 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)]",
2508
+ selected: "ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:shadow-[var(--shadow-sm)]",
2509
+ unavailable: "ds:[outline:1px_dashed_color:var(--border)] ds:[outline-offset:-1px] ds:bg-transparent ds:text-[color:var(--muted-foreground)]"
2510
+ }
2511
+ },
2512
+ defaultVariants: { state: "idle" }
2513
+ }
2514
+ );
2515
+ function Qr(e) {
2516
+ const [t] = e.split(":").map((i) => parseInt(i, 10)), s = Number.isFinite(t) ? t : 0;
2517
+ return s < 12 ? "morning" : s < 17 ? "afternoon" : "evening";
2518
+ }
2519
+ function Jt(e, t, s) {
2520
+ if (!e) return t;
2521
+ try {
2522
+ return new Intl.DateTimeFormat(s, {
2523
+ hour: "numeric",
2524
+ minute: "2-digit"
2525
+ }).format(/* @__PURE__ */ new Date(`${e}T${t}:00`));
2526
+ } catch {
2527
+ return t;
2528
+ }
2529
+ }
2530
+ const ei = {
2531
+ morning: Cs,
2532
+ afternoon: Qs,
2533
+ evening: ws
2534
+ };
2535
+ function ti({
2536
+ date: e,
2537
+ slots: t,
2538
+ selectedSlotKey: s,
2539
+ onSelect: i,
2540
+ loading: r,
2541
+ locale: a
2542
+ }) {
2543
+ const { t: c } = Q("ui"), l = q(() => {
2544
+ try {
2545
+ return new Intl.DateTimeFormat(a, {
2546
+ weekday: "long",
2547
+ day: "numeric",
2548
+ month: "long"
2549
+ }).format(he(e));
2550
+ } catch {
2551
+ return e;
2552
+ }
2553
+ }, [e, a]), m = q(() => {
2554
+ const v = {
2555
+ morning: [],
2556
+ afternoon: [],
2557
+ evening: []
2558
+ };
2559
+ for (const h of t)
2560
+ v[Qr(h.time)].push(h);
2561
+ return v;
2562
+ }, [t]), p = t.filter((v) => v.available).length, f = ["morning", "afternoon", "evening"];
2563
+ return r ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2564
+ /* @__PURE__ */ n(Gt, { variant: "text", width: "60%" }),
2565
+ [0, 1].map((v) => /* @__PURE__ */ n(
2566
+ "div",
2567
+ {
2568
+ className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)]",
2569
+ children: [0, 1, 2].map((h) => /* @__PURE__ */ n(Gt, { variant: "rounded", height: "44px" }, h))
2570
+ },
2571
+ v
2572
+ ))
2573
+ ] }) : p === 0 ? /* @__PURE__ */ n(Dn, { variant: "no-results", title: c("booking.noSlotsForDate") }) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2574
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:items-baseline ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
2575
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
2576
+ /* @__PURE__ */ n(
2577
+ qs,
2578
+ {
2579
+ "aria-hidden": "true",
2580
+ className: "ds:size-4 ds:text-[color:var(--accent)]"
2581
+ }
2582
+ ),
2583
+ /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: l })
2584
+ ] }),
2585
+ /* @__PURE__ */ n("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: c("booking.slotsAvailable", { count: p }) })
2586
+ ] }),
2587
+ f.map((v) => {
2588
+ const h = m[v];
2589
+ if (h.length === 0) return null;
2590
+ const d = ei[v];
2591
+ return /* @__PURE__ */ k(
2592
+ "div",
2593
+ {
2594
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
2595
+ children: [
2596
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
2597
+ /* @__PURE__ */ n(d, { "aria-hidden": "true", className: "ds:size-3.5" }),
2598
+ /* @__PURE__ */ n("span", { className: "type-meta ds:font-[var(--font-weight-semibold)] ds:uppercase", children: c(`booking.timeOfDay.${v}`) })
2599
+ ] }),
2600
+ /* @__PURE__ */ n(
2601
+ "div",
2602
+ {
2603
+ role: "group",
2604
+ "aria-label": c(`booking.timeOfDay.${v}`),
2605
+ className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)] ds:sm:grid-cols-4",
2606
+ children: h.map((g) => {
2607
+ const I = g.key === s, u = g.available ? I ? "selected" : "idle" : "unavailable";
2608
+ return /* @__PURE__ */ n(
2609
+ "button",
2610
+ {
2611
+ type: "button",
2612
+ "data-slot-id": g.key,
2613
+ disabled: !g.available,
2614
+ "aria-pressed": I,
2615
+ "aria-label": c("booking.slotAvailableLabel", {
2616
+ time: Jt(e, g.time, a)
2617
+ }),
2618
+ onClick: () => g.available && i(g),
2619
+ className: Xr({ state: u }),
2620
+ children: Jt(e, g.time, a)
2621
+ },
2622
+ g.key
2623
+ );
2624
+ })
2625
+ }
2626
+ )
2627
+ ]
2628
+ },
2629
+ v
2630
+ );
2631
+ })
2632
+ ] });
2633
+ }
2634
+ const Ut = 4;
2635
+ function ni({
2636
+ availableDates: e,
2637
+ availableSlots: t,
2638
+ value: s,
2639
+ onChange: i,
2640
+ onDateSelect: r,
2641
+ onWindowChange: a,
2642
+ loadingDates: c,
2643
+ loadingSlots: l,
2644
+ locale: m,
2645
+ agentIdBase: p
2646
+ }) {
2647
+ const f = q(() => vt(/* @__PURE__ */ new Date()), []), [v, h] = H(() => {
2648
+ if (s.date) {
2649
+ const b = vt(he(s.date));
2650
+ if (!bt(f, b)) return b;
2651
+ }
2652
+ if (e.length > 0) {
2653
+ const b = vt(he(e[0]));
2654
+ if (bt(b, f)) return b;
2655
+ }
2656
+ return f;
2657
+ }), d = q(
2658
+ () => nn(v, Ut - 1),
2659
+ [v]
2660
+ ), g = q(() => Array.from({ length: Ut }, (b, C) => {
2661
+ const V = nn(v, C), D = ot(V), P = (t[D] ?? []).map((O) => ({
2662
+ id: O.key,
2663
+ // SlotGrid formats `start` as a time via Intl.DateTimeFormat —
2664
+ // compose a full ISO from the column's date + the slot's HH:mm
2665
+ // so the locale-formatter has a real timestamp to work with.
2666
+ start: `${D}T${O.time}:00`,
2667
+ available: O.available
2668
+ }));
2669
+ return { date: D, slots: P };
2670
+ }), [v, t]), I = bt(v, f), u = !0, F = ye(() => {
2671
+ h((b) => {
2672
+ const C = xs(b, Ut);
2673
+ return bt(f, C) ? f : C;
2674
+ });
2675
+ }, [f]), N = ye(() => {
2676
+ h((b) => nn(b, Ut));
2677
+ }, []);
2678
+ z(() => {
2679
+ if (e.length === 0) return;
2680
+ const b = vt(he(e[0]));
2681
+ !bt(b, f) || e.some((V) => {
2682
+ const D = vt(he(V));
2683
+ return !bt(D, d) && !ks(D, v);
2684
+ }) || h(b);
2685
+ }, [e]), z(() => {
2686
+ a == null || a(ot(v), ot(d));
2687
+ }, [v, d, a]);
2688
+ const w = ye(
2689
+ (b, C) => {
2690
+ const V = typeof C.date == "string" ? C.date : ot(C.date);
2691
+ i({
2692
+ ...Pn(Zt(s, V), b.id)
2693
+ }), r == null || r(V);
2694
+ },
2695
+ [i, r, s]
2696
+ ), x = c || l ? "loading" : "default", A = g.some((b) => b.slots.length > 0), _ = e[0];
2697
+ return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2698
+ x !== "loading" && !A && !!_ ? /* @__PURE__ */ n(
2699
+ mn,
2700
+ {
2701
+ nextAvailableDate: _,
2702
+ onJump: () => h(vt(he(_))),
2703
+ locale: m
2704
+ }
2705
+ ) : null,
2706
+ /* @__PURE__ */ n(
2707
+ bs,
2708
+ {
2709
+ id: p ? `${p}-slots` : void 0,
2710
+ days: g,
2711
+ state: x,
2712
+ selectedSlotId: s.slotKey,
2713
+ maxInitialSlotsPerDay: 6,
2714
+ locale: m,
2715
+ hasPrevious: I,
2716
+ hasNext: u,
2717
+ onSlotSelect: w,
2718
+ onPreviousDays: F,
2719
+ onNextDays: N
2720
+ }
2721
+ )
2722
+ ] });
2723
+ }
2724
+ function jn(e) {
2725
+ const {
2726
+ inputs: t,
2727
+ value: s,
2728
+ onChange: i,
2729
+ onDateSelect: r,
2730
+ onWindowChange: a,
2731
+ loadingDates: c,
2732
+ loadingSlots: l,
2733
+ locale: m,
2734
+ datePickerStyle: p,
2735
+ agentIdBase: f
2736
+ } = e;
2737
+ return p === "four-day-grid" ? /* @__PURE__ */ n(
2738
+ ni,
2739
+ {
2740
+ availableDates: t.availableDates,
2741
+ availableSlots: t.availableSlots,
2742
+ value: s,
2743
+ onChange: i,
2744
+ onDateSelect: r,
2745
+ onWindowChange: a,
2746
+ loadingDates: c,
2747
+ loadingSlots: l,
2748
+ locale: m,
2749
+ agentIdBase: f
2750
+ }
2751
+ ) : /* @__PURE__ */ n(
2752
+ Wr,
2753
+ {
2754
+ availableDates: t.availableDates,
2755
+ selectedDate: s.date,
2756
+ onSelectDate: (v) => {
2757
+ i(Zt(s, v)), r == null || r(v);
2758
+ },
2759
+ locale: m,
2760
+ loading: c ?? l
2761
+ }
2762
+ );
2763
+ }
2764
+ function Un(e) {
2765
+ const { inputs: t, value: s, onChange: i, loadingSlots: r, locale: a, datePickerStyle: c } = e;
2766
+ return c === "four-day-grid" || !s.date ? null : /* @__PURE__ */ n(
2767
+ ti,
2768
+ {
2769
+ date: s.date,
2770
+ slots: t.availableSlots[s.date] ?? [],
2771
+ selectedSlotKey: s.slotKey,
2772
+ onSelect: (l) => i(Pn(s, l.key)),
2773
+ loading: r,
2774
+ locale: a
2775
+ }
2776
+ );
2777
+ }
2778
+ function Hn({ value: e, onChange: t }) {
2779
+ const { t: s } = Q("ui"), i = [
2780
+ { value: "private", label: s("booking.insurance.private") },
2781
+ { value: "public", label: s("booking.insurance.public") }
2782
+ ];
2783
+ return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2784
+ /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: s("booking.insurance.heading") }),
2785
+ /* @__PURE__ */ n(
2786
+ Yt,
2787
+ {
2788
+ options: i,
2789
+ value: e ?? "",
2790
+ onValueChange: (r) => {
2791
+ (r === "private" || r === "public") && t(r);
2792
+ },
2793
+ placeholder: s("booking.insurance.placeholder"),
2794
+ "aria-label": s("booking.insurance.heading")
2795
+ }
2796
+ )
2797
+ ] });
2798
+ }
2799
+ function Gn({
2800
+ specialties: e,
2801
+ value: t,
2802
+ valueIds: s,
2803
+ onChange: i,
2804
+ onChangeIds: r,
2805
+ pickerStyle: a = "select"
2806
+ }) {
2807
+ const { t: c } = Q("ui"), l = e.map((p) => ({
2808
+ value: p.id,
2809
+ label: p.label,
2810
+ dir: "auto"
2811
+ })), m = /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: c("booking.specialty.heading") });
2812
+ return a === "multi-select" && r ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2813
+ m,
2814
+ /* @__PURE__ */ n(
2815
+ dn,
2816
+ {
2817
+ options: l,
2818
+ value: s ?? [],
2819
+ onChange: r,
2820
+ placeholder: c("booking.specialty.placeholder"),
2821
+ "aria-label": c("booking.specialty.heading"),
2822
+ allowClear: !0
2823
+ }
2824
+ )
2825
+ ] }) : a === "combobox" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2826
+ m,
2827
+ /* @__PURE__ */ n(
2828
+ cn,
2829
+ {
2830
+ options: l,
2831
+ value: t ?? "",
2832
+ onValueChange: (p) => i(p === "" ? "" : p),
2833
+ placeholder: c("booking.specialty.placeholder"),
2834
+ "aria-label": c("booking.specialty.heading"),
2835
+ clearable: !0
2836
+ }
2837
+ )
2838
+ ] }) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2839
+ m,
2840
+ /* @__PURE__ */ n(
2841
+ Yt,
2842
+ {
2843
+ options: l,
2844
+ value: t ?? "",
2845
+ onValueChange: (p) => i(p),
2846
+ placeholder: c("booking.specialty.placeholder"),
2847
+ "aria-label": c("booking.specialty.heading")
2848
+ }
2849
+ )
2850
+ ] });
2851
+ }
2852
+ function Jn({
2853
+ services: e,
2854
+ value: t,
2855
+ valueIds: s,
2856
+ onChange: i,
2857
+ onChangeIds: r,
2858
+ pickerStyle: a,
2859
+ compact: c,
2860
+ showDuration: l
2861
+ }) {
2862
+ const { t: m } = Q("ui"), p = Kn(), f = a ?? (c ? "select" : "cards"), v = e.map((d) => {
2863
+ const { price: g, payment: I, paymentTone: u } = p(d);
2864
+ return {
2865
+ value: d.id,
2866
+ // The practice's service name leads the label, so it decides the
2867
+ // direction, even when the kit's duration is appended after it.
2868
+ dir: "auto",
2869
+ label: g || I || !l ? d.label : `${d.label} · ${m("booking.serviceSummary", {
2870
+ minutes: d.durationMin
2871
+ })}`,
2872
+ ...g ? {
2873
+ endContent: /* @__PURE__ */ n(An, { variant: "accentSoft", size: "lg", children: g })
2874
+ } : {},
2875
+ ...I ? { description: I, descriptionTone: u } : {}
2876
+ };
2877
+ }), h = /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: m("booking.service.heading") });
2878
+ return f === "multi-select" && r ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2879
+ h,
2880
+ /* @__PURE__ */ n(
2881
+ dn,
2882
+ {
2883
+ options: v,
2884
+ value: s ?? [],
2885
+ onChange: r,
2886
+ placeholder: m("booking.service.placeholder"),
2887
+ "aria-label": m("booking.service.heading"),
2888
+ allowClear: !0,
2889
+ wrapOptionLabels: !0
2890
+ }
2891
+ )
2892
+ ] }) : f === "combobox" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2893
+ h,
2894
+ /* @__PURE__ */ n(
2895
+ cn,
2896
+ {
2897
+ options: v,
2898
+ value: t ?? "",
2899
+ onValueChange: (d) => i(d === "" ? "" : d),
2900
+ placeholder: m("booking.service.placeholder"),
2901
+ "aria-label": m("booking.service.heading"),
2902
+ clearable: !0,
2903
+ wrapOptionLabels: !0
2904
+ }
2905
+ )
2906
+ ] }) : f === "select" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2907
+ h,
2908
+ /* @__PURE__ */ n(
2909
+ Yt,
2910
+ {
2911
+ options: v,
2912
+ value: t ?? "",
2913
+ onValueChange: (d) => i(d),
2914
+ placeholder: m("booking.service.placeholder"),
2915
+ "aria-label": m("booking.service.heading"),
2916
+ showDescriptions: !0,
2917
+ descriptionInName: !0,
2918
+ wrapOptionLabels: !0
2919
+ }
2920
+ )
2921
+ ] }) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2922
+ h,
2923
+ /* @__PURE__ */ n(
2924
+ Zr,
2925
+ {
2926
+ services: e,
2927
+ selectedServiceId: t,
2928
+ onSelect: i,
2929
+ showDuration: l
2930
+ }
2931
+ )
2932
+ ] });
2933
+ }
2934
+ function Wn({
2935
+ operators: e,
2936
+ value: t,
2937
+ valueIds: s,
2938
+ onChange: i,
2939
+ onChangeIds: r,
2940
+ pickerStyle: a = "select"
2941
+ }) {
2942
+ const { t: c } = Q("ui"), l = /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: c("booking.operator.heading") });
2943
+ if (a === "multi-select" && r) {
2944
+ const p = e.map((f) => ({
2945
+ value: f.id,
2946
+ label: f.name,
2947
+ dir: "auto"
2948
+ }));
2949
+ return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2950
+ l,
2951
+ /* @__PURE__ */ n(
2952
+ dn,
2953
+ {
2954
+ options: p,
2955
+ value: s ?? [],
2956
+ onChange: r,
2957
+ placeholder: c("booking.operator.all"),
2958
+ "aria-label": c("booking.operator.heading"),
2959
+ allowClear: !0
2960
+ }
2961
+ )
2962
+ ] });
2963
+ }
2964
+ const m = [
2965
+ { value: Ee, label: c("booking.operator.all") },
2966
+ ...e.map(
2967
+ (p) => ({ value: p.id, label: p.name, dir: "auto" })
2968
+ )
2969
+ ];
2970
+ return a === "combobox" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2971
+ l,
2972
+ /* @__PURE__ */ n(
2973
+ cn,
2974
+ {
2975
+ options: m,
2976
+ value: t ?? Ee,
2977
+ onValueChange: (p) => i(p === "" ? Ee : p),
2978
+ placeholder: c("booking.operator.placeholder"),
2979
+ "aria-label": c("booking.operator.heading"),
2980
+ clearable: !0
2981
+ }
2982
+ )
2983
+ ] }) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2984
+ l,
2985
+ /* @__PURE__ */ n(
2986
+ Yt,
2987
+ {
2988
+ options: m,
2989
+ value: t ?? Ee,
2990
+ onValueChange: (p) => i(p),
2991
+ placeholder: c("booking.operator.placeholder"),
2992
+ "aria-label": c("booking.operator.heading")
2993
+ }
2994
+ )
2995
+ ] });
2996
+ }
2997
+ function Yn({
2998
+ customSlot: e
2999
+ }) {
3000
+ const { t } = Q("ui");
3001
+ return e ? /* @__PURE__ */ n(oe, { children: e }) : /* @__PURE__ */ k(ae, { variant: "warning", children: [
3002
+ /* @__PURE__ */ n(ae.Title, { as: "h4", children: t("booking.onboardingIncomplete.title") }),
3003
+ /* @__PURE__ */ n(ae.Description, { children: t("booking.onboardingIncomplete.description") })
3004
+ ] });
3005
+ }
3006
+ function mn({
3007
+ nextAvailableDate: e,
3008
+ onJump: t,
3009
+ locale: s
3010
+ }) {
3011
+ const { t: i } = Q("ui"), r = q(() => {
3012
+ try {
3013
+ return new Intl.DateTimeFormat(s, { dateStyle: "long" }).format(
3014
+ he(e)
3015
+ );
3016
+ } catch {
3017
+ return e;
3018
+ }
3019
+ }, [e, s]);
3020
+ return /* @__PURE__ */ k(ae, { variant: "info", children: [
3021
+ /* @__PURE__ */ n(ae.Description, { children: i("booking.nextAvailable.description", { date: r }) }),
3022
+ /* @__PURE__ */ n(ae.Action, { children: /* @__PURE__ */ n(Ne, { intent: "secondary", size: "sm", onClick: t, children: i("booking.nextAvailable.cta") }) })
3023
+ ] });
3024
+ }
3025
+ function si({
3026
+ codeVerified: e = !1,
3027
+ handoverUrl: t,
3028
+ handoverDelayMs: s,
3029
+ onNavigate: i,
3030
+ payment: r,
3031
+ confirmationChannels: a,
3032
+ snapshot: c,
3033
+ operators: l,
3034
+ specialties: m,
3035
+ services: p,
3036
+ locale: f,
3037
+ mode: v,
3038
+ showModify: h,
3039
+ onReset: d,
3040
+ onModify: g,
3041
+ focusWasLost: I
3042
+ }) {
3043
+ const { t: u } = Q("ui"), F = M(null);
3044
+ z(() => {
3045
+ const D = F.current, B = document.activeElement, P = D == null ? void 0 : D.closest('[data-component="booking"]');
3046
+ !r && !e || !D || (B && (P != null && P.contains(B)) || I()) && D.focus();
3047
+ }, []);
3048
+ const N = ln(a), x = $n(
3049
+ N,
3050
+ c.details.confirmationChannels
3051
+ ).map(
3052
+ (D) => u(`booking.confirmation.channel.${D}`)
3053
+ ), A = r ? Wt(r.amountCents, r.currencyCode, f) : "", _ = r ? u(
3054
+ v === "demo" ? "booking.payment.paidDemo" : "booking.payment.paidBody",
3055
+ { amount: A }
3056
+ ) : e ? u(v === "demo" ? "booking.code.confirmedDemo" : "booking.code.confirmedBody") : v === "demo" ? u("booking.success.descriptionDemo") : x.length > 1 ? u("booking.success.descriptionMultiple", {
3057
+ channels: x.join(" · ")
3058
+ }) : u("booking.success.descriptionSingle", {
3059
+ channel: x[0]
3060
+ }), R = q(() => {
3061
+ if (c.date)
3062
+ try {
3063
+ return new Intl.DateTimeFormat(f, {
3064
+ weekday: "long",
3065
+ day: "numeric",
3066
+ month: "long"
3067
+ }).format(he(c.date));
3068
+ } catch {
3069
+ return c.date;
3070
+ }
3071
+ }, [c.date, f]), b = q(() => {
3072
+ const B = (c.operatorIds && c.operatorIds.length > 0 ? c.operatorIds : c.operatorId ? [c.operatorId] : []).filter((P) => P !== Ee).map((P) => {
3073
+ var O;
3074
+ return (O = l.find((y) => y.id === P)) == null ? void 0 : O.name;
3075
+ }).filter((P) => P !== void 0);
3076
+ if (B.length === 0) return [];
3077
+ try {
3078
+ return new Intl.ListFormat(f === "en" ? "en-GB" : f, {
3079
+ style: "long",
3080
+ type: "conjunction"
3081
+ }).formatToParts(B);
3082
+ } catch {
3083
+ return B.flatMap((P, O) => [
3084
+ ...O > 0 ? [{ type: "literal", value: ", " }] : [],
3085
+ { type: "element", value: P }
3086
+ ]);
3087
+ }
3088
+ }, [c.operatorIds, c.operatorId, l, f]), C = c.specialtyId ? m.find((D) => D.id === c.specialtyId) : void 0, V = c.serviceId ? p.find((D) => D.id === c.serviceId) : void 0;
3089
+ if (t) {
3090
+ let D;
3091
+ if (c.date)
3092
+ try {
3093
+ D = new Intl.DateTimeFormat(f, {
3094
+ weekday: "short",
3095
+ day: "numeric",
3096
+ month: "short"
3097
+ }).format(he(c.date));
3098
+ } catch {
3099
+ D = c.date;
3100
+ }
3101
+ const B = (V == null ? void 0 : V.label) ?? (C == null ? void 0 : C.label), P = b.map(
3102
+ (O, y) => O.type === "element" ? /* @__PURE__ */ n("bdi", { children: O.value }, y) : O.value
3103
+ );
3104
+ return /* @__PURE__ */ n(
3105
+ Pr,
3106
+ {
3107
+ url: t,
3108
+ delayMs: zr(s),
3109
+ onNavigate: i,
3110
+ date: D,
3111
+ time: Jt(c.date, c.slot.time, f),
3112
+ details: B || P.length > 0 ? /* @__PURE__ */ k(oe, { children: [
3113
+ B ? /* @__PURE__ */ n("bdi", { children: B }) : null,
3114
+ B && P.length > 0 ? " · " : null,
3115
+ P
3116
+ ] }) : void 0,
3117
+ shouldTakeFocus: (O) => {
3118
+ const y = document.activeElement, X = O.closest('[data-component="booking"]');
3119
+ return !!(y && (X != null && X.contains(y)) || I());
3120
+ }
3121
+ }
3122
+ );
3123
+ }
3124
+ return /* @__PURE__ */ k(
3125
+ "div",
3126
+ {
3127
+ "data-component": "booking-success",
3128
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
3129
+ children: [
3130
+ /* @__PURE__ */ k(ae, { variant: "success", children: [
3131
+ /* @__PURE__ */ n(
3132
+ ae.Title,
3133
+ {
3134
+ as: "h3",
3135
+ ref: F,
3136
+ tabIndex: r || e ? -1 : void 0,
3137
+ className: r || e ? yt : void 0,
3138
+ children: u(
3139
+ r ? v === "demo" ? "booking.payment.paidDemoTitle" : "booking.payment.paidTitle" : e ? "booking.code.confirmedHeading" : "booking.success.heading"
3140
+ )
3141
+ }
3142
+ ),
3143
+ /* @__PURE__ */ n(ae.Description, { children: _ })
3144
+ ] }),
3145
+ /* @__PURE__ */ n("div", { className: "ds:rounded-[var(--radius-md)] ds:bg-[var(--secondary)] ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ k("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: [
3146
+ r && v !== "demo" ? /* @__PURE__ */ k(oe, { children: [
3147
+ /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: u("booking.payment.summaryPaid") }),
3148
+ /* @__PURE__ */ n("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: A })
3149
+ ] }) : null,
3150
+ C ? /* @__PURE__ */ k(oe, { children: [
3151
+ /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: u("booking.success.summarySpecialty") }),
3152
+ /* @__PURE__ */ n(
3153
+ "dd",
3154
+ {
3155
+ dir: "auto",
3156
+ className: "type-body ds:m-0 ds:text-[var(--foreground)]",
3157
+ children: C.label
3158
+ }
3159
+ )
3160
+ ] }) : null,
3161
+ V ? /* @__PURE__ */ k(oe, { children: [
3162
+ /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: u("booking.success.summaryService") }),
3163
+ /* @__PURE__ */ n(
3164
+ "dd",
3165
+ {
3166
+ dir: "auto",
3167
+ className: "type-body ds:m-0 ds:text-[var(--foreground)]",
3168
+ children: V.label
3169
+ }
3170
+ )
3171
+ ] }) : null,
3172
+ R ? /* @__PURE__ */ k(oe, { children: [
3173
+ /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: u("booking.success.summaryDate") }),
3174
+ /* @__PURE__ */ n("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: R })
3175
+ ] }) : null,
3176
+ /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: u("booking.success.summaryTime") }),
3177
+ /* @__PURE__ */ n("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: Jt(c.date, c.slot.time, f) }),
3178
+ b.length > 0 ? /* @__PURE__ */ k(oe, { children: [
3179
+ /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: u("booking.success.summaryProvider") }),
3180
+ /* @__PURE__ */ n("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: b.map(
3181
+ (D, B) => D.type === "element" ? /* @__PURE__ */ n("bdi", { children: D.value }, B) : D.value
3182
+ ) })
3183
+ ] }) : null
3184
+ ] }) }),
3185
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
3186
+ /* @__PURE__ */ n(Ne, { intent: "secondary", size: "md", onClick: d, children: u("booking.success.bookAnother") }),
3187
+ h ? /* @__PURE__ */ n(Ne, { intent: "ghost", size: "md", onClick: g, children: u("booking.success.modifyBooking") }) : null
3188
+ ] })
3189
+ ]
3190
+ }
3191
+ );
3192
+ }
3193
+ function Zn({ customSlot: e }) {
3194
+ const { t } = Q("ui");
3195
+ return e ? /* @__PURE__ */ n(oe, { children: e }) : /* @__PURE__ */ n(
3196
+ Dn,
3197
+ {
3198
+ variant: "no-results",
3199
+ title: t("booking.emptyServices.title"),
3200
+ description: t("booking.emptyServices.description")
3201
+ }
3202
+ );
3203
+ }
3204
+ const Xn = "data-booking-step-active", ri = `[${Xn}]`;
3205
+ function ie({
3206
+ step: e,
3207
+ active: t,
3208
+ className: s,
3209
+ id: i,
3210
+ children: r
3211
+ }) {
3212
+ return /* @__PURE__ */ n(
3213
+ "div",
3214
+ {
3215
+ id: i,
3216
+ "data-booking-step": String(e),
3217
+ ...t ? { [Xn]: "" } : null,
3218
+ tabIndex: -1,
3219
+ className: s ? `${s} ${yt}` : yt,
3220
+ children: r
3221
+ }
3222
+ );
3223
+ }
3224
+ function pn(e, t) {
3225
+ return t === "four-day-grid" ? e.filter((s) => s !== 6) : e;
3226
+ }
3227
+ function ii(e) {
3228
+ const {
3229
+ cascade: t,
3230
+ inputs: s,
3231
+ value: i,
3232
+ onChange: r,
3233
+ onSubmit: a,
3234
+ emptyServicesSlot: c,
3235
+ onboardingIncompleteSlot: l,
3236
+ loadingDates: m,
3237
+ loadingSlots: p,
3238
+ onDateSelect: f,
3239
+ onWindowChange: v,
3240
+ datePickerStyle: h,
3241
+ specialtyPickerStyle: d,
3242
+ servicePickerStyle: g,
3243
+ showServiceDuration: I,
3244
+ operatorPickerStyle: u,
3245
+ submitting: F,
3246
+ locale: N,
3247
+ detailsProps: w,
3248
+ agentIdBase: x,
3249
+ activeStep: A
3250
+ } = e, { t: _ } = Q("ui"), R = kt(A, h), b = (C, V) => ({
3251
+ step: C,
3252
+ active: C === R,
3253
+ className: V
3254
+ });
3255
+ return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3256
+ t.gates.insurance ? /* @__PURE__ */ n(ie, { ...b(1), children: /* @__PURE__ */ n(
3257
+ Hn,
3258
+ {
3259
+ value: i.insuranceType,
3260
+ onChange: (C) => r(Mn(i, C))
3261
+ }
3262
+ ) }) : null,
3263
+ t.gates.specialty ? /* @__PURE__ */ n(ie, { ...b(2), children: /* @__PURE__ */ n(
3264
+ Gn,
3265
+ {
3266
+ specialties: t.filtered.specialties,
3267
+ value: i.specialtyId,
3268
+ valueIds: i.specialtyIds,
3269
+ onChange: (C) => r(En(i, C)),
3270
+ onChangeIds: (C) => r(Fn(i, C)),
3271
+ pickerStyle: d
3272
+ }
3273
+ ) }) : null,
3274
+ t.gates.service ? /* @__PURE__ */ n(ie, { ...b(3), children: t.filtered.services.length === 0 ? /* @__PURE__ */ n(Zn, { customSlot: c }) : /* @__PURE__ */ n(
3275
+ Jn,
3276
+ {
3277
+ services: t.filtered.services,
3278
+ value: i.serviceId,
3279
+ valueIds: i.serviceIds,
3280
+ onChange: (C) => r(_n(i, C)),
3281
+ onChangeIds: (C) => r(Rn(i, C)),
3282
+ pickerStyle: g,
3283
+ showDuration: I
3284
+ }
3285
+ ) }) : null,
3286
+ t.gates.onboardingIncomplete ? /* @__PURE__ */ n(Yn, { customSlot: l }) : null,
3287
+ t.gates.operator ? /* @__PURE__ */ n(ie, { ...b(4), children: /* @__PURE__ */ n(
3288
+ Wn,
3289
+ {
3290
+ operators: t.filtered.operators,
3291
+ value: i.operatorId,
3292
+ valueIds: i.operatorIds,
3293
+ onChange: (C) => r(Ln(i, C)),
3294
+ onChangeIds: (C) => r(Bn(i, C)),
3295
+ pickerStyle: u
3296
+ }
3297
+ ) }) : null,
3298
+ t.gates.date ? /* @__PURE__ */ k(
3299
+ ie,
3300
+ {
3301
+ ...b(5, "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"),
3302
+ children: [
3303
+ /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: _("booking.date.heading") }),
3304
+ s.availableDates.length === 0 && s.nextAvailableDate ? /* @__PURE__ */ n(
3305
+ mn,
3306
+ {
3307
+ nextAvailableDate: s.nextAvailableDate,
3308
+ onJump: () => r(Zt(i, s.nextAvailableDate)),
3309
+ locale: N
3310
+ }
3311
+ ) : jn({
3312
+ inputs: s,
3313
+ value: i,
3314
+ onChange: r,
3315
+ onDateSelect: f,
3316
+ onWindowChange: v,
3317
+ loadingDates: m,
3318
+ loadingSlots: p,
3319
+ locale: N,
3320
+ datePickerStyle: h,
3321
+ agentIdBase: x
3322
+ })
3323
+ ]
3324
+ }
3325
+ ) : null,
3326
+ t.gates.slot && i.date && h === "month-calendar" ? /* @__PURE__ */ k(
3327
+ ie,
3328
+ {
3329
+ ...b(6, "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"),
3330
+ children: [
3331
+ /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: _("booking.slot.heading") }),
3332
+ Un({
3333
+ inputs: s,
3334
+ value: i,
3335
+ onChange: r,
3336
+ loadingSlots: p,
3337
+ locale: N,
3338
+ datePickerStyle: h
3339
+ })
3340
+ ]
3341
+ }
3342
+ ) : null,
3343
+ t.gates.details && t.selectedSlot ? /* @__PURE__ */ n(ie, { ...b(7), children: /* @__PURE__ */ n(
3344
+ un,
3345
+ {
3346
+ ...w,
3347
+ value: i.details ?? {},
3348
+ onChange: (C) => r({ ...i, details: C }),
3349
+ onSubmit: a,
3350
+ submitting: F,
3351
+ defaultPhoneCountry: e.policy.country
3352
+ }
3353
+ ) }) : null
3354
+ ] });
3355
+ }
3356
+ function Ie(e, t, s = {}) {
3357
+ const {
3358
+ cascade: i,
3359
+ inputs: r,
3360
+ value: a,
3361
+ onChange: c,
3362
+ onSubmit: l,
3363
+ emptyServicesSlot: m,
3364
+ onboardingIncompleteSlot: p,
3365
+ loadingDates: f,
3366
+ loadingSlots: v,
3367
+ onDateSelect: h,
3368
+ onWindowChange: d,
3369
+ datePickerStyle: g,
3370
+ specialtyPickerStyle: I,
3371
+ servicePickerStyle: u,
3372
+ showServiceDuration: F,
3373
+ operatorPickerStyle: N,
3374
+ submitting: w,
3375
+ locale: x,
3376
+ detailsProps: A,
3377
+ policy: _,
3378
+ agentIdBase: R
3379
+ } = t;
3380
+ switch (e) {
3381
+ case 1:
3382
+ return /* @__PURE__ */ n(
3383
+ Hn,
3384
+ {
3385
+ value: a.insuranceType,
3386
+ onChange: (b) => c(Mn(a, b))
3387
+ }
3388
+ );
3389
+ case 2:
3390
+ return /* @__PURE__ */ n(
3391
+ Gn,
3392
+ {
3393
+ specialties: i.filtered.specialties,
3394
+ value: a.specialtyId,
3395
+ valueIds: a.specialtyIds,
3396
+ onChange: (b) => c(En(a, b)),
3397
+ onChangeIds: (b) => c(Fn(a, b)),
3398
+ pickerStyle: I
3399
+ }
3400
+ );
3401
+ case 3:
3402
+ return i.filtered.services.length === 0 ? /* @__PURE__ */ n(Zn, { customSlot: m }) : i.gates.onboardingIncomplete ? /* @__PURE__ */ n(Yn, { customSlot: p }) : /* @__PURE__ */ n(
3403
+ Jn,
3404
+ {
3405
+ services: i.filtered.services,
3406
+ value: a.serviceId,
3407
+ valueIds: a.serviceIds,
3408
+ onChange: (b) => c(_n(a, b)),
3409
+ onChangeIds: (b) => c(Rn(a, b)),
3410
+ pickerStyle: u,
3411
+ compact: s.compactService,
3412
+ showDuration: F
3413
+ }
3414
+ );
3415
+ case 4:
3416
+ return /* @__PURE__ */ n(
3417
+ Wn,
3418
+ {
3419
+ operators: i.filtered.operators,
3420
+ value: a.operatorId,
3421
+ valueIds: a.operatorIds,
3422
+ onChange: (b) => c(Ln(a, b)),
3423
+ onChangeIds: (b) => c(Bn(a, b)),
3424
+ pickerStyle: N
3425
+ }
3426
+ );
3427
+ case 5:
3428
+ return r.availableDates.length === 0 && r.nextAvailableDate ? /* @__PURE__ */ n(
3429
+ mn,
3430
+ {
3431
+ nextAvailableDate: r.nextAvailableDate,
3432
+ onJump: () => c(Zt(a, r.nextAvailableDate)),
3433
+ locale: x
3434
+ }
3435
+ ) : jn({
3436
+ inputs: r,
3437
+ value: a,
3438
+ onChange: c,
3439
+ onDateSelect: h,
3440
+ onWindowChange: d,
3441
+ loadingDates: f,
3442
+ loadingSlots: v,
3443
+ locale: x,
3444
+ datePickerStyle: g,
3445
+ agentIdBase: R
3446
+ });
3447
+ case 6:
3448
+ return Un({
3449
+ inputs: r,
3450
+ value: a,
3451
+ onChange: c,
3452
+ loadingSlots: v,
3453
+ locale: x,
3454
+ datePickerStyle: g
3455
+ });
3456
+ case 7:
3457
+ return i.selectedSlot ? /* @__PURE__ */ n(
3458
+ un,
3459
+ {
3460
+ ...A,
3461
+ value: a.details ?? {},
3462
+ onChange: (b) => c({ ...a, details: b }),
3463
+ onSubmit: l,
3464
+ submitting: w,
3465
+ defaultPhoneCountry: _.country
3466
+ }
3467
+ ) : null;
3468
+ /* c8 ignore next 2 */
3469
+ default:
3470
+ return null;
3471
+ }
3472
+ }
3473
+ function Xt() {
3474
+ const { t: e } = Q("ui");
3475
+ return q(
3476
+ () => ({
3477
+ 1: e("booking.insurance.heading"),
3478
+ 2: e("booking.specialty.heading"),
3479
+ 3: e("booking.service.heading"),
3480
+ 4: e("booking.operator.heading"),
3481
+ 5: e("booking.date.heading"),
3482
+ 6: e("booking.slot.heading"),
3483
+ 7: e("booking.details.heading")
3484
+ }),
3485
+ [e]
3486
+ );
3487
+ }
3488
+ function kt(e, t) {
3489
+ return t === "four-day-grid" && e === 6 ? 5 : e;
3490
+ }
3491
+ function oi(e) {
3492
+ const { cascade: t, value: s, activeStep: i, setActiveStep: r, datePickerStyle: a } = e, c = Xt(), { t: l } = Q("ui"), m = l("booking.operator.all"), p = q(
3493
+ () => pn(t.visibleSteps, a),
3494
+ [t.visibleSteps, a]
3495
+ ), f = kt(i, a), v = Math.max(0, p.indexOf(f)), h = q(
3496
+ () => p.map((d) => ({
3497
+ label: c[d],
3498
+ summary: Qn(d, s, t, m),
3499
+ status: ai(d, s, t),
3500
+ content: /* @__PURE__ */ n(ie, { step: d, active: d === f, children: Ie(d, e, { compactService: !0 }) })
3501
+ })),
3502
+ [
3503
+ p,
3504
+ s,
3505
+ c,
3506
+ t,
3507
+ e,
3508
+ f,
3509
+ m
3510
+ ]
3511
+ );
3512
+ return /* @__PURE__ */ n(
3513
+ hs,
3514
+ {
3515
+ activeStep: v,
3516
+ steps: h,
3517
+ onStepChange: (d) => {
3518
+ const g = p[d];
3519
+ g && r(g);
3520
+ }
3521
+ }
3522
+ );
3523
+ }
3524
+ function ai(e, t, s) {
3525
+ return ze(e, t) && e < s.currentStep ? "completed" : e <= s.currentStep ? "unlocked" : void 0;
3526
+ }
3527
+ function In(e, t) {
3528
+ return e !== 4 ? ze(e, t) : t.operatorIds && t.operatorIds.length > 0 ? !0 : Vn(t) !== void 0;
3529
+ }
3530
+ function rn(e, t) {
3531
+ const s = e.map((i) => {
3532
+ var r;
3533
+ return (r = t.find((a) => a.id === i)) == null ? void 0 : r.label;
3534
+ }).filter((i) => i !== void 0);
3535
+ return s.length > 0 ? s.join(", ") : void 0;
3536
+ }
3537
+ function Qn(e, t, s, i) {
3538
+ var r;
3539
+ if (ze(e, t))
3540
+ switch (e) {
3541
+ case 1:
3542
+ return t.insuranceType;
3543
+ case 2:
3544
+ return rn(
3545
+ Qe(t),
3546
+ s.filtered.specialties
3547
+ );
3548
+ case 3:
3549
+ return rn(Ke(t), s.filtered.services);
3550
+ case 4: {
3551
+ const c = an(t).filter((m) => m !== Ee), l = rn(
3552
+ c,
3553
+ s.filtered.operators.map((m) => ({
3554
+ id: m.id,
3555
+ label: m.name
3556
+ }))
3557
+ );
3558
+ return l !== void 0 ? l : c.length === 0 ? i : void 0;
3559
+ }
3560
+ case 5:
3561
+ return t.date;
3562
+ case 6:
3563
+ return (r = s.selectedSlot) == null ? void 0 : r.time;
3564
+ case 7:
3565
+ return;
3566
+ }
3567
+ }
3568
+ function ci(e) {
3569
+ const { cascade: t, value: s, activeStep: i, setActiveStep: r } = e, { t: a } = Q("ui"), c = Xt(), l = a("booking.operator.all"), m = `${at()}-filter`, p = kt(i, e.datePickerStyle), f = t.visibleSteps.filter(
3570
+ (d) => d === 1 || d === 2 || d === 3 || d === 4
3571
+ ), v = f.some(
3572
+ (d) => !ze(d, s)
3573
+ ), h = f.some(
3574
+ (d) => d === i
3575
+ ) ? i : f.find((d) => !ze(d, s));
3576
+ return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3577
+ f.length > 0 ? /* @__PURE__ */ n(
3578
+ "div",
3579
+ {
3580
+ role: "group",
3581
+ "aria-label": a("booking.filtersLabel"),
3582
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
3583
+ children: f.map((d) => {
3584
+ const g = Qn(
3585
+ d,
3586
+ s,
3587
+ t,
3588
+ l
3589
+ ), I = d === h, u = ze(d, s);
3590
+ return /* @__PURE__ */ n(
3591
+ Ne,
3592
+ {
3593
+ intent: I ? "primary" : "outline",
3594
+ size: "sm",
3595
+ endIcon: /* @__PURE__ */ n(
3596
+ ys,
3597
+ {
3598
+ "aria-hidden": "true",
3599
+ className: I ? "ds:rotate-180" : void 0
3600
+ }
3601
+ ),
3602
+ "aria-expanded": u ? I : void 0,
3603
+ "aria-controls": u && I ? m : void 0,
3604
+ "aria-current": !u && I ? "step" : void 0,
3605
+ onClick: () => r(
3606
+ u && I ? t.currentStep : d
3607
+ ),
3608
+ children: g ? /* @__PURE__ */ k(oe, { children: [
3609
+ c[d],
3610
+ ": ",
3611
+ g
3612
+ ] }) : c[d]
3613
+ },
3614
+ `csc-${d}`
3615
+ );
3616
+ })
3617
+ }
3618
+ ) : null,
3619
+ h !== void 0 ? /* @__PURE__ */ n(
3620
+ ie,
3621
+ {
3622
+ step: h,
3623
+ active: h === p,
3624
+ id: m,
3625
+ children: Ie(h, e, { compactService: !0 })
3626
+ }
3627
+ ) : null,
3628
+ !v && t.gates.date ? (
3629
+ // four-day-grid embeds slots inline with the day strip — the
3630
+ // historic 2-col date|slot split collapses to a single column
3631
+ // so the picker spans the full width instead of orphaning an
3632
+ // empty right cell.
3633
+ e.datePickerStyle === "four-day-grid" ? /* @__PURE__ */ n(ie, { step: 5, active: p === 5, children: Ie(5, e) }) : /* @__PURE__ */ k("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2", children: [
3634
+ /* @__PURE__ */ n(
3635
+ ie,
3636
+ {
3637
+ step: 5,
3638
+ active: p === 5,
3639
+ className: "ds:min-w-0",
3640
+ children: Ie(5, e)
3641
+ }
3642
+ ),
3643
+ s.date ? /* @__PURE__ */ n(
3644
+ ie,
3645
+ {
3646
+ step: 6,
3647
+ active: p === 6,
3648
+ className: "ds:min-w-0",
3649
+ children: Ie(6, e)
3650
+ }
3651
+ ) : /* @__PURE__ */ n("div", { className: "ds:min-w-0" })
3652
+ ] })
3653
+ ) : null,
3654
+ t.gates.details ? /* @__PURE__ */ n(ie, { step: 7, active: p === 7, children: Ie(7, e) }) : null
3655
+ ] });
3656
+ }
3657
+ function di(e) {
3658
+ const { cascade: t, datePickerStyle: s, activeStep: i } = e, r = kt(i, s), a = t.visibleSteps.filter(
3659
+ (l) => l === 1 || l === 2 || l === 3 || l === 4
3660
+ );
3661
+ return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3662
+ /* @__PURE__ */ k(
3663
+ "div",
3664
+ {
3665
+ 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",
3666
+ children: [
3667
+ /* @__PURE__ */ n("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: a.map((l) => /* @__PURE__ */ n(ie, { step: l, active: l === r, children: Ie(l, e, { compactService: !0 }) }, `fbf-${l}`)) }),
3668
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3669
+ t.gates.date ? /* @__PURE__ */ n(ie, { step: 5, active: r === 5, children: Ie(5, e) }) : null,
3670
+ t.gates.slot && e.value.date && s === "month-calendar" ? /* @__PURE__ */ n(ie, { step: 6, active: r === 6, children: Ie(6, e) }) : null
3671
+ ] })
3672
+ ]
3673
+ }
3674
+ ),
3675
+ t.gates.details ? /* @__PURE__ */ n(ie, { step: 7, active: r === 7, children: Ie(7, e) }) : null
3676
+ ] });
3677
+ }
3678
+ function li(e) {
3679
+ const { cascade: t, value: s, activeStep: i, setActiveStep: r, datePickerStyle: a } = e, { t: c } = Q("ui"), l = Xt(), m = q(
3680
+ () => pn(t.visibleSteps, a),
3681
+ [t.visibleSteps, a]
3682
+ ), p = kt(i, a), f = Math.max(0, m.indexOf(p)), v = m.length, h = q(
3683
+ () => m.map((u) => ({ label: l[u] })),
3684
+ [m, l]
3685
+ ), d = f > 0, g = p === 5 && a === "four-day-grid", I = f < v - 1 && ze(p, s) && (!g || ze(6, s));
3686
+ return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3687
+ /* @__PURE__ */ n(vs, { activeStep: f, steps: h }),
3688
+ /* @__PURE__ */ n(ie, { step: p, active: !0, children: Ie(p, e, { compactService: !0 }) }),
3689
+ /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
3690
+ /* @__PURE__ */ n(
3691
+ Ne,
3692
+ {
3693
+ intent: "ghost",
3694
+ size: "md",
3695
+ disabled: !d,
3696
+ onClick: () => {
3697
+ const u = m[f - 1];
3698
+ u && r(u);
3699
+ },
3700
+ children: c("booking.actions.back")
3701
+ }
3702
+ ),
3703
+ p < 7 ? /* @__PURE__ */ n(
3704
+ Ne,
3705
+ {
3706
+ intent: "primary",
3707
+ size: "md",
3708
+ disabled: !I,
3709
+ onClick: () => {
3710
+ const u = m[f + 1];
3711
+ u && r(u);
3712
+ },
3713
+ children: c("booking.actions.next")
3714
+ }
3715
+ ) : null
3716
+ ] })
3717
+ ] });
3718
+ }
3719
+ const ui = [], mi = [];
3720
+ function Nn() {
3721
+ return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
3722
+ }
3723
+ const pi = wn(
3724
+ ({
3725
+ variant: e = "inline-list",
3726
+ country: t,
3727
+ // No default — the cascade engine treats `undefined` as "auto-on
3728
+ // when `specialties` has items" so consumers who pass specialty
3729
+ // data without the explicit flag still get the step.
3730
+ useSpecialties: s,
3731
+ allowOperatorSelection: i = !1,
3732
+ lockedOperatorId: r,
3733
+ operatorsByService: a = !1,
3734
+ autoSelectSingleService: c = !1,
3735
+ specialties: l,
3736
+ services: m,
3737
+ operators: p,
3738
+ availableDates: f,
3739
+ availableSlots: v,
3740
+ nextAvailableDate: h,
3741
+ hideEmail: d = !1,
3742
+ emailOptional: g = !1,
3743
+ requireCodiceFiscale: I,
3744
+ requireDateOfBirth: u,
3745
+ requireInsuranceNumber: F,
3746
+ billingInDetails: N = !1,
3747
+ paymentNoticeStyle: w = "highlighted",
3748
+ showNote: x,
3749
+ showReturningPatientFlag: A,
3750
+ privacyPolicyUrl: _,
3751
+ termsUrl: R,
3752
+ practiceConsent: b,
3753
+ paymentTermsUrl: C,
3754
+ paymentState: V,
3755
+ handoverDelayMs: D,
3756
+ onNavigate: B,
3757
+ renderPayment: P,
3758
+ renderPaymentCompletion: O,
3759
+ validateCodiceFiscale: y,
3760
+ validateInsuranceNumber: X,
3761
+ confirmationChannels: ee,
3762
+ defaultConfirmationChannels: Fe,
3763
+ singleConfirmationChannel: _e,
3764
+ value: E,
3765
+ onChange: K,
3766
+ onSubmit: G,
3767
+ codeStep: te,
3768
+ onStepChange: Re,
3769
+ onDateSelect: et,
3770
+ onWindowChange: ve,
3771
+ datePickerStyle: se = "month-calendar",
3772
+ specialtyPickerStyle: fe,
3773
+ servicePickerStyle: ke,
3774
+ showServiceDuration: Se = !0,
3775
+ operatorPickerStyle: Ce,
3776
+ loadingDates: de,
3777
+ loadingSlots: Le,
3778
+ submitting: ne,
3779
+ submitError: ue,
3780
+ mode: At = "live",
3781
+ showModifyOnSuccess: Be = !0,
3782
+ surface: tt = "flat",
3783
+ emptyServicesSlot: j,
3784
+ onboardingIncompleteSlot: Te,
3785
+ "aria-label": Qt,
3786
+ id: je,
3787
+ className: Dt,
3788
+ onFocus: ct,
3789
+ onBlur: Ue,
3790
+ ...Ae
3791
+ }, en) => {
3792
+ var It, Nt, wt;
3793
+ const { t: ce, i18n: Ot } = Q("ui"), me = e ?? "inline-list", Pe = Ot.language ?? "en", De = l ?? ui, be = p ?? mi;
3794
+ z(() => {
3795
+ const T = lr(E, {
3796
+ useSpecialties: s,
3797
+ lockedOperatorId: r,
3798
+ autoSelectSingleService: c,
3799
+ specialties: De,
3800
+ services: m
3801
+ });
3802
+ (T.specialtyId !== E.specialtyId || T.operatorId !== E.operatorId || T.serviceId !== E.serviceId) && K(T);
3803
+ }, [
3804
+ r,
3805
+ s,
3806
+ c,
3807
+ De,
3808
+ m
3809
+ ]);
3810
+ const $ = q(
3811
+ () => dr({
3812
+ country: t,
3813
+ useSpecialties: s,
3814
+ allowOperatorSelection: i,
3815
+ lockedOperatorId: r,
3816
+ operatorsByService: a,
3817
+ specialties: De,
3818
+ services: m,
3819
+ operators: be,
3820
+ availableSlots: v,
3821
+ value: E
3822
+ }),
3823
+ [
3824
+ t,
3825
+ s,
3826
+ i,
3827
+ r,
3828
+ a,
3829
+ c,
3830
+ De,
3831
+ m,
3832
+ be,
3833
+ f,
3834
+ v,
3835
+ E
3836
+ ]
3837
+ ), dt = q(
3838
+ () => [
3839
+ JSON.stringify(E.insuranceType),
3840
+ JSON.stringify(Qe(E)),
3841
+ JSON.stringify(Ke(E)),
3842
+ JSON.stringify(an(E)),
3843
+ JSON.stringify(E.date),
3844
+ JSON.stringify(E.slotKey)
3845
+ ],
3846
+ [E]
3847
+ ), nt = me === "progress", st = ye(
3848
+ (T) => {
3849
+ if (T === 4 && $.visibleSteps.includes(4) && an(E).length === 0)
3850
+ return Math.min(4, $.currentStep);
3851
+ if (!nt) return $.currentStep;
3852
+ const o = $.visibleSteps.find(
3853
+ (S) => S > T && !In(S, E)
3854
+ );
3855
+ return o === void 0 ? $.currentStep : Math.min(o, $.currentStep);
3856
+ },
3857
+ [nt, $.visibleSteps, $.currentStep, E]
3858
+ ), [le, Oe] = H(
3859
+ $.currentStep
3860
+ ), He = M(dt), Ge = M($.visibleSteps);
3861
+ z(() => {
3862
+ const T = He.current, o = Ge.current;
3863
+ He.current = dt, Ge.current = $.visibleSteps;
3864
+ const S = dt.findIndex(
3865
+ (Z, fn) => Z !== T[fn]
3866
+ );
3867
+ if (S !== -1) {
3868
+ Oe(st(S + 1));
3869
+ return;
3870
+ }
3871
+ const L = nt ? $.visibleSteps.find(
3872
+ (Z) => Z < le && !o.includes(Z) && !In(Z, E)
3873
+ ) : void 0;
3874
+ if (L !== void 0) {
3875
+ Oe(L);
3876
+ return;
3877
+ }
3878
+ $.visibleSteps.includes(le) || Oe($.currentStep);
3879
+ }, [
3880
+ dt,
3881
+ st,
3882
+ nt,
3883
+ $.currentStep,
3884
+ $.visibleSteps,
3885
+ le,
3886
+ E
3887
+ ]);
3888
+ const ge = M(null), Ve = q(
3889
+ () => pn($.visibleSteps, se),
3890
+ [$.visibleSteps, se]
3891
+ ), Mt = Xt(), [Me, $e] = H(""), Je = M(null), xe = M(null);
3892
+ z(() => {
3893
+ const T = kt(le, se);
3894
+ if (xe.current === null) {
3895
+ xe.current = T;
3896
+ return;
3897
+ }
3898
+ if (xe.current === T) return;
3899
+ xe.current = T;
3900
+ const o = Ve.indexOf(T);
3901
+ $e(
3902
+ o === -1 ? "" : ce("booking.stepAnnouncement", {
3903
+ current: o + 1,
3904
+ total: Ve.length,
3905
+ label: Mt[T]
3906
+ })
3907
+ );
3908
+ const S = Je.current;
3909
+ if (!S || S.isConnected) return;
3910
+ const L = ge.current;
3911
+ if (!L) return;
3912
+ const Z = document.activeElement;
3913
+ if (!(Z === null || Z === document.body || !L.contains(Z))) return;
3914
+ const Vt = L.querySelector(ri) ?? L;
3915
+ if (Vt.focus({ preventScroll: !0 }), typeof Vt.scrollIntoView == "function")
3916
+ try {
3917
+ Vt.scrollIntoView({
3918
+ behavior: Nn() ? "auto" : "smooth",
3919
+ block: "nearest"
3920
+ });
3921
+ } catch {
3922
+ Vt.scrollIntoView();
3923
+ }
3924
+ }, [le, se, Ve, Mt, ce]);
3925
+ const U = _r({
3926
+ services: m,
3927
+ value: E,
3928
+ availableSlots: v,
3929
+ onSubmit: G,
3930
+ onChange: K,
3931
+ paymentState: V,
3932
+ submitting: ne,
3933
+ paymentTermsUrl: C,
3934
+ renderPayment: P,
3935
+ codeStep: te
3936
+ }), W = U.status, lt = U.submit, rt = M(U.reset);
3937
+ rt.current = U.reset;
3938
+ const ut = M(!1), [Et, Ft] = H(!1);
3939
+ z(() => {
3940
+ var o, S;
3941
+ if (!ut.current || W !== "idle") return;
3942
+ ut.current = !1;
3943
+ const T = (o = ge.current) == null ? void 0 : o.querySelector(
3944
+ 'form input:not([type="hidden"]):not(:disabled), form select:not(:disabled), form textarea:not(:disabled)'
3945
+ );
3946
+ T && (T.focus({ preventScroll: !0 }), (S = T.scrollIntoView) == null || S.call(T, { block: "nearest" }));
3947
+ }, [W]);
3948
+ const We = at(), mt = M(null), pt = M(null), _t = ((It = U.state) == null ? void 0 : It.status) === "failed", ft = U.state && "phase" in U.state && U.state.phase === "completion";
3949
+ z(() => {
3950
+ var T, o;
3951
+ if (W === "payment") {
3952
+ const S = document.activeElement;
3953
+ (!ft || !S || S === document.body || !((T = ge.current) != null && T.contains(S))) && ((o = mt.current) == null || o.focus());
3954
+ }
3955
+ }, [W, ft]), z(() => {
3956
+ var T;
3957
+ W === "payment" && _t && ((T = pt.current) == null || T.focus());
3958
+ }, [W, _t]), ns(en, () => ge.current, []);
3959
+ const Ye = W === "success" ? 8 : W === "payment" || W === "code" ? 7 : $.currentStep, Rt = M(null);
3960
+ z(() => {
3961
+ if (Ye !== Rt.current && (Rt.current = Ye, Re == null || Re(Ye), Ye === 8 && ge.current))
3962
+ try {
3963
+ ge.current.scrollIntoView({
3964
+ behavior: Nn() ? "auto" : "smooth",
3965
+ block: "start"
3966
+ });
3967
+ } catch {
3968
+ ge.current.scrollIntoView();
3969
+ }
3970
+ }, [Ye, Re]);
3971
+ const Ze = M({ activeStep: le, cascade: $, submitState: W });
3972
+ z(() => {
3973
+ Ze.current = { activeStep: le, cascade: $, submitState: W };
3974
+ }, [le, $, W]);
3975
+ const Lt = q(
3976
+ () => ({
3977
+ getVariant: () => me,
3978
+ getCurrentStep: () => {
3979
+ const T = Ze.current;
3980
+ return T.submitState === "success" ? 8 : T.submitState === "payment" || T.submitState === "code" ? 7 : T.activeStep;
3981
+ },
3982
+ reset: () => {
3983
+ Ze.current.submitState === "payment" || Ze.current.submitState === "code" || (K({}), rt.current(), Oe(1));
3984
+ },
3985
+ goToStep: (T) => {
3986
+ const o = Ze.current, S = o.cascade.visibleSteps.includes(T), L = o.cascade.currentStep, Z = o.submitState === "payment" || o.submitState === "code" ? 7 : !S || T > L ? L : T;
3987
+ Ze.current = { ...o, activeStep: Z }, Oe(Z);
3988
+ }
3989
+ }),
3990
+ [me, K]
3991
+ );
3992
+ ss(nr, Lt, je);
3993
+ const tn = Qt ?? ce("booking.regionLabel"), pe = U.snapshot, Bt = W === "success" && pe ? /* @__PURE__ */ n(
3994
+ si,
3995
+ {
3996
+ codeVerified: U.codeVerified,
3997
+ handoverUrl: $r(U.redirectUrl),
3998
+ handoverDelayMs: D,
3999
+ onNavigate: B,
4000
+ payment: pe.payment,
4001
+ confirmationChannels: ee,
4002
+ snapshot: {
4003
+ ...pe.value,
4004
+ slot: pe.slot,
4005
+ details: pe.details,
4006
+ serviceId: ((Nt = pe.payment) == null ? void 0 : Nt.serviceId) ?? pe.slot.serviceId ?? pe.value.serviceId
4007
+ },
4008
+ operators: be,
4009
+ specialties: De,
4010
+ services: m,
4011
+ locale: Pe,
4012
+ mode: At,
4013
+ showModify: Be && !pe.payment && !U.codeVerified,
4014
+ onReset: () => Lt.reset(),
4015
+ focusWasLost: () => {
4016
+ const T = Je.current, o = document.activeElement;
4017
+ return !!(T && !T.isConnected) && (!o || o === document.body);
4018
+ },
4019
+ onModify: () => {
4020
+ rt.current(), Oe(7);
4021
+ }
4022
+ }
4023
+ ) : null, gt = W === "code" && U.codeStep ? /* @__PURE__ */ n(
4024
+ Mr,
4025
+ {
4026
+ ...U.codeStep,
4027
+ ...te,
4028
+ onVerified: U.completeCode,
4029
+ onBusyChange: Ft
4030
+ }
4031
+ ) : null, re = U.activeSession, Xe = U.state, Y = re && Xe ? {
4032
+ session: re,
4033
+ payment: re.payment,
4034
+ state: Xe,
4035
+ billing: (wt = U.snapshot) == null ? void 0 : wt.details.billing
4036
+ } : void 0, it = Xe && "phase" in Xe && Xe.phase === "completion", Pt = W === "payment" && Y ? /* @__PURE__ */ k(
4037
+ "section",
4038
+ {
4039
+ "aria-labelledby": We,
4040
+ "data-component": "booking-payment",
4041
+ "data-payment-status": Y.state.status,
4042
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
4043
+ children: [
4044
+ /* @__PURE__ */ n(
4045
+ "h3",
4046
+ {
4047
+ ref: mt,
4048
+ id: We,
4049
+ tabIndex: -1,
4050
+ className: "type-title-card ds:m-0",
4051
+ children: ce(
4052
+ it ? "booking.payment.confirming" : "booking.payment.heading"
4053
+ )
4054
+ }
4055
+ ),
4056
+ it ? null : /* @__PURE__ */ n("p", { className: "type-body ds:m-0", children: ce("booking.payment.noticeBody", {
4057
+ amount: Wt(
4058
+ Y.payment.amountCents,
4059
+ Y.payment.currencyCode,
4060
+ Pe
4061
+ )
4062
+ }) }),
4063
+ /* @__PURE__ */ n(
4064
+ "p",
4065
+ {
4066
+ role: "status",
4067
+ className: Y.state.status === "processing" ? "type-body ds:m-0 ds:flex ds:items-center ds:gap-[var(--spacing-sm)]" : "ds:sr-only",
4068
+ children: Y.state.status === "processing" ? /* @__PURE__ */ k(oe, { children: [
4069
+ /* @__PURE__ */ n(Tn, { variant: "pulse", size: "lg", "aria-hidden": "true" }),
4070
+ /* @__PURE__ */ n("span", { children: ce(
4071
+ it ? "booking.payment.confirming" : "booking.payment.processing"
4072
+ ) })
4073
+ ] }) : null
4074
+ }
4075
+ ),
4076
+ Y.state.status === "failed" ? /* @__PURE__ */ n(
4077
+ ae,
4078
+ {
4079
+ ref: pt,
4080
+ variant: "error",
4081
+ tabIndex: -1,
4082
+ className: yt,
4083
+ children: /* @__PURE__ */ n(ae.Description, { children: Y.state.error ?? ce(
4084
+ it ? "booking.payment.completionFailed" : "booking.payment.failed"
4085
+ ) })
4086
+ }
4087
+ ) : null,
4088
+ it ? O == null ? void 0 : O(Y) : P == null ? void 0 : P(Y)
4089
+ ]
4090
+ }
4091
+ ) : null, St = q(() => {
4092
+ const T = new Set(Ke(E)), o = m.filter((S) => T.has(S.id)).map((S) => {
4093
+ var L;
4094
+ return {
4095
+ label: S.label,
4096
+ text: ((L = S.criticalInformationToAccept) == null ? void 0 : L.trim()) ?? ""
4097
+ };
4098
+ }).filter((S) => S.text.length > 0);
4099
+ if (o.length !== 0)
4100
+ return o.length === 1 ? o[0].text : o.map((S) => `${S.label}: ${S.text}`).join(`
4101
+
4102
+ `);
4103
+ }, [m, E]), xt = q(() => {
4104
+ if (W === "success" || W === "payment") return null;
4105
+ const T = me === "accordion" ? oi : me === "calendar" ? ci : me === "flexible" ? di : me === "progress" ? li : ii, o = {
4106
+ cascade: $,
4107
+ inputs: {
4108
+ specialties: De,
4109
+ services: m,
4110
+ operators: be,
4111
+ availableDates: f,
4112
+ availableSlots: v,
4113
+ nextAvailableDate: h
4114
+ },
4115
+ value: E,
4116
+ onChange: K,
4117
+ onSubmit: lt,
4118
+ policy: { country: t, lockedOperatorId: r },
4119
+ detailsProps: {
4120
+ hideEmail: d,
4121
+ emailOptional: g,
4122
+ requireCodiceFiscale: I,
4123
+ requireDateOfBirth: u,
4124
+ requireInsuranceNumber: F,
4125
+ insuranceType: E.insuranceType,
4126
+ showNote: x,
4127
+ showReturningPatientFlag: A,
4128
+ privacyPolicyUrl: _,
4129
+ termsUrl: R,
4130
+ practiceConsent: b,
4131
+ criticalInformationToAccept: St,
4132
+ locked: W === "code",
4133
+ payment: U.payment,
4134
+ paymentTermsUrl: C,
4135
+ paymentBlocked: U.blocked,
4136
+ billingInDetails: N,
4137
+ paymentNoticeStyle: w,
4138
+ validateCodiceFiscale: y,
4139
+ validateInsuranceNumber: X,
4140
+ confirmationChannels: ee,
4141
+ defaultConfirmationChannels: Fe,
4142
+ singleConfirmationChannel: _e,
4143
+ submitError: ue ?? (W === "error" ? ce("booking.payment.submitFailed") : void 0)
4144
+ },
4145
+ emptyServicesSlot: j,
4146
+ onboardingIncompleteSlot: Te,
4147
+ loadingDates: de,
4148
+ loadingSlots: Le,
4149
+ onDateSelect: et,
4150
+ onWindowChange: ve,
4151
+ datePickerStyle: se,
4152
+ specialtyPickerStyle: fe,
4153
+ servicePickerStyle: ke,
4154
+ showServiceDuration: Se,
4155
+ operatorPickerStyle: Ce,
4156
+ submitting: ne || W === "submitting",
4157
+ locale: Pe,
4158
+ activeStep: le,
4159
+ setActiveStep: Oe,
4160
+ agentIdBase: je
4161
+ };
4162
+ return /* @__PURE__ */ n(T, { ...o });
4163
+ }, [
4164
+ W,
4165
+ U.payment,
4166
+ U.blocked,
4167
+ C,
4168
+ ce,
4169
+ me,
4170
+ $,
4171
+ De,
4172
+ m,
4173
+ be,
4174
+ f,
4175
+ v,
4176
+ h,
4177
+ E,
4178
+ K,
4179
+ lt,
4180
+ t,
4181
+ r,
4182
+ d,
4183
+ g,
4184
+ I,
4185
+ u,
4186
+ F,
4187
+ N,
4188
+ w,
4189
+ ue,
4190
+ x,
4191
+ A,
4192
+ _,
4193
+ R,
4194
+ b,
4195
+ St,
4196
+ y,
4197
+ X,
4198
+ ee,
4199
+ Fe,
4200
+ _e,
4201
+ j,
4202
+ Te,
4203
+ de,
4204
+ Le,
4205
+ et,
4206
+ ve,
4207
+ se,
4208
+ fe,
4209
+ ke,
4210
+ Se,
4211
+ Ce,
4212
+ ne,
4213
+ Pe,
4214
+ le,
4215
+ je
4216
+ ]);
4217
+ return /* @__PURE__ */ k(
4218
+ "div",
4219
+ {
4220
+ ref: ge,
4221
+ role: "region",
4222
+ "aria-label": tn,
4223
+ id: je,
4224
+ "data-component": "booking",
4225
+ "data-component-id": je,
4226
+ "data-variant": me,
4227
+ className: Kr({
4228
+ variant: me,
4229
+ surface: tt,
4230
+ className: Dt
4231
+ }),
4232
+ tabIndex: -1,
4233
+ onFocus: (T) => {
4234
+ Je.current = T.target, ct == null || ct(T);
4235
+ },
4236
+ onBlur: (T) => {
4237
+ const o = T.target;
4238
+ window.setTimeout(() => {
4239
+ var L;
4240
+ const S = document.activeElement;
4241
+ Je.current === o && o.isConnected && !(S && ((L = ge.current) != null && L.contains(S))) && (Je.current = null);
4242
+ }), Ue == null || Ue(T);
4243
+ },
4244
+ ...Ae,
4245
+ children: [
4246
+ /* @__PURE__ */ n("div", { role: "status", className: "ds:sr-only", children: Me }),
4247
+ /* @__PURE__ */ k(
4248
+ "div",
4249
+ {
4250
+ className: [
4251
+ "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
4252
+ "ds:rounded-[var(--radius-md)]",
4253
+ "ds:bg-[color-mix(in_srgb,var(--primary)_35%,var(--background))]",
4254
+ "ds:bg-[image:var(--gradient-hero-brand)]",
4255
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
4256
+ "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]"
4257
+ ].join(" "),
4258
+ children: [
4259
+ /* @__PURE__ */ n("h2", { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: ce("booking.regionLabel") }),
4260
+ /* @__PURE__ */ n("p", { className: "type-body-sm ds:text-[var(--foreground)] ds:m-0", children: ce("booking.headingSubtitle") })
4261
+ ]
4262
+ }
4263
+ ),
4264
+ U.cancelled ? /* @__PURE__ */ n(ae, { variant: "info", children: /* @__PURE__ */ n(ae.Description, { children: ce("booking.payment.cancelled") }) }) : null,
4265
+ Bt ?? Pt ?? /* @__PURE__ */ k(oe, { children: [
4266
+ te ? /* @__PURE__ */ n(
4267
+ "fieldset",
4268
+ {
4269
+ "data-slot": "booking-form",
4270
+ disabled: gt ? !0 : void 0,
4271
+ className: "ds:m-0 ds:min-w-0 ds:border-0 ds:p-0",
4272
+ children: xt
4273
+ }
4274
+ ) : xt,
4275
+ gt ? /* @__PURE__ */ k(oe, { children: [
4276
+ /* @__PURE__ */ n("div", { className: "ds:flex ds:justify-end", children: /* @__PURE__ */ n(
4277
+ Ne,
4278
+ {
4279
+ type: "button",
4280
+ intent: "ghost",
4281
+ size: "md",
4282
+ disabled: Et,
4283
+ onClick: () => {
4284
+ ut.current = !0, rt.current();
4285
+ },
4286
+ children: ce("booking.actions.change")
4287
+ }
4288
+ ) }),
4289
+ gt
4290
+ ] }) : null
4291
+ ] })
4292
+ ]
4293
+ }
4294
+ );
4295
+ }
4296
+ );
4297
+ pi.displayName = "Booking";
4298
+ export {
4299
+ pi as B,
4300
+ on as C,
4301
+ Ee as O,
4302
+ nr as b
4303
+ };
4304
+ //# sourceMappingURL=booking-dsgiuhKg.js.map