@uva-glass/component-library 1.64.5 → 1.64.7

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 (87) hide show
  1. package/dist/Lexical.prod-DeeCy7Xd.js +4216 -0
  2. package/dist/Lexical.prod-DeeCy7Xd.js.map +1 -0
  3. package/dist/LexicalClipboard.prod-CayrMfkI.js +258 -0
  4. package/dist/LexicalClipboard.prod-CayrMfkI.js.map +1 -0
  5. package/dist/{LexicalLink.prod-BvJo1BD4.js → LexicalLink.prod-Biaqry-c.js} +40 -40
  6. package/dist/LexicalLink.prod-Biaqry-c.js.map +1 -0
  7. package/dist/{LexicalList.prod-igdv32dp.js → LexicalList.prod-Uk8UObU7.js} +52 -50
  8. package/dist/LexicalList.prod-Uk8UObU7.js.map +1 -0
  9. package/dist/LexicalSelection.prod-C1TEIGhq.js +86 -0
  10. package/dist/{LexicalSelection.prod-CL_DfdL6.js.map → LexicalSelection.prod-C1TEIGhq.js.map} +1 -1
  11. package/dist/LexicalTable.prod-hx6rW3fc.js +1338 -0
  12. package/dist/LexicalTable.prod-hx6rW3fc.js.map +1 -0
  13. package/dist/LexicalUtils.prod-CCjlRAc-.js +94 -0
  14. package/dist/LexicalUtils.prod-CCjlRAc-.js.map +1 -0
  15. package/dist/{TablePlugin-BVkwu1Gt.js → TablePlugin-BbiBRjod.js} +45 -45
  16. package/dist/{TablePlugin-BVkwu1Gt.js.map → TablePlugin-BbiBRjod.js.map} +1 -1
  17. package/dist/components/Buttons/Button.stories.js +1 -1
  18. package/dist/components/Buttons/LinkButton.stories.js +1 -1
  19. package/dist/components/Buttons/MenuButton.stories.js +1 -1
  20. package/dist/components/Checkbox/Checkbox.stories.js +1 -1
  21. package/dist/components/CheckboxButton/CheckboxButton.stories.js +1 -1
  22. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
  23. package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
  24. package/dist/components/CheckboxTree/CheckboxTree.stories.js +1 -1
  25. package/dist/components/Drawer/Drawer.stories.js +1 -1
  26. package/dist/components/FormInput/FormInput.js +2 -2
  27. package/dist/components/FormInput/FormInput.stories.js +1 -1
  28. package/dist/components/IconButton/IconButton.stories.js +1 -1
  29. package/dist/components/InputField/InputField.stories.js +3 -3
  30. package/dist/components/ModalDialog/ModalDialog.stories.js +1 -1
  31. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  32. package/dist/components/MultiSelect/MultiSelect.stories.js +2 -2
  33. package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
  34. package/dist/components/MultiSelect/index.js +1 -1
  35. package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +1 -1
  36. package/dist/components/PeriodSelector/PeriodSelector.js +2 -2
  37. package/dist/components/PeriodSelector/PeriodSelector.stories.js +1 -1
  38. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +3 -3
  39. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +2 -2
  40. package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +7 -7
  41. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +5 -5
  42. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +3 -3
  43. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
  44. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +69 -69
  45. package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
  46. package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +25 -25
  47. package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +12 -12
  48. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
  49. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +4 -4
  50. package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +24 -24
  51. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  52. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +26 -26
  53. package/dist/components/RteEditor/Plugins/index.js +1 -1
  54. package/dist/components/RteEditor/RteEditor.js +474 -473
  55. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  56. package/dist/components/RteEditor/helpers.js +9 -9
  57. package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
  58. package/dist/components/Sortable/Sortable.stories.js +1 -1
  59. package/dist/components/index.js +1 -1
  60. package/dist/{helpers-BKqr9jXh.js → helpers-CgzuKnuq.js} +39 -39
  61. package/dist/{helpers-BKqr9jXh.js.map → helpers-CgzuKnuq.js.map} +1 -1
  62. package/dist/index-0wq-B7do.js +238 -0
  63. package/dist/{index-DPQ9bZx5.js.map → index-0wq-B7do.js.map} +1 -1
  64. package/dist/{index-DsprzSCj.js → index-B9BWML6P.js} +1025 -963
  65. package/dist/{index-DsprzSCj.js.map → index-B9BWML6P.js.map} +1 -1
  66. package/dist/{index-C9QoqAAt.js → index-DQyNeMuh.js} +66 -66
  67. package/dist/index-DQyNeMuh.js.map +1 -0
  68. package/dist/index.js +1 -1
  69. package/dist/react-18-BIqxBxbW.js +65 -0
  70. package/dist/{react-18-C0Aiha-e.js.map → react-18-BIqxBxbW.js.map} +1 -1
  71. package/dist/storybook__react.d.js +186 -183
  72. package/dist/storybook__react.d.js.map +1 -1
  73. package/package.json +19 -19
  74. package/dist/Lexical.prod-RJB8n7sC.js +0 -4072
  75. package/dist/Lexical.prod-RJB8n7sC.js.map +0 -1
  76. package/dist/LexicalClipboard.prod-DB_B0Sr6.js +0 -259
  77. package/dist/LexicalClipboard.prod-DB_B0Sr6.js.map +0 -1
  78. package/dist/LexicalLink.prod-BvJo1BD4.js.map +0 -1
  79. package/dist/LexicalList.prod-igdv32dp.js.map +0 -1
  80. package/dist/LexicalSelection.prod-CL_DfdL6.js +0 -86
  81. package/dist/LexicalTable.prod-CfgKmbyy.js +0 -1221
  82. package/dist/LexicalTable.prod-CfgKmbyy.js.map +0 -1
  83. package/dist/LexicalUtils.prod-mYf1cd8X.js +0 -94
  84. package/dist/LexicalUtils.prod-mYf1cd8X.js.map +0 -1
  85. package/dist/index-C9QoqAAt.js.map +0 -1
  86. package/dist/index-DPQ9bZx5.js +0 -231
  87. package/dist/react-18-C0Aiha-e.js +0 -52
