@uva-glass/component-library 1.59.2 → 1.61.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 (80) hide show
  1. package/dist/{Lexical.prod-CO0gPAfo.js → Lexical.prod-qM_1BY0u.js} +961 -952
  2. package/dist/Lexical.prod-qM_1BY0u.js.map +1 -0
  3. package/dist/{LexicalUtils.prod-PbdOb6JG.js → LexicalUtils.prod-BFSPHHi1.js} +20 -20
  4. package/dist/{LexicalUtils.prod-PbdOb6JG.js.map → LexicalUtils.prod-BFSPHHi1.js.map} +1 -1
  5. package/dist/ListPlugin-Bhkh3IBK.js +625 -0
  6. package/dist/ListPlugin-Bhkh3IBK.js.map +1 -0
  7. package/dist/RteEditor.module-Cku3JY-0.js +29 -0
  8. package/dist/RteEditor.module-Cku3JY-0.js.map +1 -0
  9. package/dist/TablePlugin-CLPV2OjO.js +294 -0
  10. package/dist/TablePlugin-CLPV2OjO.js.map +1 -0
  11. package/dist/assets/EditorHeader.css +1 -1
  12. package/dist/assets/Periods.css +1 -1
  13. package/dist/assets/RteEditor.css +1 -1
  14. package/dist/assets/TableCellContextMenu.css +1 -1
  15. package/dist/assets/TablePlugin.css +1 -1
  16. package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
  17. package/dist/components/InputField/InputField.stories.js +2 -2
  18. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  19. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  20. package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
  21. package/dist/components/MultiSelect/index.js +1 -1
  22. package/dist/components/Periods/Periods.js +19 -19
  23. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
  24. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +19 -19
  25. package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -1
  26. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.d.ts +1 -6
  27. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +34 -20
  28. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js.map +1 -1
  29. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +36 -31
  30. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
  31. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.d.ts +3 -3
  32. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +4 -4
  33. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.d.ts +7 -6
  34. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +157 -54
  35. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  36. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.d.ts +1 -3
  37. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +5 -6
  38. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js.map +1 -1
  39. package/dist/components/RteEditor/Plugins/LinkPlugin/index.js +3 -2
  40. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.d.ts +1 -6
  41. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +10 -31
  42. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js.map +1 -1
  43. package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
  44. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
  45. package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.d.ts +2 -1
  46. package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js +104 -31
  47. package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js.map +1 -1
  48. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +6 -5
  49. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
  50. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +1 -1
  51. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  52. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.d.ts +6 -7
  53. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +42 -46
  54. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
  55. package/dist/components/RteEditor/Plugins/index.js +13 -12
  56. package/dist/components/RteEditor/RteEditor.d.ts +13 -4
  57. package/dist/components/RteEditor/RteEditor.js +593 -601
  58. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  59. package/dist/components/RteEditor/UvaTheme/UvaTheme.js +1 -1
  60. package/dist/components/RteEditor/hooks/components/Flyout.js.map +1 -1
  61. package/dist/components/RteEditor/hooks/useTranslation.d.ts +98 -6
  62. package/dist/components/RteEditor/translations.d.ts +98 -6
  63. package/dist/components/RteEditor/translations.js +104 -12
  64. package/dist/components/RteEditor/translations.js.map +1 -1
  65. package/dist/components/index.js +1 -1
  66. package/dist/{helpers-Ec7CfNnA.js → helpers-BB6Byf50.js} +92 -103
  67. package/dist/helpers-BB6Byf50.js.map +1 -0
  68. package/dist/{helpers-BewZrn6E.js → helpers-D9T1Tgkj.js} +581 -515
  69. package/dist/helpers-D9T1Tgkj.js.map +1 -0
  70. package/dist/index.js +1 -1
  71. package/package.json +9 -9
  72. package/dist/Lexical.prod-CO0gPAfo.js.map +0 -1
  73. package/dist/LexicalList.prod-BceA-cJD.js +0 -562
  74. package/dist/LexicalList.prod-BceA-cJD.js.map +0 -1
  75. package/dist/RteEditor.module-Dz9a8vaK.js +0 -29
  76. package/dist/RteEditor.module-Dz9a8vaK.js.map +0 -1
  77. package/dist/TablePlugin-Cj6IBz2k.js +0 -249
  78. package/dist/TablePlugin-Cj6IBz2k.js.map +0 -1
  79. package/dist/helpers-BewZrn6E.js.map +0 -1
  80. package/dist/helpers-Ec7CfNnA.js.map +0 -1
