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