laif-ds 0.2.85 → 0.2.87

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 (113) hide show
  1. package/README.md +11 -81
  2. package/dist/CHANGELOG.md +13 -0
  3. package/dist/_virtual/index6.js +2 -2
  4. package/dist/_virtual/index7.js +2 -2
  5. package/dist/agent-docs/adoption-report.json +2 -2
  6. package/dist/agent-docs/manifest.json +3 -3
  7. package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
  8. package/dist/components/editor/editor-ui/content-editable.js +1 -1
  9. package/dist/components/editor/nodes/mention-node.js +2 -2
  10. package/dist/components/editor/plugins/actions/clear-editor-plugin.js +2 -2
  11. package/dist/components/editor/plugins/actions/counter-character-plugin.js +2 -2
  12. package/dist/components/editor/plugins/mention-plugin.js +21 -21
  13. package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +10 -10
  14. package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +5 -5
  15. package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +5 -5
  16. package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +5 -5
  17. package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +9 -9
  18. package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +3 -3
  19. package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +13 -13
  20. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +2 -2
  21. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +18 -19
  22. package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +1 -1
  23. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +3 -3
  24. package/dist/components/ui/app-editor.js +51 -51
  25. package/dist/components/ui/markdown-renderer.js +33 -32
  26. package/dist/lib/utils.js +35 -34
  27. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
  28. package/dist/node_modules/@floating-ui/{utils → core/node_modules/@floating-ui/utils}/dist/floating-ui.utils.js +33 -39
  29. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +20 -19
  30. package/dist/node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +12 -0
  31. package/dist/node_modules/@lexical/clipboard/dist/LexicalClipboard.prod.js +354 -0
  32. package/dist/node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.js +298 -0
  33. package/dist/node_modules/@lexical/dragon/dist/LexicalDragon.prod.js +89 -0
  34. package/dist/node_modules/@lexical/extension/dist/LexicalExtension.prod.js +611 -0
  35. package/dist/node_modules/@lexical/history/dist/LexicalHistory.prod.js +96 -0
  36. package/dist/node_modules/@lexical/html/dist/LexicalHtml.prod.js +604 -0
  37. package/dist/node_modules/@lexical/link/dist/LexicalLink.prod.js +201 -0
  38. package/dist/node_modules/@lexical/list/dist/LexicalList.prod.js +843 -0
  39. package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +555 -0
  40. package/dist/node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js +11 -0
  41. package/dist/node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js +13 -0
  42. package/dist/node_modules/@lexical/react/dist/LexicalComposer.prod.js +45 -0
  43. package/dist/node_modules/@lexical/react/{LexicalComposerContext.prod.js → dist/LexicalComposerContext.prod.js} +1 -1
  44. package/dist/node_modules/@lexical/react/dist/LexicalContentEditable.prod.js +53 -0
  45. package/dist/node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js +21 -0
  46. package/dist/node_modules/@lexical/react/{LexicalHistoryPlugin.prod.js → dist/LexicalHistoryPlugin.prod.js} +3 -3
  47. package/dist/node_modules/@lexical/react/dist/LexicalListPlugin.prod.js +17 -0
  48. package/dist/node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js +16 -0
  49. package/dist/node_modules/@lexical/react/dist/LexicalReactProviderExtension.prod.js +6 -0
  50. package/dist/node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js +77 -0
  51. package/dist/node_modules/@lexical/react/dist/LexicalTypeaheadMenuPlugin.prod.js +245 -0
  52. package/dist/node_modules/@lexical/react/dist/useLexicalEditable.prod.js +22 -0
  53. package/dist/node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js +567 -0
  54. package/dist/node_modules/@lexical/selection/dist/LexicalSelection.prod.js +123 -0
  55. package/dist/node_modules/@lexical/table/dist/LexicalTable.prod.js +929 -0
  56. package/dist/node_modules/@lexical/text/{LexicalText.prod.js → dist/LexicalText.prod.js} +6 -6
  57. package/dist/node_modules/@lexical/utils/dist/LexicalUtils.prod.js +111 -0
  58. package/dist/node_modules/eventemitter3/index2.js +1 -1
  59. package/dist/node_modules/lexical/dist/Lexical.prod.js +6731 -0
  60. package/dist/node_modules/style-to-object/cjs/index.js +1 -1
  61. package/package.json +17 -15
  62. package/dist/_virtual/prism-cpp.js +0 -3
  63. package/dist/_virtual/prism-cpp2.js +0 -5
  64. package/dist/_virtual/prism-java.js +0 -3
  65. package/dist/_virtual/prism-java2.js +0 -5
  66. package/dist/_virtual/prism-python.js +0 -3
  67. package/dist/_virtual/prism-python2.js +0 -5
  68. package/dist/_virtual/prism-rust.js +0 -3
  69. package/dist/_virtual/prism-rust2.js +0 -5
  70. package/dist/_virtual/prism-typescript.js +0 -3
  71. package/dist/_virtual/prism-typescript2.js +0 -5
  72. package/dist/_virtual/prism.js +0 -3
  73. package/dist/_virtual/prism2.js +0 -5
  74. package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -159
  75. package/dist/node_modules/@lexical/code/LexicalCode.prod.js +0 -236
  76. package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +0 -46
  77. package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +0 -89
  78. package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +0 -108
  79. package/dist/node_modules/@lexical/link/LexicalLink.prod.js +0 -187
  80. package/dist/node_modules/@lexical/list/LexicalList.prod.js +0 -729
  81. package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +0 -367
  82. package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +0 -11
  83. package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +0 -17
  84. package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +0 -45
  85. package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +0 -55
  86. package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +0 -49
  87. package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +0 -17
  88. package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +0 -16
  89. package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +0 -56
  90. package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +0 -220
  91. package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +0 -21
  92. package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -376
  93. package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -107
  94. package/dist/node_modules/@lexical/table/LexicalTable.prod.js +0 -661
  95. package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -102
  96. package/dist/node_modules/lexical/Lexical.prod.js +0 -4912
  97. package/dist/node_modules/prismjs/components/prism-c.js +0 -77
  98. package/dist/node_modules/prismjs/components/prism-clike.js +0 -32
  99. package/dist/node_modules/prismjs/components/prism-cpp.js +0 -93
  100. package/dist/node_modules/prismjs/components/prism-css.js +0 -56
  101. package/dist/node_modules/prismjs/components/prism-java.js +0 -122
  102. package/dist/node_modules/prismjs/components/prism-javascript.js +0 -138
  103. package/dist/node_modules/prismjs/components/prism-markdown.js +0 -301
  104. package/dist/node_modules/prismjs/components/prism-markup.js +0 -174
  105. package/dist/node_modules/prismjs/components/prism-objectivec.js +0 -11
  106. package/dist/node_modules/prismjs/components/prism-powershell.js +0 -56
  107. package/dist/node_modules/prismjs/components/prism-python.js +0 -69
  108. package/dist/node_modules/prismjs/components/prism-rust.js +0 -124
  109. package/dist/node_modules/prismjs/components/prism-sql.js +0 -34
  110. package/dist/node_modules/prismjs/components/prism-swift.js +0 -114
  111. package/dist/node_modules/prismjs/components/prism-typescript.js +0 -53
  112. package/dist/node_modules/prismjs/prism.js +0 -1165
  113. /package/dist/node_modules/@floating-ui/{utils → dom/node_modules/@floating-ui/utils}/dist/floating-ui.utils.dom.js +0 -0
