@layers-app/editor 0.5.10-optimization → 0.6.0-specific.2
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 +2 -252
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +3 -4
- package/dist/index.js +11 -12
- package/dist/layers.BAh77n3h.js +53500 -0
- package/dist/layers.BR_PAAvW.js +319 -0
- package/dist/layers.BVrvmVeX.js +343 -0
- package/dist/layers.BeZDS7Yo.js +1 -0
- package/dist/layers.C9DRKDGJ.js +1 -0
- package/dist/layers.Dawun4Ev.js +44715 -0
- package/dist/layers.DwBS80Kn.js +285 -0
- package/dist/layers.Zo4c9OM_.js +161 -0
- package/package.json +23 -66
- package/dist/ExcalidrawComponent-D7Z_2awF.cjs +0 -1
- package/dist/ExcalidrawComponent-Re4zFgLg.js +0 -283
- package/dist/InlineImageComponent-DHgCaPNk.cjs +0 -1
- package/dist/InlineImageComponent-kXhZcmF6.js +0 -265
- package/dist/collaboration-C7xVk0Zj.cjs +0 -4
- package/dist/collaboration-Cn7KizEJ.js +0 -5997
- package/dist/excalidraw-C-6bid_P.js +0 -16497
- package/dist/excalidraw-DpwKTNBz.cjs +0 -574
- package/dist/index-B4yOqKUQ.cjs +0 -1
- package/dist/index-BZu8Qnrg.cjs +0 -1
- package/dist/index-CFA9Drk2.cjs +0 -16
- package/dist/index-CX5msaMB.js +0 -296
- package/dist/index-CbQX0N2c.js +0 -136
- package/dist/index-DEC5JR_F.js +0 -60
- package/dist/index-Dan3tqoj.cjs +0 -1
- package/dist/index-WCOc4LNL.js +0 -16600
- package/dist/lexical-2rxs76dr.cjs +0 -41
- package/dist/lexical-C60GkwxR.js +0 -13122
- package/dist/lexical-code-DKIWiZdJ.js +0 -604
- package/dist/lexical-code-VafvPacU.cjs +0 -9
- package/dist/lexical-collab-1tX9tFVC.js +0 -1025
- package/dist/lexical-collab-Nk2LVpJv.cjs +0 -1
- package/dist/lexical-file-C52Mze5k.cjs +0 -1
- package/dist/lexical-file-DjHP4vVw.js +0 -43
- package/dist/lexical-markdown-BSl_ahWw.cjs +0 -12
- package/dist/lexical-markdown-DcEwQQba.js +0 -488
- package/dist/lodash-3PEMjFQT.cjs +0 -1
- package/dist/lodash-jftOdrxX.js +0 -711
- package/dist/stats.html +0 -4949
- package/dist/vendor-BrXDSyZX.js +0 -136433
- package/dist/vendor-Bt6Lma3y.cjs +0 -2469
|
@@ -1,604 +0,0 @@
|
|
|
1
|
-
var Ne = Object.defineProperty;
|
|
2
|
-
var we = (n, i, t) => i in n ? Ne(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
|
|
3
|
-
var J = (n, i, t) => we(n, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
-
import { X as xe, l as W, u as Ae, f as ke, K as Pe, C as Le, L as oe, a as Se, b as v, c as j, J as X, d as Oe, t as _e, e as He, U as Ee, x as ee, M as ze, g as P, y as L, D as R, A as le, P as D, h as q, z as k, j as je, k as Q, T as ae, v as te, i as ue, m as _, s as De, S as Me, n as Be, o as Ie, E as Je, p as Fe, q as $e, r as Ke } from "./lexical-C60GkwxR.js";
|
|
5
|
-
import "./vendor-BrXDSyZX.js";
|
|
6
|
-
function G(n, ...i) {
|
|
7
|
-
const t = new URL("https://lexical.dev/docs/error"), e = new URLSearchParams();
|
|
8
|
-
e.append("code", n);
|
|
9
|
-
for (const r of i) e.append("v", r);
|
|
10
|
-
throw t.search = e.toString(), Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
11
|
-
}
|
|
12
|
-
const Re = "javascript";
|
|
13
|
-
function Te(n, i) {
|
|
14
|
-
for (const t of n.childNodes) {
|
|
15
|
-
if (Oe(t) && t.tagName === i) return !0;
|
|
16
|
-
Te(t, i);
|
|
17
|
-
}
|
|
18
|
-
return !1;
|
|
19
|
-
}
|
|
20
|
-
const $ = "data-language", F = "data-highlight-language", U = "data-theme";
|
|
21
|
-
class E extends Le {
|
|
22
|
-
constructor(t, e) {
|
|
23
|
-
super(e);
|
|
24
|
-
J(this, "__language");
|
|
25
|
-
J(this, "__theme");
|
|
26
|
-
J(this, "__isSyntaxHighlightSupported");
|
|
27
|
-
this.__language = t || void 0, this.__isSyntaxHighlightSupported = !1, this.__theme = void 0;
|
|
28
|
-
}
|
|
29
|
-
static getType() {
|
|
30
|
-
return "code";
|
|
31
|
-
}
|
|
32
|
-
static clone(t) {
|
|
33
|
-
return new E(t.__language, t.__key);
|
|
34
|
-
}
|
|
35
|
-
afterCloneFrom(t) {
|
|
36
|
-
super.afterCloneFrom(t), this.__language = t.__language, this.__theme = t.__theme, this.__isSyntaxHighlightSupported = t.__isSyntaxHighlightSupported;
|
|
37
|
-
}
|
|
38
|
-
createDOM(t) {
|
|
39
|
-
const e = document.createElement("code");
|
|
40
|
-
W(e, t.theme.code), e.setAttribute("spellcheck", "false");
|
|
41
|
-
const r = this.getLanguage();
|
|
42
|
-
r && (e.setAttribute($, r), this.getIsSyntaxHighlightSupported() && e.setAttribute(F, r));
|
|
43
|
-
const s = this.getTheme();
|
|
44
|
-
s && e.setAttribute(U, s);
|
|
45
|
-
const o = this.getStyle();
|
|
46
|
-
return o && e.setAttribute("style", o), e;
|
|
47
|
-
}
|
|
48
|
-
updateDOM(t, e, r) {
|
|
49
|
-
const s = this.__language, o = t.__language;
|
|
50
|
-
s ? s !== o && e.setAttribute($, s) : o && e.removeAttribute($);
|
|
51
|
-
const l = this.__isSyntaxHighlightSupported;
|
|
52
|
-
t.__isSyntaxHighlightSupported && o ? l && s ? s !== o && e.setAttribute(F, s) : e.removeAttribute(F) : l && s && e.setAttribute(F, s);
|
|
53
|
-
const u = this.__theme, a = t.__theme;
|
|
54
|
-
u ? u !== a && e.setAttribute(U, u) : a && e.removeAttribute(U);
|
|
55
|
-
const c = this.__style, g = t.__style;
|
|
56
|
-
return c ? c !== g && e.setAttribute("style", c) : g && e.removeAttribute("style"), !1;
|
|
57
|
-
}
|
|
58
|
-
exportDOM(t) {
|
|
59
|
-
const e = document.createElement("pre");
|
|
60
|
-
W(e, t._config.theme.code), e.setAttribute("spellcheck", "false");
|
|
61
|
-
const r = this.getLanguage();
|
|
62
|
-
r && (e.setAttribute($, r), this.getIsSyntaxHighlightSupported() && e.setAttribute(F, r));
|
|
63
|
-
const s = this.getTheme();
|
|
64
|
-
s && e.setAttribute(U, s);
|
|
65
|
-
const o = this.getStyle();
|
|
66
|
-
return o && e.setAttribute("style", o), { element: e };
|
|
67
|
-
}
|
|
68
|
-
static importDOM() {
|
|
69
|
-
return { code: (t) => t.textContent != null && (/\r?\n/.test(t.textContent) || Te(t, "BR")) ? { conversion: ge, priority: 1 } : null, div: () => ({ conversion: Ue, priority: 1 }), pre: () => ({ conversion: ge, priority: 0 }), table: (t) => V(t) ? { conversion: We, priority: 3 } : null, td: (t) => {
|
|
70
|
-
const e = t, r = e.closest("table");
|
|
71
|
-
return e.classList.contains("js-file-line") || r && V(r) ? { conversion: ce, priority: 3 } : null;
|
|
72
|
-
}, tr: (t) => {
|
|
73
|
-
const e = t.closest("table");
|
|
74
|
-
return e && V(e) ? { conversion: ce, priority: 3 } : null;
|
|
75
|
-
} };
|
|
76
|
-
}
|
|
77
|
-
static importJSON(t) {
|
|
78
|
-
return K().updateFromJSON(t);
|
|
79
|
-
}
|
|
80
|
-
updateFromJSON(t) {
|
|
81
|
-
return super.updateFromJSON(t).setLanguage(t.language).setTheme(t.theme);
|
|
82
|
-
}
|
|
83
|
-
exportJSON() {
|
|
84
|
-
return { ...super.exportJSON(), language: this.getLanguage(), theme: this.getTheme() };
|
|
85
|
-
}
|
|
86
|
-
insertNewAfter(t, e = !0) {
|
|
87
|
-
const r = this.getChildren(), s = r.length;
|
|
88
|
-
if (s >= 2 && r[s - 1].getTextContent() === `
|
|
89
|
-
` && r[s - 2].getTextContent() === `
|
|
90
|
-
` && t.isCollapsed() && t.anchor.key === this.__key && t.anchor.offset === s) {
|
|
91
|
-
r[s - 1].remove(), r[s - 2].remove();
|
|
92
|
-
const a = oe();
|
|
93
|
-
return this.insertAfter(a, e), a;
|
|
94
|
-
}
|
|
95
|
-
const { anchor: o, focus: l } = t, u = (o.isBefore(l) ? o : l).getNode();
|
|
96
|
-
if (Se(u)) {
|
|
97
|
-
let a = z(u);
|
|
98
|
-
const c = [];
|
|
99
|
-
for (; ; ) if (v(a)) c.push(j()), a = a.getNextSibling();
|
|
100
|
-
else {
|
|
101
|
-
if (!y(a)) break;
|
|
102
|
-
{
|
|
103
|
-
let p = 0;
|
|
104
|
-
const x = a.getTextContent(), O = a.getTextContentSize();
|
|
105
|
-
for (; p < O && x[p] === " "; ) p++;
|
|
106
|
-
if (p !== 0 && c.push(ie(" ".repeat(p))), p !== O) break;
|
|
107
|
-
a = a.getNextSibling();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const g = u.splitText(o.offset)[0], d = o.offset === 0 ? 0 : 1, f = g.getIndexWithinParent() + d, h = u.getParentOrThrow(), S = [X(), ...c];
|
|
111
|
-
h.splice(f, 0, S);
|
|
112
|
-
const m = c[c.length - 1];
|
|
113
|
-
m ? m.select() : o.offset === 0 ? g.selectPrevious() : g.getNextSibling().selectNext(0, 0);
|
|
114
|
-
}
|
|
115
|
-
if (A(u)) {
|
|
116
|
-
const { offset: a } = t.anchor;
|
|
117
|
-
u.splice(a, 0, [X()]), u.select(a + 1, a + 1);
|
|
118
|
-
}
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
canIndent() {
|
|
122
|
-
return !1;
|
|
123
|
-
}
|
|
124
|
-
collapseAtStart() {
|
|
125
|
-
const t = oe();
|
|
126
|
-
return this.getChildren().forEach((e) => t.append(e)), this.replace(t), !0;
|
|
127
|
-
}
|
|
128
|
-
setLanguage(t) {
|
|
129
|
-
const e = this.getWritable();
|
|
130
|
-
return e.__language = t || void 0, e;
|
|
131
|
-
}
|
|
132
|
-
getLanguage() {
|
|
133
|
-
return this.getLatest().__language;
|
|
134
|
-
}
|
|
135
|
-
setIsSyntaxHighlightSupported(t) {
|
|
136
|
-
const e = this.getWritable();
|
|
137
|
-
return e.__isSyntaxHighlightSupported = t, e;
|
|
138
|
-
}
|
|
139
|
-
getIsSyntaxHighlightSupported() {
|
|
140
|
-
return this.getLatest().__isSyntaxHighlightSupported;
|
|
141
|
-
}
|
|
142
|
-
setTheme(t) {
|
|
143
|
-
const e = this.getWritable();
|
|
144
|
-
return e.__theme = t || void 0, e;
|
|
145
|
-
}
|
|
146
|
-
getTheme() {
|
|
147
|
-
return this.getLatest().__theme;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function K(n, i) {
|
|
151
|
-
return Pe(E).setLanguage(n).setTheme(i);
|
|
152
|
-
}
|
|
153
|
-
function A(n) {
|
|
154
|
-
return n instanceof E;
|
|
155
|
-
}
|
|
156
|
-
function ge(n) {
|
|
157
|
-
return { node: K(n.getAttribute($)) };
|
|
158
|
-
}
|
|
159
|
-
function Ue(n) {
|
|
160
|
-
const i = n, t = fe(i);
|
|
161
|
-
return t || (function(e) {
|
|
162
|
-
let r = e.parentElement;
|
|
163
|
-
for (; r !== null; ) {
|
|
164
|
-
if (fe(r)) return !0;
|
|
165
|
-
r = r.parentElement;
|
|
166
|
-
}
|
|
167
|
-
return !1;
|
|
168
|
-
})(i) ? { node: t ? K() : null } : { node: null };
|
|
169
|
-
}
|
|
170
|
-
function We() {
|
|
171
|
-
return { node: K() };
|
|
172
|
-
}
|
|
173
|
-
function ce() {
|
|
174
|
-
return { node: null };
|
|
175
|
-
}
|
|
176
|
-
function fe(n) {
|
|
177
|
-
return n.style.fontFamily.match("monospace") !== null;
|
|
178
|
-
}
|
|
179
|
-
function V(n) {
|
|
180
|
-
return n.classList.contains("js-file-line-container");
|
|
181
|
-
}
|
|
182
|
-
class B extends xe {
|
|
183
|
-
constructor(t = "", e, r) {
|
|
184
|
-
super(t, r);
|
|
185
|
-
J(this, "__highlightType");
|
|
186
|
-
this.__highlightType = e;
|
|
187
|
-
}
|
|
188
|
-
static getType() {
|
|
189
|
-
return "code-highlight";
|
|
190
|
-
}
|
|
191
|
-
static clone(t) {
|
|
192
|
-
return new B(t.__text, t.__highlightType || void 0, t.__key);
|
|
193
|
-
}
|
|
194
|
-
getHighlightType() {
|
|
195
|
-
return this.getLatest().__highlightType;
|
|
196
|
-
}
|
|
197
|
-
setHighlightType(t) {
|
|
198
|
-
const e = this.getWritable();
|
|
199
|
-
return e.__highlightType = t || void 0, e;
|
|
200
|
-
}
|
|
201
|
-
canHaveFormat() {
|
|
202
|
-
return !1;
|
|
203
|
-
}
|
|
204
|
-
createDOM(t) {
|
|
205
|
-
const e = super.createDOM(t), r = Y(t.theme, this.__highlightType);
|
|
206
|
-
return W(e, r), e;
|
|
207
|
-
}
|
|
208
|
-
updateDOM(t, e, r) {
|
|
209
|
-
const s = super.updateDOM(t, e, r), o = Y(r.theme, t.__highlightType), l = Y(r.theme, this.__highlightType);
|
|
210
|
-
return o !== l && (o && Ae(e, o), l && W(e, l)), s;
|
|
211
|
-
}
|
|
212
|
-
static importJSON(t) {
|
|
213
|
-
return ie().updateFromJSON(t);
|
|
214
|
-
}
|
|
215
|
-
updateFromJSON(t) {
|
|
216
|
-
return super.updateFromJSON(t).setHighlightType(t.highlightType);
|
|
217
|
-
}
|
|
218
|
-
exportJSON() {
|
|
219
|
-
return { ...super.exportJSON(), highlightType: this.getHighlightType() };
|
|
220
|
-
}
|
|
221
|
-
setFormat(t) {
|
|
222
|
-
return this;
|
|
223
|
-
}
|
|
224
|
-
isParentRequired() {
|
|
225
|
-
return !0;
|
|
226
|
-
}
|
|
227
|
-
createParentElementNode() {
|
|
228
|
-
return K();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
function Y(n, i) {
|
|
232
|
-
return i && n && n.codeHighlight && n.codeHighlight[i];
|
|
233
|
-
}
|
|
234
|
-
function ie(n = "", i) {
|
|
235
|
-
return ke(new B(n, i));
|
|
236
|
-
}
|
|
237
|
-
function y(n) {
|
|
238
|
-
return n instanceof B;
|
|
239
|
-
}
|
|
240
|
-
function ve(n, i) {
|
|
241
|
-
let t = n;
|
|
242
|
-
for (let e = _e(n, i); e && (y(e.origin) || v(e.origin)); e = He(e)) t = e.origin;
|
|
243
|
-
return t;
|
|
244
|
-
}
|
|
245
|
-
function z(n) {
|
|
246
|
-
return ve(n, "previous");
|
|
247
|
-
}
|
|
248
|
-
function M(n) {
|
|
249
|
-
return ve(n, "next");
|
|
250
|
-
}
|
|
251
|
-
function Xe(n) {
|
|
252
|
-
const i = z(n), t = M(n);
|
|
253
|
-
let e = i;
|
|
254
|
-
for (; e !== null; ) {
|
|
255
|
-
if (y(e)) {
|
|
256
|
-
const s = $e(e.getTextContent());
|
|
257
|
-
if (s !== null) return s;
|
|
258
|
-
}
|
|
259
|
-
if (e === t) break;
|
|
260
|
-
e = e.getNextSibling();
|
|
261
|
-
}
|
|
262
|
-
const r = i.getParent();
|
|
263
|
-
if (Ke(r)) {
|
|
264
|
-
const s = r.getDirection();
|
|
265
|
-
if (s === "ltr" || s === "rtl") return s;
|
|
266
|
-
}
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
function qe(n, i) {
|
|
270
|
-
let t = null, e = null, r = n, s = i, o = n.getTextContent();
|
|
271
|
-
for (; ; ) {
|
|
272
|
-
if (s === 0) {
|
|
273
|
-
if (r = r.getPreviousSibling(), r === null) break;
|
|
274
|
-
if (y(r) || v(r) || _(r) || G(167), _(r)) {
|
|
275
|
-
t = { node: r, offset: 1 };
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
s = Math.max(0, r.getTextContentSize() - 1), o = r.getTextContent();
|
|
279
|
-
} else s--;
|
|
280
|
-
const u = o[s];
|
|
281
|
-
y(r) && u !== " " && (e = { node: r, offset: s });
|
|
282
|
-
}
|
|
283
|
-
if (e !== null) return e;
|
|
284
|
-
let l = null;
|
|
285
|
-
if (i < n.getTextContentSize()) y(n) && (l = n.getTextContent()[i]);
|
|
286
|
-
else {
|
|
287
|
-
const u = n.getNextSibling();
|
|
288
|
-
y(u) && (l = u.getTextContent()[0]);
|
|
289
|
-
}
|
|
290
|
-
if (l !== null && l !== " ") return t;
|
|
291
|
-
{
|
|
292
|
-
const u = (function(a, c) {
|
|
293
|
-
let g = a, d = c, f = a.getTextContent(), h = a.getTextContentSize();
|
|
294
|
-
for (; ; ) {
|
|
295
|
-
if (!y(g) || d === h) {
|
|
296
|
-
if (g = g.getNextSibling(), g === null || _(g)) return null;
|
|
297
|
-
y(g) && (d = 0, f = g.getTextContent(), h = g.getTextContentSize());
|
|
298
|
-
}
|
|
299
|
-
if (y(g)) {
|
|
300
|
-
if (f[d] !== " ") return { node: g, offset: d };
|
|
301
|
-
d++;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
})(n, i);
|
|
305
|
-
return u !== null ? u : t;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function Qe(n) {
|
|
309
|
-
const i = M(n);
|
|
310
|
-
return _(i) && G(168), i;
|
|
311
|
-
}
|
|
312
|
-
(function(n) {
|
|
313
|
-
n.languages.diff = { coord: [/^(?:\*{3}|-{3}|\+{3}).*$/m, /^@@.*@@$/m, /^\d.*$/m] };
|
|
314
|
-
var i = { "deleted-sign": "-", "deleted-arrow": "<", "inserted-sign": "+", "inserted-arrow": ">", unchanged: " ", diff: "!" };
|
|
315
|
-
Object.keys(i).forEach(function(t) {
|
|
316
|
-
var e = i[t], r = [];
|
|
317
|
-
/^\w+$/.test(t) || r.push(/\w+/.exec(t)[0]), t === "diff" && r.push("bold"), n.languages.diff[t] = { pattern: RegExp("^(?:[" + e + `].*(?:\r
|
|
318
|
-
?|
|
|
319
|
-
|(?![\\s\\S])))+`, "m"), alias: r, inside: { line: { pattern: /(.)(?=[\s\S]).*(?:\r\n?|\n)?/, lookbehind: !0 }, prefix: { pattern: /[\s\S]/, alias: /\w+/.exec(t)[0] } } };
|
|
320
|
-
}), Object.defineProperty(n.languages.diff, "PREFIXES", { value: i });
|
|
321
|
-
})(Prism);
|
|
322
|
-
const w = globalThis.Prism || window.Prism, nt = { c: "C", clike: "C-like", cpp: "C++", css: "CSS", html: "HTML", java: "Java", js: "JavaScript", markdown: "Markdown", objc: "Objective-C", plain: "Plain Text", powershell: "PowerShell", py: "Python", rust: "Rust", sql: "SQL", swift: "Swift", typescript: "TypeScript", xml: "XML" }, rt = { cpp: "cpp", java: "java", javascript: "js", md: "markdown", plaintext: "plain", python: "py", text: "plain", ts: "typescript" };
|
|
323
|
-
function ne(n) {
|
|
324
|
-
return typeof n == "string" ? n : Array.isArray(n) ? n.map(ne).join("") : ne(n.content);
|
|
325
|
-
}
|
|
326
|
-
function Ge(n, i) {
|
|
327
|
-
const t = /^diff-([\w-]+)/i.exec(i), e = n.getTextContent();
|
|
328
|
-
let r = w.tokenize(e, w.languages[t ? "diff" : i]);
|
|
329
|
-
return t && (r = (function(s, o) {
|
|
330
|
-
const l = o, u = w.languages[l], a = { tokens: s }, c = w.languages.diff.PREFIXES;
|
|
331
|
-
for (const g of a.tokens) {
|
|
332
|
-
if (typeof g == "string" || !(g.type in c) || !Array.isArray(g.content)) continue;
|
|
333
|
-
const d = g.type;
|
|
334
|
-
let f = 0;
|
|
335
|
-
const h = () => (f++, new w.Token("prefix", c[d], d.replace(/^(\w+).*/, "$1"))), S = g.content.filter((T) => typeof T == "string" || T.type !== "prefix"), m = g.content.length - S.length, p = w.tokenize(ne(S), u);
|
|
336
|
-
p.unshift(h());
|
|
337
|
-
const x = /\r\n|\n/g, O = (T) => {
|
|
338
|
-
const C = [];
|
|
339
|
-
x.lastIndex = 0;
|
|
340
|
-
let b, N = 0;
|
|
341
|
-
for (; f < m && (b = x.exec(T)); ) {
|
|
342
|
-
const se = b.index + b[0].length;
|
|
343
|
-
C.push(T.slice(N, se)), N = se, C.push(h());
|
|
344
|
-
}
|
|
345
|
-
if (C.length !== 0) return N < T.length && C.push(T.slice(N)), C;
|
|
346
|
-
}, I = (T) => {
|
|
347
|
-
for (let C = 0; C < T.length && f < m; C++) {
|
|
348
|
-
const b = T[C];
|
|
349
|
-
if (typeof b == "string") {
|
|
350
|
-
const N = O(b);
|
|
351
|
-
N && (T.splice(C, 1, ...N), C += N.length - 1);
|
|
352
|
-
} else if (typeof b.content == "string") {
|
|
353
|
-
const N = O(b.content);
|
|
354
|
-
N && (b.content = N);
|
|
355
|
-
} else Array.isArray(b.content) ? I(b.content) : I([b.content]);
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
I(p), f < m && p.push(h()), g.content = p;
|
|
359
|
-
}
|
|
360
|
-
return a.tokens;
|
|
361
|
-
})(r, t[1])), re(r);
|
|
362
|
-
}
|
|
363
|
-
function re(n, i) {
|
|
364
|
-
const t = [];
|
|
365
|
-
for (const e of n) if (typeof e == "string") {
|
|
366
|
-
const r = e.split(/(\n|\t)/), s = r.length;
|
|
367
|
-
for (let o = 0; o < s; o++) {
|
|
368
|
-
const l = r[o];
|
|
369
|
-
l === `
|
|
370
|
-
` || l === `\r
|
|
371
|
-
` ? t.push(X()) : l === " " ? t.push(j()) : l.length > 0 && t.push(ie(l, i));
|
|
372
|
-
}
|
|
373
|
-
} else {
|
|
374
|
-
const { content: r, alias: s } = e;
|
|
375
|
-
typeof r == "string" ? t.push(...re([r], e.type === "prefix" && typeof s == "string" ? s : e.type)) : Array.isArray(r) && t.push(...re(r, e.type === "unchanged" ? void 0 : e.type));
|
|
376
|
-
}
|
|
377
|
-
return t;
|
|
378
|
-
}
|
|
379
|
-
const Ve = { $tokenize(n, i) {
|
|
380
|
-
return Ge(n, i || this.defaultLanguage);
|
|
381
|
-
}, defaultLanguage: Re, tokenize(n, i) {
|
|
382
|
-
return w.tokenize(n, w.languages[i || ""] || w.languages[this.defaultLanguage]);
|
|
383
|
-
} };
|
|
384
|
-
function he(n, i, t) {
|
|
385
|
-
const e = n.getParent();
|
|
386
|
-
A(e) ? be(e, i, t) : y(n) && n.replace(De(n.__text));
|
|
387
|
-
}
|
|
388
|
-
function Ye(n, i) {
|
|
389
|
-
const t = i.getElementByKey(n.getKey());
|
|
390
|
-
if (t === null) return;
|
|
391
|
-
const e = n.getChildren(), r = e.length;
|
|
392
|
-
if (r === t.__cachedChildrenLength) return;
|
|
393
|
-
t.__cachedChildrenLength = r;
|
|
394
|
-
let s = "1", o = 1;
|
|
395
|
-
for (let l = 0; l < r; l++) _(e[l]) && (s += `
|
|
396
|
-
` + ++o);
|
|
397
|
-
t.setAttribute("data-gutter", s);
|
|
398
|
-
}
|
|
399
|
-
const Z = /* @__PURE__ */ new Set();
|
|
400
|
-
function be(n, i, t) {
|
|
401
|
-
const e = n.getKey();
|
|
402
|
-
n.getLanguage() === void 0 && n.setLanguage(t.defaultLanguage);
|
|
403
|
-
const r = n.getLanguage() || t.defaultLanguage;
|
|
404
|
-
if (!(function(s) {
|
|
405
|
-
const o = (function(u) {
|
|
406
|
-
const a = /^diff-([\w-]+)/i.exec(u);
|
|
407
|
-
return a ? a[1] : null;
|
|
408
|
-
})(s), l = o || s;
|
|
409
|
-
try {
|
|
410
|
-
return !!l && w.languages.hasOwnProperty(l);
|
|
411
|
-
} catch {
|
|
412
|
-
return !1;
|
|
413
|
-
}
|
|
414
|
-
})(r)) return n.getIsSyntaxHighlightSupported() && n.setIsSyntaxHighlightSupported(!1), void (async function() {
|
|
415
|
-
})();
|
|
416
|
-
n.getIsSyntaxHighlightSupported() || n.setIsSyntaxHighlightSupported(!0), Z.has(e) || (Z.add(e), i.update(() => {
|
|
417
|
-
(function(s, o) {
|
|
418
|
-
const l = ee(s);
|
|
419
|
-
if (!A(l) || !l.isAttached()) return;
|
|
420
|
-
const u = P();
|
|
421
|
-
if (!L(u)) return void o();
|
|
422
|
-
const a = u.anchor, c = a.offset, g = a.type === "element" && _(l.getChildAtIndex(a.offset - 1));
|
|
423
|
-
let d = 0;
|
|
424
|
-
if (!g) {
|
|
425
|
-
const f = a.getNode();
|
|
426
|
-
d = c + f.getPreviousSiblings().reduce((h, S) => h + S.getTextContentSize(), 0);
|
|
427
|
-
}
|
|
428
|
-
if (o()) {
|
|
429
|
-
if (g) return void a.getNode().select(c, c);
|
|
430
|
-
l.getChildren().some((f) => {
|
|
431
|
-
const h = Se(f);
|
|
432
|
-
if (h || _(f)) {
|
|
433
|
-
const S = f.getTextContentSize();
|
|
434
|
-
if (h && S >= d) return f.select(d, d), !0;
|
|
435
|
-
d -= S;
|
|
436
|
-
}
|
|
437
|
-
return !1;
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
})(e, () => {
|
|
441
|
-
const s = ee(e);
|
|
442
|
-
if (!A(s) || !s.isAttached()) return !1;
|
|
443
|
-
const o = s.getLanguage() || t.defaultLanguage, l = t.$tokenize(s, o), u = (function(d, f) {
|
|
444
|
-
let h = 0;
|
|
445
|
-
for (; h < d.length && pe(d[h], f[h]); ) h++;
|
|
446
|
-
const S = d.length, m = f.length, p = Math.min(S, m) - h;
|
|
447
|
-
let x = 0;
|
|
448
|
-
for (; x < p; ) if (x++, !pe(d[S - x], f[m - x])) {
|
|
449
|
-
x--;
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
const O = h, I = S - x, T = f.slice(h, m - x);
|
|
453
|
-
return { from: O, nodesForReplacement: T, to: I };
|
|
454
|
-
})(s.getChildren(), l), { from: a, to: c, nodesForReplacement: g } = u;
|
|
455
|
-
return !(a === c && !g.length) && (n.splice(a, c - a, g), !0);
|
|
456
|
-
});
|
|
457
|
-
}, { onUpdate: () => {
|
|
458
|
-
Z.delete(e);
|
|
459
|
-
}, skipTransforms: !0 }));
|
|
460
|
-
}
|
|
461
|
-
function pe(n, i) {
|
|
462
|
-
return y(n) && y(i) && n.__text === i.__text && n.__highlightType === i.__highlightType || v(n) && v(i) || _(n) && _(i);
|
|
463
|
-
}
|
|
464
|
-
function H(n) {
|
|
465
|
-
if (!L(n)) return !1;
|
|
466
|
-
const i = n.anchor.getNode(), t = A(i) ? i : i.getParent(), e = n.focus.getNode(), r = A(e) ? e : e.getParent();
|
|
467
|
-
return A(t) && t.is(r);
|
|
468
|
-
}
|
|
469
|
-
function Ce(n) {
|
|
470
|
-
const i = n.getNodes(), t = [];
|
|
471
|
-
if (i.length === 1 && A(i[0])) return t;
|
|
472
|
-
let e = [];
|
|
473
|
-
for (let r = 0; r < i.length; r++) {
|
|
474
|
-
const s = i[r];
|
|
475
|
-
y(s) || v(s) || _(s) || G(169), _(s) ? e.length > 0 && (t.push(e), e = []) : e.push(s);
|
|
476
|
-
}
|
|
477
|
-
if (e.length > 0) {
|
|
478
|
-
const r = n.isBackward() ? n.anchor : n.focus, s = q(e[0].getKey(), 0, "text");
|
|
479
|
-
r.is(s) || t.push(e);
|
|
480
|
-
}
|
|
481
|
-
return t;
|
|
482
|
-
}
|
|
483
|
-
function de(n) {
|
|
484
|
-
const i = P();
|
|
485
|
-
if (!L(i) || !H(i)) return !1;
|
|
486
|
-
const t = Ce(i), e = t.length;
|
|
487
|
-
if (e === 0 && i.isCollapsed()) return n === D && i.insertNodes([j()]), !0;
|
|
488
|
-
if (e === 0 && n === D && i.getTextContent() === `
|
|
489
|
-
`) {
|
|
490
|
-
const r = j(), s = X(), o = i.isBackward() ? "previous" : "next";
|
|
491
|
-
return i.insertNodes([r, s]), Me(Be(Ie(Fe(r, "next", 0), Je(_e(s, "next"))), o)), !0;
|
|
492
|
-
}
|
|
493
|
-
for (let r = 0; r < e; r++) {
|
|
494
|
-
const s = t[r];
|
|
495
|
-
if (s.length > 0) {
|
|
496
|
-
let o = s[0];
|
|
497
|
-
if (r === 0 && (o = z(o)), n === D) {
|
|
498
|
-
const l = j();
|
|
499
|
-
if (o.insertBefore(l), r === 0) {
|
|
500
|
-
const u = i.isBackward() ? "focus" : "anchor", a = q(o.getKey(), 0, "text");
|
|
501
|
-
i[u].is(a) && i[u].set(l.getKey(), 0, "text");
|
|
502
|
-
}
|
|
503
|
-
} else v(o) && o.remove();
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return !0;
|
|
507
|
-
}
|
|
508
|
-
function me(n, i) {
|
|
509
|
-
const t = P();
|
|
510
|
-
if (!L(t)) return !1;
|
|
511
|
-
const { anchor: e, focus: r } = t, s = e.offset, o = r.offset, l = e.getNode(), u = r.getNode(), a = n === Q;
|
|
512
|
-
if (!H(t) || !y(l) && !v(l) || !y(u) && !v(u)) return !1;
|
|
513
|
-
if (!i.altKey) {
|
|
514
|
-
if (t.isCollapsed()) {
|
|
515
|
-
const p = l.getParentOrThrow();
|
|
516
|
-
if (a && s === 0 && l.getPreviousSibling() === null) {
|
|
517
|
-
if (p.getPreviousSibling() === null) return p.selectPrevious(), i.preventDefault(), !0;
|
|
518
|
-
} else if (!a && s === l.getTextContentSize() && l.getNextSibling() === null && p.getNextSibling() === null)
|
|
519
|
-
return p.selectNext(), i.preventDefault(), !0;
|
|
520
|
-
}
|
|
521
|
-
return !1;
|
|
522
|
-
}
|
|
523
|
-
let c, g;
|
|
524
|
-
if (l.isBefore(u) ? (c = z(l), g = M(u)) : (c = z(u), g = M(l)), c == null || g == null) return !1;
|
|
525
|
-
const d = c.getNodesBetween(g);
|
|
526
|
-
for (let p = 0; p < d.length; p++) {
|
|
527
|
-
const x = d[p];
|
|
528
|
-
if (!y(x) && !v(x) && !_(x)) return !1;
|
|
529
|
-
}
|
|
530
|
-
i.preventDefault(), i.stopPropagation();
|
|
531
|
-
const f = a ? c.getPreviousSibling() : g.getNextSibling();
|
|
532
|
-
if (!_(f)) return !0;
|
|
533
|
-
const h = a ? f.getPreviousSibling() : f.getNextSibling();
|
|
534
|
-
if (h == null) return !0;
|
|
535
|
-
const S = y(h) || v(h) || _(h) ? a ? z(h) : M(h) : null;
|
|
536
|
-
let m = S ?? h;
|
|
537
|
-
return f.remove(), d.forEach((p) => p.remove()), n === Q ? (d.forEach((p) => m.insertBefore(p)), m.insertBefore(f)) : (m.insertAfter(f), m = f, d.forEach((p) => {
|
|
538
|
-
m.insertAfter(p), m = p;
|
|
539
|
-
})), t.setTextNodeRange(l, s, u, o), !0;
|
|
540
|
-
}
|
|
541
|
-
function ye(n, i) {
|
|
542
|
-
const t = P();
|
|
543
|
-
if (!L(t)) return !1;
|
|
544
|
-
const { anchor: e, focus: r } = t, s = e.getNode(), o = r.getNode(), l = n === te;
|
|
545
|
-
if (!H(t) || !y(s) && !v(s) || !y(o) && !v(o)) return !1;
|
|
546
|
-
const u = o;
|
|
547
|
-
if (Xe(u) === "rtl" ? !l : l) {
|
|
548
|
-
const a = qe(u, r.offset);
|
|
549
|
-
if (a !== null) {
|
|
550
|
-
const { node: c, offset: g } = a;
|
|
551
|
-
_(c) ? c.selectNext(0, 0) : t.setTextNodeRange(c, g, c, g);
|
|
552
|
-
} else u.getParentOrThrow().selectStart();
|
|
553
|
-
} else
|
|
554
|
-
Qe(u).select();
|
|
555
|
-
return i.preventDefault(), i.stopPropagation(), !0;
|
|
556
|
-
}
|
|
557
|
-
function it(n, i) {
|
|
558
|
-
if (!n.hasNodes([E, B])) throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");
|
|
559
|
-
i == null && (i = Ve);
|
|
560
|
-
const t = [];
|
|
561
|
-
return n._headless !== !0 && t.push(n.registerMutationListener(E, (e) => {
|
|
562
|
-
n.getEditorState().read(() => {
|
|
563
|
-
for (const [r, s] of e) if (s !== "destroyed") {
|
|
564
|
-
const o = ee(r);
|
|
565
|
-
o !== null && Ye(o, n);
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
}, { skipInitialization: !1 })), t.push(n.registerNodeTransform(E, (e) => be(e, n, i)), n.registerNodeTransform(xe, (e) => he(e, n, i)), n.registerNodeTransform(B, (e) => he(e, n, i)), n.registerCommand(ze, (e) => {
|
|
569
|
-
const r = (function(s) {
|
|
570
|
-
const o = P();
|
|
571
|
-
if (!L(o) || !H(o)) return null;
|
|
572
|
-
const l = s ? R : D, u = s ? R : le, a = o.anchor, c = o.focus;
|
|
573
|
-
if (a.is(c)) return u;
|
|
574
|
-
const g = Ce(o);
|
|
575
|
-
if (g.length !== 1) return l;
|
|
576
|
-
const d = g[0];
|
|
577
|
-
let f, h;
|
|
578
|
-
d.length === 0 && G(285), o.isBackward() ? (f = c, h = a) : (f = a, h = c);
|
|
579
|
-
const S = z(d[0]), m = M(d[0]), p = q(S.getKey(), 0, "text"), x = q(m.getKey(), m.getTextContentSize(), "text");
|
|
580
|
-
return f.isBefore(p) || x.isBefore(h) ? l : p.isBefore(f) || h.isBefore(x) ? u : l;
|
|
581
|
-
})(e.shiftKey);
|
|
582
|
-
return r !== null && (e.preventDefault(), n.dispatchCommand(r, void 0), !0);
|
|
583
|
-
}, k), n.registerCommand(le, () => !!H(P()) && (je([j()]), !0), k), n.registerCommand(D, (e) => de(D), k), n.registerCommand(R, (e) => de(R), k), n.registerCommand(Q, (e) => {
|
|
584
|
-
const r = P();
|
|
585
|
-
if (!L(r)) return !1;
|
|
586
|
-
const { anchor: s } = r, o = s.getNode();
|
|
587
|
-
return !!H(r) && (r.isCollapsed() && s.offset === 0 && o.getPreviousSibling() === null && A(o.getParentOrThrow()) ? (e.preventDefault(), !0) : me(Q, e));
|
|
588
|
-
}, k), n.registerCommand(ae, (e) => {
|
|
589
|
-
const r = P();
|
|
590
|
-
if (!L(r)) return !1;
|
|
591
|
-
const { anchor: s } = r, o = s.getNode();
|
|
592
|
-
return !!H(r) && (r.isCollapsed() && s.offset === o.getTextContentSize() && o.getNextSibling() === null && A(o.getParentOrThrow()) ? (e.preventDefault(), !0) : me(ae, e));
|
|
593
|
-
}, k), n.registerCommand(te, (e) => ye(te, e), k), n.registerCommand(ue, (e) => ye(ue, e), k)), Ee(...t);
|
|
594
|
-
}
|
|
595
|
-
export {
|
|
596
|
-
it as E,
|
|
597
|
-
K as U,
|
|
598
|
-
A as X,
|
|
599
|
-
B as e,
|
|
600
|
-
rt as h,
|
|
601
|
-
y as i,
|
|
602
|
-
nt as p,
|
|
603
|
-
E as q
|
|
604
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";var oe=Object.defineProperty;var se=(n,o,t)=>o in n?oe(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t;var E=(n,o,t)=>se(n,typeof o!="symbol"?o+"":o,t);const r=require("./lexical-2rxs76dr.cjs");require("./vendor-Bt6Lma3y.cjs");function B(n,...o){const t=new URL("https://lexical.dev/docs/error"),e=new URLSearchParams;e.append("code",n);for(const i of o)e.append("v",i);throw t.search=e.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const le="javascript";function te(n,o){for(const t of n.childNodes){if(r.Cs(t)&&t.tagName===o)return!0;te(t,o)}return!1}const J="data-language",D="data-highlight-language",M="data-theme";class P extends r.Ci{constructor(t,e){super(e);E(this,"__language");E(this,"__theme");E(this,"__isSyntaxHighlightSupported");this.__language=t||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}static getType(){return"code"}static clone(t){return new P(t.__language,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__language=t.__language,this.__theme=t.__theme,this.__isSyntaxHighlightSupported=t.__isSyntaxHighlightSupported}createDOM(t){const e=document.createElement("code");r.lt(e,t.theme.code),e.setAttribute("spellcheck","false");const i=this.getLanguage();i&&(e.setAttribute(J,i),this.getIsSyntaxHighlightSupported()&&e.setAttribute(D,i));const s=this.getTheme();s&&e.setAttribute(M,s);const l=this.getStyle();return l&&e.setAttribute("style",l),e}updateDOM(t,e,i){const s=this.__language,l=t.__language;s?s!==l&&e.setAttribute(J,s):l&&e.removeAttribute(J);const u=this.__isSyntaxHighlightSupported;t.__isSyntaxHighlightSupported&&l?u&&s?s!==l&&e.setAttribute(D,s):e.removeAttribute(D):u&&s&&e.setAttribute(D,s);const g=this.__theme,a=t.__theme;g?g!==a&&e.setAttribute(M,g):a&&e.removeAttribute(M);const f=this.__style,c=t.__style;return f?f!==c&&e.setAttribute("style",f):c&&e.removeAttribute("style"),!1}exportDOM(t){const e=document.createElement("pre");r.lt(e,t._config.theme.code),e.setAttribute("spellcheck","false");const i=this.getLanguage();i&&(e.setAttribute(J,i),this.getIsSyntaxHighlightSupported()&&e.setAttribute(D,i));const s=this.getTheme();s&&e.setAttribute(M,s);const l=this.getStyle();return l&&e.setAttribute("style",l),{element:e}}static importDOM(){return{code:t=>t.textContent!=null&&(/\r?\n/.test(t.textContent)||te(t,"BR"))?{conversion:W,priority:1}:null,div:()=>({conversion:ue,priority:1}),pre:()=>({conversion:W,priority:0}),table:t=>I(t)?{conversion:ae,priority:3}:null,td:t=>{const e=t,i=e.closest("table");return e.classList.contains("js-file-line")||i&&I(i)?{conversion:q,priority:3}:null},tr:t=>{const e=t.closest("table");return e&&I(e)?{conversion:q,priority:3}:null}}}static importJSON(t){return H().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setLanguage(t.language).setTheme(t.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(t,e=!0){const i=this.getChildren(),s=i.length;if(s>=2&&i[s-1].getTextContent()===`
|
|
2
|
-
`&&i[s-2].getTextContent()===`
|
|
3
|
-
`&&t.isCollapsed()&&t.anchor.key===this.__key&&t.anchor.offset===s){i[s-1].remove(),i[s-2].remove();const a=r.Li();return this.insertAfter(a,e),a}const{anchor:l,focus:u}=t,g=(l.isBefore(u)?l:u).getNode();if(r.lr(g)){let a=k(g);const f=[];for(;;)if(r.fr(a))f.push(r.ur()),a=a.getNextSibling();else{if(!m(a))break;{let d=0;const S=a.getTextContent(),w=a.getTextContentSize();for(;d<w&&S[d]===" ";)d++;if(d!==0&&f.push(X(" ".repeat(d))),d!==w)break;a=a.getNextSibling()}}const c=g.splitText(l.offset)[0],y=l.offset===0?0:1,h=c.getIndexWithinParent()+y,p=g.getParentOrThrow(),_=[r.Jn(),...f];p.splice(h,0,_);const x=f[f.length-1];x?x.select():l.offset===0?c.selectPrevious():c.getNextSibling().selectNext(0,0)}if(N(g)){const{offset:a}=t.anchor;g.splice(a,0,[r.Jn()]),g.select(a+1,a+1)}return null}canIndent(){return!1}collapseAtStart(){const t=r.Li();return this.getChildren().forEach(e=>t.append(e)),this.replace(t),!0}setLanguage(t){const e=this.getWritable();return e.__language=t||void 0,e}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(t){const e=this.getWritable();return e.__isSyntaxHighlightSupported=t,e}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(t){const e=this.getWritable();return e.__theme=t||void 0,e}getTheme(){return this.getLatest().__theme}}function H(n,o){return r.Ks(P).setLanguage(n).setTheme(o)}function N(n){return n instanceof P}function W(n){return{node:H(n.getAttribute(J))}}function ue(n){const o=n,t=Q(o);return t||(function(e){let i=e.parentElement;for(;i!==null;){if(Q(i))return!0;i=i.parentElement}return!1})(o)?{node:t?H():null}:{node:null}}function ae(){return{node:H()}}function q(){return{node:null}}function Q(n){return n.style.fontFamily.match("monospace")!==null}function I(n){return n.classList.contains("js-file-line-container")}class j extends r.Xn{constructor(t="",e,i){super(t,i);E(this,"__highlightType");this.__highlightType=e}static getType(){return"code-highlight"}static clone(t){return new j(t.__text,t.__highlightType||void 0,t.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const e=this.getWritable();return e.__highlightType=t||void 0,e}canHaveFormat(){return!1}createDOM(t){const e=super.createDOM(t),i=F(t.theme,this.__highlightType);return r.lt(e,i),e}updateDOM(t,e,i){const s=super.updateDOM(t,e,i),l=F(i.theme,t.__highlightType),u=F(i.theme,this.__highlightType);return l!==u&&(l&&r.ut(e,l),u&&r.lt(e,u)),s}static importJSON(t){return X().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return!0}createParentElementNode(){return H()}}function F(n,o){return o&&n&&n.codeHighlight&&n.codeHighlight[o]}function X(n="",o){return r.fs(new j(n,o))}function m(n){return n instanceof j}function ne(n,o){let t=n;for(let e=r.tl(n,o);e&&(m(e.origin)||r.fr(e.origin));e=r.ft(e))t=e.origin;return t}function k(n){return ne(n,"previous")}function O(n){return ne(n,"next")}function ge(n){const o=k(n),t=O(n);let e=o;for(;e!==null;){if(m(e)){const s=r.oo(e.getTextContent());if(s!==null)return s}if(e===t)break;e=e.getNextSibling()}const i=o.getParent();if(r.Si(i)){const s=i.getDirection();if(s==="ltr"||s==="rtl")return s}return null}function ce(n,o){let t=null,e=null,i=n,s=o,l=n.getTextContent();for(;;){if(s===0){if(i=i.getPreviousSibling(),i===null)break;if(m(i)||r.fr(i)||r.jn(i)||B(167),r.jn(i)){t={node:i,offset:1};break}s=Math.max(0,i.getTextContentSize()-1),l=i.getTextContent()}else s--;const g=l[s];m(i)&&g!==" "&&(e={node:i,offset:s})}if(e!==null)return e;let u=null;if(o<n.getTextContentSize())m(n)&&(u=n.getTextContent()[o]);else{const g=n.getNextSibling();m(g)&&(u=g.getTextContent()[0])}if(u!==null&&u!==" ")return t;{const g=(function(a,f){let c=a,y=f,h=a.getTextContent(),p=a.getTextContentSize();for(;;){if(!m(c)||y===p){if(c=c.getNextSibling(),c===null||r.jn(c))return null;m(c)&&(y=0,h=c.getTextContent(),p=c.getTextContentSize())}if(m(c)){if(h[y]!==" ")return{node:c,offset:y};y++}}})(n,o);return g!==null?g:t}}function fe(n){const o=O(n);return r.jn(o)&&B(168),o}(function(n){n.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var o={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(o).forEach(function(t){var e=o[t],i=[];/^\w+$/.test(t)||i.push(/\w+/.exec(t)[0]),t==="diff"&&i.push("bold"),n.languages.diff[t]={pattern:RegExp("^(?:["+e+`].*(?:\r
|
|
4
|
-
?|
|
|
5
|
-
|(?![\\s\\S])))+`,"m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(t)[0]}}}}),Object.defineProperty(n.languages.diff,"PREFIXES",{value:o})})(Prism);const L=globalThis.Prism||window.Prism,he={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},pe={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function K(n){return typeof n=="string"?n:Array.isArray(n)?n.map(K).join(""):K(n.content)}function de(n,o){const t=/^diff-([\w-]+)/i.exec(o),e=n.getTextContent();let i=L.tokenize(e,L.languages[t?"diff":o]);return t&&(i=(function(s,l){const u=l,g=L.languages[u],a={tokens:s},f=L.languages.diff.PREFIXES;for(const c of a.tokens){if(typeof c=="string"||!(c.type in f)||!Array.isArray(c.content))continue;const y=c.type;let h=0;const p=()=>(h++,new L.Token("prefix",f[y],y.replace(/^(\w+).*/,"$1"))),_=c.content.filter(v=>typeof v=="string"||v.type!=="prefix"),x=c.content.length-_.length,d=L.tokenize(K(_),g);d.unshift(p());const S=/\r\n|\n/g,w=v=>{const C=[];S.lastIndex=0;let T,b=0;for(;h<x&&(T=S.exec(v));){const U=T.index+T[0].length;C.push(v.slice(b,U)),b=U,C.push(p())}if(C.length!==0)return b<v.length&&C.push(v.slice(b)),C},z=v=>{for(let C=0;C<v.length&&h<x;C++){const T=v[C];if(typeof T=="string"){const b=w(T);b&&(v.splice(C,1,...b),C+=b.length-1)}else if(typeof T.content=="string"){const b=w(T.content);b&&(T.content=b)}else Array.isArray(T.content)?z(T.content):z([T.content])}};z(d),h<x&&d.push(p()),c.content=d}return a.tokens})(i,t[1])),$(i)}function $(n,o){const t=[];for(const e of n)if(typeof e=="string"){const i=e.split(/(\n|\t)/),s=i.length;for(let l=0;l<s;l++){const u=i[l];u===`
|
|
6
|
-
`||u===`\r
|
|
7
|
-
`?t.push(r.Jn()):u===" "?t.push(r.ur()):u.length>0&&t.push(X(u,o))}}else{const{content:i,alias:s}=e;typeof i=="string"?t.push(...$([i],e.type==="prefix"&&typeof s=="string"?s:e.type)):Array.isArray(i)&&t.push(...$(i,e.type==="unchanged"?void 0:e.type))}return t}const ye={$tokenize(n,o){return de(n,o||this.defaultLanguage)},defaultLanguage:le,tokenize(n,o){return L.tokenize(n,L.languages[o||""]||L.languages[this.defaultLanguage])}};function G(n,o,t){const e=n.getParent();N(e)?re(e,o,t):m(n)&&n.replace(r.sr(n.__text))}function me(n,o){const t=o.getElementByKey(n.getKey());if(t===null)return;const e=n.getChildren(),i=e.length;if(i===t.__cachedChildrenLength)return;t.__cachedChildrenLength=i;let s="1",l=1;for(let u=0;u<i;u++)r.jn(e[u])&&(s+=`
|
|
8
|
-
`+ ++l);t.setAttribute("data-gutter",s)}const R=new Set;function re(n,o,t){const e=n.getKey();n.getLanguage()===void 0&&n.setLanguage(t.defaultLanguage);const i=n.getLanguage()||t.defaultLanguage;if(!(function(s){const l=(function(g){const a=/^diff-([\w-]+)/i.exec(g);return a?a[1]:null})(s),u=l||s;try{return!!u&&L.languages.hasOwnProperty(u)}catch{return!1}})(i))return n.getIsSyntaxHighlightSupported()&&n.setIsSyntaxHighlightSupported(!1),void(async function(){})();n.getIsSyntaxHighlightSupported()||n.setIsSyntaxHighlightSupported(!0),R.has(e)||(R.add(e),o.update(()=>{(function(s,l){const u=r.xo(s);if(!N(u)||!u.isAttached())return;const g=r.Lr();if(!r.yr(g))return void l();const a=g.anchor,f=a.offset,c=a.type==="element"&&r.jn(u.getChildAtIndex(a.offset-1));let y=0;if(!c){const h=a.getNode();y=f+h.getPreviousSiblings().reduce((p,_)=>p+_.getTextContentSize(),0)}if(l()){if(c)return void a.getNode().select(f,f);u.getChildren().some(h=>{const p=r.lr(h);if(p||r.jn(h)){const _=h.getTextContentSize();if(p&&_>=y)return h.select(y,y),!0;y-=_}return!1})}})(e,()=>{const s=r.xo(e);if(!N(s)||!s.isAttached())return!1;const l=s.getLanguage()||t.defaultLanguage,u=t.$tokenize(s,l),g=(function(y,h){let p=0;for(;p<y.length&&V(y[p],h[p]);)p++;const _=y.length,x=h.length,d=Math.min(_,x)-p;let S=0;for(;S<d;)if(S++,!V(y[_-S],h[x-S])){S--;break}const w=p,z=_-S,v=h.slice(p,x-S);return{from:w,nodesForReplacement:v,to:z}})(s.getChildren(),u),{from:a,to:f,nodesForReplacement:c}=g;return!(a===f&&!c.length)&&(n.splice(a,f-a,c),!0)})},{onUpdate:()=>{R.delete(e)},skipTransforms:!0}))}function V(n,o){return m(n)&&m(o)&&n.__text===o.__text&&n.__highlightType===o.__highlightType||r.fr(n)&&r.fr(o)||r.jn(n)&&r.jn(o)}function A(n){if(!r.yr(n))return!1;const o=n.anchor.getNode(),t=N(o)?o:o.getParent(),e=n.focus.getNode(),i=N(e)?e:e.getParent();return N(t)&&t.is(i)}function ie(n){const o=n.getNodes(),t=[];if(o.length===1&&N(o[0]))return t;let e=[];for(let i=0;i<o.length;i++){const s=o[i];m(s)||r.fr(s)||r.jn(s)||B(169),r.jn(s)?e.length>0&&(t.push(e),e=[]):e.push(s)}if(e.length>0){const i=n.isBackward()?n.anchor:n.focus,s=r.hr(e[0].getKey(),0,"text");i.is(s)||t.push(e)}return t}function Y(n){const o=r.Lr();if(!r.yr(o)||!A(o))return!1;const t=ie(o),e=t.length;if(e===0&&o.isCollapsed())return n===r.Pe&&o.insertNodes([r.ur()]),!0;if(e===0&&n===r.Pe&&o.getTextContent()===`
|
|
9
|
-
`){const i=r.ur(),s=r.Jn(),l=o.isBackward()?"previous":"next";return o.insertNodes([i,s]),r.Sl(r.Al(r.dl(r.el(i,"next",0),r.El(r.tl(s,"next"))),l)),!0}for(let i=0;i<e;i++){const s=t[i];if(s.length>0){let l=s[0];if(i===0&&(l=k(l)),n===r.Pe){const u=r.ur();if(l.insertBefore(u),i===0){const g=o.isBackward()?"focus":"anchor",a=r.hr(l.getKey(),0,"text");o[g].is(a)&&o[g].set(u.getKey(),0,"text")}}else r.fr(l)&&l.remove()}}return!0}function Z(n,o){const t=r.Lr();if(!r.yr(t))return!1;const{anchor:e,focus:i}=t,s=e.offset,l=i.offset,u=e.getNode(),g=i.getNode(),a=n===r.ke;if(!A(t)||!m(u)&&!r.fr(u)||!m(g)&&!r.fr(g))return!1;if(!o.altKey){if(t.isCollapsed()){const d=u.getParentOrThrow();if(a&&s===0&&u.getPreviousSibling()===null){if(d.getPreviousSibling()===null)return d.selectPrevious(),o.preventDefault(),!0}else if(!a&&s===u.getTextContentSize()&&u.getNextSibling()===null&&d.getNextSibling()===null)return d.selectNext(),o.preventDefault(),!0}return!1}let f,c;if(u.isBefore(g)?(f=k(u),c=O(g)):(f=k(g),c=O(u)),f==null||c==null)return!1;const y=f.getNodesBetween(c);for(let d=0;d<y.length;d++){const S=y[d];if(!m(S)&&!r.fr(S)&&!r.jn(S))return!1}o.preventDefault(),o.stopPropagation();const h=a?f.getPreviousSibling():c.getNextSibling();if(!r.jn(h))return!0;const p=a?h.getPreviousSibling():h.getNextSibling();if(p==null)return!0;const _=m(p)||r.fr(p)||r.jn(p)?a?k(p):O(p):null;let x=_??p;return h.remove(),y.forEach(d=>d.remove()),n===r.ke?(y.forEach(d=>x.insertBefore(d)),x.insertBefore(h)):(x.insertAfter(h),x=h,y.forEach(d=>{x.insertAfter(d),x=d})),t.setTextNodeRange(u,s,g,l),!0}function ee(n,o){const t=r.Lr();if(!r.yr(t))return!1;const{anchor:e,focus:i}=t,s=e.getNode(),l=i.getNode(),u=n===r.ve;if(!A(t)||!m(s)&&!r.fr(s)||!m(l)&&!r.fr(l))return!1;const g=l;if(ge(g)==="rtl"?!u:u){const a=ce(g,i.offset);if(a!==null){const{node:f,offset:c}=a;r.jn(f)?f.selectNext(0,0):t.setTextNodeRange(f,c,f,c)}else g.getParentOrThrow().selectStart()}else fe(g).select();return o.preventDefault(),o.stopPropagation(),!0}function xe(n,o){if(!n.hasNodes([P,j]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");o==null&&(o=ye);const t=[];return n._headless!==!0&&t.push(n.registerMutationListener(P,e=>{n.getEditorState().read(()=>{for(const[i,s]of e)if(s!=="destroyed"){const l=r.xo(i);l!==null&&me(l,n)}})},{skipInitialization:!1})),t.push(n.registerNodeTransform(P,e=>re(e,n,o)),n.registerNodeTransform(r.Xn,e=>G(e,n,o)),n.registerNodeTransform(j,e=>G(e,n,o)),n.registerCommand(r.Me,e=>{const i=(function(s){const l=r.Lr();if(!r.yr(l)||!A(l))return null;const u=s?r.De:r.Pe,g=s?r.De:r.Ae,a=l.anchor,f=l.focus;if(a.is(f))return g;const c=ie(l);if(c.length!==1)return u;const y=c[0];let h,p;y.length===0&&B(285),l.isBackward()?(h=f,p=a):(h=a,p=f);const _=k(y[0]),x=O(y[0]),d=r.hr(_.getKey(),0,"text"),S=r.hr(x.getKey(),x.getTextContentSize(),"text");return h.isBefore(d)||S.isBefore(p)?u:d.isBefore(h)||p.isBefore(S)?g:u})(e.shiftKey);return i!==null&&(e.preventDefault(),n.dispatchCommand(i,void 0),!0)},r.zi),n.registerCommand(r.Ae,()=>!!A(r.Lr())&&(r.jr([r.ur()]),!0),r.zi),n.registerCommand(r.Pe,e=>Y(r.Pe),r.zi),n.registerCommand(r.De,e=>Y(r.De),r.zi),n.registerCommand(r.ke,e=>{const i=r.Lr();if(!r.yr(i))return!1;const{anchor:s}=i,l=s.getNode();return!!A(i)&&(i.isCollapsed()&&s.offset===0&&l.getPreviousSibling()===null&&N(l.getParentOrThrow())?(e.preventDefault(),!0):Z(r.ke,e))},r.zi),n.registerCommand(r.Te,e=>{const i=r.Lr();if(!r.yr(i))return!1;const{anchor:s}=i,l=s.getNode();return!!A(i)&&(i.isCollapsed()&&s.offset===l.getTextContentSize()&&l.getNextSibling()===null&&N(l.getParentOrThrow())?(e.preventDefault(),!0):Z(r.Te,e))},r.zi),n.registerCommand(r.ve,e=>ee(r.ve,e),r.zi),n.registerCommand(r.Ce,e=>ee(r.Ce,e),r.zi)),r.U(...t)}exports.Et=xe;exports.U=H;exports.X=N;exports.et=j;exports.ht=pe;exports.it=m;exports.pt=he;exports.q=P;
|