@milkdown/preset-gfm 6.1.4 → 6.3.0

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