@@ -0,0 +1,929 @@
1
+ "use client";
2
+ import { $getNodeByKey as st, $createPoint as mt, $createParagraphNode as R, $createTextNode as Kt, $isParagraphNode as Ot, $isElementNode as Ft, $normalizeSelection__EXPERIMENTAL as Bt, isCurrentlyReadOnlyMode as Ht, TEXT_TYPE_TO_FORMAT as Ut, $applyNodeReplacement as dt, $findMatchingParent as H, $isTextNode as G, ElementNode as _t, $getDocument as k, setDOMStyleFromCSS as St, setDOMUnmanaged as Pt, addClassNamesToElement as W, $getEditor as Jt, removeClassNamesFromElement as Y, isHTMLElement as I, $getNearestNodeFromDOMNode as Mt, $isInlineElementOrDecoratorNode as vt, $isLineBreakNode as Q, isHTMLTableRowElement as qt, IS_ITALIC as Vt, IS_UNDERLINE as Xt, IS_STRIKETHROUGH as Yt, IS_BOLD as Gt } from "../../../lexical/dist/Lexical.prod.js";
3
+ import { defineImportRule as at, sel as it, ImportTextFormat as Ct, ImportTextStyle as wt, $propagateTextAlignToBlockChildren as Qt, contextValue as yt } from "../../html/dist/LexicalHtml.prod.js";
4
+ import { $descendantsMatching as Z } from "../../utils/dist/LexicalUtils.prod.js";
5
+ const K = /^(\d+(?:\.\d+)?)px$/, y = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
6
+ class P extends _t {
7
+ __colSpan;
8
+ __rowSpan;
9
+ __headerState;
10
+ __width;
11
+ __backgroundColor;
12
+ __verticalAlign;
13
+ static getType() {
14
+ return "tablecell";
15
+ }
16
+ static clone(t) {
17
+ return new P(t.__headerState, t.__colSpan, t.__width, t.__key);
18
+ }
19
+ afterCloneFrom(t) {
20
+ super.afterCloneFrom(t), this.__rowSpan = t.__rowSpan, this.__backgroundColor = t.__backgroundColor, this.__verticalAlign = t.__verticalAlign, this.__colSpan = t.__colSpan, this.__headerState = t.__headerState, this.__width = t.__width;
21
+ }
22
+ static importDOM() {
23
+ return { td: (t) => ({ conversion: bt, priority: 0 }), th: (t) => ({ conversion: bt, priority: 0 }) };
24
+ }
25
+ static importJSON(t) {
26
+ return M().updateFromJSON(t);
27
+ }
28
+ updateFromJSON(t) {
29
+ return super.updateFromJSON(t).setHeaderStyles(t.headerState).setColSpan(t.colSpan || 1).setRowSpan(t.rowSpan || 1).setWidth(t.width || void 0).setBackgroundColor(t.backgroundColor || null).setVerticalAlign(t.verticalAlign || void 0);
30
+ }
31
+ constructor(t = y.NO_STATUS, e = 1, n, o) {
32
+ super(o), this.__colSpan = e, this.__rowSpan = 1, this.__headerState = t, this.__width = n, this.__backgroundColor = null, this.__verticalAlign = void 0;
33
+ }
34
+ createDOM(t) {
35
+ const e = k().createElement(this.getTag());
36
+ return this.__width && (e.style.width = `${this.__width}px`), this.__colSpan > 1 && (e.colSpan = this.__colSpan), this.__rowSpan > 1 && (e.rowSpan = this.__rowSpan), this.__backgroundColor !== null && (e.style.backgroundColor = this.__backgroundColor), ut(this.__verticalAlign) && (e.style.verticalAlign = this.__verticalAlign), W(e, t.theme.tableCell, this.hasHeader() && t.theme.tableCellHeader), e;
37
+ }
38
+ exportDOM(t) {
39
+ const e = super.exportDOM(t);
40
+ if (I(e.element)) {
41
+ const n = e.element;
42
+ n.setAttribute("data-temporary-table-cell-lexical-key", this.getKey()), n.style.border = "1px solid black", this.__colSpan > 1 && (n.colSpan = this.__colSpan), this.__rowSpan > 1 && (n.rowSpan = this.__rowSpan), n.style.width = `${this.getWidth() || 75}px`, n.style.verticalAlign = this.getVerticalAlign() || "top", n.style.textAlign = "start", this.__backgroundColor === null && this.hasHeader() && (n.style.backgroundColor = "#f2f3f5");
43
+ }
44
+ return e;
45
+ }
46
+ exportJSON() {
47
+ return { ...super.exportJSON(), ...ut(this.__verticalAlign) && { verticalAlign: this.__verticalAlign }, backgroundColor: this.getBackgroundColor(), colSpan: this.__colSpan, headerState: this.__headerState, rowSpan: this.__rowSpan, width: this.getWidth() };
48
+ }
49
+ getColSpan() {
50
+ return this.getLatest().__colSpan;
51
+ }
52
+ setColSpan(t) {
53
+ const e = this.getWritable();
54
+ return e.__colSpan = t, e;
55
+ }
56
+ getRowSpan() {
57
+ return this.getLatest().__rowSpan;
58
+ }
59
+ setRowSpan(t) {
60
+ const e = this.getWritable();
61
+ return e.__rowSpan = t, e;
62
+ }
63
+ getTag() {
64
+ return this.hasHeader() ? "th" : "td";
65
+ }
66
+ setHeaderStyles(t, e = y.BOTH) {
67
+ const n = this.getWritable();
68
+ return n.__headerState = t & e | n.__headerState & ~e, n;
69
+ }
70
+ getHeaderStyles() {
71
+ return this.getLatest().__headerState;
72
+ }
73
+ setWidth(t) {
74
+ const e = this.getWritable();
75
+ return e.__width = t, e;
76
+ }
77
+ getWidth() {
78
+ return this.getLatest().__width;
79
+ }
80
+ getBackgroundColor() {
81
+ return this.getLatest().__backgroundColor;
82
+ }
83
+ setBackgroundColor(t) {
84
+ const e = this.getWritable();
85
+ return e.__backgroundColor = t, e;
86
+ }
87
+ getVerticalAlign() {
88
+ return this.getLatest().__verticalAlign;
89
+ }
90
+ setVerticalAlign(t) {
91
+ const e = this.getWritable();
92
+ return e.__verticalAlign = t || void 0, e;
93
+ }
94
+ toggleHeaderStyle(t) {
95
+ const e = this.getWritable();
96
+ return (e.__headerState & t) === t ? e.__headerState -= t : e.__headerState += t, e;
97
+ }
98
+ hasHeaderState(t) {
99
+ return (this.getHeaderStyles() & t) === t;
100
+ }
101
+ hasHeader() {
102
+ return this.getLatest().__headerState !== y.NO_STATUS;
103
+ }
104
+ updateDOM(t) {
105
+ return t.__headerState !== this.__headerState || t.__width !== this.__width || t.__colSpan !== this.__colSpan || t.__rowSpan !== this.__rowSpan || t.__backgroundColor !== this.__backgroundColor || t.__verticalAlign !== this.__verticalAlign;
106
+ }
107
+ isShadowRoot() {
108
+ return !0;
109
+ }
110
+ collapseAtStart() {
111
+ return !0;
112
+ }
113
+ canBeEmpty() {
114
+ return !1;
115
+ }
116
+ canIndent() {
117
+ return !1;
118
+ }
119
+ }
120
+ function ut(l) {
121
+ return l === "middle" || l === "bottom";
122
+ }
123
+ function bt(l) {
124
+ const t = l, e = l.nodeName.toLowerCase();
125
+ let n;
126
+ K.test(t.style.width) && (n = parseFloat(t.style.width));
127
+ let o = y.NO_STATUS;
128
+ if (e === "th") {
129
+ const m = t.getAttribute("scope");
130
+ if (m === "col") o = y.COLUMN;
131
+ else if (m === "row") o = y.ROW;
132
+ else {
133
+ const a = t.parentElement, d = I(a) && a.nodeName.toLowerCase() === "tr" && I(a.parentElement) && (a.parentElement.nodeName.toLowerCase() === "thead" || a.rowIndex === 0), C = t.cellIndex === 0;
134
+ d && (o |= y.ROW), C && (o |= y.COLUMN), o === y.NO_STATUS && (o = y.ROW);
135
+ }
136
+ }
137
+ const r = M(o, t.colSpan, n);
138
+ r.__rowSpan = t.rowSpan;
139
+ const s = t.style.backgroundColor;
140
+ s !== "" && (r.__backgroundColor = s);
141
+ const c = t.style.verticalAlign;
142
+ ut(c) && (r.__verticalAlign = c);
143
+ const i = t.style, p = (i && i.textDecoration || "").split(" "), h = i.fontWeight === "700" || i.fontWeight === "bold", u = p.includes("line-through"), g = i.fontStyle === "italic", S = p.includes("underline"), _ = i.color;
144
+ return { after: (m) => {
145
+ const a = [];
146
+ let d = null;
147
+ const C = () => {
148
+ if (d) {
149
+ const f = d.getFirstChild();
150
+ Q(f) && d.getChildrenSize() === 1 && f.remove();
151
+ }
152
+ };
153
+ for (const f of m) if (vt(f) || G(f) || Q(f)) {
154
+ if (G(f) && (h && f.toggleFormat("bold"), u && f.toggleFormat("strikethrough"), g && f.toggleFormat("italic"), S && f.toggleFormat("underline"), _)) {
155
+ const N = f.getStyle();
156
+ N.includes("color:") || f.setStyle(N + `color: ${_};`);
157
+ }
158
+ d ? d.append(f) : (d = R().append(f), a.push(d));
159
+ } else a.push(f), C(), d = null;
160
+ return C(), a.length === 0 && a.push(R()), a;
161
+ }, node: r };
162
+ }
163
+ function M(l = y.NO_STATUS, t = 1, e) {
164
+ return dt(new P(l, t, e));
165
+ }
166
+ function x(l) {
167
+ return l instanceof P;
168
+ }
169
+ function b(l, ...t) {
170
+ const e = new URL("https://lexical.dev/docs/error"), n = new URLSearchParams();
171
+ n.append("code", l);
172
+ for (const o of t) n.append("v", o);
173
+ throw e.search = n.toString(), Error(`Minified Lexical error #${l}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
174
+ }
175
+ class j extends _t {
176
+ __height;
177
+ static getType() {
178
+ return "tablerow";
179
+ }
180
+ static clone(t) {
181
+ return new j(t.__height, t.__key);
182
+ }
183
+ afterCloneFrom(t) {
184
+ super.afterCloneFrom(t), this.__height = t.__height;
185
+ }
186
+ static importDOM() {
187
+ return { tr: (t) => ({ conversion: Zt, priority: 0 }) };
188
+ }
189
+ static importJSON(t) {
190
+ return B().updateFromJSON(t);
191
+ }
192
+ updateFromJSON(t) {
193
+ return super.updateFromJSON(t).setHeight(t.height);
194
+ }
195
+ constructor(t, e) {
196
+ super(e), this.__height = t;
197
+ }
198
+ exportJSON() {
199
+ const t = this.getHeight();
200
+ return { ...super.exportJSON(), ...t === void 0 ? void 0 : { height: t } };
201
+ }
202
+ createDOM(t) {
203
+ const e = k().createElement("tr");
204
+ return this.__height && (e.style.height = `${this.__height}px`), W(e, t.theme.tableRow), e;
205
+ }
206
+ extractWithChild(t, e, n) {
207
+ return n === "html";
208
+ }
209
+ isShadowRoot() {
210
+ return !0;
211
+ }
212
+ setHeight(t) {
213
+ const e = this.getWritable();
214
+ return e.__height = t, e;
215
+ }
216
+ getHeight() {
217
+ return this.getLatest().__height;
218
+ }
219
+ updateDOM(t) {
220
+ return t.__height !== this.__height;
221
+ }
222
+ canBeEmpty() {
223
+ return !1;
224
+ }
225
+ canIndent() {
226
+ return !1;
227
+ }
228
+ }
229
+ function Zt(l) {
230
+ const t = l;
231
+ let e;
232
+ return K.test(t.style.height) && (e = parseFloat(t.style.height)), { after: (n) => Z(n, x), node: B(e) };
233
+ }
234
+ function B(l) {
235
+ return dt(new j(l));
236
+ }
237
+ function T(l) {
238
+ return l instanceof j;
239
+ }
240
+ function jt(l) {
241
+ const t = H(l, (e) => U(e));
242
+ if (U(t)) return t;
243
+ throw new Error("Expected table cell to be inside of table.");
244
+ }
245
+ const ht = (l, t) => l === y.BOTH || l === t ? t : y.NO_STATUS;
246
+ function te(l, t = !0) {
247
+ const [, , e] = q(l), [n, o] = J(e, l, l), r = n[0].length, { startRow: s } = o;
248
+ let c = null;
249
+ if (t) {
250
+ const i = s + l.__rowSpan - 1, p = n[i], h = B();
251
+ for (let g = 0; g < r; g++) {
252
+ const { cell: S, startRow: _ } = p[g];
253
+ if (_ + S.__rowSpan - 1 <= i) {
254
+ const m = p[g].cell.__headerState, a = ht(m, y.COLUMN);
255
+ h.append(M(a).append(R()));
256
+ } else S.setRowSpan(S.__rowSpan + 1);
257
+ }
258
+ const u = e.getChildAtIndex(i);
259
+ T(u) || b(256), u.insertAfter(h), c = h;
260
+ } else {
261
+ const i = s, p = n[i], h = B();
262
+ for (let g = 0; g < r; g++) {
263
+ const { cell: S, startRow: _ } = p[g];
264
+ if (_ === i) {
265
+ const m = p[g].cell.__headerState, a = ht(m, y.COLUMN);
266
+ h.append(M(a).append(R()));
267
+ } else S.setRowSpan(S.__rowSpan + 1);
268
+ }
269
+ const u = e.getChildAtIndex(i);
270
+ T(u) || b(257), u.insertBefore(h), c = h;
271
+ }
272
+ return c;
273
+ }
274
+ function ee(l, t = !0, e = !0) {
275
+ const [, , n] = q(l), [o, r] = J(n, l, l), s = o.length, { startColumn: c } = r, i = t ? c + l.__colSpan - 1 : c - 1, p = n.getFirstChild();
276
+ T(p) || b(120);
277
+ let h = null;
278
+ function u(_ = y.NO_STATUS) {
279
+ const m = M(_).append(R());
280
+ return h === null && (h = m), m;
281
+ }
282
+ let g = p;
283
+ t: for (let _ = 0; _ < s; _++) {
284
+ if (_ !== 0) {
285
+ const A = g.getNextSibling();
286
+ T(A) || b(121), g = A;
287
+ }
288
+ const m = o[_], a = m[i < 0 ? 0 : i].cell.__headerState, d = ht(a, y.ROW);
289
+ if (i < 0) {
290
+ Wt(g, u(d));
291
+ continue;
292
+ }
293
+ const { cell: C, startColumn: f, startRow: N } = m[i];
294
+ if (f + C.__colSpan - 1 <= i) {
295
+ let A = C, V = N, L = i;
296
+ for (; V !== _ && A.__rowSpan > 1; ) {
297
+ if (L -= C.__colSpan, !(L >= 0)) {
298
+ g.append(u(d));
299
+ continue t;
300
+ }
301
+ {
302
+ const { cell: z, startRow: nt } = m[L];
303
+ A = z, V = nt;
304
+ }
305
+ }
306
+ A.insertAfter(u(d));
307
+ } else C.setColSpan(C.__colSpan + 1);
308
+ }
309
+ h !== null && e && ne(h);
310
+ const S = n.getColWidths();
311
+ if (S) {
312
+ const _ = [...S], m = i < 0 ? 0 : i, a = _[m];
313
+ _.splice(m, 0, a), n.setColWidths(_);
314
+ }
315
+ return h;
316
+ }
317
+ function ne(l) {
318
+ const t = l.getFirstDescendant();
319
+ t == null ? l.selectStart() : t.getParentOrThrow().selectStart();
320
+ }
321
+ function Wt(l, t) {
322
+ const e = l.getFirstChild();
323
+ e !== null ? e.insertBefore(t) : l.append(t);
324
+ }
325
+ function oe(l) {
326
+ if (l.length === 0) return null;
327
+ const t = jt(l[0]), [e] = E(t, null, null);
328
+ let n = 1 / 0, o = -1 / 0, r = 1 / 0, s = -1 / 0;
329
+ const c = /* @__PURE__ */ new Set();
330
+ for (const S of e) for (const _ of S) {
331
+ if (!_ || !_.cell) continue;
332
+ const m = _.cell.getKey();
333
+ if (!c.has(m) && l.some((a) => a.is(_.cell))) {
334
+ c.add(m);
335
+ const a = _.startRow, d = _.startColumn, C = _.cell.__rowSpan || 1, f = _.cell.__colSpan || 1;
336
+ n = Math.min(n, a), o = Math.max(o, a + C - 1), r = Math.min(r, d), s = Math.max(s, d + f - 1);
337
+ }
338
+ }
339
+ if (n === 1 / 0 || r === 1 / 0) return null;
340
+ const i = o - n + 1, p = s - r + 1, h = e[n][r];
341
+ if (!h.cell) return null;
342
+ const u = h.cell;
343
+ u.setColSpan(p), u.setRowSpan(i);
344
+ const g = /* @__PURE__ */ new Set([u.getKey()]);
345
+ for (let S = n; S <= o; S++) for (let _ = r; _ <= s; _++) {
346
+ const m = e[S][_];
347
+ if (!m.cell) continue;
348
+ const a = m.cell, d = a.getKey();
349
+ g.has(d) || (g.add(d), re(a) || u.append(...a.getChildren()), a.remove());
350
+ }
351
+ return u.getChildrenSize() === 0 && u.append(R()), u;
352
+ }
353
+ function re(l) {
354
+ if (l.getChildrenSize() !== 1) return !1;
355
+ const t = l.getFirstChildOrThrow();
356
+ return !(!Ot(t) || !t.isEmpty());
357
+ }
358
+ function le(l) {
359
+ const [t, e, n] = q(l), o = t.__colSpan, r = t.__rowSpan;
360
+ if (o === 1 && r === 1) return;
361
+ const [s, c] = J(n, t, t), { startColumn: i, startRow: p } = c, h = t.__headerState & y.COLUMN, u = Array.from({ length: o }, (_, m) => {
362
+ let a = h;
363
+ for (let d = 0; a !== 0 && d < s.length; d++) a &= s[d][m + i].cell.__headerState;
364
+ return a;
365
+ }), g = t.__headerState & y.ROW, S = Array.from({ length: r }, (_, m) => {
366
+ let a = g;
367
+ for (let d = 0; a !== 0 && d < s[0].length; d++) a &= s[m + p][d].cell.__headerState;
368
+ return a;
369
+ });
370
+ if (o > 1) {
371
+ for (let _ = 1; _ < o; _++) t.insertAfter(M(u[_] | S[0]).append(R()));
372
+ t.setColSpan(1);
373
+ }
374
+ if (r > 1) {
375
+ let _;
376
+ for (let m = 1; m < r; m++) {
377
+ const a = p + m, d = s[a];
378
+ _ = (_ || e).getNextSibling(), T(_) || b(125);
379
+ let C = null;
380
+ for (let f = 0; f < i; f++) {
381
+ const N = d[f], A = N.cell;
382
+ N.startRow === a && (C = A), A.__colSpan > 1 && (f += A.__colSpan - 1);
383
+ }
384
+ if (C === null) for (let f = o - 1; f >= 0; f--) Wt(_, M(u[f] | S[m]).append(R()));
385
+ else for (let f = o - 1; f >= 0; f--) C.insertAfter(M(u[f] | S[m]).append(R()));
386
+ }
387
+ t.setRowSpan(1);
388
+ }
389
+ }
390
+ function J(l, t, e) {
391
+ const [n, o, r] = E(l, t, e);
392
+ return o === null && b(207), r === null && b(208), [n, o, r];
393
+ }
394
+ function E(l, t, e) {
395
+ const n = [];
396
+ let o = null, r = null;
397
+ function s(i) {
398
+ let p = n[i];
399
+ return p === void 0 && (n[i] = p = []), p;
400
+ }
401
+ const c = l.getChildren();
402
+ for (let i = 0; i < c.length; i++) {
403
+ const p = c[i];
404
+ T(p) || b(209);
405
+ const h = s(i);
406
+ for (let u = p.getFirstChild(), g = 0; u != null; u = u.getNextSibling()) {
407
+ for (x(u) || b(147); h[g] !== void 0; ) g++;
408
+ const S = { cell: u, startColumn: g, startRow: i }, { __rowSpan: _, __colSpan: m } = u;
409
+ for (let a = 0; a < _ && !(i + a >= c.length); a++) {
410
+ const d = s(i + a);
411
+ for (let C = 0; C < m; C++) d[g + C] = S;
412
+ }
413
+ t !== null && o === null && t.is(u) && (o = S), e !== null && r === null && e.is(u) && (r = S);
414
+ }
415
+ }
416
+ return [n, o, r];
417
+ }
418
+ function q(l) {
419
+ let t;
420
+ if (l instanceof P) t = l;
421
+ else if ("__type" in l) {
422
+ const o = H(l, x);
423
+ x(o) || b(148), t = o;
424
+ } else {
425
+ const o = H(l.getNode(), x);
426
+ x(o) || b(148), t = o;
427
+ }
428
+ const e = t.getParent();
429
+ T(e) || b(149);
430
+ const n = e.getParent();
431
+ return U(n) || b(210), [t, e, n];
432
+ }
433
+ function zt(l, t, e) {
434
+ let n, o = Math.min(t.startColumn, e.startColumn), r = Math.min(t.startRow, e.startRow), s = Math.max(t.startColumn + t.cell.__colSpan - 1, e.startColumn + e.cell.__colSpan - 1), c = Math.max(t.startRow + t.cell.__rowSpan - 1, e.startRow + e.cell.__rowSpan - 1);
435
+ do {
436
+ n = !1;
437
+ for (let i = 0; i < l.length; i++) for (let p = 0; p < l[0].length; p++) {
438
+ const h = l[i][p];
439
+ if (!h) continue;
440
+ const u = h.startColumn + h.cell.__colSpan - 1, g = h.startRow + h.cell.__rowSpan - 1, S = h.startColumn <= s && u >= o, _ = h.startRow <= c && g >= r;
441
+ if (S && _) {
442
+ const m = Math.min(o, h.startColumn), a = Math.max(s, u), d = Math.min(r, h.startRow), C = Math.max(c, g);
443
+ m === o && a === s && d === r && C === c || (o = m, s = a, r = d, c = C, n = !0);
444
+ }
445
+ }
446
+ } while (n);
447
+ return { maxColumn: s, maxRow: c, minColumn: o, minRow: r };
448
+ }
449
+ function Nt(l) {
450
+ const [t, , e] = q(l), n = e.getChildren().filter(T), o = n.length, r = n[0].getChildren().length, s = new Array(o);
451
+ for (let c = 0; c < o; c++) s[c] = new Array(r);
452
+ for (let c = 0; c < o; c++) {
453
+ const i = n[c].getChildren().filter(x);
454
+ let p = 0;
455
+ for (let h = 0; h < i.length; h++) {
456
+ for (; s[c][p]; ) p++;
457
+ const u = i[h], g = u.__rowSpan || 1, S = u.__colSpan || 1;
458
+ for (let _ = 0; _ < g; _++) for (let m = 0; m < S; m++) s[c + _][p + m] = u;
459
+ if (t === u) return { colSpan: S, columnIndex: p, rowIndex: c, rowSpan: g };
460
+ p += S;
461
+ }
462
+ }
463
+ return null;
464
+ }
465
+ function se(l, t) {
466
+ const e = t.getStartEndPoints(), n = $t(t);
467
+ if (e === null) return !1;
468
+ const [o, r] = e, [s, c, i] = q(o), p = H(r.getNode(), (w) => x(w));
469
+ if (!(x(s) && x(p) && T(c) && U(i))) return !1;
470
+ const [h, u, g] = J(i, s, p), [S] = E(l, null, null), _ = h.length, m = _ > 0 ? h[0].length : 0;
471
+ let a = u.startRow, d = u.startColumn, C = S.length, f = C > 0 ? S[0].length : 0;
472
+ if (n) {
473
+ const w = zt(h, u, g), O = w.maxRow - w.minRow + 1, F = w.maxColumn - w.minColumn + 1;
474
+ a = w.minRow, d = w.minColumn, C = Math.min(C, O), f = Math.min(f, F);
475
+ }
476
+ let N = !1;
477
+ const A = Math.min(_, a + C) - 1, V = Math.min(m, d + f) - 1, L = /* @__PURE__ */ new Set();
478
+ for (let w = a; w <= A; w++) for (let O = d; O <= V; O++) {
479
+ const F = h[w][O];
480
+ L.has(F.cell.getKey()) || F.cell.__rowSpan === 1 && F.cell.__colSpan === 1 || (le(F.cell), L.add(F.cell.getKey()), N = !0);
481
+ }
482
+ let [z] = E(i.getWritable(), null, null);
483
+ const nt = C - _ + a;
484
+ for (let w = 0; w < nt; w++)
485
+ te(z[_ - 1][0].cell);
486
+ const kt = f - m + d;
487
+ for (let w = 0; w < kt; w++)
488
+ ee(z[0][m - 1].cell, !0, !1);
489
+ [z] = E(i.getWritable(), null, null);
490
+ for (let w = a; w < a + C; w++) for (let O = d; O < d + f; O++) {
491
+ const F = w - a, ft = O - d, ot = S[F][ft];
492
+ if (ot.startRow !== F || ot.startColumn !== ft) continue;
493
+ const D = ot.cell;
494
+ if (D.__rowSpan !== 1 || D.__colSpan !== 1) {
495
+ const v = [], It = Math.min(w + D.__rowSpan, a + C) - 1, Lt = Math.min(O + D.__colSpan, d + f) - 1;
496
+ for (let rt = w; rt <= It; rt++) for (let lt = O; lt <= Lt; lt++) {
497
+ const Dt = z[rt][lt];
498
+ v.push(Dt.cell);
499
+ }
500
+ oe(v), N = !0;
501
+ }
502
+ const { cell: X } = z[w][O], gt = D.getBackgroundColor();
503
+ gt != null && X.setBackgroundColor(gt);
504
+ const Et = X.getChildren();
505
+ D.getChildren().forEach((v) => {
506
+ G(v) && R().append(v), X.append(v);
507
+ }), Et.forEach((v) => v.remove());
508
+ }
509
+ if (n && N) {
510
+ const [w] = E(i.getWritable(), null, null);
511
+ w[u.startRow][u.startColumn].cell.selectEnd();
512
+ }
513
+ return !0;
514
+ }
515
+ function ct(l) {
516
+ const [[t, e, n, o], [r, s, c, i]] = ["anchor", "focus"].map((p) => {
517
+ const h = l[p].getNode(), u = H(h, x);
518
+ x(u) || b(238, p, h.getKey(), h.getType());
519
+ const g = u.getParent();
520
+ T(g) || b(239, p);
521
+ const S = g.getParent();
522
+ return U(S) || b(240, p), [h, u, g, S];
523
+ });
524
+ return o.is(i) || b(241), { anchorCell: e, anchorNode: t, anchorRow: n, anchorTable: o, focusCell: s, focusNode: r, focusRow: c, focusTable: i };
525
+ }
526
+ class pt {
527
+ tableKey;
528
+ anchor;
529
+ focus;
530
+ _cachedNodes;
531
+ dirty;
532
+ constructor(t, e, n) {
533
+ this.anchor = e, this.focus = n, e._selection = this, n._selection = this, this._cachedNodes = null, this.dirty = !1, this.tableKey = t;
534
+ }
535
+ getStartEndPoints() {
536
+ return [this.anchor, this.focus];
537
+ }
538
+ isValid() {
539
+ if (this.tableKey === "root" || this.anchor.key === "root" || this.anchor.type !== "element" || this.focus.key === "root" || this.focus.type !== "element") return !1;
540
+ const t = st(this.tableKey), e = st(this.anchor.key), n = st(this.focus.key);
541
+ return t !== null && e !== null && n !== null;
542
+ }
543
+ isBackward() {
544
+ return this.focus.isBefore(this.anchor);
545
+ }
546
+ getCachedNodes() {
547
+ return this._cachedNodes;
548
+ }
549
+ setCachedNodes(t) {
550
+ this._cachedNodes = t;
551
+ }
552
+ is(t) {
553
+ return $t(t) && this.tableKey === t.tableKey && this.anchor.is(t.anchor) && this.focus.is(t.focus);
554
+ }
555
+ set(t, e, n) {
556
+ this.dirty = this.dirty || t !== this.tableKey || e !== this.anchor.key || n !== this.focus.key, this.tableKey = t, this.anchor.key = e, this.focus.key = n, this._cachedNodes = null;
557
+ }
558
+ clone() {
559
+ return new pt(this.tableKey, mt(this.anchor.key, this.anchor.offset, this.anchor.type), mt(this.focus.key, this.focus.offset, this.focus.type));
560
+ }
561
+ isCollapsed() {
562
+ return !1;
563
+ }
564
+ extract() {
565
+ return this.getNodes();
566
+ }
567
+ insertRawText(t) {
568
+ if (t === "") return;
569
+ const e = (t.endsWith(`
570
+ `) ? t.slice(0, -1) : t).split(`
571
+ `).map((r) => r.split(" ")), n = et();
572
+ for (const r of e) {
573
+ const s = B();
574
+ for (const c of r) {
575
+ const i = M(y.NO_STATUS), p = R();
576
+ c && p.append(Kt(c)), i.append(p), s.append(i);
577
+ }
578
+ n.append(s);
579
+ }
580
+ const { anchorCell: o } = ct(this);
581
+ se(n, o.select(0, o.getChildrenSize()));
582
+ }
583
+ insertText() {
584
+ }
585
+ hasFormat(t) {
586
+ let e = 0;
587
+ this.getNodes().filter(x).forEach((o) => {
588
+ const r = o.getFirstChild();
589
+ Ot(r) && (e |= r.getTextFormat());
590
+ });
591
+ const n = Ut[t];
592
+ return (e & n) !== 0;
593
+ }
594
+ insertNodes(t) {
595
+ const e = this.focus.getNode();
596
+ Ft(e) || b(151), Bt(e.select(0, e.getChildrenSize())).insertNodes(t);
597
+ }
598
+ getShape() {
599
+ const { anchorCell: t, focusCell: e } = ct(this), n = Nt(t);
600
+ n === null && b(153);
601
+ const o = Nt(e);
602
+ o === null && b(155);
603
+ const r = Math.min(n.columnIndex, o.columnIndex), s = Math.max(n.columnIndex + n.colSpan - 1, o.columnIndex + o.colSpan - 1), c = Math.min(n.rowIndex, o.rowIndex), i = Math.max(n.rowIndex + n.rowSpan - 1, o.rowIndex + o.rowSpan - 1);
604
+ return { fromX: Math.min(r, s), fromY: Math.min(c, i), toX: Math.max(r, s), toY: Math.max(c, i) };
605
+ }
606
+ getNodes() {
607
+ if (!this.isValid()) return [];
608
+ const t = this._cachedNodes;
609
+ if (t !== null) return t;
610
+ const { anchorTable: e, anchorCell: n, focusCell: o } = ct(this), r = o.getParents()[1];
611
+ if (r !== e) {
612
+ if (e.isParentOf(o)) {
613
+ const a = r.getParent();
614
+ a == null && b(159), this.set(this.tableKey, o.getKey(), a.getKey());
615
+ } else {
616
+ const a = e.getParent();
617
+ a == null && b(158), this.set(this.tableKey, a.getKey(), o.getKey());
618
+ }
619
+ return this.getNodes();
620
+ }
621
+ const [s, c, i] = J(e, n, o), { minColumn: p, maxColumn: h, minRow: u, maxRow: g } = zt(s, c, i), S = /* @__PURE__ */ new Map([[e.getKey(), e]]);
622
+ let _ = null;
623
+ for (let a = u; a <= g; a++) for (let d = p; d <= h; d++) {
624
+ const { cell: C } = s[a][d], f = C.getParent();
625
+ T(f) || b(160), f !== _ && (S.set(f.getKey(), f), _ = f), S.has(C.getKey()) || ae(C, (N) => {
626
+ S.set(N.getKey(), N);
627
+ });
628
+ }
629
+ const m = Array.from(S.values());
630
+ return Ht() || (this._cachedNodes = m), m;
631
+ }
632
+ getTextContent() {
633
+ const t = this.getNodes().filter((n) => x(n));
634
+ let e = "";
635
+ for (let n = 0; n < t.length; n++) {
636
+ const o = t[n], r = o.__parent, s = (t[n + 1] || {}).__parent;
637
+ e += o.getTextContent() + (s !== r ? `
638
+ ` : " ");
639
+ }
640
+ return e;
641
+ }
642
+ }
643
+ function $t(l) {
644
+ return l instanceof pt;
645
+ }
646
+ function ae(l, t) {
647
+ const e = [[l]];
648
+ for (let n = e.at(-1); n !== void 0 && e.length > 0; n = e.at(-1)) {
649
+ const o = n.pop();
650
+ o === void 0 ? e.pop() : t(o) !== !1 && Ft(o) && e.push(o.getChildren());
651
+ }
652
+ }
653
+ function $(l) {
654
+ return I(l) && l.nodeName === "TABLE";
655
+ }
656
+ function xt(l, t) {
657
+ if (!t) return t;
658
+ const e = $(t) ? t : t.querySelector("table");
659
+ return $(e) || b(341, l.constructor.name, l.getType(), l.getKey(), t.nodeName), e;
660
+ }
661
+ function ie(l, t) {
662
+ for (let e = t, n = null; e !== null; e = e.getParent()) {
663
+ if (l.is(e)) return n;
664
+ x(e) && (n = e);
665
+ }
666
+ return null;
667
+ }
668
+ function ce(l, t, e) {
669
+ return ie(l, Mt(t, e));
670
+ }
671
+ function Tt(l, t, e) {
672
+ const n = l.querySelector("colgroup");
673
+ if (!n) return;
674
+ const o = [];
675
+ for (let r = 0; r < t; r++) {
676
+ const s = k().createElement("col"), c = e && e[r];
677
+ c && (s.style.width = `${c}px`), o.push(s);
678
+ }
679
+ n.replaceChildren(...o);
680
+ }
681
+ function Rt(l, t, e) {
682
+ if (!t.theme.tableAlignment) return;
683
+ const n = [], o = [];
684
+ for (const r of ["center", "right"]) {
685
+ const s = t.theme.tableAlignment[r];
686
+ s && (r === e ? o : n).push(s);
687
+ }
688
+ Y(l, ...n), W(l, ...o);
689
+ }
690
+ const ue = /* @__PURE__ */ new WeakSet();
691
+ function At(l = Jt()) {
692
+ return ue.has(l);
693
+ }
694
+ class tt extends _t {
695
+ __rowStriping;
696
+ __frozenColumnCount;
697
+ __frozenRowCount;
698
+ __colWidths;
699
+ static getType() {
700
+ return "table";
701
+ }
702
+ getColWidths() {
703
+ return this.getLatest().__colWidths;
704
+ }
705
+ setColWidths(t) {
706
+ const e = this.getWritable();
707
+ return e.__colWidths = t, e;
708
+ }
709
+ static clone(t) {
710
+ return new tt(t.__key);
711
+ }
712
+ afterCloneFrom(t) {
713
+ super.afterCloneFrom(t), this.__colWidths = t.__colWidths, this.__rowStriping = t.__rowStriping, this.__frozenColumnCount = t.__frozenColumnCount, this.__frozenRowCount = t.__frozenRowCount;
714
+ }
715
+ static importDOM() {
716
+ return { table: (t) => ({ conversion: he, priority: 1 }) };
717
+ }
718
+ static importJSON(t) {
719
+ return et().updateFromJSON(t);
720
+ }
721
+ updateFromJSON(t) {
722
+ return super.updateFromJSON(t).setRowStriping(t.rowStriping || !1).setFrozenColumns(t.frozenColumnCount || 0).setFrozenRows(t.frozenRowCount || 0).setColWidths(t.colWidths);
723
+ }
724
+ constructor(t) {
725
+ super(t), this.__rowStriping = !1, this.__frozenColumnCount = 0, this.__frozenRowCount = 0, this.__colWidths = void 0;
726
+ }
727
+ exportJSON() {
728
+ 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 };
729
+ }
730
+ extractWithChild(t, e, n) {
731
+ return n === "html";
732
+ }
733
+ getDOMSlot(t) {
734
+ const e = $(t) ? t : t.querySelector("table");
735
+ return $(e) || b(229), super.getDOMSlot(t).withElement(e).withAfter(e.querySelector("colgroup"));
736
+ }
737
+ createDOM(t, e) {
738
+ const n = k().createElement("table");
739
+ this.__style && St(n.style, this.__style);
740
+ const o = k().createElement("colgroup");
741
+ if (n.appendChild(o), Pt(o), W(n, t.theme.table), this.updateTableElement(null, n, t), At(e)) {
742
+ const r = k().createElement("div"), s = t.theme.tableScrollableWrapper;
743
+ return s ? W(r, s) : r.style.overflowX = "auto", r.appendChild(n), this.updateTableWrapper(null, r, n, t), r;
744
+ }
745
+ return n;
746
+ }
747
+ updateTableWrapper(t, e, n, o) {
748
+ this.__frozenColumnCount !== (t ? t.__frozenColumnCount : 0) && (function(r, s, c, i) {
749
+ i > 0 ? (W(r, c.theme.tableFrozenColumn), s.setAttribute("data-lexical-frozen-column", "true")) : (Y(r, c.theme.tableFrozenColumn), s.removeAttribute("data-lexical-frozen-column"));
750
+ })(e, n, o, this.__frozenColumnCount), this.__frozenRowCount !== (t ? t.__frozenRowCount : 0) && (function(r, s, c, i) {
751
+ i > 0 ? (W(r, c.theme.tableFrozenRow), s.setAttribute("data-lexical-frozen-row", "true")) : (Y(r, c.theme.tableFrozenRow), s.removeAttribute("data-lexical-frozen-row"));
752
+ })(e, n, o, this.__frozenRowCount);
753
+ }
754
+ updateTableElement(t, e, n) {
755
+ this.__style !== (t ? t.__style : "") && St(e.style, this.__style, t ? t.__style : ""), this.__rowStriping !== (!!t && t.__rowStriping) && (function(s, c, i) {
756
+ i ? (W(s, c.theme.tableRowStriping), s.setAttribute("data-lexical-row-striping", "true")) : (Y(s, c.theme.tableRowStriping), s.removeAttribute("data-lexical-row-striping"));
757
+ })(e, n, this.__rowStriping);
758
+ const o = t ? t.getColumnCount() : 0, r = t ? t.__colWidths : void 0;
759
+ this.getColumnCount() === o && this.getColWidths() === r || Tt(e, this.getColumnCount(), this.getColWidths()), Rt(e, n, this.getFormatType());
760
+ }
761
+ updateDOM(t, e, n) {
762
+ const o = xt(this, e);
763
+ return e === o === At() || (I(r = e) && r.nodeName === "DIV" && this.updateTableWrapper(t, e, o, n), this.updateTableElement(t, o, n), !1);
764
+ var r;
765
+ }
766
+ scaleDOMColWidths(t, e) {
767
+ const n = this.getColWidths();
768
+ n && Tt(xt(this, t), this.getColumnCount(), n.map((o) => o * e));
769
+ }
770
+ exportDOM(t) {
771
+ const e = super.exportDOM(t), { element: n } = e;
772
+ return { after: (o) => {
773
+ if (e.after && (o = e.after(o)), !$(o) && I(o) && (o = o.querySelector("table")), !$(o)) return null;
774
+ Rt(o, t._config, this.getFormatType());
775
+ const [r] = E(this, null, null), s = /* @__PURE__ */ new Map();
776
+ for (const h of r) for (const u of h) {
777
+ const g = u.cell.getKey();
778
+ s.has(g) || s.set(g, { colSpan: u.cell.getColSpan(), startColumn: u.startColumn });
779
+ }
780
+ const c = /* @__PURE__ */ new Set();
781
+ for (const h of o.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")) {
782
+ const u = h.getAttribute("data-temporary-table-cell-lexical-key");
783
+ if (u) {
784
+ const g = s.get(u);
785
+ if (h.removeAttribute("data-temporary-table-cell-lexical-key"), g) {
786
+ s.delete(u);
787
+ for (let S = 0; S < g.colSpan; S++) c.add(S + g.startColumn);
788
+ }
789
+ }
790
+ }
791
+ const i = o.querySelector(":scope > colgroup");
792
+ if (i) {
793
+ const h = Array.from(o.querySelectorAll(":scope > colgroup > col")).filter((u, g) => c.has(g));
794
+ i.replaceChildren(...h);
795
+ }
796
+ const p = o.querySelectorAll(":scope > tr");
797
+ if (p.length > 0) {
798
+ const h = k().createElement("tbody");
799
+ for (const u of p) h.appendChild(u);
800
+ o.append(h);
801
+ }
802
+ return o;
803
+ }, element: !$(n) && I(n) ? n.querySelector("table") : n };
804
+ }
805
+ canBeEmpty() {
806
+ return !1;
807
+ }
808
+ isShadowRoot() {
809
+ return !0;
810
+ }
811
+ getCordsFromCellNode(t, e) {
812
+ const { rows: n, domRows: o } = e;
813
+ for (let r = 0; r < n; r++) {
814
+ const s = o[r];
815
+ if (s != null) for (let c = 0; c < s.length; c++) {
816
+ const i = s[c];
817
+ if (i == null) continue;
818
+ const { elem: p } = i, h = ce(this, p);
819
+ if (h !== null && t.is(h)) return { x: c, y: r };
820
+ }
821
+ }
822
+ throw new Error("Cell not found in table.");
823
+ }
824
+ getDOMCellFromCords(t, e, n) {
825
+ const { domRows: o } = n, r = o[e];
826
+ if (r == null) return null;
827
+ const s = r[t < r.length ? t : r.length - 1];
828
+ return s ?? null;
829
+ }
830
+ getDOMCellFromCordsOrThrow(t, e, n) {
831
+ const o = this.getDOMCellFromCords(t, e, n);
832
+ if (!o) throw new Error("Cell not found at cords.");
833
+ return o;
834
+ }
835
+ getCellNodeFromCords(t, e, n) {
836
+ const o = this.getDOMCellFromCords(t, e, n);
837
+ if (o == null) return null;
838
+ const r = Mt(o.elem);
839
+ return x(r) ? r : null;
840
+ }
841
+ getCellNodeFromCordsOrThrow(t, e, n) {
842
+ const o = this.getCellNodeFromCords(t, e, n);
843
+ if (!o) throw new Error("Node at cords not TableCellNode.");
844
+ return o;
845
+ }
846
+ getRowStriping() {
847
+ return !!this.getLatest().__rowStriping;
848
+ }
849
+ setRowStriping(t) {
850
+ const e = this.getWritable();
851
+ return e.__rowStriping = t, e;
852
+ }
853
+ setFrozenColumns(t) {
854
+ const e = this.getWritable();
855
+ return e.__frozenColumnCount = t, e;
856
+ }
857
+ getFrozenColumns() {
858
+ return this.getLatest().__frozenColumnCount;
859
+ }
860
+ setFrozenRows(t) {
861
+ const e = this.getWritable();
862
+ return e.__frozenRowCount = t, e;
863
+ }
864
+ getFrozenRows() {
865
+ return this.getLatest().__frozenRowCount;
866
+ }
867
+ canSelectBefore() {
868
+ return !0;
869
+ }
870
+ canIndent() {
871
+ return !1;
872
+ }
873
+ getColumnCount() {
874
+ const t = this.getFirstChild();
875
+ if (!T(t)) return 0;
876
+ let e = 0;
877
+ return t.getChildren().forEach((n) => {
878
+ x(n) && (e += n.getColSpan());
879
+ }), e;
880
+ }
881
+ }
882
+ function he(l) {
883
+ const t = et();
884
+ l.hasAttribute("data-lexical-row-striping") && t.setRowStriping(!0), l.hasAttribute("data-lexical-frozen-column") && t.setFrozenColumns(1), l.hasAttribute("data-lexical-frozen-row") && t.setFrozenRows(1);
885
+ const e = l.querySelector(":scope > colgroup");
886
+ if (e) {
887
+ let n = [];
888
+ for (const o of e.querySelectorAll(":scope > col")) {
889
+ let r = o.style.width || "";
890
+ if (!K.test(r) && (r = o.getAttribute("width") || "", !/^\d+$/.test(r))) {
891
+ n = void 0;
892
+ break;
893
+ }
894
+ n.push(parseFloat(r));
895
+ }
896
+ n && t.setColWidths(n);
897
+ }
898
+ return { after: (n) => Z(n, T), node: t };
899
+ }
900
+ function et() {
901
+ return dt(new tt());
902
+ }
903
+ function U(l) {
904
+ return l instanceof tt;
905
+ }
906
+ it.tag("table"), it.tag("tr"), it.tag("td", "th");
907
+ export {
908
+ J as $computeTableMap,
909
+ E as $computeTableMapSkipCellCheck,
910
+ M as $createTableCellNode,
911
+ et as $createTableNode,
912
+ B as $createTableRowNode,
913
+ q as $getNodeTriplet,
914
+ Nt as $getTableCellNodeRect,
915
+ jt as $getTableNodeFromLexicalNodeOrThrow,
916
+ ee as $insertTableColumnAtNode,
917
+ te as $insertTableRowAtNode,
918
+ At as $isScrollableTablesActive,
919
+ x as $isTableCellNode,
920
+ U as $isTableNode,
921
+ T as $isTableRowNode,
922
+ $t as $isTableSelection,
923
+ oe as $mergeCells,
924
+ y as TableCellHeaderStates,
925
+ P as TableCellNode,
926
+ tt as TableNode,
927
+ j as TableRowNode,
928
+ xt as getTableElement
929
+ };