@samhammer/tiptob 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -126,25 +126,25 @@ function mo(n, e, t, r) {
126
126
  for (let i = n.childCount, o = e.childCount; ; ) {
127
127
  if (i == 0 || o == 0)
128
128
  return i == o ? null : { a: t, b: r };
129
- let s = n.child(--i), a = e.child(--o), l = s.nodeSize;
130
- if (s == a) {
131
- t -= l, r -= l;
129
+ let s = n.child(--i), l = e.child(--o), a = s.nodeSize;
130
+ if (s == l) {
131
+ t -= a, r -= a;
132
132
  continue;
133
133
  }
134
- if (!s.sameMarkup(a))
134
+ if (!s.sameMarkup(l))
135
135
  return { a: t, b: r };
136
- if (s.isText && s.text != a.text) {
137
- let c = 0, u = Math.min(s.text.length, a.text.length);
138
- for (; c < u && s.text[s.text.length - c - 1] == a.text[a.text.length - c - 1]; )
136
+ if (s.isText && s.text != l.text) {
137
+ let c = 0, u = Math.min(s.text.length, l.text.length);
138
+ for (; c < u && s.text[s.text.length - c - 1] == l.text[l.text.length - c - 1]; )
139
139
  c++, t--, r--;
140
140
  return { a: t, b: r };
141
141
  }
142
- if (s.content.size || a.content.size) {
143
- let c = mo(s.content, a.content, t - 1, r - 1);
142
+ if (s.content.size || l.content.size) {
143
+ let c = mo(s.content, l.content, t - 1, r - 1);
144
144
  if (c)
145
145
  return c;
146
146
  }
147
- t -= l, r -= l;
147
+ t -= a, r -= a;
148
148
  }
149
149
  }
150
150
  class k {
@@ -162,13 +162,13 @@ class k {
162
162
  into a node when the callback returns `false`.
163
163
  */
164
164
  nodesBetween(e, t, r, i = 0, o) {
165
- for (let s = 0, a = 0; a < t; s++) {
166
- let l = this.content[s], c = a + l.nodeSize;
167
- if (c > e && r(l, i + a, o || null, s) !== !1 && l.content.size) {
168
- let u = a + 1;
169
- l.nodesBetween(Math.max(0, e - u), Math.min(l.content.size, t - u), r, i + u);
165
+ for (let s = 0, l = 0; l < t; s++) {
166
+ let a = this.content[s], c = l + a.nodeSize;
167
+ if (c > e && r(a, i + l, o || null, s) !== !1 && a.content.size) {
168
+ let u = l + 1;
169
+ a.nodesBetween(Math.max(0, e - u), Math.min(a.content.size, t - u), r, i + u);
170
170
  }
171
- a = c;
171
+ l = c;
172
172
  }
173
173
  }
174
174
  /**
@@ -185,9 +185,9 @@ class k {
185
185
  */
186
186
  textBetween(e, t, r, i) {
187
187
  let o = "", s = !0;
188
- return this.nodesBetween(e, t, (a, l) => {
189
- let c = a.isText ? a.text.slice(Math.max(e, l) - l, t - l) : a.isLeaf ? i ? typeof i == "function" ? i(a) : i : a.type.spec.leafText ? a.type.spec.leafText(a) : "" : "";
190
- a.isBlock && (a.isLeaf && c || a.isTextblock) && r && (s ? s = !1 : o += r), o += c;
188
+ return this.nodesBetween(e, t, (l, a) => {
189
+ let c = l.isText ? l.text.slice(Math.max(e, a) - a, t - a) : l.isLeaf ? i ? typeof i == "function" ? i(l) : i : l.type.spec.leafText ? l.type.spec.leafText(l) : "" : "";
190
+ l.isBlock && (l.isLeaf && c || l.isTextblock) && r && (s ? s = !1 : o += r), o += c;
191
191
  }, 0), o;
192
192
  }
193
193
  /**
@@ -213,8 +213,8 @@ class k {
213
213
  let r = [], i = 0;
214
214
  if (t > e)
215
215
  for (let o = 0, s = 0; s < t; o++) {
216
- let a = this.content[o], l = s + a.nodeSize;
217
- l > e && ((s < e || l > t) && (a.isText ? a = a.cut(Math.max(0, e - s), Math.min(a.text.length, t - s)) : a = a.cut(Math.max(0, e - s - 1), Math.min(a.content.size, t - s - 1))), r.push(a), i += a.nodeSize), s = l;
216
+ let l = this.content[o], a = s + l.nodeSize;
217
+ a > e && ((s < e || a > t) && (l.isText ? l = l.cut(Math.max(0, e - s), Math.min(l.text.length, t - s)) : l = l.cut(Math.max(0, e - s - 1), Math.min(l.content.size, t - s - 1))), r.push(l), i += l.nodeSize), s = a;
218
218
  }
219
219
  return new k(r, i);
220
220
  }
@@ -325,18 +325,18 @@ class k {
325
325
  position in this fragment. The result object will be reused
326
326
  (overwritten) the next time the function is called. @internal
327
327
  */
328
- findIndex(e, t = -1) {
328
+ findIndex(e) {
329
329
  if (e == 0)
330
330
  return xn(0, e);
331
331
  if (e == this.size)
332
332
  return xn(this.content.length, e);
333
333
  if (e > this.size || e < 0)
334
334
  throw new RangeError(`Position ${e} outside of fragment (${this})`);
335
- for (let r = 0, i = 0; ; r++) {
336
- let o = this.child(r), s = i + o.nodeSize;
337
- if (s >= e)
338
- return s == e || t > 0 ? xn(r + 1, s) : xn(r, i);
339
- i = s;
335
+ for (let t = 0, r = 0; ; t++) {
336
+ let i = this.child(t), o = r + i.nodeSize;
337
+ if (o >= e)
338
+ return o == e ? xn(t + 1, o) : xn(t, r);
339
+ r = o;
340
340
  }
341
341
  }
342
342
  /**
@@ -618,9 +618,9 @@ class S {
618
618
  }
619
619
  S.empty = new S(k.empty, 0, 0);
620
620
  function go(n, e, t) {
621
- let { index: r, offset: i } = n.findIndex(e), o = n.maybeChild(r), { index: s, offset: a } = n.findIndex(t);
621
+ let { index: r, offset: i } = n.findIndex(e), o = n.maybeChild(r), { index: s, offset: l } = n.findIndex(t);
622
622
  if (i == e || o.isText) {
623
- if (a != t && !n.child(s).isText)
623
+ if (l != t && !n.child(s).isText)
624
624
  throw new RangeError("Removing non-flat range");
625
625
  return n.cut(0, e).append(n.cut(t));
626
626
  }
@@ -632,10 +632,10 @@ function yo(n, e, t, r) {
632
632
  let { index: i, offset: o } = n.findIndex(e), s = n.maybeChild(i);
633
633
  if (o == e || s.isText)
634
634
  return n.cut(0, e).append(t).append(n.cut(e));
635
- let a = yo(s.content, e - o - 1, t);
636
- return a && n.replaceChild(i, s.copy(a));
635
+ let l = yo(s.content, e - o - 1, t);
636
+ return l && n.replaceChild(i, s.copy(l));
637
637
  }
638
- function aa(n, e, t) {
638
+ function ll(n, e, t) {
639
639
  if (t.openStart > n.depth)
640
640
  throw new Dn("Inserted content deeper than insertion position");
641
641
  if (n.depth - t.openStart != e.depth - t.openEnd)
@@ -649,11 +649,11 @@ function vo(n, e, t, r) {
649
649
  return o.copy(o.content.replaceChild(i, s));
650
650
  } else if (t.content.size)
651
651
  if (!t.openStart && !t.openEnd && n.depth == r && e.depth == r) {
652
- let s = n.parent, a = s.content;
653
- return nt(s, a.cut(0, n.parentOffset).append(t.content).append(a.cut(e.parentOffset)));
652
+ let s = n.parent, l = s.content;
653
+ return nt(s, l.cut(0, n.parentOffset).append(t.content).append(l.cut(e.parentOffset)));
654
654
  } else {
655
- let { start: s, end: a } = la(t, n);
656
- return nt(o, xo(n, s, a, e, r));
655
+ let { start: s, end: l } = al(t, n);
656
+ return nt(o, xo(n, s, l, e, r));
657
657
  }
658
658
  else return nt(o, Rn(n, e, r));
659
659
  }
@@ -672,16 +672,16 @@ function tt(n, e) {
672
672
  function Lt(n, e, t, r) {
673
673
  let i = (e || n).node(t), o = 0, s = e ? e.index(t) : i.childCount;
674
674
  n && (o = n.index(t), n.depth > t ? o++ : n.textOffset && (tt(n.nodeAfter, r), o++));
675
- for (let a = o; a < s; a++)
676
- tt(i.child(a), r);
675
+ for (let l = o; l < s; l++)
676
+ tt(i.child(l), r);
677
677
  e && e.depth == t && e.textOffset && tt(e.nodeBefore, r);
678
678
  }
679
679
  function nt(n, e) {
680
680
  return n.type.checkContent(e), n.copy(e);
681
681
  }
682
682
  function xo(n, e, t, r, i) {
683
- let o = n.depth > i && vr(n, e, i + 1), s = r.depth > i && vr(t, r, i + 1), a = [];
684
- return Lt(null, n, i, a), o && s && e.index(i) == t.index(i) ? (bo(o, s), tt(nt(o, xo(n, e, t, r, i + 1)), a)) : (o && tt(nt(o, Rn(n, e, i + 1)), a), Lt(e, t, i, a), s && tt(nt(s, Rn(t, r, i + 1)), a)), Lt(r, null, i, a), new k(a);
683
+ let o = n.depth > i && vr(n, e, i + 1), s = r.depth > i && vr(t, r, i + 1), l = [];
684
+ return Lt(null, n, i, l), o && s && e.index(i) == t.index(i) ? (bo(o, s), tt(nt(o, xo(n, e, t, r, i + 1)), l)) : (o && tt(nt(o, Rn(n, e, i + 1)), l), Lt(e, t, i, l), s && tt(nt(s, Rn(t, r, i + 1)), l)), Lt(r, null, i, l), new k(l);
685
685
  }
686
686
  function Rn(n, e, t) {
687
687
  let r = [];
@@ -691,7 +691,7 @@ function Rn(n, e, t) {
691
691
  }
692
692
  return Lt(e, null, t, r), new k(r);
693
693
  }
694
- function la(n, e) {
694
+ function al(n, e) {
695
695
  let t = e.depth - n.openStart, i = e.node(t).copy(n.content);
696
696
  for (let o = t - 1; o >= 0; o--)
697
697
  i = e.node(o).copy(k.from(i));
@@ -836,8 +836,8 @@ class qt {
836
836
  return e.child(t).marks;
837
837
  let r = e.maybeChild(t - 1), i = e.maybeChild(t);
838
838
  if (!r) {
839
- let a = r;
840
- r = i, i = a;
839
+ let l = r;
840
+ r = i, i = l;
841
841
  }
842
842
  let o = r.marks;
843
843
  for (var s = 0; s < o.length; s++)
@@ -923,10 +923,10 @@ class qt {
923
923
  throw new RangeError("Position " + t + " out of range");
924
924
  let r = [], i = 0, o = t;
925
925
  for (let s = e; ; ) {
926
- let { index: a, offset: l } = s.content.findIndex(o), c = o - l;
927
- if (r.push(s, a, i + l), !c || (s = s.child(a), s.isText))
926
+ let { index: l, offset: a } = s.content.findIndex(o), c = o - a;
927
+ if (r.push(s, l, i + a), !c || (s = s.child(l), s.isText))
928
928
  break;
929
- o = c - 1, i += l + 1;
929
+ o = c - 1, i += a + 1;
930
930
  }
931
931
  return new qt(t, r, o);
932
932
  }
@@ -942,17 +942,17 @@ class qt {
942
942
  return s;
943
943
  }
944
944
  else
945
- fi.set(e, r = new ca());
945
+ fi.set(e, r = new cl());
946
946
  let i = r.elts[r.i] = qt.resolve(e, t);
947
- return r.i = (r.i + 1) % ua, i;
947
+ return r.i = (r.i + 1) % ul, i;
948
948
  }
949
949
  }
950
- class ca {
950
+ class cl {
951
951
  constructor() {
952
952
  this.elts = [], this.i = 0;
953
953
  }
954
954
  }
955
- const ua = 12, fi = /* @__PURE__ */ new WeakMap();
955
+ const ul = 12, fi = /* @__PURE__ */ new WeakMap();
956
956
  class Pn {
957
957
  /**
958
958
  Construct a node range. `$from` and `$to` should point into the
@@ -993,7 +993,7 @@ class Pn {
993
993
  return this.$to.indexAfter(this.depth);
994
994
  }
995
995
  }
996
- const fa = /* @__PURE__ */ Object.create(null);
996
+ const fl = /* @__PURE__ */ Object.create(null);
997
997
  let rt = class br {
998
998
  /**
999
999
  @internal
@@ -1075,7 +1075,7 @@ let rt = class br {
1075
1075
  `blockSeparator` is given, it will be inserted to separate text
1076
1076
  from different block nodes. If `leafText` is given, it'll be
1077
1077
  inserted for every non-text leaf node encountered, otherwise
1078
- [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used.
1078
+ [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
1079
1079
  */
1080
1080
  textBetween(e, t, r, i) {
1081
1081
  return this.content.textBetween(e, t, r, i);
@@ -1112,7 +1112,7 @@ let rt = class br {
1112
1112
  attributes, and marks.
1113
1113
  */
1114
1114
  hasMarkup(e, t, r) {
1115
- return this.type == e && In(this.attrs, t || e.defaultAttrs || fa) && z.sameSet(this.marks, r || z.none);
1115
+ return this.type == e && In(this.attrs, t || e.defaultAttrs || fl) && z.sameSet(this.marks, r || z.none);
1116
1116
  }
1117
1117
  /**
1118
1118
  Create a new node with the same markup as this node, containing
@@ -1143,7 +1143,7 @@ let rt = class br {
1143
1143
  slice(e, t = this.content.size, r = !1) {
1144
1144
  if (e == t)
1145
1145
  return S.empty;
1146
- let i = this.resolve(e), o = this.resolve(t), s = r ? 0 : i.sharedDepth(t), a = i.start(s), c = i.node(s).content.cut(i.pos - a, o.pos - a);
1146
+ let i = this.resolve(e), o = this.resolve(t), s = r ? 0 : i.sharedDepth(t), l = i.start(s), c = i.node(s).content.cut(i.pos - l, o.pos - l);
1147
1147
  return new S(c, i.depth - s, o.depth - s);
1148
1148
  }
1149
1149
  /**
@@ -1155,7 +1155,7 @@ let rt = class br {
1155
1155
  [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
1156
1156
  */
1157
1157
  replace(e, t, r) {
1158
- return aa(this.resolve(e), this.resolve(t), r);
1158
+ return ll(this.resolve(e), this.resolve(t), r);
1159
1159
  }
1160
1160
  /**
1161
1161
  Find the node directly after the given position.
@@ -1289,11 +1289,11 @@ let rt = class br {
1289
1289
  replacement fragment.
1290
1290
  */
1291
1291
  canReplace(e, t, r = k.empty, i = 0, o = r.childCount) {
1292
- let s = this.contentMatchAt(e).matchFragment(r, i, o), a = s && s.matchFragment(this.content, t);
1293
- if (!a || !a.validEnd)
1292
+ let s = this.contentMatchAt(e).matchFragment(r, i, o), l = s && s.matchFragment(this.content, t);
1293
+ if (!l || !l.validEnd)
1294
1294
  return !1;
1295
- for (let l = i; l < o; l++)
1296
- if (!this.type.allowsMarks(r.child(l).marks))
1295
+ for (let a = i; a < o; a++)
1296
+ if (!this.type.allowsMarks(r.child(a).marks))
1297
1297
  return !1;
1298
1298
  return !0;
1299
1299
  }
@@ -1407,7 +1407,7 @@ function ko(n, e) {
1407
1407
  e = n[t].type.name + "(" + e + ")";
1408
1408
  return e;
1409
1409
  }
1410
- class lt {
1410
+ class at {
1411
1411
  /**
1412
1412
  @internal
1413
1413
  */
@@ -1418,13 +1418,13 @@ class lt {
1418
1418
  @internal
1419
1419
  */
1420
1420
  static parse(e, t) {
1421
- let r = new da(e, t);
1421
+ let r = new dl(e, t);
1422
1422
  if (r.next == null)
1423
- return lt.empty;
1423
+ return at.empty;
1424
1424
  let i = wo(r);
1425
1425
  r.next && r.err("Unexpected trailing text");
1426
- let o = ba(va(i));
1427
- return xa(o, r), o;
1426
+ let o = bl(vl(i));
1427
+ return xl(o, r), o;
1428
1428
  }
1429
1429
  /**
1430
1430
  Match a node type, returning a match after that node if
@@ -1484,15 +1484,15 @@ class lt {
1484
1484
  */
1485
1485
  fillBefore(e, t = !1, r = 0) {
1486
1486
  let i = [this];
1487
- function o(s, a) {
1488
- let l = s.matchFragment(e, r);
1489
- if (l && (!t || l.validEnd))
1490
- return k.from(a.map((c) => c.createAndFill()));
1487
+ function o(s, l) {
1488
+ let a = s.matchFragment(e, r);
1489
+ if (a && (!t || a.validEnd))
1490
+ return k.from(l.map((c) => c.createAndFill()));
1491
1491
  for (let c = 0; c < s.next.length; c++) {
1492
1492
  let { type: u, next: f } = s.next[c];
1493
1493
  if (!(u.isText || u.hasRequiredAttrs()) && i.indexOf(f) == -1) {
1494
1494
  i.push(f);
1495
- let p = o(f, a.concat(u));
1495
+ let p = o(f, l.concat(u));
1496
1496
  if (p)
1497
1497
  return p;
1498
1498
  }
@@ -1523,13 +1523,13 @@ class lt {
1523
1523
  let i = r.shift(), o = i.match;
1524
1524
  if (o.matchType(e)) {
1525
1525
  let s = [];
1526
- for (let a = i; a.type; a = a.via)
1527
- s.push(a.type);
1526
+ for (let l = i; l.type; l = l.via)
1527
+ s.push(l.type);
1528
1528
  return s.reverse();
1529
1529
  }
1530
1530
  for (let s = 0; s < o.next.length; s++) {
1531
- let { type: a, next: l } = o.next[s];
1532
- !a.isLeaf && !a.hasRequiredAttrs() && !(a.name in t) && (!i.type || l.validEnd) && (r.push({ match: a.contentMatch, type: a, via: i }), t[a.name] = !0);
1531
+ let { type: l, next: a } = o.next[s];
1532
+ !l.isLeaf && !l.hasRequiredAttrs() && !(l.name in t) && (!i.type || a.validEnd) && (r.push({ match: l.contentMatch, type: l, via: i }), t[l.name] = !0);
1533
1533
  }
1534
1534
  }
1535
1535
  return null;
@@ -1569,8 +1569,8 @@ class lt {
1569
1569
  `);
1570
1570
  }
1571
1571
  }
1572
- lt.empty = new lt(!0);
1573
- class da {
1572
+ at.empty = new at(!0);
1573
+ class dl {
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
  }
@@ -1587,19 +1587,19 @@ class da {
1587
1587
  function wo(n) {
1588
1588
  let e = [];
1589
1589
  do
1590
- e.push(pa(n));
1590
+ e.push(pl(n));
1591
1591
  while (n.eat("|"));
1592
1592
  return e.length == 1 ? e[0] : { type: "choice", exprs: e };
1593
1593
  }
1594
- function pa(n) {
1594
+ function pl(n) {
1595
1595
  let e = [];
1596
1596
  do
1597
- e.push(ha(n));
1597
+ e.push(hl(n));
1598
1598
  while (n.next && n.next != ")" && n.next != "|");
1599
1599
  return e.length == 1 ? e[0] : { type: "seq", exprs: e };
1600
1600
  }
1601
- function ha(n) {
1602
- let e = ya(n);
1601
+ function hl(n) {
1602
+ let e = yl(n);
1603
1603
  for (; ; )
1604
1604
  if (n.eat("+"))
1605
1605
  e = { type: "plus", expr: e };
@@ -1608,7 +1608,7 @@ function ha(n) {
1608
1608
  else if (n.eat("?"))
1609
1609
  e = { type: "opt", expr: e };
1610
1610
  else if (n.eat("{"))
1611
- e = ma(n, e);
1611
+ e = ml(n, e);
1612
1612
  else
1613
1613
  break;
1614
1614
  return e;
@@ -1618,11 +1618,11 @@ function di(n) {
1618
1618
  let e = Number(n.next);
1619
1619
  return n.pos++, e;
1620
1620
  }
1621
- function ma(n, e) {
1621
+ function ml(n, e) {
1622
1622
  let t = di(n), r = t;
1623
1623
  return n.eat(",") && (n.next != "}" ? r = di(n) : r = -1), n.eat("}") || n.err("Unclosed braced range"), { type: "range", min: t, max: r, expr: e };
1624
1624
  }
1625
- function ga(n, e) {
1625
+ function gl(n, e) {
1626
1626
  let t = n.nodeTypes, r = t[e];
1627
1627
  if (r)
1628
1628
  return [r];
@@ -1633,66 +1633,66 @@ function ga(n, e) {
1633
1633
  }
1634
1634
  return i.length == 0 && n.err("No node type or group '" + e + "' found"), i;
1635
1635
  }
1636
- function ya(n) {
1636
+ function yl(n) {
1637
1637
  if (n.eat("(")) {
1638
1638
  let e = wo(n);
1639
1639
  return n.eat(")") || n.err("Missing closing paren"), e;
1640
1640
  } else if (/\W/.test(n.next))
1641
1641
  n.err("Unexpected token '" + n.next + "'");
1642
1642
  else {
1643
- let e = ga(n, n.next).map((t) => (n.inline == null ? n.inline = t.isInline : n.inline != t.isInline && n.err("Mixing inline and block content"), { type: "name", value: t }));
1643
+ let e = gl(n, n.next).map((t) => (n.inline == null ? n.inline = t.isInline : n.inline != t.isInline && n.err("Mixing inline and block content"), { type: "name", value: t }));
1644
1644
  return n.pos++, e.length == 1 ? e[0] : { type: "choice", exprs: e };
1645
1645
  }
1646
1646
  }
1647
- function va(n) {
1647
+ function vl(n) {
1648
1648
  let e = [[]];
1649
1649
  return i(o(n, 0), t()), e;
1650
1650
  function t() {
1651
1651
  return e.push([]) - 1;
1652
1652
  }
1653
- function r(s, a, l) {
1654
- let c = { term: l, to: a };
1653
+ function r(s, l, a) {
1654
+ let c = { term: a, to: l };
1655
1655
  return e[s].push(c), c;
1656
1656
  }
1657
- function i(s, a) {
1658
- s.forEach((l) => l.to = a);
1657
+ function i(s, l) {
1658
+ s.forEach((a) => a.to = l);
1659
1659
  }
1660
- function o(s, a) {
1660
+ function o(s, l) {
1661
1661
  if (s.type == "choice")
1662
- return s.exprs.reduce((l, c) => l.concat(o(c, a)), []);
1662
+ return s.exprs.reduce((a, c) => a.concat(o(c, l)), []);
1663
1663
  if (s.type == "seq")
1664
- for (let l = 0; ; l++) {
1665
- let c = o(s.exprs[l], a);
1666
- if (l == s.exprs.length - 1)
1664
+ for (let a = 0; ; a++) {
1665
+ let c = o(s.exprs[a], l);
1666
+ if (a == s.exprs.length - 1)
1667
1667
  return c;
1668
- i(c, a = t());
1668
+ i(c, l = t());
1669
1669
  }
1670
1670
  else if (s.type == "star") {
1671
- let l = t();
1672
- return r(a, l), i(o(s.expr, l), l), [r(l)];
1671
+ let a = t();
1672
+ return r(l, a), i(o(s.expr, a), a), [r(a)];
1673
1673
  } else if (s.type == "plus") {
1674
- let l = t();
1675
- return i(o(s.expr, a), l), i(o(s.expr, l), l), [r(l)];
1674
+ let a = t();
1675
+ return i(o(s.expr, l), a), i(o(s.expr, a), a), [r(a)];
1676
1676
  } else {
1677
1677
  if (s.type == "opt")
1678
- return [r(a)].concat(o(s.expr, a));
1678
+ return [r(l)].concat(o(s.expr, l));
1679
1679
  if (s.type == "range") {
1680
- let l = a;
1680
+ let a = l;
1681
1681
  for (let c = 0; c < s.min; c++) {
1682
1682
  let u = t();
1683
- i(o(s.expr, l), u), l = u;
1683
+ i(o(s.expr, a), u), a = u;
1684
1684
  }
1685
1685
  if (s.max == -1)
1686
- i(o(s.expr, l), l);
1686
+ i(o(s.expr, a), a);
1687
1687
  else
1688
1688
  for (let c = s.min; c < s.max; c++) {
1689
1689
  let u = t();
1690
- r(l, u), i(o(s.expr, l), u), l = u;
1690
+ r(a, u), i(o(s.expr, a), u), a = u;
1691
1691
  }
1692
- return [r(l)];
1692
+ return [r(a)];
1693
1693
  } else {
1694
1694
  if (s.type == "name")
1695
- return [r(a, void 0, s.value)];
1695
+ return [r(l, void 0, s.value)];
1696
1696
  throw new Error("Unknown expr type");
1697
1697
  }
1698
1698
  }
@@ -1710,42 +1710,42 @@ function pi(n, e) {
1710
1710
  return r(o[0].to);
1711
1711
  t.push(i);
1712
1712
  for (let s = 0; s < o.length; s++) {
1713
- let { term: a, to: l } = o[s];
1714
- !a && t.indexOf(l) == -1 && r(l);
1713
+ let { term: l, to: a } = o[s];
1714
+ !l && t.indexOf(a) == -1 && r(a);
1715
1715
  }
1716
1716
  }
1717
1717
  }
1718
- function ba(n) {
1718
+ function bl(n) {
1719
1719
  let e = /* @__PURE__ */ Object.create(null);
1720
1720
  return t(pi(n, 0));
1721
1721
  function t(r) {
1722
1722
  let i = [];
1723
1723
  r.forEach((s) => {
1724
- n[s].forEach(({ term: a, to: l }) => {
1725
- if (!a)
1724
+ n[s].forEach(({ term: l, to: a }) => {
1725
+ if (!l)
1726
1726
  return;
1727
1727
  let c;
1728
1728
  for (let u = 0; u < i.length; u++)
1729
- i[u][0] == a && (c = i[u][1]);
1730
- pi(n, l).forEach((u) => {
1731
- c || i.push([a, c = []]), c.indexOf(u) == -1 && c.push(u);
1729
+ i[u][0] == l && (c = i[u][1]);
1730
+ pi(n, a).forEach((u) => {
1731
+ c || i.push([l, c = []]), c.indexOf(u) == -1 && c.push(u);
1732
1732
  });
1733
1733
  });
1734
1734
  });
1735
- let o = e[r.join(",")] = new lt(r.indexOf(n.length - 1) > -1);
1735
+ let o = e[r.join(",")] = new at(r.indexOf(n.length - 1) > -1);
1736
1736
  for (let s = 0; s < i.length; s++) {
1737
- let a = i[s][1].sort(So);
1738
- o.next.push({ type: i[s][0], next: e[a.join(",")] || t(a) });
1737
+ let l = i[s][1].sort(So);
1738
+ o.next.push({ type: i[s][0], next: e[l.join(",")] || t(l) });
1739
1739
  }
1740
1740
  return o;
1741
1741
  }
1742
1742
  }
1743
- function xa(n, e) {
1743
+ function xl(n, e) {
1744
1744
  for (let t = 0, r = [n]; t < r.length; t++) {
1745
1745
  let i = r[t], o = !i.validEnd, s = [];
1746
- for (let a = 0; a < i.next.length; a++) {
1747
- let { type: l, next: c } = i.next[a];
1748
- s.push(l.name), o && !(l.isText || l.hasRequiredAttrs()) && (o = !1), r.indexOf(c) == -1 && r.push(c);
1746
+ for (let l = 0; l < i.next.length; l++) {
1747
+ let { type: a, next: c } = i.next[l];
1748
+ s.push(a.name), o && !(a.isText || a.hasRequiredAttrs()) && (o = !1), r.indexOf(c) == -1 && r.push(c);
1749
1749
  }
1750
1750
  o && e.err("Only non-generatable nodes (" + s.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
1751
1751
  }
@@ -1788,7 +1788,7 @@ function To(n, e) {
1788
1788
  let t = /* @__PURE__ */ Object.create(null);
1789
1789
  if (e)
1790
1790
  for (let r in e)
1791
- t[r] = new wa(n, r, e[r]);
1791
+ t[r] = new wl(n, r, e[r]);
1792
1792
  return t;
1793
1793
  }
1794
1794
  let hi = class Mo {
@@ -1815,7 +1815,7 @@ let hi = class Mo {
1815
1815
  True for node types that allow no content.
1816
1816
  */
1817
1817
  get isLeaf() {
1818
- return this.contentMatch == lt.empty;
1818
+ return this.contentMatch == at.empty;
1819
1819
  }
1820
1820
  /**
1821
1821
  True when this node is an atom, i.e. when it does not have
@@ -1970,7 +1970,7 @@ let hi = class Mo {
1970
1970
  return r;
1971
1971
  }
1972
1972
  };
1973
- function ka(n, e, t) {
1973
+ function kl(n, e, t) {
1974
1974
  let r = t.split("|");
1975
1975
  return (i) => {
1976
1976
  let o = i === null ? "null" : typeof i;
@@ -1978,9 +1978,9 @@ function ka(n, e, t) {
1978
1978
  throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`);
1979
1979
  };
1980
1980
  }
1981
- class wa {
1981
+ class wl {
1982
1982
  constructor(e, t, r) {
1983
- this.hasDefault = Object.prototype.hasOwnProperty.call(r, "default"), this.default = r.default, this.validate = typeof r.validate == "string" ? ka(e, t, r.validate) : r.validate;
1983
+ this.hasDefault = Object.prototype.hasOwnProperty.call(r, "default"), this.default = r.default, this.validate = typeof r.validate == "string" ? kl(e, t, r.validate) : r.validate;
1984
1984
  }
1985
1985
  get isRequired() {
1986
1986
  return !this.hasDefault;
@@ -2041,7 +2041,7 @@ class Pr {
2041
2041
  return this.excluded.indexOf(e) > -1;
2042
2042
  }
2043
2043
  }
2044
- class Sa {
2044
+ class Sl {
2045
2045
  /**
2046
2046
  Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
2047
2047
  */
@@ -2055,21 +2055,21 @@ class Sa {
2055
2055
  for (let i in this.nodes) {
2056
2056
  if (i in this.marks)
2057
2057
  throw new RangeError(i + " can not be both a node and a mark");
2058
- let o = this.nodes[i], s = o.spec.content || "", a = o.spec.marks;
2059
- if (o.contentMatch = r[s] || (r[s] = lt.parse(s, this.nodes)), o.inlineContent = o.contentMatch.inlineContent, o.spec.linebreakReplacement) {
2058
+ let o = this.nodes[i], s = o.spec.content || "", l = o.spec.marks;
2059
+ if (o.contentMatch = r[s] || (r[s] = at.parse(s, this.nodes)), o.inlineContent = o.contentMatch.inlineContent, o.spec.linebreakReplacement) {
2060
2060
  if (this.linebreakReplacement)
2061
2061
  throw new RangeError("Multiple linebreak nodes defined");
2062
2062
  if (!o.isInline || !o.isLeaf)
2063
2063
  throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
2064
2064
  this.linebreakReplacement = o;
2065
2065
  }
2066
- o.markSet = a == "_" ? null : a ? mi(this, a.split(" ")) : a == "" || !o.inlineContent ? [] : null;
2066
+ o.markSet = l == "_" ? null : l ? mi(this, l.split(" ")) : l == "" || !o.inlineContent ? [] : null;
2067
2067
  }
2068
2068
  for (let i in this.marks) {
2069
2069
  let o = this.marks[i], s = o.spec.excludes;
2070
2070
  o.excluded = s == null ? [o] : s == "" ? [] : mi(this, s.split(" "));
2071
2071
  }
2072
- this.nodeFromJSON = this.nodeFromJSON.bind(this), this.markFromJSON = this.markFromJSON.bind(this), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
2072
+ this.nodeFromJSON = (i) => rt.fromJSON(this, i), this.markFromJSON = (i) => z.fromJSON(this, i), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
2073
2073
  }
2074
2074
  /**
2075
2075
  Create a node in this schema. The `type` may be a string or a
@@ -2101,20 +2101,6 @@ class Sa {
2101
2101
  return typeof e == "string" && (e = this.marks[e]), e.create(t);
2102
2102
  }
2103
2103
  /**
2104
- Deserialize a node from its JSON representation. This method is
2105
- bound.
2106
- */
2107
- nodeFromJSON(e) {
2108
- return rt.fromJSON(this, e);
2109
- }
2110
- /**
2111
- Deserialize a mark from its JSON representation. This method is
2112
- bound.
2113
- */
2114
- markFromJSON(e) {
2115
- return z.fromJSON(this, e);
2116
- }
2117
- /**
2118
2104
  @internal
2119
2105
  */
2120
2106
  nodeType(e) {
@@ -2131,19 +2117,19 @@ function mi(n, e) {
2131
2117
  if (o)
2132
2118
  t.push(o);
2133
2119
  else
2134
- for (let a in n.marks) {
2135
- let l = n.marks[a];
2136
- (i == "_" || l.spec.group && l.spec.group.split(" ").indexOf(i) > -1) && t.push(s = l);
2120
+ for (let l in n.marks) {
2121
+ let a = n.marks[l];
2122
+ (i == "_" || a.spec.group && a.spec.group.split(" ").indexOf(i) > -1) && t.push(s = a);
2137
2123
  }
2138
2124
  if (!s)
2139
2125
  throw new SyntaxError("Unknown mark type: '" + e[r] + "'");
2140
2126
  }
2141
2127
  return t;
2142
2128
  }
2143
- function Ca(n) {
2129
+ function Cl(n) {
2144
2130
  return n.tag != null;
2145
2131
  }
2146
- function Oa(n) {
2132
+ function Ol(n) {
2147
2133
  return n.style != null;
2148
2134
  }
2149
2135
  class it {
@@ -2155,9 +2141,9 @@ class it {
2155
2141
  this.schema = e, this.rules = t, this.tags = [], this.styles = [];
2156
2142
  let r = this.matchedStyles = [];
2157
2143
  t.forEach((i) => {
2158
- if (Ca(i))
2144
+ if (Cl(i))
2159
2145
  this.tags.push(i);
2160
- else if (Oa(i)) {
2146
+ else if (Ol(i)) {
2161
2147
  let o = /[^=]*/.exec(i.style)[0];
2162
2148
  r.indexOf(o) < 0 && r.push(o), this.styles.push(i);
2163
2149
  }
@@ -2193,7 +2179,7 @@ class it {
2193
2179
  matchTag(e, t, r) {
2194
2180
  for (let i = r ? this.tags.indexOf(r) + 1 : 0; i < this.tags.length; i++) {
2195
2181
  let o = this.tags[i];
2196
- if (Ma(e, o.tag) && (o.namespace === void 0 || e.namespaceURI == o.namespace) && (!o.context || t.matchesContext(o.context))) {
2182
+ if (Ml(e, o.tag) && (o.namespace === void 0 || e.namespaceURI == o.namespace) && (!o.context || t.matchesContext(o.context))) {
2197
2183
  if (o.getAttrs) {
2198
2184
  let s = o.getAttrs(e);
2199
2185
  if (s === !1)
@@ -2209,16 +2195,16 @@ class it {
2209
2195
  */
2210
2196
  matchStyle(e, t, r, i) {
2211
2197
  for (let o = i ? this.styles.indexOf(i) + 1 : 0; o < this.styles.length; o++) {
2212
- let s = this.styles[o], a = s.style;
2213
- if (!(a.indexOf(e) != 0 || s.context && !r.matchesContext(s.context) || // Test that the style string either precisely matches the prop,
2198
+ let s = this.styles[o], l = s.style;
2199
+ if (!(l.indexOf(e) != 0 || s.context && !r.matchesContext(s.context) || // Test that the style string either precisely matches the prop,
2214
2200
  // or has an '=' sign after the prop, followed by the given
2215
2201
  // value.
2216
- a.length > e.length && (a.charCodeAt(e.length) != 61 || a.slice(e.length + 1) != t))) {
2202
+ l.length > e.length && (l.charCodeAt(e.length) != 61 || l.slice(e.length + 1) != t))) {
2217
2203
  if (s.getAttrs) {
2218
- let l = s.getAttrs(t);
2219
- if (l === !1)
2204
+ let a = s.getAttrs(t);
2205
+ if (a === !1)
2220
2206
  continue;
2221
- s.attrs = l || void 0;
2207
+ s.attrs = a || void 0;
2222
2208
  }
2223
2209
  return s;
2224
2210
  }
@@ -2232,8 +2218,8 @@ class it {
2232
2218
  function r(i) {
2233
2219
  let o = i.priority == null ? 50 : i.priority, s = 0;
2234
2220
  for (; s < t.length; s++) {
2235
- let a = t[s];
2236
- if ((a.priority == null ? 50 : a.priority) < o)
2221
+ let l = t[s];
2222
+ if ((l.priority == null ? 50 : l.priority) < o)
2237
2223
  break;
2238
2224
  }
2239
2225
  t.splice(s, 0, i);
@@ -2255,7 +2241,7 @@ class it {
2255
2241
  /**
2256
2242
  Construct a DOM parser using the parsing rules listed in a
2257
2243
  schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
2258
- [priority](https://prosemirror.net/docs/ref/#model.ParseRule.priority).
2244
+ [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
2259
2245
  */
2260
2246
  static fromSchema(e) {
2261
2247
  return e.cached.domParser || (e.cached.domParser = new it(e, it.schemaRules(e)));
@@ -2294,7 +2280,7 @@ const Ao = {
2294
2280
  table: !0,
2295
2281
  tfoot: !0,
2296
2282
  ul: !0
2297
- }, Ea = {
2283
+ }, El = {
2298
2284
  head: !0,
2299
2285
  noscript: !0,
2300
2286
  object: !0,
@@ -2360,8 +2346,8 @@ class yi {
2360
2346
  o !== "full" ? r = r.replace(/\r?\n|\r/g, " ") : r = r.replace(/\r\n?/g, `
2361
2347
  `);
2362
2348
  else if (r = r.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(r) && this.open == this.nodes.length - 1) {
2363
- let s = i.content[i.content.length - 1], a = e.previousSibling;
2364
- (!s || a && a.nodeName == "BR" || s.isText && /[ \t\r\n\u000c]$/.test(s.text)) && (r = r.slice(1));
2349
+ let s = i.content[i.content.length - 1], l = e.previousSibling;
2350
+ (!s || l && l.nodeName == "BR" || s.isText && /[ \t\r\n\u000c]$/.test(s.text)) && (r = r.slice(1));
2365
2351
  }
2366
2352
  r && this.insertNode(this.parser.schema.text(r), t, !/\S/.test(r)), this.findInText(e);
2367
2353
  } else
@@ -2372,13 +2358,13 @@ class yi {
2372
2358
  addElement(e, t, r) {
2373
2359
  let i = this.localPreserveWS, o = this.top;
2374
2360
  (e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
2375
- let s = e.nodeName.toLowerCase(), a;
2376
- No.hasOwnProperty(s) && this.parser.normalizeLists && Ta(e);
2377
- let l = this.options.ruleFromNode && this.options.ruleFromNode(e) || (a = this.parser.matchTag(e, this, r));
2378
- e: if (l ? l.ignore : Ea.hasOwnProperty(s))
2361
+ let s = e.nodeName.toLowerCase(), l;
2362
+ No.hasOwnProperty(s) && this.parser.normalizeLists && Tl(e);
2363
+ let a = this.options.ruleFromNode && this.options.ruleFromNode(e) || (l = this.parser.matchTag(e, this, r));
2364
+ e: if (a ? a.ignore : El.hasOwnProperty(s))
2379
2365
  this.findInside(e), this.ignoreFallback(e, t);
2380
- else if (!l || l.skip || l.closeParent) {
2381
- l && l.closeParent ? this.open = Math.max(0, this.open - 1) : l && l.skip.nodeType && (e = l.skip);
2366
+ else if (!a || a.skip || a.closeParent) {
2367
+ a && a.closeParent ? this.open = Math.max(0, this.open - 1) : a && a.skip.nodeType && (e = a.skip);
2382
2368
  let c, u = this.needsBlock;
2383
2369
  if (Ao.hasOwnProperty(s))
2384
2370
  o.content.length && o.content[0].isInline && this.open && (this.open--, o = this.top), c = !0, o.type || (this.needsBlock = !0);
@@ -2386,11 +2372,11 @@ class yi {
2386
2372
  this.leafFallback(e, t);
2387
2373
  break e;
2388
2374
  }
2389
- let f = l && l.skip ? t : this.readStyles(e, t);
2375
+ let f = a && a.skip ? t : this.readStyles(e, t);
2390
2376
  f && this.addAll(e, f), c && this.sync(o), this.needsBlock = u;
2391
2377
  } else {
2392
2378
  let c = this.readStyles(e, t);
2393
- c && this.addElementByRule(e, l, c, l.consuming === !1 ? a : void 0);
2379
+ c && this.addElementByRule(e, a, c, a.consuming === !1 ? l : void 0);
2394
2380
  }
2395
2381
  this.localPreserveWS = i;
2396
2382
  }
@@ -2412,14 +2398,14 @@ class yi {
2412
2398
  for (let i = 0; i < this.parser.matchedStyles.length; i++) {
2413
2399
  let o = this.parser.matchedStyles[i], s = r.getPropertyValue(o);
2414
2400
  if (s)
2415
- for (let a = void 0; ; ) {
2416
- let l = this.parser.matchStyle(o, s, this, a);
2417
- if (!l)
2401
+ for (let l = void 0; ; ) {
2402
+ let a = this.parser.matchStyle(o, s, this, l);
2403
+ if (!a)
2418
2404
  break;
2419
- if (l.ignore)
2405
+ if (a.ignore)
2420
2406
  return null;
2421
- if (l.clearMark ? t = t.filter((c) => !l.clearMark(c)) : t = t.concat(this.parser.schema.marks[l.mark].create(l.attrs)), l.consuming === !1)
2422
- a = l;
2407
+ if (a.clearMark ? t = t.filter((c) => !a.clearMark(c)) : t = t.concat(this.parser.schema.marks[a.mark].create(a.attrs)), a.consuming === !1)
2408
+ l = a;
2423
2409
  else
2424
2410
  break;
2425
2411
  }
@@ -2435,32 +2421,32 @@ class yi {
2435
2421
  if (s = this.parser.schema.nodes[t.node], s.isLeaf)
2436
2422
  this.insertNode(s.create(t.attrs), r, e.nodeName == "BR") || this.leafFallback(e, r);
2437
2423
  else {
2438
- let l = this.enter(s, t.attrs || null, r, t.preserveWhitespace);
2439
- l && (o = !0, r = l);
2424
+ let a = this.enter(s, t.attrs || null, r, t.preserveWhitespace);
2425
+ a && (o = !0, r = a);
2440
2426
  }
2441
2427
  else {
2442
- let l = this.parser.schema.marks[t.mark];
2443
- r = r.concat(l.create(t.attrs));
2428
+ let a = this.parser.schema.marks[t.mark];
2429
+ r = r.concat(a.create(t.attrs));
2444
2430
  }
2445
- let a = this.top;
2431
+ let l = this.top;
2446
2432
  if (s && s.isLeaf)
2447
2433
  this.findInside(e);
2448
2434
  else if (i)
2449
2435
  this.addElement(e, r, i);
2450
2436
  else if (t.getContent)
2451
- this.findInside(e), t.getContent(e, this.parser.schema).forEach((l) => this.insertNode(l, r, !1));
2437
+ this.findInside(e), t.getContent(e, this.parser.schema).forEach((a) => this.insertNode(a, r, !1));
2452
2438
  else {
2453
- let l = e;
2454
- typeof t.contentElement == "string" ? l = e.querySelector(t.contentElement) : typeof t.contentElement == "function" ? l = t.contentElement(e) : t.contentElement && (l = t.contentElement), this.findAround(e, l, !0), this.addAll(l, r), this.findAround(e, l, !1);
2439
+ let a = e;
2440
+ typeof t.contentElement == "string" ? a = e.querySelector(t.contentElement) : typeof t.contentElement == "function" ? a = t.contentElement(e) : t.contentElement && (a = t.contentElement), this.findAround(e, a, !0), this.addAll(a, r), this.findAround(e, a, !1);
2455
2441
  }
2456
- o && this.sync(a) && this.open--;
2442
+ o && this.sync(l) && this.open--;
2457
2443
  }
2458
2444
  // Add all child nodes between `startIndex` and `endIndex` (or the
2459
2445
  // whole node, if not given). If `sync` is passed, use it to
2460
2446
  // synchronize after every block element.
2461
2447
  addAll(e, t, r, i) {
2462
2448
  let o = r || 0;
2463
- for (let s = r ? e.childNodes[r] : e.firstChild, a = i == null ? null : e.childNodes[i]; s != a; s = s.nextSibling, ++o)
2449
+ for (let s = r ? e.childNodes[r] : e.firstChild, l = i == null ? null : e.childNodes[i]; s != l; s = s.nextSibling, ++o)
2464
2450
  this.findAtPoint(e, o), this.addDOM(s, t);
2465
2451
  this.findAtPoint(e, o);
2466
2452
  }
@@ -2469,14 +2455,14 @@ class yi {
2469
2455
  // nodes that we're in.
2470
2456
  findPlace(e, t, r) {
2471
2457
  let i, o;
2472
- for (let s = this.open, a = 0; s >= 0; s--) {
2473
- let l = this.nodes[s], c = l.findWrapping(e);
2474
- if (c && (!i || i.length > c.length + a) && (i = c, o = l, !c.length))
2458
+ for (let s = this.open, l = 0; s >= 0; s--) {
2459
+ let a = this.nodes[s], c = a.findWrapping(e);
2460
+ if (c && (!i || i.length > c.length + l) && (i = c, o = a, !c.length))
2475
2461
  break;
2476
- if (l.solid) {
2462
+ if (a.solid) {
2477
2463
  if (r)
2478
2464
  break;
2479
- a += 2;
2465
+ l += 2;
2480
2466
  }
2481
2467
  }
2482
2468
  if (!i)
@@ -2498,8 +2484,8 @@ class yi {
2498
2484
  let o = this.top;
2499
2485
  o.match && (o.match = o.match.matchType(e.type));
2500
2486
  let s = z.none;
2501
- for (let a of i.concat(e.marks))
2502
- (o.type ? o.type.allowsMarkType(a.type) : bi(a.type, e.type)) && (s = a.addToSet(s));
2487
+ for (let l of i.concat(e.marks))
2488
+ (o.type ? o.type.allowsMarkType(l.type) : bi(l.type, e.type)) && (s = l.addToSet(s));
2503
2489
  return o.content.push(e.mark(s)), !0;
2504
2490
  }
2505
2491
  return !1;
@@ -2515,10 +2501,10 @@ class yi {
2515
2501
  this.closeExtra();
2516
2502
  let s = this.top;
2517
2503
  s.match = s.match && s.match.matchType(e);
2518
- let a = gi(e, o, s.options);
2519
- s.options & $t && s.content.length == 0 && (a |= $t);
2520
- let l = z.none;
2521
- return r = r.filter((c) => (s.type ? s.type.allowsMarkType(c.type) : bi(c.type, e)) ? (l = c.addToSet(l), !1) : !0), this.nodes.push(new kn(e, t, l, i, null, a)), this.open++, r;
2504
+ let l = gi(e, o, s.options);
2505
+ s.options & $t && s.content.length == 0 && (l |= $t);
2506
+ let a = z.none;
2507
+ return r = r.filter((c) => (s.type ? s.type.allowsMarkType(c.type) : bi(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new kn(e, t, a, i, null, l)), this.open++, r;
2522
2508
  }
2523
2509
  // Make sure all nodes above this.open are finished and added to
2524
2510
  // their parents
@@ -2576,21 +2562,21 @@ class yi {
2576
2562
  matchesContext(e) {
2577
2563
  if (e.indexOf("|") > -1)
2578
2564
  return e.split(/\s*\|\s*/).some(this.matchesContext, this);
2579
- let t = e.split("/"), r = this.options.context, i = !this.isOpen && (!r || r.parent.type == this.nodes[0].type), o = -(r ? r.depth + 1 : 0) + (i ? 0 : 1), s = (a, l) => {
2580
- for (; a >= 0; a--) {
2581
- let c = t[a];
2565
+ let t = e.split("/"), r = this.options.context, i = !this.isOpen && (!r || r.parent.type == this.nodes[0].type), o = -(r ? r.depth + 1 : 0) + (i ? 0 : 1), s = (l, a) => {
2566
+ for (; l >= 0; l--) {
2567
+ let c = t[l];
2582
2568
  if (c == "") {
2583
- if (a == t.length - 1 || a == 0)
2569
+ if (l == t.length - 1 || l == 0)
2584
2570
  continue;
2585
- for (; l >= o; l--)
2586
- if (s(a - 1, l))
2571
+ for (; a >= o; a--)
2572
+ if (s(l - 1, a))
2587
2573
  return !0;
2588
2574
  return !1;
2589
2575
  } else {
2590
- let u = l > 0 || l == 0 && i ? this.nodes[l].type : r && l >= o ? r.node(l - o).type : null;
2576
+ let u = a > 0 || a == 0 && i ? this.nodes[a].type : r && a >= o ? r.node(a - o).type : null;
2591
2577
  if (!u || u.name != c && !u.isInGroup(c))
2592
2578
  return !1;
2593
- l--;
2579
+ a--;
2594
2580
  }
2595
2581
  }
2596
2582
  return !0;
@@ -2612,13 +2598,13 @@ class yi {
2612
2598
  }
2613
2599
  }
2614
2600
  }
2615
- function Ta(n) {
2601
+ function Tl(n) {
2616
2602
  for (let e = n.firstChild, t = null; e; e = e.nextSibling) {
2617
2603
  let r = e.nodeType == 1 ? e.nodeName.toLowerCase() : null;
2618
2604
  r && No.hasOwnProperty(r) && t ? (t.appendChild(e), e = t) : r == "li" ? t = e : r && (t = null);
2619
2605
  }
2620
2606
  }
2621
- function Ma(n, e) {
2607
+ function Ml(n, e) {
2622
2608
  return (n.matches || n.msMatchesSelector || n.webkitMatchesSelector || n.mozMatchesSelector).call(n, e);
2623
2609
  }
2624
2610
  function vi(n) {
@@ -2633,10 +2619,10 @@ function bi(n, e) {
2633
2619
  let i = t[r];
2634
2620
  if (!i.allowsMarkType(n))
2635
2621
  continue;
2636
- let o = [], s = (a) => {
2637
- o.push(a);
2638
- for (let l = 0; l < a.edgeCount; l++) {
2639
- let { type: c, next: u } = a.edge(l);
2622
+ let o = [], s = (l) => {
2623
+ o.push(l);
2624
+ for (let a = 0; a < l.edgeCount; a++) {
2625
+ let { type: c, next: u } = l.edge(a);
2640
2626
  if (c == e || o.indexOf(u) < 0 && s(u))
2641
2627
  return !0;
2642
2628
  }
@@ -2669,21 +2655,21 @@ class Kn {
2669
2655
  let i = r, o = [];
2670
2656
  return e.forEach((s) => {
2671
2657
  if (o.length || s.marks.length) {
2672
- let a = 0, l = 0;
2673
- for (; a < o.length && l < s.marks.length; ) {
2674
- let c = s.marks[l];
2658
+ let l = 0, a = 0;
2659
+ for (; l < o.length && a < s.marks.length; ) {
2660
+ let c = s.marks[a];
2675
2661
  if (!this.marks[c.type.name]) {
2676
- l++;
2662
+ a++;
2677
2663
  continue;
2678
2664
  }
2679
- if (!c.eq(o[a][0]) || c.type.spec.spanning === !1)
2665
+ if (!c.eq(o[l][0]) || c.type.spec.spanning === !1)
2680
2666
  break;
2681
- a++, l++;
2667
+ l++, a++;
2682
2668
  }
2683
- for (; a < o.length; )
2669
+ for (; l < o.length; )
2684
2670
  i = o.pop()[1];
2685
- for (; l < s.marks.length; ) {
2686
- let c = s.marks[l++], u = this.serializeMark(c, s.isInline, t);
2671
+ for (; a < s.marks.length; ) {
2672
+ let c = s.marks[a++], u = this.serializeMark(c, s.isInline, t);
2687
2673
  u && (o.push([c, i]), i.appendChild(u.dom), i = u.contentDOM || u.dom);
2688
2674
  }
2689
2675
  }
@@ -2761,11 +2747,11 @@ function rr(n) {
2761
2747
  return n.document || window.document;
2762
2748
  }
2763
2749
  const ki = /* @__PURE__ */ new WeakMap();
2764
- function Aa(n) {
2750
+ function Al(n) {
2765
2751
  let e = ki.get(n);
2766
- return e === void 0 && ki.set(n, e = Na(n)), e;
2752
+ return e === void 0 && ki.set(n, e = Nl(n)), e;
2767
2753
  }
2768
- function Na(n) {
2754
+ function Nl(n) {
2769
2755
  let e = null;
2770
2756
  function t(r) {
2771
2757
  if (r && typeof r == "object")
@@ -2791,17 +2777,17 @@ function Tn(n, e, t, r) {
2791
2777
  let i = e[0], o;
2792
2778
  if (typeof i != "string")
2793
2779
  throw new RangeError("Invalid array passed to renderSpec");
2794
- if (r && (o = Aa(r)) && o.indexOf(e) > -1)
2780
+ if (r && (o = Al(r)) && o.indexOf(e) > -1)
2795
2781
  throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
2796
2782
  let s = i.indexOf(" ");
2797
2783
  s > 0 && (t = i.slice(0, s), i = i.slice(s + 1));
2798
- let a, l = t ? n.createElementNS(t, i) : n.createElement(i), c = e[1], u = 1;
2784
+ let l, a = t ? n.createElementNS(t, i) : n.createElement(i), c = e[1], u = 1;
2799
2785
  if (c && typeof c == "object" && c.nodeType == null && !Array.isArray(c)) {
2800
2786
  u = 2;
2801
2787
  for (let f in c)
2802
2788
  if (c[f] != null) {
2803
2789
  let p = f.indexOf(" ");
2804
- p > 0 ? l.setAttributeNS(f.slice(0, p), f.slice(p + 1), c[f]) : l.setAttribute(f, c[f]);
2790
+ p > 0 ? a.setAttributeNS(f.slice(0, p), f.slice(p + 1), c[f]) : f == "style" && a.style ? a.style.cssText = c[f] : a.setAttribute(f, c[f]);
2805
2791
  }
2806
2792
  }
2807
2793
  for (let f = u; f < e.length; f++) {
@@ -2809,26 +2795,26 @@ function Tn(n, e, t, r) {
2809
2795
  if (p === 0) {
2810
2796
  if (f < e.length - 1 || f > u)
2811
2797
  throw new RangeError("Content hole must be the only child of its parent node");
2812
- return { dom: l, contentDOM: l };
2798
+ return { dom: a, contentDOM: a };
2813
2799
  } else {
2814
2800
  let { dom: d, contentDOM: g } = Tn(n, p, t, r);
2815
- if (l.appendChild(d), g) {
2816
- if (a)
2801
+ if (a.appendChild(d), g) {
2802
+ if (l)
2817
2803
  throw new RangeError("Multiple content holes");
2818
- a = g;
2804
+ l = g;
2819
2805
  }
2820
2806
  }
2821
2807
  }
2822
- return { dom: l, contentDOM: a };
2808
+ return { dom: a, contentDOM: l };
2823
2809
  }
2824
2810
  const Io = 65535, Do = Math.pow(2, 16);
2825
- function Ia(n, e) {
2811
+ function Il(n, e) {
2826
2812
  return n + e * Do;
2827
2813
  }
2828
2814
  function wi(n) {
2829
2815
  return n & Io;
2830
2816
  }
2831
- function Da(n) {
2817
+ function Dl(n) {
2832
2818
  return (n - (n & Io)) / Do;
2833
2819
  }
2834
2820
  const Ro = 1, Po = 2, Mn = 4, Bo = 8;
@@ -2886,7 +2872,7 @@ class oe {
2886
2872
  if (!this.inverted)
2887
2873
  for (let i = 0; i < r; i++)
2888
2874
  t += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
2889
- return this.ranges[r * 3] + t + Da(e);
2875
+ return this.ranges[r * 3] + t + Dl(e);
2890
2876
  }
2891
2877
  mapResult(e, t = 1) {
2892
2878
  return this._map(e, t, !1);
@@ -2899,17 +2885,17 @@ class oe {
2899
2885
  */
2900
2886
  _map(e, t, r) {
2901
2887
  let i = 0, o = this.inverted ? 2 : 1, s = this.inverted ? 1 : 2;
2902
- for (let a = 0; a < this.ranges.length; a += 3) {
2903
- let l = this.ranges[a] - (this.inverted ? i : 0);
2904
- if (l > e)
2888
+ for (let l = 0; l < this.ranges.length; l += 3) {
2889
+ let a = this.ranges[l] - (this.inverted ? i : 0);
2890
+ if (a > e)
2905
2891
  break;
2906
- let c = this.ranges[a + o], u = this.ranges[a + s], f = l + c;
2892
+ let c = this.ranges[l + o], u = this.ranges[l + s], f = a + c;
2907
2893
  if (e <= f) {
2908
- let p = c ? e == l ? -1 : e == f ? 1 : t : t, d = l + i + (p < 0 ? 0 : u);
2894
+ let p = c ? e == a ? -1 : e == f ? 1 : t : t, d = a + i + (p < 0 ? 0 : u);
2909
2895
  if (r)
2910
2896
  return d;
2911
- let g = e == (t < 0 ? l : f) ? null : Ia(a / 3, e - l), m = e == l ? Po : e == f ? Ro : Mn;
2912
- return (t < 0 ? e != l : e != f) && (m |= Bo), new Si(d, m, g);
2897
+ let g = e == (t < 0 ? a : f) ? null : Il(l / 3, e - a), m = e == a ? Po : e == f ? Ro : Mn;
2898
+ return (t < 0 ? e != a : e != f) && (m |= Bo), new Si(d, m, g);
2913
2899
  }
2914
2900
  i += u - c;
2915
2901
  }
@@ -2920,14 +2906,14 @@ class oe {
2920
2906
  */
2921
2907
  touches(e, t) {
2922
2908
  let r = 0, i = wi(t), o = this.inverted ? 2 : 1, s = this.inverted ? 1 : 2;
2923
- for (let a = 0; a < this.ranges.length; a += 3) {
2924
- let l = this.ranges[a] - (this.inverted ? r : 0);
2925
- if (l > e)
2909
+ for (let l = 0; l < this.ranges.length; l += 3) {
2910
+ let a = this.ranges[l] - (this.inverted ? r : 0);
2911
+ if (a > e)
2926
2912
  break;
2927
- let c = this.ranges[a + o], u = l + c;
2928
- if (e <= u && a == i * 3)
2913
+ let c = this.ranges[l + o], u = a + c;
2914
+ if (e <= u && l == i * 3)
2929
2915
  return !0;
2930
- r += this.ranges[a + s] - c;
2916
+ r += this.ranges[l + s] - c;
2931
2917
  }
2932
2918
  return !1;
2933
2919
  }
@@ -2938,8 +2924,8 @@ class oe {
2938
2924
  forEach(e) {
2939
2925
  let t = this.inverted ? 2 : 1, r = this.inverted ? 1 : 2;
2940
2926
  for (let i = 0, o = 0; i < this.ranges.length; i += 3) {
2941
- let s = this.ranges[i], a = s - (this.inverted ? o : 0), l = s + (this.inverted ? 0 : o), c = this.ranges[i + t], u = this.ranges[i + r];
2942
- e(a, a + c, l, l + u), o += u - c;
2927
+ let s = this.ranges[i], l = s - (this.inverted ? o : 0), a = s + (this.inverted ? 0 : o), c = this.ranges[i + t], u = this.ranges[i + r];
2928
+ e(l, l + c, a, a + u), o += u - c;
2943
2929
  }
2944
2930
  }
2945
2931
  /**
@@ -3057,7 +3043,7 @@ class Ze extends Y {
3057
3043
  super(), this.from = e, this.to = t, this.mark = r;
3058
3044
  }
3059
3045
  apply(e) {
3060
- let t = e.slice(this.from, this.to), r = e.resolve(this.from), i = r.node(r.sharedDepth(this.to)), o = new S(Br(t.content, (s, a) => !s.isAtom || !a.type.allowsMarkType(this.mark.type) ? s : s.mark(this.mark.addToSet(s.marks)), i), t.openStart, t.openEnd);
3046
+ let t = e.slice(this.from, this.to), r = e.resolve(this.from), i = r.node(r.sharedDepth(this.to)), o = new S(Br(t.content, (s, l) => !s.isAtom || !l.type.allowsMarkType(this.mark.type) ? s : s.mark(this.mark.addToSet(s.marks)), i), t.openStart, t.openEnd);
3061
3047
  return V.fromReplace(e, this.from, this.to, o);
3062
3048
  }
3063
3049
  invert() {
@@ -3265,8 +3251,8 @@ class _ extends Y {
3265
3251
  of the gap should be moved. `structure` has the same meaning as
3266
3252
  it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
3267
3253
  */
3268
- constructor(e, t, r, i, o, s, a = !1) {
3269
- super(), this.from = e, this.to = t, this.gapFrom = r, this.gapTo = i, this.slice = o, this.insert = s, this.structure = a;
3254
+ constructor(e, t, r, i, o, s, l = !1) {
3255
+ super(), this.from = e, this.to = t, this.gapFrom = r, this.gapTo = i, this.slice = o, this.insert = s, this.structure = l;
3270
3256
  }
3271
3257
  apply(e) {
3272
3258
  if (this.structure && (kr(e, this.from, this.gapFrom) || kr(e, this.gapTo, this.to)))
@@ -3330,7 +3316,7 @@ function kr(n, e, t) {
3330
3316
  }
3331
3317
  return !1;
3332
3318
  }
3333
- function Ra(n, e, t) {
3319
+ function Rl(n, e, t) {
3334
3320
  return (e == 0 || n.canReplace(e, n.childCount)) && (t == n.childCount || n.canReplace(0, t));
3335
3321
  }
3336
3322
  function At(n) {
@@ -3339,33 +3325,33 @@ function At(n) {
3339
3325
  let i = n.$from.node(r), o = n.$from.index(r), s = n.$to.indexAfter(r);
3340
3326
  if (r < n.depth && i.canReplace(o, s, t))
3341
3327
  return r;
3342
- if (r == 0 || i.type.spec.isolating || !Ra(i, o, s))
3328
+ if (r == 0 || i.type.spec.isolating || !Rl(i, o, s))
3343
3329
  break;
3344
3330
  }
3345
3331
  return null;
3346
3332
  }
3347
3333
  function zo(n, e, t = null, r = n) {
3348
- let i = Pa(n, e), o = i && Ba(r, e);
3334
+ let i = Pl(n, e), o = i && Bl(r, e);
3349
3335
  return o ? i.map(Ci).concat({ type: e, attrs: t }).concat(o.map(Ci)) : null;
3350
3336
  }
3351
3337
  function Ci(n) {
3352
3338
  return { type: n, attrs: null };
3353
3339
  }
3354
- function Pa(n, e) {
3340
+ function Pl(n, e) {
3355
3341
  let { parent: t, startIndex: r, endIndex: i } = n, o = t.contentMatchAt(r).findWrapping(e);
3356
3342
  if (!o)
3357
3343
  return null;
3358
3344
  let s = o.length ? o[0] : e;
3359
3345
  return t.canReplaceWith(r, i, s) ? o : null;
3360
3346
  }
3361
- function Ba(n, e) {
3347
+ function Bl(n, e) {
3362
3348
  let { parent: t, startIndex: r, endIndex: i } = n, o = t.child(r), s = e.contentMatch.findWrapping(o.type);
3363
3349
  if (!s)
3364
3350
  return null;
3365
- let l = (s.length ? s[s.length - 1] : e).contentMatch;
3366
- for (let c = r; l && c < i; c++)
3367
- l = l.matchType(t.child(c).type);
3368
- return !l || !l.validEnd ? null : s;
3351
+ let a = (s.length ? s[s.length - 1] : e).contentMatch;
3352
+ for (let c = r; a && c < i; c++)
3353
+ a = a.matchType(t.child(c).type);
3354
+ return !a || !a.validEnd ? null : s;
3369
3355
  }
3370
3356
  function Pe(n, e, t = 1, r) {
3371
3357
  let i = n.resolve(e), o = i.depth - t, s = r && r[r.length - 1] || i.parent;
@@ -3381,14 +3367,14 @@ function Pe(n, e, t = 1, r) {
3381
3367
  if (!f.canReplace(p + 1, f.childCount) || !m.type.validContent(d))
3382
3368
  return !1;
3383
3369
  }
3384
- let a = i.indexAfter(o), l = r && r[0];
3385
- return i.node(o).canReplaceWith(a, a, l ? l.type : i.node(o + 1).type);
3370
+ let l = i.indexAfter(o), a = r && r[0];
3371
+ return i.node(o).canReplaceWith(l, l, a ? a.type : i.node(o + 1).type);
3386
3372
  }
3387
3373
  function ut(n, e) {
3388
3374
  let t = n.resolve(e), r = t.index();
3389
3375
  return Fo(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(r, r + 1);
3390
3376
  }
3391
- function za(n, e) {
3377
+ function zl(n, e) {
3392
3378
  e.content.size || n.type.compatibleContent(e.type);
3393
3379
  let t = n.contentMatchAt(n.childCount), { linebreakReplacement: r } = n.type.schema;
3394
3380
  for (let i = 0; i < e.childCount; i++) {
@@ -3399,20 +3385,20 @@ function za(n, e) {
3399
3385
  return t.validEnd;
3400
3386
  }
3401
3387
  function Fo(n, e) {
3402
- return !!(n && e && !n.isLeaf && za(n, e));
3388
+ return !!(n && e && !n.isLeaf && zl(n, e));
3403
3389
  }
3404
3390
  function Un(n, e, t = -1) {
3405
3391
  let r = n.resolve(e);
3406
3392
  for (let i = r.depth; ; i--) {
3407
- let o, s, a = r.index(i);
3408
- if (i == r.depth ? (o = r.nodeBefore, s = r.nodeAfter) : t > 0 ? (o = r.node(i + 1), a++, s = r.node(i).maybeChild(a)) : (o = r.node(i).maybeChild(a - 1), s = r.node(i + 1)), o && !o.isTextblock && Fo(o, s) && r.node(i).canReplace(a, a + 1))
3393
+ let o, s, l = r.index(i);
3394
+ if (i == r.depth ? (o = r.nodeBefore, s = r.nodeAfter) : t > 0 ? (o = r.node(i + 1), l++, s = r.node(i).maybeChild(l)) : (o = r.node(i).maybeChild(l - 1), s = r.node(i + 1)), o && !o.isTextblock && Fo(o, s) && r.node(i).canReplace(l, l + 1))
3409
3395
  return e;
3410
3396
  if (i == 0)
3411
3397
  break;
3412
3398
  e = t < 0 ? r.before(i) : r.after(i);
3413
3399
  }
3414
3400
  }
3415
- function Fa(n, e, t) {
3401
+ function Fl(n, e, t) {
3416
3402
  let r = n.resolve(e);
3417
3403
  if (!t.content.size)
3418
3404
  return e;
@@ -3421,15 +3407,15 @@ function Fa(n, e, t) {
3421
3407
  i = i.firstChild.content;
3422
3408
  for (let o = 1; o <= (t.openStart == 0 && t.size ? 2 : 1); o++)
3423
3409
  for (let s = r.depth; s >= 0; s--) {
3424
- let a = s == r.depth ? 0 : r.pos <= (r.start(s + 1) + r.end(s + 1)) / 2 ? -1 : 1, l = r.index(s) + (a > 0 ? 1 : 0), c = r.node(s), u = !1;
3410
+ let l = s == r.depth ? 0 : r.pos <= (r.start(s + 1) + r.end(s + 1)) / 2 ? -1 : 1, a = r.index(s) + (l > 0 ? 1 : 0), c = r.node(s), u = !1;
3425
3411
  if (o == 1)
3426
- u = c.canReplace(l, l, i);
3412
+ u = c.canReplace(a, a, i);
3427
3413
  else {
3428
- let f = c.contentMatchAt(l).findWrapping(i.firstChild.type);
3429
- u = f && c.canReplaceWith(l, l, f[0]);
3414
+ let f = c.contentMatchAt(a).findWrapping(i.firstChild.type);
3415
+ u = f && c.canReplaceWith(a, a, f[0]);
3430
3416
  }
3431
3417
  if (u)
3432
- return a == 0 ? r.pos : a < 0 ? r.before(s + 1) : r.after(s + 1);
3418
+ return l == 0 ? r.pos : l < 0 ? r.before(s + 1) : r.after(s + 1);
3433
3419
  }
3434
3420
  return null;
3435
3421
  }
@@ -3437,12 +3423,12 @@ function zr(n, e, t = e, r = S.empty) {
3437
3423
  if (e == t && !r.size)
3438
3424
  return null;
3439
3425
  let i = n.resolve(e), o = n.resolve(t);
3440
- return La(i, o, r) ? new ie(e, t, r) : new $a(i, o, r).fit();
3426
+ return Ll(i, o, r) ? new ie(e, t, r) : new $l(i, o, r).fit();
3441
3427
  }
3442
- function La(n, e, t) {
3428
+ function Ll(n, e, t) {
3443
3429
  return !t.openStart && !t.openEnd && n.start() == e.start() && n.parent.canReplace(n.index(), e.index(), t.content);
3444
3430
  }
3445
- class $a {
3431
+ class $l {
3446
3432
  constructor(e, t, r) {
3447
3433
  this.$from = e, this.$to = t, this.unplaced = r, this.frontier = [], this.placed = k.empty;
3448
3434
  for (let i = 0; i <= e.depth; i++) {
@@ -3466,11 +3452,11 @@ class $a {
3466
3452
  let e = this.mustMoveInline(), t = this.placed.size - this.depth - this.$from.depth, r = this.$from, i = this.close(e < 0 ? this.$to : r.doc.resolve(e));
3467
3453
  if (!i)
3468
3454
  return null;
3469
- let o = this.placed, s = r.depth, a = i.depth;
3470
- for (; s && a && o.childCount == 1; )
3471
- o = o.firstChild.content, s--, a--;
3472
- let l = new S(o, s, a);
3473
- return e > -1 ? new _(r.pos, e, this.$to.pos, this.$to.end(), l, t) : l.size || r.pos != this.$to.pos ? new ie(r.pos, i.pos, l) : null;
3455
+ let o = this.placed, s = r.depth, l = i.depth;
3456
+ for (; s && l && o.childCount == 1; )
3457
+ o = o.firstChild.content, s--, l--;
3458
+ let a = new S(o, s, l);
3459
+ return e > -1 ? new _(r.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || r.pos != this.$to.pos ? new ie(r.pos, i.pos, a) : null;
3474
3460
  }
3475
3461
  // Find a position on the start spine of `this.unplaced` that has
3476
3462
  // content that can be moved somewhere on the frontier. Returns two
@@ -3490,12 +3476,12 @@ class $a {
3490
3476
  let i, o = null;
3491
3477
  r ? (o = or(this.unplaced.content, r - 1).firstChild, i = o.content) : i = this.unplaced.content;
3492
3478
  let s = i.firstChild;
3493
- for (let a = this.depth; a >= 0; a--) {
3494
- let { type: l, match: c } = this.frontier[a], u, f = null;
3495
- if (t == 1 && (s ? c.matchType(s.type) || (f = c.fillBefore(k.from(s), !1)) : o && l.compatibleContent(o.type)))
3496
- return { sliceDepth: r, frontierDepth: a, parent: o, inject: f };
3479
+ for (let l = this.depth; l >= 0; l--) {
3480
+ let { type: a, match: c } = this.frontier[l], u, f = null;
3481
+ if (t == 1 && (s ? c.matchType(s.type) || (f = c.fillBefore(k.from(s), !1)) : o && a.compatibleContent(o.type)))
3482
+ return { sliceDepth: r, frontierDepth: l, parent: o, inject: f };
3497
3483
  if (t == 2 && s && (u = c.findWrapping(s.type)))
3498
- return { sliceDepth: r, frontierDepth: a, parent: o, wrap: u };
3484
+ return { sliceDepth: r, frontierDepth: l, parent: o, wrap: u };
3499
3485
  if (o && c.matchType(o.type))
3500
3486
  break;
3501
3487
  }
@@ -3522,22 +3508,22 @@ class $a {
3522
3508
  if (o)
3523
3509
  for (let m = 0; m < o.length; m++)
3524
3510
  this.openFrontierNode(o[m]);
3525
- let s = this.unplaced, a = r ? r.content : s.content, l = s.openStart - e, c = 0, u = [], { match: f, type: p } = this.frontier[t];
3511
+ let s = this.unplaced, l = r ? r.content : s.content, a = s.openStart - e, c = 0, u = [], { match: f, type: p } = this.frontier[t];
3526
3512
  if (i) {
3527
3513
  for (let m = 0; m < i.childCount; m++)
3528
3514
  u.push(i.child(m));
3529
3515
  f = f.matchFragment(i);
3530
3516
  }
3531
- let d = a.size + e - (s.content.size - s.openEnd);
3532
- for (; c < a.childCount; ) {
3533
- let m = a.child(c), y = f.matchType(m.type);
3517
+ let d = l.size + e - (s.content.size - s.openEnd);
3518
+ for (; c < l.childCount; ) {
3519
+ let m = l.child(c), y = f.matchType(m.type);
3534
3520
  if (!y)
3535
3521
  break;
3536
- c++, (c > 1 || l == 0 || m.content.size) && (f = y, u.push(Lo(m.mark(p.allowedMarks(m.marks)), c == 1 ? l : 0, c == a.childCount ? d : -1)));
3522
+ c++, (c > 1 || a == 0 || m.content.size) && (f = y, u.push(Lo(m.mark(p.allowedMarks(m.marks)), c == 1 ? a : 0, c == l.childCount ? d : -1)));
3537
3523
  }
3538
- let g = c == a.childCount;
3524
+ let g = c == l.childCount;
3539
3525
  g || (d = -1), this.placed = Ft(this.placed, t, k.from(u)), this.frontier[t].match = f, g && d < 0 && r && r.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
3540
- for (let m = 0, y = a; m < d; m++) {
3526
+ for (let m = 0, y = l; m < d; m++) {
3541
3527
  let b = y.lastChild;
3542
3528
  this.frontier.push({ type: b.type, match: b.contentMatchAt(b.childCount) }), y = b.content;
3543
3529
  }
@@ -3558,8 +3544,8 @@ class $a {
3558
3544
  e: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
3559
3545
  let { match: r, type: i } = this.frontier[t], o = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), s = sr(e, t, i, r, o);
3560
3546
  if (s) {
3561
- for (let a = t - 1; a >= 0; a--) {
3562
- let { match: l, type: c } = this.frontier[a], u = sr(e, a, c, l, !0);
3547
+ for (let l = t - 1; l >= 0; l--) {
3548
+ let { match: a, type: c } = this.frontier[l], u = sr(e, l, c, a, !0);
3563
3549
  if (!u || u.childCount)
3564
3550
  continue e;
3565
3551
  }
@@ -3610,10 +3596,10 @@ function sr(n, e, t, r, i) {
3610
3596
  let o = n.node(e), s = i ? n.indexAfter(e) : n.index(e);
3611
3597
  if (s == o.childCount && !t.compatibleContent(o.type))
3612
3598
  return null;
3613
- let a = r.fillBefore(o.content, !0, s);
3614
- return a && !Va(t, o.content, s) ? a : null;
3599
+ let l = r.fillBefore(o.content, !0, s);
3600
+ return l && !Vl(t, o.content, s) ? l : null;
3615
3601
  }
3616
- function Va(n, e, t) {
3602
+ function Vl(n, e, t) {
3617
3603
  for (let r = t; r < e.childCount; r++)
3618
3604
  if (!n.allowsMarks(e.child(r).marks))
3619
3605
  return !0;
@@ -3700,7 +3686,7 @@ Gt = function n(e) {
3700
3686
  Gt.prototype = Object.create(Error.prototype);
3701
3687
  Gt.prototype.constructor = Gt;
3702
3688
  Gt.prototype.name = "TransformError";
3703
- const ar = /* @__PURE__ */ Object.create(null);
3689
+ const lr = /* @__PURE__ */ Object.create(null);
3704
3690
  class D {
3705
3691
  /**
3706
3692
  Initialize a selection with the head and anchor and ranges. If no
@@ -3708,7 +3694,7 @@ class D {
3708
3694
  `$head`.
3709
3695
  */
3710
3696
  constructor(e, t, r) {
3711
- this.$anchor = e, this.$head = t, this.ranges = r || [new ja(e.min(t), e.max(t))];
3697
+ this.$anchor = e, this.$head = t, this.ranges = r || [new jl(e.min(t), e.max(t))];
3712
3698
  }
3713
3699
  /**
3714
3700
  The selection's anchor, as an unresolved position.
@@ -3768,12 +3754,12 @@ class D {
3768
3754
  */
3769
3755
  replace(e, t = S.empty) {
3770
3756
  let r = t.content.lastChild, i = null;
3771
- for (let a = 0; a < t.openEnd; a++)
3757
+ for (let l = 0; l < t.openEnd; l++)
3772
3758
  i = r, r = r.lastChild;
3773
3759
  let o = e.steps.length, s = this.ranges;
3774
- for (let a = 0; a < s.length; a++) {
3775
- let { $from: l, $to: c } = s[a], u = e.mapping.slice(o);
3776
- e.replaceRange(u.map(l.pos), u.map(c.pos), a ? S.empty : t), a == 0 && Ti(e, o, (r ? r.isInline : i && i.isTextblock) ? -1 : 1);
3760
+ for (let l = 0; l < s.length; l++) {
3761
+ let { $from: a, $to: c } = s[l], u = e.mapping.slice(o);
3762
+ e.replaceRange(u.map(a.pos), u.map(c.pos), l ? S.empty : t), l == 0 && Ti(e, o, (r ? r.isInline : i && i.isTextblock) ? -1 : 1);
3777
3763
  }
3778
3764
  }
3779
3765
  /**
@@ -3783,7 +3769,7 @@ class D {
3783
3769
  replaceWith(e, t) {
3784
3770
  let r = e.steps.length, i = this.ranges;
3785
3771
  for (let o = 0; o < i.length; o++) {
3786
- let { $from: s, $to: a } = i[o], l = e.mapping.slice(r), c = l.map(s.pos), u = l.map(a.pos);
3772
+ let { $from: s, $to: l } = i[o], a = e.mapping.slice(r), c = a.map(s.pos), u = a.map(l.pos);
3787
3773
  o ? e.deleteRange(c, u) : (e.replaceRangeWith(c, u, t), Ti(e, r, t.isInline ? -1 : 1));
3788
3774
  }
3789
3775
  }
@@ -3811,7 +3797,7 @@ class D {
3811
3797
  negative, it will search backwards first.
3812
3798
  */
3813
3799
  static near(e, t = 1) {
3814
- return this.findFrom(e, t) || this.findFrom(e, -t) || new ae(e.node(0));
3800
+ return this.findFrom(e, t) || this.findFrom(e, -t) || new le(e.node(0));
3815
3801
  }
3816
3802
  /**
3817
3803
  Find the cursor or leaf node selection closest to the start of
@@ -3820,14 +3806,14 @@ class D {
3820
3806
  exists.
3821
3807
  */
3822
3808
  static atStart(e) {
3823
- return xt(e, e, 0, 0, 1) || new ae(e);
3809
+ return xt(e, e, 0, 0, 1) || new le(e);
3824
3810
  }
3825
3811
  /**
3826
3812
  Find the cursor or leaf node selection closest to the end of the
3827
3813
  given document.
3828
3814
  */
3829
3815
  static atEnd(e) {
3830
- return xt(e, e, e.content.size, e.childCount, -1) || new ae(e);
3816
+ return xt(e, e, e.content.size, e.childCount, -1) || new le(e);
3831
3817
  }
3832
3818
  /**
3833
3819
  Deserialize the JSON representation of a selection. Must be
@@ -3836,7 +3822,7 @@ class D {
3836
3822
  static fromJSON(e, t) {
3837
3823
  if (!t || !t.type)
3838
3824
  throw new RangeError("Invalid input for Selection.fromJSON");
3839
- let r = ar[t.type];
3825
+ let r = lr[t.type];
3840
3826
  if (!r)
3841
3827
  throw new RangeError(`No selection type ${t.type} defined`);
3842
3828
  return r.fromJSON(e, t);
@@ -3848,9 +3834,9 @@ class D {
3848
3834
  clash with classes from other modules.
3849
3835
  */
3850
3836
  static jsonID(e, t) {
3851
- if (e in ar)
3837
+ if (e in lr)
3852
3838
  throw new RangeError("Duplicate use of selection JSON ID " + e);
3853
- return ar[e] = t, t.prototype.jsonID = e, t;
3839
+ return lr[e] = t, t.prototype.jsonID = e, t;
3854
3840
  }
3855
3841
  /**
3856
3842
  Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
@@ -3866,7 +3852,7 @@ class D {
3866
3852
  }
3867
3853
  }
3868
3854
  D.prototype.visible = !0;
3869
- class ja {
3855
+ class jl {
3870
3856
  /**
3871
3857
  Create a range.
3872
3858
  */
@@ -4023,7 +4009,7 @@ class Fr {
4023
4009
  return r && O.isSelectable(r) ? new O(t) : D.near(t);
4024
4010
  }
4025
4011
  }
4026
- class ae extends D {
4012
+ class le extends D {
4027
4013
  /**
4028
4014
  Create an all-selection over the given document.
4029
4015
  */
@@ -4045,41 +4031,41 @@ class ae extends D {
4045
4031
  @internal
4046
4032
  */
4047
4033
  static fromJSON(e) {
4048
- return new ae(e);
4034
+ return new le(e);
4049
4035
  }
4050
4036
  map(e) {
4051
- return new ae(e);
4037
+ return new le(e);
4052
4038
  }
4053
4039
  eq(e) {
4054
- return e instanceof ae;
4040
+ return e instanceof le;
4055
4041
  }
4056
4042
  getBookmark() {
4057
- return Wa;
4043
+ return Wl;
4058
4044
  }
4059
4045
  }
4060
- D.jsonID("all", ae);
4061
- const Wa = {
4046
+ D.jsonID("all", le);
4047
+ const Wl = {
4062
4048
  map() {
4063
4049
  return this;
4064
4050
  },
4065
4051
  resolve(n) {
4066
- return new ae(n);
4052
+ return new le(n);
4067
4053
  }
4068
4054
  };
4069
4055
  function xt(n, e, t, r, i, o = !1) {
4070
4056
  if (e.inlineContent)
4071
4057
  return A.create(n, t);
4072
4058
  for (let s = r - (i > 0 ? 0 : 1); i > 0 ? s < e.childCount : s >= 0; s += i) {
4073
- let a = e.child(s);
4074
- if (a.isAtom) {
4075
- if (!o && O.isSelectable(a))
4076
- return O.create(n, t - (i < 0 ? a.nodeSize : 0));
4059
+ let l = e.child(s);
4060
+ if (l.isAtom) {
4061
+ if (!o && O.isSelectable(l))
4062
+ return O.create(n, t - (i < 0 ? l.nodeSize : 0));
4077
4063
  } else {
4078
- let l = xt(n, a, t + i, i < 0 ? a.childCount : 0, i, o);
4079
- if (l)
4080
- return l;
4064
+ let a = xt(n, l, t + i, i < 0 ? l.childCount : 0, i, o);
4065
+ if (a)
4066
+ return a;
4081
4067
  }
4082
- t += a.nodeSize * i;
4068
+ t += l.nodeSize * i;
4083
4069
  }
4084
4070
  return null;
4085
4071
  }
@@ -4091,7 +4077,7 @@ function Ti(n, e, t) {
4091
4077
  if (!(i instanceof ie || i instanceof _))
4092
4078
  return;
4093
4079
  let o = n.mapping.maps[r], s;
4094
- o.forEach((a, l, c, u) => {
4080
+ o.forEach((l, a, c, u) => {
4095
4081
  s == null && (s = u);
4096
4082
  }), n.setSelection(D.near(n.doc.resolve(s), t));
4097
4083
  }
@@ -4153,9 +4139,9 @@ class Te {
4153
4139
  return e[this.key];
4154
4140
  }
4155
4141
  }
4156
- const lr = /* @__PURE__ */ Object.create(null);
4142
+ const ar = /* @__PURE__ */ Object.create(null);
4157
4143
  function Vo(n) {
4158
- return n in lr ? n + "$" + ++lr[n] : (lr[n] = 0, n + "$");
4144
+ return n in ar ? n + "$" + ++ar[n] : (ar[n] = 0, n + "$");
4159
4145
  }
4160
4146
  class ye {
4161
4147
  /**
@@ -4184,14 +4170,14 @@ const ft = function(n) {
4184
4170
  return e;
4185
4171
  }, jo = function(n, e, t, r) {
4186
4172
  return t && (Ai(n, e, t, r, -1) || Ai(n, e, t, r, 1));
4187
- }, Ha = /^(img|br|input|textarea|hr)$/i;
4173
+ }, Hl = /^(img|br|input|textarea|hr)$/i;
4188
4174
  function Ai(n, e, t, r, i) {
4189
4175
  for (var o; ; ) {
4190
4176
  if (n == t && e == r)
4191
4177
  return !0;
4192
4178
  if (e == (i < 0 ? 0 : Fn(n))) {
4193
4179
  let s = n.parentNode;
4194
- if (!s || s.nodeType != 1 || Lr(n) || Ha.test(n.nodeName) || n.contentEditable == "false")
4180
+ if (!s || s.nodeType != 1 || Lr(n) || Hl.test(n.nodeName) || n.contentEditable == "false")
4195
4181
  return !1;
4196
4182
  e = ft(n) + (i < 0 ? 0 : 1), n = s;
4197
4183
  } else if (n.nodeType == 1) {
@@ -4210,7 +4196,7 @@ function Ai(n, e, t, r, i) {
4210
4196
  function Fn(n) {
4211
4197
  return n.nodeType == 3 ? n.nodeValue.length : n.childNodes.length;
4212
4198
  }
4213
- function Ja(n, e, t) {
4199
+ function Jl(n, e, t) {
4214
4200
  for (let r = e == 0, i = e == Fn(n); r || i; ) {
4215
4201
  if (n == t)
4216
4202
  return !0;
@@ -4235,22 +4221,22 @@ function Ho(n, e) {
4235
4221
  }
4236
4222
  const Oe = typeof navigator < "u" ? navigator : null, Ni = typeof document < "u" ? document : null, je = Oe && Oe.userAgent || "", wr = /Edge\/(\d+)/.exec(je), Jo = /MSIE \d/.exec(je), Sr = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(je), rn = !!(Jo || Sr || wr), qo = Jo ? document.documentMode : Sr ? +Sr[1] : wr ? +wr[1] : 0, Yn = !rn && /gecko\/(\d+)/i.test(je);
4237
4223
  Yn && +(/Firefox\/(\d+)/.exec(je) || [0, 0])[1];
4238
- const Cr = !rn && /Chrome\/(\d+)/.exec(je), We = !!Cr, Ko = Cr ? +Cr[1] : 0, dt = !rn && !!Oe && /Apple Computer/.test(Oe.vendor), $r = dt && (/Mobile\/\w+/.test(je) || !!Oe && Oe.maxTouchPoints > 2), de = $r || (Oe ? /Mac/.test(Oe.platform) : !1), qa = Oe ? /Win/.test(Oe.platform) : !1, on = /Android \d/.test(je), Vr = !!Ni && "webkitFontSmoothing" in Ni.documentElement.style, Ka = Vr ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
4239
- function Ua(n, e = null) {
4224
+ const Cr = !rn && /Chrome\/(\d+)/.exec(je), We = !!Cr, Ko = Cr ? +Cr[1] : 0, dt = !rn && !!Oe && /Apple Computer/.test(Oe.vendor), $r = dt && (/Mobile\/\w+/.test(je) || !!Oe && Oe.maxTouchPoints > 2), de = $r || (Oe ? /Mac/.test(Oe.platform) : !1), ql = Oe ? /Win/.test(Oe.platform) : !1, on = /Android \d/.test(je), Vr = !!Ni && "webkitFontSmoothing" in Ni.documentElement.style, Kl = Vr ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
4225
+ function Ul(n, e = null) {
4240
4226
  let t = n.domSelectionRange(), r = n.state.doc;
4241
4227
  if (!t.focusNode)
4242
4228
  return null;
4243
4229
  let i = n.docView.nearestDesc(t.focusNode), o = i && i.size == 0, s = n.docView.posFromDOM(t.focusNode, t.focusOffset, 1);
4244
4230
  if (s < 0)
4245
4231
  return null;
4246
- let a = r.resolve(s), l, c;
4232
+ let l = r.resolve(s), a, c;
4247
4233
  if (Wo(t)) {
4248
- for (l = s; i && !i.node; )
4234
+ for (a = s; i && !i.node; )
4249
4235
  i = i.parent;
4250
4236
  let f = i.node;
4251
- if (i && f.isAtom && O.isSelectable(f) && i.parent && !(f.isInline && Ja(t.focusNode, t.focusOffset, i.dom))) {
4237
+ if (i && f.isAtom && O.isSelectable(f) && i.parent && !(f.isInline && Jl(t.focusNode, t.focusOffset, i.dom))) {
4252
4238
  let p = i.posBefore;
4253
- c = new O(s == p ? a : r.resolve(p));
4239
+ c = new O(s == p ? l : r.resolve(p));
4254
4240
  }
4255
4241
  } else {
4256
4242
  if (t instanceof n.dom.ownerDocument.defaultView.Selection && t.rangeCount > 1) {
@@ -4261,25 +4247,25 @@ function Ua(n, e = null) {
4261
4247
  }
4262
4248
  if (f < 0)
4263
4249
  return null;
4264
- [l, s] = p == n.state.selection.anchor ? [p, f] : [f, p], a = r.resolve(s);
4250
+ [a, s] = p == n.state.selection.anchor ? [p, f] : [f, p], l = r.resolve(s);
4265
4251
  } else
4266
- l = n.docView.posFromDOM(t.anchorNode, t.anchorOffset, 1);
4267
- if (l < 0)
4252
+ a = n.docView.posFromDOM(t.anchorNode, t.anchorOffset, 1);
4253
+ if (a < 0)
4268
4254
  return null;
4269
4255
  }
4270
- let u = r.resolve(l);
4256
+ let u = r.resolve(a);
4271
4257
  if (!c) {
4272
- let f = e == "pointer" || n.state.selection.head < a.pos && !o ? 1 : -1;
4273
- c = Go(n, u, a, f);
4258
+ let f = e == "pointer" || n.state.selection.head < l.pos && !o ? 1 : -1;
4259
+ c = Go(n, u, l, f);
4274
4260
  }
4275
4261
  return c;
4276
4262
  }
4277
4263
  function Uo(n) {
4278
- return n.editable ? n.hasFocus() : Qa(n) && document.activeElement && document.activeElement.contains(n.dom);
4264
+ return n.editable ? n.hasFocus() : Ql(n) && document.activeElement && document.activeElement.contains(n.dom);
4279
4265
  }
4280
4266
  function jr(n, e = !1) {
4281
4267
  let t = n.state.selection;
4282
- if (Xa(n, t), !!Uo(n)) {
4268
+ if (Xl(n, t), !!Uo(n)) {
4283
4269
  if (!e && n.input.mouseDown && n.input.mouseDown.allowDefault && We) {
4284
4270
  let r = n.domSelectionRange(), i = n.domObserver.currentSelection;
4285
4271
  if (r.anchorNode && i.anchorNode && jo(r.anchorNode, r.anchorOffset, i.anchorNode, i.anchorOffset)) {
@@ -4288,10 +4274,10 @@ function jr(n, e = !1) {
4288
4274
  }
4289
4275
  }
4290
4276
  if (n.domObserver.disconnectSelection(), n.cursorWrapper)
4291
- Ya(n);
4277
+ Yl(n);
4292
4278
  else {
4293
4279
  let { anchor: r, head: i } = t, o, s;
4294
- Ii && !(t instanceof A) && (t.$from.parent.inlineContent || (o = Di(n, t.from)), !t.empty && !t.$from.parent.inlineContent && (s = Di(n, t.to))), n.docView.setSelection(r, i, n, e), Ii && (o && Ri(o), s && Ri(s)), t.visible ? n.dom.classList.remove("ProseMirror-hideselection") : (n.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Ga(n));
4280
+ Ii && !(t instanceof A) && (t.$from.parent.inlineContent || (o = Di(n, t.from)), !t.empty && !t.$from.parent.inlineContent && (s = Di(n, t.to))), n.docView.setSelection(r, i, n, e), Ii && (o && Ri(o), s && Ri(s)), t.visible ? n.dom.classList.remove("ProseMirror-hideselection") : (n.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Gl(n));
4295
4281
  }
4296
4282
  n.domObserver.setCurSelection(), n.domObserver.connectSelection();
4297
4283
  }
@@ -4314,7 +4300,7 @@ function cr(n) {
4314
4300
  function Ri(n) {
4315
4301
  n.contentEditable = "false", n.wasDraggable && (n.draggable = !0, n.wasDraggable = null);
4316
4302
  }
4317
- function Ga(n) {
4303
+ function Gl(n) {
4318
4304
  let e = n.dom.ownerDocument;
4319
4305
  e.removeEventListener("selectionchange", n.input.hideSelectionGuard);
4320
4306
  let t = n.domSelectionRange(), r = t.anchorNode, i = t.anchorOffset;
@@ -4324,14 +4310,14 @@ function Ga(n) {
4324
4310
  }, 20));
4325
4311
  });
4326
4312
  }
4327
- function Ya(n) {
4313
+ function Yl(n) {
4328
4314
  let e = n.domSelection(), t = document.createRange();
4329
4315
  if (!e)
4330
4316
  return;
4331
4317
  let r = n.cursorWrapper.dom, i = r.nodeName == "IMG";
4332
4318
  i ? t.setStart(r.parentNode, ft(r) + 1) : t.setStart(r, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t), !i && !n.state.selection.visible && rn && qo <= 11 && (r.disabled = !0, r.disabled = !1);
4333
4319
  }
4334
- function Xa(n, e) {
4320
+ function Xl(n, e) {
4335
4321
  if (e instanceof O) {
4336
4322
  let t = n.docView.descAt(e.from);
4337
4323
  t != n.lastSelectedViewDesc && (Pi(n), t && t.selectNode(), n.lastSelectedViewDesc = t);
@@ -4344,7 +4330,7 @@ function Pi(n) {
4344
4330
  function Go(n, e, t, r) {
4345
4331
  return n.someProp("createSelectionBetween", (i) => i(n, e, t)) || A.between(e, t, r);
4346
4332
  }
4347
- function Qa(n) {
4333
+ function Ql(n) {
4348
4334
  let e = n.domSelectionRange();
4349
4335
  if (!e.anchorNode)
4350
4336
  return !1;
@@ -4378,8 +4364,8 @@ function Bi(n, e, t) {
4378
4364
  let i = r.$head, o = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, s;
4379
4365
  if (!o || o.isText)
4380
4366
  return !1;
4381
- let a = e < 0 ? i.pos - o.nodeSize : i.pos;
4382
- return o.isAtom || (s = n.docView.descAt(a)) && !s.contentDOM ? O.isSelectable(o) ? Le(n, new O(e < 0 ? n.state.doc.resolve(i.pos - o.nodeSize) : i)) : Vr ? Le(n, new A(n.state.doc.resolve(e < 0 ? a : a + o.nodeSize))) : !1 : !1;
4367
+ let l = e < 0 ? i.pos - o.nodeSize : i.pos;
4368
+ return o.isAtom || (s = n.docView.descAt(l)) && !s.contentDOM ? O.isSelectable(o) ? Le(n, new O(e < 0 ? n.state.doc.resolve(i.pos - o.nodeSize) : i)) : Vr ? Le(n, new A(n.state.doc.resolve(e < 0 ? l : l + o.nodeSize))) : !1 : !1;
4383
4369
  }
4384
4370
  } else return !1;
4385
4371
  else {
@@ -4399,9 +4385,9 @@ function jt(n, e) {
4399
4385
  return t && t.size == 0 && (e < 0 || n.nextSibling || n.nodeName != "BR");
4400
4386
  }
4401
4387
  function vt(n, e) {
4402
- return e < 0 ? Za(n) : _a(n);
4388
+ return e < 0 ? Zl(n) : _l(n);
4403
4389
  }
4404
- function Za(n) {
4390
+ function Zl(n) {
4405
4391
  let e = n.domSelectionRange(), t = e.focusNode, r = e.focusOffset;
4406
4392
  if (!t)
4407
4393
  return;
@@ -4411,11 +4397,11 @@ function Za(n) {
4411
4397
  if (t.nodeType != 1)
4412
4398
  break;
4413
4399
  {
4414
- let a = t.childNodes[r - 1];
4415
- if (jt(a, -1))
4400
+ let l = t.childNodes[r - 1];
4401
+ if (jt(l, -1))
4416
4402
  i = t, o = --r;
4417
- else if (a.nodeType == 3)
4418
- t = a, r = t.nodeValue.length;
4403
+ else if (l.nodeType == 3)
4404
+ t = l, r = t.nodeValue.length;
4419
4405
  else
4420
4406
  break;
4421
4407
  }
@@ -4423,11 +4409,11 @@ function Za(n) {
4423
4409
  if (Yo(t))
4424
4410
  break;
4425
4411
  {
4426
- let a = t.previousSibling;
4427
- for (; a && jt(a, -1); )
4428
- i = t.parentNode, o = ft(a), a = a.previousSibling;
4429
- if (a)
4430
- t = a, r = Ln(t);
4412
+ let l = t.previousSibling;
4413
+ for (; l && jt(l, -1); )
4414
+ i = t.parentNode, o = ft(l), l = l.previousSibling;
4415
+ if (l)
4416
+ t = l, r = Ln(t);
4431
4417
  else {
4432
4418
  if (t = t.parentNode, t == n.dom)
4433
4419
  break;
@@ -4437,7 +4423,7 @@ function Za(n) {
4437
4423
  }
4438
4424
  s ? Er(n, t, r) : i && Er(n, i, o);
4439
4425
  }
4440
- function _a(n) {
4426
+ function _l(n) {
4441
4427
  let e = n.domSelectionRange(), t = e.focusNode, r = e.focusOffset;
4442
4428
  if (!t)
4443
4429
  return;
@@ -4446,8 +4432,8 @@ function _a(n) {
4446
4432
  if (r < i) {
4447
4433
  if (t.nodeType != 1)
4448
4434
  break;
4449
- let a = t.childNodes[r];
4450
- if (jt(a, 1))
4435
+ let l = t.childNodes[r];
4436
+ if (jt(l, 1))
4451
4437
  o = t, s = ++r;
4452
4438
  else
4453
4439
  break;
@@ -4455,11 +4441,11 @@ function _a(n) {
4455
4441
  if (Yo(t))
4456
4442
  break;
4457
4443
  {
4458
- let a = t.nextSibling;
4459
- for (; a && jt(a, 1); )
4460
- o = a.parentNode, s = ft(a) + 1, a = a.nextSibling;
4461
- if (a)
4462
- t = a, r = 0, i = Ln(t);
4444
+ let l = t.nextSibling;
4445
+ for (; l && jt(l, 1); )
4446
+ o = l.parentNode, s = ft(l) + 1, l = l.nextSibling;
4447
+ if (l)
4448
+ t = l, r = 0, i = Ln(t);
4463
4449
  else {
4464
4450
  if (t = t.parentNode, t == n.dom)
4465
4451
  break;
@@ -4473,7 +4459,7 @@ function Yo(n) {
4473
4459
  let e = n.pmViewDesc;
4474
4460
  return e && e.node && e.node.isBlock;
4475
4461
  }
4476
- function el(n, e) {
4462
+ function ea(n, e) {
4477
4463
  for (; n && e == n.childNodes.length && !Lr(n); )
4478
4464
  e = ft(n) + 1, n = n.parentNode;
4479
4465
  for (; n && e < n.childNodes.length; ) {
@@ -4485,7 +4471,7 @@ function el(n, e) {
4485
4471
  n = t, e = 0;
4486
4472
  }
4487
4473
  }
4488
- function tl(n, e) {
4474
+ function ta(n, e) {
4489
4475
  for (; n && !e && !Lr(n); )
4490
4476
  e = ft(n), n = n.parentNode;
4491
4477
  for (; n && e; ) {
@@ -4500,7 +4486,7 @@ function tl(n, e) {
4500
4486
  function Er(n, e, t) {
4501
4487
  if (e.nodeType != 3) {
4502
4488
  let o, s;
4503
- (s = el(e, t)) ? (e = s, t = 0) : (o = tl(e, t)) && (e = o, t = o.nodeValue.length);
4489
+ (s = ea(e, t)) ? (e = s, t = 0) : (o = ta(e, t)) && (e = o, t = o.nodeValue.length);
4504
4490
  }
4505
4491
  let r = n.domSelection();
4506
4492
  if (!r)
@@ -4517,7 +4503,7 @@ function Er(n, e, t) {
4517
4503
  }
4518
4504
  function zi(n, e) {
4519
4505
  let t = n.state.doc.resolve(e);
4520
- if (!(We || qa) && t.parent.inlineContent) {
4506
+ if (!(We || ql) && t.parent.inlineContent) {
4521
4507
  let i = n.coordsAtPos(e);
4522
4508
  if (e > t.start()) {
4523
4509
  let o = n.coordsAtPos(e - 1), s = (o.top + o.bottom) / 2;
@@ -4543,8 +4529,8 @@ function Fi(n, e, t) {
4543
4529
  return Le(n, s);
4544
4530
  }
4545
4531
  if (!i.parent.inlineContent) {
4546
- let s = e < 0 ? i : o, a = r instanceof ae ? D.near(s, e) : D.findFrom(s, e);
4547
- return a ? Le(n, a) : !1;
4532
+ let s = e < 0 ? i : o, l = r instanceof le ? D.near(s, e) : D.findFrom(s, e);
4533
+ return l ? Le(n, l) : !1;
4548
4534
  }
4549
4535
  return !1;
4550
4536
  }
@@ -4568,7 +4554,7 @@ function Li(n, e) {
4568
4554
  function $i(n, e, t) {
4569
4555
  n.domObserver.stop(), e.contentEditable = t, n.domObserver.start();
4570
4556
  }
4571
- function nl(n) {
4557
+ function na(n) {
4572
4558
  if (!dt || n.state.selection.$head.parentOffset > 0)
4573
4559
  return !1;
4574
4560
  let { focusNode: e, focusOffset: t } = n.domSelectionRange();
@@ -4578,12 +4564,12 @@ function nl(n) {
4578
4564
  }
4579
4565
  return !1;
4580
4566
  }
4581
- function rl(n) {
4567
+ function ra(n) {
4582
4568
  let e = "";
4583
4569
  return n.ctrlKey && (e += "c"), n.metaKey && (e += "m"), n.altKey && (e += "a"), n.shiftKey && (e += "s"), e;
4584
4570
  }
4585
- function il(n, e) {
4586
- let t = e.keyCode, r = rl(e);
4571
+ function ia(n, e) {
4572
+ let t = e.keyCode, r = ra(e);
4587
4573
  if (t == 8 || de && t == 72 && r == "c")
4588
4574
  return Li(n, -1) || vt(n, -1);
4589
4575
  if (t == 46 && !e.shiftKey || de && t == 68 && r == "c")
@@ -4600,7 +4586,7 @@ function il(n, e) {
4600
4586
  if (t == 38 || de && t == 80 && r == "c")
4601
4587
  return Fi(n, -1, r) || vt(n, -1);
4602
4588
  if (t == 40 || de && t == 78 && r == "c")
4603
- return nl(n) || Fi(n, 1, r) || vt(n, 1);
4589
+ return na(n) || Fi(n, 1, r) || vt(n, 1);
4604
4590
  if (r == (de ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
4605
4591
  return !0;
4606
4592
  }
@@ -4616,30 +4602,30 @@ function Xo(n, e) {
4616
4602
  let d = r.firstChild;
4617
4603
  t.push(d.type.name, d.attrs != d.type.defaultAttrs ? d.attrs : null), r = d.content;
4618
4604
  }
4619
- let s = n.someProp("clipboardSerializer") || Kn.fromSchema(n.state.schema), a = ns(), l = a.createElement("div");
4620
- l.appendChild(s.serializeFragment(r, { document: a }));
4621
- let c = l.firstChild, u, f = 0;
4605
+ let s = n.someProp("clipboardSerializer") || Kn.fromSchema(n.state.schema), l = ns(), a = l.createElement("div");
4606
+ a.appendChild(s.serializeFragment(r, { document: l }));
4607
+ let c = a.firstChild, u, f = 0;
4622
4608
  for (; c && c.nodeType == 1 && (u = ts[c.nodeName.toLowerCase()]); ) {
4623
4609
  for (let d = u.length - 1; d >= 0; d--) {
4624
- let g = a.createElement(u[d]);
4625
- for (; l.firstChild; )
4626
- g.appendChild(l.firstChild);
4627
- l.appendChild(g), f++;
4610
+ let g = l.createElement(u[d]);
4611
+ for (; a.firstChild; )
4612
+ g.appendChild(a.firstChild);
4613
+ a.appendChild(g), f++;
4628
4614
  }
4629
- c = l.firstChild;
4615
+ c = a.firstChild;
4630
4616
  }
4631
4617
  c && c.nodeType == 1 && c.setAttribute("data-pm-slice", `${i} ${o}${f ? ` -${f}` : ""} ${JSON.stringify(t)}`);
4632
4618
  let p = n.someProp("clipboardTextSerializer", (d) => d(e, n)) || e.content.textBetween(0, e.content.size, `
4633
4619
 
4634
4620
  `);
4635
- return { dom: l, text: p, slice: e };
4621
+ return { dom: a, text: p, slice: e };
4636
4622
  }
4637
4623
  function Qo(n, e, t, r, i) {
4638
- let o = i.parent.type.spec.code, s, a;
4624
+ let o = i.parent.type.spec.code, s, l;
4639
4625
  if (!t && !e)
4640
4626
  return null;
4641
- let l = e && (r || o || !t);
4642
- if (l) {
4627
+ let a = e && (r || o || !t);
4628
+ if (a) {
4643
4629
  if (n.someProp("transformPastedText", (p) => {
4644
4630
  e = p(e, o || r, n);
4645
4631
  }), o)
@@ -4647,7 +4633,7 @@ function Qo(n, e, t, r, i) {
4647
4633
  `))), 0, 0) : S.empty;
4648
4634
  let f = n.someProp("clipboardTextParser", (p) => p(e, i, r, n));
4649
4635
  if (f)
4650
- a = f;
4636
+ l = f;
4651
4637
  else {
4652
4638
  let p = i.marks(), { schema: d } = n.state, g = Kn.fromSchema(d);
4653
4639
  s = document.createElement("div"), e.split(/(?:\r\n?|\n)+/).forEach((m) => {
@@ -4658,7 +4644,7 @@ function Qo(n, e, t, r, i) {
4658
4644
  } else
4659
4645
  n.someProp("transformPastedHTML", (f) => {
4660
4646
  t = f(t, n);
4661
- }), s = ll(t), Vr && cl(s);
4647
+ }), s = aa(t), Vr && ca(s);
4662
4648
  let c = s && s.querySelector("[data-pm-slice]"), u = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice") || "");
4663
4649
  if (u && u[3])
4664
4650
  for (let f = +u[3]; f > 0; f--) {
@@ -4669,44 +4655,44 @@ function Qo(n, e, t, r, i) {
4669
4655
  break;
4670
4656
  s = p;
4671
4657
  }
4672
- if (a || (a = (n.someProp("clipboardParser") || n.someProp("domParser") || it.fromSchema(n.state.schema)).parseSlice(s, {
4673
- preserveWhitespace: !!(l || u),
4658
+ if (l || (l = (n.someProp("clipboardParser") || n.someProp("domParser") || it.fromSchema(n.state.schema)).parseSlice(s, {
4659
+ preserveWhitespace: !!(a || u),
4674
4660
  context: i,
4675
4661
  ruleFromNode(p) {
4676
- return p.nodeName == "BR" && !p.nextSibling && p.parentNode && !ol.test(p.parentNode.nodeName) ? { ignore: !0 } : null;
4662
+ return p.nodeName == "BR" && !p.nextSibling && p.parentNode && !oa.test(p.parentNode.nodeName) ? { ignore: !0 } : null;
4677
4663
  }
4678
4664
  })), u)
4679
- a = ul(Vi(a, +u[1], +u[2]), u[4]);
4680
- else if (a = S.maxOpen(sl(a.content, i), !0), a.openStart || a.openEnd) {
4665
+ l = ua(Vi(l, +u[1], +u[2]), u[4]);
4666
+ else if (l = S.maxOpen(sa(l.content, i), !0), l.openStart || l.openEnd) {
4681
4667
  let f = 0, p = 0;
4682
- for (let d = a.content.firstChild; f < a.openStart && !d.type.spec.isolating; f++, d = d.firstChild)
4668
+ for (let d = l.content.firstChild; f < l.openStart && !d.type.spec.isolating; f++, d = d.firstChild)
4683
4669
  ;
4684
- for (let d = a.content.lastChild; p < a.openEnd && !d.type.spec.isolating; p++, d = d.lastChild)
4670
+ for (let d = l.content.lastChild; p < l.openEnd && !d.type.spec.isolating; p++, d = d.lastChild)
4685
4671
  ;
4686
- a = Vi(a, f, p);
4672
+ l = Vi(l, f, p);
4687
4673
  }
4688
4674
  return n.someProp("transformPasted", (f) => {
4689
- a = f(a, n);
4690
- }), a;
4675
+ l = f(l, n);
4676
+ }), l;
4691
4677
  }
4692
- const ol = /^(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;
4693
- function sl(n, e) {
4678
+ const oa = /^(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;
4679
+ function sa(n, e) {
4694
4680
  if (n.childCount < 2)
4695
4681
  return n;
4696
4682
  for (let t = e.depth; t >= 0; t--) {
4697
4683
  let i = e.node(t).contentMatchAt(e.index(t)), o, s = [];
4698
- if (n.forEach((a) => {
4684
+ if (n.forEach((l) => {
4699
4685
  if (!s)
4700
4686
  return;
4701
- let l = i.findWrapping(a.type), c;
4702
- if (!l)
4687
+ let a = i.findWrapping(l.type), c;
4688
+ if (!a)
4703
4689
  return s = null;
4704
- if (c = s.length && o.length && _o(l, o, a, s[s.length - 1], 0))
4690
+ if (c = s.length && o.length && _o(a, o, l, s[s.length - 1], 0))
4705
4691
  s[s.length - 1] = c;
4706
4692
  else {
4707
4693
  s.length && (s[s.length - 1] = es(s[s.length - 1], o.length));
4708
- let u = Zo(a, l);
4709
- s.push(u), i = i.matchType(u.type), o = l;
4694
+ let u = Zo(l, a);
4695
+ s.push(u), i = i.matchType(u.type), o = a;
4710
4696
  }
4711
4697
  }), s)
4712
4698
  return k.from(s);
@@ -4734,8 +4720,8 @@ function es(n, e) {
4734
4720
  return n.copy(t.append(r));
4735
4721
  }
4736
4722
  function Tr(n, e, t, r, i, o) {
4737
- let s = e < 0 ? n.firstChild : n.lastChild, a = s.content;
4738
- return n.childCount > 1 && (o = 0), i < r - 1 && (a = Tr(a, e, t, r, i + 1, o)), i >= t && (a = e < 0 ? s.contentMatchAt(0).fillBefore(a, o <= i).append(a) : a.append(s.contentMatchAt(s.childCount).fillBefore(k.empty, !0))), n.replaceChild(e < 0 ? 0 : n.childCount - 1, s.copy(a));
4723
+ let s = e < 0 ? n.firstChild : n.lastChild, l = s.content;
4724
+ return n.childCount > 1 && (o = 0), i < r - 1 && (l = Tr(l, e, t, r, i + 1, o)), i >= t && (l = e < 0 ? s.contentMatchAt(0).fillBefore(l, o <= i).append(l) : l.append(s.contentMatchAt(s.childCount).fillBefore(k.empty, !0))), n.replaceChild(e < 0 ? 0 : n.childCount - 1, s.copy(l));
4739
4725
  }
4740
4726
  function Vi(n, e, t) {
4741
4727
  return e < n.openStart && (n = new S(Tr(n.content, -1, e, n.openStart, 0, n.openEnd), e, n.openEnd)), t < n.openEnd && (n = new S(Tr(n.content, 1, t, n.openEnd, 0, 0), n.openStart, t)), n;
@@ -4756,27 +4742,27 @@ function ns() {
4756
4742
  return ji || (ji = document.implementation.createHTMLDocument("title"));
4757
4743
  }
4758
4744
  let ur = null;
4759
- function al(n) {
4745
+ function la(n) {
4760
4746
  let e = window.trustedTypes;
4761
4747
  return e ? (ur || (ur = e.defaultPolicy || e.createPolicy("ProseMirrorClipboard", { createHTML: (t) => t })), ur.createHTML(n)) : n;
4762
4748
  }
4763
- function ll(n) {
4749
+ function aa(n) {
4764
4750
  let e = /^(\s*<meta [^>]*>)*/.exec(n);
4765
4751
  e && (n = n.slice(e[0].length));
4766
4752
  let t = ns().createElement("div"), r = /<([a-z][^>\s]+)/i.exec(n), i;
4767
- if ((i = r && ts[r[1].toLowerCase()]) && (n = i.map((o) => "<" + o + ">").join("") + n + i.map((o) => "</" + o + ">").reverse().join("")), t.innerHTML = al(n), i)
4753
+ if ((i = r && ts[r[1].toLowerCase()]) && (n = i.map((o) => "<" + o + ">").join("") + n + i.map((o) => "</" + o + ">").reverse().join("")), t.innerHTML = la(n), i)
4768
4754
  for (let o = 0; o < i.length; o++)
4769
4755
  t = t.querySelector(i[o]) || t;
4770
4756
  return t;
4771
4757
  }
4772
- function cl(n) {
4758
+ function ca(n) {
4773
4759
  let e = n.querySelectorAll(We ? "span:not([class]):not([style])" : "span.Apple-converted-space");
4774
4760
  for (let t = 0; t < e.length; t++) {
4775
4761
  let r = e[t];
4776
4762
  r.childNodes.length == 1 && r.textContent == " " && r.parentNode && r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "), r);
4777
4763
  }
4778
4764
  }
4779
- function ul(n, e) {
4765
+ function ua(n, e) {
4780
4766
  if (!n.size)
4781
4767
  return n;
4782
4768
  let t = n.content.firstChild.type.schema, r;
@@ -4786,19 +4772,19 @@ function ul(n, e) {
4786
4772
  return n;
4787
4773
  }
4788
4774
  let { content: i, openStart: o, openEnd: s } = n;
4789
- for (let a = r.length - 2; a >= 0; a -= 2) {
4790
- let l = t.nodes[r[a]];
4791
- if (!l || l.hasRequiredAttrs())
4775
+ for (let l = r.length - 2; l >= 0; l -= 2) {
4776
+ let a = t.nodes[r[l]];
4777
+ if (!a || a.hasRequiredAttrs())
4792
4778
  break;
4793
- i = k.from(l.create(r[a + 1], i)), o++, s++;
4779
+ i = k.from(a.create(r[l + 1], i)), o++, s++;
4794
4780
  }
4795
4781
  return new S(i, o, s);
4796
4782
  }
4797
- const ve = {}, le = {};
4783
+ const ve = {}, ae = {};
4798
4784
  function $e(n, e) {
4799
4785
  n.input.lastSelectionOrigin = e, n.input.lastSelectionTime = Date.now();
4800
4786
  }
4801
- le.keydown = (n, e) => {
4787
+ ae.keydown = (n, e) => {
4802
4788
  let t = e;
4803
4789
  if (n.input.shiftKey = t.keyCode == 16 || t.shiftKey, !is(n, t) && (n.input.lastKeyCode = t.keyCode, n.input.lastKeyCodeTime = Date.now(), !(on && We && t.keyCode == 13)))
4804
4790
  if (t.keyCode != 229 && n.domObserver.forceFlush(), $r && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
@@ -4806,12 +4792,12 @@ le.keydown = (n, e) => {
4806
4792
  n.input.lastIOSEnter = r, n.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
4807
4793
  n.input.lastIOSEnter == r && (n.someProp("handleKeyDown", (i) => i(n, Ho(13, "Enter"))), n.input.lastIOSEnter = 0);
4808
4794
  }, 200);
4809
- } else n.someProp("handleKeyDown", (r) => r(n, t)) || il(n, t) ? t.preventDefault() : $e(n, "key");
4795
+ } else n.someProp("handleKeyDown", (r) => r(n, t)) || ia(n, t) ? t.preventDefault() : $e(n, "key");
4810
4796
  };
4811
- le.keyup = (n, e) => {
4797
+ ae.keyup = (n, e) => {
4812
4798
  e.keyCode == 16 && (n.input.shiftKey = !1);
4813
4799
  };
4814
- le.keypress = (n, e) => {
4800
+ ae.keypress = (n, e) => {
4815
4801
  let t = e;
4816
4802
  if (is(n, t) || !t.charCode || t.ctrlKey && !t.altKey || de && t.metaKey)
4817
4803
  return;
@@ -4828,7 +4814,7 @@ le.keypress = (n, e) => {
4828
4814
  function Xn(n) {
4829
4815
  return { left: n.clientX, top: n.clientY };
4830
4816
  }
4831
- function fl(n, e) {
4817
+ function fa(n, e) {
4832
4818
  let t = e.x - n.clientX, r = e.y - n.clientY;
4833
4819
  return t * t + r * r < 100;
4834
4820
  }
@@ -4837,7 +4823,7 @@ function Wr(n, e, t, r, i) {
4837
4823
  return !1;
4838
4824
  let o = n.state.doc.resolve(r);
4839
4825
  for (let s = o.depth + 1; s > 0; s--)
4840
- if (n.someProp(e, (a) => s > o.depth ? a(n, t, o.nodeAfter, o.before(s), i, !0) : a(n, t, o.node(s), o.before(s), i, !1)))
4826
+ if (n.someProp(e, (l) => s > o.depth ? l(n, t, o.nodeAfter, o.before(s), i, !0) : l(n, t, o.node(s), o.before(s), i, !1)))
4841
4827
  return !0;
4842
4828
  return !1;
4843
4829
  }
@@ -4847,37 +4833,37 @@ function St(n, e, t) {
4847
4833
  let r = n.state.tr.setSelection(e);
4848
4834
  r.setMeta("pointer", !0), n.dispatch(r);
4849
4835
  }
4850
- function dl(n, e) {
4836
+ function da(n, e) {
4851
4837
  if (e == -1)
4852
4838
  return !1;
4853
4839
  let t = n.state.doc.resolve(e), r = t.nodeAfter;
4854
4840
  return r && r.isAtom && O.isSelectable(r) ? (St(n, new O(t)), !0) : !1;
4855
4841
  }
4856
- function pl(n, e) {
4842
+ function pa(n, e) {
4857
4843
  if (e == -1)
4858
4844
  return !1;
4859
4845
  let t = n.state.selection, r, i;
4860
4846
  t instanceof O && (r = t.node);
4861
4847
  let o = n.state.doc.resolve(e);
4862
4848
  for (let s = o.depth + 1; s > 0; s--) {
4863
- let a = s > o.depth ? o.nodeAfter : o.node(s);
4864
- if (O.isSelectable(a)) {
4849
+ let l = s > o.depth ? o.nodeAfter : o.node(s);
4850
+ if (O.isSelectable(l)) {
4865
4851
  r && t.$from.depth > 0 && s >= t.$from.depth && o.before(t.$from.depth + 1) == t.$from.pos ? i = o.before(t.$from.depth) : i = o.before(s);
4866
4852
  break;
4867
4853
  }
4868
4854
  }
4869
4855
  return i != null ? (St(n, O.create(n.state.doc, i)), !0) : !1;
4870
4856
  }
4871
- function hl(n, e, t, r, i) {
4872
- return Wr(n, "handleClickOn", e, t, r) || n.someProp("handleClick", (o) => o(n, e, r)) || (i ? pl(n, t) : dl(n, t));
4857
+ function ha(n, e, t, r, i) {
4858
+ return Wr(n, "handleClickOn", e, t, r) || n.someProp("handleClick", (o) => o(n, e, r)) || (i ? pa(n, t) : da(n, t));
4873
4859
  }
4874
- function ml(n, e, t, r) {
4860
+ function ma(n, e, t, r) {
4875
4861
  return Wr(n, "handleDoubleClickOn", e, t, r) || n.someProp("handleDoubleClick", (i) => i(n, e, r));
4876
4862
  }
4877
- function gl(n, e, t, r) {
4878
- return Wr(n, "handleTripleClickOn", e, t, r) || n.someProp("handleTripleClick", (i) => i(n, e, r)) || yl(n, t, r);
4863
+ function ga(n, e, t, r) {
4864
+ return Wr(n, "handleTripleClickOn", e, t, r) || n.someProp("handleTripleClick", (i) => i(n, e, r)) || ya(n, t, r);
4879
4865
  }
4880
- function yl(n, e, t) {
4866
+ function ya(n, e, t) {
4881
4867
  if (t.button != 0)
4882
4868
  return !1;
4883
4869
  let r = n.state.doc;
@@ -4885,11 +4871,11 @@ function yl(n, e, t) {
4885
4871
  return r.inlineContent ? (St(n, A.create(r, 0, r.content.size)), !0) : !1;
4886
4872
  let i = r.resolve(e);
4887
4873
  for (let o = i.depth + 1; o > 0; o--) {
4888
- let s = o > i.depth ? i.nodeAfter : i.node(o), a = i.before(o);
4874
+ let s = o > i.depth ? i.nodeAfter : i.node(o), l = i.before(o);
4889
4875
  if (s.inlineContent)
4890
- St(n, A.create(r, a + 1, a + 1 + s.content.size));
4876
+ St(n, A.create(r, l + 1, l + 1 + s.content.size));
4891
4877
  else if (O.isSelectable(s))
4892
- St(n, O.create(r, a));
4878
+ St(n, O.create(r, l));
4893
4879
  else
4894
4880
  continue;
4895
4881
  return !0;
@@ -4903,11 +4889,11 @@ ve.mousedown = (n, e) => {
4903
4889
  let t = e;
4904
4890
  n.input.shiftKey = t.shiftKey;
4905
4891
  let r = Hr(n), i = Date.now(), o = "singleClick";
4906
- i - n.input.lastClick.time < 500 && fl(t, n.input.lastClick) && !t[rs] && n.input.lastClick.button == t.button && (n.input.lastClick.type == "singleClick" ? o = "doubleClick" : n.input.lastClick.type == "doubleClick" && (o = "tripleClick")), n.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: o, button: t.button };
4892
+ i - n.input.lastClick.time < 500 && fa(t, n.input.lastClick) && !t[rs] && n.input.lastClick.button == t.button && (n.input.lastClick.type == "singleClick" ? o = "doubleClick" : n.input.lastClick.type == "doubleClick" && (o = "tripleClick")), n.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: o, button: t.button };
4907
4893
  let s = n.posAtCoords(Xn(t));
4908
- s && (o == "singleClick" ? (n.input.mouseDown && n.input.mouseDown.done(), n.input.mouseDown = new vl(n, s, t, !!r)) : (o == "doubleClick" ? ml : gl)(n, s.pos, s.inside, t) ? t.preventDefault() : $e(n, "pointer"));
4894
+ s && (o == "singleClick" ? (n.input.mouseDown && n.input.mouseDown.done(), n.input.mouseDown = new va(n, s, t, !!r)) : (o == "doubleClick" ? ma : ga)(n, s.pos, s.inside, t) ? t.preventDefault() : $e(n, "pointer"));
4909
4895
  };
4910
- class vl {
4896
+ class va {
4911
4897
  constructor(e, t, r, i) {
4912
4898
  this.view = e, this.pos = t, this.event = r, this.flushed = i, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!r[rs], this.allowDefault = r.shiftKey;
4913
4899
  let o, s;
@@ -4917,8 +4903,8 @@ class vl {
4917
4903
  let u = e.state.doc.resolve(t.pos);
4918
4904
  o = u.parent, s = u.depth ? u.before() : 0;
4919
4905
  }
4920
- const a = i ? null : r.target, l = a ? e.docView.nearestDesc(a, !0) : null;
4921
- this.target = l && l.dom.nodeType == 1 ? l.dom : null;
4906
+ const l = i ? null : r.target, a = l ? e.docView.nearestDesc(l, !0) : null;
4907
+ this.target = a && a.dom.nodeType == 1 ? a.dom : null;
4922
4908
  let { selection: c } = e.state;
4923
4909
  (r.button == 0 && o.type.spec.draggable && o.type.spec.selectable !== !1 || c instanceof O && c.from <= s && c.to > s) && (this.mightDrag = {
4924
4910
  node: o,
@@ -4936,7 +4922,7 @@ class vl {
4936
4922
  if (this.done(), !this.view.dom.contains(e.target))
4937
4923
  return;
4938
4924
  let t = this.pos;
4939
- this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(Xn(e))), this.updateAllowDefault(e), this.allowDefault || !t ? $e(this.view, "pointer") : hl(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
4925
+ this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(Xn(e))), this.updateAllowDefault(e), this.allowDefault || !t ? $e(this.view, "pointer") : ha(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
4940
4926
  dt && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
4941
4927
  // cursor, but still report that the node is selected
4942
4928
  // when asked through getSelection. You'll then get a
@@ -4963,8 +4949,8 @@ ve.contextmenu = (n) => Hr(n);
4963
4949
  function is(n, e) {
4964
4950
  return n.composing ? !0 : dt && Math.abs(e.timeStamp - n.input.compositionEndedAt) < 500 ? (n.input.compositionEndedAt = -2e8, !0) : !1;
4965
4951
  }
4966
- const bl = on ? 5e3 : -1;
4967
- le.compositionstart = le.compositionupdate = (n) => {
4952
+ const ba = on ? 5e3 : -1;
4953
+ ae.compositionstart = ae.compositionupdate = (n) => {
4968
4954
  if (!n.composing) {
4969
4955
  n.domObserver.flush();
4970
4956
  let { state: e } = n, t = e.selection.$to;
@@ -4977,8 +4963,8 @@ le.compositionstart = le.compositionupdate = (n) => {
4977
4963
  if (!s)
4978
4964
  break;
4979
4965
  if (s.nodeType == 3) {
4980
- let a = n.domSelection();
4981
- a && a.collapse(s, s.nodeValue.length);
4966
+ let l = n.domSelection();
4967
+ l && l.collapse(s, s.nodeValue.length);
4982
4968
  break;
4983
4969
  } else
4984
4970
  i = s, o = -1;
@@ -4986,32 +4972,32 @@ le.compositionstart = le.compositionupdate = (n) => {
4986
4972
  }
4987
4973
  n.input.composing = !0;
4988
4974
  }
4989
- ss(n, bl);
4975
+ ss(n, ba);
4990
4976
  };
4991
- le.compositionend = (n, e) => {
4977
+ ae.compositionend = (n, e) => {
4992
4978
  n.composing && (n.input.composing = !1, n.input.compositionEndedAt = e.timeStamp, n.input.compositionPendingChanges = n.domObserver.pendingRecords().length ? n.input.compositionID : 0, n.input.compositionNode = null, n.input.compositionPendingChanges && Promise.resolve().then(() => n.domObserver.flush()), n.input.compositionID++, ss(n, 20));
4993
4979
  };
4994
4980
  function ss(n, e) {
4995
4981
  clearTimeout(n.input.composingTimeout), e > -1 && (n.input.composingTimeout = setTimeout(() => $n(n), e));
4996
4982
  }
4997
- function xl(n) {
4998
- for (n.composing && (n.input.composing = !1, n.input.compositionEndedAt = kl()); n.input.compositionNodes.length > 0; )
4983
+ function xa(n) {
4984
+ for (n.composing && (n.input.composing = !1, n.input.compositionEndedAt = ka()); n.input.compositionNodes.length > 0; )
4999
4985
  n.input.compositionNodes.pop().markParentsDirty();
5000
4986
  }
5001
- function kl() {
4987
+ function ka() {
5002
4988
  let n = document.createEvent("Event");
5003
4989
  return n.initEvent("event", !0, !0), n.timeStamp;
5004
4990
  }
5005
4991
  function $n(n, e = !1) {
5006
4992
  if (!(on && n.domObserver.flushingSoon >= 0)) {
5007
- if (n.domObserver.forceFlush(), xl(n), e || n.docView && n.docView.dirty) {
5008
- let t = Ua(n), r = n.state.selection;
4993
+ if (n.domObserver.forceFlush(), xa(n), e || n.docView && n.docView.dirty) {
4994
+ let t = Ul(n), r = n.state.selection;
5009
4995
  return t && !t.eq(r) ? n.dispatch(n.state.tr.setSelection(t)) : (n.markCursor || e) && !r.$from.node(r.$from.sharedDepth(r.to)).inlineContent ? n.dispatch(n.state.tr.deleteSelection()) : n.updateState(n.state), !0;
5010
4996
  }
5011
4997
  return !1;
5012
4998
  }
5013
4999
  }
5014
- function wl(n, e) {
5000
+ function wa(n, e) {
5015
5001
  if (!n.dom.parentNode)
5016
5002
  return;
5017
5003
  let t = n.dom.parentNode.appendChild(document.createElement("div"));
@@ -5021,18 +5007,18 @@ function wl(n, e) {
5021
5007
  t.parentNode && t.parentNode.removeChild(t), n.focus();
5022
5008
  }, 50);
5023
5009
  }
5024
- const Yt = rn && qo < 15 || $r && Ka < 604;
5025
- ve.copy = le.cut = (n, e) => {
5010
+ const Yt = rn && qo < 15 || $r && Kl < 604;
5011
+ ve.copy = ae.cut = (n, e) => {
5026
5012
  let t = e, r = n.state.selection, i = t.type == "cut";
5027
5013
  if (r.empty)
5028
5014
  return;
5029
- let o = Yt ? null : t.clipboardData, s = r.content(), { dom: a, text: l } = Xo(n, s);
5030
- o ? (t.preventDefault(), o.clearData(), o.setData("text/html", a.innerHTML), o.setData("text/plain", l)) : wl(n, a), i && n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
5015
+ let o = Yt ? null : t.clipboardData, s = r.content(), { dom: l, text: a } = Xo(n, s);
5016
+ o ? (t.preventDefault(), o.clearData(), o.setData("text/html", l.innerHTML), o.setData("text/plain", a)) : wa(n, l), i && n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
5031
5017
  };
5032
- function Sl(n) {
5018
+ function Sa(n) {
5033
5019
  return n.openStart == 0 && n.openEnd == 0 && n.content.childCount == 1 ? n.content.firstChild : null;
5034
5020
  }
5035
- function Cl(n, e) {
5021
+ function Ca(n, e) {
5036
5022
  if (!n.dom.parentNode)
5037
5023
  return;
5038
5024
  let t = n.input.shiftKey || n.state.selection.$from.parent.type.spec.code, r = n.dom.parentNode.appendChild(document.createElement(t ? "textarea" : "div"));
@@ -5044,36 +5030,36 @@ function Cl(n, e) {
5044
5030
  }
5045
5031
  function Mr(n, e, t, r, i) {
5046
5032
  let o = Qo(n, e, t, r, n.state.selection.$from);
5047
- if (n.someProp("handlePaste", (l) => l(n, i, o || S.empty)))
5033
+ if (n.someProp("handlePaste", (a) => a(n, i, o || S.empty)))
5048
5034
  return !0;
5049
5035
  if (!o)
5050
5036
  return !1;
5051
- let s = Sl(o), a = s ? n.state.tr.replaceSelectionWith(s, r) : n.state.tr.replaceSelection(o);
5052
- return n.dispatch(a.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
5037
+ let s = Sa(o), l = s ? n.state.tr.replaceSelectionWith(s, r) : n.state.tr.replaceSelection(o);
5038
+ return n.dispatch(l.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
5053
5039
  }
5054
- function as(n) {
5040
+ function ls(n) {
5055
5041
  let e = n.getData("text/plain") || n.getData("Text");
5056
5042
  if (e)
5057
5043
  return e;
5058
5044
  let t = n.getData("text/uri-list");
5059
5045
  return t ? t.replace(/\r?\n/g, " ") : "";
5060
5046
  }
5061
- le.paste = (n, e) => {
5047
+ ae.paste = (n, e) => {
5062
5048
  let t = e;
5063
5049
  if (n.composing && !on)
5064
5050
  return;
5065
5051
  let r = Yt ? null : t.clipboardData, i = n.input.shiftKey && n.input.lastKeyCode != 45;
5066
- r && Mr(n, as(r), r.getData("text/html"), i, t) ? t.preventDefault() : Cl(n, t);
5052
+ r && Mr(n, ls(r), r.getData("text/html"), i, t) ? t.preventDefault() : Ca(n, t);
5067
5053
  };
5068
- class Ol {
5054
+ class Oa {
5069
5055
  constructor(e, t, r) {
5070
5056
  this.slice = e, this.move = t, this.node = r;
5071
5057
  }
5072
5058
  }
5073
- const El = de ? "altKey" : "ctrlKey";
5074
- function ls(n, e) {
5059
+ const Ea = de ? "altKey" : "ctrlKey";
5060
+ function as(n, e) {
5075
5061
  let t = n.someProp("dragCopies", (r) => !r(e));
5076
- return t ?? !e[El];
5062
+ return t ?? !e[Ea];
5077
5063
  }
5078
5064
  ve.dragstart = (n, e) => {
5079
5065
  let t = e, r = n.input.mouseDown;
@@ -5088,8 +5074,8 @@ ve.dragstart = (n, e) => {
5088
5074
  f && f.node.type.spec.draggable && f != n.docView && (s = O.create(n.state.doc, f.posBefore));
5089
5075
  }
5090
5076
  }
5091
- let a = (s || n.state.selection).content(), { dom: l, text: c, slice: u } = Xo(n, a);
5092
- (!t.dataTransfer.files.length || !We || Ko > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(Yt ? "Text" : "text/html", l.innerHTML), t.dataTransfer.effectAllowed = "copyMove", Yt || t.dataTransfer.setData("text/plain", c), n.dragging = new Ol(u, ls(n, t), s);
5077
+ let l = (s || n.state.selection).content(), { dom: a, text: c, slice: u } = Xo(n, l);
5078
+ (!t.dataTransfer.files.length || !We || Ko > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(Yt ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", Yt || t.dataTransfer.setData("text/plain", c), n.dragging = new Oa(u, as(n, t), s);
5093
5079
  };
5094
5080
  ve.dragend = (n) => {
5095
5081
  let e = n.dragging;
@@ -5097,8 +5083,8 @@ ve.dragend = (n) => {
5097
5083
  n.dragging == e && (n.dragging = null);
5098
5084
  }, 50);
5099
5085
  };
5100
- le.dragover = le.dragenter = (n, e) => e.preventDefault();
5101
- le.drop = (n, e) => {
5086
+ ae.dragover = ae.dragenter = (n, e) => e.preventDefault();
5087
+ ae.drop = (n, e) => {
5102
5088
  let t = e, r = n.dragging;
5103
5089
  if (n.dragging = null, !t.dataTransfer)
5104
5090
  return;
@@ -5108,30 +5094,30 @@ le.drop = (n, e) => {
5108
5094
  let o = n.state.doc.resolve(i.pos), s = r && r.slice;
5109
5095
  s ? n.someProp("transformPasted", (g) => {
5110
5096
  s = g(s, n);
5111
- }) : s = Qo(n, as(t.dataTransfer), Yt ? null : t.dataTransfer.getData("text/html"), !1, o);
5112
- let a = !!(r && ls(n, t));
5113
- if (n.someProp("handleDrop", (g) => g(n, t, s || S.empty, a))) {
5097
+ }) : s = Qo(n, ls(t.dataTransfer), Yt ? null : t.dataTransfer.getData("text/html"), !1, o);
5098
+ let l = !!(r && as(n, t));
5099
+ if (n.someProp("handleDrop", (g) => g(n, t, s || S.empty, l))) {
5114
5100
  t.preventDefault();
5115
5101
  return;
5116
5102
  }
5117
5103
  if (!s)
5118
5104
  return;
5119
5105
  t.preventDefault();
5120
- let l = s ? Fa(n.state.doc, o.pos, s) : o.pos;
5121
- l == null && (l = o.pos);
5106
+ let a = s ? Fl(n.state.doc, o.pos, s) : o.pos;
5107
+ a == null && (a = o.pos);
5122
5108
  let c = n.state.tr;
5123
- if (a) {
5109
+ if (l) {
5124
5110
  let { node: g } = r;
5125
5111
  g ? g.replace(c) : c.deleteSelection();
5126
5112
  }
5127
- let u = c.mapping.map(l), f = s.openStart == 0 && s.openEnd == 0 && s.content.childCount == 1, p = c.doc;
5113
+ let u = c.mapping.map(a), f = s.openStart == 0 && s.openEnd == 0 && s.content.childCount == 1, p = c.doc;
5128
5114
  if (f ? c.replaceRangeWith(u, u, s.content.firstChild) : c.replaceRange(u, u, s), c.doc.eq(p))
5129
5115
  return;
5130
5116
  let d = c.doc.resolve(u);
5131
5117
  if (f && O.isSelectable(s.content.firstChild) && d.nodeAfter && d.nodeAfter.sameMarkup(s.content.firstChild))
5132
5118
  c.setSelection(new O(d));
5133
5119
  else {
5134
- let g = c.mapping.map(l);
5120
+ let g = c.mapping.map(a);
5135
5121
  c.mapping.maps[c.mapping.maps.length - 1].forEach((m, y, b, C) => g = C), c.setSelection(Go(n, d, c.doc.resolve(g)));
5136
5122
  }
5137
5123
  n.focus(), n.dispatch(c.setMeta("uiEvent", "drop"));
@@ -5157,8 +5143,8 @@ ve.beforeinput = (n, e) => {
5157
5143
  }, 50);
5158
5144
  }
5159
5145
  };
5160
- for (let n in le)
5161
- ve[n] = le[n];
5146
+ for (let n in ae)
5147
+ ve[n] = ae[n];
5162
5148
  function Xt(n, e) {
5163
5149
  if (n == e)
5164
5150
  return !0;
@@ -5330,13 +5316,13 @@ class W {
5330
5316
  }
5331
5317
  findInner(e, t, r, i, o) {
5332
5318
  for (let s = 0; s < this.local.length; s++) {
5333
- let a = this.local[s];
5334
- a.from <= t && a.to >= e && (!o || o(a.spec)) && r.push(a.copy(a.from + i, a.to + i));
5319
+ let l = this.local[s];
5320
+ l.from <= t && l.to >= e && (!o || o(l.spec)) && r.push(l.copy(l.from + i, l.to + i));
5335
5321
  }
5336
5322
  for (let s = 0; s < this.children.length; s += 3)
5337
5323
  if (this.children[s] < t && this.children[s + 1] > e) {
5338
- let a = this.children[s] + 1;
5339
- this.children[s + 2].findInner(e - a, t - a, r, i + a, o);
5324
+ let l = this.children[s] + 1;
5325
+ this.children[s + 2].findInner(e - l, t - l, r, i + l, o);
5340
5326
  }
5341
5327
  }
5342
5328
  /**
@@ -5351,11 +5337,11 @@ class W {
5351
5337
  */
5352
5338
  mapInner(e, t, r, i, o) {
5353
5339
  let s;
5354
- for (let a = 0; a < this.local.length; a++) {
5355
- let l = this.local[a].map(e, r, i);
5356
- l && l.type.valid(t, l) ? (s || (s = [])).push(l) : o.onRemove && o.onRemove(this.local[a].spec);
5340
+ for (let l = 0; l < this.local.length; l++) {
5341
+ let a = this.local[l].map(e, r, i);
5342
+ a && a.type.valid(t, a) ? (s || (s = [])).push(a) : o.onRemove && o.onRemove(this.local[l].spec);
5357
5343
  }
5358
- return this.children.length ? Tl(this.children, s || [], e, t, r, i, o) : s ? new W(s.sort(st), kt) : Q;
5344
+ return this.children.length ? Ta(this.children, s || [], e, t, r, i, o) : s ? new W(s.sort(st), kt) : Q;
5359
5345
  }
5360
5346
  /**
5361
5347
  Add the given array of decorations to the ones in the set,
@@ -5368,17 +5354,17 @@ class W {
5368
5354
  }
5369
5355
  addInner(e, t, r) {
5370
5356
  let i, o = 0;
5371
- e.forEach((a, l) => {
5372
- let c = l + r, u;
5373
- if (u = us(t, a, c)) {
5374
- for (i || (i = this.children.slice()); o < i.length && i[o] < l; )
5357
+ e.forEach((l, a) => {
5358
+ let c = a + r, u;
5359
+ if (u = us(t, l, c)) {
5360
+ for (i || (i = this.children.slice()); o < i.length && i[o] < a; )
5375
5361
  o += 3;
5376
- i[o] == l ? i[o + 2] = i[o + 2].addInner(a, u, c + 1) : i.splice(o, 0, l, l + a.nodeSize, jn(u, a, c + 1, ot)), o += 3;
5362
+ i[o] == a ? i[o + 2] = i[o + 2].addInner(l, u, c + 1) : i.splice(o, 0, a, a + l.nodeSize, jn(u, l, c + 1, ot)), o += 3;
5377
5363
  }
5378
5364
  });
5379
5365
  let s = cs(o ? fs(t) : t, -r);
5380
- for (let a = 0; a < s.length; a++)
5381
- s[a].type.valid(e, s[a]) || s.splice(a--, 1);
5366
+ for (let l = 0; l < s.length; l++)
5367
+ s[l].type.valid(e, s[l]) || s.splice(l--, 1);
5382
5368
  return new W(s.length ? this.local.concat(s).sort(st) : this.local, i || this.children);
5383
5369
  }
5384
5370
  /**
@@ -5391,20 +5377,20 @@ class W {
5391
5377
  removeInner(e, t) {
5392
5378
  let r = this.children, i = this.local;
5393
5379
  for (let o = 0; o < r.length; o += 3) {
5394
- let s, a = r[o] + t, l = r[o + 1] + t;
5380
+ let s, l = r[o] + t, a = r[o + 1] + t;
5395
5381
  for (let u = 0, f; u < e.length; u++)
5396
- (f = e[u]) && f.from > a && f.to < l && (e[u] = null, (s || (s = [])).push(f));
5382
+ (f = e[u]) && f.from > l && f.to < a && (e[u] = null, (s || (s = [])).push(f));
5397
5383
  if (!s)
5398
5384
  continue;
5399
5385
  r == this.children && (r = this.children.slice());
5400
- let c = r[o + 2].removeInner(s, a + 1);
5386
+ let c = r[o + 2].removeInner(s, l + 1);
5401
5387
  c != Q ? r[o + 2] = c : (r.splice(o, 3), o -= 3);
5402
5388
  }
5403
5389
  if (i.length) {
5404
5390
  for (let o = 0, s; o < e.length; o++)
5405
5391
  if (s = e[o])
5406
- for (let a = 0; a < i.length; a++)
5407
- i[a].eq(s, t) && (i == this.local && (i = this.local.slice()), i.splice(a--, 1));
5392
+ for (let l = 0; l < i.length; l++)
5393
+ i[l].eq(s, t) && (i == this.local && (i = this.local.slice()), i.splice(l--, 1));
5408
5394
  }
5409
5395
  return r == this.children && i == this.local ? this : i.length || r.length ? new W(i, r) : Q;
5410
5396
  }
@@ -5414,22 +5400,22 @@ class W {
5414
5400
  if (t.isLeaf)
5415
5401
  return W.empty;
5416
5402
  let r, i;
5417
- for (let a = 0; a < this.children.length; a += 3)
5418
- if (this.children[a] >= e) {
5419
- this.children[a] == e && (r = this.children[a + 2]);
5403
+ for (let l = 0; l < this.children.length; l += 3)
5404
+ if (this.children[l] >= e) {
5405
+ this.children[l] == e && (r = this.children[l + 2]);
5420
5406
  break;
5421
5407
  }
5422
5408
  let o = e + 1, s = o + t.content.size;
5423
- for (let a = 0; a < this.local.length; a++) {
5424
- let l = this.local[a];
5425
- if (l.from < s && l.to > o && l.type instanceof Ve) {
5426
- let c = Math.max(o, l.from) - o, u = Math.min(s, l.to) - o;
5427
- c < u && (i || (i = [])).push(l.copy(c, u));
5409
+ for (let l = 0; l < this.local.length; l++) {
5410
+ let a = this.local[l];
5411
+ if (a.from < s && a.to > o && a.type instanceof Ve) {
5412
+ let c = Math.max(o, a.from) - o, u = Math.min(s, a.to) - o;
5413
+ c < u && (i || (i = [])).push(a.copy(c, u));
5428
5414
  }
5429
5415
  }
5430
5416
  if (i) {
5431
- let a = new W(i.sort(st), kt);
5432
- return r ? new Xe([a, r]) : a;
5417
+ let l = new W(i.sort(st), kt);
5418
+ return r ? new Xe([l, r]) : l;
5433
5419
  }
5434
5420
  return r || Q;
5435
5421
  }
@@ -5533,54 +5519,54 @@ class Xe {
5533
5519
  this.members[t].forEachSet(e);
5534
5520
  }
5535
5521
  }
5536
- function Tl(n, e, t, r, i, o, s) {
5537
- let a = n.slice();
5522
+ function Ta(n, e, t, r, i, o, s) {
5523
+ let l = n.slice();
5538
5524
  for (let c = 0, u = o; c < t.maps.length; c++) {
5539
5525
  let f = 0;
5540
5526
  t.maps[c].forEach((p, d, g, m) => {
5541
5527
  let y = m - g - (d - p);
5542
- for (let b = 0; b < a.length; b += 3) {
5543
- let C = a[b + 1];
5528
+ for (let b = 0; b < l.length; b += 3) {
5529
+ let C = l[b + 1];
5544
5530
  if (C < 0 || p > C + u - f)
5545
5531
  continue;
5546
- let T = a[b] + u - f;
5547
- d >= T ? a[b + 1] = p <= T ? -2 : -1 : p >= u && y && (a[b] += y, a[b + 1] += y);
5532
+ let T = l[b] + u - f;
5533
+ d >= T ? l[b + 1] = p <= T ? -2 : -1 : p >= u && y && (l[b] += y, l[b + 1] += y);
5548
5534
  }
5549
5535
  f += y;
5550
5536
  }), u = t.maps[c].map(u, -1);
5551
5537
  }
5552
- let l = !1;
5553
- for (let c = 0; c < a.length; c += 3)
5554
- if (a[c + 1] < 0) {
5555
- if (a[c + 1] == -2) {
5556
- l = !0, a[c + 1] = -1;
5538
+ let a = !1;
5539
+ for (let c = 0; c < l.length; c += 3)
5540
+ if (l[c + 1] < 0) {
5541
+ if (l[c + 1] == -2) {
5542
+ a = !0, l[c + 1] = -1;
5557
5543
  continue;
5558
5544
  }
5559
5545
  let u = t.map(n[c] + o), f = u - i;
5560
5546
  if (f < 0 || f >= r.content.size) {
5561
- l = !0;
5547
+ a = !0;
5562
5548
  continue;
5563
5549
  }
5564
5550
  let p = t.map(n[c + 1] + o, -1), d = p - i, { index: g, offset: m } = r.content.findIndex(f), y = r.maybeChild(g);
5565
5551
  if (y && m == f && m + y.nodeSize == d) {
5566
- let b = a[c + 2].mapInner(t, y, u + 1, n[c] + o + 1, s);
5567
- b != Q ? (a[c] = f, a[c + 1] = d, a[c + 2] = b) : (a[c + 1] = -2, l = !0);
5552
+ let b = l[c + 2].mapInner(t, y, u + 1, n[c] + o + 1, s);
5553
+ b != Q ? (l[c] = f, l[c + 1] = d, l[c + 2] = b) : (l[c + 1] = -2, a = !0);
5568
5554
  } else
5569
- l = !0;
5555
+ a = !0;
5570
5556
  }
5571
- if (l) {
5572
- let c = Ml(a, n, e, t, i, o, s), u = jn(c, r, 0, s);
5557
+ if (a) {
5558
+ let c = Ma(l, n, e, t, i, o, s), u = jn(c, r, 0, s);
5573
5559
  e = u.local;
5574
- for (let f = 0; f < a.length; f += 3)
5575
- a[f + 1] < 0 && (a.splice(f, 3), f -= 3);
5560
+ for (let f = 0; f < l.length; f += 3)
5561
+ l[f + 1] < 0 && (l.splice(f, 3), f -= 3);
5576
5562
  for (let f = 0, p = 0; f < u.children.length; f += 3) {
5577
5563
  let d = u.children[f];
5578
- for (; p < a.length && a[p] < d; )
5564
+ for (; p < l.length && l[p] < d; )
5579
5565
  p += 3;
5580
- a.splice(p, 0, u.children[f], u.children[f + 1], u.children[f + 2]);
5566
+ l.splice(p, 0, u.children[f], u.children[f + 1], u.children[f + 2]);
5581
5567
  }
5582
5568
  }
5583
- return new W(e.sort(st), a);
5569
+ return new W(e.sort(st), l);
5584
5570
  }
5585
5571
  function cs(n, e) {
5586
5572
  if (!e || !n.length)
@@ -5592,17 +5578,17 @@ function cs(n, e) {
5592
5578
  }
5593
5579
  return t;
5594
5580
  }
5595
- function Ml(n, e, t, r, i, o, s) {
5596
- function a(l, c) {
5597
- for (let u = 0; u < l.local.length; u++) {
5598
- let f = l.local[u].map(r, i, c);
5599
- f ? t.push(f) : s.onRemove && s.onRemove(l.local[u].spec);
5581
+ function Ma(n, e, t, r, i, o, s) {
5582
+ function l(a, c) {
5583
+ for (let u = 0; u < a.local.length; u++) {
5584
+ let f = a.local[u].map(r, i, c);
5585
+ f ? t.push(f) : s.onRemove && s.onRemove(a.local[u].spec);
5600
5586
  }
5601
- for (let u = 0; u < l.children.length; u += 3)
5602
- a(l.children[u + 2], l.children[u] + c + 1);
5587
+ for (let u = 0; u < a.children.length; u += 3)
5588
+ l(a.children[u + 2], a.children[u] + c + 1);
5603
5589
  }
5604
- for (let l = 0; l < n.length; l += 3)
5605
- n[l + 1] == -1 && a(n[l + 2], e[l] + o + 1);
5590
+ for (let a = 0; a < n.length; a += 3)
5591
+ n[a + 1] == -1 && l(n[a + 2], e[a] + o + 1);
5606
5592
  return t;
5607
5593
  }
5608
5594
  function us(n, e, t) {
@@ -5621,17 +5607,17 @@ function fs(n) {
5621
5607
  }
5622
5608
  function jn(n, e, t, r) {
5623
5609
  let i = [], o = !1;
5624
- e.forEach((a, l) => {
5625
- let c = us(n, a, l + t);
5610
+ e.forEach((l, a) => {
5611
+ let c = us(n, l, a + t);
5626
5612
  if (c) {
5627
5613
  o = !0;
5628
- let u = jn(c, a, t + l + 1, r);
5629
- u != Q && i.push(l, l + a.nodeSize, u);
5614
+ let u = jn(c, l, t + a + 1, r);
5615
+ u != Q && i.push(a, a + l.nodeSize, u);
5630
5616
  }
5631
5617
  });
5632
5618
  let s = cs(o ? fs(n) : n, -t).sort(st);
5633
- for (let a = 0; a < s.length; a++)
5634
- s[a].type.valid(e, s[a]) || (r.onRemove && r.onRemove(s[a].spec), s.splice(a--, 1));
5619
+ for (let l = 0; l < s.length; l++)
5620
+ s[l].type.valid(e, s[l]) || (r.onRemove && r.onRemove(s[l].spec), s.splice(l--, 1));
5635
5621
  return s.length || i.length ? new W(s, i) : Q;
5636
5622
  }
5637
5623
  function st(n, e) {
@@ -5671,19 +5657,19 @@ const ps = (n, e, t) => {
5671
5657
  return !1;
5672
5658
  let i = Ur(r);
5673
5659
  if (!i) {
5674
- let s = r.blockRange(), a = s && At(s);
5675
- return a == null ? !1 : (e && e(n.tr.lift(s, a).scrollIntoView()), !0);
5660
+ let s = r.blockRange(), l = s && At(s);
5661
+ return l == null ? !1 : (e && e(n.tr.lift(s, l).scrollIntoView()), !0);
5676
5662
  }
5677
5663
  let o = i.nodeBefore;
5678
5664
  if (ws(n, i, e, -1))
5679
5665
  return !0;
5680
5666
  if (r.parent.content.size == 0 && (Ct(o, "end") || O.isSelectable(o)))
5681
5667
  for (let s = r.depth; ; s--) {
5682
- let a = zr(n.doc, r.before(s), r.after(s), S.empty);
5683
- if (a && a.slice.size < a.to - a.from) {
5668
+ let l = zr(n.doc, r.before(s), r.after(s), S.empty);
5669
+ if (l && l.slice.size < l.to - l.from) {
5684
5670
  if (e) {
5685
- let l = n.tr.step(a);
5686
- l.setSelection(Ct(o, "end") ? D.findFrom(l.doc.resolve(l.mapping.map(i.pos, -1)), -1) : O.create(l.doc, i.pos - o.nodeSize)), e(l.scrollIntoView());
5671
+ let a = n.tr.step(l);
5672
+ a.setSelection(Ct(o, "end") ? D.findFrom(a.doc.resolve(a.mapping.map(i.pos, -1)), -1) : O.create(a.doc, i.pos - o.nodeSize)), e(a.scrollIntoView());
5687
5673
  }
5688
5674
  return !0;
5689
5675
  }
@@ -5691,13 +5677,13 @@ const ps = (n, e, t) => {
5691
5677
  break;
5692
5678
  }
5693
5679
  return o.isAtom && i.depth == r.depth - 1 ? (e && e(n.tr.delete(i.pos - o.nodeSize, i.pos).scrollIntoView()), !0) : !1;
5694
- }, Al = (n, e, t) => {
5680
+ }, Aa = (n, e, t) => {
5695
5681
  let r = ds(n, t);
5696
5682
  if (!r)
5697
5683
  return !1;
5698
5684
  let i = Ur(r);
5699
5685
  return i ? hs(n, i, e) : !1;
5700
- }, Nl = (n, e, t) => {
5686
+ }, Na = (n, e, t) => {
5701
5687
  let r = gs(n, t);
5702
5688
  if (!r)
5703
5689
  return !1;
@@ -5714,17 +5700,17 @@ function hs(n, e, t) {
5714
5700
  return !1;
5715
5701
  i = u;
5716
5702
  }
5717
- let s = e.nodeAfter, a = s, l = e.pos + 1;
5718
- for (; !a.isTextblock; l++) {
5719
- if (a.type.spec.isolating)
5703
+ let s = e.nodeAfter, l = s, a = e.pos + 1;
5704
+ for (; !l.isTextblock; a++) {
5705
+ if (l.type.spec.isolating)
5720
5706
  return !1;
5721
- let u = a.firstChild;
5707
+ let u = l.firstChild;
5722
5708
  if (!u)
5723
5709
  return !1;
5724
- a = u;
5710
+ l = u;
5725
5711
  }
5726
- let c = zr(n.doc, o, l, S.empty);
5727
- if (!c || c.from != o || c instanceof ie && c.slice.size >= l - o)
5712
+ let c = zr(n.doc, o, a, S.empty);
5713
+ if (!c || c.from != o || c instanceof ie && c.slice.size >= a - o)
5728
5714
  return !1;
5729
5715
  if (t) {
5730
5716
  let u = n.tr.step(c);
@@ -5781,8 +5767,8 @@ const ys = (n, e, t) => {
5781
5767
  let s = zr(n.doc, r.before(), r.after(), S.empty);
5782
5768
  if (s && s.slice.size < s.to - s.from) {
5783
5769
  if (e) {
5784
- let a = n.tr.step(s);
5785
- a.setSelection(Ct(o, "start") ? D.findFrom(a.doc.resolve(a.mapping.map(i.pos)), 1) : O.create(a.doc, a.mapping.map(i.pos))), e(a.scrollIntoView());
5770
+ let l = n.tr.step(s);
5771
+ l.setSelection(Ct(o, "start") ? D.findFrom(l.doc.resolve(l.mapping.map(i.pos)), 1) : O.create(l.doc, l.mapping.map(i.pos))), e(l.scrollIntoView());
5786
5772
  }
5787
5773
  return !0;
5788
5774
  }
@@ -5811,7 +5797,7 @@ function Gr(n) {
5811
5797
  }
5812
5798
  return null;
5813
5799
  }
5814
- const Il = (n, e) => {
5800
+ const Ia = (n, e) => {
5815
5801
  let t = n.selection, r = t instanceof O, i;
5816
5802
  if (r) {
5817
5803
  if (t.node.isTextblock || !ut(n.doc, t.from))
@@ -5824,7 +5810,7 @@ const Il = (n, e) => {
5824
5810
  r && o.setSelection(O.create(o.doc, i - n.doc.resolve(i).nodeBefore.nodeSize)), e(o.scrollIntoView());
5825
5811
  }
5826
5812
  return !0;
5827
- }, Dl = (n, e) => {
5813
+ }, Da = (n, e) => {
5828
5814
  let t = n.selection, r;
5829
5815
  if (t instanceof O) {
5830
5816
  if (t.node.isTextblock || !ut(n.doc, t.to))
@@ -5833,7 +5819,7 @@ const Il = (n, e) => {
5833
5819
  } else if (r = Un(n.doc, t.to, 1), r == null)
5834
5820
  return !1;
5835
5821
  return e && e(n.tr.join(r).scrollIntoView()), !0;
5836
- }, Rl = (n, e) => {
5822
+ }, Ra = (n, e) => {
5837
5823
  let { $from: t, $to: r } = n.selection, i = t.blockRange(r), o = i && At(i);
5838
5824
  return o == null ? !1 : (e && e(n.tr.lift(i, o).scrollIntoView()), !0);
5839
5825
  }, bs = (n, e) => {
@@ -5849,7 +5835,7 @@ function Yr(n) {
5849
5835
  }
5850
5836
  return null;
5851
5837
  }
5852
- const Pl = (n, e) => {
5838
+ const Pa = (n, e) => {
5853
5839
  let { $head: t, $anchor: r } = n.selection;
5854
5840
  if (!t.parent.type.spec.code || !t.sameParent(r))
5855
5841
  return !1;
@@ -5857,20 +5843,20 @@ const Pl = (n, e) => {
5857
5843
  if (!s || !i.canReplaceWith(o, o, s))
5858
5844
  return !1;
5859
5845
  if (e) {
5860
- let a = t.after(), l = n.tr.replaceWith(a, a, s.createAndFill());
5861
- l.setSelection(D.near(l.doc.resolve(a), 1)), e(l.scrollIntoView());
5846
+ let l = t.after(), a = n.tr.replaceWith(l, l, s.createAndFill());
5847
+ a.setSelection(D.near(a.doc.resolve(l), 1)), e(a.scrollIntoView());
5862
5848
  }
5863
5849
  return !0;
5864
5850
  }, xs = (n, e) => {
5865
5851
  let t = n.selection, { $from: r, $to: i } = t;
5866
- if (t instanceof ae || r.parent.inlineContent || i.parent.inlineContent)
5852
+ if (t instanceof le || r.parent.inlineContent || i.parent.inlineContent)
5867
5853
  return !1;
5868
5854
  let o = Yr(i.parent.contentMatchAt(i.indexAfter()));
5869
5855
  if (!o || !o.isTextblock)
5870
5856
  return !1;
5871
5857
  if (e) {
5872
- let s = (!r.parentOffset && i.index() < i.parent.childCount ? r : i).pos, a = n.tr.insert(s, o.createAndFill());
5873
- a.setSelection(A.create(a.doc, s + 1)), e(a.scrollIntoView());
5858
+ let s = (!r.parentOffset && i.index() < i.parent.childCount ? r : i).pos, l = n.tr.insert(s, o.createAndFill());
5859
+ l.setSelection(A.create(l.doc, s + 1)), e(l.scrollIntoView());
5874
5860
  }
5875
5861
  return !0;
5876
5862
  }, ks = (n, e) => {
@@ -5885,17 +5871,17 @@ const Pl = (n, e) => {
5885
5871
  let r = t.blockRange(), i = r && At(r);
5886
5872
  return i == null ? !1 : (e && e(n.tr.lift(r, i).scrollIntoView()), !0);
5887
5873
  };
5888
- function Bl(n) {
5874
+ function Ba(n) {
5889
5875
  return (e, t) => {
5890
5876
  let { $from: r, $to: i } = e.selection;
5891
5877
  if (e.selection instanceof O && e.selection.node.isBlock)
5892
5878
  return !r.parentOffset || !Pe(e.doc, r.pos) ? !1 : (t && t(e.tr.split(r.pos).scrollIntoView()), !0);
5893
5879
  if (!r.depth)
5894
5880
  return !1;
5895
- let o = [], s, a, l = !1, c = !1;
5881
+ let o = [], s, l, a = !1, c = !1;
5896
5882
  for (let d = r.depth; ; d--)
5897
5883
  if (r.node(d).isBlock) {
5898
- l = r.end(d) == r.pos + (r.depth - d), c = r.start(d) == r.pos - (r.depth - d), a = Yr(r.node(d - 1).contentMatchAt(r.indexAfter(d - 1))), o.unshift(l && a ? { type: a } : null), s = d;
5884
+ a = r.end(d) == r.pos + (r.depth - d), c = r.start(d) == r.pos - (r.depth - d), l = Yr(r.node(d - 1).contentMatchAt(r.indexAfter(d - 1))), o.unshift(a && l ? { type: l } : null), s = d;
5899
5885
  break;
5900
5886
  } else {
5901
5887
  if (d == 1)
@@ -5903,31 +5889,31 @@ function Bl(n) {
5903
5889
  o.unshift(null);
5904
5890
  }
5905
5891
  let u = e.tr;
5906
- (e.selection instanceof A || e.selection instanceof ae) && u.deleteSelection();
5892
+ (e.selection instanceof A || e.selection instanceof le) && u.deleteSelection();
5907
5893
  let f = u.mapping.map(r.pos), p = Pe(u.doc, f, o.length, o);
5908
- if (p || (o[0] = a ? { type: a } : null, p = Pe(u.doc, f, o.length, o)), !p)
5894
+ if (p || (o[0] = l ? { type: l } : null, p = Pe(u.doc, f, o.length, o)), !p)
5909
5895
  return !1;
5910
- if (u.split(f, o.length, o), !l && c && r.node(s).type != a) {
5896
+ if (u.split(f, o.length, o), !a && c && r.node(s).type != l) {
5911
5897
  let d = u.mapping.map(r.before(s)), g = u.doc.resolve(d);
5912
- a && r.node(s - 1).canReplaceWith(g.index(), g.index() + 1, a) && u.setNodeMarkup(u.mapping.map(r.before(s)), a);
5898
+ l && r.node(s - 1).canReplaceWith(g.index(), g.index() + 1, l) && u.setNodeMarkup(u.mapping.map(r.before(s)), l);
5913
5899
  }
5914
5900
  return t && t(u.scrollIntoView()), !0;
5915
5901
  };
5916
5902
  }
5917
- const zl = Bl(), Fl = (n, e) => {
5903
+ const za = Ba(), Fa = (n, e) => {
5918
5904
  let { $from: t, to: r } = n.selection, i, o = t.sharedDepth(r);
5919
5905
  return o == 0 ? !1 : (i = t.before(o), e && e(n.tr.setSelection(O.create(n.doc, i))), !0);
5920
5906
  };
5921
- function Ll(n, e, t) {
5907
+ function La(n, e, t) {
5922
5908
  let r = e.nodeBefore, i = e.nodeAfter, o = e.index();
5923
5909
  return !r || !i || !r.type.compatibleContent(i.type) ? !1 : !r.content.size && e.parent.canReplace(o - 1, o) ? (t && t(n.tr.delete(e.pos - r.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(o, o + 1) || !(i.isTextblock || ut(n.doc, e.pos)) ? !1 : (t && t(n.tr.join(e.pos).scrollIntoView()), !0);
5924
5910
  }
5925
5911
  function ws(n, e, t, r) {
5926
- let i = e.nodeBefore, o = e.nodeAfter, s, a, l = i.type.spec.isolating || o.type.spec.isolating;
5927
- if (!l && Ll(n, e, t))
5912
+ let i = e.nodeBefore, o = e.nodeAfter, s, l, a = i.type.spec.isolating || o.type.spec.isolating;
5913
+ if (!a && La(n, e, t))
5928
5914
  return !0;
5929
- let c = !l && e.parent.canReplace(e.index(), e.index() + 1);
5930
- if (c && (s = (a = i.contentMatchAt(i.childCount)).findWrapping(o.type)) && a.matchType(s[0] || o.type).validEnd) {
5915
+ let c = !a && e.parent.canReplace(e.index(), e.index() + 1);
5916
+ if (c && (s = (l = i.contentMatchAt(i.childCount)).findWrapping(o.type)) && l.matchType(s[0] || o.type).validEnd) {
5931
5917
  if (t) {
5932
5918
  let d = e.pos + o.nodeSize, g = k.empty;
5933
5919
  for (let b = s.length - 1; b >= 0; b--)
@@ -5938,7 +5924,7 @@ function ws(n, e, t, r) {
5938
5924
  }
5939
5925
  return !0;
5940
5926
  }
5941
- let u = o.type.spec.isolating || r > 0 && l ? null : D.findFrom(e, 1), f = u && u.$from.blockRange(u.$to), p = f && At(f);
5927
+ let u = o.type.spec.isolating || r > 0 && a ? null : D.findFrom(e, 1), f = u && u.$from.blockRange(u.$to), p = f && At(f);
5942
5928
  if (p != null && p >= e.depth)
5943
5929
  return t && t(n.tr.lift(f, p).scrollIntoView()), !0;
5944
5930
  if (c && Ct(o, "start", !0) && Ct(i, "end")) {
@@ -5972,23 +5958,23 @@ function Ss(n) {
5972
5958
  return i.node(o).isTextblock ? (t && t(e.tr.setSelection(A.create(e.doc, n < 0 ? i.start(o) : i.end(o)))), !0) : !1;
5973
5959
  };
5974
5960
  }
5975
- const $l = Ss(-1), Vl = Ss(1);
5976
- function jl(n, e = null) {
5961
+ const $a = Ss(-1), Va = Ss(1);
5962
+ function ja(n, e = null) {
5977
5963
  return function(t, r) {
5978
- let { $from: i, $to: o } = t.selection, s = i.blockRange(o), a = s && zo(s, n, e);
5979
- return a ? (r && r(t.tr.wrap(s, a).scrollIntoView()), !0) : !1;
5964
+ let { $from: i, $to: o } = t.selection, s = i.blockRange(o), l = s && zo(s, n, e);
5965
+ return l ? (r && r(t.tr.wrap(s, l).scrollIntoView()), !0) : !1;
5980
5966
  };
5981
5967
  }
5982
5968
  function Hi(n, e = null) {
5983
5969
  return function(t, r) {
5984
5970
  let i = !1;
5985
5971
  for (let o = 0; o < t.selection.ranges.length && !i; o++) {
5986
- let { $from: { pos: s }, $to: { pos: a } } = t.selection.ranges[o];
5987
- t.doc.nodesBetween(s, a, (l, c) => {
5972
+ let { $from: { pos: s }, $to: { pos: l } } = t.selection.ranges[o];
5973
+ t.doc.nodesBetween(s, l, (a, c) => {
5988
5974
  if (i)
5989
5975
  return !1;
5990
- if (!(!l.isTextblock || l.hasMarkup(n, e)))
5991
- if (l.type == n)
5976
+ if (!(!a.isTextblock || a.hasMarkup(n, e)))
5977
+ if (a.type == n)
5992
5978
  i = !0;
5993
5979
  else {
5994
5980
  let u = t.doc.resolve(c), f = u.index();
@@ -6001,8 +5987,8 @@ function Hi(n, e = null) {
6001
5987
  if (r) {
6002
5988
  let o = t.tr;
6003
5989
  for (let s = 0; s < t.selection.ranges.length; s++) {
6004
- let { $from: { pos: a }, $to: { pos: l } } = t.selection.ranges[s];
6005
- o.setBlockType(a, l, n, e);
5990
+ let { $from: { pos: l }, $to: { pos: a } } = t.selection.ranges[s];
5991
+ o.setBlockType(l, a, n, e);
6006
5992
  }
6007
5993
  r(o.scrollIntoView());
6008
5994
  }
@@ -6019,29 +6005,29 @@ function Xr(...n) {
6019
6005
  }
6020
6006
  Xr(Kr, ps, ms);
6021
6007
  Xr(Kr, ys, vs);
6022
- Xr(bs, xs, ks, zl);
6008
+ Xr(bs, xs, ks, za);
6023
6009
  typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
6024
- function Wl(n, e = null) {
6010
+ function Wa(n, e = null) {
6025
6011
  return function(t, r) {
6026
6012
  let { $from: i, $to: o } = t.selection, s = i.blockRange(o);
6027
6013
  if (!s)
6028
6014
  return !1;
6029
- let a = r ? t.tr : null;
6030
- return Hl(a, s, n, e) ? (r && r(a.scrollIntoView()), !0) : !1;
6015
+ let l = r ? t.tr : null;
6016
+ return Ha(l, s, n, e) ? (r && r(l.scrollIntoView()), !0) : !1;
6031
6017
  };
6032
6018
  }
6033
- function Hl(n, e, t, r = null) {
6019
+ function Ha(n, e, t, r = null) {
6034
6020
  let i = !1, o = e, s = e.$from.doc;
6035
6021
  if (e.depth >= 2 && e.$from.node(e.depth - 1).type.compatibleContent(t) && e.startIndex == 0) {
6036
6022
  if (e.$from.index(e.depth - 1) == 0)
6037
6023
  return !1;
6038
- let l = s.resolve(e.start - 2);
6039
- o = new Pn(l, l, e.depth), e.endIndex < e.parent.childCount && (e = new Pn(e.$from, s.resolve(e.$to.end(e.depth)), e.depth)), i = !0;
6024
+ let a = s.resolve(e.start - 2);
6025
+ o = new Pn(a, a, e.depth), e.endIndex < e.parent.childCount && (e = new Pn(e.$from, s.resolve(e.$to.end(e.depth)), e.depth)), i = !0;
6040
6026
  }
6041
- let a = zo(o, t, r, e);
6042
- return a ? (n && Jl(n, e, a, i, t), !0) : !1;
6027
+ let l = zo(o, t, r, e);
6028
+ return l ? (n && Ja(n, e, l, i, t), !0) : !1;
6043
6029
  }
6044
- function Jl(n, e, t, r, i) {
6030
+ function Ja(n, e, t, r, i) {
6045
6031
  let o = k.empty;
6046
6032
  for (let u = t.length - 1; u >= 0; u--)
6047
6033
  o = k.from(t[u].type.create(t[u].attrs, o));
@@ -6049,41 +6035,41 @@ function Jl(n, e, t, r, i) {
6049
6035
  let s = 0;
6050
6036
  for (let u = 0; u < t.length; u++)
6051
6037
  t[u].type == i && (s = u + 1);
6052
- let a = t.length - s, l = e.start + t.length - (r ? 2 : 0), c = e.parent;
6038
+ let l = t.length - s, a = e.start + t.length - (r ? 2 : 0), c = e.parent;
6053
6039
  for (let u = e.startIndex, f = e.endIndex, p = !0; u < f; u++, p = !1)
6054
- !p && Pe(n.doc, l, a) && (n.split(l, a), l += 2 * a), l += c.child(u).nodeSize;
6040
+ !p && Pe(n.doc, a, l) && (n.split(a, l), a += 2 * l), a += c.child(u).nodeSize;
6055
6041
  return n;
6056
6042
  }
6057
- function ql(n) {
6043
+ function qa(n) {
6058
6044
  return function(e, t) {
6059
6045
  let { $from: r, $to: i } = e.selection, o = r.blockRange(i, (s) => s.childCount > 0 && s.firstChild.type == n);
6060
- return o ? t ? r.node(o.depth - 1).type == n ? Kl(e, t, n, o) : Ul(e, t, o) : !0 : !1;
6046
+ return o ? t ? r.node(o.depth - 1).type == n ? Ka(e, t, n, o) : Ua(e, t, o) : !0 : !1;
6061
6047
  };
6062
6048
  }
6063
- function Kl(n, e, t, r) {
6049
+ function Ka(n, e, t, r) {
6064
6050
  let i = n.tr, o = r.end, s = r.$to.end(r.depth);
6065
6051
  o < s && (i.step(new _(o - 1, s, o, s, new S(k.from(t.create(null, r.parent.copy())), 1, 0), 1, !0)), r = new Pn(i.doc.resolve(r.$from.pos), i.doc.resolve(s), r.depth));
6066
- const a = At(r);
6067
- if (a == null)
6052
+ const l = At(r);
6053
+ if (l == null)
6068
6054
  return !1;
6069
- i.lift(r, a);
6070
- let l = i.doc.resolve(i.mapping.map(o, -1) - 1);
6071
- return ut(i.doc, l.pos) && l.nodeBefore.type == l.nodeAfter.type && i.join(l.pos), e(i.scrollIntoView()), !0;
6055
+ i.lift(r, l);
6056
+ let a = i.doc.resolve(i.mapping.map(o, -1) - 1);
6057
+ return ut(i.doc, a.pos) && a.nodeBefore.type == a.nodeAfter.type && i.join(a.pos), e(i.scrollIntoView()), !0;
6072
6058
  }
6073
- function Ul(n, e, t) {
6059
+ function Ua(n, e, t) {
6074
6060
  let r = n.tr, i = t.parent;
6075
6061
  for (let d = t.end, g = t.endIndex - 1, m = t.startIndex; g > m; g--)
6076
6062
  d -= i.child(g).nodeSize, r.delete(d - 1, d + 1);
6077
6063
  let o = r.doc.resolve(t.start), s = o.nodeAfter;
6078
6064
  if (r.mapping.map(t.end) != t.start + o.nodeAfter.nodeSize)
6079
6065
  return !1;
6080
- let a = t.startIndex == 0, l = t.endIndex == i.childCount, c = o.node(-1), u = o.index(-1);
6081
- if (!c.canReplace(u + (a ? 0 : 1), u + 1, s.content.append(l ? k.empty : k.from(i))))
6066
+ let l = t.startIndex == 0, a = t.endIndex == i.childCount, c = o.node(-1), u = o.index(-1);
6067
+ if (!c.canReplace(u + (l ? 0 : 1), u + 1, s.content.append(a ? k.empty : k.from(i))))
6082
6068
  return !1;
6083
6069
  let f = o.pos, p = f + s.nodeSize;
6084
- return r.step(new _(f - (a ? 1 : 0), p + (l ? 1 : 0), f + 1, p - 1, new S((a ? k.empty : k.from(i.copy(k.empty))).append(l ? k.empty : k.from(i.copy(k.empty))), a ? 0 : 1, l ? 0 : 1), a ? 0 : 1)), e(r.scrollIntoView()), !0;
6070
+ return r.step(new _(f - (l ? 1 : 0), p + (a ? 1 : 0), f + 1, p - 1, new S((l ? k.empty : k.from(i.copy(k.empty))).append(a ? k.empty : k.from(i.copy(k.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), e(r.scrollIntoView()), !0;
6085
6071
  }
6086
- function Gl(n) {
6072
+ function Ga(n) {
6087
6073
  return function(e, t) {
6088
6074
  let { $from: r, $to: i } = e.selection, o = r.blockRange(i, (c) => c.childCount > 0 && c.firstChild.type == n);
6089
6075
  if (!o)
@@ -6091,11 +6077,11 @@ function Gl(n) {
6091
6077
  let s = o.startIndex;
6092
6078
  if (s == 0)
6093
6079
  return !1;
6094
- let a = o.parent, l = a.child(s - 1);
6095
- if (l.type != n)
6080
+ let l = o.parent, a = l.child(s - 1);
6081
+ if (a.type != n)
6096
6082
  return !1;
6097
6083
  if (t) {
6098
- let c = l.lastChild && l.lastChild.type == a.type, u = k.from(c ? n.create() : null), f = new S(k.from(n.create(null, k.from(a.type.create(null, u)))), c ? 3 : 1, 0), p = o.start, d = o.end;
6084
+ let c = a.lastChild && a.lastChild.type == l.type, u = k.from(c ? n.create() : null), f = new S(k.from(n.create(null, k.from(l.type.create(null, u)))), c ? 3 : 1, 0), p = o.start, d = o.end;
6099
6085
  t(e.tr.step(new _(p - (c ? 3 : 1), d, p, d, f, 1, !0)).scrollIntoView());
6100
6086
  }
6101
6087
  return !0;
@@ -6126,7 +6112,7 @@ function Cs(n) {
6126
6112
  }
6127
6113
  };
6128
6114
  }
6129
- class Yl {
6115
+ class Ya {
6130
6116
  constructor(e) {
6131
6117
  this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
6132
6118
  }
@@ -6138,8 +6124,8 @@ class Yl {
6138
6124
  }
6139
6125
  get commands() {
6140
6126
  const { rawCommands: e, editor: t, state: r } = this, { view: i } = t, { tr: o } = r, s = this.buildProps(o);
6141
- return Object.fromEntries(Object.entries(e).map(([a, l]) => [a, (...u) => {
6142
- const f = l(...u)(s);
6127
+ return Object.fromEntries(Object.entries(e).map(([l, a]) => [l, (...u) => {
6128
+ const f = a(...u)(s);
6143
6129
  return !o.getMeta("preventDispatch") && !this.hasCustomState && i.dispatch(o), f;
6144
6130
  }]));
6145
6131
  }
@@ -6150,10 +6136,10 @@ class Yl {
6150
6136
  return () => this.createCan();
6151
6137
  }
6152
6138
  createChain(e, t = !0) {
6153
- const { rawCommands: r, editor: i, state: o } = this, { view: s } = i, a = [], l = !!e, c = e || o.tr, u = () => (!l && t && !c.getMeta("preventDispatch") && !this.hasCustomState && s.dispatch(c), a.every((p) => p === !0)), f = {
6139
+ const { rawCommands: r, editor: i, state: o } = this, { view: s } = i, l = [], a = !!e, c = e || o.tr, u = () => (!a && t && !c.getMeta("preventDispatch") && !this.hasCustomState && s.dispatch(c), l.every((p) => p === !0)), f = {
6154
6140
  ...Object.fromEntries(Object.entries(r).map(([p, d]) => [p, (...m) => {
6155
6141
  const y = this.buildProps(c, t), b = d(...m)(y);
6156
- return a.push(b), f;
6142
+ return l.push(b), f;
6157
6143
  }])),
6158
6144
  run: u
6159
6145
  };
@@ -6162,12 +6148,12 @@ class Yl {
6162
6148
  createCan(e) {
6163
6149
  const { rawCommands: t, state: r } = this, i = !1, o = e || r.tr, s = this.buildProps(o, i);
6164
6150
  return {
6165
- ...Object.fromEntries(Object.entries(t).map(([l, c]) => [l, (...u) => c(...u)({ ...s, dispatch: void 0 })])),
6151
+ ...Object.fromEntries(Object.entries(t).map(([a, c]) => [a, (...u) => c(...u)({ ...s, dispatch: void 0 })])),
6166
6152
  chain: () => this.createChain(o, i)
6167
6153
  };
6168
6154
  }
6169
6155
  buildProps(e, t = !0) {
6170
- const { rawCommands: r, editor: i, state: o } = this, { view: s } = i, a = {
6156
+ const { rawCommands: r, editor: i, state: o } = this, { view: s } = i, l = {
6171
6157
  tr: e,
6172
6158
  editor: i,
6173
6159
  view: s,
@@ -6180,10 +6166,10 @@ class Yl {
6180
6166
  chain: () => this.createChain(e, t),
6181
6167
  can: () => this.createCan(e),
6182
6168
  get commands() {
6183
- return Object.fromEntries(Object.entries(r).map(([l, c]) => [l, (...u) => c(...u)(a)]));
6169
+ return Object.fromEntries(Object.entries(r).map(([a, c]) => [a, (...u) => c(...u)(l)]));
6184
6170
  }
6185
6171
  };
6186
- return a;
6172
+ return l;
6187
6173
  }
6188
6174
  }
6189
6175
  function Z(n, e, t) {
@@ -6192,7 +6178,7 @@ function Z(n, e, t) {
6192
6178
  parent: n.parent ? Z(n.parent, e, t) : null
6193
6179
  }) : n.config[e];
6194
6180
  }
6195
- function Xl(n) {
6181
+ function Xa(n) {
6196
6182
  const e = n.filter((i) => i.type === "extension"), t = n.filter((i) => i.type === "node"), r = n.filter((i) => i.type === "mark");
6197
6183
  return {
6198
6184
  baseExtensions: e,
@@ -6217,14 +6203,14 @@ function Qn(...n) {
6217
6203
  return;
6218
6204
  }
6219
6205
  if (i === "class") {
6220
- const a = o ? String(o).split(" ") : [], l = r[i] ? r[i].split(" ") : [], c = a.filter((u) => !l.includes(u));
6221
- r[i] = [...l, ...c].join(" ");
6206
+ const l = o ? String(o).split(" ") : [], a = r[i] ? r[i].split(" ") : [], c = l.filter((u) => !a.includes(u));
6207
+ r[i] = [...a, ...c].join(" ");
6222
6208
  } else if (i === "style") {
6223
- const a = o ? o.split(";").map((u) => u.trim()).filter(Boolean) : [], l = r[i] ? r[i].split(";").map((u) => u.trim()).filter(Boolean) : [], c = /* @__PURE__ */ new Map();
6224
- l.forEach((u) => {
6209
+ const l = o ? o.split(";").map((u) => u.trim()).filter(Boolean) : [], a = r[i] ? r[i].split(";").map((u) => u.trim()).filter(Boolean) : [], c = /* @__PURE__ */ new Map();
6210
+ a.forEach((u) => {
6225
6211
  const [f, p] = u.split(":").map((d) => d.trim());
6226
6212
  c.set(f, p);
6227
- }), a.forEach((u) => {
6213
+ }), l.forEach((u) => {
6228
6214
  const [f, p] = u.split(":").map((d) => d.trim());
6229
6215
  c.set(f, p);
6230
6216
  }), r[i] = Array.from(c.entries()).map(([u, f]) => `${u}: ${f}`).join("; ");
@@ -6233,13 +6219,13 @@ function Qn(...n) {
6233
6219
  }), r;
6234
6220
  }, {});
6235
6221
  }
6236
- function Ql(n) {
6222
+ function Qa(n) {
6237
6223
  return typeof n == "function";
6238
6224
  }
6239
6225
  function U(n, e = void 0, ...t) {
6240
- return Ql(n) ? e ? n.bind(e)(...t) : n(...t) : n;
6226
+ return Qa(n) ? e ? n.bind(e)(...t) : n(...t) : n;
6241
6227
  }
6242
- function Zl(n) {
6228
+ function Za(n) {
6243
6229
  return Object.prototype.toString.call(n) === "[object RegExp]";
6244
6230
  }
6245
6231
  class Os {
@@ -6247,11 +6233,11 @@ class Os {
6247
6233
  this.find = e.find, this.handler = e.handler;
6248
6234
  }
6249
6235
  }
6250
- function _l(n) {
6236
+ function _a(n) {
6251
6237
  return Object.prototype.toString.call(n).slice(8, -1);
6252
6238
  }
6253
6239
  function Sn(n) {
6254
- return _l(n) !== "Object" ? !1 : n.constructor === Object && Object.getPrototypeOf(n) === Object.prototype;
6240
+ return _a(n) !== "Object" ? !1 : n.constructor === Object && Object.getPrototypeOf(n) === Object.prototype;
6255
6241
  }
6256
6242
  function Zn(n, e) {
6257
6243
  const t = { ...n };
@@ -6297,10 +6283,10 @@ class Qt {
6297
6283
  const { tr: r } = e.state, i = e.state.selection.$from;
6298
6284
  if (i.pos === i.end()) {
6299
6285
  const s = i.marks();
6300
- if (!!!s.find((c) => (c == null ? void 0 : c.type.name) === t.name))
6286
+ if (!!!s.find((c) => c?.type.name === t.name))
6301
6287
  return !1;
6302
- const l = s.find((c) => (c == null ? void 0 : c.type.name) === t.name);
6303
- return l && r.removeStoredMark(l), r.insertText(" ", i.pos), e.view.dispatch(r), !0;
6288
+ const a = s.find((c) => c?.type.name === t.name);
6289
+ return a && r.removeStoredMark(a), r.insertText(" ", i.pos), e.view.dispatch(r), !0;
6304
6290
  }
6305
6291
  return !1;
6306
6292
  }
@@ -6349,21 +6335,21 @@ function tc(n, e, t) {
6349
6335
  const { from: r, to: i } = e, { blockSeparator: o = `
6350
6336
 
6351
6337
  `, textSerializers: s = {} } = t || {};
6352
- let a = "";
6353
- return n.nodesBetween(r, i, (l, c, u, f) => {
6338
+ let l = "";
6339
+ return n.nodesBetween(r, i, (a, c, u, f) => {
6354
6340
  var p;
6355
- l.isBlock && c > r && (a += o);
6356
- const d = s == null ? void 0 : s[l.type.name];
6341
+ a.isBlock && c > r && (l += o);
6342
+ const d = s?.[a.type.name];
6357
6343
  if (d)
6358
- return u && (a += d({
6359
- node: l,
6344
+ return u && (l += d({
6345
+ node: a,
6360
6346
  pos: c,
6361
6347
  parent: u,
6362
6348
  index: f,
6363
6349
  range: e
6364
6350
  })), !1;
6365
- l.isText && (a += (p = l == null ? void 0 : l.text) === null || p === void 0 ? void 0 : p.slice(Math.max(r, c) - c, i - c));
6366
- }), a;
6351
+ a.isText && (l += (p = a?.text) === null || p === void 0 ? void 0 : p.slice(Math.max(r, c) - c, i - c));
6352
+ }), l;
6367
6353
  }
6368
6354
  function nc(n) {
6369
6355
  return Object.fromEntries(Object.entries(n.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
@@ -6381,10 +6367,10 @@ ce.create({
6381
6367
  key: new ye("clipboardTextSerializer"),
6382
6368
  props: {
6383
6369
  clipboardTextSerializer: () => {
6384
- const { editor: n } = this, { state: e, schema: t } = n, { doc: r, selection: i } = e, { ranges: o } = i, s = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), l = nc(t);
6385
- return tc(r, { from: s, to: a }, {
6370
+ const { editor: n } = this, { state: e, schema: t } = n, { doc: r, selection: i } = e, { ranges: o } = i, s = Math.min(...o.map((u) => u.$from.pos)), l = Math.max(...o.map((u) => u.$to.pos)), a = nc(t);
6371
+ return tc(r, { from: s, to: l }, {
6386
6372
  ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
6387
- textSerializers: l
6373
+ textSerializers: a
6388
6374
  });
6389
6375
  }
6390
6376
  }
@@ -6394,25 +6380,25 @@ ce.create({
6394
6380
  });
6395
6381
  const rc = () => ({ editor: n, view: e }) => (requestAnimationFrame(() => {
6396
6382
  var t;
6397
- n.isDestroyed || (e.dom.blur(), (t = window == null ? void 0 : window.getSelection()) === null || t === void 0 || t.removeAllRanges());
6383
+ n.isDestroyed || (e.dom.blur(), (t = window?.getSelection()) === null || t === void 0 || t.removeAllRanges());
6398
6384
  }), !0), ic = (n = !1) => ({ commands: e }) => e.setContent("", n), oc = () => ({ state: n, tr: e, dispatch: t }) => {
6399
6385
  const { selection: r } = e, { ranges: i } = r;
6400
6386
  return t && i.forEach(({ $from: o, $to: s }) => {
6401
- n.doc.nodesBetween(o.pos, s.pos, (a, l) => {
6402
- if (a.type.isText)
6387
+ n.doc.nodesBetween(o.pos, s.pos, (l, a) => {
6388
+ if (l.type.isText)
6403
6389
  return;
6404
- const { doc: c, mapping: u } = e, f = c.resolve(u.map(l)), p = c.resolve(u.map(l + a.nodeSize)), d = f.blockRange(p);
6390
+ const { doc: c, mapping: u } = e, f = c.resolve(u.map(a)), p = c.resolve(u.map(a + l.nodeSize)), d = f.blockRange(p);
6405
6391
  if (!d)
6406
6392
  return;
6407
6393
  const g = At(d);
6408
- if (a.type.isTextblock) {
6394
+ if (l.type.isTextblock) {
6409
6395
  const { defaultType: m } = f.parent.contentMatchAt(f.index());
6410
6396
  e.setNodeMarkup(d.start, m);
6411
6397
  }
6412
6398
  (g || g === 0) && e.lift(d, g);
6413
6399
  });
6414
6400
  }), !0;
6415
- }, sc = (n) => (e) => n(e), ac = () => ({ state: n, dispatch: e }) => xs(n, e), lc = (n, e) => ({ editor: t, tr: r }) => {
6401
+ }, sc = (n) => (e) => n(e), lc = () => ({ state: n, dispatch: e }) => xs(n, e), ac = (n, e) => ({ editor: t, tr: r }) => {
6416
6402
  const { state: i } = t, o = i.doc.slice(n.from, n.to);
6417
6403
  r.deleteRange(n.from, n.to);
6418
6404
  const s = r.mapping.map(e);
@@ -6425,8 +6411,8 @@ const rc = () => ({ editor: n, view: e }) => (requestAnimationFrame(() => {
6425
6411
  for (let o = i.depth; o > 0; o -= 1)
6426
6412
  if (i.node(o).type === r.type) {
6427
6413
  if (e) {
6428
- const a = i.before(o), l = i.after(o);
6429
- n.delete(a, l).scrollIntoView();
6414
+ const l = i.before(o), a = i.after(o);
6415
+ n.delete(l, a).scrollIntoView();
6430
6416
  }
6431
6417
  return !0;
6432
6418
  }
@@ -6436,8 +6422,8 @@ const rc = () => ({ editor: n, view: e }) => (requestAnimationFrame(() => {
6436
6422
  for (let s = o.depth; s > 0; s -= 1)
6437
6423
  if (o.node(s).type === i) {
6438
6424
  if (r) {
6439
- const l = o.before(s), c = o.after(s);
6440
- e.delete(l, c).scrollIntoView();
6425
+ const a = o.before(s), c = o.after(s);
6426
+ e.delete(a, c).scrollIntoView();
6441
6427
  }
6442
6428
  return !0;
6443
6429
  }
@@ -6445,10 +6431,10 @@ const rc = () => ({ editor: n, view: e }) => (requestAnimationFrame(() => {
6445
6431
  }, fc = (n) => ({ tr: e, dispatch: t }) => {
6446
6432
  const { from: r, to: i } = n;
6447
6433
  return t && e.delete(r, i), !0;
6448
- }, dc = () => ({ state: n, dispatch: e }) => Kr(n, e), pc = () => ({ commands: n }) => n.keyboardShortcut("Enter"), hc = () => ({ state: n, dispatch: e }) => Pl(n, e);
6434
+ }, dc = () => ({ state: n, dispatch: e }) => Kr(n, e), pc = () => ({ commands: n }) => n.keyboardShortcut("Enter"), hc = () => ({ state: n, dispatch: e }) => Pa(n, e);
6449
6435
  function Wn(n, e, t = { strict: !0 }) {
6450
6436
  const r = Object.keys(e);
6451
- return r.length ? r.every((i) => t.strict ? e[i] === n[i] : Zl(e[i]) ? e[i].test(n[i]) : e[i] === n[i]) : !0;
6437
+ return r.length ? r.every((i) => t.strict ? e[i] === n[i] : Za(e[i]) ? e[i].test(n[i]) : e[i] === n[i]) : !0;
6452
6438
  }
6453
6439
  function Es(n, e, t = {}) {
6454
6440
  return n.find((r) => r.type === e && Wn(
@@ -6467,13 +6453,13 @@ function Qr(n, e, t) {
6467
6453
  let i = n.parent.childAfter(n.parentOffset);
6468
6454
  if ((!i.node || !i.node.marks.some((u) => u.type === e)) && (i = n.parent.childBefore(n.parentOffset)), !i.node || !i.node.marks.some((u) => u.type === e) || (t = t || ((r = i.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs), !Es([...i.node.marks], e, t)))
6469
6455
  return;
6470
- let s = i.index, a = n.start() + i.offset, l = s + 1, c = a + i.node.nodeSize;
6456
+ let s = i.index, l = n.start() + i.offset, a = s + 1, c = l + i.node.nodeSize;
6471
6457
  for (; s > 0 && Ji([...n.parent.child(s - 1).marks], e, t); )
6472
- s -= 1, a -= n.parent.child(s).nodeSize;
6473
- for (; l < n.parent.childCount && Ji([...n.parent.child(l).marks], e, t); )
6474
- c += n.parent.child(l).nodeSize, l += 1;
6458
+ s -= 1, l -= n.parent.child(s).nodeSize;
6459
+ for (; a < n.parent.childCount && Ji([...n.parent.child(a).marks], e, t); )
6460
+ c += n.parent.child(a).nodeSize, a += 1;
6475
6461
  return {
6476
- from: a,
6462
+ from: l,
6477
6463
  to: c
6478
6464
  };
6479
6465
  }
@@ -6486,9 +6472,9 @@ function He(n, e) {
6486
6472
  return n;
6487
6473
  }
6488
6474
  const mc = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
6489
- const o = He(n, r.schema), { doc: s, selection: a } = t, { $from: l, from: c, to: u } = a;
6475
+ const o = He(n, r.schema), { doc: s, selection: l } = t, { $from: a, from: c, to: u } = l;
6490
6476
  if (i) {
6491
- const f = Qr(l, o, e);
6477
+ const f = Qr(a, o, e);
6492
6478
  if (f && f.from <= c && f.to >= u) {
6493
6479
  const p = A.create(s, f.from, f.to);
6494
6480
  t.setSelection(p);
@@ -6539,15 +6525,15 @@ const bc = (n = null, e = {}) => ({ editor: t, view: r, tr: i, dispatch: o }) =>
6539
6525
  };
6540
6526
  const s = () => {
6541
6527
  (_r() || vc()) && r.dom.focus(), requestAnimationFrame(() => {
6542
- t.isDestroyed || (r.focus(), e != null && e.scrollIntoView && t.commands.scrollIntoView());
6528
+ t.isDestroyed || (r.focus(), e?.scrollIntoView && t.commands.scrollIntoView());
6543
6529
  });
6544
6530
  };
6545
6531
  if (r.hasFocus() && n === null || n === !1)
6546
6532
  return !0;
6547
6533
  if (o && n === null && !Zr(t.state.selection))
6548
6534
  return s(), !0;
6549
- const a = yc(i.doc, n) || t.state.selection, l = t.state.selection.eq(a);
6550
- return o && (l || i.setSelection(a), l && i.storedMarks && i.setStoredMarks(i.storedMarks), s()), !0;
6535
+ const l = yc(i.doc, n) || t.state.selection, a = t.state.selection.eq(l);
6536
+ return o && (a || i.setSelection(l), a && i.storedMarks && i.setStoredMarks(i.storedMarks), s()), !0;
6551
6537
  }, xc = (n, e) => (t) => n.every((r, i) => e(r, { ...t, index: i })), kc = (n, e) => ({ tr: t, commands: r }) => r.insertContentAt({ from: t.selection.from, to: t.selection.to }, n, e), Ts = (n) => {
6552
6538
  const e = n.childNodes;
6553
6539
  for (let t = e.length - 1; t >= 0; t -= 1) {
@@ -6572,7 +6558,7 @@ function Zt(n, e, t) {
6572
6558
  if (r)
6573
6559
  try {
6574
6560
  if (Array.isArray(n) && n.length > 0)
6575
- return k.fromArray(n.map((a) => e.nodeFromJSON(a)));
6561
+ return k.fromArray(n.map((l) => e.nodeFromJSON(l)));
6576
6562
  const s = e.nodeFromJSON(n);
6577
6563
  return t.errorOnInvalidContent && s.check(), s;
6578
6564
  } catch (o) {
@@ -6582,8 +6568,8 @@ function Zt(n, e, t) {
6582
6568
  }
6583
6569
  if (i) {
6584
6570
  if (t.errorOnInvalidContent) {
6585
- let s = !1, a = "";
6586
- const l = new Sa({
6571
+ let s = !1, l = "";
6572
+ const a = new Sl({
6587
6573
  topNode: e.spec.topNode,
6588
6574
  marks: e.spec.marks,
6589
6575
  // Prosemirror's schemas are executed such that: the last to execute, matches last
@@ -6595,14 +6581,14 @@ function Zt(n, e, t) {
6595
6581
  parseDOM: [
6596
6582
  {
6597
6583
  tag: "*",
6598
- getAttrs: (c) => (s = !0, a = typeof c == "string" ? c : c.outerHTML, null)
6584
+ getAttrs: (c) => (s = !0, l = typeof c == "string" ? c : c.outerHTML, null)
6599
6585
  }
6600
6586
  ]
6601
6587
  }
6602
6588
  })
6603
6589
  });
6604
- if (t.slice ? it.fromSchema(l).parseSlice(Cn(n), t.parseOptions) : it.fromSchema(l).parse(Cn(n), t.parseOptions), t.errorOnInvalidContent && s)
6605
- throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${a}`) });
6590
+ if (t.slice ? it.fromSchema(a).parseSlice(Cn(n), t.parseOptions) : it.fromSchema(a).parse(Cn(n), t.parseOptions), t.errorOnInvalidContent && s)
6591
+ throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${l}`) });
6606
6592
  }
6607
6593
  const o = it.fromSchema(e);
6608
6594
  return t.slice ? o.parseSlice(Cn(n), t.parseOptions).content : o.parse(Cn(n), t.parseOptions);
@@ -6618,7 +6604,7 @@ function wc(n, e, t) {
6618
6604
  return;
6619
6605
  const o = n.mapping.maps[r];
6620
6606
  let s = 0;
6621
- o.forEach((a, l, c, u) => {
6607
+ o.forEach((l, a, c, u) => {
6622
6608
  s === 0 && (s = u);
6623
6609
  }), n.setSelection(D.near(n.doc.resolve(s), t));
6624
6610
  }
@@ -6632,8 +6618,8 @@ const Sc = (n) => !("type" in n), Cc = (n, e, t) => ({ tr: r, dispatch: i, edito
6632
6618
  applyPasteRules: !1,
6633
6619
  ...t
6634
6620
  };
6635
- let a;
6636
- const l = (y) => {
6621
+ let l;
6622
+ const a = (y) => {
6637
6623
  o.emit("contentError", {
6638
6624
  editor: o,
6639
6625
  error: y,
@@ -6652,18 +6638,18 @@ const Sc = (n) => !("type" in n), Cc = (n, e, t) => ({ tr: r, dispatch: i, edito
6652
6638
  errorOnInvalidContent: !0
6653
6639
  });
6654
6640
  } catch (y) {
6655
- l(y);
6641
+ a(y);
6656
6642
  }
6657
6643
  try {
6658
- a = Zt(e, o.schema, {
6644
+ l = Zt(e, o.schema, {
6659
6645
  parseOptions: c,
6660
6646
  errorOnInvalidContent: (s = t.errorOnInvalidContent) !== null && s !== void 0 ? s : o.options.enableContentCheck
6661
6647
  });
6662
6648
  } catch (y) {
6663
- return l(y), !1;
6649
+ return a(y), !1;
6664
6650
  }
6665
6651
  let { from: u, to: f } = typeof n == "number" ? { from: n, to: n } : { from: n.from, to: n.to }, p = !0, d = !0;
6666
- if ((Sc(a) ? a : [a]).forEach((y) => {
6652
+ if ((Sc(l) ? l : [l]).forEach((y) => {
6667
6653
  y.check(), p = p ? y.isText && y.marks.length === 0 : !1, d = d ? y.isBlock : !1;
6668
6654
  }), u === f && d) {
6669
6655
  const { parent: y } = r.doc.resolve(u);
@@ -6681,11 +6667,11 @@ const Sc = (n) => !("type" in n), Cc = (n, e, t) => ({ tr: r, dispatch: i, edito
6681
6667
  } else typeof e == "object" && e && e.text ? m = e.text : m = e;
6682
6668
  r.insertText(m, u, f);
6683
6669
  } else
6684
- m = a, r.replaceWith(u, f, m);
6670
+ m = l, r.replaceWith(u, f, m);
6685
6671
  t.updateSelection && wc(r, r.steps.length - 1, -1), t.applyInputRules && r.setMeta("applyInputRules", { from: u, text: m }), t.applyPasteRules && r.setMeta("applyPasteRules", { from: u, text: m });
6686
6672
  }
6687
6673
  return !0;
6688
- }, Oc = () => ({ state: n, dispatch: e }) => Il(n, e), Ec = () => ({ state: n, dispatch: e }) => Dl(n, e), Tc = () => ({ state: n, dispatch: e }) => ps(n, e), Mc = () => ({ state: n, dispatch: e }) => ys(n, e), Ac = () => ({ state: n, dispatch: e, tr: t }) => {
6674
+ }, Oc = () => ({ state: n, dispatch: e }) => Ia(n, e), Ec = () => ({ state: n, dispatch: e }) => Da(n, e), Tc = () => ({ state: n, dispatch: e }) => ps(n, e), Mc = () => ({ state: n, dispatch: e }) => ys(n, e), Ac = () => ({ state: n, dispatch: e, tr: t }) => {
6689
6675
  try {
6690
6676
  const r = Un(n.doc, n.selection.$from.pos, -1);
6691
6677
  return r == null ? !1 : (t.join(r, 2), e && e(t), !0);
@@ -6699,7 +6685,7 @@ const Sc = (n) => !("type" in n), Cc = (n, e, t) => ({ tr: r, dispatch: i, edito
6699
6685
  } catch {
6700
6686
  return !1;
6701
6687
  }
6702
- }, Ic = () => ({ state: n, dispatch: e }) => Al(n, e), Dc = () => ({ state: n, dispatch: e }) => Nl(n, e);
6688
+ }, Ic = () => ({ state: n, dispatch: e }) => Aa(n, e), Dc = () => ({ state: n, dispatch: e }) => Na(n, e);
6703
6689
  function Ms() {
6704
6690
  return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
6705
6691
  }
@@ -6708,25 +6694,25 @@ function Rc(n) {
6708
6694
  let t = e[e.length - 1];
6709
6695
  t === "Space" && (t = " ");
6710
6696
  let r, i, o, s;
6711
- for (let a = 0; a < e.length - 1; a += 1) {
6712
- const l = e[a];
6713
- if (/^(cmd|meta|m)$/i.test(l))
6697
+ for (let l = 0; l < e.length - 1; l += 1) {
6698
+ const a = e[l];
6699
+ if (/^(cmd|meta|m)$/i.test(a))
6714
6700
  s = !0;
6715
- else if (/^a(lt)?$/i.test(l))
6701
+ else if (/^a(lt)?$/i.test(a))
6716
6702
  r = !0;
6717
- else if (/^(c|ctrl|control)$/i.test(l))
6703
+ else if (/^(c|ctrl|control)$/i.test(a))
6718
6704
  i = !0;
6719
- else if (/^s(hift)?$/i.test(l))
6705
+ else if (/^s(hift)?$/i.test(a))
6720
6706
  o = !0;
6721
- else if (/^mod$/i.test(l))
6707
+ else if (/^mod$/i.test(a))
6722
6708
  _r() || Ms() ? s = !0 : i = !0;
6723
6709
  else
6724
- throw new Error(`Unrecognized modifier name: ${l}`);
6710
+ throw new Error(`Unrecognized modifier name: ${a}`);
6725
6711
  }
6726
6712
  return r && (t = `Alt-${t}`), i && (t = `Ctrl-${t}`), s && (t = `Meta-${t}`), o && (t = `Shift-${t}`), t;
6727
6713
  }
6728
6714
  const Pc = (n) => ({ editor: e, view: t, tr: r, dispatch: i }) => {
6729
- const o = Rc(n).split(/-(?!$)/), s = o.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), a = new KeyboardEvent("keydown", {
6715
+ const o = Rc(n).split(/-(?!$)/), s = o.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), l = new KeyboardEvent("keydown", {
6730
6716
  key: s === "Space" ? " " : s,
6731
6717
  altKey: o.includes("Alt"),
6732
6718
  ctrlKey: o.includes("Ctrl"),
@@ -6734,35 +6720,35 @@ const Pc = (n) => ({ editor: e, view: t, tr: r, dispatch: i }) => {
6734
6720
  shiftKey: o.includes("Shift"),
6735
6721
  bubbles: !0,
6736
6722
  cancelable: !0
6737
- }), l = e.captureTransaction(() => {
6738
- t.someProp("handleKeyDown", (c) => c(t, a));
6723
+ }), a = e.captureTransaction(() => {
6724
+ t.someProp("handleKeyDown", (c) => c(t, l));
6739
6725
  });
6740
- return l == null || l.steps.forEach((c) => {
6726
+ return a?.steps.forEach((c) => {
6741
6727
  const u = c.map(r.mapping);
6742
6728
  u && i && r.maybeStep(u);
6743
6729
  }), !0;
6744
6730
  };
6745
6731
  function ei(n, e, t = {}) {
6746
- const { from: r, to: i, empty: o } = n.selection, s = e ? G(e, n.schema) : null, a = [];
6732
+ const { from: r, to: i, empty: o } = n.selection, s = e ? G(e, n.schema) : null, l = [];
6747
6733
  n.doc.nodesBetween(r, i, (f, p) => {
6748
6734
  if (f.isText)
6749
6735
  return;
6750
6736
  const d = Math.max(r, p), g = Math.min(i, p + f.nodeSize);
6751
- a.push({
6737
+ l.push({
6752
6738
  node: f,
6753
6739
  from: d,
6754
6740
  to: g
6755
6741
  });
6756
6742
  });
6757
- const l = i - r, c = a.filter((f) => s ? s.name === f.node.type.name : !0).filter((f) => Wn(f.node.attrs, t, { strict: !1 }));
6758
- return o ? !!c.length : c.reduce((f, p) => f + p.to - p.from, 0) >= l;
6743
+ const a = i - r, c = l.filter((f) => s ? s.name === f.node.type.name : !0).filter((f) => Wn(f.node.attrs, t, { strict: !1 }));
6744
+ return o ? !!c.length : c.reduce((f, p) => f + p.to - p.from, 0) >= a;
6759
6745
  }
6760
6746
  const Bc = (n, e = {}) => ({ state: t, dispatch: r }) => {
6761
6747
  const i = G(n, t.schema);
6762
- return ei(t, i, e) ? Rl(t, r) : !1;
6748
+ return ei(t, i, e) ? Ra(t, r) : !1;
6763
6749
  }, zc = () => ({ state: n, dispatch: e }) => ks(n, e), Fc = (n) => ({ state: e, dispatch: t }) => {
6764
6750
  const r = G(n, e.schema);
6765
- return ql(r)(e, t);
6751
+ return qa(r)(e, t);
6766
6752
  }, Lc = () => ({ state: n, dispatch: e }) => bs(n, e);
6767
6753
  function As(n, e) {
6768
6754
  return e.nodes[n] ? "node" : e.marks[n] ? "mark" : null;
@@ -6773,9 +6759,9 @@ function qi(n, e) {
6773
6759
  }
6774
6760
  const $c = (n, e) => ({ tr: t, state: r, dispatch: i }) => {
6775
6761
  let o = null, s = null;
6776
- const a = As(typeof n == "string" ? n : n.name, r.schema);
6777
- return a ? (a === "node" && (o = G(n, r.schema)), a === "mark" && (s = He(n, r.schema)), i && t.selection.ranges.forEach((l) => {
6778
- r.doc.nodesBetween(l.$from.pos, l.$to.pos, (c, u) => {
6762
+ const l = As(typeof n == "string" ? n : n.name, r.schema);
6763
+ return l ? (l === "node" && (o = G(n, r.schema)), l === "mark" && (s = He(n, r.schema)), i && t.selection.ranges.forEach((a) => {
6764
+ r.doc.nodesBetween(a.$from.pos, a.$to.pos, (c, u) => {
6779
6765
  o && o === c.type && t.setNodeMarkup(u, void 0, qi(c.attrs, e)), s && c.marks.length && c.marks.forEach((f) => {
6780
6766
  s === f.type && t.addMark(u, u + c.nodeSize, s.create(qi(f.attrs, e)));
6781
6767
  });
@@ -6783,11 +6769,11 @@ const $c = (n, e) => ({ tr: t, state: r, dispatch: i }) => {
6783
6769
  }), !0) : !1;
6784
6770
  }, Vc = () => ({ tr: n, dispatch: e }) => (e && n.scrollIntoView(), !0), jc = () => ({ tr: n, dispatch: e }) => {
6785
6771
  if (e) {
6786
- const t = new ae(n.doc);
6772
+ const t = new le(n.doc);
6787
6773
  n.setSelection(t);
6788
6774
  }
6789
6775
  return !0;
6790
- }, Wc = () => ({ state: n, dispatch: e }) => ms(n, e), Hc = () => ({ state: n, dispatch: e }) => vs(n, e), Jc = () => ({ state: n, dispatch: e }) => Fl(n, e), qc = () => ({ state: n, dispatch: e }) => Vl(n, e), Kc = () => ({ state: n, dispatch: e }) => $l(n, e);
6776
+ }, Wc = () => ({ state: n, dispatch: e }) => ms(n, e), Hc = () => ({ state: n, dispatch: e }) => vs(n, e), Jc = () => ({ state: n, dispatch: e }) => Fa(n, e), qc = () => ({ state: n, dispatch: e }) => Va(n, e), Kc = () => ({ state: n, dispatch: e }) => $a(n, e);
6791
6777
  function Uc(n, e, t = {}, r = {}) {
6792
6778
  return Zt(n, e, {
6793
6779
  slice: !1,
@@ -6795,27 +6781,27 @@ function Uc(n, e, t = {}, r = {}) {
6795
6781
  errorOnInvalidContent: r.errorOnInvalidContent
6796
6782
  });
6797
6783
  }
6798
- const Gc = (n, e = !1, t = {}, r = {}) => ({ editor: i, tr: o, dispatch: s, commands: a }) => {
6799
- var l, c;
6784
+ const Gc = (n, e = !1, t = {}, r = {}) => ({ editor: i, tr: o, dispatch: s, commands: l }) => {
6785
+ var a, c;
6800
6786
  const { doc: u } = o;
6801
6787
  if (t.preserveWhitespace !== "full") {
6802
6788
  const f = Uc(n, i.schema, t, {
6803
- errorOnInvalidContent: (l = r.errorOnInvalidContent) !== null && l !== void 0 ? l : i.options.enableContentCheck
6789
+ errorOnInvalidContent: (a = r.errorOnInvalidContent) !== null && a !== void 0 ? a : i.options.enableContentCheck
6804
6790
  });
6805
6791
  return s && o.replaceWith(0, u.content.size, f).setMeta("preventUpdate", !e), !0;
6806
6792
  }
6807
- return s && o.setMeta("preventUpdate", !e), a.insertContentAt({ from: 0, to: u.content.size }, n, {
6793
+ return s && o.setMeta("preventUpdate", !e), l.insertContentAt({ from: 0, to: u.content.size }, n, {
6808
6794
  parseOptions: t,
6809
6795
  errorOnInvalidContent: (c = r.errorOnInvalidContent) !== null && c !== void 0 ? c : i.options.enableContentCheck
6810
6796
  });
6811
6797
  };
6812
6798
  function Yc(n, e) {
6813
6799
  const t = He(e, n.schema), { from: r, to: i, empty: o } = n.selection, s = [];
6814
- o ? (n.storedMarks && s.push(...n.storedMarks), s.push(...n.selection.$head.marks())) : n.doc.nodesBetween(r, i, (l) => {
6815
- s.push(...l.marks);
6800
+ o ? (n.storedMarks && s.push(...n.storedMarks), s.push(...n.selection.$head.marks())) : n.doc.nodesBetween(r, i, (a) => {
6801
+ s.push(...a.marks);
6816
6802
  });
6817
- const a = s.find((l) => l.type.name === t.name);
6818
- return a ? { ...a.attrs } : {};
6803
+ const l = s.find((a) => a.type.name === t.name);
6804
+ return l ? { ...l.attrs } : {};
6819
6805
  }
6820
6806
  function Xc(n) {
6821
6807
  for (let e = 0; e < n.edgeCount; e += 1) {
@@ -6849,7 +6835,7 @@ function Ns(n, e, t) {
6849
6835
  ...s
6850
6836
  });
6851
6837
  }) : t.nodesBetween(n, e, (i, o) => {
6852
- !i || (i == null ? void 0 : i.nodeSize) === void 0 || r.push(...i.marks.map((s) => ({
6838
+ !i || i?.nodeSize === void 0 || r.push(...i.marks.map((s) => ({
6853
6839
  from: o,
6854
6840
  to: o + i.nodeSize,
6855
6841
  mark: s
@@ -6867,14 +6853,14 @@ function Zc(n, e, t = {}) {
6867
6853
  if (r)
6868
6854
  return !!(n.storedMarks || n.selection.$from.marks()).filter((f) => o ? o.name === f.type.name : !0).find((f) => Wn(f.attrs, t, { strict: !1 }));
6869
6855
  let s = 0;
6870
- const a = [];
6856
+ const l = [];
6871
6857
  if (i.forEach(({ $from: f, $to: p }) => {
6872
6858
  const d = f.pos, g = p.pos;
6873
6859
  n.doc.nodesBetween(d, g, (m, y) => {
6874
6860
  if (!m.isText && !m.marks.length)
6875
6861
  return;
6876
6862
  const b = Math.max(d, y), C = Math.min(g, y + m.nodeSize), T = C - b;
6877
- s += T, a.push(...m.marks.map((h) => ({
6863
+ s += T, l.push(...m.marks.map((h) => ({
6878
6864
  mark: h,
6879
6865
  from: b,
6880
6866
  to: C
@@ -6882,11 +6868,11 @@ function Zc(n, e, t = {}) {
6882
6868
  });
6883
6869
  }), s === 0)
6884
6870
  return !1;
6885
- const l = a.filter((f) => o ? o.name === f.mark.type.name : !0).filter((f) => Wn(f.mark.attrs, t, { strict: !1 })).reduce((f, p) => f + p.to - p.from, 0), c = a.filter((f) => o ? f.mark.type !== o && f.mark.type.excludes(o) : !0).reduce((f, p) => f + p.to - p.from, 0);
6886
- return (l > 0 ? l + c : l) >= s;
6871
+ const a = l.filter((f) => o ? o.name === f.mark.type.name : !0).filter((f) => Wn(f.mark.attrs, t, { strict: !1 })).reduce((f, p) => f + p.to - p.from, 0), c = l.filter((f) => o ? f.mark.type !== o && f.mark.type.excludes(o) : !0).reduce((f, p) => f + p.to - p.from, 0);
6872
+ return (a > 0 ? a + c : a) >= s;
6887
6873
  }
6888
6874
  function Ki(n, e) {
6889
- const { nodeExtensions: t } = Xl(e), r = t.find((s) => s.name === n);
6875
+ const { nodeExtensions: t } = Xa(e), r = t.find((s) => s.name === n);
6890
6876
  if (!r)
6891
6877
  return !1;
6892
6878
  const i = {
@@ -6922,7 +6908,7 @@ function _c(n) {
6922
6908
  return n instanceof O;
6923
6909
  }
6924
6910
  function Ds(n, e, t) {
6925
- const i = n.state.doc.content.size, o = Re(e, 0, i), s = Re(t, 0, i), a = n.coordsAtPos(o), l = n.coordsAtPos(s, -1), c = Math.min(a.top, l.top), u = Math.max(a.bottom, l.bottom), f = Math.min(a.left, l.left), p = Math.max(a.right, l.right), d = p - f, g = u - c, b = {
6911
+ const i = n.state.doc.content.size, o = Re(e, 0, i), s = Re(t, 0, i), l = n.coordsAtPos(o), a = n.coordsAtPos(s, -1), c = Math.min(l.top, a.top), u = Math.max(l.bottom, a.bottom), f = Math.min(l.left, a.left), p = Math.max(l.right, a.right), d = p - f, g = u - c, b = {
6926
6912
  top: c,
6927
6913
  bottom: u,
6928
6914
  left: f,
@@ -6942,13 +6928,13 @@ function eu(n, e, t) {
6942
6928
  const { selection: i } = e;
6943
6929
  let o = null;
6944
6930
  if (Zr(i) && (o = i.$cursor), o) {
6945
- const a = (r = n.storedMarks) !== null && r !== void 0 ? r : o.marks();
6946
- return !!t.isInSet(a) || !a.some((l) => l.type.excludes(t));
6931
+ const l = (r = n.storedMarks) !== null && r !== void 0 ? r : o.marks();
6932
+ return !!t.isInSet(l) || !l.some((a) => a.type.excludes(t));
6947
6933
  }
6948
6934
  const { ranges: s } = i;
6949
- return s.some(({ $from: a, $to: l }) => {
6950
- let c = a.depth === 0 ? n.doc.inlineContent && n.doc.type.allowsMarkType(t) : !1;
6951
- return n.doc.nodesBetween(a.pos, l.pos, (u, f, p) => {
6935
+ return s.some(({ $from: l, $to: a }) => {
6936
+ let c = l.depth === 0 ? n.doc.inlineContent && n.doc.type.allowsMarkType(t) : !1;
6937
+ return n.doc.nodesBetween(l.pos, a.pos, (u, f, p) => {
6952
6938
  if (c)
6953
6939
  return !1;
6954
6940
  if (u.isInline) {
@@ -6960,32 +6946,32 @@ function eu(n, e, t) {
6960
6946
  });
6961
6947
  }
6962
6948
  const tu = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
6963
- const { selection: o } = t, { empty: s, ranges: a } = o, l = He(n, r.schema);
6949
+ const { selection: o } = t, { empty: s, ranges: l } = o, a = He(n, r.schema);
6964
6950
  if (i)
6965
6951
  if (s) {
6966
- const c = Yc(r, l);
6967
- t.addStoredMark(l.create({
6952
+ const c = Yc(r, a);
6953
+ t.addStoredMark(a.create({
6968
6954
  ...c,
6969
6955
  ...e
6970
6956
  }));
6971
6957
  } else
6972
- a.forEach((c) => {
6958
+ l.forEach((c) => {
6973
6959
  const u = c.$from.pos, f = c.$to.pos;
6974
6960
  r.doc.nodesBetween(u, f, (p, d) => {
6975
6961
  const g = Math.max(d, u), m = Math.min(d + p.nodeSize, f);
6976
- p.marks.find((b) => b.type === l) ? p.marks.forEach((b) => {
6977
- l === b.type && t.addMark(g, m, l.create({
6962
+ p.marks.find((b) => b.type === a) ? p.marks.forEach((b) => {
6963
+ a === b.type && t.addMark(g, m, a.create({
6978
6964
  ...b.attrs,
6979
6965
  ...e
6980
6966
  }));
6981
- }) : t.addMark(g, m, l.create(e));
6967
+ }) : t.addMark(g, m, a.create(e));
6982
6968
  });
6983
6969
  });
6984
- return eu(r, t, l);
6970
+ return eu(r, t, a);
6985
6971
  }, nu = (n, e) => ({ tr: t }) => (t.setMeta(n, e), !0), ru = (n, e = {}) => ({ state: t, dispatch: r, chain: i }) => {
6986
6972
  const o = G(n, t.schema);
6987
6973
  let s;
6988
- return t.selection.$anchor.sameParent(t.selection.$head) && (s = t.selection.$anchor.parent.attrs), o.isTextblock ? i().command(({ commands: a }) => Hi(o, { ...s, ...e })(t) ? !0 : a.clearNodes()).command(({ state: a }) => Hi(o, { ...s, ...e })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
6974
+ return t.selection.$anchor.sameParent(t.selection.$head) && (s = t.selection.$anchor.parent.attrs), o.isTextblock ? i().command(({ commands: l }) => Hi(o, { ...s, ...e })(t) ? !0 : l.clearNodes()).command(({ state: l }) => Hi(o, { ...s, ...e })(l, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
6989
6975
  }, iu = (n) => ({ tr: e, dispatch: t }) => {
6990
6976
  if (t) {
6991
6977
  const { doc: r } = e, i = Re(n, 0, r.content.size), o = O.create(r, i);
@@ -6994,71 +6980,71 @@ const tu = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
6994
6980
  return !0;
6995
6981
  }, ou = (n) => ({ tr: e, dispatch: t }) => {
6996
6982
  if (t) {
6997
- const { doc: r } = e, { from: i, to: o } = typeof n == "number" ? { from: n, to: n } : n, s = A.atStart(r).from, a = A.atEnd(r).to, l = Re(i, s, a), c = Re(o, s, a), u = A.create(r, l, c);
6983
+ const { doc: r } = e, { from: i, to: o } = typeof n == "number" ? { from: n, to: n } : n, s = A.atStart(r).from, l = A.atEnd(r).to, a = Re(i, s, l), c = Re(o, s, l), u = A.create(r, a, c);
6998
6984
  e.setSelection(u);
6999
6985
  }
7000
6986
  return !0;
7001
6987
  }, su = (n) => ({ state: e, dispatch: t }) => {
7002
6988
  const r = G(n, e.schema);
7003
- return Gl(r)(e, t);
6989
+ return Ga(r)(e, t);
7004
6990
  };
7005
6991
  function Ui(n, e) {
7006
6992
  const t = n.storedMarks || n.selection.$to.parentOffset && n.selection.$from.marks();
7007
6993
  if (t) {
7008
- const r = t.filter((i) => e == null ? void 0 : e.includes(i.type.name));
6994
+ const r = t.filter((i) => e?.includes(i.type.name));
7009
6995
  n.tr.ensureMarks(r);
7010
6996
  }
7011
6997
  }
7012
- const au = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, editor: i }) => {
7013
- const { selection: o, doc: s } = e, { $from: a, $to: l } = o, c = i.extensionManager.attributes, u = An(c, a.node().type.name, a.node().attrs);
6998
+ const lu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, editor: i }) => {
6999
+ const { selection: o, doc: s } = e, { $from: l, $to: a } = o, c = i.extensionManager.attributes, u = An(c, l.node().type.name, l.node().attrs);
7014
7000
  if (o instanceof O && o.node.isBlock)
7015
- return !a.parentOffset || !Pe(s, a.pos) ? !1 : (r && (n && Ui(t, i.extensionManager.splittableMarks), e.split(a.pos).scrollIntoView()), !0);
7016
- if (!a.parent.isBlock)
7001
+ return !l.parentOffset || !Pe(s, l.pos) ? !1 : (r && (n && Ui(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
7002
+ if (!l.parent.isBlock)
7017
7003
  return !1;
7018
- const f = l.parentOffset === l.parent.content.size, p = a.depth === 0 ? void 0 : Xc(a.node(-1).contentMatchAt(a.indexAfter(-1)));
7004
+ const f = a.parentOffset === a.parent.content.size, p = l.depth === 0 ? void 0 : Xc(l.node(-1).contentMatchAt(l.indexAfter(-1)));
7019
7005
  let d = f && p ? [
7020
7006
  {
7021
7007
  type: p,
7022
7008
  attrs: u
7023
7009
  }
7024
- ] : void 0, g = Pe(e.doc, e.mapping.map(a.pos), 1, d);
7025
- if (!d && !g && Pe(e.doc, e.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (g = !0, d = p ? [
7010
+ ] : void 0, g = Pe(e.doc, e.mapping.map(l.pos), 1, d);
7011
+ if (!d && !g && Pe(e.doc, e.mapping.map(l.pos), 1, p ? [{ type: p }] : void 0) && (g = !0, d = p ? [
7026
7012
  {
7027
7013
  type: p,
7028
7014
  attrs: u
7029
7015
  }
7030
7016
  ] : void 0), r) {
7031
- if (g && (o instanceof A && e.deleteSelection(), e.split(e.mapping.map(a.pos), 1, d), p && !f && !a.parentOffset && a.parent.type !== p)) {
7032
- const m = e.mapping.map(a.before()), y = e.doc.resolve(m);
7033
- a.node(-1).canReplaceWith(y.index(), y.index() + 1, p) && e.setNodeMarkup(e.mapping.map(a.before()), p);
7017
+ if (g && (o instanceof A && e.deleteSelection(), e.split(e.mapping.map(l.pos), 1, d), p && !f && !l.parentOffset && l.parent.type !== p)) {
7018
+ const m = e.mapping.map(l.before()), y = e.doc.resolve(m);
7019
+ l.node(-1).canReplaceWith(y.index(), y.index() + 1, p) && e.setNodeMarkup(e.mapping.map(l.before()), p);
7034
7020
  }
7035
7021
  n && Ui(t, i.extensionManager.splittableMarks), e.scrollIntoView();
7036
7022
  }
7037
7023
  return g;
7038
- }, lu = (n, e = {}) => ({ tr: t, state: r, dispatch: i, editor: o }) => {
7024
+ }, au = (n, e = {}) => ({ tr: t, state: r, dispatch: i, editor: o }) => {
7039
7025
  var s;
7040
- const a = G(n, r.schema), { $from: l, $to: c } = r.selection, u = r.selection.node;
7041
- if (u && u.isBlock || l.depth < 2 || !l.sameParent(c))
7026
+ const l = G(n, r.schema), { $from: a, $to: c } = r.selection, u = r.selection.node;
7027
+ if (u && u.isBlock || a.depth < 2 || !a.sameParent(c))
7042
7028
  return !1;
7043
- const f = l.node(-1);
7044
- if (f.type !== a)
7029
+ const f = a.node(-1);
7030
+ if (f.type !== l)
7045
7031
  return !1;
7046
7032
  const p = o.extensionManager.attributes;
7047
- if (l.parent.content.size === 0 && l.node(-1).childCount === l.indexAfter(-1)) {
7048
- if (l.depth === 2 || l.node(-3).type !== a || l.index(-2) !== l.node(-2).childCount - 1)
7033
+ if (a.parent.content.size === 0 && a.node(-1).childCount === a.indexAfter(-1)) {
7034
+ if (a.depth === 2 || a.node(-3).type !== l || a.index(-2) !== a.node(-2).childCount - 1)
7049
7035
  return !1;
7050
7036
  if (i) {
7051
7037
  let b = k.empty;
7052
- const C = l.index(-1) ? 1 : l.index(-2) ? 2 : 3;
7053
- for (let P = l.depth - C; P >= l.depth - 3; P -= 1)
7054
- b = k.from(l.node(P).copy(b));
7055
- const T = l.indexAfter(-1) < l.node(-2).childCount ? 1 : l.indexAfter(-2) < l.node(-3).childCount ? 2 : 3, h = {
7056
- ...An(p, l.node().type.name, l.node().attrs),
7038
+ const C = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
7039
+ for (let P = a.depth - C; P >= a.depth - 3; P -= 1)
7040
+ b = k.from(a.node(P).copy(b));
7041
+ const T = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, h = {
7042
+ ...An(p, a.node().type.name, a.node().attrs),
7057
7043
  ...e
7058
- }, M = ((s = a.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(h)) || void 0;
7059
- b = b.append(k.from(a.createAndFill(null, M) || void 0));
7060
- const x = l.before(l.depth - (C - 1));
7061
- t.replace(x, l.after(-T), new S(b, 4 - C, 0));
7044
+ }, M = ((s = l.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(h)) || void 0;
7045
+ b = b.append(k.from(l.createAndFill(null, M) || void 0));
7046
+ const x = a.before(a.depth - (C - 1));
7047
+ t.replace(x, a.after(-T), new S(b, 4 - C, 0));
7062
7048
  let N = -1;
7063
7049
  t.doc.nodesBetween(x, t.doc.content.size, (P, F) => {
7064
7050
  if (N > -1)
@@ -7068,23 +7054,23 @@ const au = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
7068
7054
  }
7069
7055
  return !0;
7070
7056
  }
7071
- const d = c.pos === l.end() ? f.contentMatchAt(0).defaultType : null, g = {
7057
+ const d = c.pos === a.end() ? f.contentMatchAt(0).defaultType : null, g = {
7072
7058
  ...An(p, f.type.name, f.attrs),
7073
7059
  ...e
7074
7060
  }, m = {
7075
- ...An(p, l.node().type.name, l.node().attrs),
7061
+ ...An(p, a.node().type.name, a.node().attrs),
7076
7062
  ...e
7077
7063
  };
7078
- t.delete(l.pos, c.pos);
7064
+ t.delete(a.pos, c.pos);
7079
7065
  const y = d ? [
7080
- { type: a, attrs: g },
7066
+ { type: l, attrs: g },
7081
7067
  { type: d, attrs: m }
7082
- ] : [{ type: a, attrs: g }];
7083
- if (!Pe(t.doc, l.pos, 2))
7068
+ ] : [{ type: l, attrs: g }];
7069
+ if (!Pe(t.doc, a.pos, 2))
7084
7070
  return !1;
7085
7071
  if (i) {
7086
7072
  const { selection: b, storedMarks: C } = r, { splittableMarks: T } = o.extensionManager, h = C || b.$to.parentOffset && b.$from.marks();
7087
- if (t.split(l.pos, 2, y).scrollIntoView(), !h || !i)
7073
+ if (t.split(a.pos, 2, y).scrollIntoView(), !h || !i)
7088
7074
  return !0;
7089
7075
  const M = h.filter((x) => T.includes(x.type.name));
7090
7076
  t.ensureMarks(M);
@@ -7098,7 +7084,7 @@ const au = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
7098
7084
  if (r === void 0)
7099
7085
  return !0;
7100
7086
  const i = n.doc.nodeAt(r);
7101
- return t.node.type === (i == null ? void 0 : i.type) && ut(n.doc, t.pos) && n.join(t.pos), !0;
7087
+ return t.node.type === i?.type && ut(n.doc, t.pos) && n.join(t.pos), !0;
7102
7088
  }, dr = (n, e) => {
7103
7089
  const t = ti((s) => s.type === e)(n.selection);
7104
7090
  if (!t)
@@ -7107,8 +7093,8 @@ const au = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
7107
7093
  if (r === void 0)
7108
7094
  return !0;
7109
7095
  const i = n.doc.nodeAt(r);
7110
- return t.node.type === (i == null ? void 0 : i.type) && ut(n.doc, r) && n.join(r), !0;
7111
- }, cu = (n, e, t, r = {}) => ({ editor: i, tr: o, state: s, dispatch: a, chain: l, commands: c, can: u }) => {
7096
+ return t.node.type === i?.type && ut(n.doc, r) && n.join(r), !0;
7097
+ }, cu = (n, e, t, r = {}) => ({ editor: i, tr: o, state: s, dispatch: l, chain: a, commands: c, can: u }) => {
7112
7098
  const { extensions: f, splittableMarks: p } = i.extensionManager, d = G(n, s.schema), g = G(e, s.schema), { selection: m, storedMarks: y } = s, { $from: b, $to: C } = m, T = b.blockRange(C), h = y || m.$to.parentOffset && m.$from.marks();
7113
7099
  if (!T)
7114
7100
  return !1;
@@ -7116,10 +7102,10 @@ const au = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
7116
7102
  if (T.depth >= 1 && M && T.depth - M.depth <= 1) {
7117
7103
  if (M.node.type === d)
7118
7104
  return c.liftListItem(g);
7119
- if (Ki(M.node.type.name, f) && d.validContent(M.node.content) && a)
7120
- return l().command(() => (o.setNodeMarkup(M.pos, d), !0)).command(() => fr(o, d)).command(() => dr(o, d)).run();
7105
+ if (Ki(M.node.type.name, f) && d.validContent(M.node.content) && l)
7106
+ return a().command(() => (o.setNodeMarkup(M.pos, d), !0)).command(() => fr(o, d)).command(() => dr(o, d)).run();
7121
7107
  }
7122
- return !t || !h || !a ? l().command(() => u().wrapInList(d, r) ? !0 : c.clearNodes()).wrapInList(d, r).command(() => fr(o, d)).command(() => dr(o, d)).run() : l().command(() => {
7108
+ return !t || !h || !l ? a().command(() => u().wrapInList(d, r) ? !0 : c.clearNodes()).wrapInList(d, r).command(() => fr(o, d)).command(() => dr(o, d)).run() : a().command(() => {
7123
7109
  const x = u().wrapInList(d, r), N = h.filter((P) => p.includes(P.type.name));
7124
7110
  return o.ensureMarks(N), x ? !0 : c.clearNodes();
7125
7111
  }).wrapInList(d, r).command(() => fr(o, d)).command(() => dr(o, d)).run();
@@ -7127,9 +7113,9 @@ const au = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
7127
7113
  const { extendEmptyMarkRange: o = !1 } = t, s = He(n, r.schema);
7128
7114
  return Zc(r, s, e) ? i.unsetMark(s, { extendEmptyMarkRange: o }) : i.setMark(s, e);
7129
7115
  }, fu = (n, e, t = {}) => ({ state: r, commands: i }) => {
7130
- const o = G(n, r.schema), s = G(e, r.schema), a = ei(r, o, t);
7131
- let l;
7132
- return r.selection.$anchor.sameParent(r.selection.$head) && (l = r.selection.$anchor.parent.attrs), a ? i.setNode(s, l) : i.setNode(o, { ...l, ...t });
7116
+ const o = G(n, r.schema), s = G(e, r.schema), l = ei(r, o, t);
7117
+ let a;
7118
+ return r.selection.$anchor.sameParent(r.selection.$head) && (a = r.selection.$anchor.parent.attrs), l ? i.setNode(s, a) : i.setNode(o, { ...a, ...t });
7133
7119
  }, du = (n, e = {}) => ({ state: t, commands: r }) => {
7134
7120
  const i = G(n, t.schema);
7135
7121
  return ei(t, i, e) ? r.lift(i) : r.wrapIn(i, e);
@@ -7140,12 +7126,12 @@ const au = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
7140
7126
  let o;
7141
7127
  if (i.spec.isInputRules && (o = i.getState(n))) {
7142
7128
  if (e) {
7143
- const s = n.tr, a = o.transform;
7144
- for (let l = a.steps.length - 1; l >= 0; l -= 1)
7145
- s.step(a.steps[l].invert(a.docs[l]));
7129
+ const s = n.tr, l = o.transform;
7130
+ for (let a = l.steps.length - 1; a >= 0; a -= 1)
7131
+ s.step(l.steps[a].invert(l.docs[a]));
7146
7132
  if (o.text) {
7147
- const l = s.doc.resolve(o.from).marks();
7148
- s.replaceWith(o.from, o.to, n.schema.text(o.text, l));
7133
+ const a = s.doc.resolve(o.from).marks();
7134
+ s.replaceWith(o.from, o.to, n.schema.text(o.text, a));
7149
7135
  } else
7150
7136
  s.delete(o.from, o.to);
7151
7137
  }
@@ -7160,23 +7146,23 @@ const au = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
7160
7146
  }), !0;
7161
7147
  }, mu = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
7162
7148
  var o;
7163
- const { extendEmptyMarkRange: s = !1 } = e, { selection: a } = t, l = He(n, r.schema), { $from: c, empty: u, ranges: f } = a;
7149
+ const { extendEmptyMarkRange: s = !1 } = e, { selection: l } = t, a = He(n, r.schema), { $from: c, empty: u, ranges: f } = l;
7164
7150
  if (!i)
7165
7151
  return !0;
7166
7152
  if (u && s) {
7167
- let { from: p, to: d } = a;
7168
- const g = (o = c.marks().find((y) => y.type === l)) === null || o === void 0 ? void 0 : o.attrs, m = Qr(c, l, g);
7169
- m && (p = m.from, d = m.to), t.removeMark(p, d, l);
7153
+ let { from: p, to: d } = l;
7154
+ const g = (o = c.marks().find((y) => y.type === a)) === null || o === void 0 ? void 0 : o.attrs, m = Qr(c, a, g);
7155
+ m && (p = m.from, d = m.to), t.removeMark(p, d, a);
7170
7156
  } else
7171
7157
  f.forEach((p) => {
7172
- t.removeMark(p.$from.pos, p.$to.pos, l);
7158
+ t.removeMark(p.$from.pos, p.$to.pos, a);
7173
7159
  });
7174
- return t.removeStoredMark(l), !0;
7160
+ return t.removeStoredMark(a), !0;
7175
7161
  }, gu = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
7176
7162
  let o = null, s = null;
7177
- const a = As(typeof n == "string" ? n : n.name, r.schema);
7178
- return a ? (a === "node" && (o = G(n, r.schema)), a === "mark" && (s = He(n, r.schema)), i && t.selection.ranges.forEach((l) => {
7179
- const c = l.$from.pos, u = l.$to.pos;
7163
+ const l = As(typeof n == "string" ? n : n.name, r.schema);
7164
+ return l ? (l === "node" && (o = G(n, r.schema)), l === "mark" && (s = He(n, r.schema)), i && t.selection.ranges.forEach((a) => {
7165
+ const c = a.$from.pos, u = a.$to.pos;
7180
7166
  let f, p, d, g;
7181
7167
  t.selection.empty ? r.doc.nodesBetween(c, u, (m, y) => {
7182
7168
  o && o === m.type && (d = Math.max(y, c), g = Math.min(y + m.nodeSize, u), f = y, p = m);
@@ -7205,10 +7191,10 @@ const au = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
7205
7191
  }), !0) : !1;
7206
7192
  }, yu = (n, e = {}) => ({ state: t, dispatch: r }) => {
7207
7193
  const i = G(n, t.schema);
7208
- return jl(i, e)(t, r);
7194
+ return ja(i, e)(t, r);
7209
7195
  }, vu = (n, e = {}) => ({ state: t, dispatch: r }) => {
7210
7196
  const i = G(n, t.schema);
7211
- return Wl(i, e)(t, r);
7197
+ return Wa(i, e)(t, r);
7212
7198
  };
7213
7199
  var bu = /* @__PURE__ */ Object.freeze({
7214
7200
  __proto__: null,
@@ -7216,8 +7202,8 @@ var bu = /* @__PURE__ */ Object.freeze({
7216
7202
  clearContent: ic,
7217
7203
  clearNodes: oc,
7218
7204
  command: sc,
7219
- createParagraphNear: ac,
7220
- cut: lc,
7205
+ createParagraphNear: lc,
7206
+ cut: ac,
7221
7207
  deleteCurrentNode: cc,
7222
7208
  deleteNode: uc,
7223
7209
  deleteRange: fc,
@@ -7258,8 +7244,8 @@ var bu = /* @__PURE__ */ Object.freeze({
7258
7244
  setNodeSelection: iu,
7259
7245
  setTextSelection: ou,
7260
7246
  sinkListItem: su,
7261
- splitBlock: au,
7262
- splitListItem: lu,
7247
+ splitBlock: lu,
7248
+ splitListItem: au,
7263
7249
  toggleList: cu,
7264
7250
  toggleMark: uu,
7265
7251
  toggleNode: fu,
@@ -7344,8 +7330,8 @@ ce.create({
7344
7330
  const n = () => this.editor.commands.first(({ commands: s }) => [
7345
7331
  () => s.undoInputRule(),
7346
7332
  // maybe convert first text block node to default node
7347
- () => s.command(({ tr: a }) => {
7348
- const { selection: l, doc: c } = a, { empty: u, $anchor: f } = l, { pos: p, parent: d } = f, g = f.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : f, m = g.parent.type.spec.isolating, y = f.pos - f.parentOffset, b = m && g.parent.childCount === 1 ? y === f.pos : D.atStart(c).from === p;
7333
+ () => s.command(({ tr: l }) => {
7334
+ const { selection: a, doc: c } = l, { empty: u, $anchor: f } = a, { pos: p, parent: d } = f, g = f.parent.isTextblock && p > 0 ? l.doc.resolve(p - 1) : f, m = g.parent.type.spec.isolating, y = f.pos - f.parentOffset, b = m && g.parent.childCount === 1 ? y === f.pos : D.atStart(c).from === p;
7349
7335
  return !u || !d.type.isTextblock || d.textContent.length || !b || b && f.parent.type.name === "paragraph" ? !1 : s.clearNodes();
7350
7336
  }),
7351
7337
  () => s.deleteSelection(),
@@ -7400,13 +7386,13 @@ ce.create({
7400
7386
  const r = n.some((m) => m.docChanged) && !e.doc.eq(t.doc), i = n.some((m) => m.getMeta("preventClearDocument"));
7401
7387
  if (!r || i)
7402
7388
  return;
7403
- const { empty: o, from: s, to: a } = e.selection, l = D.atStart(e.doc).from, c = D.atEnd(e.doc).to;
7404
- if (o || !(s === l && a === c) || !Is(t.doc))
7389
+ const { empty: o, from: s, to: l } = e.selection, a = D.atStart(e.doc).from, c = D.atEnd(e.doc).to;
7390
+ if (o || !(s === a && l === c) || !Is(t.doc))
7405
7391
  return;
7406
7392
  const p = t.tr, d = Cs({
7407
7393
  state: t,
7408
7394
  transaction: p
7409
- }), { commands: g } = new Yl({
7395
+ }), { commands: g } = new Ya({
7410
7396
  editor: this.editor,
7411
7397
  state: d
7412
7398
  });
@@ -7524,11 +7510,11 @@ class Qe {
7524
7510
  const i = t.isBlock && !t.isTextblock, o = t.isAtom && !t.isText, s = this.pos + r + (o ? 0 : 1);
7525
7511
  if (s < 0 || s > this.resolvedPos.doc.nodeSize - 2)
7526
7512
  return;
7527
- const a = this.resolvedPos.doc.resolve(s);
7528
- if (!i && a.depth <= this.depth)
7513
+ const l = this.resolvedPos.doc.resolve(s);
7514
+ if (!i && l.depth <= this.depth)
7529
7515
  return;
7530
- const l = new Qe(a, this.editor, i, i ? t : null);
7531
- i && (l.actualDepth = this.depth + 1), e.push(new Qe(a, this.editor, i, i ? t : null));
7516
+ const a = new Qe(l, this.editor, i, i ? t : null);
7517
+ i && (a.actualDepth = this.depth + 1), e.push(new Qe(l, this.editor, i, i ? t : null));
7532
7518
  }), e;
7533
7519
  }
7534
7520
  get firstChild() {
@@ -7544,9 +7530,9 @@ class Qe {
7544
7530
  if (i.node.type.name === e)
7545
7531
  if (Object.keys(t).length > 0) {
7546
7532
  const o = i.node.attrs, s = Object.keys(t);
7547
- for (let a = 0; a < s.length; a += 1) {
7548
- const l = s[a];
7549
- if (o[l] !== t[l])
7533
+ for (let l = 0; l < s.length; l += 1) {
7534
+ const a = s[l];
7535
+ if (o[a] !== t[a])
7550
7536
  break;
7551
7537
  }
7552
7538
  } else
@@ -7564,7 +7550,7 @@ class Qe {
7564
7550
  return i;
7565
7551
  const o = Object.keys(t);
7566
7552
  return this.children.forEach((s) => {
7567
- r && i.length > 0 || (s.node.type.name === e && o.every((l) => t[l] === s.node.attrs[l]) && i.push(s), !(r && i.length > 0) && (i = i.concat(s.querySelectorAll(e, t, r))));
7553
+ r && i.length > 0 || (s.node.type.name === e && o.every((a) => t[a] === s.node.attrs[a]) && i.push(s), !(r && i.length > 0) && (i = i.concat(s.querySelectorAll(e, t, r))));
7568
7554
  }), i;
7569
7555
  }
7570
7556
  setAttribute(e) {
@@ -7582,14 +7568,14 @@ function ku(n) {
7582
7568
  const i = U(n.getAttributes, void 0, r);
7583
7569
  if (i === !1 || i === null)
7584
7570
  return null;
7585
- const { tr: o } = e, s = r[r.length - 1], a = r[0];
7571
+ const { tr: o } = e, s = r[r.length - 1], l = r[0];
7586
7572
  if (s) {
7587
- const l = a.search(/\S/), c = t.from + a.indexOf(s), u = c + s.length;
7573
+ const a = l.search(/\S/), c = t.from + l.indexOf(s), u = c + s.length;
7588
7574
  if (Ns(t.from, t.to, e.doc).filter((d) => d.mark.type.excluded.find((m) => m === n.type && m !== d.mark.type)).filter((d) => d.to > c).length)
7589
7575
  return null;
7590
- u < t.to && o.delete(u, t.to), c > t.from && o.delete(t.from + l, c);
7591
- const p = t.from + l + s.length;
7592
- o.addMark(t.from + l, p, n.type.create(i || {})), o.removeStoredMark(n.type);
7576
+ u < t.to && o.delete(u, t.to), c > t.from && o.delete(t.from + a, c);
7577
+ const p = t.from + a + s.length;
7578
+ o.addMark(t.from + a, p, n.type.create(i || {})), o.removeStoredMark(n.type);
7593
7579
  }
7594
7580
  }
7595
7581
  });
@@ -7599,17 +7585,17 @@ function wu(n) {
7599
7585
  find: n.find,
7600
7586
  handler: ({ state: e, range: t, match: r }) => {
7601
7587
  const i = U(n.getAttributes, void 0, r) || {}, { tr: o } = e, s = t.from;
7602
- let a = t.to;
7603
- const l = n.type.create(i);
7588
+ let l = t.to;
7589
+ const a = n.type.create(i);
7604
7590
  if (r[1]) {
7605
7591
  const c = r[0].lastIndexOf(r[1]);
7606
7592
  let u = s + c;
7607
- u > a ? u = a : a = u + r[1].length;
7593
+ u > l ? u = l : l = u + r[1].length;
7608
7594
  const f = r[0][r[0].length - 1];
7609
- o.insertText(f, s + r[0].length - 1), o.replaceWith(u, a, l);
7595
+ o.insertText(f, s + r[0].length - 1), o.replaceWith(u, l, a);
7610
7596
  } else if (r[0]) {
7611
7597
  const c = n.type.isInline ? s : s - 1;
7612
- o.insert(c, n.type.create(i)).delete(o.mapping.map(s), o.mapping.map(a));
7598
+ o.insert(c, n.type.create(i)).delete(o.mapping.map(s), o.mapping.map(l));
7613
7599
  }
7614
7600
  o.scrollIntoView();
7615
7601
  }
@@ -7657,13 +7643,13 @@ function Su(n) {
7657
7643
  const o = U(n.getAttributes, void 0, r, i);
7658
7644
  if (o === !1 || o === null)
7659
7645
  return null;
7660
- const { tr: s } = e, a = r[r.length - 1], l = r[0];
7646
+ const { tr: s } = e, l = r[r.length - 1], a = r[0];
7661
7647
  let c = t.to;
7662
- if (a) {
7663
- const u = l.search(/\S/), f = t.from + l.indexOf(a), p = f + a.length;
7648
+ if (l) {
7649
+ const u = a.search(/\S/), f = t.from + a.indexOf(l), p = f + l.length;
7664
7650
  if (Ns(t.from, t.to, e.doc).filter((g) => g.mark.type.excluded.find((y) => y === n.type && y !== g.mark.type)).filter((g) => g.to > f).length)
7665
7651
  return null;
7666
- p < t.to && s.delete(p, t.to), f > t.from && s.delete(t.from + u, f), c = t.from + u + a.length, s.addMark(t.from + u, c, n.type.create(o || {})), s.removeStoredMark(n.type);
7652
+ p < t.to && s.delete(p, t.to), f > t.from && s.delete(t.from + u, f), c = t.from + u + l.length, s.addMark(t.from + u, c, n.type.create(o || {})), s.removeStoredMark(n.type);
7667
7653
  }
7668
7654
  }
7669
7655
  });
@@ -7746,10 +7732,10 @@ function dd(n) {
7746
7732
  t.preventDefault();
7747
7733
  const { schema: o } = e.state;
7748
7734
  for (const s of i)
7749
- n(s).then((a) => {
7750
- const l = o.nodes.imageUpload.create({
7751
- src: a
7752
- }), c = e.state.tr.insert(e.state.selection.from, l);
7735
+ n(s).then((l) => {
7736
+ const a = o.nodes.imageUpload.create({
7737
+ src: l
7738
+ }), c = e.state.tr.insert(e.state.selection.from, a);
7753
7739
  e.dispatch(c);
7754
7740
  });
7755
7741
  }
@@ -7817,8 +7803,8 @@ function Lu(n) {
7817
7803
  Object.keys(e.elements).forEach(function(t) {
7818
7804
  var r = e.styles[t] || {}, i = e.attributes[t] || {}, o = e.elements[t];
7819
7805
  !pe(o) || !Ee(o) || (Object.assign(o.style, r), Object.keys(i).forEach(function(s) {
7820
- var a = i[s];
7821
- a === !1 ? o.removeAttribute(s) : o.setAttribute(s, a === !0 ? "" : a);
7806
+ var l = i[s];
7807
+ l === !1 ? o.removeAttribute(s) : o.setAttribute(s, l === !0 ? "" : l);
7822
7808
  }));
7823
7809
  });
7824
7810
  }
@@ -7837,11 +7823,11 @@ function $u(n) {
7837
7823
  };
7838
7824
  return Object.assign(e.elements.popper.style, t.popper), e.styles = t, e.elements.arrow && Object.assign(e.elements.arrow.style, t.arrow), function() {
7839
7825
  Object.keys(e.elements).forEach(function(r) {
7840
- var i = e.elements[r], o = e.attributes[r] || {}, s = Object.keys(e.styles.hasOwnProperty(r) ? e.styles[r] : t[r]), a = s.reduce(function(l, c) {
7841
- return l[c] = "", l;
7826
+ var i = e.elements[r], o = e.attributes[r] || {}, s = Object.keys(e.styles.hasOwnProperty(r) ? e.styles[r] : t[r]), l = s.reduce(function(a, c) {
7827
+ return a[c] = "", a;
7842
7828
  }, {});
7843
- !pe(i) || !Ee(i) || (Object.assign(i.style, a), Object.keys(o).forEach(function(l) {
7844
- i.removeAttribute(l);
7829
+ !pe(i) || !Ee(i) || (Object.assign(i.style, l), Object.keys(o).forEach(function(a) {
7830
+ i.removeAttribute(a);
7845
7831
  }));
7846
7832
  });
7847
7833
  };
@@ -7857,7 +7843,7 @@ const Bs = {
7857
7843
  function Ce(n) {
7858
7844
  return n.split("-")[0];
7859
7845
  }
7860
- var at = Math.max, Jn = Math.min, Et = Math.round;
7846
+ var lt = Math.max, Jn = Math.min, Et = Math.round;
7861
7847
  function Ar() {
7862
7848
  var n = navigator.userAgentData;
7863
7849
  return n != null && n.brands && Array.isArray(n.brands) ? n.brands.map(function(e) {
@@ -7871,7 +7857,7 @@ function Tt(n, e, t) {
7871
7857
  e === void 0 && (e = !1), t === void 0 && (t = !1);
7872
7858
  var r = n.getBoundingClientRect(), i = 1, o = 1;
7873
7859
  e && pe(n) && (i = n.offsetWidth > 0 && Et(r.width) / n.offsetWidth || 1, o = n.offsetHeight > 0 && Et(r.height) / n.offsetHeight || 1);
7874
- var s = ct(n) ? ue(n) : window, a = s.visualViewport, l = !zs() && t, c = (r.left + (l && a ? a.offsetLeft : 0)) / i, u = (r.top + (l && a ? a.offsetTop : 0)) / o, f = r.width / i, p = r.height / o;
7860
+ var s = ct(n) ? ue(n) : window, l = s.visualViewport, a = !zs() && t, c = (r.left + (a && l ? l.offsetLeft : 0)) / i, u = (r.top + (a && l ? l.offsetTop : 0)) / o, f = r.width / i, p = r.height / o;
7875
7861
  return {
7876
7862
  width: f,
7877
7863
  height: p,
@@ -7950,7 +7936,7 @@ function ju(n) {
7950
7936
  }
7951
7937
  return null;
7952
7938
  }
7953
- function an(n) {
7939
+ function ln(n) {
7954
7940
  for (var e = ue(n), t = Yi(n); t && Vu(t) && Be(t).position === "static"; )
7955
7941
  t = Yi(t);
7956
7942
  return t && (Ee(t) === "html" || Ee(t) === "body" && Be(t).position === "static") ? e : t || ju(n) || e;
@@ -7959,7 +7945,7 @@ function oi(n) {
7959
7945
  return ["top", "bottom"].indexOf(n) >= 0 ? "x" : "y";
7960
7946
  }
7961
7947
  function Wt(n, e, t) {
7962
- return at(n, Jn(e, t));
7948
+ return lt(n, Jn(e, t));
7963
7949
  }
7964
7950
  function Wu(n, e, t) {
7965
7951
  var r = Wt(n, e, t);
@@ -7987,9 +7973,9 @@ var Hu = function(e, t) {
7987
7973
  })) : e, $s(typeof e != "number" ? e : Vs(e, sn));
7988
7974
  };
7989
7975
  function Ju(n) {
7990
- var e, t = n.state, r = n.name, i = n.options, o = t.elements.arrow, s = t.modifiersData.popperOffsets, a = Ce(t.placement), l = oi(a), c = [te, me].indexOf(a) >= 0, u = c ? "height" : "width";
7976
+ var e, t = n.state, r = n.name, i = n.options, o = t.elements.arrow, s = t.modifiersData.popperOffsets, l = Ce(t.placement), a = oi(l), c = [te, me].indexOf(l) >= 0, u = c ? "height" : "width";
7991
7977
  if (!(!o || !s)) {
7992
- var f = Hu(i.padding, t), p = ii(o), d = l === "y" ? ee : te, g = l === "y" ? he : me, m = t.rects.reference[u] + t.rects.reference[l] - s[l] - t.rects.popper[u], y = s[l] - t.rects.reference[l], b = an(o), C = b ? l === "y" ? b.clientHeight || 0 : b.clientWidth || 0 : 0, T = m / 2 - y / 2, h = f[d], M = C - p[u] - f[g], x = C / 2 - p[u] / 2 + T, N = Wt(h, x, M), P = l;
7978
+ var f = Hu(i.padding, t), p = ii(o), d = a === "y" ? ee : te, g = a === "y" ? he : me, m = t.rects.reference[u] + t.rects.reference[a] - s[a] - t.rects.popper[u], y = s[a] - t.rects.reference[a], b = ln(o), C = b ? a === "y" ? b.clientHeight || 0 : b.clientWidth || 0 : 0, T = m / 2 - y / 2, h = f[d], M = C - p[u] - f[g], x = C / 2 - p[u] / 2 + T, N = Wt(h, x, M), P = a;
7993
7979
  t.modifiersData[r] = (e = {}, e[P] = N, e.centerOffset = N - x, e);
7994
7980
  }
7995
7981
  }
@@ -8023,7 +8009,7 @@ function Gu(n, e) {
8023
8009
  };
8024
8010
  }
8025
8011
  function Xi(n) {
8026
- var e, t = n.popper, r = n.popperRect, i = n.placement, o = n.variation, s = n.offsets, a = n.position, l = n.gpuAcceleration, c = n.adaptive, u = n.roundOffsets, f = n.isFixed, p = s.x, d = p === void 0 ? 0 : p, g = s.y, m = g === void 0 ? 0 : g, y = typeof u == "function" ? u({
8012
+ var e, t = n.popper, r = n.popperRect, i = n.placement, o = n.variation, s = n.offsets, l = n.position, a = n.gpuAcceleration, c = n.adaptive, u = n.roundOffsets, f = n.isFixed, p = s.x, d = p === void 0 ? 0 : p, g = s.y, m = g === void 0 ? 0 : g, y = typeof u == "function" ? u({
8027
8013
  x: d,
8028
8014
  y: m
8029
8015
  }) : {
@@ -8033,14 +8019,14 @@ function Xi(n) {
8033
8019
  d = y.x, m = y.y;
8034
8020
  var b = s.hasOwnProperty("x"), C = s.hasOwnProperty("y"), T = te, h = ee, M = window;
8035
8021
  if (c) {
8036
- var x = an(t), N = "clientHeight", P = "clientWidth";
8037
- if (x === ue(t) && (x = Je(t), Be(x).position !== "static" && a === "absolute" && (N = "scrollHeight", P = "scrollWidth")), x = x, i === ee || (i === te || i === me) && o === _t) {
8022
+ var x = ln(t), N = "clientHeight", P = "clientWidth";
8023
+ if (x === ue(t) && (x = Je(t), Be(x).position !== "static" && l === "absolute" && (N = "scrollHeight", P = "scrollWidth")), x = x, i === ee || (i === te || i === me) && o === _t) {
8038
8024
  h = he;
8039
8025
  var F = f && x === M && M.visualViewport ? M.visualViewport.height : (
8040
8026
  // $FlowFixMe[prop-missing]
8041
8027
  x[N]
8042
8028
  );
8043
- m -= F - r.height, m *= l ? 1 : -1;
8029
+ m -= F - r.height, m *= a ? 1 : -1;
8044
8030
  }
8045
8031
  if (i === te || (i === ee || i === he) && o === _t) {
8046
8032
  T = me;
@@ -8048,11 +8034,11 @@ function Xi(n) {
8048
8034
  // $FlowFixMe[prop-missing]
8049
8035
  x[P]
8050
8036
  );
8051
- d -= L - r.width, d *= l ? 1 : -1;
8037
+ d -= L - r.width, d *= a ? 1 : -1;
8052
8038
  }
8053
8039
  }
8054
8040
  var j = Object.assign({
8055
- position: a
8041
+ position: l
8056
8042
  }, c && Uu), $ = u === !0 ? Gu({
8057
8043
  x: d,
8058
8044
  y: m
@@ -8060,14 +8046,14 @@ function Xi(n) {
8060
8046
  x: d,
8061
8047
  y: m
8062
8048
  };
8063
- if (d = $.x, m = $.y, l) {
8049
+ if (d = $.x, m = $.y, a) {
8064
8050
  var B;
8065
8051
  return Object.assign({}, j, (B = {}, B[h] = C ? "0" : "", B[T] = b ? "0" : "", B.transform = (M.devicePixelRatio || 1) <= 1 ? "translate(" + d + "px, " + m + "px)" : "translate3d(" + d + "px, " + m + "px, 0)", B));
8066
8052
  }
8067
8053
  return Object.assign({}, j, (e = {}, e[h] = C ? m + "px" : "", e[T] = b ? d + "px" : "", e.transform = "", e));
8068
8054
  }
8069
8055
  function Yu(n) {
8070
- var e = n.state, t = n.options, r = t.gpuAcceleration, i = r === void 0 ? !0 : r, o = t.adaptive, s = o === void 0 ? !0 : o, a = t.roundOffsets, l = a === void 0 ? !0 : a, c = {
8056
+ var e = n.state, t = n.options, r = t.gpuAcceleration, i = r === void 0 ? !0 : r, o = t.adaptive, s = o === void 0 ? !0 : o, l = t.roundOffsets, a = l === void 0 ? !0 : l, c = {
8071
8057
  placement: Ce(e.placement),
8072
8058
  variation: Mt(e.placement),
8073
8059
  popper: e.elements.popper,
@@ -8079,12 +8065,12 @@ function Yu(n) {
8079
8065
  offsets: e.modifiersData.popperOffsets,
8080
8066
  position: e.options.strategy,
8081
8067
  adaptive: s,
8082
- roundOffsets: l
8068
+ roundOffsets: a
8083
8069
  })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, Xi(Object.assign({}, c, {
8084
8070
  offsets: e.modifiersData.arrow,
8085
8071
  position: "absolute",
8086
8072
  adaptive: !1,
8087
- roundOffsets: l
8073
+ roundOffsets: a
8088
8074
  })))), e.attributes.popper = Object.assign({}, e.attributes.popper, {
8089
8075
  "data-popper-placement": e.placement
8090
8076
  });
@@ -8100,13 +8086,13 @@ var On = {
8100
8086
  passive: !0
8101
8087
  };
8102
8088
  function Qu(n) {
8103
- var e = n.state, t = n.instance, r = n.options, i = r.scroll, o = i === void 0 ? !0 : i, s = r.resize, a = s === void 0 ? !0 : s, l = ue(e.elements.popper), c = [].concat(e.scrollParents.reference, e.scrollParents.popper);
8089
+ var e = n.state, t = n.instance, r = n.options, i = r.scroll, o = i === void 0 ? !0 : i, s = r.resize, l = s === void 0 ? !0 : s, a = ue(e.elements.popper), c = [].concat(e.scrollParents.reference, e.scrollParents.popper);
8104
8090
  return o && c.forEach(function(u) {
8105
8091
  u.addEventListener("scroll", t.update, On);
8106
- }), a && l.addEventListener("resize", t.update, On), function() {
8092
+ }), l && a.addEventListener("resize", t.update, On), function() {
8107
8093
  o && c.forEach(function(u) {
8108
8094
  u.removeEventListener("scroll", t.update, On);
8109
- }), a && l.removeEventListener("resize", t.update, On);
8095
+ }), l && a.removeEventListener("resize", t.update, On);
8110
8096
  };
8111
8097
  }
8112
8098
  const Zu = {
@@ -8145,46 +8131,46 @@ function si(n) {
8145
8131
  scrollTop: r
8146
8132
  };
8147
8133
  }
8148
- function ai(n) {
8134
+ function li(n) {
8149
8135
  return Tt(Je(n)).left + si(n).scrollLeft;
8150
8136
  }
8151
8137
  function tf(n, e) {
8152
- var t = ue(n), r = Je(n), i = t.visualViewport, o = r.clientWidth, s = r.clientHeight, a = 0, l = 0;
8138
+ var t = ue(n), r = Je(n), i = t.visualViewport, o = r.clientWidth, s = r.clientHeight, l = 0, a = 0;
8153
8139
  if (i) {
8154
8140
  o = i.width, s = i.height;
8155
8141
  var c = zs();
8156
- (c || !c && e === "fixed") && (a = i.offsetLeft, l = i.offsetTop);
8142
+ (c || !c && e === "fixed") && (l = i.offsetLeft, a = i.offsetTop);
8157
8143
  }
8158
8144
  return {
8159
8145
  width: o,
8160
8146
  height: s,
8161
- x: a + ai(n),
8162
- y: l
8147
+ x: l + li(n),
8148
+ y: a
8163
8149
  };
8164
8150
  }
8165
8151
  function nf(n) {
8166
- var e, t = Je(n), r = si(n), i = (e = n.ownerDocument) == null ? void 0 : e.body, o = at(t.scrollWidth, t.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), s = at(t.scrollHeight, t.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0), a = -r.scrollLeft + ai(n), l = -r.scrollTop;
8167
- return Be(i || t).direction === "rtl" && (a += at(t.clientWidth, i ? i.clientWidth : 0) - o), {
8152
+ var e, t = Je(n), r = si(n), i = (e = n.ownerDocument) == null ? void 0 : e.body, o = lt(t.scrollWidth, t.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), s = lt(t.scrollHeight, t.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0), l = -r.scrollLeft + li(n), a = -r.scrollTop;
8153
+ return Be(i || t).direction === "rtl" && (l += lt(t.clientWidth, i ? i.clientWidth : 0) - o), {
8168
8154
  width: o,
8169
8155
  height: s,
8170
- x: a,
8171
- y: l
8156
+ x: l,
8157
+ y: a
8172
8158
  };
8173
8159
  }
8174
- function li(n) {
8160
+ function ai(n) {
8175
8161
  var e = Be(n), t = e.overflow, r = e.overflowX, i = e.overflowY;
8176
8162
  return /auto|scroll|overlay|hidden/.test(t + i + r);
8177
8163
  }
8178
8164
  function js(n) {
8179
- return ["html", "body", "#document"].indexOf(Ee(n)) >= 0 ? n.ownerDocument.body : pe(n) && li(n) ? n : js(_n(n));
8165
+ return ["html", "body", "#document"].indexOf(Ee(n)) >= 0 ? n.ownerDocument.body : pe(n) && ai(n) ? n : js(_n(n));
8180
8166
  }
8181
8167
  function Ht(n, e) {
8182
8168
  var t;
8183
8169
  e === void 0 && (e = []);
8184
- var r = js(n), i = r === ((t = n.ownerDocument) == null ? void 0 : t.body), o = ue(r), s = i ? [o].concat(o.visualViewport || [], li(r) ? r : []) : r, a = e.concat(s);
8185
- return i ? a : (
8170
+ var r = js(n), i = r === ((t = n.ownerDocument) == null ? void 0 : t.body), o = ue(r), s = i ? [o].concat(o.visualViewport || [], ai(r) ? r : []) : r, l = e.concat(s);
8171
+ return i ? l : (
8186
8172
  // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
8187
- a.concat(Ht(_n(s)))
8173
+ l.concat(Ht(_n(s)))
8188
8174
  );
8189
8175
  }
8190
8176
  function Nr(n) {
@@ -8203,47 +8189,47 @@ function Zi(n, e, t) {
8203
8189
  return e === Rs ? Nr(tf(n, t)) : ct(e) ? rf(e, t) : Nr(nf(Je(n)));
8204
8190
  }
8205
8191
  function of(n) {
8206
- var e = Ht(_n(n)), t = ["absolute", "fixed"].indexOf(Be(n).position) >= 0, r = t && pe(n) ? an(n) : n;
8192
+ var e = Ht(_n(n)), t = ["absolute", "fixed"].indexOf(Be(n).position) >= 0, r = t && pe(n) ? ln(n) : n;
8207
8193
  return ct(r) ? e.filter(function(i) {
8208
8194
  return ct(i) && Fs(i, r) && Ee(i) !== "body";
8209
8195
  }) : [];
8210
8196
  }
8211
8197
  function sf(n, e, t, r) {
8212
- var i = e === "clippingParents" ? of(n) : [].concat(e), o = [].concat(i, [t]), s = o[0], a = o.reduce(function(l, c) {
8198
+ var i = e === "clippingParents" ? of(n) : [].concat(e), o = [].concat(i, [t]), s = o[0], l = o.reduce(function(a, c) {
8213
8199
  var u = Zi(n, c, r);
8214
- return l.top = at(u.top, l.top), l.right = Jn(u.right, l.right), l.bottom = Jn(u.bottom, l.bottom), l.left = at(u.left, l.left), l;
8200
+ return a.top = lt(u.top, a.top), a.right = Jn(u.right, a.right), a.bottom = Jn(u.bottom, a.bottom), a.left = lt(u.left, a.left), a;
8215
8201
  }, Zi(n, s, r));
8216
- return a.width = a.right - a.left, a.height = a.bottom - a.top, a.x = a.left, a.y = a.top, a;
8202
+ return l.width = l.right - l.left, l.height = l.bottom - l.top, l.x = l.left, l.y = l.top, l;
8217
8203
  }
8218
8204
  function Ws(n) {
8219
- var e = n.reference, t = n.element, r = n.placement, i = r ? Ce(r) : null, o = r ? Mt(r) : null, s = e.x + e.width / 2 - t.width / 2, a = e.y + e.height / 2 - t.height / 2, l;
8205
+ var e = n.reference, t = n.element, r = n.placement, i = r ? Ce(r) : null, o = r ? Mt(r) : null, s = e.x + e.width / 2 - t.width / 2, l = e.y + e.height / 2 - t.height / 2, a;
8220
8206
  switch (i) {
8221
8207
  case ee:
8222
- l = {
8208
+ a = {
8223
8209
  x: s,
8224
8210
  y: e.y - t.height
8225
8211
  };
8226
8212
  break;
8227
8213
  case he:
8228
- l = {
8214
+ a = {
8229
8215
  x: s,
8230
8216
  y: e.y + e.height
8231
8217
  };
8232
8218
  break;
8233
8219
  case me:
8234
- l = {
8220
+ a = {
8235
8221
  x: e.x + e.width,
8236
- y: a
8222
+ y: l
8237
8223
  };
8238
8224
  break;
8239
8225
  case te:
8240
- l = {
8226
+ a = {
8241
8227
  x: e.x - t.width,
8242
- y: a
8228
+ y: l
8243
8229
  };
8244
8230
  break;
8245
8231
  default:
8246
- l = {
8232
+ a = {
8247
8233
  x: e.x,
8248
8234
  y: e.y
8249
8235
  };
@@ -8253,18 +8239,18 @@ function Ws(n) {
8253
8239
  var u = c === "y" ? "height" : "width";
8254
8240
  switch (o) {
8255
8241
  case Ot:
8256
- l[c] = l[c] - (e[u] / 2 - t[u] / 2);
8242
+ a[c] = a[c] - (e[u] / 2 - t[u] / 2);
8257
8243
  break;
8258
8244
  case _t:
8259
- l[c] = l[c] + (e[u] / 2 - t[u] / 2);
8245
+ a[c] = a[c] + (e[u] / 2 - t[u] / 2);
8260
8246
  break;
8261
8247
  }
8262
8248
  }
8263
- return l;
8249
+ return a;
8264
8250
  }
8265
8251
  function en(n, e) {
8266
8252
  e === void 0 && (e = {});
8267
- var t = e, r = t.placement, i = r === void 0 ? n.placement : r, o = t.strategy, s = o === void 0 ? n.strategy : o, a = t.boundary, l = a === void 0 ? Eu : a, c = t.rootBoundary, u = c === void 0 ? Rs : c, f = t.elementContext, p = f === void 0 ? Bt : f, d = t.altBoundary, g = d === void 0 ? !1 : d, m = t.padding, y = m === void 0 ? 0 : m, b = $s(typeof y != "number" ? y : Vs(y, sn)), C = p === Bt ? Tu : Bt, T = n.rects.popper, h = n.elements[g ? C : p], M = sf(ct(h) ? h : h.contextElement || Je(n.elements.popper), l, u, s), x = Tt(n.elements.reference), N = Ws({
8253
+ var t = e, r = t.placement, i = r === void 0 ? n.placement : r, o = t.strategy, s = o === void 0 ? n.strategy : o, l = t.boundary, a = l === void 0 ? Eu : l, c = t.rootBoundary, u = c === void 0 ? Rs : c, f = t.elementContext, p = f === void 0 ? Bt : f, d = t.altBoundary, g = d === void 0 ? !1 : d, m = t.padding, y = m === void 0 ? 0 : m, b = $s(typeof y != "number" ? y : Vs(y, sn)), C = p === Bt ? Tu : Bt, T = n.rects.popper, h = n.elements[g ? C : p], M = sf(ct(h) ? h : h.contextElement || Je(n.elements.popper), a, u, s), x = Tt(n.elements.reference), N = Ws({
8268
8254
  reference: x,
8269
8255
  element: T,
8270
8256
  placement: i
@@ -8283,9 +8269,9 @@ function en(n, e) {
8283
8269
  }
8284
8270
  return L;
8285
8271
  }
8286
- function af(n, e) {
8272
+ function lf(n, e) {
8287
8273
  e === void 0 && (e = {});
8288
- var t = e, r = t.placement, i = t.boundary, o = t.rootBoundary, s = t.padding, a = t.flipVariations, l = t.allowedAutoPlacements, c = l === void 0 ? Ps : l, u = Mt(r), f = u ? a ? Gi : Gi.filter(function(g) {
8274
+ var t = e, r = t.placement, i = t.boundary, o = t.rootBoundary, s = t.padding, l = t.flipVariations, a = t.allowedAutoPlacements, c = a === void 0 ? Ps : a, u = Mt(r), f = u ? l ? Gi : Gi.filter(function(g) {
8289
8275
  return Mt(g) === u;
8290
8276
  }) : sn, p = f.filter(function(g) {
8291
8277
  return c.indexOf(g) >= 0;
@@ -8303,7 +8289,7 @@ function af(n, e) {
8303
8289
  return d[g] - d[m];
8304
8290
  });
8305
8291
  }
8306
- function lf(n) {
8292
+ function af(n) {
8307
8293
  if (Ce(n) === ni)
8308
8294
  return [];
8309
8295
  var e = Nn(n);
@@ -8312,8 +8298,8 @@ function lf(n) {
8312
8298
  function cf(n) {
8313
8299
  var e = n.state, t = n.options, r = n.name;
8314
8300
  if (!e.modifiersData[r]._skip) {
8315
- for (var i = t.mainAxis, o = i === void 0 ? !0 : i, s = t.altAxis, a = s === void 0 ? !0 : s, l = t.fallbackPlacements, c = t.padding, u = t.boundary, f = t.rootBoundary, p = t.altBoundary, d = t.flipVariations, g = d === void 0 ? !0 : d, m = t.allowedAutoPlacements, y = e.options.placement, b = Ce(y), C = b === y, T = l || (C || !g ? [Nn(y)] : lf(y)), h = [y].concat(T).reduce(function(Me, ge) {
8316
- return Me.concat(Ce(ge) === ni ? af(e, {
8301
+ for (var i = t.mainAxis, o = i === void 0 ? !0 : i, s = t.altAxis, l = s === void 0 ? !0 : s, a = t.fallbackPlacements, c = t.padding, u = t.boundary, f = t.rootBoundary, p = t.altBoundary, d = t.flipVariations, g = d === void 0 ? !0 : d, m = t.allowedAutoPlacements, y = e.options.placement, b = Ce(y), C = b === y, T = a || (C || !g ? [Nn(y)] : af(y)), h = [y].concat(T).reduce(function(Me, ge) {
8302
+ return Me.concat(Ce(ge) === ni ? lf(e, {
8317
8303
  placement: ge,
8318
8304
  boundary: u,
8319
8305
  rootBoundary: f,
@@ -8331,7 +8317,7 @@ function cf(n) {
8331
8317
  }), K = ne ? B ? me : te : B ? he : ee;
8332
8318
  M[re] > x[re] && (K = Nn(K));
8333
8319
  var H = Nn(K), be = [];
8334
- if (o && be.push(q[$] <= 0), a && be.push(q[K] <= 0, q[H] <= 0), be.every(function(Me) {
8320
+ if (o && be.push(q[$] <= 0), l && be.push(q[K] <= 0, q[H] <= 0), be.every(function(Me) {
8335
8321
  return Me;
8336
8322
  })) {
8337
8323
  F = j, P = !1;
@@ -8386,11 +8372,11 @@ function eo(n) {
8386
8372
  function ff(n) {
8387
8373
  var e = n.state, t = n.name, r = e.rects.reference, i = e.rects.popper, o = e.modifiersData.preventOverflow, s = en(e, {
8388
8374
  elementContext: "reference"
8389
- }), a = en(e, {
8375
+ }), l = en(e, {
8390
8376
  altBoundary: !0
8391
- }), l = _i(s, r), c = _i(a, i, o), u = eo(l), f = eo(c);
8377
+ }), a = _i(s, r), c = _i(l, i, o), u = eo(a), f = eo(c);
8392
8378
  e.modifiersData[t] = {
8393
- referenceClippingOffsets: l,
8379
+ referenceClippingOffsets: a,
8394
8380
  popperEscapeOffsets: c,
8395
8381
  isReferenceHidden: u,
8396
8382
  hasPopperEscaped: f
@@ -8409,20 +8395,20 @@ const df = {
8409
8395
  function pf(n, e, t) {
8410
8396
  var r = Ce(n), i = [te, ee].indexOf(r) >= 0 ? -1 : 1, o = typeof t == "function" ? t(Object.assign({}, e, {
8411
8397
  placement: n
8412
- })) : t, s = o[0], a = o[1];
8413
- return s = s || 0, a = (a || 0) * i, [te, me].indexOf(r) >= 0 ? {
8414
- x: a,
8398
+ })) : t, s = o[0], l = o[1];
8399
+ return s = s || 0, l = (l || 0) * i, [te, me].indexOf(r) >= 0 ? {
8400
+ x: l,
8415
8401
  y: s
8416
8402
  } : {
8417
8403
  x: s,
8418
- y: a
8404
+ y: l
8419
8405
  };
8420
8406
  }
8421
8407
  function hf(n) {
8422
8408
  var e = n.state, t = n.options, r = n.name, i = t.offset, o = i === void 0 ? [0, 0] : i, s = Ps.reduce(function(u, f) {
8423
8409
  return u[f] = pf(f, e.rects, o), u;
8424
- }, {}), a = s[e.placement], l = a.x, c = a.y;
8425
- e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += l, e.modifiersData.popperOffsets.y += c), e.modifiersData[r] = s;
8410
+ }, {}), l = s[e.placement], a = l.x, c = l.y;
8411
+ e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += a, e.modifiersData.popperOffsets.y += c), e.modifiersData[r] = s;
8426
8412
  }
8427
8413
  const mf = {
8428
8414
  name: "offset",
@@ -8450,8 +8436,8 @@ function vf(n) {
8450
8436
  return n === "x" ? "y" : "x";
8451
8437
  }
8452
8438
  function bf(n) {
8453
- var e = n.state, t = n.options, r = n.name, i = t.mainAxis, o = i === void 0 ? !0 : i, s = t.altAxis, a = s === void 0 ? !1 : s, l = t.boundary, c = t.rootBoundary, u = t.altBoundary, f = t.padding, p = t.tether, d = p === void 0 ? !0 : p, g = t.tetherOffset, m = g === void 0 ? 0 : g, y = en(e, {
8454
- boundary: l,
8439
+ var e = n.state, t = n.options, r = n.name, i = t.mainAxis, o = i === void 0 ? !0 : i, s = t.altAxis, l = s === void 0 ? !1 : s, a = t.boundary, c = t.rootBoundary, u = t.altBoundary, f = t.padding, p = t.tether, d = p === void 0 ? !0 : p, g = t.tetherOffset, m = g === void 0 ? 0 : g, y = en(e, {
8440
+ boundary: a,
8455
8441
  rootBoundary: c,
8456
8442
  padding: f,
8457
8443
  altBoundary: u
@@ -8472,11 +8458,11 @@ function bf(n) {
8472
8458
  var B, ne = h === "y" ? ee : te, re = h === "y" ? he : me, q = h === "y" ? "height" : "width", K = x[h], H = K + y[ne], be = K - y[re], xe = d ? -P[q] / 2 : 0, qe = C === Ot ? N[q] : P[q], ke = C === Ot ? -P[q] : -N[q], Ke = e.elements.arrow, Me = d && Ke ? ii(Ke) : {
8473
8459
  width: 0,
8474
8460
  height: 0
8475
- }, ge = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : Ls(), Ae = ge[ne], pt = ge[re], Ne = Wt(0, N[q], Me[q]), ht = T ? N[q] / 2 - xe - Ne - Ae - L.mainAxis : qe - Ne - Ae - L.mainAxis, ze = T ? -N[q] / 2 + xe + Ne + pt + L.mainAxis : ke + Ne + pt + L.mainAxis, mt = e.elements.arrow && an(e.elements.arrow), cn = mt ? h === "y" ? mt.clientTop || 0 : mt.clientLeft || 0 : 0, Nt = (B = j == null ? void 0 : j[h]) != null ? B : 0, un = K + ht - Nt - cn, fn = K + ze - Nt, It = Wt(d ? Jn(H, un) : H, K, d ? at(be, fn) : be);
8461
+ }, ge = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : Ls(), Ae = ge[ne], pt = ge[re], Ne = Wt(0, N[q], Me[q]), ht = T ? N[q] / 2 - xe - Ne - Ae - L.mainAxis : qe - Ne - Ae - L.mainAxis, ze = T ? -N[q] / 2 + xe + Ne + pt + L.mainAxis : ke + Ne + pt + L.mainAxis, mt = e.elements.arrow && ln(e.elements.arrow), cn = mt ? h === "y" ? mt.clientTop || 0 : mt.clientLeft || 0 : 0, Nt = (B = j?.[h]) != null ? B : 0, un = K + ht - Nt - cn, fn = K + ze - Nt, It = Wt(d ? Jn(H, un) : H, K, d ? lt(be, fn) : be);
8476
8462
  x[h] = It, $[h] = It - K;
8477
8463
  }
8478
- if (a) {
8479
- var Dt, dn = h === "x" ? ee : te, pn = h === "x" ? he : me, Ie = x[M], Fe = M === "y" ? "height" : "width", Rt = Ie + y[dn], Ue = Ie - y[pn], Pt = [ee, te].indexOf(b) !== -1, hn = (Dt = j == null ? void 0 : j[M]) != null ? Dt : 0, mn = Pt ? Rt : Ie - N[Fe] - P[Fe] - hn + L.altAxis, gn = Pt ? Ie + N[Fe] + P[Fe] - hn - L.altAxis : Ue, yn = d && Pt ? Wu(mn, Ie, gn) : Wt(d ? mn : Rt, Ie, d ? gn : Ue);
8464
+ if (l) {
8465
+ var Dt, dn = h === "x" ? ee : te, pn = h === "x" ? he : me, Ie = x[M], Fe = M === "y" ? "height" : "width", Rt = Ie + y[dn], Ue = Ie - y[pn], Pt = [ee, te].indexOf(b) !== -1, hn = (Dt = j?.[M]) != null ? Dt : 0, mn = Pt ? Rt : Ie - N[Fe] - P[Fe] - hn + L.altAxis, gn = Pt ? Ie + N[Fe] + P[Fe] - hn - L.altAxis : Ue, yn = d && Pt ? Wu(mn, Ie, gn) : Wt(d ? mn : Rt, Ie, d ? gn : Ue);
8480
8466
  x[M] = yn, $[M] = yn - Ie;
8481
8467
  }
8482
8468
  e.modifiersData[r] = $;
@@ -8504,17 +8490,17 @@ function Sf(n) {
8504
8490
  }
8505
8491
  function Cf(n, e, t) {
8506
8492
  t === void 0 && (t = !1);
8507
- var r = pe(e), i = pe(e) && Sf(e), o = Je(e), s = Tt(n, i, t), a = {
8493
+ var r = pe(e), i = pe(e) && Sf(e), o = Je(e), s = Tt(n, i, t), l = {
8508
8494
  scrollLeft: 0,
8509
8495
  scrollTop: 0
8510
- }, l = {
8496
+ }, a = {
8511
8497
  x: 0,
8512
8498
  y: 0
8513
8499
  };
8514
8500
  return (r || !r && !t) && ((Ee(e) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
8515
- li(o)) && (a = wf(e)), pe(e) ? (l = Tt(e, !0), l.x += e.clientLeft, l.y += e.clientTop) : o && (l.x = ai(o))), {
8516
- x: s.left + a.scrollLeft - l.x,
8517
- y: s.top + a.scrollTop - l.y,
8501
+ ai(o)) && (l = wf(e)), pe(e) ? (a = Tt(e, !0), a.x += e.clientLeft, a.y += e.clientTop) : o && (a.x = li(o))), {
8502
+ x: s.left + l.scrollLeft - a.x,
8503
+ y: s.top + l.scrollTop - a.y,
8518
8504
  width: s.width,
8519
8505
  height: s.height
8520
8506
  };
@@ -8527,10 +8513,10 @@ function Of(n) {
8527
8513
  function i(o) {
8528
8514
  t.add(o.name);
8529
8515
  var s = [].concat(o.requires || [], o.requiresIfExists || []);
8530
- s.forEach(function(a) {
8531
- if (!t.has(a)) {
8532
- var l = e.get(a);
8533
- l && i(l);
8516
+ s.forEach(function(l) {
8517
+ if (!t.has(l)) {
8518
+ var a = e.get(l);
8519
+ a && i(a);
8534
8520
  }
8535
8521
  }), r.push(o);
8536
8522
  }
@@ -8583,7 +8569,7 @@ function no() {
8583
8569
  function Af(n) {
8584
8570
  n === void 0 && (n = {});
8585
8571
  var e = n, t = e.defaultModifiers, r = t === void 0 ? [] : t, i = e.defaultOptions, o = i === void 0 ? to : i;
8586
- return function(a, l, c) {
8572
+ return function(l, a, c) {
8587
8573
  c === void 0 && (c = o);
8588
8574
  var u = {
8589
8575
  placement: "bottom",
@@ -8591,8 +8577,8 @@ function Af(n) {
8591
8577
  options: Object.assign({}, to, o),
8592
8578
  modifiersData: {},
8593
8579
  elements: {
8594
- reference: a,
8595
- popper: l
8580
+ reference: l,
8581
+ popper: a
8596
8582
  },
8597
8583
  attributes: {},
8598
8584
  styles: {}
@@ -8601,8 +8587,8 @@ function Af(n) {
8601
8587
  setOptions: function(b) {
8602
8588
  var C = typeof b == "function" ? b(u.options) : b;
8603
8589
  m(), u.options = Object.assign({}, o, u.options, C), u.scrollParents = {
8604
- reference: ct(a) ? Ht(a) : a.contextElement ? Ht(a.contextElement) : [],
8605
- popper: Ht(l)
8590
+ reference: ct(l) ? Ht(l) : l.contextElement ? Ht(l.contextElement) : [],
8591
+ popper: Ht(a)
8606
8592
  };
8607
8593
  var T = Ef(Mf([].concat(r, u.options.modifiers)));
8608
8594
  return u.orderedModifiers = T.filter(function(h) {
@@ -8619,7 +8605,7 @@ function Af(n) {
8619
8605
  var b = u.elements, C = b.reference, T = b.popper;
8620
8606
  if (no(C, T)) {
8621
8607
  u.rects = {
8622
- reference: Cf(C, an(T), u.options.strategy === "fixed"),
8608
+ reference: Cf(C, ln(T), u.options.strategy === "fixed"),
8623
8609
  popper: ii(T)
8624
8610
  }, u.reset = !1, u.placement = u.options.placement, u.orderedModifiers.forEach(function(L) {
8625
8611
  return u.modifiersData[L.name] = Object.assign({}, L.data);
@@ -8651,7 +8637,7 @@ function Af(n) {
8651
8637
  m(), p = !0;
8652
8638
  }
8653
8639
  };
8654
- if (!no(a, l))
8640
+ if (!no(l, a))
8655
8641
  return d;
8656
8642
  d.setOptions(c).then(function(y) {
8657
8643
  !p && c.onFirstUpdate && c.onFirstUpdate(y);
@@ -8782,10 +8768,10 @@ function Hf(n) {
8782
8768
  function Jf(n, e) {
8783
8769
  var t = e.clientX, r = e.clientY;
8784
8770
  return n.every(function(i) {
8785
- var o = i.popperRect, s = i.popperState, a = i.props, l = a.interactiveBorder, c = Lf(s.placement), u = s.modifiersData.offset;
8771
+ var o = i.popperRect, s = i.popperState, l = i.props, a = l.interactiveBorder, c = Lf(s.placement), u = s.modifiersData.offset;
8786
8772
  if (!u)
8787
8773
  return !0;
8788
- var f = c === "bottom" ? u.top.y : 0, p = c === "top" ? u.bottom.y : 0, d = c === "right" ? u.left.x : 0, g = c === "left" ? u.right.x : 0, m = o.top - r + f > l, y = r - o.bottom - p > l, b = o.left - t + d > l, C = t - o.right - g > l;
8774
+ var f = c === "bottom" ? u.top.y : 0, p = c === "top" ? u.bottom.y : 0, d = c === "right" ? u.left.x : 0, g = c === "left" ? u.right.x : 0, m = o.top - r + f > a, y = r - o.bottom - p > a, b = o.left - t + d > a, C = t - o.right - g > a;
8789
8775
  return m || y || b || C;
8790
8776
  });
8791
8777
  }
@@ -8795,7 +8781,7 @@ function mr(n, e, t) {
8795
8781
  n[r](i, t);
8796
8782
  });
8797
8783
  }
8798
- function ao(n, e) {
8784
+ function lo(n, e) {
8799
8785
  for (var t = e; t; ) {
8800
8786
  var r;
8801
8787
  if (n.contains(t))
@@ -8806,13 +8792,13 @@ function ao(n, e) {
8806
8792
  }
8807
8793
  var we = {
8808
8794
  isTouch: !1
8809
- }, lo = 0;
8795
+ }, ao = 0;
8810
8796
  function qf() {
8811
8797
  we.isTouch || (we.isTouch = !0, window.performance && document.addEventListener("mousemove", Gs));
8812
8798
  }
8813
8799
  function Gs() {
8814
8800
  var n = performance.now();
8815
- n - lo < 20 && (we.isTouch = !1, document.removeEventListener("mousemove", Gs)), lo = n;
8801
+ n - ao < 20 && (we.isTouch = !1, document.removeEventListener("mousemove", Gs)), ao = n;
8816
8802
  }
8817
8803
  function Kf() {
8818
8804
  var n = document.activeElement;
@@ -8951,8 +8937,8 @@ function Qs(n) {
8951
8937
  var e = n.plugins || [], t = e.reduce(function(r, i) {
8952
8938
  var o = i.name, s = i.defaultValue;
8953
8939
  if (o) {
8954
- var a;
8955
- r[o] = n[o] !== void 0 ? n[o] : (a = se[o]) != null ? a : s;
8940
+ var l;
8941
+ r[o] = n[o] !== void 0 ? n[o] : (l = se[o]) != null ? l : s;
8956
8942
  }
8957
8943
  return r;
8958
8944
  }, {});
@@ -9033,8 +9019,8 @@ function _s(n) {
9033
9019
  var r = Jt();
9034
9020
  r.className = Hs, r.setAttribute("data-state", "hidden"), po(r, n.props), e.appendChild(t), t.appendChild(r), i(n.props, n.props);
9035
9021
  function i(o, s) {
9036
- var a = Rr(e), l = a.box, c = a.content, u = a.arrow;
9037
- s.theme ? l.setAttribute("data-theme", s.theme) : l.removeAttribute("data-theme"), typeof s.animation == "string" ? l.setAttribute("data-animation", s.animation) : l.removeAttribute("data-animation"), s.inertia ? l.setAttribute("data-inertia", "") : l.removeAttribute("data-inertia"), l.style.maxWidth = typeof s.maxWidth == "number" ? s.maxWidth + "px" : s.maxWidth, s.role ? l.setAttribute("role", s.role) : l.removeAttribute("role"), (o.content !== s.content || o.allowHTML !== s.allowHTML) && po(c, n.props), s.arrow ? u ? o.arrow !== s.arrow && (l.removeChild(u), l.appendChild(fo(s.arrow))) : l.appendChild(fo(s.arrow)) : u && l.removeChild(u);
9022
+ var l = Rr(e), a = l.box, c = l.content, u = l.arrow;
9023
+ s.theme ? a.setAttribute("data-theme", s.theme) : a.removeAttribute("data-theme"), typeof s.animation == "string" ? a.setAttribute("data-animation", s.animation) : a.removeAttribute("data-animation"), s.inertia ? a.setAttribute("data-inertia", "") : a.removeAttribute("data-inertia"), a.style.maxWidth = typeof s.maxWidth == "number" ? s.maxWidth + "px" : s.maxWidth, s.role ? a.setAttribute("role", s.role) : a.removeAttribute("role"), (o.content !== s.content || o.allowHTML !== s.allowHTML) && po(c, n.props), s.arrow ? u ? o.arrow !== s.arrow && (a.removeChild(u), a.appendChild(fo(s.arrow))) : a.appendChild(fo(s.arrow)) : u && a.removeChild(u);
9038
9024
  }
9039
9025
  return {
9040
9026
  popper: e,
@@ -9044,7 +9030,7 @@ function _s(n) {
9044
9030
  _s.$$tippy = !0;
9045
9031
  var id = 1, En = [], gr = [];
9046
9032
  function od(n, e) {
9047
- var t = uo(n, Object.assign({}, se, Qs(oo(e)))), r, i, o, s = !1, a = !1, l = !1, c = !1, u, f, p, d = [], g = ro(un, t.interactiveDebounce), m, y = id++, b = null, C = Ff(t.plugins), T = {
9033
+ var t = uo(n, Object.assign({}, se, Qs(oo(e)))), r, i, o, s = !1, l = !1, a = !1, c = !1, u, f, p, d = [], g = ro(un, t.interactiveDebounce), m, y = id++, b = null, C = Ff(t.plugins), T = {
9048
9034
  // Is the instance currently enabled?
9049
9035
  isEnabled: !0,
9050
9036
  // Is the tippy currently showing and not transitioning out?
@@ -9068,13 +9054,13 @@ function od(n, e) {
9068
9054
  clearDelayTimeouts: mn,
9069
9055
  setProps: gn,
9070
9056
  setContent: yn,
9071
- show: ta,
9072
- hide: na,
9073
- hideWithInteractivity: ra,
9057
+ show: tl,
9058
+ hide: nl,
9059
+ hideWithInteractivity: rl,
9074
9060
  enable: Pt,
9075
9061
  disable: hn,
9076
- unmount: ia,
9077
- destroy: oa
9062
+ unmount: il,
9063
+ destroy: ol
9078
9064
  };
9079
9065
  if (!t.render)
9080
9066
  return process.env.NODE_ENV !== "production" && Ir(!0, "render() function has not been supplied."), h;
@@ -9152,27 +9138,27 @@ function od(n, e) {
9152
9138
  });
9153
9139
  }
9154
9140
  function ke(v) {
9155
- if (!(we.isTouch && (l || v.type === "mousedown"))) {
9141
+ if (!(we.isTouch && (a || v.type === "mousedown"))) {
9156
9142
  var w = v.composedPath && v.composedPath()[0] || v.target;
9157
- if (!(h.props.interactive && ao(x, w))) {
9143
+ if (!(h.props.interactive && lo(x, w))) {
9158
9144
  if (wt(h.props.triggerTarget || n).some(function(E) {
9159
- return ao(E, w);
9145
+ return lo(E, w);
9160
9146
  })) {
9161
9147
  if (we.isTouch || h.state.isVisible && h.props.trigger.indexOf("click") >= 0)
9162
9148
  return;
9163
9149
  } else
9164
9150
  H("onClickOutside", [h, v]);
9165
- h.props.hideOnClick === !0 && (h.clearDelayTimeouts(), h.hide(), a = !0, setTimeout(function() {
9166
- a = !1;
9151
+ h.props.hideOnClick === !0 && (h.clearDelayTimeouts(), h.hide(), l = !0, setTimeout(function() {
9152
+ l = !1;
9167
9153
  }), h.state.isMounted || Ae());
9168
9154
  }
9169
9155
  }
9170
9156
  }
9171
9157
  function Ke() {
9172
- l = !0;
9158
+ a = !0;
9173
9159
  }
9174
9160
  function Me() {
9175
- l = !1;
9161
+ a = !1;
9176
9162
  }
9177
9163
  function ge() {
9178
9164
  var v = ne();
@@ -9239,7 +9225,7 @@ function od(n, e) {
9239
9225
  }
9240
9226
  function Nt(v) {
9241
9227
  var w, E = !1;
9242
- if (!(!h.state.isEnabled || Dt(v) || a)) {
9228
+ if (!(!h.state.isEnabled || Dt(v) || l)) {
9243
9229
  var R = ((w = u) == null ? void 0 : w.type) === "focus";
9244
9230
  u = v, m = v.currentTarget, xe(), !h.state.isVisible && Vf(v) && En.forEach(function(I) {
9245
9231
  return I(v);
@@ -9289,7 +9275,7 @@ function od(n, e) {
9289
9275
  fn: function(vn) {
9290
9276
  var yt = vn.state;
9291
9277
  if ($()) {
9292
- var sa = re(), tr = sa.box;
9278
+ var sl = re(), tr = sl.box;
9293
9279
  ["placement", "reference-hidden", "escaped"].forEach(function(bn) {
9294
9280
  bn === "placement" ? tr.setAttribute("data-placement", yt.placement) : yt.attributes.popper["data-popper-" + bn] ? tr.setAttribute("data-" + bn, "") : tr.removeAttribute("data-" + bn);
9295
9281
  }), yt.attributes.popper = {};
@@ -9327,7 +9313,7 @@ function od(n, e) {
9327
9313
  element: fe,
9328
9314
  padding: 3
9329
9315
  }
9330
- }), Ge.push.apply(Ge, (w == null ? void 0 : w.modifiers) || []), h.popperInstance = If(gt, x, Object.assign({}, w, {
9316
+ }), Ge.push.apply(Ge, w?.modifiers || []), h.popperInstance = If(gt, x, Object.assign({}, w, {
9331
9317
  placement: E,
9332
9318
  onFirstUpdate: p,
9333
9319
  modifiers: Ge
@@ -9397,7 +9383,7 @@ function od(n, e) {
9397
9383
  content: v
9398
9384
  });
9399
9385
  }
9400
- function ta() {
9386
+ function tl() {
9401
9387
  process.env.NODE_ENV !== "production" && De(h.state.isDestroyed, bt("show"));
9402
9388
  var v = h.state.isVisible, w = h.state.isDestroyed, E = !h.state.isEnabled, R = we.isTouch && !h.props.touch, I = pr(h.props.duration, 0, se.duration);
9403
9389
  if (!(v || w || E || R) && !B().hasAttribute("disabled") && (H("onShow", [h], !1), h.props.onShow(h) !== !1)) {
@@ -9419,7 +9405,7 @@ function od(n, e) {
9419
9405
  }, Ie();
9420
9406
  }
9421
9407
  }
9422
- function na() {
9408
+ function nl() {
9423
9409
  process.env.NODE_ENV !== "production" && De(h.state.isDestroyed, bt("hide"));
9424
9410
  var v = !h.state.isVisible, w = h.state.isDestroyed, E = !h.state.isEnabled, R = pr(h.props.duration, 1, se.duration);
9425
9411
  if (!(v || w || E) && (H("onHide", [h], !1), h.props.onHide(h) !== !1)) {
@@ -9430,21 +9416,21 @@ function od(n, e) {
9430
9416
  be(), xe(), h.props.animation ? $() && pt(R, h.unmount) : h.unmount();
9431
9417
  }
9432
9418
  }
9433
- function ra(v) {
9419
+ function rl(v) {
9434
9420
  process.env.NODE_ENV !== "production" && De(h.state.isDestroyed, bt("hideWithInteractivity")), ne().addEventListener("mousemove", g), io(En, g), g(v);
9435
9421
  }
9436
- function ia() {
9422
+ function il() {
9437
9423
  process.env.NODE_ENV !== "production" && De(h.state.isDestroyed, bt("unmount")), h.state.isVisible && h.hide(), h.state.isMounted && (pn(), Fe().forEach(function(v) {
9438
9424
  v._tippy.unmount();
9439
9425
  }), x.parentNode && x.parentNode.removeChild(x), gr = gr.filter(function(v) {
9440
9426
  return v !== h;
9441
9427
  }), h.state.isMounted = !1, H("onHidden", [h]));
9442
9428
  }
9443
- function oa() {
9429
+ function ol() {
9444
9430
  process.env.NODE_ENV !== "production" && De(h.state.isDestroyed, bt("destroy")), !h.state.isDestroyed && (h.clearDelayTimeouts(), h.unmount(), cn(), delete n._tippy, h.state.isDestroyed = !0, H("onDestroy", [h]));
9445
9431
  }
9446
9432
  }
9447
- function ln(n, e) {
9433
+ function an(n, e) {
9448
9434
  e === void 0 && (e = {});
9449
9435
  var t = se.plugins.concat(e.plugins || []);
9450
9436
  process.env.NODE_ENV !== "production" && (Zf(n), Zs(e, t)), Uf();
@@ -9460,15 +9446,15 @@ function ln(n, e) {
9460
9446
  `, `1) content: element.innerHTML
9461
9447
  `, "2) content: () => element.cloneNode(true)"].join(" "));
9462
9448
  }
9463
- var a = i.reduce(function(l, c) {
9449
+ var l = i.reduce(function(a, c) {
9464
9450
  var u = c && od(c, r);
9465
- return u && l.push(u), l;
9451
+ return u && a.push(u), a;
9466
9452
  }, []);
9467
- return tn(n) ? a[0] : a;
9453
+ return tn(n) ? l[0] : l;
9468
9454
  }
9469
- ln.defaultProps = se;
9470
- ln.setDefaultProps = td;
9471
- ln.currentInput = we;
9455
+ an.defaultProps = se;
9456
+ an.setDefaultProps = td;
9457
+ an.currentInput = we;
9472
9458
  Object.assign({}, Bs, {
9473
9459
  effect: function(e) {
9474
9460
  var t = e.state, r = {
@@ -9486,45 +9472,45 @@ Object.assign({}, Bs, {
9486
9472
  Object.assign(t.elements.popper.style, r.popper), t.styles = r, t.elements.arrow && Object.assign(t.elements.arrow.style, r.arrow);
9487
9473
  }
9488
9474
  });
9489
- ln.setDefaultProps({
9475
+ an.setDefaultProps({
9490
9476
  render: _s
9491
9477
  });
9492
9478
  class sd {
9493
9479
  constructor({ editor: e, element: t, view: r, tippyOptions: i = {}, updateDelay: o = 250, shouldShow: s }) {
9494
- this.preventHide = !1, this.shouldShow = ({ view: a, state: l, from: c, to: u }) => {
9495
- const { doc: f, selection: p } = l, { empty: d } = p, g = !f.textBetween(c, u).length && Zr(l.selection), m = this.element.contains(document.activeElement);
9496
- return !(!(a.hasFocus() || m) || d || g || !this.editor.isEditable);
9480
+ this.preventHide = !1, this.shouldShow = ({ view: l, state: a, from: c, to: u }) => {
9481
+ const { doc: f, selection: p } = a, { empty: d } = p, g = !f.textBetween(c, u).length && Zr(a.selection), m = this.element.contains(document.activeElement);
9482
+ return !(!(l.hasFocus() || m) || d || g || !this.editor.isEditable);
9497
9483
  }, this.mousedownHandler = () => {
9498
9484
  this.preventHide = !0;
9499
9485
  }, this.dragstartHandler = () => {
9500
9486
  this.hide();
9501
9487
  }, this.focusHandler = () => {
9502
9488
  setTimeout(() => this.update(this.editor.view));
9503
- }, this.blurHandler = ({ event: a }) => {
9504
- var l;
9489
+ }, this.blurHandler = ({ event: l }) => {
9490
+ var a;
9505
9491
  if (this.preventHide) {
9506
9492
  this.preventHide = !1;
9507
9493
  return;
9508
9494
  }
9509
- a != null && a.relatedTarget && (!((l = this.element.parentNode) === null || l === void 0) && l.contains(a.relatedTarget)) || (a == null ? void 0 : a.relatedTarget) !== this.editor.view.dom && this.hide();
9510
- }, this.tippyBlurHandler = (a) => {
9511
- this.blurHandler({ event: a });
9512
- }, this.handleDebouncedUpdate = (a, l) => {
9513
- const c = !(l != null && l.selection.eq(a.state.selection)), u = !(l != null && l.doc.eq(a.state.doc));
9495
+ l?.relatedTarget && (!((a = this.element.parentNode) === null || a === void 0) && a.contains(l.relatedTarget)) || l?.relatedTarget !== this.editor.view.dom && this.hide();
9496
+ }, this.tippyBlurHandler = (l) => {
9497
+ this.blurHandler({ event: l });
9498
+ }, this.handleDebouncedUpdate = (l, a) => {
9499
+ const c = !a?.selection.eq(l.state.selection), u = !a?.doc.eq(l.state.doc);
9514
9500
  !c && !u || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
9515
- this.updateHandler(a, c, u, l);
9501
+ this.updateHandler(l, c, u, a);
9516
9502
  }, this.updateDelay));
9517
- }, this.updateHandler = (a, l, c, u) => {
9503
+ }, this.updateHandler = (l, a, c, u) => {
9518
9504
  var f, p, d;
9519
- const { state: g, composing: m } = a, { selection: y } = g;
9520
- if (m || !l && !c)
9505
+ const { state: g, composing: m } = l, { selection: y } = g;
9506
+ if (m || !a && !c)
9521
9507
  return;
9522
9508
  this.createTooltip();
9523
9509
  const { ranges: C } = y, T = Math.min(...C.map((x) => x.$from.pos)), h = Math.max(...C.map((x) => x.$to.pos));
9524
9510
  if (!((f = this.shouldShow) === null || f === void 0 ? void 0 : f.call(this, {
9525
9511
  editor: this.editor,
9526
9512
  element: this.element,
9527
- view: a,
9513
+ view: l,
9528
9514
  state: g,
9529
9515
  oldState: u,
9530
9516
  from: T,
@@ -9536,21 +9522,21 @@ class sd {
9536
9522
  (p = this.tippy) === null || p === void 0 || p.setProps({
9537
9523
  getReferenceClientRect: ((d = this.tippyOptions) === null || d === void 0 ? void 0 : d.getReferenceClientRect) || (() => {
9538
9524
  if (_c(g.selection)) {
9539
- let x = a.nodeDOM(T);
9525
+ let x = l.nodeDOM(T);
9540
9526
  if (x) {
9541
9527
  const N = x.dataset.nodeViewWrapper ? x : x.querySelector("[data-node-view-wrapper]");
9542
9528
  if (N && (x = N.firstChild), x)
9543
9529
  return x.getBoundingClientRect();
9544
9530
  }
9545
9531
  }
9546
- return Ds(a, T, h);
9532
+ return Ds(l, T, h);
9547
9533
  })
9548
9534
  }), this.show();
9549
9535
  }, this.editor = e, this.element = t, this.view = r, this.updateDelay = o, s && (this.shouldShow = s), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = i, this.element.remove(), this.element.style.visibility = "visible";
9550
9536
  }
9551
9537
  createTooltip() {
9552
9538
  const { element: e } = this.editor.options, t = !!e.parentElement;
9553
- this.element.tabIndex = 0, !(this.tippy || !t) && (this.tippy = ln(e, {
9539
+ this.element.tabIndex = 0, !(this.tippy || !t) && (this.tippy = an(e, {
9554
9540
  duration: 0,
9555
9541
  getReferenceClientRect: null,
9556
9542
  content: this.element,
@@ -9567,7 +9553,7 @@ class sd {
9567
9553
  this.handleDebouncedUpdate(e, t);
9568
9554
  return;
9569
9555
  }
9570
- const o = !(t != null && t.selection.eq(e.state.selection)), s = !(t != null && t.doc.eq(e.state.doc));
9556
+ const o = !t?.selection.eq(e.state.selection), s = !t?.doc.eq(e.state.doc);
9571
9557
  this.updateHandler(e, o, s, t);
9572
9558
  }
9573
9559
  show() {
@@ -9583,10 +9569,10 @@ class sd {
9583
9569
  !((e = this.tippy) === null || e === void 0) && e.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (t = this.tippy) === null || t === void 0 || t.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
9584
9570
  }
9585
9571
  }
9586
- const ad = (n) => new Te({
9572
+ const ld = (n) => new Te({
9587
9573
  key: typeof n.pluginKey == "string" ? new ye(n.pluginKey) : n.pluginKey,
9588
9574
  view: (e) => new sd({ view: e, ...n })
9589
- }), ld = ce.create({
9575
+ }), ad = ce.create({
9590
9576
  name: "bubbleMenu",
9591
9577
  addOptions() {
9592
9578
  return {
@@ -9599,7 +9585,7 @@ const ad = (n) => new Te({
9599
9585
  },
9600
9586
  addProseMirrorPlugins() {
9601
9587
  return this.options.element ? [
9602
- ad({
9588
+ ld({
9603
9589
  pluginKey: this.options.pluginKey,
9604
9590
  editor: this.editor,
9605
9591
  element: this.options.element,
@@ -9611,7 +9597,7 @@ const ad = (n) => new Te({
9611
9597
  }
9612
9598
  });
9613
9599
  function hd(n) {
9614
- return ld.configure({
9600
+ return ad.configure({
9615
9601
  pluginKey: new ye("tableBubbleMenu"),
9616
9602
  tippyOptions: {
9617
9603
  animation: !0,
@@ -9629,7 +9615,7 @@ function hd(n) {
9629
9615
  ]
9630
9616
  },
9631
9617
  getReferenceClientRect: () => {
9632
- const { state: e, view: t } = n(), r = new Qe(e.selection.$anchor, n()), i = ea(r);
9618
+ const { state: e, view: t } = n(), r = new Qe(e.selection.$anchor, n()), i = el(r);
9633
9619
  return i ? i.getBoundingClientRect() : Ds(t, 0, 0);
9634
9620
  }
9635
9621
  },
@@ -9637,11 +9623,11 @@ function hd(n) {
9637
9623
  element: document.querySelector("tiptob-table-bubble-menu")
9638
9624
  });
9639
9625
  }
9640
- function ea(n) {
9626
+ function el(n) {
9641
9627
  if (n.node.type.name === "table")
9642
9628
  return n.element;
9643
9629
  const e = n.parent;
9644
- return e ? ea(e) : null;
9630
+ return e ? el(e) : null;
9645
9631
  }
9646
9632
  const md = ce.create({
9647
9633
  name: "selectionDecoration",
@@ -9724,13 +9710,12 @@ const md = ce.create({
9724
9710
  }), gd = fd.extend({
9725
9711
  priority: 103,
9726
9712
  parseHTML() {
9727
- var n;
9728
9713
  return [
9729
- ...(n = this.parent) == null ? void 0 : n.call(this),
9714
+ ...this.parent?.(),
9730
9715
  {
9731
9716
  consuming: !1,
9732
9717
  tag: "span",
9733
- getAttrs: (e) => e.style.backgroundColor !== "" ? { color: e.style.backgroundColor } : !1
9718
+ getAttrs: (n) => n.style.backgroundColor !== "" ? { color: n.style.backgroundColor } : !1
9734
9719
  }
9735
9720
  ];
9736
9721
  },