@pie-element/shared-editor-runtime 0.1.2 → 0.1.3-next.20261019151920

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 (45) hide show
  1. package/dist/browser/{dist-CbvLhouk.js → dist-1Ah9gEL8.js} +315 -290
  2. package/dist/browser/dist-1Ah9gEL8.js.map +1 -0
  3. package/dist/browser/{dist-Pg4oVkv2.js → dist-BVA3Sgbc.js} +66 -57
  4. package/dist/browser/dist-BVA3Sgbc.js.map +1 -0
  5. package/dist/browser/{dist-BLT2aMxu.js → dist-C2dWnbCz.js} +9 -18
  6. package/dist/browser/dist-C2dWnbCz.js.map +1 -0
  7. package/dist/browser/{dist-DwhlRAyY.js → dist-COqKtKEY.js} +27 -20
  8. package/dist/browser/dist-COqKtKEY.js.map +1 -0
  9. package/dist/browser/{dist-CJhbhuk0.js → dist-C_bRf4Tj.js} +17 -17
  10. package/dist/browser/dist-C_bRf4Tj.js.map +1 -0
  11. package/dist/browser/prosemirror-state/index.js +1 -2
  12. package/dist/browser/tiptap-core/index.js +1 -2
  13. package/dist/browser/tiptap-extension-character-count/index.js +1 -1
  14. package/dist/browser/tiptap-extension-character-count/index.js.map +1 -1
  15. package/dist/browser/tiptap-extension-image/index.js +6 -10
  16. package/dist/browser/tiptap-extension-image/index.js.map +1 -1
  17. package/dist/browser/tiptap-extension-list-item/index.js +1 -1
  18. package/dist/browser/tiptap-extension-list-item/index.js.map +1 -1
  19. package/dist/browser/tiptap-extension-placeholder/index.js +1 -1
  20. package/dist/browser/tiptap-extension-placeholder/index.js.map +1 -1
  21. package/dist/browser/tiptap-extension-subscript/index.js +1 -1
  22. package/dist/browser/tiptap-extension-subscript/index.js.map +1 -1
  23. package/dist/browser/tiptap-extension-superscript/index.js +1 -1
  24. package/dist/browser/tiptap-extension-superscript/index.js.map +1 -1
  25. package/dist/browser/tiptap-extension-table/index.js +1 -2
  26. package/dist/browser/tiptap-extension-table-cell/index.js +1 -1
  27. package/dist/browser/tiptap-extension-table-cell/index.js.map +1 -1
  28. package/dist/browser/tiptap-extension-table-header/index.js +1 -1
  29. package/dist/browser/tiptap-extension-table-header/index.js.map +1 -1
  30. package/dist/browser/tiptap-extension-table-row/index.js +1 -1
  31. package/dist/browser/tiptap-extension-table-row/index.js.map +1 -1
  32. package/dist/browser/tiptap-extension-text-align/index.js +1 -1
  33. package/dist/browser/tiptap-extension-text-align/index.js.map +1 -1
  34. package/dist/browser/tiptap-extension-text-style/index.js +1 -1
  35. package/dist/browser/tiptap-extension-text-style/index.js.map +1 -1
  36. package/dist/browser/tiptap-extensions/index.js +1 -2
  37. package/dist/browser/tiptap-pm-state/index.js +1 -2
  38. package/dist/browser/tiptap-starter-kit/index.js +6 -14
  39. package/dist/browser/tiptap-starter-kit/index.js.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/browser/dist-BLT2aMxu.js.map +0 -1
  42. package/dist/browser/dist-CJhbhuk0.js.map +0 -1
  43. package/dist/browser/dist-CbvLhouk.js.map +0 -1
  44. package/dist/browser/dist-DwhlRAyY.js.map +0 -1
  45. package/dist/browser/dist-Pg4oVkv2.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { C as e, D as t, E as n, O as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, k as h, m as g, n as _, o as v, p as y, r as b, t as x, u as ee, v as S, w as C, x as te, y as w } from "./dist-Pg4oVkv2.js";
1
+ import { C as e, D as t, E as n, O as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, k as h, m as g, n as _, o as v, p as y, r as b, t as x, u as ee, v as S, w as C, x as te, y as w } from "./dist-BVA3Sgbc.js";
2
2
  //#region ../../../node_modules/.bun/@tiptap+core@3.31.4+15378246f3975c2e/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
3
3
  var ne = Object.defineProperty, re = (e, t) => {
4
4
  let n = {};
@@ -7,7 +7,7 @@ var ne = Object.defineProperty, re = (e, t) => {
7
7
  enumerable: !0
8
8
  });
9
9
  return t || ne(n, Symbol.toStringTag, { value: "Module" }), n;
