@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,8 +1,8 @@
1
- import { f as namedSignals, l as effect } from "./LexicalExtension.node-BVlcrgOx.mjs";
2
- import { $ as $isElementNode, $t as ElementNode, Bt as COMMAND_PRIORITY_LOW, Ct as $setPointFromCaret, Fr as shallowMergeConfig, L as $getNearestNodeFromDOMNode, Rt as COMMAND_PRIORITY_EDITOR, U as $getSelection, Vn as PASTE_COMMAND, _ as $createTextNode, at as $isNodeSelection, c as $copyNode, cr as defineExtension, dr as getNearestEditorFromDOMNode, er as TextNode, ft as $isTextNode, gt as $normalizeSelection__EXPERIMENTAL, ht as $normalizeCaret, ir as createCommand, it as $isLineBreakNode, jr as safeCast, k as $getChildCaret, n as $applyNodeReplacement, r as $caretFromPoint, rr as configExtension, st as $isRangeSelection, ut as $isSiblingCaret, vr as isDOMNode, wt as $setSelection, yt as $rewindSiblingCaret } from "./Lexical.node-fXM8Jp7p.mjs";
3
- import { a as CoreImportExtension, g as sel, o as DOMImportExtension, p as defineImportRule, t as $distributeInlineWrapper } from "./LexicalHtml.node-BvNF96jZ.mjs";
4
- import { d as addClassNamesToElement, g as objectKlassEquals, h as mergeRegister, l as $insertNodeToNearestRootAtCaret, p as isHTMLAnchorElement, r as $findMatchingParent } from "./LexicalUtils.node-j3Llm7Y3.mjs";
5
- //#region ../../node_modules/.pnpm/@lexical+link@0.45.0/node_modules/@lexical/link/dist/LexicalLink.prod.mjs
1
+ import { f as namedSignals, l as effect } from "./LexicalExtension.node-CMsupJZs.mjs";
2
+ import { $ as $insertNodeToNearestRootAtCaret, $n as PASTE_COMMAND, A as $getChildCaret, Ct as $normalizeCaret, Dt as $rewindSiblingCaret, Kr as isHTMLAnchorElement, Mt as $setSelection, R as $getNearestNodeFromDOMNode, Vr as isDOMNode, W as $getSelection, Yt as COMMAND_PRIORITY_LOW, _t as $isSiblingCaret, ai as safeCast, at as $isElementNode, b as $findMatchingParent, br as defineExtension, bt as $isTextNode, dn as ElementNode, dt as $isNodeSelection, fr as TextNode, gr as createCommand, hr as configExtension, i as $caretFromPoint, jr as getNearestEditorFromDOMNode, jt as $setPointFromCaret, l as $copyNode, li as shallowMergeConfig, n as $applyNodeReplacement, ni as mergeRegister, pr as addClassNamesToElement, pt as $isRangeSelection, qt as COMMAND_PRIORITY_EDITOR, ut as $isLineBreakNode, v as $createTextNode, wt as $normalizeSelection__EXPERIMENTAL } from "./Lexical.node-DnR_u_Ke.mjs";
3
+ import { c as DOMImportExtension, h as defineImportRule, s as CoreImportExtension, t as $distributeInlineWrapper, v as sel } from "./LexicalHtml.node-DagZUjQ_.mjs";
4
+ import { h as objectKlassEquals } from "./LexicalUtils.node-Ck74ludK.mjs";
5
+ //#region ../../node_modules/.pnpm/@lexical+link@0.46.0_typescript@6.0.3/node_modules/@lexical/link/dist/LexicalLink.prod.mjs
6
6
  /**
7
7
  * Copyright (c) Meta Platforms, Inc. and affiliates.
8
8
  *
@@ -34,26 +34,26 @@ var z = class z extends ElementNode {
34
34
  }
35
35
  constructor(t = "", e = {}, n) {
36
36
  super(n);
37
- const { target: r = null, rel: i = null, title: l = null } = e;
38
- this.__url = t, this.__target = r, this.__rel = i, this.__title = l;
37
+ const { target: r = null, rel: i = null, title: s = null } = e;
38
+ this.__url = t, this.__target = r, this.__rel = i, this.__title = s;
39
39
  }
40
40
  afterCloneFrom(t) {
41
41
  super.afterCloneFrom(t), this.__url = t.__url, this.__rel = t.__rel, this.__target = t.__target, this.__title = t.__title;
42
42
  }
43
- createDOM(e) {
44
- const n = document.createElement("a");
45
- return this.updateLinkDOM(null, n, e), addClassNamesToElement(n, e.theme.link), n;
43
+ createDOM(t) {
44
+ const e = document.createElement("a");
45
+ return this.updateLinkDOM(null, e, t), addClassNamesToElement(e, t.theme.link), e;
46
46
  }
47
- updateLinkDOM(t, n, r) {
48
- if (isHTMLAnchorElement(n)) {
49
- t && t.__url === this.__url || (n.href = this.sanitizeUrl(this.__url));
50
- for (const e of [
47
+ updateLinkDOM(t, e, n) {
48
+ if (isHTMLAnchorElement(e)) {
49
+ t && t.__url === this.__url || (e.href = this.sanitizeUrl(this.__url));
50
+ for (const n of [
51
51
  "target",
52
52
  "rel",
53
53
  "title"
54
54
  ]) {
55
- const r = `__${e}`, i = this[r];
56
- t && t[r] === i || (i ? n[e] = i : n.removeAttribute(e));
55
+ const r = `__${n}`, i = this[r];
56
+ t && t[r] === i || (i ? e[n] = i : e.removeAttribute(n));
57
57
  }
58
58
  }
59
59
  }
@@ -138,7 +138,7 @@ var z = class z extends ElementNode {
138
138
  extractWithChild(t, e, n) {
139
139
  if (!$isRangeSelection(e)) return !1;
140
140
  const r = e.anchor.getNode(), i = e.focus.getNode();
141
- return this.isParentOf(r) && this.isParentOf(i) && e.getTextContent().length > 0;
141
+ return (this.is(r) || this.isParentOf(r)) && (this.is(i) || this.isParentOf(i)) && e.getTextContent().length > 0;
142
142
  }
143
143
  isEmailURI() {
144
144
  return this.__url.startsWith("mailto:");
@@ -162,54 +162,54 @@ function H(t, e) {
162
162
  }
163
163
  function G(t) {
164
164
  const e = $getSelection();
165
- let n = null, i = null;
166
- function l() {
167
- $isRangeSelection(e) && (H(e.anchor, n), H(e.focus, i), $normalizeSelection__EXPERIMENTAL(e));
165
+ let n = null, r = null;
166
+ function i() {
167
+ $isRangeSelection(e) && (H(e.anchor, n), H(e.focus, r), $normalizeSelection__EXPERIMENTAL(e));
168
168
  }
169
- $isRangeSelection(e) && (n = j(e.anchor), i = j(e.focus));
170
- let s = !1;
169
+ $isRangeSelection(e) && (n = j(e.anchor), r = j(e.focus));
170
+ let o = !1;
171
171
  for (const e of $getChildCaret(t, "next")) {
172
172
  const n = e.origin;
173
173
  if ($isElementNode(n) && !n.isInline()) {
174
- const i = n.getChildren();
175
- if (i.length > 0) {
174
+ const r = n.getChildren();
175
+ if (r.length > 0) {
176
176
  const e = $copyNode(t);
177
- e.append(...i), n.append(e), s = !0;
177
+ e.append(...r), n.append(e), o = !0;
178
178
  }
179
179
  $insertNodeToNearestRootAtCaret(n, $rewindSiblingCaret(e), { $shouldSplit: () => !1 });
180
180
  }
181
181
  }
182
- function a(t, e, n) {
183
- const [r, i] = t, l = (t) => $isSiblingCaret(t) && t.origin.is(e);
184
- if (!l(r) && !l(i)) return t;
185
- const s = $normalizeCaret($getChildCaret(n, "next"));
186
- return [s, s.getFlipped()];
182
+ function u(t, e, n) {
183
+ const [r, i] = t, s = (t) => $isSiblingCaret(t) && t.origin.is(e);
184
+ if (!s(r) && !s(i)) return t;
185
+ const l = $normalizeCaret($getChildCaret(n, "next"));
186
+ return [l, l.getFlipped()];
187
187
  }
188
188
  if (t.isAttached()) {
189
189
  const e = t.getPreviousSibling();
190
- if (Q(e) && e.shouldMergeAdjacentLink(t)) return n && (n = a(n, e, t)), i && (i = a(i, e, t)), e.append(...t.getChildren()), t.remove(), void l();
191
- const r = t.getNextSibling();
192
- Q(r) && t.shouldMergeAdjacentLink(r) && (n && (n = a(n, t, r)), i && (i = a(i, t, r)), t.append(...r.getChildren()), r.remove(), s = !0);
190
+ if (Q(e) && e.shouldMergeAdjacentLink(t)) return n && (n = u(n, e, t)), r && (r = u(r, e, t)), e.append(...t.getChildren()), t.remove(), void i();
191
+ const s = t.getNextSibling();
192
+ Q(s) && t.shouldMergeAdjacentLink(s) && (n && (n = u(n, t, s)), r && (r = u(r, t, s)), t.append(...s.getChildren()), s.remove(), o = !0);
193
193
  }
194
- if (s) {
194
+ if (o) {
195
195
  if (!t.canBeEmpty() && t.isEmpty()) {
196
196
  const e = t.getParent();
197
197
  t.remove(), e && e.isEmpty() && e.remove();
198
198
  }
199
- l();
199
+ i();
200
200
  }
201
201
  }
202
202
  function Z(t) {
203
- let n = null;
203
+ let e = null;
204
204
  if (isHTMLAnchorElement(t)) {
205
- const e = t.textContent;
206
- (null !== e && "" !== e || t.children.length > 0) && (n = q(t.getAttribute("href") || "", {
205
+ const n = t.textContent;
206
+ (null !== n && "" !== n || t.children.length > 0) && (e = q(t.getAttribute("href") || "", {
207
207
  rel: t.getAttribute("rel"),
208
208
  target: t.getAttribute("target"),
209
209
  title: t.getAttribute("title")
210
210
  }));
211
211
  }
212
- return { node: n };
212
+ return { node: e };
213
213
  }
214
214
  function q(t = "", e) {
215
215
  return $applyNodeReplacement(new z(t, e));
@@ -283,7 +283,7 @@ function X(t = "", e) {
283
283
  function Y(t) {
284
284
  return t instanceof V;
285
285
  }
286
- const tt = createCommand("TOGGLE_LINK_COMMAND");
286
+ const tt = /* @__PURE__ */ createCommand("TOGGLE_LINK_COMMAND");
287
287
  function et(t, e) {
288
288
  if ("element" === t.type) {
289
289
  const n = t.getNode();
@@ -298,30 +298,30 @@ function et(t, e) {
298
298
  return null;
299
299
  }
300
300
  function nt(t, e = {}) {
301
- let r;
301
+ let n;
302
302
  if (t && "object" == typeof t) {
303
- const { url: n, ...i } = t;
304
- r = n, e = {
303
+ const { url: r, ...i } = t;
304
+ n = r, e = {
305
305
  ...i,
306
306
  ...e
307
307
  };
308
- } else r = t;
309
- const { target: i, title: l } = e, s = void 0 === e.rel ? "noreferrer" : e.rel, a = $getSelection();
310
- if (null === a || !$isRangeSelection(a) && !$isNodeSelection(a)) return;
311
- if ($isNodeSelection(a)) {
312
- const t = a.getNodes();
308
+ } else n = t;
309
+ const { target: r, title: i } = e, o = void 0 === e.rel ? "noreferrer" : e.rel, u = $getSelection();
310
+ if (null === u || !$isRangeSelection(u) && !$isNodeSelection(u)) return;
311
+ if ($isNodeSelection(u)) {
312
+ const t = u.getNodes();
313
313
  if (0 === t.length) return;
314
314
  t.forEach((t) => {
315
- if (null === r) {
315
+ if (null === n) {
316
316
  const e = $findMatchingParent(t, (t) => !Y(t) && Q(t));
317
317
  e && (e.insertBefore(t), 0 === e.getChildren().length && e.remove());
318
318
  } else {
319
319
  const e = $findMatchingParent(t, (t) => !Y(t) && Q(t));
320
- if (e) e.setURL(r), void 0 !== i && e.setTarget(i), void 0 !== s && e.setRel(s);
320
+ if (e) e.setURL(n), void 0 !== r && e.setTarget(r), void 0 !== o && e.setRel(o);
321
321
  else {
322
- const e = q(r, {
323
- rel: s,
324
- target: i
322
+ const e = q(n, {
323
+ rel: o,
324
+ target: r
325
325
  });
326
326
  t.insertBefore(e), e.append(t);
327
327
  }
@@ -329,23 +329,23 @@ function nt(t, e = {}) {
329
329
  });
330
330
  return;
331
331
  }
332
- if (a.isCollapsed() && null === r) for (const t of a.getNodes()) {
332
+ if (u.isCollapsed() && null === n) for (const t of u.getNodes()) {
333
333
  const e = $findMatchingParent(t, (t) => !Y(t) && Q(t));
334
334
  null !== e && (e.getParentOrThrow().splice(e.getIndexWithinParent(), 0, e.getChildren()), e.remove());
335
335
  return;
336
336
  }
337
- const c = a.extract();
338
- if (null === r) {
337
+ const h = u.extract();
338
+ if (null === n) {
339
339
  const t = /* @__PURE__ */ new Set();
340
- c.forEach((e) => {
341
- const r = $findMatchingParent(e, (t) => !Y(t) && Q(t));
342
- if (null !== r) {
343
- const e = r.getKey();
340
+ h.forEach((e) => {
341
+ const n = $findMatchingParent(e, (t) => !Y(t) && Q(t));
342
+ if (null !== n) {
343
+ const e = n.getKey();
344
344
  if (t.has(e)) return;
345
345
  (function(t, e) {
346
346
  const n = new Set(e.filter((e) => t.isParentOf(e)).map((t) => t.getKey())), r = t.getChildren(), i = (r) => n.has(r.getKey()) || $isElementNode(r) && e.some((e) => t.isParentOf(e) && r.isParentOf(e)), l = r.filter(i);
347
347
  if (l.length === r.length) return r.forEach((e) => t.insertBefore(e)), void t.remove();
348
- const s = r.findIndex(i), u = r.findLastIndex(i), a = 0 === s, c = u === r.length - 1;
348
+ const o = r.findIndex(i), u = r.findLastIndex(i), a = 0 === o, c = u === r.length - 1;
349
349
  if (a) l.forEach((e) => t.insertBefore(e));
350
350
  else if (c) for (let e = l.length - 1; e >= 0; e--) t.insertAfter(l[e]);
351
351
  else {
@@ -356,24 +356,24 @@ function nt(t, e = {}) {
356
356
  l[l.length - 1].insertAfter(n), e.forEach((t) => n.append(t));
357
357
  }
358
358
  }
359
- })(r, c), t.add(e);
359
+ })(n, h), t.add(e);
360
360
  }
361
361
  });
362
362
  return;
363
363
  }
364
- const p = /* @__PURE__ */ new Set(), m = (t) => {
365
- p.has(t.getKey()) || (p.add(t.getKey()), t.setURL(r), void 0 !== i && t.setTarget(i), void 0 !== s && t.setRel(s), void 0 !== l && t.setTitle(l));
364
+ const _ = /* @__PURE__ */ new Set(), m = (t) => {
365
+ _.has(t.getKey()) || (_.add(t.getKey()), t.setURL(n), void 0 !== r && t.setTarget(r), void 0 !== o && t.setRel(o), void 0 !== i && t.setTitle(i));
366
366
  };
367
- if (1 === c.length) {
368
- const t = c[0], e = $findMatchingParent(t, Q);
367
+ if (1 === h.length) {
368
+ const t = h[0], e = $findMatchingParent(t, Q);
369
369
  if (null !== e) return m(e);
370
370
  }
371
371
  (function(t) {
372
372
  const e = $getSelection();
373
373
  if (!$isRangeSelection(e)) return t();
374
- const n = $normalizeSelection__EXPERIMENTAL(e), r = n.isBackward(), i = et(n.anchor, r ? -1 : 0), l = et(n.focus, r ? 0 : -1);
374
+ const n = $normalizeSelection__EXPERIMENTAL(e), r = n.isBackward(), i = et(n.anchor, r ? -1 : 0), s = et(n.focus, r ? 0 : -1);
375
375
  t();
376
- if (i || l) {
376
+ if (i || s) {
377
377
  const t = $getSelection();
378
378
  if ($isRangeSelection(t)) {
379
379
  const e = t.clone();
@@ -381,20 +381,20 @@ function nt(t, e = {}) {
381
381
  const t = i.getParent();
382
382
  t && e.anchor.set(t.getKey(), i.getIndexWithinParent() + (r ? 1 : 0), "element");
383
383
  }
384
- if (l) {
385
- const t = l.getParent();
386
- t && e.focus.set(t.getKey(), l.getIndexWithinParent() + (r ? 0 : 1), "element");
384
+ if (s) {
385
+ const t = s.getParent();
386
+ t && e.focus.set(t.getKey(), s.getIndexWithinParent() + (r ? 0 : 1), "element");
387
387
  }
388
388
  $setSelection($normalizeSelection__EXPERIMENTAL(e));
389
389
  }
390
390
  }
391
391
  })(() => {
392
392
  let t = null;
393
- for (const e of c) {
393
+ for (const e of h) {
394
394
  if (!e.isAttached()) continue;
395
- const o = $findMatchingParent(e, Q);
396
- if (o) {
397
- m(o);
395
+ const s = $findMatchingParent(e, Q);
396
+ if (s) {
397
+ m(s);
398
398
  continue;
399
399
  }
400
400
  if ($isElementNode(e)) {
@@ -409,11 +409,11 @@ function nt(t, e = {}) {
409
409
  continue;
410
410
  }
411
411
  }
412
- const u = e.getPreviousSibling();
413
- Q(u) && u.is(t) ? u.append(e) : (t = q(r, {
414
- rel: s,
415
- target: i,
416
- title: l
412
+ const l = e.getPreviousSibling();
413
+ Q(l) && l.is(t) ? l.append(e) : (t = q(n, {
414
+ rel: o,
415
+ target: r,
416
+ title: i
417
417
  }), e.insertAfter(t), t.append(e));
418
418
  }
419
419
  });
@@ -422,42 +422,57 @@ const rt = /^\+?[0-9\s()-]{5,}$/;
422
422
  function it(t) {
423
423
  return t.match(/^[a-z][a-z0-9+.-]*:/i) || t.match(/^[/#.]/) ? t : t.includes("@") ? `mailto:${t}` : rt.test(t) ? `tel:${t}` : `https://${t}`;
424
424
  }
425
- function lt(t, e) {
425
+ const st = [/* @__PURE__ */ defineImportRule({
426
+ $import: (t, e) => {
427
+ if (!e.textContent && 0 === e.children.length) return [];
428
+ const n = e.getAttribute("href") || "", r = {
429
+ rel: e.getAttribute("rel"),
430
+ target: e.getAttribute("target"),
431
+ title: e.getAttribute("title")
432
+ };
433
+ return $distributeInlineWrapper(t.$importChildren(e), () => q(n, r));
434
+ },
435
+ match: sel.tag("a"),
436
+ name: "@lexical/link/a"
437
+ })];
438
+ function lt(t, n) {
426
439
  return mergeRegister(t.registerNodeTransform(z, G), t.registerCommand(tt, (t) => {
427
- const n = e.validateUrl.peek(), r = e.attributes.peek();
440
+ const e = n.validateUrl.peek(), r = n.attributes.peek();
428
441
  if (null === t) return nt(null), !0;
429
- if ("string" == typeof t) return !(void 0 !== n && !n(t)) && (nt(t, r), !0);
442
+ if ("string" == typeof t) return !(void 0 !== e && !e(t)) && (nt(t, r), !0);
430
443
  {
431
- const { url: e, target: n, rel: i, title: l } = t;
444
+ const { url: e, target: n, rel: i, title: s } = t;
432
445
  return nt(e, {
433
446
  ...r,
434
447
  rel: i,
435
448
  target: n,
436
- title: l
449
+ title: s
437
450
  }), !0;
438
451
  }
439
452
  }, COMMAND_PRIORITY_EDITOR), effect(() => {
440
- const n = e.validateUrl.value;
441
- if (!n) return;
442
- const r = e.attributes.value;
443
- return t.registerCommand(PASTE_COMMAND, (e) => {
453
+ const e = n.validateUrl.value;
454
+ if (!e) return;
455
+ const r = n.attributes.value;
456
+ return t.registerCommand(PASTE_COMMAND, (n) => {
444
457
  const i = $getSelection();
445
- if (!$isRangeSelection(i) || i.isCollapsed() || !objectKlassEquals(e, ClipboardEvent)) return !1;
446
- if (null === e.clipboardData) return !1;
447
- const s = e.clipboardData.getData("text");
448
- return !!n(s) && !i.getNodes().some((t) => $isElementNode(t)) && (t.dispatchCommand(tt, {
458
+ if (!$isRangeSelection(i) || i.isCollapsed() || !objectKlassEquals(n, ClipboardEvent)) return !1;
459
+ if (null === n.clipboardData) return !1;
460
+ const s = n.clipboardData.getData("text");
461
+ if (!e(s)) return !1;
462
+ return !i.getNodes().some((t) => $isElementNode(t) || $isTextNode(t) && !t.isSimpleText()) && (t.dispatchCommand(tt, {
449
463
  ...r,
450
464
  url: s
451
- }), e.preventDefault(), !0);
465
+ }), n.preventDefault(), !0);
452
466
  }, COMMAND_PRIORITY_LOW);
453
467
  }));
454
468
  }
455
- const st = defineExtension({
456
- build: (t, e, n) => namedSignals(e),
469
+ const ot = /* @__PURE__ */ defineExtension({
470
+ build: (e, n, r) => namedSignals(n),
457
471
  config: {
458
472
  attributes: void 0,
459
473
  validateUrl: void 0
460
474
  },
475
+ dependencies: [CoreImportExtension, /* @__PURE__ */ configExtension(DOMImportExtension, { rules: st })],
461
476
  mergeConfig(t, e) {
462
477
  const n = shallowMergeConfig(t, e);
463
478
  return t.attributes && (n.attributes = shallowMergeConfig(t.attributes, n.attributes)), n;
@@ -465,19 +480,22 @@ const st = defineExtension({
465
480
  name: "@lexical/link/Link",
466
481
  nodes: () => [z],
467
482
  register: (t, e, n) => lt(t, n.getOutput())
483
+ }), ut = /* @__PURE__ */ defineExtension({
484
+ dependencies: [ot],
485
+ name: "@lexical/link/Import"
468
486
  });
469
- function ot(t, r, i = {}) {
470
- const l = (i) => {
471
- const l = i.target;
472
- if (!isDOMNode(l)) return;
473
- const s = getNearestEditorFromDOMNode(l);
487
+ function at(t, e, n = {}) {
488
+ const r = (n) => {
489
+ const r = n.target;
490
+ if (!isDOMNode(r)) return;
491
+ const s = getNearestEditorFromDOMNode(r);
474
492
  if (null === s) return;
475
- let o = null, a = null;
493
+ let o = null, u = null;
476
494
  if (s.update(() => {
477
- const t = $getNearestNodeFromDOMNode(l);
495
+ const t = $getNearestNodeFromDOMNode(r);
478
496
  if (null !== t) {
479
- const i = $findMatchingParent(t, $isElementNode);
480
- if (!r.disabled.peek()) if (Q(i)) o = i.sanitizeUrl(i.getURL()), a = i.getTarget();
497
+ const n = $findMatchingParent(t, $isElementNode);
498
+ if (!e.disabled.peek()) if (Q(n)) o = n.sanitizeUrl(n.getURL()), u = n.getTarget();
481
499
  else {
482
500
  const t = function(t, e) {
483
501
  let n = t;
@@ -486,35 +504,35 @@ function ot(t, r, i = {}) {
486
504
  n = n.parentNode;
487
505
  }
488
506
  return null;
489
- }(l, isHTMLAnchorElement);
490
- null !== t && (o = t.href, a = t.target);
507
+ }(r, isHTMLAnchorElement);
508
+ null !== t && (o = t.href, u = t.target);
491
509
  }
492
510
  }
493
511
  }), null === o || "" === o) return;
494
- const c = t.getEditorState().read($getSelection, { editor: t });
495
- if ($isRangeSelection(c) && !c.isCollapsed()) return void i.preventDefault();
496
- const f = "auxclick" === i.type && 1 === i.button;
497
- window.open(o, r.newTab.peek() || f || i.metaKey || i.ctrlKey || "_blank" === a ? "_blank" : "_self"), i.preventDefault();
512
+ const c = t.read("latest", $getSelection);
513
+ if ($isRangeSelection(c) && !c.isCollapsed()) return void n.preventDefault();
514
+ const f = "auxclick" === n.type && 1 === n.button;
515
+ window.open(o, e.newTab.peek() || f || n.metaKey || n.ctrlKey || "_blank" === u ? "_blank" : "_self"), n.preventDefault();
498
516
  }, s = (t) => {
499
- 1 === t.button && l(t);
517
+ 1 === t.button && r(t);
500
518
  };
501
519
  return t.registerRootListener((t) => {
502
- if (t) return t.addEventListener("click", l, i), t.addEventListener("mouseup", s, i), () => {
503
- t.removeEventListener("click", l), t.removeEventListener("mouseup", s);
520
+ if (t) return t.addEventListener("click", r, n), t.addEventListener("mouseup", s, n), () => {
521
+ t.removeEventListener("click", r), t.removeEventListener("mouseup", s);
504
522
  };
505
523
  });
506
524
  }
507
- const ut = defineExtension({
508
- build: (t, e, n) => namedSignals(e),
509
- config: safeCast({
525
+ const ct = /* @__PURE__ */ defineExtension({
526
+ build: (e, n, r) => namedSignals(n),
527
+ config: /* @__PURE__ */ safeCast({
510
528
  disabled: !1,
511
529
  newTab: !1
512
530
  }),
513
- dependencies: [st],
531
+ dependencies: [ot],
514
532
  name: "@lexical/link/ClickableLink",
515
- register: (t, e, n) => ot(t, n.getOutput())
533
+ register: (t, e, n) => at(t, n.getOutput())
516
534
  });
517
- function at(t, e = (t) => t) {
535
+ function gt(t, e = (t) => t) {
518
536
  return (n) => {
519
537
  const r = t.exec(n);
520
538
  return null === r ? null : {
@@ -525,86 +543,86 @@ function at(t, e = (t) => t) {
525
543
  };
526
544
  };
527
545
  }
528
- function ct(t, e) {
546
+ function ft(t, e) {
529
547
  for (let n = 0; n < e.length; n++) {
530
548
  const r = e[n](t);
531
549
  if (r) return r;
532
550
  }
533
551
  return null;
534
552
  }
535
- const gt = /[.,;\s]/;
536
- function ft(t, e) {
553
+ const dt = /[.,;\s]/;
554
+ function ht(t, e) {
537
555
  return e.test(t);
538
556
  }
539
- function dt(t, e) {
540
- return ft(t[t.length - 1], e);
557
+ function pt(t, e) {
558
+ return ht(t[t.length - 1], e);
541
559
  }
542
- function ht(t, e) {
543
- return ft(t[0], e);
560
+ function _t(t, e) {
561
+ return ht(t[0], e);
544
562
  }
545
- function pt(t, e) {
563
+ function mt(t, e) {
546
564
  let n = t.getPreviousSibling();
547
- return $isElementNode(n) && (n = n.getLastDescendant()), null === n || $isLineBreakNode(n) || $isTextNode(n) && dt(n.getTextContent(), e);
565
+ return $isElementNode(n) && (n = n.getLastDescendant()), null === n || $isLineBreakNode(n) || $isTextNode(n) && pt(n.getTextContent(), e);
548
566
  }
549
- function _t(t, e) {
567
+ function xt(t, e) {
550
568
  let n = t.getNextSibling();
551
- return $isElementNode(n) && (n = n.getFirstDescendant()), null === n || $isLineBreakNode(n) || $isTextNode(n) && ht(n.getTextContent(), e);
569
+ return $isElementNode(n) && (n = n.getFirstDescendant()), null === n || $isLineBreakNode(n) || $isTextNode(n) && _t(n.getTextContent(), e);
552
570
  }
553
- function mt(t, e, n, r, i) {
554
- if (!(t > 0 ? ft(r[t - 1], n) : pt(i[0], n))) return !1;
555
- return e < r.length ? ft(r[e], n) : _t(i[i.length - 1], n);
571
+ function kt(t, e, n, r, i) {
572
+ if (!(t > 0 ? ht(r[t - 1], n) : mt(i[0], n))) return !1;
573
+ return e < r.length ? ht(r[e], n) : xt(i[i.length - 1], n);
556
574
  }
557
- function xt(t, e, n) {
558
- const r = [], i = [], l = [];
559
- let s = 0, o = 0;
575
+ function bt(t, e, n) {
576
+ const r = [], i = [], s = [];
577
+ let l = 0, o = 0;
560
578
  const u = [...t];
561
579
  for (; u.length > 0;) {
562
580
  const t = u[0], a = t.getTextContent().length, c = o;
563
- o + a <= e ? (r.push(t), s += a) : c >= n ? l.push(t) : i.push(t), o += a, u.shift();
581
+ o + a <= e ? (r.push(t), l += a) : c >= n ? s.push(t) : i.push(t), o += a, u.shift();
564
582
  }
565
583
  return [
566
- s,
584
+ l,
567
585
  r,
568
586
  i,
569
- l
587
+ s
570
588
  ];
571
589
  }
572
- function kt(t, e, n, r) {
590
+ function vt(t, e, n, r) {
573
591
  const i = X(r.url, r.attributes);
574
592
  if (1 === t.length) {
575
- let l, s = t[0];
576
- 0 === e ? [l, s] = s.splitText(n) : [, l, s] = s.splitText(e, n);
593
+ let s, l = t[0];
594
+ 0 === e ? [s, l] = l.splitText(n) : [, s, l] = l.splitText(e, n);
577
595
  const o = $createTextNode(r.text);
578
- return o.setFormat(l.getFormat()), o.setDetail(l.getDetail()), o.setStyle(l.getStyle()), i.append(o), l.replace(i), s;
596
+ return o.setFormat(s.getFormat()), o.setDetail(s.getDetail()), o.setStyle(s.getStyle()), i.append(o), s.replace(i), l;
579
597
  }
580
598
  if (t.length > 1) {
581
599
  const r = t[0];
582
- let l, s = r.getTextContent().length;
583
- 0 === e ? l = r : [, l] = r.splitText(e);
584
- const o = [];
585
- let a;
600
+ let s, o = r.getTextContent().length;
601
+ 0 === e ? s = r : [, s] = r.splitText(e);
602
+ const u = [];
603
+ let g;
586
604
  for (let e = 1; e < t.length; e++) {
587
- const r = t[e], i = r.getTextContent().length, l = s;
588
- if (l < n) if (s + i <= n) o.push(r);
605
+ const r = t[e], i = r.getTextContent().length, s = o;
606
+ if (s < n) if (o + i <= n) u.push(r);
589
607
  else {
590
- const [t, e] = r.splitText(n - l);
591
- o.push(t), a = e;
608
+ const [t, e] = r.splitText(n - s);
609
+ u.push(t), g = e;
592
610
  }
593
- s += i;
611
+ o += i;
594
612
  }
595
- const c = $getSelection(), d = c ? c.getNodes().find($isTextNode) : void 0, h = $createTextNode(l.getTextContent());
596
- return h.setFormat(l.getFormat()), h.setDetail(l.getDetail()), h.setStyle(l.getStyle()), i.append(h, ...o), d && d === l && ($isRangeSelection(c) ? h.select(c.anchor.offset, c.focus.offset) : $isNodeSelection(c) && h.select(0, h.getTextContent().length)), l.replace(i), a;
613
+ const f = $getSelection(), d = f ? f.getNodes().find($isTextNode) : void 0, h = $createTextNode(s.getTextContent());
614
+ return h.setFormat(s.getFormat()), h.setDetail(s.getDetail()), h.setStyle(s.getStyle()), i.append(h, ...u), d && d === s && ($isRangeSelection(f) ? h.select(f.anchor.offset, f.focus.offset) : $isNodeSelection(f) && h.select(0, h.getTextContent().length)), s.replace(i), g;
597
615
  }
598
616
  }
599
- function bt(t, e, n, r) {
600
- const i = t.getChildren(), l = i.length;
601
- for (let e = 0; e < l; e++) {
617
+ function Ut(t, e, n, r) {
618
+ const i = t.getChildren(), s = i.length;
619
+ for (let e = 0; e < s; e++) {
602
620
  const r = i[e];
603
- if (!$isTextNode(r) || !r.isSimpleText()) return vt(t), void n(null, t.getURL());
621
+ if (!$isTextNode(r) || !r.isSimpleText()) return Tt(t), void n(null, t.getURL());
604
622
  }
605
- const s = t.getTextContent(), o = ct(s, e);
606
- if (null === o || o.text !== s) return vt(t), void n(null, t.getURL());
607
- if (!pt(t, r) || !_t(t, r)) return vt(t), void n(null, t.getURL());
623
+ const l = t.getTextContent(), o = ft(l, e);
624
+ if (null === o || o.text !== l) return Tt(t), void n(null, t.getURL());
625
+ if (!mt(t, r) || !xt(t, r)) return Tt(t), void n(null, t.getURL());
608
626
  const u = t.getURL();
609
627
  if (u !== o.url && (t.setURL(o.url), n(o.url, u)), o.attributes) {
610
628
  const e = t.getRel();
@@ -613,39 +631,39 @@ function bt(t, e, n, r) {
613
631
  r !== o.attributes.target && (t.setTarget(o.attributes.target || null), n(o.attributes.target || null, r));
614
632
  }
615
633
  }
616
- function vt(t) {
634
+ function Tt(t) {
617
635
  const e = t.getChildren();
618
636
  for (let n = e.length - 1; n >= 0; n--) t.insertAfter(e[n]);
619
637
  return t.remove(), e.map((t) => t.getLatest());
620
638
  }
621
- const Ut = {
639
+ const Ct = {
622
640
  changeHandlers: [],
623
641
  excludeParents: [],
624
642
  matchers: [],
625
- separatorRegex: gt
643
+ separatorRegex: dt
626
644
  };
627
- function Tt(t, e = Ut) {
628
- const { matchers: n, changeHandlers: r, excludeParents: l, separatorRegex: s = gt } = e, o = (t, e) => {
645
+ function Lt(t, e = Ct) {
646
+ const { matchers: n, changeHandlers: r, excludeParents: i, separatorRegex: s = dt } = e, o = (t, e) => {
629
647
  for (const n of r) n(t, e);
630
648
  };
631
649
  return mergeRegister(t.registerNodeTransform(TextNode, (t) => {
632
650
  const e = t.getParentOrThrow(), r = t.getPreviousSibling();
633
- if (Y(e)) bt(e, n, o, s);
634
- else if (!Q(e) && !l.some((t) => t(e))) {
635
- if (t.isSimpleText() && (ht(t.getTextContent(), s) || !Y(r))) (function(t, e, n, r) {
651
+ if (Y(e)) Ut(e, n, o, s);
652
+ else if (!Q(e) && !i.some((t) => t(e))) {
653
+ if (t.isSimpleText() && (_t(t.getTextContent(), s) || !Y(r))) (function(t, e, n, r) {
636
654
  for (const e of t) {
637
655
  const t = e.getParent();
638
656
  if (Y(t) && !t.getIsUnlinked()) return;
639
657
  }
640
658
  let i = [...t];
641
- const l = i.map((t) => t.getTextContent()).join("");
642
- let s, o = l, u = 0;
643
- for (; (s = ct(o, e)) && null !== s;) {
644
- const t = s.index, e = t + s.length;
645
- if (mt(u + t, u + e, r, l, i)) {
646
- const [r, , l, a] = xt(i, u + t, u + e);
659
+ const s = i.map((t) => t.getTextContent()).join("");
660
+ let l, o = s, u = 0;
661
+ for (; (l = ft(o, e)) && null !== l;) {
662
+ const t = l.index, e = t + l.length;
663
+ if (kt(u + t, u + e, r, s, i)) {
664
+ const [r, , s, a] = bt(i, u + t, u + e);
647
665
  let c = !1;
648
- for (const t of l) {
666
+ for (const t of s) {
649
667
  const e = t.getParent();
650
668
  if (Y(e) && !e.getIsUnlinked()) {
651
669
  c = !0;
@@ -656,8 +674,8 @@ function Tt(t, e = Ut) {
656
674
  u += e, o = o.substring(e);
657
675
  continue;
658
676
  }
659
- const g = kt(l, u + t - r, u + e - r, s);
660
- i = g ? [g, ...a] : a, n(s.url, null), u = 0;
677
+ const g = vt(s, u + t - r, u + e - r, l);
678
+ i = g ? [g, ...a] : a, n(l.url, null), u = 0;
661
679
  } else u += e;
662
680
  o = o.substring(e);
663
681
  }
@@ -668,17 +686,17 @@ function Tt(t, e = Ut) {
668
686
  return e;
669
687
  }(t), n, o, s);
670
688
  (function(t, e, n, r) {
671
- const i = t.getParent(), l = t.getPreviousSibling(), s = t.getNextSibling(), o = t.getTextContent();
689
+ const i = t.getParent(), s = t.getPreviousSibling(), l = t.getNextSibling(), o = t.getTextContent();
672
690
  if (!Y(i) || i.getIsUnlinked()) {
673
- if (Y(l) && !l.getIsUnlinked() && l.is(t.getPreviousSibling()) && t.getParent() === l.getParent()) {
674
- if (!ht(o, r)) return vt(l), void n(null, l.getURL());
675
- if (u = o, l.isEmailURI() ? /^\.[a-zA-Z]{2,}/.test(u) : /^\.[a-zA-Z0-9]{1,}/.test(u)) {
676
- const i = l.getTextContent() + o, s = ct(i, e);
677
- null !== s && s.text === i && (l.append(t), bt(l, e, n, r), n(null, l.getURL()));
691
+ if (Y(s) && !s.getIsUnlinked() && s.is(t.getPreviousSibling()) && t.getParent() === s.getParent()) {
692
+ if (!_t(o, r)) return Tt(s), void n(null, s.getURL());
693
+ if (u = o, s.isEmailURI() ? /^\.[a-zA-Z]{2,}/.test(u) : /^\.[a-zA-Z0-9]{1,}/.test(u)) {
694
+ const i = s.getTextContent() + o, l = ft(i, e);
695
+ null !== l && l.text === i && (s.append(t), Ut(s, e, n, r), n(null, s.getURL()));
678
696
  }
679
697
  }
680
698
  var u;
681
- !Y(s) || s.getIsUnlinked() || dt(o, r) || s.is(t.getNextSibling()) && t.getParent() === s.getParent() && (vt(s), n(null, s.getURL()));
699
+ !Y(l) || l.getIsUnlinked() || pt(o, r) || l.is(t.getNextSibling()) && t.getParent() === l.getParent() && (Tt(l), n(null, l.getURL()));
682
700
  }
683
701
  })(t, n, o, s);
684
702
  }
@@ -691,9 +709,9 @@ function Tt(t, e = Ut) {
691
709
  }), !1;
692
710
  }, COMMAND_PRIORITY_LOW));
693
711
  }
694
- const Ct = defineExtension({
695
- config: Ut,
696
- dependencies: [st],
712
+ const St = /* @__PURE__ */ defineExtension({
713
+ config: Ct,
714
+ dependencies: [ot],
697
715
  mergeConfig(t, e) {
698
716
  const n = shallowMergeConfig(t, e);
699
717
  for (const r of [
@@ -708,26 +726,7 @@ const Ct = defineExtension({
708
726
  },
709
727
  name: "@lexical/link/AutoLink",
710
728
  nodes: [V],
711
- register: Tt
712
- }), Lt = [defineImportRule({
713
- $import: (t, e) => {
714
- if (!e.textContent && 0 === e.children.length) return [];
715
- const n = e.getAttribute("href") || "", r = {
716
- rel: e.getAttribute("rel"),
717
- target: e.getAttribute("target"),
718
- title: e.getAttribute("title")
719
- };
720
- return $distributeInlineWrapper(t.$importChildren(e), () => q(n, r));
721
- },
722
- match: sel.tag("a"),
723
- name: "@lexical/link/a"
724
- })], St = defineExtension({
725
- dependencies: [
726
- CoreImportExtension,
727
- st,
728
- configExtension(DOMImportExtension, { rules: Lt })
729
- ],
730
- name: "@lexical/link/Import"
731
- }), Ot = nt;
729
+ register: Lt
730
+ });
732
731
  //#endregion
733
- export { X as $createAutoLinkNode, q as $createLinkNode, Y as $isAutoLinkNode, Q as $isLinkNode, nt as $toggleLink, Ct as AutoLinkExtension, V as AutoLinkNode, ut as ClickableLinkExtension, st as LinkExtension, St as LinkImportExtension, Lt as LinkImportRules, z as LinkNode, tt as TOGGLE_LINK_COMMAND, at as createLinkMatcherWithRegExp, it as formatUrl, Tt as registerAutoLink, ot as registerClickableLink, lt as registerLink, Ot as toggleLink };
732
+ export { X as $createAutoLinkNode, q as $createLinkNode, Y as $isAutoLinkNode, Q as $isLinkNode, nt as $toggleLink, St as AutoLinkExtension, V as AutoLinkNode, ct as ClickableLinkExtension, ot as LinkExtension, ut as LinkImportExtension, st as LinkImportRules, z as LinkNode, tt as TOGGLE_LINK_COMMAND, gt as createLinkMatcherWithRegExp, it as formatUrl, Lt as registerAutoLink, at as registerClickableLink, lt as registerLink };