@alfadocs/ui-kit 1.136.0 → 1.138.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 (131) hide show
  1. package/dist/_chunks/{appointment-card-BT1cMZIX.js → appointment-card-CaxFXtSn.js} +196 -184
  2. package/dist/_chunks/appointment-details-panel.history-DrIMDQYf.js +314 -0
  3. package/dist/_chunks/appointment-details-panel.identity-C20Y9xNC.js +223 -0
  4. package/dist/_chunks/{appointment-timeline-Dy4YQJ17.js → appointment-timeline-BEwgbYyG.js} +113 -110
  5. package/dist/_chunks/{appointment-tray-B3gSHL1j.js → appointment-tray-DPpeR9JT.js} +8 -8
  6. package/dist/_chunks/calendar-appointment-editor-dialog-SxSkOTnO.js +5519 -0
  7. package/dist/_chunks/calendar-editor-discard-host-DjUhoFr2.js +1336 -0
  8. package/dist/_chunks/calendar-editor-guard-9fShhNIA.js +31 -0
  9. package/dist/_chunks/calendar-waiting-list-panel-331vzAdl.js +981 -0
  10. package/dist/_chunks/calendar-workspace.model-B8yPwuBv.js +1557 -0
  11. package/dist/_chunks/calendar.sheets-aodjllWd.js +4585 -0
  12. package/dist/_chunks/color-picker-CC8ZfntU.js +582 -0
  13. package/dist/_chunks/{document-preview-DWlejd8A.js → document-preview-CirR3C_m.js} +2 -2
  14. package/dist/_chunks/{fiscal-code-input-BBvU7sAo.js → fiscal-code-input-DZlpaMGg.js} +2 -2
  15. package/dist/_chunks/{iban-input-DuTwKok5.js → iban-input-CdSLRzQN.js} +2 -2
  16. package/dist/_chunks/list-todo-KWvUhmT_.js +33 -0
  17. package/dist/_chunks/{notes-panel-BvjAo4RQ.js → notes-panel-DsEKNtsw.js} +2 -2
  18. package/dist/_chunks/palettes-CKVXYTzo.js +172 -0
  19. package/dist/_chunks/{patient-account-settings-Bmfeclpd.js → patient-account-settings-Cs9y-pVA.js} +3 -3
  20. package/dist/_chunks/{patient-check-in-resume-CYZ-SvsF.js → patient-check-in-resume-4qi_klQV.js} +5 -5
  21. package/dist/_chunks/{patient-details-9eh9cNy7.js → patient-details-Dv7EiTCo.js} +2 -2
  22. package/dist/_chunks/{patient-field-row-B782eT0C.js → patient-field-row-DuHWGlLz.js} +2 -2
  23. package/dist/_chunks/patient-picker-BZJuOgMw.js +173 -0
  24. package/dist/_chunks/{patient-summary-card-K9zaMl1O.js → patient-summary-card-D-cDzOim.js} +2 -2
  25. package/dist/_chunks/{portal-details-DCIiGkHA.js → portal-details-BGc_FLQk.js} +3 -3
  26. package/dist/_chunks/{portal-documents-DVKj6Sco.js → portal-documents-BSI1U5lI.js} +3 -3
  27. package/dist/_chunks/{portal-parts-Br8wuala.js → portal-parts-C99CreYO.js} +2 -2
  28. package/dist/_chunks/{privacy-mask-C19dJFMk.js → privacy-mask-C2ZLKrMh.js} +5 -5
  29. package/dist/_chunks/{rich-text-editor-DjHL1b3E.js → rich-text-editor-C48omVjq.js} +2 -2
  30. package/dist/_chunks/task-editor-wKbFbGqW.js +1093 -0
  31. package/dist/_chunks/use-appointment-details-read-jGkJalX8.js +1966 -0
  32. package/dist/agent-catalog.json +2 -2
  33. package/dist/appointment-editor-panel/index.js +100 -0
  34. package/dist/booking-tools-data/index.js +82 -0
  35. package/dist/browser-support.js +1 -1
  36. package/dist/calendar-action-buttons/index.js +178 -0
  37. package/dist/components/appointment-card/appointment-card.d.ts +5 -2
  38. package/dist/components/appointment-card/index.js +2 -2
  39. package/dist/components/appointment-details-panel/index.js +6 -5
  40. package/dist/components/appointment-timeline/appointment-timeline.d.ts +6 -0
  41. package/dist/components/appointment-timeline/index.js +1 -1
  42. package/dist/components/color-picker/index.js +5 -4
  43. package/dist/components/document-preview/index.js +1 -1
  44. package/dist/components/fiscal-code-input/index.js +1 -1
  45. package/dist/components/iban-input/index.js +1 -1
  46. package/dist/components/notes-panel/index.js +1 -1
  47. package/dist/components/patient-details/index.js +1 -1
  48. package/dist/components/patient-summary-card/index.js +1 -1
  49. package/dist/components/rich-text-editor/index.js +1 -1
  50. package/dist/components/task-editor/index.js +1 -1
  51. package/dist/core.css +1 -1
  52. package/dist/find-free-slots-panel/index.js +58 -0
  53. package/dist/host-legacy.css +16 -0
  54. package/dist/i18n/locales/ar.d.ts +0 -1
  55. package/dist/i18n/locales/ar.js +0 -1
  56. package/dist/i18n/locales/de.d.ts +0 -1
  57. package/dist/i18n/locales/de.js +0 -1
  58. package/dist/i18n/locales/el.d.ts +0 -1
  59. package/dist/i18n/locales/el.js +0 -1
  60. package/dist/i18n/locales/en.d.ts +0 -1
  61. package/dist/i18n/locales/en.js +0 -1
  62. package/dist/i18n/locales/es.d.ts +0 -1
  63. package/dist/i18n/locales/es.js +0 -1
  64. package/dist/i18n/locales/fr.d.ts +0 -1
  65. package/dist/i18n/locales/fr.js +0 -1
  66. package/dist/i18n/locales/hi.d.ts +0 -1
  67. package/dist/i18n/locales/hi.js +0 -1
  68. package/dist/i18n/locales/it.d.ts +0 -1
  69. package/dist/i18n/locales/it.js +0 -1
  70. package/dist/i18n/locales/ja.d.ts +0 -1
  71. package/dist/i18n/locales/ja.js +0 -1
  72. package/dist/i18n/locales/nl.d.ts +0 -1
  73. package/dist/i18n/locales/nl.js +0 -1
  74. package/dist/i18n/locales/pl.d.ts +0 -1
  75. package/dist/i18n/locales/pl.js +0 -1
  76. package/dist/i18n/locales/pt.d.ts +0 -1
  77. package/dist/i18n/locales/pt.js +0 -1
  78. package/dist/i18n/locales/ro.d.ts +0 -1
  79. package/dist/i18n/locales/ro.js +0 -1
  80. package/dist/i18n/locales/ru.d.ts +0 -1
  81. package/dist/i18n/locales/ru.js +0 -1
  82. package/dist/i18n/locales/sq.d.ts +0 -1
  83. package/dist/i18n/locales/sq.js +0 -1
  84. package/dist/i18n/locales/sv.d.ts +0 -1
  85. package/dist/i18n/locales/sv.js +0 -1
  86. package/dist/i18n/locales/tr.d.ts +0 -1
  87. package/dist/i18n/locales/tr.js +0 -1
  88. package/dist/i18n/locales/zh.d.ts +0 -1
  89. package/dist/i18n/locales/zh.js +0 -1
  90. package/dist/index.js +1328 -1322
  91. package/dist/locales/ar.json +0 -1
  92. package/dist/locales/de.json +0 -1
  93. package/dist/locales/el.json +0 -1
  94. package/dist/locales/en.json +0 -1
  95. package/dist/locales/es.json +0 -1
  96. package/dist/locales/fr.json +0 -1
  97. package/dist/locales/hi.json +0 -1
  98. package/dist/locales/it.json +0 -1
  99. package/dist/locales/ja.json +0 -1
  100. package/dist/locales/nl.json +0 -1
  101. package/dist/locales/pl.json +0 -1
  102. package/dist/locales/pt.json +0 -1
  103. package/dist/locales/ro.json +0 -1
  104. package/dist/locales/ru.json +0 -1
  105. package/dist/locales/sq.json +0 -1
  106. package/dist/locales/sv.json +0 -1
  107. package/dist/locales/tr.json +0 -1
  108. package/dist/locales/zh.json +0 -1
  109. package/dist/online-bookings-panel/index.js +69 -0
  110. package/dist/patterns/calendar/booking-tools/appointment-editor-panel.d.ts +46 -0
  111. package/dist/patterns/calendar/booking-tools/booking-tools-data.d.ts +48 -0
  112. package/dist/patterns/calendar/booking-tools/calendar-action-buttons.d.ts +55 -0
  113. package/dist/patterns/calendar/booking-tools/find-free-slots-panel.d.ts +35 -0
  114. package/dist/patterns/calendar/booking-tools/online-bookings-panel.d.ts +61 -0
  115. package/dist/patterns/calendar/booking-tools/waiting-list-panel.d.ts +58 -0
  116. package/dist/patterns/calendar/calendar-editor-discard-host.d.ts +20 -0
  117. package/dist/patterns/calendar/calendar-print-sheet.d.ts +16 -0
  118. package/dist/patterns/calendar/calendar-workspace.model.d.ts +7 -0
  119. package/dist/patterns/calendar/calendar.model.d.ts +9 -0
  120. package/dist/patterns/calendar/calendar.sheets.d.ts +59 -17
  121. package/dist/patterns/calendar/index.js +24 -20
  122. package/dist/patterns/patient-account-settings/index.js +1 -1
  123. package/dist/patterns/patient-check-in/index.js +1 -1
  124. package/dist/patterns/patient-portal/index.js +2 -2
  125. package/dist/tokens.css +1 -1
  126. package/dist/waiting-list-panel/index.js +158 -0
  127. package/package.json +27 -2
  128. package/dist/_chunks/calendar-appointment-editor-dialog-CB4cQOtc.js +0 -13773
  129. package/dist/_chunks/color-picker-AcaWuKah.js +0 -745
  130. package/dist/_chunks/task-editor-BfXSn6U1.js +0 -1257
  131. package/dist/_chunks/use-appointment-details-read-7J0j1FP7.js +0 -2476
