@alfadocs/ui-kit 1.147.1 → 1.148.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/{appointment-details-panel.history-eqPMKmW0.js → appointment-details-panel.history-BxNqcA-r.js} +109 -110
- package/dist/_chunks/{appointment-timeline-D5qbZ7in.js → appointment-timeline-CuZW-CGT.js} +2 -2
- package/dist/_chunks/{bill-line-table-DnkFqMnM.js → bill-line-table-B8Cc2pTH.js} +2 -2
- package/dist/_chunks/button-group-CHQD8GJ0.js +449 -0
- package/dist/_chunks/{calendar-appointment-editor-dialog-sY-k0GGW.js → calendar-appointment-editor-dialog-Cz8F2H4M.js} +6 -6
- package/dist/_chunks/{calendar-waiting-list-panel-Bm7NAZdk.js → calendar-waiting-list-panel-C4T85b4q.js} +3 -3
- package/dist/_chunks/{calendar.sheets-CCvdZF-R.js → calendar.sheets-DsgPdycU.js} +4 -4
- package/dist/_chunks/{data-grid-CujX-2tF.js → data-grid-CkzbCZSo.js} +486 -476
- package/dist/_chunks/{default-tabs-CqP1uWdx.js → default-tabs-C45FVzsG.js} +3 -3
- package/dist/_chunks/editable-description-BsSjLnSx.js +193 -0
- package/dist/_chunks/{editable-description.agent-Bm_LBV2j.js → editable-description.agent-zyyR_hxB.js} +2 -2
- package/dist/_chunks/{face-scheme-ByYeboH9.js → face-scheme-BC2whb1S.js} +2 -2
- package/dist/_chunks/{invoice-upload-list-srvWy5_d.js → invoice-upload-list-BReimsvV.js} +3 -3
- package/dist/_chunks/{notes-panel-C9aB1Cma.js → notes-panel-BHMnLbEH.js} +2 -2
- package/dist/_chunks/prescription-history-CQuJmd4H.js +1846 -0
- package/dist/_chunks/{rich-text-editor-CJXc5GgH.js → rich-text-editor-BAcJq1PO.js} +445 -437
- package/dist/_chunks/{tasks-panel-DsjfS_k5.js → tasks-panel-DufAoAxG.js} +2 -2
- package/dist/_chunks/{toolbar-z_6tE7zG.js → toolbar-B9oh9XY9.js} +2 -2
- package/dist/_chunks/{use-appointment-details-read-Dod21IxM.js → use-appointment-details-read-kYp-gfhb.js} +417 -422
- package/dist/agent-catalog.json +2 -2
- package/dist/appointment-editor-panel/index.js +1 -1
- package/dist/browser-support.js +1 -1
- package/dist/calendar-action-buttons/index.js +1 -1
- package/dist/components/appointment-details-panel/appointment-details-panel.history.d.ts +4 -6
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/bill-line-table/index.js +1 -1
- package/dist/components/bill-table/index.js +1 -1
- package/dist/components/button-group/button-group.d.ts +2 -1
- package/dist/components/button-group/index.js +1 -1
- package/dist/components/data-grid/data-grid.variants.d.ts +7 -1
- package/dist/components/data-grid/index.js +2 -2
- package/dist/components/editable-description/editable-description.d.ts +2 -1
- package/dist/components/editable-description/index.js +2 -2
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/invoice-upload-list/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/core.css +1 -1
- package/dist/find-free-slots-panel/index.js +1 -1
- package/dist/host-compat.css +7 -1
- package/dist/i18n/locales/ar.d.ts +0 -1
- package/dist/i18n/locales/ar.js +1 -2
- package/dist/i18n/locales/de.d.ts +0 -1
- package/dist/i18n/locales/de.js +1 -2
- package/dist/i18n/locales/el.d.ts +0 -1
- package/dist/i18n/locales/el.js +1 -2
- package/dist/i18n/locales/en.d.ts +0 -1
- package/dist/i18n/locales/en.js +1 -2
- package/dist/i18n/locales/es.d.ts +0 -1
- package/dist/i18n/locales/es.js +1 -2
- package/dist/i18n/locales/fr.d.ts +0 -1
- package/dist/i18n/locales/fr.js +1 -2
- package/dist/i18n/locales/hi.d.ts +0 -1
- package/dist/i18n/locales/hi.js +1 -2
- package/dist/i18n/locales/it.d.ts +0 -1
- package/dist/i18n/locales/it.js +1 -2
- package/dist/i18n/locales/ja.d.ts +0 -1
- package/dist/i18n/locales/ja.js +1 -2
- package/dist/i18n/locales/nl.d.ts +0 -1
- package/dist/i18n/locales/nl.js +1 -2
- package/dist/i18n/locales/pl.d.ts +0 -1
- package/dist/i18n/locales/pl.js +1 -2
- package/dist/i18n/locales/pt.d.ts +0 -1
- package/dist/i18n/locales/pt.js +1 -2
- package/dist/i18n/locales/ro.d.ts +0 -1
- package/dist/i18n/locales/ro.js +1 -2
- package/dist/i18n/locales/ru.d.ts +0 -1
- package/dist/i18n/locales/ru.js +1 -2
- package/dist/i18n/locales/sq.d.ts +0 -1
- package/dist/i18n/locales/sq.js +1 -2
- package/dist/i18n/locales/sv.d.ts +0 -1
- package/dist/i18n/locales/sv.js +1 -2
- package/dist/i18n/locales/tr.d.ts +0 -1
- package/dist/i18n/locales/tr.js +1 -2
- package/dist/i18n/locales/zh.d.ts +0 -1
- package/dist/i18n/locales/zh.js +1 -2
- package/dist/index.js +17 -17
- package/dist/locales/ar.json +1 -2
- package/dist/locales/de.json +1 -2
- package/dist/locales/el.json +1 -2
- package/dist/locales/en.json +1 -2
- package/dist/locales/es.json +1 -2
- package/dist/locales/fr.json +1 -2
- package/dist/locales/hi.json +1 -2
- package/dist/locales/it.json +1 -2
- package/dist/locales/ja.json +1 -2
- package/dist/locales/nl.json +1 -2
- package/dist/locales/pl.json +1 -2
- package/dist/locales/pt.json +1 -2
- package/dist/locales/ro.json +1 -2
- package/dist/locales/ru.json +1 -2
- package/dist/locales/sq.json +1 -2
- package/dist/locales/sv.json +1 -2
- package/dist/locales/tr.json +1 -2
- package/dist/locales/zh.json +1 -2
- package/dist/online-bookings-panel/index.js +1 -1
- package/dist/patterns/calendar/index.js +2 -2
- package/dist/patterns/prescription/index.d.ts +1 -1
- package/dist/patterns/prescription/index.js +1 -1
- package/dist/patterns/prescription/prescription-history.d.ts +28 -0
- package/dist/tokens.css +1 -1
- package/dist/waiting-list-panel/index.js +2 -2
- package/package.json +1 -1
- package/dist/_chunks/button-group-N60L3HMa.js +0 -408
- package/dist/_chunks/editable-description-BQauSuCG.js +0 -142
- package/dist/_chunks/prescription-history-CFs3JMIE.js +0 -1773
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as t, jsxs as N, Fragment as
|
|
1
|
+
import { jsx as t, jsxs as N, Fragment as Be } from "react/jsx-runtime";
|
|
2
2
|
import { useId as Ge, useState as R, useRef as x, useCallback as w, useEffect as H, Fragment as yt, useLayoutEffect as si, forwardRef as li, useMemo as ht, useImperativeHandle as ci } from "react";
|
|
3
3
|
import { c as wt } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { useTranslation as
|
|
4
|
+
import { useTranslation as se } from "react-i18next";
|
|
5
5
|
import { SafeHtml as di, sanitiseHtml as ui } from "../safe-html/index.js";
|
|
6
6
|
import { a as mi, c as fi, d as gi, b as oo } from "./ai-fab-pill-BOu96kCx.js";
|
|
7
7
|
import { u as hi } from "./registry-DvAUVLHh.js";
|
|
8
8
|
import { u as pi } from "./use-ai-sparkle-Cf4yVTLB.js";
|
|
9
9
|
import { S as Zn } from "./spinner-CoflYlEx.js";
|
|
10
10
|
import { A as bi } from "./ai-sparkle-D23NT8Z_.js";
|
|
11
|
-
import { B as
|
|
11
|
+
import { B as Se } from "./button-Dp4j9ygh.js";
|
|
12
12
|
import { I as X } from "./icon-button-u9VMQn3x.js";
|
|
13
13
|
import { A as vi } from "./ai-permission-notice-C_YB3MBA.js";
|
|
14
14
|
import { T as yi } from "./text-area-COMVJ1yE.js";
|
|
@@ -26,7 +26,7 @@ import * as sn from "@radix-ui/react-popover";
|
|
|
26
26
|
import { u as Ni, f as Ti } from "./non-modal-tab-exit-DqJao_E-.js";
|
|
27
27
|
import { V as io } from "./variables-menu-C4NcClKi.js";
|
|
28
28
|
import { a as Qn } from "./tooltip-uEBdD1-5.js";
|
|
29
|
-
import { P as
|
|
29
|
+
import { P as ae } from "./popover-C9O7my6h.js";
|
|
30
30
|
import { D as de } from "./dialog-239Geb7Z.js";
|
|
31
31
|
import { C as Jn } from "./color-picker-5FKOk_z1.js";
|
|
32
32
|
import { S as mn } from "./state-backed-text-input-DVETOhSS.js";
|
|
@@ -750,7 +750,7 @@ const Ua = {
|
|
|
750
750
|
{ variants: { stacked: { true: "ds:justify-end", false: "" } } }
|
|
751
751
|
), Ya = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", es = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]";
|
|
752
752
|
function co({ id: r }) {
|
|
753
|
-
const { t: a } =
|
|
753
|
+
const { t: a } = se("ui");
|
|
754
754
|
return /* @__PURE__ */ t(
|
|
755
755
|
"p",
|
|
756
756
|
{
|
|
@@ -788,21 +788,21 @@ function ts({
|
|
|
788
788
|
privacyNotice: h,
|
|
789
789
|
onDictate: b
|
|
790
790
|
}) {
|
|
791
|
-
const { t: f } =
|
|
791
|
+
const { t: f } = se("ui"), y = Ge(), E = Ge(), [C, M] = R(""), [I, L] = R(!1), [P, g] = R(!1), [m, v] = R(null), z = x(null), [_, D] = R(!1), [K, G] = R("listening"), [B, k] = R(""), [le, F] = R(""), U = x(null), re = x(null), Y = w((W = !1) => {
|
|
792
792
|
var A;
|
|
793
|
-
|
|
793
|
+
re.current && (re.current.keepLate = W), (A = U.current) == null || A.abort();
|
|
794
794
|
}, []), ke = w(() => {
|
|
795
795
|
if (!b) return;
|
|
796
796
|
const W = new AbortController();
|
|
797
797
|
U.current = W;
|
|
798
798
|
const A = { keepLate: !1 };
|
|
799
|
-
|
|
799
|
+
re.current = A;
|
|
800
800
|
let Ee = !1;
|
|
801
801
|
const ce = () => !Ee && (!W.signal.aborted || A.keepLate);
|
|
802
|
-
D(!0), G("listening"), k(""),
|
|
802
|
+
D(!0), G("listening"), k(""), F(f("editor.ai.listening")), b({
|
|
803
803
|
signal: W.signal,
|
|
804
804
|
onStatus: (ge) => {
|
|
805
|
-
ce() && (G(ge),
|
|
805
|
+
ce() && (G(ge), F(
|
|
806
806
|
f(ge === "connecting" ? "voiceControl.status.starting" : "editor.ai.listening")
|
|
807
807
|
));
|
|
808
808
|
},
|
|
@@ -812,41 +812,41 @@ function ts({
|
|
|
812
812
|
onFinalTranscript: (ge) => {
|
|
813
813
|
if (!ce()) return;
|
|
814
814
|
const $ = ge.trim();
|
|
815
|
-
k(""), $ && (M((
|
|
815
|
+
k(""), $ && (M((te) => Xr(te, $)), F($));
|
|
816
816
|
}
|
|
817
817
|
}).catch(() => {
|
|
818
818
|
}).finally(() => {
|
|
819
|
-
Ee = !0, k(""), U.current === W && (U.current = null,
|
|
819
|
+
Ee = !0, k(""), U.current === W && (U.current = null, re.current = null, D(!1), F(""));
|
|
820
820
|
});
|
|
821
|
-
}, [b, f]),
|
|
822
|
-
|
|
823
|
-
}, [
|
|
821
|
+
}, [b, f]), ee = w(() => {
|
|
822
|
+
_ ? Y(!0) : ke();
|
|
823
|
+
}, [_, ke, Y]);
|
|
824
824
|
H(() => {
|
|
825
825
|
var W, A;
|
|
826
|
-
r ? (M(""),
|
|
826
|
+
r ? (M(""), L(!1), g(!1), v(null), k(""), F("")) : ((W = z.current) == null || W.abort(), z.current = null, (A = U.current) == null || A.abort());
|
|
827
827
|
}, [r]), H(
|
|
828
828
|
() => () => {
|
|
829
829
|
var W, A;
|
|
830
|
-
(W =
|
|
830
|
+
(W = z.current) == null || W.abort(), (A = U.current) == null || A.abort();
|
|
831
831
|
},
|
|
832
832
|
[]
|
|
833
833
|
);
|
|
834
|
-
const
|
|
834
|
+
const _e = w(() => {
|
|
835
835
|
var Ee;
|
|
836
836
|
const W = C.trim();
|
|
837
|
-
if (!W ||
|
|
838
|
-
|
|
837
|
+
if (!W || I) return;
|
|
838
|
+
Y(), (Ee = z.current) == null || Ee.abort();
|
|
839
839
|
const A = new AbortController();
|
|
840
|
-
|
|
841
|
-
A.signal.aborted || (v(ce),
|
|
840
|
+
z.current = A, g(!1), L(!0), u({ prompt: W, signal: A.signal }).then((ce) => {
|
|
841
|
+
A.signal.aborted || (v(ce), L(!1));
|
|
842
842
|
}).catch((ce) => {
|
|
843
|
-
A.signal.aborted || ce && typeof ce == "object" && "name" in ce && ce.name === "AbortError" || (g(!0),
|
|
843
|
+
A.signal.aborted || ce && typeof ce == "object" && "name" in ce && ce.name === "AbortError" || (g(!0), L(!1));
|
|
844
844
|
});
|
|
845
|
-
}, [C,
|
|
845
|
+
}, [C, I, u, Y]), V = w(() => {
|
|
846
846
|
m != null && (c(m), a());
|
|
847
|
-
}, [m, c, a]),
|
|
847
|
+
}, [m, c, a]), oe = x(null), [Z, Ne] = R(!1);
|
|
848
848
|
wi(() => {
|
|
849
|
-
const W =
|
|
849
|
+
const W = oe.current;
|
|
850
850
|
if (!r || !W) return;
|
|
851
851
|
const A = () => {
|
|
852
852
|
const ce = W.clientWidth;
|
|
@@ -856,7 +856,7 @@ function ts({
|
|
|
856
856
|
const Ee = new ResizeObserver(A);
|
|
857
857
|
return Ee.observe(W), () => Ee.disconnect();
|
|
858
858
|
}, [r]);
|
|
859
|
-
const kt = m != null, Te =
|
|
859
|
+
const kt = m != null, Te = _ && K === "connecting", xt = _ ? Xr(C, B) : C, Dt = Z ? null : /* @__PURE__ */ t(
|
|
860
860
|
X,
|
|
861
861
|
{
|
|
862
862
|
size: "md",
|
|
@@ -874,7 +874,7 @@ function ts({
|
|
|
874
874
|
onClose: a,
|
|
875
875
|
title: Z ? f("editor.ai.dialogTitle") : void 0,
|
|
876
876
|
ariaLabel: f("editor.ai.dialogTitle"),
|
|
877
|
-
children: /* @__PURE__ */ t("div", { ref:
|
|
877
|
+
children: /* @__PURE__ */ t("div", { ref: oe, className: Ja, children: kt ? /* @__PURE__ */ N("div", { className: Gr({ stacked: Z }), children: [
|
|
878
878
|
Dt,
|
|
879
879
|
/* @__PURE__ */ t("div", { className: Kr({ stacked: Z }), children: p ? /* @__PURE__ */ t(
|
|
880
880
|
di,
|
|
@@ -917,7 +917,7 @@ function ts({
|
|
|
917
917
|
}
|
|
918
918
|
)
|
|
919
919
|
] })
|
|
920
|
-
] }) : /* @__PURE__ */ N(
|
|
920
|
+
] }) : /* @__PURE__ */ N(Be, { children: [
|
|
921
921
|
/* @__PURE__ */ N("div", { className: Gr({ stacked: Z }), children: [
|
|
922
922
|
Dt,
|
|
923
923
|
/* @__PURE__ */ t("div", { className: Kr({ stacked: Z }), children: /* @__PURE__ */ t(
|
|
@@ -927,12 +927,12 @@ function ts({
|
|
|
927
927
|
size: "md",
|
|
928
928
|
value: xt,
|
|
929
929
|
onChange: (W) => M(W.target.value),
|
|
930
|
-
placeholder: f(
|
|
930
|
+
placeholder: f(_ ? Te ? "voiceControl.status.starting" : "editor.ai.listening" : "editor.ai.promptPlaceholder"),
|
|
931
931
|
"aria-label": f("editor.ai.promptLabel"),
|
|
932
932
|
autoResize: !0,
|
|
933
933
|
minRows: 1,
|
|
934
934
|
maxRows: 3,
|
|
935
|
-
readOnly:
|
|
935
|
+
readOnly: _,
|
|
936
936
|
tone: P ? "error" : "default",
|
|
937
937
|
"aria-describedby": P ? E : void 0
|
|
938
938
|
}
|
|
@@ -943,11 +943,11 @@ function ts({
|
|
|
943
943
|
{
|
|
944
944
|
size: "md",
|
|
945
945
|
intent: "outline",
|
|
946
|
-
className:
|
|
947
|
-
icon: Te ? /* @__PURE__ */ t(Fn, { className: "ds:animate-spin ds:motion-reduce:animate-none" }) :
|
|
948
|
-
"aria-pressed":
|
|
949
|
-
"aria-label": f(
|
|
950
|
-
onClick:
|
|
946
|
+
className: _ && !Te ? `${bt} ${Za}` : bt,
|
|
947
|
+
icon: Te ? /* @__PURE__ */ t(Fn, { className: "ds:animate-spin ds:motion-reduce:animate-none" }) : _ ? /* @__PURE__ */ t($t, { className: "ds:fill-current" }) : /* @__PURE__ */ t(jn, {}),
|
|
948
|
+
"aria-pressed": _,
|
|
949
|
+
"aria-label": f(_ ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
950
|
+
onClick: ee
|
|
951
951
|
}
|
|
952
952
|
) : null,
|
|
953
953
|
/* @__PURE__ */ t(
|
|
@@ -955,12 +955,12 @@ function ts({
|
|
|
955
955
|
{
|
|
956
956
|
size: "md",
|
|
957
957
|
intent: "primary",
|
|
958
|
-
icon:
|
|
958
|
+
icon: I ? /* @__PURE__ */ t(Zn, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ t(Ai, {}),
|
|
959
959
|
className: `${bt} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
|
|
960
|
-
disabled:
|
|
961
|
-
"aria-busy":
|
|
960
|
+
disabled: I || !C.trim(),
|
|
961
|
+
"aria-busy": I || void 0,
|
|
962
962
|
"aria-label": f("editor.ai.generate"),
|
|
963
|
-
onClick:
|
|
963
|
+
onClick: _e
|
|
964
964
|
}
|
|
965
965
|
)
|
|
966
966
|
] })
|
|
@@ -1194,16 +1194,16 @@ function as({
|
|
|
1194
1194
|
insertVariable: u,
|
|
1195
1195
|
saveSelection: c
|
|
1196
1196
|
}) {
|
|
1197
|
-
const { t: p } =
|
|
1197
|
+
const { t: p } = se("ui"), [h, b] = R(!1), [f, y] = R(""), E = x(null), C = x(!1), M = Ni(!0, {
|
|
1198
1198
|
getAnchor: Ti,
|
|
1199
1199
|
onReturnToTrigger: () => b(!1)
|
|
1200
|
-
}),
|
|
1200
|
+
}), I = r;
|
|
1201
1201
|
return /* @__PURE__ */ N(
|
|
1202
1202
|
sn.Root,
|
|
1203
1203
|
{
|
|
1204
1204
|
open: h,
|
|
1205
|
-
onOpenChange: (
|
|
1206
|
-
|
|
1205
|
+
onOpenChange: (L) => {
|
|
1206
|
+
L && c(), b(L), L && y("");
|
|
1207
1207
|
},
|
|
1208
1208
|
children: [
|
|
1209
1209
|
/* @__PURE__ */ t(sn.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
@@ -1223,20 +1223,20 @@ function as({
|
|
|
1223
1223
|
sideOffset: 4,
|
|
1224
1224
|
className: "ds:z-[var(--z-popover)]",
|
|
1225
1225
|
onKeyDown: M,
|
|
1226
|
-
onCloseAutoFocus: (
|
|
1227
|
-
C.current && (
|
|
1226
|
+
onCloseAutoFocus: (L) => {
|
|
1227
|
+
C.current && (L.preventDefault(), C.current = !1);
|
|
1228
1228
|
},
|
|
1229
1229
|
children: /* @__PURE__ */ t(
|
|
1230
1230
|
io,
|
|
1231
1231
|
{
|
|
1232
|
-
variables:
|
|
1232
|
+
variables: I,
|
|
1233
1233
|
recentTokens: a,
|
|
1234
1234
|
query: f,
|
|
1235
1235
|
onQueryChange: y,
|
|
1236
1236
|
searchFocusable: !0,
|
|
1237
1237
|
"aria-label": p("editor.insertVariable", "Insert variable"),
|
|
1238
|
-
onSelect: (
|
|
1239
|
-
C.current = !0, u(
|
|
1238
|
+
onSelect: (L) => {
|
|
1239
|
+
C.current = !0, u(L.token), b(!1);
|
|
1240
1240
|
},
|
|
1241
1241
|
onClose: () => b(!1)
|
|
1242
1242
|
}
|
|
@@ -1252,10 +1252,10 @@ function ss({
|
|
|
1252
1252
|
active: a,
|
|
1253
1253
|
onTriggerDown: u
|
|
1254
1254
|
}) {
|
|
1255
|
-
const { t: c } =
|
|
1255
|
+
const { t: c } = se("ui"), p = Pn.find((h) => a.has(h.id)) ?? Pn[0];
|
|
1256
1256
|
return /* @__PURE__ */ N(j.Root, { children: [
|
|
1257
1257
|
/* @__PURE__ */ t(j.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1258
|
-
|
|
1258
|
+
Se,
|
|
1259
1259
|
{
|
|
1260
1260
|
size: "sm",
|
|
1261
1261
|
intent: "ghost",
|
|
@@ -1285,7 +1285,7 @@ function ls({
|
|
|
1285
1285
|
active: a,
|
|
1286
1286
|
onTriggerDown: u
|
|
1287
1287
|
}) {
|
|
1288
|
-
const { t: c } =
|
|
1288
|
+
const { t: c } = se("ui"), p = x(null), [h, b] = R(!1);
|
|
1289
1289
|
si(() => {
|
|
1290
1290
|
const M = p.current;
|
|
1291
1291
|
M && b(getComputedStyle(M).direction === "rtl");
|
|
@@ -1300,7 +1300,7 @@ function ls({
|
|
|
1300
1300
|
)}`;
|
|
1301
1301
|
return /* @__PURE__ */ N(j.Root, { children: [
|
|
1302
1302
|
/* @__PURE__ */ t(j.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1303
|
-
|
|
1303
|
+
Se,
|
|
1304
1304
|
{
|
|
1305
1305
|
ref: p,
|
|
1306
1306
|
size: "sm",
|
|
@@ -1320,12 +1320,12 @@ function cs({
|
|
|
1320
1320
|
restoreSelection: u,
|
|
1321
1321
|
getSelectedText: c
|
|
1322
1322
|
}) {
|
|
1323
|
-
const { t: p } =
|
|
1324
|
-
y(""), C(""),
|
|
1323
|
+
const { t: p } = se("ui"), [h, b] = R(!1), [f, y] = R(""), [E, C] = R(""), [M, I] = R(!1), L = Ge(), P = Ge(), g = () => {
|
|
1324
|
+
y(""), C(""), I(!1);
|
|
1325
1325
|
}, m = () => {
|
|
1326
1326
|
const v = f.trim();
|
|
1327
1327
|
if (!v) return;
|
|
1328
|
-
const
|
|
1328
|
+
const z = is(v), _ = E.trim() || v, D = M ? ' target="_blank" rel="noopener noreferrer"' : "", K = `<a href="${fn(z)}"${D}>${fn(_)}</a>`;
|
|
1329
1329
|
b(!1), g(), window.requestAnimationFrame(() => {
|
|
1330
1330
|
u(), r(K);
|
|
1331
1331
|
});
|
|
@@ -1347,11 +1347,11 @@ function cs({
|
|
|
1347
1347
|
/* @__PURE__ */ t(de.Header, { children: /* @__PURE__ */ t(de.Title, { children: p("editor.link.insert", "Insert link") }) }),
|
|
1348
1348
|
/* @__PURE__ */ N(de.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
1349
1349
|
/* @__PURE__ */ N("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1350
|
-
/* @__PURE__ */ t("label", { htmlFor:
|
|
1350
|
+
/* @__PURE__ */ t("label", { htmlFor: L, className: Ht, children: p("editor.link.url", "URL") }),
|
|
1351
1351
|
/* @__PURE__ */ t(
|
|
1352
1352
|
mn,
|
|
1353
1353
|
{
|
|
1354
|
-
id:
|
|
1354
|
+
id: L,
|
|
1355
1355
|
type: "url",
|
|
1356
1356
|
value: f,
|
|
1357
1357
|
onChange: (v) => y(v.target.value),
|
|
@@ -1375,14 +1375,14 @@ function cs({
|
|
|
1375
1375
|
Ei,
|
|
1376
1376
|
{
|
|
1377
1377
|
checked: M,
|
|
1378
|
-
onCheckedChange: (v) =>
|
|
1378
|
+
onCheckedChange: (v) => I(v === !0),
|
|
1379
1379
|
label: p("editor.link.newTab", "Open in new tab")
|
|
1380
1380
|
}
|
|
1381
1381
|
)
|
|
1382
1382
|
] }),
|
|
1383
1383
|
/* @__PURE__ */ N(de.Footer, { children: [
|
|
1384
|
-
/* @__PURE__ */ t(de.Close, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1385
|
-
/* @__PURE__ */ t(
|
|
1384
|
+
/* @__PURE__ */ t(de.Close, { asChild: !0, children: /* @__PURE__ */ t(Se, { intent: "secondary", children: p("common.cancel") }) }),
|
|
1385
|
+
/* @__PURE__ */ t(Se, { onClick: m, disabled: !f.trim(), children: p("editor.link.insertAction", "Insert") })
|
|
1386
1386
|
] })
|
|
1387
1387
|
] })
|
|
1388
1388
|
] });
|
|
@@ -1393,14 +1393,14 @@ function ds({
|
|
|
1393
1393
|
restoreSelection: u,
|
|
1394
1394
|
uploadImage: c
|
|
1395
1395
|
}) {
|
|
1396
|
-
const { t: p } =
|
|
1396
|
+
const { t: p } = se("ui"), [h, b] = R(!1), [f, y] = R(""), [E, C] = R(""), M = Ge(), I = Ge(), L = (g, m) => {
|
|
1397
1397
|
const v = `<img src="${fn(g)}" alt="${fn(m)}" loading="lazy">`;
|
|
1398
1398
|
b(!1), y(""), C(""), window.requestAnimationFrame(() => {
|
|
1399
1399
|
u(), r(v);
|
|
1400
1400
|
});
|
|
1401
1401
|
}, P = () => {
|
|
1402
1402
|
const g = f.trim();
|
|
1403
|
-
g &&
|
|
1403
|
+
g && L(g, E.trim());
|
|
1404
1404
|
};
|
|
1405
1405
|
return /* @__PURE__ */ N(de.Root, { open: h, onOpenChange: b, children: [
|
|
1406
1406
|
/* @__PURE__ */ t(de.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
@@ -1428,7 +1428,7 @@ function ds({
|
|
|
1428
1428
|
maxFiles: 1,
|
|
1429
1429
|
onUpload: async (g, { signal: m }) => {
|
|
1430
1430
|
const v = await c(g, m);
|
|
1431
|
-
|
|
1431
|
+
L(v, g.name);
|
|
1432
1432
|
}
|
|
1433
1433
|
}
|
|
1434
1434
|
),
|
|
@@ -1448,11 +1448,11 @@ function ds({
|
|
|
1448
1448
|
)
|
|
1449
1449
|
] }),
|
|
1450
1450
|
/* @__PURE__ */ N("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1451
|
-
/* @__PURE__ */ t("label", { htmlFor:
|
|
1451
|
+
/* @__PURE__ */ t("label", { htmlFor: I, className: Ht, children: p("editor.image.alt", "Alt text") }),
|
|
1452
1452
|
/* @__PURE__ */ t(
|
|
1453
1453
|
mn,
|
|
1454
1454
|
{
|
|
1455
|
-
id:
|
|
1455
|
+
id: I,
|
|
1456
1456
|
value: E,
|
|
1457
1457
|
onChange: (g) => C(g.target.value),
|
|
1458
1458
|
placeholder: p(
|
|
@@ -1464,8 +1464,8 @@ function ds({
|
|
|
1464
1464
|
] })
|
|
1465
1465
|
] }),
|
|
1466
1466
|
/* @__PURE__ */ N(de.Footer, { children: [
|
|
1467
|
-
/* @__PURE__ */ t(de.Close, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1468
|
-
/* @__PURE__ */ t(
|
|
1467
|
+
/* @__PURE__ */ t(de.Close, { asChild: !0, children: /* @__PURE__ */ t(Se, { intent: "secondary", children: p("common.cancel") }) }),
|
|
1468
|
+
/* @__PURE__ */ t(Se, { onClick: P, disabled: !f.trim(), children: p("editor.image.insertAction", "Insert") })
|
|
1469
1469
|
] })
|
|
1470
1470
|
] })
|
|
1471
1471
|
] });
|
|
@@ -1475,7 +1475,7 @@ function us({
|
|
|
1475
1475
|
saveSelection: a,
|
|
1476
1476
|
restoreSelection: u
|
|
1477
1477
|
}) {
|
|
1478
|
-
const { t: c } =
|
|
1478
|
+
const { t: c } = se("ui"), [p, h] = R("#1f2a5c"), b = (y) => {
|
|
1479
1479
|
h(y), u(), r("module.inline.format", {
|
|
1480
1480
|
tag: "span",
|
|
1481
1481
|
style: { color: y },
|
|
@@ -1484,8 +1484,8 @@ function us({
|
|
|
1484
1484
|
}, f = () => {
|
|
1485
1485
|
u(), r("module.inline.remove", { style: "color" });
|
|
1486
1486
|
};
|
|
1487
|
-
return /* @__PURE__ */ N(
|
|
1488
|
-
/* @__PURE__ */ t(
|
|
1487
|
+
return /* @__PURE__ */ N(ae, { onOpenChange: (y) => y && a(), children: [
|
|
1488
|
+
/* @__PURE__ */ t(ae.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1489
1489
|
X,
|
|
1490
1490
|
{
|
|
1491
1491
|
size: "sm",
|
|
@@ -1497,8 +1497,8 @@ function us({
|
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
1499
|
) }),
|
|
1500
|
-
/* @__PURE__ */ N(
|
|
1501
|
-
/* @__PURE__ */ t(
|
|
1500
|
+
/* @__PURE__ */ N(ae.Content, { side: "bottom", align: "start", children: [
|
|
1501
|
+
/* @__PURE__ */ t(ae.Heading, { children: c("editor.textColor", "Text colour") }),
|
|
1502
1502
|
/* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
|
|
1503
1503
|
Jn,
|
|
1504
1504
|
{
|
|
@@ -1508,7 +1508,7 @@ function us({
|
|
|
1508
1508
|
onChange: b
|
|
1509
1509
|
}
|
|
1510
1510
|
) }),
|
|
1511
|
-
/* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(
|
|
1511
|
+
/* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(Se, { size: "sm", intent: "secondary", onClick: f, children: c("editor.color.remove", "Remove colour") }) })
|
|
1512
1512
|
] })
|
|
1513
1513
|
] });
|
|
1514
1514
|
}
|
|
@@ -1517,7 +1517,7 @@ function ms({
|
|
|
1517
1517
|
saveSelection: a,
|
|
1518
1518
|
restoreSelection: u
|
|
1519
1519
|
}) {
|
|
1520
|
-
const { t: c } =
|
|
1520
|
+
const { t: c } = se("ui"), [p, h] = R("#fff3a3"), b = (y) => {
|
|
1521
1521
|
h(y), u(), r("module.inline.format", {
|
|
1522
1522
|
tag: "span",
|
|
1523
1523
|
style: { "background-color": y },
|
|
@@ -1526,8 +1526,8 @@ function ms({
|
|
|
1526
1526
|
}, f = () => {
|
|
1527
1527
|
u(), r("module.inline.remove", { style: "background-color" });
|
|
1528
1528
|
};
|
|
1529
|
-
return /* @__PURE__ */ N(
|
|
1530
|
-
/* @__PURE__ */ t(
|
|
1529
|
+
return /* @__PURE__ */ N(ae, { onOpenChange: (y) => y && a(), children: [
|
|
1530
|
+
/* @__PURE__ */ t(ae.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1531
1531
|
X,
|
|
1532
1532
|
{
|
|
1533
1533
|
size: "sm",
|
|
@@ -1539,8 +1539,8 @@ function ms({
|
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
1541
|
) }),
|
|
1542
|
-
/* @__PURE__ */ N(
|
|
1543
|
-
/* @__PURE__ */ t(
|
|
1542
|
+
/* @__PURE__ */ N(ae.Content, { side: "bottom", align: "start", children: [
|
|
1543
|
+
/* @__PURE__ */ t(ae.Heading, { children: c("editor.highlightColor", "Highlight") }),
|
|
1544
1544
|
/* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
|
|
1545
1545
|
Jn,
|
|
1546
1546
|
{
|
|
@@ -1550,7 +1550,7 @@ function ms({
|
|
|
1550
1550
|
onChange: b
|
|
1551
1551
|
}
|
|
1552
1552
|
) }),
|
|
1553
|
-
/* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(
|
|
1553
|
+
/* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(Se, { size: "sm", intent: "secondary", onClick: f, children: c("editor.highlight.remove", "Remove highlight") }) })
|
|
1554
1554
|
] })
|
|
1555
1555
|
] });
|
|
1556
1556
|
}
|
|
@@ -1563,7 +1563,7 @@ function gs({
|
|
|
1563
1563
|
insertTable: a,
|
|
1564
1564
|
active: u
|
|
1565
1565
|
}) {
|
|
1566
|
-
const { t: c } =
|
|
1566
|
+
const { t: c } = se("ui"), [p, h] = R({ r: 0, c: 0 }), [b, f] = R(!1), y = u.has("table") || b, E = /* @__PURE__ */ t(
|
|
1567
1567
|
X,
|
|
1568
1568
|
{
|
|
1569
1569
|
size: "sm",
|
|
@@ -1584,10 +1584,10 @@ function gs({
|
|
|
1584
1584
|
},
|
|
1585
1585
|
C.id
|
|
1586
1586
|
)) })
|
|
1587
|
-
] }) : /* @__PURE__ */ N(
|
|
1588
|
-
/* @__PURE__ */ t(
|
|
1589
|
-
/* @__PURE__ */ N(
|
|
1590
|
-
/* @__PURE__ */ t(
|
|
1587
|
+
] }) : /* @__PURE__ */ N(ae, { onOpenChange: (C) => !C && h({ r: 0, c: 0 }), children: [
|
|
1588
|
+
/* @__PURE__ */ t(ae.Trigger, { asChild: !0, children: E }),
|
|
1589
|
+
/* @__PURE__ */ N(ae.Content, { side: "bottom", align: "start", children: [
|
|
1590
|
+
/* @__PURE__ */ t(ae.Heading, { children: c("editor.table.insert", "Insert table") }),
|
|
1591
1591
|
/* @__PURE__ */ t(
|
|
1592
1592
|
"div",
|
|
1593
1593
|
{
|
|
@@ -1596,17 +1596,17 @@ function gs({
|
|
|
1596
1596
|
className: "ds:mt-[var(--spacing-sm)] ds:grid ds:w-fit ds:grid-cols-6 ds:gap-[var(--spacing-2xs)]",
|
|
1597
1597
|
onMouseLeave: () => h({ r: 0, c: 0 }),
|
|
1598
1598
|
children: Array.from({ length: cn * cn }, (C, M) => {
|
|
1599
|
-
const
|
|
1599
|
+
const I = Math.floor(M / cn) + 1, L = M % cn + 1, P = I <= p.r && L <= p.c;
|
|
1600
1600
|
return /* @__PURE__ */ t(
|
|
1601
1601
|
"button",
|
|
1602
1602
|
{
|
|
1603
1603
|
type: "button",
|
|
1604
1604
|
"aria-label": c("editor.table.sizeCell", "{{r}}×{{c}}", {
|
|
1605
|
-
r:
|
|
1606
|
-
c:
|
|
1605
|
+
r: I,
|
|
1606
|
+
c: L
|
|
1607
1607
|
}),
|
|
1608
|
-
onMouseEnter: () => h({ r:
|
|
1609
|
-
onClick: () => a(fs(
|
|
1608
|
+
onMouseEnter: () => h({ r: I, c: L }),
|
|
1609
|
+
onClick: () => a(fs(I, L)),
|
|
1610
1610
|
className: `ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ${P ? "ds:bg-[var(--primary)]" : "ds:bg-[var(--muted)]"}`
|
|
1611
1611
|
},
|
|
1612
1612
|
M
|
|
@@ -1635,15 +1635,15 @@ function Ur({
|
|
|
1635
1635
|
saveTableCell: p,
|
|
1636
1636
|
applyTableBackground: h
|
|
1637
1637
|
}) {
|
|
1638
|
-
const { t: b } =
|
|
1638
|
+
const { t: b } = se("ui"), [f, y] = R(bs);
|
|
1639
1639
|
return /* @__PURE__ */ N(
|
|
1640
|
-
|
|
1640
|
+
ae,
|
|
1641
1641
|
{
|
|
1642
1642
|
onOpenChange: (E) => {
|
|
1643
1643
|
c(E), E && p();
|
|
1644
1644
|
},
|
|
1645
1645
|
children: [
|
|
1646
|
-
/* @__PURE__ */ t(
|
|
1646
|
+
/* @__PURE__ */ t(ae.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1647
1647
|
X,
|
|
1648
1648
|
{
|
|
1649
1649
|
size: "sm",
|
|
@@ -1653,7 +1653,7 @@ function Ur({
|
|
|
1653
1653
|
onMouseDown: (E) => E.preventDefault()
|
|
1654
1654
|
}
|
|
1655
1655
|
) }),
|
|
1656
|
-
/* @__PURE__ */ N(
|
|
1656
|
+
/* @__PURE__ */ N(ae.Content, { side: "bottom", align: "center", children: [
|
|
1657
1657
|
/* @__PURE__ */ t(
|
|
1658
1658
|
Jn,
|
|
1659
1659
|
{
|
|
@@ -1666,7 +1666,7 @@ function Ur({
|
|
|
1666
1666
|
}
|
|
1667
1667
|
),
|
|
1668
1668
|
/* @__PURE__ */ t(
|
|
1669
|
-
|
|
1669
|
+
Se,
|
|
1670
1670
|
{
|
|
1671
1671
|
size: "sm",
|
|
1672
1672
|
intent: "ghost",
|
|
@@ -1689,14 +1689,14 @@ function vs({
|
|
|
1689
1689
|
saveTableCell: h,
|
|
1690
1690
|
applyTableBackground: b
|
|
1691
1691
|
}) {
|
|
1692
|
-
const { t: f } =
|
|
1692
|
+
const { t: f } = se("ui"), y = r.has("table"), [E, C] = R(null), M = x(0), [I, L] = R(!1), P = w((m) => {
|
|
1693
1693
|
M.current = Math.max(
|
|
1694
1694
|
0,
|
|
1695
1695
|
M.current + (m ? 1 : -1)
|
|
1696
|
-
),
|
|
1696
|
+
), L(M.current > 0);
|
|
1697
1697
|
}, []);
|
|
1698
1698
|
if (H(() => {
|
|
1699
|
-
if (
|
|
1699
|
+
if (I) return;
|
|
1700
1700
|
if (!y || typeof window > "u") {
|
|
1701
1701
|
C(null);
|
|
1702
1702
|
return;
|
|
@@ -1707,15 +1707,15 @@ function vs({
|
|
|
1707
1707
|
C(null);
|
|
1708
1708
|
return;
|
|
1709
1709
|
}
|
|
1710
|
-
const G = D.getBoundingClientRect(),
|
|
1711
|
-
C({ top: le, start: Math.max(0,
|
|
1710
|
+
const G = D.getBoundingClientRect(), B = K.getBoundingClientRect(), k = getComputedStyle(D).direction === "rtl", le = Math.max(0, B.top - G.top - 44), F = k ? G.right - B.right + B.width / 2 : B.left - G.left + B.width / 2;
|
|
1711
|
+
C({ top: le, start: Math.max(0, F), rtl: k });
|
|
1712
1712
|
};
|
|
1713
1713
|
m();
|
|
1714
|
-
const v = new ResizeObserver(m),
|
|
1715
|
-
return
|
|
1714
|
+
const v = new ResizeObserver(m), z = u.current, _ = c();
|
|
1715
|
+
return z && v.observe(z), _ && v.observe(_), window.addEventListener("scroll", m, !0), window.addEventListener("resize", m), () => {
|
|
1716
1716
|
v.disconnect(), window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", m);
|
|
1717
1717
|
};
|
|
1718
|
-
}, [y,
|
|
1718
|
+
}, [y, I, u, c]), !y && !I || !E) return null;
|
|
1719
1719
|
const g = [
|
|
1720
1720
|
["rowAbove", "rowBelow"],
|
|
1721
1721
|
["colLeft", "colRight"],
|
|
@@ -1740,7 +1740,7 @@ function vs({
|
|
|
1740
1740
|
},
|
|
1741
1741
|
children: g.map((m, v) => /* @__PURE__ */ N(yt, { children: [
|
|
1742
1742
|
v > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: gn }) : null,
|
|
1743
|
-
m === "colour" ? /* @__PURE__ */ N(
|
|
1743
|
+
m === "colour" ? /* @__PURE__ */ N(Be, { children: [
|
|
1744
1744
|
/* @__PURE__ */ t(
|
|
1745
1745
|
Ur,
|
|
1746
1746
|
{
|
|
@@ -1763,19 +1763,19 @@ function vs({
|
|
|
1763
1763
|
applyTableBackground: b
|
|
1764
1764
|
}
|
|
1765
1765
|
)
|
|
1766
|
-
] }) : m.map((
|
|
1767
|
-
const
|
|
1766
|
+
] }) : m.map((z) => {
|
|
1767
|
+
const _ = hs[z];
|
|
1768
1768
|
return /* @__PURE__ */ t(
|
|
1769
1769
|
X,
|
|
1770
1770
|
{
|
|
1771
1771
|
size: "sm",
|
|
1772
1772
|
intent: "ghost",
|
|
1773
|
-
icon:
|
|
1774
|
-
tooltip: f(
|
|
1773
|
+
icon: _.icon,
|
|
1774
|
+
tooltip: f(_.label[0], _.label[1]),
|
|
1775
1775
|
onMouseDown: (D) => D.preventDefault(),
|
|
1776
|
-
onClick: () => a(
|
|
1776
|
+
onClick: () => a(_.command)
|
|
1777
1777
|
},
|
|
1778
|
-
|
|
1778
|
+
z
|
|
1779
1779
|
);
|
|
1780
1780
|
})
|
|
1781
1781
|
] }, m === "colour" ? "colour" : m[0]))
|
|
@@ -1892,7 +1892,7 @@ function Rs({
|
|
|
1892
1892
|
applyImageClass: u,
|
|
1893
1893
|
setImageWidth: c
|
|
1894
1894
|
}) {
|
|
1895
|
-
const { t: p } =
|
|
1895
|
+
const { t: p } = se("ui"), [h, b] = R(null), f = x(null);
|
|
1896
1896
|
H(() => {
|
|
1897
1897
|
if (!a || typeof window > "u") {
|
|
1898
1898
|
b(null);
|
|
@@ -1904,16 +1904,16 @@ function Rs({
|
|
|
1904
1904
|
b(null);
|
|
1905
1905
|
return;
|
|
1906
1906
|
}
|
|
1907
|
-
const K = D.getBoundingClientRect(), G = a.getBoundingClientRect(),
|
|
1907
|
+
const K = D.getBoundingClientRect(), G = a.getBoundingClientRect(), B = getComputedStyle(D).direction === "rtl", k = G.top - K.top, le = B ? K.right - G.right : G.left - K.left, F = le + G.width / 2, U = Math.max(0, k - 44);
|
|
1908
1908
|
b({
|
|
1909
1909
|
top: k,
|
|
1910
1910
|
start: Math.max(0, le),
|
|
1911
1911
|
width: G.width,
|
|
1912
1912
|
height: G.height,
|
|
1913
|
-
center: Math.max(0,
|
|
1913
|
+
center: Math.max(0, F),
|
|
1914
1914
|
barTop: U,
|
|
1915
1915
|
pct: ys(a),
|
|
1916
|
-
rtl:
|
|
1916
|
+
rtl: B
|
|
1917
1917
|
});
|
|
1918
1918
|
};
|
|
1919
1919
|
g();
|
|
@@ -1921,16 +1921,16 @@ function Rs({
|
|
|
1921
1921
|
m.observe(a);
|
|
1922
1922
|
const v = r.current;
|
|
1923
1923
|
v && m.observe(v);
|
|
1924
|
-
const
|
|
1925
|
-
let
|
|
1926
|
-
return
|
|
1924
|
+
const z = a.closest(".redactor-in");
|
|
1925
|
+
let _ = null;
|
|
1926
|
+
return z && (_ = new MutationObserver(g), _.observe(z, {
|
|
1927
1927
|
subtree: !0,
|
|
1928
1928
|
childList: !0,
|
|
1929
1929
|
characterData: !0,
|
|
1930
1930
|
attributes: !0,
|
|
1931
1931
|
attributeFilter: ["class", "style", "width", "height", "src"]
|
|
1932
1932
|
})), window.addEventListener("scroll", g, !0), window.addEventListener("resize", g), () => {
|
|
1933
|
-
m.disconnect(),
|
|
1933
|
+
m.disconnect(), _ == null || _.disconnect(), window.removeEventListener("scroll", g, !0), window.removeEventListener("resize", g);
|
|
1934
1934
|
};
|
|
1935
1935
|
}, [a, r]);
|
|
1936
1936
|
const y = w(
|
|
@@ -1947,10 +1947,10 @@ function Rs({
|
|
|
1947
1947
|
(g) => {
|
|
1948
1948
|
const m = f.current;
|
|
1949
1949
|
if (!m || g.pointerId !== m.pointerId || !a) return;
|
|
1950
|
-
const v = a.closest(".redactor-in"),
|
|
1951
|
-
if (
|
|
1952
|
-
const
|
|
1953
|
-
c(Qr(m.startPct +
|
|
1950
|
+
const v = a.closest(".redactor-in"), z = v instanceof HTMLElement ? v.clientWidth : 0;
|
|
1951
|
+
if (z <= 0) return;
|
|
1952
|
+
const _ = m.sign * (g.clientX - m.startX) / z * 100;
|
|
1953
|
+
c(Qr(m.startPct + _));
|
|
1954
1954
|
},
|
|
1955
1955
|
[a, c]
|
|
1956
1956
|
), C = w(
|
|
@@ -1989,11 +1989,11 @@ function Rs({
|
|
|
1989
1989
|
[h, c]
|
|
1990
1990
|
);
|
|
1991
1991
|
if (!a || !h) return null;
|
|
1992
|
-
const
|
|
1992
|
+
const I = Zr(a, Wn), L = Zr(a, ho), P = p("editor.image.widthAnnounce", {
|
|
1993
1993
|
width: h.pct,
|
|
1994
1994
|
defaultValue: "{{width}} percent"
|
|
1995
1995
|
});
|
|
1996
|
-
return /* @__PURE__ */ N(
|
|
1996
|
+
return /* @__PURE__ */ N(Be, { children: [
|
|
1997
1997
|
/* @__PURE__ */ t(
|
|
1998
1998
|
"div",
|
|
1999
1999
|
{
|
|
@@ -2039,16 +2039,16 @@ function Rs({
|
|
|
2039
2039
|
children: [xs, Cs].map((g, m) => /* @__PURE__ */ N(yt, { children: [
|
|
2040
2040
|
m > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: gn }) : null,
|
|
2041
2041
|
g.map((v) => {
|
|
2042
|
-
const
|
|
2042
|
+
const z = m === 0 ? I === v.id : L === v.id;
|
|
2043
2043
|
return /* @__PURE__ */ t(
|
|
2044
2044
|
X,
|
|
2045
2045
|
{
|
|
2046
2046
|
size: "sm",
|
|
2047
2047
|
intent: "ghost",
|
|
2048
2048
|
icon: v.icon,
|
|
2049
|
-
"aria-pressed":
|
|
2049
|
+
"aria-pressed": z,
|
|
2050
2050
|
tooltip: p(v.label[0], v.label[1]),
|
|
2051
|
-
onMouseDown: (
|
|
2051
|
+
onMouseDown: (_) => _.preventDefault(),
|
|
2052
2052
|
onClick: () => u(v.id)
|
|
2053
2053
|
},
|
|
2054
2054
|
v.id
|
|
@@ -2068,7 +2068,7 @@ function Ms({
|
|
|
2068
2068
|
trigger: h,
|
|
2069
2069
|
side: b = "top"
|
|
2070
2070
|
}) {
|
|
2071
|
-
const { t: f } =
|
|
2071
|
+
const { t: f } = se("ui"), y = Ge();
|
|
2072
2072
|
return /* @__PURE__ */ N(j.Root, { onOpenChange: p, children: [
|
|
2073
2073
|
/* @__PURE__ */ t(j.Trigger, { asChild: !0, children: h }),
|
|
2074
2074
|
/* @__PURE__ */ N(j.Content, { side: b, align: "end", sideOffset: 8, children: [
|
|
@@ -2108,7 +2108,7 @@ function Ms({
|
|
|
2108
2108
|
children: f("editor.ai.createFirstTemplate")
|
|
2109
2109
|
}
|
|
2110
2110
|
) : null,
|
|
2111
|
-
u && r.length > 0 ? /* @__PURE__ */ N(
|
|
2111
|
+
u && r.length > 0 ? /* @__PURE__ */ N(Be, { children: [
|
|
2112
2112
|
/* @__PURE__ */ t(j.Separator, {}),
|
|
2113
2113
|
/* @__PURE__ */ t(
|
|
2114
2114
|
j.Item,
|
|
@@ -2138,7 +2138,7 @@ function Ls({
|
|
|
2138
2138
|
holdOpen: h = !1,
|
|
2139
2139
|
children: b
|
|
2140
2140
|
}) {
|
|
2141
|
-
const { t: f } =
|
|
2141
|
+
const { t: f } = se("ui"), y = x(null), [E, C] = R(null), M = x(h);
|
|
2142
2142
|
return H(() => {
|
|
2143
2143
|
M.current = h;
|
|
2144
2144
|
}, [h]), H(() => {
|
|
@@ -2146,51 +2146,51 @@ function Ls({
|
|
|
2146
2146
|
C(null);
|
|
2147
2147
|
return;
|
|
2148
2148
|
}
|
|
2149
|
-
let
|
|
2149
|
+
let I = !1, L = 0, P = !1, g = !1;
|
|
2150
2150
|
const m = () => {
|
|
2151
2151
|
P = !1, C(null);
|
|
2152
2152
|
}, v = () => {
|
|
2153
2153
|
var Ne;
|
|
2154
|
-
if (M.current ||
|
|
2154
|
+
if (M.current || I) return;
|
|
2155
2155
|
if (g) {
|
|
2156
2156
|
m();
|
|
2157
2157
|
return;
|
|
2158
2158
|
}
|
|
2159
|
-
const
|
|
2160
|
-
if (!
|
|
2159
|
+
const B = u.current, k = c(), le = window.getSelection();
|
|
2160
|
+
if (!B || !k || !le || le.rangeCount === 0 || le.isCollapsed || !B.contains(document.activeElement)) {
|
|
2161
2161
|
m();
|
|
2162
2162
|
return;
|
|
2163
2163
|
}
|
|
2164
|
-
const
|
|
2165
|
-
if (!k.contains(
|
|
2164
|
+
const F = le.getRangeAt(0);
|
|
2165
|
+
if (!k.contains(F.commonAncestorContainer)) {
|
|
2166
2166
|
m();
|
|
2167
2167
|
return;
|
|
2168
2168
|
}
|
|
2169
|
-
if (!
|
|
2169
|
+
if (!F.toString().trim()) {
|
|
2170
2170
|
m();
|
|
2171
2171
|
return;
|
|
2172
2172
|
}
|
|
2173
|
-
const U =
|
|
2174
|
-
Math.max(V,
|
|
2175
|
-
Math.max(
|
|
2173
|
+
const U = B.getBoundingClientRect(), re = F.getBoundingClientRect(), Y = getComputedStyle(B).direction === "rtl", ke = re.top - U.top - 48, ee = ke >= 0 ? ke : re.bottom - U.top + 8, _e = ((Ne = y.current) == null ? void 0 : Ne.offsetWidth) ?? 0, V = Y ? U.right - re.right + re.width / 2 : re.left - U.left + re.width / 2, oe = _e / 2, Z = Math.min(
|
|
2174
|
+
Math.max(V, oe),
|
|
2175
|
+
Math.max(oe, U.width - oe)
|
|
2176
2176
|
);
|
|
2177
|
-
C({ top:
|
|
2178
|
-
},
|
|
2179
|
-
cancelAnimationFrame(
|
|
2180
|
-
},
|
|
2177
|
+
C({ top: ee, start: Z, rtl: Y }), _e === 0 && !P && (P = !0, L = requestAnimationFrame(v));
|
|
2178
|
+
}, z = () => {
|
|
2179
|
+
cancelAnimationFrame(L), L = requestAnimationFrame(v);
|
|
2180
|
+
}, _ = (B) => {
|
|
2181
2181
|
const k = c();
|
|
2182
|
-
k &&
|
|
2182
|
+
k && B.target instanceof Node && k.contains(B.target) && (I = !0, m());
|
|
2183
2183
|
}, D = () => {
|
|
2184
|
-
|
|
2185
|
-
}, K = (
|
|
2186
|
-
if (
|
|
2184
|
+
I && (I = !1, z());
|
|
2185
|
+
}, K = (B) => {
|
|
2186
|
+
if (B.key !== "Escape") return;
|
|
2187
2187
|
const k = u.current;
|
|
2188
2188
|
!k || !k.contains(document.activeElement) || (g = !0, m());
|
|
2189
2189
|
}, G = () => {
|
|
2190
|
-
g = !1,
|
|
2190
|
+
g = !1, z();
|
|
2191
2191
|
};
|
|
2192
|
-
return document.addEventListener("selectionchange", G), document.addEventListener("focusin",
|
|
2193
|
-
cancelAnimationFrame(
|
|
2192
|
+
return document.addEventListener("selectionchange", G), document.addEventListener("focusin", z), document.addEventListener("keydown", K, !0), document.addEventListener("pointerdown", _, !0), document.addEventListener("pointerup", D, !0), document.addEventListener("pointercancel", D, !0), window.addEventListener("scroll", z, !0), window.addEventListener("resize", z), z(), () => {
|
|
2193
|
+
cancelAnimationFrame(L), document.removeEventListener("selectionchange", G), document.removeEventListener("focusin", z), document.removeEventListener("keydown", K, !0), document.removeEventListener("pointerdown", _, !0), document.removeEventListener("pointerup", D, !0), document.removeEventListener("pointercancel", D, !0), window.removeEventListener("scroll", z, !0), window.removeEventListener("resize", z);
|
|
2194
2194
|
};
|
|
2195
2195
|
}, [p, u, c]), p || !E ? null : /* @__PURE__ */ t(Qn, { children: /* @__PURE__ */ N(
|
|
2196
2196
|
"div",
|
|
@@ -2205,23 +2205,23 @@ function Ls({
|
|
|
2205
2205
|
"--rte-sel-start": `${E.start}px`
|
|
2206
2206
|
},
|
|
2207
2207
|
children: [
|
|
2208
|
-
zs.map((
|
|
2209
|
-
const
|
|
2208
|
+
zs.map((I) => {
|
|
2209
|
+
const L = mo[I];
|
|
2210
2210
|
return /* @__PURE__ */ t(
|
|
2211
2211
|
X,
|
|
2212
2212
|
{
|
|
2213
2213
|
size: "sm",
|
|
2214
2214
|
intent: "ghost",
|
|
2215
|
-
icon:
|
|
2216
|
-
tooltip: f(
|
|
2217
|
-
"aria-pressed":
|
|
2215
|
+
icon: L.icon,
|
|
2216
|
+
tooltip: f(L.label[0], L.label[1]),
|
|
2217
|
+
"aria-pressed": L.toggle ? r.has(L.toggle) : void 0,
|
|
2218
2218
|
onMouseDown: (P) => P.preventDefault(),
|
|
2219
|
-
onClick: () => a(...
|
|
2219
|
+
onClick: () => a(...L.command)
|
|
2220
2220
|
},
|
|
2221
|
-
|
|
2221
|
+
I
|
|
2222
2222
|
);
|
|
2223
2223
|
}),
|
|
2224
|
-
b ? /* @__PURE__ */ N(
|
|
2224
|
+
b ? /* @__PURE__ */ N(Be, { children: [
|
|
2225
2225
|
/* @__PURE__ */ t("span", { "aria-hidden": "true", className: gn }),
|
|
2226
2226
|
b
|
|
2227
2227
|
] }) : null
|
|
@@ -2242,29 +2242,29 @@ function _s({
|
|
|
2242
2242
|
enableColor: E = !1,
|
|
2243
2243
|
enableImage: C = !1,
|
|
2244
2244
|
enableTable: M = !1,
|
|
2245
|
-
showExtensions:
|
|
2246
|
-
extensionControl:
|
|
2245
|
+
showExtensions: I = !1,
|
|
2246
|
+
extensionControl: L,
|
|
2247
2247
|
variables: P,
|
|
2248
2248
|
recentVariableTokens: g,
|
|
2249
2249
|
insertVariable: m
|
|
2250
2250
|
}) {
|
|
2251
|
-
const { t: v } =
|
|
2252
|
-
if (!
|
|
2253
|
-
const
|
|
2251
|
+
const { t: v } = se("ui"), z = (V) => V.preventDefault(), _ = (V) => ns[u].includes(V), D = (V) => {
|
|
2252
|
+
if (!_(V)) return null;
|
|
2253
|
+
const oe = mo[V];
|
|
2254
2254
|
return /* @__PURE__ */ t(
|
|
2255
2255
|
X,
|
|
2256
2256
|
{
|
|
2257
2257
|
size: "sm",
|
|
2258
2258
|
intent: "ghost",
|
|
2259
|
-
icon:
|
|
2260
|
-
"aria-label": v(
|
|
2261
|
-
"aria-pressed":
|
|
2262
|
-
onMouseDown:
|
|
2263
|
-
onClick: () => r(...
|
|
2259
|
+
icon: oe.icon,
|
|
2260
|
+
"aria-label": v(oe.label[0], oe.label[1]),
|
|
2261
|
+
"aria-pressed": oe.toggle ? a.has(oe.toggle) : void 0,
|
|
2262
|
+
onMouseDown: z,
|
|
2263
|
+
onClick: () => r(...oe.command)
|
|
2264
2264
|
},
|
|
2265
|
-
|
|
2265
|
+
oe.id
|
|
2266
2266
|
);
|
|
2267
|
-
}, K = () => /* @__PURE__ */ t("span", { "aria-hidden": "true", className: gn }), G =
|
|
2267
|
+
}, K = () => /* @__PURE__ */ t("span", { "aria-hidden": "true", className: gn }), G = _("format"), B = [D("undo"), D("redo")].filter(Boolean), k = [
|
|
2268
2268
|
D("bold"),
|
|
2269
2269
|
D("italic"),
|
|
2270
2270
|
D("underline"),
|
|
@@ -2287,18 +2287,18 @@ function _s({
|
|
|
2287
2287
|
},
|
|
2288
2288
|
"highlight"
|
|
2289
2289
|
) : null
|
|
2290
|
-
].filter(Boolean), le =
|
|
2290
|
+
].filter(Boolean), le = B.length > 0 || G || k.length > 0, F = _("align") ? [
|
|
2291
2291
|
/* @__PURE__ */ t(
|
|
2292
2292
|
ls,
|
|
2293
2293
|
{
|
|
2294
2294
|
run: r,
|
|
2295
2295
|
active: a,
|
|
2296
|
-
onTriggerDown:
|
|
2296
|
+
onTriggerDown: z
|
|
2297
2297
|
},
|
|
2298
2298
|
"align"
|
|
2299
2299
|
)
|
|
2300
|
-
] : [], U = [D("ul"), D("ol")].filter(Boolean),
|
|
2301
|
-
|
|
2300
|
+
] : [], U = [D("ul"), D("ol")].filter(Boolean), re = [
|
|
2301
|
+
_("link") ? /* @__PURE__ */ t(
|
|
2302
2302
|
cs,
|
|
2303
2303
|
{
|
|
2304
2304
|
insertHtml: c,
|
|
@@ -2337,7 +2337,7 @@ function _s({
|
|
|
2337
2337
|
},
|
|
2338
2338
|
"variables"
|
|
2339
2339
|
) : null
|
|
2340
|
-
].filter(Boolean),
|
|
2340
|
+
].filter(Boolean), Y = L ? [/* @__PURE__ */ t(yt, { children: L }, "extensions")] : I ? [
|
|
2341
2341
|
/* @__PURE__ */ t(
|
|
2342
2342
|
X,
|
|
2343
2343
|
{
|
|
@@ -2346,18 +2346,18 @@ function _s({
|
|
|
2346
2346
|
icon: /* @__PURE__ */ t(Kn, {}),
|
|
2347
2347
|
"aria-label": v("editor.extensions", "Editor extensions"),
|
|
2348
2348
|
disabled: !0,
|
|
2349
|
-
onMouseDown:
|
|
2349
|
+
onMouseDown: z
|
|
2350
2350
|
},
|
|
2351
2351
|
"extensions"
|
|
2352
2352
|
)
|
|
2353
2353
|
] : [], ke = [
|
|
2354
|
-
|
|
2354
|
+
F,
|
|
2355
2355
|
U,
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
].filter((V) => V.length > 0),
|
|
2356
|
+
re,
|
|
2357
|
+
Y
|
|
2358
|
+
].filter((V) => V.length > 0), ee = ke.length > 0, _e = (V) => ke.map((oe, Z) => /* @__PURE__ */ N(yt, { children: [
|
|
2359
2359
|
Z > 0 || V ? /* @__PURE__ */ t(K, {}) : null,
|
|
2360
|
-
|
|
2360
|
+
oe
|
|
2361
2361
|
] }, Z));
|
|
2362
2362
|
return (
|
|
2363
2363
|
// Outer element is the query container + visual chrome; the flex row is an
|
|
@@ -2370,27 +2370,27 @@ function _s({
|
|
|
2370
2370
|
"aria-label": v("editor.toolbarLabel"),
|
|
2371
2371
|
className: os,
|
|
2372
2372
|
children: [
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
G ? /* @__PURE__ */ t(ss, { run: r, active: a, onTriggerDown:
|
|
2373
|
+
B,
|
|
2374
|
+
B.length > 0 && (G || k.length > 0) ? /* @__PURE__ */ t(K, {}) : null,
|
|
2375
|
+
G ? /* @__PURE__ */ t(ss, { run: r, active: a, onTriggerDown: z }) : null,
|
|
2376
2376
|
G && k.length > 0 ? /* @__PURE__ */ t(K, {}) : null,
|
|
2377
2377
|
k,
|
|
2378
|
-
|
|
2379
|
-
/* @__PURE__ */ t("div", { className: "ds:hidden ds:@[384px]/toolbar:contents", children:
|
|
2378
|
+
ee ? /* @__PURE__ */ N(Be, { children: [
|
|
2379
|
+
/* @__PURE__ */ t("div", { className: "ds:hidden ds:@[384px]/toolbar:contents", children: _e(le) }),
|
|
2380
2380
|
/* @__PURE__ */ N("div", { className: "ds:contents ds:@[384px]/toolbar:hidden", children: [
|
|
2381
2381
|
le ? /* @__PURE__ */ t(K, {}) : null,
|
|
2382
|
-
/* @__PURE__ */ N(
|
|
2383
|
-
/* @__PURE__ */ t(
|
|
2382
|
+
/* @__PURE__ */ N(ae, { children: [
|
|
2383
|
+
/* @__PURE__ */ t(ae.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2384
2384
|
X,
|
|
2385
2385
|
{
|
|
2386
2386
|
size: "sm",
|
|
2387
2387
|
intent: "ghost",
|
|
2388
2388
|
icon: /* @__PURE__ */ t(Mi, {}),
|
|
2389
2389
|
"aria-label": v("editor.more", "More options"),
|
|
2390
|
-
onMouseDown:
|
|
2390
|
+
onMouseDown: z
|
|
2391
2391
|
}
|
|
2392
2392
|
) }),
|
|
2393
|
-
/* @__PURE__ */ t(
|
|
2393
|
+
/* @__PURE__ */ t(ae.Content, { side: "bottom", align: "end", children: /* @__PURE__ */ t("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: _e(!1) }) })
|
|
2394
2394
|
] })
|
|
2395
2395
|
] })
|
|
2396
2396
|
] }) : null
|
|
@@ -2399,7 +2399,7 @@ function _s({
|
|
|
2399
2399
|
) })
|
|
2400
2400
|
);
|
|
2401
2401
|
}
|
|
2402
|
-
function
|
|
2402
|
+
function Me(r) {
|
|
2403
2403
|
return ui(r, "rich-text");
|
|
2404
2404
|
}
|
|
2405
2405
|
function dn(r = "") {
|
|
@@ -2496,8 +2496,8 @@ function vt(r, a) {
|
|
|
2496
2496
|
const M = a.get(C[1].toLowerCase());
|
|
2497
2497
|
if (!M || C.index === void 0) continue;
|
|
2498
2498
|
y.append(f.data.slice(E, C.index));
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2499
|
+
const I = u.createElement("span");
|
|
2500
|
+
I.setAttribute("data-redactor-type", "variable"), I.textContent = `[[${M}]]`, y.append(I), E = C.index + C[0].length;
|
|
2501
2501
|
}
|
|
2502
2502
|
E !== 0 && (y.append(f.data.slice(E)), f.replaceWith(y), h = !0);
|
|
2503
2503
|
}
|
|
@@ -2572,26 +2572,26 @@ function Js({
|
|
|
2572
2572
|
closeSignal: y,
|
|
2573
2573
|
restoreFocusOnCloseRef: E
|
|
2574
2574
|
}) {
|
|
2575
|
-
const { t: C } =
|
|
2575
|
+
const { t: C } = se("ui"), [M, I] = R(!1), L = x(null), P = x(!1);
|
|
2576
2576
|
return H(() => {
|
|
2577
|
-
|
|
2577
|
+
I(!1);
|
|
2578
2578
|
}, [y]), H(() => {
|
|
2579
2579
|
P.current && !c && (P.current = !1, E.current && window.requestAnimationFrame(() => {
|
|
2580
2580
|
var g;
|
|
2581
|
-
return (g =
|
|
2581
|
+
return (g = L.current) == null ? void 0 : g.focus();
|
|
2582
2582
|
}));
|
|
2583
2583
|
}, [c, E]), /* @__PURE__ */ N(
|
|
2584
2584
|
j.Root,
|
|
2585
2585
|
{
|
|
2586
2586
|
open: M,
|
|
2587
2587
|
onOpenChange: (g) => {
|
|
2588
|
-
g ? (f(),
|
|
2588
|
+
g ? (f(), I(!0)) : (I(!1), u && b());
|
|
2589
2589
|
},
|
|
2590
2590
|
children: [
|
|
2591
2591
|
/* @__PURE__ */ t(j.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2592
2592
|
X,
|
|
2593
2593
|
{
|
|
2594
|
-
ref:
|
|
2594
|
+
ref: L,
|
|
2595
2595
|
"data-component-part": "extensions-trigger",
|
|
2596
2596
|
size: "sm",
|
|
2597
2597
|
intent: "ghost",
|
|
@@ -2613,22 +2613,22 @@ function Js({
|
|
|
2613
2613
|
m === 0 ? "editor.extensionsKit" : "editor.extensionsMarketplace"
|
|
2614
2614
|
) }) : null,
|
|
2615
2615
|
g.map((v) => {
|
|
2616
|
-
var
|
|
2616
|
+
var z;
|
|
2617
2617
|
return /* @__PURE__ */ N(
|
|
2618
2618
|
j.Item,
|
|
2619
2619
|
{
|
|
2620
2620
|
"data-extension-id": v.id,
|
|
2621
2621
|
disabled: u && (c == null ? void 0 : c.extension.id) !== v.id,
|
|
2622
2622
|
"aria-busy": u && (c == null ? void 0 : c.extension.id) === v.id || void 0,
|
|
2623
|
-
onSelect: (
|
|
2624
|
-
v.kind === "action" &&
|
|
2623
|
+
onSelect: (_) => {
|
|
2624
|
+
v.kind === "action" && _.preventDefault(), P.current = !0, h(v);
|
|
2625
2625
|
},
|
|
2626
2626
|
children: [
|
|
2627
2627
|
u && (c == null ? void 0 : c.extension.id) === v.id ? /* @__PURE__ */ t(Zn, { size: "sm" }) : v.icon ?? /* @__PURE__ */ t(Kn, {}),
|
|
2628
2628
|
/* @__PURE__ */ N("span", { className: "ds:flex ds:min-w-0 ds:flex-col ds:text-start", children: [
|
|
2629
2629
|
/* @__PURE__ */ t("span", { children: uo(C, v.label) }),
|
|
2630
2630
|
v.description ? /* @__PURE__ */ t("span", { className: "type-meta ds:text-muted-foreground", children: v.description }) : null,
|
|
2631
|
-
((
|
|
2631
|
+
((z = v.source) == null ? void 0 : z.kind) === "marketplace" ? /* @__PURE__ */ N("span", { className: "type-meta ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-muted-foreground", children: [
|
|
2632
2632
|
v.source.appIconUrl ? /* @__PURE__ */ t(
|
|
2633
2633
|
"img",
|
|
2634
2634
|
{
|
|
@@ -2667,29 +2667,29 @@ const Ys = li(
|
|
|
2667
2667
|
showExtensions: E,
|
|
2668
2668
|
extensions: C,
|
|
2669
2669
|
extensionContext: M,
|
|
2670
|
-
onExtensionRun:
|
|
2671
|
-
className:
|
|
2670
|
+
onExtensionRun: I,
|
|
2671
|
+
className: L,
|
|
2672
2672
|
redactor: P,
|
|
2673
2673
|
options: g,
|
|
2674
2674
|
plugins: m,
|
|
2675
2675
|
lang: v,
|
|
2676
|
-
imageUploadUrl:
|
|
2677
|
-
onUploadImage:
|
|
2676
|
+
imageUploadUrl: z,
|
|
2677
|
+
onUploadImage: _,
|
|
2678
2678
|
onKeyDown: D,
|
|
2679
2679
|
onRequestAiDraft: K,
|
|
2680
2680
|
aiDraftFormat: G = "html",
|
|
2681
|
-
aiPrivacyNotice:
|
|
2681
|
+
aiPrivacyNotice: B,
|
|
2682
2682
|
aiConsent: k,
|
|
2683
2683
|
aiConsentHeadingLevel: le,
|
|
2684
|
-
onDictate:
|
|
2684
|
+
onDictate: F,
|
|
2685
2685
|
onProofread: U,
|
|
2686
|
-
onAutoFormat:
|
|
2687
|
-
aiTemplates:
|
|
2686
|
+
onAutoFormat: re,
|
|
2687
|
+
aiTemplates: Y,
|
|
2688
2688
|
onAiApplied: ke,
|
|
2689
|
-
aiSparkle:
|
|
2690
|
-
selectionToolbar:
|
|
2689
|
+
aiSparkle: ee = !0,
|
|
2690
|
+
selectionToolbar: _e,
|
|
2691
2691
|
variables: V,
|
|
2692
|
-
recentVariableTokens:
|
|
2692
|
+
recentVariableTokens: oe,
|
|
2693
2693
|
onVariableInserted: Z,
|
|
2694
2694
|
validateVariable: Ne,
|
|
2695
2695
|
onVariableValidityChange: kt,
|
|
@@ -2698,17 +2698,17 @@ const Ys = li(
|
|
|
2698
2698
|
aiCreditsNotice: Dt
|
|
2699
2699
|
}, W) => {
|
|
2700
2700
|
var Dr, Pr;
|
|
2701
|
-
const { t: A, i18n: Ee } =
|
|
2701
|
+
const { t: A, i18n: Ee } = se("ui"), ce = Ge(), ge = ht(
|
|
2702
2702
|
() => `rte-${ce.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
2703
2703
|
[ce]
|
|
2704
|
-
), $ = `#${ge}`,
|
|
2705
|
-
Pt.current =
|
|
2704
|
+
), $ = `#${ge}`, te = x(null), ie = x(null), Ie = x(null), hn = x(!1), Ct = x(b), Q = x(null), At = x(null), [he, er] = R(!1), [Nt, Fe] = R(!1), [xe, tr] = R(null), [pn, nr] = R(!1), [bn, vn] = R(!1), Tt = x(null), Pt = x(I);
|
|
2705
|
+
Pt.current = I;
|
|
2706
2706
|
const Ke = x(null), [vo, yo] = R(0), rr = x(!0), yn = w((e = !0) => {
|
|
2707
2707
|
rr.current = e, yo((n) => n + 1);
|
|
2708
2708
|
}, []), wn = w(() => {
|
|
2709
2709
|
var e, n;
|
|
2710
2710
|
(e = Tt.current) == null || e.abort(), Tt.current = null, (n = Ke.current) == null || n.call(Ke, { status: "aborted" }), tr(null), vn(!1), nr(!1);
|
|
2711
|
-
}, []),
|
|
2711
|
+
}, []), $e = w(
|
|
2712
2712
|
(e = !0) => {
|
|
2713
2713
|
wn(), yn(e);
|
|
2714
2714
|
},
|
|
@@ -2757,7 +2757,7 @@ const Ys = li(
|
|
|
2757
2757
|
H(() => {
|
|
2758
2758
|
We.current = kt;
|
|
2759
2759
|
}, [kt]);
|
|
2760
|
-
const
|
|
2760
|
+
const He = x(() => {
|
|
2761
2761
|
}), [Tn, No] = R(
|
|
2762
2762
|
() => /* @__PURE__ */ new Set()
|
|
2763
2763
|
), Bt = x(null), [To, Eo] = R(
|
|
@@ -2771,21 +2771,21 @@ const Ys = li(
|
|
|
2771
2771
|
const Ro = x(
|
|
2772
2772
|
(() => {
|
|
2773
2773
|
const e = u ?? a ?? "";
|
|
2774
|
-
return e ?
|
|
2774
|
+
return e ? Me(e) : "";
|
|
2775
2775
|
})()
|
|
2776
2776
|
), ue = w(() => {
|
|
2777
2777
|
var n;
|
|
2778
|
-
const e =
|
|
2778
|
+
const e = ie.current;
|
|
2779
2779
|
if (e)
|
|
2780
2780
|
try {
|
|
2781
2781
|
const o = e($, "source.getCode");
|
|
2782
2782
|
if (typeof o == "string") return Yr(o);
|
|
2783
2783
|
} catch {
|
|
2784
2784
|
}
|
|
2785
|
-
return ((n =
|
|
2785
|
+
return ((n = te.current) == null ? void 0 : n.value) ?? "";
|
|
2786
2786
|
}, [$]);
|
|
2787
2787
|
H(() => {
|
|
2788
|
-
|
|
2788
|
+
He.current = () => {
|
|
2789
2789
|
var o;
|
|
2790
2790
|
if (!it) {
|
|
2791
2791
|
ar((i) => i.length ? [] : i);
|
|
@@ -2812,10 +2812,10 @@ const Ys = li(
|
|
|
2812
2812
|
ar(
|
|
2813
2813
|
(i) => i.length === n.length && i.every((l, s) => l === n[s]) ? i : n
|
|
2814
2814
|
);
|
|
2815
|
-
},
|
|
2815
|
+
}, He.current();
|
|
2816
2816
|
}, [it, Nn, or, ue]), H(() => {
|
|
2817
2817
|
var o;
|
|
2818
|
-
const n = ((o = Q.current) == null ? void 0 : o.querySelector(".redactor-in")) ??
|
|
2818
|
+
const n = ((o = Q.current) == null ? void 0 : o.querySelector(".redactor-in")) ?? te.current;
|
|
2819
2819
|
n && (at.length > 0 ? (n.setAttribute("aria-invalid", "true"), n.setAttribute("aria-describedby", `${ge}-variables-error`)) : (n.removeAttribute("aria-invalid"), n.removeAttribute("aria-describedby")));
|
|
2820
2820
|
}, [at, ge, he]);
|
|
2821
2821
|
const En = x(!1);
|
|
@@ -2823,11 +2823,11 @@ const Ys = li(
|
|
|
2823
2823
|
var e, n;
|
|
2824
2824
|
it ? (En.current = !0, (e = We.current) == null || e.call(We, at)) : En.current && (En.current = !1, (n = We.current) == null || n.call(We, []));
|
|
2825
2825
|
}, [at, it]), H(() => {
|
|
2826
|
-
Ne &&
|
|
2826
|
+
Ne && He.current();
|
|
2827
2827
|
}, [Ne]);
|
|
2828
2828
|
const me = w(
|
|
2829
2829
|
(e, ...n) => {
|
|
2830
|
-
const o =
|
|
2830
|
+
const o = ie.current;
|
|
2831
2831
|
if (!o) return !1;
|
|
2832
2832
|
const i = Ct.current;
|
|
2833
2833
|
if (i)
|
|
@@ -2850,19 +2850,19 @@ const Ys = li(
|
|
|
2850
2850
|
[$]
|
|
2851
2851
|
), fe = w(
|
|
2852
2852
|
(e, n) => {
|
|
2853
|
-
var
|
|
2854
|
-
const o = (n == null ? void 0 : n.asHtml) ?? !0, i = o ?
|
|
2853
|
+
var q;
|
|
2854
|
+
const o = (n == null ? void 0 : n.asHtml) ?? !0, i = o ? Me(e) : e;
|
|
2855
2855
|
if (me(o ? "insertion.insertHtml" : "insertion.insertText", i)) return;
|
|
2856
|
-
const s =
|
|
2856
|
+
const s = te.current;
|
|
2857
2857
|
if (!s) return;
|
|
2858
2858
|
const d = s.selectionStart ?? s.value.length, T = s.selectionEnd ?? s.value.length;
|
|
2859
2859
|
s.value = s.value.slice(0, d) + i + s.value.slice(T);
|
|
2860
|
-
const
|
|
2860
|
+
const S = d + i.length;
|
|
2861
2861
|
try {
|
|
2862
|
-
s.setSelectionRange(
|
|
2862
|
+
s.setSelectionRange(S, S);
|
|
2863
2863
|
} catch {
|
|
2864
2864
|
}
|
|
2865
|
-
(
|
|
2865
|
+
(q = be.current) == null || q.call(be, { html: Me(s.value), markdown: "" });
|
|
2866
2866
|
},
|
|
2867
2867
|
[me]
|
|
2868
2868
|
), Ce = x(null), ve = w(() => {
|
|
@@ -2882,8 +2882,8 @@ const Ys = li(
|
|
|
2882
2882
|
"p, div, blockquote, pre, h1, h2, h3, h4, h5, h6, li, td, th"
|
|
2883
2883
|
);
|
|
2884
2884
|
if (d && e.contains(d) && d !== e) {
|
|
2885
|
-
const T = getComputedStyle(d),
|
|
2886
|
-
o.add(`align-${
|
|
2885
|
+
const T = getComputedStyle(d), S = T.direction === "rtl", q = T.textAlign.replace(/^-webkit-/, ""), ne = S ? "right" : "left", Re = S ? "left" : "right", J = ["left", "center", "right", "justify"].includes(q) ? q : q === "end" ? Re : ne;
|
|
2886
|
+
o.add(`align-${J}`);
|
|
2887
2887
|
}
|
|
2888
2888
|
} catch {
|
|
2889
2889
|
}
|
|
@@ -2917,8 +2917,8 @@ const Ys = li(
|
|
|
2917
2917
|
if (!e) return;
|
|
2918
2918
|
let n;
|
|
2919
2919
|
const o = (l) => {
|
|
2920
|
-
var
|
|
2921
|
-
const s = (
|
|
2920
|
+
var S;
|
|
2921
|
+
const s = (S = window.getSelection()) == null ? void 0 : S.anchorNode;
|
|
2922
2922
|
if (!s) return null;
|
|
2923
2923
|
const d = s.nodeType === Node.TEXT_NODE ? s.parentElement : s, T = (d == null ? void 0 : d.closest(Is)) ?? null;
|
|
2924
2924
|
return T && T !== l && l.contains(T) ? T : null;
|
|
@@ -2930,15 +2930,15 @@ const Ys = li(
|
|
|
2930
2930
|
return;
|
|
2931
2931
|
const d = o(s), T = d == null ? void 0 : d.style.textAlign;
|
|
2932
2932
|
if (!d || !T) return;
|
|
2933
|
-
const
|
|
2933
|
+
const S = d.tagName === "LI" ? d.style.listStylePosition : "";
|
|
2934
2934
|
clearTimeout(n), n = setTimeout(() => {
|
|
2935
|
-
const
|
|
2936
|
-
if (!
|
|
2937
|
-
|
|
2938
|
-
const
|
|
2939
|
-
if (
|
|
2935
|
+
const q = o(s);
|
|
2936
|
+
if (!q || q === d || q.style.textAlign) return;
|
|
2937
|
+
q.style.textAlign = T, S && q.tagName === "LI" && (q.style.listStylePosition = S);
|
|
2938
|
+
const ne = ie.current;
|
|
2939
|
+
if (ne)
|
|
2940
2940
|
try {
|
|
2941
|
-
|
|
2941
|
+
ne($, "broadcast", "hardsync");
|
|
2942
2942
|
} catch {
|
|
2943
2943
|
}
|
|
2944
2944
|
ve();
|
|
@@ -2953,14 +2953,14 @@ const Ys = li(
|
|
|
2953
2953
|
fe(e, { asHtml: !0 }), typeof window < "u" && window.requestAnimationFrame(() => ve());
|
|
2954
2954
|
},
|
|
2955
2955
|
[fe, ve]
|
|
2956
|
-
), [st, Rn] = R(null), Kt = x(null), Mn = `${ge}-variables`, sr = x(null), [Sn, Mo] = R(void 0),
|
|
2956
|
+
), [st, Rn] = R(null), Kt = x(null), Mn = `${ge}-variables`, sr = x(null), [Sn, Mo] = R(void 0), ze = w(() => {
|
|
2957
2957
|
Kt.current = null, Rn(null);
|
|
2958
2958
|
}, []), Vt = w(
|
|
2959
2959
|
(e, n) => {
|
|
2960
2960
|
const o = window.getSelection();
|
|
2961
2961
|
if (!o) return;
|
|
2962
2962
|
const i = document.createRange();
|
|
2963
|
-
i.setStart(n.node, n.start), i.setEnd(n.node, n.end), o.removeAllRanges(), o.addRange(i), Ue(ro(e)), window.requestAnimationFrame(() =>
|
|
2963
|
+
i.setStart(n.node, n.start), i.setEnd(n.node, n.end), o.removeAllRanges(), o.addRange(i), Ue(ro(e)), window.requestAnimationFrame(() => He.current());
|
|
2964
2964
|
},
|
|
2965
2965
|
[Ue]
|
|
2966
2966
|
);
|
|
@@ -2968,43 +2968,43 @@ const Ys = li(
|
|
|
2968
2968
|
const e = Q.current;
|
|
2969
2969
|
if (!e || !it) return;
|
|
2970
2970
|
const n = () => {
|
|
2971
|
-
var
|
|
2971
|
+
var qe;
|
|
2972
2972
|
const l = e.querySelector(".redactor-in"), s = window.getSelection();
|
|
2973
2973
|
if (!l || !s || s.rangeCount === 0 || !s.isCollapsed) {
|
|
2974
|
-
|
|
2974
|
+
ze();
|
|
2975
2975
|
return;
|
|
2976
2976
|
}
|
|
2977
2977
|
const { startContainer: d, startOffset: T } = s.getRangeAt(0);
|
|
2978
|
-
if (d.nodeType !== Node.TEXT_NODE || !l.contains(d) || (((
|
|
2978
|
+
if (d.nodeType !== Node.TEXT_NODE || !l.contains(d) || (((qe = d.parentElement) == null ? void 0 : qe.closest(
|
|
2979
2979
|
'[data-redactor-type="variable"]'
|
|
2980
2980
|
)) ?? null) !== null) {
|
|
2981
|
-
|
|
2981
|
+
ze();
|
|
2982
2982
|
return;
|
|
2983
2983
|
}
|
|
2984
|
-
const
|
|
2985
|
-
if (
|
|
2986
|
-
|
|
2987
|
-
pe.get(
|
|
2988
|
-
{ node:
|
|
2984
|
+
const S = d, q = S.data.slice(0, T), ne = /\[\[([A-Za-z0-9_]+)\]\]$/.exec(q);
|
|
2985
|
+
if (ne) {
|
|
2986
|
+
ze(), Vt(
|
|
2987
|
+
pe.get(ne[1].toLowerCase()) ?? ne[1],
|
|
2988
|
+
{ node: S, start: T - ne[0].length, end: T }
|
|
2989
2989
|
);
|
|
2990
2990
|
return;
|
|
2991
2991
|
}
|
|
2992
|
-
const
|
|
2993
|
-
if (!
|
|
2994
|
-
|
|
2992
|
+
const Re = /\[\[([A-Za-z0-9_ ]{0,40})$/.exec(q), J = At.current;
|
|
2993
|
+
if (!Re || !J || (V ?? []).length === 0) {
|
|
2994
|
+
ze();
|
|
2995
2995
|
return;
|
|
2996
2996
|
}
|
|
2997
|
-
const
|
|
2998
|
-
node:
|
|
2999
|
-
start: T -
|
|
2997
|
+
const Pe = {
|
|
2998
|
+
node: S,
|
|
2999
|
+
start: T - Re[0].length,
|
|
3000
3000
|
end: T
|
|
3001
3001
|
};
|
|
3002
|
-
Kt.current =
|
|
3002
|
+
Kt.current = Pe;
|
|
3003
3003
|
const gt = document.createRange();
|
|
3004
|
-
gt.setStart(
|
|
3005
|
-
const rt = gt.getBoundingClientRect(), It =
|
|
3004
|
+
gt.setStart(S, Pe.start), gt.setEnd(S, Pe.end);
|
|
3005
|
+
const rt = gt.getBoundingClientRect(), It = J.getBoundingClientRect(), Dn = getComputedStyle(J).direction === "rtl";
|
|
3006
3006
|
Rn({
|
|
3007
|
-
query:
|
|
3007
|
+
query: Re[1],
|
|
3008
3008
|
left: Dn ? It.right - rt.right : rt.left - It.left,
|
|
3009
3009
|
top: rt.bottom - It.top + 4
|
|
3010
3010
|
});
|
|
@@ -3015,7 +3015,7 @@ const Ys = li(
|
|
|
3015
3015
|
))
|
|
3016
3016
|
return;
|
|
3017
3017
|
(((d = sr.current) == null ? void 0 : d.handleKeyDown(l)) ?? !1) && (l.preventDefault(), l.stopImmediatePropagation());
|
|
3018
|
-
}, i = () =>
|
|
3018
|
+
}, i = () => ze();
|
|
3019
3019
|
return e.addEventListener("input", n), e.addEventListener("keydown", o, !0), e.addEventListener("focusout", i), () => {
|
|
3020
3020
|
e.removeEventListener("input", n), e.removeEventListener("keydown", o, !0), e.removeEventListener("focusout", i);
|
|
3021
3021
|
};
|
|
@@ -3024,7 +3024,7 @@ const Ys = li(
|
|
|
3024
3024
|
pe,
|
|
3025
3025
|
V,
|
|
3026
3026
|
Vt,
|
|
3027
|
-
|
|
3027
|
+
ze
|
|
3028
3028
|
]), H(() => {
|
|
3029
3029
|
var n;
|
|
3030
3030
|
const e = (n = Q.current) == null ? void 0 : n.querySelector(".redactor-in");
|
|
@@ -3033,12 +3033,12 @@ const Ys = li(
|
|
|
3033
3033
|
const So = w(
|
|
3034
3034
|
(e) => {
|
|
3035
3035
|
const n = Kt.current;
|
|
3036
|
-
|
|
3036
|
+
ze(), n && Vt(e.token, n), Z == null || Z(e.token);
|
|
3037
3037
|
},
|
|
3038
|
-
[
|
|
3038
|
+
[ze, Vt, Z]
|
|
3039
3039
|
), zo = w(() => {
|
|
3040
|
-
|
|
3041
|
-
}, [
|
|
3040
|
+
ze();
|
|
3041
|
+
}, [ze]), Lo = w((e) => {
|
|
3042
3042
|
Rn((n) => n && { ...n, query: e });
|
|
3043
3043
|
}, []), lt = w(() => {
|
|
3044
3044
|
var n;
|
|
@@ -3046,14 +3046,14 @@ const Ys = li(
|
|
|
3046
3046
|
const o = (n = Q.current) == null ? void 0 : n.querySelector(".redactor-in"), i = window.getSelection();
|
|
3047
3047
|
o && i && i.rangeCount > 0 && i.anchorNode && o.contains(i.anchorNode) && (Ce.current = i.getRangeAt(0).cloneRange());
|
|
3048
3048
|
}
|
|
3049
|
-
const e =
|
|
3049
|
+
const e = ie.current;
|
|
3050
3050
|
if (e)
|
|
3051
3051
|
try {
|
|
3052
3052
|
e($, "selection.save");
|
|
3053
3053
|
} catch {
|
|
3054
3054
|
}
|
|
3055
3055
|
}, [$]), we = w(() => {
|
|
3056
|
-
const e =
|
|
3056
|
+
const e = ie.current;
|
|
3057
3057
|
if (!e) return;
|
|
3058
3058
|
const n = Ce.current;
|
|
3059
3059
|
try {
|
|
@@ -3101,7 +3101,7 @@ const Ys = li(
|
|
|
3101
3101
|
if (!o) return;
|
|
3102
3102
|
const i = e === "row" ? Array.from(((s = o.closest("tr")) == null ? void 0 : s.children) ?? [o]).filter(
|
|
3103
3103
|
(d) => d instanceof HTMLElement && (d.tagName === "TD" || d.tagName === "TH")
|
|
3104
|
-
) : [o], l =
|
|
3104
|
+
) : [o], l = ie.current;
|
|
3105
3105
|
if (l)
|
|
3106
3106
|
try {
|
|
3107
3107
|
l($, "module.buffer.trigger");
|
|
@@ -3143,7 +3143,7 @@ const Ys = li(
|
|
|
3143
3143
|
if (!n) return;
|
|
3144
3144
|
const o = Wn.includes(
|
|
3145
3145
|
e
|
|
3146
|
-
) ? Wn : ho, i =
|
|
3146
|
+
) ? Wn : ho, i = ie.current;
|
|
3147
3147
|
if (i)
|
|
3148
3148
|
try {
|
|
3149
3149
|
i($, "module.buffer.trigger");
|
|
@@ -3162,7 +3162,7 @@ const Ys = li(
|
|
|
3162
3162
|
(e) => {
|
|
3163
3163
|
const n = Bt.current;
|
|
3164
3164
|
if (!n) return;
|
|
3165
|
-
const o =
|
|
3165
|
+
const o = ie.current;
|
|
3166
3166
|
if (o)
|
|
3167
3167
|
try {
|
|
3168
3168
|
o($, "module.buffer.trigger");
|
|
@@ -3179,7 +3179,7 @@ const Ys = li(
|
|
|
3179
3179
|
), Po = w(
|
|
3180
3180
|
(e) => {
|
|
3181
3181
|
var o;
|
|
3182
|
-
const n =
|
|
3182
|
+
const n = ie.current;
|
|
3183
3183
|
if (n && typeof window < "u") {
|
|
3184
3184
|
const i = (o = Q.current) == null ? void 0 : o.querySelector(".redactor-in"), l = window.getSelection(), s = l == null ? void 0 : l.anchorNode, d = s && s.nodeType === Node.TEXT_NODE ? s.parentElement : s, T = d && (i != null && i.contains(d)) ? d.closest("ul,ol") : null;
|
|
3185
3185
|
if (T)
|
|
@@ -3203,11 +3203,11 @@ const Ys = li(
|
|
|
3203
3203
|
[Ue, $]
|
|
3204
3204
|
), cr = w(
|
|
3205
3205
|
async (e, n) => {
|
|
3206
|
-
if (
|
|
3207
|
-
if (!
|
|
3206
|
+
if (_) return _(e, n);
|
|
3207
|
+
if (!z) throw new Error("No image upload URL configured.");
|
|
3208
3208
|
const o = new FormData();
|
|
3209
3209
|
o.append("file", e);
|
|
3210
|
-
const i = await fetch(
|
|
3210
|
+
const i = await fetch(z, {
|
|
3211
3211
|
method: "POST",
|
|
3212
3212
|
body: o,
|
|
3213
3213
|
credentials: "same-origin",
|
|
@@ -3218,10 +3218,10 @@ const Ys = li(
|
|
|
3218
3218
|
if (!l) throw new Error("Image upload response contained no URL.");
|
|
3219
3219
|
return l;
|
|
3220
3220
|
},
|
|
3221
|
-
[
|
|
3222
|
-
), Ze = pi({ enabled:
|
|
3221
|
+
[z, _]
|
|
3222
|
+
), Ze = pi({ enabled: ee }), {
|
|
3223
3223
|
start: ct,
|
|
3224
|
-
land:
|
|
3224
|
+
land: Oe,
|
|
3225
3225
|
reset: dt
|
|
3226
3226
|
} = Ze, Rt = x(null), ut = x(null), [ye, dr] = R(!1), [qo, ur] = R("listening"), [Bo, mr] = R(!1), [Fo, Mt] = R(""), mt = w(() => {
|
|
3227
3227
|
const e = ut.current;
|
|
@@ -3237,11 +3237,11 @@ const Ys = li(
|
|
|
3237
3237
|
o = document.createElement("span"), o.setAttribute("data-rte-interim", ""), o.setAttribute("contenteditable", "false");
|
|
3238
3238
|
const T = window.getSelection();
|
|
3239
3239
|
if (T && T.rangeCount > 0 && n.contains(T.anchorNode)) {
|
|
3240
|
-
const
|
|
3241
|
-
|
|
3240
|
+
const S = T.getRangeAt(0).cloneRange();
|
|
3241
|
+
S.collapse(!1), S.insertNode(o);
|
|
3242
3242
|
} else {
|
|
3243
|
-
const
|
|
3244
|
-
|
|
3243
|
+
const S = n.lastElementChild;
|
|
3244
|
+
S !== null && S.tagName === "P" && S === n.firstElementChild && (S.textContent ?? "").replace(/[\ufeff\s]/g, "") === "" && Array.from(S.children).every((ne) => ne.tagName === "BR") ? ((d = S.lastChild) == null ? void 0 : d.nodeName) === "BR" ? S.insertBefore(o, S.lastChild) : S.appendChild(o) : n.appendChild(o);
|
|
3245
3245
|
}
|
|
3246
3246
|
ut.current = o;
|
|
3247
3247
|
}
|
|
@@ -3273,14 +3273,14 @@ const Ys = li(
|
|
|
3273
3273
|
const l = o.data.charAt(i - 1);
|
|
3274
3274
|
return /\S/.test(l) && l !== " ";
|
|
3275
3275
|
}, []), Ae = k !== void 0 && !k.granted, Qt = x(null), Jt = w(() => {
|
|
3276
|
-
if (!
|
|
3276
|
+
if (!F || Ae) return;
|
|
3277
3277
|
const e = new AbortController();
|
|
3278
3278
|
Rt.current = e;
|
|
3279
3279
|
const n = { keepLate: !1 };
|
|
3280
3280
|
Ut.current = n;
|
|
3281
3281
|
let o = !1;
|
|
3282
3282
|
const i = () => !o && (!e.signal.aborted || n.keepLate);
|
|
3283
|
-
mr(!1), dr(!0), ur("listening"), Mt(A("editor.ai.listening")),
|
|
3283
|
+
mr(!1), dr(!0), ur("listening"), Mt(A("editor.ai.listening")), ee && ct(), mt();
|
|
3284
3284
|
const l = (s) => {
|
|
3285
3285
|
if (Qt.current) {
|
|
3286
3286
|
ft.current = "";
|
|
@@ -3288,7 +3288,7 @@ const Ys = li(
|
|
|
3288
3288
|
}
|
|
3289
3289
|
fr(s);
|
|
3290
3290
|
};
|
|
3291
|
-
l(A("editor.ai.listening")),
|
|
3291
|
+
l(A("editor.ai.listening")), F({
|
|
3292
3292
|
signal: e.signal,
|
|
3293
3293
|
onStatus: (s) => {
|
|
3294
3294
|
if (!i()) return;
|
|
@@ -3307,27 +3307,35 @@ const Ys = li(
|
|
|
3307
3307
|
if (d) {
|
|
3308
3308
|
const T = Qt.current;
|
|
3309
3309
|
if (T) {
|
|
3310
|
-
Qt.current = null, Ce.current = T, we(), fe(`${d} `, { asHtml: !1 }),
|
|
3310
|
+
Qt.current = null, Ce.current = T, we(), fe(`${d} `, { asHtml: !1 }), ee && Oe(), Mt(d);
|
|
3311
3311
|
return;
|
|
3312
3312
|
}
|
|
3313
|
-
|
|
3314
|
-
|
|
3313
|
+
if (gr()) {
|
|
3314
|
+
const S = window.getSelection(), q = S == null ? void 0 : S.getRangeAt(0);
|
|
3315
|
+
if (S && q) {
|
|
3316
|
+
const ne = q.startContainer, Re = q.startOffset;
|
|
3317
|
+
ne.insertData(Re, " ");
|
|
3318
|
+
const J = document.createRange();
|
|
3319
|
+
J.setStart(ne, Re + 1), J.collapse(!0), S.removeAllRanges(), S.addRange(J);
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
fe(`${d} `, { asHtml: !1 }), ee && Oe(), Mt(d);
|
|
3315
3323
|
}
|
|
3316
3324
|
}
|
|
3317
3325
|
}).catch((s) => {
|
|
3318
3326
|
var d;
|
|
3319
3327
|
if (!(e.signal.aborted || s && typeof s == "object" && "name" in s && s.name === "AbortError")) {
|
|
3320
3328
|
if (eo(s) && ((d = Ve.current) == null || d.call(Ve), xn.current)) {
|
|
3321
|
-
kn(!0),
|
|
3329
|
+
kn(!0), Fe(!0);
|
|
3322
3330
|
return;
|
|
3323
3331
|
}
|
|
3324
3332
|
mr(!0);
|
|
3325
3333
|
}
|
|
3326
3334
|
}).finally(() => {
|
|
3327
|
-
o = !0, ft.current = "", mt(), Rt.current === e && (Rt.current = null, Ut.current = null, dr(!1), Mt(""),
|
|
3335
|
+
o = !0, ft.current = "", mt(), Rt.current === e && (Rt.current = null, Ut.current = null, dr(!1), Mt(""), ee && !De.current && dt());
|
|
3328
3336
|
});
|
|
3329
3337
|
}, [
|
|
3330
|
-
|
|
3338
|
+
F,
|
|
3331
3339
|
Ae,
|
|
3332
3340
|
fe,
|
|
3333
3341
|
we,
|
|
@@ -3335,9 +3343,9 @@ const Ys = li(
|
|
|
3335
3343
|
Xt,
|
|
3336
3344
|
fr,
|
|
3337
3345
|
gr,
|
|
3338
|
-
|
|
3346
|
+
ee,
|
|
3339
3347
|
ct,
|
|
3340
|
-
|
|
3348
|
+
Oe,
|
|
3341
3349
|
dt,
|
|
3342
3350
|
A
|
|
3343
3351
|
]);
|
|
@@ -3361,10 +3369,10 @@ const Ys = li(
|
|
|
3361
3369
|
Qe.current = null, tn.current = !1, St(null);
|
|
3362
3370
|
const i = en.current;
|
|
3363
3371
|
if (en.current = null, !o) return;
|
|
3364
|
-
n === "write" ?
|
|
3372
|
+
n === "write" ? Fe(!0) : n === "action" ? i == null || i() : (we(), Jt());
|
|
3365
3373
|
}
|
|
3366
3374
|
}, [k == null ? void 0 : k.granted, we, Jt]), H(() => {
|
|
3367
|
-
Ae && (
|
|
3375
|
+
Ae && (Fe(!1), ye && Zt());
|
|
3368
3376
|
}, [Ae, ye, Zt]);
|
|
3369
3377
|
const br = w(
|
|
3370
3378
|
(e = "document") => {
|
|
@@ -3389,28 +3397,28 @@ const Ys = li(
|
|
|
3389
3397
|
Qe.current = "write", St("write");
|
|
3390
3398
|
return;
|
|
3391
3399
|
}
|
|
3392
|
-
|
|
3400
|
+
Fe(!0);
|
|
3393
3401
|
},
|
|
3394
3402
|
[lt, Ae]
|
|
3395
|
-
), yr = ht(() => k != null && k.granted ? /* @__PURE__ */ N(
|
|
3403
|
+
), yr = ht(() => k != null && k.granted ? /* @__PURE__ */ N(Be, { children: [
|
|
3396
3404
|
A(
|
|
3397
3405
|
"editor.ai.consentRecorded",
|
|
3398
3406
|
"AI assistance consent has been recorded."
|
|
3399
3407
|
),
|
|
3400
|
-
|
|
3408
|
+
B ? /* @__PURE__ */ N(Be, { children: [
|
|
3401
3409
|
" ",
|
|
3402
|
-
|
|
3410
|
+
B
|
|
3403
3411
|
] }) : null
|
|
3404
|
-
] }) :
|
|
3412
|
+
] }) : B, [k, B, A]), [Je, Ln] = R(null), [Vo, nn] = R(!1), [wr, kr] = R(!1), [Wo, Ye] = R(""), xr = x(null), De = x(null), rn = x(ke);
|
|
3405
3413
|
H(() => {
|
|
3406
3414
|
rn.current = ke;
|
|
3407
3415
|
}, [ke]), H(() => {
|
|
3408
|
-
|
|
3409
|
-
}, [
|
|
3416
|
+
ee && (!ye && Je === null || Ze.state === null && ct());
|
|
3417
|
+
}, [ee, ye, Je, Ze.state, ct]);
|
|
3410
3418
|
const zt = (e) => e.preventDefault(), Cr = w(
|
|
3411
3419
|
(e) => {
|
|
3412
3420
|
var o;
|
|
3413
|
-
const n =
|
|
3421
|
+
const n = ie.current;
|
|
3414
3422
|
if (n)
|
|
3415
3423
|
try {
|
|
3416
3424
|
const i = n($);
|
|
@@ -3421,7 +3429,7 @@ const Ys = li(
|
|
|
3421
3429
|
[$]
|
|
3422
3430
|
), Ar = x(!1), et = w(
|
|
3423
3431
|
(e) => {
|
|
3424
|
-
const n =
|
|
3432
|
+
const n = ie.current;
|
|
3425
3433
|
if (!n || Ar.current === e) return;
|
|
3426
3434
|
Ar.current = e;
|
|
3427
3435
|
const o = e || b;
|
|
@@ -3436,10 +3444,10 @@ const Ys = li(
|
|
|
3436
3444
|
(e) => {
|
|
3437
3445
|
var o;
|
|
3438
3446
|
const n = vt(
|
|
3439
|
-
|
|
3447
|
+
Me(e),
|
|
3440
3448
|
ot.current
|
|
3441
3449
|
);
|
|
3442
|
-
!me("source.setCode", n) &&
|
|
3450
|
+
!me("source.setCode", n) && te.current && (te.current.value = n), (o = be.current) == null || o.call(be, { html: n, markdown: "" });
|
|
3443
3451
|
},
|
|
3444
3452
|
[me]
|
|
3445
3453
|
), tt = w(
|
|
@@ -3465,9 +3473,9 @@ const Ys = li(
|
|
|
3465
3473
|
[ue]
|
|
3466
3474
|
), In = w(
|
|
3467
3475
|
(e, n, o, i) => {
|
|
3468
|
-
if (
|
|
3476
|
+
if (De.current || !o.text.trim()) return;
|
|
3469
3477
|
const l = new AbortController();
|
|
3470
|
-
|
|
3478
|
+
De.current = l, Ln(e), kr(!1), xr.current = e, Ye(A("editor.ai.generating")), nn(!1), ee && ct();
|
|
3471
3479
|
const s = ue();
|
|
3472
3480
|
et(!0), Promise.resolve(
|
|
3473
3481
|
n({
|
|
@@ -3477,7 +3485,7 @@ const Ys = li(
|
|
|
3477
3485
|
signal: l.signal
|
|
3478
3486
|
})
|
|
3479
3487
|
).then((d) => {
|
|
3480
|
-
var
|
|
3488
|
+
var S;
|
|
3481
3489
|
if (l.signal.aborted) return;
|
|
3482
3490
|
et(!1);
|
|
3483
3491
|
const T = String(d ?? "");
|
|
@@ -3495,14 +3503,14 @@ const Ys = li(
|
|
|
3495
3503
|
return;
|
|
3496
3504
|
}
|
|
3497
3505
|
Ce.current = o.range, we();
|
|
3498
|
-
const
|
|
3499
|
-
|
|
3506
|
+
const q = vt(
|
|
3507
|
+
Me(T),
|
|
3500
3508
|
ot.current
|
|
3501
3509
|
);
|
|
3502
|
-
me("insertion.insertHtml",
|
|
3510
|
+
me("insertion.insertHtml", q) || fe(T, { asHtml: !0 });
|
|
3503
3511
|
} else
|
|
3504
3512
|
_n(T);
|
|
3505
|
-
|
|
3513
|
+
ee && Oe(), Ye(A("editor.ai.actionDone")), (S = rn.current) == null || S.call(rn, {
|
|
3506
3514
|
action: e,
|
|
3507
3515
|
template: i,
|
|
3508
3516
|
scope: o.scope,
|
|
@@ -3513,19 +3521,19 @@ const Ys = li(
|
|
|
3513
3521
|
var T;
|
|
3514
3522
|
if (et(!1), !(l.signal.aborted || Ds(d))) {
|
|
3515
3523
|
if (eo(d) && ((T = Ve.current) == null || T.call(Ve), xn.current)) {
|
|
3516
|
-
kn(!0),
|
|
3524
|
+
kn(!0), Fe(!0);
|
|
3517
3525
|
return;
|
|
3518
3526
|
}
|
|
3519
3527
|
nn(!0), Ye("");
|
|
3520
3528
|
}
|
|
3521
3529
|
}).finally(() => {
|
|
3522
|
-
|
|
3530
|
+
De.current === l && (De.current = null, et(!1), Ln(null), dt());
|
|
3523
3531
|
});
|
|
3524
3532
|
},
|
|
3525
3533
|
[
|
|
3526
|
-
|
|
3534
|
+
ee,
|
|
3527
3535
|
ct,
|
|
3528
|
-
|
|
3536
|
+
Oe,
|
|
3529
3537
|
dt,
|
|
3530
3538
|
et,
|
|
3531
3539
|
ue,
|
|
@@ -3547,7 +3555,7 @@ const Ys = li(
|
|
|
3547
3555
|
[Ae, In]
|
|
3548
3556
|
), Nr = w(
|
|
3549
3557
|
(e, n) => {
|
|
3550
|
-
const o =
|
|
3558
|
+
const o = Y == null ? void 0 : Y.onRun;
|
|
3551
3559
|
o && Lt(
|
|
3552
3560
|
"template",
|
|
3553
3561
|
(i) => o({ ...i, template: e }),
|
|
@@ -3555,10 +3563,10 @@ const Ys = li(
|
|
|
3555
3563
|
e
|
|
3556
3564
|
);
|
|
3557
3565
|
},
|
|
3558
|
-
[
|
|
3566
|
+
[Y, Lt]
|
|
3559
3567
|
), Tr = w(() => {
|
|
3560
3568
|
var e;
|
|
3561
|
-
(e =
|
|
3569
|
+
(e = De.current) == null || e.abort(), De.current = null, et(!1), Ln(null), Ye(""), dt();
|
|
3562
3570
|
}, [et, dt]), Er = x(null);
|
|
3563
3571
|
H(() => {
|
|
3564
3572
|
const e = Je ?? xr.current;
|
|
@@ -3571,22 +3579,22 @@ const Ys = li(
|
|
|
3571
3579
|
return () => cancelAnimationFrame(o);
|
|
3572
3580
|
}, [Je]), H(() => () => {
|
|
3573
3581
|
var e;
|
|
3574
|
-
return (e =
|
|
3582
|
+
return (e = De.current) == null ? void 0 : e.abort();
|
|
3575
3583
|
}, []), H(() => {
|
|
3576
|
-
const e =
|
|
3584
|
+
const e = te.current;
|
|
3577
3585
|
if (!e) return;
|
|
3578
|
-
e.value = Ro.current,
|
|
3586
|
+
e.value = Ro.current, He.current();
|
|
3579
3587
|
const n = js(P);
|
|
3580
3588
|
if (!n) {
|
|
3581
3589
|
er(!0);
|
|
3582
3590
|
return;
|
|
3583
3591
|
}
|
|
3584
|
-
if (
|
|
3592
|
+
if (ie.current = n, e.value = vt(e.value, ot.current), v === void 0 && (g == null ? void 0 : g.lang) === void 0 && n.addLang && n.lang) {
|
|
3585
3593
|
const d = `alfadocs-${ge}`;
|
|
3586
|
-
n.addLang(d, jr(A)),
|
|
3594
|
+
n.addLang(d, jr(A)), Ie.current = d;
|
|
3587
3595
|
}
|
|
3588
3596
|
const o = {
|
|
3589
|
-
lang:
|
|
3597
|
+
lang: Ie.current ?? v ?? Vs(Ee.language || "en"),
|
|
3590
3598
|
// The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
|
|
3591
3599
|
// via the command API, so Redactor's native toolbar is suppressed.
|
|
3592
3600
|
toolbar: !1,
|
|
@@ -3601,7 +3609,7 @@ const Ys = li(
|
|
|
3601
3609
|
// second, untokenised, mouse-only UI competing with ours.
|
|
3602
3610
|
imageEditable: !1,
|
|
3603
3611
|
imageResizable: !1
|
|
3604
|
-
}, i =
|
|
3612
|
+
}, i = z ? { imageUpload: z } : {}, l = (g == null ? void 0 : g.callbacks) ?? {}, s = {
|
|
3605
3613
|
...o,
|
|
3606
3614
|
...i,
|
|
3607
3615
|
...g ?? {},
|
|
@@ -3613,17 +3621,17 @@ const Ys = li(
|
|
|
3613
3621
|
callbacks: {
|
|
3614
3622
|
...l,
|
|
3615
3623
|
changed(d) {
|
|
3616
|
-
|
|
3624
|
+
He.current();
|
|
3617
3625
|
const T = dn(
|
|
3618
3626
|
Jr(Yr(d))
|
|
3619
|
-
),
|
|
3620
|
-
if (
|
|
3621
|
-
jt.current =
|
|
3627
|
+
), S = Me(T), q = Mr.current;
|
|
3628
|
+
if (q && Date.now() < q.until && no(S) === q.text) {
|
|
3629
|
+
jt.current = S;
|
|
3622
3630
|
return;
|
|
3623
3631
|
}
|
|
3624
|
-
|
|
3625
|
-
var
|
|
3626
|
-
(
|
|
3632
|
+
S !== jt.current && (jt.current = S, hn.current = !0, be.current && (Et.current && clearTimeout(Et.current), Et.current = setTimeout(() => {
|
|
3633
|
+
var ne;
|
|
3634
|
+
(ne = be.current) == null || ne.call(be, { html: S, markdown: "" });
|
|
3627
3635
|
}, 100)));
|
|
3628
3636
|
},
|
|
3629
3637
|
keydown(d) {
|
|
@@ -3636,15 +3644,15 @@ const Ys = li(
|
|
|
3636
3644
|
}
|
|
3637
3645
|
};
|
|
3638
3646
|
try {
|
|
3639
|
-
if (n($, s), jt.current =
|
|
3647
|
+
if (n($, s), jt.current = Me(
|
|
3640
3648
|
dn(Jr(ue()))
|
|
3641
|
-
),
|
|
3649
|
+
), He.current(), b)
|
|
3642
3650
|
try {
|
|
3643
3651
|
n($, "enableReadOnly");
|
|
3644
3652
|
} catch {
|
|
3645
3653
|
}
|
|
3646
3654
|
} catch {
|
|
3647
|
-
|
|
3655
|
+
Ie.current && n.lang && delete n.lang[Ie.current], Ie.current = null, ie.current = null, er(!0);
|
|
3648
3656
|
}
|
|
3649
3657
|
return () => {
|
|
3650
3658
|
Et.current && clearTimeout(Et.current);
|
|
@@ -3652,10 +3660,10 @@ const Ys = li(
|
|
|
3652
3660
|
n($, "destroy");
|
|
3653
3661
|
} catch {
|
|
3654
3662
|
}
|
|
3655
|
-
|
|
3663
|
+
Ie.current && n.lang && delete n.lang[Ie.current], Ie.current = null, ie.current = null;
|
|
3656
3664
|
};
|
|
3657
3665
|
}, []), H(() => {
|
|
3658
|
-
const e =
|
|
3666
|
+
const e = ie.current, n = Ie.current;
|
|
3659
3667
|
if (!(!(e != null && e.addLang) || !n)) {
|
|
3660
3668
|
e.addLang(n, jr(A));
|
|
3661
3669
|
try {
|
|
@@ -3669,7 +3677,7 @@ const Ys = li(
|
|
|
3669
3677
|
);
|
|
3670
3678
|
H(() => {
|
|
3671
3679
|
var o, i;
|
|
3672
|
-
if (Rr.current === pe || (Rr.current = pe, !
|
|
3680
|
+
if (Rr.current === pe || (Rr.current = pe, !ie.current || pe.size === 0)) return;
|
|
3673
3681
|
const e = ue(), n = vt(e, pe);
|
|
3674
3682
|
if (n !== e) {
|
|
3675
3683
|
const l = (o = Q.current) == null ? void 0 : o.querySelector(".redactor-in"), d = l != null && l.contains(document.activeElement) && l ? qs(l) : null;
|
|
@@ -3680,21 +3688,21 @@ const Ys = li(
|
|
|
3680
3688
|
const T = (i = Q.current) == null ? void 0 : i.querySelector(".redactor-in");
|
|
3681
3689
|
d !== null && T && Bs(T, d);
|
|
3682
3690
|
}
|
|
3683
|
-
window.requestAnimationFrame(() =>
|
|
3691
|
+
window.requestAnimationFrame(() => He.current());
|
|
3684
3692
|
}, [pe, ue, me]), H(() => {
|
|
3685
|
-
if (!
|
|
3693
|
+
if (!ie.current || u === void 0) return;
|
|
3686
3694
|
if (hn.current) {
|
|
3687
3695
|
hn.current = !1;
|
|
3688
3696
|
return;
|
|
3689
3697
|
}
|
|
3690
3698
|
const e = vt(
|
|
3691
|
-
|
|
3699
|
+
Me(dn(u)),
|
|
3692
3700
|
ot.current
|
|
3693
3701
|
);
|
|
3694
3702
|
dn(ue()) !== e && me("source.setCode", e);
|
|
3695
3703
|
}, [u, ue, me]), H(() => {
|
|
3696
3704
|
Ct.current = b;
|
|
3697
|
-
const e =
|
|
3705
|
+
const e = ie.current;
|
|
3698
3706
|
if (e)
|
|
3699
3707
|
try {
|
|
3700
3708
|
e($, b ? "enableReadOnly" : "disableReadOnly");
|
|
@@ -3702,12 +3710,12 @@ const Ys = li(
|
|
|
3702
3710
|
}
|
|
3703
3711
|
}, [b, $]), H(() => {
|
|
3704
3712
|
if (!he || u === void 0) return;
|
|
3705
|
-
const e =
|
|
3713
|
+
const e = te.current;
|
|
3706
3714
|
if (!e) return;
|
|
3707
|
-
const n =
|
|
3715
|
+
const n = Me(u);
|
|
3708
3716
|
e.value !== n && document.activeElement !== e && (e.value = n);
|
|
3709
3717
|
}, [he, u]);
|
|
3710
|
-
const
|
|
3718
|
+
const je = ht(
|
|
3711
3719
|
() => ({
|
|
3712
3720
|
getHTML() {
|
|
3713
3721
|
return ue();
|
|
@@ -3719,14 +3727,14 @@ const Ys = li(
|
|
|
3719
3727
|
return "";
|
|
3720
3728
|
},
|
|
3721
3729
|
isAiBusy() {
|
|
3722
|
-
return
|
|
3730
|
+
return De.current !== null;
|
|
3723
3731
|
},
|
|
3724
3732
|
setContent(e) {
|
|
3725
|
-
const n =
|
|
3733
|
+
const n = Me(e);
|
|
3726
3734
|
me(
|
|
3727
3735
|
"source.setCode",
|
|
3728
3736
|
vt(n, ot.current)
|
|
3729
|
-
) ||
|
|
3737
|
+
) || te.current && (te.current.value = n);
|
|
3730
3738
|
},
|
|
3731
3739
|
insertAtCursor: fe,
|
|
3732
3740
|
applyFormat(e) {
|
|
@@ -3735,27 +3743,27 @@ const Ys = li(
|
|
|
3735
3743
|
},
|
|
3736
3744
|
focus() {
|
|
3737
3745
|
var n;
|
|
3738
|
-
const e =
|
|
3746
|
+
const e = ie.current;
|
|
3739
3747
|
if (e)
|
|
3740
3748
|
try {
|
|
3741
3749
|
e($, "editor.focus");
|
|
3742
3750
|
return;
|
|
3743
3751
|
} catch {
|
|
3744
3752
|
}
|
|
3745
|
-
(n =
|
|
3753
|
+
(n = te.current) == null || n.focus();
|
|
3746
3754
|
},
|
|
3747
3755
|
clear() {
|
|
3748
|
-
me("source.setCode", "") ||
|
|
3756
|
+
me("source.setCode", "") || te.current && (te.current.value = "");
|
|
3749
3757
|
}
|
|
3750
3758
|
}),
|
|
3751
3759
|
[$, ue, me, fe, Xe]
|
|
3752
3760
|
);
|
|
3753
|
-
ci(W, () =>
|
|
3761
|
+
ci(W, () => je, [je]), hi(Ua, je, r);
|
|
3754
3762
|
const Xo = w(
|
|
3755
3763
|
(e) => {
|
|
3756
3764
|
var n;
|
|
3757
|
-
|
|
3758
|
-
html:
|
|
3765
|
+
He.current(), (n = be.current) == null || n.call(be, {
|
|
3766
|
+
html: Me(e.target.value),
|
|
3759
3767
|
markdown: ""
|
|
3760
3768
|
});
|
|
3761
3769
|
},
|
|
@@ -3812,8 +3820,8 @@ const Ys = li(
|
|
|
3812
3820
|
onClick: o ? Tr : () => Lt(e, n, tt("document")),
|
|
3813
3821
|
running: o
|
|
3814
3822
|
};
|
|
3815
|
-
},
|
|
3816
|
-
if (
|
|
3823
|
+
}, Le = Hi(Dt), On = ye && qo === "connecting", nt = [];
|
|
3824
|
+
if (F && nt.push({
|
|
3817
3825
|
key: "dictate",
|
|
3818
3826
|
// Connecting: a spinner, not yet the red recording look, so the
|
|
3819
3827
|
// red means "speak now". Pressing it still stops the session.
|
|
@@ -3829,7 +3837,7 @@ const Ys = li(
|
|
|
3829
3837
|
recording: ye && !On,
|
|
3830
3838
|
// On from the first press, though not red until it listens.
|
|
3831
3839
|
pressed: ye
|
|
3832
|
-
}),
|
|
3840
|
+
}), Y) {
|
|
3833
3841
|
const e = Je === "template";
|
|
3834
3842
|
nt.push({
|
|
3835
3843
|
key: "templates",
|
|
@@ -3842,20 +3850,20 @@ const Ys = li(
|
|
|
3842
3850
|
}
|
|
3843
3851
|
const zr = Sr("proofread", U);
|
|
3844
3852
|
zr && nt.push(zr);
|
|
3845
|
-
const Lr = Sr("format",
|
|
3853
|
+
const Lr = Sr("format", re);
|
|
3846
3854
|
Lr && nt.push(Lr), (K || Te) && nt.push({
|
|
3847
3855
|
key: "write",
|
|
3848
3856
|
icon: /* @__PURE__ */ t(qr, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
3849
3857
|
label: A("editor.ai.helpMeWrite"),
|
|
3850
3858
|
onClick: () => vr("document")
|
|
3851
3859
|
});
|
|
3852
|
-
const _r = (e, n) =>
|
|
3860
|
+
const _r = (e, n) => Y ? /* @__PURE__ */ t(
|
|
3853
3861
|
Ms,
|
|
3854
3862
|
{
|
|
3855
3863
|
side: n === "document" ? "top" : "bottom",
|
|
3856
|
-
templates:
|
|
3864
|
+
templates: Y.templates,
|
|
3857
3865
|
onPick: ti,
|
|
3858
|
-
onManage:
|
|
3866
|
+
onManage: Y.onManage,
|
|
3859
3867
|
noteEmpty: Zo,
|
|
3860
3868
|
onOpenChange: (o) => ei(o, n),
|
|
3861
3869
|
trigger: e
|
|
@@ -3864,69 +3872,69 @@ const Ys = li(
|
|
|
3864
3872
|
(e) => !e.contexts || M !== void 0 && e.contexts.includes(M)
|
|
3865
3873
|
);
|
|
3866
3874
|
H(() => {
|
|
3867
|
-
(Nt || Yt !== null || b) &&
|
|
3868
|
-
}, [Nt, Yt, b,
|
|
3875
|
+
(Nt || Yt !== null || b) && $e(!1);
|
|
3876
|
+
}, [Nt, Yt, b, $e]), H(() => {
|
|
3869
3877
|
xe && !(C ?? []).some(
|
|
3870
3878
|
(e) => e.id === xe.extension.id && (!e.contexts || M !== void 0 && e.contexts.includes(M))
|
|
3871
|
-
) &&
|
|
3872
|
-
}, [C, M, xe,
|
|
3879
|
+
) && $e();
|
|
3880
|
+
}, [C, M, xe, $e]);
|
|
3873
3881
|
const ni = (e) => {
|
|
3874
|
-
var
|
|
3882
|
+
var ne, Re;
|
|
3875
3883
|
if (bn) return;
|
|
3876
|
-
wn(),
|
|
3884
|
+
wn(), Fe(!1), zn();
|
|
3877
3885
|
const n = new AbortController();
|
|
3878
3886
|
Tt.current = n;
|
|
3879
|
-
const o = (
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
] : null, l = (o == null ? void 0 : o.toString()) ?? (i ? (((
|
|
3887
|
+
const o = (ne = Ce.current) == null ? void 0 : ne.cloneRange(), i = te.current ? [
|
|
3888
|
+
te.current.selectionStart,
|
|
3889
|
+
te.current.selectionEnd
|
|
3890
|
+
] : null, l = (o == null ? void 0 : o.toString()) ?? (i ? (((Re = te.current) == null ? void 0 : Re.value) ?? "").slice(...i) : "");
|
|
3883
3891
|
let s = !1;
|
|
3884
|
-
const d = (
|
|
3885
|
-
var
|
|
3886
|
-
s || (s = !0, (
|
|
3892
|
+
const d = (J) => {
|
|
3893
|
+
var Pe;
|
|
3894
|
+
s || (s = !0, (Pe = Pt.current) == null || Pe.call(Pt, e.id, J));
|
|
3887
3895
|
};
|
|
3888
3896
|
Ke.current = d;
|
|
3889
3897
|
const T = () => {
|
|
3890
3898
|
n.signal.aborted || (d({ status: "error" }), n.abort(), vn(!1), nr(!0), yn());
|
|
3891
|
-
},
|
|
3899
|
+
}, S = async (J) => {
|
|
3892
3900
|
var gt;
|
|
3893
3901
|
if (n.signal.aborted) return;
|
|
3894
|
-
let
|
|
3895
|
-
if (
|
|
3896
|
-
const rt = await
|
|
3902
|
+
let Pe = J.mode === "image" ? "" : J.html;
|
|
3903
|
+
if (J.mode !== "text") {
|
|
3904
|
+
const rt = await J.pngDataUri();
|
|
3897
3905
|
if (n.signal.aborted) return;
|
|
3898
3906
|
const It = await (await fetch(rt.dataUri, { signal: n.signal })).blob(), Dn = await cr(
|
|
3899
3907
|
new File([It], "extension-result.png", { type: "image/png" }),
|
|
3900
3908
|
n.signal
|
|
3901
3909
|
);
|
|
3902
3910
|
if (n.signal.aborted) return;
|
|
3903
|
-
const
|
|
3904
|
-
|
|
3911
|
+
const qe = document.createElement("img");
|
|
3912
|
+
qe.src = Dn, qe.alt = J.text, qe.width = rt.width, qe.height = rt.height, qe.loading = "lazy", Pe += qe.outerHTML;
|
|
3905
3913
|
}
|
|
3906
|
-
n.signal.aborted || (o && (Ce.current = o.cloneRange()), i && ((gt =
|
|
3907
|
-
},
|
|
3908
|
-
html:
|
|
3909
|
-
text:
|
|
3914
|
+
n.signal.aborted || (o && (Ce.current = o.cloneRange()), i && ((gt = te.current) == null || gt.setSelectionRange(...i)), we(), fe(Pe, { asHtml: !0 }), d({ status: "success" }), $e());
|
|
3915
|
+
}, q = {
|
|
3916
|
+
html: je.getHTML(),
|
|
3917
|
+
text: je.getText(),
|
|
3910
3918
|
selectionText: l,
|
|
3911
3919
|
scope: l ? "selection" : "document",
|
|
3912
3920
|
signal: n.signal,
|
|
3913
3921
|
close: () => {
|
|
3914
|
-
Tt.current === n &&
|
|
3922
|
+
Tt.current === n && $e();
|
|
3915
3923
|
},
|
|
3916
|
-
insert: async (
|
|
3924
|
+
insert: async (J) => {
|
|
3917
3925
|
try {
|
|
3918
|
-
await
|
|
3926
|
+
await S(J);
|
|
3919
3927
|
} catch {
|
|
3920
3928
|
T();
|
|
3921
3929
|
}
|
|
3922
3930
|
}
|
|
3923
3931
|
};
|
|
3924
|
-
tr({ extension: e, context:
|
|
3932
|
+
tr({ extension: e, context: q }), e.kind === "action" && (vn(!0), (async () => {
|
|
3925
3933
|
try {
|
|
3926
3934
|
if (!e.run) throw new Error("Missing extension run");
|
|
3927
|
-
const
|
|
3935
|
+
const J = await e.run(q);
|
|
3928
3936
|
if (n.signal.aborted) return;
|
|
3929
|
-
|
|
3937
|
+
J ? await S(J) : (d({ status: "success" }), $e());
|
|
3930
3938
|
} catch {
|
|
3931
3939
|
T();
|
|
3932
3940
|
}
|
|
@@ -3949,12 +3957,12 @@ const Ys = li(
|
|
|
3949
3957
|
extensionSession: xe,
|
|
3950
3958
|
extensionError: pn,
|
|
3951
3959
|
openExtension: ni,
|
|
3952
|
-
closeExtension:
|
|
3960
|
+
closeExtension: $e,
|
|
3953
3961
|
saveSelection: lt,
|
|
3954
3962
|
closeSignal: vo,
|
|
3955
3963
|
restoreFocusOnCloseRef: rr
|
|
3956
3964
|
}
|
|
3957
|
-
) : void 0, Hr = !!(K || Te), Or = !!(
|
|
3965
|
+
) : void 0, Hr = !!(K || Te), Or = !!(Y || U || re || Hr || F), ii = !he && !b && (_e ?? Or), ai = w(
|
|
3958
3966
|
() => {
|
|
3959
3967
|
var e;
|
|
3960
3968
|
return ((e = Q.current) == null ? void 0 : e.querySelector(".redactor-in")) ?? null;
|
|
@@ -3965,7 +3973,7 @@ const Ys = li(
|
|
|
3965
3973
|
"div",
|
|
3966
3974
|
{
|
|
3967
3975
|
ref: Q,
|
|
3968
|
-
className: [Ws(),
|
|
3976
|
+
className: [Ws(), L].filter(Boolean).join(" "),
|
|
3969
3977
|
"data-component": "rich-text-editor",
|
|
3970
3978
|
"data-component-id": r,
|
|
3971
3979
|
"data-min-height": y,
|
|
@@ -3981,14 +3989,14 @@ const Ys = li(
|
|
|
3981
3989
|
saveSelection: lt,
|
|
3982
3990
|
restoreSelection: we,
|
|
3983
3991
|
getSelectedText: _o,
|
|
3984
|
-
uploadImage:
|
|
3992
|
+
uploadImage: z || _ ? cr : void 0,
|
|
3985
3993
|
enableColor: (m == null ? void 0 : m.includes("fontcolor")) ?? !1,
|
|
3986
|
-
enableImage: !!(
|
|
3994
|
+
enableImage: !!(z || _),
|
|
3987
3995
|
enableTable: (m == null ? void 0 : m.includes("table")) ?? !1,
|
|
3988
3996
|
showExtensions: E,
|
|
3989
3997
|
extensionControl: oi,
|
|
3990
3998
|
variables: ir,
|
|
3991
|
-
recentVariableTokens:
|
|
3999
|
+
recentVariableTokens: oe,
|
|
3992
4000
|
insertVariable: Uo
|
|
3993
4001
|
}
|
|
3994
4002
|
) : null,
|
|
@@ -3996,7 +4004,7 @@ const Ys = li(
|
|
|
3996
4004
|
/* @__PURE__ */ t(
|
|
3997
4005
|
"textarea",
|
|
3998
4006
|
{
|
|
3999
|
-
ref:
|
|
4007
|
+
ref: te,
|
|
4000
4008
|
id: ge,
|
|
4001
4009
|
"aria-label": on,
|
|
4002
4010
|
"aria-multiline": "true",
|
|
@@ -4050,7 +4058,7 @@ const Ys = li(
|
|
|
4050
4058
|
) : null,
|
|
4051
4059
|
pt(
|
|
4052
4060
|
e.menu ? _r(o, "document") : o,
|
|
4053
|
-
|
|
4061
|
+
Le
|
|
4054
4062
|
)
|
|
4055
4063
|
] }, e.key);
|
|
4056
4064
|
}),
|
|
@@ -4070,7 +4078,7 @@ const Ys = li(
|
|
|
4070
4078
|
Bn,
|
|
4071
4079
|
{
|
|
4072
4080
|
open: !!(xe && (!bn || pn)),
|
|
4073
|
-
onClose:
|
|
4081
|
+
onClose: $e,
|
|
4074
4082
|
title: xe ? uo(A, xe.extension.label) : void 0,
|
|
4075
4083
|
children: pn ? /* @__PURE__ */ t(co, {}) : /* @__PURE__ */ t("div", { className: "ds:overflow-y-auto ds:[max-block-size:min(60dvh,calc(var(--rich-text-editor-min-block-size)*3))]", children: (Pr = xe == null ? void 0 : (Dr = xe.extension).render) == null ? void 0 : Pr.call(
|
|
4076
4084
|
Dr,
|
|
@@ -4081,17 +4089,17 @@ const Ys = li(
|
|
|
4081
4089
|
Te ? Te({
|
|
4082
4090
|
open: Nt && !Ae,
|
|
4083
4091
|
onClose: () => {
|
|
4084
|
-
|
|
4092
|
+
Fe(!1), kn(!1);
|
|
4085
4093
|
},
|
|
4086
4094
|
selectionText: wo,
|
|
4087
4095
|
scope: xo,
|
|
4088
4096
|
creditsExhausted: Ao,
|
|
4089
|
-
getHTML:
|
|
4090
|
-
getText:
|
|
4097
|
+
getHTML: je.getHTML,
|
|
4098
|
+
getText: je.getText,
|
|
4091
4099
|
// All three write seams put AI output into the note, so
|
|
4092
4100
|
// each one is an action landing and sparkles the pill.
|
|
4093
4101
|
insertAtSelection: (e) => {
|
|
4094
|
-
qt.current && (Ce.current = qt.current.cloneRange()), we(), fe(e, { asHtml: !0 }),
|
|
4102
|
+
qt.current && (Ce.current = qt.current.cloneRange()), we(), fe(e, { asHtml: !0 }), ee && Oe();
|
|
4095
4103
|
},
|
|
4096
4104
|
insertAfterSelection: (e) => {
|
|
4097
4105
|
const n = qt.current ?? Ce.current;
|
|
@@ -4099,25 +4107,25 @@ const Ys = li(
|
|
|
4099
4107
|
const o = n.cloneRange();
|
|
4100
4108
|
o.collapse(!1), Ce.current = o;
|
|
4101
4109
|
}
|
|
4102
|
-
we(), fe(e, { asHtml: !0 }),
|
|
4110
|
+
we(), fe(e, { asHtml: !0 }), ee && Oe();
|
|
4103
4111
|
},
|
|
4104
4112
|
setContent: (e) => {
|
|
4105
|
-
|
|
4113
|
+
je.setContent(e), ee && Oe();
|
|
4106
4114
|
},
|
|
4107
|
-
onDictate:
|
|
4115
|
+
onDictate: F,
|
|
4108
4116
|
privacyNotice: yr
|
|
4109
4117
|
}) : K ? /* @__PURE__ */ t(
|
|
4110
4118
|
ts,
|
|
4111
4119
|
{
|
|
4112
4120
|
open: Nt && !Ae,
|
|
4113
|
-
onClose: () =>
|
|
4121
|
+
onClose: () => Fe(!1),
|
|
4114
4122
|
onRequestAiDraft: K,
|
|
4115
4123
|
onInsert: (e) => {
|
|
4116
|
-
we(), fe(e, { asHtml: G !== "text" }),
|
|
4124
|
+
we(), fe(e, { asHtml: G !== "text" }), ee && Oe();
|
|
4117
4125
|
},
|
|
4118
4126
|
previewAsHtml: G !== "text",
|
|
4119
4127
|
privacyNotice: yr,
|
|
4120
|
-
onDictate:
|
|
4128
|
+
onDictate: F
|
|
4121
4129
|
}
|
|
4122
4130
|
) : null,
|
|
4123
4131
|
k ? /* @__PURE__ */ t(
|
|
@@ -4129,7 +4137,7 @@ const Ys = li(
|
|
|
4129
4137
|
"editor.ai.consentRegionLabel",
|
|
4130
4138
|
"AI assistance consent for this document"
|
|
4131
4139
|
),
|
|
4132
|
-
footer: /* @__PURE__ */ t(
|
|
4140
|
+
footer: /* @__PURE__ */ t(Se, { intent: "ghost", size: "sm", onClick: zn, children: A("common.close") }),
|
|
4133
4141
|
children: /* @__PURE__ */ t(
|
|
4134
4142
|
vi,
|
|
4135
4143
|
{
|
|
@@ -4179,8 +4187,8 @@ const Ys = li(
|
|
|
4179
4187
|
getEditorRoot: ai,
|
|
4180
4188
|
suppressed: an || Nt || Yt !== null || xe !== null,
|
|
4181
4189
|
holdOpen: Jo,
|
|
4182
|
-
children: Or ? /* @__PURE__ */ N(
|
|
4183
|
-
|
|
4190
|
+
children: Or ? /* @__PURE__ */ N(Be, { children: [
|
|
4191
|
+
F ? pt(
|
|
4184
4192
|
/* @__PURE__ */ t(
|
|
4185
4193
|
X,
|
|
4186
4194
|
{
|
|
@@ -4192,17 +4200,17 @@ const Ys = li(
|
|
|
4192
4200
|
"aria-pressed": ye,
|
|
4193
4201
|
...un(
|
|
4194
4202
|
A(ye ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
4195
|
-
!!
|
|
4203
|
+
!!Le
|
|
4196
4204
|
),
|
|
4197
4205
|
onClick: () => br("selection")
|
|
4198
4206
|
}
|
|
4199
4207
|
),
|
|
4200
|
-
|
|
4208
|
+
Le
|
|
4201
4209
|
) : null,
|
|
4202
|
-
|
|
4210
|
+
Y ? pt(
|
|
4203
4211
|
_r(
|
|
4204
4212
|
/* @__PURE__ */ t(
|
|
4205
|
-
|
|
4213
|
+
Se,
|
|
4206
4214
|
{
|
|
4207
4215
|
size: "sm",
|
|
4208
4216
|
intent: "ghost",
|
|
@@ -4215,7 +4223,7 @@ const Ys = li(
|
|
|
4215
4223
|
),
|
|
4216
4224
|
"selection"
|
|
4217
4225
|
),
|
|
4218
|
-
|
|
4226
|
+
Le
|
|
4219
4227
|
) : null,
|
|
4220
4228
|
U ? pt(
|
|
4221
4229
|
/* @__PURE__ */ t(
|
|
@@ -4228,7 +4236,7 @@ const Ys = li(
|
|
|
4228
4236
|
icon: /* @__PURE__ */ t(Br, {}),
|
|
4229
4237
|
...un(
|
|
4230
4238
|
A("editor.ai.proofread"),
|
|
4231
|
-
!!
|
|
4239
|
+
!!Le
|
|
4232
4240
|
),
|
|
4233
4241
|
onClick: () => Lt(
|
|
4234
4242
|
"proofread",
|
|
@@ -4237,9 +4245,9 @@ const Ys = li(
|
|
|
4237
4245
|
)
|
|
4238
4246
|
}
|
|
4239
4247
|
),
|
|
4240
|
-
|
|
4248
|
+
Le
|
|
4241
4249
|
) : null,
|
|
4242
|
-
|
|
4250
|
+
re ? pt(
|
|
4243
4251
|
/* @__PURE__ */ t(
|
|
4244
4252
|
X,
|
|
4245
4253
|
{
|
|
@@ -4250,16 +4258,16 @@ const Ys = li(
|
|
|
4250
4258
|
icon: /* @__PURE__ */ t(Fr, {}),
|
|
4251
4259
|
...un(
|
|
4252
4260
|
A("editor.ai.autoFormat"),
|
|
4253
|
-
!!
|
|
4261
|
+
!!Le
|
|
4254
4262
|
),
|
|
4255
4263
|
onClick: () => Lt(
|
|
4256
4264
|
"format",
|
|
4257
|
-
|
|
4265
|
+
re,
|
|
4258
4266
|
tt("selection")
|
|
4259
4267
|
)
|
|
4260
4268
|
}
|
|
4261
4269
|
),
|
|
4262
|
-
|
|
4270
|
+
Le
|
|
4263
4271
|
) : null,
|
|
4264
4272
|
Hr ? pt(
|
|
4265
4273
|
/* @__PURE__ */ t(
|
|
@@ -4272,12 +4280,12 @@ const Ys = li(
|
|
|
4272
4280
|
icon: /* @__PURE__ */ t(qr, {}),
|
|
4273
4281
|
...un(
|
|
4274
4282
|
A("editor.ai.helpMeWrite"),
|
|
4275
|
-
!!
|
|
4283
|
+
!!Le
|
|
4276
4284
|
),
|
|
4277
4285
|
onClick: () => vr("selection")
|
|
4278
4286
|
}
|
|
4279
4287
|
),
|
|
4280
|
-
|
|
4288
|
+
Le
|
|
4281
4289
|
) : null
|
|
4282
4290
|
] }) : null
|
|
4283
4291
|
}
|
|
@@ -4296,7 +4304,7 @@ const Ys = li(
|
|
|
4296
4304
|
ref: sr,
|
|
4297
4305
|
id: Mn,
|
|
4298
4306
|
variables: ir,
|
|
4299
|
-
recentTokens:
|
|
4307
|
+
recentTokens: oe,
|
|
4300
4308
|
query: st.query,
|
|
4301
4309
|
onQueryChange: Lo,
|
|
4302
4310
|
onSelect: So,
|
|
@@ -4308,7 +4316,7 @@ const Ys = li(
|
|
|
4308
4316
|
}
|
|
4309
4317
|
) : null
|
|
4310
4318
|
] }),
|
|
4311
|
-
|
|
4319
|
+
F ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Fo }) : null,
|
|
4312
4320
|
at.length > 0 ? /* @__PURE__ */ t(
|
|
4313
4321
|
"p",
|
|
4314
4322
|
{
|
|
@@ -4320,7 +4328,7 @@ const Ys = li(
|
|
|
4320
4328
|
})
|
|
4321
4329
|
}
|
|
4322
4330
|
) : null,
|
|
4323
|
-
|
|
4331
|
+
F && Bo ? /* @__PURE__ */ t(
|
|
4324
4332
|
"p",
|
|
4325
4333
|
{
|
|
4326
4334
|
role: "alert",
|
|
@@ -4328,7 +4336,7 @@ const Ys = li(
|
|
|
4328
4336
|
children: A("editor.ai.dictationError")
|
|
4329
4337
|
}
|
|
4330
4338
|
) : null,
|
|
4331
|
-
|
|
4339
|
+
Y || U || re ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Wo }) : null,
|
|
4332
4340
|
Vo || wr ? /* @__PURE__ */ t(
|
|
4333
4341
|
"p",
|
|
4334
4342
|
{
|
|
@@ -4348,4 +4356,4 @@ export {
|
|
|
4348
4356
|
Ua as r,
|
|
4349
4357
|
Ws as w
|
|
4350
4358
|
};
|
|
4351
|
-
//# sourceMappingURL=rich-text-editor-
|
|
4359
|
+
//# sourceMappingURL=rich-text-editor-BAcJq1PO.js.map
|