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

131 lines
3.8 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 939e07c76f4b30f0.294c1bf0d6.js
* Module id: 911214
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e, t, i) => {
"use strict";
var r = e.r(22541),
a = e.r(764121);
(i.highlight = A),
(i.highlightAuto = function (e, t) {
var i,
s,
o,
l,
c = t || {},
d = c.subset || r.listLanguages(),
u = c.prefix,
g = d.length,
p = -1;
if ((null == u && (u = n), "string" != typeof e))
throw a("Expected `string` for value, got `%s`", e);
for (
s = { relevance: 0, language: null, value: [] },
i = { relevance: 0, language: null, value: [] };
++p < g;
)
(l = d[p]),
r.getLanguage(l) &&
(((o = A(l, e, t)).language = l),
o.relevance > s.relevance && (s = o),
o.relevance > i.relevance && ((s = i), (i = o)));
return s.language && (i.secondBest = s), i;
}),
(i.registerLanguage = function (e, t) {
r.registerLanguage(e, t);
}),
(i.listLanguages = function () {
return r.listLanguages();
}),
(i.registerAlias = function (e, t) {
var i,
a = e;
for (i in (t && ((a = {})[e] = t), a))
r.registerAliases(a[i], { languageName: i });
}),
(s.prototype.addText = function (e) {
var t,
i,
r = this.stack;
"" !== e &&
((i = (t = r[r.length - 1]).children[t.children.length - 1]) &&
"text" === i.type
? (i.value += e)
: t.children.push({ type: "text", value: e }));
}),
(s.prototype.addKeyword = function (e, t) {
this.openNode(t), this.addText(e), this.closeNode();
}),
(s.prototype.addSublanguage = function (e, t) {
var i = this.stack,
r = i[i.length - 1],
a = e.rootNode.children;
r.children = r.children.concat(
t
? {
type: "element",
tagName: "span",
properties: { className: [t] },
children: a,
}
: a,
);
}),
(s.prototype.openNode = function (e) {
var t = this.stack,
i = this.options.classPrefix + e,
r = t[t.length - 1],
a = {
type: "element",
tagName: "span",
properties: { className: [i] },
children: [],
};
r.children.push(a), t.push(a);
}),
(s.prototype.closeNode = function () {
this.stack.pop();
}),
(s.prototype.closeAllNodes = o),
(s.prototype.finalize = o),
(s.prototype.toHTML = function () {
return "";
});
var n = "hljs-";
function A(e, t, i) {
var A,
o = r.configure({}),
l = (i || {}).prefix;
if ("string" != typeof e)
throw a("Expected `string` for name, got `%s`", e);
if (!r.getLanguage(e))
throw a("Unknown language: `%s` is not registered", e);
if ("string" != typeof t)
throw a("Expected `string` for value, got `%s`", t);
if (
(null == l && (l = n),
r.configure({ __emitter: s, classPrefix: l }),
(A = r.highlight(t, { language: e, ignoreIllegals: !0 })),
r.configure(o || {}),
A.errorRaised)
)
throw A.errorRaised;
return {
relevance: A.relevance,
language: A.language,
value: A.emitter.rootNode.children,
};
}
function s(e) {
(this.options = e),
(this.rootNode = { children: [] }),
(this.stack = [this.rootNode]);
}
function o() {}
};
export default moduleFactory;