@mx-space/cli 0.7.8 → 0.8.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 (55) hide show
  1. package/dist/{Lexical.dev-rcxzwpir.mjs → Lexical.dev-By5dOKBN.mjs} +1486 -356
  2. package/dist/{Lexical.node-BUsI9gWr.mjs → Lexical.node-fXM8Jp7p.mjs} +39 -17
  3. package/dist/{Lexical.prod-C8HtkSD6.mjs → Lexical.prod-BlCvXPGa.mjs} +2279 -1768
  4. package/dist/LexicalClipboard.dev--HxGoSkO.mjs +915 -0
  5. package/dist/{LexicalClipboard.node-CO-MCKx5.mjs → LexicalClipboard.node-C3mRbrmW.mjs} +10 -3
  6. package/dist/LexicalClipboard.prod-DNJzFMcT.mjs +371 -0
  7. package/dist/LexicalCodeCore.dev-DjSrd4A4.mjs +1109 -0
  8. package/dist/LexicalCodeCore.prod-DTDShkR3.mjs +642 -0
  9. package/dist/{LexicalDragon.dev-gBP8WSRS.mjs → LexicalDragon.dev-DwprRH0z.mjs} +3 -3
  10. package/dist/{LexicalDragon.node-OG6G55nl.mjs → LexicalDragon.node-BVhw4C7s.mjs} +2 -2
  11. package/dist/{LexicalDragon.prod-DP-_Q8cv.mjs → LexicalDragon.prod-nh4J-8vn.mjs} +3 -3
  12. package/dist/{LexicalExtension.dev-DVbjljrm.mjs → LexicalExtension.dev-BPNyvGqe.mjs} +335 -6
  13. package/dist/{LexicalExtension.node-CF3EAPN7.mjs → LexicalExtension.node-BVlcrgOx.mjs} +15 -8
  14. package/dist/{LexicalExtension.prod-DklHHErZ.mjs → LexicalExtension.prod-DFKbiNt-.mjs} +375 -265
  15. package/dist/{LexicalHeadless.dev-DdWLM7Nl.mjs → LexicalHeadless.dev-B-cj7Pr5.mjs} +2 -2
  16. package/dist/{LexicalHeadless.prod-CoiiTDzR.mjs → LexicalHeadless.prod-Byp1vNzT.mjs} +2 -2
  17. package/dist/LexicalHtml.dev-prBAwszN.mjs +2424 -0
  18. package/dist/LexicalHtml.node-BvNF96jZ.mjs +56 -0
  19. package/dist/LexicalHtml.prod-Sz3CW1ht.mjs +1207 -0
  20. package/dist/{LexicalLink.dev-BS1Bf-yD.mjs → LexicalLink.dev-NySTYhVR.mjs} +42 -8
  21. package/dist/{LexicalLink.prod-B_crkoHP.mjs → LexicalLink.prod-BuCM8gts.mjs} +209 -191
  22. package/dist/{LexicalList.dev-OMqmcnQ-.mjs → LexicalList.dev-DIMOvSFD.mjs} +252 -80
  23. package/dist/{LexicalList.prod-CpL1s8vS.mjs → LexicalList.prod-MVqfA6Vo.mjs} +364 -278
  24. package/dist/{LexicalMarkdown.dev-BHSdx_Gr.mjs → LexicalMarkdown.dev-C7aylvCG.mjs} +729 -552
  25. package/dist/LexicalMarkdown.prod-CfQSM406.mjs +868 -0
  26. package/dist/{LexicalRichText.dev-Bz9A_WbM.mjs → LexicalRichText.dev-DfICq6lU.mjs} +272 -77
  27. package/dist/{LexicalRichText.node-DDpwfE-P.mjs → LexicalRichText.node-Bg9jND3Q.mjs} +21 -8
  28. package/dist/LexicalRichText.prod-GsFzCK-o.mjs +550 -0
  29. package/dist/{LexicalSelection.dev-CQ380fnD.mjs → LexicalSelection.dev-DGjj12wW.mjs} +50 -38
  30. package/dist/{LexicalSelection.node-DesBMjIE.mjs → LexicalSelection.node-BU5L4193.mjs} +4 -4
  31. package/dist/{LexicalSelection.prod-D2jivCDB.mjs → LexicalSelection.prod-D-PwRbyK.mjs} +158 -140
  32. package/dist/{LexicalTable.dev-Ca7mQ7Jk.mjs → LexicalTable.dev-ChP7cugd.mjs} +215 -53
  33. package/dist/{LexicalTable.prod-DyPAcC7y.mjs → LexicalTable.prod-Bpr9YRXp.mjs} +668 -573
  34. package/dist/{LexicalUtils.dev-HxM8F0g6.mjs → LexicalUtils.dev-BiFU3789.mjs} +10 -47
  35. package/dist/{LexicalUtils.node-lCWjRjoG.mjs → LexicalUtils.node-j3Llm7Y3.mjs} +2 -2
  36. package/dist/{LexicalUtils.prod-Bti5w4ki.mjs → LexicalUtils.prod-DCvrA78p.mjs} +103 -105
  37. package/dist/bin/mxs.d.mts +1 -1
  38. package/dist/bin/mxs.mjs +1 -1
  39. package/dist/esm-By7trG9K.mjs +2 -0
  40. package/dist/{esm-CK9m5JKX.mjs → esm-Dg-WhPCe.mjs} +989 -989
  41. package/dist/index.d.mts +1 -1
  42. package/dist/index.mjs +1 -1
  43. package/dist/{mxs-BZt1cLW9.mjs → mxs-DT0oYk6U.mjs} +11935 -11866
  44. package/package.json +15 -14
  45. package/dist/LexicalClipboard.dev-BpqRwTLP.mjs +0 -494
  46. package/dist/LexicalClipboard.prod-B_xdeiAC.mjs +0 -291
  47. package/dist/LexicalCodeCore.dev-7_cexm39.mjs +0 -537
  48. package/dist/LexicalCodeCore.prod-Bd6WFHcO.mjs +0 -381
  49. package/dist/LexicalHtml.dev-C3ZSWBFZ.mjs +0 -684
  50. package/dist/LexicalHtml.node-D0TD152E.mjs +0 -24
  51. package/dist/LexicalHtml.prod-CX47X0zl.mjs +0 -430
  52. package/dist/LexicalMarkdown.prod-C-S7Ii6-.mjs +0 -754
  53. package/dist/LexicalRichText.prod-C8qXACDL.mjs +0 -427
  54. package/dist/esm-DRbkkY3r.mjs +0 -2
  55. /package/dist/{mxs-CM8-6uAr.d.mts → mxs-iqJBopvE.d.mts} +0 -0
@@ -1,8 +1,9 @@
1
- import { c as signal, r as effect, s as namedSignals } from "./LexicalExtension.node-CF3EAPN7.mjs";
2
- import { $n as safeCast, At as COMMAND_PRIORITY_LOW, B as $getSiblingCaret, Bn as isCurrentlyReadOnlyMode, D as $getChildCaret, F as $getNodeByKeyOrThrow, Ft as DELETE_CHARACTER_COMMAND, Gn as isHTMLElement, Gt as FORMAT_TEXT_COMMAND, Hn as isDOMNode, Ht as ElementNode, It as DELETE_LINE_COMMAND, K as $isChildCaret, L as $getPreviousSelection, Lt as DELETE_WORD_COMMAND, Mn as defineExtension, N as $getNearestNodeFromDOMNode, Nn as getDOMSelection, Nt as CUT_COMMAND, On as createCommand, Ot as COMMAND_PRIORITY_EDITOR, P as $getNodeByKey, R as $getRoot, Sn as TEXT_TYPE_TO_FORMAT, Tt as CLICK_COMMAND, Ut as FOCUS_COMMAND, Wt as FORMAT_ELEMENT_COMMAND, X as $isExtendableTextPointCaret, Y as $isElementNode, Z as $isInlineElementOrDecoratorNode, Zt as INSERT_PARAGRAPH_COMMAND, _ as $createTextNode, _n as SELECTION_CHANGE_COMMAND, _t as $setPointFromCaret, an as KEY_DELETE_COMMAND, at as $isRootOrShadowRoot, b as $getAdjacentChildCaret, ct as $isTextNode, dt as $normalizeCaret, en as KEY_ARROW_DOWN_COMMAND, er as setDOMStyleFromCSS, et as $isLineBreakNode, f as $createParagraphNode, ft as $normalizeSelection__EXPERIMENTAL, h as $createRangeSelectionFromDom, in as KEY_BACKSPACE_COMMAND, it as $isRootNode, j as $getEditor, jt as CONTROLLED_TEXT_INSERTION_COMMAND, kt as COMMAND_PRIORITY_HIGH, ln as KEY_TAB_COMMAND, m as $createRangeSelection, n as $applyNodeReplacement, nn as KEY_ARROW_RIGHT_COMMAND, nt as $isParagraphNode, ot as $isSiblingCaret, p as $createPoint, r as $caretFromPoint, rn as KEY_ARROW_UP_COMMAND, rt as $isRangeSelection, sn as KEY_ESCAPE_COMMAND, tn as KEY_ARROW_LEFT_COMMAND, tr as setDOMUnmanaged, v as $extendCaretToRange, vn as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, vt as $setSelection, yn as SELECT_ALL_COMMAND, z as $getSelection } from "./Lexical.node-BUsI9gWr.mjs";
3
- import { _ as removeClassNamesFromElement, c as $insertNodeToNearestRoot, d as addClassNamesToElement, g as objectKlassEquals, h as mergeRegister, m as isHTMLElement$1, n as $dfs, r as $findMatchingParent, s as $insertFirst, t as $descendantsMatching, u as $unwrapAndFilterDescendants } from "./LexicalUtils.node-lCWjRjoG.mjs";
4
- import { a as copyToClipboard, t as $getClipboardDataFromSelection } from "./LexicalClipboard.node-CO-MCKx5.mjs";
5
- //#region ../../node_modules/.pnpm/@lexical+table@0.44.0/node_modules/@lexical/table/LexicalTable.prod.mjs
1
+ import { f as namedSignals, l as effect, p as signal } from "./LexicalExtension.node-BVlcrgOx.mjs";
2
+ import { $ as $isElementNode, $t as ElementNode, An as KEY_ARROW_UP_COMMAND, Bt as COMMAND_PRIORITY_LOW, Cn as IS_STRIKETHROUGH, Cr as isHTMLTableRowElement, Ct as $setPointFromCaret, Dn as KEY_ARROW_DOWN_COMMAND, En as IS_UNDERLINE, F as $getEditor, H as $getRoot, Ht as CONTROLLED_TEXT_INSERTION_COMMAND, In as KEY_TAB_COMMAND, Jn as SELECT_ALL_COMMAND, Jt as DELETE_WORD_COMMAND, Kn as SELECTION_CHANGE_COMMAND, Kt as DELETE_CHARACTER_COMMAND, L as $getNearestNodeFromDOMNode, Mn as KEY_DELETE_COMMAND, Mr as setDOMStyleFromCSS, Nr as setDOMUnmanaged, On as KEY_ARROW_LEFT_COMMAND, Pn as KEY_ESCAPE_COMMAND, Pt as CLICK_COMMAND, Qn as TEXT_TYPE_TO_FORMAT, R as $getNodeByKey, Rt as COMMAND_PRIORITY_EDITOR, S as $getAdjacentChildCaret, Sr as isHTMLElement, U as $getSelection, V as $getPreviousSelection, W as $getSiblingCaret, Wt as CUT_COMMAND, X as $isChildCaret, _ as $createTextNode, b as $fullReconcile, cn as INSERT_PARAGRAPH_COMMAND, cr as defineExtension, ct as $isRootNode, en as FOCUS_COMMAND, et as $isExtendableTextPointCaret, f as $createParagraphNode, ft as $isTextNode, gr as isCurrentlyReadOnlyMode, gt as $normalizeSelection__EXPERIMENTAL, h as $createRangeSelectionFromDom, hn as IS_BOLD, ht as $normalizeCaret, ir as createCommand, it as $isLineBreakNode, jn as KEY_BACKSPACE_COMMAND, jr as safeCast, k as $getChildCaret, kn as KEY_ARROW_RIGHT_COMMAND, lr as getDOMSelection, lt as $isRootOrShadowRoot, m as $createRangeSelection, n as $applyNodeReplacement, nn as FORMAT_TEXT_COMMAND, ot as $isParagraphNode, p as $createPoint, qn as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, qt as DELETE_LINE_COMMAND, r as $caretFromPoint, rr as configExtension, st as $isRangeSelection, tn as FORMAT_ELEMENT_COMMAND, tt as $isInlineElementOrDecoratorNode, ut as $isSiblingCaret, v as $extendCaretToRange, vn as IS_FIREFOX, vr as isDOMNode, wt as $setSelection, xn as IS_ITALIC, z as $getNodeByKeyOrThrow, zt as COMMAND_PRIORITY_HIGH } from "./Lexical.node-fXM8Jp7p.mjs";
3
+ import { a as CoreImportExtension, d as ImportTextStyle, f as contextValue, g as sel, o as DOMImportExtension, p as defineImportRule, u as ImportTextFormat } from "./LexicalHtml.node-BvNF96jZ.mjs";
4
+ import { _ as removeClassNamesFromElement, c as $insertNodeToNearestRoot, d as addClassNamesToElement, g as objectKlassEquals, h as mergeRegister, m as isHTMLElement$1, n as $dfs, r as $findMatchingParent, s as $insertFirst, t as $descendantsMatching, u as $unwrapAndFilterDescendants } from "./LexicalUtils.node-j3Llm7Y3.mjs";
5
+ import { o as copyToClipboard, t as $getClipboardDataFromSelection } from "./LexicalClipboard.node-C3mRbrmW.mjs";
6
+ //#region ../../node_modules/.pnpm/@lexical+table@0.45.0/node_modules/@lexical/table/dist/LexicalTable.prod.mjs
6
7
  /**
7
8
  * Copyright (c) Meta Platforms, Inc. and affiliates.
8
9
  *
@@ -10,13 +11,13 @@ import { a as copyToClipboard, t as $getClipboardDataFromSelection } from "./Lex
10
11
  * LICENSE file in the root directory of this source tree.
11
12
  *
12
13
  */
