@alfadocs/ui-kit 1.67.0 → 1.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/dist/_chunks/{address-fields-CJtu7LQU.js → address-fields-BUPRs3n-.js} +3 -3
  2. package/dist/_chunks/{agenda-card-DR9gDdKp.js → agenda-card-BDuvreCe.js} +2 -2
  3. package/dist/_chunks/{agenda-tray-DGB1Zup-.js → agenda-tray-CfwylhWf.js} +3 -3
  4. package/dist/_chunks/{ai-credits-exhausted-notice-DfAgfZDF.js → ai-credits-exhausted-notice-Bg8NpW2K.js} +2 -2
  5. package/dist/_chunks/{ai-permission-notice-qsdm4Sx4.js → ai-permission-notice-C00i6VhY.js} +2 -2
  6. package/dist/_chunks/{ai-prompt-input-DSGSe4LH.js → ai-prompt-input-DzgyoKyk.js} +141 -139
  7. package/dist/_chunks/{alert-DjsJMGRE.js → alert-9kEwDza3.js} +122 -112
  8. package/dist/_chunks/{alia-sidebar-qe0quZkB.js → alia-sidebar-B06ZSOaF.js} +3 -3
  9. package/dist/_chunks/{anamnesis-summary-card-CMzBLTiN.js → anamnesis-summary-card-DQ3iE1gD.js} +2 -2
  10. package/dist/_chunks/{anamnesis-summary-rows-BQ_EokKz.js → anamnesis-summary-rows-CNK0fIJk.js} +392 -388
  11. package/dist/_chunks/{appointment-card-CL32sux-.js → appointment-card-5JMWi9_f.js} +2 -2
  12. package/dist/_chunks/{appointment-peek-B5mcDcXt.js → appointment-peek-D5XCfYKu.js} +2 -2
  13. package/dist/_chunks/{appointment-timeline-CCqjORFb.js → appointment-timeline-VFP6HoXT.js} +4 -4
  14. package/dist/_chunks/{appointment-tray-qtpJt8e0.js → appointment-tray-B3PDER3I.js} +3 -3
  15. package/dist/_chunks/{audio-recorder-B11RR-rC.js → audio-recorder-4Ll0pwYK.js} +3 -3
  16. package/dist/_chunks/{auth-form-parts-DwUTH6YN.js → auth-form-parts-B40zvD-a.js} +2 -2
  17. package/dist/_chunks/avatar-BPiPL7ND.js +199 -0
  18. package/dist/_chunks/{balance-badge-cell-DZNthHO1.js → balance-badge-cell-BG3DMly4.js} +4 -4
  19. package/dist/_chunks/{bishop-score-CaNTrikJ.js → bishop-score-Df8nF1qg.js} +2 -2
  20. package/dist/_chunks/{booking-tTVxKPQY.js → booking-B1pDbERi.js} +377 -335
  21. package/dist/_chunks/{calendar-BhN-jisv.js → calendar-BvOM8rG3.js} +2 -2
  22. package/dist/_chunks/{calendar-workspace-MRrzcxAy.js → calendar-workspace-CYK1M83j.js} +18 -18
  23. package/dist/_chunks/{chat-message-fRLZ95O5.js → chat-message-Be-9vIIQ.js} +2 -2
  24. package/dist/_chunks/{clinical-note-card-BnFTIs6x.js → clinical-note-card-Caidqcwa.js} +2 -2
  25. package/dist/_chunks/{color-picker-BsggJovx.js → color-picker-AcaWuKah.js} +99 -95
  26. package/dist/_chunks/{combobox-U5yfO6o0.js → combobox-vF9O-QoG.js} +92 -83
  27. package/dist/_chunks/{contact-profile-card-C4-OCshj.js → contact-profile-card-CAwwOqHl.js} +40 -40
  28. package/dist/_chunks/{control-room-rail-DUerqHeo.js → control-room-rail-BB6rCDWI.js} +3 -3
  29. package/dist/_chunks/{country-select-DF5Bd_mn.js → country-select-CSE2Zm_s.js} +2 -2
  30. package/dist/_chunks/dashboard-grid-7JzaiKnk.js +1487 -0
  31. package/dist/_chunks/{data-table-COoCQ4n_.js → data-table-Cty4-Jht.js} +3 -3
  32. package/dist/_chunks/{dependent-selector-DBr1AhLg.js → dependent-selector-C4kOgO8b.js} +2 -2
  33. package/dist/_chunks/{document-preview-VyQOjFVL.js → document-preview-513f3iPn.js} +4 -4
  34. package/dist/_chunks/{document-scanner-CXH_GYh4.js → document-scanner-Bd3wbzpI.js} +2 -2
  35. package/dist/_chunks/{editable-description-ChGNdYY8.js → editable-description-DnAFi360.js} +2 -2
  36. package/dist/_chunks/{entity-summary-Bj-Wxq7Y.js → entity-summary-C2B8yNmc.js} +4 -4
  37. package/dist/_chunks/{error-summary-PUE5Zxp9.js → error-summary-mGxIyDAY.js} +2 -2
  38. package/dist/_chunks/{face-scheme-DAD-mXzM.js → face-scheme-CSJdRNad.js} +248 -244
  39. package/dist/_chunks/{file-manager-RiV7-OEE.js → file-manager-D4cPnRhL.js} +3 -3
  40. package/dist/_chunks/{forgot-password-form-CPOfRE0C.js → forgot-password-form-Dqi7R-NL.js} +4 -4
  41. package/dist/_chunks/format-number-DdzqwMs1.js +13 -0
  42. package/dist/_chunks/{freemium-paywall-6DO7noHX.js → freemium-paywall-C73C8Rgd.js} +2 -2
  43. package/dist/_chunks/{gestational-age-calculator-CZYa2D6m.js → gestational-age-calculator-Du53p8MH.js} +2 -2
  44. package/dist/_chunks/{header-settings-BSH9Gk0J.js → header-settings-DlUbvAUx.js} +37 -36
  45. package/dist/_chunks/{heatmap-C1TeC7wT.js → heatmap-DbZIQg14.js} +4 -4
  46. package/dist/_chunks/{help-me-write-templates-Bw3Q58x-.js → help-me-write-templates-5WkUfvc_.js} +3 -3
  47. package/dist/_chunks/{kit-extensions-DWs1UEXb.js → kit-extensions-CYvLL4ee.js} +3 -3
  48. package/dist/_chunks/length-token-DwMnGEYT.js +24 -0
  49. package/dist/_chunks/{link-cell-renderer-CtTsvfPY.js → link-cell-renderer-DtIsQWDO.js} +4 -4
  50. package/dist/_chunks/{login-dev-card-A-CL3mjt.js → login-dev-card-vEL-o5wq.js} +3 -3
  51. package/dist/_chunks/{map-view-BuVfJMEa.js → map-view-CtohteZD.js} +300 -191
  52. package/dist/_chunks/{marketplace-app-shell-DtSX8sYb.js → marketplace-app-shell-CcLQ0Dn-.js} +4 -4
  53. package/dist/_chunks/{message-card-A3mJNqfy.js → message-card-C_ksqIYM.js} +2 -2
  54. package/dist/_chunks/{message-tray-Ft6vSr71.js → message-tray-DCoQ4GQb.js} +3 -3
  55. package/dist/_chunks/{multi-select-CMaAQQgb.js → multi-select-BOad3za9.js} +110 -98
  56. package/dist/_chunks/{muscle-scheme-YoN3rYXV.js → muscle-scheme-C66WlCxG.js} +2 -2
  57. package/dist/_chunks/{note-timeline-DDqNU46n.js → note-timeline-KzL52MmB.js} +2 -2
  58. package/dist/_chunks/{notes-panel-IdsmqRFC.js → notes-panel-BXN46XkF.js} +6 -6
  59. package/dist/_chunks/notice-group-DkYzKyAZ.js +291 -0
  60. package/dist/_chunks/{notification-tray-BR3seWA7.js → notification-tray-Cp18MW5b.js} +2 -2
  61. package/dist/_chunks/{operator-hero-3_RG4Dkj.js → operator-hero-6aAIQaFZ.js} +83 -66
  62. package/dist/_chunks/{optical-prescription-CxfMsbxi.js → optical-prescription-ulXnDbBe.js} +525 -509
  63. package/dist/_chunks/panel-header-CbtlTe85.js +190 -0
  64. package/dist/_chunks/{panel-subview-yP4qIbKS.js → panel-subview-BPU7220K.js} +2 -2
  65. package/dist/_chunks/{patient-details-C-EWQTms.js → patient-details-C4Dyo7Ck.js} +4 -4
  66. package/dist/_chunks/{patient-field-row-lY-Tb5Mo.js → patient-field-row-DROvUkFu.js} +4 -4
  67. package/dist/_chunks/{patient-search-DpAKidZ5.js → patient-search-BADdx3M1.js} +2 -2
  68. package/dist/_chunks/{patient-summary-card-Bpto_VCD.js → patient-summary-card-CAimxbuI.js} +4 -4
  69. package/dist/_chunks/{payment-automation-upsell-BQ307qEX.js → payment-automation-upsell-CiwF5UrC.js} +2 -2
  70. package/dist/_chunks/{payment-form-XKtinW8r.js → payment-form-PBuh8PIa.js} +2 -2
  71. package/dist/_chunks/{pdf-viewer-BvoVMjH4.js → pdf-viewer-gAsNUsA8.js} +2 -2
  72. package/dist/_chunks/{periodontal-risk-chart-CPy7CNFe.js → periodontal-risk-chart-B7S9OmPC.js} +97 -89
  73. package/dist/_chunks/practice-profile-hero-qfrsFQI_.js +236 -0
  74. package/dist/_chunks/{practice-results-BrUDDMXC.js → practice-results-BzThnpnm.js} +328 -298
  75. package/dist/_chunks/{pregnancy-dating-B8wo4l_r.js → pregnancy-dating-EFcFUJkQ.js} +2 -2
  76. package/dist/_chunks/{privacy-mask-Ch7743uk.js → privacy-mask-CCz9zuIh.js} +2 -2
  77. package/dist/_chunks/{product-hub-panel-C_ZosrBt.js → product-hub-panel-YuFbNPlT.js} +2 -2
  78. package/dist/_chunks/progress-notice-DiHWZ8Ms.js +279 -0
  79. package/dist/_chunks/{province-select-Bd20Z9Br.js → province-select-CDjs5obD.js} +2 -2
  80. package/dist/_chunks/{radiograph-panel.agent-8Ewv8-d7.js → radiograph-panel.agent-4UllIoTQ.js} +2 -2
  81. package/dist/_chunks/{rating-C1Vrmpsi.js → rating-CGYpg5dj.js} +43 -44
  82. package/dist/_chunks/{registration-form-BxwqUZzk.js → registration-form-1B0PTDal.js} +4 -4
  83. package/dist/_chunks/{reviews-panel-AvsVgtJu.js → reviews-panel-CosDZyow.js} +29 -7
  84. package/dist/_chunks/{rich-text-editor-aCIoptbg.js → rich-text-editor-56dSsyZI.js} +3 -3
  85. package/dist/_chunks/{select-k4gBdS8N.js → select-4S-eYZUf.js} +244 -214
  86. package/dist/_chunks/{sign-document-D1P1nUQA.js → sign-document-BiOTs1P4.js} +2 -2
  87. package/dist/_chunks/{signature-request-3u6TvRt2.js → signature-request-DAmNj_uq.js} +5 -5
  88. package/dist/_chunks/skeleton-tTWJpvAq.js +415 -0
  89. package/dist/_chunks/{slot-grid-dj5f6R2w.js → slot-grid-D_gix9mJ.js} +2 -2
  90. package/dist/_chunks/{tabs-2x3L13jn.js → tabs-BTj-2qMZ.js} +2 -2
  91. package/dist/_chunks/{task-card-BS7Uqevr.js → task-card-Ci2XbLmq.js} +2 -2
  92. package/dist/_chunks/{task-editor-Bb5MMcid.js → task-editor-BomyxGoZ.js} +8 -8
  93. package/dist/_chunks/{task-tray-eQU4KJcA.js → task-tray-Dnc72nl-.js} +3 -3
  94. package/dist/_chunks/{tasks-panel-BOb57Ysw.js → tasks-panel-ATz9JDy8.js} +6 -6
  95. package/dist/_chunks/{theme-toggle-Ctb77x6O.js → theme-toggle-DT_Jn4DC.js} +147 -138
  96. package/dist/_chunks/{timeline-DEIuHrWz.js → timeline-wUuTDFY_.js} +2 -2
  97. package/dist/_chunks/{tool-rail-C-03rH2I.js → tool-rail-C-M3eVdY.js} +2 -2
  98. package/dist/_chunks/{transcript-panel-XudW5l6l.js → transcript-panel-CoHHpcFg.js} +2 -2
  99. package/dist/_chunks/{treatment-receipt-Cpm8tqQN.js → treatment-receipt-pFqWFyD_.js} +2 -2
  100. package/dist/_chunks/{unit-converter-BPZ0Ldkb.js → unit-converter-CIoTmCmP.js} +2 -2
  101. package/dist/_chunks/{use-appointment-details-read-CVSPoP5j.js → use-appointment-details-read-CUGfE0hV.js} +12 -12
  102. package/dist/_chunks/use-dismissed-CTOWqA0e.js +177 -0
  103. package/dist/_chunks/{voice-control-panel-BJIEbDq6.js → voice-control-panel-B8Lrk0C4.js} +4 -4
  104. package/dist/_chunks/{warning-stack-BdY-0bd3.js → warning-stack-BhHUmRiD.js} +2 -2
  105. package/dist/_chunks/{workflow-map-CYbRD9ek.js → workflow-map-ln4_OG8A.js} +2 -2
  106. package/dist/agent-catalog.json +172 -4
  107. package/dist/agent-i18n/en.json +25 -1
  108. package/dist/components/_shared/format-number.d.ts +20 -0
  109. package/dist/components/_shared/length-token.d.ts +12 -0
  110. package/dist/components/_shared/option.d.ts +1 -0
  111. package/dist/components/address-fields/index.js +1 -1
  112. package/dist/components/agenda-card/index.js +1 -1
  113. package/dist/components/agenda-tray/index.js +1 -1
  114. package/dist/components/ai-credits-notice/index.js +1 -1
  115. package/dist/components/ai-permission-notice/index.js +1 -1
  116. package/dist/components/ai-prompt-input/index.js +1 -1
  117. package/dist/components/alert/alert.d.ts +26 -0
  118. package/dist/components/alert/index.js +1 -1
  119. package/dist/components/anamnesis-summary-card/index.js +1 -1
  120. package/dist/components/appointment-card/index.js +2 -2
  121. package/dist/components/appointment-details-panel/index.js +1 -1
  122. package/dist/components/appointment-peek/index.js +1 -1
  123. package/dist/components/appointment-timeline/index.js +1 -1
  124. package/dist/components/audio-recorder/index.js +1 -1
  125. package/dist/components/avatar/avatar.d.ts +2 -0
  126. package/dist/components/avatar/index.js +1 -1
  127. package/dist/components/bishop-score/index.js +1 -1
  128. package/dist/components/booking/index.js +1 -1
  129. package/dist/components/calendar/index.js +1 -1
  130. package/dist/components/chat-message/index.js +1 -1
  131. package/dist/components/clinical-note-card/index.js +1 -1
  132. package/dist/components/color-picker/index.js +1 -1
  133. package/dist/components/combobox/index.js +1 -1
  134. package/dist/components/contact-profile-card/index.js +1 -1
  135. package/dist/components/control-room-rail/index.js +1 -1
  136. package/dist/components/country-select/index.js +1 -1
  137. package/dist/components/dashboard-grid/dashboard-grid.d.ts +20 -1
  138. package/dist/components/dashboard-grid/index.js +1 -1
  139. package/dist/components/data-table/index.js +2 -2
  140. package/dist/components/dependent-selector/index.js +1 -1
  141. package/dist/components/document-preview/index.js +1 -1
  142. package/dist/components/document-scanner/index.js +1 -1
  143. package/dist/components/editable-description/index.js +1 -1
  144. package/dist/components/entity-summary/index.js +1 -1
  145. package/dist/components/error-summary/index.js +1 -1
  146. package/dist/components/face-scheme/index.js +1 -1
  147. package/dist/components/file-manager/index.js +1 -1
  148. package/dist/components/freemium-paywall/index.js +1 -1
  149. package/dist/components/gestational-age-calculator/index.js +1 -1
  150. package/dist/components/header-settings/index.js +1 -1
  151. package/dist/components/heatmap/index.js +1 -1
  152. package/dist/components/index.d.ts +4 -2
  153. package/dist/components/map-view/index.d.ts +1 -1
  154. package/dist/components/map-view/index.js +1 -1
  155. package/dist/components/map-view/map-view.d.ts +51 -0
  156. package/dist/components/message-card/index.js +1 -1
  157. package/dist/components/message-tray/index.js +1 -1
  158. package/dist/components/multi-select/index.js +1 -1
  159. package/dist/components/muscle-scheme/index.js +1 -1
  160. package/dist/components/note-timeline/index.js +1 -1
  161. package/dist/components/notes-panel/index.js +1 -1
  162. package/dist/components/notice-group/index.d.ts +3 -0
  163. package/dist/components/notice-group/index.js +6 -0
  164. package/dist/components/notice-group/notice-group.agent.d.ts +4 -0
  165. package/dist/components/notice-group/notice-group.d.ts +43 -0
  166. package/dist/components/notification-tray/index.js +1 -1
  167. package/dist/components/operator-hero/index.js +1 -1
  168. package/dist/components/optical-prescription/index.js +1 -1
  169. package/dist/components/optical-prescription/optical-prescription-data.d.ts +8 -8
  170. package/dist/components/panel-header/index.js +1 -1
  171. package/dist/components/panel-header/panel-header.d.ts +10 -0
  172. package/dist/components/panel-subview/index.js +1 -1
  173. package/dist/components/patient-details/index.js +1 -1
  174. package/dist/components/patient-search/index.js +1 -1
  175. package/dist/components/patient-summary-card/index.js +1 -1
  176. package/dist/components/patient-table/index.js +1 -1
  177. package/dist/components/payment-form/index.js +1 -1
  178. package/dist/components/pdf-viewer/index.js +1 -1
  179. package/dist/components/periodontal-risk-chart/index.js +1 -1
  180. package/dist/components/practice-profile-hero/index.js +1 -1
  181. package/dist/components/practice-profile-hero/practice-profile-hero.d.ts +4 -1
  182. package/dist/components/practice-results/index.js +1 -1
  183. package/dist/components/practice-results/practice-results.d.ts +10 -2
  184. package/dist/components/pregnancy-dating/index.js +1 -1
  185. package/dist/components/product-hub-tray/index.js +1 -1
  186. package/dist/components/progress-notice/index.d.ts +3 -0
  187. package/dist/components/progress-notice/index.js +6 -0
  188. package/dist/components/progress-notice/progress-notice.agent.d.ts +4 -0
  189. package/dist/components/progress-notice/progress-notice.d.ts +81 -0
  190. package/dist/components/province-select/index.js +1 -1
  191. package/dist/components/radiograph-panel/index.js +1 -1
  192. package/dist/components/rating/index.js +1 -1
  193. package/dist/components/reviews-panel/index.js +1 -1
  194. package/dist/components/rich-text-editor/index.js +2 -2
  195. package/dist/components/select/index.js +1 -1
  196. package/dist/components/select/select.d.ts +6 -0
  197. package/dist/components/sign-document/index.js +1 -1
  198. package/dist/components/skeleton/index.d.ts +1 -1
  199. package/dist/components/skeleton/index.js +1 -1
  200. package/dist/components/skeleton/skeleton.d.ts +41 -1
  201. package/dist/components/skeleton-scheme/index.js +1 -1
  202. package/dist/components/slot-grid/index.js +1 -1
  203. package/dist/components/tabs/index.js +1 -1
  204. package/dist/components/task-card/index.js +1 -1
  205. package/dist/components/task-editor/index.js +1 -1
  206. package/dist/components/task-tray/index.js +1 -1
  207. package/dist/components/tasks-panel/index.js +1 -1
  208. package/dist/components/theme-toggle/index.js +1 -1
  209. package/dist/components/timeline/index.js +1 -1
  210. package/dist/components/tool-rail/index.js +1 -1
  211. package/dist/components/transcript-panel/index.js +1 -1
  212. package/dist/components/treatment-receipt/index.js +1 -1
  213. package/dist/components/unit-converter/index.js +1 -1
  214. package/dist/components/voice-control-panel/index.js +1 -1
  215. package/dist/components/warning-stack/index.js +1 -1
  216. package/dist/components/workflow/index.js +1 -1
  217. package/dist/hooks/index.d.ts +1 -0
  218. package/dist/hooks/index.js +81 -76
  219. package/dist/hooks/use-dismissed.d.ts +58 -0
  220. package/dist/i18n/locales/ar.d.ts +22 -0
  221. package/dist/i18n/locales/ar.js +22 -0
  222. package/dist/i18n/locales/de.d.ts +22 -0
  223. package/dist/i18n/locales/de.js +22 -0
  224. package/dist/i18n/locales/el.d.ts +22 -0
  225. package/dist/i18n/locales/el.js +22 -0
  226. package/dist/i18n/locales/en.d.ts +22 -0
  227. package/dist/i18n/locales/en.js +22 -0
  228. package/dist/i18n/locales/es.d.ts +22 -0
  229. package/dist/i18n/locales/es.js +22 -0
  230. package/dist/i18n/locales/fr.d.ts +22 -0
  231. package/dist/i18n/locales/fr.js +22 -0
  232. package/dist/i18n/locales/hi.d.ts +22 -0
  233. package/dist/i18n/locales/hi.js +22 -0
  234. package/dist/i18n/locales/it.d.ts +22 -0
  235. package/dist/i18n/locales/it.js +22 -0
  236. package/dist/i18n/locales/ja.d.ts +22 -0
  237. package/dist/i18n/locales/ja.js +22 -0
  238. package/dist/i18n/locales/nl.d.ts +22 -0
  239. package/dist/i18n/locales/nl.js +22 -0
  240. package/dist/i18n/locales/pl.d.ts +22 -0
  241. package/dist/i18n/locales/pl.js +22 -0
  242. package/dist/i18n/locales/pt.d.ts +22 -0
  243. package/dist/i18n/locales/pt.js +22 -0
  244. package/dist/i18n/locales/ro.d.ts +22 -0
  245. package/dist/i18n/locales/ro.js +22 -0
  246. package/dist/i18n/locales/ru.d.ts +22 -0
  247. package/dist/i18n/locales/ru.js +22 -0
  248. package/dist/i18n/locales/sq.d.ts +22 -0
  249. package/dist/i18n/locales/sq.js +22 -0
  250. package/dist/i18n/locales/sv.d.ts +22 -0
  251. package/dist/i18n/locales/sv.js +22 -0
  252. package/dist/i18n/locales/tr.d.ts +22 -0
  253. package/dist/i18n/locales/tr.js +22 -0
  254. package/dist/i18n/locales/zh.d.ts +22 -0
  255. package/dist/i18n/locales/zh.js +22 -0
  256. package/dist/index.js +1194 -1183
  257. package/dist/locales/ar.json +22 -0
  258. package/dist/locales/de.json +22 -0
  259. package/dist/locales/el.json +22 -0
  260. package/dist/locales/en.json +22 -0
  261. package/dist/locales/es.json +22 -0
  262. package/dist/locales/fr.json +22 -0
  263. package/dist/locales/hi.json +22 -0
  264. package/dist/locales/it.json +22 -0
  265. package/dist/locales/ja.json +22 -0
  266. package/dist/locales/nl.json +22 -0
  267. package/dist/locales/pl.json +22 -0
  268. package/dist/locales/pt.json +22 -0
  269. package/dist/locales/ro.json +22 -0
  270. package/dist/locales/ru.json +22 -0
  271. package/dist/locales/sq.json +22 -0
  272. package/dist/locales/sv.json +22 -0
  273. package/dist/locales/tr.json +22 -0
  274. package/dist/locales/zh.json +22 -0
  275. package/dist/patterns/alia-assistant/index.js +1 -1
  276. package/dist/patterns/anamnesis/index.js +1 -1
  277. package/dist/patterns/calendar/index.js +1 -1
  278. package/dist/patterns/forgot-password-form/index.js +1 -1
  279. package/dist/patterns/help-me-write-templates/index.js +2 -2
  280. package/dist/patterns/login-form/index.js +1 -1
  281. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  282. package/dist/patterns/payment-automation-upsell/index.js +1 -1
  283. package/dist/patterns/registration-form/index.js +1 -1
  284. package/dist/patterns/signature-request/index.js +1 -1
  285. package/dist/tokens.css +1 -1
  286. package/package.json +9 -1
  287. package/dist/_chunks/avatar-WZY3eGE7.js +0 -123
  288. package/dist/_chunks/dashboard-grid-B2MB7SRS.js +0 -1428
  289. package/dist/_chunks/panel-header-BJkaUwnl.js +0 -128
  290. package/dist/_chunks/practice-profile-hero-Dfc0F60y.js +0 -193
  291. package/dist/_chunks/skeleton-B1KTdJ4N.js +0 -116
