@pstdio/ui 0.20.1 → 0.22.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-BVMyKttu.js → MermaidComponent-D92GMhht.js} +3 -3
- package/dist/{MermaidComponent-BVMyKttu.js.map → MermaidComponent-D92GMhht.js.map} +1 -1
- package/dist/chat-ui.d.ts +2 -0
- package/dist/chat-ui.js +3 -7
- package/dist/chat-ui.js.map +1 -1
- package/dist/components/data-table/build-columns.d.ts +2 -0
- package/dist/components/data-table/data-table-column-menu.d.ts +2 -0
- package/dist/components/data-table/data-table-row-display.d.ts +11 -0
- package/dist/components/data-table/data-table-table-parts.d.ts +1 -0
- package/dist/components/data-table/edit-mode-data-table-body.d.ts +1 -0
- package/dist/components/data-table/edit-mode-data-table-cell.d.ts +1 -0
- package/dist/components/data-table/edit-mode-data-table-header.d.ts +1 -0
- package/dist/components/data-table/types.d.ts +1 -0
- package/dist/components/diff-viewer/code-editor.d.ts +8 -2
- package/dist/components/diff-viewer/index.d.ts +1 -0
- package/dist/components/kanban-renderer/collection-badge.d.ts +7 -0
- package/dist/components/kanban-renderer/index.d.ts +1 -1
- package/dist/components/kanban-renderer/kanban-renderer-helpers.d.ts +2 -1
- package/dist/components/kanban-renderer/types.d.ts +20 -1
- package/dist/components/list-row/list-row-content.d.ts +1 -0
- package/dist/components/param-editor/param-editor-presentation.d.ts +1 -1
- package/dist/components/param-editor/param-editor.types.d.ts +5 -193
- package/dist/components/rich-text/shared/markdown-ast.d.ts +1 -0
- package/dist/components/rich-text/shared/markdown-source-document.d.ts +7 -0
- package/dist/components/rich-text/shared/markdown-source-links.d.ts +11 -0
- package/dist/components/rich-text/shared/markdown-source-map.d.ts +10 -0
- package/dist/components/rich-text/utils/inferResourceType.d.ts +1 -1
- package/dist/components/tag-editor/tag-editor-row.d.ts +2 -1
- package/dist/components/tag-editor/tag-editor.types.d.ts +13 -0
- package/dist/components/tag-editor/tag-settings-panel.d.ts +1 -1
- package/dist/components/tree-list/tree-list-drag-provider.d.ts +13 -0
- package/dist/components/tree-list/tree-list-order.store.d.ts +4 -1
- package/dist/components/tree-list/tree-list-reorder.d.ts +14 -3
- package/dist/components/tree-list/tree-list-sortable.d.ts +2 -0
- package/dist/components/tree-list/tree-list-visibility-filter.d.ts +2 -2
- package/dist/components/tree-list/tree-list.d.ts +3 -0
- package/dist/components/tree-list/tree-list.types.d.ts +4 -0
- package/dist/data-table.d.ts +2 -0
- package/dist/data-table.js +740 -704
- package/dist/data-table.js.map +1 -1
- package/dist/diff.d.ts +2 -0
- package/dist/diff.js +532 -533
- package/dist/diff.js.map +1 -1
- package/dist/edit-mode-data-table-DGgRuSW3.js +846 -0
- package/dist/edit-mode-data-table-DGgRuSW3.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1603 -1492
- package/dist/index.js.map +1 -1
- package/dist/{kanban-renderer-toolbar-CpegGbwq.js → kanban-renderer-toolbar-Bl8xXdwU.js} +527 -469
- package/dist/kanban-renderer-toolbar-Bl8xXdwU.js.map +1 -0
- package/dist/kanban-renderer.d.ts +2 -0
- package/dist/kanban-renderer.js +21 -21
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/lazy-markdown-editor-CCOchoJX.js +235 -0
- package/dist/lazy-markdown-editor-CCOchoJX.js.map +1 -0
- package/dist/list-row-DCgdza1i.js +812 -0
- package/dist/list-row-DCgdza1i.js.map +1 -0
- package/dist/markdown-CASvn1Z2.js +1643 -0
- package/dist/markdown-CASvn1Z2.js.map +1 -0
- package/dist/markdown-editor-C4GCyebp.js +1019 -0
- package/dist/markdown-editor-C4GCyebp.js.map +1 -0
- package/dist/{mermaid-renderer-H3IhLqnQ.js → mermaid-renderer-CVnuKs-A.js} +2 -2
- package/dist/{mermaid-renderer-H3IhLqnQ.js.map → mermaid-renderer-CVnuKs-A.js.map} +1 -1
- package/dist/mermaid.d.ts +2 -0
- package/dist/mermaid.js +1 -1
- package/dist/monaco-browser-CgvlArN7.js +21 -0
- package/dist/monaco-browser-CgvlArN7.js.map +1 -0
- package/dist/{param-editor-B8Ff9Nm8.js → param-editor-CkDq623X.js} +2 -2
- package/dist/{param-editor-B8Ff9Nm8.js.map → param-editor-CkDq623X.js.map} +1 -1
- package/dist/param-editor-field-DRgbnL7-.js +2809 -0
- package/dist/param-editor-field-DRgbnL7-.js.map +1 -0
- package/dist/rich-message-DARuDVOX.js +628 -0
- package/dist/{rich-message-DdFYRzTo.js.map → rich-message-DARuDVOX.js.map} +1 -1
- package/dist/rich-text.d.ts +2 -0
- package/dist/rich-text.js +48 -47
- package/dist/rich-text.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/terminal.d.ts +2 -0
- package/dist/terminal.js +1 -1
- package/dist/terminal.js.map +1 -1
- package/dist/theme/primitives/sizes.d.ts +9 -0
- package/dist/{theme-BH4fSst9.js → theme-B-l5_a6F.js} +69 -50
- package/dist/theme-B-l5_a6F.js.map +1 -0
- package/dist/theme-preference-Bpobguh4.js +114 -0
- package/dist/theme-preference-Bpobguh4.js.map +1 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +1 -1
- package/dist/tree-list-AlO5ZmxQ.js +1262 -0
- package/dist/tree-list-AlO5ZmxQ.js.map +1 -0
- package/dist/utils/theme-preference.d.ts +4 -1
- package/dist/workspace-badge-BR_GgsAG.js +175 -0
- package/dist/workspace-badge-BR_GgsAG.js.map +1 -0
- package/package.json +5 -42
- package/dist/dialog-accept-shortcut-DAEBsoWW.js +0 -7
- package/dist/dialog-accept-shortcut-DAEBsoWW.js.map +0 -1
- package/dist/edit-mode-data-table-D6NeiDJx.js +0 -775
- package/dist/edit-mode-data-table-D6NeiDJx.js.map +0 -1
- package/dist/editor-config-D9OksZ93.js +0 -2416
- package/dist/editor-config-D9OksZ93.js.map +0 -1
- package/dist/kanban-renderer-toolbar-CpegGbwq.js.map +0 -1
- package/dist/lazy-markdown-editor-B7uP2ALS.js +0 -26
- package/dist/lazy-markdown-editor-B7uP2ALS.js.map +0 -1
- package/dist/list-row-9oxy-F0v.js +0 -796
- package/dist/list-row-9oxy-F0v.js.map +0 -1
- package/dist/monaco-browser-CO0NxK_Z.js +0 -19
- package/dist/monaco-browser-CO0NxK_Z.js.map +0 -1
- package/dist/number-input-WUfejtNx.js +0 -343
- package/dist/number-input-WUfejtNx.js.map +0 -1
- package/dist/param-editor-field-Cu4pto_a.js +0 -2845
- package/dist/param-editor-field-Cu4pto_a.js.map +0 -1
- package/dist/rich-message-DdFYRzTo.js +0 -658
- package/dist/theme-BH4fSst9.js.map +0 -1
- package/dist/theme-preference-DyymrYpR.js +0 -123
- package/dist/theme-preference-DyymrYpR.js.map +0 -1
- package/dist/tree-list-uV4UFj0x.js +0 -1116
- package/dist/tree-list-uV4UFj0x.js.map +0 -1
|
@@ -0,0 +1,1643 @@
|
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { c as x } from "react/compiler-runtime";
|
|
3
|
+
import { chakra as Tt, Box as $, Text as Ke, Image as $t, Code as Re, Link as St } from "@chakra-ui/react";
|
|
4
|
+
import { ContentEditable as vt } from "@lexical/react/LexicalContentEditable";
|
|
5
|
+
import { S as Ot } from "./browser-storage-DPtOQJx0.js";
|
|
6
|
+
import { LinkNode as Ee, AutoLinkNode as je, $createLinkNode as Mt, $isLinkNode as We, $isAutoLinkNode as Ve, $createAutoLinkNode as Lt } from "@lexical/link";
|
|
7
|
+
import { ListNode as Rt, ListItemNode as It, $isListNode as Ge, $isListItemNode as At, $createListNode as Bt, $createListItemNode as Dt } from "@lexical/list";
|
|
8
|
+
import { CHECK_LIST as Ft, TRANSFORMERS as qt, LINK as Pt } from "@lexical/markdown";
|
|
9
|
+
import { QuoteNode as zt, HeadingNode as Ut, $isHeadingNode as Ht, $isQuoteNode as Jt, $createQuoteNode as Kt, $createHeadingNode as jt } from "@lexical/rich-text";
|
|
10
|
+
import { CodeNode as Qe, CodeHighlightNode as Wt, registerCodeHighlighting as Vt, $isCodeNode as Gt, $createCodeNode as Qt } from "@lexical/code";
|
|
11
|
+
import { DecoratorNode as F, $getSelection as Xt, $getNodeByKey as ke, $isRangeSelection as Yt, $applyNodeReplacement as q, HISTORY_PUSH_TAG as Ie, $createParagraphNode as re, REDO_COMMAND as Zt, UNDO_COMMAND as en, ElementNode as tn, TextNode as ye, $createTextNode as E, $nodesOfType as nn, $isParagraphNode as Xe, $isElementNode as Ye, $isTextNode as rn, $isLineBreakNode as sn, $getRoot as Ze, $createLineBreakNode as ln } from "lexical";
|
|
12
|
+
import { useLexicalComposerContext as le } from "@lexical/react/LexicalComposerContext";
|
|
13
|
+
import * as on from "react";
|
|
14
|
+
import { createContext as an, useContext as cn, useRef as et, useEffect as oe, Fragment as un, useState as dn, Suspense as tt, lazy as pn } from "react";
|
|
15
|
+
import { diffChars as te } from "diff";
|
|
16
|
+
import { fromMarkdown as nt } from "mdast-util-from-markdown";
|
|
17
|
+
import { gfmToMarkdown as hn, gfmFromMarkdown as fn } from "mdast-util-gfm";
|
|
18
|
+
import { mathToMarkdown as mn, mathFromMarkdown as _n } from "mdast-util-math";
|
|
19
|
+
import { toMarkdown as gn } from "mdast-util-to-markdown";
|
|
20
|
+
import { gfm as kn } from "micromark-extension-gfm";
|
|
21
|
+
import { math as yn } from "micromark-extension-math";
|
|
22
|
+
import { R as bn, L as xn } from "./lazy-markdown-editor-CCOchoJX.js";
|
|
23
|
+
import { E as Cn } from "./edit-mode-data-table-DGgRuSW3.js";
|
|
24
|
+
import Nn from "dompurify";
|
|
25
|
+
import wn from "katex";
|
|
26
|
+
import { TreeView as En } from "@lexical/react/LexicalTreeView";
|
|
27
|
+
const Tn = Tt(vt);
|
|
28
|
+
function si(t) {
|
|
29
|
+
const e = x(11), {
|
|
30
|
+
onRef: n,
|
|
31
|
+
fullWidth: r,
|
|
32
|
+
padding: i,
|
|
33
|
+
isRichMessage: s,
|
|
34
|
+
scrollable: l
|
|
35
|
+
} = t, a = r === void 0 ? !1 : r, o = s === void 0 ? !1 : s, c = l === void 0 ? !0 : l, u = a ? "100%" : "45rem", d = a ? "0" : "auto";
|
|
36
|
+
let p;
|
|
37
|
+
e[0] !== u || e[1] !== d ? (p = /* @__PURE__ */ h(Tn, { "data-testid": "content-editable", height: "fit-content", minH: "100%", width: "100%", maxWidth: u, marginInline: d, textStyle: "paragraph/M/regular", fontSize: "calc(var(--chakra-font-sizes-md) * var(--rich-text-font-scale))", position: "relative", outline: "none" }), e[0] = u, e[1] = d, e[2] = p) : p = e[2];
|
|
38
|
+
let _;
|
|
39
|
+
e[3] !== n || e[4] !== i || e[5] !== p ? (_ = /* @__PURE__ */ h($, { ref: n, width: "100%", minH: "100%", padding: i, children: p }), e[3] = n, e[4] = i, e[5] = p, e[6] = _) : _ = e[6];
|
|
40
|
+
const g = _;
|
|
41
|
+
if (!c)
|
|
42
|
+
return g;
|
|
43
|
+
const m = o ? "true" : void 0;
|
|
44
|
+
let k;
|
|
45
|
+
e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = {
|
|
46
|
+
width: "100%",
|
|
47
|
+
minH: "100%"
|
|
48
|
+
}, e[7] = k) : k = e[7];
|
|
49
|
+
let y;
|
|
50
|
+
return e[8] !== g || e[9] !== m ? (y = /* @__PURE__ */ h(Ot, { className: "rich-text", "data-rich-message": m, height: "100%", minH: "0", position: "relative", contentProps: k, children: g }), e[8] = g, e[9] = m, e[10] = y) : y = e[10], y;
|
|
51
|
+
}
|
|
52
|
+
class S extends F {
|
|
53
|
+
__href;
|
|
54
|
+
__label;
|
|
55
|
+
static getType() {
|
|
56
|
+
return "reference-link";
|
|
57
|
+
}
|
|
58
|
+
static clone(e) {
|
|
59
|
+
return new S(e.__href, e.__label, e.__key);
|
|
60
|
+
}
|
|
61
|
+
constructor(e, n, r) {
|
|
62
|
+
super(r), this.__href = e, this.__label = n;
|
|
63
|
+
}
|
|
64
|
+
createDOM(e, n) {
|
|
65
|
+
return document.createElement("span");
|
|
66
|
+
}
|
|
67
|
+
updateDOM(e, n, r) {
|
|
68
|
+
return !1;
|
|
69
|
+
}
|
|
70
|
+
getTextContent() {
|
|
71
|
+
return `{{link('${this.__label ?? this.__href}')}}`;
|
|
72
|
+
}
|
|
73
|
+
exportJSON() {
|
|
74
|
+
return {
|
|
75
|
+
type: S.getType(),
|
|
76
|
+
version: 1,
|
|
77
|
+
href: this.__href,
|
|
78
|
+
label: this.__label
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
static importJSON(e) {
|
|
82
|
+
return Te(e.href, e.label);
|
|
83
|
+
}
|
|
84
|
+
decorate(e, n) {
|
|
85
|
+
const r = this.__href, s = r.split("/").pop() || "unknown", l = /^https?:\/\//i.test(r), a = /^#?\$PROJECT\//i.test(r);
|
|
86
|
+
return /* @__PURE__ */ h($, { width: "fit-content", display: "inline-block", children: /* @__PURE__ */ h(bn, { fileName: s, onSelect: () => {
|
|
87
|
+
if (l)
|
|
88
|
+
window.open(r, "_blank", "noopener,noreferrer");
|
|
89
|
+
else if (a) {
|
|
90
|
+
const o = r.replace(/^#?\$PROJECT\//i, ""), c = new CustomEvent("ui:open-project-file", {
|
|
91
|
+
detail: o
|
|
92
|
+
});
|
|
93
|
+
window.dispatchEvent(c);
|
|
94
|
+
} else
|
|
95
|
+
window.location.assign(r);
|
|
96
|
+
} }) });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function Te(t, e) {
|
|
100
|
+
return new S(t, e);
|
|
101
|
+
}
|
|
102
|
+
function rt(t) {
|
|
103
|
+
return t instanceof S;
|
|
104
|
+
}
|
|
105
|
+
const Ae = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/, $n = {
|
|
106
|
+
dependencies: [S],
|
|
107
|
+
export: (t) => {
|
|
108
|
+
if (rt(t)) {
|
|
109
|
+
const e = t.__href, n = t.__label ?? e;
|
|
110
|
+
return n ? `{{link('${n}')}}` : `{{link('${e}')}}`;
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
},
|
|
114
|
+
regExp: Ae,
|
|
115
|
+
importRegExp: Ae,
|
|
116
|
+
replace: (t, e) => {
|
|
117
|
+
const n = e[2], i = /^(https?:\/\/|\/)/i.test(n) ? n : `#${n}`, s = n;
|
|
118
|
+
t.replace(Te(i, s));
|
|
119
|
+
},
|
|
120
|
+
type: "text-match"
|
|
121
|
+
}, Sn = {
|
|
122
|
+
code: "rich-text__code",
|
|
123
|
+
codeHighlight: {
|
|
124
|
+
atrule: "rich-text__tokenAttr",
|
|
125
|
+
attr: "rich-text__tokenAttr",
|
|
126
|
+
boolean: "rich-text__tokenProperty",
|
|
127
|
+
builtin: "rich-text__tokenSelector",
|
|
128
|
+
cdata: "rich-text__tokenComment",
|
|
129
|
+
char: "rich-text__tokenSelector",
|
|
130
|
+
class: "rich-text__tokenFunction",
|
|
131
|
+
"class-name": "rich-text__tokenFunction",
|
|
132
|
+
comment: "rich-text__tokenComment",
|
|
133
|
+
constant: "rich-text__tokenProperty",
|
|
134
|
+
deleted: "rich-text__tokenProperty",
|
|
135
|
+
doctype: "rich-text__tokenComment",
|
|
136
|
+
entity: "rich-text__tokenOperator",
|
|
137
|
+
function: "rich-text__tokenFunction",
|
|
138
|
+
important: "rich-text__tokenVariable",
|
|
139
|
+
inserted: "rich-text__tokenSelector",
|
|
140
|
+
keyword: "rich-text__tokenAttr",
|
|
141
|
+
namespace: "rich-text__tokenVariable",
|
|
142
|
+
number: "rich-text__tokenProperty",
|
|
143
|
+
operator: "rich-text__tokenOperator",
|
|
144
|
+
prolog: "rich-text__tokenComment",
|
|
145
|
+
property: "rich-text__tokenProperty",
|
|
146
|
+
punctuation: "rich-text__tokenPunctuation",
|
|
147
|
+
regex: "rich-text__tokenVariable",
|
|
148
|
+
selector: "rich-text__tokenSelector",
|
|
149
|
+
string: "rich-text__tokenSelector",
|
|
150
|
+
symbol: "rich-text__tokenProperty",
|
|
151
|
+
tag: "rich-text__tokenProperty",
|
|
152
|
+
url: "rich-text__tokenOperator",
|
|
153
|
+
variable: "rich-text__tokenVariable"
|
|
154
|
+
},
|
|
155
|
+
embedBlock: {
|
|
156
|
+
base: "rich-text__embedBlock",
|
|
157
|
+
focus: "rich-text__embedBlockFocus"
|
|
158
|
+
},
|
|
159
|
+
list: {
|
|
160
|
+
checklist: "rich-text__checklist",
|
|
161
|
+
listitem: "rich-text__listItem",
|
|
162
|
+
listitemChecked: "rich-text__listItemChecked",
|
|
163
|
+
listitemUnchecked: "rich-text__listItemUnchecked",
|
|
164
|
+
nested: {
|
|
165
|
+
listitem: "rich-text__nestedListItem"
|
|
166
|
+
},
|
|
167
|
+
olDepth: ["rich-text__ol1", "rich-text__ol2", "rich-text__ol3", "rich-text__ol4", "rich-text__ol5"],
|
|
168
|
+
ol: "rich-text__ol",
|
|
169
|
+
ul: "rich-text__ul"
|
|
170
|
+
},
|
|
171
|
+
heading: {
|
|
172
|
+
h1: "rich-text__h1",
|
|
173
|
+
h2: "rich-text__h2",
|
|
174
|
+
h3: "rich-text__h3"
|
|
175
|
+
},
|
|
176
|
+
paragraph: "rich-text__p",
|
|
177
|
+
text: {
|
|
178
|
+
underline: "rich-text__textUnderline",
|
|
179
|
+
italic: "rich-text__textItalic",
|
|
180
|
+
code: "rich-text__textCode"
|
|
181
|
+
},
|
|
182
|
+
link: "rich-text__link",
|
|
183
|
+
quote: "rich-text__quote",
|
|
184
|
+
reference: "rich-text__reference",
|
|
185
|
+
table: "rich-text__table",
|
|
186
|
+
tableCell: "rich-text__tableCell",
|
|
187
|
+
tableRow: "rich-text__tableRow",
|
|
188
|
+
tableCellHeader: "rich-text__tableCellHeader",
|
|
189
|
+
layoutContainer: "rich-text__layoutContainer",
|
|
190
|
+
layoutItem: "rich-text__layoutItem",
|
|
191
|
+
draggableBlockDemo: {
|
|
192
|
+
row: "rich-text__row",
|
|
193
|
+
content: "rich-text__content"
|
|
194
|
+
}
|
|
195
|
+
}, it = {
|
|
196
|
+
extensions: [kn(), yn()],
|
|
197
|
+
mdastExtensions: [fn(), _n()]
|
|
198
|
+
}, vn = {
|
|
199
|
+
bullet: "-",
|
|
200
|
+
emphasis: "*",
|
|
201
|
+
extensions: [hn(), mn()],
|
|
202
|
+
fence: "`",
|
|
203
|
+
fences: !0,
|
|
204
|
+
listItemIndent: "one",
|
|
205
|
+
rule: "-",
|
|
206
|
+
strong: "*"
|
|
207
|
+
}, On = (t) => t.match(/^ {0,3}(`{3,}|~{3,})/), Mn = (t) => {
|
|
208
|
+
let e = null, n = "";
|
|
209
|
+
for (let r = 0; r < t.length; ) {
|
|
210
|
+
if (t[r] === "`") {
|
|
211
|
+
let s = r;
|
|
212
|
+
for (; t[s] === "`"; ) s += 1;
|
|
213
|
+
const l = s - r;
|
|
214
|
+
e === null ? e = l : e === l && (e = null), n += t.slice(r, s), r = s;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
const i = t.slice(r, r + 2);
|
|
218
|
+
if (e === null && (i === "\\(" || i === "\\)")) {
|
|
219
|
+
n += "$", r += 2;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (e === null && (i === "\\[" || i === "\\]")) {
|
|
223
|
+
n += "$$", r += 2;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
n += t[r], r += 1;
|
|
227
|
+
}
|
|
228
|
+
return n;
|
|
229
|
+
}, Ln = (t) => {
|
|
230
|
+
let e = null;
|
|
231
|
+
const n = [];
|
|
232
|
+
for (const r of t.split(`
|
|
233
|
+
`)) {
|
|
234
|
+
if (e) {
|
|
235
|
+
n.push(r);
|
|
236
|
+
const l = r.match(/^ {0,3}(`+|~+)[ \t]*$/)?.[1];
|
|
237
|
+
l?.[0] === e.character && l.length >= e.length && (e = null);
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
const i = On(r)?.[1];
|
|
241
|
+
if (i) {
|
|
242
|
+
e = {
|
|
243
|
+
character: i[0] ?? "`",
|
|
244
|
+
length: i.length
|
|
245
|
+
}, n.push(r);
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
const s = r.match(/^( {0,3})\\\[\s*(.*?)\s*\\\][ \t]*$/);
|
|
249
|
+
if (s) {
|
|
250
|
+
const l = s[1] ?? "";
|
|
251
|
+
n.push(`${l}$$`, s[2] ?? "", `${l}$$`);
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (/^ {0,3}\\\[[ \t]*$/.test(r)) {
|
|
255
|
+
n.push(r.replace("\\[", () => "$$"));
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
if (/^ {0,3}\\\][ \t]*$/.test(r)) {
|
|
259
|
+
n.push(r.replace("\\]", () => "$$"));
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
n.push(Mn(r));
|
|
263
|
+
}
|
|
264
|
+
return n.join(`
|
|
265
|
+
`);
|
|
266
|
+
}, st = (t) => nt(Ln(t), it), D = (t) => nt(t, it), lt = (t) => gn(t, vn).trimEnd(), $e = (t) => lt({
|
|
267
|
+
type: "root",
|
|
268
|
+
children: [t]
|
|
269
|
+
}), U = (t) => $e({
|
|
270
|
+
type: "paragraph",
|
|
271
|
+
children: t
|
|
272
|
+
}), ot = (t) => {
|
|
273
|
+
const n = st(t).children[0];
|
|
274
|
+
return n?.type === "paragraph" || n?.type === "heading" ? n.children : [];
|
|
275
|
+
}, Rn = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]), In = /^data:image\/(?:png|gif|jpeg|webp);base64,[a-z0-9+/=]+$/i, at = /^[a-z][a-z\d+.-]*:/i, An = (t) => {
|
|
276
|
+
if (t.startsWith("#") || t.startsWith("/") || t.startsWith("./") || t.startsWith("../") || !at.test(t)) return !0;
|
|
277
|
+
try {
|
|
278
|
+
return Rn.has(new URL(t).protocol);
|
|
279
|
+
} catch {
|
|
280
|
+
return !1;
|
|
281
|
+
}
|
|
282
|
+
}, Bn = (t) => t.startsWith("https://") ? !0 : In.test(t), ae = (t, e, n) => {
|
|
283
|
+
const r = n ? n(t, e) : t;
|
|
284
|
+
return r === null ? null : e === "image" ? !at.test(t) && !n ? null : Bn(r) ? r : null : An(r) ? r : null;
|
|
285
|
+
}, ct = an(void 0), li = (t) => {
|
|
286
|
+
const e = x(3), {
|
|
287
|
+
children: n,
|
|
288
|
+
resolver: r
|
|
289
|
+
} = t;
|
|
290
|
+
let i;
|
|
291
|
+
return e[0] !== n || e[1] !== r ? (i = /* @__PURE__ */ h(ct.Provider, { value: r, children: n }), e[0] = n, e[1] = r, e[2] = i) : i = e[2], i;
|
|
292
|
+
}, Se = () => cn(ct), ut = (t) => {
|
|
293
|
+
const e = x(10), {
|
|
294
|
+
source: n,
|
|
295
|
+
alt: r,
|
|
296
|
+
title: i,
|
|
297
|
+
onLoad: s
|
|
298
|
+
} = t, l = Se();
|
|
299
|
+
let a;
|
|
300
|
+
e[0] !== l || e[1] !== n ? (a = ae(n, "image", l), e[0] = l, e[1] = n, e[2] = a) : a = e[2];
|
|
301
|
+
const o = a;
|
|
302
|
+
if (!o) {
|
|
303
|
+
const d = r || "Image";
|
|
304
|
+
let p;
|
|
305
|
+
return e[3] !== d ? (p = /* @__PURE__ */ h($, { as: "span", display: "inline-block", paddingX: "xs", paddingY: "2xs", background: "bg.muted", borderRadius: "sm", children: /* @__PURE__ */ h(Ke, { as: "span", textStyle: "label/S/regular", color: "fg.muted", children: d }) }), e[3] = d, e[4] = p) : p = e[4], p;
|
|
306
|
+
}
|
|
307
|
+
const c = i ?? void 0;
|
|
308
|
+
let u;
|
|
309
|
+
return e[5] !== r || e[6] !== s || e[7] !== o || e[8] !== c ? (u = /* @__PURE__ */ h($t, { src: o, alt: r, title: c, loading: "lazy", referrerPolicy: "no-referrer", onLoad: s }), e[5] = r, e[6] = s, e[7] = o, e[8] = c, e[9] = u) : u = e[9], u;
|
|
310
|
+
};
|
|
311
|
+
class K extends F {
|
|
312
|
+
__source;
|
|
313
|
+
__alt;
|
|
314
|
+
__title;
|
|
315
|
+
static getType() {
|
|
316
|
+
return "markdown-image";
|
|
317
|
+
}
|
|
318
|
+
static clone(e) {
|
|
319
|
+
return new K(e.__source, e.__alt, e.__title, e.__key);
|
|
320
|
+
}
|
|
321
|
+
constructor(e, n, r = null, i) {
|
|
322
|
+
super(i), this.__source = e, this.__alt = n, this.__title = r;
|
|
323
|
+
}
|
|
324
|
+
createDOM() {
|
|
325
|
+
return document.createElement("span");
|
|
326
|
+
}
|
|
327
|
+
updateDOM() {
|
|
328
|
+
return !1;
|
|
329
|
+
}
|
|
330
|
+
isInline() {
|
|
331
|
+
return !0;
|
|
332
|
+
}
|
|
333
|
+
getSource() {
|
|
334
|
+
return this.__source;
|
|
335
|
+
}
|
|
336
|
+
getAlt() {
|
|
337
|
+
return this.__alt;
|
|
338
|
+
}
|
|
339
|
+
getTitle() {
|
|
340
|
+
return this.__title;
|
|
341
|
+
}
|
|
342
|
+
getTextContent() {
|
|
343
|
+
return this.__alt;
|
|
344
|
+
}
|
|
345
|
+
exportJSON() {
|
|
346
|
+
return {
|
|
347
|
+
type: "markdown-image",
|
|
348
|
+
version: 1,
|
|
349
|
+
source: this.__source,
|
|
350
|
+
alt: this.__alt,
|
|
351
|
+
title: this.__title
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
static importJSON(e) {
|
|
355
|
+
return be(e.source, e.alt, e.title);
|
|
356
|
+
}
|
|
357
|
+
decorate(e) {
|
|
358
|
+
const n = () => {
|
|
359
|
+
if (!e.isEditable()) return;
|
|
360
|
+
let r = null;
|
|
361
|
+
e.getEditorState().read(() => {
|
|
362
|
+
const s = Xt(), l = ke(this.getKey());
|
|
363
|
+
if (!Yt(s) || !s.isCollapsed() || !l) return;
|
|
364
|
+
const c = l.getTopLevelElement()?.getNextSibling()?.getKey(), u = s.anchor.getNode().getTopLevelElement();
|
|
365
|
+
c && c === u?.getKey() && (r = c);
|
|
366
|
+
});
|
|
367
|
+
const i = r;
|
|
368
|
+
i && requestAnimationFrame(() => {
|
|
369
|
+
e.getElementByKey(i)?.scrollIntoView({
|
|
370
|
+
block: "end"
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
return /* @__PURE__ */ h(ut, { source: this.__source, alt: this.__alt, title: this.__title, onLoad: n });
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const be = (t, e, n = null) => q(new K(t, e, n)), Dn = (t) => t instanceof K, dt = (t) => /^<!--[\s\S]*-->$/.test(t.trim()), Fn = (t, e) => {
|
|
378
|
+
if (typeof document > "u") return null;
|
|
379
|
+
const n = Nn.sanitize(t, {
|
|
380
|
+
FORBID_TAGS: ["script", "style", "iframe", "object", "embed", "form", "input", "button", "textarea", "select"]
|
|
381
|
+
}), r = document.createElement("template");
|
|
382
|
+
r.innerHTML = n;
|
|
383
|
+
for (const i of r.content.querySelectorAll("[href], [src]")) {
|
|
384
|
+
const s = i.hasAttribute("href") ? "href" : "src", l = s === "href" ? "link" : "image", a = i.getAttribute(s) ?? "", o = ae(a, l, e);
|
|
385
|
+
o ? i.setAttribute(s, o) : i.removeAttribute(s);
|
|
386
|
+
}
|
|
387
|
+
return r.content;
|
|
388
|
+
}, pt = (t) => {
|
|
389
|
+
const e = x(7), {
|
|
390
|
+
source: n,
|
|
391
|
+
display: r
|
|
392
|
+
} = t, i = Se(), s = et(null);
|
|
393
|
+
let l;
|
|
394
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = (d) => {
|
|
395
|
+
s.current = d;
|
|
396
|
+
}, e[0] = l) : l = e[0];
|
|
397
|
+
const a = l;
|
|
398
|
+
let o, c;
|
|
399
|
+
if (e[1] !== i || e[2] !== n ? (o = () => {
|
|
400
|
+
const d = Fn(n, i), p = s.current;
|
|
401
|
+
p && p.replaceChildren(d ? d.cloneNode(!0) : document.createTextNode(""));
|
|
402
|
+
}, c = [i, n], e[1] = i, e[2] = n, e[3] = o, e[4] = c) : (o = e[3], c = e[4]), oe(o, c), dt(n))
|
|
403
|
+
return null;
|
|
404
|
+
if (r === "inline") {
|
|
405
|
+
let d;
|
|
406
|
+
return e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ h("span", { ref: a }), e[5] = d) : d = e[5], d;
|
|
407
|
+
}
|
|
408
|
+
let u;
|
|
409
|
+
return e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ h("div", { ref: a }), e[6] = u) : u = e[6], u;
|
|
410
|
+
};
|
|
411
|
+
class j extends F {
|
|
412
|
+
__source;
|
|
413
|
+
__display;
|
|
414
|
+
static getType() {
|
|
415
|
+
return "raw-html";
|
|
416
|
+
}
|
|
417
|
+
static clone(e) {
|
|
418
|
+
return new j(e.__source, e.__display, e.__key);
|
|
419
|
+
}
|
|
420
|
+
constructor(e, n, r) {
|
|
421
|
+
super(r), this.__source = e, this.__display = n;
|
|
422
|
+
}
|
|
423
|
+
createDOM() {
|
|
424
|
+
return document.createElement(this.__display === "inline" ? "span" : "div");
|
|
425
|
+
}
|
|
426
|
+
updateDOM(e) {
|
|
427
|
+
return e.__display !== this.__display;
|
|
428
|
+
}
|
|
429
|
+
isInline() {
|
|
430
|
+
return this.__display === "inline";
|
|
431
|
+
}
|
|
432
|
+
getSource() {
|
|
433
|
+
return this.__source;
|
|
434
|
+
}
|
|
435
|
+
getDisplay() {
|
|
436
|
+
return this.__display;
|
|
437
|
+
}
|
|
438
|
+
getTextContent() {
|
|
439
|
+
return dt(this.__source) ? "" : this.__source;
|
|
440
|
+
}
|
|
441
|
+
exportJSON() {
|
|
442
|
+
return {
|
|
443
|
+
type: "raw-html",
|
|
444
|
+
version: 1,
|
|
445
|
+
source: this.__source,
|
|
446
|
+
display: this.__display
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
static importJSON(e) {
|
|
450
|
+
return ve(e.source, e.display);
|
|
451
|
+
}
|
|
452
|
+
decorate() {
|
|
453
|
+
return /* @__PURE__ */ h(pt, { source: this.__source, display: this.__display });
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
const ve = (t, e) => q(new j(t, e)), ht = (t) => t instanceof j, B = (t) => {
|
|
457
|
+
const e = x(5), {
|
|
458
|
+
nodes: n
|
|
459
|
+
} = t, r = Se();
|
|
460
|
+
let i;
|
|
461
|
+
if (e[0] !== n || e[1] !== r) {
|
|
462
|
+
let s;
|
|
463
|
+
e[3] !== r ? (s = (l, a) => {
|
|
464
|
+
const o = `${l.type}-${a}`;
|
|
465
|
+
switch (l.type) {
|
|
466
|
+
case "text":
|
|
467
|
+
return /* @__PURE__ */ h(un, { children: l.value }, o);
|
|
468
|
+
case "strong":
|
|
469
|
+
return /* @__PURE__ */ h(Ke, { as: "strong", fontWeight: "semibold", children: /* @__PURE__ */ h(B, { nodes: l.children }) }, o);
|
|
470
|
+
case "emphasis":
|
|
471
|
+
return /* @__PURE__ */ h($, { as: "em", children: /* @__PURE__ */ h(B, { nodes: l.children }) }, o);
|
|
472
|
+
case "delete":
|
|
473
|
+
return /* @__PURE__ */ h($, { as: "del", children: /* @__PURE__ */ h(B, { nodes: l.children }) }, o);
|
|
474
|
+
case "inlineCode":
|
|
475
|
+
return /* @__PURE__ */ h(Re, { children: l.value }, o);
|
|
476
|
+
case "break":
|
|
477
|
+
return /* @__PURE__ */ h("br", {}, o);
|
|
478
|
+
case "link": {
|
|
479
|
+
const c = ae(l.url, "link", r);
|
|
480
|
+
return c ? /* @__PURE__ */ h(St, { href: c, title: l.title ?? void 0, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ h(B, { nodes: l.children }) }, o) : /* @__PURE__ */ h(B, { nodes: l.children }, o);
|
|
481
|
+
}
|
|
482
|
+
case "image":
|
|
483
|
+
return /* @__PURE__ */ h(ut, { source: l.url, alt: l.alt ?? "", title: l.title ?? null }, o);
|
|
484
|
+
case "html":
|
|
485
|
+
return /* @__PURE__ */ h(pt, { source: l.value, display: "inline" }, o);
|
|
486
|
+
case "inlineMath":
|
|
487
|
+
return /* @__PURE__ */ h(Re, { children: l.value }, o);
|
|
488
|
+
default:
|
|
489
|
+
return null;
|
|
490
|
+
}
|
|
491
|
+
}, e[3] = r, e[4] = s) : s = e[4], i = n.map(s), e[0] = n, e[1] = r, e[2] = i;
|
|
492
|
+
} else
|
|
493
|
+
i = e[2];
|
|
494
|
+
return i;
|
|
495
|
+
}, ft = (t) => {
|
|
496
|
+
const e = x(4), {
|
|
497
|
+
value: n
|
|
498
|
+
} = t;
|
|
499
|
+
let r;
|
|
500
|
+
e[0] !== n ? (r = ot(n), e[0] = n, e[1] = r) : r = e[1];
|
|
501
|
+
let i;
|
|
502
|
+
return e[2] !== r ? (i = /* @__PURE__ */ h(B, { nodes: r }), e[2] = r, e[3] = i) : i = e[3], i;
|
|
503
|
+
}, qn = (t) => t.rows.map((e) => ({
|
|
504
|
+
id: e.id,
|
|
505
|
+
...e.cells
|
|
506
|
+
})), Pn = (t) => t.columns, zn = (t) => {
|
|
507
|
+
const e = x(38), {
|
|
508
|
+
editor: n,
|
|
509
|
+
nodeKey: r,
|
|
510
|
+
table: i
|
|
511
|
+
} = t, [s, l] = dn(!1), a = et(null);
|
|
512
|
+
let o;
|
|
513
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = () => {
|
|
514
|
+
setTimeout(() => a.current?.focus(), 0);
|
|
515
|
+
}, e[0] = o) : o = e[0];
|
|
516
|
+
const c = o;
|
|
517
|
+
let u;
|
|
518
|
+
e[1] !== n || e[2] !== r ? (u = (f) => {
|
|
519
|
+
n.update(() => {
|
|
520
|
+
const b = ke(r);
|
|
521
|
+
xe(b) && b.setTable(f(b.getTable()));
|
|
522
|
+
}, {
|
|
523
|
+
tag: Ie
|
|
524
|
+
}), c();
|
|
525
|
+
}, e[1] = n, e[2] = r, e[3] = u) : u = e[3];
|
|
526
|
+
const d = u;
|
|
527
|
+
let p;
|
|
528
|
+
e[4] !== d ? (p = (f) => {
|
|
529
|
+
d((b) => ({
|
|
530
|
+
columns: f,
|
|
531
|
+
rows: b.rows.map((N) => ({
|
|
532
|
+
...N,
|
|
533
|
+
cells: Object.fromEntries(f.map((A) => [A.id, N.cells[A.id] ?? ""]))
|
|
534
|
+
}))
|
|
535
|
+
}));
|
|
536
|
+
}, e[4] = d, e[5] = p) : p = e[5];
|
|
537
|
+
const _ = p;
|
|
538
|
+
let g;
|
|
539
|
+
e[6] !== d ? (g = (f) => {
|
|
540
|
+
d((b) => ({
|
|
541
|
+
...b,
|
|
542
|
+
rows: f.map((N, A) => ({
|
|
543
|
+
id: String(N.id ?? b.rows[A]?.id ?? `row-${A + 1}`),
|
|
544
|
+
cells: Object.fromEntries(b.columns.map((Le) => [Le.id, String(N[Le.id] ?? "")]))
|
|
545
|
+
}))
|
|
546
|
+
}));
|
|
547
|
+
}, e[6] = d, e[7] = g) : g = e[7];
|
|
548
|
+
const m = g;
|
|
549
|
+
let k;
|
|
550
|
+
e[8] !== n || e[9] !== r ? (k = () => {
|
|
551
|
+
n.update(() => {
|
|
552
|
+
const f = ke(r);
|
|
553
|
+
if (xe(f)) {
|
|
554
|
+
const b = re();
|
|
555
|
+
f.replace(b), b.select();
|
|
556
|
+
}
|
|
557
|
+
}, {
|
|
558
|
+
tag: Ie
|
|
559
|
+
}), setTimeout(() => n.focus(), 0);
|
|
560
|
+
}, e[8] = n, e[9] = r, e[10] = k) : k = e[10];
|
|
561
|
+
const y = k;
|
|
562
|
+
let C;
|
|
563
|
+
e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (C = (f) => {
|
|
564
|
+
f.target.closest("button, input, textarea, [contenteditable='true'], [role='menuitem']") || (f.preventDefault(), a.current?.focus());
|
|
565
|
+
}, e[11] = C) : C = e[11];
|
|
566
|
+
const wt = C;
|
|
567
|
+
let G;
|
|
568
|
+
e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (G = (f) => {
|
|
569
|
+
f.currentTarget.contains(f.relatedTarget) || l(!1);
|
|
570
|
+
}, e[12] = G) : G = e[12];
|
|
571
|
+
const Et = G;
|
|
572
|
+
let Q;
|
|
573
|
+
e[13] !== y || e[14] !== n || e[15] !== s ? (Q = (f) => {
|
|
574
|
+
const b = f.target, N = b.matches("input, textarea") || b.isContentEditable;
|
|
575
|
+
if ((f.ctrlKey || f.metaKey) && f.key.toLowerCase() === "z" && !N) {
|
|
576
|
+
f.preventDefault(), f.stopPropagation(), n.dispatchCommand(f.shiftKey ? Zt : en, void 0);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
N || s && (f.key === "Delete" || f.key === "Backspace") && (f.preventDefault(), f.stopPropagation(), y());
|
|
580
|
+
}, e[13] = y, e[14] = n, e[15] = s, e[16] = Q) : Q = e[16];
|
|
581
|
+
const de = Q, pe = String(s), he = s ? "2px solid" : "none";
|
|
582
|
+
let X;
|
|
583
|
+
e[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (X = () => l(!0), e[17] = X) : X = e[17];
|
|
584
|
+
let M;
|
|
585
|
+
e[18] !== i ? (M = qn(i), e[18] = i, e[19] = M) : M = e[19];
|
|
586
|
+
let L;
|
|
587
|
+
e[20] !== i ? (L = Pn(i), e[20] = i, e[21] = L) : L = e[21];
|
|
588
|
+
let R;
|
|
589
|
+
e[22] !== _ || e[23] !== m || e[24] !== L ? (R = {
|
|
590
|
+
columns: L,
|
|
591
|
+
onColumnsChange: _,
|
|
592
|
+
onDataChange: m,
|
|
593
|
+
renderHeader: Un,
|
|
594
|
+
renderCell: Hn,
|
|
595
|
+
renderCellEditor: Jn
|
|
596
|
+
}, e[22] = _, e[23] = m, e[24] = L, e[25] = R) : R = e[25];
|
|
597
|
+
let Y;
|
|
598
|
+
e[26] !== n ? (Y = n.isEditable(), e[26] = n, e[27] = Y) : Y = e[27];
|
|
599
|
+
const fe = !Y;
|
|
600
|
+
let I;
|
|
601
|
+
e[28] !== M || e[29] !== R || e[30] !== fe ? (I = /* @__PURE__ */ h(Cn, { data: M, editMode: R, fullWidth: !0, getRowId: Kn, initialPageSize: 30, isReadOnly: fe }), e[28] = M, e[29] = R, e[30] = fe, e[31] = I) : I = e[31];
|
|
602
|
+
let Z;
|
|
603
|
+
return e[32] !== de || e[33] !== s || e[34] !== I || e[35] !== pe || e[36] !== he ? (Z = /* @__PURE__ */ h($, { ref: a, "data-testid": "markdown-table-node", "data-selected": pe, "aria-label": "Markdown table", "aria-selected": s, tabIndex: 0, outline: he, outlineColor: "border.accent-light", outlineOffset: "2px", borderRadius: "sm", onFocus: X, onBlur: Et, onClick: wt, onKeyDownCapture: de, children: I }), e[32] = de, e[33] = s, e[34] = I, e[35] = pe, e[36] = he, e[37] = Z) : Z = e[37], Z;
|
|
604
|
+
};
|
|
605
|
+
class W extends F {
|
|
606
|
+
__table;
|
|
607
|
+
static getType() {
|
|
608
|
+
return "data_table";
|
|
609
|
+
}
|
|
610
|
+
static clone(e) {
|
|
611
|
+
return new W(e.__table, e.__key);
|
|
612
|
+
}
|
|
613
|
+
constructor(e, n) {
|
|
614
|
+
super(n), this.__table = e;
|
|
615
|
+
}
|
|
616
|
+
getTable() {
|
|
617
|
+
return this.getLatest().__table;
|
|
618
|
+
}
|
|
619
|
+
setTable(e) {
|
|
620
|
+
const n = this.getWritable();
|
|
621
|
+
n.__table = e;
|
|
622
|
+
}
|
|
623
|
+
createDOM() {
|
|
624
|
+
return document.createElement("div");
|
|
625
|
+
}
|
|
626
|
+
updateDOM() {
|
|
627
|
+
return !1;
|
|
628
|
+
}
|
|
629
|
+
decorate(e) {
|
|
630
|
+
return /* @__PURE__ */ h(zn, { editor: e, nodeKey: this.__key, table: this.__table });
|
|
631
|
+
}
|
|
632
|
+
exportJSON() {
|
|
633
|
+
return {
|
|
634
|
+
type: "data_table",
|
|
635
|
+
version: 2,
|
|
636
|
+
table: this.__table
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
static importJSON(e) {
|
|
640
|
+
return mt(e.table);
|
|
641
|
+
}
|
|
642
|
+
getTextContent() {
|
|
643
|
+
const e = this.__table.columns.map((i) => i.label).join(" | "), n = this.__table.columns.map(() => "---").join(" | "), r = this.__table.rows.map((i) => this.__table.columns.map((s) => i.cells[s.id] ?? "").join(" | "));
|
|
644
|
+
return [e, n, ...r].join(`
|
|
645
|
+
`);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
const mt = (t) => q(new W(t)), xe = (t) => t instanceof W;
|
|
649
|
+
function Un(t) {
|
|
650
|
+
return /* @__PURE__ */ h(ft, { value: t.label });
|
|
651
|
+
}
|
|
652
|
+
function Hn(t) {
|
|
653
|
+
return /* @__PURE__ */ h(ft, { value: String(t.value ?? "") });
|
|
654
|
+
}
|
|
655
|
+
function Jn(t) {
|
|
656
|
+
const {
|
|
657
|
+
value: e,
|
|
658
|
+
onChange: n
|
|
659
|
+
} = t;
|
|
660
|
+
return /* @__PURE__ */ h(xn, { autoFocus: !0, defaultState: e, fullWidth: !0, isEditable: !0, padding: "xs", scrollable: !1, onChange: n });
|
|
661
|
+
}
|
|
662
|
+
function Kn(t) {
|
|
663
|
+
return String(t.id);
|
|
664
|
+
}
|
|
665
|
+
const Ce = (t, e) => ae(t, "link", e) ?? "about:blank";
|
|
666
|
+
class V extends Ee {
|
|
667
|
+
__source;
|
|
668
|
+
static getType() {
|
|
669
|
+
return "markdown-link";
|
|
670
|
+
}
|
|
671
|
+
static clone(e) {
|
|
672
|
+
return new V(e.__source, e.__url, {
|
|
673
|
+
rel: e.__rel,
|
|
674
|
+
target: e.__target,
|
|
675
|
+
title: e.__title
|
|
676
|
+
}, e.__key);
|
|
677
|
+
}
|
|
678
|
+
constructor(e = "", n, r, i) {
|
|
679
|
+
super(n ?? Ce(e), r, i), this.__source = e;
|
|
680
|
+
}
|
|
681
|
+
getSource() {
|
|
682
|
+
return this.__source;
|
|
683
|
+
}
|
|
684
|
+
setURL(e) {
|
|
685
|
+
const n = this.getWritable();
|
|
686
|
+
return n.__source = e, n.__url = Ce(e), n;
|
|
687
|
+
}
|
|
688
|
+
exportJSON() {
|
|
689
|
+
return {
|
|
690
|
+
...super.exportJSON(),
|
|
691
|
+
source: this.__source,
|
|
692
|
+
type: "markdown-link",
|
|
693
|
+
version: 1
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
static importJSON(e) {
|
|
697
|
+
return Ne(e.source, void 0, {
|
|
698
|
+
rel: e.rel,
|
|
699
|
+
target: e.target,
|
|
700
|
+
title: e.title
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
const Ne = (t, e, n) => q(new V(t, Ce(t, e), n)), jn = (t) => t instanceof V, Wn = on.lazy(() => import("./EquationComponent-DeDYHvqY.js"));
|
|
705
|
+
function Be(t) {
|
|
706
|
+
let e = t.getAttribute("data-lexical-equation");
|
|
707
|
+
const n = t.getAttribute("data-lexical-inline") === "true";
|
|
708
|
+
return e = atob(e || ""), e ? {
|
|
709
|
+
node: P(e, n)
|
|
710
|
+
} : null;
|
|
711
|
+
}
|
|
712
|
+
class O extends F {
|
|
713
|
+
__equation;
|
|
714
|
+
__inline;
|
|
715
|
+
static getType() {
|
|
716
|
+
return "equation";
|
|
717
|
+
}
|
|
718
|
+
static clone(e) {
|
|
719
|
+
return new O(e.__equation, e.__inline, e.__key);
|
|
720
|
+
}
|
|
721
|
+
constructor(e, n, r) {
|
|
722
|
+
super(r), this.__equation = e, this.__inline = n ?? !1;
|
|
723
|
+
}
|
|
724
|
+
static importJSON(e) {
|
|
725
|
+
return P(e.equation, e.inline);
|
|
726
|
+
}
|
|
727
|
+
exportJSON() {
|
|
728
|
+
return {
|
|
729
|
+
equation: this.getEquation(),
|
|
730
|
+
inline: this.__inline,
|
|
731
|
+
type: "equation",
|
|
732
|
+
version: 1
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
createDOM(e) {
|
|
736
|
+
const n = document.createElement(this.__inline ? "span" : "div");
|
|
737
|
+
return n.className = "editor-equation", n;
|
|
738
|
+
}
|
|
739
|
+
exportDOM() {
|
|
740
|
+
const e = document.createElement(this.__inline ? "span" : "div"), n = btoa(this.__equation);
|
|
741
|
+
return e.setAttribute("data-lexical-equation", n), e.setAttribute("data-lexical-inline", `${this.__inline}`), wn.render(this.__equation, e, {
|
|
742
|
+
displayMode: !this.__inline,
|
|
743
|
+
// true === block display //
|
|
744
|
+
errorColor: "#cc0000",
|
|
745
|
+
output: "html",
|
|
746
|
+
strict: "warn",
|
|
747
|
+
throwOnError: !1,
|
|
748
|
+
trust: !1
|
|
749
|
+
}), {
|
|
750
|
+
element: e
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
static importDOM() {
|
|
754
|
+
return {
|
|
755
|
+
div: (e) => e.hasAttribute("data-lexical-equation") ? {
|
|
756
|
+
conversion: Be,
|
|
757
|
+
priority: 2
|
|
758
|
+
} : null,
|
|
759
|
+
span: (e) => e.hasAttribute("data-lexical-equation") ? {
|
|
760
|
+
conversion: Be,
|
|
761
|
+
priority: 1
|
|
762
|
+
} : null
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
updateDOM(e) {
|
|
766
|
+
return this.__inline !== e.__inline;
|
|
767
|
+
}
|
|
768
|
+
getTextContent() {
|
|
769
|
+
return this.__equation;
|
|
770
|
+
}
|
|
771
|
+
getEquation() {
|
|
772
|
+
return this.__equation;
|
|
773
|
+
}
|
|
774
|
+
setEquation(e) {
|
|
775
|
+
const n = this.getWritable();
|
|
776
|
+
n.__equation = e;
|
|
777
|
+
}
|
|
778
|
+
isInline() {
|
|
779
|
+
return this.__inline;
|
|
780
|
+
}
|
|
781
|
+
decorate() {
|
|
782
|
+
return /* @__PURE__ */ h(tt, { fallback: null, children: /* @__PURE__ */ h(Wn, { equation: this.__equation, inline: this.__inline }) });
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
function P(t = "", e = !1) {
|
|
786
|
+
const n = new O(t, e);
|
|
787
|
+
return q(n);
|
|
788
|
+
}
|
|
789
|
+
function ce(t) {
|
|
790
|
+
return t instanceof O;
|
|
791
|
+
}
|
|
792
|
+
const Vn = {
|
|
793
|
+
dependencies: [O],
|
|
794
|
+
export: (t) => ce(t) && t.isInline() ? `\\( ${t.getEquation().trim()} \\)` : null,
|
|
795
|
+
importRegExp: /\\\((.*?)\\\)/,
|
|
796
|
+
regExp: /\\\((.*?)\\\)/,
|
|
797
|
+
replace: (t, e) => {
|
|
798
|
+
const n = P(e[1].trim(), !0);
|
|
799
|
+
t.replace(n);
|
|
800
|
+
},
|
|
801
|
+
type: "text-match"
|
|
802
|
+
}, Gn = {
|
|
803
|
+
dependencies: [O],
|
|
804
|
+
regExpStart: /\\\[/,
|
|
805
|
+
regExpEnd: /\\]/,
|
|
806
|
+
export: (t) => ce(t) && !t.isInline() ? `\\[ ${t.getEquation().trim()} \\]` : null,
|
|
807
|
+
replace: (t, e, n, r, i) => i ? (t.append(P(i.join(" "), !1)), !0) : !1,
|
|
808
|
+
type: "multiline-element"
|
|
809
|
+
};
|
|
810
|
+
function oi() {
|
|
811
|
+
return null;
|
|
812
|
+
}
|
|
813
|
+
class z extends tn {
|
|
814
|
+
static getType() {
|
|
815
|
+
return "hr";
|
|
816
|
+
}
|
|
817
|
+
static clone(e) {
|
|
818
|
+
return new z(e?.__key);
|
|
819
|
+
}
|
|
820
|
+
static importJSON(e) {
|
|
821
|
+
return Oe();
|
|
822
|
+
}
|
|
823
|
+
exportJSON() {
|
|
824
|
+
return {
|
|
825
|
+
...super.exportJSON()
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
createDOM(e, n) {
|
|
829
|
+
const r = document.createElement("hr");
|
|
830
|
+
return r.style = "margin: 2rem 0;", r;
|
|
831
|
+
}
|
|
832
|
+
updateDOM(e, n, r) {
|
|
833
|
+
return !1;
|
|
834
|
+
}
|
|
835
|
+
decorate(e) {
|
|
836
|
+
return null;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
function Oe() {
|
|
840
|
+
return new z();
|
|
841
|
+
}
|
|
842
|
+
function _t(t) {
|
|
843
|
+
return t instanceof z;
|
|
844
|
+
}
|
|
845
|
+
const Qn = pn(() => import("./MermaidComponent-D92GMhht.js"));
|
|
846
|
+
class v extends F {
|
|
847
|
+
__code;
|
|
848
|
+
static getType() {
|
|
849
|
+
return "mermaid";
|
|
850
|
+
}
|
|
851
|
+
static clone(e) {
|
|
852
|
+
return new v(e.__code, e.__key);
|
|
853
|
+
}
|
|
854
|
+
constructor(e, n) {
|
|
855
|
+
super(n), this.__code = e;
|
|
856
|
+
}
|
|
857
|
+
createDOM() {
|
|
858
|
+
return document.createElement("div");
|
|
859
|
+
}
|
|
860
|
+
updateDOM() {
|
|
861
|
+
return !1;
|
|
862
|
+
}
|
|
863
|
+
static importJSON(e) {
|
|
864
|
+
return new v(e.code);
|
|
865
|
+
}
|
|
866
|
+
exportJSON() {
|
|
867
|
+
return {
|
|
868
|
+
type: "mermaid",
|
|
869
|
+
code: this.__code,
|
|
870
|
+
version: 1
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
getTextContent() {
|
|
874
|
+
return `\`\`\`mermaid
|
|
875
|
+
${this.__code}
|
|
876
|
+
\`\`\``;
|
|
877
|
+
}
|
|
878
|
+
getCode() {
|
|
879
|
+
return this.__code;
|
|
880
|
+
}
|
|
881
|
+
setCode(e) {
|
|
882
|
+
const n = this.getWritable();
|
|
883
|
+
n.__code = e;
|
|
884
|
+
}
|
|
885
|
+
decorate() {
|
|
886
|
+
return /* @__PURE__ */ h(tt, { fallback: null, children: /* @__PURE__ */ h(Qn, { code: this.__code, nodeKey: this.__key }) });
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
function Xn(t) {
|
|
890
|
+
return t instanceof v;
|
|
891
|
+
}
|
|
892
|
+
function Yn(t) {
|
|
893
|
+
return q(new v(t));
|
|
894
|
+
}
|
|
895
|
+
const Zn = {
|
|
896
|
+
dependencies: [z],
|
|
897
|
+
export: (t) => _t(t) ? "***" : null,
|
|
898
|
+
regExp: /^(---|\*\*\*|___)\s?$/,
|
|
899
|
+
replace: (t) => {
|
|
900
|
+
const e = Oe();
|
|
901
|
+
t.replace(e);
|
|
902
|
+
},
|
|
903
|
+
type: "element"
|
|
904
|
+
}, er = {
|
|
905
|
+
dependencies: [ye],
|
|
906
|
+
export: (t, e) => {
|
|
907
|
+
if (t instanceof ye) {
|
|
908
|
+
let n = t.getTextContent();
|
|
909
|
+
if (t.hasFormat("bold"))
|
|
910
|
+
n = `**${n}**`;
|
|
911
|
+
else if (t.hasFormat("italic"))
|
|
912
|
+
n = `*${n}*`;
|
|
913
|
+
else if (t.hasFormat("underline"))
|
|
914
|
+
n = `<ins>${n}</ins>`;
|
|
915
|
+
else
|
|
916
|
+
return null;
|
|
917
|
+
return n;
|
|
918
|
+
}
|
|
919
|
+
return null;
|
|
920
|
+
},
|
|
921
|
+
regExp: /<ins>(.*)<\/ins>/,
|
|
922
|
+
importRegExp: /<ins>(.*)<\/ins>/,
|
|
923
|
+
replace: (t, e) => {
|
|
924
|
+
const n = E(e[1]);
|
|
925
|
+
n.toggleFormat("underline"), t.replace(n);
|
|
926
|
+
},
|
|
927
|
+
type: "text-match"
|
|
928
|
+
}, tr = {
|
|
929
|
+
dependencies: [ye],
|
|
930
|
+
export: (t, e) => null,
|
|
931
|
+
regExp: /<u>(.*)<\/u>/,
|
|
932
|
+
importRegExp: /<u>(.*)<\/u>/,
|
|
933
|
+
replace: (t, e) => {
|
|
934
|
+
const n = E(e[1]);
|
|
935
|
+
n.toggleFormat("underline"), t.replace(n);
|
|
936
|
+
},
|
|
937
|
+
type: "text-match"
|
|
938
|
+
}, De = /https?:\/\/[^\s<>"']*[^\s<>"'.,:;"')\]}]/, H = (t) => t.replace(/\\([*_`~\\])/g, "$1"), nr = (t) => t.replace(/\\/g, "\\\\").replace(/"/g, '\\"'), rr = (t) => t?.replace(/\\(["\\])/g, "$1"), gt = (t, e, n) => {
|
|
939
|
+
if (t !== e)
|
|
940
|
+
return n;
|
|
941
|
+
const r = e.replace(/([*_`~\\])/g, "\\$1");
|
|
942
|
+
return n.replace(r, e);
|
|
943
|
+
}, ir = {
|
|
944
|
+
dependencies: [Ee],
|
|
945
|
+
export: (t, e) => {
|
|
946
|
+
if (!We(t) || Ve(t))
|
|
947
|
+
return null;
|
|
948
|
+
const n = t.getTitle(), r = H(t.getURL()), i = gt(t.getTextContent(), r, e(t));
|
|
949
|
+
return n != null ? `[${i}](${r} "${nr(n)}")` : `[${i}](${r})`;
|
|
950
|
+
},
|
|
951
|
+
importRegExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,
|
|
952
|
+
regExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,
|
|
953
|
+
replace: (t, e) => {
|
|
954
|
+
const [, n, r, i] = e, s = H(r), l = Mt(s, {
|
|
955
|
+
title: rr(i)
|
|
956
|
+
}), a = n.split("[").length - 1, o = n.split("]").length - 1;
|
|
957
|
+
let c = n, u = "";
|
|
958
|
+
if (a < o)
|
|
959
|
+
return;
|
|
960
|
+
if (a > o) {
|
|
961
|
+
const _ = n.split("[");
|
|
962
|
+
u = `[${_[0]}`, c = _.slice(1).join("[");
|
|
963
|
+
}
|
|
964
|
+
const d = H(c), p = E(d === s ? s : d);
|
|
965
|
+
return p.setFormat(t.getFormat()), l.append(p), t.replace(l), u && l.insertBefore(E(u)), p;
|
|
966
|
+
},
|
|
967
|
+
trigger: ")",
|
|
968
|
+
type: "text-match"
|
|
969
|
+
}, sr = {
|
|
970
|
+
dependencies: [je],
|
|
971
|
+
export: (t, e) => {
|
|
972
|
+
if (!Ve(t))
|
|
973
|
+
return null;
|
|
974
|
+
const n = H(t.getURL());
|
|
975
|
+
return gt(t.getTextContent(), n, e(t));
|
|
976
|
+
},
|
|
977
|
+
regExp: De,
|
|
978
|
+
importRegExp: De,
|
|
979
|
+
replace: (t, e) => {
|
|
980
|
+
const n = H(e[0]), r = Lt(n), i = E(n);
|
|
981
|
+
i.setFormat(t.getFormat()), r.append(i), t.replace(r);
|
|
982
|
+
},
|
|
983
|
+
type: "text-match"
|
|
984
|
+
}, lr = [Zn, er, tr, ir, sr], ai = [zt, Ee, je, V, K, j, W, Ut, Rt, It, Qe, Wt, v, O, z, S], or = [Ft, ...qt.filter((t) => t !== Pt), ...lr, Vn, Gn], ci = [...or, $n], ui = Sn;
|
|
985
|
+
function ar(t) {
|
|
986
|
+
return t.trim().toLowerCase() === "mermaid";
|
|
987
|
+
}
|
|
988
|
+
function cr(t) {
|
|
989
|
+
const e = t.getLanguage() ?? "plaintext";
|
|
990
|
+
return ar(e) ? (t.replace(new v(t.getTextContent())), !0) : !1;
|
|
991
|
+
}
|
|
992
|
+
function di() {
|
|
993
|
+
const t = x(3), [e] = le();
|
|
994
|
+
let n, r;
|
|
995
|
+
return t[0] !== e ? (n = () => {
|
|
996
|
+
e.update(ur);
|
|
997
|
+
}, r = [e], t[0] = e, t[1] = n, t[2] = r) : (n = t[1], r = t[2]), oe(n, r), null;
|
|
998
|
+
}
|
|
999
|
+
function ur() {
|
|
1000
|
+
const t = nn(Qe);
|
|
1001
|
+
for (const e of t)
|
|
1002
|
+
cr(e);
|
|
1003
|
+
}
|
|
1004
|
+
function pi() {
|
|
1005
|
+
const t = x(3), [e] = le();
|
|
1006
|
+
let n, r;
|
|
1007
|
+
return t[0] !== e ? (n = () => Vt(e), r = [e], t[0] = e, t[1] = n, t[2] = r) : (n = t[1], r = t[2]), oe(n, r), null;
|
|
1008
|
+
}
|
|
1009
|
+
const dr = (t) => {
|
|
1010
|
+
let e = t.hasFormat("code") ? {
|
|
1011
|
+
type: "inlineCode",
|
|
1012
|
+
value: t.getTextContent()
|
|
1013
|
+
} : {
|
|
1014
|
+
type: "text",
|
|
1015
|
+
value: t.getTextContent()
|
|
1016
|
+
};
|
|
1017
|
+
return t.hasFormat("code") || (t.hasFormat("bold") && (e = {
|
|
1018
|
+
type: "strong",
|
|
1019
|
+
children: [e]
|
|
1020
|
+
}), t.hasFormat("italic") && (e = {
|
|
1021
|
+
type: "emphasis",
|
|
1022
|
+
children: [e]
|
|
1023
|
+
}), t.hasFormat("strikethrough") && (e = {
|
|
1024
|
+
type: "delete",
|
|
1025
|
+
children: [e]
|
|
1026
|
+
})), t.hasFormat("underline") ? [{
|
|
1027
|
+
type: "html",
|
|
1028
|
+
value: "<ins>"
|
|
1029
|
+
}, e, {
|
|
1030
|
+
type: "html",
|
|
1031
|
+
value: "</ins>"
|
|
1032
|
+
}] : [e];
|
|
1033
|
+
}, kt = (t) => {
|
|
1034
|
+
if (rn(t)) return dr(t);
|
|
1035
|
+
if (sn(t)) return [{
|
|
1036
|
+
type: "break"
|
|
1037
|
+
}];
|
|
1038
|
+
if (Dn(t))
|
|
1039
|
+
return [{
|
|
1040
|
+
type: "image",
|
|
1041
|
+
url: t.getSource(),
|
|
1042
|
+
alt: t.getAlt(),
|
|
1043
|
+
title: t.getTitle()
|
|
1044
|
+
}];
|
|
1045
|
+
if (ce(t) && t.isInline()) return [{
|
|
1046
|
+
type: "inlineMath",
|
|
1047
|
+
value: t.getEquation()
|
|
1048
|
+
}];
|
|
1049
|
+
if (ht(t)) return [{
|
|
1050
|
+
type: "html",
|
|
1051
|
+
value: t.getSource()
|
|
1052
|
+
}];
|
|
1053
|
+
if (rt(t)) return [{
|
|
1054
|
+
type: "text",
|
|
1055
|
+
value: t.getTextContent()
|
|
1056
|
+
}];
|
|
1057
|
+
if (We(t))
|
|
1058
|
+
return [{
|
|
1059
|
+
type: "link",
|
|
1060
|
+
url: jn(t) ? t.getSource() : t.getURL(),
|
|
1061
|
+
title: t.getTitle(),
|
|
1062
|
+
children: ie(t)
|
|
1063
|
+
}];
|
|
1064
|
+
if (Ye(t)) return ie(t);
|
|
1065
|
+
const e = t.getTextContent();
|
|
1066
|
+
return e ? [{
|
|
1067
|
+
type: "text",
|
|
1068
|
+
value: e
|
|
1069
|
+
}] : [];
|
|
1070
|
+
}, ie = (t) => t.getChildren().flatMap(kt), we = (t) => ({
|
|
1071
|
+
type: "paragraph",
|
|
1072
|
+
children: ie(t)
|
|
1073
|
+
}), pr = (t) => {
|
|
1074
|
+
const e = [], n = [];
|
|
1075
|
+
for (const r of t.getChildren())
|
|
1076
|
+
Ge(r) ? (n.length && e.push({
|
|
1077
|
+
type: "paragraph",
|
|
1078
|
+
children: n.splice(0)
|
|
1079
|
+
}), e.push(yt(r))) : Xe(r) ? (n.length && e.push({
|
|
1080
|
+
type: "paragraph",
|
|
1081
|
+
children: n.splice(0)
|
|
1082
|
+
}), e.push(we(r))) : n.push(...kt(r));
|
|
1083
|
+
return (n.length || e.length === 0) && e.unshift({
|
|
1084
|
+
type: "paragraph",
|
|
1085
|
+
children: n
|
|
1086
|
+
}), {
|
|
1087
|
+
type: "listItem",
|
|
1088
|
+
checked: t.getChecked(),
|
|
1089
|
+
spread: !1,
|
|
1090
|
+
children: e
|
|
1091
|
+
};
|
|
1092
|
+
}, yt = (t) => ({
|
|
1093
|
+
type: "list",
|
|
1094
|
+
ordered: t.getListType() === "number",
|
|
1095
|
+
start: t.getListType() === "number" ? t.getStart() : null,
|
|
1096
|
+
spread: !1,
|
|
1097
|
+
children: t.getChildren().filter(At).map(pr)
|
|
1098
|
+
}), Fe = (t) => ({
|
|
1099
|
+
type: "tableCell",
|
|
1100
|
+
children: ot(t)
|
|
1101
|
+
}), hr = (t) => {
|
|
1102
|
+
const e = t.getTable();
|
|
1103
|
+
return {
|
|
1104
|
+
type: "table",
|
|
1105
|
+
align: e.columns.map((n) => n.alignment),
|
|
1106
|
+
children: [{
|
|
1107
|
+
type: "tableRow",
|
|
1108
|
+
children: e.columns.map((n) => Fe(n.label))
|
|
1109
|
+
}, ...e.rows.map((n) => ({
|
|
1110
|
+
type: "tableRow",
|
|
1111
|
+
children: e.columns.map((r) => Fe(n.cells[r.id] ?? ""))
|
|
1112
|
+
}))]
|
|
1113
|
+
};
|
|
1114
|
+
}, bt = (t) => {
|
|
1115
|
+
if (Xe(t)) return we(t);
|
|
1116
|
+
if (Ht(t))
|
|
1117
|
+
return {
|
|
1118
|
+
type: "heading",
|
|
1119
|
+
depth: Number(t.getTag().slice(1)),
|
|
1120
|
+
children: ie(t)
|
|
1121
|
+
};
|
|
1122
|
+
if (Jt(t))
|
|
1123
|
+
return {
|
|
1124
|
+
type: "blockquote",
|
|
1125
|
+
children: t.getChildren().map(bt).filter((n) => n !== null)
|
|
1126
|
+
};
|
|
1127
|
+
if (Ge(t)) return yt(t);
|
|
1128
|
+
if (Gt(t))
|
|
1129
|
+
return {
|
|
1130
|
+
type: "code",
|
|
1131
|
+
lang: t.getLanguage() || null,
|
|
1132
|
+
meta: null,
|
|
1133
|
+
value: t.getTextContent()
|
|
1134
|
+
};
|
|
1135
|
+
if (Xn(t)) return {
|
|
1136
|
+
type: "code",
|
|
1137
|
+
lang: "mermaid",
|
|
1138
|
+
meta: null,
|
|
1139
|
+
value: t.getCode()
|
|
1140
|
+
};
|
|
1141
|
+
if (ce(t)) return {
|
|
1142
|
+
type: "math",
|
|
1143
|
+
meta: null,
|
|
1144
|
+
value: t.getEquation()
|
|
1145
|
+
};
|
|
1146
|
+
if (_t(t)) return {
|
|
1147
|
+
type: "thematicBreak"
|
|
1148
|
+
};
|
|
1149
|
+
if (xe(t)) return hr(t);
|
|
1150
|
+
if (ht(t)) return {
|
|
1151
|
+
type: "html",
|
|
1152
|
+
value: t.getSource()
|
|
1153
|
+
};
|
|
1154
|
+
if (Ye(t)) return we(t);
|
|
1155
|
+
const e = t.getTextContent();
|
|
1156
|
+
return e ? {
|
|
1157
|
+
type: "paragraph",
|
|
1158
|
+
children: [{
|
|
1159
|
+
type: "text",
|
|
1160
|
+
value: e
|
|
1161
|
+
}]
|
|
1162
|
+
} : null;
|
|
1163
|
+
}, qe = (t) => {
|
|
1164
|
+
const e = {
|
|
1165
|
+
type: "root",
|
|
1166
|
+
children: t.getChildren().map(bt).filter((n) => n !== null)
|
|
1167
|
+
};
|
|
1168
|
+
return lt(e);
|
|
1169
|
+
}, fr = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/g, T = (t, e) => {
|
|
1170
|
+
const n = E(t);
|
|
1171
|
+
for (const r of e) n.toggleFormat(r);
|
|
1172
|
+
return n;
|
|
1173
|
+
}, mr = (t, e) => {
|
|
1174
|
+
const n = [];
|
|
1175
|
+
let r = 0;
|
|
1176
|
+
for (const i of t.matchAll(fr)) {
|
|
1177
|
+
const s = i.index ?? 0;
|
|
1178
|
+
s > r && n.push(T(t.slice(r, s), e));
|
|
1179
|
+
const l = i[2] ?? "", a = /^(?:https?:\/\/|\/)/i.test(l) ? l : `#${l}`;
|
|
1180
|
+
n.push(Te(a, l)), r = s + i[0].length;
|
|
1181
|
+
}
|
|
1182
|
+
return r < t.length && n.push(T(t.slice(r), e)), n;
|
|
1183
|
+
}, Pe = (t, e) => e.definitions.get(t.identifier.toLowerCase());
|
|
1184
|
+
function _r(t, e, n) {
|
|
1185
|
+
switch (t.type) {
|
|
1186
|
+
case "text":
|
|
1187
|
+
return mr(t.value, n);
|
|
1188
|
+
case "strong":
|
|
1189
|
+
return w(t.children, e, /* @__PURE__ */ new Set([...n, "bold"]));
|
|
1190
|
+
case "emphasis":
|
|
1191
|
+
return w(t.children, e, /* @__PURE__ */ new Set([...n, "italic"]));
|
|
1192
|
+
case "delete":
|
|
1193
|
+
return w(t.children, e, /* @__PURE__ */ new Set([...n, "strikethrough"]));
|
|
1194
|
+
case "inlineCode":
|
|
1195
|
+
return [T(t.value, /* @__PURE__ */ new Set([...n, "code"]))];
|
|
1196
|
+
case "break":
|
|
1197
|
+
return [ln()];
|
|
1198
|
+
case "link": {
|
|
1199
|
+
const r = Ne(t.url, e.resolver, {
|
|
1200
|
+
title: t.title
|
|
1201
|
+
});
|
|
1202
|
+
return r.append(...w(t.children, e, n)), [r];
|
|
1203
|
+
}
|
|
1204
|
+
case "linkReference": {
|
|
1205
|
+
const r = Pe(t, e);
|
|
1206
|
+
if (!r) return [T(U([t]), n)];
|
|
1207
|
+
const i = Ne(r.url, e.resolver, {
|
|
1208
|
+
title: r.title
|
|
1209
|
+
});
|
|
1210
|
+
return i.append(...w(t.children, e, n)), [i];
|
|
1211
|
+
}
|
|
1212
|
+
case "image":
|
|
1213
|
+
return [be(t.url, t.alt ?? "", t.title ?? null)];
|
|
1214
|
+
case "imageReference": {
|
|
1215
|
+
const r = Pe(t, e);
|
|
1216
|
+
return r ? [be(r.url, t.alt ?? "", r.title ?? null)] : [T(U([t]), n)];
|
|
1217
|
+
}
|
|
1218
|
+
case "inlineMath":
|
|
1219
|
+
return [P(t.value, !0)];
|
|
1220
|
+
case "html":
|
|
1221
|
+
return [ve(t.value, "inline")];
|
|
1222
|
+
default:
|
|
1223
|
+
return [T(U([t]), n)];
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
function w(t, e, n = /* @__PURE__ */ new Set()) {
|
|
1227
|
+
const r = [];
|
|
1228
|
+
let i = 0;
|
|
1229
|
+
for (const s of t) {
|
|
1230
|
+
if (s.type === "html" && /^<(?:ins|u)>$/i.test(s.value.trim())) {
|
|
1231
|
+
i += 1;
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
if (s.type === "html" && /^<\/(?:ins|u)>$/i.test(s.value.trim())) {
|
|
1235
|
+
i = Math.max(i - 1, 0);
|
|
1236
|
+
continue;
|
|
1237
|
+
}
|
|
1238
|
+
const l = new Set(n);
|
|
1239
|
+
i > 0 && l.add("underline"), r.push(..._r(s, e, l));
|
|
1240
|
+
}
|
|
1241
|
+
return r;
|
|
1242
|
+
}
|
|
1243
|
+
const gr = (t, e) => {
|
|
1244
|
+
e.tableIndex += 1;
|
|
1245
|
+
const n = `table-${e.tableIndex}`, r = t.children[0], i = Math.max(r?.children.length ?? 0, 1), s = Array.from({
|
|
1246
|
+
length: i
|
|
1247
|
+
}, (a, o) => ({
|
|
1248
|
+
id: `${n}-column-${o + 1}`,
|
|
1249
|
+
label: r?.children[o] ? U(r.children[o].children) : "",
|
|
1250
|
+
alignment: t.align?.[o] ?? null
|
|
1251
|
+
})), l = t.children.slice(1).map((a, o) => ({
|
|
1252
|
+
id: `${n}-row-${o + 1}`,
|
|
1253
|
+
cells: Object.fromEntries(s.map((c, u) => [c.id, a.children[u] ? U(a.children[u].children) : ""]))
|
|
1254
|
+
}));
|
|
1255
|
+
return {
|
|
1256
|
+
columns: s,
|
|
1257
|
+
rows: l
|
|
1258
|
+
};
|
|
1259
|
+
}, kr = (t, e, n) => {
|
|
1260
|
+
if (e.type !== "listItem") return;
|
|
1261
|
+
const r = Dt(e.checked ?? void 0);
|
|
1262
|
+
t.append(r);
|
|
1263
|
+
for (const i of e.children)
|
|
1264
|
+
i.type === "paragraph" ? r.append(...w(i.children, n)) : i.type === "list" ? Me(r, i, n) : r.append(T($e(i), /* @__PURE__ */ new Set()));
|
|
1265
|
+
}, Me = (t, e, n) => {
|
|
1266
|
+
switch (e.type) {
|
|
1267
|
+
case "paragraph": {
|
|
1268
|
+
const r = re();
|
|
1269
|
+
r.append(...w(e.children, n)), t.append(r);
|
|
1270
|
+
break;
|
|
1271
|
+
}
|
|
1272
|
+
case "heading": {
|
|
1273
|
+
const r = jt(`h${e.depth}`);
|
|
1274
|
+
r.append(...w(e.children, n)), t.append(r);
|
|
1275
|
+
break;
|
|
1276
|
+
}
|
|
1277
|
+
case "blockquote": {
|
|
1278
|
+
const r = Kt();
|
|
1279
|
+
t.append(r);
|
|
1280
|
+
for (const i of e.children) Me(r, i, n);
|
|
1281
|
+
break;
|
|
1282
|
+
}
|
|
1283
|
+
case "list": {
|
|
1284
|
+
const r = e.children.some((l) => l.checked !== null && l.checked !== void 0);
|
|
1285
|
+
let i = "bullet";
|
|
1286
|
+
e.ordered ? i = "number" : r && (i = "check");
|
|
1287
|
+
const s = Bt(i, e.start ?? 1);
|
|
1288
|
+
t.append(s);
|
|
1289
|
+
for (const l of e.children) kr(s, l, n);
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1292
|
+
case "code":
|
|
1293
|
+
t.append(e.lang === "mermaid" ? Yn(e.value) : Qt(e.lang ?? void 0).append(E(e.value)));
|
|
1294
|
+
break;
|
|
1295
|
+
case "math":
|
|
1296
|
+
t.append(P(e.value, !1));
|
|
1297
|
+
break;
|
|
1298
|
+
case "thematicBreak":
|
|
1299
|
+
t.append(Oe());
|
|
1300
|
+
break;
|
|
1301
|
+
case "table":
|
|
1302
|
+
t.append(mt(gr(e, n)));
|
|
1303
|
+
break;
|
|
1304
|
+
case "html":
|
|
1305
|
+
t.append(ve(e.value, "block"));
|
|
1306
|
+
break;
|
|
1307
|
+
case "definition":
|
|
1308
|
+
break;
|
|
1309
|
+
default: {
|
|
1310
|
+
const r = re();
|
|
1311
|
+
r.append(E($e(e))), t.append(r);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
}, yr = (t, e) => {
|
|
1315
|
+
const n = st(t), i = {
|
|
1316
|
+
definitions: new Map(n.children.filter((l) => l.type === "definition").map((l) => [l.identifier.toLowerCase(), l])),
|
|
1317
|
+
resolver: e,
|
|
1318
|
+
tableIndex: 0
|
|
1319
|
+
}, s = Ze();
|
|
1320
|
+
s.clear();
|
|
1321
|
+
for (const l of n.children) Me(s, l, i);
|
|
1322
|
+
s.isEmpty() && s.append(re());
|
|
1323
|
+
}, ee = (t) => {
|
|
1324
|
+
const e = t.position?.start.offset, n = t.position?.end.offset;
|
|
1325
|
+
return e === void 0 || n === void 0 ? null : {
|
|
1326
|
+
end: n,
|
|
1327
|
+
start: e
|
|
1328
|
+
};
|
|
1329
|
+
}, ze = (t) => typeof t == "object" && t !== null && "children" in t && Array.isArray(t.children), br = (t) => typeof t == "object" && t !== null && "type" in t && (t.type === "link" || t.type === "linkReference"), ue = (t) => {
|
|
1330
|
+
const e = [];
|
|
1331
|
+
if (!ze(t)) return e;
|
|
1332
|
+
for (const n of t.children)
|
|
1333
|
+
br(n) && e.push(n), ze(n) && e.push(...ue(n));
|
|
1334
|
+
return e;
|
|
1335
|
+
}, ne = (t) => D(t).children.flatMap((e) => e.type === "table" ? [] : ue(e).map((n) => ({
|
|
1336
|
+
block: e,
|
|
1337
|
+
node: n
|
|
1338
|
+
}))), xr = (t, e, n, r, i, s) => {
|
|
1339
|
+
const l = ee(r), a = ee(s);
|
|
1340
|
+
if (!l || !a) return [];
|
|
1341
|
+
const o = i.map(ee);
|
|
1342
|
+
if (o.some((m) => !m)) return [];
|
|
1343
|
+
const c = [];
|
|
1344
|
+
let u = l.start;
|
|
1345
|
+
for (const m of o) {
|
|
1346
|
+
if (!m) return [];
|
|
1347
|
+
c.push(t.slice(u, m.start)), u = m.end;
|
|
1348
|
+
}
|
|
1349
|
+
c.push(t.slice(u, l.end));
|
|
1350
|
+
const d = e.slice(a.start, a.end), p = c[0] ?? "";
|
|
1351
|
+
if (!d.startsWith(p)) return [];
|
|
1352
|
+
const _ = [];
|
|
1353
|
+
let g = p.length;
|
|
1354
|
+
for (let m = 0; m < i.length; m += 1) {
|
|
1355
|
+
const k = c[m + 1] ?? "", y = m === i.length - 1 ? d.length - k.length : d.indexOf(k, g);
|
|
1356
|
+
if (y < g) return [];
|
|
1357
|
+
_.push({
|
|
1358
|
+
start: g,
|
|
1359
|
+
end: y,
|
|
1360
|
+
value: d.slice(g, y)
|
|
1361
|
+
}), g = y + k.length;
|
|
1362
|
+
}
|
|
1363
|
+
return g !== d.length ? [] : _.flatMap((m, k) => {
|
|
1364
|
+
if (ne(m.value).length > 0) return [];
|
|
1365
|
+
const y = ee(n[k]?.node ?? {}), C = o[k];
|
|
1366
|
+
return !y || !C ? [] : [{
|
|
1367
|
+
edit: {
|
|
1368
|
+
...y,
|
|
1369
|
+
replacement: m.value
|
|
1370
|
+
},
|
|
1371
|
+
normalization: {
|
|
1372
|
+
start: a.start + m.start,
|
|
1373
|
+
end: a.start + m.end,
|
|
1374
|
+
replacement: t.slice(C.start, C.end)
|
|
1375
|
+
}
|
|
1376
|
+
}];
|
|
1377
|
+
});
|
|
1378
|
+
}, Cr = (t, e, n, r, i, s, l, a) => {
|
|
1379
|
+
const o = s.map((c, u) => u);
|
|
1380
|
+
o.sort((c, u) => +(u === l) - +(c === l));
|
|
1381
|
+
for (const c of o) {
|
|
1382
|
+
if (a.has(c)) continue;
|
|
1383
|
+
const u = s[c];
|
|
1384
|
+
if (!u) continue;
|
|
1385
|
+
const d = ue(u);
|
|
1386
|
+
if (i.length <= d.length) continue;
|
|
1387
|
+
const p = xr(e, n, t, r, i, u);
|
|
1388
|
+
if (p.length === i.length - d.length)
|
|
1389
|
+
return {
|
|
1390
|
+
currentBlockIndex: c,
|
|
1391
|
+
replacements: p
|
|
1392
|
+
};
|
|
1393
|
+
}
|
|
1394
|
+
return null;
|
|
1395
|
+
}, Nr = (t, e, n) => {
|
|
1396
|
+
const r = ne(t);
|
|
1397
|
+
if (ne(n).length >= ne(e).length)
|
|
1398
|
+
return {
|
|
1399
|
+
edits: [],
|
|
1400
|
+
normalizedCurrent: n
|
|
1401
|
+
};
|
|
1402
|
+
const i = D(e), s = D(n), l = [], a = [], o = /* @__PURE__ */ new Set();
|
|
1403
|
+
let c = 0;
|
|
1404
|
+
for (let d = 0; d < i.children.length; d += 1) {
|
|
1405
|
+
const p = i.children[d];
|
|
1406
|
+
if (!p || p.type === "table") continue;
|
|
1407
|
+
const _ = ue(p), g = Cr(r.slice(c, c + _.length), e, n, p, _, s.children, d, o);
|
|
1408
|
+
if (g) {
|
|
1409
|
+
for (const m of g.replacements)
|
|
1410
|
+
l.push(m.edit), a.push(m.normalization);
|
|
1411
|
+
o.add(g.currentBlockIndex);
|
|
1412
|
+
}
|
|
1413
|
+
c += _.length;
|
|
1414
|
+
}
|
|
1415
|
+
let u = n;
|
|
1416
|
+
for (const d of a.sort((p, _) => _.start - p.start))
|
|
1417
|
+
u = u.slice(0, d.start) + d.replacement + u.slice(d.end);
|
|
1418
|
+
return {
|
|
1419
|
+
edits: l,
|
|
1420
|
+
normalizedCurrent: u
|
|
1421
|
+
};
|
|
1422
|
+
};
|
|
1423
|
+
function* wr(t, e) {
|
|
1424
|
+
const n = D(t).children, r = D(e).children;
|
|
1425
|
+
if (!(n.length === r.length && n.every((a, o) => a.type === r[o]?.type && a.position?.end.offset !== void 0 && r[o]?.position?.end.offset !== void 0))) {
|
|
1426
|
+
yield* te(t, e);
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
let s = 0, l = 0;
|
|
1430
|
+
for (let a = 0; a < n.length; a += 1) {
|
|
1431
|
+
const o = n[a].position.end.offset, c = r[a].position.end.offset;
|
|
1432
|
+
yield* te(t.slice(s, o), e.slice(l, c)), s = o, l = c;
|
|
1433
|
+
}
|
|
1434
|
+
yield* te(t.slice(s), e.slice(l));
|
|
1435
|
+
}
|
|
1436
|
+
const Ue = (t, e) => {
|
|
1437
|
+
const n = Array.from({
|
|
1438
|
+
length: t.length + 1
|
|
1439
|
+
}).fill(-1), r = Array.from({
|
|
1440
|
+
length: t.length + 1
|
|
1441
|
+
}).fill(-1);
|
|
1442
|
+
let i = 0, s = 0, l = !1;
|
|
1443
|
+
n[0] = 0, r[0] = 0;
|
|
1444
|
+
for (const a of wr(t, e)) {
|
|
1445
|
+
const o = a.value.length;
|
|
1446
|
+
if (a.added) {
|
|
1447
|
+
r[i] = s, s += o, n[i] = s, l && (r[i] = s), l = !1;
|
|
1448
|
+
continue;
|
|
1449
|
+
}
|
|
1450
|
+
if (a.removed) {
|
|
1451
|
+
for (let c = 0; c <= o; c += 1)
|
|
1452
|
+
n[i + c] = s, r[i + c] = s;
|
|
1453
|
+
i += o, l = !0;
|
|
1454
|
+
continue;
|
|
1455
|
+
}
|
|
1456
|
+
for (let c = 0; c <= o; c += 1) {
|
|
1457
|
+
const u = i + c;
|
|
1458
|
+
n[u] = s + c, (r[u] === void 0 || r[u] < 0) && (r[u] = s + c);
|
|
1459
|
+
}
|
|
1460
|
+
i += o, s += o, l = !1;
|
|
1461
|
+
}
|
|
1462
|
+
return {
|
|
1463
|
+
end: r,
|
|
1464
|
+
start: n
|
|
1465
|
+
};
|
|
1466
|
+
}, xt = (t, e, n) => {
|
|
1467
|
+
for (let r = e; r >= 0 && r < t.length; r += n) {
|
|
1468
|
+
const i = t[r];
|
|
1469
|
+
if (i !== void 0 && i >= 0) return i;
|
|
1470
|
+
}
|
|
1471
|
+
return n === -1 ? 0 : t.at(-1) ?? 0;
|
|
1472
|
+
}, Er = (t, e) => {
|
|
1473
|
+
const n = t.start[e];
|
|
1474
|
+
return n !== void 0 && n >= 0 ? n : xt(t.start, e, -1);
|
|
1475
|
+
}, He = (t, e) => {
|
|
1476
|
+
const n = t.end[e];
|
|
1477
|
+
return n !== void 0 && n >= 0 ? n : xt(t.end, e, 1);
|
|
1478
|
+
}, Tr = (t, e) => {
|
|
1479
|
+
const n = [];
|
|
1480
|
+
let r = 0, i = null;
|
|
1481
|
+
const s = () => {
|
|
1482
|
+
i && (n.push(i), i = null);
|
|
1483
|
+
};
|
|
1484
|
+
for (const l of te(t, e)) {
|
|
1485
|
+
if (!l.added && !l.removed) {
|
|
1486
|
+
s(), r += l.value.length;
|
|
1487
|
+
continue;
|
|
1488
|
+
}
|
|
1489
|
+
if (i ??= {
|
|
1490
|
+
start: r,
|
|
1491
|
+
end: r,
|
|
1492
|
+
replacement: ""
|
|
1493
|
+
}, l.added) {
|
|
1494
|
+
i.replacement += l.value;
|
|
1495
|
+
continue;
|
|
1496
|
+
}
|
|
1497
|
+
r += l.value.length, i.end = r;
|
|
1498
|
+
}
|
|
1499
|
+
return s(), n;
|
|
1500
|
+
}, $r = (t) => t.includes(`\r
|
|
1501
|
+
`) ? `\r
|
|
1502
|
+
` : `
|
|
1503
|
+
`, me = (t, e) => {
|
|
1504
|
+
const n = $r(e);
|
|
1505
|
+
return n === `
|
|
1506
|
+
` ? t : t.replaceAll(`
|
|
1507
|
+
`, n);
|
|
1508
|
+
}, se = (t) => Array.isArray(t) ? t.map(se) : !t || typeof t != "object" ? t : Object.fromEntries(Object.entries(t).filter(([e]) => e !== "position").map(([e, n]) => [e, se(n)])), Ct = (t, e) => JSON.stringify(se(t)) === JSON.stringify(se(e)), _e = (t) => D(t).children.filter((e) => e.type === "table" && !!e.position), ge = (t) => t.children.flatMap((e) => e.children), Je = (t, e) => t.children.length === e.children.length && t.children.every((n, r) => n.children.length === e.children[r]?.children.length), J = (t) => {
|
|
1509
|
+
const e = t.position?.start.offset, n = t.position?.end.offset;
|
|
1510
|
+
return e === void 0 || n === void 0 ? null : {
|
|
1511
|
+
end: n,
|
|
1512
|
+
start: e
|
|
1513
|
+
};
|
|
1514
|
+
}, Nt = (t, e) => {
|
|
1515
|
+
const n = e.children[0], r = e.children.at(-1), i = n?.position?.start.offset, s = r?.position?.end.offset;
|
|
1516
|
+
if (i !== void 0 && s !== void 0)
|
|
1517
|
+
return {
|
|
1518
|
+
start: i,
|
|
1519
|
+
end: s
|
|
1520
|
+
};
|
|
1521
|
+
const l = J(e);
|
|
1522
|
+
if (!l) return null;
|
|
1523
|
+
const a = t.slice(l.start, l.end), o = a.indexOf("|"), c = a.endsWith("|") ? a.length - 1 : a.length, u = o < 0 ? 0 : o + 1, d = a.slice(u, c).match(/^\s*/)?.[0].length ?? 0, p = l.start + u + d;
|
|
1524
|
+
return {
|
|
1525
|
+
start: p,
|
|
1526
|
+
end: p
|
|
1527
|
+
};
|
|
1528
|
+
}, Sr = (t, e) => {
|
|
1529
|
+
const n = Nt(t, e);
|
|
1530
|
+
return n ? t.slice(n.start, n.end) : "";
|
|
1531
|
+
}, vr = (t, e, n, r, i) => {
|
|
1532
|
+
const s = ge(n), l = ge(r);
|
|
1533
|
+
return ge(i).flatMap((o, c) => {
|
|
1534
|
+
const u = s[c], d = l[c];
|
|
1535
|
+
if (!u || !d || Ct(d, o)) return [];
|
|
1536
|
+
const p = Nt(t, u);
|
|
1537
|
+
return p ? [{
|
|
1538
|
+
...p,
|
|
1539
|
+
replacement: Sr(e, o)
|
|
1540
|
+
}] : [];
|
|
1541
|
+
});
|
|
1542
|
+
}, Or = (t, e, n, r, i) => {
|
|
1543
|
+
if (Ct(r, i)) return [];
|
|
1544
|
+
if (Je(r, i) && Je(n, r) && JSON.stringify(r.align) === JSON.stringify(i.align))
|
|
1545
|
+
return vr(t, e, n, r, i);
|
|
1546
|
+
const l = J(n), a = J(i);
|
|
1547
|
+
return !l || !a ? [] : [{
|
|
1548
|
+
start: l.start,
|
|
1549
|
+
end: l.end,
|
|
1550
|
+
replacement: e.slice(a.start, a.end)
|
|
1551
|
+
}];
|
|
1552
|
+
}, Mr = (t, e, n) => {
|
|
1553
|
+
const r = _e(t), i = _e(e), s = _e(n);
|
|
1554
|
+
if (r.length !== i.length || i.length !== s.length)
|
|
1555
|
+
return {
|
|
1556
|
+
edits: [],
|
|
1557
|
+
normalizedCurrent: n
|
|
1558
|
+
};
|
|
1559
|
+
const l = [];
|
|
1560
|
+
let a = n;
|
|
1561
|
+
for (let o = s.length - 1; o >= 0; o -= 1) {
|
|
1562
|
+
const c = r[o], u = i[o], d = s[o];
|
|
1563
|
+
if (!c || !u || !d) continue;
|
|
1564
|
+
const p = J(u), _ = J(d);
|
|
1565
|
+
!p || !_ || (a = a.slice(0, _.start) + e.slice(p.start, p.end) + a.slice(_.end), l.push(...Or(t, n, c, u, d)));
|
|
1566
|
+
}
|
|
1567
|
+
return {
|
|
1568
|
+
edits: l,
|
|
1569
|
+
normalizedCurrent: a
|
|
1570
|
+
};
|
|
1571
|
+
}, Lr = (t, e, n, r) => {
|
|
1572
|
+
if (n === r) return t;
|
|
1573
|
+
const i = Nr(t, n, r), s = Mr(t, n, i.normalizedCurrent), l = Tr(n, s.normalizedCurrent).map((o) => ({
|
|
1574
|
+
start: o.start === o.end ? He(e, o.start) : Er(e, o.start),
|
|
1575
|
+
end: He(e, o.end),
|
|
1576
|
+
replacement: me(o.replacement, t)
|
|
1577
|
+
})).concat(i.edits.map((o) => ({
|
|
1578
|
+
...o,
|
|
1579
|
+
replacement: me(o.replacement, t)
|
|
1580
|
+
}))).concat(s.edits.map((o) => ({
|
|
1581
|
+
...o,
|
|
1582
|
+
replacement: me(o.replacement, t)
|
|
1583
|
+
}))).sort((o, c) => c.start - o.start);
|
|
1584
|
+
let a = t;
|
|
1585
|
+
for (const o of l)
|
|
1586
|
+
a = a.slice(0, o.start) + o.replacement + a.slice(o.end);
|
|
1587
|
+
return a;
|
|
1588
|
+
}, hi = (t, e) => {
|
|
1589
|
+
let n = null, r = null;
|
|
1590
|
+
return {
|
|
1591
|
+
importToLexical() {
|
|
1592
|
+
yr(t, e), n = qe(Ze()), r = Ue(n, t);
|
|
1593
|
+
},
|
|
1594
|
+
exportFromLexical(i) {
|
|
1595
|
+
const s = qe(i), l = n ?? s;
|
|
1596
|
+
return Lr(t, r ?? Ue(l, t), l, s);
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
};
|
|
1600
|
+
function fi(t) {
|
|
1601
|
+
const e = x(4), {
|
|
1602
|
+
isEditable: n
|
|
1603
|
+
} = t, [r] = le();
|
|
1604
|
+
let i, s;
|
|
1605
|
+
return e[0] !== r || e[1] !== n ? (i = () => {
|
|
1606
|
+
r.setEditable(n);
|
|
1607
|
+
}, s = [n, r], e[0] = r, e[1] = n, e[2] = i, e[3] = s) : (i = e[2], s = e[3]), oe(i, s), null;
|
|
1608
|
+
}
|
|
1609
|
+
function mi() {
|
|
1610
|
+
const t = x(2), [e] = le();
|
|
1611
|
+
let n;
|
|
1612
|
+
return t[0] !== e ? (n = /* @__PURE__ */ h($, { fontSize: "xs", color: "fg.muted", padding: "4", children: /* @__PURE__ */ h(En, { treeTypeButtonClassName: "debug-treetype-button", timeTravelButtonClassName: "debug-timetravel-button", timeTravelPanelButtonClassName: "debug-timetravel-button", timeTravelPanelClassName: "debug-timetravel-panel", timeTravelPanelSliderClassName: "debug-timetravel-slider", viewClassName: "tree-view-output", editor: e }) }), t[0] = e, t[1] = n) : n = t[1], n;
|
|
1613
|
+
}
|
|
1614
|
+
const Rr = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/;
|
|
1615
|
+
function _i(t) {
|
|
1616
|
+
const e = t.match(Rr);
|
|
1617
|
+
return e ? {
|
|
1618
|
+
frontmatter: e[0],
|
|
1619
|
+
body: t.slice(e[0].length)
|
|
1620
|
+
} : {
|
|
1621
|
+
frontmatter: "",
|
|
1622
|
+
body: t
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
export {
|
|
1626
|
+
Xn as $,
|
|
1627
|
+
pi as C,
|
|
1628
|
+
oi as E,
|
|
1629
|
+
di as I,
|
|
1630
|
+
li as M,
|
|
1631
|
+
fi as T,
|
|
1632
|
+
ai as a,
|
|
1633
|
+
si as b,
|
|
1634
|
+
be as c,
|
|
1635
|
+
mt as d,
|
|
1636
|
+
ui as e,
|
|
1637
|
+
hi as f,
|
|
1638
|
+
ci as g,
|
|
1639
|
+
mi as h,
|
|
1640
|
+
_i as s,
|
|
1641
|
+
Sn as t
|
|
1642
|
+
};
|
|
1643
|
+
//# sourceMappingURL=markdown-CASvn1Z2.js.map
|