13
- const Ke = /^(\d+(?:\.\d+)?)px$/, Ae = {
14
+ const Je = /^(\d+(?:\.\d+)?)px$/, Xe = {
14
15
  BOTH: 3,
15
16
  COLUMN: 2,
16
17
  NO_STATUS: 0,
17
18
  ROW: 1
18
19
  };
19
- var Ee = class Ee extends ElementNode {
20
+ var Ye = class Ye extends ElementNode {
20
21
  __colSpan;
21
22
  __rowSpan;
22
23
  __headerState;
@@ -27,7 +28,7 @@ var Ee = class Ee extends ElementNode {
27
28
  return "tablecell";
28
29
  }
29
30
  static clone(e) {
30
- return new Ee(e.__headerState, e.__colSpan, e.__width, e.__key);
31
+ return new Ye(e.__headerState, e.__colSpan, e.__width, e.__key);
31
32
  }
32
33
  afterCloneFrom(e) {
33
34
  super.afterCloneFrom(e), this.__rowSpan = e.__rowSpan, this.__backgroundColor = e.__backgroundColor, this.__verticalAlign = e.__verticalAlign, this.__colSpan = e.__colSpan, this.__headerState = e.__headerState, this.__width = e.__width;
@@ -35,27 +36,27 @@ var Ee = class Ee extends ElementNode {
35
36
  static importDOM() {
36
37
  return {
37
38
  td: (e) => ({
38
- conversion: Me,
39
+ conversion: je,
39
40
  priority: 0
40
41
  }),
41
42
  th: (e) => ({
42
- conversion: Me,
43
+ conversion: je,
43
44
  priority: 0
44
45
  })
45
46
  };
46
47
  }
47
48
  static importJSON(e) {
48
- return $e().updateFromJSON(e);
49
+ return Ve().updateFromJSON(e);
49
50
  }
50
51
  updateFromJSON(e) {
51
52
  return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan || 1).setRowSpan(e.rowSpan || 1).setWidth(e.width || void 0).setBackgroundColor(e.backgroundColor || null).setVerticalAlign(e.verticalAlign || void 0);
52
53
  }
53
- constructor(e = Ae.NO_STATUS, t = 1, n, o) {
54
+ constructor(e = Xe.NO_STATUS, t = 1, n, o) {
54
55
  super(o), this.__colSpan = t, this.__rowSpan = 1, this.__headerState = e, this.__width = n, this.__backgroundColor = null, this.__verticalAlign = void 0;
55
56
  }
56
57
  createDOM(t) {
57
58
  const n = document.createElement(this.getTag());
58
- return this.__width && (n.style.width = `${this.__width}px`), this.__colSpan > 1 && (n.colSpan = this.__colSpan), this.__rowSpan > 1 && (n.rowSpan = this.__rowSpan), null !== this.__backgroundColor && (n.style.backgroundColor = this.__backgroundColor), ke(this.__verticalAlign) && (n.style.verticalAlign = this.__verticalAlign), addClassNamesToElement(n, t.theme.tableCell, this.hasHeader() && t.theme.tableCellHeader), n;
59
+ return this.__width && (n.style.width = `${this.__width}px`), this.__colSpan > 1 && (n.colSpan = this.__colSpan), this.__rowSpan > 1 && (n.rowSpan = this.__rowSpan), null !== this.__backgroundColor && (n.style.backgroundColor = this.__backgroundColor), qe(this.__verticalAlign) && (n.style.verticalAlign = this.__verticalAlign), addClassNamesToElement(n, t.theme.tableCell, this.hasHeader() && t.theme.tableCellHeader), n;
59
60
  }
60
61
  exportDOM(e) {
61
62
  const t = super.exportDOM(e);
@@ -68,7 +69,7 @@ var Ee = class Ee extends ElementNode {
68
69
  exportJSON() {
69
70
  return {
70
71
  ...super.exportJSON(),
71
- ...ke(this.__verticalAlign) && { verticalAlign: this.__verticalAlign },
72
+ ...qe(this.__verticalAlign) && { verticalAlign: this.__verticalAlign },
72
73
  backgroundColor: this.getBackgroundColor(),
73
74
  colSpan: this.__colSpan,
74
75
  headerState: this.__headerState,
@@ -93,7 +94,7 @@ var Ee = class Ee extends ElementNode {
93
94
  getTag() {
94
95
  return this.hasHeader() ? "th" : "td";
95
96
  }
96
- setHeaderStyles(e, t = Ae.BOTH) {
97
+ setHeaderStyles(e, t = Xe.BOTH) {
97
98
  const n = this.getWritable();
98
99
  return n.__headerState = e & t | n.__headerState & ~t, n;
99
100
  }
@@ -129,7 +130,7 @@ var Ee = class Ee extends ElementNode {
129
130
  return (this.getHeaderStyles() & e) === e;
130
131
  }
131
132
  hasHeader() {
132
- return this.getLatest().__headerState !== Ae.NO_STATUS;
133
+ return this.getLatest().__headerState !== Xe.NO_STATUS;
133
134
  }
134
135
  updateDOM(e) {
135
136
  return e.__headerState !== this.__headerState || e.__width !== this.__width || e.__colSpan !== this.__colSpan || e.__rowSpan !== this.__rowSpan || e.__backgroundColor !== this.__backgroundColor || e.__verticalAlign !== this.__verticalAlign;
@@ -147,29 +148,29 @@ var Ee = class Ee extends ElementNode {
147
148
  return !1;
148
149
  }
149
150
  };
150
- function ke(e) {
151
+ function qe(e) {
151
152
  return "middle" === e || "bottom" === e;
152
153
  }
153
- function Me(e) {
154
+ function je(e) {
154
155
  const t = e, n = e.nodeName.toLowerCase();
155
156
  let o;
156
- Ke.test(t.style.width) && (o = parseFloat(t.style.width));
157
- let r = Ae.NO_STATUS;
157
+ Je.test(t.style.width) && (o = parseFloat(t.style.width));
158
+ let r = Xe.NO_STATUS;
158
159
  if ("th" === n) {
159
160
  const e = t.getAttribute("scope");
160
- if ("col" === e) r = Ae.COLUMN;
161
- else if ("row" === e) r = Ae.ROW;
161
+ if ("col" === e) r = Xe.COLUMN;
162
+ else if ("row" === e) r = Xe.ROW;
162
163
  else {
163
164
  const e = t.parentElement, n = isHTMLElement(e) && "tr" === e.nodeName.toLowerCase() && isHTMLElement(e.parentElement) && ("thead" === e.parentElement.nodeName.toLowerCase() || 0 === e.rowIndex), o = 0 === t.cellIndex;
164
- n && (r |= Ae.ROW), o && (r |= Ae.COLUMN), r === Ae.NO_STATUS && (r = Ae.ROW);
165
+ n && (r |= Xe.ROW), o && (r |= Xe.COLUMN), r === Xe.NO_STATUS && (r = Xe.ROW);
165
166
  }
166
167
  }
167
- const l = $e(r, t.colSpan, o);
168
+ const l = Ve(r, t.colSpan, o);
168
169
  l.__rowSpan = t.rowSpan;
169
170
  const s = t.style.backgroundColor;
170
171
  "" !== s && (l.__backgroundColor = s);
171
172
  const i = t.style.verticalAlign;
172
- ke(i) && (l.__verticalAlign = i);
173
+ qe(i) && (l.__verticalAlign = i);
173
174
  const c = t.style, a = (c && c.textDecoration || "").split(" "), u = "700" === c.fontWeight || "bold" === c.fontWeight, h = a.includes("line-through"), C = "italic" === c.fontStyle, _ = a.includes("underline"), S = c.color;
174
175
  return {
175
176
  after: (e) => {
@@ -193,38 +194,38 @@ function Me(e) {
193
194
  node: l
194
195
  };
195
196
  }
196
- function $e(e = Ae.NO_STATUS, t = 1, n) {
197
- return $applyNodeReplacement(new Ee(e, t, n));
197
+ function Ve(e = Xe.NO_STATUS, t = 1, n) {
198
+ return $applyNodeReplacement(new Ye(e, t, n));
198
199
  }
199
- function We(e) {
200
- return e instanceof Ee;
200
+ function Ge(e) {
201
+ return e instanceof Ye;
201
202
  }
202
- const ze = createCommand("INSERT_TABLE_COMMAND");
203
- function Le(e, ...t) {
203
+ const Qe = createCommand("INSERT_TABLE_COMMAND");
204
+ function Ze(e, ...t) {
204
205
  const n = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
205
206
  o.append("code", e);
206
207
  for (const e of t) o.append("v", e);
207
208
  throw n.search = o.toString(), Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
208
209
  }
209
- var He = class He extends ElementNode {
210
+ var et = class et extends ElementNode {
210
211
  __height;
211
212
  static getType() {
212
213
  return "tablerow";
213
214
  }
214
215
  static clone(e) {
215
- return new He(e.__height, e.__key);
216
+ return new et(e.__height, e.__key);
216
217
  }
217
218
  afterCloneFrom(e) {
218
219
  super.afterCloneFrom(e), this.__height = e.__height;
219
220
  }
220
221
  static importDOM() {
221
222
  return { tr: (e) => ({
222
- conversion: Be,
223
+ conversion: tt,
223
224
  priority: 0
224
225
  }) };
225
226
  }
226
227
  static importJSON(e) {
227
- return Pe().updateFromJSON(e);
228
+ return nt().updateFromJSON(e);
228
229
  }
229
230
  updateFromJSON(e) {
230
231
  return super.updateFromJSON(e).setHeight(e.height);
@@ -266,58 +267,57 @@ var He = class He extends ElementNode {
266
267
  return !1;
267
268
  }
268
269
  };
269
- function Be(e) {
270
+ function tt(e) {
270
271
  const n = e;
271
272
  let o;
272
- return Ke.test(n.style.height) && (o = parseFloat(n.style.height)), {
273
- after: (e) => $descendantsMatching(e, We),
274
- node: Pe(o)
273
+ return Je.test(n.style.height) && (o = parseFloat(n.style.height)), {
274
+ after: (e) => $descendantsMatching(e, Ge),
275
+ node: nt(o)
275
276
  };
276
277
  }
277
- function Pe(e) {
278
- return $applyNodeReplacement(new He(e));
278
+ function nt(e) {
279
+ return $applyNodeReplacement(new et(e));
279
280
  }
280
- function De(e) {
281
- return e instanceof He;
281
+ function ot(e) {
282
+ return e instanceof et;
282
283
  }
283
- const Ie = "undefined" != typeof window && void 0 !== window.document && void 0 !== window.document.createElement, Ue = Ie && "documentMode" in document ? document.documentMode : null, Je = Ie && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
284
- function Xe(e, t, n = !0) {
285
- const o = Fn();
284
+ function rt(e, t, n = !0) {
285
+ const o = Hn();
286
286
  for (let r = 0; r < e; r++) {
287
- const e = Pe();
287
+ const e = nt();
288
288
  for (let o = 0; o < t; o++) {
289
- let t = Ae.NO_STATUS;
290
- "object" == typeof n ? (0 === r && n.rows && (t |= Ae.ROW), 0 === o && n.columns && (t |= Ae.COLUMN)) : n && (0 === r && (t |= Ae.ROW), 0 === o && (t |= Ae.COLUMN));
291
- const l = $e(t), s = $createParagraphNode();
289
+ let t = Xe.NO_STATUS;
290
+ "object" == typeof n ? (0 === r && n.rows && (t |= Xe.ROW), 0 === o && n.columns && (t |= Xe.COLUMN)) : n && (0 === r && (t |= Xe.ROW), 0 === o && (t |= Xe.COLUMN));
291
+ const l = Ve(t), s = $createParagraphNode();
292
292
  s.append($createTextNode()), l.append(s), e.append(l);
293
293
  }
294
294
  o.append(e);
295
295
  }
296
296
  return o;
297
297
  }
298
- function Ye(e) {
299
- const t = $findMatchingParent(e, (e) => We(e));
300
- return We(t) ? t : null;
298
+ function lt(e) {
299
+ const t = $findMatchingParent(e, (e) => Ge(e));
300
+ return Ge(t) ? t : null;
301
301
  }
302
- function qe(e) {
303
- const t = $findMatchingParent(e, (e) => De(e));
304
- if (De(t)) return t;
302
+ function st(e) {
303
+ const t = $findMatchingParent(e, (e) => ot(e));
304
+ if (ot(t)) return t;
305
305
  throw new Error("Expected table cell to be inside of table row.");
306
306
  }
307
- function je(e) {
308
- const t = $findMatchingParent(e, (e) => Rn(e));
309
- if (Rn(t)) return t;
307
+ function it(e) {
308
+ const t = $findMatchingParent(e, (e) => Bn(e));
309
+ if (Bn(t)) return t;
310
310
  throw new Error("Expected table cell to be inside of table.");
311
311
  }
312
- function Ve(e) {
313
- const t = qe(e);
314
- return je(t).getChildren().findIndex((e) => e.is(t));
312
+ function ct(e) {
313
+ const t = st(e);
314
+ return it(t).getChildren().findIndex((e) => e.is(t));
315
315
  }
316
- function Ge(e) {
317
- return qe(e).getChildren().findIndex((t) => t.is(e));
316
+ function at(e) {
317
+ return st(e).getChildren().findIndex((t) => t.is(e));
318
318
  }
319
- function Qe(e, t) {
320
- const n = je(e), { x: o, y: r } = n.getCordsFromCellNode(e, t);
319
+ function ut(e, t) {
320
+ const n = it(e), { x: o, y: r } = n.getCordsFromCellNode(e, t);
321
321
  return {
322
322
  above: n.getCellNodeFromCords(o, r - 1, t),
323
323
  below: n.getCellNodeFromCords(o, r + 1, t),
@@ -325,82 +325,81 @@ function Qe(e, t) {
325
325
  right: n.getCellNodeFromCords(o + 1, r, t)
326
326
  };
327
327
  }
328
- function Ze(e, t) {
328
+ function ht(e, t) {
329
329
  const n = e.getChildren();
330
330
  if (t >= n.length || t < 0) throw new Error("Expected table cell to be inside of table row.");
331
331
  return n[t].remove(), e;
332
332
  }
333
- function et(e, t, n = !0, o, r) {
333
+ function dt(e, t, n = !0, o, r) {
334
334
  const l = e.getChildren();
335
335
  if (t >= l.length || t < 0) throw new Error("Table row target index out of range");
336
336
  const s = l[t];
337
- if (!De(s)) throw new Error("Row before insertion index does not exist.");
337
+ if (!ot(s)) throw new Error("Row before insertion index does not exist.");
338
338
  for (let e = 0; e < o; e++) {
339
- const e = s.getChildren(), t = e.length, o = Pe();
339
+ const e = s.getChildren(), t = e.length, o = nt();
340
340
  for (let n = 0; n < t; n++) {
341
341
  const t = e[n];
342
- We(t) || Le(12);
343
- const { above: l, below: s } = Qe(t, r);
344
- let i = Ae.NO_STATUS;
342
+ Ge(t) || Ze(12);
343
+ const { above: l, below: s } = ut(t, r);
344
+ let i = Xe.NO_STATUS;
345
345
  const c = l && l.getWidth() || s && s.getWidth() || void 0;
346
- (l && l.hasHeaderState(Ae.COLUMN) || s && s.hasHeaderState(Ae.COLUMN)) && (i |= Ae.COLUMN);
347
- const a = $e(i, 1, c);
346
+ (l && l.hasHeaderState(Xe.COLUMN) || s && s.hasHeaderState(Xe.COLUMN)) && (i |= Xe.COLUMN);
347
+ const a = Ve(i, 1, c);
348
348
  a.append($createParagraphNode()), o.append(a);
349
349
  }
350
350
  n ? s.insertAfter(o) : s.insertBefore(o);
351
351
  }
352
352
  return e;
353
353
  }
354
- Ie && "InputEvent" in window && !Ue && new window.InputEvent("input");
355
- const tt = (e, t) => e === Ae.BOTH || e === t ? t : Ae.NO_STATUS;
356
- function nt(e = !0) {
354
+ const ft = (e, t) => e === Xe.BOTH || e === t ? t : Xe.NO_STATUS;
355
+ function gt(e = !0) {
357
356
  const t = $getSelection();
358
- $isRangeSelection(t) || Ot(t) || Le(188);
359
- const n = t.anchor.getNode(), o = t.focus.getNode(), [r] = yt(n), [l, , s] = yt(o), [, i, c] = wt(s, l, r), { startRow: a } = c, { startRow: u } = i;
360
- return e ? rt(a + r.__rowSpan > u + l.__rowSpan ? r : l, !0) : rt(u < a ? l : r, !1);
357
+ $isRangeSelection(t) || Pt(t) || Ze(188);
358
+ const n = t.anchor.getNode(), o = t.focus.getNode(), [r] = Mt(n), [l, , s] = Mt(o), [, i, c] = Et(s, l, r), { startRow: a } = c, { startRow: u } = i;
359
+ return e ? pt(a + r.__rowSpan > u + l.__rowSpan ? r : l, !0) : pt(u < a ? l : r, !1);
361
360
  }
362
- const ot = nt;
363
- function rt(e, t = !0) {
364
- const [, , n] = yt(e), [o, r] = wt(n, e, e), l = o[0].length, { startRow: s } = r;
361
+ const mt = gt;
362
+ function pt(e, t = !0) {
363
+ const [, , n] = Mt(e), [o, r] = Et(n, e, e), l = o[0].length, { startRow: s } = r;
365
364
  let i = null;
366
365
  if (t) {
367
- const t = s + e.__rowSpan - 1, r = o[t], c = Pe();
366
+ const t = s + e.__rowSpan - 1, r = o[t], c = nt();
368
367
  for (let e = 0; e < l; e++) {
369
368
  const { cell: n, startRow: o } = r[e];
370
369
  if (o + n.__rowSpan - 1 <= t) {
371
- const t = r[e].cell.__headerState, n = tt(t, Ae.COLUMN);
372
- c.append($e(n).append($createParagraphNode()));
370
+ const t = r[e].cell.__headerState, n = ft(t, Xe.COLUMN);
371
+ c.append(Ve(n).append($createParagraphNode()));
373
372
  } else n.setRowSpan(n.__rowSpan + 1);
374
373
  }
375
374
  const a = n.getChildAtIndex(t);
376
- De(a) || Le(256), a.insertAfter(c), i = c;
375
+ ot(a) || Ze(256), a.insertAfter(c), i = c;
377
376
  } else {
378
- const e = s, t = o[e], r = Pe();
377
+ const e = s, t = o[e], r = nt();
379
378
  for (let n = 0; n < l; n++) {
380
379
  const { cell: o, startRow: l } = t[n];
381
380
  if (l === e) {
382
- const e = t[n].cell.__headerState, o = tt(e, Ae.COLUMN);
383
- r.append($e(o).append($createParagraphNode()));
381
+ const e = t[n].cell.__headerState, o = ft(e, Xe.COLUMN);
382
+ r.append(Ve(o).append($createParagraphNode()));
384
383
  } else o.setRowSpan(o.__rowSpan + 1);
385
384
  }
386
385
  const c = n.getChildAtIndex(e);
387
- De(c) || Le(257), c.insertBefore(r), i = r;
386
+ ot(c) || Ze(257), c.insertBefore(r), i = r;
388
387
  }
389
388
  return i;
390
389
  }
391
- function lt(e, t, n = !0, o, r) {
390
+ function Ct(e, t, n = !0, o, r) {
392
391
  const l = e.getChildren(), s = [];
393
392
  for (let e = 0; e < l.length; e++) {
394
393
  const n = l[e];
395
- if (De(n)) for (let e = 0; e < o; e++) {
394
+ if (ot(n)) for (let e = 0; e < o; e++) {
396
395
  const e = n.getChildren();
397
396
  if (t >= e.length || t < 0) throw new Error("Table column target index out of range");
398
397
  const o = e[t];
399
- We(o) || Le(12);
400
- const { left: l, right: i } = Qe(o, r);
401
- let c = Ae.NO_STATUS;
402
- (l && l.hasHeaderState(Ae.ROW) || i && i.hasHeaderState(Ae.ROW)) && (c |= Ae.ROW);
403
- const a = $e(c);
398
+ Ge(o) || Ze(12);
399
+ const { left: l, right: i } = ut(o, r);
400
+ let c = Xe.NO_STATUS;
401
+ (l && l.hasHeaderState(Xe.ROW) || i && i.hasHeaderState(Xe.ROW)) && (c |= Xe.ROW);
402
+ const a = Ve(c);
404
403
  a.append($createParagraphNode()), s.push({
405
404
  newTableCell: a,
406
405
  targetCell: o
@@ -411,30 +410,30 @@ function lt(e, t, n = !0, o, r) {
411
410
  n ? t.insertAfter(e) : t.insertBefore(e);
412
411
  }), e;
413
412
  }
414
- function st(e = !0) {
413
+ function _t(e = !0) {
415
414
  const t = $getSelection();
416
- $isRangeSelection(t) || Ot(t) || Le(188);
417
- const n = t.anchor.getNode(), o = t.focus.getNode(), [r] = yt(n), [l, , s] = yt(o), [, i, c] = wt(s, l, r), { startColumn: a } = c, { startColumn: u } = i;
418
- return e ? ct(a + r.__colSpan > u + l.__colSpan ? r : l, !0) : ct(u < a ? l : r, !1);
419
- }
420
- const it = st;
421
- function ct(e, t = !0, n = !0) {
422
- const [, , o] = yt(e), [r, l] = wt(o, e, e), s = r.length, { startColumn: i } = l, c = t ? i + e.__colSpan - 1 : i - 1, a = o.getFirstChild();
423
- De(a) || Le(120);
415
+ $isRangeSelection(t) || Pt(t) || Ze(188);
416
+ const n = t.anchor.getNode(), o = t.focus.getNode(), [r] = Mt(n), [l, , s] = Mt(o), [, i, c] = Et(s, l, r), { startColumn: a } = c, { startColumn: u } = i;
417
+ return e ? bt(a + r.__colSpan > u + l.__colSpan ? r : l, !0) : bt(u < a ? l : r, !1);
418
+ }
419
+ const St = _t;
420
+ function bt(e, t = !0, n = !0) {
421
+ const [, , o] = Mt(e), [r, l] = Et(o, e, e), s = r.length, { startColumn: i } = l, c = t ? i + e.__colSpan - 1 : i - 1, a = o.getFirstChild();
422
+ ot(a) || Ze(120);
424
423
  let u = null;
425
- function h(e = Ae.NO_STATUS) {
426
- const t = $e(e).append($createParagraphNode());
424
+ function h(e = Xe.NO_STATUS) {
425
+ const t = Ve(e).append($createParagraphNode());
427
426
  return null === u && (u = t), t;
428
427
  }
429
428
  let d = a;
430
429
  e: for (let e = 0; e < s; e++) {
431
430
  if (0 !== e) {
432
431
  const e = d.getNextSibling();
433
- De(e) || Le(121), d = e;
432
+ ot(e) || Ze(121), d = e;
434
433
  }
435
- const t = r[e], n = t[c < 0 ? 0 : c].cell.__headerState, o = tt(n, Ae.ROW);
434
+ const t = r[e], n = t[c < 0 ? 0 : c].cell.__headerState, o = ft(n, Xe.ROW);
436
435
  if (c < 0) {
437
- mt(d, h(o));
436
+ Ft(d, h(o));
438
437
  continue;
439
438
  }
440
439
  const { cell: l, startColumn: s, startRow: i } = t[c];
@@ -453,7 +452,7 @@ function ct(e, t = !0, n = !0) {
453
452
  n.insertAfter(h(o));
454
453
  } else l.setColSpan(l.__colSpan + 1);
455
454
  }
456
- null !== u && n && gt(u);
455
+ null !== u && n && Tt(u);
457
456
  const f = o.getColWidths();
458
457
  if (f) {
459
458
  const e = [...f], t = c < 0 ? 0 : c, n = e[t];
@@ -461,11 +460,11 @@ function ct(e, t = !0, n = !0) {
461
460
  }
462
461
  return u;
463
462
  }
464
- function at(e, t) {
463
+ function wt(e, t) {
465
464
  const n = e.getChildren();
466
465
  for (let e = 0; e < n.length; e++) {
467
466
  const o = n[e];
468
- if (De(o)) {
467
+ if (ot(o)) {
469
468
  const e = o.getChildren();
470
469
  if (t >= e.length || t < 0) throw new Error("Table column target index out of range");
471
470
  e[t].remove();
@@ -473,10 +472,10 @@ function at(e, t) {
473
472
  }
474
473
  return e;
475
474
  }
476
- function ut() {
475
+ function yt() {
477
476
  const e = $getSelection();
478
- $isRangeSelection(e) || Ot(e) || Le(188);
479
- const [t, n] = e.isBackward() ? [e.focus.getNode(), e.anchor.getNode()] : [e.anchor.getNode(), e.focus.getNode()], [o, , r] = yt(t), [l] = yt(n), [s, i, c] = wt(r, o, l), { startRow: a } = i, { startRow: u } = c, h = u + l.__rowSpan - 1;
477
+ $isRangeSelection(e) || Pt(e) || Ze(188);
478
+ const [t, n] = e.isBackward() ? [e.focus.getNode(), e.anchor.getNode()] : [e.anchor.getNode(), e.focus.getNode()], [o, , r] = Mt(t), [l] = Mt(n), [s, i, c] = Et(r, o, l), { startRow: a } = i, { startRow: u } = c, h = u + l.__rowSpan - 1;
480
479
  if (s.length === h - a + 1) return void r.remove();
481
480
  const d = s[0].length, f = s[h + 1], g = r.getChildAtIndex(h + 1);
482
481
  for (let e = h; e >= a; e--) {
@@ -488,32 +487,32 @@ function ut() {
488
487
  n.setRowSpan(n.__rowSpan - r);
489
488
  }
490
489
  if (o >= a && o + n.__rowSpan - 1 > h && e === h) {
491
- null === g && Le(122);
490
+ null === g && Ze(122);
492
491
  let o = null;
493
492
  for (let n = 0; n < t; n++) {
494
493
  const t = f[n], r = t.cell;
495
494
  t.startRow === e + 1 && (o = r), r.__colSpan > 1 && (n += r.__colSpan - 1);
496
495
  }
497
- null === o ? mt(g, n) : o.insertAfter(n);
496
+ null === o ? Ft(g, n) : o.insertAfter(n);
498
497
  }
499
498
  }
500
499
  }
501
500
  const t = r.getChildAtIndex(e);
502
- De(t) || Le(206, String(e)), t.remove();
501
+ ot(t) || Ze(206, String(e)), t.remove();
503
502
  }
504
503
  if (void 0 !== f) {
505
504
  const { cell: e } = f[0];
506
- gt(e);
505
+ Tt(e);
507
506
  } else {
508
507
  const { cell: t } = s[a - 1][0];
509
- gt(t);
508
+ Tt(t);
510
509
  }
511
510
  }
512
- const ht = ut;
513
- function dt() {
511
+ const Nt = yt;
512
+ function vt() {
514
513
  const e = $getSelection();
515
- $isRangeSelection(e) || Ot(e) || Le(188);
516
- const t = e.anchor.getNode(), n = e.focus.getNode(), [o, , r] = yt(t), [l] = yt(n), [s, i, c] = wt(r, o, l), { startColumn: a } = i, { startRow: u, startColumn: h } = c, d = Math.min(a, h), f = Math.max(a + o.__colSpan - 1, h + l.__colSpan - 1), g = f - d + 1;
514
+ $isRangeSelection(e) || Pt(e) || Ze(188);
515
+ const t = e.anchor.getNode(), n = e.focus.getNode(), [o, , r] = Mt(t), [l] = Mt(n), [s, i, c] = Et(r, o, l), { startColumn: a } = i, { startRow: u, startColumn: h } = c, d = Math.min(a, h), f = Math.max(a + o.__colSpan - 1, h + l.__colSpan - 1), g = f - d + 1;
517
516
  if (s[0].length === f - d + 1) return r.selectPrevious(), void r.remove();
518
517
  const m = s.length;
519
518
  for (let e = 0; e < m; e++) for (let t = d; t <= f; t++) {
@@ -533,10 +532,10 @@ function dt() {
533
532
  const p = s[u], C = a > h ? p[a + o.__colSpan] : p[h + l.__colSpan];
534
533
  if (void 0 !== C) {
535
534
  const { cell: e } = C;
536
- gt(e);
535
+ Tt(e);
537
536
  } else {
538
537
  const { cell: t } = h < a ? p[h - 1] : p[a - 1];
539
- gt(t);
538
+ Tt(t);
540
539
  }
541
540
  const _ = r.getColWidths();
542
541
  if (_) {
@@ -544,18 +543,18 @@ function dt() {
544
543
  e.splice(d, g), r.setColWidths(e);
545
544
  }
546
545
  }
547
- const ft = dt;
548
- function gt(e) {
546
+ const xt = vt;
547
+ function Tt(e) {
549
548
  const t = e.getFirstDescendant();
550
549
  null == t ? e.selectStart() : t.getParentOrThrow().selectStart();
551
550
  }
552
- function mt(e, t) {
551
+ function Ft(e, t) {
553
552
  const n = e.getFirstChild();
554
553
  null !== n ? n.insertBefore(t) : e.append(t);
555
554
  }
556
- function pt(e) {
555
+ function Rt(e) {
557
556
  if (0 === e.length) return null;
558
- const [n] = bt(je(e[0]), null, null);
557
+ const [n] = kt(it(e[0]), null, null);
559
558
  let o = Infinity, r = -Infinity, l = Infinity, s = -Infinity;
560
559
  const i = /* @__PURE__ */ new Set();
561
560
  for (const t of n) for (const n of t) {
@@ -579,63 +578,63 @@ function pt(e) {
579
578
  const r = o.cell, l = r.getKey();
580
579
  if (!d.has(l)) {
581
580
  d.add(l);
582
- Ct(r) || h.append(...r.getChildren()), r.remove();
581
+ Ot(r) || h.append(...r.getChildren()), r.remove();
583
582
  }
584
583
  }
585
584
  return 0 === h.getChildrenSize() && h.append($createParagraphNode()), h;
586
585
  }
587
- function Ct(e) {
586
+ function Ot(e) {
588
587
  if (1 !== e.getChildrenSize()) return !1;
589
588
  const t = e.getFirstChildOrThrow();
590
589
  return !(!$isParagraphNode(t) || !t.isEmpty());
591
590
  }
592
- function _t() {
591
+ function At() {
593
592
  const e = $getSelection();
594
- $isRangeSelection(e) || Ot(e) || Le(188);
595
- const o = $findMatchingParent(e.anchor.getNode(), We);
596
- return We(o) || Le(148), St(o);
593
+ $isRangeSelection(e) || Pt(e) || Ze(188);
594
+ const o = $findMatchingParent(e.anchor.getNode(), Ge);
595
+ return Ge(o) || Ze(148), Kt(o);
597
596
  }
598
- function St(e) {
599
- const [t, n, o] = yt(e), r = t.__colSpan, l = t.__rowSpan;
597
+ function Kt(e) {
598
+ const [t, n, o] = Mt(e), r = t.__colSpan, l = t.__rowSpan;
600
599
  if (1 === r && 1 === l) return;
601
- const [s, i] = wt(o, t, t), { startColumn: c, startRow: a } = i, u = t.__headerState & Ae.COLUMN, h = Array.from({ length: r }, (e, t) => {
600
+ const [s, i] = Et(o, t, t), { startColumn: c, startRow: a } = i, u = t.__headerState & Xe.COLUMN, h = Array.from({ length: r }, (e, t) => {
602
601
  let n = u;
603
602
  for (let e = 0; 0 !== n && e < s.length; e++) n &= s[e][t + c].cell.__headerState;
604
603
  return n;
605
- }), d = t.__headerState & Ae.ROW, f = Array.from({ length: l }, (e, t) => {
604
+ }), d = t.__headerState & Xe.ROW, f = Array.from({ length: l }, (e, t) => {
606
605
  let n = d;
607
606
  for (let e = 0; 0 !== n && e < s[0].length; e++) n &= s[t + a][e].cell.__headerState;
608
607
  return n;
609
608
  });
610
609
  if (r > 1) {
611
- for (let e = 1; e < r; e++) t.insertAfter($e(h[e] | f[0]).append($createParagraphNode()));
610
+ for (let e = 1; e < r; e++) t.insertAfter(Ve(h[e] | f[0]).append($createParagraphNode()));
612
611
  t.setColSpan(1);
613
612
  }
614
613
  if (l > 1) {
615
614
  let e;
616
615
  for (let t = 1; t < l; t++) {
617
616
  const o = a + t, l = s[o];
618
- e = (e || n).getNextSibling(), De(e) || Le(125);
617
+ e = (e || n).getNextSibling(), ot(e) || Ze(125);
619
618
  let i = null;
620
619
  for (let e = 0; e < c; e++) {
621
620
  const t = l[e], n = t.cell;
622
621
  t.startRow === o && (i = n), n.__colSpan > 1 && (e += n.__colSpan - 1);
623
622
  }
624
- if (null === i) for (let n = r - 1; n >= 0; n--) mt(e, $e(h[n] | f[t]).append($createParagraphNode()));
625
- else for (let e = r - 1; e >= 0; e--) i.insertAfter($e(h[e] | f[t]).append($createParagraphNode()));
623
+ if (null === i) for (let n = r - 1; n >= 0; n--) Ft(e, Ve(h[n] | f[t]).append($createParagraphNode()));
624
+ else for (let e = r - 1; e >= 0; e--) i.insertAfter(Ve(h[e] | f[t]).append($createParagraphNode()));
626
625
  }
627
626
  t.setRowSpan(1);
628
627
  }
629
628
  }
630
- function wt(e, t, n) {
631
- const [o, r, l] = bt(e, t, n);
632
- return null === r && Le(207), null === l && Le(208), [
629
+ function Et(e, t, n) {
630
+ const [o, r, l] = kt(e, t, n);
631
+ return null === r && Ze(207), null === l && Ze(208), [
633
632
  o,
634
633
  r,
635
634
  l
636
635
  ];
637
636
  }
638
- function bt(e, t, n) {
637
+ function kt(e, t, n) {
639
638
  const o = [];
640
639
  let r = null, l = null;
641
640
  function s(e) {
@@ -645,10 +644,10 @@ function bt(e, t, n) {
645
644
  const i = e.getChildren();
646
645
  for (let e = 0; e < i.length; e++) {
647
646
  const o = i[e];
648
- De(o) || Le(209);
647
+ ot(o) || Ze(209);
649
648
  const c = s(e);
650
649
  for (let a = o.getFirstChild(), u = 0; null != a; a = a.getNextSibling()) {
651
- for (We(a) || Le(147); void 0 !== c[u];) u++;
650
+ for (Ge(a) || Ze(147); void 0 !== c[u];) u++;
652
651
  const o = {
653
652
  cell: a,
654
653
  startColumn: u,
@@ -667,26 +666,26 @@ function bt(e, t, n) {
667
666
  l
668
667
  ];
669
668
  }
670
- function yt(e) {
669
+ function Mt(e) {
671
670
  let t;
672
- if (e instanceof Ee) t = e;
671
+ if (e instanceof Ye) t = e;
673
672
  else if ("__type" in e) {
674
- const o = $findMatchingParent(e, We);
675
- We(o) || Le(148), t = o;
673
+ const o = $findMatchingParent(e, Ge);
674
+ Ge(o) || Ze(148), t = o;
676
675
  } else {
677
- const o = $findMatchingParent(e.getNode(), We);
678
- We(o) || Le(148), t = o;
676
+ const o = $findMatchingParent(e.getNode(), Ge);
677
+ Ge(o) || Ze(148), t = o;
679
678
  }
680
679
  const o = t.getParent();
681
- De(o) || Le(149);
680
+ ot(o) || Ze(149);
682
681
  const r = o.getParent();
683
- return Rn(r) || Le(210), [
682
+ return Bn(r) || Ze(210), [
684
683
  t,
685
684
  o,
686
685
  r
687
686
  ];
688
687
  }
689
- function Nt(e, t, n) {
688
+ function $t(e, t, n) {
690
689
  let o, r = Math.min(t.startColumn, n.startColumn), l = Math.min(t.startRow, n.startRow), s = Math.max(t.startColumn + t.cell.__colSpan - 1, n.startColumn + n.cell.__colSpan - 1), i = Math.max(t.startRow + t.cell.__rowSpan - 1, n.startRow + n.cell.__rowSpan - 1);
691
690
  do {
692
691
  o = !1;
@@ -707,23 +706,23 @@ function Nt(e, t, n) {
707
706
  minRow: l
708
707
  };
709
708
  }
710
- function vt(e) {
709
+ function Wt(e) {
711
710
  const t = e.getChildren();
712
711
  let n = null;
713
712
  for (const e of t) {
714
- if (!De(e)) return !1;
713
+ if (!ot(e)) return !1;
715
714
  if (null === n && (n = e.getChildrenSize()), e.getChildrenSize() !== n) return !1;
716
715
  const t = e.getChildren();
717
- for (const e of t) if (!We(e) || 1 !== e.getRowSpan() || 1 !== e.getColSpan()) return !1;
716
+ for (const e of t) if (!Ge(e) || 1 !== e.getRowSpan() || 1 !== e.getColSpan()) return !1;
718
717
  }
719
718
  return (n || 0) > 0;
720
719
  }
721
- function xt(e, t, n) {
720
+ function zt(e, t, n) {
722
721
  if (t === n) return;
723
722
  const o = e.getColumnCount();
724
723
  if (t < 0 || t >= o || n < 0 || n >= o) return;
725
- if (!vt(e)) return;
726
- e.getChildren().filter(De).forEach((e) => {
724
+ if (!Wt(e)) return;
725
+ e.getChildren().filter(ot).forEach((e) => {
727
726
  const o = e.getChildren(), [r] = o.splice(t, 1);
728
727
  o.splice(n, 0, r), e.splice(0, o.length, o);
729
728
  });
@@ -733,8 +732,8 @@ function xt(e, t, n) {
733
732
  o.splice(n, 0, l), e.setColWidths(o);
734
733
  }
735
734
  }
736
- function Tt(e) {
737
- const [t, , n] = yt(e), o = n.getChildren(), r = o.length, l = o[0].getChildren().length, s = new Array(r);
735
+ function Lt(e) {
736
+ const [t, , n] = Mt(e), o = n.getChildren(), r = o.length, l = o[0].getChildren().length, s = new Array(r);
738
737
  for (let e = 0; e < r; e++) s[e] = new Array(l);
739
738
  for (let e = 0; e < r; e++) {
740
739
  const n = o[e].getChildren();
@@ -754,21 +753,21 @@ function Tt(e) {
754
753
  }
755
754
  return null;
756
755
  }
757
- function Ft(e) {
756
+ function Ht(e) {
758
757
  const [[t, o, r, l], [s, i, c, a]] = ["anchor", "focus"].map((t) => {
759
- const o = e[t].getNode(), r = $findMatchingParent(o, We);
760
- We(r) || Le(238, t, o.getKey(), o.getType());
758
+ const o = e[t].getNode(), r = $findMatchingParent(o, Ge);
759
+ Ge(r) || Ze(238, t, o.getKey(), o.getType());
761
760
  const l = r.getParent();
762
- De(l) || Le(239, t);
761
+ ot(l) || Ze(239, t);
763
762
  const s = l.getParent();
764
- return Rn(s) || Le(240, t), [
763
+ return Bn(s) || Ze(240, t), [
765
764
  o,
766
765
  r,
767
766
  l,
768
767
  s
769
768
  ];
770
769
  });
771
- return l.is(a) || Le(241), {
770
+ return l.is(a) || Ze(241), {
772
771
  anchorCell: o,
773
772
  anchorNode: t,
774
773
  anchorRow: r,
@@ -779,7 +778,7 @@ function Ft(e) {
779
778
  focusTable: a
780
779
  };
781
780
  }
782
- var Rt = class Rt {
781
+ var Bt = class Bt {
783
782
  tableKey;
784
783
  anchor;
785
784
  focus;
@@ -806,13 +805,13 @@ var Rt = class Rt {
806
805
  this._cachedNodes = e;
807
806
  }
808
807
  is(e) {
809
- return Ot(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
808
+ return Pt(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
810
809
  }
811
810
  set(e, t, n) {
812
811
  this.dirty = this.dirty || e !== this.tableKey || t !== this.anchor.key || n !== this.focus.key, this.tableKey = e, this.anchor.key = t, this.focus.key = n, this._cachedNodes = null;
813
812
  }
814
813
  clone() {
815
- return new Rt(this.tableKey, $createPoint(this.anchor.key, this.anchor.offset, this.anchor.type), $createPoint(this.focus.key, this.focus.offset, this.focus.type));
814
+ return new Bt(this.tableKey, $createPoint(this.anchor.key, this.anchor.offset, this.anchor.type), $createPoint(this.focus.key, this.focus.offset, this.focus.type));
816
815
  }
817
816
  isCollapsed() {
818
817
  return !1;
@@ -824,7 +823,7 @@ var Rt = class Rt {
824
823
  insertText() {}
825
824
  hasFormat(e) {
826
825
  let t = 0;
827
- this.getNodes().filter(We).forEach((e) => {
826
+ this.getNodes().filter(Ge).forEach((e) => {
828
827
  const n = e.getFirstChild();
829
828
  $isParagraphNode(n) && (t |= n.getTextFormat());
830
829
  });
@@ -833,14 +832,14 @@ var Rt = class Rt {
833
832
  }
834
833
  insertNodes(e) {
835
834
  const t = this.focus.getNode();
836
- $isElementNode(t) || Le(151);
835
+ $isElementNode(t) || Ze(151);
837
836
  $normalizeSelection__EXPERIMENTAL(t.select(0, t.getChildrenSize())).insertNodes(e);
838
837
  }
839
838
  getShape() {
840
- const { anchorCell: e, focusCell: t } = Ft(this), n = Tt(e);
841
- null === n && Le(153);
842
- const o = Tt(t);
843
- null === o && Le(155);
839
+ const { anchorCell: e, focusCell: t } = Ht(this), n = Lt(e);
840
+ null === n && Ze(153);
841
+ const o = Lt(t);
842
+ null === o && Ze(155);
844
843
  const r = Math.min(n.columnIndex, o.columnIndex), l = Math.max(n.columnIndex + n.colSpan - 1, o.columnIndex + o.colSpan - 1), s = Math.min(n.rowIndex, o.rowIndex), i = Math.max(n.rowIndex + n.rowSpan - 1, o.rowIndex + o.rowSpan - 1);
845
844
  return {
846
845
  fromX: Math.min(r, l),
@@ -853,22 +852,22 @@ var Rt = class Rt {
853
852
  if (!this.isValid()) return [];
854
853
  const e = this._cachedNodes;
855
854
  if (null !== e) return e;
856
- const { anchorTable: t, anchorCell: n, focusCell: o } = Ft(this), r = o.getParents()[1];
855
+ const { anchorTable: t, anchorCell: n, focusCell: o } = Ht(this), r = o.getParents()[1];
857
856
  if (r !== t) {
858
857
  if (t.isParentOf(o)) {
859
858
  const e = r.getParent();
860
- e ?? Le(159), this.set(this.tableKey, o.getKey(), e.getKey());
859
+ e ?? Ze(159), this.set(this.tableKey, o.getKey(), e.getKey());
861
860
  } else {
862
861
  const e = t.getParent();
863
- e ?? Le(158), this.set(this.tableKey, e.getKey(), o.getKey());
862
+ e ?? Ze(158), this.set(this.tableKey, e.getKey(), o.getKey());
864
863
  }
865
864
  return this.getNodes();
866
865
  }
867
- const [l, s, i] = wt(t, n, o), { minColumn: c, maxColumn: a, minRow: u, maxRow: h } = Nt(l, s, i), d = new Map([[t.getKey(), t]]);
866
+ const [l, s, i] = Et(t, n, o), { minColumn: c, maxColumn: a, minRow: u, maxRow: h } = $t(l, s, i), d = new Map([[t.getKey(), t]]);
868
867
  let f = null;
869
868
  for (let e = u; e <= h; e++) for (let t = c; t <= a; t++) {
870
869
  const { cell: n } = l[e][t], o = n.getParent();
871
- De(o) || Le(160), o !== f && (d.set(o.getKey(), o), f = o), d.has(n.getKey()) || Et(n, (e) => {
870
+ ot(o) || Ze(160), o !== f && (d.set(o.getKey(), o), f = o), d.has(n.getKey()) || Ut(n, (e) => {
872
871
  d.set(e.getKey(), e);
873
872
  });
874
873
  }
@@ -876,7 +875,7 @@ var Rt = class Rt {
876
875
  return isCurrentlyReadOnlyMode() || (this._cachedNodes = g), g;
877
876
  }
878
877
  getTextContent() {
879
- const e = this.getNodes().filter((e) => We(e));
878
+ const e = this.getNodes().filter((e) => Ge(e));
880
879
  let t = "";
881
880
  for (let n = 0; n < e.length; n++) {
882
881
  const o = e[n], r = o.__parent, l = (e[n + 1] || {}).__parent;
@@ -885,34 +884,34 @@ var Rt = class Rt {
885
884
  return t;
886
885
  }
887
886
  };
888
- function Ot(e) {
889
- return e instanceof Rt;
887
+ function Pt(e) {
888
+ return e instanceof Bt;
890
889
  }
891
- function Kt() {
892
- return new Rt("root", $createPoint("root", 0, "element"), $createPoint("root", 0, "element"));
890
+ function Dt() {
891
+ return new Bt("root", $createPoint("root", 0, "element"), $createPoint("root", 0, "element"));
893
892
  }
894
- function At(e, t, n) {
893
+ function It(e, t, n) {
895
894
  e.getKey(), t.getKey(), n.getKey();
896
- const o = $getSelection(), r = Ot(o) ? o.clone() : Kt();
895
+ const o = $getSelection(), r = Pt(o) ? o.clone() : Dt();
897
896
  return r.set(e.getKey(), t.getKey(), n.getKey()), r;
898
897
  }
899
- function Et(e, t) {
898
+ function Ut(e, t) {
900
899
  const n = [[e]];
901
900
  for (let e = n.at(-1); void 0 !== e && n.length > 0; e = n.at(-1)) {
902
901
  const o = e.pop();
903
902
  void 0 === o ? n.pop() : !1 !== t(o) && $isElementNode(o) && n.push(o.getChildren());
904
903
  }
905
904
  }
906
- function kt(e, t = $getEditor()) {
905
+ function Jt(e, t = $getEditor()) {
907
906
  const n = $getNodeByKey(e);
908
- Rn(n) || Le(231, e);
909
- const o = Lt(n, t.getElementByKey(e));
910
- return null === o && Le(232, e), {
907
+ Bn(n) || Ze(231, e);
908
+ const o = Vt(n, t.getElementByKey(e));
909
+ return null === o && Ze(232, e), {
911
910
  tableElement: o,
912
911
  tableNode: n
913
912
  };
914
913
  }
915
- var Mt = class {
914
+ var Xt = class {
916
915
  observers;
917
916
  nextFocus;
918
917
  shouldCheckSelectionForTable;
@@ -934,7 +933,7 @@ var Mt = class {
934
933
  return e ? (this.shouldCheckSelectionForTable = null, e) : null;
935
934
  }
936
935
  };
937
- var $t = class {
936
+ var Yt = class {
938
937
  focusX;
939
938
  focusY;
940
939
  listenersToRemove;
@@ -968,7 +967,7 @@ var $t = class {
968
967
  this.abortController.abort("removeListeners"), Array.from(this.listenersToRemove).forEach((e) => e()), this.listenersToRemove.clear();
969
968
  }
970
969
  $lookup() {
971
- return kt(this.tableNodeKey, this.editor);
970
+ return Jt(this.tableNodeKey, this.editor);
972
971
  }
973
972
  trackTable() {
974
973
  const e = new MutationObserver((e) => {
@@ -983,12 +982,12 @@ var $t = class {
983
982
  }
984
983
  if (!t) return;
985
984
  const { tableNode: n, tableElement: o } = this.$lookup();
986
- this.table = Gt(n, o);
985
+ this.table = un(n, o);
987
986
  }, { editor: this.editor });
988
987
  });
989
988
  this.editor.getEditorState().read(() => {
990
989
  const { tableNode: t, tableElement: n } = this.$lookup();
991
- this.table = Gt(t, n), e.observe(n, {
990
+ this.table = un(t, n), e.observe(n, {
992
991
  attributes: !0,
993
992
  childList: !0,
994
993
  subtree: !0
@@ -999,7 +998,7 @@ var $t = class {
999
998
  const t = this.editor;
1000
999
  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();
1001
1000
  const { tableNode: n, tableElement: o } = this.$lookup();
1002
- Qt(t, Gt(n, o), null), e && null !== $getSelection() && ($setSelection(null), t.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0));
1001
+ hn(t, un(n, o), null), e && null !== $getSelection() && ($setSelection(null), t.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0));
1003
1002
  }
1004
1003
  $enableHighlightStyle() {
1005
1004
  const e = this.editor, { tableElement: t } = this.$lookup();
@@ -1011,9 +1010,9 @@ var $t = class {
1011
1010
  }
1012
1011
  $updateTableTableSelection(e) {
1013
1012
  if (null !== e) {
1014
- e.tableKey !== this.tableNodeKey && Le(233, e.tableKey, this.tableNodeKey);
1013
+ e.tableKey !== this.tableNodeKey && Ze(233, e.tableKey, this.tableNodeKey);
1015
1014
  const t = this.editor;
1016
- this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), Qt(t, this.table, this.tableSelection);
1015
+ this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), hn(t, this.table, this.tableSelection);
1017
1016
  } else this.$clearHighlight();
1018
1017
  }
1019
1018
  updateDOMSelection() {
@@ -1027,12 +1026,12 @@ var $t = class {
1027
1026
  if (this.focusCell = e, !this.isHighlightingCells) (t || this.anchorX !== r || this.anchorY !== l || null != this.tableSelection && null != this.anchorCellNodeKey) && (this.isHighlightingCells = !0, this.$disableHighlightStyle());
1028
1027
  if (-1 !== this.focusX && -1 !== this.focusY && r === this.focusX && l === this.focusY) return !1;
1029
1028
  if (this.focusX = r, this.focusY = l, this.isHighlightingCells) {
1030
- const s = _n(o, e.elem);
1029
+ const s = An(o, e.elem);
1031
1030
  if (null != this.tableSelection && null != this.anchorCellNodeKey) {
1032
1031
  let e = s;
1033
1032
  if (null === e && t && (e = o.getCellNodeFromCords(r, l, this.table)), null !== e) {
1034
1033
  const t = this.$getAnchorTableCellOrThrow();
1035
- return this.focusCellNodeKey = e.getKey(), this.tableSelection = At(o, t, e), $setSelection(this.tableSelection), n.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0), Qt(n, this.table, this.tableSelection), !0;
1034
+ return this.focusCellNodeKey = e.getKey(), this.tableSelection = It(o, t, e), $setSelection(this.tableSelection), n.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0), hn(n, this.table, this.tableSelection), !0;
1036
1035
  }
1037
1036
  }
1038
1037
  }
@@ -1043,28 +1042,28 @@ var $t = class {
1043
1042
  }
1044
1043
  $getAnchorTableCellOrThrow() {
1045
1044
  const e = this.$getAnchorTableCell();
1046
- return null === e && Le(234), e;
1045
+ return null === e && Ze(234), e;
1047
1046
  }
1048
1047
  $getFocusTableCell() {
1049
1048
  return this.focusCellNodeKey ? $getNodeByKey(this.focusCellNodeKey) : null;
1050
1049
  }
1051
1050
  $getFocusTableCellOrThrow() {
1052
1051
  const e = this.$getFocusTableCell();
1053
- return null === e && Le(235), e;
1052
+ return null === e && Ze(235), e;
1054
1053
  }
1055
1054
  $setAnchorCellForSelection(e) {
1056
1055
  this.isHighlightingCells = !1, this.anchorCell = e, this.anchorX = e.x, this.anchorY = e.y, this.focusX = -1, this.focusY = -1, this.focusCell = null, this.focusCellNodeKey = null;
1057
- const { tableNode: t } = this.$lookup(), n = _n(t, e.elem);
1056
+ const { tableNode: t } = this.$lookup(), n = An(t, e.elem);
1058
1057
  if (null !== n) {
1059
1058
  const e = n.getKey();
1060
- null != this.tableSelection ? (this.tableSelection = this.tableSelection.clone(), this.tableSelection.set(t.getKey(), e, e)) : this.tableSelection = At(t, n, n), this.anchorCellNodeKey = e;
1059
+ null != this.tableSelection ? (this.tableSelection = this.tableSelection.clone(), this.tableSelection.set(t.getKey(), e, e)) : this.tableSelection = It(t, n, n), this.anchorCellNodeKey = e;
1061
1060
  }
1062
1061
  }
1063
1062
  $formatCells(e) {
1064
1063
  const t = $getSelection();
1065
- Ot(t) || Le(236);
1066
- const n = $createRangeSelection(), o = n.anchor, r = n.focus, l = t.getNodes().filter(We);
1067
- l.length > 0 || Le(237);
1064
+ Pt(t) || Ze(236);
1065
+ const n = $createRangeSelection(), o = n.anchor, r = n.focus, l = t.getNodes().filter(Ge);
1066
+ l.length > 0 || Ze(237);
1068
1067
  const s = l[0].getFirstChild(), i = $isParagraphNode(s) ? s.getFormatFlags(e, null) : null;
1069
1068
  l.forEach((t) => {
1070
1069
  o.set(t.getKey(), 0, "element"), r.set(t.getKey(), t.getChildrenSize(), "element"), n.formatText(e, i);
@@ -1072,11 +1071,11 @@ var $t = class {
1072
1071
  }
1073
1072
  $clearText() {
1074
1073
  const { editor: e } = this, t = $getNodeByKey(this.tableNodeKey);
1075
- if (!Rn(t)) throw new Error("Expected TableNode.");
1074
+ if (!Bn(t)) throw new Error("Expected TableNode.");
1076
1075
  const n = $getSelection();
1077
- Ot(n) || Le(253);
1078
- const o = n.getNodes().filter(We), r = t.getFirstChild(), l = t.getLastChild();
1079
- if (o.length > 0 && null !== r && null !== l && De(r) && De(l) && o[0] === r.getFirstChild() && o[o.length - 1] === l.getLastChild()) {
1076
+ Pt(n) || Ze(253);
1077
+ const o = n.getNodes().filter(Ge), r = t.getFirstChild(), l = t.getLastChild();
1078
+ if (o.length > 0 && null !== r && null !== l && ot(r) && ot(l) && o[0] === r.getFirstChild() && o[o.length - 1] === l.getLastChild()) {
1080
1079
  t.selectPrevious();
1081
1080
  const n = t.getParent();
1082
1081
  t.remove(), $isRootNode(n) && n.isEmpty() && e.dispatchCommand(INSERT_PARAGRAPH_COMMAND, void 0);
@@ -1089,165 +1088,168 @@ var $t = class {
1089
1088
  e !== t && e.remove();
1090
1089
  });
1091
1090
  }
1092
- }), Qt(e, this.table, null), $setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0);
1091
+ }), hn(e, this.table, null), $setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0);
1093
1092
  }
1094
1093
  };
1095
- const Wt = "__lexicalTableSelection";
1096
- function zt(e) {
1094
+ const qt = "__lexicalTableSelection";
1095
+ function jt(e) {
1097
1096
  return isHTMLElement(e) && "TABLE" === e.nodeName;
1098
1097
  }
1099
- function Lt(e, t) {
1098
+ function Vt(e, t) {
1100
1099
  if (!t) return t;
1101
- const n = zt(t) ? t : t.querySelector("table");
1102
- return zt(n) || Le(341, e.constructor.name, e.getType(), e.getKey(), t.nodeName), n;
1100
+ const n = jt(t) ? t : t.querySelector("table");
1101
+ return jt(n) || Ze(341, e.constructor.name, e.getType(), e.getKey(), t.nodeName), n;
1103
1102
  }
1104
- function Ht(e) {
1103
+ function Gt(e) {
1105
1104
  return e._window;
1106
1105
  }
1107
- function Bt(e, t) {
1106
+ function Qt(e, t) {
1108
1107
  for (let n = t, o = null; null !== n; n = n.getParent()) {
1109
1108
  if (e.is(n)) return o;
1110
- We(n) && (o = n);
1109
+ Ge(n) && (o = n);
1111
1110
  }
1112
1111
  return null;
1113
1112
  }
1114
- const Pt = [
1113
+ const Zt = [
1115
1114
  [KEY_ARROW_DOWN_COMMAND, "down"],
1116
1115
  [KEY_ARROW_UP_COMMAND, "up"],
1117
1116
  [KEY_ARROW_LEFT_COMMAND, "backward"],
1118
1117
  [KEY_ARROW_RIGHT_COMMAND, "forward"]
1119
- ], Dt = [
1118
+ ], en = [
1120
1119
  DELETE_WORD_COMMAND,
1121
1120
  DELETE_LINE_COMMAND,
1122
1121
  DELETE_CHARACTER_COMMAND
1123
- ], It = [KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND];
1124
- function Ut(e, t) {
1125
- const n = e.getRootElement(), o = e._window;
1126
- if (!n || !o) return () => {};
1127
- const r = (o) => {
1128
- const r = o.target;
1129
- if (0 !== o.button || !isDOMNode(r) || !n.contains(r)) return;
1130
- const l = function(e) {
1131
- const t = jt(e);
1132
- if (null === t) return null;
1133
- let n = t.elem;
1134
- for (; null != n;) {
1135
- if ("TABLE" === n.nodeName && Wt in n && n[Wt]) return {
1136
- cellElement: t,
1137
- tableElement: n,
1138
- tableObserver: n[Wt]
1139
- };
1140
- n = n.parentNode;
1141
- }
1142
- return null;
1143
- }(r);
1144
- e.update(() => {
1145
- if (Ot($getSelection())) {
1146
- for (const [e] of t.observers.values()) e.$clearHighlight(!1);
1147
- $setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0);
1148
- }
1149
- if (!l) return;
1150
- const { tableObserver: n, tableElement: r, cellElement: s } = l;
1151
- (function(e, t, n, o, r, l) {
1152
- const s = e._window;
1153
- if (!s) return;
1154
- const i = (t) => {
1155
- if (r.isSelecting) return;
1156
- r.isSelecting = !0, null !== t && null === r.anchorCell && e.update(() => {
1157
- r.$setAnchorCellForSelection(t);
1158
- });
1159
- const n = () => {
1160
- r.isSelecting = !1, s.removeEventListener("pointerup", n), s.removeEventListener("pointermove", i);
1161
- }, i = (t) => {
1162
- if (!((e) => !(1 & ~e.buttons))(t) && r.isSelecting) return r.isSelecting = !1, s.removeEventListener("pointerup", n), void s.removeEventListener("pointermove", i);
1163
- if (!isDOMNode(t.target)) return;
1164
- let c = null;
1165
- const a = !(Je || o.contains(t.target));
1166
- if (a) c = Vt(o, t.target);
1167
- else for (const e of document.elementsFromPoint(t.clientX, t.clientY)) if (c = Vt(o, e), c) break;
1168
- if (c) {
1169
- const t = c;
1170
- null === r.anchorCell && e.update(() => {
1171
- r.$setAnchorCellForSelection(t);
1172
- }), null !== r.focusCell && c.elem === r.focusCell.elem || (l.setNextFocus({
1173
- focusCell: c,
1174
- override: a,
1175
- tableKey: r.tableNodeKey
1176
- }), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0));
1177
- }
1122
+ ], tn = [KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND];
1123
+ function nn(e, t) {
1124
+ return e.registerRootListener((n) => {
1125
+ if (null === n) return;
1126
+ const o = e._window;
1127
+ if (null === o) return;
1128
+ const r = (o) => {
1129
+ const r = o.target;
1130
+ if (0 !== o.button || !isDOMNode(r) || !n.contains(r)) return;
1131
+ const l = function(e) {
1132
+ const t = cn(e);
1133
+ if (null === t) return null;
1134
+ let n = t.elem;
1135
+ for (; null != n;) {
1136
+ if ("TABLE" === n.nodeName && qt in n && n[qt]) return {
1137
+ cellElement: t,
1138
+ tableElement: n,
1139
+ tableObserver: n[qt]
1178
1140
  };
1179
- s.addEventListener("pointerup", n, r.listenerOptions), s.addEventListener("pointermove", i, r.listenerOptions);
1180
- };
1181
- r.pointerType = t.pointerType;
1182
- const c = $getNodeByKeyOrThrow(r.tableNodeKey), a = $getPreviousSelection();
1183
- if (Je && t.shiftKey && ln(a, c) && ($isRangeSelection(a) || Ot(a))) {
1184
- const e = a.anchor.getNode(), o = Bt(c, a.anchor.getNode());
1185
- if (o) r.$setAnchorCellForSelection(Cn(r, o)), r.$setFocusCellForSelection(n), gn(t);
1186
- else (c.isBefore(e) ? c.selectStart() : c.selectEnd()).anchor.set(a.anchor.key, a.anchor.offset, a.anchor.type);
1187
- } else "touch" !== t.pointerType && r.$setAnchorCellForSelection(n);
1188
- i(n);
1189
- })(e, o, s, r, n, t);
1190
- });
1191
- };
1192
- return o.addEventListener("pointerdown", r), () => {
1193
- o.removeEventListener("pointerdown", r);
1194
- };
1141
+ n = n.parentNode;
1142
+ }
1143
+ return null;
1144
+ }(r);
1145
+ e.update(() => {
1146
+ if (Pt($getSelection())) {
1147
+ for (const [e] of t.observers.values()) e.$clearHighlight(!1);
1148
+ $setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0);
1149
+ }
1150
+ if (!l) return;
1151
+ const { tableObserver: n, tableElement: r, cellElement: s } = l;
1152
+ (function(e, t, n, o, r, l) {
1153
+ const s = e._window;
1154
+ if (!s) return;
1155
+ const i = (t) => {
1156
+ if (r.isSelecting) return;
1157
+ r.isSelecting = !0, null !== t && null === r.anchorCell && e.update(() => {
1158
+ r.$setAnchorCellForSelection(t);
1159
+ });
1160
+ const n = () => {
1161
+ r.isSelecting = !1, s.removeEventListener("pointerup", n), s.removeEventListener("pointermove", i);
1162
+ }, i = (t) => {
1163
+ if (!((e) => !(1 & ~e.buttons))(t) && r.isSelecting) return r.isSelecting = !1, s.removeEventListener("pointerup", n), void s.removeEventListener("pointermove", i);
1164
+ if (!isDOMNode(t.target)) return;
1165
+ let c = null;
1166
+ const a = !(IS_FIREFOX || o.contains(t.target));
1167
+ if (a) c = an(o, t.target);
1168
+ else for (const e of document.elementsFromPoint(t.clientX, t.clientY)) if (c = an(o, e), c) break;
1169
+ if (c) {
1170
+ const t = c;
1171
+ null === r.anchorCell && e.update(() => {
1172
+ r.$setAnchorCellForSelection(t);
1173
+ }), null !== r.focusCell && c.elem === r.focusCell.elem || (l.setNextFocus({
1174
+ focusCell: c,
1175
+ override: a,
1176
+ tableKey: r.tableNodeKey
1177
+ }), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0));
1178
+ }
1179
+ };
1180
+ s.addEventListener("pointerup", n, r.listenerOptions), s.addEventListener("pointermove", i, r.listenerOptions);
1181
+ };
1182
+ r.pointerType = t.pointerType;
1183
+ const c = $getNodeByKeyOrThrow(r.tableNodeKey), a = $getPreviousSelection();
1184
+ if (IS_FIREFOX && t.shiftKey && _n(a, c) && ($isRangeSelection(a) || Pt(a))) {
1185
+ const e = a.anchor.getNode(), o = Qt(c, a.anchor.getNode());
1186
+ if (o) r.$setAnchorCellForSelection(On(r, o)), r.$setFocusCellForSelection(n), Tn(t);
1187
+ else (c.isBefore(e) ? c.selectStart() : c.selectEnd()).anchor.set(a.anchor.key, a.anchor.offset, a.anchor.type);
1188
+ } else "touch" !== t.pointerType && r.$setAnchorCellForSelection(n);
1189
+ i(n);
1190
+ })(e, o, s, r, n, t);
1191
+ });
1192
+ };
1193
+ return o.addEventListener("pointerdown", r), () => {
1194
+ o.removeEventListener("pointerdown", r);
1195
+ };
1196
+ });
1195
1197
  }
1196
- function Jt(e, t, o, l, s) {
1197
- const i = o.getRootElement(), c = Ht(o);
1198
- null !== i && null !== c || Le(246);
1199
- const a = new $t(o, e.getKey()), u = Lt(e, t);
1198
+ function on(e, t, o, l, s) {
1199
+ const i = o.getRootElement(), c = Gt(o);
1200
+ null !== i && null !== c || Ze(246);
1201
+ const a = new Yt(o, e.getKey()), u = Vt(e, t);
1200
1202
  (function(e, t) {
1201
- null !== qt(e) && Le(205);
1202
- e[Wt] = t;
1203
+ null !== sn(e) && Ze(205);
1204
+ e[qt] = t;
1203
1205
  })(u, a), a.listenersToRemove.add(() => function(e, t) {
1204
- qt(e) === t && delete e[Wt];
1206
+ sn(e) === t && delete e[qt];
1205
1207
  }(u, a));
1206
1208
  const h = (e) => {
1207
- if (e.detail >= 3 && isDOMNode(e.target)) null !== jt(e.target) && e.preventDefault();
1209
+ if (e.detail >= 3 && isDOMNode(e.target)) null !== cn(e.target) && e.preventDefault();
1208
1210
  };
1209
1211
  u.addEventListener("mousedown", h, a.listenerOptions), a.listenersToRemove.add(() => {
1210
1212
  u.removeEventListener("mousedown", h);
1211
1213
  });
1212
- for (const [t, n] of Pt) a.listenersToRemove.add(o.registerCommand(t, (t) => fn(o, t, n, e, a, s), COMMAND_PRIORITY_HIGH));
1214
+ for (const [t, n] of Zt) a.listenersToRemove.add(o.registerCommand(t, (t) => xn(o, t, n, e, a, s), COMMAND_PRIORITY_HIGH));
1213
1215
  a.listenersToRemove.add(o.registerCommand(KEY_ESCAPE_COMMAND, (t) => {
1214
1216
  const n = $getSelection();
1215
- if (Ot(n)) {
1216
- const o = Bt(e, n.focus.getNode());
1217
- if (null !== o) return gn(t), o.selectEnd(), !0;
1217
+ if (Pt(n)) {
1218
+ const o = Qt(e, n.focus.getNode());
1219
+ if (null !== o) return Tn(t), o.selectEnd(), !0;
1218
1220
  }
1219
1221
  return !1;
1220
1222
  }, COMMAND_PRIORITY_HIGH));
1221
1223
  const d = (t) => () => {
1222
1224
  const o = $getSelection();
1223
- if (!ln(o, e)) return !1;
1224
- if (Ot(o)) return a.$clearText(), !0;
1225
+ if (!_n(o, e)) return !1;
1226
+ if (Pt(o)) return a.$clearText(), !0;
1225
1227
  if ($isRangeSelection(o)) {
1226
- if (!We(Bt(e, o.anchor.getNode()))) return !1;
1228
+ if (!Ge(Qt(e, o.anchor.getNode()))) return !1;
1227
1229
  const r = o.anchor.getNode(), l = o.focus.getNode(), s = e.isParentOf(r), i = e.isParentOf(l);
1228
1230
  if (s && !i || i && !s) return a.$clearText(), !0;
1229
- const c = $findMatchingParent(o.anchor.getNode(), (e) => $isElementNode(e)), u = c && $findMatchingParent(c, (e) => $isElementNode(e) && We(e.getParent()));
1231
+ const c = $findMatchingParent(o.anchor.getNode(), (e) => $isElementNode(e)), u = c && $findMatchingParent(c, (e) => $isElementNode(e) && Ge(e.getParent()));
1230
1232
  if (!$isElementNode(u) || !$isElementNode(c)) return !1;
1231
1233
  if (t === DELETE_LINE_COMMAND && null === u.getPreviousSibling()) return !0;
1232
1234
  }
1233
1235
  return !1;
1234
1236
  };
1235
- for (const e of Dt) a.listenersToRemove.add(o.registerCommand(e, d(e), COMMAND_PRIORITY_HIGH));
1237
+ for (const e of en) a.listenersToRemove.add(o.registerCommand(e, d(e), COMMAND_PRIORITY_HIGH));
1236
1238
  const f = (t) => {
1237
1239
  const n = $getSelection();
1238
- if (!Ot(n) && !$isRangeSelection(n)) return !1;
1240
+ if (!Pt(n) && !$isRangeSelection(n)) return !1;
1239
1241
  const o = e.isParentOf(n.anchor.getNode());
1240
1242
  if (o !== e.isParentOf(n.focus.getNode())) {
1241
1243
  const t = o ? "anchor" : "focus", r = o ? "focus" : "anchor", { key: l, offset: s, type: i } = n[r];
1242
1244
  return e[n[t].isBefore(n[r]) ? "selectPrevious" : "selectNext"]()[r].set(l, s, i), !1;
1243
1245
  }
1244
- return !!ln(n, e) && !!Ot(n) && (t && (t.preventDefault(), t.stopPropagation()), a.$clearText(), !0);
1246
+ return !!_n(n, e) && !!Pt(n) && (t && (t.preventDefault(), t.stopPropagation()), a.$clearText(), !0);
1245
1247
  };
1246
- for (const e of It) a.listenersToRemove.add(o.registerCommand(e, f, COMMAND_PRIORITY_HIGH));
1248
+ for (const e of tn) a.listenersToRemove.add(o.registerCommand(e, f, COMMAND_PRIORITY_HIGH));
1247
1249
  return a.listenersToRemove.add(o.registerCommand(CUT_COMMAND, (e) => {
1248
1250
  const t = $getSelection();
1249
1251
  if (t) {
1250
- if (!Ot(t) && !$isRangeSelection(t)) return !1;
1252
+ if (!Pt(t) && !$isRangeSelection(t)) return !1;
1251
1253
  copyToClipboard(o, objectKlassEquals(e, ClipboardEvent) ? e : null, $getClipboardDataFromSelection(t));
1252
1254
  const n = f(e);
1253
1255
  return $isRangeSelection(t) ? (t.removeText(), !0) : n;
@@ -1255,28 +1257,28 @@ function Jt(e, t, o, l, s) {
1255
1257
  return !1;
1256
1258
  }, COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(FORMAT_TEXT_COMMAND, (t) => {
1257
1259
  const o = $getSelection();
1258
- if (!ln(o, e)) return !1;
1259
- if (Ot(o)) return a.$formatCells(t), !0;
1260
+ if (!_n(o, e)) return !1;
1261
+ if (Pt(o)) return a.$formatCells(t), !0;
1260
1262
  if ($isRangeSelection(o)) {
1261
- if (!We($findMatchingParent(o.anchor.getNode(), (e) => We(e)))) return !1;
1263
+ if (!Ge($findMatchingParent(o.anchor.getNode(), (e) => Ge(e)))) return !1;
1262
1264
  }
1263
1265
  return !1;
1264
1266
  }, COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(FORMAT_ELEMENT_COMMAND, (t) => {
1265
1267
  const n = $getSelection();
1266
- if (!Ot(n) || !ln(n, e)) return !1;
1268
+ if (!Pt(n) || !_n(n, e)) return !1;
1267
1269
  const o = n.anchor.getNode(), r = n.focus.getNode();
1268
- if (!We(o) || !We(r)) return !1;
1270
+ if (!Ge(o) || !Ge(r)) return !1;
1269
1271
  if (function(e, t) {
1270
- if (Ot(e)) {
1272
+ if (Pt(e)) {
1271
1273
  const n = e.anchor.getNode(), o = e.focus.getNode();
1272
1274
  if (t && n && o) {
1273
- const [e] = wt(t, n, o);
1275
+ const [e] = Et(t, n, o);
1274
1276
  return n.getKey() === e[0][0].cell.getKey() && o.getKey() === e[e.length - 1].at(-1).cell.getKey();
1275
1277
  }
1276
1278
  }
1277
1279
  return !1;
1278
1280
  }(n, e)) return e.setFormat(t), !0;
1279
- const [l, s, i] = wt(e, o, r), c = Math.max(s.startRow + s.cell.__rowSpan - 1, i.startRow + i.cell.__rowSpan - 1), a = Math.max(s.startColumn + s.cell.__colSpan - 1, i.startColumn + i.cell.__colSpan - 1), u = Math.min(s.startRow, i.startRow), h = Math.min(s.startColumn, i.startColumn), d = /* @__PURE__ */ new Set();
1281
+ const [l, s, i] = Et(e, o, r), c = Math.max(s.startRow + s.cell.__rowSpan - 1, i.startRow + i.cell.__rowSpan - 1), a = Math.max(s.startColumn + s.cell.__colSpan - 1, i.startColumn + i.cell.__colSpan - 1), u = Math.min(s.startRow, i.startRow), h = Math.min(s.startColumn, i.startColumn), d = /* @__PURE__ */ new Set();
1280
1282
  for (let e = u; e <= c; e++) for (let n = h; n <= a; n++) {
1281
1283
  const o = l[e][n].cell;
1282
1284
  if (d.has(o)) continue;
@@ -1290,59 +1292,59 @@ function Jt(e, t, o, l, s) {
1290
1292
  return !0;
1291
1293
  }, COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(CONTROLLED_TEXT_INSERTION_COMMAND, (t) => {
1292
1294
  const r = $getSelection();
1293
- if (!ln(r, e)) return !1;
1294
- if (Ot(r)) return a.$clearHighlight(), !1;
1295
+ if (!_n(r, e)) return !1;
1296
+ if (Pt(r)) return a.$clearHighlight(), !1;
1295
1297
  if ($isRangeSelection(r)) {
1296
- if (!We($findMatchingParent(r.anchor.getNode(), (e) => We(e)))) return !1;
1298
+ if (!Ge($findMatchingParent(r.anchor.getNode(), (e) => Ge(e)))) return !1;
1297
1299
  if ("string" == typeof t) {
1298
- const n = pn(o, r, e);
1299
- if (n) return mn(n, e, [$createTextNode(t)]), !0;
1300
+ const n = Rn(o, r, e);
1301
+ if (n) return Fn(n, e, [$createTextNode(t)]), !0;
1300
1302
  }
1301
1303
  }
1302
1304
  return !1;
1303
1305
  }, COMMAND_PRIORITY_HIGH)), l && a.listenersToRemove.add(o.registerCommand(KEY_TAB_COMMAND, (t) => {
1304
1306
  const o = $getSelection();
1305
- if (!$isRangeSelection(o) || !o.isCollapsed() || !ln(o, e)) return !1;
1306
- const r = un(o.anchor.getNode());
1307
- return !(null === r || !e.is(hn(r))) && (gn(t), function(e, t) {
1307
+ if (!$isRangeSelection(o) || !o.isCollapsed() || !_n(o, e)) return !1;
1308
+ const r = yn(o.anchor.getNode());
1309
+ return !(null === r || !e.is(Nn(r))) && (Tn(t), function(e, t) {
1308
1310
  const o = "next" === t ? "getNextSibling" : "getPreviousSibling", r = "next" === t ? "getFirstChild" : "getLastChild", l = e[o]();
1309
1311
  if ($isElementNode(l)) return l.selectEnd();
1310
- const s = $findMatchingParent(e, De);
1311
- null === s && Le(247);
1312
- for (let e = s[o](); De(e); e = e[o]()) {
1312
+ const s = $findMatchingParent(e, ot);
1313
+ null === s && Ze(247);
1314
+ for (let e = s[o](); ot(e); e = e[o]()) {
1313
1315
  const t = e[r]();
1314
1316
  if ($isElementNode(t)) return t.selectEnd();
1315
1317
  }
1316
- const i = $findMatchingParent(s, Rn);
1317
- null === i && Le(248);
1318
+ const i = $findMatchingParent(s, Bn);
1319
+ null === i && Ze(248);
1318
1320
  "next" === t ? i.selectNext() : i.selectPrevious();
1319
1321
  }(r, t.shiftKey ? "previous" : "next"), !0);
1320
1322
  }, COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(FOCUS_COMMAND, (t) => e.isSelected(), COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(INSERT_PARAGRAPH_COMMAND, () => {
1321
1323
  const t = $getSelection();
1322
- if (!$isRangeSelection(t) || !t.isCollapsed() || !ln(t, e)) return !1;
1323
- const n = pn(o, t, e);
1324
- return !!n && (mn(n, e), !0);
1324
+ if (!$isRangeSelection(t) || !t.isCollapsed() || !_n(t, e)) return !1;
1325
+ const n = Rn(o, t, e);
1326
+ return !!n && (Fn(n, e), !0);
1325
1327
  }, COMMAND_PRIORITY_HIGH)), a;
1326
1328
  }
1327
- function Xt(e, t) {
1329
+ function rn(e, t) {
1328
1330
  const o = $getSelection(), r = $getPreviousSelection(), l = e.getAndClearNextFocus();
1329
1331
  if (null !== l) {
1330
1332
  const { tableKey: t, focusCell: n } = l, r = e.observers.get(t);
1331
- r || Le(335, t);
1333
+ r || Ze(335, t);
1332
1334
  const [s] = r;
1333
- if (Ot(o) && o.tableKey === s.tableNodeKey) return (n.x !== s.focusX || n.y !== s.focusY) && (s.$setFocusCellForSelection(n), !0);
1335
+ if (Pt(o) && o.tableKey === s.tableNodeKey) return (n.x !== s.focusX || n.y !== s.focusY) && (s.$setFocusCellForSelection(n), !0);
1334
1336
  if (null !== s.anchorCell && null !== s.anchorCellNodeKey && n.elem !== s.anchorCell.elem && null !== s.tableSelection) return s.$setFocusCellForSelection(n, !0), !0;
1335
1337
  }
1336
1338
  const s = e.getAndClearShouldCheckSelectionForTable();
1337
1339
  if (s && $isRangeSelection(r) && $isRangeSelection(o) && o.isCollapsed()) {
1338
- const e = $getNodeByKeyOrThrow(s), t = o.anchor.getNode(), r = e.getFirstChild(), l = un(t);
1339
- if (null !== l && De(r)) {
1340
+ const e = $getNodeByKeyOrThrow(s), t = o.anchor.getNode(), r = e.getFirstChild(), l = yn(t);
1341
+ if (null !== l && ot(r)) {
1340
1342
  const t = r.getFirstChild();
1341
- if (We(t) && e.is($findMatchingParent(l, (n) => n.is(e) || n.is(t)))) return t.selectStart(), !0;
1343
+ if (Ge(t) && e.is($findMatchingParent(l, (n) => n.is(e) || n.is(t)))) return t.selectStart(), !0;
1342
1344
  }
1343
1345
  }
1344
- Ot(o) && function(e, t) {
1345
- const n = Ht(e), o = $getPreviousSelection();
1346
+ Pt(o) && function(e, t) {
1347
+ const n = Gt(e), o = $getPreviousSelection();
1346
1348
  if (!t.is(o)) return;
1347
1349
  const r = $getNodeByKeyOrThrow(t.tableKey), l = getDOMSelection(n);
1348
1350
  if (l && l.anchorNode && l.focusNode) {
@@ -1353,20 +1355,20 @@ function Xt(e, t) {
1353
1355
  }
1354
1356
  }
1355
1357
  }(t, o), $isRangeSelection(o) && function(e, t) {
1356
- const n = $getPreviousSelection(), { anchor: o, focus: r } = e, l = o.getNode(), s = r.getNode(), i = un(l), c = un(s), a = i ? hn(i) : null, u = c ? hn(c) : null, h = e.isBackward(), d = i && c && a && u && a.is(u), f = u && (!a || a.isParentOf(u)), g = a && (!u || u.isParentOf(a));
1358
+ const n = $getPreviousSelection(), { anchor: o, focus: r } = e, l = o.getNode(), s = r.getNode(), i = yn(l), c = yn(s), a = i ? Nn(i) : null, u = c ? Nn(c) : null, h = e.isBackward(), d = i && c && a && u && a.is(u), f = u && (!a || a.isParentOf(u)), g = a && (!u || u.isParentOf(a));
1357
1359
  if (f) {
1358
- const t = e.clone(), [n] = wt(u, c, c), o = n[0][0].cell, r = n[n.length - 1].at(-1).cell;
1360
+ const t = e.clone(), [n] = Et(u, c, c), o = n[0][0].cell, r = n[n.length - 1].at(-1).cell;
1359
1361
  t.focus.set(h ? o.getKey() : r.getKey(), h ? 0 : r.getChildrenSize(), "element"), $setSelection(t);
1360
1362
  } else if (g) {
1361
- const t = e.clone(), [n] = wt(a, i, i), o = n[0][0].cell, r = n[n.length - 1].at(-1).cell;
1363
+ const t = e.clone(), [n] = Et(a, i, i), o = n[0][0].cell, r = n[n.length - 1].at(-1).cell;
1362
1364
  t.anchor.set(h ? r.getKey() : o.getKey(), h ? r.getChildrenSize() : 0, "element"), $setSelection(t);
1363
1365
  } else if (d) {
1364
1366
  const o = t.observers.get(a.getKey());
1365
- o || Le(335, a.getKey());
1367
+ o || Ze(335, a.getKey());
1366
1368
  const [r] = o;
1367
- if (i.is(c) || (r.$setAnchorCellForSelection(Cn(r, i)), r.$setFocusCellForSelection(Cn(r, c), !0)), "touch" === r.pointerType && r.isSelecting && e.isCollapsed() && $isRangeSelection(n) && n.isCollapsed()) {
1368
- const e = un(n.anchor.getNode());
1369
- e && !e.is(c) && (r.$setAnchorCellForSelection(Cn(r, e)), r.$setFocusCellForSelection(Cn(r, c), !0), r.pointerType = null);
1369
+ if (i.is(c) || (r.$setAnchorCellForSelection(On(r, i)), r.$setFocusCellForSelection(On(r, c), !0)), "touch" === r.pointerType && r.isSelecting && e.isCollapsed() && $isRangeSelection(n) && n.isCollapsed()) {
1370
+ const e = yn(n.anchor.getNode());
1371
+ e && !e.is(c) && (r.$setAnchorCellForSelection(On(r, e)), r.$setFocusCellForSelection(On(r, c), !0), r.pointerType = null);
1370
1372
  }
1371
1373
  }
1372
1374
  }(o, e);
@@ -1374,26 +1376,26 @@ function Xt(e, t) {
1374
1376
  tableNode: $getNodeByKeyOrThrow(e),
1375
1377
  tableObserver: t
1376
1378
  }));
1377
- for (const { tableNode: e, tableObserver: n } of i) Yt(t, e, n);
1379
+ for (const { tableNode: e, tableObserver: n } of i) ln(t, e, n);
1378
1380
  return !1;
1379
1381
  }
1380
- function Yt(e, t, n) {
1382
+ function ln(e, t, n) {
1381
1383
  const o = $getSelection(), r = $getPreviousSelection();
1382
- o && !o.is(r) && (Ot(o) || Ot(r)) && n.tableSelection && !n.tableSelection.is(r) && (Ot(o) && o.tableKey === n.tableNodeKey ? n.$updateTableTableSelection(o) : !Ot(o) && Ot(r) && r.tableKey === n.tableNodeKey && n.$updateTableTableSelection(null)), n.hasHijackedSelectionStyles && !t.isSelected() ? function(e, t) {
1383
- t.$enableHighlightStyle(), Zt(t.table, (t) => {
1384
+ o && !o.is(r) && (Pt(o) || Pt(r)) && n.tableSelection && !n.tableSelection.is(r) && (Pt(o) && o.tableKey === n.tableNodeKey ? n.$updateTableTableSelection(o) : !Pt(o) && Pt(r) && r.tableKey === n.tableNodeKey && n.$updateTableTableSelection(null)), n.hasHijackedSelectionStyles && !t.isSelected() ? function(e, t) {
1385
+ t.$enableHighlightStyle(), dn(t.table, (t) => {
1384
1386
  const n = t.elem;
1385
- t.highlighted = !1, an(e, t), n.getAttribute("style") || n.removeAttribute("style");
1387
+ t.highlighted = !1, wn(e, t), n.getAttribute("style") || n.removeAttribute("style");
1386
1388
  });
1387
1389
  }(e, n) : !n.hasHijackedSelectionStyles && t.isSelected() && function(e, t) {
1388
- t.$disableHighlightStyle(), Zt(t.table, (t) => {
1389
- t.highlighted = !0, cn(e, t);
1390
+ t.$disableHighlightStyle(), dn(t.table, (t) => {
1391
+ t.highlighted = !0, bn(e, t);
1390
1392
  });
1391
1393
  }(e, n);
1392
1394
  }
1393
- function qt(e) {
1394
- return e[Wt] || null;
1395
+ function sn(e) {
1396
+ return e[qt] || null;
1395
1397
  }
1396
- function jt(e) {
1398
+ function cn(e) {
1397
1399
  let t = e;
1398
1400
  for (; null != t;) {
1399
1401
  const e = t.nodeName;
@@ -1405,7 +1407,7 @@ function jt(e) {
1405
1407
  }
1406
1408
  return null;
1407
1409
  }
1408
- function Vt(e, t) {
1410
+ function an(e, t) {
1409
1411
  if (!e.contains(t)) return null;
1410
1412
  let n = null;
1411
1413
  for (let o = t; null != o; o = o.parentNode) {
@@ -1415,13 +1417,13 @@ function Vt(e, t) {
1415
1417
  }
1416
1418
  return null;
1417
1419
  }
1418
- function Gt(e, t) {
1420
+ function un(e, t) {
1419
1421
  const n = [], o = {
1420
1422
  columns: 0,
1421
1423
  domRows: n,
1422
1424
  rows: 0
1423
1425
  };
1424
- let r = Lt(e, t).querySelector("tr"), l = 0, s = 0;
1426
+ let r = Vt(e, t).querySelector("tr"), l = 0, s = 0;
1425
1427
  for (n.length = 0; null != r;) {
1426
1428
  const e = r.nodeName;
1427
1429
  if ("TD" === e || "TH" === e) {
@@ -1456,14 +1458,14 @@ function Gt(e, t) {
1456
1458
  }
1457
1459
  return o.columns = l + 1, o.rows = s + 1, o;
1458
1460
  }
1459
- function Qt(e, t, n) {
1461
+ function hn(e, t, n) {
1460
1462
  const o = new Set(n ? n.getNodes() : []);
1461
- Zt(t, (t, n) => {
1463
+ dn(t, (t, n) => {
1462
1464
  const r = t.elem;
1463
- o.has(n) ? (t.highlighted = !0, cn(e, t)) : (t.highlighted = !1, an(e, t), r.getAttribute("style") || r.removeAttribute("style"));
1465
+ o.has(n) ? (t.highlighted = !0, bn(e, t)) : (t.highlighted = !1, wn(e, t), r.getAttribute("style") || r.removeAttribute("style"));
1464
1466
  });
1465
1467
  }
1466
- function Zt(e, t) {
1468
+ function dn(e, t) {
1467
1469
  const { domRows: n } = e;
1468
1470
  for (let e = 0; e < n.length; e++) {
1469
1471
  const o = n[e];
@@ -1478,17 +1480,17 @@ function Zt(e, t) {
1478
1480
  }
1479
1481
  }
1480
1482
  }
1481
- const en = (e, t, n, o, r) => {
1483
+ const fn = (e, t, n, o, r) => {
1482
1484
  const l = "forward" === r;
1483
1485
  switch (r) {
1484
1486
  case "backward":
1485
- case "forward": return n !== (l ? e.table.columns - 1 : 0) ? sn(t.getCellNodeFromCordsOrThrow(n + (l ? 1 : -1), o, e.table), l) : o !== (l ? e.table.rows - 1 : 0) ? sn(t.getCellNodeFromCordsOrThrow(l ? 0 : e.table.columns - 1, o + (l ? 1 : -1), e.table), l) : l ? t.selectNext() : t.selectPrevious(), !0;
1486
- case "up": return 0 !== o ? sn(t.getCellNodeFromCordsOrThrow(n, o - 1, e.table), !1) : t.selectPrevious(), !0;
1487
- case "down": return o !== e.table.rows - 1 ? sn(t.getCellNodeFromCordsOrThrow(n, o + 1, e.table), !0) : t.selectNext(), !0;
1487
+ case "forward": return n !== (l ? e.table.columns - 1 : 0) ? Sn(t.getCellNodeFromCordsOrThrow(n + (l ? 1 : -1), o, e.table), l) : o !== (l ? e.table.rows - 1 : 0) ? Sn(t.getCellNodeFromCordsOrThrow(l ? 0 : e.table.columns - 1, o + (l ? 1 : -1), e.table), l) : l ? t.selectNext() : t.selectPrevious(), !0;
1488
+ case "up": return 0 !== o ? Sn(t.getCellNodeFromCordsOrThrow(n, o - 1, e.table), !1) : t.selectPrevious(), !0;
1489
+ case "down": return o !== e.table.rows - 1 ? Sn(t.getCellNodeFromCordsOrThrow(n, o + 1, e.table), !0) : t.selectNext(), !0;
1488
1490
  default: return !1;
1489
1491
  }
1490
1492
  };
1491
- function tn(e, t) {
1493
+ function gn(e, t) {
1492
1494
  let n, o;
1493
1495
  if (t.startColumn === e.minColumn) n = "minColumn";
1494
1496
  else {
@@ -1502,17 +1504,17 @@ function tn(e, t) {
1502
1504
  }
1503
1505
  return [n, o];
1504
1506
  }
1505
- function nn([e, t]) {
1507
+ function mn([e, t]) {
1506
1508
  return ["minColumn" === e ? "maxColumn" : "minColumn", "minRow" === t ? "maxRow" : "minRow"];
1507
1509
  }
1508
- function on(e, t, [n, o]) {
1510
+ function pn(e, t, [n, o]) {
1509
1511
  const r = t[o], l = e[r];
1510
- void 0 === l && Le(250, o, String(r));
1512
+ void 0 === l && Ze(250, o, String(r));
1511
1513
  const s = t[n], i = l[s];
1512
- return void 0 === i && Le(250, n, String(s)), i;
1514
+ return void 0 === i && Ze(250, n, String(s)), i;
1513
1515
  }
1514
- function rn(e, t, n, o, r) {
1515
- const l = Nt(t, n, o), { topSpan: i, leftSpan: c, bottomSpan: a, rightSpan: u } = function(e, t) {
1516
+ function Cn(e, t, n, o, r) {
1517
+ const l = $t(t, n, o), { topSpan: i, leftSpan: c, bottomSpan: a, rightSpan: u } = function(e, t) {
1516
1518
  const { minColumn: n, maxColumn: o, minRow: r, maxRow: l } = t;
1517
1519
  let s = 1, i = 1, c = 1, a = 1;
1518
1520
  const u = e[r], h = e[l];
@@ -1524,9 +1526,9 @@ function rn(e, t, n, o, r) {
1524
1526
  rightSpan: c,
1525
1527
  topSpan: s
1526
1528
  };
1527
- }(t, l), [d, f] = nn(function(e, t) {
1528
- const n = tn(e, t);
1529
- return null === n && Le(249, t.cell.getKey()), n;
1529
+ }(t, l), [d, f] = mn(function(e, t) {
1530
+ const n = gn(e, t);
1531
+ return null === n && Ze(249, t.cell.getKey()), n;
1530
1532
  }(l, n));
1531
1533
  let g = l[d], m = l[f];
1532
1534
  "forward" === r ? g += "maxColumn" === d ? 1 : c : "backward" === r ? g -= "minColumn" === d ? 1 : u : "down" === r ? m += "maxRow" === f ? 1 : i : "up" === r && (m -= "minRow" === f ? 1 : a);
@@ -1535,44 +1537,44 @@ function rn(e, t, n, o, r) {
1535
1537
  const C = p[g];
1536
1538
  if (void 0 === C) return !1;
1537
1539
  const [_, S] = function(e, t, n) {
1538
- const o = Nt(e, t, n), r = tn(o, t);
1539
- if (r) return [on(e, o, r), on(e, o, nn(r))];
1540
- const l = tn(o, n);
1541
- if (l) return [on(e, o, nn(l)), on(e, o, l)];
1540
+ const o = $t(e, t, n), r = gn(o, t);
1541
+ if (r) return [pn(e, o, r), pn(e, o, mn(r))];
1542
+ const l = gn(o, n);
1543
+ if (l) return [pn(e, o, mn(l)), pn(e, o, l)];
1542
1544
  const s = ["minColumn", "minRow"];
1543
- return [on(e, o, s), on(e, o, nn(s))];
1544
- }(t, n, C), w = Cn(e, _.cell), b = Cn(e, S.cell);
1545
- return e.$setAnchorCellForSelection(w), e.$setFocusCellForSelection(b, !0), !0;
1545
+ return [pn(e, o, s), pn(e, o, mn(s))];
1546
+ }(t, n, C), b = On(e, _.cell), w = On(e, S.cell);
1547
+ return e.$setAnchorCellForSelection(b), e.$setFocusCellForSelection(w, !0), !0;
1546
1548
  }
1547
- function ln(e, t) {
1548
- if ($isRangeSelection(e) || Ot(e)) {
1549
+ function _n(e, t) {
1550
+ if ($isRangeSelection(e) || Pt(e)) {
1549
1551
  const n = t.isParentOf(e.anchor.getNode()), o = t.isParentOf(e.focus.getNode());
1550
1552
  return n && o;
1551
1553
  }
1552
1554
  return !1;
1553
1555
  }
1554
- function sn(e, t) {
1556
+ function Sn(e, t) {
1555
1557
  t ? e.selectStart() : e.selectEnd();
1556
1558
  }
1557
- function cn(t, n) {
1559
+ function bn(t, n) {
1558
1560
  const o = n.elem, r = t._config.theme;
1559
- We($getNearestNodeFromDOMNode(o)) || Le(131), addClassNamesToElement(o, r.tableCellSelected);
1561
+ Ge($getNearestNodeFromDOMNode(o)) || Ze(131), addClassNamesToElement(o, r.tableCellSelected);
1560
1562
  }
1561
- function an(e, t) {
1563
+ function wn(e, t) {
1562
1564
  const n = t.elem;
1563
- We($getNearestNodeFromDOMNode(n)) || Le(131);
1565
+ Ge($getNearestNodeFromDOMNode(n)) || Ze(131);
1564
1566
  const r = e._config.theme;
1565
1567
  removeClassNamesFromElement(n, r.tableCellSelected);
1566
1568
  }
1567
- function un(e) {
1568
- const t = $findMatchingParent(e, We);
1569
- return We(t) ? t : null;
1569
+ function yn(e) {
1570
+ const t = $findMatchingParent(e, Ge);
1571
+ return Ge(t) ? t : null;
1570
1572
  }
1571
- function hn(e) {
1572
- const t = $findMatchingParent(e, Rn);
1573
- return Rn(t) ? t : null;
1573
+ function Nn(e) {
1574
+ const t = $findMatchingParent(e, Bn);
1575
+ return Bn(t) ? t : null;
1574
1576
  }
1575
- function dn(e, t, o, r, l, s, i) {
1577
+ function vn(e, t, o, r, l, s, i) {
1576
1578
  const c = $caretFromPoint(o.focus, l ? "previous" : "next");
1577
1579
  if ($isExtendableTextPointCaret(c)) return !1;
1578
1580
  let a = c;
@@ -1581,21 +1583,21 @@ function dn(e, t, o, r, l, s, i) {
1581
1583
  a = e;
1582
1584
  }
1583
1585
  const u = a.getParentAtCaret();
1584
- if (!We(u)) return !1;
1586
+ if (!Ge(u)) return !1;
1585
1587
  const h = u, d = function(e) {
1586
1588
  for (const t of $extendCaretToRange(e).iterNodeCarets("root")) {
1587
1589
  const { origin: n } = t;
1588
- if (We(n)) {
1590
+ if (Ge(n)) {
1589
1591
  if ($isChildCaret(t)) return $getChildCaret(n, e.direction);
1590
- } else if (!De(n)) break;
1592
+ } else if (!ot(n)) break;
1591
1593
  }
1592
1594
  return null;
1593
- }($getSiblingCaret(h, a.direction)), f = $findMatchingParent(h, Rn);
1595
+ }($getSiblingCaret(h, a.direction)), f = $findMatchingParent(h, Bn);
1594
1596
  if (!f || !f.is(s)) return !1;
1595
- const g = e.getElementByKey(h.getKey()), m = jt(g);
1597
+ const g = e.getElementByKey(h.getKey()), m = cn(g);
1596
1598
  if (!g || !m) return !1;
1597
- if (i.table = xn(e, f), d) if ("extend" === r) {
1598
- const t = jt(e.getElementByKey(d.origin.getKey()));
1599
+ if (i.table = zn(e, f), d) if ("extend" === r) {
1600
+ const t = cn(e.getElementByKey(d.origin.getKey()));
1599
1601
  if (!t) return !1;
1600
1602
  i.$setAnchorCellForSelection(m), i.$setFocusCellForSelection(t, !0);
1601
1603
  } else {
@@ -1610,16 +1612,16 @@ function dn(e, t, o, r, l, s, i) {
1610
1612
  }($getSiblingCaret(f, c.direction));
1611
1613
  $setPointFromCaret(o.anchor, e), $setPointFromCaret(o.focus, e);
1612
1614
  }
1613
- return gn(t), !0;
1615
+ return Tn(t), !0;
1614
1616
  }
1615
- function fn(e, t, o, r, l, s) {
1617
+ function xn(e, t, o, r, l, s) {
1616
1618
  if (("up" === o || "down" === o) && function(e) {
1617
1619
  const t = e.getRootElement();
1618
1620
  if (!t) return !1;
1619
1621
  return t.hasAttribute("aria-controls") && "typeahead-menu" === t.getAttribute("aria-controls");
1620
1622
  }(e)) return !1;
1621
1623
  const i = $getSelection();
1622
- if (!ln(i, r)) {
1624
+ if (!_n(i, r)) {
1623
1625
  if ($isRangeSelection(i)) {
1624
1626
  if ("backward" === o) {
1625
1627
  if (i.focus.offset > 0) return !1;
@@ -1632,13 +1634,13 @@ function fn(e, t, o, r, l, s) {
1632
1634
  }(i.focus.getNode());
1633
1635
  if (!e) return !1;
1634
1636
  const n = e.getPreviousSibling();
1635
- return !!Rn(n) && (gn(t), t.shiftKey ? i.focus.set(n.getParentOrThrow().getKey(), n.getIndexWithinParent(), "element") : n.selectEnd(), !0);
1637
+ return !!Bn(n) && (Tn(t), t.shiftKey ? i.focus.set(n.getParentOrThrow().getKey(), n.getIndexWithinParent(), "element") : n.selectEnd(), !0);
1636
1638
  }
1637
1639
  if (t.shiftKey && ("up" === o || "down" === o)) {
1638
1640
  const e = i.focus.getNode();
1639
1641
  if (!i.isCollapsed() && ("up" === o && !i.isBackward() || "down" === o && i.isBackward())) {
1640
- let l = $findMatchingParent(e, (e) => Rn(e));
1641
- if (We(l) && (l = $findMatchingParent(l, Rn)), l !== r) return !1;
1642
+ let l = $findMatchingParent(e, (e) => Bn(e));
1643
+ if (Ge(l) && (l = $findMatchingParent(l, Bn)), l !== r) return !1;
1642
1644
  if (!l) return !1;
1643
1645
  const s = "down" === o ? l.getNextSibling() : l.getPreviousSibling();
1644
1646
  if (!s) return !1;
@@ -1647,15 +1649,15 @@ function fn(e, t, o, r, l, s) {
1647
1649
  let a = s;
1648
1650
  if ("up" === o && $isElementNode(s)) a = s.getLastChild() || s, c = $isTextNode(a) ? a.getTextContentSize() : 0;
1649
1651
  const u = i.clone();
1650
- return u.focus.set(a.getKey(), c, $isTextNode(a) ? "text" : "element"), $setSelection(u), gn(t), !0;
1652
+ return u.focus.set(a.getKey(), c, $isTextNode(a) ? "text" : "element"), $setSelection(u), Tn(t), !0;
1651
1653
  }
1652
1654
  if ($isRootOrShadowRoot(e)) {
1653
1655
  const e = "up" === o ? i.getNodes()[i.getNodes().length - 1] : i.getNodes()[0];
1654
1656
  if (e) {
1655
- if (null !== Bt(r, e)) {
1657
+ if (null !== Qt(r, e)) {
1656
1658
  const e = r.getFirstDescendant(), t = r.getLastDescendant();
1657
1659
  if (!e || !t) return !1;
1658
- const [n] = yt(e), [o] = yt(t), s = r.getCordsFromCellNode(n, l.table), i = r.getCordsFromCellNode(o, l.table), c = r.getDOMCellFromCordsOrThrow(s.x, s.y, l.table), a = r.getDOMCellFromCordsOrThrow(i.x, i.y, l.table);
1660
+ const [n] = Mt(e), [o] = Mt(t), s = r.getCordsFromCellNode(n, l.table), i = r.getCordsFromCellNode(o, l.table), c = r.getDOMCellFromCordsOrThrow(s.x, s.y, l.table), a = r.getDOMCellFromCordsOrThrow(i.x, i.y, l.table);
1659
1661
  return l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(a, !0), !0;
1660
1662
  }
1661
1663
  }
@@ -1663,35 +1665,35 @@ function fn(e, t, o, r, l, s) {
1663
1665
  }
1664
1666
  {
1665
1667
  let r = $findMatchingParent(e, (e) => $isElementNode(e) && !e.isInline());
1666
- if (We(r) && (r = $findMatchingParent(r, Rn)), !r) return !1;
1668
+ if (Ge(r) && (r = $findMatchingParent(r, Bn)), !r) return !1;
1667
1669
  const s = "down" === o ? r.getNextSibling() : r.getPreviousSibling();
1668
- if (Rn(s) && l.tableNodeKey === s.getKey()) {
1670
+ if (Bn(s) && l.tableNodeKey === s.getKey()) {
1669
1671
  const e = s.getFirstDescendant(), n = s.getLastDescendant();
1670
1672
  if (!e || !n) return !1;
1671
- const [r] = yt(e), [l] = yt(n), c = i.clone();
1672
- return c.focus.set(("up" === o ? r : l).getKey(), "up" === o ? 0 : l.getChildrenSize(), "element"), gn(t), $setSelection(c), !0;
1673
+ const [r] = Mt(e), [l] = Mt(n), c = i.clone();
1674
+ return c.focus.set(("up" === o ? r : l).getKey(), "up" === o ? 0 : l.getChildrenSize(), "element"), Tn(t), $setSelection(c), !0;
1673
1675
  }
1674
1676
  }
1675
1677
  }
1676
1678
  }
1677
- return "down" === o && yn(e) && s.setShouldCheckSelectionForTable(r.getKey()), !1;
1679
+ return "down" === o && Mn(e) && s.setShouldCheckSelectionForTable(r.getKey()), !1;
1678
1680
  }
1679
1681
  if ($isRangeSelection(i)) {
1680
- if ("backward" === o || "forward" === o) return dn(e, t, i, t.shiftKey ? "extend" : "move", "backward" === o, r, l);
1682
+ if ("backward" === o || "forward" === o) return vn(e, t, i, t.shiftKey ? "extend" : "move", "backward" === o, r, l);
1681
1683
  if (i.isCollapsed()) {
1682
- const { anchor: c, focus: a } = i, u = $findMatchingParent(c.getNode(), We), h = $findMatchingParent(a.getNode(), We);
1683
- if (!We(u) || !u.is(h)) return !1;
1684
- const d = hn(u);
1684
+ const { anchor: c, focus: a } = i, u = $findMatchingParent(c.getNode(), Ge), h = $findMatchingParent(a.getNode(), Ge);
1685
+ if (!Ge(u) || !u.is(h)) return !1;
1686
+ const d = Nn(u);
1685
1687
  if (d !== r && null != d) {
1686
- const n = Lt(d, e.getElementByKey(d.getKey()));
1687
- if (null != n) return l.table = Gt(d, n), fn(e, t, o, d, l, s);
1688
+ const n = Vt(d, e.getElementByKey(d.getKey()));
1689
+ if (null != n) return l.table = un(d, n), xn(e, t, o, d, l, s);
1688
1690
  }
1689
1691
  const f = e.getElementByKey(u.__key), g = e.getElementByKey(c.key);
1690
1692
  if (null == g || null == f) return !1;
1691
1693
  let m;
1692
1694
  if ("element" === c.type) m = g.getBoundingClientRect();
1693
1695
  else {
1694
- const t = getDOMSelection(Ht(e));
1696
+ const t = getDOMSelection(Gt(e));
1695
1697
  if (null === t || 0 === t.rangeCount) return !1;
1696
1698
  m = t.getRangeAt(0).getBoundingClientRect();
1697
1699
  }
@@ -1701,9 +1703,9 @@ function fn(e, t, o, r, l, s) {
1701
1703
  if (null == C) return !1;
1702
1704
  const _ = C.getBoundingClientRect();
1703
1705
  if ("up" === o ? _.top > m.top - m.height : m.bottom + m.height > _.bottom) {
1704
- gn(t);
1706
+ Tn(t);
1705
1707
  const e = r.getCordsFromCellNode(u, l.table);
1706
- if (!t.shiftKey) return en(l, r, e.x, e.y, o);
1708
+ if (!t.shiftKey) return fn(l, r, e.x, e.y, o);
1707
1709
  {
1708
1710
  const t = r.getDOMCellFromCordsOrThrow(e.x, e.y, l.table);
1709
1711
  l.$setAnchorCellForSelection(t), l.$setFocusCellForSelection(t, !0);
@@ -1711,50 +1713,52 @@ function fn(e, t, o, r, l, s) {
1711
1713
  return !0;
1712
1714
  }
1713
1715
  }
1714
- } else if (Ot(i)) {
1715
- const { anchor: s, focus: c } = i, a = $findMatchingParent(s.getNode(), We), u = $findMatchingParent(c.getNode(), We), [h] = i.getNodes();
1716
- Rn(h) || Le(251);
1717
- const d = Lt(h, e.getElementByKey(h.getKey()));
1718
- if (!We(a) || !We(u) || !Rn(h) || null == d) return !1;
1716
+ } else if (Pt(i)) {
1717
+ const { anchor: s, focus: c, tableKey: a } = i;
1718
+ if (a !== r.getKey()) return !1;
1719
+ const u = $findMatchingParent(s.getNode(), Ge), h = $findMatchingParent(c.getNode(), Ge), [d] = i.getNodes();
1720
+ Bn(d) || Ze(251);
1721
+ const f = Vt(d, e.getElementByKey(d.getKey()));
1722
+ if (!Ge(u) || !Ge(h) || !Bn(d) || null == f) return !1;
1719
1723
  l.$updateTableTableSelection(i);
1720
- const f = Gt(h, d), g = r.getCordsFromCellNode(a, f), m = r.getDOMCellFromCordsOrThrow(g.x, g.y, f);
1721
- if (l.$setAnchorCellForSelection(m), gn(t), t.shiftKey) {
1722
- const [e, t, n] = wt(r, a, u);
1723
- return rn(l, e, t, n, o);
1724
+ const g = un(d, f), m = r.getCordsFromCellNode(u, g), p = r.getDOMCellFromCordsOrThrow(m.x, m.y, g);
1725
+ if (l.$setAnchorCellForSelection(p), Tn(t), t.shiftKey) {
1726
+ const [e, t, n] = Et(r, u, h);
1727
+ return Cn(l, e, t, n, o);
1724
1728
  }
1725
- return u.selectEnd(), !0;
1729
+ return h.selectEnd(), !0;
1726
1730
  }
1727
1731
  return !1;
1728
1732
  }
1729
- function gn(e) {
1733
+ function Tn(e) {
1730
1734
  e.preventDefault(), e.stopImmediatePropagation(), e.stopPropagation();
1731
1735
  }
1732
- function mn(e, t, n) {
1736
+ function Fn(e, t, n) {
1733
1737
  const o = $createParagraphNode();
1734
1738
  "first" === e ? t.insertBefore(o) : t.insertAfter(o), o.append(...n || []), o.selectEnd();
1735
1739
  }
1736
- function pn(e, t, o) {
1740
+ function Rn(e, t, o) {
1737
1741
  const r = o.getParent();
1738
1742
  if (!r) return;
1739
- const l = getDOMSelection(Ht(e));
1743
+ const l = getDOMSelection(Gt(e));
1740
1744
  if (!l) return;
1741
- const s = l.anchorNode, i = e.getElementByKey(r.getKey()), c = Lt(o, e.getElementByKey(o.getKey()));
1745
+ const s = l.anchorNode, i = e.getElementByKey(r.getKey()), c = Vt(o, e.getElementByKey(o.getKey()));
1742
1746
  if (!s || !i || !c || !i.contains(s) || c.contains(s)) return;
1743
- const a = $findMatchingParent(t.anchor.getNode(), (e) => We(e));
1747
+ const a = $findMatchingParent(t.anchor.getNode(), (e) => Ge(e));
1744
1748
  if (!a) return;
1745
- const u = $findMatchingParent(a, (e) => Rn(e));
1746
- if (!Rn(u) || !u.is(o)) return;
1747
- const [h, d] = wt(o, a, a), f = h[0][0], g = h[h.length - 1][h[0].length - 1], { startRow: m, startColumn: p } = d, C = m === f.startRow && p === f.startColumn, _ = m === g.startRow && p === g.startColumn;
1749
+ const u = $findMatchingParent(a, (e) => Bn(e));
1750
+ if (!Bn(u) || !u.is(o)) return;
1751
+ const [h, d] = Et(o, a, a), f = h[0][0], g = h[h.length - 1][h[0].length - 1], { startRow: m, startColumn: p } = d, C = m === f.startRow && p === f.startColumn, _ = m === g.startRow && p === g.startColumn;
1748
1752
  return C ? "first" : _ ? "last" : void 0;
1749
1753
  }
1750
- function Cn(e, t) {
1754
+ function On(e, t) {
1751
1755
  const { tableNode: n } = e.$lookup(), o = n.getCordsFromCellNode(t, e.table);
1752
1756
  return n.getDOMCellFromCordsOrThrow(o.x, o.y, e.table);
1753
1757
  }
1754
- function _n(e, t, n) {
1755
- return Bt(e, $getNearestNodeFromDOMNode(t, n));
1758
+ function An(e, t, n) {
1759
+ return Qt(e, $getNearestNodeFromDOMNode(t, n));
1756
1760
  }
1757
- function Sn(e, t, n) {
1761
+ function Kn(e, t, n) {
1758
1762
  const o = e.querySelector("colgroup");
1759
1763
  if (!o) return;
1760
1764
  const r = [];
@@ -1764,7 +1768,7 @@ function Sn(e, t, n) {
1764
1768
  }
1765
1769
  o.replaceChildren(...r);
1766
1770
  }
1767
- function wn(t, n, r) {
1771
+ function En(t, n, r) {
1768
1772
  if (!n.theme.tableAlignment) return;
1769
1773
  const l = [], s = [];
1770
1774
  for (const e of ["center", "right"]) {
@@ -1773,14 +1777,14 @@ function wn(t, n, r) {
1773
1777
  }
1774
1778
  removeClassNamesFromElement(t, ...l), addClassNamesToElement(t, ...s);
1775
1779
  }
1776
- const bn = /* @__PURE__ */ new WeakSet();
1777
- function yn(e = $getEditor()) {
1778
- return bn.has(e);
1780
+ const kn = /* @__PURE__ */ new WeakSet();
1781
+ function Mn(e = $getEditor()) {
1782
+ return kn.has(e);
1779
1783
  }
1780
- function Nn(e, t) {
1781
- t ? bn.add(e) : bn.delete(e);
1784
+ function $n(e, t) {
1785
+ t ? kn.add(e) : kn.delete(e);
1782
1786
  }
1783
- var vn = class vn extends ElementNode {
1787
+ var Wn = class Wn extends ElementNode {
1784
1788
  __rowStriping;
1785
1789
  __frozenColumnCount;
1786
1790
  __frozenRowCount;
@@ -1796,19 +1800,19 @@ var vn = class vn extends ElementNode {
1796
1800
  return t.__colWidths = e, t;
1797
1801
  }
1798
1802
  static clone(e) {
1799
- return new vn(e.__key);
1803
+ return new Wn(e.__key);
1800
1804
  }
1801
1805
  afterCloneFrom(e) {
1802
1806
  super.afterCloneFrom(e), this.__colWidths = e.__colWidths, this.__rowStriping = e.__rowStriping, this.__frozenColumnCount = e.__frozenColumnCount, this.__frozenRowCount = e.__frozenRowCount;
1803
1807
  }
1804
1808
  static importDOM() {
1805
1809
  return { table: (e) => ({
1806
- conversion: Tn,
1810
+ conversion: Ln,
1807
1811
  priority: 1
1808
1812
  }) };
1809
1813
  }
1810
1814
  static importJSON(e) {
1811
- return Fn().updateFromJSON(e);
1815
+ return Hn().updateFromJSON(e);
1812
1816
  }
1813
1817
  updateFromJSON(e) {
1814
1818
  return super.updateFromJSON(e).setRowStriping(e.rowStriping || !1).setFrozenColumns(e.frozenColumnCount || 0).setFrozenRows(e.frozenRowCount || 0).setColWidths(e.colWidths);
@@ -1829,14 +1833,14 @@ var vn = class vn extends ElementNode {
1829
1833
  return "html" === n;
1830
1834
  }
1831
1835
  getDOMSlot(e) {
1832
- const t = zt(e) ? e : e.querySelector("table");
1833
- return zt(t) || Le(229), super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"));
1836
+ const t = jt(e) ? e : e.querySelector("table");
1837
+ return jt(t) || Ze(229), super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"));
1834
1838
  }
1835
1839
  createDOM(t, n) {
1836
1840
  const o = document.createElement("table");
1837
1841
  this.__style && setDOMStyleFromCSS(o.style, this.__style);
1838
1842
  const r = document.createElement("colgroup");
1839
- if (o.appendChild(r), setDOMUnmanaged(r), addClassNamesToElement(o, t.theme.table), this.updateTableElement(null, o, t), yn(n)) {
1843
+ if (o.appendChild(r), setDOMUnmanaged(r), addClassNamesToElement(o, t.theme.table), this.updateTableElement(null, o, t), Mn(n)) {
1840
1844
  const n = document.createElement("div"), r = t.theme.tableScrollableWrapper;
1841
1845
  return r ? addClassNamesToElement(n, r) : n.style.overflowX = "auto", n.appendChild(o), this.updateTableWrapper(null, n, o, t), n;
1842
1846
  }
@@ -1854,25 +1858,25 @@ var vn = class vn extends ElementNode {
1854
1858
  r ? (addClassNamesToElement(t, n.theme.tableRowStriping), t.setAttribute("data-lexical-row-striping", "true")) : (removeClassNamesFromElement(t, n.theme.tableRowStriping), t.removeAttribute("data-lexical-row-striping"));
1855
1859
  }(n, r, this.__rowStriping);
1856
1860
  const l = t ? t.getColumnCount() : 0, s = t ? t.__colWidths : void 0;
1857
- this.getColumnCount() === l && this.getColWidths() === s || Sn(n, this.getColumnCount(), this.getColWidths()), wn(n, r, this.getFormatType());
1861
+ this.getColumnCount() === l && this.getColWidths() === s || Kn(n, this.getColumnCount(), this.getColWidths()), En(n, r, this.getFormatType());
1858
1862
  }
1859
1863
  updateDOM(e, t, n) {
1860
- const o = Lt(this, t);
1861
- return t === o === yn() || (isHTMLElement$1(r = t) && "DIV" === r.nodeName && this.updateTableWrapper(e, t, o, n), this.updateTableElement(e, o, n), !1);
1864
+ const o = Vt(this, t);
1865
+ return t === o === Mn() || (isHTMLElement$1(r = t) && "DIV" === r.nodeName && this.updateTableWrapper(e, t, o, n), this.updateTableElement(e, o, n), !1);
1862
1866
  var r;
1863
1867
  }
1864
1868
  scaleDOMColWidths(e, t) {
1865
1869
  const n = this.getColWidths();
1866
1870
  if (!n) return;
1867
- Sn(Lt(this, e), this.getColumnCount(), n.map((e) => e * t));
1871
+ Kn(Vt(this, e), this.getColumnCount(), n.map((e) => e * t));
1868
1872
  }
1869
1873
  exportDOM(e) {
1870
1874
  const t = super.exportDOM(e), { element: n } = t;
1871
1875
  return {
1872
1876
  after: (n) => {
1873
- if (t.after && (n = t.after(n)), !zt(n) && isHTMLElement$1(n) && (n = n.querySelector("table")), !zt(n)) return null;
1874
- wn(n, e._config, this.getFormatType());
1875
- const [o] = bt(this, null, null), r = /* @__PURE__ */ new Map();
1877
+ if (t.after && (n = t.after(n)), !jt(n) && isHTMLElement$1(n) && (n = n.querySelector("table")), !jt(n)) return null;
1878
+ En(n, e._config, this.getFormatType());
1879
+ const [o] = kt(this, null, null), r = /* @__PURE__ */ new Map();
1876
1880
  for (const e of o) for (const t of e) {
1877
1881
  const e = t.cell.getKey();
1878
1882
  r.has(e) || r.set(e, {
@@ -1904,7 +1908,7 @@ var vn = class vn extends ElementNode {
1904
1908
  }
1905
1909
  return n;
1906
1910
  },
1907
- element: !zt(n) && isHTMLElement$1(n) ? n.querySelector("table") : n
1911
+ element: !jt(n) && isHTMLElement$1(n) ? n.querySelector("table") : n
1908
1912
  };
1909
1913
  }
1910
1914
  canBeEmpty() {
@@ -1920,7 +1924,7 @@ var vn = class vn extends ElementNode {
1920
1924
  if (null != n) for (let o = 0; o < n.length; o++) {
1921
1925
  const r = n[o];
1922
1926
  if (null == r) continue;
1923
- const { elem: l } = r, s = _n(this, l);
1927
+ const { elem: l } = r, s = An(this, l);
1924
1928
  if (null !== s && e.is(s)) return {
1925
1929
  x: o,
1926
1930
  y: t
@@ -1944,7 +1948,7 @@ var vn = class vn extends ElementNode {
1944
1948
  const o = this.getDOMCellFromCords(e, t, n);
1945
1949
  if (null == o) return null;
1946
1950
  const r = $getNearestNodeFromDOMNode(o.elem);
1947
- return We(r) ? r : null;
1951
+ return Ge(r) ? r : null;
1948
1952
  }
1949
1953
  getCellNodeFromCordsOrThrow(e, t, n) {
1950
1954
  const o = this.getCellNodeFromCords(e, t, n);
@@ -1983,23 +1987,23 @@ var vn = class vn extends ElementNode {
1983
1987
  if (!e) return 0;
1984
1988
  let t = 0;
1985
1989
  return e.getChildren().forEach((e) => {
1986
- We(e) && (t += e.getColSpan());
1990
+ Ge(e) && (t += e.getColSpan());
1987
1991
  }), t;
1988
1992
  }
1989
1993
  };
1990
- function xn(e, t) {
1994
+ function zn(e, t) {
1991
1995
  const n = e.getElementByKey(t.getKey());
1992
- return null === n && Le(230), Gt(t, n);
1996
+ return null === n && Ze(230), un(t, n);
1993
1997
  }
1994
- function Tn(e) {
1995
- const n = Fn();
1998
+ function Ln(e) {
1999
+ const n = Hn();
1996
2000
  e.hasAttribute("data-lexical-row-striping") && n.setRowStriping(!0), e.hasAttribute("data-lexical-frozen-column") && n.setFrozenColumns(1), e.hasAttribute("data-lexical-frozen-row") && n.setFrozenRows(1);
1997
2001
  const o = e.querySelector(":scope > colgroup");
1998
2002
  if (o) {
1999
2003
  let e = [];
2000
2004
  for (const t of o.querySelectorAll(":scope > col")) {
2001
2005
  let n = t.style.width || "";
2002
- if (!Ke.test(n) && (n = t.getAttribute("width") || "", !/^\d+$/.test(n))) {
2006
+ if (!Je.test(n) && (n = t.getAttribute("width") || "", !/^\d+$/.test(n))) {
2003
2007
  e = void 0;
2004
2008
  break;
2005
2009
  }
@@ -2008,32 +2012,32 @@ function Tn(e) {
2008
2012
  e && n.setColWidths(e);
2009
2013
  }
2010
2014
  return {
2011
- after: (e) => $descendantsMatching(e, De),
2015
+ after: (e) => $descendantsMatching(e, ot),
2012
2016
  node: n
2013
2017
  };
2014
2018
  }
2015
- function Fn() {
2016
- return $applyNodeReplacement(new vn());
2019
+ function Hn() {
2020
+ return $applyNodeReplacement(new Wn());
2017
2021
  }
2018
- function Rn(e) {
2019
- return e instanceof vn;
2022
+ function Bn(e) {
2023
+ return e instanceof Wn;
2020
2024
  }
2021
- function On(e) {
2022
- De(e.getParent()) ? e.isEmpty() && e.append($createParagraphNode()) : e.remove();
2025
+ function Pn(e) {
2026
+ ot(e.getParent()) ? e.isEmpty() && e.append($createParagraphNode()) : e.remove();
2023
2027
  }
2024
- function Kn(e) {
2025
- Rn(e.getParent()) ? $unwrapAndFilterDescendants(e, We) : e.remove();
2028
+ function Dn(e) {
2029
+ Bn(e.getParent()) ? $unwrapAndFilterDescendants(e, Ge) : e.remove();
2026
2030
  }
2027
- function An(e) {
2028
- $unwrapAndFilterDescendants(e, De);
2029
- const [t] = bt(e, null, null), n = t.reduce((e, t) => Math.max(e, t.length), 0), o = e.getChildren();
2031
+ function In(e) {
2032
+ $unwrapAndFilterDescendants(e, ot);
2033
+ const [t] = kt(e, null, null), n = t.reduce((e, t) => Math.max(e, t.length), 0), o = e.getChildren();
2030
2034
  for (let e = 0; e < t.length; ++e) {
2031
2035
  const r = o[e];
2032
2036
  if (!r) continue;
2033
- De(r) || Le(254, r.constructor.name, r.getType());
2037
+ ot(r) || Ze(254, r.constructor.name, r.getType());
2034
2038
  const l = t[e].reduce((e, t) => t ? 1 + e : e, 0);
2035
2039
  if (l !== n) for (let e = l; e < n; ++e) {
2036
- const e = $e();
2040
+ const e = Ve();
2037
2041
  e.append($createParagraphNode()), r.append(e);
2038
2042
  }
2039
2043
  }
@@ -2048,45 +2052,45 @@ function An(e) {
2048
2052
  e.setColWidths(t);
2049
2053
  }
2050
2054
  }
2051
- function En(e) {
2055
+ function Un(e) {
2052
2056
  if (e.detail < 3 || !isDOMNode(e.target)) return !1;
2053
2057
  const t = $getNearestNodeFromDOMNode(e.target);
2054
2058
  if (null === t) return !1;
2055
2059
  const o = $findMatchingParent(t, (e) => $isElementNode(e) && !e.isInline());
2056
2060
  if (null === o) return !1;
2057
- return !!We(o.getParent()) && (o.select(0), !0);
2061
+ return !!Ge(o.getParent()) && (o.select(0), !0);
2058
2062
  }
2059
- function kn() {
2063
+ function Jn() {
2060
2064
  const e = $getSelection();
2061
2065
  if (!$isRangeSelection(e)) return !1;
2062
- const t = hn(e.anchor.getNode());
2066
+ const t = Nn(e.anchor.getNode());
2063
2067
  if (null === t) return !1;
2064
2068
  const n = $getRoot();
2065
2069
  if (!n.is(t.getParent()) || 1 !== n.getChildrenSize()) return !1;
2066
- const [o] = bt(t, null, null);
2070
+ const [o] = kt(t, null, null);
2067
2071
  if (0 === o.length || 0 === o[0].length) return !1;
2068
2072
  const r = o[0][0];
2069
2073
  if (!r || !r.cell) return !1;
2070
2074
  const l = o[o.length - 1], s = l[l.length - 1];
2071
2075
  if (!s || !s.cell) return !1;
2072
- return $setSelection(At(t, r.cell, s.cell)), !0;
2076
+ return $setSelection(It(t, r.cell, s.cell)), !0;
2073
2077
  }
2074
- function Mn(e) {
2075
- return e.registerNodeTransform(Ee, (e) => {
2078
+ function Xn(e) {
2079
+ return e.registerNodeTransform(Ye, (e) => {
2076
2080
  if (e.getColSpan() > 1 || e.getRowSpan() > 1) {
2077
- const [, , t] = yt(e), [n] = wt(t, e, e), o = n.length, r = n[0].length;
2081
+ const [, , t] = Mt(e), [n] = Et(t, e, e), o = n.length, r = n[0].length;
2078
2082
  let l = t.getFirstChild();
2079
- De(l) || Le(175);
2083
+ ot(l) || Ze(175);
2080
2084
  const i = [];
2081
2085
  for (let e = 0; e < o; e++) {
2082
- 0 !== e && (l = l.getNextSibling(), De(l) || Le(175));
2086
+ 0 !== e && (l = l.getNextSibling(), ot(l) || Ze(175));
2083
2087
  let t = null;
2084
2088
  for (let o = 0; o < r; o++) {
2085
2089
  const r = n[e][o], c = r.cell;
2086
2090
  if (r.startRow === e && r.startColumn === o) t = c, i.push(c);
2087
2091
  else if (c.getColSpan() > 1 || c.getRowSpan() > 1) {
2088
- We(c) || Le(176);
2089
- const e = $e(c.__headerState);
2092
+ Ge(c) || Ze(176);
2093
+ const e = Ve(c.__headerState);
2090
2094
  null !== t ? t.insertAfter(e) : $insertFirst(l, e);
2091
2095
  }
2092
2096
  }
@@ -2095,17 +2099,17 @@ function Mn(e) {
2095
2099
  }
2096
2100
  });
2097
2101
  }
2098
- function $n(e, t = !0) {
2099
- const n = new Mt(), o = (o, r, l) => {
2100
- const s = Lt(o, l), i = Jt(o, s, e, t, n);
2102
+ function Yn(e, t = !0) {
2103
+ const n = new Xt(), o = (o, r, l) => {
2104
+ const s = Vt(o, l), i = on(o, s, e, t, n);
2101
2105
  n.observers.set(r, [i, s]);
2102
2106
  };
2103
- return mergeRegister(Ut(e, n), e.registerCommand(SELECTION_CHANGE_COMMAND, () => Xt(n, e), COMMAND_PRIORITY_HIGH), e.registerMutationListener(vn, (t) => {
2107
+ return mergeRegister(nn(e, n), e.registerCommand(SELECTION_CHANGE_COMMAND, () => rn(n, e), COMMAND_PRIORITY_HIGH), e.registerMutationListener(Wn, (t) => {
2104
2108
  e.getEditorState().read(() => {
2105
2109
  for (const [e, r] of t) {
2106
2110
  const t = n.observers.get(e);
2107
2111
  if ("created" === r || "updated" === r) {
2108
- const { tableNode: r, tableElement: l } = kt(e);
2112
+ const { tableNode: r, tableElement: l } = Jt(e);
2109
2113
  void 0 === t ? o(r, e, l) : l !== t[1] && (t[0].removeListeners(), n.observers.delete(e), o(r, e, l));
2110
2114
  } else "destroyed" === r && void 0 !== t && (t[0].removeListeners(), n.observers.delete(e));
2111
2115
  }
@@ -2114,56 +2118,56 @@ function $n(e, t = !0) {
2114
2118
  for (const [, [e]] of n.observers) e.removeListeners();
2115
2119
  });
2116
2120
  }
2117
- function Wn(e, t) {
2118
- e.hasNodes([vn]) || Le(255);
2121
+ function qn(e, t) {
2122
+ e.hasNodes([Wn]) || Ze(255);
2119
2123
  const { hasNestedTables: o = signal(!1) } = t ?? {};
2120
- return mergeRegister(e.registerCommand(ze, (e) => function({ rows: e, columns: t, includeHeaders: n }, o) {
2124
+ return mergeRegister(e.registerCommand(Qe, (e) => function({ rows: e, columns: t, includeHeaders: n }, o) {
2121
2125
  const r = $getSelection() || $getPreviousSelection();
2122
2126
  if (!r || !$isRangeSelection(r)) return !1;
2123
- if (!o && hn(r.anchor.getNode())) return !1;
2124
- const l = Xe(Number(e), Number(t), n);
2127
+ if (!o && Nn(r.anchor.getNode())) return !1;
2128
+ const l = rt(Number(e), Number(t), n);
2125
2129
  $insertNodeToNearestRoot(l);
2126
2130
  const s = l.getFirstDescendant();
2127
2131
  return $isTextNode(s) && s.select(), !0;
2128
2132
  }(e, o.peek()), COMMAND_PRIORITY_EDITOR), e.registerCommand(SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, (t, r) => e === r && function(e, t) {
2129
2133
  const { nodes: o, selection: r } = e;
2130
- if (!o.some((e) => Rn(e) || $dfs(e).some((e) => Rn(e.node)))) return !1;
2131
- const l = Ot(r), s = $isRangeSelection(r);
2132
- if (!(s && null !== $findMatchingParent(r.anchor.getNode(), (e) => We(e)) && null !== $findMatchingParent(r.focus.getNode(), (e) => We(e)) || l)) return !1;
2133
- if (1 === o.length && Rn(o[0])) return function(e, t) {
2134
- const o = t.getStartEndPoints(), r = Ot(t);
2134
+ if (!o.some((e) => Bn(e) || $dfs(e).some((e) => Bn(e.node)))) return !1;
2135
+ const l = Pt(r), s = $isRangeSelection(r);
2136
+ if (!(s && null !== $findMatchingParent(r.anchor.getNode(), (e) => Ge(e)) && null !== $findMatchingParent(r.focus.getNode(), (e) => Ge(e)) || l)) return !1;
2137
+ if (1 === o.length && Bn(o[0])) return function(e, t) {
2138
+ const o = t.getStartEndPoints(), r = Pt(t);
2135
2139
  if (null === o) return !1;
2136
- const [l, s] = o, [i, c, a] = yt(l), u = $findMatchingParent(s.getNode(), (e) => We(e));
2137
- if (!(We(i) && We(u) && De(c) && Rn(a))) return !1;
2138
- const [h, d, f] = wt(a, i, u), [m] = bt(e, null, null), C = h.length, _ = C > 0 ? h[0].length : 0;
2139
- let S = d.startRow, w = d.startColumn, b = m.length, y = b > 0 ? m[0].length : 0;
2140
+ const [l, s] = o, [i, c, a] = Mt(l), u = $findMatchingParent(s.getNode(), (e) => Ge(e));
2141
+ if (!(Ge(i) && Ge(u) && ot(c) && Bn(a))) return !1;
2142
+ const [h, d, f] = Et(a, i, u), [m] = kt(e, null, null), C = h.length, _ = C > 0 ? h[0].length : 0;
2143
+ let S = d.startRow, b = d.startColumn, w = m.length, y = w > 0 ? m[0].length : 0;
2140
2144
  if (r) {
2141
- const e = Nt(h, d, f), t = e.maxRow - e.minRow + 1, n = e.maxColumn - e.minColumn + 1;
2142
- S = e.minRow, w = e.minColumn, b = Math.min(b, t), y = Math.min(y, n);
2145
+ const e = $t(h, d, f), t = e.maxRow - e.minRow + 1, n = e.maxColumn - e.minColumn + 1;
2146
+ S = e.minRow, b = e.minColumn, w = Math.min(w, t), y = Math.min(y, n);
2143
2147
  }
2144
2148
  let N = !1;
2145
- const v = Math.min(C, S + b) - 1, x = Math.min(_, w + y) - 1, T = /* @__PURE__ */ new Set();
2146
- for (let e = S; e <= v; e++) for (let t = w; t <= x; t++) {
2149
+ const v = Math.min(C, S + w) - 1, x = Math.min(_, b + y) - 1, T = /* @__PURE__ */ new Set();
2150
+ for (let e = S; e <= v; e++) for (let t = b; t <= x; t++) {
2147
2151
  const n = h[e][t];
2148
- T.has(n.cell.getKey()) || 1 === n.cell.__rowSpan && 1 === n.cell.__colSpan || (St(n.cell), T.add(n.cell.getKey()), N = !0);
2152
+ T.has(n.cell.getKey()) || 1 === n.cell.__rowSpan && 1 === n.cell.__colSpan || (Kt(n.cell), T.add(n.cell.getKey()), N = !0);
2149
2153
  }
2150
- let [F] = bt(a.getWritable(), null, null);
2151
- const R = b - C + S;
2152
- for (let e = 0; e < R; e++) rt(F[C - 1][0].cell);
2153
- const O = y - _ + w;
2154
- for (let e = 0; e < O; e++) ct(F[0][_ - 1].cell, !0, !1);
2155
- [F] = bt(a.getWritable(), null, null);
2156
- for (let e = S; e < S + b; e++) for (let t = w; t < w + y; t++) {
2157
- const n = e - S, o = t - w, r = m[n][o];
2154
+ let [F] = kt(a.getWritable(), null, null);
2155
+ const R = w - C + S;
2156
+ for (let e = 0; e < R; e++) pt(F[C - 1][0].cell);
2157
+ const O = y - _ + b;
2158
+ for (let e = 0; e < O; e++) bt(F[0][_ - 1].cell, !0, !1);
2159
+ [F] = kt(a.getWritable(), null, null);
2160
+ for (let e = S; e < S + w; e++) for (let t = b; t < b + y; t++) {
2161
+ const n = e - S, o = t - b, r = m[n][o];
2158
2162
  if (r.startRow !== n || r.startColumn !== o) continue;
2159
2163
  const l = r.cell;
2160
2164
  if (1 !== l.__rowSpan || 1 !== l.__colSpan) {
2161
- const n = [], o = Math.min(e + l.__rowSpan, S + b) - 1, r = Math.min(t + l.__colSpan, w + y) - 1;
2165
+ const n = [], o = Math.min(e + l.__rowSpan, S + w) - 1, r = Math.min(t + l.__colSpan, b + y) - 1;
2162
2166
  for (let l = e; l <= o; l++) for (let e = t; e <= r; e++) {
2163
2167
  const t = F[l][e];
2164
2168
  n.push(t.cell);
2165
2169
  }
2166
- pt(n), N = !0;
2170
+ Rt(n), N = !0;
2167
2171
  }
2168
2172
  const { cell: s } = F[e][t], i = l.getBackgroundColor();
2169
2173
  null != i && s.setBackgroundColor(i);
@@ -2174,20 +2178,20 @@ function Wn(e, t) {
2174
2178
  }), c.forEach((e) => e.remove());
2175
2179
  }
2176
2180
  if (r && N) {
2177
- const [e] = bt(a.getWritable(), null, null);
2181
+ const [e] = kt(a.getWritable(), null, null);
2178
2182
  e[d.startRow][d.startColumn].cell.selectEnd();
2179
2183
  }
2180
2184
  return !0;
2181
2185
  }(o[0], r);
2182
2186
  if (s && t.peek() && !function(e) {
2183
- if (Ot(e) && !e.focus.getNode().is(e.anchor.getNode())) return !0;
2184
- if ($isRangeSelection(e) && We(e.anchor.getNode()) && !e.anchor.getNode().is(e.focus.getNode())) return !0;
2187
+ if (Pt(e) && !e.focus.getNode().is(e.anchor.getNode())) return !0;
2188
+ if ($isRangeSelection(e) && Ge(e.anchor.getNode()) && !e.anchor.getNode().is(e.focus.getNode())) return !0;
2185
2189
  return !1;
2186
2190
  }(r)) return !1;
2187
2191
  return !0;
2188
- }(t, o), COMMAND_PRIORITY_EDITOR), e.registerCommand(SELECT_ALL_COMMAND, kn, COMMAND_PRIORITY_LOW), e.registerCommand(CLICK_COMMAND, En, COMMAND_PRIORITY_EDITOR), e.registerNodeTransform(vn, An), e.registerNodeTransform(He, Kn), e.registerNodeTransform(Ee, On));
2192
+ }(t, o), COMMAND_PRIORITY_EDITOR), e.registerCommand(SELECT_ALL_COMMAND, Jn, COMMAND_PRIORITY_LOW), e.registerCommand(CLICK_COMMAND, Un, COMMAND_PRIORITY_EDITOR), e.registerNodeTransform(Wn, In), e.registerNodeTransform(et, Dn), e.registerNodeTransform(Ye, Pn));
2189
2193
  }
2190
- const zn = defineExtension({
2194
+ const jn = defineExtension({
2191
2195
  build: (e, t, n) => namedSignals(t),
2192
2196
  config: safeCast({
2193
2197
  hasCellBackgroundColor: !0,
@@ -2198,19 +2202,110 @@ const zn = defineExtension({
2198
2202
  }),
2199
2203
  name: "@lexical/table/Table",
2200
2204
  nodes: () => [
2201
- vn,
2202
- He,
2203
- Ee
2205
+ Wn,
2206
+ et,
2207
+ Ye
2204
2208
  ],
2205
2209
  register(e, t, n) {
2206
2210
  const o = n.getOutput();
2207
2211
  return mergeRegister(effect(() => {
2208
2212
  const t = o.hasHorizontalScroll.value;
2209
- yn(e) !== t && (Nn(e, t), e.registerNodeTransform(vn, () => {})());
2210
- }), Wn(e, o), effect(() => $n(e, o.hasTabHandler.value)), effect(() => o.hasCellMerge.value ? void 0 : Mn(e)), effect(() => o.hasCellBackgroundColor.value ? void 0 : e.registerNodeTransform(Ee, (e) => {
2213
+ Mn(e) !== t && ($n(e, t), e.update($fullReconcile));
2214
+ }), qn(e, o), effect(() => Yn(e, o.hasTabHandler.value)), effect(() => o.hasCellMerge.value ? void 0 : Xn(e)), effect(() => o.hasCellBackgroundColor.value ? void 0 : e.registerNodeTransform(Ye, (e) => {
2211
2215
  null !== e.getBackgroundColor() && e.setBackgroundColor(null);
2212
2216
  })));
2213
2217
  }
2214
2218
  });
2219
+ function Vn(e) {
2220
+ const t = [];
2221
+ let n = null;
2222
+ const o = () => {
2223
+ if (null !== n) {
2224
+ const e = n.getFirstChild();
2225
+ $isLineBreakNode(e) && 1 === n.getChildrenSize() && e.remove();
2226
+ }
2227
+ };
2228
+ for (const r of e) $isInlineElementOrDecoratorNode(r) || $isTextNode(r) || $isLineBreakNode(r) ? null !== n ? n.append(r) : (n = $createParagraphNode().append(r), t.push(n)) : (o(), t.push(r), n = null);
2229
+ return o(), 0 === t.length && t.push($createParagraphNode()), t;
2230
+ }
2231
+ const Gn = {
2232
+ $accepts: ot,
2233
+ $packageRun: (e) => e.every(Ge) ? [nt().splice(0, 0, e)] : [],
2234
+ name: "TableSchema"
2235
+ }, Qn = {
2236
+ $accepts: Ge,
2237
+ name: "TableRowSchema"
2238
+ }, Zn = [
2239
+ defineImportRule({
2240
+ $import: (e, n) => {
2241
+ const o = Hn();
2242
+ n.hasAttribute("data-lexical-row-striping") && o.setRowStriping(!0), n.hasAttribute("data-lexical-frozen-column") && o.setFrozenColumns(1), n.hasAttribute("data-lexical-frozen-row") && o.setFrozenRows(1);
2243
+ const r = n.querySelector(":scope > colgroup");
2244
+ if (r) {
2245
+ let e = [];
2246
+ for (const t of r.querySelectorAll(":scope > col")) {
2247
+ let n = t.style.width || "";
2248
+ if (!Je.test(n) && (n = t.getAttribute("width") || "", !/^\d+$/.test(n))) {
2249
+ e = void 0;
2250
+ break;
2251
+ }
2252
+ e.push(parseFloat(n));
2253
+ }
2254
+ e && o.setColWidths(e);
2255
+ }
2256
+ return [o.splice(0, 0, $descendantsMatching(e.$importChildren(n), ot))];
2257
+ },
2258
+ match: sel.tag("table"),
2259
+ name: "@lexical/table/table"
2260
+ }),
2261
+ defineImportRule({
2262
+ $import: (e, n) => [nt(Je.test(n.style.height) ? parseFloat(n.style.height) : void 0).splice(0, 0, $descendantsMatching(e.$importChildren(n), Ge))],
2263
+ match: sel.tag("tr"),
2264
+ name: "@lexical/table/tr"
2265
+ }),
2266
+ defineImportRule({
2267
+ $import: (e, t) => {
2268
+ const n = "TH" === t.nodeName, o = Je.test(t.style.width) ? parseFloat(t.style.width) : void 0;
2269
+ let r = Xe.NO_STATUS;
2270
+ if (n) {
2271
+ const e = t.getAttribute("scope");
2272
+ if ("col" === e) r = Xe.COLUMN;
2273
+ else if ("row" === e) r = Xe.ROW;
2274
+ else {
2275
+ const e = t.parentElement, n = isHTMLTableRowElement(e) && (e.parentElement && "THEAD" === e.parentElement.nodeName || 0 === e.rowIndex), o = 0 === t.cellIndex;
2276
+ n && (r |= Xe.ROW), o && (r |= Xe.COLUMN), r === Xe.NO_STATUS && (r = Xe.ROW);
2277
+ }
2278
+ }
2279
+ const l = Ve(r, t.colSpan, o);
2280
+ l.__rowSpan = t.rowSpan;
2281
+ const s = t.style.backgroundColor;
2282
+ "" !== s && (l.__backgroundColor = s);
2283
+ const i = t.style.verticalAlign;
2284
+ (function(e) {
2285
+ return "middle" === e || "bottom" === e;
2286
+ })(i) && (l.__verticalAlign = i);
2287
+ const c = e.get(ImportTextFormat), a = c | function(e) {
2288
+ let t = 0;
2289
+ const n = e.fontWeight;
2290
+ "700" !== n && "bold" !== n || (t |= IS_BOLD), "italic" === e.fontStyle && (t |= IS_ITALIC);
2291
+ const o = (e.textDecoration || "").split(" ");
2292
+ return o.includes("underline") && (t |= IS_UNDERLINE), o.includes("line-through") && (t |= IS_STRIKETHROUGH), t;
2293
+ }(t.style), u = e.get(ImportTextStyle), h = t.style.color, d = h ? {
2294
+ ...u,
2295
+ color: h
2296
+ } : u, f = [];
2297
+ return a !== c && f.push(contextValue(ImportTextFormat, a)), d !== u && f.push(contextValue(ImportTextStyle, d)), [l.splice(0, 0, Vn(e.$importChildren(t, { context: f })))];
2298
+ },
2299
+ match: sel.tag("td", "th"),
2300
+ name: "@lexical/table/cell"
2301
+ })
2302
+ ], eo = defineExtension({
2303
+ dependencies: [
2304
+ CoreImportExtension,
2305
+ jn,
2306
+ configExtension(DOMImportExtension, { rules: Zn })
2307
+ ],
2308
+ name: "@lexical/table/Import"
2309
+ });
2215
2310
  //#endregion
2216
- export { wt as $computeTableMap, bt as $computeTableMapSkipCellCheck, $e as $createTableCellNode, Fn as $createTableNode, Xe as $createTableNodeWithDimensions, Pe as $createTableRowNode, Kt as $createTableSelection, At as $createTableSelectionFrom, at as $deleteTableColumn, dt as $deleteTableColumnAtSelection, ft as $deleteTableColumn__EXPERIMENTAL, ut as $deleteTableRowAtSelection, ht as $deleteTableRow__EXPERIMENTAL, un as $findCellNode, hn as $findTableNode, xn as $getElementForTableNode, yt as $getNodeTriplet, kt as $getTableAndElementByKey, Ye as $getTableCellNodeFromLexicalNode, Tt as $getTableCellNodeRect, Ge as $getTableColumnIndexFromTableCellNode, je as $getTableNodeFromLexicalNodeOrThrow, Ve as $getTableRowIndexFromTableCellNode, qe as $getTableRowNodeFromTableCellNodeOrThrow, lt as $insertTableColumn, st as $insertTableColumnAtSelection, it as $insertTableColumn__EXPERIMENTAL, et as $insertTableRow, nt as $insertTableRowAtSelection, ot as $insertTableRow__EXPERIMENTAL, yn as $isScrollableTablesActive, vt as $isSimpleTable, We as $isTableCellNode, Rn as $isTableNode, De as $isTableRowNode, Ot as $isTableSelection, pt as $mergeCells, xt as $moveTableColumn, Ze as $removeTableRowAtIndex, _t as $unmergeCell, ze as INSERT_TABLE_COMMAND, Ae as TableCellHeaderStates, Ee as TableCellNode, zn as TableExtension, vn as TableNode, $t as TableObserver, He as TableRowNode, Jt as applyTableHandlers, jt as getDOMCellFromTarget, Lt as getTableElement, qt as getTableObserverFromTableElement, Mn as registerTableCellUnmergeTransform, Wn as registerTablePlugin, $n as registerTableSelectionObserver, Nn as setScrollableTablesActive };
2311
+ export { Et as $computeTableMap, kt as $computeTableMapSkipCellCheck, Ve as $createTableCellNode, Hn as $createTableNode, rt as $createTableNodeWithDimensions, nt as $createTableRowNode, Dt as $createTableSelection, It as $createTableSelectionFrom, wt as $deleteTableColumn, vt as $deleteTableColumnAtSelection, xt as $deleteTableColumn__EXPERIMENTAL, yt as $deleteTableRowAtSelection, Nt as $deleteTableRow__EXPERIMENTAL, yn as $findCellNode, Nn as $findTableNode, zn as $getElementForTableNode, Mt as $getNodeTriplet, Jt as $getTableAndElementByKey, lt as $getTableCellNodeFromLexicalNode, Lt as $getTableCellNodeRect, at as $getTableColumnIndexFromTableCellNode, it as $getTableNodeFromLexicalNodeOrThrow, ct as $getTableRowIndexFromTableCellNode, st as $getTableRowNodeFromTableCellNodeOrThrow, Ct as $insertTableColumn, _t as $insertTableColumnAtSelection, St as $insertTableColumn__EXPERIMENTAL, dt as $insertTableRow, gt as $insertTableRowAtSelection, mt as $insertTableRow__EXPERIMENTAL, Mn as $isScrollableTablesActive, Wt as $isSimpleTable, Ge as $isTableCellNode, Bn as $isTableNode, ot as $isTableRowNode, Pt as $isTableSelection, Rt as $mergeCells, zt as $moveTableColumn, ht as $removeTableRowAtIndex, At as $unmergeCell, Qe as INSERT_TABLE_COMMAND, Xe as TableCellHeaderStates, Ye as TableCellNode, jn as TableExtension, eo as TableImportExtension, Zn as TableImportRules, Wn as TableNode, Yt as TableObserver, et as TableRowNode, Qn as TableRowSchema, Gn as TableSchema, on as applyTableHandlers, cn as getDOMCellFromTarget, Vt as getTableElement, sn as getTableObserverFromTableElement, Xn as registerTableCellUnmergeTransform, qn as registerTablePlugin, Yn as registerTableSelectionObserver, $n as setScrollableTablesActive };