Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

1202 lines
38 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 939e07c76f4b30f0.294c1bf0d6.js
* Module id: 22541
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e, t, i) => {
function r(e) {
return (
e instanceof Map
? (e.clear =
e.delete =
e.set =
function () {
throw Error("map is read-only");
})
: e instanceof Set &&
(e.add =
e.clear =
e.delete =
function () {
throw Error("set is read-only");
}),
Object.freeze(e),
Object.getOwnPropertyNames(e).forEach(function (t) {
var i = e[t];
"object" != typeof i || Object.isFrozen(i) || r(i);
}),
e
);
}
r.default = r;
class a {
constructor(e) {
void 0 === e.data && (e.data = {}),
(this.data = e.data),
(this.isMatchIgnored = !1);
}
ignoreMatch() {
this.isMatchIgnored = !0;
}
}
function n(e) {
return e
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#x27;");
}
function A(e, ...t) {
let i = Object.create(null);
for (let t in e) i[t] = e[t];
return (
t.forEach(function (e) {
for (let t in e) i[t] = e[t];
}),
i
);
}
class s {
constructor(e, t) {
(this.buffer = ""), (this.classPrefix = t.classPrefix), e.walk(this);
}
addText(e) {
this.buffer += n(e);
}
openNode(e) {
if (!e.kind) return;
let t = e.kind;
e.sublanguage || (t = `${this.classPrefix}${t}`), this.span(t);
}
closeNode(e) {
e.kind && (this.buffer += "</span>");
}
value() {
return this.buffer;
}
span(e) {
this.buffer += `<span class="${e}">`;
}
}
class o {
constructor() {
(this.rootNode = { children: [] }), (this.stack = [this.rootNode]);
}
get top() {
return this.stack[this.stack.length - 1];
}
get root() {
return this.rootNode;
}
add(e) {
this.top.children.push(e);
}
openNode(e) {
let t = { kind: e, children: [] };
this.add(t), this.stack.push(t);
}
closeNode() {
if (this.stack.length > 1) return this.stack.pop();
}
closeAllNodes() {
for (; this.closeNode(); );
}
toJSON() {
return JSON.stringify(this.rootNode, null, 4);
}
walk(e) {
return this.constructor._walk(e, this.rootNode);
}
static _walk(e, t) {
return (
"string" == typeof t
? e.addText(t)
: t.children &&
(e.openNode(t),
t.children.forEach((t) => this._walk(e, t)),
e.closeNode(t)),
e
);
}
static _collapse(e) {
"string" == typeof e ||
(e.children &&
(e.children.every((e) => "string" == typeof e)
? (e.children = [e.children.join("")])
: e.children.forEach((e) => {
o._collapse(e);
})));
}
}
class l extends o {
constructor(e) {
super(), (this.options = e);
}
addKeyword(e, t) {
"" !== e && (this.openNode(t), this.addText(e), this.closeNode());
}
addText(e) {
"" !== e && this.add(e);
}
addSublanguage(e, t) {
let i = e.root;
(i.kind = t), (i.sublanguage = !0), this.add(i);
}
toHTML() {
return new s(this, this.options).value();
}
finalize() {
return !0;
}
}
function c(e) {
return e ? ("string" == typeof e ? e : e.source) : null;
}
let d = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./,
u = "[a-zA-Z]\\w*",
g = "[a-zA-Z_]\\w*",
p = "\\b\\d+(\\.\\d+)?",
h =
"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",
m = "\\b(0b[01]+)",
I = { begin: "\\\\[\\s\\S]", relevance: 0 },
f = {
begin:
/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/,
},
C = function (e, t, i = {}) {
let r = A({ className: "comment", begin: e, end: t, contains: [] }, i);
return (
r.contains.push(f),
r.contains.push({
className: "doctag",
begin: "(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):",
relevance: 0,
}),
r
);
},
E = C("//", "$"),
B = C("/\\*", "\\*/"),
b = C("#", "$"),
y = {
begin: /(?=\/[^/\n]*\/)/,
contains: [
{
className: "regexp",
begin: /\//,
end: /\/[gimuy]*/,
illegal: /\n/,
contains: [
I,
{ begin: /\[/, end: /\]/, relevance: 0, contains: [I] },
],
},
],
};
var w = Object.freeze({
__proto__: null,
MATCH_NOTHING_RE: /\b\B/,
IDENT_RE: u,
UNDERSCORE_IDENT_RE: g,
NUMBER_RE: p,
C_NUMBER_RE: h,
BINARY_NUMBER_RE: m,
RE_STARTERS_RE:
"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",
SHEBANG: (e = {}) => {
let t = /^#![ ]*\//;
return (
e.binary &&
(e.begin = (function (...e) {
return e.map((e) => c(e)).join("");
})(t, /.*\b/, e.binary, /\b.*/)),
A(
{
className: "meta",
begin: t,
end: /$/,
relevance: 0,
"on:begin": (e, t) => {
0 !== e.index && t.ignoreMatch();
},
},
e,
)
);
},
BACKSLASH_ESCAPE: I,
APOS_STRING_MODE: {
className: "string",
begin: "'",
end: "'",
illegal: "\\n",
contains: [I],
},
QUOTE_STRING_MODE: {
className: "string",
begin: '"',
end: '"',
illegal: "\\n",
contains: [I],
},
PHRASAL_WORDS_MODE: f,
COMMENT: C,
C_LINE_COMMENT_MODE: E,
C_BLOCK_COMMENT_MODE: B,
HASH_COMMENT_MODE: b,
NUMBER_MODE: { className: "number", begin: p, relevance: 0 },
C_NUMBER_MODE: { className: "number", begin: h, relevance: 0 },
BINARY_NUMBER_MODE: { className: "number", begin: m, relevance: 0 },
CSS_NUMBER_MODE: {
className: "number",
begin:
p +
"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",
relevance: 0,
},
REGEXP_MODE: y,
TITLE_MODE: { className: "title", begin: u, relevance: 0 },
UNDERSCORE_TITLE_MODE: { className: "title", begin: g, relevance: 0 },
METHOD_GUARD: { begin: "\\.\\s*" + g, relevance: 0 },
END_SAME_AS_BEGIN: function (e) {
return Object.assign(e, {
"on:begin": (e, t) => {
t.data._beginMatch = e[1];
},
"on:end": (e, t) => {
t.data._beginMatch !== e[1] && t.ignoreMatch();
},
});
},
});
function Q(e, t) {
"." === e.input[e.index - 1] && t.ignoreMatch();
}
function S(e, t) {
!t ||
(e.beginKeywords &&
((e.begin =
"\\b(" +
e.beginKeywords.split(" ").join("|") +
")(?!\\.)(?=\\b|\\s)"),
(e.__beforeBegin = Q),
(e.keywords = e.keywords || e.beginKeywords),
delete e.beginKeywords,
void 0 === e.relevance && (e.relevance = 0)));
}
function k(e, t) {
Array.isArray(e.illegal) &&
(e.illegal = (function (...e) {
return "(" + e.map((e) => c(e)).join("|") + ")";
})(...e.illegal));
}
function v(e, t) {
if (e.match) {
if (e.begin || e.end)
throw Error("begin & end are not supported with match");
(e.begin = e.match), delete e.match;
}
}
function x(e, t) {
void 0 === e.relevance && (e.relevance = 1);
}
let D = [
"of",
"and",
"for",
"in",
"not",
"or",
"if",
"then",
"parent",
"list",
"value",
],
T = {
"after:highlightElement": ({ el: e, result: t, text: i }) => {
let r = R(e);
if (!r.length) return;
let a = document.createElement("div");
(a.innerHTML = t.value),
(t.value = (function (e, t, i) {
let r = 0,
a = "",
A = [];
function s() {
return e.length && t.length
? e[0].offset !== t[0].offset
? e[0].offset < t[0].offset
? e
: t
: "start" === t[0].event
? e
: t
: e.length
? e
: t;
}
function o(e) {
a +=
"<" +
N(e) +
[].map
.call(e.attributes, function (e) {
return " " + e.nodeName + '="' + n(e.value) + '"';
})
.join("") +
">";
}
function l(e) {
a += "</" + N(e) + ">";
}
function c(e) {
("start" === e.event ? o : l)(e.node);
}
for (; e.length || t.length; ) {
let t = s();
if (
((a += n(i.substring(r, t[0].offset))),
(r = t[0].offset),
t === e)
) {
A.reverse().forEach(l);
do c(t.splice(0, 1)[0]), (t = s());
while (t === e && t.length && t[0].offset === r);
A.reverse().forEach(o);
} else
"start" === t[0].event ? A.push(t[0].node) : A.pop(),
c(t.splice(0, 1)[0]);
}
return a + n(i.substr(r));
})(r, R(a), i));
},
};
function N(e) {
return e.nodeName.toLowerCase();
}
function R(e) {
let t = [];
return (
!(function e(i, r) {
for (let a = i.firstChild; a; a = a.nextSibling)
3 === a.nodeType
? (r += a.nodeValue.length)
: 1 === a.nodeType &&
(t.push({ event: "start", offset: r, node: a }),
(r = e(a, r)),
N(a).match(/br|hr|img|input/) ||
t.push({ event: "stop", offset: r, node: a }));
return r;
})(e, 0),
t
);
}
let M = {},
P = (e) => {
console.error(e);
},
L = (e, ...t) => {
console.log(`WARN: ${e}`, ...t);
},
F = (e, t) => {
M[`${e}/${t}`] ||
(console.log(`Deprecated as of ${e}. ${t}`), (M[`${e}/${t}`] = !0));
},
U = Symbol("nomatch");
t.exports = (function (e) {
var t;
let i,
s = Object.create(null),
o = Object.create(null),
u = [],
g = !0,
p = /(^(<[^>]+>|\t|)+|\n)/gm,
h =
"Could not find the language '{}', did you forget to load/include a language module?",
m = { disableAutodetect: !0, name: "Plain text", contains: [] },
I = {
noHighlightRe: /^(no-?highlight)$/i,
languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
classPrefix: "hljs-",
tabReplace: null,
useBR: !1,
languages: null,
__emitter: l,
};
function f(e) {
return I.noHighlightRe.test(e);
}
function C(e, t, i, r) {
let a = "",
n = "";
"object" == typeof t
? ((a = e), (i = t.ignoreIllegals), (n = t.language), (r = void 0))
: (F("10.7.0", "highlight(lang, code, ...args) has been deprecated."),
F(
"10.7.0",
"Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277",
),
(n = e),
(a = t));
let A = { code: a, language: n };
G("before:highlight", A);
let s = A.result ? A.result : E(A.language, A.code, i, r);
return (s.code = A.code), G("after:highlight", s), s;
}
function E(e, t, i, r) {
function o() {
null != y.subLanguage
? (function () {
if ("" === N) return;
let e = null;
if ("string" == typeof y.subLanguage) {
if (!s[y.subLanguage]) return Q.addText(N);
(e = E(y.subLanguage, N, !0, w[y.subLanguage])),
(w[y.subLanguage] = e.top);
} else e = B(N, y.subLanguage.length ? y.subLanguage : null);
y.relevance > 0 && (R += e.relevance),
Q.addSublanguage(e.emitter, e.language);
})()
: (function () {
if (!y.keywords) return Q.addText(N);
let e = 0;
y.keywordPatternRe.lastIndex = 0;
let t = y.keywordPatternRe.exec(N),
i = "";
for (; t; ) {
i += N.substring(e, t.index);
let r = (function (e, t) {
let i = f.case_insensitive ? t[0].toLowerCase() : t[0];
return (
Object.prototype.hasOwnProperty.call(e.keywords, i) &&
e.keywords[i]
);
})(y, t);
if (r) {
let [e, a] = r;
if ((Q.addText(i), (i = ""), (R += a), e.startsWith("_")))
i += t[0];
else {
let i = f.classNameAliases[e] || e;
Q.addKeyword(t[0], i);
}
} else i += t[0];
(e = y.keywordPatternRe.lastIndex),
(t = y.keywordPatternRe.exec(N));
}
(i += N.substr(e)), Q.addText(i);
})(),
(N = "");
}
function l(e) {
return (
e.className &&
Q.openNode(f.classNameAliases[e.className] || e.className),
(y = Object.create(e, { parent: { value: y } }))
);
}
let p = {};
function m(r, n) {
let A = n && n[0];
if (((N += r), null == A)) return o(), 0;
if (
"begin" === p.type &&
"end" === n.type &&
p.index === n.index &&
"" === A
) {
if (((N += t.slice(n.index, n.index + 1)), !g)) {
let t = Error("0 width match regex");
throw ((t.languageName = e), (t.badRule = p.rule), t);
}
return 1;
}
if (((p = n), "begin" === n.type)) {
let e = n[0],
t = n.rule,
i = new a(t);
for (let r of [t.__beforeBegin, t["on:begin"]])
if (r && (r(n, i), i.isMatchIgnored))
return 0 === y.matcher.regexIndex
? ((N += e[0]), 1)
: ((O = !0), 0);
return (
t &&
t.endSameAsBegin &&
(t.endRe = RegExp(
e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"),
"m",
)),
t.skip
? (N += e)
: (t.excludeBegin && (N += e),
o(),
t.returnBegin || t.excludeBegin || (N = e)),
l(t),
t.returnBegin ? 0 : e.length
);
}
if ("illegal" !== n.type || i) {
if ("end" === n.type) {
let e = (function (e) {
let i = e[0],
r = t.substr(e.index),
n = (function e(t, i, r) {
var n;
let A,
s =
((n = t.endRe), (A = n && n.exec(r)) && 0 === A.index);
if (s) {
if (t["on:end"]) {
let e = new a(t);
t["on:end"](i, e), e.isMatchIgnored && (s = !1);
}
if (s) {
for (; t.endsParent && t.parent; ) t = t.parent;
return t;
}
}
if (t.endsWithParent) return e(t.parent, i, r);
})(y, e, r);
if (!n) return U;
let A = y;
A.skip
? (N += i)
: (A.returnEnd || A.excludeEnd || (N += i),
o(),
A.excludeEnd && (N = i));
do
y.className && Q.closeNode(),
y.skip || y.subLanguage || (R += y.relevance),
(y = y.parent);
while (y !== n.parent);
return (
n.starts &&
(n.endSameAsBegin && (n.starts.endRe = n.endRe),
l(n.starts)),
A.returnEnd ? 0 : i.length
);
})(n);
if (e !== U) return e;
}
} else {
let e = Error(
'Illegal lexeme "' +
A +
'" for mode "' +
(y.className || "<unnamed>") +
'"',
);
throw ((e.mode = y), e);
}
if ("illegal" === n.type && "" === A) return 1;
if (F > 1e5 && F > 3 * n.index)
throw Error(
"potential infinite loop, way more iterations than matches",
);
return (N += A), A.length;
}
let f = M(e);
if (!f)
throw (P(h.replace("{}", e)), Error('Unknown language: "' + e + '"'));
let C = (function (e, { plugins: t }) {
function i(t, i) {
return RegExp(
c(t),
"m" + (e.case_insensitive ? "i" : "") + (i ? "g" : ""),
);
}
class r {
constructor() {
(this.matchIndexes = {}),
(this.regexes = []),
(this.matchAt = 1),
(this.position = 0);
}
addRule(e, t) {
(t.position = this.position++),
(this.matchIndexes[this.matchAt] = t),
this.regexes.push([t, e]),
(this.matchAt +=
RegExp(e.toString() + "|").exec("").length - 1 + 1);
}
compile() {
0 === this.regexes.length && (this.exec = () => null);
let e = this.regexes.map((e) => e[1]);
(this.matcherRe = i(
(function (e, t = "|") {
let i = 0;
return e
.map((e) => {
let t = (i += 1),
r = c(e),
a = "";
for (; r.length > 0; ) {
let e = d.exec(r);
if (!e) {
a += r;
break;
}
(a += r.substring(0, e.index)),
(r = r.substring(e.index + e[0].length)),
"\\" === e[0][0] && e[1]
? (a += "\\" + String(Number(e[1]) + t))
: ((a += e[0]), "(" === e[0] && i++);
}
return a;
})
.map((e) => `(${e})`)
.join(t);
})(e),
!0,
)),
(this.lastIndex = 0);
}
exec(e) {
this.matcherRe.lastIndex = this.lastIndex;
let t = this.matcherRe.exec(e);
if (!t) return null;
let i = t.findIndex((e, t) => t > 0 && void 0 !== e),
r = this.matchIndexes[i];
return t.splice(0, i), Object.assign(t, r);
}
}
class a {
constructor() {
(this.rules = []),
(this.multiRegexes = []),
(this.count = 0),
(this.lastIndex = 0),
(this.regexIndex = 0);
}
getMatcher(e) {
if (this.multiRegexes[e]) return this.multiRegexes[e];
let t = new r();
return (
this.rules.slice(e).forEach(([e, i]) => t.addRule(e, i)),
t.compile(),
(this.multiRegexes[e] = t),
t
);
}
resumingScanAtSamePosition() {
return 0 !== this.regexIndex;
}
considerAll() {
this.regexIndex = 0;
}
addRule(e, t) {
this.rules.push([e, t]), "begin" === t.type && this.count++;
}
exec(e) {
let t = this.getMatcher(this.regexIndex);
t.lastIndex = this.lastIndex;
let i = t.exec(e);
if (this.resumingScanAtSamePosition())
if (i && i.index === this.lastIndex);
else {
let t = this.getMatcher(0);
(t.lastIndex = this.lastIndex + 1), (i = t.exec(e));
}
return (
i &&
((this.regexIndex += i.position + 1),
this.regexIndex === this.count && this.considerAll()),
i
);
}
}
if (
(e.compilerExtensions || (e.compilerExtensions = []),
e.contains && e.contains.includes("self"))
)
throw Error(
"ERR: contains `self` is not supported at the top-level of a language. See documentation.",
);
return (
(e.classNameAliases = A(e.classNameAliases || {})),
(function t(r, n) {
let s;
if (r.isCompiled) return r;
[v].forEach((e) => e(r, n)),
e.compilerExtensions.forEach((e) => e(r, n)),
(r.__beforeBegin = null),
[S, k, x].forEach((e) => e(r, n)),
(r.isCompiled = !0);
let o = null;
if (
("object" == typeof r.keywords &&
((o = r.keywords.$pattern), delete r.keywords.$pattern),
r.keywords &&
(r.keywords = (function e(t, i, r = "keyword") {
let a = {};
return (
"string" == typeof t
? n(r, t.split(" "))
: Array.isArray(t)
? n(r, t)
: Object.keys(t).forEach(function (r) {
Object.assign(a, e(t[r], i, r));
}),
a
);
function n(e, t) {
i && (t = t.map((e) => e.toLowerCase())),
t.forEach(function (t) {
var i, r, n;
let A = t.split("|");
a[A[0]] = [
e,
((i = A[0]),
(r = A[1])
? Number(r)
: +((n = i), !D.includes(n.toLowerCase()))),
];
});
}
})(r.keywords, e.case_insensitive)),
r.lexemes && o)
)
throw Error(
"ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ",
);
return (
(o = o || r.lexemes || /\w+/),
(r.keywordPatternRe = i(o, !0)),
n &&
(r.begin || (r.begin = /\B|\b/),
(r.beginRe = i(r.begin)),
r.endSameAsBegin && (r.end = r.begin),
r.end || r.endsWithParent || (r.end = /\B|\b/),
r.end && (r.endRe = i(r.end)),
(r.terminatorEnd = c(r.end) || ""),
r.endsWithParent &&
n.terminatorEnd &&
(r.terminatorEnd +=
(r.end ? "|" : "") + n.terminatorEnd)),
r.illegal && (r.illegalRe = i(r.illegal)),
r.contains || (r.contains = []),
(r.contains = [].concat(
...r.contains.map(function (e) {
var t;
return ((t = "self" === e ? r : e).variants &&
!t.cachedVariants &&
(t.cachedVariants = t.variants.map(function (e) {
return A(t, { variants: null }, e);
})),
t.cachedVariants)
? t.cachedVariants
: !(function e(t) {
return !!t && (t.endsWithParent || e(t.starts));
})(t)
? Object.isFrozen(t)
? A(t)
: t
: A(t, { starts: t.starts ? A(t.starts) : null });
}),
)),
r.contains.forEach(function (e) {
t(e, r);
}),
r.starts && t(r.starts, n),
(s = new a()),
r.contains.forEach((e) =>
s.addRule(e.begin, { rule: e, type: "begin" }),
),
r.terminatorEnd &&
s.addRule(r.terminatorEnd, { type: "end" }),
r.illegal && s.addRule(r.illegal, { type: "illegal" }),
(r.matcher = s),
r
);
})(e)
);
})(f, { plugins: u }),
b = "",
y = r || C,
w = {},
Q = new I.__emitter(I),
T = [];
for (let e = y; e !== f; e = e.parent)
e.className && T.unshift(e.className);
T.forEach((e) => Q.openNode(e));
let N = "",
R = 0,
L = 0,
F = 0,
O = !1;
try {
for (y.matcher.considerAll(); ; ) {
F++,
O ? (O = !1) : y.matcher.considerAll(),
(y.matcher.lastIndex = L);
let e = y.matcher.exec(t);
if (!e) break;
let i = t.substring(L, e.index),
r = m(i, e);
L = e.index + r;
}
return (
m(t.substr(L)),
Q.closeAllNodes(),
Q.finalize(),
(b = Q.toHTML()),
{
relevance: Math.floor(R),
value: b,
language: e,
illegal: !1,
emitter: Q,
top: y,
}
);
} catch (i) {
if (i.message && i.message.includes("Illegal"))
return {
illegal: !0,
illegalBy: {
msg: i.message,
context: t.slice(L - 100, L + 100),
mode: i.mode,
},
sofar: b,
relevance: 0,
value: n(t),
emitter: Q,
};
if (g)
return {
illegal: !1,
relevance: 0,
value: n(t),
emitter: Q,
language: e,
top: y,
errorRaised: i,
};
throw i;
}
}
function B(e, t) {
let i;
t = t || I.languages || Object.keys(s);
let r =
((i = {
relevance: 0,
emitter: new I.__emitter(I),
value: n(e),
illegal: !1,
top: m,
}).emitter.addText(e),
i),
a = t
.filter(M)
.filter(_)
.map((t) => E(t, e, !1));
a.unshift(r);
let [A, o] = a.sort((e, t) => {
if (e.relevance !== t.relevance) return t.relevance - e.relevance;
if (e.language && t.language) {
if (M(e.language).supersetOf === t.language) return 1;
else if (M(t.language).supersetOf === e.language) return -1;
}
return 0;
});
return (A.second_best = o), A;
}
let b = /^(<[^>]+>|\t)+/gm;
function y(e) {
var t;
let i,
r = (function (e) {
let t = e.className + " ";
t += e.parentNode ? e.parentNode.className : "";
let i = I.languageDetectRe.exec(t);
if (i) {
let t = M(i[1]);
return (
t ||
(L(h.replace("{}", i[1])),
L("Falling back to no-highlight mode for this block.", e)),
t ? i[1] : "no-highlight"
);
}
return t.split(/\s+/).find((e) => f(e) || M(e));
})(e);
if (f(r)) return;
G("before:highlightElement", { el: e, language: r });
let a = e.textContent,
n = r ? C(a, { language: r, ignoreIllegals: !0 }) : B(a);
G("after:highlightElement", { el: e, result: n, text: a }),
(e.innerHTML = n.value),
(t = n.language),
(i = r ? o[r] : t),
e.classList.add("hljs"),
i && e.classList.add(i),
(e.result = {
language: n.language,
re: n.relevance,
relavance: n.relevance,
}),
n.second_best &&
(e.second_best = {
language: n.second_best.language,
re: n.second_best.relevance,
relavance: n.second_best.relevance,
});
}
let Q = () => {
Q.called ||
((Q.called = !0),
F(
"10.6.0",
"initHighlighting() is deprecated. Use highlightAll() instead.",
),
document.querySelectorAll("pre code").forEach(y));
},
N = !1;
function R() {
if ("loading" === document.readyState) {
N = !0;
return;
}
document.querySelectorAll("pre code").forEach(y);
}
function M(e) {
return s[(e = (e || "").toLowerCase())] || s[o[e]];
}
function O(e, { languageName: t }) {
"string" == typeof e && (e = [e]),
e.forEach((e) => {
o[e.toLowerCase()] = t;
});
}
function _(e) {
let t = M(e);
return t && !t.disableAutodetect;
}
function G(e, t) {
u.forEach(function (i) {
i[e] && i[e](t);
});
}
for (let a in ("u" > typeof window &&
window.addEventListener &&
window.addEventListener(
"DOMContentLoaded",
function () {
N && R();
},
!1,
),
Object.assign(e, {
highlight: C,
highlightAuto: B,
highlightAll: R,
fixMarkup: function (e) {
var t;
return (
F("10.2.0", "fixMarkup will be removed entirely in v11.0"),
F(
"10.2.0",
"Please see https://github.com/highlightjs/highlight.js/issues/2534",
),
(t = e),
I.tabReplace || I.useBR
? t.replace(p, (e) =>
"\n" === e
? I.useBR
? "<br>"
: e
: I.tabReplace
? e.replace(/\t/g, I.tabReplace)
: e,
)
: t
);
},
highlightElement: y,
highlightBlock: function (e) {
return (
F("10.7.0", "highlightBlock will be removed entirely in v12.0"),
F("10.7.0", "Please use highlightElement now."),
y(e)
);
},
configure: function (e) {
e.useBR &&
(F("10.3.0", "'useBR' will be removed entirely in v11.0"),
F(
"10.3.0",
"Please see https://github.com/highlightjs/highlight.js/issues/2559",
)),
(I = A(I, e));
},
initHighlighting: Q,
initHighlightingOnLoad: function () {
F(
"10.6.0",
"initHighlightingOnLoad() is deprecated. Use highlightAll() instead.",
),
(N = !0);
},
registerLanguage: function (t, i) {
let r = null;
try {
r = i(e);
} catch (e) {
if (
(P(
"Language definition for '{}' could not be registered.".replace(
"{}",
t,
),
),
g)
)
P(e);
else throw e;
r = m;
}
r.name || (r.name = t),
(s[t] = r),
(r.rawDefinition = i.bind(null, e)),
r.aliases && O(r.aliases, { languageName: t });
},
unregisterLanguage: function (e) {
for (let t of (delete s[e], Object.keys(o)))
o[t] === e && delete o[t];
},
listLanguages: function () {
return Object.keys(s);
},
getLanguage: M,
registerAliases: O,
requireLanguage: function (e) {
F("10.4.0", "requireLanguage will be removed entirely in v11."),
F(
"10.4.0",
"Please see https://github.com/highlightjs/highlight.js/pull/2844",
);
let t = M(e);
if (t) return t;
throw Error(
"The '{}' language is required, but not loaded.".replace("{}", e),
);
},
autoDetection: _,
inherit: A,
addPlugin: function (e) {
var t;
(t = e)["before:highlightBlock"] &&
!t["before:highlightElement"] &&
(t["before:highlightElement"] = (e) => {
t["before:highlightBlock"](Object.assign({ block: e.el }, e));
}),
t["after:highlightBlock"] &&
!t["after:highlightElement"] &&
(t["after:highlightElement"] = (e) => {
t["after:highlightBlock"](Object.assign({ block: e.el }, e));
}),
u.push(e);
},
vuePlugin: ((t = e),
{
Component: (i = {
props: ["language", "code", "autodetect"],
data: function () {
return { detectedLanguage: "", unknownLanguage: !1 };
},
computed: {
className() {
return this.unknownLanguage
? ""
: "hljs " + this.detectedLanguage;
},
highlighted() {
if (!this.autoDetect && !t.getLanguage(this.language))
return (
console.warn(
`The language "${this.language}" you specified could not be found.`,
),
(this.unknownLanguage = !0),
n(this.code)
);
let e = {};
return (
this.autoDetect
? ((e = t.highlightAuto(this.code)),
(this.detectedLanguage = e.language))
: ((e = t.highlight(
this.language,
this.code,
this.ignoreIllegals,
)),
(this.detectedLanguage = this.language)),
e.value
);
},
autoDetect() {
var e;
return !this.language || !!((e = this.autodetect) || "" === e);
},
ignoreIllegals: () => !0,
},
render(e) {
return e("pre", {}, [
e("code", {
class: this.className,
domProps: { innerHTML: this.highlighted },
}),
]);
},
}),
VuePlugin: {
install(e) {
e.component("highlightjs", i);
},
},
}).VuePlugin,
}),
(e.debugMode = function () {
g = !1;
}),
(e.safeMode = function () {
g = !0;
}),
(e.versionString = "10.7.3"),
w))
"object" == typeof w[a] && r(w[a]);
return (
Object.assign(e, w),
e.addPlugin({
"before:highlightElement": ({ el: e }) => {
I.useBR &&
(e.innerHTML = e.innerHTML
.replace(/\n/g, "")
.replace(/<br[ /]*>/g, "\n"));
},
"after:highlightElement": ({ result: e }) => {
I.useBR && (e.value = e.value.replace(/\n/g, "<br>"));
},
}),
e.addPlugin(T),
e.addPlugin({
"after:highlightElement": ({ result: e }) => {
I.tabReplace &&
(e.value = e.value.replace(b, (e) =>
e.replace(/\t/g, I.tabReplace),
));
},
}),
e
);
})({});
};
export default moduleFactory;