@layers-app/editor 0.5.4-optimization → 0.5.6-optimization
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.
- package/README.md +19 -0
- package/dist/index.cjs +2 -0
- package/dist/index.js +12 -10
- package/dist/layers.7jmq6tBR.js +2227 -0
- package/dist/layers.B90YwJga.js +4 -0
- package/dist/layers.C03OvlLb.js +6 -0
- package/dist/layers.CJiIq6YQ.js +1 -0
- package/dist/layers.CXffIp2y.js +864 -0
- package/dist/layers.CZPeYQ9g.js +3 -0
- package/dist/layers.CZ_Lt7IL.js +7 -0
- package/dist/layers.Ci1-qkbn.js +341 -0
- package/dist/layers.Cnm-pECN.js +2 -0
- package/dist/layers.D6d62qQ_.js +6774 -0
- package/dist/layers.DNCgFYS7.js +27 -0
- package/dist/layers.Dev6Yrwi.js +530 -0
- package/dist/layers.Dgok89qX.js +1 -0
- package/dist/layers.Dq3o7sh3.js +7723 -0
- package/dist/layers.Duy8YzsH.js +2511 -0
- package/dist/layers.QjAkD17S.js +3677 -0
- package/package.json +73 -17
- package/dist/layers.0EAb8Ajx.js +0 -65
- package/dist/layers.1Mvzm38Y.js +0 -501
- package/dist/layers.2wIERhxO.js +0 -41
- package/dist/layers.694DrE1_.js +0 -931
- package/dist/layers.7JqFgE4-.js +0 -15
- package/dist/layers.B-5aeeDH.js +0 -1359
- package/dist/layers.B0winug5.js +0 -59
- package/dist/layers.B1S8ufDn.js +0 -40
- package/dist/layers.B3JNY9Km.js +0 -42
- package/dist/layers.B6W2tqC0.js +0 -40
- package/dist/layers.B7Olyhe8.js +0 -1089
- package/dist/layers.BCuuRSaf.js +0 -37
- package/dist/layers.BESPlBGC.js +0 -32
- package/dist/layers.BJDrjORS.js +0 -244
- package/dist/layers.BJTh7mUo.js +0 -1265
- package/dist/layers.BLL-019k.js +0 -39
- package/dist/layers.BNJiP8Pw.js +0 -2966
- package/dist/layers.BNvAl5dS.js +0 -14
- package/dist/layers.BThP74aw.js +0 -32
- package/dist/layers.BZ4laUeR.js +0 -40
- package/dist/layers.BZByPNdY.js +0 -37
- package/dist/layers.B_5zMrI3.js +0 -38
- package/dist/layers.B_7N5yjX.js +0 -32
- package/dist/layers.BbCfEXyj.js +0 -55
- package/dist/layers.BdvfoI4U.js +0 -44
- package/dist/layers.BiJ8hfRt.js +0 -1510
- package/dist/layers.BiJBOHr0.js +0 -84
- package/dist/layers.Bk3_8qR9.js +0 -48146
- package/dist/layers.BkPPOKBy.js +0 -32
- package/dist/layers.BnZcjRLr.js +0 -32
- package/dist/layers.BpilXLfW.js +0 -6
- package/dist/layers.BqpcWKH6.js +0 -2479
- package/dist/layers.Br7D0wMN.js +0 -39
- package/dist/layers.BsAu1GXs.js +0 -42
- package/dist/layers.Bv5sK47C.js +0 -769
- package/dist/layers.BxEdkUpI.js +0 -1088
- package/dist/layers.BxUBbVsO.js +0 -41
- package/dist/layers.Bzalhqz_.js +0 -39
- package/dist/layers.C-dS7ntQ.js +0 -41
- package/dist/layers.C0Lgw_Sx.js +0 -11688
- package/dist/layers.C5BFsvzI.js +0 -803
- package/dist/layers.C5WLg9ed.js +0 -21763
- package/dist/layers.C6lAFlKZ.js +0 -186
- package/dist/layers.C8_lu5UH.js +0 -23
- package/dist/layers.CGwNL7dH.js +0 -791
- package/dist/layers.CI739wqN.js +0 -39
- package/dist/layers.CKaj4dG4.js +0 -41
- package/dist/layers.CLRiSwgi.js +0 -904
- package/dist/layers.CN1QkD6D.js +0 -38
- package/dist/layers.CPY6U3g-.js +0 -1034
- package/dist/layers.CRSjdIG6.js +0 -1619
- package/dist/layers.CUHkTCid.js +0 -6
- package/dist/layers.CUPMw0sy.js +0 -40
- package/dist/layers.CWb6LiAY.js +0 -40
- package/dist/layers.C_XsSNQo.js +0 -42
- package/dist/layers.CbmlFoXt.js +0 -33
- package/dist/layers.CfGeHh-g.js +0 -36
- package/dist/layers.CiJxVu9b.js +0 -36
- package/dist/layers.Cj4ezyVr.js +0 -33
- package/dist/layers.Cpb-MRZn.js +0 -960
- package/dist/layers.CqVTtuYm.js +0 -6
- package/dist/layers.CskURloi.js +0 -39
- package/dist/layers.CtTD47i4.js +0 -41
- package/dist/layers.CxcvEfKe.js +0 -36
- package/dist/layers.D-U9uIsP.js +0 -40
- package/dist/layers.D10WeKck.js +0 -2235
- package/dist/layers.D4T8fTcj.js +0 -1223
- package/dist/layers.D4jK2Tet.js +0 -39
- package/dist/layers.D7jGxypv.js +0 -8
- package/dist/layers.DBosqi2D.js +0 -19
- package/dist/layers.DGtETOVJ.js +0 -304
- package/dist/layers.DKENAsMv.js +0 -220
- package/dist/layers.DLwuMfdd.js +0 -84
- package/dist/layers.DN9HoVxI.js +0 -18
- package/dist/layers.DOBSfaUM.js +0 -35
- package/dist/layers.DOKLQ6A3.js +0 -373
- package/dist/layers.DPuVWH3L.js +0 -40
- package/dist/layers.DQVXh43C.js +0 -42
- package/dist/layers.DSTh89J8.js +0 -42
- package/dist/layers.DUsIfvNt.js +0 -46859
- package/dist/layers.DVfpGIrv.js +0 -41
- package/dist/layers.DWSkLlGf.js +0 -41
- package/dist/layers.DX1RI3m3.js +0 -32
- package/dist/layers.DdMwmP4m.js +0 -37
- package/dist/layers.DhkyREpW.js +0 -793
- package/dist/layers.Dj-f1_6N.js +0 -34
- package/dist/layers.DjUOC4st.js +0 -16
- package/dist/layers.DjhJT1nZ.js +0 -21938
- package/dist/layers.Djl9Gz6s.js +0 -282
- package/dist/layers.Dn2AP7iE.js +0 -1283
- package/dist/layers.Dqbek_0L.js +0 -40
- package/dist/layers.DsDjOLHs.js +0 -437
- package/dist/layers.DsOaqGXW.js +0 -8
- package/dist/layers.DuE1l7lR.js +0 -41
- package/dist/layers.DxA6ocdw.js +0 -70
- package/dist/layers.DxHlP7Pb.js +0 -39
- package/dist/layers.Dy1naDTQ.js +0 -14
- package/dist/layers.DyZ5R-vS.js +0 -37
- package/dist/layers.H2Kl_PC2.js +0 -40
- package/dist/layers.IW4NBP9k.js +0 -39
- package/dist/layers.LGx1jmqd.js +0 -40
- package/dist/layers.NABwYdw5.js +0 -35
- package/dist/layers.NtwvbkGN.js +0 -1580
- package/dist/layers.O-bFTk-n.js +0 -268
- package/dist/layers.R_udKe_N.js +0 -38
- package/dist/layers.TdTDbIzb.js +0 -1126
- package/dist/layers.WLeJl9el.js +0 -202
- package/dist/layers.b0h5ZBmD.js +0 -61
- package/dist/layers.dEHKcy8J.js +0 -320
- package/dist/layers.eTredPK_.js +0 -36
- package/dist/layers.gIdzfQAa.js +0 -5
- package/dist/layers.huV95Ipe.js +0 -295
- package/dist/layers.jU4W5PG5.js +0 -9166
- package/dist/layers.lCpg7dOn.js +0 -21
- package/dist/layers.mQcENPPW.js +0 -802
- package/dist/layers.nPQCmYXI.js +0 -423
- package/dist/layers.ntC1foLT.js +0 -39
- package/dist/layers.uHy1yMbq.js +0 -6
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import { $isElementNode as y, createCommand as h, $getRoot as S, $createParagraphNode as b, $getSelection as g, $isRangeSelection as p, $getNearestNodeFromDOMNode as N, $setSelection as M, $getNodeByKey as G, $createRangeSelection as V, $copyNode as O, ElementNode as x, ParagraphNode as W, INSERT_PARAGRAPH_COMMAND as j, COMMAND_PRIORITY_NORMAL as $, $isParagraphNode as J, DELETE_CHARACTER_COMMAND as Y, REDO_COMMAND as q } from "lexical";
|
|
2
|
+
import { p as k, D as I, f as E, aF as Z, a6 as Q, U as H, u as v, Q as A, C as X, aj as tt, n as et } from "./layers.Dq3o7sh3.js";
|
|
3
|
+
import { s as st } from "./layers.Duy8YzsH.js";
|
|
4
|
+
import { $getNearestNodeOfType as nt } from "@lexical/utils";
|
|
5
|
+
import { $isAtNodeEnd as D } from "@lexical/selection";
|
|
6
|
+
import "@lexical/code";
|
|
7
|
+
import "@lexical/hashtag";
|
|
8
|
+
import "@lexical/link";
|
|
9
|
+
import "@lexical/mark";
|
|
10
|
+
import "@lexical/overflow";
|
|
11
|
+
import "@lexical/react/LexicalHorizontalRuleNode";
|
|
12
|
+
import "@lexical/rich-text";
|
|
13
|
+
import { G as F, H as ot, _ as lt, a0 as rt, a1 as it, a2 as at, a3 as K, a4 as ct, a5 as ft, a6 as ut, a7 as dt, a8 as gt, a9 as ht, aa as pt, ab as mt } from "./layers.D6d62qQ_.js";
|
|
14
|
+
function Ct(t, e) {
|
|
15
|
+
if (e.add(t.getKey()), y(t))
|
|
16
|
+
for (const s of t.getChildren())
|
|
17
|
+
Ct(s, e);
|
|
18
|
+
}
|
|
19
|
+
function Vt(t) {
|
|
20
|
+
t.preventDefault(), t.stopImmediatePropagation(), t.stopPropagation();
|
|
21
|
+
}
|
|
22
|
+
const Wt = h(), jt = h(), Jt = h(), Yt = h(), qt = h(), Zt = h(), Qt = h(), Ht = h(), vt = (() => {
|
|
23
|
+
var e;
|
|
24
|
+
const t = (e = window.navigator) == null ? void 0 : e.userAgentData;
|
|
25
|
+
return t !== void 0 ? t.mobile : window.innerWidth <= 800 && window.innerHeight <= 600;
|
|
26
|
+
})(), Xt = (t) => typeof t == "string" && t.includes("%") ? parseFloat(t) : t;
|
|
27
|
+
function te(t, e) {
|
|
28
|
+
if (!e || !(e instanceof HTMLElement)) {
|
|
29
|
+
console.error("Invalid DOM element provided.");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
t ? e.classList.add("disable-scroll") : e.classList.remove("disable-scroll");
|
|
33
|
+
}
|
|
34
|
+
function m(t) {
|
|
35
|
+
const e = g();
|
|
36
|
+
if (p(e)) {
|
|
37
|
+
const n = e.anchor.getNode();
|
|
38
|
+
if (n !== null) {
|
|
39
|
+
const o = n.getParent();
|
|
40
|
+
return t ? o : n;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
function ee(t) {
|
|
46
|
+
t.update(() => {
|
|
47
|
+
const e = g();
|
|
48
|
+
if (p(e)) {
|
|
49
|
+
const s = e.getNodes();
|
|
50
|
+
let n = null, o = null;
|
|
51
|
+
if (s.forEach((l, i) => {
|
|
52
|
+
i === 0 && (n = l.getParent()), i === s.length - 1 && (o = l.getParent());
|
|
53
|
+
}), n && o) {
|
|
54
|
+
const l = g();
|
|
55
|
+
p(l) && (n.isAttached() && o.isAttached() ? E(n) && E(o) ? l.setTextNodeRange(
|
|
56
|
+
n,
|
|
57
|
+
0,
|
|
58
|
+
o,
|
|
59
|
+
o.getTextContentSize()
|
|
60
|
+
) : (l.anchor.set(n.getKey(), 0, "element"), l.focus.set(
|
|
61
|
+
o.getKey(),
|
|
62
|
+
o.getChildrenSize(),
|
|
63
|
+
"element"
|
|
64
|
+
)) : console.error("Error: One of the nodes is not attached."));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const yt = (t, e) => {
|
|
70
|
+
t.update(() => {
|
|
71
|
+
if (typeof e == "string") {
|
|
72
|
+
const s = G(e);
|
|
73
|
+
s && s.remove();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
e && e.remove();
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
function se(t, e) {
|
|
80
|
+
e.update(() => {
|
|
81
|
+
let s = V();
|
|
82
|
+
t.getParent() && (s.anchor.set(t.getKey(), 0, "element"), s.focus.set(t.getKey(), 0, "element"), M(s));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function ne() {
|
|
86
|
+
const t = g();
|
|
87
|
+
if (p(t)) {
|
|
88
|
+
const e = t.anchor, s = t.focus, n = s.getNode(), o = k(n) ? n.__size : n.getTextContentSize(), l = e.offset === 0, i = s.offset === o;
|
|
89
|
+
if (l && i)
|
|
90
|
+
return !0;
|
|
91
|
+
}
|
|
92
|
+
return !1;
|
|
93
|
+
}
|
|
94
|
+
function oe(t, e) {
|
|
95
|
+
const s = O(t), n = [[t, s]];
|
|
96
|
+
let o;
|
|
97
|
+
for (; (o = n.length) > 0; )
|
|
98
|
+
for (let l = 0; l < o; l++) {
|
|
99
|
+
const i = n.shift();
|
|
100
|
+
if (i !== void 0) {
|
|
101
|
+
const [a, r] = i;
|
|
102
|
+
if (y(a) && y(r)) {
|
|
103
|
+
const c = a.getChildren();
|
|
104
|
+
for (const f of c) {
|
|
105
|
+
if (e && f.is(e))
|
|
106
|
+
continue;
|
|
107
|
+
const u = O(f);
|
|
108
|
+
E(f) && E(u) && (u.setFormat(f.__format), u.setStyle(f.__style)), r.append(u), n.push([f, u]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return s;
|
|
114
|
+
}
|
|
115
|
+
function Et(t, e, s = 3) {
|
|
116
|
+
if (!t) return null;
|
|
117
|
+
let n = t, o = 0;
|
|
118
|
+
for (; n && o < s; ) {
|
|
119
|
+
if (e(n))
|
|
120
|
+
return n;
|
|
121
|
+
if (n.__type === "root")
|
|
122
|
+
break;
|
|
123
|
+
n = n.getParent(), o++;
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
function L(t, e, s) {
|
|
128
|
+
var o;
|
|
129
|
+
const n = s || { root: !0 };
|
|
130
|
+
if (t) {
|
|
131
|
+
let l = t.getParent();
|
|
132
|
+
if (n[l == null ? void 0 : l.__type]) {
|
|
133
|
+
const i = e.getElementByKey(t.__key), a = Et(l, I);
|
|
134
|
+
if (a && (a.getFirstChild() === t.getTopLevelElement() || a.getFirstChild() === ((o = t.getTopLevelElement()) == null ? void 0 : o.getParent()))) {
|
|
135
|
+
const c = a.getParent(), f = c ? e.getElementByKey(c.__key) : null;
|
|
136
|
+
if (f)
|
|
137
|
+
return {
|
|
138
|
+
htmlElement: f,
|
|
139
|
+
lexicalNode: N(f)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return { htmlElement: i, lexicalNode: t };
|
|
143
|
+
}
|
|
144
|
+
return L(l, e, n);
|
|
145
|
+
}
|
|
146
|
+
return { htmlElement: null, lexicalNode: null };
|
|
147
|
+
}
|
|
148
|
+
function le(t, e, s, n) {
|
|
149
|
+
var o;
|
|
150
|
+
if (t)
|
|
151
|
+
if ((t == null ? void 0 : t.__type) === "root" || (t == null ? void 0 : t.__type) === "layout-item" || (t == null ? void 0 : t.__type) === "callout-wrapper" || (t == null ? void 0 : t.__type) === "collapsible-content") {
|
|
152
|
+
const l = (n == null ? void 0 : n.clientY) || 0, { left: i } = ((o = e.getElementByKey(t.__key)) == null ? void 0 : o.getBoundingClientRect()) || {
|
|
153
|
+
left: 0
|
|
154
|
+
}, { paddingLeft: a } = window.getComputedStyle(
|
|
155
|
+
n == null ? void 0 : n.target
|
|
156
|
+
), r = document.elementFromPoint(
|
|
157
|
+
i + parseFloat(a) + 10,
|
|
158
|
+
l
|
|
159
|
+
), c = N(r || document.body);
|
|
160
|
+
return c ? L(c, e, s) : { htmlElement: null, lexicalNode: null };
|
|
161
|
+
} else
|
|
162
|
+
return L(t, e, s);
|
|
163
|
+
return { htmlElement: null, lexicalNode: null };
|
|
164
|
+
}
|
|
165
|
+
const re = (t) => {
|
|
166
|
+
t.update(() => {
|
|
167
|
+
g() !== null && M(null);
|
|
168
|
+
});
|
|
169
|
+
}, ie = () => {
|
|
170
|
+
const t = S(), e = t == null ? void 0 : t.getFirstChild();
|
|
171
|
+
return t.getChildren().length > 1 ? !1 : e && y(e) && e.isEmpty() && !k(e);
|
|
172
|
+
}, ae = (t) => {
|
|
173
|
+
t.update(() => {
|
|
174
|
+
const e = S(), s = b(), n = g();
|
|
175
|
+
p(n) && (n.format = 0, n.setStyle("")), e.append(s).selectEnd();
|
|
176
|
+
});
|
|
177
|
+
}, ce = (t, e, s) => {
|
|
178
|
+
const n = t.target;
|
|
179
|
+
if (n && (n instanceof HTMLElement || n instanceof SVGElement)) {
|
|
180
|
+
let o = null;
|
|
181
|
+
const l = n.closest(e);
|
|
182
|
+
for (const a of s)
|
|
183
|
+
if (o = n.closest(a), o)
|
|
184
|
+
break;
|
|
185
|
+
return { lexicalDOMNode: l, isOutside: !(l || o) };
|
|
186
|
+
} else
|
|
187
|
+
return { lexicalDOMNode: null, isOutside: !0 };
|
|
188
|
+
};
|
|
189
|
+
async function* B(t) {
|
|
190
|
+
let e = !1;
|
|
191
|
+
for (; !e; ) {
|
|
192
|
+
const s = await t.read(), { value: n } = s;
|
|
193
|
+
n !== void 0 && (yield n), e = s.done;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async function _t(t) {
|
|
197
|
+
const e = [];
|
|
198
|
+
for await (const n of B(t))
|
|
199
|
+
for (let o = 0; o < n.length; o += 32768)
|
|
200
|
+
e.push(String.fromCharCode(...n.subarray(o, o + 32768)));
|
|
201
|
+
return e.join("");
|
|
202
|
+
}
|
|
203
|
+
async function fe(t) {
|
|
204
|
+
const e = new CompressionStream("gzip"), s = e.writable.getWriter(), [, n] = await Promise.all([
|
|
205
|
+
s.write(new TextEncoder().encode(JSON.stringify(t))).then(() => s.close()),
|
|
206
|
+
_t(e.readable.getReader())
|
|
207
|
+
]);
|
|
208
|
+
return `#doc=${btoa(n).replace(/\//g, "_").replace(/\+/g, "-").replace(/=+$/, "")}`;
|
|
209
|
+
}
|
|
210
|
+
async function ue(t) {
|
|
211
|
+
const e = /^#doc=(.*)$/.exec(t);
|
|
212
|
+
if (!e)
|
|
213
|
+
return null;
|
|
214
|
+
const s = new DecompressionStream("gzip"), n = s.writable.getWriter(), o = atob(e[1].replace(/_/g, "/").replace(/-/g, "+")), l = new Uint8Array(o.length);
|
|
215
|
+
for (let r = 0; r < o.length; r++)
|
|
216
|
+
l[r] = o.charCodeAt(r);
|
|
217
|
+
const i = n.write(l).then(() => n.close()), a = [];
|
|
218
|
+
for await (const r of B(
|
|
219
|
+
s.readable.pipeThrough(new TextDecoderStream()).getReader()
|
|
220
|
+
))
|
|
221
|
+
a.push(r);
|
|
222
|
+
return await i, JSON.parse(a.join(""));
|
|
223
|
+
}
|
|
224
|
+
const St = () => !!document.querySelector(".selected-all-document"), de = (t, e, s) => {
|
|
225
|
+
var o, l, i, a, r;
|
|
226
|
+
const n = g();
|
|
227
|
+
if (p(n) && n.isCollapsed()) {
|
|
228
|
+
const c = n.anchor.getNode(), f = c.getKey(), u = c.getParent() === s, C = s instanceof x && (s.__type === "layout-item" ? (l = (o = s.getLastChild()) == null ? void 0 : o.getPreviousSibling()) == null ? void 0 : l.getKey() : (i = s.getLastChild()) == null ? void 0 : i.getKey()) === f, R = s instanceof x && ((a = s.getFirstChild()) == null ? void 0 : a.getKey()) === f;
|
|
229
|
+
if (s && c instanceof W && !c.getTextContent() && u && !((r = c.getPreviousSibling()) != null && r.getTextContent()) && C && !R) {
|
|
230
|
+
const U = t.registerCommand(
|
|
231
|
+
j,
|
|
232
|
+
() => (U(), !0),
|
|
233
|
+
$
|
|
234
|
+
);
|
|
235
|
+
return t.update(() => {
|
|
236
|
+
var P;
|
|
237
|
+
if (s) {
|
|
238
|
+
let d = s.getChildren();
|
|
239
|
+
const z = s.getLastChild();
|
|
240
|
+
Z(z) && (d = d.slice(0, -1)), d.length === 2 ? d.slice(-1).forEach((T) => T.remove()) : d.slice(-2).forEach((T) => T.remove());
|
|
241
|
+
}
|
|
242
|
+
const w = e == null ? void 0 : e.getNextSibling();
|
|
243
|
+
if (J(w) && w.getTextContent() === "")
|
|
244
|
+
(P = e == null ? void 0 : e.getNextSibling()) == null || P.selectEnd();
|
|
245
|
+
else {
|
|
246
|
+
const d = e == null ? void 0 : e.insertAfter(b());
|
|
247
|
+
d == null || d.selectStart();
|
|
248
|
+
}
|
|
249
|
+
}), !0;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return !1;
|
|
253
|
+
}, ge = (t, e, s) => {
|
|
254
|
+
var l, i, a;
|
|
255
|
+
const n = (s == null ? void 0 : s.getChildren()) || [];
|
|
256
|
+
if ((n == null ? void 0 : n.length) === 2) {
|
|
257
|
+
for (const r of n)
|
|
258
|
+
r.__key !== (e == null ? void 0 : e.__key) && (s == null || s.insertBefore(r), (l = r.getFirstChild()) == null || l.selectEnd());
|
|
259
|
+
s.remove();
|
|
260
|
+
} else
|
|
261
|
+
for (const r of n)
|
|
262
|
+
if (r.__key === (e == null ? void 0 : e.__key)) {
|
|
263
|
+
st(t, r), yt(t, r);
|
|
264
|
+
const c = r.getPreviousSibling() ?? r.getNextSibling();
|
|
265
|
+
(a = (i = c == null ? void 0 : c.getFirstChild) == null ? void 0 : i.call(c)) == null || a.selectEnd();
|
|
266
|
+
}
|
|
267
|
+
const o = t.registerCommand(
|
|
268
|
+
Y,
|
|
269
|
+
() => (o(), !0),
|
|
270
|
+
$
|
|
271
|
+
);
|
|
272
|
+
return !0;
|
|
273
|
+
}, he = (t, e, s) => {
|
|
274
|
+
if (!t) return null;
|
|
275
|
+
let n = null;
|
|
276
|
+
return s.read(() => {
|
|
277
|
+
const o = N(t);
|
|
278
|
+
n = o && nt(o, e);
|
|
279
|
+
}), n;
|
|
280
|
+
};
|
|
281
|
+
function pe(t) {
|
|
282
|
+
return t instanceof HTMLElement;
|
|
283
|
+
}
|
|
284
|
+
function _(t) {
|
|
285
|
+
let e = 0;
|
|
286
|
+
t instanceof WheelEvent ? e = t.deltaY : t instanceof TouchEvent && (e = 1);
|
|
287
|
+
let s = t.target;
|
|
288
|
+
for (; s && s !== document.body && s !== document.documentElement; ) {
|
|
289
|
+
if (s.scrollHeight > s.clientHeight && (e < 0 && s.scrollTop > 0 || e > 0 && s.scrollTop + s.clientHeight < s.scrollHeight))
|
|
290
|
+
return;
|
|
291
|
+
s = s.parentElement;
|
|
292
|
+
}
|
|
293
|
+
t.preventDefault();
|
|
294
|
+
}
|
|
295
|
+
function Nt() {
|
|
296
|
+
document.addEventListener("wheel", _, { passive: !1 }), document.addEventListener("touchmove", _, { passive: !1 });
|
|
297
|
+
}
|
|
298
|
+
function Tt() {
|
|
299
|
+
document.removeEventListener("wheel", _), document.removeEventListener("touchmove", _);
|
|
300
|
+
}
|
|
301
|
+
function me(t) {
|
|
302
|
+
const e = t.anchor, s = t.focus, n = t.anchor.getNode(), o = t.focus.getNode();
|
|
303
|
+
return n === o ? n : t.isBackward() ? D(s) ? n : o : D(e) ? n : o;
|
|
304
|
+
}
|
|
305
|
+
const Lt = /* @__PURE__ */ new Set([
|
|
306
|
+
"http:",
|
|
307
|
+
"https:",
|
|
308
|
+
"mailto:",
|
|
309
|
+
"sms:",
|
|
310
|
+
"tel:"
|
|
311
|
+
]);
|
|
312
|
+
function Ce(t) {
|
|
313
|
+
try {
|
|
314
|
+
const e = new URL(t);
|
|
315
|
+
if (!Lt.has(e.protocol))
|
|
316
|
+
return "about:blank";
|
|
317
|
+
} catch {
|
|
318
|
+
return t;
|
|
319
|
+
}
|
|
320
|
+
return t;
|
|
321
|
+
}
|
|
322
|
+
function ye(t, e) {
|
|
323
|
+
const s = t.getRangeAt(0);
|
|
324
|
+
let n;
|
|
325
|
+
if (t.anchorNode === e) {
|
|
326
|
+
let o = e;
|
|
327
|
+
for (; o.firstElementChild != null; )
|
|
328
|
+
o = o.firstElementChild;
|
|
329
|
+
n = o.getBoundingClientRect();
|
|
330
|
+
} else
|
|
331
|
+
n = s.getBoundingClientRect();
|
|
332
|
+
return n;
|
|
333
|
+
}
|
|
334
|
+
const Ee = () => {
|
|
335
|
+
var s;
|
|
336
|
+
const t = (s = window.getSelection()) == null ? void 0 : s.toString().trim();
|
|
337
|
+
return t == null ? void 0 : t.replace(/\s+/g, "");
|
|
338
|
+
}, bt = 10, wt = 5;
|
|
339
|
+
function _e(t, e, s, n = !1, o = bt, l = wt) {
|
|
340
|
+
const i = s.parentElement, a = document.querySelector(".ai-editor-menu");
|
|
341
|
+
if (t === null || !i || a) {
|
|
342
|
+
e.style.opacity = "0", e.style.transform = "translate(-10000px, -10000px)", Tt();
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const r = e.getBoundingClientRect(), c = i.getBoundingClientRect();
|
|
346
|
+
let f = t.top - r.height - o;
|
|
347
|
+
f < 0 && (f = 10);
|
|
348
|
+
let u = t.left - l;
|
|
349
|
+
if (f < c.top && (f += r.height + t.height + o * 2), u + r.width > c.right && (u = c.right - r.width - l), t.bottom - t.height > c.bottom) {
|
|
350
|
+
e.style.transform = "translate(-1000px, -1000px)";
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (t.bottom + t.height < c.top) {
|
|
354
|
+
e.style.transform = "translate(-1000px, -1000px)";
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
let C = f;
|
|
358
|
+
r.top >= c.bottom && (C = c.bottom), e.style.transform = `translate(${u}px, ${C}px)`, e.style.opacity = "1", Nt();
|
|
359
|
+
}
|
|
360
|
+
const Se = (t) => {
|
|
361
|
+
const e = g(), s = m(), n = s == null ? void 0 : s.getParent(), o = n == null ? void 0 : n.getParent();
|
|
362
|
+
if (s) {
|
|
363
|
+
if (St())
|
|
364
|
+
return S().clear(), e.insertParagraph(), !0;
|
|
365
|
+
if (o instanceof F || o instanceof ot)
|
|
366
|
+
return lt();
|
|
367
|
+
if (n instanceof Q)
|
|
368
|
+
return rt();
|
|
369
|
+
}
|
|
370
|
+
return !1;
|
|
371
|
+
}, Ne = (t, e) => {
|
|
372
|
+
var s, n, o, l, i, a;
|
|
373
|
+
if (t.dataTransfer) {
|
|
374
|
+
const r = Object.values(t.dataTransfer.files);
|
|
375
|
+
if (r && r.length)
|
|
376
|
+
return t.preventDefault(), t.target instanceof HTMLElement && ((s = e.current) != null && s.insertImages) && ((n = N(t.target)) == null || n.selectEnd(), r[0].type.includes("video") && ((o = e.current) != null && o.insertVideos) ? e.current.insertVideos(r) : r[0].type.includes("image") && ((l = e.current) != null && l.insertImages) ? e.current.insertImages(r) : r[0].type.includes("audio") && ((i = e.current) != null && i.insertMusics) ? e.current.insertMusics(r) : (a = e.current) != null && a.insertFiles && (e == null || e.current.insertFiles(r))), !0;
|
|
377
|
+
}
|
|
378
|
+
return !1;
|
|
379
|
+
}, Te = () => {
|
|
380
|
+
const t = m(), e = t == null ? void 0 : t.getParent();
|
|
381
|
+
return t && it(e) ? at() : !1;
|
|
382
|
+
}, Le = () => {
|
|
383
|
+
const t = m(), e = t == null ? void 0 : t.getParent();
|
|
384
|
+
return t && K(e) ? ct() : !1;
|
|
385
|
+
}, Pt = (t) => {
|
|
386
|
+
const e = g();
|
|
387
|
+
if (!p(e) || !e.isCollapsed())
|
|
388
|
+
return !1;
|
|
389
|
+
const s = e.anchor.getNode();
|
|
390
|
+
if (s.getPreviousSibling() === null && e.anchor.offset === 0) {
|
|
391
|
+
const n = s.getParent();
|
|
392
|
+
if (n) {
|
|
393
|
+
const o = b();
|
|
394
|
+
return o.append(...n.getChildren()), n.replace(o), t.preventDefault(), !0;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return !1;
|
|
398
|
+
};
|
|
399
|
+
function Ot(t) {
|
|
400
|
+
if (!t) return null;
|
|
401
|
+
const s = new DOMParser().parseFromString(t, "text/html").body, n = Array.from(s.children);
|
|
402
|
+
if (n.length !== 1) return null;
|
|
403
|
+
const o = n[0];
|
|
404
|
+
return o.tagName !== "IMG" || s.textContent && s.textContent.trim().length > 0 ? null : o.getAttribute("src") || "" || null;
|
|
405
|
+
}
|
|
406
|
+
const be = (t, e, s) => {
|
|
407
|
+
var l, i;
|
|
408
|
+
const n = m(), o = n == null ? void 0 : n.getParent();
|
|
409
|
+
if (n) {
|
|
410
|
+
if (K(o))
|
|
411
|
+
return ft(t);
|
|
412
|
+
if (I(o))
|
|
413
|
+
(i = (l = s.current) == null ? void 0 : l.onDeleteCallout) == null || i.call(l, e);
|
|
414
|
+
else {
|
|
415
|
+
if (H(o))
|
|
416
|
+
return ut(t);
|
|
417
|
+
if (v(o))
|
|
418
|
+
return Pt(e);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return !1;
|
|
422
|
+
}, we = (t, e) => {
|
|
423
|
+
const s = e.ctrlKey || e.metaKey, n = e.shiftKey, o = e.code === "KeyZ";
|
|
424
|
+
return s && n && o ? (e.preventDefault(), t.dispatchCommand(q, void 0), !0) : !1;
|
|
425
|
+
}, Pe = (t, e, s, n, o) => {
|
|
426
|
+
var a, r;
|
|
427
|
+
if (o)
|
|
428
|
+
return n.preventDefault(), n.key === "Enter" && n.shiftKey && e.insertParagraph(), !0;
|
|
429
|
+
const l = m(), i = l == null ? void 0 : l.getParent();
|
|
430
|
+
if (l) {
|
|
431
|
+
if (i instanceof A)
|
|
432
|
+
return dt(t);
|
|
433
|
+
if (i instanceof F)
|
|
434
|
+
return gt(t);
|
|
435
|
+
if (i instanceof X)
|
|
436
|
+
return ht(t);
|
|
437
|
+
if (i instanceof tt)
|
|
438
|
+
return pt(t);
|
|
439
|
+
if (i instanceof et || A)
|
|
440
|
+
return mt();
|
|
441
|
+
}
|
|
442
|
+
return (r = (a = s.current) == null ? void 0 : a.decoratorEnterAction) == null || r.call(a), !1;
|
|
443
|
+
};
|
|
444
|
+
function Oe(t, e) {
|
|
445
|
+
var s, n, o, l, i, a, r, c;
|
|
446
|
+
if ("dataTransfer" in t && ((n = (s = t.dataTransfer) == null ? void 0 : s.files) != null && n.length)) {
|
|
447
|
+
const f = Array.from(t.dataTransfer.files), u = f[0];
|
|
448
|
+
return u.type.includes("video") && ((o = e.current) != null && o.insertVideos) ? e.current.insertVideos(f) : u.type.includes("image") && ((l = e.current) != null && l.insertImages) ? e.current.insertImages(f) : u.type.includes("audio") && ((i = e.current) != null && i.insertMusics) ? e.current.insertMusics(f) : (a = e.current) != null && a.insertFiles && e.current.insertFiles(f), !0;
|
|
449
|
+
}
|
|
450
|
+
if ("clipboardData" in t) {
|
|
451
|
+
const f = (c = (r = t.clipboardData) == null ? void 0 : r.getData("text/html")) == null ? void 0 : c.trim();
|
|
452
|
+
if (Ot(f))
|
|
453
|
+
return !0;
|
|
454
|
+
}
|
|
455
|
+
return !1;
|
|
456
|
+
}
|
|
457
|
+
function xe(t) {
|
|
458
|
+
if (!t || t.classList.contains("video-container") || t.classList.contains("resizable-container") || t.classList.contains("editor-image"))
|
|
459
|
+
return null;
|
|
460
|
+
if (t.closest("ol, ul"))
|
|
461
|
+
return t;
|
|
462
|
+
let e = t;
|
|
463
|
+
for (; e && !e.classList.contains("ContentEditable__root"); )
|
|
464
|
+
e = e.parentElement;
|
|
465
|
+
if (e != null && e.classList.contains("ContentEditable__root")) {
|
|
466
|
+
let s = t;
|
|
467
|
+
for (; s && s.parentElement !== e; )
|
|
468
|
+
s = s.parentElement;
|
|
469
|
+
return s;
|
|
470
|
+
}
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
function Ae(t, e = !1) {
|
|
474
|
+
t.focus(), t.update(() => {
|
|
475
|
+
var n, o;
|
|
476
|
+
const s = S();
|
|
477
|
+
e ? (s.selectStart(), (n = s.getFirstChild()) == null || n.selectEnd()) : (s.selectEnd(), (o = s.getLastChild()) == null || o.selectEnd());
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
export {
|
|
481
|
+
L as $,
|
|
482
|
+
me as A,
|
|
483
|
+
qt as B,
|
|
484
|
+
ae as C,
|
|
485
|
+
re as D,
|
|
486
|
+
se as E,
|
|
487
|
+
oe as F,
|
|
488
|
+
Nt as G,
|
|
489
|
+
jt as H,
|
|
490
|
+
Jt as I,
|
|
491
|
+
pe as J,
|
|
492
|
+
be as K,
|
|
493
|
+
le as L,
|
|
494
|
+
Tt as M,
|
|
495
|
+
Ee as N,
|
|
496
|
+
Wt as O,
|
|
497
|
+
_e as P,
|
|
498
|
+
ee as Q,
|
|
499
|
+
Qt as R,
|
|
500
|
+
ne as S,
|
|
501
|
+
ye as T,
|
|
502
|
+
Zt as U,
|
|
503
|
+
Ae as V,
|
|
504
|
+
we as a,
|
|
505
|
+
Le as b,
|
|
506
|
+
ie as c,
|
|
507
|
+
Se as d,
|
|
508
|
+
Te as e,
|
|
509
|
+
Ne as f,
|
|
510
|
+
Yt as g,
|
|
511
|
+
xe as h,
|
|
512
|
+
m as i,
|
|
513
|
+
Xt as j,
|
|
514
|
+
Pe as k,
|
|
515
|
+
vt as l,
|
|
516
|
+
ce as m,
|
|
517
|
+
yt as n,
|
|
518
|
+
Ct as o,
|
|
519
|
+
Oe as p,
|
|
520
|
+
ue as q,
|
|
521
|
+
fe as r,
|
|
522
|
+
Vt as s,
|
|
523
|
+
te as t,
|
|
524
|
+
St as u,
|
|
525
|
+
de as v,
|
|
526
|
+
ge as w,
|
|
527
|
+
Ht as x,
|
|
528
|
+
he as y,
|
|
529
|
+
Ce as z
|
|
530
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("lexical"),g=require("./layers.B90YwJga.js"),x=require("./layers.Cnm-pECN.js"),k=require("@lexical/utils"),O=require("@lexical/selection");require("@lexical/code");require("@lexical/hashtag");require("@lexical/link");require("@lexical/mark");require("@lexical/overflow");require("@lexical/react/LexicalHorizontalRuleNode");require("@lexical/rich-text");const f=require("./layers.CZ_Lt7IL.js");function T(e,t){if(t.add(e.getKey()),r.$isElementNode(e))for(const n of e.getChildren())T(n,t)}function I(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}const R=r.createCommand(),F=r.createCommand(),K=r.createCommand(),B=r.createCommand(),U=r.createCommand(),q=r.createCommand(),z=r.createCommand(),W=r.createCommand(),G=(()=>{var t;const e=(t=window.navigator)==null?void 0:t.userAgentData;return e!==void 0?e.mobile:window.innerWidth<=800&&window.innerHeight<=600})(),V=e=>typeof e=="string"&&e.includes("%")?parseFloat(e):e;function H(e,t){if(!t||!(t instanceof HTMLElement)){console.error("Invalid DOM element provided.");return}e?t.classList.add("disable-scroll"):t.classList.remove("disable-scroll")}function m(e){const t=r.$getSelection();if(r.$isRangeSelection(t)){const o=t.anchor.getNode();if(o!==null){const s=o.getParent();return e?s:o}}return null}function Y(e){e.update(()=>{const t=r.$getSelection();if(r.$isRangeSelection(t)){const n=t.getNodes();let o=null,s=null;if(n.forEach((l,c)=>{c===0&&(o=l.getParent()),c===n.length-1&&(s=l.getParent())}),o&&s){const l=r.$getSelection();r.$isRangeSelection(l)&&(o.isAttached()&&s.isAttached()?g.$isExtendedTextNode(o)&&g.$isExtendedTextNode(s)?l.setTextNodeRange(o,0,s,s.getTextContentSize()):(l.anchor.set(o.getKey(),0,"element"),l.focus.set(s.getKey(),s.getChildrenSize(),"element")):console.error("Error: One of the nodes is not attached."))}}})}const $=(e,t)=>{e.update(()=>{if(typeof t=="string"){const n=r.$getNodeByKey(t);n&&n.remove();return}t&&t.remove()})};function J(e,t){t.update(()=>{let n=r.$createRangeSelection();e.getParent()&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(e.getKey(),0,"element"),r.$setSelection(n))})}function j(){const e=r.$getSelection();if(r.$isRangeSelection(e)){const t=e.anchor,n=e.focus,o=n.getNode(),s=g.$isExtendedCodeNode(o)?o.__size:o.getTextContentSize(),l=t.offset===0,c=n.offset===s;if(l&&c)return!0}return!1}function Z(e,t){const n=r.$copyNode(e),o=[[e,n]];let s;for(;(s=o.length)>0;)for(let l=0;l<s;l++){const c=o.shift();if(c!==void 0){const[a,i]=c;if(r.$isElementNode(a)&&r.$isElementNode(i)){const d=a.getChildren();for(const u of d){if(t&&u.is(t))continue;const h=r.$copyNode(u);g.$isExtendedTextNode(u)&&g.$isExtendedTextNode(h)&&(h.setFormat(u.__format),h.setStyle(u.__style)),i.append(h),o.push([u,h])}}}}return n}function v(e,t,n=3){if(!e)return null;let o=e,s=0;for(;o&&s<n;){if(t(o))return o;if(o.__type==="root")break;o=o.getParent(),s++}return null}function E(e,t,n){var s;const o=n||{root:!0};if(e){let l=e.getParent();if(o[l==null?void 0:l.__type]){const c=t.getElementByKey(e.__key),a=v(l,g.$isCalloutNode);if(a&&(a.getFirstChild()===e.getTopLevelElement()||a.getFirstChild()===((s=e.getTopLevelElement())==null?void 0:s.getParent()))){const d=a.getParent(),u=d?t.getElementByKey(d.__key):null;if(u)return{htmlElement:u,lexicalNode:r.$getNearestNodeFromDOMNode(u)}}return{htmlElement:c,lexicalNode:e}}return E(l,t,o)}return{htmlElement:null,lexicalNode:null}}function Q(e,t,n,o){var s;if(e)if((e==null?void 0:e.__type)==="root"||(e==null?void 0:e.__type)==="layout-item"||(e==null?void 0:e.__type)==="callout-wrapper"||(e==null?void 0:e.__type)==="collapsible-content"){const l=(o==null?void 0:o.clientY)||0,{left:c}=((s=t.getElementByKey(e.__key))==null?void 0:s.getBoundingClientRect())||{left:0},{paddingLeft:a}=window.getComputedStyle(o==null?void 0:o.target),i=document.elementFromPoint(c+parseFloat(a)+10,l),d=r.$getNearestNodeFromDOMNode(i||document.body);return d?E(d,t,n):{htmlElement:null,lexicalNode:null}}else return E(e,t,n);return{htmlElement:null,lexicalNode:null}}const X=e=>{e.update(()=>{r.$getSelection()!==null&&r.$setSelection(null)})},ee=()=>{const e=r.$getRoot(),t=e==null?void 0:e.getFirstChild();return e.getChildren().length>1?!1:t&&r.$isElementNode(t)&&t.isEmpty()&&!g.$isExtendedCodeNode(t)},te=e=>{e.update(()=>{const t=r.$getRoot(),n=r.$createParagraphNode(),o=r.$getSelection();r.$isRangeSelection(o)&&(o.format=0,o.setStyle("")),t.append(n).selectEnd()})},ne=(e,t,n)=>{const o=e.target;if(o&&(o instanceof HTMLElement||o instanceof SVGElement)){let s=null;const l=o.closest(t);for(const a of n)if(s=o.closest(a),s)break;return{lexicalDOMNode:l,isOutside:!(l||s)}}else return{lexicalDOMNode:null,isOutside:!0}};async function*L(e){let t=!1;for(;!t;){const n=await e.read(),{value:o}=n;o!==void 0&&(yield o),t=n.done}}async function oe(e){const t=[];for await(const o of L(e))for(let s=0;s<o.length;s+=32768)t.push(String.fromCharCode(...o.subarray(s,s+32768)));return t.join("")}async function se(e){const t=new CompressionStream("gzip"),n=t.writable.getWriter(),[,o]=await Promise.all([n.write(new TextEncoder().encode(JSON.stringify(e))).then(()=>n.close()),oe(t.readable.getReader())]);return`#doc=${btoa(o).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,"")}`}async function le(e){const t=/^#doc=(.*)$/.exec(e);if(!t)return null;const n=new DecompressionStream("gzip"),o=n.writable.getWriter(),s=atob(t[1].replace(/_/g,"/").replace(/-/g,"+")),l=new Uint8Array(s.length);for(let i=0;i<s.length;i++)l[i]=s.charCodeAt(i);const c=o.write(l).then(()=>o.close()),a=[];for await(const i of L(n.readable.pipeThrough(new TextDecoderStream).getReader()))a.push(i);return await c,JSON.parse(a.join(""))}const P=()=>!!document.querySelector(".selected-all-document"),re=(e,t,n)=>{var s,l,c,a,i;const o=r.$getSelection();if(r.$isRangeSelection(o)&&o.isCollapsed()){const d=o.anchor.getNode(),u=d.getKey(),h=d.getParent()===n,C=n instanceof r.ElementNode&&(n.__type==="layout-item"?(l=(s=n.getLastChild())==null?void 0:s.getPreviousSibling())==null?void 0:l.getKey():(c=n.getLastChild())==null?void 0:c.getKey())===u,b=n instanceof r.ElementNode&&((a=n.getFirstChild())==null?void 0:a.getKey())===u;if(n&&d instanceof r.ParagraphNode&&!d.getTextContent()&&h&&!((i=d.getPreviousSibling())!=null&&i.getTextContent())&&C&&!b){const D=e.registerCommand(r.INSERT_PARAGRAPH_COMMAND,()=>(D(),!0),r.COMMAND_PRIORITY_NORMAL);return e.update(()=>{var _;if(n){let p=n.getChildren();const w=n.getLastChild();g.$isLayoutDividerNode(w)&&(p=p.slice(0,-1)),p.length===2?p.slice(-1).forEach(y=>y.remove()):p.slice(-2).forEach(y=>y.remove())}const S=t==null?void 0:t.getNextSibling();if(r.$isParagraphNode(S)&&S.getTextContent()==="")(_=t==null?void 0:t.getNextSibling())==null||_.selectEnd();else{const p=t==null?void 0:t.insertAfter(r.$createParagraphNode());p==null||p.selectStart()}}),!0}}return!1},ie=(e,t,n)=>{var l,c,a;const o=(n==null?void 0:n.getChildren())||[];if((o==null?void 0:o.length)===2){for(const i of o)i.__key!==(t==null?void 0:t.__key)&&(n==null||n.insertBefore(i),(l=i.getFirstChild())==null||l.selectEnd());n.remove()}else for(const i of o)if(i.__key===(t==null?void 0:t.__key)){x.setTemplateColumnsAfterDelete(e,i),$(e,i);const d=i.getPreviousSibling()??i.getNextSibling();(a=(c=d==null?void 0:d.getFirstChild)==null?void 0:c.call(d))==null||a.selectEnd()}const s=e.registerCommand(r.DELETE_CHARACTER_COMMAND,()=>(s(),!0),r.COMMAND_PRIORITY_NORMAL);return!0},ce=(e,t,n)=>{if(!e)return null;let o=null;return n.read(()=>{const s=r.$getNearestNodeFromDOMNode(e);o=s&&k.$getNearestNodeOfType(s,t)}),o};function ae(e){return e instanceof HTMLElement}function N(e){let t=0;e instanceof WheelEvent?t=e.deltaY:e instanceof TouchEvent&&(t=1);let n=e.target;for(;n&&n!==document.body&&n!==document.documentElement;){if(n.scrollHeight>n.clientHeight&&(t<0&&n.scrollTop>0||t>0&&n.scrollTop+n.clientHeight<n.scrollHeight))return;n=n.parentElement}e.preventDefault()}function A(){document.addEventListener("wheel",N,{passive:!1}),document.addEventListener("touchmove",N,{passive:!1})}function M(){document.removeEventListener("wheel",N),document.removeEventListener("touchmove",N)}function de(e){const t=e.anchor,n=e.focus,o=e.anchor.getNode(),s=e.focus.getNode();return o===s?o:e.isBackward()?O.$isAtNodeEnd(n)?o:s:O.$isAtNodeEnd(t)?o:s}const ue=new Set(["http:","https:","mailto:","sms:","tel:"]);function fe(e){try{const t=new URL(e);if(!ue.has(t.protocol))return"about:blank"}catch{return e}return e}function ge(e,t){const n=e.getRangeAt(0);let o;if(e.anchorNode===t){let s=t;for(;s.firstElementChild!=null;)s=s.firstElementChild;o=s.getBoundingClientRect()}else o=n.getBoundingClientRect();return o}const he=()=>{var n;const e=(n=window.getSelection())==null?void 0:n.toString().trim();return e==null?void 0:e.replace(/\s+/g,"")},pe=10,me=5;function Ce(e,t,n,o=!1,s=pe,l=me){const c=n.parentElement,a=document.querySelector(".ai-editor-menu");if(e===null||!c||a){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)",M();return}const i=t.getBoundingClientRect(),d=c.getBoundingClientRect();let u=e.top-i.height-s;u<0&&(u=10);let h=e.left-l;if(u<d.top&&(u+=i.height+e.height+s*2),h+i.width>d.right&&(h=d.right-i.width-l),e.bottom-e.height>d.bottom){t.style.transform="translate(-1000px, -1000px)";return}if(e.bottom+e.height<d.top){t.style.transform="translate(-1000px, -1000px)";return}let C=u;i.top>=d.bottom&&(C=d.bottom),t.style.transform=`translate(${h}px, ${C}px)`,t.style.opacity="1",A()}const Ee=e=>{const t=r.$getSelection(),n=m(),o=n==null?void 0:n.getParent(),s=o==null?void 0:o.getParent();if(n){if(P())return r.$getRoot().clear(),t.insertParagraph(),!0;if(s instanceof f.CollapsibleContentNode||s instanceof f.CollapsibleTitleNode)return f.handleDeleteCollapsibleCharacter();if(o instanceof g.ExtendCodeNode)return f.handleDeleteCodeCharacter()}return!1},Ne=(e,t)=>{var n,o,s,l,c,a;if(e.dataTransfer){const i=Object.values(e.dataTransfer.files);if(i&&i.length)return e.preventDefault(),e.target instanceof HTMLElement&&((n=t.current)!=null&&n.insertImages)&&((o=r.$getNearestNodeFromDOMNode(e.target))==null||o.selectEnd(),i[0].type.includes("video")&&((s=t.current)!=null&&s.insertVideos)?t.current.insertVideos(i):i[0].type.includes("image")&&((l=t.current)!=null&&l.insertImages)?t.current.insertImages(i):i[0].type.includes("audio")&&((c=t.current)!=null&&c.insertMusics)?t.current.insertMusics(i):(a=t.current)!=null&&a.insertFiles&&(t==null||t.current.insertFiles(i))),!0}return!1},ye=()=>{const e=m(),t=e==null?void 0:e.getParent();return e&&f.$isCollapsibleContentNode(t)?f.$onEscapeDownRightCollapsible():!1},Se=()=>{const e=m(),t=e==null?void 0:e.getParent();return e&&f.$isCollapsibleTitleNode(t)?f.$onEscapeUpLeftCollapsible():!1},_e=e=>{const t=r.$getSelection();if(!r.$isRangeSelection(t)||!t.isCollapsed())return!1;const n=t.anchor.getNode();if(n.getPreviousSibling()===null&&t.anchor.offset===0){const o=n.getParent();if(o){const s=r.$createParagraphNode();return s.append(...o.getChildren()),o.replace(s),e.preventDefault(),!0}}return!1};function Oe(e){if(!e)return null;const n=new DOMParser().parseFromString(e,"text/html").body,o=Array.from(n.children);if(o.length!==1)return null;const s=o[0];return s.tagName!=="IMG"||n.textContent&&n.textContent.trim().length>0?null:s.getAttribute("src")||""||null}const Te=(e,t,n)=>{var l,c;const o=m(),s=o==null?void 0:o.getParent();if(o){if(f.$isCollapsibleTitleNode(s))return f.deleteCollapsibleContainer(e);if(g.$isCalloutNode(s))(c=(l=n.current)==null?void 0:l.onDeleteCallout)==null||c.call(l,t);else{if(g.$isLayoutItemNode(s))return f.deleteLayoutItem(e);if(g.$isListItemNode(s))return _e(t)}}return!1},$e=(e,t)=>{const n=t.ctrlKey||t.metaKey,o=t.shiftKey,s=t.code==="KeyZ";return n&&o&&s?(t.preventDefault(),e.dispatchCommand(r.REDO_COMMAND,void 0),!0):!1},Le=(e,t,n,o,s)=>{var a,i;if(s)return o.preventDefault(),o.key==="Enter"&&o.shiftKey&&t.insertParagraph(),!0;const l=m(),c=l==null?void 0:l.getParent();if(l){if(c instanceof g.LayoutItemNode)return f.handleExitLayout(e);if(c instanceof f.CollapsibleContentNode)return f.handleExitCollapsible(e);if(c instanceof g.CalloutNode)return f.handleExitCallout(e);if(c instanceof g.TableCellNode)return f.handleExitTable(e);if(c instanceof g.ListNode||g.LayoutItemNode)return f.handleEnterCheckList()}return(i=(a=n.current)==null?void 0:a.decoratorEnterAction)==null||i.call(a),!1};function Pe(e,t){var n,o,s,l,c,a,i,d;if("dataTransfer"in e&&((o=(n=e.dataTransfer)==null?void 0:n.files)!=null&&o.length)){const u=Array.from(e.dataTransfer.files),h=u[0];return h.type.includes("video")&&((s=t.current)!=null&&s.insertVideos)?t.current.insertVideos(u):h.type.includes("image")&&((l=t.current)!=null&&l.insertImages)?t.current.insertImages(u):h.type.includes("audio")&&((c=t.current)!=null&&c.insertMusics)?t.current.insertMusics(u):(a=t.current)!=null&&a.insertFiles&&t.current.insertFiles(u),!0}if("clipboardData"in e){const u=(d=(i=e.clipboardData)==null?void 0:i.getData("text/html"))==null?void 0:d.trim();if(Oe(u))return!0}return!1}function Ae(e){if(!e||e.classList.contains("video-container")||e.classList.contains("resizable-container")||e.classList.contains("editor-image"))return null;if(e.closest("ol, ul"))return e;let t=e;for(;t&&!t.classList.contains("ContentEditable__root");)t=t.parentElement;if(t!=null&&t.classList.contains("ContentEditable__root")){let n=e;for(;n&&n.parentElement!==t;)n=n.parentElement;return n}return null}function Me(e,t=!1){e.focus(),e.update(()=>{var o,s;const n=r.$getRoot();t?(n.selectStart(),(o=n.getFirstChild())==null||o.selectEnd()):(n.selectEnd(),(s=n.getLastChild())==null||s.selectEnd())})}exports.$copyNodeDeep=Z;exports.$createNewParagraph=te;exports.$getBlockNode=Q;exports.$getClosestParentNode=E;exports.CREATE_TEMPLATE=q;exports.INSERT_CALLOUT_COMMAND=K;exports.KeyBackSpace=Te;exports.ON_CHANGE_COMMAND=R;exports.ON_OPEN_KEBAB_MENU=F;exports.ON_SCROLL_EDITOR=B;exports.ON_SHOW_LINK_POPUP=U;exports.OPEN_EMOJI_PICKER_COMMAND=W;exports.RIGHT_CLICK_COMMAND=z;exports.addNodeAndChildrenToSelection=T;exports.allEditorSelected=P;exports.blockScroll=A;exports.checkIsEmpty=ee;exports.deleteCharacterCommand=Ee;exports.deleteNode=$;exports.docFromHash=le;exports.docToHash=se;exports.dropCommand=Ne;exports.findTopParentElement=Ae;exports.focusEditor=Me;exports.focusOnNode=J;exports.getCurrentElement=m;exports.getDOMRangeRect=ge;exports.getMouseInfo=ne;exports.getNativeSelectedText=he;exports.getNearestBlockNodeOfType=ce;exports.getSelectedNode=de;exports.handleEnterExitContainer=re;exports.isHTMLElement=ae;exports.isMobile=G;exports.isWholeNodeSelected=j;exports.keyArrowRightDown=ye;exports.keyArrowUpLeft=Se;exports.keyDownCommand=$e;exports.keyEnterListener=Le;exports.parseContainerSize=V;exports.pasteCommand=Pe;exports.removeNodeKeepContent=ie;exports.resetSelection=X;exports.sanitizeUrl=fe;exports.selectCurrentNode=Y;exports.setFloatingElemPosition=Ce;exports.stopEvent=I;exports.toggleLockScroll=H;exports.unblockScroll=M;
|