@alfadocs/ui-kit 0.69.0 → 0.71.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 (425) hide show
  1. package/dist/_chunks/address-fields-CPbFJ8e8.js +246 -0
  2. package/dist/_chunks/{agenda-card-BxSFkqgY.js → agenda-card-BQ-IKAru.js} +2 -2
  3. package/dist/_chunks/{agenda-tray-g0kg7HwB.js → agenda-tray-CGXRk58j.js} +2 -2
  4. package/dist/_chunks/{ai-consent-banner-CXlsNX1c.js → ai-consent-banner-Be-h9mRI.js} +3 -3
  5. package/dist/_chunks/{ai-prompt-input-CuhTo9mh.js → ai-prompt-input-V4DdOeqv.js} +2 -2
  6. package/dist/_chunks/{alert-_mUKLmwA.js → alert-CHYZ96tR.js} +150 -96
  7. package/dist/_chunks/{alia-sidebar-B47qRQb5.js → alia-sidebar-DvIUzIX9.js} +107 -106
  8. package/dist/_chunks/{anamnesis-card-DRmE24OQ.js → anamnesis-card-DvYCa16e.js} +2 -2
  9. package/dist/_chunks/anatomy-scheme-CXSk11UJ.js +2445 -0
  10. package/dist/_chunks/annotation-marker-qt5R9WZX.js +120 -0
  11. package/dist/_chunks/{antenatal-schedule-timeline-35ebkcZT.js → antenatal-schedule-timeline-CwXrQRm1.js} +2 -2
  12. package/dist/_chunks/{app-frame-BYx1gcV7.js → app-frame-DIEMIC5V.js} +67 -56
  13. package/dist/_chunks/appointment-card-DVaeJNVB.js +294 -0
  14. package/dist/_chunks/appointment-timeline-PJgnrjFb.js +388 -0
  15. package/dist/_chunks/appointment-tray-B16QPGbm.js +193 -0
  16. package/dist/_chunks/{audio-recorder-DYXXnGug.js → audio-recorder-DNDsOLqO.js} +3 -3
  17. package/dist/_chunks/{autocomplete-DOeGouCL.js → autocomplete-BrONKN8l.js} +168 -146
  18. package/dist/_chunks/{badge-CqGsX32l.js → badge-DCOqV9mI.js} +32 -27
  19. package/dist/_chunks/{bishop-score-PJI3AXzA.js → bishop-score-Cym_TeQY.js} +3 -3
  20. package/dist/_chunks/{bmi-calculator-BZtIJ53x.js → bmi-calculator-zjeY4E7J.js} +2 -2
  21. package/dist/_chunks/{booking-C3VqFReX.js → booking-C7do4vaR.js} +7 -7
  22. package/dist/_chunks/{button-group-Ciq6J4IW.js → button-group-CvEnVzY7.js} +32 -35
  23. package/dist/_chunks/{care-plan-card-CvFGXa2z.js → care-plan-card-DzPDYgtK.js} +5 -5
  24. package/dist/_chunks/{care-plan-entry-card-C3E_gClk.js → care-plan-entry-card-CEnQy7YP.js} +5 -5
  25. package/dist/_chunks/care-plan-header-DcXFXWit.js +198 -0
  26. package/dist/_chunks/{chat-message-3V54YipB.js → chat-message-DzpcJR-q.js} +25 -23
  27. package/dist/_chunks/city-input-Dkgaak7I.js +169 -0
  28. package/dist/_chunks/clinical-note-card-BUvNMNGL.js +436 -0
  29. package/dist/_chunks/clipboard-list-S7s-MXQq.js +25 -0
  30. package/dist/_chunks/{combobox-Clum7gJ1.js → combobox-DnqSF0IH.js} +131 -114
  31. package/dist/_chunks/connection-status-CY1HV8Wg.js +108 -0
  32. package/dist/_chunks/{contact-profile-card-Dramqa9C.js → contact-profile-card-DDPwRFiP.js} +2 -2
  33. package/dist/_chunks/control-room-rail-FAQZrGVL.js +333 -0
  34. package/dist/_chunks/country-select-BwUZQvTa.js +709 -0
  35. package/dist/_chunks/{cycle-calculator-DmRGJNaT.js → cycle-calculator-CCmPwcBl.js} +2 -2
  36. package/dist/_chunks/{dependent-selector-CG_FOHya.js → dependent-selector-DUV4thxX.js} +2 -2
  37. package/dist/_chunks/{document-scanner-CTubA0-N.js → document-scanner-C_AxLooF.js} +3 -3
  38. package/dist/_chunks/{due-date-calculator-BTmsIQqD.js → due-date-calculator-Brdj-euS.js} +3 -3
  39. package/dist/_chunks/editable-currency-cell-renderer-CGELrkIj.js +410 -0
  40. package/dist/_chunks/email-input-DJ7EXklP.js +397 -0
  41. package/dist/_chunks/{entity-card-COhmqHly.js → entity-card-DmrgYSEX.js} +38 -20
  42. package/dist/_chunks/entity-summary-CaM1Y-xE.js +291 -0
  43. package/dist/_chunks/{fetal-weight-CRz7KE2D.js → fetal-weight-DNCkyeVo.js} +2 -2
  44. package/dist/_chunks/field-array-siUZzfYe.js +146 -0
  45. package/dist/_chunks/field-value-3jMM0uDx.js +415 -0
  46. package/dist/_chunks/{file-upload-5ScQd4fE.js → file-upload-DwZcAK8D.js} +2 -1
  47. package/dist/_chunks/{freemium-paywall-DZ2mBS3w.js → freemium-paywall-WYlNO7yT.js} +2 -2
  48. package/dist/_chunks/{gestational-age-calculator-BleUdhbI.js → gestational-age-calculator-DKzEV5Qi.js} +4 -4
  49. package/dist/_chunks/hash-CysBBS_N.js +17 -0
  50. package/dist/_chunks/{hcg-doubling-CnjDXX6U.js → hcg-doubling-C7bmuaU3.js} +2 -2
  51. package/dist/_chunks/iban-input-B0TWzR1R.js +436 -0
  52. package/dist/_chunks/icon-picker-0B7KhrF1.js +272 -0
  53. package/dist/_chunks/image-cropper-D9jqJy19.js +367 -0
  54. package/dist/_chunks/{actions-cell-renderer-DrcaxB0w.js → link-cell-renderer-De_SLjSq.js} +792 -668
  55. package/dist/_chunks/list-checks-BUs75d_o.js +18 -0
  56. package/dist/_chunks/lock-CKOIn0IK.js +15 -0
  57. package/dist/_chunks/{marketplace-app-shell-6T9W4Knl.js → marketplace-app-shell-BGqkywsi.js} +5 -5
  58. package/dist/_chunks/message-card-DsHFFiL1.js +319 -0
  59. package/dist/_chunks/{message-tray-DwrBLJlf.js → message-tray-C0a6CL1_.js} +172 -135
  60. package/dist/_chunks/{multi-select-BdHHDrRN.js → multi-select-WE4S9FIF.js} +75 -63
  61. package/dist/_chunks/nav-grid-9xphY3FM.js +169 -0
  62. package/dist/_chunks/notes-panel-DXiMfuvp.js +320 -0
  63. package/dist/_chunks/notification-card-BMqNzCIt.js +290 -0
  64. package/dist/_chunks/{notification-tray-Btb9oQeZ.js → notification-tray-BmUlCx3g.js} +201 -166
  65. package/dist/_chunks/{operator-hero-CP2Nhupm.js → operator-hero-BO8TqzX2.js} +3 -3
  66. package/dist/_chunks/panel-header-D313n_9-.js +105 -0
  67. package/dist/_chunks/patient-details-DgfTJimE.js +759 -0
  68. package/dist/_chunks/{patient-search-CBC_ySF6.js → patient-search-CSWQKOSP.js} +3 -3
  69. package/dist/_chunks/{patient-shell-DV3XEtIB.js → patient-shell-BMwsIKlW.js} +3 -3
  70. package/dist/_chunks/patient-summary-card-D4NdgYJB.js +452 -0
  71. package/dist/_chunks/patient-table-CERknpd8.js +1110 -0
  72. package/dist/_chunks/{payment-form-DvjwYVIT.js → payment-form-CxqIXqw7.js} +2 -2
  73. package/dist/_chunks/{payment-request-card-DioWKBUq.js → payment-request-card-Blf-MFNY.js} +125 -136
  74. package/dist/_chunks/{pdf-viewer-D6BPfW2D.js → pdf-viewer-QfebdLOd.js} +192 -214
  75. package/dist/_chunks/{periodontal-chart-card-BuDEMbHE.js → periodontal-chart-card-hRRJY1NN.js} +2 -2
  76. package/dist/_chunks/permission-matrix-Bw5oexUt.js +174 -0
  77. package/dist/_chunks/position-grid-CcvqHaKN.js +169 -0
  78. package/dist/_chunks/postal-code-input-UCOYuRY2.js +192 -0
  79. package/dist/_chunks/{practice-results-KrTHqZua.js → practice-results-El5Z-oVp.js} +4 -4
  80. package/dist/_chunks/{pregnancy-dating-DORUAOHB.js → pregnancy-dating-CunHrOpO.js} +4 -4
  81. package/dist/_chunks/{pregnancy-weight-gain-DVz4rr7-.js → pregnancy-weight-gain-BUNpTsH-.js} +2 -2
  82. package/dist/_chunks/{product-hub-panel-e6pW220e.js → product-hub-panel-DtU7KXxm.js} +257 -217
  83. package/dist/_chunks/province-select-D_TZvix3.js +261 -0
  84. package/dist/_chunks/{public-header.agent-DqkqA-ca.js → public-header.agent-TxmC_x1I.js} +2 -2
  85. package/dist/_chunks/radiograph-panel.agent-tWjN2nHX.js +553 -0
  86. package/dist/_chunks/reviews-panel-DxkSrgMl.js +559 -0
  87. package/dist/_chunks/rich-text-editor-C8tyGjfb.js +2621 -0
  88. package/dist/_chunks/{scroll-area-5wNK0Cyz.js → scroll-area-BZOvUhwQ.js} +2 -2
  89. package/dist/_chunks/{select-DMLG44F5.js → select-KsyRr8WH.js} +114 -102
  90. package/dist/_chunks/{sheet-BxsE7eQm.js → sheet-umkfZjF6.js} +53 -42
  91. package/dist/_chunks/{sidebar-DY9jGjgt.js → sidebar-QCp9wHNP.js} +125 -113
  92. package/dist/_chunks/{sign-document-B4DeRhTe.js → sign-document-By6hMOra.js} +2 -2
  93. package/dist/_chunks/{stepper-accordion-Dki6r9ZE.js → stepper-accordion-DC-H-8v4.js} +38 -48
  94. package/dist/_chunks/tab-bar-Bv9nGNdO.js +262 -0
  95. package/dist/_chunks/{tabs-BxcOziCo.js → tabs-CYZVKKDl.js} +2 -2
  96. package/dist/_chunks/task-card-DCdsI0ZT.js +189 -0
  97. package/dist/_chunks/{task-tray-qOEQflu4.js → task-tray-DNVejijD.js} +2 -2
  98. package/dist/_chunks/tasks-panel-C9odmawT.js +757 -0
  99. package/dist/_chunks/token-insert-menu-CFQqTe_n.js +147 -0
  100. package/dist/_chunks/tool-rail-BZx0-yIr.js +524 -0
  101. package/dist/_chunks/tooth-scheme-DJZtzfeY.js +2133 -0
  102. package/dist/_chunks/{transaction-chip-DK84XCBU.js → transaction-chip-CscoQbxF.js} +88 -61
  103. package/dist/_chunks/{transcript-panel-3THQX6nJ.js → transcript-panel-CHGHHHdT.js} +95 -83
  104. package/dist/_chunks/{unit-converter-YEpD9evj.js → unit-converter-CwlZbfdn.js} +2 -2
  105. package/dist/_chunks/use-clamp-overflow-DQE2kwZ9.js +20 -0
  106. package/dist/_chunks/use-overflow-collapse-BIOzKbni.js +32 -0
  107. package/dist/_chunks/use-persistent-state-nZwZAnE9.js +24 -0
  108. package/dist/_chunks/{warning-stack-BsgaEbL8.js → warning-stack--sTrrBDA.js} +86 -101
  109. package/dist/_chunks/{workflow-map-Bdam9pGp.js → workflow-map-M8MBBHQm.js} +107 -119
  110. package/dist/_chunks/zoom-out-CgVtf2Wx.js +29 -0
  111. package/dist/agent/index.js +5 -4
  112. package/dist/agent/types.d.ts +19 -2
  113. package/dist/agent-catalog.json +3325 -322
  114. package/dist/agent-i18n/en.json +314 -14
  115. package/dist/components/_shared/entity-card/entity-card.d.ts +6 -0
  116. package/dist/components/_shared/entity-card/index.d.ts +1 -1
  117. package/dist/components/_shared/field-value.d.ts +21 -0
  118. package/dist/components/_shared/field-visibility-cog.d.ts +20 -0
  119. package/dist/components/_shared/field-visibility.d.ts +36 -0
  120. package/dist/components/_shared/option.d.ts +2 -0
  121. package/dist/components/_shared/patient-fields.d.ts +119 -0
  122. package/dist/components/address-fields/address-fields.agent.d.ts +9 -0
  123. package/dist/components/address-fields/address-fields.d.ts +29 -0
  124. package/dist/components/address-fields/index.d.ts +5 -0
  125. package/dist/components/address-fields/index.js +6 -0
  126. package/dist/components/agenda-card/index.js +1 -1
  127. package/dist/components/agenda-tray/index.js +1 -1
  128. package/dist/components/ai-consent-banner/index.js +1 -1
  129. package/dist/components/ai-prompt-input/index.js +1 -1
  130. package/dist/components/alert/alert.d.ts +5 -0
  131. package/dist/components/alert/index.js +1 -1
  132. package/dist/components/anamnesis-card/index.js +1 -1
  133. package/dist/components/anatomy-scheme/anatomy-face-paths.d.ts +15 -0
  134. package/dist/components/anatomy-scheme/anatomy-muscle-paths.d.ts +20 -0
  135. package/dist/components/anatomy-scheme/anatomy-scheme-data.d.ts +121 -0
  136. package/dist/components/anatomy-scheme/anatomy-scheme.agent.d.ts +6 -0
  137. package/dist/components/anatomy-scheme/anatomy-scheme.d.ts +69 -0
  138. package/dist/components/anatomy-scheme/index.d.ts +6 -0
  139. package/dist/components/anatomy-scheme/index.js +17 -0
  140. package/dist/components/annotation-marker/annotation-marker.d.ts +33 -0
  141. package/dist/components/annotation-marker/index.d.ts +3 -0
  142. package/dist/components/annotation-marker/index.js +7 -0
  143. package/dist/components/app-frame/app-frame.d.ts +2 -2
  144. package/dist/components/app-frame/index.js +1 -1
  145. package/dist/components/appointment-card/appointment-card.d.ts +25 -1
  146. package/dist/components/appointment-card/index.js +6 -5
  147. package/dist/components/appointment-timeline/appointment-timeline.agent.d.ts +4 -0
  148. package/dist/components/appointment-timeline/appointment-timeline.d.ts +66 -0
  149. package/dist/components/appointment-timeline/index.d.ts +4 -0
  150. package/dist/components/appointment-timeline/index.js +6 -0
  151. package/dist/components/audio-recorder/index.js +1 -1
  152. package/dist/components/autocomplete/autocomplete.d.ts +10 -0
  153. package/dist/components/autocomplete/index.js +1 -1
  154. package/dist/components/badge/badge.d.ts +6 -2
  155. package/dist/components/badge/index.js +1 -1
  156. package/dist/components/bishop-score/index.js +1 -1
  157. package/dist/components/bmi-calculator/index.js +1 -1
  158. package/dist/components/booking/index.js +1 -1
  159. package/dist/components/button-group/index.js +1 -1
  160. package/dist/components/care-plan-card/index.js +1 -1
  161. package/dist/components/care-plan-entry-card/index.js +1 -1
  162. package/dist/components/care-plan-header/care-plan-header.agent.d.ts +4 -0
  163. package/dist/components/care-plan-header/care-plan-header.d.ts +111 -0
  164. package/dist/components/care-plan-header/index.d.ts +4 -0
  165. package/dist/components/care-plan-header/index.js +6 -0
  166. package/dist/components/chat-message/index.js +1 -1
  167. package/dist/components/city-input/city-input.agent.d.ts +8 -0
  168. package/dist/components/city-input/city-input.d.ts +57 -0
  169. package/dist/components/city-input/index.d.ts +5 -0
  170. package/dist/components/city-input/index.js +6 -0
  171. package/dist/components/clinical-note-card/clinical-note-card.d.ts +21 -1
  172. package/dist/components/clinical-note-card/index.js +1 -1
  173. package/dist/components/combobox/combobox.d.ts +17 -0
  174. package/dist/components/combobox/index.js +1 -1
  175. package/dist/components/connection-status/connection-status.agent.d.ts +4 -0
  176. package/dist/components/connection-status/connection-status.d.ts +36 -0
  177. package/dist/components/connection-status/index.d.ts +4 -0
  178. package/dist/components/connection-status/index.js +6 -0
  179. package/dist/components/contact-profile-card/index.js +1 -1
  180. package/dist/components/control-room-rail/control-room-context.d.ts +53 -0
  181. package/dist/components/control-room-rail/control-room-rail.agent.d.ts +4 -0
  182. package/dist/components/control-room-rail/control-room-rail.d.ts +35 -0
  183. package/dist/components/control-room-rail/index.d.ts +6 -0
  184. package/dist/components/control-room-rail/index.js +10 -0
  185. package/dist/components/counter/counter.d.ts +1 -1
  186. package/dist/components/country-select/country-select.agent.d.ts +8 -0
  187. package/dist/components/country-select/country-select.d.ts +51 -0
  188. package/dist/components/country-select/index.d.ts +6 -0
  189. package/dist/components/country-select/index.js +9 -0
  190. package/dist/components/country-select/iso-3166.d.ts +15 -0
  191. package/dist/components/cycle-calculator/index.js +1 -1
  192. package/dist/components/data-table/cell-renderers/actions-cell-renderer.d.ts +18 -0
  193. package/dist/components/data-table/cell-renderers/reorder-cell-renderer.d.ts +34 -0
  194. package/dist/components/data-table/index.d.ts +3 -1
  195. package/dist/components/data-table/index.js +35 -32
  196. package/dist/components/dependent-selector/index.js +1 -1
  197. package/dist/components/document-scanner/index.js +1 -1
  198. package/dist/components/due-date-calculator/index.js +2 -2
  199. package/dist/components/email-input/index.js +1 -1
  200. package/dist/components/entity-summary/entity-summary.agent.d.ts +4 -0
  201. package/dist/components/entity-summary/entity-summary.d.ts +92 -0
  202. package/dist/components/entity-summary/index.d.ts +3 -0
  203. package/dist/components/entity-summary/index.js +5 -0
  204. package/dist/components/fetal-weight/index.js +1 -1
  205. package/dist/components/field-array/field-array.agent.d.ts +4 -0
  206. package/dist/components/field-array/field-array.d.ts +45 -0
  207. package/dist/components/field-array/index.d.ts +4 -0
  208. package/dist/components/field-array/index.js +6 -0
  209. package/dist/components/file-upload/index.js +1 -1
  210. package/dist/components/freemium-paywall/freemium-paywall.d.ts +1 -1
  211. package/dist/components/freemium-paywall/index.js +1 -1
  212. package/dist/components/gestational-age-calculator/index.js +1 -1
  213. package/dist/components/hcg-doubling/index.js +1 -1
  214. package/dist/components/iban-input/iban-input.agent.d.ts +4 -0
  215. package/dist/components/iban-input/iban-input.d.ts +51 -0
  216. package/dist/components/iban-input/index.d.ts +5 -0
  217. package/dist/components/iban-input/index.js +13 -0
  218. package/dist/components/iban-input/is-valid-iban.d.ts +31 -0
  219. package/dist/components/icon-picker/icon-picker.agent.d.ts +4 -0
  220. package/dist/components/icon-picker/icon-picker.d.ts +41 -0
  221. package/dist/components/icon-picker/index.d.ts +4 -0
  222. package/dist/components/icon-picker/index.js +6 -0
  223. package/dist/components/image-cropper/crop-geometry.d.ts +30 -0
  224. package/dist/components/image-cropper/image-cropper.agent.d.ts +4 -0
  225. package/dist/components/image-cropper/image-cropper.d.ts +32 -0
  226. package/dist/components/image-cropper/index.d.ts +5 -0
  227. package/dist/components/image-cropper/index.js +11 -0
  228. package/dist/components/index.d.ts +25 -1
  229. package/dist/components/message-card/index.js +1 -1
  230. package/dist/components/message-card/message-card.d.ts +14 -0
  231. package/dist/components/message-tray/index.js +1 -1
  232. package/dist/components/message-tray/message-tray.d.ts +4 -0
  233. package/dist/components/multi-select/index.js +1 -1
  234. package/dist/components/nav-grid/index.d.ts +4 -0
  235. package/dist/components/nav-grid/index.js +7 -0
  236. package/dist/components/nav-grid/nav-grid.agent.d.ts +4 -0
  237. package/dist/components/nav-grid/nav-grid.d.ts +41 -0
  238. package/dist/components/notes-panel/index.d.ts +3 -0
  239. package/dist/components/notes-panel/index.js +5 -0
  240. package/dist/components/notes-panel/notes-panel.agent.d.ts +4 -0
  241. package/dist/components/notes-panel/notes-panel.d.ts +94 -0
  242. package/dist/components/notification-card/index.js +1 -1
  243. package/dist/components/notification-card/notification-card.d.ts +15 -0
  244. package/dist/components/notification-tray/index.js +1 -1
  245. package/dist/components/notification-tray/notification-tray.d.ts +4 -0
  246. package/dist/components/operator-hero/index.js +1 -1
  247. package/dist/components/panel-header/index.d.ts +3 -0
  248. package/dist/components/panel-header/index.js +7 -0
  249. package/dist/components/panel-header/panel-header.d.ts +41 -0
  250. package/dist/components/patient-details/index.d.ts +5 -0
  251. package/dist/components/patient-details/index.js +6 -0
  252. package/dist/components/patient-details/patient-details.agent.d.ts +4 -0
  253. package/dist/components/patient-details/patient-details.d.ts +96 -0
  254. package/dist/components/patient-search/index.js +1 -1
  255. package/dist/components/patient-summary-card/index.js +1 -1
  256. package/dist/components/patient-summary-card/patient-summary-card.d.ts +40 -1
  257. package/dist/components/patient-table/columns.d.ts +69 -40
  258. package/dist/components/patient-table/index.d.ts +2 -6
  259. package/dist/components/patient-table/index.js +8 -9
  260. package/dist/components/patient-table/patient-table.d.ts +38 -4
  261. package/dist/components/patient-table/types.d.ts +52 -2
  262. package/dist/components/patient-table/use-responsive-columns.d.ts +8 -6
  263. package/dist/components/payment-card/index.js +1 -1
  264. package/dist/components/payment-form/index.js +1 -1
  265. package/dist/components/pdf-viewer/index.js +1 -1
  266. package/dist/components/periodontal-chart-card/index.js +1 -1
  267. package/dist/components/permission-matrix/index.d.ts +4 -0
  268. package/dist/components/permission-matrix/index.js +7 -0
  269. package/dist/components/permission-matrix/permission-matrix.agent.d.ts +4 -0
  270. package/dist/components/permission-matrix/permission-matrix.d.ts +47 -0
  271. package/dist/components/position-grid/index.d.ts +4 -0
  272. package/dist/components/position-grid/index.js +7 -0
  273. package/dist/components/position-grid/position-grid.agent.d.ts +4 -0
  274. package/dist/components/position-grid/position-grid.d.ts +39 -0
  275. package/dist/components/postal-code-input/index.d.ts +5 -0
  276. package/dist/components/postal-code-input/index.js +6 -0
  277. package/dist/components/postal-code-input/postal-code-input.agent.d.ts +8 -0
  278. package/dist/components/postal-code-input/postal-code-input.d.ts +27 -0
  279. package/dist/components/practice-results/index.js +1 -1
  280. package/dist/components/pregnancy-dating/index.js +1 -1
  281. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  282. package/dist/components/product-hub-tray/index.js +1 -1
  283. package/dist/components/product-hub-tray/product-hub-tray.d.ts +13 -1
  284. package/dist/components/province-select/index.d.ts +6 -0
  285. package/dist/components/province-select/index.js +7 -0
  286. package/dist/components/province-select/it-provinces.d.ts +8 -0
  287. package/dist/components/province-select/province-select.agent.d.ts +8 -0
  288. package/dist/components/province-select/province-select.d.ts +38 -0
  289. package/dist/components/public-footer/public-footer.d.ts +1 -1
  290. package/dist/components/public-header/index.js +1 -1
  291. package/dist/components/radiograph-panel/index.d.ts +4 -0
  292. package/dist/components/radiograph-panel/index.js +7 -0
  293. package/dist/components/radiograph-panel/radiograph-panel.agent.d.ts +13 -0
  294. package/dist/components/radiograph-panel/radiograph-panel.d.ts +36 -0
  295. package/dist/components/reviews-panel/index.js +1 -1
  296. package/dist/components/rich-text-editor/editor-toolbar.d.ts +17 -0
  297. package/dist/components/rich-text-editor/index.js +1 -1
  298. package/dist/components/scroll-area/index.js +1 -1
  299. package/dist/components/select/index.js +1 -1
  300. package/dist/components/select/select.d.ts +8 -2
  301. package/dist/components/sheet/index.js +1 -1
  302. package/dist/components/sidebar/index.js +2 -2
  303. package/dist/components/sign-document/index.js +1 -1
  304. package/dist/components/skeleton/skeleton.d.ts +1 -1
  305. package/dist/components/stepper-accordion/index.js +1 -1
  306. package/dist/components/tab-bar/index.js +1 -1
  307. package/dist/components/tab-bar/tab-bar.d.ts +18 -1
  308. package/dist/components/tabs/index.js +1 -1
  309. package/dist/components/task-card/index.js +1 -1
  310. package/dist/components/task-card/task-card.d.ts +14 -6
  311. package/dist/components/task-tray/index.js +1 -1
  312. package/dist/components/tasks-panel/index.d.ts +4 -0
  313. package/dist/components/tasks-panel/index.js +6 -0
  314. package/dist/components/tasks-panel/tasks-panel.agent.d.ts +4 -0
  315. package/dist/components/tasks-panel/tasks-panel.d.ts +152 -0
  316. package/dist/components/token-insert-menu/index.d.ts +4 -0
  317. package/dist/components/token-insert-menu/index.js +6 -0
  318. package/dist/components/token-insert-menu/token-insert-menu.agent.d.ts +4 -0
  319. package/dist/components/token-insert-menu/token-insert-menu.d.ts +33 -0
  320. package/dist/components/tool-rail/index.d.ts +4 -0
  321. package/dist/components/tool-rail/index.js +6 -0
  322. package/dist/components/tool-rail/tool-rail.agent.d.ts +4 -0
  323. package/dist/components/tool-rail/tool-rail.d.ts +160 -0
  324. package/dist/components/tooth-scheme/index.d.ts +2 -2
  325. package/dist/components/tooth-scheme/index.js +30 -23
  326. package/dist/components/tooth-scheme/tooth-data.d.ts +112 -1
  327. package/dist/components/tooth-scheme/tooth-scheme.agent.d.ts +2 -2
  328. package/dist/components/tooth-scheme/tooth-scheme.d.ts +84 -11
  329. package/dist/components/transaction-chip/index.js +1 -1
  330. package/dist/components/transaction-chip/transaction-chip.d.ts +2 -2
  331. package/dist/components/transcript-panel/index.js +1 -1
  332. package/dist/components/transcript-panel/transcript-panel.d.ts +2 -2
  333. package/dist/components/unit-converter/index.js +1 -1
  334. package/dist/components/warning-stack/index.js +1 -1
  335. package/dist/components/warning-stack/warning-stack.d.ts +10 -7
  336. package/dist/components/workflow/index.js +1 -1
  337. package/dist/hooks/index.d.ts +1 -0
  338. package/dist/hooks/index.js +24 -22
  339. package/dist/hooks/use-clamp-overflow.d.ts +19 -0
  340. package/dist/hooks/use-edge-resize.d.ts +2 -2
  341. package/dist/hooks/use-overflow-collapse.d.ts +46 -0
  342. package/dist/hooks/use-persistent-state.d.ts +7 -1
  343. package/dist/hooks/use-scroll-overflow.d.ts +36 -0
  344. package/dist/i18n/locales/ar.d.ts +475 -26
  345. package/dist/i18n/locales/ar.js +478 -31
  346. package/dist/i18n/locales/de.d.ts +475 -26
  347. package/dist/i18n/locales/de.js +480 -31
  348. package/dist/i18n/locales/el.d.ts +475 -26
  349. package/dist/i18n/locales/el.js +485 -31
  350. package/dist/i18n/locales/en.d.ts +476 -34
  351. package/dist/i18n/locales/en.js +492 -39
  352. package/dist/i18n/locales/es.d.ts +475 -26
  353. package/dist/i18n/locales/es.js +477 -31
  354. package/dist/i18n/locales/fr.d.ts +475 -26
  355. package/dist/i18n/locales/fr.js +480 -31
  356. package/dist/i18n/locales/hi.d.ts +475 -26
  357. package/dist/i18n/locales/hi.js +476 -31
  358. package/dist/i18n/locales/it.d.ts +475 -26
  359. package/dist/i18n/locales/it.js +480 -31
  360. package/dist/i18n/locales/ja.d.ts +475 -26
  361. package/dist/i18n/locales/ja.js +481 -31
  362. package/dist/i18n/locales/nl.d.ts +475 -26
  363. package/dist/i18n/locales/nl.js +473 -31
  364. package/dist/i18n/locales/pl.d.ts +475 -26
  365. package/dist/i18n/locales/pl.js +481 -31
  366. package/dist/i18n/locales/pt.d.ts +475 -26
  367. package/dist/i18n/locales/pt.js +485 -31
  368. package/dist/i18n/locales/ro.d.ts +475 -26
  369. package/dist/i18n/locales/ro.js +485 -31
  370. package/dist/i18n/locales/ru.d.ts +475 -26
  371. package/dist/i18n/locales/ru.js +478 -31
  372. package/dist/i18n/locales/sq.d.ts +475 -26
  373. package/dist/i18n/locales/sq.js +482 -31
  374. package/dist/i18n/locales/sv.d.ts +475 -26
  375. package/dist/i18n/locales/sv.js +480 -31
  376. package/dist/i18n/locales/tr.d.ts +475 -26
  377. package/dist/i18n/locales/tr.js +478 -31
  378. package/dist/i18n/locales/zh.d.ts +475 -26
  379. package/dist/i18n/locales/zh.js +473 -31
  380. package/dist/index.js +826 -709
  381. package/dist/locales/ar.json +480 -31
  382. package/dist/locales/de.json +480 -31
  383. package/dist/locales/el.json +480 -31
  384. package/dist/locales/en.json +480 -31
  385. package/dist/locales/es.json +480 -31
  386. package/dist/locales/fr.json +480 -31
  387. package/dist/locales/hi.json +480 -31
  388. package/dist/locales/it.json +480 -31
  389. package/dist/locales/ja.json +480 -31
  390. package/dist/locales/nl.json +480 -31
  391. package/dist/locales/pl.json +480 -31
  392. package/dist/locales/pt.json +480 -31
  393. package/dist/locales/ro.json +480 -31
  394. package/dist/locales/ru.json +480 -31
  395. package/dist/locales/sq.json +480 -31
  396. package/dist/locales/sv.json +480 -31
  397. package/dist/locales/tr.json +480 -31
  398. package/dist/locales/zh.json +480 -31
  399. package/dist/patterns/alia-assistant/alia-types.d.ts +9 -0
  400. package/dist/patterns/alia-assistant/index.js +1 -1
  401. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  402. package/dist/patterns/patient-shell/index.js +1 -1
  403. package/dist/tokens.css +9 -1
  404. package/package.json +101 -5
  405. package/dist/_chunks/ai-tools-rail-BA_sqy1A.js +0 -373
  406. package/dist/_chunks/appointment-tray-CZtvtaH-.js +0 -431
  407. package/dist/_chunks/clinical-note-card-DqQYf_D4.js +0 -333
  408. package/dist/_chunks/editable-currency-cell-renderer-kgqp_mIw.js +0 -448
  409. package/dist/_chunks/email-input-B_Y55f5G.js +0 -396
  410. package/dist/_chunks/message-card-Bx4GmLvf.js +0 -277
  411. package/dist/_chunks/notification-card-BiESdm8q.js +0 -255
  412. package/dist/_chunks/patient-summary-card-B836_fDB.js +0 -435
  413. package/dist/_chunks/patient-table-CDuosVru.js +0 -889
  414. package/dist/_chunks/reviews-panel-Dq7LMDcH.js +0 -555
  415. package/dist/_chunks/rich-text-editor-BsV7zUdg.js +0 -2142
  416. package/dist/_chunks/tab-bar-B1ovILzh.js +0 -105
  417. package/dist/_chunks/task-card-BwY9jaV1.js +0 -124
  418. package/dist/_chunks/tooth-scheme-yBr53cvv.js +0 -1330
  419. package/dist/_chunks/use-persistent-state-i23OWy6G.js +0 -24
  420. package/dist/components/ai-tools-rail/ai-tools-rail.agent.d.ts +0 -4
  421. package/dist/components/ai-tools-rail/ai-tools-rail.d.ts +0 -68
  422. package/dist/components/ai-tools-rail/index.d.ts +0 -4
  423. package/dist/components/ai-tools-rail/index.js +0 -6
  424. package/dist/components/patient-table/cell-renderers/contact-cell.d.ts +0 -45
  425. package/dist/components/patient-table/cell-renderers/patient-identity-cell.d.ts +0 -26