@@ -0,0 +1,4216 @@
1
+ function to(n) {
2
+ return {};
3
+ }
4
+ const Nn = {}, eo = {}, Ai = {}, ve = {}, ye = {}, Zn = {}, jt = {}, Kr = {}, tr = {}, Se = {}, Ce = {}, wt = {}, Jr = {}, $r = {}, Bi = {}, zi = {}, Wi = {}, Ri = {}, Ki = {}, Ji = {}, $i = {}, hn = {}, Ui = {}, Vi = {}, ji = {}, Hi = {}, qi = {}, no = {}, ro = {}, io = {}, Gi = {}, so = {}, Qi = {}, Xi = {}, Yi = {}, Ur = {}, Vr = {}, er = {}, oo = {}, lo = {}, ao = {}, co = {}, Zi = {}, ts = {}, es = {}, nt = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, ns = nt && "documentMode" in document ? document.documentMode : null, Z = nt && /Mac|iPod|iPhone|iPad/.test(navigator.platform), xt = nt && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent), Te = !(!nt || !("InputEvent" in window) || ns) && "getTargetRanges" in new window.InputEvent("input"), Be = nt && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), re = nt && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, rs = nt && /Android/.test(navigator.userAgent), jr = nt && /^(?=.*Chrome).*/i.test(navigator.userAgent), is = nt && rs && jr, En = nt && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !jr, ie = 1, Ct = 3, Et = 0, Hr = 1, At = 2, ss = 0, os = 1, ls = 2, ke = 4, be = 8, Pn = 128, as = 112 | (3 | ke | be) | Pn, Fn = 1, Dn = 2, Ln = 3, On = 4, Mn = 5, In = 6, ze = Be || re || En ? " " : "​", ct = `
5
+
6
+ `, cs = xt ? " " : ze, qr = "֑-߿יִ-﷽ﹰ-ﻼ", Gr = "A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿", us = new RegExp("^[^" + Gr + "]*[" + qr + "]"), fs = new RegExp("^[^" + qr + "]*[" + Gr + "]"), at = { bold: 1, code: 16, highlight: Pn, italic: 2, strikethrough: ke, subscript: 32, superscript: 64, underline: be }, ds = { directionless: 1, unmergeable: 2 }, nr = { center: Dn, end: In, justify: On, left: Fn, right: Ln, start: Mn }, hs = { [Dn]: "center", [In]: "end", [On]: "justify", [Fn]: "left", [Ln]: "right", [Mn]: "start" }, gs = { normal: 0, segmented: 2, token: 1 }, _s = { [ss]: "normal", [ls]: "segmented", [os]: "token" };
7
+ function ps(n) {
8
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
9
+ }
10
+ var T = ps(function(n) {
11
+ const t = new URLSearchParams();
12
+ t.append("code", n);
13
+ for (let e = 1; e < arguments.length; e++) t.append("v", arguments[e]);
14
+ throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
15
+ });
16
+ function we(...n) {
17
+ const t = [];
18
+ for (const e of n) if (e && typeof e == "string") for (const [r] of e.matchAll(/\S+/g)) t.push(r);
19
+ return t;
20
+ }
21
+ const ys = 100;
22
+ let gn = !1, An = 0;
23
+ function ms(n) {
24
+ An = n.timeStamp;
25
+ }
26
+ function nn(n, t, e) {
27
+ const r = n.nodeName === "BR", i = t.__lexicalLineBreak;
28
+ return i && (n === i || r && n.previousSibling === i) || r && Ke(n, e) !== void 0;
29
+ }
30
+ function xs(n, t, e) {
31
+ const r = it(e._window);
32
+ let i = null, s = null;
33
+ r !== null && r.anchorNode === n && (i = r.anchorOffset, s = r.focusOffset);
34
+ const o = n.nodeValue;
35
+ o !== null && Kn(t, o, i, s, !1);
36
+ }
37
+ function vs(n, t, e) {
38
+ if (F(n)) {
39
+ const r = n.anchor.getNode();
40
+ if (r.is(e) && n.format !== r.getFormat()) return !1;
41
+ }
42
+ return t.nodeType === Ct && e.isAttached();
43
+ }
44
+ function Ss(n, t, e, r) {
45
+ for (let i = n; i && !Is(i); i = se(i)) {
46
+ const s = Ke(i, t);
47
+ if (s !== void 0) {
48
+ const o = V(s, e);
49
+ if (o) return I(o) ? void 0 : [i, o];
50
+ } else if (i === r) return [r, ii(e)];
51
+ }
52
+ }
53
+ function Qr(n, t, e) {
54
+ gn = !0;
55
+ const r = performance.now() - An > ys;
56
+ try {
57
+ Q(n, () => {
58
+ const i = M() || function(f) {
59
+ return f.getEditorState().read(() => {
60
+ const h = M();
61
+ return h !== null ? h.clone() : null;
62
+ });
63
+ }(n), s = /* @__PURE__ */ new Map(), o = n.getRootElement(), l = n._editorState, a = n._blockCursorElement;
64
+ let c = !1, u = "";
65
+ for (let f = 0; f < t.length; f++) {
66
+ const h = t[f], g = h.type, _ = h.target, p = Ss(_, n, l, o);
67
+ if (!p) continue;
68
+ const [m, y] = p;
69
+ if (g === "characterData") r && E(y) && vs(i, _, y) && xs(_, y, n);
70
+ else if (g === "childList") {
71
+ c = !0;
72
+ const x = h.addedNodes;
73
+ for (let v = 0; v < x.length; v++) {
74
+ const P = x[v], C = ni(P), N = P.parentNode;
75
+ if (N != null && P !== a && C === null && !nn(P, N, n)) {
76
+ if (xt) {
77
+ const D = P.innerText || P.nodeValue;
78
+ D && (u += D);
79
+ }
80
+ N.removeChild(P);
81
+ }
82
+ }
83
+ const b = h.removedNodes, k = b.length;
84
+ if (k > 0) {
85
+ let v = 0;
86
+ for (let P = 0; P < k; P++) {
87
+ const C = b[P];
88
+ (nn(C, _, n) || a === C) && (_.appendChild(C), v++);
89
+ }
90
+ k !== v && s.set(m, y);
91
+ }
92
+ }
93
+ }
94
+ if (s.size > 0) for (const [f, h] of s) h.reconcileObservedMutation(f, n);
95
+ const d = e.takeRecords();
96
+ if (d.length > 0) {
97
+ for (let f = 0; f < d.length; f++) {
98
+ const h = d[f], g = h.addedNodes, _ = h.target;
99
+ for (let p = 0; p < g.length; p++) {
100
+ const m = g[p], y = m.parentNode;
101
+ y == null || m.nodeName !== "BR" || nn(m, _, n) || y.removeChild(m);
102
+ }
103
+ }
104
+ e.takeRecords();
105
+ }
106
+ i !== null && (c && (i.dirty = !0, ut(i)), xt && ai(n) && i.insertRawText(u));
107
+ });
108
+ } finally {
109
+ gn = !1;
110
+ }
111
+ }
112
+ function Xr(n) {
113
+ const t = n._observer;
114
+ t !== null && Qr(n, t.takeRecords(), t);
115
+ }
116
+ function Yr(n) {
117
+ (function(t) {
118
+ An === 0 && $e(t).addEventListener("textInput", ms, !0);
119
+ })(n), n._observer = new MutationObserver((t, e) => {
120
+ Qr(n, t, e);
121
+ });
122
+ }
123
+ function rr(n, t) {
124
+ const e = n.__mode, r = n.__format, i = n.__style, s = t.__mode, o = t.__format, l = t.__style;
125
+ return !(e !== null && e !== s || r !== null && r !== o || i !== null && i !== l);
126
+ }
127
+ function ir(n, t) {
128
+ const e = n.mergeWithSibling(t), r = A()._normalizedNodes;
129
+ return r.add(n.__key), r.add(t.__key), e;
130
+ }
131
+ function sr(n) {
132
+ let t, e, r = n;
133
+ if (r.__text !== "" || !r.isSimpleText() || r.isUnmergeable()) {
134
+ for (; (t = r.getPreviousSibling()) !== null && E(t) && t.isSimpleText() && !t.isUnmergeable(); ) {
135
+ if (t.__text !== "") {
136
+ if (rr(t, r)) {
137
+ r = ir(t, r);
138
+ break;
139
+ }
140
+ break;
141
+ }
142
+ t.remove();
143
+ }
144
+ for (; (e = r.getNextSibling()) !== null && E(e) && e.isSimpleText() && !e.isUnmergeable(); ) {
145
+ if (e.__text !== "") {
146
+ if (rr(r, e)) {
147
+ r = ir(r, e);
148
+ break;
149
+ }
150
+ break;
151
+ }
152
+ e.remove();
153
+ }
154
+ } else r.remove();
155
+ }
156
+ function Cs(n) {
157
+ return or(n.anchor), or(n.focus), n;
158
+ }
159
+ function or(n) {
160
+ for (; n.type === "element"; ) {
161
+ const t = n.getNode(), e = n.offset;
162
+ let r, i;
163
+ if (e === t.getChildrenSize() ? (r = t.getChildAtIndex(e - 1), i = !0) : (r = t.getChildAtIndex(e), i = !1), E(r)) {
164
+ n.set(r.__key, i ? r.getTextContentSize() : 0, "text");
165
+ break;
166
+ }
167
+ if (!S(r)) break;
168
+ n.set(r.__key, i ? r.getChildrenSize() : 0, "element");
169
+ }
170
+ }
171
+ let Ts = 1;
172
+ const ks = typeof queueMicrotask == "function" ? queueMicrotask : (n) => {
173
+ Promise.resolve().then(n);
174
+ };
175
+ function Zr(n) {
176
+ const t = document.activeElement;
177
+ if (t === null) return !1;
178
+ const e = t.nodeName;
179
+ return I(zn(n)) && (e === "INPUT" || e === "TEXTAREA" || t.contentEditable === "true" && Re(t) == null);
180
+ }
181
+ function We(n, t, e) {
182
+ const r = n.getRootElement();
183
+ try {
184
+ return r !== null && r.contains(t) && r.contains(e) && t !== null && !Zr(t) && ti(t) === n;
185
+ } catch {
186
+ return !1;
187
+ }
188
+ }
189
+ function Bn(n) {
190
+ return n instanceof Ye;
191
+ }
192
+ function ti(n) {
193
+ let t = n;
194
+ for (; t != null; ) {
195
+ const e = Re(t);
196
+ if (Bn(e)) return e;
197
+ t = se(t);
198
+ }
199
+ return null;
200
+ }
201
+ function Re(n) {
202
+ return n ? n.__lexicalEditor : null;
203
+ }
204
+ function bt(n) {
205
+ return n.isToken() || n.isSegmented();
206
+ }
207
+ function bs(n) {
208
+ return n.nodeType === Ct;
209
+ }
210
+ function Ne(n) {
211
+ let t = n;
212
+ for (; t != null; ) {
213
+ if (bs(t)) return t;
214
+ t = t.firstChild;
215
+ }
216
+ return null;
217
+ }
218
+ function Ee(n, t, e) {
219
+ const r = at[t];
220
+ if (e !== null && (n & r) == (e & r)) return n;
221
+ let i = n ^ r;
222
+ return t === "subscript" ? i &= ~at.superscript : t === "superscript" && (i &= ~at.subscript), i;
223
+ }
224
+ function uo(n) {
225
+ return E(n) || It(n) || I(n);
226
+ }
227
+ function ei(n, t) {
228
+ if (t != null) return void (n.__key = t);
229
+ q(), Ei();
230
+ const e = A(), r = ft(), i = "" + Ts++;
231
+ r._nodeMap.set(i, n), S(n) ? e._dirtyElements.set(i, !0) : e._dirtyLeaves.add(i), e._cloneNotNeeded.add(i), e._dirtyType = Hr, n.__key = i;
232
+ }
233
+ function Nt(n) {
234
+ const t = n.getParent();
235
+ if (t !== null) {
236
+ const e = n.getWritable(), r = t.getWritable(), i = n.getPreviousSibling(), s = n.getNextSibling();
237
+ if (i === null) if (s !== null) {
238
+ const o = s.getWritable();
239
+ r.__first = s.__key, o.__prev = null;
240
+ } else r.__first = null;
241
+ else {
242
+ const o = i.getWritable();
243
+ if (s !== null) {
244
+ const l = s.getWritable();
245
+ l.__prev = o.__key, o.__next = l.__key;
246
+ } else o.__next = null;
247
+ e.__prev = null;
248
+ }
249
+ if (s === null) if (i !== null) {
250
+ const o = i.getWritable();
251
+ r.__last = i.__key, o.__next = null;
252
+ } else r.__last = null;
253
+ else {
254
+ const o = s.getWritable();
255
+ if (i !== null) {
256
+ const l = i.getWritable();
257
+ l.__next = o.__key, o.__prev = l.__key;
258
+ } else o.__prev = null;
259
+ e.__next = null;
260
+ }
261
+ r.__size--, e.__parent = null;
262
+ }
263
+ }
264
+ function Pe(n) {
265
+ Ei();
266
+ const t = n.getLatest(), e = t.__parent, r = ft(), i = A(), s = r._nodeMap, o = i._dirtyElements;
267
+ e !== null && function(a, c, u) {
268
+ let d = a;
269
+ for (; d !== null; ) {
270
+ if (u.has(d)) return;
271
+ const f = c.get(d);
272
+ if (f === void 0) break;
273
+ u.set(d, !1), d = f.__parent;
274
+ }
275
+ }(e, s, o);
276
+ const l = t.__key;
277
+ i._dirtyType = Hr, S(n) ? o.set(l, !0) : i._dirtyLeaves.add(l);
278
+ }
279
+ function U(n) {
280
+ q();
281
+ const t = A(), e = t._compositionKey;
282
+ if (n !== e) {
283
+ if (t._compositionKey = n, e !== null) {
284
+ const r = V(e);
285
+ r !== null && r.getWritable();
286
+ }
287
+ if (n !== null) {
288
+ const r = V(n);
289
+ r !== null && r.getWritable();
290
+ }
291
+ }
292
+ }
293
+ function yt() {
294
+ return ce() ? null : A()._compositionKey;
295
+ }
296
+ function V(n, t) {
297
+ const e = (t || ft())._nodeMap.get(n);
298
+ return e === void 0 ? null : e;
299
+ }
300
+ function ni(n, t) {
301
+ const e = Ke(n, A());
302
+ return e !== void 0 ? V(e, t) : null;
303
+ }
304
+ function Ke(n, t) {
305
+ return n[`__lexicalKey_${t._key}`];
306
+ }
307
+ function zn(n, t) {
308
+ let e = n;
309
+ for (; e != null; ) {
310
+ const r = ni(e, t);
311
+ if (r !== null) return r;
312
+ e = se(e);
313
+ }
314
+ return null;
315
+ }
316
+ function ri(n) {
317
+ const t = n._decorators, e = Object.assign({}, t);
318
+ return n._pendingDecorators = e, e;
319
+ }
320
+ function lr(n) {
321
+ return n.read(() => Y().getTextContent());
322
+ }
323
+ function Y() {
324
+ return ii(ft());
325
+ }
326
+ function ii(n) {
327
+ return n._nodeMap.get("root");
328
+ }
329
+ function ut(n) {
330
+ q();
331
+ const t = ft();
332
+ n !== null && (n.dirty = !0, n.setCachedNodes(null)), t._selection = n;
333
+ }
334
+ function Ot(n) {
335
+ const t = A(), e = function(r, i) {
336
+ let s = r;
337
+ for (; s != null; ) {
338
+ const o = Ke(s, i);
339
+ if (o !== void 0) return o;
340
+ s = se(s);
341
+ }
342
+ return null;
343
+ }(n, t);
344
+ return e === null ? n === t.getRootElement() ? V("root") : null : V(e);
345
+ }
346
+ function ar(n, t) {
347
+ return t ? n.getTextContentSize() : 0;
348
+ }
349
+ function si(n) {
350
+ return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n);
351
+ }
352
+ function Wn(n) {
353
+ const t = [];
354
+ let e = n;
355
+ for (; e !== null; ) t.push(e), e = e._parentEditor;
356
+ return t;
357
+ }
358
+ function oi() {
359
+ return Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 5);
360
+ }
361
+ function li(n) {
362
+ return n.nodeType === Ct ? n.nodeValue : null;
363
+ }
364
+ function Rn(n, t, e) {
365
+ const r = it(t._window);
366
+ if (r === null) return;
367
+ const i = r.anchorNode;
368
+ let { anchorOffset: s, focusOffset: o } = r;
369
+ if (i !== null) {
370
+ let l = li(i);
371
+ const a = zn(i);
372
+ if (l !== null && E(a)) {
373
+ if (l === ze && e) {
374
+ const c = e.length;
375
+ l = e, s = c, o = c;
376
+ }
377
+ l !== null && Kn(a, l, s, o, n);
378
+ }
379
+ }
380
+ }
381
+ function Kn(n, t, e, r, i) {
382
+ let s = n;
383
+ if (s.isAttached() && (i || !s.isDirty())) {
384
+ const o = s.isComposing();
385
+ let l = t;
386
+ (o || i) && t[t.length - 1] === ze && (l = t.slice(0, -1));
387
+ const a = s.getTextContent();
388
+ if (i || l !== a) {
389
+ if (l === "") {
390
+ if (U(null), Be || re || En) s.remove();
391
+ else {
392
+ const _ = A();
393
+ setTimeout(() => {
394
+ _.update(() => {
395
+ s.isAttached() && s.remove();
396
+ });
397
+ }, 20);
398
+ }
399
+ return;
400
+ }
401
+ const c = s.getParent(), u = ae(), d = s.getTextContentSize(), f = yt(), h = s.getKey();
402
+ if (s.isToken() || f !== null && h === f && !o || F(u) && (c !== null && !c.canInsertTextBefore() && u.anchor.offset === 0 || u.anchor.key === n.__key && u.anchor.offset === 0 && !s.canInsertTextBefore() && !o || u.focus.key === n.__key && u.focus.offset === d && !s.canInsertTextAfter() && !o)) return void s.markDirty();
403
+ const g = M();
404
+ if (!F(g) || e === null || r === null) return void s.setTextContent(l);
405
+ if (g.setTextNodeRange(s, e, s, r), s.isSegmented()) {
406
+ const _ = $(s.getTextContent());
407
+ s.replace(_), s = _;
408
+ }
409
+ s.setTextContent(l);
410
+ }
411
+ }
412
+ }
413
+ function ws(n, t) {
414
+ if (t.isSegmented()) return !0;
415
+ if (!n.isCollapsed()) return !1;
416
+ const e = n.anchor.offset, r = t.getParentOrThrow(), i = t.isToken();
417
+ return e === 0 ? !t.canInsertTextBefore() || !r.canInsertTextBefore() && !t.isComposing() || i || function(s) {
418
+ const o = s.getPreviousSibling();
419
+ return (E(o) || S(o) && o.isInline()) && !o.canInsertTextAfter();
420
+ }(t) : e === t.getTextContentSize() && (!t.canInsertTextAfter() || !r.canInsertTextAfter() && !t.isComposing() || i);
421
+ }
422
+ function cr(n) {
423
+ return n === "ArrowLeft";
424
+ }
425
+ function ur(n) {
426
+ return n === "ArrowRight";
427
+ }
428
+ function Ut(n, t) {
429
+ return Z ? n : t;
430
+ }
431
+ function fr(n) {
432
+ return n === "Enter";
433
+ }
434
+ function Rt(n) {
435
+ return n === "Backspace";
436
+ }
437
+ function Kt(n) {
438
+ return n === "Delete";
439
+ }
440
+ function dr(n, t, e) {
441
+ return n.toLowerCase() === "a" && Ut(t, e);
442
+ }
443
+ function fo() {
444
+ const n = Y();
445
+ ut(Cs(n.select(0, n.getChildrenSize())));
446
+ }
447
+ function Ht(n, t) {
448
+ n.__lexicalClassNameCache === void 0 && (n.__lexicalClassNameCache = {});
449
+ const e = n.__lexicalClassNameCache, r = e[t];
450
+ if (r !== void 0) return r;
451
+ const i = n[t];
452
+ if (typeof i == "string") {
453
+ const s = we(i);
454
+ return e[t] = s, s;
455
+ }
456
+ return i;
457
+ }
458
+ function Jn(n, t, e, r, i) {
459
+ if (e.size === 0) return;
460
+ const s = r.__type, o = r.__key, l = t.get(s);
461
+ l === void 0 && T(33, s);
462
+ const a = l.klass;
463
+ let c = n.get(a);
464
+ c === void 0 && (c = /* @__PURE__ */ new Map(), n.set(a, c));
465
+ const u = c.get(o), d = u === "destroyed" && i === "created";
466
+ (u === void 0 || d) && c.set(o, d ? "updated" : i);
467
+ }
468
+ function hr(n, t, e) {
469
+ const r = n.getParent();
470
+ let i = e, s = n;
471
+ return r !== null && (t && e === 0 ? (i = s.getIndexWithinParent(), s = r) : t || e !== s.getChildrenSize() || (i = s.getIndexWithinParent() + 1, s = r)), s.getChildAtIndex(t ? i - 1 : i);
472
+ }
473
+ function gr(n, t) {
474
+ const e = n.offset;
475
+ if (n.type === "element")
476
+ return hr(n.getNode(), t, e);
477
+ {
478
+ const r = n.getNode();
479
+ if (t && e === 0 || !t && e === r.getTextContentSize()) {
480
+ const i = t ? r.getPreviousSibling() : r.getNextSibling();
481
+ return i === null ? hr(r.getParentOrThrow(), t, r.getIndexWithinParent() + (t ? 0 : 1)) : i;
482
+ }
483
+ }
484
+ return null;
485
+ }
486
+ function ai(n) {
487
+ const t = $e(n).event, e = t && t.inputType;
488
+ return e === "insertFromPaste" || e === "insertFromPasteAsQuotation";
489
+ }
490
+ function w(n, t, e) {
491
+ return Di(n, t, e);
492
+ }
493
+ function Je(n) {
494
+ return !X(n) && !n.isLastChild() && !n.isInline();
495
+ }
496
+ function Fe(n, t) {
497
+ const e = n._keyToDOMMap.get(t);
498
+ return e === void 0 && T(75, t), e;
499
+ }
500
+ function se(n) {
501
+ const t = n.assignedSlot || n.parentElement;
502
+ return t !== null && t.nodeType === 11 ? t.host : t;
503
+ }
504
+ function qt(n, t) {
505
+ let e = n.getParent();
506
+ for (; e !== null; ) {
507
+ if (e.is(t)) return !0;
508
+ e = e.getParent();
509
+ }
510
+ return !1;
511
+ }
512
+ function $e(n) {
513
+ const t = n._window;
514
+ return t === null && T(78), t;
515
+ }
516
+ function Ns(n) {
517
+ let t = n.getParentOrThrow();
518
+ for (; t !== null; ) {
519
+ if (Pt(t)) return t;
520
+ t = t.getParentOrThrow();
521
+ }
522
+ return t;
523
+ }
524
+ function Pt(n) {
525
+ return X(n) || S(n) && n.isShadowRoot();
526
+ }
527
+ function Es(n) {
528
+ const t = n.constructor.clone(n);
529
+ return ei(t, null), t;
530
+ }
531
+ function Ue(n) {
532
+ const t = A(), e = n.constructor.getType(), r = t._nodes.get(e);
533
+ r === void 0 && T(200, n.constructor.name, e);
534
+ const { replace: i, replaceWithKlass: s } = r;
535
+ if (i !== null) {
536
+ const o = i(n), l = o.constructor;
537
+ return s !== null ? o instanceof s || T(201, s.name, s.getType(), l.name, l.getType(), n.constructor.name, e) : o instanceof n.constructor && l !== n.constructor || T(202, l.name, l.getType(), n.constructor.name, e), o.__key === n.__key && T(203, n.constructor.name, e, l.name, l.getType()), o;
538
+ }
539
+ return n;
540
+ }
541
+ function rn(n, t) {
542
+ !X(n.getParent()) || S(t) || I(t) || T(99);
543
+ }
544
+ function sn(n) {
545
+ return (I(n) || S(n) && !n.canBeEmpty()) && !n.isInline();
546
+ }
547
+ function $n(n, t, e) {
548
+ e.style.removeProperty("caret-color"), t._blockCursorElement = null;
549
+ const r = n.parentElement;
550
+ r !== null && r.removeChild(n);
551
+ }
552
+ function Ps(n, t, e) {
553
+ let r = n._blockCursorElement;
554
+ if (F(e) && e.isCollapsed() && e.anchor.type === "element" && t.contains(document.activeElement)) {
555
+ const i = e.anchor, s = i.getNode(), o = i.offset;
556
+ let l = !1, a = null;
557
+ if (o === s.getChildrenSize())
558
+ sn(s.getChildAtIndex(o - 1)) && (l = !0);
559
+ else {
560
+ const c = s.getChildAtIndex(o);
561
+ if (c !== null && sn(c)) {
562
+ const u = c.getPreviousSibling();
563
+ (u === null || sn(u)) && (l = !0, a = n.getElementByKey(c.__key));
564
+ }
565
+ }
566
+ if (l) {
567
+ const c = n.getElementByKey(s.__key);
568
+ return r === null && (n._blockCursorElement = r = function(u) {
569
+ const d = u.theme, f = document.createElement("div");
570
+ f.contentEditable = "false", f.setAttribute("data-lexical-cursor", "true");
571
+ let h = d.blockCursor;
572
+ if (h !== void 0) {
573
+ if (typeof h == "string") {
574
+ const g = we(h);
575
+ h = d.blockCursor = g;
576
+ }
577
+ h !== void 0 && f.classList.add(...h);
578
+ }
579
+ return f;
580
+ }(n._config)), t.style.caretColor = "transparent", void (a === null ? c.appendChild(r) : c.insertBefore(r, a));
581
+ }
582
+ }
583
+ r !== null && $n(r, n, t);
584
+ }
585
+ function it(n) {
586
+ return nt ? (n || window).getSelection() : null;
587
+ }
588
+ function ho(n, t) {
589
+ let e = n.getChildAtIndex(t);
590
+ e == null && (e = n), Pt(n) && T(102);
591
+ const r = (o) => {
592
+ const l = o.getParentOrThrow(), a = Pt(l), c = o !== e || a ? Es(o) : o;
593
+ if (a) return S(o) && S(c) || T(133), o.insertAfter(c), [o, c, c];
594
+ {
595
+ const [u, d, f] = r(l), h = o.getNextSiblings();
596
+ return f.append(c, ...h), [u, d, c];
597
+ }
598
+ }, [i, s] = r(e);
599
+ return [i, s];
600
+ }
601
+ function go(n) {
602
+ return Ve(n) && n.tagName === "A";
603
+ }
604
+ function Ve(n) {
605
+ return n.nodeType === 1;
606
+ }
607
+ function _o(n) {
608
+ return n.nodeType === 11;
609
+ }
610
+ function Fs(n) {
611
+ const t = new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/, "i");
612
+ return n.nodeName.match(t) !== null;
613
+ }
614
+ function _r(n) {
615
+ const t = new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/, "i");
616
+ return n.nodeName.match(t) !== null;
617
+ }
618
+ function _t(n) {
619
+ if (I(n) && !n.isInline()) return !0;
620
+ if (!S(n) || Pt(n)) return !1;
621
+ const t = n.getFirstChild(), e = t === null || It(t) || E(t) || t.isInline();
622
+ return !n.isInline() && n.canBeEmpty() !== !1 && e;
623
+ }
624
+ function Jt(n, t) {
625
+ let e = n;
626
+ for (; e !== null && e.getParent() !== null && !t(e); ) e = e.getParentOrThrow();
627
+ return t(e) ? e : null;
628
+ }
629
+ function po() {
630
+ return A();
631
+ }
632
+ const pr = /* @__PURE__ */ new WeakMap(), Ds = /* @__PURE__ */ new Map();
633
+ function Ls(n) {
634
+ if (!n._readOnly && n.isEmpty()) return Ds;
635
+ n._readOnly || T(192);
636
+ let t = pr.get(n);
637
+ if (!t) {
638
+ t = /* @__PURE__ */ new Map(), pr.set(n, t);
639
+ for (const [e, r] of n._nodeMap) {
640
+ const i = r.__type;
641
+ let s = t.get(i);
642
+ s || (s = /* @__PURE__ */ new Map(), t.set(i, s)), s.set(e, r);
643
+ }
644
+ }
645
+ return t;
646
+ }
647
+ function Os(n) {
648
+ const t = n.constructor.clone(n);
649
+ return t.afterCloneFrom(n), t;
650
+ }
651
+ function Ms(n, t) {
652
+ const e = (parseInt(n.style.paddingInlineStart, 10) || 0) / 40;
653
+ t.setIndent(e);
654
+ }
655
+ function yo(n) {
656
+ n.__lexicalUnmanaged = !0;
657
+ }
658
+ function Is(n) {
659
+ return n.__lexicalUnmanaged === !0;
660
+ }
661
+ function ci(n, t, e, r, i, s) {
662
+ let o = n.getFirstChild();
663
+ for (; o !== null; ) {
664
+ const l = o.__key;
665
+ o.__parent === t && (S(o) && ci(o, l, e, r, i, s), e.has(l) || s.delete(l), i.push(l)), o = o.getNextSibling();
666
+ }
667
+ }
668
+ let St, H, Zt, je, _n, pn, Ft, et, yn, te, W = "", j = "", rt = null, tt = "", lt = "", ui = !1, ee = !1, me = null;
669
+ function De(n, t) {
670
+ const e = Ft.get(n);
671
+ if (t !== null) {
672
+ const r = vn(n);
673
+ r.parentNode === t && t.removeChild(r);
674
+ }
675
+ if (et.has(n) || H._keyToDOMMap.delete(n), S(e)) {
676
+ const r = Oe(e, Ft);
677
+ mn(r, 0, r.length - 1, null);
678
+ }
679
+ e !== void 0 && Jn(te, Zt, je, e, "destroyed");
680
+ }
681
+ function mn(n, t, e, r) {
682
+ let i = t;
683
+ for (; i <= e; ++i) {
684
+ const s = n[i];
685
+ s !== void 0 && De(s, r);
686
+ }
687
+ }
688
+ function kt(n, t) {
689
+ n.setProperty("text-align", t);
690
+ }
691
+ const As = "40px";
692
+ function fi(n, t) {
693
+ const e = St.theme.indent;
694
+ if (typeof e == "string") {
695
+ const i = n.classList.contains(e);
696
+ t > 0 && !i ? n.classList.add(e) : t < 1 && i && n.classList.remove(e);
697
+ }
698
+ const r = getComputedStyle(n).getPropertyValue("--lexical-indent-base-value") || As;
699
+ n.style.setProperty("padding-inline-start", t === 0 ? "" : `calc(${t} * ${r})`);
700
+ }
701
+ function di(n, t) {
702
+ const e = n.style;
703
+ t === 0 ? kt(e, "") : t === Fn ? kt(e, "left") : t === Dn ? kt(e, "center") : t === Ln ? kt(e, "right") : t === On ? kt(e, "justify") : t === Mn ? kt(e, "start") : t === In && kt(e, "end");
704
+ }
705
+ function Le(n, t) {
706
+ const e = et.get(n);
707
+ e === void 0 && T(60);
708
+ const r = e.createDOM(St, H);
709
+ if (function(i, s, o) {
710
+ const l = o._keyToDOMMap;
711
+ (function(a, c, u) {
712
+ a[`__lexicalKey_${c._key}`] = u;
713
+ })(s, o, i), l.set(i, s);
714
+ }(n, r, H), E(e) ? r.setAttribute("data-lexical-text", "true") : I(e) && r.setAttribute("data-lexical-decorator", "true"), S(e)) {
715
+ const i = e.__indent, s = e.__size;
716
+ if (i !== 0 && fi(r, i), s !== 0) {
717
+ const l = s - 1;
718
+ (function(a, c, u, d) {
719
+ const f = j;
720
+ j = "", xn(a, u, 0, c, u.getDOMSlot(d)), gi(u, d), j = f;
721
+ })(Oe(e, et), l, e, r);
722
+ }
723
+ const o = e.__format;
724
+ o !== 0 && di(r, o), e.isInline() || hi(null, e, r), Je(e) && (W += ct, lt += ct);
725
+ } else {
726
+ const i = e.getTextContent();
727
+ if (I(e)) {
728
+ const s = e.decorate(H, St);
729
+ s !== null && _i(n, s), r.contentEditable = "false";
730
+ } else E(e) && (e.isDirectionless() || (j += i));
731
+ W += i, lt += i;
732
+ }
733
+ return t !== null && t.insertChild(r), Jn(te, Zt, je, e, "created"), r;
734
+ }
735
+ function xn(n, t, e, r, i) {
736
+ const s = W;
737
+ W = "";
738
+ let o = e;
739
+ for (; o <= r; ++o) {
740
+ Le(n[o], i);
741
+ const l = et.get(n[o]);
742
+ l !== null && E(l) && (rt === null && (rt = l.getFormat()), tt === "" && (tt = l.getStyle()));
743
+ }
744
+ Je(t) && (W += ct), i.element.__lexicalTextContent = W, W = s + W;
745
+ }
746
+ function yr(n, t) {
747
+ if (n) {
748
+ const e = n.__last;
749
+ if (e) {
750
+ const r = t.get(e);
751
+ if (r) return It(r) ? "line-break" : I(r) && r.isInline() ? "decorator" : null;
752
+ }
753
+ return "empty";
754
+ }
755
+ return null;
756
+ }
757
+ function hi(n, t, e) {
758
+ const r = yr(n, Ft), i = yr(t, et);
759
+ r !== i && t.getDOMSlot(e).setManagedLineBreak(i);
760
+ }
761
+ function gi(n, t) {
762
+ const e = t.__lexicalDirTextContent || "", r = t.__lexicalDir || "";
763
+ if (e !== j || r !== me) {
764
+ const s = j === "", o = s ? me : (i = j, us.test(i) ? "rtl" : fs.test(i) ? "ltr" : null);
765
+ if (o !== r) {
766
+ const l = t.classList, a = St.theme;
767
+ let c = r !== null ? a[r] : void 0, u = o !== null ? a[o] : void 0;
768
+ if (c !== void 0) {
769
+ if (typeof c == "string") {
770
+ const d = we(c);
771
+ c = a[r] = d;
772
+ }
773
+ l.remove(...c);
774
+ }
775
+ if (o === null || s && o === "ltr") t.removeAttribute("dir");
776
+ else {
777
+ if (u !== void 0) {
778
+ if (typeof u == "string") {
779
+ const d = we(u);
780
+ u = a[o] = d;
781
+ }
782
+ u !== void 0 && l.add(...u);
783
+ }
784
+ t.dir = o;
785
+ }
786
+ ee || (n.getWritable().__dir = o);
787
+ }
788
+ me = o, t.__lexicalDirTextContent = j, t.__lexicalDir = o;
789
+ }
790
+ var i;
791
+ }
792
+ function Bs(n, t, e) {
793
+ const r = j;
794
+ var i;
795
+ j = "", rt = null, tt = "", function(s, o, l) {
796
+ const a = W, c = s.__size, u = o.__size;
797
+ W = "";
798
+ const d = l.element;
799
+ if (c === 1 && u === 1) {
800
+ const f = s.__first, h = o.__first;
801
+ if (f === h) Vt(f, d);
802
+ else {
803
+ const _ = vn(f), p = Le(h, null);
804
+ try {
805
+ d.replaceChild(p, _);
806
+ } catch (m) {
807
+ if (typeof m == "object" && m != null) {
808
+ const y = `${m.toString()} Parent: ${d.tagName}, new child: {tag: ${p.tagName} key: ${h}}, old child: {tag: ${_.tagName}, key: ${f}}.`;
809
+ throw new Error(y);
810
+ }
811
+ throw m;
812
+ }
813
+ De(f, null);
814
+ }
815
+ const g = et.get(h);
816
+ E(g) && (rt === null && (rt = g.getFormat()), tt === "" && (tt = g.getStyle()));
817
+ } else {
818
+ const f = Oe(s, Ft), h = Oe(o, et);
819
+ if (f.length !== c && T(227), h.length !== u && T(228), c === 0) u !== 0 && xn(h, o, 0, u - 1, l);
820
+ else if (u === 0) {
821
+ if (c !== 0) {
822
+ const g = l.after == null && l.before == null && l.element.__lexicalLineBreak == null;
823
+ mn(f, 0, c - 1, g ? null : d), g && (d.textContent = "");
824
+ }
825
+ } else (function(g, _, p, m, y, x) {
826
+ const b = m - 1, k = y - 1;
827
+ let v, P, C = x.getFirstChild(), N = 0, D = 0;
828
+ for (; N <= b && D <= k; ) {
829
+ const L = _[N], R = p[D];
830
+ if (L === R) C = on(Vt(R, x.element)), N++, D++;
831
+ else {
832
+ v === void 0 && (v = new Set(_)), P === void 0 && (P = new Set(p));
833
+ const dt = P.has(L), Dt = v.has(R);
834
+ if (dt) if (Dt) {
835
+ const fe = Fe(H, R);
836
+ fe === C ? C = on(Vt(R, x.element)) : (x.withBefore(C).insertChild(fe), Vt(R, x.element)), N++, D++;
837
+ } else Le(R, x.withBefore(C)), D++;
838
+ else C = on(vn(L)), De(L, x.element), N++;
839
+ }
840
+ const z = et.get(R);
841
+ z !== null && E(z) && (rt === null && (rt = z.getFormat()), tt === "" && (tt = z.getStyle()));
842
+ }
843
+ const O = N > b, B = D > k;
844
+ if (O && !B) {
845
+ const L = p[k + 1], R = L === void 0 ? null : H.getElementByKey(L);
846
+ xn(p, g, D, k, x.withBefore(R));
847
+ } else B && !O && mn(_, N, b, x.element);
848
+ })(o, f, h, c, u, l);
849
+ }
850
+ Je(o) && (W += ct), d.__lexicalTextContent = W, W = a + W;
851
+ }(n, t, t.getDOMSlot(e)), gi(t, e), wn(i = t) && rt != null && rt !== i.__textFormat && !ee && (i.setTextFormat(rt), i.setTextStyle(tt)), function(s) {
852
+ wn(s) && tt !== "" && tt !== s.__textStyle && !ee && s.setTextStyle(tt);
853
+ }(t), j = r;
854
+ }
855
+ function Oe(n, t) {
856
+ const e = [];
857
+ let r = n.__first;
858
+ for (; r !== null; ) {
859
+ const i = t.get(r);
860
+ i === void 0 && T(101), e.push(r), r = i.__next;
861
+ }
862
+ return e;
863
+ }
864
+ function Vt(n, t) {
865
+ const e = Ft.get(n);
866
+ let r = et.get(n);
867
+ e !== void 0 && r !== void 0 || T(61);
868
+ const i = ui || pn.has(n) || _n.has(n), s = Fe(H, n);
869
+ if (e === r && !i) {
870
+ if (S(e)) {
871
+ const o = s.__lexicalTextContent;
872
+ o !== void 0 && (W += o, lt += o);
873
+ const l = s.__lexicalDirTextContent;
874
+ l !== void 0 && (j += l);
875
+ } else {
876
+ const o = e.getTextContent();
877
+ E(e) && !e.isDirectionless() && (j += o), lt += o, W += o;
878
+ }
879
+ return s;
880
+ }
881
+ if (e !== r && i && Jn(te, Zt, je, r, "updated"), r.updateDOM(e, s, St)) {
882
+ const o = Le(n, null);
883
+ return t === null && T(62), t.replaceChild(o, s), De(n, null), o;
884
+ }
885
+ if (S(e) && S(r)) {
886
+ const o = r.__indent;
887
+ o !== e.__indent && fi(s, o);
888
+ const l = r.__format;
889
+ l !== e.__format && di(s, l), i && (Bs(e, r, s), X(r) || r.isInline() || hi(e, r, s)), Je(r) && (W += ct, lt += ct);
890
+ } else {
891
+ const o = r.getTextContent();
892
+ if (I(r)) {
893
+ const l = r.decorate(H, St);
894
+ l !== null && _i(n, l);
895
+ } else E(r) && !r.isDirectionless() && (j += o);
896
+ W += o, lt += o;
897
+ }
898
+ if (!ee && X(r) && r.__cachedText !== lt) {
899
+ const o = r.getWritable();
900
+ o.__cachedText = lt, r = o;
901
+ }
902
+ return s;
903
+ }
904
+ function _i(n, t) {
905
+ let e = H._pendingDecorators;
906
+ const r = H._decorators;
907
+ if (e === null) {
908
+ if (r[n] === t) return;
909
+ e = ri(H);
910
+ }
911
+ e[n] = t;
912
+ }
913
+ function on(n) {
914
+ let t = n.nextSibling;
915
+ return t !== null && t === H._blockCursorElement && (t = t.nextSibling), t;
916
+ }
917
+ function zs(n, t, e, r, i, s) {
918
+ W = "", lt = "", j = "", ui = r === At, me = null, H = e, St = e._config, Zt = e._nodes, je = H._listeners.mutation, _n = i, pn = s, Ft = n._nodeMap, et = t._nodeMap, ee = t._readOnly, yn = new Map(e._keyToDOMMap);
919
+ const o = /* @__PURE__ */ new Map();
920
+ return te = o, Vt("root", null), H = void 0, Zt = void 0, _n = void 0, pn = void 0, Ft = void 0, et = void 0, St = void 0, yn = void 0, te = void 0, o;
921
+ }
922
+ function vn(n) {
923
+ const t = yn.get(n);
924
+ return t === void 0 && T(75, n), t;
925
+ }
926
+ const ot = Object.freeze({}), Sn = 30, Cn = [["keydown", function(n, t) {
927
+ if (Gt = n.timeStamp, pi = n.key, t.isComposing()) return;
928
+ const { key: e, shiftKey: r, ctrlKey: i, metaKey: s, altKey: o } = n;
929
+ if (!w(t, Bi, n) && e != null) {
930
+ if (function(l, a, c, u) {
931
+ return ur(l) && !a && !u && !c;
932
+ }(e, i, o, s)) w(t, zi, n);
933
+ else if (function(l, a, c, u, d) {
934
+ return ur(l) && !u && !c && (a || d);
935
+ }(e, i, r, o, s)) w(t, Wi, n);
936
+ else if (function(l, a, c, u) {
937
+ return cr(l) && !a && !u && !c;
938
+ }(e, i, o, s)) w(t, Ri, n);
939
+ else if (function(l, a, c, u, d) {
940
+ return cr(l) && !u && !c && (a || d);
941
+ }(e, i, r, o, s)) w(t, Ki, n);
942
+ else if (/* @__PURE__ */ function(l, a, c) {
943
+ return /* @__PURE__ */ function(u) {
944
+ return u === "ArrowUp";
945
+ }(l) && !a && !c;
946
+ }(e, i, s)) w(t, Ji, n);
947
+ else if (/* @__PURE__ */ function(l, a, c) {
948
+ return /* @__PURE__ */ function(u) {
949
+ return u === "ArrowDown";
950
+ }(l) && !a && !c;
951
+ }(e, i, s)) w(t, $i, n);
952
+ else if (function(l, a) {
953
+ return fr(l) && a;
954
+ }(e, r)) Qt = !0, w(t, hn, n);
955
+ else if (/* @__PURE__ */ function(l) {
956
+ return l === " ";
957
+ }(e)) w(t, Ui, n);
958
+ else if (function(l, a) {
959
+ return Z && a && l.toLowerCase() === "o";
960
+ }(e, i)) n.preventDefault(), Qt = !0, w(t, ye, !0);
961
+ else if (function(l, a) {
962
+ return fr(l) && !a;
963
+ }(e, r)) Qt = !1, w(t, hn, n);
964
+ else if (function(l, a, c, u) {
965
+ return Z ? !a && !c && (Rt(l) || l.toLowerCase() === "h" && u) : !(u || a || c) && Rt(l);
966
+ }(e, o, s, i)) Rt(e) ? w(t, Vi, n) : (n.preventDefault(), w(t, ve, !0));
967
+ else if (/* @__PURE__ */ function(l) {
968
+ return l === "Escape";
969
+ }(e)) w(t, ji, n);
970
+ else if (function(l, a, c, u, d) {
971
+ return Z ? !(c || u || d) && (Kt(l) || l.toLowerCase() === "d" && a) : !(a || u || d) && Kt(l);
972
+ }(e, i, r, o, s)) Kt(e) ? w(t, Hi, n) : (n.preventDefault(), w(t, ve, !1));
973
+ else if (function(l, a, c) {
974
+ return Rt(l) && (Z ? a : c);
975
+ }(e, o, i)) n.preventDefault(), w(t, Se, !0);
976
+ else if (function(l, a, c) {
977
+ return Kt(l) && (Z ? a : c);
978
+ }(e, o, i)) n.preventDefault(), w(t, Se, !1);
979
+ else if (function(l, a) {
980
+ return Z && a && Rt(l);
981
+ }(e, s)) n.preventDefault(), w(t, Ce, !0);
982
+ else if (function(l, a) {
983
+ return Z && a && Kt(l);
984
+ }(e, s)) n.preventDefault(), w(t, Ce, !1);
985
+ else if (function(l, a, c, u) {
986
+ return l.toLowerCase() === "b" && !a && Ut(c, u);
987
+ }(e, o, s, i)) n.preventDefault(), w(t, wt, "bold");
988
+ else if (function(l, a, c, u) {
989
+ return l.toLowerCase() === "u" && !a && Ut(c, u);
990
+ }(e, o, s, i)) n.preventDefault(), w(t, wt, "underline");
991
+ else if (function(l, a, c, u) {
992
+ return l.toLowerCase() === "i" && !a && Ut(c, u);
993
+ }(e, o, s, i)) n.preventDefault(), w(t, wt, "italic");
994
+ else if (/* @__PURE__ */ function(l, a, c, u) {
995
+ return l === "Tab" && !a && !c && !u;
996
+ }(e, o, i, s)) w(t, qi, n);
997
+ else if (function(l, a, c, u) {
998
+ return l.toLowerCase() === "z" && !a && Ut(c, u);
999
+ }(e, r, s, i)) n.preventDefault(), w(t, Jr, void 0);
1000
+ else if (function(l, a, c, u) {
1001
+ return Z ? l.toLowerCase() === "z" && c && a : l.toLowerCase() === "y" && u || l.toLowerCase() === "z" && u && a;
1002
+ }(e, r, s, i)) n.preventDefault(), w(t, $r, void 0);
1003
+ else {
1004
+ const l = t._editorState._selection;
1005
+ l === null || F(l) ? !xt && dr(e, s, i) && (n.preventDefault(), w(t, er, n)) : function(a, c, u, d) {
1006
+ return !c && a.toLowerCase() === "c" && (Z ? u : d);
1007
+ }(e, r, s, i) ? (n.preventDefault(), w(t, Ur, n)) : function(a, c, u, d) {
1008
+ return !c && a.toLowerCase() === "x" && (Z ? u : d);
1009
+ }(e, r, s, i) ? (n.preventDefault(), w(t, Vr, n)) : dr(e, s, i) && (n.preventDefault(), w(t, er, n));
1010
+ }
1011
+ /* @__PURE__ */ (function(l, a, c, u) {
1012
+ return l || a || c || u;
1013
+ })(i, r, o, s) && w(t, es, n);
1014
+ }
1015
+ }], ["pointerdown", function(n, t) {
1016
+ const e = n.target, r = n.pointerType;
1017
+ e instanceof Node && r !== "touch" && Q(t, () => {
1018
+ I(zn(e)) || (kn = !0);
1019
+ });
1020
+ }], ["compositionstart", function(n, t) {
1021
+ Q(t, () => {
1022
+ const e = M();
1023
+ if (F(e) && !t.isComposing()) {
1024
+ const r = e.anchor, i = e.anchor.getNode();
1025
+ U(r.key), (n.timeStamp < Gt + Sn || r.type === "element" || !e.isCollapsed() || i.getFormat() !== e.format || E(i) && i.getStyle() !== e.style) && w(t, jt, cs);
1026
+ }
1027
+ });
1028
+ }], ["compositionend", function(n, t) {
1029
+ xt ? $t = !0 : Q(t, () => {
1030
+ ln(t, n.data);
1031
+ });
1032
+ }], ["input", function(n, t) {
1033
+ n.stopPropagation(), Q(t, () => {
1034
+ const e = M(), r = n.data, i = vi(n);
1035
+ if (r != null && F(e) && xi(e, i, r, n.timeStamp, !1)) {
1036
+ $t && (ln(t, r), $t = !1);
1037
+ const s = e.anchor.getNode(), o = it(t._window);
1038
+ if (o === null) return;
1039
+ const l = e.isBackward(), a = l ? e.anchor.offset : e.focus.offset, c = l ? e.focus.offset : e.anchor.offset;
1040
+ Te && !e.isCollapsed() && E(s) && o.anchorNode !== null && s.getTextContent().slice(0, a) + r + s.getTextContent().slice(a + c) === li(o.anchorNode) || w(t, jt, r);
1041
+ const u = r.length;
1042
+ xt && u > 1 && n.inputType === "insertCompositionText" && !t.isComposing() && (e.anchor.offset -= u), Be || re || En || !t.isComposing() || (Gt = 0, U(null));
1043
+ } else
1044
+ Rn(!1, t, r !== null ? r : void 0), $t && (ln(t, r || void 0), $t = !1);
1045
+ q(), Xr(A());
1046
+ }), Lt = null;
1047
+ }], ["click", function(n, t) {
1048
+ Q(t, () => {
1049
+ const e = M(), r = it(t._window), i = ae();
1050
+ if (r) {
1051
+ if (F(e)) {
1052
+ const s = e.anchor, o = s.getNode();
1053
+ s.type === "element" && s.offset === 0 && e.isCollapsed() && !X(o) && Y().getChildrenSize() === 1 && o.getTopLevelElementOrThrow().isEmpty() && i !== null && e.is(i) ? (r.removeAllRanges(), e.dirty = !0) : n.detail === 3 && !e.isCollapsed() && o !== e.focus.getNode() && (S(o) ? o.select(0) : o.getParentOrThrow().select(0));
1054
+ } else if (n.pointerType === "touch") {
1055
+ const s = r.anchorNode;
1056
+ if (s !== null) {
1057
+ const o = s.nodeType;
1058
+ (o === ie || o === Ct) && ut(Ge(i, r, t, n));
1059
+ }
1060
+ }
1061
+ }
1062
+ w(t, Ai, n);
1063
+ });
1064
+ }], ["cut", ot], ["copy", ot], ["dragstart", ot], ["dragover", ot], ["dragend", ot], ["paste", ot], ["focus", ot], ["blur", ot], ["drop", ot]];
1065
+ Te && Cn.push(["beforeinput", (n, t) => function(e, r) {
1066
+ const i = e.inputType, s = vi(e);
1067
+ i === "deleteCompositionText" || xt && ai(r) || i !== "insertCompositionText" && Q(r, () => {
1068
+ const o = M();
1069
+ if (i === "deleteContentBackward") {
1070
+ if (o === null) {
1071
+ const h = ae();
1072
+ if (!F(h)) return;
1073
+ ut(h.clone());
1074
+ }
1075
+ if (F(o)) {
1076
+ const h = o.anchor.key === o.focus.key;
1077
+ if (l = e.timeStamp, pi === "MediaLast" && l < Gt + Sn && r.isComposing() && h) {
1078
+ if (U(null), Gt = 0, setTimeout(() => {
1079
+ Q(r, () => {
1080
+ U(null);
1081
+ });
1082
+ }, Sn), F(o)) {
1083
+ const g = o.anchor.getNode();
1084
+ g.markDirty(), o.format = g.getFormat(), E(g) || T(142), o.style = g.getStyle();
1085
+ }
1086
+ } else {
1087
+ U(null), e.preventDefault();
1088
+ const g = o.anchor.getNode(), _ = g.getTextContent(), p = g.canInsertTextAfter(), m = o.anchor.offset === 0 && o.focus.offset === _.length;
1089
+ is && h && !m && p || w(r, ve, !0);
1090
+ }
1091
+ return;
1092
+ }
1093
+ }
1094
+ var l;
1095
+ if (!F(o)) return;
1096
+ const a = e.data;
1097
+ Lt !== null && Rn(!1, r, Lt), o.dirty && Lt === null || !o.isCollapsed() || X(o.anchor.getNode()) || s === null || o.applyDOMRange(s), Lt = null;
1098
+ const c = o.anchor, u = o.focus, d = c.getNode(), f = u.getNode();
1099
+ if (i !== "insertText" && i !== "insertTranspose") switch (e.preventDefault(), i) {
1100
+ case "insertFromYank":
1101
+ case "insertFromDrop":
1102
+ case "insertReplacementText":
1103
+ w(r, jt, e);
1104
+ break;
1105
+ case "insertFromComposition":
1106
+ U(null), w(r, jt, e);
1107
+ break;
1108
+ case "insertLineBreak":
1109
+ U(null), w(r, ye, !1);
1110
+ break;
1111
+ case "insertParagraph":
1112
+ U(null), Qt && !re ? (Qt = !1, w(r, ye, !1)) : w(r, Zn, void 0);
1113
+ break;
1114
+ case "insertFromPaste":
1115
+ case "insertFromPasteAsQuotation":
1116
+ w(r, Kr, e);
1117
+ break;
1118
+ case "deleteByComposition":
1119
+ (function(h, g) {
1120
+ return h !== g || S(h) || S(g) || !h.isToken() || !g.isToken();
1121
+ })(d, f) && w(r, tr, e);
1122
+ break;
1123
+ case "deleteByDrag":
1124
+ case "deleteByCut":
1125
+ w(r, tr, e);
1126
+ break;
1127
+ case "deleteContent":
1128
+ w(r, ve, !1);
1129
+ break;
1130
+ case "deleteWordBackward":
1131
+ w(r, Se, !0);
1132
+ break;
1133
+ case "deleteWordForward":
1134
+ w(r, Se, !1);
1135
+ break;
1136
+ case "deleteHardLineBackward":
1137
+ case "deleteSoftLineBackward":
1138
+ w(r, Ce, !0);
1139
+ break;
1140
+ case "deleteContentForward":
1141
+ case "deleteHardLineForward":
1142
+ case "deleteSoftLineForward":
1143
+ w(r, Ce, !1);
1144
+ break;
1145
+ case "formatStrikeThrough":
1146
+ w(r, wt, "strikethrough");
1147
+ break;
1148
+ case "formatBold":
1149
+ w(r, wt, "bold");
1150
+ break;
1151
+ case "formatItalic":
1152
+ w(r, wt, "italic");
1153
+ break;
1154
+ case "formatUnderline":
1155
+ w(r, wt, "underline");
1156
+ break;
1157
+ case "historyUndo":
1158
+ w(r, Jr, void 0);
1159
+ break;
1160
+ case "historyRedo":
1161
+ w(r, $r, void 0);
1162
+ }
1163
+ else {
1164
+ if (a === `
1165
+ `) e.preventDefault(), w(r, ye, !1);
1166
+ else if (a === ct) e.preventDefault(), w(r, Zn, void 0);
1167
+ else if (a == null && e.dataTransfer) {
1168
+ const h = e.dataTransfer.getData("text/plain");
1169
+ e.preventDefault(), o.insertRawText(h);
1170
+ } else a != null && xi(o, s, a, e.timeStamp, !0) ? (e.preventDefault(), w(r, jt, a)) : Lt = a;
1171
+ yi = e.timeStamp;
1172
+ }
1173
+ });
1174
+ }(n, t)]);
1175
+ let Gt = 0, pi = null, yi = 0, Lt = null;
1176
+ const Me = /* @__PURE__ */ new WeakMap();
1177
+ let Tn = !1, kn = !1, Qt = !1, $t = !1, mi = [0, "", 0, "root", 0];
1178
+ function xi(n, t, e, r, i) {
1179
+ const s = n.anchor, o = n.focus, l = s.getNode(), a = A(), c = it(a._window), u = c !== null ? c.anchorNode : null, d = s.key, f = a.getElementByKey(d), h = e.length;
1180
+ return d !== o.key || !E(l) || (!i && (!Te || yi < r + 50) || l.isDirty() && h < 2 || si(e)) && s.offset !== o.offset && !l.isComposing() || bt(l) || l.isDirty() && h > 1 || (i || !Te) && f !== null && !l.isComposing() && u !== Ne(f) || c !== null && t !== null && (!t.collapsed || t.startContainer !== c.anchorNode || t.startOffset !== c.anchorOffset) || l.getFormat() !== n.format || l.getStyle() !== n.style || ws(n, l);
1181
+ }
1182
+ function mr(n, t) {
1183
+ return n !== null && n.nodeValue !== null && n.nodeType === Ct && t !== 0 && t !== n.nodeValue.length;
1184
+ }
1185
+ function xr(n, t, e) {
1186
+ const { anchorNode: r, anchorOffset: i, focusNode: s, focusOffset: o } = n;
1187
+ Tn && (Tn = !1, mr(r, i) && mr(s, o)) || Q(t, () => {
1188
+ if (!e) return void ut(null);
1189
+ if (!We(t, r, s)) return;
1190
+ const l = M();
1191
+ if (F(l)) {
1192
+ const a = l.anchor, c = a.getNode();
1193
+ if (l.isCollapsed()) {
1194
+ n.type === "Range" && n.anchorNode === n.focusNode && (l.dirty = !0);
1195
+ const u = $e(t).event, d = u ? u.timeStamp : performance.now(), [f, h, g, _, p] = mi, m = Y(), y = t.isComposing() === !1 && m.getTextContent() === "";
1196
+ if (d < p + 200 && a.offset === g && a.key === _) l.format = f, l.style = h;
1197
+ else if (a.type === "text") E(c) || T(141), l.format = c.getFormat(), l.style = c.getStyle();
1198
+ else if (a.type === "element" && !y) {
1199
+ const x = a.getNode();
1200
+ l.style = "", x instanceof zt && x.getChildrenSize() === 0 ? (l.format = x.getTextFormat(), l.style = x.getTextStyle()) : l.format = 0;
1201
+ }
1202
+ } else {
1203
+ const u = a.key, d = l.focus.key, f = l.getNodes(), h = f.length, g = l.isBackward(), _ = g ? o : i, p = g ? i : o, m = g ? d : u, y = g ? u : d;
1204
+ let x = as, b = !1;
1205
+ for (let k = 0; k < h; k++) {
1206
+ const v = f[k], P = v.getTextContentSize();
1207
+ if (E(v) && P !== 0 && !(k === 0 && v.__key === m && _ === P || k === h - 1 && v.__key === y && p === 0) && (b = !0, x &= v.getFormat(), x === 0)) break;
1208
+ }
1209
+ l.format = b ? x : 0;
1210
+ }
1211
+ }
1212
+ w(t, Nn, void 0);
1213
+ });
1214
+ }
1215
+ function vi(n) {
1216
+ if (!n.getTargetRanges) return null;
1217
+ const t = n.getTargetRanges();
1218
+ return t.length === 0 ? null : t[0];
1219
+ }
1220
+ function ln(n, t) {
1221
+ const e = n._compositionKey;
1222
+ if (U(null), e !== null && t != null) {
1223
+ if (t === "") {
1224
+ const r = V(e), i = Ne(n.getElementByKey(e));
1225
+ return void (i !== null && i.nodeValue !== null && E(r) && Kn(r, i.nodeValue, null, null, !0));
1226
+ }
1227
+ if (t[t.length - 1] === `
1228
+ `) {
1229
+ const r = M();
1230
+ if (F(r)) {
1231
+ const i = r.focus;
1232
+ return r.anchor.set(i.key, i.offset, i.type), void w(n, hn, null);
1233
+ }
1234
+ }
1235
+ }
1236
+ Rn(!0, n, t);
1237
+ }
1238
+ function Si(n) {
1239
+ let t = n.__lexicalEventHandles;
1240
+ return t === void 0 && (t = [], n.__lexicalEventHandles = t), t;
1241
+ }
1242
+ const Mt = /* @__PURE__ */ new Map();
1243
+ function Ci(n) {
1244
+ const t = n.target, e = it(t == null ? null : t.nodeType === 9 ? t.defaultView : t.ownerDocument.defaultView);
1245
+ if (e === null) return;
1246
+ const r = ti(e.anchorNode);
1247
+ if (r === null) return;
1248
+ kn && (kn = !1, Q(r, () => {
1249
+ const c = ae(), u = e.anchorNode;
1250
+ if (u === null) return;
1251
+ const d = u.nodeType;
1252
+ d !== ie && d !== Ct || ut(Ge(c, e, r, n));
1253
+ }));
1254
+ const i = Wn(r), s = i[i.length - 1], o = s._key, l = Mt.get(o), a = l || s;
1255
+ a !== r && xr(e, a, !1), xr(e, r, !0), r !== s ? Mt.set(o, r) : l && Mt.delete(o);
1256
+ }
1257
+ function vr(n) {
1258
+ n._lexicalHandled = !0;
1259
+ }
1260
+ function Sr(n) {
1261
+ return n._lexicalHandled === !0;
1262
+ }
1263
+ function Ws(n) {
1264
+ const t = n.ownerDocument, e = Me.get(t);
1265
+ e === void 0 && T(162);
1266
+ const r = e - 1;
1267
+ r >= 0 || T(164), Me.set(t, r), r === 0 && t.removeEventListener("selectionchange", Ci);
1268
+ const i = Re(n);
1269
+ Bn(i) ? (function(o) {
1270
+ if (o._parentEditor !== null) {
1271
+ const l = Wn(o), a = l[l.length - 1]._key;
1272
+ Mt.get(a) === o && Mt.delete(a);
1273
+ } else Mt.delete(o._key);
1274
+ }(i), n.__lexicalEditor = null) : i && T(198);
1275
+ const s = Si(n);
1276
+ for (let o = 0; o < s.length; o++) s[o]();
1277
+ n.__lexicalEventHandles = [];
1278
+ }
1279
+ function bn(n, t, e) {
1280
+ q();
1281
+ const r = n.__key, i = n.getParent();
1282
+ if (i === null) return;
1283
+ const s = function(l) {
1284
+ const a = M();
1285
+ if (!F(a) || !S(l)) return a;
1286
+ const { anchor: c, focus: u } = a, d = c.getNode(), f = u.getNode();
1287
+ return qt(d, l) && c.set(l.__key, 0, "element"), qt(f, l) && u.set(l.__key, 0, "element"), a;
1288
+ }(n);
1289
+ let o = !1;
1290
+ if (F(s) && t) {
1291
+ const l = s.anchor, a = s.focus;
1292
+ l.key === r && (Ae(l, n, i, n.getPreviousSibling(), n.getNextSibling()), o = !0), a.key === r && (Ae(a, n, i, n.getPreviousSibling(), n.getNextSibling()), o = !0);
1293
+ } else jn(s) && t && n.isSelected() && n.selectPrevious();
1294
+ if (F(s) && t && !o) {
1295
+ const l = n.getIndexWithinParent();
1296
+ Nt(n), Ie(s, i, l, -1);
1297
+ } else Nt(n);
1298
+ e || Pt(i) || i.canBeEmpty() || !i.isEmpty() || bn(i, t), t && X(i) && i.isEmpty() && i.selectEnd();
1299
+ }
1300
+ class He {
1301
+ static getType() {
1302
+ T(64, this.name);
1303
+ }
1304
+ static clone(t) {
1305
+ T(65, this.name);
1306
+ }
1307
+ afterCloneFrom(t) {
1308
+ this.__parent = t.__parent, this.__next = t.__next, this.__prev = t.__prev;
1309
+ }
1310
+ constructor(t) {
1311
+ this.__type = this.constructor.getType(), this.__parent = null, this.__prev = null, this.__next = null, ei(this, t);
1312
+ }
1313
+ getType() {
1314
+ return this.__type;
1315
+ }
1316
+ isInline() {
1317
+ T(137, this.constructor.name);
1318
+ }
1319
+ isAttached() {
1320
+ let t = this.__key;
1321
+ for (; t !== null; ) {
1322
+ if (t === "root") return !0;
1323
+ const e = V(t);
1324
+ if (e === null) break;
1325
+ t = e.__parent;
1326
+ }
1327
+ return !1;
1328
+ }
1329
+ isSelected(t) {
1330
+ const e = t || M();
1331
+ if (e == null) return !1;
1332
+ const r = e.getNodes().some((i) => i.__key === this.__key);
1333
+ if (E(this)) return r;
1334
+ if (F(e) && e.anchor.type === "element" && e.focus.type === "element") {
1335
+ if (e.isCollapsed()) return !1;
1336
+ const i = this.getParent();
1337
+ if (I(this) && this.isInline() && i) {
1338
+ const s = e.isBackward() ? e.focus : e.anchor, o = s.getNode();
1339
+ if (s.offset === o.getChildrenSize() && o.is(i) && o.getLastChildOrThrow().is(this)) return !1;
1340
+ }
1341
+ }
1342
+ return r;
1343
+ }
1344
+ getKey() {
1345
+ return this.__key;
1346
+ }
1347
+ getIndexWithinParent() {
1348
+ const t = this.getParent();
1349
+ if (t === null) return -1;
1350
+ let e = t.getFirstChild(), r = 0;
1351
+ for (; e !== null; ) {
1352
+ if (this.is(e)) return r;
1353
+ r++, e = e.getNextSibling();
1354
+ }
1355
+ return -1;
1356
+ }
1357
+ getParent() {
1358
+ const t = this.getLatest().__parent;
1359
+ return t === null ? null : V(t);
1360
+ }
1361
+ getParentOrThrow() {
1362
+ const t = this.getParent();
1363
+ return t === null && T(66, this.__key), t;
1364
+ }
1365
+ getTopLevelElement() {
1366
+ let t = this;
1367
+ for (; t !== null; ) {
1368
+ const e = t.getParent();
1369
+ if (Pt(e)) return S(t) || t === this && I(t) || T(194), t;
1370
+ t = e;
1371
+ }
1372
+ return null;
1373
+ }
1374
+ getTopLevelElementOrThrow() {
1375
+ const t = this.getTopLevelElement();
1376
+ return t === null && T(67, this.__key), t;
1377
+ }
1378
+ getParents() {
1379
+ const t = [];
1380
+ let e = this.getParent();
1381
+ for (; e !== null; ) t.push(e), e = e.getParent();
1382
+ return t;
1383
+ }
1384
+ getParentKeys() {
1385
+ const t = [];
1386
+ let e = this.getParent();
1387
+ for (; e !== null; ) t.push(e.__key), e = e.getParent();
1388
+ return t;
1389
+ }
1390
+ getPreviousSibling() {
1391
+ const t = this.getLatest().__prev;
1392
+ return t === null ? null : V(t);
1393
+ }
1394
+ getPreviousSiblings() {
1395
+ const t = [], e = this.getParent();
1396
+ if (e === null) return t;
1397
+ let r = e.getFirstChild();
1398
+ for (; r !== null && !r.is(this); ) t.push(r), r = r.getNextSibling();
1399
+ return t;
1400
+ }
1401
+ getNextSibling() {
1402
+ const t = this.getLatest().__next;
1403
+ return t === null ? null : V(t);
1404
+ }
1405
+ getNextSiblings() {
1406
+ const t = [];
1407
+ let e = this.getNextSibling();
1408
+ for (; e !== null; ) t.push(e), e = e.getNextSibling();
1409
+ return t;
1410
+ }
1411
+ getCommonAncestor(t) {
1412
+ const e = this.getParents(), r = t.getParents();
1413
+ S(this) && e.unshift(this), S(t) && r.unshift(t);
1414
+ const i = e.length, s = r.length;
1415
+ if (i === 0 || s === 0 || e[i - 1] !== r[s - 1]) return null;
1416
+ const o = new Set(r);
1417
+ for (let l = 0; l < i; l++) {
1418
+ const a = e[l];
1419
+ if (o.has(a)) return a;
1420
+ }
1421
+ return null;
1422
+ }
1423
+ is(t) {
1424
+ return t != null && this.__key === t.__key;
1425
+ }
1426
+ isBefore(t) {
1427
+ if (this === t) return !1;
1428
+ if (t.isParentOf(this)) return !0;
1429
+ if (this.isParentOf(t)) return !1;
1430
+ const e = this.getCommonAncestor(t);
1431
+ let r = 0, i = 0, s = this;
1432
+ for (; ; ) {
1433
+ const o = s.getParentOrThrow();
1434
+ if (o === e) {
1435
+ r = s.getIndexWithinParent();
1436
+ break;
1437
+ }
1438
+ s = o;
1439
+ }
1440
+ for (s = t; ; ) {
1441
+ const o = s.getParentOrThrow();
1442
+ if (o === e) {
1443
+ i = s.getIndexWithinParent();
1444
+ break;
1445
+ }
1446
+ s = o;
1447
+ }
1448
+ return r < i;
1449
+ }
1450
+ isParentOf(t) {
1451
+ const e = this.__key;
1452
+ if (e === t.__key) return !1;
1453
+ let r = t;
1454
+ for (; r !== null; ) {
1455
+ if (r.__key === e) return !0;
1456
+ r = r.getParent();
1457
+ }
1458
+ return !1;
1459
+ }
1460
+ getNodesBetween(t) {
1461
+ const e = this.isBefore(t), r = [], i = /* @__PURE__ */ new Set();
1462
+ let s = this;
1463
+ for (; s !== null; ) {
1464
+ const o = s.__key;
1465
+ if (i.has(o) || (i.add(o), r.push(s)), s === t) break;
1466
+ const l = S(s) ? e ? s.getFirstChild() : s.getLastChild() : null;
1467
+ if (l !== null) {
1468
+ s = l;
1469
+ continue;
1470
+ }
1471
+ const a = e ? s.getNextSibling() : s.getPreviousSibling();
1472
+ if (a !== null) {
1473
+ s = a;
1474
+ continue;
1475
+ }
1476
+ const c = s.getParentOrThrow();
1477
+ if (i.has(c.__key) || r.push(c), c === t) break;
1478
+ let u = null, d = c;
1479
+ do {
1480
+ if (d === null && T(68), u = e ? d.getNextSibling() : d.getPreviousSibling(), d = d.getParent(), d === null) break;
1481
+ u !== null || i.has(d.__key) || r.push(d);
1482
+ } while (u === null);
1483
+ s = u;
1484
+ }
1485
+ return e || r.reverse(), r;
1486
+ }
1487
+ isDirty() {
1488
+ const t = A()._dirtyLeaves;
1489
+ return t !== null && t.has(this.__key);
1490
+ }
1491
+ getLatest() {
1492
+ const t = V(this.__key);
1493
+ return t === null && T(113), t;
1494
+ }
1495
+ getWritable() {
1496
+ q();
1497
+ const t = ft(), e = A(), r = t._nodeMap, i = this.__key, s = this.getLatest(), o = e._cloneNotNeeded, l = M();
1498
+ if (l !== null && l.setCachedNodes(null), o.has(i)) return Pe(s), s;
1499
+ const a = Os(s);
1500
+ return o.add(i), Pe(a), r.set(i, a), a;
1501
+ }
1502
+ getTextContent() {
1503
+ return "";
1504
+ }
1505
+ getTextContentSize() {
1506
+ return this.getTextContent().length;
1507
+ }
1508
+ createDOM(t, e) {
1509
+ T(70);
1510
+ }
1511
+ updateDOM(t, e, r) {
1512
+ T(71);
1513
+ }
1514
+ exportDOM(t) {
1515
+ return { element: this.createDOM(t._config, t) };
1516
+ }
1517
+ exportJSON() {
1518
+ T(72);
1519
+ }
1520
+ static importJSON(t) {
1521
+ T(18, this.name);
1522
+ }
1523
+ static transform() {
1524
+ return null;
1525
+ }
1526
+ remove(t) {
1527
+ bn(this, !0, t);
1528
+ }
1529
+ replace(t, e) {
1530
+ q();
1531
+ let r = M();
1532
+ r !== null && (r = r.clone()), rn(this, t);
1533
+ const i = this.getLatest(), s = this.__key, o = t.__key, l = t.getWritable(), a = this.getParentOrThrow().getWritable(), c = a.__size;
1534
+ Nt(l);
1535
+ const u = i.getPreviousSibling(), d = i.getNextSibling(), f = i.__prev, h = i.__next, g = i.__parent;
1536
+ if (bn(i, !1, !0), u === null ? a.__first = o : u.getWritable().__next = o, l.__prev = f, d === null ? a.__last = o : d.getWritable().__prev = o, l.__next = h, l.__parent = g, a.__size = c, e && (S(this) && S(l) || T(139), this.getChildren().forEach((_) => {
1537
+ l.append(_);
1538
+ })), F(r)) {
1539
+ ut(r);
1540
+ const _ = r.anchor, p = r.focus;
1541
+ _.key === s && br(_, l), p.key === s && br(p, l);
1542
+ }
1543
+ return yt() === s && U(o), l;
1544
+ }
1545
+ insertAfter(t, e = !0) {
1546
+ q(), rn(this, t);
1547
+ const r = this.getWritable(), i = t.getWritable(), s = i.getParent(), o = M();
1548
+ let l = !1, a = !1;
1549
+ if (s !== null) {
1550
+ const h = t.getIndexWithinParent();
1551
+ if (Nt(i), F(o)) {
1552
+ const g = s.__key, _ = o.anchor, p = o.focus;
1553
+ l = _.type === "element" && _.key === g && _.offset === h + 1, a = p.type === "element" && p.key === g && p.offset === h + 1;
1554
+ }
1555
+ }
1556
+ const c = this.getNextSibling(), u = this.getParentOrThrow().getWritable(), d = i.__key, f = r.__next;
1557
+ if (c === null ? u.__last = d : c.getWritable().__prev = d, u.__size++, r.__next = d, i.__next = f, i.__prev = r.__key, i.__parent = r.__parent, e && F(o)) {
1558
+ const h = this.getIndexWithinParent();
1559
+ Ie(o, u, h + 1);
1560
+ const g = u.__key;
1561
+ l && o.anchor.set(g, h + 2, "element"), a && o.focus.set(g, h + 2, "element");
1562
+ }
1563
+ return t;
1564
+ }
1565
+ insertBefore(t, e = !0) {
1566
+ q(), rn(this, t);
1567
+ const r = this.getWritable(), i = t.getWritable(), s = i.__key;
1568
+ Nt(i);
1569
+ const o = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(), a = r.__prev, c = this.getIndexWithinParent();
1570
+ o === null ? l.__first = s : o.getWritable().__next = s, l.__size++, r.__prev = s, i.__prev = a, i.__next = r.__key, i.__parent = r.__parent;
1571
+ const u = M();
1572
+ return e && F(u) && Ie(u, this.getParentOrThrow(), c), t;
1573
+ }
1574
+ isParentRequired() {
1575
+ return !1;
1576
+ }
1577
+ createParentElementNode() {
1578
+ return vt();
1579
+ }
1580
+ selectStart() {
1581
+ return this.selectPrevious();
1582
+ }
1583
+ selectEnd() {
1584
+ return this.selectNext(0, 0);
1585
+ }
1586
+ selectPrevious(t, e) {
1587
+ q();
1588
+ const r = this.getPreviousSibling(), i = this.getParentOrThrow();
1589
+ if (r === null) return i.select(0, 0);
1590
+ if (S(r)) return r.select();
1591
+ if (!E(r)) {
1592
+ const s = r.getIndexWithinParent() + 1;
1593
+ return i.select(s, s);
1594
+ }
1595
+ return r.select(t, e);
1596
+ }
1597
+ selectNext(t, e) {
1598
+ q();
1599
+ const r = this.getNextSibling(), i = this.getParentOrThrow();
1600
+ if (r === null) return i.select();
1601
+ if (S(r)) return r.select(0, 0);
1602
+ if (!E(r)) {
1603
+ const s = r.getIndexWithinParent();
1604
+ return i.select(s, s);
1605
+ }
1606
+ return r.select(t, e);
1607
+ }
1608
+ markDirty() {
1609
+ this.getWritable();
1610
+ }
1611
+ reconcileObservedMutation(t, e) {
1612
+ this.markDirty();
1613
+ }
1614
+ }
1615
+ class oe extends He {
1616
+ static getType() {
1617
+ return "linebreak";
1618
+ }
1619
+ static clone(t) {
1620
+ return new oe(t.__key);
1621
+ }
1622
+ constructor(t) {
1623
+ super(t);
1624
+ }
1625
+ getTextContent() {
1626
+ return `
1627
+ `;
1628
+ }
1629
+ createDOM() {
1630
+ return document.createElement("br");
1631
+ }
1632
+ updateDOM() {
1633
+ return !1;
1634
+ }
1635
+ static importDOM() {
1636
+ return { br: (t) => function(e) {
1637
+ const r = e.parentElement;
1638
+ if (r !== null && _r(r)) {
1639
+ const i = r.firstChild;
1640
+ if (i === e || i.nextSibling === e && _e(i)) {
1641
+ const s = r.lastChild;
1642
+ if (s === e || s.previousSibling === e && _e(s)) return !0;
1643
+ }
1644
+ }
1645
+ return !1;
1646
+ }(t) || function(e) {
1647
+ const r = e.parentElement;
1648
+ if (r !== null && _r(r)) {
1649
+ const i = r.firstChild;
1650
+ if (i === e || i.nextSibling === e && _e(i)) return !1;
1651
+ const s = r.lastChild;
1652
+ if (s === e || s.previousSibling === e && _e(s)) return !0;
1653
+ }
1654
+ return !1;
1655
+ }(t) ? null : { conversion: Rs, priority: 0 } };
1656
+ }
1657
+ static importJSON(t) {
1658
+ return ne();
1659
+ }
1660
+ exportJSON() {
1661
+ return { type: "linebreak", version: 1 };
1662
+ }
1663
+ }
1664
+ function Rs(n) {
1665
+ return { node: ne() };
1666
+ }
1667
+ function ne() {
1668
+ return Ue(new oe());
1669
+ }
1670
+ function It(n) {
1671
+ return n instanceof oe;
1672
+ }
1673
+ function _e(n) {
1674
+ return n.nodeType === Ct && /^( |\t|\r?\n)+$/.test(n.textContent || "");
1675
+ }
1676
+ function an(n, t) {
1677
+ return 16 & t ? "code" : t & Pn ? "mark" : 32 & t ? "sub" : 64 & t ? "sup" : null;
1678
+ }
1679
+ function cn(n, t) {
1680
+ return 1 & t ? "strong" : 2 & t ? "em" : "span";
1681
+ }
1682
+ function Ti(n, t, e, r, i) {
1683
+ const s = r.classList;
1684
+ let o = Ht(i, "base");
1685
+ o !== void 0 && s.add(...o), o = Ht(i, "underlineStrikethrough");
1686
+ let l = !1;
1687
+ const a = t & be && t & ke;
1688
+ o !== void 0 && (e & be && e & ke ? (l = !0, a || s.add(...o)) : a && s.remove(...o));
1689
+ for (const c in at) {
1690
+ const u = at[c];
1691
+ if (o = Ht(i, c), o !== void 0) if (e & u) {
1692
+ if (l && (c === "underline" || c === "strikethrough")) {
1693
+ t & u && s.remove(...o);
1694
+ continue;
1695
+ }
1696
+ t & u && (!a || c !== "underline") && c !== "strikethrough" || s.add(...o);
1697
+ } else t & u && s.remove(...o);
1698
+ }
1699
+ }
1700
+ function ki(n, t, e) {
1701
+ const r = t.firstChild, i = e.isComposing(), s = n + (i ? ze : "");
1702
+ if (r == null) t.textContent = s;
1703
+ else {
1704
+ const o = r.nodeValue;
1705
+ if (o !== s) if (i || xt) {
1706
+ const [l, a, c] = function(u, d) {
1707
+ const f = u.length, h = d.length;
1708
+ let g = 0, _ = 0;
1709
+ for (; g < f && g < h && u[g] === d[g]; ) g++;
1710
+ for (; _ + g < f && _ + g < h && u[f - _ - 1] === d[h - _ - 1]; ) _++;
1711
+ return [g, f - g - _, d.slice(g, h - _)];
1712
+ }(o, s);
1713
+ a !== 0 && r.deleteData(l, a), r.insertData(l, c);
1714
+ } else r.nodeValue = s;
1715
+ }
1716
+ }
1717
+ function Cr(n, t, e, r, i, s) {
1718
+ ki(i, n, t);
1719
+ const o = s.theme.text;
1720
+ o !== void 0 && Ti(0, 0, r, n, o);
1721
+ }
1722
+ function pe(n, t) {
1723
+ const e = document.createElement(t);
1724
+ return e.appendChild(n), e;
1725
+ }
1726
+ class Bt extends He {
1727
+ static getType() {
1728
+ return "text";
1729
+ }
1730
+ static clone(t) {
1731
+ return new Bt(t.__text, t.__key);
1732
+ }
1733
+ afterCloneFrom(t) {
1734
+ super.afterCloneFrom(t), this.__format = t.__format, this.__style = t.__style, this.__mode = t.__mode, this.__detail = t.__detail;
1735
+ }
1736
+ constructor(t, e) {
1737
+ super(e), this.__text = t, this.__format = 0, this.__style = "", this.__mode = 0, this.__detail = 0;
1738
+ }
1739
+ getFormat() {
1740
+ return this.getLatest().__format;
1741
+ }
1742
+ getDetail() {
1743
+ return this.getLatest().__detail;
1744
+ }
1745
+ getMode() {
1746
+ const t = this.getLatest();
1747
+ return _s[t.__mode];
1748
+ }
1749
+ getStyle() {
1750
+ return this.getLatest().__style;
1751
+ }
1752
+ isToken() {
1753
+ return this.getLatest().__mode === 1;
1754
+ }
1755
+ isComposing() {
1756
+ return this.__key === yt();
1757
+ }
1758
+ isSegmented() {
1759
+ return this.getLatest().__mode === 2;
1760
+ }
1761
+ isDirectionless() {
1762
+ return !!(1 & this.getLatest().__detail);
1763
+ }
1764
+ isUnmergeable() {
1765
+ return !!(2 & this.getLatest().__detail);
1766
+ }
1767
+ hasFormat(t) {
1768
+ const e = at[t];
1769
+ return !!(this.getFormat() & e);
1770
+ }
1771
+ isSimpleText() {
1772
+ return this.__type === "text" && this.__mode === 0;
1773
+ }
1774
+ getTextContent() {
1775
+ return this.getLatest().__text;
1776
+ }
1777
+ getFormatFlags(t, e) {
1778
+ return Ee(this.getLatest().__format, t, e);
1779
+ }
1780
+ canHaveFormat() {
1781
+ return !0;
1782
+ }
1783
+ createDOM(t, e) {
1784
+ const r = this.__format, i = an(0, r), s = cn(0, r), o = i === null ? s : i, l = document.createElement(o);
1785
+ let a = l;
1786
+ this.hasFormat("code") && l.setAttribute("spellcheck", "false"), i !== null && (a = document.createElement(s), l.appendChild(a)), Cr(a, this, 0, r, this.__text, t);
1787
+ const c = this.__style;
1788
+ return c !== "" && (l.style.cssText = c), l;
1789
+ }
1790
+ updateDOM(t, e, r) {
1791
+ const i = this.__text, s = t.__format, o = this.__format, l = an(0, s), a = an(0, o), c = cn(0, s), u = cn(0, o);
1792
+ if ((l === null ? c : l) !== (a === null ? u : a)) return !0;
1793
+ if (l === a && c !== u) {
1794
+ const _ = e.firstChild;
1795
+ _ == null && T(48);
1796
+ const p = document.createElement(u);
1797
+ return Cr(p, this, 0, o, i, r), e.replaceChild(p, _), !1;
1798
+ }
1799
+ let d = e;
1800
+ a !== null && l !== null && (d = e.firstChild, d == null && T(49)), ki(i, d, this);
1801
+ const f = r.theme.text;
1802
+ f !== void 0 && s !== o && Ti(0, s, o, d, f);
1803
+ const h = t.__style, g = this.__style;
1804
+ return h !== g && (e.style.cssText = g), !1;
1805
+ }
1806
+ static importDOM() {
1807
+ return { "#text": () => ({ conversion: Us, priority: 0 }), b: () => ({ conversion: Js, priority: 0 }), code: () => ({ conversion: gt, priority: 0 }), em: () => ({ conversion: gt, priority: 0 }), i: () => ({ conversion: gt, priority: 0 }), s: () => ({ conversion: gt, priority: 0 }), span: () => ({ conversion: Ks, priority: 0 }), strong: () => ({ conversion: gt, priority: 0 }), sub: () => ({ conversion: gt, priority: 0 }), sup: () => ({ conversion: gt, priority: 0 }), u: () => ({ conversion: gt, priority: 0 }) };
1808
+ }
1809
+ static importJSON(t) {
1810
+ const e = $(t.text);
1811
+ return e.setFormat(t.format), e.setDetail(t.detail), e.setMode(t.mode), e.setStyle(t.style), e;
1812
+ }
1813
+ exportDOM(t) {
1814
+ let { element: e } = super.exportDOM(t);
1815
+ return e !== null && Ve(e) || T(132), e.style.whiteSpace = "pre-wrap", this.hasFormat("bold") && (e = pe(e, "b")), this.hasFormat("italic") && (e = pe(e, "i")), this.hasFormat("strikethrough") && (e = pe(e, "s")), this.hasFormat("underline") && (e = pe(e, "u")), { element: e };
1816
+ }
1817
+ exportJSON() {
1818
+ return { detail: this.getDetail(), format: this.getFormat(), mode: this.getMode(), style: this.getStyle(), text: this.getTextContent(), type: "text", version: 1 };
1819
+ }
1820
+ selectionTransform(t, e) {
1821
+ }
1822
+ setFormat(t) {
1823
+ const e = this.getWritable();
1824
+ return e.__format = typeof t == "string" ? at[t] : t, e;
1825
+ }
1826
+ setDetail(t) {
1827
+ const e = this.getWritable();
1828
+ return e.__detail = typeof t == "string" ? ds[t] : t, e;
1829
+ }
1830
+ setStyle(t) {
1831
+ const e = this.getWritable();
1832
+ return e.__style = t, e;
1833
+ }
1834
+ toggleFormat(t) {
1835
+ const e = Ee(this.getFormat(), t, null);
1836
+ return this.setFormat(e);
1837
+ }
1838
+ toggleDirectionless() {
1839
+ const t = this.getWritable();
1840
+ return t.__detail ^= 1, t;
1841
+ }
1842
+ toggleUnmergeable() {
1843
+ const t = this.getWritable();
1844
+ return t.__detail ^= 2, t;
1845
+ }
1846
+ setMode(t) {
1847
+ const e = gs[t];
1848
+ if (this.__mode === e) return this;
1849
+ const r = this.getWritable();
1850
+ return r.__mode = e, r;
1851
+ }
1852
+ setTextContent(t) {
1853
+ if (this.__text === t) return this;
1854
+ const e = this.getWritable();
1855
+ return e.__text = t, e;
1856
+ }
1857
+ select(t, e) {
1858
+ q();
1859
+ let r = t, i = e;
1860
+ const s = M(), o = this.getTextContent(), l = this.__key;
1861
+ if (typeof o == "string") {
1862
+ const a = o.length;
1863
+ r === void 0 && (r = a), i === void 0 && (i = a);
1864
+ } else r = 0, i = 0;
1865
+ if (!F(s)) return Ni(l, r, l, i, "text", "text");
1866
+ {
1867
+ const a = yt();
1868
+ a !== s.anchor.key && a !== s.focus.key || U(l), s.setTextNodeRange(this, r, this, i);
1869
+ }
1870
+ return s;
1871
+ }
1872
+ selectStart() {
1873
+ return this.select(0, 0);
1874
+ }
1875
+ selectEnd() {
1876
+ const t = this.getTextContentSize();
1877
+ return this.select(t, t);
1878
+ }
1879
+ spliceText(t, e, r, i) {
1880
+ const s = this.getWritable(), o = s.__text, l = r.length;
1881
+ let a = t;
1882
+ a < 0 && (a = l + a, a < 0 && (a = 0));
1883
+ const c = M();
1884
+ if (i && F(c)) {
1885
+ const d = t + l;
1886
+ c.setTextNodeRange(s, d, s, d);
1887
+ }
1888
+ const u = o.slice(0, a) + r + o.slice(a + e);
1889
+ return s.__text = u, s;
1890
+ }
1891
+ canInsertTextBefore() {
1892
+ return !0;
1893
+ }
1894
+ canInsertTextAfter() {
1895
+ return !0;
1896
+ }
1897
+ splitText(...t) {
1898
+ q();
1899
+ const e = this.getLatest(), r = e.getTextContent(), i = e.__key, s = yt(), o = new Set(t), l = [], a = r.length;
1900
+ let c = "";
1901
+ for (let k = 0; k < a; k++) c !== "" && o.has(k) && (l.push(c), c = ""), c += r[k];
1902
+ c !== "" && l.push(c);
1903
+ const u = l.length;
1904
+ if (u === 0) return [];
1905
+ if (l[0] === r) return [e];
1906
+ const d = l[0], f = e.getParent();
1907
+ let h;
1908
+ const g = e.getFormat(), _ = e.getStyle(), p = e.__detail;
1909
+ let m = !1;
1910
+ e.isSegmented() ? (h = $(d), h.__format = g, h.__style = _, h.__detail = p, m = !0) : (h = e.getWritable(), h.__text = d);
1911
+ const y = M(), x = [h];
1912
+ let b = d.length;
1913
+ for (let k = 1; k < u; k++) {
1914
+ const v = l[k], P = v.length, C = $(v).getWritable();
1915
+ C.__format = g, C.__style = _, C.__detail = p;
1916
+ const N = C.__key, D = b + P;
1917
+ if (F(y)) {
1918
+ const O = y.anchor, B = y.focus;
1919
+ O.key === i && O.type === "text" && O.offset > b && O.offset <= D && (O.key = N, O.offset -= b, y.dirty = !0), B.key === i && B.type === "text" && B.offset > b && B.offset <= D && (B.key = N, B.offset -= b, y.dirty = !0);
1920
+ }
1921
+ s === i && U(N), b = D, x.push(C);
1922
+ }
1923
+ if (f !== null) {
1924
+ (function(P) {
1925
+ const C = P.getPreviousSibling(), N = P.getNextSibling();
1926
+ C !== null && Pe(C), N !== null && Pe(N);
1927
+ })(this);
1928
+ const k = f.getWritable(), v = this.getIndexWithinParent();
1929
+ m ? (k.splice(v, 0, x), this.remove()) : k.splice(v, 1, x), F(y) && Ie(y, f, v, u - 1);
1930
+ }
1931
+ return x;
1932
+ }
1933
+ mergeWithSibling(t) {
1934
+ const e = t === this.getPreviousSibling();
1935
+ e || t === this.getNextSibling() || T(50);
1936
+ const r = this.__key, i = t.__key, s = this.__text, o = s.length;
1937
+ yt() === i && U(r);
1938
+ const l = M();
1939
+ if (F(l)) {
1940
+ const d = l.anchor, f = l.focus;
1941
+ d !== null && d.key === i && (Or(d, e, r, t, o), l.dirty = !0), f !== null && f.key === i && (Or(f, e, r, t, o), l.dirty = !0);
1942
+ }
1943
+ const a = t.__text, c = e ? a + s : s + a;
1944
+ this.setTextContent(c);
1945
+ const u = this.getWritable();
1946
+ return t.remove(), u;
1947
+ }
1948
+ isTextEntity() {
1949
+ return !1;
1950
+ }
1951
+ }
1952
+ function Ks(n) {
1953
+ return { forChild: Un(n.style), node: null };
1954
+ }
1955
+ function Js(n) {
1956
+ const t = n, e = t.style.fontWeight === "normal";
1957
+ return { forChild: Un(t.style, e ? void 0 : "bold"), node: null };
1958
+ }
1959
+ const Tr = /* @__PURE__ */ new WeakMap();
1960
+ function $s(n) {
1961
+ return n.nodeName === "PRE" || n.nodeType === ie && n.style !== void 0 && n.style.whiteSpace !== void 0 && n.style.whiteSpace.startsWith("pre");
1962
+ }
1963
+ function Us(n) {
1964
+ const t = n;
1965
+ n.parentElement === null && T(129);
1966
+ let e = t.textContent || "";
1967
+ if (function(r) {
1968
+ let i, s = r.parentNode;
1969
+ const o = [r];
1970
+ for (; s !== null && (i = Tr.get(s)) === void 0 && !$s(s); ) o.push(s), s = s.parentNode;
1971
+ const l = i === void 0 ? s : i;
1972
+ for (let a = 0; a < o.length; a++) Tr.set(o[a], l);
1973
+ return l;
1974
+ }(t) !== null) {
1975
+ const r = e.split(/(\r?\n|\t)/), i = [], s = r.length;
1976
+ for (let o = 0; o < s; o++) {
1977
+ const l = r[o];
1978
+ l === `
1979
+ ` || l === `\r
1980
+ ` ? i.push(ne()) : l === " " ? i.push(Vn()) : l !== "" && i.push($(l));
1981
+ }
1982
+ return { node: i };
1983
+ }
1984
+ if (e = e.replace(/\r/g, "").replace(/[ \t\n]+/g, " "), e === "") return { node: null };
1985
+ if (e[0] === " ") {
1986
+ let r = t, i = !0;
1987
+ for (; r !== null && (r = kr(r, !1)) !== null; ) {
1988
+ const s = r.textContent || "";
1989
+ if (s.length > 0) {
1990
+ /[ \t\n]$/.test(s) && (e = e.slice(1)), i = !1;
1991
+ break;
1992
+ }
1993
+ }
1994
+ i && (e = e.slice(1));
1995
+ }
1996
+ if (e[e.length - 1] === " ") {
1997
+ let r = t, i = !0;
1998
+ for (; r !== null && (r = kr(r, !0)) !== null; )
1999
+ if ((r.textContent || "").replace(/^( |\t|\r?\n)+/, "").length > 0) {
2000
+ i = !1;
2001
+ break;
2002
+ }
2003
+ i && (e = e.slice(0, e.length - 1));
2004
+ }
2005
+ return e === "" ? { node: null } : { node: $(e) };
2006
+ }
2007
+ function kr(n, t) {
2008
+ let e = n;
2009
+ for (; ; ) {
2010
+ let r;
2011
+ for (; (r = t ? e.nextSibling : e.previousSibling) === null; ) {
2012
+ const s = e.parentElement;
2013
+ if (s === null) return null;
2014
+ e = s;
2015
+ }
2016
+ if (e = r, e.nodeType === ie) {
2017
+ const s = e.style.display;
2018
+ if (s === "" && !Fs(e) || s !== "" && !s.startsWith("inline")) return null;
2019
+ }
2020
+ let i = e;
2021
+ for (; (i = t ? e.firstChild : e.lastChild) !== null; ) e = i;
2022
+ if (e.nodeType === Ct) return e;
2023
+ if (e.nodeName === "BR") return null;
2024
+ }
2025
+ }
2026
+ const Vs = { code: "code", em: "italic", i: "italic", s: "strikethrough", strong: "bold", sub: "subscript", sup: "superscript", u: "underline" };
2027
+ function gt(n) {
2028
+ const t = Vs[n.nodeName.toLowerCase()];
2029
+ return t === void 0 ? { node: null } : { forChild: Un(n.style, t), node: null };
2030
+ }
2031
+ function $(n = "") {
2032
+ return Ue(new Bt(n));
2033
+ }
2034
+ function E(n) {
2035
+ return n instanceof Bt;
2036
+ }
2037
+ function Un(n, t) {
2038
+ const e = n.fontWeight, r = n.textDecoration.split(" "), i = e === "700" || e === "bold", s = r.includes("line-through"), o = n.fontStyle === "italic", l = r.includes("underline"), a = n.verticalAlign;
2039
+ return (c) => (E(c) && (i && !c.hasFormat("bold") && c.toggleFormat("bold"), s && !c.hasFormat("strikethrough") && c.toggleFormat("strikethrough"), o && !c.hasFormat("italic") && c.toggleFormat("italic"), l && !c.hasFormat("underline") && c.toggleFormat("underline"), a !== "sub" || c.hasFormat("subscript") || c.toggleFormat("subscript"), a !== "super" || c.hasFormat("superscript") || c.toggleFormat("superscript"), t && !c.hasFormat(t) && c.toggleFormat(t)), c);
2040
+ }
2041
+ class le extends Bt {
2042
+ static getType() {
2043
+ return "tab";
2044
+ }
2045
+ static clone(t) {
2046
+ return new le(t.__key);
2047
+ }
2048
+ afterCloneFrom(t) {
2049
+ super.afterCloneFrom(t), this.__text = t.__text;
2050
+ }
2051
+ constructor(t) {
2052
+ super(" ", t), this.__detail = 2;
2053
+ }
2054
+ static importDOM() {
2055
+ return null;
2056
+ }
2057
+ static importJSON(t) {
2058
+ const e = Vn();
2059
+ return e.setFormat(t.format), e.setStyle(t.style), e;
2060
+ }
2061
+ exportJSON() {
2062
+ return { ...super.exportJSON(), type: "tab", version: 1 };
2063
+ }
2064
+ setTextContent(t) {
2065
+ T(126);
2066
+ }
2067
+ setDetail(t) {
2068
+ T(127);
2069
+ }
2070
+ setMode(t) {
2071
+ T(128);
2072
+ }
2073
+ canInsertTextBefore() {
2074
+ return !1;
2075
+ }
2076
+ canInsertTextAfter() {
2077
+ return !1;
2078
+ }
2079
+ }
2080
+ function Vn() {
2081
+ return Ue(new le());
2082
+ }
2083
+ function js(n) {
2084
+ return n instanceof le;
2085
+ }
2086
+ class Hs {
2087
+ constructor(t, e, r) {
2088
+ this._selection = null, this.key = t, this.offset = e, this.type = r;
2089
+ }
2090
+ is(t) {
2091
+ return this.key === t.key && this.offset === t.offset && this.type === t.type;
2092
+ }
2093
+ isBefore(t) {
2094
+ let e = this.getNode(), r = t.getNode();
2095
+ const i = this.offset, s = t.offset;
2096
+ if (S(e)) {
2097
+ const o = e.getDescendantByIndex(i);
2098
+ e = o ?? e;
2099
+ }
2100
+ if (S(r)) {
2101
+ const o = r.getDescendantByIndex(s);
2102
+ r = o ?? r;
2103
+ }
2104
+ return e === r ? i < s : e.isBefore(r);
2105
+ }
2106
+ getNode() {
2107
+ const t = V(this.key);
2108
+ return t === null && T(20), t;
2109
+ }
2110
+ set(t, e, r) {
2111
+ const i = this._selection, s = this.key;
2112
+ this.key = t, this.offset = e, this.type = r, ce() || (yt() === s && U(t), i !== null && (i.setCachedNodes(null), i.dirty = !0));
2113
+ }
2114
+ }
2115
+ function st(n, t, e) {
2116
+ return new Hs(n, t, e);
2117
+ }
2118
+ function un(n, t) {
2119
+ let e = t.__key, r = n.offset, i = "element";
2120
+ if (E(t)) {
2121
+ i = "text";
2122
+ const s = t.getTextContentSize();
2123
+ r > s && (r = s);
2124
+ } else if (!S(t)) {
2125
+ const s = t.getNextSibling();
2126
+ if (E(s)) e = s.__key, r = 0, i = "text";
2127
+ else {
2128
+ const o = t.getParent();
2129
+ o && (e = o.__key, r = t.getIndexWithinParent() + 1);
2130
+ }
2131
+ }
2132
+ n.set(e, r, i);
2133
+ }
2134
+ function br(n, t) {
2135
+ if (S(t)) {
2136
+ const e = t.getLastDescendant();
2137
+ S(e) || E(e) ? un(n, e) : un(n, t);
2138
+ } else un(n, t);
2139
+ }
2140
+ function pt(n, t, e, r) {
2141
+ n.key = t, n.offset = e, n.type = r;
2142
+ }
2143
+ class qe {
2144
+ constructor(t) {
2145
+ this._cachedNodes = null, this._nodes = t, this.dirty = !1;
2146
+ }
2147
+ getCachedNodes() {
2148
+ return this._cachedNodes;
2149
+ }
2150
+ setCachedNodes(t) {
2151
+ this._cachedNodes = t;
2152
+ }
2153
+ is(t) {
2154
+ if (!jn(t)) return !1;
2155
+ const e = this._nodes, r = t._nodes;
2156
+ return e.size === r.size && Array.from(e).every((i) => r.has(i));
2157
+ }
2158
+ isCollapsed() {
2159
+ return !1;
2160
+ }
2161
+ isBackward() {
2162
+ return !1;
2163
+ }
2164
+ getStartEndPoints() {
2165
+ return null;
2166
+ }
2167
+ add(t) {
2168
+ this.dirty = !0, this._nodes.add(t), this._cachedNodes = null;
2169
+ }
2170
+ delete(t) {
2171
+ this.dirty = !0, this._nodes.delete(t), this._cachedNodes = null;
2172
+ }
2173
+ clear() {
2174
+ this.dirty = !0, this._nodes.clear(), this._cachedNodes = null;
2175
+ }
2176
+ has(t) {
2177
+ return this._nodes.has(t);
2178
+ }
2179
+ clone() {
2180
+ return new qe(new Set(this._nodes));
2181
+ }
2182
+ extract() {
2183
+ return this.getNodes();
2184
+ }
2185
+ insertRawText(t) {
2186
+ }
2187
+ insertText() {
2188
+ }
2189
+ insertNodes(t) {
2190
+ const e = this.getNodes(), r = e.length, i = e[r - 1];
2191
+ let s;
2192
+ if (E(i)) s = i.select();
2193
+ else {
2194
+ const o = i.getIndexWithinParent() + 1;
2195
+ s = i.getParentOrThrow().select(o, o);
2196
+ }
2197
+ s.insertNodes(t);
2198
+ for (let o = 0; o < r; o++) e[o].remove();
2199
+ }
2200
+ getNodes() {
2201
+ const t = this._cachedNodes;
2202
+ if (t !== null) return t;
2203
+ const e = this._nodes, r = [];
2204
+ for (const i of e) {
2205
+ const s = V(i);
2206
+ s !== null && r.push(s);
2207
+ }
2208
+ return ce() || (this._cachedNodes = r), r;
2209
+ }
2210
+ getTextContent() {
2211
+ const t = this.getNodes();
2212
+ let e = "";
2213
+ for (let r = 0; r < t.length; r++) e += t[r].getTextContent();
2214
+ return e;
2215
+ }
2216
+ }
2217
+ function F(n) {
2218
+ return n instanceof Tt;
2219
+ }
2220
+ class Tt {
2221
+ constructor(t, e, r, i) {
2222
+ this.anchor = t, this.focus = e, t._selection = this, e._selection = this, this._cachedNodes = null, this.format = r, this.style = i, this.dirty = !1;
2223
+ }
2224
+ getCachedNodes() {
2225
+ return this._cachedNodes;
2226
+ }
2227
+ setCachedNodes(t) {
2228
+ this._cachedNodes = t;
2229
+ }
2230
+ is(t) {
2231
+ return !!F(t) && this.anchor.is(t.anchor) && this.focus.is(t.focus) && this.format === t.format && this.style === t.style;
2232
+ }
2233
+ isCollapsed() {
2234
+ return this.anchor.is(this.focus);
2235
+ }
2236
+ getNodes() {
2237
+ const t = this._cachedNodes;
2238
+ if (t !== null) return t;
2239
+ const e = this.anchor, r = this.focus, i = e.isBefore(r), s = i ? e : r, o = i ? r : e;
2240
+ let l = s.getNode(), a = o.getNode();
2241
+ const c = s.offset, u = o.offset;
2242
+ if (S(l)) {
2243
+ const f = l.getDescendantByIndex(c);
2244
+ l = f ?? l;
2245
+ }
2246
+ if (S(a)) {
2247
+ let f = a.getDescendantByIndex(u);
2248
+ f !== null && f !== l && a.getChildAtIndex(u) === f && (f = f.getPreviousSibling()), a = f ?? a;
2249
+ }
2250
+ let d;
2251
+ return d = l.is(a) ? S(l) && l.getChildrenSize() > 0 ? [] : [l] : l.getNodesBetween(a), ce() || (this._cachedNodes = d), d;
2252
+ }
2253
+ setTextNodeRange(t, e, r, i) {
2254
+ pt(this.anchor, t.__key, e, "text"), pt(this.focus, r.__key, i, "text"), this._cachedNodes = null, this.dirty = !0;
2255
+ }
2256
+ getTextContent() {
2257
+ const t = this.getNodes();
2258
+ if (t.length === 0) return "";
2259
+ const e = t[0], r = t[t.length - 1], i = this.anchor, s = this.focus, o = i.isBefore(s), [l, a] = Nr(this);
2260
+ let c = "", u = !0;
2261
+ for (let d = 0; d < t.length; d++) {
2262
+ const f = t[d];
2263
+ if (S(f) && !f.isInline()) u || (c += `
2264
+ `), u = !f.isEmpty();
2265
+ else if (u = !1, E(f)) {
2266
+ let h = f.getTextContent();
2267
+ f === e ? f === r ? i.type === "element" && s.type === "element" && s.offset !== i.offset || (h = l < a ? h.slice(l, a) : h.slice(a, l)) : h = o ? h.slice(l) : h.slice(a) : f === r && (h = o ? h.slice(0, a) : h.slice(0, l)), c += h;
2268
+ } else !I(f) && !It(f) || f === r && this.isCollapsed() || (c += f.getTextContent());
2269
+ }
2270
+ return c;
2271
+ }
2272
+ applyDOMRange(t) {
2273
+ const e = A(), r = e.getEditorState()._selection, i = wi(t.startContainer, t.startOffset, t.endContainer, t.endOffset, e, r);
2274
+ if (i === null) return;
2275
+ const [s, o] = i;
2276
+ pt(this.anchor, s.key, s.offset, s.type), pt(this.focus, o.key, o.offset, o.type), this._cachedNodes = null;
2277
+ }
2278
+ clone() {
2279
+ const t = this.anchor, e = this.focus;
2280
+ return new Tt(st(t.key, t.offset, t.type), st(e.key, e.offset, e.type), this.format, this.style);
2281
+ }
2282
+ toggleFormat(t) {
2283
+ this.format = Ee(this.format, t, null), this.dirty = !0;
2284
+ }
2285
+ setStyle(t) {
2286
+ this.style = t, this.dirty = !0;
2287
+ }
2288
+ hasFormat(t) {
2289
+ const e = at[t];
2290
+ return !!(this.format & e);
2291
+ }
2292
+ insertRawText(t) {
2293
+ const e = t.split(/(\r?\n|\t)/), r = [], i = e.length;
2294
+ for (let s = 0; s < i; s++) {
2295
+ const o = e[s];
2296
+ o === `
2297
+ ` || o === `\r
2298
+ ` ? r.push(ne()) : o === " " ? r.push(Vn()) : r.push($(o));
2299
+ }
2300
+ this.insertNodes(r);
2301
+ }
2302
+ insertText(t) {
2303
+ const e = this.anchor, r = this.focus, i = this.format, s = this.style;
2304
+ let o = e, l = r;
2305
+ !this.isCollapsed() && r.isBefore(e) && (o = r, l = e), o.type === "element" && function(p, m, y, x) {
2306
+ const b = p.getNode(), k = b.getChildAtIndex(p.offset), v = $(), P = X(b) ? vt().append(v) : v;
2307
+ v.setFormat(y), v.setStyle(x), k === null ? b.append(P) : k.insertBefore(P), p.is(m) && m.set(v.__key, 0, "text"), p.set(v.__key, 0, "text");
2308
+ }(o, l, i, s);
2309
+ const a = o.offset;
2310
+ let c = l.offset;
2311
+ const u = this.getNodes(), d = u.length;
2312
+ let f = u[0];
2313
+ E(f) || T(26);
2314
+ const h = f.getTextContent().length, g = f.getParentOrThrow();
2315
+ let _ = u[d - 1];
2316
+ if (d === 1 && l.type === "element" && (c = h, l.set(o.key, c, "text")), this.isCollapsed() && a === h && (f.isSegmented() || f.isToken() || !f.canInsertTextAfter() || !g.canInsertTextAfter() && f.getNextSibling() === null)) {
2317
+ let p = f.getNextSibling();
2318
+ if (E(p) && p.canInsertTextBefore() && !bt(p) || (p = $(), p.setFormat(i), p.setStyle(s), g.canInsertTextAfter() ? f.insertAfter(p) : g.insertAfter(p)), p.select(0, 0), f = p, t !== "") return void this.insertText(t);
2319
+ } else if (this.isCollapsed() && a === 0 && (f.isSegmented() || f.isToken() || !f.canInsertTextBefore() || !g.canInsertTextBefore() && f.getPreviousSibling() === null)) {
2320
+ let p = f.getPreviousSibling();
2321
+ if (E(p) && !bt(p) || (p = $(), p.setFormat(i), g.canInsertTextBefore() ? f.insertBefore(p) : g.insertBefore(p)), p.select(), f = p, t !== "") return void this.insertText(t);
2322
+ } else if (f.isSegmented() && a !== h) {
2323
+ const p = $(f.getTextContent());
2324
+ p.setFormat(i), f.replace(p), f = p;
2325
+ } else if (!this.isCollapsed() && t !== "") {
2326
+ const p = _.getParent();
2327
+ if (!g.canInsertTextBefore() || !g.canInsertTextAfter() || S(p) && (!p.canInsertTextBefore() || !p.canInsertTextAfter())) return this.insertText(""), bi(this.anchor, this.focus, null), void this.insertText(t);
2328
+ }
2329
+ if (d === 1) {
2330
+ if (f.isToken()) {
2331
+ const x = $(t);
2332
+ return x.select(), void f.replace(x);
2333
+ }
2334
+ const p = f.getFormat(), m = f.getStyle();
2335
+ if (a !== c || p === i && m === s) {
2336
+ if (js(f)) {
2337
+ const x = $(t);
2338
+ return x.setFormat(i), x.setStyle(s), x.select(), void f.replace(x);
2339
+ }
2340
+ } else {
2341
+ if (f.getTextContent() !== "") {
2342
+ const x = $(t);
2343
+ if (x.setFormat(i), x.setStyle(s), x.select(), a === 0) f.insertBefore(x, !1);
2344
+ else {
2345
+ const [b] = f.splitText(a);
2346
+ b.insertAfter(x, !1);
2347
+ }
2348
+ return void (x.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= t.length));
2349
+ }
2350
+ f.setFormat(i), f.setStyle(s);
2351
+ }
2352
+ const y = c - a;
2353
+ f = f.spliceText(a, y, t, !0), f.getTextContent() === "" ? f.remove() : this.anchor.type === "text" && (f.isComposing() ? this.anchor.offset -= t.length : (this.format = p, this.style = m));
2354
+ } else {
2355
+ const p = /* @__PURE__ */ new Set([...f.getParentKeys(), ..._.getParentKeys()]), m = S(f) ? f : f.getParentOrThrow();
2356
+ let y = S(_) ? _ : _.getParentOrThrow(), x = _;
2357
+ if (!m.is(y) && y.isInline()) do
2358
+ x = y, y = y.getParentOrThrow();
2359
+ while (y.isInline());
2360
+ if (l.type === "text" && (c !== 0 || _.getTextContent() === "") || l.type === "element" && _.getIndexWithinParent() < c) if (E(_) && !_.isToken() && c !== _.getTextContentSize()) {
2361
+ if (_.isSegmented()) {
2362
+ const C = $(_.getTextContent());
2363
+ _.replace(C), _ = C;
2364
+ }
2365
+ X(l.getNode()) || l.type !== "text" || (_ = _.spliceText(0, c, "")), p.add(_.__key);
2366
+ } else {
2367
+ const C = _.getParentOrThrow();
2368
+ C.canBeEmpty() || C.getChildrenSize() !== 1 ? _.remove() : C.remove();
2369
+ }
2370
+ else p.add(_.__key);
2371
+ const b = y.getChildren(), k = new Set(u), v = m.is(y), P = m.isInline() && f.getNextSibling() === null ? m : f;
2372
+ for (let C = b.length - 1; C >= 0; C--) {
2373
+ const N = b[C];
2374
+ if (N.is(f) || S(N) && N.isParentOf(f)) break;
2375
+ N.isAttached() && (!k.has(N) || N.is(x) ? v || P.insertAfter(N, !1) : N.remove());
2376
+ }
2377
+ if (!v) {
2378
+ let C = y, N = null;
2379
+ for (; C !== null; ) {
2380
+ const D = C.getChildren(), O = D.length;
2381
+ (O === 0 || D[O - 1].is(N)) && (p.delete(C.__key), N = C), C = C.getParent();
2382
+ }
2383
+ }
2384
+ if (f.isToken()) if (a === h) f.select();
2385
+ else {
2386
+ const C = $(t);
2387
+ C.select(), f.replace(C);
2388
+ }
2389
+ else f = f.spliceText(a, h - a, t, !0), f.getTextContent() === "" ? f.remove() : f.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= t.length);
2390
+ for (let C = 1; C < d; C++) {
2391
+ const N = u[C], D = N.__key;
2392
+ p.has(D) || N.remove();
2393
+ }
2394
+ }
2395
+ }
2396
+ removeText() {
2397
+ if (this.isCollapsed()) return;
2398
+ const { anchor: t, focus: e } = this, r = this.getNodes(), i = this.isBackward() ? e : t, s = this.isBackward() ? t : e;
2399
+ let o = i.getNode(), l = s.getNode();
2400
+ const a = Jt(o, _t), c = Jt(l, _t);
2401
+ E(o) && o.isToken() && i.offset < o.getTextContentSize() && (i.offset = 0), s.offset > 0 && E(l) && l.isToken() && (s.offset = l.getTextContentSize()), r.forEach((d) => {
2402
+ qt(o, d) || qt(l, d) || d.getKey() === o.getKey() || d.getKey() === l.getKey() || d.remove();
2403
+ });
2404
+ const u = (d, f) => {
2405
+ if (d.getTextContent() === "") d.remove();
2406
+ else if (f !== 0 && bt(d)) {
2407
+ const h = $(d.getTextContent());
2408
+ return h.setFormat(d.getFormat()), h.setStyle(d.getStyle()), d.replace(h);
2409
+ }
2410
+ };
2411
+ if (o === l && E(o)) {
2412
+ const d = Math.abs(e.offset - t.offset);
2413
+ return o.spliceText(i.offset, d, "", !0), void u(o, d);
2414
+ }
2415
+ if (E(o)) {
2416
+ const d = o.getTextContentSize() - i.offset;
2417
+ o.spliceText(i.offset, d, ""), o = u(o, d) || o;
2418
+ }
2419
+ E(l) && (l.spliceText(0, s.offset, ""), l = u(l, s.offset) || l), o.isAttached() && E(o) ? o.selectEnd() : l.isAttached() && E(l) && l.selectStart(), S(a) && S(c) && a !== c && (a.append(...c.getChildren()), c.remove(), s.set(i.key, i.offset, i.type));
2420
+ }
2421
+ formatText(t, e = null) {
2422
+ if (this.isCollapsed()) return this.toggleFormat(t), void U(null);
2423
+ const r = this.getNodes(), i = [];
2424
+ for (const b of r) E(b) && i.push(b);
2425
+ const s = (b) => {
2426
+ r.forEach((k) => {
2427
+ if (wn(k)) {
2428
+ const v = k.getFormatFlags(t, b);
2429
+ k.setTextFormat(v);
2430
+ }
2431
+ });
2432
+ }, o = i.length;
2433
+ if (o === 0) return this.toggleFormat(t), U(null), void s(e);
2434
+ const l = this.anchor, a = this.focus, c = this.isBackward(), u = c ? a : l, d = c ? l : a;
2435
+ let f = 0, h = i[0], g = u.type === "element" ? 0 : u.offset;
2436
+ if (u.type === "text" && g === h.getTextContentSize() && (f = 1, h = i[1], g = 0), h == null) return;
2437
+ const _ = h.getFormatFlags(t, e);
2438
+ s(_);
2439
+ const p = o - 1;
2440
+ let m = i[p];
2441
+ const y = d.type === "text" ? d.offset : m.getTextContentSize();
2442
+ if (h.is(m)) {
2443
+ if (g === y) return;
2444
+ if (bt(h) || g === 0 && y === h.getTextContentSize()) h.setFormat(_);
2445
+ else {
2446
+ const b = h.splitText(g, y), k = g === 0 ? b[0] : b[1];
2447
+ k.setFormat(_), u.type === "text" && u.set(k.__key, 0, "text"), d.type === "text" && d.set(k.__key, y - g, "text");
2448
+ }
2449
+ return void (this.format = _);
2450
+ }
2451
+ g === 0 || bt(h) || ([, h] = h.splitText(g), g = 0), h.setFormat(_);
2452
+ const x = m.getFormatFlags(t, _);
2453
+ y > 0 && (y === m.getTextContentSize() || bt(m) || ([m] = m.splitText(y)), m.setFormat(x));
2454
+ for (let b = f + 1; b < p; b++) {
2455
+ const k = i[b], v = k.getFormatFlags(t, x);
2456
+ k.setFormat(v);
2457
+ }
2458
+ u.type === "text" && u.set(h.__key, g, "text"), d.type === "text" && d.set(m.__key, y, "text"), this.format = _ | x;
2459
+ }
2460
+ insertNodes(t) {
2461
+ if (t.length === 0) return;
2462
+ if (this.anchor.key === "root") {
2463
+ this.insertParagraph();
2464
+ const g = M();
2465
+ return F(g) || T(134), g.insertNodes(t);
2466
+ }
2467
+ const e = (this.isBackward() ? this.focus : this.anchor).getNode(), r = Jt(e, _t), i = t[t.length - 1];
2468
+ if (S(r) && "__language" in r) {
2469
+ if ("__language" in t[0]) this.insertText(t[0].getTextContent());
2470
+ else {
2471
+ const g = fn(this);
2472
+ r.splice(g, 0, t), i.selectEnd();
2473
+ }
2474
+ return;
2475
+ }
2476
+ if (!t.some((g) => (S(g) || I(g)) && !g.isInline())) {
2477
+ S(r) || T(211, e.constructor.name, e.getType());
2478
+ const g = fn(this);
2479
+ return r.splice(g, 0, t), void i.selectEnd();
2480
+ }
2481
+ const s = function(g) {
2482
+ const _ = vt();
2483
+ let p = null;
2484
+ for (let m = 0; m < g.length; m++) {
2485
+ const y = g[m], x = It(y);
2486
+ if (x || I(y) && y.isInline() || S(y) && y.isInline() || E(y) || y.isParentRequired()) {
2487
+ if (p === null && (p = y.createParentElementNode(), _.append(p), x)) continue;
2488
+ p !== null && p.append(y);
2489
+ } else _.append(y), p = null;
2490
+ }
2491
+ return _;
2492
+ }(t), o = s.getLastDescendant(), l = s.getChildren(), a = !S(r) || !r.isEmpty() ? this.insertParagraph() : null, c = l[l.length - 1];
2493
+ let u = l[0];
2494
+ var d;
2495
+ S(d = u) && _t(d) && !d.isEmpty() && S(r) && (!r.isEmpty() || r.canMergeWhenEmpty()) && (S(r) || T(211, e.constructor.name, e.getType()), r.append(...u.getChildren()), u = l[1]), u && (r === null && T(212, e.constructor.name, e.getType()), function(g, _, p) {
2496
+ const m = _.getParentOrThrow().getLastChild();
2497
+ let y = _;
2498
+ const x = [_];
2499
+ for (; y !== m; ) y.getNextSibling() || T(140), y = y.getNextSibling(), x.push(y);
2500
+ let b = g;
2501
+ for (const k of x) b = b.insertAfter(k);
2502
+ }(r, u));
2503
+ const f = Jt(o, _t);
2504
+ a && S(f) && (a.canMergeWhenEmpty() || _t(c)) && (f.append(...a.getChildren()), a.remove()), S(r) && r.isEmpty() && r.remove(), o.selectEnd();
2505
+ const h = S(r) ? r.getLastChild() : null;
2506
+ It(h) && f !== r && h.remove();
2507
+ }
2508
+ insertParagraph() {
2509
+ if (this.anchor.key === "root") {
2510
+ const o = vt();
2511
+ return Y().splice(this.anchor.offset, 0, [o]), o.select(), o;
2512
+ }
2513
+ const t = fn(this), e = Jt(this.anchor.getNode(), _t);
2514
+ S(e) || T(213);
2515
+ const r = e.getChildAtIndex(t), i = r ? [r, ...r.getNextSiblings()] : [], s = e.insertNewAfter(this, !1);
2516
+ return s ? (s.append(...i), s.selectStart(), s) : null;
2517
+ }
2518
+ insertLineBreak(t) {
2519
+ const e = ne();
2520
+ if (this.insertNodes([e]), t) {
2521
+ const r = e.getParentOrThrow(), i = e.getIndexWithinParent();
2522
+ r.select(i, i);
2523
+ }
2524
+ }
2525
+ extract() {
2526
+ const t = this.getNodes(), e = t.length, r = e - 1, i = this.anchor, s = this.focus;
2527
+ let o = t[0], l = t[r];
2528
+ const [a, c] = Nr(this);
2529
+ if (e === 0) return [];
2530
+ if (e === 1) {
2531
+ if (E(o) && !this.isCollapsed()) {
2532
+ const d = a > c ? c : a, f = a > c ? a : c, h = o.splitText(d, f), g = d === 0 ? h[0] : h[1];
2533
+ return g != null ? [g] : [];
2534
+ }
2535
+ return [o];
2536
+ }
2537
+ const u = i.isBefore(s);
2538
+ if (E(o)) {
2539
+ const d = u ? a : c;
2540
+ d === o.getTextContentSize() ? t.shift() : d !== 0 && ([, o] = o.splitText(d), t[0] = o);
2541
+ }
2542
+ if (E(l)) {
2543
+ const d = l.getTextContent().length, f = u ? c : a;
2544
+ f === 0 ? t.pop() : f !== d && ([l] = l.splitText(f), t[r] = l);
2545
+ }
2546
+ return t;
2547
+ }
2548
+ modify(t, e, r) {
2549
+ const i = this.focus, s = this.anchor, o = t === "move", l = gr(i, e);
2550
+ if (I(l) && !l.isIsolated()) {
2551
+ if (o && l.isKeyboardSelectable()) {
2552
+ const h = Dr();
2553
+ return h.add(l.__key), void ut(h);
2554
+ }
2555
+ const f = e ? l.getPreviousSibling() : l.getNextSibling();
2556
+ if (E(f)) {
2557
+ const h = f.__key, g = e ? f.getTextContent().length : 0;
2558
+ return i.set(h, g, "text"), void (o && s.set(h, g, "text"));
2559
+ }
2560
+ {
2561
+ const h = l.getParentOrThrow();
2562
+ let g, _;
2563
+ return S(f) ? (_ = f.__key, g = e ? f.getChildrenSize() : 0) : (g = l.getIndexWithinParent(), _ = h.__key, e || g++), i.set(_, g, "element"), void (o && s.set(_, g, "element"));
2564
+ }
2565
+ }
2566
+ const a = A(), c = it(a._window);
2567
+ if (!c) return;
2568
+ const u = a._blockCursorElement, d = a._rootElement;
2569
+ if (d === null || u === null || !S(l) || l.isInline() || l.canBeEmpty() || $n(u, a, d), function(f, h, g, _) {
2570
+ f.modify(h, g, _);
2571
+ }(c, t, e ? "backward" : "forward", r), c.rangeCount > 0) {
2572
+ const f = c.getRangeAt(0), h = this.anchor.getNode(), g = X(h) ? h : Ns(h);
2573
+ if (this.applyDOMRange(f), this.dirty = !0, !o) {
2574
+ const _ = this.getNodes(), p = [];
2575
+ let m = !1;
2576
+ for (let y = 0; y < _.length; y++) {
2577
+ const x = _[y];
2578
+ qt(x, g) ? p.push(x) : m = !0;
2579
+ }
2580
+ if (m && p.length > 0) if (e) {
2581
+ const y = p[0];
2582
+ S(y) ? y.selectStart() : y.getParentOrThrow().selectStart();
2583
+ } else {
2584
+ const y = p[p.length - 1];
2585
+ S(y) ? y.selectEnd() : y.getParentOrThrow().selectEnd();
2586
+ }
2587
+ c.anchorNode === f.startContainer && c.anchorOffset === f.startOffset || function(y) {
2588
+ const x = y.focus, b = y.anchor, k = b.key, v = b.offset, P = b.type;
2589
+ pt(b, x.key, x.offset, x.type), pt(x, k, v, P), y._cachedNodes = null;
2590
+ }(this);
2591
+ }
2592
+ }
2593
+ }
2594
+ forwardDeletion(t, e, r) {
2595
+ if (!r && (t.type === "element" && S(e) && t.offset === e.getChildrenSize() || t.type === "text" && t.offset === e.getTextContentSize())) {
2596
+ const i = e.getParent(), s = e.getNextSibling() || (i === null ? null : i.getNextSibling());
2597
+ if (S(s) && s.isShadowRoot()) return !0;
2598
+ }
2599
+ return !1;
2600
+ }
2601
+ deleteCharacter(t) {
2602
+ const e = this.isCollapsed();
2603
+ if (this.isCollapsed()) {
2604
+ const r = this.anchor;
2605
+ let i = r.getNode();
2606
+ if (this.forwardDeletion(r, i, t)) return;
2607
+ const s = this.focus, o = gr(s, t);
2608
+ if (I(o) && !o.isIsolated()) {
2609
+ if (o.isKeyboardSelectable() && S(i) && i.getChildrenSize() === 0) {
2610
+ i.remove();
2611
+ const l = Dr();
2612
+ l.add(o.__key), ut(l);
2613
+ } else
2614
+ o.remove(), A().dispatchCommand(Nn, void 0);
2615
+ return;
2616
+ }
2617
+ if (!t && S(o) && S(i) && i.isEmpty()) return i.remove(), void o.selectStart();
2618
+ if (this.modify("extend", t, "character"), this.isCollapsed()) {
2619
+ if (t && r.offset === 0 && (r.type === "element" ? r.getNode() : r.getNode().getParentOrThrow()).collapseAtStart(this))
2620
+ return;
2621
+ } else {
2622
+ const l = s.type === "text" ? s.getNode() : null;
2623
+ if (i = r.type === "text" ? r.getNode() : null, l !== null && l.isSegmented()) {
2624
+ const a = s.offset, c = l.getTextContentSize();
2625
+ if (l.is(i) || t && a !== c || !t && a !== 0) return void Er(l, t, a);
2626
+ } else if (i !== null && i.isSegmented()) {
2627
+ const a = r.offset, c = i.getTextContentSize();
2628
+ if (i.is(l) || t && a !== 0 || !t && a !== c) return void Er(i, t, a);
2629
+ }
2630
+ (function(a, c) {
2631
+ const u = a.anchor, d = a.focus, f = u.getNode(), h = d.getNode();
2632
+ if (f === h && u.type === "text" && d.type === "text") {
2633
+ const g = u.offset, _ = d.offset, p = g < _, m = p ? g : _, y = p ? _ : g, x = y - 1;
2634
+ m !== x && (si(f.getTextContent().slice(m, y)) || (c ? d.offset = x : u.offset = x));
2635
+ }
2636
+ })(this, t);
2637
+ }
2638
+ }
2639
+ if (this.removeText(), t && !e && this.isCollapsed() && this.anchor.type === "element" && this.anchor.offset === 0) {
2640
+ const r = this.anchor.getNode();
2641
+ r.isEmpty() && X(r.getParent()) && r.getIndexWithinParent() === 0 && r.collapseAtStart(this);
2642
+ }
2643
+ }
2644
+ deleteLine(t) {
2645
+ if (this.isCollapsed()) {
2646
+ const e = this.anchor.type === "element";
2647
+ if (e && this.insertText(" "), this.modify("extend", t, "lineboundary"), this.isCollapsed() && this.anchor.offset === 0 && this.modify("extend", t, "character"), e) {
2648
+ const r = t ? this.anchor : this.focus;
2649
+ r.set(r.key, r.offset + 1, r.type);
2650
+ }
2651
+ }
2652
+ this.removeText();
2653
+ }
2654
+ deleteWord(t) {
2655
+ if (this.isCollapsed()) {
2656
+ const e = this.anchor, r = e.getNode();
2657
+ if (this.forwardDeletion(e, r, t)) return;
2658
+ this.modify("extend", t, "word");
2659
+ }
2660
+ this.removeText();
2661
+ }
2662
+ isBackward() {
2663
+ return this.focus.isBefore(this.anchor);
2664
+ }
2665
+ getStartEndPoints() {
2666
+ return [this.anchor, this.focus];
2667
+ }
2668
+ }
2669
+ function jn(n) {
2670
+ return n instanceof qe;
2671
+ }
2672
+ function wr(n) {
2673
+ const t = n.offset;
2674
+ if (n.type === "text") return t;
2675
+ const e = n.getNode();
2676
+ return t === e.getChildrenSize() ? e.getTextContent().length : 0;
2677
+ }
2678
+ function Nr(n) {
2679
+ const t = n.getStartEndPoints();
2680
+ if (t === null) return [0, 0];
2681
+ const [e, r] = t;
2682
+ return e.type === "element" && r.type === "element" && e.key === r.key && e.offset === r.offset ? [0, 0] : [wr(e), wr(r)];
2683
+ }
2684
+ function Er(n, t, e) {
2685
+ const r = n, i = r.getTextContent().split(/(?=\s)/g), s = i.length;
2686
+ let o = 0, l = 0;
2687
+ for (let c = 0; c < s; c++) {
2688
+ const u = c === s - 1;
2689
+ if (l = o, o += i[c].length, t && o === e || o > e || u) {
2690
+ i.splice(c, 1), u && (l = void 0);
2691
+ break;
2692
+ }
2693
+ }
2694
+ const a = i.join("").trim();
2695
+ a === "" ? r.remove() : (r.setTextContent(a), r.select(l, l));
2696
+ }
2697
+ function Pr(n, t, e, r) {
2698
+ let i, s = t;
2699
+ if (n.nodeType === ie) {
2700
+ let o = !1;
2701
+ const l = n.childNodes, a = l.length, c = r._blockCursorElement;
2702
+ s === a && (o = !0, s = a - 1);
2703
+ let u = l[s], d = !1;
2704
+ if (u === c) u = l[s + 1], d = !0;
2705
+ else if (c !== null) {
2706
+ const f = c.parentNode;
2707
+ n === f && t > Array.prototype.indexOf.call(f.children, c) && s--;
2708
+ }
2709
+ if (i = Ot(u), E(i)) s = ar(i, o);
2710
+ else {
2711
+ let f = Ot(n);
2712
+ if (f === null) return null;
2713
+ if (S(f)) {
2714
+ const h = r.getElementByKey(f.getKey());
2715
+ h === null && T(214), [f, s] = f.getDOMSlot(h).resolveChildIndex(f, h, n, t), S(f) || T(215), o && s >= f.getChildrenSize() && (s = Math.max(0, f.getChildrenSize() - 1));
2716
+ let _ = f.getChildAtIndex(s);
2717
+ if (S(_) && function(p, m, y) {
2718
+ const x = p.getParent();
2719
+ return y === null || x === null || !x.canBeEmpty() || x !== y.getNode();
2720
+ }(_, 0, e)) {
2721
+ const p = o ? _.getLastDescendant() : _.getFirstDescendant();
2722
+ p === null ? f = _ : (_ = p, f = S(_) ? _ : _.getParentOrThrow()), s = 0;
2723
+ }
2724
+ E(_) ? (i = _, f = null, s = ar(_, o)) : _ !== f && o && !d && (S(f) || T(216), s = Math.min(f.getChildrenSize(), s + 1));
2725
+ } else {
2726
+ const h = f.getIndexWithinParent();
2727
+ s = t === 0 && I(f) && Ot(n) === f ? h : h + 1, f = f.getParentOrThrow();
2728
+ }
2729
+ if (S(f)) return st(f.__key, s, "element");
2730
+ }
2731
+ } else i = Ot(n);
2732
+ return E(i) ? st(i.__key, s, "text") : null;
2733
+ }
2734
+ function Fr(n, t, e) {
2735
+ const r = n.offset, i = n.getNode();
2736
+ if (r === 0) {
2737
+ const s = i.getPreviousSibling(), o = i.getParent();
2738
+ if (t) {
2739
+ if ((e || !t) && s === null && S(o) && o.isInline()) {
2740
+ const l = o.getPreviousSibling();
2741
+ E(l) && (n.key = l.__key, n.offset = l.getTextContent().length);
2742
+ }
2743
+ } else S(s) && !e && s.isInline() ? (n.key = s.__key, n.offset = s.getChildrenSize(), n.type = "element") : E(s) && (n.key = s.__key, n.offset = s.getTextContent().length);
2744
+ } else if (r === i.getTextContent().length) {
2745
+ const s = i.getNextSibling(), o = i.getParent();
2746
+ if (t && S(s) && s.isInline()) n.key = s.__key, n.offset = 0, n.type = "element";
2747
+ else if ((e || t) && s === null && S(o) && o.isInline() && !o.canInsertTextAfter()) {
2748
+ const l = o.getNextSibling();
2749
+ E(l) && (n.key = l.__key, n.offset = 0);
2750
+ }
2751
+ }
2752
+ }
2753
+ function bi(n, t, e) {
2754
+ if (n.type === "text" && t.type === "text") {
2755
+ const r = n.isBefore(t), i = n.is(t);
2756
+ Fr(n, r, i), Fr(t, !r, i), i && (t.key = n.key, t.offset = n.offset, t.type = n.type);
2757
+ const s = A();
2758
+ if (s.isComposing() && s._compositionKey !== n.key && F(e)) {
2759
+ const o = e.anchor, l = e.focus;
2760
+ pt(n, o.key, o.offset, o.type), pt(t, l.key, l.offset, l.type);
2761
+ }
2762
+ }
2763
+ }
2764
+ function wi(n, t, e, r, i, s) {
2765
+ if (n === null || e === null || !We(i, n, e)) return null;
2766
+ const o = Pr(n, t, F(s) ? s.anchor : null, i);
2767
+ if (o === null) return null;
2768
+ const l = Pr(e, r, F(s) ? s.focus : null, i);
2769
+ if (l === null) return null;
2770
+ if (o.type === "element" && l.type === "element") {
2771
+ const a = Ot(n), c = Ot(e);
2772
+ if (I(a) && I(c)) return null;
2773
+ }
2774
+ return bi(o, l, s), [o, l];
2775
+ }
2776
+ function mo(n) {
2777
+ return S(n) && !n.isInline();
2778
+ }
2779
+ function Ni(n, t, e, r, i, s) {
2780
+ const o = ft(), l = new Tt(st(n, t, i), st(e, r, s), 0, "");
2781
+ return l.dirty = !0, o._selection = l, l;
2782
+ }
2783
+ function xo() {
2784
+ const n = st("root", 0, "element"), t = st("root", 0, "element");
2785
+ return new Tt(n, t, 0, "");
2786
+ }
2787
+ function Dr() {
2788
+ return new qe(/* @__PURE__ */ new Set());
2789
+ }
2790
+ function vo(n, t) {
2791
+ return Ge(null, n, t, null);
2792
+ }
2793
+ function Ge(n, t, e, r) {
2794
+ const i = e._window;
2795
+ if (i === null) return null;
2796
+ const s = r || i.event, o = s ? s.type : void 0, l = o === "selectionchange", a = !gn && (l || o === "beforeinput" || o === "compositionstart" || o === "compositionend" || o === "click" && s && s.detail === 3 || o === "drop" || o === void 0);
2797
+ let c, u, d, f;
2798
+ if (F(n) && !a) return n.clone();
2799
+ if (t === null) return null;
2800
+ if (c = t.anchorNode, u = t.focusNode, d = t.anchorOffset, f = t.focusOffset, l && F(n) && !We(e, c, u)) return n.clone();
2801
+ const h = wi(c, d, u, f, e, n);
2802
+ if (h === null) return null;
2803
+ const [g, _] = h;
2804
+ return new Tt(g, _, F(n) ? n.format : 0, F(n) ? n.style : "");
2805
+ }
2806
+ function M() {
2807
+ return ft()._selection;
2808
+ }
2809
+ function ae() {
2810
+ return A()._editorState._selection;
2811
+ }
2812
+ function Ie(n, t, e, r = 1) {
2813
+ const i = n.anchor, s = n.focus, o = i.getNode(), l = s.getNode();
2814
+ if (!t.is(o) && !t.is(l)) return;
2815
+ const a = t.__key;
2816
+ if (n.isCollapsed()) {
2817
+ const c = i.offset;
2818
+ if (e <= c && r > 0 || e < c && r < 0) {
2819
+ const u = Math.max(0, c + r);
2820
+ i.set(a, u, "element"), s.set(a, u, "element"), Lr(n);
2821
+ }
2822
+ } else {
2823
+ const c = n.isBackward(), u = c ? s : i, d = u.getNode(), f = c ? i : s, h = f.getNode();
2824
+ if (t.is(d)) {
2825
+ const g = u.offset;
2826
+ (e <= g && r > 0 || e < g && r < 0) && u.set(a, Math.max(0, g + r), "element");
2827
+ }
2828
+ if (t.is(h)) {
2829
+ const g = f.offset;
2830
+ (e <= g && r > 0 || e < g && r < 0) && f.set(a, Math.max(0, g + r), "element");
2831
+ }
2832
+ }
2833
+ Lr(n);
2834
+ }
2835
+ function Lr(n) {
2836
+ const t = n.anchor, e = t.offset, r = n.focus, i = r.offset, s = t.getNode(), o = r.getNode();
2837
+ if (n.isCollapsed()) {
2838
+ if (!S(s)) return;
2839
+ const l = s.getChildrenSize(), a = e >= l, c = a ? s.getChildAtIndex(l - 1) : s.getChildAtIndex(e);
2840
+ if (E(c)) {
2841
+ let u = 0;
2842
+ a && (u = c.getTextContentSize()), t.set(c.__key, u, "text"), r.set(c.__key, u, "text");
2843
+ }
2844
+ } else {
2845
+ if (S(s)) {
2846
+ const l = s.getChildrenSize(), a = e >= l, c = a ? s.getChildAtIndex(l - 1) : s.getChildAtIndex(e);
2847
+ if (E(c)) {
2848
+ let u = 0;
2849
+ a && (u = c.getTextContentSize()), t.set(c.__key, u, "text");
2850
+ }
2851
+ }
2852
+ if (S(o)) {
2853
+ const l = o.getChildrenSize(), a = i >= l, c = a ? o.getChildAtIndex(l - 1) : o.getChildAtIndex(i);
2854
+ if (E(c)) {
2855
+ let u = 0;
2856
+ a && (u = c.getTextContentSize()), r.set(c.__key, u, "text");
2857
+ }
2858
+ }
2859
+ }
2860
+ }
2861
+ function Ae(n, t, e, r, i) {
2862
+ let s = null, o = 0, l = null;
2863
+ r !== null ? (s = r.__key, E(r) ? (o = r.getTextContentSize(), l = "text") : S(r) && (o = r.getChildrenSize(), l = "element")) : i !== null && (s = i.__key, E(i) ? l = "text" : S(i) && (l = "element")), s !== null && l !== null ? n.set(s, o, l) : (o = t.getIndexWithinParent(), o === -1 && (o = e.getChildrenSize()), n.set(e.__key, o, "element"));
2864
+ }
2865
+ function Or(n, t, e, r, i) {
2866
+ n.type === "text" ? (n.key = e, t || (n.offset += i)) : n.offset > r.getIndexWithinParent() && (n.offset -= 1);
2867
+ }
2868
+ function qs(n, t, e, r, i, s, o) {
2869
+ const l = r.anchorNode, a = r.focusNode, c = r.anchorOffset, u = r.focusOffset, d = document.activeElement;
2870
+ if (i.has("collaboration") && d !== s || d !== null && Zr(d)) return;
2871
+ if (!F(t)) return void (n !== null && We(e, l, a) && r.removeAllRanges());
2872
+ const f = t.anchor, h = t.focus, g = f.key, _ = h.key, p = Fe(e, g), m = Fe(e, _), y = f.offset, x = h.offset, b = t.format, k = t.style, v = t.isCollapsed();
2873
+ let P = p, C = m, N = !1;
2874
+ if (f.type === "text") {
2875
+ P = Ne(p);
2876
+ const z = f.getNode();
2877
+ N = z.getFormat() !== b || z.getStyle() !== k;
2878
+ } else F(n) && n.anchor.type === "text" && (N = !0);
2879
+ var D, O, B, L, R;
2880
+ if (h.type === "text" && (C = Ne(m)), P !== null && C !== null && (v && (n === null || N || F(n) && (n.format !== b || n.style !== k)) && (D = b, O = k, B = y, L = g, R = performance.now(), mi = [D, O, B, L, R]), c !== y || u !== x || l !== P || a !== C || r.type === "Range" && v || (d !== null && s.contains(d) || s.focus({ preventScroll: !0 }), f.type === "element"))) {
2881
+ try {
2882
+ r.setBaseAndExtent(P, y, C, x);
2883
+ } catch {
2884
+ }
2885
+ if (!i.has("skip-scroll-into-view") && t.isCollapsed() && s !== null && s === document.activeElement) {
2886
+ const z = t instanceof Tt && t.anchor.type === "element" ? P.childNodes[y] || null : r.rangeCount > 0 ? r.getRangeAt(0) : null;
2887
+ if (z !== null) {
2888
+ let dt;
2889
+ if (z instanceof Text) {
2890
+ const Dt = document.createRange();
2891
+ Dt.selectNode(z), dt = Dt.getBoundingClientRect();
2892
+ } else dt = z.getBoundingClientRect();
2893
+ (function(Dt, fe, Gn) {
2894
+ const Qn = Gn.ownerDocument, Xn = Qn.defaultView;
2895
+ if (Xn === null) return;
2896
+ let { top: Ze, bottom: tn } = fe, de = 0, he = 0, ht = Gn;
2897
+ for (; ht !== null; ) {
2898
+ const en = ht === Qn.body;
2899
+ if (en) de = 0, he = $e(Dt).innerHeight;
2900
+ else {
2901
+ const ge = ht.getBoundingClientRect();
2902
+ de = ge.top, he = ge.bottom;
2903
+ }
2904
+ let Wt = 0;
2905
+ if (Ze < de ? Wt = -(de - Ze) : tn > he && (Wt = tn - he), Wt !== 0) if (en) Xn.scrollBy(0, Wt);
2906
+ else {
2907
+ const ge = ht.scrollTop;
2908
+ ht.scrollTop += Wt;
2909
+ const Yn = ht.scrollTop - ge;
2910
+ Ze -= Yn, tn -= Yn;
2911
+ }
2912
+ if (en) break;
2913
+ ht = se(ht);
2914
+ }
2915
+ })(e, dt, s);
2916
+ }
2917
+ }
2918
+ Tn = !0;
2919
+ }
2920
+ }
2921
+ function So(n) {
2922
+ let t = M() || ae();
2923
+ t === null && (t = Y().selectEnd()), t.insertNodes(n);
2924
+ }
2925
+ function fn(n) {
2926
+ let t = n;
2927
+ n.isCollapsed() || t.removeText();
2928
+ const e = M();
2929
+ F(e) && (t = e), F(t) || T(161);
2930
+ const r = t.anchor;
2931
+ let i = r.getNode(), s = r.offset;
2932
+ for (; !_t(i); ) [i, s] = Gs(i, s);
2933
+ return s;
2934
+ }
2935
+ function Gs(n, t) {
2936
+ const e = n.getParent();
2937
+ if (!e) {
2938
+ const i = vt();
2939
+ return Y().append(i), i.select(), [Y(), 0];
2940
+ }
2941
+ if (E(n)) {
2942
+ const i = n.splitText(t);
2943
+ if (i.length === 0) return [e, n.getIndexWithinParent()];
2944
+ const s = t === 0 ? 0 : 1;
2945
+ return [e, i[0].getIndexWithinParent() + s];
2946
+ }
2947
+ if (!S(n) || t === 0) return [e, n.getIndexWithinParent()];
2948
+ const r = n.getChildAtIndex(t);
2949
+ if (r) {
2950
+ const i = new Tt(st(n.__key, t, "element"), st(n.__key, t, "element"), 0, ""), s = n.insertNewAfter(i);
2951
+ s && s.append(r, ...r.getNextSiblings());
2952
+ }
2953
+ return [e, n.getIndexWithinParent() + 1];
2954
+ }
2955
+ let K = null, J = null, G = !1, dn = !1, xe = 0;
2956
+ const Mr = { characterData: !0, childList: !0, subtree: !0 };
2957
+ function ce() {
2958
+ return G || K !== null && K._readOnly;
2959
+ }
2960
+ function q() {
2961
+ G && T(13);
2962
+ }
2963
+ function Ei() {
2964
+ xe > 99 && T(14);
2965
+ }
2966
+ function ft() {
2967
+ return K === null && T(195, Pi()), K;
2968
+ }
2969
+ function A() {
2970
+ return J === null && T(196, Pi()), J;
2971
+ }
2972
+ function Pi() {
2973
+ let n = 0;
2974
+ const t = /* @__PURE__ */ new Set(), e = Ye.version;
2975
+ if (typeof window < "u") for (const i of document.querySelectorAll("[contenteditable]")) {
2976
+ const s = Re(i);
2977
+ if (Bn(s)) n++;
2978
+ else if (s) {
2979
+ let o = String(s.constructor.version || "<0.17.1");
2980
+ o === e && (o += " (separately built, likely a bundler configuration issue)"), t.add(o);
2981
+ }
2982
+ }
2983
+ let r = ` Detected on the page: ${n} compatible editor(s) with version ${e}`;
2984
+ return t.size && (r += ` and incompatible editors with versions ${Array.from(t).join(", ")}`), r;
2985
+ }
2986
+ function Qs() {
2987
+ return J;
2988
+ }
2989
+ function Ir(n, t, e) {
2990
+ const r = t.__type, i = function(l, a) {
2991
+ const c = l._nodes.get(a);
2992
+ return c === void 0 && T(30, a), c;
2993
+ }(n, r);
2994
+ let s = e.get(r);
2995
+ s === void 0 && (s = Array.from(i.transforms), e.set(r, s));
2996
+ const o = s.length;
2997
+ for (let l = 0; l < o && (s[l](t), t.isAttached()); l++) ;
2998
+ }
2999
+ function Ar(n, t) {
3000
+ return n !== void 0 && n.__key !== t && n.isAttached();
3001
+ }
3002
+ function Fi(n, t) {
3003
+ if (!t) return;
3004
+ const e = n._updateTags;
3005
+ let r = t;
3006
+ Array.isArray(t) || (r = [t]);
3007
+ for (const i of r) e.add(i);
3008
+ }
3009
+ function Co(n) {
3010
+ return Hn(n, A()._nodes);
3011
+ }
3012
+ function Hn(n, t) {
3013
+ const e = n.type, r = t.get(e);
3014
+ r === void 0 && T(17, e);
3015
+ const i = r.klass;
3016
+ n.type !== i.getType() && T(18, i.name);
3017
+ const s = i.importJSON(n), o = n.children;
3018
+ if (S(s) && Array.isArray(o)) for (let l = 0; l < o.length; l++) {
3019
+ const a = Hn(o[l], t);
3020
+ s.append(a);
3021
+ }
3022
+ return s;
3023
+ }
3024
+ function Br(n, t, e) {
3025
+ const r = K, i = G, s = J;
3026
+ K = t, G = !0, J = n;
3027
+ try {
3028
+ return e();
3029
+ } finally {
3030
+ K = r, G = i, J = s;
3031
+ }
3032
+ }
3033
+ function mt(n, t) {
3034
+ const e = n._pendingEditorState, r = n._rootElement, i = n._headless || r === null;
3035
+ if (e === null) return;
3036
+ const s = n._editorState, o = s._selection, l = e._selection, a = n._dirtyType !== Et, c = K, u = G, d = J, f = n._updating, h = n._observer;
3037
+ let g = null;
3038
+ if (n._pendingEditorState = null, n._editorState = e, !i && a && h !== null) {
3039
+ J = n, K = e, G = !1, n._updating = !0;
3040
+ try {
3041
+ const v = n._dirtyType, P = n._dirtyElements, C = n._dirtyLeaves;
3042
+ h.disconnect(), g = zs(s, e, n, v, P, C);
3043
+ } catch (v) {
3044
+ if (v instanceof Error && n._onError(v), dn) throw v;
3045
+ return Ii(n, null, r, e), Yr(n), n._dirtyType = At, dn = !0, mt(n, s), void (dn = !1);
3046
+ } finally {
3047
+ h.observe(r, Mr), n._updating = f, K = c, G = u, J = d;
3048
+ }
3049
+ }
3050
+ e._readOnly || (e._readOnly = !0);
3051
+ const _ = n._dirtyLeaves, p = n._dirtyElements, m = n._normalizedNodes, y = n._updateTags, x = n._deferred;
3052
+ a && (n._dirtyType = Et, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements = /* @__PURE__ */ new Map(), n._normalizedNodes = /* @__PURE__ */ new Set(), n._updateTags = /* @__PURE__ */ new Set()), function(v, P) {
3053
+ const C = v._decorators;
3054
+ let N = v._pendingDecorators || C;
3055
+ const D = P._nodeMap;
3056
+ let O;
3057
+ for (O in N) D.has(O) || (N === C && (N = ri(v)), delete N[O]);
3058
+ }(n, e);
3059
+ const b = i ? null : it(n._window);
3060
+ if (n._editable && b !== null && (a || l === null || l.dirty)) {
3061
+ J = n, K = e;
3062
+ try {
3063
+ if (h !== null && h.disconnect(), a || l === null || l.dirty) {
3064
+ const v = n._blockCursorElement;
3065
+ v !== null && $n(v, n, r), qs(o, l, n, b, y, r);
3066
+ }
3067
+ Ps(n, r, l), h !== null && h.observe(r, Mr);
3068
+ } finally {
3069
+ J = d, K = c;
3070
+ }
3071
+ }
3072
+ g !== null && function(v, P, C, N, D) {
3073
+ const O = Array.from(v._listeners.mutation), B = O.length;
3074
+ for (let L = 0; L < B; L++) {
3075
+ const [R, z] = O[L], dt = P.get(z);
3076
+ dt !== void 0 && R(dt, { dirtyLeaves: N, prevEditorState: D, updateTags: C });
3077
+ }
3078
+ }(n, g, y, _, s), F(l) || l === null || o !== null && o.is(l) || n.dispatchCommand(Nn, void 0);
3079
+ const k = n._pendingDecorators;
3080
+ k !== null && (n._decorators = k, n._pendingDecorators = null, Xt("decorator", n, !0, k)), function(v, P, C) {
3081
+ const N = lr(P), D = lr(C);
3082
+ N !== D && Xt("textcontent", v, !0, D);
3083
+ }(n, t || s, e), Xt("update", n, !0, { dirtyElements: p, dirtyLeaves: _, editorState: e, normalizedNodes: m, prevEditorState: t || s, tags: y }), function(v, P) {
3084
+ if (v._deferred = [], P.length !== 0) {
3085
+ const C = v._updating;
3086
+ v._updating = !0;
3087
+ try {
3088
+ for (let N = 0; N < P.length; N++) P[N]();
3089
+ } finally {
3090
+ v._updating = C;
3091
+ }
3092
+ }
3093
+ }(n, x), function(v) {
3094
+ const P = v._updates;
3095
+ if (P.length !== 0) {
3096
+ const C = P.shift();
3097
+ if (C) {
3098
+ const [N, D] = C;
3099
+ Li(v, N, D);
3100
+ }
3101
+ }
3102
+ }(n);
3103
+ }
3104
+ function Xt(n, t, e, ...r) {
3105
+ const i = t._updating;
3106
+ t._updating = e;
3107
+ try {
3108
+ const s = Array.from(t._listeners[n]);
3109
+ for (let o = 0; o < s.length; o++) s[o].apply(null, r);
3110
+ } finally {
3111
+ t._updating = i;
3112
+ }
3113
+ }
3114
+ function Di(n, t, e) {
3115
+ if (n._updating === !1 || J !== n) {
3116
+ let i = !1;
3117
+ return n.update(() => {
3118
+ i = Di(n, t, e);
3119
+ }), i;
3120
+ }
3121
+ const r = Wn(n);
3122
+ for (let i = 4; i >= 0; i--) for (let s = 0; s < r.length; s++) {
3123
+ const o = r[s]._commands.get(t);
3124
+ if (o !== void 0) {
3125
+ const l = o[i];
3126
+ if (l !== void 0) {
3127
+ const a = Array.from(l), c = a.length;
3128
+ for (let u = 0; u < c; u++) if (a[u](e, n) === !0) return !0;
3129
+ }
3130
+ }
3131
+ }
3132
+ return !1;
3133
+ }
3134
+ function zr(n, t) {
3135
+ const e = n._updates;
3136
+ let r = t || !1;
3137
+ for (; e.length !== 0; ) {
3138
+ const i = e.shift();
3139
+ if (i) {
3140
+ const [s, o] = i;
3141
+ let l;
3142
+ if (o !== void 0) {
3143
+ if (l = o.onUpdate, o.skipTransforms && (r = !0), o.discrete) {
3144
+ const a = n._pendingEditorState;
3145
+ a === null && T(191), a._flushSync = !0;
3146
+ }
3147
+ l && n._deferred.push(l), Fi(n, o.tag);
3148
+ }
3149
+ s();
3150
+ }
3151
+ }
3152
+ return r;
3153
+ }
3154
+ function Li(n, t, e) {
3155
+ const r = n._updateTags;
3156
+ let i, s = !1, o = !1;
3157
+ e !== void 0 && (i = e.onUpdate, Fi(n, e.tag), s = e.skipTransforms || !1, o = e.discrete || !1), i && n._deferred.push(i);
3158
+ const l = n._editorState;
3159
+ let a = n._pendingEditorState, c = !1;
3160
+ (a === null || a._readOnly) && (a = n._pendingEditorState = Oi(a || l), c = !0), a._flushSync = o;
3161
+ const u = K, d = G, f = J, h = n._updating;
3162
+ K = a, G = !1, n._updating = !0, J = n;
3163
+ try {
3164
+ c && (n._headless ? l._selection !== null && (a._selection = l._selection.clone()) : a._selection = function(m) {
3165
+ const y = m.getEditorState()._selection, x = it(m._window);
3166
+ return F(y) || y == null ? Ge(y, x, m, null) : y.clone();
3167
+ }(n));
3168
+ const _ = n._compositionKey;
3169
+ t(), s = zr(n, s), function(m, y) {
3170
+ const x = y.getEditorState()._selection, b = m._selection;
3171
+ if (F(b)) {
3172
+ const k = b.anchor, v = b.focus;
3173
+ let P;
3174
+ if (k.type === "text" && (P = k.getNode(), P.selectionTransform(x, b)), v.type === "text") {
3175
+ const C = v.getNode();
3176
+ P !== C && C.selectionTransform(x, b);
3177
+ }
3178
+ }
3179
+ }(a, n), n._dirtyType !== Et && (s ? function(m, y) {
3180
+ const x = y._dirtyLeaves, b = m._nodeMap;
3181
+ for (const k of x) {
3182
+ const v = b.get(k);
3183
+ E(v) && v.isAttached() && v.isSimpleText() && !v.isUnmergeable() && sr(v);
3184
+ }
3185
+ }(a, n) : function(m, y) {
3186
+ const x = y._dirtyLeaves, b = y._dirtyElements, k = m._nodeMap, v = yt(), P = /* @__PURE__ */ new Map();
3187
+ let C = x, N = C.size, D = b, O = D.size;
3188
+ for (; N > 0 || O > 0; ) {
3189
+ if (N > 0) {
3190
+ y._dirtyLeaves = /* @__PURE__ */ new Set();
3191
+ for (const B of C) {
3192
+ const L = k.get(B);
3193
+ E(L) && L.isAttached() && L.isSimpleText() && !L.isUnmergeable() && sr(L), L !== void 0 && Ar(L, v) && Ir(y, L, P), x.add(B);
3194
+ }
3195
+ if (C = y._dirtyLeaves, N = C.size, N > 0) {
3196
+ xe++;
3197
+ continue;
3198
+ }
3199
+ }
3200
+ y._dirtyLeaves = /* @__PURE__ */ new Set(), y._dirtyElements = /* @__PURE__ */ new Map();
3201
+ for (const B of D) {
3202
+ const L = B[0], R = B[1];
3203
+ if (L !== "root" && !R) continue;
3204
+ const z = k.get(L);
3205
+ z !== void 0 && Ar(z, v) && Ir(y, z, P), b.set(L, R);
3206
+ }
3207
+ C = y._dirtyLeaves, N = C.size, D = y._dirtyElements, O = D.size, xe++;
3208
+ }
3209
+ y._dirtyLeaves = x, y._dirtyElements = b;
3210
+ }(a, n), zr(n), function(m, y, x, b) {
3211
+ const k = m._nodeMap, v = y._nodeMap, P = [];
3212
+ for (const [C] of b) {
3213
+ const N = v.get(C);
3214
+ N !== void 0 && (N.isAttached() || (S(N) && ci(N, C, k, v, P, b), k.has(C) || b.delete(C), P.push(C)));
3215
+ }
3216
+ for (const C of P) v.delete(C);
3217
+ for (const C of x) {
3218
+ const N = v.get(C);
3219
+ N === void 0 || N.isAttached() || (k.has(C) || x.delete(C), v.delete(C));
3220
+ }
3221
+ }(l, a, n._dirtyLeaves, n._dirtyElements)), _ !== n._compositionKey && (a._flushSync = !0);
3222
+ const p = a._selection;
3223
+ if (F(p)) {
3224
+ const m = a._nodeMap, y = p.anchor.key, x = p.focus.key;
3225
+ m.get(y) !== void 0 && m.get(x) !== void 0 || T(19);
3226
+ } else jn(p) && p._nodes.size === 0 && (a._selection = null);
3227
+ } catch (_) {
3228
+ return _ instanceof Error && n._onError(_), n._pendingEditorState = l, n._dirtyType = At, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements.clear(), void mt(n);
3229
+ } finally {
3230
+ K = u, G = d, J = f, n._updating = h, xe = 0;
3231
+ }
3232
+ n._dirtyType !== Et || function(_, p) {
3233
+ const m = p.getEditorState()._selection, y = _._selection;
3234
+ if (y !== null) {
3235
+ if (y.dirty || !y.is(m)) return !0;
3236
+ } else if (m !== null) return !0;
3237
+ return !1;
3238
+ }(a, n) ? a._flushSync ? (a._flushSync = !1, mt(n)) : c && ks(() => {
3239
+ mt(n);
3240
+ }) : (a._flushSync = !1, c && (r.clear(), n._deferred = [], n._pendingEditorState = null));
3241
+ }
3242
+ function Q(n, t, e) {
3243
+ n._updating ? n._updates.push([t, e]) : Li(n, t, e);
3244
+ }
3245
+ class Yt {
3246
+ constructor(t, e, r) {
3247
+ this.element = t, this.before = e || null, this.after = r || null;
3248
+ }
3249
+ withBefore(t) {
3250
+ return new Yt(this.element, t, this.after);
3251
+ }
3252
+ withAfter(t) {
3253
+ return new Yt(this.element, this.before, t);
3254
+ }
3255
+ withElement(t) {
3256
+ return new Yt(t, this.before, this.after);
3257
+ }
3258
+ insertChild(t) {
3259
+ const e = this.before || this.getManagedLineBreak();
3260
+ return e !== null && e.parentElement !== this.element && T(222), this.element.insertBefore(t, e), this;
3261
+ }
3262
+ removeChild(t) {
3263
+ return t.parentElement !== this.element && T(223), this.element.removeChild(t), this;
3264
+ }
3265
+ replaceChild(t, e) {
3266
+ return e.parentElement !== this.element && T(224), this.element.replaceChild(t, e), this;
3267
+ }
3268
+ getFirstChild() {
3269
+ const t = this.after ? this.after.nextSibling : this.element.firstChild;
3270
+ return t === this.before || t === this.getManagedLineBreak() ? null : t;
3271
+ }
3272
+ getManagedLineBreak() {
3273
+ return this.element.__lexicalLineBreak || null;
3274
+ }
3275
+ setManagedLineBreak(t) {
3276
+ if (t === null) this.removeManagedLineBreak();
3277
+ else {
3278
+ const e = t === "decorator" && (re || Be);
3279
+ this.insertManagedLineBreak(e);
3280
+ }
3281
+ }
3282
+ removeManagedLineBreak() {
3283
+ const t = this.getManagedLineBreak();
3284
+ if (t) {
3285
+ const e = this.element, r = t.nodeName === "IMG" ? t.nextSibling : null;
3286
+ r && e.removeChild(r), e.removeChild(t), e.__lexicalLineBreak = void 0;
3287
+ }
3288
+ }
3289
+ insertManagedLineBreak(t) {
3290
+ const e = this.getManagedLineBreak();
3291
+ if (e) {
3292
+ if (t === (e.nodeName === "IMG")) return;
3293
+ this.removeManagedLineBreak();
3294
+ }
3295
+ const r = this.element, i = this.before, s = document.createElement("br");
3296
+ if (r.insertBefore(s, i), t) {
3297
+ const o = document.createElement("img");
3298
+ o.setAttribute("data-lexical-linebreak", "true"), o.style.cssText = "display: inline !important; border: 0px !important; margin: 0px !important;", o.alt = "", r.insertBefore(o, s), r.__lexicalLineBreak = o;
3299
+ } else r.__lexicalLineBreak = s;
3300
+ }
3301
+ getFirstChildOffset() {
3302
+ let t = 0;
3303
+ for (let e = this.after; e !== null; e = e.previousSibling) t++;
3304
+ return t;
3305
+ }
3306
+ resolveChildIndex(t, e, r, i) {
3307
+ if (r === this.element) {
3308
+ const a = this.getFirstChildOffset();
3309
+ return [t, Math.min(a + t.getChildrenSize(), Math.max(a, i))];
3310
+ }
3311
+ const s = Wr(e, r);
3312
+ s.push(i);
3313
+ const o = Wr(e, this.element);
3314
+ let l = t.getIndexWithinParent();
3315
+ for (let a = 0; a < o.length; a++) {
3316
+ const c = s[a], u = o[a];
3317
+ if (c === void 0 || c < u) break;
3318
+ if (c > u) {
3319
+ l += 1;
3320
+ break;
3321
+ }
3322
+ }
3323
+ return [t.getParentOrThrow(), l];
3324
+ }
3325
+ }
3326
+ function Wr(n, t) {
3327
+ const e = [];
3328
+ let r = t;
3329
+ for (; r !== n && r !== null; r = t.parentNode) {
3330
+ let i = 0;
3331
+ for (let s = r.previousSibling; s !== null; s = r.previousSibling) i++;
3332
+ e.push(i);
3333
+ }
3334
+ return r !== n && T(225), e.reverse();
3335
+ }
3336
+ class Qe extends He {
3337
+ constructor(t) {
3338
+ super(t), this.__first = null, this.__last = null, this.__size = 0, this.__format = 0, this.__style = "", this.__indent = 0, this.__dir = null;
3339
+ }
3340
+ afterCloneFrom(t) {
3341
+ super.afterCloneFrom(t), this.__first = t.__first, this.__last = t.__last, this.__size = t.__size, this.__indent = t.__indent, this.__format = t.__format, this.__style = t.__style, this.__dir = t.__dir;
3342
+ }
3343
+ getFormat() {
3344
+ return this.getLatest().__format;
3345
+ }
3346
+ getFormatType() {
3347
+ const t = this.getFormat();
3348
+ return hs[t] || "";
3349
+ }
3350
+ getStyle() {
3351
+ return this.getLatest().__style;
3352
+ }
3353
+ getIndent() {
3354
+ return this.getLatest().__indent;
3355
+ }
3356
+ getChildren() {
3357
+ const t = [];
3358
+ let e = this.getFirstChild();
3359
+ for (; e !== null; ) t.push(e), e = e.getNextSibling();
3360
+ return t;
3361
+ }
3362
+ getChildrenKeys() {
3363
+ const t = [];
3364
+ let e = this.getFirstChild();
3365
+ for (; e !== null; ) t.push(e.__key), e = e.getNextSibling();
3366
+ return t;
3367
+ }
3368
+ getChildrenSize() {
3369
+ return this.getLatest().__size;
3370
+ }
3371
+ isEmpty() {
3372
+ return this.getChildrenSize() === 0;
3373
+ }
3374
+ isDirty() {
3375
+ const t = A()._dirtyElements;
3376
+ return t !== null && t.has(this.__key);
3377
+ }
3378
+ isLastChild() {
3379
+ const t = this.getLatest(), e = this.getParentOrThrow().getLastChild();
3380
+ return e !== null && e.is(t);
3381
+ }
3382
+ getAllTextNodes() {
3383
+ const t = [];
3384
+ let e = this.getFirstChild();
3385
+ for (; e !== null; ) {
3386
+ if (E(e) && t.push(e), S(e)) {
3387
+ const r = e.getAllTextNodes();
3388
+ t.push(...r);
3389
+ }
3390
+ e = e.getNextSibling();
3391
+ }
3392
+ return t;
3393
+ }
3394
+ getFirstDescendant() {
3395
+ let t = this.getFirstChild();
3396
+ for (; S(t); ) {
3397
+ const e = t.getFirstChild();
3398
+ if (e === null) break;
3399
+ t = e;
3400
+ }
3401
+ return t;
3402
+ }
3403
+ getLastDescendant() {
3404
+ let t = this.getLastChild();
3405
+ for (; S(t); ) {
3406
+ const e = t.getLastChild();
3407
+ if (e === null) break;
3408
+ t = e;
3409
+ }
3410
+ return t;
3411
+ }
3412
+ getDescendantByIndex(t) {
3413
+ const e = this.getChildren(), r = e.length;
3414
+ if (t >= r) {
3415
+ const s = e[r - 1];
3416
+ return S(s) && s.getLastDescendant() || s || null;
3417
+ }
3418
+ const i = e[t];
3419
+ return S(i) && i.getFirstDescendant() || i || null;
3420
+ }
3421
+ getFirstChild() {
3422
+ const t = this.getLatest().__first;
3423
+ return t === null ? null : V(t);
3424
+ }
3425
+ getFirstChildOrThrow() {
3426
+ const t = this.getFirstChild();
3427
+ return t === null && T(45, this.__key), t;
3428
+ }
3429
+ getLastChild() {
3430
+ const t = this.getLatest().__last;
3431
+ return t === null ? null : V(t);
3432
+ }
3433
+ getLastChildOrThrow() {
3434
+ const t = this.getLastChild();
3435
+ return t === null && T(96, this.__key), t;
3436
+ }
3437
+ getChildAtIndex(t) {
3438
+ const e = this.getChildrenSize();
3439
+ let r, i;
3440
+ if (t < e / 2) {
3441
+ for (r = this.getFirstChild(), i = 0; r !== null && i <= t; ) {
3442
+ if (i === t) return r;
3443
+ r = r.getNextSibling(), i++;
3444
+ }
3445
+ return null;
3446
+ }
3447
+ for (r = this.getLastChild(), i = e - 1; r !== null && i >= t; ) {
3448
+ if (i === t) return r;
3449
+ r = r.getPreviousSibling(), i--;
3450
+ }
3451
+ return null;
3452
+ }
3453
+ getTextContent() {
3454
+ let t = "";
3455
+ const e = this.getChildren(), r = e.length;
3456
+ for (let i = 0; i < r; i++) {
3457
+ const s = e[i];
3458
+ t += s.getTextContent(), S(s) && i !== r - 1 && !s.isInline() && (t += ct);
3459
+ }
3460
+ return t;
3461
+ }
3462
+ getTextContentSize() {
3463
+ let t = 0;
3464
+ const e = this.getChildren(), r = e.length;
3465
+ for (let i = 0; i < r; i++) {
3466
+ const s = e[i];
3467
+ t += s.getTextContentSize(), S(s) && i !== r - 1 && !s.isInline() && (t += ct.length);
3468
+ }
3469
+ return t;
3470
+ }
3471
+ getDirection() {
3472
+ return this.getLatest().__dir;
3473
+ }
3474
+ hasFormat(t) {
3475
+ if (t !== "") {
3476
+ const e = nr[t];
3477
+ return !!(this.getFormat() & e);
3478
+ }
3479
+ return !1;
3480
+ }
3481
+ select(t, e) {
3482
+ q();
3483
+ const r = M();
3484
+ let i = t, s = e;
3485
+ const o = this.getChildrenSize();
3486
+ if (!this.canBeEmpty()) {
3487
+ if (t === 0 && e === 0) {
3488
+ const a = this.getFirstChild();
3489
+ if (E(a) || S(a)) return a.select(0, 0);
3490
+ } else if (!(t !== void 0 && t !== o || e !== void 0 && e !== o)) {
3491
+ const a = this.getLastChild();
3492
+ if (E(a) || S(a)) return a.select();
3493
+ }
3494
+ }
3495
+ i === void 0 && (i = o), s === void 0 && (s = o);
3496
+ const l = this.__key;
3497
+ return F(r) ? (r.anchor.set(l, i, "element"), r.focus.set(l, s, "element"), r.dirty = !0, r) : Ni(l, i, l, s, "element", "element");
3498
+ }
3499
+ selectStart() {
3500
+ const t = this.getFirstDescendant();
3501
+ return t ? t.selectStart() : this.select();
3502
+ }
3503
+ selectEnd() {
3504
+ const t = this.getLastDescendant();
3505
+ return t ? t.selectEnd() : this.select();
3506
+ }
3507
+ clear() {
3508
+ const t = this.getWritable();
3509
+ return this.getChildren().forEach((e) => e.remove()), t;
3510
+ }
3511
+ append(...t) {
3512
+ return this.splice(this.getChildrenSize(), 0, t);
3513
+ }
3514
+ setDirection(t) {
3515
+ const e = this.getWritable();
3516
+ return e.__dir = t, e;
3517
+ }
3518
+ setFormat(t) {
3519
+ return this.getWritable().__format = t !== "" ? nr[t] : 0, this;
3520
+ }
3521
+ setStyle(t) {
3522
+ return this.getWritable().__style = t || "", this;
3523
+ }
3524
+ setIndent(t) {
3525
+ return this.getWritable().__indent = t, this;
3526
+ }
3527
+ splice(t, e, r) {
3528
+ const i = r.length, s = this.getChildrenSize(), o = this.getWritable();
3529
+ t + e <= s || T(226, String(t), String(e), String(s));
3530
+ const l = o.__key, a = [], c = [], u = this.getChildAtIndex(t + e);
3531
+ let d = null, f = s - e + i;
3532
+ if (t !== 0) if (t === s) d = this.getLastChild();
3533
+ else {
3534
+ const g = this.getChildAtIndex(t);
3535
+ g !== null && (d = g.getPreviousSibling());
3536
+ }
3537
+ if (e > 0) {
3538
+ let g = d === null ? this.getFirstChild() : d.getNextSibling();
3539
+ for (let _ = 0; _ < e; _++) {
3540
+ g === null && T(100);
3541
+ const p = g.getNextSibling(), m = g.__key;
3542
+ Nt(g.getWritable()), c.push(m), g = p;
3543
+ }
3544
+ }
3545
+ let h = d;
3546
+ for (let g = 0; g < i; g++) {
3547
+ const _ = r[g];
3548
+ h !== null && _.is(h) && (d = h = h.getPreviousSibling());
3549
+ const p = _.getWritable();
3550
+ p.__parent === l && f--, Nt(p);
3551
+ const m = _.__key;
3552
+ if (h === null) o.__first = m, p.__prev = null;
3553
+ else {
3554
+ const y = h.getWritable();
3555
+ y.__next = m, p.__prev = y.__key;
3556
+ }
3557
+ _.__key === l && T(76), p.__parent = l, a.push(m), h = _;
3558
+ }
3559
+ if (t + e === s)
3560
+ h !== null && (h.getWritable().__next = null, o.__last = h.__key);
3561
+ else if (u !== null) {
3562
+ const g = u.getWritable();
3563
+ if (h !== null) {
3564
+ const _ = h.getWritable();
3565
+ g.__prev = h.__key, _.__next = u.__key;
3566
+ } else g.__prev = null;
3567
+ }
3568
+ if (o.__size = f, c.length) {
3569
+ const g = M();
3570
+ if (F(g)) {
3571
+ const _ = new Set(c), p = new Set(a), { anchor: m, focus: y } = g;
3572
+ Rr(m, _, p) && Ae(m, m.getNode(), this, d, u), Rr(y, _, p) && Ae(y, y.getNode(), this, d, u), f !== 0 || this.canBeEmpty() || Pt(this) || this.remove();
3573
+ }
3574
+ }
3575
+ return o;
3576
+ }
3577
+ getDOMSlot(t) {
3578
+ return new Yt(t);
3579
+ }
3580
+ exportDOM(t) {
3581
+ const { element: e } = super.exportDOM(t);
3582
+ if (e && Ve(e)) {
3583
+ const r = this.getIndent();
3584
+ r > 0 && (e.style.paddingInlineStart = 40 * r + "px");
3585
+ }
3586
+ return { element: e };
3587
+ }
3588
+ exportJSON() {
3589
+ return { children: [], direction: this.getDirection(), format: this.getFormatType(), indent: this.getIndent(), type: "element", version: 1 };
3590
+ }
3591
+ insertNewAfter(t, e) {
3592
+ return null;
3593
+ }
3594
+ canIndent() {
3595
+ return !0;
3596
+ }
3597
+ collapseAtStart(t) {
3598
+ return !1;
3599
+ }
3600
+ excludeFromCopy(t) {
3601
+ return !1;
3602
+ }
3603
+ canReplaceWith(t) {
3604
+ return !0;
3605
+ }
3606
+ canInsertAfter(t) {
3607
+ return !0;
3608
+ }
3609
+ canBeEmpty() {
3610
+ return !0;
3611
+ }
3612
+ canInsertTextBefore() {
3613
+ return !0;
3614
+ }
3615
+ canInsertTextAfter() {
3616
+ return !0;
3617
+ }
3618
+ isInline() {
3619
+ return !1;
3620
+ }
3621
+ isShadowRoot() {
3622
+ return !1;
3623
+ }
3624
+ canMergeWith(t) {
3625
+ return !1;
3626
+ }
3627
+ extractWithChild(t, e, r) {
3628
+ return !1;
3629
+ }
3630
+ canMergeWhenEmpty() {
3631
+ return !1;
3632
+ }
3633
+ reconcileObservedMutation(t, e) {
3634
+ const r = this.getDOMSlot(t);
3635
+ let i = r.getFirstChild();
3636
+ for (let s = this.getFirstChild(); s; s = s.getNextSibling()) {
3637
+ const o = e.getElementByKey(s.getKey());
3638
+ o !== null && (i == null ? (r.insertChild(o), i = o) : i !== o && r.replaceChild(o, i), i = i.nextSibling);
3639
+ }
3640
+ }
3641
+ }
3642
+ function S(n) {
3643
+ return n instanceof Qe;
3644
+ }
3645
+ function Rr(n, t, e) {
3646
+ let r = n.getNode();
3647
+ for (; r; ) {
3648
+ const i = r.__key;
3649
+ if (t.has(i) && !e.has(i)) return !0;
3650
+ r = r.getParent();
3651
+ }
3652
+ return !1;
3653
+ }
3654
+ class Xs extends He {
3655
+ constructor(t) {
3656
+ super(t);
3657
+ }
3658
+ decorate(t, e) {
3659
+ T(47);
3660
+ }
3661
+ isIsolated() {
3662
+ return !1;
3663
+ }
3664
+ isInline() {
3665
+ return !0;
3666
+ }
3667
+ isKeyboardSelectable() {
3668
+ return !0;
3669
+ }
3670
+ }
3671
+ function I(n) {
3672
+ return n instanceof Xs;
3673
+ }
3674
+ class ue extends Qe {
3675
+ static getType() {
3676
+ return "root";
3677
+ }
3678
+ static clone() {
3679
+ return new ue();
3680
+ }
3681
+ constructor() {
3682
+ super("root"), this.__cachedText = null;
3683
+ }
3684
+ getTopLevelElementOrThrow() {
3685
+ T(51);
3686
+ }
3687
+ getTextContent() {
3688
+ const t = this.__cachedText;
3689
+ return !ce() && A()._dirtyType !== Et || t === null ? super.getTextContent() : t;
3690
+ }
3691
+ remove() {
3692
+ T(52);
3693
+ }
3694
+ replace(t) {
3695
+ T(53);
3696
+ }
3697
+ insertBefore(t) {
3698
+ T(54);
3699
+ }
3700
+ insertAfter(t) {
3701
+ T(55);
3702
+ }
3703
+ updateDOM(t, e) {
3704
+ return !1;
3705
+ }
3706
+ append(...t) {
3707
+ for (let e = 0; e < t.length; e++) {
3708
+ const r = t[e];
3709
+ S(r) || I(r) || T(56);
3710
+ }
3711
+ return super.append(...t);
3712
+ }
3713
+ static importJSON(t) {
3714
+ const e = Y();
3715
+ return e.setFormat(t.format), e.setIndent(t.indent), e.setDirection(t.direction), e;
3716
+ }
3717
+ exportJSON() {
3718
+ return { children: [], direction: this.getDirection(), format: this.getFormatType(), indent: this.getIndent(), type: "root", version: 1 };
3719
+ }
3720
+ collapseAtStart() {
3721
+ return !0;
3722
+ }
3723
+ }
3724
+ function X(n) {
3725
+ return n instanceof ue;
3726
+ }
3727
+ function Oi(n) {
3728
+ return new Xe(new Map(n._nodeMap));
3729
+ }
3730
+ function qn() {
3731
+ return new Xe(/* @__PURE__ */ new Map([["root", new ue()]]));
3732
+ }
3733
+ function Mi(n) {
3734
+ const t = n.exportJSON(), e = n.constructor;
3735
+ if (t.type !== e.getType() && T(130, e.name), S(n)) {
3736
+ const r = t.children;
3737
+ Array.isArray(r) || T(59, e.name);
3738
+ const i = n.getChildren();
3739
+ for (let s = 0; s < i.length; s++) {
3740
+ const o = Mi(i[s]);
3741
+ r.push(o);
3742
+ }
3743
+ }
3744
+ return t;
3745
+ }
3746
+ class Xe {
3747
+ constructor(t, e) {
3748
+ this._nodeMap = t, this._selection = e || null, this._flushSync = !1, this._readOnly = !1;
3749
+ }
3750
+ isEmpty() {
3751
+ return this._nodeMap.size === 1 && this._selection === null;
3752
+ }
3753
+ read(t, e) {
3754
+ return Br(e && e.editor || null, this, t);
3755
+ }
3756
+ clone(t) {
3757
+ const e = new Xe(this._nodeMap, t === void 0 ? this._selection : t);
3758
+ return e._readOnly = !0, e;
3759
+ }
3760
+ toJSON() {
3761
+ return Br(null, this, () => ({ root: Mi(Y()) }));
3762
+ }
3763
+ }
3764
+ class Ys extends Qe {
3765
+ static getType() {
3766
+ return "artificial";
3767
+ }
3768
+ createDOM(t) {
3769
+ return document.createElement("div");
3770
+ }
3771
+ }
3772
+ class zt extends Qe {
3773
+ constructor(t) {
3774
+ super(t), this.__textFormat = 0, this.__textStyle = "";
3775
+ }
3776
+ static getType() {
3777
+ return "paragraph";
3778
+ }
3779
+ getTextFormat() {
3780
+ return this.getLatest().__textFormat;
3781
+ }
3782
+ setTextFormat(t) {
3783
+ const e = this.getWritable();
3784
+ return e.__textFormat = t, e;
3785
+ }
3786
+ hasTextFormat(t) {
3787
+ const e = at[t];
3788
+ return !!(this.getTextFormat() & e);
3789
+ }
3790
+ getFormatFlags(t, e) {
3791
+ return Ee(this.getLatest().__textFormat, t, e);
3792
+ }
3793
+ getTextStyle() {
3794
+ return this.getLatest().__textStyle;
3795
+ }
3796
+ setTextStyle(t) {
3797
+ const e = this.getWritable();
3798
+ return e.__textStyle = t, e;
3799
+ }
3800
+ static clone(t) {
3801
+ return new zt(t.__key);
3802
+ }
3803
+ afterCloneFrom(t) {
3804
+ super.afterCloneFrom(t), this.__textFormat = t.__textFormat, this.__textStyle = t.__textStyle;
3805
+ }
3806
+ createDOM(t) {
3807
+ const e = document.createElement("p"), r = Ht(t.theme, "paragraph");
3808
+ return r !== void 0 && e.classList.add(...r), e;
3809
+ }
3810
+ updateDOM(t, e, r) {
3811
+ return !1;
3812
+ }
3813
+ static importDOM() {
3814
+ return { p: (t) => ({ conversion: Zs, priority: 0 }) };
3815
+ }
3816
+ exportDOM(t) {
3817
+ const { element: e } = super.exportDOM(t);
3818
+ if (e && Ve(e)) {
3819
+ this.isEmpty() && e.append(document.createElement("br"));
3820
+ const r = this.getFormatType();
3821
+ e.style.textAlign = r;
3822
+ const i = this.getDirection();
3823
+ i && (e.dir = i);
3824
+ }
3825
+ return { element: e };
3826
+ }
3827
+ static importJSON(t) {
3828
+ const e = vt();
3829
+ return e.setFormat(t.format), e.setIndent(t.indent), e.setDirection(t.direction), e.setTextFormat(t.textFormat), e;
3830
+ }
3831
+ exportJSON() {
3832
+ return { ...super.exportJSON(), textFormat: this.getTextFormat(), textStyle: this.getTextStyle(), type: "paragraph", version: 1 };
3833
+ }
3834
+ insertNewAfter(t, e) {
3835
+ const r = vt();
3836
+ r.setTextFormat(t.format), r.setTextStyle(t.style);
3837
+ const i = this.getDirection();
3838
+ return r.setDirection(i), r.setFormat(this.getFormatType()), r.setStyle(this.getTextStyle()), this.insertAfter(r, e), r;
3839
+ }
3840
+ collapseAtStart() {
3841
+ const t = this.getChildren();
3842
+ if (t.length === 0 || E(t[0]) && t[0].getTextContent().trim() === "") {
3843
+ if (this.getNextSibling() !== null) return this.selectNext(), this.remove(), !0;
3844
+ if (this.getPreviousSibling() !== null) return this.selectPrevious(), this.remove(), !0;
3845
+ }
3846
+ return !1;
3847
+ }
3848
+ }
3849
+ function Zs(n) {
3850
+ const t = vt();
3851
+ return n.style && (t.setFormat(n.style.textAlign), Ms(n, t)), { node: t };
3852
+ }
3853
+ function vt() {
3854
+ return Ue(new zt());
3855
+ }
3856
+ function wn(n) {
3857
+ return n instanceof zt;
3858
+ }
3859
+ const To = 0, ko = 1, bo = 3, wo = 4;
3860
+ function Ii(n, t, e, r) {
3861
+ const i = n._keyToDOMMap;
3862
+ i.clear(), n._editorState = qn(), n._pendingEditorState = r, n._compositionKey = null, n._dirtyType = Et, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements.clear(), n._normalizedNodes = /* @__PURE__ */ new Set(), n._updateTags = /* @__PURE__ */ new Set(), n._updates = [], n._blockCursorElement = null;
3863
+ const s = n._observer;
3864
+ s !== null && (s.disconnect(), n._observer = null), t !== null && (t.textContent = ""), e !== null && (e.textContent = "", i.set("root", e));
3865
+ }
3866
+ function No(n) {
3867
+ const t = n || {}, e = Qs(), r = t.theme || {}, i = n === void 0 ? e : t.parentEditor || null, s = t.disableEvents || !1, o = qn(), l = t.namespace || (i !== null ? i._config.namespace : oi()), a = t.editorState, c = [ue, Bt, oe, le, zt, Ys, ...t.nodes || []], { onError: u, html: d } = t, f = t.editable === void 0 || t.editable;
3868
+ let h;
3869
+ if (n === void 0 && e !== null) h = e._nodes;
3870
+ else {
3871
+ h = /* @__PURE__ */ new Map();
3872
+ for (let _ = 0; _ < c.length; _++) {
3873
+ let p = c[_], m = null, y = null;
3874
+ if (typeof p != "function") {
3875
+ const v = p;
3876
+ p = v.replace, m = v.with, y = v.withKlass || null;
3877
+ }
3878
+ const x = p.getType(), b = p.transform(), k = /* @__PURE__ */ new Set();
3879
+ b !== null && k.add(b), h.set(x, { exportDOM: d && d.export ? d.export.get(p) : void 0, klass: p, replace: m, replaceWithKlass: y, transforms: k });
3880
+ }
3881
+ }
3882
+ const g = new Ye(o, i, h, { disableEvents: s, namespace: l, theme: r }, u || console.error, function(_, p) {
3883
+ const m = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), x = (b) => {
3884
+ Object.keys(b).forEach((k) => {
3885
+ let v = m.get(k);
3886
+ v === void 0 && (v = [], m.set(k, v)), v.push(b[k]);
3887
+ });
3888
+ };
3889
+ return _.forEach((b) => {
3890
+ const k = b.klass.importDOM;
3891
+ if (k == null || y.has(k)) return;
3892
+ y.add(k);
3893
+ const v = k.call(b.klass);
3894
+ v !== null && x(v);
3895
+ }), p && x(p), m;
3896
+ }(h, d ? d.import : void 0), f);
3897
+ return a !== void 0 && (g._pendingEditorState = a, g._dirtyType = At), g;
3898
+ }
3899
+ class Ye {
3900
+ constructor(t, e, r, i, s, o, l) {
3901
+ this._parentEditor = e, this._rootElement = null, this._editorState = t, this._pendingEditorState = null, this._compositionKey = null, this._deferred = [], this._keyToDOMMap = /* @__PURE__ */ new Map(), this._updates = [], this._updating = !1, this._listeners = { decorator: /* @__PURE__ */ new Set(), editable: /* @__PURE__ */ new Set(), mutation: /* @__PURE__ */ new Map(), root: /* @__PURE__ */ new Set(), textcontent: /* @__PURE__ */ new Set(), update: /* @__PURE__ */ new Set() }, this._commands = /* @__PURE__ */ new Map(), this._config = i, this._nodes = r, this._decorators = {}, this._pendingDecorators = null, this._dirtyType = Et, this._cloneNotNeeded = /* @__PURE__ */ new Set(), this._dirtyLeaves = /* @__PURE__ */ new Set(), this._dirtyElements = /* @__PURE__ */ new Map(), this._normalizedNodes = /* @__PURE__ */ new Set(), this._updateTags = /* @__PURE__ */ new Set(), this._observer = null, this._key = oi(), this._onError = s, this._htmlConversions = o, this._editable = l, this._headless = e !== null && e._headless, this._window = null, this._blockCursorElement = null;
3902
+ }
3903
+ isComposing() {
3904
+ return this._compositionKey != null;
3905
+ }
3906
+ registerUpdateListener(t) {
3907
+ const e = this._listeners.update;
3908
+ return e.add(t), () => {
3909
+ e.delete(t);
3910
+ };
3911
+ }
3912
+ registerEditableListener(t) {
3913
+ const e = this._listeners.editable;
3914
+ return e.add(t), () => {
3915
+ e.delete(t);
3916
+ };
3917
+ }
3918
+ registerDecoratorListener(t) {
3919
+ const e = this._listeners.decorator;
3920
+ return e.add(t), () => {
3921
+ e.delete(t);
3922
+ };
3923
+ }
3924
+ registerTextContentListener(t) {
3925
+ const e = this._listeners.textcontent;
3926
+ return e.add(t), () => {
3927
+ e.delete(t);
3928
+ };
3929
+ }
3930
+ registerRootListener(t) {
3931
+ const e = this._listeners.root;
3932
+ return t(this._rootElement, null), e.add(t), () => {
3933
+ t(null, this._rootElement), e.delete(t);
3934
+ };
3935
+ }
3936
+ registerCommand(t, e, r) {
3937
+ r === void 0 && T(35);
3938
+ const i = this._commands;
3939
+ i.has(t) || i.set(t, [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()]);
3940
+ const s = i.get(t);
3941
+ s === void 0 && T(36, String(t));
3942
+ const o = s[r];
3943
+ return o.add(e), () => {
3944
+ o.delete(e), s.every((l) => l.size === 0) && i.delete(t);
3945
+ };
3946
+ }
3947
+ registerMutationListener(t, e, r) {
3948
+ const i = this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass, s = this._listeners.mutation;
3949
+ s.set(e, i);
3950
+ const o = r && r.skipInitialization;
3951
+ return o !== void 0 && o || this.initializeMutationListener(e, i), () => {
3952
+ s.delete(e);
3953
+ };
3954
+ }
3955
+ getRegisteredNode(t) {
3956
+ const e = this._nodes.get(t.getType());
3957
+ return e === void 0 && T(37, t.name), e;
3958
+ }
3959
+ resolveRegisteredNodeAfterReplacements(t) {
3960
+ for (; t.replaceWithKlass; ) t = this.getRegisteredNode(t.replaceWithKlass);
3961
+ return t;
3962
+ }
3963
+ initializeMutationListener(t, e) {
3964
+ const r = this._editorState, i = Ls(r).get(e.getType());
3965
+ if (!i) return;
3966
+ const s = /* @__PURE__ */ new Map();
3967
+ for (const o of i.keys()) s.set(o, "created");
3968
+ s.size > 0 && t(s, { dirtyLeaves: /* @__PURE__ */ new Set(), prevEditorState: r, updateTags: /* @__PURE__ */ new Set(["registerMutationListener"]) });
3969
+ }
3970
+ registerNodeTransformToKlass(t, e) {
3971
+ const r = this.getRegisteredNode(t);
3972
+ return r.transforms.add(e), r;
3973
+ }
3974
+ registerNodeTransform(t, e) {
3975
+ const r = this.registerNodeTransformToKlass(t, e), i = [r], s = r.replaceWithKlass;
3976
+ if (s != null) {
3977
+ const a = this.registerNodeTransformToKlass(s, e);
3978
+ i.push(a);
3979
+ }
3980
+ var o, l;
3981
+ return o = this, l = t.getType(), Q(o, () => {
3982
+ const a = ft();
3983
+ if (a.isEmpty()) return;
3984
+ if (l === "root") return void Y().markDirty();
3985
+ const c = a._nodeMap;
3986
+ for (const [, u] of c) u.markDirty();
3987
+ }, o._pendingEditorState === null ? { tag: "history-merge" } : void 0), () => {
3988
+ i.forEach((a) => a.transforms.delete(e));
3989
+ };
3990
+ }
3991
+ hasNode(t) {
3992
+ return this._nodes.has(t.getType());
3993
+ }
3994
+ hasNodes(t) {
3995
+ return t.every(this.hasNode.bind(this));
3996
+ }
3997
+ dispatchCommand(t, e) {
3998
+ return w(this, t, e);
3999
+ }
4000
+ getDecorators() {
4001
+ return this._decorators;
4002
+ }
4003
+ getRootElement() {
4004
+ return this._rootElement;
4005
+ }
4006
+ getKey() {
4007
+ return this._key;
4008
+ }
4009
+ setRootElement(t) {
4010
+ const e = this._rootElement;
4011
+ if (t !== e) {
4012
+ const r = Ht(this._config.theme, "root"), i = this._pendingEditorState || this._editorState;
4013
+ if (this._rootElement = t, Ii(this, e, t, i), e !== null && (this._config.disableEvents || Ws(e), r != null && e.classList.remove(...r)), t !== null) {
4014
+ const s = function(l) {
4015
+ const a = l.ownerDocument;
4016
+ return a && a.defaultView || null;
4017
+ }(t), o = t.style;
4018
+ o.userSelect = "text", o.whiteSpace = "pre-wrap", o.wordBreak = "break-word", t.setAttribute("data-lexical-editor", "true"), this._window = s, this._dirtyType = At, Yr(this), this._updateTags.add("history-merge"), mt(this), this._config.disableEvents || function(l, a) {
4019
+ const c = l.ownerDocument, u = Me.get(c);
4020
+ (u === void 0 || u < 1) && c.addEventListener("selectionchange", Ci), Me.set(c, (u || 0) + 1), l.__lexicalEditor = a;
4021
+ const d = Si(l);
4022
+ for (let f = 0; f < Cn.length; f++) {
4023
+ const [h, g] = Cn[f], _ = typeof g == "function" ? (p) => {
4024
+ Sr(p) || (vr(p), (a.isEditable() || h === "click") && g(p, a));
4025
+ } : (p) => {
4026
+ if (Sr(p)) return;
4027
+ vr(p);
4028
+ const m = a.isEditable();
4029
+ switch (h) {
4030
+ case "cut":
4031
+ return m && w(a, Vr, p);
4032
+ case "copy":
4033
+ return w(a, Ur, p);
4034
+ case "paste":
4035
+ return m && w(a, Kr, p);
4036
+ case "dragstart":
4037
+ return m && w(a, Qi, p);
4038
+ case "dragover":
4039
+ return m && w(a, Xi, p);
4040
+ case "dragend":
4041
+ return m && w(a, Yi, p);
4042
+ case "focus":
4043
+ return m && w(a, Zi, p);
4044
+ case "blur":
4045
+ return m && w(a, ts, p);
4046
+ case "drop":
4047
+ return m && w(a, Gi, p);
4048
+ }
4049
+ };
4050
+ l.addEventListener(h, _), d.push(() => {
4051
+ l.removeEventListener(h, _);
4052
+ });
4053
+ }
4054
+ }(t, this), r != null && t.classList.add(...r);
4055
+ } else this._editorState = i, this._pendingEditorState = null, this._window = null;
4056
+ Xt("root", this, !1, t, e);
4057
+ }
4058
+ }
4059
+ getElementByKey(t) {
4060
+ return this._keyToDOMMap.get(t) || null;
4061
+ }
4062
+ getEditorState() {
4063
+ return this._editorState;
4064
+ }
4065
+ setEditorState(t, e) {
4066
+ t.isEmpty() && T(38);
4067
+ let r = t;
4068
+ r._readOnly && (r = Oi(t), r._selection = t._selection ? t._selection.clone() : null), Xr(this);
4069
+ const i = this._pendingEditorState, s = this._updateTags, o = e !== void 0 ? e.tag : null;
4070
+ i === null || i.isEmpty() || (o != null && s.add(o), mt(this)), this._pendingEditorState = r, this._dirtyType = At, this._dirtyElements.set("root", !1), this._compositionKey = null, o != null && s.add(o), this._updating || mt(this);
4071
+ }
4072
+ parseEditorState(t, e) {
4073
+ return function(r, i, s) {
4074
+ const o = qn(), l = K, a = G, c = J, u = i._dirtyElements, d = i._dirtyLeaves, f = i._cloneNotNeeded, h = i._dirtyType;
4075
+ i._dirtyElements = /* @__PURE__ */ new Map(), i._dirtyLeaves = /* @__PURE__ */ new Set(), i._cloneNotNeeded = /* @__PURE__ */ new Set(), i._dirtyType = 0, K = o, G = !1, J = i;
4076
+ try {
4077
+ const g = i._nodes;
4078
+ Hn(r.root, g), s && s(), o._readOnly = !0;
4079
+ } catch (g) {
4080
+ g instanceof Error && i._onError(g);
4081
+ } finally {
4082
+ i._dirtyElements = u, i._dirtyLeaves = d, i._cloneNotNeeded = f, i._dirtyType = h, K = l, G = a, J = c;
4083
+ }
4084
+ return o;
4085
+ }(typeof t == "string" ? JSON.parse(t) : t, this, e);
4086
+ }
4087
+ read(t) {
4088
+ return mt(this), this.getEditorState().read(t, { editor: this });
4089
+ }
4090
+ update(t, e) {
4091
+ Q(this, t, e);
4092
+ }
4093
+ focus(t, e = {}) {
4094
+ const r = this._rootElement;
4095
+ r !== null && (r.setAttribute("autocapitalize", "off"), Q(this, () => {
4096
+ const i = M(), s = Y();
4097
+ i !== null ? i.dirty = !0 : s.getChildrenSize() !== 0 && (e.defaultSelection === "rootStart" ? s.selectStart() : s.selectEnd());
4098
+ }, { onUpdate: () => {
4099
+ r.removeAttribute("autocapitalize"), t && t();
4100
+ }, tag: "focus" }), this._pendingEditorState === null && r.removeAttribute("autocapitalize"));
4101
+ }
4102
+ blur() {
4103
+ const t = this._rootElement;
4104
+ t !== null && t.blur();
4105
+ const e = it(this._window);
4106
+ e !== null && e.removeAllRanges();
4107
+ }
4108
+ isEditable() {
4109
+ return this._editable;
4110
+ }
4111
+ setEditable(t) {
4112
+ this._editable !== t && (this._editable = t, Xt("editable", this, !0, t));
4113
+ }
4114
+ toJSON() {
4115
+ return { editorState: this._editorState.toJSON() };
4116
+ }
4117
+ }
4118
+ Ye.version = "0.20.2+prod.esm";
4119
+ export {
4120
+ bo as $,
4121
+ xo as A,
4122
+ Vr as B,
4123
+ go as C,
4124
+ Se as D,
4125
+ I as E,
4126
+ ut as F,
4127
+ It as G,
4128
+ Ce as H,
4129
+ yo as I,
4130
+ ve as J,
4131
+ ko as K,
4132
+ Vi as L,
4133
+ Hi as M,
4134
+ qi as N,
4135
+ so as O,
4136
+ po as P,
4137
+ st as Q,
4138
+ M as R,
4139
+ $i as S,
4140
+ Ve as T,
4141
+ wo as U,
4142
+ Cs as V,
4143
+ wn as W,
4144
+ ce as X,
4145
+ at as Y,
4146
+ zt as Z,
4147
+ Bt as _,
4148
+ F as a,
4149
+ Kr as a0,
4150
+ ho as a1,
4151
+ Nr as a2,
4152
+ gr as a3,
4153
+ X as a4,
4154
+ Bi as a5,
4155
+ To as a6,
4156
+ Ai as a7,
4157
+ co as a8,
4158
+ ao as a9,
4159
+ So as aA,
4160
+ tr as aB,
4161
+ ti as aC,
4162
+ lo as aD,
4163
+ oo as aE,
4164
+ Jr as aa,
4165
+ $r as ab,
4166
+ Ys as ac,
4167
+ ne as ad,
4168
+ Os as ae,
4169
+ _o as af,
4170
+ mo as ag,
4171
+ _r as ah,
4172
+ Fs as ai,
4173
+ Vn as aj,
4174
+ Co as ak,
4175
+ Ur as al,
4176
+ We as am,
4177
+ jn as an,
4178
+ No as ao,
4179
+ Zr as ap,
4180
+ er as aq,
4181
+ fo as ar,
4182
+ Xi as as,
4183
+ Qi as at,
4184
+ Gi as au,
4185
+ hn as av,
4186
+ ye as aw,
4187
+ io as ax,
4188
+ ro as ay,
4189
+ no as az,
4190
+ S as b,
4191
+ Pt as c,
4192
+ $ as d,
4193
+ to as e,
4194
+ zn as f,
4195
+ Ue as g,
4196
+ E as h,
4197
+ V as i,
4198
+ ae as j,
4199
+ Qe as k,
4200
+ ji as l,
4201
+ wt as m,
4202
+ jt as n,
4203
+ Zn as o,
4204
+ uo as p,
4205
+ Zi as q,
4206
+ eo as r,
4207
+ vo as s,
4208
+ Nn as t,
4209
+ Y as u,
4210
+ it as v,
4211
+ Ji as w,
4212
+ Ri as x,
4213
+ zi as y,
4214
+ vt as z
4215
+ };
4216
+ //# sourceMappingURL=Lexical.prod-DeeCy7Xd.js.map