@alfadocs/ui-kit 0.66.0 → 0.67.1

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 (153) hide show
  1. package/dist/_chunks/{agenda-card-Bl-SBiCh.js → agenda-card-BxSFkqgY.js} +2 -2
  2. package/dist/_chunks/{agenda-tray-Bh1KfEOG.js → agenda-tray-T-BumlGZ.js} +2 -2
  3. package/dist/_chunks/{ai-consent-banner-Btzmk8OH.js → ai-consent-banner-Dxtx_WAh.js} +2 -2
  4. package/dist/_chunks/{ai-tools-rail-DAfaW8eA.js → ai-tools-rail-CInA_1-E.js} +57 -50
  5. package/dist/_chunks/{alia-sidebar-CN8pA6c-.js → alia-sidebar-Ckv0yCKi.js} +2 -2
  6. package/dist/_chunks/{anamnesis-card-qeLYRG79.js → anamnesis-card-N8pIKWuS.js} +2 -2
  7. package/dist/_chunks/{antenatal-schedule-timeline-BfzFjEyb.js → antenatal-schedule-timeline-35ebkcZT.js} +2 -2
  8. package/dist/_chunks/{appointment-tray-BQnJEora.js → appointment-tray-BMl89NPW.js} +4 -4
  9. package/dist/_chunks/{badge-zsf5i5bH.js → badge-CqGsX32l.js} +46 -42
  10. package/dist/_chunks/{bishop-score-DPN4Ched.js → bishop-score-CjsB9bM-.js} +2 -2
  11. package/dist/_chunks/{bmi-calculator-DuUneHuZ.js → bmi-calculator-n-823_1V.js} +2 -2
  12. package/dist/_chunks/{care-plan-card-D42WD4-T.js → care-plan-card-BwVUyUBb.js} +4 -4
  13. package/dist/_chunks/{care-plan-entry-card-BukNI7Uy.js → care-plan-entry-card-VzdQHcOL.js} +4 -4
  14. package/dist/_chunks/{clinical-note-card-BYo437dU.js → clinical-note-card-gtrxv6zn.js} +2 -2
  15. package/dist/_chunks/{color-picker-9tL7pz5y.js → color-picker-FXpItIaF.js} +198 -175
  16. package/dist/_chunks/{contact-profile-card-CCeJmjbd.js → contact-profile-card-7BMB85T6.js} +2 -2
  17. package/dist/_chunks/{cycle-calculator-D6LTmtQt.js → cycle-calculator-BF0ointe.js} +2 -2
  18. package/dist/_chunks/{dependent-selector-CRWgieHm.js → dependent-selector-DpzGtr_J.js} +2 -2
  19. package/dist/_chunks/{document-scanner-biBS_f6c.js → document-scanner-D2qehl3-.js} +53 -53
  20. package/dist/_chunks/{due-date-calculator-CIG194vq.js → due-date-calculator-DU9AEWNy.js} +3 -3
  21. package/dist/_chunks/{editable-currency-cell-renderer-f3d0Rhue.js → editable-currency-cell-renderer-D1ewvJKO.js} +875 -809
  22. package/dist/_chunks/{fetal-weight-Xf8-ZoDy.js → fetal-weight-BVSzOhuR.js} +2 -2
  23. package/dist/_chunks/{gestational-age-calculator-BGsZaWXW.js → gestational-age-calculator-DBlFdoiP.js} +3 -3
  24. package/dist/_chunks/{hcg-doubling-LH5i6oM7.js → hcg-doubling-if4Q8aSX.js} +2 -2
  25. package/dist/_chunks/{marketplace-app-shell-Cou6XnMJ.js → marketplace-app-shell-D4-T9Qzz.js} +3 -3
  26. package/dist/_chunks/{message-card-Bgcvfj6-.js → message-card-Bx4GmLvf.js} +9 -9
  27. package/dist/_chunks/{message-tray-saAVMeHP.js → message-tray-CVyJajVJ.js} +2 -2
  28. package/dist/_chunks/{operator-hero-CM8949Hd.js → operator-hero-f_KaRhw5.js} +2 -2
  29. package/dist/_chunks/{patient-search-Bw9ONucF.js → patient-search-DR9XUYRQ.js} +2 -2
  30. package/dist/_chunks/{patient-shell-Tgpv0HND.js → patient-shell-BfgufL_q.js} +2 -2
  31. package/dist/_chunks/{patient-summary-card-Bgso0p_l.js → patient-summary-card-hEmr4eTW.js} +4 -4
  32. package/dist/_chunks/{payment-request-card-DBz3hVDz.js → payment-request-card-CYE5vhZ0.js} +3 -3
  33. package/dist/_chunks/{periodontal-chart-card-AYyHtU9K.js → periodontal-chart-card-Dh3KgvYG.js} +2 -2
  34. package/dist/_chunks/{practice-results-CVAgY2RZ.js → practice-results-DND2SAt7.js} +2 -2
  35. package/dist/_chunks/{pregnancy-dating-f9aJbiAk.js → pregnancy-dating-QY-sqpvj.js} +3 -3
  36. package/dist/_chunks/{pregnancy-weight-gain-BMRBeA8V.js → pregnancy-weight-gain-DOJXXNYP.js} +2 -2
  37. package/dist/_chunks/rich-text-editor-DAeCXiQG.js +1973 -0
  38. package/dist/_chunks/{scroll-area-BWqCkEGz.js → scroll-area-5wNK0Cyz.js} +40 -30
  39. package/dist/_chunks/{sidebar-BFwbx74W.js → sidebar-DaB4ulxH.js} +351 -344
  40. package/dist/_chunks/{suggestion-chip-C4kxWUIs.js → suggestion-chip-Bk4PmYTg.js} +30 -30
  41. package/dist/_chunks/{tab-bar-Xetknddo.js → tab-bar-B1ovILzh.js} +2 -2
  42. package/dist/_chunks/{tag-CdA0s_VV.js → tag-BQXwuJq1.js} +41 -38
  43. package/dist/_chunks/{transaction-chip-BZCa6XDn.js → transaction-chip-DK84XCBU.js} +46 -33
  44. package/dist/_chunks/{workflow-map-Bt4Of5dT.js → workflow-map-JAZryZJr.js} +2 -2
  45. package/dist/agent-catalog.json +1 -1
  46. package/dist/components/agenda-card/index.js +1 -1
  47. package/dist/components/agenda-tray/index.js +1 -1
  48. package/dist/components/ai-consent-banner/index.js +1 -1
  49. package/dist/components/ai-tools-rail/index.js +1 -1
  50. package/dist/components/anamnesis-card/index.js +1 -1
  51. package/dist/components/appointment-card/index.js +1 -1
  52. package/dist/components/badge/index.js +1 -1
  53. package/dist/components/bishop-score/index.js +1 -1
  54. package/dist/components/bmi-calculator/index.js +1 -1
  55. package/dist/components/care-plan-card/index.js +1 -1
  56. package/dist/components/care-plan-entry-card/index.js +1 -1
  57. package/dist/components/clinical-note-card/index.js +1 -1
  58. package/dist/components/color-picker/index.js +1 -1
  59. package/dist/components/contact-profile-card/index.js +1 -1
  60. package/dist/components/cycle-calculator/index.js +1 -1
  61. package/dist/components/data-table/cell-renderers/actions-cell-renderer.d.ts +16 -0
  62. package/dist/components/data-table/cell-renderers/tooth-cell-renderer.d.ts +12 -0
  63. package/dist/components/data-table/data-table.d.ts +1 -1
  64. package/dist/components/data-table/index.d.ts +2 -0
  65. package/dist/components/data-table/index.js +13 -12
  66. package/dist/components/data-table/toolbar.d.ts +5 -1
  67. package/dist/components/dependent-selector/index.js +1 -1
  68. package/dist/components/document-scanner/index.js +1 -1
  69. package/dist/components/due-date-calculator/index.js +2 -2
  70. package/dist/components/fetal-weight/index.js +1 -1
  71. package/dist/components/gestational-age-calculator/index.js +1 -1
  72. package/dist/components/hcg-doubling/index.js +1 -1
  73. package/dist/components/message-card/index.js +1 -1
  74. package/dist/components/message-tray/index.js +1 -1
  75. package/dist/components/operator-hero/index.js +1 -1
  76. package/dist/components/patient-search/index.js +1 -1
  77. package/dist/components/patient-summary-card/index.js +1 -1
  78. package/dist/components/payment-card/index.js +1 -1
  79. package/dist/components/periodontal-chart-card/index.js +1 -1
  80. package/dist/components/practice-results/index.js +1 -1
  81. package/dist/components/pregnancy-dating/index.js +1 -1
  82. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  83. package/dist/components/rich-text-editor/editor-toolbar.d.ts +25 -1
  84. package/dist/components/rich-text-editor/index.js +1 -1
  85. package/dist/components/rich-text-editor/rich-text-editor.d.ts +2 -0
  86. package/dist/components/scroll-area/index.js +1 -1
  87. package/dist/components/sidebar/index.js +1 -1
  88. package/dist/components/suggestion-chip/index.js +1 -1
  89. package/dist/components/tab-bar/index.js +1 -1
  90. package/dist/components/tag/index.js +1 -1
  91. package/dist/components/transaction-chip/index.js +1 -1
  92. package/dist/components/workflow/index.js +1 -1
  93. package/dist/i18n/locales/ar.d.ts +14 -1
  94. package/dist/i18n/locales/ar.js +16 -3
  95. package/dist/i18n/locales/de.d.ts +14 -1
  96. package/dist/i18n/locales/de.js +16 -3
  97. package/dist/i18n/locales/el.d.ts +14 -1
  98. package/dist/i18n/locales/el.js +16 -3
  99. package/dist/i18n/locales/en.d.ts +14 -1
  100. package/dist/i18n/locales/en.js +16 -3
  101. package/dist/i18n/locales/es.d.ts +14 -1
  102. package/dist/i18n/locales/es.js +16 -3
  103. package/dist/i18n/locales/fr.d.ts +14 -1
  104. package/dist/i18n/locales/fr.js +16 -3
  105. package/dist/i18n/locales/hi.d.ts +14 -1
  106. package/dist/i18n/locales/hi.js +16 -3
  107. package/dist/i18n/locales/it.d.ts +14 -1
  108. package/dist/i18n/locales/it.js +16 -3
  109. package/dist/i18n/locales/ja.d.ts +14 -1
  110. package/dist/i18n/locales/ja.js +16 -3
  111. package/dist/i18n/locales/nl.d.ts +14 -1
  112. package/dist/i18n/locales/nl.js +14 -3
  113. package/dist/i18n/locales/pl.d.ts +14 -1
  114. package/dist/i18n/locales/pl.js +16 -3
  115. package/dist/i18n/locales/pt.d.ts +14 -1
  116. package/dist/i18n/locales/pt.js +16 -3
  117. package/dist/i18n/locales/ro.d.ts +14 -1
  118. package/dist/i18n/locales/ro.js +16 -3
  119. package/dist/i18n/locales/ru.d.ts +14 -1
  120. package/dist/i18n/locales/ru.js +16 -3
  121. package/dist/i18n/locales/sq.d.ts +14 -1
  122. package/dist/i18n/locales/sq.js +16 -3
  123. package/dist/i18n/locales/sv.d.ts +14 -1
  124. package/dist/i18n/locales/sv.js +14 -3
  125. package/dist/i18n/locales/tr.d.ts +14 -1
  126. package/dist/i18n/locales/tr.js +16 -3
  127. package/dist/i18n/locales/zh.d.ts +14 -1
  128. package/dist/i18n/locales/zh.js +14 -3
  129. package/dist/index.js +508 -507
  130. package/dist/locales/ar.json +16 -3
  131. package/dist/locales/de.json +16 -3
  132. package/dist/locales/el.json +16 -3
  133. package/dist/locales/en.json +16 -3
  134. package/dist/locales/es.json +16 -3
  135. package/dist/locales/fr.json +16 -3
  136. package/dist/locales/hi.json +16 -3
  137. package/dist/locales/it.json +16 -3
  138. package/dist/locales/ja.json +16 -3
  139. package/dist/locales/nl.json +16 -3
  140. package/dist/locales/pl.json +16 -3
  141. package/dist/locales/pt.json +16 -3
  142. package/dist/locales/ro.json +16 -3
  143. package/dist/locales/ru.json +16 -3
  144. package/dist/locales/sq.json +16 -3
  145. package/dist/locales/sv.json +16 -3
  146. package/dist/locales/tr.json +16 -3
  147. package/dist/locales/zh.json +16 -3
  148. package/dist/patterns/alia-assistant/index.js +1 -1
  149. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  150. package/dist/patterns/patient-shell/index.js +1 -1
  151. package/dist/tokens.css +6 -3
  152. package/package.json +1 -1
  153. package/dist/_chunks/rich-text-editor-B5XQNxe8.js +0 -1586
