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
@@ -1,661 +0,0 @@
1
- "use client";
2
- import { $findMatchingParent as M, addClassNamesToElement as b, removeClassNamesFromElement as A, $descendantsMatching as V } from "../utils/LexicalUtils.prod.js";
3
- import { $createPoint as K, $isParagraphNode as ot, $isElementNode as X, $normalizeSelection__EXPERIMENTAL as rt, isCurrentlyReadOnlyMode as nt, TEXT_TYPE_TO_FORMAT as lt, ElementNode as k, isHTMLElement as T, $isInlineElementOrDecoratorNode as st, $isTextNode as L, $isLineBreakNode as H, $createParagraphNode as P, $applyNodeReplacement as W, setDOMUnmanaged as it, $getEditor as at, $getNearestNodeFromDOMNode as Y } from "../../lexical/Lexical.prod.js";
4
- const E = /^(\d+(?:\.\d+)?)px$/, y = { BOTH: 3, NO_STATUS: 0, ROW: 1 };
5
- class R extends k {
6
- static getType() {
7
- return "tablecell";
8
- }
9
- static clone(t) {
10
- return new R(t.__headerState, t.__colSpan, t.__width, t.__key);
11
- }
12
- afterCloneFrom(t) {
13
- super.afterCloneFrom(t), this.__rowSpan = t.__rowSpan, this.__backgroundColor = t.__backgroundColor, this.__verticalAlign = t.__verticalAlign;
14
- }
15
- static importDOM() {
16
- return { td: (t) => ({ conversion: I, priority: 0 }), th: (t) => ({ conversion: I, priority: 0 }) };
17
- }
18
- static importJSON(t) {
19
- return j().updateFromJSON(t);
20
- }
21
- updateFromJSON(t) {
22
- return super.updateFromJSON(t).setHeaderStyles(t.headerState).setColSpan(t.colSpan || 1).setRowSpan(t.rowSpan || 1).setWidth(t.width || void 0).setBackgroundColor(t.backgroundColor || null).setVerticalAlign(t.verticalAlign || void 0);
23
- }
24
- constructor(t = y.NO_STATUS, e = 1, o, r) {
25
- super(r), this.__colSpan = e, this.__rowSpan = 1, this.__headerState = t, this.__width = o, this.__backgroundColor = null, this.__verticalAlign = void 0;
26
- }
27
- createDOM(t) {
28
- const e = document.createElement(this.getTag());
29
- return this.__width && (e.style.width = `${this.__width}px`), this.__colSpan > 1 && (e.colSpan = this.__colSpan), this.__rowSpan > 1 && (e.rowSpan = this.__rowSpan), this.__backgroundColor !== null && (e.style.backgroundColor = this.__backgroundColor), z(this.__verticalAlign) && (e.style.verticalAlign = this.__verticalAlign), b(e, t.theme.tableCell, this.hasHeader() && t.theme.tableCellHeader), e;
30
- }
31
- exportDOM(t) {
32
- const e = super.exportDOM(t);
33
- if (T(e.element)) {
34
- const o = e.element;
35
- o.setAttribute("data-temporary-table-cell-lexical-key", this.getKey()), o.style.border = "1px solid black", this.__colSpan > 1 && (o.colSpan = this.__colSpan), this.__rowSpan > 1 && (o.rowSpan = this.__rowSpan), o.style.width = `${this.getWidth() || 75}px`, o.style.verticalAlign = this.getVerticalAlign() || "top", o.style.textAlign = "start", this.__backgroundColor === null && this.hasHeader() && (o.style.backgroundColor = "#f2f3f5");
36
- }
37
- return e;
38
- }
39
- exportJSON() {
40
- return { ...super.exportJSON(), ...z(this.__verticalAlign) && { verticalAlign: this.__verticalAlign }, backgroundColor: this.getBackgroundColor(), colSpan: this.__colSpan, headerState: this.__headerState, rowSpan: this.__rowSpan, width: this.getWidth() };
41
- }
42
- getColSpan() {
43
- return this.getLatest().__colSpan;
44
- }
45
- setColSpan(t) {
46
- const e = this.getWritable();
47
- return e.__colSpan = t, e;
48
- }
49
- getRowSpan() {
50
- return this.getLatest().__rowSpan;
51
- }
52
- setRowSpan(t) {
53
- const e = this.getWritable();
54
- return e.__rowSpan = t, e;
55
- }
56
- getTag() {
57
- return this.hasHeader() ? "th" : "td";
58
- }
59
- setHeaderStyles(t, e = y.BOTH) {
60
- const o = this.getWritable();
61
- return o.__headerState = t & e | o.__headerState & ~e, o;
62
- }
63
- getHeaderStyles() {
64
- return this.getLatest().__headerState;
65
- }
66
- setWidth(t) {
67
- const e = this.getWritable();
68
- return e.__width = t, e;
69
- }
70
- getWidth() {
71
- return this.getLatest().__width;
72
- }
73
- getBackgroundColor() {
74
- return this.getLatest().__backgroundColor;
75
- }
76
- setBackgroundColor(t) {
77
- const e = this.getWritable();
78
- return e.__backgroundColor = t, e;
79
- }
80
- getVerticalAlign() {
81
- return this.getLatest().__verticalAlign;
82
- }
83
- setVerticalAlign(t) {
84
- const e = this.getWritable();
85
- return e.__verticalAlign = t || void 0, e;
86
- }
87
- toggleHeaderStyle(t) {
88
- const e = this.getWritable();
89
- return (e.__headerState & t) === t ? e.__headerState -= t : e.__headerState += t, e;
90
- }
91
- hasHeaderState(t) {
92
- return (this.getHeaderStyles() & t) === t;
93
- }
94
- hasHeader() {
95
- return this.getLatest().__headerState !== y.NO_STATUS;
96
- }
97
- updateDOM(t) {
98
- return t.__headerState !== this.__headerState || t.__width !== this.__width || t.__colSpan !== this.__colSpan || t.__rowSpan !== this.__rowSpan || t.__backgroundColor !== this.__backgroundColor || t.__verticalAlign !== this.__verticalAlign;
99
- }
100
- isShadowRoot() {
101
- return !0;
102
- }
103
- collapseAtStart() {
104
- return !0;
105
- }
106
- canBeEmpty() {
107
- return !1;
108
- }
109
- canIndent() {
110
- return !1;
111
- }
112
- }
113
- function z(l) {
114
- return l === "middle" || l === "bottom";
115
- }
116
- function I(l) {
117
- const t = l, e = l.nodeName.toLowerCase();
118
- let o;
119
- E.test(t.style.width) && (o = parseFloat(t.style.width));
120
- const r = j(e === "th" ? y.ROW : y.NO_STATUS, t.colSpan, o);
121
- r.__rowSpan = t.rowSpan;
122
- const n = t.style.backgroundColor;
123
- n !== "" && (r.__backgroundColor = n);
124
- const s = t.style.verticalAlign;
125
- z(s) && (r.__verticalAlign = s);
126
- const i = t.style, a = (i && i.textDecoration || "").split(" "), h = i.fontWeight === "700" || i.fontWeight === "bold", c = a.includes("line-through"), u = i.fontStyle === "italic", d = a.includes("underline");
127
- return { after: (_) => {
128
- const w = [];
129
- let p = null;
130
- const f = () => {
131
- if (p) {
132
- const g = p.getFirstChild();
133
- H(g) && p.getChildrenSize() === 1 && g.remove();
134
- }
135
- };
136
- for (const g of _) st(g) || L(g) || H(g) ? (L(g) && (h && g.toggleFormat("bold"), c && g.toggleFormat("strikethrough"), u && g.toggleFormat("italic"), d && g.toggleFormat("underline")), p ? p.append(g) : (p = P().append(g), w.push(p))) : (w.push(g), f(), p = null);
137
- return f(), w.length === 0 && w.push(P()), w;
138
- }, node: r };
139
- }
140
- function j(l = y.NO_STATUS, t = 1, e) {
141
- return W(new R(l, t, e));
142
- }
143
- function S(l) {
144
- return l instanceof R;
145
- }
146
- function m(l, ...t) {
147
- const e = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
148
- o.append("code", l);
149
- for (const r of t) o.append("v", r);
150
- throw e.search = o.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.`);
151
- }
152
- class O extends k {
153
- static getType() {
154
- return "tablerow";
155
- }
156
- static clone(t) {
157
- return new O(t.__height, t.__key);
158
- }
159
- static importDOM() {
160
- return { tr: (t) => ({ conversion: ct, priority: 0 }) };
161
- }
162
- static importJSON(t) {
163
- return Q().updateFromJSON(t);
164
- }
165
- updateFromJSON(t) {
166
- return super.updateFromJSON(t).setHeight(t.height);
167
- }
168
- constructor(t, e) {
169
- super(e), this.__height = t;
170
- }
171
- exportJSON() {
172
- const t = this.getHeight();
173
- return { ...super.exportJSON(), ...t === void 0 ? void 0 : { height: t } };
174
- }
175
- createDOM(t) {
176
- const e = document.createElement("tr");
177
- return this.__height && (e.style.height = `${this.__height}px`), b(e, t.theme.tableRow), e;
178
- }
179
- extractWithChild(t, e, o) {
180
- return o === "html";
181
- }
182
- isShadowRoot() {
183
- return !0;
184
- }
185
- setHeight(t) {
186
- const e = this.getWritable();
187
- return e.__height = t, e;
188
- }
189
- getHeight() {
190
- return this.getLatest().__height;
191
- }
192
- updateDOM(t) {
193
- return t.__height !== this.__height;
194
- }
195
- canBeEmpty() {
196
- return !1;
197
- }
198
- canIndent() {
199
- return !1;
200
- }
201
- }
202
- function ct(l) {
203
- const t = l;
204
- let e;
205
- return E.test(t.style.height) && (e = parseFloat(t.style.height)), { after: (o) => V(o, S), node: Q(e) };
206
- }
207
- function Q(l) {
208
- return W(new O(l));
209
- }
210
- function v(l) {
211
- return l instanceof O;
212
- }
213
- const G = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, ut = G && "documentMode" in document ? document.documentMode : null;
214
- G && "InputEvent" in window && !ut && new window.InputEvent("input");
215
- function ht(l, t, e) {
216
- const [o, r, n] = Z(l, t, e);
217
- return r === null && m(207), n === null && m(208), [o, r, n];
218
- }
219
- function Z(l, t, e) {
220
- const o = [];
221
- let r = null, n = null;
222
- function s(a) {
223
- let h = o[a];
224
- return h === void 0 && (o[a] = h = []), h;
225
- }
226
- const i = l.getChildren();
227
- for (let a = 0; a < i.length; a++) {
228
- const h = i[a];
229
- v(h) || m(209);
230
- const c = s(a);
231
- for (let u = h.getFirstChild(), d = 0; u != null; u = u.getNextSibling()) {
232
- for (S(u) || m(147); c[d] !== void 0; ) d++;
233
- const _ = { cell: u, startColumn: d, startRow: a }, { __rowSpan: w, __colSpan: p } = u;
234
- for (let f = 0; f < w && !(a + f >= i.length); f++) {
235
- const g = s(a + f);
236
- for (let C = 0; C < p; C++) g[d + C] = _;
237
- }
238
- t !== null && r === null && t.is(u) && (r = _), e !== null && n === null && e.is(u) && (n = _);
239
- }
240
- }
241
- return [o, r, n];
242
- }
243
- function dt(l) {
244
- let t;
245
- if (l instanceof R) t = l;
246
- else if ("__type" in l) {
247
- const r = M(l, S);
248
- S(r) || m(148), t = r;
249
- } else {
250
- const r = M(l.getNode(), S);
251
- S(r) || m(148), t = r;
252
- }
253
- const e = t.getParent();
254
- v(e) || m(149);
255
- const o = e.getParent();
256
- return et(o) || m(210), [t, e, o];
257
- }
258
- function _t(l, t, e) {
259
- let o, r = Math.min(t.startColumn, e.startColumn), n = Math.min(t.startRow, e.startRow), s = Math.max(t.startColumn + t.cell.__colSpan - 1, e.startColumn + e.cell.__colSpan - 1), i = Math.max(t.startRow + t.cell.__rowSpan - 1, e.startRow + e.cell.__rowSpan - 1);
260
- do {
261
- o = !1;
262
- for (let a = 0; a < l.length; a++) for (let h = 0; h < l[0].length; h++) {
263
- const c = l[a][h];
264
- if (!c) continue;
265
- const u = c.startColumn + c.cell.__colSpan - 1, d = c.startRow + c.cell.__rowSpan - 1, _ = c.startColumn <= s && u >= r, w = c.startRow <= i && d >= n;
266
- if (_ && w) {
267
- const p = Math.min(r, c.startColumn), f = Math.max(s, u), g = Math.min(n, c.startRow), C = Math.max(i, d);
268
- p === r && f === s && g === n && C === i || (r = p, s = f, n = g, i = C, o = !0);
269
- }
270
- }
271
- } while (o);
272
- return { maxColumn: s, maxRow: i, minColumn: r, minRow: n };
273
- }
274
- function J(l) {
275
- const [t, , e] = dt(l), o = e.getChildren(), r = o.length, n = o[0].getChildren().length, s = new Array(r);
276
- for (let i = 0; i < r; i++) s[i] = new Array(n);
277
- for (let i = 0; i < r; i++) {
278
- const a = o[i].getChildren();
279
- let h = 0;
280
- for (let c = 0; c < a.length; c++) {
281
- for (; s[i][h]; ) h++;
282
- const u = a[c], d = u.__rowSpan || 1, _ = u.__colSpan || 1;
283
- for (let w = 0; w < d; w++) for (let p = 0; p < _; p++) s[i + w][h + p] = u;
284
- if (t === u) return { colSpan: _, columnIndex: h, rowIndex: i, rowSpan: d };
285
- h += _;
286
- }
287
- }
288
- return null;
289
- }
290
- function B(l) {
291
- const [[t, e, o, r], [n, s, i, a]] = ["anchor", "focus"].map(((h) => {
292
- const c = l[h].getNode(), u = M(c, S);
293
- S(u) || m(238, h, c.getKey(), c.getType());
294
- const d = u.getParent();
295
- v(d) || m(239, h);
296
- const _ = d.getParent();
297
- return et(_) || m(240, h), [c, u, d, _];
298
- }));
299
- return r.is(a) || m(241), { anchorCell: e, anchorNode: t, anchorRow: o, anchorTable: r, focusCell: s, focusNode: n, focusRow: i, focusTable: a };
300
- }
301
- class $ {
302
- constructor(t, e, o) {
303
- this.anchor = e, this.focus = o, e._selection = this, o._selection = this, this._cachedNodes = null, this.dirty = !1, this.tableKey = t;
304
- }
305
- getStartEndPoints() {
306
- return [this.anchor, this.focus];
307
- }
308
- isValid() {
309
- return this.tableKey !== "root" && this.anchor.key !== "root" && this.anchor.type === "element" && this.focus.key !== "root" && this.focus.type === "element";
310
- }
311
- isBackward() {
312
- return this.focus.isBefore(this.anchor);
313
- }
314
- getCachedNodes() {
315
- return this._cachedNodes;
316
- }
317
- setCachedNodes(t) {
318
- this._cachedNodes = t;
319
- }
320
- is(t) {
321
- return gt(t) && this.tableKey === t.tableKey && this.anchor.is(t.anchor) && this.focus.is(t.focus);
322
- }
323
- set(t, e, o) {
324
- this.dirty = this.dirty || t !== this.tableKey || e !== this.anchor.key || o !== this.focus.key, this.tableKey = t, this.anchor.key = e, this.focus.key = o, this._cachedNodes = null;
325
- }
326
- clone() {
327
- return new $(this.tableKey, K(this.anchor.key, this.anchor.offset, this.anchor.type), K(this.focus.key, this.focus.offset, this.focus.type));
328
- }
329
- isCollapsed() {
330
- return !1;
331
- }
332
- extract() {
333
- return this.getNodes();
334
- }
335
- insertRawText(t) {
336
- }
337
- insertText() {
338
- }
339
- hasFormat(t) {
340
- let e = 0;
341
- this.getNodes().filter(S).forEach(((r) => {
342
- const n = r.getFirstChild();
343
- ot(n) && (e |= n.getTextFormat());
344
- }));
345
- const o = lt[t];
346
- return !!(e & o);
347
- }
348
- insertNodes(t) {
349
- const e = this.focus.getNode();
350
- X(e) || m(151), rt(e.select(0, e.getChildrenSize())).insertNodes(t);
351
- }
352
- getShape() {
353
- const { anchorCell: t, focusCell: e } = B(this), o = J(t);
354
- o === null && m(153);
355
- const r = J(e);
356
- r === null && m(155);
357
- const n = Math.min(o.columnIndex, r.columnIndex), s = Math.max(o.columnIndex + o.colSpan - 1, r.columnIndex + r.colSpan - 1), i = Math.min(o.rowIndex, r.rowIndex), a = Math.max(o.rowIndex + o.rowSpan - 1, r.rowIndex + r.rowSpan - 1);
358
- return { fromX: Math.min(n, s), fromY: Math.min(i, a), toX: Math.max(n, s), toY: Math.max(i, a) };
359
- }
360
- getNodes() {
361
- if (!this.isValid()) return [];
362
- const t = this._cachedNodes;
363
- if (t !== null) return t;
364
- const { anchorTable: e, anchorCell: o, focusCell: r } = B(this), n = r.getParents()[1];
365
- if (n !== e) {
366
- if (e.isParentOf(r)) {
367
- const f = n.getParent();
368
- f == null && m(159), this.set(this.tableKey, r.getKey(), f.getKey());
369
- } else {
370
- const f = e.getParent();
371
- f == null && m(158), this.set(this.tableKey, f.getKey(), r.getKey());
372
- }
373
- return this.getNodes();
374
- }
375
- const [s, i, a] = ht(e, o, r), { minColumn: h, maxColumn: c, minRow: u, maxRow: d } = _t(s, i, a), _ = /* @__PURE__ */ new Map([[e.getKey(), e]]);
376
- let w = null;
377
- for (let f = u; f <= d; f++) for (let g = h; g <= c; g++) {
378
- const { cell: C } = s[f][g], N = C.getParent();
379
- v(N) || m(160), N !== w && (_.set(N.getKey(), N), w = N), _.has(C.getKey()) || pt(C, ((D) => {
380
- _.set(D.getKey(), D);
381
- }));
382
- }
383
- const p = Array.from(_.values());
384
- return nt() || (this._cachedNodes = p), p;
385
- }
386
- getTextContent() {
387
- const t = this.getNodes().filter(((o) => S(o)));
388
- let e = "";
389
- for (let o = 0; o < t.length; o++) {
390
- const r = t[o], n = r.__parent, s = (t[o + 1] || {}).__parent;
391
- e += r.getTextContent() + (s !== n ? `
392
- ` : " ");
393
- }
394
- return e;
395
- }
396
- }
397
- function gt(l) {
398
- return l instanceof $;
399
- }
400
- function pt(l, t) {
401
- const e = [[l]];
402
- for (let o = e.at(-1); o !== void 0 && e.length > 0; o = e.at(-1)) {
403
- const r = o.pop();
404
- r === void 0 ? e.pop() : t(r) !== !1 && X(r) && e.push(r.getChildren());
405
- }
406
- }
407
- function x(l) {
408
- return T(l) && l.nodeName === "TABLE";
409
- }
410
- function ft(l, t) {
411
- for (let e = t, o = null; e !== null; e = e.getParent()) {
412
- if (l.is(e)) return o;
413
- S(e) && (o = e);
414
- }
415
- return null;
416
- }
417
- function mt(l, t, e) {
418
- return ft(l, Y(t, e));
419
- }
420
- function q(l, t, e) {
421
- if (!t.theme.tableAlignment) return;
422
- const o = [], r = [];
423
- for (const n of ["center", "right"]) {
424
- const s = t.theme.tableAlignment[n];
425
- s && (n === e ? r : o).push(s);
426
- }
427
- A(l, ...o), b(l, ...r);
428
- }
429
- const wt = /* @__PURE__ */ new WeakSet();
430
- function U(l = at()) {
431
- return wt.has(l);
432
- }
433
- class F extends k {
434
- static getType() {
435
- return "table";
436
- }
437
- getColWidths() {
438
- return this.getLatest().__colWidths;
439
- }
440
- setColWidths(t) {
441
- const e = this.getWritable();
442
- return e.__colWidths = t, e;
443
- }
444
- static clone(t) {
445
- return new F(t.__key);
446
- }
447
- afterCloneFrom(t) {
448
- super.afterCloneFrom(t), this.__colWidths = t.__colWidths, this.__rowStriping = t.__rowStriping, this.__frozenColumnCount = t.__frozenColumnCount, this.__frozenRowCount = t.__frozenRowCount;
449
- }
450
- static importDOM() {
451
- return { table: (t) => ({ conversion: St, priority: 1 }) };
452
- }
453
- static importJSON(t) {
454
- return tt().updateFromJSON(t);
455
- }
456
- updateFromJSON(t) {
457
- return super.updateFromJSON(t).setRowStriping(t.rowStriping || !1).setFrozenColumns(t.frozenColumnCount || 0).setFrozenRows(t.frozenRowCount || 0).setColWidths(t.colWidths);
458
- }
459
- constructor(t) {
460
- super(t), this.__rowStriping = !1, this.__frozenColumnCount = 0, this.__frozenRowCount = 0;
461
- }
462
- exportJSON() {
463
- 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 };
464
- }
465
- extractWithChild(t, e, o) {
466
- return o === "html";
467
- }
468
- getDOMSlot(t) {
469
- const e = x(t) ? t : t.querySelector("table");
470
- return x(e) || m(229), super.getDOMSlot(t).withElement(e).withAfter(e.querySelector("colgroup"));
471
- }
472
- createDOM(t, e) {
473
- const o = document.createElement("table");
474
- this.__style && (o.style.cssText = this.__style);
475
- const r = document.createElement("colgroup");
476
- if (o.appendChild(r), it(r), b(o, t.theme.table), this.updateTableElement(null, o, t), U(e)) {
477
- const n = document.createElement("div"), s = t.theme.tableScrollableWrapper;
478
- return s ? b(n, s) : n.style.cssText = "overflow-x: auto;", n.appendChild(o), this.updateTableWrapper(null, n, o, t), n;
479
- }
480
- return o;
481
- }
482
- updateTableWrapper(t, e, o, r) {
483
- this.__frozenColumnCount !== (t ? t.__frozenColumnCount : 0) && (function(n, s, i, a) {
484
- a > 0 ? (b(n, i.theme.tableFrozenColumn), s.setAttribute("data-lexical-frozen-column", "true")) : (A(n, i.theme.tableFrozenColumn), s.removeAttribute("data-lexical-frozen-column"));
485
- })(e, o, r, this.__frozenColumnCount), this.__frozenRowCount !== (t ? t.__frozenRowCount : 0) && (function(n, s, i, a) {
486
- a > 0 ? (b(n, i.theme.tableFrozenRow), s.setAttribute("data-lexical-frozen-row", "true")) : (A(n, i.theme.tableFrozenRow), s.removeAttribute("data-lexical-frozen-row"));
487
- })(e, o, r, this.__frozenRowCount);
488
- }
489
- updateTableElement(t, e, o) {
490
- this.__style !== (t ? t.__style : "") && (e.style.cssText = this.__style), this.__rowStriping !== (!!t && t.__rowStriping) && (function(r, n, s) {
491
- s ? (b(r, n.theme.tableRowStriping), r.setAttribute("data-lexical-row-striping", "true")) : (A(r, n.theme.tableRowStriping), r.removeAttribute("data-lexical-row-striping"));
492
- })(e, o, this.__rowStriping), (function(r, n, s, i) {
493
- const a = r.querySelector("colgroup");
494
- if (!a) return;
495
- const h = [];
496
- for (let c = 0; c < s; c++) {
497
- const u = document.createElement("col"), d = i && i[c];
498
- d && (u.style.width = `${d}px`), h.push(u);
499
- }
500
- a.replaceChildren(...h);
501
- })(e, 0, this.getColumnCount(), this.getColWidths()), q(e, o, this.getFormatType());
502
- }
503
- updateDOM(t, e, o) {
504
- const r = this.getDOMSlot(e).element;
505
- return e === r === U() || (T(n = e) && n.nodeName === "DIV" && this.updateTableWrapper(t, e, r, o), this.updateTableElement(t, r, o), !1);
506
- var n;
507
- }
508
- exportDOM(t) {
509
- const e = super.exportDOM(t), { element: o } = e;
510
- return { after: (r) => {
511
- if (e.after && (r = e.after(r)), !x(r) && T(r) && (r = r.querySelector("table")), !x(r)) return null;
512
- q(r, t._config, this.getFormatType());
513
- const [n] = Z(this, null, null), s = /* @__PURE__ */ new Map();
514
- for (const c of n) for (const u of c) {
515
- const d = u.cell.getKey();
516
- s.has(d) || s.set(d, { colSpan: u.cell.getColSpan(), startColumn: u.startColumn });
517
- }
518
- const i = /* @__PURE__ */ new Set();
519
- for (const c of r.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")) {
520
- const u = c.getAttribute("data-temporary-table-cell-lexical-key");
521
- if (u) {
522
- const d = s.get(u);
523
- if (c.removeAttribute("data-temporary-table-cell-lexical-key"), d) {
524
- s.delete(u);
525
- for (let _ = 0; _ < d.colSpan; _++) i.add(_ + d.startColumn);
526
- }
527
- }
528
- }
529
- const a = r.querySelector(":scope > colgroup");
530
- if (a) {
531
- const c = Array.from(r.querySelectorAll(":scope > colgroup > col")).filter(((u, d) => i.has(d)));
532
- a.replaceChildren(...c);
533
- }
534
- const h = r.querySelectorAll(":scope > tr");
535
- if (h.length > 0) {
536
- const c = document.createElement("tbody");
537
- for (const u of h) c.appendChild(u);
538
- r.append(c);
539
- }
540
- return r;
541
- }, element: !x(o) && T(o) ? o.querySelector("table") : o };
542
- }
543
- canBeEmpty() {
544
- return !1;
545
- }
546
- isShadowRoot() {
547
- return !0;
548
- }
549
- getCordsFromCellNode(t, e) {
550
- const { rows: o, domRows: r } = e;
551
- for (let n = 0; n < o; n++) {
552
- const s = r[n];
553
- if (s != null) for (let i = 0; i < s.length; i++) {
554
- const a = s[i];
555
- if (a == null) continue;
556
- const { elem: h } = a, c = mt(this, h);
557
- if (c !== null && t.is(c)) return { x: i, y: n };
558
- }
559
- }
560
- throw new Error("Cell not found in table.");
561
- }
562
- getDOMCellFromCords(t, e, o) {
563
- const { domRows: r } = o, n = r[e];
564
- if (n == null) return null;
565
- const s = n[t < n.length ? t : n.length - 1];
566
- return s ?? null;
567
- }
568
- getDOMCellFromCordsOrThrow(t, e, o) {
569
- const r = this.getDOMCellFromCords(t, e, o);
570
- if (!r) throw new Error("Cell not found at cords.");
571
- return r;
572
- }
573
- getCellNodeFromCords(t, e, o) {
574
- const r = this.getDOMCellFromCords(t, e, o);
575
- if (r == null) return null;
576
- const n = Y(r.elem);
577
- return S(n) ? n : null;
578
- }
579
- getCellNodeFromCordsOrThrow(t, e, o) {
580
- const r = this.getCellNodeFromCords(t, e, o);
581
- if (!r) throw new Error("Node at cords not TableCellNode.");
582
- return r;
583
- }
584
- getRowStriping() {
585
- return !!this.getLatest().__rowStriping;
586
- }
587
- setRowStriping(t) {
588
- const e = this.getWritable();
589
- return e.__rowStriping = t, e;
590
- }
591
- setFrozenColumns(t) {
592
- const e = this.getWritable();
593
- return e.__frozenColumnCount = t, e;
594
- }
595
- getFrozenColumns() {
596
- return this.getLatest().__frozenColumnCount;
597
- }
598
- setFrozenRows(t) {
599
- const e = this.getWritable();
600
- return e.__frozenRowCount = t, e;
601
- }
602
- getFrozenRows() {
603
- return this.getLatest().__frozenRowCount;
604
- }
605
- canSelectBefore() {
606
- return !0;
607
- }
608
- canIndent() {
609
- return !1;
610
- }
611
- getColumnCount() {
612
- const t = this.getFirstChild();
613
- if (!t) return 0;
614
- let e = 0;
615
- return t.getChildren().forEach(((o) => {
616
- S(o) && (e += o.getColSpan());
617
- })), e;
618
- }
619
- }
620
- function St(l) {
621
- const t = tt();
622
- 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);
623
- const e = l.querySelector(":scope > colgroup");
624
- if (e) {
625
- let o = [];
626
- for (const r of e.querySelectorAll(":scope > col")) {
627
- let n = r.style.width || "";
628
- if (!E.test(n) && (n = r.getAttribute("width") || "", !/^\d+$/.test(n))) {
629
- o = void 0;
630
- break;
631
- }
632
- o.push(parseFloat(n));
633
- }
634
- o && t.setColWidths(o);
635
- }
636
- return { after: (o) => V(o, v), node: t };
637
- }
638
- function tt() {
639
- return W(new F());
640
- }
641
- function et(l) {
642
- return l instanceof F;
643
- }
644
- export {
645
- ht as $computeTableMap,
646
- Z as $computeTableMapSkipCellCheck,
647
- j as $createTableCellNode,
648
- tt as $createTableNode,
649
- Q as $createTableRowNode,
650
- dt as $getNodeTriplet,
651
- J as $getTableCellNodeRect,
652
- U as $isScrollableTablesActive,
653
- S as $isTableCellNode,
654
- et as $isTableNode,
655
- v as $isTableRowNode,
656
- gt as $isTableSelection,
657
- y as TableCellHeaderStates,
658
- R as TableCellNode,
659
- F as TableNode,
660
- O as TableRowNode
661
- };