@alfadocs/ui-kit 1.135.0 → 1.137.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 (216) hide show
  1. package/dist/_chunks/{ai-prompt-input-JIPbrTF3.js → ai-prompt-input-CVNeusoW.js} +2 -2
  2. package/dist/_chunks/ai-summary-panel-BhCo2vZF.js +1045 -0
  3. package/dist/_chunks/{alia-sidebar-CtwhdASP.js → alia-sidebar-CVBlKur9.js} +3 -3
  4. package/dist/_chunks/{anamnesis-summary-rows-CCNmkq55.js → anamnesis-summary-rows-Dr2V1Rtf.js} +3 -3
  5. package/dist/_chunks/appointment-details-panel.history-DrIMDQYf.js +314 -0
  6. package/dist/_chunks/appointment-details-panel.identity-C20Y9xNC.js +223 -0
  7. package/dist/_chunks/{audio-recorder-CsnM_WDy.js → audio-recorder-BOF5YYoC.js} +2 -2
  8. package/dist/_chunks/{balance-badge-cell-DTiMdnCZ.js → balance-badge-cell-BSB02Bwo.js} +4 -4
  9. package/dist/_chunks/{bill-line-table-DHKb_O7c.js → bill-line-table-By-YL2ms.js} +2 -2
  10. package/dist/_chunks/{bishop-score-CKztphVz.js → bishop-score-DWGESRP9.js} +2 -2
  11. package/dist/_chunks/calendar-appointment-editor-dialog-D0n_bVsT.js +5518 -0
  12. package/dist/_chunks/calendar-editor-discard-host-1UfmMOEb.js +1336 -0
  13. package/dist/_chunks/calendar-editor-guard-9fShhNIA.js +31 -0
  14. package/dist/_chunks/calendar-waiting-list-panel-Ckd6tSeu.js +981 -0
  15. package/dist/_chunks/calendar-workspace.model-DrOoxY1b.js +1557 -0
  16. package/dist/_chunks/calendar.sheets-Datc0-IT.js +4585 -0
  17. package/dist/_chunks/call-status-chip-pajxN5eZ.js +180 -0
  18. package/dist/_chunks/calls-panel-BIfatK90.js +1094 -0
  19. package/dist/_chunks/{chat-input-CX4dxBq7.js → chat-input-BmvnuZqj.js} +114 -109
  20. package/dist/_chunks/{chat-message-CfIyXrxA.js → chat-message-B4TMeZ2m.js} +35 -30
  21. package/dist/_chunks/circle-x-W8Enq3i4.js +16 -0
  22. package/dist/_chunks/color-picker-CC8ZfntU.js +582 -0
  23. package/dist/_chunks/communications-panel-SQ-55e3V.js +1079 -0
  24. package/dist/_chunks/{data-grid-B2oaI7Lt.js → data-grid-CxKz8flO.js} +2 -2
  25. package/dist/_chunks/{data-table-FTV3uRjX.js → data-table-_tgj0C_T.js} +2 -2
  26. package/dist/_chunks/{default-tabs-DbebYO04.js → default-tabs-oDWQzbN7.js} +3 -3
  27. package/dist/_chunks/{document-preview-DLVIrOYV.js → document-preview-CirR3C_m.js} +3 -3
  28. package/dist/_chunks/entity-summary-CPUHzyil.js +297 -0
  29. package/dist/_chunks/{file-manager-Bzr5NK1t.js → file-manager-CEi4z2i0.js} +2 -2
  30. package/dist/_chunks/{fiscal-code-input-BBvU7sAo.js → fiscal-code-input-DZlpaMGg.js} +2 -2
  31. package/dist/_chunks/{gestational-age-calculator-mB6brTlp.js → gestational-age-calculator-CHbpC4vL.js} +2 -2
  32. package/dist/_chunks/{heatmap-C5gJin_F.js → heatmap-_546qI2V.js} +2 -2
  33. package/dist/_chunks/{iban-input-DuTwKok5.js → iban-input-CdSLRzQN.js} +2 -2
  34. package/dist/_chunks/{invoice-upload-list-B5aMffTy.js → invoice-upload-list-CQI9MUl6.js} +3 -3
  35. package/dist/_chunks/{kit-extensions-DUaIYyMD.js → kit-extensions-BNBf4m8O.js} +3 -3
  36. package/dist/_chunks/{link-cell-renderer-D3JLPURZ.js → link-cell-renderer-Xx5T8u5Q.js} +3 -3
  37. package/dist/_chunks/list-todo-KWvUhmT_.js +33 -0
  38. package/dist/_chunks/{muscle-scheme-BGJD62op.js → muscle-scheme-D_rSyGDj.js} +2 -2
  39. package/dist/_chunks/{notes-panel-BvjAo4RQ.js → notes-panel-DsEKNtsw.js} +2 -2
  40. package/dist/_chunks/{optical-prescription-Da_r8pMr.js → optical-prescription-DaSbsh4p.js} +2 -2
  41. package/dist/_chunks/palettes-CKVXYTzo.js +172 -0
  42. package/dist/_chunks/{patient-account-settings-B2XbN_Fe.js → patient-account-settings-COybehKx.js} +3 -3
  43. package/dist/_chunks/{patient-card-DTh3QTyS.js → patient-card-Cpr8iD19.js} +4 -4
  44. package/dist/_chunks/{patient-check-in-resume-B7NY-6KI.js → patient-check-in-resume-DZnyYDKH.js} +40 -40
  45. package/dist/_chunks/{patient-details-DBtEITfE.js → patient-details-Dv7EiTCo.js} +2 -2
  46. package/dist/_chunks/{patient-field-row-a5d4QijH.js → patient-field-row-DuHWGlLz.js} +3 -3
  47. package/dist/_chunks/patient-picker-BZJuOgMw.js +173 -0
  48. package/dist/_chunks/{patient-sign-in-pin-CDBqV254.js → patient-sign-in-pin-DmMBwWet.js} +2 -2
  49. package/dist/_chunks/{patient-sign-in-steps-C2JSqlok.js → patient-sign-in-steps-BKcxNkdY.js} +37 -59
  50. package/dist/_chunks/{patient-summary-card-Bl2NknPe.js → patient-summary-card-D-cDzOim.js} +2 -2
  51. package/dist/_chunks/phone-off-DQSTLz4l.js +28 -0
  52. package/dist/_chunks/{portal-details-DCIiGkHA.js → portal-details-DdzvroYP.js} +2 -2
  53. package/dist/_chunks/{portal-documents-DJOH8pZx.js → portal-documents-CNmoYWFc.js} +3 -3
  54. package/dist/_chunks/{pregnancy-dating-BNI32qNw.js → pregnancy-dating-lJbzai73.js} +2 -2
  55. package/dist/_chunks/{privacy-mask-C19dJFMk.js → privacy-mask-C2ZLKrMh.js} +5 -5
  56. package/dist/_chunks/{registration-form-DS3RuKHu.js → registration-form-CuLiTA52.js} +2 -2
  57. package/dist/_chunks/{reserved.agent-DOzOBUW7.js → reserved.agent-CabZHFJC.js} +2 -2
  58. package/dist/_chunks/{rich-text-editor-DjHL1b3E.js → rich-text-editor-C48omVjq.js} +2 -2
  59. package/dist/_chunks/{select-uESzXTX6.js → select-CIXKyUMw.js} +172 -149
  60. package/dist/_chunks/{session-countdown-DOx1IBUB.js → session-countdown-StcyUU5O.js} +56 -66
  61. package/dist/_chunks/{signature-request-CHsM_iWi.js → signature-request-vJDSHZld.js} +2 -2
  62. package/dist/_chunks/{tabs-CRIDBLP7.js → tabs-Czkmw5ou.js} +2 -2
  63. package/dist/_chunks/task-editor-wKbFbGqW.js +1093 -0
  64. package/dist/_chunks/{tasks-panel-6EzdnwT8.js → tasks-panel-DbtJS4QI.js} +2 -2
  65. package/dist/_chunks/{toolbar-CfdoJzMV.js → toolbar-DjG-cpD_.js} +2 -2
  66. package/dist/_chunks/{unit-converter-YKlHyUC2.js → unit-converter-CUAUTu2B.js} +2 -2
  67. package/dist/_chunks/use-appointment-details-read-jGkJalX8.js +1966 -0
  68. package/dist/_chunks/{voice-control-panel-Be_c0CQ0.js → voice-control-panel-Cp4vs1iy.js} +2 -2
  69. package/dist/agent-catalog.json +282 -6
  70. package/dist/agent-i18n/en.json +26 -4
  71. package/dist/appointment-editor-panel/index.js +100 -0
  72. package/dist/booking-tools-data/index.js +82 -0
  73. package/dist/browser-support.js +1 -1
  74. package/dist/calendar-action-buttons/index.js +178 -0
  75. package/dist/components/ai-prompt-input/index.js +1 -1
  76. package/dist/components/ai-summary-panel/ai-summary-panel.d.ts +68 -5
  77. package/dist/components/ai-summary-panel/index.d.ts +1 -1
  78. package/dist/components/ai-summary-panel/index.js +1 -1
  79. package/dist/components/ai-summary-panel/summary-markdown.d.ts +15 -0
  80. package/dist/components/appointment-details-panel/index.js +6 -5
  81. package/dist/components/audio-recorder/index.js +1 -1
  82. package/dist/components/bill-line-table/index.js +1 -1
  83. package/dist/components/bill-table/index.js +1 -1
  84. package/dist/components/bishop-score/index.js +1 -1
  85. package/dist/components/booking/index.js +1 -1
  86. package/dist/components/call-status-chip/call-status-chip.d.ts +30 -0
  87. package/dist/components/call-status-chip/index.d.ts +3 -0
  88. package/dist/components/call-status-chip/index.js +5 -0
  89. package/dist/components/calls-panel/calls-panel.agent.d.ts +4 -0
  90. package/dist/components/calls-panel/calls-panel.d.ts +153 -0
  91. package/dist/components/calls-panel/index.d.ts +4 -0
  92. package/dist/components/calls-panel/index.js +6 -0
  93. package/dist/components/chat-input/chat-input.d.ts +17 -0
  94. package/dist/components/chat-input/index.js +1 -1
  95. package/dist/components/chat-message/index.js +1 -1
  96. package/dist/components/color-picker/index.js +5 -4
  97. package/dist/components/communications-panel/communications-panel.d.ts +15 -3
  98. package/dist/components/communications-panel/index.js +1 -1
  99. package/dist/components/data-grid/index.js +2 -2
  100. package/dist/components/data-table/index.js +2 -2
  101. package/dist/components/document-preview/index.js +1 -1
  102. package/dist/components/entity-summary/entity-summary.d.ts +29 -1
  103. package/dist/components/entity-summary/index.js +1 -1
  104. package/dist/components/file-manager/index.js +1 -1
  105. package/dist/components/fiscal-code-input/index.js +1 -1
  106. package/dist/components/gestational-age-calculator/index.js +1 -1
  107. package/dist/components/heatmap/index.js +1 -1
  108. package/dist/components/iban-input/index.js +1 -1
  109. package/dist/components/index.d.ts +2 -0
  110. package/dist/components/invoice-upload-list/index.js +1 -1
  111. package/dist/components/muscle-scheme/index.js +1 -1
  112. package/dist/components/notes-panel/index.js +1 -1
  113. package/dist/components/optical-prescription/index.js +1 -1
  114. package/dist/components/patient-details/index.js +1 -1
  115. package/dist/components/patient-summary-card/index.js +1 -1
  116. package/dist/components/patient-table/index.js +1 -1
  117. package/dist/components/pregnancy-dating/index.js +1 -1
  118. package/dist/components/rich-text-editor/index.js +2 -2
  119. package/dist/components/select/index.js +1 -1
  120. package/dist/components/select/select.d.ts +8 -0
  121. package/dist/components/session-countdown/index.js +1 -1
  122. package/dist/components/skeleton-scheme/index.js +1 -1
  123. package/dist/components/tabs/index.js +1 -1
  124. package/dist/components/task-editor/index.js +1 -1
  125. package/dist/components/tasks-panel/index.js +1 -1
  126. package/dist/components/unit-converter/index.js +1 -1
  127. package/dist/components/voice-control-panel/index.js +1 -1
  128. package/dist/core.css +1 -1
  129. package/dist/find-free-slots-panel/index.js +58 -0
  130. package/dist/host-compat.css +4 -1
  131. package/dist/i18n/locales/ar.d.ts +72 -3
  132. package/dist/i18n/locales/ar.js +74 -5
  133. package/dist/i18n/locales/de.d.ts +72 -3
  134. package/dist/i18n/locales/de.js +74 -5
  135. package/dist/i18n/locales/el.d.ts +72 -3
  136. package/dist/i18n/locales/el.js +74 -5
  137. package/dist/i18n/locales/en.d.ts +72 -3
  138. package/dist/i18n/locales/en.js +73 -4
  139. package/dist/i18n/locales/es.d.ts +72 -3
  140. package/dist/i18n/locales/es.js +74 -5
  141. package/dist/i18n/locales/fr.d.ts +72 -3
  142. package/dist/i18n/locales/fr.js +74 -5
  143. package/dist/i18n/locales/hi.d.ts +72 -3
  144. package/dist/i18n/locales/hi.js +74 -5
  145. package/dist/i18n/locales/it.d.ts +83 -14
  146. package/dist/i18n/locales/it.js +84 -15
  147. package/dist/i18n/locales/ja.d.ts +72 -3
  148. package/dist/i18n/locales/ja.js +74 -5
  149. package/dist/i18n/locales/nl.d.ts +72 -3
  150. package/dist/i18n/locales/nl.js +74 -5
  151. package/dist/i18n/locales/pl.d.ts +72 -3
  152. package/dist/i18n/locales/pl.js +74 -5
  153. package/dist/i18n/locales/pt.d.ts +72 -3
  154. package/dist/i18n/locales/pt.js +74 -5
  155. package/dist/i18n/locales/ro.d.ts +72 -3
  156. package/dist/i18n/locales/ro.js +74 -5
  157. package/dist/i18n/locales/ru.d.ts +72 -3
  158. package/dist/i18n/locales/ru.js +74 -5
  159. package/dist/i18n/locales/sq.d.ts +72 -3
  160. package/dist/i18n/locales/sq.js +74 -5
  161. package/dist/i18n/locales/sv.d.ts +72 -3
  162. package/dist/i18n/locales/sv.js +74 -5
  163. package/dist/i18n/locales/tr.d.ts +72 -3
  164. package/dist/i18n/locales/tr.js +74 -5
  165. package/dist/i18n/locales/zh.d.ts +72 -3
  166. package/dist/i18n/locales/zh.js +74 -5
  167. package/dist/index.js +1329 -1318
  168. package/dist/locales/ar.json +74 -5
  169. package/dist/locales/de.json +74 -5
  170. package/dist/locales/el.json +74 -5
  171. package/dist/locales/en.json +73 -4
  172. package/dist/locales/es.json +74 -5
  173. package/dist/locales/fr.json +74 -5
  174. package/dist/locales/hi.json +74 -5
  175. package/dist/locales/it.json +84 -15
  176. package/dist/locales/ja.json +74 -5
  177. package/dist/locales/nl.json +74 -5
  178. package/dist/locales/pl.json +74 -5
  179. package/dist/locales/pt.json +74 -5
  180. package/dist/locales/ro.json +74 -5
  181. package/dist/locales/ru.json +74 -5
  182. package/dist/locales/sq.json +74 -5
  183. package/dist/locales/sv.json +74 -5
  184. package/dist/locales/tr.json +74 -5
  185. package/dist/locales/zh.json +74 -5
  186. package/dist/online-bookings-panel/index.js +69 -0
  187. package/dist/patterns/alia-assistant/index.js +1 -1
  188. package/dist/patterns/anamnesis/index.js +1 -1
  189. package/dist/patterns/calendar/booking-tools/appointment-editor-panel.d.ts +46 -0
  190. package/dist/patterns/calendar/booking-tools/booking-tools-data.d.ts +48 -0
  191. package/dist/patterns/calendar/booking-tools/calendar-action-buttons.d.ts +55 -0
  192. package/dist/patterns/calendar/booking-tools/find-free-slots-panel.d.ts +35 -0
  193. package/dist/patterns/calendar/booking-tools/online-bookings-panel.d.ts +61 -0
  194. package/dist/patterns/calendar/booking-tools/waiting-list-panel.d.ts +58 -0
  195. package/dist/patterns/calendar/calendar-editor-discard-host.d.ts +20 -0
  196. package/dist/patterns/calendar/calendar-print-sheet.d.ts +16 -0
  197. package/dist/patterns/calendar/calendar-workspace.model.d.ts +7 -0
  198. package/dist/patterns/calendar/calendar.model.d.ts +9 -0
  199. package/dist/patterns/calendar/calendar.sheets.d.ts +59 -17
  200. package/dist/patterns/calendar/index.js +24 -20
  201. package/dist/patterns/patient-account-settings/index.js +1 -1
  202. package/dist/patterns/patient-check-in/index.js +1 -1
  203. package/dist/patterns/patient-portal/index.js +2 -2
  204. package/dist/patterns/patient-sign-in/index.js +2 -2
  205. package/dist/patterns/registration-form/index.js +1 -1
  206. package/dist/patterns/signature-request/index.js +1 -1
  207. package/dist/tokens.css +1 -1
  208. package/dist/waiting-list-panel/index.js +158 -0
  209. package/package.json +35 -2
  210. package/dist/_chunks/ai-summary-panel-B70S2lgC.js +0 -455
  211. package/dist/_chunks/calendar-appointment-editor-dialog-I5PfWudy.js +0 -13773
  212. package/dist/_chunks/color-picker-AcaWuKah.js +0 -745
  213. package/dist/_chunks/communications-panel-BKPHCiMB.js +0 -973
  214. package/dist/_chunks/entity-summary-CpNk6ybN.js +0 -266
  215. package/dist/_chunks/task-editor-DvwqPfFR.js +0 -1257
  216. package/dist/_chunks/use-appointment-details-read-6_OmOwUs.js +0 -2476