@@ -0,0 +1,4585 @@
1
+ import { jsx as e, jsxs as c, Fragment as ae } from "react/jsx-runtime";
2
+ import { useRef as P, useState as N, createContext as gr, useContext as vr, useEffect as V, useId as wn, forwardRef as pr, useMemo as ye, Fragment as Ut, useCallback as br } from "react";
3
+ import { useTranslation as le } from "react-i18next";
4
+ import { P as yr, S as kr } from "./patient-picker-BZJuOgMw.js";
5
+ import { u as Ye, a as fr } from "./calendar-editor-guard-9fShhNIA.js";
6
+ import { u as Nr } from "./form-field-context-DtiROUJV.js";
7
+ import { A as xr, M as Cr, C as Gt } from "./appointment-details-panel.history-DrIMDQYf.js";
8
+ import { R as As, b as Rn, D as li, f as Ir, e as Sr, g as wr, h as Rr, i as Dr } from "./appointment-details-panel.identity-C20Y9xNC.js";
9
+ import { d as xa } from "./toast-DQ1Zu1kk.js";
10
+ import { i as ui } from "./treatment-receipt-BZzwvsnY.js";
11
+ import { A as L } from "./alert-C4WKViaS.js";
12
+ import { B as te } from "./button-DohK_Ak_.js";
13
+ import { R as Ae } from "./radio-BZQs6_36.js";
14
+ import { R as Sn } from "./radio-group-ChIKyeSJ.js";
15
+ import { q as Os, s as Hs, t as hi, v as Er, x as Tr, y as Lr, N as q, z as Ar, A as Kt, B as Or, F as Pr, G as qt, H as jt, I as Mr, J as Br, K as mi, p as Ta, L as Yt, M as Wr, O as Xt, P as $r, Q as Fr, S as Qt, T as zr, U as _r, X as Vr, Y as Hr, Z as Ur, R as Jt, _ as Zt, $ as we, a0 as Gr, a1 as Kr, a2 as qr, a3 as ei, a4 as jr, a5 as Ca, a6 as Yr, a7 as Xr, a8 as Qr, a9 as ni, aa as Ia, ab as si, c as Jr, ac as Zr, ad as ed, ae as nd, af as sd } from "./calendar-workspace.model-B8yPwuBv.js";
16
+ import { V as Ps } from "./visually-hidden-BHxEUGyT.js";
17
+ import { N as ad } from "./notes-panel-DsEKNtsw.js";
18
+ import { A as gi } from "./avatar-Dp5apm1d.js";
19
+ import { E as vi } from "./empty-state-DwJ5YNzz.js";
20
+ import { P as Ms } from "./panel-header-CbtlTe85.js";
21
+ import { P as td } from "./panel-subview-DCyvn-49.js";
22
+ import { F as z } from "./form-field-CyHfOVKF.js";
23
+ import { C as La } from "./combobox-BBCVQS-S.js";
24
+ import { S as id } from "./state-backed-text-input-DVETOhSS.js";
25
+ import { T as rd } from "./text-area-COMVJ1yE.js";
26
+ import { N as Sa } from "./number-input-DUSvP7Dq.js";
27
+ import { T as dd } from "./time-picker-DDr5vhwQ.js";
28
+ import { C as pi } from "./color-picker-CC8ZfntU.js";
29
+ import { G as Bs } from "./palettes-CKVXYTzo.js";
30
+ import { a as bi } from "./whatsapp-button-XbozeDl_.js";
31
+ import { B as an } from "./badge-BUk4RjTS.js";
32
+ import { C as Re } from "./checkbox-DV4sNDeB.js";
33
+ import { T as Ws } from "./tag-BNlcEJfE.js";
34
+ import { D as Z } from "./dropdown-menu-DBWaW4pq.js";
35
+ import { a as ai } from "./key-value-pair-DOTl68_U.js";
36
+ import { T as Aa } from "./timestamp-DPLDWdxA.js";
37
+ import { S as od } from "./switch-DO6uC4HJ.js";
38
+ import { I as ve } from "./icon-button-S8_weU3g.js";
39
+ import { B as yi } from "./button-group-DuQuuulC.js";
40
+ import { I as ti } from "./icon-button-group-SmkdVCNx.js";
41
+ import { C as cd, b as ld, a as ud } from "./collapsible-DVPM46bq.js";
42
+ import { D as $s } from "./date-picker-BmVBVpVu.js";
43
+ import { D as mn } from "./dialog-CVTxyR0v.js";
44
+ import { T as Fs } from "./trash-2-uumy3fy1.js";
45
+ import { P as rs } from "./popover-CN5IsOeS.js";
46
+ import { S as be } from "./select-CIXKyUMw.js";
47
+ import { L as hd } from "./link-CeV7FoI6.js";
48
+ import { S as md } from "./signature-status-chip-DS9hHwIt.js";
49
+ import { g as gd } from "./date-locale-OG-MupVD.js";
50
+ import { f as vd } from "./format-ql5WTsYT.js";
51
+ import { R as pd } from "./repeat-CvQa5rZt.js";
52
+ import { a as ki } from "./compact-editor-fields-cP6yh7xv.js";
53
+ import { c as ds } from "./index-D2ZczOXr.js";
54
+ import { S as In } from "./skeleton-tTWJpvAq.js";
55
+ import { T as bd } from "./transaction-chip-CkYd-3ky.js";
56
+ import { a as yd } from "./workflow-status-CO0mxXs2.js";
57
+ import { U as kd } from "./user-x-BJZg4kaP.js";
58
+ import { E as ii } from "./eye-off-C_4xkbRP.js";
59
+ import { V as fd } from "./video-BheNGvsu.js";
60
+ import { M as fi } from "./map-pin-BaY37-Km.js";
61
+ import { G as Ni } from "./globe-sHBW1JN5.js";
62
+ import { A as wa } from "./armchair-BaLDW6Hz.js";
63
+ import { U as Nd } from "./user-plus-BtcOLgNU.js";
64
+ import { S as xd } from "./stethoscope-sZXGC43m.js";
65
+ import { E as Cd } from "./eye-BjhN2nYf.js";
66
+ import { P as Id } from "./pencil-B1sKKyuT.js";
67
+ import { a as Sd } from "./entity-card-p-LANpYt.js";
68
+ import { A as ri } from "./arrow-left-BfaGqVam.js";
69
+ import { H as di } from "./history-CK2JaU2g.js";
70
+ import { C as wd } from "./calendar-plus-BFrIRE4r.js";
71
+ import { L as Oa } from "./lock-ClAFG1gy.js";
72
+ import { C as Rd } from "./calendar-clock-hbObjfGY.js";
73
+ import { P as Dd } from "./plus-DzMQ_c6b.js";
74
+ import { C as Ts } from "./copy-vRpqqHtY.js";
75
+ import { C as Ra } from "./clipboard-list-rSzfIYZB.js";
76
+ import { X as Ed } from "./x-B5YnXwCz.js";
77
+ import { C as Td, L as Ld } from "./list-todo-KWvUhmT_.js";
78
+ import { F as Ad } from "./funnel-DpPV3Qkd.js";
79
+ import { U as Od } from "./user-cog-BTn98Arm.js";
80
+ import { M as xi } from "./message-square-Bye4ATvx.js";
81
+ import { M as Ci } from "./mail-BqXVF2zH.js";
82
+ import { H as Pd } from "./hourglass-BEAzW1wE.js";
83
+ import { S as Md } from "./settings-d25ju_6L.js";
84
+ import { R as Bd } from "./rotate-ccw-BBQnIVTr.js";
85
+ import { P as Wd } from "./pen-line-D0De5zdl.js";
86
+ import { C as $d } from "./check-DrFSN__t.js";
87
+ import { S as Fd } from "./send-C5kDJ-Mz.js";
88
+ import { S as zd } from "./smartphone-C0rFF2if.js";
89
+ const sn = (n) => `calendarWorkspace.editor.${n}`;
90
+ function _d({
91
+ scopes: n,
92
+ offersCarePlanCleanup: s,
93
+ onConfirm: i
94
+ }) {
95
+ const { t: u } = le("ui"), [b, f] = N("this"), [g, o] = N(!1), [y, v] = N(!1), [l, k] = N(), h = n != null && n.includes(b) ? b : (n == null ? void 0 : n[0]) ?? "this", D = async () => {
96
+ k(void 0), v(!0);
97
+ try {
98
+ await i({
99
+ scope: h,
100
+ removeFromCarePlan: s ? g : void 0
101
+ });
102
+ } catch (T) {
103
+ k(
104
+ T instanceof Error && T.message.trim() ? T.message : u("emptyState.error.title")
105
+ ), v(!1);
106
+ }
107
+ };
108
+ return /* @__PURE__ */ c(ae, { children: [
109
+ /* @__PURE__ */ c(mn.Header, { children: [
110
+ /* @__PURE__ */ e(mn.Title, { children: u(sn("deleteConfirmTitle")) }),
111
+ /* @__PURE__ */ e(mn.Description, { children: u(sn("deleteConfirmBody")) })
112
+ ] }),
113
+ n || s || l ? /* @__PURE__ */ c(mn.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
114
+ n ? /* @__PURE__ */ e(
115
+ Sn,
116
+ {
117
+ label: u(sn("deleteScope")),
118
+ value: h,
119
+ onValueChange: (T) => f(T),
120
+ children: n.map((T) => /* @__PURE__ */ e(
121
+ Ae,
122
+ {
123
+ value: T,
124
+ label: u(sn(Os[T]))
125
+ },
126
+ T
127
+ ))
128
+ }
129
+ ) : null,
130
+ s ? /* @__PURE__ */ c(
131
+ Sn,
132
+ {
133
+ label: u(sn("carePlanCleanup")),
134
+ value: g ? "remove" : "keep",
135
+ onValueChange: (T) => o(T === "remove"),
136
+ children: [
137
+ /* @__PURE__ */ e(Ae, { value: "remove", label: u(sn("carePlanRemove")) }),
138
+ /* @__PURE__ */ e(Ae, { value: "keep", label: u(sn("carePlanKeep")) })
139
+ ]
140
+ }
141
+ ) : null,
142
+ l ? /* @__PURE__ */ e(L, { variant: "error", children: /* @__PURE__ */ e(L.Description, { children: l }) }) : null
143
+ ] }) : null,
144
+ /* @__PURE__ */ c(mn.Footer, { divider: !0, children: [
145
+ /* @__PURE__ */ e(mn.Close, { asChild: !0, children: /* @__PURE__ */ e(te, { intent: "outline", disabled: y, children: u(sn("deleteCancel")) }) }),
146
+ /* @__PURE__ */ e(
147
+ te,
148
+ {
149
+ intent: "destructive",
150
+ startIcon: /* @__PURE__ */ e(Fs, { "aria-hidden": "true" }),
151
+ loading: y,
152
+ onClick: D,
153
+ children: u(sn("deleteConfirm"))
154
+ }
155
+ )
156
+ ] })
157
+ ] });
158
+ }
159
+ function Vd({
160
+ open: n,
161
+ onOpenChange: s,
162
+ scopes: i,
163
+ offersCarePlanCleanup: u,
164
+ onConfirm: b,
165
+ onCloseAutoFocus: f
166
+ }) {
167
+ const g = P(!1);
168
+ return /* @__PURE__ */ e(
169
+ mn,
170
+ {
171
+ open: n,
172
+ onOpenChange: (o) => {
173
+ g.current || s(o);
174
+ },
175
+ children: /* @__PURE__ */ e(
176
+ mn.Content,
177
+ {
178
+ size: "sm",
179
+ variant: "alert",
180
+ onCloseAutoFocus: f,
181
+ children: /* @__PURE__ */ e(
182
+ _d,
183
+ {
184
+ scopes: i,
185
+ offersCarePlanCleanup: u,
186
+ onConfirm: async (o) => {
187
+ g.current = !0;
188
+ try {
189
+ await b(o);
190
+ } finally {
191
+ g.current = !1;
192
+ }
193
+ s(!1);
194
+ }
195
+ }
196
+ )
197
+ }
198
+ )
199
+ }
200
+ );
201
+ }
202
+ const Ii = gr(null), vl = Ii.Provider;
203
+ function Si() {
204
+ const n = vr(Ii);
205
+ if (!n)
206
+ throw new Error("useSheetHost: render inside a SheetHostProvider");
207
+ return n;
208
+ }
209
+ function wi({
210
+ onCreatePatient: n,
211
+ ...s
212
+ }) {
213
+ var S;
214
+ const i = Ye(), { t: u } = le("ui"), [b, f] = N(), [g, o] = N(!1), [y, v] = N(), l = P(!0), k = P(null), h = P(!1);
215
+ V(() => (l.current = !0, () => {
216
+ l.current = !1;
217
+ }), []), V(() => {
218
+ var _, B;
219
+ !h.current || !s.value || (h.current = !1, (B = (_ = k.current) == null ? void 0 : _.querySelector('[role="combobox"]')) == null || B.focus());
220
+ }, [s.value]);
221
+ const D = async (_) => {
222
+ if (!(!n || g)) {
223
+ o(!0), v(void 0);
224
+ try {
225
+ const B = await n({ typedText: _ });
226
+ B && l.current && (f({ id: B.id, name: B.name }), h.current = !0, s.onValueChange(B.id));
227
+ } catch (B) {
228
+ l.current && v(
229
+ B instanceof Error && B.message.trim() ? B.message : u("calendarWorkspace.bookingTriage.createPatientFailed")
230
+ );
231
+ } finally {
232
+ l.current && o(!1);
233
+ }
234
+ }
235
+ }, T = ((S = i.patientById(s.value)) == null ? void 0 : S.name) ?? ((b == null ? void 0 : b.id) === s.value ? b.name : void 0) ?? s.selectedLabel ?? u("calendarWorkspace.details.patientNotLoaded");
236
+ return /* @__PURE__ */ c(
237
+ "div",
238
+ {
239
+ ref: k,
240
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
241
+ children: [
242
+ /* @__PURE__ */ e(
243
+ yr,
244
+ {
245
+ ...s,
246
+ selectedLabel: T,
247
+ patients: i.patients,
248
+ searchPatients: i.searchPatients,
249
+ placeholder: u("calendarWorkspace.editor.patientSearch"),
250
+ createAction: n ? {
251
+ label: u("calendarWorkspace.bookingTriage.createPatient"),
252
+ onCreate: (_) => void D(_),
253
+ loading: g
254
+ } : void 0
255
+ }
256
+ ),
257
+ y ? /* @__PURE__ */ e("p", { role: "alert", className: "type-body-sm ds:text-destructive", children: y }) : null
258
+ ]
259
+ }
260
+ );
261
+ }
262
+ function Hd({
263
+ value: n,
264
+ fallbackLabel: s
265
+ }) {
266
+ var b;
267
+ const i = Ye(), u = Nr();
268
+ return /* @__PURE__ */ e(
269
+ "div",
270
+ {
271
+ id: u.id,
272
+ role: "group",
273
+ "aria-label": u.label,
274
+ "aria-describedby": u.describedBy || void 0,
275
+ "data-component": "calendar-patient-locked",
276
+ className: "type-body ds:min-w-0 ds:py-[var(--spacing-xs)] ds:text-start ds:break-words ds:text-foreground",
277
+ children: ((b = i.patientById(n)) == null ? void 0 : b.name) ?? s
278
+ }
279
+ );
280
+ }
281
+ const Ud = 90;
282
+ function Gd(n) {
283
+ var i;
284
+ let s = n.closest("[data-presence]");
285
+ for (; s; ) {
286
+ if (s.dataset.presence !== "present" || s.getAnimations().some((u) => u.playState === "running"))
287
+ return !1;
288
+ s = ((i = s.parentElement) == null ? void 0 : i.closest("[data-presence]")) ?? null;
289
+ }
290
+ return !0;
291
+ }
292
+ function Kd(n, s) {
293
+ let i = 0, u = 0, b = 0;
294
+ const f = () => {
295
+ const g = n();
296
+ if (g) {
297
+ if (u += 1, b = Gd(g) ? b + 1 : 0, b >= 2 || u >= Ud) return s(g);
298
+ i = requestAnimationFrame(f);
299
+ }
300
+ };
301
+ return i = requestAnimationFrame(f), () => cancelAnimationFrame(i);
302
+ }
303
+ const qd = 'input, button, textarea, [role="combobox"]';
304
+ function jd(n) {
305
+ for (const s of n.querySelectorAll(qd))
306
+ if (!s.matches(
307
+ ':disabled, [aria-disabled="true"], [aria-hidden="true"], [tabindex="-1"], [type="hidden"]'
308
+ ) && s.getClientRects().length !== 0)
309
+ return s;
310
+ return null;
311
+ }
312
+ function Yd(n, s) {
313
+ const i = n ? s[n] : void 0;
314
+ V(() => {
315
+ if (i)
316
+ return Kd(
317
+ () => i.current,
318
+ (u) => {
319
+ const b = jd(u);
320
+ b && (b.scrollIntoView({ block: "center" }), b.focus({ preventScroll: !0 }));
321
+ }
322
+ );
323
+ }, [i]);
324
+ }
325
+ function Xd(n) {
326
+ const { t: s } = le("ui"), i = wn(), u = wn(), [b, f] = N(n.defaultScope), { scopes: g } = n, o = b && g.includes(b) ? b : g[0], y = o === "all" && n.warnOnWholeSeries !== !1;
327
+ let v;
328
+ try {
329
+ v = new Intl.DateTimeFormat(n.locale, {
330
+ dateStyle: "full",
331
+ timeStyle: "short"
332
+ }).format(n.occurrence);
333
+ } catch {
334
+ v = n.occurrence.toLocaleString();
335
+ }
336
+ return /* @__PURE__ */ c(
337
+ "section",
338
+ {
339
+ "data-component": "calendar-series-scope-chooser",
340
+ "aria-labelledby": i,
341
+ className: "ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-md)] ds:text-start",
342
+ children: [
343
+ /* @__PURE__ */ e("h3", { id: i, className: "type-title-item ds:m-0", children: s("calendarWorkspace.editor.seriesChooserTitle") }),
344
+ /* @__PURE__ */ e("p", { className: "type-body ds:m-0", children: s("calendarWorkspace.editor.seriesChooserBody", { date: v }) }),
345
+ /* @__PURE__ */ e(
346
+ Sn,
347
+ {
348
+ label: s("calendarWorkspace.editor.recurringSaveMode"),
349
+ value: o,
350
+ onValueChange: (l) => f(l),
351
+ children: g.map((l) => /* @__PURE__ */ e(
352
+ Ae,
353
+ {
354
+ value: l,
355
+ label: s(
356
+ `calendarWorkspace.editor.${Os[l]}`
357
+ ),
358
+ "aria-describedby": l === "all" && y ? u : void 0
359
+ },
360
+ l
361
+ ))
362
+ }
363
+ ),
364
+ y ? /* @__PURE__ */ e(L, { variant: "warning", announce: "polite", children: /* @__PURE__ */ e(L.Description, { id: u, children: s("calendarWorkspace.editor.seriesAllDiscardsOverrides") }) }) : null,
365
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-wrap ds:justify-end ds:gap-[var(--spacing-sm)]", children: [
366
+ /* @__PURE__ */ e(te, { intent: "outline", onClick: n.onCancel, children: s("calendarWorkspace.editor.cancel") }),
367
+ /* @__PURE__ */ e(
368
+ te,
369
+ {
370
+ intent: "primary",
371
+ disabled: !o,
372
+ onClick: () => n.onContinue(o),
373
+ children: s("calendarWorkspace.editor.seriesChooserContinue")
374
+ }
375
+ )
376
+ ] })
377
+ ]
378
+ }
379
+ );
380
+ }
381
+ const Ri = 99, Di = {
382
+ day: "daily",
383
+ week: "weekly",
384
+ month: "monthly",
385
+ year: "yearly"
386
+ }, Qd = ["day", "week", "month", "year"], Jd = {
387
+ day: "recurrenceUnitDay",
388
+ week: "recurrenceUnitWeek",
389
+ month: "recurrenceUnitMonth",
390
+ year: "recurrenceUnitYear"
391
+ }, Zd = {
392
+ day: "recurrenceEveryDay",
393
+ week: "recurrenceEveryWeek",
394
+ month: "recurrenceEveryMonth",
395
+ year: "recurrenceEveryYear"
396
+ }, Ei = {
397
+ 1: "recurrenceOrdinal1",
398
+ 2: "recurrenceOrdinal2",
399
+ 3: "recurrenceOrdinal3",
400
+ 4: "recurrenceOrdinal4"
401
+ }, eo = {
402
+ daily: { unit: "day", every: 1 },
403
+ weekly: { unit: "week", every: 1 },
404
+ monthly: { unit: "month", every: 1 },
405
+ quarterly: { unit: "month", every: 3 },
406
+ semiannual: { unit: "month", every: 6 },
407
+ yearly: { unit: "year", every: 1 }
408
+ }, Ti = [
409
+ "MO",
410
+ "TU",
411
+ "WE",
412
+ "TH",
413
+ "FR",
414
+ "SA",
415
+ "SU"
416
+ ], Us = (n) => hi[n.getDay()];
417
+ function no() {
418
+ return { interval: 1, unit: "week", weekdays: [], monthlyBy: "monthDay" };
419
+ }
420
+ function so(n) {
421
+ var s;
422
+ return (n.interval ?? 1) > 1 || !!((s = n.byDay) != null && s.length);
423
+ }
424
+ function ao(n) {
425
+ var u;
426
+ const s = eo[n.frequency], i = (u = n.byDay) == null ? void 0 : u.find((b) => b.length > 2);
427
+ return {
428
+ interval: (n.interval ?? 1) * s.every,
429
+ unit: s.unit,
430
+ weekdays: s.unit === "week" ? (n.byDay ?? []).filter(
431
+ (b) => b.length === 2
432
+ ) : [],
433
+ monthlyBy: i ? i.startsWith("-") ? "lastWeekday" : "nthWeekday" : "monthDay"
434
+ };
435
+ }
436
+ function Li(n) {
437
+ const { nth: s, last: i } = Hs(n);
438
+ return [
439
+ "monthDay",
440
+ ...s <= 4 ? ["nthWeekday"] : [],
441
+ ...i ? ["lastWeekday"] : []
442
+ ];
443
+ }
444
+ function Pa(n, s) {
445
+ return Li(s).includes(n) ? n : n === "nthWeekday" ? "lastWeekday" : "nthWeekday";
446
+ }
447
+ function Ma(n, s) {
448
+ const i = /* @__PURE__ */ new Set([
449
+ ...n.weekdays,
450
+ Us(s)
451
+ ]);
452
+ return Ti.filter((u) => i.has(u));
453
+ }
454
+ function to(n, s) {
455
+ const i = Math.min(Math.max(n.interval ?? 1, 1), Ri), u = {
456
+ frequency: Di[n.unit],
457
+ ...i > 1 ? { interval: i } : {}
458
+ };
459
+ if (n.unit === "week")
460
+ return { ...u, byDay: Ma(n, s) };
461
+ if (n.unit === "month") {
462
+ const b = Pa(n.monthlyBy, s);
463
+ if (b === "monthDay") return u;
464
+ const { nth: f } = Hs(s);
465
+ return {
466
+ ...u,
467
+ byDay: [`${b === "lastWeekday" ? -1 : f}${Us(s)}`]
468
+ };
469
+ }
470
+ return u;
471
+ }
472
+ function zs(n, s, i) {
473
+ const u = new Date(2026, 0, 4 + hi.indexOf(n));
474
+ return new Intl.DateTimeFormat(s, { weekday: i }).format(u);
475
+ }
476
+ function io({
477
+ frequency: n,
478
+ custom: s,
479
+ start: i,
480
+ ends: u,
481
+ count: b,
482
+ untilDate: f,
483
+ locale: g
484
+ }) {
485
+ const { t: o } = le("ui"), y = (k) => `calendarWorkspace.editor.${k}`, v = (k) => {
486
+ const h = zs(Us(i), g, "long");
487
+ return k === "monthDay" ? o(y("recurrenceMonthDay"), { day: i.getDate() }) : k === "lastWeekday" ? o(y("recurrenceLastWeekday"), { weekday: h }) : o(y("recurrenceNthWeekday"), {
488
+ weekday: h,
489
+ ordinal: o(y(Ei[Hs(i).nth]))
490
+ });
491
+ }, l = [];
492
+ if (n === "custom") {
493
+ const k = Math.max(s.interval ?? 1, 1);
494
+ if (l.push(
495
+ k === 1 ? o(y(As[Di[s.unit]])) : o(y(Zd[s.unit]), { count: k })
496
+ ), s.unit === "week") {
497
+ const h = Ma(s, i).map(
498
+ (D) => zs(D, g, "long")
499
+ );
500
+ l.push(
501
+ new Intl.ListFormat(g, { type: "conjunction" }).format(h)
502
+ );
503
+ }
504
+ s.unit === "month" && l.push(v(Pa(s.monthlyBy, i)));
505
+ } else
506
+ l.push(o(y(As[n])));
507
+ return u === "until" && f ? l.push(
508
+ /* The date picker's own short format, so the line and the Last
509
+ date field above it never print one day two ways. */
510
+ o(y("recurrenceSummaryUntil"), {
511
+ date: vd(f, gd(g))
512
+ })
513
+ ) : u === "count" && b && l.push(o(y("recurrenceSummaryCount"), { count: b })), l.join(" · ");
514
+ }
515
+ function ro({
516
+ value: n,
517
+ onChange: s,
518
+ start: i,
519
+ locale: u,
520
+ fieldClassName: b,
521
+ wideClassName: f
522
+ }) {
523
+ const { t: g } = le("ui"), o = (S) => `calendarWorkspace.editor.${S}`, y = wn(), v = wn(), l = Math.max(n.interval ?? 1, 1), k = Us(i), h = new Set(Ma(n, i)), D = Pa(n.monthlyBy, i), T = zs(k, u, "long");
524
+ return /* @__PURE__ */ c(ae, { children: [
525
+ /* @__PURE__ */ c(
526
+ "div",
527
+ {
528
+ className: `${b} ds:grid ds:grid-cols-[minmax(0,6rem)_minmax(0,1fr)] ds:items-start ds:gap-x-[var(--spacing-sm)]`,
529
+ children: [
530
+ /* @__PURE__ */ e(z, { label: g(o("recurrenceInterval")), children: /* @__PURE__ */ e(
531
+ Sa,
532
+ {
533
+ value: n.interval,
534
+ min: 1,
535
+ max: Ri,
536
+ onChange: (S) => s({ ...n, interval: S })
537
+ }
538
+ ) }),
539
+ /* @__PURE__ */ e(z, { label: g(o("recurrenceUnit")), children: /* @__PURE__ */ e(
540
+ be,
541
+ {
542
+ options: Qd.map((S) => ({
543
+ value: S,
544
+ label: g(o(Jd[S]), { count: l })
545
+ })),
546
+ value: n.unit,
547
+ onValueChange: (S) => s({ ...n, unit: S })
548
+ }
549
+ ) })
550
+ ]
551
+ }
552
+ ),
553
+ n.unit === "week" ? /* @__PURE__ */ c(
554
+ "div",
555
+ {
556
+ className: `${f} ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]`,
557
+ children: [
558
+ /* @__PURE__ */ e("span", { id: y, className: "type-label ds:text-foreground", children: g(o("recurrenceWeekdays")) }),
559
+ /* @__PURE__ */ e(
560
+ "div",
561
+ {
562
+ role: "group",
563
+ "aria-labelledby": y,
564
+ "aria-describedby": v,
565
+ "data-recurrence-weekdays": "",
566
+ className: "ds:flex ds:flex-wrap ds:gap-[var(--spacing-xs)]",
567
+ children: Ti.map((S) => {
568
+ const _ = S === k, B = h.has(S);
569
+ return /* @__PURE__ */ e(
570
+ te,
571
+ {
572
+ type: "button",
573
+ size: "sm",
574
+ intent: B ? "primary" : "outline",
575
+ "aria-pressed": B,
576
+ disabled: _,
577
+ "data-weekday": S,
578
+ className: "ds:[min-block-size:var(--accessible-target-floor,auto)]",
579
+ onClick: () => s({
580
+ ...n,
581
+ weekdays: B ? n.weekdays.filter((xe) => xe !== S) : [...n.weekdays, S]
582
+ }),
583
+ children: zs(S, u, "short")
584
+ },
585
+ S
586
+ );
587
+ })
588
+ }
589
+ ),
590
+ /* @__PURE__ */ e(
591
+ "span",
592
+ {
593
+ id: v,
594
+ className: "type-body-sm ds:text-[color:var(--muted-foreground)]",
595
+ children: g(o("recurrenceWeekdaysHint"), { weekday: T })
596
+ }
597
+ )
598
+ ]
599
+ }
600
+ ) : null,
601
+ n.unit === "month" ? /* @__PURE__ */ e(
602
+ z,
603
+ {
604
+ className: f,
605
+ label: g(o("recurrenceWeekdays")),
606
+ children: /* @__PURE__ */ e(
607
+ be,
608
+ {
609
+ options: Li(i).map((S) => ({
610
+ value: S,
611
+ label: S === "monthDay" ? g(o("recurrenceMonthDay"), { day: i.getDate() }) : S === "lastWeekday" ? g(o("recurrenceLastWeekday"), { weekday: T }) : g(o("recurrenceNthWeekday"), {
612
+ weekday: T,
613
+ ordinal: g(o(Ei[Hs(i).nth]))
614
+ })
615
+ })),
616
+ value: D,
617
+ onValueChange: (S) => s({ ...n, monthlyBy: S })
618
+ }
619
+ )
620
+ }
621
+ ) : null
622
+ ] });
623
+ }
624
+ function oo({
625
+ summary: n,
626
+ className: s
627
+ }) {
628
+ return /* @__PURE__ */ c(
629
+ "p",
630
+ {
631
+ "data-recurrence-summary": "",
632
+ className: `${s} type-body-sm ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]`,
633
+ children: [
634
+ /* @__PURE__ */ e(pd, { "aria-hidden": "true", className: "ds:size-4 ds:shrink-0" }),
635
+ /* @__PURE__ */ e("span", { children: n })
636
+ ]
637
+ }
638
+ );
639
+ }
640
+ function Ai(n, s, i) {
641
+ const u = s.map(i);
642
+ if (u.length === 0 || u.some((f) => f.length === 0))
643
+ return { list: [...n], restricted: !1 };
644
+ const b = new Set(u.flat());
645
+ return {
646
+ list: n.filter((f) => b.has(f.id)),
647
+ restricted: !0
648
+ };
649
+ }
650
+ function Da(n, s) {
651
+ return Ai(s, n, (i) => i.operatorIds);
652
+ }
653
+ function Ea(n, s) {
654
+ return Ai(s, n, (i) => i.chairIds);
655
+ }
656
+ function gn(n, s) {
657
+ return s.list.some((i) => i.id === n);
658
+ }
659
+ const ie = (n) => `calendarWorkspace.inc1.bookings.${n}`, co = "confirmed";
660
+ function lo(n) {
661
+ if (!n || !/^\+?[\d\s().-]+$/.test(n.trim())) return null;
662
+ const s = n.replace(/\D/g, "");
663
+ return s.length >= 7 && s.length <= 15 ? s : null;
664
+ }
665
+ function _s(n, s) {
666
+ try {
667
+ return new Intl.DateTimeFormat(n, {
668
+ weekday: "short",
669
+ day: "numeric",
670
+ month: "short"
671
+ }).format(s);
672
+ } catch {
673
+ return Rn(n, s);
674
+ }
675
+ }
676
+ const uo = "ds:sm:[min-block-size:var(--accessible-target-floor,0px)] ds:[min-inline-size:var(--accessible-target-floor,auto)]", _n = ds(`${uo} ds:whitespace-nowrap`), ho = ds(
677
+ [
678
+ "ds:relative ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-sm)]",
679
+ "ds:rounded-[var(--radius-md)] ds:p-[var(--spacing-sm)]",
680
+ "ds:[:where(&)]:border-[length:var(--surface-border-width,var(--border-width-sm))] ds:border-[color:var(--card-border)]",
681
+ "ds:text-[color:var(--card-foreground)] ds:shadow-[var(--shadow-sm)]",
682
+ "ds:forced-colors:border-[CanvasText]",
683
+ "ds:focus:outline-[length:var(--focus-ring-width)] ds:focus:outline-solid ds:focus:outline-[color:var(--ring)] ds:focus:outline-offset-[length:var(--focus-ring-offset)]"
684
+ ].join(" "),
685
+ {
686
+ variants: {
687
+ /* A new booking wears a steady, faint accent tint; the Badge beside
688
+ its title is the channel that is not colour. */
689
+ tint: {
690
+ none: "ds:bg-[var(--card)]",
691
+ new: "ds:bg-[color:color-mix(in_srgb,var(--accent)_5%,var(--card))]"
692
+ }
693
+ },
694
+ defaultVariants: { tint: "none" }
695
+ }
696
+ ), mo = ds(
697
+ [
698
+ "ds:pointer-events-none ds:absolute ds:inset-0 ds:rounded-[var(--radius-md)]",
699
+ // Clear at rest; the accessible themes hold it steady (--accessible-on
700
+ // is 1 there) instead of playing it.
701
+ "ds:border-2 ds:border-[color:var(--accent)] ds:opacity-[var(--accessible-on,0)]",
702
+ "ds:animate-[var(--accessible-off,booking-addressed_calc(var(--animation-duration)*9)_var(--ease-in-out))]",
703
+ "ds:motion-reduce:animate-none ds:motion-reduce:opacity-100",
704
+ "ds:forced-colors:border-[Highlight]"
705
+ ].join(" ")
706
+ ), go = ds(
707
+ "ds:min-w-0 ds:truncate type-title-item ds:text-[color:var(--foreground)]"
708
+ ), oi = ds(
709
+ "ds:inline-flex ds:size-8 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-full)] ds:bg-[color:var(--muted)] ds:text-[color:var(--muted-foreground)]"
710
+ ), vo = [
711
+ "ds:inline-flex ds:min-w-0 ds:flex-1 ds:basis-24 ds:cursor-pointer",
712
+ "ds:border-0 ds:bg-transparent ds:p-0 ds:text-start",
713
+ "ds:focus-visible:outline-none",
714
+ "ds:after:absolute ds:after:inset-0 ds:after:rounded-[var(--radius-sm)] ds:after:content-['']",
715
+ "ds:focus-visible:after:outline-[length:var(--focus-ring-width)]",
716
+ "ds:focus-visible:after:outline-solid",
717
+ "ds:focus-visible:after:outline-[color:var(--ring)]",
718
+ "ds:focus-visible:after:outline-offset-[length:var(--focus-ring-offset)]",
719
+ "ds:forced-colors:focus-visible:after:outline-[CanvasText]"
720
+ ].join(" "), po = "type-eyebrow ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-2xs)] ds:text-[color:var(--muted-foreground)]", Oi = pr(
721
+ ({
722
+ view: n,
723
+ locale: s,
724
+ privacy: i = !1,
725
+ canComplete: u,
726
+ onComplete: b,
727
+ onShowInCalendar: f,
728
+ addressed: g = !1,
729
+ addressKey: o
730
+ }, y) => {
731
+ var pe;
732
+ const { t: v } = le("ui"), l = Ye(), k = s ?? "en", { row: h } = n, D = Er(
733
+ h,
734
+ i,
735
+ l,
736
+ v("calendarWorkspace.details.patientNotLoaded")
737
+ ), T = Tr(h.event, l).record, S = i ? void 0 : l.bookingContacts[n.eventId], _ = lo(S == null ? void 0 : S.phone), B = ((pe = D.patient) == null ? void 0 : pe.name) ?? v(ie("needsPatient")), xe = Rn(k, n.start), A = (Q) => v(ie("actionNamed"), { action: Q, who: B, when: xe }), de = (Q) => {
738
+ u && (b == null || b(h, Q));
739
+ }, ke = [
740
+ n.needsPatient,
741
+ n.needsOperator,
742
+ n.needsChair
743
+ ].filter(Boolean).length > 1, R = D.state, H = Sd(R ?? ""), d = H.Icon, tn = D.type === "telehealth" ? fd : fi, t = v(ie("whatsapp"));
744
+ let E;
745
+ return D.patient ? i ? E = /* @__PURE__ */ e("span", { className: oi(), children: /* @__PURE__ */ e(ii, { "aria-hidden": "true", className: "ds:size-4" }) }) : E = /* @__PURE__ */ e(
746
+ gi,
747
+ {
748
+ name: D.patient.name,
749
+ src: T == null ? void 0 : T.avatarSrc,
750
+ size: "sm",
751
+ className: "ds:shrink-0",
752
+ "aria-hidden": "true",
753
+ role: "presentation",
754
+ "aria-label": void 0
755
+ }
756
+ ) : E = /* @__PURE__ */ e("span", { className: oi(), children: /* @__PURE__ */ e(kd, { "aria-hidden": "true", className: "ds:size-4" }) }), /* @__PURE__ */ c(
757
+ "div",
758
+ {
759
+ ref: y,
760
+ role: "listitem",
761
+ "data-component": "calendar-booking-card",
762
+ "data-booking-id": n.eventId,
763
+ "data-new": n.isNew ? "" : void 0,
764
+ "data-addressed": g ? "" : void 0,
765
+ "aria-current": g ? "true" : void 0,
766
+ tabIndex: g ? -1 : void 0,
767
+ className: ho({ tint: n.isNew ? "new" : "none" }),
768
+ children: [
769
+ g ? /* @__PURE__ */ c(ae, { children: [
770
+ /* @__PURE__ */ e("span", { className: "ds:sr-only", children: v(ie("current")) }),
771
+ /* @__PURE__ */ e(
772
+ "span",
773
+ {
774
+ "aria-hidden": "true",
775
+ "data-booking-ring": "addressed",
776
+ className: mo()
777
+ },
778
+ `${n.eventId}:${o ?? ""}`
779
+ )
780
+ ] }) : null,
781
+ /* @__PURE__ */ c("div", { className: "ds:relative ds:flex ds:min-w-0 ds:flex-wrap ds:items-start ds:gap-[var(--spacing-sm)]", children: [
782
+ /* @__PURE__ */ c("span", { className: "ds:flex ds:min-w-20 ds:shrink-0 ds:flex-col ds:items-start ds:gap-[var(--spacing-2xs)]", children: [
783
+ /* @__PURE__ */ c("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:whitespace-nowrap ds:text-[color:var(--muted-foreground)]", children: [
784
+ /* @__PURE__ */ e(
785
+ tn,
786
+ {
787
+ "aria-hidden": "true",
788
+ className: "ds:size-3.5 ds:shrink-0"
789
+ }
790
+ ),
791
+ /* @__PURE__ */ e("span", { className: "ds:sr-only", children: v(`appointmentCard.type.${D.type}`) }),
792
+ /* @__PURE__ */ e(
793
+ Aa,
794
+ {
795
+ value: D.startIso,
796
+ format: "absolute",
797
+ shape: "bare",
798
+ locale: s,
799
+ absoluteFormat: { hour: "numeric", minute: "2-digit" },
800
+ className: "type-body-sm ds:font-medium ds:text-[color:var(--foreground)] ds:tabular-nums"
801
+ }
802
+ )
803
+ ] }),
804
+ /* @__PURE__ */ e("span", { className: "type-eyebrow ds:text-[color:var(--muted-foreground)]", children: v("appointmentCard.duration", { count: D.durationMin }) })
805
+ ] }),
806
+ E,
807
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:basis-40 ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
808
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:min-w-0 ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-2xs)]", children: [
809
+ /* @__PURE__ */ e(
810
+ "button",
811
+ {
812
+ type: "button",
813
+ className: vo,
814
+ "aria-label": A(
815
+ v(ie(u ? "edit" : "showInCalendar"))
816
+ ),
817
+ onClick: () => u ? de() : f(n.eventId),
818
+ children: /* @__PURE__ */ e("span", { className: go(), children: B })
819
+ }
820
+ ),
821
+ n.isNew ? /* @__PURE__ */ e(an, { size: "sm", variant: "brand", "data-booking-new": "", children: v(ie("new")) }) : null,
822
+ n.bookedOnline ? /* @__PURE__ */ e(
823
+ an,
824
+ {
825
+ size: "sm",
826
+ variant: "info",
827
+ leading: /* @__PURE__ */ e(Ni, { "aria-hidden": "true" }),
828
+ "data-booking-online": "",
829
+ children: v("calendarWorkspace.details.indicators.bookedOnline")
830
+ }
831
+ ) : null,
832
+ n.paidOnline !== null && n.paidOnline > 0 ? (
833
+ /* The details panel's own name for this money, so the same
834
+ deposit reads the same on both surfaces. */
835
+ /* @__PURE__ */ e(
836
+ bd,
837
+ {
838
+ "data-booking-paid": "",
839
+ state: "settled",
840
+ amount: n.paidOnline,
841
+ currency: l.currency ?? "EUR",
842
+ locale: s,
843
+ size: "sm",
844
+ showLabel: !0,
845
+ label: v("calendarWorkspace.details.paidOnline"),
846
+ showIcon: !1
847
+ }
848
+ )
849
+ ) : null,
850
+ R && R !== co ? /* @__PURE__ */ e(
851
+ yd,
852
+ {
853
+ size: "sm",
854
+ value: R,
855
+ option: {
856
+ value: R,
857
+ label: v(`appointmentCard.state.${R}`),
858
+ icon: /* @__PURE__ */ e(d, { "aria-hidden": "true" }),
859
+ tone: H.tone
860
+ },
861
+ className: "ds:shrink-0"
862
+ }
863
+ ) : null
864
+ ] }),
865
+ /* @__PURE__ */ c("div", { className: po, children: [
866
+ D.operator ? /* @__PURE__ */ e("span", { children: D.operator.name }) : null,
867
+ /* @__PURE__ */ e("span", { children: _s(k, n.start) }),
868
+ n.chairTitle ? /* @__PURE__ */ c("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]", children: [
869
+ /* @__PURE__ */ e(
870
+ wa,
871
+ {
872
+ "aria-hidden": "true",
873
+ className: "ds:size-3 ds:shrink-0"
874
+ }
875
+ ),
876
+ n.chairTitle
877
+ ] }) : null,
878
+ n.needsPatient ? /* @__PURE__ */ e(an, { size: "sm", variant: "neutral", children: v(ie("needsPatient")) }) : null,
879
+ n.needsOperator ? /* @__PURE__ */ e(an, { size: "sm", variant: "neutral", children: v(ie("needsOperator")) }) : null,
880
+ n.needsChair ? /* @__PURE__ */ e(an, { size: "sm", variant: "neutral", children: v(ie("needsChair")) }) : null
881
+ ] }),
882
+ i ? /* @__PURE__ */ c("span", { className: "type-body-sm ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
883
+ /* @__PURE__ */ e(
884
+ ii,
885
+ {
886
+ "aria-hidden": "true",
887
+ className: "ds:size-3.5 ds:shrink-0"
888
+ }
889
+ ),
890
+ v("calendarWorkspace.privacy.hidden")
891
+ ] }) : /* @__PURE__ */ e("span", { className: "type-body-sm ds:truncate ds:text-[color:var(--foreground)]", children: n.reason ?? v(ie("noReason")) }),
892
+ D.treatments && D.treatments.length > 0 ? /* @__PURE__ */ e("div", { className: "ds:flex ds:flex-wrap ds:gap-[var(--spacing-2xs)]", children: D.treatments.map((Q, r) => /* @__PURE__ */ e(
893
+ Ws,
894
+ {
895
+ label: Q.careName,
896
+ variant: "neutral",
897
+ fill: "outline",
898
+ size: "sm",
899
+ maxInlineSize: "12rem"
900
+ },
901
+ `${Q.careName}-${r}`
902
+ )) }) : null
903
+ ] })
904
+ ] }),
905
+ S ? (
906
+ /* Host-redacted contact values are display text, never dial
907
+ or email actions. */
908
+ /* @__PURE__ */ e(
909
+ "div",
910
+ {
911
+ "data-booking-contact": "",
912
+ className: "type-body-sm ds:flex ds:min-w-0 ds:flex-wrap ds:gap-x-[var(--spacing-sm)] ds:text-[color:var(--muted-foreground)] ds:[overflow-wrap:anywhere]",
913
+ children: [
914
+ { value: S.typedName, ltr: !1 },
915
+ // Phone and email are LTR data even in an RTL paragraph —
916
+ // without `dir="ltr"` the digits/punctuation can reorder.
917
+ { value: S.phone, ltr: !0 },
918
+ { value: S.email, ltr: !0 }
919
+ ].filter((Q) => Q.value.trim() !== "").map((Q) => /* @__PURE__ */ e(
920
+ "span",
921
+ {
922
+ className: "ds:min-w-0",
923
+ dir: Q.ltr ? "ltr" : void 0,
924
+ children: Q.value
925
+ },
926
+ Q.value
927
+ ))
928
+ }
929
+ )
930
+ ) : null,
931
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:min-w-0 ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)] ds:border-t ds:border-[color:var(--border)] ds:pt-[var(--spacing-sm)]", children: [
932
+ n.bookedAt ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:min-w-0 ds:truncate ds:text-[color:var(--muted-foreground)]", children: v(ie("bookedOn"), {
933
+ date: _s(k, n.bookedAt)
934
+ }) }) : null,
935
+ /* @__PURE__ */ c(
936
+ yi,
937
+ {
938
+ size: "sm",
939
+ overflow: "menu",
940
+ label: A(v(ie("actionsLabel"))),
941
+ "data-booking-actions": "",
942
+ className: "ds:ms-auto ds:min-w-0",
943
+ children: [
944
+ u && n.needsPatient ? /* @__PURE__ */ e(
945
+ te,
946
+ {
947
+ intent: "primary",
948
+ startIcon: /* @__PURE__ */ e(Nd, {}),
949
+ className: _n(),
950
+ "aria-label": A(v(ie("assignPatient"))),
951
+ "data-booking-action": "assign-patient",
952
+ onClick: () => de("patient"),
953
+ children: v(
954
+ ie(
955
+ ke ? "assignPatientShort" : "assignPatient"
956
+ )
957
+ )
958
+ },
959
+ "patient"
960
+ ) : null,
961
+ u && n.needsOperator ? /* @__PURE__ */ e(
962
+ te,
963
+ {
964
+ intent: "primary",
965
+ startIcon: /* @__PURE__ */ e(xd, {}),
966
+ className: _n(),
967
+ "aria-label": A(v(ie("assignOperator"))),
968
+ "data-booking-action": "assign-operator",
969
+ onClick: () => de("operator"),
970
+ children: v(
971
+ ie(
972
+ ke ? "assignOperatorShort" : "assignOperator"
973
+ )
974
+ )
975
+ },
976
+ "operator"
977
+ ) : null,
978
+ u && n.needsChair ? /* @__PURE__ */ e(
979
+ te,
980
+ {
981
+ intent: "primary",
982
+ startIcon: /* @__PURE__ */ e(wa, {}),
983
+ className: _n(),
984
+ "aria-label": A(v(ie("assignChair"))),
985
+ "data-booking-action": "assign-chair",
986
+ onClick: () => de("chair"),
987
+ children: v(
988
+ ie(ke ? "assignChairShort" : "assignChair")
989
+ )
990
+ },
991
+ "chair"
992
+ ) : null,
993
+ /* @__PURE__ */ e(
994
+ ve,
995
+ {
996
+ icon: /* @__PURE__ */ e(Cd, {}),
997
+ className: _n(),
998
+ "aria-label": v(ie("showInCalendarNamed"), { when: xe }),
999
+ tooltip: v(ie("showInCalendar")),
1000
+ "data-booking-action": "show",
1001
+ onClick: () => f(n.eventId)
1002
+ },
1003
+ "show"
1004
+ ),
1005
+ u && !ke ? /* @__PURE__ */ e(
1006
+ ve,
1007
+ {
1008
+ icon: /* @__PURE__ */ e(Id, {}),
1009
+ className: _n(),
1010
+ "aria-label": A(v(ie("edit"))),
1011
+ tooltip: v(ie("edit")),
1012
+ "data-booking-action": "edit",
1013
+ onClick: () => de()
1014
+ },
1015
+ "edit"
1016
+ ) : null,
1017
+ _ ? /* @__PURE__ */ e(
1018
+ ve,
1019
+ {
1020
+ icon: /* @__PURE__ */ e(bi, { "aria-hidden": "true" }),
1021
+ className: _n(),
1022
+ "aria-label": A(t),
1023
+ tooltip: t,
1024
+ "data-booking-action": "whatsapp",
1025
+ onClick: () => {
1026
+ window.open(
1027
+ `https://wa.me/${_}`,
1028
+ "_blank",
1029
+ "noopener,noreferrer"
1030
+ );
1031
+ }
1032
+ },
1033
+ "whatsapp"
1034
+ ) : null
1035
+ ]
1036
+ }
1037
+ )
1038
+ ] })
1039
+ ]
1040
+ }
1041
+ );
1042
+ }
1043
+ );
1044
+ Oi.displayName = "BookingCard";
1045
+ function bo() {
1046
+ return /* @__PURE__ */ e(
1047
+ "div",
1048
+ {
1049
+ "aria-hidden": "true",
1050
+ "data-bookings-loading": "",
1051
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1052
+ children: [0, 1, 2].map((n) => /* @__PURE__ */ c(
1053
+ "div",
1054
+ {
1055
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)] ds:p-[var(--spacing-sm)]",
1056
+ children: [
1057
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:items-start ds:gap-[var(--spacing-sm)]", children: [
1058
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:w-20 ds:shrink-0 ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1059
+ /* @__PURE__ */ e(
1060
+ In,
1061
+ {
1062
+ variant: "text",
1063
+ size: "sm",
1064
+ stagger: n * 2,
1065
+ width: "70%"
1066
+ }
1067
+ ),
1068
+ /* @__PURE__ */ e(
1069
+ In,
1070
+ {
1071
+ variant: "text",
1072
+ size: "sm",
1073
+ stagger: n * 2,
1074
+ width: "50%"
1075
+ }
1076
+ )
1077
+ ] }),
1078
+ /* @__PURE__ */ e(In, { variant: "circular", size: "sm", stagger: n * 2 }),
1079
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1080
+ /* @__PURE__ */ e(
1081
+ In,
1082
+ {
1083
+ variant: "text",
1084
+ size: "sm",
1085
+ stagger: n * 2,
1086
+ width: n === 1 ? "40%" : "60%"
1087
+ }
1088
+ ),
1089
+ /* @__PURE__ */ e(
1090
+ In,
1091
+ {
1092
+ variant: "text",
1093
+ size: "sm",
1094
+ stagger: n * 2 + 1,
1095
+ width: "80%"
1096
+ }
1097
+ ),
1098
+ /* @__PURE__ */ e(
1099
+ In,
1100
+ {
1101
+ variant: "text",
1102
+ size: "sm",
1103
+ stagger: n * 2 + 1,
1104
+ width: "33%"
1105
+ }
1106
+ )
1107
+ ] })
1108
+ ] }),
1109
+ /* @__PURE__ */ e("div", { className: "ds:border-t ds:border-[color:var(--border)] ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ e(
1110
+ In,
1111
+ {
1112
+ variant: "rounded",
1113
+ stagger: n * 2 + 1,
1114
+ width: "66%",
1115
+ height: "var(--spacing-xl)"
1116
+ }
1117
+ ) })
1118
+ ]
1119
+ },
1120
+ n
1121
+ ))
1122
+ }
1123
+ );
1124
+ }
1125
+ function Vs(n) {
1126
+ return n.operators.filter((s) => !n.inactiveOperatorIds.includes(s.id));
1127
+ }
1128
+ function pl(n) {
1129
+ return n.unresolved ? "calendarWorkspace.details.patientNotLoaded" : n.assigned && nd(n, "sms") === "unknown" ? "calendarWorkspace.details.patientPhoneUnknown" : "calendarWorkspace.waitingList.whatsappDisabled";
1130
+ }
1131
+ function bl(n) {
1132
+ return /* @__PURE__ */ e(yo, { ...n }, n.patientId);
1133
+ }
1134
+ function yo({
1135
+ patientId: n,
1136
+ seam: s,
1137
+ editable: i = !1,
1138
+ currentNoteId: u,
1139
+ currentNoteKey: b
1140
+ }) {
1141
+ const f = Ye(), g = ((s == null ? void 0 : s.notes) ?? f.patientNotes(n)).map(
1142
+ (k) => {
1143
+ var h;
1144
+ return k.clinical ? {
1145
+ ...k,
1146
+ actions: ((h = k.actions) == null ? void 0 : h.edit) === void 0 ? { ...k.actions, edit: !1 } : k.actions,
1147
+ keptOnDelete: k.keptOnDelete ?? !0
1148
+ } : k;
1149
+ }
1150
+ ), o = s !== void 0 && (s.writable ?? (s.onLoad ? !1 : i)), y = P(s);
1151
+ y.current = s;
1152
+ const v = P(null), l = !!(s != null && s.onLoad);
1153
+ return V(() => {
1154
+ const k = y.current;
1155
+ k != null && k.onLoad && k.complete !== !0 && (k == null ? void 0 : k.status) !== "loading" && (k == null ? void 0 : k.status) !== "error" && v.current !== n && (v.current = n, k.onLoad("all"));
1156
+ }, [n, s == null ? void 0 : s.status, s == null ? void 0 : s.complete, l]), /* @__PURE__ */ e(
1157
+ ad,
1158
+ {
1159
+ notes: g,
1160
+ status: (s == null ? void 0 : s.status) ?? (s != null && s.onLoad ? "loading" : "ready"),
1161
+ onRetry: s == null ? void 0 : s.onRetry,
1162
+ canAddClinicalNote: (s == null ? void 0 : s.canAddClinicalNote) ?? !(s != null && s.onLoad),
1163
+ currentNoteId: u,
1164
+ currentNoteKey: b,
1165
+ onRequestAiDraft: o ? s == null ? void 0 : s.onRequestAiDraft : void 0,
1166
+ onDictate: o ? s == null ? void 0 : s.onDictate : void 0,
1167
+ aiConsent: o ? s == null ? void 0 : s.aiConsent : void 0,
1168
+ variables: o ? s == null ? void 0 : s.variables : void 0,
1169
+ validateVariable: o ? s == null ? void 0 : s.validateVariable : void 0,
1170
+ onVariableValidityChange: o ? s == null ? void 0 : s.onVariableValidityChange : void 0,
1171
+ renderHelpMeWrite: o ? s == null ? void 0 : s.renderHelpMeWrite : void 0,
1172
+ aiTemplates: o ? s == null ? void 0 : s.aiTemplates : void 0,
1173
+ onAiApplied: o ? s == null ? void 0 : s.onAiApplied : void 0,
1174
+ onUploadImage: o ? s == null ? void 0 : s.onUploadImage : void 0,
1175
+ onAiCreditsExhausted: o ? s == null ? void 0 : s.onAiCreditsExhausted : void 0,
1176
+ showExtensions: o ? s == null ? void 0 : s.showExtensions : void 0,
1177
+ aiCreditsNotice: o ? s == null ? void 0 : s.aiCreditsNotice : void 0,
1178
+ extensions: o ? s == null ? void 0 : s.extensions : void 0,
1179
+ extensionContext: o ? s == null ? void 0 : s.extensionContext : void 0,
1180
+ onExtensionRun: o ? s == null ? void 0 : s.onExtensionRun : void 0,
1181
+ composerBefore: o ? s == null ? void 0 : s.composerBefore : void 0,
1182
+ composerAfter: o ? s == null ? void 0 : s.composerAfter : void 0,
1183
+ onAddNote: o ? s == null ? void 0 : s.onAddNote : void 0,
1184
+ onEditNote: o && s ? (k, h) => s.onEditNote(k, h.content) : void 0,
1185
+ onDeleteNote: o ? s == null ? void 0 : s.onDeleteNote : void 0,
1186
+ onTogglePin: o ? s == null ? void 0 : s.onTogglePin : void 0,
1187
+ onToggleFlag: o ? s == null ? void 0 : s.onToggleFlag : void 0,
1188
+ onWriteError: o ? s == null ? void 0 : s.onWriteError : void 0
1189
+ }
1190
+ );
1191
+ }
1192
+ function Pi({
1193
+ value: n,
1194
+ onChange: s
1195
+ }) {
1196
+ const { t: i } = le("ui"), u = i("calendarWorkspace.editor.durationUnit"), b = ye(() => (Ca.includes(n ?? -1) ? Ca : [...Ca, ...n != null ? [n] : []].sort(
1197
+ (g, o) => g - o
1198
+ )).map((g) => ({ value: String(g), label: `${g} ${u}` })), [n, u]);
1199
+ return /* @__PURE__ */ e(
1200
+ La,
1201
+ {
1202
+ options: b,
1203
+ value: n != null ? String(n) : "",
1204
+ onValueChange: (f) => s(f ? Number(f) : null),
1205
+ filter: Yr,
1206
+ allowCreate: !0,
1207
+ onCreate: (f) => {
1208
+ const g = Number.parseInt(f.replace(/\D/g, ""), 10);
1209
+ Number.isNaN(g) || s(Math.min(480, Math.max(5, g)));
1210
+ }
1211
+ }
1212
+ );
1213
+ }
1214
+ const ko = [
1215
+ "whatsapp",
1216
+ "sms",
1217
+ "email"
1218
+ ], fo = "ds:@container/apptform", No = `ds:m-0 ds:grid ds:min-w-0 ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:border-0 ds:p-[var(--spacing-md)] ds:@[480px]/apptform:grid-cols-2 ds:@[704px]/apptform:grid-cols-3 ${ki}`, Y = "ds:col-span-full ds:min-w-0", Ls = "ds:min-w-0 ds:[&>div]:min-w-0", Be = `${Ls} ds:@[704px]/apptform:grid ds:@[704px]/apptform:grid-cols-[minmax(0,max-content)_minmax(0,1fr)] ds:@[704px]/apptform:items-center ds:@[704px]/apptform:gap-x-[var(--spacing-sm)]`;
1219
+ function yl({
1220
+ prefill: n,
1221
+ onSave: s,
1222
+ onDelete: i,
1223
+ onDeleteInitiated: u,
1224
+ onDuplicate: b,
1225
+ panelTitle: f,
1226
+ headerIcon: g,
1227
+ identity: o,
1228
+ after: y,
1229
+ closeOnSave: v = !0,
1230
+ returnsOnCancel: l = !1,
1231
+ onDraftChange: k,
1232
+ onPatientContextChange: h,
1233
+ slotPatch: D,
1234
+ locale: T,
1235
+ scheduleByEntry: S = zr,
1236
+ history: _,
1237
+ noteUnrecordedEdits: B,
1238
+ onMove: xe,
1239
+ onCopy: A,
1240
+ onWhatsApp: de,
1241
+ readOnly: X = !1,
1242
+ capabilities: ke,
1243
+ series: R,
1244
+ onRecurringScopeChosen: H,
1245
+ platform: d,
1246
+ className: tn
1247
+ }) {
1248
+ var Wt, $t, Ft, zt, _t, Vt;
1249
+ const { t } = le("ui"), E = Ye(), { t: pe, i18n: Q } = le("ui"), r = (a) => `calendarWorkspace.editor.${a}`, F = (a) => `calendarWorkspace.details.${a}`, G = (a) => `calendarWorkspace.bookingTriage.${a}`, { close: _e, open: Ce } = Si(), ue = fr(), w = !!(n != null && n.editEventId), Dn = w && !X ? R == null ? void 0 : R.scopes : void 0, Vn = R != null && R.detached ? void 0 : Dn, [Ie, Gs] = N(), [Hn, vn] = N(!1), Ve = !!Vn && (!Ie || Hn), rn = Ie ?? (R != null && R.detached ? "this" : void 0), W = rn ? { ...ke, ...(Wt = R == null ? void 0 : R.capabilitiesByScope) == null ? void 0 : Wt[rn] } : ke, De = (W == null ? void 0 : W.editCare) !== !1, Xe = (W == null ? void 0 : W.editPatient) === !1, He = (d == null ? void 0 : d.operatorOptions) ?? Vs(E), [dn, Un] = N(!1), [me, Ks] = N(!1), [ee, En] = N(), [qs, Gn] = N(!1), Ue = wn(), We = P(!1), Qe = P(!1), fe = P(!0);
1250
+ V(() => (fe.current = !0, () => {
1251
+ fe.current = !1;
1252
+ }), []);
1253
+ const [M, pn] = N((n == null ? void 0 : n.patientId) ?? ""), [bn, Kn] = N(), [os, cs] = N(!1), qn = P(!1), on = d == null ? void 0 : d.createPatientFromBooking, yn = async () => {
1254
+ const a = n == null ? void 0 : n.bookingContact;
1255
+ if (!(!a || !on || os)) {
1256
+ cs(!0), En(void 0);
1257
+ try {
1258
+ const m = await on({
1259
+ name: a.typedName,
1260
+ phone: a.phone,
1261
+ email: a.email
1262
+ });
1263
+ m && fe.current && (Kn({ id: m.id, name: m.name }), qn.current = !0, pn(m.id), Mn(!0), Yn(!0));
1264
+ } catch (m) {
1265
+ fe.current && En(
1266
+ m instanceof Error && m.message.trim() ? m.message : t(G("createPatientFailed"))
1267
+ );
1268
+ } finally {
1269
+ fe.current && cs(!1);
1270
+ }
1271
+ }
1272
+ };
1273
+ V(() => {
1274
+ Xe && pn((n == null ? void 0 : n.patientId) ?? "");
1275
+ }, [Xe, n == null ? void 0 : n.patientId]), V(() => {
1276
+ h == null || h(M || void 0);
1277
+ }, [M, h]);
1278
+ const [Je, Tn] = N(
1279
+ n != null && n.isTelehealth ? "telehealth" : "in_practice"
1280
+ ), [O, Ln] = N(
1281
+ () => (n == null ? void 0 : n.date) ?? Lr(E.initialDateIso, E.nowIso)
1282
+ ), [ge, jn] = N(
1283
+ (n == null ? void 0 : n.time) ?? { hours: 9, minutes: 0 }
1284
+ ), [Oe, An] = N(
1285
+ (n == null ? void 0 : n.durationMin) ?? 30
1286
+ ), [se, On] = N(
1287
+ (n == null ? void 0 : n.operatorId) ?? (!w && He.length === 1 ? He[0].id : q)
1288
+ ), [oe, kn] = N(
1289
+ (n == null ? void 0 : n.chairId) ?? (!w && E.chairs.length === 1 ? E.chairs[0].id : q)
1290
+ ), [Pn, ls] = N(
1291
+ () => w ? (n == null ? void 0 : n.colorHex) ?? "" : Ar(n)
1292
+ ), [Ge, js] = N((n == null ? void 0 : n.care) ?? ""), Ze = !w || !!(n != null && n.bookingContact), [Ke, Mn] = N(
1293
+ Ze ? (($t = d == null ? void 0 : d.defaultReminders) == null ? void 0 : $t.email) === !0 : (n == null ? void 0 : n.emailReminder) === !0
1294
+ ), [$e, Yn] = N(
1295
+ Ze ? ((Ft = d == null ? void 0 : d.defaultReminders) == null ? void 0 : Ft.sms) === !0 : (n == null ? void 0 : n.smsReminder) === !0
1296
+ ), [cn, Bn] = N(
1297
+ (n == null ? void 0 : n.firstVisit) ?? "unknown"
1298
+ ), Ys = P({ emailReminder: Ke, smsReminder: $e, firstVisit: cn }), p = (a, m) => !w || !!(n != null && n.bookingContact) || (n == null ? void 0 : n[a]) !== void 0 || m !== Ys.current[a], x = n == null ? void 0 : n.careLink, [I, J] = N((x == null ? void 0 : x.kind) ?? q), [K, ce] = N(
1299
+ (x == null ? void 0 : x.kind) === "plan" ? x.planId : ""
1300
+ ), [Pe, Fe] = N(
1301
+ () => (x == null ? void 0 : x.kind) === "plan" ? [...x.entryIds] : []
1302
+ ), [qe, Xn] = N(
1303
+ () => (x == null ? void 0 : x.kind) === "plan" ? { ...x.phasesByEntry } : {}
1304
+ ), [fn, Qn] = N(
1305
+ () => (x == null ? void 0 : x.kind) === "priceList" ? x.priceListId : Kt(n == null ? void 0 : n.patientId, E) ?? ""
1306
+ ), Wn = P(0), [je, $n] = N(
1307
+ () => (x == null ? void 0 : x.kind) === "priceList" && x.items.length > 0 ? x.items.map((a) => ({
1308
+ key: Wn.current += 1,
1309
+ careId: a.careId,
1310
+ priceCents: a.priceCents,
1311
+ phases: a.phases ? [...a.phases] : void 0,
1312
+ billed: ui(a),
1313
+ billing: a.billing
1314
+ })) : [{ key: Wn.current += 1, careId: "", priceCents: null }]
1315
+ ), Jn = T ?? Q.language ?? "en", Se = ye(
1316
+ () => M ? E.openCarePlansForPatient(M) : [],
1317
+ [M, E]
1318
+ ), Zn = P(M);
1319
+ V(() => {
1320
+ if (!w && (Se.length > 0 ? (J((a) => a === "priceList" ? a : "plan"), ce(
1321
+ (a) => Se.some((m) => m.id === a) ? a : Se[0].id
1322
+ )) : (J((a) => a === "plan" ? q : a), ce("")), Zn.current !== M)) {
1323
+ Zn.current = M;
1324
+ const a = Kt(M || void 0, E) ?? "";
1325
+ Qn(a), a === "" && J((m) => m === "priceList" ? q : m);
1326
+ }
1327
+ }, [w, Se, M, E]);
1328
+ const he = K ? E.carePlanById(K) : void 0, Ba = E.priceLists ?? [], Bi = Or(E), Wa = jr(Bi), $a = Wa || I === "priceList", Wi = w || $a || Se.length > 0, $i = he && !Se.some((a) => a.id === he.id) ? [he, ...Se] : Se, Fa = he ? he.entries.filter((a) => !a.done || Pe.includes(a.id)) : [], Fi = (a) => Pe.includes(a.id) ? a.phases && a.phases.length > 0 && (qe[a.id] ?? []).length < a.phases.length ? "indeterminate" : !0 : !1, zi = (a, m) => {
1329
+ const C = m !== !1;
1330
+ Fe(
1331
+ (U) => C ? U.includes(a.id) ? U : [...U, a.id] : U.filter(($) => $ !== a.id)
1332
+ ), Xn((U) => {
1333
+ const $ = { ...U };
1334
+ return C && a.phases && a.phases.length > 0 ? $[a.id] = [...a.phases] : delete $[a.id], $;
1335
+ });
1336
+ }, _i = (a, m, C) => {
1337
+ const U = qe[a.id] ?? [], $ = C === !0 ? U.includes(m) ? U : [...U, m] : U.filter((Ne) => Ne !== m), ne = (a.phases ?? []).filter((Ne) => $.includes(Ne));
1338
+ Xn((Ne) => {
1339
+ const j = { ...Ne };
1340
+ return ne.length > 0 ? j[a.id] = ne : delete j[a.id], j;
1341
+ }), Fe(
1342
+ (Ne) => ne.length > 0 ? Ne.includes(a.id) ? Ne : [...Ne, a.id] : Ne.filter((j) => j !== a.id)
1343
+ );
1344
+ }, us = (a, m) => $n(
1345
+ (C) => C.map((U) => U.key === a ? { ...U, ...m } : U)
1346
+ ), Vi = () => $n((a) => [
1347
+ ...a,
1348
+ { key: Wn.current += 1, careId: "", priceCents: null }
1349
+ ]), Hi = (a) => $n(
1350
+ (m) => m.length > 1 ? m.filter((C) => C.key !== a) : m
1351
+ ), Ui = (a, m, C) => {
1352
+ var Ne;
1353
+ const U = ((Ne = E.careById(a.careId)) == null ? void 0 : Ne.phases) ?? [], $ = a.phases ?? [], ne = C ? [...$, m] : $.filter((j) => j !== m);
1354
+ us(a.key, {
1355
+ phases: U.filter((j) => ne.includes(j))
1356
+ });
1357
+ }, Gi = (a, m) => {
1358
+ var C;
1359
+ return us(a.key, {
1360
+ phases: m ? [...((C = E.careById(a.careId)) == null ? void 0 : C.phases) ?? []] : []
1361
+ });
1362
+ }, Ee = ye(() => {
1363
+ if (!De) return n == null ? void 0 : n.careLink;
1364
+ if (I === "plan" && he) {
1365
+ const a = he.entries.filter((C) => Pe.includes(C.id)).map((C) => C.id);
1366
+ if (a.length === 0) return;
1367
+ const m = Object.fromEntries(
1368
+ a.filter((C) => {
1369
+ var U;
1370
+ return (((U = qe[C]) == null ? void 0 : U.length) ?? 0) > 0;
1371
+ }).map((C) => [C, qe[C]])
1372
+ );
1373
+ return {
1374
+ kind: "plan",
1375
+ planId: he.id,
1376
+ entryIds: a,
1377
+ phasesByEntry: Object.keys(m).length > 0 ? m : void 0
1378
+ };
1379
+ }
1380
+ if (I === "priceList") {
1381
+ const a = je.filter((m) => m.careId).map((m) => {
1382
+ var C;
1383
+ return {
1384
+ careId: m.careId,
1385
+ priceCents: m.priceCents ?? ((C = E.careById(m.careId)) == null ? void 0 : C.priceCents) ?? 0,
1386
+ ...m.phases && m.phases.length > 0 ? { phases: m.phases } : {},
1387
+ ...m.billed ? { billed: !0 } : {},
1388
+ ...m.billing ? { billing: m.billing } : {}
1389
+ };
1390
+ });
1391
+ if (a.length > 0 && fn)
1392
+ return { kind: "priceList", priceListId: fn, items: a };
1393
+ }
1394
+ }, [
1395
+ I,
1396
+ he,
1397
+ Pe,
1398
+ qe,
1399
+ fn,
1400
+ je,
1401
+ E,
1402
+ De,
1403
+ n == null ? void 0 : n.careLink
1404
+ ]), hs = JSON.stringify(Ee ?? null), ms = P(null);
1405
+ V(() => {
1406
+ if (!De) return;
1407
+ if (ms.current === null || ms.current === hs) {
1408
+ ms.current = hs;
1409
+ return;
1410
+ }
1411
+ ms.current = hs;
1412
+ const a = Pr(Ee, E);
1413
+ a.durationMin !== void 0 && An(a.durationMin);
1414
+ }, [hs, Ee, E, De]);
1415
+ const gs = (Ee == null ? void 0 : Ee.kind) === "plan", es = De && Ee ? E.careEntriesFromLink(Ee) : n == null ? void 0 : n.cares, ln = ye(() => I === "plan" && he ? he.entries.filter((a) => Pe.includes(a.id)).map((a) => a.careId) : I === "priceList" ? je.filter((a) => a.careId).map((a) => a.careId) : ((n == null ? void 0 : n.cares) ?? []).map((a) => a.careId).filter((a) => !!a), [I, he, Pe, je, n == null ? void 0 : n.cares]), za = ye(
1416
+ () => w || I === "plan" ? [] : ln,
1417
+ [w, I, ln]
1418
+ ), vs = ye(
1419
+ () => za.map((a) => E.careById(a)).filter((a) => !!a),
1420
+ [za, E]
1421
+ ), ps = ye(
1422
+ () => Da(vs, He),
1423
+ [vs, He]
1424
+ ), bs = ye(
1425
+ () => Ea(vs, E.chairs),
1426
+ [vs, E.chairs]
1427
+ );
1428
+ V(() => {
1429
+ w || (On(
1430
+ (a) => a !== q && !gn(a, ps) ? q : a
1431
+ ), kn(
1432
+ (a) => a !== q && !gn(a, bs) ? q : a
1433
+ ));
1434
+ }, [w, ps, bs]);
1435
+ const [un, Ki] = N((n == null ? void 0 : n.allDay) ?? !1), _a = P(0);
1436
+ V(() => {
1437
+ if (!D || D.tick === _a.current) return;
1438
+ _a.current = D.tick, D.date && Ln(D.date), D.time && jn(D.time), D.durationMin && An(D.durationMin);
1439
+ let a = !1;
1440
+ D.chairId && (gn(D.chairId, bs) ? kn(D.chairId) : a = !0), D.operatorId && (gn(D.operatorId, ps) ? On(D.operatorId) : a = !0), a && xa(t(r("draftColumnRefused")));
1441
+ }, [D]), V(() => {
1442
+ k && k(
1443
+ O ? {
1444
+ editEventId: n == null ? void 0 : n.editEventId,
1445
+ date: O,
1446
+ time: ge,
1447
+ durationMin: Oe ?? 30,
1448
+ allDay: un,
1449
+ chairId: oe === q ? void 0 : oe,
1450
+ operatorId: se === q ? void 0 : se
1451
+ } : null
1452
+ );
1453
+ }, [
1454
+ k,
1455
+ n == null ? void 0 : n.editEventId,
1456
+ O,
1457
+ ge,
1458
+ Oe,
1459
+ un,
1460
+ oe,
1461
+ se
1462
+ ]), V(() => () => k == null ? void 0 : k(null), [k]);
1463
+ const re = w || n == null ? void 0 : n.recurrence, Va = re !== void 0 && so(re) && ((d == null ? void 0 : d.recurrenceCustom) ?? (d == null ? void 0 : d.recurrenceExtras) !== !1), [ns, Ha] = N(re !== void 0);
1464
+ V(() => {
1465
+ gs && Ha(!1);
1466
+ }, [gs]);
1467
+ const [Fn, qi] = N(
1468
+ Va ? "custom" : (re == null ? void 0 : re.frequency) ?? "weekly"
1469
+ ), [ys, ji] = N(
1470
+ () => re && Va ? ao(re) : no()
1471
+ ), [Nn, Yi] = N(
1472
+ (re == null ? void 0 : re.ends) ?? "count"
1473
+ ), [ks, Xi] = N(
1474
+ (re == null ? void 0 : re.ends) === "count" ? re.count : 4
1475
+ ), [Me, Xs] = N(
1476
+ re == null ? void 0 : re.untilDate
1477
+ ), [Qs, Qi] = N(
1478
+ (re == null ? void 0 : re.skipClosedDays) ?? (d == null ? void 0 : d.recurrenceSkipClosedDaysDefault) ?? !0
1479
+ ), Ua = wn(), hn = (d == null ? void 0 : d.recurrenceExtras) !== !1, Js = (d == null ? void 0 : d.recurrenceCustom) ?? hn, Ga = (d == null ? void 0 : d.recurrenceSkipClosedDays) ?? hn, fs = (a) => a.getFullYear() * 1e4 + a.getMonth() * 100 + a.getDate(), Zs = !w && ns && (W == null ? void 0 : W.editRecurrence) !== !1 && hn && Nn === "until", Ka = Zs && (!Me || O && fs(Me) < fs(O));
1480
+ V(() => {
1481
+ !Zs || !O || !Me || fs(Me) < fs(O) && Xs(qt(O, 1));
1482
+ }, [Zs, O, Me]);
1483
+ const ea = O ?? new Date(E.nowIso), qa = io({
1484
+ frequency: Fn,
1485
+ custom: ys,
1486
+ start: ea,
1487
+ ends: hn ? Nn : "count",
1488
+ count: ks,
1489
+ untilDate: Me,
1490
+ locale: T ?? Q.language
1491
+ }), [na, Ji] = N(
1492
+ w && (n == null ? void 0 : n.addToWaitingList) === !0
1493
+ ), ja = !w || (n == null ? void 0 : n.addToWaitingList) !== void 0, [sa, Zi] = N(
1494
+ (n == null ? void 0 : n.status) ?? (w ? void 0 : "confirmed")
1495
+ ), aa = d == null ? void 0 : d.consentsForCares, Ya = n == null ? void 0 : n.editEventId, ta = ye(
1496
+ () => !X && ln.length > 0 && aa ? aa(ln, Ya) : [],
1497
+ [X, ln, aa, Ya]
1498
+ ), [ia, er] = N([]), Xa = (a) => w ? ia.includes(a) : !ia.includes(a), ra = ta.filter((a) => a.state === "missing" && Xa(a.id)).map((a) => a.id), Ns = d == null ? void 0 : d.medicalDevicesForCares, xs = `${(O == null ? void 0 : O.getTime()) ?? ""}|${ge.hours}:${ge.minutes}|${Oe ?? ""}|${un}`, [Qa, nr] = N({ slot: xs, byCare: {} }), Cs = Qa.slot === xs ? Qa.byCare : {}, da = ye(() => {
1499
+ if (X || !Ns || !O || un) return [];
1500
+ if (ln.length === 0) return [];
1501
+ const a = new Date(O);
1502
+ return a.setHours(ge.hours, ge.minutes, 0, 0), Ns({
1503
+ careIds: ln,
1504
+ start: a,
1505
+ durationMin: Oe ?? 30,
1506
+ ...n != null && n.editEventId ? { eventId: n.editEventId } : {}
1507
+ }).filter((m) => m.options.length > 0);
1508
+ }, [
1509
+ X,
1510
+ Ns,
1511
+ ln,
1512
+ xs,
1513
+ n == null ? void 0 : n.editEventId
1514
+ ]), Ja = da.flatMap((a) => {
1515
+ const m = jt(a, Cs[a.careId]);
1516
+ return m ? [{ careId: a.careId, deviceId: m }] : [];
1517
+ }), Is = (a = !1) => {
1518
+ const m = a && !w && I === "plan" && Pe.length === 0;
1519
+ return JSON.stringify({
1520
+ patientId: M,
1521
+ type: Je,
1522
+ dateMs: (O == null ? void 0 : O.getTime()) ?? null,
1523
+ time: ge,
1524
+ durationMin: Oe,
1525
+ operatorId: a && !He.some((C) => C.id === se) ? q : se,
1526
+ chairId: a && !E.chairs.some((C) => C.id === oe) ? q : oe,
1527
+ colorHex: Pn,
1528
+ care: Ge,
1529
+ emailReminder: Ke,
1530
+ smsReminder: $e,
1531
+ firstVisit: cn,
1532
+ /* A new appointment's patient auto-selects their open plan after the
1533
+ first render: with no line ticked that is not typed data. */
1534
+ careLink: m ? q : I,
1535
+ carePlanId: m ? "" : K,
1536
+ entryIds: Pe,
1537
+ phaseSelection: qe,
1538
+ priceListId: fn,
1539
+ priceRows: je,
1540
+ allDay: un,
1541
+ repeats: ns,
1542
+ recurrence: Fn,
1543
+ customRecurrence: ys,
1544
+ recurrenceEnds: Nn,
1545
+ recurrenceCount: ks,
1546
+ recurrenceUntilMs: (Me == null ? void 0 : Me.getTime()) ?? null,
1547
+ skipClosedDays: Qs,
1548
+ addToWaitingList: na,
1549
+ status: sa,
1550
+ pickedDevices: Cs
1551
+ });
1552
+ }, oa = P(null);
1553
+ oa.current === null && (oa.current = Is());
1554
+ const Za = w && ra.length > 0 || Is() !== oa.current, ca = P(null);
1555
+ ca.current === null && (ca.current = Is(!0));
1556
+ const et = (Is(!0) !== ca.current || ia.length > 0) && !dn && !me;
1557
+ V(() => {
1558
+ ue && (ue.dirty = et);
1559
+ }, [ue, et]), V(
1560
+ () => () => {
1561
+ ue && (ue.dirty = !1);
1562
+ },
1563
+ [ue]
1564
+ );
1565
+ const Ss = O ? E.closureOn(
1566
+ Mr(O),
1567
+ se === q ? void 0 : se
1568
+ ) : null, nt = (d == null ? void 0 : d.operatorAbsenceWarning) === !0 && (Ss == null ? void 0 : Ss.kind) === "absence", st = nt ? null : Ss, at = Br(n == null ? void 0 : n.callToAction, {
1569
+ patientId: M || void 0,
1570
+ operatorId: se === q ? void 0 : se
1571
+ }), la = d == null ? void 0 : d.descriptionMaxLength, tt = la !== void 0 && Ge.length > la, zn = (n == null ? void 0 : n.simpleSave) === !1, ss = !dn && !me && (w ? Za : !!O) && !tt && !Ka && at, sr = me || l || (w ? Za : !0), Te = mi(M, E), ar = n != null && n.editEventId ? (zt = E.baseEvents.find((a) => a.event.id === n.editEventId)) == null ? void 0 : zt.event.title : void 0, it = Ta(
1572
+ Te,
1573
+ ar,
1574
+ t(F("patientNotLoaded"))
1575
+ ), [tr, rt] = N(!1), [dt, ir] = N("this"), [ot, ct] = N(Yt), lt = P(M);
1576
+ V(() => {
1577
+ lt.current !== M && (lt.current = M, ct(Yt()));
1578
+ }, [M]);
1579
+ const ws = (d == null ? void 0 : d.branches) ?? [], [ut, rr] = N(() => {
1580
+ var a;
1581
+ return ((a = ws[0]) == null ? void 0 : a.id) ?? "";
1582
+ }), ua = !w && Te.assigned && (d != null && d.unsignedRequiredDocs) ? d.unsignedRequiredDocs(Te.id) : 0, ht = (d == null ? void 0 : d.signatureCredits) !== void 0 && d.signatureCredits.available <= 0, mt = ua > 0 && !ht, dr = ht && ua > 0 && !w && Te.assigned, Rs = Wr(Te), as = ei(Rs.sms), ts = ei(Rs.email), xn = Xt(Rs.sms, {
1583
+ optedOut: r("signModeSmsDisabled"),
1584
+ none: r("signModeSmsDisabled")
1585
+ }), Cn = Xt(Rs.email, {
1586
+ optedOut: r("signModeEmailDisabled"),
1587
+ none: r("signModeEmailDisabled")
1588
+ }), Le = (d == null ? void 0 : d.reminderCapability) === !0, Ds = !Le || Te.assigned, gt = (d == null ? void 0 : d.firstVisitRequiresPatient) !== !0 || Te.assigned, vt = P(d == null ? void 0 : d.proposeFirstVisit);
1589
+ vt.current = d == null ? void 0 : d.proposeFirstVisit;
1590
+ const ha = P(!1), pt = P(M), ma = O == null ? void 0 : O.getTime();
1591
+ V(() => {
1592
+ if (w) return;
1593
+ pt.current !== M && (pt.current = M, ha.current = !1, Bn("unknown"));
1594
+ const a = vt.current;
1595
+ if (!M || !a || ma === void 0) return;
1596
+ let m = !0;
1597
+ return Promise.resolve().then(() => a({ patientId: M, date: new Date(ma) })).then((C) => {
1598
+ m && !ha.current && (C === "yes" || C === "no" || C === "unknown") && Bn(C);
1599
+ }).catch(() => {
1600
+ }), () => {
1601
+ m = !1;
1602
+ };
1603
+ }, [w, M, ma]);
1604
+ const ga = d != null && d.devicesByCare && !Ns ? $r(es, d.devicesByCare) : [], en = O ? new Date(O) : void 0;
1605
+ en && en.setHours(ge.hours, ge.minutes, 0, 0);
1606
+ const [or, bt] = N({}), yt = P(d == null ? void 0 : d.sameDayReminders);
1607
+ yt.current = d == null ? void 0 : d.sameDayReminders;
1608
+ const va = O ? new Date(O).setHours(0, 0, 0, 0) : void 0, kt = n == null ? void 0 : n.editEventId;
1609
+ V(() => {
1610
+ bt({});
1611
+ const a = yt.current;
1612
+ if (!M || !a || va === void 0) return;
1613
+ let m = !0;
1614
+ return Promise.resolve().then(
1615
+ () => a({
1616
+ patientId: M,
1617
+ date: new Date(va),
1618
+ eventId: kt
1619
+ })
1620
+ ).then((C) => {
1621
+ if (!m) return;
1622
+ const U = ($) => {
1623
+ const ne = $ === void 0 ? NaN : new Date($).getTime();
1624
+ return Number.isNaN(ne) ? void 0 : ne;
1625
+ };
1626
+ bt({ sms: U(C == null ? void 0 : C.sms), email: U(C == null ? void 0 : C.email) });
1627
+ }).catch(() => {
1628
+ }), () => {
1629
+ m = !1;
1630
+ };
1631
+ }, [M, va, kt]);
1632
+ const ft = (a) => {
1633
+ var C;
1634
+ const m = or[a];
1635
+ return m === void 0 || !en || ((C = d == null ? void 0 : d.defaultReminders) == null ? void 0 : C[a]) !== !0 ? null : en.getTime() > m ? "earlier" : "later";
1636
+ }, pa = ft("sms"), ba = ft("email");
1637
+ V(() => {
1638
+ Ze && pa === "earlier" && Yn(!1);
1639
+ }, [pa, Ze]), V(() => {
1640
+ Ze && ba === "earlier" && Mn(!1);
1641
+ }, [ba, Ze]);
1642
+ const Nt = Je === "telehealth" && Te.assigned && p("emailReminder", Ke) && p("smsReminder", $e) && !(Ke && (!Le || ts)) && !($e && (!Le || as)), is = qs && Nt, xt = d != null && d.rows && en && !un ? Fr(d.rows, {
1643
+ start: en,
1644
+ end: new Date(en.getTime() + (Oe ?? 30) * 6e4),
1645
+ chairId: oe === q ? void 0 : oe,
1646
+ operatorId: se === q ? void 0 : se,
1647
+ excludeEventId: n == null ? void 0 : n.editEventId
1648
+ }) : { chairBusy: !1, operatorBusy: !1 }, Ct = !Dn && w && (d == null ? void 0 : d.recurringScope) === !0 && (W == null ? void 0 : W.editRecurrence) !== !1, cr = w && (Dn ? (R == null ? void 0 : R.offersCarePlanCleanup) === !0 : (d == null ? void 0 : d.carePlanCleanup) === !0), lr = w && ((d == null ? void 0 : d.recurringDeleteScope) ?? (d == null ? void 0 : d.recurringScope)) === !0 && (W == null ? void 0 : W.editRecurrence) !== !1, It = Dn ?? (lr ? Jt : void 0), St = R != null && en != null && Math.floor(en.getTime() / 6e4) !== Math.floor(R.occurrence.getTime() / 6e4), ur = Ie === "all" && St, ya = P(null), wt = P(null), Rt = P(null);
1649
+ Yd(n == null ? void 0 : n.initialFocus, {
1650
+ patient: ya,
1651
+ operator: wt,
1652
+ chair: Rt
1653
+ }), V(() => {
1654
+ var a, m;
1655
+ !qn.current || !M || (qn.current = !1, (m = (a = ya.current) == null ? void 0 : a.querySelector('[role="combobox"]')) == null || m.focus());
1656
+ }, [M]);
1657
+ const Dt = P(null), Et = P(null), Tt = P(Ve);
1658
+ V(() => {
1659
+ var a, m, C;
1660
+ Tt.current !== Ve && (Tt.current = Ve, Ve ? (C = (m = Dt.current) == null ? void 0 : m.querySelector('[role="radio"][aria-checked="true"]')) == null || C.focus() : (a = Et.current) == null || a.focus());
1661
+ }, [Ve]);
1662
+ const ka = {
1663
+ recurringSaveMode: Ie ?? (Ct ? dt : void 0),
1664
+ requiredDocsSignMode: mt ? ot : void 0,
1665
+ consentIds: ra.length > 0 ? ra : void 0,
1666
+ medicalDevices: Ja.length > 0 ? Ja : void 0,
1667
+ branchId: De && I === "priceList" && ws.length > 1 ? ut : void 0
1668
+ }, [nn, Lt] = N("form"), At = P(null), Ot = P(null), Pt = P(nn);
1669
+ V(() => {
1670
+ var m, C;
1671
+ Pt.current !== nn && (Pt.current = nn, nn === "history" ? (m = Ot.current) == null || m.focus() : (C = At.current) == null || C.focus());
1672
+ }, [nn]);
1673
+ const Mt = T ?? Q.language, fa = async (a) => {
1674
+ var m;
1675
+ if (!(X || We.current || Qe.current || !ss || !O)) {
1676
+ if (Nt) {
1677
+ Gn(!0);
1678
+ return;
1679
+ }
1680
+ We.current = !0, Un(!0), En(void 0);
1681
+ try {
1682
+ await s(
1683
+ {
1684
+ editEventId: n == null ? void 0 : n.editEventId,
1685
+ /* B23: the save carries the whole appointment, and a field left
1686
+ empty is sent as empty (null), never left out. */
1687
+ ...Xe ? {} : { patientId: M || null },
1688
+ isTelehealth: Je === "telehealth",
1689
+ date: O,
1690
+ time: ge,
1691
+ durationMin: Oe ?? 30,
1692
+ operatorId: se === q ? null : se,
1693
+ chairId: oe === q ? null : oe,
1694
+ colorHex: Pn,
1695
+ ...(W == null ? void 0 : W.editDescription) === !1 ? {} : { care: Ge },
1696
+ allDay: un,
1697
+ ...De ? { cares: n == null ? void 0 : n.cares, careLink: Ee } : {},
1698
+ waitingEntryId: n == null ? void 0 : n.waitingEntryId,
1699
+ ...ja ? { addToWaitingList: na } : {},
1700
+ /* B2, B7: no patient, or a channel the patient cannot take, is
1701
+ sent as off, as the boxes show it. */
1702
+ ...p("emailReminder", Ke) ? {
1703
+ emailReminder: Ds && Te.assigned && Ke && (!Le || ts)
1704
+ } : {},
1705
+ ...p("smsReminder", $e) ? {
1706
+ smsReminder: Ds && Te.assigned && $e && (!Le || as)
1707
+ } : {},
1708
+ ...p("firstVisit", cn) ? { firstVisit: gt ? cn : "unknown" } : {},
1709
+ ...(W == null ? void 0 : W.editStatus) === !1 ? {} : { status: w ? sa : void 0 },
1710
+ /* Create-only, matching platform: once an appointment exists its
1711
+ recurrence inputs are disabled, so an edit never re-rules a
1712
+ series from this form. */
1713
+ recurrence: !w && (W == null ? void 0 : W.editRecurrence) !== !1 && ns ? {
1714
+ ...Fn === "custom" ? to(ys, ea) : { frequency: Fn },
1715
+ ends: hn ? Nn : "count",
1716
+ count: ks ?? 2,
1717
+ untilDate: hn && Nn === "until" ? Me : void 0,
1718
+ skipClosedDays: Ga ? Qs : !1
1719
+ } : void 0
1720
+ },
1721
+ ka
1722
+ ), Qe.current = !0, ue && (ue.dirty = !1), ka.recurringSaveMode && (H == null || H({
1723
+ action: "edit",
1724
+ scope: ka.recurringSaveMode
1725
+ })), fe.current && Ks(!0);
1726
+ } catch (C) {
1727
+ fe.current && En(
1728
+ C instanceof Error && C.message.trim() ? C.message : t("patientDetails.edit.saveFailed")
1729
+ );
1730
+ return;
1731
+ } finally {
1732
+ We.current = !1, fe.current && Un(!1);
1733
+ }
1734
+ if (fe.current) {
1735
+ try {
1736
+ a != null && a.andReturn && ((m = d == null ? void 0 : d.onSaveAndReturn) == null || m.call(d));
1737
+ } catch {
1738
+ xa(t("emptyState.error.title"));
1739
+ }
1740
+ try {
1741
+ v && !(a != null && a.keepOpen) && _e();
1742
+ } catch {
1743
+ xa(t("emptyState.error.title"));
1744
+ }
1745
+ }
1746
+ }
1747
+ }, Bt = P(null), hr = (a) => {
1748
+ a.preventDefault(), a.nativeEvent.submitter === Bt.current && ss && d != null && d.submitOnEnter && fa({ keepOpen: zn });
1749
+ }, mr = (a) => {
1750
+ We.current || Qe.current || (n != null && n.editEventId && (It && (H == null || H({ action: "delete", scope: a.scope })), i == null || i(n.editEventId, a)), ue && (ue.dirty = !1), _e());
1751
+ }, Na = (a) => {
1752
+ We.current || Qe.current || b && (b({
1753
+ patientId: M || void 0,
1754
+ isTelehealth: Je === "telehealth",
1755
+ date: O,
1756
+ time: ge,
1757
+ durationMin: Oe ?? 30,
1758
+ operatorId: se === q ? void 0 : se,
1759
+ chairId: oe === q ? void 0 : oe,
1760
+ colorHex: Pn,
1761
+ care: Ge || void 0,
1762
+ cares: Ee && !a || n == null ? void 0 : n.cares,
1763
+ careLink: a ? Ee : void 0
1764
+ }), Ce("appointment-editor"));
1765
+ };
1766
+ return /* @__PURE__ */ c(
1767
+ "div",
1768
+ {
1769
+ className: ["ds:flex ds:h-full ds:flex-col", tn].filter(Boolean).join(" "),
1770
+ children: [
1771
+ nn === "history" ? /* @__PURE__ */ c(ae, { children: [
1772
+ /* @__PURE__ */ e(
1773
+ Ms,
1774
+ {
1775
+ ref: Ot,
1776
+ tabIndex: -1,
1777
+ title: t(F("historyTitle")),
1778
+ icon: /* @__PURE__ */ e(di, { "aria-hidden": "true" }),
1779
+ sticky: !0,
1780
+ divider: !0,
1781
+ actions: /* @__PURE__ */ e(
1782
+ ve,
1783
+ {
1784
+ size: "sm",
1785
+ intent: "ghost",
1786
+ icon: /* @__PURE__ */ e(ri, { "aria-hidden": "true" }),
1787
+ flipIconInRtl: !0,
1788
+ "aria-label": t(F("historyBack")),
1789
+ tooltip: t(F("historyBack")),
1790
+ onClick: () => Lt("form")
1791
+ }
1792
+ )
1793
+ }
1794
+ ),
1795
+ /* @__PURE__ */ e(
1796
+ "div",
1797
+ {
1798
+ tabIndex: 0,
1799
+ className: "ds:[min-block-size:0] ds:flex-1 ds:overflow-y-auto ds:p-[var(--spacing-md)]",
1800
+ children: /* @__PURE__ */ e(
1801
+ xr,
1802
+ {
1803
+ history: _ ?? [],
1804
+ locale: T,
1805
+ noteUnrecordedEdits: B
1806
+ }
1807
+ )
1808
+ }
1809
+ )
1810
+ ] }) : null,
1811
+ /* @__PURE__ */ c(
1812
+ "div",
1813
+ {
1814
+ hidden: nn !== "form",
1815
+ className: "ds:relative ds:z-10 ds:shrink-0 ds:bg-[var(--background)] ds:shadow-[var(--shadow-sm)]",
1816
+ children: [
1817
+ /* @__PURE__ */ e(
1818
+ Ms,
1819
+ {
1820
+ title: f ?? t(r(w ? "editTitle" : "title")),
1821
+ icon: g ?? /* @__PURE__ */ e(wd, { "aria-hidden": "true" }),
1822
+ sticky: !0,
1823
+ divider: !0,
1824
+ actions: _ ? /* @__PURE__ */ e(ae, { children: _ ? /* @__PURE__ */ e(
1825
+ ve,
1826
+ {
1827
+ ref: At,
1828
+ size: "sm",
1829
+ intent: "ghost",
1830
+ icon: /* @__PURE__ */ e(di, { "aria-hidden": "true" }),
1831
+ "aria-label": t(F("historyAction")),
1832
+ tooltip: t(F("historyAction")),
1833
+ onClick: () => Lt("history")
1834
+ }
1835
+ ) : null }) : void 0
1836
+ }
1837
+ ),
1838
+ o,
1839
+ dn || me ? /* @__PURE__ */ e("p", { role: "status", className: "type-body-sm ds:p-[var(--spacing-sm)]", children: me && O ? t("calendarWorkspace.inc1.save.toast", {
1840
+ date: Rn(T ?? Q.language, O)
1841
+ }) : t("common.loading") }) : null,
1842
+ is ? /* @__PURE__ */ e(L, { id: Ue, variant: "error", announce: "assertive", children: /* @__PURE__ */ e(L.Description, { children: t(r("telehealthNeedsReminder")) }) }) : null,
1843
+ ee ? /* @__PURE__ */ e(L, { variant: "error", children: /* @__PURE__ */ e(L.Description, { children: ee }) }) : null
1844
+ ]
1845
+ }
1846
+ ),
1847
+ /* @__PURE__ */ c(
1848
+ "div",
1849
+ {
1850
+ hidden: nn !== "form",
1851
+ tabIndex: 0,
1852
+ className: "ds:[min-block-size:0] ds:flex-1 ds:overflow-y-auto",
1853
+ children: [
1854
+ Ve && R ? /* @__PURE__ */ e("div", { ref: Dt, className: "ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ e(
1855
+ Xd,
1856
+ {
1857
+ scopes: R.scopes,
1858
+ occurrence: R.occurrence,
1859
+ locale: T ?? Q.language,
1860
+ defaultScope: Ie,
1861
+ warnOnWholeSeries: St,
1862
+ onContinue: (a) => {
1863
+ Gs(a), vn(!1);
1864
+ },
1865
+ onCancel: () => Ie ? vn(!1) : _e()
1866
+ }
1867
+ ) }) : null,
1868
+ /* @__PURE__ */ e("div", { className: fo, hidden: Ve, children: /* @__PURE__ */ c("form", { className: "ds:contents", onSubmit: hr, children: [
1869
+ /* @__PURE__ */ e(
1870
+ "button",
1871
+ {
1872
+ ref: Bt,
1873
+ type: "submit",
1874
+ hidden: !0,
1875
+ tabIndex: -1,
1876
+ disabled: !ss || !(d != null && d.submitOnEnter)
1877
+ }
1878
+ ),
1879
+ /* @__PURE__ */ c(
1880
+ "fieldset",
1881
+ {
1882
+ disabled: X || dn || me,
1883
+ className: No,
1884
+ children: [
1885
+ X ? /* @__PURE__ */ c(
1886
+ L,
1887
+ {
1888
+ variant: "info",
1889
+ announce: "off",
1890
+ className: Y,
1891
+ icon: /* @__PURE__ */ e(Oa, { "aria-hidden": "true" }),
1892
+ children: [
1893
+ /* @__PURE__ */ e(L.Title, { as: "p", children: t(F("readOnlyTitle")) }),
1894
+ /* @__PURE__ */ e(L.Description, { children: t(F("readOnlyBody")) })
1895
+ ]
1896
+ }
1897
+ ) : null,
1898
+ Vn && Ie ? /* @__PURE__ */ c(L, { variant: "info", className: Y, children: [
1899
+ /* @__PURE__ */ c(L.Description, { children: [
1900
+ t(r("seriesScopeReadout"), {
1901
+ scope: t(r(Os[Ie]))
1902
+ }),
1903
+ Ie !== "this" && ` ${t(r("seriesClashNote"))}`
1904
+ ] }),
1905
+ /* @__PURE__ */ e(L.Action, { children: /* @__PURE__ */ e(
1906
+ te,
1907
+ {
1908
+ ref: Et,
1909
+ size: "sm",
1910
+ intent: "outline",
1911
+ onClick: () => vn(!0),
1912
+ children: t(r("seriesScopeChange"))
1913
+ }
1914
+ ) })
1915
+ ] }) : null,
1916
+ ur ? /* @__PURE__ */ e(
1917
+ L,
1918
+ {
1919
+ variant: "warning",
1920
+ announce: "polite",
1921
+ className: Y,
1922
+ children: /* @__PURE__ */ e(L.Description, { children: t(r("seriesAllDiscardsOverrides")) })
1923
+ }
1924
+ ) : null,
1925
+ w ? /* @__PURE__ */ e(
1926
+ z,
1927
+ {
1928
+ label: t(F("status")),
1929
+ className: Be,
1930
+ children: /* @__PURE__ */ e(
1931
+ be,
1932
+ {
1933
+ options: Object.keys(Qt).map((a) => ({ value: a, label: pe(Qt[a]) })),
1934
+ value: sa,
1935
+ onValueChange: (a) => Zi(a),
1936
+ disabled: (W == null ? void 0 : W.editStatus) === !1
1937
+ }
1938
+ )
1939
+ }
1940
+ ) : null,
1941
+ /* @__PURE__ */ e("div", { className: "ds:min-w-0", children: /* @__PURE__ */ c(
1942
+ Sn,
1943
+ {
1944
+ label: t(r("type")),
1945
+ variant: "horizontal",
1946
+ value: Je,
1947
+ onValueChange: (a) => Tn(a),
1948
+ children: [
1949
+ /* @__PURE__ */ e(Ae, { value: "in_practice", label: t(r("typeInPractice")) }),
1950
+ /* @__PURE__ */ e(Ae, { value: "telehealth", label: t(r("typeTelehealth")) })
1951
+ ]
1952
+ }
1953
+ ) }),
1954
+ n != null && n.bookingContact ? /* @__PURE__ */ c(
1955
+ "div",
1956
+ {
1957
+ className: `${Y} ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)] ds:bg-[color:var(--muted)] ds:p-[var(--spacing-sm)]`,
1958
+ children: [
1959
+ /* @__PURE__ */ c("span", { className: "type-label ds:flex ds:items-center ds:gap-[var(--spacing-2xs)] ds:text-[color:var(--muted-foreground)]", children: [
1960
+ /* @__PURE__ */ e(Ni, { size: 12, "aria-hidden": "true" }),
1961
+ t(G("bookedOnlineBy"))
1962
+ ] }),
1963
+ /* @__PURE__ */ e("span", { className: "ds:font-[var(--font-weight-semibold)] ds:text-start", children: n.bookingContact.typedName }),
1964
+ /* @__PURE__ */ e(
1965
+ "a",
1966
+ {
1967
+ className: "type-body-sm",
1968
+ href: `tel:${n.bookingContact.phone.replace(/\s/g, "")}`,
1969
+ dir: "ltr",
1970
+ children: n.bookingContact.phone
1971
+ }
1972
+ ),
1973
+ /* @__PURE__ */ e(
1974
+ "a",
1975
+ {
1976
+ className: "type-body-sm ds:truncate",
1977
+ href: `mailto:${n.bookingContact.email}`,
1978
+ dir: "ltr",
1979
+ children: n.bookingContact.email
1980
+ }
1981
+ ),
1982
+ /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-start ds:text-[color:var(--muted-foreground)]", children: `${t(G("note"))}: ${n.bookingContact.note}` }),
1983
+ /* @__PURE__ */ c("span", { className: "type-body-sm ds:text-start ds:text-[color:var(--muted-foreground)]", children: [
1984
+ `${t(F("bookedAt"))}: `,
1985
+ /* @__PURE__ */ e(
1986
+ Aa,
1987
+ {
1988
+ value: n.bookingContact.bookedAtIso,
1989
+ format: "absolute",
1990
+ shape: "bare",
1991
+ locale: Mt,
1992
+ absoluteFormat: li
1993
+ }
1994
+ )
1995
+ ] }),
1996
+ !M && !Xe ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-start ds:text-[color:var(--info-foreground)]", children: t(G("searchPatientHint")) }) : null,
1997
+ !M && !Xe && !X && on ? /* @__PURE__ */ e(
1998
+ te,
1999
+ {
2000
+ type: "button",
2001
+ size: "sm",
2002
+ intent: "outline",
2003
+ className: "ds:self-start",
2004
+ loading: os,
2005
+ "data-action": "create-patient-from-booking",
2006
+ onClick: () => void yn(),
2007
+ children: t(G("createPatient"))
2008
+ }
2009
+ ) : null
2010
+ ]
2011
+ }
2012
+ ) : null,
2013
+ n != null && n.callToAction && !at ? /* @__PURE__ */ e(
2014
+ L,
2015
+ {
2016
+ variant: "info",
2017
+ announce: "polite",
2018
+ className: Y,
2019
+ children: /* @__PURE__ */ e(L.Description, { children: t(
2020
+ n.callToAction === "processBooking" ? "calendarWorkspace.backlog.processIncomplete" : "calendarWorkspace.backlog.assignIncomplete"
2021
+ ) })
2022
+ }
2023
+ ) : null,
2024
+ /* @__PURE__ */ e(
2025
+ z,
2026
+ {
2027
+ ref: ya,
2028
+ className: Y,
2029
+ label: t(r("patient")),
2030
+ required: (n == null ? void 0 : n.callToAction) === "processBooking",
2031
+ description: Xe ? (W == null ? void 0 : W.patientLockedReason) ?? t(r("patientLocked")) : (n == null ? void 0 : n.callToAction) === "processBooking" ? t("calendarWorkspace.backlog.processPatientHint") : void 0,
2032
+ children: Xe ? /* @__PURE__ */ e(
2033
+ Hd,
2034
+ {
2035
+ value: (n == null ? void 0 : n.patientId) ?? "",
2036
+ fallbackLabel: it
2037
+ }
2038
+ ) : /* @__PURE__ */ e(
2039
+ wi,
2040
+ {
2041
+ value: M,
2042
+ onValueChange: pn,
2043
+ onCreatePatient: X || n != null && n.bookingContact && on || d == null ? void 0 : d.createPatient,
2044
+ selectedLabel: (bn == null ? void 0 : bn.id) === M && !Te.record ? bn.name : it
2045
+ }
2046
+ )
2047
+ }
2048
+ ),
2049
+ mt ? /* @__PURE__ */ e("div", { className: Y, children: /* @__PURE__ */ c(
2050
+ Sn,
2051
+ {
2052
+ label: t(r("signMode"), { count: ua }),
2053
+ value: ot,
2054
+ onValueChange: (a) => ct(a),
2055
+ children: [
2056
+ /* @__PURE__ */ e(
2057
+ Ae,
2058
+ {
2059
+ value: "sms",
2060
+ label: xn === null ? t(r("signModeSms")) : `${t(r("signModeSms"))} — ${t(xn)}`,
2061
+ disabled: !as,
2062
+ disabledReason: xn === null ? void 0 : t(xn)
2063
+ }
2064
+ ),
2065
+ /* @__PURE__ */ e(
2066
+ Ae,
2067
+ {
2068
+ value: "email",
2069
+ label: Cn === null ? t(r("signModeEmail")) : `${t(r("signModeEmail"))} — ${t(Cn)}`,
2070
+ disabled: !ts,
2071
+ disabledReason: Cn === null ? void 0 : t(Cn)
2072
+ }
2073
+ ),
2074
+ /* @__PURE__ */ e(Ae, { value: "none", label: t(r("signModeNone")) })
2075
+ ]
2076
+ }
2077
+ ) }) : null,
2078
+ dr && (d != null && d.signatureCredits) ? /* @__PURE__ */ e(
2079
+ L,
2080
+ {
2081
+ variant: "warning",
2082
+ announce: "polite",
2083
+ className: Y,
2084
+ children: /* @__PURE__ */ c(L.Description, { children: [
2085
+ t(r("signatureCreditsNone")),
2086
+ " ",
2087
+ /* @__PURE__ */ e(hd, { href: d.signatureCredits.buyHref, external: !0, children: t(r("signatureCreditsBuy")) })
2088
+ ] })
2089
+ }
2090
+ ) : null,
2091
+ gt ? /* @__PURE__ */ e(
2092
+ z,
2093
+ {
2094
+ className: Be,
2095
+ label: t(r("firstVisit")),
2096
+ children: /* @__PURE__ */ e(
2097
+ be,
2098
+ {
2099
+ options: [
2100
+ { value: "no", label: t(r("firstVisitNo")) },
2101
+ { value: "yes", label: t(r("firstVisitYes")) },
2102
+ { value: "unknown", label: t(r("firstVisitUnknown")) }
2103
+ ],
2104
+ value: cn,
2105
+ onValueChange: (a) => {
2106
+ ha.current = !0, Bn(a);
2107
+ }
2108
+ }
2109
+ )
2110
+ }
2111
+ ) : null,
2112
+ De && (M || w) && Wi ? /* @__PURE__ */ e("div", { className: Y, children: /* @__PURE__ */ c(
2113
+ Sn,
2114
+ {
2115
+ label: t(r("linkCare")),
2116
+ variant: "horizontal",
2117
+ value: I,
2118
+ onValueChange: J,
2119
+ disabled: w,
2120
+ description: w ? t(r("linkCareLocked")) : Se.length === 0 ? t(r("linkPlanDisabled")) : void 0,
2121
+ children: [
2122
+ /* @__PURE__ */ e(Ae, { value: q, label: t(r("linkNone")) }),
2123
+ /* @__PURE__ */ e(
2124
+ Ae,
2125
+ {
2126
+ value: "plan",
2127
+ label: t(r("linkPlan")),
2128
+ disabled: !w && Se.length === 0,
2129
+ disabledReason: !w && Se.length === 0 ? t(r("linkPlanDisabled")) : void 0
2130
+ }
2131
+ ),
2132
+ $a ? /* @__PURE__ */ e(
2133
+ Ae,
2134
+ {
2135
+ value: "priceList",
2136
+ label: t(r("linkPriceList"))
2137
+ }
2138
+ ) : null
2139
+ ]
2140
+ }
2141
+ ) }) : null,
2142
+ De && (M || w) && I === "plan" ? /* @__PURE__ */ c(ae, { children: [
2143
+ /* @__PURE__ */ e(
2144
+ z,
2145
+ {
2146
+ className: Y,
2147
+ label: t(r("plan")),
2148
+ children: /* @__PURE__ */ e(
2149
+ be,
2150
+ {
2151
+ options: $i.map((a) => ({
2152
+ value: a.id,
2153
+ label: `${a.number} · ${a.name}`
2154
+ })),
2155
+ value: K,
2156
+ onValueChange: (a) => {
2157
+ ce(a), Fe([]), Xn({});
2158
+ },
2159
+ placeholder: t(r("planSelect")),
2160
+ disabled: w
2161
+ }
2162
+ )
2163
+ }
2164
+ ),
2165
+ Fa.length > 0 ? /* @__PURE__ */ c(
2166
+ "fieldset",
2167
+ {
2168
+ className: `${Y} ds:m-0 ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:border-0 ds:p-0`,
2169
+ children: [
2170
+ /* @__PURE__ */ e("legend", { className: "type-label ds:mb-[var(--spacing-2xs)] ds:p-0", children: t(r("planEntries")) }),
2171
+ Fa.map((a) => {
2172
+ var C, U;
2173
+ const m = E.careById(a.careId);
2174
+ return /* @__PURE__ */ c(
2175
+ "div",
2176
+ {
2177
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
2178
+ children: [
2179
+ /* @__PURE__ */ e(
2180
+ Re,
2181
+ {
2182
+ checked: Fi(a),
2183
+ onCheckedChange: ($) => zi(a, $),
2184
+ label: /* @__PURE__ */ c("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-2xs)]", children: [
2185
+ /* @__PURE__ */ e("span", { children: (m == null ? void 0 : m.name) ?? a.careId }),
2186
+ m ? /* @__PURE__ */ e("span", { className: "type-meta ds:tabular-nums ds:text-[color:var(--muted-foreground)]", children: m.code }) : null,
2187
+ (C = a.elements) == null ? void 0 : C.map(($) => /* @__PURE__ */ e(
2188
+ Ws,
2189
+ {
2190
+ label: $,
2191
+ variant: "info",
2192
+ size: "sm"
2193
+ },
2194
+ $
2195
+ )),
2196
+ (U = S[a.id]) == null ? void 0 : U.map(($) => /* @__PURE__ */ e(
2197
+ Ws,
2198
+ {
2199
+ label: t(r("entryScheduled"), {
2200
+ date: Rn(
2201
+ Jn,
2202
+ $.startIso
2203
+ )
2204
+ }),
2205
+ variant: "neutral",
2206
+ fill: "outline",
2207
+ size: "sm",
2208
+ leading: /* @__PURE__ */ e(Rd, { "aria-hidden": "true" })
2209
+ },
2210
+ $.eventId
2211
+ ))
2212
+ ] })
2213
+ }
2214
+ ),
2215
+ a.phases && a.phases.length > 0 ? (
2216
+ /* Named group: a screen reader hears each phase
2217
+ under its treatment line, not a bare "Phase 1". */
2218
+ /* @__PURE__ */ e(
2219
+ "div",
2220
+ {
2221
+ role: "group",
2222
+ "aria-label": (m == null ? void 0 : m.name) ?? a.careId,
2223
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:ps-[var(--spacing-xl)]",
2224
+ children: a.phases.map(($) => /* @__PURE__ */ e(
2225
+ Re,
2226
+ {
2227
+ size: "sm",
2228
+ label: $,
2229
+ checked: (qe[a.id] ?? []).includes($),
2230
+ onCheckedChange: (ne) => _i(a, $, ne)
2231
+ },
2232
+ $
2233
+ ))
2234
+ }
2235
+ )
2236
+ ) : null
2237
+ ]
2238
+ },
2239
+ a.id
2240
+ );
2241
+ })
2242
+ ]
2243
+ }
2244
+ ) : null
2245
+ ] }) : null,
2246
+ De && (M || w) && I === "priceList" ? /* @__PURE__ */ c(ae, { children: [
2247
+ Wa ? /* @__PURE__ */ e(
2248
+ z,
2249
+ {
2250
+ className: Be,
2251
+ label: t(r("priceList")),
2252
+ children: /* @__PURE__ */ e(
2253
+ be,
2254
+ {
2255
+ options: Ba.map((a) => ({
2256
+ value: a.id,
2257
+ label: a.name
2258
+ })),
2259
+ value: fn,
2260
+ onValueChange: (a) => {
2261
+ var m;
2262
+ return Qn(a || (((m = Ba[0]) == null ? void 0 : m.id) ?? ""));
2263
+ },
2264
+ disabled: w
2265
+ }
2266
+ )
2267
+ }
2268
+ ) : null,
2269
+ ws.length > 1 ? /* @__PURE__ */ e(
2270
+ z,
2271
+ {
2272
+ className: Be,
2273
+ label: t(r("branch")),
2274
+ children: /* @__PURE__ */ e(
2275
+ be,
2276
+ {
2277
+ options: ws.map((a) => ({
2278
+ value: a.id,
2279
+ label: a.name
2280
+ })),
2281
+ value: ut,
2282
+ onValueChange: rr,
2283
+ disabled: w
2284
+ }
2285
+ )
2286
+ }
2287
+ ) : null,
2288
+ /* @__PURE__ */ e(
2289
+ "div",
2290
+ {
2291
+ role: "list",
2292
+ "aria-label": t(r("priceListRows")),
2293
+ className: `${Y} ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]`,
2294
+ children: je.map((a) => {
2295
+ const m = a.careId ? E.careById(a.careId) : void 0, C = d != null && d.priceListPhases ? (m == null ? void 0 : m.phases) ?? [] : [], U = a.phases ?? [], $ = (d == null ? void 0 : d.priceListPhases) === !0 && a.billed === !0, ne = $ ? "priceListBilled" : je.length === 1 ? "priceListLastRow" : "priceListRemove", Ne = C.length > 0 && U.length === C.length ? !0 : U.length > 0 ? "indeterminate" : !1;
2296
+ return /* @__PURE__ */ c(
2297
+ "div",
2298
+ {
2299
+ role: "listitem",
2300
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
2301
+ children: [
2302
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-xs)]", children: [
2303
+ /* @__PURE__ */ e(
2304
+ z,
2305
+ {
2306
+ label: t(r("priceListCare")),
2307
+ className: "ds:min-w-0 ds:flex-1",
2308
+ children: /* @__PURE__ */ e(
2309
+ La,
2310
+ {
2311
+ options: E.cares.map((j) => ({
2312
+ value: j.id,
2313
+ label: `${j.name} (${j.code})`
2314
+ })),
2315
+ value: a.careId,
2316
+ disabled: $,
2317
+ onValueChange: (j) => {
2318
+ var Es, Ht;
2319
+ return us(a.key, {
2320
+ careId: j,
2321
+ priceCents: j ? ((Es = E.careById(j)) == null ? void 0 : Es.priceCents) ?? null : null,
2322
+ phases: j && (d != null && d.priceListPhases) ? [...((Ht = E.careById(j)) == null ? void 0 : Ht.phases) ?? []] : void 0
2323
+ });
2324
+ },
2325
+ placeholder: t(r("priceListSearch")),
2326
+ clearable: !0,
2327
+ size: "sm"
2328
+ }
2329
+ )
2330
+ }
2331
+ ),
2332
+ /* @__PURE__ */ e(z, { label: t(r("priceListPrice")), children: /* @__PURE__ */ e(
2333
+ Sa,
2334
+ {
2335
+ mode: "currency",
2336
+ currency: E.currency ?? "EUR",
2337
+ locale: Jn,
2338
+ min: 0,
2339
+ variant: "plain",
2340
+ size: "sm",
2341
+ inline: "md",
2342
+ disabled: $,
2343
+ value: a.priceCents == null ? null : a.priceCents / 100,
2344
+ onChange: (j) => us(a.key, {
2345
+ priceCents: j == null ? null : Math.round(j * 100)
2346
+ })
2347
+ }
2348
+ ) }),
2349
+ /* @__PURE__ */ e(
2350
+ ve,
2351
+ {
2352
+ size: "sm",
2353
+ intent: "outline",
2354
+ icon: /* @__PURE__ */ e(Fs, { "aria-hidden": "true" }),
2355
+ "aria-label": t(r(ne)),
2356
+ tooltip: t(r(ne)),
2357
+ "aria-disabled": ne === "priceListRemove" ? void 0 : !0,
2358
+ onClick: () => {
2359
+ ne === "priceListRemove" && Hi(a.key);
2360
+ }
2361
+ }
2362
+ )
2363
+ ] }),
2364
+ C.length > 0 ? (
2365
+ /* Named group: a phase is heard under its own
2366
+ treatment, never as a bare "Impression". */
2367
+ /* @__PURE__ */ c(
2368
+ "div",
2369
+ {
2370
+ role: "group",
2371
+ "aria-label": (m == null ? void 0 : m.name) ?? a.careId,
2372
+ className: "ds:flex ds:flex-wrap ds:gap-[var(--spacing-md)] ds:ps-[var(--spacing-xs)]",
2373
+ children: [
2374
+ /* @__PURE__ */ e(
2375
+ Re,
2376
+ {
2377
+ size: "sm",
2378
+ label: t(r("priceListAllPhases")),
2379
+ checked: Ne,
2380
+ disabled: $,
2381
+ onCheckedChange: (j) => Gi(a, j !== !1)
2382
+ }
2383
+ ),
2384
+ C.map((j) => /* @__PURE__ */ e(
2385
+ Re,
2386
+ {
2387
+ size: "sm",
2388
+ label: j,
2389
+ checked: U.includes(j),
2390
+ disabled: $,
2391
+ onCheckedChange: (Es) => Ui(a, j, Es === !0)
2392
+ },
2393
+ j
2394
+ ))
2395
+ ]
2396
+ }
2397
+ )
2398
+ ) : null,
2399
+ $ ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-start ds:text-[color:var(--warning-foreground)]", children: t(r("priceListBilled")) }) : null
2400
+ ]
2401
+ },
2402
+ a.key
2403
+ );
2404
+ })
2405
+ }
2406
+ ),
2407
+ /* @__PURE__ */ e("div", { className: Y, children: /* @__PURE__ */ e(
2408
+ te,
2409
+ {
2410
+ size: "sm",
2411
+ intent: "outline",
2412
+ startIcon: /* @__PURE__ */ e(Dd, { "aria-hidden": "true" }),
2413
+ onClick: Vi,
2414
+ children: t(r("priceListAdd"))
2415
+ }
2416
+ ) })
2417
+ ] }) : null,
2418
+ /* @__PURE__ */ e(
2419
+ z,
2420
+ {
2421
+ className: Y,
2422
+ label: t(r("description")),
2423
+ error: tt ? t(r("descriptionTooLong"), { max: la }) : void 0,
2424
+ children: /* @__PURE__ */ e(
2425
+ id,
2426
+ {
2427
+ value: Ge,
2428
+ disabled: (W == null ? void 0 : W.editDescription) === !1,
2429
+ onChange: (a) => js(a.target.value)
2430
+ }
2431
+ )
2432
+ }
2433
+ ),
2434
+ es != null && es.length ? /* @__PURE__ */ e(
2435
+ ai,
2436
+ {
2437
+ className: Y,
2438
+ label: t(r("cares")),
2439
+ value: _r(es)
2440
+ }
2441
+ ) : null,
2442
+ ga.length > 0 ? /* @__PURE__ */ e(
2443
+ ai,
2444
+ {
2445
+ className: Y,
2446
+ label: t(r("devices")),
2447
+ value: `${t(r("devicesRequired"), {
2448
+ count: ga.length
2449
+ })} · ${ga.join(", ")}`
2450
+ }
2451
+ ) : null,
2452
+ /* @__PURE__ */ e(z, { className: Be, label: t(r("date")), children: /* @__PURE__ */ e($s, { value: O, onChange: Ln }) }),
2453
+ /* @__PURE__ */ e(
2454
+ z,
2455
+ {
2456
+ className: Ls,
2457
+ label: t(r("time")),
2458
+ children: /* @__PURE__ */ e(dd, { value: ge, onChange: jn })
2459
+ }
2460
+ ),
2461
+ /* @__PURE__ */ e(
2462
+ z,
2463
+ {
2464
+ className: Be,
2465
+ label: t(r("duration")),
2466
+ children: /* @__PURE__ */ e(
2467
+ Pi,
2468
+ {
2469
+ value: Oe,
2470
+ onChange: An
2471
+ }
2472
+ )
2473
+ }
2474
+ ),
2475
+ /* @__PURE__ */ e(
2476
+ z,
2477
+ {
2478
+ className: Ls,
2479
+ label: t(F("color")),
2480
+ children: /* @__PURE__ */ e(
2481
+ pi,
2482
+ {
2483
+ variant: "inline",
2484
+ compact: !0,
2485
+ size: "sm",
2486
+ palette: ((_t = E.appointmentPalette) == null ? void 0 : _t.slice()) ?? Bs,
2487
+ value: Pn,
2488
+ onChange: ls
2489
+ }
2490
+ )
2491
+ }
2492
+ ),
2493
+ st && O ? /* @__PURE__ */ e(
2494
+ L,
2495
+ {
2496
+ variant: "warning",
2497
+ announce: "polite",
2498
+ className: Y,
2499
+ children: /* @__PURE__ */ e(L.Description, { children: Vr(
2500
+ t,
2501
+ Q.language,
2502
+ st,
2503
+ O,
2504
+ E
2505
+ ) })
2506
+ }
2507
+ ) : null,
2508
+ ta.length > 0 ? /* @__PURE__ */ c(
2509
+ "fieldset",
2510
+ {
2511
+ "data-editor-consents": "",
2512
+ className: `${Y} ds:m-0 ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:border-0 ds:p-0`,
2513
+ children: [
2514
+ /* @__PURE__ */ e("legend", { className: "type-label ds:text-foreground ds:p-0", children: t(r("consents")) }),
2515
+ /* @__PURE__ */ e("p", { className: "type-meta ds:m-0 ds:text-[color:var(--muted-foreground)]", children: t(r("consentsHint")) }),
2516
+ ta.map(
2517
+ (a) => a.state === "missing" ? /* @__PURE__ */ e(
2518
+ Re,
2519
+ {
2520
+ label: a.name,
2521
+ checked: Xa(a.id),
2522
+ onCheckedChange: () => er(
2523
+ (m) => m.includes(a.id) ? m.filter((C) => C !== a.id) : [...m, a.id]
2524
+ )
2525
+ },
2526
+ a.id
2527
+ ) : /* @__PURE__ */ e("p", { className: "type-body ds:m-0", children: `${a.name}: ${t(
2528
+ F(
2529
+ a.state === "signed" ? "consentSigned" : "consentRequested"
2530
+ )
2531
+ )}` }, a.id)
2532
+ )
2533
+ ]
2534
+ }
2535
+ ) : null,
2536
+ da.length > 0 ? /* @__PURE__ */ c(
2537
+ "fieldset",
2538
+ {
2539
+ "data-editor-devices": "",
2540
+ className: `${Y} ds:m-0 ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:border-0 ds:p-0`,
2541
+ children: [
2542
+ /* @__PURE__ */ e("legend", { className: "type-label ds:text-foreground ds:p-0", children: t(r("devices")) }),
2543
+ da.map((a) => {
2544
+ var $;
2545
+ const m = (($ = E.careById(a.careId)) == null ? void 0 : $.name) ?? a.careId, C = jt(
2546
+ a,
2547
+ Cs[a.careId]
2548
+ ), U = a.options.every((ne) => ne.busy);
2549
+ return /* @__PURE__ */ c(
2550
+ "div",
2551
+ {
2552
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
2553
+ children: [
2554
+ /* @__PURE__ */ e(z, { label: m, children: /* @__PURE__ */ e(
2555
+ be,
2556
+ {
2557
+ options: a.options.map((ne) => ({
2558
+ value: ne.id,
2559
+ label: ne.busy ? `${ne.name} (${t(r("deviceBusy"))})` : ne.name,
2560
+ disabled: ne.busy === !0
2561
+ })),
2562
+ value: C ?? "",
2563
+ placeholder: t(r("deviceNoneFree")),
2564
+ onValueChange: (ne) => nr({
2565
+ slot: xs,
2566
+ byCare: {
2567
+ ...Cs,
2568
+ [a.careId]: ne
2569
+ }
2570
+ })
2571
+ }
2572
+ ) }),
2573
+ U ? /* @__PURE__ */ e(L, { variant: "warning", announce: "polite", children: /* @__PURE__ */ e(L.Description, { children: t(r("devicesAllBusy"), { care: m }) }) }) : null
2574
+ ]
2575
+ },
2576
+ a.careId
2577
+ );
2578
+ })
2579
+ ]
2580
+ }
2581
+ ) : null,
2582
+ /* @__PURE__ */ c(
2583
+ "fieldset",
2584
+ {
2585
+ className: `${Y} ds:m-0 ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:border-0 ds:p-0`,
2586
+ children: [
2587
+ /* @__PURE__ */ e("legend", { className: "type-label ds:text-foreground ds:p-0", children: t(r("options")) }),
2588
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-wrap ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-sm)]", children: [
2589
+ Ds ? /* @__PURE__ */ c(ae, { children: [
2590
+ /* @__PURE__ */ e(
2591
+ Re,
2592
+ {
2593
+ label: Le && xn !== null ? `${t(r("smsReminder"))} ${t(r("reminderDisabled"))}` : t(r("smsReminder")),
2594
+ checked: $e && (!Le || as),
2595
+ disabled: Le && !as,
2596
+ disabledReason: Le && xn !== null ? t(xn) : void 0,
2597
+ "aria-invalid": is || void 0,
2598
+ "aria-describedby": is ? Ue : void 0,
2599
+ onCheckedChange: (a) => {
2600
+ Gn(!1), Yn(a === !0);
2601
+ }
2602
+ }
2603
+ ),
2604
+ /* @__PURE__ */ e(
2605
+ Re,
2606
+ {
2607
+ label: Le && Cn !== null ? `${t(r("emailReminder"))} ${t(r("reminderDisabled"))}` : t(r("emailReminder")),
2608
+ checked: Ke && (!Le || ts),
2609
+ disabled: Le && !ts,
2610
+ disabledReason: Le && Cn !== null ? t(Cn) : void 0,
2611
+ "aria-invalid": is || void 0,
2612
+ "aria-describedby": is ? Ue : void 0,
2613
+ onCheckedChange: (a) => {
2614
+ Gn(!1), Mn(a === !0);
2615
+ }
2616
+ }
2617
+ )
2618
+ ] }) : null,
2619
+ /* @__PURE__ */ e(
2620
+ Re,
2621
+ {
2622
+ label: t(r("allDay")),
2623
+ checked: un,
2624
+ onCheckedChange: (a) => Ki(a === !0)
2625
+ }
2626
+ ),
2627
+ w ? null : /* @__PURE__ */ e(
2628
+ Re,
2629
+ {
2630
+ label: t(r("repeats")),
2631
+ disabled: (W == null ? void 0 : W.editRecurrence) === !1 || gs,
2632
+ disabledReason: gs ? t(r("repeatsCarePlan")) : void 0,
2633
+ checked: ns,
2634
+ onCheckedChange: (a) => Ha(a === !0)
2635
+ }
2636
+ ),
2637
+ ja ? /* @__PURE__ */ e(
2638
+ Re,
2639
+ {
2640
+ label: t(r("addToWaitingList")),
2641
+ checked: na,
2642
+ onCheckedChange: (a) => Ji(a === !0)
2643
+ }
2644
+ ) : null
2645
+ ] })
2646
+ ]
2647
+ }
2648
+ ),
2649
+ Ds && Te.assigned ? [
2650
+ ["sms", pa, "smsReminder"],
2651
+ ["email", ba, "emailReminder"]
2652
+ ].map(
2653
+ ([a, m, C]) => (
2654
+ /* A tick that an edit keeps is never removed, so it
2655
+ never says it was. */
2656
+ m === null || m === "earlier" && !Ze ? null : /* @__PURE__ */ e(
2657
+ L,
2658
+ {
2659
+ variant: "info",
2660
+ announce: "polite",
2661
+ className: Y,
2662
+ children: /* @__PURE__ */ e(L.Description, { children: t(
2663
+ r(
2664
+ m === "earlier" ? "sameDayReminderEarlier" : "sameDayReminderLater"
2665
+ ),
2666
+ { channel: t(r(C)) }
2667
+ ) })
2668
+ },
2669
+ a
2670
+ )
2671
+ )
2672
+ ) : null,
2673
+ w ? null : /* @__PURE__ */ e(ae, { children: ns ? /* @__PURE__ */ c(ae, { children: [
2674
+ /* @__PURE__ */ e(
2675
+ z,
2676
+ {
2677
+ className: Be,
2678
+ label: t(r("recurrence")),
2679
+ children: /* @__PURE__ */ e(
2680
+ be,
2681
+ {
2682
+ options: [
2683
+ ...Hr.map((a) => ({
2684
+ value: a,
2685
+ label: t(r(As[a]))
2686
+ })),
2687
+ ...Js ? [
2688
+ {
2689
+ value: "custom",
2690
+ label: t(r("recurrenceCustom"))
2691
+ }
2692
+ ] : []
2693
+ ],
2694
+ value: Fn,
2695
+ onValueChange: (a) => qi(a)
2696
+ }
2697
+ )
2698
+ }
2699
+ ),
2700
+ Js && Fn === "custom" ? /* @__PURE__ */ e(
2701
+ ro,
2702
+ {
2703
+ value: ys,
2704
+ onChange: ji,
2705
+ start: ea,
2706
+ locale: T ?? Q.language,
2707
+ fieldClassName: Ls,
2708
+ wideClassName: Y
2709
+ }
2710
+ ) : null,
2711
+ hn ? /* @__PURE__ */ e(
2712
+ z,
2713
+ {
2714
+ className: Be,
2715
+ label: t(r("recurrenceEnds")),
2716
+ children: /* @__PURE__ */ e(
2717
+ be,
2718
+ {
2719
+ options: [
2720
+ {
2721
+ value: "count",
2722
+ label: t(r("recurrenceEndsCount"))
2723
+ },
2724
+ {
2725
+ value: "until",
2726
+ label: t(r("recurrenceEndsUntil"))
2727
+ }
2728
+ ],
2729
+ value: Nn,
2730
+ onValueChange: (a) => {
2731
+ const m = a;
2732
+ Yi(m), m === "until" && !Me && O && Xs(qt(O, 1));
2733
+ }
2734
+ }
2735
+ )
2736
+ }
2737
+ ) : null,
2738
+ !hn || Nn === "count" ? /* @__PURE__ */ e(
2739
+ z,
2740
+ {
2741
+ className: Be,
2742
+ label: t(r("recurrenceCount")),
2743
+ children: /* @__PURE__ */ e(
2744
+ Sa,
2745
+ {
2746
+ value: ks,
2747
+ min: 2,
2748
+ max: Ur,
2749
+ onChange: Xi
2750
+ }
2751
+ )
2752
+ }
2753
+ ) : /* @__PURE__ */ e(
2754
+ z,
2755
+ {
2756
+ className: Be,
2757
+ label: t(r("recurrenceUntil")),
2758
+ error: Ka ? (
2759
+ /* The grid's existing "on or after" message:
2760
+ the same rule, already translated. */
2761
+ t("dataTable.agGrid.minDateValidation", {
2762
+ var0: new Intl.DateTimeFormat(Mt, {
2763
+ dateStyle: "medium"
2764
+ }).format(O ?? new Date(E.nowIso))
2765
+ })
2766
+ ) : void 0,
2767
+ children: /* @__PURE__ */ e(
2768
+ $s,
2769
+ {
2770
+ value: Me,
2771
+ onChange: Xs,
2772
+ minDate: O
2773
+ }
2774
+ )
2775
+ }
2776
+ ),
2777
+ Ga ? /* @__PURE__ */ c(
2778
+ "div",
2779
+ {
2780
+ className: `${Y} ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]`,
2781
+ children: [
2782
+ /* @__PURE__ */ e(
2783
+ Re,
2784
+ {
2785
+ label: t(r("skipClosedDays")),
2786
+ "aria-describedby": Ua,
2787
+ checked: Qs,
2788
+ onCheckedChange: (a) => Qi(a === !0)
2789
+ }
2790
+ ),
2791
+ /* @__PURE__ */ e(
2792
+ "span",
2793
+ {
2794
+ id: Ua,
2795
+ className: "type-body-sm ds:text-start ds:text-[color:var(--muted-foreground)]",
2796
+ children: t(r("skipClosedDaysHint"))
2797
+ }
2798
+ )
2799
+ ]
2800
+ }
2801
+ ) : null,
2802
+ Js && qa ? /* @__PURE__ */ e(
2803
+ oo,
2804
+ {
2805
+ summary: qa,
2806
+ className: Y
2807
+ }
2808
+ ) : null
2809
+ ] }) : null }),
2810
+ /* @__PURE__ */ e(
2811
+ z,
2812
+ {
2813
+ ref: Rt,
2814
+ className: Be,
2815
+ label: t(F("chair")),
2816
+ children: /* @__PURE__ */ e(
2817
+ be,
2818
+ {
2819
+ showDescriptions: !0,
2820
+ options: [
2821
+ { value: q, label: t(r("unassigned")) },
2822
+ ...oe !== q && !E.chairs.some((a) => a.id === oe) ? [
2823
+ {
2824
+ value: oe,
2825
+ label: `${t(F("chair"))} (${oe})`,
2826
+ disabled: !0
2827
+ }
2828
+ ] : [],
2829
+ ...bs.list.map((a) => ({
2830
+ value: a.id,
2831
+ label: a.title
2832
+ }))
2833
+ ],
2834
+ value: oe,
2835
+ onValueChange: (a) => {
2836
+ kn(a);
2837
+ }
2838
+ }
2839
+ )
2840
+ }
2841
+ ),
2842
+ /* @__PURE__ */ e(
2843
+ z,
2844
+ {
2845
+ ref: wt,
2846
+ className: Be,
2847
+ label: t(F("operator")),
2848
+ required: !!(n != null && n.callToAction),
2849
+ description: (n == null ? void 0 : n.callToAction) === "processBooking" ? t("calendarWorkspace.backlog.processOperatorHint") : (n == null ? void 0 : n.callToAction) === "assignOperator" ? t("calendarWorkspace.backlog.assignOperatorHint") : void 0,
2850
+ children: /* @__PURE__ */ e(
2851
+ be,
2852
+ {
2853
+ showDescriptions: !0,
2854
+ options: [
2855
+ { value: q, label: t(r("unassigned")) },
2856
+ ...se !== q && !He.some(
2857
+ (a) => a.id === se
2858
+ ) ? [
2859
+ {
2860
+ value: se,
2861
+ label: ((Vt = E.operators.find(
2862
+ (a) => a.id === se
2863
+ )) == null ? void 0 : Vt.title) ?? `${t(F("operator"))} (${se})`,
2864
+ disabled: !0
2865
+ }
2866
+ ] : [],
2867
+ ...ps.list.map((a) => ({
2868
+ value: a.id,
2869
+ label: a.title
2870
+ }))
2871
+ ],
2872
+ value: se,
2873
+ onValueChange: (a) => {
2874
+ On(a);
2875
+ }
2876
+ }
2877
+ )
2878
+ }
2879
+ ),
2880
+ xt.chairBusy ? /* @__PURE__ */ e(
2881
+ L,
2882
+ {
2883
+ variant: "warning",
2884
+ announce: "polite",
2885
+ className: Y,
2886
+ children: /* @__PURE__ */ e(L.Description, { children: t(r("chairBusy")) })
2887
+ }
2888
+ ) : null,
2889
+ xt.operatorBusy ? /* @__PURE__ */ e(
2890
+ L,
2891
+ {
2892
+ variant: "warning",
2893
+ announce: "polite",
2894
+ className: Y,
2895
+ children: /* @__PURE__ */ e(L.Description, { children: t(r("operatorBusy")) })
2896
+ }
2897
+ ) : null,
2898
+ nt ? /* @__PURE__ */ e(
2899
+ L,
2900
+ {
2901
+ variant: "warning",
2902
+ announce: "polite",
2903
+ className: Y,
2904
+ children: /* @__PURE__ */ e(L.Description, { children: t(r("operatorAbsent")) })
2905
+ }
2906
+ ) : null,
2907
+ Ct ? /* @__PURE__ */ e("div", { className: Y, children: /* @__PURE__ */ e(
2908
+ Sn,
2909
+ {
2910
+ label: t(r("recurringSaveMode")),
2911
+ value: dt,
2912
+ onValueChange: (a) => ir(a),
2913
+ children: Jt.map((a) => /* @__PURE__ */ e(
2914
+ Ae,
2915
+ {
2916
+ value: a,
2917
+ label: t(r(Os[a]))
2918
+ },
2919
+ a
2920
+ ))
2921
+ }
2922
+ ) }) : null,
2923
+ y ? /* @__PURE__ */ e("div", { className: Y, children: y }) : null
2924
+ ]
2925
+ }
2926
+ )
2927
+ ] }) })
2928
+ ]
2929
+ }
2930
+ ),
2931
+ /* @__PURE__ */ e(
2932
+ "fieldset",
2933
+ {
2934
+ hidden: nn !== "form" || Ve,
2935
+ disabled: dn,
2936
+ className: "ds:relative ds:z-10 ds:m-0 ds:min-w-0 ds:shrink-0 ds:border-0 ds:border-t ds:border-[color:var(--border)] ds:bg-[var(--background)] ds:p-0",
2937
+ children: /* @__PURE__ */ e("div", { className: "ds:@container/apptstrip", children: /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)] ds:pt-[var(--spacing-sm)]", children: [
2938
+ Te.assigned && !X && !me ? /* @__PURE__ */ e(
2939
+ xo,
2940
+ {
2941
+ onWhatsApp: de,
2942
+ channels: d == null ? void 0 : d.reminderChannels
2943
+ }
2944
+ ) : null,
2945
+ /* @__PURE__ */ c("span", { className: "ds:ms-auto ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
2946
+ w && !X && !me && (xe || A) ? /* @__PURE__ */ c(Z.Root, { children: [
2947
+ /* @__PURE__ */ c(
2948
+ ti,
2949
+ {
2950
+ role: "toolbar",
2951
+ "aria-label": t(F("placementLabel")),
2952
+ children: [
2953
+ xe ? /* @__PURE__ */ e(
2954
+ ve,
2955
+ {
2956
+ size: "sm",
2957
+ intent: "outline",
2958
+ icon: /* @__PURE__ */ e(Cr, { "aria-hidden": "true" }),
2959
+ "aria-label": t(F("move")),
2960
+ tooltip: t(F("move")),
2961
+ onClick: xe
2962
+ }
2963
+ ) : null,
2964
+ A && Ee ? /* @__PURE__ */ e(Z.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
2965
+ ve,
2966
+ {
2967
+ size: "sm",
2968
+ intent: "outline",
2969
+ icon: /* @__PURE__ */ e(Gt, { "aria-hidden": "true" }),
2970
+ "aria-label": t(F("copy")),
2971
+ tooltip: t(F("copy"))
2972
+ }
2973
+ ) }) : A ? /* @__PURE__ */ e(
2974
+ ve,
2975
+ {
2976
+ size: "sm",
2977
+ intent: "outline",
2978
+ icon: /* @__PURE__ */ e(Gt, { "aria-hidden": "true" }),
2979
+ "aria-label": t(F("copy")),
2980
+ tooltip: t(F("copy")),
2981
+ onClick: () => A(!1)
2982
+ }
2983
+ ) : null
2984
+ ]
2985
+ }
2986
+ ),
2987
+ /* @__PURE__ */ c(Z.Content, { align: "end", children: [
2988
+ /* @__PURE__ */ e(
2989
+ Z.Item,
2990
+ {
2991
+ startIcon: /* @__PURE__ */ e(Ts, { "aria-hidden": "true" }),
2992
+ onSelect: () => A == null ? void 0 : A(!1),
2993
+ children: t(r("duplicateAppointmentOnly"))
2994
+ }
2995
+ ),
2996
+ /* @__PURE__ */ e(
2997
+ Z.Item,
2998
+ {
2999
+ startIcon: /* @__PURE__ */ e(Ra, { "aria-hidden": "true" }),
3000
+ onSelect: () => A == null ? void 0 : A(!0),
3001
+ children: t(r("duplicateWithTreatments"))
3002
+ }
3003
+ )
3004
+ ] })
3005
+ ] }) : null,
3006
+ X ? null : /* @__PURE__ */ c(Z.Root, { children: [
3007
+ /* @__PURE__ */ c(
3008
+ ti,
3009
+ {
3010
+ role: "toolbar",
3011
+ "aria-label": t(r("actionsLabel")),
3012
+ children: [
3013
+ zn ? /* @__PURE__ */ e(
3014
+ ve,
3015
+ {
3016
+ size: "sm",
3017
+ intent: "primary",
3018
+ icon: /* @__PURE__ */ e(ri, { "aria-hidden": "true" }),
3019
+ flipIconInRtl: !0,
3020
+ "aria-label": t(r("saveAndReturn")),
3021
+ tooltip: t(r("saveAndReturn")),
3022
+ disabled: !ss,
3023
+ onClick: () => fa({ andReturn: !0 })
3024
+ }
3025
+ ) : null,
3026
+ /* @__PURE__ */ e(
3027
+ ve,
3028
+ {
3029
+ size: "sm",
3030
+ intent: zn ? "outline" : "primary",
3031
+ icon: /* @__PURE__ */ e(kr, { "aria-hidden": "true" }),
3032
+ "aria-label": t(r(zn ? "saveAndStay" : "save")),
3033
+ tooltip: t(r(zn ? "saveAndStay" : "save")),
3034
+ disabled: !ss,
3035
+ onClick: () => fa({ keepOpen: zn })
3036
+ }
3037
+ ),
3038
+ /* @__PURE__ */ e(
3039
+ ve,
3040
+ {
3041
+ size: "sm",
3042
+ intent: "outline",
3043
+ icon: /* @__PURE__ */ e(Ed, { "aria-hidden": "true" }),
3044
+ "aria-label": t(r("cancel")),
3045
+ tooltip: t(r("cancel")),
3046
+ disabled: !sr,
3047
+ onClick: () => ue ? ue.ask(_e) : _e()
3048
+ }
3049
+ ),
3050
+ w && !me && b && Ee ? /* @__PURE__ */ e(Z.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
3051
+ ve,
3052
+ {
3053
+ size: "sm",
3054
+ intent: "outline",
3055
+ icon: /* @__PURE__ */ e(Ts, { "aria-hidden": "true" }),
3056
+ "aria-label": t(r("duplicate")),
3057
+ tooltip: t(r("duplicate"))
3058
+ }
3059
+ ) }) : w && !me && b ? /* @__PURE__ */ e(
3060
+ ve,
3061
+ {
3062
+ size: "sm",
3063
+ intent: "outline",
3064
+ icon: /* @__PURE__ */ e(Ts, { "aria-hidden": "true" }),
3065
+ "aria-label": t(r("duplicate")),
3066
+ tooltip: t(r("duplicate")),
3067
+ onClick: () => Na(!1)
3068
+ }
3069
+ ) : null,
3070
+ w && !me ? /* @__PURE__ */ e(
3071
+ ve,
3072
+ {
3073
+ size: "sm",
3074
+ intent: "destructive",
3075
+ icon: /* @__PURE__ */ e(Fs, { "aria-hidden": "true" }),
3076
+ "aria-label": t(r("delete")),
3077
+ tooltip: t(r("delete")),
3078
+ onClick: () => {
3079
+ n != null && n.editEventId && (u == null || u(n.editEventId)), rt(!0);
3080
+ }
3081
+ }
3082
+ ) : null
3083
+ ]
3084
+ }
3085
+ ),
3086
+ b ? /* @__PURE__ */ c(Z.Content, { align: "end", children: [
3087
+ /* @__PURE__ */ e(
3088
+ Z.Item,
3089
+ {
3090
+ startIcon: /* @__PURE__ */ e(Ts, { "aria-hidden": "true" }),
3091
+ onSelect: () => Na(!1),
3092
+ children: t(r("duplicateAppointmentOnly"))
3093
+ }
3094
+ ),
3095
+ /* @__PURE__ */ e(
3096
+ Z.Item,
3097
+ {
3098
+ startIcon: /* @__PURE__ */ e(Ra, { "aria-hidden": "true" }),
3099
+ onSelect: () => Na(!0),
3100
+ children: t(r("duplicateWithTreatments"))
3101
+ }
3102
+ )
3103
+ ] }) : null
3104
+ ] })
3105
+ ] })
3106
+ ] }) })
3107
+ }
3108
+ ),
3109
+ w ? /* @__PURE__ */ e(
3110
+ Vd,
3111
+ {
3112
+ open: tr,
3113
+ onOpenChange: rt,
3114
+ scopes: It,
3115
+ offersCarePlanCleanup: cr,
3116
+ onConfirm: mr
3117
+ }
3118
+ ) : null
3119
+ ]
3120
+ }
3121
+ );
3122
+ }
3123
+ function kl({
3124
+ row: n,
3125
+ patientRef: s,
3126
+ showAge: i = !1,
3127
+ onOpenPatient: u,
3128
+ anamnesisAnswers: b
3129
+ }) {
3130
+ const { t: f } = le("ui"), g = Ye(), o = s.record;
3131
+ return /* @__PURE__ */ e(
3132
+ Dr,
3133
+ {
3134
+ name: Ta(
3135
+ s,
3136
+ n.event.title,
3137
+ f("calendarWorkspace.details.patientNotLoaded")
3138
+ ),
3139
+ avatarSrc: o == null ? void 0 : o.avatarSrc,
3140
+ unresolved: s.unresolved,
3141
+ status: n.event.status,
3142
+ flags: n.event,
3143
+ age: i && (o != null && o.dobIso) ? ed(o.dobIso, g) : void 0,
3144
+ onOpenPatient: u && o ? () => u(o) : void 0,
3145
+ highlightedAnamnesisCount: o == null ? void 0 : o.highlightedAnamnesisCount,
3146
+ expiredAnamnesisCount: o == null ? void 0 : o.expiredAnamnesisCount,
3147
+ anamnesisAnswers: b
3148
+ }
3149
+ );
3150
+ }
3151
+ function xo({
3152
+ onWhatsApp: n,
3153
+ channels: s = ko
3154
+ }) {
3155
+ const { t: i } = le("ui"), u = (o) => `calendarWorkspace.details.${o}`, [b, f] = N(""), g = [
3156
+ {
3157
+ id: "whatsapp",
3158
+ label: i(u("remindWhatsApp")),
3159
+ icon: /* @__PURE__ */ e(bi, { "aria-hidden": "true" })
3160
+ },
3161
+ {
3162
+ id: "sms",
3163
+ label: i(u("remindSms")),
3164
+ icon: /* @__PURE__ */ e(xi, { "aria-hidden": "true" })
3165
+ },
3166
+ {
3167
+ id: "email",
3168
+ label: i(u("remindEmail")),
3169
+ icon: /* @__PURE__ */ e(Ci, { "aria-hidden": "true" })
3170
+ }
3171
+ ].filter((o) => s.includes(o.id));
3172
+ return g.length === 0 ? null : /* @__PURE__ */ c(ae, { children: [
3173
+ /* @__PURE__ */ e(yi, { "aria-label": i(u("remind")), children: g.map((o) => /* @__PURE__ */ e(
3174
+ te,
3175
+ {
3176
+ size: "sm",
3177
+ intent: "outline",
3178
+ startIcon: o.icon,
3179
+ "aria-label": o.label,
3180
+ title: o.label,
3181
+ onClick: () => o.id === "whatsapp" && n ? n() : f(o.label),
3182
+ children: /* @__PURE__ */ e("span", { className: "ds:hidden ds:@[480px]/apptstrip:inline", children: o.label })
3183
+ },
3184
+ o.id
3185
+ )) }),
3186
+ /* @__PURE__ */ e(Ps, { "aria-live": "polite", children: b ? i(u("remindSent"), { channel: b }) : "" })
3187
+ ] });
3188
+ }
3189
+ function fl({
3190
+ row: n,
3191
+ patient: s,
3192
+ locale: i,
3193
+ signRequestedVia: u,
3194
+ onRequestSignature: b,
3195
+ onRequestSignatureOnDevice: f,
3196
+ readOnly: g = !1,
3197
+ platform: o
3198
+ }) {
3199
+ var Q;
3200
+ const y = Ye(), { t: v } = le("ui"), l = (r) => `calendarWorkspace.details.${r}`, { t: k } = le("ui"), h = y.metaById[n.event.id], D = (h == null ? void 0 : h.documentsToSign) ?? [], T = Zr(D), [S, _] = N(""), B = (r) => {
3201
+ b == null || b(n.event.id, r), _(
3202
+ v(l("signingRequestedReadout"), {
3203
+ channel: v(l(r === "sms" ? "remindSms" : "remindEmail"))
3204
+ })
3205
+ );
3206
+ }, xe = v(l(u === "sms" ? "signingRequestedSms" : u === "email" ? "signingRequestedEmail" : "signingNotRequested")), A = n.careLink, de = (A == null ? void 0 : A.kind) === "plan" ? y.carePlanById(A.planId) : void 0, X = (A == null ? void 0 : A.kind) === "plan" && de ? de.entries.filter((r) => A.entryIds.includes(r.id)) : [], ke = (A == null ? void 0 : A.kind) === "priceList" ? (Q = (y.priceLists ?? []).find((r) => r.id === A.priceListId)) == null ? void 0 : Q.name : void 0, R = new Intl.NumberFormat(i, {
3207
+ style: "currency",
3208
+ currency: y.currency ?? "EUR"
3209
+ }), H = "ds:flex ds:items-baseline ds:gap-[var(--spacing-xs)]", d = "type-body-sm ds:text-[color:var(--muted-foreground)] ds:shrink-0", tn = s ? Sr(s) : "", t = s ? wr(s) : "", E = !!(o != null && o.mapsLink) && tn !== "", pe = !!(s != null && s.dobIso || s != null && s.phone || s != null && s.email || s != null && s.city || o != null && o.bookingPhone || E);
3210
+ return /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)] ds:pt-[var(--spacing-md)]", children: [
3211
+ n.series ? /* @__PURE__ */ c("div", { className: H, children: [
3212
+ /* @__PURE__ */ e("span", { className: d, children: v(l("seriesLabel")) }),
3213
+ /* @__PURE__ */ c("span", { children: [
3214
+ v(l("seriesSummary"), {
3215
+ frequency: v(
3216
+ `calendarWorkspace.editor.${As[n.series.frequency]}`
3217
+ ),
3218
+ index: n.series.index,
3219
+ total: n.series.total,
3220
+ last: Rn(i, n.series.lastIso)
3221
+ }),
3222
+ n.series.skipped > 0 ? ` · ${v(l("seriesSkipped"), { n: n.series.skipped })}` : ""
3223
+ ] })
3224
+ ] }) : null,
3225
+ A ? /* @__PURE__ */ c(ae, { children: [
3226
+ /* @__PURE__ */ e("h3", { className: "type-label ds:m-0 ds:uppercase ds:text-[color:var(--muted-foreground)]", children: v(l("sectionTreatments")) }),
3227
+ A.kind === "plan" && de ? /* @__PURE__ */ c(ae, { children: [
3228
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
3229
+ /* @__PURE__ */ e(
3230
+ Ra,
3231
+ {
3232
+ size: 14,
3233
+ "aria-hidden": "true",
3234
+ className: "ds:shrink-0"
3235
+ }
3236
+ ),
3237
+ /* @__PURE__ */ e("span", { children: v(l("planLine"), {
3238
+ number: de.number,
3239
+ name: de.name
3240
+ }) })
3241
+ ] }),
3242
+ X.map((r) => {
3243
+ var _e, Ce;
3244
+ const F = y.careById(r.careId), G = (_e = A.phasesByEntry) == null ? void 0 : _e[r.id];
3245
+ return /* @__PURE__ */ c(
3246
+ "div",
3247
+ {
3248
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
3249
+ children: [
3250
+ /* @__PURE__ */ c("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-2xs)]", children: [
3251
+ /* @__PURE__ */ e("span", { children: (F == null ? void 0 : F.name) ?? r.careId }),
3252
+ F ? /* @__PURE__ */ e("span", { className: "type-meta ds:tabular-nums ds:text-[color:var(--muted-foreground)]", children: F.code }) : null,
3253
+ (Ce = r.elements) == null ? void 0 : Ce.map((ue) => /* @__PURE__ */ e(Ws, { label: ue, variant: "info", size: "sm" }, ue)),
3254
+ r.done ? /* @__PURE__ */ e(an, { variant: "success", size: "sm", withDot: !0, children: k("carePlanEntryCard.flag.done") }) : null,
3255
+ ui(r) ? /* @__PURE__ */ e(an, { variant: "neutral", size: "sm", children: k("carePlanEntryCard.flag.billed") }) : null,
3256
+ r.billing === "reversed" ? /* @__PURE__ */ c(
3257
+ an,
3258
+ {
3259
+ variant: "warning",
3260
+ size: "sm",
3261
+ title: k("treatmentReceipt.billReversed"),
3262
+ children: [
3263
+ k("treatmentReceipt.unbilled"),
3264
+ /* @__PURE__ */ e(Ps, { children: `, ${k("treatmentReceipt.billReversed")}` })
3265
+ ]
3266
+ }
3267
+ ) : null
3268
+ ] }),
3269
+ G && G.length > 0 ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-[color:var(--muted-foreground)]", children: v(l("phasesScheduled"), {
3270
+ phases: G.join(", ")
3271
+ }) }) : null
3272
+ ]
3273
+ },
3274
+ r.id
3275
+ );
3276
+ })
3277
+ ] }) : null,
3278
+ A.kind === "priceList" ? /* @__PURE__ */ c(ae, { children: [
3279
+ /* @__PURE__ */ c("div", { className: H, children: [
3280
+ /* @__PURE__ */ e("span", { className: d, children: v(l("priceListLine")) }),
3281
+ /* @__PURE__ */ e("span", { children: ke ?? A.priceListId })
3282
+ ] }),
3283
+ A.items.map((r, F) => {
3284
+ const G = y.careById(r.careId);
3285
+ return /* @__PURE__ */ c(
3286
+ "div",
3287
+ {
3288
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-2xs)]",
3289
+ children: [
3290
+ /* @__PURE__ */ e("span", { children: (G == null ? void 0 : G.name) ?? r.careId }),
3291
+ G ? /* @__PURE__ */ e("span", { className: "type-meta ds:tabular-nums ds:text-[color:var(--muted-foreground)]", children: G.code }) : null,
3292
+ /* @__PURE__ */ e("span", { className: "ds:ms-auto ds:tabular-nums", children: R.format(r.priceCents / 100) })
3293
+ ]
3294
+ },
3295
+ `${r.careId}-${F}`
3296
+ );
3297
+ })
3298
+ ] }) : null
3299
+ ] }) : null,
3300
+ D.length > 0 ? /* @__PURE__ */ c(ae, { children: [
3301
+ /* @__PURE__ */ e("h3", { className: "type-label ds:m-0 ds:uppercase ds:text-[color:var(--muted-foreground)]", children: v(l("sectionSigning")) }),
3302
+ /* @__PURE__ */ c(
3303
+ "span",
3304
+ {
3305
+ className: `ds:flex ds:items-center ds:gap-[var(--spacing-2xs)] ds:font-[var(--font-weight-semibold)] ${T.toSign > 0 ? "ds:text-[color:var(--warning-foreground)]" : "ds:text-[color:var(--success-foreground)]"}`,
3306
+ children: [
3307
+ T.toSign > 0 ? /* @__PURE__ */ e(Wd, { size: 16, "aria-hidden": "true" }) : /* @__PURE__ */ e($d, { size: 16, "aria-hidden": "true" }),
3308
+ T.toSign === 0 ? v(l("signingAllSigned")) : T.toSign === 1 ? v(l("signingToSignOne")) : v(l("signingToSignMany"), { n: T.toSign })
3309
+ ]
3310
+ }
3311
+ ),
3312
+ D.map((r) => /* @__PURE__ */ c(
3313
+ "div",
3314
+ {
3315
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
3316
+ children: [
3317
+ /* @__PURE__ */ e("span", { className: "ds:[min-inline-size:0] ds:truncate", children: r.name }),
3318
+ /* @__PURE__ */ e(
3319
+ md,
3320
+ {
3321
+ className: "ds:ms-auto",
3322
+ size: "sm",
3323
+ operator: r.operator,
3324
+ patient: r.patient
3325
+ }
3326
+ )
3327
+ ]
3328
+ },
3329
+ r.id
3330
+ )),
3331
+ T.toSign > 0 ? /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
3332
+ /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-[color:var(--muted-foreground)]", children: xe }),
3333
+ g ? null : /* @__PURE__ */ c(Z.Root, { children: [
3334
+ /* @__PURE__ */ e(Z.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
3335
+ te,
3336
+ {
3337
+ size: "sm",
3338
+ intent: "outline",
3339
+ startIcon: /* @__PURE__ */ e(Fd, { "aria-hidden": "true" }),
3340
+ children: v(l("signingRequest"))
3341
+ }
3342
+ ) }),
3343
+ /* @__PURE__ */ c(Z.Content, { align: "end", children: [
3344
+ /* @__PURE__ */ e(
3345
+ Z.Item,
3346
+ {
3347
+ startIcon: /* @__PURE__ */ e(xi, { "aria-hidden": "true" }),
3348
+ disabled: (s == null ? void 0 : s.smsEnabled) === !1,
3349
+ description: (s == null ? void 0 : s.smsEnabled) === !1 ? v(l("signingSmsDisabled")) : void 0,
3350
+ onSelect: () => B("sms"),
3351
+ children: v(l("signingViaSms"))
3352
+ }
3353
+ ),
3354
+ /* @__PURE__ */ e(
3355
+ Z.Item,
3356
+ {
3357
+ startIcon: /* @__PURE__ */ e(Ci, { "aria-hidden": "true" }),
3358
+ onSelect: () => B("email"),
3359
+ children: v(l("signingViaEmail"))
3360
+ }
3361
+ ),
3362
+ f ? /* @__PURE__ */ e(
3363
+ Z.Item,
3364
+ {
3365
+ startIcon: /* @__PURE__ */ e(zd, { "aria-hidden": "true" }),
3366
+ onSelect: f,
3367
+ children: v(l("signingOnDevice"))
3368
+ }
3369
+ ) : null
3370
+ ] })
3371
+ ] }),
3372
+ /* @__PURE__ */ e(Ps, { "aria-live": "polite", children: S })
3373
+ ] }) : null
3374
+ ] }) : null,
3375
+ n.event.isBookedOnline && (h != null && h.bookedAtIso) ? /* @__PURE__ */ c(ae, { children: [
3376
+ /* @__PURE__ */ e("h3", { className: "type-label ds:m-0 ds:uppercase ds:text-[color:var(--muted-foreground)]", children: v(l("sectionBooking")) }),
3377
+ /* @__PURE__ */ c("div", { className: H, children: [
3378
+ /* @__PURE__ */ e("span", { className: d, children: v(l("bookedAt")) }),
3379
+ /* @__PURE__ */ e(
3380
+ Aa,
3381
+ {
3382
+ value: h.bookedAtIso,
3383
+ format: "absolute",
3384
+ shape: "bare",
3385
+ locale: i,
3386
+ absoluteFormat: li
3387
+ }
3388
+ )
3389
+ ] }),
3390
+ h.bookingNote ? /* @__PURE__ */ c("div", { className: H, children: [
3391
+ /* @__PURE__ */ e("span", { className: d, children: v(l("bookingNote")) }),
3392
+ /* @__PURE__ */ e("span", { children: h.bookingNote })
3393
+ ] }) : null
3394
+ ] }) : null,
3395
+ (h == null ? void 0 : h.billableAmount) !== void 0 ? /* @__PURE__ */ c("div", { className: H, children: [
3396
+ /* @__PURE__ */ e("span", { className: d, children: v(l("billable")) }),
3397
+ /* @__PURE__ */ e("span", { children: R.format(h.billableAmount) })
3398
+ ] }) : null,
3399
+ o != null && o.paidOnlineAmount ? /* @__PURE__ */ c("div", { className: H, children: [
3400
+ /* @__PURE__ */ e("span", { className: d, children: v(l("paidOnline")) }),
3401
+ /* @__PURE__ */ e("span", { className: "ds:text-[color:var(--success-foreground)]", children: R.format(o.paidOnlineAmount) })
3402
+ ] }) : null,
3403
+ o != null && o.toCollectAmount ? /* @__PURE__ */ c("div", { className: H, children: [
3404
+ /* @__PURE__ */ e("span", { className: d, children: v(l("toCollect")) }),
3405
+ /* @__PURE__ */ e("span", { className: "ds:text-[color:var(--warning-foreground)]", children: R.format(o.toCollectAmount) })
3406
+ ] }) : null,
3407
+ pe ? /* @__PURE__ */ c(ae, { children: [
3408
+ /* @__PURE__ */ e("h3", { className: "type-label ds:m-0 ds:uppercase ds:text-[color:var(--muted-foreground)]", children: v(l("sectionPatient")) }),
3409
+ s != null && s.dobIso ? /* @__PURE__ */ c("div", { className: H, children: [
3410
+ /* @__PURE__ */ e("span", { className: d, children: v(l("dob")) }),
3411
+ /* @__PURE__ */ e("span", { children: Rn(i, s.dobIso) })
3412
+ ] }) : null,
3413
+ s != null && s.phone ? /* @__PURE__ */ c("div", { className: H, children: [
3414
+ /* @__PURE__ */ e("span", { className: d, children: v(l("phone")) }),
3415
+ /* @__PURE__ */ e("a", { href: `tel:${s.phone.replace(/\s/g, "")}`, dir: "ltr", children: s.phone })
3416
+ ] }) : null,
3417
+ s != null && s.email ? /* @__PURE__ */ c("div", { className: H, children: [
3418
+ /* @__PURE__ */ e("span", { className: d, children: v(l("email")) }),
3419
+ /* @__PURE__ */ e(
3420
+ "a",
3421
+ {
3422
+ className: "ds:truncate",
3423
+ href: `mailto:${s.email}`,
3424
+ dir: "ltr",
3425
+ children: s.email
3426
+ }
3427
+ )
3428
+ ] }) : null,
3429
+ s != null && s.city ? /* @__PURE__ */ c("div", { className: H, children: [
3430
+ /* @__PURE__ */ e("span", { className: d, children: v(l("city")) }),
3431
+ /* @__PURE__ */ e("span", { children: s.city })
3432
+ ] }) : null,
3433
+ o != null && o.bookingPhone ? /* @__PURE__ */ c("div", { className: H, children: [
3434
+ /* @__PURE__ */ e("span", { className: d, children: v(l("bookingPhone")) }),
3435
+ /* @__PURE__ */ e(
3436
+ "a",
3437
+ {
3438
+ href: `tel:${o.bookingPhone.replace(/\s/g, "")}`,
3439
+ dir: "ltr",
3440
+ children: o.bookingPhone
3441
+ }
3442
+ )
3443
+ ] }) : null,
3444
+ E && s ? /* @__PURE__ */ c("div", { className: H, children: [
3445
+ /* @__PURE__ */ e("span", { className: d, children: v(l("address")) }),
3446
+ /* @__PURE__ */ c(
3447
+ "a",
3448
+ {
3449
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]",
3450
+ href: Rr(s),
3451
+ target: "_blank",
3452
+ rel: "noopener noreferrer",
3453
+ "aria-label": `${v(l("mapsLink"))} — ${t}`,
3454
+ children: [
3455
+ /* @__PURE__ */ e(fi, { size: 14, "aria-hidden": "true" }),
3456
+ t
3457
+ ]
3458
+ }
3459
+ )
3460
+ ] }) : null
3461
+ ] }) : null
3462
+ ] });
3463
+ }
3464
+ const ze = (n) => `calendarWorkspace.inc1.bookings.${n}`;
3465
+ function Co(n) {
3466
+ const s = /* @__PURE__ */ new Map();
3467
+ for (const i of n) {
3468
+ const u = i.bookedAt ?? i.start, b = Number.isFinite(u.getTime()) ? u.toISOString().slice(0, 10) : "unknown", f = s.get(b);
3469
+ f ? f.views.push(i) : s.set(b, { dateKey: b, date: u, views: [i] });
3470
+ }
3471
+ return Array.from(s.values()).sort(
3472
+ (i, u) => u.date.getTime() - i.date.getTime()
3473
+ );
3474
+ }
3475
+ const Io = [
3476
+ "ds:pointer-events-none ds:absolute",
3477
+ "ds:-top-[var(--spacing-2xs)] ds:-end-[var(--spacing-2xs)]",
3478
+ "ds:size-[var(--spacing-sm)] ds:rounded-[var(--radius-full)]",
3479
+ "ds:bg-[color:var(--accent)]",
3480
+ "ds:outline-2 ds:outline-solid ds:outline-[color:var(--background)]",
3481
+ "ds:forced-colors:bg-[Highlight] ds:forced-colors:outline-[Canvas]"
3482
+ ].join(" "), So = [
3483
+ "type-meta",
3484
+ "ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:pb-[var(--spacing-xs)]",
3485
+ "ds:text-[color:var(--muted-foreground)]"
3486
+ ].join(" ");
3487
+ function wo(n, s) {
3488
+ return n ? !n.patient || !n.operator || s && !n.chair : !1;
3489
+ }
3490
+ function Ro({
3491
+ filters: n,
3492
+ chairsExist: s,
3493
+ narrowed: i,
3494
+ onFiltersChange: u
3495
+ }) {
3496
+ const { t: b } = le("ui"), f = wn(), g = (o, y) => {
3497
+ u == null || u({ ...n, [o]: y });
3498
+ };
3499
+ return /* @__PURE__ */ c(Z.Root, { id: "calendar-backlog-settings", children: [
3500
+ /* @__PURE__ */ c("span", { className: "ds:relative ds:inline-flex", children: [
3501
+ /* @__PURE__ */ e(Z.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
3502
+ ve,
3503
+ {
3504
+ intent: "ghost",
3505
+ size: "sm",
3506
+ icon: /* @__PURE__ */ e(Md, { "aria-hidden": "true" }),
3507
+ "data-backlog-settings": "",
3508
+ "data-narrowed": i ? "" : void 0,
3509
+ "aria-label": b(
3510
+ ze(i ? "settingsNarrowed" : "settings")
3511
+ )
3512
+ }
3513
+ ) }),
3514
+ i ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: Io }) : null
3515
+ ] }),
3516
+ /* @__PURE__ */ c(
3517
+ Z.Content,
3518
+ {
3519
+ align: "end",
3520
+ className: "ds:w-64",
3521
+ "aria-describedby": f,
3522
+ children: [
3523
+ /* @__PURE__ */ e(Z.Label, { children: b(ze("settingsTitle")) }),
3524
+ /* @__PURE__ */ e("div", { id: f, className: So, children: b(ze("settingsHint")) }),
3525
+ /* @__PURE__ */ c(Z.Group, { "data-component": "calendar-backlog-filters", children: [
3526
+ /* @__PURE__ */ e(
3527
+ Z.SwitchItem,
3528
+ {
3529
+ name: "withoutPatient",
3530
+ checked: n.patient,
3531
+ onCheckedChange: (o) => g("patient", o),
3532
+ children: b(ze("filterNoPatient"))
3533
+ }
3534
+ ),
3535
+ /* @__PURE__ */ e(
3536
+ Z.SwitchItem,
3537
+ {
3538
+ name: "withoutOperator",
3539
+ checked: n.operator,
3540
+ onCheckedChange: (o) => g("operator", o),
3541
+ children: b(ze("filterNoOperator"))
3542
+ }
3543
+ ),
3544
+ s ? /* @__PURE__ */ e(
3545
+ Z.SwitchItem,
3546
+ {
3547
+ name: "withoutChair",
3548
+ checked: n.chair,
3549
+ onCheckedChange: (o) => g("chair", o),
3550
+ children: b(ze("filterNoChair"))
3551
+ }
3552
+ ) : null
3553
+ ] }),
3554
+ /* @__PURE__ */ e(Z.Separator, {}),
3555
+ /* @__PURE__ */ e(
3556
+ Z.Item,
3557
+ {
3558
+ startIcon: /* @__PURE__ */ e(Bd, { "aria-hidden": "true" }),
3559
+ onSelect: () => u == null ? void 0 : u(Jr),
3560
+ children: b("common.resetToDefaults")
3561
+ }
3562
+ )
3563
+ ]
3564
+ }
3565
+ )
3566
+ ] });
3567
+ }
3568
+ function Nl({
3569
+ bookings: n,
3570
+ locale: s,
3571
+ privacy: i = !1,
3572
+ status: u = "ready",
3573
+ lastSeenIso: b,
3574
+ createdAtById: f,
3575
+ currentBookingId: g,
3576
+ currentBookingKey: o,
3577
+ onRetry: y,
3578
+ onShowInCalendar: v,
3579
+ onComplete: l,
3580
+ resourceKind: k,
3581
+ filters: h,
3582
+ onFiltersChange: D
3583
+ }) {
3584
+ const { t: T } = le("ui"), S = Ye(), _ = S.chairs.length > 0, B = ye(
3585
+ () => n.map(
3586
+ (R) => qr(
3587
+ R,
3588
+ S,
3589
+ b ? new Date(b).getTime() : null,
3590
+ f == null ? void 0 : f[R.event.id]
3591
+ )
3592
+ ),
3593
+ [n, S, b, f]
3594
+ ), xe = ye(() => Co(B), [B]), A = k === "chair" && B.some((R) => R.needsChair), de = wo(h, _), X = P(null);
3595
+ V(() => {
3596
+ var R, H;
3597
+ g && ((R = X.current) == null || R.scrollIntoView({ block: "center" }), (H = X.current) == null || H.focus());
3598
+ }, [g, o]);
3599
+ const ke = (R) => {
3600
+ const H = R.eventId === g;
3601
+ return (
3602
+ /* No <li> wrapper: the card is its own role="listitem". */
3603
+ /* @__PURE__ */ e(
3604
+ Oi,
3605
+ {
3606
+ ref: H ? X : void 0,
3607
+ view: R,
3608
+ locale: s,
3609
+ privacy: i,
3610
+ canComplete: !!l && u === "ready",
3611
+ onComplete: l,
3612
+ onShowInCalendar: v,
3613
+ addressed: H,
3614
+ addressKey: o
3615
+ },
3616
+ R.eventId
3617
+ )
3618
+ );
3619
+ };
3620
+ return /* @__PURE__ */ c(
3621
+ "div",
3622
+ {
3623
+ "data-component": "calendar-bookings",
3624
+ "data-status": u,
3625
+ className: "ds:flex ds:h-full ds:flex-col",
3626
+ children: [
3627
+ /* @__PURE__ */ e(
3628
+ Ms,
3629
+ {
3630
+ title: T(ze("title")),
3631
+ icon: /* @__PURE__ */ e(Ld, { "aria-hidden": "true" }),
3632
+ sticky: !0,
3633
+ divider: !0,
3634
+ actions: h ? /* @__PURE__ */ e(
3635
+ Ro,
3636
+ {
3637
+ filters: h,
3638
+ chairsExist: _,
3639
+ narrowed: de,
3640
+ onFiltersChange: D
3641
+ }
3642
+ ) : void 0
3643
+ }
3644
+ ),
3645
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
3646
+ /* @__PURE__ */ e("p", { className: "type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]", children: T(ze("intro")) }),
3647
+ A ? /* @__PURE__ */ e("p", { className: "type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]", children: T(ze("notShownOnChairAxis")) }) : null,
3648
+ u === "loading" ? /* @__PURE__ */ c(ae, { children: [
3649
+ /* @__PURE__ */ e("p", { role: "status", className: "ds:sr-only", children: T("common.loading") }),
3650
+ B.length === 0 ? /* @__PURE__ */ e(bo, {}) : null
3651
+ ] }) : u === "error" ? /* @__PURE__ */ c(L, { variant: "error", children: [
3652
+ /* @__PURE__ */ e(L.Description, { children: T("emptyState.error.description") }),
3653
+ y ? /* @__PURE__ */ e(te, { size: "sm", intent: "outline", onClick: () => y(), children: T("emptyState.error.cta") }) : null
3654
+ ] }) : null,
3655
+ B.length === 0 ? u === "ready" ? /* @__PURE__ */ e(
3656
+ vi,
3657
+ {
3658
+ variant: de ? "no-results" : "first-use",
3659
+ size: "sm",
3660
+ title: T(ze("emptyTitle")),
3661
+ description: de ? T(ze("emptyNarrowed")) : void 0
3662
+ }
3663
+ ) : null : /* @__PURE__ */ e(
3664
+ "div",
3665
+ {
3666
+ "aria-busy": u === "loading",
3667
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
3668
+ children: xe.map((R) => /* @__PURE__ */ c(
3669
+ "section",
3670
+ {
3671
+ "aria-label": _s(s ?? "en", R.date),
3672
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
3673
+ children: [
3674
+ /* @__PURE__ */ e("h3", { className: "type-label ds:m-0 ds:uppercase ds:text-start ds:text-[color:var(--muted-foreground)]", children: _s(s ?? "en", R.date) }),
3675
+ /* @__PURE__ */ e(
3676
+ "ul",
3677
+ {
3678
+ role: "list",
3679
+ className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0",
3680
+ children: R.views.map(ke)
3681
+ }
3682
+ )
3683
+ ]
3684
+ },
3685
+ R.dateKey
3686
+ ))
3687
+ }
3688
+ )
3689
+ ] })
3690
+ ]
3691
+ }
3692
+ );
3693
+ }
3694
+ function Do({
3695
+ entry: n,
3696
+ readOnly: s,
3697
+ onSave: i
3698
+ }) {
3699
+ const [u, b] = N((n == null ? void 0 : n.patientId) ?? ""), [f, g] = N((n == null ? void 0 : n.operatorId) ?? q), [o, y] = N(
3700
+ (n == null ? void 0 : n.colorHex) ?? Bs[6].hex
3701
+ ), [v, l] = N((n == null ? void 0 : n.description) ?? ""), [k, h] = N(!1), D = br((S) => {
3702
+ b((S == null ? void 0 : S.patientId) ?? ""), g((S == null ? void 0 : S.operatorId) ?? q), y((S == null ? void 0 : S.colorHex) ?? Bs[6].hex), l((S == null ? void 0 : S.description) ?? ""), h(!1);
3703
+ }, []);
3704
+ return {
3705
+ patientId: u,
3706
+ setPatientId: b,
3707
+ operatorId: f,
3708
+ setOperatorId: g,
3709
+ colorHex: o,
3710
+ setColorHex: y,
3711
+ description: v,
3712
+ setDescription: l,
3713
+ showError: k,
3714
+ setShowError: h,
3715
+ reset: D,
3716
+ submit: () => {
3717
+ if (!s) {
3718
+ if (!sd({ patientId: u, description: v })) {
3719
+ h(!0);
3720
+ return;
3721
+ }
3722
+ i({
3723
+ id: n == null ? void 0 : n.id,
3724
+ patientId: u || void 0,
3725
+ operatorId: f === q ? void 0 : f,
3726
+ colorHex: o,
3727
+ description: v.trim() || void 0
3728
+ });
3729
+ }
3730
+ }
3731
+ };
3732
+ }
3733
+ function Eo({
3734
+ form: n,
3735
+ entry: s,
3736
+ readOnly: i,
3737
+ onCreatePatient: u
3738
+ }) {
3739
+ var y;
3740
+ const b = Ye(), { t: f } = le("ui"), g = mi(n.patientId, b), o = Ta(
3741
+ g,
3742
+ s == null ? void 0 : s.description,
3743
+ f("calendarWorkspace.details.patientNotLoaded")
3744
+ );
3745
+ return /* @__PURE__ */ c(ae, { children: [
3746
+ /* @__PURE__ */ c(
3747
+ "fieldset",
3748
+ {
3749
+ disabled: i,
3750
+ className: `ds:m-0 ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-md)] ds:border-0 ds:p-0 ${ki}`,
3751
+ children: [
3752
+ i ? /* @__PURE__ */ c(
3753
+ L,
3754
+ {
3755
+ variant: "info",
3756
+ announce: "off",
3757
+ icon: /* @__PURE__ */ e(Oa, { "aria-hidden": "true" }),
3758
+ children: [
3759
+ /* @__PURE__ */ e(L.Title, { as: "p", children: f("calendarWorkspace.details.readOnlyTitle") }),
3760
+ /* @__PURE__ */ e(L.Description, { children: f("calendarWorkspace.inc1.readOnly.waitingLockedBody") })
3761
+ ]
3762
+ }
3763
+ ) : null,
3764
+ /* @__PURE__ */ e(z, { label: f("calendarWorkspace.editor.patient"), children: /* @__PURE__ */ e(
3765
+ wi,
3766
+ {
3767
+ value: n.patientId,
3768
+ selectedLabel: o,
3769
+ onCreatePatient: i ? void 0 : u,
3770
+ onValueChange: (v) => {
3771
+ n.setPatientId(v), n.setShowError(!1);
3772
+ }
3773
+ }
3774
+ ) }),
3775
+ /* @__PURE__ */ e(z, { label: f("calendarWorkspace.details.operator"), children: /* @__PURE__ */ e(
3776
+ be,
3777
+ {
3778
+ options: [
3779
+ {
3780
+ value: q,
3781
+ label: f("calendarWorkspace.editor.unassigned")
3782
+ },
3783
+ ...Vs(b).map((v) => ({
3784
+ value: v.id,
3785
+ label: v.title
3786
+ }))
3787
+ ],
3788
+ value: n.operatorId,
3789
+ onValueChange: n.setOperatorId
3790
+ }
3791
+ ) }),
3792
+ /* @__PURE__ */ e(z, { label: f("calendarWorkspace.details.color"), children: /* @__PURE__ */ e(
3793
+ pi,
3794
+ {
3795
+ variant: "inline",
3796
+ compact: !0,
3797
+ size: "sm",
3798
+ palette: ((y = b.appointmentPalette) == null ? void 0 : y.slice()) ?? Bs,
3799
+ value: n.colorHex,
3800
+ onChange: n.setColorHex
3801
+ }
3802
+ ) }),
3803
+ /* @__PURE__ */ e(z, { label: f("calendarWorkspace.editor.description"), children: /* @__PURE__ */ e(
3804
+ rd,
3805
+ {
3806
+ value: n.description,
3807
+ onChange: (v) => {
3808
+ n.setDescription(v.target.value), n.setShowError(!1);
3809
+ },
3810
+ minRows: 2,
3811
+ autoResize: !0
3812
+ }
3813
+ ) })
3814
+ ]
3815
+ }
3816
+ ),
3817
+ n.showError ? /* @__PURE__ */ e(L, { variant: "error", children: /* @__PURE__ */ e(L.Description, { children: f("calendarWorkspace.waitingList.formError") }) }) : null
3818
+ ] });
3819
+ }
3820
+ function xl({
3821
+ open: n,
3822
+ entry: s,
3823
+ onSave: i,
3824
+ onCancel: u,
3825
+ onRemove: b,
3826
+ readOnly: f = !1,
3827
+ onCreatePatient: g
3828
+ }) {
3829
+ const { t: o } = le("ui"), y = (h) => `calendarWorkspace.waitingList.${h}`, v = Do({ entry: s, readOnly: f, onSave: i }), { reset: l } = v;
3830
+ V(() => {
3831
+ n && l(s);
3832
+ }, [n, s, l]);
3833
+ const k = !!s && !f && b !== void 0;
3834
+ return /* @__PURE__ */ e(
3835
+ td,
3836
+ {
3837
+ open: n,
3838
+ onBack: u,
3839
+ icon: /* @__PURE__ */ e(Pd, { "aria-hidden": "true" }),
3840
+ title: o(y(s ? "editTitle" : "addTitle")),
3841
+ backLabel: o(y("back")),
3842
+ "data-waiting-entry-form": "",
3843
+ footerAlign: k ? "between" : "end",
3844
+ footer: /* @__PURE__ */ c(ae, { children: [
3845
+ k ? /* @__PURE__ */ e(
3846
+ ve,
3847
+ {
3848
+ size: "sm",
3849
+ intent: "destructiveOutline",
3850
+ icon: /* @__PURE__ */ e(Fs, { "aria-hidden": "true" }),
3851
+ "aria-label": o(y("remove")),
3852
+ tooltip: o(y("remove")),
3853
+ onClick: () => s && (b == null ? void 0 : b(s))
3854
+ }
3855
+ ) : null,
3856
+ /* @__PURE__ */ c("span", { className: "ds:ms-auto ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
3857
+ /* @__PURE__ */ e(te, { size: "sm", intent: "secondary", onClick: u, children: o("calendarWorkspace.editor.cancel") }),
3858
+ f ? null : /* @__PURE__ */ e(
3859
+ te,
3860
+ {
3861
+ size: "sm",
3862
+ intent: "primary",
3863
+ "data-action": "save-waiting-entry",
3864
+ onClick: v.submit,
3865
+ children: o(y(s ? "formSave" : "formAdd"))
3866
+ }
3867
+ )
3868
+ ] })
3869
+ ] }),
3870
+ children: /* @__PURE__ */ e("div", { className: "ds:-m-[var(--panel-subview-inset)] ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ e(
3871
+ Eo,
3872
+ {
3873
+ form: v,
3874
+ entry: s,
3875
+ readOnly: f,
3876
+ onCreatePatient: g
3877
+ }
3878
+ ) })
3879
+ }
3880
+ );
3881
+ }
3882
+ const Mi = "ds:flex ds:min-w-0 ds:items-center ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-md)] ds:[:where(&)]:border-[length:var(--surface-border-width,var(--border-width-sm))] ds:border-[color:var(--card-border)] ds:bg-[color:var(--card)] ds:text-[color:var(--card-foreground)] ds:shadow-[var(--shadow-sm)] ds:p-[var(--spacing-sm)]", To = [
3883
+ Mi,
3884
+ "ds:w-full ds:cursor-pointer ds:text-start ds:transition-colors",
3885
+ "ds:hover:bg-[color:var(--muted)]",
3886
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
3887
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
3888
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
3889
+ ].join(" ");
3890
+ function ci({
3891
+ label: n,
3892
+ countLabel: s,
3893
+ hint: i,
3894
+ icon: u,
3895
+ sections: b,
3896
+ selected: f,
3897
+ onChange: g
3898
+ }) {
3899
+ const { t: o } = le("ui"), y = o("calendarWorkspace.filters.selectAll"), v = b.flatMap(
3900
+ (h) => h.options.map((D) => D.id)
3901
+ ), l = b.some(
3902
+ (h) => h.name !== null || h.practiceName !== void 0
3903
+ ), k = (h) => /* @__PURE__ */ e(
3904
+ Re,
3905
+ {
3906
+ label: h.title,
3907
+ checked: f.includes(h.id),
3908
+ onCheckedChange: (D) => g(Ia(f, [h.id], D))
3909
+ },
3910
+ h.id
3911
+ );
3912
+ return /* @__PURE__ */ c(rs, { children: [
3913
+ /* @__PURE__ */ e(rs.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
3914
+ te,
3915
+ {
3916
+ intent: "primary",
3917
+ startIcon: u,
3918
+ endIcon: f.length > 0 ? /* @__PURE__ */ e(an, { size: "sm", variant: "brand", children: f.length }) : void 0,
3919
+ "aria-label": f.length > 0 ? s : n,
3920
+ children: n
3921
+ }
3922
+ ) }),
3923
+ /* @__PURE__ */ c(
3924
+ rs.Content,
3925
+ {
3926
+ align: "start",
3927
+ className: "ds:w-72 ds:max-h-[var(--radix-popover-content-available-height)] ds:overflow-y-auto",
3928
+ children: [
3929
+ /* @__PURE__ */ e(rs.Heading, { children: n }),
3930
+ /* @__PURE__ */ e(rs.Description, { children: i }),
3931
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:pt-[var(--spacing-sm)]", children: [
3932
+ /* @__PURE__ */ e(
3933
+ Re,
3934
+ {
3935
+ label: y,
3936
+ checked: si(f, v),
3937
+ onCheckedChange: (h) => g(Ia(f, v, h))
3938
+ }
3939
+ ),
3940
+ l ? b.map((h, D) => {
3941
+ var _;
3942
+ const T = h.options.map((B) => B.id), S = h.practiceName && h.practiceName !== ((_ = b[D - 1]) == null ? void 0 : _.practiceName) ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:pt-[var(--spacing-xs)] ds:font-[var(--font-weight-semibold)] ds:text-[color:var(--muted-foreground)]", children: h.practiceName }) : null;
3943
+ return h.name === null ? /* @__PURE__ */ c(Ut, { children: [
3944
+ S,
3945
+ /* @__PURE__ */ e("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: h.options.map(k) })
3946
+ ] }, h.id) : /* @__PURE__ */ c(Ut, { children: [
3947
+ S,
3948
+ /* @__PURE__ */ c(
3949
+ "div",
3950
+ {
3951
+ role: "group",
3952
+ "aria-label": h.name ?? n,
3953
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
3954
+ children: [
3955
+ /* @__PURE__ */ e(
3956
+ Re,
3957
+ {
3958
+ label: /* @__PURE__ */ c(ae, { children: [
3959
+ /* @__PURE__ */ e("span", { className: "ds:font-[var(--font-weight-semibold)]", children: h.name }),
3960
+ /* @__PURE__ */ e(Ps, { children: ` · ${y}` })
3961
+ ] }),
3962
+ checked: si(f, T),
3963
+ onCheckedChange: (B) => g(
3964
+ Ia(f, T, B)
3965
+ )
3966
+ }
3967
+ ),
3968
+ /* @__PURE__ */ e("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:ps-[var(--spacing-md)]", children: h.options.map(k) })
3969
+ ]
3970
+ }
3971
+ )
3972
+ ] }, h.id);
3973
+ }) : b.flatMap((h) => h.options).map(k)
3974
+ ] })
3975
+ ]
3976
+ }
3977
+ )
3978
+ ] });
3979
+ }
3980
+ const Lo = 300;
3981
+ function Ao(n) {
3982
+ return n.filter((s) => !s.event.isTask).map(
3983
+ (s) => [
3984
+ s.event.id,
3985
+ String(s.event.start),
3986
+ String(s.event.end ?? ""),
3987
+ s.event.allDay === !0 ? "1" : "0",
3988
+ s.chairId ?? "",
3989
+ s.operatorId ?? ""
3990
+ ].join("|")
3991
+ ).sort().join(";");
3992
+ }
3993
+ function Oo(n, s) {
3994
+ if (n.length !== s.length) return !1;
3995
+ for (let i = 0; i < n.length; i++)
3996
+ if (n[i].start.getTime() !== s[i].start.getTime() || n[i].durationMin !== s[i].durationMin || n[i].chairId !== s[i].chairId || n[i].operatorId !== s[i].operatorId)
3997
+ return !1;
3998
+ return !0;
3999
+ }
4000
+ function Cl({
4001
+ rows: n,
4002
+ locale: s,
4003
+ seed: i,
4004
+ onBookSlot: u,
4005
+ onShowInCalendar: b,
4006
+ onSearchRange: f,
4007
+ platform: g,
4008
+ canBook: o = !0,
4009
+ restore: y,
4010
+ onSnapshot: v
4011
+ }) {
4012
+ const { t: l } = le("ui"), k = Ye(), h = (p) => `calendarWorkspace.findSlots.${p}`, { open: D } = Si(), T = i ? {
4013
+ patientId: i.patientId,
4014
+ care: i.care,
4015
+ cares: i.cares,
4016
+ colorHex: i.colorHex
4017
+ } : void 0, S = (g == null ? void 0 : g.listOnly) === !0, _ = k.searchFreeSlots, [B, xe] = N((y == null ? void 0 : y.careId) ?? ""), [A, de] = N((y == null ? void 0 : y.deviceName) ?? ""), [X, ke] = N(
4018
+ y ? y.durationMin : (i == null ? void 0 : i.durationMin) ?? Zt
4019
+ ), [R, H] = N(
4020
+ (y == null ? void 0 : y.operatorId) ?? (i == null ? void 0 : i.operatorId) ?? we
4021
+ ), [d, tn] = N(
4022
+ (y == null ? void 0 : y.chairId) ?? (i == null ? void 0 : i.chairId) ?? we
4023
+ ), t = g == null ? void 0 : g.connectedPractices, E = (g == null ? void 0 : g.multiSelectScope) === !0 || !!t, [pe, Q] = N(
4024
+ () => y ? [...y.scopeOperatorIds] : i != null && i.operatorId ? [i.operatorId] : []
4025
+ ), [r, F] = N(
4026
+ () => y ? [...y.scopeChairIds] : i != null && i.chairId ? [i.chairId] : []
4027
+ ), [G, _e] = N(() => {
4028
+ if (y) return y.fromDate;
4029
+ const p = new Date(k.nowIso);
4030
+ return p.setHours(0, 0, 0, 0), p;
4031
+ }), [Ce, ue] = N(() => {
4032
+ if (y) return y.toDate;
4033
+ const p = new Date(k.nowIso);
4034
+ return p.setHours(0, 0, 0, 0), p.setDate(p.getDate() + Gr), p;
4035
+ }), [w, Dn] = N(
4036
+ (y == null ? void 0 : y.results) ?? null
4037
+ ), [Vn, Ie] = N(!1), [Gs, Hn] = N(!1), [vn, Ve] = N((y == null ? void 0 : y.capped) ?? !1), [rn, W] = N(
4038
+ (y == null ? void 0 : y.allFound) ?? null
4039
+ ), [De, Xe] = N(!0), [He, dn] = N((y == null ? void 0 : y.filtersOpen) ?? !0), Un = P(b);
4040
+ Un.current = b, V(() => () => Un.current(null), []);
4041
+ const me = ye(
4042
+ () => (t == null ? void 0 : t.others.flatMap((p) => p.operators)) ?? [],
4043
+ [t]
4044
+ ), Ks = ye(
4045
+ () => new Set(me.map((p) => p.id)),
4046
+ [me]
4047
+ ), ee = k.cares.find((p) => p.id === B), En = Da(
4048
+ ee ? [ee] : [],
4049
+ Vs(k)
4050
+ ), qs = Ea(ee ? [ee] : [], k.chairs), Gn = (p) => {
4051
+ xe(p), de("");
4052
+ const x = k.cares.find((K) => K.id === p);
4053
+ if (!x) {
4054
+ ke(Zt);
4055
+ return;
4056
+ }
4057
+ ke(x.durationMin);
4058
+ const I = Da(
4059
+ [x],
4060
+ Vs(k)
4061
+ ), J = Ea([x], k.chairs);
4062
+ H(
4063
+ (K) => K !== we && !gn(K, I) ? we : K
4064
+ ), tn(
4065
+ (K) => K !== we && !gn(K, J) ? we : K
4066
+ ), Q(
4067
+ (K) => K.filter(
4068
+ (ce) => Ks.has(ce) || gn(ce, I)
4069
+ )
4070
+ ), F(
4071
+ (K) => K.filter((ce) => gn(ce, J))
4072
+ );
4073
+ }, Ue = En.list, We = qs.list, Qe = E ? Ue.filter(
4074
+ (p) => pe.length === 0 || pe.includes(p.id)
4075
+ ) : Ue.filter(
4076
+ (p) => R === we || p.id === R
4077
+ ), fe = E ? We.filter(
4078
+ (p) => r.length === 0 || r.includes(p.id)
4079
+ ) : We.filter((p) => d === we || p.id === d), M = {
4080
+ ...T,
4081
+ ...Qe.length === 1 ? { scopeOperatorId: Qe[0].id } : {},
4082
+ ...fe.length === 1 ? { scopeChairId: fe[0].id } : {}
4083
+ }, pn = E ? pe : R === we ? [] : [R], bn = g == null ? void 0 : g.operatorGroups, Kn = (p, x, I, J) => x && x.length > 0 ? Xr({
4084
+ groups: x,
4085
+ operators: I,
4086
+ inactiveIds: [],
4087
+ withoutGroupLabel: l("calendarWorkspace.filters.withoutGroup"),
4088
+ locale: s
4089
+ }).map((K) => ({
4090
+ id: `${p}${K.id}`,
4091
+ name: K.name,
4092
+ practiceName: J,
4093
+ options: K.operators
4094
+ })) : [{ id: `${p}all`, name: null, practiceName: J, options: I }], os = t ? [
4095
+ ...Kn(
4096
+ `${t.current.id}:`,
4097
+ bn,
4098
+ Ue,
4099
+ t.current.name
4100
+ ),
4101
+ ...t.others.flatMap(
4102
+ (p) => Kn(
4103
+ `${p.id}:`,
4104
+ p.operatorGroups,
4105
+ p.operators,
4106
+ p.name
4107
+ )
4108
+ )
4109
+ ] : Kn("", bn, Ue, void 0), cs = [
4110
+ { id: "all", name: null, options: We }
4111
+ ], qn = (p, x) => {
4112
+ const I = new Date(k.nowIso);
4113
+ I.setHours(0, 0, 0, 0);
4114
+ const J = p.getTime() < I.getTime() ? I : p;
4115
+ if (x.getTime() < J.getTime()) return null;
4116
+ const K = [
4117
+ ...Qe.map((ce) => ce.id),
4118
+ ...me.filter(
4119
+ (ce) => pe.length === 0 || pe.includes(ce.id)
4120
+ ).map((ce) => ce.id)
4121
+ ];
4122
+ return K.length === 0 || fe.length === 0 ? null : {
4123
+ from: J,
4124
+ to: x,
4125
+ durationMin: X ?? (ee == null ? void 0 : ee.durationMin) ?? 30,
4126
+ operatorIds: K,
4127
+ chairIds: fe.map((ce) => ce.id),
4128
+ ...ee ? { careId: ee.id } : {},
4129
+ ...A ? { medicalDeviceIds: [A] } : {}
4130
+ };
4131
+ }, on = (p, x) => Qr(
4132
+ {
4133
+ rows: n,
4134
+ chairs: fe,
4135
+ operators: Qe,
4136
+ durationMin: X ?? (ee == null ? void 0 : ee.durationMin) ?? 30,
4137
+ fromDate: p,
4138
+ toDate: x,
4139
+ careId: ee == null ? void 0 : ee.id
4140
+ },
4141
+ k
4142
+ ), yn = (p, x) => {
4143
+ Ve(p.length > ni), Dn(p.slice(0, ni)), W(p), De && !S && b(p, x, M);
4144
+ }, Je = ye(
4145
+ () => _ ? `${Ao(n)}#${k.revision ?? ""}` : "",
4146
+ [_, n, k.revision]
4147
+ ), Tn = P((y == null ? void 0 : y.stamp) ?? null), O = P(null);
4148
+ V(() => () => {
4149
+ var p;
4150
+ return (p = O.current) == null ? void 0 : p.abort();
4151
+ }, []);
4152
+ const Ln = (p, x) => {
4153
+ var K;
4154
+ if (!_) return;
4155
+ Tn.current = Je;
4156
+ const I = qn(p, x);
4157
+ if ((K = O.current) == null || K.abort(), !I) {
4158
+ Ie(!1), Hn(!1), yn([], p);
4159
+ return;
4160
+ }
4161
+ const J = new AbortController();
4162
+ O.current = J, Ie(!0), Hn(!1), _(I, { signal: J.signal }).then(
4163
+ (ce) => {
4164
+ J.signal.aborted || (Ie(!1), yn(
4165
+ [...ce].sort((Pe, Fe) => Pe.start.getTime() - Fe.start.getTime()),
4166
+ I.from
4167
+ ));
4168
+ },
4169
+ () => {
4170
+ J.signal.aborted || (Ie(!1), Hn(!0));
4171
+ }
4172
+ );
4173
+ }, ge = P(
4174
+ (y == null ? void 0 : y.searched) ?? null
4175
+ ), jn = (p) => {
4176
+ const x = (p == null ? void 0 : p.to) ?? Ce;
4177
+ !G || !x || (ge.current = { from: G, to: x }, _ ? Ln(G, x) : (f == null || f({ from: G, to: x }), yn(on(G, x), G)), dn(!1));
4178
+ }, Oe = P(on);
4179
+ Oe.current = on;
4180
+ const An = P(yn);
4181
+ An.current = yn;
4182
+ const se = P(rn);
4183
+ se.current = rn, V(() => {
4184
+ if (_) return;
4185
+ const p = ge.current, x = se.current;
4186
+ if (!p || x === null) return;
4187
+ const I = Oe.current(p.from, p.to);
4188
+ Oo(x, I) || An.current(I, p.from);
4189
+ }, [n, k, _]);
4190
+ const On = P(Ln);
4191
+ On.current = Ln, V(() => {
4192
+ if (!_ || Tn.current === null || Tn.current === Je) return;
4193
+ const p = ge.current;
4194
+ if (!p) return;
4195
+ const x = setTimeout(
4196
+ () => On.current(p.from, p.to),
4197
+ Lo
4198
+ );
4199
+ return () => clearTimeout(x);
4200
+ }, [_, Je]);
4201
+ const oe = () => jn(), kn = g == null ? void 0 : g.pagerStepDays, Pn = () => {
4202
+ if (!kn) return;
4203
+ const p = Ce ?? G ?? /* @__PURE__ */ new Date(), x = new Date(p);
4204
+ x.setDate(x.getDate() + kn), ue(x), jn({ to: x });
4205
+ }, ls = P(y !== void 0);
4206
+ V(() => {
4207
+ i && !ls.current && (ls.current = !0, oe());
4208
+ }, []);
4209
+ const Ge = P(v);
4210
+ Ge.current = v, V(() => {
4211
+ var p;
4212
+ (p = Ge.current) == null || p.call(Ge, {
4213
+ careId: B,
4214
+ deviceName: A,
4215
+ durationMin: X,
4216
+ operatorId: R,
4217
+ chairId: d,
4218
+ scopeOperatorIds: pe,
4219
+ scopeChairIds: r,
4220
+ fromDate: G,
4221
+ toDate: Ce,
4222
+ results: w,
4223
+ allFound: rn,
4224
+ capped: vn,
4225
+ filtersOpen: He,
4226
+ searched: ge.current,
4227
+ stamp: Tn.current
4228
+ });
4229
+ }, [
4230
+ B,
4231
+ A,
4232
+ X,
4233
+ R,
4234
+ d,
4235
+ pe,
4236
+ r,
4237
+ G,
4238
+ Ce,
4239
+ w,
4240
+ rn,
4241
+ vn,
4242
+ He
4243
+ ]);
4244
+ const js = (p) => {
4245
+ Xe(p), b(p ? rn : null, G, M);
4246
+ }, Ze = () => {
4247
+ const p = G && Ce ? k.openDatesBetween(G, Ce) : [];
4248
+ return p.length === 0 ? l(h("noResultsClosed")) : pn.length > 0 && pn.every(
4249
+ (x) => p.every((I) => (k.operatorAbsences[x] ?? []).includes(I))
4250
+ ) ? l(h("noResultsOperatorAbsent"), {
4251
+ name: pn.map((x) => {
4252
+ var I;
4253
+ return ((I = k.operators.find((J) => J.id === x)) == null ? void 0 : I.title) ?? "";
4254
+ }).filter(Boolean).join(", ")
4255
+ }) : l(h("noResultsDescription"));
4256
+ }, Ke = (p) => {
4257
+ if (!o) return;
4258
+ const x = t ? { practice: p.practice ?? t.current } : void 0, I = {
4259
+ date: p.start,
4260
+ time: { hours: p.start.getHours(), minutes: p.start.getMinutes() },
4261
+ durationMin: p.durationMin,
4262
+ operatorId: p.operatorId,
4263
+ chairId: p.chairId,
4264
+ /* The seed context (the waiting entry's colour/description) carries
4265
+ through, and the WAITING PATIENT lands pre-selected in the
4266
+ editor. A chosen care's colour is drawn, never handed off. */
4267
+ colorHex: i == null ? void 0 : i.colorHex,
4268
+ /* A chosen catalogue care rides as a linked care, not as the
4269
+ free-text description. */
4270
+ care: ee || i == null ? void 0 : i.care,
4271
+ cares: ee ? [{ careId: ee.id, name: ee.name, code: ee.code }] : i == null ? void 0 : i.cares,
4272
+ patientId: i == null ? void 0 : i.patientId
4273
+ };
4274
+ x ? u(I, x) : u(I), D("appointment-editor");
4275
+ }, Mn = g != null && g.devicesByCare && ee ? g.devicesByCare[ee.id] ?? [] : [], $e = g == null ? void 0 : g.maxRangeDays, Yn = !!($e && G && Ce && Kr(G, Ce) > $e), cn = (g == null ? void 0 : g.practiceHasBusinessHours) === !1, Bn = (g == null ? void 0 : g.operatorsHaveBusinessHours) === !1, Ys = ye(() => {
4276
+ if (!w) return [];
4277
+ const p = /* @__PURE__ */ new Map();
4278
+ for (const x of w) {
4279
+ const I = `${x.start.getFullYear()}-${x.start.getMonth()}-${x.start.getDate()}`, J = p.get(I);
4280
+ J ? J.push(x) : p.set(I, [x]);
4281
+ }
4282
+ return [...p.entries()];
4283
+ }, [w]);
4284
+ return /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col", children: [
4285
+ /* @__PURE__ */ e(
4286
+ Ms,
4287
+ {
4288
+ title: l(h("tool")),
4289
+ icon: /* @__PURE__ */ e(Td, { "aria-hidden": "true" }),
4290
+ sticky: !0,
4291
+ divider: !0
4292
+ }
4293
+ ),
4294
+ /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
4295
+ o ? null : /* @__PURE__ */ c(
4296
+ L,
4297
+ {
4298
+ variant: "info",
4299
+ announce: "off",
4300
+ icon: /* @__PURE__ */ e(Oa, { "aria-hidden": "true" }),
4301
+ children: [
4302
+ /* @__PURE__ */ e(L.Title, { as: "p", children: l("calendarWorkspace.details.readOnlyTitle") }),
4303
+ /* @__PURE__ */ e(L.Description, { children: l("calendarWorkspace.inc1.readOnly.createBlocked") })
4304
+ ]
4305
+ }
4306
+ ),
4307
+ cn || Bn ? /* @__PURE__ */ e(L, { variant: "error", children: /* @__PURE__ */ e(L.Description, { children: /* @__PURE__ */ c("span", { className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-2xs)]", children: [
4308
+ cn ? /* @__PURE__ */ e("span", { children: l(h("noPracticeBusinessHours")) }) : null,
4309
+ Bn ? /* @__PURE__ */ e("span", { children: l(h("noOperatorBusinessHours")) }) : null,
4310
+ g != null && g.onOpenScheduler ? /* @__PURE__ */ e(
4311
+ te,
4312
+ {
4313
+ size: "sm",
4314
+ intent: "link",
4315
+ onClick: g.onOpenScheduler,
4316
+ children: l(h("openScheduler"))
4317
+ }
4318
+ ) : null
4319
+ ] }) }) }) : null,
4320
+ /* @__PURE__ */ c(cd, { open: He, onOpenChange: dn, children: [
4321
+ /* @__PURE__ */ e(ld, { asChild: !0, children: /* @__PURE__ */ e(
4322
+ te,
4323
+ {
4324
+ size: "sm",
4325
+ intent: "outline",
4326
+ startIcon: /* @__PURE__ */ e(Ad, { "aria-hidden": "true" }),
4327
+ children: l(h("filters"))
4328
+ }
4329
+ ) }),
4330
+ /* @__PURE__ */ e(ud, { children: /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:pt-[var(--spacing-md)]", children: [
4331
+ /* @__PURE__ */ e(z, { label: l(h("care")), children: /* @__PURE__ */ e(
4332
+ La,
4333
+ {
4334
+ options: k.cares.map((p) => ({
4335
+ value: p.id,
4336
+ label: p.name
4337
+ })),
4338
+ value: B,
4339
+ onValueChange: Gn,
4340
+ placeholder: l(h("careSearch")),
4341
+ clearable: !0
4342
+ }
4343
+ ) }),
4344
+ /* @__PURE__ */ e(z, { label: l(h("duration")), children: /* @__PURE__ */ e(
4345
+ Pi,
4346
+ {
4347
+ value: X,
4348
+ onChange: ke
4349
+ }
4350
+ ) }),
4351
+ E ? (
4352
+ /* Platform parity: grouped checklists, not one Select. */
4353
+ /* @__PURE__ */ c(
4354
+ "div",
4355
+ {
4356
+ role: "group",
4357
+ "aria-label": l(h("scope")),
4358
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
4359
+ children: [
4360
+ /* @__PURE__ */ e(
4361
+ ci,
4362
+ {
4363
+ label: l(h("operators")),
4364
+ countLabel: l(h("operatorsScoped"), {
4365
+ selected: pe.length,
4366
+ total: Ue.length + me.length
4367
+ }),
4368
+ hint: l(h("everyoneOperators")),
4369
+ icon: /* @__PURE__ */ e(Od, { "aria-hidden": "true" }),
4370
+ sections: os,
4371
+ selected: pe,
4372
+ onChange: Q
4373
+ }
4374
+ ),
4375
+ /* @__PURE__ */ e(
4376
+ ci,
4377
+ {
4378
+ label: l(h("chairs")),
4379
+ countLabel: l(h("chairsScoped"), {
4380
+ selected: r.length,
4381
+ total: We.length
4382
+ }),
4383
+ hint: l(h("everyoneChairs")),
4384
+ icon: /* @__PURE__ */ e(wa, { "aria-hidden": "true" }),
4385
+ sections: cs,
4386
+ selected: r,
4387
+ onChange: F
4388
+ }
4389
+ )
4390
+ ]
4391
+ }
4392
+ )
4393
+ ) : /* @__PURE__ */ c(ae, { children: [
4394
+ /* @__PURE__ */ e(z, { label: l(h("operator")), children: /* @__PURE__ */ e(
4395
+ be,
4396
+ {
4397
+ options: [
4398
+ { value: we, label: l(h("any")) },
4399
+ ...Ue.map((p) => ({
4400
+ value: p.id,
4401
+ label: p.title
4402
+ }))
4403
+ ],
4404
+ value: R,
4405
+ onValueChange: H
4406
+ }
4407
+ ) }),
4408
+ /* @__PURE__ */ e(z, { label: l(h("chair")), children: /* @__PURE__ */ e(
4409
+ be,
4410
+ {
4411
+ options: [
4412
+ { value: we, label: l(h("any")) },
4413
+ ...We.map((p) => ({
4414
+ value: p.id,
4415
+ label: p.title
4416
+ }))
4417
+ ],
4418
+ value: d,
4419
+ onValueChange: tn
4420
+ }
4421
+ ) })
4422
+ ] }),
4423
+ Mn.length > 0 ? /* @__PURE__ */ e(z, { label: l(h("device")), children: /* @__PURE__ */ e(
4424
+ be,
4425
+ {
4426
+ options: [
4427
+ { value: we, label: l(h("any")) },
4428
+ ...Mn.map((p) => ({
4429
+ value: p,
4430
+ label: p
4431
+ }))
4432
+ ],
4433
+ value: A || we,
4434
+ onValueChange: (p) => de(p === we ? "" : p)
4435
+ }
4436
+ ) }) : null,
4437
+ /* @__PURE__ */ e(z, { label: l(h("from")), children: /* @__PURE__ */ e($s, { value: G, onChange: _e }) }),
4438
+ /* @__PURE__ */ e(z, { label: l(h("to")), children: /* @__PURE__ */ e($s, { value: Ce, onChange: ue }) }),
4439
+ Yn ? /* @__PURE__ */ e(L, { variant: "warning", children: /* @__PURE__ */ e(L.Description, { children: l(h("rangeTooLong"), { days: $e }) }) }) : null,
4440
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
4441
+ te,
4442
+ {
4443
+ intent: "primary",
4444
+ onClick: oe,
4445
+ disabled: Vn,
4446
+ children: l(h("search"))
4447
+ }
4448
+ ) })
4449
+ ] }) })
4450
+ ] }),
4451
+ Vn ? /* @__PURE__ */ e(
4452
+ "span",
4453
+ {
4454
+ role: "status",
4455
+ "data-testid": "find-slots-searching",
4456
+ className: "type-body-sm ds:text-start ds:text-[color:var(--muted-foreground)]",
4457
+ children: l(h("searching"))
4458
+ }
4459
+ ) : null,
4460
+ Gs ? /* @__PURE__ */ c(L, { variant: "error", children: [
4461
+ /* @__PURE__ */ e(L.Description, { children: l(h("searchFailed")) }),
4462
+ /* @__PURE__ */ e(L.Action, { children: /* @__PURE__ */ e(te, { size: "sm", intent: "tonal", onClick: oe, children: l("emptyState.error.cta") }) })
4463
+ ] }) : null,
4464
+ w === null ? null : w.length === 0 ? /* @__PURE__ */ e(
4465
+ vi,
4466
+ {
4467
+ variant: "no-results",
4468
+ size: "sm",
4469
+ title: l(h("noResultsTitle")),
4470
+ description: Ze()
4471
+ }
4472
+ ) : /* @__PURE__ */ c("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
4473
+ S ? null : /* @__PURE__ */ e(
4474
+ od,
4475
+ {
4476
+ label: l(h("showInCalendar")),
4477
+ checked: De,
4478
+ onCheckedChange: js
4479
+ }
4480
+ ),
4481
+ vn ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-start ds:text-[color:var(--muted-foreground)]", children: l(h("capNote")) }) : null,
4482
+ Ys.map(([p, x]) => /* @__PURE__ */ c(
4483
+ "div",
4484
+ {
4485
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
4486
+ children: [
4487
+ /* @__PURE__ */ e("span", { className: "type-body-sm ds:font-[var(--font-weight-semibold)] ds:text-start", children: Rn(s, x[0].start) }),
4488
+ /* @__PURE__ */ e(
4489
+ "ul",
4490
+ {
4491
+ role: "list",
4492
+ className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0",
4493
+ children: x.map((I) => {
4494
+ var je, $n, Jn, Se, Zn;
4495
+ const J = t !== void 0 && I.practice !== void 0 && I.practice.id !== t.current.id, K = t ? ((je = I.practice) == null ? void 0 : je.name) ?? t.current.name : void 0, ce = ($n = k.operators.find(
4496
+ (he) => he.id === I.operatorId
4497
+ )) == null ? void 0 : $n.title, Pe = (Jn = k.chairs.find(
4498
+ (he) => he.id === I.chairId
4499
+ )) == null ? void 0 : Jn.title, Fe = J ? I.operatorName ?? ((Se = me.find((he) => he.id === I.operatorId)) == null ? void 0 : Se.title) : ce ?? I.operatorName, qe = J ? I.chairName : Pe ?? I.chairName, Xn = [
4500
+ qe,
4501
+ Fe,
4502
+ A || void 0
4503
+ ].filter(Boolean).join(" · "), fn = Ir(
4504
+ s,
4505
+ I.start,
4506
+ new Date(I.start.getTime() + I.durationMin * 6e4)
4507
+ ), Qn = /* @__PURE__ */ c("span", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:items-center ds:gap-[var(--spacing-sm)]", children: [
4508
+ /* @__PURE__ */ c("span", { className: "ds:flex ds:shrink-0 ds:flex-col ds:[min-inline-size:4.5rem]", children: [
4509
+ /* @__PURE__ */ e("span", { className: "type-body-sm ds:font-medium ds:tabular-nums ds:text-start ds:text-[color:var(--foreground)]", children: new Intl.DateTimeFormat(s, {
4510
+ hour: "numeric",
4511
+ minute: "2-digit"
4512
+ }).format(I.start) }),
4513
+ /* @__PURE__ */ e("span", { className: "type-eyebrow ds:text-start ds:text-[color:var(--muted-foreground)]", children: l("appointmentCard.duration", {
4514
+ count: I.durationMin
4515
+ }) })
4516
+ ] }),
4517
+ Fe ? /* @__PURE__ */ e(gi, { name: Fe, size: "sm" }) : null,
4518
+ /* @__PURE__ */ c("span", { className: "ds:flex ds:min-w-0 ds:flex-col", children: [
4519
+ /* @__PURE__ */ e("span", { className: "type-body-sm ds:sr-only", children: fn }),
4520
+ /* @__PURE__ */ e("span", { className: "type-body-sm ds:truncate ds:font-[var(--font-weight-semibold)] ds:text-start", children: Fe ?? Xn }),
4521
+ Fe ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:truncate ds:text-start ds:text-[color:var(--muted-foreground)]", children: [qe, A || void 0].filter(Boolean).join(" · ") }) : null,
4522
+ K ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:truncate ds:text-start ds:text-[color:var(--muted-foreground)]", children: K }) : null
4523
+ ] })
4524
+ ] }), Wn = S && o;
4525
+ return /* @__PURE__ */ e(
4526
+ "li",
4527
+ {
4528
+ className: Wn ? void 0 : Mi,
4529
+ children: Wn ? /* @__PURE__ */ c(
4530
+ "button",
4531
+ {
4532
+ type: "button",
4533
+ className: To,
4534
+ onClick: () => Ke(I),
4535
+ children: [
4536
+ Qn,
4537
+ /* @__PURE__ */ e("span", { className: "type-body-sm ds:ms-auto ds:shrink-0 ds:text-[color:var(--muted-foreground)]", children: l(h("book")) })
4538
+ ]
4539
+ }
4540
+ ) : /* @__PURE__ */ c(ae, { children: [
4541
+ Qn,
4542
+ o ? /* @__PURE__ */ e("span", { className: "ds:ms-auto", children: /* @__PURE__ */ e(
4543
+ te,
4544
+ {
4545
+ size: "sm",
4546
+ intent: "primary",
4547
+ onClick: () => Ke(I),
4548
+ children: l(h("book"))
4549
+ }
4550
+ ) }) : null
4551
+ ] })
4552
+ },
4553
+ `${((Zn = I.practice) == null ? void 0 : Zn.id) ?? ""}-${I.start.getTime()}-${I.chairId}-${I.operatorId}`
4554
+ );
4555
+ })
4556
+ }
4557
+ )
4558
+ ]
4559
+ },
4560
+ p
4561
+ )),
4562
+ kn ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(te, { size: "sm", intent: "outline", onClick: Pn, children: l(h("showMore")) }) }) : null
4563
+ ] })
4564
+ ] })
4565
+ ] });
4566
+ }
4567
+ export {
4568
+ yl as A,
4569
+ Nl as B,
4570
+ Xd as C,
4571
+ Cl as F,
4572
+ bl as P,
4573
+ vl as S,
4574
+ xl as W,
4575
+ wi as a,
4576
+ Vs as b,
4577
+ Vd as c,
4578
+ Kd as d,
4579
+ fl as e,
4580
+ kl as f,
4581
+ so as i,
4582
+ Si as u,
4583
+ pl as w
4584
+ };
4585
+ //# sourceMappingURL=calendar.sheets-aodjllWd.js.map