@mx-space/cli 0.13.1 → 0.13.2

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.
Files changed (58) hide show
  1. package/README.md +59 -0
  2. package/ROADMAP.md +10 -7
  3. package/dist/{Lexical.dev-By5dOKBN.mjs → Lexical.dev-BsbWMhb3.mjs} +2265 -429
  4. package/dist/{Lexical.node-fXM8Jp7p.mjs → Lexical.node-DnR_u_Ke.mjs} +47 -10
  5. package/dist/Lexical.prod-B7L8eVsO.mjs +6816 -0
  6. package/dist/{LexicalClipboard.dev--HxGoSkO.mjs → LexicalClipboard.dev-BGSFbuTA.mjs} +131 -39
  7. package/dist/{LexicalClipboard.node-C3mRbrmW.mjs → LexicalClipboard.node-CUD_tpWb.mjs} +2 -2
  8. package/dist/LexicalClipboard.prod-DQXfRt3h.mjs +429 -0
  9. package/dist/{LexicalCodeCore.dev-DjSrd4A4.mjs → LexicalCodeCore.dev-B9lK_GSN.mjs} +81 -67
  10. package/dist/LexicalCodeCore.prod-CNWMPXhg.mjs +651 -0
  11. package/dist/LexicalDragon.dev-DRm2bGZ1.mjs +186 -0
  12. package/dist/{LexicalDragon.node-BVhw4C7s.mjs → LexicalDragon.node-d8gPruly.mjs} +3 -2
  13. package/dist/LexicalDragon.prod-ey3uKDJF.mjs +121 -0
  14. package/dist/{LexicalExtension.dev-BPNyvGqe.mjs → LexicalExtension.dev-CXtOJb83.mjs} +349 -35
  15. package/dist/{LexicalExtension.node-BVlcrgOx.mjs → LexicalExtension.node-CMsupJZs.mjs} +9 -4
  16. package/dist/{LexicalExtension.prod-DFKbiNt-.mjs → LexicalExtension.prod-BCLGhzcg.mjs} +477 -328
  17. package/dist/{LexicalHeadless.dev-B-cj7Pr5.mjs → LexicalHeadless.dev-yVDOBd64.mjs} +2 -2
  18. package/dist/{LexicalHeadless.prod-Byp1vNzT.mjs → LexicalHeadless.prod-B8qauuEA.mjs} +2 -2
  19. package/dist/{LexicalHtml.dev-prBAwszN.mjs → LexicalHtml.dev-3rdckXIU.mjs} +323 -265
  20. package/dist/{LexicalHtml.node-BvNF96jZ.mjs → LexicalHtml.node-DagZUjQ_.mjs} +6 -4
  21. package/dist/{LexicalHtml.prod-Sz3CW1ht.mjs → LexicalHtml.prod-B5AQaJDb.mjs} +354 -352
  22. package/dist/{LexicalLink.dev-NySTYhVR.mjs → LexicalLink.dev-CspSwLNB.mjs} +69 -58
  23. package/dist/{LexicalLink.prod-BuCM8gts.mjs → LexicalLink.prod-Da-ZW6H5.mjs} +210 -211
  24. package/dist/{LexicalList.dev-DIMOvSFD.mjs → LexicalList.dev-CNXmV6v8.mjs} +246 -198
  25. package/dist/LexicalList.prod-DgQzj4v9.mjs +944 -0
  26. package/dist/{LexicalMarkdown.dev-C7aylvCG.mjs → LexicalMarkdown.dev-0XURdo96.mjs} +129 -37
  27. package/dist/LexicalMarkdown.prod-qUsIQfJx.mjs +932 -0
  28. package/dist/{LexicalRichText.dev-DfICq6lU.mjs → LexicalRichText.dev-BqsEA7I9.mjs} +151 -122
  29. package/dist/{LexicalRichText.node-Bg9jND3Q.mjs → LexicalRichText.node-D73RR0Ck.mjs} +8 -11
  30. package/dist/LexicalRichText.prod-4Atyd7OR.mjs +538 -0
  31. package/dist/{LexicalSelection.dev-DGjj12wW.mjs → LexicalSelection.dev-DK5xfxKP.mjs} +10 -9
  32. package/dist/{LexicalSelection.node-BU5L4193.mjs → LexicalSelection.node-pyZyrANz.mjs} +4 -4
  33. package/dist/{LexicalSelection.prod-D-PwRbyK.mjs → LexicalSelection.prod-C5GrCbDC.mjs} +144 -146
  34. package/dist/{LexicalTable.dev-ChP7cugd.mjs → LexicalTable.dev-DiR_4rdI.mjs} +184 -119
  35. package/dist/LexicalTable.prod-Cbc5EasT.mjs +2336 -0
  36. package/dist/{LexicalUtils.dev-BiFU3789.mjs → LexicalUtils.dev-jhPjn1vQ.mjs} +375 -35
  37. package/dist/{LexicalUtils.node-j3Llm7Y3.mjs → LexicalUtils.node-Ck74ludK.mjs} +24 -12
  38. package/dist/LexicalUtils.prod-nuTBxnk_.mjs +504 -0
  39. package/dist/bin/mxs.mjs +1 -1
  40. package/dist/esm-BumPuCXw.mjs +2 -0
  41. package/dist/{esm-DFrz5rIo.mjs → esm-DupC6TTP.mjs} +214 -179
  42. package/dist/index.d.mts +46 -17
  43. package/dist/index.mjs +1 -1
  44. package/dist/{mxs-DXpzbUf4.mjs → mxs-BgAyMQdq.mjs} +8384 -6209
  45. package/package.json +17 -17
  46. package/skills/commands-ai.md +115 -0
  47. package/skills/overview.md +1 -0
  48. package/dist/Lexical.prod-BlCvXPGa.mjs +0 -6088
  49. package/dist/LexicalClipboard.prod-DNJzFMcT.mjs +0 -371
  50. package/dist/LexicalCodeCore.prod-DTDShkR3.mjs +0 -642
  51. package/dist/LexicalDragon.dev-DwprRH0z.mjs +0 -88
  52. package/dist/LexicalDragon.prod-nh4J-8vn.mjs +0 -59
  53. package/dist/LexicalList.prod-MVqfA6Vo.mjs +0 -925
  54. package/dist/LexicalMarkdown.prod-CfQSM406.mjs +0 -868
  55. package/dist/LexicalRichText.prod-GsFzCK-o.mjs +0 -550
  56. package/dist/LexicalTable.prod-Bpr9YRXp.mjs +0 -2311
  57. package/dist/LexicalUtils.prod-DCvrA78p.mjs +0 -373
  58. package/dist/esm-DXO9Afik.mjs +0 -2
