@alfadocs/ui-kit-debug 1.129.0 → 1.130.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 (150) hide show
  1. package/dist/_chunks/calendar-appointment-editor-dialog-CXch4Pmu.js +13663 -0
  2. package/dist/_chunks/calendar-appointment-editor-dialog-CXch4Pmu.js.map +1 -0
  3. package/dist/_chunks/contact-round-DiSvB3LP.js +18 -0
  4. package/dist/_chunks/contact-round-DiSvB3LP.js.map +1 -0
  5. package/dist/_chunks/{entity-summary-Dzk54yom.js → entity-summary-KHM0PnSI.js} +55 -67
  6. package/dist/_chunks/entity-summary-KHM0PnSI.js.map +1 -0
  7. package/dist/_chunks/{header-settings-DsvheAOt.js → header-settings-ZGvYAuKF.js} +101 -97
  8. package/dist/_chunks/header-settings-ZGvYAuKF.js.map +1 -0
  9. package/dist/_chunks/{marketplace-app-shell-BOBWmzoT.js → marketplace-app-shell-D_HA8CKx.js} +2 -2
  10. package/dist/_chunks/{marketplace-app-shell-BOBWmzoT.js.map → marketplace-app-shell-D_HA8CKx.js.map} +1 -1
  11. package/dist/_chunks/{patient-search-D_S7joff.js → patient-search-OAwFgOW3.js} +2 -2
  12. package/dist/_chunks/{patient-search-D_S7joff.js.map → patient-search-OAwFgOW3.js.map} +1 -1
  13. package/dist/_chunks/{toast-BNoN8Qjh.js → toast-DQ1Zu1kk.js} +264 -251
  14. package/dist/_chunks/{toast-BNoN8Qjh.js.map → toast-DQ1Zu1kk.js.map} +1 -1
  15. package/dist/_chunks/use-appointment-details-read-BrykoTOR.js +2475 -0
  16. package/dist/_chunks/use-appointment-details-read-BrykoTOR.js.map +1 -0
  17. package/dist/agent-catalog.json +1 -1
  18. package/dist/browser-support.js +1 -1
  19. package/dist/components/appointment-details-panel/appointment-details-panel.d.ts +7 -0
  20. package/dist/components/appointment-details-panel/appointment-details-panel.d.ts.map +1 -1
  21. package/dist/components/appointment-details-panel/appointment-details-panel.links.d.ts +2 -0
  22. package/dist/components/appointment-details-panel/appointment-details-panel.links.d.ts.map +1 -1
  23. package/dist/components/appointment-details-panel/appointment-details-panel.sections.d.ts +5 -1
  24. package/dist/components/appointment-details-panel/appointment-details-panel.sections.d.ts.map +1 -1
  25. package/dist/components/appointment-details-panel/index.js +1 -1
  26. package/dist/components/entity-summary/index.js +1 -1
  27. package/dist/components/header-settings/header-settings.d.ts.map +1 -1
  28. package/dist/components/header-settings/index.js +1 -1
  29. package/dist/components/patient-search/index.js +1 -1
  30. package/dist/components/toast/index.js +1 -1
  31. package/dist/components/toast/toast.d.ts.map +1 -1
  32. package/dist/core.css +1 -1
  33. package/dist/i18n/locales/ar.d.ts +12 -4
  34. package/dist/i18n/locales/ar.d.ts.map +1 -1
  35. package/dist/i18n/locales/ar.js +15 -7
  36. package/dist/i18n/locales/ar.js.map +1 -1
  37. package/dist/i18n/locales/de.d.ts +12 -4
  38. package/dist/i18n/locales/de.d.ts.map +1 -1
  39. package/dist/i18n/locales/de.js +15 -7
  40. package/dist/i18n/locales/de.js.map +1 -1
  41. package/dist/i18n/locales/el.d.ts +12 -4
  42. package/dist/i18n/locales/el.d.ts.map +1 -1
  43. package/dist/i18n/locales/el.js +15 -7
  44. package/dist/i18n/locales/el.js.map +1 -1
  45. package/dist/i18n/locales/en.d.ts +12 -4
  46. package/dist/i18n/locales/en.d.ts.map +1 -1
  47. package/dist/i18n/locales/en.js +12 -4
  48. package/dist/i18n/locales/en.js.map +1 -1
  49. package/dist/i18n/locales/es.d.ts +12 -4
  50. package/dist/i18n/locales/es.d.ts.map +1 -1
  51. package/dist/i18n/locales/es.js +15 -7
  52. package/dist/i18n/locales/es.js.map +1 -1
  53. package/dist/i18n/locales/fr.d.ts +12 -4
  54. package/dist/i18n/locales/fr.d.ts.map +1 -1
  55. package/dist/i18n/locales/fr.js +15 -7
  56. package/dist/i18n/locales/fr.js.map +1 -1
  57. package/dist/i18n/locales/hi.d.ts +12 -4
  58. package/dist/i18n/locales/hi.d.ts.map +1 -1
  59. package/dist/i18n/locales/hi.js +15 -7
  60. package/dist/i18n/locales/hi.js.map +1 -1
  61. package/dist/i18n/locales/it.d.ts +12 -4
  62. package/dist/i18n/locales/it.d.ts.map +1 -1
  63. package/dist/i18n/locales/it.js +15 -7
  64. package/dist/i18n/locales/it.js.map +1 -1
  65. package/dist/i18n/locales/ja.d.ts +12 -4
  66. package/dist/i18n/locales/ja.d.ts.map +1 -1
  67. package/dist/i18n/locales/ja.js +15 -7
  68. package/dist/i18n/locales/ja.js.map +1 -1
  69. package/dist/i18n/locales/nl.d.ts +12 -4
  70. package/dist/i18n/locales/nl.d.ts.map +1 -1
  71. package/dist/i18n/locales/nl.js +15 -7
  72. package/dist/i18n/locales/nl.js.map +1 -1
  73. package/dist/i18n/locales/pl.d.ts +12 -4
  74. package/dist/i18n/locales/pl.d.ts.map +1 -1
  75. package/dist/i18n/locales/pl.js +15 -7
  76. package/dist/i18n/locales/pl.js.map +1 -1
  77. package/dist/i18n/locales/pt.d.ts +12 -4
  78. package/dist/i18n/locales/pt.d.ts.map +1 -1
  79. package/dist/i18n/locales/pt.js +15 -7
  80. package/dist/i18n/locales/pt.js.map +1 -1
  81. package/dist/i18n/locales/ro.d.ts +12 -4
  82. package/dist/i18n/locales/ro.d.ts.map +1 -1
  83. package/dist/i18n/locales/ro.js +15 -7
  84. package/dist/i18n/locales/ro.js.map +1 -1
  85. package/dist/i18n/locales/ru.d.ts +12 -4
  86. package/dist/i18n/locales/ru.d.ts.map +1 -1
  87. package/dist/i18n/locales/ru.js +15 -7
  88. package/dist/i18n/locales/ru.js.map +1 -1
  89. package/dist/i18n/locales/sq.d.ts +12 -4
  90. package/dist/i18n/locales/sq.d.ts.map +1 -1
  91. package/dist/i18n/locales/sq.js +15 -7
  92. package/dist/i18n/locales/sq.js.map +1 -1
  93. package/dist/i18n/locales/sv.d.ts +12 -4
  94. package/dist/i18n/locales/sv.d.ts.map +1 -1
  95. package/dist/i18n/locales/sv.js +15 -7
  96. package/dist/i18n/locales/sv.js.map +1 -1
  97. package/dist/i18n/locales/tr.d.ts +12 -4
  98. package/dist/i18n/locales/tr.d.ts.map +1 -1
  99. package/dist/i18n/locales/tr.js +15 -7
  100. package/dist/i18n/locales/tr.js.map +1 -1
  101. package/dist/i18n/locales/zh.d.ts +12 -4
  102. package/dist/i18n/locales/zh.d.ts.map +1 -1
  103. package/dist/i18n/locales/zh.js +15 -7
  104. package/dist/i18n/locales/zh.js.map +1 -1
  105. package/dist/index.js +6 -6
  106. package/dist/locales/ar.json +15 -7
  107. package/dist/locales/de.json +15 -7
  108. package/dist/locales/el.json +15 -7
  109. package/dist/locales/en.json +12 -4
  110. package/dist/locales/es.json +15 -7
  111. package/dist/locales/fr.json +15 -7
  112. package/dist/locales/hi.json +15 -7
  113. package/dist/locales/it.json +15 -7
  114. package/dist/locales/ja.json +15 -7
  115. package/dist/locales/nl.json +15 -7
  116. package/dist/locales/pl.json +15 -7
  117. package/dist/locales/pt.json +15 -7
  118. package/dist/locales/ro.json +15 -7
  119. package/dist/locales/ru.json +15 -7
  120. package/dist/locales/sq.json +15 -7
  121. package/dist/locales/sv.json +15 -7
  122. package/dist/locales/tr.json +15 -7
  123. package/dist/locales/zh.json +15 -7
  124. package/dist/patterns/calendar/calendar-appointment-details.d.ts +10 -1
  125. package/dist/patterns/calendar/calendar-appointment-details.d.ts.map +1 -1
  126. package/dist/patterns/calendar/calendar-appointment-editor-dialog.d.ts.map +1 -1
  127. package/dist/patterns/calendar/calendar-load-error.d.ts.map +1 -1
  128. package/dist/patterns/calendar/calendar-settings-practice.d.ts.map +1 -1
  129. package/dist/patterns/calendar/calendar-waiting-list-panel.d.ts.map +1 -1
  130. package/dist/patterns/calendar/calendar-workspace.d.ts +27 -0
  131. package/dist/patterns/calendar/calendar-workspace.d.ts.map +1 -1
  132. package/dist/patterns/calendar/calendar-workspace.model.d.ts +5 -6
  133. package/dist/patterns/calendar/calendar-workspace.model.d.ts.map +1 -1
  134. package/dist/patterns/calendar/calendar.model.d.ts +57 -8
  135. package/dist/patterns/calendar/calendar.model.d.ts.map +1 -1
  136. package/dist/patterns/calendar/calendar.sheets.d.ts +46 -3
  137. package/dist/patterns/calendar/calendar.sheets.d.ts.map +1 -1
  138. package/dist/patterns/calendar/calendar.surface.d.ts.map +1 -1
  139. package/dist/patterns/calendar/calendar.types.d.ts +13 -5
  140. package/dist/patterns/calendar/calendar.types.d.ts.map +1 -1
  141. package/dist/patterns/calendar/index.js +1 -1
  142. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  143. package/dist/tokens.css +1 -1
  144. package/package.json +1 -1
  145. package/dist/_chunks/calendar-appointment-editor-dialog-DnPADcj9.js +0 -13438
  146. package/dist/_chunks/calendar-appointment-editor-dialog-DnPADcj9.js.map +0 -1
  147. package/dist/_chunks/entity-summary-Dzk54yom.js.map +0 -1
  148. package/dist/_chunks/header-settings-DsvheAOt.js.map +0 -1
  149. package/dist/_chunks/use-appointment-details-read-n7kycxrm.js +0 -2439
  150. package/dist/_chunks/use-appointment-details-read-n7kycxrm.js.map +0 -1
