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