@@ -1,868 +0,0 @@
1
- import { _ as LinkNode, a as HeadingNode, c as $createListNode, d as ListItemNode, f as ListNode, h as $isLinkNode, i as $isQuoteNode, l as $isListItemNode, m as $isAutoLinkNode, n as $createQuoteNode, o as QuoteNode, p as $createLinkNode, r as $isHeadingNode, s as $createListItemNode, t as $createHeadingNode, u as $isListNode, v as $createCodeNode, x as CodeNode, y as $isCodeNode } from "./LexicalRichText.node-Bg9jND3Q.mjs";
2
- import { $ as $isElementNode, Bt as COMMAND_PRIORITY_LOW, Et as $setState, Ft as COLLABORATION_TAG, G as $getState, H as $getRoot, Nn as KEY_ENTER_COMMAND, Or as mergeRegister, U as $getSelection, Vt as COMPOSITION_END_TAG, Z as $isDecoratorNode, _ as $createTextNode, an as HISTORY_PUSH_TAG, f as $createParagraphNode, ft as $isTextNode, g as $createTabNode, it as $isLineBreakNode, lt as $isRootOrShadowRoot, m as $createRangeSelection, or as createState, ot as $isParagraphNode, rn as HISTORIC_TAG, st as $isRangeSelection, t as $addUpdateTag, u as $createLineBreakNode, wt as $setSelection, y as $findMatchingParent } from "./Lexical.node-fXM8Jp7p.mjs";
3
- import { i as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-BU5L4193.mjs";
4
- import { r as $findMatchingParent$1 } from "./LexicalUtils.node-j3Llm7Y3.mjs";
5
- //#region ../../node_modules/.pnpm/@lexical+markdown@0.45.0/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.mjs
6
- /**
7
- * Copyright (c) Meta Platforms, Inc. and affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- *
12
- */
13
- function J(t, e) {
14
- const n = {};
15
- for (const o of t) {
16
- const t = e(o);
17
- t && (n[t] ? n[t].push(o) : n[t] = [o]);
18
- }
19
- return n;
20
- }
21
- function Q(t) {
22
- const e = J(t, (t) => t.type);
23
- return {
24
- element: e.element || [],
25
- multilineElement: e["multiline-element"] || [],
26
- textFormat: e["text-format"] || [],
27
- textMatch: e["text-match"] || []
28
- };
29
- }
30
- const V = /[!-/:-@[-`{-~\s]/, X = /\s/, Y = /[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/, Z = /^\s{0,3}$/;
31
- function tt(n) {
32
- if (!$isParagraphNode(n)) return !1;
33
- const o = n.getFirstChild();
34
- return null == o || 1 === n.getChildrenSize() && $isTextNode(o) && Z.test(o.getTextContent());
35
- }
36
- function et(t) {
37
- return t.replace(/\\([!-/:-@[-`{-~])/g, "$1").replace(/&#(\d+);/g, (t, e) => String.fromCodePoint(Number(e)));
38
- }
39
- const nt = /^(\s*)(\d{1,})\.\s/, ot = /^(\s*)[-*+]\s/, rt = /^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i, it = /^(#{1,6})\s/, st = /^>\s/, lt = /^([ \t]*`{3,})([\w-]+)?[ \t]?/, ct = /^[ \t]*`{3,}$/, at = /^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/, ft = /^(?:\|)(.+)(?:\|)\s?$/, ut = /^(\| ?:?-*:? ?)+\|\s?$/, dt = /^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i, gt = /^<\/[a-z_][\w-]*\s*>/i, pt = (t) => new RegExp(`(?:${t.source})$`, t.flags), ht = createState("mdListMarker", {
40
- parse: (t) => "string" == typeof t && /^[-*+]$/.test(t) ? t : "-",
41
- resetOnCopyNode: !0
42
- }), xt = createState("mdCodeFence", {
43
- parse: (t) => "string" == typeof t && /^`{3,}$/.test(t) ? t : "```",
44
- resetOnCopyNode: !0
45
- }), mt = createState("mdHardLineBreak", {
46
- parse: (t) => "string" == typeof t && /^(\\| {2,})$/.test(t) ? t : "",
47
- resetOnCopyNode: !0
48
- });
49
- function Ct(t) {
50
- if (t.endsWith("\\")) return [t.slice(0, -1), "\\"];
51
- const e = t.match(/^(.*?\S)( {2,})$/);
52
- return e ? [e[1], e[2]] : null;
53
- }
54
- function Tt(t) {
55
- const n = t.getChildren(), o = n.length - 1, r = n[o];
56
- if (!$isTextNode(r)) return null;
57
- const i = r.getTextContent(), s = Ct(i);
58
- if (null !== s) {
59
- const [t, e] = s;
60
- return r.setTextContent(t), e;
61
- }
62
- return /^ {2,}$/.test(i) && function(t, e) {
63
- for (let n = e - 1; n >= 0; n--) {
64
- if ($isLineBreakNode(t[n])) return !1;
65
- if (/\S/.test(t[n].getTextContent())) return !0;
66
- }
67
- return !1;
68
- }(n, o) ? (r.setTextContent(""), i) : null;
69
- }
70
- function Et(t) {
71
- const e = $createLineBreakNode(), n = Tt(t);
72
- return null !== n && $setState(e, mt, n), e;
73
- }
74
- const $t = (t) => (e, n, o, r) => {
75
- const i = t(o);
76
- i.append(...n), e.replace(i), r || i.select(0, 0);
77
- };
78
- const vt = (t) => (e, n, r, i) => {
79
- const s = e.getPreviousSibling(), l = e.getNextSibling(), c = $createListItemNode("check" === t ? "x" === r[3] : void 0), a = r[0].trim()[0], f = "bullet" !== t && "check" !== t || a !== ht.parse(a) ? void 0 : a;
80
- if ($isListNode(l) && l.getListType() === t) {
81
- f && $setState(l, ht, f);
82
- const t = l.getFirstChild();
83
- null !== t ? t.insertBefore(c) : l.append(c), e.remove();
84
- } else if ($isListNode(s) && s.getListType() === t) f && $setState(s, ht, f), s.append(c), e.remove();
85
- else {
86
- const n = $createListNode(t, "number" === t ? Number(r[2]) : void 0);
87
- f && $setState(n, ht, f), n.append(c), e.replace(n);
88
- }
89
- c.append(...n), i || c.select(0, 0);
90
- const u = function(t) {
91
- const e = t.match(/\t/g), n = t.match(/ /g);
92
- let o = 0;
93
- return e && (o += e.length), n && (o += Math.floor(n.length / 4)), o;
94
- }(r[1]);
95
- u && c.setIndent(u);
96
- }, It = (t, e, n, o) => {
97
- const r = [], s = t.getChildren();
98
- let l = 0;
99
- for (const c of s) if ($isListItemNode(c)) {
100
- if (1 === c.getChildrenSize()) {
101
- const t = c.getFirstChild();
102
- if ($isListNode(t)) {
103
- const i = It(t, e, n + 1, o);
104
- i && r.push(i);
105
- continue;
106
- }
107
- }
108
- if (o && !c.getChildren().some((t) => t.isSelected(o))) continue;
109
- const s = " ".repeat(4 * n), a = t.getListType(), f = $getState(t, ht), u = "number" === a ? `${t.getStart() + l}. ` : "check" === a ? `${f} [${c.getChecked() ? "x" : " "}] ` : f + " ";
110
- let d = e(c);
111
- "number" !== a && (d = d.replace(/^(\s{0,3}\d+)(\.\s)/, "$1\\$2")), r.push(s + u + d), l++;
112
- }
113
- return r.join("\n");
114
- }, yt = {
115
- dependencies: [HeadingNode],
116
- export: (t, e) => {
117
- if (!$isHeadingNode(t)) return null;
118
- const n = Number(t.getTag().slice(1));
119
- return "#".repeat(n) + " " + e(t);
120
- },
121
- regExp: it,
122
- replace: $t((t) => {
123
- return $createHeadingNode("h" + t[1].length);
124
- }),
125
- triggerOnEnter: !0,
126
- type: "element"
127
- }, St = {
128
- dependencies: [QuoteNode],
129
- export: (t, e) => {
130
- if (!$isQuoteNode(t)) return null;
131
- const n = e(t).split("\n"), o = [];
132
- for (const t of n) o.push("> " + t);
133
- return o.join("\n");
134
- },
135
- regExp: st,
136
- replace: (t, e, n, o) => {
137
- if (o) {
138
- const n = t.getPreviousSibling();
139
- if ($isQuoteNode(n)) return n.splice(n.getChildrenSize(), 0, [Et(n), ...e]), void t.remove();
140
- }
141
- const r = $createQuoteNode();
142
- r.append(...e), t.replace(r), o || r.select(0, 0);
143
- },
144
- triggerOnEnter: !0,
145
- type: "element"
146
- }, bt = {
147
- dependencies: [CodeNode],
148
- export: (t) => {
149
- if (!$isCodeNode(t)) return null;
150
- const e = t.getTextContent();
151
- let n = $getState(t, xt);
152
- if (e.indexOf(n) > -1) {
153
- const t = e.match(/`{3,}/g);
154
- if (t) {
155
- const e = Math.max(...t.map((t) => t.length));
156
- n = "`".repeat(e + 1);
157
- }
158
- }
159
- return n + (t.getLanguage() || "") + (e ? "\n" + e : "") + "\n" + n;
160
- },
161
- handleImportAfterStartMatch: ({ lines: t, rootNode: e, startLineIndex: n, startMatch: o }) => {
162
- const r = o[1], i = r.trim().length, s = t[n], l = o.index + r.length, c = s.slice(l), a = new RegExp(`\`{${i},}$`);
163
- if (a.test(c)) {
164
- const t = c.match(a), r = c.slice(0, c.lastIndexOf(t[0])), i = [...o];
165
- return i[2] = "", bt.replace(e, null, i, t, [r], !0), [!0, n];
166
- }
167
- const f = new RegExp(`^[ \\t]*\`{${i},}$`);
168
- for (let r = n + 1; r < t.length; r++) {
169
- const i = t[r];
170
- if (f.test(i)) {
171
- const l = i.match(f), c = t.slice(n + 1, r), a = s.slice(o[0].length);
172
- return a.length > 0 && c.unshift(a), bt.replace(e, null, o, l, c, !0), [!0, r];
173
- }
174
- }
175
- const u = t.slice(n + 1), d = s.slice(o[0].length);
176
- return d.length > 0 && u.unshift(d), bt.replace(e, null, o, null, u, !0), [!0, t.length - 1];
177
- },
178
- regExpEnd: {
179
- optional: !0,
180
- regExp: ct
181
- },
182
- regExpStart: lt,
183
- replace: (t, e, n, i, s, l) => {
184
- let c, a;
185
- const f = n[1] ? n[1].trim() : "```", u = n[2] || void 0;
186
- if (!e && s) {
187
- if (1 === s.length) i ? (c = $createCodeNode(u), a = s[0]) : (c = $createCodeNode(u), a = s[0].startsWith(" ") ? s[0].slice(1) : s[0]);
188
- else {
189
- for (c = $createCodeNode(u), s.length > 0 && (0 === s[0].trim().length ? s.shift() : s[0].startsWith(" ") && (s[0] = s[0].slice(1))); s.length > 0 && !s[s.length - 1].length;) s.pop();
190
- a = s.join("\n");
191
- }
192
- $setState(c, xt, f);
193
- const e = $createTextNode(a);
194
- c.append(e), t.append(c);
195
- } else e && $t((t) => $createCodeNode(t ? t[2] : void 0))(t, e, n, l);
196
- },
197
- type: "multiline-element"
198
- }, wt = {
199
- dependencies: [ListNode, ListItemNode],
200
- export: (t, e, n) => $isListNode(t) ? It(t, e, 0, n) : null,
201
- regExp: ot,
202
- replace: vt("bullet"),
203
- triggerOnEnter: !0,
204
- type: "element"
205
- }, kt = {
206
- dependencies: [ListNode, ListItemNode],
207
- export: (t, e, n) => $isListNode(t) ? It(t, e, 0, n) : null,
208
- regExp: rt,
209
- replace: vt("check"),
210
- triggerOnEnter: !0,
211
- type: "element"
212
- }, Nt = {
213
- dependencies: [ListNode, ListItemNode],
214
- export: (t, e, n) => $isListNode(t) ? It(t, e, 0, n) : null,
215
- regExp: nt,
216
- replace: vt("number"),
217
- triggerOnEnter: !0,
218
- type: "element"
219
- }, Ft = {
220
- format: ["code"],
221
- tag: "`",
222
- type: "text-format"
223
- }, Lt = {
224
- format: ["highlight"],
225
- tag: "==",
226
- type: "text-format"
227
- }, Ot = {
228
- format: ["bold", "italic"],
229
- tag: "***",
230
- type: "text-format"
231
- }, Mt = {
232
- format: ["bold", "italic"],
233
- intraword: !1,
234
- tag: "___",
235
- type: "text-format"
236
- }, Rt = {
237
- format: ["bold"],
238
- tag: "**",
239
- type: "text-format"
240
- }, Bt = {
241
- format: ["bold"],
242
- intraword: !1,
243
- tag: "__",
244
- type: "text-format"
245
- }, _t = {
246
- format: ["strikethrough"],
247
- tag: "~~",
248
- type: "text-format"
249
- }, jt = {
250
- format: ["italic"],
251
- tag: "*",
252
- type: "text-format"
253
- }, At = {
254
- format: ["italic"],
255
- intraword: !1,
256
- tag: "_",
257
- type: "text-format"
258
- }, Pt = {
259
- dependencies: [LinkNode],
260
- export: (t, e, n) => {
261
- if (!$isLinkNode(t) || $isAutoLinkNode(t)) return null;
262
- const o = e(t);
263
- let r = t.getTitle();
264
- null != r && (r = r.replace(/([\\"])/g, "\\$1"));
265
- return r ? `[${o}](${t.getURL()} "${r}")` : `[${o}](${t.getURL()})`;
266
- },
267
- importRegExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,
268
- regExp: /(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,
269
- replace: (t, e) => {
270
- if ($findMatchingParent(t, $isLinkNode)) return;
271
- const [, n, o, i] = e, a = $createLinkNode(null != o ? et(o) : void 0, { title: null != i ? et(i) : void 0 }), f = n.split("[").length - 1, u = n.split("]").length - 1;
272
- let d = n, g = "";
273
- if (f < u) return;
274
- if (f > u) {
275
- const t = n.split("[");
276
- g = "[" + t[0], d = t.slice(1).join("[");
277
- }
278
- const p = $createTextNode(d);
279
- return p.setFormat(t.getFormat()), a.append(p), t.replace(a), g && a.insertBefore($createTextNode(g)), p;
280
- },
281
- trigger: ")",
282
- type: "text-match"
283
- }, zt = [
284
- yt,
285
- St,
286
- wt,
287
- Nt
288
- ], Wt = [bt], Ut = [
289
- Ft,
290
- Ot,
291
- Mt,
292
- Rt,
293
- Bt,
294
- Lt,
295
- jt,
296
- At,
297
- _t
298
- ], Dt = [Pt], Ht = [
299
- ...zt,
300
- ...Wt,
301
- ...Ut,
302
- ...Dt
303
- ];
304
- function Kt(t, e, n, o, r, i) {
305
- let s = t.isSelected(e);
306
- for (const l of n) {
307
- if (!l.export) continue;
308
- const n = l.export(t, (t) => qt(t, e, o, r, i).markdown, e);
309
- if (null != n) {
310
- if (!s && $isElementNode(t)) qt(t, e, o, r, i).shouldInclude && (s = !0);
311
- return {
312
- markdown: n,
313
- shouldInclude: s
314
- };
315
- }
316
- }
317
- if ($isElementNode(t)) {
318
- const n = qt(t, e, o, r, i);
319
- return {
320
- markdown: n.markdown,
321
- shouldInclude: s || n.shouldInclude
322
- };
323
- }
324
- return $isDecoratorNode(t) ? {
325
- markdown: t.getTextContent(),
326
- shouldInclude: s
327
- } : {
328
- markdown: null,
329
- shouldInclude: s
330
- };
331
- }
332
- function qt(t, n, o, r, i, s, l) {
333
- const a = [], d = t.getChildren();
334
- let g = !1;
335
- s || (s = []), l || (l = []);
336
- t: for (const t of d) {
337
- let d = t.isSelected(n);
338
- for (const e of r) {
339
- if (!e.export) continue;
340
- const c = e.export(t, (t) => qt(t, n, o, r, i, s, [...l, ...s]).markdown, (t, e) => Vt(t, $sliceSelectedTextNodeContent(n, t, "clone").getTextContent(), o, s, l, i));
341
- if (null != c) {
342
- !d && $isElementNode(t) && t.getChildren().some((t) => t.isSelected(n)) && t.extractWithChild(t, n, "html") && (d = !0), d && (a.push(c), g = !0);
343
- continue t;
344
- }
345
- }
346
- if ($isLineBreakNode(t)) d && (a.push(Qt(t)), g = !0);
347
- else if ($isTextNode(t)) {
348
- if (d) {
349
- const e = $sliceSelectedTextNodeContent(n, t, "clone");
350
- a.push(Vt(t, e.getTextContent(), o, s, l, i)), g = !0;
351
- }
352
- } else if ($isElementNode(t)) {
353
- const e = qt(t, n, o, r, i, s, l);
354
- !d && e.shouldInclude && t.extractWithChild(t, n, "html") && (d = !0), (d || e.shouldInclude) && (a.push(e.markdown), g = !0);
355
- } else $isDecoratorNode(t) && d && (a.push(t.getTextContent()), g = !0);
356
- }
357
- return {
358
- markdown: a.join(""),
359
- shouldInclude: g
360
- };
361
- }
362
- function Gt(t, e, n, o, r) {
363
- for (const i of e) {
364
- if (!i.export) continue;
365
- const e = i.export(t, (t) => Jt(t, n, o, void 0, void 0, r));
366
- if (null != e) return e;
367
- }
368
- return $isElementNode(t) ? Jt(t, n, o, void 0, void 0, r) : $isDecoratorNode(t) ? t.getTextContent() : null;
369
- }
370
- function Jt(t, n, o, r, i, s = !1) {
371
- const l = [], a = t.getChildren();
372
- r || (r = []), i || (i = []);
373
- t: for (const t of a) {
374
- for (const e of o) {
375
- if (!e.export) continue;
376
- const c = e.export(t, (t) => Jt(t, n, o, r, [...i, ...r], s), (t, e) => Vt(t, e, n, r, i, s));
377
- if (null != c) {
378
- l.push(c);
379
- continue t;
380
- }
381
- }
382
- $isLineBreakNode(t) ? l.push(Qt(t)) : $isTextNode(t) ? l.push(Vt(t, t.getTextContent(), n, r, i, s)) : $isElementNode(t) ? l.push(Jt(t, n, o, r, i, s)) : $isDecoratorNode(t) && l.push(t.getTextContent());
383
- }
384
- return l.join("");
385
- }
386
- function Qt(t) {
387
- return $getState(t, mt) + "\n";
388
- }
389
- function Vt(t, e, n, o, r, i = !1) {
390
- let s = e;
391
- t.hasFormat("code") || (s = i ? s.replace(/([*_`~])/g, "\\$1") : s.replace(/([*_`~\\])/g, "\\$1"));
392
- const l = s.match(/^(\s*)(.*?)(\s*)$/s) || [
393
- "",
394
- "",
395
- s,
396
- ""
397
- ], c = l[1], a = l[2], f = l[3], u = "" === a;
398
- let d = "", g = "", p = "";
399
- const h = Xt(t, !0), x = Xt(t, !1), m = /* @__PURE__ */ new Set();
400
- for (const e of n) {
401
- const n = e.format[0], r = e.tag;
402
- Zt(t, n) && !m.has(n) && (m.add(n), Zt(h, n) && o.find((t) => t.tag === r) || (o.push({
403
- format: n,
404
- tag: r
405
- }), d += r));
406
- }
407
- for (let e = 0; e < o.length; e++) {
408
- const n = Yt(t, o[e].format), i = Yt(x, o[e].format);
409
- if (n && i) continue;
410
- const s = [...o];
411
- for (; s.length > e;) {
412
- const t = s.pop();
413
- r && t && r.find((e) => e.tag === t.tag) || (t && "string" == typeof t.tag && (n ? i || (p += t.tag) : g += t.tag), o.pop());
414
- }
415
- break;
416
- }
417
- return u && !t.hasFormat("code") ? g + s : g + c + d + a + p + f;
418
- }
419
- function Xt(t, n) {
420
- const o = n ? t.getPreviousSibling() : t.getNextSibling();
421
- return $isTextNode(o) ? o : null;
422
- }
423
- function Yt(t, n) {
424
- return $isTextNode(t) && t.hasFormat(n);
425
- }
426
- function Zt(t, e) {
427
- return !!Yt(t, e) && ("code" === e || !t || !/^\s*$/.test(t.getTextContent()));
428
- }
429
- function te(t, e) {
430
- const n = t.getTextContent(), o = e.fullMatchRegExpByTag["`"], r = e.transformersByTag["`"], i = [];
431
- let s = null;
432
- if (o && r) {
433
- const t = new RegExp(o.source, "g"), e = Array.from(n.matchAll(t));
434
- for (const t of e) {
435
- const e = t.index + t[1].length, n = t.index + t[0].length;
436
- s || (s = {
437
- content: t[3],
438
- endIndex: n,
439
- startIndex: e,
440
- tag: "`"
441
- }), i.push({
442
- end: n,
443
- start: e
444
- });
445
- }
446
- }
447
- const l = function(t, e, n = []) {
448
- const o = [], r = new Set(Object.keys(e.transformersByTag).filter((t) => "`" !== t[0]).map((t) => t[0])), i = (e) => {
449
- let n = 0;
450
- for (let o = e - 1; o >= 0 && "\\" === t[o]; o--) n++;
451
- return n % 2 == 1;
452
- }, s = (t) => n.some((e) => t >= e.start && t < e.end);
453
- let l = 0;
454
- for (; l < t.length;) {
455
- const e = t[l];
456
- if (!r.has(e) || i(l) || s(l)) {
457
- l++;
458
- continue;
459
- }
460
- let n = 1;
461
- for (; l + n < t.length && t[l + n] === e;) n++;
462
- const c = ee(e, t, l, n, !0), a = ee(e, t, l, n, !1);
463
- (c || a) && o.push({
464
- active: !0,
465
- canClose: a,
466
- canOpen: c,
467
- char: e,
468
- index: l,
469
- length: n,
470
- originalLength: n
471
- }), l += n;
472
- }
473
- return o;
474
- }(n, e, i), c = l.length > 0 ? function(t, e, n) {
475
- const o = {};
476
- let r = 0, i = null;
477
- for (; r < e.length;) {
478
- const s = e[r];
479
- if (!s.active || !s.canClose || 0 === s.length) {
480
- r++;
481
- continue;
482
- }
483
- const l = `${s.char}${s.canOpen}`, c = o[l] ?? -1;
484
- let a = !1;
485
- for (let o = r - 1; o > c; o--) {
486
- const l = e[o];
487
- if (!l.active || !l.canOpen || 0 === l.length || l.char !== s.char) continue;
488
- if (l.canClose || s.canOpen) {
489
- if ((l.originalLength + s.originalLength) % 3 == 0 && l.originalLength % 3 != 0 && s.originalLength % 3 != 0) continue;
490
- }
491
- const c = Math.min(l.length, s.length), f = Object.keys(n.transformersByTag).filter((t) => t[0] === l.char && t.length <= c).sort((t, e) => e.length - t.length)[0];
492
- if (!f) continue;
493
- a = !0;
494
- const u = f.length, d = {
495
- content: t.slice(l.index + l.length, s.index),
496
- endIndex: s.index + u,
497
- startIndex: l.index + (l.length - u),
498
- tag: f
499
- };
500
- (!i || d.startIndex < i.startIndex || d.startIndex === i.startIndex && d.endIndex > i.endIndex) && (i = d);
501
- for (let t = o + 1; t < r; t++) e[t].active = !1;
502
- l.length -= u, s.length -= u, l.active = l.length > 0, s.length > 0 ? s.index += u : (s.active = !1, r++);
503
- break;
504
- }
505
- a || (o[l] = r - 1, s.canOpen || (s.active = !1), r++);
506
- }
507
- return i;
508
- }(n, l, e) : null;
509
- let a = null, f = null;
510
- if (s && c ? c.startIndex <= s.startIndex && c.endIndex >= s.endIndex ? (a = c, f = e.transformersByTag[c.tag]) : (a = s, f = r) : s ? (a = s, f = r) : c && (a = c, f = e.transformersByTag[c.tag]), !a || !f) return null;
511
- const u = [
512
- n.slice(a.startIndex, a.endIndex),
513
- a.tag,
514
- a.content
515
- ];
516
- return u.index = a.startIndex, u.input = n, {
517
- endIndex: a.endIndex,
518
- match: u,
519
- startIndex: a.startIndex,
520
- transformer: f
521
- };
522
- }
523
- function ee(t, e, n, o, r) {
524
- if (!ne(e, n, o, r)) return !1;
525
- if ("*" === t) return !0;
526
- if ("_" === t) {
527
- if (!ne(e, n, o, !r)) return !0;
528
- const t = r ? e[n - 1] : e[n + o];
529
- return void 0 !== t && Y.test(t);
530
- }
531
- return !0;
532
- }
533
- function ne(t, e, n, o) {
534
- const r = t[e - 1], i = t[e + n], [s, l] = o ? [i, r] : [r, i];
535
- return void 0 !== s && !X.test(s) && (!Y.test(s) || void 0 === l || X.test(l) || Y.test(l));
536
- }
537
- function oe(t) {
538
- return $isTextNode(t) && !t.hasFormat("code");
539
- }
540
- function re(t, e, n) {
541
- let o = te(t, e), r = function(t, e) {
542
- const n = t;
543
- let o, r, i, s;
544
- for (const t of e) {
545
- if (!t.replace || !t.importRegExp) continue;
546
- const e = n.getTextContent().match(t.importRegExp);
547
- if (!e) continue;
548
- const l = e.index || 0, c = t.getEndIndex ? t.getEndIndex(n, e) : l + e[0].length;
549
- !1 !== c && (void 0 === o || void 0 === r || l < o && (c > r || c <= o)) && (o = l, r = c, i = t, s = e);
550
- }
551
- return void 0 === o || void 0 === r || void 0 === i || void 0 === s ? null : {
552
- endIndex: r,
553
- match: s,
554
- startIndex: o,
555
- transformer: i
556
- };
557
- }(t, n);
558
- if (o && r && (o.startIndex <= r.startIndex && o.endIndex >= r.endIndex || r.startIndex > o.endIndex ? r = null : o = null), o) {
559
- const r = function(t, e, n, o, r) {
560
- const i = t.getTextContent();
561
- let s, l, c;
562
- if (r[0] === i ? s = t : 0 === e ? [s, l] = t.splitText(n) : [c, s, l] = t.splitText(e, n), s.setTextContent(r[2]), o) for (const t of o.format) s.hasFormat(t) || s.toggleFormat(t);
563
- return {
564
- nodeAfter: l,
565
- nodeBefore: c,
566
- transformedNode: s
567
- };
568
- }(t, o.startIndex, o.endIndex, o.transformer, o.match);
569
- oe(r.nodeAfter) && re(r.nodeAfter, e, n), oe(r.nodeBefore) && re(r.nodeBefore, e, n), oe(r.transformedNode) && re(r.transformedNode, e, n);
570
- } else if (r) {
571
- const o = function(t, e, n, o, r) {
572
- let i, s, l;
573
- return 0 === e ? [i, s] = t.splitText(n) : [l, i, s] = t.splitText(e, n), o.replace ? {
574
- nodeAfter: s,
575
- nodeBefore: l,
576
- transformedNode: o.replace(i, r) || void 0
577
- } : null;
578
- }(t, r.startIndex, r.endIndex, r.transformer, r.match);
579
- if (!o) return;
580
- oe(o.nodeAfter) && re(o.nodeAfter, e, n), oe(o.nodeBefore) && re(o.nodeBefore, e, n), oe(o.transformedNode) && re(o.transformedNode, e, n);
581
- }
582
- const i = et(t.getTextContent());
583
- t.setTextContent(i);
584
- }
585
- function ie(t, e = !1) {
586
- const n = Q(t), o = function(t) {
587
- const e = {}, n = {}, o = [];
588
- for (const r of t) {
589
- const { tag: t } = r;
590
- e[t] = r;
591
- const i = t.replace(/(\*|\^|\+)/g, "\\$1");
592
- o.push(i), 1 === t.length ? n[t] = "`" === t ? /* @__PURE__ */ new RegExp("(^|[^\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)") : new RegExp(`(^|[^\\\\${i}])(${i})((\\\\${i})?.*?[^${i}\\s](\\\\${i})?)(${i})(?![\\\\${i}])`) : n[t] = new RegExp(`(^|[^\\\\])(${i})((\\\\${i})?.*?[^\\s](\\\\${i})?)(${i})(?!\\\\)`);
593
- }
594
- return {
595
- fullMatchRegExpByTag: n,
596
- openTagsRegExp: new RegExp(`(${o.join("|")})`, "g"),
597
- transformersByTag: e
598
- };
599
- }(n.textFormat);
600
- return (t, r) => {
601
- const i = t.split("\n"), s = i.length, l = r || $getRoot();
602
- l.clear();
603
- for (let t = 0; t < s; t++) {
604
- const r = i[t], [s, c] = se(i, t, n.multilineElement, l);
605
- s ? t = c : le(r, l, n.element, o, n.textMatch, e);
606
- }
607
- const c = l.getChildren();
608
- for (const t of c) if (!e && tt(t) && l.getChildrenSize() > 1) t.remove();
609
- else if ($isElementNode(t)) for (const e of t.getAllTextNodes()) ce(e);
610
- null !== $getSelection() && l.selectStart();
611
- };
612
- }
613
- function se(t, e, n, o) {
614
- for (const r of n) {
615
- const { handleImportAfterStartMatch: n, regExpEnd: i, regExpStart: s, replace: l } = r, c = t[e].match(s);
616
- if (!c) continue;
617
- if (n) {
618
- const i = n({
619
- lines: t,
620
- rootNode: o,
621
- startLineIndex: e,
622
- startMatch: c,
623
- transformer: r
624
- });
625
- if (null === i) continue;
626
- if (i) return i;
627
- }
628
- const a = "object" == typeof i && "regExp" in i ? i.regExp : i, f = i && "object" == typeof i && "optional" in i ? i.optional : !i;
629
- let u = e;
630
- const d = t.length;
631
- for (; u < d;) {
632
- const n = a ? t[u].match(a) : null;
633
- if (!n && (!f || f && u < d - 1)) {
634
- u++;
635
- continue;
636
- }
637
- if (n && e === u && n.index === c.index) {
638
- u++;
639
- continue;
640
- }
641
- const r = [];
642
- if (n && e === u) r.push(t[e].slice(c[0].length, -n[0].length));
643
- else for (let o = e; o <= u; o++) if (o === e) {
644
- const e = t[o].slice(c[0].length);
645
- r.push(e);
646
- } else if (o === u && n) {
647
- const e = t[o].slice(0, -n[0].length);
648
- r.push(e);
649
- } else r.push(t[o]);
650
- if (!1 !== l(o, null, c, n, r, !0)) return [!0, u];
651
- break;
652
- }
653
- }
654
- return [!1, e];
655
- }
656
- function le(e, n, o, i, s, l) {
657
- const c = $createTextNode(e), a = $createParagraphNode();
658
- a.append(c), n.append(a);
659
- for (const { regExp: t, replace: n } of o) {
660
- const o = e.match(t);
661
- if (o && (c.setTextContent(e.slice(o[0].length)), !1 !== n(a, [c], o, !0))) break;
662
- }
663
- if (re(c, i, s), a.isAttached() && e.length > 0) {
664
- const e = a.getPreviousSibling();
665
- if (!l && ($isParagraphNode(e) || $isQuoteNode(e) || $isListNode(e))) {
666
- let t = e;
667
- if ($isListNode(e)) {
668
- const n = e.getLastDescendant();
669
- t = null == n ? null : $findMatchingParent$1(n, $isListItemNode);
670
- }
671
- null != t && t.getTextContentSize() > 0 && (t.splice(t.getChildrenSize(), 0, [Et(t), ...a.getChildren()]), a.remove());
672
- }
673
- }
674
- }
675
- function ce(t) {
676
- const e = /* @__PURE__ */ new Set(), n = t.getTextContent();
677
- let o = n.indexOf(" ");
678
- for (; -1 !== o;) e.add(o), e.add(o + 1), o = n.indexOf(" ", o + 1);
679
- t.splitText(...e).forEach((t) => {
680
- " " === t.getTextContent() && t.replace($createTabNode());
681
- });
682
- }
683
- function ae(t, ...e) {
684
- const n = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
685
- o.append("code", t);
686
- for (const t of e) o.append("v", t);
687
- throw n.search = o.toString(), Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
688
- }
689
- function fe(t, e, n, o, r) {
690
- if (!$isRootOrShadowRoot(t.getParent()) || t.getFirstChild() !== e) return !1;
691
- const s = e.getTextContent();
692
- if (!r && " " !== s[n - 1]) return !1;
693
- for (const { regExp: i, replace: l } of o) {
694
- const o = s.match(i), c = r || o && o[0].endsWith(" ") ? n : n - 1;
695
- if (o && o[0].length === c) {
696
- const r = e.getNextSiblings(), [i, s] = e.splitText(n);
697
- if (!1 !== l(t, s ? [s, ...r] : r, o, !1)) return i.remove(), !0;
698
- }
699
- }
700
- return !1;
701
- }
702
- function ue(t, e, n, o, r) {
703
- if (!$isRootOrShadowRoot(t.getParent()) || t.getFirstChild() !== e) return !1;
704
- const s = e.getTextContent();
705
- if (!r && " " !== s[n - 1]) return !1;
706
- for (const { regExpStart: i, replace: l, regExpEnd: c } of o) {
707
- if (c && !("optional" in c) || c && "optional" in c && !c.optional) continue;
708
- const o = s.match(i);
709
- if (o) {
710
- const i = r || o[0].endsWith(" ") ? n : n - 1;
711
- if (o[0].length !== i) continue;
712
- const s = e.getNextSiblings(), [c, a] = e.splitText(n);
713
- if (!1 !== l(t, a ? [a, ...s] : s, o, null, null, !1)) return c.remove(), !0;
714
- }
715
- }
716
- return !1;
717
- }
718
- function de(t, e) {
719
- let n = 0;
720
- const o = t.getTextContent();
721
- for (let t = 0; t < e; t++) "`" === o[t] && n++;
722
- return n % 2 != 0;
723
- }
724
- function ge(t, e, n) {
725
- const o = n.length;
726
- for (let r = e; r >= o; r--) {
727
- const e = r - o;
728
- if (pe(t, e, n, 0, o) && " " !== t[e + o]) return e;
729
- }
730
- return -1;
731
- }
732
- function pe(t, e, n, o, r) {
733
- for (let i = 0; i < r; i++) if (t[e + i] !== n[o + i]) return !1;
734
- return !0;
735
- }
736
- function he(t, n = Ht) {
737
- const o = Q(n), r = o.element.filter((t) => t.triggerOnEnter), i = J(o.textFormat, ({ tag: t }) => t[t.length - 1]), s = J(o.textMatch, ({ trigger: t }) => t), l = new Set([" "]);
738
- for (const t of o.textFormat) l.add(t.tag.slice(-1));
739
- for (const t of o.textMatch) void 0 !== t.trigger && l.add(t.trigger);
740
- for (const e of n) {
741
- const n = e.type;
742
- if ("element" === n || "text-match" === n || "multiline-element" === n) {
743
- const n = e.dependencies;
744
- for (const e of n) t.hasNode(e) || ae(173, e.getType());
745
- }
746
- }
747
- const a = (t, n, r) => !!fe(t, n, r, o.element) || !!ue(t, n, r, o.multilineElement) || !!function(t, e, n) {
748
- let o = t.getTextContent();
749
- const r = n[o[e - 1]];
750
- if (null == r) return !1;
751
- e < o.length && (o = o.slice(0, e));
752
- for (const e of r) {
753
- if (!e.replace || !e.regExp) continue;
754
- const n = o.match(e.regExp);
755
- if (null === n) continue;
756
- const r = n.index || 0, i = r + n[0].length;
757
- let s;
758
- return 0 === r ? [s] = t.splitText(i) : [, s] = t.splitText(r, i), s.selectNext(0, 0), e.replace(s, n), !0;
759
- }
760
- return !1;
761
- }(n, r, s) || !!function(t, n, o) {
762
- const r = t.getTextContent(), i = n - 1, s = r[i], l = o[s];
763
- if (!l) return !1;
764
- for (const n of l) {
765
- const { tag: o } = n, l = o.length, a = i - l + 1;
766
- if (l > 1 && !pe(r, a, o, 0, l)) continue;
767
- if (" " === r[a - 1]) continue;
768
- const f = r[i + 1];
769
- if (!1 === n.intraword && f && !V.test(f)) continue;
770
- const u = t;
771
- let g = u, p = ge(r, a, o), h = g;
772
- for (; p < 0 && (h = h.getPreviousSibling()) && !$isLineBreakNode(h);) if ($isTextNode(h)) {
773
- if (h.hasFormat("code")) continue;
774
- const t = h.getTextContent();
775
- g = h, p = ge(t, t.length, o);
776
- }
777
- if (p < 0) continue;
778
- if (g === u && p + l === a) continue;
779
- const x = g.getTextContent();
780
- if (p > 0 && x[p - 1] === s) continue;
781
- const m = x[p - 1];
782
- if (!1 === n.intraword && m && !V.test(m)) continue;
783
- if (!n.format.includes("code") && de(g, p)) continue;
784
- const C = u.getTextContent(), E = C.slice(0, a) + C.slice(i + 1);
785
- u.setTextContent(E);
786
- const $ = g === u ? E : x;
787
- g.setTextContent($.slice(0, p) + $.slice(p + l));
788
- const v = $getSelection(), I = $createRangeSelection();
789
- $setSelection(I);
790
- const y = i - l * (g === u ? 2 : 1) + 1;
791
- I.anchor.set(g.__key, p, "text"), I.focus.set(u.__key, y, "text");
792
- for (const t of n.format) I.hasFormat(t) || I.formatText(t);
793
- I.anchor.set(I.focus.key, I.focus.offset, I.focus.type);
794
- for (const t of n.format) I.hasFormat(t) && I.toggleFormat(t);
795
- return $isRangeSelection(v) && (I.format = v.format), !0;
796
- }
797
- return !1;
798
- }(n, r, i);
799
- return mergeRegister(t.registerUpdateListener(({ tags: n, dirtyLeaves: o, editorState: r, prevEditorState: i }) => {
800
- if (n.has(COLLABORATION_TAG) || n.has(HISTORIC_TAG)) return;
801
- if (t.isComposing()) return;
802
- const s = n.has(COMPOSITION_END_TAG), c = r.read($getSelection), f = i.read($getSelection);
803
- if (!$isRangeSelection(f) || !$isRangeSelection(c) || !c.isCollapsed() || c.is(f) && !s) return;
804
- const u = c.anchor.key, g = c.anchor.offset, p = r._nodeMap.get(u);
805
- if ($isTextNode(p) && o.has(u) && (s || 1 === g || !(g > f.anchor.offset + 1))) {
806
- if (s) {
807
- const t = r.read(() => p.getTextContent())[g - 1];
808
- if (!l.has(t)) return;
809
- }
810
- t.update(() => {
811
- if (!oe(p)) return;
812
- const t = p.getParent();
813
- null === t || $isCodeNode(t) || a(t, p, c.anchor.offset) && $addUpdateTag(HISTORY_PUSH_TAG);
814
- });
815
- }
816
- }), t.registerCommand(KEY_ENTER_COMMAND, (t) => {
817
- if (null !== t && t.shiftKey) return !1;
818
- const n = $getSelection();
819
- if (!$isRangeSelection(n) || !n.isCollapsed()) return !1;
820
- const i = n.anchor.offset, s = n.anchor.getNode();
821
- if (!$isTextNode(s) || !oe(s)) return !1;
822
- const l = s.getParent();
823
- if (null === l || $isCodeNode(l)) return !1;
824
- return i === s.getTextContent().length && !(!ue(l, s, i, o.multilineElement, !0) && !fe(l, s, i, r, !0)) && (null !== t && t.preventDefault(), !0);
825
- }, COMMAND_PRIORITY_LOW));
826
- }
827
- function xe(t, e = Ht, n, o = !1, r = !1) {
828
- const i = o ? t : function(t, e = !1) {
829
- const n = t.split("\n");
830
- let o = !1;
831
- const r = [];
832
- for (let t = 0; t < n.length; t++) {
833
- const i = n[t], s = i.trimEnd(), l = r[r.length - 1], c = t < n.length - 1 ? Ct(i) : null, a = void 0 !== l && null !== Ct(l);
834
- at.test(s) ? r.push(s) : lt.test(s) || ct.test(s) ? (o = !o, r.push(s)) : o ? r.push(i) : "" === s || "" === l || !l || it.test(l) || it.test(s) || st.test(s) || nt.test(s) || ot.test(s) || rt.test(s) || ft.test(s) || ut.test(s) || a || !e || dt.test(s) || gt.test(s) || pt(gt).test(l) || pt(dt).test(l) || ct.test(l) ? r.push(!e && "" !== s || null !== c ? i : s) : r[r.length - 1] = l + " " + (null === c ? s : i).trimStart();
835
- }
836
- return r.join("\n");
837
- }(t, r);
838
- return ie(e, o)(i, n);
839
- }
840
- function me(t = Ht, e, n = !1) {
841
- return function(t, e = !1) {
842
- const n = Q(t), o = [...n.multilineElement, ...n.element], r = !e, i = n.textFormat.filter((t) => 1 === t.format.length).sort((t, e) => Number(t.format.includes("code")) - Number(e.format.includes("code")));
843
- return (t) => {
844
- const s = [], l = (t || $getRoot()).getChildren();
845
- for (let t = 0; t < l.length; t++) {
846
- const c = l[t], a = Gt(c, o, i, n.textMatch, e);
847
- null != a && s.push(r && t > 0 && !tt(c) && !tt(l[t - 1]) ? "\n".concat(a) : a);
848
- }
849
- return s.join("\n");
850
- };
851
- }(t, n)(e);
852
- }
853
- function Ce(t = Ht, e, n = !1) {
854
- if (!e || $isRangeSelection(e) && e.isCollapsed()) return "";
855
- return function(t, e = !1) {
856
- const n = Q(t), o = [...n.multilineElement, ...n.element], r = !e, i = n.textFormat.filter((t) => 1 === t.format.length).sort((t, e) => Number(t.format.includes("code")) - Number(e.format.includes("code")));
857
- return (t) => {
858
- const s = [], l = $getRoot().getChildren();
859
- for (let c = 0; c < l.length; c++) {
860
- const a = l[c], { shouldInclude: f, markdown: u } = Kt(a, t, o, i, n.textMatch, e);
861
- f && null != u && s.push(r && c > 0 && !tt(a) && !tt(l[c - 1]) ? "\n".concat(u) : u);
862
- }
863
- return s.join("\n");
864
- };
865
- }(t, n)(e);
866
- }
867
- //#endregion
868
- export { xe as $convertFromMarkdownString, Ce as $convertSelectionToMarkdownString, me as $convertToMarkdownString, Ot as BOLD_ITALIC_STAR, Mt as BOLD_ITALIC_UNDERSCORE, Rt as BOLD_STAR, Bt as BOLD_UNDERSCORE, kt as CHECK_LIST, bt as CODE, zt as ELEMENT_TRANSFORMERS, yt as HEADING, Lt as HIGHLIGHT, Ft as INLINE_CODE, jt as ITALIC_STAR, At as ITALIC_UNDERSCORE, Pt as LINK, Wt as MULTILINE_ELEMENT_TRANSFORMERS, Nt as ORDERED_LIST, St as QUOTE, _t as STRIKETHROUGH, Ut as TEXT_FORMAT_TRANSFORMERS, Dt as TEXT_MATCH_TRANSFORMERS, Ht as TRANSFORMERS, wt as UNORDERED_LIST, he as registerMarkdownShortcuts };