@@ -1,2439 +0,0 @@
1
- import { jsx as e, jsxs as g, Fragment as ne } from "react/jsx-runtime";
2
- import { c as ht } from "./index-D2ZczOXr.js";
3
- import { useId as st, useRef as _, forwardRef as rn, useEffect as ke, useMemo as Rt, useState as $, useCallback as on } from "react";
4
- import { useTranslation as W } from "react-i18next";
5
- import { u as dn } from "./registry-DvAUVLHh.js";
6
- import { u as oe } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
7
- import { c as ln } from "./compose-refs-C0k0tdqF.js";
8
- import { h as tt, g as rt } from "./handled-rejection-6gqCf5vt.js";
9
- import { a as cn, b as Pt } from "./privacy-mask-DJ1gee4c.js";
10
- import { A as B } from "./alert-C4WKViaS.js";
11
- import { B as M } from "./button-DohK_Ak_.js";
12
- import { I as qt } from "./icon-button-S8_weU3g.js";
13
- import { B as un } from "./button-group-B2MJo0Se.js";
14
- import { D as We } from "./dropdown-menu-Dw6sgQwJ.js";
15
- import { E as jt } from "./editable-description-KU56SP4P.js";
16
- import { N as ot } from "./note-timeline-BQeW0VZY.js";
17
- import { P as Kt } from "./panel-header-CbtlTe85.js";
18
- import { P as nt } from "./panel-subview-DCyvn-49.js";
19
- import { P as Yt } from "./patient-summary-card-BUcZ-gaL.js";
20
- import { S as de } from "./section-card-CYfeQ6EQ.js";
21
- import { C as mn, S as ye } from "./skeleton-tTWJpvAq.js";
22
- import { T as pn } from "./text-area-COMVJ1yE.js";
23
- import { T as fn } from "./tooltip-uEBdD1-5.js";
24
- import { T as Gt } from "./treatment-receipt-BZzwvsnY.js";
25
- import { a as at } from "./whatsapp-button-XbozeDl_.js";
26
- import { a as Vt, W as hn } from "./workflow-status-D0avpoeS.js";
27
- import { u as gt, a as Mt, i as gn } from "./appointment-workflow-status-DMjuIK90.js";
28
- import { E as vn } from "./empty-state-DwJ5YNzz.js";
29
- import { T as Pe } from "./timeline-DXko0M1t.js";
30
- import { C as vt } from "./calendar-clock-hbObjfGY.js";
31
- import { T as Xt } from "./trash-2-uumy3fy1.js";
32
- import { A as it } from "./entity-card-fpm-KUKc.js";
33
- import { C as yn } from "./calendar-plus-BFrIRE4r.js";
34
- import { P as be } from "./pencil-B1sKKyuT.js";
35
- import { C as dt } from "./clock-Drd4Wtis.js";
36
- import { c as Ye } from "./createLucideIcon-DhHxpK9K.js";
37
- import { A as bn } from "./arrow-right-KsIrLdt0.js";
38
- import { A as lt } from "./avatar-Dp5apm1d.js";
39
- import { B as Ge } from "./badge-BUk4RjTS.js";
40
- import { H as yt } from "./heart-pulse-BCppJyN2.js";
41
- import { G as kn } from "./globe-sHBW1JN5.js";
42
- import { T as wn } from "./triangle-alert-CBnO6nq_.js";
43
- import { E as Nn } from "./euro-Dsuz4ixO.js";
44
- import { V as bt } from "./video-BheNGvsu.js";
45
- import { R as Qt } from "./repeat-CvQa5rZt.js";
46
- import { C as xn } from "./counter-WsvRuum1.js";
47
- import { D as Ue } from "./description-list-BxzDN9o2.js";
48
- import { T as Lt } from "./timestamp-DPLDWdxA.js";
49
- import { T as Sn } from "./transaction-chip-CkYd-3ky.js";
50
- import { H as we } from "./hover-card-CuRIA4wN.js";
51
- import { S as An } from "./smartphone-C0rFF2if.js";
52
- import { P as In } from "./phone-FceYcIFQ.js";
53
- import { M as Tn } from "./mail-BqXVF2zH.js";
54
- import { M as En } from "./map-pin-BaY37-Km.js";
55
- import { F as Dn } from "./file-pen-line-k4uMBM3h.js";
56
- import { P as Cn } from "./pen-line-D0De5zdl.js";
57
- import { C as Rn } from "./credit-card-D9XZsHGA.js";
58
- import { R as Pn } from "./refresh-cw-DnI0cLFC.js";
59
- import { C as Mn } from "./calendar-days-BGWklvE-.js";
60
- import { H as Ln } from "./hourglass-BEAzW1wE.js";
61
- import { A as Ot } from "./armchair-BaLDW6Hz.js";
62
- import { B as On } from "./building-2-D33bLCWL.js";
63
- import { N as _n } from "./notebook-pen-CO7HoM-W.js";
64
- import { C as ct } from "./clipboard-list-rSzfIYZB.js";
65
- import { U as Fn } from "./user-plus-BtcOLgNU.js";
66
- import { C as zn } from "./copy-vRpqqHtY.js";
67
- import { P as Hn } from "./plus-DzMQ_c6b.js";
68
- import { S as $n } from "./square-check-big-dj0o8yA3.js";
69
- import { H as _t } from "./history-CK2JaU2g.js";
70
- import { C as Bn } from "./chevron-down-DWE7GSq9.js";
71
- import { C as Wn } from "./camera-VSklPDCv.js";
72
- import { F as Un } from "./file-BuG1VMAy.js";
73
- import { F as qn } from "./file-text-5yv6r2ls.js";
74
- import { F as jn } from "./folder-BghC8_S2.js";
75
- import { R as Kn } from "./receipt-euro-B1cLM_TN.js";
76
- /**
77
- * @license lucide-react v1.22.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */
82
- const Yn = [
83
- ["path", { d: "M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8", key: "1w3rig" }],
84
- ["path", { d: "M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1", key: "n2jgmb" }],
85
- ["path", { d: "M2 21h20", key: "1nyx9w" }],
86
- ["path", { d: "M7 8v3", key: "1qtyvj" }],
87
- ["path", { d: "M12 8v3", key: "hwp4zt" }],
88
- ["path", { d: "M17 8v3", key: "1i6e5u" }],
89
- ["path", { d: "M7 4h.01", key: "1bh4kh" }],
90
- ["path", { d: "M12 4h.01", key: "1ujb9j" }],
91
- ["path", { d: "M17 4h.01", key: "1upcoc" }]
92
- ], Gn = Ye("cake", Yn);
93
- /**
94
- * @license lucide-react v1.22.0 - ISC
95
- *
96
- * This source code is licensed under the ISC license.
97
- * See the LICENSE file in the root directory of this source tree.
98
- */
99
- const Vn = [
100
- ["path", { d: "M11 14h10", key: "1w8e9d" }],
101
- ["path", { d: "M16 4h2a2 2 0 0 1 2 2v1.344", key: "1e62lh" }],
102
- ["path", { d: "m17 18 4-4-4-4", key: "z2g111" }],
103
- ["path", { d: "M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113", key: "bjbb7m" }],
104
- ["rect", { x: "8", y: "2", width: "8", height: "4", rx: "1", key: "ublpy" }]
105
- ], Ft = Ye("clipboard-paste", Vn);
106
- /**
107
- * @license lucide-react v1.22.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */
112
- const Xn = [
113
- ["path", { d: "M16 10h2", key: "8sgtl7" }],
114
- ["path", { d: "M16 14h2", key: "epxaof" }],
115
- ["path", { d: "M6.17 15a3 3 0 0 1 5.66 0", key: "n6f512" }],
116
- ["circle", { cx: "9", cy: "11", r: "2", key: "yxgjnd" }],
117
- ["rect", { x: "2", y: "5", width: "20", height: "14", rx: "2", key: "qneu4z" }]
118
- ], Qn = Ye("id-card", Xn);
119
- /**
120
- * @license lucide-react v1.22.0 - ISC
121
- *
122
- * This source code is licensed under the ISC license.
123
- * See the LICENSE file in the root directory of this source tree.
124
- */
125
- const Jn = [
126
- ["path", { d: "M12 2v20", key: "t6zp3m" }],
127
- ["path", { d: "m15 19-3 3-3-3", key: "11eu04" }],
128
- ["path", { d: "m19 9 3 3-3 3", key: "1mg7y2" }],
129
- ["path", { d: "M2 12h20", key: "9i4pu4" }],
130
- ["path", { d: "m5 9-3 3 3 3", key: "j64kie" }],
131
- ["path", { d: "m9 5 3-3 3 3", key: "l8vdw6" }]
132
- ], ut = Ye("move", Jn), Zn = '[data-component="button-group"] [data-component="icon-button"][aria-haspopup="menu"]', ea = {
133
- id: "appointment-details-panel",
134
- // open and close back open_history and close_history; set_value backs
135
- // set_status.
136
- capabilities: ["open", "close", "set_value"],
137
- state: {
138
- eventId: {
139
- type: "string | null",
140
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.eventId",
141
- description: "The occurrence on screen or being read, as the host identifies it. After a failed or refused read, the occurrence it was for when the host says so. Null when there is none, or the host did not say.",
142
- read: (t) => t.getEventId()
143
- },
144
- loadStatus: {
145
- type: "'loading' | 'ready' | 'error' | 'refused'",
146
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.loadStatus",
147
- description: "Where the read is: loading, ready, failed (with Retry) or refused. Actions need ready.",
148
- read: (t) => t.getLoadStatus()
149
- },
150
- appointmentStatus: {
151
- type: "'confirmed' | 'waiting' | 'in_care' | 'done' | 'cancelled' | 'absent' | null",
152
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.appointmentStatus",
153
- description: "The appointment status as last saved here or read. Null when none is recorded or nothing is on screen.",
154
- read: (t) => t.getAppointmentStatus()
155
- },
156
- allowedStatuses: {
157
- type: "string[]",
158
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.allowedStatuses",
159
- description: "The statuses set_status accepts now, in menu order. Empty when the status is read-only.",
160
- read: (t) => t.getAllowedStatuses()
161
- },
162
- offeredActions: {
163
- type: "string[]",
164
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.offeredActions",
165
- description: "The footer actions on offer, as their data-action values (for example edit-appointment, delete-appointment), in footer order, including any folded into More.",
166
- read: (t) => t.getOfferedActions()
167
- },
168
- historyOpen: {
169
- type: "boolean",
170
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.historyOpen",
171
- description: "Whether the History sub-view covers the details.",
172
- read: (t) => t.isHistoryOpen()
173
- },
174
- privacy: {
175
- type: "boolean",
176
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.privacy",
177
- description: "Whether privacy mode is on. The patient identity and personal fields are then masked on screen.",
178
- read: (t) => t.isPrivacy()
179
- }
180
- },
181
- actions: {
182
- open_history: {
183
- safety: "read",
184
- openWorld: !0,
185
- idempotent: !0,
186
- errors: ["No appointment is on screen, or History is not offered."],
187
- descriptionKey: "ui.agent.appointmentDetailsPanel.actions.openHistory",
188
- description: "Slide the appointment's history over the details, as its header button does; the host reads it then if it did not send it with the details. It lists who changed what, and when.",
189
- invoke: (t) => t.openHistory()
190
- },
191
- close_history: {
192
- safety: "read",
193
- idempotent: !0,
194
- descriptionKey: "ui.agent.appointmentDetailsPanel.actions.closeHistory",
195
- description: "Return from History to the details.",
196
- invoke: (t) => t.closeHistory()
197
- },
198
- set_status: {
199
- safety: "phi",
200
- openWorld: !0,
201
- idempotent: !0,
202
- argsType: "{ status: string }",
203
- argsSchema: {
204
- type: "object",
205
- properties: {
206
- status: {
207
- type: "string",
208
- enum: [
209
- "confirmed",
210
- "waiting",
211
- "in_care",
212
- "done",
213
- "cancelled",
214
- "absent"
215
- ]
216
- }
217
- },
218
- required: ["status"]
219
- },
220
- errors: [
221
- "The status is read-only: no appointment on screen, no host save, readOnly, or no allowed statuses.",
222
- "The status is not in allowedStatuses.",
223
- "A status save is already in flight.",
224
- "The host refused the change. The previous status stays and the panel shows the message."
225
- ],
226
- examples: [{ args: { status: "waiting" } }],
227
- descriptionKey: "ui.agent.appointmentDetailsPanel.actions.setStatus",
228
- description: "Save a new appointment status through the host, as the footer control does. Resolves once the host has saved it.",
229
- invoke: (t, n) => t.setAppointmentStatus(
230
- n.status
231
- )
232
- },
233
- retry: {
234
- safety: "read",
235
- openWorld: !0,
236
- errors: [
237
- "Retry is not offered: the read has not failed or been refused as retryable, or the host offers no Retry."
238
- ],
239
- descriptionKey: "ui.agent.appointmentDetailsPanel.actions.retry",
240
- description: "Ask the host to read the appointment again, after a failed read or a refusal it marked retryable.",
241
- invoke: (t) => t.retry()
242
- }
243
- },
244
- domHooks: {
245
- root: {
246
- attr: "data-component",
247
- value: "appointment-details-panel",
248
- description: `Marks the panel. It also carries data-event-id and data-status. Inside, cards carry data-card (patient, appointment, notes, treatments), footer actions data-action, and the History and description sub-views data-details-subview. An action in offeredActions with no data-action in the footer strip is folded into More: click the panel's ${Zn}, and its menu item carries the same data-action.`
249
- },
250
- instanceId: {
251
- attr: "data-component-id",
252
- sourceProp: "id",
253
- description: "Sourced from the id prop, or generated."
254
- }
255
- }
256
- };
257
- function mt(t) {
258
- const n = document.activeElement;
259
- n && n !== document.body || t == null || t.focus({ preventScroll: !0 });
260
- }
261
- function Le(t) {
262
- const n = document.getElementById(t);
263
- n && !n.hasAttribute("tabindex") && (n.tabIndex = -1), mt(n);
264
- }
265
- const Me = {
266
- advancedSignature: "setup-advanced-signature",
267
- requestSignature: "request-signature",
268
- renewAnamnesis: "renew-anamnesis",
269
- unlockPayments: "unlock-payments",
270
- carePlan: "open-care-plan"
271
- };
272
- function qe(t) {
273
- if (t)
274
- try {
275
- const { protocol: n } = new URL(t, "https://host.invalid");
276
- return n === "http:" || n === "https:" ? t : void 0;
277
- } catch {
278
- return;
279
- }
280
- }
281
- function Oe(t) {
282
- return typeof t == "string" && /^\d{4}-\d{2}-\d{2}$/.test(t) ? /* @__PURE__ */ new Date(`${t}T00:00:00`) : new Date(t);
283
- }
284
- function Ke(t, n) {
285
- try {
286
- return new Intl.DateTimeFormat(t, {
287
- weekday: "long",
288
- day: "numeric",
289
- month: "long",
290
- year: "numeric"
291
- }).format(Oe(n));
292
- } catch {
293
- return "";
294
- }
295
- }
296
- function ta(t, n, a) {
297
- const o = new Date(n), i = a ? new Date(a) : o;
298
- try {
299
- const l = new Intl.DateTimeFormat(t, {
300
- hour: "2-digit",
301
- minute: "2-digit",
302
- hour12: !1
303
- });
304
- return typeof l.formatRange == "function" ? l.formatRange(o, i) : `${l.format(o)} – ${l.format(i)}`;
305
- } catch {
306
- return "";
307
- }
308
- }
309
- const pt = {
310
- weekday: "short",
311
- day: "numeric",
312
- month: "short",
313
- hour: "2-digit",
314
- minute: "2-digit"
315
- };
316
- function na(t, n) {
317
- const a = Oe(t), o = Oe(n);
318
- let i = o.getFullYear() - a.getFullYear();
319
- const l = o.getMonth() - a.getMonth();
320
- return (l < 0 || l === 0 && o.getDate() < a.getDate()) && (i -= 1), Math.max(0, i);
321
- }
322
- const aa = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/;
323
- function ia(t) {
324
- const n = typeof t == "string" ? aa.exec(t) : null;
325
- if (!n) return;
326
- const [a, o, i, l, h, r] = n.slice(1).map(Number), d = /* @__PURE__ */ new Date(0);
327
- if (d.setFullYear(a, o, 0), o < 1 || o > 12 || i < 1 || i > d.getDate() || l > 23 || h > 59 || r > 59)
328
- return;
329
- const c = /* @__PURE__ */ new Date(0);
330
- return c.setFullYear(a, o - 1, i), c.setHours(l, h, r, 0), c;
331
- }
332
- function sa(t) {
333
- return t.map((n) => {
334
- const a = Date.parse(n.atIso);
335
- return { entry: n, time: Number.isFinite(a) ? a : -1 / 0 };
336
- }).sort((n, a) => n.time === a.time ? 0 : a.time - n.time).map(({ entry: n }) => n);
337
- }
338
- const ra = {
339
- daily: "recurrenceDaily",
340
- weekly: "recurrenceWeekly",
341
- monthly: "recurrenceMonthly",
342
- quarterly: "recurrenceQuarterly",
343
- semiannual: "recurrenceSemiannual",
344
- yearly: "recurrenceYearly"
345
- };
346
- function oa(t) {
347
- return t.phones ? t.phones : t.phone ? [{ label: "mobile", number: t.phone }] : [];
348
- }
349
- function Jt(t) {
350
- return [t.address, t.postalCode, t.city].filter((n) => !!n).join(", ");
351
- }
352
- function da(t) {
353
- return [t.address, t.city].filter((n) => !!n).join(", ");
354
- }
355
- function la(t) {
356
- const n = Jt(t);
357
- return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(n)}`;
358
- }
359
- const P = (t) => `calendarWorkspace.details.${t}`, ca = /* @__PURE__ */ new Set(["patient", "care"]), zt = /^#?(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i, ua = (t) => {
360
- switch (t.field) {
361
- case "time":
362
- return !!(t.fromIso || t.toIso);
363
- case "duration":
364
- return t.fromMin !== void 0 || t.toMin !== void 0;
365
- default:
366
- return !!(t.from || t.to);
367
- }
368
- };
369
- function ma(t) {
370
- const n = t.kind === "moved" ? [{ field: "time", fromIso: t.fromIso, toIso: t.toIso }] : t.kind === "resized" ? [{ field: "duration", fromMin: t.fromMin, toMin: t.toMin }] : t.kind === "status" ? [{ field: "status", from: t.from, to: t.to }] : [], a = ("changes" in t ? t.changes ?? [] : []).filter(
371
- ua
372
- ), o = new Set(n.map((i) => i.field));
373
- return [
374
- ...n,
375
- ...a.filter((i) => o.has(i.field) ? !1 : (o.add(i.field), !0))
376
- ];
377
- }
378
- const pa = (t, n) => t.getFullYear() === n.getFullYear() && t.getMonth() === n.getMonth() && t.getDate() === n.getDate();
379
- function fa({
380
- history: t,
381
- locale: n,
382
- noteUnrecordedEdits: a = !1,
383
- privacy: o = !1
384
- }) {
385
- const { t: i, i18n: l } = W("ui"), { optionFor: h } = gt(null), r = n ?? l.language, d = (s, f) => {
386
- try {
387
- return new Intl.DateTimeFormat(r, f).format(
388
- new Date(s)
389
- );
390
- } catch {
391
- return s;
392
- }
393
- }, c = (s) => d(s, pt), p = i(P("history.notSet")), A = (s) => {
394
- switch (s.field) {
395
- case "status":
396
- return {
397
- from: s.from && h(s.from).label,
398
- to: s.to && h(s.to).label
399
- };
400
- case "time": {
401
- const f = s.fromIso && new Date(s.fromIso), b = s.toIso && new Date(s.toIso), y = f && b && pa(f, b) ? d(s.toIso, {
402
- hour: "2-digit",
403
- minute: "2-digit"
404
- }) : void 0;
405
- return {
406
- from: s.fromIso && c(s.fromIso),
407
- to: y ?? (s.toIso && c(s.toIso))
408
- };
409
- }
410
- case "duration":
411
- return {
412
- from: s.fromMin === void 0 ? void 0 : i(P("history.minutes"), { n: s.fromMin }),
413
- to: s.toMin === void 0 ? void 0 : i(P("history.minutes"), { n: s.toMin })
414
- };
415
- default:
416
- return { from: s.from || void 0, to: s.to || void 0 };
417
- }
418
- }, I = (s) => {
419
- const f = i(P(`history.fields.${s.field}`)), { from: b, to: y } = A(s);
420
- return s.field === "colour" && [b, y].some((T) => T && zt.test(T)) ? i(P("history.changed.colour")) : b && !y ? i(P("history.changeCleared"), { field: f, from: b }) : !b && y ? i(P("history.changeSet"), { field: f, to: y }) : i(P("history.changeFromTo"), {
421
- field: f,
422
- from: b ?? p,
423
- to: y ?? p
424
- });
425
- }, u = (s) => {
426
- const f = (x, S) => x && s.field === "colour" && zt.test(x) ? /* @__PURE__ */ e(
427
- "span",
428
- {
429
- className: "ds:inline-block ds:size-4 ds:shrink-0 ds:rounded-[var(--radius-full)] ds:border ds:border-[color:var(--border)] ds:[background-color:var(--history-swatch)] ds:forced-colors:[forced-color-adjust:none]",
430
- style: {
431
- "--history-swatch": x.startsWith("#") ? x : `#${x}`
432
- }
433
- }
434
- ) : x ? /* @__PURE__ */ e(
435
- "span",
436
- {
437
- className: S ? "ds:min-w-0 ds:font-[var(--font-weight-medium)] ds:text-[color:var(--foreground)]" : "ds:min-w-0 ds:text-[color:var(--muted-foreground)]",
438
- children: x
439
- }
440
- ) : /* @__PURE__ */ e("span", { className: "ds:min-w-0 ds:text-[color:var(--muted-foreground)]", children: p }), b = (x) => x ? /* @__PURE__ */ e(
441
- Vt,
442
- {
443
- value: x,
444
- option: h(x),
445
- size: "sm"
446
- }
447
- ) : f(void 0, !1), { from: y, to: T } = A(s);
448
- return /* @__PURE__ */ g("div", { className: "ds:min-w-0", "data-history-change": s.field, children: [
449
- /* @__PURE__ */ e("span", { className: "ds:sr-only", children: I(s) }),
450
- /* @__PURE__ */ g(
451
- "div",
452
- {
453
- "aria-hidden": "true",
454
- className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
455
- children: [
456
- s.field === "status" ? b(s.from) : f(y, !1),
457
- /* @__PURE__ */ e(
458
- bn,
459
- {
460
- className: "ds:size-4 ds:shrink-0 ds:text-[color:var(--muted-foreground)] ds:rtl:rotate-180",
461
- "aria-hidden": "true"
462
- }
463
- ),
464
- s.field === "status" ? b(s.to) : f(T, !0)
465
- ]
466
- }
467
- )
468
- ] });
469
- }, k = (s) => {
470
- switch (s.kind) {
471
- case "created":
472
- return {
473
- title: i(P("history.created")),
474
- type: "success",
475
- icon: /* @__PURE__ */ e(yn, { size: 16, "aria-hidden": "true" })
476
- };
477
- case "confirmedByPatient": {
478
- const v = it.confirmed.Icon;
479
- return {
480
- title: i(P("history.confirmedByPatient")),
481
- type: "success",
482
- icon: /* @__PURE__ */ e(v, { size: 16, "aria-hidden": "true" })
483
- };
484
- }
485
- case "deleted":
486
- return {
487
- title: i(P("history.deleted")),
488
- type: "error",
489
- icon: /* @__PURE__ */ e(Xt, { size: 16, "aria-hidden": "true" })
490
- };
491
- }
492
- const f = ma(s), b = o ? f.filter((v) => !ca.has(v.field)) : f, y = new Set(b.map((v) => v.field)), T = [
493
- ...s.kind === "edited" ? s.fields : [],
494
- ...f.filter((v) => !y.has(v.field)).map((v) => v.field)
495
- ].filter(
496
- (v, L, F) => v !== "status" && !y.has(v) && F.indexOf(v) === L
497
- ), x = T.length > 0 ? i(P("history.editedDetail"), {
498
- fields: T.map((v) => i(P(`history.fields.${v}`))).join(", ")
499
- }) : void 0, [S] = b;
500
- if (b.length === 1 && S && !x)
501
- switch (S.field) {
502
- case "status": {
503
- const { to: v } = S, L = v ? it[v].Icon : be;
504
- return {
505
- title: i(P("history.status")),
506
- type: v === "cancelled" || v === "absent" ? "warning" : "neutral",
507
- icon: /* @__PURE__ */ e(L, { size: 16, "aria-hidden": "true" }),
508
- detail: u(S)
509
- };
510
- }
511
- case "time":
512
- return {
513
- title: i(P("history.moved")),
514
- type: "info",
515
- icon: /* @__PURE__ */ e(ut, { size: 16, "aria-hidden": "true" }),
516
- detail: u(S)
517
- };
518
- case "duration":
519
- return {
520
- title: i(P("history.resized")),
521
- type: "info",
522
- icon: /* @__PURE__ */ e(dt, { size: 16, "aria-hidden": "true" }),
523
- detail: u(S)
524
- };
525
- default:
526
- return {
527
- title: i(P(`history.changed.${S.field}`)),
528
- type: "neutral",
529
- icon: /* @__PURE__ */ e(be, { size: 16, "aria-hidden": "true" }),
530
- detail: u(S)
531
- };
532
- }
533
- if (b.length > 0) {
534
- const v = s.kind === "moved" ? {
535
- title: "history.moved",
536
- icon: /* @__PURE__ */ e(ut, { size: 16, "aria-hidden": "true" })
537
- } : s.kind === "resized" ? {
538
- title: "history.resized",
539
- icon: /* @__PURE__ */ e(dt, { size: 16, "aria-hidden": "true" })
540
- } : s.kind === "status" ? {
541
- title: "history.status",
542
- icon: (() => {
543
- const L = it[s.to].Icon;
544
- return /* @__PURE__ */ e(L, { size: 16, "aria-hidden": "true" });
545
- })()
546
- } : {
547
- title: "history.edited",
548
- icon: /* @__PURE__ */ e(be, { size: 16, "aria-hidden": "true" })
549
- };
550
- return {
551
- title: i(P(v.title)),
552
- type: s.kind === "moved" || s.kind === "resized" ? "info" : s.kind === "status" && (s.to === "cancelled" || s.to === "absent") ? "warning" : "neutral",
553
- icon: v.icon,
554
- detail: /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
555
- /* @__PURE__ */ e(
556
- "dl",
557
- {
558
- "aria-label": i(P("history.changesLabel")),
559
- className: "ds:m-0 ds:grid ds:grid-cols-[auto_minmax(0,1fr)] ds:items-baseline ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-xs)]",
560
- children: b.map((L) => /* @__PURE__ */ g("div", { className: "ds:contents", children: [
561
- /* @__PURE__ */ e("dt", { className: "type-label ds:text-[color:var(--muted-foreground)]", children: i(P(`history.fields.${L.field}`)) }),
562
- /* @__PURE__ */ e("dd", { className: "ds:m-0 ds:min-w-0", children: u(L) })
563
- ] }, L.field))
564
- }
565
- ),
566
- x ? /* @__PURE__ */ e("p", { className: "ds:m-0", children: x }) : null
567
- ] })
568
- };
569
- }
570
- return {
571
- title: i(P("history.edited")),
572
- type: "neutral",
573
- icon: /* @__PURE__ */ e(be, { size: 16, "aria-hidden": "true" }),
574
- detail: x || (a ? /* @__PURE__ */ e("span", { className: "ds:text-[color:var(--muted-foreground)]", children: i(P("history.notRecorded")) }) : void 0)
575
- };
576
- };
577
- return t.length === 0 ? /* @__PURE__ */ e(
578
- vn,
579
- {
580
- variant: "first-use",
581
- size: "sm",
582
- title: i(P("historyEmpty"))
583
- }
584
- ) : /* @__PURE__ */ e(Pe, { order: "newest-first", "aria-label": i(P("historyTitle")), children: sa(t).map((s) => {
585
- const f = k(s);
586
- return /* @__PURE__ */ g(
587
- Pe.Event,
588
- {
589
- eventId: s.id,
590
- type: f.type,
591
- className: "ds:[column-gap:var(--spacing-sm)] ds:[padding-block-end:var(--spacing-lg)] ds:before:bg-[var(--primary)]",
592
- children: [
593
- /* @__PURE__ */ e(Pe.Dot, { icon: f.icon }),
594
- /* @__PURE__ */ e(
595
- Pe.Content,
596
- {
597
- title: f.title,
598
- description: f.detail,
599
- className: "ds:[padding-block-end:0] ds:[&>[data-component=card]]:border-[color:var(--card-border)] ds:[&>[data-component=card]]:shadow-[var(--shadow-card)]",
600
- actor: s.actor.trim() ? { name: s.actor } : void 0,
601
- children: /* @__PURE__ */ g("span", { className: "ds:mt-[var(--spacing-sm)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
602
- /* @__PURE__ */ e(
603
- vt,
604
- {
605
- "aria-hidden": "true",
606
- className: "ds:size-4 ds:shrink-0 ds:text-[color:var(--muted-foreground)]"
607
- }
608
- ),
609
- /* @__PURE__ */ e(
610
- Pe.Timestamp,
611
- {
612
- date: s.atIso,
613
- relative: !1,
614
- locale: r
615
- }
616
- )
617
- ] })
618
- }
619
- )
620
- ]
621
- },
622
- s.id
623
- );
624
- }) });
625
- }
626
- const ha = {
627
- confirmed: "success",
628
- waiting: "info",
629
- in_care: "accentSoft",
630
- done: "success",
631
- cancelled: "error",
632
- absent: "warning"
633
- };
634
- function ga({ event: t }) {
635
- const { t: n } = W("ui"), a = (i) => `calendarWorkspace.details.indicators.${i}`, o = [];
636
- return t.isBookedOnline && o.push({
637
- id: "online",
638
- icon: /* @__PURE__ */ e(kn, { "aria-hidden": "true" }),
639
- label: n(a("bookedOnline")),
640
- variant: "info"
641
- }), t.hasUnassignedPatient && o.push({
642
- id: "unassigned",
643
- icon: /* @__PURE__ */ e(wn, { "aria-hidden": "true" }),
644
- label: n(a("unassignedPatient")),
645
- variant: "warning"
646
- }), t.hasHighlightedAnamnesis && o.push({
647
- id: "anamnesis",
648
- icon: /* @__PURE__ */ e(yt, { "aria-hidden": "true" }),
649
- label: n(a("anamnesis")),
650
- variant: "accentSoft"
651
- }), t.hasBillableAmount && o.push({
652
- id: "billable",
653
- icon: /* @__PURE__ */ e(Nn, { "aria-hidden": "true" }),
654
- label: n(a("billable")),
655
- variant: "warning"
656
- }), t.isTelehealth && o.push({
657
- id: "telehealth",
658
- icon: /* @__PURE__ */ e(bt, { "aria-hidden": "true" }),
659
- label: n(a("telehealth")),
660
- variant: "info"
661
- }), t.isRecurring && o.push({
662
- id: "recurring",
663
- icon: /* @__PURE__ */ e(Qt, { "aria-hidden": "true" }),
664
- label: n(a("recurring")),
665
- variant: "info"
666
- }), o.length === 0 ? null : /* @__PURE__ */ e("span", { className: "ds:flex ds:flex-wrap ds:gap-[var(--spacing-2xs)]", children: o.map((i) => /* @__PURE__ */ e(
667
- Ge,
668
- {
669
- variant: i.variant,
670
- size: "sm",
671
- leading: i.icon,
672
- children: i.label
673
- },
674
- i.id
675
- )) });
676
- }
677
- function va({
678
- name: t,
679
- avatarSrc: n,
680
- unresolved: a = !1,
681
- status: o,
682
- flags: i,
683
- age: l,
684
- onOpenPatient: h,
685
- highlightedAnamnesisCount: r = 0,
686
- expiredAnamnesisCount: d = 0,
687
- anamnesisAnswers: c = [],
688
- locale: p
689
- }) {
690
- const { t: A, i18n: I } = W("ui"), u = (y) => `calendarWorkspace.details.${y}`, { optionFor: k } = gt(o), s = o ? k(o) : void 0, f = r, b = d;
691
- return /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)] ds:pb-0", children: [
692
- /* @__PURE__ */ g("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
693
- /* @__PURE__ */ e(lt, { name: t, src: n }),
694
- /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:[min-inline-size:0]", children: [
695
- /* @__PURE__ */ g("span", { className: "ds:flex ds:flex-wrap ds:items-baseline ds:gap-[var(--spacing-2xs)] ds:text-start", children: [
696
- h ? /* @__PURE__ */ e(M, { size: "sm", intent: "link", onClick: () => h(), children: t }) : /* @__PURE__ */ e("span", { className: "ds:font-[var(--font-weight-semibold)] ds:truncate", children: t }),
697
- l !== void 0 ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-[color:var(--muted-foreground)]", children: A(u("patientAge"), { n: l }) }) : null
698
- ] }),
699
- a ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-start ds:text-[color:var(--muted-foreground)]", children: A(u("patientNotLoaded")) }) : null,
700
- o && s ? /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
701
- Ge,
702
- {
703
- variant: ha[o],
704
- size: "sm",
705
- leading: s.icon,
706
- children: s.label
707
- }
708
- ) }) : null,
709
- /* @__PURE__ */ e(ga, { event: i })
710
- ] })
711
- ] }),
712
- f + b > 0 ? /* @__PURE__ */ g(
713
- B,
714
- {
715
- variant: "warning",
716
- announce: "off",
717
- icon: /* @__PURE__ */ e(yt, { "aria-hidden": "true" }),
718
- children: [
719
- /* @__PURE__ */ e(B.Title, { as: "p", children: A(u("anamnesisTitle")) }),
720
- /* @__PURE__ */ e(B.Description, { children: [
721
- f > 0 ? A(u("anamnesisHighlighted"), { n: f }) : null,
722
- b > 0 ? A(u("anamnesisExpired"), { n: b }) : null
723
- ].filter((y) => y !== null).join(" · ") }),
724
- c.length > 0 ? (
725
- /* Question · yes or no · answer · interview date, as the
726
- platform's details dialog lists them. A list, not a
727
- Description, which renders a <p>. */
728
- /* @__PURE__ */ e("ul", { className: "type-body-sm ds:m-0 ds:mt-[var(--spacing-xs)] ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-2xs)] ds:p-0", children: c.map((y) => /* @__PURE__ */ g("li", { className: "ds:text-start", children: [
729
- /* @__PURE__ */ e("span", { className: "ds:font-[var(--font-weight-semibold)]", children: y.question }),
730
- ` · ${A(u(y.yes ? "anamnesisYes" : "anamnesisNo"))}`,
731
- y.answer ? ` · ${y.answer}` : "",
732
- ` · ${Ke(p ?? I.language, y.interviewIso)}`
733
- ] }, y.question)) })
734
- ) : null
735
- ]
736
- }
737
- ) : null
738
- ] });
739
- }
740
- const ya = {
741
- SU: 0,
742
- MO: 1,
743
- TU: 2,
744
- WE: 3,
745
- TH: 4,
746
- FR: 5,
747
- SA: 6
748
- }, ba = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"], ka = {
749
- daily: "recurrenceEveryDay",
750
- weekly: "recurrenceEveryWeek",
751
- monthly: "recurrenceEveryMonth",
752
- yearly: "recurrenceEveryYear"
753
- }, wa = {
754
- 1: "recurrenceOrdinal1",
755
- 2: "recurrenceOrdinal2",
756
- 3: "recurrenceOrdinal3",
757
- 4: "recurrenceOrdinal4"
758
- }, Na = /^(-1|[1-4])?(MO|TU|WE|TH|FR|SA|SU)$/;
759
- function Ht(t, n) {
760
- const a = new Date(2026, 0, 4 + ya[t]);
761
- return new Intl.DateTimeFormat(n, { weekday: "long" }).format(a);
762
- }
763
- function xa(t, n, a) {
764
- const o = Oe(n);
765
- if (!Number.isFinite(o.getTime())) return;
766
- const i = a ? Oe(a) : void 0, l = i && i.getFullYear() === o.getFullYear();
767
- try {
768
- return new Intl.DateTimeFormat(t, {
769
- day: "numeric",
770
- month: "long",
771
- ...l ? {} : { year: "numeric" }
772
- }).format(o);
773
- } catch {
774
- return;
775
- }
776
- }
777
- function Sa(t, n, a, o) {
778
- const i = ra[a.frequency];
779
- if (!i) return;
780
- const l = (k) => `calendarWorkspace.editor.${k}`, h = (k) => `calendarWorkspace.details.${k}`, r = ka[a.frequency], d = r && (a.interval ?? 1) > 1 ? t(l(r), { count: a.interval }) : t(l(i)), c = (a.byDay ?? []).map((k) => Na.exec(k)).filter((k) => k !== null), p = a.frequency === "weekly" ? ba.filter(
781
- (k) => c.some(([, s, f]) => !s && f === k)
782
- ) : [], A = a.frequency === "monthly" || a.frequency === "yearly" ? c.find(([, k]) => k) : void 0;
783
- let I = d;
784
- if (p.length > 0)
785
- I = t(h("seriesOnDays"), {
786
- every: d,
787
- days: new Intl.ListFormat(n, { type: "conjunction" }).format(
788
- p.map((k) => Ht(k, n))
789
- )
790
- });
791
- else if (A) {
792
- const [, k, s] = A, f = Ht(s, n);
793
- I = k === "-1" ? t(h("seriesOnLast"), { every: d, weekday: f }) : t(h("seriesOnNth"), {
794
- every: d,
795
- weekday: f,
796
- ordinal: t(l(wa[k]))
797
- });
798
- }
799
- if (a.count !== void 0)
800
- return t(h("seriesRule"), {
801
- frequency: I,
802
- count: a.count
803
- });
804
- const u = a.untilIso ? xa(n, a.untilIso, o) : void 0;
805
- return u ? t(h("seriesUntil"), { rule: I, date: u }) : I;
806
- }
807
- function ft({
808
- eyebrow: t,
809
- heading: n,
810
- facts: a
811
- }) {
812
- return /* @__PURE__ */ g(ne, { children: [
813
- /* @__PURE__ */ e(we.Eyebrow, { children: t }),
814
- /* @__PURE__ */ e(we.Heading, { children: n }),
815
- a && a.length > 0 ? /* @__PURE__ */ e(we.Body, { children: /* @__PURE__ */ e("ul", { className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-2xs)] ds:p-0 type-body-sm", children: a.map((o, i) => /* @__PURE__ */ e(
816
- "li",
817
- {
818
- className: o.muted ? "ds:text-[color:var(--muted-foreground)]" : void 0,
819
- children: o.text
820
- },
821
- i
822
- )) }) }) : null
823
- ] });
824
- }
825
- const Aa = "ds:inline-flex ds:cursor-pointer ds:rounded-[var(--radius-full)] ds:p-0 ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]";
826
- function $t({
827
- id: t,
828
- eyebrow: n,
829
- heading: a,
830
- facts: o,
831
- children: i
832
- }) {
833
- return /* @__PURE__ */ g(we, { children: [
834
- /* @__PURE__ */ e(we.Trigger, { asChild: !0, children: /* @__PURE__ */ e("button", { type: "button", "data-chip-hover": t, className: Aa, children: i }) }),
835
- /* @__PURE__ */ e(we.Content, { side: "bottom", align: "start", size: "sm", children: /* @__PURE__ */ e(ft, { eyebrow: n, heading: a, facts: o }) })
836
- ] });
837
- }
838
- const m = (t) => `calendarWorkspace.details.${t}`, Ia = {
839
- missing: "consentMissing",
840
- requested: "consentRequested",
841
- signed: "consentSigned"
842
- }, Zt = (t) => /* @__PURE__ */ e("a", { href: `tel:${t.replace(/\s/g, "")}`, dir: "ltr", children: t }), en = (t) => /* @__PURE__ */ e("a", { href: `mailto:${t}`, dir: "ltr", children: t }), tn = (t, n, a) => new Intl.NumberFormat(t, { style: "currency", currency: a }).format(n);
843
- function je({
844
- href: t,
845
- action: n,
846
- icon: a,
847
- children: o
848
- }) {
849
- const i = qe(t);
850
- return i ? /* @__PURE__ */ e(
851
- M,
852
- {
853
- asChild: !0,
854
- size: "sm",
855
- intent: "outline",
856
- "data-action": n,
857
- startIcon: a,
858
- children: /* @__PURE__ */ e("a", { href: i, children: o })
859
- }
860
- ) : null;
861
- }
862
- function Bt({ rows: t }) {
863
- const n = t.filter((a) => !!a);
864
- return n.length === 0 ? null : /* @__PURE__ */ e(Ue, { layout: "inline", density: "compact", children: n.map((a) => /* @__PURE__ */ g(
865
- Ue.Row,
866
- {
867
- "data-row": a.id,
868
- icon: a.icon,
869
- children: [
870
- /* @__PURE__ */ e(Ue.Term, { children: a.label }),
871
- /* @__PURE__ */ e(Ue.Detail, { children: a.value })
872
- ]
873
- },
874
- a.id
875
- )) });
876
- }
877
- function Ta({
878
- details: t,
879
- locale: n,
880
- currency: a,
881
- now: o,
882
- mapsLink: i = !1,
883
- shortcuts: l,
884
- onRequestSignature: h
885
- }) {
886
- const { t: r } = W("ui"), { patient: d, signing: c, money: p, booking: A } = t;
887
- if (!d) return null;
888
- const I = (c == null ? void 0 : c.consents) ?? [], u = c && (c.required > 0 || I.length > 0) ? c : void 0, k = ((u == null ? void 0 : u.toComplete) ?? 0) > 0, s = u ? [
889
- {
890
- text: k ? u.requestedVia === "sms" ? r(m("signingRequestedSms")) : u.requestedVia === "email" ? r(m("signingRequestedEmail")) : r(m("signingNotRequested")) : r(m("signingAllSigned"))
891
- },
892
- ...u.aesSetUp ? [] : [{ text: r(m("aesMissing")), muted: !0 }]
893
- ] : [], f = ((c == null ? void 0 : c.required) ?? 0) > 0 && k, b = !!(l != null && l.advancedSignatureUrl) && ((c == null ? void 0 : c.required) ?? 0) > 0 && !(c != null && c.aesSetUp), y = !!h && f, T = d.highlightedAnamnesisCount ?? 0, x = d.expiredAnamnesisCount ?? 0, S = (d.highlightedAnamnesisAnswers ?? []).map((R) => ({
894
- text: [
895
- R.question,
896
- r(m(R.yes ? "anamnesisYes" : "anamnesisNo")),
897
- R.answer,
898
- Ke(n, R.interviewIso)
899
- ].filter(Boolean).join(" · ")
900
- })), v = Jt(d), L = da(d) || v, F = I.map((R) => ({
901
- id: `consent-${R.id}`,
902
- label: R.name,
903
- value: r(m(Ia[R.state]))
904
- })), G = [
905
- ...d.dobIso ? [
906
- {
907
- id: "dob",
908
- label: r(m("dob")),
909
- icon: /* @__PURE__ */ e(Gn, {}),
910
- value: `${Ke(n, d.dobIso)} ${r(
911
- m("patientAge"),
912
- {
913
- n: na(d.dobIso, o)
914
- }
915
- )}`
916
- }
917
- ] : [],
918
- ...oa(d).map((R, Q) => {
919
- const J = R.label === "mobile" || R.label === "home" || R.label === "work";
920
- return {
921
- id: `phone-${Q}`,
922
- label: r(J ? `calendarWorkspace.print.phoneLabels.${R.label}` : m("phone")),
923
- icon: R.label === "mobile" ? /* @__PURE__ */ e(An, {}) : /* @__PURE__ */ e(In, {}),
924
- value: Zt(R.number)
925
- };
926
- }),
927
- ...d.email ? [
928
- {
929
- id: "email",
930
- label: r(m("email")),
931
- icon: /* @__PURE__ */ e(Tn, {}),
932
- value: en(d.email)
933
- }
934
- ] : [],
935
- /* P27: hidden patient details leave the address out, and with it the
936
- row: no map link and no empty "address" line. */
937
- ...i && v ? [
938
- {
939
- id: "address",
940
- label: r(m("address")),
941
- icon: /* @__PURE__ */ e(En, {}),
942
- value: /* @__PURE__ */ e(
943
- "a",
944
- {
945
- href: la(d),
946
- target: "_blank",
947
- rel: "noopener noreferrer",
948
- "aria-label": `${r(m("mapsLink"))}: ${L}`,
949
- children: L
950
- }
951
- )
952
- }
953
- ] : []
954
- ], V = (p == null ? void 0 : p.unpaidAmount) ?? 0, X = (p == null ? void 0 : p.billableAmount) ?? 0, K = (A == null ? void 0 : A.paidOnlineAmount) ?? 0, ee = (R, Q, J, le, Ne, ce) => /* @__PURE__ */ e(
955
- $t,
956
- {
957
- id: J,
958
- eyebrow: r(m("hoverBilling")),
959
- heading: r(m(le), {
960
- amount: tn(n, Q, a)
961
- }),
962
- facts: [{ text: r(m(Ne)) }],
963
- children: /* @__PURE__ */ e(
964
- Sn,
965
- {
966
- "data-chip": J,
967
- state: R,
968
- amount: Q,
969
- currency: a,
970
- locale: n,
971
- size: "md",
972
- showLabel: !0,
973
- label: ce,
974
- showIcon: !1
975
- }
976
- )
977
- }
978
- );
979
- return /* @__PURE__ */ e(
980
- Yt,
981
- {
982
- "data-card": "patient",
983
- name: d.name,
984
- avatarUrl: d.avatarSrc,
985
- locale: n,
986
- surface: "elevated",
987
- density: "compact",
988
- flags: {
989
- unsignedDocumentsCount: (u == null ? void 0 : u.toComplete) ?? 0,
990
- highlightedAnamnesisCount: T
991
- },
992
- flagHover: {
993
- ...u ? {
994
- unsignedDocuments: /* @__PURE__ */ e(
995
- ft,
996
- {
997
- eyebrow: r(m("sectionSigning")),
998
- heading: u.toComplete === 1 ? r(m("signingToSignOne")) : r(m("signingToSignMany"), {
999
- n: u.toComplete
1000
- }),
1001
- facts: s
1002
- }
1003
- )
1004
- } : {},
1005
- highlightedAnamnesis: /* @__PURE__ */ e(
1006
- ft,
1007
- {
1008
- eyebrow: r(m("anamnesisTitle")),
1009
- heading: r(m("anamnesisHighlighted"), { n: T }),
1010
- facts: S
1011
- }
1012
- )
1013
- },
1014
- extraChips: V > 0 || X > 0 || K > 0 || x > 0 || b || y ? /* @__PURE__ */ g(ne, { children: [
1015
- /* @__PURE__ */ g("span", { className: "ds:inline-flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
1016
- V > 0 ? ee(
1017
- "debt",
1018
- V,
1019
- "unpaid",
1020
- "hoverUnpaidHeading",
1021
- "hoverUnpaidFact"
1022
- ) : null,
1023
- X > 0 ? ee(
1024
- "to-invoice",
1025
- X,
1026
- "billable",
1027
- "hoverBillableHeading",
1028
- "hoverBillableFact"
1029
- ) : null,
1030
- K > 0 ? ee(
1031
- "settled",
1032
- K,
1033
- "paidOnline",
1034
- "hoverPaidOnlineHeading",
1035
- "hoverPaidOnlineFact",
1036
- /* A deposit is settled money, but "Settled" hides where
1037
- it came from: the chip says what its hover card says. */
1038
- r(m("paidOnline"))
1039
- ) : null
1040
- ] }),
1041
- y ? /* @__PURE__ */ e(
1042
- M,
1043
- {
1044
- size: "sm",
1045
- intent: "outline",
1046
- "data-action": Me.requestSignature,
1047
- startIcon: /* @__PURE__ */ e(Dn, { "aria-hidden": "true" }),
1048
- onClick: () => h(t.eventId),
1049
- children: r(m("signingRequest"))
1050
- }
1051
- ) : null,
1052
- b && (l != null && l.advancedSignatureUrl) ? /* @__PURE__ */ e(
1053
- je,
1054
- {
1055
- href: l.advancedSignatureUrl,
1056
- action: Me.advancedSignature,
1057
- icon: /* @__PURE__ */ e(Cn, { "aria-hidden": "true" }),
1058
- children: r(m("aesSetUp"))
1059
- }
1060
- ) : null,
1061
- l != null && l.unlockPaymentsUrl && (V > 0 || X > 0) ? /* @__PURE__ */ e(
1062
- je,
1063
- {
1064
- href: l.unlockPaymentsUrl,
1065
- action: Me.unlockPayments,
1066
- icon: /* @__PURE__ */ e(Rn, { "aria-hidden": "true" }),
1067
- children: r(m("unlockPayments"))
1068
- }
1069
- ) : null,
1070
- x > 0 ? /* @__PURE__ */ e(
1071
- $t,
1072
- {
1073
- id: "anamnesisExpired",
1074
- eyebrow: r(m("anamnesisTitle")),
1075
- heading: r(m("anamnesisExpired"), { n: x }),
1076
- facts: [{ text: r(m("hoverAnamnesisExpiredFact")) }],
1077
- children: /* @__PURE__ */ e(
1078
- Ge,
1079
- {
1080
- "data-chip": "anamnesisExpired",
1081
- variant: "warning",
1082
- size: "md",
1083
- leading: /* @__PURE__ */ e(yt, {}),
1084
- children: r(m("anamnesisExpired"), { n: x })
1085
- }
1086
- )
1087
- }
1088
- ) : null,
1089
- x > 0 && (l != null && l.renewAnamnesisUrl) ? /* @__PURE__ */ e(
1090
- je,
1091
- {
1092
- href: l.renewAnamnesisUrl,
1093
- action: Me.renewAnamnesis,
1094
- icon: /* @__PURE__ */ e(Pn, { "aria-hidden": "true" }),
1095
- children: r(m("anamnesisRenew"))
1096
- }
1097
- ) : null
1098
- ] }) : void 0,
1099
- visibleFieldOrder: [...G, ...F].map((R) => R.id),
1100
- sections: G.length > 0 || F.length > 0 ? [
1101
- ...G.length > 0 ? [{ id: "contact", heading: r(m("sectionPatient")), fields: G }] : [],
1102
- ...F.length > 0 ? [
1103
- {
1104
- id: "consents",
1105
- heading: r(m("sectionSigning")),
1106
- fields: F
1107
- }
1108
- ] : []
1109
- ] : void 0
1110
- }
1111
- );
1112
- }
1113
- function Ea({
1114
- details: t,
1115
- locale: n,
1116
- currency: a,
1117
- operator: o,
1118
- chair: i,
1119
- description: l,
1120
- privacy: h = !1,
1121
- history: r
1122
- }) {
1123
- const { t: d } = W("ui"), { appointment: c, booking: p, patient: A } = t, I = (v) => d(`calendarWorkspace.editor.${v}`), u = new Date(c.startIso), k = new Date(u.getTime() + c.durationMin * 6e4), s = Number.isFinite(u.getTime()), { recurrence: f } = c, b = f && Sa(d, n, f, c.startIso), y = p ? [
1124
- p.bookedAtIso && {
1125
- id: "bookedAt",
1126
- label: d(m("bookedAt")),
1127
- value: /* @__PURE__ */ e(
1128
- Lt,
1129
- {
1130
- value: p.bookedAtIso,
1131
- format: "absolute",
1132
- shape: "bare",
1133
- locale: n,
1134
- absoluteFormat: pt
1135
- }
1136
- )
1137
- },
1138
- p.typedName && {
1139
- id: "bookingName",
1140
- label: d(m("bookingName")),
1141
- value: p.typedName
1142
- },
1143
- p.phone && {
1144
- id: "bookingPhone",
1145
- label: d(m("bookingPhone")),
1146
- value: Zt(p.phone)
1147
- },
1148
- p.email && {
1149
- id: "bookingEmail",
1150
- label: d(m("bookingEmail")),
1151
- value: en(p.email)
1152
- },
1153
- p.note && {
1154
- id: "bookingNote",
1155
- label: d(m("bookingNote")),
1156
- value: p.note
1157
- },
1158
- /* With a patient the amount is a chip on the patient card. */
1159
- !A && p.paidOnlineAmount !== void 0 && {
1160
- id: "paidOnline",
1161
- label: d(m("paidOnline")),
1162
- value: tn(n, p.paidOnlineAmount, a)
1163
- }
1164
- ] : [], T = h ? y.filter((v) => v && v.id === "bookedAt") : y, x = T.some(Boolean), S = p || c.bookedOnline || r == null ? void 0 : r.filter(
1165
- (v) => v.kind === "created" && v.actor.trim() !== ""
1166
- ).sort((v, L) => Date.parse(v.atIso) - Date.parse(L.atIso))[0];
1167
- return /* @__PURE__ */ g(
1168
- de,
1169
- {
1170
- "data-card": "appointment",
1171
- title: d(m("sectionAppointment")),
1172
- headingLevel: 3,
1173
- children: [
1174
- l,
1175
- /* @__PURE__ */ e(
1176
- Bt,
1177
- {
1178
- rows: [
1179
- s && {
1180
- id: "date",
1181
- label: I("date"),
1182
- icon: /* @__PURE__ */ e(Mn, {}),
1183
- value: Ke(n, u)
1184
- },
1185
- s && {
1186
- id: "time",
1187
- label: d(m("time")),
1188
- icon: /* @__PURE__ */ e(dt, {}),
1189
- value: c.allDay ? I("allDay") : ta(n, u, k)
1190
- },
1191
- !c.allDay && {
1192
- id: "duration",
1193
- label: I("duration"),
1194
- icon: /* @__PURE__ */ e(Ln, {}),
1195
- value: `${c.durationMin} ${I("durationUnit")}`
1196
- },
1197
- c.isTelehealth && {
1198
- id: "type",
1199
- label: I("type"),
1200
- icon: /* @__PURE__ */ e(bt, {}),
1201
- value: I("typeTelehealth")
1202
- },
1203
- o && {
1204
- id: "operator",
1205
- label: d(m("operator")),
1206
- /* A person, as on the grid: the avatar fills the icon slot. */
1207
- icon: /* @__PURE__ */ e(lt, { name: o.name, src: o.avatarSrc, size: "xs" }),
1208
- value: o.name
1209
- },
1210
- i && {
1211
- id: "chair",
1212
- label: d(m("chair")),
1213
- icon: /* @__PURE__ */ e(Ot, {}),
1214
- value: /* @__PURE__ */ e(Ge, { variant: "neutral", size: "sm", leading: /* @__PURE__ */ e(Ot, {}), children: i.name })
1215
- },
1216
- c.branchLabel && {
1217
- id: "branch",
1218
- label: I("branch"),
1219
- icon: /* @__PURE__ */ e(On, {}),
1220
- value: c.branchLabel
1221
- },
1222
- S && {
1223
- id: "createdBy",
1224
- label: d(m("createdBy")),
1225
- icon: /* @__PURE__ */ e(lt, { name: S.actor, size: "xs" }),
1226
- value: /* @__PURE__ */ g("span", { className: "ds:inline-flex ds:flex-wrap ds:items-baseline ds:gap-x-[var(--spacing-xs)]", children: [
1227
- /* @__PURE__ */ e("span", { children: S.actor }),
1228
- " ",
1229
- /* @__PURE__ */ e("span", { className: "ds:text-[color:var(--muted-foreground)]", children: /* @__PURE__ */ e(
1230
- Lt,
1231
- {
1232
- value: S.atIso,
1233
- format: "absolute",
1234
- shape: "bare",
1235
- locale: n,
1236
- absoluteFormat: pt
1237
- }
1238
- ) })
1239
- ] })
1240
- },
1241
- b && {
1242
- id: "series",
1243
- label: d(m("seriesLabel")),
1244
- icon: /* @__PURE__ */ e(Qt, {}),
1245
- value: b
1246
- }
1247
- ]
1248
- }
1249
- ),
1250
- x ? /* @__PURE__ */ g(
1251
- "div",
1252
- {
1253
- "data-block": "booking",
1254
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1255
- children: [
1256
- /* @__PURE__ */ e("h4", { className: "ds:m-0 type-label ds:text-[color:var(--muted-foreground)]", children: d(m("sectionBooking")) }),
1257
- /* @__PURE__ */ e(Bt, { rows: T })
1258
- ]
1259
- }
1260
- ) : null
1261
- ]
1262
- }
1263
- );
1264
- }
1265
- function Da({
1266
- details: t,
1267
- locale: n,
1268
- currency: a,
1269
- privacy: o = !1,
1270
- carePlanUrl: i
1271
- }) {
1272
- const { t: l } = W("ui"), { care: h } = t, r = o || h == null ? void 0 : h.plan;
1273
- return !h || !r && h.lines.length === 0 ? null : /* @__PURE__ */ g(
1274
- de,
1275
- {
1276
- "data-card": "treatments",
1277
- title: l(m("sectionTreatments")),
1278
- headingLevel: 3,
1279
- children: [
1280
- r ? /* @__PURE__ */ g("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-xs)]", children: [
1281
- /* @__PURE__ */ g("span", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] type-title-item", children: [
1282
- /* @__PURE__ */ e(
1283
- ct,
1284
- {
1285
- "aria-hidden": "true",
1286
- className: "ds:size-4 ds:shrink-0 ds:text-[color:var(--muted-foreground)]"
1287
- }
1288
- ),
1289
- r.number ? l(m("planLine"), { number: r.number, name: r.name }) : r.name
1290
- ] }),
1291
- i ? /* @__PURE__ */ e(
1292
- je,
1293
- {
1294
- href: i,
1295
- action: Me.carePlan,
1296
- icon: /* @__PURE__ */ e(ct, { "aria-hidden": "true" }),
1297
- children: l(m("openCarePlan"))
1298
- }
1299
- ) : null
1300
- ] }) : null,
1301
- h.lines.length > 0 ? /* @__PURE__ */ e(
1302
- Gt,
1303
- {
1304
- lines: h.lines.map(({ entryId: d, careId: c, ...p }) => ({
1305
- id: d,
1306
- ...p
1307
- })),
1308
- locale: n,
1309
- currency: a
1310
- }
1311
- ) : null
1312
- ]
1313
- }
1314
- );
1315
- }
1316
- const Wt = 3;
1317
- function Ca({
1318
- preview: t,
1319
- onOpenNotes: n,
1320
- locale: a
1321
- }) {
1322
- const { t: o } = W("ui"), i = st(), l = t.status ?? "ready", h = _(!1);
1323
- oe(() => {
1324
- h.current && (l !== "loading" && (h.current = !1), Le(i));
1325
- }, [l, i]);
1326
- const r = t.total ?? (l === "ready" ? t.notes.length : null), d = Math.max(0, (r ?? 0) - Wt), c = d > 0 ? o(m("notesMore"), { n: d }) : o(m("notesPreviewOpen"));
1327
- return /* @__PURE__ */ g(
1328
- de,
1329
- {
1330
- "data-card": "notes",
1331
- headingId: i,
1332
- headingLevel: 3,
1333
- title: r === null ? o("notesPanel.title") : o(m("notesPreviewTitle"), { count: r }),
1334
- headerAction: n && (r ?? 0) > 0 ? /* @__PURE__ */ g("span", { className: "ds:relative ds:inline-flex", children: [
1335
- /* @__PURE__ */ e(
1336
- qt,
1337
- {
1338
- icon: /* @__PURE__ */ e(_n, { "aria-hidden": "true" }),
1339
- intent: "outline",
1340
- size: "sm",
1341
- "data-action": "open-patient-notes",
1342
- "aria-label": c,
1343
- tooltip: c,
1344
- onClick: () => n()
1345
- }
1346
- ),
1347
- d > 0 ? (
1348
- /* Decorative: the button's name already says the count. */
1349
- /* @__PURE__ */ e(
1350
- xn,
1351
- {
1352
- variant: "outline",
1353
- size: "sm",
1354
- background: "surface",
1355
- count: d,
1356
- "aria-hidden": "true",
1357
- className: "ds:pointer-events-none ds:absolute ds:-top-[var(--spacing-2xs)] ds:-end-[var(--spacing-2xs)]"
1358
- }
1359
- )
1360
- ) : null
1361
- ] }) : void 0,
1362
- children: [
1363
- l === "error" ? /* @__PURE__ */ g(B, { variant: "error", children: [
1364
- /* @__PURE__ */ e(B.Description, { children: o("notesPanel.loadError") }),
1365
- t.onRetry ? /* @__PURE__ */ e(B.Action, { children: /* @__PURE__ */ e(
1366
- M,
1367
- {
1368
- intent: "secondary",
1369
- size: "sm",
1370
- onClick: () => {
1371
- var p;
1372
- h.current = !0, (p = t.onRetry) == null || p.call(t);
1373
- },
1374
- children: o("notesPanel.retry")
1375
- }
1376
- ) }) : null
1377
- ] }) : null,
1378
- t.notes.length === 0 && l === "loading" ? /* @__PURE__ */ g(ne, { children: [
1379
- /* @__PURE__ */ e("span", { role: "status", className: "ds:sr-only", children: o("notesPanel.loading") }),
1380
- /* @__PURE__ */ e(ot, { notes: [], loading: !0, loadingRows: 2 })
1381
- ] }) : l !== "error" || t.notes.length > 0 ? (
1382
- /* A note click, or Enter or Space on it, goes straight to that note
1383
- in the Notes tool; the header button opens the tool at the top. */
1384
- /* @__PURE__ */ e(
1385
- ot,
1386
- {
1387
- notes: t.notes,
1388
- maxItems: Wt,
1389
- locale: a,
1390
- "aria-labelledby": i,
1391
- onNoteActivate: n,
1392
- emptyState: /* @__PURE__ */ e("p", { className: "ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]", children: o(m("notesPreviewEmpty")) })
1393
- }
1394
- )
1395
- ) : null
1396
- ]
1397
- }
1398
- );
1399
- }
1400
- const Ra = ht("ds:flex ds:h-full ds:min-h-0 ds:flex-col"), Pa = ht(
1401
- "ds:flex ds:shrink-0 ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:border-t ds:border-[color:var(--border)] ds:p-[var(--spacing-sm)]"
1402
- ), Ma = ht(
1403
- "ds:shrink-0 ds:rounded-[var(--radius-md)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
1404
- ), j = "ds:sm:[min-block-size:var(--accessible-target-floor,0px)]", La = "ds:sm:[&>button]:[min-block-size:var(--accessible-target-floor,0px)]", Oa = [
1405
- "ds:sm:[&_button:has(svg.lucide-ellipsis)]:[min-block-size:var(--accessible-target-floor,0px)]",
1406
- "ds:[&_button:has(svg.lucide-ellipsis)]:[min-inline-size:var(--accessible-target-floor,auto)]"
1407
- ].join(" "), nn = ["40%", "33%", "50%", "25%"], _a = [
1408
- "bill",
1409
- "folder",
1410
- "template",
1411
- "empty",
1412
- "identification",
1413
- "webcam"
1414
- ], Fa = {
1415
- bill: /* @__PURE__ */ e(Kn, { "aria-hidden": "true" }),
1416
- folder: /* @__PURE__ */ e(jn, { "aria-hidden": "true" }),
1417
- template: /* @__PURE__ */ e(qn, { "aria-hidden": "true" }),
1418
- empty: /* @__PURE__ */ e(Un, { "aria-hidden": "true" }),
1419
- identification: /* @__PURE__ */ e(Qn, { "aria-hidden": "true" }),
1420
- webcam: /* @__PURE__ */ e(Wn, { "aria-hidden": "true" })
1421
- }, D = (t) => `calendarWorkspace.details.${t}`;
1422
- function Ut({
1423
- children: t,
1424
- startIcon: n,
1425
- overflowItems: a,
1426
- "data-action": o,
1427
- intent: i,
1428
- background: l,
1429
- size: h,
1430
- hideLabel: r
1431
- }) {
1432
- return /* @__PURE__ */ g(We.Root, { children: [
1433
- /* @__PURE__ */ e(fn, { label: t, side: "top", children: /* @__PURE__ */ e(We.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1434
- M,
1435
- {
1436
- intent: i,
1437
- background: l,
1438
- size: h,
1439
- "data-action": o,
1440
- className: j,
1441
- startIcon: n,
1442
- "aria-haspopup": "menu",
1443
- endIcon: /* @__PURE__ */ e(Bn, { "aria-hidden": "true" }),
1444
- children: r ? /* @__PURE__ */ e("span", { className: "ds:sr-only", children: t }) : t
1445
- }
1446
- ) }) }),
1447
- /* @__PURE__ */ e(We.Content, { align: "end", children: a.map((d) => /* @__PURE__ */ e(
1448
- We.Item,
1449
- {
1450
- "data-action": d.action,
1451
- startIcon: d.icon,
1452
- onSelect: d.onSelect,
1453
- children: d.label
1454
- },
1455
- d.label
1456
- )) })
1457
- ] });
1458
- }
1459
- function za() {
1460
- const { t } = W("ui");
1461
- return /* @__PURE__ */ g(ne, { children: [
1462
- /* @__PURE__ */ e("span", { role: "status", className: "ds:sr-only", children: t("common.loading") }),
1463
- /* @__PURE__ */ g(
1464
- "div",
1465
- {
1466
- "aria-hidden": "true",
1467
- className: "ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-sm)] ds:overflow-hidden ds:p-[var(--spacing-md)] ds:[&>*]:shrink-0",
1468
- children: [
1469
- /* @__PURE__ */ e(
1470
- Yt,
1471
- {
1472
- name: "",
1473
- loading: !0,
1474
- surface: "elevated",
1475
- density: "compact"
1476
- }
1477
- ),
1478
- /* @__PURE__ */ g(de, { title: t(D("sectionAppointment")), headingLevel: 3, children: [
1479
- /* @__PURE__ */ e(jt, { loading: !0, maxLines: 2 }),
1480
- /* @__PURE__ */ e("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: nn.map((n, a) => /* @__PURE__ */ g(
1481
- "div",
1482
- {
1483
- className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]",
1484
- children: [
1485
- /* @__PURE__ */ e(
1486
- ye,
1487
- {
1488
- variant: "rounded",
1489
- stagger: a + 2,
1490
- width: "var(--spacing-md)",
1491
- height: "var(--spacing-md)",
1492
- className: "ds:shrink-0"
1493
- }
1494
- ),
1495
- /* @__PURE__ */ e(
1496
- ye,
1497
- {
1498
- variant: "text",
1499
- size: "sm",
1500
- stagger: a + 2,
1501
- width: n
1502
- }
1503
- )
1504
- ]
1505
- },
1506
- n
1507
- )) })
1508
- ] }),
1509
- /* @__PURE__ */ e(de, { title: t("notesPanel.title"), headingLevel: 3, children: /* @__PURE__ */ e(ot, { notes: [], loading: !0, loadingRows: 2 }) }),
1510
- /* @__PURE__ */ e(de, { title: t(D("sectionTreatments")), headingLevel: 3, children: /* @__PURE__ */ e(Gt, { lines: [], loading: !0 }) })
1511
- ]
1512
- }
1513
- ),
1514
- /* @__PURE__ */ g(
1515
- "div",
1516
- {
1517
- "aria-hidden": "true",
1518
- className: "ds:flex ds:shrink-0 ds:items-center ds:gap-[var(--spacing-sm)] ds:border-t ds:border-[color:var(--border)] ds:p-[var(--spacing-md)]",
1519
- children: [
1520
- /* @__PURE__ */ e(ye, { variant: "rounded", width: "33%", height: "var(--spacing-xl)" }),
1521
- /* @__PURE__ */ e(
1522
- ye,
1523
- {
1524
- variant: "rounded",
1525
- stagger: 1,
1526
- height: "var(--spacing-xl)",
1527
- className: "ds:flex-1"
1528
- }
1529
- )
1530
- ]
1531
- }
1532
- )
1533
- ] });
1534
- }
1535
- function Ha({
1536
- history: t,
1537
- locale: n,
1538
- onRetry: a,
1539
- noteUnrecordedEdits: o,
1540
- privacy: i
1541
- }) {
1542
- var u;
1543
- const { t: l } = W("ui"), h = t.status ?? (t.entries ? "ready" : "loading"), r = h === "error" ? void 0 : t.entries, d = h === "loading" || h !== "error" && !r, [c, p] = $(!1);
1544
- ke(() => p(!0), []);
1545
- let A = "";
1546
- d ? A = l("common.loading") : r && (A = r.length === 0 ? l(D("historyEmpty")) : l(D("historyLoaded"), { n: r.length }));
1547
- let I;
1548
- return h === "error" ? I = /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1549
- /* @__PURE__ */ e(B, { variant: "error", children: /* @__PURE__ */ e(B.Description, { children: ((u = t.message) == null ? void 0 : u.trim()) || l("emptyState.error.description") }) }),
1550
- a ? /* @__PURE__ */ e(
1551
- M,
1552
- {
1553
- intent: "outline",
1554
- "data-action": "retry-history",
1555
- onClick: () => a(),
1556
- children: l("emptyState.error.cta")
1557
- }
1558
- ) : null
1559
- ] }) : d || !r ? I = /* @__PURE__ */ e(
1560
- "div",
1561
- {
1562
- "aria-hidden": "true",
1563
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1564
- children: nn.slice(0, 3).map((k, s) => /* @__PURE__ */ g(
1565
- "div",
1566
- {
1567
- className: "ds:flex ds:items-start ds:gap-[var(--spacing-sm)]",
1568
- children: [
1569
- /* @__PURE__ */ e(
1570
- ye,
1571
- {
1572
- variant: "circular",
1573
- stagger: s,
1574
- width: "var(--spacing-xl)",
1575
- height: "var(--spacing-xl)",
1576
- className: "ds:shrink-0"
1577
- }
1578
- ),
1579
- /* @__PURE__ */ e(
1580
- ye,
1581
- {
1582
- variant: "rounded",
1583
- stagger: s,
1584
- width: k,
1585
- height: "var(--spacing-2xl)"
1586
- }
1587
- )
1588
- ]
1589
- },
1590
- k
1591
- ))
1592
- }
1593
- ) : I = /* @__PURE__ */ e(
1594
- fa,
1595
- {
1596
- history: r,
1597
- locale: n,
1598
- noteUnrecordedEdits: o,
1599
- privacy: i
1600
- }
1601
- ), /* @__PURE__ */ g(ne, { children: [
1602
- /* @__PURE__ */ e("span", { role: "status", className: "ds:sr-only", children: c ? A : "" }),
1603
- I
1604
- ] });
1605
- }
1606
- function $a({
1607
- read: t,
1608
- refreshing: n,
1609
- currency: a,
1610
- now: o,
1611
- locale: i,
1612
- shownTitle: l,
1613
- headingId: h,
1614
- enter: r,
1615
- live: d,
1616
- statusControl: c,
1617
- patientId: p = ((_e) => (_e = t.patient) == null ? void 0 : _e.id)(),
1618
- operator: A,
1619
- chair: I,
1620
- privacy: u = !1,
1621
- privacyTitle: k,
1622
- mapsLink: s,
1623
- notesPreview: f,
1624
- onOpenNotes: b,
1625
- history: y,
1626
- onOpenHistory: T,
1627
- noteUnrecordedEdits: x = !1,
1628
- readOnly: S = !1,
1629
- onStatusChange: v,
1630
- allowedStatuses: L = Mt,
1631
- onDescriptionChange: F,
1632
- onAssignPatient: G,
1633
- onEdit: V,
1634
- onMove: X,
1635
- onCopy: K,
1636
- onDelete: ee,
1637
- onJoinTelehealth: R,
1638
- onWhatsApp: Q,
1639
- whatsappUrl: J,
1640
- onBuyWhatsApp: le,
1641
- createTaskUrl: Ne,
1642
- onRequestSignature: ce,
1643
- shortcuts: ue,
1644
- documents: ae
1645
- }) {
1646
- var Et, Dt;
1647
- const { t: w } = W("ui"), { eventId: O } = t, [Ve] = $(r), me = { details: t, locale: i, currency: a }, E = y ? y.eventId !== void 0 && y.eventId !== O ? { status: "loading" } : y : t.history ? { entries: t.history } : void 0, Fe = (f == null ? void 0 : f.patientId) === void 0 || f.patientId === p, pe = f ? Fe ? f : p ? { notes: [], status: "loading", total: null } : void 0 : void 0, ie = !!F && !S && !u, [xe, te] = $(!1), [Se, Z] = $(!1), se = xe && E !== void 0, ze = Se && ie, Ae = () => {
1648
- se || !E || (te(!0), T == null || T(O));
1649
- }, He = _({ history: !1, editor: !1 });
1650
- oe(() => {
1651
- const N = He.current;
1652
- He.current = { history: se, editor: ze };
1653
- const ve = N.history && E === void 0, Ct = N.editor && !ie;
1654
- ve && te(!1), Ct && Z(!1), (ve || Ct) && Le(h);
1655
- });
1656
- const fe = _(null), z = _(!1), Ie = (E == null ? void 0 : E.status) ?? (E != null && E.entries ? "ready" : "loading");
1657
- oe(() => {
1658
- z.current && (Ie !== "loading" && (z.current = !1), mt(fe.current));
1659
- }, [Ie]);
1660
- const [Y, Te] = $(t.appointment.name ?? "");
1661
- ke(() => {
1662
- Te(t.appointment.name ?? "");
1663
- }, [t.appointment.name]);
1664
- const [Ee, re] = $(""), [he, De] = $(!1), [C, U] = $(), ge = _(null);
1665
- ke(() => {
1666
- Se && (re(Y), U(void 0));
1667
- }, [Se]);
1668
- const $e = async () => {
1669
- if (!F) return;
1670
- const N = Ee.trim();
1671
- De(!0), U(void 0);
1672
- try {
1673
- await F(N, O), Te(N), Z(!1);
1674
- } catch (ve) {
1675
- U(
1676
- rt(ve, w(D("descriptionSaveFailed")))
1677
- );
1678
- } finally {
1679
- De(!1);
1680
- }
1681
- }, [q, Xe] = $(t.appointment.status);
1682
- ke(() => {
1683
- Xe(t.appointment.status);
1684
- }, [t.appointment.status]);
1685
- const kt = _(n);
1686
- oe(() => {
1687
- const N = kt.current && !n;
1688
- kt.current = n, N && (Xe(t.appointment.status), Te(t.appointment.name ?? ""));
1689
- }, [n]);
1690
- const Be = Mt.filter(
1691
- (N) => L.includes(N)
1692
- ), Ce = gt(q, {
1693
- statuses: Be,
1694
- /* Shown so the control can say it, but not a choice. */
1695
- disabledStatuses: q && !Be.includes(q) ? [q] : []
1696
- }), Re = !!v && !S && Be.some((N) => N !== q), an = async (N) => {
1697
- if (!(!v || !gn(N))) {
1698
- try {
1699
- await v(N, O);
1700
- } catch (ve) {
1701
- throw new Error(rt(ve, w(D("statusSaveFailed"))));
1702
- }
1703
- Xe(N);
1704
- }
1705
- }, wt = u ? void 0 : J, Nt = _a.filter(
1706
- (N) => ae == null ? void 0 : ae.kinds.includes(N)
1707
- ), sn = (((Et = t.care) == null ? void 0 : Et.lines.length) ?? 0) > 0, Qe = p !== void 0 && p !== "", Je = w(D("status")), xt = `${Je}: ${Ce.option.label}`, Ze = _(null), St = _(Re);
1708
- oe(() => {
1709
- const N = St.current && !Re;
1710
- St.current = Re, N && (Ze.current ? mt(Ze.current) : Le(h));
1711
- });
1712
- const At = Re ? /* @__PURE__ */ e(
1713
- hn,
1714
- {
1715
- ref: c,
1716
- value: Ce.value,
1717
- options: Ce.options,
1718
- size: "sm",
1719
- workflowLabel: Je,
1720
- className: `ds:[&>button]:bg-[color:var(--background)] ${La}`,
1721
- "aria-label": xt,
1722
- onValueChange: an
1723
- }
1724
- ) : q ? (
1725
- /* Named as the control is, "Status: Confirmed": the small display
1726
- prints the value alone. */
1727
- /* @__PURE__ */ e(
1728
- "div",
1729
- {
1730
- ref: Ze,
1731
- role: "group",
1732
- "aria-label": xt,
1733
- tabIndex: -1,
1734
- "data-status-display": "",
1735
- className: Ma(),
1736
- children: /* @__PURE__ */ e(
1737
- Vt,
1738
- {
1739
- value: Ce.value,
1740
- size: "sm",
1741
- workflowLabel: Je,
1742
- option: Ce.option
1743
- }
1744
- )
1745
- }
1746
- )
1747
- ) : null, H = [];
1748
- !S && G && !Qe && H.push([
1749
- "assign-patient",
1750
- /* @__PURE__ */ e(
1751
- M,
1752
- {
1753
- intent: "primary",
1754
- "data-action": "assign-patient",
1755
- className: j,
1756
- startIcon: /* @__PURE__ */ e(Fn, { "aria-hidden": "true" }),
1757
- onClick: () => G(O),
1758
- children: w("calendarWorkspace.inc1.bookings.assignPatient")
1759
- },
1760
- "assign"
1761
- )
1762
- ]), R && H.push([
1763
- "join-telehealth",
1764
- /* @__PURE__ */ e(
1765
- M,
1766
- {
1767
- intent: "primary",
1768
- "data-action": "join-telehealth",
1769
- className: j,
1770
- startIcon: /* @__PURE__ */ e(bt, { "aria-hidden": "true" }),
1771
- onClick: () => R(O),
1772
- children: w(D("joinTelehealth"))
1773
- },
1774
- "join"
1775
- )
1776
- ]), !S && V && H.push([
1777
- "edit-appointment",
1778
- /* @__PURE__ */ e(
1779
- M,
1780
- {
1781
- "data-action": "edit-appointment",
1782
- className: j,
1783
- startIcon: /* @__PURE__ */ e(be, { "aria-hidden": "true" }),
1784
- onClick: () => V(O),
1785
- children: w("calendarWorkspace.editor.editTitle")
1786
- },
1787
- "edit"
1788
- )
1789
- ]), !S && X && H.push([
1790
- "move-appointment",
1791
- /* @__PURE__ */ e(
1792
- M,
1793
- {
1794
- "data-action": "move-appointment",
1795
- className: j,
1796
- startIcon: /* @__PURE__ */ e(ut, { "aria-hidden": "true" }),
1797
- onClick: () => X(O),
1798
- children: w(D("move"))
1799
- },
1800
- "move"
1801
- )
1802
- ]), !S && K && H.push([
1803
- "copy-appointment",
1804
- sn ? /* @__PURE__ */ e(
1805
- Ut,
1806
- {
1807
- "data-action": "copy-appointment",
1808
- "data-overflow-tip": !1,
1809
- startIcon: /* @__PURE__ */ e(Ft, { "aria-hidden": "true" }),
1810
- overflowItems: [
1811
- {
1812
- label: w("calendarWorkspace.editor.duplicateAppointmentOnly"),
1813
- icon: /* @__PURE__ */ e(zn, { "aria-hidden": "true" }),
1814
- action: "copy-appointment-only",
1815
- onSelect: () => K(!1, O)
1816
- },
1817
- {
1818
- label: w("calendarWorkspace.editor.duplicateWithTreatments"),
1819
- icon: /* @__PURE__ */ e(ct, { "aria-hidden": "true" }),
1820
- action: "copy-appointment-with-treatments",
1821
- onSelect: () => K(!0, O)
1822
- }
1823
- ],
1824
- children: w(D("copy"))
1825
- },
1826
- "copy"
1827
- ) : /* @__PURE__ */ e(
1828
- M,
1829
- {
1830
- "data-action": "copy-appointment",
1831
- className: j,
1832
- startIcon: /* @__PURE__ */ e(Ft, { "aria-hidden": "true" }),
1833
- onClick: () => K(!1, O),
1834
- children: w(D("copy"))
1835
- },
1836
- "copy"
1837
- )
1838
- ]), ae && Nt.length > 0 && H.push([
1839
- "open-create-document",
1840
- /* @__PURE__ */ e(
1841
- Ut,
1842
- {
1843
- "data-action": "open-create-document",
1844
- "data-overflow-tip": !1,
1845
- startIcon: /* @__PURE__ */ e(Hn, { "aria-hidden": "true" }),
1846
- overflowItems: Nt.map((N) => ({
1847
- label: w(D(`documents.${N}`)),
1848
- icon: Fa[N],
1849
- action: `create-document-${N}`,
1850
- onSelect: () => ae.onCreate(N, O)
1851
- })),
1852
- children: w(D("documents.label"))
1853
- },
1854
- "documents"
1855
- )
1856
- ]), Q ? H.push([
1857
- "open-whatsapp",
1858
- /* @__PURE__ */ e(
1859
- M,
1860
- {
1861
- "data-action": "open-whatsapp",
1862
- className: j,
1863
- startIcon: /* @__PURE__ */ e(at, { "aria-hidden": "true" }),
1864
- onClick: () => Q(O),
1865
- children: w(D("remindWhatsApp"))
1866
- },
1867
- "whatsapp"
1868
- )
1869
- ]) : qe(wt) ? H.push([
1870
- "open-whatsapp",
1871
- /* @__PURE__ */ e(
1872
- M,
1873
- {
1874
- asChild: !0,
1875
- "data-action": "open-whatsapp",
1876
- className: j,
1877
- startIcon: /* @__PURE__ */ e(at, { "aria-hidden": "true" }),
1878
- children: /* @__PURE__ */ e(
1879
- "a",
1880
- {
1881
- href: qe(wt),
1882
- target: "_blank",
1883
- rel: "noopener noreferrer",
1884
- children: w(D("remindWhatsApp"))
1885
- }
1886
- )
1887
- },
1888
- "whatsapp"
1889
- )
1890
- ]) : le && !J && H.push([
1891
- "buy-whatsapp",
1892
- /* @__PURE__ */ e(
1893
- M,
1894
- {
1895
- "data-action": "buy-whatsapp",
1896
- className: j,
1897
- startIcon: /* @__PURE__ */ e(at, { "aria-hidden": "true" }),
1898
- onClick: () => le(O),
1899
- children: w(D("buyWhatsApp"))
1900
- },
1901
- "buy-whatsapp"
1902
- )
1903
- ]);
1904
- const It = qe(Ne);
1905
- It && H.push([
1906
- "create-task",
1907
- /* @__PURE__ */ e(
1908
- M,
1909
- {
1910
- asChild: !0,
1911
- "data-action": "create-task",
1912
- className: j,
1913
- startIcon: /* @__PURE__ */ e($n, { "aria-hidden": "true" }),
1914
- children: /* @__PURE__ */ e("a", { href: It, children: w(D("createTask")) })
1915
- },
1916
- "task"
1917
- )
1918
- ]), !S && ee && H.push([
1919
- "delete-appointment",
1920
- /* @__PURE__ */ e(
1921
- M,
1922
- {
1923
- intent: "destructiveOutline",
1924
- "data-action": "delete-appointment",
1925
- className: j,
1926
- startIcon: /* @__PURE__ */ e(Xt, { "aria-hidden": "true" }),
1927
- onClick: () => ee(O),
1928
- children: w("calendarWorkspace.editor.delete")
1929
- },
1930
- "delete"
1931
- )
1932
- ]);
1933
- const et = H.map(([, N]) => N);
1934
- d.current = {
1935
- status: q ?? null,
1936
- allowed: Re ? Be : [],
1937
- offered: H.map(([N]) => N),
1938
- historyAvailable: E !== void 0,
1939
- historyOpen: se,
1940
- openHistory: Ae,
1941
- closeHistory: () => te(!1)
1942
- };
1943
- const Tt = w(D("historyBack"));
1944
- return /* @__PURE__ */ e(
1945
- "div",
1946
- {
1947
- className: `ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ${Ve ? mn : ""}`,
1948
- children: /* @__PURE__ */ g(nt.Host, { children: [
1949
- /* @__PURE__ */ e(
1950
- Kt,
1951
- {
1952
- title: l,
1953
- headingId: h,
1954
- icon: /* @__PURE__ */ e(vt, { "aria-hidden": "true" }),
1955
- sticky: !0,
1956
- divider: !0,
1957
- actions: E ? /* @__PURE__ */ e(
1958
- qt,
1959
- {
1960
- size: "sm",
1961
- intent: "ghost",
1962
- icon: /* @__PURE__ */ e(_t, { "aria-hidden": "true" }),
1963
- "aria-label": w(D("historyAction")),
1964
- tooltip: w(D("historyAction")),
1965
- "data-action": "open-history",
1966
- onClick: Ae
1967
- }
1968
- ) : void 0
1969
- }
1970
- ),
1971
- /* @__PURE__ */ e(
1972
- "div",
1973
- {
1974
- tabIndex: 0,
1975
- "aria-busy": n || void 0,
1976
- className: "ds:[min-block-size:0] ds:flex-1 ds:overflow-y-auto",
1977
- children: /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
1978
- u ? /* @__PURE__ */ e(cn, { mask: k }) : t.patient ? /* @__PURE__ */ e(
1979
- Ta,
1980
- {
1981
- ...me,
1982
- now: o,
1983
- mapsLink: s,
1984
- shortcuts: ue,
1985
- onRequestSignature: ce
1986
- }
1987
- ) : (
1988
- /* No patient card to carry the identity: a patient-less, an
1989
- unassigned or an unresolved booking keeps the strip. */
1990
- /* @__PURE__ */ e(
1991
- va,
1992
- {
1993
- name: t.appointment.title.trim() ? t.appointment.title : w(D("patientNotLoaded")),
1994
- unresolved: Qe,
1995
- status: q,
1996
- flags: {
1997
- isTelehealth: t.appointment.isTelehealth,
1998
- isBookedOnline: t.appointment.bookedOnline,
1999
- isRecurring: t.appointment.recurrence !== void 0,
2000
- hasUnassignedPatient: t.appointment.bookedOnline && !Qe,
2001
- hasHighlightedAnamnesis: !1,
2002
- hasBillableAmount: (((Dt = t.money) == null ? void 0 : Dt.billableAmount) ?? 0) > 0
2003
- },
2004
- locale: i
2005
- }
2006
- )
2007
- ),
2008
- /* @__PURE__ */ e(
2009
- Ea,
2010
- {
2011
- ...me,
2012
- operator: A,
2013
- chair: I,
2014
- privacy: u,
2015
- history: (E == null ? void 0 : E.status) === "error" || E == null ? void 0 : E.entries,
2016
- description: (
2017
- /* Not keyed on the text: the pencil must survive a save,
2018
- so the sub-view can hand focus back to it. An empty
2019
- read-only description prints nothing. Privacy hides the
2020
- text and the pencil. */
2021
- u ? Y ? /* @__PURE__ */ e(Pt, { block: "description" }) : void 0 : Y || F && !S ? /* @__PURE__ */ e(
2022
- jt,
2023
- {
2024
- "data-block": "description",
2025
- role: "group",
2026
- "aria-label": w("calendarWorkspace.editor.description"),
2027
- value: Y,
2028
- editLabel: w(D("editDescription")),
2029
- onEdit: F && !S ? () => Z(!0) : void 0
2030
- }
2031
- ) : void 0
2032
- )
2033
- }
2034
- ),
2035
- pe && u ? /* @__PURE__ */ e(
2036
- de,
2037
- {
2038
- "data-card": "notes",
2039
- title: w("notesPanel.title"),
2040
- headingLevel: 3,
2041
- children: /* @__PURE__ */ e(Pt, {})
2042
- }
2043
- ) : pe ? /* @__PURE__ */ e(
2044
- Ca,
2045
- {
2046
- preview: pe,
2047
- onOpenNotes: Fe ? b : void 0,
2048
- locale: i
2049
- }
2050
- ) : null,
2051
- /* @__PURE__ */ e(
2052
- Da,
2053
- {
2054
- ...me,
2055
- privacy: u,
2056
- carePlanUrl: ue == null ? void 0 : ue.carePlanUrl
2057
- }
2058
- )
2059
- ] })
2060
- }
2061
- ),
2062
- At || et.length > 0 ? (
2063
- /* The body scrolls; the status and the actions stay put. The
2064
- status keeps its own segment and never folds. The actions fold
2065
- to icons, then into More, never onto a second line. */
2066
- /* @__PURE__ */ g("div", { className: Pa(), children: [
2067
- At,
2068
- et.length > 0 ? /* @__PURE__ */ e(
2069
- un,
2070
- {
2071
- label: w(D("actionsLabel")),
2072
- overflow: "menu",
2073
- collapseToIcons: !0,
2074
- background: "surface",
2075
- size: "sm",
2076
- className: `ds:min-w-0 ds:flex-1 ds:text-end ${Oa}`,
2077
- children: et
2078
- }
2079
- ) : null
2080
- ] })
2081
- ) : null,
2082
- E ? /* @__PURE__ */ e(
2083
- nt,
2084
- {
2085
- ref: fe,
2086
- open: se,
2087
- icon: /* @__PURE__ */ e(_t, { "aria-hidden": "true" }),
2088
- title: w(D("historyTitle")),
2089
- backLabel: Tt,
2090
- headingLevel: 3,
2091
- onBack: () => te(!1),
2092
- "data-details-subview": "history",
2093
- children: /* @__PURE__ */ e("div", { className: "ds:-m-[var(--panel-subview-inset)] ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ e(
2094
- Ha,
2095
- {
2096
- history: E,
2097
- locale: i,
2098
- noteUnrecordedEdits: x,
2099
- privacy: u,
2100
- onRetry: E.onRetry ? () => {
2101
- var N;
2102
- z.current = !0, (N = E.onRetry) == null || N.call(E);
2103
- } : void 0
2104
- }
2105
- ) })
2106
- }
2107
- ) : null,
2108
- ie ? /* @__PURE__ */ e(
2109
- nt,
2110
- {
2111
- open: ze,
2112
- icon: /* @__PURE__ */ e(be, { "aria-hidden": "true" }),
2113
- title: w(D("editDescription")),
2114
- backLabel: Tt,
2115
- headingLevel: 3,
2116
- initialFocusRef: ge,
2117
- onBack: () => {
2118
- he || Z(!1);
2119
- },
2120
- "data-details-subview": "description",
2121
- footer: /* @__PURE__ */ g(ne, { children: [
2122
- /* @__PURE__ */ e(
2123
- M,
2124
- {
2125
- intent: "secondary",
2126
- disabled: he,
2127
- onClick: () => Z(!1),
2128
- children: w(D("noteCancel"))
2129
- }
2130
- ),
2131
- /* @__PURE__ */ e(
2132
- M,
2133
- {
2134
- intent: "primary",
2135
- "data-action": "save-description",
2136
- loading: he,
2137
- onClick: () => void $e(),
2138
- children: w(D("descriptionSave"))
2139
- }
2140
- )
2141
- ] }),
2142
- children: /* @__PURE__ */ g("div", { className: "ds:-m-[var(--panel-subview-inset)] ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
2143
- C ? /* @__PURE__ */ e(B, { variant: "error", children: /* @__PURE__ */ e(B.Description, { children: C }) }) : null,
2144
- /* @__PURE__ */ e(
2145
- pn,
2146
- {
2147
- ref: ge,
2148
- value: Ee,
2149
- minRows: 6,
2150
- autoResize: !0,
2151
- "aria-label": w("calendarWorkspace.editor.description"),
2152
- onChange: (N) => re(N.target.value)
2153
- }
2154
- )
2155
- ] })
2156
- }
2157
- ) : null
2158
- ] })
2159
- }
2160
- );
2161
- }
2162
- const Ba = rn(function({
2163
- state: n,
2164
- onRetry: a,
2165
- patientId: o,
2166
- operator: i,
2167
- chair: l,
2168
- currency: h = "EUR",
2169
- now: r,
2170
- locale: d,
2171
- title: c,
2172
- privacy: p = !1,
2173
- privacyTitle: A,
2174
- mapsLink: I,
2175
- notesPreview: u,
2176
- onOpenNotes: k,
2177
- history: s,
2178
- onOpenHistory: f,
2179
- noteUnrecordedEdits: b,
2180
- readOnly: y = !1,
2181
- onStatusChange: T,
2182
- allowedStatuses: x,
2183
- onDescriptionChange: S,
2184
- onAssignPatient: v,
2185
- onEdit: L,
2186
- onMove: F,
2187
- onCopy: G,
2188
- onDelete: V,
2189
- onJoinTelehealth: X,
2190
- onWhatsApp: K,
2191
- whatsappUrl: ee,
2192
- onBuyWhatsApp: R,
2193
- createTaskUrl: Q,
2194
- onRequestSignature: J,
2195
- shortcuts: le,
2196
- documents: Ne,
2197
- id: ce,
2198
- className: ue,
2199
- ...ae
2200
- }, _e) {
2201
- var he, De;
2202
- const { t: w, i18n: O } = W("ui"), Ve = st(), me = ce ?? Ve, E = st(), Fe = d ?? O.language, pe = !p && (c != null && c.trim()) ? c : w(D("region")), ie = n.status === "ready" ? n.read : void 0, xe = n.status === "ready" ? n.read.eventId : n.eventId, te = _(
2203
- void 0
2204
- ), Se = te.current !== void 0 && te.current !== "ready";
2205
- ke(() => {
2206
- te.current = n.status;
2207
- }, [n.status]);
2208
- const Z = !!a && (n.status === "error" || n.status === "refused" && n.retryable === !0), se = _(null), ze = Rt(() => ln(_e, se), [_e]), Ae = _(!1);
2209
- typeof document < "u" && (Ae.current = ((he = se.current) == null ? void 0 : he.contains(document.activeElement)) ?? !1);
2210
- const He = ie ? `ready:${ie.eventId}` : n.status, fe = _(!1);
2211
- oe(() => {
2212
- fe.current ? (n.status !== "loading" && (fe.current = !1), Le(E)) : Ae.current && Le(E);
2213
- }, [He, E]);
2214
- const z = _(null);
2215
- ie || (z.current = null);
2216
- const Ie = _(null), Y = _({ state: n, eventId: xe, privacy: p, retryOffered: Z, onRetry: a });
2217
- Y.current = { state: n, eventId: xe, privacy: p, retryOffered: Z, onRetry: a };
2218
- const Te = Rt(
2219
- () => ({
2220
- getEventId: () => Y.current.eventId ?? null,
2221
- getLoadStatus: () => Y.current.state.status,
2222
- getAppointmentStatus: () => {
2223
- var C;
2224
- return ((C = z.current) == null ? void 0 : C.status) ?? null;
2225
- },
2226
- getAllowedStatuses: () => {
2227
- var C;
2228
- return [...((C = z.current) == null ? void 0 : C.allowed) ?? []];
2229
- },
2230
- getOfferedActions: () => {
2231
- var C;
2232
- return [...((C = z.current) == null ? void 0 : C.offered) ?? []];
2233
- },
2234
- isHistoryOpen: () => {
2235
- var C;
2236
- return ((C = z.current) == null ? void 0 : C.historyOpen) ?? !1;
2237
- },
2238
- isPrivacy: () => Y.current.privacy,
2239
- openHistory: () => {
2240
- var C;
2241
- if (!((C = z.current) != null && C.historyAvailable))
2242
- throw new Error("AppointmentDetailsPanel: History is not offered.");
2243
- z.current.openHistory();
2244
- },
2245
- closeHistory: () => {
2246
- var C;
2247
- (C = z.current) == null || C.closeHistory();
2248
- },
2249
- setAppointmentStatus: (C) => {
2250
- const U = z.current, ge = Ie.current;
2251
- if (!U || !ge || U.allowed.length === 0)
2252
- return tt(
2253
- new Error("AppointmentDetailsPanel: the status is read-only.")
2254
- );
2255
- if (C === U.status) return Promise.resolve();
2256
- if (!U.allowed.includes(C))
2257
- return tt(
2258
- new Error(`AppointmentDetailsPanel: "${C}" is not allowed.`)
2259
- );
2260
- const $e = () => tt(
2261
- new Error("AppointmentDetailsPanel: a status save is in flight.")
2262
- );
2263
- if (ge.getIsSaving()) return $e();
2264
- const q = ge.setValue(C);
2265
- return q === void 0 ? $e() : q;
2266
- },
2267
- retry: () => {
2268
- const { retryOffered: C, onRetry: U } = Y.current;
2269
- if (!C || !U)
2270
- throw new Error("AppointmentDetailsPanel: Retry is not offered.");
2271
- U();
2272
- }
2273
- }),
2274
- []
2275
- );
2276
- dn(ea, Te, me);
2277
- const Ee = /* @__PURE__ */ e(
2278
- Kt,
2279
- {
2280
- title: pe,
2281
- headingId: E,
2282
- icon: /* @__PURE__ */ e(vt, { "aria-hidden": "true" }),
2283
- sticky: !0,
2284
- divider: !0
2285
- }
2286
- );
2287
- let re;
2288
- return n.status === "ready" ? re = /* @__PURE__ */ e(
2289
- $a,
2290
- {
2291
- read: n.read,
2292
- refreshing: n.refreshing === !0,
2293
- currency: h,
2294
- now: r ?? /* @__PURE__ */ new Date(),
2295
- locale: Fe,
2296
- shownTitle: pe,
2297
- headingId: E,
2298
- enter: Se,
2299
- live: z,
2300
- statusControl: Ie,
2301
- patientId: o,
2302
- operator: i,
2303
- chair: l,
2304
- privacy: p,
2305
- privacyTitle: A,
2306
- mapsLink: I,
2307
- notesPreview: u,
2308
- onOpenNotes: k,
2309
- history: s,
2310
- onOpenHistory: f,
2311
- noteUnrecordedEdits: b,
2312
- readOnly: y,
2313
- onStatusChange: T,
2314
- allowedStatuses: x,
2315
- onDescriptionChange: S,
2316
- onAssignPatient: v,
2317
- onEdit: L,
2318
- onMove: F,
2319
- onCopy: G,
2320
- onDelete: V,
2321
- onJoinTelehealth: X,
2322
- onWhatsApp: K,
2323
- whatsappUrl: ee,
2324
- onBuyWhatsApp: R,
2325
- createTaskUrl: Q,
2326
- onRequestSignature: J,
2327
- shortcuts: le,
2328
- documents: Ne
2329
- },
2330
- n.read.eventId
2331
- ) : n.status === "loading" ? re = /* @__PURE__ */ g(ne, { children: [
2332
- Ee,
2333
- /* @__PURE__ */ e(za, {})
2334
- ] }) : re = /* @__PURE__ */ g(ne, { children: [
2335
- Ee,
2336
- /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
2337
- /* @__PURE__ */ e(B, { variant: n.status === "error" ? "error" : "warning", children: /* @__PURE__ */ e(B.Description, { children: n.status === "error" ? ((De = n.message) == null ? void 0 : De.trim()) || w("emptyState.error.description") : n.reason }) }),
2338
- Z ? /* @__PURE__ */ e(
2339
- M,
2340
- {
2341
- intent: "outline",
2342
- "data-action": "retry-load",
2343
- onClick: () => {
2344
- fe.current = !0, a == null || a();
2345
- },
2346
- children: w("emptyState.error.cta")
2347
- }
2348
- ) : null
2349
- ] })
2350
- ] }), /* @__PURE__ */ e(
2351
- "div",
2352
- {
2353
- ref: ze,
2354
- id: ce,
2355
- "data-component": "appointment-details-panel",
2356
- "data-component-id": me,
2357
- "data-event-id": xe,
2358
- "data-status": n.status,
2359
- "aria-busy": n.status === "loading" || void 0,
2360
- className: Ra({ className: ue }),
2361
- ...ae,
2362
- children: re
2363
- }
2364
- );
2365
- });
2366
- Ba.displayName = "AppointmentDetailsPanel";
2367
- function ls({
2368
- eventId: t,
2369
- load: n,
2370
- reloadKey: a
2371
- }) {
2372
- const { t: o } = W("ui"), i = _("");
2373
- i.current = o("emptyState.error.description");
2374
- const l = _(n);
2375
- oe(() => {
2376
- l.current = n;
2377
- });
2378
- const [h, r] = $(0), [d, c] = $(), p = JSON.stringify([a ?? null, h]), [A, I] = $({ eventId: t, count: 0 }), u = A.eventId === t ? A.count : A.count + 1;
2379
- A.eventId !== t && I({ eventId: t, count: u }), ke(() => {
2380
- if (t === null) {
2381
- c(void 0);
2382
- return;
2383
- }
2384
- const b = new AbortController(), y = (T) => {
2385
- b.signal.aborted || c({ eventId: t, selection: u, request: p, value: T });
2386
- };
2387
- return Promise.resolve().then(() => l.current(t, { signal: b.signal })).then((T) => {
2388
- var x, S;
2389
- if (T.status !== "ready") {
2390
- y({
2391
- status: "refused",
2392
- eventId: t,
2393
- reason: T.reason,
2394
- retryable: T.retryable
2395
- });
2396
- return;
2397
- }
2398
- if (((x = T.details) == null ? void 0 : x.eventId) !== t || !ia((S = T.details.appointment) == null ? void 0 : S.startIso))
2399
- throw new Error(i.current);
2400
- y({ status: "ready", read: T.details });
2401
- }).catch((T) => {
2402
- y({
2403
- status: "error",
2404
- eventId: t,
2405
- message: rt(T, i.current)
2406
- });
2407
- }), () => b.abort();
2408
- }, [t, u, p]);
2409
- const k = on(() => r((b) => b + 1), []);
2410
- if (t === null) return { state: null, retry: k };
2411
- const s = (d == null ? void 0 : d.eventId) === t && d.selection === u ? d : void 0;
2412
- let f = { status: "loading", eventId: t };
2413
- return (s == null ? void 0 : s.request) === p ? f = s.value : (s == null ? void 0 : s.value.status) === "ready" && (f = { status: "ready", read: s.value.read, refreshing: !0 }), { state: f, retry: k };
2414
- }
2415
- export {
2416
- Ba as A,
2417
- Ft as C,
2418
- Me as D,
2419
- ga as I,
2420
- ut as M,
2421
- ra as R,
2422
- ea as a,
2423
- Oe as b,
2424
- na as c,
2425
- oa as d,
2426
- ha as e,
2427
- Ke as f,
2428
- fa as g,
2429
- pt as h,
2430
- Jt as i,
2431
- da as j,
2432
- la as k,
2433
- va as l,
2434
- ta as m,
2435
- ia as p,
2436
- sa as s,
2437
- ls as u
2438
- };
2439
- //# sourceMappingURL=use-appointment-details-read-n7kycxrm.js.map