@layers-app/editor 0.5.6-optimization → 0.5.6

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 (256) hide show
  1. package/README.md +0 -19
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.js +10 -12
  4. package/dist/layers.52famHy6.js +1 -0
  5. package/dist/layers.59MV1gHs.js +41 -0
  6. package/dist/layers.6IaGqrl-.js +39 -0
  7. package/dist/layers.6lqPO-3Z.js +32 -0
  8. package/dist/layers.7JqFgE4-.js +15 -0
  9. package/dist/layers.8CsJHG7m.js +139 -0
  10. package/dist/layers.9pNaFvaX.js +1 -0
  11. package/dist/layers.AK6shBV6.js +42 -0
  12. package/dist/layers.AamAEMA7.js +160 -0
  13. package/dist/layers.B-WGMHL6.js +11 -0
  14. package/dist/layers.B19hGmey.js +1 -0
  15. package/dist/layers.B2wUdnez.js +437 -0
  16. package/dist/layers.B3D4g2HH.js +1 -0
  17. package/dist/layers.B6FBUZ1Z.js +9 -0
  18. package/dist/layers.B7-Kk2kp.js +11 -0
  19. package/dist/layers.B7K7JjK6.js +1510 -0
  20. package/dist/layers.B7USkgSi.js +6 -0
  21. package/dist/layers.B7hegMVr.js +1034 -0
  22. package/dist/layers.BAtv1CM7.js +1 -0
  23. package/dist/layers.BBSE_YmF.js +37 -0
  24. package/dist/layers.BCG8kdU-.js +32 -0
  25. package/dist/layers.BCUz59rh.js +39 -0
  26. package/dist/layers.BF8ID4w9.js +39 -0
  27. package/dist/layers.BIZaN3QR.js +7 -0
  28. package/dist/layers.BIeVwYKL.js +1 -0
  29. package/dist/layers.BJDrjORS.js +244 -0
  30. package/dist/layers.BK35bp4_.js +931 -0
  31. package/dist/layers.BKrHVgKG.js +11 -0
  32. package/dist/layers.BLd2spTm.js +1 -0
  33. package/dist/layers.BQj7sYv9.js +4 -0
  34. package/dist/layers.BSTBZrFn.js +1 -0
  35. package/dist/layers.BTnY40Hl.js +230 -0
  36. package/dist/layers.BW6eTqTQ.js +9 -0
  37. package/dist/layers.BX50pyFe.js +42 -0
  38. package/dist/layers.BXiMBNCf.js +7 -0
  39. package/dist/layers.BY0saexf.js +44 -0
  40. package/dist/layers.BYyHDhdF.js +40 -0
  41. package/dist/layers.B_SkKQaN.js +7 -0
  42. package/dist/layers.Bb45BkB7.js +35 -0
  43. package/dist/layers.BbCfEXyj.js +55 -0
  44. package/dist/layers.Bbx2DS9P.js +10 -0
  45. package/dist/layers.BeRqUeUL.js +1 -0
  46. package/dist/layers.BfBHY8YH.js +8 -0
  47. package/dist/layers.BfPqzMs9.js +1 -0
  48. package/dist/layers.Bfqazne8.js +70 -0
  49. package/dist/layers.BgzFjX4U.js +35 -0
  50. package/dist/layers.BhL3qtd0.js +1126 -0
  51. package/dist/layers.BitUjngp.js +11 -0
  52. package/dist/layers.BmR6H-fP.js +2966 -0
  53. package/dist/layers.Bn7g95cI.js +39 -0
  54. package/dist/layers.Bn7hw-zZ.js +13 -0
  55. package/dist/layers.BnYpz8RW.js +1359 -0
  56. package/dist/layers.BoIdFEtV.js +186 -0
  57. package/dist/layers.BorvTy9p.js +33 -0
  58. package/dist/layers.BpilXLfW.js +6 -0
  59. package/dist/layers.Bt8HOTA6.js +10 -0
  60. package/dist/layers.BvVfdnbz.js +41 -0
  61. package/dist/layers.BzUNMS1L.js +2 -0
  62. package/dist/layers.C-FZw43o.js +41 -0
  63. package/dist/layers.C0Lgw_Sx.js +11688 -0
  64. package/dist/layers.C4ToPutV.js +40 -0
  65. package/dist/layers.C4wkiWhv.js +8 -0
  66. package/dist/layers.C5ZDJAAD.js +220 -0
  67. package/dist/layers.C6P4YEcq.js +257 -0
  68. package/dist/layers.C7x1USYv.js +139 -0
  69. package/dist/layers.C8_lu5UH.js +23 -0
  70. package/dist/layers.C99jO8bw.js +1 -0
  71. package/dist/layers.C9KoadvU.js +122 -0
  72. package/dist/layers.C9PwfpMh.js +39 -0
  73. package/dist/layers.CA8KMZRI.js +1 -0
  74. package/dist/layers.CAGTppwS.js +4 -0
  75. package/dist/layers.CAgoPdOX.js +1088 -0
  76. package/dist/layers.CBb84SJY.js +10 -0
  77. package/dist/layers.CCaOiFeL.js +9 -0
  78. package/dist/layers.CChtus6s.js +9 -0
  79. package/dist/layers.CDpYDf4E.js +41 -0
  80. package/dist/layers.CElZbgj1.js +61 -0
  81. package/dist/layers.CFXi5TGg.js +5 -0
  82. package/dist/layers.CGvSf-pD.js +10 -0
  83. package/dist/layers.CH7Yhxyl.js +1 -0
  84. package/dist/layers.CHZsXQcr.js +1 -0
  85. package/dist/layers.CHbqHHw4.js +10 -0
  86. package/dist/layers.CIK15Iw8.js +1 -0
  87. package/dist/layers.CIpcY9uj.js +38 -0
  88. package/dist/layers.CK2ePV5l.js +1 -0
  89. package/dist/layers.CKOfAypO.js +1 -0
  90. package/dist/layers.CKuoZO2o.js +5 -0
  91. package/dist/layers.CLELtUjk.js +40 -0
  92. package/dist/layers.CNmEkwvP.js +84 -0
  93. package/dist/layers.CPJv1Tc9.js +46859 -0
  94. package/dist/layers.CPlQgHvJ.js +37 -0
  95. package/dist/layers.CR9KcJml.js +9 -0
  96. package/dist/layers.CRFf4NzO.js +10 -0
  97. package/dist/layers.CSI1-wyP.js +1 -0
  98. package/dist/layers.CTmWmJtN.js +32 -0
  99. package/dist/layers.CXqT56ec.js +304 -0
  100. package/dist/layers.CZ5YSh6D.js +8 -0
  101. package/dist/layers.C_2s_qym.js +3 -0
  102. package/dist/layers.C_IvrzZ3.js +7 -0
  103. package/dist/layers.C_fjSuvx.js +1 -0
  104. package/dist/layers.CaMAncU5.js +423 -0
  105. package/dist/layers.CcaiUz4r.js +1 -0
  106. package/dist/layers.Cd1zz9ej.js +39 -0
  107. package/dist/layers.CeafY0UM.js +37 -0
  108. package/dist/layers.CfcMk6Ta.js +1 -0
  109. package/dist/layers.Cfl_HoMI.js +769 -0
  110. package/dist/layers.CfpNlmP9.js +1 -0
  111. package/dist/layers.CiTTUiMF.js +8 -0
  112. package/dist/layers.Cj4cFFtZ.js +189 -0
  113. package/dist/layers.CmdoC_9-.js +7 -0
  114. package/dist/layers.CoGB8bed.js +8 -0
  115. package/dist/layers.Cpy28Z7d.js +35 -0
  116. package/dist/layers.CqVTtuYm.js +6 -0
  117. package/dist/layers.Cu93NN5Z.js +41 -0
  118. package/dist/layers.Cu9NodvY.js +1089 -0
  119. package/dist/layers.CvBE5BLz.js +118 -0
  120. package/dist/layers.Cx9zn9dM.js +41 -0
  121. package/dist/layers.CxJcDiDE.js +65 -0
  122. package/dist/layers.Cyzu9PKQ.js +1 -0
  123. package/dist/layers.CzAsjHtw.js +34 -0
  124. package/dist/layers.D0kgeXsw.js +1619 -0
  125. package/dist/layers.D0zn4_Mx.js +1 -0
  126. package/dist/layers.D1Vfjokq.js +32 -0
  127. package/dist/layers.D1rIvRN6.js +9 -0
  128. package/dist/layers.D22i1Ls7.js +6 -0
  129. package/dist/layers.D25D_N3C.js +7 -0
  130. package/dist/layers.D4T8fTcj.js +1223 -0
  131. package/dist/layers.D4fXRymr.js +40 -0
  132. package/dist/layers.D4gUAtLW.js +41 -0
  133. package/dist/layers.D59PMsKH.js +51 -0
  134. package/dist/layers.D5_C65FS.js +2479 -0
  135. package/dist/layers.D5j-6Vz3.js +36 -0
  136. package/dist/layers.D7ikYTua.js +2235 -0
  137. package/dist/layers.D7jGxypv.js +8 -0
  138. package/dist/layers.D7n2QyFM.js +48146 -0
  139. package/dist/layers.D8fdxG58.js +295 -0
  140. package/dist/layers.D9h1AMfz.js +8 -0
  141. package/dist/layers.DAsAtqWK.js +4 -0
  142. package/dist/layers.DBVrBhF0.js +1 -0
  143. package/dist/layers.DCWjWRvL.js +9 -0
  144. package/dist/layers.DD9dfhit.js +40 -0
  145. package/dist/layers.DHD10kvJ.js +1 -0
  146. package/dist/layers.DHZBzVaT.js +1283 -0
  147. package/dist/layers.DHfSJOOW.js +1 -0
  148. package/dist/layers.DKJQWPVn.js +32 -0
  149. package/dist/layers.DKUfWSX1.js +904 -0
  150. package/dist/layers.DLK-HpMV.js +1 -0
  151. package/dist/layers.DLjZPfF1.js +802 -0
  152. package/dist/layers.DLwuMfdd.js +84 -0
  153. package/dist/layers.DMIDFKxo.js +36 -0
  154. package/dist/layers.DMkBISW1.js +1 -0
  155. package/dist/layers.DN9HoVxI.js +18 -0
  156. package/dist/layers.DOrgOHBr.js +1 -0
  157. package/dist/layers.DRvKjryx.js +1265 -0
  158. package/dist/layers.DTMLuJKN.js +33 -0
  159. package/dist/layers.DUJa2ZOS.js +8 -0
  160. package/dist/layers.DVUWZ8Wt.js +37 -0
  161. package/dist/layers.DVrOJIL5.js +7 -0
  162. package/dist/layers.DY6GA9ww.js +9166 -0
  163. package/dist/layers.D_Imug13.js +8 -0
  164. package/dist/layers.D_KJI4uf.js +1 -0
  165. package/dist/layers.D_vzZUhY.js +1 -0
  166. package/dist/layers.DaCB9yHC.js +4 -0
  167. package/dist/layers.DbaKVP5e.js +1 -0
  168. package/dist/layers.DcjluSHw.js +84 -0
  169. package/dist/layers.De0fDaHO.js +40 -0
  170. package/dist/layers.DeEGG6FS.js +42 -0
  171. package/dist/layers.DfFJCPRD.js +373 -0
  172. package/dist/layers.DfLz3NUP.js +320 -0
  173. package/dist/layers.DhW2E_US.js +1580 -0
  174. package/dist/layers.DjUOC4st.js +16 -0
  175. package/dist/layers.DjbsplkN.js +32 -0
  176. package/dist/layers.DkaJchxc.js +6 -0
  177. package/dist/layers.DlGVcszu.js +1 -0
  178. package/dist/layers.DlfnKTKF.js +42 -0
  179. package/dist/layers.DnxO-9oO.js +1 -0
  180. package/dist/layers.DqSkTf9R.js +21763 -0
  181. package/dist/layers.Dr1JK1_Z.js +202 -0
  182. package/dist/layers.Dr8zNYOs.js +5 -0
  183. package/dist/layers.DsiNLArY.js +40 -0
  184. package/dist/layers.DtP3hMV0.js +10 -0
  185. package/dist/layers.Du1ZlY6H.js +40 -0
  186. package/dist/layers.Du8uQ4JH.js +1 -0
  187. package/dist/layers.DuQ8oZjN.js +1 -0
  188. package/dist/layers.DuwNlZRl.js +11 -0
  189. package/dist/layers.Dw7Dmv6Y.js +19 -0
  190. package/dist/layers.DxA6ocdw.js +70 -0
  191. package/dist/layers.Dy1naDTQ.js +14 -0
  192. package/dist/layers.E1TwhuY2.js +791 -0
  193. package/dist/layers.Eelq_G9Y.js +803 -0
  194. package/dist/layers.Eodu_OXz.js +2 -0
  195. package/dist/layers.H36OYk_h.js +5 -0
  196. package/dist/layers.HVpHwo9E.js +5 -0
  197. package/dist/layers.I-tmhwFG.js +39 -0
  198. package/dist/layers.Is4NOcYC.js +9 -0
  199. package/dist/layers.J20L8tWx.js +501 -0
  200. package/dist/layers.JWCLFILJ.js +1 -0
  201. package/dist/layers.Jm82B3Oj.js +116 -0
  202. package/dist/layers.L60GQ2sb.js +8 -0
  203. package/dist/layers.LJC22eKQ.js +7 -0
  204. package/dist/layers.MW6tobI-.js +6 -0
  205. package/dist/layers.MZ6d0DZp.js +10 -0
  206. package/dist/layers.M_62Sbj7.js +268 -0
  207. package/dist/layers.O8Nxijec.js +793 -0
  208. package/dist/layers.OLlYwVPc.js +14 -0
  209. package/dist/layers.Pw46DBip.js +59 -0
  210. package/dist/layers.U98UFPWm.js +207 -0
  211. package/dist/layers.VXlo2W40.js +36 -0
  212. package/dist/layers.VlKfhmpq.js +10 -0
  213. package/dist/layers.YOQy_t6q.js +40 -0
  214. package/dist/layers.ZoMyFX9M.js +2 -0
  215. package/dist/layers._1XiIhPh.js +7 -0
  216. package/dist/layers.ay_dYKjj.js +960 -0
  217. package/dist/layers.b0h5ZBmD.js +61 -0
  218. package/dist/layers.dDe6FHmh.js +36 -0
  219. package/dist/layers.dVkHa3a_.js +39 -0
  220. package/dist/layers.et7zjoY9.js +52 -0
  221. package/dist/layers.gryxZo3n.js +10 -0
  222. package/dist/layers.hPuFhhxl.js +41 -0
  223. package/dist/layers.hweLqW3I.js +261 -0
  224. package/dist/layers.kaOt41rd.js +9 -0
  225. package/dist/layers.lCpg7dOn.js +21 -0
  226. package/dist/layers.lLFiut9N.js +8 -0
  227. package/dist/layers.lNSz2AQQ.js +6 -0
  228. package/dist/layers.mV8zYAS9.js +39 -0
  229. package/dist/layers.oyyMMK1Q.js +21938 -0
  230. package/dist/layers.qFWUlMDP.js +282 -0
  231. package/dist/layers.t46sYkQh.js +96 -0
  232. package/dist/layers.tdFdnJVX.js +38 -0
  233. package/dist/layers.u4sk_7sk.js +6 -0
  234. package/dist/layers.uEa7jWOw.js +42 -0
  235. package/dist/layers.uKwUcHfW.js +9 -0
  236. package/dist/layers.v6694Ulr.js +425 -0
  237. package/dist/layers.xkw2pWfm.js +40 -0
  238. package/dist/layers.ytXaFkr-.js +1 -0
  239. package/dist/layers.z5ZNUv1T.js +38 -0
  240. package/package.json +18 -76
  241. package/dist/layers.7jmq6tBR.js +0 -2227
  242. package/dist/layers.B90YwJga.js +0 -4
  243. package/dist/layers.C03OvlLb.js +0 -6
  244. package/dist/layers.CJiIq6YQ.js +0 -1
  245. package/dist/layers.CXffIp2y.js +0 -864
  246. package/dist/layers.CZPeYQ9g.js +0 -3
  247. package/dist/layers.CZ_Lt7IL.js +0 -7
  248. package/dist/layers.Ci1-qkbn.js +0 -341
  249. package/dist/layers.Cnm-pECN.js +0 -2
  250. package/dist/layers.D6d62qQ_.js +0 -6774
  251. package/dist/layers.DNCgFYS7.js +0 -27
  252. package/dist/layers.Dev6Yrwi.js +0 -530
  253. package/dist/layers.Dgok89qX.js +0 -1
  254. package/dist/layers.Dq3o7sh3.js +0 -7723
  255. package/dist/layers.Duy8YzsH.js +0 -2511
  256. package/dist/layers.QjAkD17S.js +0 -3677
@@ -1,530 +0,0 @@
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
- };
@@ -1 +0,0 @@
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;