@@ -0,0 +1,1487 @@
1
+ import { jsxs as we, jsx as _ } from "react/jsx-runtime";
2
+ import { forwardRef as Wt, useRef as E, useState as q, useCallback as L, useMemo as de, useEffect as Z, useImperativeHandle as Dt, useContext as Pt, useId as Ht, Children as zt, isValidElement as Xt, Fragment as Ft, createContext as Ot, cloneElement as ft } from "react";
3
+ import { c as ce } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as St } from "react-i18next";
5
+ import { I as $e } from "./icon-button-C_1TgRiK.js";
6
+ import { D as De } from "./dropdown-menu-D1we7oAY.js";
7
+ import { T as Yt } from "./tooltip-uEBdD1-5.js";
8
+ import { C as Vt } from "./skeleton-tTWJpvAq.js";
9
+ import { u as ne } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
10
+ import { u as jt } from "./registry-DvAUVLHh.js";
11
+ import { P as $t } from "./plus-DzMQ_c6b.js";
12
+ import { X as Kt } from "./x-B5YnXwCz.js";
13
+ import { G as qt } from "./grip-vertical-onSb1JXO.js";
14
+ import { E as Ut } from "./ellipsis-dRo9ouSU.js";
15
+ import { c as Bt } from "./createLucideIcon-DhHxpK9K.js";
16
+ /**
17
+ * @license lucide-react v1.22.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */
22
+ const Jt = [
23
+ ["path", { d: "M19 13v6h-6", key: "1hxl6d" }],
24
+ ["path", { d: "M5 11V5h6", key: "12e2xe" }],
25
+ ["path", { d: "m5 5 14 14", key: "11anup" }]
26
+ ], Qt = Bt("move-diagonal-2", Jt), Zt = {
27
+ id: "dashboard-grid",
28
+ // The board's whole purpose is in-place rearrangement of its widgets.
29
+ // `scroll` is backed by reveal_widget (the catalogue's name heuristic
30
+ // cannot see that and warns).
31
+ capabilities: ["edit_inline", "scroll"],
32
+ state: {
33
+ layout: {
34
+ type: "{ id: string, x: number, y: number, w: number, h: number }[]",
35
+ descriptionKey: "ui.agent.dashboardGrid.state.layout",
36
+ description: "Current widget geometry in cell units — ids and rectangles only, no widget content.",
37
+ read: (r) => r.getGridState().layout
38
+ },
39
+ cols: {
40
+ type: "number",
41
+ descriptionKey: "ui.agent.dashboardGrid.state.cols",
42
+ description: "Logical column count of the board.",
43
+ read: (r) => r.getGridState().cols
44
+ },
45
+ editing: {
46
+ type: "boolean",
47
+ descriptionKey: "ui.agent.dashboardGrid.state.editing",
48
+ description: "Whether edit mode is on. Move/resize actions are refused while it is off — the host app owns the toggle.",
49
+ read: (r) => r.getGridState().editing
50
+ },
51
+ stacked: {
52
+ type: "boolean",
53
+ descriptionKey: "ui.agent.dashboardGrid.state.stacked",
54
+ description: "Whether the board is narrower than its stackBelow width and shows its widgets as one read-only column. Move/resize actions are unavailable while it is true, even in edit mode; the saved layout is unchanged.",
55
+ read: (r) => r.getGridState().stacked
56
+ },
57
+ selectedId: {
58
+ type: "string | null",
59
+ descriptionKey: "ui.agent.dashboardGrid.state.selectedId",
60
+ description: "The widget the host has marked (for example while its settings are open), or null. Set by the host, not by agents.",
61
+ read: (r) => r.getGridState().selectedId
62
+ },
63
+ loadingIds: {
64
+ type: "string[]",
65
+ descriptionKey: "ui.agent.dashboardGrid.state.loadingIds",
66
+ description: "Ids of the widgets still waiting for their figures (the host set loading). Their bodies show placeholders, so read their values only once they leave this list. Set by the host, not by agents.",
67
+ read: (r) => r.getGridState().loadingIds
68
+ }
69
+ },
70
+ actions: {
71
+ reveal_widget: {
72
+ // Scrolls the view and rings a widget for a moment; changes nothing.
73
+ safety: "read",
74
+ argsType: "id",
75
+ argsSchema: {
76
+ type: "object",
77
+ properties: {
78
+ id: { type: "string", description: "Widget id (see layout state)." }
79
+ },
80
+ required: ["id"]
81
+ },
82
+ returns: "Promise<boolean> (revealed)",
83
+ returnsSchema: {
84
+ type: "boolean",
85
+ description: "True once the widget is in view; false if it has not appeared within a second."
86
+ },
87
+ idempotent: !0,
88
+ errors: [
89
+ "Unknown or not yet rendered widget id: waits up to a second, then resolves false."
90
+ ],
91
+ descriptionKey: "ui.agent.dashboardGrid.actions.revealWidget",
92
+ description: "Scroll a widget into view (its scrolling ancestor and the window) and highlight it briefly. Works in view and edit mode, and for a widget added a moment ago. Does not move focus.",
93
+ invoke: (r, s) => r.revealWidget(s.id)
94
+ },
95
+ move_widget: {
96
+ // Rearranging the board mutates user configuration — a write,
97
+ // reversible by moving back.
98
+ safety: "write",
99
+ argsType: "id, x, y",
100
+ argsSchema: {
101
+ type: "object",
102
+ properties: {
103
+ id: { type: "string", description: "Widget id (see layout state)." },
104
+ x: {
105
+ type: "integer",
106
+ minimum: 0,
107
+ description: "0-based logical column."
108
+ },
109
+ y: { type: "integer", minimum: 0, description: "0-based row." }
110
+ },
111
+ required: ["id", "x", "y"]
112
+ },
113
+ returns: "boolean (accepted)",
114
+ returnsSchema: {
115
+ type: "boolean",
116
+ description: "True when applied; false when edit mode is off, the board is stacked, or the id is unknown."
117
+ },
118
+ idempotent: !0,
119
+ errors: [
120
+ "Unavailable while the board is stacked (state stacked is true): returns false and changes nothing.",
121
+ "Unavailable while edit mode is off: returns false.",
122
+ "Unknown widget id: returns false."
123
+ ],
124
+ descriptionKey: "ui.agent.dashboardGrid.actions.moveWidget",
125
+ description: "Move a widget to a cell. Out-of-bounds targets are clamped; colliding widgets are pushed down and the layout re-compacts. Refused while edit mode is off or the board is stacked.",
126
+ invoke: (r, s) => r.moveWidgetTo(s.id, s.x, s.y)
127
+ },
128
+ resize_widget: {
129
+ safety: "write",
130
+ argsType: "id, w, h",
131
+ argsSchema: {
132
+ type: "object",
133
+ properties: {
134
+ id: { type: "string", description: "Widget id (see layout state)." },
135
+ w: {
136
+ type: "integer",
137
+ minimum: 1,
138
+ description: "Column span (≥ 1)."
139
+ },
140
+ h: { type: "integer", minimum: 1, description: "Row span (≥ 1)." }
141
+ },
142
+ required: ["id", "w", "h"]
143
+ },
144
+ returns: "boolean (accepted)",
145
+ returnsSchema: {
146
+ type: "boolean",
147
+ description: "True when applied; false when edit mode is off, the board is stacked, or the id is unknown."
148
+ },
149
+ idempotent: !0,
150
+ errors: [
151
+ "Unavailable while the board is stacked (state stacked is true): returns false and changes nothing.",
152
+ "Unavailable while edit mode is off: returns false.",
153
+ "Unknown widget id: returns false."
154
+ ],
155
+ descriptionKey: "ui.agent.dashboardGrid.actions.resizeWidget",
156
+ description: "Resize a widget to a span. Clamped to the grid and the widget’s min/max; colliding widgets are pushed down. Refused while edit mode is off or the board is stacked.",
157
+ invoke: (r, s) => r.resizeWidgetTo(s.id, s.w, s.h)
158
+ }
159
+ },
160
+ domHooks: {
161
+ root: {
162
+ attr: "data-component",
163
+ value: "dashboard-grid",
164
+ description: 'Also carries data-stacked="true" while the board shows one read-only column.'
165
+ },
166
+ instanceId: {
167
+ attr: "data-component-id",
168
+ sourceProp: "id",
169
+ description: "Sourced from the id prop."
170
+ },
171
+ item: {
172
+ attr: "data-widget-id",
173
+ description: 'Each widget wrapper carries its layout id. While its figures load it also carries data-loading="true" and aria-busy="true".'
174
+ }
175
+ }
176
+ };
177
+ function z(r, s) {
178
+ return r.x < s.x + s.w && s.x < r.x + r.w && r.y < s.y + s.h && s.y < r.y + r.h;
179
+ }
180
+ function He(r, s) {
181
+ const i = Math.max(1, r.minW ?? 1), c = Math.max(1, r.minH ?? 1), p = Math.min(s, r.maxW ?? s), N = r.maxH ?? Number.POSITIVE_INFINITY, m = Math.min(Math.max(r.w, i), p), b = Math.min(Math.max(r.h, c), N), M = Math.min(Math.max(0, r.x), s - m), v = Math.max(0, r.y);
182
+ return { ...r, x: M, y: v, w: m, h: b };
183
+ }
184
+ function mt(r, s) {
185
+ if (s.some((i) => z(i, r))) return !1;
186
+ for (let i = r.y; i < r.y + r.h; i += 1)
187
+ if (!s.some(
188
+ (p) => p.x >= r.x + r.w && i >= p.y && i < p.y + p.h
189
+ )) return !1;
190
+ return !0;
191
+ }
192
+ function pt(r, s, i) {
193
+ return Math.abs(r.y * i + r.x - (s.y * i + s.x));
194
+ }
195
+ function ae(r, s, i, c) {
196
+ const p = r.map((o) => He(o, s)), N = [...p].sort((o, h) => o.id === i ? -1 : h.id === i ? 1 : o.y - h.y || o.x - h.x), m = [], b = i ? p.find((o) => o.id === i) : void 0, M = /* @__PURE__ */ new Set();
197
+ for (const o of N) {
198
+ if (o.id !== i) {
199
+ if (b && z(b, o)) {
200
+ const h = { ...o, y: Math.max(0, b.y - o.h) };
201
+ !z(b, h) && !m.some((G) => G.id !== i && z(G, h)) && (o.y = h.y);
202
+ }
203
+ if (m.some((h) => z(h, o))) {
204
+ M.add(o.id);
205
+ const h = p.filter((k) => k.id !== o.id);
206
+ let G = o.y;
207
+ for (; m.some((k) => z(k, { ...o, y: G })); )
208
+ G += 1;
209
+ let I = null;
210
+ for (let k = Math.max(0, o.y - o.h); k <= G; k += 1)
211
+ for (let T = 0; T <= s - o.w; T += 1) {
212
+ const H = { ...o, x: T, y: k };
213
+ (mt(H, h) || c !== void 0 && z(c, H) && !h.some((Y) => z(Y, H))) && (!I || pt({ x: T, y: k }, o, s) < pt(I, o, s)) && (I = { x: T, y: k });
214
+ }
215
+ if (I)
216
+ o.x = I.x, o.y = I.y;
217
+ else {
218
+ o.y = G;
219
+ const k = b !== void 0 && b.x < o.x && o.x < b.x + b.w, T = b ? b.x : o.x;
220
+ for (; k && o.x > T && !h.some((H) => z(H, { ...o, x: o.x - 1 })); )
221
+ o.x -= 1;
222
+ }
223
+ }
224
+ for (; m.some((h) => z(h, o)); )
225
+ o.y += 1;
226
+ for (; o.y > 0; ) {
227
+ const h = { ...o, y: o.y - 1 };
228
+ if (m.some((G) => z(G, h))) break;
229
+ o.y -= 1;
230
+ }
231
+ }
232
+ m.push(o);
233
+ }
234
+ const v = b ? [...m].sort((o, h) => o.y - h.y || o.x - h.x) : [];
235
+ for (const o of v) {
236
+ if (o.id === i || M.has(o.id)) continue;
237
+ const h = m.filter((I) => I.id !== o.id);
238
+ let G = null;
239
+ for (let I = 0; I < o.y && !G; I += 1) {
240
+ const k = Array.from(
241
+ { length: 2 * o.w + 1 },
242
+ (T, H) => o.x - o.w + H
243
+ ).filter((T) => T >= 0 && T <= s - o.w).sort((T, H) => Math.abs(T - o.x) - Math.abs(H - o.x) || T - H);
244
+ for (const T of k)
245
+ if (mt({ ...o, x: T, y: I }, h)) {
246
+ G = { x: T, y: I };
247
+ break;
248
+ }
249
+ }
250
+ if (G)
251
+ for (o.x = G.x, o.y = G.y; o.y > 0; ) {
252
+ const I = { ...o, y: o.y - 1 };
253
+ if (h.some((k) => z(k, I))) break;
254
+ o.y -= 1;
255
+ }
256
+ }
257
+ const W = new Map(m.map((o) => [o.id, o]));
258
+ return r.map((o) => W.get(o.id));
259
+ }
260
+ function er(r, s, i, c, p) {
261
+ const N = r.map(
262
+ (m) => m.id === s ? He({ ...m, x: i, y: c }, p) : m
263
+ );
264
+ return ae(
265
+ N,
266
+ p,
267
+ s,
268
+ r.find((m) => m.id === s)
269
+ );
270
+ }
271
+ function tr(r, s, i, c, p) {
272
+ const N = r.map(
273
+ (m) => m.id === s ? (
274
+ // Resizing never moves the widget: the width clamps to the space
275
+ // between its position and the grid edge (clampRect would slide it).
276
+ // minW wins over the edge clamp so clampRect cannot re-raise w and
277
+ // slide x as a side effect.
278
+ He(
279
+ {
280
+ ...m,
281
+ w: Math.max(m.minW ?? 1, Math.min(i, p - m.x)),
282
+ h: c
283
+ },
284
+ p
285
+ )
286
+ ) : m
287
+ );
288
+ return ae(N, p, s);
289
+ }
290
+ function gt(r, s, i, c) {
291
+ const p = Math.min(Math.max(1, i), s), N = r.reduce((m, b) => Math.max(m, b.y + b.h), 0);
292
+ for (let m = 0; m <= N; m += 1)
293
+ for (let b = 0; b <= s - p; b += 1) {
294
+ const M = {
295
+ x: b,
296
+ y: m,
297
+ w: p,
298
+ h: c
299
+ };
300
+ if (!r.some((v) => z(v, M)))
301
+ return { x: b, y: m };
302
+ }
303
+ return { x: 0, y: N };
304
+ }
305
+ function Et(r) {
306
+ return r.reduce((s, i) => Math.max(s, i.y + i.h), 0);
307
+ }
308
+ const rr = 24;
309
+ function ht(r, s, i) {
310
+ return s === void 0 || !Number.isFinite(s) || s <= 0 ? !1 : !Number.isFinite(r) || r <= 0 ? i : i ? r < s + rr : r < s;
311
+ }
312
+ function nr(r, s) {
313
+ const i = new Map(s.map((c) => [c.id, c]));
314
+ return r.map((c, p) => ({ id: c, index: p, entry: i.get(c) })).sort((c, p) => !c.entry || !p.entry ? c.entry ? -1 : p.entry ? 1 : c.index - p.index : c.entry.y - p.entry.y || c.entry.x - p.entry.x || c.index - p.index).map(({ id: c }) => c);
315
+ }
316
+ const sr = ce(
317
+ [
318
+ "ds:grid ds:w-full",
319
+ // A stacking context: a grabbed widget's lift stays inside the board.
320
+ "ds:isolate",
321
+ "ds:gap-[var(--spacing-md)]",
322
+ // Edit-mode surface: tint the whole plane, draw faint cell lines, and
323
+ // reserve spare rows (--dg-min-block) so the AVAILABLE space reads at
324
+ // a glance instead of the board ending at the last occupied row.
325
+ "ds:data-[editing=true]:rounded-[var(--radius-lg)] ds:data-[editing=true]:bg-muted/10",
326
+ "ds:data-[editing=true]:[background-image:var(--dg-grid-lines)]",
327
+ "ds:data-[editing=true]:min-h-[var(--dg-min-block)]"
328
+ ].join(" "),
329
+ {
330
+ variants: {
331
+ // Stacked: one full-width column; each row takes its widget's block
332
+ // size. Focus can fall back to the board here (see the focus effect),
333
+ // so it gets the kit's focus ring.
334
+ stacked: {
335
+ false: [
336
+ "ds:[grid-template-columns:repeat(var(--dg-cols),minmax(0,1fr))]",
337
+ "ds:[grid-auto-rows:var(--dg-row)]"
338
+ ].join(" "),
339
+ true: [
340
+ "ds:grid-cols-1 ds:auto-rows-auto",
341
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
342
+ ].join(" ")
343
+ }
344
+ },
345
+ defaultVariants: { stacked: !1 }
346
+ }
347
+ ), ir = ce(
348
+ [
349
+ "ds:relative ds:min-h-0 ds:min-w-0 ds:overflow-hidden",
350
+ // Its own stacking context: a sticky or raised layer inside a widget
351
+ // can never paint over the page's chrome (a sticky toolbar, say).
352
+ "ds:isolate",
353
+ // Header actions fold into one menu below a set widget width.
354
+ "ds:@container/widget",
355
+ // Mirror of Card variant="elevated" so widgets read as kit cards.
356
+ "ds:rounded-[var(--radius-lg)] ds:bg-[var(--card)] ds:text-[var(--card-foreground)]",
357
+ "ds:[:where(&)]:border-[length:var(--surface-border-width,var(--border-width-sm))] ds:border-[color:var(--card-border)] ds:shadow-[var(--shadow-card)]",
358
+ // Grabbed feedback (keyboard or pointer drag in flight).
359
+ "ds:data-[grabbed=true]:ring-[length:var(--focus-ring-width)] ds:data-[grabbed=true]:ring-ring ds:data-[grabbed=true]:z-10",
360
+ // Selected (and briefly revealed): an inset edge in --primary, the
361
+ // kit's selected colour, so it reads apart from focus and from a grab.
362
+ "ds:data-[selected=true]:ring-[length:var(--border-width-md)] ds:data-[selected=true]:ring-inset ds:data-[selected=true]:ring-[color:var(--primary)]",
363
+ "ds:data-[revealed=true]:ring-[length:var(--border-width-md)] ds:data-[revealed=true]:ring-inset ds:data-[revealed=true]:ring-[color:var(--primary)]",
364
+ "ds:forced-colors:data-[selected=true]:outline-[length:var(--border-width-md)] ds:forced-colors:data-[selected=true]:outline-solid ds:forced-colors:data-[selected=true]:outline-[Highlight]",
365
+ // Only reachable when stacking removes the focused edit control: the
366
+ // widget then takes focus itself (tabindex -1, set at that moment).
367
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
368
+ ].join(" "),
369
+ {
370
+ variants: {
371
+ stacked: {
372
+ false: [
373
+ "ds:[grid-column-start:var(--dg-x)] ds:[grid-column-end:span_var(--dg-w)]",
374
+ "ds:[grid-row-start:var(--dg-y)] ds:[grid-row-end:span_var(--dg-h)]"
375
+ ].join(" "),
376
+ true: "ds:col-span-full ds:row-auto"
377
+ },
378
+ stackedHeight: { grid: "", content: "" }
379
+ },
380
+ compoundVariants: [
381
+ { stacked: !1, class: "ds:flex ds:flex-col" },
382
+ // At least the block size the widget has in the grid (h rows plus the
383
+ // h - 1 gaps). A minimum, not a fixed size: at 200% zoom the widget
384
+ // grows instead of clipping its content (WCAG 1.4.4, 1.4.10).
385
+ {
386
+ stacked: !0,
387
+ stackedHeight: "grid",
388
+ class: [
389
+ "ds:flex ds:flex-col",
390
+ "ds:[min-block-size:calc(var(--dg-h)*var(--dg-row)_+_(var(--dg-h)_-_1)*var(--spacing-md))]"
391
+ ].join(" ")
392
+ },
393
+ // As tall as the content, or minStackedHeight. A grid, not a flex
394
+ // column, so the body row is a definite box a 100% chart can fill.
395
+ {
396
+ stacked: !0,
397
+ stackedHeight: "content",
398
+ class: [
399
+ "ds:grid ds:grid-cols-[minmax(0,1fr)] ds:grid-rows-[auto_1fr]",
400
+ "ds:[min-block-size:var(--dg-min-stacked)]"
401
+ ].join(" ")
402
+ }
403
+ ],
404
+ defaultVariants: { stacked: !1, stackedHeight: "grid" }
405
+ }
406
+ ), or = ce(
407
+ "ds:ps-[var(--spacing-md)] ds:pt-[var(--spacing-xs)]",
408
+ {
409
+ variants: {
410
+ // `box`: fill the widget's block size and clip to it. `content`: take
411
+ // the content's own height (the content-height stack), never a box.
412
+ fit: {
413
+ box: "ds:min-h-0 ds:flex-1 ds:overflow-hidden",
414
+ content: "ds:min-w-0"
415
+ },
416
+ // Editing: clear of the resize grip's whole hit area, a
417
+ // --min-target-size square in the corner. Block-end takes the full
418
+ // size, keeping the width narrow widgets need; inline-end the glyph.
419
+ editing: {
420
+ false: "ds:pe-[var(--spacing-md)]",
421
+ true: "ds:pe-[calc(var(--spacing-lg)_+_var(--spacing-2xs))]"
422
+ },
423
+ // A loading caption sits under the body and owns the block-end
424
+ // space (and the grip's clearance) instead.
425
+ captioned: { false: "", true: "ds:pb-[var(--spacing-xs)]" },
426
+ // Real content where a placeholder stood settles in. Opacity only.
427
+ settling: { false: "", true: Vt }
428
+ },
429
+ compoundVariants: [
430
+ { captioned: !1, editing: !1, class: "ds:pb-[var(--spacing-md)]" },
431
+ {
432
+ captioned: !1,
433
+ editing: !0,
434
+ class: "ds:pb-[var(--min-target-size)]"
435
+ }
436
+ ],
437
+ defaultVariants: {
438
+ fit: "box",
439
+ editing: !1,
440
+ captioned: !1,
441
+ settling: !1
442
+ }
443
+ }
444
+ ), dr = ce(
445
+ [
446
+ "ds:m-0 ds:shrink-0 ds:truncate type-body-sm ds:text-[var(--muted-foreground)]",
447
+ "ds:ps-[var(--spacing-md)] ds:pb-[var(--spacing-sm)]"
448
+ ].join(" "),
449
+ {
450
+ variants: {
451
+ editing: {
452
+ false: "ds:pe-[var(--spacing-md)]",
453
+ true: "ds:pe-[var(--min-target-size)]"
454
+ }
455
+ },
456
+ defaultVariants: { editing: !1 }
457
+ }
458
+ ), ar = ce(
459
+ [
460
+ "ds:absolute ds:bottom-[var(--spacing-2xs)] ds:end-[var(--spacing-2xs)]",
461
+ "ds:inline-flex ds:size-[var(--spacing-lg)] ds:items-center ds:justify-center",
462
+ "ds:rounded-[var(--radius-sm)] ds:text-[var(--muted-foreground)] ds:touch-none",
463
+ "ds:cursor-nwse-resize ds:rtl:cursor-nesw-resize",
464
+ "ds:hover:bg-muted/20 ds:hover:text-[var(--foreground)]",
465
+ "ds:aria-pressed:bg-muted/20 ds:aria-pressed:text-[var(--foreground)]",
466
+ "ds:[&_svg]:size-3.5 ds:rtl:[&_svg]:-scale-x-100",
467
+ "ds:before:absolute ds:before:content-['']",
468
+ "ds:before:bottom-[calc(-1*var(--spacing-2xs))] ds:before:end-[calc(-1*var(--spacing-2xs))]",
469
+ "ds:before:size-[var(--min-target-size)]",
470
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
471
+ ].join(" ")
472
+ ), vt = ce(
473
+ "ds:items-center ds:gap-[calc(var(--min-target-size)_-_var(--spacing-xl))]",
474
+ {
475
+ variants: {
476
+ when: {
477
+ always: "ds:flex",
478
+ wide: "ds:flex ds:@max-[300px]/widget:hidden",
479
+ narrow: "ds:hidden ds:@max-[300px]/widget:flex"
480
+ }
481
+ },
482
+ defaultVariants: { when: "always" }
483
+ }
484
+ ), Ke = "ds:bg-[var(--card)] ds:data-[component=icon-button]:sm:before:block", cr = ce(
485
+ "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:pt-[var(--spacing-sm)]",
486
+ {
487
+ variants: {
488
+ editing: {
489
+ false: "",
490
+ true: "ds:cursor-grab ds:select-none ds:[-webkit-touch-callout:none]"
491
+ }
492
+ },
493
+ defaultVariants: { editing: !1 }
494
+ }
495
+ ), lr = ce(
496
+ [
497
+ "ds:m-0 ds:min-w-0 ds:flex-1 ds:truncate ds:text-sm ds:font-medium",
498
+ "ds:rounded-[var(--radius-sm)]",
499
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
500
+ ].join(" ")
501
+ ), Mt = Ot(
502
+ null
503
+ );
504
+ function bt(r) {
505
+ return r !== void 0 && Number.isFinite(r) && r >= 1 ? Math.floor(r) : void 0;
506
+ }
507
+ function Pe(r, s) {
508
+ zt.forEach(r, (i) => {
509
+ if (Xt(i)) {
510
+ if (i.type === Ft) {
511
+ Pe(
512
+ i.props.children,
513
+ s
514
+ );
515
+ return;
516
+ }
517
+ s(i);
518
+ }
519
+ });
520
+ }
521
+ function Gt({
522
+ id: r,
523
+ title: s,
524
+ minStackedHeight: i,
525
+ actions: c,
526
+ actionsSlot: p,
527
+ loading: N = !1,
528
+ loadingCaption: m,
529
+ children: b
530
+ }) {
531
+ var le, V, C;
532
+ const { t: M } = St("ui"), v = Pt(Mt), W = E(null), o = Ht(), h = !!N, [G, I] = q(h), [k, T] = q(!1);
533
+ G !== h && (I(h), T(!h));
534
+ const H = E(null), y = v == null ? void 0 : v.layoutById.get(r), [Y, D] = q(null), [S, ze] = q(!1), [ee, pe] = q(!1), [ge, A] = q(!1);
535
+ if (Z(() => {
536
+ if (!Y) return;
537
+ const g = () => ze(Y.scrollWidth > Y.clientWidth);
538
+ g();
539
+ const F = typeof document < "u" ? document.fonts : void 0;
540
+ F == null || F.addEventListener("loadingdone", g);
541
+ const B = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(g);
542
+ return B == null || B.observe(Y), () => {
543
+ F == null || F.removeEventListener("loadingdone", g), B == null || B.disconnect();
544
+ };
545
+ }, [Y, s]), Z(() => {
546
+ S || A(!1);
547
+ }, [S]), ne(() => {
548
+ const g = W.current;
549
+ !g || !y || (g.style.setProperty("--dg-x", String(y.x + 1)), g.style.setProperty("--dg-y", String(y.y + 1)), g.style.setProperty("--dg-w", String(y.w)), g.style.setProperty("--dg-h", String(y.h)), g.style.setProperty(
550
+ "--dg-min-stacked",
551
+ i !== void 0 && Number.isFinite(i) && i > 0 ? `${i}px` : "auto"
552
+ ));
553
+ }, [y == null ? void 0 : y.x, y == null ? void 0 : y.y, y == null ? void 0 : y.w, y == null ? void 0 : y.h, y, i]), !v || !y) return null;
554
+ const he = ((le = v.grab) == null ? void 0 : le.id) === r, X = v.editing, ve = [
555
+ ...c ?? [],
556
+ ...X && v.canRemove ? [
557
+ {
558
+ id: wt,
559
+ label: M("dashboardGrid.remove", { title: s }),
560
+ icon: /* @__PURE__ */ _(Kt, {}),
561
+ onSelect: () => v.requestRemove(r)
562
+ }
563
+ ] : []
564
+ ], Ge = ve.length > 1, se = h && (m == null ? void 0 : m.trim()) || void 0, Te = v.headingLevel ? `h${v.headingLevel}` : "span";
565
+ return /* @__PURE__ */ we(
566
+ "div",
567
+ {
568
+ ref: W,
569
+ role: "listitem",
570
+ "aria-label": s,
571
+ "data-component": "dashboard-grid-widget",
572
+ "data-widget-id": r,
573
+ "data-grabbed": he || void 0,
574
+ "data-selected": v.selectedId === r || void 0,
575
+ "data-revealed": v.revealedId === r || void 0,
576
+ "data-loading": h || void 0,
577
+ "aria-busy": h || void 0,
578
+ "aria-describedby": h ? o : void 0,
579
+ "aria-current": v.selectedId === r ? "true" : void 0,
580
+ className: ir({
581
+ stacked: v.stacked,
582
+ stackedHeight: v.stackedHeight
583
+ }),
584
+ children: [
585
+ /* @__PURE__ */ we(
586
+ "div",
587
+ {
588
+ className: cr({ editing: X }),
589
+ onPointerDown: X ? (g) => v.startHeaderPress(r, g) : void 0,
590
+ children: [
591
+ X ? /* @__PURE__ */ _(
592
+ $e,
593
+ {
594
+ size: "sm",
595
+ intent: "outline",
596
+ type: "button",
597
+ icon: /* @__PURE__ */ _(qt, {}),
598
+ "aria-label": M("dashboardGrid.move", { title: s }),
599
+ "aria-pressed": he && ((V = v.grab) == null ? void 0 : V.kind) === "move",
600
+ className: `ds:cursor-grab ds:touch-none ${Ke}`,
601
+ onPointerDown: (g) => v.startPointerGrab("move", r, g),
602
+ onKeyDown: (g) => v.keyboardStep(g, r),
603
+ onClick: () => v.startKeyboardGrab("move", r)
604
+ }
605
+ ) : null,
606
+ /* @__PURE__ */ _(
607
+ Yt,
608
+ {
609
+ label: s,
610
+ open: S && ge,
611
+ onOpenChange: (g) => A(g && S),
612
+ children: /* @__PURE__ */ _(
613
+ Te,
614
+ {
615
+ ref: D,
616
+ tabIndex: S || ee ? 0 : void 0,
617
+ "data-dashboard-grid-title": "",
618
+ onFocus: () => pe(!0),
619
+ onBlur: () => pe(!1),
620
+ className: lr(),
621
+ children: s
622
+ }
623
+ )
624
+ }
625
+ ),
626
+ p,
627
+ ve.length > 0 ? /* @__PURE__ */ _(
628
+ "div",
629
+ {
630
+ className: vt({
631
+ when: Ge ? "wide" : "always"
632
+ }),
633
+ children: ve.map((g) => /* @__PURE__ */ _(
634
+ $e,
635
+ {
636
+ size: "sm",
637
+ intent: "outline",
638
+ type: "button",
639
+ icon: g.icon,
640
+ className: Ke,
641
+ "aria-label": g.label,
642
+ onClick: g.onSelect
643
+ },
644
+ g.id
645
+ ))
646
+ }
647
+ ) : null,
648
+ Ge ? /* @__PURE__ */ _("div", { className: vt({ when: "narrow" }), children: /* @__PURE__ */ we(De.Root, { modal: !1, children: [
649
+ /* @__PURE__ */ _(De.Trigger, { asChild: !0, children: /* @__PURE__ */ _(
650
+ $e,
651
+ {
652
+ size: "sm",
653
+ intent: "outline",
654
+ type: "button",
655
+ icon: /* @__PURE__ */ _(Ut, {}),
656
+ className: Ke,
657
+ "aria-label": M("dashboardGrid.moreActions", { title: s })
658
+ }
659
+ ) }),
660
+ /* @__PURE__ */ _(
661
+ De.Content,
662
+ {
663
+ align: "end",
664
+ onCloseAutoFocus: (g) => {
665
+ const F = H.current;
666
+ if (H.current = null, !F) return;
667
+ const B = document.activeElement;
668
+ F.onSelect(), (F.id === wt || document.activeElement !== B) && g.preventDefault();
669
+ },
670
+ children: ve.map((g) => /* @__PURE__ */ _(
671
+ De.Item,
672
+ {
673
+ startIcon: g.icon,
674
+ onSelect: () => {
675
+ H.current = g;
676
+ },
677
+ children: g.label
678
+ },
679
+ g.id
680
+ ))
681
+ }
682
+ )
683
+ ] }) }) : null
684
+ ]
685
+ }
686
+ ),
687
+ /* @__PURE__ */ _(
688
+ "div",
689
+ {
690
+ className: or({
691
+ fit: v.stacked && v.stackedHeight === "content" ? "content" : "box",
692
+ editing: X,
693
+ captioned: !!se,
694
+ settling: k
695
+ }),
696
+ onAnimationEnd: (g) => {
697
+ g.target === g.currentTarget && T(!1);
698
+ },
699
+ children: b
700
+ }
701
+ ),
702
+ se ? /* @__PURE__ */ _("p", { id: o, className: dr({ editing: X }), children: se }) : h ? (
703
+ // The placeholder is hidden from assistive technology, so the
704
+ // widget would otherwise read as empty.
705
+ /* @__PURE__ */ _("span", { id: o, className: "ds:sr-only", children: M("common.loading") })
706
+ ) : null,
707
+ X ? /* @__PURE__ */ _(
708
+ "button",
709
+ {
710
+ type: "button",
711
+ "aria-label": M("dashboardGrid.resize", { title: s }),
712
+ "aria-pressed": he && ((C = v.grab) == null ? void 0 : C.kind) === "resize",
713
+ className: ar(),
714
+ onPointerDown: (g) => v.startPointerGrab("resize", r, g),
715
+ onKeyDown: (g) => v.keyboardStep(g, r),
716
+ onClick: () => v.startKeyboardGrab("resize", r),
717
+ children: /* @__PURE__ */ _(Qt, { "aria-hidden": "true" })
718
+ }
719
+ ) : null
720
+ ]
721
+ }
722
+ );
723
+ }
724
+ Gt.displayName = "DashboardGrid.Widget";
725
+ const yt = 1e3, ur = 1600, fr = [
726
+ "button",
727
+ "a",
728
+ "input",
729
+ "select",
730
+ "textarea",
731
+ "label",
732
+ "summary",
733
+ '[contenteditable]:not([contenteditable="false"])',
734
+ '[role="button"]',
735
+ '[role="menuitem"]',
736
+ "[tabindex]:not([data-dashboard-grid-title])"
737
+ ].join(", "), wt = "__remove__", xt = 4, mr = 400, pr = 8, qe = 48, gr = 18;
738
+ function hr(r) {
739
+ const s = {
740
+ x: null,
741
+ y: null
742
+ }, i = (c) => c === "auto" || c === "scroll" || c === "overlay";
743
+ for (let c = r.parentElement; c && c !== document.body && c !== document.documentElement && !(s.x && s.y); c = c.parentElement) {
744
+ const p = window.getComputedStyle(c);
745
+ !s.y && i(p.overflowY) && c.scrollHeight > c.clientHeight && (s.y = c), !s.x && i(p.overflowX) && c.scrollWidth > c.clientWidth && (s.x = c);
746
+ }
747
+ return s;
748
+ }
749
+ function ye(r, s, i, c, p, N, m = !0) {
750
+ const b = r.find((h) => h.id === i);
751
+ if (!b) return r;
752
+ const M = m ? Et(r) + 2 : Number.POSITIVE_INFINITY, v = s === "move" ? er(r, i, c, Math.min(p, M - b.h), N) : tr(r, i, c, Math.min(p, M - b.y), N), W = v.find((h) => h.id === i);
753
+ return W !== void 0 && W.x === b.x && W.y === b.y && W.w === b.w && W.h === b.h ? r : v;
754
+ }
755
+ function kt(r) {
756
+ if (r >= qe) return 0;
757
+ const s = (qe - Math.max(0, r)) / qe;
758
+ return Math.ceil(s * gr);
759
+ }
760
+ const Tt = Wt(
761
+ ({
762
+ "aria-label": r,
763
+ id: s,
764
+ cols: i = 12,
765
+ rowHeight: c = 96,
766
+ layout: p,
767
+ defaultLayout: N,
768
+ onLayoutChange: m,
769
+ editing: b = !1,
770
+ onRemoveWidget: M,
771
+ onRequestAdd: v,
772
+ stackBelow: W,
773
+ onStackedChange: o,
774
+ stackedHeight: h = "grid",
775
+ selectedId: G,
776
+ widgetHeadingLevel: I,
777
+ children: k,
778
+ className: T
779
+ }, H) => {
780
+ const { t: y } = St("ui"), Y = E(null), D = E(null), [S, ze] = q(!1), ee = E(!1);
781
+ ee.current = S;
782
+ const pe = E(null), ge = L((e) => {
783
+ var d;
784
+ if (e === ee.current) return;
785
+ const t = Y.current, n = typeof document < "u" ? document.activeElement : null;
786
+ pe.current = t && n instanceof HTMLElement && t.contains(n) ? {
787
+ element: n,
788
+ widgetId: ((d = n.closest("[data-widget-id]")) == null ? void 0 : d.getAttribute("data-widget-id")) ?? null
789
+ } : null, ee.current = e, ze(e);
790
+ }, []);
791
+ ne(() => {
792
+ const e = Y.current;
793
+ if (!e) return;
794
+ if (W === void 0) {
795
+ ge(!1);
796
+ return;
797
+ }
798
+ if (ge(
799
+ ht(e.offsetWidth, W, ee.current)
800
+ ), typeof ResizeObserver > "u") return;
801
+ const t = new ResizeObserver((n) => {
802
+ var a, f;
803
+ const d = n[n.length - 1];
804
+ if (!d) return;
805
+ const l = ((f = (a = d.borderBoxSize) == null ? void 0 : a[0]) == null ? void 0 : f.inlineSize) ?? d.contentRect.width;
806
+ ge(ht(l, W, ee.current));
807
+ });
808
+ return t.observe(e), () => t.disconnect();
809
+ }, [W, ge]);
810
+ const A = b && !S, he = de(() => {
811
+ const e = [];
812
+ return Pe(k, (t) => {
813
+ t.props.id && e.push(t.props.id);
814
+ }), e;
815
+ }, [k]), X = de(() => {
816
+ const e = /* @__PURE__ */ new Map();
817
+ return Pe(k, (t) => {
818
+ t.props.id && e.set(t.props.id, {
819
+ defaultW: t.props.defaultW ?? 4,
820
+ defaultH: t.props.defaultH ?? 2,
821
+ minW: bt(t.props.minW),
822
+ minH: bt(t.props.minH),
823
+ loading: !!t.props.loading
824
+ });
825
+ }), e;
826
+ }, [k]), [ve, Ge] = q(() => N ?? []), se = p ?? ve, Te = E(se);
827
+ Te.current = se;
828
+ const le = L(
829
+ (e) => e.map((t) => {
830
+ const n = Te.current.find((f) => f.id === t.id), { minW: d, minH: l, ...a } = t;
831
+ return {
832
+ ...a,
833
+ ...(n == null ? void 0 : n.minW) !== void 0 ? { minW: n.minW } : {},
834
+ ...(n == null ? void 0 : n.minH) !== void 0 ? { minH: n.minH } : {}
835
+ };
836
+ }),
837
+ []
838
+ ), V = L(
839
+ (e) => {
840
+ const t = le(e);
841
+ p === void 0 && Ge(t), m == null || m(t);
842
+ },
843
+ [p, m, le]
844
+ ), { resolved: C, autoPlaced: g } = de(() => {
845
+ const e = (l) => {
846
+ const a = X.get(l.id);
847
+ return He(
848
+ {
849
+ ...l,
850
+ ...(a == null ? void 0 : a.minW) !== void 0 ? { minW: Math.max(l.minW ?? 1, a.minW) } : {},
851
+ ...(a == null ? void 0 : a.minH) !== void 0 ? { minH: Math.max(l.minH ?? 1, a.minH) } : {}
852
+ },
853
+ i
854
+ );
855
+ }, t = se.map(e), n = he.filter(
856
+ (l) => !t.some((a) => a.id === l)
857
+ );
858
+ if (n.length === 0)
859
+ return {
860
+ resolved: t.some(
861
+ (a, f) => t.some((x, u) => u > f && z(a, x))
862
+ ) ? ae(t, i) : t,
863
+ autoPlaced: !1
864
+ };
865
+ const d = [...t];
866
+ for (const l of n) {
867
+ const a = X.get(l) ?? {
868
+ defaultW: 4,
869
+ defaultH: 2
870
+ }, f = Math.min(Math.max(a.defaultW, a.minW ?? 1), i), x = Math.max(a.defaultH, a.minH ?? 1), u = gt(d, i, f, x);
871
+ d.push(e({ id: l, x: u.x, y: u.y, w: f, h: x }));
872
+ }
873
+ return { resolved: ae(d, i), autoPlaced: !0 };
874
+ }, [se, he, X, i]), F = E("");
875
+ Z(() => {
876
+ if (!g) return;
877
+ const e = C.map(
878
+ (t) => `${t.id}:${t.x},${t.y},${t.w},${t.h}`
879
+ ).join("|");
880
+ F.current !== e && (F.current = e, V(C));
881
+ }, [g, C, V]);
882
+ const [B, _t] = q(null), [ue, Ue] = q(null), [At, fe] = q(""), Xe = E(null), U = E(null), me = E(null), Fe = E(!1), xe = E(i);
883
+ xe.current = i;
884
+ const be = E(C);
885
+ be.current = C;
886
+ const ie = L((e) => {
887
+ Xe.current = e, _t(e);
888
+ }, []), _e = L(
889
+ (e, t, n) => {
890
+ const d = { kind: e, id: t, via: n };
891
+ U.current = { ...d, baseLayout: be.current }, Ue(d), ie(be.current);
892
+ },
893
+ [ie]
894
+ ), ke = B ?? C, Be = de(
895
+ () => new Map(ke.map((e) => [e.id, e])),
896
+ [ke]
897
+ ), Je = L(
898
+ (e, t) => {
899
+ fe(
900
+ e === "move" ? y("dashboardGrid.movedTo", { col: t.x + 1, row: t.y + 1 }) : y("dashboardGrid.resizedTo", { cols: t.w, rows: t.h })
901
+ );
902
+ },
903
+ [y]
904
+ ), j = E(null), $ = L(
905
+ (e) => {
906
+ var f;
907
+ (f = j.current) == null || f.call(j), j.current = null;
908
+ const t = Xe.current, n = U.current;
909
+ if (U.current = null, me.current = null, Ue(null), ie(null), !e || !t || !n) {
910
+ fe(y("dashboardGrid.cancelled"));
911
+ return;
912
+ }
913
+ const d = ae(t, xe.current), l = (x) => x.map((u) => `${u.id}:${u.x},${u.y},${u.w},${u.h}`).join("|");
914
+ if (l(d) === l(be.current)) {
915
+ fe(y("dashboardGrid.cancelled"));
916
+ return;
917
+ }
918
+ V(d);
919
+ const a = d.find((x) => x.id === n.id);
920
+ fe(
921
+ a ? y("dashboardGrid.droppedAt", {
922
+ col: a.x + 1,
923
+ row: a.y + 1
924
+ }) : y("dashboardGrid.cancelled")
925
+ );
926
+ },
927
+ [ie, V, y]
928
+ ), Oe = E($);
929
+ Oe.current = $;
930
+ const Qe = L(
931
+ (e, t) => {
932
+ if (!A) return;
933
+ if (Fe.current) {
934
+ Fe.current = !1;
935
+ return;
936
+ }
937
+ const n = U.current;
938
+ if ((n == null ? void 0 : n.via) !== "pointer") {
939
+ if (n && n.id === t && n.kind === e) {
940
+ $(!0);
941
+ return;
942
+ }
943
+ _e(e, t, "keyboard"), fe(
944
+ y(e === "move" ? "dashboardGrid.grabbed" : "dashboardGrid.resizeGrabbed")
945
+ );
946
+ }
947
+ },
948
+ [A, _e, $, y]
949
+ ), Ze = L(
950
+ (e, t) => {
951
+ const n = U.current;
952
+ if (!n || n.id !== t || n.via !== "keyboard")
953
+ return;
954
+ if (e.key === "Escape") {
955
+ e.preventDefault(), $(!1);
956
+ return;
957
+ }
958
+ if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(e.key)) return;
959
+ e.preventDefault();
960
+ const l = typeof window < "u" && D.current ? window.getComputedStyle(D.current).direction === "rtl" : !1, a = e.key === "ArrowRight" ? l ? -1 : 1 : e.key === "ArrowLeft" ? l ? 1 : -1 : 0, f = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0, u = (Xe.current ?? n.baseLayout).find((P) => P.id === t);
961
+ if (!u) return;
962
+ const w = n.kind === "move" ? ye(
963
+ n.baseLayout,
964
+ "move",
965
+ t,
966
+ u.x + a,
967
+ u.y + f,
968
+ i
969
+ ) : ye(
970
+ n.baseLayout,
971
+ "resize",
972
+ t,
973
+ u.w + a,
974
+ u.h + f,
975
+ i
976
+ );
977
+ ie(w);
978
+ const R = w.find((P) => P.id === t);
979
+ R && Je(n.kind, R);
980
+ },
981
+ [i, $, ie, Je]
982
+ ), Se = L(() => {
983
+ const e = me.current, t = U.current, n = D.current;
984
+ if (!e || !t || !n) return;
985
+ const d = n.getBoundingClientRect(), l = e.lastClientX - d.left - e.startGridX, a = e.lastClientY - d.top - e.startGridY, f = Math.round(l / e.colStride) * (e.isRtl ? -1 : 1), x = Math.round(a / e.rowStride), { origin: u } = e;
986
+ ie(
987
+ e.kind === "move" ? ye(
988
+ t.baseLayout,
989
+ "move",
990
+ e.id,
991
+ u.x + f,
992
+ u.y + x,
993
+ xe.current
994
+ ) : ye(
995
+ t.baseLayout,
996
+ "resize",
997
+ e.id,
998
+ u.w + f,
999
+ u.h + x,
1000
+ xe.current
1001
+ )
1002
+ );
1003
+ }, [ie]), Ae = E(!1), et = L(() => {
1004
+ var x;
1005
+ (x = j.current) == null || x.call(j);
1006
+ const e = (u) => {
1007
+ const w = me.current;
1008
+ !w || u.pointerId !== w.pointerId || (w.lastClientX = u.clientX, w.lastClientY = u.clientY, w.travelled || (w.travelled = Math.hypot(
1009
+ u.clientX - w.pressX,
1010
+ u.clientY - w.pressY
1011
+ ) > xt), Se());
1012
+ }, t = (u) => (w) => {
1013
+ const R = me.current;
1014
+ !R || w.pointerId !== R.pointerId || (Fe.current = R.fromHandle, Oe.current(u));
1015
+ }, n = t(!0), d = t(!1), l = () => Se();
1016
+ let a = 0;
1017
+ const f = () => {
1018
+ a = requestAnimationFrame(f);
1019
+ const u = me.current;
1020
+ if (!(u != null && u.travelled)) return;
1021
+ const w = D.current;
1022
+ if (!w) return;
1023
+ const { lastClientX: R, lastClientY: P } = u, J = hr(w), We = (Q, lt, re) => {
1024
+ const je = re ? window.innerHeight : window.innerWidth, K = Q == null ? void 0 : Q.getBoundingClientRect(), Ct = Math.max(
1025
+ re ? (K == null ? void 0 : K.top) ?? 0 : (K == null ? void 0 : K.left) ?? 0,
1026
+ 0
1027
+ ), Lt = Math.min(
1028
+ re ? (K == null ? void 0 : K.bottom) ?? je : (K == null ? void 0 : K.right) ?? je,
1029
+ je
1030
+ ), Me = kt(Lt - lt) - kt(lt - Ct);
1031
+ if (Me === 0) return;
1032
+ const ut = () => Q ? re ? Q.scrollTop : Q.scrollLeft : re ? window.scrollY : window.scrollX, Nt = ut();
1033
+ Q == null || Q.scrollBy(re ? 0 : Me, re ? Me : 0), (!Q || ut() === Nt) && window.scrollBy(re ? 0 : Me, re ? Me : 0);
1034
+ };
1035
+ We(J.y, P, !0), We(J.x, R, !1);
1036
+ };
1037
+ a = requestAnimationFrame(f), window.addEventListener("pointermove", e), window.addEventListener("pointerup", n), window.addEventListener("pointercancel", d), window.addEventListener("scroll", l, {
1038
+ capture: !0,
1039
+ passive: !0
1040
+ }), j.current = () => {
1041
+ cancelAnimationFrame(a), Ae.current = !1, window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", d), window.removeEventListener("scroll", l, { capture: !0 });
1042
+ };
1043
+ }, [Se]);
1044
+ Z(
1045
+ () => () => {
1046
+ var e;
1047
+ (e = j.current) == null || e.call(j), j.current = null;
1048
+ },
1049
+ []
1050
+ );
1051
+ const Ie = L(
1052
+ (e, t, n, d, l) => {
1053
+ var J;
1054
+ const a = D.current, f = be.current.find((We) => We.id === t);
1055
+ if (!a || !f) return !1;
1056
+ const x = a.getBoundingClientRect();
1057
+ if (x.width <= 0) return !1;
1058
+ const u = window.getComputedStyle(a), w = Number.parseFloat(u.columnGap) || 0, R = Number.parseFloat(u.rowGap) || 0, P = (x.width - w * (i - 1)) / i;
1059
+ me.current = {
1060
+ kind: e,
1061
+ id: t,
1062
+ pointerId: n.pointerId,
1063
+ startGridX: n.clientX - x.left,
1064
+ startGridY: n.clientY - x.top,
1065
+ lastClientX: n.clientX,
1066
+ lastClientY: n.clientY,
1067
+ origin: f,
1068
+ colStride: P + w,
1069
+ rowStride: c + R,
1070
+ isRtl: u.direction === "rtl",
1071
+ fromHandle: l,
1072
+ pressX: n.clientX,
1073
+ pressY: n.clientY,
1074
+ travelled: !1
1075
+ };
1076
+ try {
1077
+ (J = d.setPointerCapture) == null || J.call(d, n.pointerId);
1078
+ } catch {
1079
+ }
1080
+ return _e(e, t, "pointer"), et(), !0;
1081
+ },
1082
+ [i, c, _e, et]
1083
+ ), tt = L(
1084
+ (e, t, n) => {
1085
+ var d, l;
1086
+ A && (U.current || (n.preventDefault(), (l = (d = n.currentTarget).focus) == null || l.call(d), Ie(e, t, n, n.currentTarget, !0)));
1087
+ },
1088
+ [A, Ie]
1089
+ ), te = E(null), oe = L(() => {
1090
+ const e = te.current;
1091
+ te.current = null, e && (e.holdTimer && clearTimeout(e.holdTimer), e.cleanup());
1092
+ }, []), rt = L(
1093
+ (e, t) => {
1094
+ if (!A || U.current || te.current || t.button !== 0 || !t.isPrimary) return;
1095
+ const n = t.target;
1096
+ if (!t.currentTarget.contains(n)) return;
1097
+ const d = n.closest(fr);
1098
+ if (d && t.currentTarget.contains(d)) return;
1099
+ const l = t.currentTarget, a = t.pointerType === "touch";
1100
+ a || t.preventDefault();
1101
+ const f = (w, R) => {
1102
+ const P = te.current;
1103
+ if (oe(), !(!P || U.current) && Ie(
1104
+ "move",
1105
+ P.id,
1106
+ {
1107
+ pointerId: P.pointerId,
1108
+ clientX: P.startClientX,
1109
+ clientY: P.startClientY
1110
+ },
1111
+ P.surface,
1112
+ !1
1113
+ )) {
1114
+ Ae.current = a;
1115
+ const J = me.current;
1116
+ J && (J.lastClientX = w, J.lastClientY = R, J.travelled = !a), Se();
1117
+ }
1118
+ }, x = (w) => {
1119
+ const R = te.current;
1120
+ if (!R || w.pointerId !== R.pointerId) return;
1121
+ const P = Math.hypot(
1122
+ w.clientX - R.startClientX,
1123
+ w.clientY - R.startClientY
1124
+ );
1125
+ a ? P > pr && oe() : P > xt && f(w.clientX, w.clientY);
1126
+ }, u = (w) => {
1127
+ var R;
1128
+ w.pointerId === ((R = te.current) == null ? void 0 : R.pointerId) && oe();
1129
+ };
1130
+ window.addEventListener("pointermove", x), window.addEventListener("pointerup", u), window.addEventListener("pointercancel", u), te.current = {
1131
+ id: e,
1132
+ pointerId: t.pointerId,
1133
+ pointerType: t.pointerType,
1134
+ startClientX: t.clientX,
1135
+ startClientY: t.clientY,
1136
+ surface: l,
1137
+ holdTimer: a ? setTimeout(() => {
1138
+ const w = te.current;
1139
+ w && f(w.startClientX, w.startClientY);
1140
+ }, mr) : null,
1141
+ cleanup: () => {
1142
+ window.removeEventListener("pointermove", x), window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", u);
1143
+ }
1144
+ };
1145
+ },
1146
+ [A, Ie, Se, oe]
1147
+ );
1148
+ Z(() => {
1149
+ A || (oe(), U.current && Oe.current(!1));
1150
+ }, [A, oe]), Z(() => oe, [oe]), Z(() => {
1151
+ const e = D.current;
1152
+ if (!A || !e) return;
1153
+ const t = (d) => {
1154
+ Ae.current && d.cancelable && d.preventDefault();
1155
+ }, n = (d) => {
1156
+ (te.current || Ae.current) && d.preventDefault();
1157
+ };
1158
+ return e.addEventListener("touchmove", t, { passive: !1 }), e.addEventListener("contextmenu", n), () => {
1159
+ e.removeEventListener("touchmove", t), e.removeEventListener("contextmenu", n);
1160
+ };
1161
+ }, [A]), Z(() => {
1162
+ if (!ue) return;
1163
+ const e = (t) => {
1164
+ t.key === "Escape" && $(!1);
1165
+ };
1166
+ return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1167
+ }, [ue, $]), Z(() => {
1168
+ if (!ue || ue.via !== "keyboard") return;
1169
+ const e = (n) => {
1170
+ var l;
1171
+ const d = n.relatedTarget;
1172
+ (!d || !((l = D.current) != null && l.contains(d))) && $(!1);
1173
+ }, t = D.current;
1174
+ return t == null || t.addEventListener("focusout", e), () => t == null ? void 0 : t.removeEventListener("focusout", e);
1175
+ }, [ue, $]), ne(() => {
1176
+ S && (U.current && $(!1), b && fe(y("dashboardGrid.stackedReadOnly")));
1177
+ }, [S, b, $, y]), ne(() => {
1178
+ var l;
1179
+ const e = pe.current;
1180
+ pe.current = null;
1181
+ const t = Y.current;
1182
+ if (!e || !t) return;
1183
+ const n = document.activeElement;
1184
+ if (n === e.element || n !== null && n !== document.body) return;
1185
+ if (t.contains(e.element)) {
1186
+ e.element.focus();
1187
+ return;
1188
+ }
1189
+ const d = e.widgetId ? Array.from(
1190
+ t.querySelectorAll("[data-widget-id]")
1191
+ ).find(
1192
+ (a) => a.getAttribute("data-widget-id") === e.widgetId
1193
+ ) : void 0;
1194
+ if (d) {
1195
+ d.setAttribute("tabindex", "-1"), d.focus();
1196
+ return;
1197
+ }
1198
+ (l = D.current) == null || l.focus();
1199
+ }, [S]);
1200
+ const Re = E(o);
1201
+ Re.current = o;
1202
+ const nt = E(!1);
1203
+ ne(() => {
1204
+ var e;
1205
+ nt.current !== S && (nt.current = S, (e = Re.current) == null || e.call(Re, S));
1206
+ }, [S]), ne(() => {
1207
+ const e = D.current;
1208
+ e && (e.style.setProperty("--dg-cols", String(i)), e.style.setProperty("--dg-row", `${c}px`));
1209
+ }, [i, c]);
1210
+ const st = Et(ke);
1211
+ ne(() => {
1212
+ const e = D.current;
1213
+ e && (e.style.setProperty(
1214
+ "--dg-grid-lines",
1215
+ `repeating-linear-gradient(to right, color-mix(in srgb, var(--border) 50%, transparent) 0 1px, transparent 1px calc((100% + var(--spacing-md)) / ${i})), repeating-linear-gradient(to bottom, color-mix(in srgb, var(--border) 50%, transparent) 0 1px, transparent 1px calc(${c}px + var(--spacing-md)))`
1216
+ ), e.style.setProperty(
1217
+ "--dg-min-block",
1218
+ `calc(${st + 2} * (${c}px + var(--spacing-md)) - var(--spacing-md))`
1219
+ ));
1220
+ }, [i, c, st]);
1221
+ const it = E(null), Ye = A && !!v, Ce = de(
1222
+ () => Ye ? gt(ke, i, 2, 2) : null,
1223
+ [Ye, ke, i]
1224
+ );
1225
+ ne(() => {
1226
+ const e = it.current;
1227
+ !e || !Ce || (e.style.setProperty("--dg-x", String(Ce.x + 1)), e.style.setProperty("--dg-y", String(Ce.y + 1)), e.style.setProperty("--dg-w", "2"), e.style.setProperty("--dg-h", "2"));
1228
+ }, [Ce]);
1229
+ const ot = L(
1230
+ (e) => {
1231
+ var l, a;
1232
+ const t = Array.from(
1233
+ ((l = D.current) == null ? void 0 : l.querySelectorAll("[data-widget-id]")) ?? []
1234
+ ), n = t.findIndex(
1235
+ (f) => f.getAttribute("data-widget-id") === e
1236
+ ), d = (a = t[n + 1] ?? t[n - 1]) == null ? void 0 : a.getAttribute(
1237
+ "data-widget-id"
1238
+ );
1239
+ V(
1240
+ ae(
1241
+ be.current.filter((f) => f.id !== e),
1242
+ xe.current
1243
+ )
1244
+ ), fe(y("dashboardGrid.removed")), M == null || M(e), requestAnimationFrame(() => {
1245
+ const f = D.current;
1246
+ if (!f) return;
1247
+ const x = Array.from(
1248
+ f.querySelectorAll("[data-widget-id]")
1249
+ ).find((w) => w.getAttribute("data-widget-id") === d), u = (x == null ? void 0 : x.querySelector("button")) ?? f.querySelector("button");
1250
+ u ? u.focus() : f.focus();
1251
+ });
1252
+ },
1253
+ [V, M, y]
1254
+ ), [dt, at] = q(null), O = E(null), Ee = E(null), Le = E(0), Ne = L(() => {
1255
+ var a;
1256
+ const e = O.current, t = D.current;
1257
+ if (!e || !t) return !1;
1258
+ const n = Array.from(
1259
+ t.querySelectorAll("[data-widget-id]")
1260
+ ).find((f) => f.getAttribute("data-widget-id") === e.id), d = n == null ? void 0 : n.getBoundingClientRect();
1261
+ if (!n || !d || d.height <= 0)
1262
+ return performance.now() > e.deadline && (O.current = null, e.resolve(!1)), !1;
1263
+ O.current = null;
1264
+ const l = ((a = window.matchMedia) == null ? void 0 : a.call(window, "(prefers-reduced-motion: reduce)").matches) || window.getComputedStyle(t).getPropertyValue("--animation-duration").trim() === "0ms";
1265
+ return n.scrollIntoView({
1266
+ block: "nearest",
1267
+ inline: "nearest",
1268
+ behavior: l ? "auto" : "smooth"
1269
+ }), at(e.id), Ee.current && clearTimeout(Ee.current), Ee.current = setTimeout(
1270
+ () => at(null),
1271
+ ur
1272
+ ), e.resolve(!0), !0;
1273
+ }, []), ct = L(
1274
+ (e) => new Promise((t) => {
1275
+ var a;
1276
+ (a = O.current) == null || a.resolve(!1), cancelAnimationFrame(Le.current);
1277
+ const n = setTimeout(() => {
1278
+ const f = O.current;
1279
+ (f == null ? void 0 : f.resolve) === d && !Ne() && O.current === f && (O.current = null, d(!1));
1280
+ }, yt), d = (f) => {
1281
+ clearTimeout(n), t(f);
1282
+ };
1283
+ O.current = {
1284
+ id: e,
1285
+ deadline: performance.now() + yt,
1286
+ resolve: d
1287
+ };
1288
+ const l = () => {
1289
+ O.current && !Ne() && O.current && (Le.current = requestAnimationFrame(l));
1290
+ };
1291
+ Le.current = requestAnimationFrame(l);
1292
+ }),
1293
+ [Ne]
1294
+ );
1295
+ ne(() => {
1296
+ O.current && Ne();
1297
+ }), Z(
1298
+ () => () => {
1299
+ var e;
1300
+ cancelAnimationFrame(Le.current), Ee.current && clearTimeout(Ee.current), (e = O.current) == null || e.resolve(!1), O.current = null;
1301
+ },
1302
+ []
1303
+ );
1304
+ const Ve = de(
1305
+ () => ({
1306
+ moveWidgetTo(e, t, n) {
1307
+ if (!A || ee.current || !Number.isFinite(t) || !Number.isFinite(n) || !C.some((l) => l.id === e)) return !1;
1308
+ const d = ye(
1309
+ C,
1310
+ "move",
1311
+ e,
1312
+ Math.round(t),
1313
+ Math.round(n),
1314
+ i,
1315
+ !1
1316
+ );
1317
+ return d !== C && V(ae(d, i)), !0;
1318
+ },
1319
+ resizeWidgetTo(e, t, n) {
1320
+ if (!A || ee.current || !Number.isFinite(t) || !Number.isFinite(n) || !C.some((l) => l.id === e)) return !1;
1321
+ const d = ye(
1322
+ C,
1323
+ "resize",
1324
+ e,
1325
+ Math.round(t),
1326
+ Math.round(n),
1327
+ i,
1328
+ !1
1329
+ );
1330
+ return d !== C && V(ae(d, i)), !0;
1331
+ },
1332
+ revealWidget: ct,
1333
+ getGridState() {
1334
+ return {
1335
+ cols: i,
1336
+ editing: b,
1337
+ stacked: S,
1338
+ layout: le(C),
1339
+ selectedId: G ?? null,
1340
+ loadingIds: [...X].filter(([, e]) => e.loading).map(([e]) => e)
1341
+ };
1342
+ }
1343
+ }),
1344
+ [
1345
+ A,
1346
+ b,
1347
+ S,
1348
+ C,
1349
+ i,
1350
+ V,
1351
+ le,
1352
+ ct,
1353
+ G,
1354
+ X
1355
+ ]
1356
+ );
1357
+ Dt(H, () => Ve, [Ve]), jt(Zt, Ve, s);
1358
+ const It = de(
1359
+ () => ({
1360
+ editing: A,
1361
+ stacked: S,
1362
+ stackedHeight: h,
1363
+ selectedId: G,
1364
+ revealedId: dt,
1365
+ headingLevel: I,
1366
+ layoutById: Be,
1367
+ grab: ue,
1368
+ canRemove: !!M,
1369
+ requestRemove: ot,
1370
+ startKeyboardGrab: Qe,
1371
+ keyboardStep: Ze,
1372
+ startPointerGrab: tt,
1373
+ startHeaderPress: rt
1374
+ }),
1375
+ [
1376
+ A,
1377
+ S,
1378
+ h,
1379
+ G,
1380
+ dt,
1381
+ I,
1382
+ Be,
1383
+ ue,
1384
+ M,
1385
+ ot,
1386
+ Qe,
1387
+ Ze,
1388
+ tt,
1389
+ rt
1390
+ ]
1391
+ ), Rt = de(() => {
1392
+ if (W === void 0) return k;
1393
+ const e = [], t = /* @__PURE__ */ new Map(), n = [];
1394
+ return Pe(k, (d) => {
1395
+ const l = d.props.id;
1396
+ if (l && !t.has(l)) {
1397
+ const a = ft(d, {
1398
+ key: `widget:${l}:${d.key ?? ""}`
1399
+ });
1400
+ t.set(l, a), e.push(a);
1401
+ } else {
1402
+ const a = ft(d, {
1403
+ key: d.key === null ? `child:at:${n.length}` : `child:key:${d.key}`
1404
+ });
1405
+ n.push(a), e.push(a);
1406
+ }
1407
+ }), S ? [
1408
+ ...nr([...t.keys()], C).map(
1409
+ (d) => t.get(d)
1410
+ ),
1411
+ ...n
1412
+ ] : e;
1413
+ }, [W, k, S, C]);
1414
+ return /* @__PURE__ */ we(
1415
+ "div",
1416
+ {
1417
+ ref: Y,
1418
+ "data-component": "dashboard-grid",
1419
+ "data-component-id": s,
1420
+ "data-editing": A || void 0,
1421
+ "data-stacked": S || void 0,
1422
+ className: `ds:block ds:w-full ${T ?? ""}`.trim(),
1423
+ children: [
1424
+ /* @__PURE__ */ _("div", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: At }),
1425
+ /* @__PURE__ */ we(
1426
+ "div",
1427
+ {
1428
+ ref: D,
1429
+ role: "list",
1430
+ "aria-label": r,
1431
+ tabIndex: -1,
1432
+ "data-editing": A || void 0,
1433
+ "data-stacked": S || void 0,
1434
+ className: sr({ stacked: S }),
1435
+ children: [
1436
+ /* @__PURE__ */ _(Mt.Provider, { value: It, children: Rt }),
1437
+ Ye ? (
1438
+ // role="list" allows only listitem children — the tile wrapper
1439
+ // carries the grid placement, the button fills it.
1440
+ /* @__PURE__ */ _(
1441
+ "div",
1442
+ {
1443
+ ref: it,
1444
+ role: "listitem",
1445
+ className: [
1446
+ "ds:flex",
1447
+ "ds:[grid-column-start:var(--dg-x)] ds:[grid-column-end:span_var(--dg-w)]",
1448
+ "ds:[grid-row-start:var(--dg-y)] ds:[grid-row-end:span_var(--dg-h)]"
1449
+ ].join(" "),
1450
+ children: /* @__PURE__ */ we(
1451
+ "button",
1452
+ {
1453
+ type: "button",
1454
+ onClick: v,
1455
+ className: [
1456
+ "ds:flex ds:flex-1 ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)]",
1457
+ "ds:rounded-[var(--radius-lg)] ds:border ds:border-dashed ds:border-border",
1458
+ "ds:text-sm ds:text-muted-foreground ds:transition-colors",
1459
+ "ds:hover:bg-muted/10 ds:hover:text-foreground",
1460
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring"
1461
+ ].join(" "),
1462
+ children: [
1463
+ /* @__PURE__ */ _($t, { "aria-hidden": "true", className: "ds:size-4" }),
1464
+ y("dashboardGrid.add")
1465
+ ]
1466
+ }
1467
+ )
1468
+ }
1469
+ )
1470
+ ) : null
1471
+ ]
1472
+ }
1473
+ )
1474
+ ]
1475
+ }
1476
+ );
1477
+ }
1478
+ );
1479
+ Tt.displayName = "DashboardGrid";
1480
+ const Cr = Object.assign(Tt, {
1481
+ Widget: Gt
1482
+ });
1483
+ export {
1484
+ Cr as D,
1485
+ Zt as d
1486
+ };
1487
+ //# sourceMappingURL=dashboard-grid-7JzaiKnk.js.map