10
- }, ie = (e, t) => e.selection.empty ? !1 : (t && t(e.tr.deleteSelection().scrollIntoView()), !0);
10
+ }, ie = (e, t) => !e.selection.empty && (t && t(e.tr.deleteSelection().scrollIntoView()), !0);
11
11
  function ae(e, t) {
12
12
  let { $cursor: n } = e.selection;
13
13
  return !n || (t ? !t.endOfTextblock("backward", e) : n.parentOffset > 0) ? null : n;
@@ -18,7 +18,7 @@ var oe = (e, t, n) => {
18
18
  let i = fe(r);
19
19
  if (!i) {
20
20
  let n = r.blockRange(), i = n && c(n);
21
- return i == null ? !1 : (t && t(e.tr.lift(n, i).scrollIntoView()), !0);
21
+ return i != null && (t && t(e.tr.lift(n, i).scrollIntoView()), !0);
22
22
  }
23
23
  let a = i.nodeBefore;
24
24
  if (Ae(e, i, t, -1)) return !0;
@@ -152,7 +152,7 @@ var _e = (e, t) => {
152
152
  return t && t(e.tr.join(r).scrollIntoView()), !0;
153
153
  }, ye = (e, t) => {
154
154
  let { $from: n, $to: r } = e.selection, i = n.blockRange(r), a = i && c(i);
155
- return a == null ? !1 : (t && t(e.tr.lift(i, a).scrollIntoView()), !0);
155
+ return a != null && (t && t(e.tr.lift(i, a).scrollIntoView()), !0);
156
156
  }, be = (e, t) => {
157
157
  let { $head: n, $anchor: r } = e.selection;
158
158
  return !n.parent.type.spec.code || !n.sameParent(r) ? !1 : (t && t(e.tr.insertText("\n").scrollIntoView()), !0);
@@ -192,7 +192,7 @@ var Se = (e, t) => {
192
192
  if (f(e.doc, r)) return t && t(e.tr.split(r).scrollIntoView()), !0;
193
193
  }
194
194
  let r = n.blockRange(), i = r && c(r);
195
- return i == null ? !1 : (t && t(e.tr.lift(r, i).scrollIntoView()), !0);
195
+ return i != null && (t && t(e.tr.lift(r, i).scrollIntoView()), !0);
196
196
  };
197
197
  function Te(e) {
198
198
  return (t, n) => {
@@ -224,7 +224,7 @@ function Te(e) {
224
224
  }
225
225
  var Ee = Te(), De = (e, t) => {
226
226
  let { $from: n, to: r } = e.selection, i, a = n.sharedDepth(r);
227
- return a == 0 ? !1 : (i = n.before(a), t && t(e.tr.setSelection(b.create(e.doc, i))), !0);
227
+ return a != 0 && (i = n.before(a), t && t(e.tr.setSelection(b.create(e.doc, i))), !0);
228
228
  }, Oe = (e, t) => (t && t(e.tr.setSelection(new x(e.doc))), !0);
229
229
  function ke(e, t, n) {
230
230
  let r = t.nodeBefore, i = t.nodeAfter, a = t.index();
@@ -286,10 +286,12 @@ function Fe(e, t = null) {
286
286
  let { $from: { pos: a }, $to: { pos: o } } = n.selection.ranges[r];
287
287
  n.doc.nodesBetween(a, o, (r, a) => {
288
288
  if (i) return !1;
289
- if (!(!r.isTextblock || r.hasMarkup(e, t))) if (r.type == e) i = !0;
290
- else {
291
- let t = n.doc.resolve(a), r = t.index();
292
- i = t.parent.canReplaceWith(r, r + 1, e);
289
+ if (r.isTextblock && !r.hasMarkup(e, t)) {
290
+ if (r.type == e) i = !0;
291
+ else {
292
+ let t = n.doc.resolve(a), r = t.index();
293
+ i = t.parent.canReplaceWith(r, r + 1, e);
294
+ }
293
295
  }
294
296
  });
295
297
  }
@@ -426,9 +428,10 @@ function et(e, t, n, r, i) {
426
428
  t = T(e) + (i < 0 ? 0 : 1), e = n;
427
429
  } else if (D(e)) {
428
430
  let n = e.childNodes[t + (i < 0 ? -1 : 0)];
429
- if (D(n) && n.contentEditable == "false") if (n.pmViewDesc?.ignoreForSelection) t += i;
430
- else return !1;
431
- else e = n, t = i < 0 ? E(e) : 0;
431
+ if (D(n) && n.contentEditable == "false") {
432
+ if (n.pmViewDesc?.ignoreForSelection) t += i;
433
+ else return !1;
434
+ } else e = n, t = i < 0 ? E(e) : 0;
432
435
  } else return !1;
433
436
  }
434
437
  }
@@ -543,17 +546,19 @@ function wt(e, t, n) {
543
546
  continue;
544
547
  }
545
548
  let e = o == a.body, n = e ? St(a) : Ct(o), s = 0, c = 0;
546
- if (t.top < n.top + I(r, "top") ? c = -(n.top - t.top + I(i, "top")) : t.bottom > n.bottom - I(r, "bottom") && (c = t.bottom - t.top > n.bottom - n.top ? t.top + I(i, "top") - n.top : t.bottom - n.bottom + I(i, "bottom")), t.left < n.left + I(r, "left") ? s = -(n.left - t.left + I(i, "left")) : t.right > n.right - I(r, "right") && (s = t.right - n.right + I(i, "right")), s || c) if (e) a.defaultView.scrollBy(s, c);
547
- else {
548
- let e = o.scrollLeft, n = o.scrollTop;
549
- c && (o.scrollTop += c), s && (o.scrollLeft += s);
550
- let r = o.scrollLeft - e, i = o.scrollTop - n;
551
- t = {
552
- left: t.left - r,
553
- top: t.top - i,
554
- right: t.right - r,
555
- bottom: t.bottom - i
556
- };
549
+ if (t.top < n.top + I(r, "top") ? c = -(n.top - t.top + I(i, "top")) : t.bottom > n.bottom - I(r, "bottom") && (c = t.bottom - t.top > n.bottom - n.top ? t.top + I(i, "top") - n.top : t.bottom - n.bottom + I(i, "bottom")), t.left < n.left + I(r, "left") ? s = -(n.left - t.left + I(i, "left")) : t.right > n.right - I(r, "right") && (s = t.right - n.right + I(i, "right")), s || c) {
550
+ if (e) a.defaultView.scrollBy(s, c);
551
+ else {
552
+ let e = o.scrollLeft, n = o.scrollTop;
553
+ c && (o.scrollTop += c), s && (o.scrollLeft += s);
554
+ let r = o.scrollLeft - e, i = o.scrollTop - n;
555
+ t = {
556
+ left: t.left - r,
557
+ top: t.top - i,
558
+ right: t.right - r,
559
+ bottom: t.bottom - i
560
+ };
561
+ }
557
562
  }
558
563
  let l = e ? "fixed" : getComputedStyle(o).position;
559
564
  if (/^(fixed|sticky)$/.test(l)) break;
@@ -732,19 +737,22 @@ function Bt(e, t) {
732
737
  var Vt = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
733
738
  function Ht(e, t, n) {
734
739
  let { node: r, offset: i, atom: a } = e.docView.domFromPos(t, n < 0 ? -1 : 1), o = bt || j;
735
- if (O(r)) if (o && (Vt.test(r.nodeValue) || (n < 0 ? !i : i == r.nodeValue.length))) {
736
- let e = Bt(Xe(r, i, i), n);
737
- if (j && i && /\s/.test(r.nodeValue[i - 1]) && i < r.nodeValue.length) {
738
- let t = Bt(Xe(r, i - 1, i - 1), -1);
739
- if (t.top == e.top) {
740
- let n = Bt(Xe(r, i, i + 1), -1);
741
- if (n.top != e.top) return Ut(n, n.left < t.left);
740
+ if (O(r)) {
741
+ if (o && (Vt.test(r.nodeValue) || (n < 0 ? !i : i == r.nodeValue.length))) {
742
+ let e = Bt(Xe(r, i, i), n);
743
+ if (j && i && /\s/.test(r.nodeValue[i - 1]) && i < r.nodeValue.length) {
744
+ let t = Bt(Xe(r, i - 1, i - 1), -1);
745
+ if (t.top == e.top) {
746
+ let n = Bt(Xe(r, i, i + 1), -1);
747
+ if (n.top != e.top) return Ut(n, n.left < t.left);
748
+ }
742
749
  }
750
+ return e;
751
+ }
752
+ {
753
+ let e = i, t = i, a = n < 0 ? 1 : -1;
754
+ return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++, Ut(Bt(Xe(r, e, t), a), a < 0);
743
755
  }
744
- return e;
745
- } else {
746
- let e = i, t = i, a = n < 0 ? 1 : -1;
747
- return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++, Ut(Bt(Xe(r, e, t), a), a < 0);
748
756
  }
749
757
  if (!e.state.doc.resolve(t - (a || 0)).parent.inlineContent) {
750
758
  if (a == null && i && (n < 0 || i == E(r))) {
@@ -898,24 +906,27 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
898
906
  return this.posAtStart + this.size - 2 * this.border;
899
907
  }
900
908
  localPosFromDOM(e, t, n) {
901
- if (this.contentDOM && tt(this.contentDOM, e)) if (n < 0) {
902
- let n, r;
903
- if (e == this.contentDOM) n = e.childNodes[t - 1];
904
- else {
905
- for (; e.parentNode != this.contentDOM;) e = e.parentNode;
906
- n = e.previousSibling;
909
+ if (this.contentDOM && tt(this.contentDOM, e)) {
910
+ if (n < 0) {
911
+ let n, r;
912
+ if (e == this.contentDOM) n = e.childNodes[t - 1];
913
+ else {
914
+ for (; e.parentNode != this.contentDOM;) e = e.parentNode;
915
+ n = e.previousSibling;
916
+ }
917
+ for (; n && !((r = n.pmViewDesc) && r.parent == this);) n = n.previousSibling;
918
+ return n ? this.posBeforeChild(r) + r.size : this.posAtStart;
907
919
  }
908
- for (; n && !((r = n.pmViewDesc) && r.parent == this);) n = n.previousSibling;
909
- return n ? this.posBeforeChild(r) + r.size : this.posAtStart;
910
- } else {
911
- let n, r;
912
- if (e == this.contentDOM) n = e.childNodes[t];
913
- else {
914
- for (; e.parentNode != this.contentDOM;) e = e.parentNode;
915
- n = e.nextSibling;
920
+ {
921
+ let n, r;
922
+ if (e == this.contentDOM) n = e.childNodes[t];
923
+ else {
924
+ for (; e.parentNode != this.contentDOM;) e = e.parentNode;
925
+ n = e.nextSibling;
926
+ }
927
+ for (; n && !((r = n.pmViewDesc) && r.parent == this);) n = n.nextSibling;
928
+ return n ? this.posBeforeChild(r) : this.posAtEnd;
916
929
  }
917
- for (; n && !((r = n.pmViewDesc) && r.parent == this);) n = n.nextSibling;
918
- return n ? this.posBeforeChild(r) : this.posAtEnd;
919
930
  }
920
931
  let r;
921
932
  if (e == this.dom && this.contentDOM) r = t > T(this.contentDOM);
@@ -941,8 +952,10 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
941
952
  nearestDesc(e, t = !1) {
942
953
  for (let n = !0, r = e; r; r = r.parentNode) {
943
954
  let i = this.getDesc(r), a;
944
- if (i && (!t || i.node)) if (n && (a = i.nodeDOM) && !(D(a) ? tt(a, e) : a == e)) n = !1;
945
- else return i;
955
+ if (i && (!t || i.node)) {
956
+ if (n && (a = i.nodeDOM) && !(D(a) ? tt(a, e) : a == e)) n = !1;
957
+ else return i;
958
+ }
946
959
  }
947
960
  }
948
961
  getDesc(e) {
@@ -995,14 +1008,15 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
995
1008
  }
996
1009
  if (t <= 0) {
997
1010
  let e, r = !0;
998
- for (; e = n ? this.children[n - 1] : null, !(!e || e.dom.parentNode == this.contentDOM); n--, r = !1);
1011
+ for (; e = n ? this.children[n - 1] : null, e && e.dom.parentNode != this.contentDOM; n--, r = !1);
999
1012
  return e && t && r && !e.border && !e.domAtom ? e.domFromPos(e.size, t) : {
1000
1013
  node: this.contentDOM,
1001
1014
  offset: e ? T(e.dom) + 1 : 0
1002
1015
  };
1003
- } else {
1016
+ }
1017
+ {
1004
1018
  let e, r = !0;
1005
- for (; e = n < this.children.length ? this.children[n] : null, !(!e || e.dom.parentNode == this.contentDOM); n++, r = !1);
1019
+ for (; e = n < this.children.length ? this.children[n] : null, e && e.dom.parentNode != this.contentDOM; n++, r = !1);
1006
1020
  return e && r && !e.border && !e.domAtom ? e.domFromPos(0, t) : {
1007
1021
  node: this.contentDOM,
1008
1022
  offset: e ? T(e.dom) : this.contentDOM.childNodes.length
@@ -1129,7 +1143,8 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
1129
1143
  if (e >= r && t <= o) {
1130
1144
  this.dirty = e == n || t == a ? en : $t, e == r && t == o && (i.contentLost || i.dom.parentNode != this.contentDOM) ? i.dirty = R : i.markDirty(e - r, t - r);
1131
1145
  return;
1132
- } else i.dirty = i.dom == i.contentDOM && i.dom.parentNode == this.contentDOM && !i.children.length ? en : R;
1146
+ }
1147
+ i.dirty = i.dom == i.contentDOM && i.dom.parentNode == this.contentDOM && !i.children.length ? en : R;
1133
1148
  }
1134
1149
  n = a;
1135
1150
  }
@@ -1321,7 +1336,8 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
1321
1336
  pos: a,
1322
1337
  text: e
1323
1338
  };
1324
- } else return {
1339
+ }
1340
+ return {
1325
1341
  node: i,
1326
1342
  pos: -1,
1327
1343
  text: ""
@@ -1333,7 +1349,7 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
1333
1349
  for (; i.parentNode != this.contentDOM; i = i.parentNode) {
1334
1350
  for (; i.previousSibling;) i.parentNode.removeChild(i.previousSibling);
1335
1351
  for (; i.nextSibling;) i.parentNode.removeChild(i.nextSibling);
1336
- i.pmViewDesc &&= void 0;
1352
+ i.pmViewDesc && (i.pmViewDesc = void 0);
1337
1353
  }
1338
1354
  let a = new rn(this, i, t, r);
1339
1355
  e.input.compositionNodes.push(a), this.children = En(this.children, n, n + r.length, e, a);
@@ -1428,8 +1444,8 @@ var cn = class e extends on {
1428
1444
  if (this.spec.update && (this.node.type == e.type || this.spec.multiType)) {
1429
1445
  let i = this.spec.update(e, t, n);
1430
1446
  return i && this.updateInner(e, t, n, r), i;
1431
- } else if (!this.contentDOM && !e.isLeaf) return !1;
1432
- else return super.update(e, t, n, r);
1447
+ }
1448
+ return !this.contentDOM && !e.isLeaf ? !1 : super.update(e, t, n, r);
1433
1449
  }
1434
1450
  selectNode() {
1435
1451
  this.spec.selectNode ? this.spec.selectNode() : super.selectNode();
@@ -1493,7 +1509,7 @@ function hn(e, t, n, r) {
1493
1509
  let a = r[t], o = n[t];
1494
1510
  if (t) {
1495
1511
  let t;
1496
- o && o.nodeName == a.nodeName && i != e && (t = i.parentNode) && t.nodeName.toLowerCase() == a.nodeName ? i = t : (t = document.createElement(a.nodeName), t.pmIsDeco = !0, t.appendChild(i), o = pn[0], i = t);
1512
+ o && o.nodeName == a.nodeName && i != e && (t = i.parentNode) && t.nodeName.toLowerCase() == a.nodeName || (t = document.createElement(a.nodeName), t.pmIsDeco = !0, t.appendChild(i), o = pn[0]), i = t;
1497
1513
  }
1498
1514
  gn(i, o || pn[0], a);
1499
1515
  }
@@ -1695,10 +1711,12 @@ function Cn(e, t, n, r) {
1695
1711
  let e = i[o++];
1696
1712
  e.widget && (u ? (d ||= [u]).push(e) : u = e);
1697
1713
  }
1698
- if (u) if (d) {
1699
- d.sort(Sn);
1700
- for (let e = 0; e < d.length; e++) n(d[e], l, !!c);
1701
- } else n(u, l, !!c);
1714
+ if (u) {
1715
+ if (d) {
1716
+ d.sort(Sn);
1717
+ for (let e = 0; e < d.length; e++) n(d[e], l, !!c);
1718
+ } else n(u, l, !!c);
1719
+ }
1702
1720
  let f, p;
1703
1721
  if (c) p = -1, f = c, c = null;
1704
1722
  else if (l < e.childCount) p = l, f = e.child(l++);
@@ -1881,11 +1899,13 @@ function Un(e, t, n) {
1881
1899
  if (!i || i.isText || !i.isLeaf) return !1;
1882
1900
  let a = e.state.doc.resolve(n.pos + i.nodeSize * (t < 0 ? -1 : 1));
1883
1901
  return Hn(e, new l(r.$anchor, a));
1884
- } else if (!r.empty) return !1;
1885
- else if (e.endOfTextblock(t > 0 ? "forward" : "backward")) {
1902
+ }
1903
+ if (!r.empty) return !1;
1904
+ if (e.endOfTextblock(t > 0 ? "forward" : "backward")) {
1886
1905
  let n = Vn(e.state, t);
1887
1906
  return n && n instanceof b ? Hn(e, n) : !1;
1888
- } else if (!(P && n.indexOf("m") > -1)) {
1907
+ }
1908
+ if (!(P && n.indexOf("m") > -1)) {
1889
1909
  let n = r.$head, i = n.textOffset ? null : t < 0 ? n.nodeBefore : n.nodeAfter, a;
1890
1910
  if (!i || i.isText) return !1;
1891
1911
  let o = t < 0 ? n.pos - i.nodeSize : n.pos;
@@ -2052,13 +2072,12 @@ function ir(e, t) {
2052
2072
  if (n == 37 || P && n == 66 && r == "c") {
2053
2073
  let t = n == 37 ? Qn(e, e.state.selection.from) == "ltr" ? -1 : 1 : -1;
2054
2074
  return Un(e, t, r) || Gn(e, t);
2055
- } else if (n == 39 || P && n == 70 && r == "c") {
2075
+ }
2076
+ if (n == 39 || P && n == 70 && r == "c") {
2056
2077
  let t = n == 39 ? Qn(e, e.state.selection.from) == "ltr" ? 1 : -1 : 1;
2057
2078
  return Un(e, t, r) || Gn(e, t);
2058
- } else if (n == 38 || P && n == 80 && r == "c") return $n(e, -1, r) || Gn(e, -1);
2059
- else if (n == 40 || P && n == 78 && r == "c") return nr(e) || $n(e, 1, r) || Gn(e, 1);
2060
- else if (r == (P ? "m" : "c") && (n == 66 || n == 73 || n == 89 || n == 90)) return !0;
2061
- return !1;
2079
+ }
2080
+ return n == 38 || P && n == 80 && r == "c" ? $n(e, -1, r) || Gn(e, -1) : n == 40 || P && n == 78 && r == "c" ? nr(e) || $n(e, 1, r) || Gn(e, 1) : !(r != (P ? "m" : "c") || n != 66 && n != 73 && n != 89 && n != 90);
2062
2081
  }
2063
2082
  function ar(t, n) {
2064
2083
  t.someProp("transformCopied", (e) => {
@@ -2307,12 +2326,14 @@ function Or(e, t) {
2307
2326
  }
2308
2327
  V.keydown = (e, t) => {
2309
2328
  let n = t;
2310
- if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !Gr(e) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), !(F && M && n.keyCode == 13))) if (n.keyCode != 229 && e.domObserver.forceFlush(), vt && n.keyCode == 13 && !n.ctrlKey && !n.altKey && !n.metaKey) {
2311
- let t = Date.now();
2312
- e.input.lastIOSEnter = t, e.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
2313
- e.input.lastIOSEnter == t && (e.someProp("handleKeyDown", (t) => t(e, st(13, "Enter"))), e.input.lastIOSEnter = 0);
2314
- }, 200);
2315
- } else e.someProp("handleKeyDown", (t) => t(e, n)) || ir(e, n) ? n.preventDefault() : H(e, "key");
2329
+ if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !Gr(e) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), !(F && M && n.keyCode == 13))) {
2330
+ if (n.keyCode != 229 && e.domObserver.forceFlush(), vt && n.keyCode == 13 && !n.ctrlKey && !n.altKey && !n.metaKey) {
2331
+ let t = Date.now();
2332
+ e.input.lastIOSEnter = t, e.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
2333
+ e.input.lastIOSEnter == t && (e.someProp("handleKeyDown", (t) => t(e, st(13, "Enter"))), e.input.lastIOSEnter = 0);
2334
+ }, 200);
2335
+ } else e.someProp("handleKeyDown", (t) => t(e, n)) || ir(e, n) ? n.preventDefault() : H(e, "key");
2336
+ }
2316
2337
  }, V.keyup = (e, t) => {
2317
2338
  t.keyCode == 16 && (e.input.shiftKey = !1);
2318
2339
  }, V.keypress = (e, t) => {
@@ -2366,7 +2387,7 @@ function Pr(e, t) {
2366
2387
  break;
2367
2388
  }
2368
2389
  }
2369
- return i == null ? !1 : (Mr(e, b.create(e.state.doc, i)), !0);
2390
+ return i != null && (Mr(e, b.create(e.state.doc, i)), !0);
2370
2391
  }
2371
2392
  function Fr(e, t, n, r, i) {
2372
2393
  return jr(e, "handleClickOn", t, n, r) || e.someProp("handleClick", (n) => n(e, t, r)) || (i ? Pr(e, n) : Nr(e, n));
@@ -2442,7 +2463,7 @@ var Hr = class {
2442
2463
  n.button == 0 && (i.type.spec.draggable && i.type.spec.selectable !== !1 || c instanceof b && c.from <= a && c.to > a) && (this.mightDrag = {
2443
2464
  node: i,
2444
2465
  pos: a,
2445
- addAttr: !!(this.target && !this.target.draggable),
2466
+ addAttr: !(!this.target || this.target.draggable),
2446
2467
  setUneditable: !!(this.target && j && !this.target.hasAttribute("contentEditable"))
2447
2468
  }), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
2448
2469
  this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
@@ -2506,7 +2527,8 @@ V.compositionstart = V.compositionupdate = (e) => {
2506
2527
  let n = e.domSelection();
2507
2528
  n && n.collapse(t, t.nodeValue.length);
2508
2529
  break;
2509
- } else n = t, r = -1;
2530
+ }
2531
+ n = t, r = -1;
2510
2532
  }
2511
2533
  }
2512
2534
  e.input.composing = !0;
@@ -2538,7 +2560,7 @@ function Xr(e) {
2538
2560
  if (!t || !t.isText(r.nodeValue)) return r;
2539
2561
  if (e.input.compositionNode == r) {
2540
2562
  let e = n.pmViewDesc;
2541
- if (!(!e || !e.isText(n.nodeValue))) return r;
2563
+ if (e && e.isText(n.nodeValue)) return r;
2542
2564
  }
2543
2565
  }
2544
2566
  return n || r;
@@ -2912,10 +2934,12 @@ var G = W.empty, mi = class e {
2912
2934
  let t, n = !0;
2913
2935
  for (let r = 0; r < this.members.length; r++) {
2914
2936
  let i = this.members[r].localsInner(e);
2915
- if (i.length) if (!t) t = i;
2916
- else {
2917
- n &&= (t = t.slice(), !1);
2918
- for (let e = 0; e < i.length; e++) t.push(i[e]);
2937
+ if (i.length) {
2938
+ if (!t) t = i;
2939
+ else {
2940
+ n &&= (t = t.slice(), !1);
2941
+ for (let e = 0; e < i.length; e++) t.push(i[e]);
2942
+ }
2919
2943
  }
2920
2944
  }
2921
2945
  return t ? Si(n ? t : t.sort(xi)) : fi;
@@ -3029,10 +3053,8 @@ function Si(e) {
3029
3053
  let r = t[n];
3030
3054
  if (r.from != r.to) for (let i = n + 1; i < t.length; i++) {
3031
3055
  let a = t[i];
3032
- if (a.from == r.from) {
3033
- a.to != r.to && (t == e && (t = e.slice()), t[i] = a.copy(a.from, r.to), Ci(t, i + 1, a.copy(r.to, a.to)));
3034
- continue;
3035
- } else {
3056
+ if (a.from == r.from) a.to != r.to && (t == e && (t = e.slice()), t[i] = a.copy(a.from, r.to), Ci(t, i + 1, a.copy(r.to, a.to)));
3057
+ else {
3036
3058
  a.from < r.to && (t == e && (t = e.slice()), t[n] = r.copy(r.from, a.from), Ci(t, i, r.copy(a.from, r.to)));
3037
3059
  break;
3038
3060
  }
@@ -3206,15 +3228,15 @@ var Ti = {
3206
3228
  from: o,
3207
3229
  to: n.localPosFromDOM(e.target, s, 1)
3208
3230
  };
3209
- } else if (e.type == "attributes") return {
3231
+ }
3232
+ return e.type == "attributes" ? {
3210
3233
  from: n.posAtStart - n.border,
3211
3234
  to: n.posAtEnd + n.border
3212
- };
3213
- else return this.lastChangedTextNode = e.target, {
3235
+ } : (this.lastChangedTextNode = e.target, {
3214
3236
  from: n.posAtStart,
3215
3237
  to: n.posAtEnd,
3216
3238
  typeOver: e.target.nodeValue == e.oldValue
3217
- };
3239
+ });
3218
3240
  }
3219
3241
  }, ki = /* @__PURE__ */ new WeakMap(), Ai = !1;
3220
3242
  function ji(e) {
@@ -3323,7 +3345,8 @@ var Li = (e) => (t) => {
3323
3345
  if (N && /^(ul|ol)$/i.test(t.parentNode.nodeName)) {
3324
3346
  let e = document.createElement("div");
3325
3347
  return e.appendChild(document.createElement("li")), { skip: e };
3326
- } else if (t.parentNode.lastChild == t || N && /^(tr|table)$/i.test(t.parentNode.nodeName)) return { ignore: !0 };
3348
+ }
3349
+ if (t.parentNode.lastChild == t || N && /^(tr|table)$/i.test(t.parentNode.nodeName)) return { ignore: !0 };
3327
3350
  } else if (t.nodeName == "IMG" && t.getAttribute("mark-placeholder")) return { ignore: !0 };
3328
3351
  return null;
3329
3352
  }, Ri = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
@@ -3347,20 +3370,22 @@ function zi(e, t, n, r, i) {
3347
3370
  e.input.lastIOSEnter = 0;
3348
3371
  return;
3349
3372
  }
3350
- if (!h) if (r && c instanceof l && !c.empty && c.$head.sameParent(c.$anchor) && !e.composing && !(u.sel && u.sel.anchor != u.sel.head)) h = {
3351
- start: c.from,
3352
- endA: c.to,
3353
- endB: c.to
3354
- };
3355
- else {
3356
- if (u.sel) {
3357
- let t = Bi(e, e.state.doc, u.sel);
3358
- if (t && !t.eq(e.state.selection)) {
3359
- let n = e.state.tr.setSelection(t);
3360
- a && n.setMeta("composition", a), e.dispatch(n);
3373
+ if (!h) {
3374
+ if (r && c instanceof l && !c.empty && c.$head.sameParent(c.$anchor) && !e.composing && !(u.sel && u.sel.anchor != u.sel.head)) h = {
3375
+ start: c.from,
3376
+ endA: c.to,
3377
+ endB: c.to
3378
+ };
3379
+ else {
3380
+ if (u.sel) {
3381
+ let t = Bi(e, e.state.doc, u.sel);
3382
+ if (t && !t.eq(e.state.selection)) {
3383
+ let n = e.state.tr.setSelection(t);
3384
+ a && n.setMeta("composition", a), e.dispatch(n);
3385
+ }
3361
3386
  }
3387
+ return;
3362
3388
  }
3363
- return;
3364
3389
  }
3365
3390
  e.state.selection.from < e.state.selection.to && h.start == h.endB && e.state.selection instanceof l && (h.start > e.state.selection.from && h.start <= e.state.selection.from + 2 && e.state.selection.from >= u.from ? h.start = e.state.selection.from : h.endA < e.state.selection.to && h.endA >= e.state.selection.to - 2 && e.state.selection.to <= u.to && (h.endB += e.state.selection.to - h.endA, h.endA = e.state.selection.to)), A && ht <= 11 && h.endB == h.start + 1 && h.endA == h.start && h.start > u.from && u.doc.textBetween(h.start - u.from - 1, h.start - u.from + 1) == " \xA0" && (h.start--, h.endA--, h.endB--);
3366
3391
  let g = u.doc.resolveNoCache(h.start - u.from), _ = u.doc.resolveNoCache(h.endB - u.from), v = d.resolve(h.start), y = g.sameParent(_) && g.parent.inlineContent && v.end() >= h.endA;
@@ -3385,18 +3410,19 @@ function zi(e, t, n, r, i) {
3385
3410
  }
3386
3411
  return a && n.setMeta("composition", a), n.scrollIntoView();
3387
3412
  }, S;
3388
- if (y) if (g.pos == _.pos) {
3389
- A && ht <= 11 && g.parentOffset == 0 && (e.domObserver.suppressSelectionUpdates(), setTimeout(() => z(e), 20));
3390
- let t = ee(e.state.tr.delete(b, x)), n = d.resolve(h.start).marksAcross(d.resolve(h.endA));
3391
- n && t.ensureMarks(n), e.dispatch(t);
3392
- } else if (h.endA == h.endB && (S = Vi(g.parent.content.cut(g.parentOffset, _.parentOffset), v.parent.content.cut(v.parentOffset, h.endA - v.start())))) {
3393
- let t = ee(e.state.tr);
3394
- S.type == "add" ? t.addMark(b, x, S.mark) : t.removeMark(b, x, S.mark), e.dispatch(t);
3395
- } else if (g.parent.child(g.index()).isText && g.index() == _.index() - +!_.textOffset) {
3396
- let t = g.parent.textBetween(g.parentOffset, _.parentOffset), n = () => ee(e.state.tr.insertText(t, b, x));
3397
- e.someProp("handleTextInput", (r) => r(e, b, x, t, n)) || e.dispatch(n());
3413
+ if (y) {
3414
+ if (g.pos == _.pos) {
3415
+ A && ht <= 11 && g.parentOffset == 0 && (e.domObserver.suppressSelectionUpdates(), setTimeout(() => z(e), 20));
3416
+ let t = ee(e.state.tr.delete(b, x)), n = d.resolve(h.start).marksAcross(d.resolve(h.endA));
3417
+ n && t.ensureMarks(n), e.dispatch(t);
3418
+ } else if (h.endA == h.endB && (S = Vi(g.parent.content.cut(g.parentOffset, _.parentOffset), v.parent.content.cut(v.parentOffset, h.endA - v.start())))) {
3419
+ let t = ee(e.state.tr);
3420
+ S.type == "add" ? t.addMark(b, x, S.mark) : t.removeMark(b, x, S.mark), e.dispatch(t);
3421
+ } else if (g.parent.child(g.index()).isText && g.index() == _.index() - +!_.textOffset) {
3422
+ let t = g.parent.textBetween(g.parentOffset, _.parentOffset), n = () => ee(e.state.tr.insertText(t, b, x));
3423
+ e.someProp("handleTextInput", (r) => r(e, b, x, t, n)) || e.dispatch(n());
3424
+ } else e.dispatch(ee());
3398
3425
  } else e.dispatch(ee());
3399
- else e.dispatch(ee());
3400
3426
  }
3401
3427
  function Bi(e, t, n) {
3402
3428
  return Math.max(n.anchor, n.head) > t.content.size ? null : Ln(e, t.resolve(n.anchor), t.resolve(n.head));
@@ -3519,10 +3545,12 @@ var Ki = class {
3519
3545
  }
3520
3546
  scrollToSelection() {
3521
3547
  let e = this.domSelectionRange().focusNode;
3522
- if (!(!e || !tt(this.dom, e)) && !this.someProp("handleScrollToSelection", (e) => e(this))) if (this.state.selection instanceof b) {
3523
- let t = this.docView.domAfterPos(this.state.selection.from);
3524
- D(t) && wt(this, t.getBoundingClientRect(), e);
3525
- } else wt(this, this.coordsAtPos(this.state.selection.head, 1), e);
3548
+ if (e && tt(this.dom, e) && !this.someProp("handleScrollToSelection", (e) => e(this))) {
3549
+ if (this.state.selection instanceof b) {
3550
+ let t = this.docView.domAfterPos(this.state.selection.from);
3551
+ D(t) && wt(this, t.getBoundingClientRect(), e);
3552
+ } else wt(this, this.coordsAtPos(this.state.selection.head, 1), e);
3553
+ }
3526
3554
  }
3527
3555
  destroyPluginViews() {
3528
3556
  let e;
@@ -3921,16 +3949,15 @@ var ha = /* @__PURE__ */ function(e) {
3921
3949
  n && (i = this.remapping(r, this.items.length), a = i.maps.length);
3922
3950
  let o = t.tr, s, c, l = [], u = [];
3923
3951
  return this.items.forEach((t, n) => {
3924
- if (!t.step) {
3925
- i || (i = this.remapping(r, n + 1), a = i.maps.length), a--, u.push(t);
3926
- return;
3952
+ if (!t.step) i || (i = this.remapping(r, n + 1), a = i.maps.length), a--, u.push(t);
3953
+ else {
3954
+ if (i) {
3955
+ u.push(new ya(t.map));
3956
+ let e = t.step.map(i.slice(a)), n;
3957
+ e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new ya(n, void 0, void 0, l.length + u.length))), a--, n && i.appendMap(n, a);
3958
+ } else o.maybeStep(t.step);
3959
+ if (t.selection) return s = i ? t.selection.map(i.slice(a)) : t.selection, c = new e(this.items.slice(0, r).append(u.reverse().concat(l)), this.eventCount - 1), !1;
3927
3960
  }
3928
- if (i) {
3929
- u.push(new ya(t.map));
3930
- let e = t.step.map(i.slice(a)), n;
3931
- e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new ya(n, void 0, void 0, l.length + u.length))), a--, n && i.appendMap(n, a);
3932
- } else o.maybeStep(t.step);
3933
- if (t.selection) return s = i ? t.selection.map(i.slice(a)) : t.selection, c = new e(this.items.slice(0, r).append(u.reverse().concat(l)), this.eventCount - 1), !1;
3934
3961
  }, this.items.length, 0), {
3935
3962
  remaining: c,
3936
3963
  transform: o,
@@ -4032,8 +4059,8 @@ function Sa(e, t, n, r) {
4032
4059
  if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
4033
4060
  let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !Ca(n, e.prevRanges)), s = o ? Ta(e.prevRanges, n.mapping) : wa(n.mapping.maps);
4034
4061
  return new ba(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, ka(t)), _a.empty, s, n.time, i ?? e.prevComposition);
4035
- } else if (a = n.getMeta("rebased")) return new ba(e.done.rebased(n, a), e.undone.rebased(n, a), Ta(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
4036
- else return new ba(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), Ta(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
4062
+ }
4063
+ return (a = n.getMeta("rebased")) ? new ba(e.done.rebased(n, a), e.undone.rebased(n, a), Ta(e.prevRanges, n.mapping), e.prevTime, e.prevComposition) : new ba(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), Ta(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
4037
4064
  }
4038
4065
  function Ca(e, t) {
4039
4066
  if (!t) return !1;
@@ -4816,29 +4843,25 @@ function ms(e) {
4816
4843
  let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
4817
4844
  for (let s = 0; s < o; s += 1) {
4818
4845
  let o = e[s];
4819
- if (o === "'" && !i) {
4820
- r = !r, n += o;
4821
- continue;
4822
- }
4823
- if (o === "\"" && !r) {
4824
- i = !i, n += o;
4825
- continue;
4826
- }
4827
- if (!r && !i) {
4828
- if (o === "(") {
4829
- a += 1, n += o;
4830
- continue;
4831
- }
4832
- if (o === ")" && a > 0) {
4833
- --a, n += o;
4834
- continue;
4835
- }
4836
- if (o === ";" && a === 0) {
4837
- t.push(n), n = "";
4838
- continue;
4846
+ if (o === "'" && !i) r = !r, n += o;
4847
+ else if (o === "\"" && !r) i = !i, n += o;
4848
+ else {
4849
+ if (!r && !i) {
4850
+ if (o === "(") {
4851
+ a += 1, n += o;
4852
+ continue;
4853
+ }
4854
+ if (o === ")" && a > 0) {
4855
+ --a, n += o;
4856
+ continue;
4857
+ }
4858
+ if (o === ";" && a === 0) {
4859
+ t.push(n), n = "";
4860
+ continue;
4861
+ }
4839
4862
  }
4863
+ n += o;
4840
4864
  }
4841
- n += o;
4842
4865
  }
4843
4866
  return n && t.push(n), t;
4844
4867
  }
@@ -4856,20 +4879,14 @@ function gs(...e) {
4856
4879
  return e.filter((e) => !!e).reduce((e, t) => {
4857
4880
  let n = { ...e };
4858
4881
  return Object.entries(t).forEach(([e, t]) => {
4859
- if (e === "__proto__") {
4860
- Object.defineProperty(n, e, {
4861
- configurable: !0,
4862
- enumerable: !0,
4863
- value: t,
4864
- writable: !0
4865
- });
4866
- return;
4867
- }
4868
- if (!n[e]) {
4869
- n[e] = t;
4870
- return;
4871
- }
4872
- if (e === "class") {
4882
+ if (e === "__proto__") Object.defineProperty(n, e, {
4883
+ configurable: !0,
4884
+ enumerable: !0,
4885
+ value: t,
4886
+ writable: !0
4887
+ });
4888
+ else if (!n[e]) n[e] = t;
4889
+ else if (e === "class") {
4873
4890
  let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
4874
4891
  n[e] = [...i, ...a].join(" ");
4875
4892
  } else if (e === "style") {
@@ -4911,77 +4928,77 @@ function bs(e) {
4911
4928
  function xs(e) {
4912
4929
  var t, n;
4913
4930
  let r = {};
4914
- return !(!(e == null || (t = e.attribute) == null) && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), (e == null || (n = e.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
4931
+ return !(e != null && (t = e.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), (e == null || (n = e.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
4915
4932
  }
4916
4933
  function Ss(e, t) {
4917
- let n = ps(e), { nodeExtensions: i, markExtensions: a } = fs(e);
4934
+ let n = ps(e), { nodeExtensions: i, markExtensions: a } = fs(e), o = i.find((e) => Z(e, "topNode"))?.name, s = Object.fromEntries(i.map((r) => {
4935
+ let i = n.filter((e) => e.type === r.name), a = {
4936
+ name: r.name,
4937
+ options: r.options,
4938
+ storage: r.storage,
4939
+ editor: t
4940
+ }, o = bs({
4941
+ ...e.reduce((e, t) => {
4942
+ let n = Z(t, "extendNodeSchema", a);
4943
+ return {
4944
+ ...e,
4945
+ ...n ? n(r) : {}
4946
+ };
4947
+ }, {}),
4948
+ content: Q(Z(r, "content", a)),
4949
+ marks: Q(Z(r, "marks", a)),
4950
+ group: Q(Z(r, "group", a)),
4951
+ inline: Q(Z(r, "inline", a)),
4952
+ atom: Q(Z(r, "atom", a)),
4953
+ selectable: Q(Z(r, "selectable", a)),
4954
+ draggable: Q(Z(r, "draggable", a)),
4955
+ code: Q(Z(r, "code", a)),
4956
+ whitespace: Q(Z(r, "whitespace", a)),
4957
+ linebreakReplacement: Q(Z(r, "linebreakReplacement", a)),
4958
+ defining: Q(Z(r, "defining", a)),
4959
+ isolating: Q(Z(r, "isolating", a)),
4960
+ attrs: Object.fromEntries(i.map(xs))
4961
+ }), s = Q(Z(r, "parseHTML", a));
4962
+ s && (o.parseDOM = s.map((e) => ys(e, i)));
4963
+ let c = Z(r, "renderHTML", a);
4964
+ c && (o.toDOM = (e) => c({
4965
+ node: e,
4966
+ HTMLAttributes: _s(e, i)
4967
+ }));
4968
+ let l = Z(r, "renderText", a);
4969
+ return l && (o.toText = l), [r.name, o];
4970
+ })), c = Object.fromEntries(a.map((r) => {
4971
+ let i = n.filter((e) => e.type === r.name), a = {
4972
+ name: r.name,
4973
+ options: r.options,
4974
+ storage: r.storage,
4975
+ editor: t
4976
+ }, o = bs({
4977
+ ...e.reduce((e, t) => {
4978
+ let n = Z(t, "extendMarkSchema", a);
4979
+ return {
4980
+ ...e,
4981
+ ...n ? n(r) : {}
4982
+ };
4983
+ }, {}),
4984
+ inclusive: Q(Z(r, "inclusive", a)),
4985
+ excludes: Q(Z(r, "excludes", a)),
4986
+ group: Q(Z(r, "group", a)),
4987
+ spanning: Q(Z(r, "spanning", a)),
4988
+ code: Q(Z(r, "code", a)),
4989
+ attrs: Object.fromEntries(i.map(xs))
4990
+ }), s = Q(Z(r, "parseHTML", a));
4991
+ s && (o.parseDOM = s.map((e) => ys(e, i)));
4992
+ let c = Z(r, "renderHTML", a);
4993
+ return c && (o.toDOM = (e) => c({
4994
+ mark: e,
4995
+ HTMLAttributes: _s(e, i)
4996
+ })), [r.name, o];
4997
+ }));
4918
4998
  return new r({
4919
- topNode: i.find((e) => Z(e, "topNode"))?.name,
4920
- nodes: Object.fromEntries(i.map((r) => {
4921
- let i = n.filter((e) => e.type === r.name), a = {
4922
- name: r.name,
4923
- options: r.options,
4924
- storage: r.storage,
4925
- editor: t
4926
- }, o = bs({
4927
- ...e.reduce((e, t) => {
4928
- let n = Z(t, "extendNodeSchema", a);
4929
- return {
4930
- ...e,
4931
- ...n ? n(r) : {}
4932
- };
4933
- }, {}),
4934
- content: Q(Z(r, "content", a)),
4935
- marks: Q(Z(r, "marks", a)),
4936
- group: Q(Z(r, "group", a)),
4937
- inline: Q(Z(r, "inline", a)),
4938
- atom: Q(Z(r, "atom", a)),
4939
- selectable: Q(Z(r, "selectable", a)),
4940
- draggable: Q(Z(r, "draggable", a)),
4941
- code: Q(Z(r, "code", a)),
4942
- whitespace: Q(Z(r, "whitespace", a)),
4943
- linebreakReplacement: Q(Z(r, "linebreakReplacement", a)),
4944
- defining: Q(Z(r, "defining", a)),
4945
- isolating: Q(Z(r, "isolating", a)),
4946
- attrs: Object.fromEntries(i.map(xs))
4947
- }), s = Q(Z(r, "parseHTML", a));
4948
- s && (o.parseDOM = s.map((e) => ys(e, i)));
4949
- let c = Z(r, "renderHTML", a);
4950
- c && (o.toDOM = (e) => c({
4951
- node: e,
4952
- HTMLAttributes: _s(e, i)
4953
- }));
4954
- let l = Z(r, "renderText", a);
4955
- return l && (o.toText = l), [r.name, o];
4956
- })),
4957
- marks: Object.fromEntries(a.map((r) => {
4958
- let i = n.filter((e) => e.type === r.name), a = {
4959
- name: r.name,
4960
- options: r.options,
4961
- storage: r.storage,
4962
- editor: t
4963
- }, o = bs({
4964
- ...e.reduce((e, t) => {
4965
- let n = Z(t, "extendMarkSchema", a);
4966
- return {
4967
- ...e,
4968
- ...n ? n(r) : {}
4969
- };
4970
- }, {}),
4971
- inclusive: Q(Z(r, "inclusive", a)),
4972
- excludes: Q(Z(r, "excludes", a)),
4973
- group: Q(Z(r, "group", a)),
4974
- spanning: Q(Z(r, "spanning", a)),
4975
- code: Q(Z(r, "code", a)),
4976
- attrs: Object.fromEntries(i.map(xs))
4977
- }), s = Q(Z(r, "parseHTML", a));
4978
- s && (o.parseDOM = s.map((e) => ys(e, i)));
4979
- let c = Z(r, "renderHTML", a);
4980
- return c && (o.toDOM = (e) => c({
4981
- mark: e,
4982
- HTMLAttributes: _s(e, i)
4983
- })), [r.name, o];
4984
- }))
4999
+ topNode: o,
5000
+ nodes: s,
5001
+ marks: c
4985
5002
  });
4986
5003
  }
4987
5004
  function Cs(e) {
@@ -5125,7 +5142,7 @@ function zs(e, t, n) {
5125
5142
  ...i
5126
5143
  });
5127
5144
  }) : n.nodesBetween(e, t, (e, t) => {
5128
- !e || e?.nodeSize === void 0 || r.push(...e.marks.map((n) => ({
5145
+ e && e?.nodeSize !== void 0 && r.push(...e.marks.map((n) => ({
5129
5146
  from: t,
5130
5147
  to: t + e.nodeSize,
5131
5148
  mark: n
@@ -5247,7 +5264,7 @@ function $s({ selection: e, pos: t, nodeSize: n, selectedOnTextSelection: r = !1
5247
5264
  function ec(e) {
5248
5265
  if (typeof e != "object" || !e) return !1;
5249
5266
  let t = e;
5250
- return !(typeof t.apply != "function" || typeof t.getMap != "function" || typeof t.invert != "function" || typeof t.map != "function" || typeof t.merge != "function" || typeof t.toJSON != "function");
5267
+ return typeof t.apply == "function" && typeof t.getMap == "function" && typeof t.invert == "function" && typeof t.map == "function" && typeof t.merge == "function" && typeof t.toJSON == "function";
5251
5268
  }
5252
5269
  function tc(e) {
5253
5270
  if (typeof e != "object" || !e) return !1;
@@ -5422,24 +5439,26 @@ function bc(e, t, n) {
5422
5439
  }
5423
5440
  var xc = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
5424
5441
  let { selection: a } = n, { empty: o, ranges: s } = a, c = Y(e, r.schema);
5425
- if (i) if (o) {
5426
- let e = ts(r, c);
5427
- n.addStoredMark(c.create({
5428
- ...e,
5429
- ...t
5430
- }));
5431
- } else s.forEach((e) => {
5432
- let i = e.$from.pos, a = e.$to.pos;
5433
- r.doc.nodesBetween(i, a, (e, r) => {
5434
- let o = Math.max(r, i), s = Math.min(r + e.nodeSize, a);
5435
- e.marks.find((e) => e.type === c) ? e.marks.forEach((e) => {
5436
- c === e.type && n.addMark(o, s, c.create({
5437
- ...e.attrs,
5438
- ...t
5439
- }));
5440
- }) : n.addMark(o, s, c.create(t));
5442
+ if (i) {
5443
+ if (o) {
5444
+ let e = ts(r, c);
5445
+ n.addStoredMark(c.create({
5446
+ ...e,
5447
+ ...t
5448
+ }));
5449
+ } else s.forEach((e) => {
5450
+ let i = e.$from.pos, a = e.$to.pos;
5451
+ r.doc.nodesBetween(i, a, (e, r) => {
5452
+ let o = Math.max(r, i), s = Math.min(r + e.nodeSize, a);
5453
+ e.marks.find((e) => e.type === c) ? e.marks.forEach((e) => {
5454
+ c === e.type && n.addMark(o, s, c.create({
5455
+ ...e.attrs,
5456
+ ...t
5457
+ }));
5458
+ }) : n.addMark(o, s, c.create(t));
5459
+ });
5441
5460
  });
5442
- });
5461
+ }
5443
5462
  return bc(r, n, c);
5444
5463
  }, Sc = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), Cc = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
5445
5464
  let a = J(e, n.schema), o;
@@ -6292,7 +6311,7 @@ function Zl(e) {
6292
6311
  if (!e || Object.keys(e).length === 0) return "";
6293
6312
  let t = [];
6294
6313
  return e.class && String(e.class).split(/\s+/).filter(Boolean).forEach((e) => t.push(`.${e}`)), e.id && t.push(`#${e.id}`), Object.entries(e).forEach(([e, n]) => {
6295
- e === "class" || e === "id" || (n === !0 ? t.push(e) : n !== !1 && n != null && t.push(`${e}="${String(n)}"`));
6314
+ e !== "class" && e !== "id" && (n === !0 ? t.push(e) : n !== !1 && n != null && t.push(`${e}="${String(n)}"`));
6296
6315
  }), t.join(" ");
6297
6316
  }
6298
6317
  function Ql(e) {
@@ -6380,14 +6399,16 @@ function $l(e) {
6380
6399
  let a = g.slice(0, i);
6381
6400
  m = a.trim();
6382
6401
  let o = e.slice(0, p + i + n[0].length), c = [];
6383
- if (m) if (s === "block") for (c = r.blockTokens(a), c.forEach((e) => {
6384
- e.text && (!e.tokens || e.tokens.length === 0) && (e.tokens = r.inlineTokens(e.text));
6385
- }); c.length > 0;) {
6386
- let e = c[c.length - 1];
6387
- if (e.type === "paragraph" && (!e.text || e.text.trim() === "")) c.pop();
6388
- else break;
6402
+ if (m) {
6403
+ if (s === "block") for (c = r.blockTokens(a), c.forEach((e) => {
6404
+ e.text && (!e.tokens || e.tokens.length === 0) && (e.tokens = r.inlineTokens(e.text));
6405
+ }); c.length > 0;) {
6406
+ let e = c[c.length - 1];
6407
+ if (e.type === "paragraph" && (!e.text || e.text.trim() === "")) c.pop();
6408
+ else break;
6409
+ }
6410
+ else c = r.inlineTokens(m);
6389
6411
  }
6390
- else c = r.inlineTokens(m);
6391
6412
  return {
6392
6413
  type: t,
6393
6414
  raw: o,
@@ -6482,7 +6503,8 @@ function ru(e, t, n) {
6482
6503
  if (e.trim() === "") {
6483
6504
  o += 1, a = `${a}${e}\n`;
6484
6505
  continue;
6485
- } else return;
6506
+ }
6507
+ return;
6486
6508
  }
6487
6509
  let d = t.extractItemData(u), { indentLevel: f, mainContent: p } = d;
6488
6510
  a = `${a}${e}\n`;
@@ -6497,7 +6519,8 @@ function ru(e, t, n) {
6497
6519
  if ((((l = r[o + 1 + t].match(/^(\s*)/)) == null || (l = l[1]) == null ? void 0 : l.length) || 0) > f) {
6498
6520
  m.push(e), a = `${a}${e}\n`, o += 1;
6499
6521
  continue;
6500
- } else break;
6522
+ }
6523
+ break;
6501
6524
  }
6502
6525
  if ((((c = e.match(/^(\s*)/)) == null || (c = c[1]) == null ? void 0 : c.length) || 0) > f) m.push(e), a = `${a}${e}\n`, o += 1;
6503
6526
  else break;
@@ -6553,7 +6576,7 @@ function lu(e, t) {
6553
6576
  let n = Array.from({ length: t.length }, () => !1);
6554
6577
  return e.every((e) => {
6555
6578
  let r = cu(e), i = t.findIndex((t, i) => !n[i] && r === cu(t) && xl(e.attrs, t.attrs));
6556
- return i === -1 ? !1 : (n[i] = !0, !0);
6579
+ return i !== -1 && (n[i] = !0, !0);
6557
6580
  });
6558
6581
  }
6559
6582
  function uu(e, t) {
@@ -6649,12 +6672,12 @@ function gu(e) {
6649
6672
  commands: h,
6650
6673
  chain: g,
6651
6674
  can: _
6652
- }) === null || !d.steps.length ? !1 : u && (l.dispatch(u), !l.state.doc.eq(u.doc)) ? !0 : (Aa(d), d.setMeta("inputRule", !0), a.undoable && d.setMeta(s, {
6675
+ }) === null || !d.steps.length ? !1 : (u && (l.dispatch(u), !l.state.doc.eq(u.doc)) || (Aa(d), d.setMeta("inputRule", !0), a.undoable && d.setMeta(s, {
6653
6676
  transform: d,
6654
6677
  from: n,
6655
6678
  to: f,
6656
6679
  text: i
6657
- }), l.dispatch(d), !0);
6680
+ }), l.dispatch(d)), !0);
6658
6681
  }
6659
6682
  function _u(e, t, n) {
6660
6683
  let r = t[0].length - n.length;
@@ -6670,7 +6693,7 @@ function vu(e) {
6670
6693
  let u = Ws(l) + i;
6671
6694
  for (let e of a) {
6672
6695
  let a = mu(u, e.find);
6673
- if (!(!a || !_u(l, a, i)) && gu({
6696
+ if (a && _u(l, a, i) && gu({
6674
6697
  editor: t,
6675
6698
  from: n,
6676
6699
  to: r,
@@ -6822,7 +6845,7 @@ function wu(e) {
6822
6845
  }), d = [];
6823
6846
  return n.doc.nodesBetween(r, i, (e, t) => {
6824
6847
  var f;
6825
- if (!((f = e.type) == null || (f = f.spec) == null) && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
6848
+ if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
6826
6849
  let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
6827
6850
  m >= h || Cu(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
6828
6851
  if (e.index === void 0) return;
@@ -6860,7 +6883,7 @@ function Du(e) {
6860
6883
  state: e,
6861
6884
  transaction: c
6862
6885
  });
6863
- if (!(!wu({
6886
+ if (wu({
6864
6887
  editor: t,
6865
6888
  state: l,
6866
6889
  from: Math.max(n - 1, 0),
@@ -6868,7 +6891,7 @@ function Du(e) {
6868
6891
  rule: i,
6869
6892
  pasteEvent: a,
6870
6893
  dropEvent: s
6871
- }) || !c.steps.length)) {
6894
+ }) && c.steps.length) {
6872
6895
  try {
6873
6896
  s = typeof DragEvent < "u" ? new DragEvent("drop") : null;
6874
6897
  } catch {
@@ -6926,7 +6949,7 @@ function Du(e) {
6926
6949
  });
6927
6950
  }
6928
6951
  let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
6929
- if (!(!Ml(p) || !m || p === m.b)) return c({
6952
+ if (Ml(p) && m && p !== m.b) return c({
6930
6953
  rule: e,
6931
6954
  state: r,
6932
6955
  from: p,
@@ -7335,7 +7358,7 @@ var $ = class e extends bu {
7335
7358
  let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
7336
7359
  if (!r || i) return;
7337
7360
  let { empty: a, from: o, to: s } = t.selection, c = v.atStart(t.doc).from, l = v.atEnd(t.doc).to;
7338
- if (a || !(o === c && s === l) || !Zs(n.doc)) return;
7361
+ if (a || o !== c || s !== l || !Zs(n.doc)) return;
7339
7362
  let u = n.tr, d = Ra({
7340
7363
  state: n,
7341
7364
  transaction: u
@@ -7519,13 +7542,15 @@ var Uu = class e {
7519
7542
  closest(e, t = {}) {
7520
7543
  let n = null, r = this.parent;
7521
7544
  for (; r && !n;) {
7522
- if (r.node.type.name === e) if (Object.keys(t).length > 0) {
7523
- let e = r.node.attrs, n = Object.keys(t);
7524
- for (let r = 0; r < n.length; r += 1) {
7525
- let i = n[r];
7526
- if (e[i] !== t[i]) break;
7527
- }
7528
- } else n = r;
7545
+ if (r.node.type.name === e) {
7546
+ if (Object.keys(t).length > 0) {
7547
+ let e = r.node.attrs, n = Object.keys(t);
7548
+ for (let r = 0; r < n.length; r += 1) {
7549
+ let i = n[r];
7550
+ if (e[i] !== t[i]) break;
7551
+ }
7552
+ } else n = r;
7553
+ }
7529
7554
  r = r.parent;
7530
7555
  }
7531
7556
  return n;
@@ -7637,7 +7662,7 @@ var Uu = class e {
7637
7662
  this.options = {
7638
7663
  ...this.options,
7639
7664
  ...e
7640
- }, !(!this.editorView || !this.state || this.isDestroyed) && (this.options.editorProps && this.view.setProps({
7665
+ }, this.editorView && this.state && !this.isDestroyed && (this.options.editorProps && this.view.setProps({
7641
7666
  ...this.options.editorProps,
7642
7667
  attributes: this.getEditorViewAttributes()
7643
7668
  }), this.view.updateState(this.state));
@@ -8137,7 +8162,7 @@ var dd = (e, t) => ud(e, t), fd = (e) => "touches" in e, pd = class {
8137
8162
  }, this.node = e.node, this.editor = e.editor, this.element = e.element, this.element.draggable = !1, this.contentElement = e.contentElement, this.getPos = e.getPos, this.onResize = e.onResize, this.onCommit = e.onCommit, this.onUpdate = e.onUpdate, e.options?.min && (this.minSize = {
8138
8163
  ...this.minSize,
8139
8164
  ...e.options.min
8140
- }), e.options?.max && (this.maxSize = e.options.max), !(e == null || (t = e.options) == null) && t.directions && (this.directions = e.options.directions), e.options?.preserveAspectRatio && (this.preserveAspectRatio = e.options.preserveAspectRatio), e.options?.className && (this.classNames = {
8165
+ }), e.options?.max && (this.maxSize = e.options.max), e != null && (t = e.options) != null && t.directions && (this.directions = e.options.directions), e.options?.preserveAspectRatio && (this.preserveAspectRatio = e.options.preserveAspectRatio), e.options?.className && (this.classNames = {
8141
8166
  container: e.options.className.container || "",
8142
8167
  wrapper: e.options.className.wrapper || "",
8143
8168
  handle: e.options.className.handle || "",
@@ -8155,7 +8180,7 @@ var dd = (e, t) => ud(e, t), fd = (e) => "touches" in e, pd = class {
8155
8180
  e !== this.lastEditableState && (this.lastEditableState = e, e ? e && this.handleMap.size === 0 && this.attachHandles() : this.removeHandles());
8156
8181
  }
8157
8182
  update(e, t, n) {
8158
- return e.type === this.node.type ? (this.node = e, !this.onUpdate || this.onUpdate(e, t, n)) : !1;
8183
+ return e.type === this.node.type && (this.node = e, !this.onUpdate || this.onUpdate(e, t, n));
8159
8184
  }
8160
8185
  destroy() {
8161
8186
  this.isResizing && (this.container.dataset.resizeState = "false", this.classNames.resizing && this.container.classList.remove(this.classNames.resizing), document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("mouseup", this.handleMouseUp), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("keyup", this.handleKeyUp), this.isResizing = !1, this.activeHandle = null), this.editor.off("update", this.handleEditorUpdate.bind(this)), this.container.remove();
@@ -8299,7 +8324,7 @@ var dd = (e, t) => ud(e, t), fd = (e) => "touches" in e, pd = class {
8299
8324
  if (!this.dom) return !1;
8300
8325
  if (typeof this.options.stopEvent == "function") return this.options.stopEvent({ event: e });
8301
8326
  let t = e.target;
8302
- if (!(this.dom.contains(t) && !this.contentDOM?.contains(t))) return !1;
8327
+ if (!this.dom.contains(t) || this.contentDOM?.contains(t)) return !1;
8303
8328
  let n = e.type.startsWith("drag"), r = e.type === "dragover" || e.type === "dragenter", i = e.type === "drop";
8304
8329
  if (([
8305
8330
  "INPUT",
@@ -8327,10 +8352,10 @@ var dd = (e, t) => ud(e, t), fd = (e) => "touches" in e, pd = class {
8327
8352
  updateAttributes(e) {
8328
8353
  this.editor.commands.command(({ tr: t }) => {
8329
8354
  let n = this.getPos();
8330
- return typeof n == "number" ? (t.setNodeMarkup(n, void 0, {
8355
+ return typeof n == "number" && (t.setNodeMarkup(n, void 0, {
8331
8356
  ...this.node.attrs,
8332
8357
  ...e
8333
- }), !0) : !1;
8358
+ }), !0);
8334
8359
  });
8335
8360
  }
8336
8361
  deleteNode() {
@@ -8405,4 +8430,4 @@ var bd = class {
8405
8430
  //#endregion
8406
8431
  export { Ms as $, cc as $t, Ra as A, lo as An, uo as At, vo as B, rd as Bn, Ro as Bt, xl as C, Xl as Cn, Ws as Ct, Yc as D, Fs as Dn, ys as Dt, ns as E, _c as En, dd as Et, Cl as F, fs as Fn, jl as Ft, is as G, fa as Gn, Pl as Gt, wl as H, La as Hn, Qs as Ht, Qu as I, nd as In, us as It, as as J, rc as Jt, Cs as K, U as Kn, tc as Kt, Dl as L, yd as Ln, Xs as Lt, nu as M, So as Mn, Js as Mt, gc as N, Zl as Nn, ds as Nt, Ql as O, ou as On, yu as Ot, bo as P, ws as Pn, Ys as Pt, Os as Q, sc as Qt, wo as R, td as Rn, Fo as Rt, Yu as S, no as Sn, ks as St, Sl as T, Du as Tn, hc as Tt, Bu as U, Ia as Un, $s as Ut, Al as V, Na as Vn, Zs as Vt, rs as W, Fa as Wn, Ml as Wt, vs as X, ac as Xt, cs as Y, ic as Yt, Ds as Z, oc as Zt, gd as _, gs as _n, Hs as _t, Gu as a, pc as an, ls as at, md as b, ed as bn, Tl as bt, ld as c, Fl as cn, Y as ct, mc as d, fo as dn, Ns as dt, lc as en, Ps as et, xu as f, yl as fn, J as ft, Uu as g, lu as gn, Ss as gt, Ju as h, su as hn, Es as ht, bl as i, ec as in, Z as it, $o as j, yc as jn, qs as jt, $l as k, Ts as kn, Ks as kt, qu as l, co as ln, zs as lt, hd as m, _d as mn, _s as mt, Gc as n, dc as nn, Ls as nt, bu as o, to as on, ts as ot, fu as p, $u as pn, Vs as pt, ss as q, W as qn, nc as qt, Ku as r, fc as rn, Rs as rt, $ as s, po as sn, ao as st, za as t, uc as tn, ps as tt, pu as u, Il as un, Bs as ut, Su as v, uu as vn, Uo as vt, Q as w, ru as wn, js as wt, bd as x, vd as xn, As as xt, pd as y, X as yn, Us as yt, Wo as z, du as zn, Gs as zt };
8407
8432
 
8408
- //# sourceMappingURL=dist-CbvLhouk.js.map
8433
+ //# sourceMappingURL=dist-1Ah9gEL8.js.map