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