@uva-glass/component-library 3.42.3 → 3.42.5

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 (61) hide show
  1. package/dist/{Lexical.prod-qYl_ifJ6.js → Lexical.prod-nXWuyOKD.js} +1299 -1322
  2. package/dist/Lexical.prod-nXWuyOKD.js.map +1 -0
  3. package/dist/{LexicalClipboard.prod-DIGbXq4v.js → LexicalClipboard.prod-BP8LNbol.js} +104 -104
  4. package/dist/LexicalClipboard.prod-BP8LNbol.js.map +1 -0
  5. package/dist/{LexicalLink.prod-ZZwC5ABn.js → LexicalLink.prod-Brzpgs_K.js} +51 -51
  6. package/dist/{LexicalLink.prod-ZZwC5ABn.js.map → LexicalLink.prod-Brzpgs_K.js.map} +1 -1
  7. package/dist/{LexicalList.prod-UurCu6DK.js → LexicalList.prod-D6IAptR7.js} +53 -53
  8. package/dist/{LexicalList.prod-UurCu6DK.js.map → LexicalList.prod-D6IAptR7.js.map} +1 -1
  9. package/dist/LexicalSelection.prod-ZvNRDI9l.js +119 -0
  10. package/dist/LexicalSelection.prod-ZvNRDI9l.js.map +1 -0
  11. package/dist/LexicalTable.prod-DJktN6jF.js +1763 -0
  12. package/dist/LexicalTable.prod-DJktN6jF.js.map +1 -0
  13. package/dist/{LexicalUtils.prod-C3To3vrm.js → LexicalUtils.prod-Ckfw0Hjt.js} +34 -34
  14. package/dist/{LexicalUtils.prod-C3To3vrm.js.map → LexicalUtils.prod-Ckfw0Hjt.js.map} +1 -1
  15. package/dist/{TableCellResizerPlugin-B9MT1fxA.js → TableCellResizerPlugin-DFzNK-ve.js} +32 -32
  16. package/dist/{TableCellResizerPlugin-B9MT1fxA.js.map → TableCellResizerPlugin-DFzNK-ve.js.map} +1 -1
  17. package/dist/{TablePlugin-FQQwnq2m.js → TablePlugin-CAoOq8iA.js} +52 -52
  18. package/dist/{TablePlugin-FQQwnq2m.js.map → TablePlugin-CAoOq8iA.js.map} +1 -1
  19. package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
  20. package/dist/components/FormInput/FormInput.js +1 -1
  21. package/dist/components/InputField/InputField.stories.js +1 -1
  22. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  23. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  24. package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
  25. package/dist/components/MultiSelect/index.js +1 -1
  26. package/dist/components/PeriodSelector/PeriodSelector.js +1 -1
  27. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
  28. package/dist/components/RadioTabSelector/RadioTabSelector.js +1 -1
  29. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
  30. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +6 -6
  31. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +6 -6
  32. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +2 -2
  33. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
  34. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +35 -35
  35. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
  36. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +27 -27
  37. package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +5 -5
  38. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +4 -4
  39. package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +1 -1
  40. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
  41. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +4 -4
  42. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +7 -7
  43. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  44. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +18 -18
  45. package/dist/components/RteEditor/Plugins/index.js +2 -2
  46. package/dist/components/RteEditor/RteEditor.js +233 -233
  47. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  48. package/dist/components/RteEditor/helpers.js +32 -33
  49. package/dist/components/RteEditor/helpers.js.map +1 -1
  50. package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +16 -16
  51. package/dist/components/index.js +1 -1
  52. package/dist/{helpers-D3SODeVc.js → helpers-mE437H2Y.js} +38 -38
  53. package/dist/{helpers-D3SODeVc.js.map → helpers-mE437H2Y.js.map} +1 -1
  54. package/dist/index.js +1 -1
  55. package/package.json +6 -6
  56. package/dist/Lexical.prod-qYl_ifJ6.js.map +0 -1
  57. package/dist/LexicalClipboard.prod-DIGbXq4v.js.map +0 -1
  58. package/dist/LexicalSelection.prod-DXruZeFN.js +0 -103
  59. package/dist/LexicalSelection.prod-DXruZeFN.js.map +0 -1
  60. package/dist/LexicalTable.prod-COFf1Spn.js +0 -1763
  61. package/dist/LexicalTable.prod-COFf1Spn.js.map +0 -1
