@alfadocs/ui-kit 1.150.0 → 1.151.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 (261) hide show
  1. package/dist/_chunks/{address-autocomplete-_LeOFdM7.js → address-autocomplete-Bt1nwxyn.js} +2 -2
  2. package/dist/_chunks/{address-fields-C4khof4C.js → address-fields-COumFRSX.js} +2 -2
  3. package/dist/_chunks/{agenda-tray-NgxPuAAz.js → agenda-tray-CmfcYQhc.js} +2 -2
  4. package/dist/_chunks/{ai-summary-panel-D-RNe-_n.js → ai-summary-panel-DyAHCqaj.js} +2 -2
  5. package/dist/_chunks/{alia-sidebar-Bjuxk8mU.js → alia-sidebar-BqZjnVoF.js} +2 -2
  6. package/dist/_chunks/{anamnesis-card-G0qzw0Oi.js → anamnesis-card-CoiG7vDj.js} +2 -2
  7. package/dist/_chunks/{anamnesis-summary-rows-CE-i9j-s.js → anamnesis-summary-rows-CFpaA1GP.js} +3 -3
  8. package/dist/_chunks/{app-frame-DUPEwu4E.js → app-frame-XEjLsLGY.js} +2 -2
  9. package/dist/_chunks/{appointment-details-panel.history-BO31ZFQp.js → appointment-details-panel.history-FSsTXj1t.js} +84 -71
  10. package/dist/_chunks/{appointment-details-panel.identity-C9kWtC6m.js → appointment-details-panel.identity-9hRo85Lx.js} +4 -4
  11. package/dist/_chunks/appointment-peek-CmQM4wvx.js +223 -0
  12. package/dist/_chunks/{appointment-timeline-ynFqcw0S.js → appointment-timeline-COfoHpoJ.js} +2 -2
  13. package/dist/_chunks/{appointment-tray-Dx5VDREk.js → appointment-tray-BlKwDJKi.js} +2 -2
  14. package/dist/_chunks/{balance-badge-cell-DiyJQcmA.js → balance-badge-cell-OghXENKK.js} +3 -3
  15. package/dist/_chunks/{bill-line-table-B8Cc2pTH.js → bill-line-table-DxV5_Dmq.js} +2 -2
  16. package/dist/_chunks/{calendar-appointment-editor-dialog-BfoEpFVx.js → calendar-appointment-editor-dialog-BPAfWtm9.js} +337 -334
  17. package/dist/_chunks/{calendar-editor-discard-host-DO506cJu.js → calendar-editor-discard-host-BudLsUZO.js} +3 -3
  18. package/dist/_chunks/{calendar-waiting-list-panel-CyMTv2y3.js → calendar-waiting-list-panel-DukgSOPH.js} +7 -7
  19. package/dist/_chunks/{calendar-workspace.model-X3aXbDTo.js → calendar-workspace.model-BulUpy0I.js} +2 -2
  20. package/dist/_chunks/{calendar.sheets-C8x8kPb4.js → calendar.sheets-OmTiQdCg.js} +8 -8
  21. package/dist/_chunks/{calls-panel-Bpemmnpd.js → calls-panel-eohONLia.js} +3 -3
  22. package/dist/_chunks/code-BfU9G1ZM.js +15 -0
  23. package/dist/_chunks/{communications-panel-Cd0TBEhL.js → communications-panel-CqiFs8BH.js} +3 -3
  24. package/dist/_chunks/{connection-status-Bi6KPTlh.js → connection-status-C13KmOPL.js} +2 -2
  25. package/dist/_chunks/control-room-rail-BmpTKtL1.js +456 -0
  26. package/dist/_chunks/{data-grid-CkzbCZSo.js → data-grid-DTAwrOiq.js} +3 -3
  27. package/dist/_chunks/{data-table-DFAYYsSc.js → data-table-CgpHO6EZ.js} +2 -2
  28. package/dist/_chunks/{default-tabs-C45FVzsG.js → default-tabs-CZaDDf1G.js} +4 -4
  29. package/dist/_chunks/{description-list-DA4TgL_I.js → description-list-DaldSpGy.js} +29 -26
  30. package/dist/_chunks/dev-bypass-button-DFcNpCQj.js +24 -0
  31. package/dist/_chunks/{document-preview-Zws6CHhK.js → document-preview-TbwhY_eK.js} +3 -3
  32. package/dist/_chunks/{editable-currency-cell-renderer-DXJI0fnU.js → editable-currency-cell-renderer-a3CrwNKm.js} +143 -168
  33. package/dist/_chunks/{empty-state-5REM7oDM.js → empty-state-qHtpcasr.js} +65 -77
  34. package/dist/_chunks/{error-boundary-BQ5mRqEd.js → error-boundary-BDS1XStO.js} +2 -2
  35. package/dist/_chunks/{error-page-CdNGIezW.js → error-page-3gWV-Vmj.js} +2 -2
  36. package/dist/_chunks/{error-page-illustration-BdJLuMdV.js → error-page-illustration-CJCjLk_-.js} +125 -149
  37. package/dist/_chunks/{face-scheme-BC2whb1S.js → face-scheme-DRYGaszs.js} +255 -264
  38. package/dist/_chunks/{feature-preview-switch-PKeLaFry.js → feature-preview-switch-B_8JTya_.js} +2 -2
  39. package/dist/_chunks/{file-manager-DzOCQBAO.js → file-manager-DMvYx-Gq.js} +4 -4
  40. package/dist/_chunks/{folder-CH9PJHou.js → folder-DvNxod7_.js} +3 -3
  41. package/dist/_chunks/{heatmap-DvsZ-mcL.js → heatmap-BZNkPkDD.js} +4 -4
  42. package/dist/_chunks/{help-me-write-templates-B_wMJ82X.js → help-me-write-templates-VnvlK87x.js} +2 -2
  43. package/dist/_chunks/{info-tip-cCppV1fD.js → info-tip-DkVISvo-.js} +2 -2
  44. package/dist/_chunks/{invoice-upload-list-BReimsvV.js → invoice-upload-list-DutydbjC.js} +3 -3
  45. package/dist/_chunks/{link-cell-renderer-CWLArl5e.js → link-cell-renderer-DTunki79.js} +3 -3
  46. package/dist/_chunks/{login-dev-card-DqUNJcd7.js → login-dev-card-CQz9yhrU.js} +2 -2
  47. package/dist/_chunks/{map-view-n6GiDRWM.js → map-view-B67HXWPR.js} +2 -2
  48. package/dist/_chunks/mark-adrift-LBqHvZwv.js +42 -0
  49. package/dist/_chunks/{marketplace-app-shell-CGA-R-zt.js → marketplace-app-shell-CclaaAvb.js} +3 -3
  50. package/dist/_chunks/{message-tray-Dx2HPcKB.js → message-tray-DysT-DPS.js} +2 -2
  51. package/dist/_chunks/{note-timeline-BbjHMhkL.js → note-timeline-CS5j2OKD.js} +86 -77
  52. package/dist/_chunks/notebook-text-spVSekMN.js +21 -0
  53. package/dist/_chunks/{notes-panel-BguRX8VC.js → notes-panel-d0I3hOEY.js} +162 -173
  54. package/dist/_chunks/{notification-tray-BnC5OItw.js → notification-tray-CjGDlwLg.js} +2 -2
  55. package/dist/_chunks/{optical-prescription-BzGnlIjq.js → optical-prescription-CAnXavjq.js} +2 -2
  56. package/dist/_chunks/panel-right-CnMHSvLU.js +15 -0
  57. package/dist/_chunks/{panel-subview-Om_yZvFG.js → panel-subview-B5hnQwfQ.js} +2 -2
  58. package/dist/_chunks/{patient-account-settings-YKnBzmwE.js → patient-account-settings-DQx_9CYV.js} +3 -3
  59. package/dist/_chunks/{patient-check-in-resume-DERfQbp5.js → patient-check-in-resume-BOHcm9hT.js} +5 -5
  60. package/dist/_chunks/{patient-details-BUD0UbmT.js → patient-details-wFIzTz7N.js} +3 -3
  61. package/dist/_chunks/{patient-field-row-DytaHdGw.js → patient-field-row-BDgfYLgz.js} +2 -2
  62. package/dist/_chunks/{patient-summary-card-7Werxl48.js → patient-summary-card-ZunOre3Q.js} +162 -155
  63. package/dist/_chunks/{payment-request-card-BF3rakTQ.js → payment-request-card-BSSfKrcc.js} +2 -2
  64. package/dist/_chunks/{portal-details-C1QQGPQf.js → portal-details-R-lwrisO.js} +4 -4
  65. package/dist/_chunks/{portal-documents-CzEuCaqv.js → portal-documents-C6XlWpEl.js} +3 -3
  66. package/dist/_chunks/{portal-parts-BMW4t57s.js → portal-parts-DlvSUZFX.js} +2 -2
  67. package/dist/_chunks/{practice-results-D0TAgL8v.js → practice-results-CqoB5YAv.js} +5 -5
  68. package/dist/_chunks/{prescription-history-CQuJmd4H.js → prescription-history-CxBM3gnm.js} +4 -4
  69. package/dist/_chunks/{privacy-mask-CrjD5PYW.js → privacy-mask-CaLBAxzj.js} +2 -2
  70. package/dist/_chunks/{product-hub-panel-NVpRuJeW.js → product-hub-panel-RJzrDcGp.js} +3 -3
  71. package/dist/_chunks/{public-header.agent-Dzo6ujrE.js → public-header.agent-B2CqVq4s.js} +2 -2
  72. package/dist/_chunks/{radiograph-panel.agent-Kl1M0dtT.js → radiograph-panel.agent-kgCmmgZk.js} +2 -2
  73. package/dist/_chunks/{registration-form-AtRCt8n5.js → registration-form-Dbe1sFZb.js} +2 -2
  74. package/dist/_chunks/{registry-connection-panel-kdKbGQE6.js → registry-connection-panel-BkPPA3Fj.js} +3 -3
  75. package/dist/_chunks/{reserved.agent-CW0frsMv.js → reserved.agent-C-sMq0pb.js} +4 -4
  76. package/dist/_chunks/{reviews-panel-54AFY6uy.js → reviews-panel-jIz5aP2X.js} +3 -3
  77. package/dist/_chunks/rich-text-editor-DTadvKa7.js +4716 -0
  78. package/dist/_chunks/{scroll-area-CY5SLYNw.js → scroll-area-RQtcKkHf.js} +84 -79
  79. package/dist/_chunks/{sheet-CZDjW9Q-.js → sheet-1LXzej6Q.js} +2 -2
  80. package/dist/_chunks/{sidebar-D5DFYN5K.js → sidebar-BV9JCgS4.js} +2 -2
  81. package/dist/_chunks/{signed-out-frame-CC25CgKo.js → signed-out-frame-CKA8SSbU.js} +2 -2
  82. package/dist/_chunks/{signing-end-screen-Bq6tkFE6.js → signing-end-screen-HXkalppf.js} +2 -2
  83. package/dist/_chunks/{slot-grid-khIpy8Gx.js → slot-grid-DdqeF6PW.js} +2 -2
  84. package/dist/_chunks/{sync-tray-BQD-HuA4.js → sync-tray-CSVGzuur.js} +2 -2
  85. package/dist/_chunks/{task-editor-CIHQQRtP.js → task-editor-aXjGMwYA.js} +4 -4
  86. package/dist/_chunks/{task-tray-CxxcGGgx.js → task-tray-C48Vq8nt.js} +2 -2
  87. package/dist/_chunks/{tasks-panel-Bc_odkQN.js → tasks-panel-BdxHb-fX.js} +2 -2
  88. package/dist/_chunks/{tool-rail-CJBtqzMs.js → tool-rail-B4p6MmxA.js} +253 -250
  89. package/dist/_chunks/{toolbar-B9oh9XY9.js → toolbar-B2JJ_XDT.js} +2 -2
  90. package/dist/_chunks/tooth-chip-DOv925IH.js +41 -0
  91. package/dist/_chunks/{treatment-receipt-B6m47Jie.js → treatment-receipt-CZQV1NkJ.js} +45 -46
  92. package/dist/_chunks/{use-appointment-details-read-HVHbR0Zl.js → use-appointment-details-read-BR3TQOHx.js} +878 -809
  93. package/dist/_chunks/user-round-DZxRG9zq.js +15 -0
  94. package/dist/_chunks/{week-availability-D0tTll4q.js → week-availability-D00rMjsX.js} +2 -2
  95. package/dist/_chunks/{workflow-map-F7OThorL.js → workflow-map-DLUTUZ27.js} +2 -2
  96. package/dist/agent-catalog.json +1 -1
  97. package/dist/appointment-editor-panel/index.js +3 -3
  98. package/dist/booking-tools-data/index.js +1 -1
  99. package/dist/browser-support.js +1 -1
  100. package/dist/calendar-action-buttons/index.js +1 -1
  101. package/dist/components/_shared/mark-adrift.d.ts +12 -0
  102. package/dist/components/_shared/safe-html.d.ts +6 -0
  103. package/dist/components/_shared/tooth-chip.d.ts +21 -0
  104. package/dist/components/address-autocomplete/index.js +1 -1
  105. package/dist/components/address-fields/index.js +1 -1
  106. package/dist/components/agenda-tray/index.js +1 -1
  107. package/dist/components/ai-summary-panel/index.js +1 -1
  108. package/dist/components/anamnesis-card/index.js +1 -1
  109. package/dist/components/app-frame/index.js +1 -1
  110. package/dist/components/appointment-card/index.js +1 -1
  111. package/dist/components/appointment-details-panel/appointment-details-panel.d.ts +9 -2
  112. package/dist/components/appointment-details-panel/appointment-details-panel.types.d.ts +9 -2
  113. package/dist/components/appointment-details-panel/description-length.d.ts +18 -0
  114. package/dist/components/appointment-details-panel/index.d.ts +1 -0
  115. package/dist/components/appointment-details-panel/index.js +7 -6
  116. package/dist/components/appointment-peek/index.js +1 -1
  117. package/dist/components/appointment-timeline/index.js +1 -1
  118. package/dist/components/bill-line-table/index.js +1 -1
  119. package/dist/components/bill-table/index.js +1 -1
  120. package/dist/components/booking/index.js +1 -1
  121. package/dist/components/calls-panel/index.js +1 -1
  122. package/dist/components/communications-panel/index.js +1 -1
  123. package/dist/components/connection-status/index.js +1 -1
  124. package/dist/components/control-room-rail/control-room-rail.d.ts +24 -0
  125. package/dist/components/control-room-rail/index.js +1 -1
  126. package/dist/components/data-grid/index.js +2 -2
  127. package/dist/components/data-table/index.js +3 -3
  128. package/dist/components/description-list/index.js +1 -1
  129. package/dist/components/dev-bypass-button/index.js +1 -1
  130. package/dist/components/document-preview/index.js +1 -1
  131. package/dist/components/empty-state/index.js +1 -1
  132. package/dist/components/error-boundary/index.js +1 -1
  133. package/dist/components/face-scheme/index.js +1 -1
  134. package/dist/components/feature-preview-switch/index.js +1 -1
  135. package/dist/components/file-manager/index.js +1 -1
  136. package/dist/components/heatmap/index.js +1 -1
  137. package/dist/components/info-tip/index.js +1 -1
  138. package/dist/components/invoice-upload-list/index.js +1 -1
  139. package/dist/components/map-view/index.js +1 -1
  140. package/dist/components/message-tray/index.js +1 -1
  141. package/dist/components/note-timeline/index.js +1 -1
  142. package/dist/components/note-timeline/note-timeline.d.ts +8 -0
  143. package/dist/components/notes-panel/index.js +1 -1
  144. package/dist/components/notes-panel/notes-panel.d.ts +18 -7
  145. package/dist/components/notification-tray/index.js +1 -1
  146. package/dist/components/optical-prescription/index.js +1 -1
  147. package/dist/components/panel-subview/index.js +1 -1
  148. package/dist/components/patient-details/index.js +1 -1
  149. package/dist/components/patient-summary-card/index.js +1 -1
  150. package/dist/components/patient-table/index.js +1 -1
  151. package/dist/components/payment-card/index.js +1 -1
  152. package/dist/components/practice-results/index.js +1 -1
  153. package/dist/components/product-hub-tray/index.js +1 -1
  154. package/dist/components/public-header/index.js +1 -1
  155. package/dist/components/radiograph-panel/index.js +1 -1
  156. package/dist/components/registry-connection-panel/index.js +1 -1
  157. package/dist/components/reviews-panel/index.js +1 -1
  158. package/dist/components/rich-text-editor/editor-toolbar.d.ts +16 -6
  159. package/dist/components/rich-text-editor/index.d.ts +1 -1
  160. package/dist/components/rich-text-editor/index.js +1 -1
  161. package/dist/components/rich-text-editor/link-bar.d.ts +8 -0
  162. package/dist/components/rich-text-editor/rich-text-editor.d.ts +25 -3
  163. package/dist/components/scroll-area/index.js +1 -1
  164. package/dist/components/scroll-area/scroll-area.d.ts +6 -0
  165. package/dist/components/sheet/index.js +1 -1
  166. package/dist/components/sidebar/index.js +1 -1
  167. package/dist/components/slot-grid/index.js +1 -1
  168. package/dist/components/sync-tray/index.js +1 -1
  169. package/dist/components/task-editor/index.js +1 -1
  170. package/dist/components/task-tray/index.js +1 -1
  171. package/dist/components/tasks-panel/index.js +1 -1
  172. package/dist/components/tool-rail/index.js +1 -1
  173. package/dist/components/tool-rail/tool-rail.d.ts +11 -0
  174. package/dist/components/treatment-receipt/index.js +1 -1
  175. package/dist/components/treatment-receipt/treatment-receipt.d.ts +6 -1
  176. package/dist/components/week-availability/index.js +1 -1
  177. package/dist/components/workflow/index.js +1 -1
  178. package/dist/core.css +1 -1
  179. package/dist/find-free-slots-panel/index.js +1 -1
  180. package/dist/host-compat.css +4 -1
  181. package/dist/host-legacy.css +13 -1
  182. package/dist/i18n/locales/ar.d.ts +9 -0
  183. package/dist/i18n/locales/ar.js +11 -2
  184. package/dist/i18n/locales/de.d.ts +9 -0
  185. package/dist/i18n/locales/de.js +11 -2
  186. package/dist/i18n/locales/el.d.ts +9 -0
  187. package/dist/i18n/locales/el.js +11 -2
  188. package/dist/i18n/locales/en.d.ts +9 -0
  189. package/dist/i18n/locales/en.js +10 -1
  190. package/dist/i18n/locales/es.d.ts +9 -0
  191. package/dist/i18n/locales/es.js +11 -2
  192. package/dist/i18n/locales/fr.d.ts +9 -0
  193. package/dist/i18n/locales/fr.js +11 -2
  194. package/dist/i18n/locales/hi.d.ts +9 -0
  195. package/dist/i18n/locales/hi.js +11 -2
  196. package/dist/i18n/locales/it.d.ts +9 -0
  197. package/dist/i18n/locales/it.js +11 -2
  198. package/dist/i18n/locales/ja.d.ts +9 -0
  199. package/dist/i18n/locales/ja.js +11 -2
  200. package/dist/i18n/locales/nl.d.ts +9 -0
  201. package/dist/i18n/locales/nl.js +11 -2
  202. package/dist/i18n/locales/pl.d.ts +9 -0
  203. package/dist/i18n/locales/pl.js +11 -2
  204. package/dist/i18n/locales/pt.d.ts +9 -0
  205. package/dist/i18n/locales/pt.js +11 -2
  206. package/dist/i18n/locales/ro.d.ts +9 -0
  207. package/dist/i18n/locales/ro.js +11 -2
  208. package/dist/i18n/locales/ru.d.ts +9 -0
  209. package/dist/i18n/locales/ru.js +11 -2
  210. package/dist/i18n/locales/sq.d.ts +9 -0
  211. package/dist/i18n/locales/sq.js +11 -2
  212. package/dist/i18n/locales/sv.d.ts +9 -0
  213. package/dist/i18n/locales/sv.js +11 -2
  214. package/dist/i18n/locales/tr.d.ts +9 -0
  215. package/dist/i18n/locales/tr.js +11 -2
  216. package/dist/i18n/locales/zh.d.ts +9 -0
  217. package/dist/i18n/locales/zh.js +11 -2
  218. package/dist/index.js +817 -816
  219. package/dist/locales/ar.json +11 -2
  220. package/dist/locales/de.json +11 -2
  221. package/dist/locales/el.json +11 -2
  222. package/dist/locales/en.json +10 -1
  223. package/dist/locales/es.json +11 -2
  224. package/dist/locales/fr.json +11 -2
  225. package/dist/locales/hi.json +11 -2
  226. package/dist/locales/it.json +11 -2
  227. package/dist/locales/ja.json +11 -2
  228. package/dist/locales/nl.json +11 -2
  229. package/dist/locales/pl.json +11 -2
  230. package/dist/locales/pt.json +11 -2
  231. package/dist/locales/ro.json +11 -2
  232. package/dist/locales/ru.json +11 -2
  233. package/dist/locales/sq.json +11 -2
  234. package/dist/locales/sv.json +11 -2
  235. package/dist/locales/tr.json +11 -2
  236. package/dist/locales/zh.json +11 -2
  237. package/dist/online-bookings-panel/index.js +2 -2
  238. package/dist/patterns/alia-assistant/index.js +1 -1
  239. package/dist/patterns/anamnesis/index.js +1 -1
  240. package/dist/patterns/calendar/index.js +4 -4
  241. package/dist/patterns/error-page/index.js +2 -2
  242. package/dist/patterns/help-me-write-templates/index.js +1 -1
  243. package/dist/patterns/login-form/index.js +1 -1
  244. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  245. package/dist/patterns/patient-account-settings/index.js +1 -1
  246. package/dist/patterns/patient-check-in/index.js +1 -1
  247. package/dist/patterns/patient-portal/index.js +2 -2
  248. package/dist/patterns/prescription/index.js +1 -1
  249. package/dist/patterns/registration-form/index.js +1 -1
  250. package/dist/patterns/signed-out-frame/index.js +1 -1
  251. package/dist/patterns/signing/index.js +1 -1
  252. package/dist/redactor.css +9 -0
  253. package/dist/safe-html/index.js +33 -19
  254. package/dist/tokens.css +61 -52
  255. package/dist/waiting-list-panel/index.js +3 -3
  256. package/package.json +1 -1
  257. package/dist/_chunks/appointment-peek-CGJ6kUvM.js +0 -213
  258. package/dist/_chunks/control-room-rail-4W1MFY-g.js +0 -416
  259. package/dist/_chunks/dev-bypass-button-BzfYGPuf.js +0 -33
  260. package/dist/_chunks/rich-text-editor-DCQEpaIv.js +0 -4523
  261. /package/dist/{patterns → components}/_shared/mark-pieces.d.ts +0 -0
