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