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,298 @@
1
+ "use client";
2
+ import { defineOverlayRules as w, defineImportRule as u, sel as c } from "../../html/dist/LexicalHtml.prod.js";
3
+ import { ElementNode as K, $getDocument as H, addClassNamesToElement as S, setDOMStyleFromCSS as b, $getEditor as G, $isTextNode as Q, $isTabNode as P, $createTabNode as U, $createLineBreakNode as F, $createParagraphNode as I, $create as Y, isHTMLElement as v, $isLineBreakNode as L, $applyNodeReplacement as Z, $getSiblingCaret as ee, TextNode as te, removeClassNamesFromElement as ne, $generateNodesFromRawText as E, isDOMTextNode as re } from "../../../lexical/dist/Lexical.prod.js";
4
+ import { getPeerDependencyFromEditor as ie } from "../../extension/dist/LexicalExtension.prod.js";
5
+ function se(n, e) {
6
+ let t = n;
7
+ for (let r = ee(n, e); r && (R(r.origin) || P(r.origin)); r = r.getAdjacentCaret()) t = r.origin;
8
+ return t;
9
+ }
10
+ function oe(n) {
11
+ return se(n, "previous");
12
+ }
13
+ function j(n, e) {
14
+ for (const t of n.childNodes)
15
+ if (v(t) && t.tagName === e || j(t, e)) return !0;
16
+ return !1;
17
+ }
18
+ const d = "data-language", p = "data-highlight-language", _ = "data-theme";
19
+ class x extends K {
20
+ __language;
21
+ __theme;
22
+ __isSyntaxHighlightSupported;
23
+ static getType() {
24
+ return "code";
25
+ }
26
+ static clone(e) {
27
+ return new x(e.__language, e.__key);
28
+ }
29
+ constructor(e, t) {
30
+ super(t), this.__language = e || void 0, this.__isSyntaxHighlightSupported = !1, this.__theme = void 0;
31
+ }
32
+ afterCloneFrom(e) {
33
+ super.afterCloneFrom(e), this.__language = e.__language, this.__theme = e.__theme, this.__isSyntaxHighlightSupported = e.__isSyntaxHighlightSupported;
34
+ }
35
+ createDOM(e) {
36
+ const t = H().createElement("code");
37
+ S(t, e.theme.code), t.setAttribute("spellcheck", "false");
38
+ const r = this.getLanguage();
39
+ r && (t.setAttribute(d, r), this.getIsSyntaxHighlightSupported() && t.setAttribute(p, r));
40
+ const s = this.getTheme();
41
+ s && t.setAttribute(_, s);
42
+ const i = this.getStyle();
43
+ return i && b(t.style, i), t;
44
+ }
45
+ updateDOM(e, t, r) {
46
+ const s = this.__language, i = e.__language;
47
+ s ? s !== i && t.setAttribute(d, s) : i && t.removeAttribute(d);
48
+ const o = this.__isSyntaxHighlightSupported;
49
+ e.__isSyntaxHighlightSupported && i ? o && s ? s !== i && t.setAttribute(p, s) : t.removeAttribute(p) : o && s && t.setAttribute(p, s);
50
+ const a = this.__theme, g = e.__theme;
51
+ a ? a !== g && t.setAttribute(_, a) : g && t.removeAttribute(_);
52
+ const m = this.__style, f = e.__style;
53
+ return m !== f && b(t.style, m, f), !1;
54
+ }
55
+ exportDOM(e) {
56
+ const t = H().createElement("pre");
57
+ S(t, e._config.theme.code), t.setAttribute("spellcheck", "false");
58
+ const r = this.getLanguage();
59
+ r && (t.setAttribute(d, r), this.getIsSyntaxHighlightSupported() && t.setAttribute(p, r));
60
+ const s = this.getTheme();
61
+ s && t.setAttribute(_, s);
62
+ const i = this.getStyle();
63
+ return i && b(t.style, i), { element: t };
64
+ }
65
+ static importDOM() {
66
+ return { code: (e) => e.textContent != null && (/\r?\n/.test(e.textContent) || j(e, "BR")) ? { conversion: D, priority: 1 } : null, div: () => ({ conversion: ae, priority: 1 }), pre: () => ({ conversion: D, priority: 0 }), table: (e) => C(e) ? { conversion: le, priority: 3 } : null, td: (e) => {
67
+ const t = e, r = t.closest("table");
68
+ return t.classList.contains("js-file-line") || r && C(r) ? { conversion: J, priority: 3 } : null;
69
+ }, tr: (e) => {
70
+ const t = e.closest("table");
71
+ return t && C(t) ? { conversion: J, priority: 3 } : null;
72
+ } };
73
+ }
74
+ static importJSON(e) {
75
+ return l().updateFromJSON(e);
76
+ }
77
+ updateFromJSON(e) {
78
+ return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme);
79
+ }
80
+ exportJSON() {
81
+ return { ...super.exportJSON(), language: this.getLanguage(), theme: this.getTheme() };
82
+ }
83
+ insertNewAfter(e, t = !0) {
84
+ if (!ie(G(), "@lexical/code")) {
85
+ const o = ue(e);
86
+ if (o) return o;
87
+ }
88
+ const { anchor: r, focus: s } = e, i = (r.isBefore(s) ? r : s).getNode();
89
+ if (Q(i)) {
90
+ let o = oe(i);
91
+ const a = [];
92
+ for (; ; ) if (P(o)) a.push(U()), o = o.getNextSibling();
93
+ else {
94
+ if (!R(o)) break;
95
+ {
96
+ let h = 0;
97
+ const X = o.getTextContent(), O = o.getTextContentSize();
98
+ for (; h < O && X[h] === " "; ) h++;
99
+ if (h !== 0 && a.push(B(" ".repeat(h))), h !== O) break;
100
+ o = o.getNextSibling();
101
+ }
102
+ }
103
+ const g = i.splitText(r.offset)[0], m = r.offset === 0 ? 0 : 1, f = g.getIndexWithinParent() + m, z = i.getParentOrThrow(), V = [F(), ...a];
104
+ z.splice(f, 0, V);
105
+ const A = a[a.length - 1];
106
+ A ? A.select() : r.offset === 0 ? g.selectPrevious() : g.getNextSibling().selectNext(0, 0);
107
+ }
108
+ if (k(i)) {
109
+ const { offset: o } = e.anchor;
110
+ i.splice(o, 0, [F()]), i.select(o + 1, o + 1);
111
+ }
112
+ return null;
113
+ }
114
+ canIndent() {
115
+ return !1;
116
+ }
117
+ collapseAtStart() {
118
+ const e = I();
119
+ return this.getChildren().forEach((t) => e.append(t)), this.replace(e), !0;
120
+ }
121
+ setLanguage(e) {
122
+ const t = this.getWritable();
123
+ return t.__language = e || void 0, t;
124
+ }
125
+ getLanguage() {
126
+ return this.getLatest().__language;
127
+ }
128
+ setIsSyntaxHighlightSupported(e) {
129
+ const t = this.getWritable();
130
+ return t.__isSyntaxHighlightSupported = e, t;
131
+ }
132
+ getIsSyntaxHighlightSupported() {
133
+ return this.getLatest().__isSyntaxHighlightSupported;
134
+ }
135
+ setTheme(e) {
136
+ const t = this.getWritable();
137
+ return t.__theme = e || void 0, t;
138
+ }
139
+ getTheme() {
140
+ return this.getLatest().__theme;
141
+ }
142
+ }
143
+ function l(n, e) {
144
+ return Y(x).setLanguage(n).setTheme(e);
145
+ }
146
+ function k(n) {
147
+ return n instanceof x;
148
+ }
149
+ function D(n) {
150
+ return { node: l(n.getAttribute(d)) };
151
+ }
152
+ function ae(n) {
153
+ const e = n, t = M(e);
154
+ return t || (function(r) {
155
+ let s = r.parentElement;
156
+ for (; s !== null; ) {
157
+ if (M(s)) return !0;
158
+ s = s.parentElement;
159
+ }
160
+ return !1;
161
+ })(e) ? { node: t ? l() : null } : { node: null };
162
+ }
163
+ function le() {
164
+ return { node: l() };
165
+ }
166
+ function J() {
167
+ return { node: null };
168
+ }
169
+ function M(n) {
170
+ return n.style.fontFamily.match("monospace") !== null;
171
+ }
172
+ function C(n) {
173
+ return n.classList.contains("js-file-line-container");
174
+ }
175
+ function ue(n) {
176
+ const { anchor: e } = n;
177
+ if (n.isCollapsed() && e.type === "element") {
178
+ const t = e.getNode();
179
+ if (k(t)) {
180
+ const r = t.getChildrenSize();
181
+ if (r >= 2 && e.offset === r) {
182
+ const s = t.getLastChild();
183
+ if (L(s) && L(s.getPreviousSibling())) {
184
+ const i = I();
185
+ return t.splice(r - 2, 2, []).insertAfter(i, !1), i.select(), i;
186
+ }
187
+ }
188
+ }
189
+ }
190
+ return null;
191
+ }
192
+ class N extends te {
193
+ __highlightType;
194
+ constructor(e = "", t, r) {
195
+ super(e, r), this.__highlightType = t;
196
+ }
197
+ static getType() {
198
+ return "code-highlight";
199
+ }
200
+ static clone(e) {
201
+ return new N(e.__text, e.__highlightType || void 0, e.__key);
202
+ }
203
+ afterCloneFrom(e) {
204
+ super.afterCloneFrom(e), this.__highlightType = e.__highlightType;
205
+ }
206
+ getHighlightType() {
207
+ return this.getLatest().__highlightType;
208
+ }
209
+ setHighlightType(e) {
210
+ const t = this.getWritable();
211
+ return t.__highlightType = e || void 0, t;
212
+ }
213
+ canHaveFormat() {
214
+ return !1;
215
+ }
216
+ createDOM(e) {
217
+ const t = super.createDOM(e), r = T(e.theme, this.__highlightType);
218
+ return S(t, r), t;
219
+ }
220
+ updateDOM(e, t, r) {
221
+ const s = super.updateDOM(e, t, r), i = T(r.theme, e.__highlightType), o = T(r.theme, this.__highlightType);
222
+ return i !== o && (i && ne(t, i), o && S(t, o)), s;
223
+ }
224
+ static importJSON(e) {
225
+ return B().updateFromJSON(e);
226
+ }
227
+ updateFromJSON(e) {
228
+ return super.updateFromJSON(e).setHighlightType(e.highlightType);
229
+ }
230
+ exportJSON() {
231
+ return { ...super.exportJSON(), highlightType: this.getHighlightType() };
232
+ }
233
+ setFormat(e) {
234
+ return this;
235
+ }
236
+ isParentRequired() {
237
+ return !0;
238
+ }
239
+ createParentElementNode() {
240
+ return l();
241
+ }
242
+ }
243
+ function T(n, e) {
244
+ return e && n && n.codeHighlight && n.codeHighlight[e];
245
+ }
246
+ function B(n = "", e) {
247
+ return Z(new N(n, e));
248
+ }
249
+ function R(n) {
250
+ return n instanceof N;
251
+ }
252
+ const W = "data-language";
253
+ function q(n) {
254
+ return n.style.fontFamily.match("monospace") !== null;
255
+ }
256
+ function $(n) {
257
+ let e = n.parentElement;
258
+ for (; e !== null; ) {
259
+ if (q(e)) return !0;
260
+ e = e.parentElement;
261
+ }
262
+ return !1;
263
+ }
264
+ const ce = /* @__PURE__ */ w([/* @__PURE__ */ u({ $import: (n, e) => n.$importChildren(e), match: c.tag("tr", "td"), name: "@lexical/code/github-code-table/unwrap" })]), ge = /* @__PURE__ */ u({ $import: (n, e) => [l(e.getAttribute(W)).splice(0, 0, n.$importChildren(e))], match: c.tag("pre"), name: "@lexical/code/pre" }), he = /* @__PURE__ */ u({ $import: (n, e, t) => {
265
+ const r = e.textContent || "";
266
+ return /\r?\n/.test(r) || e.querySelector("br") !== null ? [l(e.getAttribute(W)).splice(0, 0, n.$importChildren(e))] : t();
267
+ }, match: c.tag("code"), name: "@lexical/code/code-multiline" });
268
+ function y(n) {
269
+ if (!v(n)) return !1;
270
+ const e = n.style.fontFamily, t = n.style.whiteSpace;
271
+ return typeof e == "string" && /monospace/i.test(e) && typeof t == "string" && t.startsWith("pre");
272
+ }
273
+ function pe(n) {
274
+ let e = !1;
275
+ const t = [];
276
+ let r = "", s = !1;
277
+ const i = () => {
278
+ s && (t.push(r), r = "", s = !1);
279
+ };
280
+ for (const o of Array.from(n.childNodes)) if (v(o)) o.tagName === "DIV" ? (i(), t.push(o.textContent || ""), e = !0) : o.tagName === "BR" ? (i(), t.push(""), e = !0) : (r += o.textContent || "", s = !0);
281
+ else if (re(o)) {
282
+ const a = o.textContent || "";
283
+ a.length > 0 && (r += a, s = !0);
284
+ }
285
+ return i(), e ? t : null;
286
+ }
287
+ c.tag("div"), c.tag("div", "br");
288
+ const de = /* @__PURE__ */ u({ $import: (n, e, t) => q(e) ? [l().splice(0, 0, n.$importChildren(e))] : $(e) ? n.$importChildren(e) : t(), match: c.tag("div"), name: "@lexical/code/div" });
289
+ c.tag("table").classAll("js-file-line-container"), c.tag("td").classAll("js-file-line");
290
+ export {
291
+ B as $createCodeHighlightNode,
292
+ l as $createCodeNode,
293
+ oe as $getFirstCodeNodeOfLine,
294
+ R as $isCodeHighlightNode,
295
+ k as $isCodeNode,
296
+ N as CodeHighlightNode,
297
+ x as CodeNode
298
+ };
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ import { watchedSignal as v, effect as w } from "../../extension/dist/LexicalExtension.prod.js";
3
+ import { getEditorPropertyFromDOMNode as N, getActiveElementDeep as T, isLexicalEditor as E, $getSelection as M, $isRangeSelection as R, $isTextNode as S } from "../../../lexical/dist/Lexical.prod.js";
4
+ const D = { bold: "bold", italic: "italic", strikeThrough: "strikethrough", subscript: "subscript", superscript: "superscript", underline: "underline" }, m = Symbol.for("@lexical/dragon/WindowState");
5
+ function L(i, s, n) {
6
+ const e = (function(t) {
7
+ let o = t[m];
8
+ return o === void 0 && (o = { dispose: () => {
9
+ }, editors: /* @__PURE__ */ new Map(), installs: /* @__PURE__ */ new Set() }, t[m] = o), o;
10
+ })(i);
11
+ if (e.installs.size === 0) {
12
+ const t = C.bind(i);
13
+ i.addEventListener("message", t, !0), e.dispose = () => {
14
+ i.removeEventListener("message", t, !0);
15
+ };
16
+ }
17
+ if (e.installs.add(s), n) {
18
+ const t = e.editors.get(n) || /* @__PURE__ */ new Set();
19
+ t.add(s), e.editors.set(n, t);
20
+ }
21
+ return z.bind(null, i, e, s, n);
22
+ }
23
+ function z(i, s, n, e) {
24
+ if (e) {
25
+ const t = s.editors.get(e);
26
+ t && t.delete(n) && t.size === 0 && s.editors.delete(e);
27
+ }
28
+ s.installs.delete(n) && s.installs.size === 0 && (s.dispose(), delete i[m]);
29
+ }
30
+ function b(i) {
31
+ return i && i.ownerDocument.defaultView;
32
+ }
33
+ function I(i) {
34
+ const s = v(() => b(i.getRootElement()), (n) => i.registerRootListener((e) => {
35
+ n.value = b(e);
36
+ }));
37
+ return w(() => {
38
+ const n = s.value;
39
+ if (n) return L(n, Symbol("@lexical/dragon/editorInstall"), i);
40
+ });
41
+ }
42
+ function C(i) {
43
+ if (i.origin !== this.location.origin) return;
44
+ const s = (function(e) {
45
+ const t = e[m];
46
+ if (t === void 0) return null;
47
+ const o = N(T(e.document));
48
+ return E(o) && t.editors.has(o) ? o : null;
49
+ })(this);
50
+ if (s === null) return;
51
+ const n = i.data;
52
+ if (typeof n == "string") {
53
+ let e;
54
+ try {
55
+ e = JSON.parse(n);
56
+ } catch {
57
+ return;
58
+ }
59
+ if (e && e.protocol === "nuanria_messaging" && e.type === "request") {
60
+ const t = e.payload;
61
+ if (t && t.functionId === "makeChanges") {
62
+ const o = t.args;
63
+ if (Array.isArray(o)) {
64
+ const [f, h, c, g, p, y] = o;
65
+ if (![f, h, g, p].every(Number.isFinite) || typeof c != "string" && c !== -1) return;
66
+ s.update(() => {
67
+ const a = M();
68
+ if (R(a)) {
69
+ const x = a.anchor;
70
+ let r = x.getNode(), l = 0, d = 0;
71
+ if (S(r) && f >= 0 && h >= 0 && (l = f, d = f + h, a.setTextNodeRange(r, l, r, d)), typeof c != "string" || l === d && c === "" || (a.insertRawText(c), r = x.getNode()), S(r)) {
72
+ const u = r.getTextContentSize();
73
+ l = Math.min(Math.max(g, 0), u), d = g < 0 || p < 0 ? l : Math.min(g + p, u), a.setTextNodeRange(r, l, r, d);
74
+ }
75
+ if (typeof y == "string" && p > 0 && !a.isCollapsed()) {
76
+ const u = D[y];
77
+ u !== void 0 && a.formatText(u);
78
+ }
79
+ i.stopImmediatePropagation();
80
+ }
81
+ });
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ export {
88
+ I as registerDragonSupport
89
+ };