@@ -1,4523 +0,0 @@
1
- import { jsx as t, jsxs as C, Fragment as je } from "react/jsx-runtime";
2
- import { useId as Ve, useState as T, useRef as x, useEffect as I, useCallback as A, Fragment as Ct, useLayoutEffect as ci, forwardRef as di, useMemo as yt, useImperativeHandle as ui } from "react";
3
- import { c as At } from "./index-D2ZczOXr.js";
4
- import { useTranslation as ie } from "react-i18next";
5
- import { SafeHtml as mi, sanitiseHtml as fi } from "../safe-html/index.js";
6
- import { a as hi, c as gi, d as pi, b as so } from "./ai-fab-pill-BOu96kCx.js";
7
- import { u as bi } from "./registry-DvAUVLHh.js";
8
- import { u as vi } from "./use-ai-sparkle-Cf4yVTLB.js";
9
- import { S as Yn } from "./spinner-CoflYlEx.js";
10
- import { A as yi } from "./ai-sparkle-D23NT8Z_.js";
11
- import { B as ze } from "./button-Dp4j9ygh.js";
12
- import { I as Z } from "./icon-button-u9VMQn3x.js";
13
- import { A as wi } from "./ai-permission-notice-C_YB3MBA.js";
14
- import { T as ki } from "./text-area-DbxGkpzE.js";
15
- import { E as Gn } from "./editor-overlay-jc9HUeQ2.js";
16
- import { A as xi } from "./ai-credits-exhausted-notice-DCq27xy2.js";
17
- import { u as Ci } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
18
- import { X as Ai } from "./x-B5YnXwCz.js";
19
- import { R as Ni } from "./rotate-ccw-BBQnIVTr.js";
20
- import { C as Ti } from "./check-DrFSN__t.js";
21
- import { L as Kn } from "./loader-circle-BECIU_8N.js";
22
- import { S as Ht } from "./square-DASBRZ0U.js";
23
- import { M as Vn } from "./mic-CUklMZGF.js";
24
- import { S as Ei } from "./send-C5kDJ-Mz.js";
25
- import { D as G } from "./dropdown-menu-Bm1KALnk.js";
26
- import * as ln from "@radix-ui/react-popover";
27
- import { u as Mi, f as Ri } from "./non-modal-tab-exit-DqJao_E-.js";
28
- import { V as lo } from "./variables-menu-C4NcClKi.js";
29
- import { a as er } from "./tooltip-uEBdD1-5.js";
30
- import { P as le } from "./popover-C9O7my6h.js";
31
- import { D as me } from "./dialog-239Geb7Z.js";
32
- import { C as tr } from "./color-picker-5FKOk_z1.js";
33
- import { S as fn } from "./state-backed-text-input-DVETOhSS.js";
34
- import { C as Si } from "./checkbox-DV4sNDeB.js";
35
- import { F as zi } from "./file-upload-DQc0LsBM.js";
36
- import { c as O } from "./createLucideIcon-DhHxpK9K.js";
37
- import { E as Li } from "./ellipsis-dRo9ouSU.js";
38
- import { H as _i } from "./highlighter-DSkckT2Q.js";
39
- import { C as nr } from "./chevron-down-DWE7GSq9.js";
40
- import { I as Ii } from "./image-B_5MNK0x.js";
41
- import { P as Hi } from "./plus-DzMQ_c6b.js";
42
- import { S as $i } from "./settings-d25ju_6L.js";
43
- import { M as Oi } from "./minus-BQDHq1c1.js";
44
- import { U as Di } from "./undo-2-EBxWjj1W.js";
45
- import { T as Pi } from "./trash-2-uumy3fy1.js";
46
- import { u as qi, w as wt } from "./ai-credits-notice-B6buIgmV.js";
47
- /**
48
- * @license lucide-react v1.22.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */
53
- const Bi = [
54
- ["path", { d: "m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16", key: "xik6mr" }],
55
- ["path", { d: "M15.697 14h5.606", key: "1stdlc" }],
56
- ["path", { d: "m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16", key: "d5nyq2" }],
57
- ["path", { d: "M3.304 13h6.392", key: "1q3zxz" }]
58
- ], Fi = O("a-large-small", Bi);
59
- /**
60
- * @license lucide-react v1.22.0 - ISC
61
- *
62
- * This source code is licensed under the ISC license.
63
- * See the LICENSE file in the root directory of this source tree.
64
- */
65
- const ji = [
66
- ["path", { d: "M4 20h16", key: "14thso" }],
67
- ["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
68
- ["path", { d: "M8 12h8", key: "1wcyev" }]
69
- ], Gi = O("baseline", ji);
70
- /**
71
- * @license lucide-react v1.22.0 - ISC
72
- *
73
- * This source code is licensed under the ISC license.
74
- * See the LICENSE file in the root directory of this source tree.
75
- */
76
- const Ki = [
77
- ["rect", { width: "13", height: "7", x: "3", y: "3", rx: "1", key: "11xb64" }],
78
- ["path", { d: "m22 15-3-3 3-3", key: "26chmm" }],
79
- ["rect", { width: "13", height: "7", x: "3", y: "14", rx: "1", key: "k6ky7n" }]
80
- ], Vi = O("between-horizontal-end", Ki);
81
- /**
82
- * @license lucide-react v1.22.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */
87
- const Wi = [
88
- ["rect", { width: "13", height: "7", x: "8", y: "3", rx: "1", key: "pkso9a" }],
89
- ["path", { d: "m2 9 3 3-3 3", key: "1agib5" }],
90
- ["rect", { width: "13", height: "7", x: "8", y: "14", rx: "1", key: "1q5fc1" }]
91
- ], Xi = O("between-horizontal-start", Wi);
92
- /**
93
- * @license lucide-react v1.22.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */
98
- const Ui = [
99
- ["rect", { width: "7", height: "13", x: "3", y: "3", rx: "1", key: "1fdu0f" }],
100
- ["path", { d: "m9 22 3-3 3 3", key: "17z65a" }],
101
- ["rect", { width: "7", height: "13", x: "14", y: "3", rx: "1", key: "1squn4" }]
102
- ], Zi = O("between-vertical-end", Ui);
103
- /**
104
- * @license lucide-react v1.22.0 - ISC
105
- *
106
- * This source code is licensed under the ISC license.
107
- * See the LICENSE file in the root directory of this source tree.
108
- */
109
- const Qi = [
110
- ["rect", { width: "7", height: "13", x: "3", y: "8", rx: "1", key: "1fjrkv" }],
111
- ["path", { d: "m15 2-3 3-3-3", key: "1uh6eb" }],
112
- ["rect", { width: "7", height: "13", x: "14", y: "8", rx: "1", key: "w3fjg8" }]
113
- ], Ji = O("between-vertical-start", Qi);
114
- /**
115
- * @license lucide-react v1.22.0 - ISC
116
- *
117
- * This source code is licensed under the ISC license.
118
- * See the LICENSE file in the root directory of this source tree.
119
- */
120
- const Yi = [
121
- [
122
- "path",
123
- {
124
- d: "M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",
125
- key: "1ah6g2"
126
- }
127
- ],
128
- ["rect", { x: "14", y: "2", width: "8", height: "8", rx: "1", key: "88lufb" }]
129
- ], Wn = O("blocks", Yi);
130
- /**
131
- * @license lucide-react v1.22.0 - ISC
132
- *
133
- * This source code is licensed under the ISC license.
134
- * See the LICENSE file in the root directory of this source tree.
135
- */
136
- const ea = [
137
- [
138
- "path",
139
- { 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" }
140
- ]
141
- ], ta = O("bold", ea);
142
- /**
143
- * @license lucide-react v1.22.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */
148
- const na = [
149
- [
150
- "path",
151
- { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1", key: "ezmyqa" }
152
- ],
153
- [
154
- "path",
155
- {
156
- d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",
157
- key: "e1hn23"
158
- }
159
- ]
160
- ], ra = O("braces", na);
161
- /**
162
- * @license lucide-react v1.22.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */
167
- const oa = [
168
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
169
- ["path", { d: "M12 3v18", key: "108xh3" }]
170
- ], ia = O("columns-2", oa);
171
- /**
172
- * @license lucide-react v1.22.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */
177
- const aa = [
178
- ["path", { d: "M4 12h8", key: "17cfdx" }],
179
- ["path", { d: "M4 18V6", key: "1rz3zl" }],
180
- ["path", { d: "M12 18V6", key: "zqpxq5" }],
181
- ["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
182
- ], sa = O("heading-2", aa);
183
- /**
184
- * @license lucide-react v1.22.0 - ISC
185
- *
186
- * This source code is licensed under the ISC license.
187
- * See the LICENSE file in the root directory of this source tree.
188
- */
189
- const la = [
190
- ["path", { d: "M4 12h8", key: "17cfdx" }],
191
- ["path", { d: "M4 18V6", key: "1rz3zl" }],
192
- ["path", { d: "M12 18V6", key: "zqpxq5" }],
193
- ["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
194
- ["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
195
- ], ca = O("heading-3", la);
196
- /**
197
- * @license lucide-react v1.22.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */
202
- const da = [
203
- ["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
204
- ["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
205
- ["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
206
- ], ua = O("italic", da);
207
- /**
208
- * @license lucide-react v1.22.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */
213
- const ma = [
214
- ["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" }],
215
- ["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" }]
216
- ], fa = O("link", ma);
217
- /**
218
- * @license lucide-react v1.22.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */
223
- const ha = [
224
- ["path", { d: "M21 5H11", key: "us1j55" }],
225
- ["path", { d: "M21 12H11", key: "wd7e0v" }],
226
- ["path", { d: "M21 19H11", key: "saa85w" }],
227
- ["path", { d: "m7 8-4 4 4 4", key: "o5hrat" }]
228
- ], ga = O("list-indent-decrease", ha);
229
- /**
230
- * @license lucide-react v1.22.0 - ISC
231
- *
232
- * This source code is licensed under the ISC license.
233
- * See the LICENSE file in the root directory of this source tree.
234
- */
235
- const pa = [
236
- ["path", { d: "M21 5H11", key: "us1j55" }],
237
- ["path", { d: "M21 12H11", key: "wd7e0v" }],
238
- ["path", { d: "M21 19H11", key: "saa85w" }],
239
- ["path", { d: "m3 8 4 4-4 4", key: "1a3j6y" }]
240
- ], ba = O("list-indent-increase", pa);
241
- /**
242
- * @license lucide-react v1.22.0 - ISC
243
- *
244
- * This source code is licensed under the ISC license.
245
- * See the LICENSE file in the root directory of this source tree.
246
- */
247
- const va = [
248
- ["path", { d: "M11 5h10", key: "1cz7ny" }],
249
- ["path", { d: "M11 12h10", key: "1438ji" }],
250
- ["path", { d: "M11 19h10", key: "11t30w" }],
251
- ["path", { d: "M4 4h1v5", key: "10yrso" }],
252
- ["path", { d: "M4 9h2", key: "r1h2o0" }],
253
- ["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" }]
254
- ], ya = O("list-ordered", va);
255
- /**
256
- * @license lucide-react v1.22.0 - ISC
257
- *
258
- * This source code is licensed under the ISC license.
259
- * See the LICENSE file in the root directory of this source tree.
260
- */
261
- const wa = [
262
- ["path", { d: "M3 5h.01", key: "18ugdj" }],
263
- ["path", { d: "M3 12h.01", key: "nlz23k" }],
264
- ["path", { d: "M3 19h.01", key: "noohij" }],
265
- ["path", { d: "M8 5h13", key: "1pao27" }],
266
- ["path", { d: "M8 12h13", key: "1za7za" }],
267
- ["path", { d: "M8 19h13", key: "m83p4d" }]
268
- ], ka = O("list", wa);
269
- /**
270
- * @license lucide-react v1.22.0 - ISC
271
- *
272
- * This source code is licensed under the ISC license.
273
- * See the LICENSE file in the root directory of this source tree.
274
- */
275
- const xa = [
276
- ["path", { d: "M11 7 6 2", key: "1jwth8" }],
277
- ["path", { d: "M18.992 12H2.041", key: "xw1gg" }],
278
- [
279
- "path",
280
- {
281
- 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",
282
- key: "1nkol4"
283
- }
284
- ],
285
- [
286
- "path",
287
- {
288
- 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",
289
- key: "1nk1rd"
290
- }
291
- ]
292
- ], Ca = O("paint-bucket", xa);
293
- /**
294
- * @license lucide-react v1.22.0 - ISC
295
- *
296
- * This source code is licensed under the ISC license.
297
- * See the LICENSE file in the root directory of this source tree.
298
- */
299
- const Aa = [
300
- ["rect", { width: "16", height: "6", x: "2", y: "2", rx: "2", key: "jcyz7m" }],
301
- ["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" }],
302
- ["rect", { width: "4", height: "6", x: "8", y: "16", rx: "1", key: "d6e7yl" }]
303
- ], Na = O("paint-roller", Aa);
304
- /**
305
- * @license lucide-react v1.22.0 - ISC
306
- *
307
- * This source code is licensed under the ISC license.
308
- * See the LICENSE file in the root directory of this source tree.
309
- */
310
- const Ta = [
311
- [
312
- "path",
313
- {
314
- 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",
315
- key: "e79jfc"
316
- }
317
- ],
318
- ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
319
- ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
320
- ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
321
- ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
322
- ], Ea = O("palette", Ta);
323
- /**
324
- * @license lucide-react v1.22.0 - ISC
325
- *
326
- * This source code is licensed under the ISC license.
327
- * See the LICENSE file in the root directory of this source tree.
328
- */
329
- const Ma = [
330
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
331
- ["path", { d: "M9 3v18", key: "fh3hqa" }]
332
- ], Ra = O("panel-left", Ma);
333
- /**
334
- * @license lucide-react v1.22.0 - ISC
335
- *
336
- * This source code is licensed under the ISC license.
337
- * See the LICENSE file in the root directory of this source tree.
338
- */
339
- const Sa = [
340
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
341
- ["path", { d: "M15 3v18", key: "14nvp0" }]
342
- ], za = O("panel-right", Sa);
343
- /**
344
- * @license lucide-react v1.22.0 - ISC
345
- *
346
- * This source code is licensed under the ISC license.
347
- * See the LICENSE file in the root directory of this source tree.
348
- */
349
- const La = [
350
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
351
- ["path", { d: "M14 9h1", key: "l0svgy" }],
352
- ["path", { d: "M19 9h2", key: "te2zfg" }],
353
- ["path", { d: "M3 9h2", key: "1h4ldw" }],
354
- ["path", { d: "M9 9h1", key: "15jzuz" }]
355
- ], _a = O("panel-top-dashed", La);
356
- /**
357
- * @license lucide-react v1.22.0 - ISC
358
- *
359
- * This source code is licensed under the ISC license.
360
- * See the LICENSE file in the root directory of this source tree.
361
- */
362
- const Ia = [
363
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
364
- ["path", { d: "M3 9h18", key: "1pudct" }]
365
- ], Ha = O("panel-top", Ia);
366
- /**
367
- * @license lucide-react v1.22.0 - ISC
368
- *
369
- * This source code is licensed under the ISC license.
370
- * See the LICENSE file in the root directory of this source tree.
371
- */
372
- const $a = [
373
- ["path", { d: "M10 3H8", key: "mzdi2d" }],
374
- ["path", { d: "m15.007 5.008 3.987 3.986", key: "1scubj" }],
375
- ["path", { d: "M20 15v4", key: "nmhudv" }],
376
- [
377
- "path",
378
- {
379
- d: "M21.174 6.813a2.82 2.82 0 0 0-3.986-3.987L3.842 16.175a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
380
- key: "fs0856"
381
- }
382
- ],
383
- ["path", { d: "M22 17h-4", key: "1sj068" }],
384
- ["path", { d: "M4 5v4", key: "13jjxc" }],
385
- ["path", { d: "M6 7H2", key: "8zbtv0" }],
386
- ["path", { d: "M9 2v2", key: "165o2o" }]
387
- ], Gr = O("pencil-sparkles", $a);
388
- /**
389
- * @license lucide-react v1.22.0 - ISC
390
- *
391
- * This source code is licensed under the ISC license.
392
- * See the LICENSE file in the root directory of this source tree.
393
- */
394
- const Oa = [
395
- ["path", { d: "M13 4v16", key: "8vvj80" }],
396
- ["path", { d: "M17 4v16", key: "7dpous" }],
397
- ["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
398
- ], Da = O("pilcrow", Oa);
399
- /**
400
- * @license lucide-react v1.22.0 - ISC
401
- *
402
- * This source code is licensed under the ISC license.
403
- * See the LICENSE file in the root directory of this source tree.
404
- */
405
- const Pa = [
406
- [
407
- "path",
408
- {
409
- 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",
410
- key: "rib7q0"
411
- }
412
- ],
413
- [
414
- "path",
415
- {
416
- 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",
417
- key: "1ymkrd"
418
- }
419
- ]
420
- ], qa = O("quote", Pa);
421
- /**
422
- * @license lucide-react v1.22.0 - ISC
423
- *
424
- * This source code is licensed under the ISC license.
425
- * See the LICENSE file in the root directory of this source tree.
426
- */
427
- const Ba = [
428
- ["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
429
- ["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
430
- ], Fa = O("redo-2", Ba);
431
- /**
432
- * @license lucide-react v1.22.0 - ISC
433
- *
434
- * This source code is licensed under the ISC license.
435
- * See the LICENSE file in the root directory of this source tree.
436
- */
437
- const ja = [
438
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
439
- ["path", { d: "M3 12h18", key: "1i2n21" }]
440
- ], Ga = O("rows-2", ja);
441
- /**
442
- * @license lucide-react v1.22.0 - ISC
443
- *
444
- * This source code is licensed under the ISC license.
445
- * See the LICENSE file in the root directory of this source tree.
446
- */
447
- const Ka = [
448
- ["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
449
- ["path", { d: "M8 12h8", key: "1wcyev" }],
450
- ["path", { d: "m16 20 2 2 4-4", key: "13tcca" }]
451
- ], Kr = O("spell-check", Ka);
452
- /**
453
- * @license lucide-react v1.22.0 - ISC
454
- *
455
- * This source code is licensed under the ISC license.
456
- * See the LICENSE file in the root directory of this source tree.
457
- */
458
- const Va = [
459
- ["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
460
- ["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
461
- ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
462
- ], Wa = O("strikethrough", Va);
463
- /**
464
- * @license lucide-react v1.22.0 - ISC
465
- *
466
- * This source code is licensed under the ISC license.
467
- * See the LICENSE file in the root directory of this source tree.
468
- */
469
- const Xa = [
470
- ["path", { d: "M12 3v18", key: "108xh3" }],
471
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
472
- ["path", { d: "M3 9h18", key: "1pudct" }],
473
- ["path", { d: "M3 15h18", key: "5xshup" }]
474
- ], Ua = O("table", Xa);
475
- /**
476
- * @license lucide-react v1.22.0 - ISC
477
- *
478
- * This source code is licensed under the ISC license.
479
- * See the LICENSE file in the root directory of this source tree.
480
- */
481
- const Za = [
482
- ["path", { d: "M21 5H3", key: "1fi0y6" }],
483
- ["path", { d: "M17 12H7", key: "16if0g" }],
484
- ["path", { d: "M19 19H5", key: "vjpgq2" }]
485
- ], co = O("text-align-center", Za);
486
- /**
487
- * @license lucide-react v1.22.0 - ISC
488
- *
489
- * This source code is licensed under the ISC license.
490
- * See the LICENSE file in the root directory of this source tree.
491
- */
492
- const Qa = [
493
- ["path", { d: "M21 5H3", key: "1fi0y6" }],
494
- ["path", { d: "M21 12H9", key: "dn1m92" }],
495
- ["path", { d: "M21 19H7", key: "4cu937" }]
496
- ], uo = O("text-align-end", Qa);
497
- /**
498
- * @license lucide-react v1.22.0 - ISC
499
- *
500
- * This source code is licensed under the ISC license.
501
- * See the LICENSE file in the root directory of this source tree.
502
- */
503
- const Ja = [
504
- ["path", { d: "M3 5h18", key: "1u36vt" }],
505
- ["path", { d: "M3 12h18", key: "1i2n21" }],
506
- ["path", { d: "M3 19h18", key: "awlh7x" }]
507
- ], Ya = O("text-align-justify", Ja);
508
- /**
509
- * @license lucide-react v1.22.0 - ISC
510
- *
511
- * This source code is licensed under the ISC license.
512
- * See the LICENSE file in the root directory of this source tree.
513
- */
514
- const es = [
515
- ["path", { d: "M21 5H3", key: "1fi0y6" }],
516
- ["path", { d: "M15 12H3", key: "6jk70r" }],
517
- ["path", { d: "M17 19H3", key: "z6ezky" }]
518
- ], mo = O("text-align-start", es);
519
- /**
520
- * @license lucide-react v1.22.0 - ISC
521
- *
522
- * This source code is licensed under the ISC license.
523
- * See the LICENSE file in the root directory of this source tree.
524
- */
525
- const ts = [
526
- ["rect", { width: "18", height: "12", x: "3", y: "8", rx: "1", key: "158fvp" }],
527
- ["path", { d: "M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3", key: "s0042v" }],
528
- ["path", { d: "M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3", key: "9wmeh2" }]
529
- ], Xn = O("toy-brick", ts);
530
- /**
531
- * @license lucide-react v1.22.0 - ISC
532
- *
533
- * This source code is licensed under the ISC license.
534
- * See the LICENSE file in the root directory of this source tree.
535
- */
536
- const ns = [
537
- ["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
538
- ["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
539
- ], rs = O("underline", ns);
540
- /**
541
- * @license lucide-react v1.22.0 - ISC
542
- *
543
- * This source code is licensed under the ISC license.
544
- * See the LICENSE file in the root directory of this source tree.
545
- */
546
- const os = [
547
- [
548
- "path",
549
- {
550
- 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",
551
- key: "ul74o6"
552
- }
553
- ],
554
- ["path", { d: "m14 7 3 3", key: "1r5n42" }],
555
- ["path", { d: "M5 6v4", key: "ilb8ba" }],
556
- ["path", { d: "M19 14v4", key: "blhpug" }],
557
- ["path", { d: "M10 2v2", key: "7u0qdc" }],
558
- ["path", { d: "M7 8H3", key: "zfb6yr" }],
559
- ["path", { d: "M21 16h-4", key: "1cnmox" }],
560
- ["path", { d: "M11 3H9", key: "1obp7u" }]
561
- ], Vr = O("wand-sparkles", os);
562
- function Wr(n) {
563
- return {
564
- format: n("editor.vendor.format"),
565
- image: n("editor.vendor.image"),
566
- file: n("editor.vendor.file"),
567
- link: n("editor.vendor.link"),
568
- bold: n("editor.bold"),
569
- italic: n("editor.italic"),
570
- deleted: n("editor.strike"),
571
- underline: n("editor.underline"),
572
- superscript: n("editor.vendor.superscript"),
573
- subscript: n("editor.vendor.subscript"),
574
- "bold-abbr": n("editor.vendor.boldAbbr"),
575
- "italic-abbr": n("editor.vendor.italicAbbr"),
576
- "deleted-abbr": n("editor.vendor.deletedAbbr"),
577
- "underline-abbr": n("editor.vendor.underlineAbbr"),
578
- "superscript-abbr": n("editor.vendor.superscriptAbbr"),
579
- "subscript-abbr": n("editor.vendor.subscriptAbbr"),
580
- lists: n("editor.vendor.lists"),
581
- "link-insert": n("editor.link.insert"),
582
- "link-edit": n("editor.link.edit"),
583
- "link-in-new-tab": n("editor.vendor.linkInNewTab"),
584
- unlink: n("editor.vendor.unlink"),
585
- cancel: n("common.cancel"),
586
- close: n("common.close"),
587
- insert: n("editor.link.insertAction"),
588
- save: n("common.save"),
589
- delete: n("common.delete"),
590
- text: n("editor.vendor.text"),
591
- edit: n("editor.vendor.edit"),
592
- title: n("editor.image.alt"),
593
- paragraph: n("editor.vendor.paragraph"),
594
- quote: n("editor.quote"),
595
- code: n("editor.vendor.code"),
596
- heading1: n("editor.vendor.heading1"),
597
- heading2: n("editor.heading2"),
598
- heading3: n("editor.heading3"),
599
- heading4: n("editor.vendor.heading4"),
600
- heading5: n("editor.vendor.heading5"),
601
- heading6: n("editor.vendor.heading6"),
602
- filename: n("editor.vendor.filename"),
603
- optional: n("common.optional"),
604
- unorderedlist: n("editor.vendor.unorderedlist"),
605
- orderedlist: n("editor.vendor.orderedlist"),
606
- outdent: n("editor.vendor.outdent"),
607
- indent: n("editor.vendor.indent"),
608
- horizontalrule: n("editor.vendor.horizontalrule"),
609
- upload: n("editor.image.upload"),
610
- "upload-label": n("editor.vendor.uploadLabel"),
611
- "accessibility-help-label": n("editor.regionLabel"),
612
- caption: n("editor.vendor.caption"),
613
- bulletslist: n("editor.vendor.bulletslist"),
614
- numberslist: n("editor.vendor.numberslist"),
615
- "image-position": n("editor.vendor.imagePosition"),
616
- none: n("editor.vendor.none"),
617
- left: n("editor.vendor.left"),
618
- right: n("editor.vendor.right"),
619
- center: n("editor.vendor.center"),
620
- undo: n("editor.undo"),
621
- redo: n("editor.redo"),
622
- size: n("editor.vendor.fontSize"),
623
- "remove-size": n("editor.vendor.removeSize"),
624
- fontcolor: n("editor.textColor"),
625
- highlight: n("editor.highlightColor"),
626
- table: n("editor.vendor.table"),
627
- "insert-table": n("editor.table.insert"),
628
- "insert-row-above": n("editor.table.rowAbove"),
629
- "insert-row-below": n("editor.table.rowBelow"),
630
- "insert-column-left": n("editor.table.columnLeft"),
631
- "insert-column-right": n("editor.table.columnRight"),
632
- "add-head": n("editor.table.addHeader"),
633
- "delete-head": n("editor.table.deleteHeader"),
634
- "delete-column": n("editor.table.deleteColumn"),
635
- "delete-row": n("editor.table.deleteRow"),
636
- "delete-table": n("editor.table.deleteTable")
637
- };
638
- }
639
- const is = {
640
- id: "rich-text-editor",
641
- capabilities: ["edit_inline"],
642
- state: {
643
- html: {
644
- type: "string",
645
- descriptionKey: "ui.agent.richTextEditor.state.html",
646
- description: "Sanitised HTML representation of the editor content.",
647
- read: (n) => n.getHTML()
648
- },
649
- text: {
650
- type: "string",
651
- descriptionKey: "ui.agent.richTextEditor.state.text",
652
- description: "Plain-text content of the editor (tags stripped).",
653
- read: (n) => n.getText()
654
- },
655
- markdown: {
656
- type: "string",
657
- descriptionKey: "ui.agent.richTextEditor.state.markdown",
658
- description: "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
659
- read: (n) => n.getMarkdown()
660
- },
661
- aiBusy: {
662
- type: "boolean",
663
- descriptionKey: "ui.agent.richTextEditor.state.aiBusy",
664
- description: "True while a one-shot AI action (a practice template, spelling or auto-format) is rewriting the note. Read `html` once it is false.",
665
- read: (n) => n.isAiBusy()
666
- }
667
- },
668
- // Image wrap/align/resize are intentionally NOT agent actions — they target
669
- // the ephemeral click-selected image the handle can't address. Agents emit
670
- // `<img class="wysiwyg-img-*" style="width:N%">` via set_content instead.
671
- actions: {
672
- set_content: {
673
- // Replaces the whole document — discards whatever the user had typed.
674
- safety: "destructive",
675
- argsType: "{ html: string }",
676
- argsSchema: {
677
- type: "object",
678
- properties: {
679
- html: {
680
- type: "string",
681
- description: "Replacement HTML (sanitised via DOMPurify)."
682
- }
683
- },
684
- required: ["html"]
685
- },
686
- idempotent: !0,
687
- descriptionKey: "ui.agent.richTextEditor.actions.setContent",
688
- description: "Replace the editor content. Loses unsaved input.",
689
- invoke: (n, a) => {
690
- n.setContent(a.html);
691
- }
692
- },
693
- insert_at_cursor: {
694
- // Reversible via the editor's own undo stack — write, not destructive.
695
- safety: "write",
696
- argsType: "{ content: string; asHtml?: boolean }",
697
- argsSchema: {
698
- type: "object",
699
- properties: {
700
- content: {
701
- type: "string",
702
- description: "Content to insert at the caret."
703
- },
704
- asHtml: {
705
- type: "boolean",
706
- description: "Treat content as HTML (sanitised). Pass false for plain text. Defaults to true."
707
- }
708
- },
709
- required: ["content"]
710
- },
711
- descriptionKey: "ui.agent.richTextEditor.actions.insertAtCursor",
712
- 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.",
713
- examples: [
714
- {
715
- args: { content: "{{patient.firstName}}", asHtml: !1 },
716
- note: "Insert a merge variable as plain text."
717
- }
718
- ],
719
- invoke: (n, a) => {
720
- n.insertAtCursor(a.content, { asHtml: a.asHtml });
721
- }
722
- },
723
- apply_format: {
724
- // Reversible via undo — write, not destructive.
725
- safety: "write",
726
- argsType: "{ format: 'bold' | 'italic' | 'strikethrough' | 'bulletedList' | 'numberedList' | 'heading' | 'quote' | 'paragraph' }",
727
- argsSchema: {
728
- type: "object",
729
- properties: {
730
- format: {
731
- type: "string",
732
- enum: [
733
- "bold",
734
- "italic",
735
- "strikethrough",
736
- "bulletedList",
737
- "numberedList",
738
- "heading",
739
- "quote",
740
- "paragraph"
741
- ],
742
- description: "Block or inline format to toggle/apply."
743
- }
744
- },
745
- required: ["format"]
746
- },
747
- descriptionKey: "ui.agent.richTextEditor.actions.applyFormat",
748
- description: "Toggle/apply a block or inline format on the current selection (bold, italic, strikethrough, bulleted/numbered list, heading, quote, paragraph).",
749
- examples: [{ args: { format: "bold" }, note: "Bold the selection." }],
750
- invoke: (n, a) => {
751
- n.applyFormat(a.format);
752
- }
753
- },
754
- clear: {
755
- // Empties the document — loses unsaved input.
756
- safety: "destructive",
757
- idempotent: !0,
758
- descriptionKey: "ui.agent.richTextEditor.actions.clear",
759
- description: "Empty the editor. Loses unsaved input.",
760
- invoke: (n) => {
761
- n.clear();
762
- }
763
- },
764
- focus: {
765
- safety: "read",
766
- idempotent: !0,
767
- descriptionKey: "ui.agent.richTextEditor.actions.focus",
768
- description: "Move keyboard focus to the editor surface.",
769
- invoke: (n) => {
770
- n.focus();
771
- }
772
- }
773
- },
774
- domHooks: {
775
- root: { attr: "data-component", value: "rich-text-editor" },
776
- instanceId: {
777
- attr: "data-component-id",
778
- sourceProp: "id",
779
- description: "Sourced from the id prop."
780
- }
781
- }
782
- }, as = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", kt = "ds:!size-[var(--min-target-size)]", ss = 384, ls = "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", qn = At("ds:flex ds:gap-[var(--spacing-sm)]", {
783
- variants: { stacked: { true: "ds:flex-col", false: "ds:items-center" } }
784
- }), Bn = At("ds:min-w-0", {
785
- variants: { stacked: { true: "", false: "ds:flex-1" } }
786
- }), Xr = At(
787
- "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]",
788
- { variants: { stacked: { true: "ds:justify-end", false: "" } } }
789
- ), cs = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", ds = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]";
790
- function fo({ id: n }) {
791
- const { t: a } = ie("ui");
792
- return /* @__PURE__ */ t(
793
- "p",
794
- {
795
- "data-component": "editor-request-error",
796
- id: n,
797
- role: "alert",
798
- className: ds,
799
- children: a("editor.ai.error")
800
- }
801
- );
802
- }
803
- const Ur = [
804
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
805
- "ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
806
- "ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
807
- "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]",
808
- // The preview renders arbitrary model-generated rich text, and the
809
- // `rich-text` SafeHtml profile allows ul/ol/li. Inside a
810
- // [data-component] preflight's list reset still applies and the host
811
- // undo deliberately does not reach, so markers and indent have to be
812
- // asked for explicitly — otherwise a generated bullet list previews as
813
- // flush, marker-less lines.
814
- "ds:[&_ul]:list-disc ds:[&_ol]:list-decimal",
815
- "ds:[&_ul]:ps-[var(--spacing-md)] ds:[&_ol]:ps-[var(--spacing-md)]"
816
- ].join(" ");
817
- function Zr(n, a) {
818
- return a ? n ? /\s$/.test(n) ? `${n}${a}` : `${n} ${a}` : a : n;
819
- }
820
- function Qr(n) {
821
- return typeof n == "object" && n !== null && "name" in n && n.name === "AiCreditsExhaustedError";
822
- }
823
- function us({
824
- open: n,
825
- onClose: a,
826
- onRequestAiDraft: u,
827
- onInsert: l,
828
- onCreditsExhausted: h,
829
- creditsExhausted: g = !1,
830
- previewAsHtml: y = !0,
831
- privacyNotice: w,
832
- onDictate: b
833
- }) {
834
- const { t: p } = ie("ui"), E = Ve(), M = Ve(), [S, z] = T(""), [j, f] = T(!1), [m, v] = T(!1), [L, H] = T(!1), F = x(h);
835
- I(() => {
836
- F.current = h;
837
- }, [h]);
838
- const [P, X] = T(null), q = x(null), [k, oe] = T(!1), [Q, ae] = T("listening"), [de, J] = T(""), [Le, W] = T(""), we = x(null), se = x(null), Y = A((_ = !1) => {
839
- var V;
840
- se.current && (se.current.keepLate = _), (V = we.current) == null || V.abort();
841
- }, []), U = A(() => {
842
- if (!b) return;
843
- const _ = new AbortController();
844
- we.current = _;
845
- const V = { keepLate: !1 };
846
- se.current = V;
847
- let Ce = !1;
848
- const ne = () => !Ce && (!_.signal.aborted || V.keepLate);
849
- oe(!0), ae("listening"), J(""), W(p("editor.ai.listening")), b({
850
- signal: _.signal,
851
- onStatus: (B) => {
852
- ne() && (ae(B), W(
853
- p(B === "connecting" ? "voiceControl.status.starting" : "editor.ai.listening")
854
- ));
855
- },
856
- onPartialTranscript: (B) => {
857
- ne() && J(B);
858
- },
859
- onFinalTranscript: (B) => {
860
- if (!ne()) return;
861
- const Ae = B.trim();
862
- J(""), Ae && (z((ue) => Zr(ue, Ae)), W(Ae));
863
- }
864
- }).catch((B) => {
865
- var Ae;
866
- _.signal.aborted || !Qr(B) || (H(!0), (Ae = F.current) == null || Ae.call(F));
867
- }).finally(() => {
868
- Ce = !0, J(""), we.current === _ && (we.current = null, se.current = null, oe(!1), W(""));
869
- });
870
- }, [b, p]), ce = A(() => {
871
- k ? Y(!0) : U();
872
- }, [k, U, Y]);
873
- I(() => {
874
- var _, V;
875
- n ? (z(""), f(!1), v(!1), H(!1), X(null), J(""), W("")) : ((_ = q.current) == null || _.abort(), q.current = null, (V = we.current) == null || V.abort());
876
- }, [n]), I(
877
- () => () => {
878
- var _, V;
879
- (_ = q.current) == null || _.abort(), (V = we.current) == null || V.abort();
880
- },
881
- []
882
- );
883
- const We = A(() => {
884
- var Ce;
885
- const _ = S.trim();
886
- if (!_ || j) return;
887
- Y(), (Ce = q.current) == null || Ce.abort();
888
- const V = new AbortController();
889
- q.current = V, v(!1), f(!0), u({ prompt: _, signal: V.signal }).then((ne) => {
890
- V.signal.aborted || (X(ne), f(!1));
891
- }).catch((ne) => {
892
- var B;
893
- if (!(V.signal.aborted || ne && typeof ne == "object" && "name" in ne && ne.name === "AbortError")) {
894
- if (f(!1), Qr(ne)) {
895
- H(!0), (B = F.current) == null || B.call(F);
896
- return;
897
- }
898
- v(!0);
899
- }
900
- });
901
- }, [S, j, u, Y]), $e = A(() => {
902
- P != null && (l(P), a());
903
- }, [P, l, a]), st = x(null), [xe, pn] = T(!1);
904
- Ci(() => {
905
- const _ = st.current;
906
- if (!n || !_) return;
907
- const V = () => {
908
- const ne = _.clientWidth;
909
- pn(ne > 0 && ne < ss);
910
- };
911
- if (V(), typeof ResizeObserver > "u") return;
912
- const Ce = new ResizeObserver(V);
913
- return Ce.observe(_), () => Ce.disconnect();
914
- }, [n]);
915
- const $ = x(null), Dt = P != null, Pt = L || g, Me = k && Q === "connecting", D = k ? Zr(S, de) : S;
916
- I(() => {
917
- var _;
918
- L && ((_ = $.current) == null || _.focus());
919
- }, [L]);
920
- const ee = xe ? null : /* @__PURE__ */ t(
921
- Z,
922
- {
923
- size: "md",
924
- intent: "outline",
925
- className: kt,
926
- icon: /* @__PURE__ */ t(Ai, {}),
927
- "aria-label": p("common.close"),
928
- onClick: a
929
- }
930
- );
931
- return /* @__PURE__ */ t(
932
- Gn,
933
- {
934
- open: n,
935
- onClose: a,
936
- title: xe ? p("editor.ai.dialogTitle") : void 0,
937
- ariaLabel: p("editor.ai.dialogTitle"),
938
- children: /* @__PURE__ */ t("div", { ref: st, className: ls, children: Pt ? /* @__PURE__ */ C("div", { className: qn({ stacked: xe }), children: [
939
- ee,
940
- /* @__PURE__ */ t("div", { className: Bn({ stacked: xe }), children: /* @__PURE__ */ t(
941
- xi,
942
- {
943
- ref: $,
944
- tabIndex: -1,
945
- headingLevel: 2,
946
- announce: "assertive"
947
- }
948
- ) })
949
- ] }) : Dt ? /* @__PURE__ */ C("div", { className: qn({ stacked: xe }), children: [
950
- ee,
951
- /* @__PURE__ */ t("div", { className: Bn({ stacked: xe }), children: y ? /* @__PURE__ */ t(
952
- mi,
953
- {
954
- html: P,
955
- profile: "rich-text",
956
- className: Ur,
957
- tabIndex: 0,
958
- "aria-label": p("editor.ai.dialogTitle")
959
- }
960
- ) : (
961
- // Focusable so a keyboard user can scroll a long draft preview
962
- // (mirrors the SafeHtml preview branch above). The lint rule's
963
- // tabIndex allowlist doesn't cover a scrollable, non-interactive
964
- // text region.
965
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
966
- /* @__PURE__ */ t("p", { className: Ur, tabIndex: 0, children: P })
967
- ) }),
968
- /* @__PURE__ */ C("div", { className: Xr({ stacked: xe }), children: [
969
- /* @__PURE__ */ t(
970
- Z,
971
- {
972
- size: "md",
973
- intent: "outline",
974
- className: `${kt} ds:rounded-full`,
975
- icon: /* @__PURE__ */ t(Ni, {}),
976
- "aria-label": p("editor.ai.retry"),
977
- onClick: () => X(null)
978
- }
979
- ),
980
- /* @__PURE__ */ t(
981
- Z,
982
- {
983
- size: "md",
984
- intent: "primary",
985
- className: `${kt} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
986
- icon: /* @__PURE__ */ t(Ti, {}),
987
- "aria-label": p("common.confirm"),
988
- onClick: $e
989
- }
990
- )
991
- ] })
992
- ] }) : /* @__PURE__ */ C(je, { children: [
993
- /* @__PURE__ */ C("div", { className: qn({ stacked: xe }), children: [
994
- ee,
995
- /* @__PURE__ */ t("div", { className: Bn({ stacked: xe }), children: /* @__PURE__ */ t(
996
- ki,
997
- {
998
- id: E,
999
- size: "md",
1000
- value: D,
1001
- onChange: (_) => z(_.target.value),
1002
- placeholder: p(k ? Me ? "voiceControl.status.starting" : "editor.ai.listening" : "editor.ai.promptPlaceholder"),
1003
- "aria-label": p("editor.ai.promptLabel"),
1004
- autoResize: !0,
1005
- minRows: 1,
1006
- maxRows: 3,
1007
- readOnly: k,
1008
- tone: m ? "error" : "default",
1009
- "aria-describedby": m ? M : void 0
1010
- }
1011
- ) }),
1012
- /* @__PURE__ */ C("div", { className: Xr({ stacked: xe }), children: [
1013
- b ? /* @__PURE__ */ t(
1014
- Z,
1015
- {
1016
- size: "md",
1017
- intent: "outline",
1018
- className: k && !Me ? `${kt} ${as}` : kt,
1019
- icon: Me ? /* @__PURE__ */ t(Kn, { className: "ds:animate-spin ds:motion-reduce:animate-none" }) : k ? /* @__PURE__ */ t(Ht, { className: "ds:fill-current" }) : /* @__PURE__ */ t(Vn, {}),
1020
- "aria-pressed": k,
1021
- "aria-label": p(k ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
1022
- onClick: ce
1023
- }
1024
- ) : null,
1025
- /* @__PURE__ */ t(
1026
- Z,
1027
- {
1028
- size: "md",
1029
- intent: "primary",
1030
- icon: j ? /* @__PURE__ */ t(Yn, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ t(Ei, {}),
1031
- className: `${kt} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
1032
- disabled: j || !S.trim(),
1033
- "aria-busy": j || void 0,
1034
- "aria-label": p("editor.ai.generate"),
1035
- onClick: We
1036
- }
1037
- )
1038
- ] })
1039
- ] }),
1040
- b ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Le }) : null,
1041
- m ? /* @__PURE__ */ t(fo, { id: M }) : w ? /* @__PURE__ */ t("p", { className: cs, children: w }) : null
1042
- ] }) })
1043
- }
1044
- );
1045
- }
1046
- function ho(n, a) {
1047
- return n(a, { nsSeparator: !1, defaultValue: a });
1048
- }
1049
- const go = {
1050
- // Redactor's own history. AI rewrites push onto it too (see
1051
- // `pushUndoState` in rich-text-editor.tsx), so Undo steps back over them.
1052
- undo: {
1053
- id: "undo",
1054
- icon: /* @__PURE__ */ t(Di, {}),
1055
- label: ["editor.undo", "Undo"],
1056
- command: ["module.buffer.undo"]
1057
- },
1058
- redo: {
1059
- id: "redo",
1060
- icon: /* @__PURE__ */ t(Fa, {}),
1061
- label: ["editor.redo", "Redo"],
1062
- command: ["module.buffer.redo"]
1063
- },
1064
- bold: {
1065
- id: "bold",
1066
- icon: /* @__PURE__ */ t(ta, {}),
1067
- label: ["editor.bold", "Bold"],
1068
- command: ["module.inline.format", { tag: "b" }],
1069
- toggle: "bold"
1070
- },
1071
- italic: {
1072
- id: "italic",
1073
- icon: /* @__PURE__ */ t(ua, {}),
1074
- label: ["editor.italic", "Italic"],
1075
- command: ["module.inline.format", { tag: "i" }],
1076
- toggle: "italic"
1077
- },
1078
- underline: {
1079
- id: "underline",
1080
- icon: /* @__PURE__ */ t(rs, {}),
1081
- label: ["editor.underline", "Underline"],
1082
- command: ["module.inline.format", { tag: "u" }],
1083
- toggle: "underline"
1084
- },
1085
- strike: {
1086
- id: "strike",
1087
- icon: /* @__PURE__ */ t(Wa, {}),
1088
- label: ["editor.strike", "Strikethrough"],
1089
- command: ["module.inline.format", { tag: "del" }],
1090
- toggle: "strike"
1091
- },
1092
- ul: {
1093
- id: "ul",
1094
- icon: /* @__PURE__ */ t(ka, {}),
1095
- label: ["editor.list.bullet", "Bulleted list"],
1096
- command: ["module.list.toggle", "ul"],
1097
- toggle: "ul"
1098
- },
1099
- ol: {
1100
- id: "ol",
1101
- icon: /* @__PURE__ */ t(ya, {}),
1102
- label: ["editor.list.ordered", "Numbered list"],
1103
- command: ["module.list.toggle", "ol"],
1104
- toggle: "ol"
1105
- },
1106
- // Redactor's own list commands. They only act inside a list, so the
1107
- // buttons are off elsewhere, as Redactor's `observe: 'list'` does. The
1108
- // icons point along the writing direction, so they flip in RTL.
1109
- outdent: {
1110
- id: "outdent",
1111
- icon: /* @__PURE__ */ t(ga, { className: "ds:rtl:-scale-x-100" }),
1112
- label: ["editor.list.outdent", "Decrease indent"],
1113
- command: ["module.list.outdent"],
1114
- needs: ["ul", "ol"]
1115
- },
1116
- indent: {
1117
- id: "indent",
1118
- icon: /* @__PURE__ */ t(ba, { className: "ds:rtl:-scale-x-100" }),
1119
- label: ["editor.list.indent", "Increase indent"],
1120
- command: ["module.list.indent"],
1121
- needs: ["ul", "ol"]
1122
- },
1123
- line: {
1124
- id: "line",
1125
- icon: /* @__PURE__ */ t(Oi, {}),
1126
- label: ["editor.line", "Horizontal line"],
1127
- command: ["module.line.insert"]
1128
- }
1129
- }, ms = [10, 11, 12, 14, 16, 18, 20, 24, 28, 30], Fn = [
1130
- {
1131
- id: "paragraph",
1132
- tag: "p",
1133
- icon: /* @__PURE__ */ t(Da, {}),
1134
- label: ["editor.paragraph", "Paragraph"]
1135
- },
1136
- {
1137
- id: "h2",
1138
- tag: "h2",
1139
- icon: /* @__PURE__ */ t(sa, {}),
1140
- label: ["editor.heading2", "Heading 2"]
1141
- },
1142
- {
1143
- id: "h3",
1144
- tag: "h3",
1145
- icon: /* @__PURE__ */ t(ca, {}),
1146
- label: ["editor.heading3", "Heading 3"]
1147
- },
1148
- {
1149
- id: "quote",
1150
- tag: "blockquote",
1151
- icon: /* @__PURE__ */ t(qa, {}),
1152
- label: ["editor.quote", "Quote"]
1153
- }
1154
- ], cn = [
1155
- {
1156
- id: "left",
1157
- icon: /* @__PURE__ */ t(mo, {}),
1158
- label: ["editor.align.left", "Align left"]
1159
- },
1160
- {
1161
- id: "center",
1162
- icon: /* @__PURE__ */ t(co, {}),
1163
- label: ["editor.align.center", "Align centre"]
1164
- },
1165
- {
1166
- id: "right",
1167
- icon: /* @__PURE__ */ t(uo, {}),
1168
- label: ["editor.align.right", "Align right"]
1169
- },
1170
- {
1171
- id: "justify",
1172
- icon: /* @__PURE__ */ t(Ya, {}),
1173
- label: ["editor.align.justify", "Justify"]
1174
- }
1175
- ], Un = [
1176
- "p",
1177
- "div",
1178
- "blockquote",
1179
- "pre",
1180
- "h1",
1181
- "h2",
1182
- "h3",
1183
- "h4",
1184
- "h5",
1185
- "h6",
1186
- "li"
1187
- ], fs = {
1188
- minimal: ["bold", "italic", "underline", "link"],
1189
- standard: [
1190
- "undo",
1191
- "redo",
1192
- "format",
1193
- "bold",
1194
- "italic",
1195
- "underline",
1196
- "strike",
1197
- "align",
1198
- "ul",
1199
- "ol",
1200
- "link"
1201
- ],
1202
- // Everything `standard` has, plus the list indent pair and the horizontal
1203
- // line: platform's `RedactorWysiwyg` set (`lists` dropdown, `buttonsAdd:
1204
- // ['line']`).
1205
- full: [
1206
- "undo",
1207
- "redo",
1208
- "format",
1209
- "bold",
1210
- "italic",
1211
- "underline",
1212
- "strike",
1213
- "align",
1214
- "ul",
1215
- "ol",
1216
- "outdent",
1217
- "indent",
1218
- "link",
1219
- "line"
1220
- ]
1221
- }, po = [
1222
- {
1223
- id: "rowAbove",
1224
- command: "plugin.table.addRowAbove",
1225
- icon: /* @__PURE__ */ t(Xi, {}),
1226
- label: ["editor.table.rowAbove", "Add row above"]
1227
- },
1228
- {
1229
- id: "rowBelow",
1230
- command: "plugin.table.addRowBelow",
1231
- icon: /* @__PURE__ */ t(Vi, {}),
1232
- label: ["editor.table.rowBelow", "Add row below"]
1233
- },
1234
- {
1235
- id: "colLeft",
1236
- command: "plugin.table.addColumnLeft",
1237
- icon: /* @__PURE__ */ t(Ji, {}),
1238
- label: ["editor.table.columnLeft", "Add column left"]
1239
- },
1240
- {
1241
- id: "colRight",
1242
- command: "plugin.table.addColumnRight",
1243
- icon: /* @__PURE__ */ t(Zi, {}),
1244
- label: ["editor.table.columnRight", "Add column right"]
1245
- },
1246
- {
1247
- id: "addHead",
1248
- command: "plugin.table.addHead",
1249
- icon: /* @__PURE__ */ t(Ha, {}),
1250
- label: ["editor.table.addHeader", "Add header row"]
1251
- },
1252
- {
1253
- id: "deleteHead",
1254
- command: "plugin.table.deleteHead",
1255
- icon: /* @__PURE__ */ t(_a, {}),
1256
- label: ["editor.table.deleteHeader", "Remove header row"]
1257
- },
1258
- {
1259
- id: "deleteRow",
1260
- command: "plugin.table.deleteRow",
1261
- icon: /* @__PURE__ */ t(Ga, {}),
1262
- label: ["editor.table.deleteRow", "Delete row"]
1263
- },
1264
- {
1265
- id: "deleteColumn",
1266
- command: "plugin.table.deleteColumn",
1267
- icon: /* @__PURE__ */ t(ia, {}),
1268
- label: ["editor.table.deleteColumn", "Delete column"]
1269
- },
1270
- {
1271
- id: "deleteTable",
1272
- command: "plugin.table.deleteTable",
1273
- icon: /* @__PURE__ */ t(Pi, {}),
1274
- label: ["editor.table.deleteTable", "Delete table"]
1275
- }
1276
- ], dn = 6, bo = "ds:[&_[data-intent=ghost]:hover]:bg-[color-mix(in_srgb,var(--accent)_12%,transparent)] ds:[&_[data-intent=ghost]:hover]:text-[color:var(--accent)]", hs = At(
1277
- [
1278
- "ds:@container/toolbar",
1279
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1280
- "ds:bg-[var(--background)] ds:p-[var(--spacing-xs)]",
1281
- "ds:shadow-[var(--shadow-md)]",
1282
- bo
1283
- ].join(" ")
1284
- ), gs = "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", gn = "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[var(--border)] ds:[margin-inline:var(--spacing-2xs)]", $t = "ds:text-[length:var(--font-size-sm)] ds:font-medium ds:text-[color:var(--foreground)]";
1285
- function hn(n) {
1286
- return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1287
- }
1288
- function ps(n) {
1289
- const a = n.trim();
1290
- return a && (/^([^\s/:@]+\.[^\s/:@]+|localhost):\d+([/?#]|$)/i.test(a) ? `https://${a}` : /^[a-z][a-z0-9+.-]*:/i.test(a) || /^[/#?]/.test(a) || a.startsWith("[[") ? a : /^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(a) ? `mailto:${a}` : `https://${a}`);
1291
- }
1292
- function bs({
1293
- variables: n,
1294
- recentVariableTokens: a,
1295
- insertVariable: u,
1296
- saveSelection: l
1297
- }) {
1298
- const { t: h } = ie("ui"), [g, y] = T(!1), [w, b] = T(""), p = x(null), E = x(!1), M = Mi(!0, {
1299
- getAnchor: Ri,
1300
- onReturnToTrigger: () => y(!1)
1301
- }), S = n;
1302
- return /* @__PURE__ */ C(
1303
- ln.Root,
1304
- {
1305
- open: g,
1306
- onOpenChange: (z) => {
1307
- z && l(), y(z), z && b("");
1308
- },
1309
- children: [
1310
- /* @__PURE__ */ t(ln.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1311
- Z,
1312
- {
1313
- ref: p,
1314
- size: "sm",
1315
- intent: "ghost",
1316
- icon: /* @__PURE__ */ t(ra, {}),
1317
- "aria-label": h("editor.insertVariable", "Insert variable")
1318
- }
1319
- ) }),
1320
- /* @__PURE__ */ t(ln.Portal, { children: /* @__PURE__ */ t(
1321
- ln.Content,
1322
- {
1323
- align: "start",
1324
- sideOffset: 4,
1325
- className: "ds:z-[var(--z-popover)]",
1326
- onKeyDown: M,
1327
- onCloseAutoFocus: (z) => {
1328
- E.current && (z.preventDefault(), E.current = !1);
1329
- },
1330
- children: /* @__PURE__ */ t(
1331
- lo,
1332
- {
1333
- variables: S,
1334
- recentTokens: a,
1335
- query: w,
1336
- onQueryChange: b,
1337
- searchFocusable: !0,
1338
- "aria-label": h("editor.insertVariable", "Insert variable"),
1339
- onSelect: (z) => {
1340
- E.current = !0, u(z.token), y(!1);
1341
- },
1342
- onClose: () => y(!1)
1343
- }
1344
- )
1345
- }
1346
- ) })
1347
- ]
1348
- }
1349
- );
1350
- }
1351
- function vs({
1352
- run: n,
1353
- active: a,
1354
- onTriggerDown: u
1355
- }) {
1356
- const { t: l } = ie("ui"), h = Fn.find((g) => a.has(g.id)) ?? Fn[0];
1357
- return /* @__PURE__ */ C(G.Root, { children: [
1358
- /* @__PURE__ */ t(G.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1359
- ze,
1360
- {
1361
- size: "sm",
1362
- intent: "ghost",
1363
- startIcon: h.icon,
1364
- endIcon: /* @__PURE__ */ t(nr, {}),
1365
- "aria-label": `${l("editor.format", "Paragraph style")}: ${l(
1366
- h.label[0],
1367
- h.label[1]
1368
- )}`,
1369
- onMouseDown: u,
1370
- children: /* @__PURE__ */ t("span", { className: "ds:hidden ds:@[448px]/toolbar:inline", children: l(h.label[0], h.label[1]) })
1371
- }
1372
- ) }),
1373
- /* @__PURE__ */ t(G.Content, { align: "start", children: Fn.map((g) => /* @__PURE__ */ t(
1374
- G.Item,
1375
- {
1376
- startIcon: g.icon,
1377
- onSelect: () => n("module.block.format", { tag: g.tag }),
1378
- children: l(g.label[0], g.label[1])
1379
- },
1380
- g.id
1381
- )) })
1382
- ] });
1383
- }
1384
- function ys({
1385
- run: n,
1386
- active: a,
1387
- onTriggerDown: u
1388
- }) {
1389
- const { t: l } = ie("ui"), h = x(null), [g, y] = T(!1);
1390
- ci(() => {
1391
- const M = h.current;
1392
- M && y(getComputedStyle(M).direction === "rtl");
1393
- }, []);
1394
- const w = g ? "right" : "left", b = cn.find((M) => a.has(`align-${M.id}`)) ?? cn.find((M) => M.id === w) ?? cn[0], p = (M) => {
1395
- M === w ? n("module.block.remove", { style: "text-align" }, Un) : n("module.block.add", { style: { "text-align": M } }, Un), M === w || M === "justify" ? n("module.block.remove", { style: "list-style-position" }, ["li"]) : n("module.block.add", { style: { "list-style-position": "inside" } }, [
1396
- "li"
1397
- ]);
1398
- }, E = `${l("editor.align.label", "Text alignment")}: ${l(
1399
- b.label[0],
1400
- b.label[1]
1401
- )}`;
1402
- return /* @__PURE__ */ C(G.Root, { children: [
1403
- /* @__PURE__ */ t(G.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1404
- ze,
1405
- {
1406
- ref: h,
1407
- size: "sm",
1408
- intent: "ghost",
1409
- startIcon: b.icon,
1410
- endIcon: /* @__PURE__ */ t(nr, {}),
1411
- "aria-label": E,
1412
- onMouseDown: u
1413
- }
1414
- ) }),
1415
- /* @__PURE__ */ t(G.Content, { align: "start", children: /* @__PURE__ */ t(G.RadioGroup, { value: b.id, onValueChange: p, children: cn.map((M) => /* @__PURE__ */ t(G.RadioItem, { value: M.id, children: l(M.label[0], M.label[1]) }, M.id)) }) })
1416
- ] });
1417
- }
1418
- function ws({
1419
- insertHtml: n,
1420
- saveSelection: a,
1421
- restoreSelection: u,
1422
- getSelectedText: l
1423
- }) {
1424
- const { t: h } = ie("ui"), [g, y] = T(!1), [w, b] = T(""), [p, E] = T(""), [M, S] = T(!1), z = Ve(), j = Ve(), f = () => {
1425
- b(""), E(""), S(!1);
1426
- }, m = () => {
1427
- const v = w.trim();
1428
- if (!v) return;
1429
- const L = ps(v), H = p.trim() || v, F = M ? ' target="_blank" rel="noopener noreferrer"' : "", P = `<a href="${hn(L)}"${F}>${hn(H)}</a>`;
1430
- y(!1), f(), window.requestAnimationFrame(() => {
1431
- u(), n(P);
1432
- });
1433
- };
1434
- return /* @__PURE__ */ C(me.Root, { open: g, onOpenChange: y, children: [
1435
- /* @__PURE__ */ t(me.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1436
- Z,
1437
- {
1438
- size: "sm",
1439
- intent: "ghost",
1440
- icon: /* @__PURE__ */ t(fa, {}),
1441
- "aria-label": h("editor.link.insert", "Insert link"),
1442
- onMouseDown: () => {
1443
- a(), E(l());
1444
- }
1445
- }
1446
- ) }),
1447
- /* @__PURE__ */ C(me.Content, { children: [
1448
- /* @__PURE__ */ t(me.Header, { children: /* @__PURE__ */ t(me.Title, { children: h("editor.link.insert", "Insert link") }) }),
1449
- /* @__PURE__ */ C(me.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1450
- /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1451
- /* @__PURE__ */ t("label", { htmlFor: z, className: $t, children: h("editor.link.url", "URL") }),
1452
- /* @__PURE__ */ t(
1453
- fn,
1454
- {
1455
- id: z,
1456
- type: "url",
1457
- value: w,
1458
- onChange: (v) => b(v.target.value),
1459
- placeholder: "https://…"
1460
- }
1461
- )
1462
- ] }),
1463
- /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1464
- /* @__PURE__ */ t("label", { htmlFor: j, className: $t, children: h("editor.link.text", "Text to display") }),
1465
- /* @__PURE__ */ t(
1466
- fn,
1467
- {
1468
- id: j,
1469
- value: p,
1470
- onChange: (v) => E(v.target.value),
1471
- placeholder: h("editor.link.textPlaceholder", "Link text")
1472
- }
1473
- )
1474
- ] }),
1475
- /* @__PURE__ */ t(
1476
- Si,
1477
- {
1478
- checked: M,
1479
- onCheckedChange: (v) => S(v === !0),
1480
- label: h("editor.link.newTab", "Open in new tab")
1481
- }
1482
- )
1483
- ] }),
1484
- /* @__PURE__ */ C(me.Footer, { children: [
1485
- /* @__PURE__ */ t(me.Close, { asChild: !0, children: /* @__PURE__ */ t(ze, { intent: "secondary", children: h("common.cancel") }) }),
1486
- /* @__PURE__ */ t(ze, { onClick: m, disabled: !w.trim(), children: h("editor.link.insertAction", "Insert") })
1487
- ] })
1488
- ] })
1489
- ] });
1490
- }
1491
- function ks({
1492
- insertHtml: n,
1493
- saveSelection: a,
1494
- restoreSelection: u,
1495
- uploadImage: l
1496
- }) {
1497
- const { t: h } = ie("ui"), [g, y] = T(!1), [w, b] = T(""), [p, E] = T(""), M = Ve(), S = Ve(), z = (f, m) => {
1498
- const v = `<img src="${hn(f)}" alt="${hn(m)}" loading="lazy">`;
1499
- y(!1), b(""), E(""), window.requestAnimationFrame(() => {
1500
- u(), n(v);
1501
- });
1502
- }, j = () => {
1503
- const f = w.trim();
1504
- f && z(f, p.trim());
1505
- };
1506
- return /* @__PURE__ */ C(me.Root, { open: g, onOpenChange: y, children: [
1507
- /* @__PURE__ */ t(me.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1508
- Z,
1509
- {
1510
- size: "sm",
1511
- intent: "ghost",
1512
- icon: /* @__PURE__ */ t(Ii, {}),
1513
- "aria-label": h("editor.image.insert", "Insert image"),
1514
- onMouseDown: () => a()
1515
- }
1516
- ) }),
1517
- /* @__PURE__ */ C(me.Content, { children: [
1518
- /* @__PURE__ */ t(me.Header, { children: /* @__PURE__ */ t(me.Title, { children: h("editor.image.insert", "Insert image") }) }),
1519
- /* @__PURE__ */ C(me.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1520
- l ? /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1521
- /* @__PURE__ */ t("span", { className: $t, children: h("editor.image.upload", "Upload") }),
1522
- /* @__PURE__ */ t(
1523
- zi,
1524
- {
1525
- variant: "dropzone",
1526
- accept: {
1527
- "image/*": [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"]
1528
- },
1529
- maxFiles: 1,
1530
- onUpload: async (f, { signal: m }) => {
1531
- const v = await l(f, m);
1532
- z(v, f.name);
1533
- }
1534
- }
1535
- ),
1536
- /* @__PURE__ */ t("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: h("editor.image.orUrl", "Or paste an image URL") })
1537
- ] }) : null,
1538
- /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1539
- /* @__PURE__ */ t("label", { htmlFor: M, className: $t, children: h("editor.image.url", "Image URL") }),
1540
- /* @__PURE__ */ t(
1541
- fn,
1542
- {
1543
- id: M,
1544
- type: "url",
1545
- value: w,
1546
- onChange: (f) => b(f.target.value),
1547
- placeholder: "https://…"
1548
- }
1549
- )
1550
- ] }),
1551
- /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1552
- /* @__PURE__ */ t("label", { htmlFor: S, className: $t, children: h("editor.image.alt", "Alt text") }),
1553
- /* @__PURE__ */ t(
1554
- fn,
1555
- {
1556
- id: S,
1557
- value: p,
1558
- onChange: (f) => E(f.target.value),
1559
- placeholder: h(
1560
- "editor.image.altPlaceholder",
1561
- "Describe the image"
1562
- )
1563
- }
1564
- )
1565
- ] })
1566
- ] }),
1567
- /* @__PURE__ */ C(me.Footer, { children: [
1568
- /* @__PURE__ */ t(me.Close, { asChild: !0, children: /* @__PURE__ */ t(ze, { intent: "secondary", children: h("common.cancel") }) }),
1569
- /* @__PURE__ */ t(ze, { onClick: j, disabled: !w.trim(), children: h("editor.image.insertAction", "Insert") })
1570
- ] })
1571
- ] })
1572
- ] });
1573
- }
1574
- function xs({
1575
- run: n,
1576
- onTriggerDown: a
1577
- }) {
1578
- const { t: u } = ie("ui");
1579
- return /* @__PURE__ */ C(G.Root, { children: [
1580
- /* @__PURE__ */ t(G.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1581
- Z,
1582
- {
1583
- size: "sm",
1584
- intent: "ghost",
1585
- icon: /* @__PURE__ */ t(Fi, {}),
1586
- "aria-label": u("editor.fontSize.label", "Font size"),
1587
- onMouseDown: a
1588
- }
1589
- ) }),
1590
- /* @__PURE__ */ C(G.Content, { align: "start", children: [
1591
- ms.map((l) => /* @__PURE__ */ t(
1592
- G.Item,
1593
- {
1594
- onSelect: () => n("module.inline.format", {
1595
- tag: "span",
1596
- style: { "font-size": `${l}px` },
1597
- type: "toggle"
1598
- }),
1599
- children: `${l}px`
1600
- },
1601
- l
1602
- )),
1603
- /* @__PURE__ */ t(G.Separator, {}),
1604
- /* @__PURE__ */ t(
1605
- G.Item,
1606
- {
1607
- onSelect: () => n("module.inline.remove", { style: "font-size" }),
1608
- children: u("editor.fontSize.reset", "Reset font size")
1609
- }
1610
- )
1611
- ] })
1612
- ] });
1613
- }
1614
- function Cs({
1615
- run: n,
1616
- saveSelection: a,
1617
- restoreSelection: u
1618
- }) {
1619
- const { t: l } = ie("ui"), [h, g] = T("#1f2a5c"), y = (b) => {
1620
- g(b), u(), n("module.inline.format", {
1621
- tag: "span",
1622
- style: { color: b },
1623
- type: "toggle"
1624
- });
1625
- }, w = () => {
1626
- u(), n("module.inline.remove", { style: "color" });
1627
- };
1628
- return /* @__PURE__ */ C(le, { onOpenChange: (b) => b && a(), children: [
1629
- /* @__PURE__ */ t(le.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1630
- Z,
1631
- {
1632
- size: "sm",
1633
- intent: "ghost",
1634
- icon: /* @__PURE__ */ t(Ea, {}),
1635
- "aria-label": l("editor.textColor", "Text colour"),
1636
- onMouseDown: (b) => {
1637
- b.preventDefault(), a();
1638
- }
1639
- }
1640
- ) }),
1641
- /* @__PURE__ */ C(le.Content, { side: "bottom", align: "start", children: [
1642
- /* @__PURE__ */ t(le.Heading, { children: l("editor.textColor", "Text colour") }),
1643
- /* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
1644
- tr,
1645
- {
1646
- variant: "inline",
1647
- size: "sm",
1648
- value: h,
1649
- onChange: y
1650
- }
1651
- ) }),
1652
- /* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(ze, { size: "sm", intent: "secondary", onClick: w, children: l("editor.color.remove", "Remove colour") }) })
1653
- ] })
1654
- ] });
1655
- }
1656
- function As({
1657
- run: n,
1658
- saveSelection: a,
1659
- restoreSelection: u
1660
- }) {
1661
- const { t: l } = ie("ui"), [h, g] = T("#fff3a3"), y = (b) => {
1662
- g(b), u(), n("module.inline.format", {
1663
- tag: "span",
1664
- style: { "background-color": b },
1665
- type: "toggle"
1666
- });
1667
- }, w = () => {
1668
- u(), n("module.inline.remove", { style: "background-color" });
1669
- };
1670
- return /* @__PURE__ */ C(le, { onOpenChange: (b) => b && a(), children: [
1671
- /* @__PURE__ */ t(le.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1672
- Z,
1673
- {
1674
- size: "sm",
1675
- intent: "ghost",
1676
- icon: /* @__PURE__ */ t(_i, {}),
1677
- "aria-label": l("editor.highlightColor", "Highlight"),
1678
- onMouseDown: (b) => {
1679
- b.preventDefault(), a();
1680
- }
1681
- }
1682
- ) }),
1683
- /* @__PURE__ */ C(le.Content, { side: "bottom", align: "start", children: [
1684
- /* @__PURE__ */ t(le.Heading, { children: l("editor.highlightColor", "Highlight") }),
1685
- /* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
1686
- tr,
1687
- {
1688
- variant: "inline",
1689
- size: "sm",
1690
- value: h,
1691
- onChange: y
1692
- }
1693
- ) }),
1694
- /* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(ze, { size: "sm", intent: "secondary", onClick: w, children: l("editor.highlight.remove", "Remove highlight") }) })
1695
- ] })
1696
- ] });
1697
- }
1698
- function Ns(n, a) {
1699
- const u = Array.from({ length: a }, () => "<td><br></td>").join("");
1700
- return `<table><tbody>${Array.from({ length: n }, () => `<tr>${u}</tr>`).join("")}</tbody></table>`;
1701
- }
1702
- function Ts({
1703
- run: n,
1704
- insertTable: a,
1705
- active: u
1706
- }) {
1707
- const { t: l } = ie("ui"), [h, g] = T({ r: 0, c: 0 }), [y, w] = T(!1), b = u.has("table") || y, p = /* @__PURE__ */ t(
1708
- Z,
1709
- {
1710
- size: "sm",
1711
- intent: "ghost",
1712
- icon: /* @__PURE__ */ t(Ua, {}),
1713
- "aria-label": l("editor.table.insert", "Insert table"),
1714
- onMouseDown: (E) => E.preventDefault()
1715
- }
1716
- );
1717
- return b ? /* @__PURE__ */ C(G.Root, { open: y, onOpenChange: w, children: [
1718
- /* @__PURE__ */ t(G.Trigger, { asChild: !0, children: p }),
1719
- /* @__PURE__ */ t(G.Content, { side: "bottom", align: "start", children: po.map((E) => /* @__PURE__ */ t(
1720
- G.Item,
1721
- {
1722
- startIcon: E.icon,
1723
- onSelect: () => n(E.command),
1724
- children: l(E.label[0], E.label[1])
1725
- },
1726
- E.id
1727
- )) })
1728
- ] }) : /* @__PURE__ */ C(le, { onOpenChange: (E) => !E && g({ r: 0, c: 0 }), children: [
1729
- /* @__PURE__ */ t(le.Trigger, { asChild: !0, children: p }),
1730
- /* @__PURE__ */ C(le.Content, { side: "bottom", align: "start", children: [
1731
- /* @__PURE__ */ t(le.Heading, { children: l("editor.table.insert", "Insert table") }),
1732
- /* @__PURE__ */ t(
1733
- "div",
1734
- {
1735
- role: "group",
1736
- "aria-label": l("editor.table.sizePicker", "Table size"),
1737
- className: "ds:mt-[var(--spacing-sm)] ds:grid ds:w-fit ds:grid-cols-6 ds:gap-[var(--spacing-2xs)]",
1738
- onMouseLeave: () => g({ r: 0, c: 0 }),
1739
- children: Array.from({ length: dn * dn }, (E, M) => {
1740
- const S = Math.floor(M / dn) + 1, z = M % dn + 1, j = S <= h.r && z <= h.c;
1741
- return /* @__PURE__ */ t(
1742
- "button",
1743
- {
1744
- type: "button",
1745
- "aria-label": l("editor.table.sizeCell", "{{r}}×{{c}}", {
1746
- r: S,
1747
- c: z
1748
- }),
1749
- onMouseEnter: () => g({ r: S, c: z }),
1750
- onClick: () => a(Ns(S, z)),
1751
- className: `ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ${j ? "ds:bg-[var(--primary)]" : "ds:bg-[var(--muted)]"}`
1752
- },
1753
- M
1754
- );
1755
- })
1756
- }
1757
- ),
1758
- /* @__PURE__ */ t("p", { className: "ds:mt-[var(--spacing-xs)] ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: h.r > 0 ? l("editor.table.sizeCell", "{{r}}×{{c}}", {
1759
- r: h.r,
1760
- c: h.c
1761
- }) : l("editor.table.sizeHint", "Pick a size") })
1762
- ] })
1763
- ] });
1764
- }
1765
- const Es = Object.fromEntries(po.map((n) => [n.id, n])), Ms = [
1766
- "ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1767
- "ds:[inset-block-start:var(--rte-tt-top)] ds:[inset-inline-start:var(--rte-tt-start)]",
1768
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1769
- "ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
1770
- ].join(" "), Rs = "#fde68a";
1771
- function Jr({
1772
- scope: n,
1773
- icon: a,
1774
- label: u,
1775
- onOpenChange: l,
1776
- saveTableCell: h,
1777
- applyTableBackground: g
1778
- }) {
1779
- const { t: y } = ie("ui"), [w, b] = T(Rs);
1780
- return /* @__PURE__ */ C(
1781
- le,
1782
- {
1783
- onOpenChange: (p) => {
1784
- l(p), p && h();
1785
- },
1786
- children: [
1787
- /* @__PURE__ */ t(le.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1788
- Z,
1789
- {
1790
- size: "sm",
1791
- intent: "ghost",
1792
- icon: a,
1793
- tooltip: u,
1794
- onMouseDown: (p) => p.preventDefault()
1795
- }
1796
- ) }),
1797
- /* @__PURE__ */ C(le.Content, { side: "bottom", align: "center", children: [
1798
- /* @__PURE__ */ t(
1799
- tr,
1800
- {
1801
- variant: "inline",
1802
- size: "sm",
1803
- value: w,
1804
- onChange: (p) => {
1805
- b(p), g(n, p);
1806
- }
1807
- }
1808
- ),
1809
- /* @__PURE__ */ t(
1810
- ze,
1811
- {
1812
- size: "sm",
1813
- intent: "ghost",
1814
- className: "ds:mt-[var(--spacing-xs)] ds:w-full",
1815
- onClick: () => g(n, null),
1816
- children: y("editor.table.clearColor", "Clear colour")
1817
- }
1818
- )
1819
- ] })
1820
- ]
1821
- }
1822
- );
1823
- }
1824
- function Ss({
1825
- active: n,
1826
- run: a,
1827
- areaRef: u,
1828
- getActiveTableEl: l,
1829
- enableColor: h = !1,
1830
- saveTableCell: g,
1831
- applyTableBackground: y
1832
- }) {
1833
- const { t: w } = ie("ui"), b = n.has("table"), [p, E] = T(null), M = x(0), [S, z] = T(!1), j = A((m) => {
1834
- M.current = Math.max(
1835
- 0,
1836
- M.current + (m ? 1 : -1)
1837
- ), z(M.current > 0);
1838
- }, []);
1839
- if (I(() => {
1840
- if (S) return;
1841
- if (!b || typeof window > "u") {
1842
- E(null);
1843
- return;
1844
- }
1845
- const m = () => {
1846
- const F = u.current, P = l();
1847
- if (!F || !P) {
1848
- E(null);
1849
- return;
1850
- }
1851
- const X = F.getBoundingClientRect(), q = P.getBoundingClientRect(), k = getComputedStyle(F).direction === "rtl", oe = Math.max(0, q.top - X.top - 44), Q = k ? X.right - q.right + q.width / 2 : q.left - X.left + q.width / 2;
1852
- E({ top: oe, start: Math.max(0, Q), rtl: k });
1853
- };
1854
- m();
1855
- const v = new ResizeObserver(m), L = u.current, H = l();
1856
- return L && v.observe(L), H && v.observe(H), window.addEventListener("scroll", m, !0), window.addEventListener("resize", m), () => {
1857
- v.disconnect(), window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", m);
1858
- };
1859
- }, [b, S, u, l]), !b && !S || !p) return null;
1860
- const f = [
1861
- ["rowAbove", "rowBelow"],
1862
- ["colLeft", "colRight"],
1863
- ["addHead"],
1864
- ...h ? ["colour"] : [],
1865
- ["deleteRow", "deleteColumn"],
1866
- ["deleteTable"]
1867
- ];
1868
- return (
1869
- // Tooltips disambiguate the icon-only ops on hover (and provide each
1870
- // button's accessible name via IconButton's `tooltip` prop). Radix Tooltip
1871
- // needs a provider ancestor, so scope one to the bar.
1872
- /* @__PURE__ */ t(er, { children: /* @__PURE__ */ t(
1873
- "div",
1874
- {
1875
- role: "group",
1876
- "aria-label": w("editor.table.toolbar", "Table tools"),
1877
- className: `${Ms} ${p.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
1878
- style: {
1879
- "--rte-tt-top": `${p.top}px`,
1880
- "--rte-tt-start": `${p.start}px`
1881
- },
1882
- children: f.map((m, v) => /* @__PURE__ */ C(Ct, { children: [
1883
- v > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: gn }) : null,
1884
- m === "colour" ? /* @__PURE__ */ C(je, { children: [
1885
- /* @__PURE__ */ t(
1886
- Jr,
1887
- {
1888
- scope: "cell",
1889
- icon: /* @__PURE__ */ t(Ca, {}),
1890
- label: w("editor.table.cellColor", "Cell colour"),
1891
- onOpenChange: j,
1892
- saveTableCell: g,
1893
- applyTableBackground: y
1894
- }
1895
- ),
1896
- /* @__PURE__ */ t(
1897
- Jr,
1898
- {
1899
- scope: "row",
1900
- icon: /* @__PURE__ */ t(Na, {}),
1901
- label: w("editor.table.rowColor", "Row colour"),
1902
- onOpenChange: j,
1903
- saveTableCell: g,
1904
- applyTableBackground: y
1905
- }
1906
- )
1907
- ] }) : m.map((L) => {
1908
- const H = Es[L];
1909
- return /* @__PURE__ */ t(
1910
- Z,
1911
- {
1912
- size: "sm",
1913
- intent: "ghost",
1914
- icon: H.icon,
1915
- tooltip: w(H.label[0], H.label[1]),
1916
- onMouseDown: (F) => F.preventDefault(),
1917
- onClick: () => a(H.command)
1918
- },
1919
- L
1920
- );
1921
- })
1922
- ] }, m === "colour" ? "colour" : m[0]))
1923
- }
1924
- ) })
1925
- );
1926
- }
1927
- const Zn = [
1928
- "wysiwyg-img-inline",
1929
- "wysiwyg-img-wrap-left",
1930
- "wysiwyg-img-wrap-right"
1931
- ], vo = [
1932
- "wysiwyg-img-align-left",
1933
- "wysiwyg-img-align-center",
1934
- "wysiwyg-img-align-right"
1935
- ];
1936
- function Yr(n, a) {
1937
- return a.find((u) => n.classList.contains(u)) ?? "";
1938
- }
1939
- function zs(n) {
1940
- const a = n.closest(".redactor-in"), u = a instanceof HTMLElement ? a.clientWidth : 0, l = n.getBoundingClientRect().width;
1941
- return u <= 0 || l <= 0 ? Ot : Math.round(Math.min(Ot, l / u * 100));
1942
- }
1943
- const Qn = 10, Ot = 100, Ls = 5, _s = 10, eo = (n) => Math.min(Ot, Math.max(Qn, Math.round(n))), Is = [
1944
- {
1945
- id: "wysiwyg-img-inline",
1946
- icon: /* @__PURE__ */ t(Gi, {}),
1947
- label: ["editor.image.inline", "Inline with text"]
1948
- },
1949
- {
1950
- id: "wysiwyg-img-wrap-left",
1951
- icon: /* @__PURE__ */ t(Ra, {}),
1952
- label: ["editor.image.wrapLeft", "Wrap left"]
1953
- },
1954
- {
1955
- id: "wysiwyg-img-wrap-right",
1956
- icon: /* @__PURE__ */ t(za, {}),
1957
- label: ["editor.image.wrapRight", "Wrap right"]
1958
- }
1959
- ], Hs = [
1960
- {
1961
- id: "wysiwyg-img-align-left",
1962
- icon: /* @__PURE__ */ t(mo, {}),
1963
- label: ["editor.image.alignLeft", "Align left"]
1964
- },
1965
- {
1966
- id: "wysiwyg-img-align-center",
1967
- icon: /* @__PURE__ */ t(co, {}),
1968
- label: ["editor.image.alignCenter", "Align centre"]
1969
- },
1970
- {
1971
- id: "wysiwyg-img-align-right",
1972
- icon: /* @__PURE__ */ t(uo, {}),
1973
- label: ["editor.image.alignRight", "Align right"]
1974
- }
1975
- ], $s = [
1976
- {
1977
- id: "tl",
1978
- pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
1979
- cursor: "ds:cursor-nwse-resize",
1980
- sign: -1,
1981
- labelKey: "editor.image.resizeTopStart",
1982
- labelFallback: "Resize image, top-start corner"
1983
- },
1984
- {
1985
- id: "tr",
1986
- pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
1987
- cursor: "ds:cursor-nesw-resize",
1988
- sign: 1,
1989
- labelKey: "editor.image.resizeTopEnd",
1990
- labelFallback: "Resize image, top-end corner"
1991
- },
1992
- {
1993
- id: "bl",
1994
- pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
1995
- cursor: "ds:cursor-nesw-resize",
1996
- sign: -1,
1997
- labelKey: "editor.image.resizeBottomStart",
1998
- labelFallback: "Resize image, bottom-start corner"
1999
- },
2000
- {
2001
- id: "br",
2002
- pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
2003
- cursor: "ds:cursor-nwse-resize",
2004
- sign: 1,
2005
- labelKey: "editor.image.resizeBottomEnd",
2006
- labelFallback: "Resize image, bottom-end corner"
2007
- }
2008
- ], Os = [
2009
- "ds:absolute ds:z-20 ds:pointer-events-none",
2010
- "ds:[inset-block-start:var(--rte-img-top)] ds:[inset-inline-start:var(--rte-img-start)]",
2011
- "ds:[inline-size:var(--rte-img-width)] ds:[block-size:var(--rte-img-height)]",
2012
- "ds:rounded-[var(--radius-2xs)]",
2013
- "ds:[outline-style:solid] ds:[outline-width:var(--border-width-md)]",
2014
- "ds:[outline-color:var(--accent)] ds:[outline-offset:var(--focus-ring-offset)]"
2015
- ].join(" "), Ds = [
2016
- "ds:absolute ds:pointer-events-auto ds:touch-none",
2017
- "ds:[inline-size:var(--spacing-md)] ds:[block-size:var(--spacing-md)]",
2018
- "ds:rounded-[var(--radius-2xs)] ds:shadow-[var(--shadow-sm)]",
2019
- "ds:bg-[var(--accent)] ds:border ds:border-[color:var(--background)]",
2020
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
2021
- "ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)]",
2022
- "ds:focus-visible:[outline-offset:var(--focus-ring-offset)]",
2023
- "ds:forced-colors:bg-[CanvasText]"
2024
- ].join(" "), Ps = [
2025
- "ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
2026
- "ds:[inset-block-start:var(--rte-img-bar-top)] ds:[inset-inline-start:var(--rte-img-center)]",
2027
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
2028
- "ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
2029
- ].join(" ");
2030
- function qs({
2031
- areaRef: n,
2032
- activeImageEl: a,
2033
- applyImageClass: u,
2034
- setImageWidth: l
2035
- }) {
2036
- const { t: h } = ie("ui"), [g, y] = T(null), w = x(null);
2037
- I(() => {
2038
- if (!a || typeof window > "u") {
2039
- y(null);
2040
- return;
2041
- }
2042
- const f = () => {
2043
- const F = n.current;
2044
- if (!F) {
2045
- y(null);
2046
- return;
2047
- }
2048
- const P = F.getBoundingClientRect(), X = a.getBoundingClientRect(), q = getComputedStyle(F).direction === "rtl", k = X.top - P.top, oe = q ? P.right - X.right : X.left - P.left, Q = oe + X.width / 2, ae = Math.max(0, k - 44);
2049
- y({
2050
- top: k,
2051
- start: Math.max(0, oe),
2052
- width: X.width,
2053
- height: X.height,
2054
- center: Math.max(0, Q),
2055
- barTop: ae,
2056
- pct: zs(a),
2057
- rtl: q
2058
- });
2059
- };
2060
- f();
2061
- const m = new ResizeObserver(f);
2062
- m.observe(a);
2063
- const v = n.current;
2064
- v && m.observe(v);
2065
- const L = a.closest(".redactor-in");
2066
- let H = null;
2067
- return L && (H = new MutationObserver(f), H.observe(L, {
2068
- subtree: !0,
2069
- childList: !0,
2070
- characterData: !0,
2071
- attributes: !0,
2072
- attributeFilter: ["class", "style", "width", "height", "src"]
2073
- })), window.addEventListener("scroll", f, !0), window.addEventListener("resize", f), () => {
2074
- m.disconnect(), H == null || H.disconnect(), window.removeEventListener("scroll", f, !0), window.removeEventListener("resize", f);
2075
- };
2076
- }, [a, n]);
2077
- const b = A(
2078
- (f) => (m) => {
2079
- !m.isPrimary || !g || (m.preventDefault(), m.currentTarget.setPointerCapture(m.pointerId), w.current = {
2080
- pointerId: m.pointerId,
2081
- startX: m.clientX,
2082
- startPct: g.pct,
2083
- sign: f.sign * (g.rtl ? -1 : 1)
2084
- });
2085
- },
2086
- [g]
2087
- ), p = A(
2088
- (f) => {
2089
- const m = w.current;
2090
- if (!m || f.pointerId !== m.pointerId || !a) return;
2091
- const v = a.closest(".redactor-in"), L = v instanceof HTMLElement ? v.clientWidth : 0;
2092
- if (L <= 0) return;
2093
- const H = m.sign * (f.clientX - m.startX) / L * 100;
2094
- l(eo(m.startPct + H));
2095
- },
2096
- [a, l]
2097
- ), E = A(
2098
- (f) => {
2099
- const m = w.current;
2100
- !m || f.pointerId !== m.pointerId || (f.currentTarget.releasePointerCapture(f.pointerId), w.current = null);
2101
- },
2102
- []
2103
- ), M = A(
2104
- (f) => {
2105
- if (!g) return;
2106
- let m = null;
2107
- const v = f.shiftKey ? _s : Ls;
2108
- switch (f.key) {
2109
- // Up / right always grow; down / left always shrink — independent of
2110
- // which corner has focus, so the gesture reads the same everywhere.
2111
- case "ArrowRight":
2112
- case "ArrowUp":
2113
- m = g.pct + v;
2114
- break;
2115
- case "ArrowLeft":
2116
- case "ArrowDown":
2117
- m = g.pct - v;
2118
- break;
2119
- case "Home":
2120
- m = Qn;
2121
- break;
2122
- case "End":
2123
- m = Ot;
2124
- break;
2125
- default:
2126
- return;
2127
- }
2128
- f.preventDefault(), l(eo(m));
2129
- },
2130
- [g, l]
2131
- );
2132
- if (!a || !g) return null;
2133
- const S = Yr(a, Zn), z = Yr(a, vo), j = h("editor.image.widthAnnounce", {
2134
- width: g.pct,
2135
- defaultValue: "{{width}} percent"
2136
- });
2137
- return /* @__PURE__ */ C(je, { children: [
2138
- /* @__PURE__ */ t(
2139
- "div",
2140
- {
2141
- className: Os,
2142
- style: {
2143
- "--rte-img-top": `${g.top}px`,
2144
- "--rte-img-start": `${g.start}px`,
2145
- "--rte-img-width": `${g.width}px`,
2146
- "--rte-img-height": `${g.height}px`
2147
- },
2148
- children: $s.map((f) => /* @__PURE__ */ t(
2149
- "div",
2150
- {
2151
- role: "slider",
2152
- tabIndex: 0,
2153
- "aria-label": h(f.labelKey, f.labelFallback),
2154
- "aria-orientation": "horizontal",
2155
- "aria-valuemin": Qn,
2156
- "aria-valuemax": Ot,
2157
- "aria-valuenow": g.pct,
2158
- "aria-valuetext": j,
2159
- className: `${Ds} ${f.pos} ${f.cursor}`,
2160
- onPointerDown: b(f),
2161
- onPointerMove: p,
2162
- onPointerUp: E,
2163
- onPointerCancel: E,
2164
- onKeyDown: M
2165
- },
2166
- f.id
2167
- ))
2168
- }
2169
- ),
2170
- /* @__PURE__ */ t(er, { children: /* @__PURE__ */ t(
2171
- "div",
2172
- {
2173
- role: "group",
2174
- "aria-label": h("editor.image.toolbar", "Image tools"),
2175
- className: `${Ps} ${g.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
2176
- style: {
2177
- "--rte-img-bar-top": `${g.barTop}px`,
2178
- "--rte-img-center": `${g.center}px`
2179
- },
2180
- children: [Is, Hs].map((f, m) => /* @__PURE__ */ C(Ct, { children: [
2181
- m > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: gn }) : null,
2182
- f.map((v) => {
2183
- const L = m === 0 ? S === v.id : z === v.id;
2184
- return /* @__PURE__ */ t(
2185
- Z,
2186
- {
2187
- size: "sm",
2188
- intent: "ghost",
2189
- icon: v.icon,
2190
- "aria-pressed": L,
2191
- tooltip: h(v.label[0], v.label[1]),
2192
- onMouseDown: (H) => H.preventDefault(),
2193
- onClick: () => u(v.id)
2194
- },
2195
- v.id
2196
- );
2197
- })
2198
- ] }, m === 0 ? "flow" : "align"))
2199
- }
2200
- ) })
2201
- ] });
2202
- }
2203
- function Bs({
2204
- templates: n,
2205
- onPick: a,
2206
- onManage: u,
2207
- noteEmpty: l,
2208
- onOpenChange: h,
2209
- trigger: g,
2210
- side: y = "top"
2211
- }) {
2212
- const { t: w } = ie("ui"), b = Ve();
2213
- return /* @__PURE__ */ C(G.Root, { onOpenChange: h, children: [
2214
- /* @__PURE__ */ t(G.Trigger, { asChild: !0, children: g }),
2215
- /* @__PURE__ */ C(G.Content, { side: y, align: "end", sideOffset: 8, children: [
2216
- /* @__PURE__ */ t(G.Label, { children: n.length > 0 ? w("editor.ai.templatesGroup") : w("editor.ai.noTemplates") }),
2217
- n.map((p) => /* @__PURE__ */ t(
2218
- G.Item,
2219
- {
2220
- startIcon: /* @__PURE__ */ t(Wn, {}),
2221
- description: p.description || void 0,
2222
- "aria-disabled": l || void 0,
2223
- "aria-describedby": l ? b : void 0,
2224
- className: "ds:aria-disabled:opacity-50 ds:aria-disabled:cursor-not-allowed",
2225
- onSelect: (E) => {
2226
- if (l) {
2227
- E.preventDefault();
2228
- return;
2229
- }
2230
- a(p);
2231
- },
2232
- children: p.name
2233
- },
2234
- p.id
2235
- )),
2236
- l && n.length > 0 ? /* @__PURE__ */ t(
2237
- "p",
2238
- {
2239
- id: b,
2240
- className: "ds:m-0 ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] ds:text-[length:var(--font-size-xs)] ds:text-[color:var(--muted-foreground)]",
2241
- children: w("editor.ai.templatesNoteEmpty")
2242
- }
2243
- ) : null,
2244
- u && n.length === 0 ? /* @__PURE__ */ t(
2245
- G.Item,
2246
- {
2247
- startIcon: /* @__PURE__ */ t(Hi, {}),
2248
- onSelect: () => u("create"),
2249
- children: w("editor.ai.createFirstTemplate")
2250
- }
2251
- ) : null,
2252
- u && n.length > 0 ? /* @__PURE__ */ C(je, { children: [
2253
- /* @__PURE__ */ t(G.Separator, {}),
2254
- /* @__PURE__ */ t(
2255
- G.Item,
2256
- {
2257
- startIcon: /* @__PURE__ */ t($i, {}),
2258
- onSelect: () => u("list"),
2259
- children: w("editor.ai.manageTemplates")
2260
- }
2261
- )
2262
- ] }) : null
2263
- ] })
2264
- ] });
2265
- }
2266
- const Fs = [
2267
- "ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
2268
- "ds:[inset-block-start:var(--rte-sel-top)] ds:[inset-inline-start:var(--rte-sel-start)]",
2269
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
2270
- "ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]",
2271
- bo
2272
- ].join(" "), js = ["bold", "italic", "underline", "strike"];
2273
- function Gs({
2274
- active: n,
2275
- run: a,
2276
- areaRef: u,
2277
- getEditorRoot: l,
2278
- suppressed: h = !1,
2279
- holdOpen: g = !1,
2280
- children: y
2281
- }) {
2282
- const { t: w } = ie("ui"), b = x(null), [p, E] = T(null), M = x(g);
2283
- return I(() => {
2284
- M.current = g;
2285
- }, [g]), I(() => {
2286
- if (h || typeof window > "u") {
2287
- E(null);
2288
- return;
2289
- }
2290
- let S = !1, z = 0, j = !1, f = !1;
2291
- const m = () => {
2292
- j = !1, E(null);
2293
- }, v = () => {
2294
- var ce;
2295
- if (M.current || S) return;
2296
- if (f) {
2297
- m();
2298
- return;
2299
- }
2300
- const q = u.current, k = l(), oe = window.getSelection();
2301
- if (!q || !k || !oe || oe.rangeCount === 0 || oe.isCollapsed || !q.contains(document.activeElement)) {
2302
- m();
2303
- return;
2304
- }
2305
- const Q = oe.getRangeAt(0);
2306
- if (!k.contains(Q.commonAncestorContainer)) {
2307
- m();
2308
- return;
2309
- }
2310
- if (!Q.toString().trim()) {
2311
- m();
2312
- return;
2313
- }
2314
- const ae = q.getBoundingClientRect(), de = Q.getBoundingClientRect(), J = getComputedStyle(q).direction === "rtl", Le = de.top - ae.top - 48, W = Le >= 0 ? Le : de.bottom - ae.top + 8, we = ((ce = b.current) == null ? void 0 : ce.offsetWidth) ?? 0, se = J ? ae.right - de.right + de.width / 2 : de.left - ae.left + de.width / 2, Y = we / 2, U = Math.min(
2315
- Math.max(se, Y),
2316
- Math.max(Y, ae.width - Y)
2317
- );
2318
- E({ top: W, start: U, rtl: J }), we === 0 && !j && (j = !0, z = requestAnimationFrame(v));
2319
- }, L = () => {
2320
- cancelAnimationFrame(z), z = requestAnimationFrame(v);
2321
- }, H = (q) => {
2322
- const k = l();
2323
- k && q.target instanceof Node && k.contains(q.target) && (S = !0, m());
2324
- }, F = () => {
2325
- S && (S = !1, L());
2326
- }, P = (q) => {
2327
- if (q.key !== "Escape") return;
2328
- const k = u.current;
2329
- !k || !k.contains(document.activeElement) || (f = !0, m());
2330
- }, X = () => {
2331
- f = !1, L();
2332
- };
2333
- return document.addEventListener("selectionchange", X), document.addEventListener("focusin", L), document.addEventListener("keydown", P, !0), document.addEventListener("pointerdown", H, !0), document.addEventListener("pointerup", F, !0), document.addEventListener("pointercancel", F, !0), window.addEventListener("scroll", L, !0), window.addEventListener("resize", L), L(), () => {
2334
- cancelAnimationFrame(z), document.removeEventListener("selectionchange", X), document.removeEventListener("focusin", L), document.removeEventListener("keydown", P, !0), document.removeEventListener("pointerdown", H, !0), document.removeEventListener("pointerup", F, !0), document.removeEventListener("pointercancel", F, !0), window.removeEventListener("scroll", L, !0), window.removeEventListener("resize", L);
2335
- };
2336
- }, [h, u, l]), h || !p ? null : /* @__PURE__ */ t(er, { children: /* @__PURE__ */ C(
2337
- "div",
2338
- {
2339
- ref: b,
2340
- role: "group",
2341
- "aria-label": w("editor.ai.selectionTools"),
2342
- "data-component-part": "selection-toolbar",
2343
- className: `${Fs} ${p.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
2344
- style: {
2345
- "--rte-sel-top": `${p.top}px`,
2346
- "--rte-sel-start": `${p.start}px`
2347
- },
2348
- children: [
2349
- js.map((S) => {
2350
- const z = go[S];
2351
- return /* @__PURE__ */ t(
2352
- Z,
2353
- {
2354
- size: "sm",
2355
- intent: "ghost",
2356
- icon: z.icon,
2357
- tooltip: w(z.label[0], z.label[1]),
2358
- "aria-pressed": z.toggle ? n.has(z.toggle) : void 0,
2359
- onMouseDown: (j) => j.preventDefault(),
2360
- onClick: () => a(...z.command)
2361
- },
2362
- S
2363
- );
2364
- }),
2365
- y ? /* @__PURE__ */ C(je, { children: [
2366
- /* @__PURE__ */ t("span", { "aria-hidden": "true", className: gn }),
2367
- y
2368
- ] }) : null
2369
- ]
2370
- }
2371
- ) });
2372
- }
2373
- function Ks({
2374
- run: n,
2375
- active: a,
2376
- preset: u,
2377
- insertHtml: l,
2378
- insertTable: h,
2379
- saveSelection: g,
2380
- restoreSelection: y,
2381
- getSelectedText: w,
2382
- uploadImage: b,
2383
- enableColor: p = !1,
2384
- enableFontSize: E = !1,
2385
- enableImage: M = !1,
2386
- enableTable: S = !1,
2387
- showExtensions: z = !1,
2388
- extensionControl: j,
2389
- variables: f,
2390
- recentVariableTokens: m,
2391
- insertVariable: v
2392
- }) {
2393
- const { t: L } = ie("ui"), H = (Y) => Y.preventDefault(), F = (Y) => fs[u].includes(Y), P = (Y) => {
2394
- if (!F(Y)) return null;
2395
- const U = go[Y], ce = U.needs ? !U.needs.some((We) => a.has(We)) : !1;
2396
- return /* @__PURE__ */ t(
2397
- Z,
2398
- {
2399
- size: "sm",
2400
- intent: "ghost",
2401
- icon: U.icon,
2402
- "aria-label": L(U.label[0], U.label[1]),
2403
- "aria-pressed": U.toggle ? a.has(U.toggle) : void 0,
2404
- "aria-disabled": ce || void 0,
2405
- onMouseDown: H,
2406
- onClick: () => {
2407
- ce || n(...U.command);
2408
- }
2409
- },
2410
- U.id
2411
- );
2412
- }, X = () => /* @__PURE__ */ t("span", { "aria-hidden": "true", className: gn }), q = F("format"), k = [P("undo"), P("redo")].filter(Boolean), oe = [
2413
- P("bold"),
2414
- P("italic"),
2415
- P("underline"),
2416
- P("strike"),
2417
- E ? /* @__PURE__ */ t(xs, { run: n, onTriggerDown: H }, "font-size") : null,
2418
- p ? /* @__PURE__ */ t(
2419
- Cs,
2420
- {
2421
- run: n,
2422
- saveSelection: g,
2423
- restoreSelection: y
2424
- },
2425
- "colour"
2426
- ) : null,
2427
- p ? /* @__PURE__ */ t(
2428
- As,
2429
- {
2430
- run: n,
2431
- saveSelection: g,
2432
- restoreSelection: y
2433
- },
2434
- "highlight"
2435
- ) : null
2436
- ].filter(Boolean), Q = k.length > 0 || q || oe.length > 0, ae = F("align") ? [
2437
- /* @__PURE__ */ t(
2438
- ys,
2439
- {
2440
- run: n,
2441
- active: a,
2442
- onTriggerDown: H
2443
- },
2444
- "align"
2445
- )
2446
- ] : [], de = [
2447
- P("ul"),
2448
- P("ol"),
2449
- P("outdent"),
2450
- P("indent")
2451
- ].filter(Boolean), J = [
2452
- F("link") ? /* @__PURE__ */ t(
2453
- ws,
2454
- {
2455
- insertHtml: l,
2456
- saveSelection: g,
2457
- restoreSelection: y,
2458
- getSelectedText: w
2459
- },
2460
- "link"
2461
- ) : null,
2462
- M ? /* @__PURE__ */ t(
2463
- ks,
2464
- {
2465
- insertHtml: l,
2466
- saveSelection: g,
2467
- restoreSelection: y,
2468
- uploadImage: b
2469
- },
2470
- "image"
2471
- ) : null,
2472
- S ? /* @__PURE__ */ t(
2473
- Ts,
2474
- {
2475
- run: n,
2476
- insertTable: h,
2477
- active: a
2478
- },
2479
- "table"
2480
- ) : null,
2481
- P("line"),
2482
- f && f.length > 0 && v ? /* @__PURE__ */ t(
2483
- bs,
2484
- {
2485
- variables: f,
2486
- recentVariableTokens: m,
2487
- insertVariable: v,
2488
- saveSelection: g
2489
- },
2490
- "variables"
2491
- ) : null
2492
- ].filter(Boolean), Le = j ? [/* @__PURE__ */ t(Ct, { children: j }, "extensions")] : z ? [
2493
- /* @__PURE__ */ t(
2494
- Z,
2495
- {
2496
- size: "sm",
2497
- intent: "ghost",
2498
- icon: /* @__PURE__ */ t(Xn, {}),
2499
- "aria-label": L("editor.extensions", "Editor extensions"),
2500
- disabled: !0,
2501
- onMouseDown: H
2502
- },
2503
- "extensions"
2504
- )
2505
- ] : [], W = [
2506
- ae,
2507
- de,
2508
- J,
2509
- Le
2510
- ].filter((Y) => Y.length > 0), we = W.length > 0, se = (Y) => W.map((U, ce) => /* @__PURE__ */ C(Ct, { children: [
2511
- ce > 0 || Y ? /* @__PURE__ */ t(X, {}) : null,
2512
- U
2513
- ] }, ce));
2514
- return (
2515
- // Outer element is the query container + visual chrome; the flex row is an
2516
- // inner child so `container-type` never lands on the flex parent (which
2517
- // would blockify the inline controls).
2518
- /* @__PURE__ */ t("div", { className: hs(), "data-component": "editor-toolbar", children: /* @__PURE__ */ C(
2519
- "div",
2520
- {
2521
- role: "group",
2522
- "aria-label": L("editor.toolbarLabel"),
2523
- className: gs,
2524
- children: [
2525
- k,
2526
- k.length > 0 && (q || oe.length > 0) ? /* @__PURE__ */ t(X, {}) : null,
2527
- q ? /* @__PURE__ */ t(vs, { run: n, active: a, onTriggerDown: H }) : null,
2528
- q && oe.length > 0 ? /* @__PURE__ */ t(X, {}) : null,
2529
- oe,
2530
- we ? /* @__PURE__ */ C(je, { children: [
2531
- /* @__PURE__ */ t("div", { className: "ds:hidden ds:@[384px]/toolbar:contents", children: se(Q) }),
2532
- /* @__PURE__ */ C("div", { className: "ds:contents ds:@[384px]/toolbar:hidden", children: [
2533
- Q ? /* @__PURE__ */ t(X, {}) : null,
2534
- /* @__PURE__ */ C(le, { children: [
2535
- /* @__PURE__ */ t(le.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
2536
- Z,
2537
- {
2538
- size: "sm",
2539
- intent: "ghost",
2540
- icon: /* @__PURE__ */ t(Li, {}),
2541
- "aria-label": L("editor.more", "More options"),
2542
- onMouseDown: H
2543
- }
2544
- ) }),
2545
- /* @__PURE__ */ t(le.Content, { side: "bottom", align: "end", children: /* @__PURE__ */ t("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: se(!1) }) })
2546
- ] })
2547
- ] })
2548
- ] }) : null
2549
- ]
2550
- }
2551
- ) })
2552
- );
2553
- }
2554
- function Se(n) {
2555
- return fi(n, "rich-text");
2556
- }
2557
- function un(n = "") {
2558
- const a = String(n).trim();
2559
- if (a === "" || a === "<p><br></p>" || a === "<p>&nbsp;</p>")
2560
- return "";
2561
- const u = a.replace(/<br\s*\/?>/gi, "").replace(/&nbsp;/gi, "").replace(/<[^>]+>/g, "").trim();
2562
- return u === "" && /<img\b[^>]*>/i.test(a) ? a : u === "" ? "" : a;
2563
- }
2564
- function to(n) {
2565
- return n.replace(
2566
- /<img(?![^>]*\sloading=)([^>]*)>/gi,
2567
- '<img loading="lazy"$1>'
2568
- );
2569
- }
2570
- const Vs = Un.join(", "), Ws = 10, jn = /^[A-Za-z0-9_]+$/, yo = /\[\[([A-Za-z0-9_]+)\]\]/g, Jn = "rte-variable-invalid", Xs = new RegExp(
2571
- `\\s*\\b${Jn}\\b`,
2572
- "g"
2573
- );
2574
- function no(n) {
2575
- const a = n.includes("data-rte-interim") ? n.replace(/<span\b[^>]*\bdata-rte-interim\b[^>]*>[^<]*<\/span>/g, "") : n;
2576
- return a.includes('data-redactor-type="variable"') ? a.replace(
2577
- /<span\b[^>]*data-redactor-type="variable"[^>]*>/g,
2578
- (u) => u.replace(/\s(?:data-label|title)="[^"]*"/g, "").replace(Xs, "").replace(/\sclass=""/g, "")
2579
- ) : a;
2580
- }
2581
- function Us(n) {
2582
- const a = n.replace(/<[^>]*>/g, " ");
2583
- return Array.from(a.matchAll(yo), (u) => u[1]);
2584
- }
2585
- function ro(n) {
2586
- return typeof n == "object" && n !== null && "name" in n && n.name === "AiCreditsExhaustedError";
2587
- }
2588
- function Zs(n) {
2589
- return typeof n == "object" && n !== null && "name" in n && n.name === "AbortError";
2590
- }
2591
- function Qs(n) {
2592
- const a = document.createElement("template");
2593
- return a.content.appendChild(n), a.innerHTML;
2594
- }
2595
- function oo(n) {
2596
- const a = document.createElement("template");
2597
- return a.innerHTML = n, (a.content.textContent ?? "").replace(/\s+/g, " ").trim();
2598
- }
2599
- function io(n) {
2600
- return n.replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, "").replace(/[\s\u200B\uFEFF]+/g, "");
2601
- }
2602
- function Js(n) {
2603
- const a = window.getSelection();
2604
- if (!a || a.rangeCount === 0) return null;
2605
- const u = a.getRangeAt(0);
2606
- if (!n.contains(u.startContainer)) return null;
2607
- const l = document.createRange();
2608
- return l.selectNodeContents(n), l.setEnd(u.startContainer, u.startOffset), l.toString().length;
2609
- }
2610
- function Ys(n, a) {
2611
- var g;
2612
- const u = window.getSelection();
2613
- if (!u) return;
2614
- const l = document.createTreeWalker(n, NodeFilter.SHOW_TEXT);
2615
- let h = 0;
2616
- for (let y = l.nextNode(); y; y = l.nextNode()) {
2617
- const w = y;
2618
- if (h + w.data.length >= a) {
2619
- const b = document.createRange(), p = (g = w.parentElement) == null ? void 0 : g.closest(
2620
- '[data-redactor-type="variable"]'
2621
- );
2622
- p ? b.setStartAfter(p) : b.setStart(w, a - h), b.collapse(!0), u.removeAllRanges(), u.addRange(b);
2623
- return;
2624
- }
2625
- h += w.data.length;
2626
- }
2627
- }
2628
- function ao(n) {
2629
- return `<span data-redactor-type="variable">[[${n}]]</span>`;
2630
- }
2631
- function xt(n, a) {
2632
- var y;
2633
- if (a.size === 0 || !n.includes("[[") || typeof DOMParser > "u")
2634
- return n;
2635
- const u = new DOMParser().parseFromString(
2636
- `<body>${n}</body>`,
2637
- "text/html"
2638
- ), l = u.createTreeWalker(u.body, NodeFilter.SHOW_TEXT), h = [];
2639
- for (let w = l.nextNode(); w; w = l.nextNode()) {
2640
- const b = w;
2641
- (y = b.parentElement) != null && y.closest('[data-redactor-type="variable"]') || b.data.includes("[[") && h.push(b);
2642
- }
2643
- let g = !1;
2644
- for (const w of h) {
2645
- const b = u.createDocumentFragment();
2646
- let p = 0;
2647
- for (const E of w.data.matchAll(yo)) {
2648
- const M = a.get(E[1].toLowerCase());
2649
- if (!M || E.index === void 0) continue;
2650
- b.append(w.data.slice(p, E.index));
2651
- const S = u.createElement("span");
2652
- S.setAttribute("data-redactor-type", "variable"), S.textContent = `[[${M}]]`, b.append(S), p = E.index + E[0].length;
2653
- }
2654
- p !== 0 && (b.append(w.data.slice(p)), w.replaceWith(b), g = !0);
2655
- }
2656
- return g ? u.body.innerHTML : n;
2657
- }
2658
- function el(n) {
2659
- if (!n || typeof n != "object") return;
2660
- const a = n, u = (l) => {
2661
- if (l && typeof l == "object" && "url" in l) {
2662
- const h = l.url;
2663
- return typeof h == "string" ? h : void 0;
2664
- }
2665
- };
2666
- return typeof a.url == "string" ? a.url : u(a.file) ?? u(a.data) ?? Object.values(a).map(u).find(Boolean);
2667
- }
2668
- function tl(n) {
2669
- if (n) return n;
2670
- if (typeof window > "u") return null;
2671
- const a = window;
2672
- return a.$R ?? a.Redactor ?? null;
2673
- }
2674
- const nl = {
2675
- bold: ["module.inline.format", { tag: "b" }],
2676
- italic: ["module.inline.format", { tag: "i" }],
2677
- strikethrough: ["module.inline.format", { tag: "del" }],
2678
- bulletedList: ["module.list.toggle", "ul"],
2679
- numberedList: ["module.list.toggle", "ol"],
2680
- heading: ["module.block.format", { tag: "h2" }],
2681
- quote: ["module.block.format", { tag: "blockquote" }],
2682
- paragraph: ["module.block.format", { tag: "p" }]
2683
- }, rl = {
2684
- zh: "zh_cn",
2685
- pt: "pt_br"
2686
- };
2687
- function ol(n) {
2688
- const a = n.split("-")[0];
2689
- return rl[a] ?? a ?? "en";
2690
- }
2691
- const il = At(
2692
- "redactor-theme-alfadocs ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"
2693
- ), al = [
2694
- "ds:absolute ds:z-30",
2695
- "ds:[inset-inline-start:var(--rte-typeahead-x)] ds:[inset-block-start:var(--rte-typeahead-y)]"
2696
- ].join(" "), sl = At(
2697
- [
2698
- "ds:block ds:[inline-size:100%]",
2699
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--control-border)]",
2700
- "ds:bg-[var(--background)] ds:text-[var(--foreground)]",
2701
- "ds:shadow-[var(--shadow-md)]",
2702
- "ds:font-[family-name:var(--font-sans)] ds:text-[length:var(--font-size-base)]",
2703
- "ds:p-[var(--spacing-md)] ds:[min-block-size:var(--rich-text-editor-min-block-size)]",
2704
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
2705
- "ds:focus-visible:outline-solid",
2706
- "ds:focus-visible:outline-[var(--ring)]",
2707
- "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
2708
- "ds:forced-colors:focus-visible:outline-[CanvasText]"
2709
- ].join(" ")
2710
- ), ll = so({ recording: !1 }), cl = so({ recording: !0 });
2711
- function mn(n, a) {
2712
- return a ? { "aria-label": n } : { tooltip: n };
2713
- }
2714
- const wo = ["kit", "marketplace"];
2715
- function dl({
2716
- groupedExtensions: n,
2717
- showExtensionGroups: a,
2718
- extensionPending: u,
2719
- extensionSession: l,
2720
- extensionError: h,
2721
- openExtension: g,
2722
- closeExtension: y,
2723
- saveSelection: w,
2724
- closeSignal: b,
2725
- restoreFocusOnCloseRef: p
2726
- }) {
2727
- const { t: E } = ie("ui"), [M, S] = T(!1), z = x(null), j = x(!1);
2728
- return I(() => {
2729
- S(!1);
2730
- }, [b]), I(() => {
2731
- j.current && !l && (j.current = !1, p.current && window.requestAnimationFrame(() => {
2732
- var f;
2733
- return (f = z.current) == null ? void 0 : f.focus();
2734
- }));
2735
- }, [l, p]), /* @__PURE__ */ C(
2736
- G.Root,
2737
- {
2738
- open: M,
2739
- onOpenChange: (f) => {
2740
- f ? (w(), S(!0)) : (S(!1), u && y());
2741
- },
2742
- children: [
2743
- /* @__PURE__ */ t(G.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
2744
- Z,
2745
- {
2746
- ref: z,
2747
- "data-component-part": "extensions-trigger",
2748
- size: "sm",
2749
- intent: "ghost",
2750
- icon: /* @__PURE__ */ t(Xn, {}),
2751
- "aria-label": E("editor.extensions"),
2752
- onPointerDown: () => w()
2753
- }
2754
- ) }),
2755
- /* @__PURE__ */ t(
2756
- G.Content,
2757
- {
2758
- align: "end",
2759
- onCloseAutoFocus: (f) => {
2760
- (l == null ? void 0 : l.extension.kind) === "panel" && !h && f.preventDefault();
2761
- },
2762
- children: n.map(
2763
- (f, m) => f.length > 0 ? /* @__PURE__ */ C(Ct, { children: [
2764
- a ? /* @__PURE__ */ t(G.Label, { children: E(
2765
- m === 0 ? "editor.extensionsKit" : "editor.extensionsMarketplace"
2766
- ) }) : null,
2767
- f.map((v) => {
2768
- var L;
2769
- return /* @__PURE__ */ C(
2770
- G.Item,
2771
- {
2772
- "data-extension-id": v.id,
2773
- disabled: u && (l == null ? void 0 : l.extension.id) !== v.id,
2774
- "aria-busy": u && (l == null ? void 0 : l.extension.id) === v.id || void 0,
2775
- onSelect: (H) => {
2776
- v.kind === "action" && H.preventDefault(), j.current = !0, g(v);
2777
- },
2778
- children: [
2779
- u && (l == null ? void 0 : l.extension.id) === v.id ? /* @__PURE__ */ t(Yn, { size: "sm" }) : v.icon ?? /* @__PURE__ */ t(Xn, {}),
2780
- /* @__PURE__ */ C("span", { className: "ds:flex ds:min-w-0 ds:flex-col ds:text-start", children: [
2781
- /* @__PURE__ */ t("span", { children: ho(E, v.label) }),
2782
- v.description ? /* @__PURE__ */ t("span", { className: "type-meta ds:text-muted-foreground", children: v.description }) : null,
2783
- ((L = v.source) == null ? void 0 : L.kind) === "marketplace" ? /* @__PURE__ */ C("span", { className: "type-meta ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-muted-foreground", children: [
2784
- v.source.appIconUrl ? /* @__PURE__ */ t(
2785
- "img",
2786
- {
2787
- src: v.source.appIconUrl,
2788
- alt: "",
2789
- className: "ds:size-[var(--spacing-md)]"
2790
- }
2791
- ) : null,
2792
- v.source.appName
2793
- ] }) : null
2794
- ] })
2795
- ]
2796
- },
2797
- v.id
2798
- );
2799
- })
2800
- ] }, wo[m]) : null
2801
- )
2802
- }
2803
- )
2804
- ]
2805
- }
2806
- );
2807
- }
2808
- const ul = di(
2809
- ({
2810
- id: n,
2811
- defaultValue: a,
2812
- value: u,
2813
- onChange: l,
2814
- toolbar: h = "standard",
2815
- placeholder: g,
2816
- readOnly: y = !1,
2817
- ariaLabel: w,
2818
- minHeight: b,
2819
- showExtensions: p,
2820
- extensions: E,
2821
- extensionContext: M,
2822
- onExtensionRun: S,
2823
- className: z,
2824
- redactor: j,
2825
- options: f,
2826
- plugins: m,
2827
- lang: v,
2828
- imageUploadUrl: L,
2829
- onUploadImage: H,
2830
- onKeyDown: F,
2831
- onRequestAiDraft: P,
2832
- aiDraftFormat: X = "html",
2833
- aiPrivacyNotice: q,
2834
- aiConsent: k,
2835
- aiConsentHeadingLevel: oe,
2836
- onDictate: Q,
2837
- onProofread: ae,
2838
- onAutoFormat: de,
2839
- aiTemplates: J,
2840
- onAiApplied: Le,
2841
- aiSparkle: W = !0,
2842
- selectionToolbar: we,
2843
- variables: se,
2844
- recentVariableTokens: Y,
2845
- onVariableInserted: U,
2846
- validateVariable: ce,
2847
- onVariableValidityChange: We,
2848
- renderHelpMeWrite: $e,
2849
- onAiCreditsExhausted: st,
2850
- aiCreditsNotice: xe
2851
- }, pn) => {
2852
- var Fr, jr;
2853
- const { t: $, i18n: Dt } = ie("ui"), Pt = Ve(), Me = yt(
2854
- () => `rte-${Pt.replace(/[^a-zA-Z0-9-_]/g, "")}`,
2855
- [Pt]
2856
- ), D = `#${Me}`, ee = x(null), _ = x(null), V = x(null), Ce = x(!1), ne = x(y), B = x(null), Ae = x(null), [ue, rr] = T(!1), [Xe, Ge] = T(!1), [Ne, or] = T(null), [bn, ir] = T(!1), [vn, yn] = T(!1), Nt = x(null), qt = x(S);
2857
- qt.current = S;
2858
- const Ue = x(null), [ko, xo] = T(0), ar = x(!0), wn = A((e = !0) => {
2859
- ar.current = e, xo((r) => r + 1);
2860
- }, []), kn = A(() => {
2861
- var e, r;
2862
- (e = Nt.current) == null || e.abort(), Nt.current = null, (r = Ue.current) == null || r.call(Ue, { status: "aborted" }), or(null), yn(!1), ir(!1);
2863
- }, []), Oe = A(
2864
- (e = !0) => {
2865
- kn(), wn(e);
2866
- },
2867
- [kn, wn]
2868
- );
2869
- I(
2870
- () => () => {
2871
- var e, r;
2872
- (e = Nt.current) == null || e.abort(), (r = Ue.current) == null || r.call(Ue, { status: "aborted" });
2873
- },
2874
- []
2875
- );
2876
- const [Co, Ao] = T(""), [No, To] = T(
2877
- "document"
2878
- ), [sr, Tt] = T(!1);
2879
- I(() => {
2880
- Xe || Tt(!1);
2881
- }, [Xe]);
2882
- const _e = x(st), xn = x($e), Cn = x(!!P);
2883
- I(() => {
2884
- _e.current = st, xn.current = $e, Cn.current = !!P;
2885
- }, [st, $e, P]);
2886
- const Bt = x(null), pe = yt(
2887
- () => new Map(
2888
- (se ?? []).map((e) => e.token).filter((e) => jn.test(e)).map((e) => [e.toLowerCase(), e])
2889
- ),
2890
- [se]
2891
- ), lr = yt(
2892
- () => new Map(
2893
- (se ?? []).map(
2894
- (e) => [e.token.toLowerCase(), e.label]
2895
- )
2896
- ),
2897
- [se]
2898
- ), lt = x(pe);
2899
- I(() => {
2900
- lt.current = pe;
2901
- }, [pe]);
2902
- const cr = yt(
2903
- () => (se ?? []).filter((e) => jn.test(e.token)),
2904
- [se]
2905
- ), An = x(ce);
2906
- I(() => {
2907
- An.current = ce;
2908
- }, [ce]);
2909
- const Nn = ce !== void 0, Tn = A(
2910
- (e) => Nn && An.current ? An.current(e) : pe.has(e.toLowerCase()),
2911
- [Nn, pe]
2912
- ), ct = pe.size > 0 || Nn, [dt, dr] = T([]), Ze = x(We);
2913
- I(() => {
2914
- Ze.current = We;
2915
- }, [We]);
2916
- const De = x(() => {
2917
- }), [En, Eo] = T(
2918
- () => /* @__PURE__ */ new Set()
2919
- ), Ft = x(null), [Mo, Ro] = T(
2920
- null
2921
- ), jt = A((e) => {
2922
- Ft.current = e, Ro(e);
2923
- }, []), Et = x(null), Gt = x(null), be = x(l), Kt = x(F);
2924
- I(() => {
2925
- be.current = l, Kt.current = F;
2926
- }, [l, F]);
2927
- const So = x(
2928
- (() => {
2929
- const e = u ?? a ?? "";
2930
- return e ? Se(e) : "";
2931
- })()
2932
- ), fe = A(() => {
2933
- var r;
2934
- const e = _.current;
2935
- if (e)
2936
- try {
2937
- const o = e(D, "source.getCode");
2938
- if (typeof o == "string") return no(o);
2939
- } catch {
2940
- }
2941
- return ((r = ee.current) == null ? void 0 : r.value) ?? "";
2942
- }, [D]);
2943
- I(() => {
2944
- De.current = () => {
2945
- var o;
2946
- if (!ct) {
2947
- dr((i) => i.length ? [] : i);
2948
- return;
2949
- }
2950
- const e = (o = B.current) == null ? void 0 : o.querySelector(".redactor-in");
2951
- e == null || e.querySelectorAll('[data-redactor-type="variable"]').forEach((i) => {
2952
- const c = /^\[\[([A-Za-z0-9_]+)\]\]$/.exec(
2953
- i.textContent ?? ""
2954
- ), s = !c || !Tn(c[1]);
2955
- i.classList.contains(Jn) !== s && i.classList.toggle(Jn, s);
2956
- const d = c ? lr.get(c[1].toLowerCase()) ?? c[1] : i.textContent ?? "";
2957
- i.getAttribute("data-label") !== d && i.setAttribute("data-label", d);
2958
- const N = i.textContent ?? "";
2959
- i.getAttribute("title") !== N && i.setAttribute("title", N);
2960
- });
2961
- const r = Array.from(
2962
- new Set(
2963
- Us(fe()).filter(
2964
- (i) => !Tn(i)
2965
- )
2966
- )
2967
- );
2968
- dr(
2969
- (i) => i.length === r.length && i.every((c, s) => c === r[s]) ? i : r
2970
- );
2971
- }, De.current();
2972
- }, [ct, Tn, lr, fe]), I(() => {
2973
- var o;
2974
- const r = ((o = B.current) == null ? void 0 : o.querySelector(".redactor-in")) ?? ee.current;
2975
- r && (dt.length > 0 ? (r.setAttribute("aria-invalid", "true"), r.setAttribute("aria-describedby", `${Me}-variables-error`)) : (r.removeAttribute("aria-invalid"), r.removeAttribute("aria-describedby")));
2976
- }, [dt, Me, ue]);
2977
- const Mn = x(!1);
2978
- I(() => {
2979
- var e, r;
2980
- ct ? (Mn.current = !0, (e = Ze.current) == null || e.call(Ze, dt)) : Mn.current && (Mn.current = !1, (r = Ze.current) == null || r.call(Ze, []));
2981
- }, [dt, ct]), I(() => {
2982
- ce && De.current();
2983
- }, [ce]);
2984
- const he = A(
2985
- (e, ...r) => {
2986
- const o = _.current;
2987
- if (!o) return !1;
2988
- const i = ne.current;
2989
- if (i)
2990
- try {
2991
- o(D, "disableReadOnly");
2992
- } catch {
2993
- }
2994
- try {
2995
- return o(D, e, ...r), !0;
2996
- } catch {
2997
- return !1;
2998
- } finally {
2999
- if (i)
3000
- try {
3001
- o(D, "enableReadOnly");
3002
- } catch {
3003
- }
3004
- }
3005
- },
3006
- [D]
3007
- ), ge = A(
3008
- (e, r) => {
3009
- var K;
3010
- const o = (r == null ? void 0 : r.asHtml) ?? !0, i = o ? Se(e) : e;
3011
- if (he(o ? "insertion.insertHtml" : "insertion.insertText", i)) return;
3012
- const s = ee.current;
3013
- if (!s) return;
3014
- const d = s.selectionStart ?? s.value.length, N = s.selectionEnd ?? s.value.length;
3015
- s.value = s.value.slice(0, d) + i + s.value.slice(N);
3016
- const R = d + i.length;
3017
- try {
3018
- s.setSelectionRange(R, R);
3019
- } catch {
3020
- }
3021
- (K = be.current) == null || K.call(be, { html: Se(s.value), markdown: "" });
3022
- },
3023
- [he]
3024
- ), Te = x(null), ve = A(() => {
3025
- var i;
3026
- const e = (i = B.current) == null ? void 0 : i.querySelector(".redactor-in"), r = typeof window < "u" ? window.getSelection() : null, o = /* @__PURE__ */ new Set();
3027
- if (e && r && r.anchorNode && e.contains(r.anchorNode) && typeof document.queryCommandState == "function") {
3028
- r.rangeCount > 0 && (Te.current = r.getRangeAt(0).cloneRange());
3029
- try {
3030
- document.queryCommandState("bold") && o.add("bold"), document.queryCommandState("italic") && o.add("italic"), document.queryCommandState("underline") && o.add("underline"), document.queryCommandState("strikeThrough") && o.add("strike"), document.queryCommandState("insertUnorderedList") && o.add("ul"), document.queryCommandState("insertOrderedList") && o.add("ol");
3031
- const c = String(
3032
- document.queryCommandValue("formatBlock") || ""
3033
- ).toLowerCase();
3034
- /^h[1-6]$/.test(c) ? (o.add("heading"), o.add(c)) : c === "blockquote" ? o.add("quote") : o.add("paragraph");
3035
- const s = r.anchorNode.nodeType === Node.TEXT_NODE ? r.anchorNode.parentElement : r.anchorNode;
3036
- s && e.contains(s) && s.closest("table") && o.add("table");
3037
- const d = s == null ? void 0 : s.closest(
3038
- "p, div, blockquote, pre, h1, h2, h3, h4, h5, h6, li, td, th"
3039
- );
3040
- if (d && e.contains(d) && d !== e) {
3041
- const N = getComputedStyle(d), R = N.direction === "rtl", K = N.textAlign.replace(/^-webkit-/, ""), re = R ? "right" : "left", Re = R ? "left" : "right", te = ["left", "center", "right", "justify"].includes(K) ? K : K === "end" ? Re : re;
3042
- o.add(`align-${te}`);
3043
- }
3044
- } catch {
3045
- }
3046
- }
3047
- Eo(
3048
- (c) => c.size === o.size && [...o].every((s) => c.has(s)) ? c : o
3049
- );
3050
- }, []), Qe = A(
3051
- (e, ...r) => {
3052
- he(e, ...r), typeof window < "u" ? window.requestAnimationFrame(() => ve()) : ve();
3053
- },
3054
- [he, ve]
3055
- );
3056
- I(() => {
3057
- const e = B.current;
3058
- if (!e) return;
3059
- const r = {
3060
- b: ["module.inline.format", { tag: "b" }],
3061
- i: ["module.inline.format", { tag: "i" }],
3062
- u: ["module.inline.format", { tag: "u" }]
3063
- }, o = (i) => {
3064
- if (!(i.metaKey || i.ctrlKey) || i.altKey || i.shiftKey || i.isComposing) return;
3065
- const c = r[i.key.toLowerCase()];
3066
- if (!c) return;
3067
- const s = e.querySelector(".redactor-in");
3068
- !s || !(i.target instanceof Node) || !s.contains(i.target) || ne.current || (i.preventDefault(), i.stopImmediatePropagation(), Qe(...c));
3069
- };
3070
- return e.addEventListener("keydown", o, !0), () => e.removeEventListener("keydown", o, !0);
3071
- }, [Qe]), I(() => {
3072
- const e = B.current;
3073
- if (!e) return;
3074
- let r;
3075
- const o = (c) => {
3076
- var R;
3077
- const s = (R = window.getSelection()) == null ? void 0 : R.anchorNode;
3078
- if (!s) return null;
3079
- const d = s.nodeType === Node.TEXT_NODE ? s.parentElement : s, N = (d == null ? void 0 : d.closest(Vs)) ?? null;
3080
- return N && N !== c && c.contains(N) ? N : null;
3081
- }, i = (c) => {
3082
- if (c.key !== "Enter" || c.shiftKey || c.isComposing)
3083
- return;
3084
- const s = e.querySelector(".redactor-in");
3085
- if (!s || !(c.target instanceof Node) || !s.contains(c.target) || ne.current)
3086
- return;
3087
- const d = o(s), N = d == null ? void 0 : d.style.textAlign;
3088
- if (!d || !N) return;
3089
- const R = d.tagName === "LI" ? d.style.listStylePosition : "";
3090
- clearTimeout(r), r = setTimeout(() => {
3091
- const K = o(s);
3092
- if (!K || K === d || K.style.textAlign) return;
3093
- K.style.textAlign = N, R && K.tagName === "LI" && (K.style.listStylePosition = R);
3094
- const re = _.current;
3095
- if (re)
3096
- try {
3097
- re(D, "broadcast", "hardsync");
3098
- } catch {
3099
- }
3100
- ve();
3101
- }, Ws);
3102
- };
3103
- return e.addEventListener("keydown", i, !0), () => {
3104
- clearTimeout(r), e.removeEventListener("keydown", i, !0);
3105
- };
3106
- }, [D, ve]);
3107
- const Je = A(
3108
- (e) => {
3109
- ge(e, { asHtml: !0 }), typeof window < "u" && window.requestAnimationFrame(() => ve());
3110
- },
3111
- [ge, ve]
3112
- ), [ut, Rn] = T(null), Vt = x(null), Sn = `${Me}-variables`, ur = x(null), [zn, zo] = T(void 0), Ie = A(() => {
3113
- Vt.current = null, Rn(null);
3114
- }, []), Wt = A(
3115
- (e, r) => {
3116
- const o = window.getSelection();
3117
- if (!o) return;
3118
- const i = document.createRange();
3119
- i.setStart(r.node, r.start), i.setEnd(r.node, r.end), o.removeAllRanges(), o.addRange(i), Je(ao(e)), window.requestAnimationFrame(() => De.current());
3120
- },
3121
- [Je]
3122
- );
3123
- I(() => {
3124
- const e = B.current;
3125
- if (!e || !ct) return;
3126
- const r = () => {
3127
- var Fe;
3128
- const c = e.querySelector(".redactor-in"), s = window.getSelection();
3129
- if (!c || !s || s.rangeCount === 0 || !s.isCollapsed) {
3130
- Ie();
3131
- return;
3132
- }
3133
- const { startContainer: d, startOffset: N } = s.getRangeAt(0);
3134
- if (d.nodeType !== Node.TEXT_NODE || !c.contains(d) || (((Fe = d.parentElement) == null ? void 0 : Fe.closest(
3135
- '[data-redactor-type="variable"]'
3136
- )) ?? null) !== null) {
3137
- Ie();
3138
- return;
3139
- }
3140
- const R = d, K = R.data.slice(0, N), re = /\[\[([A-Za-z0-9_]+)\]\]$/.exec(K);
3141
- if (re) {
3142
- Ie(), Wt(
3143
- pe.get(re[1].toLowerCase()) ?? re[1],
3144
- { node: R, start: N - re[0].length, end: N }
3145
- );
3146
- return;
3147
- }
3148
- const Re = /\[\[([A-Za-z0-9_ ]{0,40})$/.exec(K), te = Ae.current;
3149
- if (!Re || !te || (se ?? []).length === 0) {
3150
- Ie();
3151
- return;
3152
- }
3153
- const Be = {
3154
- node: R,
3155
- start: N - Re[0].length,
3156
- end: N
3157
- };
3158
- Vt.current = Be;
3159
- const vt = document.createRange();
3160
- vt.setStart(R, Be.start), vt.setEnd(R, Be.end);
3161
- const at = vt.getBoundingClientRect(), It = te.getBoundingClientRect(), Pn = getComputedStyle(te).direction === "rtl";
3162
- Rn({
3163
- query: Re[1],
3164
- left: Pn ? It.right - at.right : at.left - It.left,
3165
- top: at.bottom - It.top + 4
3166
- });
3167
- }, o = (c) => {
3168
- var d;
3169
- if (!Vt.current || !["ArrowDown", "ArrowUp", "Home", "End", "Enter", "Escape"].includes(
3170
- c.key
3171
- ))
3172
- return;
3173
- (((d = ur.current) == null ? void 0 : d.handleKeyDown(c)) ?? !1) && (c.preventDefault(), c.stopImmediatePropagation());
3174
- }, i = () => Ie();
3175
- return e.addEventListener("input", r), e.addEventListener("keydown", o, !0), e.addEventListener("focusout", i), () => {
3176
- e.removeEventListener("input", r), e.removeEventListener("keydown", o, !0), e.removeEventListener("focusout", i);
3177
- };
3178
- }, [
3179
- ct,
3180
- pe,
3181
- se,
3182
- Wt,
3183
- Ie
3184
- ]), I(() => {
3185
- var r;
3186
- const e = (r = B.current) == null ? void 0 : r.querySelector(".redactor-in");
3187
- e && (ut ? (e.setAttribute("aria-expanded", "true"), e.setAttribute("aria-controls", `${Sn}-list`), zn ? e.setAttribute("aria-activedescendant", zn) : e.removeAttribute("aria-activedescendant")) : (e.removeAttribute("aria-expanded"), e.removeAttribute("aria-controls"), e.removeAttribute("aria-activedescendant")));
3188
- }, [ut, Sn, zn]);
3189
- const Lo = A(
3190
- (e) => {
3191
- const r = Vt.current;
3192
- Ie(), r && Wt(e.token, r), U == null || U(e.token);
3193
- },
3194
- [Ie, Wt, U]
3195
- ), _o = A(() => {
3196
- Ie();
3197
- }, [Ie]), Io = A((e) => {
3198
- Rn((r) => r && { ...r, query: e });
3199
- }, []), mt = A(() => {
3200
- var r;
3201
- if (typeof window < "u") {
3202
- const o = (r = B.current) == null ? void 0 : r.querySelector(".redactor-in"), i = window.getSelection();
3203
- o && i && i.rangeCount > 0 && i.anchorNode && o.contains(i.anchorNode) && (Te.current = i.getRangeAt(0).cloneRange());
3204
- }
3205
- const e = _.current;
3206
- if (e)
3207
- try {
3208
- e(D, "selection.save");
3209
- } catch {
3210
- }
3211
- }, [D]), ke = A(() => {
3212
- const e = _.current;
3213
- if (!e) return;
3214
- const r = Te.current;
3215
- try {
3216
- e(D, "editor.focus");
3217
- } catch {
3218
- }
3219
- if (r && typeof window < "u") {
3220
- const o = window.getSelection();
3221
- if (o)
3222
- try {
3223
- o.removeAllRanges(), o.addRange(r);
3224
- return;
3225
- } catch {
3226
- }
3227
- }
3228
- try {
3229
- e(D, "selection.restore");
3230
- } catch {
3231
- }
3232
- }, [D]), Ho = A(() => {
3233
- var o;
3234
- if (typeof window > "u") return "";
3235
- const e = (o = B.current) == null ? void 0 : o.querySelector(".redactor-in"), r = window.getSelection();
3236
- return !e || !r || !r.anchorNode || !e.contains(r.anchorNode) ? "" : r.toString();
3237
- }, []), $o = A(() => {
3238
- var c;
3239
- if (typeof window > "u") return null;
3240
- const e = (c = B.current) == null ? void 0 : c.querySelector(".redactor-in"), r = window.getSelection();
3241
- if (!e || !r || r.rangeCount === 0) return null;
3242
- const o = r.anchorNode, i = o && o.nodeType === Node.TEXT_NODE ? o.parentElement : o;
3243
- return !i || !e.contains(i) ? null : i.closest("table");
3244
- }, []), mr = x(null), Xt = A(() => {
3245
- var c;
3246
- if (typeof window > "u") return null;
3247
- const e = (c = B.current) == null ? void 0 : c.querySelector(".redactor-in"), r = window.getSelection();
3248
- if (!e || !r || r.rangeCount === 0) return null;
3249
- const o = r.anchorNode, i = o && o.nodeType === Node.TEXT_NODE ? o.parentElement : o;
3250
- return !i || !e.contains(i) ? null : i.closest("td,th");
3251
- }, []), Oo = A(() => {
3252
- mr.current = Xt();
3253
- }, [Xt]), Do = A(
3254
- (e, r) => {
3255
- var s;
3256
- const o = mr.current ?? Xt();
3257
- if (!o) return;
3258
- const i = e === "row" ? Array.from(((s = o.closest("tr")) == null ? void 0 : s.children) ?? [o]).filter(
3259
- (d) => d instanceof HTMLElement && (d.tagName === "TD" || d.tagName === "TH")
3260
- ) : [o], c = _.current;
3261
- if (c)
3262
- try {
3263
- c(D, "module.buffer.trigger");
3264
- } catch {
3265
- }
3266
- for (const d of i)
3267
- r ? d.style.setProperty("background-color", r) : d.style.removeProperty("background-color");
3268
- if (c)
3269
- try {
3270
- c(D, "broadcast", "hardsync");
3271
- } catch {
3272
- }
3273
- typeof window < "u" && window.requestAnimationFrame(() => ve());
3274
- },
3275
- [Xt, D, ve]
3276
- );
3277
- I(() => {
3278
- const e = B.current;
3279
- if (typeof window > "u" || !e) return;
3280
- const r = (c) => {
3281
- const s = e.querySelector(".redactor-in"), d = c.target;
3282
- if (!s || !(d instanceof Node) || !s.contains(d))
3283
- return;
3284
- const N = d instanceof Element ? d.closest("img") : null;
3285
- jt(N && s.contains(N) ? N : null);
3286
- }, o = (c) => {
3287
- c.key === "Escape" && Ft.current && jt(null);
3288
- }, i = (c) => {
3289
- const s = c.relatedTarget;
3290
- (!(s instanceof Node) || !e.contains(s)) && jt(null);
3291
- };
3292
- return e.addEventListener("click", r), e.addEventListener("keydown", o), e.addEventListener("focusout", i), () => {
3293
- e.removeEventListener("click", r), e.removeEventListener("keydown", o), e.removeEventListener("focusout", i);
3294
- };
3295
- }, [jt]);
3296
- const Po = A(
3297
- (e) => {
3298
- const r = Ft.current;
3299
- if (!r) return;
3300
- const o = Zn.includes(
3301
- e
3302
- ) ? Zn : vo, i = _.current;
3303
- if (i)
3304
- try {
3305
- i(D, "module.buffer.trigger");
3306
- } catch {
3307
- }
3308
- for (const c of o) r.classList.remove(c);
3309
- if (r.classList.add(e), i)
3310
- try {
3311
- i(D, "broadcast", "hardsync");
3312
- } catch {
3313
- }
3314
- typeof window < "u" && window.requestAnimationFrame(() => ve());
3315
- },
3316
- [D, ve]
3317
- ), qo = A(
3318
- (e) => {
3319
- const r = Ft.current;
3320
- if (!r) return;
3321
- const o = _.current;
3322
- if (o)
3323
- try {
3324
- o(D, "module.buffer.trigger");
3325
- } catch {
3326
- }
3327
- if (r.style.setProperty("width", `${e}%`), o)
3328
- try {
3329
- o(D, "broadcast", "hardsync");
3330
- } catch {
3331
- }
3332
- typeof window < "u" && window.requestAnimationFrame(() => ve());
3333
- },
3334
- [D, ve]
3335
- ), Bo = A(
3336
- (e) => {
3337
- var o;
3338
- const r = _.current;
3339
- if (r && typeof window < "u") {
3340
- const i = (o = B.current) == null ? void 0 : o.querySelector(".redactor-in"), c = window.getSelection(), s = c == null ? void 0 : c.anchorNode, d = s && s.nodeType === Node.TEXT_NODE ? s.parentElement : s, N = d && (i != null && i.contains(d)) ? d.closest("ul,ol") : null;
3341
- if (N)
3342
- try {
3343
- r(D, "caret.setAfter", N);
3344
- } catch {
3345
- }
3346
- }
3347
- Je(e), typeof window < "u" && window.requestAnimationFrame(() => {
3348
- var c;
3349
- const i = (c = B.current) == null ? void 0 : c.querySelector(".redactor-in");
3350
- i == null || i.querySelectorAll("table td, table th").forEach((s) => {
3351
- let d = s.lastChild;
3352
- for (; d && d.nodeType === Node.TEXT_NODE && !(d.textContent ?? "").trim(); ) {
3353
- const N = d.previousSibling;
3354
- s.removeChild(d), d = N;
3355
- }
3356
- });
3357
- });
3358
- },
3359
- [Je, D]
3360
- ), fr = A(
3361
- async (e, r) => {
3362
- if (H) return H(e, r);
3363
- if (!L) throw new Error("No image upload URL configured.");
3364
- const o = new FormData();
3365
- o.append("file", e);
3366
- const i = await fetch(L, {
3367
- method: "POST",
3368
- body: o,
3369
- credentials: "same-origin",
3370
- signal: r
3371
- });
3372
- if (!i.ok) throw new Error(`Image upload failed (${i.status}).`);
3373
- const c = el(await i.json());
3374
- if (!c) throw new Error("Image upload response contained no URL.");
3375
- return c;
3376
- },
3377
- [L, H]
3378
- ), Ye = vi({ enabled: W }), {
3379
- start: ft,
3380
- land: Pe,
3381
- reset: ht
3382
- } = Ye, Mt = x(null), gt = x(null), [ye, hr] = T(!1), [Fo, gr] = T("listening"), [jo, pr] = T(!1), [Go, Rt] = T(""), pt = A(() => {
3383
- const e = gt.current;
3384
- e != null && e.parentNode && e.parentNode.removeChild(e), gt.current = null;
3385
- }, []), bt = x(""), Ut = A((e) => {
3386
- var s, d;
3387
- const r = (s = B.current) == null ? void 0 : s.querySelector(
3388
- ".redactor-in"
3389
- );
3390
- if (!r) return;
3391
- let o = gt.current;
3392
- if (!o || !r.contains(o)) {
3393
- o = document.createElement("span"), o.setAttribute("data-rte-interim", ""), o.setAttribute("contenteditable", "false");
3394
- const N = window.getSelection();
3395
- if (N && N.rangeCount > 0 && r.contains(N.anchorNode)) {
3396
- const R = N.getRangeAt(0).cloneRange();
3397
- R.collapse(!1), R.insertNode(o);
3398
- } else {
3399
- const R = r.lastElementChild;
3400
- R !== null && R.tagName === "P" && R === r.firstElementChild && (R.textContent ?? "").replace(/[\ufeff\s]/g, "") === "" && Array.from(R.children).every((re) => re.tagName === "BR") ? ((d = R.lastChild) == null ? void 0 : d.nodeName) === "BR" ? R.insertBefore(o, R.lastChild) : R.appendChild(o) : r.appendChild(o);
3401
- }
3402
- gt.current = o;
3403
- }
3404
- bt.current ? o.setAttribute("data-hint", bt.current) : o.removeAttribute("data-hint");
3405
- const i = o.previousSibling, c = (i == null ? void 0 : i.nodeType) === Node.TEXT_NODE ? i.data.replace(/\ufeff/g, "").slice(-1) : "";
3406
- o.toggleAttribute("data-gap", /\S/.test(c) && c !== " "), o.textContent = e;
3407
- }, []), br = A(
3408
- (e) => {
3409
- var r;
3410
- bt.current = e, Ut(((r = gt.current) == null ? void 0 : r.textContent) ?? "");
3411
- },
3412
- [Ut]
3413
- ), Zt = x(null), Qt = A(
3414
- (e = !1) => {
3415
- var o;
3416
- Zt.current && (Zt.current.keepLate = e), (o = Mt.current) == null || o.abort(), bt.current = "";
3417
- const r = gt.current;
3418
- r && !r.textContent ? pt() : r == null || r.removeAttribute("data-hint");
3419
- },
3420
- [pt]
3421
- ), vr = A(() => {
3422
- var s;
3423
- if (typeof window > "u") return !1;
3424
- const e = window.getSelection(), r = (s = B.current) == null ? void 0 : s.querySelector(".redactor-in");
3425
- if (!e || e.rangeCount === 0 || !r) return !1;
3426
- const { startContainer: o, startOffset: i } = e.getRangeAt(0);
3427
- if (!r.contains(o) || o.nodeType !== Node.TEXT_NODE || i === 0)
3428
- return !1;
3429
- const c = o.data.charAt(i - 1);
3430
- return /\S/.test(c) && c !== " ";
3431
- }, []), Ee = k !== void 0 && !k.granted, Jt = x(null), Yt = A(() => {
3432
- if (!Q || Ee) return;
3433
- const e = new AbortController();
3434
- Mt.current = e;
3435
- const r = { keepLate: !1 };
3436
- Zt.current = r;
3437
- let o = !1;
3438
- const i = () => !o && (!e.signal.aborted || r.keepLate);
3439
- pr(!1), hr(!0), gr("listening"), Rt($("editor.ai.listening")), W && ft(), pt();
3440
- const c = (s) => {
3441
- if (Jt.current) {
3442
- bt.current = "";
3443
- return;
3444
- }
3445
- br(s);
3446
- };
3447
- c($("editor.ai.listening")), Q({
3448
- signal: e.signal,
3449
- onStatus: (s) => {
3450
- if (!i()) return;
3451
- const d = $(s === "connecting" ? "voiceControl.status.starting" : "editor.ai.listening");
3452
- gr(s), Rt(d), c(d);
3453
- },
3454
- // Interim text shows live in the editor (grey + caret); each final
3455
- // replaces it with committed text at the caret.
3456
- onPartialTranscript: (s) => {
3457
- i() && Ut(s);
3458
- },
3459
- onFinalTranscript: (s) => {
3460
- if (!i()) return;
3461
- pt();
3462
- const d = s.trim();
3463
- if (d) {
3464
- const N = Jt.current;
3465
- if (N) {
3466
- Jt.current = null, Te.current = N, ke(), ge(`${d} `, { asHtml: !1 }), W && Pe(), Rt(d);
3467
- return;
3468
- }
3469
- if (vr()) {
3470
- const R = window.getSelection(), K = R == null ? void 0 : R.getRangeAt(0);
3471
- if (R && K) {
3472
- const re = K.startContainer, Re = K.startOffset;
3473
- re.insertData(Re, " ");
3474
- const te = document.createRange();
3475
- te.setStart(re, Re + 1), te.collapse(!0), R.removeAllRanges(), R.addRange(te);
3476
- }
3477
- }
3478
- ge(`${d} `, { asHtml: !1 }), W && Pe(), Rt(d);
3479
- }
3480
- }
3481
- }).catch((s) => {
3482
- var d;
3483
- if (!(e.signal.aborted || s && typeof s == "object" && "name" in s && s.name === "AbortError")) {
3484
- if (ro(s) && ((d = _e.current) == null || d.call(_e), xn.current || Cn.current)) {
3485
- Tt(!0), Ge(!0);
3486
- return;
3487
- }
3488
- pr(!0);
3489
- }
3490
- }).finally(() => {
3491
- o = !0, bt.current = "", pt(), Mt.current === e && (Mt.current = null, Zt.current = null, hr(!1), Rt(""), W && !qe.current && ht());
3492
- });
3493
- }, [
3494
- Q,
3495
- Ee,
3496
- ge,
3497
- ke,
3498
- pt,
3499
- Ut,
3500
- br,
3501
- vr,
3502
- W,
3503
- ft,
3504
- Pe,
3505
- ht,
3506
- $
3507
- ]);
3508
- I(() => () => {
3509
- var e;
3510
- return (e = Mt.current) == null ? void 0 : e.abort();
3511
- }, []);
3512
- const [en, St] = T(null), et = x(null), tn = x(null), [Ko, yr] = T(!1), Vo = ((k == null ? void 0 : k.pending) ?? !1) || Ko, nn = x(!1), Ln = A(() => {
3513
- et.current = null, tn.current = null, nn.current = !1, St(null);
3514
- }, []), Wo = A(() => {
3515
- var r;
3516
- nn.current = !0;
3517
- const e = (r = k == null ? void 0 : k.onGrant) == null ? void 0 : r.call(k);
3518
- e && typeof e.then == "function" && (yr(!0), Promise.resolve(e).catch(() => {
3519
- }).finally(() => yr(!1)));
3520
- }, [k]), wr = x((k == null ? void 0 : k.granted) ?? !0);
3521
- I(() => {
3522
- const e = wr.current;
3523
- if (wr.current = (k == null ? void 0 : k.granted) ?? !0, !e && (k != null && k.granted) && et.current) {
3524
- const r = et.current, o = nn.current;
3525
- et.current = null, nn.current = !1, St(null);
3526
- const i = tn.current;
3527
- if (tn.current = null, !o) return;
3528
- r === "write" ? Ge(!0) : r === "action" ? i == null || i() : (ke(), Yt());
3529
- }
3530
- }, [k == null ? void 0 : k.granted, ke, Yt]), I(() => {
3531
- Ee && (Ge(!1), ye && Qt());
3532
- }, [Ee, ye, Qt]);
3533
- const kr = A(
3534
- (e = "document") => {
3535
- if (ye) {
3536
- Qt(!0);
3537
- return;
3538
- }
3539
- mt();
3540
- const r = Te.current;
3541
- if (Jt.current = e === "selection" && r && !r.collapsed ? r.cloneRange() : null, Ee) {
3542
- et.current = "dictate", St("dictate");
3543
- return;
3544
- }
3545
- Yt();
3546
- },
3547
- [ye, Qt, Ee, mt, Yt]
3548
- ), xr = A(
3549
- (e = "document") => {
3550
- mt();
3551
- const r = Te.current, o = r ? r.cloneRange() : null, i = e === "selection" && !!(o && !o.collapsed);
3552
- if (o && !i && o.collapse(!1), Bt.current = o, To(i ? "selection" : "document"), Ao(i && o ? o.toString() : ""), Ee) {
3553
- et.current = "write", St("write");
3554
- return;
3555
- }
3556
- Ge(!0);
3557
- },
3558
- [mt, Ee]
3559
- ), Cr = yt(() => k != null && k.granted ? /* @__PURE__ */ C(je, { children: [
3560
- $(
3561
- "editor.ai.consentRecorded",
3562
- "AI assistance consent has been recorded."
3563
- ),
3564
- q ? /* @__PURE__ */ C(je, { children: [
3565
- " ",
3566
- q
3567
- ] }) : null
3568
- ] }) : q, [k, q, $]), [tt, _n] = T(null), [Xo, rn] = T(!1), [Ar, Nr] = T(!1), [Uo, nt] = T(""), Tr = x(null), qe = x(null), on = x(Le);
3569
- I(() => {
3570
- on.current = Le;
3571
- }, [Le]), I(() => {
3572
- W && (!ye && tt === null || Ye.state === null && ft());
3573
- }, [W, ye, tt, Ye.state, ft]);
3574
- const zt = (e) => e.preventDefault(), Er = A(
3575
- (e) => {
3576
- var o;
3577
- const r = _.current;
3578
- if (r)
3579
- try {
3580
- const i = r(D);
3581
- (o = i == null ? void 0 : i.broadcast) == null || o.call(i, "state", !1, e);
3582
- } catch {
3583
- }
3584
- },
3585
- [D]
3586
- ), Mr = x(!1), rt = A(
3587
- (e) => {
3588
- const r = _.current;
3589
- if (!r || Mr.current === e) return;
3590
- Mr.current = e;
3591
- const o = e || y;
3592
- ne.current = o;
3593
- try {
3594
- r(D, o ? "enableReadOnly" : "disableReadOnly");
3595
- } catch {
3596
- }
3597
- },
3598
- [D, y]
3599
- ), In = A(
3600
- (e) => {
3601
- var o;
3602
- const r = xt(
3603
- Se(e),
3604
- lt.current
3605
- );
3606
- !he("source.setCode", r) && ee.current && (ee.current.value = r), (o = be.current) == null || o.call(be, { html: r, markdown: "" });
3607
- },
3608
- [he]
3609
- ), ot = A(
3610
- (e) => {
3611
- var c;
3612
- const r = (c = B.current) == null ? void 0 : c.querySelector(".redactor-in"), o = typeof window < "u" ? window.getSelection() : null;
3613
- if (e === "selection" && r && o && o.rangeCount > 0 && !o.isCollapsed) {
3614
- const s = o.getRangeAt(0);
3615
- if (r.contains(s.commonAncestorContainer)) {
3616
- const d = s.toString();
3617
- if (d.trim())
3618
- return {
3619
- scope: "selection",
3620
- range: s.cloneRange(),
3621
- html: Qs(s.cloneContents()),
3622
- text: d
3623
- };
3624
- }
3625
- }
3626
- const i = fe();
3627
- return { scope: "document", range: null, html: i, text: oo(i) };
3628
- },
3629
- [fe]
3630
- ), Hn = A(
3631
- (e, r, o, i) => {
3632
- if (qe.current || !o.text.trim()) return;
3633
- const c = new AbortController();
3634
- qe.current = c, _n(e), Nr(!1), Tr.current = e, nt($("editor.ai.generating")), rn(!1), W && ft();
3635
- const s = fe();
3636
- rt(!0), Promise.resolve(
3637
- r({
3638
- html: o.html,
3639
- text: o.text,
3640
- scope: o.scope,
3641
- signal: c.signal
3642
- })
3643
- ).then((d) => {
3644
- var R;
3645
- if (c.signal.aborted) return;
3646
- rt(!1);
3647
- const N = String(d ?? "");
3648
- if (fe() !== s) {
3649
- Nr(!0), nt("");
3650
- return;
3651
- }
3652
- if (!oo(N)) {
3653
- rn(!0), nt("");
3654
- return;
3655
- }
3656
- if (Er(s), o.scope === "selection" && o.range) {
3657
- if (!o.range.startContainer.isConnected) {
3658
- rn(!0), nt("");
3659
- return;
3660
- }
3661
- Te.current = o.range, ke();
3662
- const K = xt(
3663
- Se(N),
3664
- lt.current
3665
- );
3666
- he("insertion.insertHtml", K) || ge(N, { asHtml: !0 });
3667
- } else
3668
- In(N);
3669
- W && Pe(), nt($("editor.ai.actionDone")), (R = on.current) == null || R.call(on, {
3670
- action: e,
3671
- template: i,
3672
- scope: o.scope,
3673
- previousHtml: s,
3674
- undo: () => In(s)
3675
- });
3676
- }).catch((d) => {
3677
- var N;
3678
- if (rt(!1), !(c.signal.aborted || Zs(d))) {
3679
- if (ro(d) && ((N = _e.current) == null || N.call(_e), xn.current || Cn.current)) {
3680
- Tt(!0), Ge(!0);
3681
- return;
3682
- }
3683
- rn(!0), nt("");
3684
- }
3685
- }).finally(() => {
3686
- qe.current === c && (qe.current = null, rt(!1), _n(null), ht());
3687
- });
3688
- },
3689
- [
3690
- W,
3691
- ft,
3692
- Pe,
3693
- ht,
3694
- rt,
3695
- fe,
3696
- ke,
3697
- he,
3698
- ge,
3699
- In,
3700
- Er,
3701
- $
3702
- ]
3703
- ), Lt = A(
3704
- (e, r, o, i) => {
3705
- if (Ee) {
3706
- tn.current = () => Hn(e, r, o, i), et.current = "action", St("action");
3707
- return;
3708
- }
3709
- Hn(e, r, o, i);
3710
- },
3711
- [Ee, Hn]
3712
- ), Rr = A(
3713
- (e, r) => {
3714
- const o = J == null ? void 0 : J.onRun;
3715
- o && Lt(
3716
- "template",
3717
- (i) => o({ ...i, template: e }),
3718
- r,
3719
- e
3720
- );
3721
- },
3722
- [J, Lt]
3723
- ), Sr = A(() => {
3724
- var e;
3725
- (e = qe.current) == null || e.abort(), qe.current = null, rt(!1), _n(null), nt(""), ht();
3726
- }, [rt, ht]), zr = x(null);
3727
- I(() => {
3728
- const e = tt ?? Tr.current;
3729
- if (!e) return;
3730
- const r = e === "template" ? "ai-templates" : `ai-${e}`, o = requestAnimationFrame(() => {
3731
- var c, s;
3732
- const i = document.activeElement;
3733
- i && i !== document.body && i.isConnected || (s = (c = zr.current) == null ? void 0 : c.querySelector(`[data-component-part="${r}"]`)) == null || s.focus();
3734
- });
3735
- return () => cancelAnimationFrame(o);
3736
- }, [tt]), I(() => () => {
3737
- var e;
3738
- return (e = qe.current) == null ? void 0 : e.abort();
3739
- }, []), I(() => {
3740
- const e = ee.current;
3741
- if (!e) return;
3742
- e.value = So.current, De.current();
3743
- const r = tl(j);
3744
- if (!r) {
3745
- rr(!0);
3746
- return;
3747
- }
3748
- if (_.current = r, e.value = xt(e.value, lt.current), v === void 0 && (f == null ? void 0 : f.lang) === void 0 && r.addLang && r.lang) {
3749
- const d = `alfadocs-${Me}`;
3750
- r.addLang(d, Wr($)), V.current = d;
3751
- }
3752
- const o = {
3753
- lang: V.current ?? v ?? ol(Dt.language || "en"),
3754
- // The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
3755
- // via the command API, so Redactor's native toolbar is suppressed.
3756
- toolbar: !1,
3757
- plugins: m ?? [],
3758
- placeholder: g ?? $("editor.placeholder"),
3759
- toolbarFixed: !1,
3760
- // Platform parity (RedactorWysiwyg.js:84): no inline shortcode expansion.
3761
- shortcodes: !1,
3762
- // The kit owns image editing: ImageFloatingToolbar provides DS-native,
3763
- // keyboard-accessible resize + wrap/align, so Redactor's own image
3764
- // popup AND its single-handle drag-resizer are both disabled to avoid a
3765
- // second, untokenised, mouse-only UI competing with ours.
3766
- imageEditable: !1,
3767
- imageResizable: !1
3768
- }, i = L ? { imageUpload: L } : {}, c = (f == null ? void 0 : f.callbacks) ?? {}, s = {
3769
- ...o,
3770
- ...i,
3771
- ...f ?? {},
3772
- // Re-pin safety-critical keys LAST so consumer `options` can't override
3773
- // the sanitising change handler or re-enable Redactor's native image UI
3774
- // (the kit's ImageFloatingToolbar replaces both — see kitDefaults above).
3775
- imageEditable: !1,
3776
- imageResizable: !1,
3777
- callbacks: {
3778
- ...c,
3779
- changed(d) {
3780
- De.current();
3781
- const N = un(
3782
- to(no(d))
3783
- ), R = Se(N), K = _r.current;
3784
- if (K && Date.now() < K.until && io(R) === K.text) {
3785
- Gt.current = R;
3786
- return;
3787
- }
3788
- R !== Gt.current && (Gt.current = R, Ce.current = !0, be.current && (Et.current && clearTimeout(Et.current), Et.current = setTimeout(() => {
3789
- var re;
3790
- (re = be.current) == null || re.call(be, { html: R, markdown: "" });
3791
- }, 100)));
3792
- },
3793
- keydown(d) {
3794
- var N;
3795
- (N = Kt.current) == null || N.call(Kt, d);
3796
- },
3797
- observe() {
3798
- ve();
3799
- }
3800
- }
3801
- };
3802
- try {
3803
- if (r(D, s), Gt.current = Se(
3804
- un(to(fe()))
3805
- ), De.current(), y)
3806
- try {
3807
- r(D, "enableReadOnly");
3808
- } catch {
3809
- }
3810
- } catch {
3811
- V.current && r.lang && delete r.lang[V.current], V.current = null, _.current = null, rr(!0);
3812
- }
3813
- return () => {
3814
- Et.current && clearTimeout(Et.current);
3815
- try {
3816
- r(D, "destroy");
3817
- } catch {
3818
- }
3819
- V.current && r.lang && delete r.lang[V.current], V.current = null, _.current = null;
3820
- };
3821
- }, []), I(() => {
3822
- const e = _.current, r = V.current;
3823
- if (!(!(e != null && e.addLang) || !r)) {
3824
- e.addLang(r, Wr($));
3825
- try {
3826
- e(D, "lang.rebuild", r);
3827
- } catch {
3828
- }
3829
- }
3830
- }, [$, Dt.language, D]);
3831
- const Lr = x(pe), _r = x(
3832
- null
3833
- );
3834
- I(() => {
3835
- var o, i;
3836
- if (Lr.current === pe || (Lr.current = pe, !_.current || pe.size === 0)) return;
3837
- const e = fe(), r = xt(e, pe);
3838
- if (r !== e) {
3839
- const c = (o = B.current) == null ? void 0 : o.querySelector(".redactor-in"), d = c != null && c.contains(document.activeElement) && c ? Js(c) : null;
3840
- _r.current = {
3841
- text: io(e),
3842
- until: Date.now() + 1e3
3843
- }, he("source.setCode", r);
3844
- const N = (i = B.current) == null ? void 0 : i.querySelector(".redactor-in");
3845
- d !== null && N && Ys(N, d);
3846
- }
3847
- window.requestAnimationFrame(() => De.current());
3848
- }, [pe, fe, he]), I(() => {
3849
- if (!_.current || u === void 0) return;
3850
- if (Ce.current) {
3851
- Ce.current = !1;
3852
- return;
3853
- }
3854
- const e = xt(
3855
- Se(un(u)),
3856
- lt.current
3857
- );
3858
- un(fe()) !== e && he("source.setCode", e);
3859
- }, [u, fe, he]), I(() => {
3860
- ne.current = y;
3861
- const e = _.current;
3862
- if (e)
3863
- try {
3864
- e(D, y ? "enableReadOnly" : "disableReadOnly");
3865
- } catch {
3866
- }
3867
- }, [y, D]), I(() => {
3868
- if (!ue || u === void 0) return;
3869
- const e = ee.current;
3870
- if (!e) return;
3871
- const r = Se(u);
3872
- e.value !== r && document.activeElement !== e && (e.value = r);
3873
- }, [ue, u]);
3874
- const Ke = yt(
3875
- () => ({
3876
- getHTML() {
3877
- return fe();
3878
- },
3879
- getText() {
3880
- return fe().replace(/<[^>]*>/g, " ").replace(/&nbsp;/gi, " ").replace(/\s+/g, " ").trim();
3881
- },
3882
- getMarkdown() {
3883
- return "";
3884
- },
3885
- isAiBusy() {
3886
- return qe.current !== null;
3887
- },
3888
- setContent(e) {
3889
- const r = Se(e);
3890
- he(
3891
- "source.setCode",
3892
- xt(r, lt.current)
3893
- ) || ee.current && (ee.current.value = r);
3894
- },
3895
- insertAtCursor: ge,
3896
- applyFormat(e) {
3897
- const r = nl[e];
3898
- r && Qe(...r);
3899
- },
3900
- focus() {
3901
- var r;
3902
- const e = _.current;
3903
- if (e)
3904
- try {
3905
- e(D, "editor.focus");
3906
- return;
3907
- } catch {
3908
- }
3909
- (r = ee.current) == null || r.focus();
3910
- },
3911
- clear() {
3912
- he("source.setCode", "") || ee.current && (ee.current.value = "");
3913
- }
3914
- }),
3915
- [D, fe, he, ge, Qe]
3916
- );
3917
- ui(pn, () => Ke, [Ke]), bi(is, Ke, n);
3918
- const Zo = A(
3919
- (e) => {
3920
- var r;
3921
- De.current(), (r = be.current) == null || r.call(be, {
3922
- html: Se(e.target.value),
3923
- markdown: ""
3924
- });
3925
- },
3926
- []
3927
- ), an = w ?? $("editor.regionLabel"), $n = f == null ? void 0 : f.placeholder, _t = typeof $n == "string" || $n === !1 ? $n : g ?? $("editor.placeholder");
3928
- I(() => {
3929
- var i;
3930
- if (ue) return;
3931
- const e = (i = B.current) == null ? void 0 : i.querySelector(".redactor-in");
3932
- if (!e) return;
3933
- const r = () => {
3934
- e.getAttribute("role") !== "textbox" && e.setAttribute("role", "textbox"), e.getAttribute("aria-multiline") !== "true" && e.setAttribute("aria-multiline", "true"), e.getAttribute("aria-label") !== an && e.setAttribute("aria-label", an), _t === !1 ? e.hasAttribute("placeholder") && e.removeAttribute("placeholder") : e.getAttribute("placeholder") !== _t && e.setAttribute("placeholder", _t), e.hasAttribute("aria-labelledby") && e.removeAttribute("aria-labelledby");
3935
- };
3936
- r();
3937
- const o = new MutationObserver(r);
3938
- return o.observe(e, {
3939
- attributes: !0,
3940
- attributeFilter: ["role", "aria-labelledby", "placeholder"]
3941
- }), () => o.disconnect();
3942
- }, [ue, an, _t]);
3943
- const sn = tt !== null, Qo = A(
3944
- (e) => {
3945
- jn.test(e) && (ue ? ge(`[[${e}]]`, { asHtml: !1 }) : (ke(), Je(ao(e))), U == null || U(e));
3946
- },
3947
- [
3948
- ue,
3949
- ge,
3950
- ke,
3951
- Je,
3952
- U
3953
- ]
3954
- ), On = x(null), [Jo, Yo] = T(!1), [ei, ti] = T(!1), ni = A(
3955
- (e, r) => {
3956
- if (ti(e), !e) return;
3957
- const o = ot(r);
3958
- On.current = o, Yo(!o.text.trim());
3959
- },
3960
- [ot]
3961
- ), ri = A(
3962
- (e) => {
3963
- const r = On.current ?? ot("document");
3964
- On.current = null, Rr(e, r);
3965
- },
3966
- [ot, Rr]
3967
- ), Ir = (e, r) => {
3968
- if (!r) return null;
3969
- const o = tt === e;
3970
- return {
3971
- key: e,
3972
- // While running, the segment becomes a Stop/Cancel button (progress
3973
- // shows on the scrim spinner).
3974
- icon: o ? /* @__PURE__ */ t(Ht, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : e === "proofread" ? /* @__PURE__ */ t(Kr, { "aria-hidden": "true", className: "ds:size-5" }) : /* @__PURE__ */ t(Vr, { "aria-hidden": "true", className: "ds:size-5" }),
3975
- label: o ? $("common.cancel") : e === "proofread" ? $("editor.ai.proofread", "Check spelling & grammar") : $("editor.ai.autoFormat", "Auto-format document"),
3976
- onClick: o ? Sr : () => Lt(e, r, ot("document")),
3977
- running: o
3978
- };
3979
- }, He = qi(xe), Dn = ye && Fo === "connecting", it = [];
3980
- if (Q && it.push({
3981
- key: "dictate",
3982
- // Connecting: a spinner, not yet the red recording look, so the
3983
- // red means "speak now". Pressing it still stops the session.
3984
- icon: Dn ? /* @__PURE__ */ t(
3985
- Kn,
3986
- {
3987
- "aria-hidden": "true",
3988
- className: "ds:size-5 ds:animate-spin ds:motion-reduce:animate-none"
3989
- }
3990
- ) : ye ? /* @__PURE__ */ t(Ht, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ t(Vn, { "aria-hidden": "true", className: "ds:size-5" }),
3991
- label: $(ye ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
3992
- onClick: () => kr("document"),
3993
- recording: ye && !Dn,
3994
- // On from the first press, though not red until it listens.
3995
- pressed: ye
3996
- }), J) {
3997
- const e = tt === "template";
3998
- it.push({
3999
- key: "templates",
4000
- icon: e ? /* @__PURE__ */ t(Ht, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ t(Wn, { "aria-hidden": "true", className: "ds:size-5" }),
4001
- label: $(e ? "common.cancel" : "editor.ai.templates"),
4002
- onClick: e ? Sr : void 0,
4003
- running: e,
4004
- menu: !e
4005
- });
4006
- }
4007
- const Hr = Ir("proofread", ae);
4008
- Hr && it.push(Hr);
4009
- const $r = Ir("format", de);
4010
- $r && it.push($r), (P || $e) && it.push({
4011
- key: "write",
4012
- icon: /* @__PURE__ */ t(Gr, { "aria-hidden": "true", className: "ds:size-5" }),
4013
- label: $("editor.ai.helpMeWrite"),
4014
- onClick: () => xr("document")
4015
- });
4016
- const Or = (e, r) => J ? /* @__PURE__ */ t(
4017
- Bs,
4018
- {
4019
- side: r === "document" ? "top" : "bottom",
4020
- templates: J.templates,
4021
- onPick: ri,
4022
- onManage: J.onManage,
4023
- noteEmpty: Jo,
4024
- onOpenChange: (o) => ni(o, r),
4025
- trigger: e
4026
- }
4027
- ) : null, Dr = (E ?? []).filter(
4028
- (e) => !e.contexts || M !== void 0 && e.contexts.includes(M)
4029
- );
4030
- I(() => {
4031
- (Xe || en !== null || y) && Oe(!1);
4032
- }, [Xe, en, y, Oe]), I(() => {
4033
- Ne && !(E ?? []).some(
4034
- (e) => e.id === Ne.extension.id && (!e.contexts || M !== void 0 && e.contexts.includes(M))
4035
- ) && Oe();
4036
- }, [E, M, Ne, Oe]);
4037
- const oi = (e) => {
4038
- var re, Re;
4039
- if (vn) return;
4040
- kn(), Ge(!1), Ln();
4041
- const r = new AbortController();
4042
- Nt.current = r;
4043
- const o = (re = Te.current) == null ? void 0 : re.cloneRange(), i = ee.current ? [
4044
- ee.current.selectionStart,
4045
- ee.current.selectionEnd
4046
- ] : null, c = (o == null ? void 0 : o.toString()) ?? (i ? (((Re = ee.current) == null ? void 0 : Re.value) ?? "").slice(...i) : "");
4047
- let s = !1;
4048
- const d = (te) => {
4049
- var Be;
4050
- s || (s = !0, (Be = qt.current) == null || Be.call(qt, e.id, te));
4051
- };
4052
- Ue.current = d;
4053
- const N = () => {
4054
- r.signal.aborted || (d({ status: "error" }), r.abort(), yn(!1), ir(!0), wn());
4055
- }, R = async (te) => {
4056
- var vt;
4057
- if (r.signal.aborted) return;
4058
- let Be = te.mode === "image" ? "" : te.html;
4059
- if (te.mode !== "text") {
4060
- const at = await te.pngDataUri();
4061
- if (r.signal.aborted) return;
4062
- const It = await (await fetch(at.dataUri, { signal: r.signal })).blob(), Pn = await fr(
4063
- new File([It], "extension-result.png", { type: "image/png" }),
4064
- r.signal
4065
- );
4066
- if (r.signal.aborted) return;
4067
- const Fe = document.createElement("img");
4068
- Fe.src = Pn, Fe.alt = te.text, Fe.width = at.width, Fe.height = at.height, Fe.loading = "lazy", Be += Fe.outerHTML;
4069
- }
4070
- r.signal.aborted || (o && (Te.current = o.cloneRange()), i && ((vt = ee.current) == null || vt.setSelectionRange(...i)), ke(), ge(Be, { asHtml: !0 }), d({ status: "success" }), Oe());
4071
- }, K = {
4072
- html: Ke.getHTML(),
4073
- text: Ke.getText(),
4074
- selectionText: c,
4075
- scope: c ? "selection" : "document",
4076
- signal: r.signal,
4077
- close: () => {
4078
- Nt.current === r && Oe();
4079
- },
4080
- insert: async (te) => {
4081
- try {
4082
- await R(te);
4083
- } catch {
4084
- N();
4085
- }
4086
- }
4087
- };
4088
- or({ extension: e, context: K }), e.kind === "action" && (yn(!0), (async () => {
4089
- try {
4090
- if (!e.run) throw new Error("Missing extension run");
4091
- const te = await e.run(K);
4092
- if (r.signal.aborted) return;
4093
- te ? await R(te) : (d({ status: "success" }), Oe());
4094
- } catch {
4095
- N();
4096
- }
4097
- })());
4098
- }, Pr = wo.map(
4099
- (e) => Dr.filter(
4100
- (r) => {
4101
- var o;
4102
- return (((o = r.source) == null ? void 0 : o.kind) ?? "kit") === e;
4103
- }
4104
- )
4105
- ), ii = Pr.every(
4106
- (e) => e.length > 0
4107
- ), ai = Dr.length > 0 ? /* @__PURE__ */ t(
4108
- dl,
4109
- {
4110
- groupedExtensions: Pr,
4111
- showExtensionGroups: ii,
4112
- extensionPending: vn,
4113
- extensionSession: Ne,
4114
- extensionError: bn,
4115
- openExtension: oi,
4116
- closeExtension: Oe,
4117
- saveSelection: mt,
4118
- closeSignal: ko,
4119
- restoreFocusOnCloseRef: ar
4120
- }
4121
- ) : void 0, qr = !!(P || $e), Br = !!(J || ae || de || qr || Q), si = !ue && !y && (we ?? Br), li = A(
4122
- () => {
4123
- var e;
4124
- return ((e = B.current) == null ? void 0 : e.querySelector(".redactor-in")) ?? null;
4125
- },
4126
- []
4127
- );
4128
- return /* @__PURE__ */ C(
4129
- "div",
4130
- {
4131
- ref: B,
4132
- className: [il(), z].filter(Boolean).join(" "),
4133
- "data-component": "rich-text-editor",
4134
- "data-component-id": n,
4135
- "data-min-height": b,
4136
- children: [
4137
- !ue && !y ? /* @__PURE__ */ t(
4138
- Ks,
4139
- {
4140
- run: Qe,
4141
- active: En,
4142
- preset: h,
4143
- insertHtml: Je,
4144
- insertTable: Bo,
4145
- saveSelection: mt,
4146
- restoreSelection: ke,
4147
- getSelectedText: Ho,
4148
- uploadImage: L || H ? fr : void 0,
4149
- enableColor: (m == null ? void 0 : m.includes("fontcolor")) ?? !1,
4150
- enableFontSize: (m == null ? void 0 : m.includes("fontsize")) ?? !1,
4151
- enableImage: !!(L || H),
4152
- enableTable: (m == null ? void 0 : m.includes("table")) ?? !1,
4153
- showExtensions: p,
4154
- extensionControl: ai,
4155
- variables: cr,
4156
- recentVariableTokens: Y,
4157
- insertVariable: Qo
4158
- }
4159
- ) : null,
4160
- /* @__PURE__ */ C("div", { className: "ds:relative", ref: Ae, children: [
4161
- /* @__PURE__ */ t(
4162
- "textarea",
4163
- {
4164
- ref: ee,
4165
- id: Me,
4166
- "aria-label": an,
4167
- "aria-multiline": "true",
4168
- "aria-busy": sn || void 0,
4169
- placeholder: _t || void 0,
4170
- onChange: ue ? Zo : void 0,
4171
- readOnly: ue ? y : void 0,
4172
- className: ue ? sl() : void 0
4173
- }
4174
- ),
4175
- sn ? /* @__PURE__ */ t(
4176
- "div",
4177
- {
4178
- "aria-hidden": "true",
4179
- 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)]",
4180
- children: /* @__PURE__ */ t(Yn, { size: "lg", variant: "prism" })
4181
- }
4182
- ) : null,
4183
- /* @__PURE__ */ C("div", { className: "ds:sticky ds:bottom-0 ds:z-10", children: [
4184
- it.length > 0 ? /* @__PURE__ */ C(
4185
- "div",
4186
- {
4187
- ref: zr,
4188
- className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10",
4189
- "data-ai-sparkle": Ye.props["data-ai-sparkle"],
4190
- children: [
4191
- /* @__PURE__ */ C("div", { className: hi, children: [
4192
- it.map((e, r) => {
4193
- const o = /* @__PURE__ */ t(
4194
- "button",
4195
- {
4196
- type: "button",
4197
- onClick: e.onClick,
4198
- "aria-pressed": (e.pressed ?? e.recording) || void 0,
4199
- "aria-busy": e.running || void 0,
4200
- "aria-haspopup": e.menu ? "menu" : void 0,
4201
- "data-component-part": `ai-${e.key}`,
4202
- disabled: sn && !e.running || void 0,
4203
- "aria-label": e.label,
4204
- className: e.recording ? cl : ll,
4205
- children: e.icon
4206
- }
4207
- );
4208
- return /* @__PURE__ */ C(Ct, { children: [
4209
- r > 0 ? /* @__PURE__ */ t(
4210
- "span",
4211
- {
4212
- "aria-hidden": "true",
4213
- className: gi
4214
- }
4215
- ) : null,
4216
- wt(
4217
- e.menu ? Or(o, "document") : o,
4218
- He
4219
- )
4220
- ] }, e.key);
4221
- }),
4222
- Ye.state ? /* @__PURE__ */ t(
4223
- "span",
4224
- {
4225
- "aria-hidden": "true",
4226
- className: `${pi} ${Ye.props.className}`
4227
- }
4228
- ) : null
4229
- ] }),
4230
- /* @__PURE__ */ t(yi, { state: Ye.state })
4231
- ]
4232
- }
4233
- ) : null,
4234
- /* @__PURE__ */ t(
4235
- Gn,
4236
- {
4237
- open: !!(Ne && (!vn || bn)),
4238
- onClose: Oe,
4239
- title: Ne ? ho($, Ne.extension.label) : void 0,
4240
- children: bn ? /* @__PURE__ */ t(fo, {}) : /* @__PURE__ */ t("div", { className: "ds:overflow-y-auto ds:[max-block-size:min(60dvh,calc(var(--rich-text-editor-min-block-size)*3))]", children: (jr = Ne == null ? void 0 : (Fr = Ne.extension).render) == null ? void 0 : jr.call(
4241
- Fr,
4242
- Ne.context
4243
- ) })
4244
- }
4245
- ),
4246
- $e ? $e({
4247
- open: Xe && !Ee,
4248
- onClose: () => {
4249
- Ge(!1), Tt(!1);
4250
- },
4251
- selectionText: Co,
4252
- scope: No,
4253
- creditsExhausted: sr,
4254
- getHTML: Ke.getHTML,
4255
- getText: Ke.getText,
4256
- // All three write seams put AI output into the note, so
4257
- // each one is an action landing and sparkles the pill.
4258
- insertAtSelection: (e) => {
4259
- Bt.current && (Te.current = Bt.current.cloneRange()), ke(), ge(e, { asHtml: !0 }), W && Pe();
4260
- },
4261
- insertAfterSelection: (e) => {
4262
- const r = Bt.current ?? Te.current;
4263
- if (r) {
4264
- const o = r.cloneRange();
4265
- o.collapse(!1), Te.current = o;
4266
- }
4267
- ke(), ge(e, { asHtml: !0 }), W && Pe();
4268
- },
4269
- setContent: (e) => {
4270
- Ke.setContent(e), W && Pe();
4271
- },
4272
- onDictate: Q,
4273
- privacyNotice: Cr
4274
- }) : P ? /* @__PURE__ */ t(
4275
- us,
4276
- {
4277
- open: Xe && !Ee,
4278
- onClose: () => {
4279
- Ge(!1), Tt(!1);
4280
- },
4281
- onRequestAiDraft: P,
4282
- creditsExhausted: sr,
4283
- onCreditsExhausted: () => {
4284
- var e;
4285
- return (e = _e.current) == null ? void 0 : e.call(_e);
4286
- },
4287
- onInsert: (e) => {
4288
- ke(), ge(e, { asHtml: X !== "text" }), W && Pe();
4289
- },
4290
- previewAsHtml: X !== "text",
4291
- privacyNotice: Cr,
4292
- onDictate: Q
4293
- }
4294
- ) : null,
4295
- k ? /* @__PURE__ */ t(
4296
- Gn,
4297
- {
4298
- open: en !== null,
4299
- onClose: Ln,
4300
- ariaLabel: $(
4301
- "editor.ai.consentRegionLabel",
4302
- "AI assistance consent for this document"
4303
- ),
4304
- footer: /* @__PURE__ */ t(ze, { intent: "ghost", size: "sm", onClick: Ln, children: $("common.close") }),
4305
- children: /* @__PURE__ */ t(
4306
- wi,
4307
- {
4308
- granted: k.granted,
4309
- grantedAt: k.grantedAt,
4310
- grantedBy: k.grantedBy,
4311
- canGrant: (k.canGrant ?? !0) && k.onGrant !== void 0,
4312
- pending: Vo,
4313
- onGrantConsent: Wo,
4314
- headingLevel: oe,
4315
- "aria-label": $(
4316
- "editor.ai.consentRegionLabel",
4317
- "AI assistance consent for this document"
4318
- )
4319
- }
4320
- )
4321
- }
4322
- ) : null
4323
- ] }),
4324
- !ue && !y && ((m == null ? void 0 : m.includes("table")) ?? !1) ? /* @__PURE__ */ t(
4325
- Ss,
4326
- {
4327
- active: En,
4328
- run: Qe,
4329
- areaRef: Ae,
4330
- getActiveTableEl: $o,
4331
- enableColor: (m == null ? void 0 : m.includes("fontcolor")) ?? !1,
4332
- saveTableCell: Oo,
4333
- applyTableBackground: Do
4334
- }
4335
- ) : null,
4336
- !ue && !y ? /* @__PURE__ */ t(
4337
- qs,
4338
- {
4339
- areaRef: Ae,
4340
- activeImageEl: Mo,
4341
- applyImageClass: Po,
4342
- setImageWidth: qo
4343
- }
4344
- ) : null,
4345
- si ? /* @__PURE__ */ t(
4346
- Gs,
4347
- {
4348
- active: En,
4349
- run: Qe,
4350
- areaRef: Ae,
4351
- getEditorRoot: li,
4352
- suppressed: sn || Xe || en !== null || Ne !== null,
4353
- holdOpen: ei,
4354
- children: Br ? /* @__PURE__ */ C(je, { children: [
4355
- Q ? wt(
4356
- /* @__PURE__ */ t(
4357
- Z,
4358
- {
4359
- size: "sm",
4360
- intent: "ghost",
4361
- "data-component-part": "selection-ai-dictate",
4362
- onMouseDown: zt,
4363
- icon: Dn ? /* @__PURE__ */ t(Kn, { className: "ds:animate-spin ds:motion-reduce:animate-none" }) : ye ? /* @__PURE__ */ t(Ht, {}) : /* @__PURE__ */ t(Vn, {}),
4364
- "aria-pressed": ye,
4365
- ...mn(
4366
- $(ye ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
4367
- !!He
4368
- ),
4369
- onClick: () => kr("selection")
4370
- }
4371
- ),
4372
- He
4373
- ) : null,
4374
- J ? wt(
4375
- Or(
4376
- /* @__PURE__ */ t(
4377
- ze,
4378
- {
4379
- size: "sm",
4380
- intent: "ghost",
4381
- "data-component-part": "selection-ai-templates",
4382
- onMouseDown: zt,
4383
- startIcon: /* @__PURE__ */ t(Wn, {}),
4384
- endIcon: /* @__PURE__ */ t(nr, {}),
4385
- children: $("editor.ai.templates")
4386
- }
4387
- ),
4388
- "selection"
4389
- ),
4390
- He
4391
- ) : null,
4392
- ae ? wt(
4393
- /* @__PURE__ */ t(
4394
- Z,
4395
- {
4396
- size: "sm",
4397
- intent: "ghost",
4398
- "data-component-part": "selection-ai-proofread",
4399
- onMouseDown: zt,
4400
- icon: /* @__PURE__ */ t(Kr, {}),
4401
- ...mn(
4402
- $("editor.ai.proofread"),
4403
- !!He
4404
- ),
4405
- onClick: () => Lt(
4406
- "proofread",
4407
- ae,
4408
- ot("selection")
4409
- )
4410
- }
4411
- ),
4412
- He
4413
- ) : null,
4414
- de ? wt(
4415
- /* @__PURE__ */ t(
4416
- Z,
4417
- {
4418
- size: "sm",
4419
- intent: "ghost",
4420
- "data-component-part": "selection-ai-format",
4421
- onMouseDown: zt,
4422
- icon: /* @__PURE__ */ t(Vr, {}),
4423
- ...mn(
4424
- $("editor.ai.autoFormat"),
4425
- !!He
4426
- ),
4427
- onClick: () => Lt(
4428
- "format",
4429
- de,
4430
- ot("selection")
4431
- )
4432
- }
4433
- ),
4434
- He
4435
- ) : null,
4436
- qr ? wt(
4437
- /* @__PURE__ */ t(
4438
- Z,
4439
- {
4440
- size: "sm",
4441
- intent: "ghost",
4442
- "data-component-part": "selection-ai-write",
4443
- onMouseDown: zt,
4444
- icon: /* @__PURE__ */ t(Gr, {}),
4445
- ...mn(
4446
- $("editor.ai.helpMeWrite"),
4447
- !!He
4448
- ),
4449
- onClick: () => xr("selection")
4450
- }
4451
- ),
4452
- He
4453
- ) : null
4454
- ] }) : null
4455
- }
4456
- ) : null,
4457
- ut ? /* @__PURE__ */ t(
4458
- "div",
4459
- {
4460
- className: al,
4461
- style: {
4462
- "--rte-typeahead-x": `${ut.left}px`,
4463
- "--rte-typeahead-y": `${ut.top}px`
4464
- },
4465
- children: /* @__PURE__ */ t(
4466
- lo,
4467
- {
4468
- ref: ur,
4469
- id: Sn,
4470
- variables: cr,
4471
- recentTokens: Y,
4472
- query: ut.query,
4473
- onQueryChange: Io,
4474
- onSelect: Lo,
4475
- onClose: _o,
4476
- searchFocusable: !1,
4477
- onActiveDescendantChange: zo
4478
- }
4479
- )
4480
- }
4481
- ) : null
4482
- ] }),
4483
- Q ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Go }) : null,
4484
- dt.length > 0 ? /* @__PURE__ */ t(
4485
- "p",
4486
- {
4487
- id: `${Me}-variables-error`,
4488
- role: "alert",
4489
- className: "ds:m-0 ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
4490
- children: $("editor.variableInvalid", {
4491
- tokens: dt.map((e) => `[[${e}]]`).join(", ")
4492
- })
4493
- }
4494
- ) : null,
4495
- Q && jo ? /* @__PURE__ */ t(
4496
- "p",
4497
- {
4498
- role: "alert",
4499
- className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
4500
- children: $("editor.ai.dictationError")
4501
- }
4502
- ) : null,
4503
- J || ae || de ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Uo }) : null,
4504
- Xo || Ar ? /* @__PURE__ */ t(
4505
- "p",
4506
- {
4507
- role: "alert",
4508
- className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
4509
- children: $(Ar ? "editor.ai.actionStale" : "editor.ai.actionError")
4510
- }
4511
- ) : null
4512
- ]
4513
- }
4514
- );
4515
- }
4516
- );
4517
- ul.displayName = "RichTextEditor";
4518
- export {
4519
- ul as R,
4520
- is as r,
4521
- il as w
4522
- };
4523
- //# sourceMappingURL=rich-text-editor-DCQEpaIv.js.map