@@ -1,67 +1,69 @@
1
- import { i as Qe, $ as ue, t as N, U as Ve } from "./LexicalUtils.prod-PbdOb6JG.js";
2
- import { T as _t, X as Nt, i as Ze, y as E, j as xt, k as et, n as tt, w as ve, q as nt, l as ne, v as ot, S as Pe, b as rt, E as Ne, C as De, s as Ae, P as G, m as D, I as k, u as vt, z as st, B as Tt, M as Ot, D as L, G as Et, H as Mt, f as Te, o as Oe, p as Ee, J as Ft, t as Rt, N as U, O as Kt, Q as V, R as kt, U as Pt, V as Dt, W as At, Z as Ht, a0 as He, a1 as Bt, a2 as Lt, a3 as Wt, a4 as It, d as zt, a5 as Jt, a6 as Ut, a7 as Yt, a8 as Xt, a9 as se, A as jt, aa as q, ab as qt, a as $t, ac as ae, ad as Gt, F as Qt, ae as Vt, af as Zt, ag as Be } from "./Lexical.prod-CO0gPAfo.js";
3
- function en(n) {
1
+ import { i as et, t as _, $ as ue, U as tt } from "./LexicalUtils.prod-BFSPHHi1.js";
2
+ import { C as Tt, X as Et, k as nt, b as T, n as Ot, N as ot, J as rt, w as Ee, p as st, c as $, v as lt, q as Le, a as it, P as ve, s as He, T as Be, F as V, x as A, A as D, u as Mt, z as at, B as Ft, E as Rt, G as B, H as Kt, I as kt, f as Oe, l as Me, y as Fe, U as Dt, t as Pt, Q as Y, R as At, V as Q, W as Lt, Y as Ht, a0 as Bt, a1 as Wt, a2 as It, a3 as We, a4 as zt, a5 as Ut, a6 as Jt, a7 as Yt, d as Xt, a8 as jt, a9 as qt, aa as $t, ab as Gt, e as se, M as Vt, ac as q, ad as Zt, o as Qt, ae, af as en, D as ct, ag as tn, ah as nn, ai as on, aj as Ie } from "./Lexical.prod-qM_1BY0u.js";
3
+ function rn(n) {
4
4
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
5
5
  }
6
- en(function(n) {
6
+ rn(function(n) {
7
7
  const e = new URLSearchParams();
8
8
  e.append("code", n);
9
9
  for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
10
10
  throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
11
11
  });
12
- const tn = /* @__PURE__ */ new Map();
13
- function nn(n) {
14
- const e = {}, t = n.split(";");
12
+ const sn = /* @__PURE__ */ new Map();
13
+ function ln(n) {
14
+ const e = {};
15
+ if (!n) return e;
16
+ const t = n.split(";");
15
17
  for (const o of t) if (o !== "") {
16
18
  const [s, r] = o.split(/:([^]+)/);
17
19
  s && r && (e[s.trim()] = r.trim());
18
20
  }
19
21
  return e;
20
22
  }
21
- function lt(n, e) {
23
+ function ut(n, e) {
22
24
  const t = n.getStartEndPoints();
23
25
  if (e.isSelected(n) && !e.isSegmented() && !e.isToken() && t !== null) {
24
26
  const [o, s] = t, r = n.isBackward(), l = o.getNode(), a = s.getNode(), d = e.is(l), h = e.is(a);
25
27
  if (d || h) {
26
- const [i, c] = _t(n), u = l.is(a), g = e.is(r ? a : l), f = e.is(r ? l : a);
27
- let m, w = 0;
28
- return u ? (w = i > c ? c : i, m = i > c ? i : c) : g ? (w = r ? c : i, m = void 0) : f && (w = 0, m = r ? i : c), e.__text = e.__text.slice(w, m), e;
28
+ const [i, c] = Tt(n), u = l.is(a), g = e.is(r ? a : l), f = e.is(r ? l : a);
29
+ let p, w = 0;
30
+ return u ? (w = i > c ? c : i, p = i > c ? i : c) : g ? (w = r ? c : i, p = void 0) : f && (w = 0, p = r ? i : c), e.__text = e.__text.slice(w, p), e;
29
31
  }
30
32
  }
31
33
  return e;
32
34
  }
33
- function on(n) {
34
- const e = n.getStyle(), t = nn(e);
35
- tn.set(e, t);
35
+ function an(n) {
36
+ const e = n.getStyle(), t = ln(e);
37
+ sn.set(e, t);
36
38
  }
37
- function Kn(n, e) {
38
- const t = Nt(n.focus, e);
39
- return Ze(t) && !t.isIsolated() || E(t) && !t.isInline() && !t.canBeEmpty();
39
+ function Ln(n, e) {
40
+ const t = Et(n.focus, e);
41
+ return nt(t) && !t.isIsolated() || T(t) && !t.isInline() && !t.canBeEmpty();
40
42
  }
41
- function rn(n, e, t, o) {
43
+ function cn(n, e, t, o) {
42
44
  n.modify(e ? "extend" : "move", t, o);
43
45
  }
44
- function sn(n) {
46
+ function un(n) {
45
47
  const e = n.anchor.getNode();
46
- return (xt(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
48
+ return (Ot(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
47
49
  }
48
- function kn(n, e, t) {
49
- const o = sn(n);
50
- rn(n, e, t ? !o : o, "character");
50
+ function Hn(n, e, t) {
51
+ const o = un(n);
52
+ cn(n, e, t ? !o : o, "character");
51
53
  }
52
- function ln(n, e) {
54
+ function dn(n, e) {
53
55
  const t = e.body ? e.body.childNodes : [];
54
56
  let o = [];
55
57
  const s = [];
56
58
  for (let r = 0; r < t.length; r++) {
57
59
  const l = t[r];
58
- if (!at.has(l.nodeName)) {
59
- const a = ct(l, n, s, !1);
60
+ if (!ht.has(l.nodeName)) {
61
+ const a = gt(l, n, s, !1);
60
62
  a !== null && (o = o.concat(a));
61
63
  }
62
64
  }
63
65
  return function(r) {
64
- for (const l of r) l.getNextSibling() instanceof et && l.insertAfter(tt());
66
+ for (const l of r) l.getNextSibling() instanceof ot && l.insertAfter(rt());
65
67
  for (const l of r) {
66
68
  const a = l.getChildren();
67
69
  for (const d of a) l.insertBefore(d);
@@ -69,158 +71,160 @@ function ln(n, e) {
69
71
  }
70
72
  }(s), o;
71
73
  }
72
- function an(n, e) {
74
+ function hn(n, e) {
73
75
  if (typeof document > "u" || typeof window > "u" && global.window === void 0) throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
74
- const t = document.createElement("div"), o = ve().getChildren();
76
+ const t = document.createElement("div"), o = Ee().getChildren();
75
77
  for (let s = 0; s < o.length; s++)
76
- it(n, o[s], t, e);
78
+ dt(n, o[s], t, e);
77
79
  return t.innerHTML;
78
80
  }
79
- function it(n, e, t, o = null) {
81
+ function dt(n, e, t, o = null) {
80
82
  let s = o === null || e.isSelected(o);
81
- const r = E(e) && e.excludeFromCopy("html");
83
+ const r = T(e) && e.excludeFromCopy("html");
82
84
  let l = e;
83
85
  if (o !== null) {
84
- let g = nt(e);
85
- g = ne(g) && o !== null ? lt(o, g) : g, l = g;
86
+ let g = st(e);
87
+ g = $(g) && o !== null ? ut(o, g) : g, l = g;
86
88
  }
87
- const a = E(l) ? l.getChildren() : [], d = n._nodes.get(l.getType());
89
+ const a = T(l) ? l.getChildren() : [], d = n._nodes.get(l.getType());
88
90
  let h;
89
91
  h = d && d.exportDOM !== void 0 ? d.exportDOM(n, l) : l.exportDOM(n);
90
92
  const { element: i, after: c } = h;
91
93
  if (!i) return !1;
92
94
  const u = document.createDocumentFragment();
93
95
  for (let g = 0; g < a.length; g++) {
94
- const f = a[g], m = it(n, f, u, o);
95
- !s && E(e) && m && e.extractWithChild(f, o, "html") && (s = !0);
96
+ const f = a[g], p = dt(n, f, u, o);
97
+ !s && T(e) && p && e.extractWithChild(f, o, "html") && (s = !0);
96
98
  }
97
99
  if (s && !r) {
98
- if ((ot(i) || Pe(i)) && i.append(u), t.append(i), c) {
100
+ if ((lt(i) || Le(i)) && i.append(u), t.append(i), c) {
99
101
  const g = c.call(l, i);
100
- g && (Pe(i) ? i.replaceChildren(g) : i.replaceWith(g));
102
+ g && (Le(i) ? i.replaceChildren(g) : i.replaceWith(g));
101
103
  }
102
104
  } else t.append(u);
103
105
  return s;
104
106
  }
105
- const at = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
106
- function ct(n, e, t, o, s = /* @__PURE__ */ new Map(), r) {
107
+ const ht = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
108
+ function gt(n, e, t, o, s = /* @__PURE__ */ new Map(), r) {
107
109
  let l = [];
108
- if (at.has(n.nodeName)) return l;
110
+ if (ht.has(n.nodeName)) return l;
109
111
  let a = null;
110
- const d = function(f, m) {
111
- const { nodeName: w } = f, C = m._htmlConversions.get(w.toLowerCase());
112
- let _ = null;
113
- if (C !== void 0) for (const T of C) {
114
- const v = T(f);
115
- v !== null && (_ === null || (_.priority || 0) < (v.priority || 0)) && (_ = v);
112
+ const d = function(f, p) {
113
+ const { nodeName: w } = f, C = p._htmlConversions.get(w.toLowerCase());
114
+ let x = null;
115
+ if (C !== void 0) for (const E of C) {
116
+ const v = E(f);
117
+ v !== null && (x === null || (x.priority || 0) < (v.priority || 0)) && (x = v);
116
118
  }
117
- return _ !== null ? _.conversion : null;
119
+ return x !== null ? x.conversion : null;
118
120
  }(n, e), h = d ? d(n) : null;
119
121
  let i = null;
120
122
  if (h !== null) {
121
123
  i = h.after;
122
124
  const f = h.node;
123
125
  if (a = Array.isArray(f) ? f[f.length - 1] : f, a !== null) {
124
- for (const [, m] of s) if (a = m(a, r), !a) break;
126
+ for (const [, p] of s) if (a = p(a, r), !a) break;
125
127
  a && l.push(...Array.isArray(f) ? f : [a]);
126
128
  }
127
129
  h.forChild != null && s.set(n.nodeName, h.forChild);
128
130
  }
129
131
  const c = n.childNodes;
130
132
  let u = [];
131
- const g = (a == null || !rt(a)) && (a != null && Ne(a) || o);
132
- for (let f = 0; f < c.length; f++) u.push(...ct(c[f], e, t, g, new Map(s), a));
133
- return i != null && (u = i(u)), De(n) && (u = cn(n, u, g ? () => {
134
- const f = new et();
133
+ const g = (a == null || !it(a)) && (a != null && ve(a) || o);
134
+ for (let f = 0; f < c.length; f++) u.push(...gt(c[f], e, t, g, new Map(s), a));
135
+ return i != null && (u = i(u)), He(n) && (u = gn(n, u, g ? () => {
136
+ const f = new ot();
135
137
  return t.push(f), f;
136
- } : G)), a == null ? u.length > 0 ? l = l.concat(u) : De(n) && function(f) {
137
- return f.nextSibling == null || f.previousSibling == null ? !1 : Ae(f.nextSibling) && Ae(f.previousSibling);
138
- }(n) && (l = l.concat(tt())) : E(a) && a.append(...u), l;
138
+ } : V)), a == null ? u.length > 0 ? l = l.concat(u) : He(n) && function(f) {
139
+ return f.nextSibling == null || f.previousSibling == null ? !1 : Be(f.nextSibling) && Be(f.previousSibling);
140
+ }(n) && (l = l.concat(rt())) : T(a) && a.append(...u), l;
139
141
  }
140
- function cn(n, e, t) {
142
+ function gn(n, e, t) {
141
143
  const o = n.style.textAlign, s = [];
142
144
  let r = [];
143
145
  for (let l = 0; l < e.length; l++) {
144
146
  const a = e[l];
145
- if (Ne(a)) o && !a.getFormat() && a.setFormat(o), s.push(a);
146
- else if (r.push(a), l === e.length - 1 || l < e.length - 1 && Ne(e[l + 1])) {
147
+ if (ve(a)) o && !a.getFormat() && a.setFormat(o), s.push(a);
148
+ else if (r.push(a), l === e.length - 1 || l < e.length - 1 && ve(e[l + 1])) {
147
149
  const d = t();
148
150
  d.setFormat(o), d.append(...r), s.push(d), r = [];
149
151
  }
150
152
  }
151
153
  return s;
152
154
  }
153
- function un(n) {
155
+ function fn(n) {
154
156
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
155
157
  }
156
- var pe = un(function(n) {
158
+ var we = fn(function(n) {
157
159
  const e = new URLSearchParams();
158
160
  e.append("code", n);
159
161
  for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
160
162
  throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
161
163
  });
162
- const dn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, ut = (n) => dn ? (n || window).getSelection() : null;
163
- function hn(n, e = k()) {
164
- return e == null && pe(166), D(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : an(n, e);
164
+ const mn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, ft = (n) => mn ? (n || window).getSelection() : null;
165
+ function pn(n, e = D()) {
166
+ return e == null && we(166), A(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : hn(n, e);
165
167
  }
166
- function gn(n, e = k()) {
167
- return e == null && pe(166), D(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(fn(n, e));
168
+ function wn(n, e = D()) {
169
+ return e == null && we(166), A(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(Cn(n, e));
168
170
  }
169
- function Pn(n, e, t) {
171
+ function Bn(n, e, t) {
170
172
  const o = n.getData("application/x-lexical-editor");
171
173
  if (o) try {
172
174
  const l = JSON.parse(o);
173
175
  if (l.namespace === t._config.namespace && Array.isArray(l.nodes))
174
- return Le(t, mn(l.nodes), e);
176
+ return ze(t, Sn(l.nodes), e);
175
177
  } catch {
176
178
  }
177
179
  const s = n.getData("text/html");
178
180
  if (s) try {
179
- const l = new DOMParser().parseFromString(s, "text/html");
180
- return Le(t, ln(t, l), e);
181
+ const l = new DOMParser().parseFromString(function(a) {
182
+ return window.trustedTypes && window.trustedTypes.createPolicy ? window.trustedTypes.createPolicy("lexical", { createHTML: (d) => d }).createHTML(a) : a;
183
+ }(s), "text/html");
184
+ return ze(t, dn(t, l), e);
181
185
  } catch {
182
186
  }
183
187
  const r = n.getData("text/plain") || n.getData("text/uri-list");
184
- if (r != null) if (D(e)) {
188
+ if (r != null) if (A(e)) {
185
189
  const l = r.split(/(\r?\n|\t)/);
186
190
  l[l.length - 1] === "" && l.pop();
187
191
  for (let a = 0; a < l.length; a++) {
188
- const d = k();
189
- if (D(d)) {
192
+ const d = D();
193
+ if (A(d)) {
190
194
  const h = l[a];
191
195
  h === `
192
196
  ` || h === `\r
193
- ` ? d.insertParagraph() : h === " " ? d.insertNodes([vt()]) : d.insertText(h);
197
+ ` ? d.insertParagraph() : h === " " ? d.insertNodes([Mt()]) : d.insertText(h);
194
198
  }
195
199
  }
196
200
  } else e.insertRawText(r);
197
201
  }
198
- function Le(n, e, t) {
199
- n.dispatchCommand(st, { nodes: e, selection: t }) || t.insertNodes(e);
202
+ function ze(n, e, t) {
203
+ n.dispatchCommand(at, { nodes: e, selection: t }) || t.insertNodes(e);
200
204
  }
201
- function dt(n, e, t, o = []) {
205
+ function mt(n, e, t, o = []) {
202
206
  let s = e === null || t.isSelected(e);
203
- const r = E(t) && t.excludeFromCopy("html");
207
+ const r = T(t) && t.excludeFromCopy("html");
204
208
  let l = t;
205
209
  if (e !== null) {
206
- let h = nt(t);
207
- h = ne(h) && e !== null ? lt(e, h) : h, l = h;
210
+ let h = st(t);
211
+ h = $(h) && e !== null ? ut(e, h) : h, l = h;
208
212
  }
209
- const a = E(l) ? l.getChildren() : [], d = function(h) {
213
+ const a = T(l) ? l.getChildren() : [], d = function(h) {
210
214
  const i = h.exportJSON(), c = h.constructor;
211
- if (i.type !== c.getType() && pe(58, c.name), E(h)) {
215
+ if (i.type !== c.getType() && we(58, c.name), T(h)) {
212
216
  const u = i.children;
213
- Array.isArray(u) || pe(59, c.name);
217
+ Array.isArray(u) || we(59, c.name);
214
218
  }
215
219
  return i;
216
220
  }(l);
217
- if (ne(l)) {
221
+ if ($(l)) {
218
222
  const h = l.__text;
219
223
  h.length > 0 ? d.text = h : s = !1;
220
224
  }
221
225
  for (let h = 0; h < a.length; h++) {
222
- const i = a[h], c = dt(n, e, i, d.children);
223
- !s && E(t) && c && t.extractWithChild(i, e, "clone") && (s = !0);
226
+ const i = a[h], c = mt(n, e, i, d.children);
227
+ !s && T(t) && c && t.extractWithChild(i, e, "clone") && (s = !0);
224
228
  }
225
229
  if (s && !r) o.push(d);
226
230
  else if (Array.isArray(d.children)) for (let h = 0; h < d.children.length; h++) {
@@ -229,74 +233,74 @@ function dt(n, e, t, o = []) {
229
233
  }
230
234
  return s;
231
235
  }
232
- function fn(n, e) {
233
- const t = [], o = ve().getChildren();
236
+ function Cn(n, e) {
237
+ const t = [], o = Ee().getChildren();
234
238
  for (let s = 0; s < o.length; s++)
235
- dt(n, e, o[s], t);
239
+ mt(n, e, o[s], t);
236
240
  return { namespace: n._config.namespace, nodes: t };
237
241
  }
238
- function mn(n) {
242
+ function Sn(n) {
239
243
  const e = [];
240
244
  for (let t = 0; t < n.length; t++) {
241
- const o = n[t], s = Tt(o);
242
- ne(s) && on(s), e.push(s);
245
+ const o = n[t], s = Ft(o);
246
+ $(s) && an(s), e.push(s);
243
247
  }
244
248
  return e;
245
249
  }
246
- let Z = null;
247
- async function pn(n, e, t) {
248
- if (Z !== null) return !1;
250
+ let ee = null;
251
+ async function bn(n, e, t) {
252
+ if (ee !== null) return !1;
249
253
  if (e !== null) return new Promise((d, h) => {
250
254
  n.update(() => {
251
- d(We(n, e, t));
255
+ d(Ue(n, e, t));
252
256
  });
253
257
  });
254
- const o = n.getRootElement(), s = n._window == null ? window.document : n._window.document, r = ut(n._window);
258
+ const o = n.getRootElement(), s = n._window == null ? window.document : n._window.document, r = ft(n._window);
255
259
  if (o === null || r === null) return !1;
256
260
  const l = s.createElement("span");
257
261
  l.style.cssText = "position: fixed; top: -1000px;", l.append(s.createTextNode("#")), o.append(l);
258
262
  const a = new Range();
259
263
  return a.setStart(l, 0), a.setEnd(l, 1), r.removeAllRanges(), r.addRange(a), new Promise((d, h) => {
260
- const i = n.registerCommand(Ot, (c) => (Qe(c, ClipboardEvent) && (i(), Z !== null && (window.clearTimeout(Z), Z = null), d(We(n, c, t))), !0), L);
261
- Z = window.setTimeout(() => {
262
- i(), Z = null, d(!1);
264
+ const i = n.registerCommand(Rt, (c) => (et(c, ClipboardEvent) && (i(), ee !== null && (window.clearTimeout(ee), ee = null), d(Ue(n, c, t))), !0), B);
265
+ ee = window.setTimeout(() => {
266
+ i(), ee = null, d(!1);
263
267
  }, 50), s.execCommand("copy"), l.remove();
264
268
  });
265
269
  }
266
- function We(n, e, t) {
270
+ function Ue(n, e, t) {
267
271
  if (t === void 0) {
268
- const s = ut(n._window);
272
+ const s = ft(n._window);
269
273
  if (!s) return !1;
270
274
  const r = s.anchorNode, l = s.focusNode;
271
- if (r !== null && l !== null && !Et(n, r, l)) return !1;
272
- const a = k();
275
+ if (r !== null && l !== null && !Kt(n, r, l)) return !1;
276
+ const a = D();
273
277
  if (a === null) return !1;
274
- t = ht(a);
278
+ t = pt(a);
275
279
  }
276
280
  e.preventDefault();
277
281
  const o = e.clipboardData;
278
- return o !== null && (Cn(o, t), !0);
282
+ return o !== null && (_n(o, t), !0);
279
283
  }
280
- const wn = [["text/html", hn], ["application/x-lexical-editor", gn]];
281
- function ht(n = k()) {
284
+ const yn = [["text/html", pn], ["application/x-lexical-editor", wn]];
285
+ function pt(n = D()) {
282
286
  const e = { "text/plain": n ? n.getTextContent() : "" };
283
287
  if (n) {
284
- const t = Mt();
285
- for (const [o, s] of wn) {
288
+ const t = kt();
289
+ for (const [o, s] of yn) {
286
290
  const r = s(t, n);
287
291
  r !== null && (e[o] = r);
288
292
  }
289
293
  }
290
294
  return e;
291
295
  }
292
- function Cn(n, e) {
296
+ function _n(n, e) {
293
297
  for (const t in e) {
294
298
  const o = e[t];
295
299
  o !== void 0 && n.setData(t, o);
296
300
  }
297
301
  }
298
- const gt = /^(\d+(?:\.\d+)?)px$/, W = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
299
- class de extends Ee {
302
+ const Re = /^(\d+(?:\.\d+)?)px$/, I = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
303
+ class de extends Fe {
300
304
  static getType() {
301
305
  return "tablecell";
302
306
  }
@@ -307,13 +311,13 @@ class de extends Ee {
307
311
  super.afterCloneFrom(e), this.__rowSpan = e.__rowSpan, this.__backgroundColor = e.__backgroundColor;
308
312
  }
309
313
  static importDOM() {
310
- return { td: (e) => ({ conversion: Ie, priority: 0 }), th: (e) => ({ conversion: Ie, priority: 0 }) };
314
+ return { td: (e) => ({ conversion: Je, priority: 0 }), th: (e) => ({ conversion: Je, priority: 0 }) };
311
315
  }
312
316
  static importJSON(e) {
313
317
  const t = e.colSpan || 1, o = e.rowSpan || 1;
314
318
  return oe(e.headerState, t, e.width || void 0).setRowSpan(o).setBackgroundColor(e.backgroundColor || null);
315
319
  }
316
- constructor(e = W.NO_STATUS, t = 1, o, s) {
320
+ constructor(e = I.NO_STATUS, t = 1, o, s) {
317
321
  super(s), this.__colSpan = t, this.__rowSpan = 1, this.__headerState = e, this.__width = o, this.__backgroundColor = null;
318
322
  }
319
323
  createDOM(e) {
@@ -350,7 +354,7 @@ class de extends Ee {
350
354
  getTag() {
351
355
  return this.hasHeader() ? "th" : "td";
352
356
  }
353
- setHeaderStyles(e, t = W.BOTH) {
357
+ setHeaderStyles(e, t = I.BOTH) {
354
358
  const o = this.getWritable();
355
359
  return o.__headerState = e & t | o.__headerState & ~t, o;
356
360
  }
@@ -379,7 +383,7 @@ class de extends Ee {
379
383
  return (this.getHeaderStyles() & e) === e;
380
384
  }
381
385
  hasHeader() {
382
- return this.getLatest().__headerState !== W.NO_STATUS;
386
+ return this.getLatest().__headerState !== I.NO_STATUS;
383
387
  }
384
388
  updateDOM(e) {
385
389
  return e.__headerState !== this.__headerState || e.__width !== this.__width || e.__colSpan !== this.__colSpan || e.__rowSpan !== this.__rowSpan || e.__backgroundColor !== this.__backgroundColor;
@@ -397,50 +401,50 @@ class de extends Ee {
397
401
  return !1;
398
402
  }
399
403
  }
400
- function Ie(n) {
404
+ function Je(n) {
401
405
  const e = n, t = n.nodeName.toLowerCase();
402
406
  let o;
403
- gt.test(e.style.width) && (o = parseFloat(e.style.width));
404
- const s = oe(t === "th" ? W.ROW : W.NO_STATUS, e.colSpan, o);
407
+ Re.test(e.style.width) && (o = parseFloat(e.style.width));
408
+ const s = oe(t === "th" ? I.ROW : I.NO_STATUS, e.colSpan, o);
405
409
  s.__rowSpan = e.rowSpan;
406
410
  const r = e.style.backgroundColor;
407
411
  r !== "" && (s.__backgroundColor = r);
408
- const l = e.style, a = l.textDecoration.split(" "), d = l.fontWeight === "700" || l.fontWeight === "bold", h = a.includes("line-through"), i = l.fontStyle === "italic", c = a.includes("underline");
409
- return { after: (u) => (u.length === 0 && u.push(G()), u), forChild: (u, g) => {
410
- if (p(g) && !E(u)) {
411
- const f = G();
412
- return Ft(u) && u.getTextContent() === `
413
- ` ? null : (ne(u) && (d && u.toggleFormat("bold"), h && u.toggleFormat("strikethrough"), i && u.toggleFormat("italic"), c && u.toggleFormat("underline")), f.append(u), f);
412
+ const l = e.style, a = (l && l.textDecoration || "").split(" "), d = l.fontWeight === "700" || l.fontWeight === "bold", h = a.includes("line-through"), i = l.fontStyle === "italic", c = a.includes("underline");
413
+ return { after: (u) => (u.length === 0 && u.push(V()), u), forChild: (u, g) => {
414
+ if (m(g) && !T(u)) {
415
+ const f = V();
416
+ return Dt(u) && u.getTextContent() === `
417
+ ` ? null : ($(u) && (d && u.toggleFormat("bold"), h && u.toggleFormat("strikethrough"), i && u.toggleFormat("italic"), c && u.toggleFormat("underline")), f.append(u), f);
414
418
  }
415
419
  return u;
416
420
  }, node: s };
417
421
  }
418
422
  function oe(n, e = 1, t) {
419
- return Te(new de(n, e, t));
423
+ return Oe(new de(n, e, t));
420
424
  }
421
- function p(n) {
425
+ function m(n) {
422
426
  return n instanceof de;
423
427
  }
424
- const Dn = Rt();
425
- function Sn(n) {
428
+ const Wn = Pt();
429
+ function xn(n) {
426
430
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
427
431
  }
428
- var x = Sn(function(n) {
432
+ var N = xn(function(n) {
429
433
  const e = new URLSearchParams();
430
434
  e.append("code", n);
431
435
  for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
432
436
  throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
433
437
  });
434
- const bn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0;
435
- class we extends Ee {
438
+ const Nn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0;
439
+ class Ce extends Fe {
436
440
  static getType() {
437
441
  return "tablerow";
438
442
  }
439
443
  static clone(e) {
440
- return new we(e.__height, e.__key);
444
+ return new Ce(e.__height, e.__key);
441
445
  }
442
446
  static importDOM() {
443
- return { tr: (e) => ({ conversion: yn, priority: 0 }) };
447
+ return { tr: (e) => ({ conversion: vn, priority: 0 }) };
444
448
  }
445
449
  static importJSON(e) {
446
450
  return he(e.height);
@@ -474,36 +478,57 @@ class we extends Ee {
474
478
  return !1;
475
479
  }
476
480
  }
477
- function yn(n) {
481
+ function vn(n) {
478
482
  const e = n;
479
483
  let t;
480
- return gt.test(e.style.height) && (t = parseFloat(e.style.height)), { node: he(t) };
484
+ return Re.test(e.style.height) && (t = parseFloat(e.style.height)), { node: he(t) };
481
485
  }
482
486
  function he(n) {
483
- return Te(new we(n));
487
+ return Oe(new Ce(n));
484
488
  }
485
- function J(n) {
486
- return n instanceof we;
489
+ function W(n) {
490
+ return n instanceof Ce;
487
491
  }
488
- function _n(n, e, t = !0) {
489
- const o = Fe();
492
+ function Tn(n, e, t = !0) {
493
+ const o = ke();
490
494
  for (let s = 0; s < n; s++) {
491
495
  const r = he();
492
496
  for (let l = 0; l < e; l++) {
493
- let a = W.NO_STATUS;
494
- typeof t == "object" ? (s === 0 && t.rows && (a |= W.ROW), l === 0 && t.columns && (a |= W.COLUMN)) : t && (s === 0 && (a |= W.ROW), l === 0 && (a |= W.COLUMN));
495
- const d = oe(a), h = G();
496
- h.append(Oe()), d.append(h), r.append(d);
497
+ let a = I.NO_STATUS;
498
+ typeof t == "object" ? (s === 0 && t.rows && (a |= I.ROW), l === 0 && t.columns && (a |= I.COLUMN)) : t && (s === 0 && (a |= I.ROW), l === 0 && (a |= I.COLUMN));
499
+ const d = oe(a), h = V();
500
+ h.append(Me()), d.append(h), r.append(d);
497
501
  }
498
502
  o.append(r);
499
503
  }
500
504
  return o;
501
505
  }
502
- function Nn(n, e) {
506
+ function In(n) {
507
+ const e = _(n, (t) => m(t));
508
+ return m(e) ? e : null;
509
+ }
510
+ function ge(n) {
511
+ const e = _(n, (t) => W(t));
512
+ if (W(e)) return e;
513
+ throw new Error("Expected table cell to be inside of table row.");
514
+ }
515
+ function Se(n) {
516
+ const e = _(n, (t) => M(t));
517
+ if (M(e)) return e;
518
+ throw new Error("Expected table cell to be inside of table.");
519
+ }
520
+ function En(n) {
521
+ const e = ge(n);
522
+ return Se(e).getChildren().findIndex((t) => t.is(e));
523
+ }
524
+ function wt(n) {
525
+ return ge(n).getChildren().findIndex((e) => e.is(n));
526
+ }
527
+ function On(n, e) {
503
528
  const t = n.getChildren();
504
529
  for (let o = 0; o < t.length; o++) {
505
530
  const s = t[o];
506
- if (J(s)) {
531
+ if (W(s)) {
507
532
  const r = s.getChildren();
508
533
  if (e >= r.length || e < 0) throw new Error("Table column target index out of range");
509
534
  r[e].remove();
@@ -511,11 +536,11 @@ function Nn(n, e) {
511
536
  }
512
537
  return n;
513
538
  }
514
- function te(n, e, t) {
515
- const [o, s, r] = xn(n, e, t);
516
- return s === null && x(207), r === null && x(208), [o, s, r];
539
+ function ne(n, e, t) {
540
+ const [o, s, r] = Mn(n, e, t);
541
+ return s === null && N(207), r === null && N(208), [o, s, r];
517
542
  }
518
- function xn(n, e, t) {
543
+ function Mn(n, e, t) {
519
544
  const o = [];
520
545
  let s = null, r = null;
521
546
  function l(d) {
@@ -525,15 +550,15 @@ function xn(n, e, t) {
525
550
  const a = n.getChildren();
526
551
  for (let d = 0; d < a.length; d++) {
527
552
  const h = a[d];
528
- J(h) || x(209);
553
+ W(h) || N(209);
529
554
  for (let i = h.getFirstChild(), c = 0; i != null; i = i.getNextSibling()) {
530
- p(i) || x(147);
555
+ m(i) || N(147);
531
556
  const u = l(d);
532
557
  for (; u[c] !== void 0; ) c++;
533
- const g = { cell: i, startColumn: c, startRow: d }, { __rowSpan: f, __colSpan: m } = i;
558
+ const g = { cell: i, startColumn: c, startRow: d }, { __rowSpan: f, __colSpan: p } = i;
534
559
  for (let w = 0; w < f && !(d + w >= a.length); w++) {
535
560
  const C = l(d + w);
536
- for (let _ = 0; _ < m; _++) C[c + _] = g;
561
+ for (let x = 0; x < p; x++) C[c + x] = g;
537
562
  }
538
563
  e !== null && s === null && e.is(i) && (s = g), t !== null && r === null && t.is(i) && (r = g);
539
564
  }
@@ -544,18 +569,18 @@ function le(n) {
544
569
  let e;
545
570
  if (n instanceof de) e = n;
546
571
  else if ("__type" in n) {
547
- const s = N(n, p);
548
- p(s) || x(148), e = s;
572
+ const s = _(n, m);
573
+ m(s) || N(148), e = s;
549
574
  } else {
550
- const s = N(n.getNode(), p);
551
- p(s) || x(148), e = s;
575
+ const s = _(n.getNode(), m);
576
+ m(s) || N(148), e = s;
552
577
  }
553
578
  const t = e.getParent();
554
- J(t) || x(149);
579
+ W(t) || N(149);
555
580
  const o = t.getParent();
556
- return A(o) || x(210), [e, t, o];
581
+ return M(o) || N(210), [e, t, o];
557
582
  }
558
- function ze(n) {
583
+ function Ye(n) {
559
584
  const [e, , t] = le(n), o = t.getChildren(), s = o.length, r = o[0].getChildren().length, l = new Array(s);
560
585
  for (let a = 0; a < s; a++) l[a] = new Array(r);
561
586
  for (let a = 0; a < s; a++) {
@@ -564,14 +589,14 @@ function ze(n) {
564
589
  for (let i = 0; i < d.length; i++) {
565
590
  for (; l[a][h]; ) h++;
566
591
  const c = d[i], u = c.__rowSpan || 1, g = c.__colSpan || 1;
567
- for (let f = 0; f < u; f++) for (let m = 0; m < g; m++) l[a + f][h + m] = c;
592
+ for (let f = 0; f < u; f++) for (let p = 0; p < g; p++) l[a + f][h + p] = c;
568
593
  if (e === c) return { colSpan: g, columnIndex: h, rowIndex: a, rowSpan: u };
569
594
  h += g;
570
595
  }
571
596
  }
572
597
  return null;
573
598
  }
574
- class Ce {
599
+ class be {
575
600
  constructor(e, t, o) {
576
601
  this.anchor = t, this.focus = o, t._selection = this, o._selection = this, this._cachedNodes = null, this.dirty = !1, this.tableKey = e;
577
602
  }
@@ -588,13 +613,13 @@ class Ce {
588
613
  this._cachedNodes = e;
589
614
  }
590
615
  is(e) {
591
- return !!F(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
616
+ return !!R(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
592
617
  }
593
618
  set(e, t, o) {
594
619
  this.dirty = !0, this.tableKey = e, this.anchor.key = t, this.focus.key = o, this._cachedNodes = null;
595
620
  }
596
621
  clone() {
597
- return new Ce(this.tableKey, this.anchor, this.focus);
622
+ return new be(this.tableKey, this.anchor, this.focus);
598
623
  }
599
624
  isCollapsed() {
600
625
  return !1;
@@ -606,83 +631,92 @@ class Ce {
606
631
  }
607
632
  insertText() {
608
633
  }
634
+ hasFormat(e) {
635
+ let t = 0;
636
+ this.getNodes().filter(m).forEach((s) => {
637
+ const r = s.getFirstChild();
638
+ ct(r) && (t |= r.getTextFormat());
639
+ });
640
+ const o = tn[e];
641
+ return !!(t & o);
642
+ }
609
643
  insertNodes(e) {
610
644
  const t = this.focus.getNode();
611
- E(t) || x(151), Vt(t.select(0, t.getChildrenSize())).insertNodes(e);
645
+ T(t) || N(151), nn(t.select(0, t.getChildrenSize())).insertNodes(e);
612
646
  }
613
647
  getShape() {
614
648
  const e = ae(this.anchor.key);
615
- p(e) || x(152);
616
- const t = ze(e);
617
- t === null && x(153);
649
+ m(e) || N(152);
650
+ const t = Ye(e);
651
+ t === null && N(153);
618
652
  const o = ae(this.focus.key);
619
- p(o) || x(154);
620
- const s = ze(o);
621
- s === null && x(155);
653
+ m(o) || N(154);
654
+ const s = Ye(o);
655
+ s === null && N(155);
622
656
  const r = Math.min(t.columnIndex, s.columnIndex), l = Math.max(t.columnIndex + t.colSpan - 1, s.columnIndex + s.colSpan - 1), a = Math.min(t.rowIndex, s.rowIndex), d = Math.max(t.rowIndex + t.rowSpan - 1, s.rowIndex + s.rowSpan - 1);
623
657
  return { fromX: Math.min(r, l), fromY: Math.min(a, d), toX: Math.max(r, l), toY: Math.max(a, d) };
624
658
  }
625
659
  getNodes() {
626
660
  const e = this._cachedNodes;
627
661
  if (e !== null) return e;
628
- const t = this.anchor.getNode(), o = this.focus.getNode(), s = N(t, p), r = N(o, p);
629
- p(s) || x(152), p(r) || x(154);
662
+ const t = this.anchor.getNode(), o = this.focus.getNode(), s = _(t, m), r = _(o, m);
663
+ m(s) || N(152), m(r) || N(154);
630
664
  const l = s.getParent();
631
- J(l) || x(156);
665
+ W(l) || N(156);
632
666
  const a = l.getParent();
633
- A(a) || x(157);
667
+ M(a) || N(157);
634
668
  const d = r.getParents()[1];
635
669
  if (d !== a) {
636
670
  if (a.isParentOf(r)) {
637
671
  const b = d.getParent();
638
- b == null && x(159), this.set(this.tableKey, r.getKey(), b.getKey());
672
+ b == null && N(159), this.set(this.tableKey, r.getKey(), b.getKey());
639
673
  } else {
640
674
  const b = a.getParent();
641
- b == null && x(158), this.set(this.tableKey, b.getKey(), r.getKey());
675
+ b == null && N(158), this.set(this.tableKey, b.getKey(), r.getKey());
642
676
  }
643
677
  return this.getNodes();
644
678
  }
645
- const [h, i, c] = te(a, s, r);
646
- let u = Math.min(i.startColumn, c.startColumn), g = Math.min(i.startRow, c.startRow), f = Math.max(i.startColumn + i.cell.__colSpan - 1, c.startColumn + c.cell.__colSpan - 1), m = Math.max(i.startRow + i.cell.__rowSpan - 1, c.startRow + c.cell.__rowSpan - 1), w = u, C = g, _ = u, T = g;
679
+ const [h, i, c] = ne(a, s, r);
680
+ let u = Math.min(i.startColumn, c.startColumn), g = Math.min(i.startRow, c.startRow), f = Math.max(i.startColumn + i.cell.__colSpan - 1, c.startColumn + c.cell.__colSpan - 1), p = Math.max(i.startRow + i.cell.__rowSpan - 1, c.startRow + c.cell.__rowSpan - 1), w = u, C = g, x = u, E = g;
647
681
  function v(b) {
648
682
  const { cell: y, startColumn: S, startRow: P } = b;
649
- u = Math.min(u, S), g = Math.min(g, P), f = Math.max(f, S + y.__colSpan - 1), m = Math.max(m, P + y.__rowSpan - 1);
683
+ u = Math.min(u, S), g = Math.min(g, P), f = Math.max(f, S + y.__colSpan - 1), p = Math.max(p, P + y.__rowSpan - 1);
650
684
  }
651
- for (; u < w || g < C || f > _ || m > T; ) {
685
+ for (; u < w || g < C || f > x || p > E; ) {
652
686
  if (u < w) {
653
- const b = T - C, y = w - 1;
687
+ const b = E - C, y = w - 1;
654
688
  for (let S = 0; S <= b; S++) v(h[C + S][y]);
655
689
  w = y;
656
690
  }
657
691
  if (g < C) {
658
- const b = _ - w, y = C - 1;
692
+ const b = x - w, y = C - 1;
659
693
  for (let S = 0; S <= b; S++) v(h[y][w + S]);
660
694
  C = y;
661
695
  }
662
- if (f > _) {
663
- const b = T - C, y = _ + 1;
696
+ if (f > x) {
697
+ const b = E - C, y = x + 1;
664
698
  for (let S = 0; S <= b; S++) v(h[C + S][y]);
665
- _ = y;
699
+ x = y;
666
700
  }
667
- if (m > T) {
668
- const b = _ - w, y = T + 1;
701
+ if (p > E) {
702
+ const b = x - w, y = E + 1;
669
703
  for (let S = 0; S <= b; S++) v(h[y][w + S]);
670
- T = y;
704
+ E = y;
671
705
  }
672
706
  }
673
- const R = /* @__PURE__ */ new Map([[a.getKey(), a]]);
707
+ const K = /* @__PURE__ */ new Map([[a.getKey(), a]]);
674
708
  let O = null;
675
- for (let b = g; b <= m; b++) for (let y = u; y <= f; y++) {
709
+ for (let b = g; b <= p; b++) for (let y = u; y <= f; y++) {
676
710
  const { cell: S } = h[b][y], P = S.getParent();
677
- J(P) || x(160), P !== O && R.set(P.getKey(), P), R.set(S.getKey(), S);
678
- for (const H of vn(S)) R.set(H.getKey(), H);
711
+ W(P) || N(160), P !== O && K.set(P.getKey(), P), K.set(S.getKey(), S);
712
+ for (const L of Fn(S)) K.set(L.getKey(), L);
679
713
  O = P;
680
714
  }
681
- const M = Array.from(R.values());
682
- return Zt() || (this._cachedNodes = M), M;
715
+ const F = Array.from(K.values());
716
+ return on() || (this._cachedNodes = F), F;
683
717
  }
684
718
  getTextContent() {
685
- const e = this.getNodes().filter((o) => p(o));
719
+ const e = this.getNodes().filter((o) => m(o));
686
720
  let t = "";
687
721
  for (let o = 0; o < e.length; o++) {
688
722
  const s = e[o], r = s.__parent, l = (e[o + 1] || {}).__parent;
@@ -692,22 +726,22 @@ class Ce {
692
726
  return t;
693
727
  }
694
728
  }
695
- function F(n) {
696
- return n instanceof Ce;
729
+ function R(n) {
730
+ return n instanceof be;
697
731
  }
698
- function Je() {
699
- const n = Be("root", 0, "element"), e = Be("root", 0, "element");
700
- return new Ce("root", n, e);
732
+ function Xe() {
733
+ const n = Ie("root", 0, "element"), e = Ie("root", 0, "element");
734
+ return new be("root", n, e);
701
735
  }
702
- function vn(n) {
736
+ function Fn(n) {
703
737
  const e = [], t = [n];
704
738
  for (; t.length > 0; ) {
705
739
  const o = t.pop();
706
- o === void 0 && x(112), E(o) && t.unshift(...o.getChildren()), o !== n && e.push(o);
740
+ o === void 0 && N(112), T(o) && t.unshift(...o.getChildren()), o !== n && e.push(o);
707
741
  }
708
742
  return e;
709
743
  }
710
- class Tn {
744
+ class Rn {
711
745
  constructor(e, t) {
712
746
  this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.listenersToRemove = /* @__PURE__ */ new Set(), this.tableNodeKey = t, this.editor = e, this.table = { columns: 0, domRows: [], rows: 0 }, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.trackTable(), this.isSelecting = !1, this.abortController = new AbortController(), this.listenerOptions = { signal: this.abortController.signal };
713
747
  }
@@ -743,11 +777,11 @@ class Tn {
743
777
  clearHighlight() {
744
778
  const e = this.editor;
745
779
  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(), e.update(() => {
746
- if (!A(ae(this.tableNodeKey))) throw new Error("Expected TableNode.");
780
+ if (!M(ae(this.tableNodeKey))) throw new Error("Expected TableNode.");
747
781
  const t = e.getElementByKey(this.tableNodeKey);
748
782
  if (!t) throw new Error("Expected to find TableElement in DOM");
749
783
  const o = ce(t);
750
- fe(e, o, null), q(null), e.dispatchCommand(se, void 0);
784
+ me(e, o, null), q(null), e.dispatchCommand(se, void 0);
751
785
  });
752
786
  }
753
787
  enableHighlightStyle() {
@@ -755,7 +789,7 @@ class Tn {
755
789
  e.update(() => {
756
790
  const t = e.getElementByKey(this.tableNodeKey);
757
791
  if (!t) throw new Error("Expected to find TableElement in DOM");
758
- Ve(t, e._config.theme.tableSelection), t.classList.remove("disable-selection"), this.hasHijackedSelectionStyles = !1;
792
+ tt(t, e._config.theme.tableSelection), t.classList.remove("disable-selection"), this.hasHijackedSelectionStyles = !1;
759
793
  });
760
794
  }
761
795
  disableHighlightStyle() {
@@ -769,46 +803,46 @@ class Tn {
769
803
  updateTableTableSelection(e) {
770
804
  if (e !== null && e.tableKey === this.tableNodeKey) {
771
805
  const t = this.editor;
772
- this.tableSelection = e, this.isHighlightingCells = !0, this.disableHighlightStyle(), fe(t, this.table, this.tableSelection);
806
+ this.tableSelection = e, this.isHighlightingCells = !0, this.disableHighlightStyle(), me(t, this.table, this.tableSelection);
773
807
  } else e == null ? this.clearHighlight() : (this.tableNodeKey = e.tableKey, this.updateTableTableSelection(e));
774
808
  }
775
809
  setFocusCellForSelection(e, t = !1) {
776
810
  const o = this.editor;
777
811
  o.update(() => {
778
812
  const s = ae(this.tableNodeKey);
779
- if (!A(s)) throw new Error("Expected TableNode.");
813
+ if (!M(s)) throw new Error("Expected TableNode.");
780
814
  if (!o.getElementByKey(this.tableNodeKey)) throw new Error("Expected to find TableElement in DOM");
781
815
  const r = e.x, l = e.y;
782
816
  if (this.focusCell = e, this.anchorCell !== null) {
783
- const a = ft(o._window);
817
+ const a = Ct(o._window);
784
818
  a && a.setBaseAndExtent(this.anchorCell.elem, 0, this.focusCell.elem, 0);
785
819
  }
786
820
  if (this.isHighlightingCells || this.anchorX === r && this.anchorY === l && !t) {
787
821
  if (r === this.focusX && l === this.focusY) return;
788
822
  } else this.isHighlightingCells = !0, this.disableHighlightStyle();
789
823
  if (this.focusX = r, this.focusY = l, this.isHighlightingCells) {
790
- const a = U(e.elem);
791
- if (this.tableSelection != null && this.anchorCellNodeKey != null && p(a) && s.is(ee(a))) {
824
+ const a = Y(e.elem);
825
+ if (this.tableSelection != null && this.anchorCellNodeKey != null && m(a) && s.is(te(a))) {
792
826
  const d = a.getKey();
793
- this.tableSelection = this.tableSelection.clone() || Je(), this.focusCellNodeKey = d, this.tableSelection.set(this.tableNodeKey, this.anchorCellNodeKey, this.focusCellNodeKey), q(this.tableSelection), o.dispatchCommand(se, void 0), fe(o, this.table, this.tableSelection);
827
+ this.tableSelection = this.tableSelection.clone() || Xe(), this.focusCellNodeKey = d, this.tableSelection.set(this.tableNodeKey, this.anchorCellNodeKey, this.focusCellNodeKey), q(this.tableSelection), o.dispatchCommand(se, void 0), me(o, this.table, this.tableSelection);
794
828
  }
795
829
  }
796
830
  });
797
831
  }
798
832
  setAnchorCellForSelection(e) {
799
833
  this.isHighlightingCells = !1, this.anchorCell = e, this.anchorX = e.x, this.anchorY = e.y, this.editor.update(() => {
800
- const t = U(e.elem);
801
- if (p(t)) {
834
+ const t = Y(e.elem);
835
+ if (m(t)) {
802
836
  const o = t.getKey();
803
- this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : Je(), this.anchorCellNodeKey = o;
837
+ this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : Xe(), this.anchorCellNodeKey = o;
804
838
  }
805
839
  });
806
840
  }
807
841
  formatCells(e) {
808
842
  this.editor.update(() => {
809
- const t = k();
810
- F(t) || x(11);
811
- const o = Gt(), s = o.anchor, r = o.focus, l = t.getNodes().filter(p), a = l[0].getFirstChild(), d = Qt(a) ? a.getFormatFlags(e, null) : null;
843
+ const t = D();
844
+ R(t) || N(11);
845
+ const o = en(), s = o.anchor, r = o.focus, l = t.getNodes().filter(m), a = l[0].getFirstChild(), d = ct(a) ? a.getFormatFlags(e, null) : null;
812
846
  l.forEach((h) => {
813
847
  s.set(h.getKey(), 0, "element"), r.set(h.getKey(), h.getChildrenSize(), "element"), o.formatText(e, d);
814
848
  }), q(t), this.editor.dispatchCommand(se, void 0);
@@ -818,30 +852,30 @@ class Tn {
818
852
  const e = this.editor;
819
853
  e.update(() => {
820
854
  const t = ae(this.tableNodeKey);
821
- if (!A(t)) throw new Error("Expected TableNode.");
822
- const o = k();
823
- F(o) || x(11);
824
- const s = o.getNodes().filter(p);
855
+ if (!M(t)) throw new Error("Expected TableNode.");
856
+ const o = D();
857
+ R(o) || N(11);
858
+ const s = o.getNodes().filter(m);
825
859
  s.length !== this.table.columns * this.table.rows ? (s.forEach((r) => {
826
- if (E(r)) {
827
- const l = G(), a = Oe();
860
+ if (T(r)) {
861
+ const l = V(), a = Me();
828
862
  l.append(a), r.append(l), r.getChildren().forEach((d) => {
829
863
  d !== l && d.remove();
830
864
  });
831
865
  }
832
- }), fe(e, this.table, null), q(null), e.dispatchCommand(se, void 0)) : (t.selectPrevious(), t.remove(), ve().selectStart());
866
+ }), me(e, this.table, null), q(null), e.dispatchCommand(se, void 0)) : (t.selectPrevious(), t.remove(), Ee().selectStart());
833
867
  });
834
868
  }
835
869
  }
836
- const xe = "__lexicalTableSelection", ft = (n) => bn ? (n || window).getSelection() : null;
837
- function An(n, e, t, o) {
870
+ const Te = "__lexicalTableSelection", Ct = (n) => Nn ? (n || window).getSelection() : null;
871
+ function zn(n, e, t, o) {
838
872
  const s = t.getRootElement();
839
873
  if (s === null) throw new Error("No root element.");
840
- const r = new Tn(t, n.getKey()), l = t._window || window;
874
+ const r = new Rn(t, n.getKey()), l = t._window || window;
841
875
  (function(i, c) {
842
- Ue(i) !== null && x(205), i[xe] = c;
876
+ je(i) !== null && N(205), i[Te] = c;
843
877
  })(e, r), r.listenersToRemove.add(() => function(i, c) {
844
- Ue(i) === c && delete i[xe];
878
+ je(i) === c && delete i[Te];
845
879
  }(e, r));
846
880
  const a = () => {
847
881
  const i = () => {
@@ -849,7 +883,7 @@ function An(n, e, t, o) {
849
883
  }, c = (u) => {
850
884
  setTimeout(() => {
851
885
  if (1 & ~u.buttons && r.isSelecting) return r.isSelecting = !1, l.removeEventListener("mouseup", i), void l.removeEventListener("mousemove", c);
852
- const g = Ye(u.target);
886
+ const g = qe(u.target);
853
887
  g === null || r.anchorX === g.x && r.anchorY === g.y || (u.preventDefault(), r.setFocusCellForSelection(g));
854
888
  }, 0);
855
889
  };
@@ -858,181 +892,181 @@ function An(n, e, t, o) {
858
892
  e.addEventListener("mousedown", (i) => {
859
893
  setTimeout(() => {
860
894
  if (i.button !== 0 || !l) return;
861
- const c = Ye(i.target);
862
- c !== null && ($(i), r.setAnchorCellForSelection(c));
895
+ const c = qe(i.target);
896
+ c !== null && (J(i), r.setAnchorCellForSelection(c));
863
897
  const { onMouseUp: u, onMouseMove: g } = a();
864
898
  r.isSelecting = !0, l.addEventListener("mouseup", u, r.listenerOptions), l.addEventListener("mousemove", g, r.listenerOptions);
865
899
  }, 0);
866
900
  }, r.listenerOptions), l.addEventListener("mousedown", (i) => {
867
901
  i.button === 0 && t.update(() => {
868
- const c = k(), u = i.target;
869
- F(c) && c.tableKey === r.tableNodeKey && s.contains(u) && r.clearHighlight();
902
+ const c = D(), u = i.target;
903
+ R(c) && c.tableKey === r.tableNodeKey && s.contains(u) && r.clearHighlight();
870
904
  });
871
- }, r.listenerOptions), r.listenersToRemove.add(t.registerCommand(Kt, (i) => ie(t, i, "down", n, r), V)), r.listenersToRemove.add(t.registerCommand(kt, (i) => ie(t, i, "up", n, r), V)), r.listenersToRemove.add(t.registerCommand(Pt, (i) => ie(t, i, "backward", n, r), V)), r.listenersToRemove.add(t.registerCommand(Dt, (i) => ie(t, i, "forward", n, r), V)), r.listenersToRemove.add(t.registerCommand(At, (i) => {
872
- const c = k();
873
- if (F(c)) {
874
- const u = N(c.focus.getNode(), p);
875
- if (p(u)) return $(i), u.selectEnd(), !0;
905
+ }, r.listenerOptions), r.listenersToRemove.add(t.registerCommand(At, (i) => ie(t, i, "down", n, r), Q)), r.listenersToRemove.add(t.registerCommand(Lt, (i) => ie(t, i, "up", n, r), Q)), r.listenersToRemove.add(t.registerCommand(Ht, (i) => ie(t, i, "backward", n, r), Q)), r.listenersToRemove.add(t.registerCommand(Bt, (i) => ie(t, i, "forward", n, r), Q)), r.listenersToRemove.add(t.registerCommand(Wt, (i) => {
906
+ const c = D();
907
+ if (R(c)) {
908
+ const u = _(c.focus.getNode(), m);
909
+ if (m(u)) return J(i), u.selectEnd(), !0;
876
910
  }
877
911
  return !1;
878
- }, V)), [Ht, He, Bt].forEach((i) => {
912
+ }, Q)), [It, We, zt].forEach((i) => {
879
913
  r.listenersToRemove.add(t.registerCommand(i, /* @__PURE__ */ ((c) => () => {
880
- const u = k();
881
- if (!j(u, n)) return !1;
882
- if (F(u)) return r.clearText(), !0;
883
- if (D(u)) {
884
- const g = N(u.anchor.getNode(), (v) => p(v));
885
- if (!p(g)) return !1;
886
- const f = u.anchor.getNode(), m = u.focus.getNode(), w = n.isParentOf(f), C = n.isParentOf(m);
914
+ const u = D();
915
+ if (!G(u, n)) return !1;
916
+ if (R(u)) return r.clearText(), !0;
917
+ if (A(u)) {
918
+ const g = _(u.anchor.getNode(), (v) => m(v));
919
+ if (!m(g)) return !1;
920
+ const f = u.anchor.getNode(), p = u.focus.getNode(), w = n.isParentOf(f), C = n.isParentOf(p);
887
921
  if (w && !C || C && !w) return r.clearText(), !0;
888
- const _ = N(u.anchor.getNode(), (v) => E(v)), T = _ && N(_, (v) => E(v) && p(v.getParent()));
889
- if (!E(T) || !E(_)) return !1;
890
- if (c === He && T.getPreviousSibling() === null) return !0;
922
+ const x = _(u.anchor.getNode(), (v) => T(v)), E = x && _(x, (v) => T(v) && m(v.getParent()));
923
+ if (!T(E) || !T(x)) return !1;
924
+ if (c === We && E.getPreviousSibling() === null) return !0;
891
925
  }
892
926
  return !1;
893
- })(i), L));
927
+ })(i), B));
894
928
  });
895
929
  const d = (i) => {
896
- const c = k();
897
- if (!F(c) && !D(c)) return !1;
930
+ const c = D();
931
+ if (!R(c) && !A(c)) return !1;
898
932
  const u = n.isParentOf(c.anchor.getNode());
899
933
  if (u !== n.isParentOf(c.focus.getNode())) {
900
- const g = u ? "anchor" : "focus", f = u ? "focus" : "anchor", { key: m, offset: w, type: C } = c[f];
901
- return n[c[g].isBefore(c[f]) ? "selectPrevious" : "selectNext"]()[f].set(m, w, C), !1;
934
+ const g = u ? "anchor" : "focus", f = u ? "focus" : "anchor", { key: p, offset: w, type: C } = c[f];
935
+ return n[c[g].isBefore(c[f]) ? "selectPrevious" : "selectNext"]()[f].set(p, w, C), !1;
902
936
  }
903
- return !!F(c) && (i && (i.preventDefault(), i.stopPropagation()), r.clearText(), !0);
937
+ return !!R(c) && (i && (i.preventDefault(), i.stopPropagation()), r.clearText(), !0);
904
938
  };
905
939
  function h(i) {
906
940
  const c = n.getCordsFromCellNode(i, r.table);
907
941
  return n.getDOMCellFromCordsOrThrow(c.x, c.y, r.table);
908
942
  }
909
- return r.listenersToRemove.add(t.registerCommand(Lt, d, L)), r.listenersToRemove.add(t.registerCommand(Wt, d, L)), r.listenersToRemove.add(t.registerCommand(It, (i) => {
910
- const c = k();
943
+ return r.listenersToRemove.add(t.registerCommand(Ut, d, B)), r.listenersToRemove.add(t.registerCommand(Jt, d, B)), r.listenersToRemove.add(t.registerCommand(Yt, (i) => {
944
+ const c = D();
911
945
  if (c) {
912
- if (!F(c) && !D(c)) return !1;
913
- pn(t, Qe(i, ClipboardEvent) ? i : null, ht(c));
946
+ if (!R(c) && !A(c)) return !1;
947
+ bn(t, et(i, ClipboardEvent) ? i : null, pt(c));
914
948
  const u = d(i);
915
- return D(c) ? (c.removeText(), !0) : u;
949
+ return A(c) ? (c.removeText(), !0) : u;
916
950
  }
917
951
  return !1;
918
- }, L)), r.listenersToRemove.add(t.registerCommand(zt, (i) => {
919
- const c = k();
920
- if (!j(c, n)) return !1;
921
- if (F(c)) return r.formatCells(i), !0;
922
- if (D(c)) {
923
- const u = N(c.anchor.getNode(), (g) => p(g));
924
- if (!p(u)) return !1;
952
+ }, B)), r.listenersToRemove.add(t.registerCommand(Xt, (i) => {
953
+ const c = D();
954
+ if (!G(c, n)) return !1;
955
+ if (R(c)) return r.formatCells(i), !0;
956
+ if (A(c)) {
957
+ const u = _(c.anchor.getNode(), (g) => m(g));
958
+ if (!m(u)) return !1;
925
959
  }
926
960
  return !1;
927
- }, L)), r.listenersToRemove.add(t.registerCommand(Jt, (i) => {
928
- const c = k();
929
- if (!F(c) || !j(c, n)) return !1;
961
+ }, B)), r.listenersToRemove.add(t.registerCommand(jt, (i) => {
962
+ const c = D();
963
+ if (!R(c) || !G(c, n)) return !1;
930
964
  const u = c.anchor.getNode(), g = c.focus.getNode();
931
- if (!p(u) || !p(g)) return !1;
932
- const [f, m, w] = te(n, u, g), C = Math.max(m.startRow, w.startRow), _ = Math.max(m.startColumn, w.startColumn), T = Math.min(m.startRow, w.startRow), v = Math.min(m.startColumn, w.startColumn);
933
- for (let R = T; R <= C; R++) for (let O = v; O <= _; O++) {
934
- const M = f[R][O].cell;
935
- M.setFormat(i);
936
- const b = M.getChildren();
965
+ if (!m(u) || !m(g)) return !1;
966
+ const [f, p, w] = ne(n, u, g), C = Math.max(p.startRow, w.startRow), x = Math.max(p.startColumn, w.startColumn), E = Math.min(p.startRow, w.startRow), v = Math.min(p.startColumn, w.startColumn);
967
+ for (let K = E; K <= C; K++) for (let O = v; O <= x; O++) {
968
+ const F = f[K][O].cell;
969
+ F.setFormat(i);
970
+ const b = F.getChildren();
937
971
  for (let y = 0; y < b.length; y++) {
938
972
  const S = b[y];
939
- E(S) && !S.isInline() && S.setFormat(i);
973
+ T(S) && !S.isInline() && S.setFormat(i);
940
974
  }
941
975
  }
942
976
  return !0;
943
- }, L)), r.listenersToRemove.add(t.registerCommand(Ut, (i) => {
944
- const c = k();
945
- if (!j(c, n)) return !1;
946
- if (F(c)) return r.clearHighlight(), !1;
947
- if (D(c)) {
948
- const u = N(c.anchor.getNode(), (g) => p(g));
949
- if (!p(u)) return !1;
977
+ }, B)), r.listenersToRemove.add(t.registerCommand(qt, (i) => {
978
+ const c = D();
979
+ if (!G(c, n)) return !1;
980
+ if (R(c)) return r.clearHighlight(), !1;
981
+ if (A(c)) {
982
+ const u = _(c.anchor.getNode(), (g) => m(g));
983
+ if (!m(u)) return !1;
950
984
  if (typeof i == "string") {
951
- const g = qe(t, c, n);
952
- if (g) return je(g, n, [Oe(i)]), !0;
985
+ const g = Ve(t, c, n);
986
+ if (g) return Ge(g, n, [Me(i)]), !0;
953
987
  }
954
988
  }
955
989
  return !1;
956
- }, L)), o && r.listenersToRemove.add(t.registerCommand(Yt, (i) => {
957
- const c = k();
958
- if (!D(c) || !c.isCollapsed() || !j(c, n)) return !1;
959
- const u = _e(c.anchor.getNode());
990
+ }, B)), o && r.listenersToRemove.add(t.registerCommand($t, (i) => {
991
+ const c = D();
992
+ if (!A(c) || !c.isCollapsed() || !G(c, n)) return !1;
993
+ const u = Ne(c.anchor.getNode());
960
994
  if (u === null) return !1;
961
- $(i);
995
+ J(i);
962
996
  const g = n.getCordsFromCellNode(u, r.table);
963
- return mt(r, n, g.x, g.y, i.shiftKey ? "backward" : "forward"), !0;
964
- }, L)), r.listenersToRemove.add(t.registerCommand(Xt, (i) => n.isSelected(), V)), r.listenersToRemove.add(t.registerCommand(st, (i) => {
965
- const { nodes: c, selection: u } = i, g = u.getStartEndPoints(), f = F(u), m = D(u) && N(u.anchor.getNode(), (K) => p(K)) !== null && N(u.focus.getNode(), (K) => p(K)) !== null || f;
966
- if (c.length !== 1 || !A(c[0]) || !m || g === null) return !1;
967
- const [w] = g, C = c[0], _ = C.getChildren(), T = C.getFirstChildOrThrow().getChildrenSize(), v = C.getChildrenSize(), R = N(w.getNode(), (K) => p(K)), O = R && N(R, (K) => J(K)), M = O && N(O, (K) => A(K));
968
- if (!p(R) || !J(O) || !A(M)) return !1;
969
- const b = O.getIndexWithinParent(), y = Math.min(M.getChildrenSize() - 1, b + v - 1), S = R.getIndexWithinParent(), P = Math.min(O.getChildrenSize() - 1, S + T - 1), H = Math.min(S, P), B = Math.min(b, y), Y = Math.max(S, P), I = Math.max(b, y), X = M.getChildren();
970
- let z = 0;
971
- for (let K = B; K <= I; K++) {
972
- const re = X[K];
973
- if (!J(re)) return !1;
974
- const Re = _[z];
975
- if (!J(Re)) return !1;
976
- const St = re.getChildren(), bt = Re.getChildren();
977
- let Ke = 0;
978
- for (let be = H; be <= Y; be++) {
979
- const ge = St[be];
980
- if (!p(ge)) return !1;
981
- const ke = bt[Ke];
982
- if (!p(ke)) return !1;
983
- const yt = ge.getChildren();
984
- ke.getChildren().forEach((Q) => {
985
- ne(Q) && G().append(Q), ge.append(Q);
986
- }), yt.forEach((Q) => Q.remove()), Ke++;
997
+ return St(r, n, g.x, g.y, i.shiftKey ? "backward" : "forward"), !0;
998
+ }, B)), r.listenersToRemove.add(t.registerCommand(Gt, (i) => n.isSelected(), Q)), r.listenersToRemove.add(t.registerCommand(at, (i) => {
999
+ const { nodes: c, selection: u } = i, g = u.getStartEndPoints(), f = R(u), p = A(u) && _(u.anchor.getNode(), (k) => m(k)) !== null && _(u.focus.getNode(), (k) => m(k)) !== null || f;
1000
+ if (c.length !== 1 || !M(c[0]) || !p || g === null) return !1;
1001
+ const [w] = g, C = c[0], x = C.getChildren(), E = C.getFirstChildOrThrow().getChildrenSize(), v = C.getChildrenSize(), K = _(w.getNode(), (k) => m(k)), O = K && _(K, (k) => W(k)), F = O && _(O, (k) => M(k));
1002
+ if (!m(K) || !W(O) || !M(F)) return !1;
1003
+ const b = O.getIndexWithinParent(), y = Math.min(F.getChildrenSize() - 1, b + v - 1), S = K.getIndexWithinParent(), P = Math.min(O.getChildrenSize() - 1, S + E - 1), L = Math.min(S, P), H = Math.min(b, y), X = Math.max(S, P), z = Math.max(b, y), j = F.getChildren();
1004
+ let U = 0;
1005
+ for (let k = H; k <= z; k++) {
1006
+ const re = j[k];
1007
+ if (!W(re)) return !1;
1008
+ const De = x[U];
1009
+ if (!W(De)) return !1;
1010
+ const xt = re.getChildren(), Nt = De.getChildren();
1011
+ let Pe = 0;
1012
+ for (let _e = L; _e <= X; _e++) {
1013
+ const fe = xt[_e];
1014
+ if (!m(fe)) return !1;
1015
+ const Ae = Nt[Pe];
1016
+ if (!m(Ae)) return !1;
1017
+ const vt = fe.getChildren();
1018
+ Ae.getChildren().forEach((Z) => {
1019
+ $(Z) && V().append(Z), fe.append(Z);
1020
+ }), vt.forEach((Z) => Z.remove()), Pe++;
987
1021
  }
988
- z++;
1022
+ U++;
989
1023
  }
990
1024
  return !0;
991
- }, L)), r.listenersToRemove.add(t.registerCommand(se, () => {
992
- const i = k(), c = jt();
993
- if (D(i)) {
994
- const { anchor: u, focus: g } = i, f = u.getNode(), m = g.getNode(), w = _e(f), C = _e(m), _ = !(!w || !n.is(ee(w))), T = !(!C || !n.is(ee(C))), v = _ !== T, R = _ && T, O = i.isBackward();
1025
+ }, B)), r.listenersToRemove.add(t.registerCommand(se, () => {
1026
+ const i = D(), c = Vt();
1027
+ if (A(i)) {
1028
+ const { anchor: u, focus: g } = i, f = u.getNode(), p = g.getNode(), w = Ne(f), C = Ne(p), x = !(!w || !n.is(te(w))), E = !(!C || !n.is(te(C))), v = x !== E, K = x && E, O = i.isBackward();
995
1029
  if (v) {
996
- const M = i.clone();
997
- if (T) {
998
- const [b] = te(n, C, C), y = b[0][0].cell, S = b[b.length - 1].at(-1).cell;
999
- M.focus.set(O ? y.getKey() : S.getKey(), O ? y.getChildrenSize() : S.getChildrenSize(), "element");
1000
- } else if (_) {
1001
- const [b] = te(n, w, w), y = b[0][0].cell, S = b[b.length - 1].at(-1).cell;
1002
- M.anchor.set(O ? S.getKey() : y.getKey(), O ? S.getChildrenSize() : 0, "element");
1030
+ const F = i.clone();
1031
+ if (E) {
1032
+ const [b] = ne(n, C, C), y = b[0][0].cell, S = b[b.length - 1].at(-1).cell;
1033
+ F.focus.set(O ? y.getKey() : S.getKey(), O ? y.getChildrenSize() : S.getChildrenSize(), "element");
1034
+ } else if (x) {
1035
+ const [b] = ne(n, w, w), y = b[0][0].cell, S = b[b.length - 1].at(-1).cell;
1036
+ F.anchor.set(O ? S.getKey() : y.getKey(), O ? S.getChildrenSize() : 0, "element");
1003
1037
  }
1004
- q(M), Xe(t, r);
1005
- } else R && (w.is(C) || (r.setAnchorCellForSelection(h(w)), r.setFocusCellForSelection(h(C), !0), r.isSelecting || setTimeout(() => {
1006
- const { onMouseUp: M, onMouseMove: b } = a();
1007
- r.isSelecting = !0, l.addEventListener("mouseup", M), l.addEventListener("mousemove", b);
1038
+ q(F), $e(t, r);
1039
+ } else K && (w.is(C) || (r.setAnchorCellForSelection(h(w)), r.setFocusCellForSelection(h(C), !0), r.isSelecting || setTimeout(() => {
1040
+ const { onMouseUp: F, onMouseMove: b } = a();
1041
+ r.isSelecting = !0, l.addEventListener("mouseup", F), l.addEventListener("mousemove", b);
1008
1042
  }, 0)));
1009
- } else if (i && F(i) && i.is(c) && i.tableKey === n.getKey()) {
1010
- const u = ft(t._window);
1043
+ } else if (i && R(i) && i.is(c) && i.tableKey === n.getKey()) {
1044
+ const u = Ct(t._window);
1011
1045
  if (u && u.anchorNode && u.focusNode) {
1012
- const g = U(u.focusNode), f = g && !n.is(ee(g)), m = U(u.anchorNode), w = m && n.is(ee(m));
1046
+ const g = Y(u.focusNode), f = g && !n.is(te(g)), p = Y(u.anchorNode), w = p && n.is(te(p));
1013
1047
  if (f && w && u.rangeCount > 0) {
1014
- const C = qt(u, t);
1048
+ const C = Zt(u, t);
1015
1049
  C && (C.anchor.set(n.getKey(), i.isBackward() ? n.getChildrenSize() : 0, "element"), u.removeAllRanges(), q(C));
1016
1050
  }
1017
1051
  }
1018
1052
  }
1019
- return i && !i.is(c) && (F(i) || F(c)) && r.tableSelection && !r.tableSelection.is(c) ? (F(i) && i.tableKey === r.tableNodeKey ? r.updateTableTableSelection(i) : !F(i) && F(c) && c.tableKey === r.tableNodeKey && r.updateTableTableSelection(null), !1) : (r.hasHijackedSelectionStyles && !n.isSelected() ? function(u, g) {
1020
- g.enableHighlightStyle(), Me(g.table, (f) => {
1021
- const m = f.elem;
1022
- f.highlighted = !1, wt(u, f), m.getAttribute("style") || m.removeAttribute("style");
1053
+ return i && !i.is(c) && (R(i) || R(c)) && r.tableSelection && !r.tableSelection.is(c) ? (R(i) && i.tableKey === r.tableNodeKey ? r.updateTableTableSelection(i) : !R(i) && R(c) && c.tableKey === r.tableNodeKey && r.updateTableTableSelection(null), !1) : (r.hasHijackedSelectionStyles && !n.isSelected() ? function(u, g) {
1054
+ g.enableHighlightStyle(), Ke(g.table, (f) => {
1055
+ const p = f.elem;
1056
+ f.highlighted = !1, yt(u, f), p.getAttribute("style") || p.removeAttribute("style");
1023
1057
  });
1024
- }(t, r) : !r.hasHijackedSelectionStyles && n.isSelected() && Xe(t, r), !1);
1025
- }, L)), r.listenersToRemove.add(t.registerCommand($t, () => {
1026
- const i = k();
1027
- if (!D(i) || !i.isCollapsed() || !j(i, n)) return !1;
1028
- const c = qe(t, i, n);
1029
- return !!c && (je(c, n), !0);
1030
- }, L)), r;
1031
- }
1032
- function Ue(n) {
1033
- return n[xe] || null;
1034
- }
1035
- function Ye(n) {
1058
+ }(t, r) : !r.hasHijackedSelectionStyles && n.isSelected() && $e(t, r), !1);
1059
+ }, B)), r.listenersToRemove.add(t.registerCommand(Qt, () => {
1060
+ const i = D();
1061
+ if (!A(i) || !i.isCollapsed() || !G(i, n)) return !1;
1062
+ const c = Ve(t, i, n);
1063
+ return !!c && (Ge(c, n), !0);
1064
+ }, B)), r;
1065
+ }
1066
+ function je(n) {
1067
+ return n[Te] || null;
1068
+ }
1069
+ function qe(n) {
1036
1070
  let e = n;
1037
1071
  for (; e != null; ) {
1038
1072
  const t = e.nodeName;
@@ -1075,44 +1109,44 @@ function ce(n) {
1075
1109
  }
1076
1110
  return t.columns = s + 1, t.rows = r + 1, t;
1077
1111
  }
1078
- function fe(n, e, t) {
1112
+ function me(n, e, t) {
1079
1113
  const o = new Set(t ? t.getNodes() : []);
1080
- Me(e, (s, r) => {
1114
+ Ke(e, (s, r) => {
1081
1115
  const l = s.elem;
1082
- o.has(r) ? (s.highlighted = !0, pt(n, s)) : (s.highlighted = !1, wt(n, s), l.getAttribute("style") || l.removeAttribute("style"));
1116
+ o.has(r) ? (s.highlighted = !0, bt(n, s)) : (s.highlighted = !1, yt(n, s), l.getAttribute("style") || l.removeAttribute("style"));
1083
1117
  });
1084
1118
  }
1085
- function Me(n, e) {
1119
+ function Ke(n, e) {
1086
1120
  const { domRows: t } = n;
1087
1121
  for (let o = 0; o < t.length; o++) {
1088
1122
  const s = t[o];
1089
1123
  if (s) for (let r = 0; r < s.length; r++) {
1090
1124
  const l = s[r];
1091
1125
  if (!l) continue;
1092
- const a = U(l.elem);
1126
+ const a = Y(l.elem);
1093
1127
  a !== null && e(l, a, { x: r, y: o });
1094
1128
  }
1095
1129
  }
1096
1130
  }
1097
- function Xe(n, e) {
1098
- e.disableHighlightStyle(), Me(e.table, (t) => {
1099
- t.highlighted = !0, pt(n, t);
1131
+ function $e(n, e) {
1132
+ e.disableHighlightStyle(), Ke(e.table, (t) => {
1133
+ t.highlighted = !0, bt(n, t);
1100
1134
  });
1101
1135
  }
1102
- const mt = (n, e, t, o, s) => {
1136
+ const St = (n, e, t, o, s) => {
1103
1137
  const r = s === "forward";
1104
1138
  switch (s) {
1105
1139
  case "backward":
1106
1140
  case "forward":
1107
- return t !== (r ? n.table.columns - 1 : 0) ? me(e.getCellNodeFromCordsOrThrow(t + (r ? 1 : -1), o, n.table), r) : o !== (r ? n.table.rows - 1 : 0) ? me(e.getCellNodeFromCordsOrThrow(r ? 0 : n.table.columns - 1, o + (r ? 1 : -1), n.table), r) : r ? e.selectNext() : e.selectPrevious(), !0;
1141
+ return t !== (r ? n.table.columns - 1 : 0) ? pe(e.getCellNodeFromCordsOrThrow(t + (r ? 1 : -1), o, n.table), r) : o !== (r ? n.table.rows - 1 : 0) ? pe(e.getCellNodeFromCordsOrThrow(r ? 0 : n.table.columns - 1, o + (r ? 1 : -1), n.table), r) : r ? e.selectNext() : e.selectPrevious(), !0;
1108
1142
  case "up":
1109
- return o !== 0 ? me(e.getCellNodeFromCordsOrThrow(t, o - 1, n.table), !1) : e.selectPrevious(), !0;
1143
+ return o !== 0 ? pe(e.getCellNodeFromCordsOrThrow(t, o - 1, n.table), !1) : e.selectPrevious(), !0;
1110
1144
  case "down":
1111
- return o !== n.table.rows - 1 ? me(e.getCellNodeFromCordsOrThrow(t, o + 1, n.table), !0) : e.selectNext(), !0;
1145
+ return o !== n.table.rows - 1 ? pe(e.getCellNodeFromCordsOrThrow(t, o + 1, n.table), !0) : e.selectNext(), !0;
1112
1146
  default:
1113
1147
  return !1;
1114
1148
  }
1115
- }, On = (n, e, t, o, s) => {
1149
+ }, Kn = (n, e, t, o, s) => {
1116
1150
  const r = s === "forward";
1117
1151
  switch (s) {
1118
1152
  case "backward":
@@ -1126,118 +1160,130 @@ const mt = (n, e, t, o, s) => {
1126
1160
  return !1;
1127
1161
  }
1128
1162
  };
1129
- function j(n, e) {
1130
- if (D(n) || F(n)) {
1163
+ function G(n, e) {
1164
+ if (A(n) || R(n)) {
1131
1165
  const t = e.isParentOf(n.anchor.getNode()), o = e.isParentOf(n.focus.getNode());
1132
1166
  return t && o;
1133
1167
  }
1134
1168
  return !1;
1135
1169
  }
1136
- function me(n, e) {
1170
+ function pe(n, e) {
1137
1171
  e ? n.selectStart() : n.selectEnd();
1138
1172
  }
1139
- const ye = "172,206,247";
1140
- function pt(n, e) {
1141
- const t = e.elem, o = U(t);
1142
- p(o) || x(131), o.getBackgroundColor() === null ? t.style.setProperty("background-color", `rgb(${ye})`) : t.style.setProperty("background-image", `linear-gradient(to right, rgba(${ye},0.85), rgba(${ye},0.85))`), t.style.setProperty("caret-color", "transparent");
1173
+ const xe = "172,206,247";
1174
+ function bt(n, e) {
1175
+ const t = e.elem, o = Y(t);
1176
+ m(o) || N(131), o.getBackgroundColor() === null ? t.style.setProperty("background-color", `rgb(${xe})`) : t.style.setProperty("background-image", `linear-gradient(to right, rgba(${xe},0.85), rgba(${xe},0.85))`), t.style.setProperty("caret-color", "transparent");
1143
1177
  }
1144
- function wt(n, e) {
1145
- const t = e.elem, o = U(t);
1146
- p(o) || x(131), o.getBackgroundColor() === null && t.style.removeProperty("background-color"), t.style.removeProperty("background-image"), t.style.removeProperty("caret-color");
1178
+ function yt(n, e) {
1179
+ const t = e.elem, o = Y(t);
1180
+ m(o) || N(131), o.getBackgroundColor() === null && t.style.removeProperty("background-color"), t.style.removeProperty("background-image"), t.style.removeProperty("caret-color");
1147
1181
  }
1148
- function _e(n) {
1149
- const e = N(n, p);
1150
- return p(e) ? e : null;
1182
+ function Ne(n) {
1183
+ const e = _(n, m);
1184
+ return m(e) ? e : null;
1151
1185
  }
1152
- function ee(n) {
1153
- const e = N(n, A);
1154
- return A(e) ? e : null;
1186
+ function te(n) {
1187
+ const e = _(n, M);
1188
+ return M(e) ? e : null;
1155
1189
  }
1156
1190
  function ie(n, e, t, o, s) {
1157
1191
  if ((t === "up" || t === "down") && function(l) {
1158
1192
  const a = l.getRootElement();
1159
1193
  return a ? a.hasAttribute("aria-controls") && a.getAttribute("aria-controls") === "typeahead-menu" : !1;
1160
1194
  }(n)) return !1;
1161
- const r = k();
1162
- if (!j(r, o)) {
1163
- if (D(r)) {
1195
+ const r = D();
1196
+ if (!G(r, o)) {
1197
+ if (A(r)) {
1164
1198
  if (r.isCollapsed() && t === "backward") {
1165
1199
  const l = r.anchor.type, a = r.anchor.offset;
1166
1200
  if (l !== "element" && (l !== "text" || a !== 0)) return !1;
1167
1201
  const d = r.anchor.getNode();
1168
1202
  if (!d) return !1;
1169
- const h = N(d, (c) => E(c) && !c.isInline());
1203
+ const h = _(d, (c) => T(c) && !c.isInline());
1170
1204
  if (!h) return !1;
1171
1205
  const i = h.getPreviousSibling();
1172
- return !(!i || !A(i)) && ($(e), i.selectEnd(), !0);
1206
+ return !(!i || !M(i)) && (J(e), i.selectEnd(), !0);
1173
1207
  }
1174
1208
  if (e.shiftKey && (t === "up" || t === "down")) {
1175
1209
  const l = r.focus.getNode();
1176
- if (rt(l)) {
1177
- const a = r.getNodes()[0];
1210
+ if (!r.isCollapsed() && (t === "up" && !r.isBackward() || t === "down" && r.isBackward())) {
1211
+ let a = _(l, (u) => M(u));
1212
+ if (m(a) && (a = _(a, M)), a !== o || !a) return !1;
1213
+ const d = t === "down" ? a.getNextSibling() : a.getPreviousSibling();
1214
+ if (!d) return !1;
1215
+ let h = 0;
1216
+ t === "up" && T(d) && (h = d.getChildrenSize());
1217
+ let i = d;
1218
+ t === "up" && T(d) && (i = d.getLastChild() || d, h = $(i) ? i.getTextContentSize() : 0);
1219
+ const c = r.clone();
1220
+ return c.focus.set(i.getKey(), h, $(i) ? "text" : "element"), q(c), J(e), !0;
1221
+ }
1222
+ if (it(l)) {
1223
+ const a = t === "up" ? r.getNodes()[r.getNodes().length - 1] : r.getNodes()[0];
1178
1224
  if (a) {
1179
- const d = N(a, p);
1225
+ const d = _(a, m);
1180
1226
  if (d && o.isParentOf(d)) {
1181
1227
  const h = o.getFirstDescendant(), i = o.getLastDescendant();
1182
1228
  if (!h || !i) return !1;
1183
- const [c] = le(h), [u] = le(i), g = o.getCordsFromCellNode(c, s.table), f = o.getCordsFromCellNode(u, s.table), m = o.getDOMCellFromCordsOrThrow(g.x, g.y, s.table), w = o.getDOMCellFromCordsOrThrow(f.x, f.y, s.table);
1184
- return s.setAnchorCellForSelection(m), s.setFocusCellForSelection(w, !0), !0;
1229
+ const [c] = le(h), [u] = le(i), g = o.getCordsFromCellNode(c, s.table), f = o.getCordsFromCellNode(u, s.table), p = o.getDOMCellFromCordsOrThrow(g.x, g.y, s.table), w = o.getDOMCellFromCordsOrThrow(f.x, f.y, s.table);
1230
+ return s.setAnchorCellForSelection(p), s.setFocusCellForSelection(w, !0), !0;
1185
1231
  }
1186
1232
  }
1187
1233
  return !1;
1188
1234
  }
1189
1235
  {
1190
- const a = N(l, (h) => E(h) && !h.isInline());
1191
- if (!a) return !1;
1236
+ let a = _(l, (h) => T(h) && !h.isInline());
1237
+ if (m(a) && (a = _(a, M)), !a) return !1;
1192
1238
  const d = t === "down" ? a.getNextSibling() : a.getPreviousSibling();
1193
- if (A(d) && s.tableNodeKey === d.getKey()) {
1239
+ if (M(d) && s.tableNodeKey === d.getKey()) {
1194
1240
  const h = d.getFirstDescendant(), i = d.getLastDescendant();
1195
1241
  if (!h || !i) return !1;
1196
1242
  const [c] = le(h), [u] = le(i), g = r.clone();
1197
- return g.focus.set((t === "up" ? c : u).getKey(), t === "up" ? 0 : u.getChildrenSize(), "element"), q(g), !0;
1243
+ return g.focus.set((t === "up" ? c : u).getKey(), t === "up" ? 0 : u.getChildrenSize(), "element"), J(e), q(g), !0;
1198
1244
  }
1199
1245
  }
1200
1246
  }
1201
1247
  }
1202
1248
  return !1;
1203
1249
  }
1204
- if (D(r) && r.isCollapsed()) {
1205
- const { anchor: l, focus: a } = r, d = N(l.getNode(), p), h = N(a.getNode(), p);
1206
- if (!p(d) || !d.is(h)) return !1;
1207
- const i = ee(d);
1250
+ if (A(r) && r.isCollapsed()) {
1251
+ const { anchor: l, focus: a } = r, d = _(l.getNode(), m), h = _(a.getNode(), m);
1252
+ if (!m(d) || !d.is(h)) return !1;
1253
+ const i = te(d);
1208
1254
  if (i !== o && i != null) {
1209
1255
  const C = n.getElementByKey(i.getKey());
1210
1256
  if (C != null) return s.table = ce(C), ie(n, e, t, i, s);
1211
1257
  }
1212
1258
  if (t === "backward" || t === "forward") {
1213
- const C = l.type, _ = l.offset, T = l.getNode();
1214
- if (!T) return !1;
1259
+ const C = l.type, x = l.offset, E = l.getNode();
1260
+ if (!E) return !1;
1215
1261
  const v = r.getNodes();
1216
- return (v.length !== 1 || !Ze(v[0])) && !!function(R, O, M, b) {
1262
+ return (v.length !== 1 || !nt(v[0])) && !!function(K, O, F, b) {
1217
1263
  return function(y, S, P) {
1218
1264
  return y === "element" && (P === "backward" ? S.getPreviousSibling() === null : S.getNextSibling() === null);
1219
- }(R, M, b) || function(y, S, P, H) {
1220
- const B = N(P, (I) => E(I) && !I.isInline());
1221
- if (!B) return !1;
1222
- const Y = H === "backward" ? S === 0 : S === P.getTextContentSize();
1223
- return y === "text" && Y && (H === "backward" ? B.getPreviousSibling() === null : B.getNextSibling() === null);
1224
- }(R, O, M, b);
1225
- }(C, _, T, t) && function(R, O, M, b) {
1226
- const y = N(O, p);
1227
- if (!p(y)) return !1;
1228
- const [S, P] = te(M, y, y);
1229
- if (!function(B, Y, I) {
1230
- const X = B[0][0], z = B[B.length - 1][B[0].length - 1], { startColumn: K, startRow: re } = Y;
1231
- return I === "backward" ? K === X.startColumn && re === X.startRow : K === z.startColumn && re === z.startRow;
1265
+ }(K, F, b) || function(y, S, P, L) {
1266
+ const H = _(P, (z) => T(z) && !z.isInline());
1267
+ if (!H) return !1;
1268
+ const X = L === "backward" ? S === 0 : S === P.getTextContentSize();
1269
+ return y === "text" && X && (L === "backward" ? H.getPreviousSibling() === null : H.getNextSibling() === null);
1270
+ }(K, O, F, b);
1271
+ }(C, x, E, t) && function(K, O, F, b) {
1272
+ const y = _(O, m);
1273
+ if (!m(y)) return !1;
1274
+ const [S, P] = ne(F, y, y);
1275
+ if (!function(H, X, z) {
1276
+ const j = H[0][0], U = H[H.length - 1][H[0].length - 1], { startColumn: k, startRow: re } = X;
1277
+ return z === "backward" ? k === j.startColumn && re === j.startRow : k === U.startColumn && re === U.startRow;
1232
1278
  }(S, P, b)) return !1;
1233
- const H = function(B, Y, I) {
1234
- const X = N(B, (K) => E(K) && !K.isInline());
1235
- if (!X) return;
1236
- const z = Y === "backward" ? X.getPreviousSibling() : X.getNextSibling();
1237
- return z && A(z) ? z : Y === "backward" ? I.getPreviousSibling() : I.getNextSibling();
1238
- }(O, b, M);
1239
- return !H || A(H) ? !1 : ($(R), b === "backward" ? H.selectEnd() : H.selectStart(), !0);
1240
- }(e, T, o, t);
1279
+ const L = function(H, X, z) {
1280
+ const j = _(H, (k) => T(k) && !k.isInline());
1281
+ if (!j) return;
1282
+ const U = X === "backward" ? j.getPreviousSibling() : j.getNextSibling();
1283
+ return U && M(U) ? U : X === "backward" ? z.getPreviousSibling() : z.getNextSibling();
1284
+ }(O, b, F);
1285
+ return !L || M(L) ? !1 : (J(K), b === "backward" ? L.selectEnd() : L.selectStart(), !0);
1286
+ }(e, E, o, t);
1241
1287
  }
1242
1288
  const c = n.getElementByKey(d.__key), u = n.getElementByKey(l.key);
1243
1289
  if (u == null || c == null) return !1;
@@ -1250,54 +1296,54 @@ function ie(n, e, t, o, s) {
1250
1296
  }
1251
1297
  const f = t === "up" ? d.getFirstChild() : d.getLastChild();
1252
1298
  if (f == null) return !1;
1253
- const m = n.getElementByKey(f.__key);
1254
- if (m == null) return !1;
1255
- const w = m.getBoundingClientRect();
1299
+ const p = n.getElementByKey(f.__key);
1300
+ if (p == null) return !1;
1301
+ const w = p.getBoundingClientRect();
1256
1302
  if (t === "up" ? w.top > g.top - g.height : g.bottom + g.height > w.bottom) {
1257
- $(e);
1303
+ J(e);
1258
1304
  const C = o.getCordsFromCellNode(d, s.table);
1259
- if (!e.shiftKey) return mt(s, o, C.x, C.y, t);
1305
+ if (!e.shiftKey) return St(s, o, C.x, C.y, t);
1260
1306
  {
1261
- const _ = o.getDOMCellFromCordsOrThrow(C.x, C.y, s.table);
1262
- s.setAnchorCellForSelection(_), s.setFocusCellForSelection(_, !0);
1307
+ const x = o.getDOMCellFromCordsOrThrow(C.x, C.y, s.table);
1308
+ s.setAnchorCellForSelection(x), s.setFocusCellForSelection(x, !0);
1263
1309
  }
1264
1310
  return !0;
1265
1311
  }
1266
- } else if (F(r)) {
1267
- const { anchor: l, focus: a } = r, d = N(l.getNode(), p), h = N(a.getNode(), p), [i] = r.getNodes(), c = n.getElementByKey(i.getKey());
1268
- if (!p(d) || !p(h) || !A(i) || c == null) return !1;
1312
+ } else if (R(r)) {
1313
+ const { anchor: l, focus: a } = r, d = _(l.getNode(), m), h = _(a.getNode(), m), [i] = r.getNodes(), c = n.getElementByKey(i.getKey());
1314
+ if (!m(d) || !m(h) || !M(i) || c == null) return !1;
1269
1315
  s.updateTableTableSelection(r);
1270
1316
  const u = ce(c), g = o.getCordsFromCellNode(d, u), f = o.getDOMCellFromCordsOrThrow(g.x, g.y, u);
1271
- if (s.setAnchorCellForSelection(f), $(e), e.shiftKey) {
1272
- const m = o.getCordsFromCellNode(h, u);
1273
- return On(s, i, m.x, m.y, t);
1317
+ if (s.setAnchorCellForSelection(f), J(e), e.shiftKey) {
1318
+ const p = o.getCordsFromCellNode(h, u);
1319
+ return Kn(s, i, p.x, p.y, t);
1274
1320
  }
1275
1321
  return h.selectEnd(), !0;
1276
1322
  }
1277
1323
  return !1;
1278
1324
  }
1279
- function $(n) {
1325
+ function J(n) {
1280
1326
  n.preventDefault(), n.stopImmediatePropagation(), n.stopPropagation();
1281
1327
  }
1282
- function je(n, e, t) {
1283
- const o = G();
1328
+ function Ge(n, e, t) {
1329
+ const o = V();
1284
1330
  n === "first" ? e.insertBefore(o) : e.insertAfter(o), o.append(...t || []), o.selectEnd();
1285
1331
  }
1286
- function qe(n, e, t) {
1332
+ function Ve(n, e, t) {
1287
1333
  const o = t.getParent();
1288
1334
  if (!o) return;
1289
1335
  const s = n.getElementByKey(o.getKey());
1290
1336
  if (!s) return;
1291
1337
  const r = window.getSelection();
1292
1338
  if (!r || r.anchorNode !== s) return;
1293
- const l = N(e.anchor.getNode(), (w) => p(w));
1339
+ const l = _(e.anchor.getNode(), (w) => m(w));
1294
1340
  if (!l) return;
1295
- const a = N(l, (w) => A(w));
1296
- if (!A(a) || !a.is(t)) return;
1297
- const [d, h] = te(t, l, l), i = d[0][0], c = d[d.length - 1][d[0].length - 1], { startRow: u, startColumn: g } = h, f = u === i.startRow && g === i.startColumn, m = u === c.startRow && g === c.startColumn;
1298
- return f ? "first" : m ? "last" : void 0;
1341
+ const a = _(l, (w) => M(w));
1342
+ if (!M(a) || !a.is(t)) return;
1343
+ const [d, h] = ne(t, l, l), i = d[0][0], c = d[d.length - 1][d[0].length - 1], { startRow: u, startColumn: g } = h, f = u === i.startRow && g === i.startColumn, p = u === c.startRow && g === c.startColumn;
1344
+ return f ? "first" : p ? "last" : void 0;
1299
1345
  }
1300
- function $e(n, e, t, o) {
1346
+ function Ze(n, e, t, o) {
1301
1347
  const s = n.querySelector("colgroup");
1302
1348
  if (!s) return;
1303
1349
  const r = [];
@@ -1307,10 +1353,10 @@ function $e(n, e, t, o) {
1307
1353
  }
1308
1354
  s.replaceChildren(...r);
1309
1355
  }
1310
- function Ge(n, e, t) {
1311
- t ? (ue(n, e.theme.tableRowStriping), n.setAttribute("data-lexical-row-striping", "true")) : (Ve(n, e.theme.tableRowStriping), n.removeAttribute("data-lexical-row-striping"));
1356
+ function Qe(n, e, t) {
1357
+ t ? (ue(n, e.theme.tableRowStriping), n.setAttribute("data-lexical-row-striping", "true")) : (tt(n, e.theme.tableRowStriping), n.removeAttribute("data-lexical-row-striping"));
1312
1358
  }
1313
- class Se extends Ee {
1359
+ class ye extends Fe {
1314
1360
  static getType() {
1315
1361
  return "table";
1316
1362
  }
@@ -1322,16 +1368,16 @@ class Se extends Ee {
1322
1368
  return t.__colWidths = e, t;
1323
1369
  }
1324
1370
  static clone(e) {
1325
- return new Se(e.__key);
1371
+ return new ye(e.__key);
1326
1372
  }
1327
1373
  afterCloneFrom(e) {
1328
1374
  super.afterCloneFrom(e), this.__colWidths = e.__colWidths, this.__rowStriping = e.__rowStriping;
1329
1375
  }
1330
1376
  static importDOM() {
1331
- return { table: (e) => ({ conversion: En, priority: 1 }) };
1377
+ return { table: (e) => ({ conversion: kn, priority: 1 }) };
1332
1378
  }
1333
1379
  static importJSON(e) {
1334
- const t = Fe();
1380
+ const t = ke();
1335
1381
  return t.__rowStriping = e.rowStriping || !1, t.__colWidths = e.colWidths, t;
1336
1382
  }
1337
1383
  constructor(e) {
@@ -1342,16 +1388,16 @@ class Se extends Ee {
1342
1388
  }
1343
1389
  createDOM(e, t) {
1344
1390
  const o = document.createElement("table"), s = document.createElement("colgroup");
1345
- return o.appendChild(s), $e(o, 0, this.getColumnCount(), this.getColWidths()), ue(o, e.theme.table), this.__rowStriping && Ge(o, e, !0), o;
1391
+ return o.appendChild(s), Ze(o, 0, this.getColumnCount(), this.getColWidths()), ue(o, e.theme.table), this.__rowStriping && Qe(o, e, !0), o;
1346
1392
  }
1347
1393
  updateDOM(e, t, o) {
1348
- return e.__rowStriping !== this.__rowStriping && Ge(t, o, this.__rowStriping), $e(t, 0, this.getColumnCount(), this.getColWidths()), !1;
1394
+ return e.__rowStriping !== this.__rowStriping && Qe(t, o, this.__rowStriping), Ze(t, 0, this.getColumnCount(), this.getColWidths()), !1;
1349
1395
  }
1350
1396
  exportDOM(e) {
1351
1397
  return { ...super.exportDOM(e), after: (t) => {
1352
1398
  if (t) {
1353
1399
  const o = t.cloneNode(), s = document.createElement("colgroup"), r = document.createElement("tbody");
1354
- if (ot(t)) {
1400
+ if (lt(t)) {
1355
1401
  const l = t.querySelectorAll("col");
1356
1402
  s.append(...l);
1357
1403
  const a = t.querySelectorAll("tr");
@@ -1375,7 +1421,7 @@ class Se extends Ee {
1375
1421
  const a = l.findIndex((d) => {
1376
1422
  if (!d) return;
1377
1423
  const { elem: h } = d;
1378
- return U(h) === e;
1424
+ return Y(h) === e;
1379
1425
  });
1380
1426
  if (a !== -1) return { x: a, y: r };
1381
1427
  }
@@ -1395,8 +1441,8 @@ class Se extends Ee {
1395
1441
  getCellNodeFromCords(e, t, o) {
1396
1442
  const s = this.getDOMCellFromCords(e, t, o);
1397
1443
  if (s == null) return null;
1398
- const r = U(s.elem);
1399
- return p(r) ? r : null;
1444
+ const r = Y(s.elem);
1445
+ return m(r) ? r : null;
1400
1446
  }
1401
1447
  getCellNodeFromCordsOrThrow(e, t, o) {
1402
1448
  const s = this.getCellNodeFromCords(e, t, o);
@@ -1420,41 +1466,55 @@ class Se extends Ee {
1420
1466
  if (!e) return 0;
1421
1467
  let t = 0;
1422
1468
  return e.getChildren().forEach((o) => {
1423
- p(o) && (t += o.getColSpan());
1469
+ m(o) && (t += o.getColSpan());
1424
1470
  }), t;
1425
1471
  }
1426
1472
  }
1427
- function En(n) {
1428
- const e = Fe();
1429
- return n.hasAttribute("data-lexical-row-striping") && e.setRowStriping(!0), { node: e };
1473
+ function kn(n) {
1474
+ const e = ke();
1475
+ n.hasAttribute("data-lexical-row-striping") && e.setRowStriping(!0);
1476
+ const t = n.querySelector(":scope > colgroup");
1477
+ if (t) {
1478
+ let o = [];
1479
+ for (const s of t.querySelectorAll(":scope > col")) {
1480
+ const r = s.style.width;
1481
+ if (!r || !Re.test(r)) {
1482
+ o = void 0;
1483
+ break;
1484
+ }
1485
+ o.push(parseFloat(r));
1486
+ }
1487
+ o && e.setColWidths(o);
1488
+ }
1489
+ return { node: e };
1430
1490
  }
1431
- function Fe() {
1432
- return Te(new Se());
1491
+ function ke() {
1492
+ return Oe(new ye());
1433
1493
  }
1434
- function A(n) {
1435
- return n instanceof Se;
1494
+ function M(n) {
1495
+ return n instanceof ye;
1436
1496
  }
1437
- const Ct = 100, Hn = (n, e) => {
1438
- const t = _n(0, 0, !1);
1497
+ const _t = 100, Un = (n, e) => {
1498
+ const t = Tn(0, 0, !1);
1439
1499
  for (let o = 0; o < n; o++) {
1440
1500
  const s = he();
1441
1501
  for (let r = 0; r < e; r++) {
1442
- const l = oe(0, void 0, Ct / e);
1502
+ const l = oe(0, void 0, _t / e);
1443
1503
  s.append(l);
1444
1504
  }
1445
1505
  t.append(s);
1446
1506
  }
1447
1507
  return t;
1448
- }, Bn = (n) => {
1449
- const e = n.getParentOrThrow(), t = e.getNextSibling() || e.getPreviousSibling(), o = e.getParentOrThrow();
1508
+ }, Jn = (n) => {
1509
+ const e = ge(n), t = e.getNextSibling() || e.getPreviousSibling(), o = e.getParentOrThrow();
1450
1510
  if (o.getChildrenSize() > 1 ? e.remove() : o.remove(), t !== null) {
1451
1511
  const s = t.getFirstDescendant();
1452
1512
  s && s.select();
1453
1513
  }
1454
- }, Mn = (n) => {
1455
- n.getParentOrThrow().getParentOrThrow().remove();
1456
- }, Ln = (n, e) => {
1457
- const t = he(), o = n.getParentOrThrow(), s = o.getChildrenSize();
1514
+ }, Dn = (n) => {
1515
+ Se(n).remove();
1516
+ }, Yn = (n, e) => {
1517
+ const t = he(), o = ge(n), s = o.getChildrenSize();
1458
1518
  for (let l = 0; l < s; l++) {
1459
1519
  const a = oe(0);
1460
1520
  t.append(a);
@@ -1462,51 +1522,57 @@ const Ct = 100, Hn = (n, e) => {
1462
1522
  e === "insertRowAbove" ? o.insertBefore(t) : o.insertAfter(t);
1463
1523
  const r = t.getFirstDescendant();
1464
1524
  r && r.select();
1465
- }, Wn = (n, e) => {
1466
- const t = n.getParentOrThrow(), o = t.getParentOrThrow().getChildren().indexOf(t), s = t.getChildren().length, r = t.getParentOrThrow();
1467
- let l = t.getChildren().indexOf(n);
1525
+ }, Xn = (n, e) => {
1526
+ const t = ge(n);
1527
+ if (!m(n))
1528
+ throw new Error("Selected node is not a TableCellNode");
1529
+ const o = En(n), s = t.getChildren().length, r = Se(n);
1530
+ let l = wt(n);
1468
1531
  const a = r.getChildren(), d = a.length;
1469
1532
  for (let i = 0; i < d; i++) {
1470
1533
  const c = oe(0), u = a[i].getChildren()[l];
1471
1534
  u && (e === "insertColumnLeft" ? u.insertBefore(c) : u.insertAfter(c)), a.forEach((g) => {
1472
1535
  g.getChildren().forEach((f) => {
1473
- f.setWidth(Ct / s);
1536
+ f.setWidth(_t / s);
1474
1537
  });
1475
1538
  });
1476
1539
  }
1477
1540
  l = e === "insertColumnLeft" ? l : l + 1;
1478
1541
  const h = a[o].getChildren()[l];
1479
1542
  h && h.select();
1480
- }, In = (n) => {
1481
- var r;
1482
- const e = n.getParentOrThrow(), t = e.getParentOrThrow(), o = ((r = t.getFirstChild()) == null ? void 0 : r.getChildrenSize()) || 0, s = e.getChildren().indexOf(n);
1483
- o === 1 ? Mn(n) : Nn(t, s);
1543
+ }, jn = (n) => {
1544
+ var s;
1545
+ if (!m(n))
1546
+ throw new Error("Selected node is not a TableCellNode");
1547
+ const e = Se(n), t = ((s = e.getFirstChild()) == null ? void 0 : s.getChildrenSize()) || 0, o = wt(n);
1548
+ t === 1 ? Dn(n) : On(e, o);
1484
1549
  };
1485
1550
  export {
1486
- kn as $,
1487
- le as F,
1488
- An as I,
1489
- xn as K,
1490
- Kn as L,
1491
- te as M,
1492
- pn as P,
1493
- Pn as T,
1494
- de as Z,
1495
- In as a,
1496
- Bn as b,
1497
- Ln as c,
1498
- Mn as d,
1499
- Hn as e,
1500
- Se as f,
1501
- we as g,
1502
- _n as h,
1503
- Wn as i,
1504
- A as j,
1505
- ln as k,
1506
- an as m,
1507
- p as n,
1508
- Dn as o,
1509
- oe as t,
1510
- J as u
1551
+ Hn as $,
1552
+ ne as F,
1553
+ Mn as K,
1554
+ Ln as L,
1555
+ bn as O,
1556
+ zn as U,
1557
+ Bn as _,
1558
+ jn as a,
1559
+ Jn as b,
1560
+ Yn as c,
1561
+ Dn as d,
1562
+ Un as e,
1563
+ de as f,
1564
+ In as g,
1565
+ Ce as h,
1566
+ Xn as i,
1567
+ Tn as j,
1568
+ M as k,
1569
+ le as l,
1570
+ W as m,
1571
+ oe as n,
1572
+ m as o,
1573
+ dn as p,
1574
+ hn as q,
1575
+ Wn as r,
1576
+ ye as u
1511
1577
  };
1512
- //# sourceMappingURL=helpers-BewZrn6E.js.map
1578
+ //# sourceMappingURL=helpers-D9T1Tgkj.js.map