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