@powerduck/md-editor 0.9.0 → 0.9.1
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/dist/index.cjs +10 -10
- package/dist/index.mjs +349 -356
- package/dist/plugins/doclink.d.ts +2 -0
- package/dist/plugins/mention.d.ts +4 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Compartment as Be, EditorState as
|
|
1
|
+
import { Compartment as Be, EditorState as Ft } from "@codemirror/state";
|
|
2
2
|
import { EditorView as ge, keymap as $e, lineNumbers as Ue } from "@codemirror/view";
|
|
3
3
|
import { history as zt, defaultKeymap as Kt, historyKeymap as Gt } from "@codemirror/commands";
|
|
4
4
|
import { markdown as qt } from "@codemirror/lang-markdown";
|
|
5
5
|
import { languages as Wt } from "@codemirror/language-data";
|
|
6
6
|
import Yt from "markdown-it";
|
|
7
|
-
import
|
|
7
|
+
import He from "katex";
|
|
8
8
|
class Zt {
|
|
9
9
|
constructor(e, t = {}) {
|
|
10
|
-
this.dropdown = null, this.items = [], this.selectedIndex = 0, this.trigger = null, this.searchAbort = null, this.destroyed = !1, this.view = e, this.options = {
|
|
10
|
+
this.dropdown = null, this.items = [], this.selectedIndex = 0, this.trigger = null, this.activeHead = 0, this.searchAbort = null, this.destroyed = !1, this.view = e, this.options = {
|
|
11
11
|
onMentionSearch: t.onMentionSearch ?? (() => []),
|
|
12
12
|
onMentionSelect: t.onMentionSelect ?? ((i) => `@${i.label}`),
|
|
13
13
|
minChars: t.minChars ?? 0,
|
|
@@ -81,7 +81,7 @@ class Zt {
|
|
|
81
81
|
}
|
|
82
82
|
show() {
|
|
83
83
|
if (this.trigger) {
|
|
84
|
-
if (!this.dropdown) {
|
|
84
|
+
if (this.activeHead = this.view.state.selection.main.head, !this.dropdown) {
|
|
85
85
|
this.dropdown = document.createElement("div"), this.dropdown.className = "md-editor-mention-dropdown", this.dropdown.setAttribute("role", "listbox");
|
|
86
86
|
const e = this.view.dom.closest(".md-editor-root"), t = (e == null ? void 0 : e.getAttribute("data-theme")) ?? "light";
|
|
87
87
|
this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown);
|
|
@@ -121,17 +121,13 @@ class Zt {
|
|
|
121
121
|
r + t.height > i - 8 && (r = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${r}px`, this.dropdown.style.left = `${a}px`;
|
|
122
122
|
}
|
|
123
123
|
selectItem(e) {
|
|
124
|
-
const t = this.items[e];
|
|
125
|
-
if (!t || !
|
|
126
|
-
const
|
|
127
|
-
this.view.dispatch({
|
|
128
|
-
changes: {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
insert: i
|
|
132
|
-
},
|
|
133
|
-
selection: { anchor: this.trigger.from + i.length }
|
|
134
|
-
}), this.hide(), this.view.focus();
|
|
124
|
+
const t = this.items[e], i = this.trigger;
|
|
125
|
+
if (!t || !i) return;
|
|
126
|
+
const r = this.options.onMentionSelect(t), a = i.from, s = this.activeHead;
|
|
127
|
+
this.view.focus(), this.view.dispatch({
|
|
128
|
+
changes: { from: a, to: s, insert: r },
|
|
129
|
+
selection: { anchor: a + r.length }
|
|
130
|
+
}), this.hide();
|
|
135
131
|
}
|
|
136
132
|
hide() {
|
|
137
133
|
var e;
|
|
@@ -141,13 +137,13 @@ class Zt {
|
|
|
141
137
|
this.destroyed = !0, this.hide();
|
|
142
138
|
}
|
|
143
139
|
}
|
|
144
|
-
async function
|
|
140
|
+
async function Vt(n) {
|
|
145
141
|
const e = await fetch(n, { mode: "cors" });
|
|
146
142
|
if (!e.ok) throw new Error(`HTTP ${e.status}`);
|
|
147
143
|
const t = await e.text();
|
|
148
|
-
return
|
|
144
|
+
return Xt(t, n);
|
|
149
145
|
}
|
|
150
|
-
function
|
|
146
|
+
function Xt(n, e) {
|
|
151
147
|
var c, l, d, h, p, m, y;
|
|
152
148
|
const t = {}, i = new DOMParser().parseFromString(n, "text/html"), a = ((c = i.querySelector('meta[property="og:title"]')) == null ? void 0 : c.getAttribute("content")) ?? ((l = i.querySelector("title")) == null ? void 0 : l.textContent) ?? void 0;
|
|
153
149
|
a && (t.title = a.trim());
|
|
@@ -158,7 +154,7 @@ function Vt(n, e) {
|
|
|
158
154
|
}
|
|
159
155
|
class Qt {
|
|
160
156
|
constructor(e, t = {}) {
|
|
161
|
-
this.dropdown = null, this.items = [], this.selectedIndex = 0, this.trigger = null, this.searchAbort = null, this.destroyed = !1, this.view = e, this.options = {
|
|
157
|
+
this.dropdown = null, this.items = [], this.selectedIndex = 0, this.trigger = null, this.activeHead = 0, this.searchAbort = null, this.destroyed = !1, this.view = e, this.options = {
|
|
162
158
|
onDocSearch: t.onDocSearch ?? (() => []),
|
|
163
159
|
insertStyle: t.insertStyle ?? "auto",
|
|
164
160
|
triggerChar: t.triggerChar ?? "/",
|
|
@@ -166,7 +162,7 @@ class Qt {
|
|
|
166
162
|
maxItems: t.maxItems ?? 8,
|
|
167
163
|
// Use the built-in fetch+DOMParser fetcher unless the consumer provides
|
|
168
164
|
// their own (e.g. a backend proxy to avoid CORS).
|
|
169
|
-
onFetchDocMeta: t.onFetchDocMeta ??
|
|
165
|
+
onFetchDocMeta: t.onFetchDocMeta ?? Vt
|
|
170
166
|
};
|
|
171
167
|
}
|
|
172
168
|
/** Called on every CodeMirror update. */
|
|
@@ -230,7 +226,7 @@ class Qt {
|
|
|
230
226
|
}
|
|
231
227
|
show() {
|
|
232
228
|
if (this.trigger) {
|
|
233
|
-
if (!this.dropdown) {
|
|
229
|
+
if (this.activeHead = this.view.state.selection.main.head, !this.dropdown) {
|
|
234
230
|
this.dropdown = document.createElement("div"), this.dropdown.className = "md-editor-doclink-dropdown", this.dropdown.setAttribute("role", "listbox");
|
|
235
231
|
const e = this.view.dom.closest(".md-editor-root"), t = (e == null ? void 0 : e.getAttribute("data-theme")) ?? "light";
|
|
236
232
|
this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown);
|
|
@@ -277,17 +273,17 @@ class Qt {
|
|
|
277
273
|
r + t.height > i - 8 && (r = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${r}px`, this.dropdown.style.left = `${a}px`;
|
|
278
274
|
}
|
|
279
275
|
async selectItem(e) {
|
|
280
|
-
const t = this.items[e];
|
|
281
|
-
if (!t || !
|
|
282
|
-
const
|
|
283
|
-
this.view.dispatch({
|
|
284
|
-
changes: { from: r, to:
|
|
276
|
+
const t = this.items[e], i = this.trigger;
|
|
277
|
+
if (!t || !i) return;
|
|
278
|
+
const r = i.from, a = this.activeHead;
|
|
279
|
+
this.view.focus(), this.view.dispatch({
|
|
280
|
+
changes: { from: r, to: a, insert: "" }
|
|
285
281
|
});
|
|
286
|
-
const
|
|
282
|
+
const s = await this.buildInsertion(t);
|
|
287
283
|
this.view.dispatch({
|
|
288
|
-
changes: { from: r, insert:
|
|
289
|
-
selection: { anchor: r +
|
|
290
|
-
}), this.hide()
|
|
284
|
+
changes: { from: r, insert: s },
|
|
285
|
+
selection: { anchor: r + s.length }
|
|
286
|
+
}), this.hide();
|
|
291
287
|
}
|
|
292
288
|
/**
|
|
293
289
|
* Build the markdown insertion string for a selected document.
|
|
@@ -339,8 +335,8 @@ function en(n) {
|
|
|
339
335
|
const o = s[1] ?? "";
|
|
340
336
|
let c = t + 1, l = !1;
|
|
341
337
|
for (; c < i; ) {
|
|
342
|
-
const
|
|
343
|
-
if (jt.test(
|
|
338
|
+
const f = e.src.slice(e.bMarks[c], e.eMarks[c]);
|
|
339
|
+
if (jt.test(f.trim())) {
|
|
344
340
|
l = !0;
|
|
345
341
|
break;
|
|
346
342
|
}
|
|
@@ -349,17 +345,17 @@ function en(n) {
|
|
|
349
345
|
if (!l) return !1;
|
|
350
346
|
if (r) return !0;
|
|
351
347
|
const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
|
|
352
|
-
`).map((
|
|
348
|
+
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
353
349
|
let h = "", p = "";
|
|
354
350
|
const m = [];
|
|
355
|
-
for (const
|
|
356
|
-
if (
|
|
357
|
-
h =
|
|
358
|
-
else if (
|
|
359
|
-
const
|
|
360
|
-
|
|
351
|
+
for (const f of d)
|
|
352
|
+
if (f.startsWith("# "))
|
|
353
|
+
h = f.slice(2).trim();
|
|
354
|
+
else if (f.startsWith(") {
|
|
355
|
+
const v = f.match(/^!\[thumbnail\]\((.+)\)$/);
|
|
356
|
+
v && (p = v[1] ?? "");
|
|
361
357
|
} else
|
|
362
|
-
m.push(
|
|
358
|
+
m.push(f);
|
|
363
359
|
const y = e.push("doclink_block", "div", 0);
|
|
364
360
|
return y.content = JSON.stringify({ url: o, title: h, thumbnail: p, description: m.join(" ") }), e.line = c + 1, !0;
|
|
365
361
|
}), n.renderer.rules.doclink_block = (e, t) => {
|
|
@@ -377,14 +373,14 @@ function en(n) {
|
|
|
377
373
|
l = new URL(a).hostname;
|
|
378
374
|
} catch {
|
|
379
375
|
}
|
|
380
|
-
const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${
|
|
381
|
-
return `<a class="md-editor-doclink-card" href="${
|
|
376
|
+
const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${Fe(o)}" alt="" loading="lazy" /></div>` : "";
|
|
377
|
+
return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer"><div class="md-editor-doclink-card-body"><div class="md-editor-doclink-card-title">${Te(s)}</div>` + (c ? `<div class="md-editor-doclink-card-desc">${Te(c)}</div>` : "") + `<div class="md-editor-doclink-card-url">${Te(l)}</div></div>` + d + "</a>";
|
|
382
378
|
};
|
|
383
379
|
}
|
|
384
380
|
function Te(n) {
|
|
385
381
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
386
382
|
}
|
|
387
|
-
function
|
|
383
|
+
function Fe(n) {
|
|
388
384
|
return n.replace(/"/g, """).replace(/</g, "<");
|
|
389
385
|
}
|
|
390
386
|
class tn {
|
|
@@ -419,7 +415,7 @@ class tn {
|
|
|
419
415
|
})
|
|
420
416
|
];
|
|
421
417
|
this.view = new ge({
|
|
422
|
-
state:
|
|
418
|
+
state: Ft.create({ doc: t.value ?? "", extensions: i }),
|
|
423
419
|
parent: e
|
|
424
420
|
}), (r = t.mention) != null && r.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new Qt(this.view, t.docLink));
|
|
425
421
|
}
|
|
@@ -543,17 +539,13 @@ class tn {
|
|
|
543
539
|
*/
|
|
544
540
|
toggleTaskList() {
|
|
545
541
|
const { from: e, to: t } = this.view.state.selection.main, i = this.view.state.doc.lineAt(e), r = this.view.state.doc.lineAt(t), a = [];
|
|
546
|
-
for (let
|
|
547
|
-
a.push(this.view.state.doc.line(
|
|
548
|
-
const s = a.every(
|
|
549
|
-
(d) => /^- \[[ xX]\]\s/.test(d) || /^- \[[ xX]\]$/.test(d)
|
|
550
|
-
), o = a.every(
|
|
551
|
-
(d) => /^- \[ \]\s/.test(d) || /^- \[ \]$/.test(d)
|
|
552
|
-
), l = a.map((d) => s ? o ? d.replace(/^- \[ \](\s?)/, "- [x]$1") : d.replace(/^- \[[xX]\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(d) ? d.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${d}`).join(`
|
|
542
|
+
for (let p = i.number; p <= r.number; p++)
|
|
543
|
+
a.push(this.view.state.doc.line(p).text);
|
|
544
|
+
const s = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => s.test(p)), l = a.every((p) => o.test(p)), h = a.map((p) => c ? l ? p.replace(/^- \[\s*\](\s?)/, "- [x]$1") : p.replace(/^- \[\s*[xX]\s*\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(p) ? p.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${p}`).join(`
|
|
553
545
|
`);
|
|
554
546
|
this.view.dispatch({
|
|
555
|
-
changes: { from: i.from, to: r.to, insert:
|
|
556
|
-
selection: { anchor: i.from, head: i.from +
|
|
547
|
+
changes: { from: i.from, to: r.to, insert: h },
|
|
548
|
+
selection: { anchor: i.from, head: i.from + h.length }
|
|
557
549
|
}), this.view.focus();
|
|
558
550
|
}
|
|
559
551
|
destroy() {
|
|
@@ -591,7 +583,7 @@ function sn(n) {
|
|
|
591
583
|
var r;
|
|
592
584
|
const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
|
|
593
585
|
try {
|
|
594
|
-
return `<div class="md-editor-math-block">${
|
|
586
|
+
return `<div class="md-editor-math-block">${He.renderToString(i, {
|
|
595
587
|
displayMode: !0,
|
|
596
588
|
throwOnError: !1,
|
|
597
589
|
strict: !1
|
|
@@ -612,7 +604,7 @@ function sn(n) {
|
|
|
612
604
|
var r;
|
|
613
605
|
const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
|
|
614
606
|
try {
|
|
615
|
-
return
|
|
607
|
+
return He.renderToString(i, {
|
|
616
608
|
displayMode: !1,
|
|
617
609
|
throwOnError: !1,
|
|
618
610
|
strict: !1
|
|
@@ -645,7 +637,7 @@ function on(n) {
|
|
|
645
637
|
const d = l[1].length;
|
|
646
638
|
let h = i + 1, p = 1;
|
|
647
639
|
for (; h < r; ) {
|
|
648
|
-
const
|
|
640
|
+
const f = t.bMarks[h] + t.tShift[h], v = t.eMarks[h], O = t.src.slice(f, v).match(/^(`{3,})\s*(.*)$/);
|
|
649
641
|
if (O && O[1].length >= d) {
|
|
650
642
|
if (O[2].trim())
|
|
651
643
|
p++;
|
|
@@ -695,10 +687,10 @@ async function ln(n) {
|
|
|
695
687
|
h.setAttribute("width", String(l)), h.setAttribute("height", String(d)), h.style.width = "100%", h.style.height = "100%", h.style.display = "block", s.appendChild(h);
|
|
696
688
|
const p = r.create(h, { autoFit: !1 }, c), m = () => {
|
|
697
689
|
try {
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
const
|
|
701
|
-
(!
|
|
690
|
+
const f = h.querySelector("g");
|
|
691
|
+
if (f) {
|
|
692
|
+
const v = f.getAttribute("transform") || "";
|
|
693
|
+
(!v || v.includes("NaN")) && f.setAttribute(
|
|
702
694
|
"transform",
|
|
703
695
|
`translate(40, ${d / 2}) scale(1)`
|
|
704
696
|
);
|
|
@@ -706,11 +698,11 @@ async function ln(n) {
|
|
|
706
698
|
} catch {
|
|
707
699
|
}
|
|
708
700
|
};
|
|
709
|
-
m(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (
|
|
710
|
-
var
|
|
701
|
+
m(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (f) => setTimeout(f, 16))(() => {
|
|
702
|
+
var f;
|
|
711
703
|
try {
|
|
712
|
-
const
|
|
713
|
-
|
|
704
|
+
const v = h.getBoundingClientRect();
|
|
705
|
+
v.width > 0 && v.height > 0 && ((f = p.fit) == null || f.call(p), m());
|
|
714
706
|
} catch {
|
|
715
707
|
}
|
|
716
708
|
});
|
|
@@ -1155,10 +1147,10 @@ function $n(n, e) {
|
|
|
1155
1147
|
function Un(n, e) {
|
|
1156
1148
|
e && n.beginKeywords && (n.begin = "\\b(" + n.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", n.__beforeBegin = Bn, n.keywords = n.keywords || n.beginKeywords, delete n.beginKeywords, n.relevance === void 0 && (n.relevance = 0));
|
|
1157
1149
|
}
|
|
1158
|
-
function
|
|
1150
|
+
function Hn(n, e) {
|
|
1159
1151
|
Array.isArray(n.illegal) && (n.illegal = ye(...n.illegal));
|
|
1160
1152
|
}
|
|
1161
|
-
function
|
|
1153
|
+
function Fn(n, e) {
|
|
1162
1154
|
if (n.match) {
|
|
1163
1155
|
if (n.begin || n.end) throw new Error("begin & end are not supported with match");
|
|
1164
1156
|
n.begin = n.match, delete n.match;
|
|
@@ -1239,7 +1231,7 @@ function Zn(n) {
|
|
|
1239
1231
|
ht(n, n.begin, { key: "beginScope" }), n.begin = xe(n.begin, { joinWith: "" });
|
|
1240
1232
|
}
|
|
1241
1233
|
}
|
|
1242
|
-
function
|
|
1234
|
+
function Vn(n) {
|
|
1243
1235
|
if (Array.isArray(n.end)) {
|
|
1244
1236
|
if (n.skip || n.excludeEnd || n.returnEnd)
|
|
1245
1237
|
throw ee("skip, excludeEnd, returnEnd not compatible with endScope: {}"), _e;
|
|
@@ -1248,11 +1240,11 @@ function Xn(n) {
|
|
|
1248
1240
|
ht(n, n.end, { key: "endScope" }), n.end = xe(n.end, { joinWith: "" });
|
|
1249
1241
|
}
|
|
1250
1242
|
}
|
|
1251
|
-
function
|
|
1243
|
+
function Xn(n) {
|
|
1252
1244
|
n.scope && typeof n.scope == "object" && n.scope !== null && (n.beginScope = n.scope, delete n.scope);
|
|
1253
1245
|
}
|
|
1254
1246
|
function Qn(n) {
|
|
1255
|
-
|
|
1247
|
+
Xn(n), typeof n.beginScope == "string" && (n.beginScope = { _wrap: n.beginScope }), typeof n.endScope == "string" && (n.endScope = { _wrap: n.endScope }), Zn(n), Vn(n);
|
|
1256
1248
|
}
|
|
1257
1249
|
function Jn(n) {
|
|
1258
1250
|
function e(s, o) {
|
|
@@ -1330,14 +1322,14 @@ function Jn(n) {
|
|
|
1330
1322
|
$n,
|
|
1331
1323
|
// do this early so compiler extensions generally don't have to worry about
|
|
1332
1324
|
// the distinction between match/begin
|
|
1333
|
-
|
|
1325
|
+
Fn,
|
|
1334
1326
|
Qn,
|
|
1335
1327
|
Kn
|
|
1336
1328
|
].forEach((d) => d(s, o)), n.compilerExtensions.forEach((d) => d(s, o)), s.__beforeBegin = null, [
|
|
1337
1329
|
Un,
|
|
1338
1330
|
// do this later so compiler extensions that come earlier have access to the
|
|
1339
1331
|
// raw array if they wanted to perhaps manipulate it, etc.
|
|
1340
|
-
|
|
1332
|
+
Hn,
|
|
1341
1333
|
// default to 1 relevance if not specified
|
|
1342
1334
|
zn
|
|
1343
1335
|
].forEach((d) => d(s, o)), s.isCompiled = !0;
|
|
@@ -1376,7 +1368,7 @@ class ti extends Error {
|
|
|
1376
1368
|
super(e), this.name = "HTMLInjectionError", this.html = t;
|
|
1377
1369
|
}
|
|
1378
1370
|
}
|
|
1379
|
-
const Se = rt,
|
|
1371
|
+
const Se = rt, Ve = Q, Xe = Symbol("nomatch"), ni = 7, gt = function(n) {
|
|
1380
1372
|
const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
|
|
1381
1373
|
let r = !0;
|
|
1382
1374
|
const a = "Could not find the language '{}', did you forget to load/include a language module?", s = { disableAutodetect: !0, name: "Plain text", contains: [] };
|
|
@@ -1398,98 +1390,98 @@ const Se = rt, Xe = Q, Ve = Symbol("nomatch"), ni = 7, gt = function(n) {
|
|
|
1398
1390
|
function l(u) {
|
|
1399
1391
|
let _ = u.className + " ";
|
|
1400
1392
|
_ += u.parentNode ? u.parentNode.className : "";
|
|
1401
|
-
const
|
|
1402
|
-
if (
|
|
1403
|
-
const k = $(
|
|
1404
|
-
return k || (Ze(a.replace("{}",
|
|
1393
|
+
const b = o.languageDetectRe.exec(_);
|
|
1394
|
+
if (b) {
|
|
1395
|
+
const k = $(b[1]);
|
|
1396
|
+
return k || (Ze(a.replace("{}", b[1])), Ze("Falling back to no-highlight mode for this block.", u)), k ? b[1] : "no-highlight";
|
|
1405
1397
|
}
|
|
1406
1398
|
return _.split(/\s+/).find((k) => c(k) || $(k));
|
|
1407
1399
|
}
|
|
1408
|
-
function d(u, _,
|
|
1400
|
+
function d(u, _, b) {
|
|
1409
1401
|
let k = "", T = "";
|
|
1410
|
-
typeof _ == "object" ? (k = u,
|
|
1411
|
-
https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _),
|
|
1402
|
+
typeof _ == "object" ? (k = u, b = _.ignoreIllegals, T = _.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
|
|
1403
|
+
https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b === void 0 && (b = !0);
|
|
1412
1404
|
const P = {
|
|
1413
1405
|
code: k,
|
|
1414
1406
|
language: T
|
|
1415
1407
|
};
|
|
1416
|
-
|
|
1417
|
-
const z = P.result ? P.result : h(P.language, P.code,
|
|
1418
|
-
return z.code = P.code,
|
|
1408
|
+
X("before:highlight", P);
|
|
1409
|
+
const z = P.result ? P.result : h(P.language, P.code, b);
|
|
1410
|
+
return z.code = P.code, X("after:highlight", z), z;
|
|
1419
1411
|
}
|
|
1420
|
-
function h(u, _,
|
|
1412
|
+
function h(u, _, b, k) {
|
|
1421
1413
|
const T = /* @__PURE__ */ Object.create(null);
|
|
1422
1414
|
function P(g, E) {
|
|
1423
1415
|
return g.keywords[E];
|
|
1424
1416
|
}
|
|
1425
1417
|
function z() {
|
|
1426
|
-
if (!
|
|
1427
|
-
|
|
1418
|
+
if (!w.keywords) {
|
|
1419
|
+
F.addText(M);
|
|
1428
1420
|
return;
|
|
1429
1421
|
}
|
|
1430
1422
|
let g = 0;
|
|
1431
|
-
|
|
1432
|
-
let E =
|
|
1423
|
+
w.keywordPatternRe.lastIndex = 0;
|
|
1424
|
+
let E = w.keywordPatternRe.exec(M), N = "";
|
|
1433
1425
|
for (; E; ) {
|
|
1434
|
-
N +=
|
|
1435
|
-
const
|
|
1426
|
+
N += M.substring(g, E.index);
|
|
1427
|
+
const x = Y.case_insensitive ? E[0].toLowerCase() : E[0], K = P(w, x);
|
|
1436
1428
|
if (K) {
|
|
1437
1429
|
const [Z, Ut] = K;
|
|
1438
|
-
if (
|
|
1430
|
+
if (F.addText(N), N = "", T[x] = (T[x] || 0) + 1, T[x] <= ni && (pe += Ut), Z.startsWith("_"))
|
|
1439
1431
|
N += E[0];
|
|
1440
1432
|
else {
|
|
1441
|
-
const
|
|
1442
|
-
W(E[0],
|
|
1433
|
+
const Ht = Y.classNameAliases[Z] || Z;
|
|
1434
|
+
W(E[0], Ht);
|
|
1443
1435
|
}
|
|
1444
1436
|
} else
|
|
1445
1437
|
N += E[0];
|
|
1446
|
-
g =
|
|
1438
|
+
g = w.keywordPatternRe.lastIndex, E = w.keywordPatternRe.exec(M);
|
|
1447
1439
|
}
|
|
1448
|
-
N +=
|
|
1440
|
+
N += M.substring(g), F.addText(N);
|
|
1449
1441
|
}
|
|
1450
1442
|
function q() {
|
|
1451
|
-
if (
|
|
1443
|
+
if (M === "") return;
|
|
1452
1444
|
let g = null;
|
|
1453
|
-
if (typeof
|
|
1454
|
-
if (!e[
|
|
1455
|
-
|
|
1445
|
+
if (typeof w.subLanguage == "string") {
|
|
1446
|
+
if (!e[w.subLanguage]) {
|
|
1447
|
+
F.addText(M);
|
|
1456
1448
|
return;
|
|
1457
1449
|
}
|
|
1458
|
-
g = h(
|
|
1450
|
+
g = h(w.subLanguage, M, !0, Pe[w.subLanguage]), Pe[w.subLanguage] = /** @type {CompiledMode} */
|
|
1459
1451
|
g._top;
|
|
1460
1452
|
} else
|
|
1461
|
-
g = m(
|
|
1462
|
-
|
|
1453
|
+
g = m(M, w.subLanguage.length ? w.subLanguage : null);
|
|
1454
|
+
w.relevance > 0 && (pe += g.relevance), F.__addSublanguage(g._emitter, g.language);
|
|
1463
1455
|
}
|
|
1464
1456
|
function G() {
|
|
1465
|
-
|
|
1457
|
+
w.subLanguage != null ? q() : z(), M = "";
|
|
1466
1458
|
}
|
|
1467
1459
|
function W(g, E) {
|
|
1468
|
-
g !== "" && (
|
|
1460
|
+
g !== "" && (F.startScope(E), F.addText(g), F.endScope());
|
|
1469
1461
|
}
|
|
1470
1462
|
function Oe(g, E) {
|
|
1471
1463
|
let N = 1;
|
|
1472
|
-
const
|
|
1473
|
-
for (; N <=
|
|
1464
|
+
const x = E.length - 1;
|
|
1465
|
+
for (; N <= x; ) {
|
|
1474
1466
|
if (!g._emit[N]) {
|
|
1475
1467
|
N++;
|
|
1476
1468
|
continue;
|
|
1477
1469
|
}
|
|
1478
1470
|
const K = Y.classNameAliases[g[N]] || g[N], Z = E[N];
|
|
1479
|
-
K ? W(Z, K) : (
|
|
1471
|
+
K ? W(Z, K) : (M = Z, z(), M = ""), N++;
|
|
1480
1472
|
}
|
|
1481
1473
|
}
|
|
1482
1474
|
function Ie(g, E) {
|
|
1483
|
-
return g.scope && typeof g.scope == "string" &&
|
|
1475
|
+
return g.scope && typeof g.scope == "string" && F.openNode(Y.classNameAliases[g.scope] || g.scope), g.beginScope && (g.beginScope._wrap ? (W(M, Y.classNameAliases[g.beginScope._wrap] || g.beginScope._wrap), M = "") : g.beginScope._multi && (Oe(g.beginScope, E), M = "")), w = Object.create(g, { parent: { value: w } }), w;
|
|
1484
1476
|
}
|
|
1485
1477
|
function Le(g, E, N) {
|
|
1486
|
-
let
|
|
1487
|
-
if (
|
|
1478
|
+
let x = _n(g.endRe, N);
|
|
1479
|
+
if (x) {
|
|
1488
1480
|
if (g["on:end"]) {
|
|
1489
1481
|
const K = new Ge(g);
|
|
1490
|
-
g["on:end"](E, K), K.isMatchIgnored && (
|
|
1482
|
+
g["on:end"](E, K), K.isMatchIgnored && (x = !1);
|
|
1491
1483
|
}
|
|
1492
|
-
if (
|
|
1484
|
+
if (x) {
|
|
1493
1485
|
for (; g.endsParent && g.parent; )
|
|
1494
1486
|
g = g.parent;
|
|
1495
1487
|
return g;
|
|
@@ -1499,89 +1491,89 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1499
1491
|
return Le(g.parent, E, N);
|
|
1500
1492
|
}
|
|
1501
1493
|
function Lt(g) {
|
|
1502
|
-
return
|
|
1494
|
+
return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (Ne = !0, 0);
|
|
1503
1495
|
}
|
|
1504
1496
|
function Dt(g) {
|
|
1505
|
-
const E = g[0], N = g.rule,
|
|
1497
|
+
const E = g[0], N = g.rule, x = new Ge(N), K = [N.__beforeBegin, N["on:begin"]];
|
|
1506
1498
|
for (const Z of K)
|
|
1507
|
-
if (Z && (Z(g,
|
|
1499
|
+
if (Z && (Z(g, x), x.isMatchIgnored))
|
|
1508
1500
|
return Lt(E);
|
|
1509
|
-
return N.skip ?
|
|
1501
|
+
return N.skip ? M += E : (N.excludeBegin && (M += E), G(), !N.returnBegin && !N.excludeBegin && (M = E)), Ie(N, g), N.returnBegin ? 0 : E.length;
|
|
1510
1502
|
}
|
|
1511
1503
|
function Pt(g) {
|
|
1512
|
-
const E = g[0], N = _.substring(g.index),
|
|
1513
|
-
if (!
|
|
1514
|
-
return
|
|
1515
|
-
const K =
|
|
1516
|
-
|
|
1504
|
+
const E = g[0], N = _.substring(g.index), x = Le(w, g, N);
|
|
1505
|
+
if (!x)
|
|
1506
|
+
return Xe;
|
|
1507
|
+
const K = w;
|
|
1508
|
+
w.endScope && w.endScope._wrap ? (G(), W(E, w.endScope._wrap)) : w.endScope && w.endScope._multi ? (G(), Oe(w.endScope, g)) : K.skip ? M += E : (K.returnEnd || K.excludeEnd || (M += E), G(), K.excludeEnd && (M = E));
|
|
1517
1509
|
do
|
|
1518
|
-
|
|
1519
|
-
while (
|
|
1520
|
-
return
|
|
1510
|
+
w.scope && F.closeNode(), !w.skip && !w.subLanguage && (pe += w.relevance), w = w.parent;
|
|
1511
|
+
while (w !== x.parent);
|
|
1512
|
+
return x.starts && Ie(x.starts, g), K.returnEnd ? 0 : E.length;
|
|
1521
1513
|
}
|
|
1522
1514
|
function Bt() {
|
|
1523
1515
|
const g = [];
|
|
1524
|
-
for (let E =
|
|
1516
|
+
for (let E = w; E !== Y; E = E.parent)
|
|
1525
1517
|
E.scope && g.unshift(E.scope);
|
|
1526
|
-
g.forEach((E) =>
|
|
1518
|
+
g.forEach((E) => F.openNode(E));
|
|
1527
1519
|
}
|
|
1528
1520
|
let he = {};
|
|
1529
1521
|
function De(g, E) {
|
|
1530
1522
|
const N = E && E[0];
|
|
1531
|
-
if (
|
|
1523
|
+
if (M += g, N == null)
|
|
1532
1524
|
return G(), 0;
|
|
1533
1525
|
if (he.type === "begin" && E.type === "end" && he.index === E.index && N === "") {
|
|
1534
|
-
if (
|
|
1535
|
-
const
|
|
1536
|
-
throw
|
|
1526
|
+
if (M += _.slice(E.index, E.index + 1), !r) {
|
|
1527
|
+
const x = new Error(`0 width match regex (${u})`);
|
|
1528
|
+
throw x.languageName = u, x.badRule = he.rule, x;
|
|
1537
1529
|
}
|
|
1538
1530
|
return 1;
|
|
1539
1531
|
}
|
|
1540
1532
|
if (he = E, E.type === "begin")
|
|
1541
1533
|
return Dt(E);
|
|
1542
|
-
if (E.type === "illegal" && !
|
|
1543
|
-
const
|
|
1544
|
-
throw
|
|
1534
|
+
if (E.type === "illegal" && !b) {
|
|
1535
|
+
const x = new Error('Illegal lexeme "' + N + '" for mode "' + (w.scope || "<unnamed>") + '"');
|
|
1536
|
+
throw x.mode = w, x;
|
|
1545
1537
|
} else if (E.type === "end") {
|
|
1546
|
-
const
|
|
1547
|
-
if (
|
|
1548
|
-
return
|
|
1538
|
+
const x = Pt(E);
|
|
1539
|
+
if (x !== Xe)
|
|
1540
|
+
return x;
|
|
1549
1541
|
}
|
|
1550
1542
|
if (E.type === "illegal" && N === "")
|
|
1551
|
-
return E.index === _.length || (
|
|
1543
|
+
return E.index === _.length || (M += `
|
|
1552
1544
|
`), 1;
|
|
1553
1545
|
if (ke > 1e5 && ke > E.index * 3)
|
|
1554
1546
|
throw new Error("potential infinite loop, way more iterations than matches");
|
|
1555
|
-
return
|
|
1547
|
+
return M += N, N.length;
|
|
1556
1548
|
}
|
|
1557
1549
|
const Y = $(u);
|
|
1558
1550
|
if (!Y)
|
|
1559
1551
|
throw ee(a.replace("{}", u)), new Error('Unknown language: "' + u + '"');
|
|
1560
1552
|
const $t = Jn(Y);
|
|
1561
|
-
let ve = "",
|
|
1562
|
-
const Pe = {},
|
|
1553
|
+
let ve = "", w = k || $t;
|
|
1554
|
+
const Pe = {}, F = new o.__emitter(o);
|
|
1563
1555
|
Bt();
|
|
1564
|
-
let
|
|
1556
|
+
let M = "", pe = 0, j = 0, ke = 0, Ne = !1;
|
|
1565
1557
|
try {
|
|
1566
1558
|
if (Y.__emitTokens)
|
|
1567
|
-
Y.__emitTokens(_,
|
|
1559
|
+
Y.__emitTokens(_, F);
|
|
1568
1560
|
else {
|
|
1569
|
-
for (
|
|
1570
|
-
ke++, Ne ? Ne = !1 :
|
|
1571
|
-
const g =
|
|
1561
|
+
for (w.matcher.considerAll(); ; ) {
|
|
1562
|
+
ke++, Ne ? Ne = !1 : w.matcher.considerAll(), w.matcher.lastIndex = j;
|
|
1563
|
+
const g = w.matcher.exec(_);
|
|
1572
1564
|
if (!g) break;
|
|
1573
1565
|
const E = _.substring(j, g.index), N = De(E, g);
|
|
1574
1566
|
j = g.index + N;
|
|
1575
1567
|
}
|
|
1576
1568
|
De(_.substring(j));
|
|
1577
1569
|
}
|
|
1578
|
-
return
|
|
1570
|
+
return F.finalize(), ve = F.toHTML(), {
|
|
1579
1571
|
language: u,
|
|
1580
1572
|
value: ve,
|
|
1581
1573
|
relevance: pe,
|
|
1582
1574
|
illegal: !1,
|
|
1583
|
-
_emitter:
|
|
1584
|
-
_top:
|
|
1575
|
+
_emitter: F,
|
|
1576
|
+
_top: w
|
|
1585
1577
|
};
|
|
1586
1578
|
} catch (g) {
|
|
1587
1579
|
if (g.message && g.message.includes("Illegal"))
|
|
@@ -1597,7 +1589,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1597
1589
|
mode: g.mode,
|
|
1598
1590
|
resultSoFar: ve
|
|
1599
1591
|
},
|
|
1600
|
-
_emitter:
|
|
1592
|
+
_emitter: F
|
|
1601
1593
|
};
|
|
1602
1594
|
if (r)
|
|
1603
1595
|
return {
|
|
@@ -1606,8 +1598,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1606
1598
|
illegal: !1,
|
|
1607
1599
|
relevance: 0,
|
|
1608
1600
|
errorRaised: g,
|
|
1609
|
-
_emitter:
|
|
1610
|
-
_top:
|
|
1601
|
+
_emitter: F,
|
|
1602
|
+
_top: w
|
|
1611
1603
|
};
|
|
1612
1604
|
throw g;
|
|
1613
1605
|
}
|
|
@@ -1624,10 +1616,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1624
1616
|
}
|
|
1625
1617
|
function m(u, _) {
|
|
1626
1618
|
_ = _ || o.languages || Object.keys(e);
|
|
1627
|
-
const
|
|
1619
|
+
const b = p(u), k = _.filter($).filter(V).map(
|
|
1628
1620
|
(G) => h(G, u, !1)
|
|
1629
1621
|
);
|
|
1630
|
-
k.unshift(
|
|
1622
|
+
k.unshift(b);
|
|
1631
1623
|
const T = k.sort((G, W) => {
|
|
1632
1624
|
if (G.relevance !== W.relevance) return W.relevance - G.relevance;
|
|
1633
1625
|
if (G.language && W.language) {
|
|
@@ -1640,17 +1632,17 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1640
1632
|
}), [P, z] = T, q = P;
|
|
1641
1633
|
return q.secondBest = z, q;
|
|
1642
1634
|
}
|
|
1643
|
-
function y(u, _,
|
|
1644
|
-
const k = _ && t[_] ||
|
|
1635
|
+
function y(u, _, b) {
|
|
1636
|
+
const k = _ && t[_] || b;
|
|
1645
1637
|
u.classList.add("hljs"), u.classList.add(`language-${k}`);
|
|
1646
1638
|
}
|
|
1647
|
-
function
|
|
1639
|
+
function f(u) {
|
|
1648
1640
|
let _ = null;
|
|
1649
|
-
const
|
|
1650
|
-
if (c(
|
|
1651
|
-
if (
|
|
1641
|
+
const b = l(u);
|
|
1642
|
+
if (c(b)) return;
|
|
1643
|
+
if (X(
|
|
1652
1644
|
"before:highlightElement",
|
|
1653
|
-
{ el: u, language:
|
|
1645
|
+
{ el: u, language: b }
|
|
1654
1646
|
), u.dataset.highlighted) {
|
|
1655
1647
|
console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", u);
|
|
1656
1648
|
return;
|
|
@@ -1661,8 +1653,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1661
1653
|
u.innerHTML
|
|
1662
1654
|
);
|
|
1663
1655
|
_ = u;
|
|
1664
|
-
const k = _.textContent, T =
|
|
1665
|
-
u.innerHTML = T.value, u.dataset.highlighted = "yes", y(u,
|
|
1656
|
+
const k = _.textContent, T = b ? d(k, { language: b, ignoreIllegals: !0 }) : m(k);
|
|
1657
|
+
u.innerHTML = T.value, u.dataset.highlighted = "yes", y(u, b, T.language), u.result = {
|
|
1666
1658
|
language: T.language,
|
|
1667
1659
|
// TODO: remove with version 11.0
|
|
1668
1660
|
re: T.relevance,
|
|
@@ -1670,40 +1662,40 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1670
1662
|
}, T.secondBest && (u.secondBest = {
|
|
1671
1663
|
language: T.secondBest.language,
|
|
1672
1664
|
relevance: T.secondBest.relevance
|
|
1673
|
-
}),
|
|
1665
|
+
}), X("after:highlightElement", { el: u, result: T, text: k });
|
|
1674
1666
|
}
|
|
1675
|
-
function
|
|
1676
|
-
o =
|
|
1667
|
+
function v(u) {
|
|
1668
|
+
o = Ve(o, u);
|
|
1677
1669
|
}
|
|
1678
|
-
const
|
|
1679
|
-
|
|
1670
|
+
const S = () => {
|
|
1671
|
+
C(), ne("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
|
|
1680
1672
|
};
|
|
1681
1673
|
function O() {
|
|
1682
|
-
|
|
1674
|
+
C(), ne("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
|
|
1683
1675
|
}
|
|
1684
1676
|
let U = !1;
|
|
1685
|
-
function
|
|
1677
|
+
function C() {
|
|
1686
1678
|
function u() {
|
|
1687
|
-
|
|
1679
|
+
C();
|
|
1688
1680
|
}
|
|
1689
1681
|
if (document.readyState === "loading") {
|
|
1690
1682
|
U || window.addEventListener("DOMContentLoaded", u, !1), U = !0;
|
|
1691
1683
|
return;
|
|
1692
1684
|
}
|
|
1693
|
-
document.querySelectorAll(o.cssSelector).forEach(
|
|
1685
|
+
document.querySelectorAll(o.cssSelector).forEach(f);
|
|
1694
1686
|
}
|
|
1695
1687
|
function I(u, _) {
|
|
1696
|
-
let
|
|
1688
|
+
let b = null;
|
|
1697
1689
|
try {
|
|
1698
|
-
|
|
1690
|
+
b = _(n);
|
|
1699
1691
|
} catch (k) {
|
|
1700
1692
|
if (ee("Language definition for '{}' could not be registered.".replace("{}", u)), r)
|
|
1701
1693
|
ee(k);
|
|
1702
1694
|
else
|
|
1703
1695
|
throw k;
|
|
1704
|
-
|
|
1696
|
+
b = s;
|
|
1705
1697
|
}
|
|
1706
|
-
|
|
1698
|
+
b.name || (b.name = u), e[u] = b, b.rawDefinition = _.bind(null, n), b.aliases && H(b.aliases, { languageName: u });
|
|
1707
1699
|
}
|
|
1708
1700
|
function D(u) {
|
|
1709
1701
|
delete e[u];
|
|
@@ -1716,12 +1708,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1716
1708
|
function $(u) {
|
|
1717
1709
|
return u = (u || "").toLowerCase(), e[u] || e[t[u]];
|
|
1718
1710
|
}
|
|
1719
|
-
function
|
|
1720
|
-
typeof u == "string" && (u = [u]), u.forEach((
|
|
1721
|
-
t[
|
|
1711
|
+
function H(u, { languageName: _ }) {
|
|
1712
|
+
typeof u == "string" && (u = [u]), u.forEach((b) => {
|
|
1713
|
+
t[b.toLowerCase()] = _;
|
|
1722
1714
|
});
|
|
1723
1715
|
}
|
|
1724
|
-
function
|
|
1716
|
+
function V(u) {
|
|
1725
1717
|
const _ = $(u);
|
|
1726
1718
|
return _ && !_.disableAutodetect;
|
|
1727
1719
|
}
|
|
@@ -1743,32 +1735,32 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), f ===
|
|
|
1743
1735
|
const _ = i.indexOf(u);
|
|
1744
1736
|
_ !== -1 && i.splice(_, 1);
|
|
1745
1737
|
}
|
|
1746
|
-
function
|
|
1747
|
-
const
|
|
1738
|
+
function X(u, _) {
|
|
1739
|
+
const b = u;
|
|
1748
1740
|
i.forEach(function(k) {
|
|
1749
|
-
k[
|
|
1741
|
+
k[b] && k[b](_);
|
|
1750
1742
|
});
|
|
1751
1743
|
}
|
|
1752
1744
|
function ce(u) {
|
|
1753
|
-
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."),
|
|
1745
|
+
return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), f(u);
|
|
1754
1746
|
}
|
|
1755
1747
|
Object.assign(n, {
|
|
1756
1748
|
highlight: d,
|
|
1757
1749
|
highlightAuto: m,
|
|
1758
|
-
highlightAll:
|
|
1759
|
-
highlightElement:
|
|
1750
|
+
highlightAll: C,
|
|
1751
|
+
highlightElement: f,
|
|
1760
1752
|
// TODO: Remove with v12 API
|
|
1761
1753
|
highlightBlock: ce,
|
|
1762
|
-
configure:
|
|
1763
|
-
initHighlighting:
|
|
1754
|
+
configure: v,
|
|
1755
|
+
initHighlighting: S,
|
|
1764
1756
|
initHighlightingOnLoad: O,
|
|
1765
1757
|
registerLanguage: I,
|
|
1766
1758
|
unregisterLanguage: D,
|
|
1767
1759
|
listLanguages: B,
|
|
1768
1760
|
getLanguage: $,
|
|
1769
|
-
registerAliases:
|
|
1770
|
-
autoDetection:
|
|
1771
|
-
inherit:
|
|
1761
|
+
registerAliases: H,
|
|
1762
|
+
autoDetection: V,
|
|
1763
|
+
inherit: Ve,
|
|
1772
1764
|
addPlugin: oe,
|
|
1773
1765
|
removePlugin: ae
|
|
1774
1766
|
}), n.debugMode = function() {
|
|
@@ -1790,7 +1782,7 @@ se.newInstance = () => gt({});
|
|
|
1790
1782
|
var ii = se;
|
|
1791
1783
|
se.HighlightJS = se;
|
|
1792
1784
|
se.default = se;
|
|
1793
|
-
const
|
|
1785
|
+
const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ri = [
|
|
1794
1786
|
"as",
|
|
1795
1787
|
// for exports
|
|
1796
1788
|
"in",
|
|
@@ -1938,9 +1930,9 @@ const S = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ri = [
|
|
|
1938
1930
|
ft
|
|
1939
1931
|
);
|
|
1940
1932
|
function _t(n) {
|
|
1941
|
-
const e = n.regex, t = (
|
|
1942
|
-
const T = "</" +
|
|
1943
|
-
return
|
|
1933
|
+
const e = n.regex, t = (b, { after: k }) => {
|
|
1934
|
+
const T = "</" + b[0].slice(1);
|
|
1935
|
+
return b.input.indexOf(T, k) !== -1;
|
|
1944
1936
|
}, i = Qe, r = {
|
|
1945
1937
|
begin: "<>",
|
|
1946
1938
|
end: "</>"
|
|
@@ -1951,8 +1943,8 @@ function _t(n) {
|
|
|
1951
1943
|
* @param {RegExpMatchArray} match
|
|
1952
1944
|
* @param {CallbackResponse} response
|
|
1953
1945
|
*/
|
|
1954
|
-
isTrulyOpeningTag: (
|
|
1955
|
-
const T =
|
|
1946
|
+
isTrulyOpeningTag: (b, k) => {
|
|
1947
|
+
const T = b[0].length + b.index, P = b.input[T];
|
|
1956
1948
|
if (
|
|
1957
1949
|
// HTML should not include another raw `<` inside a tag
|
|
1958
1950
|
// nested type?
|
|
@@ -1964,9 +1956,9 @@ function _t(n) {
|
|
|
1964
1956
|
k.ignoreMatch();
|
|
1965
1957
|
return;
|
|
1966
1958
|
}
|
|
1967
|
-
P === ">" && (t(
|
|
1959
|
+
P === ">" && (t(b, { after: T }) || k.ignoreMatch());
|
|
1968
1960
|
let z;
|
|
1969
|
-
const q =
|
|
1961
|
+
const q = b.input.substring(T);
|
|
1970
1962
|
if (z = q.match(/^\s*=/)) {
|
|
1971
1963
|
k.ignoreMatch();
|
|
1972
1964
|
return;
|
|
@@ -2030,7 +2022,7 @@ function _t(n) {
|
|
|
2030
2022
|
],
|
|
2031
2023
|
subLanguage: "css"
|
|
2032
2024
|
}
|
|
2033
|
-
},
|
|
2025
|
+
}, f = {
|
|
2034
2026
|
begin: ".?gql`",
|
|
2035
2027
|
end: "",
|
|
2036
2028
|
starts: {
|
|
@@ -2042,7 +2034,7 @@ function _t(n) {
|
|
|
2042
2034
|
],
|
|
2043
2035
|
subLanguage: "graphql"
|
|
2044
2036
|
}
|
|
2045
|
-
},
|
|
2037
|
+
}, v = {
|
|
2046
2038
|
className: "string",
|
|
2047
2039
|
begin: "`",
|
|
2048
2040
|
end: "`",
|
|
@@ -2100,8 +2092,8 @@ function _t(n) {
|
|
|
2100
2092
|
n.QUOTE_STRING_MODE,
|
|
2101
2093
|
m,
|
|
2102
2094
|
y,
|
|
2103
|
-
|
|
2104
|
-
|
|
2095
|
+
f,
|
|
2096
|
+
v,
|
|
2105
2097
|
// Skip numbers when they are part of a variable name
|
|
2106
2098
|
{ match: /\$\d+/ },
|
|
2107
2099
|
h
|
|
@@ -2119,13 +2111,13 @@ function _t(n) {
|
|
|
2119
2111
|
"self"
|
|
2120
2112
|
].concat(U)
|
|
2121
2113
|
});
|
|
2122
|
-
const
|
|
2114
|
+
const C = [].concat(O, p.contains), I = C.concat([
|
|
2123
2115
|
// eat recursive parens in sub expressions
|
|
2124
2116
|
{
|
|
2125
2117
|
begin: /(\s*)\(/,
|
|
2126
2118
|
end: /\)/,
|
|
2127
2119
|
keywords: o,
|
|
2128
|
-
contains: ["self"].concat(
|
|
2120
|
+
contains: ["self"].concat(C)
|
|
2129
2121
|
}
|
|
2130
2122
|
]), D = {
|
|
2131
2123
|
className: "params",
|
|
@@ -2194,12 +2186,12 @@ function _t(n) {
|
|
|
2194
2186
|
...ft
|
|
2195
2187
|
]
|
|
2196
2188
|
}
|
|
2197
|
-
},
|
|
2189
|
+
}, H = {
|
|
2198
2190
|
label: "use_strict",
|
|
2199
2191
|
className: "meta",
|
|
2200
2192
|
relevance: 10,
|
|
2201
2193
|
begin: /^\s*['"]use (strict|asm)['"]/
|
|
2202
|
-
},
|
|
2194
|
+
}, V = {
|
|
2203
2195
|
variants: [
|
|
2204
2196
|
{
|
|
2205
2197
|
match: [
|
|
@@ -2229,8 +2221,8 @@ function _t(n) {
|
|
|
2229
2221
|
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
2230
2222
|
className: "variable.constant"
|
|
2231
2223
|
};
|
|
2232
|
-
function oe(
|
|
2233
|
-
return e.concat("(?!",
|
|
2224
|
+
function oe(b) {
|
|
2225
|
+
return e.concat("(?!", b.join("|"), ")");
|
|
2234
2226
|
}
|
|
2235
2227
|
const ae = {
|
|
2236
2228
|
match: e.concat(
|
|
@@ -2240,13 +2232,13 @@ function _t(n) {
|
|
|
2240
2232
|
"super",
|
|
2241
2233
|
"import",
|
|
2242
2234
|
"await"
|
|
2243
|
-
].map((
|
|
2235
|
+
].map((b) => `${b}\\s*\\(`)),
|
|
2244
2236
|
i,
|
|
2245
2237
|
e.lookahead(/\s*\(/)
|
|
2246
2238
|
),
|
|
2247
2239
|
className: "title.function",
|
|
2248
2240
|
relevance: 0
|
|
2249
|
-
},
|
|
2241
|
+
}, X = {
|
|
2250
2242
|
begin: e.concat(/\./, e.lookahead(
|
|
2251
2243
|
e.concat(i, /(?![0-9A-Za-z$_(])/)
|
|
2252
2244
|
)),
|
|
@@ -2306,13 +2298,13 @@ function _t(n) {
|
|
|
2306
2298
|
binary: "node",
|
|
2307
2299
|
relevance: 5
|
|
2308
2300
|
}),
|
|
2309
|
-
|
|
2301
|
+
H,
|
|
2310
2302
|
n.APOS_STRING_MODE,
|
|
2311
2303
|
n.QUOTE_STRING_MODE,
|
|
2312
2304
|
m,
|
|
2313
2305
|
y,
|
|
2314
|
-
|
|
2315
|
-
|
|
2306
|
+
f,
|
|
2307
|
+
v,
|
|
2316
2308
|
O,
|
|
2317
2309
|
// Skip numbers when they are part of a variable name
|
|
2318
2310
|
{ match: /\$\d+/ },
|
|
@@ -2399,7 +2391,7 @@ function _t(n) {
|
|
|
2399
2391
|
}
|
|
2400
2392
|
]
|
|
2401
2393
|
},
|
|
2402
|
-
|
|
2394
|
+
V,
|
|
2403
2395
|
{
|
|
2404
2396
|
// prevent this from getting swallowed up by function
|
|
2405
2397
|
// since they appear "function like"
|
|
@@ -2423,7 +2415,7 @@ function _t(n) {
|
|
|
2423
2415
|
match: /\.\.\./,
|
|
2424
2416
|
relevance: 0
|
|
2425
2417
|
},
|
|
2426
|
-
|
|
2418
|
+
X,
|
|
2427
2419
|
// hack: prevents detection of keywords in some circumstances
|
|
2428
2420
|
// .keyword()
|
|
2429
2421
|
// $keyword = x
|
|
@@ -2595,9 +2587,9 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
|
|
|
2595
2587
|
vt
|
|
2596
2588
|
);
|
|
2597
2589
|
function ci(n) {
|
|
2598
|
-
const e = n.regex, t = (
|
|
2599
|
-
const T = "</" +
|
|
2600
|
-
return
|
|
2590
|
+
const e = n.regex, t = (b, { after: k }) => {
|
|
2591
|
+
const T = "</" + b[0].slice(1);
|
|
2592
|
+
return b.input.indexOf(T, k) !== -1;
|
|
2601
2593
|
}, i = Ee, r = {
|
|
2602
2594
|
begin: "<>",
|
|
2603
2595
|
end: "</>"
|
|
@@ -2608,8 +2600,8 @@ function ci(n) {
|
|
|
2608
2600
|
* @param {RegExpMatchArray} match
|
|
2609
2601
|
* @param {CallbackResponse} response
|
|
2610
2602
|
*/
|
|
2611
|
-
isTrulyOpeningTag: (
|
|
2612
|
-
const T =
|
|
2603
|
+
isTrulyOpeningTag: (b, k) => {
|
|
2604
|
+
const T = b[0].length + b.index, P = b.input[T];
|
|
2613
2605
|
if (
|
|
2614
2606
|
// HTML should not include another raw `<` inside a tag
|
|
2615
2607
|
// nested type?
|
|
@@ -2621,9 +2613,9 @@ function ci(n) {
|
|
|
2621
2613
|
k.ignoreMatch();
|
|
2622
2614
|
return;
|
|
2623
2615
|
}
|
|
2624
|
-
P === ">" && (t(
|
|
2616
|
+
P === ">" && (t(b, { after: T }) || k.ignoreMatch());
|
|
2625
2617
|
let z;
|
|
2626
|
-
const q =
|
|
2618
|
+
const q = b.input.substring(T);
|
|
2627
2619
|
if (z = q.match(/^\s*=/)) {
|
|
2628
2620
|
k.ignoreMatch();
|
|
2629
2621
|
return;
|
|
@@ -2687,7 +2679,7 @@ function ci(n) {
|
|
|
2687
2679
|
],
|
|
2688
2680
|
subLanguage: "css"
|
|
2689
2681
|
}
|
|
2690
|
-
},
|
|
2682
|
+
}, f = {
|
|
2691
2683
|
begin: ".?gql`",
|
|
2692
2684
|
end: "",
|
|
2693
2685
|
starts: {
|
|
@@ -2699,7 +2691,7 @@ function ci(n) {
|
|
|
2699
2691
|
],
|
|
2700
2692
|
subLanguage: "graphql"
|
|
2701
2693
|
}
|
|
2702
|
-
},
|
|
2694
|
+
}, v = {
|
|
2703
2695
|
className: "string",
|
|
2704
2696
|
begin: "`",
|
|
2705
2697
|
end: "`",
|
|
@@ -2757,8 +2749,8 @@ function ci(n) {
|
|
|
2757
2749
|
n.QUOTE_STRING_MODE,
|
|
2758
2750
|
m,
|
|
2759
2751
|
y,
|
|
2760
|
-
|
|
2761
|
-
|
|
2752
|
+
f,
|
|
2753
|
+
v,
|
|
2762
2754
|
// Skip numbers when they are part of a variable name
|
|
2763
2755
|
{ match: /\$\d+/ },
|
|
2764
2756
|
h
|
|
@@ -2776,13 +2768,13 @@ function ci(n) {
|
|
|
2776
2768
|
"self"
|
|
2777
2769
|
].concat(U)
|
|
2778
2770
|
});
|
|
2779
|
-
const
|
|
2771
|
+
const C = [].concat(O, p.contains), I = C.concat([
|
|
2780
2772
|
// eat recursive parens in sub expressions
|
|
2781
2773
|
{
|
|
2782
2774
|
begin: /(\s*)\(/,
|
|
2783
2775
|
end: /\)/,
|
|
2784
2776
|
keywords: o,
|
|
2785
|
-
contains: ["self"].concat(
|
|
2777
|
+
contains: ["self"].concat(C)
|
|
2786
2778
|
}
|
|
2787
2779
|
]), D = {
|
|
2788
2780
|
className: "params",
|
|
@@ -2851,12 +2843,12 @@ function ci(n) {
|
|
|
2851
2843
|
...vt
|
|
2852
2844
|
]
|
|
2853
2845
|
}
|
|
2854
|
-
},
|
|
2846
|
+
}, H = {
|
|
2855
2847
|
label: "use_strict",
|
|
2856
2848
|
className: "meta",
|
|
2857
2849
|
relevance: 10,
|
|
2858
2850
|
begin: /^\s*['"]use (strict|asm)['"]/
|
|
2859
|
-
},
|
|
2851
|
+
}, V = {
|
|
2860
2852
|
variants: [
|
|
2861
2853
|
{
|
|
2862
2854
|
match: [
|
|
@@ -2886,8 +2878,8 @@ function ci(n) {
|
|
|
2886
2878
|
match: /\b[A-Z][A-Z_0-9]+\b/,
|
|
2887
2879
|
className: "variable.constant"
|
|
2888
2880
|
};
|
|
2889
|
-
function oe(
|
|
2890
|
-
return e.concat("(?!",
|
|
2881
|
+
function oe(b) {
|
|
2882
|
+
return e.concat("(?!", b.join("|"), ")");
|
|
2891
2883
|
}
|
|
2892
2884
|
const ae = {
|
|
2893
2885
|
match: e.concat(
|
|
@@ -2897,13 +2889,13 @@ function ci(n) {
|
|
|
2897
2889
|
"super",
|
|
2898
2890
|
"import",
|
|
2899
2891
|
"await"
|
|
2900
|
-
].map((
|
|
2892
|
+
].map((b) => `${b}\\s*\\(`)),
|
|
2901
2893
|
i,
|
|
2902
2894
|
e.lookahead(/\s*\(/)
|
|
2903
2895
|
),
|
|
2904
2896
|
className: "title.function",
|
|
2905
2897
|
relevance: 0
|
|
2906
|
-
},
|
|
2898
|
+
}, X = {
|
|
2907
2899
|
begin: e.concat(/\./, e.lookahead(
|
|
2908
2900
|
e.concat(i, /(?![0-9A-Za-z$_(])/)
|
|
2909
2901
|
)),
|
|
@@ -2963,13 +2955,13 @@ function ci(n) {
|
|
|
2963
2955
|
binary: "node",
|
|
2964
2956
|
relevance: 5
|
|
2965
2957
|
}),
|
|
2966
|
-
|
|
2958
|
+
H,
|
|
2967
2959
|
n.APOS_STRING_MODE,
|
|
2968
2960
|
n.QUOTE_STRING_MODE,
|
|
2969
2961
|
m,
|
|
2970
2962
|
y,
|
|
2971
|
-
|
|
2972
|
-
|
|
2963
|
+
f,
|
|
2964
|
+
v,
|
|
2973
2965
|
O,
|
|
2974
2966
|
// Skip numbers when they are part of a variable name
|
|
2975
2967
|
{ match: /\$\d+/ },
|
|
@@ -3056,7 +3048,7 @@ function ci(n) {
|
|
|
3056
3048
|
}
|
|
3057
3049
|
]
|
|
3058
3050
|
},
|
|
3059
|
-
|
|
3051
|
+
V,
|
|
3060
3052
|
{
|
|
3061
3053
|
// prevent this from getting swallowed up by function
|
|
3062
3054
|
// since they appear "function like"
|
|
@@ -3080,7 +3072,7 @@ function ci(n) {
|
|
|
3080
3072
|
match: /\.\.\./,
|
|
3081
3073
|
relevance: 0
|
|
3082
3074
|
},
|
|
3083
|
-
|
|
3075
|
+
X,
|
|
3084
3076
|
// hack: prevents detection of keywords in some circumstances
|
|
3085
3077
|
// .keyword()
|
|
3086
3078
|
// $keyword = x
|
|
@@ -3162,14 +3154,14 @@ function St(n) {
|
|
|
3162
3154
|
}, d = {
|
|
3163
3155
|
className: "meta",
|
|
3164
3156
|
begin: "@" + i
|
|
3165
|
-
}, h = (
|
|
3166
|
-
const O =
|
|
3157
|
+
}, h = (f, v, S) => {
|
|
3158
|
+
const O = f.contains.findIndex((U) => U.label === v);
|
|
3167
3159
|
if (O === -1)
|
|
3168
3160
|
throw new Error("can not find mode to replace");
|
|
3169
|
-
|
|
3161
|
+
f.contains.splice(O, 1, S);
|
|
3170
3162
|
};
|
|
3171
3163
|
Object.assign(t.keywords, l), t.exports.PARAMS_CONTAINS.push(d);
|
|
3172
|
-
const p = t.contains.find((
|
|
3164
|
+
const p = t.contains.find((f) => f.scope === "attr"), m = Object.assign(
|
|
3173
3165
|
{},
|
|
3174
3166
|
p,
|
|
3175
3167
|
{ match: e.concat(i, e.lookahead(/\s*\?:/)) }
|
|
@@ -3188,7 +3180,7 @@ function St(n) {
|
|
|
3188
3180
|
m
|
|
3189
3181
|
// Added for optional property assignment highlighting
|
|
3190
3182
|
]), h(t, "shebang", n.SHEBANG()), h(t, "use_strict", o);
|
|
3191
|
-
const y = t.contains.find((
|
|
3183
|
+
const y = t.contains.find((f) => f.label === "func.def");
|
|
3192
3184
|
return y.relevance = 0, Object.assign(t, {
|
|
3193
3185
|
name: "TypeScript",
|
|
3194
3186
|
aliases: [
|
|
@@ -3430,7 +3422,7 @@ function At(n) {
|
|
|
3430
3422
|
n.APOS_STRING_MODE,
|
|
3431
3423
|
n.QUOTE_STRING_MODE
|
|
3432
3424
|
]
|
|
3433
|
-
}, p = "[0-9](_?[0-9])*", m = `(\\b(${p}))?\\.(${p})|\\b(${p})\\.`, y = `\\b|${i.join("|")}`,
|
|
3425
|
+
}, p = "[0-9](_?[0-9])*", m = `(\\b(${p}))?\\.(${p})|\\b(${p})\\.`, y = `\\b|${i.join("|")}`, f = {
|
|
3434
3426
|
className: "number",
|
|
3435
3427
|
relevance: 0,
|
|
3436
3428
|
variants: [
|
|
@@ -3474,7 +3466,7 @@ function At(n) {
|
|
|
3474
3466
|
begin: `\\b(${p})[jJ](?=${y})`
|
|
3475
3467
|
}
|
|
3476
3468
|
]
|
|
3477
|
-
},
|
|
3469
|
+
}, v = {
|
|
3478
3470
|
className: "comment",
|
|
3479
3471
|
begin: e.lookahead(/# type:/),
|
|
3480
3472
|
end: /$/,
|
|
@@ -3491,7 +3483,7 @@ function At(n) {
|
|
|
3491
3483
|
endsWithParent: !0
|
|
3492
3484
|
}
|
|
3493
3485
|
]
|
|
3494
|
-
},
|
|
3486
|
+
}, S = {
|
|
3495
3487
|
className: "params",
|
|
3496
3488
|
variants: [
|
|
3497
3489
|
// Exclude params in functions without params
|
|
@@ -3509,7 +3501,7 @@ function At(n) {
|
|
|
3509
3501
|
contains: [
|
|
3510
3502
|
"self",
|
|
3511
3503
|
c,
|
|
3512
|
-
|
|
3504
|
+
f,
|
|
3513
3505
|
h,
|
|
3514
3506
|
n.HASH_COMMENT_MODE
|
|
3515
3507
|
]
|
|
@@ -3518,7 +3510,7 @@ function At(n) {
|
|
|
3518
3510
|
};
|
|
3519
3511
|
return l.contains = [
|
|
3520
3512
|
h,
|
|
3521
|
-
|
|
3513
|
+
f,
|
|
3522
3514
|
c
|
|
3523
3515
|
], {
|
|
3524
3516
|
name: "Python",
|
|
@@ -3532,7 +3524,7 @@ function At(n) {
|
|
|
3532
3524
|
illegal: /(<\/|\?)|=>/,
|
|
3533
3525
|
contains: [
|
|
3534
3526
|
c,
|
|
3535
|
-
|
|
3527
|
+
f,
|
|
3536
3528
|
{
|
|
3537
3529
|
// very common convention
|
|
3538
3530
|
scope: "variable.language",
|
|
@@ -3546,7 +3538,7 @@ function At(n) {
|
|
|
3546
3538
|
},
|
|
3547
3539
|
{ match: /\bor\b/, scope: "keyword" },
|
|
3548
3540
|
h,
|
|
3549
|
-
|
|
3541
|
+
v,
|
|
3550
3542
|
n.HASH_COMMENT_MODE,
|
|
3551
3543
|
{
|
|
3552
3544
|
match: [
|
|
@@ -3558,7 +3550,7 @@ function At(n) {
|
|
|
3558
3550
|
1: "keyword",
|
|
3559
3551
|
3: "title.function"
|
|
3560
3552
|
},
|
|
3561
|
-
contains: [
|
|
3553
|
+
contains: [S]
|
|
3562
3554
|
},
|
|
3563
3555
|
{
|
|
3564
3556
|
variants: [
|
|
@@ -3592,8 +3584,8 @@ function At(n) {
|
|
|
3592
3584
|
begin: /^[\t ]*@/,
|
|
3593
3585
|
end: /(?=#)|$/,
|
|
3594
3586
|
contains: [
|
|
3595
|
-
|
|
3596
|
-
|
|
3587
|
+
f,
|
|
3588
|
+
S,
|
|
3597
3589
|
h
|
|
3598
3590
|
]
|
|
3599
3591
|
}
|
|
@@ -3740,7 +3732,7 @@ function Me(n) {
|
|
|
3740
3732
|
returnBegin: !0,
|
|
3741
3733
|
contains: [n.inherit(n.TITLE_MODE, { begin: /\w[\w\d_]*/ })],
|
|
3742
3734
|
relevance: 0
|
|
3743
|
-
},
|
|
3735
|
+
}, f = [
|
|
3744
3736
|
"if",
|
|
3745
3737
|
"then",
|
|
3746
3738
|
"else",
|
|
@@ -3758,10 +3750,10 @@ function Me(n) {
|
|
|
3758
3750
|
"coproc",
|
|
3759
3751
|
"function",
|
|
3760
3752
|
"select"
|
|
3761
|
-
],
|
|
3753
|
+
], v = [
|
|
3762
3754
|
"true",
|
|
3763
3755
|
"false"
|
|
3764
|
-
],
|
|
3756
|
+
], S = { match: /(\/[a-z._-]+)+/ }, O = [
|
|
3765
3757
|
"break",
|
|
3766
3758
|
"cd",
|
|
3767
3759
|
"continue",
|
|
@@ -3803,7 +3795,7 @@ function Me(n) {
|
|
|
3803
3795
|
"typeset",
|
|
3804
3796
|
"ulimit",
|
|
3805
3797
|
"unalias"
|
|
3806
|
-
],
|
|
3798
|
+
], C = [
|
|
3807
3799
|
"autoload",
|
|
3808
3800
|
"bg",
|
|
3809
3801
|
"bindkey",
|
|
@@ -3985,15 +3977,15 @@ function Me(n) {
|
|
|
3985
3977
|
],
|
|
3986
3978
|
keywords: {
|
|
3987
3979
|
$pattern: /\b[a-z][a-z0-9._-]+\b/,
|
|
3988
|
-
keyword:
|
|
3989
|
-
literal:
|
|
3980
|
+
keyword: f,
|
|
3981
|
+
literal: v,
|
|
3990
3982
|
built_in: [
|
|
3991
3983
|
...O,
|
|
3992
3984
|
...U,
|
|
3993
3985
|
// Shell modifiers
|
|
3994
3986
|
"set",
|
|
3995
3987
|
"shopt",
|
|
3996
|
-
...
|
|
3988
|
+
...C,
|
|
3997
3989
|
...I
|
|
3998
3990
|
]
|
|
3999
3991
|
},
|
|
@@ -4006,7 +3998,7 @@ function Me(n) {
|
|
|
4006
3998
|
h,
|
|
4007
3999
|
a,
|
|
4008
4000
|
s,
|
|
4009
|
-
|
|
4001
|
+
S,
|
|
4010
4002
|
o,
|
|
4011
4003
|
c,
|
|
4012
4004
|
l,
|
|
@@ -5707,14 +5699,14 @@ function wi(n) {
|
|
|
5707
5699
|
], m = d, y = [
|
|
5708
5700
|
...l,
|
|
5709
5701
|
...c
|
|
5710
|
-
].filter((I) => !d.includes(I)),
|
|
5702
|
+
].filter((I) => !d.includes(I)), f = {
|
|
5711
5703
|
scope: "variable",
|
|
5712
5704
|
match: /@[a-z0-9][a-z0-9_]*/
|
|
5713
|
-
},
|
|
5705
|
+
}, v = {
|
|
5714
5706
|
scope: "operator",
|
|
5715
5707
|
match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
|
|
5716
5708
|
relevance: 0
|
|
5717
|
-
},
|
|
5709
|
+
}, S = {
|
|
5718
5710
|
match: e.concat(/\b/, e.either(...m), /\s*\(/),
|
|
5719
5711
|
relevance: 0,
|
|
5720
5712
|
keywords: { built_in: m }
|
|
@@ -5731,12 +5723,12 @@ function wi(n) {
|
|
|
5731
5723
|
match: O(p),
|
|
5732
5724
|
relevance: 0
|
|
5733
5725
|
};
|
|
5734
|
-
function
|
|
5726
|
+
function C(I, {
|
|
5735
5727
|
exceptions: D,
|
|
5736
5728
|
when: B
|
|
5737
5729
|
} = {}) {
|
|
5738
5730
|
const $ = B;
|
|
5739
|
-
return D = D || [], I.map((
|
|
5731
|
+
return D = D || [], I.map((H) => H.match(/\|\d+$/) || D.includes(H) ? H : $(H) ? `${H}|0` : H);
|
|
5740
5732
|
}
|
|
5741
5733
|
return {
|
|
5742
5734
|
name: "SQL",
|
|
@@ -5745,7 +5737,7 @@ function wi(n) {
|
|
|
5745
5737
|
illegal: /[{}]|<\//,
|
|
5746
5738
|
keywords: {
|
|
5747
5739
|
$pattern: /\b[\w\.]+/,
|
|
5748
|
-
keyword:
|
|
5740
|
+
keyword: C(y, { when: (I) => I.length < 3 }),
|
|
5749
5741
|
literal: a,
|
|
5750
5742
|
type: o,
|
|
5751
5743
|
built_in: h
|
|
@@ -5756,14 +5748,14 @@ function wi(n) {
|
|
|
5756
5748
|
match: O(s)
|
|
5757
5749
|
},
|
|
5758
5750
|
U,
|
|
5759
|
-
|
|
5760
|
-
|
|
5751
|
+
S,
|
|
5752
|
+
f,
|
|
5761
5753
|
i,
|
|
5762
5754
|
r,
|
|
5763
5755
|
n.C_NUMBER_MODE,
|
|
5764
5756
|
n.C_BLOCK_COMMENT_MODE,
|
|
5765
5757
|
t,
|
|
5766
|
-
|
|
5758
|
+
v
|
|
5767
5759
|
]
|
|
5768
5760
|
};
|
|
5769
5761
|
}
|
|
@@ -5853,13 +5845,13 @@ function xt(n) {
|
|
|
5853
5845
|
contains: [m],
|
|
5854
5846
|
illegal: "\\n",
|
|
5855
5847
|
relevance: 0
|
|
5856
|
-
},
|
|
5848
|
+
}, f = {
|
|
5857
5849
|
begin: "\\[",
|
|
5858
5850
|
end: "\\]",
|
|
5859
5851
|
contains: [m],
|
|
5860
5852
|
illegal: "\\n",
|
|
5861
5853
|
relevance: 0
|
|
5862
|
-
},
|
|
5854
|
+
}, v = [
|
|
5863
5855
|
i,
|
|
5864
5856
|
{
|
|
5865
5857
|
className: "meta",
|
|
@@ -5936,15 +5928,15 @@ function xt(n) {
|
|
|
5936
5928
|
relevance: 0
|
|
5937
5929
|
},
|
|
5938
5930
|
y,
|
|
5939
|
-
|
|
5931
|
+
f,
|
|
5940
5932
|
a,
|
|
5941
5933
|
s
|
|
5942
|
-
],
|
|
5943
|
-
return
|
|
5934
|
+
], S = [...v];
|
|
5935
|
+
return S.pop(), S.push(o), m.contains = S, {
|
|
5944
5936
|
name: "YAML",
|
|
5945
5937
|
case_insensitive: !0,
|
|
5946
5938
|
aliases: ["yml"],
|
|
5947
|
-
contains:
|
|
5939
|
+
contains: v
|
|
5948
5940
|
};
|
|
5949
5941
|
}
|
|
5950
5942
|
function Ct(n) {
|
|
@@ -6104,8 +6096,8 @@ function Ct(n) {
|
|
|
6104
6096
|
d,
|
|
6105
6097
|
h,
|
|
6106
6098
|
p
|
|
6107
|
-
].forEach((
|
|
6108
|
-
|
|
6099
|
+
].forEach((S) => {
|
|
6100
|
+
S.contains = S.contains.concat(m);
|
|
6109
6101
|
}), m = m.concat(l, d), {
|
|
6110
6102
|
name: "Markdown",
|
|
6111
6103
|
aliases: [
|
|
@@ -6986,11 +6978,11 @@ function Ni(n) {
|
|
|
6986
6978
|
}, y = [
|
|
6987
6979
|
p,
|
|
6988
6980
|
m
|
|
6989
|
-
],
|
|
6981
|
+
], f = {
|
|
6990
6982
|
className: "title",
|
|
6991
6983
|
begin: e.optional(r) + n.IDENT_RE,
|
|
6992
6984
|
relevance: 0
|
|
6993
|
-
},
|
|
6985
|
+
}, v = e.optional(r) + n.IDENT_RE + "\\s*\\(", S = 12, C = {
|
|
6994
6986
|
keyword: [
|
|
6995
6987
|
"asm",
|
|
6996
6988
|
"auto",
|
|
@@ -7099,35 +7091,35 @@ function Ni(n) {
|
|
|
7099
7091
|
end: /;/
|
|
7100
7092
|
}
|
|
7101
7093
|
],
|
|
7102
|
-
keywords:
|
|
7094
|
+
keywords: C,
|
|
7103
7095
|
contains: I.concat([
|
|
7104
7096
|
{
|
|
7105
7097
|
begin: /\(/,
|
|
7106
7098
|
end: /\)/,
|
|
7107
|
-
keywords:
|
|
7099
|
+
keywords: C,
|
|
7108
7100
|
contains: I.concat(["self"]),
|
|
7109
7101
|
relevance: 0
|
|
7110
7102
|
}
|
|
7111
7103
|
]),
|
|
7112
7104
|
relevance: 0
|
|
7113
7105
|
}, B = {
|
|
7114
|
-
begin: "(" + s + "[\\*&\\s]+){1," +
|
|
7106
|
+
begin: "(" + s + "[\\*&\\s]+){1," + S + "}" + v,
|
|
7115
7107
|
returnBegin: !0,
|
|
7116
7108
|
end: /[{;=]/,
|
|
7117
7109
|
excludeEnd: !0,
|
|
7118
|
-
keywords:
|
|
7110
|
+
keywords: C,
|
|
7119
7111
|
illegal: /[^\w\s\*&:<>.]/,
|
|
7120
7112
|
contains: [
|
|
7121
7113
|
{
|
|
7122
7114
|
// to prevent it from being confused as the function title
|
|
7123
7115
|
begin: i,
|
|
7124
|
-
keywords:
|
|
7116
|
+
keywords: C,
|
|
7125
7117
|
relevance: 0
|
|
7126
7118
|
},
|
|
7127
7119
|
{
|
|
7128
|
-
begin:
|
|
7120
|
+
begin: v,
|
|
7129
7121
|
returnBegin: !0,
|
|
7130
|
-
contains: [n.inherit(
|
|
7122
|
+
contains: [n.inherit(f, { className: "title.function" })],
|
|
7131
7123
|
relevance: 0
|
|
7132
7124
|
},
|
|
7133
7125
|
// allow for multiple declarations, e.g.:
|
|
@@ -7140,7 +7132,7 @@ function Ni(n) {
|
|
|
7140
7132
|
className: "params",
|
|
7141
7133
|
begin: /\(/,
|
|
7142
7134
|
end: /\)/,
|
|
7143
|
-
keywords:
|
|
7135
|
+
keywords: C,
|
|
7144
7136
|
relevance: 0,
|
|
7145
7137
|
contains: [
|
|
7146
7138
|
t,
|
|
@@ -7152,7 +7144,7 @@ function Ni(n) {
|
|
|
7152
7144
|
{
|
|
7153
7145
|
begin: /\(/,
|
|
7154
7146
|
end: /\)/,
|
|
7155
|
-
keywords:
|
|
7147
|
+
keywords: C,
|
|
7156
7148
|
relevance: 0,
|
|
7157
7149
|
contains: [
|
|
7158
7150
|
"self",
|
|
@@ -7174,7 +7166,7 @@ function Ni(n) {
|
|
|
7174
7166
|
return {
|
|
7175
7167
|
name: "C",
|
|
7176
7168
|
aliases: ["h"],
|
|
7177
|
-
keywords:
|
|
7169
|
+
keywords: C,
|
|
7178
7170
|
// Until differentiations are added between `c` and `cpp`, `c` will
|
|
7179
7171
|
// not be auto-detected to avoid auto-detect conflicts between C and C++
|
|
7180
7172
|
disableAutodetect: !0,
|
|
@@ -7187,7 +7179,7 @@ function Ni(n) {
|
|
|
7187
7179
|
...y,
|
|
7188
7180
|
{
|
|
7189
7181
|
begin: n.IDENT_RE + "::",
|
|
7190
|
-
keywords:
|
|
7182
|
+
keywords: C
|
|
7191
7183
|
},
|
|
7192
7184
|
{
|
|
7193
7185
|
className: "class",
|
|
@@ -7203,7 +7195,7 @@ function Ni(n) {
|
|
|
7203
7195
|
exports: {
|
|
7204
7196
|
preprocessor: m,
|
|
7205
7197
|
strings: d,
|
|
7206
|
-
keywords:
|
|
7198
|
+
keywords: C
|
|
7207
7199
|
}
|
|
7208
7200
|
};
|
|
7209
7201
|
}
|
|
@@ -7288,7 +7280,7 @@ function Ot(n) {
|
|
|
7288
7280
|
className: "title",
|
|
7289
7281
|
begin: e.optional(r) + n.IDENT_RE,
|
|
7290
7282
|
relevance: 0
|
|
7291
|
-
},
|
|
7283
|
+
}, f = e.optional(r) + n.IDENT_RE + "\\s*\\(", v = 12, S = [
|
|
7292
7284
|
"alignas",
|
|
7293
7285
|
"alignof",
|
|
7294
7286
|
"and",
|
|
@@ -7451,7 +7443,7 @@ function Ot(n) {
|
|
|
7451
7443
|
"weak_ptr",
|
|
7452
7444
|
"wstring",
|
|
7453
7445
|
"wstring_view"
|
|
7454
|
-
],
|
|
7446
|
+
], C = [
|
|
7455
7447
|
"abort",
|
|
7456
7448
|
"abs",
|
|
7457
7449
|
"acos",
|
|
@@ -7554,7 +7546,7 @@ function Ot(n) {
|
|
|
7554
7546
|
"vsprintf"
|
|
7555
7547
|
], B = {
|
|
7556
7548
|
type: O,
|
|
7557
|
-
keyword:
|
|
7549
|
+
keyword: S,
|
|
7558
7550
|
literal: [
|
|
7559
7551
|
"NULL",
|
|
7560
7552
|
"false",
|
|
@@ -7569,15 +7561,15 @@ function Ot(n) {
|
|
|
7569
7561
|
relevance: 0,
|
|
7570
7562
|
keywords: {
|
|
7571
7563
|
// Only for relevance, not highlighting.
|
|
7572
|
-
_hint:
|
|
7564
|
+
_hint: C
|
|
7573
7565
|
},
|
|
7574
7566
|
begin: e.concat(
|
|
7575
7567
|
/\b/,
|
|
7576
|
-
`(?!${
|
|
7568
|
+
`(?!${S.join("|")})`,
|
|
7577
7569
|
n.IDENT_RE,
|
|
7578
7570
|
e.lookahead(/(<[^<>]+>|)\s*\(/)
|
|
7579
7571
|
)
|
|
7580
|
-
},
|
|
7572
|
+
}, H = [
|
|
7581
7573
|
$,
|
|
7582
7574
|
...m,
|
|
7583
7575
|
o,
|
|
@@ -7585,7 +7577,7 @@ function Ot(n) {
|
|
|
7585
7577
|
n.C_BLOCK_COMMENT_MODE,
|
|
7586
7578
|
d,
|
|
7587
7579
|
l
|
|
7588
|
-
],
|
|
7580
|
+
], V = {
|
|
7589
7581
|
// This mode covers expression context where we can't expect a function
|
|
7590
7582
|
// definition and shouldn't highlight anything that looks like one:
|
|
7591
7583
|
// `return some()`, `else if()`, `(x*sum(1, 2))`
|
|
@@ -7604,19 +7596,19 @@ function Ot(n) {
|
|
|
7604
7596
|
}
|
|
7605
7597
|
],
|
|
7606
7598
|
keywords: B,
|
|
7607
|
-
contains:
|
|
7599
|
+
contains: H.concat([
|
|
7608
7600
|
{
|
|
7609
7601
|
begin: /\(/,
|
|
7610
7602
|
end: /\)/,
|
|
7611
7603
|
keywords: B,
|
|
7612
|
-
contains:
|
|
7604
|
+
contains: H.concat(["self"]),
|
|
7613
7605
|
relevance: 0
|
|
7614
7606
|
}
|
|
7615
7607
|
]),
|
|
7616
7608
|
relevance: 0
|
|
7617
7609
|
}, J = {
|
|
7618
7610
|
className: "function",
|
|
7619
|
-
begin: "(" + s + "[\\*&\\s]+){1," +
|
|
7611
|
+
begin: "(" + s + "[\\*&\\s]+){1," + v + "}" + f,
|
|
7620
7612
|
returnBegin: !0,
|
|
7621
7613
|
end: /[{;=]/,
|
|
7622
7614
|
excludeEnd: !0,
|
|
@@ -7630,7 +7622,7 @@ function Ot(n) {
|
|
|
7630
7622
|
relevance: 0
|
|
7631
7623
|
},
|
|
7632
7624
|
{
|
|
7633
|
-
begin:
|
|
7625
|
+
begin: f,
|
|
7634
7626
|
returnBegin: !0,
|
|
7635
7627
|
contains: [y],
|
|
7636
7628
|
relevance: 0
|
|
@@ -7706,10 +7698,10 @@ function Ot(n) {
|
|
|
7706
7698
|
illegal: "</",
|
|
7707
7699
|
classNameAliases: { "function.dispatch": "built_in" },
|
|
7708
7700
|
contains: [].concat(
|
|
7709
|
-
|
|
7701
|
+
V,
|
|
7710
7702
|
J,
|
|
7711
7703
|
$,
|
|
7712
|
-
|
|
7704
|
+
H,
|
|
7713
7705
|
[
|
|
7714
7706
|
...m,
|
|
7715
7707
|
{
|
|
@@ -7742,32 +7734,32 @@ function Ot(n) {
|
|
|
7742
7734
|
)
|
|
7743
7735
|
};
|
|
7744
7736
|
}
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7737
|
+
A.registerLanguage("javascript", _t);
|
|
7738
|
+
A.registerLanguage("js", _t);
|
|
7739
|
+
A.registerLanguage("typescript", St);
|
|
7740
|
+
A.registerLanguage("ts", St);
|
|
7741
|
+
A.registerLanguage("python", At);
|
|
7742
|
+
A.registerLanguage("py", At);
|
|
7743
|
+
A.registerLanguage("json", ui);
|
|
7744
|
+
A.registerLanguage("bash", Me);
|
|
7745
|
+
A.registerLanguage("sh", Me);
|
|
7746
|
+
A.registerLanguage("shell", Me);
|
|
7747
|
+
A.registerLanguage("css", yi);
|
|
7748
|
+
A.registerLanguage("xml", Re);
|
|
7749
|
+
A.registerLanguage("html", Re);
|
|
7750
|
+
A.registerLanguage("svg", Re);
|
|
7751
|
+
A.registerLanguage("sql", wi);
|
|
7752
|
+
A.registerLanguage("yaml", xt);
|
|
7753
|
+
A.registerLanguage("yml", xt);
|
|
7754
|
+
A.registerLanguage("markdown", Ct);
|
|
7755
|
+
A.registerLanguage("md", Ct);
|
|
7756
|
+
A.registerLanguage("go", vi);
|
|
7757
|
+
A.registerLanguage("rust", Mt);
|
|
7758
|
+
A.registerLanguage("rs", Mt);
|
|
7759
|
+
A.registerLanguage("java", ki);
|
|
7760
|
+
A.registerLanguage("c", Ni);
|
|
7761
|
+
A.registerLanguage("cpp", Ot);
|
|
7762
|
+
A.registerLanguage("c++", Ot);
|
|
7771
7763
|
const Ti = /* @__PURE__ */ new Set(["mindmap"]);
|
|
7772
7764
|
function le(n) {
|
|
7773
7765
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -7775,17 +7767,17 @@ function le(n) {
|
|
|
7775
7767
|
function Si(n, e = {}) {
|
|
7776
7768
|
const t = new Set(e.reservedLanguages ?? Ti), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (r, a, s, o, c) => c.renderToken(r, a, s);
|
|
7777
7769
|
n.renderer.rules.fence = (r, a, s, o, c) => {
|
|
7778
|
-
var
|
|
7770
|
+
var f;
|
|
7779
7771
|
const l = r[a];
|
|
7780
7772
|
if (!l) return i(r, a, s, o, c);
|
|
7781
|
-
const h = ((
|
|
7773
|
+
const h = ((f = l.info.trim().split(/\s+/)[0]) == null ? void 0 : f.toLowerCase()) ?? "";
|
|
7782
7774
|
if (t.has(h))
|
|
7783
7775
|
return i(r, a, s, o, c);
|
|
7784
7776
|
const p = l.content;
|
|
7785
7777
|
let m, y = h || "text";
|
|
7786
|
-
if (h &&
|
|
7778
|
+
if (h && A.getLanguage(h))
|
|
7787
7779
|
try {
|
|
7788
|
-
m =
|
|
7780
|
+
m = A.highlight(p, {
|
|
7789
7781
|
language: h,
|
|
7790
7782
|
ignoreIllegals: !0
|
|
7791
7783
|
}).value;
|
|
@@ -7794,15 +7786,15 @@ function Si(n, e = {}) {
|
|
|
7794
7786
|
}
|
|
7795
7787
|
else if (h)
|
|
7796
7788
|
try {
|
|
7797
|
-
const
|
|
7798
|
-
m =
|
|
7789
|
+
const v = A.highlightAuto(p);
|
|
7790
|
+
m = v.value, y = v.language || h;
|
|
7799
7791
|
} catch {
|
|
7800
7792
|
m = le(p);
|
|
7801
7793
|
}
|
|
7802
7794
|
else
|
|
7803
7795
|
try {
|
|
7804
|
-
const
|
|
7805
|
-
m =
|
|
7796
|
+
const v = A.highlightAuto(p);
|
|
7797
|
+
m = v.value, y = v.language || "text";
|
|
7806
7798
|
} catch {
|
|
7807
7799
|
m = le(p);
|
|
7808
7800
|
}
|
|
@@ -7900,7 +7892,7 @@ function $i(n) {
|
|
|
7900
7892
|
function Ui(n) {
|
|
7901
7893
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7902
7894
|
}
|
|
7903
|
-
function
|
|
7895
|
+
function Hi(n) {
|
|
7904
7896
|
const e = n.renderer.rules.list_item_open;
|
|
7905
7897
|
n.renderer.rules.list_item_open = (t, i, r, a, s) => {
|
|
7906
7898
|
var l, d;
|
|
@@ -7916,15 +7908,16 @@ function Fi(n) {
|
|
|
7916
7908
|
if (((d = t[h]) == null ? void 0 : d.type) === "list_item_close") break;
|
|
7917
7909
|
}
|
|
7918
7910
|
if (c && c.content) {
|
|
7919
|
-
const h = c.content, p = /^\[\s
|
|
7911
|
+
const h = c.content, p = /^\[\s*\]\s/.test(h), m = /^\[\s*[xX]\s*\]\s/.test(h);
|
|
7920
7912
|
if (p || m) {
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7913
|
+
const y = /^\[\s*(?:[xX])?\s*\]\s/;
|
|
7914
|
+
if (c.content = h.replace(y, ""), c.children && c.children.length > 0) {
|
|
7915
|
+
const S = c.children[0];
|
|
7916
|
+
S && S.type === "text" && (S.content = S.content.replace(y, ""));
|
|
7924
7917
|
}
|
|
7925
7918
|
o.attrSet("class", "task-list-item");
|
|
7926
|
-
const
|
|
7927
|
-
return (e ? e(t, i, r, a, s) : s.renderToken(t, i, r)) +
|
|
7919
|
+
const f = `<input type="checkbox" disabled${p ? " checked" : ""} /> `;
|
|
7920
|
+
return (e ? e(t, i, r, a, s) : s.renderToken(t, i, r)) + f;
|
|
7928
7921
|
}
|
|
7929
7922
|
}
|
|
7930
7923
|
return e ? e(t, i, r, a, s) : s.renderToken(t, i, r);
|
|
@@ -7939,7 +7932,7 @@ class It {
|
|
|
7939
7932
|
typographer: !0
|
|
7940
7933
|
}), e.math !== !1 && sn(this.md), this.mindmapEnabled = e.mindmap !== !1, this.mindmapEnabled && on(this.md), e.codeHighlight !== !1 && Si(this.md, {
|
|
7941
7934
|
reservedLanguages: this.mindmapEnabled ? ["mindmap"] : []
|
|
7942
|
-
}), e.tips !== !1 && $i(this.md),
|
|
7935
|
+
}), e.tips !== !1 && $i(this.md), Hi(this.md), en(this.md), Ii(this.md);
|
|
7943
7936
|
}
|
|
7944
7937
|
render(e) {
|
|
7945
7938
|
return this.md.render(e || "");
|
|
@@ -7955,7 +7948,7 @@ class It {
|
|
|
7955
7948
|
function or(n, e = {}) {
|
|
7956
7949
|
return new It(e).render(n);
|
|
7957
7950
|
}
|
|
7958
|
-
class
|
|
7951
|
+
class Fi {
|
|
7959
7952
|
constructor(e) {
|
|
7960
7953
|
this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
|
|
7961
7954
|
for (const t of e) {
|
|
@@ -8068,7 +8061,7 @@ class Zi {
|
|
|
8068
8061
|
this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
|
|
8069
8062
|
}
|
|
8070
8063
|
}
|
|
8071
|
-
function
|
|
8064
|
+
function Vi(n, e) {
|
|
8072
8065
|
let t, i;
|
|
8073
8066
|
const r = (...a) => {
|
|
8074
8067
|
i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
@@ -8081,7 +8074,7 @@ function Xi(n, e) {
|
|
|
8081
8074
|
t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
|
|
8082
8075
|
}, r;
|
|
8083
8076
|
}
|
|
8084
|
-
function
|
|
8077
|
+
function Xi(n, e = 120, t = 600) {
|
|
8085
8078
|
const i = Math.max(0, n), r = Math.floor(i / 2e4) * 60;
|
|
8086
8079
|
return Math.min(t, e + r);
|
|
8087
8080
|
}
|
|
@@ -8408,7 +8401,7 @@ class ur {
|
|
|
8408
8401
|
"Toggle theme",
|
|
8409
8402
|
this.theme === "dark" ? R.sun : R.moon,
|
|
8410
8403
|
() => this.setTheme(this.theme === "dark" ? "light" : "dark")
|
|
8411
|
-
), this.toolbar = new
|
|
8404
|
+
), this.toolbar = new Fi(e), this.container.insertBefore(this.toolbar.el, this.body);
|
|
8412
8405
|
}
|
|
8413
8406
|
buildStatusBar() {
|
|
8414
8407
|
this.statusBar = new zi({
|
|
@@ -8676,12 +8669,12 @@ Your ${c.key.toLowerCase()} content here.
|
|
|
8676
8669
|
// ---------- Render scheduling (performance core) ----------
|
|
8677
8670
|
requestPreviewRender(e) {
|
|
8678
8671
|
var i, r;
|
|
8679
|
-
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ??
|
|
8672
|
+
const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? Xi(e.length);
|
|
8680
8673
|
if (t === 0) {
|
|
8681
8674
|
(i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
|
|
8682
8675
|
return;
|
|
8683
8676
|
}
|
|
8684
|
-
(!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender =
|
|
8677
|
+
(!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender = Vi((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
|
|
8685
8678
|
}
|
|
8686
8679
|
renderPreview(e) {
|
|
8687
8680
|
if (!this.previewPane || !this.incremental) return;
|
|
@@ -8751,11 +8744,11 @@ export {
|
|
|
8751
8744
|
ie as Popup,
|
|
8752
8745
|
It as Renderer,
|
|
8753
8746
|
zi as StatusBar,
|
|
8754
|
-
|
|
8755
|
-
|
|
8747
|
+
Fi as Toolbar,
|
|
8748
|
+
Xi as adaptiveDebounceMs,
|
|
8756
8749
|
cr as cancelIdle,
|
|
8757
8750
|
tt as countText,
|
|
8758
|
-
|
|
8751
|
+
Vi as debounce,
|
|
8759
8752
|
Ci as extractYouTubeId,
|
|
8760
8753
|
dr as formatShortcut,
|
|
8761
8754
|
Ji as formatShortcutHtml,
|