@alfadocs/ui-kit-debug 1.52.0 → 1.53.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.
- package/dist/_chunks/{address-autocomplete-BVLoHU3E.js → address-autocomplete-Bp816Mb1.js} +2 -2
- package/dist/_chunks/{address-autocomplete-BVLoHU3E.js.map → address-autocomplete-Bp816Mb1.js.map} +1 -1
- package/dist/_chunks/{address-fields-UiEXHxEX.js → address-fields-BIL6cvLS.js} +2 -2
- package/dist/_chunks/{address-fields-UiEXHxEX.js.map → address-fields-BIL6cvLS.js.map} +1 -1
- package/dist/_chunks/{agenda-tray-C-_iu6Fo.js → agenda-tray-C2a8OfKC.js} +2 -2
- package/dist/_chunks/{agenda-tray-C-_iu6Fo.js.map → agenda-tray-C2a8OfKC.js.map} +1 -1
- package/dist/_chunks/{anamnesis-summary-rows-DaSoA80I.js → anamnesis-summary-rows-CnHxtht-.js} +3 -3
- package/dist/_chunks/{anamnesis-summary-rows-DaSoA80I.js.map → anamnesis-summary-rows-CnHxtht-.js.map} +1 -1
- package/dist/_chunks/apexcharts-theme-DNoXvgnZ.js +105 -0
- package/dist/_chunks/apexcharts-theme-DNoXvgnZ.js.map +1 -0
- package/dist/_chunks/{appointment-timeline-BZErHbD1.js → appointment-timeline-By-EwmJU.js} +2 -2
- package/dist/_chunks/{appointment-timeline-BZErHbD1.js.map → appointment-timeline-By-EwmJU.js.map} +1 -1
- package/dist/_chunks/{appointment-tray-DR_Zm4Gw.js → appointment-tray-7Z3A3Xz9.js} +2 -2
- package/dist/_chunks/{appointment-tray-DR_Zm4Gw.js.map → appointment-tray-7Z3A3Xz9.js.map} +1 -1
- package/dist/_chunks/{balance-badge-cell-CS-iKkLM.js → balance-badge-cell-BtiFfFRY.js} +2 -2
- package/dist/_chunks/{balance-badge-cell-CS-iKkLM.js.map → balance-badge-cell-BtiFfFRY.js.map} +1 -1
- package/dist/_chunks/{booking-DP543-BT.js → booking-CFR7vU8X.js} +3 -3
- package/dist/_chunks/{booking-DP543-BT.js.map → booking-CFR7vU8X.js.map} +1 -1
- package/dist/_chunks/{calendar-workspace-B9MKJXER.js → calendar-workspace-LDuzo_Ie.js} +7 -7
- package/dist/_chunks/{calendar-workspace-B9MKJXER.js.map → calendar-workspace-LDuzo_Ie.js.map} +1 -1
- package/dist/_chunks/{chart-CuE30cfr.js → chart-D37VAIa-.js} +81 -81
- package/dist/_chunks/chart-D37VAIa-.js.map +1 -0
- package/dist/_chunks/{data-table-DJvEwZZx.js → data-table-CiVyhNXx.js} +2 -2
- package/dist/_chunks/{data-table-DJvEwZZx.js.map → data-table-CiVyhNXx.js.map} +1 -1
- package/dist/_chunks/{document-preview-1CZJg6CX.js → document-preview-VXOQZZvy.js} +2 -2
- package/dist/_chunks/{document-preview-1CZJg6CX.js.map → document-preview-VXOQZZvy.js.map} +1 -1
- package/dist/_chunks/{empty-state-DActfjdn.js → empty-state-C62P_6kr.js} +59 -48
- package/dist/_chunks/empty-state-C62P_6kr.js.map +1 -0
- package/dist/_chunks/{error-boundary--w5hYiQ-.js → error-boundary-Cvs23EzK.js} +2 -2
- package/dist/_chunks/{error-boundary--w5hYiQ-.js.map → error-boundary-Cvs23EzK.js.map} +1 -1
- package/dist/_chunks/error-page-BtxEOL6g.js +780 -0
- package/dist/_chunks/error-page-BtxEOL6g.js.map +1 -0
- package/dist/_chunks/{file-manager-BGHShxn_.js → file-manager-BfG3usGk.js} +3 -3
- package/dist/_chunks/{file-manager-BGHShxn_.js.map → file-manager-BfG3usGk.js.map} +1 -1
- package/dist/_chunks/{help-me-write-templates-CGCyhAVE.js → help-me-write-templates-DcR-e_90.js} +2 -2
- package/dist/_chunks/{help-me-write-templates-CGCyhAVE.js.map → help-me-write-templates-DcR-e_90.js.map} +1 -1
- package/dist/_chunks/{index.modern-Zta-A4Jm.js → index.modern-BeRXQVdc.js} +3 -2
- package/dist/_chunks/{index.modern-Zta-A4Jm.js.map → index.modern-BeRXQVdc.js.map} +1 -1
- package/dist/_chunks/{map-view-CmNGS6Ok.js → map-view-CQmqQJwK.js} +158 -129
- package/dist/_chunks/map-view-CQmqQJwK.js.map +1 -0
- package/dist/_chunks/{practice-results-DjhcggtZ.js → practice-results-B9uV0TT8.js} +3 -3
- package/dist/_chunks/{practice-results-DjhcggtZ.js.map → practice-results-B9uV0TT8.js.map} +1 -1
- package/dist/_chunks/{privacy-mask-noG15O9q.js → privacy-mask-CK-9sxeI.js} +2 -2
- package/dist/_chunks/{privacy-mask-noG15O9q.js.map → privacy-mask-CK-9sxeI.js.map} +1 -1
- package/dist/_chunks/{product-hub-panel-BmBzDba9.js → product-hub-panel-D87kbz5j.js} +2 -2
- package/dist/_chunks/{product-hub-panel-BmBzDba9.js.map → product-hub-panel-D87kbz5j.js.map} +1 -1
- package/dist/_chunks/{radiograph-panel.agent-BP71J_VB.js → radiograph-panel.agent-BWBaxJ8e.js} +2 -2
- package/dist/_chunks/{radiograph-panel.agent-BP71J_VB.js.map → radiograph-panel.agent-BWBaxJ8e.js.map} +1 -1
- package/dist/_chunks/{reviews-panel-DDb_t7vy.js → reviews-panel-DUgqU-Wr.js} +2 -2
- package/dist/_chunks/{reviews-panel-DDb_t7vy.js.map → reviews-panel-DUgqU-Wr.js.map} +1 -1
- package/dist/_chunks/{slot-grid-Bkg9MVXP.js → slot-grid-kq7bDdrx.js} +2 -2
- package/dist/_chunks/{slot-grid-Bkg9MVXP.js.map → slot-grid-kq7bDdrx.js.map} +1 -1
- package/dist/_chunks/{sparkline-ZOxMBU76.js → sparkline-pkGPCXbl.js} +80 -80
- package/dist/_chunks/sparkline-pkGPCXbl.js.map +1 -0
- package/dist/_chunks/{task-card-CngF4Zee.js → task-card-Cfl08MCS.js} +2 -2
- package/dist/_chunks/{task-card-CngF4Zee.js.map → task-card-Cfl08MCS.js.map} +1 -1
- package/dist/_chunks/{task-editor-Dz93rRXg.js → task-editor-CxF-sBnu.js} +2 -2
- package/dist/_chunks/{task-editor-Dz93rRXg.js.map → task-editor-CxF-sBnu.js.map} +1 -1
- package/dist/_chunks/{task-tray-CB6_BvH9.js → task-tray-rAGslT2C.js} +3 -3
- package/dist/_chunks/{task-tray-CB6_BvH9.js.map → task-tray-rAGslT2C.js.map} +1 -1
- package/dist/_chunks/{tasks-panel-DHAoTQtR.js → tasks-panel-Dkm8SnmV.js} +3 -3
- package/dist/_chunks/{tasks-panel-DHAoTQtR.js.map → tasks-panel-Dkm8SnmV.js.map} +1 -1
- package/dist/_chunks/{use-appointment-details-read-YsuJgYeB.js → use-appointment-details-read-W6h4oTHx.js} +3 -3
- package/dist/_chunks/{use-appointment-details-read-YsuJgYeB.js.map → use-appointment-details-read-W6h4oTHx.js.map} +1 -1
- package/dist/_chunks/{workflow-map-C7fHKTXL.js → workflow-map-C1OjRhM3.js} +189 -197
- package/dist/_chunks/workflow-map-C1OjRhM3.js.map +1 -0
- package/dist/agent-catalog.json +51 -7
- package/dist/agent-i18n/en.json +9 -3
- package/dist/components/_shared/index.d.ts +1 -0
- package/dist/components/_shared/index.d.ts.map +1 -1
- package/dist/components/_shared/is-development.d.ts +8 -0
- package/dist/components/_shared/is-development.d.ts.map +1 -0
- package/dist/components/_shared/use-keep-apex-tooltip-inside.d.ts +3 -0
- package/dist/components/_shared/use-keep-apex-tooltip-inside.d.ts.map +1 -0
- package/dist/components/address-autocomplete/index.js +1 -1
- package/dist/components/address-fields/index.js +1 -1
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/appointment-card/index.js +1 -1
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/chart/chart.d.ts.map +1 -1
- package/dist/components/chart/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/empty-state/empty-state.d.ts +6 -0
- package/dist/components/empty-state/empty-state.d.ts.map +1 -1
- package/dist/components/empty-state/index.js +1 -1
- package/dist/components/error-boundary/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/map-view/index.js +1 -1
- package/dist/components/map-view/map-view.agent.d.ts.map +1 -1
- package/dist/components/map-view/map-view.d.ts +8 -5
- package/dist/components/map-view/map-view.d.ts.map +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/product-hub-tray/index.js +1 -1
- package/dist/components/radiograph-panel/index.js +1 -1
- package/dist/components/reviews-panel/index.js +1 -1
- package/dist/components/slot-grid/index.js +1 -1
- package/dist/components/sparkline/index.js +1 -1
- package/dist/components/sparkline/sparkline.d.ts.map +1 -1
- package/dist/components/task-card/index.js +1 -1
- package/dist/components/task-editor/index.js +1 -1
- package/dist/components/task-tray/index.js +1 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/components/workflow/workflow-editor.d.ts.map +1 -1
- package/dist/error-pages/400.ar.html +41 -0
- package/dist/error-pages/400.de.html +41 -0
- package/dist/error-pages/400.el.html +41 -0
- package/dist/error-pages/400.en.html +41 -0
- package/dist/error-pages/400.es.html +41 -0
- package/dist/error-pages/400.fr.html +41 -0
- package/dist/error-pages/400.hi.html +41 -0
- package/dist/error-pages/400.html +41 -0
- package/dist/error-pages/400.it.html +41 -0
- package/dist/error-pages/400.ja.html +41 -0
- package/dist/error-pages/400.nl.html +41 -0
- package/dist/error-pages/400.pl.html +41 -0
- package/dist/error-pages/400.pt.html +41 -0
- package/dist/error-pages/400.ro.html +41 -0
- package/dist/error-pages/400.ru.html +41 -0
- package/dist/error-pages/400.sq.html +41 -0
- package/dist/error-pages/400.sv.html +41 -0
- package/dist/error-pages/400.tr.html +41 -0
- package/dist/error-pages/400.zh.html +41 -0
- package/dist/error-pages/401.ar.html +41 -0
- package/dist/error-pages/401.de.html +41 -0
- package/dist/error-pages/401.el.html +41 -0
- package/dist/error-pages/401.en.html +41 -0
- package/dist/error-pages/401.es.html +41 -0
- package/dist/error-pages/401.fr.html +41 -0
- package/dist/error-pages/401.hi.html +41 -0
- package/dist/error-pages/401.html +41 -0
- package/dist/error-pages/401.it.html +41 -0
- package/dist/error-pages/401.ja.html +41 -0
- package/dist/error-pages/401.nl.html +41 -0
- package/dist/error-pages/401.pl.html +41 -0
- package/dist/error-pages/401.pt.html +41 -0
- package/dist/error-pages/401.ro.html +41 -0
- package/dist/error-pages/401.ru.html +41 -0
- package/dist/error-pages/401.sq.html +41 -0
- package/dist/error-pages/401.sv.html +41 -0
- package/dist/error-pages/401.tr.html +41 -0
- package/dist/error-pages/401.zh.html +41 -0
- package/dist/error-pages/403.ar.html +41 -0
- package/dist/error-pages/403.de.html +41 -0
- package/dist/error-pages/403.el.html +41 -0
- package/dist/error-pages/403.en.html +41 -0
- package/dist/error-pages/403.es.html +41 -0
- package/dist/error-pages/403.fr.html +41 -0
- package/dist/error-pages/403.hi.html +41 -0
- package/dist/error-pages/403.html +41 -0
- package/dist/error-pages/403.it.html +41 -0
- package/dist/error-pages/403.ja.html +41 -0
- package/dist/error-pages/403.nl.html +41 -0
- package/dist/error-pages/403.pl.html +41 -0
- package/dist/error-pages/403.pt.html +41 -0
- package/dist/error-pages/403.ro.html +41 -0
- package/dist/error-pages/403.ru.html +41 -0
- package/dist/error-pages/403.sq.html +41 -0
- package/dist/error-pages/403.sv.html +41 -0
- package/dist/error-pages/403.tr.html +41 -0
- package/dist/error-pages/403.zh.html +41 -0
- package/dist/error-pages/404.ar.html +41 -0
- package/dist/error-pages/404.de.html +41 -0
- package/dist/error-pages/404.el.html +41 -0
- package/dist/error-pages/404.en.html +41 -0
- package/dist/error-pages/404.es.html +41 -0
- package/dist/error-pages/404.fr.html +41 -0
- package/dist/error-pages/404.hi.html +41 -0
- package/dist/error-pages/404.html +41 -0
- package/dist/error-pages/404.it.html +41 -0
- package/dist/error-pages/404.ja.html +41 -0
- package/dist/error-pages/404.nl.html +41 -0
- package/dist/error-pages/404.pl.html +41 -0
- package/dist/error-pages/404.pt.html +41 -0
- package/dist/error-pages/404.ro.html +41 -0
- package/dist/error-pages/404.ru.html +41 -0
- package/dist/error-pages/404.sq.html +41 -0
- package/dist/error-pages/404.sv.html +41 -0
- package/dist/error-pages/404.tr.html +41 -0
- package/dist/error-pages/404.zh.html +41 -0
- package/dist/error-pages/405.ar.html +41 -0
- package/dist/error-pages/405.de.html +41 -0
- package/dist/error-pages/405.el.html +41 -0
- package/dist/error-pages/405.en.html +41 -0
- package/dist/error-pages/405.es.html +41 -0
- package/dist/error-pages/405.fr.html +41 -0
- package/dist/error-pages/405.hi.html +41 -0
- package/dist/error-pages/405.html +41 -0
- package/dist/error-pages/405.it.html +41 -0
- package/dist/error-pages/405.ja.html +41 -0
- package/dist/error-pages/405.nl.html +41 -0
- package/dist/error-pages/405.pl.html +41 -0
- package/dist/error-pages/405.pt.html +41 -0
- package/dist/error-pages/405.ro.html +41 -0
- package/dist/error-pages/405.ru.html +41 -0
- package/dist/error-pages/405.sq.html +41 -0
- package/dist/error-pages/405.sv.html +41 -0
- package/dist/error-pages/405.tr.html +41 -0
- package/dist/error-pages/405.zh.html +41 -0
- package/dist/error-pages/410.ar.html +41 -0
- package/dist/error-pages/410.de.html +41 -0
- package/dist/error-pages/410.el.html +41 -0
- package/dist/error-pages/410.en.html +41 -0
- package/dist/error-pages/410.es.html +41 -0
- package/dist/error-pages/410.fr.html +41 -0
- package/dist/error-pages/410.hi.html +41 -0
- package/dist/error-pages/410.html +41 -0
- package/dist/error-pages/410.it.html +41 -0
- package/dist/error-pages/410.ja.html +41 -0
- package/dist/error-pages/410.nl.html +41 -0
- package/dist/error-pages/410.pl.html +41 -0
- package/dist/error-pages/410.pt.html +41 -0
- package/dist/error-pages/410.ro.html +41 -0
- package/dist/error-pages/410.ru.html +41 -0
- package/dist/error-pages/410.sq.html +41 -0
- package/dist/error-pages/410.sv.html +41 -0
- package/dist/error-pages/410.tr.html +41 -0
- package/dist/error-pages/410.zh.html +41 -0
- package/dist/error-pages/419.ar.html +42 -0
- package/dist/error-pages/419.de.html +42 -0
- package/dist/error-pages/419.el.html +42 -0
- package/dist/error-pages/419.en.html +42 -0
- package/dist/error-pages/419.es.html +42 -0
- package/dist/error-pages/419.fr.html +42 -0
- package/dist/error-pages/419.hi.html +42 -0
- package/dist/error-pages/419.html +42 -0
- package/dist/error-pages/419.it.html +42 -0
- package/dist/error-pages/419.ja.html +42 -0
- package/dist/error-pages/419.nl.html +42 -0
- package/dist/error-pages/419.pl.html +42 -0
- package/dist/error-pages/419.pt.html +42 -0
- package/dist/error-pages/419.ro.html +42 -0
- package/dist/error-pages/419.ru.html +42 -0
- package/dist/error-pages/419.sq.html +42 -0
- package/dist/error-pages/419.sv.html +42 -0
- package/dist/error-pages/419.tr.html +42 -0
- package/dist/error-pages/419.zh.html +42 -0
- package/dist/error-pages/429.ar.html +42 -0
- package/dist/error-pages/429.de.html +42 -0
- package/dist/error-pages/429.el.html +42 -0
- package/dist/error-pages/429.en.html +42 -0
- package/dist/error-pages/429.es.html +42 -0
- package/dist/error-pages/429.fr.html +42 -0
- package/dist/error-pages/429.hi.html +42 -0
- package/dist/error-pages/429.html +42 -0
- package/dist/error-pages/429.it.html +42 -0
- package/dist/error-pages/429.ja.html +42 -0
- package/dist/error-pages/429.nl.html +42 -0
- package/dist/error-pages/429.pl.html +42 -0
- package/dist/error-pages/429.pt.html +42 -0
- package/dist/error-pages/429.ro.html +42 -0
- package/dist/error-pages/429.ru.html +42 -0
- package/dist/error-pages/429.sq.html +42 -0
- package/dist/error-pages/429.sv.html +42 -0
- package/dist/error-pages/429.tr.html +42 -0
- package/dist/error-pages/429.zh.html +42 -0
- package/dist/error-pages/500.ar.html +41 -0
- package/dist/error-pages/500.de.html +41 -0
- package/dist/error-pages/500.el.html +41 -0
- package/dist/error-pages/500.en.html +41 -0
- package/dist/error-pages/500.es.html +41 -0
- package/dist/error-pages/500.fr.html +41 -0
- package/dist/error-pages/500.hi.html +41 -0
- package/dist/error-pages/500.html +41 -0
- package/dist/error-pages/500.it.html +41 -0
- package/dist/error-pages/500.ja.html +41 -0
- package/dist/error-pages/500.nl.html +41 -0
- package/dist/error-pages/500.pl.html +41 -0
- package/dist/error-pages/500.pt.html +41 -0
- package/dist/error-pages/500.ro.html +41 -0
- package/dist/error-pages/500.ru.html +41 -0
- package/dist/error-pages/500.sq.html +41 -0
- package/dist/error-pages/500.sv.html +41 -0
- package/dist/error-pages/500.tr.html +41 -0
- package/dist/error-pages/500.zh.html +41 -0
- package/dist/error-pages/502.ar.html +41 -0
- package/dist/error-pages/502.de.html +41 -0
- package/dist/error-pages/502.el.html +41 -0
- package/dist/error-pages/502.en.html +41 -0
- package/dist/error-pages/502.es.html +41 -0
- package/dist/error-pages/502.fr.html +41 -0
- package/dist/error-pages/502.hi.html +41 -0
- package/dist/error-pages/502.html +41 -0
- package/dist/error-pages/502.it.html +41 -0
- package/dist/error-pages/502.ja.html +41 -0
- package/dist/error-pages/502.nl.html +41 -0
- package/dist/error-pages/502.pl.html +41 -0
- package/dist/error-pages/502.pt.html +41 -0
- package/dist/error-pages/502.ro.html +41 -0
- package/dist/error-pages/502.ru.html +41 -0
- package/dist/error-pages/502.sq.html +41 -0
- package/dist/error-pages/502.sv.html +41 -0
- package/dist/error-pages/502.tr.html +41 -0
- package/dist/error-pages/502.zh.html +41 -0
- package/dist/error-pages/503.ar.html +41 -0
- package/dist/error-pages/503.de.html +41 -0
- package/dist/error-pages/503.el.html +41 -0
- package/dist/error-pages/503.en.html +41 -0
- package/dist/error-pages/503.es.html +41 -0
- package/dist/error-pages/503.fr.html +41 -0
- package/dist/error-pages/503.hi.html +41 -0
- package/dist/error-pages/503.html +41 -0
- package/dist/error-pages/503.it.html +41 -0
- package/dist/error-pages/503.ja.html +41 -0
- package/dist/error-pages/503.nl.html +41 -0
- package/dist/error-pages/503.pl.html +41 -0
- package/dist/error-pages/503.pt.html +41 -0
- package/dist/error-pages/503.ro.html +41 -0
- package/dist/error-pages/503.ru.html +41 -0
- package/dist/error-pages/503.sq.html +41 -0
- package/dist/error-pages/503.sv.html +41 -0
- package/dist/error-pages/503.tr.html +41 -0
- package/dist/error-pages/503.zh.html +41 -0
- package/dist/error-pages/504.ar.html +41 -0
- package/dist/error-pages/504.de.html +41 -0
- package/dist/error-pages/504.el.html +41 -0
- package/dist/error-pages/504.en.html +41 -0
- package/dist/error-pages/504.es.html +41 -0
- package/dist/error-pages/504.fr.html +41 -0
- package/dist/error-pages/504.hi.html +41 -0
- package/dist/error-pages/504.html +41 -0
- package/dist/error-pages/504.it.html +41 -0
- package/dist/error-pages/504.ja.html +41 -0
- package/dist/error-pages/504.nl.html +41 -0
- package/dist/error-pages/504.pl.html +41 -0
- package/dist/error-pages/504.pt.html +41 -0
- package/dist/error-pages/504.ro.html +41 -0
- package/dist/error-pages/504.ru.html +41 -0
- package/dist/error-pages/504.sq.html +41 -0
- package/dist/error-pages/504.sv.html +41 -0
- package/dist/error-pages/504.tr.html +41 -0
- package/dist/error-pages/504.zh.html +41 -0
- package/dist/error-pages/maintenance.ar.html +41 -0
- package/dist/error-pages/maintenance.de.html +41 -0
- package/dist/error-pages/maintenance.el.html +41 -0
- package/dist/error-pages/maintenance.en.html +41 -0
- package/dist/error-pages/maintenance.es.html +41 -0
- package/dist/error-pages/maintenance.fr.html +41 -0
- package/dist/error-pages/maintenance.hi.html +41 -0
- package/dist/error-pages/maintenance.html +41 -0
- package/dist/error-pages/maintenance.it.html +41 -0
- package/dist/error-pages/maintenance.ja.html +41 -0
- package/dist/error-pages/maintenance.nl.html +41 -0
- package/dist/error-pages/maintenance.pl.html +41 -0
- package/dist/error-pages/maintenance.pt.html +41 -0
- package/dist/error-pages/maintenance.ro.html +41 -0
- package/dist/error-pages/maintenance.ru.html +41 -0
- package/dist/error-pages/maintenance.sq.html +41 -0
- package/dist/error-pages/maintenance.sv.html +41 -0
- package/dist/error-pages/maintenance.tr.html +41 -0
- package/dist/error-pages/maintenance.zh.html +41 -0
- package/dist/host-compat.css +13 -1
- package/dist/i18n/locales/ar.d.ts +70 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +70 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +70 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +70 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +70 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +70 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +70 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +70 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +70 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +70 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +70 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +70 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +70 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +70 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +70 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +70 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +70 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +70 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +70 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +70 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +70 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +70 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +70 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +70 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +70 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +70 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +70 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +70 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +70 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +70 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +70 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +70 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +70 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +70 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +70 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +70 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +143 -137
- package/dist/index.js.map +1 -1
- package/dist/locales/ar.json +70 -0
- package/dist/locales/de.json +70 -0
- package/dist/locales/el.json +70 -0
- package/dist/locales/en.json +70 -0
- package/dist/locales/es.json +70 -0
- package/dist/locales/fr.json +70 -0
- package/dist/locales/hi.json +70 -0
- package/dist/locales/it.json +70 -0
- package/dist/locales/ja.json +70 -0
- package/dist/locales/nl.json +70 -0
- package/dist/locales/pl.json +70 -0
- package/dist/locales/pt.json +70 -0
- package/dist/locales/ro.json +70 -0
- package/dist/locales/ru.json +70 -0
- package/dist/locales/sq.json +70 -0
- package/dist/locales/sv.json +70 -0
- package/dist/locales/tr.json +70 -0
- package/dist/locales/zh.json +70 -0
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/patterns/error-page/error-page-illustration.d.ts +6 -0
- package/dist/patterns/error-page/error-page-illustration.d.ts.map +1 -0
- package/dist/patterns/error-page/error-page-locale.d.ts +32 -0
- package/dist/patterns/error-page/error-page-locale.d.ts.map +1 -0
- package/dist/patterns/error-page/error-page-statuses.d.ts +16 -0
- package/dist/patterns/error-page/error-page-statuses.d.ts.map +1 -0
- package/dist/patterns/error-page/error-page.d.ts +48 -0
- package/dist/patterns/error-page/error-page.d.ts.map +1 -0
- package/dist/patterns/error-page/index.d.ts +5 -0
- package/dist/patterns/error-page/index.d.ts.map +1 -0
- package/dist/patterns/error-page/index.js +9 -0
- package/dist/patterns/error-page/index.js.map +1 -0
- package/dist/patterns/help-me-write-templates/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +9 -2
- package/dist/_chunks/apexcharts-theme-B_AxGC_h.js +0 -72
- package/dist/_chunks/apexcharts-theme-B_AxGC_h.js.map +0 -1
- package/dist/_chunks/chart-CuE30cfr.js.map +0 -1
- package/dist/_chunks/empty-state-DActfjdn.js.map +0 -1
- package/dist/_chunks/map-view-CmNGS6Ok.js.map +0 -1
- package/dist/_chunks/sparkline-ZOxMBU76.js.map +0 -1
- package/dist/_chunks/workflow-map-C7fHKTXL.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { c as $ } from "./index-D2ZczOXr.js";
|
|
|
4
4
|
import { useTranslation as U } from "react-i18next";
|
|
5
5
|
import { B as b } from "./badge-hnBt8o7n.js";
|
|
6
6
|
import { C as B } from "./card-DPmk26CL.js";
|
|
7
|
-
import { E as G } from "./empty-state-
|
|
7
|
+
import { E as G } from "./empty-state-C62P_6kr.js";
|
|
8
8
|
import { P as Y } from "./panel-header-D_mTdhUp.js";
|
|
9
9
|
import { P as J } from "./pdf-viewer-hzfM5pZf.js";
|
|
10
10
|
import { T as O, b as Q, c as X, a as Z } from "./tabs-DLXVEDsa.js";
|
|
@@ -288,4 +288,4 @@ export {
|
|
|
288
288
|
ue as D,
|
|
289
289
|
de as d
|
|
290
290
|
};
|
|
291
|
-
//# sourceMappingURL=document-preview-
|
|
291
|
+
//# sourceMappingURL=document-preview-VXOQZZvy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-preview-1CZJg6CX.js","sources":["../../node_modules/lucide-react/dist/esm/icons/files.mjs","../../src/components/document-preview/document-preview.agent.ts","../../src/components/document-preview/document-preview.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8\", key: \"14sh0y\" }],\n [\n \"path\",\n {\n d: \"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z\",\n key: \"1970lx\"\n }\n ],\n [\"path\", { d: \"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1\", key: \"l4dndm\" }]\n];\nconst Files = createLucideIcon(\"files\", __iconNode);\n\nexport { __iconNode, Files as default };\n//# sourceMappingURL=files.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentPreview. */\n/* */\n/* A passive, read-only viewer, so it declares no interactive */\n/* capabilities. The always-on state slot carries only the structural */\n/* render `kind` (pdf / image / metadata / empty) — never the document */\n/* name. */\n/* */\n/* PHI rule (PRS §26 §7): the document display name can identify a */\n/* patient (e.g. \"Rossi Maria — referto 2026.pdf\"). It renders as text */\n/* (fine) but the only name-returning read is the deliberate get_name */\n/* action with `safety: 'phi'`, so the host gates it behind confirm + */\n/* audit. No name is ever emitted in a data-* hook. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentPreviewHandle } from './document-preview';\n\nexport const documentPreviewAgent: AgentAdapter<DocumentPreviewHandle> = {\n id: 'document-preview',\n capabilities: [],\n state: {\n kind: {\n type: \"'pdf' | 'image' | 'metadata' | 'empty'\",\n descriptionKey: 'ui.agent.documentPreview.state.kind',\n description:\n 'Which render branch is active: pdf, image, metadata (no inline preview), or empty (no document). Structural — never the document name.',\n read: (handle) => handle.getKind(),\n },\n },\n actions: {\n get_name: {\n // phi (not read): resolves the document display name, which can identify\n // patients. PRS §26 — phi outranks read so the host gates it behind\n // stricter confirm + audit. The always-on kind slot stays name-free.\n safety: 'phi',\n returns: 'string | undefined',\n returnsSchema: { type: ['string', 'null'] },\n idempotent: true,\n descriptionKey: 'ui.agent.documentPreview.actions.getName',\n description:\n 'Read the display name of the previewed document. May identify a patient (PHI).',\n invoke: (handle) => handle.getName(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-preview',\n description: 'Marks the DocumentPreview region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* -------------------------------------------------------------------- */\n/* DocumentPreview — a standalone, reusable document viewer. */\n/* */\n/* Decoupled from FileManager: it takes primitive props (name, mimeType, */\n/* src, metadata) rather than a FileManagerItem, so signing, the patient */\n/* portal, and the Control Room rail can all reuse it. The body is an */\n/* elevated Card: a bounded preview viewport (PDF → kit PDFViewer; */\n/* image/* → <img>; otherwise a MIME-icon placeholder) above an always-on */\n/* Details block (badges + every structural field the host supplies), so */\n/* the metadata is never dropped when a real preview renders. No name → */\n/* EmptyState. */\n/* */\n/* Title lives in the canonical PanelHeader (the same header every rail */\n/* panel adopts) so the Control Room rail can inject its pin / close */\n/* controls into it. Pass `documents` (≥ 2) to preview a SELECTION as */\n/* tabs — one tab per document, the active one shown below; a single */\n/* entry (or the single-document props) renders without a tab strip. */\n/* */\n/* The root is a `<section>` (region landmark) so the PanelHeader's */\n/* <header> is scoped and never exposed as a page banner — the same */\n/* shape RadiographPanel uses. It is also a keyboard-focusable scroll */\n/* region (tabIndex 0 + labelled focus ring). */\n/* */\n/* PHI: the visible name renders as text (fine), but the only */\n/* name-returning handle read is surfaced by document-preview.agent.ts */\n/* as a `safety: 'phi'` action — never in always-on state, never in a */\n/* data-* hook. In tabbed mode the handle reflects the ACTIVE tab. */\n/* -------------------------------------------------------------------- */\n\nimport {\n forwardRef,\n Fragment,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n File as FileIcon,\n FileImage,\n FileText,\n Files,\n type LucideIcon,\n} from 'lucide-react';\nimport { Badge } from '../badge';\nimport { Card } from '../card';\nimport { EmptyState } from '../empty-state';\nimport { PanelHeader } from '../panel-header';\nimport { PDFViewer } from '../pdf-viewer';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../tabs';\nimport { useAgentRegistration } from '../../agent';\nimport { documentPreviewAgent } from './document-preview.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentPreviewSignatureStatus = 'none' | 'pending' | 'signed';\n\n/** Which render branch DocumentPreview is showing — structural, never PHI. */\nexport type DocumentPreviewKind = 'pdf' | 'image' | 'metadata' | 'empty';\n\nexport interface DocumentPreviewMetadata {\n /** Size in bytes. */\n size?: number;\n /** Display name of whoever created the document (host-supplied). */\n createdBy?: string;\n /** ISO 8601 timestamp the document was created. */\n createdAt?: string;\n /** ISO 8601 timestamp of the last modification. */\n updatedAt?: string;\n /** ISO 8601 timestamp a signature was requested from the patient. */\n signatureRequestedAt?: string;\n /** ISO 8601 timestamp the document was signed. */\n signedAt?: string;\n /** ISO 8601 timestamp the document was shared with the patient. */\n sharedAt?: string;\n /** Open document-type category (non-identifying), e.g. `'xray'`. */\n documentType?: string;\n /** Signature workflow state. */\n signatureStatus?: DocumentPreviewSignatureStatus;\n /** Clinical-document flag (host-defined semantics). */\n clinical?: boolean;\n /** ISO 8601 expiry (e.g. identification documents). */\n expiresAt?: string;\n}\n\n/**\n * A single previewable document. In multi-document mode each becomes a tab;\n * `id` is the tab value (never a patient name) and `name` is the tab label.\n */\nexport interface DocumentPreviewDocument {\n /** Stable, non-identifying id. Emitted as the tab value — never PHI. */\n id: string;\n /** Display name (PHI). Also the tab label in multi-document mode. */\n name: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n}\n\nexport interface DocumentPreviewProps extends VariantProps<\n typeof documentPreviewVariants\n> {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Display name. Absent (and no `documents`) → empty state. PHI. */\n name?: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. The host owns auth. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n /**\n * Multiple documents to preview as tabs — e.g. a multi-row selection. Two\n * or more render a tab per document (label = name) with the active one\n * shown below; a single entry renders without a tab strip. When non-empty\n * this takes precedence over the single-document props. Names are PHI.\n */\n documents?: DocumentPreviewDocument[];\n className?: string;\n}\n\nexport interface DocumentPreviewHandle {\n /** Which render branch is active — structural, safe for always-on reads. */\n getKind: () => DocumentPreviewKind;\n /** The active document's display name (PHI). Surfaced by the adapter as a `phi` action. */\n getName: () => string | undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst documentPreviewVariants = cva(\n [\n 'ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:overflow-auto',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring',\n ].join(' '),\n);\n\nconst SIGNATURE_VARIANT: Record<\n Exclude<DocumentPreviewSignatureStatus, 'none'>,\n 'success' | 'warning'\n> = {\n signed: 'success',\n pending: 'warning',\n};\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction resolveKind(\n name: string | undefined,\n mimeType: string | undefined,\n src: string | undefined,\n): DocumentPreviewKind {\n if (!name) return 'empty';\n const mime = mimeType ?? '';\n if (mime === 'application/pdf' && src) return 'pdf';\n if (mime.startsWith('image/') && src) return 'image';\n return 'metadata';\n}\n\n/** Fallback icon for the header / metadata card — a small MIME-family lookup. */\nfunction iconForMime(mimeType: string | undefined): LucideIcon {\n const mime = mimeType ?? '';\n if (mime.startsWith('image/')) return FileImage;\n if (\n mime === 'application/pdf' ||\n mime.startsWith('text/') ||\n mime.includes('word')\n ) {\n return FileText;\n }\n return FileIcon;\n}\n\nconst UNIT_KEYS = [\n 'documentPreview.units.bytes',\n 'documentPreview.units.kilobytes',\n 'documentPreview.units.megabytes',\n 'documentPreview.units.gigabytes',\n] as const;\n\nconst UNIT_FALLBACKS = ['B', 'KB', 'MB', 'GB'] as const;\n\nfunction formatBytes(\n bytes: number,\n locale: string,\n t: (key: string, fallback: string) => string,\n): string {\n let value = bytes;\n let unitIndex = 0;\n while (value >= 1024 && unitIndex < UNIT_FALLBACKS.length - 1) {\n value /= 1024;\n unitIndex++;\n }\n const formatted = new Intl.NumberFormat(locale, {\n maximumFractionDigits: unitIndex === 0 ? 0 : 1,\n }).format(value);\n return `${formatted} ${t(UNIT_KEYS[unitIndex], UNIT_FALLBACKS[unitIndex])}`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const DocumentPreview = forwardRef<\n DocumentPreviewHandle,\n DocumentPreviewProps\n>(({ id, name, mimeType, src, metadata, documents, className }, ref) => {\n const { t, i18n } = useTranslation('ui');\n\n // Resolve the document list: an explicit `documents` list wins; otherwise\n // the single-document props form a one-item list; nothing → empty. The\n // synthetic single-doc id is never emitted as a tab value (a lone doc\n // renders without a tab strip), so falling back to the name is PHI-safe.\n const docs = useMemo<DocumentPreviewDocument[]>(() => {\n if (documents && documents.length > 0) return documents;\n if (name) return [{ id: id ?? name, name, mimeType, src, metadata }];\n return [];\n }, [documents, id, name, mimeType, src, metadata]);\n\n const isTabbed = docs.length > 1;\n\n // Active tab (multi mode). When the current id is stale after the selection\n // changes we fall back to the first document — no reconciling effect needed.\n const [activeId, setActiveId] = useState<string | undefined>(undefined);\n const activeDoc = docs.find((doc) => doc.id === activeId) ?? docs[0];\n\n const handle = useMemo<DocumentPreviewHandle>(\n () => ({\n getKind: () =>\n activeDoc\n ? resolveKind(activeDoc.name, activeDoc.mimeType, activeDoc.src)\n : 'empty',\n getName: () => activeDoc?.name,\n }),\n [activeDoc],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(documentPreviewAgent, handle, id);\n\n /* The per-document body — an elevated Card with a bounded preview viewport\n (pdf / image / placeholder) above an always-on Details block. The title is\n NOT rendered here (the PanelHeader owns it, or the tab label in multi mode). */\n const renderBody = (doc: DocumentPreviewDocument): ReactNode => {\n const kind = resolveKind(doc.name, doc.mimeType, doc.src);\n const meta = doc.metadata;\n const PlaceholderIcon = iconForMime(doc.mimeType);\n\n // Preview viewport — the rendered document, or a MIME-icon placeholder when\n // no source resolves. Bounded to a consistent aspect so the Details below\n // stay reachable in the rail.\n let viewport: ReactNode;\n if (kind === 'pdf' && doc.src) {\n viewport = (\n <PDFViewer\n src={doc.src}\n toolbarVariant=\"minimal\"\n // Name the embedded viewer after the document so it stays distinct\n // from the surrounding \"Document preview\" region (nested landmarks\n // must not share an accessible name). Mirrors visible header text.\n ariaLabel={doc.name}\n className=\"ds:h-full ds:w-full\"\n />\n );\n } else if (kind === 'image' && doc.src) {\n viewport = (\n <img\n src={doc.src}\n alt={t('documentPreview.imageAlt', 'Preview of {{name}}', {\n name: doc.name,\n })}\n className=\"ds:max-h-full ds:max-w-full ds:object-contain\"\n />\n );\n } else {\n viewport = (\n <span className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-muted-foreground\">\n <PlaceholderIcon aria-hidden=\"true\" className=\"ds:size-10\" />\n <span className=\"type-body-sm\">\n {t('documentPreview.noPreview', 'No preview available.')}\n </span>\n </span>\n );\n }\n\n // Badges: type / clinical / signature status.\n const status = meta?.signatureStatus;\n const hasBadges =\n Boolean(meta?.documentType) ||\n Boolean(meta?.clinical) ||\n (status !== undefined && status !== 'none');\n\n // Detail rows — every structural field the host supplies, so nothing is\n // dropped when a real preview renders. Only present fields render a row.\n const fmtDate = (iso: string): string =>\n new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }).format(\n new Date(iso),\n );\n const rows: Array<{ key: string; label: string; value: string }> = [];\n if (meta?.createdBy)\n rows.push({\n key: 'createdBy',\n label: t('documentPreview.fields.createdBy', 'Created by'),\n value: meta.createdBy,\n });\n if (meta?.createdAt)\n rows.push({\n key: 'created',\n label: t('documentPreview.fields.created', 'Created'),\n value: fmtDate(meta.createdAt),\n });\n if (meta?.updatedAt)\n rows.push({\n key: 'modified',\n label: t('documentPreview.fields.modified', 'Modified'),\n value: fmtDate(meta.updatedAt),\n });\n if (meta?.signatureRequestedAt)\n rows.push({\n key: 'signatureRequested',\n label: t(\n 'documentPreview.fields.signatureRequested',\n 'Signature requested',\n ),\n value: fmtDate(meta.signatureRequestedAt),\n });\n if (meta?.signedAt)\n rows.push({\n key: 'signed',\n label: t('documentPreview.fields.signed', 'Signed'),\n value: fmtDate(meta.signedAt),\n });\n if (meta?.sharedAt)\n rows.push({\n key: 'sharedWithPatient',\n label: t(\n 'documentPreview.fields.sharedWithPatient',\n 'Shared with patient',\n ),\n value: fmtDate(meta.sharedAt),\n });\n if (meta?.size !== undefined)\n rows.push({\n key: 'size',\n label: t('documentPreview.fields.size', 'Size'),\n value: formatBytes(meta.size, i18n.language, t),\n });\n if (meta?.expiresAt)\n rows.push({\n key: 'expires',\n label: t('documentPreview.fields.expires', 'Expires'),\n value: fmtDate(meta.expiresAt),\n });\n\n const hasDetails = hasBadges || rows.length > 0;\n\n return (\n <div className=\"ds:p-[var(--spacing-md)]\">\n <Card\n variant=\"elevated\"\n className=\"ds:flex ds:flex-col ds:overflow-hidden\"\n >\n <div className=\"ds:flex ds:aspect-[4/3] ds:min-h-0 ds:items-center ds:justify-center ds:overflow-hidden ds:border-b ds:border-[color:var(--card-border)] ds:bg-muted\">\n {viewport}\n </div>\n {hasDetails && (\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <h3 className=\"type-eyebrow ds:m-0 ds:text-muted-foreground\">\n {t('documentPreview.detailsTitle', 'Details')}\n </h3>\n {hasBadges && (\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n {meta?.documentType && (\n <Badge variant=\"neutral\" size=\"sm\">\n {meta.documentType}\n </Badge>\n )}\n {meta?.clinical && (\n <Badge variant=\"info\" size=\"sm\">\n {t('documentPreview.clinical', 'Clinical')}\n </Badge>\n )}\n {status && status !== 'none' && (\n <Badge\n variant={SIGNATURE_VARIANT[status]}\n size=\"sm\"\n withDot\n >\n {t(`documentPreview.signature.${status}`, status)}\n </Badge>\n )}\n </span>\n )}\n {rows.length > 0 && (\n <dl className=\"ds:grid ds:grid-cols-[auto_1fr] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-body-sm\">\n {rows.map((row) => (\n <Fragment key={row.key}>\n <dt className=\"ds:text-muted-foreground\">{row.label}</dt>\n <dd className=\"ds:m-0\">{row.value}</dd>\n </Fragment>\n ))}\n </dl>\n )}\n </Card.Body>\n )}\n </Card>\n </div>\n );\n };\n\n // Header: a MIME icon + the document name for a single doc; a Files glyph +\n // a count badge (RadiographPanel's title-plus-badge shape) when tabbed.\n const HeaderMimeIcon = iconForMime(activeDoc?.mimeType);\n const headerIcon = isTabbed ? (\n <Files aria-hidden=\"true\" />\n ) : (\n <HeaderMimeIcon aria-hidden=\"true\" />\n );\n const headerTitle: ReactNode = isTabbed ? (\n <>\n {t('documentPreview.multiTitle', 'Documents')}\n <Badge variant=\"neutral\" size=\"sm\">\n {docs.length}\n </Badge>\n </>\n ) : (\n activeDoc?.name\n );\n\n let content: ReactNode;\n if (docs.length === 0) {\n content = (\n <EmptyState\n variant=\"first-use\"\n size=\"sm\"\n title={t('documentPreview.emptyTitle', 'No document selected')}\n description={t(\n 'documentPreview.emptyDescription',\n 'Select a document to preview it here.',\n )}\n />\n );\n } else if (isTabbed) {\n content = (\n <Tabs\n value={activeDoc?.id ?? ''}\n onValueChange={setActiveId}\n variant=\"underlined\"\n size=\"sm\"\n // Each tab shows its full file name when there's room and shrinks with\n // an ellipsis only when the tabs would otherwise overflow the width\n // (`min-inline-size:0` lets a tab shrink below its content; the label\n // truncates). The full name stays the accessible name and shows in the\n // body, so nothing is lost.\n className=\"ds:min-h-0 ds:flex-1 ds:pt-[var(--spacing-sm)]\"\n >\n <TabsList\n aria-label={t('documentPreview.tabsLabel', 'Selected documents')}\n className=\"ds:gap-[var(--spacing-sm)]\"\n >\n {docs.map((doc) => {\n const TabIcon = iconForMime(doc.mimeType);\n return (\n <TabsTrigger\n key={doc.id}\n value={doc.id}\n // Match the header glyph: same 16px size (never larger) and the\n // accent tint that marks a file across the grid and the rail.\n icon={\n <TabIcon\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-[color:var(--accent)]\"\n />\n }\n className=\"ds:[min-inline-size:0]\"\n >\n <span className=\"ds:block ds:truncate ds:[min-inline-size:0]\">\n {doc.name}\n </span>\n </TabsTrigger>\n );\n })}\n </TabsList>\n {docs.map((doc) => (\n <TabsContent\n key={doc.id}\n value={doc.id}\n className=\"ds:min-h-0 ds:flex-1\"\n >\n {renderBody(doc)}\n </TabsContent>\n ))}\n </Tabs>\n );\n } else {\n content = renderBody(activeDoc);\n }\n\n return (\n <section\n data-component=\"document-preview\"\n data-component-id={id}\n // The preview body scrolls (PDF pages, tall images, long metadata), so\n // the region needs a keyboard tab stop (axe scrollable-region-focusable).\n // A labelled <section> is a region landmark, which also scopes the\n // PanelHeader's <header> so it is never exposed as a page banner.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- keyboard-focusable scroll region (see comment above)\n tabIndex={0}\n aria-label={t('documentPreview.regionLabel', 'Document preview')}\n className={documentPreviewVariants({ className })}\n >\n {docs.length > 0 && (\n <PanelHeader sticky icon={headerIcon} title={headerTitle} />\n )}\n {content}\n </section>\n );\n});\n\nDocumentPreview.displayName = 'DocumentPreview';\n"],"names":["__iconNode","Files","createLucideIcon","documentPreviewAgent","handle","documentPreviewVariants","cva","SIGNATURE_VARIANT","resolveKind","name","mimeType","src","mime","iconForMime","FileImage","FileText","FileIcon","UNIT_KEYS","UNIT_FALLBACKS","formatBytes","bytes","locale","t","value","unitIndex","DocumentPreview","forwardRef","id","metadata","documents","className","ref","i18n","useTranslation","docs","useMemo","isTabbed","activeId","setActiveId","useState","activeDoc","doc","useImperativeHandle","useAgentRegistration","renderBody","kind","meta","PlaceholderIcon","viewport","jsx","PDFViewer","jsxs","status","hasBadges","fmtDate","iso","rows","hasDetails","Card","Badge","row","Fragment","HeaderMimeIcon","headerIcon","headerTitle","content","EmptyState","Tabs","TabsList","TabIcon","TabsTrigger","TabsContent","PanelHeader"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,6DAA6D,KAAK,SAAQ,CAAE;AAAA,EAC1F;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;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AY,EAAK,IAAI,CAACO,MAAQ;AACjB,oBAAM4B,IAAUxD,EAAY4B,EAAI,QAAQ;AACxC,qBACE,gBAAAQ;AAAA,gBAACqB;AAAA,gBAAA;AAAA,kBAEC,OAAO7B,EAAI;AAAA,kBAGX,MACE,gBAAAQ;AAAA,oBAACoB;AAAA,oBAAA;AAAA,sBACC,eAAY;AAAA,sBACZ,WAAU;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAGd,WAAU;AAAA,kBAEV,UAAA,gBAAApB,EAAC,QAAA,EAAK,WAAU,+CACb,YAAI,KAAA,CACP;AAAA,gBAAA;AAAA,gBAdKR,EAAI;AAAA,cAAA;AAAA,YAiBf,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,QAEFP,EAAK,IAAI,CAACO,MACT,gBAAAQ;AAAA,UAACsB;AAAA,UAAA;AAAA,YAEC,OAAO9B,EAAI;AAAA,YACX,WAAU;AAAA,YAET,YAAWA,CAAG;AAAA,UAAA;AAAA,UAJVA,EAAI;AAAA,QAAA,CAMZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAILwB,IAAUrB,EAAWJ,CAAS,GAI9B,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,kBAAe;AAAA,MACf,qBAAmBxB;AAAA,MAMnB,UAAU;AAAA,MACV,cAAYL,EAAE,+BAA+B,kBAAkB;AAAA,MAC/D,WAAWjB,GAAwB,EAAE,WAAAyB,GAAW;AAAA,MAE/C,UAAA;AAAA,QAAAI,EAAK,SAAS,KACb,gBAAAe,EAACuB,GAAA,EAAY,QAAM,IAAC,MAAMT,GAAY,OAAOC,EAAA,CAAa;AAAA,QAE3DC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAEDxC,GAAgB,cAAc;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"document-preview-VXOQZZvy.js","sources":["../../node_modules/lucide-react/dist/esm/icons/files.mjs","../../src/components/document-preview/document-preview.agent.ts","../../src/components/document-preview/document-preview.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8\", key: \"14sh0y\" }],\n [\n \"path\",\n {\n d: \"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z\",\n key: \"1970lx\"\n }\n ],\n [\"path\", { d: \"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1\", key: \"l4dndm\" }]\n];\nconst Files = createLucideIcon(\"files\", __iconNode);\n\nexport { __iconNode, Files as default };\n//# sourceMappingURL=files.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentPreview. */\n/* */\n/* A passive, read-only viewer, so it declares no interactive */\n/* capabilities. The always-on state slot carries only the structural */\n/* render `kind` (pdf / image / metadata / empty) — never the document */\n/* name. */\n/* */\n/* PHI rule (PRS §26 §7): the document display name can identify a */\n/* patient (e.g. \"Rossi Maria — referto 2026.pdf\"). It renders as text */\n/* (fine) but the only name-returning read is the deliberate get_name */\n/* action with `safety: 'phi'`, so the host gates it behind confirm + */\n/* audit. No name is ever emitted in a data-* hook. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentPreviewHandle } from './document-preview';\n\nexport const documentPreviewAgent: AgentAdapter<DocumentPreviewHandle> = {\n id: 'document-preview',\n capabilities: [],\n state: {\n kind: {\n type: \"'pdf' | 'image' | 'metadata' | 'empty'\",\n descriptionKey: 'ui.agent.documentPreview.state.kind',\n description:\n 'Which render branch is active: pdf, image, metadata (no inline preview), or empty (no document). Structural — never the document name.',\n read: (handle) => handle.getKind(),\n },\n },\n actions: {\n get_name: {\n // phi (not read): resolves the document display name, which can identify\n // patients. PRS §26 — phi outranks read so the host gates it behind\n // stricter confirm + audit. The always-on kind slot stays name-free.\n safety: 'phi',\n returns: 'string | undefined',\n returnsSchema: { type: ['string', 'null'] },\n idempotent: true,\n descriptionKey: 'ui.agent.documentPreview.actions.getName',\n description:\n 'Read the display name of the previewed document. May identify a patient (PHI).',\n invoke: (handle) => handle.getName(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-preview',\n description: 'Marks the DocumentPreview region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* -------------------------------------------------------------------- */\n/* DocumentPreview — a standalone, reusable document viewer. */\n/* */\n/* Decoupled from FileManager: it takes primitive props (name, mimeType, */\n/* src, metadata) rather than a FileManagerItem, so signing, the patient */\n/* portal, and the Control Room rail can all reuse it. The body is an */\n/* elevated Card: a bounded preview viewport (PDF → kit PDFViewer; */\n/* image/* → <img>; otherwise a MIME-icon placeholder) above an always-on */\n/* Details block (badges + every structural field the host supplies), so */\n/* the metadata is never dropped when a real preview renders. No name → */\n/* EmptyState. */\n/* */\n/* Title lives in the canonical PanelHeader (the same header every rail */\n/* panel adopts) so the Control Room rail can inject its pin / close */\n/* controls into it. Pass `documents` (≥ 2) to preview a SELECTION as */\n/* tabs — one tab per document, the active one shown below; a single */\n/* entry (or the single-document props) renders without a tab strip. */\n/* */\n/* The root is a `<section>` (region landmark) so the PanelHeader's */\n/* <header> is scoped and never exposed as a page banner — the same */\n/* shape RadiographPanel uses. It is also a keyboard-focusable scroll */\n/* region (tabIndex 0 + labelled focus ring). */\n/* */\n/* PHI: the visible name renders as text (fine), but the only */\n/* name-returning handle read is surfaced by document-preview.agent.ts */\n/* as a `safety: 'phi'` action — never in always-on state, never in a */\n/* data-* hook. In tabbed mode the handle reflects the ACTIVE tab. */\n/* -------------------------------------------------------------------- */\n\nimport {\n forwardRef,\n Fragment,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n File as FileIcon,\n FileImage,\n FileText,\n Files,\n type LucideIcon,\n} from 'lucide-react';\nimport { Badge } from '../badge';\nimport { Card } from '../card';\nimport { EmptyState } from '../empty-state';\nimport { PanelHeader } from '../panel-header';\nimport { PDFViewer } from '../pdf-viewer';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../tabs';\nimport { useAgentRegistration } from '../../agent';\nimport { documentPreviewAgent } from './document-preview.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentPreviewSignatureStatus = 'none' | 'pending' | 'signed';\n\n/** Which render branch DocumentPreview is showing — structural, never PHI. */\nexport type DocumentPreviewKind = 'pdf' | 'image' | 'metadata' | 'empty';\n\nexport interface DocumentPreviewMetadata {\n /** Size in bytes. */\n size?: number;\n /** Display name of whoever created the document (host-supplied). */\n createdBy?: string;\n /** ISO 8601 timestamp the document was created. */\n createdAt?: string;\n /** ISO 8601 timestamp of the last modification. */\n updatedAt?: string;\n /** ISO 8601 timestamp a signature was requested from the patient. */\n signatureRequestedAt?: string;\n /** ISO 8601 timestamp the document was signed. */\n signedAt?: string;\n /** ISO 8601 timestamp the document was shared with the patient. */\n sharedAt?: string;\n /** Open document-type category (non-identifying), e.g. `'xray'`. */\n documentType?: string;\n /** Signature workflow state. */\n signatureStatus?: DocumentPreviewSignatureStatus;\n /** Clinical-document flag (host-defined semantics). */\n clinical?: boolean;\n /** ISO 8601 expiry (e.g. identification documents). */\n expiresAt?: string;\n}\n\n/**\n * A single previewable document. In multi-document mode each becomes a tab;\n * `id` is the tab value (never a patient name) and `name` is the tab label.\n */\nexport interface DocumentPreviewDocument {\n /** Stable, non-identifying id. Emitted as the tab value — never PHI. */\n id: string;\n /** Display name (PHI). Also the tab label in multi-document mode. */\n name: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n}\n\nexport interface DocumentPreviewProps extends VariantProps<\n typeof documentPreviewVariants\n> {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Display name. Absent (and no `documents`) → empty state. PHI. */\n name?: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. The host owns auth. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n /**\n * Multiple documents to preview as tabs — e.g. a multi-row selection. Two\n * or more render a tab per document (label = name) with the active one\n * shown below; a single entry renders without a tab strip. When non-empty\n * this takes precedence over the single-document props. Names are PHI.\n */\n documents?: DocumentPreviewDocument[];\n className?: string;\n}\n\nexport interface DocumentPreviewHandle {\n /** Which render branch is active — structural, safe for always-on reads. */\n getKind: () => DocumentPreviewKind;\n /** The active document's display name (PHI). Surfaced by the adapter as a `phi` action. */\n getName: () => string | undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst documentPreviewVariants = cva(\n [\n 'ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:overflow-auto',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring',\n ].join(' '),\n);\n\nconst SIGNATURE_VARIANT: Record<\n Exclude<DocumentPreviewSignatureStatus, 'none'>,\n 'success' | 'warning'\n> = {\n signed: 'success',\n pending: 'warning',\n};\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction resolveKind(\n name: string | undefined,\n mimeType: string | undefined,\n src: string | undefined,\n): DocumentPreviewKind {\n if (!name) return 'empty';\n const mime = mimeType ?? '';\n if (mime === 'application/pdf' && src) return 'pdf';\n if (mime.startsWith('image/') && src) return 'image';\n return 'metadata';\n}\n\n/** Fallback icon for the header / metadata card — a small MIME-family lookup. */\nfunction iconForMime(mimeType: string | undefined): LucideIcon {\n const mime = mimeType ?? '';\n if (mime.startsWith('image/')) return FileImage;\n if (\n mime === 'application/pdf' ||\n mime.startsWith('text/') ||\n mime.includes('word')\n ) {\n return FileText;\n }\n return FileIcon;\n}\n\nconst UNIT_KEYS = [\n 'documentPreview.units.bytes',\n 'documentPreview.units.kilobytes',\n 'documentPreview.units.megabytes',\n 'documentPreview.units.gigabytes',\n] as const;\n\nconst UNIT_FALLBACKS = ['B', 'KB', 'MB', 'GB'] as const;\n\nfunction formatBytes(\n bytes: number,\n locale: string,\n t: (key: string, fallback: string) => string,\n): string {\n let value = bytes;\n let unitIndex = 0;\n while (value >= 1024 && unitIndex < UNIT_FALLBACKS.length - 1) {\n value /= 1024;\n unitIndex++;\n }\n const formatted = new Intl.NumberFormat(locale, {\n maximumFractionDigits: unitIndex === 0 ? 0 : 1,\n }).format(value);\n return `${formatted} ${t(UNIT_KEYS[unitIndex], UNIT_FALLBACKS[unitIndex])}`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const DocumentPreview = forwardRef<\n DocumentPreviewHandle,\n DocumentPreviewProps\n>(({ id, name, mimeType, src, metadata, documents, className }, ref) => {\n const { t, i18n } = useTranslation('ui');\n\n // Resolve the document list: an explicit `documents` list wins; otherwise\n // the single-document props form a one-item list; nothing → empty. The\n // synthetic single-doc id is never emitted as a tab value (a lone doc\n // renders without a tab strip), so falling back to the name is PHI-safe.\n const docs = useMemo<DocumentPreviewDocument[]>(() => {\n if (documents && documents.length > 0) return documents;\n if (name) return [{ id: id ?? name, name, mimeType, src, metadata }];\n return [];\n }, [documents, id, name, mimeType, src, metadata]);\n\n const isTabbed = docs.length > 1;\n\n // Active tab (multi mode). When the current id is stale after the selection\n // changes we fall back to the first document — no reconciling effect needed.\n const [activeId, setActiveId] = useState<string | undefined>(undefined);\n const activeDoc = docs.find((doc) => doc.id === activeId) ?? docs[0];\n\n const handle = useMemo<DocumentPreviewHandle>(\n () => ({\n getKind: () =>\n activeDoc\n ? resolveKind(activeDoc.name, activeDoc.mimeType, activeDoc.src)\n : 'empty',\n getName: () => activeDoc?.name,\n }),\n [activeDoc],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(documentPreviewAgent, handle, id);\n\n /* The per-document body — an elevated Card with a bounded preview viewport\n (pdf / image / placeholder) above an always-on Details block. The title is\n NOT rendered here (the PanelHeader owns it, or the tab label in multi mode). */\n const renderBody = (doc: DocumentPreviewDocument): ReactNode => {\n const kind = resolveKind(doc.name, doc.mimeType, doc.src);\n const meta = doc.metadata;\n const PlaceholderIcon = iconForMime(doc.mimeType);\n\n // Preview viewport — the rendered document, or a MIME-icon placeholder when\n // no source resolves. Bounded to a consistent aspect so the Details below\n // stay reachable in the rail.\n let viewport: ReactNode;\n if (kind === 'pdf' && doc.src) {\n viewport = (\n <PDFViewer\n src={doc.src}\n toolbarVariant=\"minimal\"\n // Name the embedded viewer after the document so it stays distinct\n // from the surrounding \"Document preview\" region (nested landmarks\n // must not share an accessible name). Mirrors visible header text.\n ariaLabel={doc.name}\n className=\"ds:h-full ds:w-full\"\n />\n );\n } else if (kind === 'image' && doc.src) {\n viewport = (\n <img\n src={doc.src}\n alt={t('documentPreview.imageAlt', 'Preview of {{name}}', {\n name: doc.name,\n })}\n className=\"ds:max-h-full ds:max-w-full ds:object-contain\"\n />\n );\n } else {\n viewport = (\n <span className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-muted-foreground\">\n <PlaceholderIcon aria-hidden=\"true\" className=\"ds:size-10\" />\n <span className=\"type-body-sm\">\n {t('documentPreview.noPreview', 'No preview available.')}\n </span>\n </span>\n );\n }\n\n // Badges: type / clinical / signature status.\n const status = meta?.signatureStatus;\n const hasBadges =\n Boolean(meta?.documentType) ||\n Boolean(meta?.clinical) ||\n (status !== undefined && status !== 'none');\n\n // Detail rows — every structural field the host supplies, so nothing is\n // dropped when a real preview renders. Only present fields render a row.\n const fmtDate = (iso: string): string =>\n new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }).format(\n new Date(iso),\n );\n const rows: Array<{ key: string; label: string; value: string }> = [];\n if (meta?.createdBy)\n rows.push({\n key: 'createdBy',\n label: t('documentPreview.fields.createdBy', 'Created by'),\n value: meta.createdBy,\n });\n if (meta?.createdAt)\n rows.push({\n key: 'created',\n label: t('documentPreview.fields.created', 'Created'),\n value: fmtDate(meta.createdAt),\n });\n if (meta?.updatedAt)\n rows.push({\n key: 'modified',\n label: t('documentPreview.fields.modified', 'Modified'),\n value: fmtDate(meta.updatedAt),\n });\n if (meta?.signatureRequestedAt)\n rows.push({\n key: 'signatureRequested',\n label: t(\n 'documentPreview.fields.signatureRequested',\n 'Signature requested',\n ),\n value: fmtDate(meta.signatureRequestedAt),\n });\n if (meta?.signedAt)\n rows.push({\n key: 'signed',\n label: t('documentPreview.fields.signed', 'Signed'),\n value: fmtDate(meta.signedAt),\n });\n if (meta?.sharedAt)\n rows.push({\n key: 'sharedWithPatient',\n label: t(\n 'documentPreview.fields.sharedWithPatient',\n 'Shared with patient',\n ),\n value: fmtDate(meta.sharedAt),\n });\n if (meta?.size !== undefined)\n rows.push({\n key: 'size',\n label: t('documentPreview.fields.size', 'Size'),\n value: formatBytes(meta.size, i18n.language, t),\n });\n if (meta?.expiresAt)\n rows.push({\n key: 'expires',\n label: t('documentPreview.fields.expires', 'Expires'),\n value: fmtDate(meta.expiresAt),\n });\n\n const hasDetails = hasBadges || rows.length > 0;\n\n return (\n <div className=\"ds:p-[var(--spacing-md)]\">\n <Card\n variant=\"elevated\"\n className=\"ds:flex ds:flex-col ds:overflow-hidden\"\n >\n <div className=\"ds:flex ds:aspect-[4/3] ds:min-h-0 ds:items-center ds:justify-center ds:overflow-hidden ds:border-b ds:border-[color:var(--card-border)] ds:bg-muted\">\n {viewport}\n </div>\n {hasDetails && (\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <h3 className=\"type-eyebrow ds:m-0 ds:text-muted-foreground\">\n {t('documentPreview.detailsTitle', 'Details')}\n </h3>\n {hasBadges && (\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n {meta?.documentType && (\n <Badge variant=\"neutral\" size=\"sm\">\n {meta.documentType}\n </Badge>\n )}\n {meta?.clinical && (\n <Badge variant=\"info\" size=\"sm\">\n {t('documentPreview.clinical', 'Clinical')}\n </Badge>\n )}\n {status && status !== 'none' && (\n <Badge\n variant={SIGNATURE_VARIANT[status]}\n size=\"sm\"\n withDot\n >\n {t(`documentPreview.signature.${status}`, status)}\n </Badge>\n )}\n </span>\n )}\n {rows.length > 0 && (\n <dl className=\"ds:grid ds:grid-cols-[auto_1fr] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-body-sm\">\n {rows.map((row) => (\n <Fragment key={row.key}>\n <dt className=\"ds:text-muted-foreground\">{row.label}</dt>\n <dd className=\"ds:m-0\">{row.value}</dd>\n </Fragment>\n ))}\n </dl>\n )}\n </Card.Body>\n )}\n </Card>\n </div>\n );\n };\n\n // Header: a MIME icon + the document name for a single doc; a Files glyph +\n // a count badge (RadiographPanel's title-plus-badge shape) when tabbed.\n const HeaderMimeIcon = iconForMime(activeDoc?.mimeType);\n const headerIcon = isTabbed ? (\n <Files aria-hidden=\"true\" />\n ) : (\n <HeaderMimeIcon aria-hidden=\"true\" />\n );\n const headerTitle: ReactNode = isTabbed ? (\n <>\n {t('documentPreview.multiTitle', 'Documents')}\n <Badge variant=\"neutral\" size=\"sm\">\n {docs.length}\n </Badge>\n </>\n ) : (\n activeDoc?.name\n );\n\n let content: ReactNode;\n if (docs.length === 0) {\n content = (\n <EmptyState\n variant=\"first-use\"\n size=\"sm\"\n title={t('documentPreview.emptyTitle', 'No document selected')}\n description={t(\n 'documentPreview.emptyDescription',\n 'Select a document to preview it here.',\n )}\n />\n );\n } else if (isTabbed) {\n content = (\n <Tabs\n value={activeDoc?.id ?? ''}\n onValueChange={setActiveId}\n variant=\"underlined\"\n size=\"sm\"\n // Each tab shows its full file name when there's room and shrinks with\n // an ellipsis only when the tabs would otherwise overflow the width\n // (`min-inline-size:0` lets a tab shrink below its content; the label\n // truncates). The full name stays the accessible name and shows in the\n // body, so nothing is lost.\n className=\"ds:min-h-0 ds:flex-1 ds:pt-[var(--spacing-sm)]\"\n >\n <TabsList\n aria-label={t('documentPreview.tabsLabel', 'Selected documents')}\n className=\"ds:gap-[var(--spacing-sm)]\"\n >\n {docs.map((doc) => {\n const TabIcon = iconForMime(doc.mimeType);\n return (\n <TabsTrigger\n key={doc.id}\n value={doc.id}\n // Match the header glyph: same 16px size (never larger) and the\n // accent tint that marks a file across the grid and the rail.\n icon={\n <TabIcon\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-[color:var(--accent)]\"\n />\n }\n className=\"ds:[min-inline-size:0]\"\n >\n <span className=\"ds:block ds:truncate ds:[min-inline-size:0]\">\n {doc.name}\n </span>\n </TabsTrigger>\n );\n })}\n </TabsList>\n {docs.map((doc) => (\n <TabsContent\n key={doc.id}\n value={doc.id}\n className=\"ds:min-h-0 ds:flex-1\"\n >\n {renderBody(doc)}\n </TabsContent>\n ))}\n </Tabs>\n );\n } else {\n content = renderBody(activeDoc);\n }\n\n return (\n <section\n data-component=\"document-preview\"\n data-component-id={id}\n // The preview body scrolls (PDF pages, tall images, long metadata), so\n // the region needs a keyboard tab stop (axe scrollable-region-focusable).\n // A labelled <section> is a region landmark, which also scopes the\n // PanelHeader's <header> so it is never exposed as a page banner.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- keyboard-focusable scroll region (see comment above)\n tabIndex={0}\n aria-label={t('documentPreview.regionLabel', 'Document preview')}\n className={documentPreviewVariants({ className })}\n >\n {docs.length > 0 && (\n <PanelHeader sticky icon={headerIcon} title={headerTitle} />\n )}\n {content}\n </section>\n );\n});\n\nDocumentPreview.displayName = 'DocumentPreview';\n"],"names":["__iconNode","Files","createLucideIcon","documentPreviewAgent","handle","documentPreviewVariants","cva","SIGNATURE_VARIANT","resolveKind","name","mimeType","src","mime","iconForMime","FileImage","FileText","FileIcon","UNIT_KEYS","UNIT_FALLBACKS","formatBytes","bytes","locale","t","value","unitIndex","DocumentPreview","forwardRef","id","metadata","documents","className","ref","i18n","useTranslation","docs","useMemo","isTabbed","activeId","setActiveId","useState","activeDoc","doc","useImperativeHandle","useAgentRegistration","renderBody","kind","meta","PlaceholderIcon","viewport","jsx","PDFViewer","jsxs","status","hasBadges","fmtDate","iso","rows","hasDetails","Card","Badge","row","Fragment","HeaderMimeIcon","headerIcon","headerTitle","content","EmptyState","Tabs","TabsList","TabIcon","TabsTrigger","TabsContent","PanelHeader"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,6DAA6D,KAAK,SAAQ,CAAE;AAAA,EAC1F;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,2DAA2D,KAAK,SAAQ,CAAE;AAC1F,GACMC,KAAQC,GAAiB,SAASF,EAAU,GCFrCG,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAAA,EACnC;AAAA,EAEF,SAAS;AAAA,IACP,UAAU;AAAA;AAAA;AAAA;AAAA,MAIR,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,eAAe,EAAE,MAAM,CAAC,UA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ACO,MACT,gBAAAQ;AAAA,UAACsB;AAAA,UAAA;AAAA,YAEC,OAAO9B,EAAI;AAAA,YACX,WAAU;AAAA,YAET,YAAWA,CAAG;AAAA,UAAA;AAAA,UAJVA,EAAI;AAAA,QAAA,CAMZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAILwB,IAAUrB,EAAWJ,CAAS,GAI9B,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,kBAAe;AAAA,MACf,qBAAmBxB;AAAA,MAMnB,UAAU;AAAA,MACV,cAAYL,EAAE,+BAA+B,kBAAkB;AAAA,MAC/D,WAAWjB,GAAwB,EAAE,WAAAyB,GAAW;AAAA,MAE/C,UAAA;AAAA,QAAAI,EAAK,SAAS,KACb,gBAAAe,EAACuB,GAAA,EAAY,QAAM,IAAC,MAAMT,GAAY,OAAOC,EAAA,CAAa;AAAA,QAE3DC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAEDxC,GAAgB,cAAc;","x_google_ignoreList":[0]}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { jsx as e, jsxs as d, Fragment as U } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
2
|
+
import { forwardRef as p, useId as H, useRef as P, useState as F, useCallback as N, useEffect as q, useContext as x, createContext as M } from "react";
|
|
3
3
|
import { c as m } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as Z } from "react-i18next";
|
|
5
|
-
import { B as
|
|
5
|
+
import { B as v } from "./button-CYPx2xFq.js";
|
|
6
|
+
function _() {
|
|
7
|
+
try {
|
|
8
|
+
return process.env.NODE_ENV !== "production";
|
|
9
|
+
} catch {
|
|
10
|
+
return !1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
6
13
|
function G(t, s) {
|
|
7
14
|
t && (typeof t == "function" ? t(s) : t.current = s);
|
|
8
15
|
}
|
|
@@ -85,7 +92,7 @@ function Y() {
|
|
|
85
92
|
}
|
|
86
93
|
);
|
|
87
94
|
}
|
|
88
|
-
function
|
|
95
|
+
function $() {
|
|
89
96
|
return /* @__PURE__ */ d(
|
|
90
97
|
"svg",
|
|
91
98
|
{
|
|
@@ -124,7 +131,7 @@ function _() {
|
|
|
124
131
|
}
|
|
125
132
|
);
|
|
126
133
|
}
|
|
127
|
-
function
|
|
134
|
+
function A() {
|
|
128
135
|
return /* @__PURE__ */ d(
|
|
129
136
|
"svg",
|
|
130
137
|
{
|
|
@@ -172,8 +179,8 @@ function $() {
|
|
|
172
179
|
}
|
|
173
180
|
);
|
|
174
181
|
}
|
|
175
|
-
const
|
|
176
|
-
const { size: i } =
|
|
182
|
+
const g = p(({ children: t, className: s, ...a }, r) => {
|
|
183
|
+
const { size: i } = x(h);
|
|
177
184
|
return /* @__PURE__ */ e(
|
|
178
185
|
"div",
|
|
179
186
|
{
|
|
@@ -185,18 +192,18 @@ const v = u(({ children: t, className: s, ...a }, r) => {
|
|
|
185
192
|
}
|
|
186
193
|
);
|
|
187
194
|
});
|
|
188
|
-
|
|
189
|
-
const w =
|
|
190
|
-
const { size: i, titleId: l, registerTitle:
|
|
191
|
-
(
|
|
192
|
-
|
|
195
|
+
g.displayName = "EmptyState.Illustration";
|
|
196
|
+
const w = p(({ children: t, className: s, ...a }, r) => {
|
|
197
|
+
const { size: i, titleId: l, registerTitle: f } = x(h), c = N(
|
|
198
|
+
(u) => {
|
|
199
|
+
u && f(), typeof r == "function" ? r(u) : r && (r.current = u);
|
|
193
200
|
},
|
|
194
|
-
[r,
|
|
201
|
+
[r, f]
|
|
195
202
|
);
|
|
196
203
|
return /* @__PURE__ */ e(
|
|
197
204
|
"h3",
|
|
198
205
|
{
|
|
199
|
-
ref:
|
|
206
|
+
ref: c,
|
|
200
207
|
id: l,
|
|
201
208
|
className: Q({ size: i, className: s }),
|
|
202
209
|
...a,
|
|
@@ -205,8 +212,8 @@ const w = u(({ children: t, className: s, ...a }, r) => {
|
|
|
205
212
|
);
|
|
206
213
|
});
|
|
207
214
|
w.displayName = "EmptyState.Title";
|
|
208
|
-
const S =
|
|
209
|
-
const { size: i } =
|
|
215
|
+
const S = p(({ children: t, className: s, ...a }, r) => {
|
|
216
|
+
const { size: i } = x(h);
|
|
210
217
|
return /* @__PURE__ */ e(
|
|
211
218
|
"p",
|
|
212
219
|
{
|
|
@@ -218,11 +225,11 @@ const S = u(({ children: t, className: s, ...a }, r) => {
|
|
|
218
225
|
);
|
|
219
226
|
});
|
|
220
227
|
S.displayName = "EmptyState.Description";
|
|
221
|
-
const
|
|
228
|
+
const tt = m(
|
|
222
229
|
"ds:flex ds:flex-row ds:flex-wrap ds:items-center ds:justify-center ds:gap-[var(--spacing-md)]"
|
|
223
|
-
), k =
|
|
230
|
+
), k = p(({ children: t, className: s, ...a }, r) => /* @__PURE__ */ e("div", { ref: r, className: tt({ className: s }), ...a, children: t }));
|
|
224
231
|
k.displayName = "EmptyState.Actions";
|
|
225
|
-
const C =
|
|
232
|
+
const C = p(
|
|
226
233
|
({
|
|
227
234
|
variant: t,
|
|
228
235
|
size: s = "md",
|
|
@@ -230,63 +237,67 @@ const C = u(
|
|
|
230
237
|
description: r,
|
|
231
238
|
primaryAction: i,
|
|
232
239
|
secondaryAction: l,
|
|
233
|
-
autoFocus:
|
|
234
|
-
children:
|
|
235
|
-
className:
|
|
236
|
-
...
|
|
237
|
-
},
|
|
238
|
-
const { t: n } = Z("ui")
|
|
240
|
+
autoFocus: f = !1,
|
|
241
|
+
children: c,
|
|
242
|
+
className: u,
|
|
243
|
+
...T
|
|
244
|
+
}, I) => {
|
|
245
|
+
const { t: n } = Z("ui");
|
|
246
|
+
_() && c != null && (a !== void 0 || r !== void 0 || i !== void 0 || l !== void 0) && console.warn(
|
|
247
|
+
"[EmptyState] `title`, `description`, `primaryAction` and `secondaryAction` are ignored when children are passed. Put EmptyState.Title, EmptyState.Description and EmptyState.Actions in the children instead, or drop the children."
|
|
248
|
+
);
|
|
249
|
+
const z = H(), E = P(null), [R, V] = F(!1), D = N(() => V(!0), []);
|
|
239
250
|
q(() => {
|
|
240
|
-
var
|
|
241
|
-
if (!
|
|
242
|
-
const o = (
|
|
251
|
+
var b;
|
|
252
|
+
if (!f) return;
|
|
253
|
+
const o = (b = E.current) == null ? void 0 : b.querySelector(
|
|
243
254
|
"button:not([disabled]), a[href]"
|
|
244
255
|
);
|
|
245
256
|
o == null || o.focus();
|
|
246
257
|
}, []);
|
|
247
|
-
const
|
|
258
|
+
const j = t === "no-results" ? { role: "status", "aria-live": "polite" } : { role: "region" }, O = n(t === "first-use" ? "emptyState.firstUse.title" : t === "no-results" ? "emptyState.noResults.title" : "emptyState.error.title"), L = n(t === "first-use" ? "emptyState.firstUse.description" : t === "no-results" ? "emptyState.noResults.description" : "emptyState.error.description"), W = n(t === "first-use" ? "emptyState.firstUse.cta" : t === "no-results" ? "emptyState.noResults.cta" : "emptyState.error.cta"), y = s === "sm" ? "sm" : "md", B = (o) => /^(https?:\/\/|\/|#)/.test(o) ? o : "#";
|
|
248
259
|
return /* @__PURE__ */ e(
|
|
249
260
|
h.Provider,
|
|
250
261
|
{
|
|
251
|
-
value: { size: s, variant: t, titleId: z, registerTitle:
|
|
262
|
+
value: { size: s, variant: t, titleId: z, registerTitle: D },
|
|
252
263
|
children: /* @__PURE__ */ e(
|
|
253
264
|
"div",
|
|
254
265
|
{
|
|
255
266
|
ref: (o) => {
|
|
256
|
-
|
|
267
|
+
E.current = o, G(I, o);
|
|
257
268
|
},
|
|
258
|
-
"aria-labelledby":
|
|
259
|
-
...
|
|
260
|
-
className: J({ size: s, className:
|
|
269
|
+
"aria-labelledby": R || !c ? z : void 0,
|
|
270
|
+
...j,
|
|
271
|
+
className: J({ size: s, className: u }),
|
|
261
272
|
"data-component": "empty-state",
|
|
262
|
-
...
|
|
263
|
-
children:
|
|
264
|
-
/* @__PURE__ */ d(
|
|
273
|
+
...T,
|
|
274
|
+
children: c ?? /* @__PURE__ */ d(U, { children: [
|
|
275
|
+
/* @__PURE__ */ d(g, { children: [
|
|
265
276
|
t === "first-use" && /* @__PURE__ */ e(Y, {}),
|
|
266
|
-
t === "no-results" && /* @__PURE__ */ e(
|
|
267
|
-
t === "error" && /* @__PURE__ */ e(
|
|
277
|
+
t === "no-results" && /* @__PURE__ */ e($, {}),
|
|
278
|
+
t === "error" && /* @__PURE__ */ e(A, {})
|
|
268
279
|
] }),
|
|
269
280
|
/* @__PURE__ */ e(w, { children: a ?? O }),
|
|
270
|
-
/* @__PURE__ */ e(S, { children: r ??
|
|
281
|
+
/* @__PURE__ */ e(S, { children: r ?? L }),
|
|
271
282
|
(i || l) && /* @__PURE__ */ d(k, { children: [
|
|
272
283
|
i && /* @__PURE__ */ e(
|
|
273
|
-
|
|
284
|
+
v,
|
|
274
285
|
{
|
|
275
286
|
intent: "primary",
|
|
276
287
|
size: y,
|
|
277
288
|
onClick: i.onClick,
|
|
278
|
-
children: i.label ??
|
|
289
|
+
children: i.label ?? W
|
|
279
290
|
}
|
|
280
291
|
),
|
|
281
|
-
l && (l.href ? /* @__PURE__ */ e(
|
|
292
|
+
l && (l.href ? /* @__PURE__ */ e(v, { intent: "ghost", size: y, asChild: !0, children: /* @__PURE__ */ e(
|
|
282
293
|
"a",
|
|
283
294
|
{
|
|
284
|
-
href:
|
|
295
|
+
href: B(l.href),
|
|
285
296
|
onClick: l.onClick,
|
|
286
297
|
children: l.label
|
|
287
298
|
}
|
|
288
299
|
) }) : /* @__PURE__ */ e(
|
|
289
|
-
|
|
300
|
+
v,
|
|
290
301
|
{
|
|
291
302
|
intent: "ghost",
|
|
292
303
|
size: y,
|
|
@@ -303,13 +314,13 @@ const C = u(
|
|
|
303
314
|
}
|
|
304
315
|
);
|
|
305
316
|
C.displayName = "EmptyState";
|
|
306
|
-
const
|
|
307
|
-
Illustration:
|
|
317
|
+
const at = Object.assign(C, {
|
|
318
|
+
Illustration: g,
|
|
308
319
|
Title: w,
|
|
309
320
|
Description: S,
|
|
310
321
|
Actions: k
|
|
311
322
|
});
|
|
312
323
|
export {
|
|
313
|
-
|
|
324
|
+
at as E
|
|
314
325
|
};
|
|
315
|
-
//# sourceMappingURL=empty-state-
|
|
326
|
+
//# sourceMappingURL=empty-state-C62P_6kr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-state-C62P_6kr.js","sources":["../../src/components/_shared/is-development.ts","../../src/components/empty-state/empty-state.tsx"],"sourcesContent":["declare const process: { env: { NODE_ENV?: string } };\n\n/**\n * True in a consumer's development build. `import.meta.env.DEV` cannot say\n * so: the kit's own library build replaces it with `false`. Bundlers leave\n * `process.env.NODE_ENV` for the consumer's build to fill in, and where\n * nothing defines `process` this is simply false.\n */\nexport function isDevelopment(): boolean {\n try {\n return process.env.NODE_ENV !== 'production';\n } catch {\n return false;\n }\n}\n","import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Button } from '../button/button';\nimport { isDevelopment } from '../_shared/is-development';\n\n/* ------------------------------------------------------------------ */\n/* Ref helper */\n/* ------------------------------------------------------------------ */\n\nfunction setRef<T>(ref: Ref<T>, value: T | null) {\n if (!ref) return;\n if (typeof ref === 'function') ref(value);\n else (ref as { current: T | null }).current = value;\n}\n\n/* ------------------------------------------------------------------ */\n/* Context */\n/* ------------------------------------------------------------------ */\n\ninterface EmptyStateContextValue {\n size: 'sm' | 'md' | 'lg';\n variant: 'first-use' | 'no-results' | 'error';\n titleId: string;\n registerTitle: () => void;\n}\n\nconst EmptyStateContext = createContext<EmptyStateContextValue>({\n size: 'md',\n variant: 'first-use',\n titleId: '',\n registerTitle: () => {},\n});\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst emptyStateVariants = cva(\n 'ds:flex ds:flex-col ds:items-center ds:text-center ds:max-w-md ds:ms-auto ds:me-auto ds:w-full',\n {\n variants: {\n size: {\n sm: 'ds:p-[var(--spacing-md)] ds:gap-[var(--spacing-sm)]',\n md: 'ds:p-[var(--spacing-lg)] ds:gap-[var(--spacing-md)]',\n lg: 'ds:p-[var(--spacing-lg)] ds:gap-[var(--spacing-md)]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst illustrationVariants = cva(\n 'ds:flex ds:items-center ds:justify-center ds:flex-shrink-0',\n {\n variants: {\n size: {\n sm: 'ds:w-[80px] ds:h-[80px]',\n md: 'ds:w-[160px] ds:h-[160px]',\n lg: 'ds:w-[240px] ds:h-[240px]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst titleVariants = cva('type-title-card ds:text-[var(--foreground)]', {\n variants: {\n size: {\n sm: 'ds:[--type-title-card-size:var(--font-size-sm)]',\n md: '',\n lg: 'ds:[--type-title-card-size:var(--font-size-xl)]',\n },\n },\n defaultVariants: { size: 'md' },\n});\n\nconst descriptionVariants = cva(\n 'type-body-sm ds:text-[var(--muted-foreground)]',\n {\n variants: {\n size: {\n sm: 'ds:[--type-body-sm-size:var(--font-size-xs)]',\n md: '',\n lg: 'ds:[--type-body-sm-size:var(--font-size-base)]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Built-in illustrations */\n/* ------------------------------------------------------------------ */\n\nfunction FirstUseIllustration() {\n return (\n <svg\n viewBox=\"0 0 120 120\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n className=\"ds:w-full ds:h-full\"\n >\n <circle\n cx=\"60\"\n cy=\"60\"\n r=\"50\"\n fill=\"var(--muted)\"\n stroke=\"var(--muted-foreground)\"\n strokeWidth=\"2\"\n />\n <rect x=\"55\" y=\"30\" width=\"10\" height=\"60\" rx=\"5\" fill=\"var(--primary)\" />\n <rect x=\"30\" y=\"55\" width=\"60\" height=\"10\" rx=\"5\" fill=\"var(--accent)\" />\n </svg>\n );\n}\n\nfunction NoResultsIllustration() {\n return (\n <svg\n viewBox=\"0 0 120 120\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n className=\"ds:w-full ds:h-full\"\n >\n <circle cx=\"52\" cy=\"52\" r=\"28\" stroke=\"var(--muted)\" strokeWidth=\"6\" />\n <line\n x1=\"72\"\n y1=\"72\"\n x2=\"92\"\n y2=\"92\"\n stroke=\"var(--muted)\"\n strokeWidth=\"6\"\n strokeLinecap=\"round\"\n />\n <line\n x1=\"42\"\n y1=\"52\"\n x2=\"62\"\n y2=\"52\"\n stroke=\"var(--muted-foreground)\"\n strokeWidth=\"4\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n\nfunction ErrorIllustration() {\n return (\n <svg\n viewBox=\"0 0 120 120\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n className=\"ds:w-full ds:h-full\"\n >\n <path\n d=\"M60 15 L110 95 H10 Z\"\n fill=\"var(--destructive)\"\n fillOpacity=\"0.1\"\n stroke=\"var(--destructive)\"\n strokeOpacity=\"0.4\"\n strokeWidth=\"3\"\n strokeLinejoin=\"round\"\n />\n <rect\n x=\"56\"\n y=\"45\"\n width=\"8\"\n height=\"26\"\n rx=\"4\"\n fill=\"var(--destructive)\"\n fillOpacity=\"0.6\"\n />\n <circle\n cx=\"60\"\n cy=\"82\"\n r=\"5\"\n fill=\"var(--destructive)\"\n fillOpacity=\"0.6\"\n />\n </svg>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Subcomponents */\n/* ------------------------------------------------------------------ */\n\nconst EmptyStateIllustration = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement>\n>(({ children, className, ...props }, ref) => {\n const { size } = useContext(EmptyStateContext);\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={illustrationVariants({ size, className })}\n {...props}\n >\n {children}\n </div>\n );\n});\nEmptyStateIllustration.displayName = 'EmptyState.Illustration';\n\nconst EmptyStateTitle = forwardRef<\n HTMLHeadingElement,\n HTMLAttributes<HTMLHeadingElement>\n>(({ children, className, ...props }, ref) => {\n const { size, titleId, registerTitle } = useContext(EmptyStateContext);\n const callbackRef = useCallback(\n (node: HTMLHeadingElement | null) => {\n if (node) registerTitle();\n if (typeof ref === 'function') ref(node);\n else if (ref)\n (ref as { current: HTMLHeadingElement | null }).current = node;\n },\n [ref, registerTitle],\n );\n return (\n <h3\n ref={callbackRef}\n id={titleId}\n className={titleVariants({ size, className })}\n {...props}\n >\n {children}\n </h3>\n );\n});\nEmptyStateTitle.displayName = 'EmptyState.Title';\n\nconst EmptyStateDescription = forwardRef<\n HTMLParagraphElement,\n HTMLAttributes<HTMLParagraphElement>\n>(({ children, className, ...props }, ref) => {\n const { size } = useContext(EmptyStateContext);\n return (\n <p\n ref={ref}\n className={descriptionVariants({ size, className })}\n {...props}\n >\n {children}\n </p>\n );\n});\nEmptyStateDescription.displayName = 'EmptyState.Description';\n\nconst actionsVariants = cva(\n 'ds:flex ds:flex-row ds:flex-wrap ds:items-center ds:justify-center ds:gap-[var(--spacing-md)]',\n);\n\nconst EmptyStateActions = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement>\n>(({ children, className, ...props }, ref) => (\n <div ref={ref} className={actionsVariants({ className })} {...props}>\n {children}\n </div>\n));\nEmptyStateActions.displayName = 'EmptyState.Actions';\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\nexport interface EmptyStateProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'title'>,\n VariantProps<typeof emptyStateVariants> {\n variant: 'first-use' | 'no-results' | 'error';\n size?: 'sm' | 'md' | 'lg';\n /** Shorthand title. Ignored when `children` are passed. */\n title?: string;\n /** Shorthand message. Ignored when `children` are passed. */\n description?: string;\n /** Shorthand main button. Ignored when `children` are passed. */\n primaryAction?: { label: string; onClick: () => void };\n /** Shorthand second button. Ignored when `children` are passed. */\n secondaryAction?: { label: string; onClick: () => void; href?: string };\n autoFocus?: boolean;\n /** Compound content. When given, it replaces the whole shorthand\n * layout: compose EmptyState.Title, .Description and .Actions here. */\n children?: ReactNode;\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nconst EmptyStateRoot = forwardRef<HTMLDivElement, EmptyStateProps>(\n (\n {\n variant,\n size = 'md',\n title,\n description,\n primaryAction,\n secondaryAction,\n autoFocus = false,\n children,\n className,\n ...props\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n // isDevelopment, not import.meta.env.DEV: this warning has to reach\n // the apps that use the kit, not only the kit's own Storybook.\n if (\n isDevelopment() &&\n children != null &&\n (title !== undefined ||\n description !== undefined ||\n primaryAction !== undefined ||\n secondaryAction !== undefined)\n ) {\n console.warn(\n '[EmptyState] `title`, `description`, `primaryAction` and `secondaryAction` are ignored when children are passed. Put EmptyState.Title, EmptyState.Description and EmptyState.Actions in the children instead, or drop the children.',\n );\n }\n const titleId = useId();\n const containerRef = useRef<HTMLDivElement | null>(null);\n const [hasTitle, setHasTitle] = useState(false);\n const registerTitle = useCallback(() => setHasTitle(true), []);\n\n useEffect(() => {\n if (!autoFocus) return;\n const firstBtn = containerRef.current?.querySelector<HTMLElement>(\n 'button:not([disabled]), a[href]',\n );\n firstBtn?.focus();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const roleProps =\n variant === 'no-results'\n ? { role: 'status' as const, 'aria-live': 'polite' as const }\n : { role: 'region' as const };\n\n const defaultTitle =\n variant === 'first-use'\n ? t('emptyState.firstUse.title')\n : variant === 'no-results'\n ? t('emptyState.noResults.title')\n : t('emptyState.error.title');\n\n const defaultDescription =\n variant === 'first-use'\n ? t('emptyState.firstUse.description')\n : variant === 'no-results'\n ? t('emptyState.noResults.description')\n : t('emptyState.error.description');\n\n const defaultCtaLabel =\n variant === 'first-use'\n ? t('emptyState.firstUse.cta')\n : variant === 'no-results'\n ? t('emptyState.noResults.cta')\n : t('emptyState.error.cta');\n\n const buttonSize = size === 'sm' ? ('sm' as const) : ('md' as const);\n\n const safeHref = (href: string) =>\n /^(https?:\\/\\/|\\/|#)/.test(href) ? href : '#';\n\n return (\n <EmptyStateContext.Provider\n value={{ size, variant, titleId, registerTitle }}\n >\n <div\n ref={(node) => {\n containerRef.current = node;\n setRef(ref, node);\n }}\n aria-labelledby={hasTitle || !children ? titleId : undefined}\n {...roleProps}\n className={emptyStateVariants({ size, className })}\n data-component=\"empty-state\"\n {...props}\n >\n {children ?? (\n <>\n <EmptyStateIllustration>\n {variant === 'first-use' && <FirstUseIllustration />}\n {variant === 'no-results' && <NoResultsIllustration />}\n {variant === 'error' && <ErrorIllustration />}\n </EmptyStateIllustration>\n <EmptyStateTitle>{title ?? defaultTitle}</EmptyStateTitle>\n <EmptyStateDescription>\n {description ?? defaultDescription}\n </EmptyStateDescription>\n {(primaryAction || secondaryAction) && (\n <EmptyStateActions>\n {primaryAction && (\n <Button\n intent=\"primary\"\n size={buttonSize}\n onClick={primaryAction.onClick}\n >\n {primaryAction.label ?? defaultCtaLabel}\n </Button>\n )}\n {secondaryAction &&\n (secondaryAction.href ? (\n <Button intent=\"ghost\" size={buttonSize} asChild>\n <a\n href={safeHref(secondaryAction.href!)}\n onClick={secondaryAction.onClick}\n >\n {secondaryAction.label}\n </a>\n </Button>\n ) : (\n <Button\n intent=\"ghost\"\n size={buttonSize}\n onClick={secondaryAction.onClick}\n >\n {secondaryAction.label}\n </Button>\n ))}\n </EmptyStateActions>\n )}\n </>\n )}\n </div>\n </EmptyStateContext.Provider>\n );\n },\n);\nEmptyStateRoot.displayName = 'EmptyState';\n\n/* ------------------------------------------------------------------ */\n/* Compound export */\n/* ------------------------------------------------------------------ */\n\nexport const EmptyState = Object.assign(EmptyStateRoot, {\n Illustration: EmptyStateIllustration,\n Title: EmptyStateTitle,\n Description: EmptyStateDescription,\n Actions: EmptyStateActions,\n});\n"],"names":["isDevelopment","setRef","ref","value","EmptyStateContext","createContext","emptyStateVariants","cva","illustrationVariants","titleVariants","descriptionVariants","FirstUseIllustration","jsxs","jsx","NoResultsIllustration","ErrorIllustration","EmptyStateIllustration","forwardRef","children","className","props","size","useContext","EmptyStateTitle","titleId","registerTitle","callbackRef","useCallback","node","EmptyStateDescription","actionsVariants","EmptyStateActions","EmptyStateRoot","variant","title","description","primaryAction","secondaryAction","autoFocus","t","useTranslation","useId","containerRef","useRef","hasTitle","setHasTitle","useState","useEffect","firstBtn","_a","roleProps","defaultTitle","defaultDescription","defaultCtaLabel","buttonSize","safeHref","href","Fragment","Button","EmptyState"],"mappings":";;;;;AAQO,SAASA,IAAyB;AACvC,MAAI;AACF,WAAO,QAAQ,IAAI,aAAa;AAAA,EAClC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;ACQA,SAASC,EAAUC,GAAaC,GAAiB;AAC/C,EAAKD,MACD,OAAOA,KAAQ,aAAYA,EAAIC,CAAK,IAClCD,EAA8B,UAAUC;AAChD;AAaA,MAAMC,IAAoBC,EAAsC;AAAA,EAC9D,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,eAAe,MAAM;AAAA,EAAC;AACxB,CAAC,GAMKC,IAAqBC;AAAA,EACzB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,iBAAiB,EAAE,MAAM,KAAA;AAAA,EAAK;AAElC,GAEMC,IAAuBD;AAAA,EAC3B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,iBAAiB,EAAE,MAAM,KAAA;AAAA,EAAK;AAElC,GAEME,IAAgBF,EAAI,+CAA+C;AAAA,EACvE,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MAC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AAO;AAAA,oBACP,MAAMJ;AAAA,oBACN,SAASlB,EAAc;AAAA,oBAEtB,YAAc,SAASiB;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAG3BhB,MACEA,EAAgB,OACf,gBAAAxB,EAAC6C,GAAA,EAAO,QAAO,SAAQ,MAAMJ,GAAY,SAAO,IAC9C,UAAA,gBAAAzC;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,MAAM0C,EAASlB,EAAgB,IAAK;AAAA,oBACpC,SAASA,EAAgB;AAAA,oBAExB,UAAAA,EAAgB;AAAA,kBAAA;AAAA,gBAAA,GAErB,IAEA,gBAAAxB;AAAA,kBAAC6C;AAAA,kBAAA;AAAA,oBACC,QAAO;AAAA,oBACP,MAAMJ;AAAA,oBACN,SAASjB,EAAgB;AAAA,oBAExB,UAAAA,EAAgB;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACnB,EAAA,CAEN;AAAA,YAAA,EAAA,CAEJ;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA;AAAA,EAGN;AACF;AACAL,EAAe,cAAc;AAMtB,MAAM2B,KAAa,OAAO,OAAO3B,GAAgB;AAAA,EACtD,cAAchB;AAAA,EACd,OAAOO;AAAA,EACP,aAAaM;AAAA,EACb,SAASE;AACX,CAAC;"}
|
|
@@ -4,7 +4,7 @@ var i = (n, e, r) => u(n, typeof e != "symbol" ? e + "" : e, r);
|
|
|
4
4
|
import { jsx as a, Fragment as y } from "react/jsx-runtime";
|
|
5
5
|
import { Component as f } from "react";
|
|
6
6
|
import { useTranslation as v } from "react-i18next";
|
|
7
|
-
import { E } from "./empty-state-
|
|
7
|
+
import { E } from "./empty-state-C62P_6kr.js";
|
|
8
8
|
function p({
|
|
9
9
|
size: n,
|
|
10
10
|
title: e,
|
|
@@ -87,4 +87,4 @@ i(b, "displayName", "ErrorBoundary");
|
|
|
87
87
|
export {
|
|
88
88
|
b as E
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=error-boundary
|
|
90
|
+
//# sourceMappingURL=error-boundary-Cvs23EzK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-boundary
|
|
1
|
+
{"version":3,"file":"error-boundary-Cvs23EzK.js","sources":["../../src/components/error-boundary/error-boundary.tsx"],"sourcesContent":["import { Component, type ErrorInfo, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { EmptyState } from '../empty-state/empty-state';\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\n/** What the boundary caught, handed to a render-prop fallback. */\nexport interface ErrorBoundaryState {\n error: Error;\n /**\n * Runs `onRetry` if the host gave one, then clears the error and re-renders\n * the children — the same call the default face's action makes, so a host\n * that replaces the face does not silently lose its own recovery.\n */\n reset: () => void;\n}\n\nexport interface ErrorBoundaryProps {\n children?: ReactNode;\n /**\n * Replaces the default face. A function receives the error and a `reset`,\n * so a host can offer its own recovery instead of a reload.\n */\n fallback?: ReactNode | ((state: ErrorBoundaryState) => ReactNode);\n /** Report the crash — logging, telemetry, a support channel. */\n onError?: (error: Error, info: ErrorInfo) => void;\n /**\n * Clear the error when any of these change, so a route change or a new\n * record recovers without the user pressing anything.\n */\n resetKeys?: readonly unknown[];\n /** Overrides for the default face; each falls back to the kit's own copy. */\n title?: string;\n description?: string;\n /**\n * Shown as the face's action, and run by a render-prop's `reset` too.\n *\n * Called BEFORE the boundary clears. That is enough for a synchronous\n * recovery — a state flip, a cache clear. It is NOT enough on its own for an\n * async one: the boundary clears on the next line, so a refetch that has not\n * resolved re-renders into the same failure. Pair an async recovery with\n * `resetKeys`, so the settled data is what clears the error.\n */\n onRetry?: () => void;\n size?: 'sm' | 'md' | 'lg';\n}\n\n/* ------------------------------------------------------------------ */\n/* Default face */\n/* ------------------------------------------------------------------ */\n\n/**\n * A function component so the copy can come from `useTranslation` — the class\n * below cannot call a hook. It adds no strings of its own: an unset title or\n * description falls through to `EmptyState`'s own error copy, which already\n * ships in every locale.\n */\nfunction ErrorBoundaryFallback({\n size,\n title,\n description,\n onRetry,\n}: Pick<ErrorBoundaryProps, 'size' | 'title' | 'description' | 'onRetry'>) {\n const { t } = useTranslation('ui');\n\n return (\n <EmptyState\n variant=\"error\"\n size={size}\n {...(title === undefined ? {} : { title })}\n {...(description === undefined ? {} : { description })}\n {...(onRetry === undefined\n ? {}\n : {\n primaryAction: {\n label: t('emptyState.error.cta'),\n onClick: onRetry,\n },\n })}\n />\n );\n}\n\nErrorBoundaryFallback.displayName = 'ErrorBoundaryFallback';\n\n/* ------------------------------------------------------------------ */\n/* Boundary */\n/* ------------------------------------------------------------------ */\n\n/**\n * Catches a render error below it and shows the kit's error face instead of\n * unmounting the tree to a blank page.\n *\n * A CLASS COMPONENT, by sanctioned exception — see\n * `src/docs/23-constraints.mdx` §9. React 18 exposes `getDerivedStateFromError`\n * and `componentDidCatch` on classes only; there is no hook form, and no\n * function component can catch a descendant's render error. The exception is\n * this file, and it is the reason the kit had no boundary at all.\n *\n * It catches RENDER errors. An event handler, a timeout or a rejected promise\n * never reaches it — React does not route those through a boundary — so a host\n * still handles its own async failures.\n */\nclass ErrorBoundary extends Component<\n ErrorBoundaryProps,\n { error: Error | null }\n> {\n static displayName = 'ErrorBoundary';\n\n state: { error: Error | null } = { error: null };\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error, info: ErrorInfo) {\n this.props.onError?.(error, info);\n }\n\n /**\n * A changed key clears the error. Compared by identity and in order, so a\n * host passing a fresh array of the same values does not re-render into the\n * same failure forever.\n *\n * `previousState` is load-bearing. React commits the caught error as an\n * ordinary update, so the first `componentDidUpdate` after a catch still sees\n * the props from the last HEALTHY commit. When the prop change is itself what\n * crashed the child — `resetKeys={[patientId]}` around something that throws\n * on the new patient, which is the documented use — the keys have moved, and\n * without this guard the boundary would clear on the very commit that caught\n * and render straight back into the failure. It settles on the second catch,\n * but the subtree renders twice and `onError` fires twice for one crash.\n */\n componentDidUpdate(\n previous: ErrorBoundaryProps,\n previousState: { error: Error | null },\n ) {\n if (this.state.error === null || previousState.error === null) return;\n\n const before = previous.resetKeys;\n const after = this.props.resetKeys;\n\n if (before === undefined || after === undefined) return;\n\n const moved =\n before.length !== after.length ||\n after.some((key, index) => !Object.is(key, before[index]));\n\n if (moved) this.reset();\n }\n\n reset = () => {\n this.setState({ error: null });\n };\n\n handleRetry = () => {\n /* The host's own recovery runs FIRST — a refetch, a cache clear — so the\n re-render it enables happens after it, not into the same failure. */\n this.props.onRetry?.();\n this.reset();\n };\n\n render() {\n const { error } = this.state;\n const { children, fallback, title, description, onRetry, size } =\n this.props;\n\n if (error === null) return <>{children}</>;\n\n const face =\n typeof fallback === 'function' ? (\n fallback({ error, reset: this.handleRetry })\n ) : fallback !== undefined ? (\n fallback\n ) : (\n <ErrorBoundaryFallback\n size={size}\n title={title}\n description={description}\n {...(onRetry === undefined ? {} : { onRetry: this.handleRetry })}\n />\n );\n\n /* The marker wraps EVERY caught branch, the host's own fallback included.\n Scoping it to the default face would make the contract below a lie: a\n host that supplies a fallback would render no marker while having very\n much caught, and anything reading its absence would call the surface\n healthy. */\n return <div data-component=\"error-boundary\">{face}</div>;\n }\n}\n\nexport { ErrorBoundary };\n"],"names":["ErrorBoundaryFallback","size","title","description","onRetry","useTranslation","jsx","EmptyState","ErrorBoundary","Component","__publicField","_b","_a","error","info","previous","previousState","before","after","key","index","children","fallback","Fragment","face"],"mappings":";;;;;;;AA2DA,SAASA,EAAsB;AAAA,EAC7B,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AACF,GAA2E;AACzE,QAAM,EAAE,EAAA,IAAMC,EAAe,IAAI;AAEjC,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAAN;AAAA,MACC,GAAIC,MAAU,SAAY,CAAA,IAAK,EAAE,OAAAA,EAAA;AAAA,MACjC,GAAIC,MAAgB,SAAY,CAAA,IAAK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