laif-ds 0.2.85 → 0.2.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -81
- package/dist/CHANGELOG.md +13 -0
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/adoption-report.json +2 -2
- package/dist/agent-docs/manifest.json +3 -3
- package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
- package/dist/components/editor/editor-ui/content-editable.js +1 -1
- package/dist/components/editor/nodes/mention-node.js +2 -2
- package/dist/components/editor/plugins/actions/clear-editor-plugin.js +2 -2
- package/dist/components/editor/plugins/actions/counter-character-plugin.js +2 -2
- package/dist/components/editor/plugins/mention-plugin.js +21 -21
- package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +10 -10
- package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +9 -9
- package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +3 -3
- package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +13 -13
- package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +2 -2
- package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +18 -19
- package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +1 -1
- package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +3 -3
- package/dist/components/ui/app-editor.js +51 -51
- package/dist/components/ui/markdown-renderer.js +33 -32
- package/dist/lib/utils.js +35 -34
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
- package/dist/node_modules/@floating-ui/{utils → core/node_modules/@floating-ui/utils}/dist/floating-ui.utils.js +33 -39
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +20 -19
- package/dist/node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +12 -0
- package/dist/node_modules/@lexical/clipboard/dist/LexicalClipboard.prod.js +354 -0
- package/dist/node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.js +298 -0
- package/dist/node_modules/@lexical/dragon/dist/LexicalDragon.prod.js +89 -0
- package/dist/node_modules/@lexical/extension/dist/LexicalExtension.prod.js +611 -0
- package/dist/node_modules/@lexical/history/dist/LexicalHistory.prod.js +96 -0
- package/dist/node_modules/@lexical/html/dist/LexicalHtml.prod.js +604 -0
- package/dist/node_modules/@lexical/link/dist/LexicalLink.prod.js +201 -0
- package/dist/node_modules/@lexical/list/dist/LexicalList.prod.js +843 -0
- package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +555 -0
- package/dist/node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js +11 -0
- package/dist/node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js +13 -0
- package/dist/node_modules/@lexical/react/dist/LexicalComposer.prod.js +45 -0
- package/dist/node_modules/@lexical/react/{LexicalComposerContext.prod.js → dist/LexicalComposerContext.prod.js} +1 -1
- package/dist/node_modules/@lexical/react/dist/LexicalContentEditable.prod.js +53 -0
- package/dist/node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js +21 -0
- package/dist/node_modules/@lexical/react/{LexicalHistoryPlugin.prod.js → dist/LexicalHistoryPlugin.prod.js} +3 -3
- package/dist/node_modules/@lexical/react/dist/LexicalListPlugin.prod.js +17 -0
- package/dist/node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js +16 -0
- package/dist/node_modules/@lexical/react/dist/LexicalReactProviderExtension.prod.js +6 -0
- package/dist/node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js +77 -0
- package/dist/node_modules/@lexical/react/dist/LexicalTypeaheadMenuPlugin.prod.js +245 -0
- package/dist/node_modules/@lexical/react/dist/useLexicalEditable.prod.js +22 -0
- package/dist/node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js +567 -0
- package/dist/node_modules/@lexical/selection/dist/LexicalSelection.prod.js +123 -0
- package/dist/node_modules/@lexical/table/dist/LexicalTable.prod.js +929 -0
- package/dist/node_modules/@lexical/text/{LexicalText.prod.js → dist/LexicalText.prod.js} +6 -6
- package/dist/node_modules/@lexical/utils/dist/LexicalUtils.prod.js +111 -0
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/lexical/dist/Lexical.prod.js +6731 -0
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/package.json +17 -15
- package/dist/_virtual/prism-cpp.js +0 -3
- package/dist/_virtual/prism-cpp2.js +0 -5
- package/dist/_virtual/prism-java.js +0 -3
- package/dist/_virtual/prism-java2.js +0 -5
- package/dist/_virtual/prism-python.js +0 -3
- package/dist/_virtual/prism-python2.js +0 -5
- package/dist/_virtual/prism-rust.js +0 -3
- package/dist/_virtual/prism-rust2.js +0 -5
- package/dist/_virtual/prism-typescript.js +0 -3
- package/dist/_virtual/prism-typescript2.js +0 -5
- package/dist/_virtual/prism.js +0 -3
- package/dist/_virtual/prism2.js +0 -5
- package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -159
- package/dist/node_modules/@lexical/code/LexicalCode.prod.js +0 -236
- package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +0 -46
- package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +0 -89
- package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +0 -108
- package/dist/node_modules/@lexical/link/LexicalLink.prod.js +0 -187
- package/dist/node_modules/@lexical/list/LexicalList.prod.js +0 -729
- package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +0 -367
- package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +0 -11
- package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +0 -17
- package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +0 -45
- package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +0 -55
- package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +0 -49
- package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +0 -17
- package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +0 -16
- package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +0 -56
- package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +0 -220
- package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +0 -21
- package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -376
- package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -107
- package/dist/node_modules/@lexical/table/LexicalTable.prod.js +0 -661
- package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -102
- package/dist/node_modules/lexical/Lexical.prod.js +0 -4912
- package/dist/node_modules/prismjs/components/prism-c.js +0 -77
- package/dist/node_modules/prismjs/components/prism-clike.js +0 -32
- package/dist/node_modules/prismjs/components/prism-cpp.js +0 -93
- package/dist/node_modules/prismjs/components/prism-css.js +0 -56
- package/dist/node_modules/prismjs/components/prism-java.js +0 -122
- package/dist/node_modules/prismjs/components/prism-javascript.js +0 -138
- package/dist/node_modules/prismjs/components/prism-markdown.js +0 -301
- package/dist/node_modules/prismjs/components/prism-markup.js +0 -174
- package/dist/node_modules/prismjs/components/prism-objectivec.js +0 -11
- package/dist/node_modules/prismjs/components/prism-powershell.js +0 -56
- package/dist/node_modules/prismjs/components/prism-python.js +0 -69
- package/dist/node_modules/prismjs/components/prism-rust.js +0 -124
- package/dist/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/node_modules/prismjs/components/prism-swift.js +0 -114
- package/dist/node_modules/prismjs/components/prism-typescript.js +0 -53
- package/dist/node_modules/prismjs/prism.js +0 -1165
- /package/dist/node_modules/@floating-ui/{utils → dom/node_modules/@floating-ui/utils}/dist/floating-ui.utils.dom.js +0 -0
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createState as G, $setState as _, $getState as X, $createTextNode as F, $findMatchingParent as ie, $getRoot as ae, $createLineBreakNode as Le, $getSelection as ve, $isElementNode as K, $isDecoratorNode as ce, $isParagraphNode as fe, $isTextNode as v, $isLineBreakNode as de, $createParagraphNode as Oe, $createTabNode as ye } from "../../../lexical/dist/Lexical.prod.js";
|
|
3
|
+
import { CodeNode as be, $createCodeNode as A, $isCodeNode as _e } from "../../code-core/dist/LexicalCodeCore.prod.js";
|
|
4
|
+
import { LinkNode as Me, $createLinkNode as Ae, $isLinkNode as Z, $isAutoLinkNode as ke } from "../../link/dist/LexicalLink.prod.js";
|
|
5
|
+
import { ListNode as ue, ListItemNode as ge, $isListNode as R, $createListItemNode as Fe, $createListNode as Be, $isListItemNode as pe } from "../../list/dist/LexicalList.prod.js";
|
|
6
|
+
import { HeadingNode as we, QuoteNode as De, $isHeadingNode as je, $isQuoteNode as D, $createQuoteNode as He, $createHeadingNode as Pe } from "../../rich-text/dist/LexicalRichText.prod.js";
|
|
7
|
+
function Ue(e, t) {
|
|
8
|
+
const o = {};
|
|
9
|
+
for (const r of e) {
|
|
10
|
+
const n = t(r);
|
|
11
|
+
n && (o[n] ? o[n].push(r) : o[n] = [r]);
|
|
12
|
+
}
|
|
13
|
+
return o;
|
|
14
|
+
}
|
|
15
|
+
function he(e) {
|
|
16
|
+
const t = Ue(e, (o) => o.type);
|
|
17
|
+
return { element: t.element || [], multilineElement: t["multiline-element"] || [], textFormat: t["text-format"] || [], textMatch: t["text-match"] || [] };
|
|
18
|
+
}
|
|
19
|
+
const q = /\s/, j = /[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/, ze = /^\s{0,3}$/;
|
|
20
|
+
function H(e) {
|
|
21
|
+
if (!fe(e)) return !1;
|
|
22
|
+
const t = e.getFirstChild();
|
|
23
|
+
return t == null || e.getChildrenSize() === 1 && v(t) && ze.test(t.getTextContent());
|
|
24
|
+
}
|
|
25
|
+
function P(e) {
|
|
26
|
+
return e.replace(/\\([!-/:-@[-`{-~])/g, "$1").replace(/&#(\d+);/g, (t, o) => String.fromCodePoint(Number(o)));
|
|
27
|
+
}
|
|
28
|
+
const xe = /^(\s*)(\d{1,})\.\s/, me = /^(\s*)[-*+]\s/, Qe = /^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i, U = /^(#{1,6})\s/, $e = /^>\s/, Ie = /^([ \t]*`{3,})([\w-]+)?[ \t]?/, z = /^[ \t]*`{3,}$/, We = /^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/, Ge = /^(?:\|)(.+)(?:\|)\s?$/;
|
|
29
|
+
function Xe(e) {
|
|
30
|
+
if (e[0] !== "|") return !1;
|
|
31
|
+
const { length: t } = e;
|
|
32
|
+
let o = 1, r = 0;
|
|
33
|
+
for (; o < t; ) {
|
|
34
|
+
let n = o;
|
|
35
|
+
for (e[n] === " " && n++, e[n] === ":" && n++; e[n] === "-"; ) n++;
|
|
36
|
+
if (e[n] === ":" && n++, e[n] === " " && n++, e[n] !== "|") break;
|
|
37
|
+
r++, o = n + 1;
|
|
38
|
+
}
|
|
39
|
+
return r > 0 && (o === t || o === t - 1 && /\s/.test(e[o]));
|
|
40
|
+
}
|
|
41
|
+
const Y = /^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i, J = /^<\/[a-z_][\w-]*\s*>/i, ee = (e) => new RegExp(`(?:${e.source})$`, e.flags), b = /* @__PURE__ */ G("mdListMarker", { parse: (e) => typeof e == "string" && /^[-*+]$/.test(e) ? e : "-", resetOnCopyNode: !0 }), te = /* @__PURE__ */ G("mdCodeFence", { parse: (e) => typeof e == "string" && /^`{3,}$/.test(e) ? e : "```", resetOnCopyNode: !0 }), Te = /* @__PURE__ */ G("mdHardLineBreak", { parse: (e) => typeof e == "string" && /^(\\| {2,})$/.test(e) ? e : "", resetOnCopyNode: !0 });
|
|
42
|
+
function Q(e) {
|
|
43
|
+
if (e.endsWith("\\")) return [e.slice(0, -1), "\\"];
|
|
44
|
+
const t = e.match(/^(.*?\S)( {2,})$/);
|
|
45
|
+
return t ? [t[1], t[2]] : null;
|
|
46
|
+
}
|
|
47
|
+
function Ke(e) {
|
|
48
|
+
const t = e.getChildren(), o = t.length - 1, r = t[o];
|
|
49
|
+
if (!v(r)) return null;
|
|
50
|
+
const n = r.getTextContent(), c = Q(n);
|
|
51
|
+
if (c !== null) {
|
|
52
|
+
const [s, l] = c;
|
|
53
|
+
return r.setTextContent(s), l;
|
|
54
|
+
}
|
|
55
|
+
return /^ {2,}$/.test(n) && (function(s, l) {
|
|
56
|
+
for (let i = l - 1; i >= 0; i--) {
|
|
57
|
+
if (de(s[i])) return !1;
|
|
58
|
+
if (/\S/.test(s[i].getTextContent())) return !0;
|
|
59
|
+
}
|
|
60
|
+
return !1;
|
|
61
|
+
})(t, o) ? (r.setTextContent(""), n) : null;
|
|
62
|
+
}
|
|
63
|
+
function Ee(e) {
|
|
64
|
+
const t = Le(), o = Ke(e);
|
|
65
|
+
return o !== null && _(t, Te, o), t;
|
|
66
|
+
}
|
|
67
|
+
const Ne = (e) => (t, o, r, n) => {
|
|
68
|
+
const c = e(r);
|
|
69
|
+
c.append(...o), t.replace(c), n || c.select(0, 0);
|
|
70
|
+
}, Ce = (e) => (t, o, r, n) => {
|
|
71
|
+
const c = t.getPreviousSibling(), s = t.getNextSibling(), l = Fe(e === "check" ? r[3] === "x" : void 0), i = r[0].trim()[0], a = e !== "bullet" && e !== "check" || i !== b.parse(i) ? void 0 : i;
|
|
72
|
+
if (R(s) && s.getListType() === e) {
|
|
73
|
+
a && _(s, b, a);
|
|
74
|
+
const d = s.getFirstChild();
|
|
75
|
+
d !== null ? d.insertBefore(l) : s.append(l), e === "number" && s.setStart(Number(r[2])), t.remove();
|
|
76
|
+
} else if (R(c) && c.getListType() === e) a && _(c, b, a), c.append(l), t.remove();
|
|
77
|
+
else {
|
|
78
|
+
const d = Be(e, e === "number" ? Number(r[2]) : void 0);
|
|
79
|
+
a && _(d, b, a), d.append(l), t.replace(d);
|
|
80
|
+
}
|
|
81
|
+
l.append(...o), n || l.select(0, 0);
|
|
82
|
+
const u = (function(d) {
|
|
83
|
+
const f = d.match(/\t/g), p = d.match(/ /g);
|
|
84
|
+
let g = 0;
|
|
85
|
+
return f && (g += f.length), p && (g += Math.floor(p.length / 4)), g;
|
|
86
|
+
})(r[1]);
|
|
87
|
+
u && l.setIndent(u);
|
|
88
|
+
}, V = (e, t, o, r) => {
|
|
89
|
+
const n = [], c = e.getChildren();
|
|
90
|
+
let s = 0;
|
|
91
|
+
for (const l of c) if (pe(l)) {
|
|
92
|
+
if (l.getChildrenSize() === 1) {
|
|
93
|
+
const p = l.getFirstChild();
|
|
94
|
+
if (R(p)) {
|
|
95
|
+
const g = V(p, t, o + 1, r);
|
|
96
|
+
g && n.push(g);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (r && !l.getChildren().some((p) => p.isSelected(r))) continue;
|
|
101
|
+
const i = " ".repeat(4 * o), a = e.getListType(), u = X(e, b), d = a === "number" ? `${e.getStart() + s}. ` : a === "check" ? `${u} [${l.getChecked() ? "x" : " "}] ` : u + " ";
|
|
102
|
+
let f = t(l);
|
|
103
|
+
a !== "number" && (f = f.replace(/^(\s{0,3}\d+)(\.\s)/, "$1\\$2")), n.push(i + d + f), s++;
|
|
104
|
+
}
|
|
105
|
+
return n.join(`
|
|
106
|
+
`);
|
|
107
|
+
}, Ve = { dependencies: [we], export: (e, t) => {
|
|
108
|
+
if (!je(e)) return null;
|
|
109
|
+
const o = Number(e.getTag().slice(1));
|
|
110
|
+
return "#".repeat(o) + " " + t(e);
|
|
111
|
+
}, regExp: U, replace: Ne((e) => {
|
|
112
|
+
const t = "h" + e[1].length;
|
|
113
|
+
return Pe(t);
|
|
114
|
+
}), triggerOnEnter: !0, type: "element" }, Ze = { dependencies: [De], export: (e, t) => {
|
|
115
|
+
if (!D(e)) return null;
|
|
116
|
+
const o = t(e).split(`
|
|
117
|
+
`), r = [];
|
|
118
|
+
for (const n of o) r.push("> " + n);
|
|
119
|
+
return r.join(`
|
|
120
|
+
`);
|
|
121
|
+
}, regExp: $e, replace: (e, t, o, r) => {
|
|
122
|
+
if (r) {
|
|
123
|
+
const c = e.getPreviousSibling();
|
|
124
|
+
if (D(c)) return c.splice(c.getChildrenSize(), 0, [Ee(c), ...t]), void e.remove();
|
|
125
|
+
}
|
|
126
|
+
const n = He();
|
|
127
|
+
n.append(...t), e.replace(n), r || n.select(0, 0);
|
|
128
|
+
}, triggerOnEnter: !0, type: "element" }, k = { dependencies: [be], export: (e) => {
|
|
129
|
+
if (!_e(e)) return null;
|
|
130
|
+
const t = e.getTextContent();
|
|
131
|
+
let o = X(e, te);
|
|
132
|
+
if (t.indexOf(o) > -1) {
|
|
133
|
+
const r = t.match(/`{3,}/g);
|
|
134
|
+
if (r) {
|
|
135
|
+
const n = Math.max(...r.map((c) => c.length));
|
|
136
|
+
o = "`".repeat(n + 1);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return o + (e.getLanguage() || "") + (t ? `
|
|
140
|
+
` + t : "") + `
|
|
141
|
+
` + o;
|
|
142
|
+
}, handleImportAfterStartMatch: ({ lines: e, rootNode: t, startLineIndex: o, startMatch: r }) => {
|
|
143
|
+
const n = r[1], c = n.trim().length, s = e[o], l = r.index + n.length, i = s.slice(l), a = new RegExp(`\`{${c},}$`);
|
|
144
|
+
if (a.test(i)) {
|
|
145
|
+
const p = i.match(a), g = i.slice(0, i.lastIndexOf(p[0])), h = [...r];
|
|
146
|
+
return h[2] = "", k.replace(t, null, h, p, [g], !0), [!0, o];
|
|
147
|
+
}
|
|
148
|
+
const u = new RegExp(`^[ \\t]*\`{${c},}$`);
|
|
149
|
+
for (let p = o + 1; p < e.length; p++) {
|
|
150
|
+
const g = e[p];
|
|
151
|
+
if (u.test(g)) {
|
|
152
|
+
const h = g.match(u), E = e.slice(o + 1, p), $ = s.slice(r[0].length);
|
|
153
|
+
return $.length > 0 && E.unshift($), k.replace(t, null, r, h, E, !0), [!0, p];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const d = e.slice(o + 1), f = s.slice(r[0].length);
|
|
157
|
+
return f.length > 0 && d.unshift(f), k.replace(t, null, r, null, d, !0), [!0, e.length - 1];
|
|
158
|
+
}, regExpEnd: { optional: !0, regExp: z }, regExpStart: Ie, replace: (e, t, o, r, n, c) => {
|
|
159
|
+
let s, l;
|
|
160
|
+
const i = o[1] ? o[1].trim() : "```", a = o[2] || void 0;
|
|
161
|
+
if (!t && n) {
|
|
162
|
+
if (n.length === 1) r ? (s = A(a), l = n[0]) : (s = A(a), l = n[0].startsWith(" ") ? n[0].slice(1) : n[0]);
|
|
163
|
+
else {
|
|
164
|
+
for (s = A(a), n.length > 0 && (n[0].trim().length === 0 ? n.shift() : n[0].startsWith(" ") && (n[0] = n[0].slice(1))); n.length > 0 && !n[n.length - 1].length; ) n.pop();
|
|
165
|
+
l = n.join(`
|
|
166
|
+
`);
|
|
167
|
+
}
|
|
168
|
+
_(s, te, i);
|
|
169
|
+
const u = F(l);
|
|
170
|
+
s.append(u), e.append(s);
|
|
171
|
+
} else t && Ne((u) => A(u ? u[2] : void 0))(e, t, o, c);
|
|
172
|
+
}, type: "multiline-element" }, qe = { dependencies: [ue, ge], export: (e, t, o) => R(e) ? V(e, t, 0, o) : null, regExp: me, replace: Ce("bullet"), triggerOnEnter: !0, type: "element" }, Ye = { dependencies: [ue, ge], export: (e, t, o) => R(e) ? V(e, t, 0, o) : null, regExp: xe, replace: Ce("number"), triggerOnEnter: !0, type: "element" }, Je = { format: ["code"], tag: "`", type: "text-format" }, et = { format: ["highlight"], tag: "==", type: "text-format" }, tt = { format: ["bold", "italic"], tag: "***", type: "text-format" }, nt = { format: ["bold", "italic"], intraword: !1, tag: "___", type: "text-format" }, rt = { format: ["bold"], tag: "**", type: "text-format" }, ot = { format: ["bold"], intraword: !1, tag: "__", type: "text-format" }, st = { format: ["strikethrough"], tag: "~~", type: "text-format" }, lt = { format: ["italic"], tag: "*", type: "text-format" }, it = { format: ["italic"], intraword: !1, tag: "_", type: "text-format" }, at = { dependencies: [Me], export: (e, t, o) => {
|
|
173
|
+
if (!Z(e) || ke(e)) return null;
|
|
174
|
+
const r = t(e);
|
|
175
|
+
let n = e.getTitle();
|
|
176
|
+
return n != null && (n = n.replace(/([\\"])/g, "\\$1")), n ? `[${r}](${e.getURL()} "${n}")` : `[${r}](${e.getURL()})`;
|
|
177
|
+
}, importRegExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/, regExp: /(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/, replace: (e, t) => {
|
|
178
|
+
if (ie(e, Z)) return;
|
|
179
|
+
const [, o, r, n] = t, c = r != null ? P(r) : void 0, s = n != null ? P(n) : void 0, l = Ae(c, { title: s }), i = o.split("[").length - 1, a = o.split("]").length - 1;
|
|
180
|
+
let u = o, d = "";
|
|
181
|
+
if (i < a) return;
|
|
182
|
+
if (i > a) {
|
|
183
|
+
const p = o.split("[");
|
|
184
|
+
d = "[" + p[0], u = p.slice(1).join("[");
|
|
185
|
+
}
|
|
186
|
+
const f = F(u);
|
|
187
|
+
return f.setFormat(e.getFormat()), l.append(f), e.replace(l), d && l.insertBefore(F(d)), f;
|
|
188
|
+
}, trigger: ")", type: "text-match" }, ct = [Ve, Ze, qe, Ye], ft = [k], dt = [Je, tt, nt, rt, ot, et, lt, it, st], ut = [at], Se = [...ct, ...ft, ...dt, ...ut];
|
|
189
|
+
function gt(e, t = !1) {
|
|
190
|
+
const o = e.split(`
|
|
191
|
+
`);
|
|
192
|
+
let r = 0;
|
|
193
|
+
const n = [];
|
|
194
|
+
for (let c = 0; c < o.length; c++) {
|
|
195
|
+
const s = o[c], l = s.trimEnd(), i = n[n.length - 1], a = c < o.length - 1 ? Q(s) : null, u = i !== void 0 && Q(i) !== null;
|
|
196
|
+
if (We.test(l)) n.push(l);
|
|
197
|
+
else if (r === 0) {
|
|
198
|
+
{
|
|
199
|
+
const d = l.match(Ie);
|
|
200
|
+
if (d) {
|
|
201
|
+
r = d[1].trim().length, n.push(l);
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
l === "" || i === "" || !i || U.test(i) || U.test(l) || $e.test(l) || xe.test(l) || me.test(l) || Qe.test(l) || Ge.test(l) || Xe(l) || u || !t || Y.test(l) || J.test(l) || ee(J).test(i) || ee(Y).test(i) || z.test(i) ? n.push(!t && l !== "" || a !== null ? s : l) : n[n.length - 1] = i + " " + (a === null ? l : s).trimStart();
|
|
206
|
+
} else {
|
|
207
|
+
if (z.test(l) && l.trim().length >= r) {
|
|
208
|
+
r = 0, n.push(l);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
n.push(s);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return n.join(`
|
|
215
|
+
`);
|
|
216
|
+
}
|
|
217
|
+
function pt(e, t, o, r, n) {
|
|
218
|
+
for (const c of t) {
|
|
219
|
+
if (!c.export) continue;
|
|
220
|
+
const s = c.export(e, (l) => B(l, o, r, void 0, void 0, n));
|
|
221
|
+
if (s != null) return s;
|
|
222
|
+
}
|
|
223
|
+
return K(e) ? B(e, o, r, void 0, void 0, n) : ce(e) ? e.getTextContent() : null;
|
|
224
|
+
}
|
|
225
|
+
function B(e, t, o, r, n, c = !1) {
|
|
226
|
+
const s = [], l = e.getChildren();
|
|
227
|
+
r || (r = []), n || (n = []);
|
|
228
|
+
e: for (const i of l) {
|
|
229
|
+
for (const a of o) {
|
|
230
|
+
if (!a.export) continue;
|
|
231
|
+
const u = a.export(i, (d) => B(d, t, o, r, [...n, ...r], c), (d, f) => ne(d, f, t, r, n, c));
|
|
232
|
+
if (u != null) {
|
|
233
|
+
s.push(u);
|
|
234
|
+
continue e;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
de(i) ? s.push(ht(i)) : v(i) ? s.push(ne(i, i.getTextContent(), t, r, n, c)) : K(i) ? s.push(B(i, t, o, r, n, c)) : ce(i) && s.push(i.getTextContent());
|
|
238
|
+
}
|
|
239
|
+
return s.join("");
|
|
240
|
+
}
|
|
241
|
+
function ht(e) {
|
|
242
|
+
return X(e, Te) + `
|
|
243
|
+
`;
|
|
244
|
+
}
|
|
245
|
+
function ne(e, t, o, r, n, c = !1) {
|
|
246
|
+
const s = e.hasFormat("code");
|
|
247
|
+
let l, i, a, u, d = t;
|
|
248
|
+
if (s || (d = c ? d.replace(/([*_`~])/g, "\\$1") : d.replace(/([*_`~\\])/g, "\\$1")), s) {
|
|
249
|
+
const { fence: x, padded: I } = (function(m) {
|
|
250
|
+
const N = m.match(/`+/g), T = N ? Math.max(...N.map((O) => O.length)) : 0;
|
|
251
|
+
return { fence: "`".repeat(T + 1), padded: m.length === 0 || m.includes("`") || /^\s/.test(m) && /\s$/.test(m) ? ` ${m} ` : m };
|
|
252
|
+
})(t);
|
|
253
|
+
l = "", a = "", i = x + I + x, u = !1;
|
|
254
|
+
} else {
|
|
255
|
+
const x = d.match(/^(\s*)(.*?)(\s*)$/s) || ["", "", d, ""];
|
|
256
|
+
l = x[1], i = x[2], a = x[3], u = i === "";
|
|
257
|
+
}
|
|
258
|
+
let f = "", p = "", g = "";
|
|
259
|
+
const h = re(e, !0), E = re(e, !1), $ = /* @__PURE__ */ new Set();
|
|
260
|
+
for (const x of o) {
|
|
261
|
+
const I = x.format[0], m = x.tag;
|
|
262
|
+
I !== "code" && oe(e, I) && !$.has(I) && ($.add(I), oe(h, I) && r.find((N) => N.tag === m) || (r.push({ format: I, tag: m }), f += m));
|
|
263
|
+
}
|
|
264
|
+
for (let x = 0; x < r.length; x++) {
|
|
265
|
+
const I = W(e, r[x].format), m = W(E, r[x].format);
|
|
266
|
+
if (I && m) continue;
|
|
267
|
+
const N = [...r];
|
|
268
|
+
for (; N.length > x; ) {
|
|
269
|
+
const T = N.pop();
|
|
270
|
+
n && T && n.find((O) => O.tag === T.tag) || (T && typeof T.tag == "string" && (I ? m || (g += T.tag) : p += T.tag), r.pop());
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
return u && !e.hasFormat("code") ? p + d : p + l + f + i + g + a;
|
|
275
|
+
}
|
|
276
|
+
function re(e, t) {
|
|
277
|
+
const o = t ? e.getPreviousSibling() : e.getNextSibling();
|
|
278
|
+
return v(o) ? o : null;
|
|
279
|
+
}
|
|
280
|
+
function W(e, t) {
|
|
281
|
+
return v(e) && e.hasFormat(t);
|
|
282
|
+
}
|
|
283
|
+
function oe(e, t) {
|
|
284
|
+
return !!W(e, t) && (t === "code" || !e || !/^\s*$/.test(e.getTextContent()));
|
|
285
|
+
}
|
|
286
|
+
function xt(e, t) {
|
|
287
|
+
const o = e.getTextContent(), r = t.transformersByTag["`"], n = [];
|
|
288
|
+
let c = null;
|
|
289
|
+
if (r) {
|
|
290
|
+
const d = (function(f) {
|
|
291
|
+
const p = (x) => {
|
|
292
|
+
let I = 0;
|
|
293
|
+
for (let m = x - 1; m >= 0 && f[m] === "\\"; m--) I++;
|
|
294
|
+
return I % 2 == 1;
|
|
295
|
+
}, g = [];
|
|
296
|
+
let h = 0;
|
|
297
|
+
for (; h < f.length; ) if (f[h] === "`") {
|
|
298
|
+
let x = 1;
|
|
299
|
+
for (; h + x < f.length && f[h + x] === "`"; ) x++;
|
|
300
|
+
g.push({ index: h, length: x }), h += x;
|
|
301
|
+
} else h++;
|
|
302
|
+
const E = [];
|
|
303
|
+
let $ = 0;
|
|
304
|
+
for (; $ < g.length; ) {
|
|
305
|
+
const x = g[$];
|
|
306
|
+
if (p(x.index)) {
|
|
307
|
+
$++;
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
let I = -1;
|
|
311
|
+
for (let T = $ + 1; T < g.length; T++) if (g[T].length === x.length) {
|
|
312
|
+
I = T;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
if (I === -1) {
|
|
316
|
+
$++;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
const m = g[I];
|
|
320
|
+
let N = f.slice(x.index + x.length, m.index);
|
|
321
|
+
N.length >= 2 && N.startsWith(" ") && N.endsWith(" ") && /[^ ]/.test(N) && (N = N.slice(1, -1)), E.push({ content: N, endIndex: m.index + m.length, startIndex: x.index }), $ = I + 1;
|
|
322
|
+
}
|
|
323
|
+
return E;
|
|
324
|
+
})(o);
|
|
325
|
+
for (const f of d) c || (c = { content: f.content, endIndex: f.endIndex, startIndex: f.startIndex, tag: "`" }), n.push({ end: f.endIndex, start: f.startIndex });
|
|
326
|
+
}
|
|
327
|
+
const s = (function(d, f, p = []) {
|
|
328
|
+
const g = [], h = new Set(Object.keys(f.transformersByTag).filter((I) => I[0] !== "`").map((I) => I[0])), E = (I) => {
|
|
329
|
+
let m = 0;
|
|
330
|
+
for (let N = I - 1; N >= 0 && d[N] === "\\"; N--) m++;
|
|
331
|
+
return m % 2 == 1;
|
|
332
|
+
}, $ = (I) => p.some((m) => I >= m.start && I < m.end);
|
|
333
|
+
let x = 0;
|
|
334
|
+
for (; x < d.length; ) {
|
|
335
|
+
const I = d[x];
|
|
336
|
+
if (!h.has(I) || E(x) || $(x)) {
|
|
337
|
+
x++;
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
let m = 1;
|
|
341
|
+
for (; x + m < d.length && d[x + m] === I; ) m++;
|
|
342
|
+
const N = se(I, d, x, m, !0), T = se(I, d, x, m, !1);
|
|
343
|
+
(N || T) && g.push({ active: !0, canClose: T, canOpen: N, char: I, index: x, length: m, originalLength: m }), x += m;
|
|
344
|
+
}
|
|
345
|
+
return g;
|
|
346
|
+
})(o, t, n), l = s.length > 0 ? (function(d, f, p) {
|
|
347
|
+
const g = {};
|
|
348
|
+
let h = 0, E = null;
|
|
349
|
+
for (; h < f.length; ) {
|
|
350
|
+
const $ = f[h];
|
|
351
|
+
if (!$.active || !$.canClose || $.length === 0) {
|
|
352
|
+
h++;
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
const x = `${$.char}${$.canOpen}`, I = g[x] ?? -1;
|
|
356
|
+
let m = !1;
|
|
357
|
+
for (let N = h - 1; N > I; N--) {
|
|
358
|
+
const T = f[N];
|
|
359
|
+
if (!T.active || !T.canOpen || T.length === 0 || T.char !== $.char || (T.canClose || $.canOpen) && (T.originalLength + $.originalLength) % 3 == 0 && T.originalLength % 3 != 0 && $.originalLength % 3 != 0)
|
|
360
|
+
continue;
|
|
361
|
+
const O = Math.min(T.length, $.length), w = Object.keys(p.transformersByTag).filter((C) => C[0] === T.char && C.length <= O).sort((C, Re) => Re.length - C.length)[0];
|
|
362
|
+
if (!w) continue;
|
|
363
|
+
m = !0;
|
|
364
|
+
const y = w.length, M = { content: d.slice(T.index + T.length, $.index), endIndex: $.index + y, startIndex: T.index + (T.length - y), tag: w };
|
|
365
|
+
(!E || M.startIndex < E.startIndex || M.startIndex === E.startIndex && M.endIndex > E.endIndex) && (E = M);
|
|
366
|
+
for (let C = N + 1; C < h; C++) f[C].active = !1;
|
|
367
|
+
T.length -= y, $.length -= y, T.active = T.length > 0, $.length > 0 ? $.index += y : ($.active = !1, h++);
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
m || (g[x] = h - 1, $.canOpen || ($.active = !1), h++);
|
|
371
|
+
}
|
|
372
|
+
return E;
|
|
373
|
+
})(o, s, t) : null;
|
|
374
|
+
let i = null, a = null;
|
|
375
|
+
if (c && l ? l.startIndex <= c.startIndex && l.endIndex >= c.endIndex ? (i = l, a = t.transformersByTag[l.tag]) : (i = c, a = r) : c ? (i = c, a = r) : l && (i = l, a = t.transformersByTag[l.tag]), !i || !a) return null;
|
|
376
|
+
const u = [o.slice(i.startIndex, i.endIndex), i.tag, i.content];
|
|
377
|
+
return u.index = i.startIndex, u.input = o, { endIndex: i.endIndex, isCodeSpan: a === r, match: u, startIndex: i.startIndex, transformer: a };
|
|
378
|
+
}
|
|
379
|
+
function se(e, t, o, r, n) {
|
|
380
|
+
if (!le(t, o, r, n)) return !1;
|
|
381
|
+
if (e === "*") return !0;
|
|
382
|
+
if (e === "_") {
|
|
383
|
+
if (!le(t, o, r, !n)) return !0;
|
|
384
|
+
const c = n ? t[o - 1] : t[o + r];
|
|
385
|
+
return c !== void 0 && j.test(c);
|
|
386
|
+
}
|
|
387
|
+
return !0;
|
|
388
|
+
}
|
|
389
|
+
function le(e, t, o, r) {
|
|
390
|
+
const n = e[t - 1], c = e[t + o], [s, l] = r ? [c, n] : [n, c];
|
|
391
|
+
return s !== void 0 && !q.test(s) && (!j.test(s) || l === void 0 || q.test(l) || j.test(l));
|
|
392
|
+
}
|
|
393
|
+
function L(e) {
|
|
394
|
+
return v(e) && !e.hasFormat("code");
|
|
395
|
+
}
|
|
396
|
+
function S(e, t, o) {
|
|
397
|
+
let r = xt(e, t), n = (function(s, l) {
|
|
398
|
+
const i = s;
|
|
399
|
+
let a, u, d, f;
|
|
400
|
+
for (const p of l) {
|
|
401
|
+
if (!p.replace || !p.importRegExp) continue;
|
|
402
|
+
const g = i.getTextContent().match(p.importRegExp);
|
|
403
|
+
if (!g) continue;
|
|
404
|
+
const h = g.index || 0, E = p.getEndIndex ? p.getEndIndex(i, g) : h + g[0].length;
|
|
405
|
+
E !== !1 && (a === void 0 || u === void 0 || h < a && (E > u || E <= a)) && (a = h, u = E, d = p, f = g);
|
|
406
|
+
}
|
|
407
|
+
return a === void 0 || u === void 0 || d === void 0 || f === void 0 ? null : { endIndex: u, match: f, startIndex: a, transformer: d };
|
|
408
|
+
})(e, o);
|
|
409
|
+
if (r && n && (r.isCodeSpan ? n.startIndex <= r.startIndex && n.endIndex >= r.endIndex ? r = null : n = null : r.startIndex <= n.startIndex && r.endIndex >= n.endIndex || n.startIndex > r.endIndex ? n = null : r = null), r) {
|
|
410
|
+
const s = (function(l, i, a, u, d) {
|
|
411
|
+
const f = l.getTextContent();
|
|
412
|
+
let p, g, h;
|
|
413
|
+
if (d[0] === f ? p = l : i === 0 ? [p, g] = l.splitText(a) : [h, p, g] = l.splitText(i, a), p.setTextContent(d[2]), u) for (const E of u.format) p.hasFormat(E) || p.toggleFormat(E);
|
|
414
|
+
return { nodeAfter: g, nodeBefore: h, transformedNode: p };
|
|
415
|
+
})(e, r.startIndex, r.endIndex, r.transformer, r.match);
|
|
416
|
+
L(s.nodeAfter) && S(s.nodeAfter, t, o), L(s.nodeBefore) && S(s.nodeBefore, t, o), L(s.transformedNode) && S(s.transformedNode, t, o);
|
|
417
|
+
} else if (n) {
|
|
418
|
+
const s = (function(l, i, a, u, d) {
|
|
419
|
+
let f, p, g;
|
|
420
|
+
return i === 0 ? [f, p] = l.splitText(a) : [g, f, p] = l.splitText(i, a), u.replace ? { nodeAfter: p, nodeBefore: g, transformedNode: u.replace(f, d) || void 0 } : null;
|
|
421
|
+
})(e, n.startIndex, n.endIndex, n.transformer, n.match);
|
|
422
|
+
if (!s) return;
|
|
423
|
+
L(s.nodeAfter) && S(s.nodeAfter, t, o), L(s.nodeBefore) && S(s.nodeBefore, t, o), L(s.transformedNode) && S(s.transformedNode, t, o);
|
|
424
|
+
}
|
|
425
|
+
const c = P(e.getTextContent());
|
|
426
|
+
e.setTextContent(c);
|
|
427
|
+
}
|
|
428
|
+
function mt(e, t, o, r = !1) {
|
|
429
|
+
const n = he(o), c = (function(a) {
|
|
430
|
+
const u = {}, d = {}, f = [];
|
|
431
|
+
for (const p of a) {
|
|
432
|
+
const { tag: g } = p;
|
|
433
|
+
u[g] = p;
|
|
434
|
+
const h = g.replace(/(\*|\^|\+)/g, "\\$1");
|
|
435
|
+
f.push(h), g.length === 1 ? d[g] = g === "`" ? new RegExp("(^|[^\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)") : new RegExp(`(^|[^\\\\${h}])(${h})((\\\\${h})?.*?[^${h}\\s](\\\\${h})?)(${h})(?![\\\\${h}])`) : d[g] = new RegExp(`(^|[^\\\\])(${h})((\\\\${h})?.*?[^\\s](\\\\${h})?)(${h})(?!\\\\)`);
|
|
436
|
+
}
|
|
437
|
+
return { fullMatchRegExpByTag: d, openTagsRegExp: new RegExp(`(${f.join("|")})`, "g"), transformersByTag: u };
|
|
438
|
+
})(n.textFormat), s = e.split(`
|
|
439
|
+
`), l = s.length;
|
|
440
|
+
for (let a = 0; a < l; a++) {
|
|
441
|
+
const u = s[a], [d, f] = $t(s, a, n.multilineElement, t);
|
|
442
|
+
d ? a = f : It(u, t, n.element, c, n.textMatch, r);
|
|
443
|
+
}
|
|
444
|
+
const i = t.getChildren();
|
|
445
|
+
for (const a of i) if (!r && H(a) && t.getChildrenSize() > 1) a.remove();
|
|
446
|
+
else if (K(a)) for (const u of a.getAllTextNodes()) Tt(u);
|
|
447
|
+
}
|
|
448
|
+
function $t(e, t, o, r) {
|
|
449
|
+
for (const n of o) {
|
|
450
|
+
const { handleImportAfterStartMatch: c, regExpEnd: s, regExpStart: l, replace: i } = n, a = e[t].match(l);
|
|
451
|
+
if (!a) continue;
|
|
452
|
+
if (c) {
|
|
453
|
+
const g = c({ lines: e, rootNode: r, startLineIndex: t, startMatch: a, transformer: n });
|
|
454
|
+
if (g === null) continue;
|
|
455
|
+
if (g) return g;
|
|
456
|
+
}
|
|
457
|
+
const u = typeof s == "object" && "regExp" in s ? s.regExp : s, d = s && typeof s == "object" && "optional" in s ? s.optional : !s;
|
|
458
|
+
let f = t;
|
|
459
|
+
const p = e.length;
|
|
460
|
+
for (; f < p; ) {
|
|
461
|
+
const g = u ? e[f].match(u) : null;
|
|
462
|
+
if (!g && (!d || d && f < p - 1)) {
|
|
463
|
+
f++;
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
if (g && t === f && g.index === a.index) {
|
|
467
|
+
f++;
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
const h = [];
|
|
471
|
+
if (g && t === f) h.push(e[t].slice(a[0].length, -g[0].length));
|
|
472
|
+
else for (let E = t; E <= f; E++) if (E === t) {
|
|
473
|
+
const $ = e[E].slice(a[0].length);
|
|
474
|
+
h.push($);
|
|
475
|
+
} else if (E === f && g) {
|
|
476
|
+
const $ = e[E].slice(0, -g[0].length);
|
|
477
|
+
h.push($);
|
|
478
|
+
} else h.push(e[E]);
|
|
479
|
+
if (i(r, null, a, g, h, !0) !== !1) return [!0, f];
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return [!1, t];
|
|
484
|
+
}
|
|
485
|
+
function It(e, t, o, r, n, c) {
|
|
486
|
+
const s = F(e), l = Oe();
|
|
487
|
+
l.append(s), t.append(l);
|
|
488
|
+
for (const { regExp: i, replace: a } of o) {
|
|
489
|
+
const u = e.match(i);
|
|
490
|
+
if (u && (s.setTextContent(e.slice(u[0].length)), a(l, [s], u, !0) !== !1)) break;
|
|
491
|
+
}
|
|
492
|
+
if (S(s, r, n), l.getParent() !== null && e.length > 0) {
|
|
493
|
+
const i = l.getPreviousSibling();
|
|
494
|
+
if (!c && (fe(i) || D(i) || R(i))) {
|
|
495
|
+
let a = i;
|
|
496
|
+
if (R(i)) {
|
|
497
|
+
const u = i.getLastDescendant();
|
|
498
|
+
a = u == null ? null : ie(u, pe);
|
|
499
|
+
}
|
|
500
|
+
a != null && a.getTextContentSize() > 0 && (a.splice(a.getChildrenSize(), 0, [Ee(a), ...l.getChildren()]), l.remove());
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function Tt(e) {
|
|
505
|
+
const t = /* @__PURE__ */ new Set(), o = e.getTextContent();
|
|
506
|
+
let r = o.indexOf(" ");
|
|
507
|
+
for (; r !== -1; ) t.add(r), t.add(r + 1), r = o.indexOf(" ", r + 1);
|
|
508
|
+
e.splitText(...t).forEach((n) => {
|
|
509
|
+
n.getTextContent() === " " && n.replace(ye());
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
function Lt(e, t = Se, o, r = !1, n = !1) {
|
|
513
|
+
const c = r ? e : gt(e, n), s = ae();
|
|
514
|
+
s.clear(), mt(c, s, t, r), ve() !== null && s.selectStart();
|
|
515
|
+
}
|
|
516
|
+
function vt(e = Se, t, o = !1) {
|
|
517
|
+
return (function(n, c = !1) {
|
|
518
|
+
const s = he(n), l = [...s.multilineElement, ...s.element], i = !c, a = s.textFormat.filter((u) => u.format.length === 1).sort((u, d) => Number(u.format.includes("code")) - Number(d.format.includes("code")));
|
|
519
|
+
return (u) => {
|
|
520
|
+
const d = [], f = (u || ae()).getChildren();
|
|
521
|
+
for (let p = 0; p < f.length; p++) {
|
|
522
|
+
const g = f[p], h = pt(g, l, a, s.textMatch, c);
|
|
523
|
+
h != null && d.push(i && p > 0 && !H(g) && !H(f[p - 1]) ? `
|
|
524
|
+
`.concat(h) : h);
|
|
525
|
+
}
|
|
526
|
+
return d.join(`
|
|
527
|
+
`);
|
|
528
|
+
};
|
|
529
|
+
})(e, o)(t);
|
|
530
|
+
}
|
|
531
|
+
export {
|
|
532
|
+
Lt as $convertFromMarkdownString,
|
|
533
|
+
vt as $convertToMarkdownString,
|
|
534
|
+
tt as BOLD_ITALIC_STAR,
|
|
535
|
+
nt as BOLD_ITALIC_UNDERSCORE,
|
|
536
|
+
rt as BOLD_STAR,
|
|
537
|
+
ot as BOLD_UNDERSCORE,
|
|
538
|
+
k as CODE,
|
|
539
|
+
ct as ELEMENT_TRANSFORMERS,
|
|
540
|
+
Ve as HEADING,
|
|
541
|
+
et as HIGHLIGHT,
|
|
542
|
+
Je as INLINE_CODE,
|
|
543
|
+
lt as ITALIC_STAR,
|
|
544
|
+
it as ITALIC_UNDERSCORE,
|
|
545
|
+
at as LINK,
|
|
546
|
+
ft as MULTILINE_ELEMENT_TRANSFORMERS,
|
|
547
|
+
Ye as ORDERED_LIST,
|
|
548
|
+
Ze as QUOTE,
|
|
549
|
+
st as STRIKETHROUGH,
|
|
550
|
+
dt as TEXT_FORMAT_TRANSFORMERS,
|
|
551
|
+
ut as TEXT_MATCH_TRANSFORMERS,
|
|
552
|
+
Se as TRANSFORMERS,
|
|
553
|
+
qe as UNORDERED_LIST,
|
|
554
|
+
Xe as isTableRowDivider
|
|
555
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { registerCheckList as o } from "../../list/dist/LexicalList.prod.js";
|
|
3
|
+
import { useLexicalComposerContext as i } from "./LexicalComposerContext.prod.js";
|
|
4
|
+
import { useEffect as t } from "react";
|
|
5
|
+
function n({ disableTakeFocusOnClick: e = !1 }) {
|
|
6
|
+
const [s] = i();
|
|
7
|
+
return t(() => o(s, { disableTakeFocusOnClick: e }), [s, e]), null;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
n as CheckListPlugin
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { registerClearEditor as r } from "../../extension/dist/LexicalExtension.prod.js";
|
|
3
|
+
import { useLexicalComposerContext as t } from "./LexicalComposerContext.prod.js";
|
|
4
|
+
import { CAN_USE_DOM as n } from "../../../lexical/dist/Lexical.prod.js";
|
|
5
|
+
import { useLayoutEffect as s, useEffect as i } from "react";
|
|
6
|
+
const u = n ? s : i;
|
|
7
|
+
function c({ onClear: o }) {
|
|
8
|
+
const [e] = t();
|
|
9
|
+
return u(() => r(e, o), [e, o]), null;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
c as ClearEditorPlugin
|
|
13
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createLexicalComposerContext as S, LexicalComposerContext as v } from "./LexicalComposerContext.prod.js";
|
|
3
|
+
import { createEditor as L, $getRoot as d, $createParagraphNode as y, CAN_USE_DOM as f, getActiveElement as R, $getSelection as _, HISTORY_MERGE_TAG as A } from "../../../lexical/dist/Lexical.prod.js";
|
|
4
|
+
import { useMemo as M, useLayoutEffect as $, useEffect as j } from "react";
|
|
5
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
6
|
+
const G = f ? $ : j, a = { tag: A };
|
|
7
|
+
function W({ initialConfig: s, children: E }) {
|
|
8
|
+
const c = M(() => {
|
|
9
|
+
const { theme: o, namespace: i, nodes: h, onError: b, onWarn: m, editorState: g, html: x } = s, C = S(null, o), n = L({ editable: s.editable, html: x, namespace: i, nodes: h, onError: (e) => b(e, n), ...m ? { onWarn: (e) => m(e, n) } : {}, theme: o });
|
|
10
|
+
return (function(e, t) {
|
|
11
|
+
if (t !== null) {
|
|
12
|
+
if (t === void 0) e.update(() => {
|
|
13
|
+
const r = d();
|
|
14
|
+
if (r.isEmpty()) {
|
|
15
|
+
const p = y();
|
|
16
|
+
r.append(p);
|
|
17
|
+
const l = e.getRootElement(), u = f && l !== null ? R(l) : null;
|
|
18
|
+
(_() !== null || u !== null && u === l) && p.select();
|
|
19
|
+
}
|
|
20
|
+
}, a);
|
|
21
|
+
else if (t !== null) switch (typeof t) {
|
|
22
|
+
case "string": {
|
|
23
|
+
const r = e.parseEditorState(t);
|
|
24
|
+
e.setEditorState(r, a);
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case "object":
|
|
28
|
+
e.setEditorState(t, a);
|
|
29
|
+
break;
|
|
30
|
+
case "function":
|
|
31
|
+
e.update(() => {
|
|
32
|
+
d().isEmpty() && t(e);
|
|
33
|
+
}, a);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
})(n, g), [n, C];
|
|
37
|
+
}, []);
|
|
38
|
+
return G(() => {
|
|
39
|
+
const o = s.editable, [i] = c;
|
|
40
|
+
i.setEditable(o === void 0 || o);
|
|
41
|
+
}, []), /* @__PURE__ */ k(v.Provider, { value: c, children: E });
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
W as LexicalComposer
|
|
45
|
+
};
|