@@ -0,0 +1,2621 @@
1
+ import { jsx as e, jsxs as v, Fragment as ke } from "react/jsx-runtime";
2
+ import { useId as de, useState as _, useRef as D, useCallback as k, useEffect as Z, Fragment as He, forwardRef as Pt, useMemo as st, useImperativeHandle as Ot } from "react";
3
+ import { c as Ge } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as ee } from "react-i18next";
5
+ import { SafeHtml as qt, sanitiseHtml as jt } from "../safe-html/index.js";
6
+ import { u as Ft } from "./registry-DvAUVLHh.js";
7
+ import { S as gt } from "./spinner-hbwuKwMf.js";
8
+ import { I as F } from "./icon-button-LqoiKcUN.js";
9
+ import { T as Bt } from "./text-area-Bt3p7Pt0.js";
10
+ import { E as Kt } from "./editor-overlay-wYm22wZK.js";
11
+ import { X as lt } from "./x-CCcI3eJp.js";
12
+ import { R as Vt } from "./rotate-ccw-BWANpitO.js";
13
+ import { C as Gt } from "./check-DPdL_Sm7.js";
14
+ import { S as Se } from "./square-CZoGU14v.js";
15
+ import { M as ft } from "./mic-B4Gog3Gi.js";
16
+ import { S as Wt } from "./send-CySZIRPJ.js";
17
+ import { B as ie } from "./button-DD_0Xdmr.js";
18
+ import { a as pt } from "./tooltip-DvmfrNvB.js";
19
+ import { P as q } from "./popover-B2qCDhJC.js";
20
+ import { D as Ae } from "./dropdown-menu-qrxjymfw.js";
21
+ import { D as B } from "./dialog-ZNuboNmy.js";
22
+ import { C as We } from "./color-picker-C_fZl6sA.js";
23
+ import { T as Ie } from "./text-input-B-OWQ1Je.js";
24
+ import { C as Xt } from "./checkbox-BuZ1u__2.js";
25
+ import { F as Ut } from "./file-upload-DwZcAK8D.js";
26
+ import { c as T } from "./createLucideIcon-CrFbzy84.js";
27
+ import { E as Qt } from "./ellipsis-rgGdiK_9.js";
28
+ import { I as Zt } from "./image-C6RM5hfF.js";
29
+ import { C as Yt } from "./chevron-down-BX_NP2Yh.js";
30
+ import { C as Jt } from "./columns-2-BTOBZbep.js";
31
+ import { T as er } from "./trash-2-rPAKaRgB.js";
32
+ import { S as tr } from "./sparkles-CuYXqQLg.js";
33
+ /**
34
+ * @license lucide-react v1.8.0 - ISC
35
+ *
36
+ * This source code is licensed under the ISC license.
37
+ * See the LICENSE file in the root directory of this source tree.
38
+ */
39
+ const rr = [
40
+ ["path", { d: "M4 20h16", key: "14thso" }],
41
+ ["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
42
+ ["path", { d: "M8 12h8", key: "1wcyev" }]
43
+ ], nr = T("baseline", rr);
44
+ /**
45
+ * @license lucide-react v1.8.0 - ISC
46
+ *
47
+ * This source code is licensed under the ISC license.
48
+ * See the LICENSE file in the root directory of this source tree.
49
+ */
50
+ const or = [
51
+ ["rect", { width: "13", height: "7", x: "3", y: "3", rx: "1", key: "11xb64" }],
52
+ ["path", { d: "m22 15-3-3 3-3", key: "26chmm" }],
53
+ ["rect", { width: "13", height: "7", x: "3", y: "14", rx: "1", key: "k6ky7n" }]
54
+ ], ir = T("between-horizontal-end", or);
55
+ /**
56
+ * @license lucide-react v1.8.0 - ISC
57
+ *
58
+ * This source code is licensed under the ISC license.
59
+ * See the LICENSE file in the root directory of this source tree.
60
+ */
61
+ const ar = [
62
+ ["rect", { width: "13", height: "7", x: "8", y: "3", rx: "1", key: "pkso9a" }],
63
+ ["path", { d: "m2 9 3 3-3 3", key: "1agib5" }],
64
+ ["rect", { width: "13", height: "7", x: "8", y: "14", rx: "1", key: "1q5fc1" }]
65
+ ], sr = T("between-horizontal-start", ar);
66
+ /**
67
+ * @license lucide-react v1.8.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */
72
+ const lr = [
73
+ ["rect", { width: "7", height: "13", x: "3", y: "3", rx: "1", key: "1fdu0f" }],
74
+ ["path", { d: "m9 22 3-3 3 3", key: "17z65a" }],
75
+ ["rect", { width: "7", height: "13", x: "14", y: "3", rx: "1", key: "1squn4" }]
76
+ ], cr = T("between-vertical-end", lr);
77
+ /**
78
+ * @license lucide-react v1.8.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */
83
+ const dr = [
84
+ ["rect", { width: "7", height: "13", x: "3", y: "8", rx: "1", key: "1fjrkv" }],
85
+ ["path", { d: "m15 2-3 3-3-3", key: "1uh6eb" }],
86
+ ["rect", { width: "7", height: "13", x: "14", y: "8", rx: "1", key: "w3fjg8" }]
87
+ ], ur = T("between-vertical-start", dr);
88
+ /**
89
+ * @license lucide-react v1.8.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */
94
+ const mr = [
95
+ [
96
+ "path",
97
+ { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
98
+ ]
99
+ ], hr = T("bold", mr);
100
+ /**
101
+ * @license lucide-react v1.8.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */
106
+ const gr = [
107
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
108
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
109
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
110
+ ["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
111
+ ], fr = T("heading-2", gr);
112
+ /**
113
+ * @license lucide-react v1.8.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */
118
+ const pr = [
119
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
120
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
121
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
122
+ ["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
123
+ ["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
124
+ ], br = T("heading-3", pr);
125
+ /**
126
+ * @license lucide-react v1.8.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */
131
+ const yr = [
132
+ ["path", { d: "m9 11-6 6v3h9l3-3", key: "1a3l36" }],
133
+ ["path", { d: "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4", key: "14a9rk" }]
134
+ ], vr = T("highlighter", yr);
135
+ /**
136
+ * @license lucide-react v1.8.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */
141
+ const wr = [
142
+ ["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
143
+ ["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
144
+ ["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
145
+ ], kr = T("italic", wr);
146
+ /**
147
+ * @license lucide-react v1.8.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */
152
+ const xr = [
153
+ ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
154
+ ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
155
+ ], Cr = T("link", xr);
156
+ /**
157
+ * @license lucide-react v1.8.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */
162
+ const Nr = [
163
+ ["path", { d: "M11 5h10", key: "1cz7ny" }],
164
+ ["path", { d: "M11 12h10", key: "1438ji" }],
165
+ ["path", { d: "M11 19h10", key: "11t30w" }],
166
+ ["path", { d: "M4 4h1v5", key: "10yrso" }],
167
+ ["path", { d: "M4 9h2", key: "r1h2o0" }],
168
+ ["path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02", key: "xtkcd5" }]
169
+ ], Mr = T("list-ordered", Nr);
170
+ /**
171
+ * @license lucide-react v1.8.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */
176
+ const zr = [
177
+ ["path", { d: "M3 5h.01", key: "18ugdj" }],
178
+ ["path", { d: "M3 12h.01", key: "nlz23k" }],
179
+ ["path", { d: "M3 19h.01", key: "noohij" }],
180
+ ["path", { d: "M8 5h13", key: "1pao27" }],
181
+ ["path", { d: "M8 12h13", key: "1za7za" }],
182
+ ["path", { d: "M8 19h13", key: "m83p4d" }]
183
+ ], Tr = T("list", zr);
184
+ /**
185
+ * @license lucide-react v1.8.0 - ISC
186
+ *
187
+ * This source code is licensed under the ISC license.
188
+ * See the LICENSE file in the root directory of this source tree.
189
+ */
190
+ const _r = [
191
+ ["path", { d: "M11 7 6 2", key: "1jwth8" }],
192
+ ["path", { d: "M18.992 12H2.041", key: "xw1gg" }],
193
+ [
194
+ "path",
195
+ {
196
+ d: "M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595",
197
+ key: "1nkol4"
198
+ }
199
+ ],
200
+ [
201
+ "path",
202
+ {
203
+ d: "m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33",
204
+ key: "1nk1rd"
205
+ }
206
+ ]
207
+ ], Er = T("paint-bucket", _r);
208
+ /**
209
+ * @license lucide-react v1.8.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */
214
+ const Ar = [
215
+ ["rect", { width: "16", height: "6", x: "2", y: "2", rx: "2", key: "jcyz7m" }],
216
+ ["path", { d: "M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2", key: "1b9h7c" }],
217
+ ["rect", { width: "4", height: "6", x: "8", y: "16", rx: "1", key: "d6e7yl" }]
218
+ ], Rr = T("paint-roller", Ar);
219
+ /**
220
+ * @license lucide-react v1.8.0 - ISC
221
+ *
222
+ * This source code is licensed under the ISC license.
223
+ * See the LICENSE file in the root directory of this source tree.
224
+ */
225
+ const Sr = [
226
+ [
227
+ "path",
228
+ {
229
+ d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
230
+ key: "e79jfc"
231
+ }
232
+ ],
233
+ ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
234
+ ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
235
+ ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
236
+ ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
237
+ ], Ir = T("palette", Sr);
238
+ /**
239
+ * @license lucide-react v1.8.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */
244
+ const Lr = [
245
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
246
+ ["path", { d: "M9 3v18", key: "fh3hqa" }]
247
+ ], Hr = T("panel-left", Lr);
248
+ /**
249
+ * @license lucide-react v1.8.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */
254
+ const $r = [
255
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
256
+ ["path", { d: "M15 3v18", key: "14nvp0" }]
257
+ ], Dr = T("panel-right", $r);
258
+ /**
259
+ * @license lucide-react v1.8.0 - ISC
260
+ *
261
+ * This source code is licensed under the ISC license.
262
+ * See the LICENSE file in the root directory of this source tree.
263
+ */
264
+ const Pr = [
265
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
266
+ ["path", { d: "M14 9h1", key: "l0svgy" }],
267
+ ["path", { d: "M19 9h2", key: "te2zfg" }],
268
+ ["path", { d: "M3 9h2", key: "1h4ldw" }],
269
+ ["path", { d: "M9 9h1", key: "15jzuz" }]
270
+ ], Or = T("panel-top-dashed", Pr);
271
+ /**
272
+ * @license lucide-react v1.8.0 - ISC
273
+ *
274
+ * This source code is licensed under the ISC license.
275
+ * See the LICENSE file in the root directory of this source tree.
276
+ */
277
+ const qr = [
278
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
279
+ ["path", { d: "M3 9h18", key: "1pudct" }]
280
+ ], jr = T("panel-top", qr);
281
+ /**
282
+ * @license lucide-react v1.8.0 - ISC
283
+ *
284
+ * This source code is licensed under the ISC license.
285
+ * See the LICENSE file in the root directory of this source tree.
286
+ */
287
+ const Fr = [
288
+ ["path", { d: "M13 4v16", key: "8vvj80" }],
289
+ ["path", { d: "M17 4v16", key: "7dpous" }],
290
+ ["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
291
+ ], Br = T("pilcrow", Fr);
292
+ /**
293
+ * @license lucide-react v1.8.0 - ISC
294
+ *
295
+ * This source code is licensed under the ISC license.
296
+ * See the LICENSE file in the root directory of this source tree.
297
+ */
298
+ const Kr = [
299
+ [
300
+ "path",
301
+ {
302
+ d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
303
+ key: "rib7q0"
304
+ }
305
+ ],
306
+ [
307
+ "path",
308
+ {
309
+ d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
310
+ key: "1ymkrd"
311
+ }
312
+ ]
313
+ ], Vr = T("quote", Kr);
314
+ /**
315
+ * @license lucide-react v1.8.0 - ISC
316
+ *
317
+ * This source code is licensed under the ISC license.
318
+ * See the LICENSE file in the root directory of this source tree.
319
+ */
320
+ const Gr = [
321
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
322
+ ["path", { d: "M3 12h18", key: "1i2n21" }]
323
+ ], Wr = T("rows-2", Gr);
324
+ /**
325
+ * @license lucide-react v1.8.0 - ISC
326
+ *
327
+ * This source code is licensed under the ISC license.
328
+ * See the LICENSE file in the root directory of this source tree.
329
+ */
330
+ const Xr = [
331
+ ["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
332
+ ["path", { d: "M8 12h8", key: "1wcyev" }],
333
+ ["path", { d: "m16 20 2 2 4-4", key: "13tcca" }]
334
+ ], Ur = T("spell-check", Xr);
335
+ /**
336
+ * @license lucide-react v1.8.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */
341
+ const Qr = [
342
+ ["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
343
+ ["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
344
+ ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
345
+ ], Zr = T("strikethrough", Qr);
346
+ /**
347
+ * @license lucide-react v1.8.0 - ISC
348
+ *
349
+ * This source code is licensed under the ISC license.
350
+ * See the LICENSE file in the root directory of this source tree.
351
+ */
352
+ const Yr = [
353
+ ["path", { d: "M12 3v18", key: "108xh3" }],
354
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
355
+ ["path", { d: "M3 9h18", key: "1pudct" }],
356
+ ["path", { d: "M3 15h18", key: "5xshup" }]
357
+ ], Jr = T("table", Yr);
358
+ /**
359
+ * @license lucide-react v1.8.0 - ISC
360
+ *
361
+ * This source code is licensed under the ISC license.
362
+ * See the LICENSE file in the root directory of this source tree.
363
+ */
364
+ const en = [
365
+ ["path", { d: "M21 5H3", key: "1fi0y6" }],
366
+ ["path", { d: "M17 12H7", key: "16if0g" }],
367
+ ["path", { d: "M19 19H5", key: "vjpgq2" }]
368
+ ], tn = T("text-align-center", en);
369
+ /**
370
+ * @license lucide-react v1.8.0 - ISC
371
+ *
372
+ * This source code is licensed under the ISC license.
373
+ * See the LICENSE file in the root directory of this source tree.
374
+ */
375
+ const rn = [
376
+ ["path", { d: "M21 5H3", key: "1fi0y6" }],
377
+ ["path", { d: "M21 12H9", key: "dn1m92" }],
378
+ ["path", { d: "M21 19H7", key: "4cu937" }]
379
+ ], nn = T("text-align-end", rn);
380
+ /**
381
+ * @license lucide-react v1.8.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */
386
+ const on = [
387
+ ["path", { d: "M21 5H3", key: "1fi0y6" }],
388
+ ["path", { d: "M15 12H3", key: "6jk70r" }],
389
+ ["path", { d: "M17 19H3", key: "z6ezky" }]
390
+ ], an = T("text-align-start", on);
391
+ /**
392
+ * @license lucide-react v1.8.0 - ISC
393
+ *
394
+ * This source code is licensed under the ISC license.
395
+ * See the LICENSE file in the root directory of this source tree.
396
+ */
397
+ const sn = [
398
+ ["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
399
+ ["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
400
+ ], ln = T("underline", sn);
401
+ /**
402
+ * @license lucide-react v1.8.0 - ISC
403
+ *
404
+ * This source code is licensed under the ISC license.
405
+ * See the LICENSE file in the root directory of this source tree.
406
+ */
407
+ const cn = [
408
+ [
409
+ "path",
410
+ {
411
+ d: "m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",
412
+ key: "ul74o6"
413
+ }
414
+ ],
415
+ ["path", { d: "m14 7 3 3", key: "1r5n42" }],
416
+ ["path", { d: "M5 6v4", key: "ilb8ba" }],
417
+ ["path", { d: "M19 14v4", key: "blhpug" }],
418
+ ["path", { d: "M10 2v2", key: "7u0qdc" }],
419
+ ["path", { d: "M7 8H3", key: "zfb6yr" }],
420
+ ["path", { d: "M21 16h-4", key: "1cnmox" }],
421
+ ["path", { d: "M11 3H9", key: "1obp7u" }]
422
+ ], dn = T("wand-sparkles", cn);
423
+ /**
424
+ * @license lucide-react v1.8.0 - ISC
425
+ *
426
+ * This source code is licensed under the ISC license.
427
+ * See the LICENSE file in the root directory of this source tree.
428
+ */
429
+ const un = [
430
+ [
431
+ "path",
432
+ {
433
+ d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",
434
+ key: "1ngwbx"
435
+ }
436
+ ]
437
+ ], mn = T("wrench", un), hn = {
438
+ id: "rich-text-editor",
439
+ capabilities: ["edit_inline"],
440
+ state: {
441
+ html: {
442
+ type: "string",
443
+ descriptionKey: "ui.agent.richTextEditor.state.html",
444
+ description: "Sanitised HTML representation of the editor content.",
445
+ read: (o) => o.getHTML()
446
+ },
447
+ text: {
448
+ type: "string",
449
+ descriptionKey: "ui.agent.richTextEditor.state.text",
450
+ description: "Plain-text content of the editor (tags stripped).",
451
+ read: (o) => o.getText()
452
+ },
453
+ markdown: {
454
+ type: "string",
455
+ descriptionKey: "ui.agent.richTextEditor.state.markdown",
456
+ description: "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
457
+ read: (o) => o.getMarkdown()
458
+ }
459
+ },
460
+ // Image wrap/align/resize are intentionally NOT agent actions — they target
461
+ // the ephemeral click-selected image the handle can't address. Agents emit
462
+ // `<img class="wysiwyg-img-*" style="width:N%">` via set_content instead.
463
+ actions: {
464
+ set_content: {
465
+ // Replaces the whole document — discards whatever the user had typed.
466
+ safety: "destructive",
467
+ argsType: "{ html: string }",
468
+ argsSchema: {
469
+ type: "object",
470
+ properties: {
471
+ html: {
472
+ type: "string",
473
+ description: "Replacement HTML (sanitised via DOMPurify)."
474
+ }
475
+ },
476
+ required: ["html"]
477
+ },
478
+ idempotent: !0,
479
+ descriptionKey: "ui.agent.richTextEditor.actions.setContent",
480
+ description: "Replace the editor content. Loses unsaved input.",
481
+ invoke: (o, i) => {
482
+ o.setContent(i.html);
483
+ }
484
+ },
485
+ insert_at_cursor: {
486
+ // Reversible via the editor's own undo stack — write, not destructive.
487
+ safety: "write",
488
+ argsType: "{ content: string; asHtml?: boolean }",
489
+ argsSchema: {
490
+ type: "object",
491
+ properties: {
492
+ content: {
493
+ type: "string",
494
+ description: "Content to insert at the caret."
495
+ },
496
+ asHtml: {
497
+ type: "boolean",
498
+ description: "Treat content as HTML (sanitised). Pass false for plain text. Defaults to true."
499
+ }
500
+ },
501
+ required: ["content"]
502
+ },
503
+ descriptionKey: "ui.agent.richTextEditor.actions.insertAtCursor",
504
+ description: "Insert content at the caret (replacing any selection). HTML is sanitised; pass asHtml:false for plain text. Seam for merge/template variables and AI-generated drafts.",
505
+ examples: [
506
+ {
507
+ args: { content: "{{patient.firstName}}", asHtml: !1 },
508
+ note: "Insert a merge variable as plain text."
509
+ }
510
+ ],
511
+ invoke: (o, i) => {
512
+ o.insertAtCursor(i.content, { asHtml: i.asHtml });
513
+ }
514
+ },
515
+ apply_format: {
516
+ // Reversible via undo — write, not destructive.
517
+ safety: "write",
518
+ argsType: "{ format: 'bold' | 'italic' | 'strikethrough' | 'bulletedList' | 'numberedList' | 'heading' | 'quote' | 'paragraph' }",
519
+ argsSchema: {
520
+ type: "object",
521
+ properties: {
522
+ format: {
523
+ type: "string",
524
+ enum: [
525
+ "bold",
526
+ "italic",
527
+ "strikethrough",
528
+ "bulletedList",
529
+ "numberedList",
530
+ "heading",
531
+ "quote",
532
+ "paragraph"
533
+ ],
534
+ description: "Block or inline format to toggle/apply."
535
+ }
536
+ },
537
+ required: ["format"]
538
+ },
539
+ descriptionKey: "ui.agent.richTextEditor.actions.applyFormat",
540
+ description: "Toggle/apply a block or inline format on the current selection (bold, italic, strikethrough, bulleted/numbered list, heading, quote, paragraph).",
541
+ examples: [{ args: { format: "bold" }, note: "Bold the selection." }],
542
+ invoke: (o, i) => {
543
+ o.applyFormat(i.format);
544
+ }
545
+ },
546
+ clear: {
547
+ // Empties the document — loses unsaved input.
548
+ safety: "destructive",
549
+ idempotent: !0,
550
+ descriptionKey: "ui.agent.richTextEditor.actions.clear",
551
+ description: "Empty the editor. Loses unsaved input.",
552
+ invoke: (o) => {
553
+ o.clear();
554
+ }
555
+ },
556
+ focus: {
557
+ safety: "read",
558
+ idempotent: !0,
559
+ descriptionKey: "ui.agent.richTextEditor.actions.focus",
560
+ description: "Move keyboard focus to the editor surface.",
561
+ invoke: (o) => {
562
+ o.focus();
563
+ }
564
+ }
565
+ },
566
+ domHooks: {
567
+ root: { attr: "data-component", value: "rich-text-editor" },
568
+ instanceId: {
569
+ attr: "data-component-id",
570
+ sourceProp: "id",
571
+ description: "Sourced from the id prop."
572
+ }
573
+ }
574
+ }, gn = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", ce = "ds:!size-[var(--min-target-size)]", fn = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", pn = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]", ct = [
575
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
576
+ "ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
577
+ "ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
578
+ "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]"
579
+ ].join(" ");
580
+ function dt(o, i) {
581
+ return i ? o ? /\s$/.test(o) ? `${o}${i}` : `${o} ${i}` : i : o;
582
+ }
583
+ function bn({
584
+ open: o,
585
+ onClose: i,
586
+ onRequestAiDraft: g,
587
+ onInsert: c,
588
+ previewAsHtml: m = !0,
589
+ privacyNotice: d,
590
+ onDictate: b
591
+ }) {
592
+ const { t: u } = ee(), w = de(), C = de(), [E, L] = _(""), [I, N] = _(!1), [$, l] = _(!1), [a, f] = _(null), A = D(null), [x, S] = _(!1), [Y, H] = _(""), [X, R] = _(""), K = D(null), U = k(() => {
593
+ var M;
594
+ (M = K.current) == null || M.abort();
595
+ }, []), P = k(() => {
596
+ if (!b) return;
597
+ const M = new AbortController();
598
+ K.current = M, S(!0), H(""), R(u("editor.ai.listening")), b({
599
+ signal: M.signal,
600
+ onPartialTranscript: (O) => {
601
+ M.signal.aborted || H(O);
602
+ },
603
+ onFinalTranscript: (O) => {
604
+ if (M.signal.aborted) return;
605
+ const j = O.trim();
606
+ H(""), j && (L((te) => dt(te, j)), R(j));
607
+ }
608
+ }).catch(() => {
609
+ }).finally(() => {
610
+ H(""), K.current === M && (K.current = null, S(!1), R(""));
611
+ });
612
+ }, [b, u]), y = k(() => {
613
+ x ? U() : P();
614
+ }, [x, P, U]);
615
+ Z(() => {
616
+ var M, O;
617
+ o ? (L(""), N(!1), l(!1), f(null), H(""), R("")) : ((M = A.current) == null || M.abort(), A.current = null, (O = K.current) == null || O.abort());
618
+ }, [o]), Z(
619
+ () => () => {
620
+ var M, O;
621
+ (M = A.current) == null || M.abort(), (O = K.current) == null || O.abort();
622
+ },
623
+ []
624
+ );
625
+ const V = k(() => {
626
+ var j;
627
+ const M = E.trim();
628
+ if (!M || I) return;
629
+ U(), (j = A.current) == null || j.abort();
630
+ const O = new AbortController();
631
+ A.current = O, l(!1), N(!0), g({ prompt: M, signal: O.signal }).then((te) => {
632
+ O.signal.aborted || (f(te), N(!1));
633
+ }).catch((te) => {
634
+ O.signal.aborted || te && typeof te == "object" && "name" in te && te.name === "AbortError" || (l(!0), N(!1));
635
+ });
636
+ }, [E, I, g, U]), G = k(() => {
637
+ a != null && (c(a), i());
638
+ }, [a, c, i]), he = a != null, ge = x ? dt(E, Y) : E;
639
+ return /* @__PURE__ */ e(
640
+ Kt,
641
+ {
642
+ open: o,
643
+ onClose: i,
644
+ ariaLabel: u("editor.ai.dialogTitle"),
645
+ children: he ? /* @__PURE__ */ v("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-sm)]", children: [
646
+ /* @__PURE__ */ e(
647
+ F,
648
+ {
649
+ size: "md",
650
+ intent: "outline",
651
+ className: ce,
652
+ icon: /* @__PURE__ */ e(lt, {}),
653
+ "aria-label": u("common.close"),
654
+ onClick: i
655
+ }
656
+ ),
657
+ /* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: m ? /* @__PURE__ */ e(
658
+ qt,
659
+ {
660
+ html: a,
661
+ profile: "rich-text",
662
+ className: ct,
663
+ tabIndex: 0,
664
+ "aria-label": u("editor.ai.dialogTitle")
665
+ }
666
+ ) : (
667
+ // Focusable so a keyboard user can scroll a long draft preview
668
+ // (mirrors the SafeHtml preview branch above). The lint rule's
669
+ // tabIndex allowlist doesn't cover a scrollable, non-interactive
670
+ // text region.
671
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
672
+ /* @__PURE__ */ e("p", { className: ct, tabIndex: 0, children: a })
673
+ ) }),
674
+ /* @__PURE__ */ e(
675
+ F,
676
+ {
677
+ size: "md",
678
+ intent: "outline",
679
+ className: `${ce} ds:rounded-full`,
680
+ icon: /* @__PURE__ */ e(Vt, {}),
681
+ "aria-label": u("editor.ai.retry"),
682
+ onClick: () => f(null)
683
+ }
684
+ ),
685
+ /* @__PURE__ */ e(
686
+ F,
687
+ {
688
+ size: "md",
689
+ intent: "primary",
690
+ className: `${ce} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
691
+ icon: /* @__PURE__ */ e(Gt, {}),
692
+ "aria-label": u("common.confirm"),
693
+ onClick: G
694
+ }
695
+ )
696
+ ] }) : /* @__PURE__ */ v(ke, { children: [
697
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-sm)]", children: [
698
+ /* @__PURE__ */ e(
699
+ F,
700
+ {
701
+ size: "md",
702
+ intent: "outline",
703
+ className: ce,
704
+ icon: /* @__PURE__ */ e(lt, {}),
705
+ "aria-label": u("common.close"),
706
+ onClick: i
707
+ }
708
+ ),
709
+ /* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ e(
710
+ Bt,
711
+ {
712
+ id: w,
713
+ size: "md",
714
+ className: "ds:content-center",
715
+ value: ge,
716
+ onChange: (M) => L(M.target.value),
717
+ placeholder: u("editor.ai.promptPlaceholder"),
718
+ "aria-label": u("editor.ai.promptLabel"),
719
+ autoResize: !0,
720
+ minRows: 1,
721
+ maxRows: 3,
722
+ readOnly: x,
723
+ tone: $ ? "error" : "default",
724
+ "aria-describedby": $ ? C : void 0
725
+ }
726
+ ) }),
727
+ b ? /* @__PURE__ */ e(
728
+ F,
729
+ {
730
+ size: "md",
731
+ intent: "outline",
732
+ className: x ? `${ce} ${gn}` : ce,
733
+ icon: x ? /* @__PURE__ */ e(Se, { className: "ds:fill-current" }) : /* @__PURE__ */ e(ft, {}),
734
+ "aria-pressed": x,
735
+ "aria-label": u(x ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
736
+ onClick: y
737
+ }
738
+ ) : null,
739
+ /* @__PURE__ */ e(
740
+ F,
741
+ {
742
+ size: "md",
743
+ intent: "primary",
744
+ icon: I ? /* @__PURE__ */ e(gt, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(Wt, {}),
745
+ className: `${ce} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
746
+ disabled: I || !E.trim(),
747
+ "aria-busy": I || void 0,
748
+ "aria-label": u("editor.ai.generate"),
749
+ onClick: V
750
+ }
751
+ )
752
+ ] }),
753
+ b ? /* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: X }) : null,
754
+ $ ? /* @__PURE__ */ e("p", { id: C, role: "alert", className: pn, children: u("editor.ai.error") }) : d ? /* @__PURE__ */ e("p", { className: fn, children: d }) : null
755
+ ] })
756
+ }
757
+ );
758
+ }
759
+ const yn = {
760
+ bold: {
761
+ id: "bold",
762
+ icon: /* @__PURE__ */ e(hr, {}),
763
+ label: ["editor.bold", "Bold"],
764
+ command: ["module.inline.format", { tag: "b" }],
765
+ toggle: "bold"
766
+ },
767
+ italic: {
768
+ id: "italic",
769
+ icon: /* @__PURE__ */ e(kr, {}),
770
+ label: ["editor.italic", "Italic"],
771
+ command: ["module.inline.format", { tag: "i" }],
772
+ toggle: "italic"
773
+ },
774
+ underline: {
775
+ id: "underline",
776
+ icon: /* @__PURE__ */ e(ln, {}),
777
+ label: ["editor.underline", "Underline"],
778
+ command: ["module.inline.format", { tag: "u" }],
779
+ toggle: "underline"
780
+ },
781
+ strike: {
782
+ id: "strike",
783
+ icon: /* @__PURE__ */ e(Zr, {}),
784
+ label: ["editor.strike", "Strikethrough"],
785
+ command: ["module.inline.format", { tag: "del" }],
786
+ toggle: "strike"
787
+ },
788
+ ul: {
789
+ id: "ul",
790
+ icon: /* @__PURE__ */ e(Tr, {}),
791
+ label: ["editor.list.bullet", "Bulleted list"],
792
+ command: ["module.list.toggle", "ul"],
793
+ toggle: "ul"
794
+ },
795
+ ol: {
796
+ id: "ol",
797
+ icon: /* @__PURE__ */ e(Mr, {}),
798
+ label: ["editor.list.ordered", "Numbered list"],
799
+ command: ["module.list.toggle", "ol"],
800
+ toggle: "ol"
801
+ }
802
+ }, Fe = [
803
+ {
804
+ id: "paragraph",
805
+ tag: "p",
806
+ icon: /* @__PURE__ */ e(Br, {}),
807
+ label: ["editor.paragraph", "Paragraph"]
808
+ },
809
+ {
810
+ id: "h2",
811
+ tag: "h2",
812
+ icon: /* @__PURE__ */ e(fr, {}),
813
+ label: ["editor.heading2", "Heading 2"]
814
+ },
815
+ {
816
+ id: "h3",
817
+ tag: "h3",
818
+ icon: /* @__PURE__ */ e(br, {}),
819
+ label: ["editor.heading3", "Heading 3"]
820
+ },
821
+ {
822
+ id: "quote",
823
+ tag: "blockquote",
824
+ icon: /* @__PURE__ */ e(Vr, {}),
825
+ label: ["editor.quote", "Quote"]
826
+ }
827
+ ], vn = {
828
+ minimal: ["bold", "italic", "underline", "link"],
829
+ standard: [
830
+ "format",
831
+ "bold",
832
+ "italic",
833
+ "underline",
834
+ "strike",
835
+ "ul",
836
+ "ol",
837
+ "link"
838
+ ],
839
+ full: ["format", "bold", "italic", "underline", "strike", "ul", "ol", "link"]
840
+ }, bt = [
841
+ {
842
+ id: "rowAbove",
843
+ command: "plugin.table.addRowAbove",
844
+ icon: /* @__PURE__ */ e(sr, {}),
845
+ label: ["editor.table.rowAbove", "Add row above"]
846
+ },
847
+ {
848
+ id: "rowBelow",
849
+ command: "plugin.table.addRowBelow",
850
+ icon: /* @__PURE__ */ e(ir, {}),
851
+ label: ["editor.table.rowBelow", "Add row below"]
852
+ },
853
+ {
854
+ id: "colLeft",
855
+ command: "plugin.table.addColumnLeft",
856
+ icon: /* @__PURE__ */ e(ur, {}),
857
+ label: ["editor.table.columnLeft", "Add column left"]
858
+ },
859
+ {
860
+ id: "colRight",
861
+ command: "plugin.table.addColumnRight",
862
+ icon: /* @__PURE__ */ e(cr, {}),
863
+ label: ["editor.table.columnRight", "Add column right"]
864
+ },
865
+ {
866
+ id: "addHead",
867
+ command: "plugin.table.addHead",
868
+ icon: /* @__PURE__ */ e(jr, {}),
869
+ label: ["editor.table.addHeader", "Add header row"]
870
+ },
871
+ {
872
+ id: "deleteHead",
873
+ command: "plugin.table.deleteHead",
874
+ icon: /* @__PURE__ */ e(Or, {}),
875
+ label: ["editor.table.deleteHeader", "Remove header row"]
876
+ },
877
+ {
878
+ id: "deleteRow",
879
+ command: "plugin.table.deleteRow",
880
+ icon: /* @__PURE__ */ e(Wr, {}),
881
+ label: ["editor.table.deleteRow", "Delete row"]
882
+ },
883
+ {
884
+ id: "deleteColumn",
885
+ command: "plugin.table.deleteColumn",
886
+ icon: /* @__PURE__ */ e(Jt, {}),
887
+ label: ["editor.table.deleteColumn", "Delete column"]
888
+ },
889
+ {
890
+ id: "deleteTable",
891
+ command: "plugin.table.deleteTable",
892
+ icon: /* @__PURE__ */ e(er, {}),
893
+ label: ["editor.table.deleteTable", "Delete table"]
894
+ }
895
+ ], Re = 6, wn = Ge(
896
+ [
897
+ "ds:@container/toolbar",
898
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
899
+ "ds:bg-[var(--background)] ds:p-[var(--spacing-xs)]",
900
+ "ds:shadow-[var(--shadow-md)]"
901
+ ].join(" ")
902
+ ), kn = "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", Xe = "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[var(--border)] ds:[margin-inline:var(--spacing-2xs)]", ve = "ds:text-[length:var(--font-size-sm)] ds:font-medium ds:text-[color:var(--foreground)]";
903
+ function Le(o) {
904
+ return o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
905
+ }
906
+ function xn({
907
+ run: o,
908
+ active: i,
909
+ onTriggerDown: g
910
+ }) {
911
+ const { t: c } = ee(), m = Fe.find((d) => i.has(d.id)) ?? Fe[0];
912
+ return /* @__PURE__ */ v(Ae.Root, { children: [
913
+ /* @__PURE__ */ e(Ae.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
914
+ ie,
915
+ {
916
+ size: "sm",
917
+ intent: "ghost",
918
+ startIcon: m.icon,
919
+ endIcon: /* @__PURE__ */ e(Yt, {}),
920
+ "aria-label": `${c("editor.format", "Paragraph style")}: ${c(
921
+ m.label[0],
922
+ m.label[1]
923
+ )}`,
924
+ onMouseDown: g,
925
+ children: /* @__PURE__ */ e("span", { className: "ds:hidden ds:@md/toolbar:inline", children: c(m.label[0], m.label[1]) })
926
+ }
927
+ ) }),
928
+ /* @__PURE__ */ e(Ae.Content, { align: "start", children: Fe.map((d) => /* @__PURE__ */ e(
929
+ Ae.Item,
930
+ {
931
+ startIcon: d.icon,
932
+ onSelect: () => o("module.block.format", { tag: d.tag }),
933
+ children: c(d.label[0], d.label[1])
934
+ },
935
+ d.id
936
+ )) })
937
+ ] });
938
+ }
939
+ function Cn({
940
+ insertHtml: o,
941
+ saveSelection: i,
942
+ restoreSelection: g,
943
+ getSelectedText: c
944
+ }) {
945
+ const { t: m } = ee(), [d, b] = _(!1), [u, w] = _(""), [C, E] = _(""), [L, I] = _(!1), N = de(), $ = de(), l = () => {
946
+ w(""), E(""), I(!1);
947
+ }, a = () => {
948
+ const f = u.trim();
949
+ if (!f) return;
950
+ const A = C.trim() || f, x = L ? ' target="_blank" rel="noopener noreferrer"' : "", S = `<a href="${Le(f)}"${x}>${Le(A)}</a>`;
951
+ b(!1), l(), window.requestAnimationFrame(() => {
952
+ g(), o(S);
953
+ });
954
+ };
955
+ return /* @__PURE__ */ v(B.Root, { open: d, onOpenChange: b, children: [
956
+ /* @__PURE__ */ e(B.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
957
+ F,
958
+ {
959
+ size: "sm",
960
+ intent: "ghost",
961
+ icon: /* @__PURE__ */ e(Cr, {}),
962
+ "aria-label": m("editor.link.insert", "Insert link"),
963
+ onMouseDown: () => {
964
+ i(), E(c());
965
+ }
966
+ }
967
+ ) }),
968
+ /* @__PURE__ */ v(B.Content, { children: [
969
+ /* @__PURE__ */ e(B.Header, { children: /* @__PURE__ */ e(B.Title, { children: m("editor.link.insert", "Insert link") }) }),
970
+ /* @__PURE__ */ v(B.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
971
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
972
+ /* @__PURE__ */ e("label", { htmlFor: N, className: ve, children: m("editor.link.url", "URL") }),
973
+ /* @__PURE__ */ e(
974
+ Ie,
975
+ {
976
+ id: N,
977
+ type: "url",
978
+ value: u,
979
+ onChange: (f) => w(f.target.value),
980
+ placeholder: "https://…"
981
+ }
982
+ )
983
+ ] }),
984
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
985
+ /* @__PURE__ */ e("label", { htmlFor: $, className: ve, children: m("editor.link.text", "Text to display") }),
986
+ /* @__PURE__ */ e(
987
+ Ie,
988
+ {
989
+ id: $,
990
+ value: C,
991
+ onChange: (f) => E(f.target.value),
992
+ placeholder: m("editor.link.textPlaceholder", "Link text")
993
+ }
994
+ )
995
+ ] }),
996
+ /* @__PURE__ */ e(
997
+ Xt,
998
+ {
999
+ checked: L,
1000
+ onCheckedChange: (f) => I(f === !0),
1001
+ label: m("editor.link.newTab", "Open in new tab")
1002
+ }
1003
+ )
1004
+ ] }),
1005
+ /* @__PURE__ */ v(B.Footer, { children: [
1006
+ /* @__PURE__ */ e(B.Close, { asChild: !0, children: /* @__PURE__ */ e(ie, { intent: "secondary", children: m("common.cancel") }) }),
1007
+ /* @__PURE__ */ e(ie, { onClick: a, disabled: !u.trim(), children: m("editor.link.insertAction", "Insert") })
1008
+ ] })
1009
+ ] })
1010
+ ] });
1011
+ }
1012
+ function Nn({
1013
+ insertHtml: o,
1014
+ saveSelection: i,
1015
+ restoreSelection: g,
1016
+ uploadImage: c
1017
+ }) {
1018
+ const { t: m } = ee(), [d, b] = _(!1), [u, w] = _(""), [C, E] = _(""), L = de(), I = de(), N = (l, a) => {
1019
+ const f = `<img src="${Le(l)}" alt="${Le(a)}" loading="lazy">`;
1020
+ b(!1), w(""), E(""), window.requestAnimationFrame(() => {
1021
+ g(), o(f);
1022
+ });
1023
+ }, $ = () => {
1024
+ const l = u.trim();
1025
+ l && N(l, C.trim());
1026
+ };
1027
+ return /* @__PURE__ */ v(B.Root, { open: d, onOpenChange: b, children: [
1028
+ /* @__PURE__ */ e(B.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1029
+ F,
1030
+ {
1031
+ size: "sm",
1032
+ intent: "ghost",
1033
+ icon: /* @__PURE__ */ e(Zt, {}),
1034
+ "aria-label": m("editor.image.insert", "Insert image"),
1035
+ onMouseDown: () => i()
1036
+ }
1037
+ ) }),
1038
+ /* @__PURE__ */ v(B.Content, { children: [
1039
+ /* @__PURE__ */ e(B.Header, { children: /* @__PURE__ */ e(B.Title, { children: m("editor.image.insert", "Insert image") }) }),
1040
+ /* @__PURE__ */ v(B.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1041
+ c ? /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1042
+ /* @__PURE__ */ e("span", { className: ve, children: m("editor.image.upload", "Upload") }),
1043
+ /* @__PURE__ */ e(
1044
+ Ut,
1045
+ {
1046
+ variant: "dropzone",
1047
+ accept: {
1048
+ "image/*": [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"]
1049
+ },
1050
+ maxFiles: 1,
1051
+ onUpload: async (l, { signal: a }) => {
1052
+ const f = await c(l, a);
1053
+ N(f, l.name);
1054
+ }
1055
+ }
1056
+ ),
1057
+ /* @__PURE__ */ e("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: m("editor.image.orUrl", "Or paste an image URL") })
1058
+ ] }) : null,
1059
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1060
+ /* @__PURE__ */ e("label", { htmlFor: L, className: ve, children: m("editor.image.url", "Image URL") }),
1061
+ /* @__PURE__ */ e(
1062
+ Ie,
1063
+ {
1064
+ id: L,
1065
+ type: "url",
1066
+ value: u,
1067
+ onChange: (l) => w(l.target.value),
1068
+ placeholder: "https://…"
1069
+ }
1070
+ )
1071
+ ] }),
1072
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1073
+ /* @__PURE__ */ e("label", { htmlFor: I, className: ve, children: m("editor.image.alt", "Alt text") }),
1074
+ /* @__PURE__ */ e(
1075
+ Ie,
1076
+ {
1077
+ id: I,
1078
+ value: C,
1079
+ onChange: (l) => E(l.target.value),
1080
+ placeholder: m(
1081
+ "editor.image.altPlaceholder",
1082
+ "Describe the image"
1083
+ )
1084
+ }
1085
+ )
1086
+ ] })
1087
+ ] }),
1088
+ /* @__PURE__ */ v(B.Footer, { children: [
1089
+ /* @__PURE__ */ e(B.Close, { asChild: !0, children: /* @__PURE__ */ e(ie, { intent: "secondary", children: m("common.cancel") }) }),
1090
+ /* @__PURE__ */ e(ie, { onClick: $, disabled: !u.trim(), children: m("editor.image.insertAction", "Insert") })
1091
+ ] })
1092
+ ] })
1093
+ ] });
1094
+ }
1095
+ function Mn({
1096
+ run: o,
1097
+ saveSelection: i,
1098
+ restoreSelection: g
1099
+ }) {
1100
+ const { t: c } = ee(), [m, d] = _("#1f2a5c"), b = (w) => {
1101
+ d(w), g(), o("module.inline.format", {
1102
+ tag: "span",
1103
+ style: { color: w },
1104
+ type: "toggle"
1105
+ });
1106
+ }, u = () => {
1107
+ g(), o("module.inline.remove", { style: "color" });
1108
+ };
1109
+ return /* @__PURE__ */ v(q, { onOpenChange: (w) => w && i(), children: [
1110
+ /* @__PURE__ */ e(q.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1111
+ F,
1112
+ {
1113
+ size: "sm",
1114
+ intent: "ghost",
1115
+ icon: /* @__PURE__ */ e(Ir, {}),
1116
+ "aria-label": c("editor.textColor", "Text colour"),
1117
+ onMouseDown: (w) => {
1118
+ w.preventDefault(), i();
1119
+ }
1120
+ }
1121
+ ) }),
1122
+ /* @__PURE__ */ v(q.Content, { side: "bottom", align: "start", children: [
1123
+ /* @__PURE__ */ e(q.Heading, { children: c("editor.textColor", "Text colour") }),
1124
+ /* @__PURE__ */ e("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ e(
1125
+ We,
1126
+ {
1127
+ variant: "inline",
1128
+ size: "sm",
1129
+ value: m,
1130
+ onChange: b
1131
+ }
1132
+ ) }),
1133
+ /* @__PURE__ */ e("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ e(ie, { size: "sm", intent: "secondary", onClick: u, children: c("editor.color.remove", "Remove colour") }) })
1134
+ ] })
1135
+ ] });
1136
+ }
1137
+ function zn({
1138
+ run: o,
1139
+ saveSelection: i,
1140
+ restoreSelection: g
1141
+ }) {
1142
+ const { t: c } = ee(), [m, d] = _("#fff3a3"), b = (w) => {
1143
+ d(w), g(), o("module.inline.format", {
1144
+ tag: "span",
1145
+ style: { "background-color": w },
1146
+ type: "toggle"
1147
+ });
1148
+ }, u = () => {
1149
+ g(), o("module.inline.remove", { style: "background-color" });
1150
+ };
1151
+ return /* @__PURE__ */ v(q, { onOpenChange: (w) => w && i(), children: [
1152
+ /* @__PURE__ */ e(q.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1153
+ F,
1154
+ {
1155
+ size: "sm",
1156
+ intent: "ghost",
1157
+ icon: /* @__PURE__ */ e(vr, {}),
1158
+ "aria-label": c("editor.highlightColor", "Highlight"),
1159
+ onMouseDown: (w) => {
1160
+ w.preventDefault(), i();
1161
+ }
1162
+ }
1163
+ ) }),
1164
+ /* @__PURE__ */ v(q.Content, { side: "bottom", align: "start", children: [
1165
+ /* @__PURE__ */ e(q.Heading, { children: c("editor.highlightColor", "Highlight") }),
1166
+ /* @__PURE__ */ e("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ e(
1167
+ We,
1168
+ {
1169
+ variant: "inline",
1170
+ size: "sm",
1171
+ value: m,
1172
+ onChange: b
1173
+ }
1174
+ ) }),
1175
+ /* @__PURE__ */ e("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ e(ie, { size: "sm", intent: "secondary", onClick: u, children: c("editor.highlight.remove", "Remove highlight") }) })
1176
+ ] })
1177
+ ] });
1178
+ }
1179
+ function Tn(o, i) {
1180
+ const g = Array.from({ length: i }, () => "<td><br></td>").join("");
1181
+ return `<table><tbody>${Array.from({ length: o }, () => `<tr>${g}</tr>`).join("")}</tbody></table>`;
1182
+ }
1183
+ function _n({
1184
+ run: o,
1185
+ insertTable: i,
1186
+ active: g
1187
+ }) {
1188
+ const { t: c } = ee(), [m, d] = _({ r: 0, c: 0 }), b = g.has("table");
1189
+ return /* @__PURE__ */ v(q, { onOpenChange: (u) => !u && d({ r: 0, c: 0 }), children: [
1190
+ /* @__PURE__ */ e(q.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1191
+ F,
1192
+ {
1193
+ size: "sm",
1194
+ intent: "ghost",
1195
+ icon: /* @__PURE__ */ e(Jr, {}),
1196
+ "aria-label": c("editor.table.insert", "Insert table"),
1197
+ onMouseDown: (u) => u.preventDefault()
1198
+ }
1199
+ ) }),
1200
+ /* @__PURE__ */ e(q.Content, { side: "bottom", align: "start", children: b ? (
1201
+ // Caret is already inside a table — offer the manage ops only, never
1202
+ // a nested-table insert (mirrors Redactor's native dropdown, which
1203
+ // disables "insert table" while the caret is in a table).
1204
+ /* @__PURE__ */ e("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: bt.map((u) => /* @__PURE__ */ v(
1205
+ "button",
1206
+ {
1207
+ type: "button",
1208
+ onClick: () => o(u.command),
1209
+ className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] ds:text-start ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)] ds:hover:bg-[var(--muted)]",
1210
+ children: [
1211
+ /* @__PURE__ */ e(
1212
+ "span",
1213
+ {
1214
+ "aria-hidden": "true",
1215
+ className: "ds:inline-flex ds:size-4 ds:shrink-0 ds:items-center ds:justify-center ds:text-[color:var(--muted-foreground)]",
1216
+ children: u.icon
1217
+ }
1218
+ ),
1219
+ c(u.label[0], u.label[1])
1220
+ ]
1221
+ },
1222
+ u.id
1223
+ )) })
1224
+ ) : /* @__PURE__ */ v(ke, { children: [
1225
+ /* @__PURE__ */ e(q.Heading, { children: c("editor.table.insert", "Insert table") }),
1226
+ /* @__PURE__ */ e(
1227
+ "div",
1228
+ {
1229
+ role: "group",
1230
+ "aria-label": c("editor.table.sizePicker", "Table size"),
1231
+ className: "ds:mt-[var(--spacing-sm)] ds:grid ds:w-fit ds:grid-cols-6 ds:gap-[var(--spacing-2xs)]",
1232
+ onMouseLeave: () => d({ r: 0, c: 0 }),
1233
+ children: Array.from({ length: Re * Re }, (u, w) => {
1234
+ const C = Math.floor(w / Re) + 1, E = w % Re + 1, L = C <= m.r && E <= m.c;
1235
+ return /* @__PURE__ */ e(
1236
+ "button",
1237
+ {
1238
+ type: "button",
1239
+ "aria-label": c("editor.table.sizeCell", "{{r}}×{{c}}", {
1240
+ r: C,
1241
+ c: E
1242
+ }),
1243
+ onMouseEnter: () => d({ r: C, c: E }),
1244
+ onClick: () => i(Tn(C, E)),
1245
+ className: `ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ${L ? "ds:bg-[var(--primary)]" : "ds:bg-[var(--muted)]"}`
1246
+ },
1247
+ w
1248
+ );
1249
+ })
1250
+ }
1251
+ ),
1252
+ /* @__PURE__ */ e("p", { className: "ds:mt-[var(--spacing-xs)] ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: m.r > 0 ? c("editor.table.sizeCell", "{{r}}×{{c}}", {
1253
+ r: m.r,
1254
+ c: m.c
1255
+ }) : c("editor.table.sizeHint", "Pick a size") })
1256
+ ] }) })
1257
+ ] });
1258
+ }
1259
+ const En = Object.fromEntries(bt.map((o) => [o.id, o])), An = [
1260
+ "ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1261
+ "ds:[inset-block-start:var(--rte-tt-top)] ds:[inset-inline-start:var(--rte-tt-start)]",
1262
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1263
+ "ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
1264
+ ].join(" "), Rn = "#fde68a";
1265
+ function ut({
1266
+ scope: o,
1267
+ icon: i,
1268
+ label: g,
1269
+ onOpenChange: c,
1270
+ saveTableCell: m,
1271
+ applyTableBackground: d
1272
+ }) {
1273
+ const { t: b } = ee(), [u, w] = _(Rn);
1274
+ return /* @__PURE__ */ v(
1275
+ q,
1276
+ {
1277
+ onOpenChange: (C) => {
1278
+ c(C), C && m();
1279
+ },
1280
+ children: [
1281
+ /* @__PURE__ */ e(q.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1282
+ F,
1283
+ {
1284
+ size: "sm",
1285
+ intent: "ghost",
1286
+ icon: i,
1287
+ tooltip: g,
1288
+ onMouseDown: (C) => C.preventDefault()
1289
+ }
1290
+ ) }),
1291
+ /* @__PURE__ */ v(q.Content, { side: "bottom", align: "center", children: [
1292
+ /* @__PURE__ */ e(
1293
+ We,
1294
+ {
1295
+ variant: "inline",
1296
+ size: "sm",
1297
+ value: u,
1298
+ onChange: (C) => {
1299
+ w(C), d(o, C);
1300
+ }
1301
+ }
1302
+ ),
1303
+ /* @__PURE__ */ e(
1304
+ ie,
1305
+ {
1306
+ size: "sm",
1307
+ intent: "ghost",
1308
+ className: "ds:mt-[var(--spacing-xs)] ds:w-full",
1309
+ onClick: () => d(o, null),
1310
+ children: b("editor.table.clearColor", "Clear colour")
1311
+ }
1312
+ )
1313
+ ] })
1314
+ ]
1315
+ }
1316
+ );
1317
+ }
1318
+ function Sn({
1319
+ active: o,
1320
+ run: i,
1321
+ areaRef: g,
1322
+ getActiveTableEl: c,
1323
+ enableColor: m = !1,
1324
+ saveTableCell: d,
1325
+ applyTableBackground: b
1326
+ }) {
1327
+ const { t: u } = ee(), w = o.has("table"), [C, E] = _(null), L = D(0), [I, N] = _(!1), $ = k((a) => {
1328
+ L.current = Math.max(
1329
+ 0,
1330
+ L.current + (a ? 1 : -1)
1331
+ ), N(L.current > 0);
1332
+ }, []);
1333
+ if (Z(() => {
1334
+ if (I) return;
1335
+ if (!w || typeof window > "u") {
1336
+ E(null);
1337
+ return;
1338
+ }
1339
+ const a = () => {
1340
+ const S = g.current, Y = c();
1341
+ if (!S || !Y) {
1342
+ E(null);
1343
+ return;
1344
+ }
1345
+ const H = S.getBoundingClientRect(), X = Y.getBoundingClientRect(), R = getComputedStyle(S).direction === "rtl", K = Math.max(0, X.top - H.top - 44), U = R ? H.right - X.right + X.width / 2 : X.left - H.left + X.width / 2;
1346
+ E({ top: K, start: Math.max(0, U), rtl: R });
1347
+ };
1348
+ a();
1349
+ const f = new ResizeObserver(a), A = g.current, x = c();
1350
+ return A && f.observe(A), x && f.observe(x), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
1351
+ f.disconnect(), window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
1352
+ };
1353
+ }, [w, I, g, c]), !w && !I || !C) return null;
1354
+ const l = [
1355
+ ["rowAbove", "rowBelow"],
1356
+ ["colLeft", "colRight"],
1357
+ ["addHead"],
1358
+ ...m ? ["colour"] : [],
1359
+ ["deleteRow", "deleteColumn"],
1360
+ ["deleteTable"]
1361
+ ];
1362
+ return (
1363
+ // Tooltips disambiguate the icon-only ops on hover (and provide each
1364
+ // button's accessible name via IconButton's `tooltip` prop). Radix Tooltip
1365
+ // needs a provider ancestor, so scope one to the bar.
1366
+ /* @__PURE__ */ e(pt, { children: /* @__PURE__ */ e(
1367
+ "div",
1368
+ {
1369
+ role: "group",
1370
+ "aria-label": u("editor.table.toolbar", "Table tools"),
1371
+ className: `${An} ${C.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
1372
+ style: {
1373
+ "--rte-tt-top": `${C.top}px`,
1374
+ "--rte-tt-start": `${C.start}px`
1375
+ },
1376
+ children: l.map((a, f) => /* @__PURE__ */ v(He, { children: [
1377
+ f > 0 ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: Xe }) : null,
1378
+ a === "colour" ? /* @__PURE__ */ v(ke, { children: [
1379
+ /* @__PURE__ */ e(
1380
+ ut,
1381
+ {
1382
+ scope: "cell",
1383
+ icon: /* @__PURE__ */ e(Er, {}),
1384
+ label: u("editor.table.cellColor", "Cell colour"),
1385
+ onOpenChange: $,
1386
+ saveTableCell: d,
1387
+ applyTableBackground: b
1388
+ }
1389
+ ),
1390
+ /* @__PURE__ */ e(
1391
+ ut,
1392
+ {
1393
+ scope: "row",
1394
+ icon: /* @__PURE__ */ e(Rr, {}),
1395
+ label: u("editor.table.rowColor", "Row colour"),
1396
+ onOpenChange: $,
1397
+ saveTableCell: d,
1398
+ applyTableBackground: b
1399
+ }
1400
+ )
1401
+ ] }) : a.map((A) => {
1402
+ const x = En[A];
1403
+ return /* @__PURE__ */ e(
1404
+ F,
1405
+ {
1406
+ size: "sm",
1407
+ intent: "ghost",
1408
+ icon: x.icon,
1409
+ tooltip: u(x.label[0], x.label[1]),
1410
+ onMouseDown: (S) => S.preventDefault(),
1411
+ onClick: () => i(x.command)
1412
+ },
1413
+ A
1414
+ );
1415
+ })
1416
+ ] }, a === "colour" ? "colour" : a[0]))
1417
+ }
1418
+ ) })
1419
+ );
1420
+ }
1421
+ const Ke = [
1422
+ "wysiwyg-img-inline",
1423
+ "wysiwyg-img-wrap-left",
1424
+ "wysiwyg-img-wrap-right"
1425
+ ], yt = [
1426
+ "wysiwyg-img-align-left",
1427
+ "wysiwyg-img-align-center",
1428
+ "wysiwyg-img-align-right"
1429
+ ];
1430
+ function mt(o, i) {
1431
+ return i.find((g) => o.classList.contains(g)) ?? "";
1432
+ }
1433
+ function In(o) {
1434
+ const i = o.closest(".redactor-in"), g = i instanceof HTMLElement ? i.clientWidth : 0, c = o.getBoundingClientRect().width;
1435
+ return g <= 0 || c <= 0 ? we : Math.round(Math.min(we, c / g * 100));
1436
+ }
1437
+ const Ve = 10, we = 100, Ln = 5, Hn = 10, ht = (o) => Math.min(we, Math.max(Ve, Math.round(o))), $n = [
1438
+ {
1439
+ id: "wysiwyg-img-inline",
1440
+ icon: /* @__PURE__ */ e(nr, {}),
1441
+ label: ["editor.image.inline", "Inline with text"]
1442
+ },
1443
+ {
1444
+ id: "wysiwyg-img-wrap-left",
1445
+ icon: /* @__PURE__ */ e(Hr, {}),
1446
+ label: ["editor.image.wrapLeft", "Wrap left"]
1447
+ },
1448
+ {
1449
+ id: "wysiwyg-img-wrap-right",
1450
+ icon: /* @__PURE__ */ e(Dr, {}),
1451
+ label: ["editor.image.wrapRight", "Wrap right"]
1452
+ }
1453
+ ], Dn = [
1454
+ {
1455
+ id: "wysiwyg-img-align-left",
1456
+ icon: /* @__PURE__ */ e(an, {}),
1457
+ label: ["editor.image.alignLeft", "Align left"]
1458
+ },
1459
+ {
1460
+ id: "wysiwyg-img-align-center",
1461
+ icon: /* @__PURE__ */ e(tn, {}),
1462
+ label: ["editor.image.alignCenter", "Align centre"]
1463
+ },
1464
+ {
1465
+ id: "wysiwyg-img-align-right",
1466
+ icon: /* @__PURE__ */ e(nn, {}),
1467
+ label: ["editor.image.alignRight", "Align right"]
1468
+ }
1469
+ ], Pn = [
1470
+ {
1471
+ id: "tl",
1472
+ pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
1473
+ cursor: "ds:cursor-nwse-resize",
1474
+ sign: -1,
1475
+ labelKey: "editor.image.resizeTopStart",
1476
+ labelFallback: "Resize image, top-start corner"
1477
+ },
1478
+ {
1479
+ id: "tr",
1480
+ pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
1481
+ cursor: "ds:cursor-nesw-resize",
1482
+ sign: 1,
1483
+ labelKey: "editor.image.resizeTopEnd",
1484
+ labelFallback: "Resize image, top-end corner"
1485
+ },
1486
+ {
1487
+ id: "bl",
1488
+ pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
1489
+ cursor: "ds:cursor-nesw-resize",
1490
+ sign: -1,
1491
+ labelKey: "editor.image.resizeBottomStart",
1492
+ labelFallback: "Resize image, bottom-start corner"
1493
+ },
1494
+ {
1495
+ id: "br",
1496
+ pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
1497
+ cursor: "ds:cursor-nwse-resize",
1498
+ sign: 1,
1499
+ labelKey: "editor.image.resizeBottomEnd",
1500
+ labelFallback: "Resize image, bottom-end corner"
1501
+ }
1502
+ ], On = [
1503
+ "ds:absolute ds:z-20 ds:pointer-events-none",
1504
+ "ds:[inset-block-start:var(--rte-img-top)] ds:[inset-inline-start:var(--rte-img-start)]",
1505
+ "ds:[inline-size:var(--rte-img-width)] ds:[block-size:var(--rte-img-height)]",
1506
+ "ds:rounded-[var(--radius-2xs)]",
1507
+ "ds:[outline-style:solid] ds:[outline-width:var(--border-width-md)]",
1508
+ "ds:[outline-color:var(--accent)] ds:[outline-offset:var(--focus-ring-offset)]"
1509
+ ].join(" "), qn = [
1510
+ "ds:absolute ds:pointer-events-auto ds:touch-none",
1511
+ "ds:[inline-size:var(--spacing-md)] ds:[block-size:var(--spacing-md)]",
1512
+ "ds:rounded-[var(--radius-2xs)] ds:shadow-[var(--shadow-sm)]",
1513
+ "ds:bg-[var(--accent)] ds:border ds:border-[color:var(--background)]",
1514
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1515
+ "ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)]",
1516
+ "ds:focus-visible:[outline-offset:var(--focus-ring-offset)]",
1517
+ "ds:forced-colors:bg-[CanvasText]"
1518
+ ].join(" "), jn = [
1519
+ "ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1520
+ "ds:[inset-block-start:var(--rte-img-bar-top)] ds:[inset-inline-start:var(--rte-img-center)]",
1521
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1522
+ "ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
1523
+ ].join(" ");
1524
+ function Fn({
1525
+ areaRef: o,
1526
+ activeImageEl: i,
1527
+ applyImageClass: g,
1528
+ setImageWidth: c
1529
+ }) {
1530
+ const { t: m } = ee(), [d, b] = _(null), u = D(null);
1531
+ Z(() => {
1532
+ if (!i || typeof window > "u") {
1533
+ b(null);
1534
+ return;
1535
+ }
1536
+ const l = () => {
1537
+ const S = o.current;
1538
+ if (!S) {
1539
+ b(null);
1540
+ return;
1541
+ }
1542
+ const Y = S.getBoundingClientRect(), H = i.getBoundingClientRect(), X = getComputedStyle(S).direction === "rtl", R = H.top - Y.top, K = X ? Y.right - H.right : H.left - Y.left, U = K + H.width / 2, P = Math.max(0, R - 44);
1543
+ b({
1544
+ top: R,
1545
+ start: Math.max(0, K),
1546
+ width: H.width,
1547
+ height: H.height,
1548
+ center: Math.max(0, U),
1549
+ barTop: P,
1550
+ pct: In(i),
1551
+ rtl: X
1552
+ });
1553
+ };
1554
+ l();
1555
+ const a = new ResizeObserver(l);
1556
+ a.observe(i);
1557
+ const f = o.current;
1558
+ f && a.observe(f);
1559
+ const A = i.closest(".redactor-in");
1560
+ let x = null;
1561
+ return A && (x = new MutationObserver(l), x.observe(A, {
1562
+ subtree: !0,
1563
+ childList: !0,
1564
+ characterData: !0,
1565
+ attributes: !0,
1566
+ attributeFilter: ["class", "style", "width", "height", "src"]
1567
+ })), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), () => {
1568
+ a.disconnect(), x == null || x.disconnect(), window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l);
1569
+ };
1570
+ }, [i, o]);
1571
+ const w = k(
1572
+ (l) => (a) => {
1573
+ !a.isPrimary || !d || (a.preventDefault(), a.currentTarget.setPointerCapture(a.pointerId), u.current = {
1574
+ pointerId: a.pointerId,
1575
+ startX: a.clientX,
1576
+ startPct: d.pct,
1577
+ sign: l.sign * (d.rtl ? -1 : 1)
1578
+ });
1579
+ },
1580
+ [d]
1581
+ ), C = k(
1582
+ (l) => {
1583
+ const a = u.current;
1584
+ if (!a || l.pointerId !== a.pointerId || !i) return;
1585
+ const f = i.closest(".redactor-in"), A = f instanceof HTMLElement ? f.clientWidth : 0;
1586
+ if (A <= 0) return;
1587
+ const x = a.sign * (l.clientX - a.startX) / A * 100;
1588
+ c(ht(a.startPct + x));
1589
+ },
1590
+ [i, c]
1591
+ ), E = k(
1592
+ (l) => {
1593
+ const a = u.current;
1594
+ !a || l.pointerId !== a.pointerId || (l.currentTarget.releasePointerCapture(l.pointerId), u.current = null);
1595
+ },
1596
+ []
1597
+ ), L = k(
1598
+ (l) => {
1599
+ if (!d) return;
1600
+ let a = null;
1601
+ const f = l.shiftKey ? Hn : Ln;
1602
+ switch (l.key) {
1603
+ // Up / right always grow; down / left always shrink — independent of
1604
+ // which corner has focus, so the gesture reads the same everywhere.
1605
+ case "ArrowRight":
1606
+ case "ArrowUp":
1607
+ a = d.pct + f;
1608
+ break;
1609
+ case "ArrowLeft":
1610
+ case "ArrowDown":
1611
+ a = d.pct - f;
1612
+ break;
1613
+ case "Home":
1614
+ a = Ve;
1615
+ break;
1616
+ case "End":
1617
+ a = we;
1618
+ break;
1619
+ default:
1620
+ return;
1621
+ }
1622
+ l.preventDefault(), c(ht(a));
1623
+ },
1624
+ [d, c]
1625
+ );
1626
+ if (!i || !d) return null;
1627
+ const I = mt(i, Ke), N = mt(i, yt), $ = m("editor.image.widthAnnounce", {
1628
+ width: d.pct,
1629
+ defaultValue: "{{width}} percent"
1630
+ });
1631
+ return /* @__PURE__ */ v(ke, { children: [
1632
+ /* @__PURE__ */ e(
1633
+ "div",
1634
+ {
1635
+ className: On,
1636
+ style: {
1637
+ "--rte-img-top": `${d.top}px`,
1638
+ "--rte-img-start": `${d.start}px`,
1639
+ "--rte-img-width": `${d.width}px`,
1640
+ "--rte-img-height": `${d.height}px`
1641
+ },
1642
+ children: Pn.map((l) => /* @__PURE__ */ e(
1643
+ "div",
1644
+ {
1645
+ role: "slider",
1646
+ tabIndex: 0,
1647
+ "aria-label": m(l.labelKey, l.labelFallback),
1648
+ "aria-orientation": "horizontal",
1649
+ "aria-valuemin": Ve,
1650
+ "aria-valuemax": we,
1651
+ "aria-valuenow": d.pct,
1652
+ "aria-valuetext": $,
1653
+ className: `${qn} ${l.pos} ${l.cursor}`,
1654
+ onPointerDown: w(l),
1655
+ onPointerMove: C,
1656
+ onPointerUp: E,
1657
+ onPointerCancel: E,
1658
+ onKeyDown: L
1659
+ },
1660
+ l.id
1661
+ ))
1662
+ }
1663
+ ),
1664
+ /* @__PURE__ */ e(pt, { children: /* @__PURE__ */ e(
1665
+ "div",
1666
+ {
1667
+ role: "group",
1668
+ "aria-label": m("editor.image.toolbar", "Image tools"),
1669
+ className: `${jn} ${d.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
1670
+ style: {
1671
+ "--rte-img-bar-top": `${d.barTop}px`,
1672
+ "--rte-img-center": `${d.center}px`
1673
+ },
1674
+ children: [$n, Dn].map((l, a) => /* @__PURE__ */ v(He, { children: [
1675
+ a > 0 ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: Xe }) : null,
1676
+ l.map((f) => {
1677
+ const A = a === 0 ? I === f.id : N === f.id;
1678
+ return /* @__PURE__ */ e(
1679
+ F,
1680
+ {
1681
+ size: "sm",
1682
+ intent: "ghost",
1683
+ icon: f.icon,
1684
+ "aria-pressed": A,
1685
+ tooltip: m(f.label[0], f.label[1]),
1686
+ onMouseDown: (x) => x.preventDefault(),
1687
+ onClick: () => g(f.id)
1688
+ },
1689
+ f.id
1690
+ );
1691
+ })
1692
+ ] }, a === 0 ? "flow" : "align"))
1693
+ }
1694
+ ) })
1695
+ ] });
1696
+ }
1697
+ function Bn({
1698
+ run: o,
1699
+ active: i,
1700
+ preset: g,
1701
+ insertHtml: c,
1702
+ insertTable: m,
1703
+ saveSelection: d,
1704
+ restoreSelection: b,
1705
+ getSelectedText: u,
1706
+ uploadImage: w,
1707
+ enableColor: C = !1,
1708
+ enableImage: E = !1,
1709
+ enableTable: L = !1,
1710
+ showExtensions: I = !1
1711
+ }) {
1712
+ const { t: N } = ee(), $ = (P) => P.preventDefault(), l = (P) => vn[g].includes(P), a = (P) => {
1713
+ if (!l(P)) return null;
1714
+ const y = yn[P];
1715
+ return /* @__PURE__ */ e(
1716
+ F,
1717
+ {
1718
+ size: "sm",
1719
+ intent: "ghost",
1720
+ icon: y.icon,
1721
+ "aria-label": N(y.label[0], y.label[1]),
1722
+ "aria-pressed": y.toggle ? i.has(y.toggle) : void 0,
1723
+ onMouseDown: $,
1724
+ onClick: () => o(...y.command)
1725
+ },
1726
+ y.id
1727
+ );
1728
+ }, f = () => /* @__PURE__ */ e("span", { "aria-hidden": "true", className: Xe }), A = l("format"), x = [
1729
+ a("bold"),
1730
+ a("italic"),
1731
+ a("underline"),
1732
+ a("strike"),
1733
+ C ? /* @__PURE__ */ e(
1734
+ Mn,
1735
+ {
1736
+ run: o,
1737
+ saveSelection: d,
1738
+ restoreSelection: b
1739
+ },
1740
+ "colour"
1741
+ ) : null,
1742
+ C ? /* @__PURE__ */ e(
1743
+ zn,
1744
+ {
1745
+ run: o,
1746
+ saveSelection: d,
1747
+ restoreSelection: b
1748
+ },
1749
+ "highlight"
1750
+ ) : null
1751
+ ].filter(Boolean), S = A || x.length > 0, Y = [a("ul"), a("ol")].filter(Boolean), H = [
1752
+ l("link") ? /* @__PURE__ */ e(
1753
+ Cn,
1754
+ {
1755
+ insertHtml: c,
1756
+ saveSelection: d,
1757
+ restoreSelection: b,
1758
+ getSelectedText: u
1759
+ },
1760
+ "link"
1761
+ ) : null,
1762
+ E ? /* @__PURE__ */ e(
1763
+ Nn,
1764
+ {
1765
+ insertHtml: c,
1766
+ saveSelection: d,
1767
+ restoreSelection: b,
1768
+ uploadImage: w
1769
+ },
1770
+ "image"
1771
+ ) : null,
1772
+ L ? /* @__PURE__ */ e(
1773
+ _n,
1774
+ {
1775
+ run: o,
1776
+ insertTable: m,
1777
+ active: i
1778
+ },
1779
+ "table"
1780
+ ) : null
1781
+ ].filter(Boolean), X = I ? [
1782
+ /* @__PURE__ */ e(
1783
+ F,
1784
+ {
1785
+ size: "sm",
1786
+ intent: "ghost",
1787
+ icon: /* @__PURE__ */ e(mn, {}),
1788
+ "aria-label": N("editor.extensions", "Editor extensions"),
1789
+ disabled: !0,
1790
+ onMouseDown: $
1791
+ },
1792
+ "extensions"
1793
+ )
1794
+ ] : [], R = [Y, H, X].filter(
1795
+ (P) => P.length > 0
1796
+ ), K = R.length > 0, U = (P) => R.map((y, V) => /* @__PURE__ */ v(He, { children: [
1797
+ V > 0 || P ? /* @__PURE__ */ e(f, {}) : null,
1798
+ y
1799
+ ] }, V));
1800
+ return (
1801
+ // Outer element is the query container + visual chrome; the flex row is an
1802
+ // inner child so `container-type` never lands on the flex parent (which
1803
+ // would blockify the inline controls).
1804
+ /* @__PURE__ */ e("div", { className: wn(), "data-component": "editor-toolbar", children: /* @__PURE__ */ v(
1805
+ "div",
1806
+ {
1807
+ role: "group",
1808
+ "aria-label": N("editor.toolbarLabel"),
1809
+ className: kn,
1810
+ children: [
1811
+ A ? /* @__PURE__ */ e(xn, { run: o, active: i, onTriggerDown: $ }) : null,
1812
+ A && x.length > 0 ? /* @__PURE__ */ e(f, {}) : null,
1813
+ x,
1814
+ K ? /* @__PURE__ */ v(ke, { children: [
1815
+ /* @__PURE__ */ e("div", { className: "ds:hidden ds:@sm/toolbar:contents", children: U(S) }),
1816
+ /* @__PURE__ */ v("div", { className: "ds:contents ds:@sm/toolbar:hidden", children: [
1817
+ S ? /* @__PURE__ */ e(f, {}) : null,
1818
+ /* @__PURE__ */ v(q, { children: [
1819
+ /* @__PURE__ */ e(q.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1820
+ F,
1821
+ {
1822
+ size: "sm",
1823
+ intent: "ghost",
1824
+ icon: /* @__PURE__ */ e(Qt, {}),
1825
+ "aria-label": N("editor.more", "More options"),
1826
+ onMouseDown: $
1827
+ }
1828
+ ) }),
1829
+ /* @__PURE__ */ e(q.Content, { side: "bottom", align: "end", children: /* @__PURE__ */ e("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: U(!1) }) })
1830
+ ] })
1831
+ ] })
1832
+ ] }) : null
1833
+ ]
1834
+ }
1835
+ ) })
1836
+ );
1837
+ }
1838
+ function oe(o) {
1839
+ return jt(o, "rich-text");
1840
+ }
1841
+ function Be(o = "") {
1842
+ const i = String(o).trim();
1843
+ if (i === "" || i === "<p><br></p>" || i === "<p>&nbsp;</p>")
1844
+ return "";
1845
+ const g = i.replace(/<br\s*\/?>/gi, "").replace(/&nbsp;/gi, "").replace(/<[^>]+>/g, "").trim();
1846
+ return g === "" && /<img\b[^>]*>/i.test(i) ? i : g === "" ? "" : i;
1847
+ }
1848
+ function Kn(o) {
1849
+ return o.replace(
1850
+ /<img(?![^>]*\sloading=)([^>]*)>/gi,
1851
+ '<img loading="lazy"$1>'
1852
+ );
1853
+ }
1854
+ function Vn(o) {
1855
+ if (!o || typeof o != "object") return;
1856
+ const i = o, g = (c) => {
1857
+ if (c && typeof c == "object" && "url" in c) {
1858
+ const m = c.url;
1859
+ return typeof m == "string" ? m : void 0;
1860
+ }
1861
+ };
1862
+ return typeof i.url == "string" ? i.url : g(i.file) ?? g(i.data) ?? Object.values(i).map(g).find(Boolean);
1863
+ }
1864
+ function Gn(o) {
1865
+ if (o) return o;
1866
+ if (typeof window > "u") return null;
1867
+ const i = window;
1868
+ return i.$R ?? i.Redactor ?? null;
1869
+ }
1870
+ const Wn = {
1871
+ bold: ["module.inline.format", { tag: "b" }],
1872
+ italic: ["module.inline.format", { tag: "i" }],
1873
+ strikethrough: ["module.inline.format", { tag: "del" }],
1874
+ bulletedList: ["module.list.toggle", "ul"],
1875
+ numberedList: ["module.list.toggle", "ol"],
1876
+ heading: ["module.block.format", { tag: "h2" }],
1877
+ quote: ["module.block.format", { tag: "blockquote" }],
1878
+ paragraph: ["module.block.format", { tag: "p" }]
1879
+ }, Xn = {
1880
+ zh: "zh_cn",
1881
+ pt: "pt_br"
1882
+ };
1883
+ function Un(o) {
1884
+ const i = o.split("-")[0];
1885
+ return Xn[i] ?? i ?? "en";
1886
+ }
1887
+ const Qn = Ge(
1888
+ "redactor-theme-alfadocs ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"
1889
+ ), Zn = Ge(
1890
+ [
1891
+ "ds:block ds:[inline-size:100%]",
1892
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1893
+ "ds:bg-[var(--background)] ds:text-[var(--foreground)]",
1894
+ "ds:shadow-[var(--shadow-md)]",
1895
+ "ds:font-[family-name:var(--font-sans)] ds:text-[length:var(--font-size-base)]",
1896
+ "ds:p-[var(--spacing-md)] ds:[min-block-size:var(--rich-text-editor-min-block-size)]",
1897
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1898
+ "ds:focus-visible:outline-solid",
1899
+ "ds:focus-visible:outline-[var(--ring)]",
1900
+ "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1901
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
1902
+ ].join(" ")
1903
+ ), vt = [
1904
+ "ds:inline-flex ds:items-center ds:justify-center",
1905
+ "ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]",
1906
+ "ds:text-[color:var(--primary-foreground)]",
1907
+ "ds:transition-colors",
1908
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1909
+ "ds:focus-visible:outline-solid",
1910
+ "ds:focus-visible:outline-[var(--primary-foreground)]",
1911
+ "ds:focus-visible:[outline-offset:calc(var(--focus-ring-width)*-1)]"
1912
+ ].join(" "), Yn = `${vt} ds:hover:bg-[color-mix(in_srgb,var(--primary-foreground)_15%,transparent)]`, Jn = `${vt} ds:bg-[var(--destructive)] ds:hover:bg-[color-mix(in_srgb,var(--destructive)_88%,var(--primary-foreground))]`, eo = Pt(
1913
+ ({
1914
+ id: o,
1915
+ defaultValue: i,
1916
+ value: g,
1917
+ onChange: c,
1918
+ toolbar: m = "standard",
1919
+ placeholder: d,
1920
+ readOnly: b = !1,
1921
+ ariaLabel: u,
1922
+ minHeight: w,
1923
+ showExtensions: C,
1924
+ className: E,
1925
+ redactor: L,
1926
+ options: I,
1927
+ plugins: N,
1928
+ lang: $,
1929
+ imageUploadUrl: l,
1930
+ onKeyDown: a,
1931
+ onRequestAiDraft: f,
1932
+ aiDraftFormat: A = "html",
1933
+ aiPrivacyNotice: x,
1934
+ onDictate: S,
1935
+ onProofread: Y,
1936
+ onAutoFormat: H
1937
+ }, X) => {
1938
+ const { t: R, i18n: K } = ee(), U = de(), P = st(
1939
+ () => `rte-${U.replace(/[^a-zA-Z0-9-_]/g, "")}`,
1940
+ [U]
1941
+ ), y = `#${P}`, V = D(null), G = D(null), he = D(!1), ge = D(b), M = D(null), O = D(null), [j, te] = _(!1), [wt, Ue] = _(!1), [Qe, kt] = _(
1942
+ () => /* @__PURE__ */ new Set()
1943
+ ), xe = D(null), [xt, Ct] = _(
1944
+ null
1945
+ ), Ce = k((t) => {
1946
+ xe.current = t, Ct(t);
1947
+ }, []), fe = D(null), Q = D(c), Ne = D(a);
1948
+ Z(() => {
1949
+ Q.current = c, Ne.current = a;
1950
+ }, [c, a]);
1951
+ const Nt = D(
1952
+ (() => {
1953
+ const t = g ?? i ?? "";
1954
+ return t ? oe(t) : "";
1955
+ })()
1956
+ ), ae = k(() => {
1957
+ var r;
1958
+ const t = G.current;
1959
+ if (t)
1960
+ try {
1961
+ const n = t(y, "source.getCode");
1962
+ if (typeof n == "string") return n;
1963
+ } catch {
1964
+ }
1965
+ return ((r = V.current) == null ? void 0 : r.value) ?? "";
1966
+ }, [y]), re = k(
1967
+ (t, ...r) => {
1968
+ const n = G.current;
1969
+ if (!n) return !1;
1970
+ const s = ge.current;
1971
+ if (s)
1972
+ try {
1973
+ n(y, "disableReadOnly");
1974
+ } catch {
1975
+ }
1976
+ try {
1977
+ return n(y, t, ...r), !0;
1978
+ } catch {
1979
+ return !1;
1980
+ } finally {
1981
+ if (s)
1982
+ try {
1983
+ n(y, "enableReadOnly");
1984
+ } catch {
1985
+ }
1986
+ }
1987
+ },
1988
+ [y]
1989
+ ), se = k(
1990
+ (t, r) => {
1991
+ var ye;
1992
+ const n = (r == null ? void 0 : r.asHtml) ?? !0, s = n ? oe(t) : t;
1993
+ if (re(n ? "insertion.insertHtml" : "insertion.insertText", s)) return;
1994
+ const p = V.current;
1995
+ if (!p) return;
1996
+ const z = p.selectionStart ?? p.value.length, W = p.selectionEnd ?? p.value.length;
1997
+ p.value = p.value.slice(0, z) + s + p.value.slice(W);
1998
+ const Ee = z + s.length;
1999
+ try {
2000
+ p.setSelectionRange(Ee, Ee);
2001
+ } catch {
2002
+ }
2003
+ (ye = Q.current) == null || ye.call(Q, { html: oe(p.value), markdown: "" });
2004
+ },
2005
+ [re]
2006
+ ), $e = D(null), J = k(() => {
2007
+ var s;
2008
+ const t = (s = M.current) == null ? void 0 : s.querySelector(".redactor-in"), r = typeof window < "u" ? window.getSelection() : null, n = /* @__PURE__ */ new Set();
2009
+ if (t && r && r.anchorNode && t.contains(r.anchorNode) && typeof document.queryCommandState == "function") {
2010
+ r.rangeCount > 0 && ($e.current = r.getRangeAt(0).cloneRange());
2011
+ try {
2012
+ document.queryCommandState("bold") && n.add("bold"), document.queryCommandState("italic") && n.add("italic"), document.queryCommandState("underline") && n.add("underline"), document.queryCommandState("strikeThrough") && n.add("strike"), document.queryCommandState("insertUnorderedList") && n.add("ul"), document.queryCommandState("insertOrderedList") && n.add("ol");
2013
+ const h = String(
2014
+ document.queryCommandValue("formatBlock") || ""
2015
+ ).toLowerCase();
2016
+ /^h[1-6]$/.test(h) ? (n.add("heading"), n.add(h)) : h === "blockquote" ? n.add("quote") : n.add("paragraph");
2017
+ const p = r.anchorNode.nodeType === Node.TEXT_NODE ? r.anchorNode.parentElement : r.anchorNode;
2018
+ p && t.contains(p) && p.closest("table") && n.add("table");
2019
+ } catch {
2020
+ }
2021
+ }
2022
+ kt(
2023
+ (h) => h.size === n.size && [...n].every((p) => h.has(p)) ? h : n
2024
+ );
2025
+ }, []), ue = k(
2026
+ (t, ...r) => {
2027
+ re(t, ...r), typeof window < "u" ? window.requestAnimationFrame(() => J()) : J();
2028
+ },
2029
+ [re, J]
2030
+ );
2031
+ Z(() => {
2032
+ const t = M.current;
2033
+ if (!t) return;
2034
+ const r = {
2035
+ b: ["module.inline.format", { tag: "b" }],
2036
+ i: ["module.inline.format", { tag: "i" }],
2037
+ u: ["module.inline.format", { tag: "u" }]
2038
+ }, n = (s) => {
2039
+ if (!(s.metaKey || s.ctrlKey) || s.altKey || s.shiftKey || s.isComposing) return;
2040
+ const h = r[s.key.toLowerCase()];
2041
+ if (!h) return;
2042
+ const p = t.querySelector(".redactor-in");
2043
+ !p || !(s.target instanceof Node) || !p.contains(s.target) || ge.current || (s.preventDefault(), s.stopImmediatePropagation(), ue(...h));
2044
+ };
2045
+ return t.addEventListener("keydown", n, !0), () => t.removeEventListener("keydown", n, !0);
2046
+ }, [ue]);
2047
+ const De = k(
2048
+ (t) => {
2049
+ se(t, { asHtml: !0 }), typeof window < "u" && window.requestAnimationFrame(() => J());
2050
+ },
2051
+ [se, J]
2052
+ ), Ze = k(() => {
2053
+ var r;
2054
+ if (typeof window < "u") {
2055
+ const n = (r = M.current) == null ? void 0 : r.querySelector(".redactor-in"), s = window.getSelection();
2056
+ n && s && s.rangeCount > 0 && s.anchorNode && n.contains(s.anchorNode) && ($e.current = s.getRangeAt(0).cloneRange());
2057
+ }
2058
+ const t = G.current;
2059
+ if (t)
2060
+ try {
2061
+ t(y, "selection.save");
2062
+ } catch {
2063
+ }
2064
+ }, [y]), Ye = k(() => {
2065
+ const t = G.current;
2066
+ if (!t) return;
2067
+ const r = $e.current;
2068
+ try {
2069
+ t(y, "editor.focus");
2070
+ } catch {
2071
+ }
2072
+ if (r && typeof window < "u") {
2073
+ const n = window.getSelection();
2074
+ if (n)
2075
+ try {
2076
+ n.removeAllRanges(), n.addRange(r);
2077
+ return;
2078
+ } catch {
2079
+ }
2080
+ }
2081
+ try {
2082
+ t(y, "selection.restore");
2083
+ } catch {
2084
+ }
2085
+ }, [y]), Mt = k(() => {
2086
+ var n;
2087
+ if (typeof window > "u") return "";
2088
+ const t = (n = M.current) == null ? void 0 : n.querySelector(".redactor-in"), r = window.getSelection();
2089
+ return !t || !r || !r.anchorNode || !t.contains(r.anchorNode) ? "" : r.toString();
2090
+ }, []), zt = k(() => {
2091
+ var h;
2092
+ if (typeof window > "u") return null;
2093
+ const t = (h = M.current) == null ? void 0 : h.querySelector(".redactor-in"), r = window.getSelection();
2094
+ if (!t || !r || r.rangeCount === 0) return null;
2095
+ const n = r.anchorNode, s = n && n.nodeType === Node.TEXT_NODE ? n.parentElement : n;
2096
+ return !s || !t.contains(s) ? null : s.closest("table");
2097
+ }, []), Je = D(null), Me = k(() => {
2098
+ var h;
2099
+ if (typeof window > "u") return null;
2100
+ const t = (h = M.current) == null ? void 0 : h.querySelector(".redactor-in"), r = window.getSelection();
2101
+ if (!t || !r || r.rangeCount === 0) return null;
2102
+ const n = r.anchorNode, s = n && n.nodeType === Node.TEXT_NODE ? n.parentElement : n;
2103
+ return !s || !t.contains(s) ? null : s.closest("td,th");
2104
+ }, []), Tt = k(() => {
2105
+ Je.current = Me();
2106
+ }, [Me]), _t = k(
2107
+ (t, r) => {
2108
+ var p;
2109
+ const n = Je.current ?? Me();
2110
+ if (!n) return;
2111
+ const s = t === "row" ? Array.from(((p = n.closest("tr")) == null ? void 0 : p.children) ?? [n]).filter(
2112
+ (z) => z instanceof HTMLElement && (z.tagName === "TD" || z.tagName === "TH")
2113
+ ) : [n], h = G.current;
2114
+ if (h)
2115
+ try {
2116
+ h(y, "module.buffer.trigger");
2117
+ } catch {
2118
+ }
2119
+ for (const z of s)
2120
+ r ? z.style.setProperty("background-color", r) : z.style.removeProperty("background-color");
2121
+ if (h)
2122
+ try {
2123
+ h(y, "broadcast", "hardsync");
2124
+ } catch {
2125
+ }
2126
+ typeof window < "u" && window.requestAnimationFrame(() => J());
2127
+ },
2128
+ [Me, y, J]
2129
+ );
2130
+ Z(() => {
2131
+ const t = M.current;
2132
+ if (typeof window > "u" || !t) return;
2133
+ const r = (h) => {
2134
+ const p = t.querySelector(".redactor-in"), z = h.target;
2135
+ if (!p || !(z instanceof Node) || !p.contains(z))
2136
+ return;
2137
+ const W = z instanceof Element ? z.closest("img") : null;
2138
+ Ce(W && p.contains(W) ? W : null);
2139
+ }, n = (h) => {
2140
+ h.key === "Escape" && xe.current && Ce(null);
2141
+ }, s = (h) => {
2142
+ const p = h.relatedTarget;
2143
+ (!(p instanceof Node) || !t.contains(p)) && Ce(null);
2144
+ };
2145
+ return t.addEventListener("click", r), t.addEventListener("keydown", n), t.addEventListener("focusout", s), () => {
2146
+ t.removeEventListener("click", r), t.removeEventListener("keydown", n), t.removeEventListener("focusout", s);
2147
+ };
2148
+ }, [Ce]);
2149
+ const Et = k(
2150
+ (t) => {
2151
+ const r = xe.current;
2152
+ if (!r) return;
2153
+ const n = Ke.includes(
2154
+ t
2155
+ ) ? Ke : yt, s = G.current;
2156
+ if (s)
2157
+ try {
2158
+ s(y, "module.buffer.trigger");
2159
+ } catch {
2160
+ }
2161
+ for (const h of n) r.classList.remove(h);
2162
+ if (r.classList.add(t), s)
2163
+ try {
2164
+ s(y, "broadcast", "hardsync");
2165
+ } catch {
2166
+ }
2167
+ typeof window < "u" && window.requestAnimationFrame(() => J());
2168
+ },
2169
+ [y, J]
2170
+ ), At = k(
2171
+ (t) => {
2172
+ const r = xe.current;
2173
+ if (!r) return;
2174
+ const n = G.current;
2175
+ if (n)
2176
+ try {
2177
+ n(y, "module.buffer.trigger");
2178
+ } catch {
2179
+ }
2180
+ if (r.style.setProperty("width", `${t}%`), n)
2181
+ try {
2182
+ n(y, "broadcast", "hardsync");
2183
+ } catch {
2184
+ }
2185
+ typeof window < "u" && window.requestAnimationFrame(() => J());
2186
+ },
2187
+ [y, J]
2188
+ ), Rt = k(
2189
+ (t) => {
2190
+ var n;
2191
+ const r = G.current;
2192
+ if (r && typeof window < "u") {
2193
+ const s = (n = M.current) == null ? void 0 : n.querySelector(".redactor-in"), h = window.getSelection(), p = h == null ? void 0 : h.anchorNode, z = p && p.nodeType === Node.TEXT_NODE ? p.parentElement : p, W = z && (s != null && s.contains(z)) ? z.closest("ul,ol") : null;
2194
+ if (W)
2195
+ try {
2196
+ r(y, "caret.setAfter", W);
2197
+ } catch {
2198
+ }
2199
+ }
2200
+ De(t), typeof window < "u" && window.requestAnimationFrame(() => {
2201
+ var h;
2202
+ const s = (h = M.current) == null ? void 0 : h.querySelector(".redactor-in");
2203
+ s == null || s.querySelectorAll("table td, table th").forEach((p) => {
2204
+ let z = p.lastChild;
2205
+ for (; z && z.nodeType === Node.TEXT_NODE && !(z.textContent ?? "").trim(); ) {
2206
+ const W = z.previousSibling;
2207
+ p.removeChild(z), z = W;
2208
+ }
2209
+ });
2210
+ });
2211
+ },
2212
+ [De, y]
2213
+ ), St = k(
2214
+ async (t, r) => {
2215
+ if (!l) throw new Error("No image upload URL configured.");
2216
+ const n = new FormData();
2217
+ n.append("file", t);
2218
+ const s = await fetch(l, {
2219
+ method: "POST",
2220
+ body: n,
2221
+ credentials: "same-origin",
2222
+ signal: r
2223
+ });
2224
+ if (!s.ok) throw new Error(`Image upload failed (${s.status}).`);
2225
+ const h = Vn(await s.json());
2226
+ if (!h) throw new Error("Image upload response contained no URL.");
2227
+ return h;
2228
+ },
2229
+ [l]
2230
+ ), pe = D(null), ze = D(null), [be, et] = _(!1), [It, tt] = _(!1), [Lt, Pe] = _(""), Te = k(() => {
2231
+ const t = ze.current;
2232
+ t != null && t.parentNode && t.parentNode.removeChild(t), ze.current = null;
2233
+ }, []), rt = k((t) => {
2234
+ var s;
2235
+ const r = (s = M.current) == null ? void 0 : s.querySelector(
2236
+ ".redactor-in"
2237
+ );
2238
+ if (!r) return;
2239
+ let n = ze.current;
2240
+ if (!n || !r.contains(n)) {
2241
+ n = document.createElement("span"), n.setAttribute("data-rte-interim", ""), n.setAttribute("contenteditable", "false");
2242
+ const h = window.getSelection();
2243
+ if (h && h.rangeCount > 0 && r.contains(h.anchorNode)) {
2244
+ const p = h.getRangeAt(0);
2245
+ p.collapse(!1), p.insertNode(n);
2246
+ } else
2247
+ r.appendChild(n);
2248
+ ze.current = n;
2249
+ }
2250
+ n.textContent = t;
2251
+ }, []), nt = k(() => {
2252
+ var t;
2253
+ (t = pe.current) == null || t.abort();
2254
+ }, []), ot = k(() => {
2255
+ if (!S) return;
2256
+ const t = new AbortController();
2257
+ pe.current = t, tt(!1), et(!0), Pe(R("editor.ai.listening")), Te(), S({
2258
+ signal: t.signal,
2259
+ // Interim text shows live in the editor (grey + caret); each final
2260
+ // replaces it with committed text at the caret.
2261
+ onPartialTranscript: (r) => {
2262
+ t.signal.aborted || rt(r);
2263
+ },
2264
+ onFinalTranscript: (r) => {
2265
+ if (t.signal.aborted) return;
2266
+ Te();
2267
+ const n = r.trim();
2268
+ n && (se(`${n} `, { asHtml: !1 }), Pe(n));
2269
+ }
2270
+ }).catch((r) => {
2271
+ t.signal.aborted || r && typeof r == "object" && "name" in r && r.name === "AbortError" || tt(!0);
2272
+ }).finally(() => {
2273
+ Te(), pe.current === t && (pe.current = null, et(!1), Pe(""));
2274
+ });
2275
+ }, [S, se, Te, rt, R]), Ht = k(() => {
2276
+ be ? nt() : ot();
2277
+ }, [be, ot, nt]);
2278
+ Z(() => () => {
2279
+ var t;
2280
+ return (t = pe.current) == null ? void 0 : t.abort();
2281
+ }, []);
2282
+ const [ne, Oe] = _(null), le = D(null), it = k(
2283
+ (t, r) => {
2284
+ if (le.current) return;
2285
+ const n = new AbortController();
2286
+ le.current = n, Oe(t);
2287
+ const s = ae();
2288
+ Promise.resolve(r({ html: s, signal: n.signal })).then((h) => {
2289
+ var z;
2290
+ if (n.signal.aborted) return;
2291
+ const p = oe(String(h ?? ""));
2292
+ re("source.setCode", p), (z = Q.current) == null || z.call(Q, { html: p, markdown: "" });
2293
+ }).catch(() => {
2294
+ }).finally(() => {
2295
+ le.current === n && (le.current = null, Oe(null));
2296
+ });
2297
+ },
2298
+ [ae, re]
2299
+ ), at = k(() => {
2300
+ var t;
2301
+ (t = le.current) == null || t.abort(), le.current = null, Oe(null);
2302
+ }, []);
2303
+ Z(() => () => {
2304
+ var t;
2305
+ return (t = le.current) == null ? void 0 : t.abort();
2306
+ }, []), Z(() => {
2307
+ const t = V.current;
2308
+ if (!t) return;
2309
+ t.value = Nt.current;
2310
+ const r = Gn(L);
2311
+ if (!r) {
2312
+ te(!0);
2313
+ return;
2314
+ }
2315
+ G.current = r;
2316
+ const n = {
2317
+ lang: $ ?? Un(K.language || "en"),
2318
+ // The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
2319
+ // via the command API, so Redactor's native toolbar is suppressed.
2320
+ toolbar: !1,
2321
+ plugins: N ?? [],
2322
+ placeholder: d ?? R("editor.placeholder"),
2323
+ toolbarFixed: !1,
2324
+ // Platform parity (RedactorWysiwyg.js:84): no inline shortcode expansion.
2325
+ shortcodes: !1,
2326
+ // The kit owns image editing: ImageFloatingToolbar provides DS-native,
2327
+ // keyboard-accessible resize + wrap/align, so Redactor's own image
2328
+ // popup AND its single-handle drag-resizer are both disabled to avoid a
2329
+ // second, untokenised, mouse-only UI competing with ours.
2330
+ imageEditable: !1,
2331
+ imageResizable: !1
2332
+ }, s = l ? { imageUpload: l } : {}, h = (I == null ? void 0 : I.callbacks) ?? {}, p = {
2333
+ ...n,
2334
+ ...s,
2335
+ ...I ?? {},
2336
+ // Re-pin safety-critical keys LAST so consumer `options` can't override
2337
+ // the sanitising change handler or re-enable Redactor's native image UI
2338
+ // (the kit's ImageFloatingToolbar replaces both — see kitDefaults above).
2339
+ imageEditable: !1,
2340
+ imageResizable: !1,
2341
+ callbacks: {
2342
+ ...h,
2343
+ changed(z) {
2344
+ const W = Be(Kn(z)), Ee = oe(W);
2345
+ he.current = !0, Q.current && (fe.current && clearTimeout(fe.current), fe.current = setTimeout(() => {
2346
+ var ye;
2347
+ (ye = Q.current) == null || ye.call(Q, { html: Ee, markdown: "" });
2348
+ }, 100));
2349
+ },
2350
+ keydown(z) {
2351
+ var W;
2352
+ (W = Ne.current) == null || W.call(Ne, z);
2353
+ },
2354
+ observe() {
2355
+ J();
2356
+ }
2357
+ }
2358
+ };
2359
+ try {
2360
+ if (r(y, p), b)
2361
+ try {
2362
+ r(y, "enableReadOnly");
2363
+ } catch {
2364
+ }
2365
+ } catch {
2366
+ te(!0);
2367
+ }
2368
+ return () => {
2369
+ fe.current && clearTimeout(fe.current);
2370
+ try {
2371
+ r(y, "destroy");
2372
+ } catch {
2373
+ }
2374
+ G.current = null;
2375
+ };
2376
+ }, []), Z(() => {
2377
+ if (!G.current || g === void 0) return;
2378
+ if (he.current) {
2379
+ he.current = !1;
2380
+ return;
2381
+ }
2382
+ const t = oe(Be(g));
2383
+ Be(ae()) !== t && re("source.setCode", t);
2384
+ }, [g, ae, re]), Z(() => {
2385
+ ge.current = b;
2386
+ const t = G.current;
2387
+ if (t)
2388
+ try {
2389
+ t(y, b ? "enableReadOnly" : "disableReadOnly");
2390
+ } catch {
2391
+ }
2392
+ }, [b, y]), Z(() => {
2393
+ if (!j || g === void 0) return;
2394
+ const t = V.current;
2395
+ if (!t) return;
2396
+ const r = oe(g);
2397
+ t.value !== r && document.activeElement !== t && (t.value = r);
2398
+ }, [j, g]);
2399
+ const qe = st(
2400
+ () => ({
2401
+ getHTML() {
2402
+ return ae();
2403
+ },
2404
+ getText() {
2405
+ return ae().replace(/<[^>]*>/g, " ").replace(/&nbsp;/gi, " ").replace(/\s+/g, " ").trim();
2406
+ },
2407
+ getMarkdown() {
2408
+ return "";
2409
+ },
2410
+ setContent(t) {
2411
+ const r = oe(t);
2412
+ re("source.setCode", r) || V.current && (V.current.value = r);
2413
+ },
2414
+ insertAtCursor: se,
2415
+ applyFormat(t) {
2416
+ const r = Wn[t];
2417
+ r && ue(...r);
2418
+ },
2419
+ focus() {
2420
+ var r;
2421
+ const t = G.current;
2422
+ if (t)
2423
+ try {
2424
+ t(y, "editor.focus");
2425
+ return;
2426
+ } catch {
2427
+ }
2428
+ (r = V.current) == null || r.focus();
2429
+ },
2430
+ clear() {
2431
+ re("source.setCode", "") || V.current && (V.current.value = "");
2432
+ }
2433
+ }),
2434
+ [y, ae, re, se, ue]
2435
+ );
2436
+ Ot(X, () => qe, [qe]), Ft(hn, qe, o);
2437
+ const $t = k(
2438
+ (t) => {
2439
+ var r;
2440
+ (r = Q.current) == null || r.call(Q, {
2441
+ html: oe(t.target.value),
2442
+ markdown: ""
2443
+ });
2444
+ },
2445
+ []
2446
+ ), _e = u ?? R("editor.regionLabel"), Dt = d ?? R("editor.placeholder");
2447
+ Z(() => {
2448
+ var s;
2449
+ if (j) return;
2450
+ const t = (s = M.current) == null ? void 0 : s.querySelector(".redactor-in");
2451
+ if (!t) return;
2452
+ const r = () => {
2453
+ t.getAttribute("role") !== "textbox" && t.setAttribute("role", "textbox"), t.getAttribute("aria-multiline") !== "true" && t.setAttribute("aria-multiline", "true"), t.getAttribute("aria-label") !== _e && t.setAttribute("aria-label", _e), t.hasAttribute("aria-labelledby") && t.removeAttribute("aria-labelledby");
2454
+ };
2455
+ r();
2456
+ const n = new MutationObserver(r);
2457
+ return n.observe(t, {
2458
+ attributes: !0,
2459
+ attributeFilter: ["role", "aria-labelledby"]
2460
+ }), () => n.disconnect();
2461
+ }, [j, _e]);
2462
+ const je = ne !== null, me = [];
2463
+ return S && me.push({
2464
+ key: "dictate",
2465
+ icon: be ? /* @__PURE__ */ e(Se, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ e(ft, { "aria-hidden": "true", className: "ds:size-5" }),
2466
+ label: R(be ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
2467
+ onClick: Ht,
2468
+ recording: be
2469
+ }), Y && me.push({
2470
+ key: "proofread",
2471
+ // While running, the segment becomes a STOP/cancel button (progress is
2472
+ // shown by the scrim spinner).
2473
+ icon: ne === "proofread" ? /* @__PURE__ */ e(Se, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ e(Ur, { "aria-hidden": "true", className: "ds:size-5" }),
2474
+ label: ne === "proofread" ? R("common.cancel") : R("editor.ai.proofread", "Check spelling & grammar"),
2475
+ onClick: ne === "proofread" ? at : () => it("proofread", Y),
2476
+ running: ne === "proofread"
2477
+ }), H && me.push({
2478
+ key: "format",
2479
+ icon: ne === "format" ? /* @__PURE__ */ e(Se, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ e(dn, { "aria-hidden": "true", className: "ds:size-5" }),
2480
+ label: ne === "format" ? R("common.cancel") : R("editor.ai.autoFormat", "Auto-format document"),
2481
+ onClick: ne === "format" ? at : () => it("format", H),
2482
+ running: ne === "format"
2483
+ }), f && me.push({
2484
+ key: "write",
2485
+ icon: /* @__PURE__ */ e(tr, { "aria-hidden": "true", className: "ds:size-5" }),
2486
+ label: R("editor.ai.helpMeWrite"),
2487
+ onClick: () => {
2488
+ Ze(), Ue(!0);
2489
+ }
2490
+ }), /* @__PURE__ */ v(
2491
+ "div",
2492
+ {
2493
+ ref: M,
2494
+ className: [Qn(), E].filter(Boolean).join(" "),
2495
+ "data-component": "rich-text-editor",
2496
+ "data-component-id": o,
2497
+ "data-min-height": w,
2498
+ children: [
2499
+ !j && !b ? /* @__PURE__ */ e(
2500
+ Bn,
2501
+ {
2502
+ run: ue,
2503
+ active: Qe,
2504
+ preset: m,
2505
+ insertHtml: De,
2506
+ insertTable: Rt,
2507
+ saveSelection: Ze,
2508
+ restoreSelection: Ye,
2509
+ getSelectedText: Mt,
2510
+ uploadImage: l ? St : void 0,
2511
+ enableColor: (N == null ? void 0 : N.includes("fontcolor")) ?? !1,
2512
+ enableImage: !!l,
2513
+ enableTable: (N == null ? void 0 : N.includes("table")) ?? !1,
2514
+ showExtensions: C
2515
+ }
2516
+ ) : null,
2517
+ /* @__PURE__ */ v("div", { className: "ds:relative", ref: O, children: [
2518
+ /* @__PURE__ */ e(
2519
+ "textarea",
2520
+ {
2521
+ ref: V,
2522
+ id: P,
2523
+ "aria-label": _e,
2524
+ "aria-multiline": "true",
2525
+ "aria-busy": je || void 0,
2526
+ placeholder: Dt,
2527
+ onChange: j ? $t : void 0,
2528
+ readOnly: j ? b : void 0,
2529
+ className: j ? Zn() : void 0
2530
+ }
2531
+ ),
2532
+ je ? /* @__PURE__ */ e(
2533
+ "div",
2534
+ {
2535
+ "aria-hidden": "true",
2536
+ className: "ds:absolute ds:inset-0 ds:z-[5] ds:flex ds:items-center ds:justify-center ds:cursor-wait ds:rounded-[var(--radius-md)] ds:bg-[color-mix(in_srgb,var(--background)_40%,transparent)]",
2537
+ children: /* @__PURE__ */ e(gt, { size: "lg", variant: "prism" })
2538
+ }
2539
+ ) : null,
2540
+ /* @__PURE__ */ v("div", { className: "ds:sticky ds:bottom-0 ds:z-10", children: [
2541
+ me.length > 0 ? /* @__PURE__ */ e("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10 ds:flex ds:items-center ds:overflow-hidden ds:rounded-full ds:bg-[var(--primary)] ds:bg-[image:var(--gradient-brand)] ds:shadow-[0_8px_24px_color-mix(in_srgb,var(--primary)_35%,transparent)]", children: me.map((t, r) => /* @__PURE__ */ v(He, { children: [
2542
+ r > 0 ? /* @__PURE__ */ e(
2543
+ "span",
2544
+ {
2545
+ "aria-hidden": "true",
2546
+ className: "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[color-mix(in_srgb,var(--primary-foreground)_35%,transparent)]"
2547
+ }
2548
+ ) : null,
2549
+ /* @__PURE__ */ e(
2550
+ "button",
2551
+ {
2552
+ type: "button",
2553
+ onClick: t.onClick,
2554
+ "aria-pressed": t.recording || void 0,
2555
+ "aria-busy": t.running || void 0,
2556
+ disabled: je && !t.running || void 0,
2557
+ "aria-label": t.label,
2558
+ title: t.label,
2559
+ className: t.recording ? Jn : Yn,
2560
+ children: t.icon
2561
+ }
2562
+ )
2563
+ ] }, t.key)) }) : null,
2564
+ f ? /* @__PURE__ */ e(
2565
+ bn,
2566
+ {
2567
+ open: wt,
2568
+ onClose: () => Ue(!1),
2569
+ onRequestAiDraft: f,
2570
+ onInsert: (t) => {
2571
+ Ye(), se(t, { asHtml: A !== "text" });
2572
+ },
2573
+ previewAsHtml: A !== "text",
2574
+ privacyNotice: x,
2575
+ onDictate: S
2576
+ }
2577
+ ) : null
2578
+ ] }),
2579
+ !j && !b && ((N == null ? void 0 : N.includes("table")) ?? !1) ? /* @__PURE__ */ e(
2580
+ Sn,
2581
+ {
2582
+ active: Qe,
2583
+ run: ue,
2584
+ areaRef: O,
2585
+ getActiveTableEl: zt,
2586
+ enableColor: (N == null ? void 0 : N.includes("fontcolor")) ?? !1,
2587
+ saveTableCell: Tt,
2588
+ applyTableBackground: _t
2589
+ }
2590
+ ) : null,
2591
+ !j && !b ? /* @__PURE__ */ e(
2592
+ Fn,
2593
+ {
2594
+ areaRef: O,
2595
+ activeImageEl: xt,
2596
+ applyImageClass: Et,
2597
+ setImageWidth: At
2598
+ }
2599
+ ) : null
2600
+ ] }),
2601
+ S ? /* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Lt }) : null,
2602
+ S && It ? /* @__PURE__ */ e(
2603
+ "p",
2604
+ {
2605
+ role: "alert",
2606
+ className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
2607
+ children: R("editor.ai.dictationError")
2608
+ }
2609
+ ) : null
2610
+ ]
2611
+ }
2612
+ );
2613
+ }
2614
+ );
2615
+ eo.displayName = "RichTextEditor";
2616
+ export {
2617
+ eo as R,
2618
+ hn as r,
2619
+ Qn as w
2620
+ };
2621
+ //# sourceMappingURL=rich-text-editor-C8tyGjfb.js.map