@pstdio/ui 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{MermaidComponent-BCMQqPqu.js → MermaidComponent-BPiVFNYK.js} +2 -2
- package/dist/{MermaidComponent-BCMQqPqu.js.map → MermaidComponent-BPiVFNYK.js.map} +1 -1
- package/dist/chat-ui.js +2 -2
- package/dist/components/data-table/data-table-column-menu.d.ts +4 -1
- package/dist/components/data-table/data-table-header.d.ts +0 -8
- package/dist/components/data-table/editable-cells-story.d.ts +9 -0
- package/dist/components/diff-viewer/code-editor.d.ts +2 -0
- package/dist/components/diff-viewer/index.d.ts +1 -1
- package/dist/components/diff-viewer/monaco-browser.d.ts +1 -0
- package/dist/components/overlays/searchable-menu-input.d.ts +9 -0
- package/dist/components/param-editor/index.d.ts +5 -2
- package/dist/components/param-editor/inputs/action-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/boolean-input.d.ts +13 -0
- package/dist/components/param-editor/inputs/color-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/date-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/file-upload-input.d.ts +15 -0
- package/dist/components/param-editor/inputs/file-upload-value.d.ts +7 -0
- package/dist/components/param-editor/inputs/horizontal-text-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/markdown-input.d.ts +13 -0
- package/dist/components/param-editor/inputs/number-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/range-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/resource-input.d.ts +2 -0
- package/dist/components/param-editor/inputs/segmented-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/selection-input.d.ts +1 -0
- package/dist/components/param-editor/inputs/selection-menu.d.ts +4 -0
- package/dist/components/param-editor/inputs/text-input.d.ts +1 -0
- package/dist/components/param-editor/param-editor-advanced-field.d.ts +14 -0
- package/dist/components/param-editor/param-editor-control-fixtures.d.ts +24 -0
- package/dist/components/param-editor/param-editor-field.d.ts +2 -0
- package/dist/components/param-editor/param-editor-horizontal.d.ts +2 -2
- package/dist/components/param-editor/param-editor-label.d.ts +1 -0
- package/dist/components/param-editor/param-editor-presentation.d.ts +3 -0
- package/dist/components/param-editor/param-editor.types.d.ts +25 -13
- package/dist/components/param-editor/resolve-param-value.d.ts +2 -0
- package/dist/components/primitives/chip.d.ts +4 -0
- package/dist/components/primitives/index.d.ts +2 -0
- package/dist/components/primitives/resource-badge.d.ts +12 -10
- package/dist/components/rich-text/index.d.ts +1 -0
- package/dist/components/rich-text/lazy-markdown-editor.d.ts +2 -0
- package/dist/components/rich-text/utils/inferResourceType.d.ts +1 -1
- package/dist/data-table.js +960 -910
- package/dist/data-table.js.map +1 -1
- package/dist/diff.js +370 -366
- package/dist/diff.js.map +1 -1
- package/dist/font/css/prompt-studio-icons.css +690 -0
- package/dist/font/prompt-studio-icons.eot +0 -0
- package/dist/font/prompt-studio-icons.svg +1 -0
- package/dist/font/prompt-studio-icons.ttf +0 -0
- package/dist/font/prompt-studio-icons.woff +0 -0
- package/dist/font/prompt-studio-icons.woff2 +0 -0
- package/dist/index.js +895 -947
- package/dist/index.js.map +1 -1
- package/dist/{kanban-renderer-toolbar-B9ro-9z1.js → kanban-renderer-toolbar-Db1mIWWd.js} +3 -3
- package/dist/{kanban-renderer-toolbar-B9ro-9z1.js.map → kanban-renderer-toolbar-Db1mIWWd.js.map} +1 -1
- package/dist/kanban-renderer.js +831 -817
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/lazy-markdown-editor-DwhqQ-NN.js +26 -0
- package/dist/lazy-markdown-editor-DwhqQ-NN.js.map +1 -0
- package/dist/{list-row-YRUxEcy3.js → list-row-BYWwcbGK.js} +286 -271
- package/dist/list-row-BYWwcbGK.js.map +1 -0
- package/dist/markdown-DDd2ESoH.js +743 -0
- package/dist/markdown-DDd2ESoH.js.map +1 -0
- package/dist/markdown-editor-CYVkzt8t.js +741 -0
- package/dist/markdown-editor-CYVkzt8t.js.map +1 -0
- package/dist/monaco-browser-CO0NxK_Z.js +19 -0
- package/dist/monaco-browser-CO0NxK_Z.js.map +1 -0
- package/dist/param-editor-BCZOw5Gt.js +140 -0
- package/dist/param-editor-BCZOw5Gt.js.map +1 -0
- package/dist/param-editor-field-ZzZwgjZ_.js +2094 -0
- package/dist/param-editor-field-ZzZwgjZ_.js.map +1 -0
- package/dist/resource-badge-CuItchgL.js +98 -0
- package/dist/resource-badge-CuItchgL.js.map +1 -0
- package/dist/rich-message--eRzjWYK.js +730 -0
- package/dist/rich-message--eRzjWYK.js.map +1 -0
- package/dist/rich-text.js +114 -827
- package/dist/rich-text.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/theme/primitives/fonts.d.ts +3 -0
- package/dist/theme/recipes/badge.d.ts +8 -0
- package/dist/theme/recipes/color-picker.d.ts +18 -1
- package/dist/theme/recipes/switch.d.ts +17 -0
- package/dist/{theme-CNhnbvcE.js → theme-poQlUgt0.js} +284 -156
- package/dist/theme-poQlUgt0.js.map +1 -0
- package/dist/theme.js +1 -1
- package/dist/{tree-list-CZHLAURU.js → tree-list-BAja2eXU.js} +2 -2
- package/dist/{tree-list-CZHLAURU.js.map → tree-list-BAja2eXU.js.map} +1 -1
- package/package.json +2 -1
- package/dist/components/param-editor/inputs/file-accept.d.ts +0 -22
- package/dist/components/param-editor/inputs/file-drop-input.d.ts +0 -14
- package/dist/list-row-YRUxEcy3.js.map +0 -1
- package/dist/param-editor-CYZJbmKu.js +0 -933
- package/dist/param-editor-CYZJbmKu.js.map +0 -1
- package/dist/param-editor-read-only-field-DgtLqcFa.js +0 -925
- package/dist/param-editor-read-only-field-DgtLqcFa.js.map +0 -1
- package/dist/prism-BXb57lxL.js +0 -125
- package/dist/prism-BXb57lxL.js.map +0 -1
- package/dist/resource-badge-qCWHP-wQ.js +0 -99
- package/dist/resource-badge-qCWHP-wQ.js.map +0 -1
- package/dist/rich-message-DBf_5YlW.js +0 -1450
- package/dist/rich-message-DBf_5YlW.js.map +0 -1
- package/dist/theme-CNhnbvcE.js.map +0 -1
|
@@ -0,0 +1,741 @@
|
|
|
1
|
+
import { jsx as n, jsxs as ge, Fragment as Xe } from "react/jsx-runtime";
|
|
2
|
+
import { c as oe } from "react/compiler-runtime";
|
|
3
|
+
import { s as Qe, n as Ze, d as Re, e as Je, a as et, C as tt, I as nt, E as ot, b as it, T as lt, f as rt } from "./markdown-DDd2ESoH.js";
|
|
4
|
+
import { IconButton as I, Text as ue, Stack as Pe, Input as st, Link as ct, Box as Ke, Flex as Ue } from "@chakra-ui/react";
|
|
5
|
+
import { $convertFromMarkdownString as at, $convertToMarkdownString as dt } from "@lexical/markdown";
|
|
6
|
+
import { AutoFocusPlugin as ft } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
7
|
+
import { CheckListPlugin as ut } from "@lexical/react/LexicalCheckListPlugin";
|
|
8
|
+
import { LexicalComposer as mt } from "@lexical/react/LexicalComposer";
|
|
9
|
+
import { LexicalErrorBoundary as ht } from "@lexical/react/LexicalErrorBoundary";
|
|
10
|
+
import { HistoryPlugin as gt } from "@lexical/react/LexicalHistoryPlugin";
|
|
11
|
+
import { HorizontalRulePlugin as pt } from "@lexical/react/LexicalHorizontalRulePlugin";
|
|
12
|
+
import { ListPlugin as Ct } from "@lexical/react/LexicalListPlugin";
|
|
13
|
+
import { MarkdownShortcutPlugin as _t } from "@lexical/react/LexicalMarkdownShortcutPlugin";
|
|
14
|
+
import { OnChangePlugin as bt } from "@lexical/react/LexicalOnChangePlugin";
|
|
15
|
+
import { RichTextPlugin as vt } from "@lexical/react/LexicalRichTextPlugin";
|
|
16
|
+
import { TabIndentationPlugin as kt } from "@lexical/react/LexicalTabIndentationPlugin";
|
|
17
|
+
import { SELECTION_CHANGE_COMMAND as Le, COMMAND_PRIORITY_CRITICAL as Be, $getSelection as J, $isRangeSelection as Y, createCommand as Et, FORMAT_TEXT_COMMAND as Ne, $isRootOrShadowRoot as Lt, CLICK_COMMAND as We, COMMAND_PRIORITY_HIGH as Ge, $createParagraphNode as He, COMMAND_PRIORITY_LOW as Me, KEY_ESCAPE_COMMAND as St, $isLineBreakNode as yt, $setSelection as Tt, $getRoot as Rt } from "lexical";
|
|
18
|
+
import { useState as M, useRef as ie, useEffect as q, useLayoutEffect as Nt } from "react";
|
|
19
|
+
import { useLexicalComposerContext as De } from "@lexical/react/LexicalComposerContext";
|
|
20
|
+
import { mergeRegister as Se, $findMatchingParent as X } from "@lexical/utils";
|
|
21
|
+
import { Check as je, Copy as wt, Link as xt, Code2 as It, List as Ot, ListOrdered as Pt, ListTodo as Mt, X as zt, Pencil as At, Trash2 as Bt } from "lucide-react";
|
|
22
|
+
import { createPortal as $e } from "react-dom";
|
|
23
|
+
import { T as O } from "./scroll-area-BMbg1WcD.js";
|
|
24
|
+
import { $isCodeNode as we, $createCodeNode as Dt } from "@lexical/code";
|
|
25
|
+
import { LinkPlugin as $t } from "@lexical/react/LexicalLinkPlugin";
|
|
26
|
+
import { $isLinkNode as le, $isAutoLinkNode as he, TOGGLE_LINK_COMMAND as ze, $createLinkNode as Ut } from "@lexical/link";
|
|
27
|
+
import { $isListNode as xe, REMOVE_LIST_COMMAND as Ht, INSERT_CHECK_LIST_COMMAND as Ft, INSERT_ORDERED_LIST_COMMAND as Kt, INSERT_UNORDERED_LIST_COMMAND as Wt } from "@lexical/list";
|
|
28
|
+
import { $isHeadingNode as Gt, $createHeadingNode as jt } from "@lexical/rich-text";
|
|
29
|
+
import { $isAtNodeEnd as Fe, $setBlocksType as ve } from "@lexical/selection";
|
|
30
|
+
function Ie(t) {
|
|
31
|
+
const e = J();
|
|
32
|
+
if (!Y(e))
|
|
33
|
+
return null;
|
|
34
|
+
const r = e.anchor.getNode(), o = we(r) ? r : X(r, (f) => we(f));
|
|
35
|
+
if (!we(o))
|
|
36
|
+
return null;
|
|
37
|
+
const l = t.getElementByKey(o.getKey());
|
|
38
|
+
return l instanceof HTMLElement ? l : null;
|
|
39
|
+
}
|
|
40
|
+
function Vt(t) {
|
|
41
|
+
return t instanceof HTMLElement ? t.closest(".rich-text__code") : null;
|
|
42
|
+
}
|
|
43
|
+
function Yt(t, e) {
|
|
44
|
+
const r = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
45
|
+
return {
|
|
46
|
+
top: o.top - r.top + 6,
|
|
47
|
+
left: o.right - r.left - 30
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function qt(t) {
|
|
51
|
+
const e = oe(31), {
|
|
52
|
+
anchorElem: r
|
|
53
|
+
} = t, [o] = De(), [l, f] = M(null), [k, h] = M(!1), c = ie(null);
|
|
54
|
+
let g, b;
|
|
55
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = () => () => {
|
|
56
|
+
c.current !== null && window.clearTimeout(c.current);
|
|
57
|
+
}, b = [], e[0] = g, e[1] = b) : (g = e[0], b = e[1]), q(g, b);
|
|
58
|
+
let p, a;
|
|
59
|
+
e[2] !== o ? (p = () => {
|
|
60
|
+
const _ = o.getRootElement();
|
|
61
|
+
if (!_)
|
|
62
|
+
return;
|
|
63
|
+
const w = (P) => {
|
|
64
|
+
const z = Vt(P.target);
|
|
65
|
+
f(z instanceof HTMLElement ? z : null);
|
|
66
|
+
}, x = () => {
|
|
67
|
+
o.getEditorState().read(() => {
|
|
68
|
+
const P = Ie(o);
|
|
69
|
+
f(P);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return _.addEventListener("pointermove", w), _.addEventListener("pointerleave", x), () => {
|
|
73
|
+
_.removeEventListener("pointermove", w), _.removeEventListener("pointerleave", x);
|
|
74
|
+
};
|
|
75
|
+
}, a = [o], e[2] = o, e[3] = p, e[4] = a) : (p = e[3], a = e[4]), q(p, a);
|
|
76
|
+
let L, S;
|
|
77
|
+
if (e[5] !== o ? (L = () => Se(o.registerUpdateListener((_) => {
|
|
78
|
+
const {
|
|
79
|
+
editorState: w
|
|
80
|
+
} = _;
|
|
81
|
+
w.read(() => {
|
|
82
|
+
const x = Ie(o);
|
|
83
|
+
x && f(x);
|
|
84
|
+
});
|
|
85
|
+
}), o.registerCommand(Le, () => (o.getEditorState().read(() => {
|
|
86
|
+
const _ = Ie(o);
|
|
87
|
+
if (!_) {
|
|
88
|
+
f(Xt);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
f(_);
|
|
92
|
+
}), !1), Be)), S = [o], e[5] = o, e[6] = L, e[7] = S) : (L = e[6], S = e[7]), q(L, S), !r || !l)
|
|
93
|
+
return null;
|
|
94
|
+
let d;
|
|
95
|
+
e[8] !== l || e[9] !== r ? (d = Yt(r, l), e[8] = l, e[9] = r, e[10] = d) : d = e[10];
|
|
96
|
+
const R = d;
|
|
97
|
+
let v;
|
|
98
|
+
e[11] !== R.left || e[12] !== R.top ? (v = {
|
|
99
|
+
position: "absolute",
|
|
100
|
+
top: R.top,
|
|
101
|
+
left: R.left
|
|
102
|
+
}, e[11] = R.left, e[12] = R.top, e[13] = v) : v = e[13];
|
|
103
|
+
const y = v, C = k ? "Copied" : "Copy code", u = k ? "Copied" : "Copy code";
|
|
104
|
+
let i;
|
|
105
|
+
e[14] !== l.textContent ? (i = async () => {
|
|
106
|
+
const _ = l.textContent ?? "";
|
|
107
|
+
try {
|
|
108
|
+
await navigator.clipboard.writeText(_), h(!0), c.current !== null && window.clearTimeout(c.current), c.current = window.setTimeout(() => {
|
|
109
|
+
h(!1);
|
|
110
|
+
}, 1200);
|
|
111
|
+
} catch {
|
|
112
|
+
h(!1);
|
|
113
|
+
}
|
|
114
|
+
}, e[14] = l.textContent, e[15] = i) : i = e[15];
|
|
115
|
+
let s;
|
|
116
|
+
e[16] !== k ? (s = k ? /* @__PURE__ */ n(je, { size: 14 }) : /* @__PURE__ */ n(wt, { size: 14 }), e[16] = k, e[17] = s) : s = e[17];
|
|
117
|
+
let m;
|
|
118
|
+
e[18] !== u || e[19] !== i || e[20] !== s ? (m = /* @__PURE__ */ n(I, { "aria-label": u, variant: "subtle", size: "xs", onClick: i, children: s }), e[18] = u, e[19] = i, e[20] = s, e[21] = m) : m = e[21];
|
|
119
|
+
let T;
|
|
120
|
+
e[22] !== m || e[23] !== C ? (T = /* @__PURE__ */ n(O, { content: C, children: m }), e[22] = m, e[23] = C, e[24] = T) : T = e[24];
|
|
121
|
+
let E;
|
|
122
|
+
e[25] !== y || e[26] !== T ? (E = /* @__PURE__ */ n("div", { className: "code-block-actions", style: y, children: T }), e[25] = y, e[26] = T, e[27] = E) : E = e[27];
|
|
123
|
+
let N;
|
|
124
|
+
return e[28] !== r || e[29] !== E ? (N = $e(E, r), e[28] = r, e[29] = E, e[30] = N) : N = e[30], N;
|
|
125
|
+
}
|
|
126
|
+
function Xt(t) {
|
|
127
|
+
return t?.matches(":hover") ? t : null;
|
|
128
|
+
}
|
|
129
|
+
const Ve = Et("TOGGLE_LINK_EDIT_MODE_COMMAND");
|
|
130
|
+
function pe(t) {
|
|
131
|
+
const e = t.anchor, r = t.focus, o = t.anchor.getNode(), l = t.focus.getNode();
|
|
132
|
+
return o === l ? o : t.isBackward() ? Fe(r) ? o : l : Fe(e) ? o : l;
|
|
133
|
+
}
|
|
134
|
+
const Qt = 10, Zt = 5;
|
|
135
|
+
function Ee(t, e, r, o = Qt, l = Zt, f = "legacy") {
|
|
136
|
+
const k = r.parentElement;
|
|
137
|
+
if (t === null || !k) {
|
|
138
|
+
e.style.opacity = "0", e.style.transform = "translate(-10000px, -10000px)";
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const h = e.getBoundingClientRect(), c = r.getBoundingClientRect(), g = k.getBoundingClientRect();
|
|
142
|
+
let b = f === "above" ? t.top - h.height - o : t.top - o, p = t.left - l;
|
|
143
|
+
b < g.top && (b = f === "above" ? t.bottom + o : b + h.height + t.height + o * 2), p + h.width > g.right && (p = g.right - h.width - l), b -= c.top, p -= c.left, e.style.opacity = "1", e.style.transform = `translate(${p}px, ${b}px)`;
|
|
144
|
+
}
|
|
145
|
+
function Oe() {
|
|
146
|
+
const t = oe(1);
|
|
147
|
+
let e;
|
|
148
|
+
return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n("span", { style: {
|
|
149
|
+
display: "inline-flex",
|
|
150
|
+
height: "1rem",
|
|
151
|
+
margin: "0 0.25rem",
|
|
152
|
+
borderLeft: "1px solid var(--chakra-colors-border-subtle)"
|
|
153
|
+
} }), t[0] = e) : e = t[0], e;
|
|
154
|
+
}
|
|
155
|
+
function Jt(t) {
|
|
156
|
+
const e = oe(81), {
|
|
157
|
+
editor: r,
|
|
158
|
+
blockType: o,
|
|
159
|
+
isBold: l,
|
|
160
|
+
isItalic: f,
|
|
161
|
+
isUnderline: k,
|
|
162
|
+
isLink: h,
|
|
163
|
+
formatHeading: c,
|
|
164
|
+
formatList: g,
|
|
165
|
+
formatCodeBlock: b,
|
|
166
|
+
insertLink: p
|
|
167
|
+
} = t, a = l || void 0;
|
|
168
|
+
let L;
|
|
169
|
+
e[0] !== r ? (L = () => r.dispatchCommand(Ne, "bold"), e[0] = r, e[1] = L) : L = e[1];
|
|
170
|
+
let S;
|
|
171
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ n(ue, { fontWeight: "bold", fontSize: ".75rem", children: "B" }), e[2] = S) : S = e[2];
|
|
172
|
+
let d;
|
|
173
|
+
e[3] !== a || e[4] !== L ? (d = /* @__PURE__ */ n(O, { content: "Bold", children: /* @__PURE__ */ n(I, { "data-active": a, onClick: L, variant: "ghost", "aria-label": "Bold", size: "xs", children: S }) }), e[3] = a, e[4] = L, e[5] = d) : d = e[5];
|
|
174
|
+
const R = f || void 0;
|
|
175
|
+
let v;
|
|
176
|
+
e[6] !== r ? (v = () => r.dispatchCommand(Ne, "italic"), e[6] = r, e[7] = v) : v = e[7];
|
|
177
|
+
let y;
|
|
178
|
+
e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(ue, { fontStyle: "italic", fontSize: ".75rem", children: "I" }), e[8] = y) : y = e[8];
|
|
179
|
+
let C;
|
|
180
|
+
e[9] !== R || e[10] !== v ? (C = /* @__PURE__ */ n(O, { content: "Italic", children: /* @__PURE__ */ n(I, { "data-active": R, onClick: v, variant: "ghost", "aria-label": "Italic", size: "xs", children: y }) }), e[9] = R, e[10] = v, e[11] = C) : C = e[11];
|
|
181
|
+
const u = k || void 0;
|
|
182
|
+
let i;
|
|
183
|
+
e[12] !== r ? (i = () => r.dispatchCommand(Ne, "underline"), e[12] = r, e[13] = i) : i = e[13];
|
|
184
|
+
let s;
|
|
185
|
+
e[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ n(ue, { textDecoration: "underline", fontSize: ".75rem", children: "U" }), e[14] = s) : s = e[14];
|
|
186
|
+
let m;
|
|
187
|
+
e[15] !== u || e[16] !== i ? (m = /* @__PURE__ */ n(O, { content: "Underline", children: /* @__PURE__ */ n(I, { "data-active": u, onClick: i, variant: "ghost", "aria-label": "Underline", size: "xs", children: s }) }), e[15] = u, e[16] = i, e[17] = m) : m = e[17];
|
|
188
|
+
const T = h ? "Remove Link" : "Insert Link", E = h || void 0, N = h ? "Remove Link" : "Insert Link";
|
|
189
|
+
let _;
|
|
190
|
+
e[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ n(xt, { size: 14 }), e[18] = _) : _ = e[18];
|
|
191
|
+
let w;
|
|
192
|
+
e[19] !== p || e[20] !== E || e[21] !== N ? (w = /* @__PURE__ */ n(I, { "data-active": E, variant: "ghost", "aria-label": N, size: "xs", onClick: p, children: _ }), e[19] = p, e[20] = E, e[21] = N, e[22] = w) : w = e[22];
|
|
193
|
+
let x;
|
|
194
|
+
e[23] !== T || e[24] !== w ? (x = /* @__PURE__ */ n(O, { content: T, children: w }), e[23] = T, e[24] = w, e[25] = x) : x = e[25];
|
|
195
|
+
let P;
|
|
196
|
+
e[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ n(Oe, {}), e[26] = P) : P = e[26];
|
|
197
|
+
const z = o === "h1" || void 0;
|
|
198
|
+
let $;
|
|
199
|
+
e[27] !== c ? ($ = () => c("h1"), e[27] = c, e[28] = $) : $ = e[28];
|
|
200
|
+
let U;
|
|
201
|
+
e[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ n(ue, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }), e[29] = U) : U = e[29];
|
|
202
|
+
let H;
|
|
203
|
+
e[30] !== z || e[31] !== $ ? (H = /* @__PURE__ */ n(O, { content: "Heading 1", children: /* @__PURE__ */ n(I, { "data-active": z, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: $, children: U }) }), e[30] = z, e[31] = $, e[32] = H) : H = e[32];
|
|
204
|
+
const te = o === "h2" || void 0;
|
|
205
|
+
let F;
|
|
206
|
+
e[33] !== c ? (F = () => c("h2"), e[33] = c, e[34] = F) : F = e[34];
|
|
207
|
+
let K;
|
|
208
|
+
e[35] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ n(ue, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }), e[35] = K) : K = e[35];
|
|
209
|
+
let W;
|
|
210
|
+
e[36] !== te || e[37] !== F ? (W = /* @__PURE__ */ n(O, { content: "Heading 2", children: /* @__PURE__ */ n(I, { "data-active": te, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: F, children: K }) }), e[36] = te, e[37] = F, e[38] = W) : W = e[38];
|
|
211
|
+
const Q = o === "h3" || void 0;
|
|
212
|
+
let A;
|
|
213
|
+
e[39] !== c ? (A = () => c("h3"), e[39] = c, e[40] = A) : A = e[40];
|
|
214
|
+
let G;
|
|
215
|
+
e[41] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ n(ue, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }), e[41] = G) : G = e[41];
|
|
216
|
+
let B;
|
|
217
|
+
e[42] !== Q || e[43] !== A ? (B = /* @__PURE__ */ n(O, { content: "Heading 3", children: /* @__PURE__ */ n(I, { "data-active": Q, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: A, children: G }) }), e[42] = Q, e[43] = A, e[44] = B) : B = e[44];
|
|
218
|
+
let j;
|
|
219
|
+
e[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (j = /* @__PURE__ */ n(Oe, {}), e[45] = j) : j = e[45];
|
|
220
|
+
const Z = o === "code" || void 0;
|
|
221
|
+
let V;
|
|
222
|
+
e[46] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(It, { size: 14 }), e[46] = V) : V = e[46];
|
|
223
|
+
let D;
|
|
224
|
+
e[47] !== b || e[48] !== Z ? (D = /* @__PURE__ */ n(O, { content: "Code Block", children: /* @__PURE__ */ n(I, { "data-active": Z, variant: "ghost", "aria-label": "Code Block", size: "xs", onClick: b, children: V }) }), e[47] = b, e[48] = Z, e[49] = D) : D = e[49];
|
|
225
|
+
let ee;
|
|
226
|
+
e[50] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ee = /* @__PURE__ */ n(Oe, {}), e[50] = ee) : ee = e[50];
|
|
227
|
+
const me = o === "bullet" || void 0;
|
|
228
|
+
let ne;
|
|
229
|
+
e[51] !== g ? (ne = () => g("bullet"), e[51] = g, e[52] = ne) : ne = e[52];
|
|
230
|
+
let re;
|
|
231
|
+
e[53] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (re = /* @__PURE__ */ n(Ot, { size: 14 }), e[53] = re) : re = e[53];
|
|
232
|
+
let se;
|
|
233
|
+
e[54] !== me || e[55] !== ne ? (se = /* @__PURE__ */ n(O, { content: "Bulleted List", children: /* @__PURE__ */ n(I, { "data-active": me, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: ne, children: re }) }), e[54] = me, e[55] = ne, e[56] = se) : se = e[56];
|
|
234
|
+
const ye = o === "number" || void 0;
|
|
235
|
+
let ce;
|
|
236
|
+
e[57] !== g ? (ce = () => g("number"), e[57] = g, e[58] = ce) : ce = e[58];
|
|
237
|
+
let Ce;
|
|
238
|
+
e[59] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ce = /* @__PURE__ */ n(Pt, { size: 14 }), e[59] = Ce) : Ce = e[59];
|
|
239
|
+
let ae;
|
|
240
|
+
e[60] !== ye || e[61] !== ce ? (ae = /* @__PURE__ */ n(O, { content: "Numbered List", children: /* @__PURE__ */ n(I, { "data-active": ye, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: ce, children: Ce }) }), e[60] = ye, e[61] = ce, e[62] = ae) : ae = e[62];
|
|
241
|
+
const Te = o === "check" || void 0;
|
|
242
|
+
let de;
|
|
243
|
+
e[63] !== g ? (de = () => g("check"), e[63] = g, e[64] = de) : de = e[64];
|
|
244
|
+
let _e;
|
|
245
|
+
e[65] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_e = /* @__PURE__ */ n(Mt, { size: 14 }), e[65] = _e) : _e = e[65];
|
|
246
|
+
let fe;
|
|
247
|
+
e[66] !== Te || e[67] !== de ? (fe = /* @__PURE__ */ n(O, { content: "Check List", children: /* @__PURE__ */ n(I, { "data-active": Te, variant: "ghost", "aria-label": "Check List", size: "xs", onClick: de, children: _e }) }), e[66] = Te, e[67] = de, e[68] = fe) : fe = e[68];
|
|
248
|
+
let be;
|
|
249
|
+
return e[69] !== m || e[70] !== x || e[71] !== H || e[72] !== W || e[73] !== d || e[74] !== B || e[75] !== D || e[76] !== se || e[77] !== ae || e[78] !== fe || e[79] !== C ? (be = /* @__PURE__ */ ge(Pe, { direction: "row", gap: "0.5", alignItems: "center", children: [
|
|
250
|
+
d,
|
|
251
|
+
C,
|
|
252
|
+
m,
|
|
253
|
+
x,
|
|
254
|
+
P,
|
|
255
|
+
H,
|
|
256
|
+
W,
|
|
257
|
+
B,
|
|
258
|
+
j,
|
|
259
|
+
D,
|
|
260
|
+
ee,
|
|
261
|
+
se,
|
|
262
|
+
ae,
|
|
263
|
+
fe
|
|
264
|
+
] }), e[69] = m, e[70] = x, e[71] = H, e[72] = W, e[73] = d, e[74] = B, e[75] = D, e[76] = se, e[77] = ae, e[78] = fe, e[79] = C, e[80] = be) : be = e[80], be;
|
|
265
|
+
}
|
|
266
|
+
const en = {
|
|
267
|
+
bullet: "Bulleted List",
|
|
268
|
+
check: "Check List",
|
|
269
|
+
code: "Code Block",
|
|
270
|
+
h1: "Heading 1",
|
|
271
|
+
h2: "Heading 2",
|
|
272
|
+
h3: "Heading 3",
|
|
273
|
+
h4: "Heading 4",
|
|
274
|
+
h5: "Heading 5",
|
|
275
|
+
h6: "Heading 6",
|
|
276
|
+
number: "Numbered List",
|
|
277
|
+
paragraph: "Normal",
|
|
278
|
+
quote: "Quote"
|
|
279
|
+
}, tn = (t) => t in en ? t : null, nn = (t) => (t.getKey() === "root" ? t : X(t, (r) => {
|
|
280
|
+
const o = r.getParent();
|
|
281
|
+
return o !== null && Lt(o);
|
|
282
|
+
})) ?? t.getTopLevelElementOrThrow(), on = (t) => {
|
|
283
|
+
const e = nn(t);
|
|
284
|
+
if (xe(e))
|
|
285
|
+
return e.getListType();
|
|
286
|
+
const r = X(t, (l) => xe(l));
|
|
287
|
+
if (r !== null && xe(r))
|
|
288
|
+
return r.getListType();
|
|
289
|
+
const o = Gt(e) ? e.getTag() : e.getType();
|
|
290
|
+
return tn(o);
|
|
291
|
+
};
|
|
292
|
+
function ln(t) {
|
|
293
|
+
const {
|
|
294
|
+
hasSelection: e,
|
|
295
|
+
isRangeSelection: r,
|
|
296
|
+
isCollapsed: o,
|
|
297
|
+
hasNativeSelection: l,
|
|
298
|
+
hasNativeRange: f,
|
|
299
|
+
isAnchorInsideEditor: k,
|
|
300
|
+
isEditorEditable: h
|
|
301
|
+
} = t;
|
|
302
|
+
return e && r && !o && l && f && k && h;
|
|
303
|
+
}
|
|
304
|
+
const rn = -4;
|
|
305
|
+
function sn({
|
|
306
|
+
editor: t,
|
|
307
|
+
anchorElem: e,
|
|
308
|
+
isToolbarActive: r,
|
|
309
|
+
setIsToolbarActive: o
|
|
310
|
+
}) {
|
|
311
|
+
const l = ie(null), [f, k] = M("paragraph"), [h, c] = M(!1), [g, b] = M(!1), [p, a] = M(!1), [L, S] = M(!1), d = ie(() => {
|
|
312
|
+
}), R = (i) => {
|
|
313
|
+
t.update(() => {
|
|
314
|
+
const s = J();
|
|
315
|
+
if (Y(s)) {
|
|
316
|
+
if (f === i) {
|
|
317
|
+
ve(s, He);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
ve(s, () => jt(i));
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}, v = (i) => {
|
|
324
|
+
if (f === i) {
|
|
325
|
+
t.dispatchCommand(Ht, void 0);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const s = {
|
|
329
|
+
bullet: Wt,
|
|
330
|
+
number: Kt,
|
|
331
|
+
check: Ft
|
|
332
|
+
}[i];
|
|
333
|
+
t.dispatchCommand(s, void 0);
|
|
334
|
+
}, y = () => {
|
|
335
|
+
t.update(() => {
|
|
336
|
+
const i = J();
|
|
337
|
+
if (Y(i)) {
|
|
338
|
+
if (f === "code") {
|
|
339
|
+
ve(i, He);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
ve(i, () => Dt());
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}, C = () => {
|
|
346
|
+
if (L) {
|
|
347
|
+
t.dispatchCommand(ze, null);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
t.dispatchCommand(Ve, !0);
|
|
351
|
+
}, u = () => {
|
|
352
|
+
const i = J();
|
|
353
|
+
if (!Y(i)) return;
|
|
354
|
+
c(i.hasFormat("bold")), b(i.hasFormat("italic")), a(i.hasFormat("underline"));
|
|
355
|
+
const s = pe(i), m = X(s, le), T = X(s, he);
|
|
356
|
+
S(m !== null || T !== null);
|
|
357
|
+
const E = on(i.anchor.getNode());
|
|
358
|
+
E && k(E);
|
|
359
|
+
};
|
|
360
|
+
return d.current = () => {
|
|
361
|
+
const i = J(), s = l.current, m = window.getSelection();
|
|
362
|
+
if (s === null)
|
|
363
|
+
return;
|
|
364
|
+
const T = t.getRootElement(), E = m !== null, N = E && m.rangeCount > 0, _ = !!T?.contains(E ? m.anchorNode : null);
|
|
365
|
+
if (ln({
|
|
366
|
+
hasSelection: i !== null,
|
|
367
|
+
isRangeSelection: Y(i),
|
|
368
|
+
isCollapsed: Y(i) ? i.isCollapsed() : !1,
|
|
369
|
+
hasNativeSelection: E,
|
|
370
|
+
hasNativeRange: N,
|
|
371
|
+
isAnchorInsideEditor: _,
|
|
372
|
+
isEditorEditable: t.isEditable()
|
|
373
|
+
}) && m) {
|
|
374
|
+
const w = m.getRangeAt(0).getBoundingClientRect();
|
|
375
|
+
if (w) {
|
|
376
|
+
const x = new DOMRect(w.left, w.bottom, 0, 0);
|
|
377
|
+
Ee(x, s, e, rn);
|
|
378
|
+
}
|
|
379
|
+
o(!0);
|
|
380
|
+
} else
|
|
381
|
+
T !== null && Ee(null, s, e), o(!1);
|
|
382
|
+
return u(), !0;
|
|
383
|
+
}, q(() => {
|
|
384
|
+
const i = e.parentElement, s = () => {
|
|
385
|
+
t.getEditorState().read(() => {
|
|
386
|
+
d.current();
|
|
387
|
+
});
|
|
388
|
+
};
|
|
389
|
+
return window.addEventListener("resize", s), i && i.addEventListener("scroll", s), () => {
|
|
390
|
+
window.removeEventListener("resize", s), i && i.removeEventListener("scroll", s);
|
|
391
|
+
};
|
|
392
|
+
}, [e, t]), q(() => Se(t.registerUpdateListener(({
|
|
393
|
+
editorState: i
|
|
394
|
+
}) => {
|
|
395
|
+
i.read(() => {
|
|
396
|
+
d.current();
|
|
397
|
+
});
|
|
398
|
+
}), t.registerCommand(Le, (i) => (d.current(), !1), Be), t.registerCommand(We, (i) => {
|
|
399
|
+
const s = J();
|
|
400
|
+
return Y(s) && d.current(), !1;
|
|
401
|
+
}, Ge)), [t]), /* @__PURE__ */ n("div", { ref: l, className: `floating-text-format-toolbar ${r ? "active" : ""}`, children: /* @__PURE__ */ n(Jt, { editor: t, blockType: f, isBold: h, isItalic: g, isUnderline: p, isLink: L, formatHeading: R, formatList: v, formatCodeBlock: y, insertLink: C }) });
|
|
402
|
+
}
|
|
403
|
+
function cn(t) {
|
|
404
|
+
const e = oe(7), {
|
|
405
|
+
anchorElem: r
|
|
406
|
+
} = t, o = r === void 0 ? document.body : r, [l] = De(), [f, k] = M(!1);
|
|
407
|
+
let h;
|
|
408
|
+
e[0] !== o || e[1] !== l || e[2] !== f ? (h = /* @__PURE__ */ n(sn, { editor: l, anchorElem: o, isToolbarActive: f, setIsToolbarActive: k }), e[0] = o, e[1] = l, e[2] = f, e[3] = h) : h = e[3];
|
|
409
|
+
let c;
|
|
410
|
+
return e[4] !== o || e[5] !== h ? (c = $e(h, o), e[4] = o, e[5] = h, e[6] = c) : c = e[6], c;
|
|
411
|
+
}
|
|
412
|
+
function an(t) {
|
|
413
|
+
const e = oe(32), {
|
|
414
|
+
isActive: r,
|
|
415
|
+
isLinkEditMode: o,
|
|
416
|
+
editedLinkUrl: l,
|
|
417
|
+
editedLinkUrlIsValid: f,
|
|
418
|
+
linkUrl: k,
|
|
419
|
+
href: h,
|
|
420
|
+
inputRef: c,
|
|
421
|
+
onEditedLinkUrlChange: g,
|
|
422
|
+
onInputKeyDown: b,
|
|
423
|
+
onClose: p,
|
|
424
|
+
onSubmit: a,
|
|
425
|
+
onEdit: L,
|
|
426
|
+
onRemove: S
|
|
427
|
+
} = t;
|
|
428
|
+
if (!r)
|
|
429
|
+
return null;
|
|
430
|
+
if (o) {
|
|
431
|
+
const i = !f;
|
|
432
|
+
let s;
|
|
433
|
+
e[0] !== g ? (s = (P) => {
|
|
434
|
+
g(P.target.value);
|
|
435
|
+
}, e[0] = g, e[1] = s) : s = e[1];
|
|
436
|
+
let m;
|
|
437
|
+
e[2] !== l || e[3] !== c || e[4] !== b || e[5] !== i || e[6] !== s ? (m = /* @__PURE__ */ n(st, { ref: c, className: "link-editor-url-field", size: "sm", fontSize: "sm", value: l, placeholder: "https://", "aria-label": "Link URL", "aria-invalid": i, onChange: s, onKeyDown: b }), e[2] = l, e[3] = c, e[4] = b, e[5] = i, e[6] = s, e[7] = m) : m = e[7];
|
|
438
|
+
let T;
|
|
439
|
+
e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ n(zt, { size: 14 }), e[8] = T) : T = e[8];
|
|
440
|
+
let E;
|
|
441
|
+
e[9] !== p ? (E = /* @__PURE__ */ n(O, { content: "Cancel", children: /* @__PURE__ */ n(I, { variant: "ghost", size: "xs", "aria-label": "Cancel link edit", onMouseDown: ke, onClick: p, children: T }) }), e[9] = p, e[10] = E) : E = e[10];
|
|
442
|
+
const N = !f;
|
|
443
|
+
let _;
|
|
444
|
+
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ n(je, { size: 14 }), e[11] = _) : _ = e[11];
|
|
445
|
+
let w;
|
|
446
|
+
e[12] !== a || e[13] !== N ? (w = /* @__PURE__ */ n(O, { content: "Confirm", children: /* @__PURE__ */ n(I, { variant: "ghost", size: "xs", "aria-label": "Confirm link edit", disabled: N, onMouseDown: ke, onClick: a, children: _ }) }), e[12] = a, e[13] = N, e[14] = w) : w = e[14];
|
|
447
|
+
let x;
|
|
448
|
+
return e[15] !== m || e[16] !== E || e[17] !== w ? (x = /* @__PURE__ */ ge(Pe, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
|
|
449
|
+
m,
|
|
450
|
+
E,
|
|
451
|
+
w
|
|
452
|
+
] }), e[15] = m, e[16] = E, e[17] = w, e[18] = x) : x = e[18], x;
|
|
453
|
+
}
|
|
454
|
+
let d;
|
|
455
|
+
e[19] !== h || e[20] !== k ? (d = /* @__PURE__ */ n(ct, { href: h, target: "_blank", rel: "noopener noreferrer", className: "link-editor-url-field", fontSize: "sm", textDecoration: "underline", px: "2", truncate: !0, children: k }), e[19] = h, e[20] = k, e[21] = d) : d = e[21];
|
|
456
|
+
let R;
|
|
457
|
+
e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ n(At, { size: 14 }), e[22] = R) : R = e[22];
|
|
458
|
+
let v;
|
|
459
|
+
e[23] !== L ? (v = /* @__PURE__ */ n(O, { content: "Edit link", children: /* @__PURE__ */ n(I, { variant: "ghost", size: "xs", "aria-label": "Edit link", onMouseDown: ke, onClick: L, children: R }) }), e[23] = L, e[24] = v) : v = e[24];
|
|
460
|
+
let y;
|
|
461
|
+
e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(Bt, { size: 14 }), e[25] = y) : y = e[25];
|
|
462
|
+
let C;
|
|
463
|
+
e[26] !== S ? (C = /* @__PURE__ */ n(O, { content: "Remove link", children: /* @__PURE__ */ n(I, { variant: "ghost", size: "xs", "aria-label": "Remove link", onMouseDown: ke, onClick: S, children: y }) }), e[26] = S, e[27] = C) : C = e[27];
|
|
464
|
+
let u;
|
|
465
|
+
return e[28] !== d || e[29] !== v || e[30] !== C ? (u = /* @__PURE__ */ ge(Pe, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
|
|
466
|
+
d,
|
|
467
|
+
v,
|
|
468
|
+
C
|
|
469
|
+
] }), e[28] = d, e[29] = v, e[30] = C, e[31] = u) : u = e[31], u;
|
|
470
|
+
}
|
|
471
|
+
function ke(t) {
|
|
472
|
+
t.preventDefault();
|
|
473
|
+
}
|
|
474
|
+
function dn(t, e, r) {
|
|
475
|
+
return t && e && r === "";
|
|
476
|
+
}
|
|
477
|
+
function fn(t) {
|
|
478
|
+
const e = pe(t), r = X(e, le);
|
|
479
|
+
return r ? r.getURL() : le(e) ? e.getURL() : "";
|
|
480
|
+
}
|
|
481
|
+
const Ye = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
|
|
482
|
+
function Ae(t) {
|
|
483
|
+
try {
|
|
484
|
+
const e = new URL(t);
|
|
485
|
+
if (!Ye.has(e.protocol))
|
|
486
|
+
return "about:blank";
|
|
487
|
+
} catch {
|
|
488
|
+
return t;
|
|
489
|
+
}
|
|
490
|
+
return t;
|
|
491
|
+
}
|
|
492
|
+
function qe(t) {
|
|
493
|
+
try {
|
|
494
|
+
const e = new URL(t);
|
|
495
|
+
return Ye.has(e.protocol) ? e.protocol === "http:" || e.protocol === "https:" ? e.hostname !== "" : e.pathname.trim() !== "" : !1;
|
|
496
|
+
} catch {
|
|
497
|
+
return !1;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
const un = 8;
|
|
501
|
+
function mn({
|
|
502
|
+
editor: t,
|
|
503
|
+
isLink: e,
|
|
504
|
+
setIsLink: r,
|
|
505
|
+
anchorElem: o,
|
|
506
|
+
isLinkEditMode: l,
|
|
507
|
+
setIsLinkEditMode: f
|
|
508
|
+
}) {
|
|
509
|
+
const k = ie(null), h = ie(null), c = ie(() => {
|
|
510
|
+
}), [g, b] = M(""), [p, a] = M("https://"), [L, S] = M(null), d = e || l, R = qe(p);
|
|
511
|
+
c.current = () => {
|
|
512
|
+
const u = J();
|
|
513
|
+
if (Y(u)) {
|
|
514
|
+
const N = fn(u);
|
|
515
|
+
b(N), dn(l, e, N) && y(), l && N !== "" && a(N);
|
|
516
|
+
}
|
|
517
|
+
const i = k.current, s = window.getSelection(), m = document.activeElement;
|
|
518
|
+
if (i === null)
|
|
519
|
+
return;
|
|
520
|
+
const T = t.getRootElement(), E = s !== null && s.rangeCount > 0;
|
|
521
|
+
if (u !== null && s !== null && E && T?.contains(s.anchorNode) && t.isEditable()) {
|
|
522
|
+
const N = s.getRangeAt(0).getBoundingClientRect(), _ = new DOMRect(N.left, N.top, 0, N.height);
|
|
523
|
+
Ee(_, i, o, un, void 0, "above"), S(u);
|
|
524
|
+
} else i.contains(m) || (T !== null && Ee(null, i, o), S(null), f(!1), b(""));
|
|
525
|
+
}, q(() => {
|
|
526
|
+
const u = o.parentElement, i = () => {
|
|
527
|
+
t.getEditorState().read(() => {
|
|
528
|
+
c.current();
|
|
529
|
+
});
|
|
530
|
+
};
|
|
531
|
+
return window.addEventListener("resize", i), u && u.addEventListener("scroll", i), () => {
|
|
532
|
+
window.removeEventListener("resize", i), u && u.removeEventListener("scroll", i);
|
|
533
|
+
};
|
|
534
|
+
}, [o.parentElement, t]), q(() => Se(t.registerUpdateListener(({
|
|
535
|
+
editorState: u
|
|
536
|
+
}) => {
|
|
537
|
+
u.read(() => {
|
|
538
|
+
c.current();
|
|
539
|
+
});
|
|
540
|
+
}), t.registerCommand(Le, () => (c.current(), !0), Me), t.registerCommand(St, () => e ? (r(!1), !0) : !1, Ge)), [t, r, e]), q(() => {
|
|
541
|
+
t.getEditorState().read(() => {
|
|
542
|
+
c.current();
|
|
543
|
+
});
|
|
544
|
+
}, [t]), Nt(() => {
|
|
545
|
+
d && t.getEditorState().read(() => {
|
|
546
|
+
c.current();
|
|
547
|
+
});
|
|
548
|
+
}, [t, d]), q(() => {
|
|
549
|
+
l && h.current && h.current.focus();
|
|
550
|
+
}, [l]);
|
|
551
|
+
const v = (u) => {
|
|
552
|
+
u.key === "Enter" ? (u.preventDefault(), C()) : u.key === "Escape" && (u.preventDefault(), y());
|
|
553
|
+
}, y = () => {
|
|
554
|
+
a("https://"), f(!1);
|
|
555
|
+
}, C = () => {
|
|
556
|
+
L === null || !R || (t.update(() => {
|
|
557
|
+
Tt(L);
|
|
558
|
+
}), t.dispatchCommand(ze, Ae(p)), t.update(() => {
|
|
559
|
+
const u = J();
|
|
560
|
+
if (Y(u)) {
|
|
561
|
+
const i = pe(u).getParent();
|
|
562
|
+
if (he(i)) {
|
|
563
|
+
const s = Ut(i.getURL(), {
|
|
564
|
+
rel: i.__rel,
|
|
565
|
+
target: i.__target,
|
|
566
|
+
title: i.__title
|
|
567
|
+
});
|
|
568
|
+
i.replace(s, !0);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}), y());
|
|
572
|
+
};
|
|
573
|
+
return /* @__PURE__ */ n(Ke, { ref: k, className: `link-editor ${d ? "active" : ""}`, children: /* @__PURE__ */ n(an, { isActive: d, isLinkEditMode: l, editedLinkUrl: p, editedLinkUrlIsValid: R, linkUrl: g, href: Ae(g), inputRef: h, onEditedLinkUrlChange: a, onInputKeyDown: v, onClose: y, onSubmit: C, onEdit: () => {
|
|
574
|
+
a(g), f(!0);
|
|
575
|
+
}, onRemove: () => {
|
|
576
|
+
t.dispatchCommand(ze, null);
|
|
577
|
+
} }) });
|
|
578
|
+
}
|
|
579
|
+
function hn(t, e, r, o) {
|
|
580
|
+
const l = oe(13), [f, k] = M(t), [h, c] = M(!1);
|
|
581
|
+
let g, b;
|
|
582
|
+
l[0] !== t || l[1] !== o ? (g = () => {
|
|
583
|
+
const L = function() {
|
|
584
|
+
const d = J();
|
|
585
|
+
if (Y(d)) {
|
|
586
|
+
const R = pe(d), v = X(R, le), y = X(R, he);
|
|
587
|
+
if (!(v || y)) {
|
|
588
|
+
c(!1);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
const C = d.getNodes().filter(pn).find((u) => {
|
|
592
|
+
const i = X(u, le), s = X(u, he), m = he(s) && s.getIsUnlinked();
|
|
593
|
+
return v && !v.is(i) || i && !i.is(v) || y && !y.is(s) || s && (!s.is(y) || m);
|
|
594
|
+
});
|
|
595
|
+
c(!C);
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
return Se(t.registerUpdateListener((S) => {
|
|
599
|
+
const {
|
|
600
|
+
editorState: d
|
|
601
|
+
} = S;
|
|
602
|
+
d.read(() => {
|
|
603
|
+
L();
|
|
604
|
+
});
|
|
605
|
+
}), t.registerCommand(Le, (S, d) => (L(), k(d), !1), Be), t.registerCommand(We, gn, Me), t.registerCommand(Ve, (S) => (o(S), !0), Me));
|
|
606
|
+
}, b = [t, o], l[0] = t, l[1] = o, l[2] = g, l[3] = b) : (g = l[2], b = l[3]), q(g, b);
|
|
607
|
+
let p;
|
|
608
|
+
l[4] !== f || l[5] !== e || l[6] !== h || l[7] !== r || l[8] !== o ? (p = /* @__PURE__ */ n(mn, { editor: f, isLink: h, anchorElem: e, setIsLink: c, isLinkEditMode: r, setIsLinkEditMode: o }), l[4] = f, l[5] = e, l[6] = h, l[7] = r, l[8] = o, l[9] = p) : p = l[9];
|
|
609
|
+
let a;
|
|
610
|
+
return l[10] !== e || l[11] !== p ? (a = $e(p, e), l[10] = e, l[11] = p, l[12] = a) : a = l[12], a;
|
|
611
|
+
}
|
|
612
|
+
function gn(t) {
|
|
613
|
+
const e = J();
|
|
614
|
+
if (Y(e)) {
|
|
615
|
+
const r = pe(e), o = X(r, le);
|
|
616
|
+
if (le(o) && (t.metaKey || t.ctrlKey))
|
|
617
|
+
return window.open(Ae(o.getURL()), "_blank", "noopener,noreferrer"), !0;
|
|
618
|
+
}
|
|
619
|
+
return !1;
|
|
620
|
+
}
|
|
621
|
+
function pn(t) {
|
|
622
|
+
return !yt(t);
|
|
623
|
+
}
|
|
624
|
+
function Cn(t) {
|
|
625
|
+
const {
|
|
626
|
+
anchorElem: e
|
|
627
|
+
} = t, r = e === void 0 ? document.body : e, [o, l] = M(!1), [f] = De();
|
|
628
|
+
return hn(f, r, o, l);
|
|
629
|
+
}
|
|
630
|
+
function _n() {
|
|
631
|
+
const t = oe(1);
|
|
632
|
+
let e;
|
|
633
|
+
return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n($t, { validateUrl: qe }), t[0] = e) : e = t[0], e;
|
|
634
|
+
}
|
|
635
|
+
function bn(t) {
|
|
636
|
+
const e = oe(57), {
|
|
637
|
+
autoFocus: r,
|
|
638
|
+
debug: o,
|
|
639
|
+
defaultState: l,
|
|
640
|
+
isEditable: f,
|
|
641
|
+
placeholder: k,
|
|
642
|
+
scrollable: h,
|
|
643
|
+
onChange: c
|
|
644
|
+
} = t, g = r === void 0 ? !1 : r, b = o === void 0 ? !1 : o, p = l === void 0 ? "" : l, a = f === void 0 ? !1 : f, L = h === void 0 ? !0 : h;
|
|
645
|
+
let S;
|
|
646
|
+
e[0] !== p ? (S = Qe(p), e[0] = p, e[1] = S) : S = e[1];
|
|
647
|
+
const {
|
|
648
|
+
frontmatter: d,
|
|
649
|
+
body: R
|
|
650
|
+
} = S, v = a && !!c, y = ie(null), [C, u] = M(null);
|
|
651
|
+
let i, s;
|
|
652
|
+
e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = () => {
|
|
653
|
+
u(y.current);
|
|
654
|
+
}, s = [], e[2] = i, e[3] = s) : (i = e[2], s = e[3]), q(i, s);
|
|
655
|
+
let m;
|
|
656
|
+
e[4] !== R ? (m = () => at(Ze(R), Re, void 0, !1), e[4] = R, e[5] = m) : m = e[5];
|
|
657
|
+
let T;
|
|
658
|
+
e[6] !== a || e[7] !== m ? (T = {
|
|
659
|
+
namespace: "MARKDOWN_EDITOR",
|
|
660
|
+
nodes: et,
|
|
661
|
+
editorState: m,
|
|
662
|
+
onError: vn,
|
|
663
|
+
editable: a,
|
|
664
|
+
theme: Je
|
|
665
|
+
}, e[6] = a, e[7] = m, e[8] = T) : T = e[8];
|
|
666
|
+
const E = T, N = L ? "100%" : "auto";
|
|
667
|
+
let _;
|
|
668
|
+
e[9] !== g ? (_ = g ? /* @__PURE__ */ n(ft, {}) : null, e[9] = g, e[10] = _) : _ = e[10];
|
|
669
|
+
let w, x, P;
|
|
670
|
+
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ n(gt, {}), x = /* @__PURE__ */ n(_n, {}), P = /* @__PURE__ */ n(Ct, {}), e[11] = w, e[12] = x, e[13] = P) : (w = e[11], x = e[12], P = e[13]);
|
|
671
|
+
let z;
|
|
672
|
+
e[14] !== a ? (z = a ? /* @__PURE__ */ n(kt, { maxIndent: 7 }) : null, e[14] = a, e[15] = z) : z = e[15];
|
|
673
|
+
let $;
|
|
674
|
+
e[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ n(ut, {}), e[16] = $) : $ = e[16];
|
|
675
|
+
let U;
|
|
676
|
+
e[17] !== a ? (U = a ? /* @__PURE__ */ n(_t, { transformers: Re }) : null, e[17] = a, e[18] = U) : U = e[18];
|
|
677
|
+
let H, te, F;
|
|
678
|
+
e[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ n(pt, {}), te = /* @__PURE__ */ n(tt, {}), F = /* @__PURE__ */ n(nt, {}), e[19] = H, e[20] = te, e[21] = F) : (H = e[19], te = e[20], F = e[21]);
|
|
679
|
+
let K;
|
|
680
|
+
e[22] !== C ? (K = /* @__PURE__ */ n(qt, { anchorElem: C }), e[22] = C, e[23] = K) : K = e[23];
|
|
681
|
+
let W;
|
|
682
|
+
e[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ n(ot, {}), e[24] = W) : W = e[24];
|
|
683
|
+
let Q;
|
|
684
|
+
e[25] !== L ? (Q = /* @__PURE__ */ n(it, { fullWidth: !1, padding: "sm", scrollable: L }), e[25] = L, e[26] = Q) : Q = e[26];
|
|
685
|
+
let A;
|
|
686
|
+
e[27] !== k ? (A = k ? /* @__PURE__ */ n(Ue, { position: "absolute", padding: "sm", top: "0", left: "0", right: "0", pointerEvents: "none", userSelect: "none", justifyContent: "center", children: /* @__PURE__ */ n(Ke, { width: "100%", maxWidth: "45rem", color: "fg.muted", textStyle: "paragraph/M/regular", children: k }) }) : null, e[27] = k, e[28] = A) : A = e[28];
|
|
687
|
+
let G;
|
|
688
|
+
e[29] !== Q || e[30] !== A ? (G = /* @__PURE__ */ n(vt, { contentEditable: Q, placeholder: A, ErrorBoundary: ht }), e[29] = Q, e[30] = A, e[31] = G) : G = e[31];
|
|
689
|
+
let B;
|
|
690
|
+
e[32] !== C || e[33] !== a ? (B = a && C ? /* @__PURE__ */ ge(Xe, { children: [
|
|
691
|
+
/* @__PURE__ */ n(cn, { anchorElem: C }),
|
|
692
|
+
/* @__PURE__ */ n(Cn, { anchorElem: C })
|
|
693
|
+
] }) : null, e[32] = C, e[33] = a, e[34] = B) : B = e[34];
|
|
694
|
+
let j;
|
|
695
|
+
e[35] !== d || e[36] !== c || e[37] !== v ? (j = v ? /* @__PURE__ */ n(bt, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (me) => {
|
|
696
|
+
me.read(() => {
|
|
697
|
+
const ne = Rt(), re = dt(Re, ne);
|
|
698
|
+
c?.(d + re);
|
|
699
|
+
});
|
|
700
|
+
} }) : null, e[35] = d, e[36] = c, e[37] = v, e[38] = j) : j = e[38];
|
|
701
|
+
let Z;
|
|
702
|
+
e[39] !== a ? (Z = /* @__PURE__ */ n(lt, { isEditable: a }), e[39] = a, e[40] = Z) : Z = e[40];
|
|
703
|
+
let V;
|
|
704
|
+
e[41] !== b ? (V = b && /* @__PURE__ */ n(rt, {}), e[41] = b, e[42] = V) : V = e[42];
|
|
705
|
+
let D;
|
|
706
|
+
e[43] !== E || e[44] !== _ || e[45] !== z || e[46] !== U || e[47] !== K || e[48] !== G || e[49] !== B || e[50] !== j || e[51] !== Z || e[52] !== V ? (D = /* @__PURE__ */ ge(mt, { initialConfig: E, children: [
|
|
707
|
+
_,
|
|
708
|
+
w,
|
|
709
|
+
x,
|
|
710
|
+
P,
|
|
711
|
+
z,
|
|
712
|
+
$,
|
|
713
|
+
U,
|
|
714
|
+
H,
|
|
715
|
+
te,
|
|
716
|
+
F,
|
|
717
|
+
K,
|
|
718
|
+
W,
|
|
719
|
+
G,
|
|
720
|
+
B,
|
|
721
|
+
j,
|
|
722
|
+
Z,
|
|
723
|
+
V
|
|
724
|
+
] }), e[43] = E, e[44] = _, e[45] = z, e[46] = U, e[47] = K, e[48] = G, e[49] = B, e[50] = j, e[51] = Z, e[52] = V, e[53] = D) : D = e[53];
|
|
725
|
+
let ee;
|
|
726
|
+
return e[54] !== N || e[55] !== D ? (ee = /* @__PURE__ */ n(Ue, { ref: y, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: N, position: "relative", direction: "column", overflow: "visible", children: D }), e[54] = N, e[55] = D, e[56] = ee) : ee = e[56], ee;
|
|
727
|
+
}
|
|
728
|
+
function vn(t) {
|
|
729
|
+
return console.error(t);
|
|
730
|
+
}
|
|
731
|
+
const Xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
732
|
+
__proto__: null,
|
|
733
|
+
MarkdownEditor: bn
|
|
734
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
735
|
+
export {
|
|
736
|
+
qt as C,
|
|
737
|
+
cn as F,
|
|
738
|
+
bn as M,
|
|
739
|
+
Xn as m
|
|
740
|
+
};
|
|
741
|
+
//# sourceMappingURL=markdown-editor-CYVkzt8t.js.map
|