@uva-glass/component-library 3.0.8 → 3.0.10

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