@jinntec/jinntap 1.2.0 → 1.4.0

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.
@@ -98,7 +98,7 @@ $.from = function(r) {
98
98
  if (r) for (var t in r) e.push(t, r[t]);
99
99
  return new $(e);
100
100
  };
101
- function ji(r, e, t) {
101
+ function Vi(r, e, t) {
102
102
  for (let n = 0; ; n++) {
103
103
  if (n == r.childCount || n == e.childCount)
104
104
  return r.childCount == e.childCount ? null : t;
@@ -115,14 +115,14 @@ function ji(r, e, t) {
115
115
  return t;
116
116
  }
117
117
  if (i.content.size || s.content.size) {
118
- let o = ji(i.content, s.content, t + 1);
118
+ let o = Vi(i.content, s.content, t + 1);
119
119
  if (o != null)
120
120
  return o;
121
121
  }
122
122
  t += i.nodeSize;
123
123
  }
124
124
  }
125
- function Hi(r, e, t, n) {
125
+ function ji(r, e, t, n) {
126
126
  for (let i = r.childCount, s = e.childCount; ; ) {
127
127
  if (i == 0 || s == 0)
128
128
  return i == s ? null : { a: t, b: n };
@@ -140,7 +140,7 @@ function Hi(r, e, t, n) {
140
140
  return { a: t, b: n };
141
141
  }
142
142
  if (o.content.size || l.content.size) {
143
- let c = Hi(o.content, l.content, t - 1, n - 1);
143
+ let c = ji(o.content, l.content, t - 1, n - 1);
144
144
  if (c)
145
145
  return c;
146
146
  }
@@ -309,7 +309,7 @@ class b {
309
309
  fragment differ, or `null` if they are the same.
310
310
  */
311
311
  findDiffStart(e, t = 0) {
312
- return ji(this, e, t);
312
+ return Vi(this, e, t);
313
313
  }
314
314
  /**
315
315
  Find the first position, searching from the end, at which this
@@ -318,7 +318,7 @@ class b {
318
318
  nodes, an object with two separate positions is returned.
319
319
  */
320
320
  findDiffEnd(e, t = this.size, n = e.size) {
321
- return Hi(this, e, t, n);
321
+ return ji(this, e, t, n);
322
322
  }
323
323
  /**
324
324
  Find the index and inner offset corresponding to a given relative
@@ -562,14 +562,14 @@ class k {
562
562
  @internal
563
563
  */
564
564
  insertAt(e, t) {
565
- let n = Ji(this.content, e + this.openStart, t);
565
+ let n = Wi(this.content, e + this.openStart, t);
566
566
  return n && new k(n, this.openStart, this.openEnd);
567
567
  }
568
568
  /**
569
569
  @internal
570
570
  */
571
571
  removeBetween(e, t) {
572
- return new k(Wi(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd);
572
+ return new k(Hi(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd);
573
573
  }
574
574
  /**
575
575
  Tests whether this slice is equal to another slice.
@@ -617,7 +617,7 @@ class k {
617
617
  }
618
618
  }
619
619
  k.empty = new k(b.empty, 0, 0);
620
- function Wi(r, e, t) {
620
+ function Hi(r, e, t) {
621
621
  let { index: n, offset: i } = r.findIndex(e), s = r.maybeChild(n), { index: o, offset: l } = r.findIndex(t);
622
622
  if (i == e || s.isText) {
623
623
  if (l != t && !r.child(o).isText)
@@ -626,44 +626,44 @@ function Wi(r, e, t) {
626
626
  }
627
627
  if (n != o)
628
628
  throw new RangeError("Removing non-flat range");
629
- return r.replaceChild(n, s.copy(Wi(s.content, e - i - 1, t - i - 1)));
629
+ return r.replaceChild(n, s.copy(Hi(s.content, e - i - 1, t - i - 1)));
630
630
  }
631
- function Ji(r, e, t, n) {
631
+ function Wi(r, e, t, n) {
632
632
  let { index: i, offset: s } = r.findIndex(e), o = r.maybeChild(i);
633
633
  if (s == e || o.isText)
634
634
  return r.cut(0, e).append(t).append(r.cut(e));
635
- let l = Ji(o.content, e - s - 1, t);
635
+ let l = Wi(o.content, e - s - 1, t);
636
636
  return l && r.replaceChild(i, o.copy(l));
637
637
  }
638
- function vo(r, e, t) {
638
+ function Ao(r, e, t) {
639
639
  if (t.openStart > r.depth)
640
640
  throw new Ht("Inserted content deeper than insertion position");
641
641
  if (r.depth - t.openStart != e.depth - t.openEnd)
642
642
  throw new Ht("Inconsistent open depths");
643
- return qi(r, e, t, 0);
643
+ return Ji(r, e, t, 0);
644
644
  }
645
- function qi(r, e, t, n) {
645
+ function Ji(r, e, t, n) {
646
646
  let i = r.index(n), s = r.node(n);
647
647
  if (i == e.index(n) && n < r.depth - t.openStart) {
648
- let o = qi(r, e, t, n + 1);
648
+ let o = Ji(r, e, t, n + 1);
649
649
  return s.copy(s.content.replaceChild(i, o));
650
650
  } else if (t.content.size)
651
651
  if (!t.openStart && !t.openEnd && r.depth == n && e.depth == n) {
652
652
  let o = r.parent, l = o.content;
653
653
  return Fe(o, l.cut(0, r.parentOffset).append(t.content).append(l.cut(e.parentOffset)));
654
654
  } else {
655
- let { start: o, end: l } = Do(t, r);
656
- return Fe(s, Ui(r, o, l, e, n));
655
+ let { start: o, end: l } = vo(t, r);
656
+ return Fe(s, Ki(r, o, l, e, n));
657
657
  }
658
658
  else return Fe(s, Wt(r, e, n));
659
659
  }
660
- function Ki(r, e) {
660
+ function qi(r, e) {
661
661
  if (!e.type.compatibleContent(r.type))
662
662
  throw new Ht("Cannot join " + e.type.name + " onto " + r.type.name);
663
663
  }
664
664
  function Fn(r, e, t) {
665
665
  let n = r.node(t);
666
- return Ki(n, e.node(t)), n;
666
+ return qi(n, e.node(t)), n;
667
667
  }
668
668
  function ze(r, e) {
669
669
  let t = e.length - 1;
@@ -679,9 +679,9 @@ function ut(r, e, t, n) {
679
679
  function Fe(r, e) {
680
680
  return r.type.checkContent(e), r.copy(e);
681
681
  }
682
- function Ui(r, e, t, n, i) {
682
+ function Ki(r, e, t, n, i) {
683
683
  let s = r.depth > i && Fn(r, e, i + 1), o = n.depth > i && Fn(t, n, i + 1), l = [];
684
- return ut(null, r, i, l), s && o && e.index(i) == t.index(i) ? (Ki(s, o), ze(Fe(s, Ui(r, e, t, n, i + 1)), l)) : (s && ze(Fe(s, Wt(r, e, i + 1)), l), ut(e, t, i, l), o && ze(Fe(o, Wt(t, n, i + 1)), l)), ut(n, null, i, l), new b(l);
684
+ return ut(null, r, i, l), s && o && e.index(i) == t.index(i) ? (qi(s, o), ze(Fe(s, Ki(r, e, t, n, i + 1)), l)) : (s && ze(Fe(s, Wt(r, e, i + 1)), l), ut(e, t, i, l), o && ze(Fe(o, Wt(t, n, i + 1)), l)), ut(n, null, i, l), new b(l);
685
685
  }
686
686
  function Wt(r, e, t) {
687
687
  let n = [];
@@ -691,7 +691,7 @@ function Wt(r, e, t) {
691
691
  }
692
692
  return ut(e, null, t, n), new b(n);
693
693
  }
694
- function Do(r, e) {
694
+ function vo(r, e) {
695
695
  let t = e.depth - r.openStart, i = e.node(t).copy(r.content);
696
696
  for (let s = t - 1; s >= 0; s--)
697
697
  i = e.node(s).copy(b.from(i));
@@ -942,17 +942,17 @@ class mt {
942
942
  return o;
943
943
  }
944
944
  else
945
- Nr.set(e, n = new Io());
945
+ Nr.set(e, n = new Do());
946
946
  let i = n.elts[n.i] = mt.resolve(e, t);
947
- return n.i = (n.i + 1) % Po, i;
947
+ return n.i = (n.i + 1) % Io, i;
948
948
  }
949
949
  }
950
- class Io {
950
+ class Do {
951
951
  constructor() {
952
952
  this.elts = [], this.i = 0;
953
953
  }
954
954
  }
955
- const Po = 12, Nr = /* @__PURE__ */ new WeakMap();
955
+ const Io = 12, Nr = /* @__PURE__ */ new WeakMap();
956
956
  class Jt {
957
957
  /**
958
958
  Construct a node range. `$from` and `$to` should point into the
@@ -993,7 +993,7 @@ class Jt {
993
993
  return this.$to.indexAfter(this.depth);
994
994
  }
995
995
  }
996
- const Ro = /* @__PURE__ */ Object.create(null);
996
+ const Po = /* @__PURE__ */ Object.create(null);
997
997
  let Me = class Ln {
998
998
  /**
999
999
  @internal
@@ -1112,7 +1112,7 @@ let Me = class Ln {
1112
1112
  attributes, and marks.
1113
1113
  */
1114
1114
  hasMarkup(e, t, n) {
1115
- return this.type == e && jt(this.attrs, t || e.defaultAttrs || Ro) && D.sameSet(this.marks, n || D.none);
1115
+ return this.type == e && jt(this.attrs, t || e.defaultAttrs || Po) && D.sameSet(this.marks, n || D.none);
1116
1116
  }
1117
1117
  /**
1118
1118
  Create a new node with the same markup as this node, containing
@@ -1155,7 +1155,7 @@ let Me = class Ln {
1155
1155
  [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
1156
1156
  */
1157
1157
  replace(e, t, n) {
1158
- return vo(this.resolve(e), this.resolve(t), n);
1158
+ return Ao(this.resolve(e), this.resolve(t), n);
1159
1159
  }
1160
1160
  /**
1161
1161
  Find the node directly after the given position.
@@ -1270,7 +1270,7 @@ let Me = class Ln {
1270
1270
  if (this.type.spec.toDebugString)
1271
1271
  return this.type.spec.toDebugString(this);
1272
1272
  let e = this.type.name;
1273
- return this.content.size && (e += "(" + this.content.toStringInner() + ")"), _i(this.marks, e);
1273
+ return this.content.size && (e += "(" + this.content.toStringInner() + ")"), Ui(this.marks, e);
1274
1274
  }
1275
1275
  /**
1276
1276
  Get the content match in this node at the given index.
@@ -1374,7 +1374,7 @@ class qt extends Me {
1374
1374
  this.text = n;
1375
1375
  }
1376
1376
  toString() {
1377
- return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : _i(this.marks, JSON.stringify(this.text));
1377
+ return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : Ui(this.marks, JSON.stringify(this.text));
1378
1378
  }
1379
1379
  get textContent() {
1380
1380
  return this.text;
@@ -1402,7 +1402,7 @@ class qt extends Me {
1402
1402
  return e.text = this.text, e;
1403
1403
  }
1404
1404
  }
1405
- function _i(r, e) {
1405
+ function Ui(r, e) {
1406
1406
  for (let t = r.length - 1; t >= 0; t--)
1407
1407
  e = r[t].type.name + "(" + e + ")";
1408
1408
  return e;
@@ -1418,13 +1418,13 @@ class je {
1418
1418
  @internal
1419
1419
  */
1420
1420
  static parse(e, t) {
1421
- let n = new Bo(e, t);
1421
+ let n = new Ro(e, t);
1422
1422
  if (n.next == null)
1423
1423
  return je.empty;
1424
- let i = Gi(n);
1424
+ let i = _i(n);
1425
1425
  n.next && n.err("Unexpected trailing text");
1426
- let s = Ho(jo(i));
1427
- return Wo(s, n), s;
1426
+ let s = jo(Vo(i));
1427
+ return Ho(s, n), s;
1428
1428
  }
1429
1429
  /**
1430
1430
  Match a node type, returning a match after that node if
@@ -1570,7 +1570,7 @@ class je {
1570
1570
  }
1571
1571
  }
1572
1572
  je.empty = new je(!0);
1573
- class Bo {
1573
+ class Ro {
1574
1574
  constructor(e, t) {
1575
1575
  this.string = e, this.nodeTypes = t, this.inline = null, this.pos = 0, this.tokens = e.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
1576
1576
  }
@@ -1584,22 +1584,22 @@ class Bo {
1584
1584
  throw new SyntaxError(e + " (in content expression '" + this.string + "')");
1585
1585
  }
1586
1586
  }
1587
- function Gi(r) {
1587
+ function _i(r) {
1588
1588
  let e = [];
1589
1589
  do
1590
- e.push(zo(r));
1590
+ e.push(Bo(r));
1591
1591
  while (r.eat("|"));
1592
1592
  return e.length == 1 ? e[0] : { type: "choice", exprs: e };
1593
1593
  }
1594
- function zo(r) {
1594
+ function Bo(r) {
1595
1595
  let e = [];
1596
1596
  do
1597
- e.push(Fo(r));
1597
+ e.push(zo(r));
1598
1598
  while (r.next && r.next != ")" && r.next != "|");
1599
1599
  return e.length == 1 ? e[0] : { type: "seq", exprs: e };
1600
1600
  }
1601
- function Fo(r) {
1602
- let e = Vo(r);
1601
+ function zo(r) {
1602
+ let e = $o(r);
1603
1603
  for (; ; )
1604
1604
  if (r.eat("+"))
1605
1605
  e = { type: "plus", expr: e };
@@ -1608,7 +1608,7 @@ function Fo(r) {
1608
1608
  else if (r.eat("?"))
1609
1609
  e = { type: "opt", expr: e };
1610
1610
  else if (r.eat("{"))
1611
- e = Lo(r, e);
1611
+ e = Fo(r, e);
1612
1612
  else
1613
1613
  break;
1614
1614
  return e;
@@ -1618,11 +1618,11 @@ function Ar(r) {
1618
1618
  let e = Number(r.next);
1619
1619
  return r.pos++, e;
1620
1620
  }
1621
- function Lo(r, e) {
1621
+ function Fo(r, e) {
1622
1622
  let t = Ar(r), n = t;
1623
1623
  return r.eat(",") && (r.next != "}" ? n = Ar(r) : n = -1), r.eat("}") || r.err("Unclosed braced range"), { type: "range", min: t, max: n, expr: e };
1624
1624
  }
1625
- function $o(r, e) {
1625
+ function Lo(r, e) {
1626
1626
  let t = r.nodeTypes, n = t[e];
1627
1627
  if (n)
1628
1628
  return [n];
@@ -1633,18 +1633,18 @@ function $o(r, e) {
1633
1633
  }
1634
1634
  return i.length == 0 && r.err("No node type or group '" + e + "' found"), i;
1635
1635
  }
1636
- function Vo(r) {
1636
+ function $o(r) {
1637
1637
  if (r.eat("(")) {
1638
- let e = Gi(r);
1638
+ let e = _i(r);
1639
1639
  return r.eat(")") || r.err("Missing closing paren"), e;
1640
1640
  } else if (/\W/.test(r.next))
1641
1641
  r.err("Unexpected token '" + r.next + "'");
1642
1642
  else {
1643
- let e = $o(r, r.next).map((t) => (r.inline == null ? r.inline = t.isInline : r.inline != t.isInline && r.err("Mixing inline and block content"), { type: "name", value: t }));
1643
+ let e = Lo(r, r.next).map((t) => (r.inline == null ? r.inline = t.isInline : r.inline != t.isInline && r.err("Mixing inline and block content"), { type: "name", value: t }));
1644
1644
  return r.pos++, e.length == 1 ? e[0] : { type: "choice", exprs: e };
1645
1645
  }
1646
1646
  }
1647
- function jo(r) {
1647
+ function Vo(r) {
1648
1648
  let e = [[]];
1649
1649
  return i(s(r, 0), t()), e;
1650
1650
  function t() {
@@ -1698,12 +1698,12 @@ function jo(r) {
1698
1698
  }
1699
1699
  }
1700
1700
  }
1701
- function Yi(r, e) {
1701
+ function Gi(r, e) {
1702
1702
  return e - r;
1703
1703
  }
1704
1704
  function vr(r, e) {
1705
1705
  let t = [];
1706
- return n(e), t.sort(Yi);
1706
+ return n(e), t.sort(Gi);
1707
1707
  function n(i) {
1708
1708
  let s = r[i];
1709
1709
  if (s.length == 1 && !s[0].term)
@@ -1715,7 +1715,7 @@ function vr(r, e) {
1715
1715
  }
1716
1716
  }
1717
1717
  }
1718
- function Ho(r) {
1718
+ function jo(r) {
1719
1719
  let e = /* @__PURE__ */ Object.create(null);
1720
1720
  return t(vr(r, 0));
1721
1721
  function t(n) {
@@ -1734,13 +1734,13 @@ function Ho(r) {
1734
1734
  });
1735
1735
  let s = e[n.join(",")] = new je(n.indexOf(r.length - 1) > -1);
1736
1736
  for (let o = 0; o < i.length; o++) {
1737
- let l = i[o][1].sort(Yi);
1737
+ let l = i[o][1].sort(Gi);
1738
1738
  s.next.push({ type: i[o][0], next: e[l.join(",")] || t(l) });
1739
1739
  }
1740
1740
  return s;
1741
1741
  }
1742
1742
  }
1743
- function Wo(r, e) {
1743
+ function Ho(r, e) {
1744
1744
  for (let t = 0, n = [r]; t < n.length; t++) {
1745
1745
  let i = n[t], s = !i.validEnd, o = [];
1746
1746
  for (let l = 0; l < i.next.length; l++) {
@@ -1750,7 +1750,7 @@ function Wo(r, e) {
1750
1750
  s && e.err("Only non-generatable nodes (" + o.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
1751
1751
  }
1752
1752
  }
1753
- function Xi(r) {
1753
+ function Yi(r) {
1754
1754
  let e = /* @__PURE__ */ Object.create(null);
1755
1755
  for (let t in r) {
1756
1756
  let n = r[t];
@@ -1760,7 +1760,7 @@ function Xi(r) {
1760
1760
  }
1761
1761
  return e;
1762
1762
  }
1763
- function Zi(r, e) {
1763
+ function Xi(r, e) {
1764
1764
  let t = /* @__PURE__ */ Object.create(null);
1765
1765
  for (let n in r) {
1766
1766
  let i = e && e[n];
@@ -1775,7 +1775,7 @@ function Zi(r, e) {
1775
1775
  }
1776
1776
  return t;
1777
1777
  }
1778
- function Qi(r, e, t, n) {
1778
+ function Zi(r, e, t, n) {
1779
1779
  for (let i in e)
1780
1780
  if (!(i in r))
1781
1781
  throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);
@@ -1784,19 +1784,19 @@ function Qi(r, e, t, n) {
1784
1784
  s.validate && s.validate(e[i]);
1785
1785
  }
1786
1786
  }
1787
- function es(r, e) {
1787
+ function Qi(r, e) {
1788
1788
  let t = /* @__PURE__ */ Object.create(null);
1789
1789
  if (e)
1790
1790
  for (let n in e)
1791
- t[n] = new qo(r, n, e[n]);
1791
+ t[n] = new Jo(r, n, e[n]);
1792
1792
  return t;
1793
1793
  }
1794
- let Dr = class ts {
1794
+ let Dr = class es {
1795
1795
  /**
1796
1796
  @internal
1797
1797
  */
1798
1798
  constructor(e, t, n) {
1799
- this.name = e, this.schema = t, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = es(e, n.attrs), this.defaultAttrs = Xi(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || e == "text"), this.isText = e == "text";
1799
+ this.name = e, this.schema = t, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = Qi(e, n.attrs), this.defaultAttrs = Yi(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || e == "text"), this.isText = e == "text";
1800
1800
  }
1801
1801
  /**
1802
1802
  True if this is an inline type.
@@ -1857,7 +1857,7 @@ let Dr = class ts {
1857
1857
  @internal
1858
1858
  */
1859
1859
  computeAttrs(e) {
1860
- return !e && this.defaultAttrs ? this.defaultAttrs : Zi(this.attrs, e);
1860
+ return !e && this.defaultAttrs ? this.defaultAttrs : Xi(this.attrs, e);
1861
1861
  }
1862
1862
  /**
1863
1863
  Create a `Node` of this type. The given attributes are
@@ -1924,7 +1924,7 @@ let Dr = class ts {
1924
1924
  @internal
1925
1925
  */
1926
1926
  checkAttrs(e) {
1927
- Qi(this.attrs, e, "node", this.name);
1927
+ Zi(this.attrs, e, "node", this.name);
1928
1928
  }
1929
1929
  /**
1930
1930
  Check whether the given mark type is allowed in this node.
@@ -1959,7 +1959,7 @@ let Dr = class ts {
1959
1959
  */
1960
1960
  static compile(e, t) {
1961
1961
  let n = /* @__PURE__ */ Object.create(null);
1962
- e.forEach((s, o) => n[s] = new ts(s, t, o));
1962
+ e.forEach((s, o) => n[s] = new es(s, t, o));
1963
1963
  let i = t.spec.topNode || "doc";
1964
1964
  if (!n[i])
1965
1965
  throw new RangeError("Schema is missing its top node type ('" + i + "')");
@@ -1970,7 +1970,7 @@ let Dr = class ts {
1970
1970
  return n;
1971
1971
  }
1972
1972
  };
1973
- function Jo(r, e, t) {
1973
+ function Wo(r, e, t) {
1974
1974
  let n = t.split("|");
1975
1975
  return (i) => {
1976
1976
  let s = i === null ? "null" : typeof i;
@@ -1978,9 +1978,9 @@ function Jo(r, e, t) {
1978
1978
  throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`);
1979
1979
  };
1980
1980
  }
1981
- class qo {
1981
+ class Jo {
1982
1982
  constructor(e, t, n) {
1983
- this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? Jo(e, t, n.validate) : n.validate;
1983
+ this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? Wo(e, t, n.validate) : n.validate;
1984
1984
  }
1985
1985
  get isRequired() {
1986
1986
  return !this.hasDefault;
@@ -1991,8 +1991,8 @@ class tn {
1991
1991
  @internal
1992
1992
  */
1993
1993
  constructor(e, t, n, i) {
1994
- this.name = e, this.rank = t, this.schema = n, this.spec = i, this.attrs = es(e, i.attrs), this.excluded = null;
1995
- let s = Xi(this.attrs);
1994
+ this.name = e, this.rank = t, this.schema = n, this.spec = i, this.attrs = Qi(e, i.attrs), this.excluded = null;
1995
+ let s = Yi(this.attrs);
1996
1996
  this.instance = s ? new D(this, s) : null;
1997
1997
  }
1998
1998
  /**
@@ -2001,7 +2001,7 @@ class tn {
2001
2001
  they have defaults, will be added.
2002
2002
  */
2003
2003
  create(e = null) {
2004
- return !e && this.instance ? this.instance : new D(this, Zi(this.attrs, e));
2004
+ return !e && this.instance ? this.instance : new D(this, Xi(this.attrs, e));
2005
2005
  }
2006
2006
  /**
2007
2007
  @internal
@@ -2031,7 +2031,7 @@ class tn {
2031
2031
  @internal
2032
2032
  */
2033
2033
  checkAttrs(e) {
2034
- Qi(this.attrs, e, "mark", this.name);
2034
+ Zi(this.attrs, e, "mark", this.name);
2035
2035
  }
2036
2036
  /**
2037
2037
  Queries whether a given mark type is
@@ -2041,7 +2041,7 @@ class tn {
2041
2041
  return this.excluded.indexOf(e) > -1;
2042
2042
  }
2043
2043
  }
2044
- class ns {
2044
+ class ts {
2045
2045
  /**
2046
2046
  Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
2047
2047
  */
@@ -2140,10 +2140,10 @@ function Ir(r, e) {
2140
2140
  }
2141
2141
  return t;
2142
2142
  }
2143
- function Ko(r) {
2143
+ function qo(r) {
2144
2144
  return r.tag != null;
2145
2145
  }
2146
- function Uo(r) {
2146
+ function Ko(r) {
2147
2147
  return r.style != null;
2148
2148
  }
2149
2149
  let dt = class $n {
@@ -2155,9 +2155,9 @@ let dt = class $n {
2155
2155
  this.schema = e, this.rules = t, this.tags = [], this.styles = [];
2156
2156
  let n = this.matchedStyles = [];
2157
2157
  t.forEach((i) => {
2158
- if (Ko(i))
2158
+ if (qo(i))
2159
2159
  this.tags.push(i);
2160
- else if (Uo(i)) {
2160
+ else if (Ko(i)) {
2161
2161
  let s = /[^=]*/.exec(i.style)[0];
2162
2162
  n.indexOf(s) < 0 && n.push(s), this.styles.push(i);
2163
2163
  }
@@ -2193,7 +2193,7 @@ let dt = class $n {
2193
2193
  matchTag(e, t, n) {
2194
2194
  for (let i = n ? this.tags.indexOf(n) + 1 : 0; i < this.tags.length; i++) {
2195
2195
  let s = this.tags[i];
2196
- if (Yo(e, s.tag) && (s.namespace === void 0 || e.namespaceURI == s.namespace) && (!s.context || t.matchesContext(s.context))) {
2196
+ if (Go(e, s.tag) && (s.namespace === void 0 || e.namespaceURI == s.namespace) && (!s.context || t.matchesContext(s.context))) {
2197
2197
  if (s.getAttrs) {
2198
2198
  let o = s.getAttrs(e);
2199
2199
  if (o === !1)
@@ -2261,7 +2261,7 @@ let dt = class $n {
2261
2261
  return e.cached.domParser || (e.cached.domParser = new $n(e, $n.schemaRules(e)));
2262
2262
  }
2263
2263
  };
2264
- const rs = {
2264
+ const ns = {
2265
2265
  address: !0,
2266
2266
  article: !0,
2267
2267
  aside: !0,
@@ -2294,14 +2294,14 @@ const rs = {
2294
2294
  table: !0,
2295
2295
  tfoot: !0,
2296
2296
  ul: !0
2297
- }, _o = {
2297
+ }, Uo = {
2298
2298
  head: !0,
2299
2299
  noscript: !0,
2300
2300
  object: !0,
2301
2301
  script: !0,
2302
2302
  style: !0,
2303
2303
  title: !0
2304
- }, is = { ol: !0, ul: !0 }, gt = 1, Vn = 2, Bt = 4;
2304
+ }, rs = { ol: !0, ul: !0 }, gt = 1, Vn = 2, Bt = 4;
2305
2305
  function Pr(r, e, t) {
2306
2306
  return e != null ? (e ? gt : 0) | (e === "full" ? Vn : 0) : r && r.whitespace == "pre" ? gt | Vn : t & -5;
2307
2307
  }
@@ -2335,7 +2335,7 @@ class vt {
2335
2335
  return !e && this.match && (t = t.append(this.match.fillBefore(b.empty, !0))), this.type ? this.type.create(this.attrs, t, this.marks) : t;
2336
2336
  }
2337
2337
  inlineContext(e) {
2338
- return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !rs.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
2338
+ return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !ns.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
2339
2339
  }
2340
2340
  }
2341
2341
  class Rr {
@@ -2373,14 +2373,14 @@ class Rr {
2373
2373
  let i = this.localPreserveWS, s = this.top;
2374
2374
  (e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
2375
2375
  let o = e.nodeName.toLowerCase(), l;
2376
- is.hasOwnProperty(o) && this.parser.normalizeLists && Go(e);
2376
+ rs.hasOwnProperty(o) && this.parser.normalizeLists && _o(e);
2377
2377
  let a = this.options.ruleFromNode && this.options.ruleFromNode(e) || (l = this.parser.matchTag(e, this, n));
2378
- e: if (a ? a.ignore : _o.hasOwnProperty(o))
2378
+ e: if (a ? a.ignore : Uo.hasOwnProperty(o))
2379
2379
  this.findInside(e), this.ignoreFallback(e, t);
2380
2380
  else if (!a || a.skip || a.closeParent) {
2381
2381
  a && a.closeParent ? this.open = Math.max(0, this.open - 1) : a && a.skip.nodeType && (e = a.skip);
2382
2382
  let c, u = this.needsBlock;
2383
- if (rs.hasOwnProperty(o))
2383
+ if (ns.hasOwnProperty(o))
2384
2384
  s.content.length && s.content[0].isInline && this.open && (this.open--, s = this.top), c = !0, s.type || (this.needsBlock = !0);
2385
2385
  else if (!e.firstChild) {
2386
2386
  this.leafFallback(e, t);
@@ -2607,13 +2607,13 @@ class Rr {
2607
2607
  }
2608
2608
  }
2609
2609
  }
2610
- function Go(r) {
2610
+ function _o(r) {
2611
2611
  for (let e = r.firstChild, t = null; e; e = e.nextSibling) {
2612
2612
  let n = e.nodeType == 1 ? e.nodeName.toLowerCase() : null;
2613
- n && is.hasOwnProperty(n) && t ? (t.appendChild(e), e = t) : n == "li" ? t = e : n && (t = null);
2613
+ n && rs.hasOwnProperty(n) && t ? (t.appendChild(e), e = t) : n == "li" ? t = e : n && (t = null);
2614
2614
  }
2615
2615
  }
2616
- function Yo(r, e) {
2616
+ function Go(r, e) {
2617
2617
  return (r.matches || r.msMatchesSelector || r.webkitMatchesSelector || r.mozMatchesSelector).call(r, e);
2618
2618
  }
2619
2619
  function Br(r) {
@@ -2756,11 +2756,11 @@ function yn(r) {
2756
2756
  return r.document || window.document;
2757
2757
  }
2758
2758
  const Lr = /* @__PURE__ */ new WeakMap();
2759
- function Xo(r) {
2759
+ function Yo(r) {
2760
2760
  let e = Lr.get(r);
2761
- return e === void 0 && Lr.set(r, e = Zo(r)), e;
2761
+ return e === void 0 && Lr.set(r, e = Xo(r)), e;
2762
2762
  }
2763
- function Zo(r) {
2763
+ function Xo(r) {
2764
2764
  let e = null;
2765
2765
  function t(n) {
2766
2766
  if (n && typeof n == "object")
@@ -2786,7 +2786,7 @@ function zt(r, e, t, n) {
2786
2786
  let i = e[0], s;
2787
2787
  if (typeof i != "string")
2788
2788
  throw new RangeError("Invalid array passed to renderSpec");
2789
- if (n && (s = Xo(n)) && s.indexOf(e) > -1)
2789
+ if (n && (s = Yo(n)) && s.indexOf(e) > -1)
2790
2790
  throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
2791
2791
  let o = i.indexOf(" ");
2792
2792
  o > 0 && (t = i.slice(0, o), i = i.slice(o + 1));
@@ -2816,17 +2816,17 @@ function zt(r, e, t, n) {
2816
2816
  }
2817
2817
  return { dom: a, contentDOM: l };
2818
2818
  }
2819
- const ss = 65535, ls = Math.pow(2, 16);
2820
- function Qo(r, e) {
2821
- return r + e * ls;
2819
+ const is = 65535, ss = Math.pow(2, 16);
2820
+ function Zo(r, e) {
2821
+ return r + e * ss;
2822
2822
  }
2823
2823
  function $r(r) {
2824
- return r & ss;
2824
+ return r & is;
2825
2825
  }
2826
- function el(r) {
2827
- return (r - (r & ss)) / ls;
2826
+ function Qo(r) {
2827
+ return (r - (r & is)) / ss;
2828
2828
  }
2829
- const as = 1, cs = 2, Ft = 4, us = 8;
2829
+ const ls = 1, as = 2, Ft = 4, cs = 8;
2830
2830
  class jn {
2831
2831
  /**
2832
2832
  @internal
@@ -2840,19 +2840,19 @@ class jn {
2840
2840
  argument from the document.
2841
2841
  */
2842
2842
  get deleted() {
2843
- return (this.delInfo & us) > 0;
2843
+ return (this.delInfo & cs) > 0;
2844
2844
  }
2845
2845
  /**
2846
2846
  Tells you whether the token before the mapped position was deleted.
2847
2847
  */
2848
2848
  get deletedBefore() {
2849
- return (this.delInfo & (as | Ft)) > 0;
2849
+ return (this.delInfo & (ls | Ft)) > 0;
2850
2850
  }
2851
2851
  /**
2852
2852
  True when the token after the mapped position was deleted.
2853
2853
  */
2854
2854
  get deletedAfter() {
2855
- return (this.delInfo & (cs | Ft)) > 0;
2855
+ return (this.delInfo & (as | Ft)) > 0;
2856
2856
  }
2857
2857
  /**
2858
2858
  Tells whether any of the steps mapped through deletes across the
@@ -2881,7 +2881,7 @@ class X {
2881
2881
  if (!this.inverted)
2882
2882
  for (let i = 0; i < n; i++)
2883
2883
  t += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
2884
- return this.ranges[n * 3] + t + el(e);
2884
+ return this.ranges[n * 3] + t + Qo(e);
2885
2885
  }
2886
2886
  mapResult(e, t = 1) {
2887
2887
  return this._map(e, t, !1);
@@ -2903,8 +2903,8 @@ class X {
2903
2903
  let f = c ? e == a ? -1 : e == d ? 1 : t : t, h = a + i + (f < 0 ? 0 : u);
2904
2904
  if (n)
2905
2905
  return h;
2906
- let p = e == (t < 0 ? a : d) ? null : Qo(l / 3, e - a), m = e == a ? cs : e == d ? as : Ft;
2907
- return (t < 0 ? e != a : e != d) && (m |= us), new jn(h, m, p);
2906
+ let p = e == (t < 0 ? a : d) ? null : Zo(l / 3, e - a), m = e == a ? as : e == d ? ls : Ft;
2907
+ return (t < 0 ? e != a : e != d) && (m |= cs), new jn(h, m, p);
2908
2908
  }
2909
2909
  i += u - c;
2910
2910
  }
@@ -3432,7 +3432,7 @@ function Hn(r, e, t) {
3432
3432
  }
3433
3433
  return !1;
3434
3434
  }
3435
- function tl(r, e, t, n) {
3435
+ function el(r, e, t, n) {
3436
3436
  let i = [], s = [], o, l;
3437
3437
  r.doc.nodesBetween(e, t, (a, c, u) => {
3438
3438
  if (!a.isInline)
@@ -3446,7 +3446,7 @@ function tl(r, e, t, n) {
3446
3446
  }
3447
3447
  }), i.forEach((a) => r.step(a)), s.forEach((a) => r.step(a));
3448
3448
  }
3449
- function nl(r, e, t, n) {
3449
+ function tl(r, e, t, n) {
3450
3450
  let i = [], s = 0;
3451
3451
  r.doc.nodesBetween(e, t, (o, l) => {
3452
3452
  if (!o.isInline)
@@ -3496,7 +3496,7 @@ function or(r, e, t, n = t.contentMatch, i = !0) {
3496
3496
  for (let a = o.length - 1; a >= 0; a--)
3497
3497
  r.step(o[a]);
3498
3498
  }
3499
- function rl(r, e, t) {
3499
+ function nl(r, e, t) {
3500
3500
  return (e == 0 || r.canReplace(e, r.childCount)) && (t == r.childCount || r.canReplace(0, t));
3501
3501
  }
3502
3502
  function st(r) {
@@ -3505,12 +3505,12 @@ function st(r) {
3505
3505
  let i = r.$from.node(n), s = r.$from.index(n), o = r.$to.indexAfter(n);
3506
3506
  if (n < r.depth && i.canReplace(s, o, t))
3507
3507
  return n;
3508
- if (n == 0 || i.type.spec.isolating || !rl(i, s, o))
3508
+ if (n == 0 || i.type.spec.isolating || !nl(i, s, o))
3509
3509
  break;
3510
3510
  }
3511
3511
  return null;
3512
3512
  }
3513
- function il(r, e, t) {
3513
+ function rl(r, e, t) {
3514
3514
  let { $from: n, $to: i, depth: s } = e, o = n.before(s + 1), l = i.after(s + 1), a = o, c = l, u = b.empty, d = 0;
3515
3515
  for (let p = s, m = !1; p > t; p--)
3516
3516
  m || n.index(p) > 0 ? (m = !0, u = b.from(n.node(p).copy(u)), d++) : a--;
@@ -3519,21 +3519,21 @@ function il(r, e, t) {
3519
3519
  m || i.after(p + 1) < i.end(p) ? (m = !0, f = b.from(i.node(p).copy(f)), h++) : c++;
3520
3520
  r.step(new z(a, c, o, l, new k(u.append(f), d, h), u.size - d, !0));
3521
3521
  }
3522
- function ds(r, e, t = null, n = r) {
3523
- let i = sl(r, e), s = i && ol(n, e);
3522
+ function us(r, e, t = null, n = r) {
3523
+ let i = il(r, e), s = i && sl(n, e);
3524
3524
  return s ? i.map(Vr).concat({ type: e, attrs: t }).concat(s.map(Vr)) : null;
3525
3525
  }
3526
3526
  function Vr(r) {
3527
3527
  return { type: r, attrs: null };
3528
3528
  }
3529
- function sl(r, e) {
3529
+ function il(r, e) {
3530
3530
  let { parent: t, startIndex: n, endIndex: i } = r, s = t.contentMatchAt(n).findWrapping(e);
3531
3531
  if (!s)
3532
3532
  return null;
3533
3533
  let o = s.length ? s[0] : e;
3534
3534
  return t.canReplaceWith(n, i, o) ? s : null;
3535
3535
  }
3536
- function ol(r, e) {
3536
+ function sl(r, e) {
3537
3537
  let { parent: t, startIndex: n, endIndex: i } = r, s = t.child(n), o = e.contentMatch.findWrapping(s.type);
3538
3538
  if (!o)
3539
3539
  return null;
@@ -3542,7 +3542,7 @@ function ol(r, e) {
3542
3542
  a = a.matchType(t.child(c).type);
3543
3543
  return !a || !a.validEnd ? null : o;
3544
3544
  }
3545
- function ll(r, e, t) {
3545
+ function ol(r, e, t) {
3546
3546
  let n = b.empty;
3547
3547
  for (let o = t.length - 1; o >= 0; o--) {
3548
3548
  if (n.size) {
@@ -3555,25 +3555,25 @@ function ll(r, e, t) {
3555
3555
  let i = e.start, s = e.end;
3556
3556
  r.step(new z(i, s, i, s, new k(n, 0, 0), t.length, !0));
3557
3557
  }
3558
- function al(r, e, t, n, i) {
3558
+ function ll(r, e, t, n, i) {
3559
3559
  if (!n.isTextblock)
3560
3560
  throw new RangeError("Type given to setBlockType should be a textblock");
3561
3561
  let s = r.steps.length;
3562
3562
  r.doc.nodesBetween(e, t, (o, l) => {
3563
3563
  let a = typeof i == "function" ? i(o) : i;
3564
- if (o.isTextblock && !o.hasMarkup(n, a) && cl(r.doc, r.mapping.slice(s).map(l), n)) {
3564
+ if (o.isTextblock && !o.hasMarkup(n, a) && al(r.doc, r.mapping.slice(s).map(l), n)) {
3565
3565
  let c = null;
3566
3566
  if (n.schema.linebreakReplacement) {
3567
3567
  let h = n.whitespace == "pre", p = !!n.contentMatch.matchType(n.schema.linebreakReplacement);
3568
3568
  h && !p ? c = !1 : !h && p && (c = !0);
3569
3569
  }
3570
- c === !1 && hs(r, o, l, s), or(r, r.mapping.slice(s).map(l, 1), n, void 0, c === null);
3570
+ c === !1 && fs(r, o, l, s), or(r, r.mapping.slice(s).map(l, 1), n, void 0, c === null);
3571
3571
  let u = r.mapping.slice(s), d = u.map(l, 1), f = u.map(l + o.nodeSize, 1);
3572
- return r.step(new z(d, f, d + 1, f - 1, new k(b.from(n.create(a, null, o.marks)), 0, 0), 1, !0)), c === !0 && fs(r, o, l, s), !1;
3572
+ return r.step(new z(d, f, d + 1, f - 1, new k(b.from(n.create(a, null, o.marks)), 0, 0), 1, !0)), c === !0 && ds(r, o, l, s), !1;
3573
3573
  }
3574
3574
  });
3575
3575
  }
3576
- function fs(r, e, t, n) {
3576
+ function ds(r, e, t, n) {
3577
3577
  e.forEach((i, s) => {
3578
3578
  if (i.isText) {
3579
3579
  let o, l = /\r?\n|\r/g;
@@ -3584,7 +3584,7 @@ function fs(r, e, t, n) {
3584
3584
  }
3585
3585
  });
3586
3586
  }
3587
- function hs(r, e, t, n) {
3587
+ function fs(r, e, t, n) {
3588
3588
  e.forEach((i, s) => {
3589
3589
  if (i.type == i.type.schema.linebreakReplacement) {
3590
3590
  let o = r.mapping.slice(n).map(t + 1 + s);
@@ -3593,11 +3593,11 @@ function hs(r, e, t, n) {
3593
3593
  }
3594
3594
  });
3595
3595
  }
3596
- function cl(r, e, t) {
3596
+ function al(r, e, t) {
3597
3597
  let n = r.resolve(e), i = n.index();
3598
3598
  return n.parent.canReplaceWith(i, i + 1, t);
3599
3599
  }
3600
- function ul(r, e, t, n, i) {
3600
+ function cl(r, e, t, n, i) {
3601
3601
  let s = r.doc.nodeAt(e);
3602
3602
  if (!s)
3603
3603
  throw new RangeError("No node at given position");
@@ -3626,7 +3626,7 @@ function me(r, e, t = 1, n) {
3626
3626
  let l = i.indexAfter(s), a = n && n[0];
3627
3627
  return i.node(s).canReplaceWith(l, l, a ? a.type : i.node(s + 1).type);
3628
3628
  }
3629
- function dl(r, e, t = 1, n) {
3629
+ function ul(r, e, t = 1, n) {
3630
3630
  let i = r.doc.resolve(e), s = b.empty, o = b.empty;
3631
3631
  for (let l = i.depth, a = i.depth - t, c = t - 1; l > a; l--, c--) {
3632
3632
  s = b.from(i.node(l).copy(s));
@@ -3637,9 +3637,9 @@ function dl(r, e, t = 1, n) {
3637
3637
  }
3638
3638
  function qe(r, e) {
3639
3639
  let t = r.resolve(e), n = t.index();
3640
- return ps(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(n, n + 1);
3640
+ return hs(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(n, n + 1);
3641
3641
  }
3642
- function fl(r, e) {
3642
+ function dl(r, e) {
3643
3643
  e.content.size || r.type.compatibleContent(e.type);
3644
3644
  let t = r.contentMatchAt(r.childCount), { linebreakReplacement: n } = r.type.schema;
3645
3645
  for (let i = 0; i < e.childCount; i++) {
@@ -3649,21 +3649,21 @@ function fl(r, e) {
3649
3649
  }
3650
3650
  return t.validEnd;
3651
3651
  }
3652
- function ps(r, e) {
3653
- return !!(r && e && !r.isLeaf && fl(r, e));
3652
+ function hs(r, e) {
3653
+ return !!(r && e && !r.isLeaf && dl(r, e));
3654
3654
  }
3655
3655
  function nn(r, e, t = -1) {
3656
3656
  let n = r.resolve(e);
3657
3657
  for (let i = n.depth; ; i--) {
3658
3658
  let s, o, l = n.index(i);
3659
- if (i == n.depth ? (s = n.nodeBefore, o = n.nodeAfter) : t > 0 ? (s = n.node(i + 1), l++, o = n.node(i).maybeChild(l)) : (s = n.node(i).maybeChild(l - 1), o = n.node(i + 1)), s && !s.isTextblock && ps(s, o) && n.node(i).canReplace(l, l + 1))
3659
+ if (i == n.depth ? (s = n.nodeBefore, o = n.nodeAfter) : t > 0 ? (s = n.node(i + 1), l++, o = n.node(i).maybeChild(l)) : (s = n.node(i).maybeChild(l - 1), o = n.node(i + 1)), s && !s.isTextblock && hs(s, o) && n.node(i).canReplace(l, l + 1))
3660
3660
  return e;
3661
3661
  if (i == 0)
3662
3662
  break;
3663
3663
  e = t < 0 ? n.before(i) : n.after(i);
3664
3664
  }
3665
3665
  }
3666
- function hl(r, e, t) {
3666
+ function fl(r, e, t) {
3667
3667
  let n = null, { linebreakReplacement: i } = r.doc.type.schema, s = r.doc.resolve(e - t), o = s.node().type;
3668
3668
  if (i && o.inlineContent) {
3669
3669
  let u = o.whitespace == "pre", d = !!o.contentMatch.matchType(i);
@@ -3672,17 +3672,17 @@ function hl(r, e, t) {
3672
3672
  let l = r.steps.length;
3673
3673
  if (n === !1) {
3674
3674
  let u = r.doc.resolve(e + t);
3675
- hs(r, u.node(), u.before(), l);
3675
+ fs(r, u.node(), u.before(), l);
3676
3676
  }
3677
3677
  o.inlineContent && or(r, e + t - 1, o, s.node().contentMatchAt(s.index()), n == null);
3678
3678
  let a = r.mapping.slice(l), c = a.map(e - t);
3679
3679
  if (r.step(new P(c, a.map(e + t, -1), k.empty, !0)), n === !0) {
3680
3680
  let u = r.doc.resolve(c);
3681
- fs(r, u.node(), u.before(), r.steps.length);
3681
+ ds(r, u.node(), u.before(), r.steps.length);
3682
3682
  }
3683
3683
  return r;
3684
3684
  }
3685
- function pl(r, e, t) {
3685
+ function hl(r, e, t) {
3686
3686
  let n = r.resolve(e);
3687
3687
  if (n.parent.canReplaceWith(n.index(), n.index(), t))
3688
3688
  return e;
@@ -3704,7 +3704,7 @@ function pl(r, e, t) {
3704
3704
  }
3705
3705
  return null;
3706
3706
  }
3707
- function ml(r, e, t) {
3707
+ function pl(r, e, t) {
3708
3708
  let n = r.resolve(e);
3709
3709
  if (!t.content.size)
3710
3710
  return e;
@@ -3729,12 +3729,12 @@ function rn(r, e, t = e, n = k.empty) {
3729
3729
  if (e == t && !n.size)
3730
3730
  return null;
3731
3731
  let i = r.resolve(e), s = r.resolve(t);
3732
- return ms(i, s, n) ? new P(e, t, n) : new gl(i, s, n).fit();
3732
+ return ps(i, s, n) ? new P(e, t, n) : new ml(i, s, n).fit();
3733
3733
  }
3734
- function ms(r, e, t) {
3734
+ function ps(r, e, t) {
3735
3735
  return !t.openStart && !t.openEnd && r.start() == e.start() && r.parent.canReplace(r.index(), e.index(), t.content);
3736
3736
  }
3737
- class gl {
3737
+ class ml {
3738
3738
  constructor(e, t, n) {
3739
3739
  this.$from = e, this.$to = t, this.unplaced = n, this.frontier = [], this.placed = b.empty;
3740
3740
  for (let i = 0; i <= e.depth; i++) {
@@ -3825,7 +3825,7 @@ class gl {
3825
3825
  let m = l.child(c), g = d.matchType(m.type);
3826
3826
  if (!g)
3827
3827
  break;
3828
- c++, (c > 1 || a == 0 || m.content.size) && (d = g, u.push(gs(m.mark(f.allowedMarks(m.marks)), c == 1 ? a : 0, c == l.childCount ? h : -1)));
3828
+ c++, (c > 1 || a == 0 || m.content.size) && (d = g, u.push(ms(m.mark(f.allowedMarks(m.marks)), c == 1 ? a : 0, c == l.childCount ? h : -1)));
3829
3829
  }
3830
3830
  let p = c == l.childCount;
3831
3831
  p || (h = -1), this.placed = at(this.placed, t, b.from(u)), this.frontier[t].match = d, p && h < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
@@ -3892,35 +3892,35 @@ function kn(r, e) {
3892
3892
  r = r.firstChild.content;
3893
3893
  return r;
3894
3894
  }
3895
- function gs(r, e, t) {
3895
+ function ms(r, e, t) {
3896
3896
  if (e <= 0)
3897
3897
  return r;
3898
3898
  let n = r.content;
3899
- return e > 1 && (n = n.replaceChild(0, gs(n.firstChild, e - 1, n.childCount == 1 ? t - 1 : 0))), e > 0 && (n = r.type.contentMatch.fillBefore(n).append(n), t <= 0 && (n = n.append(r.type.contentMatch.matchFragment(n).fillBefore(b.empty, !0)))), r.copy(n);
3899
+ return e > 1 && (n = n.replaceChild(0, ms(n.firstChild, e - 1, n.childCount == 1 ? t - 1 : 0))), e > 0 && (n = r.type.contentMatch.fillBefore(n).append(n), t <= 0 && (n = n.append(r.type.contentMatch.matchFragment(n).fillBefore(b.empty, !0)))), r.copy(n);
3900
3900
  }
3901
3901
  function xn(r, e, t, n, i) {
3902
3902
  let s = r.node(e), o = i ? r.indexAfter(e) : r.index(e);
3903
3903
  if (o == s.childCount && !t.compatibleContent(s.type))
3904
3904
  return null;
3905
3905
  let l = n.fillBefore(s.content, !0, o);
3906
- return l && !yl(t, s.content, o) ? l : null;
3906
+ return l && !gl(t, s.content, o) ? l : null;
3907
3907
  }
3908
- function yl(r, e, t) {
3908
+ function gl(r, e, t) {
3909
3909
  for (let n = t; n < e.childCount; n++)
3910
3910
  if (!r.allowsMarks(e.child(n).marks))
3911
3911
  return !0;
3912
3912
  return !1;
3913
3913
  }
3914
- function bl(r) {
3914
+ function yl(r) {
3915
3915
  return r.spec.defining || r.spec.definingForContent;
3916
3916
  }
3917
- function kl(r, e, t, n) {
3917
+ function bl(r, e, t, n) {
3918
3918
  if (!n.size)
3919
3919
  return r.deleteRange(e, t);
3920
3920
  let i = r.doc.resolve(e), s = r.doc.resolve(t);
3921
- if (ms(i, s, n))
3921
+ if (ps(i, s, n))
3922
3922
  return r.step(new P(e, t, n));
3923
- let o = bs(i, r.doc.resolve(t));
3923
+ let o = ys(i, r.doc.resolve(t));
3924
3924
  o[o.length - 1] == 0 && o.pop();
3925
3925
  let l = -(i.depth + 1);
3926
3926
  o.unshift(l);
@@ -3938,7 +3938,7 @@ function kl(r, e, t, n) {
3938
3938
  f = p.content;
3939
3939
  }
3940
3940
  for (let f = u - 1; f >= 0; f--) {
3941
- let h = c[f], p = bl(h.type);
3941
+ let h = c[f], p = yl(h.type);
3942
3942
  if (p && !h.sameMarkup(i.node(Math.abs(l) - 1)))
3943
3943
  u = f;
3944
3944
  else if (p || !h.type.isTextblock)
@@ -3952,7 +3952,7 @@ function kl(r, e, t, n) {
3952
3952
  g < 0 && (y = !1, g = -g);
3953
3953
  let S = i.node(g - 1), w = i.index(g - 1);
3954
3954
  if (S.canReplaceWith(w, w, p.type, p.marks))
3955
- return r.replace(i.before(g), y ? s.after(g) : t, new k(ys(n.content, 0, n.openStart, h), h, n.openEnd));
3955
+ return r.replace(i.before(g), y ? s.after(g) : t, new k(gs(n.content, 0, n.openStart, h), h, n.openEnd));
3956
3956
  }
3957
3957
  }
3958
3958
  let d = r.steps.length;
@@ -3961,10 +3961,10 @@ function kl(r, e, t, n) {
3961
3961
  h < 0 || (e = i.before(h), t = s.after(h));
3962
3962
  }
3963
3963
  }
3964
- function ys(r, e, t, n, i) {
3964
+ function gs(r, e, t, n, i) {
3965
3965
  if (e < t) {
3966
3966
  let s = r.firstChild;
3967
- r = r.replaceChild(0, s.copy(ys(s.content, e + 1, t, n, s)));
3967
+ r = r.replaceChild(0, s.copy(gs(s.content, e + 1, t, n, s)));
3968
3968
  }
3969
3969
  if (e > n) {
3970
3970
  let s = i.contentMatchAt(0), o = s.fillBefore(r).append(r);
@@ -3972,15 +3972,15 @@ function ys(r, e, t, n, i) {
3972
3972
  }
3973
3973
  return r;
3974
3974
  }
3975
- function xl(r, e, t, n) {
3975
+ function kl(r, e, t, n) {
3976
3976
  if (!n.isInline && e == t && r.doc.resolve(e).parent.content.size) {
3977
- let i = pl(r.doc, e, n.type);
3977
+ let i = hl(r.doc, e, n.type);
3978
3978
  i != null && (e = t = i);
3979
3979
  }
3980
3980
  r.replaceRange(e, t, new k(b.from(n), 0, 0));
3981
3981
  }
3982
- function Sl(r, e, t) {
3983
- let n = r.doc.resolve(e), i = r.doc.resolve(t), s = bs(n, i);
3982
+ function xl(r, e, t) {
3983
+ let n = r.doc.resolve(e), i = r.doc.resolve(t), s = ys(n, i);
3984
3984
  for (let o = 0; o < s.length; o++) {
3985
3985
  let l = s[o], a = o == s.length - 1;
3986
3986
  if (a && l == 0 || n.node(l).type.contentMatch.validEnd)
@@ -3993,7 +3993,7 @@ function Sl(r, e, t) {
3993
3993
  return r.delete(n.before(o), t);
3994
3994
  r.delete(e, t);
3995
3995
  }
3996
- function bs(r, e) {
3996
+ function ys(r, e) {
3997
3997
  let t = [], n = Math.min(r.depth, e.depth);
3998
3998
  for (let i = n; i >= 0; i--) {
3999
3999
  let s = r.start(i);
@@ -4084,7 +4084,7 @@ tt = function r(e) {
4084
4084
  tt.prototype = Object.create(Error.prototype);
4085
4085
  tt.prototype.constructor = tt;
4086
4086
  tt.prototype.name = "TransformError";
4087
- class Cl {
4087
+ class Sl {
4088
4088
  /**
4089
4089
  Create a transform that starts with the given document.
4090
4090
  */
@@ -4175,7 +4175,7 @@ class Cl {
4175
4175
  control over what happens.
4176
4176
  */
4177
4177
  replaceRange(e, t, n) {
4178
- return kl(this, e, t, n), this;
4178
+ return bl(this, e, t, n), this;
4179
4179
  }
4180
4180
  /**
4181
4181
  Replace the given range with a node, but use `from` and `to` as
@@ -4187,14 +4187,14 @@ class Cl {
4187
4187
  that parent node.
4188
4188
  */
4189
4189
  replaceRangeWith(e, t, n) {
4190
- return xl(this, e, t, n), this;
4190
+ return kl(this, e, t, n), this;
4191
4191
  }
4192
4192
  /**
4193
4193
  Delete the given range, expanding it to cover fully covered
4194
4194
  parent nodes until a valid replace is found.
4195
4195
  */
4196
4196
  deleteRange(e, t) {
4197
- return Sl(this, e, t), this;
4197
+ return xl(this, e, t), this;
4198
4198
  }
4199
4199
  /**
4200
4200
  Split the content in the given range off from its parent, if there
@@ -4204,14 +4204,14 @@ class Cl {
4204
4204
  sure the lift is valid.
4205
4205
  */
4206
4206
  lift(e, t) {
4207
- return il(this, e, t), this;
4207
+ return rl(this, e, t), this;
4208
4208
  }
4209
4209
  /**
4210
4210
  Join the blocks around the given position. If depth is 2, their
4211
4211
  last and first siblings are also joined, and so on.
4212
4212
  */
4213
4213
  join(e, t = 1) {
4214
- return hl(this, e, t), this;
4214
+ return fl(this, e, t), this;
4215
4215
  }
4216
4216
  /**
4217
4217
  Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
@@ -4219,21 +4219,21 @@ class Cl {
4219
4219
  probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
4220
4220
  */
4221
4221
  wrap(e, t) {
4222
- return ll(this, e, t), this;
4222
+ return ol(this, e, t), this;
4223
4223
  }
4224
4224
  /**
4225
4225
  Set the type of all textblocks (partly) between `from` and `to` to
4226
4226
  the given node type with the given attributes.
4227
4227
  */
4228
4228
  setBlockType(e, t = e, n, i = null) {
4229
- return al(this, e, t, n, i), this;
4229
+ return ll(this, e, t, n, i), this;
4230
4230
  }
4231
4231
  /**
4232
4232
  Change the type, attributes, and/or marks of the node at `pos`.
4233
4233
  When `type` isn't given, the existing node type is preserved,
4234
4234
  */
4235
4235
  setNodeMarkup(e, t, n = null, i) {
4236
- return ul(this, e, t, n, i), this;
4236
+ return cl(this, e, t, n, i), this;
4237
4237
  }
4238
4238
  /**
4239
4239
  Set a single attribute on a given node to a new value.
@@ -4277,13 +4277,13 @@ class Cl {
4277
4277
  use after the split (with the outermost nodes coming first).
4278
4278
  */
4279
4279
  split(e, t = 1, n) {
4280
- return dl(this, e, t, n), this;
4280
+ return ul(this, e, t, n), this;
4281
4281
  }
4282
4282
  /**
4283
4283
  Add the given mark to the inline content between `from` and `to`.
4284
4284
  */
4285
4285
  addMark(e, t, n) {
4286
- return tl(this, e, t, n), this;
4286
+ return el(this, e, t, n), this;
4287
4287
  }
4288
4288
  /**
4289
4289
  Remove marks from inline nodes between `from` and `to`. When
@@ -4292,7 +4292,7 @@ class Cl {
4292
4292
  remove all marks of any type.
4293
4293
  */
4294
4294
  removeMark(e, t, n) {
4295
- return nl(this, e, t, n), this;
4295
+ return tl(this, e, t, n), this;
4296
4296
  }
4297
4297
  /**
4298
4298
  Removes all marks and nodes from the content of the node at
@@ -4312,7 +4312,7 @@ class O {
4312
4312
  `$head`.
4313
4313
  */
4314
4314
  constructor(e, t, n) {
4315
- this.$anchor = e, this.$head = t, this.ranges = n || [new wl(e.min(t), e.max(t))];
4315
+ this.$anchor = e, this.$head = t, this.ranges = n || [new Cl(e.min(t), e.max(t))];
4316
4316
  }
4317
4317
  /**
4318
4318
  The selection's anchor, as an unresolved position.
@@ -4470,7 +4470,7 @@ class O {
4470
4470
  }
4471
4471
  }
4472
4472
  O.prototype.visible = !0;
4473
- class wl {
4473
+ class Cl {
4474
4474
  /**
4475
4475
  Create a range.
4476
4476
  */
@@ -4658,11 +4658,11 @@ class Z extends O {
4658
4658
  return e instanceof Z;
4659
4659
  }
4660
4660
  getBookmark() {
4661
- return Ml;
4661
+ return wl;
4662
4662
  }
4663
4663
  }
4664
4664
  O.jsonID("all", Z);
4665
- const Ml = {
4665
+ const wl = {
4666
4666
  map() {
4667
4667
  return this;
4668
4668
  },
@@ -4700,7 +4700,7 @@ function Wr(r, e, t) {
4700
4700
  }), r.setSelection(O.near(r.doc.resolve(o), t));
4701
4701
  }
4702
4702
  const Jr = 1, qr = 2, Kr = 4;
4703
- class El extends Cl {
4703
+ class Ml extends Sl {
4704
4704
  /**
4705
4705
  @internal
4706
4706
  */
@@ -4859,7 +4859,7 @@ class ct {
4859
4859
  this.name = e, this.init = Ur(t.init, n), this.apply = Ur(t.apply, n);
4860
4860
  }
4861
4861
  }
4862
- const Tl = [
4862
+ const El = [
4863
4863
  new ct("doc", {
4864
4864
  init(r) {
4865
4865
  return r.doc || r.schema.topNodeType.createAndFill();
@@ -4895,7 +4895,7 @@ const Tl = [
4895
4895
  ];
4896
4896
  class Cn {
4897
4897
  constructor(e, t) {
4898
- this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = Tl.slice(), t && t.forEach((n) => {
4898
+ this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = El.slice(), t && t.forEach((n) => {
4899
4899
  if (this.pluginsByKey[n.key])
4900
4900
  throw new RangeError("Adding different instances of a keyed plugin (" + n.key + ")");
4901
4901
  this.plugins.push(n), this.pluginsByKey[n.key] = n, n.spec.state && this.fields.push(new ct(n.key, n.spec.state, n));
@@ -4988,7 +4988,7 @@ class Ye {
4988
4988
  Start a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
4989
4989
  */
4990
4990
  get tr() {
4991
- return new El(this);
4991
+ return new Ml(this);
4992
4992
  }
4993
4993
  /**
4994
4994
  Create a new state.
@@ -5067,10 +5067,10 @@ class Ye {
5067
5067
  }), s;
5068
5068
  }
5069
5069
  }
5070
- function ks(r, e, t) {
5070
+ function bs(r, e, t) {
5071
5071
  for (let n in r) {
5072
5072
  let i = r[n];
5073
- i instanceof Function ? i = i.bind(e) : n == "handleDOMEvents" && (i = ks(i, e, {})), t[n] = i;
5073
+ i instanceof Function ? i = i.bind(e) : n == "handleDOMEvents" && (i = bs(i, e, {})), t[n] = i;
5074
5074
  }
5075
5075
  return t;
5076
5076
  }
@@ -5079,7 +5079,7 @@ class Q {
5079
5079
  Create a plugin.
5080
5080
  */
5081
5081
  constructor(e) {
5082
- this.spec = e, this.props = {}, e.props && ks(e.props, this, this.props), this.key = e.key ? e.key.key : xs("plugin");
5082
+ this.spec = e, this.props = {}, e.props && bs(e.props, this, this.props), this.key = e.key ? e.key.key : ks("plugin");
5083
5083
  }
5084
5084
  /**
5085
5085
  Extract the plugin's state field from an editor state.
@@ -5089,7 +5089,7 @@ class Q {
5089
5089
  }
5090
5090
  }
5091
5091
  const wn = /* @__PURE__ */ Object.create(null);
5092
- function xs(r) {
5092
+ function ks(r) {
5093
5093
  return r in wn ? r + "$" + ++wn[r] : (wn[r] = 0, r + "$");
5094
5094
  }
5095
5095
  class le {
@@ -5097,7 +5097,7 @@ class le {
5097
5097
  Create a plugin key.
5098
5098
  */
5099
5099
  constructor(e = "key") {
5100
- this.key = xs(e);
5100
+ this.key = ks(e);
5101
5101
  }
5102
5102
  /**
5103
5103
  Get the active plugin with this key, if any, from an editor
@@ -5125,18 +5125,18 @@ let Wn = null;
5125
5125
  const he = function(r, e, t) {
5126
5126
  let n = Wn || (Wn = document.createRange());
5127
5127
  return n.setEnd(r, t ?? r.nodeValue.length), n.setStart(r, e || 0), n;
5128
- }, Ol = function() {
5128
+ }, Tl = function() {
5129
5129
  Wn = null;
5130
5130
  }, He = function(r, e, t, n) {
5131
5131
  return t && (_r(r, e, t, n, -1) || _r(r, e, t, n, 1));
5132
- }, Nl = /^(img|br|input|textarea|hr)$/i;
5132
+ }, Ol = /^(img|br|input|textarea|hr)$/i;
5133
5133
  function _r(r, e, t, n, i) {
5134
5134
  for (; ; ) {
5135
5135
  if (r == t && e == n)
5136
5136
  return !0;
5137
5137
  if (e == (i < 0 ? 0 : ne(r))) {
5138
5138
  let s = r.parentNode;
5139
- if (!s || s.nodeType != 1 || Et(r) || Nl.test(r.nodeName) || r.contentEditable == "false")
5139
+ if (!s || s.nodeType != 1 || Et(r) || Ol.test(r.nodeName) || r.contentEditable == "false")
5140
5140
  return !1;
5141
5141
  e = V(r) + (i < 0 ? 0 : 1), r = s;
5142
5142
  } else if (r.nodeType == 1) {
@@ -5150,7 +5150,7 @@ function _r(r, e, t, n, i) {
5150
5150
  function ne(r) {
5151
5151
  return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length;
5152
5152
  }
5153
- function Al(r, e) {
5153
+ function Nl(r, e) {
5154
5154
  for (; ; ) {
5155
5155
  if (r.nodeType == 3 && e)
5156
5156
  return r;
@@ -5164,7 +5164,7 @@ function Al(r, e) {
5164
5164
  return null;
5165
5165
  }
5166
5166
  }
5167
- function vl(r, e) {
5167
+ function Al(r, e) {
5168
5168
  for (; ; ) {
5169
5169
  if (r.nodeType == 3 && e < r.nodeValue.length)
5170
5170
  return r;
@@ -5178,7 +5178,7 @@ function vl(r, e) {
5178
5178
  return null;
5179
5179
  }
5180
5180
  }
5181
- function Dl(r, e, t) {
5181
+ function vl(r, e, t) {
5182
5182
  for (let n = e == 0, i = e == ne(r); n || i; ) {
5183
5183
  if (r == t)
5184
5184
  return !0;
@@ -5201,13 +5201,13 @@ function De(r, e) {
5201
5201
  let t = document.createEvent("Event");
5202
5202
  return t.initEvent("keydown", !0, !0), t.keyCode = r, t.key = t.code = e, t;
5203
5203
  }
5204
- function Il(r) {
5204
+ function Dl(r) {
5205
5205
  let e = r.activeElement;
5206
5206
  for (; e && e.shadowRoot; )
5207
5207
  e = e.shadowRoot.activeElement;
5208
5208
  return e;
5209
5209
  }
5210
- function Pl(r, e, t) {
5210
+ function Il(r, e, t) {
5211
5211
  if (r.caretPositionFromPoint)
5212
5212
  try {
5213
5213
  let n = r.caretPositionFromPoint(e, t);
@@ -5221,10 +5221,10 @@ function Pl(r, e, t) {
5221
5221
  return { node: n.startContainer, offset: Math.min(ne(n.startContainer), n.startOffset) };
5222
5222
  }
5223
5223
  }
5224
- const ue = typeof navigator < "u" ? navigator : null, Gr = typeof document < "u" ? document : null, Ae = ue && ue.userAgent || "", Jn = /Edge\/(\d+)/.exec(Ae), Ss = /MSIE \d/.exec(Ae), qn = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ae), G = !!(Ss || qn || Jn), Ee = Ss ? document.documentMode : qn ? +qn[1] : Jn ? +Jn[1] : 0, oe = !G && /gecko\/(\d+)/i.test(Ae);
5224
+ const ue = typeof navigator < "u" ? navigator : null, Gr = typeof document < "u" ? document : null, Ae = ue && ue.userAgent || "", Jn = /Edge\/(\d+)/.exec(Ae), xs = /MSIE \d/.exec(Ae), qn = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ae), G = !!(xs || qn || Jn), Ee = xs ? document.documentMode : qn ? +qn[1] : Jn ? +Jn[1] : 0, oe = !G && /gecko\/(\d+)/i.test(Ae);
5225
5225
  oe && +(/Firefox\/(\d+)/.exec(Ae) || [0, 0])[1];
5226
- const Kn = !G && /Chrome\/(\d+)/.exec(Ae), J = !!Kn, Cs = Kn ? +Kn[1] : 0, K = !G && !!ue && /Apple Computer/.test(ue.vendor), rt = K && (/Mobile\/\w+/.test(Ae) || !!ue && ue.maxTouchPoints > 2), te = rt || (ue ? /Mac/.test(ue.platform) : !1), Rl = ue ? /Win/.test(ue.platform) : !1, pe = /Android \d/.test(Ae), Tt = !!Gr && "webkitFontSmoothing" in Gr.documentElement.style, Bl = Tt ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
5227
- function zl(r) {
5226
+ const Kn = !G && /Chrome\/(\d+)/.exec(Ae), J = !!Kn, Ss = Kn ? +Kn[1] : 0, K = !G && !!ue && /Apple Computer/.test(ue.vendor), rt = K && (/Mobile\/\w+/.test(Ae) || !!ue && ue.maxTouchPoints > 2), te = rt || (ue ? /Mac/.test(ue.platform) : !1), Pl = ue ? /Win/.test(ue.platform) : !1, pe = /Android \d/.test(Ae), Tt = !!Gr && "webkitFontSmoothing" in Gr.documentElement.style, Rl = Tt ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
5227
+ function Bl(r) {
5228
5228
  let e = r.defaultView && r.defaultView.visualViewport;
5229
5229
  return e ? {
5230
5230
  left: 0,
@@ -5241,7 +5241,7 @@ function zl(r) {
5241
5241
  function fe(r, e) {
5242
5242
  return typeof r == "number" ? r : r[e];
5243
5243
  }
5244
- function Fl(r) {
5244
+ function zl(r) {
5245
5245
  let e = r.getBoundingClientRect(), t = e.width / r.offsetWidth || 1, n = e.height / r.offsetHeight || 1;
5246
5246
  return {
5247
5247
  left: e.left,
@@ -5257,7 +5257,7 @@ function Yr(r, e, t) {
5257
5257
  o = nt(o);
5258
5258
  continue;
5259
5259
  }
5260
- let l = o, a = l == s.body, c = a ? zl(s) : Fl(l), u = 0, d = 0;
5260
+ let l = o, a = l == s.body, c = a ? Bl(s) : zl(l), u = 0, d = 0;
5261
5261
  if (e.top < c.top + fe(n, "top") ? d = -(c.top - e.top + fe(i, "top")) : e.bottom > c.bottom - fe(n, "bottom") && (d = e.bottom - e.top > c.bottom - c.top ? e.top + fe(i, "top") - c.top : e.bottom - c.bottom + fe(i, "bottom")), e.left < c.left + fe(n, "left") ? u = -(c.left - e.left + fe(i, "left")) : e.right > c.right - fe(n, "right") && (u = e.right - c.right + fe(i, "right")), u || d)
5262
5262
  if (a)
5263
5263
  s.defaultView.scrollBy(u, d);
@@ -5273,7 +5273,7 @@ function Yr(r, e, t) {
5273
5273
  o = f == "absolute" ? o.offsetParent : nt(o);
5274
5274
  }
5275
5275
  }
5276
- function Ll(r) {
5276
+ function Fl(r) {
5277
5277
  let e = r.dom.getBoundingClientRect(), t = Math.max(0, e.top), n, i;
5278
5278
  for (let s = (e.left + e.right) / 2, o = t + 1; o < Math.min(innerHeight, e.bottom); o += 5) {
5279
5279
  let l = r.root.elementFromPoint(s, o);
@@ -5285,38 +5285,38 @@ function Ll(r) {
5285
5285
  break;
5286
5286
  }
5287
5287
  }
5288
- return { refDOM: n, refTop: i, stack: ws(r.dom) };
5288
+ return { refDOM: n, refTop: i, stack: Cs(r.dom) };
5289
5289
  }
5290
- function ws(r) {
5290
+ function Cs(r) {
5291
5291
  let e = [], t = r.ownerDocument;
5292
5292
  for (let n = r; n && (e.push({ dom: n, top: n.scrollTop, left: n.scrollLeft }), r != t); n = nt(n))
5293
5293
  ;
5294
5294
  return e;
5295
5295
  }
5296
- function $l({ refDOM: r, refTop: e, stack: t }) {
5296
+ function Ll({ refDOM: r, refTop: e, stack: t }) {
5297
5297
  let n = r ? r.getBoundingClientRect().top : 0;
5298
- Ms(t, n == 0 ? 0 : n - e);
5298
+ ws(t, n == 0 ? 0 : n - e);
5299
5299
  }
5300
- function Ms(r, e) {
5300
+ function ws(r, e) {
5301
5301
  for (let t = 0; t < r.length; t++) {
5302
5302
  let { dom: n, top: i, left: s } = r[t];
5303
5303
  n.scrollTop != i + e && (n.scrollTop = i + e), n.scrollLeft != s && (n.scrollLeft = s);
5304
5304
  }
5305
5305
  }
5306
5306
  let Ke = null;
5307
- function Vl(r) {
5307
+ function $l(r) {
5308
5308
  if (r.setActive)
5309
5309
  return r.setActive();
5310
5310
  if (Ke)
5311
5311
  return r.focus(Ke);
5312
- let e = ws(r);
5312
+ let e = Cs(r);
5313
5313
  r.focus(Ke == null ? {
5314
5314
  get preventScroll() {
5315
5315
  return Ke = { preventScroll: !0 }, !0;
5316
5316
  }
5317
- } : void 0), Ke || (Ke = !1, Ms(e, 0));
5317
+ } : void 0), Ke || (Ke = !1, ws(e, 0));
5318
5318
  }
5319
- function Es(r, e) {
5319
+ function Ms(r, e) {
5320
5320
  let t, n = 2e8, i, s = 0, o = e.top, l = e.top, a, c;
5321
5321
  for (let u = r.firstChild, d = 0; u; u = u.nextSibling, d++) {
5322
5322
  let f;
@@ -5342,9 +5342,9 @@ function Es(r, e) {
5342
5342
  !t && (e.left >= p.right && e.top >= p.top || e.left >= p.left && e.top >= p.bottom) && (s = d + 1);
5343
5343
  }
5344
5344
  }
5345
- return !t && a && (t = a, i = c, n = 0), t && t.nodeType == 3 ? jl(t, i) : !t || n && t.nodeType == 1 ? { node: r, offset: s } : Es(t, i);
5345
+ return !t && a && (t = a, i = c, n = 0), t && t.nodeType == 3 ? Vl(t, i) : !t || n && t.nodeType == 1 ? { node: r, offset: s } : Ms(t, i);
5346
5346
  }
5347
- function jl(r, e) {
5347
+ function Vl(r, e) {
5348
5348
  let t = r.nodeValue.length, n = document.createRange();
5349
5349
  for (let i = 0; i < t; i++) {
5350
5350
  n.setEnd(r, i + 1), n.setStart(r, i);
@@ -5357,19 +5357,19 @@ function jl(r, e) {
5357
5357
  function ar(r, e) {
5358
5358
  return r.left >= e.left - 1 && r.left <= e.right + 1 && r.top >= e.top - 1 && r.top <= e.bottom + 1;
5359
5359
  }
5360
- function Hl(r, e) {
5360
+ function jl(r, e) {
5361
5361
  let t = r.parentNode;
5362
5362
  return t && /^li$/i.test(t.nodeName) && e.left < r.getBoundingClientRect().left ? t : r;
5363
5363
  }
5364
- function Wl(r, e, t) {
5365
- let { node: n, offset: i } = Es(e, t), s = -1;
5364
+ function Hl(r, e, t) {
5365
+ let { node: n, offset: i } = Ms(e, t), s = -1;
5366
5366
  if (n.nodeType == 1 && !n.firstChild) {
5367
5367
  let o = n.getBoundingClientRect();
5368
5368
  s = o.left != o.right && t.left > (o.left + o.right) / 2 ? 1 : -1;
5369
5369
  }
5370
5370
  return r.docView.posFromDOM(n, i, s);
5371
5371
  }
5372
- function Jl(r, e, t, n) {
5372
+ function Wl(r, e, t, n) {
5373
5373
  let i = -1;
5374
5374
  for (let s = e, o = !1; s != r.dom; ) {
5375
5375
  let l = r.docView.nearestDesc(s, !0), a;
@@ -5382,7 +5382,7 @@ function Jl(r, e, t, n) {
5382
5382
  }
5383
5383
  return i > -1 ? i : r.docView.posFromDOM(e, t, -1);
5384
5384
  }
5385
- function Ts(r, e, t) {
5385
+ function Es(r, e, t) {
5386
5386
  let n = r.childNodes.length;
5387
5387
  if (n && t.top < t.bottom)
5388
5388
  for (let i = Math.max(0, Math.min(n - 1, Math.floor(n * (e.top - t.top) / (t.bottom - t.top)) - 2)), s = i; ; ) {
@@ -5392,7 +5392,7 @@ function Ts(r, e, t) {
5392
5392
  for (let a = 0; a < l.length; a++) {
5393
5393
  let c = l[a];
5394
5394
  if (ar(e, c))
5395
- return Ts(o, e, c);
5395
+ return Es(o, e, c);
5396
5396
  }
5397
5397
  }
5398
5398
  if ((s = (s + 1) % n) == i)
@@ -5400,27 +5400,27 @@ function Ts(r, e, t) {
5400
5400
  }
5401
5401
  return r;
5402
5402
  }
5403
- function ql(r, e) {
5404
- let t = r.dom.ownerDocument, n, i = 0, s = Pl(t, e.left, e.top);
5403
+ function Jl(r, e) {
5404
+ let t = r.dom.ownerDocument, n, i = 0, s = Il(t, e.left, e.top);
5405
5405
  s && ({ node: n, offset: i } = s);
5406
5406
  let o = (r.root.elementFromPoint ? r.root : t).elementFromPoint(e.left, e.top), l;
5407
5407
  if (!o || !r.dom.contains(o.nodeType != 1 ? o.parentNode : o)) {
5408
5408
  let c = r.dom.getBoundingClientRect();
5409
- if (!ar(e, c) || (o = Ts(r.dom, e, c), !o))
5409
+ if (!ar(e, c) || (o = Es(r.dom, e, c), !o))
5410
5410
  return null;
5411
5411
  }
5412
5412
  if (K)
5413
5413
  for (let c = o; n && c; c = nt(c))
5414
5414
  c.draggable && (n = void 0);
5415
- if (o = Hl(o, e), n) {
5415
+ if (o = jl(o, e), n) {
5416
5416
  if (oe && n.nodeType == 1 && (i = Math.min(i, n.childNodes.length), i < n.childNodes.length)) {
5417
5417
  let u = n.childNodes[i], d;
5418
5418
  u.nodeName == "IMG" && (d = u.getBoundingClientRect()).right <= e.left && d.bottom > e.top && i++;
5419
5419
  }
5420
5420
  let c;
5421
- Tt && i && n.nodeType == 1 && (c = n.childNodes[i - 1]).nodeType == 1 && c.contentEditable == "false" && c.getBoundingClientRect().top >= e.top && i--, n == r.dom && i == n.childNodes.length - 1 && n.lastChild.nodeType == 1 && e.top > n.lastChild.getBoundingClientRect().bottom ? l = r.state.doc.content.size : (i == 0 || n.nodeType != 1 || n.childNodes[i - 1].nodeName != "BR") && (l = Jl(r, n, i, e));
5421
+ Tt && i && n.nodeType == 1 && (c = n.childNodes[i - 1]).nodeType == 1 && c.contentEditable == "false" && c.getBoundingClientRect().top >= e.top && i--, n == r.dom && i == n.childNodes.length - 1 && n.lastChild.nodeType == 1 && e.top > n.lastChild.getBoundingClientRect().bottom ? l = r.state.doc.content.size : (i == 0 || n.nodeType != 1 || n.childNodes[i - 1].nodeName != "BR") && (l = Wl(r, n, i, e));
5422
5422
  }
5423
- l == null && (l = Wl(r, o, e));
5423
+ l == null && (l = Hl(r, o, e));
5424
5424
  let a = r.docView.nearestDesc(o, !0);
5425
5425
  return { pos: l, inside: a ? a.posAtStart - a.border : -1 };
5426
5426
  }
@@ -5436,11 +5436,11 @@ function ye(r, e) {
5436
5436
  }
5437
5437
  return Array.prototype.find.call(t, Xr) || r.getBoundingClientRect();
5438
5438
  }
5439
- const Kl = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
5440
- function Os(r, e, t) {
5439
+ const ql = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
5440
+ function Ts(r, e, t) {
5441
5441
  let { node: n, offset: i, atom: s } = r.docView.domFromPos(e, t < 0 ? -1 : 1), o = Tt || oe;
5442
5442
  if (n.nodeType == 3)
5443
- if (o && (Kl.test(n.nodeValue) || (t < 0 ? !i : i == n.nodeValue.length))) {
5443
+ if (o && (ql.test(n.nodeValue) || (t < 0 ? !i : i == n.nodeValue.length))) {
5444
5444
  let a = ye(he(n, i, i), t);
5445
5445
  if (oe && i && /\s/.test(n.nodeValue[i - 1]) && i < n.nodeValue.length) {
5446
5446
  let c = ye(he(n, i - 1, i - 1), -1);
@@ -5495,7 +5495,7 @@ function Mn(r, e) {
5495
5495
  let t = e ? r.top : r.bottom;
5496
5496
  return { top: t, bottom: t, left: r.left, right: r.right };
5497
5497
  }
5498
- function Ns(r, e, t) {
5498
+ function Os(r, e, t) {
5499
5499
  let n = r.state, i = r.root.activeElement;
5500
5500
  n != e && r.updateState(e), i != r.dom && r.focus();
5501
5501
  try {
@@ -5504,9 +5504,9 @@ function Ns(r, e, t) {
5504
5504
  n != e && r.updateState(n), i != r.dom && i && i.focus();
5505
5505
  }
5506
5506
  }
5507
- function Ul(r, e, t) {
5507
+ function Kl(r, e, t) {
5508
5508
  let n = e.selection, i = t == "up" ? n.$from : n.$to;
5509
- return Ns(r, e, () => {
5509
+ return Os(r, e, () => {
5510
5510
  let { node: s } = r.docView.domFromPos(i.pos, t == "up" ? -1 : 1);
5511
5511
  for (; ; ) {
5512
5512
  let l = r.docView.nearestDesc(s, !0);
@@ -5518,7 +5518,7 @@ function Ul(r, e, t) {
5518
5518
  }
5519
5519
  s = l.dom.parentNode;
5520
5520
  }
5521
- let o = Os(r, i.pos, 1);
5521
+ let o = Ts(r, i.pos, 1);
5522
5522
  for (let l = s.firstChild; l; l = l.nextSibling) {
5523
5523
  let a;
5524
5524
  if (l.nodeType == 1)
@@ -5536,13 +5536,13 @@ function Ul(r, e, t) {
5536
5536
  return !0;
5537
5537
  });
5538
5538
  }
5539
- const _l = /[\u0590-\u08ac]/;
5540
- function Gl(r, e, t) {
5539
+ const Ul = /[\u0590-\u08ac]/;
5540
+ function _l(r, e, t) {
5541
5541
  let { $head: n } = e.selection;
5542
5542
  if (!n.parent.isTextblock)
5543
5543
  return !1;
5544
5544
  let i = n.parentOffset, s = !i, o = i == n.parent.content.size, l = r.domSelection();
5545
- return l ? !_l.test(n.parent.textContent) || !l.modify ? t == "left" || t == "backward" ? s : o : Ns(r, e, () => {
5545
+ return l ? !Ul.test(n.parent.textContent) || !l.modify ? t == "left" || t == "backward" ? s : o : Os(r, e, () => {
5546
5546
  let { focusNode: a, focusOffset: c, anchorNode: u, anchorOffset: d } = r.domSelectionRange(), f = l.caretBidiLevel;
5547
5547
  l.modify("move", t, "character");
5548
5548
  let h = n.depth ? r.docView.domAfterPos(n.before()) : r.dom, { focusNode: p, focusOffset: m } = r.domSelectionRange(), g = p && !h.contains(p.nodeType == 1 ? p : p.parentNode) || a == p && c == m;
@@ -5554,8 +5554,8 @@ function Gl(r, e, t) {
5554
5554
  }) : n.pos == n.start() || n.pos == n.end();
5555
5555
  }
5556
5556
  let Zr = null, Qr = null, ei = !1;
5557
- function Yl(r, e, t) {
5558
- return Zr == e && Qr == t ? ei : (Zr = e, Qr = t, ei = t == "up" || t == "down" ? Ul(r, e, t) : Gl(r, e, t));
5557
+ function Gl(r, e, t) {
5558
+ return Zr == e && Qr == t ? ei : (Zr = e, Qr = t, ei = t == "up" || t == "down" ? Kl(r, e, t) : _l(r, e, t));
5559
5559
  }
5560
5560
  const ie = 0, ti = 1, Pe = 2, de = 3;
5561
5561
  class Ot {
@@ -5729,7 +5729,7 @@ class Ot {
5729
5729
  let n = 0, i = 0;
5730
5730
  for (let s = 0; n < this.children.length; n++) {
5731
5731
  let o = this.children[n], l = s + o.size;
5732
- if (l > e || o instanceof vs) {
5732
+ if (l > e || o instanceof As) {
5733
5733
  i = e - s;
5734
5734
  break;
5735
5735
  }
@@ -5737,7 +5737,7 @@ class Ot {
5737
5737
  }
5738
5738
  if (i)
5739
5739
  return this.children[n].domFromPos(i - this.children[n].border, t);
5740
- for (let s; n && !(s = this.children[n - 1]).size && s instanceof As && s.side >= 0; n--)
5740
+ for (let s; n && !(s = this.children[n - 1]).size && s instanceof Ns && s.side >= 0; n--)
5741
5741
  ;
5742
5742
  if (t <= 0) {
5743
5743
  let s, o = !0;
@@ -5899,7 +5899,7 @@ class Ot {
5899
5899
  return !1;
5900
5900
  }
5901
5901
  }
5902
- class As extends Ot {
5902
+ class Ns extends Ot {
5903
5903
  constructor(e, t, n, i) {
5904
5904
  let s, o = t.type.toDOM;
5905
5905
  if (typeof o == "function" && (o = o(n, () => {
@@ -5939,7 +5939,7 @@ class As extends Ot {
5939
5939
  return this.widget.type.side;
5940
5940
  }
5941
5941
  }
5942
- class Xl extends Ot {
5942
+ class Yl extends Ot {
5943
5943
  constructor(e, t, n, i) {
5944
5944
  super(e, [], t, null), this.textDOM = n, this.text = i;
5945
5945
  }
@@ -6020,7 +6020,7 @@ class Te extends Ot {
6020
6020
  } else u || ({ dom: u, contentDOM: d } = Je.renderSpec(document, t.type.spec.toDOM(t), null, t.attrs));
6021
6021
  !d && !t.isText && u.nodeName != "BR" && (u.hasAttribute("contenteditable") || (u.contentEditable = "false"), t.type.spec.draggable && (u.draggable = !0));
6022
6022
  let f = u;
6023
- return u = Ps(u, n, t), c ? a = new Zl(e, t, n, i, u, d || null, f, c, s, o + 1) : t.isText ? new ln(e, t, n, i, u, f, s) : new Te(e, t, n, i, u, d || null, f, s, o + 1);
6023
+ return u = Is(u, n, t), c ? a = new Xl(e, t, n, i, u, d || null, f, c, s, o + 1) : t.isText ? new ln(e, t, n, i, u, f, s) : new Te(e, t, n, i, u, d || null, f, s, o + 1);
6024
6024
  }
6025
6025
  parseRule() {
6026
6026
  if (this.node.type.spec.reparseInView)
@@ -6056,14 +6056,14 @@ class Te extends Ot {
6056
6056
  // separate step, syncs the DOM inside `this.contentDOM` to
6057
6057
  // `this.children`.
6058
6058
  updateChildren(e, t) {
6059
- let n = this.node.inlineContent, i = t, s = e.composing ? this.localCompositionInfo(e, t) : null, o = s && s.pos > -1 ? s : null, l = s && s.pos < 0, a = new ea(this, o && o.node, e);
6060
- ra(this.node, this.innerDeco, (c, u, d) => {
6059
+ let n = this.node.inlineContent, i = t, s = e.composing ? this.localCompositionInfo(e, t) : null, o = s && s.pos > -1 ? s : null, l = s && s.pos < 0, a = new Ql(this, o && o.node, e);
6060
+ na(this.node, this.innerDeco, (c, u, d) => {
6061
6061
  c.spec.marks ? a.syncToMarks(c.spec.marks, n, e) : c.type.side >= 0 && !d && a.syncToMarks(u == this.node.childCount ? D.none : this.node.child(u).marks, n, e), a.placeWidget(c, e, i);
6062
6062
  }, (c, u, d, f) => {
6063
6063
  a.syncToMarks(c.marks, n, e);
6064
6064
  let h;
6065
6065
  a.findNodeMatch(c, u, d, f) || l && e.state.selection.from > i && e.state.selection.to < i + c.nodeSize && (h = a.findIndexWithChild(s.node)) > -1 && a.updateNodeAt(c, u, d, h, e) || a.updateNextNode(c, u, d, e, f, i) || a.addNode(c, u, d, e, i), i += c.nodeSize;
6066
- }), a.syncToMarks([], n, e), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || this.dirty == Pe) && (o && this.protectLocalComposition(e, o), Ds(this.contentDOM, this.children, e), rt && ia(this.dom));
6066
+ }), a.syncToMarks([], n, e), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || this.dirty == Pe) && (o && this.protectLocalComposition(e, o), vs(this.contentDOM, this.children, e), rt && ra(this.dom));
6067
6067
  }
6068
6068
  localCompositionInfo(e, t) {
6069
6069
  let { from: n, to: i } = e.state.selection;
@@ -6073,7 +6073,7 @@ class Te extends Ot {
6073
6073
  if (!s || !this.dom.contains(s.parentNode))
6074
6074
  return null;
6075
6075
  if (this.node.inlineContent) {
6076
- let o = s.nodeValue, l = sa(this.node.content, o, n - t, i - t);
6076
+ let o = s.nodeValue, l = ia(this.node.content, o, n - t, i - t);
6077
6077
  return l < 0 ? null : { node: s, pos: l, text: o };
6078
6078
  } else
6079
6079
  return { node: s, pos: -1, text: "" };
@@ -6089,7 +6089,7 @@ class Te extends Ot {
6089
6089
  s.parentNode.removeChild(s.nextSibling);
6090
6090
  s.pmViewDesc && (s.pmViewDesc = void 0);
6091
6091
  }
6092
- let o = new Xl(this, s, t, i);
6092
+ let o = new Yl(this, s, t, i);
6093
6093
  e.input.compositionNodes.push(o), this.children = _n(this.children, n, n + i.length, e, o);
6094
6094
  }
6095
6095
  // If this desc must be updated to match the given node decoration,
@@ -6104,7 +6104,7 @@ class Te extends Ot {
6104
6104
  if (Kt(e, this.outerDeco))
6105
6105
  return;
6106
6106
  let t = this.nodeDOM.nodeType != 1, n = this.dom;
6107
- this.dom = Is(this.dom, this.nodeDOM, Un(this.outerDeco, this.node, t), Un(e, this.node, t)), this.dom != n && (n.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
6107
+ this.dom = Ds(this.dom, this.nodeDOM, Un(this.outerDeco, this.node, t), Un(e, this.node, t)), this.dom != n && (n.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
6108
6108
  }
6109
6109
  // Mark this node as being the selected node.
6110
6110
  selectNode() {
@@ -6119,7 +6119,7 @@ class Te extends Ot {
6119
6119
  }
6120
6120
  }
6121
6121
  function ni(r, e, t, n, i) {
6122
- Ps(n, e, r);
6122
+ Is(n, e, r);
6123
6123
  let s = new Te(void 0, r, e, t, n, n, n, i, 0);
6124
6124
  return s.contentDOM && s.updateChildren(i, 0), s;
6125
6125
  }
@@ -6166,7 +6166,7 @@ class ln extends Te {
6166
6166
  return this.node.text == e;
6167
6167
  }
6168
6168
  }
6169
- class vs extends Ot {
6169
+ class As extends Ot {
6170
6170
  parseRule() {
6171
6171
  return { ignore: !0 };
6172
6172
  }
@@ -6180,7 +6180,7 @@ class vs extends Ot {
6180
6180
  return this.dom.nodeName == "IMG";
6181
6181
  }
6182
6182
  }
6183
- class Zl extends Te {
6183
+ class Xl extends Te {
6184
6184
  constructor(e, t, n, i, s, o, l, a, c, u) {
6185
6185
  super(e, t, n, i, s, o, l, c, u), this.spec = a;
6186
6186
  }
@@ -6214,7 +6214,7 @@ class Zl extends Te {
6214
6214
  return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
6215
6215
  }
6216
6216
  }
6217
- function Ds(r, e, t) {
6217
+ function vs(r, e, t) {
6218
6218
  let n = r.firstChild, i = !1;
6219
6219
  for (let s = 0; s < e.length; s++) {
6220
6220
  let o = e[s], l = o.dom;
@@ -6226,7 +6226,7 @@ function Ds(r, e, t) {
6226
6226
  i = !0, r.insertBefore(l, n);
6227
6227
  if (o instanceof We) {
6228
6228
  let a = n ? n.previousSibling : r.lastChild;
6229
- Ds(o.contentDOM, o.children, t), n = a ? a.nextSibling : r.firstChild;
6229
+ vs(o.contentDOM, o.children, t), n = a ? a.nextSibling : r.firstChild;
6230
6230
  }
6231
6231
  }
6232
6232
  for (; n; )
@@ -6254,7 +6254,7 @@ function Un(r, e, t) {
6254
6254
  }
6255
6255
  return i;
6256
6256
  }
6257
- function Is(r, e, t, n) {
6257
+ function Ds(r, e, t, n) {
6258
6258
  if (t == Re && n == Re)
6259
6259
  return e;
6260
6260
  let i = e;
@@ -6264,11 +6264,11 @@ function Is(r, e, t, n) {
6264
6264
  let a;
6265
6265
  l && l.nodeName == o.nodeName && i != r && (a = i.parentNode) && a.nodeName.toLowerCase() == o.nodeName || (a = document.createElement(o.nodeName), a.pmIsDeco = !0, a.appendChild(i), l = Re[0]), i = a;
6266
6266
  }
6267
- Ql(i, l || Re[0], o);
6267
+ Zl(i, l || Re[0], o);
6268
6268
  }
6269
6269
  return i;
6270
6270
  }
6271
- function Ql(r, e, t) {
6271
+ function Zl(r, e, t) {
6272
6272
  for (let n in e)
6273
6273
  n != "class" && n != "style" && n != "nodeName" && !(n in t) && r.removeAttribute(n);
6274
6274
  for (let n in t)
@@ -6290,8 +6290,8 @@ function Ql(r, e, t) {
6290
6290
  t.style && (r.style.cssText += t.style);
6291
6291
  }
6292
6292
  }
6293
- function Ps(r, e, t) {
6294
- return Is(r, r, Re, Un(e, t, r.nodeType != 1));
6293
+ function Is(r, e, t) {
6294
+ return Ds(r, r, Re, Un(e, t, r.nodeType != 1));
6295
6295
  }
6296
6296
  function Kt(r, e) {
6297
6297
  if (r.length != e.length)
@@ -6305,9 +6305,9 @@ function ri(r) {
6305
6305
  let e = r.nextSibling;
6306
6306
  return r.parentNode.removeChild(r), e;
6307
6307
  }
6308
- class ea {
6308
+ class Ql {
6309
6309
  constructor(e, t, n) {
6310
- this.lock = t, this.view = n, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = ta(e.node.content, e);
6310
+ this.lock = t, this.view = n, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = ea(e.node.content, e);
6311
6311
  }
6312
6312
  // Destroy and remove the children between the given indices in
6313
6313
  // `this.top`.
@@ -6428,7 +6428,7 @@ class ea {
6428
6428
  if (i && i.matchesWidget(e) && (e == i.widget || !i.widget.type.toDOM.parentNode))
6429
6429
  this.index++;
6430
6430
  else {
6431
- let s = new As(this.top, e, t, n);
6431
+ let s = new Ns(this.top, e, t, n);
6432
6432
  this.top.children.splice(this.index++, 0, s), this.changed = !0;
6433
6433
  }
6434
6434
  }
@@ -6447,7 +6447,7 @@ class ea {
6447
6447
  else {
6448
6448
  let n = document.createElement(e);
6449
6449
  e == "IMG" && (n.className = "ProseMirror-separator", n.alt = ""), e == "BR" && (n.className = "ProseMirror-trailingBreak");
6450
- let i = new vs(this.top, [], n, null);
6450
+ let i = new As(this.top, [], n, null);
6451
6451
  t != this.top ? t.children.push(i) : t.children.splice(this.index++, 0, i), this.changed = !0;
6452
6452
  }
6453
6453
  }
@@ -6455,7 +6455,7 @@ class ea {
6455
6455
  return this.lock && (e == this.lock || e.nodeType == 1 && e.contains(this.lock.parentNode));
6456
6456
  }
6457
6457
  }
6458
- function ta(r, e) {
6458
+ function ea(r, e) {
6459
6459
  let t = e, n = t.children.length, i = r.childCount, s = /* @__PURE__ */ new Map(), o = [];
6460
6460
  e: for (; i > 0; ) {
6461
6461
  let l;
@@ -6482,10 +6482,10 @@ function ta(r, e) {
6482
6482
  }
6483
6483
  return { index: i, matched: s, matches: o.reverse() };
6484
6484
  }
6485
- function na(r, e) {
6485
+ function ta(r, e) {
6486
6486
  return r.type.side - e.type.side;
6487
6487
  }
6488
- function ra(r, e, t, n) {
6488
+ function na(r, e, t, n) {
6489
6489
  let i = e.locals(r), s = 0;
6490
6490
  if (i.length == 0) {
6491
6491
  for (let c = 0; c < r.childCount; c++) {
@@ -6503,7 +6503,7 @@ function ra(r, e, t, n) {
6503
6503
  }
6504
6504
  if (u)
6505
6505
  if (d) {
6506
- d.sort(na);
6506
+ d.sort(ta);
6507
6507
  for (let g = 0; g < d.length; g++)
6508
6508
  t(d[g], c, !!a);
6509
6509
  } else
@@ -6533,13 +6533,13 @@ function ra(r, e, t, n) {
6533
6533
  n(f, m, e.forChild(s, f), h), s = p;
6534
6534
  }
6535
6535
  }
6536
- function ia(r) {
6536
+ function ra(r) {
6537
6537
  if (r.nodeName == "UL" || r.nodeName == "OL") {
6538
6538
  let e = r.style.cssText;
6539
6539
  r.style.cssText = e + "; list-style: square !important", window.getComputedStyle(r).listStyle, r.style.cssText = e;
6540
6540
  }
6541
6541
  }
6542
- function sa(r, e, t, n) {
6542
+ function ia(r, e, t, n) {
6543
6543
  for (let i = 0, s = 0; i < r.childCount && s <= n; ) {
6544
6544
  let o = r.child(i++), l = s;
6545
6545
  if (s += o.nodeSize, !o.isText)
@@ -6583,7 +6583,7 @@ function cr(r, e = null) {
6583
6583
  for (a = o; i && !i.node; )
6584
6584
  i = i.parent;
6585
6585
  let d = i.node;
6586
- if (i && d.isAtom && C.isSelectable(d) && i.parent && !(d.isInline && Dl(t.focusNode, t.focusOffset, i.dom))) {
6586
+ if (i && d.isAtom && C.isSelectable(d) && i.parent && !(d.isInline && vl(t.focusNode, t.focusOffset, i.dom))) {
6587
6587
  let f = i.posBefore;
6588
6588
  c = new C(o == f ? l : n.resolve(f));
6589
6589
  }
@@ -6609,12 +6609,12 @@ function cr(r, e = null) {
6609
6609
  }
6610
6610
  return c;
6611
6611
  }
6612
- function Rs(r) {
6613
- return r.editable ? r.hasFocus() : zs(r) && document.activeElement && document.activeElement.contains(r.dom);
6612
+ function Ps(r) {
6613
+ return r.editable ? r.hasFocus() : Bs(r) && document.activeElement && document.activeElement.contains(r.dom);
6614
6614
  }
6615
6615
  function ge(r, e = !1) {
6616
6616
  let t = r.state.selection;
6617
- if (Bs(r, t), !!Rs(r)) {
6617
+ if (Rs(r, t), !!Ps(r)) {
6618
6618
  if (!e && r.input.mouseDown && r.input.mouseDown.allowDefault && J) {
6619
6619
  let n = r.domSelectionRange(), i = r.domObserver.currentSelection;
6620
6620
  if (n.anchorNode && i.anchorNode && He(n.anchorNode, n.anchorOffset, i.anchorNode, i.anchorOffset)) {
@@ -6623,15 +6623,15 @@ function ge(r, e = !1) {
6623
6623
  }
6624
6624
  }
6625
6625
  if (r.domObserver.disconnectSelection(), r.cursorWrapper)
6626
- la(r);
6626
+ oa(r);
6627
6627
  else {
6628
6628
  let { anchor: n, head: i } = t, s, o;
6629
- ii && !(t instanceof T) && (t.$from.parent.inlineContent || (s = si(r, t.from)), !t.empty && !t.$from.parent.inlineContent && (o = si(r, t.to))), r.docView.setSelection(n, i, r, e), ii && (s && oi(s), o && oi(o)), t.visible ? r.dom.classList.remove("ProseMirror-hideselection") : (r.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && oa(r));
6629
+ ii && !(t instanceof T) && (t.$from.parent.inlineContent || (s = si(r, t.from)), !t.empty && !t.$from.parent.inlineContent && (o = si(r, t.to))), r.docView.setSelection(n, i, r, e), ii && (s && oi(s), o && oi(o)), t.visible ? r.dom.classList.remove("ProseMirror-hideselection") : (r.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && sa(r));
6630
6630
  }
6631
6631
  r.domObserver.setCurSelection(), r.domObserver.connectSelection();
6632
6632
  }
6633
6633
  }
6634
- const ii = K || J && Cs < 63;
6634
+ const ii = K || J && Ss < 63;
6635
6635
  function si(r, e) {
6636
6636
  let { node: t, offset: n } = r.docView.domFromPos(e, 0), i = n < t.childNodes.length ? t.childNodes[n] : null, s = n ? t.childNodes[n - 1] : null;
6637
6637
  if (K && i && i.contentEditable == "false")
@@ -6649,24 +6649,24 @@ function En(r) {
6649
6649
  function oi(r) {
6650
6650
  r.contentEditable = "false", r.wasDraggable && (r.draggable = !0, r.wasDraggable = null);
6651
6651
  }
6652
- function oa(r) {
6652
+ function sa(r) {
6653
6653
  let e = r.dom.ownerDocument;
6654
6654
  e.removeEventListener("selectionchange", r.input.hideSelectionGuard);
6655
6655
  let t = r.domSelectionRange(), n = t.anchorNode, i = t.anchorOffset;
6656
6656
  e.addEventListener("selectionchange", r.input.hideSelectionGuard = () => {
6657
6657
  (t.anchorNode != n || t.anchorOffset != i) && (e.removeEventListener("selectionchange", r.input.hideSelectionGuard), setTimeout(() => {
6658
- (!Rs(r) || r.state.selection.visible) && r.dom.classList.remove("ProseMirror-hideselection");
6658
+ (!Ps(r) || r.state.selection.visible) && r.dom.classList.remove("ProseMirror-hideselection");
6659
6659
  }, 20));
6660
6660
  });
6661
6661
  }
6662
- function la(r) {
6662
+ function oa(r) {
6663
6663
  let e = r.domSelection(), t = document.createRange();
6664
6664
  if (!e)
6665
6665
  return;
6666
6666
  let n = r.cursorWrapper.dom, i = n.nodeName == "IMG";
6667
6667
  i ? t.setStart(n.parentNode, V(n) + 1) : t.setStart(n, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t), !i && !r.state.selection.visible && G && Ee <= 11 && (n.disabled = !0, n.disabled = !1);
6668
6668
  }
6669
- function Bs(r, e) {
6669
+ function Rs(r, e) {
6670
6670
  if (e instanceof C) {
6671
6671
  let t = r.docView.descAt(e.from);
6672
6672
  t != r.lastSelectedViewDesc && (li(r), t && t.selectNode(), r.lastSelectedViewDesc = t);
@@ -6680,9 +6680,9 @@ function ur(r, e, t, n) {
6680
6680
  return r.someProp("createSelectionBetween", (i) => i(r, e, t)) || T.between(e, t, n);
6681
6681
  }
6682
6682
  function ai(r) {
6683
- return r.editable && !r.hasFocus() ? !1 : zs(r);
6683
+ return r.editable && !r.hasFocus() ? !1 : Bs(r);
6684
6684
  }
6685
- function zs(r) {
6685
+ function Bs(r) {
6686
6686
  let e = r.domSelectionRange();
6687
6687
  if (!e.anchorNode)
6688
6688
  return !1;
@@ -6692,7 +6692,7 @@ function zs(r) {
6692
6692
  return !1;
6693
6693
  }
6694
6694
  }
6695
- function aa(r) {
6695
+ function la(r) {
6696
6696
  let e = r.docView.domFromPos(r.state.selection.anchor, 0), t = r.domSelectionRange();
6697
6697
  return He(e.node, e.offset, t.anchorNode, t.anchorOffset);
6698
6698
  }
@@ -6741,9 +6741,9 @@ function ht(r, e) {
6741
6741
  return t && t.size == 0 && (e < 0 || r.nextSibling || r.nodeName != "BR");
6742
6742
  }
6743
6743
  function Ue(r, e) {
6744
- return e < 0 ? ca(r) : ua(r);
6744
+ return e < 0 ? aa(r) : ca(r);
6745
6745
  }
6746
- function ca(r) {
6746
+ function aa(r) {
6747
6747
  let e = r.domSelectionRange(), t = e.focusNode, n = e.focusOffset;
6748
6748
  if (!t)
6749
6749
  return;
@@ -6762,7 +6762,7 @@ function ca(r) {
6762
6762
  break;
6763
6763
  }
6764
6764
  } else {
6765
- if (Fs(t))
6765
+ if (zs(t))
6766
6766
  break;
6767
6767
  {
6768
6768
  let l = t.previousSibling;
@@ -6779,7 +6779,7 @@ function ca(r) {
6779
6779
  }
6780
6780
  o ? Yn(r, t, n) : i && Yn(r, i, s);
6781
6781
  }
6782
- function ua(r) {
6782
+ function ca(r) {
6783
6783
  let e = r.domSelectionRange(), t = e.focusNode, n = e.focusOffset;
6784
6784
  if (!t)
6785
6785
  return;
@@ -6794,7 +6794,7 @@ function ua(r) {
6794
6794
  else
6795
6795
  break;
6796
6796
  } else {
6797
- if (Fs(t))
6797
+ if (zs(t))
6798
6798
  break;
6799
6799
  {
6800
6800
  let l = t.nextSibling;
@@ -6811,11 +6811,11 @@ function ua(r) {
6811
6811
  }
6812
6812
  s && Yn(r, s, o);
6813
6813
  }
6814
- function Fs(r) {
6814
+ function zs(r) {
6815
6815
  let e = r.pmViewDesc;
6816
6816
  return e && e.node && e.node.isBlock;
6817
6817
  }
6818
- function da(r, e) {
6818
+ function ua(r, e) {
6819
6819
  for (; r && e == r.childNodes.length && !Et(r); )
6820
6820
  e = V(r) + 1, r = r.parentNode;
6821
6821
  for (; r && e < r.childNodes.length; ) {
@@ -6827,7 +6827,7 @@ function da(r, e) {
6827
6827
  r = t, e = 0;
6828
6828
  }
6829
6829
  }
6830
- function fa(r, e) {
6830
+ function da(r, e) {
6831
6831
  for (; r && !e && !Et(r); )
6832
6832
  e = V(r), r = r.parentNode;
6833
6833
  for (; r && e; ) {
@@ -6842,7 +6842,7 @@ function fa(r, e) {
6842
6842
  function Yn(r, e, t) {
6843
6843
  if (e.nodeType != 3) {
6844
6844
  let s, o;
6845
- (o = da(e, t)) ? (e = o, t = 0) : (s = fa(e, t)) && (e = s, t = s.nodeValue.length);
6845
+ (o = ua(e, t)) ? (e = o, t = 0) : (s = da(e, t)) && (e = s, t = s.nodeValue.length);
6846
6846
  }
6847
6847
  let n = r.domSelection();
6848
6848
  if (!n)
@@ -6859,7 +6859,7 @@ function Yn(r, e, t) {
6859
6859
  }
6860
6860
  function ui(r, e) {
6861
6861
  let t = r.state.doc.resolve(e);
6862
- if (!(J || Rl) && t.parent.inlineContent) {
6862
+ if (!(J || Pl) && t.parent.inlineContent) {
6863
6863
  let i = r.coordsAtPos(e);
6864
6864
  if (e > t.start()) {
6865
6865
  let s = r.coordsAtPos(e - 1), o = (s.top + s.bottom) / 2;
@@ -6910,7 +6910,7 @@ function fi(r, e) {
6910
6910
  function hi(r, e, t) {
6911
6911
  r.domObserver.stop(), e.contentEditable = t, r.domObserver.start();
6912
6912
  }
6913
- function ha(r) {
6913
+ function fa(r) {
6914
6914
  if (!K || r.state.selection.$head.parentOffset > 0)
6915
6915
  return !1;
6916
6916
  let { focusNode: e, focusOffset: t } = r.domSelectionRange();
@@ -6920,12 +6920,12 @@ function ha(r) {
6920
6920
  }
6921
6921
  return !1;
6922
6922
  }
6923
- function pa(r) {
6923
+ function ha(r) {
6924
6924
  let e = "";
6925
6925
  return r.ctrlKey && (e += "c"), r.metaKey && (e += "m"), r.altKey && (e += "a"), r.shiftKey && (e += "s"), e;
6926
6926
  }
6927
- function ma(r, e) {
6928
- let t = e.keyCode, n = pa(e);
6927
+ function pa(r, e) {
6928
+ let t = e.keyCode, n = ha(e);
6929
6929
  if (t == 8 || te && t == 72 && n == "c")
6930
6930
  return fi(r, -1) || Ue(r, -1);
6931
6931
  if (t == 46 && !e.shiftKey || te && t == 68 && n == "c")
@@ -6942,7 +6942,7 @@ function ma(r, e) {
6942
6942
  if (t == 38 || te && t == 80 && n == "c")
6943
6943
  return di(r, -1, n) || Ue(r, -1);
6944
6944
  if (t == 40 || te && t == 78 && n == "c")
6945
- return ha(r) || di(r, 1, n) || Ue(r, 1);
6945
+ return fa(r) || di(r, 1, n) || Ue(r, 1);
6946
6946
  if (n == (te ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
6947
6947
  return !0;
6948
6948
  }
@@ -6958,10 +6958,10 @@ function dr(r, e) {
6958
6958
  let h = n.firstChild;
6959
6959
  t.push(h.type.name, h.attrs != h.type.defaultAttrs ? h.attrs : null), n = h.content;
6960
6960
  }
6961
- let o = r.someProp("clipboardSerializer") || Je.fromSchema(r.state.schema), l = Ws(), a = l.createElement("div");
6961
+ let o = r.someProp("clipboardSerializer") || Je.fromSchema(r.state.schema), l = Hs(), a = l.createElement("div");
6962
6962
  a.appendChild(o.serializeFragment(n, { document: l }));
6963
6963
  let c = a.firstChild, u, d = 0;
6964
- for (; c && c.nodeType == 1 && (u = Hs[c.nodeName.toLowerCase()]); ) {
6964
+ for (; c && c.nodeType == 1 && (u = js[c.nodeName.toLowerCase()]); ) {
6965
6965
  for (let h = u.length - 1; h >= 0; h--) {
6966
6966
  let p = l.createElement(u[h]);
6967
6967
  for (; a.firstChild; )
@@ -6976,7 +6976,7 @@ function dr(r, e) {
6976
6976
  `);
6977
6977
  return { dom: a, text: f, slice: e };
6978
6978
  }
6979
- function Ls(r, e, t, n, i) {
6979
+ function Fs(r, e, t, n, i) {
6980
6980
  let s = i.parent.type.spec.code, o, l;
6981
6981
  if (!t && !e)
6982
6982
  return null;
@@ -7000,7 +7000,7 @@ function Ls(r, e, t, n, i) {
7000
7000
  } else
7001
7001
  r.someProp("transformPastedHTML", (d) => {
7002
7002
  t = d(t, r);
7003
- }), o = ka(t), Tt && xa(o);
7003
+ }), o = ba(t), Tt && ka(o);
7004
7004
  let c = o && o.querySelector("[data-pm-slice]"), u = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice") || "");
7005
7005
  if (u && u[3])
7006
7006
  for (let d = +u[3]; d > 0; d--) {
@@ -7015,11 +7015,11 @@ function Ls(r, e, t, n, i) {
7015
7015
  preserveWhitespace: !!(a || u),
7016
7016
  context: i,
7017
7017
  ruleFromNode(f) {
7018
- return f.nodeName == "BR" && !f.nextSibling && f.parentNode && !ga.test(f.parentNode.nodeName) ? { ignore: !0 } : null;
7018
+ return f.nodeName == "BR" && !f.nextSibling && f.parentNode && !ma.test(f.parentNode.nodeName) ? { ignore: !0 } : null;
7019
7019
  }
7020
7020
  })), u)
7021
- l = Sa(pi(l, +u[1], +u[2]), u[4]);
7022
- else if (l = k.maxOpen(ya(l.content, i), !0), l.openStart || l.openEnd) {
7021
+ l = xa(pi(l, +u[1], +u[2]), u[4]);
7022
+ else if (l = k.maxOpen(ga(l.content, i), !0), l.openStart || l.openEnd) {
7023
7023
  let d = 0, f = 0;
7024
7024
  for (let h = l.content.firstChild; d < l.openStart && !h.type.spec.isolating; d++, h = h.firstChild)
7025
7025
  ;
@@ -7031,8 +7031,8 @@ function Ls(r, e, t, n, i) {
7031
7031
  l = d(l, r);
7032
7032
  }), l;
7033
7033
  }
7034
- const ga = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
7035
- function ya(r, e) {
7034
+ const ma = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
7035
+ function ga(r, e) {
7036
7036
  if (r.childCount < 2)
7037
7037
  return r;
7038
7038
  for (let t = e.depth; t >= 0; t--) {
@@ -7043,11 +7043,11 @@ function ya(r, e) {
7043
7043
  let a = i.findWrapping(l.type), c;
7044
7044
  if (!a)
7045
7045
  return o = null;
7046
- if (c = o.length && s.length && Vs(a, s, l, o[o.length - 1], 0))
7046
+ if (c = o.length && s.length && $s(a, s, l, o[o.length - 1], 0))
7047
7047
  o[o.length - 1] = c;
7048
7048
  else {
7049
- o.length && (o[o.length - 1] = js(o[o.length - 1], s.length));
7050
- let u = $s(l, a);
7049
+ o.length && (o[o.length - 1] = Vs(o[o.length - 1], s.length));
7050
+ let u = Ls(l, a);
7051
7051
  o.push(u), i = i.matchType(u.type), s = a;
7052
7052
  }
7053
7053
  }), o)
@@ -7055,24 +7055,24 @@ function ya(r, e) {
7055
7055
  }
7056
7056
  return r;
7057
7057
  }
7058
- function $s(r, e, t = 0) {
7058
+ function Ls(r, e, t = 0) {
7059
7059
  for (let n = e.length - 1; n >= t; n--)
7060
7060
  r = e[n].create(null, b.from(r));
7061
7061
  return r;
7062
7062
  }
7063
- function Vs(r, e, t, n, i) {
7063
+ function $s(r, e, t, n, i) {
7064
7064
  if (i < r.length && i < e.length && r[i] == e[i]) {
7065
- let s = Vs(r, e, t, n.lastChild, i + 1);
7065
+ let s = $s(r, e, t, n.lastChild, i + 1);
7066
7066
  if (s)
7067
7067
  return n.copy(n.content.replaceChild(n.childCount - 1, s));
7068
7068
  if (n.contentMatchAt(n.childCount).matchType(i == r.length - 1 ? t.type : r[i + 1]))
7069
- return n.copy(n.content.append(b.from($s(t, r, i + 1))));
7069
+ return n.copy(n.content.append(b.from(Ls(t, r, i + 1))));
7070
7070
  }
7071
7071
  }
7072
- function js(r, e) {
7072
+ function Vs(r, e) {
7073
7073
  if (e == 0)
7074
7074
  return r;
7075
- let t = r.content.replaceChild(r.childCount - 1, js(r.lastChild, e - 1)), n = r.contentMatchAt(r.childCount).fillBefore(b.empty, !0);
7075
+ let t = r.content.replaceChild(r.childCount - 1, Vs(r.lastChild, e - 1)), n = r.contentMatchAt(r.childCount).fillBefore(b.empty, !0);
7076
7076
  return r.copy(t.append(n));
7077
7077
  }
7078
7078
  function Xn(r, e, t, n, i, s) {
@@ -7082,7 +7082,7 @@ function Xn(r, e, t, n, i, s) {
7082
7082
  function pi(r, e, t) {
7083
7083
  return e < r.openStart && (r = new k(Xn(r.content, -1, e, r.openStart, 0, r.openEnd), e, r.openEnd)), t < r.openEnd && (r = new k(Xn(r.content, 1, t, r.openEnd, 0, 0), r.openStart, t)), r;
7084
7084
  }
7085
- const Hs = {
7085
+ const js = {
7086
7086
  thead: ["table"],
7087
7087
  tbody: ["table"],
7088
7088
  tfoot: ["table"],
@@ -7094,31 +7094,31 @@ const Hs = {
7094
7094
  th: ["table", "tbody", "tr"]
7095
7095
  };
7096
7096
  let mi = null;
7097
- function Ws() {
7097
+ function Hs() {
7098
7098
  return mi || (mi = document.implementation.createHTMLDocument("title"));
7099
7099
  }
7100
7100
  let Tn = null;
7101
- function ba(r) {
7101
+ function ya(r) {
7102
7102
  let e = window.trustedTypes;
7103
7103
  return e ? (Tn || (Tn = e.createPolicy("ProseMirrorClipboard", { createHTML: (t) => t })), Tn.createHTML(r)) : r;
7104
7104
  }
7105
- function ka(r) {
7105
+ function ba(r) {
7106
7106
  let e = /^(\s*<meta [^>]*>)*/.exec(r);
7107
7107
  e && (r = r.slice(e[0].length));
7108
- let t = Ws().createElement("div"), n = /<([a-z][^>\s]+)/i.exec(r), i;
7109
- if ((i = n && Hs[n[1].toLowerCase()]) && (r = i.map((s) => "<" + s + ">").join("") + r + i.map((s) => "</" + s + ">").reverse().join("")), t.innerHTML = ba(r), i)
7108
+ let t = Hs().createElement("div"), n = /<([a-z][^>\s]+)/i.exec(r), i;
7109
+ if ((i = n && js[n[1].toLowerCase()]) && (r = i.map((s) => "<" + s + ">").join("") + r + i.map((s) => "</" + s + ">").reverse().join("")), t.innerHTML = ya(r), i)
7110
7110
  for (let s = 0; s < i.length; s++)
7111
7111
  t = t.querySelector(i[s]) || t;
7112
7112
  return t;
7113
7113
  }
7114
- function xa(r) {
7114
+ function ka(r) {
7115
7115
  let e = r.querySelectorAll(J ? "span:not([class]):not([style])" : "span.Apple-converted-space");
7116
7116
  for (let t = 0; t < e.length; t++) {
7117
7117
  let n = e[t];
7118
7118
  n.childNodes.length == 1 && n.textContent == " " && n.parentNode && n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "), n);
7119
7119
  }
7120
7120
  }
7121
- function Sa(r, e) {
7121
+ function xa(r, e) {
7122
7122
  if (!r.size)
7123
7123
  return r;
7124
7124
  let t = r.content.firstChild.type.schema, n;
@@ -7136,25 +7136,25 @@ function Sa(r, e) {
7136
7136
  }
7137
7137
  return new k(i, s, o);
7138
7138
  }
7139
- const U = {}, _ = {}, Ca = { touchstart: !0, touchmove: !0 };
7140
- class wa {
7139
+ const U = {}, _ = {}, Sa = { touchstart: !0, touchmove: !0 };
7140
+ class Ca {
7141
7141
  constructor() {
7142
7142
  this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = { time: 0, x: 0, y: 0, type: "" }, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastFocus = 0, this.lastTouch = 0, this.lastChromeDelete = 0, this.composing = !1, this.compositionNode = null, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.compositionID = 1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = /* @__PURE__ */ Object.create(null), this.hideSelectionGuard = null;
7143
7143
  }
7144
7144
  }
7145
- function Ma(r) {
7145
+ function wa(r) {
7146
7146
  for (let e in U) {
7147
7147
  let t = U[e];
7148
7148
  r.dom.addEventListener(e, r.input.eventHandlers[e] = (n) => {
7149
- Ta(r, n) && !fr(r, n) && (r.editable || !(n.type in _)) && t(r, n);
7150
- }, Ca[e] ? { passive: !0 } : void 0);
7149
+ Ea(r, n) && !fr(r, n) && (r.editable || !(n.type in _)) && t(r, n);
7150
+ }, Sa[e] ? { passive: !0 } : void 0);
7151
7151
  }
7152
7152
  K && r.dom.addEventListener("input", () => null), Zn(r);
7153
7153
  }
7154
7154
  function we(r, e) {
7155
7155
  r.input.lastSelectionOrigin = e, r.input.lastSelectionTime = Date.now();
7156
7156
  }
7157
- function Ea(r) {
7157
+ function Ma(r) {
7158
7158
  r.domObserver.stop();
7159
7159
  for (let e in r.input.eventHandlers)
7160
7160
  r.dom.removeEventListener(e, r.input.eventHandlers[e]);
@@ -7172,7 +7172,7 @@ function fr(r, e) {
7172
7172
  return n ? n(r, e) || e.defaultPrevented : !1;
7173
7173
  });
7174
7174
  }
7175
- function Ta(r, e) {
7175
+ function Ea(r, e) {
7176
7176
  if (!e.bubbles)
7177
7177
  return !0;
7178
7178
  if (e.defaultPrevented)
@@ -7182,25 +7182,25 @@ function Ta(r, e) {
7182
7182
  return !1;
7183
7183
  return !0;
7184
7184
  }
7185
- function Oa(r, e) {
7185
+ function Ta(r, e) {
7186
7186
  !fr(r, e) && U[e.type] && (r.editable || !(e.type in _)) && U[e.type](r, e);
7187
7187
  }
7188
7188
  _.keydown = (r, e) => {
7189
7189
  let t = e;
7190
- if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !qs(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(pe && J && t.keyCode == 13)))
7190
+ if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Js(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(pe && J && t.keyCode == 13)))
7191
7191
  if (t.keyCode != 229 && r.domObserver.forceFlush(), rt && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
7192
7192
  let n = Date.now();
7193
7193
  r.input.lastIOSEnter = n, r.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
7194
7194
  r.input.lastIOSEnter == n && (r.someProp("handleKeyDown", (i) => i(r, De(13, "Enter"))), r.input.lastIOSEnter = 0);
7195
7195
  }, 200);
7196
- } else r.someProp("handleKeyDown", (n) => n(r, t)) || ma(r, t) ? t.preventDefault() : we(r, "key");
7196
+ } else r.someProp("handleKeyDown", (n) => n(r, t)) || pa(r, t) ? t.preventDefault() : we(r, "key");
7197
7197
  };
7198
7198
  _.keyup = (r, e) => {
7199
7199
  e.keyCode == 16 && (r.input.shiftKey = !1);
7200
7200
  };
7201
7201
  _.keypress = (r, e) => {
7202
7202
  let t = e;
7203
- if (qs(r, t) || !t.charCode || t.ctrlKey && !t.altKey || te && t.metaKey)
7203
+ if (Js(r, t) || !t.charCode || t.ctrlKey && !t.altKey || te && t.metaKey)
7204
7204
  return;
7205
7205
  if (r.someProp("handleKeyPress", (i) => i(r, t))) {
7206
7206
  t.preventDefault();
@@ -7215,7 +7215,7 @@ _.keypress = (r, e) => {
7215
7215
  function an(r) {
7216
7216
  return { left: r.clientX, top: r.clientY };
7217
7217
  }
7218
- function Na(r, e) {
7218
+ function Oa(r, e) {
7219
7219
  let t = e.x - r.clientX, n = e.y - r.clientY;
7220
7220
  return t * t + n * n < 100;
7221
7221
  }
@@ -7234,13 +7234,13 @@ function Qe(r, e, t) {
7234
7234
  let n = r.state.tr.setSelection(e);
7235
7235
  n.setMeta("pointer", !0), r.dispatch(n);
7236
7236
  }
7237
- function Aa(r, e) {
7237
+ function Na(r, e) {
7238
7238
  if (e == -1)
7239
7239
  return !1;
7240
7240
  let t = r.state.doc.resolve(e), n = t.nodeAfter;
7241
7241
  return n && n.isAtom && C.isSelectable(n) ? (Qe(r, new C(t)), !0) : !1;
7242
7242
  }
7243
- function va(r, e) {
7243
+ function Aa(r, e) {
7244
7244
  if (e == -1)
7245
7245
  return !1;
7246
7246
  let t = r.state.selection, n, i;
@@ -7255,16 +7255,16 @@ function va(r, e) {
7255
7255
  }
7256
7256
  return i != null ? (Qe(r, C.create(r.state.doc, i)), !0) : !1;
7257
7257
  }
7258
- function Da(r, e, t, n, i) {
7259
- return hr(r, "handleClickOn", e, t, n) || r.someProp("handleClick", (s) => s(r, e, n)) || (i ? va(r, t) : Aa(r, t));
7258
+ function va(r, e, t, n, i) {
7259
+ return hr(r, "handleClickOn", e, t, n) || r.someProp("handleClick", (s) => s(r, e, n)) || (i ? Aa(r, t) : Na(r, t));
7260
7260
  }
7261
- function Ia(r, e, t, n) {
7261
+ function Da(r, e, t, n) {
7262
7262
  return hr(r, "handleDoubleClickOn", e, t, n) || r.someProp("handleDoubleClick", (i) => i(r, e, n));
7263
7263
  }
7264
- function Pa(r, e, t, n) {
7265
- return hr(r, "handleTripleClickOn", e, t, n) || r.someProp("handleTripleClick", (i) => i(r, e, n)) || Ra(r, t, n);
7264
+ function Ia(r, e, t, n) {
7265
+ return hr(r, "handleTripleClickOn", e, t, n) || r.someProp("handleTripleClick", (i) => i(r, e, n)) || Pa(r, t, n);
7266
7266
  }
7267
- function Ra(r, e, t) {
7267
+ function Pa(r, e, t) {
7268
7268
  if (t.button != 0)
7269
7269
  return !1;
7270
7270
  let n = r.state.doc;
@@ -7285,18 +7285,18 @@ function Ra(r, e, t) {
7285
7285
  function pr(r) {
7286
7286
  return _t(r);
7287
7287
  }
7288
- const Js = te ? "metaKey" : "ctrlKey";
7288
+ const Ws = te ? "metaKey" : "ctrlKey";
7289
7289
  U.mousedown = (r, e) => {
7290
7290
  let t = e;
7291
7291
  r.input.shiftKey = t.shiftKey;
7292
7292
  let n = pr(r), i = Date.now(), s = "singleClick";
7293
- i - r.input.lastClick.time < 500 && Na(t, r.input.lastClick) && !t[Js] && (r.input.lastClick.type == "singleClick" ? s = "doubleClick" : r.input.lastClick.type == "doubleClick" && (s = "tripleClick")), r.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: s };
7293
+ i - r.input.lastClick.time < 500 && Oa(t, r.input.lastClick) && !t[Ws] && (r.input.lastClick.type == "singleClick" ? s = "doubleClick" : r.input.lastClick.type == "doubleClick" && (s = "tripleClick")), r.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: s };
7294
7294
  let o = r.posAtCoords(an(t));
7295
- o && (s == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new Ba(r, o, t, !!n)) : (s == "doubleClick" ? Ia : Pa)(r, o.pos, o.inside, t) ? t.preventDefault() : we(r, "pointer"));
7295
+ o && (s == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new Ra(r, o, t, !!n)) : (s == "doubleClick" ? Da : Ia)(r, o.pos, o.inside, t) ? t.preventDefault() : we(r, "pointer"));
7296
7296
  };
7297
- class Ba {
7297
+ class Ra {
7298
7298
  constructor(e, t, n, i) {
7299
- this.view = e, this.pos = t, this.event = n, this.flushed = i, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!n[Js], this.allowDefault = n.shiftKey;
7299
+ this.view = e, this.pos = t, this.event = n, this.flushed = i, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!n[Ws], this.allowDefault = n.shiftKey;
7300
7300
  let s, o;
7301
7301
  if (t.inside > -1)
7302
7302
  s = e.state.doc.nodeAt(t.inside), o = t.inside;
@@ -7323,7 +7323,7 @@ class Ba {
7323
7323
  if (this.done(), !this.view.dom.contains(e.target))
7324
7324
  return;
7325
7325
  let t = this.pos;
7326
- this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(an(e))), this.updateAllowDefault(e), this.allowDefault || !t ? we(this.view, "pointer") : Da(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
7326
+ this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(an(e))), this.updateAllowDefault(e), this.allowDefault || !t ? we(this.view, "pointer") : va(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
7327
7327
  K && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
7328
7328
  // cursor, but still report that the node is selected
7329
7329
  // when asked through getSelection. You'll then get a
@@ -7347,10 +7347,10 @@ U.touchmove = (r) => {
7347
7347
  r.input.lastTouch = Date.now(), we(r, "pointer");
7348
7348
  };
7349
7349
  U.contextmenu = (r) => pr(r);
7350
- function qs(r, e) {
7350
+ function Js(r, e) {
7351
7351
  return r.composing ? !0 : K && Math.abs(e.timeStamp - r.input.compositionEndedAt) < 500 ? (r.input.compositionEndedAt = -2e8, !0) : !1;
7352
7352
  }
7353
- const za = pe ? 5e3 : -1;
7353
+ const Ba = pe ? 5e3 : -1;
7354
7354
  _.compositionstart = _.compositionupdate = (r) => {
7355
7355
  if (!r.composing) {
7356
7356
  r.domObserver.flush();
@@ -7373,23 +7373,23 @@ _.compositionstart = _.compositionupdate = (r) => {
7373
7373
  }
7374
7374
  r.input.composing = !0;
7375
7375
  }
7376
- Ks(r, za);
7376
+ qs(r, Ba);
7377
7377
  };
7378
7378
  _.compositionend = (r, e) => {
7379
- r.composing && (r.input.composing = !1, r.input.compositionEndedAt = e.timeStamp, r.input.compositionPendingChanges = r.domObserver.pendingRecords().length ? r.input.compositionID : 0, r.input.compositionNode = null, r.input.compositionPendingChanges && Promise.resolve().then(() => r.domObserver.flush()), r.input.compositionID++, Ks(r, 20));
7379
+ r.composing && (r.input.composing = !1, r.input.compositionEndedAt = e.timeStamp, r.input.compositionPendingChanges = r.domObserver.pendingRecords().length ? r.input.compositionID : 0, r.input.compositionNode = null, r.input.compositionPendingChanges && Promise.resolve().then(() => r.domObserver.flush()), r.input.compositionID++, qs(r, 20));
7380
7380
  };
7381
- function Ks(r, e) {
7381
+ function qs(r, e) {
7382
7382
  clearTimeout(r.input.composingTimeout), e > -1 && (r.input.composingTimeout = setTimeout(() => _t(r), e));
7383
7383
  }
7384
- function Us(r) {
7385
- for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt = La()); r.input.compositionNodes.length > 0; )
7384
+ function Ks(r) {
7385
+ for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt = Fa()); r.input.compositionNodes.length > 0; )
7386
7386
  r.input.compositionNodes.pop().markParentsDirty();
7387
7387
  }
7388
- function Fa(r) {
7388
+ function za(r) {
7389
7389
  let e = r.domSelectionRange();
7390
7390
  if (!e.focusNode)
7391
7391
  return null;
7392
- let t = Al(e.focusNode, e.focusOffset), n = vl(e.focusNode, e.focusOffset);
7392
+ let t = Nl(e.focusNode, e.focusOffset), n = Al(e.focusNode, e.focusOffset);
7393
7393
  if (t && n && t != n) {
7394
7394
  let i = n.pmViewDesc, s = r.domObserver.lastChangedTextNode;
7395
7395
  if (t == s || n == s)
@@ -7404,20 +7404,20 @@ function Fa(r) {
7404
7404
  }
7405
7405
  return t || n;
7406
7406
  }
7407
- function La() {
7407
+ function Fa() {
7408
7408
  let r = document.createEvent("Event");
7409
7409
  return r.initEvent("event", !0, !0), r.timeStamp;
7410
7410
  }
7411
7411
  function _t(r, e = !1) {
7412
7412
  if (!(pe && r.domObserver.flushingSoon >= 0)) {
7413
- if (r.domObserver.forceFlush(), Us(r), e || r.docView && r.docView.dirty) {
7413
+ if (r.domObserver.forceFlush(), Ks(r), e || r.docView && r.docView.dirty) {
7414
7414
  let t = cr(r);
7415
7415
  return t && !t.eq(r.state.selection) ? r.dispatch(r.state.tr.setSelection(t)) : (r.markCursor || e) && !r.state.selection.empty ? r.dispatch(r.state.tr.deleteSelection()) : r.updateState(r.state), !0;
7416
7416
  }
7417
7417
  return !1;
7418
7418
  }
7419
7419
  }
7420
- function $a(r, e) {
7420
+ function La(r, e) {
7421
7421
  if (!r.dom.parentNode)
7422
7422
  return;
7423
7423
  let t = r.dom.parentNode.appendChild(document.createElement("div"));
@@ -7427,18 +7427,18 @@ function $a(r, e) {
7427
7427
  t.parentNode && t.parentNode.removeChild(t), r.focus();
7428
7428
  }, 50);
7429
7429
  }
7430
- const kt = G && Ee < 15 || rt && Bl < 604;
7430
+ const kt = G && Ee < 15 || rt && Rl < 604;
7431
7431
  U.copy = _.cut = (r, e) => {
7432
7432
  let t = e, n = r.state.selection, i = t.type == "cut";
7433
7433
  if (n.empty)
7434
7434
  return;
7435
7435
  let s = kt ? null : t.clipboardData, o = n.content(), { dom: l, text: a } = dr(r, o);
7436
- s ? (t.preventDefault(), s.clearData(), s.setData("text/html", l.innerHTML), s.setData("text/plain", a)) : $a(r, l), i && r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
7436
+ s ? (t.preventDefault(), s.clearData(), s.setData("text/html", l.innerHTML), s.setData("text/plain", a)) : La(r, l), i && r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
7437
7437
  };
7438
- function Va(r) {
7438
+ function $a(r) {
7439
7439
  return r.openStart == 0 && r.openEnd == 0 && r.content.childCount == 1 ? r.content.firstChild : null;
7440
7440
  }
7441
- function ja(r, e) {
7441
+ function Va(r, e) {
7442
7442
  if (!r.dom.parentNode)
7443
7443
  return;
7444
7444
  let t = r.input.shiftKey || r.state.selection.$from.parent.type.spec.code, n = r.dom.parentNode.appendChild(document.createElement(t ? "textarea" : "div"));
@@ -7449,15 +7449,15 @@ function ja(r, e) {
7449
7449
  }, 50);
7450
7450
  }
7451
7451
  function xt(r, e, t, n, i) {
7452
- let s = Ls(r, e, t, n, r.state.selection.$from);
7452
+ let s = Fs(r, e, t, n, r.state.selection.$from);
7453
7453
  if (r.someProp("handlePaste", (a) => a(r, i, s || k.empty)))
7454
7454
  return !0;
7455
7455
  if (!s)
7456
7456
  return !1;
7457
- let o = Va(s), l = o ? r.state.tr.replaceSelectionWith(o, n) : r.state.tr.replaceSelection(s);
7457
+ let o = $a(s), l = o ? r.state.tr.replaceSelectionWith(o, n) : r.state.tr.replaceSelection(s);
7458
7458
  return r.dispatch(l.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
7459
7459
  }
7460
- function _s(r) {
7460
+ function Us(r) {
7461
7461
  let e = r.getData("text/plain") || r.getData("Text");
7462
7462
  if (e)
7463
7463
  return e;
@@ -7469,17 +7469,17 @@ _.paste = (r, e) => {
7469
7469
  if (r.composing && !pe)
7470
7470
  return;
7471
7471
  let n = kt ? null : t.clipboardData, i = r.input.shiftKey && r.input.lastKeyCode != 45;
7472
- n && xt(r, _s(n), n.getData("text/html"), i, t) ? t.preventDefault() : ja(r, t);
7472
+ n && xt(r, Us(n), n.getData("text/html"), i, t) ? t.preventDefault() : Va(r, t);
7473
7473
  };
7474
- class Gs {
7474
+ class _s {
7475
7475
  constructor(e, t, n) {
7476
7476
  this.slice = e, this.move = t, this.node = n;
7477
7477
  }
7478
7478
  }
7479
- const Ha = te ? "altKey" : "ctrlKey";
7480
- function Ys(r, e) {
7479
+ const ja = te ? "altKey" : "ctrlKey";
7480
+ function Gs(r, e) {
7481
7481
  let t = r.someProp("dragCopies", (n) => !n(e));
7482
- return t ?? !e[Ha];
7482
+ return t ?? !e[ja];
7483
7483
  }
7484
7484
  U.dragstart = (r, e) => {
7485
7485
  let t = e, n = r.input.mouseDown;
@@ -7495,7 +7495,7 @@ U.dragstart = (r, e) => {
7495
7495
  }
7496
7496
  }
7497
7497
  let l = (o || r.state.selection).content(), { dom: a, text: c, slice: u } = dr(r, l);
7498
- (!t.dataTransfer.files.length || !J || Cs > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(kt ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", kt || t.dataTransfer.setData("text/plain", c), r.dragging = new Gs(u, Ys(r, t), o);
7498
+ (!t.dataTransfer.files.length || !J || Ss > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(kt ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", kt || t.dataTransfer.setData("text/plain", c), r.dragging = new _s(u, Gs(r, t), o);
7499
7499
  };
7500
7500
  U.dragend = (r) => {
7501
7501
  let e = r.dragging;
@@ -7514,8 +7514,8 @@ _.drop = (r, e) => {
7514
7514
  let s = r.state.doc.resolve(i.pos), o = n && n.slice;
7515
7515
  o ? r.someProp("transformPasted", (p) => {
7516
7516
  o = p(o, r);
7517
- }) : o = Ls(r, _s(t.dataTransfer), kt ? null : t.dataTransfer.getData("text/html"), !1, s);
7518
- let l = !!(n && Ys(r, t));
7517
+ }) : o = Fs(r, Us(t.dataTransfer), kt ? null : t.dataTransfer.getData("text/html"), !1, s);
7518
+ let l = !!(n && Gs(r, t));
7519
7519
  if (r.someProp("handleDrop", (p) => p(r, t, o || k.empty, l))) {
7520
7520
  t.preventDefault();
7521
7521
  return;
@@ -7523,7 +7523,7 @@ _.drop = (r, e) => {
7523
7523
  if (!o)
7524
7524
  return;
7525
7525
  t.preventDefault();
7526
- let a = o ? ml(r.state.doc, s.pos, o) : s.pos;
7526
+ let a = o ? pl(r.state.doc, s.pos, o) : s.pos;
7527
7527
  a == null && (a = s.pos);
7528
7528
  let c = r.state.tr;
7529
7529
  if (l) {
@@ -7761,7 +7761,7 @@ class B {
7761
7761
  let a = this.local[l].map(e, n, i);
7762
7762
  a && a.type.valid(t, a) ? (o || (o = [])).push(a) : s.onRemove && s.onRemove(this.local[l].spec);
7763
7763
  }
7764
- return this.children.length ? Wa(this.children, o || [], e, t, n, i, s) : o ? new B(o.sort($e), Ge) : W;
7764
+ return this.children.length ? Ha(this.children, o || [], e, t, n, i, s) : o ? new B(o.sort($e), Ge) : W;
7765
7765
  }
7766
7766
  /**
7767
7767
  Add the given array of decorations to the ones in the set,
@@ -7776,13 +7776,13 @@ class B {
7776
7776
  let i, s = 0;
7777
7777
  e.forEach((l, a) => {
7778
7778
  let c = a + n, u;
7779
- if (u = Zs(t, l, c)) {
7779
+ if (u = Xs(t, l, c)) {
7780
7780
  for (i || (i = this.children.slice()); s < i.length && i[s] < a; )
7781
7781
  s += 3;
7782
7782
  i[s] == a ? i[s + 2] = i[s + 2].addInner(l, u, c + 1) : i.splice(s, 0, a, a + l.nodeSize, Yt(u, l, c + 1, Le)), s += 3;
7783
7783
  }
7784
7784
  });
7785
- let o = Xs(s ? Qs(t) : t, -n);
7785
+ let o = Ys(s ? Zs(t) : t, -n);
7786
7786
  for (let l = 0; l < o.length; l++)
7787
7787
  o[l].type.valid(e, o[l]) || o.splice(l--, 1);
7788
7788
  return new B(o.length ? this.local.concat(o).sort($e) : this.local, i || this.children);
@@ -7939,7 +7939,7 @@ class xe {
7939
7939
  this.members[t].forEachSet(e);
7940
7940
  }
7941
7941
  }
7942
- function Wa(r, e, t, n, i, s, o) {
7942
+ function Ha(r, e, t, n, i, s, o) {
7943
7943
  let l = r.slice();
7944
7944
  for (let c = 0, u = s; c < t.maps.length; c++) {
7945
7945
  let d = 0;
@@ -7975,7 +7975,7 @@ function Wa(r, e, t, n, i, s, o) {
7975
7975
  a = !0;
7976
7976
  }
7977
7977
  if (a) {
7978
- let c = Ja(l, r, e, t, i, s, o), u = Yt(c, n, 0, o);
7978
+ let c = Wa(l, r, e, t, i, s, o), u = Yt(c, n, 0, o);
7979
7979
  e = u.local;
7980
7980
  for (let d = 0; d < l.length; d += 3)
7981
7981
  l[d + 1] < 0 && (l.splice(d, 3), d -= 3);
@@ -7988,7 +7988,7 @@ function Wa(r, e, t, n, i, s, o) {
7988
7988
  }
7989
7989
  return new B(e.sort($e), l);
7990
7990
  }
7991
- function Xs(r, e) {
7991
+ function Ys(r, e) {
7992
7992
  if (!e || !r.length)
7993
7993
  return r;
7994
7994
  let t = [];
@@ -7998,7 +7998,7 @@ function Xs(r, e) {
7998
7998
  }
7999
7999
  return t;
8000
8000
  }
8001
- function Ja(r, e, t, n, i, s, o) {
8001
+ function Wa(r, e, t, n, i, s, o) {
8002
8002
  function l(a, c) {
8003
8003
  for (let u = 0; u < a.local.length; u++) {
8004
8004
  let d = a.local[u].map(n, i, c);
@@ -8011,7 +8011,7 @@ function Ja(r, e, t, n, i, s, o) {
8011
8011
  r[a + 1] == -1 && l(r[a + 2], e[a] + s + 1);
8012
8012
  return t;
8013
8013
  }
8014
- function Zs(r, e, t) {
8014
+ function Xs(r, e, t) {
8015
8015
  if (e.isLeaf)
8016
8016
  return null;
8017
8017
  let n = t + e.nodeSize, i = null;
@@ -8019,7 +8019,7 @@ function Zs(r, e, t) {
8019
8019
  (o = r[s]) && o.from > t && o.to < n && ((i || (i = [])).push(o), r[s] = null);
8020
8020
  return i;
8021
8021
  }
8022
- function Qs(r) {
8022
+ function Zs(r) {
8023
8023
  let e = [];
8024
8024
  for (let t = 0; t < r.length; t++)
8025
8025
  r[t] != null && e.push(r[t]);
@@ -8028,14 +8028,14 @@ function Qs(r) {
8028
8028
  function Yt(r, e, t, n) {
8029
8029
  let i = [], s = !1;
8030
8030
  e.forEach((l, a) => {
8031
- let c = Zs(r, l, a + t);
8031
+ let c = Xs(r, l, a + t);
8032
8032
  if (c) {
8033
8033
  s = !0;
8034
8034
  let u = Yt(c, l, t + a + 1, n);
8035
8035
  u != W && i.push(a, a + l.nodeSize, u);
8036
8036
  }
8037
8037
  });
8038
- let o = Xs(s ? Qs(r) : r, -t).sort($e);
8038
+ let o = Ys(s ? Zs(r) : r, -t).sort($e);
8039
8039
  for (let l = 0; l < o.length; l++)
8040
8040
  o[l].type.valid(e, o[l]) || (n.onRemove && n.onRemove(o[l].spec), o.splice(l--, 1));
8041
8041
  return o.length || i.length ? new B(o, i) : W;
@@ -8073,15 +8073,15 @@ function On(r) {
8073
8073
  n && n != W && e.push(n);
8074
8074
  }), r.cursorWrapper && e.push(B.create(r.state.doc, [r.cursorWrapper.deco])), xe.from(e);
8075
8075
  }
8076
- const qa = {
8076
+ const Ja = {
8077
8077
  childList: !0,
8078
8078
  characterData: !0,
8079
8079
  characterDataOldValue: !0,
8080
8080
  attributes: !0,
8081
8081
  attributeOldValue: !0,
8082
8082
  subtree: !0
8083
- }, Ka = G && Ee <= 11;
8084
- class Ua {
8083
+ }, qa = G && Ee <= 11;
8084
+ class Ka {
8085
8085
  constructor() {
8086
8086
  this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
8087
8087
  }
@@ -8095,13 +8095,13 @@ class Ua {
8095
8095
  return e.anchorNode == this.anchorNode && e.anchorOffset == this.anchorOffset && e.focusNode == this.focusNode && e.focusOffset == this.focusOffset;
8096
8096
  }
8097
8097
  }
8098
- class _a {
8098
+ class Ua {
8099
8099
  constructor(e, t) {
8100
- this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new Ua(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((n) => {
8100
+ this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new Ka(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((n) => {
8101
8101
  for (let i = 0; i < n.length; i++)
8102
8102
  this.queue.push(n[i]);
8103
8103
  G && Ee <= 11 && n.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : this.flush();
8104
- }), Ka && (this.onCharData = (n) => {
8104
+ }), qa && (this.onCharData = (n) => {
8105
8105
  this.queue.push({ target: n.target, type: "characterData", oldValue: n.prevValue }), this.flushSoon();
8106
8106
  }), this.onSelectionChange = this.onSelectionChange.bind(this);
8107
8107
  }
@@ -8114,7 +8114,7 @@ class _a {
8114
8114
  this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush());
8115
8115
  }
8116
8116
  start() {
8117
- this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, qa)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection();
8117
+ this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, Ja)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection();
8118
8118
  }
8119
8119
  stop() {
8120
8120
  if (this.observer) {
@@ -8197,12 +8197,12 @@ class _a {
8197
8197
  let { focusNode: d } = this.currentSelection;
8198
8198
  for (let f of u) {
8199
8199
  let h = f.parentNode;
8200
- h && h.nodeName == "LI" && (!d || Xa(e, d) != h) && f.remove();
8200
+ h && h.nodeName == "LI" && (!d || Ya(e, d) != h) && f.remove();
8201
8201
  }
8202
8202
  }
8203
8203
  }
8204
8204
  let c = null;
8205
- s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && on(n) && (c = cr(e)) && c.eq(O.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, ge(e), this.currentSelection.set(n), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, o), Ga(e)), this.handleDOMChange(s, o, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || ge(e), this.currentSelection.set(n));
8205
+ s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && on(n) && (c = cr(e)) && c.eq(O.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, ge(e), this.currentSelection.set(n), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, o), _a(e)), this.handleDOMChange(s, o, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || ge(e), this.currentSelection.set(n));
8206
8206
  }
8207
8207
  registerMutation(e, t) {
8208
8208
  if (t.indexOf(e.target) > -1)
@@ -8238,7 +8238,7 @@ class _a {
8238
8238
  }
8239
8239
  }
8240
8240
  let yi = /* @__PURE__ */ new WeakMap(), bi = !1;
8241
- function Ga(r) {
8241
+ function _a(r) {
8242
8242
  if (!yi.has(r) && (yi.set(r, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace) !== -1)) {
8243
8243
  if (r.requiresGeckoHackNode = oe, bi)
8244
8244
  return;
@@ -8249,7 +8249,7 @@ function ki(r, e) {
8249
8249
  let t = e.startContainer, n = e.startOffset, i = e.endContainer, s = e.endOffset, o = r.domAtPos(r.state.selection.anchor);
8250
8250
  return He(o.node, o.offset, i, s) && ([t, n, i, s] = [i, s, t, n]), { anchorNode: t, anchorOffset: n, focusNode: i, focusOffset: s };
8251
8251
  }
8252
- function Ya(r, e) {
8252
+ function Ga(r, e) {
8253
8253
  if (e.getComposedRanges) {
8254
8254
  let i = e.getComposedRanges(r.root)[0];
8255
8255
  if (i)
@@ -8261,7 +8261,7 @@ function Ya(r, e) {
8261
8261
  }
8262
8262
  return r.dom.addEventListener("beforeinput", n, !0), document.execCommand("indent"), r.dom.removeEventListener("beforeinput", n, !0), t ? ki(r, t) : null;
8263
8263
  }
8264
- function Xa(r, e) {
8264
+ function Ya(r, e) {
8265
8265
  for (let t = e.parentNode; t && t != r.dom; t = t.parentNode) {
8266
8266
  let n = r.docView.nearestDesc(t, !0);
8267
8267
  if (n && n.node.isBlock)
@@ -8269,7 +8269,7 @@ function Xa(r, e) {
8269
8269
  }
8270
8270
  return null;
8271
8271
  }
8272
- function Za(r, e, t) {
8272
+ function Xa(r, e, t) {
8273
8273
  let { node: n, fromOffset: i, toOffset: s, from: o, to: l } = r.docView.parseRange(e, t), a = r.domSelectionRange(), c, u = a.anchorNode;
8274
8274
  if (u && r.dom.contains(u.nodeType == 1 ? u : u.parentNode) && (c = [{ node: u, offset: a.anchorOffset }], on(a) || c.push({ node: a.focusNode, offset: a.focusOffset })), J && r.input.lastKeyCode === 8)
8275
8275
  for (let g = s; g > i; g--) {
@@ -8289,7 +8289,7 @@ function Za(r, e, t) {
8289
8289
  to: s,
8290
8290
  preserveWhitespace: h.parent.type.whitespace == "pre" ? "full" : !0,
8291
8291
  findPositions: c,
8292
- ruleFromNode: Qa,
8292
+ ruleFromNode: Za,
8293
8293
  context: h
8294
8294
  });
8295
8295
  if (c && c[0].pos != null) {
@@ -8298,7 +8298,7 @@ function Za(r, e, t) {
8298
8298
  }
8299
8299
  return { doc: m, sel: p, from: o, to: l };
8300
8300
  }
8301
- function Qa(r) {
8301
+ function Za(r) {
8302
8302
  let e = r.pmViewDesc;
8303
8303
  if (e)
8304
8304
  return e.parseRule();
@@ -8312,13 +8312,13 @@ function Qa(r) {
8312
8312
  return { ignore: !0 };
8313
8313
  return null;
8314
8314
  }
8315
- const ec = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
8316
- function tc(r, e, t, n, i) {
8315
+ const Qa = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
8316
+ function ec(r, e, t, n, i) {
8317
8317
  let s = r.input.compositionPendingChanges || (r.composing ? r.input.compositionID : 0);
8318
8318
  if (r.input.compositionPendingChanges = 0, e < 0) {
8319
8319
  let E = r.input.lastSelectionTime > Date.now() - 50 ? r.input.lastSelectionOrigin : null, ee = cr(r, E);
8320
8320
  if (ee && !r.state.selection.eq(ee)) {
8321
- if (J && pe && r.input.lastKeyCode === 13 && Date.now() - 100 < r.input.lastKeyCodeTime && r.someProp("handleKeyDown", (Ao) => Ao(r, De(13, "Enter"))))
8321
+ if (J && pe && r.input.lastKeyCode === 13 && Date.now() - 100 < r.input.lastKeyCodeTime && r.someProp("handleKeyDown", (No) => No(r, De(13, "Enter"))))
8322
8322
  return;
8323
8323
  let Nt = r.state.tr.setSelection(ee);
8324
8324
  E == "pointer" ? Nt.setMeta("pointer", !0) : E == "key" && Nt.scrollIntoView(), s && Nt.setMeta("composition", s), r.dispatch(Nt);
@@ -8327,10 +8327,10 @@ function tc(r, e, t, n, i) {
8327
8327
  }
8328
8328
  let o = r.state.doc.resolve(e), l = o.sharedDepth(t);
8329
8329
  e = o.before(l + 1), t = r.state.doc.resolve(t).after(l + 1);
8330
- let a = r.state.selection, c = Za(r, e, t), u = r.state.doc, d = u.slice(c.from, c.to), f, h;
8330
+ let a = r.state.selection, c = Xa(r, e, t), u = r.state.doc, d = u.slice(c.from, c.to), f, h;
8331
8331
  r.input.lastKeyCode === 8 && Date.now() - 100 < r.input.lastKeyCodeTime ? (f = r.state.selection.to, h = "end") : (f = r.state.selection.from, h = "start"), r.input.lastKeyCode = null;
8332
- let p = ic(d.content, c.doc.content, c.from, f, h);
8333
- if (p && r.input.domChangeCount++, (rt && r.input.lastIOSEnter > Date.now() - 225 || pe) && i.some((E) => E.nodeType == 1 && !ec.test(E.nodeName)) && (!p || p.endA >= p.endB) && r.someProp("handleKeyDown", (E) => E(r, De(13, "Enter")))) {
8332
+ let p = rc(d.content, c.doc.content, c.from, f, h);
8333
+ if (p && r.input.domChangeCount++, (rt && r.input.lastIOSEnter > Date.now() - 225 || pe) && i.some((E) => E.nodeType == 1 && !Qa.test(E.nodeName)) && (!p || p.endA >= p.endB) && r.someProp("handleKeyDown", (E) => E(r, De(13, "Enter")))) {
8334
8334
  r.input.lastIOSEnter = 0;
8335
8335
  return;
8336
8336
  }
@@ -8353,7 +8353,7 @@ function tc(r, e, t, n, i) {
8353
8353
  r.input.lastIOSEnter = 0;
8354
8354
  return;
8355
8355
  }
8356
- if (r.state.selection.anchor > p.start && rc(u, p.start, p.endA, m, g) && r.someProp("handleKeyDown", (E) => E(r, De(8, "Backspace")))) {
8356
+ if (r.state.selection.anchor > p.start && nc(u, p.start, p.endA, m, g) && r.someProp("handleKeyDown", (E) => E(r, De(8, "Backspace")))) {
8357
8357
  pe && J && r.domObserver.suppressSelectionUpdates();
8358
8358
  return;
8359
8359
  }
@@ -8368,7 +8368,7 @@ function tc(r, e, t, n, i) {
8368
8368
  G && Ee <= 11 && m.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() => ge(r), 20)), M = r.state.tr.delete(v, A), I = u.resolve(p.start).marksAcross(u.resolve(p.endA));
8369
8369
  else if (
8370
8370
  // Adding or removing a mark
8371
- p.endA == p.endB && (H = nc(m.parent.content.cut(m.parentOffset, g.parentOffset), y.parent.content.cut(y.parentOffset, p.endA - y.start())))
8371
+ p.endA == p.endB && (H = tc(m.parent.content.cut(m.parentOffset, g.parentOffset), y.parent.content.cut(y.parentOffset, p.endA - y.start())))
8372
8372
  )
8373
8373
  M = r.state.tr, H.type == "add" ? M.addMark(v, A, H.mark) : M.removeMark(v, A, H.mark);
8374
8374
  else if (m.parent.child(m.index()).isText && m.index() == g.index() - (g.textOffset ? 0 : 1)) {
@@ -8387,7 +8387,7 @@ function tc(r, e, t, n, i) {
8387
8387
  function xi(r, e, t) {
8388
8388
  return Math.max(t.anchor, t.head) > e.content.size ? null : ur(r, e.resolve(t.anchor), e.resolve(t.head));
8389
8389
  }
8390
- function nc(r, e) {
8390
+ function tc(r, e) {
8391
8391
  let t = r.firstChild.marks, n = e.firstChild.marks, i = t, s = n, o, l, a;
8392
8392
  for (let u = 0; u < n.length; u++)
8393
8393
  i = n[u].removeFromSet(i);
@@ -8405,7 +8405,7 @@ function nc(r, e) {
8405
8405
  if (b.from(c).eq(r))
8406
8406
  return { mark: l, type: o };
8407
8407
  }
8408
- function rc(r, e, t, n, i) {
8408
+ function nc(r, e, t, n, i) {
8409
8409
  if (
8410
8410
  // The content must have shrunk
8411
8411
  t - e <= i.pos - n.pos || // newEnd must point directly at or after the end of the block that newStart points into
@@ -8433,7 +8433,7 @@ function Nn(r, e, t) {
8433
8433
  }
8434
8434
  return i;
8435
8435
  }
8436
- function ic(r, e, t, n, i) {
8436
+ function rc(r, e, t, n, i) {
8437
8437
  let s = r.findDiffStart(e, t);
8438
8438
  if (s == null)
8439
8439
  return null;
@@ -8457,7 +8457,7 @@ function Si(r) {
8457
8457
  let e = r.charCodeAt(0), t = r.charCodeAt(1);
8458
8458
  return e >= 56320 && e <= 57343 && t >= 55296 && t <= 56319;
8459
8459
  }
8460
- class sc {
8460
+ class ic {
8461
8461
  /**
8462
8462
  Create a view. `place` may be a DOM node that the editor should
8463
8463
  be appended to, a function that will place it into the document,
@@ -8466,7 +8466,7 @@ class sc {
8466
8466
  added to the document.
8467
8467
  */
8468
8468
  constructor(e, t) {
8469
- this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new wa(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(Ti), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = Mi(this), wi(this), this.nodeViews = Ei(this), this.docView = ni(this.state.doc, Ci(this), On(this), this.dom, this), this.domObserver = new _a(this, (n, i, s, o) => tc(this, n, i, s, o)), this.domObserver.start(), Ma(this), this.updatePluginViews();
8469
+ this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new Ca(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(Ti), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = Mi(this), wi(this), this.nodeViews = Ei(this), this.docView = ni(this.state.doc, Ci(this), On(this), this.dom, this), this.domObserver = new Ua(this, (n, i, s, o) => ec(this, n, i, s, o)), this.domObserver.start(), wa(this), this.updatePluginViews();
8470
8470
  }
8471
8471
  /**
8472
8472
  Holds `true` when a
@@ -8522,26 +8522,26 @@ class sc {
8522
8522
  updateStateInner(e, t) {
8523
8523
  var n;
8524
8524
  let i = this.state, s = !1, o = !1;
8525
- e.storedMarks && this.composing && (Us(this), o = !0), this.state = e;
8525
+ e.storedMarks && this.composing && (Ks(this), o = !0), this.state = e;
8526
8526
  let l = i.plugins != e.plugins || this._props.plugins != t.plugins;
8527
8527
  if (l || this._props.plugins != t.plugins || this._props.nodeViews != t.nodeViews) {
8528
8528
  let h = Ei(this);
8529
- lc(h, this.nodeViews) && (this.nodeViews = h, s = !0);
8529
+ oc(h, this.nodeViews) && (this.nodeViews = h, s = !0);
8530
8530
  }
8531
8531
  (l || t.handleDOMEvents != this._props.handleDOMEvents) && Zn(this), this.editable = Mi(this), wi(this);
8532
8532
  let a = On(this), c = Ci(this), u = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", d = s || !this.docView.matchesNode(e.doc, c, a);
8533
8533
  (d || !e.selection.eq(i.selection)) && (o = !0);
8534
- let f = u == "preserve" && o && this.dom.style.overflowAnchor == null && Ll(this);
8534
+ let f = u == "preserve" && o && this.dom.style.overflowAnchor == null && Fl(this);
8535
8535
  if (o) {
8536
8536
  this.domObserver.stop();
8537
- let h = d && (G || J) && !this.composing && !i.selection.empty && !e.selection.empty && oc(i.selection, e.selection);
8537
+ let h = d && (G || J) && !this.composing && !i.selection.empty && !e.selection.empty && sc(i.selection, e.selection);
8538
8538
  if (d) {
8539
8539
  let p = J ? this.trackWrites = this.domSelectionRange().focusNode : null;
8540
- this.composing && (this.input.compositionNode = Fa(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = ni(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (h = !0);
8540
+ this.composing && (this.input.compositionNode = za(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = ni(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (h = !0);
8541
8541
  }
8542
- h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && aa(this)) ? ge(this, h) : (Bs(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
8542
+ h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && la(this)) ? ge(this, h) : (Rs(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
8543
8543
  }
8544
- this.updatePluginViews(i), !((n = this.dragging) === null || n === void 0) && n.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), u == "reset" ? this.dom.scrollTop = 0 : u == "to selection" ? this.scrollToSelection() : f && $l(f);
8544
+ this.updatePluginViews(i), !((n = this.dragging) === null || n === void 0) && n.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), u == "reset" ? this.dom.scrollTop = 0 : u == "to selection" ? this.scrollToSelection() : f && Ll(f);
8545
8545
  }
8546
8546
  /**
8547
8547
  @internal
@@ -8586,7 +8586,7 @@ class sc {
8586
8586
  let s = n.from + (this.state.doc.content.size - t.doc.content.size);
8587
8587
  (s > 0 && this.state.doc.nodeAt(s)) == n.node && (i = s);
8588
8588
  }
8589
- this.dragging = new Gs(e.slice, e.move, i < 0 ? void 0 : C.create(this.state.doc, i));
8589
+ this.dragging = new _s(e.slice, e.move, i < 0 ? void 0 : C.create(this.state.doc, i));
8590
8590
  }
8591
8591
  someProp(e, t) {
8592
8592
  let n = this._props && this._props[e], i;
@@ -8628,7 +8628,7 @@ class sc {
8628
8628
  Focus the editor.
8629
8629
  */
8630
8630
  focus() {
8631
- this.domObserver.stop(), this.editable && Vl(this.dom), ge(this), this.domObserver.start();
8631
+ this.domObserver.stop(), this.editable && $l(this.dom), ge(this), this.domObserver.start();
8632
8632
  }
8633
8633
  /**
8634
8634
  Get the document root in which the editor exists. This will
@@ -8662,7 +8662,7 @@ class sc {
8662
8662
  the top level, not in any node.
8663
8663
  */
8664
8664
  posAtCoords(e) {
8665
- return ql(this, e);
8665
+ return Jl(this, e);
8666
8666
  }
8667
8667
  /**
8668
8668
  Returns the viewport rectangle at a given document position.
@@ -8673,7 +8673,7 @@ class sc {
8673
8673
  otherwise the element after.
8674
8674
  */
8675
8675
  coordsAtPos(e, t = 1) {
8676
- return Os(this, e, t);
8676
+ return Ts(this, e, t);
8677
8677
  }
8678
8678
  /**
8679
8679
  Find the DOM position that corresponds to the given document
@@ -8727,7 +8727,7 @@ class sc {
8727
8727
  pass a different state.
8728
8728
  */
8729
8729
  endOfTextblock(e, t) {
8730
- return Yl(this, t || this.state, e);
8730
+ return Gl(this, t || this.state, e);
8731
8731
  }
8732
8732
  /**
8733
8733
  Run the editor's paste logic with the given HTML string. The
@@ -8759,7 +8759,7 @@ class sc {
8759
8759
  views](https://prosemirror.net/docs/ref/#view.NodeView).
8760
8760
  */
8761
8761
  destroy() {
8762
- this.docView && (Ea(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], On(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Ol());
8762
+ this.docView && (Ma(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], On(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Tl());
8763
8763
  }
8764
8764
  /**
8765
8765
  This is true when the view has been
@@ -8773,7 +8773,7 @@ class sc {
8773
8773
  Used for testing.
8774
8774
  */
8775
8775
  dispatchEvent(e) {
8776
- return Oa(this, e);
8776
+ return Ta(this, e);
8777
8777
  }
8778
8778
  /**
8779
8779
  Dispatch a transaction. Will call
@@ -8793,7 +8793,7 @@ class sc {
8793
8793
  */
8794
8794
  domSelectionRange() {
8795
8795
  let e = this.domSelection();
8796
- return e ? K && this.root.nodeType === 11 && Il(this.dom.ownerDocument) == this.dom && Ya(this, e) || e : { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
8796
+ return e ? K && this.root.nodeType === 11 && Dl(this.dom.ownerDocument) == this.dom && Ga(this, e) || e : { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
8797
8797
  }
8798
8798
  /**
8799
8799
  @internal
@@ -8820,7 +8820,7 @@ function wi(r) {
8820
8820
  function Mi(r) {
8821
8821
  return !r.someProp("editable", (e) => e(r.state) === !1);
8822
8822
  }
8823
- function oc(r, e) {
8823
+ function sc(r, e) {
8824
8824
  let t = Math.min(r.$anchor.sharedDepth(r.head), e.$anchor.sharedDepth(e.head));
8825
8825
  return r.$anchor.start(t) != e.$anchor.start(t);
8826
8826
  }
@@ -8832,7 +8832,7 @@ function Ei(r) {
8832
8832
  }
8833
8833
  return r.someProp("nodeViews", t), r.someProp("markViews", t), e;
8834
8834
  }
8835
- function lc(r, e) {
8835
+ function oc(r, e) {
8836
8836
  let t = 0, n = 0;
8837
8837
  for (let i in r) {
8838
8838
  if (r[i] != e[i])
@@ -8925,18 +8925,18 @@ var Ne = {
8925
8925
  220: "|",
8926
8926
  221: "}",
8927
8927
  222: '"'
8928
- }, ac = typeof navigator < "u" && /Mac/.test(navigator.platform), cc = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
8928
+ }, lc = typeof navigator < "u" && /Mac/.test(navigator.platform), ac = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
8929
8929
  for (var j = 0; j < 10; j++) Ne[48 + j] = Ne[96 + j] = String(j);
8930
8930
  for (var j = 1; j <= 24; j++) Ne[j + 111] = "F" + j;
8931
8931
  for (var j = 65; j <= 90; j++)
8932
8932
  Ne[j] = String.fromCharCode(j + 32), Xt[j] = String.fromCharCode(j);
8933
8933
  for (var An in Ne) Xt.hasOwnProperty(An) || (Xt[An] = Ne[An]);
8934
- function uc(r) {
8935
- var e = ac && r.metaKey && r.shiftKey && !r.ctrlKey && !r.altKey || cc && r.shiftKey && r.key && r.key.length == 1 || r.key == "Unidentified", t = !e && r.key || (r.shiftKey ? Xt : Ne)[r.keyCode] || r.key || "Unidentified";
8934
+ function cc(r) {
8935
+ var e = lc && r.metaKey && r.shiftKey && !r.ctrlKey && !r.altKey || ac && r.shiftKey && r.key && r.key.length == 1 || r.key == "Unidentified", t = !e && r.key || (r.shiftKey ? Xt : Ne)[r.keyCode] || r.key || "Unidentified";
8936
8936
  return t == "Esc" && (t = "Escape"), t == "Del" && (t = "Delete"), t == "Left" && (t = "ArrowLeft"), t == "Up" && (t = "ArrowUp"), t == "Right" && (t = "ArrowRight"), t == "Down" && (t = "ArrowDown"), t;
8937
8937
  }
8938
- const dc = typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : !1;
8939
- function fc(r) {
8938
+ const uc = typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : !1;
8939
+ function dc(r) {
8940
8940
  let e = r.split(/-(?!$)/), t = e[e.length - 1];
8941
8941
  t == "Space" && (t = " ");
8942
8942
  let n, i, s, o;
@@ -8951,28 +8951,28 @@ function fc(r) {
8951
8951
  else if (/^s(hift)?$/i.test(a))
8952
8952
  s = !0;
8953
8953
  else if (/^mod$/i.test(a))
8954
- dc ? o = !0 : i = !0;
8954
+ uc ? o = !0 : i = !0;
8955
8955
  else
8956
8956
  throw new Error("Unrecognized modifier name: " + a);
8957
8957
  }
8958
8958
  return n && (t = "Alt-" + t), i && (t = "Ctrl-" + t), o && (t = "Meta-" + t), s && (t = "Shift-" + t), t;
8959
8959
  }
8960
- function hc(r) {
8960
+ function fc(r) {
8961
8961
  let e = /* @__PURE__ */ Object.create(null);
8962
8962
  for (let t in r)
8963
- e[fc(t)] = r[t];
8963
+ e[dc(t)] = r[t];
8964
8964
  return e;
8965
8965
  }
8966
8966
  function vn(r, e, t = !0) {
8967
8967
  return e.altKey && (r = "Alt-" + r), e.ctrlKey && (r = "Ctrl-" + r), e.metaKey && (r = "Meta-" + r), t && e.shiftKey && (r = "Shift-" + r), r;
8968
8968
  }
8969
- function pc(r) {
8970
- return new Q({ props: { handleKeyDown: mc(r) } });
8969
+ function hc(r) {
8970
+ return new Q({ props: { handleKeyDown: pc(r) } });
8971
8971
  }
8972
- function mc(r) {
8973
- let e = hc(r);
8972
+ function pc(r) {
8973
+ let e = fc(r);
8974
8974
  return function(t, n) {
8975
- let i = uc(n), s, o = e[vn(i, n)];
8975
+ let i = cc(n), s, o = e[vn(i, n)];
8976
8976
  if (o && o(t.state, t.dispatch, t))
8977
8977
  return !0;
8978
8978
  if (i.length == 1 && i != " ") {
@@ -8991,12 +8991,12 @@ function mc(r) {
8991
8991
  };
8992
8992
  }
8993
8993
  const yr = (r, e) => r.selection.empty ? !1 : (e && e(r.tr.deleteSelection().scrollIntoView()), !0);
8994
- function eo(r, e) {
8994
+ function Qs(r, e) {
8995
8995
  let { $cursor: t } = r.selection;
8996
8996
  return !t || (e ? !e.endOfTextblock("backward", r) : t.parentOffset > 0) ? null : t;
8997
8997
  }
8998
- const to = (r, e, t) => {
8999
- let n = eo(r, t);
8998
+ const eo = (r, e, t) => {
8999
+ let n = Qs(r, t);
9000
9000
  if (!n)
9001
9001
  return !1;
9002
9002
  let i = br(n);
@@ -9005,7 +9005,7 @@ const to = (r, e, t) => {
9005
9005
  return l == null ? !1 : (e && e(r.tr.lift(o, l).scrollIntoView()), !0);
9006
9006
  }
9007
9007
  let s = i.nodeBefore;
9008
- if (uo(r, i, e, -1))
9008
+ if (co(r, i, e, -1))
9009
9009
  return !0;
9010
9010
  if (n.parent.content.size == 0 && (it(s, "end") || C.isSelectable(s)))
9011
9011
  for (let o = n.depth; ; o--) {
@@ -9021,20 +9021,20 @@ const to = (r, e, t) => {
9021
9021
  break;
9022
9022
  }
9023
9023
  return s.isAtom && i.depth == n.depth - 1 ? (e && e(r.tr.delete(i.pos - s.nodeSize, i.pos).scrollIntoView()), !0) : !1;
9024
- }, gc = (r, e, t) => {
9025
- let n = eo(r, t);
9024
+ }, mc = (r, e, t) => {
9025
+ let n = Qs(r, t);
9026
9026
  if (!n)
9027
9027
  return !1;
9028
9028
  let i = br(n);
9029
- return i ? no(r, i, e) : !1;
9030
- }, yc = (r, e, t) => {
9031
- let n = io(r, t);
9029
+ return i ? to(r, i, e) : !1;
9030
+ }, gc = (r, e, t) => {
9031
+ let n = ro(r, t);
9032
9032
  if (!n)
9033
9033
  return !1;
9034
9034
  let i = kr(n);
9035
- return i ? no(r, i, e) : !1;
9035
+ return i ? to(r, i, e) : !1;
9036
9036
  };
9037
- function no(r, e, t) {
9037
+ function to(r, e, t) {
9038
9038
  let n = e.nodeBefore, i = n, s = e.pos - 1;
9039
9039
  for (; !i.isTextblock; s--) {
9040
9040
  if (i.type.spec.isolating)
@@ -9071,7 +9071,7 @@ function it(r, e, t = !1) {
9071
9071
  }
9072
9072
  return !1;
9073
9073
  }
9074
- const ro = (r, e, t) => {
9074
+ const no = (r, e, t) => {
9075
9075
  let { $head: n, empty: i } = r.selection, s = n;
9076
9076
  if (!i)
9077
9077
  return !1;
@@ -9093,19 +9093,19 @@ function br(r) {
9093
9093
  }
9094
9094
  return null;
9095
9095
  }
9096
- function io(r, e) {
9096
+ function ro(r, e) {
9097
9097
  let { $cursor: t } = r.selection;
9098
9098
  return !t || (e ? !e.endOfTextblock("forward", r) : t.parentOffset < t.parent.content.size) ? null : t;
9099
9099
  }
9100
- const so = (r, e, t) => {
9101
- let n = io(r, t);
9100
+ const io = (r, e, t) => {
9101
+ let n = ro(r, t);
9102
9102
  if (!n)
9103
9103
  return !1;
9104
9104
  let i = kr(n);
9105
9105
  if (!i)
9106
9106
  return !1;
9107
9107
  let s = i.nodeAfter;
9108
- if (uo(r, i, e, 1))
9108
+ if (co(r, i, e, 1))
9109
9109
  return !0;
9110
9110
  if (n.parent.content.size == 0 && (it(s, "start") || C.isSelectable(s))) {
9111
9111
  let o = rn(r.doc, n.before(), n.after(), k.empty);
@@ -9118,7 +9118,7 @@ const so = (r, e, t) => {
9118
9118
  }
9119
9119
  }
9120
9120
  return s.isAtom && i.depth == n.depth - 1 ? (e && e(r.tr.delete(i.pos, i.pos + s.nodeSize).scrollIntoView()), !0) : !1;
9121
- }, oo = (r, e, t) => {
9121
+ }, so = (r, e, t) => {
9122
9122
  let { $head: n, empty: i } = r.selection, s = n;
9123
9123
  if (!i)
9124
9124
  return !1;
@@ -9141,7 +9141,7 @@ function kr(r) {
9141
9141
  }
9142
9142
  return null;
9143
9143
  }
9144
- const bc = (r, e) => {
9144
+ const yc = (r, e) => {
9145
9145
  let t = r.selection, n = t instanceof C, i;
9146
9146
  if (n) {
9147
9147
  if (t.node.isTextblock || !qe(r.doc, t.from))
@@ -9154,7 +9154,7 @@ const bc = (r, e) => {
9154
9154
  n && s.setSelection(C.create(s.doc, i - r.doc.resolve(i).nodeBefore.nodeSize)), e(s.scrollIntoView());
9155
9155
  }
9156
9156
  return !0;
9157
- }, kc = (r, e) => {
9157
+ }, bc = (r, e) => {
9158
9158
  let t = r.selection, n;
9159
9159
  if (t instanceof C) {
9160
9160
  if (t.node.isTextblock || !qe(r.doc, t.to))
@@ -9163,10 +9163,10 @@ const bc = (r, e) => {
9163
9163
  } else if (n = nn(r.doc, t.to, 1), n == null)
9164
9164
  return !1;
9165
9165
  return e && e(r.tr.join(n).scrollIntoView()), !0;
9166
- }, xc = (r, e) => {
9166
+ }, kc = (r, e) => {
9167
9167
  let { $from: t, $to: n } = r.selection, i = t.blockRange(n), s = i && st(i);
9168
9168
  return s == null ? !1 : (e && e(r.tr.lift(i, s).scrollIntoView()), !0);
9169
- }, lo = (r, e) => {
9169
+ }, oo = (r, e) => {
9170
9170
  let { $head: t, $anchor: n } = r.selection;
9171
9171
  return !t.parent.type.spec.code || !t.sameParent(n) ? !1 : (e && e(r.tr.insertText(`
9172
9172
  `).scrollIntoView()), !0);
@@ -9179,7 +9179,7 @@ function xr(r) {
9179
9179
  }
9180
9180
  return null;
9181
9181
  }
9182
- const Sc = (r, e) => {
9182
+ const xc = (r, e) => {
9183
9183
  let { $head: t, $anchor: n } = r.selection;
9184
9184
  if (!t.parent.type.spec.code || !t.sameParent(n))
9185
9185
  return !1;
@@ -9191,7 +9191,7 @@ const Sc = (r, e) => {
9191
9191
  a.setSelection(O.near(a.doc.resolve(l), 1)), e(a.scrollIntoView());
9192
9192
  }
9193
9193
  return !0;
9194
- }, ao = (r, e) => {
9194
+ }, lo = (r, e) => {
9195
9195
  let t = r.selection, { $from: n, $to: i } = t;
9196
9196
  if (t instanceof Z || n.parent.inlineContent || i.parent.inlineContent)
9197
9197
  return !1;
@@ -9203,7 +9203,7 @@ const Sc = (r, e) => {
9203
9203
  l.setSelection(T.create(l.doc, o + 1)), e(l.scrollIntoView());
9204
9204
  }
9205
9205
  return !0;
9206
- }, co = (r, e) => {
9206
+ }, ao = (r, e) => {
9207
9207
  let { $cursor: t } = r.selection;
9208
9208
  if (!t || t.parent.content.size)
9209
9209
  return !1;
@@ -9215,7 +9215,7 @@ const Sc = (r, e) => {
9215
9215
  let n = t.blockRange(), i = n && st(n);
9216
9216
  return i == null ? !1 : (e && e(r.tr.lift(n, i).scrollIntoView()), !0);
9217
9217
  };
9218
- function Cc(r) {
9218
+ function Sc(r) {
9219
9219
  return (e, t) => {
9220
9220
  let { $from: n, $to: i } = e.selection;
9221
9221
  if (e.selection instanceof C && e.selection.node.isBlock)
@@ -9244,17 +9244,17 @@ function Cc(r) {
9244
9244
  return t && t(u.scrollIntoView()), !0;
9245
9245
  };
9246
9246
  }
9247
- const wc = Cc(), Mc = (r, e) => {
9247
+ const Cc = Sc(), wc = (r, e) => {
9248
9248
  let { $from: t, to: n } = r.selection, i, s = t.sharedDepth(n);
9249
9249
  return s == 0 ? !1 : (i = t.before(s), e && e(r.tr.setSelection(C.create(r.doc, i))), !0);
9250
9250
  };
9251
- function Ec(r, e, t) {
9251
+ function Mc(r, e, t) {
9252
9252
  let n = e.nodeBefore, i = e.nodeAfter, s = e.index();
9253
9253
  return !n || !i || !n.type.compatibleContent(i.type) ? !1 : !n.content.size && e.parent.canReplace(s - 1, s) ? (t && t(r.tr.delete(e.pos - n.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(s, s + 1) || !(i.isTextblock || qe(r.doc, e.pos)) ? !1 : (t && t(r.tr.join(e.pos).scrollIntoView()), !0);
9254
9254
  }
9255
- function uo(r, e, t, n) {
9255
+ function co(r, e, t, n) {
9256
9256
  let i = e.nodeBefore, s = e.nodeAfter, o, l, a = i.type.spec.isolating || s.type.spec.isolating;
9257
- if (!a && Ec(r, e, t))
9257
+ if (!a && Mc(r, e, t))
9258
9258
  return !0;
9259
9259
  let c = !a && e.parent.canReplace(e.index(), e.index() + 1);
9260
9260
  if (c && (o = (l = i.contentMatchAt(i.childCount)).findWrapping(s.type)) && l.matchType(o[0] || s.type).validEnd) {
@@ -9291,7 +9291,7 @@ function uo(r, e, t, n) {
9291
9291
  }
9292
9292
  return !1;
9293
9293
  }
9294
- function fo(r) {
9294
+ function uo(r) {
9295
9295
  return function(e, t) {
9296
9296
  let n = e.selection, i = r < 0 ? n.$from : n.$to, s = i.depth;
9297
9297
  for (; i.node(s).isInline; ) {
@@ -9302,10 +9302,10 @@ function fo(r) {
9302
9302
  return i.node(s).isTextblock ? (t && t(e.tr.setSelection(T.create(e.doc, r < 0 ? i.start(s) : i.end(s)))), !0) : !1;
9303
9303
  };
9304
9304
  }
9305
- const Tc = fo(-1), Oc = fo(1);
9306
- function Nc(r, e = null) {
9305
+ const Ec = uo(-1), Tc = uo(1);
9306
+ function Oc(r, e = null) {
9307
9307
  return function(t, n) {
9308
- let { $from: i, $to: s } = t.selection, o = i.blockRange(s), l = o && ds(o, r, e);
9308
+ let { $from: i, $to: s } = t.selection, o = i.blockRange(s), l = o && us(o, r, e);
9309
9309
  return l ? (n && n(t.tr.wrap(o, l).scrollIntoView()), !0) : !1;
9310
9310
  };
9311
9311
  }
@@ -9347,20 +9347,20 @@ function Sr(...r) {
9347
9347
  return !1;
9348
9348
  };
9349
9349
  }
9350
- Sr(yr, to, ro);
9351
- Sr(yr, so, oo);
9352
- Sr(lo, ao, co, wc);
9350
+ Sr(yr, eo, no);
9351
+ Sr(yr, io, so);
9352
+ Sr(oo, lo, ao, Cc);
9353
9353
  typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
9354
- function Ac(r, e = null) {
9354
+ function Nc(r, e = null) {
9355
9355
  return function(t, n) {
9356
9356
  let { $from: i, $to: s } = t.selection, o = i.blockRange(s);
9357
9357
  if (!o)
9358
9358
  return !1;
9359
9359
  let l = n ? t.tr : null;
9360
- return vc(l, o, r, e) ? (n && n(l.scrollIntoView()), !0) : !1;
9360
+ return Ac(l, o, r, e) ? (n && n(l.scrollIntoView()), !0) : !1;
9361
9361
  };
9362
9362
  }
9363
- function vc(r, e, t, n = null) {
9363
+ function Ac(r, e, t, n = null) {
9364
9364
  let i = !1, s = e, o = e.$from.doc;
9365
9365
  if (e.depth >= 2 && e.$from.node(e.depth - 1).type.compatibleContent(t) && e.startIndex == 0) {
9366
9366
  if (e.$from.index(e.depth - 1) == 0)
@@ -9368,10 +9368,10 @@ function vc(r, e, t, n = null) {
9368
9368
  let a = o.resolve(e.start - 2);
9369
9369
  s = new Jt(a, a, e.depth), e.endIndex < e.parent.childCount && (e = new Jt(e.$from, o.resolve(e.$to.end(e.depth)), e.depth)), i = !0;
9370
9370
  }
9371
- let l = ds(s, t, n, e);
9372
- return l ? (r && Dc(r, e, l, i, t), !0) : !1;
9371
+ let l = us(s, t, n, e);
9372
+ return l ? (r && vc(r, e, l, i, t), !0) : !1;
9373
9373
  }
9374
- function Dc(r, e, t, n, i) {
9374
+ function vc(r, e, t, n, i) {
9375
9375
  let s = b.empty;
9376
9376
  for (let u = t.length - 1; u >= 0; u--)
9377
9377
  s = b.from(t[u].type.create(t[u].attrs, s));
@@ -9384,13 +9384,13 @@ function Dc(r, e, t, n, i) {
9384
9384
  !f && me(r.doc, a, l) && (r.split(a, l), a += 2 * l), a += c.child(u).nodeSize;
9385
9385
  return r;
9386
9386
  }
9387
- function Ic(r) {
9387
+ function Dc(r) {
9388
9388
  return function(e, t) {
9389
9389
  let { $from: n, $to: i } = e.selection, s = n.blockRange(i, (o) => o.childCount > 0 && o.firstChild.type == r);
9390
- return s ? t ? n.node(s.depth - 1).type == r ? Pc(e, t, r, s) : Rc(e, t, s) : !0 : !1;
9390
+ return s ? t ? n.node(s.depth - 1).type == r ? Ic(e, t, r, s) : Pc(e, t, s) : !0 : !1;
9391
9391
  };
9392
9392
  }
9393
- function Pc(r, e, t, n) {
9393
+ function Ic(r, e, t, n) {
9394
9394
  let i = r.tr, s = n.end, o = n.$to.end(n.depth);
9395
9395
  s < o && (i.step(new z(s - 1, o, s, o, new k(b.from(t.create(null, n.parent.copy())), 1, 0), 1, !0)), n = new Jt(i.doc.resolve(n.$from.pos), i.doc.resolve(o), n.depth));
9396
9396
  const l = st(n);
@@ -9400,7 +9400,7 @@ function Pc(r, e, t, n) {
9400
9400
  let a = i.doc.resolve(i.mapping.map(s, -1) - 1);
9401
9401
  return qe(i.doc, a.pos) && a.nodeBefore.type == a.nodeAfter.type && i.join(a.pos), e(i.scrollIntoView()), !0;
9402
9402
  }
9403
- function Rc(r, e, t) {
9403
+ function Pc(r, e, t) {
9404
9404
  let n = r.tr, i = t.parent;
9405
9405
  for (let h = t.end, p = t.endIndex - 1, m = t.startIndex; p > m; p--)
9406
9406
  h -= i.child(p).nodeSize, n.delete(h - 1, h + 1);
@@ -9413,7 +9413,7 @@ function Rc(r, e, t) {
9413
9413
  let d = s.pos, f = d + o.nodeSize;
9414
9414
  return n.step(new z(d - (l ? 1 : 0), f + (a ? 1 : 0), d + 1, f - 1, new k((l ? b.empty : b.from(i.copy(b.empty))).append(a ? b.empty : b.from(i.copy(b.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), e(n.scrollIntoView()), !0;
9415
9415
  }
9416
- function Bc(r) {
9416
+ function Rc(r) {
9417
9417
  return function(e, t) {
9418
9418
  let { $from: n, $to: i } = e.selection, s = n.blockRange(i, (c) => c.childCount > 0 && c.firstChild.type == r);
9419
9419
  if (!s)
@@ -9516,7 +9516,7 @@ class un {
9516
9516
  return l;
9517
9517
  }
9518
9518
  }
9519
- class zc {
9519
+ class Bc {
9520
9520
  constructor() {
9521
9521
  this.callbacks = {};
9522
9522
  }
@@ -9555,7 +9555,7 @@ function dn(r) {
9555
9555
  markExtensions: n
9556
9556
  };
9557
9557
  }
9558
- function ho(r) {
9558
+ function fo(r) {
9559
9559
  const e = [], { nodeExtensions: t, markExtensions: n } = dn(r), i = [...t, ...n], s = {
9560
9560
  default: null,
9561
9561
  rendered: !0,
@@ -9617,7 +9617,7 @@ function L(r, e) {
9617
9617
  }
9618
9618
  return r;
9619
9619
  }
9620
- function Fc(...r) {
9620
+ function zc(...r) {
9621
9621
  return r.filter((e) => !!e).reduce((e, t) => {
9622
9622
  const n = { ...e };
9623
9623
  return Object.entries(t).forEach(([i, s]) => {
@@ -9645,18 +9645,18 @@ function Fc(...r) {
9645
9645
  function Qn(r, e) {
9646
9646
  return e.filter((t) => t.type === r.type.name).filter((t) => t.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(r.attrs) || {} : {
9647
9647
  [t.name]: r.attrs[t.name]
9648
- }).reduce((t, n) => Fc(t, n), {});
9648
+ }).reduce((t, n) => zc(t, n), {});
9649
9649
  }
9650
- function po(r) {
9650
+ function ho(r) {
9651
9651
  return typeof r == "function";
9652
9652
  }
9653
9653
  function N(r, e = void 0, ...t) {
9654
- return po(r) ? e ? r.bind(e)(...t) : r(...t) : r;
9654
+ return ho(r) ? e ? r.bind(e)(...t) : r(...t) : r;
9655
9655
  }
9656
- function Lc(r = {}) {
9656
+ function Fc(r = {}) {
9657
9657
  return Object.keys(r).length === 0 && r.constructor === Object;
9658
9658
  }
9659
- function $c(r) {
9659
+ function Lc(r) {
9660
9660
  return typeof r != "string" ? r : r.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(r) : r === "true" ? !0 : r === "false" ? !1 : r;
9661
9661
  }
9662
9662
  function Ni(r, e) {
@@ -9667,7 +9667,7 @@ function Ni(r, e) {
9667
9667
  if (n === !1)
9668
9668
  return !1;
9669
9669
  const i = e.reduce((s, o) => {
9670
- const l = o.attribute.parseHTML ? o.attribute.parseHTML(t) : $c(t.getAttribute(o.name));
9670
+ const l = o.attribute.parseHTML ? o.attribute.parseHTML(t) : Lc(t.getAttribute(o.name));
9671
9671
  return l == null ? s : {
9672
9672
  ...s,
9673
9673
  [o.name]: l
@@ -9680,12 +9680,12 @@ function Ni(r, e) {
9680
9680
  function Ai(r) {
9681
9681
  return Object.fromEntries(
9682
9682
  // @ts-ignore
9683
- Object.entries(r).filter(([e, t]) => e === "attrs" && Lc(t) ? !1 : t != null)
9683
+ Object.entries(r).filter(([e, t]) => e === "attrs" && Fc(t) ? !1 : t != null)
9684
9684
  );
9685
9685
  }
9686
- function Vc(r, e) {
9686
+ function $c(r, e) {
9687
9687
  var t;
9688
- const n = ho(r), { nodeExtensions: i, markExtensions: s } = dn(r), o = (t = i.find((c) => x(c, "topNode"))) === null || t === void 0 ? void 0 : t.name, l = Object.fromEntries(i.map((c) => {
9688
+ const n = fo(r), { nodeExtensions: i, markExtensions: s } = dn(r), o = (t = i.find((c) => x(c, "topNode"))) === null || t === void 0 ? void 0 : t.name, l = Object.fromEntries(i.map((c) => {
9689
9689
  const u = n.filter((y) => y.type === c.name), d = {
9690
9690
  name: c.name,
9691
9691
  options: c.options,
@@ -9755,7 +9755,7 @@ function Vc(r, e) {
9755
9755
  HTMLAttributes: Qn(g, u)
9756
9756
  })), [c.name, h];
9757
9757
  }));
9758
- return new ns({
9758
+ return new ts({
9759
9759
  topNode: o,
9760
9760
  nodes: l,
9761
9761
  marks: a
@@ -9771,7 +9771,7 @@ function Cr(r, e) {
9771
9771
  const t = Je.fromSchema(e).serializeFragment(r), i = document.implementation.createHTMLDocument().createElement("div");
9772
9772
  return i.appendChild(t), i.innerHTML;
9773
9773
  }
9774
- const jc = (r, e = 500) => {
9774
+ const Vc = (r, e = 500) => {
9775
9775
  let t = "";
9776
9776
  const n = r.parentOffset;
9777
9777
  return r.parent.nodesBetween(Math.max(0, n - e), n, (i, s, o, l) => {
@@ -9788,7 +9788,7 @@ const jc = (r, e = 500) => {
9788
9788
  function wr(r) {
9789
9789
  return Object.prototype.toString.call(r) === "[object RegExp]";
9790
9790
  }
9791
- const Hc = (r, e) => {
9791
+ const jc = (r, e) => {
9792
9792
  if (wr(e))
9793
9793
  return e.exec(r);
9794
9794
  const t = e(r);
@@ -9809,11 +9809,11 @@ function Dt(r) {
9809
9809
  )
9810
9810
  return !1;
9811
9811
  let u = !1;
9812
- const d = jc(c) + s;
9812
+ const d = Vc(c) + s;
9813
9813
  return o.forEach((f) => {
9814
9814
  if (u)
9815
9815
  return;
9816
- const h = Hc(d, f.find);
9816
+ const h = jc(d, f.find);
9817
9817
  if (!h)
9818
9818
  return;
9819
9819
  const p = a.state.tr, m = cn({
@@ -9841,7 +9841,7 @@ function Dt(r) {
9841
9841
  }), a.dispatch(p), u = !0);
9842
9842
  }), u;
9843
9843
  }
9844
- function Wc(r) {
9844
+ function Hc(r) {
9845
9845
  const { editor: e, rules: t } = r, n = new Q({
9846
9846
  state: {
9847
9847
  init() {
@@ -9913,11 +9913,11 @@ function Wc(r) {
9913
9913
  });
9914
9914
  return n;
9915
9915
  }
9916
- function Jc(r) {
9916
+ function Wc(r) {
9917
9917
  return Object.prototype.toString.call(r).slice(8, -1);
9918
9918
  }
9919
9919
  function It(r) {
9920
- return Jc(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
9920
+ return Wc(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
9921
9921
  }
9922
9922
  function fn(r, e) {
9923
9923
  const t = { ...r };
@@ -9971,10 +9971,10 @@ class Ct {
9971
9971
  return !1;
9972
9972
  }
9973
9973
  }
9974
- function qc(r) {
9974
+ function Jc(r) {
9975
9975
  return typeof r == "number";
9976
9976
  }
9977
- const Kc = (r, e, t) => {
9977
+ const qc = (r, e, t) => {
9978
9978
  if (wr(e))
9979
9979
  return [...r.matchAll(e)];
9980
9980
  const n = e(r, t);
@@ -9983,7 +9983,7 @@ const Kc = (r, e, t) => {
9983
9983
  return s.index = i.index, s.input = r, s.data = i.data, i.replaceWith && (i.text.includes(i.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), s.push(i.replaceWith)), s;
9984
9984
  }) : [];
9985
9985
  };
9986
- function Uc(r) {
9986
+ function Kc(r) {
9987
9987
  const { editor: e, state: t, from: n, to: i, rule: s, pasteEvent: o, dropEvent: l } = r, { commands: a, chain: c, can: u } = new un({
9988
9988
  editor: e,
9989
9989
  state: t
@@ -9992,7 +9992,7 @@ function Uc(r) {
9992
9992
  if (!h.isTextblock || h.type.spec.code)
9993
9993
  return;
9994
9994
  const m = Math.max(n, p), g = Math.min(i, p + h.content.size), y = h.textBetween(m - p, g - p, void 0, "");
9995
- Kc(y, s.find, o).forEach((w) => {
9995
+ qc(y, s.find, o).forEach((w) => {
9996
9996
  if (w.index === void 0)
9997
9997
  return;
9998
9998
  const v = m + w.index + 1, A = v + w[0].length, M = {
@@ -10013,14 +10013,14 @@ function Uc(r) {
10013
10013
  }), d.every((h) => h !== null);
10014
10014
  }
10015
10015
  let Pt = null;
10016
- const _c = (r) => {
10016
+ const Uc = (r) => {
10017
10017
  var e;
10018
10018
  const t = new ClipboardEvent("paste", {
10019
10019
  clipboardData: new DataTransfer()
10020
10020
  });
10021
10021
  return (e = t.clipboardData) === null || e === void 0 || e.setData("text/html", r), t;
10022
10022
  };
10023
- function Gc(r) {
10023
+ function _c(r) {
10024
10024
  const { editor: e, rules: t } = r;
10025
10025
  let n = null, i = !1, s = !1, o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, l;
10026
10026
  try {
@@ -10033,7 +10033,7 @@ function Gc(r) {
10033
10033
  state: u,
10034
10034
  transaction: m
10035
10035
  });
10036
- if (!(!Uc({
10036
+ if (!(!Kc({
10037
10037
  editor: e,
10038
10038
  state: g,
10039
10039
  from: Math.max(d - 1, 0),
@@ -10091,7 +10091,7 @@ function Gc(r) {
10091
10091
  if (S) {
10092
10092
  let { text: A } = y;
10093
10093
  typeof A == "string" ? A = A : A = Cr(b.from(A), h.schema);
10094
- const { from: M } = y, I = M + A.length, H = _c(A);
10094
+ const { from: M } = y, I = M + A.length, H = Uc(A);
10095
10095
  return a({
10096
10096
  rule: u,
10097
10097
  state: h,
@@ -10101,7 +10101,7 @@ function Gc(r) {
10101
10101
  });
10102
10102
  }
10103
10103
  const w = f.doc.content.findDiffStart(h.doc.content), v = f.doc.content.findDiffEnd(h.doc.content);
10104
- if (!(!qc(w) || !v || w === v.b))
10104
+ if (!(!Jc(w) || !v || w === v.b))
10105
10105
  return a({
10106
10106
  rule: u,
10107
10107
  state: h,
@@ -10112,13 +10112,13 @@ function Gc(r) {
10112
10112
  }
10113
10113
  }));
10114
10114
  }
10115
- function Yc(r) {
10115
+ function Gc(r) {
10116
10116
  const e = r.filter((t, n) => r.indexOf(t) !== n);
10117
10117
  return Array.from(new Set(e));
10118
10118
  }
10119
10119
  class Xe {
10120
10120
  constructor(e, t) {
10121
- this.splittableMarks = [], this.editor = t, this.extensions = Xe.resolve(e), this.schema = Vc(this.extensions, t), this.setupExtensions();
10121
+ this.splittableMarks = [], this.editor = t, this.extensions = Xe.resolve(e), this.schema = $c(this.extensions, t), this.setupExtensions();
10122
10122
  }
10123
10123
  /**
10124
10124
  * Returns a flattened and sorted extension list while
@@ -10127,7 +10127,7 @@ class Xe {
10127
10127
  * @returns An flattened and sorted array of Tiptap extensions
10128
10128
  */
10129
10129
  static resolve(e) {
10130
- const t = Xe.sort(Xe.flatten(e)), n = Yc(t.map((i) => i.name));
10130
+ const t = Xe.sort(Xe.flatten(e)), n = Gc(t.map((i) => i.name));
10131
10131
  return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((i) => `'${i}'`).join(", ")}]. This can lead to issues.`), t;
10132
10132
  }
10133
10133
  /**
@@ -10193,7 +10193,7 @@ class Xe {
10193
10193
  const m = Object.fromEntries(Object.entries(c()).map(([g, y]) => [g, () => y({ editor: e })]));
10194
10194
  u = { ...u, ...m };
10195
10195
  }
10196
- const d = pc(u);
10196
+ const d = hc(u);
10197
10197
  a.push(d);
10198
10198
  const f = x(o, "addInputRules", l);
10199
10199
  vi(o, e.options.enableInputRules) && f && n.push(...f());
@@ -10207,11 +10207,11 @@ class Xe {
10207
10207
  return a;
10208
10208
  }).flat();
10209
10209
  return [
10210
- Wc({
10210
+ Hc({
10211
10211
  editor: e,
10212
10212
  rules: n
10213
10213
  }),
10214
- ...Gc({
10214
+ ..._c({
10215
10215
  editor: e,
10216
10216
  rules: i
10217
10217
  }),
@@ -10223,7 +10223,7 @@ class Xe {
10223
10223
  * @returns An array of attributes
10224
10224
  */
10225
10225
  get attributes() {
10226
- return ho(this.extensions);
10226
+ return fo(this.extensions);
10227
10227
  }
10228
10228
  /**
10229
10229
  * Get all node views from the extensions.
@@ -10315,7 +10315,7 @@ class Y {
10315
10315
  })), t;
10316
10316
  }
10317
10317
  }
10318
- function mo(r, e, t) {
10318
+ function po(r, e, t) {
10319
10319
  const { from: n, to: i } = e, { blockSeparator: s = `
10320
10320
 
10321
10321
  `, textSerializers: o = {} } = t || {};
@@ -10335,10 +10335,10 @@ function mo(r, e, t) {
10335
10335
  a.isText && (l += (f = a == null ? void 0 : a.text) === null || f === void 0 ? void 0 : f.slice(Math.max(n, c) - c, i - c));
10336
10336
  }), l;
10337
10337
  }
10338
- function go(r) {
10338
+ function mo(r) {
10339
10339
  return Object.fromEntries(Object.entries(r.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
10340
10340
  }
10341
- const Xc = Y.create({
10341
+ const Yc = Y.create({
10342
10342
  name: "clipboardTextSerializer",
10343
10343
  addOptions() {
10344
10344
  return {
@@ -10351,8 +10351,8 @@ const Xc = Y.create({
10351
10351
  key: new le("clipboardTextSerializer"),
10352
10352
  props: {
10353
10353
  clipboardTextSerializer: () => {
10354
- const { editor: r } = this, { state: e, schema: t } = r, { doc: n, selection: i } = e, { ranges: s } = i, o = Math.min(...s.map((u) => u.$from.pos)), l = Math.max(...s.map((u) => u.$to.pos)), a = go(t);
10355
- return mo(n, { from: o, to: l }, {
10354
+ const { editor: r } = this, { state: e, schema: t } = r, { doc: n, selection: i } = e, { ranges: s } = i, o = Math.min(...s.map((u) => u.$from.pos)), l = Math.max(...s.map((u) => u.$to.pos)), a = mo(t);
10355
+ return po(n, { from: o, to: l }, {
10356
10356
  ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
10357
10357
  textSerializers: a
10358
10358
  });
@@ -10361,10 +10361,10 @@ const Xc = Y.create({
10361
10361
  })
10362
10362
  ];
10363
10363
  }
10364
- }), Zc = () => ({ editor: r, view: e }) => (requestAnimationFrame(() => {
10364
+ }), Xc = () => ({ editor: r, view: e }) => (requestAnimationFrame(() => {
10365
10365
  var t;
10366
10366
  r.isDestroyed || (e.dom.blur(), (t = window == null ? void 0 : window.getSelection()) === null || t === void 0 || t.removeAllRanges());
10367
- }), !0), Qc = (r = !1) => ({ commands: e }) => e.setContent("", r), eu = () => ({ state: r, tr: e, dispatch: t }) => {
10367
+ }), !0), Zc = (r = !1) => ({ commands: e }) => e.setContent("", r), Qc = () => ({ state: r, tr: e, dispatch: t }) => {
10368
10368
  const { selection: n } = e, { ranges: i } = n;
10369
10369
  return t && i.forEach(({ $from: s, $to: o }) => {
10370
10370
  r.doc.nodesBetween(s.pos, o.pos, (l, a) => {
@@ -10381,12 +10381,12 @@ const Xc = Y.create({
10381
10381
  (p || p === 0) && e.lift(h, p);
10382
10382
  });
10383
10383
  }), !0;
10384
- }, tu = (r) => (e) => r(e), nu = () => ({ state: r, dispatch: e }) => ao(r, e), ru = (r, e) => ({ editor: t, tr: n }) => {
10384
+ }, eu = (r) => (e) => r(e), tu = () => ({ state: r, dispatch: e }) => lo(r, e), nu = (r, e) => ({ editor: t, tr: n }) => {
10385
10385
  const { state: i } = t, s = i.doc.slice(r.from, r.to);
10386
10386
  n.deleteRange(r.from, r.to);
10387
10387
  const o = n.mapping.map(e);
10388
10388
  return n.insert(o, s.content), n.setSelection(new T(n.doc.resolve(o - 1))), !0;
10389
- }, iu = () => ({ tr: r, dispatch: e }) => {
10389
+ }, ru = () => ({ tr: r, dispatch: e }) => {
10390
10390
  const { selection: t } = r, n = t.$anchor.node();
10391
10391
  if (n.content.size > 0)
10392
10392
  return !1;
@@ -10400,7 +10400,7 @@ const Xc = Y.create({
10400
10400
  return !0;
10401
10401
  }
10402
10402
  return !1;
10403
- }, su = (r) => ({ tr: e, state: t, dispatch: n }) => {
10403
+ }, iu = (r) => ({ tr: e, state: t, dispatch: n }) => {
10404
10404
  const i = L(r, t.schema), s = e.selection.$anchor;
10405
10405
  for (let o = s.depth; o > 0; o -= 1)
10406
10406
  if (s.node(o).type === i) {
@@ -10411,15 +10411,15 @@ const Xc = Y.create({
10411
10411
  return !0;
10412
10412
  }
10413
10413
  return !1;
10414
- }, ou = (r) => ({ tr: e, dispatch: t }) => {
10414
+ }, su = (r) => ({ tr: e, dispatch: t }) => {
10415
10415
  const { from: n, to: i } = r;
10416
10416
  return t && e.delete(n, i), !0;
10417
- }, lu = () => ({ state: r, dispatch: e }) => yr(r, e), au = () => ({ commands: r }) => r.keyboardShortcut("Enter"), cu = () => ({ state: r, dispatch: e }) => Sc(r, e);
10417
+ }, ou = () => ({ state: r, dispatch: e }) => yr(r, e), lu = () => ({ commands: r }) => r.keyboardShortcut("Enter"), au = () => ({ state: r, dispatch: e }) => xc(r, e);
10418
10418
  function Zt(r, e, t = { strict: !0 }) {
10419
10419
  const n = Object.keys(e);
10420
10420
  return n.length ? n.every((i) => t.strict ? e[i] === r[i] : wr(e[i]) ? e[i].test(r[i]) : e[i] === r[i]) : !0;
10421
10421
  }
10422
- function yo(r, e, t = {}) {
10422
+ function go(r, e, t = {}) {
10423
10423
  return r.find((n) => n.type === e && Zt(
10424
10424
  // Only check equality for the attributes that are provided
10425
10425
  Object.fromEntries(Object.keys(t).map((i) => [i, n.attrs[i]])),
@@ -10427,14 +10427,14 @@ function yo(r, e, t = {}) {
10427
10427
  ));
10428
10428
  }
10429
10429
  function Di(r, e, t = {}) {
10430
- return !!yo(r, e, t);
10430
+ return !!go(r, e, t);
10431
10431
  }
10432
10432
  function Mr(r, e, t) {
10433
10433
  var n;
10434
10434
  if (!r || !e)
10435
10435
  return;
10436
10436
  let i = r.parent.childAfter(r.parentOffset);
10437
- if ((!i.node || !i.node.marks.some((u) => u.type === e)) && (i = r.parent.childBefore(r.parentOffset)), !i.node || !i.node.marks.some((u) => u.type === e) || (t = t || ((n = i.node.marks[0]) === null || n === void 0 ? void 0 : n.attrs), !yo([...i.node.marks], e, t)))
10437
+ if ((!i.node || !i.node.marks.some((u) => u.type === e)) && (i = r.parent.childBefore(r.parentOffset)), !i.node || !i.node.marks.some((u) => u.type === e) || (t = t || ((n = i.node.marks[0]) === null || n === void 0 ? void 0 : n.attrs), !go([...i.node.marks], e, t)))
10438
10438
  return;
10439
10439
  let o = i.index, l = r.start() + i.offset, a = o + 1, c = l + i.node.nodeSize;
10440
10440
  for (; o > 0 && Di([...r.parent.child(o - 1).marks], e, t); )
@@ -10454,7 +10454,7 @@ function ve(r, e) {
10454
10454
  }
10455
10455
  return r;
10456
10456
  }
10457
- const uu = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
10457
+ const cu = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
10458
10458
  const s = ve(r, n.schema), { doc: o, selection: l } = t, { $from: a, from: c, to: u } = l;
10459
10459
  if (i) {
10460
10460
  const d = Mr(a, s, e);
@@ -10464,20 +10464,20 @@ const uu = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
10464
10464
  }
10465
10465
  }
10466
10466
  return !0;
10467
- }, du = (r) => (e) => {
10467
+ }, uu = (r) => (e) => {
10468
10468
  const t = typeof r == "function" ? r(e) : r;
10469
10469
  for (let n = 0; n < t.length; n += 1)
10470
10470
  if (t[n](e))
10471
10471
  return !0;
10472
10472
  return !1;
10473
10473
  };
10474
- function bo(r) {
10474
+ function yo(r) {
10475
10475
  return r instanceof T;
10476
10476
  }
10477
10477
  function Be(r = 0, e = 0, t = 0) {
10478
10478
  return Math.min(Math.max(r, e), t);
10479
10479
  }
10480
- function ko(r, e = null) {
10480
+ function bo(r, e = null) {
10481
10481
  if (!e)
10482
10482
  return null;
10483
10483
  const t = O.atStart(r), n = O.atEnd(r);
@@ -10488,7 +10488,7 @@ function ko(r, e = null) {
10488
10488
  const i = t.from, s = n.to;
10489
10489
  return e === "all" ? T.create(r, Be(0, i, s), Be(r.content.size, i, s)) : T.create(r, Be(e, i, s), Be(e, i, s));
10490
10490
  }
10491
- function fu() {
10491
+ function du() {
10492
10492
  return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
10493
10493
  }
10494
10494
  function Er() {
@@ -10501,33 +10501,33 @@ function Er() {
10501
10501
  "iPod"
10502
10502
  ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
10503
10503
  }
10504
- const hu = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) => {
10504
+ const fu = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) => {
10505
10505
  e = {
10506
10506
  scrollIntoView: !0,
10507
10507
  ...e
10508
10508
  };
10509
10509
  const o = () => {
10510
- (Er() || fu()) && n.dom.focus(), requestAnimationFrame(() => {
10510
+ (Er() || du()) && n.dom.focus(), requestAnimationFrame(() => {
10511
10511
  t.isDestroyed || (n.focus(), e != null && e.scrollIntoView && t.commands.scrollIntoView());
10512
10512
  });
10513
10513
  };
10514
10514
  if (n.hasFocus() && r === null || r === !1)
10515
10515
  return !0;
10516
- if (s && r === null && !bo(t.state.selection))
10516
+ if (s && r === null && !yo(t.state.selection))
10517
10517
  return o(), !0;
10518
- const l = ko(i.doc, r) || t.state.selection, a = t.state.selection.eq(l);
10518
+ const l = bo(i.doc, r) || t.state.selection, a = t.state.selection.eq(l);
10519
10519
  return s && (a || i.setSelection(l), a && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
10520
- }, pu = (r, e) => (t) => r.every((n, i) => e(n, { ...t, index: i })), mu = (r, e) => ({ tr: t, commands: n }) => n.insertContentAt({ from: t.selection.from, to: t.selection.to }, r, e), xo = (r) => {
10520
+ }, hu = (r, e) => (t) => r.every((n, i) => e(n, { ...t, index: i })), pu = (r, e) => ({ tr: t, commands: n }) => n.insertContentAt({ from: t.selection.from, to: t.selection.to }, r, e), ko = (r) => {
10521
10521
  const e = r.childNodes;
10522
10522
  for (let t = e.length - 1; t >= 0; t -= 1) {
10523
10523
  const n = e[t];
10524
- n.nodeType === 3 && n.nodeValue && /^(\n\s\s|\n)$/.test(n.nodeValue) ? r.removeChild(n) : n.nodeType === 1 && xo(n);
10524
+ n.nodeType === 3 && n.nodeValue && /^(\n\s\s|\n)$/.test(n.nodeValue) ? r.removeChild(n) : n.nodeType === 1 && ko(n);
10525
10525
  }
10526
10526
  return r;
10527
10527
  };
10528
10528
  function Rt(r) {
10529
10529
  const e = `<body>${r}</body>`, t = new window.DOMParser().parseFromString(e, "text/html").body;
10530
- return xo(t);
10530
+ return ko(t);
10531
10531
  }
10532
10532
  function Qt(r, e, t) {
10533
10533
  if (r instanceof Me || r instanceof b)
@@ -10552,7 +10552,7 @@ function Qt(r, e, t) {
10552
10552
  if (i) {
10553
10553
  if (t.errorOnInvalidContent) {
10554
10554
  let o = !1, l = "";
10555
- const a = new ns({
10555
+ const a = new ts({
10556
10556
  topNode: e.spec.topNode,
10557
10557
  marks: e.spec.marks,
10558
10558
  // Prosemirror's schemas are executed such that: the last to execute, matches last
@@ -10578,7 +10578,7 @@ function Qt(r, e, t) {
10578
10578
  }
10579
10579
  return Qt("", e, t);
10580
10580
  }
10581
- function gu(r, e, t) {
10581
+ function mu(r, e, t) {
10582
10582
  const n = r.steps.length - 1;
10583
10583
  if (n < e)
10584
10584
  return;
@@ -10591,7 +10591,7 @@ function gu(r, e, t) {
10591
10591
  o === 0 && (o = u);
10592
10592
  }), r.setSelection(O.near(r.doc.resolve(o), t));
10593
10593
  }
10594
- const yu = (r) => !("type" in r), bu = (r, e, t) => ({ tr: n, dispatch: i, editor: s }) => {
10594
+ const gu = (r) => !("type" in r), yu = (r, e, t) => ({ tr: n, dispatch: i, editor: s }) => {
10595
10595
  var o;
10596
10596
  if (i) {
10597
10597
  t = {
@@ -10620,7 +10620,7 @@ const yu = (r) => !("type" in r), bu = (r, e, t) => ({ tr: n, dispatch: i, edito
10620
10620
  }), !1;
10621
10621
  }
10622
10622
  let { from: a, to: c } = typeof r == "number" ? { from: r, to: r } : { from: r.from, to: r.to }, u = !0, d = !0;
10623
- if ((yu(l) ? l : [l]).forEach((p) => {
10623
+ if ((gu(l) ? l : [l]).forEach((p) => {
10624
10624
  p.check(), u = u ? p.isText && p.marks.length === 0 : !1, d = d ? p.isBlock : !1;
10625
10625
  }), a === c && d) {
10626
10626
  const { parent: p } = n.doc.resolve(a);
@@ -10639,28 +10639,28 @@ const yu = (r) => !("type" in r), bu = (r, e, t) => ({ tr: n, dispatch: i, edito
10639
10639
  n.insertText(h, a, c);
10640
10640
  } else
10641
10641
  h = l, n.replaceWith(a, c, h);
10642
- t.updateSelection && gu(n, n.steps.length - 1, -1), t.applyInputRules && n.setMeta("applyInputRules", { from: a, text: h }), t.applyPasteRules && n.setMeta("applyPasteRules", { from: a, text: h });
10642
+ t.updateSelection && mu(n, n.steps.length - 1, -1), t.applyInputRules && n.setMeta("applyInputRules", { from: a, text: h }), t.applyPasteRules && n.setMeta("applyPasteRules", { from: a, text: h });
10643
10643
  }
10644
10644
  return !0;
10645
- }, ku = () => ({ state: r, dispatch: e }) => bc(r, e), xu = () => ({ state: r, dispatch: e }) => kc(r, e), Su = () => ({ state: r, dispatch: e }) => to(r, e), Cu = () => ({ state: r, dispatch: e }) => so(r, e), wu = () => ({ state: r, dispatch: e, tr: t }) => {
10645
+ }, bu = () => ({ state: r, dispatch: e }) => yc(r, e), ku = () => ({ state: r, dispatch: e }) => bc(r, e), xu = () => ({ state: r, dispatch: e }) => eo(r, e), Su = () => ({ state: r, dispatch: e }) => io(r, e), Cu = () => ({ state: r, dispatch: e, tr: t }) => {
10646
10646
  try {
10647
10647
  const n = nn(r.doc, r.selection.$from.pos, -1);
10648
10648
  return n == null ? !1 : (t.join(n, 2), e && e(t), !0);
10649
10649
  } catch {
10650
10650
  return !1;
10651
10651
  }
10652
- }, Mu = () => ({ state: r, dispatch: e, tr: t }) => {
10652
+ }, wu = () => ({ state: r, dispatch: e, tr: t }) => {
10653
10653
  try {
10654
10654
  const n = nn(r.doc, r.selection.$from.pos, 1);
10655
10655
  return n == null ? !1 : (t.join(n, 2), e && e(t), !0);
10656
10656
  } catch {
10657
10657
  return !1;
10658
10658
  }
10659
- }, Eu = () => ({ state: r, dispatch: e }) => gc(r, e), Tu = () => ({ state: r, dispatch: e }) => yc(r, e);
10660
- function So() {
10659
+ }, Mu = () => ({ state: r, dispatch: e }) => mc(r, e), Eu = () => ({ state: r, dispatch: e }) => gc(r, e);
10660
+ function xo() {
10661
10661
  return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
10662
10662
  }
10663
- function Ou(r) {
10663
+ function Tu(r) {
10664
10664
  const e = r.split(/-(?!$)/);
10665
10665
  let t = e[e.length - 1];
10666
10666
  t === "Space" && (t = " ");
@@ -10676,14 +10676,14 @@ function Ou(r) {
10676
10676
  else if (/^s(hift)?$/i.test(a))
10677
10677
  s = !0;
10678
10678
  else if (/^mod$/i.test(a))
10679
- Er() || So() ? o = !0 : i = !0;
10679
+ Er() || xo() ? o = !0 : i = !0;
10680
10680
  else
10681
10681
  throw new Error(`Unrecognized modifier name: ${a}`);
10682
10682
  }
10683
10683
  return n && (t = `Alt-${t}`), i && (t = `Ctrl-${t}`), o && (t = `Meta-${t}`), s && (t = `Shift-${t}`), t;
10684
10684
  }
10685
- const Nu = (r) => ({ editor: e, view: t, tr: n, dispatch: i }) => {
10686
- const s = Ou(r).split(/-(?!$)/), o = s.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), l = new KeyboardEvent("keydown", {
10685
+ const Ou = (r) => ({ editor: e, view: t, tr: n, dispatch: i }) => {
10686
+ const s = Tu(r).split(/-(?!$)/), o = s.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), l = new KeyboardEvent("keydown", {
10687
10687
  key: o === "Space" ? " " : o,
10688
10688
  altKey: s.includes("Alt"),
10689
10689
  ctrlKey: s.includes("Ctrl"),
@@ -10714,13 +10714,13 @@ function wt(r, e, t = {}) {
10714
10714
  const a = i - n, c = l.filter((d) => o ? o.name === d.node.type.name : !0).filter((d) => Zt(d.node.attrs, t, { strict: !1 }));
10715
10715
  return s ? !!c.length : c.reduce((d, f) => d + f.to - f.from, 0) >= a;
10716
10716
  }
10717
- const Au = (r, e = {}) => ({ state: t, dispatch: n }) => {
10717
+ const Nu = (r, e = {}) => ({ state: t, dispatch: n }) => {
10718
10718
  const i = L(r, t.schema);
10719
- return wt(t, i, e) ? xc(t, n) : !1;
10720
- }, vu = () => ({ state: r, dispatch: e }) => co(r, e), Du = (r) => ({ state: e, dispatch: t }) => {
10719
+ return wt(t, i, e) ? kc(t, n) : !1;
10720
+ }, Au = () => ({ state: r, dispatch: e }) => ao(r, e), vu = (r) => ({ state: e, dispatch: t }) => {
10721
10721
  const n = L(r, e.schema);
10722
- return Ic(n)(e, t);
10723
- }, Iu = () => ({ state: r, dispatch: e }) => lo(r, e);
10722
+ return Dc(n)(e, t);
10723
+ }, Du = () => ({ state: r, dispatch: e }) => oo(r, e);
10724
10724
  function hn(r, e) {
10725
10725
  return e.nodes[r] ? "node" : e.marks[r] ? "mark" : null;
10726
10726
  }
@@ -10728,7 +10728,7 @@ function Ii(r, e) {
10728
10728
  const t = typeof e == "string" ? [e] : e;
10729
10729
  return Object.keys(r).reduce((n, i) => (t.includes(i) || (n[i] = r[i]), n), {});
10730
10730
  }
10731
- const Pu = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
10731
+ const Iu = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
10732
10732
  let s = null, o = null;
10733
10733
  const l = hn(typeof r == "string" ? r : r.name, n.schema);
10734
10734
  return l ? (l === "node" && (s = L(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
@@ -10738,13 +10738,13 @@ const Pu = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
10738
10738
  });
10739
10739
  });
10740
10740
  }), !0) : !1;
10741
- }, Ru = () => ({ tr: r, dispatch: e }) => (e && r.scrollIntoView(), !0), Bu = () => ({ tr: r, dispatch: e }) => {
10741
+ }, Pu = () => ({ tr: r, dispatch: e }) => (e && r.scrollIntoView(), !0), Ru = () => ({ tr: r, dispatch: e }) => {
10742
10742
  if (e) {
10743
10743
  const t = new Z(r.doc);
10744
10744
  r.setSelection(t);
10745
10745
  }
10746
10746
  return !0;
10747
- }, zu = () => ({ state: r, dispatch: e }) => ro(r, e), Fu = () => ({ state: r, dispatch: e }) => oo(r, e), Lu = () => ({ state: r, dispatch: e }) => Mc(r, e), $u = () => ({ state: r, dispatch: e }) => Oc(r, e), Vu = () => ({ state: r, dispatch: e }) => Tc(r, e);
10747
+ }, Bu = () => ({ state: r, dispatch: e }) => no(r, e), zu = () => ({ state: r, dispatch: e }) => so(r, e), Fu = () => ({ state: r, dispatch: e }) => wc(r, e), Lu = () => ({ state: r, dispatch: e }) => Tc(r, e), $u = () => ({ state: r, dispatch: e }) => Ec(r, e);
10748
10748
  function er(r, e, t = {}, n = {}) {
10749
10749
  return Qt(r, e, {
10750
10750
  slice: !1,
@@ -10752,7 +10752,7 @@ function er(r, e, t = {}, n = {}) {
10752
10752
  errorOnInvalidContent: n.errorOnInvalidContent
10753
10753
  });
10754
10754
  }
10755
- const ju = (r, e = !1, t = {}, n = {}) => ({ editor: i, tr: s, dispatch: o, commands: l }) => {
10755
+ const Vu = (r, e = !1, t = {}, n = {}) => ({ editor: i, tr: s, dispatch: o, commands: l }) => {
10756
10756
  var a, c;
10757
10757
  const { doc: u } = s;
10758
10758
  if (t.preserveWhitespace !== "full") {
@@ -10766,7 +10766,7 @@ const ju = (r, e = !1, t = {}, n = {}) => ({ editor: i, tr: s, dispatch: o, comm
10766
10766
  errorOnInvalidContent: (c = n.errorOnInvalidContent) !== null && c !== void 0 ? c : i.options.enableContentCheck
10767
10767
  });
10768
10768
  };
10769
- function Co(r, e) {
10769
+ function So(r, e) {
10770
10770
  const t = ve(e, r.schema), { from: n, to: i, empty: s } = r.selection, o = [];
10771
10771
  s ? (r.storedMarks && o.push(...r.storedMarks), o.push(...r.selection.$head.marks())) : r.doc.nodesBetween(n, i, (a) => {
10772
10772
  o.push(...a.marks);
@@ -10774,7 +10774,7 @@ function Co(r, e) {
10774
10774
  const l = o.find((a) => a.type.name === t.name);
10775
10775
  return l ? { ...l.attrs } : {};
10776
10776
  }
10777
- function Hu(r) {
10777
+ function ju(r) {
10778
10778
  for (let e = 0; e < r.edgeCount; e += 1) {
10779
10779
  const { type: t } = r.edge(e);
10780
10780
  if (t.isTextblock && !t.hasRequiredAttrs())
@@ -10797,14 +10797,14 @@ function pt(r, e) {
10797
10797
  function Tr(r) {
10798
10798
  return (e) => pt(e.$from, r);
10799
10799
  }
10800
- function Wu(r, e) {
10800
+ function Hu(r, e) {
10801
10801
  const t = {
10802
10802
  from: 0,
10803
10803
  to: r.content.size
10804
10804
  };
10805
- return mo(r, t, e);
10805
+ return po(r, t, e);
10806
10806
  }
10807
- function Ju(r, e) {
10807
+ function Wu(r, e) {
10808
10808
  const t = L(e, r.schema), { from: n, to: i } = r.selection, s = [];
10809
10809
  r.doc.nodesBetween(n, i, (l) => {
10810
10810
  s.push(l);
@@ -10812,9 +10812,9 @@ function Ju(r, e) {
10812
10812
  const o = s.reverse().find((l) => l.type.name === t.name);
10813
10813
  return o ? { ...o.attrs } : {};
10814
10814
  }
10815
- function qu(r, e) {
10815
+ function Ju(r, e) {
10816
10816
  const t = hn(typeof e == "string" ? e : e.name, r.schema);
10817
- return t === "node" ? Ju(r, e) : t === "mark" ? Co(r, e) : {};
10817
+ return t === "node" ? Wu(r, e) : t === "mark" ? So(r, e) : {};
10818
10818
  }
10819
10819
  function Lt(r, e, t) {
10820
10820
  return Object.fromEntries(Object.entries(t).filter(([n]) => {
@@ -10845,7 +10845,7 @@ function tr(r, e, t = {}) {
10845
10845
  const a = l.filter((d) => s ? s.name === d.mark.type.name : !0).filter((d) => Zt(d.mark.attrs, t, { strict: !1 })).reduce((d, f) => d + f.to - f.from, 0), c = l.filter((d) => s ? d.mark.type !== s && d.mark.type.excludes(s) : !0).reduce((d, f) => d + f.to - f.from, 0);
10846
10846
  return (a > 0 ? a + c : a) >= o;
10847
10847
  }
10848
- function Ku(r, e, t = {}) {
10848
+ function qu(r, e, t = {}) {
10849
10849
  if (!e)
10850
10850
  return wt(r, null, t) || tr(r, null, t);
10851
10851
  const n = hn(e, r.schema);
@@ -10884,11 +10884,11 @@ function pn(r, { checkChildren: e = !0, ignoreWhitespace: t = !1 } = {}) {
10884
10884
  }
10885
10885
  return !1;
10886
10886
  }
10887
- function Uu(r, e, t) {
10887
+ function Ku(r, e, t) {
10888
10888
  var n;
10889
10889
  const { selection: i } = e;
10890
10890
  let s = null;
10891
- if (bo(i) && (s = i.$cursor), s) {
10891
+ if (yo(i) && (s = i.$cursor), s) {
10892
10892
  const l = (n = r.storedMarks) !== null && n !== void 0 ? n : s.marks();
10893
10893
  return !!t.isInSet(l) || !l.some((a) => a.type.excludes(t));
10894
10894
  }
@@ -10906,11 +10906,11 @@ function Uu(r, e, t) {
10906
10906
  }), c;
10907
10907
  });
10908
10908
  }
10909
- const _u = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
10909
+ const Uu = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
10910
10910
  const { selection: s } = t, { empty: o, ranges: l } = s, a = ve(r, n.schema);
10911
10911
  if (i)
10912
10912
  if (o) {
10913
- const c = Co(n, a);
10913
+ const c = So(n, a);
10914
10914
  t.addStoredMark(a.create({
10915
10915
  ...c,
10916
10916
  ...e
@@ -10928,26 +10928,26 @@ const _u = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
10928
10928
  }) : t.addMark(p, m, a.create(e));
10929
10929
  });
10930
10930
  });
10931
- return Uu(n, t, a);
10932
- }, Gu = (r, e) => ({ tr: t }) => (t.setMeta(r, e), !0), Yu = (r, e = {}) => ({ state: t, dispatch: n, chain: i }) => {
10931
+ return Ku(n, t, a);
10932
+ }, _u = (r, e) => ({ tr: t }) => (t.setMeta(r, e), !0), Gu = (r, e = {}) => ({ state: t, dispatch: n, chain: i }) => {
10933
10933
  const s = L(r, t.schema);
10934
10934
  let o;
10935
10935
  return t.selection.$anchor.sameParent(t.selection.$head) && (o = t.selection.$anchor.parent.attrs), s.isTextblock ? i().command(({ commands: l }) => Oi(s, { ...o, ...e })(t) ? !0 : l.clearNodes()).command(({ state: l }) => Oi(s, { ...o, ...e })(l, n)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
10936
- }, Xu = (r) => ({ tr: e, dispatch: t }) => {
10936
+ }, Yu = (r) => ({ tr: e, dispatch: t }) => {
10937
10937
  if (t) {
10938
10938
  const { doc: n } = e, i = Be(r, 0, n.content.size), s = C.create(n, i);
10939
10939
  e.setSelection(s);
10940
10940
  }
10941
10941
  return !0;
10942
- }, Zu = (r) => ({ tr: e, dispatch: t }) => {
10942
+ }, Xu = (r) => ({ tr: e, dispatch: t }) => {
10943
10943
  if (t) {
10944
10944
  const { doc: n } = e, { from: i, to: s } = typeof r == "number" ? { from: r, to: r } : r, o = T.atStart(n).from, l = T.atEnd(n).to, a = Be(i, o, l), c = Be(s, o, l), u = T.create(n, a, c);
10945
10945
  e.setSelection(u);
10946
10946
  }
10947
10947
  return !0;
10948
- }, Qu = (r) => ({ state: e, dispatch: t }) => {
10948
+ }, Zu = (r) => ({ state: e, dispatch: t }) => {
10949
10949
  const n = L(r, e.schema);
10950
- return Bc(n)(e, t);
10950
+ return Rc(n)(e, t);
10951
10951
  };
10952
10952
  function Ri(r, e) {
10953
10953
  const t = r.storedMarks || r.selection.$to.parentOffset && r.selection.$from.marks();
@@ -10956,13 +10956,13 @@ function Ri(r, e) {
10956
10956
  r.tr.ensureMarks(n);
10957
10957
  }
10958
10958
  }
10959
- const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor: i }) => {
10959
+ const Qu = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor: i }) => {
10960
10960
  const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, u = Lt(c, l.node().type.name, l.node().attrs);
10961
10961
  if (s instanceof C && s.node.isBlock)
10962
10962
  return !l.parentOffset || !me(o, l.pos) ? !1 : (n && (r && Ri(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
10963
10963
  if (!l.parent.isBlock)
10964
10964
  return !1;
10965
- const d = a.parentOffset === a.parent.content.size, f = l.depth === 0 ? void 0 : Hu(l.node(-1).contentMatchAt(l.indexAfter(-1)));
10965
+ const d = a.parentOffset === a.parent.content.size, f = l.depth === 0 ? void 0 : ju(l.node(-1).contentMatchAt(l.indexAfter(-1)));
10966
10966
  let h = d && f ? [
10967
10967
  {
10968
10968
  type: f,
@@ -10982,7 +10982,7 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
10982
10982
  r && Ri(t, i.extensionManager.splittableMarks), e.scrollIntoView();
10983
10983
  }
10984
10984
  return p;
10985
- }, td = (r, e = {}) => ({ tr: t, state: n, dispatch: i, editor: s }) => {
10985
+ }, ed = (r, e = {}) => ({ tr: t, state: n, dispatch: i, editor: s }) => {
10986
10986
  var o;
10987
10987
  const l = L(r, n.schema), { $from: a, $to: c } = n.selection, u = n.selection.node;
10988
10988
  if (u && u.isBlock || a.depth < 2 || !a.sameParent(c))
@@ -11055,7 +11055,7 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
11055
11055
  return !0;
11056
11056
  const i = r.doc.nodeAt(n);
11057
11057
  return t.node.type === (i == null ? void 0 : i.type) && qe(r.doc, n) && r.join(n), !0;
11058
- }, nd = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: u }) => {
11058
+ }, td = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: u }) => {
11059
11059
  const { extensions: d, splittableMarks: f } = i.extensionManager, h = L(r, o.schema), p = L(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m, w = y.blockRange(S), v = g || m.$to.parentOffset && m.$from.marks();
11060
11060
  if (!w)
11061
11061
  return !1;
@@ -11070,17 +11070,17 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
11070
11070
  const M = u().wrapInList(h, n), I = v.filter((H) => f.includes(H.type.name));
11071
11071
  return s.ensureMarks(I), M ? !0 : c.clearNodes();
11072
11072
  }).wrapInList(h, n).command(() => In(s, h)).command(() => Pn(s, h)).run();
11073
- }, rd = (r, e = {}, t = {}) => ({ state: n, commands: i }) => {
11073
+ }, nd = (r, e = {}, t = {}) => ({ state: n, commands: i }) => {
11074
11074
  const { extendEmptyMarkRange: s = !1 } = t, o = ve(r, n.schema);
11075
11075
  return tr(n, o, e) ? i.unsetMark(o, { extendEmptyMarkRange: s }) : i.setMark(o, e);
11076
- }, id = (r, e, t = {}) => ({ state: n, commands: i }) => {
11076
+ }, rd = (r, e, t = {}) => ({ state: n, commands: i }) => {
11077
11077
  const s = L(r, n.schema), o = L(e, n.schema), l = wt(n, s, t);
11078
11078
  let a;
11079
11079
  return n.selection.$anchor.sameParent(n.selection.$head) && (a = n.selection.$anchor.parent.attrs), l ? i.setNode(o, a) : i.setNode(s, { ...a, ...t });
11080
- }, sd = (r, e = {}) => ({ state: t, commands: n }) => {
11080
+ }, id = (r, e = {}) => ({ state: t, commands: n }) => {
11081
11081
  const i = L(r, t.schema);
11082
11082
  return wt(t, i, e) ? n.lift(i) : n.wrapIn(i, e);
11083
- }, od = () => ({ state: r, dispatch: e }) => {
11083
+ }, sd = () => ({ state: r, dispatch: e }) => {
11084
11084
  const t = r.plugins;
11085
11085
  for (let n = 0; n < t.length; n += 1) {
11086
11086
  const i = t[n];
@@ -11100,12 +11100,12 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
11100
11100
  }
11101
11101
  }
11102
11102
  return !1;
11103
- }, ld = () => ({ tr: r, dispatch: e }) => {
11103
+ }, od = () => ({ tr: r, dispatch: e }) => {
11104
11104
  const { selection: t } = r, { empty: n, ranges: i } = t;
11105
11105
  return n || e && i.forEach((s) => {
11106
11106
  r.removeMark(s.$from.pos, s.$to.pos);
11107
11107
  }), !0;
11108
- }, ad = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
11108
+ }, ld = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
11109
11109
  var s;
11110
11110
  const { extendEmptyMarkRange: o = !1 } = e, { selection: l } = t, a = ve(r, n.schema), { $from: c, empty: u, ranges: d } = l;
11111
11111
  if (!i)
@@ -11119,7 +11119,7 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
11119
11119
  t.removeMark(f.$from.pos, f.$to.pos, a);
11120
11120
  });
11121
11121
  return t.removeStoredMark(a), !0;
11122
- }, cd = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
11122
+ }, ad = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
11123
11123
  let s = null, o = null;
11124
11124
  const l = hn(typeof r == "string" ? r : r.name, n.schema);
11125
11125
  return l ? (l === "node" && (s = L(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
@@ -11150,82 +11150,82 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
11150
11150
  }));
11151
11151
  }));
11152
11152
  }), !0) : !1;
11153
+ }, cd = (r, e = {}) => ({ state: t, dispatch: n }) => {
11154
+ const i = L(r, t.schema);
11155
+ return Oc(i, e)(t, n);
11153
11156
  }, ud = (r, e = {}) => ({ state: t, dispatch: n }) => {
11154
11157
  const i = L(r, t.schema);
11155
11158
  return Nc(i, e)(t, n);
11156
- }, dd = (r, e = {}) => ({ state: t, dispatch: n }) => {
11157
- const i = L(r, t.schema);
11158
- return Ac(i, e)(t, n);
11159
11159
  };
11160
- var fd = /* @__PURE__ */ Object.freeze({
11160
+ var dd = /* @__PURE__ */ Object.freeze({
11161
11161
  __proto__: null,
11162
- blur: Zc,
11163
- clearContent: Qc,
11164
- clearNodes: eu,
11165
- command: tu,
11166
- createParagraphNear: nu,
11167
- cut: ru,
11168
- deleteCurrentNode: iu,
11169
- deleteNode: su,
11170
- deleteRange: ou,
11171
- deleteSelection: lu,
11172
- enter: au,
11173
- exitCode: cu,
11174
- extendMarkRange: uu,
11175
- first: du,
11176
- focus: hu,
11177
- forEach: pu,
11178
- insertContent: mu,
11179
- insertContentAt: bu,
11180
- joinBackward: Su,
11181
- joinDown: xu,
11182
- joinForward: Cu,
11183
- joinItemBackward: wu,
11184
- joinItemForward: Mu,
11185
- joinTextblockBackward: Eu,
11186
- joinTextblockForward: Tu,
11187
- joinUp: ku,
11188
- keyboardShortcut: Nu,
11189
- lift: Au,
11190
- liftEmptyBlock: vu,
11191
- liftListItem: Du,
11192
- newlineInCode: Iu,
11193
- resetAttributes: Pu,
11194
- scrollIntoView: Ru,
11195
- selectAll: Bu,
11196
- selectNodeBackward: zu,
11197
- selectNodeForward: Fu,
11198
- selectParentNode: Lu,
11199
- selectTextblockEnd: $u,
11200
- selectTextblockStart: Vu,
11201
- setContent: ju,
11202
- setMark: _u,
11203
- setMeta: Gu,
11204
- setNode: Yu,
11205
- setNodeSelection: Xu,
11206
- setTextSelection: Zu,
11207
- sinkListItem: Qu,
11208
- splitBlock: ed,
11209
- splitListItem: td,
11210
- toggleList: nd,
11211
- toggleMark: rd,
11212
- toggleNode: id,
11213
- toggleWrap: sd,
11214
- undoInputRule: od,
11215
- unsetAllMarks: ld,
11216
- unsetMark: ad,
11217
- updateAttributes: cd,
11218
- wrapIn: ud,
11219
- wrapInList: dd
11162
+ blur: Xc,
11163
+ clearContent: Zc,
11164
+ clearNodes: Qc,
11165
+ command: eu,
11166
+ createParagraphNear: tu,
11167
+ cut: nu,
11168
+ deleteCurrentNode: ru,
11169
+ deleteNode: iu,
11170
+ deleteRange: su,
11171
+ deleteSelection: ou,
11172
+ enter: lu,
11173
+ exitCode: au,
11174
+ extendMarkRange: cu,
11175
+ first: uu,
11176
+ focus: fu,
11177
+ forEach: hu,
11178
+ insertContent: pu,
11179
+ insertContentAt: yu,
11180
+ joinBackward: xu,
11181
+ joinDown: ku,
11182
+ joinForward: Su,
11183
+ joinItemBackward: Cu,
11184
+ joinItemForward: wu,
11185
+ joinTextblockBackward: Mu,
11186
+ joinTextblockForward: Eu,
11187
+ joinUp: bu,
11188
+ keyboardShortcut: Ou,
11189
+ lift: Nu,
11190
+ liftEmptyBlock: Au,
11191
+ liftListItem: vu,
11192
+ newlineInCode: Du,
11193
+ resetAttributes: Iu,
11194
+ scrollIntoView: Pu,
11195
+ selectAll: Ru,
11196
+ selectNodeBackward: Bu,
11197
+ selectNodeForward: zu,
11198
+ selectParentNode: Fu,
11199
+ selectTextblockEnd: Lu,
11200
+ selectTextblockStart: $u,
11201
+ setContent: Vu,
11202
+ setMark: Uu,
11203
+ setMeta: _u,
11204
+ setNode: Gu,
11205
+ setNodeSelection: Yu,
11206
+ setTextSelection: Xu,
11207
+ sinkListItem: Zu,
11208
+ splitBlock: Qu,
11209
+ splitListItem: ed,
11210
+ toggleList: td,
11211
+ toggleMark: nd,
11212
+ toggleNode: rd,
11213
+ toggleWrap: id,
11214
+ undoInputRule: sd,
11215
+ unsetAllMarks: od,
11216
+ unsetMark: ld,
11217
+ updateAttributes: ad,
11218
+ wrapIn: cd,
11219
+ wrapInList: ud
11220
11220
  });
11221
- const hd = Y.create({
11221
+ const fd = Y.create({
11222
11222
  name: "commands",
11223
11223
  addCommands() {
11224
11224
  return {
11225
- ...fd
11225
+ ...dd
11226
11226
  };
11227
11227
  }
11228
- }), pd = Y.create({
11228
+ }), hd = Y.create({
11229
11229
  name: "drop",
11230
11230
  addProseMirrorPlugins() {
11231
11231
  return [
@@ -11244,7 +11244,7 @@ const hd = Y.create({
11244
11244
  })
11245
11245
  ];
11246
11246
  }
11247
- }), md = Y.create({
11247
+ }), pd = Y.create({
11248
11248
  name: "editable",
11249
11249
  addProseMirrorPlugins() {
11250
11250
  return [
@@ -11256,13 +11256,13 @@ const hd = Y.create({
11256
11256
  })
11257
11257
  ];
11258
11258
  }
11259
- }), gd = new le("focusEvents"), yd = Y.create({
11259
+ }), md = new le("focusEvents"), gd = Y.create({
11260
11260
  name: "focusEvents",
11261
11261
  addProseMirrorPlugins() {
11262
11262
  const { editor: r } = this;
11263
11263
  return [
11264
11264
  new Q({
11265
- key: gd,
11265
+ key: md,
11266
11266
  props: {
11267
11267
  handleDOMEvents: {
11268
11268
  focus: (e, t) => {
@@ -11280,7 +11280,7 @@ const hd = Y.create({
11280
11280
  })
11281
11281
  ];
11282
11282
  }
11283
- }), bd = Y.create({
11283
+ }), yd = Y.create({
11284
11284
  name: "keymap",
11285
11285
  addKeyboardShortcuts() {
11286
11286
  const r = () => this.editor.commands.first(({ commands: o }) => [
@@ -11325,7 +11325,7 @@ const hd = Y.create({
11325
11325
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
11326
11326
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
11327
11327
  };
11328
- return Er() || So() ? s : i;
11328
+ return Er() || xo() ? s : i;
11329
11329
  },
11330
11330
  addProseMirrorPlugins() {
11331
11331
  return [
@@ -11358,7 +11358,7 @@ const hd = Y.create({
11358
11358
  })
11359
11359
  ];
11360
11360
  }
11361
- }), kd = Y.create({
11361
+ }), bd = Y.create({
11362
11362
  name: "paste",
11363
11363
  addProseMirrorPlugins() {
11364
11364
  return [
@@ -11376,7 +11376,7 @@ const hd = Y.create({
11376
11376
  })
11377
11377
  ];
11378
11378
  }
11379
- }), xd = Y.create({
11379
+ }), kd = Y.create({
11380
11380
  name: "tabindex",
11381
11381
  addProseMirrorPlugins() {
11382
11382
  return [
@@ -11512,7 +11512,7 @@ class Ie {
11512
11512
  }), this.editor.view.dispatch(t);
11513
11513
  }
11514
11514
  }
11515
- const Sd = `.ProseMirror {
11515
+ const xd = `.ProseMirror {
11516
11516
  position: relative;
11517
11517
  }
11518
11518
 
@@ -11587,14 +11587,14 @@ img.ProseMirror-separator {
11587
11587
  .tippy-box[data-animation=fade][data-state=hidden] {
11588
11588
  opacity: 0
11589
11589
  }`;
11590
- function Cd(r, e, t) {
11590
+ function Sd(r, e, t) {
11591
11591
  const n = document.querySelector("style[data-tiptap-style]");
11592
11592
  if (n !== null)
11593
11593
  return n;
11594
11594
  const i = document.createElement("style");
11595
11595
  return e && i.setAttribute("nonce", e), i.setAttribute("data-tiptap-style", ""), i.innerHTML = r, document.getElementsByTagName("head")[0].appendChild(i), i;
11596
11596
  }
11597
- class wd extends zc {
11597
+ class Cd extends Bc {
11598
11598
  constructor(e = {}) {
11599
11599
  super(), this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.options = {
11600
11600
  element: document.createElement("div"),
@@ -11656,7 +11656,7 @@ class wd extends zc {
11656
11656
  * Inject CSS styles.
11657
11657
  */
11658
11658
  injectCSS() {
11659
- this.options.injectCSS && document && (this.css = Cd(Sd, this.options.injectNonce));
11659
+ this.options.injectCSS && document && (this.css = Sd(xd, this.options.injectNonce));
11660
11660
  }
11661
11661
  /**
11662
11662
  * Update editor options.
@@ -11695,7 +11695,7 @@ class wd extends zc {
11695
11695
  * @returns The new editor state
11696
11696
  */
11697
11697
  registerPlugin(e, t) {
11698
- const n = po(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], i = this.state.reconfigure({ plugins: n });
11698
+ const n = ho(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], i = this.state.reconfigure({ plugins: n });
11699
11699
  return this.view.updateState(i), i;
11700
11700
  }
11701
11701
  /**
@@ -11725,16 +11725,16 @@ class wd extends zc {
11725
11725
  createExtensionManager() {
11726
11726
  var e, t;
11727
11727
  const i = [...this.options.enableCoreExtensions ? [
11728
- md,
11729
- Xc.configure({
11728
+ pd,
11729
+ Yc.configure({
11730
11730
  blockSeparator: (t = (e = this.options.coreExtensionOptions) === null || e === void 0 ? void 0 : e.clipboardTextSerializer) === null || t === void 0 ? void 0 : t.blockSeparator
11731
11731
  }),
11732
- hd,
11732
+ fd,
11733
+ gd,
11733
11734
  yd,
11734
- bd,
11735
- xd,
11736
- pd,
11737
- kd
11735
+ kd,
11736
+ hd,
11737
+ bd
11738
11738
  ].filter((s) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[s.name] !== !1 : !0) : [], ...this.options.extensions].filter((s) => ["extension", "node", "mark"].includes(s == null ? void 0 : s.type));
11739
11739
  this.extensionManager = new Xe(i, this);
11740
11740
  }
@@ -11771,8 +11771,8 @@ class wd extends zc {
11771
11771
  }
11772
11772
  }), t = er(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
11773
11773
  }
11774
- const n = ko(t, this.options.autofocus);
11775
- this.view = new sc(this.options.element, {
11774
+ const n = bo(t, this.options.autofocus);
11775
+ this.view = new ic(this.options.element, {
11776
11776
  ...this.options.editorProps,
11777
11777
  attributes: {
11778
11778
  // add `role="textbox"` to the editor element
@@ -11860,11 +11860,11 @@ class wd extends zc {
11860
11860
  * Get attributes of the currently selected node or mark.
11861
11861
  */
11862
11862
  getAttributes(e) {
11863
- return qu(this.state, e);
11863
+ return Ju(this.state, e);
11864
11864
  }
11865
11865
  isActive(e, t) {
11866
11866
  const n = typeof e == "string" ? e : null, i = typeof e == "string" ? t : e;
11867
- return Ku(this.state, n, i);
11867
+ return qu(this.state, n, i);
11868
11868
  }
11869
11869
  /**
11870
11870
  * Get the document as JSON.
@@ -11885,10 +11885,10 @@ class wd extends zc {
11885
11885
  const { blockSeparator: t = `
11886
11886
 
11887
11887
  `, textSerializers: n = {} } = e || {};
11888
- return Wu(this.state.doc, {
11888
+ return Hu(this.state.doc, {
11889
11889
  blockSeparator: t,
11890
11890
  textSerializers: {
11891
- ...go(this.schema),
11891
+ ...mo(this.schema),
11892
11892
  ...n
11893
11893
  }
11894
11894
  });
@@ -11984,7 +11984,7 @@ F.prototype.prepend = function(e) {
11984
11984
  return e.length ? F.from(e).append(this) : this;
11985
11985
  };
11986
11986
  F.prototype.appendInner = function(e) {
11987
- return new Md(this, e);
11987
+ return new wd(this, e);
11988
11988
  };
11989
11989
  F.prototype.slice = function(e, t) {
11990
11990
  return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? F.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
@@ -12004,9 +12004,9 @@ F.prototype.map = function(e, t, n) {
12004
12004
  }, t, n), i;
12005
12005
  };
12006
12006
  F.from = function(e) {
12007
- return e instanceof F ? e : e && e.length ? new wo(e) : F.empty;
12007
+ return e instanceof F ? e : e && e.length ? new Co(e) : F.empty;
12008
12008
  };
12009
- var wo = /* @__PURE__ */ function(r) {
12009
+ var Co = /* @__PURE__ */ function(r) {
12010
12010
  function e(n) {
12011
12011
  r.call(this), this.values = n;
12012
12012
  }
@@ -12038,8 +12038,8 @@ var wo = /* @__PURE__ */ function(r) {
12038
12038
  return 0;
12039
12039
  }, Object.defineProperties(e.prototype, t), e;
12040
12040
  }(F);
12041
- F.empty = new wo([]);
12042
- var Md = /* @__PURE__ */ function(r) {
12041
+ F.empty = new Co([]);
12042
+ var wd = /* @__PURE__ */ function(r) {
12043
12043
  function e(t, n) {
12044
12044
  r.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
12045
12045
  }
@@ -12072,7 +12072,7 @@ var Md = /* @__PURE__ */ function(r) {
12072
12072
  return this.left.depth >= Math.max(this.right.depth, n.depth) + 1 ? new e(this.left, new e(this.right, n)) : new e(this, n);
12073
12073
  }, e;
12074
12074
  }(F);
12075
- const Ed = 500;
12075
+ const Md = 500;
12076
12076
  class se {
12077
12077
  constructor(e, t) {
12078
12078
  this.items = e, this.eventCount = t;
@@ -12114,7 +12114,7 @@ class se {
12114
12114
  (h = a && a.merge(f)) && (f = h, u ? s.pop() : l = l.slice(0, l.length - 1)), s.push(f), t && (o++, t = void 0), i || (a = f);
12115
12115
  }
12116
12116
  let c = o - n.depth;
12117
- return c > Od && (l = Td(l, c), o -= c), new se(l.append(s), o);
12117
+ return c > Td && (l = Ed(l, c), o -= c), new se(l.append(s), o);
12118
12118
  }
12119
12119
  remapping(e, t) {
12120
12120
  let n = new yt();
@@ -12154,7 +12154,7 @@ class se {
12154
12154
  for (let f = t; f < o; f++)
12155
12155
  c.push(new ae(s.maps[f]));
12156
12156
  let u = this.items.slice(0, i).append(c).append(n), d = new se(u, l);
12157
- return d.emptyItemCount() > Ed && (d = d.compress(this.items.length - n.length)), d;
12157
+ return d.emptyItemCount() > Md && (d = d.compress(this.items.length - n.length)), d;
12158
12158
  }
12159
12159
  emptyItemCount() {
12160
12160
  let e = 0;
@@ -12186,7 +12186,7 @@ class se {
12186
12186
  }
12187
12187
  }
12188
12188
  se.empty = new se(F.empty, 0);
12189
- function Td(r, e) {
12189
+ function Ed(r, e) {
12190
12190
  let t;
12191
12191
  return r.forEach((n, i) => {
12192
12192
  if (n.selection && e-- == 0)
@@ -12210,23 +12210,23 @@ class ke {
12210
12210
  this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = i, this.prevComposition = s;
12211
12211
  }
12212
12212
  }
12213
- const Od = 20;
12214
- function Nd(r, e, t, n) {
12213
+ const Td = 20;
12214
+ function Od(r, e, t, n) {
12215
12215
  let i = t.getMeta(Ve), s;
12216
12216
  if (i)
12217
12217
  return i.historyState;
12218
- t.getMeta(Dd) && (r = new ke(r.done, r.undone, null, 0, -1));
12218
+ t.getMeta(vd) && (r = new ke(r.done, r.undone, null, 0, -1));
12219
12219
  let o = t.getMeta("appendedTransaction");
12220
12220
  if (t.steps.length == 0)
12221
12221
  return r;
12222
12222
  if (o && o.getMeta(Ve))
12223
12223
  return o.getMeta(Ve).redo ? new ke(r.done.addTransform(t, void 0, n, $t(e)), r.undone, Bi(t.mapping.maps), r.prevTime, r.prevComposition) : new ke(r.done, r.undone.addTransform(t, void 0, n, $t(e)), null, r.prevTime, r.prevComposition);
12224
12224
  if (t.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
12225
- let l = t.getMeta("composition"), a = r.prevTime == 0 || !o && r.prevComposition != l && (r.prevTime < (t.time || 0) - n.newGroupDelay || !Ad(t, r.prevRanges)), c = o ? Rn(r.prevRanges, t.mapping) : Bi(t.mapping.maps);
12225
+ let l = t.getMeta("composition"), a = r.prevTime == 0 || !o && r.prevComposition != l && (r.prevTime < (t.time || 0) - n.newGroupDelay || !Nd(t, r.prevRanges)), c = o ? Rn(r.prevRanges, t.mapping) : Bi(t.mapping.maps);
12226
12226
  return new ke(r.done.addTransform(t, a ? e.selection.getBookmark() : void 0, n, $t(e)), se.empty, c, t.time, l ?? r.prevComposition);
12227
12227
  } else return (s = t.getMeta("rebased")) ? new ke(r.done.rebased(t, s), r.undone.rebased(t, s), Rn(r.prevRanges, t.mapping), r.prevTime, r.prevComposition) : new ke(r.done.addMaps(t.mapping.maps), r.undone.addMaps(t.mapping.maps), Rn(r.prevRanges, t.mapping), r.prevTime, r.prevComposition);
12228
12228
  }
12229
- function Ad(r, e) {
12229
+ function Nd(r, e) {
12230
12230
  if (!e)
12231
12231
  return !1;
12232
12232
  if (!r.docChanged)
@@ -12253,7 +12253,7 @@ function Rn(r, e) {
12253
12253
  }
12254
12254
  return t;
12255
12255
  }
12256
- function vd(r, e, t) {
12256
+ function Ad(r, e, t) {
12257
12257
  let n = $t(e), i = Ve.get(e).spec.config, s = (t ? r.undone : r.done).popEvent(e, n);
12258
12258
  if (!s)
12259
12259
  return null;
@@ -12273,8 +12273,8 @@ function $t(r) {
12273
12273
  }
12274
12274
  return Bn;
12275
12275
  }
12276
- const Ve = new le("history"), Dd = new le("closeHistory");
12277
- function Id(r = {}) {
12276
+ const Ve = new le("history"), vd = new le("closeHistory");
12277
+ function Dd(r = {}) {
12278
12278
  return r = {
12279
12279
  depth: r.depth || 100,
12280
12280
  newGroupDelay: r.newGroupDelay || 500
@@ -12285,33 +12285,33 @@ function Id(r = {}) {
12285
12285
  return new ke(se.empty, se.empty, null, 0, -1);
12286
12286
  },
12287
12287
  apply(e, t, n) {
12288
- return Nd(t, n, e, r);
12288
+ return Od(t, n, e, r);
12289
12289
  }
12290
12290
  },
12291
12291
  config: r,
12292
12292
  props: {
12293
12293
  handleDOMEvents: {
12294
12294
  beforeinput(e, t) {
12295
- let n = t.inputType, i = n == "historyUndo" ? Eo : n == "historyRedo" ? To : null;
12295
+ let n = t.inputType, i = n == "historyUndo" ? Mo : n == "historyRedo" ? Eo : null;
12296
12296
  return i ? (t.preventDefault(), i(e.state, e.dispatch)) : !1;
12297
12297
  }
12298
12298
  }
12299
12299
  }
12300
12300
  });
12301
12301
  }
12302
- function Mo(r, e) {
12302
+ function wo(r, e) {
12303
12303
  return (t, n) => {
12304
12304
  let i = Ve.getState(t);
12305
12305
  if (!i || (r ? i.undone : i.done).eventCount == 0)
12306
12306
  return !1;
12307
12307
  if (n) {
12308
- let s = vd(i, t, r);
12308
+ let s = Ad(i, t, r);
12309
12309
  s && n(e ? s.scrollIntoView() : s);
12310
12310
  }
12311
12311
  return !0;
12312
12312
  };
12313
12313
  }
12314
- const Eo = Mo(!1, !0), To = Mo(!0, !0), Pd = Y.create({
12314
+ const Mo = wo(!1, !0), Eo = wo(!0, !0), Id = Y.create({
12315
12315
  name: "history",
12316
12316
  addOptions() {
12317
12317
  return {
@@ -12321,13 +12321,13 @@ const Eo = Mo(!1, !0), To = Mo(!0, !0), Pd = Y.create({
12321
12321
  },
12322
12322
  addCommands() {
12323
12323
  return {
12324
- undo: () => ({ state: r, dispatch: e }) => Eo(r, e),
12325
- redo: () => ({ state: r, dispatch: e }) => To(r, e)
12324
+ undo: () => ({ state: r, dispatch: e }) => Mo(r, e),
12325
+ redo: () => ({ state: r, dispatch: e }) => Eo(r, e)
12326
12326
  };
12327
12327
  },
12328
12328
  addProseMirrorPlugins() {
12329
12329
  return [
12330
- Id(this.options)
12330
+ Dd(this.options)
12331
12331
  ];
12332
12332
  },
12333
12333
  addKeyboardShortcuts() {
@@ -12340,7 +12340,7 @@ const Eo = Mo(!1, !0), To = Mo(!0, !0), Pd = Y.create({
12340
12340
  "Shift-Mod-я": () => this.editor.commands.redo()
12341
12341
  };
12342
12342
  }
12343
- }), Rd = Y.create({
12343
+ }), Pd = Y.create({
12344
12344
  name: "placeholder",
12345
12345
  addOptions() {
12346
12346
  return {
@@ -12387,7 +12387,7 @@ const Eo = Mo(!1, !0), To = Mo(!0, !0), Pd = Y.create({
12387
12387
  }
12388
12388
  });
12389
12389
  function Fi(r) {
12390
- const t = r.state.doc.toJSON(), n = new Bd(r);
12390
+ const t = r.state.doc.toJSON(), n = new Rd(r);
12391
12391
  let i = [];
12392
12392
  return t.content.forEach((s) => {
12393
12393
  i.push(n.serialize(s));
@@ -12397,7 +12397,7 @@ function Fi(r) {
12397
12397
  function Li(r, e) {
12398
12398
  return r.type === e.type && JSON.stringify(r.attrs) === JSON.stringify(e.attrs);
12399
12399
  }
12400
- class Bd {
12400
+ class Rd {
12401
12401
  constructor(e) {
12402
12402
  this.editor = e, this.openMarks = [];
12403
12403
  }
@@ -12428,14 +12428,14 @@ class Bd {
12428
12428
  }), this.openMarks = [], e;
12429
12429
  }
12430
12430
  }
12431
- const zd = Or.create({
12431
+ const Bd = Or.create({
12432
12432
  name: "doc",
12433
12433
  topNode: !0,
12434
12434
  content: "block+"
12435
- }), Fd = Or.create({
12435
+ }), zd = Or.create({
12436
12436
  name: "text",
12437
12437
  group: "inline"
12438
- }), Ld = Ct.create({
12438
+ }), Fd = Ct.create({
12439
12439
  name: "inline",
12440
12440
  addOptions() {
12441
12441
  return {
@@ -12531,7 +12531,7 @@ const zd = Or.create({
12531
12531
  [`lift${r}`]: () => ({ commands: e, attributes: t }) => e.lift(this.name, t)
12532
12532
  };
12533
12533
  }
12534
- }), $d = mn.extend({
12534
+ }), Ld = mn.extend({
12535
12535
  name: "list",
12536
12536
  content: "head? item+",
12537
12537
  group: "block",
@@ -12565,7 +12565,7 @@ const zd = Or.create({
12565
12565
  r[e] = () => this.editor.commands[`toggle${n}`](this.name);
12566
12566
  }), r;
12567
12567
  }
12568
- }), Vd = mn.extend({
12568
+ }), $d = mn.extend({
12569
12569
  name: "item",
12570
12570
  content: "p block*",
12571
12571
  group: "item",
@@ -12582,10 +12582,10 @@ const zd = Or.create({
12582
12582
  };
12583
12583
  }
12584
12584
  });
12585
- function $i(r) {
12585
+ function Vd(r) {
12586
12586
  return Object.entries(r || {}).map(([e, t]) => `${e}="${t}"`).join(" ");
12587
12587
  }
12588
- const Oo = mn.extend({
12588
+ const To = mn.extend({
12589
12589
  name: "emptyElement",
12590
12590
  group: "inline",
12591
12591
  content: "",
@@ -12608,21 +12608,19 @@ const Oo = mn.extend({
12608
12608
  addNodeView() {
12609
12609
  return ({ node: r }) => {
12610
12610
  const e = document.createElement(`tei-${this.name}`);
12611
- e.classList.add("empty-element"), e.innerHTML = this.options.label;
12612
- const t = $i(r.attrs);
12613
- return t && e.setAttribute("data-tooltip", t), Object.entries(r.attrs).forEach(([n, i]) => {
12614
- i && e.setAttribute(n, i);
12611
+ return e.classList.add("empty-element"), e.innerHTML = this.options.label, Object.entries(r.attrs).forEach(([t, n]) => {
12612
+ n && e.setAttribute(t, n);
12615
12613
  }), e.addEventListener("click", () => {
12616
12614
  this.editor.options.element.dispatchEvent(new CustomEvent("empty-element-clicked", { detail: { node: r } }));
12617
12615
  }), {
12618
12616
  dom: e,
12619
- update: (n) => {
12620
- if (n.type !== r.type)
12617
+ update: (t) => {
12618
+ if (t.type !== r.type)
12621
12619
  return !1;
12622
- r.attrs = n.attrs;
12623
- const i = $i(n.attrs);
12624
- return i && e.setAttribute("data-tooltip", i), Object.entries(r.attrs).forEach(([s, o]) => {
12625
- o ? e.setAttribute(s, o) : e.removeAttribute(s);
12620
+ r.attrs = t.attrs;
12621
+ const n = Vd(t.attrs);
12622
+ return n && e.setAttribute("data-tooltip", n), Object.entries(r.attrs).forEach(([i, s]) => {
12623
+ s ? e.setAttribute(i, s) : e.removeAttribute(i);
12626
12624
  }), !0;
12627
12625
  }
12628
12626
  };
@@ -12638,7 +12636,7 @@ const Oo = mn.extend({
12638
12636
  }), r;
12639
12637
  }
12640
12638
  });
12641
- function Vi() {
12639
+ function $i() {
12642
12640
  const r = Date.now().toString(36), e = Math.random().toString(36).substring(2, 8);
12643
12641
  return `fn-${r}-${e}`;
12644
12642
  }
@@ -12722,7 +12720,7 @@ function Jd(r, e) {
12722
12720
  }
12723
12721
  }), r;
12724
12722
  }
12725
- const qd = Oo.extend({
12723
+ const qd = To.extend({
12726
12724
  name: "anchor",
12727
12725
  group: "inline",
12728
12726
  content: "",
@@ -12738,7 +12736,7 @@ const qd = Oo.extend({
12738
12736
  return { id: e.id };
12739
12737
  },
12740
12738
  parseHTML(e) {
12741
- return e.getAttribute("id") || Vi();
12739
+ return e.getAttribute("id") || $i();
12742
12740
  }
12743
12741
  },
12744
12742
  _timestamp: {
@@ -12766,7 +12764,7 @@ const qd = Oo.extend({
12766
12764
  type: this.name,
12767
12765
  attrs: {
12768
12766
  ...r,
12769
- id: Vi()
12767
+ id: $i()
12770
12768
  }
12771
12769
  }),
12772
12770
  gotoNote: (r) => ({ commands: e, editor: t }) => {
@@ -12877,20 +12875,20 @@ const qd = Oo.extend({
12877
12875
  function Ud(r) {
12878
12876
  const e = [
12879
12877
  _d,
12880
- Fd
12878
+ zd
12881
12879
  ];
12882
12880
  return Object.entries(r.schema).forEach(([t, n]) => {
12883
12881
  let i;
12884
- n.type === "inline" ? i = Ld.extend({
12882
+ n.type === "inline" ? i = Fd.extend({
12885
12883
  name: t
12886
12884
  }) : n.type === "anchor" ? i = qd.extend({
12887
12885
  name: t
12888
- }) : n.type === "empty" ? i = Oo.extend({
12886
+ }) : n.type === "empty" ? i = To.extend({
12889
12887
  name: t
12890
- }) : n.type === "list" ? i = $d.extend({
12888
+ }) : n.type === "list" ? i = Ld.extend({
12891
12889
  name: t,
12892
12890
  content: n.content || "item+"
12893
- }) : n.type === "listItem" ? i = Vd.extend({
12891
+ }) : n.type === "listItem" ? i = $d.extend({
12894
12892
  name: t,
12895
12893
  content: n.content || "p block*"
12896
12894
  }) : n.type === "block" && (i = mn.extend({
@@ -12910,10 +12908,10 @@ function Ud(r) {
12910
12908
  }));
12911
12909
  }), e;
12912
12910
  }
12913
- const _d = zd.extend({
12911
+ const _d = Bd.extend({
12914
12912
  content: "block+ noteGrp?"
12915
12913
  });
12916
- function No(r, e, t) {
12914
+ function Oo(r, e, t) {
12917
12915
  let n = null;
12918
12916
  return r.state.doc.nodesBetween(e, t, (i, s, o, l) => {
12919
12917
  i.isText && (n == null ? n = i.marks.map((a) => ({ mark: a, pos: s })) : n = n.filter((a) => i.marks.find((c) => c.type.name === a.mark.type.name)));
@@ -13003,7 +13001,7 @@ class ef {
13003
13001
  }
13004
13002
  updatePanelForCurrentPosition(e) {
13005
13003
  var l;
13006
- const { from: t, to: n } = e.state.selection, i = No(e, t, n);
13004
+ const { from: t, to: n } = e.state.selection, i = Oo(e, t, n);
13007
13005
  if (i && i.length > 0) {
13008
13006
  this.currentElement = null;
13009
13007
  const a = i[i.length - 1];
@@ -13179,7 +13177,7 @@ class tf {
13179
13177
  const { from: t, to: n } = e.state.selection, i = e.state.doc.nodeAt(t), s = [];
13180
13178
  let o;
13181
13179
  if (i) {
13182
- i.isText && (o = No(e, t, n));
13180
+ i.isText && (o = Oo(e, t, n));
13183
13181
  let a = t, c = e.state.doc.resolve(a).depth;
13184
13182
  const u = e.state.doc.resolve(a);
13185
13183
  for (; c > 0; ) {
@@ -13264,16 +13262,31 @@ class nf {
13264
13262
  */
13265
13263
  handleNodeAction(e, t, n) {
13266
13264
  if (e === "head") {
13267
- const { state: i } = this.editor, { selection: s } = i, { $from: o } = s;
13268
- if (pt(o, (a) => a.type.name === "item")) {
13265
+ const { state: s } = this.editor, { selection: o } = s, { $from: l } = o;
13266
+ if (pt(l, (c) => c.type.name === "item")) {
13269
13267
  this.editor.chain().focus().transformToHead().run();
13270
13268
  return;
13271
13269
  }
13272
13270
  }
13273
- n.command ? this.editor.chain().focus()[n.command](e, n.attributes).run() : t.type === "inline" ? this.editor.chain().focus().toggleMark(e, n.attributes).run() : t.type === "list" ? this.editor.chain().focus().toggleList(n.attributes).run() : t.type === "anchor" ? this.editor.chain().focus().addAnchor(n.attributes).run() : t.type === "empty" ? this.editor.chain().focus().insertContent({
13274
- type: e,
13275
- attrs: n.attributes
13276
- }).run() : this.editor.chain().focus().setNode(e, n.attributes).run();
13271
+ const i = this.editor.chain().focus();
13272
+ if (n.command)
13273
+ i[n.command](e, n.attributes);
13274
+ else if (t.type === "inline")
13275
+ i.toggleMark(e, n.attributes);
13276
+ else if (t.type === "list")
13277
+ i.toggleList(n.attributes);
13278
+ else if (t.type === "anchor")
13279
+ i.addAnchor(n.attributes);
13280
+ else if (t.type === "empty")
13281
+ i.insertContent({
13282
+ type: e,
13283
+ attrs: n.attributes
13284
+ });
13285
+ else {
13286
+ const s = this.editor.schema.nodes[e];
13287
+ s && s.isTextblock ? i.setNode(e, n.attributes) : i.wrapIn(e, n.attributes);
13288
+ }
13289
+ i.run();
13277
13290
  }
13278
13291
  createButton(e, t, n) {
13279
13292
  const i = document.createElement("a");
@@ -13703,6 +13716,28 @@ const sf = {
13703
13716
  }
13704
13717
  }
13705
13718
  },
13719
+ opener: {
13720
+ type: "block",
13721
+ content: "block*",
13722
+ toolbar: {
13723
+ Opener: {
13724
+ select: "Blocks",
13725
+ attributes: {},
13726
+ label: "<i class='bi bi-envelope-open'></i>"
13727
+ }
13728
+ }
13729
+ },
13730
+ closer: {
13731
+ type: "block",
13732
+ content: "block*",
13733
+ toolbar: {
13734
+ Closer: {
13735
+ select: "Blocks",
13736
+ attributes: {},
13737
+ label: "<i class='bi bi-envelope'></i>"
13738
+ }
13739
+ }
13740
+ },
13706
13741
  noteGrp: {
13707
13742
  type: "list",
13708
13743
  group: "",
@@ -13768,6 +13803,21 @@ const sf = {
13768
13803
  label: "<i class='bi bi-file-earmark-break'></i>"
13769
13804
  }
13770
13805
  }
13806
+ },
13807
+ lb: {
13808
+ type: "empty",
13809
+ label: "&#x21B5;",
13810
+ attributes: {
13811
+ n: {
13812
+ type: "string"
13813
+ }
13814
+ },
13815
+ toolbar: {
13816
+ LineBreak: {
13817
+ attributes: {},
13818
+ label: "<i class='bi bi-arrow-return-left'></i>"
13819
+ }
13820
+ }
13771
13821
  }
13772
13822
  }, Vt = {
13773
13823
  attributes: sf,
@@ -13903,13 +13953,13 @@ class lf extends HTMLElement {
13903
13953
  </div>
13904
13954
  `, this.applySlots(e);
13905
13955
  const t = e.innerHTML.trim(), n = Ud(Vt);
13906
- this.editor = new wd({
13956
+ this.editor = new Cd({
13907
13957
  element: this.querySelector(".editor-area"),
13908
13958
  extensions: [
13909
13959
  ...n,
13910
13960
  Kd,
13911
- Pd,
13912
- Rd.configure({
13961
+ Id,
13962
+ Pd.configure({
13913
13963
  placeholder: "Write something...",
13914
13964
  includeChildren: !0
13915
13965
  })
@@ -13959,12 +14009,13 @@ class lf extends HTMLElement {
13959
14009
  applySlots(e) {
13960
14010
  const t = this.querySelectorAll("slot");
13961
14011
  for (const n of t) {
13962
- const i = n.name, s = e.querySelector(`[slot="${i}"]`);
13963
- if (s) {
13964
- const o = document.createElement("div");
13965
- o.innerHTML = s.outerHTML;
13966
- const l = n.parentNode;
13967
- Array.from(o.children).forEach((c) => l.insertBefore(c, n)), s.remove();
14012
+ const i = n.name, s = e.querySelectorAll(`[slot="${i}"]`);
14013
+ if (s.length > 0) {
14014
+ const o = n.parentNode;
14015
+ s.forEach((l) => {
14016
+ const a = document.createElement("div");
14017
+ a.innerHTML = l.outerHTML, Array.from(a.children).forEach((u) => o.insertBefore(u, n)), l.remove();
14018
+ });
13968
14019
  }
13969
14020
  }
13970
14021
  return t.forEach((n) => n.remove()), e;