@milkdown/preset-gfm 6.5.0 → 6.5.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.
package/lib/index.es.js CHANGED
@@ -1,19 +1,22 @@
1
- import { SupportedKeys as lt, commonmark as st, commands as rt } from "@milkdown/preset-commonmark";
2
- import { InsertHardbreak as io, InsertHr as co, InsertImage as ao, LiftListItem as fo, ModifyImage as uo, ModifyLink as po, SinkListItem as ho, SplitListItem as mo, ToggleBold as go, ToggleInlineCode as wo, ToggleItalic as bo, ToggleLink as Co, TurnIntoCodeFence as yo, TurnIntoHeading as ko, TurnIntoText as Ao, WrapInBlockquote as Mo, WrapInBulletList as No, WrapInOrderedList as So, blockquote as xo, bulletList as Ro, codeFence as To, codeInline as Lo, commonmark as vo, commonmarkNodes as Eo, commonmarkPlugins as Io, doc as $o, em as Do, HardbreakFilterPluginKey as Oo, heading as _o, hr as zo, image as Fo, link as Bo, listItem as Po, orderedList as Wo, paragraph as Ho, strong as jo, text as Ko } from "@milkdown/preset-commonmark";
3
- import { createNode as ye, createPlugin as it, createShortcut as D, createMark as ct, AtomList as at, $remark as dt } from "@milkdown/utils";
4
- import ft from "remark-gfm";
5
- import { createCmdKey as R, editorViewCtx as te, createCmd as S, commandsCtx as Ue, themeManagerCtx as L, ThemeIcon as v, getPalette as ut, ThemeSize as Re, ThemeBorder as pt, ThemeShadow as ht, schemaCtx as V } from "@milkdown/core";
6
- import { expectDomTypeError as ke, missingRootElement as mt } from "@milkdown/exception";
7
- import { findSelectedNodeOfType as B, findParentNode as gt, cloneTr as Ve, calculateNodePosition as wt, browser as Te } from "@milkdown/prose";
8
- import { wrappingInputRule as Ge, InputRule as fe } from "@milkdown/prose/inputrules";
9
- import { PluginKey as F, NodeSelection as ne, Plugin as W, Selection as N, SelectionRange as bt, TextSelection as E } from "@milkdown/prose/state";
10
- import { toggleMark as Ct, wrapIn as yt } from "@milkdown/prose/commands";
11
- import { Fragment as I, Slice as O } from "@milkdown/prose/model";
12
- import { Decoration as Ae, DecorationSet as Me } from "@milkdown/prose/view";
13
- import { keydownHandler as kt } from "@milkdown/prose/keymap";
14
- import { Transform as At } from "@milkdown/prose/transform";
15
- import { splitListItem as Mt, sinkListItem as Nt, liftListItem as St } from "@milkdown/prose/schema-list";
16
- const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new F("MILKDOWN_FOOTNOTE_DEF_INPUT"), Le = R("ModifyFootnoteDef"), Rt = ye((o) => {
1
+ var st = Object.defineProperty;
2
+ var rt = (o, e, t) => e in o ? st(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var $ = (o, e, t) => (rt(o, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { SupportedKeys as it, commonmark as ct, commands as at } from "@milkdown/preset-commonmark";
5
+ import { InsertHardbreak as uo, InsertHr as po, InsertImage as ho, LiftListItem as mo, ModifyImage as go, ModifyLink as wo, SinkListItem as bo, SplitListItem as Co, ToggleBold as yo, ToggleInlineCode as ko, ToggleItalic as Ao, ToggleLink as Mo, TurnIntoCodeFence as So, TurnIntoHeading as No, TurnIntoText as xo, WrapInBlockquote as Ro, WrapInBulletList as To, WrapInOrderedList as Lo, blockquote as vo, bulletList as Eo, codeFence as Io, codeInline as $o, commonmark as Do, commonmarkNodes as Oo, commonmarkPlugins as _o, doc as zo, em as Fo, HardbreakFilterPluginKey as Bo, heading as Wo, hr as Po, image as Ho, link as jo, listItem as Ko, orderedList as qo, paragraph as Xo, strong as Uo, text as Vo } from "@milkdown/preset-commonmark";
6
+ import { createNode as ke, createPlugin as dt, createShortcut as O, createMark as ft, AtomList as ut, $remark as pt } from "@milkdown/utils";
7
+ import ht from "remark-gfm";
8
+ import { createCmdKey as R, editorViewCtx as ne, createCmd as N, commandsCtx as Ve, themeManagerCtx as L, ThemeIcon as v, getPalette as mt, ThemeSize as Te, ThemeBorder as gt, ThemeShadow as wt, schemaCtx as G } from "@milkdown/core";
9
+ import { expectDomTypeError as Ae, missingRootElement as bt } from "@milkdown/exception";
10
+ import { findSelectedNodeOfType as W, findParentNode as Ct, cloneTr as Ge, calculateNodePosition as yt, browser as Le } from "@milkdown/prose";
11
+ import { wrappingInputRule as Je, InputRule as ue } from "@milkdown/prose/inputrules";
12
+ import { PluginKey as B, NodeSelection as oe, Plugin as H, Selection as S, SelectionRange as kt, TextSelection as E } from "@milkdown/prose/state";
13
+ import { toggleMark as At, wrapIn as Mt } from "@milkdown/prose/commands";
14
+ import { Fragment as I, Slice as _ } from "@milkdown/prose/model";
15
+ import { Decoration as Me, DecorationSet as Se } from "@milkdown/prose/view";
16
+ import { keydownHandler as St } from "@milkdown/prose/keymap";
17
+ import { Transform as Nt } from "@milkdown/prose/transform";
18
+ import { splitListItem as xt, sinkListItem as Rt, liftListItem as Tt } from "@milkdown/prose/schema-list";
19
+ const Ye = (o) => `footnote-ref-${o}`, Ze = (o) => `footnote-def-${o}`, Lt = new B("MILKDOWN_FOOTNOTE_DEF_INPUT"), ve = R("ModifyFootnoteDef"), vt = ke((o) => {
17
20
  const e = "footnote_definition", t = "footnoteDefinition";
18
21
  return {
19
22
  id: e,
@@ -31,7 +34,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
31
34
  tag: `div[data-type="${e}"]`,
32
35
  getAttrs: (l) => {
33
36
  if (!(l instanceof HTMLElement))
34
- throw ke(l);
37
+ throw Ae(l);
35
38
  return {
36
39
  label: l.dataset.label
37
40
  };
@@ -42,11 +45,11 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
42
45
  toDOM: (l) => {
43
46
  const s = l.attrs.label, r = o.getClassName(l.attrs, "footnote-definition"), a = document.createElement("dt");
44
47
  a.textContent = `[${s}]:`, a.onclick = () => {
45
- const c = n.get(te), d = ne.create(c.state.doc, c.state.selection.from - 2);
48
+ const c = n.get(ne), d = oe.create(c.state.doc, c.state.selection.from - 2);
46
49
  c.dispatch(c.state.tr.setSelection(d));
47
50
  };
48
51
  const i = document.createElement("a");
49
- return i.href = `#${Je(s)}`, i.contentEditable = "false", i.textContent = "\u21A9", i.onmousedown = (c) => {
52
+ return i.href = `#${Ye(s)}`, i.contentEditable = "false", i.textContent = "\u21A9", i.onmousedown = (c) => {
50
53
  c.preventDefault();
51
54
  }, [
52
55
  "div",
@@ -54,7 +57,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
54
57
  class: r,
55
58
  "data-label": s,
56
59
  "data-type": e,
57
- id: Ye(s)
60
+ id: Ze(s)
58
61
  },
59
62
  ["div", { class: "footnote-definition_content" }, a, ["dd", 0]],
60
63
  ["div", { class: "footnote-definition_anchor" }, i]
@@ -79,38 +82,43 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
79
82
  }
80
83
  }),
81
84
  commands: (n) => [
82
- S(Le, (l = "") => (s, r) => {
83
- const a = B(s.selection, n);
85
+ N(ve, (l = "") => (s, r) => {
86
+ const a = W(s.selection, n);
84
87
  if (!a)
85
88
  return !1;
86
89
  const { tr: i } = s, c = i.setNodeMarkup(a.pos, void 0, { ...a.node.attrs, label: l });
87
- return r == null || r(c.setSelection(ne.create(c.doc, a.pos))), !0;
90
+ return r == null || r(c.setSelection(oe.create(c.doc, a.pos))), !0;
88
91
  })
89
92
  ],
90
93
  inputRules: (n) => [
91
- Ge(/(?:\[\^)([^:]+)(?::)$/, n, (l) => {
92
- var r;
93
- return {
94
- label: (r = l[1]) != null ? r : "footnote"
95
- };
96
- }, () => !1)
94
+ Je(
95
+ /(?:\[\^)([^:]+)(?::)$/,
96
+ n,
97
+ (l) => {
98
+ var r;
99
+ return {
100
+ label: (r = l[1]) != null ? r : "footnote"
101
+ };
102
+ },
103
+ () => !1
104
+ )
97
105
  ],
98
106
  prosePlugins: (n, l) => [
99
- new W({
100
- key: xt,
107
+ new H({
108
+ key: Lt,
101
109
  view: (s) => {
102
110
  const r = o.themeManager.get("input-chip", {
103
111
  width: "12em",
104
112
  placeholder: "Input Footnote Label",
105
113
  onUpdate: (d) => {
106
- l.get(Ue).call(Le, d);
114
+ l.get(Ve).call(ve, d);
107
115
  },
108
116
  isBindMode: !0
109
117
  });
110
118
  if (!r)
111
119
  return {};
112
- const a = (d) => Boolean(n && B(d.state.selection, n)), i = (d) => {
113
- const f = B(d.state.selection, n);
120
+ const a = (d) => Boolean(n && W(d.state.selection, n)), i = (d) => {
121
+ const f = W(d.state.selection, n);
114
122
  return f ? f.node.attrs.label : void 0;
115
123
  }, c = (d) => {
116
124
  if (!d.editable)
@@ -129,7 +137,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
129
137
  })
130
138
  ]
131
139
  };
132
- }), ve = R("ModifyFootnoteRef"), Tt = new F("MILKDOWN_FOOTNOTE_REF_INPUT"), Lt = ye((o) => {
140
+ }), Ee = R("ModifyFootnoteRef"), Et = new B("MILKDOWN_FOOTNOTE_REF_INPUT"), It = ke((o) => {
133
141
  const e = "footnote_reference";
134
142
  return {
135
143
  id: e,
@@ -147,7 +155,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
147
155
  tag: `sup[data-type="${e}"]`,
148
156
  getAttrs: (n) => {
149
157
  if (!(n instanceof HTMLElement))
150
- throw ke(n);
158
+ throw Ae(n);
151
159
  return {
152
160
  label: n.dataset.label
153
161
  };
@@ -155,17 +163,17 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
155
163
  }
156
164
  ],
157
165
  toDOM: (n) => {
158
- const l = n.attrs.label, s = document.createElement("a"), r = `#${Ye(l)}`;
166
+ const l = n.attrs.label, s = document.createElement("a"), r = `#${Ze(l)}`;
159
167
  return s.href = r, s.textContent = `[${l}]`, s.onclick = (a) => {
160
- t.get(te).editable && a.preventDefault();
168
+ t.get(ne).editable && a.preventDefault();
161
169
  }, s.ondblclick = () => {
162
- t.get(te).editable && (window.location.href = r);
170
+ t.get(ne).editable && (window.location.href = r);
163
171
  }, [
164
172
  "sup",
165
173
  {
166
174
  "data-label": l,
167
175
  "data-type": e,
168
- id: Je(l)
176
+ id: Ye(l)
169
177
  },
170
178
  s
171
179
  ];
@@ -189,23 +197,27 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
189
197
  }
190
198
  }),
191
199
  commands: (t) => [
192
- S(ve, (n = "") => (l, s) => {
193
- const r = B(l.selection, t);
200
+ N(Ee, (n = "") => (l, s) => {
201
+ const r = W(l.selection, t);
194
202
  if (!r)
195
203
  return !1;
196
204
  const { tr: a } = l, i = a.setNodeMarkup(r.pos, void 0, { ...r.node.attrs, label: n });
197
- return s == null || s(i.setSelection(ne.create(i.doc, r.pos))), !0;
205
+ return s == null || s(i.setSelection(oe.create(i.doc, r.pos))), !0;
198
206
  })
199
207
  ],
200
208
  inputRules: (t) => [
201
- new fe(/(?:\[\^)([^\]]+)(?:\])$/, (n, l, s, r) => {
209
+ new ue(/(?:\[\^)([^\]]+)(?:\])$/, (n, l, s, r) => {
202
210
  const a = n.doc.resolve(s), i = a.index(), c = n.doc.resolve(r);
203
211
  if (!a.parent.canReplaceWith(i, c.index(), t))
204
212
  return null;
205
213
  const d = l[1];
206
- return n.tr.replaceRangeWith(s, r, t.create({
207
- label: d
208
- }));
214
+ return n.tr.replaceRangeWith(
215
+ s,
216
+ r,
217
+ t.create({
218
+ label: d
219
+ })
220
+ );
209
221
  })
210
222
  ],
211
223
  prosePlugins: (t, n) => {
@@ -213,14 +225,14 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
213
225
  width: "12em",
214
226
  placeholder: "Input Footnote Label",
215
227
  onUpdate: (i) => {
216
- n.get(Ue).call(ve, i);
228
+ n.get(Ve).call(Ee, i);
217
229
  },
218
230
  isBindMode: !0
219
231
  });
220
232
  if (!l)
221
233
  return [];
222
- const s = (i) => Boolean(t && B(i.state.selection, t)), r = (i) => {
223
- const c = B(i.state.selection, t);
234
+ const s = (i) => Boolean(t && W(i.state.selection, t)), r = (i) => {
235
+ const c = W(i.state.selection, t);
224
236
  return c ? c.node.attrs.label : void 0;
225
237
  }, a = (i) => {
226
238
  if (!i.editable)
@@ -228,8 +240,8 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
228
240
  s(i) ? (l.show(i), l.update(r(i))) : l.hide();
229
241
  };
230
242
  return [
231
- new W({
232
- key: Tt,
243
+ new H({
244
+ key: Et,
233
245
  view: (i) => (l.init(i), a(i), {
234
246
  update: (c, d) => {
235
247
  (d == null ? void 0 : d.doc.eq(c.state.doc)) && d.selection.eq(c.state.selection) || a(c);
@@ -242,9 +254,12 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
242
254
  ];
243
255
  }
244
256
  };
245
- }), Ze = /* @__PURE__ */ new WeakMap(), vt = (o) => Ze.get(o), Et = (o, e) => (Ze.set(o, e), e);
246
- class Ee {
257
+ }), Qe = /* @__PURE__ */ new WeakMap(), $t = (o) => Qe.get(o), Dt = (o, e) => (Qe.set(o, e), e);
258
+ class Ie {
247
259
  constructor(e, t, n, l) {
260
+ $(this, "tableStart");
261
+ $(this, "map");
262
+ $(this, "table");
248
263
  this.left = e, this.top = t, this.right = n, this.bottom = l;
249
264
  }
250
265
  }
@@ -263,7 +278,7 @@ class g {
263
278
  r++;
264
279
  for (let i = 1; a < this.height && this.map[t + this.width * i] == n; i++)
265
280
  a++;
266
- return new Ee(l, s, r, a);
281
+ return new Ie(l, s, r, a);
267
282
  }
268
283
  throw new RangeError("No cell with offset " + e + " found");
269
284
  }
@@ -279,7 +294,12 @@ class g {
279
294
  }
280
295
  rectBetween(e, t) {
281
296
  const { left: n, right: l, top: s, bottom: r } = this.findCell(e), { left: a, right: i, top: c, bottom: d } = this.findCell(t);
282
- return new Ee(Math.min(n, a), Math.min(s, c), Math.max(l, i), Math.max(r, d));
297
+ return new Ie(
298
+ Math.min(n, a),
299
+ Math.min(s, c),
300
+ Math.max(l, i),
301
+ Math.max(r, d)
302
+ );
283
303
  }
284
304
  cellsInRect(e) {
285
305
  const t = [], n = {};
@@ -304,13 +324,13 @@ class g {
304
324
  }
305
325
  }
306
326
  static get(e) {
307
- return vt(e) || Et(e, It(e));
327
+ return $t(e) || Dt(e, Ot(e));
308
328
  }
309
329
  }
310
- function It(o) {
330
+ function Ot(o) {
311
331
  if (o.type.spec.tableRole != "table")
312
332
  throw new RangeError("Not a table node: " + o.type.name);
313
- const e = $t(o), t = o.childCount, n = [], l = [];
333
+ const e = _t(o), t = o.childCount, n = [], l = [];
314
334
  let s = 0, r;
315
335
  for (let c = 0, d = e * t; c < d; c++)
316
336
  n[c] = 0;
@@ -322,28 +342,28 @@ function It(o) {
322
342
  s++;
323
343
  if (h == f.childCount)
324
344
  break;
325
- const b = f.child(h), { colspan: w, rowspan: C, colwidth: xe } = b.attrs;
326
- for (let H = 0; H < C; H++) {
327
- if (H + c >= t) {
345
+ const b = f.child(h), { colspan: w, rowspan: C, colwidth: Re } = b.attrs;
346
+ for (let j = 0; j < C; j++) {
347
+ if (j + c >= t) {
328
348
  (r || (r = [])).push({
329
349
  type: "overlong_rowspan",
330
350
  pos: d,
331
- n: C - H
351
+ n: C - j
332
352
  });
333
353
  break;
334
354
  }
335
- const se = s + H * e;
336
- for (let _ = 0; _ < w; _++) {
337
- n[se + _] == 0 ? n[se + _] = d : (r || (r = [])).push({
355
+ const re = s + j * e;
356
+ for (let z = 0; z < w; z++) {
357
+ n[re + z] == 0 ? n[re + z] = d : (r || (r = [])).push({
338
358
  type: "collision",
339
359
  row: c,
340
360
  pos: d,
341
- n: w - _
361
+ n: w - z
342
362
  });
343
- const U = xe && xe[_];
344
- if (U) {
345
- const j = (se + _) % e * 2, re = l[j];
346
- re == null || re != U && l[j + 1] == 1 ? (l[j] = U, l[j + 1] = 1) : re == U && l[j + 1]++;
363
+ const V = Re && Re[z];
364
+ if (V) {
365
+ const K = (re + z) % e * 2, ie = l[K];
366
+ ie == null || ie != V && l[K + 1] == 1 ? (l[K] = V, l[K + 1] = 1) : ie == V && l[K + 1]++;
347
367
  }
348
368
  }
349
369
  }
@@ -359,9 +379,9 @@ function It(o) {
359
379
  let i = !1;
360
380
  for (let c = 0; !i && c < l.length; c += 2)
361
381
  l[c] != null && l[c + 1] < t && (i = !0);
362
- return i && Dt(a, l, o), a;
382
+ return i && zt(a, l, o), a;
363
383
  }
364
- function $t(o) {
384
+ function _t(o) {
365
385
  let e = -1, t = !1;
366
386
  for (let n = 0; n < o.childCount; n++) {
367
387
  const l = o.child(n);
@@ -382,7 +402,7 @@ function $t(o) {
382
402
  }
383
403
  return e;
384
404
  }
385
- function Dt(o, e, t) {
405
+ function zt(o, e, t) {
386
406
  o.problems || (o.problems = []);
387
407
  for (let n = 0, l = {}; n < o.map.length; n++) {
388
408
  const s = o.map[n];
@@ -393,7 +413,7 @@ function Dt(o, e, t) {
393
413
  let a = null;
394
414
  for (let i = 0; i < r.attrs.colspan; i++) {
395
415
  const c = (n + i) % o.width, d = e[c * 2];
396
- d != null && (!r.attrs.colwidth || r.attrs.colwidth[i] != d) && ((a || (a = Ot(r.attrs)))[i] = d);
416
+ d != null && (!r.attrs.colwidth || r.attrs.colwidth[i] != d) && ((a || (a = Ft(r.attrs)))[i] = d);
397
417
  }
398
418
  a && o.problems.unshift({
399
419
  type: "colwidth mismatch",
@@ -402,7 +422,7 @@ function Dt(o, e, t) {
402
422
  });
403
423
  }
404
424
  }
405
- function Ot(o) {
425
+ function Ft(o) {
406
426
  if (o.colwidth)
407
427
  return o.colwidth.slice();
408
428
  const e = [];
@@ -410,19 +430,19 @@ function Ot(o) {
410
430
  e.push(0);
411
431
  return e;
412
432
  }
413
- class m extends N {
433
+ class m extends S {
414
434
  constructor(e, t = e) {
415
435
  const n = e.node(-1), l = g.get(n), s = e.start(-1), r = l.rectBetween(e.pos - s, t.pos - s), a = e.node(0), i = l.cellsInRect(r).filter((d) => d != t.pos - s);
416
436
  i.unshift(t.pos - s);
417
437
  const c = i.map((d) => {
418
438
  const f = n.nodeAt(d), u = d + s + 1;
419
- return new bt(a.resolve(u), a.resolve(u + f.content.size));
439
+ return new kt(a.resolve(u), a.resolve(u + f.content.size));
420
440
  });
421
441
  super(c[0].$from, c[0].$to, c), this.$anchorCell = e, this.$headCell = t, this.$anchorCell = e, this.$headCell = t;
422
442
  }
423
443
  map(e, t) {
424
444
  const n = e.resolve(t.map(this.$anchorCell.pos)), l = e.resolve(t.map(this.$headCell.pos));
425
- if (ue(n) && ue(l) && Se(n, l)) {
445
+ if (pe(n) && pe(l) && xe(n, l)) {
426
446
  const s = this.$anchorCell.node(-1) != n.node(-1);
427
447
  return s && this.isRowSelection() ? m.rowSelection(n, l) : s && this.isColSelection() ? m.colSelection(n, l) : new m(n, l);
428
448
  }
@@ -441,10 +461,14 @@ class m extends N {
441
461
  const b = l.left - p.left, w = p.right - l.right;
442
462
  if (b > 0 || w > 0) {
443
463
  let C = h.attrs;
444
- b > 0 && (C = z(C, 0, b)), w > 0 && (C = z(C, C.colspan - w, w)), p.left < l.left ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
464
+ b > 0 && (C = F(C, 0, b)), w > 0 && (C = F(C, C.colspan - w, w)), p.left < l.left ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
445
465
  }
446
466
  if (p.top < l.top || p.bottom > l.bottom) {
447
- const C = y(h.attrs, "rowspan", Math.min(p.bottom, l.bottom) - Math.max(p.top, l.top));
467
+ const C = y(
468
+ h.attrs,
469
+ "rowspan",
470
+ Math.min(p.bottom, l.bottom) - Math.max(p.top, l.top)
471
+ );
448
472
  p.top < l.top ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
449
473
  }
450
474
  c.push(h);
@@ -453,19 +477,19 @@ class m extends N {
453
477
  r.push(e.child(i).copy(I.from(c)));
454
478
  }
455
479
  const a = this.isColSelection() && this.isRowSelection() ? e : r;
456
- return new O(I.from(a), 1, 1);
480
+ return new _(I.from(a), 1, 1);
457
481
  }
458
- replace(e, t = O.empty) {
482
+ replace(e, t = _.empty) {
459
483
  const n = e.steps.length, l = this.ranges;
460
484
  for (let r = 0; r < l.length; r++) {
461
485
  const { $from: a, $to: i } = l[r], c = e.mapping.slice(n);
462
- e.replace(c.map(a.pos), c.map(i.pos), r ? O.empty : t);
486
+ e.replace(c.map(a.pos), c.map(i.pos), r ? _.empty : t);
463
487
  }
464
- const s = N.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)), -1);
488
+ const s = S.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)), -1);
465
489
  s && e.setSelection(s);
466
490
  }
467
491
  replaceWith(e, t) {
468
- this.replace(e, new O(I.from(t), 0, 0));
492
+ this.replace(e, new _(I.from(t), 0, 0));
469
493
  }
470
494
  forEachCell(e) {
471
495
  const t = this.$anchorCell.node(-1), n = g.get(t), l = this.$anchorCell.start(-1), s = n.cellsInRect(n.rectBetween(this.$anchorCell.pos - l, this.$headCell.pos - l));
@@ -553,7 +577,7 @@ class m extends N {
553
577
  }
554
578
  }
555
579
  m.prototype.visible = !1;
556
- N.jsonID("cell", m);
580
+ S.jsonID("cell", m);
557
581
  class Ne {
558
582
  constructor(e, t) {
559
583
  this.anchor = e, this.head = t, this.anchor = e, this.head = t;
@@ -563,18 +587,18 @@ class Ne {
563
587
  }
564
588
  resolve(e) {
565
589
  const t = e.resolve(this.anchor), n = e.resolve(this.head);
566
- return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount && Se(t, n) ? new m(t, n) : N.near(n, 1);
590
+ return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount && xe(t, n) ? new m(t, n) : S.near(n, 1);
567
591
  }
568
592
  }
569
- function _t(o) {
593
+ function Bt(o) {
570
594
  if (!(o.selection instanceof m))
571
595
  return null;
572
596
  const e = [];
573
597
  return o.selection.forEachCell((t, n) => {
574
- e.push(Ae.node(n, n + t.nodeSize, { class: "selectedCell" }));
575
- }), Me.create(o.doc, e);
598
+ e.push(Me.node(n, n + t.nodeSize, { class: "selectedCell" }));
599
+ }), Se.create(o.doc, e);
576
600
  }
577
- function zt({ $from: o, $to: e }) {
601
+ function Wt({ $from: o, $to: e }) {
578
602
  if (o.pos == e.pos || o.pos < o.pos - 6)
579
603
  return !1;
580
604
  let t = o.pos, n = e.pos, l = o.depth;
@@ -584,7 +608,7 @@ function zt({ $from: o, $to: e }) {
584
608
  ;
585
609
  return t == n && /row|table/.test(o.node(l).type.spec.tableRole);
586
610
  }
587
- function Ft({ $from: o, $to: e }) {
611
+ function Pt({ $from: o, $to: e }) {
588
612
  let t, n;
589
613
  for (let l = o.depth; l > 0; l--) {
590
614
  const s = o.node(l);
@@ -602,10 +626,10 @@ function Ft({ $from: o, $to: e }) {
602
626
  }
603
627
  return t !== n && e.parentOffset === 0;
604
628
  }
605
- function Bt(o, e, t) {
629
+ function Ht(o, e, t) {
606
630
  const n = (e || o).selection, l = (e || o).doc;
607
631
  let s, r;
608
- if (n instanceof ne && (r = n.node.type.spec.tableRole)) {
632
+ if (n instanceof oe && (r = n.node.type.spec.tableRole)) {
609
633
  if (r == "cell" || r == "header_cell")
610
634
  s = m.create(l, n.from);
611
635
  else if (r == "row") {
@@ -616,10 +640,10 @@ function Bt(o, e, t) {
616
640
  s = m.create(l, i + 1, d);
617
641
  }
618
642
  } else
619
- n instanceof E && zt(n) ? s = E.create(l, n.from) : n instanceof E && Ft(n) && (s = E.create(l, n.$from.start(), n.$from.end()));
643
+ n instanceof E && Wt(n) ? s = E.create(l, n.from) : n instanceof E && Pt(n) && (s = E.create(l, n.$from.start(), n.$from.end()));
620
644
  return s && (e || (e = o.tr)).setSelection(s), e;
621
645
  }
622
- function Ie(o, e) {
646
+ function $e(o, e) {
623
647
  const t = o.getAttribute("data-colwidth"), n = t && /^\d+(,\d+)*$/.test(t) ? t.split(",").map((r) => Number(r)) : null, l = Number(o.getAttribute("colspan") || 1), s = {
624
648
  colspan: l,
625
649
  rowspan: Number(o.getAttribute("rowspan") || 1),
@@ -631,7 +655,7 @@ function Ie(o, e) {
631
655
  }
632
656
  return s;
633
657
  }
634
- function $e(o, e) {
658
+ function De(o, e) {
635
659
  const t = {};
636
660
  o.attrs.colspan != 1 && (t.colspan = o.attrs.colspan), o.attrs.rowspan != 1 && (t.rowspan = o.attrs.rowspan), o.attrs.colwidth && (t["data-colwidth"] = o.attrs.colwidth.join(","));
637
661
  for (const n in e) {
@@ -640,7 +664,7 @@ function $e(o, e) {
640
664
  }
641
665
  return t;
642
666
  }
643
- function Pt(o) {
667
+ function jt(o) {
644
668
  const e = o.cellAttributes || {}, t = {
645
669
  colspan: { default: 1 },
646
670
  rowspan: { default: 1 },
@@ -673,9 +697,9 @@ function Pt(o) {
673
697
  attrs: n,
674
698
  tableRole: "cell",
675
699
  isolating: !0,
676
- parseDOM: [{ tag: "td", getAttrs: (s) => Ie(s, e) }],
700
+ parseDOM: [{ tag: "td", getAttrs: (s) => $e(s, e) }],
677
701
  toDOM(s) {
678
- return ["td", $e(s, e), 0];
702
+ return ["td", De(s, e), 0];
679
703
  }
680
704
  },
681
705
  table_header: {
@@ -683,9 +707,9 @@ function Pt(o) {
683
707
  attrs: n,
684
708
  tableRole: "header_cell",
685
709
  isolating: !0,
686
- parseDOM: [{ tag: "th", getAttrs: (s) => Ie(s, e) }],
710
+ parseDOM: [{ tag: "th", getAttrs: (s) => $e(s, e) }],
687
711
  toDOM(s) {
688
- return ["th", $e(s, e), 0];
712
+ return ["th", De(s, e), 0];
689
713
  }
690
714
  }
691
715
  };
@@ -701,7 +725,7 @@ function A(o) {
701
725
  }
702
726
  return e;
703
727
  }
704
- const G = Pt({
728
+ const J = jt({
705
729
  tableGroup: "block",
706
730
  cellContent: "paragraph",
707
731
  cellAttributes: {
@@ -714,21 +738,21 @@ const G = Pt({
714
738
  }
715
739
  }
716
740
  });
717
- function X(o) {
741
+ function U(o) {
718
742
  for (let e = o.depth - 1; e > 0; e--)
719
743
  if (o.node(e).type.spec.tableRole == "row")
720
744
  return o.node(0).resolve(o.before(e + 1));
721
745
  }
722
- function ue(o) {
746
+ function pe(o) {
723
747
  return o.parent.type.spec.tableRole == "row" ? o.nodeAfter : null;
724
748
  }
725
- function Wt(o) {
749
+ function Kt(o) {
726
750
  return o.node(0).resolve(o.pos + o.nodeAfter.nodeSize);
727
751
  }
728
- function Se(o, e) {
752
+ function xe(o, e) {
729
753
  return o.depth == e.depth && o.pos >= e.start(-1) && o.pos <= e.end(-1);
730
754
  }
731
- function Qe(o, e, t) {
755
+ function et(o, e, t) {
732
756
  const n = o.start(-1), s = g.get(o.node(-1)).nextCell(o.pos - n, e, t);
733
757
  return s == null ? null : o.node(0).resolve(n + s);
734
758
  }
@@ -738,7 +762,7 @@ function y(o, e, t) {
738
762
  n[l] = o[l];
739
763
  return n[e] = t, n;
740
764
  }
741
- function z(o, e, t = 1) {
765
+ function F(o, e, t = 1) {
742
766
  const n = y(o, "colspan", o.colspan - t);
743
767
  if (n.colwidth) {
744
768
  const l = n.colwidth;
@@ -753,11 +777,11 @@ function M(o) {
753
777
  return !0;
754
778
  return !1;
755
779
  }
756
- function oe(o) {
780
+ function le(o) {
757
781
  const e = o.selection;
758
- return e instanceof m ? e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell : e.node && e.node.type.spec.tableRole == "cell" ? e.$anchor : X(e.$head) || Ht(e.$head);
782
+ return e instanceof m ? e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell : e.node && e.node.type.spec.tableRole == "cell" ? e.$anchor : U(e.$head) || qt(e.$head);
759
783
  }
760
- function Ht(o) {
784
+ function qt(o) {
761
785
  for (let e = o.nodeAfter, t = o.pos; e; e = e.firstChild, t++) {
762
786
  const n = e.type.spec.tableRole;
763
787
  if (n == "cell" || n == "header_cell")
@@ -769,7 +793,7 @@ function Ht(o) {
769
793
  return o.doc.resolve(t - e.nodeSize);
770
794
  }
771
795
  }
772
- function jt(o, e, t = 1) {
796
+ function Xt(o, e, t = 1) {
773
797
  const n = y(o, "colspan", o.colspan + t);
774
798
  if (n.colwidth) {
775
799
  const l = n.colwidth;
@@ -779,7 +803,7 @@ function jt(o, e, t = 1) {
779
803
  }
780
804
  return n;
781
805
  }
782
- function Kt(o, e, t) {
806
+ function Ut(o, e, t) {
783
807
  const n = A(e.type.schema).header_cell;
784
808
  for (let l = 0; l < o.height; l++) {
785
809
  const s = o.map[t + l * o.width];
@@ -788,26 +812,26 @@ function Kt(o, e, t) {
788
812
  }
789
813
  return !0;
790
814
  }
791
- const qt = (o) => (e, t) => {
815
+ const Vt = (o) => (e, t) => {
792
816
  if (!M(e))
793
817
  return !1;
794
818
  const { $head: n } = e.selection, l = n.after(), s = e.tr.replaceWith(l, l, o.createAndFill());
795
- return s.setSelection(N.near(s.doc.resolve(l), 1)), t == null || t(s.scrollIntoView()), !0;
819
+ return s.setSelection(S.near(s.doc.resolve(l), 1)), t == null || t(s.scrollIntoView()), !0;
796
820
  };
797
821
  function P(o) {
798
- const e = o.selection, t = oe(o), n = t.node(-1), l = t.start(-1), s = g.get(n);
822
+ const e = o.selection, t = le(o), n = t.node(-1), l = t.start(-1), s = g.get(n);
799
823
  let r;
800
824
  return e instanceof m ? r = s.rectBetween(e.$anchorCell.pos - l, e.$headCell.pos - l) : r = s.findCell(t.pos - l), r.tableStart = l, r.map = s, r.table = n, r;
801
825
  }
802
- function et(o, { map: e, tableStart: t, table: n }, l) {
826
+ function tt(o, { map: e, tableStart: t, table: n }, l) {
803
827
  e = e, n = n, t = t;
804
828
  let s = l > 0 ? -1 : 0;
805
- Kt(e, n, l + s) && (s = l == 0 || l == e.width ? null : 0);
829
+ Ut(e, n, l + s) && (s = l == 0 || l == e.width ? null : 0);
806
830
  for (let r = 0; r < e.height; r++) {
807
831
  const a = r * e.width + l;
808
832
  if (l > 0 && l < e.width && e.map[a - 1] == e.map[a]) {
809
833
  const i = e.map[a], c = n.nodeAt(i);
810
- o.setNodeMarkup(o.mapping.map(t + i), null, jt(c.attrs, l - e.colCount(i))), r += c.attrs.rowspan - 1;
834
+ o.setNodeMarkup(o.mapping.map(t + i), null, Xt(c.attrs, l - e.colCount(i))), r += c.attrs.rowspan - 1;
811
835
  } else {
812
836
  const i = e.map[a + s], c = s == null ? A(n.type.schema).cell : n.nodeAt(i).type, d = e.positionAt(r, l, n);
813
837
  o.insert(o.mapping.map(t + d), c.createAndFill());
@@ -815,30 +839,34 @@ function et(o, { map: e, tableStart: t, table: n }, l) {
815
839
  }
816
840
  return o;
817
841
  }
818
- const Xt = (o, e) => {
842
+ const Gt = (o, e) => {
819
843
  if (!M(o))
820
844
  return !1;
821
845
  if (e) {
822
846
  const t = P(o);
823
- e(et(o.tr, t, t.left));
847
+ e(tt(o.tr, t, t.left));
824
848
  }
825
849
  return !0;
826
- }, Ut = (o, e) => {
850
+ }, Jt = (o, e) => {
827
851
  if (!M(o))
828
852
  return !1;
829
853
  if (e) {
830
854
  const t = P(o);
831
- e(et(o.tr, t, t.right));
855
+ e(tt(o.tr, t, t.right));
832
856
  }
833
857
  return !0;
834
858
  };
835
- function Vt(o, { map: e, table: t, tableStart: n }, l) {
859
+ function Yt(o, { map: e, table: t, tableStart: n }, l) {
836
860
  e = e, t = t, n = n;
837
861
  const s = o.mapping.maps.length;
838
862
  for (let r = 0; r < e.height; ) {
839
863
  const a = r * e.width + l, i = e.map[a], c = t.nodeAt(i);
840
864
  if (l > 0 && e.map[a - 1] == i || l < e.width - 1 && e.map[a + 1] == i)
841
- o.setNodeMarkup(o.mapping.slice(s).map(n + i), null, z(c.attrs, l - e.colCount(i)));
865
+ o.setNodeMarkup(
866
+ o.mapping.slice(s).map(n + i),
867
+ null,
868
+ F(c.attrs, l - e.colCount(i))
869
+ );
842
870
  else {
843
871
  const d = o.mapping.slice(s).map(n + i);
844
872
  o.delete(d, d + c.nodeSize);
@@ -846,20 +874,20 @@ function Vt(o, { map: e, table: t, tableStart: n }, l) {
846
874
  r += c.attrs.rowspan;
847
875
  }
848
876
  }
849
- const Gt = (o, e) => {
877
+ const Zt = (o, e) => {
850
878
  if (!M(o))
851
879
  return !1;
852
880
  if (e) {
853
881
  const t = P(o), n = o.tr;
854
882
  if (t.left == 0 && t.right == t.map.width)
855
883
  return !1;
856
- for (let l = t.right - 1; Vt(n, t, l), l != t.left; l--)
884
+ for (let l = t.right - 1; Yt(n, t, l), l != t.left; l--)
857
885
  t.table = t.tableStart ? n.doc.nodeAt(t.tableStart - 1) : n.doc, t.map = g.get(t.table);
858
886
  e(n);
859
887
  }
860
888
  return !0;
861
889
  };
862
- function Jt(o, { map: e, tableStart: t, table: n }, l) {
890
+ function Qt(o, { map: e, tableStart: t, table: n }, l) {
863
891
  e = e, n = n, t = t;
864
892
  let s = 0;
865
893
  for (let i = 0; i < l; i++)
@@ -870,31 +898,35 @@ function Jt(o, { map: e, tableStart: t, table: n }, l) {
870
898
  const d = e.map[c];
871
899
  if (l > 0 && d == e.map[c - e.width]) {
872
900
  const f = n.nodeAt(d).attrs;
873
- o.setNodeMarkup(o.mapping.slice(a).map(d + t), null, y(f, "rowspan", f.rowspan - 1)), i += f.colspan - 1;
901
+ o.setNodeMarkup(
902
+ o.mapping.slice(a).map(d + t),
903
+ null,
904
+ y(f, "rowspan", f.rowspan - 1)
905
+ ), i += f.colspan - 1;
874
906
  } else if (l < e.width && d == e.map[c + e.width]) {
875
907
  const f = n.nodeAt(d), u = f.type.create(y(f.attrs, "rowspan", f.attrs.rowspan - 1), f.content), p = e.positionAt(l + 1, i, n);
876
908
  o.insert(o.mapping.slice(a).map(t + p), u), i += f.attrs.colspan - 1;
877
909
  }
878
910
  }
879
911
  }
880
- const Yt = (o, e) => {
912
+ const en = (o, e) => {
881
913
  if (!M(o))
882
914
  return !1;
883
915
  if (e) {
884
916
  const t = P(o), n = o.tr;
885
917
  if (t.top == 0 && t.bottom == t.map.height)
886
918
  return !1;
887
- for (let l = t.bottom - 1; Jt(n, t, l), l != t.top; l--)
919
+ for (let l = t.bottom - 1; Qt(n, t, l), l != t.top; l--)
888
920
  t.table = t.tableStart ? n.doc.nodeAt(t.tableStart - 1) : n.doc, t.map = g.get(t.table);
889
921
  e(n);
890
922
  }
891
923
  return !0;
892
924
  };
893
- function ie(o, e) {
925
+ function ce(o, e) {
894
926
  return (t, n) => {
895
927
  if (!M(t))
896
928
  return !1;
897
- const l = oe(t);
929
+ const l = le(t);
898
930
  if (l.nodeAfter.attrs[o] === e)
899
931
  return !1;
900
932
  if (n) {
@@ -906,7 +938,7 @@ function ie(o, e) {
906
938
  return !0;
907
939
  };
908
940
  }
909
- function Zt(o, e) {
941
+ function tn(o, e) {
910
942
  if (e < 0) {
911
943
  const t = o.nodeBefore;
912
944
  if (t)
@@ -929,28 +961,28 @@ function Zt(o, e) {
929
961
  }
930
962
  }
931
963
  }
932
- function De(o) {
964
+ function Oe(o) {
933
965
  return (e, t) => {
934
966
  if (!M(e))
935
967
  return !1;
936
- const n = Zt(oe(e), o);
968
+ const n = tn(le(e), o);
937
969
  if (n == null)
938
970
  return !1;
939
971
  if (t) {
940
972
  const l = e.doc.resolve(n);
941
- t(e.tr.setSelection(E.between(l, Wt(l))).scrollIntoView());
973
+ t(e.tr.setSelection(E.between(l, Kt(l))).scrollIntoView());
942
974
  }
943
975
  return !0;
944
976
  };
945
977
  }
946
- const Qt = (o, e) => {
978
+ const nn = (o, e) => {
947
979
  const t = o.selection.$anchor;
948
980
  for (let n = t.depth; n > 0; n--)
949
981
  if (t.node(n).type.spec.tableRole == "table")
950
982
  return e && e(o.tr.delete(t.before(n), t.after(n)).scrollIntoView()), !0;
951
983
  return !1;
952
- }, le = (o) => gt((e) => e.type.spec.tableRole === "table")(o), en = (o) => (e) => {
953
- const t = le(e);
984
+ }, se = (o) => Ct((e) => e.type.spec.tableRole === "table")(o), on = (o) => (e) => {
985
+ const t = se(e);
954
986
  if (!t)
955
987
  return;
956
988
  const n = g.get(t.node);
@@ -966,8 +998,8 @@ const Qt = (o, e) => {
966
998
  node: s
967
999
  };
968
1000
  }).filter((l) => l != null);
969
- }, tn = (o) => (e) => {
970
- const t = le(e);
1001
+ }, ln = (o) => (e) => {
1002
+ const t = se(e);
971
1003
  if (!t)
972
1004
  return;
973
1005
  const n = g.get(t.node);
@@ -983,21 +1015,25 @@ const Qt = (o, e) => {
983
1015
  node: s
984
1016
  };
985
1017
  }).filter((l) => l != null);
986
- }, ce = (o, e = 3, t = 3) => {
1018
+ }, ae = (o, e = 3, t = 3) => {
987
1019
  const { cell: n, header_cell: l, row: s, table: r } = A(o), a = Array(t).fill(0).map(() => n.createAndFill(null)), i = Array(t).fill(0).map(() => l.createAndFill(null)), c = Array(e).fill(0).map((d, f) => s.create(null, f === 0 ? i : a));
988
1020
  return r.create(null, c);
989
- }, Oe = (o) => (e) => (t) => {
990
- const n = le(t.selection), l = o === "row";
1021
+ }, _e = (o) => (e) => (t) => {
1022
+ const n = se(t.selection), l = o === "row";
991
1023
  if (n) {
992
1024
  const s = g.get(n.node);
993
1025
  if (e >= 0 && e < (l ? s.height : s.width)) {
994
- const r = s.positionAt(l ? e : s.height - 1, l ? s.width - 1 : e, n.node), a = t.doc.resolve(n.start + r), i = l ? m.rowSelection : m.colSelection, c = s.positionAt(l ? e : 0, l ? 0 : e, n.node), d = t.doc.resolve(n.start + c);
995
- return Ve(t.setSelection(i(a, d)));
1026
+ const r = s.positionAt(
1027
+ l ? e : s.height - 1,
1028
+ l ? s.width - 1 : e,
1029
+ n.node
1030
+ ), a = t.doc.resolve(n.start + r), i = l ? m.rowSelection : m.colSelection, c = s.positionAt(l ? e : 0, l ? 0 : e, n.node), d = t.doc.resolve(n.start + c);
1031
+ return Ge(t.setSelection(i(a, d)));
996
1032
  }
997
1033
  }
998
1034
  return t;
999
- }, nn = (o) => {
1000
- const e = le(o);
1035
+ }, sn = (o) => {
1036
+ const e = se(o);
1001
1037
  if (!e)
1002
1038
  return;
1003
1039
  const t = g.get(e.node);
@@ -1010,36 +1046,38 @@ const Qt = (o, e) => {
1010
1046
  const s = e.node.nodeAt(l), r = l + e.start;
1011
1047
  return { pos: r, start: r + 1, node: s };
1012
1048
  });
1013
- }, on = (o) => {
1014
- const e = nn(o.selection);
1049
+ }, rn = (o) => {
1050
+ const e = sn(o.selection);
1015
1051
  if (e && e[0]) {
1016
1052
  const t = o.doc.resolve(e[0].pos), n = e[e.length - 1];
1017
1053
  if (n) {
1018
1054
  const l = o.doc.resolve(n.pos);
1019
- return Ve(o.setSelection(new m(l, t)));
1055
+ return Ge(o.setSelection(new m(l, t)));
1020
1056
  }
1021
1057
  }
1022
1058
  return o;
1023
1059
  };
1024
- function _e(o, { map: e, tableStart: t, table: n }, l) {
1060
+ function ze(o, { map: e, tableStart: t, table: n }, l) {
1025
1061
  const s = Array(l).fill(0).reduce((c, d, f) => c + n.child(f).nodeSize, t), { cell: r, row: a } = A(n.type.schema), i = Array(e.width).fill(0).map((c, d) => {
1026
1062
  const f = n.nodeAt(e.map[d]);
1027
1063
  return r.createAndFill({ alignment: f == null ? void 0 : f.attrs.alignment });
1028
1064
  });
1029
1065
  return o.insert(s, a.create(null, i)), o;
1030
1066
  }
1031
- const T = (o) => o.state.selection, ln = (o) => {
1067
+ const T = (o) => o.state.selection, cn = (o) => {
1032
1068
  const e = g.get(o.$anchorCell.node(-1)), t = o.$anchorCell.start(-1), n = e.cellsInRect({
1033
1069
  left: 0,
1034
1070
  right: e.width,
1035
1071
  top: 0,
1036
1072
  bottom: 1
1037
- }), l = e.cellsInRect(e.rectBetween(o.$anchorCell.pos - t, o.$headCell.pos - t));
1073
+ }), l = e.cellsInRect(
1074
+ e.rectBetween(o.$anchorCell.pos - t, o.$headCell.pos - t)
1075
+ );
1038
1076
  for (let s = 0, r = n.length; s < r; s++)
1039
1077
  if (l.indexOf(n[s]) === -1)
1040
1078
  return !1;
1041
1079
  return !0;
1042
- }, sn = (o, e) => {
1080
+ }, an = (o, e) => {
1043
1081
  Object.values(o).forEach((t) => {
1044
1082
  var l;
1045
1083
  if ((l = t.disable) == null ? void 0 : l.call(t, e)) {
@@ -1048,17 +1086,17 @@ const T = (o) => o.state.selection, ln = (o) => {
1048
1086
  }
1049
1087
  t.$.classList.remove("hide");
1050
1088
  });
1051
- }, rn = (o) => {
1089
+ }, dn = (o) => {
1052
1090
  var e, t, n, l, s, r, a, i;
1053
1091
  return {
1054
1092
  [0]: {
1055
1093
  $: (e = o.get(L).get(v, "leftArrow")) == null ? void 0 : e.dom,
1056
- command: () => Xt,
1094
+ command: () => Gt,
1057
1095
  disable: (c) => !T(c).isColSelection()
1058
1096
  },
1059
1097
  [1]: {
1060
1098
  $: (t = o.get(L).get(v, "rightArrow")) == null ? void 0 : t.dom,
1061
- command: () => Ut,
1099
+ command: () => Jt,
1062
1100
  disable: (c) => !T(c).isColSelection()
1063
1101
  },
1064
1102
  [2]: {
@@ -1068,7 +1106,7 @@ const T = (o) => o.state.selection, ln = (o) => {
1068
1106
  return !1;
1069
1107
  if (d) {
1070
1108
  const f = P(c);
1071
- d(_e(c.tr, f, f.top));
1109
+ d(ze(c.tr, f, f.top));
1072
1110
  }
1073
1111
  return !0;
1074
1112
  },
@@ -1081,7 +1119,7 @@ const T = (o) => o.state.selection, ln = (o) => {
1081
1119
  return !1;
1082
1120
  if (d) {
1083
1121
  const f = P(c);
1084
- d(_e(c.tr, f, f.bottom));
1122
+ d(ze(c.tr, f, f.bottom));
1085
1123
  }
1086
1124
  return !0;
1087
1125
  },
@@ -1089,45 +1127,46 @@ const T = (o) => o.state.selection, ln = (o) => {
1089
1127
  },
1090
1128
  [4]: {
1091
1129
  $: (s = o.get(L).get(v, "alignLeft")) == null ? void 0 : s.dom,
1092
- command: () => ie("alignment", "left"),
1130
+ command: () => ce("alignment", "left"),
1093
1131
  disable: (c) => !T(c).isColSelection()
1094
1132
  },
1095
1133
  [5]: {
1096
1134
  $: (r = o.get(L).get(v, "alignCenter")) == null ? void 0 : r.dom,
1097
- command: () => ie("alignment", "center"),
1135
+ command: () => ce("alignment", "center"),
1098
1136
  disable: (c) => !T(c).isColSelection()
1099
1137
  },
1100
1138
  [6]: {
1101
1139
  $: (a = o.get(L).get(v, "alignRight")) == null ? void 0 : a.dom,
1102
- command: () => ie("alignment", "right"),
1140
+ command: () => ce("alignment", "right"),
1103
1141
  disable: (c) => !T(c).isColSelection()
1104
1142
  },
1105
1143
  [7]: {
1106
1144
  $: (i = o.get(L).get(v, "delete")) == null ? void 0 : i.dom,
1107
1145
  command: (c, d) => {
1108
1146
  const f = T(d), u = f.isColSelection(), p = f.isRowSelection();
1109
- return u && p ? Qt : u ? Gt : Yt;
1147
+ return u && p ? nn : u ? Zt : en;
1110
1148
  },
1111
1149
  disable: (c) => {
1112
1150
  const d = T(c);
1113
- return d.isRowSelection() ? d.isColSelection() ? !1 : ln(d) : !1;
1151
+ return d.isRowSelection() ? d.isColSelection() ? !1 : cn(d) : !1;
1114
1152
  }
1115
1153
  }
1116
1154
  };
1117
- }, cn = (o, e) => {
1155
+ }, fn = (o, e) => {
1118
1156
  const { selection: t } = o.state, n = t.isColSelection(), l = t.isRowSelection();
1119
- wt(o, e, (s, r, a) => {
1157
+ yt(o, e, (s, r, a) => {
1120
1158
  const i = e.parentElement;
1121
1159
  if (!i)
1122
- throw mt();
1123
- let c = l ? s.left - a.left - r.width / 2 - 8 : s.left - a.left + (s.width - r.width) / 2;
1124
- const d = s.top - a.top - r.height - (n ? 14 : 0) - 14 + i.scrollTop;
1125
- return c < 0 && (c = 0), [d, c];
1160
+ throw bt();
1161
+ let c = l ? s.left - a.left - r.width / 2 - 8 : s.left - a.left + (s.width - r.width) / 2, d = s.top - a.top - r.height - (n ? 14 : 0) - 14 + i.scrollTop;
1162
+ c < 0 && (c = 0);
1163
+ const f = i.clientWidth - (r.width + 4);
1164
+ return c > f && (c = f), d < i.scrollTop && (d = s.top - a.top + 14 + i.scrollTop), [d, c];
1126
1165
  });
1127
1166
  };
1128
1167
  var x = /* @__PURE__ */ ((o) => (o.Left = "Left", o.Top = "Top", o.Point = "Point", o))(x || {});
1129
- const an = (o, { css: e, injectGlobal: t }) => {
1130
- const n = ut(o), l = o.get(Re, "radius"), s = o.get(Re, "lineWidth");
1168
+ const un = (o, { css: e, injectGlobal: t }) => {
1169
+ const n = mt(o), l = o.get(Te, "radius"), s = o.get(Te, "lineWidth");
1131
1170
  return t`
1132
1171
  .milkdown {
1133
1172
  .tableWrapper {
@@ -1200,8 +1239,8 @@ const an = (o, { css: e, injectGlobal: t }) => {
1200
1239
 
1201
1240
  border-radius: ${l};
1202
1241
 
1203
- ${o.get(pt, void 0)};
1204
- ${o.get(ht, void 0)};
1242
+ ${o.get(gt, void 0)};
1243
+ ${o.get(wt, void 0)};
1205
1244
 
1206
1245
  overflow: hidden;
1207
1246
  background: ${n("surface")};
@@ -1239,7 +1278,7 @@ const an = (o, { css: e, injectGlobal: t }) => {
1239
1278
  display: none;
1240
1279
  }
1241
1280
  `;
1242
- }, dn = (o) => {
1281
+ }, pn = (o) => {
1243
1282
  switch (o) {
1244
1283
  case x.Left:
1245
1284
  return "milkdown-cell-left";
@@ -1250,52 +1289,52 @@ const an = (o, { css: e, injectGlobal: t }) => {
1250
1289
  return "milkdown-cell-point";
1251
1290
  }
1252
1291
  };
1253
- function ae(o, e, t, n = 0) {
1254
- return Ae.widget(e.pos + 1, (l) => {
1292
+ function de(o, e, t, n = 0) {
1293
+ return Me.widget(e.pos + 1, (l) => {
1255
1294
  var r;
1256
1295
  const s = document.createElement("div");
1257
- return s.classList.add(dn(t)), t === x.Point && s.appendChild((r = o.get(L).get(v, "select")) == null ? void 0 : r.dom), s.addEventListener("mousedown", (a) => {
1296
+ return s.classList.add(pn(t)), t === x.Point && s.appendChild((r = o.get(L).get(v, "select")) == null ? void 0 : r.dom), s.addEventListener("mousedown", (a) => {
1258
1297
  if (!!l)
1259
1298
  switch (a.preventDefault(), t) {
1260
1299
  case x.Point: {
1261
- l.dispatch(on(l.state.tr));
1300
+ l.dispatch(rn(l.state.tr));
1262
1301
  return;
1263
1302
  }
1264
1303
  case x.Left: {
1265
- l.dispatch(Oe("row")(n)(l.state.tr));
1304
+ l.dispatch(_e("row")(n)(l.state.tr));
1266
1305
  return;
1267
1306
  }
1268
1307
  case x.Top: {
1269
- l.dispatch(Oe("col")(n)(l.state.tr));
1308
+ l.dispatch(_e("col")(n)(l.state.tr));
1270
1309
  return;
1271
1310
  }
1272
1311
  }
1273
1312
  }), s;
1274
1313
  });
1275
1314
  }
1276
- const fn = (o, e) => new W({
1277
- key: new F("MILKDOWN_TABLE_OP"),
1315
+ const hn = (o, e) => new H({
1316
+ key: new B("MILKDOWN_TABLE_OP"),
1278
1317
  props: {
1279
1318
  decorations: (t) => {
1280
- const n = [], l = en(0)(t.selection);
1319
+ const n = [], l = on(0)(t.selection);
1281
1320
  if (!l)
1282
1321
  return null;
1283
- const s = tn(0)(t.selection);
1322
+ const s = ln(0)(t.selection);
1284
1323
  if (!s)
1285
1324
  return null;
1286
1325
  const [r] = l;
1287
- return n.push(ae(o, r, x.Point)), l.forEach((a, i) => {
1288
- n.push(ae(o, a, x.Left, i));
1326
+ return n.push(de(o, r, x.Point)), l.forEach((a, i) => {
1327
+ n.push(de(o, a, x.Left, i));
1289
1328
  }), s.forEach((a, i) => {
1290
- n.push(ae(o, a, x.Top, i));
1291
- }), Me.create(t.doc, n);
1329
+ n.push(de(o, a, x.Top, i));
1330
+ }), Se.create(t.doc, n);
1292
1331
  }
1293
1332
  },
1294
1333
  view: (t) => {
1295
1334
  var a;
1296
- const n = Object.fromEntries(Object.entries(rn(o)).filter(([, i]) => i.$ != null)), l = document.createElement("div");
1335
+ const n = Object.fromEntries(Object.entries(dn(o)).filter(([, i]) => i.$ != null)), l = document.createElement("div");
1297
1336
  e.themeManager.onFlush(() => {
1298
- const i = e.getStyle((c) => an(e.themeManager, c));
1337
+ const i = e.getStyle((c) => un(e.themeManager, c));
1299
1338
  i && l.classList.add(i);
1300
1339
  }), l.classList.add("table-tooltip", "hide"), Object.values(n).forEach(({ $: i }) => l.appendChild(i)), (a = t.dom.parentNode) == null || a.appendChild(l);
1301
1340
  const s = (i) => {
@@ -1314,44 +1353,48 @@ const fn = (o, e) => new W({
1314
1353
  r();
1315
1354
  return;
1316
1355
  }
1317
- if (sn(n, i), Object.values(n).every(({ $: u }) => u.classList.contains("hide"))) {
1356
+ if (an(n, i), Object.values(n).every(({ $: u }) => u.classList.contains("hide"))) {
1318
1357
  r();
1319
1358
  return;
1320
1359
  }
1321
- l.classList.remove("hide"), cn(i, l);
1360
+ l.classList.remove("hide"), fn(i, l);
1322
1361
  },
1323
1362
  destroy: () => {
1324
1363
  l.removeEventListener("mousedown", s), l.remove();
1325
1364
  }
1326
1365
  };
1327
1366
  }
1328
- }), un = (o) => o.type.name === "paragraph" && o.nodeSize === 2, pn = (o) => o.type.name === "paragraph", hn = new F("plugin_autoInsertZeroSpace"), mn = () => new W({
1329
- key: hn,
1367
+ }), mn = (o) => o.type.name === "paragraph" && o.nodeSize === 2, gn = (o) => o.type.name === "paragraph", wn = new B("plugin_autoInsertZeroSpace"), bn = () => new H({
1368
+ key: wn,
1330
1369
  props: {
1331
1370
  handleDOMEvents: {
1332
1371
  compositionstart(o) {
1333
1372
  const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
1334
- return Te.safari && M(e) && l.empty && un(s.parent) && t(n.insertText("\u2060", s.start())), !1;
1373
+ return Le.safari && M(e) && l.empty && mn(s.parent) && t(n.insertText("\u2060", s.start())), !1;
1335
1374
  },
1336
1375
  compositionend(o) {
1337
1376
  const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
1338
- return Te.safari && M(e) && l.empty && pn(s.parent) && s.parent.textContent.startsWith("\u2060") && t(n.delete(s.start(), s.start() + 1)), !1;
1377
+ return Le.safari && M(e) && l.empty && gn(s.parent) && s.parent.textContent.startsWith("\u2060") && t(n.delete(s.start(), s.start() + 1)), !1;
1339
1378
  }
1340
1379
  }
1341
1380
  }
1342
1381
  });
1343
- class gn {
1382
+ class Cn {
1344
1383
  constructor(e, t) {
1345
- this.node = e, this.cellMinWidth = t, this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), pe(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
1384
+ $(this, "dom");
1385
+ $(this, "contentDOM");
1386
+ $(this, "table");
1387
+ $(this, "colgroup");
1388
+ this.node = e, this.cellMinWidth = t, this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), he(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
1346
1389
  }
1347
1390
  update(e) {
1348
- return e.type != this.node.type ? !1 : (this.node = e, pe(e, this.colgroup, this.table, this.cellMinWidth), !0);
1391
+ return e.type != this.node.type ? !1 : (this.node = e, he(e, this.colgroup, this.table, this.cellMinWidth), !0);
1349
1392
  }
1350
1393
  ignoreMutation(e) {
1351
1394
  return e.type == "attributes" && (e.target == this.table || this.colgroup.contains(e.target));
1352
1395
  }
1353
1396
  }
1354
- function pe(o, e, t, n, l, s) {
1397
+ function he(o, e, t, n, l, s) {
1355
1398
  var d;
1356
1399
  let r = 0, a = !0, i = e.firstChild;
1357
1400
  const c = o.firstChild;
@@ -1368,18 +1411,18 @@ function pe(o, e, t, n, l, s) {
1368
1411
  }
1369
1412
  a ? (t.style.width = r + "px", t.style.minWidth = "") : (t.style.width = "", t.style.minWidth = r + "px");
1370
1413
  }
1371
- const k = new F("tableColumnResizing");
1372
- function wn({
1414
+ const k = new B("tableColumnResizing");
1415
+ function yn({
1373
1416
  handleWidth: o = 5,
1374
1417
  cellMinWidth: e = 25,
1375
- View: t = gn,
1418
+ View: t = Cn,
1376
1419
  lastColumnResizable: n = !0
1377
1420
  } = {}) {
1378
- return new W({
1421
+ return new H({
1379
1422
  key: k,
1380
1423
  state: {
1381
1424
  init(s, r) {
1382
- return this.spec.props.nodeViews[A(r.schema).table.name] = (a) => new t(a, e), new q(-1, !1);
1425
+ return this.spec.props.nodeViews[A(r.schema).table.name] = (a) => new t(a, e), new X(-1, !1);
1383
1426
  },
1384
1427
  apply(s, r) {
1385
1428
  return r.apply(s);
@@ -1391,24 +1434,24 @@ function wn({
1391
1434
  },
1392
1435
  handleDOMEvents: {
1393
1436
  mousemove(s, r) {
1394
- bn(s, r, o, n);
1437
+ kn(s, r, o, n);
1395
1438
  },
1396
1439
  mouseleave(s) {
1397
- Cn(s);
1440
+ An(s);
1398
1441
  },
1399
1442
  mousedown(s, r) {
1400
- yn(s, r, e);
1443
+ Mn(s, r, e);
1401
1444
  }
1402
1445
  },
1403
1446
  decorations(s) {
1404
1447
  const r = k.getState(s);
1405
- return r.activeHandle > -1 ? xn(s, r.activeHandle) : null;
1448
+ return r.activeHandle > -1 ? Ln(s, r.activeHandle) : null;
1406
1449
  },
1407
1450
  nodeViews: {}
1408
1451
  }
1409
1452
  });
1410
1453
  }
1411
- class q {
1454
+ class X {
1412
1455
  constructor(e, t) {
1413
1456
  this.activeHandle = e, this.dragging = t, this.activeHandle = e, this.dragging = t;
1414
1457
  }
@@ -1416,24 +1459,24 @@ class q {
1416
1459
  let t = this;
1417
1460
  const n = e.getMeta(k);
1418
1461
  if (n && n.setHandle != null)
1419
- return new q(n.setHandle, null);
1462
+ return new X(n.setHandle, null);
1420
1463
  if (n && n.setDragging !== void 0)
1421
- return new q(t.activeHandle, n.setDragging);
1464
+ return new X(t.activeHandle, n.setDragging);
1422
1465
  if (t.activeHandle > -1 && e.docChanged) {
1423
1466
  let l = e.mapping.map(t.activeHandle, -1);
1424
- ue(e.doc.resolve(l)) || (l = 0), t = new q(l, t.dragging);
1467
+ pe(e.doc.resolve(l)) || (l = 0), t = new X(l, t.dragging);
1425
1468
  }
1426
1469
  return t;
1427
1470
  }
1428
1471
  }
1429
- function bn(o, e, t, n) {
1472
+ function kn(o, e, t, n) {
1430
1473
  const l = k.getState(o.state);
1431
1474
  if (!l.dragging) {
1432
- const s = An(e.target);
1475
+ const s = Nn(e.target);
1433
1476
  let r = -1;
1434
1477
  if (s) {
1435
1478
  const { left: a, right: i } = s.getBoundingClientRect();
1436
- e.clientX - a <= t ? r = ze(o, e, "left") : i - e.clientX <= t && (r = ze(o, e, "right"));
1479
+ e.clientX - a <= t ? r = Fe(o, e, "left") : i - e.clientX <= t && (r = Fe(o, e, "right"));
1437
1480
  }
1438
1481
  if (r != l.activeHandle) {
1439
1482
  if (!n && r !== -1) {
@@ -1441,36 +1484,38 @@ function bn(o, e, t, n) {
1441
1484
  if (c.colCount(a.pos - d) + a.nodeAfter.attrs.colspan - 1 == c.width - 1)
1442
1485
  return;
1443
1486
  }
1444
- tt(o, r);
1487
+ nt(o, r);
1445
1488
  }
1446
1489
  }
1447
1490
  }
1448
- function Cn(o) {
1491
+ function An(o) {
1449
1492
  const e = k.getState(o.state);
1450
- e.activeHandle > -1 && !e.dragging && tt(o, -1);
1493
+ e.activeHandle > -1 && !e.dragging && nt(o, -1);
1451
1494
  }
1452
- function yn(o, e, t) {
1495
+ function Mn(o, e, t) {
1453
1496
  const n = k.getState(o.state);
1454
1497
  if (n.activeHandle == -1 || n.dragging)
1455
1498
  return !1;
1456
- const l = o.state.doc.nodeAt(n.activeHandle), s = kn(o, n.activeHandle, l.attrs);
1457
- o.dispatch(o.state.tr.setMeta(k, {
1458
- setDragging: { startX: e.clientX, startWidth: s }
1459
- }));
1499
+ const l = o.state.doc.nodeAt(n.activeHandle), s = Sn(o, n.activeHandle, l.attrs);
1500
+ o.dispatch(
1501
+ o.state.tr.setMeta(k, {
1502
+ setDragging: { startX: e.clientX, startWidth: s }
1503
+ })
1504
+ );
1460
1505
  function r(i) {
1461
1506
  window.removeEventListener("mouseup", r), window.removeEventListener("mousemove", a);
1462
1507
  const c = k.getState(o.state);
1463
- c.dragging && (Mn(o, c.activeHandle, Fe(c.dragging, i, t)), o.dispatch(o.state.tr.setMeta(k, { setDragging: null })));
1508
+ c.dragging && (xn(o, c.activeHandle, Be(c.dragging, i, t)), o.dispatch(o.state.tr.setMeta(k, { setDragging: null })));
1464
1509
  }
1465
1510
  function a(i) {
1466
1511
  if (!i.which)
1467
1512
  return r(i);
1468
- const c = k.getState(o.state), d = Fe(c.dragging, i, t);
1469
- Nn(o, c.activeHandle, d, t);
1513
+ const c = k.getState(o.state), d = Be(c.dragging, i, t);
1514
+ Rn(o, c.activeHandle, d, t);
1470
1515
  }
1471
1516
  return window.addEventListener("mouseup", r), window.addEventListener("mousemove", a), e.preventDefault(), !0;
1472
1517
  }
1473
- function kn(o, e, { colspan: t, colwidth: n }) {
1518
+ function Sn(o, e, { colspan: t, colwidth: n }) {
1474
1519
  const l = n && n[n.length - 1];
1475
1520
  if (l)
1476
1521
  return l;
@@ -1481,16 +1526,16 @@ function kn(o, e, { colspan: t, colwidth: n }) {
1481
1526
  n[c] && (a -= n[c], i--);
1482
1527
  return a / i;
1483
1528
  }
1484
- function An(o) {
1529
+ function Nn(o) {
1485
1530
  for (; o && o.nodeName != "TD" && o.nodeName != "TH"; )
1486
1531
  o = o.classList.contains("ProseMirror") ? null : o.parentNode;
1487
1532
  return o;
1488
1533
  }
1489
- function ze(o, e, t) {
1534
+ function Fe(o, e, t) {
1490
1535
  const n = o.posAtCoords({ left: e.clientX, top: e.clientY });
1491
1536
  if (!n)
1492
1537
  return -1;
1493
- const { pos: l } = n, s = X(o.state.doc.resolve(l));
1538
+ const { pos: l } = n, s = U(o.state.doc.resolve(l));
1494
1539
  if (!s)
1495
1540
  return -1;
1496
1541
  if (t == "right")
@@ -1498,14 +1543,14 @@ function ze(o, e, t) {
1498
1543
  const r = g.get(s.node(-1)), a = s.start(-1), i = r.map.indexOf(s.pos - a);
1499
1544
  return i % r.width == 0 ? -1 : a + r.map[i - 1];
1500
1545
  }
1501
- function Fe(o, e, t) {
1546
+ function Be(o, e, t) {
1502
1547
  const n = e.clientX - o.startX;
1503
1548
  return Math.max(t, o.startWidth + n);
1504
1549
  }
1505
- function tt(o, e) {
1550
+ function nt(o, e) {
1506
1551
  o.dispatch(o.state.tr.setMeta(k, { setHandle: e }));
1507
1552
  }
1508
- function Mn(o, e, t) {
1553
+ function xn(o, e, t) {
1509
1554
  const n = o.state.doc.resolve(e), l = n.node(-1), s = g.get(l), r = n.start(-1), a = s.colCount(n.pos - r) + n.nodeAfter.attrs.colspan - 1, i = o.state.tr;
1510
1555
  for (let c = 0; c < s.height; c++) {
1511
1556
  const d = c * s.width + a;
@@ -1514,36 +1559,36 @@ function Mn(o, e, t) {
1514
1559
  const f = s.map[d], { attrs: u } = l.nodeAt(f), p = u.colspan == 1 ? 0 : a - s.colCount(f);
1515
1560
  if (u.colwidth && u.colwidth[p] == t)
1516
1561
  continue;
1517
- const h = u.colwidth ? u.colwidth.slice() : Sn(u.colspan);
1562
+ const h = u.colwidth ? u.colwidth.slice() : Tn(u.colspan);
1518
1563
  h[p] = t, i.setNodeMarkup(r + f, null, y(u, "colwidth", h));
1519
1564
  }
1520
1565
  i.docChanged && o.dispatch(i);
1521
1566
  }
1522
- function Nn(o, e, t, n) {
1567
+ function Rn(o, e, t, n) {
1523
1568
  const l = o.state.doc.resolve(e), s = l.node(-1), r = l.start(-1), a = g.get(s).colCount(l.pos - r) + l.nodeAfter.attrs.colspan - 1;
1524
1569
  let i = o.domAtPos(l.start(-1)).node;
1525
1570
  for (; i.nodeName != "TABLE"; )
1526
1571
  i = i.parentNode;
1527
- pe(s, i.firstChild, i, n, a, t);
1572
+ he(s, i.firstChild, i, n, a, t);
1528
1573
  }
1529
- function Sn(o) {
1574
+ function Tn(o) {
1530
1575
  const e = [];
1531
1576
  for (let t = 0; t < o; t++)
1532
1577
  e.push(0);
1533
1578
  return e;
1534
1579
  }
1535
- function xn(o, e) {
1580
+ function Ln(o, e) {
1536
1581
  const t = [], n = o.doc.resolve(e), l = n.node(-1), s = g.get(l), r = n.start(-1), a = s.colCount(n.pos - r) + n.nodeAfter.attrs.colspan;
1537
1582
  for (let i = 0; i < s.height; i++) {
1538
1583
  const c = a + i * s.width - 1;
1539
1584
  if ((a == s.width || s.map[c] != s.map[c + 1]) && (i == 0 || s.map[c - 1] != s.map[c - 1 - s.width])) {
1540
1585
  const d = s.map[c], f = r + d + l.nodeAt(d).nodeSize - 1, u = document.createElement("div");
1541
- u.className = "column-resize-handle", t.push(Ae.widget(f, u));
1586
+ u.className = "column-resize-handle", t.push(Me.widget(f, u));
1542
1587
  }
1543
1588
  }
1544
- return Me.create(o.doc, t);
1589
+ return Se.create(o.doc, t);
1545
1590
  }
1546
- function Rn(o) {
1591
+ function vn(o) {
1547
1592
  if (!o.size)
1548
1593
  return null;
1549
1594
  let { content: e, openStart: t, openEnd: n } = o;
@@ -1554,15 +1599,17 @@ function Rn(o) {
1554
1599
  for (let i = 0; i < e.childCount; i++) {
1555
1600
  let c = e.child(i).content;
1556
1601
  const d = i ? 0 : Math.max(0, t - 1), f = i < e.childCount - 1 ? 0 : Math.max(0, n - 1);
1557
- (d || f) && (c = he(A(r).row, new O(c, d, f)).content), a.push(c);
1602
+ (d || f) && (c = me(A(r).row, new _(c, d, f)).content), a.push(c);
1558
1603
  }
1559
1604
  else if (s == "cell" || s == "header_cell")
1560
- a.push(t || n ? he(A(r).row, new O(e, t, n)).content : e);
1605
+ a.push(
1606
+ t || n ? me(A(r).row, new _(e, t, n)).content : e
1607
+ );
1561
1608
  else
1562
1609
  return null;
1563
- return Tn(r, a);
1610
+ return En(r, a);
1564
1611
  }
1565
- function Tn(o, e) {
1612
+ function En(o, e) {
1566
1613
  const t = [];
1567
1614
  for (let l = 0; l < e.length; l++) {
1568
1615
  const s = e[l];
@@ -1584,18 +1631,21 @@ function Tn(o, e) {
1584
1631
  }
1585
1632
  return { height: e.length, width: n, rows: e };
1586
1633
  }
1587
- function he(o, e) {
1634
+ function me(o, e) {
1588
1635
  const t = o.createAndFill();
1589
- return new At(t).replace(0, t.content.size, e).doc;
1636
+ return new Nt(t).replace(0, t.content.size, e).doc;
1590
1637
  }
1591
- function Ln({ width: o, height: e, rows: t }, n, l) {
1638
+ function In({ width: o, height: e, rows: t }, n, l) {
1592
1639
  if (o != n) {
1593
1640
  const s = [], r = [];
1594
1641
  for (let a = 0; a < t.length; a++) {
1595
1642
  const i = t[a], c = [];
1596
1643
  for (let d = s[a] || 0, f = 0; d < n; f++) {
1597
1644
  let u = i.child(f % i.childCount);
1598
- d + u.attrs.colspan > n && (u = u.type.create(z(u.attrs, u.attrs.colspan, d + u.attrs.colspan - n), u.content)), c.push(u), d += u.attrs.colspan;
1645
+ d + u.attrs.colspan > n && (u = u.type.create(
1646
+ F(u.attrs, u.attrs.colspan, d + u.attrs.colspan - n),
1647
+ u.content
1648
+ )), c.push(u), d += u.attrs.colspan;
1599
1649
  for (let p = 1; p < u.attrs.rowspan; p++)
1600
1650
  s[a + p] = (s[a + p] || 0) + u.attrs.colspan;
1601
1651
  }
@@ -1609,7 +1659,10 @@ function Ln({ width: o, height: e, rows: t }, n, l) {
1609
1659
  const i = [], c = t[a % e];
1610
1660
  for (let d = 0; d < c.childCount; d++) {
1611
1661
  let f = c.child(d);
1612
- r + f.attrs.rowspan > l && (f = f.type.create(y(f.attrs, "rowspan", Math.max(1, l - f.attrs.rowspan)), f.content)), i.push(f);
1662
+ r + f.attrs.rowspan > l && (f = f.type.create(
1663
+ y(f.attrs, "rowspan", Math.max(1, l - f.attrs.rowspan)),
1664
+ f.content
1665
+ )), i.push(f);
1613
1666
  }
1614
1667
  s.push(I.from(i));
1615
1668
  }
@@ -1617,7 +1670,7 @@ function Ln({ width: o, height: e, rows: t }, n, l) {
1617
1670
  }
1618
1671
  return { width: o, height: e, rows: t };
1619
1672
  }
1620
- function vn(o, e, t, n, l, s, r) {
1673
+ function $n(o, e, t, n, l, s, r) {
1621
1674
  const a = o.doc.type.schema, i = A(a);
1622
1675
  let c, d;
1623
1676
  if (l > e.width)
@@ -1635,7 +1688,9 @@ function vn(o, e, t, n, l, s, r) {
1635
1688
  const f = [];
1636
1689
  for (let h = 0, b = (e.height - 1) * e.width; h < Math.max(e.width, l); h++) {
1637
1690
  const w = h >= e.width ? !1 : t.nodeAt(e.map[b + h]).type == i.header_cell;
1638
- f.push(w ? d || (d = i.header_cell.createAndFill()) : c || (c = i.cell.createAndFill()));
1691
+ f.push(
1692
+ w ? d || (d = i.header_cell.createAndFill()) : c || (c = i.cell.createAndFill())
1693
+ );
1639
1694
  }
1640
1695
  const u = i.row.create(null, I.from(f)), p = [];
1641
1696
  for (let h = e.height; h < s; h++)
@@ -1644,7 +1699,7 @@ function vn(o, e, t, n, l, s, r) {
1644
1699
  }
1645
1700
  return !!(c || d);
1646
1701
  }
1647
- function Be(o, e, t, n, l, s, r, a) {
1702
+ function We(o, e, t, n, l, s, r, a) {
1648
1703
  if (r == 0 || r == e.height)
1649
1704
  return !1;
1650
1705
  let i = !1;
@@ -1653,7 +1708,14 @@ function Be(o, e, t, n, l, s, r, a) {
1653
1708
  if (e.map[d - e.width] == f) {
1654
1709
  i = !0;
1655
1710
  const u = t.nodeAt(f), { top: p, left: h } = e.findCell(f);
1656
- o.setNodeMarkup(o.mapping.slice(a).map(f + n), null, y(u.attrs, "rowspan", r - p)), o.insert(o.mapping.slice(a).map(e.positionAt(r, h, t)), u.type.createAndFill(y(u.attrs, "rowspan", p + u.attrs.rowspan - r))), c += u.attrs.colspan - 1;
1711
+ o.setNodeMarkup(
1712
+ o.mapping.slice(a).map(f + n),
1713
+ null,
1714
+ y(u.attrs, "rowspan", r - p)
1715
+ ), o.insert(
1716
+ o.mapping.slice(a).map(e.positionAt(r, h, t)),
1717
+ u.type.createAndFill(y(u.attrs, "rowspan", p + u.attrs.rowspan - r))
1718
+ ), c += u.attrs.colspan - 1;
1657
1719
  }
1658
1720
  }
1659
1721
  return i;
@@ -1667,27 +1729,43 @@ function Pe(o, e, t, n, l, s, r, a) {
1667
1729
  if (e.map[d - 1] == f) {
1668
1730
  i = !0;
1669
1731
  const u = t.nodeAt(f), p = e.colCount(f), h = o.mapping.slice(a).map(f + n);
1670
- o.setNodeMarkup(h, null, z(u.attrs, r - p, u.attrs.colspan - (r - p))), o.insert(h + u.nodeSize, u.type.createAndFill(z(u.attrs, 0, r - p))), c += u.attrs.rowspan - 1;
1732
+ o.setNodeMarkup(
1733
+ h,
1734
+ null,
1735
+ F(u.attrs, r - p, u.attrs.colspan - (r - p))
1736
+ ), o.insert(
1737
+ h + u.nodeSize,
1738
+ u.type.createAndFill(F(u.attrs, 0, r - p))
1739
+ ), c += u.attrs.rowspan - 1;
1671
1740
  }
1672
1741
  }
1673
1742
  return i;
1674
1743
  }
1675
- function We(o, e, t, n, l) {
1744
+ function He(o, e, t, n, l) {
1676
1745
  let s = t ? o.doc.nodeAt(t - 1) : o.doc, r = g.get(s);
1677
1746
  const { top: a, left: i } = n, c = i + l.width, d = a + l.height, f = o.tr;
1678
1747
  let u = 0;
1679
1748
  function p() {
1680
1749
  s = t ? f.doc.nodeAt(t - 1) : f.doc, r = g.get(s), u = f.mapping.maps.length;
1681
1750
  }
1682
- vn(f, r, s, t, c, d, u) && p(), Be(f, r, s, t, i, c, a, u) && p(), Be(f, r, s, t, i, c, d, u) && p(), Pe(f, r, s, t, a, d, i, u) && p(), Pe(f, r, s, t, a, d, c, u) && p();
1751
+ $n(f, r, s, t, c, d, u) && p(), We(f, r, s, t, i, c, a, u) && p(), We(f, r, s, t, i, c, d, u) && p(), Pe(f, r, s, t, a, d, i, u) && p(), Pe(f, r, s, t, a, d, c, u) && p();
1683
1752
  for (let h = a; h < d; h++) {
1684
1753
  const b = r.positionAt(h, i, s), w = r.positionAt(h, c, s);
1685
- f.replace(f.mapping.slice(u).map(b + t), f.mapping.slice(u).map(w + t), new O(l.rows[h - a], 0, 0));
1686
- }
1687
- p(), f.setSelection(new m(f.doc.resolve(t + r.positionAt(a, i, s)), f.doc.resolve(t + r.positionAt(d - 1, c - 1, s)))), e(f);
1688
- }
1689
- const En = new F("fix-tables");
1690
- function nt(o, e, t, n) {
1754
+ f.replace(
1755
+ f.mapping.slice(u).map(b + t),
1756
+ f.mapping.slice(u).map(w + t),
1757
+ new _(l.rows[h - a], 0, 0)
1758
+ );
1759
+ }
1760
+ p(), f.setSelection(
1761
+ new m(
1762
+ f.doc.resolve(t + r.positionAt(a, i, s)),
1763
+ f.doc.resolve(t + r.positionAt(d - 1, c - 1, s))
1764
+ )
1765
+ ), e(f);
1766
+ }
1767
+ const Dn = new B("fix-tables");
1768
+ function ot(o, e, t, n) {
1691
1769
  const l = o.childCount, s = e.childCount;
1692
1770
  e:
1693
1771
  for (let r = 0, a = 0; r < s; r++) {
@@ -1697,17 +1775,17 @@ function nt(o, e, t, n) {
1697
1775
  a = c + 1, t += i.nodeSize;
1698
1776
  continue e;
1699
1777
  }
1700
- n(i, t), a < l && o.child(a).sameMarkup(i) ? nt(o.child(a), i, t + 1, n) : i.nodesBetween(0, i.content.size, n, t + 1), t += i.nodeSize;
1778
+ n(i, t), a < l && o.child(a).sameMarkup(i) ? ot(o.child(a), i, t + 1, n) : i.nodesBetween(0, i.content.size, n, t + 1), t += i.nodeSize;
1701
1779
  }
1702
1780
  }
1703
- function In(o, e) {
1781
+ function On(o, e) {
1704
1782
  let t;
1705
1783
  const n = (l, s) => {
1706
- l.type.spec.tableRole == "table" && (t = $n(o, l, s, t));
1784
+ l.type.spec.tableRole == "table" && (t = _n(o, l, s, t));
1707
1785
  };
1708
- return e ? e.doc != o.doc && nt(e.doc, o.doc, 0, n) : o.doc.descendants(n), t;
1786
+ return e ? e.doc != o.doc && ot(e.doc, o.doc, 0, n) : o.doc.descendants(n), t;
1709
1787
  }
1710
- function $n(o, e, t, n) {
1788
+ function _n(o, e, t, n) {
1711
1789
  const l = g.get(e);
1712
1790
  if (!l.problems)
1713
1791
  return n;
@@ -1721,15 +1799,27 @@ function $n(o, e, t, n) {
1721
1799
  const d = e.nodeAt(c.pos);
1722
1800
  for (let f = 0; f < d.attrs.rowspan; f++)
1723
1801
  s[c.row + f] += c.n;
1724
- n.setNodeMarkup(n.mapping.map(t + 1 + c.pos), null, z(d.attrs, d.attrs.colspan - c.n, c.n));
1802
+ n.setNodeMarkup(
1803
+ n.mapping.map(t + 1 + c.pos),
1804
+ null,
1805
+ F(d.attrs, d.attrs.colspan - c.n, c.n)
1806
+ );
1725
1807
  } else if (c.type == "missing")
1726
1808
  s[c.row] += c.n;
1727
1809
  else if (c.type == "overlong_rowspan") {
1728
1810
  const d = e.nodeAt(c.pos);
1729
- n.setNodeMarkup(n.mapping.map(t + 1 + c.pos), null, y(d.attrs, "rowspan", d.attrs.rowspan - c.n));
1811
+ n.setNodeMarkup(
1812
+ n.mapping.map(t + 1 + c.pos),
1813
+ null,
1814
+ y(d.attrs, "rowspan", d.attrs.rowspan - c.n)
1815
+ );
1730
1816
  } else if (c.type == "colwidth mismatch") {
1731
1817
  const d = e.nodeAt(c.pos);
1732
- n.setNodeMarkup(n.mapping.map(t + 1 + c.pos), null, y(d.attrs, "colwidth", c.colwidth));
1818
+ n.setNodeMarkup(
1819
+ n.mapping.map(t + 1 + c.pos),
1820
+ null,
1821
+ y(d.attrs, "colwidth", c.colwidth)
1822
+ );
1733
1823
  }
1734
1824
  }
1735
1825
  let r, a;
@@ -1748,34 +1838,34 @@ function $n(o, e, t, n) {
1748
1838
  }
1749
1839
  c = f;
1750
1840
  }
1751
- return n.setMeta(En, { fixTables: !0 });
1841
+ return n.setMeta(Dn, { fixTables: !0 });
1752
1842
  }
1753
- const $ = new F("selectingCells");
1754
- function He(o, e) {
1843
+ const D = new B("selectingCells");
1844
+ function je(o, e) {
1755
1845
  for (; e && e != o.dom; e = e.parentNode)
1756
1846
  if (e.nodeName == "TD" || e.nodeName == "TH")
1757
1847
  return e;
1758
1848
  }
1759
- function de(o, e) {
1849
+ function fe(o, e) {
1760
1850
  const t = o.posAtCoords({ left: e.clientX, top: e.clientY });
1761
- return t && t ? X(o.state.doc.resolve(t.pos)) : null;
1851
+ return t && t ? U(o.state.doc.resolve(t.pos)) : null;
1762
1852
  }
1763
- function Dn(o, e) {
1853
+ function zn(o, e) {
1764
1854
  const t = e;
1765
1855
  if (t.ctrlKey || t.metaKey)
1766
1856
  return;
1767
- const n = He(o, t.target);
1857
+ const n = je(o, t.target);
1768
1858
  let l;
1769
1859
  if (t.shiftKey && o.state.selection instanceof m)
1770
1860
  s(o.state.selection.$anchorCell, t), t.preventDefault();
1771
- else if (t.shiftKey && n && (l = X(o.state.selection.$anchor)) != null && de(o, t).pos != l.pos)
1861
+ else if (t.shiftKey && n && (l = U(o.state.selection.$anchor)) != null && fe(o, t).pos != l.pos)
1772
1862
  s(l, t), t.preventDefault();
1773
1863
  else if (!n)
1774
1864
  return;
1775
1865
  function s(i, c) {
1776
- let d = de(o, c);
1777
- const f = $.getState(o.state) == null;
1778
- if (!d || !Se(i, d))
1866
+ let d = fe(o, c);
1867
+ const f = D.getState(o.state) == null;
1868
+ if (!d || !xe(i, d))
1779
1869
  if (f)
1780
1870
  d = i;
1781
1871
  else
@@ -1783,31 +1873,31 @@ function Dn(o, e) {
1783
1873
  const u = new m(i, d);
1784
1874
  if (f || !o.state.selection.eq(u)) {
1785
1875
  const p = o.state.tr.setSelection(u);
1786
- f && p.setMeta($, i.pos), o.dispatch(p);
1876
+ f && p.setMeta(D, i.pos), o.dispatch(p);
1787
1877
  }
1788
1878
  }
1789
1879
  function r() {
1790
- o.root.removeEventListener("mouseup", r), o.root.removeEventListener("dragstart", r), o.root.removeEventListener("mousemove", a), $.getState(o.state) != null && o.dispatch(o.state.tr.setMeta($, -1));
1880
+ o.root.removeEventListener("mouseup", r), o.root.removeEventListener("dragstart", r), o.root.removeEventListener("mousemove", a), D.getState(o.state) != null && o.dispatch(o.state.tr.setMeta(D, -1));
1791
1881
  }
1792
1882
  function a(i) {
1793
- const c = $.getState(o.state);
1883
+ const c = D.getState(o.state);
1794
1884
  let d;
1795
1885
  if (c != null)
1796
1886
  d = o.state.doc.resolve(c);
1797
- else if (He(o, i.target) != n && (d = de(o, t), !d))
1887
+ else if (je(o, i.target) != n && (d = fe(o, t), !d))
1798
1888
  return r();
1799
1889
  d && s(d, i);
1800
1890
  }
1801
1891
  o.root.addEventListener("mouseup", r), o.root.addEventListener("dragstart", r), o.root.addEventListener("mousemove", a);
1802
1892
  }
1803
- function On(o, e) {
1804
- const t = o.state.doc, n = X(t.resolve(e));
1893
+ function Fn(o, e) {
1894
+ const t = o.state.doc, n = U(t.resolve(e));
1805
1895
  return n ? (o.dispatch(o.state.tr.setSelection(new m(n))), !0) : !1;
1806
1896
  }
1807
- function Q(o, e, t) {
1897
+ function ee(o, e, t) {
1808
1898
  return t.eq(o.selection) ? !1 : (e && e(o.tr.setSelection(t).scrollIntoView()), !0);
1809
1899
  }
1810
- function ot(o, e, t) {
1900
+ function lt(o, e, t) {
1811
1901
  if (!(o.state.selection instanceof E))
1812
1902
  return null;
1813
1903
  const { $head: n } = o.state.selection;
@@ -1822,92 +1912,96 @@ function ot(o, e, t) {
1822
1912
  }
1823
1913
  return null;
1824
1914
  }
1825
- function J(o, e) {
1915
+ function Y(o, e) {
1826
1916
  return (t, n, l) => {
1827
1917
  const s = t.selection;
1828
1918
  if (s instanceof m)
1829
- return Q(t, n, N.near(s.$headCell, e));
1919
+ return ee(t, n, S.near(s.$headCell, e));
1830
1920
  if (o != "horiz" && !s.empty)
1831
1921
  return !1;
1832
- const r = ot(l, o, e);
1922
+ const r = lt(l, o, e);
1833
1923
  if (r == null)
1834
1924
  return !1;
1835
1925
  if (o == "horiz")
1836
- return Q(t, n, N.near(t.doc.resolve(s.head + e), e));
1926
+ return ee(t, n, S.near(t.doc.resolve(s.head + e), e));
1837
1927
  {
1838
- const a = t.doc.resolve(r), i = Qe(a, o, e);
1928
+ const a = t.doc.resolve(r), i = et(a, o, e);
1839
1929
  let c;
1840
- return i ? c = N.near(i, 1) : e < 0 ? c = N.near(t.doc.resolve(a.before(-1)), -1) : c = N.near(t.doc.resolve(a.after(-1)), 1), Q(t, n, c);
1930
+ return i ? c = S.near(i, 1) : e < 0 ? c = S.near(t.doc.resolve(a.before(-1)), -1) : c = S.near(t.doc.resolve(a.after(-1)), 1), ee(t, n, c);
1841
1931
  }
1842
1932
  };
1843
1933
  }
1844
- function Y(o, e) {
1934
+ function Z(o, e) {
1845
1935
  return (t, n, l) => {
1846
1936
  let s = t.selection;
1847
1937
  if (!(s instanceof m)) {
1848
- const a = ot(l, o, e);
1938
+ const a = lt(l, o, e);
1849
1939
  if (a == null)
1850
1940
  return !1;
1851
1941
  s = new m(t.doc.resolve(a));
1852
1942
  }
1853
- const r = Qe(s.$headCell, o, e);
1854
- return r ? Q(t, n, new m(s.$anchorCell, r)) : !1;
1943
+ const r = et(s.$headCell, o, e);
1944
+ return r ? ee(t, n, new m(s.$anchorCell, r)) : !1;
1855
1945
  };
1856
1946
  }
1857
- function Z(o, e) {
1947
+ function Q(o, e) {
1858
1948
  const t = o.selection;
1859
1949
  if (!(t instanceof m))
1860
1950
  return !1;
1861
1951
  if (e) {
1862
1952
  const n = o.tr, l = A(o.schema).cell.createAndFill().content;
1863
1953
  t.forEachCell((s, r) => {
1864
- s.content.eq(l) || n.replace(n.mapping.map(r + 1), n.mapping.map(r + s.nodeSize - 1), new O(l, 0, 0));
1954
+ s.content.eq(l) || n.replace(
1955
+ n.mapping.map(r + 1),
1956
+ n.mapping.map(r + s.nodeSize - 1),
1957
+ new _(l, 0, 0)
1958
+ );
1865
1959
  }), n.docChanged && e(n);
1866
1960
  }
1867
1961
  return !0;
1868
1962
  }
1869
- const _n = kt({
1870
- ArrowLeft: J("horiz", -1),
1871
- ArrowRight: J("horiz", 1),
1872
- ArrowUp: J("vert", -1),
1873
- ArrowDown: J("vert", 1),
1874
- "Shift-ArrowLeft": Y("horiz", -1),
1875
- "Shift-ArrowRight": Y("horiz", 1),
1876
- "Shift-ArrowUp": Y("vert", -1),
1877
- "Shift-ArrowDown": Y("vert", 1),
1878
- Backspace: Z,
1879
- "Mod-Backspace": Z,
1880
- Delete: Z,
1881
- "Mod-Delete": Z
1963
+ const Bn = St({
1964
+ ArrowLeft: Y("horiz", -1),
1965
+ ArrowRight: Y("horiz", 1),
1966
+ ArrowUp: Y("vert", -1),
1967
+ ArrowDown: Y("vert", 1),
1968
+ "Shift-ArrowLeft": Z("horiz", -1),
1969
+ "Shift-ArrowRight": Z("horiz", 1),
1970
+ "Shift-ArrowUp": Z("vert", -1),
1971
+ "Shift-ArrowDown": Z("vert", 1),
1972
+ Backspace: Q,
1973
+ "Mod-Backspace": Q,
1974
+ Delete: Q,
1975
+ "Mod-Delete": Q
1882
1976
  });
1883
- function zn(o, e, t) {
1977
+ function Wn(o, e, t) {
1884
1978
  if (!M(o.state))
1885
1979
  return !1;
1886
- let n = Rn(t);
1980
+ let n = vn(t);
1887
1981
  const l = o.state.selection;
1888
1982
  if (l instanceof m) {
1889
1983
  n || (n = {
1890
1984
  width: 1,
1891
1985
  height: 1,
1892
- rows: [I.from(he(A(o.state.schema).cell, t))]
1986
+ rows: [I.from(me(A(o.state.schema).cell, t))]
1893
1987
  });
1894
1988
  const s = l.$anchorCell.node(-1), r = l.$anchorCell.start(-1), a = g.get(s).rectBetween(l.$anchorCell.pos - r, l.$headCell.pos - r);
1895
- return n = Ln(n, a.right - a.left, a.bottom - a.top), We(o.state, o.dispatch, r, a, n), !0;
1989
+ return n = In(n, a.right - a.left, a.bottom - a.top), He(o.state, o.dispatch, r, a, n), !0;
1896
1990
  } else if (n) {
1897
- const s = oe(o.state), r = s.start(-1);
1898
- return We(o.state, o.dispatch, r, g.get(s.node(-1)).findCell(s.pos - r), n), !0;
1991
+ const s = le(o.state), r = s.start(-1);
1992
+ return He(o.state, o.dispatch, r, g.get(s.node(-1)).findCell(s.pos - r), n), !0;
1899
1993
  } else
1900
1994
  return !1;
1901
1995
  }
1902
- function Fn({ allowTableNodeSelection: o = !1 } = {}) {
1903
- return new W({
1904
- key: $,
1996
+ function Pn({ allowTableNodeSelection: o = !1 } = {}) {
1997
+ return new H({
1998
+ key: D,
1905
1999
  state: {
1906
2000
  init() {
1907
2001
  return null;
1908
2002
  },
1909
2003
  apply(e, t) {
1910
- const n = e.getMeta($);
2004
+ const n = e.getMeta(D);
1911
2005
  if (n != null)
1912
2006
  return n == -1 ? null : n;
1913
2007
  if (t == null || !e.docChanged)
@@ -1917,31 +2011,31 @@ function Fn({ allowTableNodeSelection: o = !1 } = {}) {
1917
2011
  }
1918
2012
  },
1919
2013
  props: {
1920
- decorations: _t,
2014
+ decorations: Bt,
1921
2015
  handleDOMEvents: {
1922
- mousedown: Dn
2016
+ mousedown: zn
1923
2017
  },
1924
2018
  createSelectionBetween(e) {
1925
- return $.getState(e.state) != null ? e.state.selection : null;
2019
+ return D.getState(e.state) != null ? e.state.selection : null;
1926
2020
  },
1927
- handleTripleClick: On,
1928
- handleKeyDown: _n,
1929
- handlePaste: zn
2021
+ handleTripleClick: Fn,
2022
+ handleKeyDown: Bn,
2023
+ handlePaste: Wn
1930
2024
  },
1931
2025
  appendTransaction(e, t, n) {
1932
- return Bt(n, In(n, t), o);
2026
+ return Ht(n, On(n, t), o);
1933
2027
  }
1934
2028
  });
1935
2029
  }
1936
- const ee = {
2030
+ const te = {
1937
2031
  NextCell: "NextCell",
1938
2032
  PrevCell: "PrevCell",
1939
2033
  ExitTable: "ExitTable"
1940
- }, je = R("PrevCell"), Ke = R("NextCell"), qe = R("BreakTable"), Bn = R("InsertTable"), Pn = it((o) => ({
2034
+ }, Ke = R("PrevCell"), qe = R("NextCell"), Xe = R("BreakTable"), Hn = R("InsertTable"), jn = dt((o) => ({
1941
2035
  schema: () => ({
1942
2036
  node: {
1943
2037
  table: {
1944
- ...G.table,
2038
+ ...J.table,
1945
2039
  parseMarkdown: {
1946
2040
  match: (e) => e.type === "table",
1947
2041
  runner: (e, t, n) => {
@@ -1968,7 +2062,7 @@ const ee = {
1968
2062
  }
1969
2063
  },
1970
2064
  table_row: {
1971
- ...G.table_row,
2065
+ ...J.table_row,
1972
2066
  parseMarkdown: {
1973
2067
  match: (e) => e.type === "tableRow",
1974
2068
  runner: (e, t, n) => {
@@ -1988,7 +2082,7 @@ const ee = {
1988
2082
  }
1989
2083
  },
1990
2084
  table_cell: {
1991
- ...G.table_cell,
2085
+ ...J.table_cell,
1992
2086
  parseMarkdown: {
1993
2087
  match: (e) => e.type === "tableCell" && !e.isHeader,
1994
2088
  runner: (e, t, n) => {
@@ -2004,7 +2098,7 @@ const ee = {
2004
2098
  }
2005
2099
  },
2006
2100
  table_header: {
2007
- ...G.table_header,
2101
+ ...J.table_header,
2008
2102
  parseMarkdown: {
2009
2103
  match: (e) => e.type === "tableCell" && !!e.isHeader,
2010
2104
  runner: (e, t, n) => {
@@ -2022,44 +2116,48 @@ const ee = {
2022
2116
  }
2023
2117
  }),
2024
2118
  inputRules: (e, t) => [
2025
- new fe(/^\|\|\s$/, (n, l, s, r) => {
2119
+ new ue(/^\|\|\s$/, (n, l, s, r) => {
2026
2120
  const a = n.doc.resolve(s);
2027
2121
  if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
2028
2122
  return null;
2029
- const i = ce(t.get(V)), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
2123
+ const i = ae(t.get(G)), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
2030
2124
  return c.setSelection(E.create(c.doc, s + 3));
2031
2125
  }),
2032
- new fe(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/, (n, l, s, r) => {
2126
+ new ue(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/, (n, l, s, r) => {
2033
2127
  var d, f;
2034
2128
  const a = n.doc.resolve(s);
2035
2129
  if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
2036
2130
  return null;
2037
- const i = ce(t.get(V), Number((d = l.groups) == null ? void 0 : d.row), Number((f = l.groups) == null ? void 0 : f.col)), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
2131
+ const i = ae(
2132
+ t.get(G),
2133
+ Number((d = l.groups) == null ? void 0 : d.row),
2134
+ Number((f = l.groups) == null ? void 0 : f.col)
2135
+ ), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
2038
2136
  return c.setSelection(E.create(c.doc, s + 3));
2039
2137
  })
2040
2138
  ],
2041
2139
  commands: (e, t) => [
2042
- S(je, () => De(-1)),
2043
- S(Ke, () => De(1)),
2044
- S(qe, () => qt(t.get(V).nodes.paragraph)),
2045
- S(Bn, () => (n, l) => {
2046
- const { selection: s, tr: r } = n, { from: a } = s, i = ce(t.get(V)), c = r.replaceSelectionWith(i), d = N.findFrom(c.doc.resolve(a), 1, !0);
2140
+ N(Ke, () => Oe(-1)),
2141
+ N(qe, () => Oe(1)),
2142
+ N(Xe, () => Vt(t.get(G).nodes.paragraph)),
2143
+ N(Hn, () => (n, l) => {
2144
+ const { selection: s, tr: r } = n, { from: a } = s, i = ae(t.get(G)), c = r.replaceSelectionWith(i), d = S.findFrom(c.doc.resolve(a), 1, !0);
2047
2145
  return d && (l == null || l(c.setSelection(d))), !0;
2048
2146
  })
2049
2147
  ],
2050
2148
  shortcuts: {
2051
- [ee.NextCell]: D(Ke, "Mod-]"),
2052
- [ee.PrevCell]: D(je, "Mod-["),
2053
- [ee.ExitTable]: D(qe, "Mod-Enter")
2149
+ [te.NextCell]: O(qe, "Mod-]"),
2150
+ [te.PrevCell]: O(Ke, "Mod-["),
2151
+ [te.ExitTable]: O(Xe, "Mod-Enter")
2054
2152
  },
2055
- prosePlugins: (e, t) => [fn(t, o), mn(), wn(), Fn()]
2056
- })), K = {
2057
- ...lt,
2058
- ...ee,
2153
+ prosePlugins: (e, t) => [hn(t, o), bn(), yn(), Pn()]
2154
+ })), q = {
2155
+ ...it,
2156
+ ...te,
2059
2157
  StrikeThrough: "StrikeThrough",
2060
2158
  TaskList: "TaskList"
2061
- }, me = R("ToggleStrikeThrough"), Xe = "strike_through", Wn = ct((o) => ({
2062
- id: Xe,
2159
+ }, ge = R("ToggleStrikeThrough"), Ue = "strike_through", Kn = ft((o) => ({
2160
+ id: Ue,
2063
2161
  schema: () => ({
2064
2162
  inclusive: !1,
2065
2163
  parseDOM: [
@@ -2074,17 +2172,17 @@ const ee = {
2074
2172
  }
2075
2173
  },
2076
2174
  toMarkdown: {
2077
- match: (e) => e.type.name === Xe,
2175
+ match: (e) => e.type.name === Ue,
2078
2176
  runner: (e, t) => {
2079
2177
  e.withMark(t, "delete");
2080
2178
  }
2081
2179
  }
2082
2180
  }),
2083
- commands: (e) => [S(me, () => Ct(e))],
2181
+ commands: (e) => [N(ge, () => At(e))],
2084
2182
  shortcuts: {
2085
- [K.StrikeThrough]: D(me, "Mod-Alt-x")
2183
+ [q.StrikeThrough]: O(ge, "Mod-Alt-x")
2086
2184
  }
2087
- })), ge = R("SplitTaskListItem"), we = R("SinkTaskListItem"), be = R("LiftTaskListItem"), Ce = R("TurnIntoTaskList"), Hn = ye((o) => {
2185
+ })), we = R("SplitTaskListItem"), be = R("SinkTaskListItem"), Ce = R("LiftTaskListItem"), ye = R("TurnIntoTaskList"), qn = ke((o) => {
2088
2186
  const e = "task_list_item";
2089
2187
  return {
2090
2188
  id: e,
@@ -2103,7 +2201,7 @@ const ee = {
2103
2201
  tag: 'li[data-type="task-item"]',
2104
2202
  getAttrs: (n) => {
2105
2203
  if (!(n instanceof HTMLElement))
2106
- throw ke(n);
2204
+ throw Ae(n);
2107
2205
  return { checked: n.dataset.checked === "true" };
2108
2206
  }
2109
2207
  }
@@ -2114,7 +2212,7 @@ const ee = {
2114
2212
  const r = s.target;
2115
2213
  if (!(r instanceof HTMLInputElement))
2116
2214
  return;
2117
- const a = t.get(te);
2215
+ const a = t.get(ne);
2118
2216
  if (!a.editable) {
2119
2217
  l.checked = !l.checked;
2120
2218
  return;
@@ -2123,9 +2221,11 @@ const ee = {
2123
2221
  if (!d)
2124
2222
  return;
2125
2223
  const { tr: f } = a.state;
2126
- a.dispatch(f.setNodeMarkup(d.inside, void 0, {
2127
- checked: r.checked
2128
- }));
2224
+ a.dispatch(
2225
+ f.setNodeMarkup(d.inside, void 0, {
2226
+ checked: r.checked
2227
+ })
2228
+ );
2129
2229
  }, [
2130
2230
  "li",
2131
2231
  {
@@ -2151,21 +2251,21 @@ const ee = {
2151
2251
  }
2152
2252
  }),
2153
2253
  inputRules: (t) => [
2154
- Ge(/^\s*(\[([ |x])\])\s$/, t, (n) => ({
2254
+ Je(/^\s*(\[([ |x])\])\s$/, t, (n) => ({
2155
2255
  checked: n[n.length - 1] === "x"
2156
2256
  }))
2157
2257
  ],
2158
2258
  commands: (t) => [
2159
- S(ge, () => Mt(t)),
2160
- S(we, () => Nt(t)),
2161
- S(be, () => St(t)),
2162
- S(Ce, () => yt(t))
2259
+ N(we, () => xt(t)),
2260
+ N(be, () => Rt(t)),
2261
+ N(Ce, () => Tt(t)),
2262
+ N(ye, () => Mt(t))
2163
2263
  ],
2164
2264
  shortcuts: {
2165
- [K.NextListItem]: D(ge, "Enter"),
2166
- [K.SinkListItem]: D(we, "Mod-]"),
2167
- [K.LiftListItem]: D(be, "Mod-["),
2168
- [K.TaskList]: D(Ce, "Mod-Alt-9")
2265
+ [q.NextListItem]: O(we, "Enter"),
2266
+ [q.SinkListItem]: O(be, "Mod-]"),
2267
+ [q.LiftListItem]: O(Ce, "Mod-["),
2268
+ [q.TaskList]: O(ye, "Mod-Alt-9")
2169
2269
  },
2170
2270
  view: () => (t, n, l) => {
2171
2271
  let s = t;
@@ -2173,9 +2273,11 @@ const ee = {
2173
2273
  editable: () => n.editable,
2174
2274
  onChange: (d) => {
2175
2275
  const { tr: f } = n.state;
2176
- n.dispatch(f.setNodeMarkup(l(), void 0, {
2177
- checked: d
2178
- }));
2276
+ n.dispatch(
2277
+ f.setNodeMarkup(l(), void 0, {
2278
+ checked: d
2279
+ })
2280
+ );
2179
2281
  }
2180
2282
  });
2181
2283
  if (!r)
@@ -2188,79 +2290,79 @@ const ee = {
2188
2290
  };
2189
2291
  }
2190
2292
  };
2191
- }), oo = at.create([
2192
- ...st,
2193
- dt(() => ft),
2194
- Pn(),
2195
- Wn(),
2196
- Hn(),
2197
- Lt(),
2198
- Rt()
2199
- ]), lo = {
2200
- ...rt,
2201
- ToggleStrikeThrough: me,
2202
- TurnIntoTaskList: Ce,
2203
- SinkTaskListItem: we,
2204
- LiftTaskListItem: be,
2205
- SplitTaskListItem: ge
2293
+ }), io = ut.create([
2294
+ ...ct,
2295
+ pt(() => ht),
2296
+ jn(),
2297
+ Kn(),
2298
+ qn(),
2299
+ It(),
2300
+ vt()
2301
+ ]), co = {
2302
+ ...at,
2303
+ ToggleStrikeThrough: ge,
2304
+ TurnIntoTaskList: ye,
2305
+ SinkTaskListItem: be,
2306
+ LiftTaskListItem: Ce,
2307
+ SplitTaskListItem: we
2206
2308
  };
2207
2309
  export {
2208
- qe as BreakTable,
2209
- io as InsertHardbreak,
2210
- co as InsertHr,
2211
- ao as InsertImage,
2212
- Bn as InsertTable,
2213
- fo as LiftListItem,
2214
- be as LiftTaskListItem,
2215
- Le as ModifyFootnoteDef,
2216
- ve as ModifyFootnoteRef,
2217
- uo as ModifyImage,
2218
- po as ModifyLink,
2219
- Ke as NextCell,
2220
- je as PrevCell,
2221
- ho as SinkListItem,
2222
- we as SinkTaskListItem,
2223
- mo as SplitListItem,
2224
- ge as SplitTaskListItem,
2225
- K as SupportedKeys,
2226
- go as ToggleBold,
2227
- wo as ToggleInlineCode,
2228
- bo as ToggleItalic,
2229
- Co as ToggleLink,
2230
- me as ToggleStrikeThrough,
2231
- yo as TurnIntoCodeFence,
2232
- ko as TurnIntoHeading,
2233
- Ce as TurnIntoTaskList,
2234
- Ao as TurnIntoText,
2235
- Mo as WrapInBlockquote,
2236
- No as WrapInBulletList,
2237
- So as WrapInOrderedList,
2238
- xo as blockquote,
2239
- Ro as bulletList,
2240
- To as codeFence,
2241
- Lo as codeInline,
2242
- lo as commands,
2243
- vo as commonmark,
2244
- Eo as commonmarkNodes,
2245
- Io as commonmarkPlugins,
2246
- ce as createTable,
2247
- $o as doc,
2248
- Do as em,
2249
- Rt as footnoteDefinition,
2250
- Lt as footnoteReference,
2251
- oo as gfm,
2252
- Oo as hardbreak,
2253
- _o as heading,
2254
- zo as hr,
2255
- Fo as image,
2256
- Bo as link,
2257
- Po as listItem,
2258
- Wo as orderedList,
2259
- Ho as paragraph,
2260
- Wn as strikeThrough,
2261
- jo as strong,
2262
- Pn as table,
2263
- Hn as taskListItem,
2264
- Ko as text
2310
+ Xe as BreakTable,
2311
+ uo as InsertHardbreak,
2312
+ po as InsertHr,
2313
+ ho as InsertImage,
2314
+ Hn as InsertTable,
2315
+ mo as LiftListItem,
2316
+ Ce as LiftTaskListItem,
2317
+ ve as ModifyFootnoteDef,
2318
+ Ee as ModifyFootnoteRef,
2319
+ go as ModifyImage,
2320
+ wo as ModifyLink,
2321
+ qe as NextCell,
2322
+ Ke as PrevCell,
2323
+ bo as SinkListItem,
2324
+ be as SinkTaskListItem,
2325
+ Co as SplitListItem,
2326
+ we as SplitTaskListItem,
2327
+ q as SupportedKeys,
2328
+ yo as ToggleBold,
2329
+ ko as ToggleInlineCode,
2330
+ Ao as ToggleItalic,
2331
+ Mo as ToggleLink,
2332
+ ge as ToggleStrikeThrough,
2333
+ So as TurnIntoCodeFence,
2334
+ No as TurnIntoHeading,
2335
+ ye as TurnIntoTaskList,
2336
+ xo as TurnIntoText,
2337
+ Ro as WrapInBlockquote,
2338
+ To as WrapInBulletList,
2339
+ Lo as WrapInOrderedList,
2340
+ vo as blockquote,
2341
+ Eo as bulletList,
2342
+ Io as codeFence,
2343
+ $o as codeInline,
2344
+ co as commands,
2345
+ Do as commonmark,
2346
+ Oo as commonmarkNodes,
2347
+ _o as commonmarkPlugins,
2348
+ ae as createTable,
2349
+ zo as doc,
2350
+ Fo as em,
2351
+ vt as footnoteDefinition,
2352
+ It as footnoteReference,
2353
+ io as gfm,
2354
+ Bo as hardbreak,
2355
+ Wo as heading,
2356
+ Po as hr,
2357
+ Ho as image,
2358
+ jo as link,
2359
+ Ko as listItem,
2360
+ qo as orderedList,
2361
+ Xo as paragraph,
2362
+ Kn as strikeThrough,
2363
+ Uo as strong,
2364
+ jn as table,
2365
+ qn as taskListItem,
2366
+ Vo as text
2265
2367
  };
2266
2368
  //# sourceMappingURL=index.es.js.map