@@ -0,0 +1,1763 @@
1
+ import { w as T, r as G, i as gt, _ as Re, j as Ve, b as je, T as Fe, S as Qe, L as Ge } from "./LexicalUtils.prod-Ckfw0Hjt.js";
2
+ import { d as ee, y as Nt, w as z, a as M, l as ne, r as Ze, Z as _t, i as de, F as U, Q as oe, j as tn, m as Ae, n as rt, q as Et, L as re, h as D, g as en, V as nn, W as on, u as rn, I as Dt, v as Ke, o as ln, x as yt, E as Ut, _ as Ot, z as sn, A as an, B as cn, C as un, D as It, G as hn, H as dn, J as Oe, N as fn, R as j, O as gn, P as mn, S as pn, U as _n, X as Cn, Y as Sn, a0 as wn, a1 as bn, a2 as ft, k as nt, a3 as Mt, a4 as yn, b as Ee, a5 as Nn, a6 as vn, s as xn, a7 as Tn, a8 as Rn, a9 as fe, aa as Fn, ab as ge, t as An, ac as me, T as pe, p as Rt, ad as Kn } from "./Lexical.prod-nXWuyOKD.js";
3
+ import { F as On, J as En } from "./LexicalClipboard.prod-BP8LNbol.js";
4
+ const le = /^(\d+(?:\.\d+)?)px$/, W = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
5
+ class ct extends ee {
6
+ static getType() {
7
+ return "tablecell";
8
+ }
9
+ static clone(t) {
10
+ return new ct(t.__headerState, t.__colSpan, t.__width, t.__key);
11
+ }
12
+ afterCloneFrom(t) {
13
+ super.afterCloneFrom(t), this.__rowSpan = t.__rowSpan, this.__backgroundColor = t.__backgroundColor, this.__verticalAlign = t.__verticalAlign;
14
+ }
15
+ static importDOM() {
16
+ return { td: (t) => ({ conversion: _e, priority: 0 }), th: (t) => ({ conversion: _e, priority: 0 }) };
17
+ }
18
+ static importJSON(t) {
19
+ return q().updateFromJSON(t);
20
+ }
21
+ updateFromJSON(t) {
22
+ return super.updateFromJSON(t).setHeaderStyles(t.headerState).setColSpan(t.colSpan || 1).setRowSpan(t.rowSpan || 1).setWidth(t.width || void 0).setBackgroundColor(t.backgroundColor || null).setVerticalAlign(t.verticalAlign || void 0);
23
+ }
24
+ constructor(t = W.NO_STATUS, e = 1, o, r) {
25
+ super(r), this.__colSpan = e, this.__rowSpan = 1, this.__headerState = t, this.__width = o, this.__backgroundColor = null, this.__verticalAlign = void 0;
26
+ }
27
+ createDOM(t) {
28
+ const e = document.createElement(this.getTag());
29
+ return this.__width && (e.style.width = `${this.__width}px`), this.__colSpan > 1 && (e.colSpan = this.__colSpan), this.__rowSpan > 1 && (e.rowSpan = this.__rowSpan), this.__backgroundColor !== null && (e.style.backgroundColor = this.__backgroundColor), Yt(this.__verticalAlign) && (e.style.verticalAlign = this.__verticalAlign), G(e, t.theme.tableCell, this.hasHeader() && t.theme.tableCellHeader), e;
30
+ }
31
+ exportDOM(t) {
32
+ const e = super.exportDOM(t);
33
+ if (Nt(e.element)) {
34
+ const o = e.element;
35
+ o.setAttribute("data-temporary-table-cell-lexical-key", this.getKey()), o.style.border = "1px solid black", this.__colSpan > 1 && (o.colSpan = this.__colSpan), this.__rowSpan > 1 && (o.rowSpan = this.__rowSpan), o.style.width = `${this.getWidth() || 75}px`, o.style.verticalAlign = this.getVerticalAlign() || "top", o.style.textAlign = "start", this.__backgroundColor === null && this.hasHeader() && (o.style.backgroundColor = "#f2f3f5");
36
+ }
37
+ return e;
38
+ }
39
+ exportJSON() {
40
+ return { ...super.exportJSON(), ...Yt(this.__verticalAlign) && { verticalAlign: this.__verticalAlign }, backgroundColor: this.getBackgroundColor(), colSpan: this.__colSpan, headerState: this.__headerState, rowSpan: this.__rowSpan, width: this.getWidth() };
41
+ }
42
+ getColSpan() {
43
+ return this.getLatest().__colSpan;
44
+ }
45
+ setColSpan(t) {
46
+ const e = this.getWritable();
47
+ return e.__colSpan = t, e;
48
+ }
49
+ getRowSpan() {
50
+ return this.getLatest().__rowSpan;
51
+ }
52
+ setRowSpan(t) {
53
+ const e = this.getWritable();
54
+ return e.__rowSpan = t, e;
55
+ }
56
+ getTag() {
57
+ return this.hasHeader() ? "th" : "td";
58
+ }
59
+ setHeaderStyles(t, e = W.BOTH) {
60
+ const o = this.getWritable();
61
+ return o.__headerState = t & e | o.__headerState & ~e, o;
62
+ }
63
+ getHeaderStyles() {
64
+ return this.getLatest().__headerState;
65
+ }
66
+ setWidth(t) {
67
+ const e = this.getWritable();
68
+ return e.__width = t, e;
69
+ }
70
+ getWidth() {
71
+ return this.getLatest().__width;
72
+ }
73
+ getBackgroundColor() {
74
+ return this.getLatest().__backgroundColor;
75
+ }
76
+ setBackgroundColor(t) {
77
+ const e = this.getWritable();
78
+ return e.__backgroundColor = t, e;
79
+ }
80
+ getVerticalAlign() {
81
+ return this.getLatest().__verticalAlign;
82
+ }
83
+ setVerticalAlign(t) {
84
+ const e = this.getWritable();
85
+ return e.__verticalAlign = t || void 0, e;
86
+ }
87
+ toggleHeaderStyle(t) {
88
+ const e = this.getWritable();
89
+ return (e.__headerState & t) === t ? e.__headerState -= t : e.__headerState += t, e;
90
+ }
91
+ hasHeaderState(t) {
92
+ return (this.getHeaderStyles() & t) === t;
93
+ }
94
+ hasHeader() {
95
+ return this.getLatest().__headerState !== W.NO_STATUS;
96
+ }
97
+ updateDOM(t) {
98
+ return t.__headerState !== this.__headerState || t.__width !== this.__width || t.__colSpan !== this.__colSpan || t.__rowSpan !== this.__rowSpan || t.__backgroundColor !== this.__backgroundColor || t.__verticalAlign !== this.__verticalAlign;
99
+ }
100
+ isShadowRoot() {
101
+ return !0;
102
+ }
103
+ collapseAtStart() {
104
+ return !0;
105
+ }
106
+ canBeEmpty() {
107
+ return !1;
108
+ }
109
+ canIndent() {
110
+ return !1;
111
+ }
112
+ }
113
+ function Yt(n) {
114
+ return n === "middle" || n === "bottom";
115
+ }
116
+ function _e(n) {
117
+ const t = n, e = n.nodeName.toLowerCase();
118
+ let o;
119
+ le.test(t.style.width) && (o = parseFloat(t.style.width));
120
+ const r = q(e === "th" ? W.ROW : W.NO_STATUS, t.colSpan, o);
121
+ r.__rowSpan = t.rowSpan;
122
+ const s = t.style.backgroundColor;
123
+ s !== "" && (r.__backgroundColor = s);
124
+ const l = t.style.verticalAlign;
125
+ Yt(l) && (r.__verticalAlign = l);
126
+ const i = t.style, u = (i && i.textDecoration || "").split(" "), f = i.fontWeight === "700" || i.fontWeight === "bold", h = u.includes("line-through"), p = i.fontStyle === "italic", _ = u.includes("underline");
127
+ return { after: (a) => {
128
+ const c = [];
129
+ let g = null;
130
+ const d = () => {
131
+ if (g) {
132
+ const m = g.getFirstChild();
133
+ de(m) && g.getChildrenSize() === 1 && m.remove();
134
+ }
135
+ };
136
+ for (const m of a) Ze(m) || _t(m) || de(m) ? (_t(m) && (f && m.toggleFormat("bold"), h && m.toggleFormat("strikethrough"), p && m.toggleFormat("italic"), _ && m.toggleFormat("underline")), g ? g.append(m) : (g = U().append(m), c.push(g))) : (c.push(m), d(), g = null);
137
+ return d(), c.length === 0 && c.push(U()), c;
138
+ }, node: r };
139
+ }
140
+ function q(n = W.NO_STATUS, t = 1, e) {
141
+ return ne(new ct(n, t, e));
142
+ }
143
+ function b(n) {
144
+ return n instanceof ct;
145
+ }
146
+ const kn = ln("INSERT_TABLE_COMMAND");
147
+ function w(n, ...t) {
148
+ const e = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
149
+ o.append("code", n);
150
+ for (const r of t) o.append("v", r);
151
+ throw e.search = o.toString(), Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
152
+ }
153
+ class Tt extends ee {
154
+ static getType() {
155
+ return "tablerow";
156
+ }
157
+ static clone(t) {
158
+ return new Tt(t.__height, t.__key);
159
+ }
160
+ static importDOM() {
161
+ return { tr: (t) => ({ conversion: $n, priority: 0 }) };
162
+ }
163
+ static importJSON(t) {
164
+ return xt().updateFromJSON(t);
165
+ }
166
+ updateFromJSON(t) {
167
+ return super.updateFromJSON(t).setHeight(t.height);
168
+ }
169
+ constructor(t, e) {
170
+ super(e), this.__height = t;
171
+ }
172
+ exportJSON() {
173
+ const t = this.getHeight();
174
+ return { ...super.exportJSON(), ...t === void 0 ? void 0 : { height: t } };
175
+ }
176
+ createDOM(t) {
177
+ const e = document.createElement("tr");
178
+ return this.__height && (e.style.height = `${this.__height}px`), G(e, t.theme.tableRow), e;
179
+ }
180
+ extractWithChild(t, e, o) {
181
+ return o === "html";
182
+ }
183
+ isShadowRoot() {
184
+ return !0;
185
+ }
186
+ setHeight(t) {
187
+ const e = this.getWritable();
188
+ return e.__height = t, e;
189
+ }
190
+ getHeight() {
191
+ return this.getLatest().__height;
192
+ }
193
+ updateDOM(t) {
194
+ return t.__height !== this.__height;
195
+ }
196
+ canBeEmpty() {
197
+ return !1;
198
+ }
199
+ canIndent() {
200
+ return !1;
201
+ }
202
+ }
203
+ function $n(n) {
204
+ const t = n;
205
+ let e;
206
+ return le.test(t.style.height) && (e = parseFloat(t.style.height)), { after: (o) => Re(o, b), node: xt(e) };
207
+ }
208
+ function xt(n) {
209
+ return ne(new Tt(n));
210
+ }
211
+ function k(n) {
212
+ return n instanceof Tt;
213
+ }
214
+ const se = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Mn = se && "documentMode" in document ? document.documentMode : null, Ce = se && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
215
+ function Ln(n, t, e = !0) {
216
+ const o = ce();
217
+ for (let r = 0; r < n; r++) {
218
+ const s = xt();
219
+ for (let l = 0; l < t; l++) {
220
+ let i = W.NO_STATUS;
221
+ typeof e == "object" ? (r === 0 && e.rows && (i |= W.ROW), l === 0 && e.columns && (i |= W.COLUMN)) : e && (r === 0 && (i |= W.ROW), l === 0 && (i |= W.COLUMN));
222
+ const u = q(i), f = U();
223
+ f.append(oe()), u.append(f), s.append(u);
224
+ }
225
+ o.append(s);
226
+ }
227
+ return o;
228
+ }
229
+ function io(n) {
230
+ const t = T(n, ((e) => b(e)));
231
+ return b(t) ? t : null;
232
+ }
233
+ function ke(n) {
234
+ const t = T(n, ((e) => k(e)));
235
+ if (k(t)) return t;
236
+ throw new Error("Expected table cell to be inside of table row.");
237
+ }
238
+ function $e(n) {
239
+ const t = T(n, ((e) => $(e)));
240
+ if ($(t)) return t;
241
+ throw new Error("Expected table cell to be inside of table.");
242
+ }
243
+ function ao(n) {
244
+ const t = ke(n);
245
+ return $e(t).getChildren().findIndex(((e) => e.is(t)));
246
+ }
247
+ function co(n) {
248
+ return ke(n).getChildren().findIndex(((t) => t.is(n)));
249
+ }
250
+ se && "InputEvent" in window && !Mn && new window.InputEvent("input");
251
+ const qt = (n, t) => n === W.BOTH || n === t ? t : W.NO_STATUS;
252
+ function uo(n = !0) {
253
+ const t = z();
254
+ M(t) || A(t) || w(188);
255
+ const e = t.anchor.getNode(), o = t.focus.getNode(), [r] = I(e), [s, , l] = I(o), [, i, u] = J(l, s, r), { startRow: f } = u, { startRow: h } = i;
256
+ return n ? Xt(f + r.__rowSpan > h + s.__rowSpan ? r : s, !0) : Xt(h < f ? s : r, !1);
257
+ }
258
+ function Xt(n, t = !0) {
259
+ const [, , e] = I(n), [o, r] = J(e, n, n), s = o[0].length, { startRow: l } = r;
260
+ let i = null;
261
+ if (t) {
262
+ const u = l + n.__rowSpan - 1, f = o[u], h = xt();
263
+ for (let _ = 0; _ < s; _++) {
264
+ const { cell: a, startRow: c } = f[_];
265
+ if (c + a.__rowSpan - 1 <= u) {
266
+ const g = f[_].cell.__headerState, d = qt(g, W.COLUMN);
267
+ h.append(q(d).append(U()));
268
+ } else a.setRowSpan(a.__rowSpan + 1);
269
+ }
270
+ const p = e.getChildAtIndex(u);
271
+ k(p) || w(256), p.insertAfter(h), i = h;
272
+ } else {
273
+ const u = l, f = o[u], h = xt();
274
+ for (let _ = 0; _ < s; _++) {
275
+ const { cell: a, startRow: c } = f[_];
276
+ if (c === u) {
277
+ const g = f[_].cell.__headerState, d = qt(g, W.COLUMN);
278
+ h.append(q(d).append(U()));
279
+ } else a.setRowSpan(a.__rowSpan + 1);
280
+ }
281
+ const p = e.getChildAtIndex(u);
282
+ k(p) || w(257), p.insertBefore(h), i = h;
283
+ }
284
+ return i;
285
+ }
286
+ function ho(n = !0) {
287
+ const t = z();
288
+ M(t) || A(t) || w(188);
289
+ const e = t.anchor.getNode(), o = t.focus.getNode(), [r] = I(e), [s, , l] = I(o), [, i, u] = J(l, s, r), { startColumn: f } = u, { startColumn: h } = i;
290
+ return n ? Vt(f + r.__colSpan > h + s.__colSpan ? r : s, !0) : Vt(h < f ? s : r, !1);
291
+ }
292
+ function Vt(n, t = !0, e = !0) {
293
+ const [, , o] = I(n), [r, s] = J(o, n, n), l = r.length, { startColumn: i } = s, u = t ? i + n.__colSpan - 1 : i - 1, f = o.getFirstChild();
294
+ k(f) || w(120);
295
+ let h = null;
296
+ function p(c = W.NO_STATUS) {
297
+ const g = q(c).append(U());
298
+ return h === null && (h = g), g;
299
+ }
300
+ let _ = f;
301
+ t: for (let c = 0; c < l; c++) {
302
+ if (c !== 0) {
303
+ const y = _.getNextSibling();
304
+ k(y) || w(121), _ = y;
305
+ }
306
+ const g = r[c], d = g[u < 0 ? 0 : u].cell.__headerState, m = qt(d, W.ROW);
307
+ if (u < 0) {
308
+ Me(_, p(m));
309
+ continue;
310
+ }
311
+ const { cell: C, startColumn: S, startRow: N } = g[u];
312
+ if (S + C.__colSpan - 1 <= u) {
313
+ let y = C, v = N, R = u;
314
+ for (; v !== c && y.__rowSpan > 1; ) {
315
+ if (R -= C.__colSpan, !(R >= 0)) {
316
+ _.append(p(m));
317
+ continue t;
318
+ }
319
+ {
320
+ const { cell: E, startRow: O } = g[R];
321
+ y = E, v = O;
322
+ }
323
+ }
324
+ y.insertAfter(p(m));
325
+ } else C.setColSpan(C.__colSpan + 1);
326
+ }
327
+ h !== null && e && jt(h);
328
+ const a = o.getColWidths();
329
+ if (a) {
330
+ const c = [...a], g = u < 0 ? 0 : u, d = c[g];
331
+ c.splice(g, 0, d), o.setColWidths(c);
332
+ }
333
+ return h;
334
+ }
335
+ function fo() {
336
+ const n = z();
337
+ M(n) || A(n) || w(188);
338
+ const t = n.anchor.getNode(), e = n.focus.getNode(), [o, , r] = I(t), [s] = I(e), [l, i, u] = J(r, o, s), { startColumn: f } = i, { startRow: h, startColumn: p } = u, _ = Math.min(f, p), a = Math.max(f + o.__colSpan - 1, p + s.__colSpan - 1), c = a - _ + 1;
339
+ if (l[0].length === a - _ + 1) return r.selectPrevious(), void r.remove();
340
+ const g = l.length;
341
+ for (let S = 0; S < g; S++) for (let N = _; N <= a; N++) {
342
+ const { cell: y, startColumn: v } = l[S][N];
343
+ if (v < _) {
344
+ if (N === _) {
345
+ const R = _ - v;
346
+ y.setColSpan(y.__colSpan - Math.min(c, y.__colSpan - R));
347
+ }
348
+ } else if (v + y.__colSpan - 1 > a) {
349
+ if (N === a) {
350
+ const R = a - v + 1;
351
+ y.setColSpan(y.__colSpan - R);
352
+ }
353
+ } else y.remove();
354
+ }
355
+ const d = l[h], m = f > p ? d[f + o.__colSpan] : d[p + s.__colSpan];
356
+ if (m !== void 0) {
357
+ const { cell: S } = m;
358
+ jt(S);
359
+ } else {
360
+ const S = p < f ? d[p - 1] : d[f - 1], { cell: N } = S;
361
+ jt(N);
362
+ }
363
+ const C = r.getColWidths();
364
+ if (C) {
365
+ const S = [...C];
366
+ S.splice(_, c), r.setColWidths(S);
367
+ }
368
+ }
369
+ function jt(n) {
370
+ const t = n.getFirstDescendant();
371
+ t == null ? n.selectStart() : t.getParentOrThrow().selectStart();
372
+ }
373
+ function Me(n, t) {
374
+ const e = n.getFirstChild();
375
+ e !== null ? e.insertBefore(t) : n.append(t);
376
+ }
377
+ function zn(n) {
378
+ if (n.length === 0) return null;
379
+ const t = $e(n[0]), [e] = ot(t, null, null);
380
+ let o = 1 / 0, r = -1 / 0, s = 1 / 0, l = -1 / 0;
381
+ const i = /* @__PURE__ */ new Set();
382
+ for (const a of e) for (const c of a) {
383
+ if (!c || !c.cell) continue;
384
+ const g = c.cell.getKey();
385
+ if (!i.has(g) && n.some(((d) => d.is(c.cell)))) {
386
+ i.add(g);
387
+ const d = c.startRow, m = c.startColumn, C = c.cell.__rowSpan || 1, S = c.cell.__colSpan || 1;
388
+ o = Math.min(o, d), r = Math.max(r, d + C - 1), s = Math.min(s, m), l = Math.max(l, m + S - 1);
389
+ }
390
+ }
391
+ if (o === 1 / 0 || s === 1 / 0) return null;
392
+ const u = r - o + 1, f = l - s + 1, h = e[o][s];
393
+ if (!h.cell) return null;
394
+ const p = h.cell;
395
+ p.setColSpan(f), p.setRowSpan(u);
396
+ const _ = /* @__PURE__ */ new Set([p.getKey()]);
397
+ for (let a = o; a <= r; a++) for (let c = s; c <= l; c++) {
398
+ const g = e[a][c];
399
+ if (!g.cell) continue;
400
+ const d = g.cell, m = d.getKey();
401
+ _.has(m) || (_.add(m), Wn(d) || p.append(...d.getChildren()), d.remove());
402
+ }
403
+ return p.getChildrenSize() === 0 && p.append(U()), p;
404
+ }
405
+ function Wn(n) {
406
+ if (n.getChildrenSize() !== 1) return !1;
407
+ const t = n.getFirstChildOrThrow();
408
+ return !(!re(t) || !t.isEmpty());
409
+ }
410
+ function Pn(n) {
411
+ const [t, e, o] = I(n), r = t.__colSpan, s = t.__rowSpan;
412
+ if (r === 1 && s === 1) return;
413
+ const [l, i] = J(o, t, t), { startColumn: u, startRow: f } = i, h = t.__headerState & W.COLUMN, p = Array.from({ length: r }, ((c, g) => {
414
+ let d = h;
415
+ for (let m = 0; d !== 0 && m < l.length; m++) d &= l[m][g + u].cell.__headerState;
416
+ return d;
417
+ })), _ = t.__headerState & W.ROW, a = Array.from({ length: s }, ((c, g) => {
418
+ let d = _;
419
+ for (let m = 0; d !== 0 && m < l[0].length; m++) d &= l[g + f][m].cell.__headerState;
420
+ return d;
421
+ }));
422
+ if (r > 1) {
423
+ for (let c = 1; c < r; c++) t.insertAfter(q(p[c] | a[0]).append(U()));
424
+ t.setColSpan(1);
425
+ }
426
+ if (s > 1) {
427
+ let c;
428
+ for (let g = 1; g < s; g++) {
429
+ const d = f + g, m = l[d];
430
+ c = (c || e).getNextSibling(), k(c) || w(125);
431
+ let C = null;
432
+ for (let S = 0; S < u; S++) {
433
+ const N = m[S], y = N.cell;
434
+ N.startRow === d && (C = y), y.__colSpan > 1 && (S += y.__colSpan - 1);
435
+ }
436
+ if (C === null) for (let S = r - 1; S >= 0; S--) Me(c, q(p[S] | a[g]).append(U()));
437
+ else for (let S = r - 1; S >= 0; S--) C.insertAfter(q(p[S] | a[g]).append(U()));
438
+ }
439
+ t.setRowSpan(1);
440
+ }
441
+ }
442
+ function J(n, t, e) {
443
+ const [o, r, s] = ot(n, t, e);
444
+ return r === null && w(207), s === null && w(208), [o, r, s];
445
+ }
446
+ function ot(n, t, e) {
447
+ const o = [];
448
+ let r = null, s = null;
449
+ function l(u) {
450
+ let f = o[u];
451
+ return f === void 0 && (o[u] = f = []), f;
452
+ }
453
+ const i = n.getChildren();
454
+ for (let u = 0; u < i.length; u++) {
455
+ const f = i[u];
456
+ k(f) || w(209);
457
+ const h = l(u);
458
+ for (let p = f.getFirstChild(), _ = 0; p != null; p = p.getNextSibling()) {
459
+ for (b(p) || w(147); h[_] !== void 0; ) _++;
460
+ const a = { cell: p, startColumn: _, startRow: u }, { __rowSpan: c, __colSpan: g } = p;
461
+ for (let d = 0; d < c && !(u + d >= i.length); d++) {
462
+ const m = l(u + d);
463
+ for (let C = 0; C < g; C++) m[_ + C] = a;
464
+ }
465
+ t !== null && r === null && t.is(p) && (r = a), e !== null && s === null && e.is(p) && (s = a);
466
+ }
467
+ }
468
+ return [o, r, s];
469
+ }
470
+ function I(n) {
471
+ let t;
472
+ if (n instanceof ct) t = n;
473
+ else if ("__type" in n) {
474
+ const r = T(n, b);
475
+ b(r) || w(148), t = r;
476
+ } else {
477
+ const r = T(n.getNode(), b);
478
+ b(r) || w(148), t = r;
479
+ }
480
+ const e = t.getParent();
481
+ k(e) || w(149);
482
+ const o = e.getParent();
483
+ return $(o) || w(210), [t, e, o];
484
+ }
485
+ function kt(n, t, e) {
486
+ let o, r = Math.min(t.startColumn, e.startColumn), s = Math.min(t.startRow, e.startRow), l = Math.max(t.startColumn + t.cell.__colSpan - 1, e.startColumn + e.cell.__colSpan - 1), i = Math.max(t.startRow + t.cell.__rowSpan - 1, e.startRow + e.cell.__rowSpan - 1);
487
+ do {
488
+ o = !1;
489
+ for (let u = 0; u < n.length; u++) for (let f = 0; f < n[0].length; f++) {
490
+ const h = n[u][f];
491
+ if (!h) continue;
492
+ const p = h.startColumn + h.cell.__colSpan - 1, _ = h.startRow + h.cell.__rowSpan - 1, a = h.startColumn <= l && p >= r, c = h.startRow <= i && _ >= s;
493
+ if (a && c) {
494
+ const g = Math.min(r, h.startColumn), d = Math.max(l, p), m = Math.min(s, h.startRow), C = Math.max(i, _);
495
+ g === r && d === l && m === s && C === i || (r = g, l = d, s = m, i = C, o = !0);
496
+ }
497
+ }
498
+ } while (o);
499
+ return { maxColumn: l, maxRow: i, minColumn: r, minRow: s };
500
+ }
501
+ function Se(n) {
502
+ const [t, , e] = I(n), o = e.getChildren(), r = o.length, s = o[0].getChildren().length, l = new Array(r);
503
+ for (let i = 0; i < r; i++) l[i] = new Array(s);
504
+ for (let i = 0; i < r; i++) {
505
+ const u = o[i].getChildren();
506
+ let f = 0;
507
+ for (let h = 0; h < u.length; h++) {
508
+ for (; l[i][f]; ) f++;
509
+ const p = u[h], _ = p.__rowSpan || 1, a = p.__colSpan || 1;
510
+ for (let c = 0; c < _; c++) for (let g = 0; g < a; g++) l[i + c][f + g] = p;
511
+ if (t === p) return { colSpan: a, columnIndex: f, rowIndex: i, rowSpan: _ };
512
+ f += a;
513
+ }
514
+ }
515
+ return null;
516
+ }
517
+ function we(n) {
518
+ const [[t, e, o, r], [s, l, i, u]] = ["anchor", "focus"].map(((f) => {
519
+ const h = n[f].getNode(), p = T(h, b);
520
+ b(p) || w(238, f, h.getKey(), h.getType());
521
+ const _ = p.getParent();
522
+ k(_) || w(239, f);
523
+ const a = _.getParent();
524
+ return $(a) || w(240, f), [h, p, _, a];
525
+ }));
526
+ return r.is(u) || w(241), { anchorCell: e, anchorNode: t, anchorRow: o, anchorTable: r, focusCell: l, focusNode: s, focusRow: i, focusTable: u };
527
+ }
528
+ class Lt {
529
+ constructor(t, e, o) {
530
+ this.anchor = e, this.focus = o, e._selection = this, o._selection = this, this._cachedNodes = null, this.dirty = !1, this.tableKey = t;
531
+ }
532
+ getStartEndPoints() {
533
+ return [this.anchor, this.focus];
534
+ }
535
+ isValid() {
536
+ return this.tableKey !== "root" && this.anchor.key !== "root" && this.anchor.type === "element" && this.focus.key !== "root" && this.focus.type === "element";
537
+ }
538
+ isBackward() {
539
+ return this.focus.isBefore(this.anchor);
540
+ }
541
+ getCachedNodes() {
542
+ return this._cachedNodes;
543
+ }
544
+ setCachedNodes(t) {
545
+ this._cachedNodes = t;
546
+ }
547
+ is(t) {
548
+ return A(t) && this.tableKey === t.tableKey && this.anchor.is(t.anchor) && this.focus.is(t.focus);
549
+ }
550
+ set(t, e, o) {
551
+ this.dirty = this.dirty || t !== this.tableKey || e !== this.anchor.key || o !== this.focus.key, this.tableKey = t, this.anchor.key = e, this.focus.key = o, this._cachedNodes = null;
552
+ }
553
+ clone() {
554
+ return new Lt(this.tableKey, Et(this.anchor.key, this.anchor.offset, this.anchor.type), Et(this.focus.key, this.focus.offset, this.focus.type));
555
+ }
556
+ isCollapsed() {
557
+ return !1;
558
+ }
559
+ extract() {
560
+ return this.getNodes();
561
+ }
562
+ insertRawText(t) {
563
+ }
564
+ insertText() {
565
+ }
566
+ hasFormat(t) {
567
+ let e = 0;
568
+ this.getNodes().filter(b).forEach(((r) => {
569
+ const s = r.getFirstChild();
570
+ re(s) && (e |= s.getTextFormat());
571
+ }));
572
+ const o = on[t];
573
+ return !!(e & o);
574
+ }
575
+ insertNodes(t) {
576
+ const e = this.focus.getNode();
577
+ D(e) || w(151), en(e.select(0, e.getChildrenSize())).insertNodes(t);
578
+ }
579
+ getShape() {
580
+ const { anchorCell: t, focusCell: e } = we(this), o = Se(t);
581
+ o === null && w(153);
582
+ const r = Se(e);
583
+ r === null && w(155);
584
+ const s = Math.min(o.columnIndex, r.columnIndex), l = Math.max(o.columnIndex + o.colSpan - 1, r.columnIndex + r.colSpan - 1), i = Math.min(o.rowIndex, r.rowIndex), u = Math.max(o.rowIndex + o.rowSpan - 1, r.rowIndex + r.rowSpan - 1);
585
+ return { fromX: Math.min(s, l), fromY: Math.min(i, u), toX: Math.max(s, l), toY: Math.max(i, u) };
586
+ }
587
+ getNodes() {
588
+ if (!this.isValid()) return [];
589
+ const t = this._cachedNodes;
590
+ if (t !== null) return t;
591
+ const { anchorTable: e, anchorCell: o, focusCell: r } = we(this), s = r.getParents()[1];
592
+ if (s !== e) {
593
+ if (e.isParentOf(r)) {
594
+ const d = s.getParent();
595
+ d == null && w(159), this.set(this.tableKey, r.getKey(), d.getKey());
596
+ } else {
597
+ const d = e.getParent();
598
+ d == null && w(158), this.set(this.tableKey, d.getKey(), r.getKey());
599
+ }
600
+ return this.getNodes();
601
+ }
602
+ const [l, i, u] = J(e, o, r), { minColumn: f, maxColumn: h, minRow: p, maxRow: _ } = kt(l, i, u), a = /* @__PURE__ */ new Map([[e.getKey(), e]]);
603
+ let c = null;
604
+ for (let d = p; d <= _; d++) for (let m = f; m <= h; m++) {
605
+ const { cell: C } = l[d][m], S = C.getParent();
606
+ k(S) || w(160), S !== c && (a.set(S.getKey(), S), c = S), a.has(C.getKey()) || Bn(C, ((N) => {
607
+ a.set(N.getKey(), N);
608
+ }));
609
+ }
610
+ const g = Array.from(a.values());
611
+ return nn() || (this._cachedNodes = g), g;
612
+ }
613
+ getTextContent() {
614
+ const t = this.getNodes().filter(((o) => b(o)));
615
+ let e = "";
616
+ for (let o = 0; o < t.length; o++) {
617
+ const r = t[o], s = r.__parent, l = (t[o + 1] || {}).__parent;
618
+ e += r.getTextContent() + (l !== s ? `
619
+ ` : " ");
620
+ }
621
+ return e;
622
+ }
623
+ }
624
+ function A(n) {
625
+ return n instanceof Lt;
626
+ }
627
+ function Le() {
628
+ const n = Et("root", 0, "element"), t = Et("root", 0, "element");
629
+ return new Lt("root", n, t);
630
+ }
631
+ function Hn(n, t, e) {
632
+ n.getKey(), t.getKey(), e.getKey();
633
+ const o = z(), r = A(o) ? o.clone() : Le();
634
+ return r.set(n.getKey(), t.getKey(), e.getKey()), r;
635
+ }
636
+ function Bn(n, t) {
637
+ const e = [[n]];
638
+ for (let o = e.at(-1); o !== void 0 && e.length > 0; o = e.at(-1)) {
639
+ const r = o.pop();
640
+ r === void 0 ? e.pop() : t(r) !== !1 && D(r) && e.push(r.getChildren());
641
+ }
642
+ }
643
+ function ze(n, t = Ae()) {
644
+ const e = Ot(n);
645
+ $(e) || w(231, n);
646
+ const o = it(e, t.getElementByKey(n));
647
+ return o === null && w(232, n), { tableElement: o, tableNode: e };
648
+ }
649
+ class Dn {
650
+ constructor(t, e) {
651
+ this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.listenersToRemove = /* @__PURE__ */ new Set(), this.tableNodeKey = e, this.editor = t, this.table = { columns: 0, domRows: [], rows: 0 }, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.isSelecting = !1, this.pointerType = null, this.shouldCheckSelection = !1, this.abortController = new AbortController(), this.listenerOptions = { signal: this.abortController.signal }, this.nextFocus = null, this.trackTable();
652
+ }
653
+ getTable() {
654
+ return this.table;
655
+ }
656
+ removeListeners() {
657
+ this.abortController.abort("removeListeners"), Array.from(this.listenersToRemove).forEach(((t) => t())), this.listenersToRemove.clear();
658
+ }
659
+ $lookup() {
660
+ return ze(this.tableNodeKey, this.editor);
661
+ }
662
+ trackTable() {
663
+ const t = new MutationObserver(((e) => {
664
+ this.editor.getEditorState().read((() => {
665
+ let o = !1;
666
+ for (let l = 0; l < e.length; l++) {
667
+ const i = e[l].target.nodeName;
668
+ if (i === "TABLE" || i === "TBODY" || i === "THEAD" || i === "TR") {
669
+ o = !0;
670
+ break;
671
+ }
672
+ }
673
+ if (!o) return;
674
+ const { tableNode: r, tableElement: s } = this.$lookup();
675
+ this.table = mt(r, s);
676
+ }), { editor: this.editor });
677
+ }));
678
+ this.editor.getEditorState().read((() => {
679
+ const { tableNode: e, tableElement: o } = this.$lookup();
680
+ this.table = mt(e, o), t.observe(o, { attributes: !0, childList: !0, subtree: !0 });
681
+ }), { editor: this.editor });
682
+ }
683
+ $clearHighlight() {
684
+ const t = this.editor;
685
+ this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.$enableHighlightStyle();
686
+ const { tableNode: e, tableElement: o } = this.$lookup();
687
+ Ft(t, mt(e, o), null), z() !== null && (nt(null), t.dispatchCommand(ft, void 0));
688
+ }
689
+ $enableHighlightStyle() {
690
+ const t = this.editor, { tableElement: e } = this.$lookup();
691
+ gt(e, t._config.theme.tableSelection), e.classList.remove("disable-selection"), this.hasHijackedSelectionStyles = !1;
692
+ }
693
+ $disableHighlightStyle() {
694
+ const { tableElement: t } = this.$lookup();
695
+ G(t, this.editor._config.theme.tableSelection), this.hasHijackedSelectionStyles = !0;
696
+ }
697
+ $updateTableTableSelection(t) {
698
+ if (t !== null) {
699
+ t.tableKey !== this.tableNodeKey && w(233, t.tableKey, this.tableNodeKey);
700
+ const e = this.editor;
701
+ this.tableSelection = t, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), Ft(e, this.table, this.tableSelection);
702
+ } else this.$clearHighlight();
703
+ }
704
+ setShouldCheckSelection() {
705
+ this.shouldCheckSelection = !0;
706
+ }
707
+ getAndClearShouldCheckSelection() {
708
+ return !!this.shouldCheckSelection && (this.shouldCheckSelection = !1, !0);
709
+ }
710
+ setNextFocus(t) {
711
+ this.nextFocus = t;
712
+ }
713
+ getAndClearNextFocus() {
714
+ const { nextFocus: t } = this;
715
+ return t !== null && (this.nextFocus = null), t;
716
+ }
717
+ updateDOMSelection() {
718
+ if (this.anchorCell !== null && this.focusCell !== null) {
719
+ const t = Mt(this.editor._window);
720
+ t && t.rangeCount > 0 && t.removeAllRanges();
721
+ }
722
+ }
723
+ $setFocusCellForSelection(t, e = !1) {
724
+ const o = this.editor, { tableNode: r } = this.$lookup(), s = t.x, l = t.y;
725
+ if (this.focusCell = t, this.isHighlightingCells || this.anchorX === s && this.anchorY === l && !e) {
726
+ if (s === this.focusX && l === this.focusY) return !1;
727
+ } else this.isHighlightingCells = !0, this.$disableHighlightStyle();
728
+ if (this.focusX = s, this.focusY = l, this.isHighlightingCells) {
729
+ const i = Gt(r, t.elem);
730
+ if (this.tableSelection != null && this.anchorCellNodeKey != null && i !== null) return this.focusCellNodeKey = i.getKey(), this.tableSelection = Hn(r, this.$getAnchorTableCellOrThrow(), i), nt(this.tableSelection), o.dispatchCommand(ft, void 0), Ft(o, this.table, this.tableSelection), !0;
731
+ }
732
+ return !1;
733
+ }
734
+ $getAnchorTableCell() {
735
+ return this.anchorCellNodeKey ? Ot(this.anchorCellNodeKey) : null;
736
+ }
737
+ $getAnchorTableCellOrThrow() {
738
+ const t = this.$getAnchorTableCell();
739
+ return t === null && w(234), t;
740
+ }
741
+ $getFocusTableCell() {
742
+ return this.focusCellNodeKey ? Ot(this.focusCellNodeKey) : null;
743
+ }
744
+ $getFocusTableCellOrThrow() {
745
+ const t = this.$getFocusTableCell();
746
+ return t === null && w(235), t;
747
+ }
748
+ $setAnchorCellForSelection(t) {
749
+ this.isHighlightingCells = !1, this.anchorCell = t, this.anchorX = t.x, this.anchorY = t.y;
750
+ const { tableNode: e } = this.$lookup(), o = Gt(e, t.elem);
751
+ if (o !== null) {
752
+ const r = o.getKey();
753
+ this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : Le(), this.anchorCellNodeKey = r;
754
+ }
755
+ }
756
+ $formatCells(t) {
757
+ const e = z();
758
+ A(e) || w(236);
759
+ const o = Nn(), r = o.anchor, s = o.focus, l = e.getNodes().filter(b);
760
+ l.length > 0 || w(237);
761
+ const i = l[0].getFirstChild(), u = re(i) ? i.getFormatFlags(t, null) : null;
762
+ l.forEach(((f) => {
763
+ r.set(f.getKey(), 0, "element"), s.set(f.getKey(), f.getChildrenSize(), "element"), o.formatText(t, u);
764
+ })), nt(e), this.editor.dispatchCommand(ft, void 0);
765
+ }
766
+ $clearText() {
767
+ const { editor: t } = this, e = Ot(this.tableNodeKey);
768
+ if (!$(e)) throw new Error("Expected TableNode.");
769
+ const o = z();
770
+ A(o) || w(253);
771
+ const r = o.getNodes().filter(b), s = e.getFirstChild(), l = e.getLastChild();
772
+ if (r.length > 0 && s !== null && l !== null && k(s) && k(l) && r[0] === s.getFirstChild() && r[r.length - 1] === l.getLastChild()) {
773
+ e.selectPrevious();
774
+ const i = e.getParent();
775
+ return e.remove(), void (vn(i) && i.isEmpty() && t.dispatchCommand(Ee, void 0));
776
+ }
777
+ r.forEach(((i) => {
778
+ if (D(i)) {
779
+ const u = U(), f = oe();
780
+ u.append(f), i.append(u), i.getChildren().forEach(((h) => {
781
+ h !== u && h.remove();
782
+ }));
783
+ }
784
+ })), Ft(t, this.table, null), nt(null), t.dispatchCommand(ft, void 0);
785
+ }
786
+ }
787
+ const Qt = "__lexicalTableSelection", In = (n) => !(1 & ~n.buttons);
788
+ function dt(n) {
789
+ return Nt(n) && n.nodeName === "TABLE";
790
+ }
791
+ function it(n, t) {
792
+ if (!t) return t;
793
+ const e = dt(t) ? t : n.getDOMSlot(t).element;
794
+ return e.nodeName !== "TABLE" && w(245, t.nodeName), e;
795
+ }
796
+ function ie(n) {
797
+ return n._window;
798
+ }
799
+ function vt(n, t) {
800
+ for (let e = t, o = null; e !== null; e = e.getParent()) {
801
+ if (n.is(e)) return o;
802
+ b(e) && (o = e);
803
+ }
804
+ return null;
805
+ }
806
+ const Jn = [[sn, "down"], [an, "up"], [cn, "backward"], [un, "forward"]], Un = [dn, Oe, fn], Yn = [gn, mn];
807
+ function qn(n, t, e, o) {
808
+ const r = e.getRootElement(), s = ie(e);
809
+ r !== null && s !== null || w(246);
810
+ const l = new Dn(e, n.getKey()), i = it(n, t);
811
+ (function(a, c) {
812
+ be(a) !== null && w(205), a[Qt] = c;
813
+ })(i, l), l.listenersToRemove.add((() => (function(a, c) {
814
+ be(a) === c && delete a[Qt];
815
+ })(i, l)));
816
+ const u = (a) => {
817
+ if (l.pointerType = a.pointerType, a.button !== 0 || !yt(a.target) || !s) return;
818
+ const c = $t(a.target);
819
+ c !== null && e.update((() => {
820
+ const g = Ut();
821
+ if (Ce && a.shiftKey && Q(g, n) && (M(g) || A(g))) {
822
+ const d = g.anchor.getNode(), m = vt(n, g.anchor.getNode());
823
+ m ? (l.$setAnchorCellForSelection(st(l, m)), l.$setFocusCellForSelection(c), tt(a)) : (n.isBefore(d) ? n.selectStart() : n.selectEnd()).anchor.set(g.anchor.key, g.anchor.offset, g.anchor.type);
824
+ } else a.pointerType !== "touch" && l.$setAnchorCellForSelection(c);
825
+ })), (() => {
826
+ if (l.isSelecting) return;
827
+ const g = () => {
828
+ l.isSelecting = !1, s.removeEventListener("pointerup", g), s.removeEventListener("pointermove", d);
829
+ }, d = (m) => {
830
+ if (!In(m) && l.isSelecting) return l.isSelecting = !1, s.removeEventListener("pointerup", g), void s.removeEventListener("pointermove", d);
831
+ if (!yt(m.target)) return;
832
+ let C = null;
833
+ const S = !(Ce || i.contains(m.target));
834
+ if (S) C = ye(i, m.target);
835
+ else for (const N of document.elementsFromPoint(m.clientX, m.clientY)) if (C = ye(i, N), C) break;
836
+ !C || l.focusCell !== null && C.elem === l.focusCell.elem || (l.setNextFocus({ focusCell: C, override: S }), e.dispatchCommand(ft, void 0));
837
+ };
838
+ l.isSelecting = !0, s.addEventListener("pointerup", g, l.listenerOptions), s.addEventListener("pointermove", d, l.listenerOptions);
839
+ })();
840
+ };
841
+ i.addEventListener("pointerdown", u, l.listenerOptions), l.listenersToRemove.add((() => {
842
+ i.removeEventListener("pointerdown", u);
843
+ }));
844
+ const f = (a) => {
845
+ a.detail >= 3 && yt(a.target) && $t(a.target) !== null && a.preventDefault();
846
+ };
847
+ i.addEventListener("mousedown", f, l.listenerOptions), l.listenersToRemove.add((() => {
848
+ i.removeEventListener("mousedown", f);
849
+ }));
850
+ const h = (a) => {
851
+ const c = a.target;
852
+ a.button === 0 && yt(c) && e.update((() => {
853
+ const g = z();
854
+ A(g) && g.tableKey === l.tableNodeKey && r.contains(c) && l.$clearHighlight();
855
+ }));
856
+ };
857
+ s.addEventListener("pointerdown", h, l.listenerOptions), l.listenersToRemove.add((() => {
858
+ s.removeEventListener("pointerdown", h);
859
+ }));
860
+ for (const [a, c] of Jn) l.listenersToRemove.add(e.registerCommand(a, ((g) => He(e, g, c, n, l)), It));
861
+ l.listenersToRemove.add(e.registerCommand(hn, ((a) => {
862
+ const c = z();
863
+ if (A(c)) {
864
+ const g = vt(n, c.focus.getNode());
865
+ if (g !== null) return tt(a), g.selectEnd(), !0;
866
+ }
867
+ return !1;
868
+ }), It));
869
+ const p = (a) => () => {
870
+ const c = z();
871
+ if (!Q(c, n)) return !1;
872
+ if (A(c)) return l.$clearText(), !0;
873
+ if (M(c)) {
874
+ if (!b(vt(n, c.anchor.getNode()))) return !1;
875
+ const g = c.anchor.getNode(), d = c.focus.getNode(), m = n.isParentOf(g), C = n.isParentOf(d);
876
+ if (m && !C || C && !m) return l.$clearText(), !0;
877
+ const S = T(c.anchor.getNode(), ((y) => D(y))), N = S && T(S, ((y) => D(y) && b(y.getParent())));
878
+ if (!D(N) || !D(S)) return !1;
879
+ if (a === Oe && N.getPreviousSibling() === null) return !0;
880
+ }
881
+ return !1;
882
+ };
883
+ for (const a of Un) l.listenersToRemove.add(e.registerCommand(a, p(a), j));
884
+ const _ = (a) => {
885
+ const c = z();
886
+ if (!A(c) && !M(c)) return !1;
887
+ const g = n.isParentOf(c.anchor.getNode());
888
+ if (g !== n.isParentOf(c.focus.getNode())) {
889
+ const d = g ? "anchor" : "focus", m = g ? "focus" : "anchor", { key: C, offset: S, type: N } = c[m];
890
+ return n[c[d].isBefore(c[m]) ? "selectPrevious" : "selectNext"]()[m].set(C, S, N), !1;
891
+ }
892
+ return !!Q(c, n) && !!A(c) && (a && (a.preventDefault(), a.stopPropagation()), l.$clearText(), !0);
893
+ };
894
+ for (const a of Yn) l.listenersToRemove.add(e.registerCommand(a, _, j));
895
+ return l.listenersToRemove.add(e.registerCommand(pn, ((a) => {
896
+ const c = z();
897
+ if (c) {
898
+ if (!A(c) && !M(c)) return !1;
899
+ On(e, Ge(a, ClipboardEvent) ? a : null, En(c));
900
+ const g = _(a);
901
+ return M(c) ? (c.removeText(), !0) : g;
902
+ }
903
+ return !1;
904
+ }), j)), l.listenersToRemove.add(e.registerCommand(_n, ((a) => {
905
+ const c = z();
906
+ if (!Q(c, n)) return !1;
907
+ if (A(c)) return l.$formatCells(a), !0;
908
+ if (M(c)) {
909
+ const g = T(c.anchor.getNode(), ((d) => b(d)));
910
+ if (!b(g)) return !1;
911
+ }
912
+ return !1;
913
+ }), j)), l.listenersToRemove.add(e.registerCommand(Cn, ((a) => {
914
+ const c = z();
915
+ if (!A(c) || !Q(c, n)) return !1;
916
+ const g = c.anchor.getNode(), d = c.focus.getNode();
917
+ if (!b(g) || !b(d)) return !1;
918
+ if ((function(O, L) {
919
+ if (A(O)) {
920
+ const F = O.anchor.getNode(), K = O.focus.getNode();
921
+ if (L && F && K) {
922
+ const [P] = J(L, F, K);
923
+ return F.getKey() === P[0][0].cell.getKey() && K.getKey() === P[P.length - 1].at(-1).cell.getKey();
924
+ }
925
+ }
926
+ return !1;
927
+ })(c, n)) return n.setFormat(a), !0;
928
+ const [m, C, S] = J(n, g, d), N = Math.max(C.startRow + C.cell.__rowSpan - 1, S.startRow + S.cell.__rowSpan - 1), y = Math.max(C.startColumn + C.cell.__colSpan - 1, S.startColumn + S.cell.__colSpan - 1), v = Math.min(C.startRow, S.startRow), R = Math.min(C.startColumn, S.startColumn), E = /* @__PURE__ */ new Set();
929
+ for (let O = v; O <= N; O++) for (let L = R; L <= y; L++) {
930
+ const F = m[O][L].cell;
931
+ if (E.has(F)) continue;
932
+ E.add(F), F.setFormat(a);
933
+ const K = F.getChildren();
934
+ for (let P = 0; P < K.length; P++) {
935
+ const B = K[P];
936
+ D(B) && !B.isInline() && B.setFormat(a);
937
+ }
938
+ }
939
+ return !0;
940
+ }), j)), l.listenersToRemove.add(e.registerCommand(Sn, ((a) => {
941
+ const c = z();
942
+ if (!Q(c, n)) return !1;
943
+ if (A(c)) return l.$clearHighlight(), !1;
944
+ if (M(c)) {
945
+ const g = T(c.anchor.getNode(), ((d) => b(d)));
946
+ if (!b(g)) return !1;
947
+ if (typeof a == "string") {
948
+ const d = xe(e, c, n);
949
+ if (d) return ve(d, n, [oe(a)]), !0;
950
+ }
951
+ }
952
+ return !1;
953
+ }), j)), o && l.listenersToRemove.add(e.registerCommand(wn, ((a) => {
954
+ const c = z();
955
+ if (!M(c) || !c.isCollapsed() || !Q(c, n)) return !1;
956
+ const g = bt(c.anchor.getNode());
957
+ return !(g === null || !n.is(pt(g))) && (tt(a), (function(d, m) {
958
+ const C = m === "next" ? "getNextSibling" : "getPreviousSibling", S = m === "next" ? "getFirstChild" : "getLastChild", N = d[C]();
959
+ if (D(N)) return N.selectEnd();
960
+ const y = T(d, k);
961
+ y === null && w(247);
962
+ for (let R = y[C](); k(R); R = R[C]()) {
963
+ const E = R[S]();
964
+ if (D(E)) return E.selectEnd();
965
+ }
966
+ const v = T(y, $);
967
+ v === null && w(248), m === "next" ? v.selectNext() : v.selectPrevious();
968
+ })(g, a.shiftKey ? "previous" : "next"), !0);
969
+ }), j)), l.listenersToRemove.add(e.registerCommand(bn, ((a) => n.isSelected()), It)), l.listenersToRemove.add(e.registerCommand(Ke, ((a, c) => {
970
+ if (e !== c) return !1;
971
+ const { nodes: g, selection: d } = a, m = d.getStartEndPoints(), C = A(d), S = M(d) && T(d.anchor.getNode(), ((x) => b(x))) !== null && T(d.focus.getNode(), ((x) => b(x))) !== null || C;
972
+ if (g.length !== 1 || !$(g[0]) || !S || m === null) return !1;
973
+ const [N, y] = m, [v, R, E] = I(N), O = T(y.getNode(), ((x) => b(x)));
974
+ if (!(b(v) && b(O) && k(R) && $(E))) return !1;
975
+ const L = g[0], [F, K, P] = J(E, v, O), [B] = ot(L, null, null), et = F.length, Ct = et > 0 ? F[0].length : 0;
976
+ let X = K.startRow, H = K.startColumn, lt = B.length, ut = lt > 0 ? B[0].length : 0;
977
+ if (C) {
978
+ const x = kt(F, K, P), Y = x.maxRow - x.minRow + 1, V = x.maxColumn - x.minColumn + 1;
979
+ X = x.minRow, H = x.minColumn, lt = Math.min(lt, Y), ut = Math.min(ut, V);
980
+ }
981
+ let zt = !1;
982
+ const Be = Math.min(et, X + lt) - 1, De = Math.min(Ct, H + ut) - 1, ue = /* @__PURE__ */ new Set();
983
+ for (let x = X; x <= Be; x++) for (let Y = H; Y <= De; Y++) {
984
+ const V = F[x][Y];
985
+ ue.has(V.cell.getKey()) || V.cell.__rowSpan === 1 && V.cell.__colSpan === 1 || (Pn(V.cell), ue.add(V.cell.getKey()), zt = !0);
986
+ }
987
+ let [St] = ot(E.getWritable(), null, null);
988
+ const Ie = lt - et + X;
989
+ for (let x = 0; x < Ie; x++)
990
+ Xt(St[et - 1][0].cell);
991
+ const Je = ut - Ct + H;
992
+ for (let x = 0; x < Je; x++)
993
+ Vt(St[0][Ct - 1].cell, !0, !1);
994
+ [St] = ot(E.getWritable(), null, null);
995
+ for (let x = X; x < X + lt; x++) for (let Y = H; Y < H + ut; Y++) {
996
+ const V = x - X, he = Y - H, Wt = B[V][he];
997
+ if (Wt.startRow !== V || Wt.startColumn !== he) continue;
998
+ const wt = Wt.cell;
999
+ if (wt.__rowSpan !== 1 || wt.__colSpan !== 1) {
1000
+ const Z = [], Ye = Math.min(x + wt.__rowSpan, X + lt) - 1, qe = Math.min(Y + wt.__colSpan, H + ut) - 1;
1001
+ for (let Ht = x; Ht <= Ye; Ht++) for (let Bt = Y; Bt <= qe; Bt++) {
1002
+ const Xe = St[Ht][Bt];
1003
+ Z.push(Xe.cell);
1004
+ }
1005
+ zn(Z), zt = !0;
1006
+ }
1007
+ const { cell: Pt } = St[x][Y], Ue = Pt.getChildren();
1008
+ wt.getChildren().forEach(((Z) => {
1009
+ _t(Z) && U().append(Z), Pt.append(Z);
1010
+ })), Ue.forEach(((Z) => Z.remove()));
1011
+ }
1012
+ if (C && zt) {
1013
+ const [x] = ot(E.getWritable(), null, null);
1014
+ x[K.startRow][K.startColumn].cell.selectEnd();
1015
+ }
1016
+ return !0;
1017
+ }), j)), l.listenersToRemove.add(e.registerCommand(ft, (() => {
1018
+ const a = z(), c = Ut(), g = l.getAndClearNextFocus();
1019
+ if (g !== null) {
1020
+ const { focusCell: d } = g;
1021
+ if (A(a) && a.tableKey === l.tableNodeKey) return (d.x !== l.focusX || d.y !== l.focusY) && (l.$setFocusCellForSelection(d), !0);
1022
+ if (d !== l.anchorCell && Q(a, n)) return l.$setFocusCellForSelection(d), !0;
1023
+ }
1024
+ if (l.getAndClearShouldCheckSelection() && M(c) && M(a) && a.isCollapsed()) {
1025
+ const d = a.anchor.getNode(), m = n.getFirstChild(), C = bt(d);
1026
+ if (C !== null && k(m)) {
1027
+ const S = m.getFirstChild();
1028
+ if (b(S) && n.is(T(C, ((N) => N.is(n) || N.is(S))))) return S.selectStart(), !0;
1029
+ }
1030
+ }
1031
+ if (M(a)) {
1032
+ const { anchor: d, focus: m } = a, C = d.getNode(), S = m.getNode(), N = bt(C), y = bt(S), v = !(!N || !n.is(pt(N))), R = !(!y || !n.is(pt(y))), E = v !== R, O = v && R, L = a.isBackward();
1033
+ if (E) {
1034
+ const F = a.clone();
1035
+ if (R) {
1036
+ const [K] = J(n, y, y), P = K[0][0].cell, B = K[K.length - 1].at(-1).cell;
1037
+ F.focus.set(L ? P.getKey() : B.getKey(), L ? P.getChildrenSize() : B.getChildrenSize(), "element");
1038
+ } else if (v) {
1039
+ const [K] = J(n, N, N), P = K[0][0].cell, B = K[K.length - 1].at(-1).cell;
1040
+ F.anchor.set(L ? B.getKey() : P.getKey(), L ? B.getChildrenSize() : 0, "element");
1041
+ }
1042
+ nt(F), Ne(e, l);
1043
+ } else if (O && (N.is(y) || (l.$setAnchorCellForSelection(st(l, N)), l.$setFocusCellForSelection(st(l, y), !0)), l.pointerType === "touch" && l.isSelecting && a.isCollapsed() && M(c) && c.isCollapsed())) {
1044
+ const F = bt(c.anchor.getNode());
1045
+ F && !F.is(y) && (l.$setAnchorCellForSelection(st(l, F)), l.$setFocusCellForSelection(st(l, y), !0), l.pointerType = null);
1046
+ }
1047
+ } else if (a && A(a) && a.is(c) && a.tableKey === n.getKey()) {
1048
+ const d = Mt(s);
1049
+ if (d && d.anchorNode && d.focusNode) {
1050
+ const m = rt(d.focusNode), C = m && !n.isParentOf(m), S = rt(d.anchorNode), N = S && n.isParentOf(S);
1051
+ if (C && N && d.rangeCount > 0) {
1052
+ const y = yn(d, e);
1053
+ y && (y.anchor.set(n.getKey(), a.isBackward() ? n.getChildrenSize() : 0, "element"), d.removeAllRanges(), nt(y));
1054
+ }
1055
+ }
1056
+ }
1057
+ return a && !a.is(c) && (A(a) || A(c)) && l.tableSelection && !l.tableSelection.is(c) ? (A(a) && a.tableKey === l.tableNodeKey ? l.$updateTableTableSelection(a) : !A(a) && A(c) && c.tableKey === l.tableNodeKey && l.$updateTableTableSelection(null), !1) : (l.hasHijackedSelectionStyles && !n.isSelected() ? (function(d, m) {
1058
+ m.$enableHighlightStyle(), ae(m.table, ((C) => {
1059
+ const S = C.elem;
1060
+ C.highlighted = !1, Pe(d, C), S.getAttribute("style") || S.removeAttribute("style");
1061
+ }));
1062
+ })(e, l) : !l.hasHijackedSelectionStyles && n.isSelected() && Ne(e, l), !1);
1063
+ }), j)), l.listenersToRemove.add(e.registerCommand(Ee, (() => {
1064
+ const a = z();
1065
+ if (!M(a) || !a.isCollapsed() || !Q(a, n)) return !1;
1066
+ const c = xe(e, a, n);
1067
+ return !!c && (ve(c, n), !0);
1068
+ }), j)), l;
1069
+ }
1070
+ function be(n) {
1071
+ return n[Qt] || null;
1072
+ }
1073
+ function $t(n) {
1074
+ let t = n;
1075
+ for (; t != null; ) {
1076
+ const e = t.nodeName;
1077
+ if (e === "TD" || e === "TH") {
1078
+ const o = t._cell;
1079
+ return o === void 0 ? null : o;
1080
+ }
1081
+ t = t.parentNode;
1082
+ }
1083
+ return null;
1084
+ }
1085
+ function ye(n, t) {
1086
+ if (!n.contains(t)) return null;
1087
+ let e = null;
1088
+ for (let o = t; o != null; o = o.parentNode) {
1089
+ if (o === n) return e;
1090
+ const r = o.nodeName;
1091
+ r !== "TD" && r !== "TH" || (e = o._cell || null);
1092
+ }
1093
+ return null;
1094
+ }
1095
+ function mt(n, t) {
1096
+ const e = [], o = { columns: 0, domRows: e, rows: 0 };
1097
+ let r = it(n, t).querySelector("tr"), s = 0, l = 0;
1098
+ for (e.length = 0; r != null; ) {
1099
+ const i = r.nodeName;
1100
+ if (i === "TD" || i === "TH") {
1101
+ const h = { elem: r, hasBackgroundColor: r.style.backgroundColor !== "", highlighted: !1, x: s, y: l };
1102
+ r._cell = h;
1103
+ let p = e[l];
1104
+ p === void 0 && (p = e[l] = []), p[s] = h;
1105
+ } else {
1106
+ const h = r.firstChild;
1107
+ if (h != null) {
1108
+ r = h;
1109
+ continue;
1110
+ }
1111
+ }
1112
+ const u = r.nextSibling;
1113
+ if (u != null) {
1114
+ s++, r = u;
1115
+ continue;
1116
+ }
1117
+ const f = r.parentNode;
1118
+ if (f != null) {
1119
+ const h = f.nextSibling;
1120
+ if (h == null) break;
1121
+ l++, s = 0, r = h;
1122
+ }
1123
+ }
1124
+ return o.columns = s + 1, o.rows = l + 1, o;
1125
+ }
1126
+ function Ft(n, t, e) {
1127
+ const o = new Set(e ? e.getNodes() : []);
1128
+ ae(t, ((r, s) => {
1129
+ const l = r.elem;
1130
+ o.has(s) ? (r.highlighted = !0, We(n, r)) : (r.highlighted = !1, Pe(n, r), l.getAttribute("style") || l.removeAttribute("style"));
1131
+ }));
1132
+ }
1133
+ function ae(n, t) {
1134
+ const { domRows: e } = n;
1135
+ for (let o = 0; o < e.length; o++) {
1136
+ const r = e[o];
1137
+ if (r) for (let s = 0; s < r.length; s++) {
1138
+ const l = r[s];
1139
+ if (!l) continue;
1140
+ const i = rt(l.elem);
1141
+ i !== null && t(l, i, { x: s, y: o });
1142
+ }
1143
+ }
1144
+ }
1145
+ function Ne(n, t) {
1146
+ t.$disableHighlightStyle(), ae(t.table, ((e) => {
1147
+ e.highlighted = !0, We(n, e);
1148
+ }));
1149
+ }
1150
+ const Xn = (n, t, e, o, r) => {
1151
+ const s = r === "forward";
1152
+ switch (r) {
1153
+ case "backward":
1154
+ case "forward":
1155
+ return e !== (s ? n.table.columns - 1 : 0) ? Kt(t.getCellNodeFromCordsOrThrow(e + (s ? 1 : -1), o, n.table), s) : o !== (s ? n.table.rows - 1 : 0) ? Kt(t.getCellNodeFromCordsOrThrow(s ? 0 : n.table.columns - 1, o + (s ? 1 : -1), n.table), s) : s ? t.selectNext() : t.selectPrevious(), !0;
1156
+ case "up":
1157
+ return o !== 0 ? Kt(t.getCellNodeFromCordsOrThrow(e, o - 1, n.table), !1) : t.selectPrevious(), !0;
1158
+ case "down":
1159
+ return o !== n.table.rows - 1 ? Kt(t.getCellNodeFromCordsOrThrow(e, o + 1, n.table), !0) : t.selectNext(), !0;
1160
+ default:
1161
+ return !1;
1162
+ }
1163
+ };
1164
+ function Jt(n, t) {
1165
+ let e, o;
1166
+ if (t.startColumn === n.minColumn) e = "minColumn";
1167
+ else {
1168
+ if (t.startColumn + t.cell.__colSpan - 1 !== n.maxColumn) return null;
1169
+ e = "maxColumn";
1170
+ }
1171
+ if (t.startRow === n.minRow) o = "minRow";
1172
+ else {
1173
+ if (t.startRow + t.cell.__rowSpan - 1 !== n.maxRow) return null;
1174
+ o = "maxRow";
1175
+ }
1176
+ return [e, o];
1177
+ }
1178
+ function At([n, t]) {
1179
+ return [n === "minColumn" ? "maxColumn" : "minColumn", t === "minRow" ? "maxRow" : "minRow"];
1180
+ }
1181
+ function ht(n, t, [e, o]) {
1182
+ const r = t[o], s = n[r];
1183
+ s === void 0 && w(250, o, String(r));
1184
+ const l = t[e], i = s[l];
1185
+ return i === void 0 && w(250, e, String(l)), i;
1186
+ }
1187
+ function Vn(n, t, e, o, r) {
1188
+ const s = kt(t, e, o), l = (function(v, R) {
1189
+ const { minColumn: E, maxColumn: O, minRow: L, maxRow: F } = R;
1190
+ let K = 1, P = 1, B = 1, et = 1;
1191
+ const Ct = v[L], X = v[F];
1192
+ for (let H = E; H <= O; H++) K = Math.max(K, Ct[H].cell.__rowSpan), et = Math.max(et, X[H].cell.__rowSpan);
1193
+ for (let H = L; H <= F; H++) P = Math.max(P, v[H][E].cell.__colSpan), B = Math.max(B, v[H][O].cell.__colSpan);
1194
+ return { bottomSpan: et, leftSpan: P, rightSpan: B, topSpan: K };
1195
+ })(t, s), { topSpan: i, leftSpan: u, bottomSpan: f, rightSpan: h } = l, p = (function(v, R) {
1196
+ const E = Jt(v, R);
1197
+ return E === null && w(249, R.cell.getKey()), E;
1198
+ })(s, e), [_, a] = At(p);
1199
+ let c = s[_], g = s[a];
1200
+ r === "forward" ? c += _ === "maxColumn" ? 1 : u : r === "backward" ? c -= _ === "minColumn" ? 1 : h : r === "down" ? g += a === "maxRow" ? 1 : i : r === "up" && (g -= a === "minRow" ? 1 : f);
1201
+ const d = t[g];
1202
+ if (d === void 0) return !1;
1203
+ const m = d[c];
1204
+ if (m === void 0) return !1;
1205
+ const [C, S] = (function(v, R, E) {
1206
+ const O = kt(v, R, E), L = Jt(O, R);
1207
+ if (L) return [ht(v, O, L), ht(v, O, At(L))];
1208
+ const F = Jt(O, E);
1209
+ if (F) return [ht(v, O, At(F)), ht(v, O, F)];
1210
+ const K = ["minColumn", "minRow"];
1211
+ return [ht(v, O, K), ht(v, O, At(K))];
1212
+ })(t, e, m), N = st(n, C.cell), y = st(n, S.cell);
1213
+ return n.$setAnchorCellForSelection(N), n.$setFocusCellForSelection(y, !0), !0;
1214
+ }
1215
+ function Q(n, t) {
1216
+ if (M(n) || A(n)) {
1217
+ const e = t.isParentOf(n.anchor.getNode()), o = t.isParentOf(n.focus.getNode());
1218
+ return e && o;
1219
+ }
1220
+ return !1;
1221
+ }
1222
+ function Kt(n, t) {
1223
+ t ? n.selectStart() : n.selectEnd();
1224
+ }
1225
+ function We(n, t) {
1226
+ const e = t.elem, o = n._config.theme;
1227
+ b(rt(e)) || w(131), G(e, o.tableCellSelected);
1228
+ }
1229
+ function Pe(n, t) {
1230
+ const e = t.elem;
1231
+ b(rt(e)) || w(131);
1232
+ const o = n._config.theme;
1233
+ gt(e, o.tableCellSelected);
1234
+ }
1235
+ function bt(n) {
1236
+ const t = T(n, b);
1237
+ return b(t) ? t : null;
1238
+ }
1239
+ function pt(n) {
1240
+ const t = T(n, $);
1241
+ return $(t) ? t : null;
1242
+ }
1243
+ function jn(n, t, e, o, r, s, l) {
1244
+ const i = Tn(e.focus, r ? "previous" : "next");
1245
+ if (Rn(i)) return !1;
1246
+ let u = i;
1247
+ for (const d of fe(i).iterNodeCarets("shadowRoot")) {
1248
+ if (!Fn(d) || !D(d.origin)) return !1;
1249
+ u = d;
1250
+ }
1251
+ const f = u.getParentAtCaret();
1252
+ if (!b(f)) return !1;
1253
+ const h = f, p = (function(d) {
1254
+ for (const m of fe(d).iterNodeCarets("root")) {
1255
+ const { origin: C } = m;
1256
+ if (b(C)) {
1257
+ if (ge(m)) return An(C, d.direction);
1258
+ } else if (!k(C)) break;
1259
+ }
1260
+ return null;
1261
+ })(me(h, u.direction)), _ = T(h, $);
1262
+ if (!_ || !_.is(s)) return !1;
1263
+ const a = n.getElementByKey(h.getKey()), c = $t(a);
1264
+ if (!a || !c) return !1;
1265
+ const g = Qn(n, _);
1266
+ if (l.table = g, p) if (o === "extend") {
1267
+ const d = $t(n.getElementByKey(p.origin.getKey()));
1268
+ if (!d) return !1;
1269
+ l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(d, !0);
1270
+ } else {
1271
+ const d = pe(p);
1272
+ Rt(e.anchor, d), Rt(e.focus, d);
1273
+ }
1274
+ else if (o === "extend") l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(c, !0);
1275
+ else {
1276
+ const d = (function(m) {
1277
+ const C = Kn(m);
1278
+ return ge(C) ? pe(C) : m;
1279
+ })(me(_, i.direction));
1280
+ Rt(e.anchor, d), Rt(e.focus, d);
1281
+ }
1282
+ return tt(t), !0;
1283
+ }
1284
+ function He(n, t, e, o, r) {
1285
+ if ((e === "up" || e === "down") && (function(l) {
1286
+ const i = l.getRootElement();
1287
+ return i ? i.hasAttribute("aria-controls") && i.getAttribute("aria-controls") === "typeahead-menu" : !1;
1288
+ })(n)) return !1;
1289
+ const s = z();
1290
+ if (!Q(s, o)) {
1291
+ if (M(s)) {
1292
+ if (e === "backward") {
1293
+ if (s.focus.offset > 0) return !1;
1294
+ const l = (function(u) {
1295
+ for (let f = u, h = u; h !== null; f = h, h = h.getParent()) if (D(h)) {
1296
+ if (h !== f && h.getFirstChild() !== f) return null;
1297
+ if (!h.isInline()) return h;
1298
+ }
1299
+ return null;
1300
+ })(s.focus.getNode());
1301
+ if (!l) return !1;
1302
+ const i = l.getPreviousSibling();
1303
+ return !!$(i) && (tt(t), t.shiftKey ? s.focus.set(i.getParentOrThrow().getKey(), i.getIndexWithinParent(), "element") : i.selectEnd(), !0);
1304
+ }
1305
+ if (t.shiftKey && (e === "up" || e === "down")) {
1306
+ const l = s.focus.getNode();
1307
+ if (!s.isCollapsed() && (e === "up" && !s.isBackward() || e === "down" && s.isBackward())) {
1308
+ let i = T(l, ((_) => $(_)));
1309
+ if (b(i) && (i = T(i, $)), i !== o || !i) return !1;
1310
+ const u = e === "down" ? i.getNextSibling() : i.getPreviousSibling();
1311
+ if (!u) return !1;
1312
+ let f = 0;
1313
+ e === "up" && D(u) && (f = u.getChildrenSize());
1314
+ let h = u;
1315
+ e === "up" && D(u) && (h = u.getLastChild() || u, f = _t(h) ? h.getTextContentSize() : 0);
1316
+ const p = s.clone();
1317
+ return p.focus.set(h.getKey(), f, _t(h) ? "text" : "element"), nt(p), tt(t), !0;
1318
+ }
1319
+ if (xn(l)) {
1320
+ const i = e === "up" ? s.getNodes()[s.getNodes().length - 1] : s.getNodes()[0];
1321
+ if (i && vt(o, i) !== null) {
1322
+ const u = o.getFirstDescendant(), f = o.getLastDescendant();
1323
+ if (!u || !f) return !1;
1324
+ const [h] = I(u), [p] = I(f), _ = o.getCordsFromCellNode(h, r.table), a = o.getCordsFromCellNode(p, r.table), c = o.getDOMCellFromCordsOrThrow(_.x, _.y, r.table), g = o.getDOMCellFromCordsOrThrow(a.x, a.y, r.table);
1325
+ return r.$setAnchorCellForSelection(c), r.$setFocusCellForSelection(g, !0), !0;
1326
+ }
1327
+ return !1;
1328
+ }
1329
+ {
1330
+ let i = T(l, ((f) => D(f) && !f.isInline()));
1331
+ if (b(i) && (i = T(i, $)), !i) return !1;
1332
+ const u = e === "down" ? i.getNextSibling() : i.getPreviousSibling();
1333
+ if ($(u) && r.tableNodeKey === u.getKey()) {
1334
+ const f = u.getFirstDescendant(), h = u.getLastDescendant();
1335
+ if (!f || !h) return !1;
1336
+ const [p] = I(f), [_] = I(h), a = s.clone();
1337
+ return a.focus.set((e === "up" ? p : _).getKey(), e === "up" ? 0 : _.getChildrenSize(), "element"), tt(t), nt(a), !0;
1338
+ }
1339
+ }
1340
+ }
1341
+ }
1342
+ return e === "down" && te(n) && r.setShouldCheckSelection(), !1;
1343
+ }
1344
+ if (M(s)) {
1345
+ if (e === "backward" || e === "forward")
1346
+ return jn(n, t, s, t.shiftKey ? "extend" : "move", e === "backward", o, r);
1347
+ if (s.isCollapsed()) {
1348
+ const { anchor: l, focus: i } = s, u = T(l.getNode(), b), f = T(i.getNode(), b);
1349
+ if (!b(u) || !u.is(f)) return !1;
1350
+ const h = pt(u);
1351
+ if (h !== o && h != null) {
1352
+ const m = it(h, n.getElementByKey(h.getKey()));
1353
+ if (m != null) return r.table = mt(h, m), He(n, t, e, h, r);
1354
+ }
1355
+ const p = n.getElementByKey(u.__key), _ = n.getElementByKey(l.key);
1356
+ if (_ == null || p == null) return !1;
1357
+ let a;
1358
+ if (l.type === "element") a = _.getBoundingClientRect();
1359
+ else {
1360
+ const m = Mt(ie(n));
1361
+ if (m === null || m.rangeCount === 0) return !1;
1362
+ a = m.getRangeAt(0).getBoundingClientRect();
1363
+ }
1364
+ const c = e === "up" ? u.getFirstChild() : u.getLastChild();
1365
+ if (c == null) return !1;
1366
+ const g = n.getElementByKey(c.__key);
1367
+ if (g == null) return !1;
1368
+ const d = g.getBoundingClientRect();
1369
+ if (e === "up" ? d.top > a.top - a.height : a.bottom + a.height > d.bottom) {
1370
+ tt(t);
1371
+ const m = o.getCordsFromCellNode(u, r.table);
1372
+ if (!t.shiftKey) return Xn(r, o, m.x, m.y, e);
1373
+ {
1374
+ const C = o.getDOMCellFromCordsOrThrow(m.x, m.y, r.table);
1375
+ r.$setAnchorCellForSelection(C), r.$setFocusCellForSelection(C, !0);
1376
+ }
1377
+ return !0;
1378
+ }
1379
+ }
1380
+ } else if (A(s)) {
1381
+ const { anchor: l, focus: i } = s, u = T(l.getNode(), b), f = T(i.getNode(), b), [h] = s.getNodes();
1382
+ $(h) || w(251);
1383
+ const p = it(h, n.getElementByKey(h.getKey()));
1384
+ if (!b(u) || !b(f) || !$(h) || p == null) return !1;
1385
+ r.$updateTableTableSelection(s);
1386
+ const _ = mt(h, p), a = o.getCordsFromCellNode(u, _), c = o.getDOMCellFromCordsOrThrow(a.x, a.y, _);
1387
+ if (r.$setAnchorCellForSelection(c), tt(t), t.shiftKey) {
1388
+ const [g, d, m] = J(o, u, f);
1389
+ return Vn(r, g, d, m, e);
1390
+ }
1391
+ return f.selectEnd(), !0;
1392
+ }
1393
+ return !1;
1394
+ }
1395
+ function tt(n) {
1396
+ n.preventDefault(), n.stopImmediatePropagation(), n.stopPropagation();
1397
+ }
1398
+ function ve(n, t, e) {
1399
+ const o = U();
1400
+ n === "first" ? t.insertBefore(o) : t.insertAfter(o), o.append(...e || []), o.selectEnd();
1401
+ }
1402
+ function xe(n, t, e) {
1403
+ const o = e.getParent();
1404
+ if (!o) return;
1405
+ const r = Mt(ie(n));
1406
+ if (!r) return;
1407
+ const s = r.anchorNode, l = n.getElementByKey(o.getKey()), i = it(e, n.getElementByKey(e.getKey()));
1408
+ if (!s || !l || !i || !l.contains(s) || i.contains(s)) return;
1409
+ const u = T(t.anchor.getNode(), ((C) => b(C)));
1410
+ if (!u) return;
1411
+ const f = T(u, ((C) => $(C)));
1412
+ if (!$(f) || !f.is(e)) return;
1413
+ const [h, p] = J(e, u, u), _ = h[0][0], a = h[h.length - 1][h[0].length - 1], { startRow: c, startColumn: g } = p, d = c === _.startRow && g === _.startColumn, m = c === a.startRow && g === a.startColumn;
1414
+ return d ? "first" : m ? "last" : void 0;
1415
+ }
1416
+ function st(n, t) {
1417
+ const { tableNode: e } = n.$lookup(), o = e.getCordsFromCellNode(t, n.table);
1418
+ return e.getDOMCellFromCordsOrThrow(o.x, o.y, n.table);
1419
+ }
1420
+ function Gt(n, t, e) {
1421
+ return vt(n, rt(t, e));
1422
+ }
1423
+ function Te(n, t, e) {
1424
+ if (!t.theme.tableAlignment) return;
1425
+ const o = [], r = [];
1426
+ for (const s of ["center", "right"]) {
1427
+ const l = t.theme.tableAlignment[s];
1428
+ l && (s === e ? r : o).push(l);
1429
+ }
1430
+ gt(n, ...o), G(n, ...r);
1431
+ }
1432
+ const Zt = /* @__PURE__ */ new WeakSet();
1433
+ function te(n = Ae()) {
1434
+ return Zt.has(n);
1435
+ }
1436
+ function go(n, t) {
1437
+ t ? Zt.add(n) : Zt.delete(n);
1438
+ }
1439
+ class at extends ee {
1440
+ static getType() {
1441
+ return "table";
1442
+ }
1443
+ getColWidths() {
1444
+ return this.getLatest().__colWidths;
1445
+ }
1446
+ setColWidths(t) {
1447
+ const e = this.getWritable();
1448
+ return e.__colWidths = t, e;
1449
+ }
1450
+ static clone(t) {
1451
+ return new at(t.__key);
1452
+ }
1453
+ afterCloneFrom(t) {
1454
+ super.afterCloneFrom(t), this.__colWidths = t.__colWidths, this.__rowStriping = t.__rowStriping, this.__frozenColumnCount = t.__frozenColumnCount, this.__frozenRowCount = t.__frozenRowCount;
1455
+ }
1456
+ static importDOM() {
1457
+ return { table: (t) => ({ conversion: Gn, priority: 1 }) };
1458
+ }
1459
+ static importJSON(t) {
1460
+ return ce().updateFromJSON(t);
1461
+ }
1462
+ updateFromJSON(t) {
1463
+ return super.updateFromJSON(t).setRowStriping(t.rowStriping || !1).setFrozenColumns(t.frozenColumnCount || 0).setFrozenRows(t.frozenRowCount || 0).setColWidths(t.colWidths);
1464
+ }
1465
+ constructor(t) {
1466
+ super(t), this.__rowStriping = !1, this.__frozenColumnCount = 0, this.__frozenRowCount = 0;
1467
+ }
1468
+ exportJSON() {
1469
+ return { ...super.exportJSON(), colWidths: this.getColWidths(), frozenColumnCount: this.__frozenColumnCount ? this.__frozenColumnCount : void 0, frozenRowCount: this.__frozenRowCount ? this.__frozenRowCount : void 0, rowStriping: this.__rowStriping ? this.__rowStriping : void 0 };
1470
+ }
1471
+ extractWithChild(t, e, o) {
1472
+ return o === "html";
1473
+ }
1474
+ getDOMSlot(t) {
1475
+ const e = dt(t) ? t : t.querySelector("table");
1476
+ return dt(e) || w(229), super.getDOMSlot(t).withElement(e).withAfter(e.querySelector("colgroup"));
1477
+ }
1478
+ createDOM(t, e) {
1479
+ const o = document.createElement("table");
1480
+ this.__style && (o.style.cssText = this.__style);
1481
+ const r = document.createElement("colgroup");
1482
+ if (o.appendChild(r), tn(r), G(o, t.theme.table), this.updateTableElement(null, o, t), te(e)) {
1483
+ const s = document.createElement("div"), l = t.theme.tableScrollableWrapper;
1484
+ return l ? G(s, l) : s.style.cssText = "overflow-x: auto;", s.appendChild(o), this.updateTableWrapper(null, s, o, t), s;
1485
+ }
1486
+ return o;
1487
+ }
1488
+ updateTableWrapper(t, e, o, r) {
1489
+ this.__frozenColumnCount !== (t ? t.__frozenColumnCount : 0) && (function(s, l, i, u) {
1490
+ u > 0 ? (G(s, i.theme.tableFrozenColumn), l.setAttribute("data-lexical-frozen-column", "true")) : (gt(s, i.theme.tableFrozenColumn), l.removeAttribute("data-lexical-frozen-column"));
1491
+ })(e, o, r, this.__frozenColumnCount), this.__frozenRowCount !== (t ? t.__frozenRowCount : 0) && (function(s, l, i, u) {
1492
+ u > 0 ? (G(s, i.theme.tableFrozenRow), l.setAttribute("data-lexical-frozen-row", "true")) : (gt(s, i.theme.tableFrozenRow), l.removeAttribute("data-lexical-frozen-row"));
1493
+ })(e, o, r, this.__frozenRowCount);
1494
+ }
1495
+ updateTableElement(t, e, o) {
1496
+ this.__style !== (t ? t.__style : "") && (e.style.cssText = this.__style), this.__rowStriping !== (!!t && t.__rowStriping) && (function(r, s, l) {
1497
+ l ? (G(r, s.theme.tableRowStriping), r.setAttribute("data-lexical-row-striping", "true")) : (gt(r, s.theme.tableRowStriping), r.removeAttribute("data-lexical-row-striping"));
1498
+ })(e, o, this.__rowStriping), (function(r, s, l, i) {
1499
+ const u = r.querySelector("colgroup");
1500
+ if (!u) return;
1501
+ const f = [];
1502
+ for (let h = 0; h < l; h++) {
1503
+ const p = document.createElement("col"), _ = i && i[h];
1504
+ _ && (p.style.width = `${_}px`), f.push(p);
1505
+ }
1506
+ u.replaceChildren(...f);
1507
+ })(e, 0, this.getColumnCount(), this.getColWidths()), Te(e, o, this.getFormatType());
1508
+ }
1509
+ updateDOM(t, e, o) {
1510
+ const r = this.getDOMSlot(e).element;
1511
+ return e === r === te() || (Nt(s = e) && s.nodeName === "DIV" && this.updateTableWrapper(t, e, r, o), this.updateTableElement(t, r, o), !1);
1512
+ var s;
1513
+ }
1514
+ exportDOM(t) {
1515
+ const e = super.exportDOM(t), { element: o } = e;
1516
+ return { after: (r) => {
1517
+ if (e.after && (r = e.after(r)), !dt(r) && Nt(r) && (r = r.querySelector("table")), !dt(r)) return null;
1518
+ Te(r, t._config, this.getFormatType());
1519
+ const [s] = ot(this, null, null), l = /* @__PURE__ */ new Map();
1520
+ for (const h of s) for (const p of h) {
1521
+ const _ = p.cell.getKey();
1522
+ l.has(_) || l.set(_, { colSpan: p.cell.getColSpan(), startColumn: p.startColumn });
1523
+ }
1524
+ const i = /* @__PURE__ */ new Set();
1525
+ for (const h of r.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")) {
1526
+ const p = h.getAttribute("data-temporary-table-cell-lexical-key");
1527
+ if (p) {
1528
+ const _ = l.get(p);
1529
+ if (h.removeAttribute("data-temporary-table-cell-lexical-key"), _) {
1530
+ l.delete(p);
1531
+ for (let a = 0; a < _.colSpan; a++) i.add(a + _.startColumn);
1532
+ }
1533
+ }
1534
+ }
1535
+ const u = r.querySelector(":scope > colgroup");
1536
+ if (u) {
1537
+ const h = Array.from(r.querySelectorAll(":scope > colgroup > col")).filter(((p, _) => i.has(_)));
1538
+ u.replaceChildren(...h);
1539
+ }
1540
+ const f = r.querySelectorAll(":scope > tr");
1541
+ if (f.length > 0) {
1542
+ const h = document.createElement("tbody");
1543
+ for (const p of f) h.appendChild(p);
1544
+ r.append(h);
1545
+ }
1546
+ return r;
1547
+ }, element: !dt(o) && Nt(o) ? o.querySelector("table") : o };
1548
+ }
1549
+ canBeEmpty() {
1550
+ return !1;
1551
+ }
1552
+ isShadowRoot() {
1553
+ return !0;
1554
+ }
1555
+ getCordsFromCellNode(t, e) {
1556
+ const { rows: o, domRows: r } = e;
1557
+ for (let s = 0; s < o; s++) {
1558
+ const l = r[s];
1559
+ if (l != null) for (let i = 0; i < l.length; i++) {
1560
+ const u = l[i];
1561
+ if (u == null) continue;
1562
+ const { elem: f } = u, h = Gt(this, f);
1563
+ if (h !== null && t.is(h)) return { x: i, y: s };
1564
+ }
1565
+ }
1566
+ throw new Error("Cell not found in table.");
1567
+ }
1568
+ getDOMCellFromCords(t, e, o) {
1569
+ const { domRows: r } = o, s = r[e];
1570
+ if (s == null) return null;
1571
+ const l = s[t < s.length ? t : s.length - 1];
1572
+ return l ?? null;
1573
+ }
1574
+ getDOMCellFromCordsOrThrow(t, e, o) {
1575
+ const r = this.getDOMCellFromCords(t, e, o);
1576
+ if (!r) throw new Error("Cell not found at cords.");
1577
+ return r;
1578
+ }
1579
+ getCellNodeFromCords(t, e, o) {
1580
+ const r = this.getDOMCellFromCords(t, e, o);
1581
+ if (r == null) return null;
1582
+ const s = rt(r.elem);
1583
+ return b(s) ? s : null;
1584
+ }
1585
+ getCellNodeFromCordsOrThrow(t, e, o) {
1586
+ const r = this.getCellNodeFromCords(t, e, o);
1587
+ if (!r) throw new Error("Node at cords not TableCellNode.");
1588
+ return r;
1589
+ }
1590
+ getRowStriping() {
1591
+ return !!this.getLatest().__rowStriping;
1592
+ }
1593
+ setRowStriping(t) {
1594
+ const e = this.getWritable();
1595
+ return e.__rowStriping = t, e;
1596
+ }
1597
+ setFrozenColumns(t) {
1598
+ const e = this.getWritable();
1599
+ return e.__frozenColumnCount = t, e;
1600
+ }
1601
+ getFrozenColumns() {
1602
+ return this.getLatest().__frozenColumnCount;
1603
+ }
1604
+ setFrozenRows(t) {
1605
+ const e = this.getWritable();
1606
+ return e.__frozenRowCount = t, e;
1607
+ }
1608
+ getFrozenRows() {
1609
+ return this.getLatest().__frozenRowCount;
1610
+ }
1611
+ canSelectBefore() {
1612
+ return !0;
1613
+ }
1614
+ canIndent() {
1615
+ return !1;
1616
+ }
1617
+ getColumnCount() {
1618
+ const t = this.getFirstChild();
1619
+ if (!t) return 0;
1620
+ let e = 0;
1621
+ return t.getChildren().forEach(((o) => {
1622
+ b(o) && (e += o.getColSpan());
1623
+ })), e;
1624
+ }
1625
+ }
1626
+ function Qn(n, t) {
1627
+ const e = n.getElementByKey(t.getKey());
1628
+ return e === null && w(230), mt(t, e);
1629
+ }
1630
+ function Gn(n) {
1631
+ const t = ce();
1632
+ n.hasAttribute("data-lexical-row-striping") && t.setRowStriping(!0), n.hasAttribute("data-lexical-frozen-column") && t.setFrozenColumns(1), n.hasAttribute("data-lexical-frozen-row") && t.setFrozenRows(1);
1633
+ const e = n.querySelector(":scope > colgroup");
1634
+ if (e) {
1635
+ let o = [];
1636
+ for (const r of e.querySelectorAll(":scope > col")) {
1637
+ let s = r.style.width || "";
1638
+ if (!le.test(s) && (s = r.getAttribute("width") || "", !/^\d+$/.test(s))) {
1639
+ o = void 0;
1640
+ break;
1641
+ }
1642
+ o.push(parseFloat(s));
1643
+ }
1644
+ o && t.setColWidths(o);
1645
+ }
1646
+ return { after: (o) => Re(o, k), node: t };
1647
+ }
1648
+ function ce() {
1649
+ return ne(new at());
1650
+ }
1651
+ function $(n) {
1652
+ return n instanceof at;
1653
+ }
1654
+ function Zn({ rows: n, columns: t, includeHeaders: e }) {
1655
+ const o = z() || Ut();
1656
+ if (!o || !M(o) || pt(o.anchor.getNode())) return !1;
1657
+ const r = Ln(Number(n), Number(t), e);
1658
+ Qe(r);
1659
+ const s = r.getFirstDescendant();
1660
+ return _t(s) && s.select(), !0;
1661
+ }
1662
+ function to(n) {
1663
+ k(n.getParent()) ? n.isEmpty() && n.append(U()) : n.remove();
1664
+ }
1665
+ function eo(n) {
1666
+ $(n.getParent()) ? Fe(n, b) : n.remove();
1667
+ }
1668
+ function no(n) {
1669
+ Fe(n, k);
1670
+ const [t] = ot(n, null, null), e = t.reduce(((r, s) => Math.max(r, s.length)), 0), o = n.getChildren();
1671
+ for (let r = 0; r < t.length; ++r) {
1672
+ const s = o[r];
1673
+ if (!s) continue;
1674
+ k(s) || w(254, s.constructor.name, s.getType());
1675
+ const l = t[r].reduce(((i, u) => u ? 1 + i : i), 0);
1676
+ if (l !== e) for (let i = l; i < e; ++i) {
1677
+ const u = q();
1678
+ u.append(U()), s.append(u);
1679
+ }
1680
+ }
1681
+ }
1682
+ function oo(n) {
1683
+ if (n.detail < 3 || !yt(n.target)) return !1;
1684
+ const t = rt(n.target);
1685
+ if (t === null) return !1;
1686
+ const e = T(t, ((o) => D(o) && !o.isInline()));
1687
+ return e === null ? !1 : !!b(e.getParent()) && (e.select(0), !0);
1688
+ }
1689
+ function mo(n) {
1690
+ return n.registerNodeTransform(ct, ((t) => {
1691
+ if (t.getColSpan() > 1 || t.getRowSpan() > 1) {
1692
+ const [, , e] = I(t), [o] = J(e, t, t), r = o.length, s = o[0].length;
1693
+ let l = e.getFirstChild();
1694
+ k(l) || w(175);
1695
+ const i = [];
1696
+ for (let u = 0; u < r; u++) {
1697
+ u !== 0 && (l = l.getNextSibling(), k(l) || w(175));
1698
+ let f = null;
1699
+ for (let h = 0; h < s; h++) {
1700
+ const p = o[u][h], _ = p.cell;
1701
+ if (p.startRow === u && p.startColumn === h) f = _, i.push(_);
1702
+ else if (_.getColSpan() > 1 || _.getRowSpan() > 1) {
1703
+ b(_) || w(176);
1704
+ const a = q(_.__headerState);
1705
+ f !== null ? f.insertAfter(a) : je(l, a);
1706
+ }
1707
+ }
1708
+ }
1709
+ for (const u of i) u.setColSpan(1), u.setRowSpan(1);
1710
+ }
1711
+ }));
1712
+ }
1713
+ function po(n, t = !0) {
1714
+ const e = /* @__PURE__ */ new Map(), o = (s, l, i) => {
1715
+ const u = it(s, i), f = qn(s, u, n, t);
1716
+ e.set(l, [f, u]);
1717
+ }, r = n.registerMutationListener(at, ((s) => {
1718
+ n.getEditorState().read((() => {
1719
+ for (const [l, i] of s) {
1720
+ const u = e.get(l);
1721
+ if (i === "created" || i === "updated") {
1722
+ const { tableNode: f, tableElement: h } = ze(l);
1723
+ u === void 0 ? o(f, l, h) : h !== u[1] && (u[0].removeListeners(), e.delete(l), o(f, l, h));
1724
+ } else i === "destroyed" && u !== void 0 && (u[0].removeListeners(), e.delete(l));
1725
+ }
1726
+ }), { editor: n });
1727
+ }), { skipInitialization: !1 });
1728
+ return () => {
1729
+ r();
1730
+ for (const [, [s]] of e) s.removeListeners();
1731
+ };
1732
+ }
1733
+ function _o(n) {
1734
+ return n.hasNodes([at]) || w(255), Ve(n.registerCommand(kn, Zn, Dt), n.registerCommand(Ke, (({ nodes: t, selection: e }, o) => n !== o || !M(e) ? !1 : pt(e.anchor.getNode()) !== null && t.some($)), Dt), n.registerCommand(rn, oo, Dt), n.registerNodeTransform(at, no), n.registerNodeTransform(Tt, eo), n.registerNodeTransform(ct, to));
1735
+ }
1736
+ export {
1737
+ co as B,
1738
+ k as E,
1739
+ $e as H,
1740
+ xt as K,
1741
+ Ln as L,
1742
+ $t as M,
1743
+ Tt as O,
1744
+ ao as P,
1745
+ b as R,
1746
+ mo as S,
1747
+ pt as V,
1748
+ io as W,
1749
+ uo as Y,
1750
+ ho as a,
1751
+ at as b,
1752
+ it as c,
1753
+ go as d,
1754
+ _o as e,
1755
+ ot as h,
1756
+ fo as n,
1757
+ te as s,
1758
+ q as v,
1759
+ po as w,
1760
+ ct as y,
1761
+ ke as z
1762
+ };
1763
+ //# sourceMappingURL=LexicalTable.prod-DJktN6jF.js.map