@@ -0,0 +1,1973 @@
1
+ import { jsx as e, jsxs as v, Fragment as Ie } from "react/jsx-runtime";
2
+ import { useId as ie, useState as M, useRef as D, useCallback as z, useEffect as ee, Fragment as ft, forwardRef as gt, useMemo as Ge, useImperativeHandle as pt } from "react";
3
+ import { c as $e } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as Q } from "react-i18next";
5
+ import { SafeHtml as bt, sanitiseHtml as vt } from "../safe-html/index.js";
6
+ import { u as yt } from "./registry-nPAVE19X.js";
7
+ import { I as q } from "./icon-button-LqoiKcUN.js";
8
+ import { S as wt } from "./spinner-hbwuKwMf.js";
9
+ import { T as kt } from "./text-area-BIx0tZ05.js";
10
+ import { E as xt } from "./editor-overlay-wYm22wZK.js";
11
+ import { R as Ct } from "./rotate-ccw-BWANpitO.js";
12
+ import { C as Nt } from "./check-DPdL_Sm7.js";
13
+ import { S as Ae } from "./square-CZoGU14v.js";
14
+ import { M as Ee } from "./mic-B4Gog3Gi.js";
15
+ import { S as zt } from "./send-CySZIRPJ.js";
16
+ import { S as He } from "./sparkles-CuYXqQLg.js";
17
+ import { B as oe } from "./button-DD_0Xdmr.js";
18
+ import { a as Tt } from "./tooltip-DvmfrNvB.js";
19
+ import { P } from "./popover-DTbfAuR0.js";
20
+ import { D as ke } from "./dropdown-menu-DwwPovMZ.js";
21
+ import { D as j } from "./dialog-DMGnSelc.js";
22
+ import { C as Le } from "./color-picker-FXpItIaF.js";
23
+ import { T as Ce } from "./text-input-BaClJL8Y.js";
24
+ import { C as Mt } from "./checkbox-DRcOdmXv.js";
25
+ import { F as Rt } from "./file-upload-BosbPDb1.js";
26
+ import { c as S } from "./createLucideIcon-CrFbzy84.js";
27
+ import { C as _t } from "./chevron-down-BX_NP2Yh.js";
28
+ import { I as St } from "./image-C6RM5hfF.js";
29
+ import { C as At } from "./columns-2-BTOBZbep.js";
30
+ import { T as Et } from "./trash-2-rPAKaRgB.js";
31
+ /**
32
+ * @license lucide-react v1.8.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */
37
+ const Ht = [
38
+ ["rect", { width: "13", height: "7", x: "3", y: "3", rx: "1", key: "11xb64" }],
39
+ ["path", { d: "m22 15-3-3 3-3", key: "26chmm" }],
40
+ ["rect", { width: "13", height: "7", x: "3", y: "14", rx: "1", key: "k6ky7n" }]
41
+ ], It = S("between-horizontal-end", Ht);
42
+ /**
43
+ * @license lucide-react v1.8.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */
48
+ const $t = [
49
+ ["rect", { width: "13", height: "7", x: "8", y: "3", rx: "1", key: "pkso9a" }],
50
+ ["path", { d: "m2 9 3 3-3 3", key: "1agib5" }],
51
+ ["rect", { width: "13", height: "7", x: "8", y: "14", rx: "1", key: "1q5fc1" }]
52
+ ], Lt = S("between-horizontal-start", $t);
53
+ /**
54
+ * @license lucide-react v1.8.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ */
59
+ const Ot = [
60
+ ["rect", { width: "7", height: "13", x: "3", y: "3", rx: "1", key: "1fdu0f" }],
61
+ ["path", { d: "m9 22 3-3 3 3", key: "17z65a" }],
62
+ ["rect", { width: "7", height: "13", x: "14", y: "3", rx: "1", key: "1squn4" }]
63
+ ], Dt = S("between-vertical-end", Ot);
64
+ /**
65
+ * @license lucide-react v1.8.0 - ISC
66
+ *
67
+ * This source code is licensed under the ISC license.
68
+ * See the LICENSE file in the root directory of this source tree.
69
+ */
70
+ const jt = [
71
+ ["rect", { width: "7", height: "13", x: "3", y: "8", rx: "1", key: "1fjrkv" }],
72
+ ["path", { d: "m15 2-3 3-3-3", key: "1uh6eb" }],
73
+ ["rect", { width: "7", height: "13", x: "14", y: "8", rx: "1", key: "w3fjg8" }]
74
+ ], qt = S("between-vertical-start", jt);
75
+ /**
76
+ * @license lucide-react v1.8.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */
81
+ const Pt = [
82
+ [
83
+ "path",
84
+ { 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" }
85
+ ]
86
+ ], Bt = S("bold", Pt);
87
+ /**
88
+ * @license lucide-react v1.8.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */
93
+ const Ft = [
94
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
95
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
96
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
97
+ ["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
98
+ ], Vt = S("heading-2", Ft);
99
+ /**
100
+ * @license lucide-react v1.8.0 - ISC
101
+ *
102
+ * This source code is licensed under the ISC license.
103
+ * See the LICENSE file in the root directory of this source tree.
104
+ */
105
+ const Gt = [
106
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
107
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
108
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
109
+ ["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
110
+ ["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
111
+ ], Wt = S("heading-3", Gt);
112
+ /**
113
+ * @license lucide-react v1.8.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */
118
+ const Ut = [
119
+ ["path", { d: "m9 11-6 6v3h9l3-3", key: "1a3l36" }],
120
+ ["path", { d: "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4", key: "14a9rk" }]
121
+ ], Xt = S("highlighter", Ut);
122
+ /**
123
+ * @license lucide-react v1.8.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */
128
+ const Qt = [
129
+ ["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
130
+ ["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
131
+ ["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
132
+ ], Yt = S("italic", Qt);
133
+ /**
134
+ * @license lucide-react v1.8.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ */
139
+ const Zt = [
140
+ ["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" }],
141
+ ["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" }]
142
+ ], Jt = S("link", Zt);
143
+ /**
144
+ * @license lucide-react v1.8.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */
149
+ const Kt = [
150
+ ["path", { d: "M11 5h10", key: "1cz7ny" }],
151
+ ["path", { d: "M11 12h10", key: "1438ji" }],
152
+ ["path", { d: "M11 19h10", key: "11t30w" }],
153
+ ["path", { d: "M4 4h1v5", key: "10yrso" }],
154
+ ["path", { d: "M4 9h2", key: "r1h2o0" }],
155
+ ["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" }]
156
+ ], er = S("list-ordered", Kt);
157
+ /**
158
+ * @license lucide-react v1.8.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */
163
+ const tr = [
164
+ ["path", { d: "M3 5h.01", key: "18ugdj" }],
165
+ ["path", { d: "M3 12h.01", key: "nlz23k" }],
166
+ ["path", { d: "M3 19h.01", key: "noohij" }],
167
+ ["path", { d: "M8 5h13", key: "1pao27" }],
168
+ ["path", { d: "M8 12h13", key: "1za7za" }],
169
+ ["path", { d: "M8 19h13", key: "m83p4d" }]
170
+ ], rr = S("list", tr);
171
+ /**
172
+ * @license lucide-react v1.8.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 nr = [
178
+ ["path", { d: "M11 7 6 2", key: "1jwth8" }],
179
+ ["path", { d: "M18.992 12H2.041", key: "xw1gg" }],
180
+ [
181
+ "path",
182
+ {
183
+ 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",
184
+ key: "1nkol4"
185
+ }
186
+ ],
187
+ [
188
+ "path",
189
+ {
190
+ 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",
191
+ key: "1nk1rd"
192
+ }
193
+ ]
194
+ ], or = S("paint-bucket", nr);
195
+ /**
196
+ * @license lucide-react v1.8.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */
201
+ const ar = [
202
+ ["rect", { width: "16", height: "6", x: "2", y: "2", rx: "2", key: "jcyz7m" }],
203
+ ["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" }],
204
+ ["rect", { width: "4", height: "6", x: "8", y: "16", rx: "1", key: "d6e7yl" }]
205
+ ], ir = S("paint-roller", ar);
206
+ /**
207
+ * @license lucide-react v1.8.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */
212
+ const sr = [
213
+ [
214
+ "path",
215
+ {
216
+ 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",
217
+ key: "e79jfc"
218
+ }
219
+ ],
220
+ ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
221
+ ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
222
+ ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
223
+ ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
224
+ ], lr = S("palette", sr);
225
+ /**
226
+ * @license lucide-react v1.8.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */
231
+ const dr = [
232
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
233
+ ["path", { d: "M14 9h1", key: "l0svgy" }],
234
+ ["path", { d: "M19 9h2", key: "te2zfg" }],
235
+ ["path", { d: "M3 9h2", key: "1h4ldw" }],
236
+ ["path", { d: "M9 9h1", key: "15jzuz" }]
237
+ ], cr = S("panel-top-dashed", dr);
238
+ /**
239
+ * @license lucide-react v1.8.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */
244
+ const ur = [
245
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
246
+ ["path", { d: "M3 9h18", key: "1pudct" }]
247
+ ], mr = S("panel-top", ur);
248
+ /**
249
+ * @license lucide-react v1.8.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */
254
+ const hr = [
255
+ ["path", { d: "M13 4v16", key: "8vvj80" }],
256
+ ["path", { d: "M17 4v16", key: "7dpous" }],
257
+ ["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
258
+ ], fr = S("pilcrow", hr);
259
+ /**
260
+ * @license lucide-react v1.8.0 - ISC
261
+ *
262
+ * This source code is licensed under the ISC license.
263
+ * See the LICENSE file in the root directory of this source tree.
264
+ */
265
+ const gr = [
266
+ [
267
+ "path",
268
+ {
269
+ 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",
270
+ key: "rib7q0"
271
+ }
272
+ ],
273
+ [
274
+ "path",
275
+ {
276
+ 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",
277
+ key: "1ymkrd"
278
+ }
279
+ ]
280
+ ], pr = S("quote", gr);
281
+ /**
282
+ * @license lucide-react v1.8.0 - ISC
283
+ *
284
+ * This source code is licensed under the ISC license.
285
+ * See the LICENSE file in the root directory of this source tree.
286
+ */
287
+ const br = [
288
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
289
+ ["path", { d: "M3 12h18", key: "1i2n21" }]
290
+ ], vr = S("rows-2", br);
291
+ /**
292
+ * @license lucide-react v1.8.0 - ISC
293
+ *
294
+ * This source code is licensed under the ISC license.
295
+ * See the LICENSE file in the root directory of this source tree.
296
+ */
297
+ const yr = [
298
+ ["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
299
+ ["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
300
+ ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
301
+ ], wr = S("strikethrough", yr);
302
+ /**
303
+ * @license lucide-react v1.8.0 - ISC
304
+ *
305
+ * This source code is licensed under the ISC license.
306
+ * See the LICENSE file in the root directory of this source tree.
307
+ */
308
+ const kr = [
309
+ ["path", { d: "M12 3v18", key: "108xh3" }],
310
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
311
+ ["path", { d: "M3 9h18", key: "1pudct" }],
312
+ ["path", { d: "M3 15h18", key: "5xshup" }]
313
+ ], xr = S("table", kr);
314
+ /**
315
+ * @license lucide-react v1.8.0 - ISC
316
+ *
317
+ * This source code is licensed under the ISC license.
318
+ * See the LICENSE file in the root directory of this source tree.
319
+ */
320
+ const Cr = [
321
+ ["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
322
+ ["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
323
+ ], Nr = S("underline", Cr);
324
+ /**
325
+ * @license lucide-react v1.8.0 - ISC
326
+ *
327
+ * This source code is licensed under the ISC license.
328
+ * See the LICENSE file in the root directory of this source tree.
329
+ */
330
+ const zr = [
331
+ [
332
+ "path",
333
+ {
334
+ d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",
335
+ key: "1ngwbx"
336
+ }
337
+ ]
338
+ ], Tr = S("wrench", zr), Mr = {
339
+ id: "rich-text-editor",
340
+ capabilities: ["edit_inline"],
341
+ state: {
342
+ html: {
343
+ type: "string",
344
+ description: "Sanitised HTML representation of the editor content.",
345
+ read: (n) => n.getHTML()
346
+ },
347
+ text: {
348
+ type: "string",
349
+ description: "Plain-text content of the editor (tags stripped).",
350
+ read: (n) => n.getText()
351
+ },
352
+ markdown: {
353
+ type: "string",
354
+ description: "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
355
+ read: (n) => n.getMarkdown()
356
+ }
357
+ },
358
+ actions: {
359
+ set_content: {
360
+ safety: "destructive",
361
+ argsType: "{ html: string }",
362
+ description: "Replace the editor content. Loses unsaved input.",
363
+ invoke: (n, a) => {
364
+ n.setContent(a.html);
365
+ }
366
+ },
367
+ insert_at_cursor: {
368
+ safety: "destructive",
369
+ argsType: "{ content: string; asHtml?: boolean }",
370
+ 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.",
371
+ invoke: (n, a) => {
372
+ n.insertAtCursor(a.content, { asHtml: a.asHtml });
373
+ }
374
+ },
375
+ apply_format: {
376
+ safety: "destructive",
377
+ argsType: "{ format: 'bold' | 'italic' | 'strikethrough' | 'bulletedList' | 'numberedList' | 'heading' | 'quote' | 'paragraph' }",
378
+ description: "Toggle/apply a block or inline format on the current selection (bold, italic, strikethrough, bulleted/numbered list, heading, quote, paragraph).",
379
+ invoke: (n, a) => {
380
+ n.applyFormat(a.format);
381
+ }
382
+ },
383
+ clear: {
384
+ safety: "destructive",
385
+ description: "Empty the editor. Loses unsaved input.",
386
+ invoke: (n) => {
387
+ n.clear();
388
+ }
389
+ },
390
+ focus: {
391
+ safety: "read",
392
+ description: "Move keyboard focus to the editor surface.",
393
+ invoke: (n) => {
394
+ n.focus();
395
+ }
396
+ }
397
+ },
398
+ domHooks: {
399
+ root: { attr: "data-component", value: "rich-text-editor" },
400
+ instanceId: {
401
+ attr: "data-component-id",
402
+ sourceProp: "id",
403
+ description: "Sourced from the id prop."
404
+ }
405
+ }
406
+ }, Rr = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", _r = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", Sr = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]", We = [
407
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
408
+ "ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
409
+ "ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
410
+ "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]"
411
+ ].join(" ");
412
+ function Ue(n, a) {
413
+ return a ? n ? /\s$/.test(n) ? `${n}${a}` : `${n} ${a}` : a : n;
414
+ }
415
+ function Ar({
416
+ open: n,
417
+ onClose: a,
418
+ onRequestAiDraft: c,
419
+ onInsert: s,
420
+ previewAsHtml: l = !0,
421
+ privacyNotice: h,
422
+ onDictate: f
423
+ }) {
424
+ const { t: i } = Q(), p = ie(), y = ie(), [T, I] = M(""), [A, k] = M(!1), [$, u] = M(!1), [m, b] = M(null), H = D(null), [R, E] = M(!1), [J, C] = M(""), [L, Y] = M(""), G = D(null), x = z(() => {
425
+ var N;
426
+ (N = G.current) == null || N.abort();
427
+ }, []), B = z(() => {
428
+ if (!f) return;
429
+ const N = new AbortController();
430
+ G.current = N, E(!0), C(""), Y(i("editor.ai.listening")), f({
431
+ signal: N.signal,
432
+ onPartialTranscript: (O) => {
433
+ N.signal.aborted || C(O);
434
+ },
435
+ onFinalTranscript: (O) => {
436
+ if (N.signal.aborted) return;
437
+ const te = O.trim();
438
+ C(""), te && (I((V) => Ue(V, te)), Y(te));
439
+ }
440
+ }).catch(() => {
441
+ }).finally(() => {
442
+ C(""), G.current === N && (G.current = null, E(!1), Y(""));
443
+ });
444
+ }, [f, i]), F = z(() => {
445
+ R ? x() : B();
446
+ }, [R, B, x]);
447
+ ee(() => {
448
+ var N, O;
449
+ n ? (I(""), k(!1), u(!1), b(null), C(""), Y("")) : ((N = H.current) == null || N.abort(), H.current = null, (O = G.current) == null || O.abort());
450
+ }, [n]), ee(
451
+ () => () => {
452
+ var N, O;
453
+ (N = H.current) == null || N.abort(), (O = G.current) == null || O.abort();
454
+ },
455
+ []
456
+ );
457
+ const se = z(() => {
458
+ var te;
459
+ const N = T.trim();
460
+ if (!N || A) return;
461
+ x(), (te = H.current) == null || te.abort();
462
+ const O = new AbortController();
463
+ H.current = O, u(!1), k(!0), c({ prompt: N, signal: O.signal }).then((V) => {
464
+ O.signal.aborted || (b(V), k(!1));
465
+ }).catch((V) => {
466
+ O.signal.aborted || V && typeof V == "object" && "name" in V && V.name === "AbortError" || (u(!0), k(!1));
467
+ });
468
+ }, [T, A, c, x]), he = z(() => {
469
+ m != null && (s(m), a());
470
+ }, [m, s, a]), W = m != null, fe = R ? Ue(T, J) : T;
471
+ return /* @__PURE__ */ e(
472
+ xt,
473
+ {
474
+ open: n,
475
+ onClose: a,
476
+ title: /* @__PURE__ */ v("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
477
+ /* @__PURE__ */ e(He, { "aria-hidden": "true", className: "ds:size-4" }),
478
+ i("editor.ai.dialogTitle")
479
+ ] }),
480
+ ariaLabel: i("editor.ai.dialogTitle"),
481
+ children: W ? /* @__PURE__ */ v("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-xs)]", children: [
482
+ /* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: l ? /* @__PURE__ */ e(
483
+ bt,
484
+ {
485
+ html: m,
486
+ profile: "rich-text",
487
+ className: We,
488
+ tabIndex: 0,
489
+ "aria-label": i("editor.ai.dialogTitle")
490
+ }
491
+ ) : (
492
+ // Focusable so a keyboard user can scroll a long draft preview
493
+ // (mirrors the SafeHtml preview branch above). The lint rule's
494
+ // tabIndex allowlist doesn't cover a scrollable, non-interactive
495
+ // text region.
496
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
497
+ /* @__PURE__ */ e("p", { className: We, tabIndex: 0, children: m })
498
+ ) }),
499
+ /* @__PURE__ */ e(
500
+ q,
501
+ {
502
+ size: "sm",
503
+ intent: "ghost",
504
+ className: "ds:rounded-full",
505
+ icon: /* @__PURE__ */ e(Ct, {}),
506
+ "aria-label": i("editor.ai.retry"),
507
+ onClick: () => b(null)
508
+ }
509
+ ),
510
+ /* @__PURE__ */ e(
511
+ q,
512
+ {
513
+ size: "sm",
514
+ intent: "primary",
515
+ className: "ds:rounded-full",
516
+ icon: /* @__PURE__ */ e(Nt, {}),
517
+ "aria-label": i("common.confirm"),
518
+ onClick: he
519
+ }
520
+ )
521
+ ] }) : /* @__PURE__ */ v(Ie, { children: [
522
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-xs)]", children: [
523
+ /* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ e(
524
+ kt,
525
+ {
526
+ id: p,
527
+ size: "md",
528
+ value: fe,
529
+ onChange: (N) => I(N.target.value),
530
+ placeholder: i("editor.ai.promptPlaceholder"),
531
+ "aria-label": i("editor.ai.promptLabel"),
532
+ autoResize: !0,
533
+ minRows: 1,
534
+ maxRows: 3,
535
+ readOnly: R,
536
+ tone: $ ? "error" : "default",
537
+ "aria-describedby": $ ? y : void 0
538
+ }
539
+ ) }),
540
+ f ? /* @__PURE__ */ e(
541
+ q,
542
+ {
543
+ size: "sm",
544
+ intent: "ghost",
545
+ className: R ? Rr : void 0,
546
+ icon: R ? /* @__PURE__ */ e(Ae, { className: "ds:fill-current" }) : /* @__PURE__ */ e(Ee, {}),
547
+ "aria-pressed": R,
548
+ "aria-label": i(R ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
549
+ onClick: F
550
+ }
551
+ ) : null,
552
+ /* @__PURE__ */ e(
553
+ q,
554
+ {
555
+ size: "sm",
556
+ intent: "primary",
557
+ icon: A ? /* @__PURE__ */ e(wt, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(zt, {}),
558
+ className: "ds:rounded-full",
559
+ disabled: A || !T.trim(),
560
+ "aria-busy": A || void 0,
561
+ "aria-label": i("editor.ai.generate"),
562
+ onClick: se
563
+ }
564
+ )
565
+ ] }),
566
+ f ? /* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: L }) : null,
567
+ $ ? /* @__PURE__ */ e("p", { id: y, role: "alert", className: Sr, children: i("editor.ai.error") }) : h ? /* @__PURE__ */ e("p", { className: _r, children: h }) : null
568
+ ] })
569
+ }
570
+ );
571
+ }
572
+ const Er = {
573
+ bold: {
574
+ id: "bold",
575
+ icon: /* @__PURE__ */ e(Bt, {}),
576
+ label: ["editor.bold", "Bold"],
577
+ command: ["module.inline.format", { tag: "b" }],
578
+ toggle: "bold"
579
+ },
580
+ italic: {
581
+ id: "italic",
582
+ icon: /* @__PURE__ */ e(Yt, {}),
583
+ label: ["editor.italic", "Italic"],
584
+ command: ["module.inline.format", { tag: "i" }],
585
+ toggle: "italic"
586
+ },
587
+ underline: {
588
+ id: "underline",
589
+ icon: /* @__PURE__ */ e(Nr, {}),
590
+ label: ["editor.underline", "Underline"],
591
+ command: ["module.inline.format", { tag: "u" }],
592
+ toggle: "underline"
593
+ },
594
+ strike: {
595
+ id: "strike",
596
+ icon: /* @__PURE__ */ e(wr, {}),
597
+ label: ["editor.strike", "Strikethrough"],
598
+ command: ["module.inline.format", { tag: "del" }],
599
+ toggle: "strike"
600
+ },
601
+ ul: {
602
+ id: "ul",
603
+ icon: /* @__PURE__ */ e(rr, {}),
604
+ label: ["editor.list.bullet", "Bulleted list"],
605
+ command: ["module.list.toggle", "ul"],
606
+ toggle: "ul"
607
+ },
608
+ ol: {
609
+ id: "ol",
610
+ icon: /* @__PURE__ */ e(er, {}),
611
+ label: ["editor.list.ordered", "Numbered list"],
612
+ command: ["module.list.toggle", "ol"],
613
+ toggle: "ol"
614
+ }
615
+ }, _e = [
616
+ {
617
+ id: "paragraph",
618
+ tag: "p",
619
+ icon: /* @__PURE__ */ e(fr, {}),
620
+ label: ["editor.paragraph", "Paragraph"]
621
+ },
622
+ {
623
+ id: "h2",
624
+ tag: "h2",
625
+ icon: /* @__PURE__ */ e(Vt, {}),
626
+ label: ["editor.heading2", "Heading 2"]
627
+ },
628
+ {
629
+ id: "h3",
630
+ tag: "h3",
631
+ icon: /* @__PURE__ */ e(Wt, {}),
632
+ label: ["editor.heading3", "Heading 3"]
633
+ },
634
+ {
635
+ id: "quote",
636
+ tag: "blockquote",
637
+ icon: /* @__PURE__ */ e(pr, {}),
638
+ label: ["editor.quote", "Quote"]
639
+ }
640
+ ], Hr = {
641
+ minimal: ["bold", "italic", "link"],
642
+ standard: [
643
+ "format",
644
+ "bold",
645
+ "italic",
646
+ "underline",
647
+ "strike",
648
+ "ul",
649
+ "ol",
650
+ "link"
651
+ ],
652
+ full: ["format", "bold", "italic", "underline", "strike", "ul", "ol", "link"]
653
+ }, Ye = [
654
+ {
655
+ id: "rowAbove",
656
+ command: "plugin.table.addRowAbove",
657
+ icon: /* @__PURE__ */ e(Lt, {}),
658
+ label: ["editor.table.rowAbove", "Add row above"]
659
+ },
660
+ {
661
+ id: "rowBelow",
662
+ command: "plugin.table.addRowBelow",
663
+ icon: /* @__PURE__ */ e(It, {}),
664
+ label: ["editor.table.rowBelow", "Add row below"]
665
+ },
666
+ {
667
+ id: "colLeft",
668
+ command: "plugin.table.addColumnLeft",
669
+ icon: /* @__PURE__ */ e(qt, {}),
670
+ label: ["editor.table.columnLeft", "Add column left"]
671
+ },
672
+ {
673
+ id: "colRight",
674
+ command: "plugin.table.addColumnRight",
675
+ icon: /* @__PURE__ */ e(Dt, {}),
676
+ label: ["editor.table.columnRight", "Add column right"]
677
+ },
678
+ {
679
+ id: "addHead",
680
+ command: "plugin.table.addHead",
681
+ icon: /* @__PURE__ */ e(mr, {}),
682
+ label: ["editor.table.addHeader", "Add header row"]
683
+ },
684
+ {
685
+ id: "deleteHead",
686
+ command: "plugin.table.deleteHead",
687
+ icon: /* @__PURE__ */ e(cr, {}),
688
+ label: ["editor.table.deleteHeader", "Remove header row"]
689
+ },
690
+ {
691
+ id: "deleteRow",
692
+ command: "plugin.table.deleteRow",
693
+ icon: /* @__PURE__ */ e(vr, {}),
694
+ label: ["editor.table.deleteRow", "Delete row"]
695
+ },
696
+ {
697
+ id: "deleteColumn",
698
+ command: "plugin.table.deleteColumn",
699
+ icon: /* @__PURE__ */ e(At, {}),
700
+ label: ["editor.table.deleteColumn", "Delete column"]
701
+ },
702
+ {
703
+ id: "deleteTable",
704
+ command: "plugin.table.deleteTable",
705
+ icon: /* @__PURE__ */ e(Et, {}),
706
+ label: ["editor.table.deleteTable", "Delete table"]
707
+ }
708
+ ], xe = 6, Ir = $e(
709
+ [
710
+ "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
711
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
712
+ "ds:bg-[var(--background)] ds:p-[var(--spacing-xs)]",
713
+ "ds:shadow-[var(--shadow-md)]"
714
+ ].join(" ")
715
+ ), Ze = "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[var(--border)] ds:[margin-inline:var(--spacing-2xs)]", me = "ds:text-[length:var(--font-size-sm)] ds:font-medium ds:text-[color:var(--foreground)]";
716
+ function Ne(n) {
717
+ return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
718
+ }
719
+ function $r({
720
+ run: n,
721
+ active: a,
722
+ onTriggerDown: c
723
+ }) {
724
+ const { t: s } = Q(), l = _e.find((h) => a.has(h.id)) ?? _e[0];
725
+ return /* @__PURE__ */ v(ke.Root, { children: [
726
+ /* @__PURE__ */ e(ke.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
727
+ oe,
728
+ {
729
+ size: "sm",
730
+ intent: "ghost",
731
+ startIcon: l.icon,
732
+ endIcon: /* @__PURE__ */ e(_t, {}),
733
+ "aria-label": s("editor.format", "Paragraph style"),
734
+ onMouseDown: c,
735
+ children: s(l.label[0], l.label[1])
736
+ }
737
+ ) }),
738
+ /* @__PURE__ */ e(ke.Content, { align: "start", children: _e.map((h) => /* @__PURE__ */ e(
739
+ ke.Item,
740
+ {
741
+ startIcon: h.icon,
742
+ onSelect: () => n("module.block.format", { tag: h.tag }),
743
+ children: s(h.label[0], h.label[1])
744
+ },
745
+ h.id
746
+ )) })
747
+ ] });
748
+ }
749
+ function Lr({
750
+ insertHtml: n,
751
+ saveSelection: a,
752
+ restoreSelection: c,
753
+ getSelectedText: s
754
+ }) {
755
+ const { t: l } = Q(), [h, f] = M(!1), [i, p] = M(""), [y, T] = M(""), [I, A] = M(!1), k = ie(), $ = ie(), u = () => {
756
+ p(""), T(""), A(!1);
757
+ }, m = () => {
758
+ const b = i.trim();
759
+ if (!b) return;
760
+ const H = y.trim() || b, R = I ? ' target="_blank" rel="noopener noreferrer"' : "", E = `<a href="${Ne(b)}"${R}>${Ne(H)}</a>`;
761
+ f(!1), u(), window.requestAnimationFrame(() => {
762
+ c(), n(E);
763
+ });
764
+ };
765
+ return /* @__PURE__ */ v(j.Root, { open: h, onOpenChange: f, children: [
766
+ /* @__PURE__ */ e(j.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
767
+ q,
768
+ {
769
+ size: "sm",
770
+ intent: "ghost",
771
+ icon: /* @__PURE__ */ e(Jt, {}),
772
+ "aria-label": l("editor.link.insert", "Insert link"),
773
+ onMouseDown: () => {
774
+ a(), T(s());
775
+ }
776
+ }
777
+ ) }),
778
+ /* @__PURE__ */ v(j.Content, { children: [
779
+ /* @__PURE__ */ e(j.Header, { children: /* @__PURE__ */ e(j.Title, { children: l("editor.link.insert", "Insert link") }) }),
780
+ /* @__PURE__ */ v(j.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
781
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
782
+ /* @__PURE__ */ e("label", { htmlFor: k, className: me, children: l("editor.link.url", "URL") }),
783
+ /* @__PURE__ */ e(
784
+ Ce,
785
+ {
786
+ id: k,
787
+ type: "url",
788
+ value: i,
789
+ onChange: (b) => p(b.target.value),
790
+ placeholder: "https://…"
791
+ }
792
+ )
793
+ ] }),
794
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
795
+ /* @__PURE__ */ e("label", { htmlFor: $, className: me, children: l("editor.link.text", "Text to display") }),
796
+ /* @__PURE__ */ e(
797
+ Ce,
798
+ {
799
+ id: $,
800
+ value: y,
801
+ onChange: (b) => T(b.target.value),
802
+ placeholder: l("editor.link.textPlaceholder", "Link text")
803
+ }
804
+ )
805
+ ] }),
806
+ /* @__PURE__ */ e(
807
+ Mt,
808
+ {
809
+ checked: I,
810
+ onCheckedChange: (b) => A(b === !0),
811
+ label: l("editor.link.newTab", "Open in new tab")
812
+ }
813
+ )
814
+ ] }),
815
+ /* @__PURE__ */ v(j.Footer, { children: [
816
+ /* @__PURE__ */ e(j.Close, { asChild: !0, children: /* @__PURE__ */ e(oe, { intent: "secondary", children: l("common.cancel") }) }),
817
+ /* @__PURE__ */ e(oe, { onClick: m, disabled: !i.trim(), children: l("editor.link.insertAction", "Insert") })
818
+ ] })
819
+ ] })
820
+ ] });
821
+ }
822
+ function Or({
823
+ insertHtml: n,
824
+ saveSelection: a,
825
+ restoreSelection: c,
826
+ uploadImage: s
827
+ }) {
828
+ const { t: l } = Q(), [h, f] = M(!1), [i, p] = M(""), [y, T] = M(""), I = ie(), A = ie(), k = (u, m) => {
829
+ const b = `<img src="${Ne(u)}" alt="${Ne(m)}" loading="lazy">`;
830
+ f(!1), p(""), T(""), window.requestAnimationFrame(() => {
831
+ c(), n(b);
832
+ });
833
+ }, $ = () => {
834
+ const u = i.trim();
835
+ u && k(u, y.trim());
836
+ };
837
+ return /* @__PURE__ */ v(j.Root, { open: h, onOpenChange: f, children: [
838
+ /* @__PURE__ */ e(j.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
839
+ q,
840
+ {
841
+ size: "sm",
842
+ intent: "ghost",
843
+ icon: /* @__PURE__ */ e(St, {}),
844
+ "aria-label": l("editor.image.insert", "Insert image"),
845
+ onMouseDown: () => a()
846
+ }
847
+ ) }),
848
+ /* @__PURE__ */ v(j.Content, { children: [
849
+ /* @__PURE__ */ e(j.Header, { children: /* @__PURE__ */ e(j.Title, { children: l("editor.image.insert", "Insert image") }) }),
850
+ /* @__PURE__ */ v(j.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
851
+ s ? /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
852
+ /* @__PURE__ */ e("span", { className: me, children: l("editor.image.upload", "Upload") }),
853
+ /* @__PURE__ */ e(
854
+ Rt,
855
+ {
856
+ variant: "dropzone",
857
+ accept: {
858
+ "image/*": [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"]
859
+ },
860
+ maxFiles: 1,
861
+ onUpload: async (u, { signal: m }) => {
862
+ const b = await s(u, m);
863
+ k(b, u.name);
864
+ }
865
+ }
866
+ ),
867
+ /* @__PURE__ */ e("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: l("editor.image.orUrl", "Or paste an image URL") })
868
+ ] }) : null,
869
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
870
+ /* @__PURE__ */ e("label", { htmlFor: I, className: me, children: l("editor.image.url", "Image URL") }),
871
+ /* @__PURE__ */ e(
872
+ Ce,
873
+ {
874
+ id: I,
875
+ type: "url",
876
+ value: i,
877
+ onChange: (u) => p(u.target.value),
878
+ placeholder: "https://…"
879
+ }
880
+ )
881
+ ] }),
882
+ /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
883
+ /* @__PURE__ */ e("label", { htmlFor: A, className: me, children: l("editor.image.alt", "Alt text") }),
884
+ /* @__PURE__ */ e(
885
+ Ce,
886
+ {
887
+ id: A,
888
+ value: y,
889
+ onChange: (u) => T(u.target.value),
890
+ placeholder: l(
891
+ "editor.image.altPlaceholder",
892
+ "Describe the image"
893
+ )
894
+ }
895
+ )
896
+ ] })
897
+ ] }),
898
+ /* @__PURE__ */ v(j.Footer, { children: [
899
+ /* @__PURE__ */ e(j.Close, { asChild: !0, children: /* @__PURE__ */ e(oe, { intent: "secondary", children: l("common.cancel") }) }),
900
+ /* @__PURE__ */ e(oe, { onClick: $, disabled: !i.trim(), children: l("editor.image.insertAction", "Insert") })
901
+ ] })
902
+ ] })
903
+ ] });
904
+ }
905
+ function Dr({
906
+ run: n,
907
+ saveSelection: a,
908
+ restoreSelection: c
909
+ }) {
910
+ const { t: s } = Q(), [l, h] = M("#1f2a5c"), f = (p) => {
911
+ h(p), c(), n("module.inline.format", {
912
+ tag: "span",
913
+ style: { color: p },
914
+ type: "toggle"
915
+ });
916
+ }, i = () => {
917
+ c(), n("module.inline.remove", { style: "color" });
918
+ };
919
+ return /* @__PURE__ */ v(P, { onOpenChange: (p) => p && a(), children: [
920
+ /* @__PURE__ */ e(P.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
921
+ q,
922
+ {
923
+ size: "sm",
924
+ intent: "ghost",
925
+ icon: /* @__PURE__ */ e(lr, {}),
926
+ "aria-label": s("editor.textColor", "Text colour"),
927
+ onMouseDown: (p) => {
928
+ p.preventDefault(), a();
929
+ }
930
+ }
931
+ ) }),
932
+ /* @__PURE__ */ v(P.Content, { side: "bottom", align: "start", children: [
933
+ /* @__PURE__ */ e(P.Heading, { children: s("editor.textColor", "Text colour") }),
934
+ /* @__PURE__ */ e("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ e(
935
+ Le,
936
+ {
937
+ variant: "inline",
938
+ size: "sm",
939
+ value: l,
940
+ onChange: f
941
+ }
942
+ ) }),
943
+ /* @__PURE__ */ e("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ e(oe, { size: "sm", intent: "secondary", onClick: i, children: s("editor.color.remove", "Remove colour") }) })
944
+ ] })
945
+ ] });
946
+ }
947
+ function jr({
948
+ run: n,
949
+ saveSelection: a,
950
+ restoreSelection: c
951
+ }) {
952
+ const { t: s } = Q(), [l, h] = M("#fff3a3"), f = (p) => {
953
+ h(p), c(), n("module.inline.format", {
954
+ tag: "span",
955
+ style: { "background-color": p },
956
+ type: "toggle"
957
+ });
958
+ }, i = () => {
959
+ c(), n("module.inline.remove", { style: "background-color" });
960
+ };
961
+ return /* @__PURE__ */ v(P, { onOpenChange: (p) => p && a(), children: [
962
+ /* @__PURE__ */ e(P.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
963
+ q,
964
+ {
965
+ size: "sm",
966
+ intent: "ghost",
967
+ icon: /* @__PURE__ */ e(Xt, {}),
968
+ "aria-label": s("editor.highlightColor", "Highlight"),
969
+ onMouseDown: (p) => {
970
+ p.preventDefault(), a();
971
+ }
972
+ }
973
+ ) }),
974
+ /* @__PURE__ */ v(P.Content, { side: "bottom", align: "start", children: [
975
+ /* @__PURE__ */ e(P.Heading, { children: s("editor.highlightColor", "Highlight") }),
976
+ /* @__PURE__ */ e("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ e(
977
+ Le,
978
+ {
979
+ variant: "inline",
980
+ size: "sm",
981
+ value: l,
982
+ onChange: f
983
+ }
984
+ ) }),
985
+ /* @__PURE__ */ e("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ e(oe, { size: "sm", intent: "secondary", onClick: i, children: s("editor.highlight.remove", "Remove highlight") }) })
986
+ ] })
987
+ ] });
988
+ }
989
+ function qr(n, a) {
990
+ const c = Array.from({ length: a }, () => "<td><br></td>").join("");
991
+ return `<table><tbody>${Array.from({ length: n }, () => `<tr>${c}</tr>`).join("")}</tbody></table>`;
992
+ }
993
+ function Pr({
994
+ run: n,
995
+ insertTable: a,
996
+ active: c
997
+ }) {
998
+ const { t: s } = Q(), [l, h] = M({ r: 0, c: 0 }), f = c.has("table");
999
+ return /* @__PURE__ */ v(P, { onOpenChange: (i) => !i && h({ r: 0, c: 0 }), children: [
1000
+ /* @__PURE__ */ e(P.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1001
+ q,
1002
+ {
1003
+ size: "sm",
1004
+ intent: "ghost",
1005
+ icon: /* @__PURE__ */ e(xr, {}),
1006
+ "aria-label": s("editor.table.insert", "Insert table"),
1007
+ onMouseDown: (i) => i.preventDefault()
1008
+ }
1009
+ ) }),
1010
+ /* @__PURE__ */ e(P.Content, { side: "bottom", align: "start", children: f ? (
1011
+ // Caret is already inside a table — offer the manage ops only, never
1012
+ // a nested-table insert (mirrors Redactor's native dropdown, which
1013
+ // disables "insert table" while the caret is in a table).
1014
+ /* @__PURE__ */ e("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: Ye.map((i) => /* @__PURE__ */ v(
1015
+ "button",
1016
+ {
1017
+ type: "button",
1018
+ onClick: () => n(i.command),
1019
+ className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] ds:text-start ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)] ds:hover:bg-[var(--muted)]",
1020
+ children: [
1021
+ /* @__PURE__ */ e(
1022
+ "span",
1023
+ {
1024
+ "aria-hidden": "true",
1025
+ className: "ds:inline-flex ds:size-4 ds:shrink-0 ds:items-center ds:justify-center ds:text-[color:var(--muted-foreground)]",
1026
+ children: i.icon
1027
+ }
1028
+ ),
1029
+ s(i.label[0], i.label[1])
1030
+ ]
1031
+ },
1032
+ i.id
1033
+ )) })
1034
+ ) : /* @__PURE__ */ v(Ie, { children: [
1035
+ /* @__PURE__ */ e(P.Heading, { children: s("editor.table.insert", "Insert table") }),
1036
+ /* @__PURE__ */ e(
1037
+ "div",
1038
+ {
1039
+ role: "group",
1040
+ "aria-label": s("editor.table.sizePicker", "Table size"),
1041
+ className: "ds:mt-[var(--spacing-sm)] ds:grid ds:w-fit ds:grid-cols-6 ds:gap-[var(--spacing-2xs)]",
1042
+ onMouseLeave: () => h({ r: 0, c: 0 }),
1043
+ children: Array.from({ length: xe * xe }, (i, p) => {
1044
+ const y = Math.floor(p / xe) + 1, T = p % xe + 1, I = y <= l.r && T <= l.c;
1045
+ return /* @__PURE__ */ e(
1046
+ "button",
1047
+ {
1048
+ type: "button",
1049
+ "aria-label": s("editor.table.sizeCell", "{{r}}×{{c}}", {
1050
+ r: y,
1051
+ c: T
1052
+ }),
1053
+ onMouseEnter: () => h({ r: y, c: T }),
1054
+ onClick: () => a(qr(y, T)),
1055
+ className: `ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ${I ? "ds:bg-[var(--primary)]" : "ds:bg-[var(--muted)]"}`
1056
+ },
1057
+ p
1058
+ );
1059
+ })
1060
+ }
1061
+ ),
1062
+ /* @__PURE__ */ e("p", { className: "ds:mt-[var(--spacing-xs)] ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: l.r > 0 ? s("editor.table.sizeCell", "{{r}}×{{c}}", {
1063
+ r: l.r,
1064
+ c: l.c
1065
+ }) : s("editor.table.sizeHint", "Pick a size") })
1066
+ ] }) })
1067
+ ] });
1068
+ }
1069
+ const Br = Object.fromEntries(Ye.map((n) => [n.id, n])), Fr = [
1070
+ "ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1071
+ "ds:[inset-block-start:var(--rte-tt-top)] ds:[inset-inline-start:var(--rte-tt-start)]",
1072
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1073
+ "ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
1074
+ ].join(" "), Vr = "#fde68a";
1075
+ function Xe({
1076
+ scope: n,
1077
+ icon: a,
1078
+ label: c,
1079
+ onOpenChange: s,
1080
+ saveTableCell: l,
1081
+ applyTableBackground: h
1082
+ }) {
1083
+ const { t: f } = Q(), [i, p] = M(Vr);
1084
+ return /* @__PURE__ */ v(
1085
+ P,
1086
+ {
1087
+ onOpenChange: (y) => {
1088
+ s(y), y && l();
1089
+ },
1090
+ children: [
1091
+ /* @__PURE__ */ e(P.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1092
+ q,
1093
+ {
1094
+ size: "sm",
1095
+ intent: "ghost",
1096
+ icon: a,
1097
+ tooltip: c,
1098
+ onMouseDown: (y) => y.preventDefault()
1099
+ }
1100
+ ) }),
1101
+ /* @__PURE__ */ v(P.Content, { side: "bottom", align: "center", children: [
1102
+ /* @__PURE__ */ e(
1103
+ Le,
1104
+ {
1105
+ variant: "inline",
1106
+ size: "sm",
1107
+ value: i,
1108
+ onChange: (y) => {
1109
+ p(y), h(n, y);
1110
+ }
1111
+ }
1112
+ ),
1113
+ /* @__PURE__ */ e(
1114
+ oe,
1115
+ {
1116
+ size: "sm",
1117
+ intent: "ghost",
1118
+ className: "ds:mt-[var(--spacing-xs)] ds:w-full",
1119
+ onClick: () => h(n, null),
1120
+ children: f("editor.table.clearColor", "Clear colour")
1121
+ }
1122
+ )
1123
+ ] })
1124
+ ]
1125
+ }
1126
+ );
1127
+ }
1128
+ function Gr({
1129
+ active: n,
1130
+ run: a,
1131
+ areaRef: c,
1132
+ getActiveTableEl: s,
1133
+ enableColor: l = !1,
1134
+ saveTableCell: h,
1135
+ applyTableBackground: f
1136
+ }) {
1137
+ const { t: i } = Q(), p = n.has("table"), [y, T] = M(null), I = D(0), [A, k] = M(!1), $ = z((m) => {
1138
+ I.current = Math.max(
1139
+ 0,
1140
+ I.current + (m ? 1 : -1)
1141
+ ), k(I.current > 0);
1142
+ }, []);
1143
+ if (ee(() => {
1144
+ if (A) return;
1145
+ if (!p || typeof window > "u") {
1146
+ T(null);
1147
+ return;
1148
+ }
1149
+ const m = () => {
1150
+ const E = c.current, J = s();
1151
+ if (!E || !J) {
1152
+ T(null);
1153
+ return;
1154
+ }
1155
+ const C = E.getBoundingClientRect(), L = J.getBoundingClientRect(), Y = getComputedStyle(E).direction === "rtl", G = Math.max(0, L.top - C.top - 44), x = Y ? C.right - L.right + L.width / 2 : L.left - C.left + L.width / 2;
1156
+ T({ top: G, start: Math.max(0, x), rtl: Y });
1157
+ };
1158
+ m();
1159
+ const b = new ResizeObserver(m), H = c.current, R = s();
1160
+ return H && b.observe(H), R && b.observe(R), window.addEventListener("scroll", m, !0), window.addEventListener("resize", m), () => {
1161
+ b.disconnect(), window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", m);
1162
+ };
1163
+ }, [p, A, c, s]), !p && !A || !y) return null;
1164
+ const u = [
1165
+ ["rowAbove", "rowBelow"],
1166
+ ["colLeft", "colRight"],
1167
+ ["addHead"],
1168
+ ...l ? ["colour"] : [],
1169
+ ["deleteRow", "deleteColumn"],
1170
+ ["deleteTable"]
1171
+ ];
1172
+ return (
1173
+ // Tooltips disambiguate the icon-only ops on hover (and provide each
1174
+ // button's accessible name via IconButton's `tooltip` prop). Radix Tooltip
1175
+ // needs a provider ancestor, so scope one to the bar.
1176
+ /* @__PURE__ */ e(Tt, { children: /* @__PURE__ */ e(
1177
+ "div",
1178
+ {
1179
+ role: "group",
1180
+ "aria-label": i("editor.table.toolbar", "Table tools"),
1181
+ className: `${Fr} ${y.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
1182
+ style: {
1183
+ "--rte-tt-top": `${y.top}px`,
1184
+ "--rte-tt-start": `${y.start}px`
1185
+ },
1186
+ children: u.map((m, b) => /* @__PURE__ */ v(ft, { children: [
1187
+ b > 0 ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: Ze }) : null,
1188
+ m === "colour" ? /* @__PURE__ */ v(Ie, { children: [
1189
+ /* @__PURE__ */ e(
1190
+ Xe,
1191
+ {
1192
+ scope: "cell",
1193
+ icon: /* @__PURE__ */ e(or, {}),
1194
+ label: i("editor.table.cellColor", "Cell colour"),
1195
+ onOpenChange: $,
1196
+ saveTableCell: h,
1197
+ applyTableBackground: f
1198
+ }
1199
+ ),
1200
+ /* @__PURE__ */ e(
1201
+ Xe,
1202
+ {
1203
+ scope: "row",
1204
+ icon: /* @__PURE__ */ e(ir, {}),
1205
+ label: i("editor.table.rowColor", "Row colour"),
1206
+ onOpenChange: $,
1207
+ saveTableCell: h,
1208
+ applyTableBackground: f
1209
+ }
1210
+ )
1211
+ ] }) : m.map((H) => {
1212
+ const R = Br[H];
1213
+ return /* @__PURE__ */ e(
1214
+ q,
1215
+ {
1216
+ size: "sm",
1217
+ intent: "ghost",
1218
+ icon: R.icon,
1219
+ tooltip: i(R.label[0], R.label[1]),
1220
+ onMouseDown: (E) => E.preventDefault(),
1221
+ onClick: () => a(R.command)
1222
+ },
1223
+ H
1224
+ );
1225
+ })
1226
+ ] }, m === "colour" ? "colour" : m[0]))
1227
+ }
1228
+ ) })
1229
+ );
1230
+ }
1231
+ function Wr({
1232
+ run: n,
1233
+ active: a,
1234
+ preset: c,
1235
+ insertHtml: s,
1236
+ insertTable: l,
1237
+ saveSelection: h,
1238
+ restoreSelection: f,
1239
+ getSelectedText: i,
1240
+ uploadImage: p,
1241
+ enableColor: y = !1,
1242
+ enableImage: T = !1,
1243
+ enableTable: I = !1,
1244
+ showExtensions: A = !1
1245
+ }) {
1246
+ const { t: k } = Q(), $ = (C) => C.preventDefault(), u = (C) => Hr[c].includes(C), m = (C) => {
1247
+ if (!u(C)) return null;
1248
+ const L = Er[C];
1249
+ return /* @__PURE__ */ e(
1250
+ q,
1251
+ {
1252
+ size: "sm",
1253
+ intent: "ghost",
1254
+ icon: L.icon,
1255
+ "aria-label": k(L.label[0], L.label[1]),
1256
+ "aria-pressed": L.toggle ? a.has(L.toggle) : void 0,
1257
+ onMouseDown: $,
1258
+ onClick: () => n(...L.command)
1259
+ },
1260
+ L.id
1261
+ );
1262
+ }, b = () => /* @__PURE__ */ e("span", { "aria-hidden": "true", className: Ze }), H = u("format"), R = u("bold") || u("italic") || u("underline") || u("strike") || y, E = u("ul") || u("ol"), J = u("link") || T || I;
1263
+ return /* @__PURE__ */ v(
1264
+ "div",
1265
+ {
1266
+ role: "group",
1267
+ "aria-label": k("editor.toolbarLabel"),
1268
+ className: Ir(),
1269
+ "data-component": "editor-toolbar",
1270
+ children: [
1271
+ H ? /* @__PURE__ */ e($r, { run: n, active: a, onTriggerDown: $ }) : null,
1272
+ H && R ? /* @__PURE__ */ e(b, {}) : null,
1273
+ m("bold"),
1274
+ m("italic"),
1275
+ m("underline"),
1276
+ m("strike"),
1277
+ y ? /* @__PURE__ */ e(
1278
+ Dr,
1279
+ {
1280
+ run: n,
1281
+ saveSelection: h,
1282
+ restoreSelection: f
1283
+ }
1284
+ ) : null,
1285
+ y ? /* @__PURE__ */ e(
1286
+ jr,
1287
+ {
1288
+ run: n,
1289
+ saveSelection: h,
1290
+ restoreSelection: f
1291
+ }
1292
+ ) : null,
1293
+ (H || R) && E ? /* @__PURE__ */ e(b, {}) : null,
1294
+ m("ul"),
1295
+ m("ol"),
1296
+ (H || R || E) && J ? /* @__PURE__ */ e(b, {}) : null,
1297
+ u("link") ? /* @__PURE__ */ e(
1298
+ Lr,
1299
+ {
1300
+ insertHtml: s,
1301
+ saveSelection: h,
1302
+ restoreSelection: f,
1303
+ getSelectedText: i
1304
+ }
1305
+ ) : null,
1306
+ T ? /* @__PURE__ */ e(
1307
+ Or,
1308
+ {
1309
+ insertHtml: s,
1310
+ saveSelection: h,
1311
+ restoreSelection: f,
1312
+ uploadImage: p
1313
+ }
1314
+ ) : null,
1315
+ I ? /* @__PURE__ */ e(Pr, { run: n, insertTable: l, active: a }) : null,
1316
+ A && (H || R || E || J) ? /* @__PURE__ */ e(b, {}) : null,
1317
+ A ? /* @__PURE__ */ e(
1318
+ q,
1319
+ {
1320
+ size: "sm",
1321
+ intent: "ghost",
1322
+ icon: /* @__PURE__ */ e(Tr, {}),
1323
+ "aria-label": k("editor.extensions", "Editor extensions"),
1324
+ disabled: !0,
1325
+ onMouseDown: $
1326
+ }
1327
+ ) : null
1328
+ ]
1329
+ }
1330
+ );
1331
+ }
1332
+ function ne(n) {
1333
+ return vt(n, "rich-text");
1334
+ }
1335
+ function Se(n = "") {
1336
+ const a = String(n).trim();
1337
+ if (a === "" || a === "<p><br></p>" || a === "<p>&nbsp;</p>")
1338
+ return "";
1339
+ const c = a.replace(/<br\s*\/?>/gi, "").replace(/&nbsp;/gi, "").replace(/<[^>]+>/g, "").trim();
1340
+ return c === "" && /<img\b[^>]*>/i.test(a) ? a : c === "" ? "" : a;
1341
+ }
1342
+ function Ur(n) {
1343
+ return n.replace(
1344
+ /<img(?![^>]*\sloading=)([^>]*)>/gi,
1345
+ '<img loading="lazy"$1>'
1346
+ );
1347
+ }
1348
+ function Xr(n) {
1349
+ if (!n || typeof n != "object") return;
1350
+ const a = n, c = (s) => {
1351
+ if (s && typeof s == "object" && "url" in s) {
1352
+ const l = s.url;
1353
+ return typeof l == "string" ? l : void 0;
1354
+ }
1355
+ };
1356
+ return typeof a.url == "string" ? a.url : c(a.file) ?? c(a.data) ?? Object.values(a).map(c).find(Boolean);
1357
+ }
1358
+ function Qr(n) {
1359
+ if (n) return n;
1360
+ if (typeof window > "u") return null;
1361
+ const a = window;
1362
+ return a.$R ?? a.Redactor ?? null;
1363
+ }
1364
+ const Yr = {
1365
+ bold: ["module.inline.format", { tag: "b" }],
1366
+ italic: ["module.inline.format", { tag: "i" }],
1367
+ strikethrough: ["module.inline.format", { tag: "del" }],
1368
+ bulletedList: ["module.list.toggle", "ul"],
1369
+ numberedList: ["module.list.toggle", "ol"],
1370
+ heading: ["module.block.format", { tag: "h2" }],
1371
+ quote: ["module.block.format", { tag: "blockquote" }],
1372
+ paragraph: ["module.block.format", { tag: "p" }]
1373
+ }, Zr = {
1374
+ zh: "zh_cn",
1375
+ pt: "pt_br"
1376
+ };
1377
+ function Jr(n) {
1378
+ const a = n.split("-")[0];
1379
+ return Zr[a] ?? a ?? "en";
1380
+ }
1381
+ const Kr = $e(
1382
+ "redactor-theme-alfadocs ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"
1383
+ ), en = $e(
1384
+ [
1385
+ "ds:block ds:[inline-size:100%]",
1386
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1387
+ "ds:bg-[var(--background)] ds:text-[var(--foreground)]",
1388
+ "ds:shadow-[var(--shadow-md)]",
1389
+ "ds:font-[family-name:var(--font-sans)] ds:text-[length:var(--font-size-base)]",
1390
+ "ds:p-[var(--spacing-md)] ds:[min-block-size:var(--rich-text-editor-min-block-size)]",
1391
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1392
+ "ds:focus-visible:outline-solid",
1393
+ "ds:focus-visible:outline-[var(--ring)]",
1394
+ "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1395
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
1396
+ ].join(" ")
1397
+ ), Je = [
1398
+ "ds:inline-flex ds:items-center ds:justify-center",
1399
+ "ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]",
1400
+ "ds:text-[color:var(--primary-foreground)]",
1401
+ "ds:transition-colors",
1402
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1403
+ "ds:focus-visible:outline-solid",
1404
+ "ds:focus-visible:outline-[var(--primary-foreground)]",
1405
+ "ds:focus-visible:[outline-offset:calc(var(--focus-ring-width)*-1)]"
1406
+ ].join(" "), Qe = `${Je} ds:hover:bg-[color-mix(in_srgb,var(--primary-foreground)_15%,transparent)]`, tn = `${Je} ds:bg-[var(--destructive)] ds:hover:bg-[color-mix(in_srgb,var(--destructive)_88%,var(--primary-foreground))]`, rn = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", nn = gt(
1407
+ ({
1408
+ id: n,
1409
+ defaultValue: a,
1410
+ value: c,
1411
+ onChange: s,
1412
+ toolbar: l = "standard",
1413
+ placeholder: h,
1414
+ readOnly: f = !1,
1415
+ ariaLabel: i,
1416
+ minHeight: p,
1417
+ showExtensions: y,
1418
+ className: T,
1419
+ redactor: I,
1420
+ options: A,
1421
+ plugins: k,
1422
+ lang: $,
1423
+ imageUploadUrl: u,
1424
+ onKeyDown: m,
1425
+ onRequestAiDraft: b,
1426
+ aiDraftFormat: H = "html",
1427
+ aiPrivacyNotice: R,
1428
+ onDictate: E
1429
+ }, J) => {
1430
+ const { t: C, i18n: L } = Q(), Y = ie(), G = Ge(
1431
+ () => `rte-${Y.replace(/[^a-zA-Z0-9-_]/g, "")}`,
1432
+ [Y]
1433
+ ), x = `#${G}`, B = D(null), F = D(null), se = D(!1), he = D(f), W = D(null), fe = D(null), [N, O] = M(!1), [te, V] = M(!1), [Oe, Ke] = M(
1434
+ () => /* @__PURE__ */ new Set()
1435
+ ), le = D(null), U = D(s), ge = D(m);
1436
+ ee(() => {
1437
+ U.current = s, ge.current = m;
1438
+ }, [s, m]);
1439
+ const et = D(
1440
+ (() => {
1441
+ const t = c ?? a ?? "";
1442
+ return t ? ne(t) : "";
1443
+ })()
1444
+ ), de = z(() => {
1445
+ var r;
1446
+ const t = F.current;
1447
+ if (t)
1448
+ try {
1449
+ const o = t(x, "source.getCode");
1450
+ if (typeof o == "string") return o;
1451
+ } catch {
1452
+ }
1453
+ return ((r = B.current) == null ? void 0 : r.value) ?? "";
1454
+ }, [x]), K = z(
1455
+ (t, ...r) => {
1456
+ const o = F.current;
1457
+ if (!o) return !1;
1458
+ const d = he.current;
1459
+ if (d)
1460
+ try {
1461
+ o(x, "disableReadOnly");
1462
+ } catch {
1463
+ }
1464
+ try {
1465
+ return o(x, t, ...r), !0;
1466
+ } catch {
1467
+ return !1;
1468
+ } finally {
1469
+ if (d)
1470
+ try {
1471
+ o(x, "enableReadOnly");
1472
+ } catch {
1473
+ }
1474
+ }
1475
+ },
1476
+ [x]
1477
+ ), ae = z(
1478
+ (t, r) => {
1479
+ var ue;
1480
+ const o = (r == null ? void 0 : r.asHtml) ?? !0, d = o ? ne(t) : t;
1481
+ if (K(o ? "insertion.insertHtml" : "insertion.insertText", d)) return;
1482
+ const w = B.current;
1483
+ if (!w) return;
1484
+ const _ = w.selectionStart ?? w.value.length, X = w.selectionEnd ?? w.value.length;
1485
+ w.value = w.value.slice(0, _) + d + w.value.slice(X);
1486
+ const we = _ + d.length;
1487
+ try {
1488
+ w.setSelectionRange(we, we);
1489
+ } catch {
1490
+ }
1491
+ (ue = U.current) == null || ue.call(U, { html: ne(w.value), markdown: "" });
1492
+ },
1493
+ [K]
1494
+ ), ze = D(null), re = z(() => {
1495
+ var d;
1496
+ const t = (d = W.current) == null ? void 0 : d.querySelector(".redactor-in"), r = typeof window < "u" ? window.getSelection() : null, o = /* @__PURE__ */ new Set();
1497
+ if (t && r && r.anchorNode && t.contains(r.anchorNode) && typeof document.queryCommandState == "function") {
1498
+ r.rangeCount > 0 && (ze.current = r.getRangeAt(0).cloneRange());
1499
+ try {
1500
+ 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");
1501
+ const g = String(
1502
+ document.queryCommandValue("formatBlock") || ""
1503
+ ).toLowerCase();
1504
+ /^h[1-6]$/.test(g) ? (o.add("heading"), o.add(g)) : g === "blockquote" ? o.add("quote") : o.add("paragraph");
1505
+ const w = r.anchorNode.nodeType === Node.TEXT_NODE ? r.anchorNode.parentElement : r.anchorNode;
1506
+ w && t.contains(w) && w.closest("table") && o.add("table");
1507
+ } catch {
1508
+ }
1509
+ }
1510
+ Ke(
1511
+ (g) => g.size === o.size && [...o].every((w) => g.has(w)) ? g : o
1512
+ );
1513
+ }, []), pe = z(
1514
+ (t, ...r) => {
1515
+ K(t, ...r), typeof window < "u" ? window.requestAnimationFrame(() => re()) : re();
1516
+ },
1517
+ [K, re]
1518
+ ), Te = z(
1519
+ (t) => {
1520
+ ae(t, { asHtml: !0 }), typeof window < "u" && window.requestAnimationFrame(() => re());
1521
+ },
1522
+ [ae, re]
1523
+ ), tt = z(() => {
1524
+ var r;
1525
+ if (typeof window < "u") {
1526
+ const o = (r = W.current) == null ? void 0 : r.querySelector(".redactor-in"), d = window.getSelection();
1527
+ o && d && d.rangeCount > 0 && d.anchorNode && o.contains(d.anchorNode) && (ze.current = d.getRangeAt(0).cloneRange());
1528
+ }
1529
+ const t = F.current;
1530
+ if (t)
1531
+ try {
1532
+ t(x, "selection.save");
1533
+ } catch {
1534
+ }
1535
+ }, [x]), rt = z(() => {
1536
+ const t = F.current;
1537
+ if (!t) return;
1538
+ const r = ze.current;
1539
+ try {
1540
+ t(x, "editor.focus");
1541
+ } catch {
1542
+ }
1543
+ if (r && typeof window < "u") {
1544
+ const o = window.getSelection();
1545
+ if (o)
1546
+ try {
1547
+ o.removeAllRanges(), o.addRange(r);
1548
+ return;
1549
+ } catch {
1550
+ }
1551
+ }
1552
+ try {
1553
+ t(x, "selection.restore");
1554
+ } catch {
1555
+ }
1556
+ }, [x]), nt = z(() => {
1557
+ var o;
1558
+ if (typeof window > "u") return "";
1559
+ const t = (o = W.current) == null ? void 0 : o.querySelector(".redactor-in"), r = window.getSelection();
1560
+ return !t || !r || !r.anchorNode || !t.contains(r.anchorNode) ? "" : r.toString();
1561
+ }, []), ot = z(() => {
1562
+ var g;
1563
+ if (typeof window > "u") return null;
1564
+ const t = (g = W.current) == null ? void 0 : g.querySelector(".redactor-in"), r = window.getSelection();
1565
+ if (!t || !r || r.rangeCount === 0) return null;
1566
+ const o = r.anchorNode, d = o && o.nodeType === Node.TEXT_NODE ? o.parentElement : o;
1567
+ return !d || !t.contains(d) ? null : d.closest("table");
1568
+ }, []), De = D(null), be = z(() => {
1569
+ var g;
1570
+ if (typeof window > "u") return null;
1571
+ const t = (g = W.current) == null ? void 0 : g.querySelector(".redactor-in"), r = window.getSelection();
1572
+ if (!t || !r || r.rangeCount === 0) return null;
1573
+ const o = r.anchorNode, d = o && o.nodeType === Node.TEXT_NODE ? o.parentElement : o;
1574
+ return !d || !t.contains(d) ? null : d.closest("td,th");
1575
+ }, []), at = z(() => {
1576
+ De.current = be();
1577
+ }, [be]), it = z(
1578
+ (t, r) => {
1579
+ var w;
1580
+ const o = De.current ?? be();
1581
+ if (!o) return;
1582
+ const d = t === "row" ? Array.from(((w = o.closest("tr")) == null ? void 0 : w.children) ?? [o]).filter(
1583
+ (_) => _ instanceof HTMLElement && (_.tagName === "TD" || _.tagName === "TH")
1584
+ ) : [o], g = F.current;
1585
+ if (g)
1586
+ try {
1587
+ g(x, "module.buffer.trigger");
1588
+ } catch {
1589
+ }
1590
+ for (const _ of d)
1591
+ r ? _.style.setProperty("background-color", r) : _.style.removeProperty("background-color");
1592
+ if (g)
1593
+ try {
1594
+ g(x, "broadcast", "hardsync");
1595
+ } catch {
1596
+ }
1597
+ typeof window < "u" && window.requestAnimationFrame(() => re());
1598
+ },
1599
+ [be, x, re]
1600
+ ), st = z(
1601
+ (t) => {
1602
+ var o;
1603
+ const r = F.current;
1604
+ if (r && typeof window < "u") {
1605
+ const d = (o = W.current) == null ? void 0 : o.querySelector(".redactor-in"), g = window.getSelection(), w = g == null ? void 0 : g.anchorNode, _ = w && w.nodeType === Node.TEXT_NODE ? w.parentElement : w, X = _ && (d != null && d.contains(_)) ? _.closest("ul,ol") : null;
1606
+ if (X)
1607
+ try {
1608
+ r(x, "caret.setAfter", X);
1609
+ } catch {
1610
+ }
1611
+ }
1612
+ Te(t), typeof window < "u" && window.requestAnimationFrame(() => {
1613
+ var g;
1614
+ const d = (g = W.current) == null ? void 0 : g.querySelector(".redactor-in");
1615
+ d == null || d.querySelectorAll("table td, table th").forEach((w) => {
1616
+ let _ = w.lastChild;
1617
+ for (; _ && _.nodeType === Node.TEXT_NODE && !(_.textContent ?? "").trim(); ) {
1618
+ const X = _.previousSibling;
1619
+ w.removeChild(_), _ = X;
1620
+ }
1621
+ });
1622
+ });
1623
+ },
1624
+ [Te, x]
1625
+ ), lt = z(
1626
+ async (t, r) => {
1627
+ if (!u) throw new Error("No image upload URL configured.");
1628
+ const o = new FormData();
1629
+ o.append("file", t);
1630
+ const d = await fetch(u, {
1631
+ method: "POST",
1632
+ body: o,
1633
+ credentials: "same-origin",
1634
+ signal: r
1635
+ });
1636
+ if (!d.ok) throw new Error(`Image upload failed (${d.status}).`);
1637
+ const g = Xr(await d.json());
1638
+ if (!g) throw new Error("Image upload response contained no URL.");
1639
+ return g;
1640
+ },
1641
+ [u]
1642
+ ), ce = D(null), ve = D(null), [Z, je] = M(!1), [dt, qe] = M(!1), [ct, Me] = M(""), ye = z(() => {
1643
+ const t = ve.current;
1644
+ t != null && t.parentNode && t.parentNode.removeChild(t), ve.current = null;
1645
+ }, []), Pe = z((t) => {
1646
+ var d;
1647
+ const r = (d = W.current) == null ? void 0 : d.querySelector(
1648
+ ".redactor-in"
1649
+ );
1650
+ if (!r) return;
1651
+ let o = ve.current;
1652
+ if (!o || !r.contains(o)) {
1653
+ o = document.createElement("span"), o.setAttribute("data-rte-interim", ""), o.setAttribute("contenteditable", "false");
1654
+ const g = window.getSelection();
1655
+ if (g && g.rangeCount > 0 && r.contains(g.anchorNode)) {
1656
+ const w = g.getRangeAt(0);
1657
+ w.collapse(!1), w.insertNode(o);
1658
+ } else
1659
+ r.appendChild(o);
1660
+ ve.current = o;
1661
+ }
1662
+ o.textContent = t;
1663
+ }, []), Be = z(() => {
1664
+ var t;
1665
+ (t = ce.current) == null || t.abort();
1666
+ }, []), Fe = z(() => {
1667
+ if (!E) return;
1668
+ const t = new AbortController();
1669
+ ce.current = t, qe(!1), je(!0), Me(C("editor.ai.listening")), ye(), E({
1670
+ signal: t.signal,
1671
+ // Interim text shows live in the editor (grey + caret); each final
1672
+ // replaces it with committed text at the caret.
1673
+ onPartialTranscript: (r) => {
1674
+ t.signal.aborted || Pe(r);
1675
+ },
1676
+ onFinalTranscript: (r) => {
1677
+ if (t.signal.aborted) return;
1678
+ ye();
1679
+ const o = r.trim();
1680
+ o && (ae(`${o} `, { asHtml: !1 }), Me(o));
1681
+ }
1682
+ }).catch((r) => {
1683
+ t.signal.aborted || r && typeof r == "object" && "name" in r && r.name === "AbortError" || qe(!0);
1684
+ }).finally(() => {
1685
+ ye(), ce.current === t && (ce.current = null, je(!1), Me(""));
1686
+ });
1687
+ }, [E, ae, ye, Pe, C]), Ve = z(() => {
1688
+ Z ? Be() : Fe();
1689
+ }, [Z, Fe, Be]);
1690
+ ee(() => () => {
1691
+ var t;
1692
+ return (t = ce.current) == null ? void 0 : t.abort();
1693
+ }, []), ee(() => {
1694
+ const t = B.current;
1695
+ if (!t) return;
1696
+ t.value = et.current;
1697
+ const r = Qr(I);
1698
+ if (!r) {
1699
+ O(!0);
1700
+ return;
1701
+ }
1702
+ F.current = r;
1703
+ const o = {
1704
+ lang: $ ?? Jr(L.language || "en"),
1705
+ // The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
1706
+ // via the command API, so Redactor's native toolbar is suppressed.
1707
+ toolbar: !1,
1708
+ plugins: k ?? [],
1709
+ placeholder: h ?? C("editor.placeholder"),
1710
+ toolbarFixed: !1,
1711
+ // Platform parity (RedactorWysiwyg.js:84): no inline shortcode expansion.
1712
+ shortcodes: !1,
1713
+ imageEditable: !1,
1714
+ imageResizable: !0
1715
+ }, d = u ? { imageUpload: u } : {}, g = (A == null ? void 0 : A.callbacks) ?? {}, w = {
1716
+ ...o,
1717
+ ...d,
1718
+ ...A ?? {},
1719
+ // Re-pin safety-critical keys LAST so consumer `options` can't override
1720
+ // the sanitising change handler, re-enable image editing, or turn off
1721
+ // drag-resize (platform re-pins both image flags — RedactorWysiwyg.js:115-116).
1722
+ imageEditable: !1,
1723
+ imageResizable: !0,
1724
+ callbacks: {
1725
+ ...g,
1726
+ changed(_) {
1727
+ const X = Se(Ur(_)), we = ne(X);
1728
+ se.current = !0, U.current && (le.current && clearTimeout(le.current), le.current = setTimeout(() => {
1729
+ var ue;
1730
+ (ue = U.current) == null || ue.call(U, { html: we, markdown: "" });
1731
+ }, 100));
1732
+ },
1733
+ keydown(_) {
1734
+ var X;
1735
+ (X = ge.current) == null || X.call(ge, _);
1736
+ },
1737
+ observe() {
1738
+ re();
1739
+ }
1740
+ }
1741
+ };
1742
+ try {
1743
+ if (r(x, w), f)
1744
+ try {
1745
+ r(x, "enableReadOnly");
1746
+ } catch {
1747
+ }
1748
+ } catch {
1749
+ O(!0);
1750
+ }
1751
+ return () => {
1752
+ le.current && clearTimeout(le.current);
1753
+ try {
1754
+ r(x, "destroy");
1755
+ } catch {
1756
+ }
1757
+ F.current = null;
1758
+ };
1759
+ }, []), ee(() => {
1760
+ if (!F.current || c === void 0) return;
1761
+ if (se.current) {
1762
+ se.current = !1;
1763
+ return;
1764
+ }
1765
+ const t = ne(Se(c));
1766
+ Se(de()) !== t && K("source.setCode", t);
1767
+ }, [c, de, K]), ee(() => {
1768
+ he.current = f;
1769
+ const t = F.current;
1770
+ if (t)
1771
+ try {
1772
+ t(x, f ? "enableReadOnly" : "disableReadOnly");
1773
+ } catch {
1774
+ }
1775
+ }, [f, x]), ee(() => {
1776
+ if (!N || c === void 0) return;
1777
+ const t = B.current;
1778
+ if (!t) return;
1779
+ const r = ne(c);
1780
+ t.value !== r && document.activeElement !== t && (t.value = r);
1781
+ }, [N, c]);
1782
+ const Re = Ge(
1783
+ () => ({
1784
+ getHTML() {
1785
+ return de();
1786
+ },
1787
+ getText() {
1788
+ return de().replace(/<[^>]*>/g, " ").replace(/&nbsp;/gi, " ").replace(/\s+/g, " ").trim();
1789
+ },
1790
+ getMarkdown() {
1791
+ return "";
1792
+ },
1793
+ setContent(t) {
1794
+ const r = ne(t);
1795
+ K("source.setCode", r) || B.current && (B.current.value = r);
1796
+ },
1797
+ insertAtCursor: ae,
1798
+ applyFormat(t) {
1799
+ const r = Yr[t];
1800
+ r && pe(...r);
1801
+ },
1802
+ focus() {
1803
+ var r;
1804
+ const t = F.current;
1805
+ if (t)
1806
+ try {
1807
+ t(x, "editor.focus");
1808
+ return;
1809
+ } catch {
1810
+ }
1811
+ (r = B.current) == null || r.focus();
1812
+ },
1813
+ clear() {
1814
+ K("source.setCode", "") || B.current && (B.current.value = "");
1815
+ }
1816
+ }),
1817
+ [x, de, K, ae, pe]
1818
+ );
1819
+ pt(J, () => Re, [Re]), yt(Mr, Re, n);
1820
+ const ut = z(
1821
+ (t) => {
1822
+ var r;
1823
+ (r = U.current) == null || r.call(U, {
1824
+ html: ne(t.target.value),
1825
+ markdown: ""
1826
+ });
1827
+ },
1828
+ []
1829
+ ), mt = i ?? C("editor.regionLabel"), ht = h ?? C("editor.placeholder");
1830
+ return /* @__PURE__ */ v(
1831
+ "div",
1832
+ {
1833
+ ref: W,
1834
+ className: [Kr(), T].filter(Boolean).join(" "),
1835
+ "data-component": "rich-text-editor",
1836
+ "data-component-id": n,
1837
+ "data-min-height": p,
1838
+ children: [
1839
+ !N && !f ? /* @__PURE__ */ e(
1840
+ Wr,
1841
+ {
1842
+ run: pe,
1843
+ active: Oe,
1844
+ preset: l,
1845
+ insertHtml: Te,
1846
+ insertTable: st,
1847
+ saveSelection: tt,
1848
+ restoreSelection: rt,
1849
+ getSelectedText: nt,
1850
+ uploadImage: u ? lt : void 0,
1851
+ enableColor: (k == null ? void 0 : k.includes("fontcolor")) ?? !1,
1852
+ enableImage: !!u,
1853
+ enableTable: (k == null ? void 0 : k.includes("table")) ?? !1,
1854
+ showExtensions: y
1855
+ }
1856
+ ) : null,
1857
+ /* @__PURE__ */ v("div", { className: "ds:relative", ref: fe, children: [
1858
+ /* @__PURE__ */ e(
1859
+ "textarea",
1860
+ {
1861
+ ref: B,
1862
+ id: G,
1863
+ "aria-label": mt,
1864
+ "aria-multiline": "true",
1865
+ placeholder: ht,
1866
+ onChange: N ? ut : void 0,
1867
+ readOnly: N ? f : void 0,
1868
+ className: N ? en() : void 0
1869
+ }
1870
+ ),
1871
+ b && E ? /* @__PURE__ */ v("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10 ds:flex ds:items-center ds:overflow-hidden ds:rounded-full ds:bg-[var(--primary)] ds:shadow-[var(--shadow-lg)]", children: [
1872
+ /* @__PURE__ */ e(
1873
+ "button",
1874
+ {
1875
+ type: "button",
1876
+ onClick: Ve,
1877
+ "aria-pressed": Z,
1878
+ "aria-label": C(Z ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
1879
+ className: Z ? tn : Qe,
1880
+ children: Z ? /* @__PURE__ */ e(
1881
+ Ae,
1882
+ {
1883
+ "aria-hidden": "true",
1884
+ className: "ds:size-5 ds:fill-current"
1885
+ }
1886
+ ) : /* @__PURE__ */ e(Ee, { "aria-hidden": "true", className: "ds:size-5" })
1887
+ }
1888
+ ),
1889
+ /* @__PURE__ */ e(
1890
+ "span",
1891
+ {
1892
+ "aria-hidden": "true",
1893
+ className: "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[color-mix(in_srgb,var(--primary-foreground)_35%,transparent)]"
1894
+ }
1895
+ ),
1896
+ /* @__PURE__ */ e(
1897
+ "button",
1898
+ {
1899
+ type: "button",
1900
+ onClick: () => V(!0),
1901
+ "aria-label": C("editor.ai.helpMeWrite"),
1902
+ className: Qe,
1903
+ children: /* @__PURE__ */ e(He, { "aria-hidden": "true", className: "ds:size-5" })
1904
+ }
1905
+ )
1906
+ ] }) : E ? /* @__PURE__ */ e("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10", children: /* @__PURE__ */ e(
1907
+ q,
1908
+ {
1909
+ size: "lg",
1910
+ intent: "primary",
1911
+ icon: Z ? /* @__PURE__ */ e(Ae, { className: "ds:fill-current" }) : /* @__PURE__ */ e(Ee, {}),
1912
+ "aria-pressed": Z,
1913
+ "aria-label": C(Z ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
1914
+ onClick: Ve,
1915
+ className: Z ? `${rn} ds:rounded-full ds:shadow-[var(--shadow-lg)]` : "ds:rounded-full ds:shadow-[var(--shadow-lg)]"
1916
+ }
1917
+ ) }) : b ? /* @__PURE__ */ e("div", { className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10", children: /* @__PURE__ */ e(
1918
+ q,
1919
+ {
1920
+ size: "lg",
1921
+ intent: "primary",
1922
+ icon: /* @__PURE__ */ e(He, {}),
1923
+ "aria-label": C("editor.ai.helpMeWrite"),
1924
+ onClick: () => V(!0),
1925
+ className: "ds:rounded-full ds:shadow-[var(--shadow-lg)]"
1926
+ }
1927
+ ) }) : null,
1928
+ b ? /* @__PURE__ */ e(
1929
+ Ar,
1930
+ {
1931
+ open: te,
1932
+ onClose: () => V(!1),
1933
+ onRequestAiDraft: b,
1934
+ onInsert: (t) => ae(t, { asHtml: H !== "text" }),
1935
+ previewAsHtml: H !== "text",
1936
+ privacyNotice: R,
1937
+ onDictate: E
1938
+ }
1939
+ ) : null,
1940
+ !N && !f && ((k == null ? void 0 : k.includes("table")) ?? !1) ? /* @__PURE__ */ e(
1941
+ Gr,
1942
+ {
1943
+ active: Oe,
1944
+ run: pe,
1945
+ areaRef: fe,
1946
+ getActiveTableEl: ot,
1947
+ enableColor: (k == null ? void 0 : k.includes("fontcolor")) ?? !1,
1948
+ saveTableCell: at,
1949
+ applyTableBackground: it
1950
+ }
1951
+ ) : null
1952
+ ] }),
1953
+ E ? /* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: ct }) : null,
1954
+ E && dt ? /* @__PURE__ */ e(
1955
+ "p",
1956
+ {
1957
+ role: "alert",
1958
+ className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
1959
+ children: C("editor.ai.dictationError")
1960
+ }
1961
+ ) : null
1962
+ ]
1963
+ }
1964
+ );
1965
+ }
1966
+ );
1967
+ nn.displayName = "RichTextEditor";
1968
+ export {
1969
+ nn as R,
1970
+ Mr as r,
1971
+ Kr as w
1972
+ };
1973
+ //# sourceMappingURL=rich-text-editor-DAeCXiQG.js.map