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