@@ -0,0 +1,1093 @@
1
+ import { jsxs as b, jsx as n, Fragment as Ee } from "react/jsx-runtime";
2
+ import { useState as K, useRef as k, useEffect as He, forwardRef as Nt, useId as Rt, useMemo as Ae } from "react";
3
+ import { c as ft } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as At } from "react-i18next";
5
+ import { A as T } from "./alert-C4WKViaS.js";
6
+ import { B as We } from "./button-DohK_Ak_.js";
7
+ import { I as Ke } from "./icon-button-S8_weU3g.js";
8
+ import { C as Bt } from "./combobox-BBCVQS-S.js";
9
+ import { D as J } from "./dialog-CVTxyR0v.js";
10
+ import { D as Ft } from "./date-picker-BmVBVpVu.js";
11
+ import { F } from "./form-field-CyHfOVKF.js";
12
+ import { I as Pt } from "./icon-button-group-SmkdVCNx.js";
13
+ import { P as Ot } from "./panel-header-CbtlTe85.js";
14
+ import { P as xt } from "./panel-subview-DCyvn-49.js";
15
+ import { R as Be } from "./radio-BZQs6_36.js";
16
+ import { R as jt } from "./radio-group-ChIKyeSJ.js";
17
+ import { S as $t } from "./scroll-area-CY5SLYNw.js";
18
+ import { S as Le } from "./select-CIXKyUMw.js";
19
+ import { S as ze } from "./skeleton-tTWJpvAq.js";
20
+ import { S as Mt } from "./switch-DO6uC4HJ.js";
21
+ import { T as qt } from "./text-area-COMVJ1yE.js";
22
+ import { T as Fe } from "./text-input-B6iAgCr3.js";
23
+ import { T as _t } from "./time-picker-DDr5vhwQ.js";
24
+ import { u as Vt } from "./registry-DvAUVLHh.js";
25
+ import { u as Ut } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
26
+ import { c as Wt } from "./compose-refs-C0k0tdqF.js";
27
+ import { E as Kt, a as Lt } from "./compact-editor-fields-cP6yh7xv.js";
28
+ import { P as zt, S as Gt } from "./patient-picker-BZJuOgMw.js";
29
+ import { b as Ht } from "./privacy-mask-C2ZLKrMh.js";
30
+ import { g as Pe } from "./get-error-message-DbFUzuja.js";
31
+ import { h as Yt } from "./handled-rejection-C-6Dq0As.js";
32
+ import { L as Xt } from "./lock-ClAFG1gy.js";
33
+ import { X as Jt } from "./x-B5YnXwCz.js";
34
+ import { C as Qt } from "./circle-off-DuT9pVy2.js";
35
+ import { U as Zt } from "./user-B12p7bVF.js";
36
+ import { B as en } from "./building-2-D33bLCWL.js";
37
+ import { S as tn } from "./stethoscope-sZXGC43m.js";
38
+ import { T as st } from "./trash-2-uumy3fy1.js";
39
+ import { S as dt } from "./square-check-big-dj0o8yA3.js";
40
+ import { p as nn } from "./privacy-mask-text-B8YfzB7L.js";
41
+ import { L as on } from "./loader-circle-BECIU_8N.js";
42
+ const rn = {
43
+ id: "task-editor",
44
+ // set_value backs set_fields and set_done; submit backs save; dismiss
45
+ // backs cancel.
46
+ capabilities: ["set_value", "submit", "dismiss"],
47
+ state: {
48
+ status: {
49
+ type: "'loading' | 'ready' | 'error' | 'locked' | 'withheld'",
50
+ descriptionKey: "ui.agent.taskEditor.state.status",
51
+ description: "Where the form is: loading the task, ready, failed to load, locked (edit mode with nothing to load) or withheld behind the privacy notice. Writes need 'ready'.",
52
+ read: (r) => r.getStatus()
53
+ },
54
+ draft: {
55
+ type: "{ mode: string; dateIso: string | null; about: string; patientId: string | null; companyId: string | null; operatorId: string | null; typeId: string | null; assigneeId: string | null; done: boolean; hasNote: boolean; noteLength: number }",
56
+ descriptionKey: "ui.agent.taskEditor.state.draft",
57
+ description: "The draft as Save would send it: ids and structure only, never the note body. done is the last value the host confirmed.",
58
+ read: (r) => r.getDraft()
59
+ },
60
+ canSave: {
61
+ type: "boolean",
62
+ descriptionKey: "ui.agent.taskEditor.state.canSave",
63
+ description: "Whether save would reach the host now: the form is ready, the note is filled, a chosen counterpart has an id and no write is pending.",
64
+ read: (r) => r.canSave()
65
+ }
66
+ },
67
+ actions: {
68
+ set_fields: {
69
+ safety: "phi",
70
+ argsType: "{ dateIso?: string; note?: string; typeId?: string; assigneeId?: string | null; about?: 'nobody' | 'patient' | 'company' | 'operator'; patientId?: string; companyId?: string; operatorId?: string }",
71
+ argsSchema: {
72
+ type: "object",
73
+ properties: {
74
+ dateIso: { type: "string", format: "date-time" },
75
+ note: { type: "string" },
76
+ typeId: { type: "string" },
77
+ assigneeId: { type: ["string", "null"] },
78
+ about: {
79
+ type: "string",
80
+ enum: ["nobody", "patient", "company", "operator"]
81
+ },
82
+ patientId: { type: "string" },
83
+ companyId: { type: "string" },
84
+ operatorId: { type: "string" }
85
+ }
86
+ },
87
+ idempotent: !0,
88
+ errors: [
89
+ "An id the host lists, its patient search or the stored task do not resolve.",
90
+ "More than one of patientId, companyId and operatorId.",
91
+ "The form is not ready, is read-only or is withheld."
92
+ ],
93
+ descriptionKey: "ui.agent.taskEditor.actions.setFields",
94
+ description: "Set draft fields. Ids must come from the host lists, a patient the host search returned, or equal the stored one. At most one counterpart per call, and it selects its branch; assigneeId null is nobody. Nothing is saved.",
95
+ invoke: (r, u) => {
96
+ r.setFields(u);
97
+ }
98
+ },
99
+ save: {
100
+ safety: "phi",
101
+ // Reaches the host's data source; the result is the host's promise.
102
+ openWorld: !0,
103
+ descriptionKey: "ui.agent.taskEditor.actions.save",
104
+ description: "Save the task through the host. Resolves once the write lands and rejects with the host error, which the form also shows.",
105
+ invoke: (r) => r.save()
106
+ },
107
+ set_done: {
108
+ safety: "write",
109
+ argsType: "{ done: boolean }",
110
+ argsSchema: {
111
+ type: "object",
112
+ properties: { done: { type: "boolean" } },
113
+ required: ["done"]
114
+ },
115
+ openWorld: !0,
116
+ errors: [
117
+ "The form is not ready, is read-only or has no Done seam.",
118
+ "A save, a delete or another Done change is in flight.",
119
+ "The task was already saved or deleted in this session."
120
+ ],
121
+ descriptionKey: "ui.agent.taskEditor.actions.setDone",
122
+ description: "Mark an existing task done or not done through the host. A rejection rolls the switch back.",
123
+ invoke: (r, u) => r.setDone(u.done)
124
+ },
125
+ delete: {
126
+ safety: "destructive",
127
+ idempotent: !0,
128
+ openWorld: !0,
129
+ descriptionKey: "ui.agent.taskEditor.actions.delete",
130
+ description: "Delete the task through the host, without the confirmation dialog. Resolves once the delete lands.",
131
+ invoke: (r) => r.deleteTask()
132
+ },
133
+ cancel: {
134
+ safety: "destructive",
135
+ errors: ["A save or delete is in flight: wait for it to settle."],
136
+ descriptionKey: "ui.agent.taskEditor.actions.cancel",
137
+ description: "Close the editor without saving. Anything typed since the last save is lost. Refused while a save or delete is in flight.",
138
+ invoke: (r) => {
139
+ r.cancel();
140
+ }
141
+ }
142
+ },
143
+ domHooks: {
144
+ root: {
145
+ attr: "data-component",
146
+ value: "task-editor",
147
+ description: "Marks the TaskEditor body. It also carries data-variant and data-status. In the subview variant it sits inside the panel-subview section, which repeats data-component-id, data-variant and data-status and holds the heading and footer."
148
+ },
149
+ instanceId: {
150
+ attr: "data-component-id",
151
+ sourceProp: "id",
152
+ description: "Sourced from the id prop, or generated. Addresses one editor from the agent. [data-component-id] reaches the footer actions in both variants."
153
+ }
154
+ }
155
+ }, N = "none", lt = {
156
+ showError: !1,
157
+ saving: !1,
158
+ saveError: void 0,
159
+ done: !1,
160
+ confirmedDone: !1,
161
+ donePending: !1,
162
+ doneError: void 0,
163
+ deleting: !1,
164
+ deleteError: void 0,
165
+ confirmDeleteOpen: !1,
166
+ accepted: !1
167
+ };
168
+ function an(r) {
169
+ return r.patientId ? "patient" : r.companyId ? "company" : r.operatorId ? "operator" : "nobody";
170
+ }
171
+ function Ye(r) {
172
+ return { hours: r.getHours(), minutes: r.getMinutes() };
173
+ }
174
+ function ct(r) {
175
+ const u = r ?? /* @__PURE__ */ new Date();
176
+ return {
177
+ date: u,
178
+ time: Ye(u),
179
+ note: "",
180
+ operatorId: N,
181
+ typeId: "",
182
+ assigneeId: N,
183
+ about: "nobody",
184
+ patientId: "",
185
+ companyId: ""
186
+ };
187
+ }
188
+ function sn(r) {
189
+ const u = new Date(r.dateIso);
190
+ return {
191
+ date: u,
192
+ time: Ye(u),
193
+ note: r.note,
194
+ /* `||`, not `??`: a host's '' is unset, like patient and company. */
195
+ operatorId: r.operatorId || N,
196
+ /* A stored type wins. With none, '' falls through to the first entry. */
197
+ typeId: r.typeId ?? "",
198
+ /* `||` too: '' would become a Select option with an empty value. */
199
+ assigneeId: r.assigneeId || N,
200
+ about: an(r),
201
+ patientId: r.patientId ?? "",
202
+ companyId: r.companyId ?? ""
203
+ };
204
+ }
205
+ const dn = [
206
+ ["patientId", "patient"],
207
+ ["companyId", "company"],
208
+ ["operatorId", "operator"]
209
+ ];
210
+ function ln({
211
+ mode: r,
212
+ taskId: u,
213
+ initialDate: C,
214
+ active: P,
215
+ taskTypes: M,
216
+ assignees: j,
217
+ companies: Oe,
218
+ operators: L,
219
+ patients: oe,
220
+ searchedPatients: Q,
221
+ resolvePatientLabel: z,
222
+ loadTask: G,
223
+ onCreateTask: H,
224
+ onUpdateTask: re,
225
+ onDeleteTask: Y,
226
+ onSetTaskDone: ae,
227
+ onSaved: q,
228
+ onDeleted: he,
229
+ readOnly: _,
230
+ withheld: Se,
231
+ maskPatient: xe,
232
+ fallbackError: ie
233
+ }) {
234
+ var be;
235
+ const $ = r === "edit", [ge, je] = K(0), [$e, Z] = K(P);
236
+ $e !== P && (Z(P), P && je((e) => e + 1));
237
+ const R = `${r}|${u ?? ""}|${ge}`, [p, se] = K(
238
+ () => ct(C)
239
+ ), [O, ve] = K(lt), [v, o] = K(), y = (e) => ve((i) => ({ ...i, ...e })), de = (e) => se((i) => ({ ...i, ...e })), [le, V] = K(R);
240
+ le !== R && (V(R), se(ct(C)), ve(lt), o(void 0));
241
+ const S = k({
242
+ subject: R,
243
+ saving: !1,
244
+ deleting: !1,
245
+ donePending: !1,
246
+ accepted: !1
247
+ });
248
+ S.current.subject !== R && (S.current = {
249
+ subject: R,
250
+ saving: !1,
251
+ deleting: !1,
252
+ donePending: !1,
253
+ accepted: !1
254
+ });
255
+ const ce = k(!0);
256
+ He(() => (ce.current = !0, () => {
257
+ ce.current = !1;
258
+ }), []);
259
+ const w = (e) => ce.current && S.current === e, ee = k(G);
260
+ ee.current = G;
261
+ const d = !!G, [E, l] = K(0), [s, m] = K(null), ye = k(s);
262
+ ye.current = s;
263
+ const ue = P && $ && !!u && d && !Se;
264
+ He(() => {
265
+ const e = ee.current;
266
+ if (!ue || !u || !e) return;
267
+ const i = S.current, f = ye.current;
268
+ if ((f == null ? void 0 : f.subject) === i.subject && f.status === "ready")
269
+ return;
270
+ const c = new AbortController();
271
+ return Promise.resolve().then(
272
+ () => (
273
+ /* Cleaned up before this ran (StrictMode's replay, a quick re-run):
274
+ never call the host with a signal already aborted. */
275
+ c.signal.aborted ? Promise.reject(c.signal.reason) : e(u, { signal: c.signal })
276
+ )
277
+ ).then(
278
+ (h) => {
279
+ c.signal.aborted || !w(i) || (se(sn(h)), y({ done: h.done, confirmedDone: h.done }), o(h), m({ subject: i.subject, status: "ready" }));
280
+ },
281
+ (h) => {
282
+ c.signal.aborted || !w(i) || m({
283
+ subject: i.subject,
284
+ status: "error",
285
+ message: Pe(h, ie)
286
+ });
287
+ }
288
+ ), () => c.abort();
289
+ }, [ue, R, E]);
290
+ const D = $ ? !u || !d ? "locked" : Se ? "withheld" : (s == null ? void 0 : s.subject) === R ? s.status : "loading" : "ready", x = () => {
291
+ D === "error" && (m(null), l((e) => e + 1));
292
+ }, te = p.typeId || (((be = M[0]) == null ? void 0 : be.id) ?? ""), Me = p.about === "nobody" || p.about === "patient" && p.patientId !== "" || p.about === "company" && p.companyId !== "" || p.about === "operator" && p.operatorId !== N, ne = !_ && p.note.trim() !== "" && p.date !== void 0 && Me && /* Required whenever the host offers a list. */
293
+ (M.length === 0 || te !== "") && !O.saving && !O.donePending, pe = $ ? re : H, Ie = () => {
294
+ const { date: e, time: i } = p;
295
+ return e ? {
296
+ dateIso: new Date(
297
+ e.getFullYear(),
298
+ e.getMonth(),
299
+ e.getDate(),
300
+ i.hours,
301
+ i.minutes,
302
+ 0,
303
+ 0
304
+ ).toISOString(),
305
+ note: p.note.trim(),
306
+ /* Sent whatever the host's list says, including a value the list no
307
+ longer resolves: a real link must survive a Save that never
308
+ offered to change it. */
309
+ typeId: te === "" ? void 0 : te,
310
+ assigneeId: p.assigneeId === N ? void 0 : p.assigneeId,
311
+ /* ONE counterpart, decided by `about` alone: the platform refuses a
312
+ task carrying two. Never gated on a list being loaded, or a list
313
+ that empties mid-edit would unlink the task on Save. */
314
+ patientId: p.about === "patient" && p.patientId ? p.patientId : void 0,
315
+ companyId: p.about === "company" && p.companyId ? p.companyId : void 0,
316
+ operatorId: p.about === "operator" && p.operatorId !== N ? p.operatorId : void 0,
317
+ /* The last CONFIRMED value only, never an optimistic or rolled-back
318
+ toggle. */
319
+ done: O.confirmedDone
320
+ } : void 0;
321
+ }, I = (e) => Yt(new Error(`TaskEditor: ${e}`)), Ce = () => {
322
+ const e = S.current;
323
+ if (D !== "ready") return I(`cannot save while ${D}.`);
324
+ if (!pe) return I("the host gave no save seam.");
325
+ if (e.accepted) return I("this task was already saved.");
326
+ if (e.deleting) return I("a delete is in flight.");
327
+ if (e.saving || !ne) return I("the task cannot be saved.");
328
+ const i = Ie();
329
+ if (!i)
330
+ return y({ showError: !0 }), I("the task has no date.");
331
+ const f = u;
332
+ e.saving = !0, y({ saving: !0, saveError: void 0 });
333
+ const c = (async () => {
334
+ try {
335
+ if ($)
336
+ await (re == null ? void 0 : re(f, i)), e.accepted = !0, w(e) && (y({ accepted: !0 }), q == null || q({
337
+ ...i,
338
+ id: f,
339
+ done: i.done ?? !1
340
+ }));
341
+ else {
342
+ const h = await (H == null ? void 0 : H(i));
343
+ e.accepted = !0, w(e) && (y({ accepted: !0 }), h && (q == null || q(h)));
344
+ }
345
+ } catch (h) {
346
+ throw w(e) && y({ saveError: Pe(h, ie) }), h;
347
+ } finally {
348
+ e.saving = !1, w(e) && y({ saving: !1 });
349
+ }
350
+ })();
351
+ return c.catch(() => {
352
+ }), c;
353
+ }, De = (e) => {
354
+ const i = S.current;
355
+ if (D !== "ready")
356
+ return I(`cannot change Done while ${D}.`);
357
+ if (!$ || !u || !ae || _)
358
+ return I("the host gave no Done seam.");
359
+ if (i.donePending) return I("a Done change is already pending.");
360
+ if (i.saving || i.deleting)
361
+ return I("a save or delete is in flight.");
362
+ if (i.accepted)
363
+ return I("this task was already saved or deleted.");
364
+ if (e === O.done) return Promise.resolve();
365
+ const f = O.confirmedDone, c = u;
366
+ i.donePending = !0, y({ done: e, donePending: !0, doneError: void 0 });
367
+ const h = (async () => {
368
+ try {
369
+ await ae(c, e), w(i) && y({ confirmedDone: e });
370
+ } catch (A) {
371
+ throw w(i) && y({
372
+ done: f,
373
+ doneError: Pe(A, ie)
374
+ }), A;
375
+ } finally {
376
+ i.donePending = !1, w(i) && y({ donePending: !1 });
377
+ }
378
+ })();
379
+ return h.catch(() => {
380
+ }), h;
381
+ }, Te = () => {
382
+ const e = S.current;
383
+ if (D !== "ready") return I(`cannot delete while ${D}.`);
384
+ if (!$ || !u || !Y || _)
385
+ return I("the host gave no delete seam.");
386
+ if (e.saving || e.accepted || e.deleting)
387
+ return I("the task cannot be deleted now.");
388
+ const i = u;
389
+ e.deleting = !0, y({ deleting: !0, deleteError: void 0 });
390
+ const f = (async () => {
391
+ try {
392
+ await Y(i), e.accepted = !0, w(e) && (y({ accepted: !0, confirmDeleteOpen: !1 }), he == null || he(i));
393
+ } catch (c) {
394
+ throw w(e) && y({ deleteError: Pe(c, ie) }), c;
395
+ } finally {
396
+ e.deleting = !1, w(e) && y({ deleting: !1 });
397
+ }
398
+ })();
399
+ return f.catch(() => {
400
+ }), f;
401
+ }, X = (e, i, f) => (
402
+ /* '' is never an id, even when the stored record holds one. */
403
+ i !== "" && (i === f || e.some((c) => c.id === i))
404
+ ), me = (e) => {
405
+ var h;
406
+ if (D !== "ready")
407
+ throw new Error(`TaskEditor: cannot set fields while ${D}.`);
408
+ if (_) throw new Error("TaskEditor: the task is read-only.");
409
+ const i = dn.filter(([A]) => e[A] !== void 0);
410
+ if (i.length > 1)
411
+ throw new Error(
412
+ "TaskEditor: set at most one of patientId, companyId and operatorId."
413
+ );
414
+ const f = (h = i[0]) == null ? void 0 : h[1];
415
+ if (e.about !== void 0 && f && e.about !== f)
416
+ throw new Error(
417
+ `TaskEditor: about "${e.about}" does not match the ${f} id.`
418
+ );
419
+ if (e.typeId !== void 0 && !X(M, e.typeId, v == null ? void 0 : v.typeId))
420
+ throw new Error(`TaskEditor: unknown typeId "${e.typeId}".`);
421
+ if (e.assigneeId !== void 0 && e.assigneeId !== null && !X(j, e.assigneeId, v == null ? void 0 : v.assigneeId))
422
+ throw new Error(`TaskEditor: unknown assigneeId "${e.assigneeId}".`);
423
+ if (e.companyId !== void 0 && !X(Oe, e.companyId, v == null ? void 0 : v.companyId))
424
+ throw new Error(`TaskEditor: unknown companyId "${e.companyId}".`);
425
+ if (e.operatorId !== void 0 && !X(L, e.operatorId, v == null ? void 0 : v.operatorId))
426
+ throw new Error(`TaskEditor: unknown operatorId "${e.operatorId}".`);
427
+ if (e.patientId !== void 0) {
428
+ if (xe)
429
+ throw new Error("TaskEditor: no patient can be set in privacy mode.");
430
+ if (!(X(oe, e.patientId, v == null ? void 0 : v.patientId) || Q.has(e.patientId) || (z == null ? void 0 : z(e.patientId)) !== void 0))
431
+ throw new Error(`TaskEditor: unknown patientId "${e.patientId}".`);
432
+ }
433
+ const c = {};
434
+ if (e.dateIso !== void 0) {
435
+ const A = new Date(e.dateIso);
436
+ if (Number.isNaN(A.getTime()))
437
+ throw new Error(`TaskEditor: "${e.dateIso}" is not a date.`);
438
+ c.date = A, c.time = Ye(A);
439
+ }
440
+ e.note !== void 0 && (c.note = e.note), e.typeId !== void 0 && (c.typeId = e.typeId), e.assigneeId !== void 0 && (c.assigneeId = e.assigneeId ?? N), e.about !== void 0 && (c.about = e.about), e.patientId !== void 0 && (c.patientId = e.patientId, c.about = "patient"), e.companyId !== void 0 && (c.companyId = e.companyId, c.about = "company"), e.operatorId !== void 0 && (c.operatorId = e.operatorId, c.about = "operator"), de(c);
441
+ }, Ne = () => {
442
+ const e = Ie();
443
+ return {
444
+ mode: r,
445
+ dateIso: (e == null ? void 0 : e.dateIso) ?? null,
446
+ about: p.about,
447
+ patientId: (e == null ? void 0 : e.patientId) ?? null,
448
+ companyId: (e == null ? void 0 : e.companyId) ?? null,
449
+ operatorId: (e == null ? void 0 : e.operatorId) ?? null,
450
+ typeId: (e == null ? void 0 : e.typeId) ?? null,
451
+ assigneeId: (e == null ? void 0 : e.assigneeId) ?? null,
452
+ done: O.confirmedDone,
453
+ hasNote: p.note.trim() !== "",
454
+ noteLength: p.note.trim().length
455
+ };
456
+ };
457
+ return {
458
+ status: D,
459
+ loadError: (s == null ? void 0 : s.subject) === R ? s.message : void 0,
460
+ retry: x,
461
+ fields: p,
462
+ patchFields: de,
463
+ stored: v,
464
+ chosenTypeId: te,
465
+ canSave: ne,
466
+ /** What the agent's `canSave` reports: the button's rule plus the
467
+ * status, the seam and a save that has not landed yet. */
468
+ agentCanSave: D === "ready" && !!pe && ne && !O.accepted,
469
+ showSave: !_ && !!pe,
470
+ showDelete: $ && !_ && !!Y && !!u,
471
+ showDone: $ && !_ && !!ae,
472
+ ui: O,
473
+ patchUi: y,
474
+ /** True once a save or delete landed in this session. */
475
+ isAccepted: () => S.current.accepted,
476
+ /** A save or delete is in flight: closing now would lose its outcome. */
477
+ isBusy: () => S.current.saving || S.current.deleting,
478
+ submit: Ce,
479
+ setDone: De,
480
+ remove: Te,
481
+ applyPatch: me,
482
+ draftState: Ne
483
+ };
484
+ }
485
+ const ut = ft("ds:flex ds:min-h-0 ds:flex-col", {
486
+ variants: {
487
+ /** The panel fills its box; the subview body sits in its scroll area. */
488
+ variant: {
489
+ /* Focusable from script only, as the subview section is: where focus
490
+ waits when a control takes itself away. */
491
+ panel: "ds:h-full ds:focus-visible:outline-none",
492
+ /* The states pad themselves, so the subview's ring inset is cancelled. */
493
+ subview: "ds:-m-[var(--panel-subview-inset)]"
494
+ }
495
+ },
496
+ defaultVariants: { variant: "panel" }
497
+ }), pt = ft(
498
+ `ds:m-0 ds:min-w-0 ds:border-0 ds:p-[var(--spacing-md)] ${Lt}`,
499
+ {
500
+ variants: {
501
+ /** 'form': the fields in a column. 'notice': the locked notice. */
502
+ layout: {
503
+ form: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
504
+ notice: "ds:flex-1"
505
+ }
506
+ },
507
+ defaultVariants: { layout: "form" }
508
+ }
509
+ ), a = (r) => `calendarWorkspace.taskEditor.${r}`, cn = (r, u, C) => C.includes(u) ? 1 : 0, ke = [], Ge = (r, u) => Array.from(r.querySelectorAll("[data-task-id]")).filter(
510
+ (C) => !u.contains(C)
511
+ ), un = 'button:not([disabled]), a[href], input:not([disabled]), [tabindex]:not([tabindex="-1"])', mt = (r, u) => {
512
+ if (!r) return [];
513
+ const C = Array.from(
514
+ r.querySelectorAll("[data-action]")
515
+ );
516
+ return [
517
+ ...C.filter((P) => u && P.dataset.action === u),
518
+ ...C.filter((P) => P.dataset.action === "open-task"),
519
+ ...Array.from(r.querySelectorAll(un))
520
+ ];
521
+ }, pn = Nt(
522
+ ({
523
+ id: r,
524
+ mode: u,
525
+ taskId: C,
526
+ initialDate: P,
527
+ variant: M = "panel",
528
+ open: j = !0,
529
+ onExited: Oe,
530
+ taskTypes: L = ke,
531
+ assignees: oe = ke,
532
+ companies: Q = ke,
533
+ operators: z = ke,
534
+ patients: G = ke,
535
+ searchPatients: H,
536
+ patientLabel: re,
537
+ resolvePatientLabel: Y,
538
+ companyLabel: ae,
539
+ operatorLabel: q,
540
+ backLabel: he,
541
+ loadTask: _,
542
+ onCreateTask: Se,
543
+ onUpdateTask: xe,
544
+ onDeleteTask: ie,
545
+ onSetTaskDone: $,
546
+ onCancel: ge,
547
+ onSaved: je,
548
+ onDeleted: $e,
549
+ readOnly: Z = !1,
550
+ privacy: R = !1,
551
+ privacyMode: p = "notice",
552
+ onPrivacyOff: se,
553
+ className: O,
554
+ ...ve
555
+ }, v) => {
556
+ const { t: o } = At("ui"), y = Rt(), de = r ?? y, le = u === "edit", V = M === "subview", S = !V || j, ce = R && le && p === "notice", w = R && !ce, [ee] = K(() => /* @__PURE__ */ new Map()), d = ln({
557
+ mode: u,
558
+ taskId: C,
559
+ initialDate: P,
560
+ active: S,
561
+ taskTypes: L,
562
+ assignees: oe,
563
+ companies: Q,
564
+ operators: z,
565
+ patients: G,
566
+ searchedPatients: ee,
567
+ resolvePatientLabel: Y,
568
+ loadTask: _,
569
+ onCreateTask: Se,
570
+ onUpdateTask: xe,
571
+ onDeleteTask: ie,
572
+ onSetTaskDone: $,
573
+ onSaved: je,
574
+ onDeleted: $e,
575
+ readOnly: Z,
576
+ withheld: ce,
577
+ maskPatient: w,
578
+ fallbackError: o("emptyState.error.title")
579
+ }), { status: E, fields: l, ui: s, stored: m } = d, ye = k(H);
580
+ ye.current = H;
581
+ const ue = !!H, D = Ae(
582
+ () => ue ? async (t, g) => {
583
+ const B = await ye.current(t, g);
584
+ for (const W of B)
585
+ ee.set(W.id, W.name);
586
+ return B;
587
+ } : void 0,
588
+ [ue, ee]
589
+ ), x = k(d);
590
+ x.current = d;
591
+ const te = k(ge);
592
+ te.current = ge;
593
+ const Me = Ae(
594
+ () => ({
595
+ getStatus: () => x.current.status,
596
+ getDraft: () => x.current.draftState(),
597
+ canSave: () => x.current.agentCanSave,
598
+ setFields: (t) => x.current.applyPatch(t),
599
+ save: () => x.current.submit(),
600
+ setDone: (t) => x.current.setDone(t),
601
+ deleteTask: () => x.current.remove(),
602
+ cancel: () => {
603
+ if (x.current.isBusy())
604
+ throw new Error("TaskEditor: a save or delete is in flight.");
605
+ te.current();
606
+ }
607
+ }),
608
+ []
609
+ );
610
+ Vt(rn, S ? Me : null, de);
611
+ const ne = k(null), pe = Ae(
612
+ () => Wt(v, ne),
613
+ [v]
614
+ ), Ie = k(null), I = k(null), Ce = k(!1);
615
+ V && j && !Ce.current && (I.current = typeof document < "u" && document.activeElement instanceof HTMLElement ? document.activeElement : null), Ce.current = V && j;
616
+ const De = k(j);
617
+ De.current = j;
618
+ const Te = k(C);
619
+ Te.current = le ? C : void 0, He(() => {
620
+ var it;
621
+ const t = ne.current, g = t == null ? void 0 : t.parentElement;
622
+ if (!V || !j || !t || !g) return;
623
+ const B = I.current, W = B && g.contains(B) && !t.contains(B) ? B : null, Dt = Te.current, we = (W == null ? void 0 : W.closest("[data-task-id]")) ?? Ge(g, t).find((Re) => Re.dataset.taskId === Dt), ot = we == null ? void 0 : we.dataset.taskId, rt = (it = W == null ? void 0 : W.closest("[data-action]")) == null ? void 0 : it.dataset.action, at = we ? Ge(g, t).indexOf(we) : -1;
624
+ return () => {
625
+ if (De.current && t.isConnected) return;
626
+ const Re = document.activeElement;
627
+ if (!g.isConnected || Re && Re !== document.body) return;
628
+ const Ue = Ge(g, t), Tt = [
629
+ ...mt(
630
+ Ue.find((fe) => ot !== void 0 && fe.dataset.taskId === ot),
631
+ rt
632
+ ),
633
+ /* The row that took its place, or the last row when it was last. */
634
+ ...at >= 0 ? mt(Ue[Math.min(at, Ue.length - 1)], rt) : [],
635
+ g.querySelector('[data-action="add-task"]'),
636
+ g.querySelector("[data-tasks-panel-region]")
637
+ ];
638
+ for (const fe of Tt)
639
+ if (!(!fe || t.contains(fe)) && (fe.focus(), document.activeElement === fe))
640
+ return;
641
+ };
642
+ }, [j, V]);
643
+ const X = k(null), me = k(!1), Ne = (t) => () => {
644
+ me.current = !0, t();
645
+ };
646
+ Ut(() => {
647
+ var B;
648
+ if (!me.current) return;
649
+ const t = ne.current, g = document.activeElement;
650
+ if (g && g !== document.body && g !== t) {
651
+ me.current = !1;
652
+ return;
653
+ }
654
+ E !== "loading" && (me.current = !1), (B = E === "error" ? X.current : t) == null || B.focus({
655
+ preventScroll: !0
656
+ });
657
+ }, [E]);
658
+ const be = o(a(le ? "editTitle" : "title")), e = Q.length > 0, i = z.length > 0, f = ue || G.length > 0, c = Ae(
659
+ () => Q.map((t) => ({ value: t.id, label: t.label })),
660
+ [Q]
661
+ ), h = (t) => {
662
+ var g;
663
+ return (Y == null ? void 0 : Y(t)) ?? ((g = G.find((B) => B.id === t)) == null ? void 0 : g.name) ?? ee.get(t) ?? (t === (m == null ? void 0 : m.patientId) ? re : void 0) ?? o("calendarWorkspace.details.patientNotLoaded");
664
+ }, A = (t) => t === (m == null ? void 0 : m.operatorId) && q ? q : o(a("operatorUnresolved"), { id: t }), ht = [
665
+ { value: N, label: o(a("operatorNone")) },
666
+ ...z.map((t) => ({ value: t.id, label: t.label })),
667
+ /* An operator the roster no longer lists is still a real link, so it
668
+ stays pickable and survives a Save. */
669
+ ...l.operatorId !== N && !z.some((t) => t.id === l.operatorId) ? [
670
+ {
671
+ value: l.operatorId,
672
+ label: A(l.operatorId)
673
+ }
674
+ ] : []
675
+ ], gt = L.some((t) => t.custom) && L.some((t) => !t.custom), vt = [
676
+ ...L.map((t) => ({
677
+ value: t.id,
678
+ label: t.label,
679
+ group: gt ? o(a(t.custom ? "typeGroupCustom" : "typeGroupStandard")) : void 0
680
+ })),
681
+ /* An id the list no longer resolves is still a real link: offered as
682
+ its own option so Save re-sends it. */
683
+ ...d.chosenTypeId && !L.some((t) => t.id === d.chosenTypeId) ? [
684
+ {
685
+ value: d.chosenTypeId,
686
+ label: o(a("typeUnresolved"), { id: d.chosenTypeId })
687
+ }
688
+ ] : []
689
+ ], yt = [
690
+ { value: N, label: o(a("assigneeNone")) },
691
+ ...oe.map((t) => ({ value: t.id, label: t.label })),
692
+ ...l.assigneeId !== N && !oe.some((t) => t.id === l.assigneeId) ? [
693
+ {
694
+ value: l.assigneeId,
695
+ label: o(a("assigneeUnresolved"), { id: l.assigneeId })
696
+ }
697
+ ] : []
698
+ ], U = l.about === "company" && l.companyId && !Q.some((t) => t.id === l.companyId) ? l.companyId : void 0, It = U && U === (m == null ? void 0 : m.companyId) && ae ? ae : o(a("companyUnresolved"), { id: U }), Xe = /* @__PURE__ */ b(T, { variant: "info", announce: "off", icon: /* @__PURE__ */ n(Xt, { "aria-hidden": "true" }), children: [
699
+ /* @__PURE__ */ n(T.Title, { as: "p", children: o("calendarWorkspace.details.readOnlyTitle") }),
700
+ /* @__PURE__ */ n(T.Description, { children: o(a("readOnlyBody")) })
701
+ ] }), qe = s.saving || s.deleting, Je = () => {
702
+ d.isBusy() || ge();
703
+ }, bt = /* @__PURE__ */ n(
704
+ Ke,
705
+ {
706
+ size: "sm",
707
+ intent: "outline",
708
+ icon: /* @__PURE__ */ n(Jt, { "aria-hidden": "true" }),
709
+ "aria-label": o(a("cancel")),
710
+ tooltip: o(a("cancel")),
711
+ "data-action": "cancel-task",
712
+ disabled: qe,
713
+ onClick: Je
714
+ }
715
+ ), _e = s.saving || s.accepted, Qe = (t) => /* @__PURE__ */ b(Ee, { children: [
716
+ t && d.showDelete ? /* @__PURE__ */ n(
717
+ Ke,
718
+ {
719
+ ref: Ie,
720
+ size: "sm",
721
+ intent: "destructiveOutline",
722
+ icon: /* @__PURE__ */ n(st, { "aria-hidden": "true" }),
723
+ "aria-label": o(a("delete")),
724
+ tooltip: o(a("delete")),
725
+ "data-action": "delete-task",
726
+ disabled: qe || s.accepted,
727
+ onClick: () => d.patchUi({ confirmDeleteOpen: !0, deleteError: void 0 })
728
+ }
729
+ ) : null,
730
+ /* @__PURE__ */ b(
731
+ Pt,
732
+ {
733
+ role: "toolbar",
734
+ "aria-label": o(a("actionsLabel")),
735
+ className: "ds:ms-auto",
736
+ children: [
737
+ bt,
738
+ t && d.showSave ? /* @__PURE__ */ n(
739
+ Ke,
740
+ {
741
+ size: "sm",
742
+ intent: "primary",
743
+ icon: s.saving ? /* @__PURE__ */ n(
744
+ on,
745
+ {
746
+ "aria-hidden": "true",
747
+ className: "ds:animate-spin ds:motion-reduce:animate-none"
748
+ }
749
+ ) : /* @__PURE__ */ n(Gt, { "aria-hidden": "true" }),
750
+ "aria-label": o(a("save")),
751
+ tooltip: o(a("save")),
752
+ disabled: !_e && !d.canSave,
753
+ "aria-disabled": _e || void 0,
754
+ "aria-busy": s.saving || void 0,
755
+ "data-action": "save-task",
756
+ onClick: () => {
757
+ _e || d.submit();
758
+ }
759
+ }
760
+ ) : null
761
+ ]
762
+ }
763
+ ),
764
+ t && d.showSave ? (
765
+ /* Out of flow, so it never moves the footer's two ends. */
766
+ /* @__PURE__ */ n("span", { role: "status", className: "ds:sr-only", children: s.saving ? o(a("saving")) : "" })
767
+ ) : null
768
+ ] }), wt = /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
769
+ /* @__PURE__ */ n("span", { role: "status", className: "ds:sr-only", children: o("common.loading") }),
770
+ /* @__PURE__ */ b(
771
+ "div",
772
+ {
773
+ "aria-hidden": "true",
774
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
775
+ children: [
776
+ /* @__PURE__ */ n(
777
+ ze,
778
+ {
779
+ variant: "rounded",
780
+ height: "calc(var(--spacing-xl) + var(--spacing-sm))"
781
+ }
782
+ ),
783
+ /* @__PURE__ */ n(
784
+ ze,
785
+ {
786
+ variant: "rounded",
787
+ height: "calc(var(--spacing-xl) * 3)",
788
+ stagger: 1
789
+ }
790
+ ),
791
+ /* @__PURE__ */ n(
792
+ ze,
793
+ {
794
+ variant: "rounded",
795
+ height: "calc(var(--spacing-xl) + var(--spacing-sm))",
796
+ stagger: 2
797
+ }
798
+ )
799
+ ]
800
+ }
801
+ )
802
+ ] }), Et = /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
803
+ /* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: d.loadError }) }),
804
+ /* @__PURE__ */ n(
805
+ We,
806
+ {
807
+ ref: X,
808
+ intent: "outline",
809
+ "data-action": "retry-load",
810
+ onClick: Ne(d.retry),
811
+ children: o("emptyState.error.cta")
812
+ }
813
+ )
814
+ ] }), kt = /* @__PURE__ */ n("fieldset", { disabled: !0, className: pt({ layout: "notice" }), children: Xe }), St = () => l.about !== "patient" ? null : w ? /* @__PURE__ */ n(F, { label: o(a("aboutPatient")), children: /* @__PURE__ */ n(Fe, { value: nn(), disabled: !0, readOnly: !0 }) }) : f ? /* @__PURE__ */ n(F, { label: o(a("aboutPatient")), children: /* @__PURE__ */ n(
815
+ zt,
816
+ {
817
+ value: l.patientId,
818
+ onValueChange: (t) => d.patchFields({ patientId: t }),
819
+ patients: G,
820
+ searchPatients: D,
821
+ selectedLabel: l.patientId ? h(l.patientId) : void 0,
822
+ placeholder: o("calendarWorkspace.editor.patientSearch"),
823
+ disabled: Z
824
+ }
825
+ ) }) : l.patientId ? /* @__PURE__ */ n(F, { label: o(a("aboutPatient")), children: /* @__PURE__ */ n(Fe, { value: h(l.patientId), disabled: !0, readOnly: !0 }) }) : null, Ze = /* @__PURE__ */ b("fieldset", { disabled: Z, className: pt(), children: [
826
+ Z ? Xe : null,
827
+ /* @__PURE__ */ n(F, { label: o(a("date")), children: /* @__PURE__ */ n(
828
+ Ft,
829
+ {
830
+ value: l.date,
831
+ onChange: (t) => d.patchFields({ date: t })
832
+ }
833
+ ) }),
834
+ /* @__PURE__ */ n(F, { label: o(a("time")), children: /* @__PURE__ */ n(
835
+ _t,
836
+ {
837
+ value: l.time,
838
+ onChange: (t) => d.patchFields({ time: t })
839
+ }
840
+ ) }),
841
+ /* @__PURE__ */ n(
842
+ F,
843
+ {
844
+ label: o(a("note")),
845
+ required: !0,
846
+ error: s.showError && l.note.trim() === "" ? o(a("noteRequired")) : void 0,
847
+ children: /* @__PURE__ */ n(
848
+ qt,
849
+ {
850
+ value: l.note,
851
+ onChange: (t) => {
852
+ d.patchFields({ note: t.target.value }), d.patchUi({ showError: !1 });
853
+ },
854
+ minRows: 3,
855
+ autoResize: !0
856
+ }
857
+ )
858
+ }
859
+ ),
860
+ L.length > 0 ? /* @__PURE__ */ n(F, { label: o(a("type")), required: !0, children: /* @__PURE__ */ n(
861
+ Le,
862
+ {
863
+ options: vt,
864
+ value: d.chosenTypeId,
865
+ onValueChange: (t) => t && d.patchFields({ typeId: t })
866
+ }
867
+ ) }) : null,
868
+ oe.length > 0 ? /* @__PURE__ */ n(F, { label: o(a("assignee")), children: /* @__PURE__ */ n(
869
+ Le,
870
+ {
871
+ options: yt,
872
+ value: l.assigneeId,
873
+ onValueChange: (t) => t && d.patchFields({ assigneeId: t })
874
+ }
875
+ ) }) : null,
876
+ /* @__PURE__ */ b(
877
+ jt,
878
+ {
879
+ label: o(a("about")),
880
+ variant: "segmented",
881
+ className: Kt,
882
+ value: l.about,
883
+ onValueChange: (t) => d.patchFields({ about: t }),
884
+ children: [
885
+ /* @__PURE__ */ n(
886
+ Be,
887
+ {
888
+ value: "nobody",
889
+ label: o(a("aboutNobody")),
890
+ icon: /* @__PURE__ */ n(Qt, { "aria-hidden": "true" })
891
+ }
892
+ ),
893
+ f || l.about === "patient" || m != null && m.patientId ? /* @__PURE__ */ n(
894
+ Be,
895
+ {
896
+ value: "patient",
897
+ label: o(a("aboutPatient")),
898
+ icon: /* @__PURE__ */ n(Zt, { "aria-hidden": "true" })
899
+ }
900
+ ) : null,
901
+ e || l.about === "company" || m != null && m.companyId ? /* @__PURE__ */ n(
902
+ Be,
903
+ {
904
+ value: "company",
905
+ label: o(a("aboutCompany")),
906
+ icon: /* @__PURE__ */ n(en, { "aria-hidden": "true" })
907
+ }
908
+ ) : null,
909
+ i || l.about === "operator" || m != null && m.operatorId ? /* @__PURE__ */ n(
910
+ Be,
911
+ {
912
+ value: "operator",
913
+ label: o(a("aboutOperator")),
914
+ icon: /* @__PURE__ */ n(tn, { "aria-hidden": "true" })
915
+ }
916
+ ) : null
917
+ ]
918
+ }
919
+ ),
920
+ St(),
921
+ l.about === "company" ? /* @__PURE__ */ b(Ee, { children: [
922
+ U ? /* @__PURE__ */ n(F, { label: o(a("companyName")), children: /* @__PURE__ */ n(Fe, { value: It, disabled: !0, readOnly: !0 }) }) : null,
923
+ e ? /* @__PURE__ */ n(
924
+ F,
925
+ {
926
+ label: o(
927
+ a(U ? "companyReplace" : "companyName")
928
+ ),
929
+ children: /* @__PURE__ */ n(
930
+ Bt,
931
+ {
932
+ options: c,
933
+ value: U ? "" : l.companyId,
934
+ onValueChange: (t) => U ? t && d.patchFields({ companyId: t }) : d.patchFields({ companyId: t }),
935
+ clearable: !U && !Z,
936
+ filter: cn,
937
+ placeholder: o(a("companySearch")),
938
+ "aria-label": o(
939
+ a(U ? "companyReplace" : "companyName")
940
+ )
941
+ }
942
+ )
943
+ }
944
+ ) : null
945
+ ] }) : null,
946
+ l.about === "operator" ? i ? /* @__PURE__ */ n(F, { label: o(a("operator")), children: /* @__PURE__ */ n(
947
+ Le,
948
+ {
949
+ options: ht,
950
+ value: l.operatorId,
951
+ onValueChange: (t) => t && d.patchFields({ operatorId: t })
952
+ }
953
+ ) }) : l.operatorId !== N ? (
954
+ /* No roster to pick from: name the link read-only. */
955
+ /* @__PURE__ */ n(F, { label: o(a("operator")), children: /* @__PURE__ */ n(
956
+ Fe,
957
+ {
958
+ value: A(l.operatorId),
959
+ disabled: !0,
960
+ readOnly: !0
961
+ }
962
+ ) })
963
+ ) : null : null,
964
+ d.showDone ? /* @__PURE__ */ b(Ee, { children: [
965
+ /* @__PURE__ */ n(
966
+ Mt,
967
+ {
968
+ label: o(a("done")),
969
+ checked: s.done,
970
+ disabled: qe || s.accepted,
971
+ "aria-disabled": s.donePending || void 0,
972
+ "aria-busy": s.donePending || void 0,
973
+ className: "ds:aria-disabled:cursor-progress",
974
+ onCheckedChange: (t) => {
975
+ s.donePending || d.setDone(t);
976
+ }
977
+ }
978
+ ),
979
+ s.doneError ? /* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: s.doneError }) }) : null
980
+ ] }) : null,
981
+ s.saveError ? /* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: s.saveError }) }) : null,
982
+ s.deleteError && !s.confirmDeleteOpen ? /* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: s.deleteError }) }) : null
983
+ ] }), et = E === "loading" ? wt : E === "error" ? Et : E === "locked" ? kt : E === "withheld" ? /* @__PURE__ */ n(
984
+ Ht,
985
+ {
986
+ onTurnOff: se ? Ne(se) : void 0
987
+ }
988
+ ) : V ? Ze : /* @__PURE__ */ n($t, { orientation: "vertical", className: "ds:min-h-0 ds:flex-1", children: Ze }), Ve = E === "ready" ? Qe(!0) : E === "locked" || E === "withheld" ? Qe(!1) : null, Ct = E === "ready" && d.showDelete, tt = le ? /* @__PURE__ */ n(
989
+ J,
990
+ {
991
+ open: s.confirmDeleteOpen && S,
992
+ onOpenChange: (t) => {
993
+ s.deleting || d.patchUi(
994
+ t ? { confirmDeleteOpen: !0 } : { confirmDeleteOpen: !1, deleteError: void 0 }
995
+ );
996
+ },
997
+ children: /* @__PURE__ */ b(
998
+ J.Content,
999
+ {
1000
+ size: "sm",
1001
+ variant: "alert",
1002
+ onCloseAutoFocus: (t) => {
1003
+ var g;
1004
+ t.preventDefault(), d.isAccepted() || (g = Ie.current) == null || g.focus();
1005
+ },
1006
+ children: [
1007
+ /* @__PURE__ */ b(J.Header, { children: [
1008
+ /* @__PURE__ */ n(J.Title, { children: o(a("deleteConfirmTitle")) }),
1009
+ /* @__PURE__ */ n(J.Description, { children: o(a("deleteConfirmBody")) })
1010
+ ] }),
1011
+ s.deleteError ? /* @__PURE__ */ n(J.Body, { children: /* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: s.deleteError }) }) }) : null,
1012
+ /* @__PURE__ */ b(J.Footer, { divider: !0, children: [
1013
+ /* @__PURE__ */ n(J.Close, { asChild: !0, children: /* @__PURE__ */ n(We, { intent: "outline", "aria-disabled": s.deleting || void 0, children: o(a("deleteCancel")) }) }),
1014
+ /* @__PURE__ */ n(
1015
+ We,
1016
+ {
1017
+ intent: "destructive",
1018
+ startIcon: /* @__PURE__ */ n(st, { "aria-hidden": "true" }),
1019
+ "aria-disabled": s.deleting || void 0,
1020
+ "aria-busy": s.deleting || void 0,
1021
+ onClick: () => {
1022
+ s.deleting || d.remove();
1023
+ },
1024
+ children: o(a("deleteConfirm"))
1025
+ }
1026
+ )
1027
+ ] })
1028
+ ]
1029
+ }
1030
+ )
1031
+ }
1032
+ ) : null, nt = {
1033
+ "data-component": "task-editor",
1034
+ "data-component-id": de,
1035
+ "data-variant": M,
1036
+ "data-status": E
1037
+ };
1038
+ return V ? /* @__PURE__ */ b(Ee, { children: [
1039
+ /* @__PURE__ */ n(
1040
+ xt,
1041
+ {
1042
+ ...ve,
1043
+ "data-component-id": de,
1044
+ "data-variant": M,
1045
+ "data-status": E,
1046
+ ref: pe,
1047
+ open: j,
1048
+ onBack: Je,
1049
+ onExited: Oe,
1050
+ title: be,
1051
+ icon: /* @__PURE__ */ n(dt, { "aria-hidden": "true" }),
1052
+ backLabel: he ?? o(a("back")),
1053
+ footer: Ve,
1054
+ footerAlign: Ct ? "between" : "end",
1055
+ className: O,
1056
+ children: /* @__PURE__ */ n("div", { ...nt, className: ut({ variant: M }), children: et })
1057
+ }
1058
+ ),
1059
+ tt
1060
+ ] }) : /* @__PURE__ */ b(Ee, { children: [
1061
+ /* @__PURE__ */ b(
1062
+ "div",
1063
+ {
1064
+ tabIndex: -1,
1065
+ ...ve,
1066
+ ...nt,
1067
+ ref: pe,
1068
+ className: ut({ variant: M, className: O }),
1069
+ children: [
1070
+ /* @__PURE__ */ n(
1071
+ Ot,
1072
+ {
1073
+ title: be,
1074
+ icon: /* @__PURE__ */ n(dt, { "aria-hidden": "true" }),
1075
+ sticky: !0,
1076
+ divider: !0
1077
+ }
1078
+ ),
1079
+ et,
1080
+ Ve ? /* @__PURE__ */ n("div", { className: "ds:relative ds:z-[var(--z-sticky)] ds:shrink-0 ds:border-t ds:border-[color:var(--border)] ds:bg-[var(--background)]", children: /* @__PURE__ */ n("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: Ve }) }) : null
1081
+ ]
1082
+ }
1083
+ ),
1084
+ tt
1085
+ ] });
1086
+ }
1087
+ );
1088
+ pn.displayName = "TaskEditor";
1089
+ export {
1090
+ pn as T,
1091
+ rn as t
1092
+ };
1093
+ //# sourceMappingURL=task-editor-wKbFbGqW.js.map