@pstdio/ui 0.25.0 → 0.26.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/README.md +8 -1
- package/dist/{MermaidComponent-BVdDqDRU.js → MermaidComponent-X__B6qib.js} +3 -3
- package/dist/{MermaidComponent-BVdDqDRU.js.map → MermaidComponent-X__B6qib.js.map} +1 -1
- package/dist/activity-timeline-BynMjXSB.js +283 -0
- package/dist/activity-timeline-BynMjXSB.js.map +1 -0
- package/dist/alert-ubcrW24X.js +33 -0
- package/dist/alert-ubcrW24X.js.map +1 -0
- package/dist/browser-storage-BinyFNJX.js +40 -0
- package/dist/browser-storage-BinyFNJX.js.map +1 -0
- package/dist/chat-ui.js +1515 -1429
- package/dist/chat-ui.js.map +1 -1
- package/dist/components/activity/index.d.ts +1 -3
- package/dist/components/chat-ui/components/chat-history-story.d.ts +14 -0
- package/dist/components/chat-ui/components/chat-input-history.d.ts +6 -0
- package/dist/components/chat-ui/components/chat-input.d.ts +2 -0
- package/dist/components/chat-ui/components/chat-panel-composer.d.ts +49 -0
- package/dist/components/chat-ui/components/use-chat-input-history.d.ts +16 -0
- package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +1 -1
- package/dist/components/chat-ui/tool-rendering/shared.d.ts +1 -1
- package/dist/components/diff-viewer/code-editor.d.ts +2 -0
- package/dist/components/rich-text/index.d.ts +2 -0
- package/dist/components/rich-text/markdown-editor/markdown-editor-scrolling.play.d.ts +4 -0
- package/dist/components/rich-text/prompt-input/plugins/KeyboardShortcutPlugin.d.ts +3 -1
- package/dist/components/rich-text/prompt-input/plugins/keyboard-shortcuts.d.ts +2 -0
- package/dist/components/rich-text/prompt-input/prompt-input.d.ts +2 -0
- package/dist/components/{activity → rich-text/resource-activity-feed}/resource-activity-feed.d.ts +1 -1
- package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/should-show-floating-toolbar.d.ts +1 -0
- package/dist/data-table.js +6 -6
- package/dist/diff.js +524 -522
- package/dist/diff.js.map +1 -1
- package/dist/{edit-mode-data-table-B8UpWb7i.js → edit-mode-data-table-Nfmfi7bz.js} +23 -22
- package/dist/{edit-mode-data-table-B8UpWb7i.js.map → edit-mode-data-table-Nfmfi7bz.js.map} +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1766 -2232
- package/dist/index.js.map +1 -1
- package/dist/{kanban-renderer-toolbar-DzY6THJY.js → kanban-renderer-toolbar-Buek4icz.js} +34 -33
- package/dist/{kanban-renderer-toolbar-DzY6THJY.js.map → kanban-renderer-toolbar-Buek4icz.js.map} +1 -1
- package/dist/kanban-renderer.js +31 -30
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/lazy-markdown-editor-PzIBc9-l.js +42 -0
- package/dist/lazy-markdown-editor-PzIBc9-l.js.map +1 -0
- package/dist/{list-row-BDoV_iMV.js → list-row-DHzRa9-O.js} +2 -2
- package/dist/{list-row-BDoV_iMV.js.map → list-row-DHzRa9-O.js.map} +1 -1
- package/dist/{markdown-gNucAjnF.js → markdown-BCfPxNpb.js} +323 -303
- package/dist/markdown-BCfPxNpb.js.map +1 -0
- package/dist/markdown-editor-CsJ4KNGu.js +1034 -0
- package/dist/markdown-editor-CsJ4KNGu.js.map +1 -0
- package/dist/{mermaid-renderer-CVnuKs-A.js → mermaid-renderer-D0YP0FmJ.js} +3 -3
- package/dist/{mermaid-renderer-CVnuKs-A.js.map → mermaid-renderer-D0YP0FmJ.js.map} +1 -1
- package/dist/mermaid.js +1 -1
- package/dist/{param-editor-CTx3mDxQ.js → param-editor-CFM2Nf3l.js} +2 -2
- package/dist/{param-editor-CTx3mDxQ.js.map → param-editor-CFM2Nf3l.js.map} +1 -1
- package/dist/param-editor-field-Bj-AGUY6.js +1728 -0
- package/dist/param-editor-field-Bj-AGUY6.js.map +1 -0
- package/dist/param-editor.d.ts +2 -0
- package/dist/param-editor.js +47 -0
- package/dist/param-editor.js.map +1 -0
- package/dist/prism-n5gcERyD.js +202 -0
- package/dist/prism-n5gcERyD.js.map +1 -0
- package/dist/radio-BfjibByI.js +51 -0
- package/dist/radio-BfjibByI.js.map +1 -0
- package/dist/rich-message-q6Y6QJOq.js +633 -0
- package/dist/rich-message-q6Y6QJOq.js.map +1 -0
- package/dist/rich-text.js +342 -178
- package/dist/rich-text.js.map +1 -1
- package/dist/scroll-area-BMbg1WcD.js +91 -0
- package/dist/scroll-area-BMbg1WcD.js.map +1 -0
- package/dist/slider-DBHjdxsU.js +1092 -0
- package/dist/slider-DBHjdxsU.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/terminal.js +96 -93
- package/dist/terminal.js.map +1 -1
- package/dist/theme/recipes/timeline.d.ts +9 -0
- package/dist/{theme-Dc7hVvMC.js → theme-AzJH4Om3.js} +10 -1
- package/dist/theme-AzJH4Om3.js.map +1 -0
- package/dist/{theme-preference-Bpobguh4.js → theme-preference-DxGW1qg-.js} +2 -2
- package/dist/{theme-preference-Bpobguh4.js.map → theme-preference-DxGW1qg-.js.map} +1 -1
- package/dist/theme.js +1 -1
- package/dist/{tree-list-CZvcg3_6.js → tree-list-CPjbGTvs.js} +2 -2
- package/dist/{tree-list-CZvcg3_6.js.map → tree-list-CPjbGTvs.js.map} +1 -1
- package/dist/{workspace-badge-BR_GgsAG.js → workspace-badge-CuOcmnZc.js} +2 -2
- package/dist/{workspace-badge-BR_GgsAG.js.map → workspace-badge-CuOcmnZc.js.map} +1 -1
- package/package.json +7 -2
- package/dist/browser-storage-DPtOQJx0.js +0 -127
- package/dist/browser-storage-DPtOQJx0.js.map +0 -1
- package/dist/lazy-markdown-editor-ClZPZuaU.js +0 -235
- package/dist/lazy-markdown-editor-ClZPZuaU.js.map +0 -1
- package/dist/markdown-editor-CAVqJ9yR.js +0 -1019
- package/dist/markdown-editor-CAVqJ9yR.js.map +0 -1
- package/dist/markdown-gNucAjnF.js.map +0 -1
- package/dist/param-editor-field-DteDEyeU.js +0 -2810
- package/dist/param-editor-field-DteDEyeU.js.map +0 -1
- package/dist/prompt-input-DNpRL5tI.js +0 -564
- package/dist/prompt-input-DNpRL5tI.js.map +0 -1
- package/dist/radio-cLMEBBZk.js +0 -76
- package/dist/radio-cLMEBBZk.js.map +0 -1
- package/dist/rich-message-CuPiKxKX.js +0 -78
- package/dist/rich-message-CuPiKxKX.js.map +0 -1
- package/dist/theme-Dc7hVvMC.js.map +0 -1
|
@@ -0,0 +1,1034 @@
|
|
|
1
|
+
import { jsx as n, jsxs as U, Fragment as rt } from "react/jsx-runtime";
|
|
2
|
+
import { c as ft, d as ht, s as gt, f as pt, M as Ct, e as bt, a as vt, g as _t, C as Et, I as St, E as kt, b as yt, T as Lt, h as Tt } from "./markdown-BCfPxNpb.js";
|
|
3
|
+
import { IconButton as A, Text as Z, Stack as Qe, Box as Re, Input as Ye, Link as It, Dialog as ee, Field as Se, Flex as Te, Button as Je, Icon as wt } from "@chakra-ui/react";
|
|
4
|
+
import { AutoFocusPlugin as Rt } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
5
|
+
import { CheckListPlugin as Nt } from "@lexical/react/LexicalCheckListPlugin";
|
|
6
|
+
import { LexicalComposer as xt } from "@lexical/react/LexicalComposer";
|
|
7
|
+
import { LexicalErrorBoundary as Mt } from "@lexical/react/LexicalErrorBoundary";
|
|
8
|
+
import { HorizontalRulePlugin as Dt } from "@lexical/react/LexicalHorizontalRulePlugin";
|
|
9
|
+
import { ListPlugin as Pt } from "@lexical/react/LexicalListPlugin";
|
|
10
|
+
import { MarkdownShortcutPlugin as At } from "@lexical/react/LexicalMarkdownShortcutPlugin";
|
|
11
|
+
import { OnChangePlugin as Ot } from "@lexical/react/LexicalOnChangePlugin";
|
|
12
|
+
import { RichTextPlugin as $t } from "@lexical/react/LexicalRichTextPlugin";
|
|
13
|
+
import { TabIndentationPlugin as zt } from "@lexical/react/LexicalTabIndentationPlugin";
|
|
14
|
+
import { SELECTION_CHANGE_COMMAND as Ne, COMMAND_PRIORITY_CRITICAL as je, $getSelection as V, $isRangeSelection as Q, createCommand as Ut, FORMAT_TEXT_COMMAND as ke, $isRootOrShadowRoot as Bt, CLICK_COMMAND as lt, COMMAND_PRIORITY_HIGH as Xe, $createParagraphNode as Ie, COMMAND_PRIORITY_LOW as Ge, KEY_ESCAPE_COMMAND as Ht, $setSelection as Ft, $isLineBreakNode as Kt, $getNodeByKey as et, $isTextNode as tt, HISTORY_MERGE_TAG as Ue, $isParagraphNode as ct, $addUpdateTag as st, KEY_DOWN_COMMAND as Wt, REDO_COMMAND as Qt, UNDO_COMMAND as Yt, $getRoot as Gt } from "lexical";
|
|
15
|
+
import { useState as M, useRef as j, useEffect as $, useLayoutEffect as qt } from "react";
|
|
16
|
+
import { c as J } from "react/compiler-runtime";
|
|
17
|
+
import { useLexicalComposerContext as me } from "@lexical/react/LexicalComposerContext";
|
|
18
|
+
import { mergeRegister as xe, $findMatchingParent as Y } from "@lexical/utils";
|
|
19
|
+
import { Check as at, Copy as Vt, Code as jt, Link as Xt, TextQuote as Zt, List as Jt, ListOrdered as en, ListTodo as tn, X as nn, Pencil as on, Trash2 as rn, Table2 as ln, Image as cn, Code2 as sn, Minus as an } from "lucide-react";
|
|
20
|
+
import * as dn from "react-dom";
|
|
21
|
+
import { createPortal as Ze } from "react-dom";
|
|
22
|
+
import { T as O } from "./scroll-area-BMbg1WcD.js";
|
|
23
|
+
import { $isCodeNode as Be, $createCodeNode as un } from "@lexical/code";
|
|
24
|
+
import { $createHorizontalRuleNode as mn } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
25
|
+
import { LexicalTypeaheadMenuPlugin as fn } from "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
26
|
+
import { HistoryPlugin as hn } from "@lexical/react/LexicalHistoryPlugin";
|
|
27
|
+
import { LinkPlugin as gn } from "@lexical/react/LexicalLinkPlugin";
|
|
28
|
+
import { $isLinkNode as ne, $isAutoLinkNode as fe, TOGGLE_LINK_COMMAND as qe, $createLinkNode as pn } from "@lexical/link";
|
|
29
|
+
import { $isListNode as He, REMOVE_LIST_COMMAND as Cn, INSERT_CHECK_LIST_COMMAND as bn, INSERT_ORDERED_LIST_COMMAND as vn, INSERT_UNORDERED_LIST_COMMAND as _n } from "@lexical/list";
|
|
30
|
+
import { $isHeadingNode as En, $createQuoteNode as Sn, $createHeadingNode as kn } from "@lexical/rich-text";
|
|
31
|
+
import { $isAtNodeEnd as nt, $setBlocksType as ye } from "@lexical/selection";
|
|
32
|
+
function Fe(t) {
|
|
33
|
+
const e = V();
|
|
34
|
+
if (!Q(e))
|
|
35
|
+
return null;
|
|
36
|
+
const i = e.anchor.getNode(), o = Be(i) ? i : Y(i, (l) => Be(l));
|
|
37
|
+
if (!Be(o))
|
|
38
|
+
return null;
|
|
39
|
+
const r = t.getElementByKey(o.getKey());
|
|
40
|
+
return r instanceof HTMLElement ? r : null;
|
|
41
|
+
}
|
|
42
|
+
function yn(t) {
|
|
43
|
+
return t instanceof HTMLElement ? t.closest(".rich-text__code") : null;
|
|
44
|
+
}
|
|
45
|
+
function Ln(t, e) {
|
|
46
|
+
const i = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
47
|
+
return {
|
|
48
|
+
top: o.top - i.top + 6,
|
|
49
|
+
left: o.right - i.left - 30
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function Tn(t) {
|
|
53
|
+
const e = J(31), {
|
|
54
|
+
anchorElem: i
|
|
55
|
+
} = t, [o] = me(), [r, l] = M(null), [d, p] = M(!1), s = j(null);
|
|
56
|
+
let u, m;
|
|
57
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = () => () => {
|
|
58
|
+
s.current !== null && window.clearTimeout(s.current);
|
|
59
|
+
}, m = [], e[0] = u, e[1] = m) : (u = e[0], m = e[1]), $(u, m);
|
|
60
|
+
let g, C;
|
|
61
|
+
e[2] !== o ? (g = () => {
|
|
62
|
+
const y = o.getRootElement();
|
|
63
|
+
if (!y)
|
|
64
|
+
return;
|
|
65
|
+
const w = (D) => {
|
|
66
|
+
const P = yn(D.target);
|
|
67
|
+
l(P instanceof HTMLElement ? P : null);
|
|
68
|
+
}, N = () => {
|
|
69
|
+
o.getEditorState().read(() => {
|
|
70
|
+
const D = Fe(o);
|
|
71
|
+
l(D);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
return y.addEventListener("pointermove", w), y.addEventListener("pointerleave", N), () => {
|
|
75
|
+
y.removeEventListener("pointermove", w), y.removeEventListener("pointerleave", N);
|
|
76
|
+
};
|
|
77
|
+
}, C = [o], e[2] = o, e[3] = g, e[4] = C) : (g = e[3], C = e[4]), $(g, C);
|
|
78
|
+
let _, v;
|
|
79
|
+
if (e[5] !== o ? (_ = () => xe(o.registerUpdateListener((y) => {
|
|
80
|
+
const {
|
|
81
|
+
editorState: w
|
|
82
|
+
} = y;
|
|
83
|
+
w.read(() => {
|
|
84
|
+
const N = Fe(o);
|
|
85
|
+
N && l(N);
|
|
86
|
+
});
|
|
87
|
+
}), o.registerCommand(Ne, () => (o.getEditorState().read(() => {
|
|
88
|
+
const y = Fe(o);
|
|
89
|
+
if (!y) {
|
|
90
|
+
l(In);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
l(y);
|
|
94
|
+
}), !1), je)), v = [o], e[5] = o, e[6] = _, e[7] = v) : (_ = e[6], v = e[7]), $(_, v), !i || !r)
|
|
95
|
+
return null;
|
|
96
|
+
let E;
|
|
97
|
+
e[8] !== r || e[9] !== i ? (E = Ln(i, r), e[8] = r, e[9] = i, e[10] = E) : E = e[10];
|
|
98
|
+
const L = E;
|
|
99
|
+
let h;
|
|
100
|
+
e[11] !== L.left || e[12] !== L.top ? (h = {
|
|
101
|
+
position: "absolute",
|
|
102
|
+
top: L.top,
|
|
103
|
+
left: L.left
|
|
104
|
+
}, e[11] = L.left, e[12] = L.top, e[13] = h) : h = e[13];
|
|
105
|
+
const S = h, I = d ? "Copied" : "Copy code", f = d ? "Copied" : "Copy code";
|
|
106
|
+
let b;
|
|
107
|
+
e[14] !== r.textContent ? (b = async () => {
|
|
108
|
+
const y = r.textContent ?? "";
|
|
109
|
+
try {
|
|
110
|
+
await navigator.clipboard.writeText(y), p(!0), s.current !== null && window.clearTimeout(s.current), s.current = window.setTimeout(() => {
|
|
111
|
+
p(!1);
|
|
112
|
+
}, 1200);
|
|
113
|
+
} catch {
|
|
114
|
+
p(!1);
|
|
115
|
+
}
|
|
116
|
+
}, e[14] = r.textContent, e[15] = b) : b = e[15];
|
|
117
|
+
let k;
|
|
118
|
+
e[16] !== d ? (k = d ? /* @__PURE__ */ n(at, { size: 14 }) : /* @__PURE__ */ n(Vt, { size: 14 }), e[16] = d, e[17] = k) : k = e[17];
|
|
119
|
+
let R;
|
|
120
|
+
e[18] !== f || e[19] !== b || e[20] !== k ? (R = /* @__PURE__ */ n(A, { "aria-label": f, variant: "subtle", size: "xs", onClick: b, children: k }), e[18] = f, e[19] = b, e[20] = k, e[21] = R) : R = e[21];
|
|
121
|
+
let c;
|
|
122
|
+
e[22] !== R || e[23] !== I ? (c = /* @__PURE__ */ n(O, { content: I, children: R }), e[22] = R, e[23] = I, e[24] = c) : c = e[24];
|
|
123
|
+
let a;
|
|
124
|
+
e[25] !== S || e[26] !== c ? (a = /* @__PURE__ */ n("div", { className: "code-block-actions", style: S, children: c }), e[25] = S, e[26] = c, e[27] = a) : a = e[27];
|
|
125
|
+
let T;
|
|
126
|
+
return e[28] !== i || e[29] !== a ? (T = Ze(a, i), e[28] = i, e[29] = a, e[30] = T) : T = e[30], T;
|
|
127
|
+
}
|
|
128
|
+
function In(t) {
|
|
129
|
+
return t?.matches(":hover") ? t : null;
|
|
130
|
+
}
|
|
131
|
+
const dt = Ut("TOGGLE_LINK_EDIT_MODE_COMMAND");
|
|
132
|
+
function he(t) {
|
|
133
|
+
const e = t.anchor, i = t.focus, o = t.anchor.getNode(), r = t.focus.getNode();
|
|
134
|
+
return o === r ? o : t.isBackward() ? nt(i) ? o : r : nt(e) ? o : r;
|
|
135
|
+
}
|
|
136
|
+
const wn = 10, Rn = 5;
|
|
137
|
+
function we(t, e, i, o = wn, r = Rn, l = "legacy", d = "anchor") {
|
|
138
|
+
const p = i.parentElement;
|
|
139
|
+
if (t === null || !p) {
|
|
140
|
+
e.style.opacity = "0", e.style.transform = "translate(-10000px, -10000px)";
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const s = e.getBoundingClientRect(), u = i.getBoundingClientRect(), m = d === "viewport" ? new DOMRect(0, 0, document.documentElement.clientWidth, document.documentElement.clientHeight) : p.getBoundingClientRect();
|
|
144
|
+
let g = l === "above" ? t.top - s.height - o : t.top - o, C = t.left - r;
|
|
145
|
+
g < m.top && (g = l === "above" ? t.bottom + o : g + s.height + t.height + o * 2), C + s.width > m.right && (C = m.right - s.width - r), g + s.height > m.bottom && (g = t.top - s.height - Math.abs(o)), d === "anchor" && (g -= u.top, C -= u.left), e.style.opacity = "1", e.style.transform = `translate(${C}px, ${g}px)`;
|
|
146
|
+
}
|
|
147
|
+
function Ke() {
|
|
148
|
+
const t = J(1);
|
|
149
|
+
let e;
|
|
150
|
+
return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n("span", { style: {
|
|
151
|
+
display: "inline-flex",
|
|
152
|
+
height: "1rem",
|
|
153
|
+
margin: "0 0.25rem",
|
|
154
|
+
borderLeft: "1px solid var(--chakra-colors-border-subtle)"
|
|
155
|
+
} }), t[0] = e) : e = t[0], e;
|
|
156
|
+
}
|
|
157
|
+
function Nn(t) {
|
|
158
|
+
const e = J(88), {
|
|
159
|
+
editor: i,
|
|
160
|
+
blockType: o,
|
|
161
|
+
isBold: r,
|
|
162
|
+
isItalic: l,
|
|
163
|
+
isUnderline: d,
|
|
164
|
+
isCode: p,
|
|
165
|
+
isLink: s,
|
|
166
|
+
formatHeading: u,
|
|
167
|
+
formatList: m,
|
|
168
|
+
formatQuote: g,
|
|
169
|
+
insertLink: C
|
|
170
|
+
} = t, _ = r || void 0;
|
|
171
|
+
let v;
|
|
172
|
+
e[0] !== i ? (v = () => i.dispatchCommand(ke, "bold"), e[0] = i, e[1] = v) : v = e[1];
|
|
173
|
+
let E;
|
|
174
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ n(Z, { fontWeight: "bold", fontSize: ".75rem", children: "B" }), e[2] = E) : E = e[2];
|
|
175
|
+
let L;
|
|
176
|
+
e[3] !== _ || e[4] !== v ? (L = /* @__PURE__ */ n(O, { content: "Bold", children: /* @__PURE__ */ n(A, { "data-active": _, onClick: v, variant: "ghost", "aria-label": "Bold", size: "xs", children: E }) }), e[3] = _, e[4] = v, e[5] = L) : L = e[5];
|
|
177
|
+
const h = l || void 0;
|
|
178
|
+
let S;
|
|
179
|
+
e[6] !== i ? (S = () => i.dispatchCommand(ke, "italic"), e[6] = i, e[7] = S) : S = e[7];
|
|
180
|
+
let I;
|
|
181
|
+
e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ n(Z, { fontStyle: "italic", fontSize: ".75rem", children: "I" }), e[8] = I) : I = e[8];
|
|
182
|
+
let f;
|
|
183
|
+
e[9] !== h || e[10] !== S ? (f = /* @__PURE__ */ n(O, { content: "Italic", children: /* @__PURE__ */ n(A, { "data-active": h, onClick: S, variant: "ghost", "aria-label": "Italic", size: "xs", children: I }) }), e[9] = h, e[10] = S, e[11] = f) : f = e[11];
|
|
184
|
+
const b = d || void 0;
|
|
185
|
+
let k;
|
|
186
|
+
e[12] !== i ? (k = () => i.dispatchCommand(ke, "underline"), e[12] = i, e[13] = k) : k = e[13];
|
|
187
|
+
let R;
|
|
188
|
+
e[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ n(Z, { textDecoration: "underline", fontSize: ".75rem", children: "U" }), e[14] = R) : R = e[14];
|
|
189
|
+
let c;
|
|
190
|
+
e[15] !== b || e[16] !== k ? (c = /* @__PURE__ */ n(O, { content: "Underline", children: /* @__PURE__ */ n(A, { "data-active": b, onClick: k, variant: "ghost", "aria-label": "Underline", size: "xs", children: R }) }), e[15] = b, e[16] = k, e[17] = c) : c = e[17];
|
|
191
|
+
let a;
|
|
192
|
+
e[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ n(Ke, {}), e[18] = a) : a = e[18];
|
|
193
|
+
const T = o === "h1" || void 0;
|
|
194
|
+
let y;
|
|
195
|
+
e[19] !== u ? (y = () => u("h1"), e[19] = u, e[20] = y) : y = e[20];
|
|
196
|
+
let w;
|
|
197
|
+
e[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ n(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }), e[21] = w) : w = e[21];
|
|
198
|
+
let N;
|
|
199
|
+
e[22] !== T || e[23] !== y ? (N = /* @__PURE__ */ n(O, { content: "Heading 1", children: /* @__PURE__ */ n(A, { "data-active": T, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: y, children: w }) }), e[22] = T, e[23] = y, e[24] = N) : N = e[24];
|
|
200
|
+
const D = o === "h2" || void 0;
|
|
201
|
+
let P;
|
|
202
|
+
e[25] !== u ? (P = () => u("h2"), e[25] = u, e[26] = P) : P = e[26];
|
|
203
|
+
let G;
|
|
204
|
+
e[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ n(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }), e[27] = G) : G = e[27];
|
|
205
|
+
let B;
|
|
206
|
+
e[28] !== D || e[29] !== P ? (B = /* @__PURE__ */ n(O, { content: "Heading 2", children: /* @__PURE__ */ n(A, { "data-active": D, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: P, children: G }) }), e[28] = D, e[29] = P, e[30] = B) : B = e[30];
|
|
207
|
+
const q = o === "h3" || void 0;
|
|
208
|
+
let H;
|
|
209
|
+
e[31] !== u ? (H = () => u("h3"), e[31] = u, e[32] = H) : H = e[32];
|
|
210
|
+
let F;
|
|
211
|
+
e[33] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (F = /* @__PURE__ */ n(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }), e[33] = F) : F = e[33];
|
|
212
|
+
let K;
|
|
213
|
+
e[34] !== q || e[35] !== H ? (K = /* @__PURE__ */ n(O, { content: "Heading 3", children: /* @__PURE__ */ n(A, { "data-active": q, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: H, children: F }) }), e[34] = q, e[35] = H, e[36] = K) : K = e[36];
|
|
214
|
+
let x;
|
|
215
|
+
e[37] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ n(Ke, {}), e[37] = x) : x = e[37];
|
|
216
|
+
const z = p || void 0;
|
|
217
|
+
let W;
|
|
218
|
+
e[38] !== i ? (W = () => i.dispatchCommand(ke, "code"), e[38] = i, e[39] = W) : W = e[39];
|
|
219
|
+
let te;
|
|
220
|
+
e[40] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (te = /* @__PURE__ */ n(jt, { size: 14 }), e[40] = te) : te = e[40];
|
|
221
|
+
let X;
|
|
222
|
+
e[41] !== z || e[42] !== W ? (X = /* @__PURE__ */ n(O, { content: "Inline Code", children: /* @__PURE__ */ n(A, { "data-active": z, onClick: W, variant: "ghost", "aria-label": "Inline Code", size: "xs", children: te }) }), e[41] = z, e[42] = W, e[43] = X) : X = e[43];
|
|
223
|
+
const Me = s ? "Remove Link" : "Insert Link", De = s || void 0, Pe = s ? "Remove Link" : "Insert Link";
|
|
224
|
+
let ge;
|
|
225
|
+
e[44] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ge = /* @__PURE__ */ n(Xt, { size: 14 }), e[44] = ge) : ge = e[44];
|
|
226
|
+
let oe;
|
|
227
|
+
e[45] !== C || e[46] !== De || e[47] !== Pe ? (oe = /* @__PURE__ */ n(A, { "data-active": De, variant: "ghost", "aria-label": Pe, size: "xs", onClick: C, children: ge }), e[45] = C, e[46] = De, e[47] = Pe, e[48] = oe) : oe = e[48];
|
|
228
|
+
let ie;
|
|
229
|
+
e[49] !== Me || e[50] !== oe ? (ie = /* @__PURE__ */ n(O, { content: Me, children: oe }), e[49] = Me, e[50] = oe, e[51] = ie) : ie = e[51];
|
|
230
|
+
const Ae = o === "quote" || void 0;
|
|
231
|
+
let pe;
|
|
232
|
+
e[52] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (pe = /* @__PURE__ */ n(Zt, { size: 14 }), e[52] = pe) : pe = e[52];
|
|
233
|
+
let re;
|
|
234
|
+
e[53] !== g || e[54] !== Ae ? (re = /* @__PURE__ */ n(O, { content: "Quote", children: /* @__PURE__ */ n(A, { "data-active": Ae, variant: "ghost", "aria-label": "Quote", size: "xs", onClick: g, children: pe }) }), e[53] = g, e[54] = Ae, e[55] = re) : re = e[55];
|
|
235
|
+
let Ce;
|
|
236
|
+
e[56] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ce = /* @__PURE__ */ n(Ke, {}), e[56] = Ce) : Ce = e[56];
|
|
237
|
+
const Oe = o === "bullet" || void 0;
|
|
238
|
+
let le;
|
|
239
|
+
e[57] !== m ? (le = () => m("bullet"), e[57] = m, e[58] = le) : le = e[58];
|
|
240
|
+
let be;
|
|
241
|
+
e[59] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (be = /* @__PURE__ */ n(Jt, { size: 14 }), e[59] = be) : be = e[59];
|
|
242
|
+
let ce;
|
|
243
|
+
e[60] !== Oe || e[61] !== le ? (ce = /* @__PURE__ */ n(O, { content: "Bulleted List", children: /* @__PURE__ */ n(A, { "data-active": Oe, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: le, children: be }) }), e[60] = Oe, e[61] = le, e[62] = ce) : ce = e[62];
|
|
244
|
+
const $e = o === "number" || void 0;
|
|
245
|
+
let se;
|
|
246
|
+
e[63] !== m ? (se = () => m("number"), e[63] = m, e[64] = se) : se = e[64];
|
|
247
|
+
let ve;
|
|
248
|
+
e[65] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ve = /* @__PURE__ */ n(en, { size: 14 }), e[65] = ve) : ve = e[65];
|
|
249
|
+
let ae;
|
|
250
|
+
e[66] !== $e || e[67] !== se ? (ae = /* @__PURE__ */ n(O, { content: "Numbered List", children: /* @__PURE__ */ n(A, { "data-active": $e, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: se, children: ve }) }), e[66] = $e, e[67] = se, e[68] = ae) : ae = e[68];
|
|
251
|
+
const ze = o === "check" || void 0;
|
|
252
|
+
let de;
|
|
253
|
+
e[69] !== m ? (de = () => m("check"), e[69] = m, e[70] = de) : de = e[70];
|
|
254
|
+
let _e;
|
|
255
|
+
e[71] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_e = /* @__PURE__ */ n(tn, { size: 14 }), e[71] = _e) : _e = e[71];
|
|
256
|
+
let ue;
|
|
257
|
+
e[72] !== ze || e[73] !== de ? (ue = /* @__PURE__ */ n(O, { content: "Check List", children: /* @__PURE__ */ n(A, { "data-active": ze, variant: "ghost", "aria-label": "Check List", size: "xs", onClick: de, children: _e }) }), e[72] = ze, e[73] = de, e[74] = ue) : ue = e[74];
|
|
258
|
+
let Ee;
|
|
259
|
+
return e[75] !== c || e[76] !== N || e[77] !== B || e[78] !== K || e[79] !== X || e[80] !== L || e[81] !== ie || e[82] !== re || e[83] !== ce || e[84] !== ae || e[85] !== ue || e[86] !== f ? (Ee = /* @__PURE__ */ U(Qe, { direction: "row", gap: "0.5", alignItems: "center", children: [
|
|
260
|
+
L,
|
|
261
|
+
f,
|
|
262
|
+
c,
|
|
263
|
+
a,
|
|
264
|
+
N,
|
|
265
|
+
B,
|
|
266
|
+
K,
|
|
267
|
+
x,
|
|
268
|
+
X,
|
|
269
|
+
ie,
|
|
270
|
+
re,
|
|
271
|
+
Ce,
|
|
272
|
+
ce,
|
|
273
|
+
ae,
|
|
274
|
+
ue
|
|
275
|
+
] }), e[75] = c, e[76] = N, e[77] = B, e[78] = K, e[79] = X, e[80] = L, e[81] = ie, e[82] = re, e[83] = ce, e[84] = ae, e[85] = ue, e[86] = f, e[87] = Ee) : Ee = e[87], Ee;
|
|
276
|
+
}
|
|
277
|
+
const xn = {
|
|
278
|
+
bullet: "Bulleted List",
|
|
279
|
+
check: "Check List",
|
|
280
|
+
code: "Code Block",
|
|
281
|
+
h1: "Heading 1",
|
|
282
|
+
h2: "Heading 2",
|
|
283
|
+
h3: "Heading 3",
|
|
284
|
+
h4: "Heading 4",
|
|
285
|
+
h5: "Heading 5",
|
|
286
|
+
h6: "Heading 6",
|
|
287
|
+
number: "Numbered List",
|
|
288
|
+
paragraph: "Normal",
|
|
289
|
+
quote: "Quote"
|
|
290
|
+
}, Mn = (t) => t in xn ? t : null, Dn = (t) => (t.getKey() === "root" ? t : Y(t, (i) => {
|
|
291
|
+
const o = i.getParent();
|
|
292
|
+
return o !== null && Bt(o);
|
|
293
|
+
})) ?? t.getTopLevelElementOrThrow(), Pn = (t) => {
|
|
294
|
+
const e = Dn(t);
|
|
295
|
+
if (He(e))
|
|
296
|
+
return e.getListType();
|
|
297
|
+
const i = Y(t, (r) => He(r));
|
|
298
|
+
if (i !== null && He(i))
|
|
299
|
+
return i.getListType();
|
|
300
|
+
const o = En(e) ? e.getTag() : e.getType();
|
|
301
|
+
return Mn(o);
|
|
302
|
+
};
|
|
303
|
+
function An(t) {
|
|
304
|
+
const {
|
|
305
|
+
hasSelection: e,
|
|
306
|
+
isRangeSelection: i,
|
|
307
|
+
isCollapsed: o,
|
|
308
|
+
hasNativeSelection: r,
|
|
309
|
+
hasNativeRange: l,
|
|
310
|
+
isAnchorInsideEditor: d,
|
|
311
|
+
isEditorEditable: p,
|
|
312
|
+
isPointerSelecting: s
|
|
313
|
+
} = t;
|
|
314
|
+
return e && i && !o && r && l && d && p && !s;
|
|
315
|
+
}
|
|
316
|
+
const On = -4;
|
|
317
|
+
function $n({
|
|
318
|
+
editor: t,
|
|
319
|
+
anchorElem: e,
|
|
320
|
+
isToolbarActive: i,
|
|
321
|
+
setIsToolbarActive: o
|
|
322
|
+
}) {
|
|
323
|
+
const r = j(null), [l, d] = M("paragraph"), [p, s] = M(!1), [u, m] = M(!1), [g, C] = M(!1), [_, v] = M(!1), [E, L] = M(!1), h = j(!1), S = j(() => {
|
|
324
|
+
}), I = (c) => {
|
|
325
|
+
t.update(() => {
|
|
326
|
+
const a = V();
|
|
327
|
+
if (Q(a)) {
|
|
328
|
+
if (l === c) {
|
|
329
|
+
ye(a, Ie);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
ye(a, () => kn(c));
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}, f = (c) => {
|
|
336
|
+
if (l === c) {
|
|
337
|
+
t.dispatchCommand(Cn, void 0);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const a = {
|
|
341
|
+
bullet: _n,
|
|
342
|
+
number: vn,
|
|
343
|
+
check: bn
|
|
344
|
+
}[c];
|
|
345
|
+
t.dispatchCommand(a, void 0);
|
|
346
|
+
}, b = () => {
|
|
347
|
+
t.update(() => {
|
|
348
|
+
const c = V();
|
|
349
|
+
if (Q(c)) {
|
|
350
|
+
if (l === "quote") {
|
|
351
|
+
ye(c, Ie);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
ye(c, Sn);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}, k = () => {
|
|
358
|
+
if (E) {
|
|
359
|
+
t.dispatchCommand(qe, null);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
t.dispatchCommand(dt, !0);
|
|
363
|
+
}, R = () => {
|
|
364
|
+
const c = V();
|
|
365
|
+
if (!Q(c)) return;
|
|
366
|
+
s(c.hasFormat("bold")), m(c.hasFormat("italic")), C(c.hasFormat("underline")), v(c.hasFormat("code"));
|
|
367
|
+
const a = he(c), T = Y(a, ne), y = Y(a, fe);
|
|
368
|
+
L(T !== null || y !== null);
|
|
369
|
+
const w = Pn(c.anchor.getNode());
|
|
370
|
+
w && d(w);
|
|
371
|
+
};
|
|
372
|
+
return S.current = () => {
|
|
373
|
+
const c = V(), a = r.current, T = window.getSelection();
|
|
374
|
+
if (a === null)
|
|
375
|
+
return;
|
|
376
|
+
const y = t.getRootElement(), w = T !== null, N = w && T.rangeCount > 0, D = !!y?.contains(w ? T.anchorNode : null);
|
|
377
|
+
if (An({
|
|
378
|
+
hasSelection: c !== null,
|
|
379
|
+
isRangeSelection: Q(c),
|
|
380
|
+
isCollapsed: Q(c) ? c.isCollapsed() : !1,
|
|
381
|
+
hasNativeSelection: w,
|
|
382
|
+
hasNativeRange: N,
|
|
383
|
+
isAnchorInsideEditor: D,
|
|
384
|
+
isEditorEditable: t.isEditable(),
|
|
385
|
+
isPointerSelecting: h.current
|
|
386
|
+
}) && T) {
|
|
387
|
+
const P = T.getRangeAt(0).getBoundingClientRect();
|
|
388
|
+
if (P) {
|
|
389
|
+
const G = new DOMRect(P.left, P.bottom, 0, 0);
|
|
390
|
+
we(G, a, e, On, void 0, "legacy", "viewport");
|
|
391
|
+
}
|
|
392
|
+
o(!0);
|
|
393
|
+
} else
|
|
394
|
+
y !== null && we(null, a, e, void 0, void 0, "legacy", "viewport"), o(!1);
|
|
395
|
+
return R(), !0;
|
|
396
|
+
}, $(() => {
|
|
397
|
+
const c = t.getRootElement();
|
|
398
|
+
if (!c) return;
|
|
399
|
+
const a = c.ownerDocument, T = () => {
|
|
400
|
+
h.current = !0, o(!1);
|
|
401
|
+
}, y = () => {
|
|
402
|
+
h.current && (h.current = !1, t.getEditorState().read(() => {
|
|
403
|
+
S.current();
|
|
404
|
+
}));
|
|
405
|
+
};
|
|
406
|
+
return c.addEventListener("pointerdown", T), a.addEventListener("pointerup", y), a.addEventListener("pointercancel", y), () => {
|
|
407
|
+
c.removeEventListener("pointerdown", T), a.removeEventListener("pointerup", y), a.removeEventListener("pointercancel", y);
|
|
408
|
+
};
|
|
409
|
+
}, [t, o]), $(() => {
|
|
410
|
+
const c = e.ownerDocument, a = () => {
|
|
411
|
+
t.getEditorState().read(() => {
|
|
412
|
+
S.current();
|
|
413
|
+
});
|
|
414
|
+
};
|
|
415
|
+
return window.addEventListener("resize", a), c.addEventListener("scroll", a, !0), () => {
|
|
416
|
+
window.removeEventListener("resize", a), c.removeEventListener("scroll", a, !0);
|
|
417
|
+
};
|
|
418
|
+
}, [e, t]), $(() => xe(t.registerUpdateListener(({
|
|
419
|
+
editorState: c
|
|
420
|
+
}) => {
|
|
421
|
+
c.read(() => {
|
|
422
|
+
S.current();
|
|
423
|
+
});
|
|
424
|
+
}), t.registerCommand(Ne, (c) => (S.current(), !1), je), t.registerCommand(lt, (c) => {
|
|
425
|
+
const a = V();
|
|
426
|
+
return Q(a) && S.current(), !1;
|
|
427
|
+
}, Xe)), [t]), /* @__PURE__ */ n(Re, { ref: r, zIndex: "tooltip", className: `floating-text-format-toolbar ${i ? "active" : ""}`, children: /* @__PURE__ */ n(Nn, { editor: t, blockType: l, isBold: p, isItalic: u, isUnderline: g, isCode: _, isLink: E, formatHeading: I, formatList: f, formatQuote: b, insertLink: k }) });
|
|
428
|
+
}
|
|
429
|
+
function zn(t) {
|
|
430
|
+
const e = J(4), {
|
|
431
|
+
anchorElem: i
|
|
432
|
+
} = t, o = i === void 0 ? document.body : i, [r] = me(), [l, d] = M(!1);
|
|
433
|
+
let p;
|
|
434
|
+
return e[0] !== o || e[1] !== r || e[2] !== l ? (p = Ze(/* @__PURE__ */ n($n, { editor: r, anchorElem: o, isToolbarActive: l, setIsToolbarActive: d }), document.body), e[0] = o, e[1] = r, e[2] = l, e[3] = p) : p = e[3], p;
|
|
435
|
+
}
|
|
436
|
+
function Un(t) {
|
|
437
|
+
const e = J(32), {
|
|
438
|
+
isActive: i,
|
|
439
|
+
isLinkEditMode: o,
|
|
440
|
+
editedLinkUrl: r,
|
|
441
|
+
editedLinkUrlIsValid: l,
|
|
442
|
+
linkUrl: d,
|
|
443
|
+
href: p,
|
|
444
|
+
inputRef: s,
|
|
445
|
+
onEditedLinkUrlChange: u,
|
|
446
|
+
onInputKeyDown: m,
|
|
447
|
+
onClose: g,
|
|
448
|
+
onSubmit: C,
|
|
449
|
+
onEdit: _,
|
|
450
|
+
onRemove: v
|
|
451
|
+
} = t;
|
|
452
|
+
if (!i)
|
|
453
|
+
return null;
|
|
454
|
+
if (o) {
|
|
455
|
+
const b = !l;
|
|
456
|
+
let k;
|
|
457
|
+
e[0] !== u ? (k = (D) => {
|
|
458
|
+
u(D.target.value);
|
|
459
|
+
}, e[0] = u, e[1] = k) : k = e[1];
|
|
460
|
+
let R;
|
|
461
|
+
e[2] !== r || e[3] !== s || e[4] !== m || e[5] !== b || e[6] !== k ? (R = /* @__PURE__ */ n(Ye, { ref: s, className: "link-editor-url-field", size: "sm", fontSize: "sm", value: r, placeholder: "https://", "aria-label": "Link URL", "aria-invalid": b, onChange: k, onKeyDown: m }), e[2] = r, e[3] = s, e[4] = m, e[5] = b, e[6] = k, e[7] = R) : R = e[7];
|
|
462
|
+
let c;
|
|
463
|
+
e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ n(nn, { size: 14 }), e[8] = c) : c = e[8];
|
|
464
|
+
let a;
|
|
465
|
+
e[9] !== g ? (a = /* @__PURE__ */ n(O, { content: "Cancel", children: /* @__PURE__ */ n(A, { variant: "ghost", size: "xs", "aria-label": "Cancel link edit", onMouseDown: Le, onClick: g, children: c }) }), e[9] = g, e[10] = a) : a = e[10];
|
|
466
|
+
const T = !l;
|
|
467
|
+
let y;
|
|
468
|
+
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(at, { size: 14 }), e[11] = y) : y = e[11];
|
|
469
|
+
let w;
|
|
470
|
+
e[12] !== C || e[13] !== T ? (w = /* @__PURE__ */ n(O, { content: "Confirm", children: /* @__PURE__ */ n(A, { variant: "ghost", size: "xs", "aria-label": "Confirm link edit", disabled: T, onMouseDown: Le, onClick: C, children: y }) }), e[12] = C, e[13] = T, e[14] = w) : w = e[14];
|
|
471
|
+
let N;
|
|
472
|
+
return e[15] !== R || e[16] !== a || e[17] !== w ? (N = /* @__PURE__ */ U(Qe, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
|
|
473
|
+
R,
|
|
474
|
+
a,
|
|
475
|
+
w
|
|
476
|
+
] }), e[15] = R, e[16] = a, e[17] = w, e[18] = N) : N = e[18], N;
|
|
477
|
+
}
|
|
478
|
+
let E;
|
|
479
|
+
e[19] !== p || e[20] !== d ? (E = /* @__PURE__ */ n(It, { href: p, target: "_blank", rel: "noopener noreferrer", className: "link-editor-url-field", fontSize: "sm", textDecoration: "underline", px: "2", truncate: !0, children: d }), e[19] = p, e[20] = d, e[21] = E) : E = e[21];
|
|
480
|
+
let L;
|
|
481
|
+
e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ n(on, { size: 14 }), e[22] = L) : L = e[22];
|
|
482
|
+
let h;
|
|
483
|
+
e[23] !== _ ? (h = /* @__PURE__ */ n(O, { content: "Edit link", children: /* @__PURE__ */ n(A, { variant: "ghost", size: "xs", "aria-label": "Edit link", onMouseDown: Le, onClick: _, children: L }) }), e[23] = _, e[24] = h) : h = e[24];
|
|
484
|
+
let S;
|
|
485
|
+
e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ n(rn, { size: 14 }), e[25] = S) : S = e[25];
|
|
486
|
+
let I;
|
|
487
|
+
e[26] !== v ? (I = /* @__PURE__ */ n(O, { content: "Remove link", children: /* @__PURE__ */ n(A, { variant: "ghost", size: "xs", "aria-label": "Remove link", onMouseDown: Le, onClick: v, children: S }) }), e[26] = v, e[27] = I) : I = e[27];
|
|
488
|
+
let f;
|
|
489
|
+
return e[28] !== E || e[29] !== h || e[30] !== I ? (f = /* @__PURE__ */ U(Qe, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
|
|
490
|
+
E,
|
|
491
|
+
h,
|
|
492
|
+
I
|
|
493
|
+
] }), e[28] = E, e[29] = h, e[30] = I, e[31] = f) : f = e[31], f;
|
|
494
|
+
}
|
|
495
|
+
function Le(t) {
|
|
496
|
+
t.preventDefault();
|
|
497
|
+
}
|
|
498
|
+
function Bn(t, e, i) {
|
|
499
|
+
return t && e && i === "";
|
|
500
|
+
}
|
|
501
|
+
function Hn(t) {
|
|
502
|
+
const e = he(t), i = Y(e, ne);
|
|
503
|
+
return i ? i.getURL() : ne(e) ? e.getURL() : "";
|
|
504
|
+
}
|
|
505
|
+
const ut = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
|
|
506
|
+
function Ve(t) {
|
|
507
|
+
try {
|
|
508
|
+
const e = new URL(t);
|
|
509
|
+
if (!ut.has(e.protocol))
|
|
510
|
+
return "about:blank";
|
|
511
|
+
} catch {
|
|
512
|
+
return t;
|
|
513
|
+
}
|
|
514
|
+
return t;
|
|
515
|
+
}
|
|
516
|
+
function mt(t) {
|
|
517
|
+
try {
|
|
518
|
+
const e = new URL(t);
|
|
519
|
+
return ut.has(e.protocol) ? e.protocol === "http:" || e.protocol === "https:" ? e.hostname !== "" : e.pathname.trim() !== "" : !1;
|
|
520
|
+
} catch {
|
|
521
|
+
return !1;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
const Fn = 8;
|
|
525
|
+
function Kn({
|
|
526
|
+
editor: t,
|
|
527
|
+
isLink: e,
|
|
528
|
+
setIsLink: i,
|
|
529
|
+
anchorElem: o,
|
|
530
|
+
isLinkEditMode: r,
|
|
531
|
+
setIsLinkEditMode: l
|
|
532
|
+
}) {
|
|
533
|
+
const d = j(null), p = j(null), s = j(() => {
|
|
534
|
+
}), [u, m] = M(""), [g, C] = M("https://"), [_, v] = M(null), E = e || r, L = mt(g);
|
|
535
|
+
s.current = () => {
|
|
536
|
+
const f = V();
|
|
537
|
+
if (Q(f)) {
|
|
538
|
+
const T = Hn(f);
|
|
539
|
+
m(T), Bn(r, e, T) && S(), r && T !== "" && C(T);
|
|
540
|
+
}
|
|
541
|
+
const b = d.current, k = window.getSelection(), R = document.activeElement;
|
|
542
|
+
if (b === null)
|
|
543
|
+
return;
|
|
544
|
+
const c = t.getRootElement(), a = k !== null && k.rangeCount > 0;
|
|
545
|
+
if (f !== null && k !== null && a && c?.contains(k.anchorNode) && t.isEditable()) {
|
|
546
|
+
const T = k.getRangeAt(0).getBoundingClientRect(), y = new DOMRect(T.left, T.top, 0, T.height);
|
|
547
|
+
we(y, b, o, Fn, void 0, "above", "viewport"), v(f);
|
|
548
|
+
} else b.contains(R) || (c !== null && we(null, b, o, void 0, void 0, "legacy", "viewport"), v(null), l(!1), m(""));
|
|
549
|
+
}, $(() => {
|
|
550
|
+
const f = o.parentElement, b = () => {
|
|
551
|
+
t.getEditorState().read(() => {
|
|
552
|
+
s.current();
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
return window.addEventListener("resize", b), f && f.addEventListener("scroll", b), () => {
|
|
556
|
+
window.removeEventListener("resize", b), f && f.removeEventListener("scroll", b);
|
|
557
|
+
};
|
|
558
|
+
}, [o.parentElement, t]), $(() => xe(t.registerUpdateListener(({
|
|
559
|
+
editorState: f
|
|
560
|
+
}) => {
|
|
561
|
+
f.read(() => {
|
|
562
|
+
s.current();
|
|
563
|
+
});
|
|
564
|
+
}), t.registerCommand(Ne, () => (s.current(), !0), Ge), t.registerCommand(Ht, () => e ? (i(!1), !0) : !1, Xe)), [t, i, e]), $(() => {
|
|
565
|
+
t.getEditorState().read(() => {
|
|
566
|
+
s.current();
|
|
567
|
+
});
|
|
568
|
+
}, [t]), qt(() => {
|
|
569
|
+
E && t.getEditorState().read(() => {
|
|
570
|
+
s.current();
|
|
571
|
+
});
|
|
572
|
+
}, [t, E]), $(() => {
|
|
573
|
+
r && p.current && p.current.focus();
|
|
574
|
+
}, [r]);
|
|
575
|
+
const h = (f) => {
|
|
576
|
+
f.key === "Enter" ? (f.preventDefault(), I()) : f.key === "Escape" && (f.preventDefault(), S());
|
|
577
|
+
}, S = () => {
|
|
578
|
+
C("https://"), l(!1);
|
|
579
|
+
}, I = () => {
|
|
580
|
+
_ === null || !L || (t.update(() => {
|
|
581
|
+
Ft(_);
|
|
582
|
+
}), t.dispatchCommand(qe, Ve(g)), t.update(() => {
|
|
583
|
+
const f = V();
|
|
584
|
+
if (Q(f)) {
|
|
585
|
+
const b = he(f).getParent();
|
|
586
|
+
if (fe(b)) {
|
|
587
|
+
const k = pn(b.getURL(), {
|
|
588
|
+
rel: b.__rel,
|
|
589
|
+
target: b.__target,
|
|
590
|
+
title: b.__title
|
|
591
|
+
});
|
|
592
|
+
b.replace(k, !0);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}), S());
|
|
596
|
+
};
|
|
597
|
+
return /* @__PURE__ */ n(Re, { ref: d, zIndex: "tooltip", className: `link-editor ${E ? "active" : ""}`, children: /* @__PURE__ */ n(Un, { isActive: E, isLinkEditMode: r, editedLinkUrl: g, editedLinkUrlIsValid: L, linkUrl: u, href: Ve(u), inputRef: p, onEditedLinkUrlChange: C, onInputKeyDown: h, onClose: S, onSubmit: I, onEdit: () => {
|
|
598
|
+
C(u), l(!0);
|
|
599
|
+
}, onRemove: () => {
|
|
600
|
+
t.dispatchCommand(qe, null);
|
|
601
|
+
} }) });
|
|
602
|
+
}
|
|
603
|
+
function Wn(t, e, i, o) {
|
|
604
|
+
const r = J(10), [l, d] = M(t), [p, s] = M(!1);
|
|
605
|
+
let u, m;
|
|
606
|
+
r[0] !== t || r[1] !== o ? (u = () => {
|
|
607
|
+
const C = function() {
|
|
608
|
+
const v = V();
|
|
609
|
+
if (Q(v)) {
|
|
610
|
+
const E = he(v), L = Y(E, ne), h = Y(E, fe);
|
|
611
|
+
if (!(L || h)) {
|
|
612
|
+
s(!1);
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
const S = v.getNodes().filter(Yn).find((I) => {
|
|
616
|
+
const f = Y(I, ne), b = Y(I, fe), k = fe(b) && b.getIsUnlinked();
|
|
617
|
+
return L && !L.is(f) || f && !f.is(L) || h && !h.is(b) || b && (!b.is(h) || k);
|
|
618
|
+
});
|
|
619
|
+
s(!S);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
return xe(t.registerUpdateListener((_) => {
|
|
623
|
+
const {
|
|
624
|
+
editorState: v
|
|
625
|
+
} = _;
|
|
626
|
+
v.read(() => {
|
|
627
|
+
C();
|
|
628
|
+
});
|
|
629
|
+
}), t.registerCommand(Ne, (_, v) => (C(), d(v), !1), je), t.registerCommand(lt, Qn, Ge), t.registerCommand(dt, (_) => (o(_), !0), Ge));
|
|
630
|
+
}, m = [t, o], r[0] = t, r[1] = o, r[2] = u, r[3] = m) : (u = r[2], m = r[3]), $(u, m);
|
|
631
|
+
let g;
|
|
632
|
+
return r[4] !== l || r[5] !== e || r[6] !== p || r[7] !== i || r[8] !== o ? (g = Ze(/* @__PURE__ */ n(Kn, { editor: l, isLink: p, anchorElem: e, setIsLink: s, isLinkEditMode: i, setIsLinkEditMode: o }), document.body), r[4] = l, r[5] = e, r[6] = p, r[7] = i, r[8] = o, r[9] = g) : g = r[9], g;
|
|
633
|
+
}
|
|
634
|
+
function Qn(t) {
|
|
635
|
+
const e = V();
|
|
636
|
+
if (Q(e)) {
|
|
637
|
+
const i = he(e), o = Y(i, ne);
|
|
638
|
+
if (ne(o) && (t.metaKey || t.ctrlKey))
|
|
639
|
+
return window.open(Ve(o.getURL()), "_blank", "noopener,noreferrer"), !0;
|
|
640
|
+
}
|
|
641
|
+
return !1;
|
|
642
|
+
}
|
|
643
|
+
function Yn(t) {
|
|
644
|
+
return !Kt(t);
|
|
645
|
+
}
|
|
646
|
+
function Gn(t) {
|
|
647
|
+
const {
|
|
648
|
+
anchorElem: e
|
|
649
|
+
} = t, i = e === void 0 ? document.body : e, [o, r] = M(!1), [l] = me();
|
|
650
|
+
return Wn(l, i, o, r);
|
|
651
|
+
}
|
|
652
|
+
function qn() {
|
|
653
|
+
const t = J(1);
|
|
654
|
+
let e;
|
|
655
|
+
return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(gn, { validateUrl: mt }), t[0] = e) : e = t[0], e;
|
|
656
|
+
}
|
|
657
|
+
const ot = (t) => t.trim().replace(/\s+/g, " "), Vn = (t, e) => {
|
|
658
|
+
const i = t.map(ot), o = /* @__PURE__ */ new Map(), r = [];
|
|
659
|
+
for (const l of e) {
|
|
660
|
+
const d = ot(l.heading), p = l.occurrence ?? o.get(d) ?? 0;
|
|
661
|
+
o.set(d, p + 1);
|
|
662
|
+
let s = 0;
|
|
663
|
+
for (const [u, m] of i.entries())
|
|
664
|
+
if (m === d) {
|
|
665
|
+
if (s === p) {
|
|
666
|
+
r.push({
|
|
667
|
+
id: l.id,
|
|
668
|
+
headingIndex: u
|
|
669
|
+
});
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
s += 1;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return r.sort((l, d) => l.headingIndex - d.headingIndex);
|
|
676
|
+
}, jn = (t, e) => {
|
|
677
|
+
let o = t[0]?.id;
|
|
678
|
+
for (const r of t) {
|
|
679
|
+
if (r.top > e) break;
|
|
680
|
+
o = r.id;
|
|
681
|
+
}
|
|
682
|
+
return o;
|
|
683
|
+
}, Xn = (t) => {
|
|
684
|
+
let e = t.parentElement;
|
|
685
|
+
for (; e; ) {
|
|
686
|
+
const i = getComputedStyle(e).overflowY;
|
|
687
|
+
if (["auto", "scroll", "overlay"].includes(i)) return e;
|
|
688
|
+
e = e.parentElement;
|
|
689
|
+
}
|
|
690
|
+
return null;
|
|
691
|
+
}, Zn = (t) => {
|
|
692
|
+
const {
|
|
693
|
+
anchors: e,
|
|
694
|
+
targetId: i,
|
|
695
|
+
onActiveSectionChange: o
|
|
696
|
+
} = t, [r] = me(), l = j(o);
|
|
697
|
+
return l.current = o, $(() => {
|
|
698
|
+
let d = () => {
|
|
699
|
+
};
|
|
700
|
+
const p = requestAnimationFrame(() => {
|
|
701
|
+
const s = r.getRootElement();
|
|
702
|
+
if (!s) return;
|
|
703
|
+
const u = Array.from(s.querySelectorAll("h1, h2, h3, h4, h5, h6")), g = Vn(u.map((h) => h.textContent ?? ""), e).map((h) => ({
|
|
704
|
+
id: h.id,
|
|
705
|
+
element: u[h.headingIndex]
|
|
706
|
+
}));
|
|
707
|
+
for (const h of g) h.element.dataset.markdownSectionId = h.id;
|
|
708
|
+
const C = g.find((h) => h.id === i);
|
|
709
|
+
if (!C) {
|
|
710
|
+
console.warn(`[markdown section] Unknown section id: ${i}`), l.current?.(null);
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
C.element.tabIndex = -1, C.element.scrollIntoView({
|
|
714
|
+
block: "start"
|
|
715
|
+
}), C.element.focus({
|
|
716
|
+
preventScroll: !0
|
|
717
|
+
});
|
|
718
|
+
const _ = Xn(s);
|
|
719
|
+
let v;
|
|
720
|
+
const E = () => {
|
|
721
|
+
const h = _?.getBoundingClientRect().top ?? 0, S = jn(g.map((I) => ({
|
|
722
|
+
id: I.id,
|
|
723
|
+
top: I.element.getBoundingClientRect().top - h
|
|
724
|
+
})), 8);
|
|
725
|
+
!S || S === v || (v = S, l.current?.(S));
|
|
726
|
+
}, L = _ ?? window;
|
|
727
|
+
L.addEventListener("scroll", E, {
|
|
728
|
+
passive: !0
|
|
729
|
+
}), E(), d = () => {
|
|
730
|
+
L.removeEventListener("scroll", E);
|
|
731
|
+
};
|
|
732
|
+
});
|
|
733
|
+
return () => {
|
|
734
|
+
cancelAnimationFrame(p), d();
|
|
735
|
+
};
|
|
736
|
+
}, [e, r, i]), null;
|
|
737
|
+
}, Jn = (t) => ({
|
|
738
|
+
columns: [{
|
|
739
|
+
id: `${t}-column-1`,
|
|
740
|
+
label: "Column 1",
|
|
741
|
+
alignment: null
|
|
742
|
+
}, {
|
|
743
|
+
id: `${t}-column-2`,
|
|
744
|
+
label: "Column 2",
|
|
745
|
+
alignment: null
|
|
746
|
+
}],
|
|
747
|
+
rows: [{
|
|
748
|
+
id: `${t}-row-1`,
|
|
749
|
+
cells: {
|
|
750
|
+
[`${t}-column-1`]: "",
|
|
751
|
+
[`${t}-column-2`]: ""
|
|
752
|
+
}
|
|
753
|
+
}]
|
|
754
|
+
}), eo = [{
|
|
755
|
+
id: "table",
|
|
756
|
+
label: "Table",
|
|
757
|
+
icon: ln
|
|
758
|
+
}, {
|
|
759
|
+
id: "image",
|
|
760
|
+
label: "Image",
|
|
761
|
+
icon: cn
|
|
762
|
+
}, {
|
|
763
|
+
id: "code",
|
|
764
|
+
label: "Code block",
|
|
765
|
+
icon: sn
|
|
766
|
+
}, {
|
|
767
|
+
id: "divider",
|
|
768
|
+
label: "Divider",
|
|
769
|
+
icon: an
|
|
770
|
+
}], to = (t) => {
|
|
771
|
+
const e = /^\/([a-z ]*)$/i.exec(t);
|
|
772
|
+
return e ? {
|
|
773
|
+
leadOffset: 0,
|
|
774
|
+
matchingString: e[1] ?? "",
|
|
775
|
+
replaceableString: e[0]
|
|
776
|
+
} : null;
|
|
777
|
+
}, no = () => `table-${globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`}`, We = (t, e) => {
|
|
778
|
+
const i = t?.getParent();
|
|
779
|
+
if (!ct(i)) return;
|
|
780
|
+
i.replace(e);
|
|
781
|
+
const o = Ie();
|
|
782
|
+
e.insertAfter(o), o.select();
|
|
783
|
+
}, oo = (t) => {
|
|
784
|
+
const e = J(18), {
|
|
785
|
+
options: i,
|
|
786
|
+
selectedIndex: o,
|
|
787
|
+
onSelect: r,
|
|
788
|
+
onHighlight: l
|
|
789
|
+
} = t;
|
|
790
|
+
let d, p;
|
|
791
|
+
e[0] !== o ? (d = () => {
|
|
792
|
+
document.getElementById(`slash-command-${o}`)?.scrollIntoView({
|
|
793
|
+
block: "nearest"
|
|
794
|
+
});
|
|
795
|
+
}, p = [o], e[0] = o, e[1] = d, e[2] = p) : (d = e[1], p = e[2]), $(d, p);
|
|
796
|
+
let s;
|
|
797
|
+
e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ n(Z, { paddingX: "sm", paddingY: "2xs", color: "fg.muted", textStyle: "label/S/medium", children: "Insert" }), e[3] = s) : s = e[3];
|
|
798
|
+
let u;
|
|
799
|
+
e[4] !== i.length ? (u = i.length === 0 ? /* @__PURE__ */ n(Z, { padding: "sm", color: "fg.muted", textStyle: "paragraph/S/regular", children: "No matching commands" }) : null, e[4] = i.length, e[5] = u) : u = e[5];
|
|
800
|
+
let m;
|
|
801
|
+
if (e[6] !== l || e[7] !== r || e[8] !== i || e[9] !== o) {
|
|
802
|
+
let C;
|
|
803
|
+
e[11] !== l || e[12] !== r || e[13] !== o ? (C = (_, v) => {
|
|
804
|
+
const E = o === v;
|
|
805
|
+
return /* @__PURE__ */ U(Te, { ref: _.setRefElement, id: `slash-command-${v}`, role: "option", "aria-selected": E, alignItems: "center", gap: "xs", paddingX: "sm", paddingY: "xs", cursor: "pointer", background: E ? "bg.active" : "transparent", _hover: {
|
|
806
|
+
background: E ? "bg.active" : "bg.hover"
|
|
807
|
+
}, onMouseEnter: () => l(v), onPointerDown: ro, onClick: () => r(_, v), children: [
|
|
808
|
+
/* @__PURE__ */ n(wt, { as: _.icon, boxSize: "16px", flexShrink: 0 }),
|
|
809
|
+
/* @__PURE__ */ n(Z, { minWidth: "0", truncate: !0, textStyle: "label/M/medium", children: _.label })
|
|
810
|
+
] }, _.id);
|
|
811
|
+
}, e[11] = l, e[12] = r, e[13] = o, e[14] = C) : C = e[14], m = i.map(C), e[6] = l, e[7] = r, e[8] = i, e[9] = o, e[10] = m;
|
|
812
|
+
} else
|
|
813
|
+
m = e[10];
|
|
814
|
+
let g;
|
|
815
|
+
return e[15] !== u || e[16] !== m ? (g = /* @__PURE__ */ U(Re, { role: "listbox", "aria-label": "Insert content", position: "absolute", zIndex: "popover", layerStyle: "modal", minWidth: "13rem", overflow: "hidden", paddingY: "2xs", children: [
|
|
816
|
+
s,
|
|
817
|
+
u,
|
|
818
|
+
m
|
|
819
|
+
] }), e[15] = u, e[16] = m, e[17] = g) : g = e[17], g;
|
|
820
|
+
}, io = () => {
|
|
821
|
+
const t = J(52), [e] = me(), [i, o] = M(null), [r, l] = M(null), [d, p] = M(""), [s, u] = M("Image");
|
|
822
|
+
let m;
|
|
823
|
+
t[0] !== i ? (m = eo.filter((x) => !i || x.label.toLowerCase().includes(i.toLowerCase())).map(co), t[0] = i, t[1] = m) : m = t[1];
|
|
824
|
+
const g = m;
|
|
825
|
+
let C;
|
|
826
|
+
t[2] !== e || t[3] !== r ? (C = () => {
|
|
827
|
+
r && e.update(() => {
|
|
828
|
+
const x = et(r);
|
|
829
|
+
if (tt(x)) {
|
|
830
|
+
const z = x.getParent();
|
|
831
|
+
x.remove(), z?.selectEnd();
|
|
832
|
+
}
|
|
833
|
+
}, {
|
|
834
|
+
tag: Ue
|
|
835
|
+
}), l(null), setTimeout(() => e.focus(), 0);
|
|
836
|
+
}, t[2] = e, t[3] = r, t[4] = C) : C = t[4];
|
|
837
|
+
const _ = C;
|
|
838
|
+
let v;
|
|
839
|
+
t[5] !== e || t[6] !== s || t[7] !== r || t[8] !== d ? (v = (x) => {
|
|
840
|
+
x.preventDefault(), !(!r || !d.trim()) && (e.update(() => {
|
|
841
|
+
const z = et(r);
|
|
842
|
+
if (tt(z)) {
|
|
843
|
+
const W = ft(d.trim(), s.trim() || "Image"), te = z.getParent();
|
|
844
|
+
if (z.replace(W), ct(te)) {
|
|
845
|
+
const X = Ie();
|
|
846
|
+
te.insertAfter(X), X.select();
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}, {
|
|
850
|
+
tag: Ue
|
|
851
|
+
}), l(null), setTimeout(() => e.focus(), 0));
|
|
852
|
+
}, t[5] = e, t[6] = s, t[7] = r, t[8] = d, t[9] = v) : v = t[9];
|
|
853
|
+
const E = v;
|
|
854
|
+
let L;
|
|
855
|
+
t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (L = (x, z, W) => {
|
|
856
|
+
if (x.id === "image") {
|
|
857
|
+
p(""), u("Image"), l(z?.getKey() ?? null), W();
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
st(Ue), x.id === "table" && We(z, ht(Jn(no()))), x.id === "code" && We(z, un()), x.id === "divider" && We(z, mn()), W();
|
|
861
|
+
}, t[10] = L) : L = t[10];
|
|
862
|
+
let h;
|
|
863
|
+
t[11] !== g ? (h = /* @__PURE__ */ n(fn, { onQueryChange: o, triggerFn: to, options: g, onSelectOption: L, menuRenderFn: so }), t[11] = g, t[12] = h) : h = t[12];
|
|
864
|
+
const S = !!r;
|
|
865
|
+
let I;
|
|
866
|
+
t[13] !== e ? (I = () => e.getRootElement(), t[13] = e, t[14] = I) : I = t[14];
|
|
867
|
+
let f;
|
|
868
|
+
t[15] !== _ || t[16] !== r ? (f = (x) => {
|
|
869
|
+
!x.open && r && _();
|
|
870
|
+
}, t[15] = _, t[16] = r, t[17] = f) : f = t[17];
|
|
871
|
+
let b;
|
|
872
|
+
t[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ n(ee.Backdrop, {}), t[18] = b) : b = t[18];
|
|
873
|
+
let k;
|
|
874
|
+
t[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ n(ee.Header, { children: /* @__PURE__ */ n(ee.Title, { children: "Insert image" }) }), t[19] = k) : k = t[19];
|
|
875
|
+
let R;
|
|
876
|
+
t[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ n(Se.Label, { children: "Image URL" }), t[20] = R) : R = t[20];
|
|
877
|
+
let c;
|
|
878
|
+
t[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = (x) => p(x.target.value), t[21] = c) : c = t[21];
|
|
879
|
+
let a;
|
|
880
|
+
t[22] !== d ? (a = /* @__PURE__ */ U(Se.Root, { required: !0, children: [
|
|
881
|
+
R,
|
|
882
|
+
/* @__PURE__ */ n(Ye, { autoFocus: !0, value: d, onChange: c })
|
|
883
|
+
] }), t[22] = d, t[23] = a) : a = t[23];
|
|
884
|
+
let T;
|
|
885
|
+
t[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ n(Se.Label, { children: "Alt text" }), t[24] = T) : T = t[24];
|
|
886
|
+
let y;
|
|
887
|
+
t[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = (x) => u(x.target.value), t[25] = y) : y = t[25];
|
|
888
|
+
let w;
|
|
889
|
+
t[26] !== s ? (w = /* @__PURE__ */ U(Se.Root, { children: [
|
|
890
|
+
T,
|
|
891
|
+
/* @__PURE__ */ n(Ye, { value: s, onChange: y })
|
|
892
|
+
] }), t[26] = s, t[27] = w) : w = t[27];
|
|
893
|
+
let N;
|
|
894
|
+
t[28] !== a || t[29] !== w ? (N = /* @__PURE__ */ n(ee.Body, { children: /* @__PURE__ */ U(Te, { direction: "column", gap: "sm", children: [
|
|
895
|
+
a,
|
|
896
|
+
w
|
|
897
|
+
] }) }), t[28] = a, t[29] = w, t[30] = N) : N = t[30];
|
|
898
|
+
let D;
|
|
899
|
+
t[31] !== _ ? (D = /* @__PURE__ */ n(Je, { type: "button", variant: "ghost", onClick: _, children: "Cancel" }), t[31] = _, t[32] = D) : D = t[32];
|
|
900
|
+
let P;
|
|
901
|
+
t[33] !== d ? (P = d.trim(), t[33] = d, t[34] = P) : P = t[34];
|
|
902
|
+
const G = !P;
|
|
903
|
+
let B;
|
|
904
|
+
t[35] !== G ? (B = /* @__PURE__ */ n(Je, { type: "submit", variant: "primary", disabled: G, children: "Insert image" }), t[35] = G, t[36] = B) : B = t[36];
|
|
905
|
+
let q;
|
|
906
|
+
t[37] !== D || t[38] !== B ? (q = /* @__PURE__ */ U(ee.Footer, { children: [
|
|
907
|
+
D,
|
|
908
|
+
B
|
|
909
|
+
] }), t[37] = D, t[38] = B, t[39] = q) : q = t[39];
|
|
910
|
+
let H;
|
|
911
|
+
t[40] !== E || t[41] !== N || t[42] !== q ? (H = /* @__PURE__ */ n(ee.Positioner, { children: /* @__PURE__ */ n(ee.Content, { asChild: !0, children: /* @__PURE__ */ U("form", { onSubmit: E, children: [
|
|
912
|
+
k,
|
|
913
|
+
N,
|
|
914
|
+
q
|
|
915
|
+
] }) }) }), t[40] = E, t[41] = N, t[42] = q, t[43] = H) : H = t[43];
|
|
916
|
+
let F;
|
|
917
|
+
t[44] !== H || t[45] !== S || t[46] !== I || t[47] !== f ? (F = /* @__PURE__ */ U(ee.Root, { open: S, finalFocusEl: I, onOpenChange: f, children: [
|
|
918
|
+
b,
|
|
919
|
+
H
|
|
920
|
+
] }), t[44] = H, t[45] = S, t[46] = I, t[47] = f, t[48] = F) : F = t[48];
|
|
921
|
+
let K;
|
|
922
|
+
return t[49] !== F || t[50] !== h ? (K = /* @__PURE__ */ U(rt, { children: [
|
|
923
|
+
h,
|
|
924
|
+
F
|
|
925
|
+
] }), t[49] = F, t[50] = h, t[51] = K) : K = t[51], K;
|
|
926
|
+
};
|
|
927
|
+
function ro(t) {
|
|
928
|
+
return t.preventDefault();
|
|
929
|
+
}
|
|
930
|
+
function lo() {
|
|
931
|
+
}
|
|
932
|
+
function co(t) {
|
|
933
|
+
return {
|
|
934
|
+
...t,
|
|
935
|
+
key: t.id,
|
|
936
|
+
setRefElement: lo
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
function so(t, e) {
|
|
940
|
+
return t.current ? dn.createPortal(/* @__PURE__ */ n(oo, { options: e.options, selectedIndex: e.selectedIndex, onHighlight: e.setHighlightedIndex, onSelect: (i, o) => {
|
|
941
|
+
e.setHighlightedIndex(o), e.selectOptionAndCleanUp(i);
|
|
942
|
+
} }), t.current) : null;
|
|
943
|
+
}
|
|
944
|
+
const ao = () => {
|
|
945
|
+
const [t] = me(), [e] = M(() => ({
|
|
946
|
+
current: {
|
|
947
|
+
editor: t,
|
|
948
|
+
editorState: t.getEditorState()
|
|
949
|
+
},
|
|
950
|
+
redoStack: [],
|
|
951
|
+
undoStack: []
|
|
952
|
+
}));
|
|
953
|
+
return $(() => {
|
|
954
|
+
e.current = {
|
|
955
|
+
editor: t,
|
|
956
|
+
editorState: t.getEditorState()
|
|
957
|
+
};
|
|
958
|
+
}, [t, e]), $(() => t.registerCommand(Wt, (i) => {
|
|
959
|
+
const o = i.target;
|
|
960
|
+
return o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || !i.ctrlKey && !i.metaKey || i.key.toLowerCase() !== "z" ? !1 : (i.preventDefault(), t.dispatchCommand(i.shiftKey ? Qt : Yt, void 0), !0);
|
|
961
|
+
}, Xe), [t]), /* @__PURE__ */ n(hn, { externalHistoryState: e });
|
|
962
|
+
}, it = "markdown-initial-import";
|
|
963
|
+
function uo(t) {
|
|
964
|
+
const {
|
|
965
|
+
autoFocus: e = !1,
|
|
966
|
+
debug: i = !1,
|
|
967
|
+
defaultState: o = "",
|
|
968
|
+
fullWidth: r = !1,
|
|
969
|
+
isEditable: l = !1,
|
|
970
|
+
padding: d = "sm",
|
|
971
|
+
placeholder: p,
|
|
972
|
+
scrollable: s = !0,
|
|
973
|
+
sectionNavigation: u,
|
|
974
|
+
resolveMarkdownUrl: m,
|
|
975
|
+
onActiveSectionChange: g,
|
|
976
|
+
onChange: C
|
|
977
|
+
} = t, {
|
|
978
|
+
frontmatter: _,
|
|
979
|
+
body: v
|
|
980
|
+
} = gt(o), E = l && !!C, L = j(null), h = j(null);
|
|
981
|
+
h.current ??= pt(v, m);
|
|
982
|
+
const S = h.current, [I, f] = M(null);
|
|
983
|
+
return $(() => {
|
|
984
|
+
f(L.current);
|
|
985
|
+
}, []), /* @__PURE__ */ n(Te, { ref: L, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: s ? "100%" : "auto", position: "relative", direction: "column", overflow: "visible", children: /* @__PURE__ */ n(Ct, { resolver: m, children: /* @__PURE__ */ U(xt, { initialConfig: {
|
|
986
|
+
namespace: "MARKDOWN_EDITOR",
|
|
987
|
+
nodes: vt,
|
|
988
|
+
editorState: () => {
|
|
989
|
+
st(it), S.importToLexical();
|
|
990
|
+
},
|
|
991
|
+
onError: (k) => console.error(k),
|
|
992
|
+
editable: l,
|
|
993
|
+
theme: bt
|
|
994
|
+
}, children: [
|
|
995
|
+
l ? /* @__PURE__ */ n(io, {}) : null,
|
|
996
|
+
u ? /* @__PURE__ */ n(Zn, { anchors: u.anchors, targetId: u.targetId, onActiveSectionChange: g }) : null,
|
|
997
|
+
e ? /* @__PURE__ */ n(Rt, {}) : null,
|
|
998
|
+
/* @__PURE__ */ n(ao, {}),
|
|
999
|
+
/* @__PURE__ */ n(qn, {}),
|
|
1000
|
+
/* @__PURE__ */ n(Pt, {}),
|
|
1001
|
+
l ? /* @__PURE__ */ n(zt, { maxIndent: 7 }) : null,
|
|
1002
|
+
/* @__PURE__ */ n(Nt, {}),
|
|
1003
|
+
l ? /* @__PURE__ */ n(At, { transformers: _t }) : null,
|
|
1004
|
+
/* @__PURE__ */ n(Dt, {}),
|
|
1005
|
+
/* @__PURE__ */ n(Et, {}),
|
|
1006
|
+
/* @__PURE__ */ n(St, {}),
|
|
1007
|
+
/* @__PURE__ */ n(Tn, { anchorElem: I }),
|
|
1008
|
+
/* @__PURE__ */ n(kt, {}),
|
|
1009
|
+
/* @__PURE__ */ n($t, { contentEditable: /* @__PURE__ */ n(yt, { fullWidth: r, padding: d, scrollable: s }), placeholder: p ? /* @__PURE__ */ n(Te, { position: "absolute", padding: "sm", top: "0", left: "0", right: "0", pointerEvents: "none", userSelect: "none", justifyContent: "center", children: /* @__PURE__ */ n(Re, { width: "100%", maxWidth: "45rem", color: "fg.muted", textStyle: "paragraph/M/regular", children: p }) }) : null, ErrorBoundary: Mt }),
|
|
1010
|
+
l && I ? /* @__PURE__ */ U(rt, { children: [
|
|
1011
|
+
/* @__PURE__ */ n(zn, { anchorElem: I }),
|
|
1012
|
+
/* @__PURE__ */ n(Gn, { anchorElem: I })
|
|
1013
|
+
] }) : null,
|
|
1014
|
+
E ? /* @__PURE__ */ n(Ot, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (k, R, c) => {
|
|
1015
|
+
c.has(it) || k.read(() => {
|
|
1016
|
+
const a = Gt(), T = S.exportFromLexical(a);
|
|
1017
|
+
C?.(_ + T);
|
|
1018
|
+
});
|
|
1019
|
+
} }) : null,
|
|
1020
|
+
/* @__PURE__ */ n(Lt, { isEditable: l }),
|
|
1021
|
+
i && /* @__PURE__ */ n(Tt, {})
|
|
1022
|
+
] }) }) });
|
|
1023
|
+
}
|
|
1024
|
+
const Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1025
|
+
__proto__: null,
|
|
1026
|
+
MarkdownEditor: uo
|
|
1027
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1028
|
+
export {
|
|
1029
|
+
Tn as C,
|
|
1030
|
+
zn as F,
|
|
1031
|
+
uo as M,
|
|
1032
|
+
Fo as m
|
|
1033
|
+
};
|
|
1034
|
+
//# sourceMappingURL=markdown-editor-CsJ4KNGu.js.map
|