docsify
Version:
A magical documentation generator.
1,002 lines (1,001 loc) • 321 kB
JavaScript
/*!
* Docsify Plugin: search v5.0.0
* https://docsify.js.org
* (c) 2017-2026
* MIT license
*/
(function() {
"use strict";
function getAndRemoveConfig(str = "") {
const config = {};
if (str) {
str = str.replace(/^('|")/, "").replace(/('|")$/, "").replace(/(?:^|\s):([\w-]+:?)=?([\w-%]+)?/g, ((m, key, value) => {
if (key.indexOf(":") !== -1) {
return m;
}
value = value && value.replace(/"/g, "") || true;
if (value !== true && config[key] !== undefined) {
if (!Array.isArray(config[key]) && value !== config[key]) {
config[key] = [ config[key] ];
}
config[key].includes(value) || config[key].push(value);
} else {
config[key] = value;
}
return "";
})).trim();
}
return {
str: str,
config: config
};
}
function removeAtag(str = "") {
return str.replace(/(<\/?a.*?>)/gi, "");
}
function getAndRemoveDocsifyIgnoreConfig(content = "") {
let ignoreAllSubs, ignoreSubHeading;
if (/<!-- {docsify-ignore} -->/g.test(content)) {
content = content.replace("\x3c!-- {docsify-ignore} --\x3e", "");
ignoreSubHeading = true;
}
if (/{docsify-ignore}/g.test(content)) {
content = content.replace("{docsify-ignore}", "");
ignoreSubHeading = true;
}
if (/<!-- {docsify-ignore-all} -->/g.test(content)) {
content = content.replace("\x3c!-- {docsify-ignore-all} --\x3e", "");
ignoreAllSubs = true;
}
if (/{docsify-ignore-all}/g.test(content)) {
content = content.replace("{docsify-ignore-all}", "");
ignoreAllSubs = true;
}
return {
content: content,
ignoreAllSubs: ignoreAllSubs,
ignoreSubHeading: ignoreSubHeading
};
}
function escapeHtml(string) {
const entityMap = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
};
return String(string).replace(/[&<>"']/g, (s => entityMap[s]));
}
function cached(fn) {
const cache = Object.create(null);
return function(str) {
const key = isPrimitive(str) ? str : JSON.stringify(str);
if (key in cache) {
return cache[key];
}
return cache[key] = fn(str);
};
}
function isPrimitive(value) {
return typeof value === "string" || typeof value === "number";
}
const isAbsolutePath = cached((path => /(:|(\/{2}))/g.test(path)));
const getParentPath = cached((path => {
if (/\/$/g.test(path)) {
return path;
}
const matchingParts = path.match(/(\S*\/)[^/]+$/);
return matchingParts ? matchingParts[1] : "";
}));
const cleanPath = cached((path => path.replace(/^\/+/, "/").replace(/([^:])\/{2,}/g, "$1/")));
function normaliseFragment(path) {
return path.split("/").filter((p => p.indexOf("#") === -1)).join("/");
}
function getPath(...args) {
return cleanPath(args.map(normaliseFragment).join("/"));
}
function z() {
return {
async: false,
breaks: false,
extensions: null,
gfm: true,
hooks: null,
pedantic: false,
renderer: null,
silent: false,
tokenizer: null,
walkTokens: null
};
}
var T = z();
function G(l) {
T = l;
}
var _ = {
exec: () => null
};
function d(l, e = "") {
let t = typeof l == "string" ? l : l.source, n = {
replace: (s, r) => {
let i = typeof r == "string" ? r : r.source;
return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n;
},
getRegex: () => new RegExp(t, e)
};
return n;
}
var Re = ((l = "") => {
try {
return !!new RegExp("(?<=1)(?<!1)" + l);
} catch {
return false;
}
})(), m = {
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
outputLinkReplace: /\\([\[\]])/g,
indentCodeCompensation: /^(\s+)(?:```)/,
beginningSpace: /^\s+/,
endingHash: /#$/,
startingSpaceChar: /^ /,
endingSpaceChar: / $/,
nonSpaceChar: /[^ ]/,
newLineCharGlobal: /\n/g,
tabCharGlobal: /\t/g,
multipleSpaceGlobal: /\s+/g,
blankLine: /^[ \t]*$/,
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
blockquoteStart: /^ {0,3}>/,
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
listIsTask: /^\[[ xX]\] +\S/,
listReplaceTask: /^\[[ xX]\] +/,
listTaskCheckbox: /\[[ xX]\]/,
anyLine: /\n.*\n/,
hrefBrackets: /^<(.*)>$/,
tableDelimiter: /[:|]/,
tableAlignChars: /^\||\| *$/g,
tableRowBlankLine: /\n[ \t]*$/,
tableAlignRight: /^ *-+: *$/,
tableAlignCenter: /^ *:-+: *$/,
tableAlignLeft: /^ *:-+ *$/,
startATag: /^<a /i,
endATag: /^<\/a>/i,
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
startAngleBracket: /^</,
endAngleBracket: />$/,
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
escapeTest: /[&<>"']/,
escapeReplace: /[&<>"']/g,
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
caret: /(^|[^\[])\^/g,
percentDecode: /%25/g,
findPipe: /\|/g,
splitPipe: / \|/,
slashPipe: /\\\|/g,
carriageReturn: /\r\n|\r/g,
spaceLine: /^ +$/gm,
notSpaceStart: /^\S*/,
endingNewline: /\n$/,
listItemRegex: l => new RegExp(`^( {0,3}${l})((?:[\t ][^\\n]*)?(?:\\n|$))`),
nextBulletRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),
hrRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
fencesBeginRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:\`\`\`|~~~)`),
headingBeginRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}#`),
htmlBeginRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}<(?:[a-z].*>|!--)`, "i"),
blockquoteBeginRegex: l => new RegExp(`^ {0,${Math.min(3, l - 1)}}>`)
}, Te = /^(?:[ \t]*(?:\n|$))+/, Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, we = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, oe = d(ie).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Pe = d(ie).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Se = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, $e = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Le = d(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _e = d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ae = d(j).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Me = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex(), K = {
blockquote: Me,
code: Oe,
def: $e,
fences: we,
heading: ye,
hr: I,
html: _e,
lheading: oe,
list: Le,
newline: Te,
paragraph: ae,
table: _,
text: Se
}, re = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}\t)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), ze = {
...K,
lheading: Pe,
table: re,
paragraph: d(j).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex()
}, Ee = {
...K,
html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
heading: /^(#{1,6})(.*)(?:\n+|$)/,
fences: _,
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
paragraph: d(j).replace("hr", I).replace("heading", ` *#{1,6} *[^\n]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
}, Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, le = /^( {2,}|\\)\n(?!\s*$)/, Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, E = /[\p{P}\p{S}]/u, H = /[\s\p{P}\p{S}]/u, W = /[^\s\p{P}\p{S}]/u, Be = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, H).getRegex(), ue = /(?!~)[\p{P}\p{S}]/u, De = /(?!~)[\s\p{P}\p{S}]/u, qe = /(?:[^\s\p{P}\p{S}]|~)/u, ve = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Re ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), pe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, He = d(pe, "u").replace(/punct/g, E).getRegex(), Ze = d(pe, "u").replace(/punct/g, ue).getRegex(), ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ge = d(ce, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, E).getRegex(), Ne = d(ce, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, De).replace(/punct/g, ue).getRegex(), Qe = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, E).getRegex(), je = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, E).getRegex(), Fe = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Ue = d(Fe, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, E).getRegex(), Ke = d(/\\(punct)/, "gu").replace(/punct/g, E).getRegex(), We = d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Xe = d(U).replace("(?:--\x3e|$)", "--\x3e").getRegex(), Je = d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Xe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ve = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), he = d(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), ke = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ye = d("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex(), se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, X = {
_backpedal: _,
anyPunctuation: Ke,
autolink: We,
blockSkip: ve,
br: le,
code: Ce,
del: _,
delLDelim: _,
delRDelim: _,
emStrongLDelim: He,
emStrongRDelimAst: Ge,
emStrongRDelimUnd: Qe,
escape: Ae,
link: Ve,
nolink: ke,
punctuation: Be,
reflink: he,
reflinkSearch: Ye,
tag: Je,
text: Ie,
url: _
}, et = {
...X,
link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
}, N = {
...X,
emStrongRDelimAst: Ne,
emStrongLDelim: Ze,
delLDelim: je,
delRDelim: Ue,
url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", se).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
text: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", se).getRegex()
}, tt = {
...N,
br: d(le).replace("{2,}", "*").getRegex(),
text: d(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
}, B = {
normal: K,
gfm: ze,
pedantic: Ee
}, A = {
normal: X,
gfm: N,
breaks: tt,
pedantic: et
};
var nt = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
}, de = l => nt[l];
function O(l, e) {
if (e) {
if (m.escapeTest.test(l)) return l.replace(m.escapeReplace, de);
} else if (m.escapeTestNoEncode.test(l)) return l.replace(m.escapeReplaceNoEncode, de);
return l;
}
function J(l) {
try {
l = encodeURI(l).replace(m.percentDecode, "%");
} catch {
return null;
}
return l;
}
function V(l, e) {
let t = l.replace(m.findPipe, ((r, i, o) => {
let u = false, a = i;
for (;--a >= 0 && o[a] === "\\"; ) u = !u;
return u ? "|" : " |";
})), n = t.split(m.splitPipe), s = 0;
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e); else for (;n.length < e; ) n.push("");
for (;s < n.length; s++) n[s] = n[s].trim().replace(m.slashPipe, "|");
return n;
}
function $(l, e, t) {
let n = l.length;
if (n === 0) return "";
let s = 0;
for (;s < n; ) {
let r = l.charAt(n - s - 1);
if (r === e && true) s++; else break;
}
return l.slice(0, n - s);
}
function Y(l) {
let e = l.split(`\n`), t = e.length - 1;
for (;t >= 0 && m.blankLine.test(e[t]); ) t--;
return e.length - t <= 2 ? l : e.slice(0, t + 1).join(`\n`);
}
function ge(l, e) {
if (l.indexOf(e[1]) === -1) return -1;
let t = 0;
for (let n = 0; n < l.length; n++) if (l[n] === "\\") n++; else if (l[n] === e[0]) t++; else if (l[n] === e[1] && (t--,
t < 0)) return n;
return t > 0 ? -2 : -1;
}
function fe(l, e = 0) {
let t = e, n = "";
for (let s of l) if (s === "\t") {
let r = 4 - t % 4;
n += " ".repeat(r), t += r;
} else n += s, t++;
return n;
}
function me(l, e, t, n, s) {
let r = e.href, i = e.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1");
n.state.inLink = true;
let u = {
type: l[0].charAt(0) === "!" ? "image" : "link",
raw: t,
href: r,
title: i,
text: o,
tokens: n.inlineTokens(o)
};
return n.state.inLink = false, u;
}
function rt(l, e, t) {
let n = l.match(t.other.indentCodeCompensation);
if (n === null) return e;
let s = n[1];
return e.split(`\n`).map((r => {
let i = r.match(t.other.beginningSpace);
if (i === null) return r;
let [o] = i;
return o.length >= s.length ? r.slice(s.length) : r;
})).join(`\n`);
}
var w = class {
options;
rules;
lexer;
constructor(e) {
this.options = e || T;
}
space(e) {
let t = this.rules.block.newline.exec(e);
if (t && t[0].length > 0) return {
type: "space",
raw: t[0]
};
}
code(e) {
let t = this.rules.block.code.exec(e);
if (t) {
let n = this.options.pedantic ? t[0] : Y(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
return {
type: "code",
raw: n,
codeBlockStyle: "indented",
text: s
};
}
}
fences(e) {
let t = this.rules.block.fences.exec(e);
if (t) {
let n = t[0], s = rt(n, t[3] || "", this.rules);
return {
type: "code",
raw: n,
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
text: s
};
}
}
heading(e) {
let t = this.rules.block.heading.exec(e);
if (t) {
let n = t[2].trim();
if (this.rules.other.endingHash.test(n)) {
let s = $(n, "#");
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
}
return {
type: "heading",
raw: $(t[0], `\n`),
depth: t[1].length,
text: n,
tokens: this.lexer.inline(n)
};
}
}
hr(e) {
let t = this.rules.block.hr.exec(e);
if (t) return {
type: "hr",
raw: $(t[0], `\n`)
};
}
blockquote(e) {
let t = this.rules.block.blockquote.exec(e);
if (t) {
let n = $(t[0], `\n`).split(`\n`), s = "", r = "", i = [];
for (;n.length > 0; ) {
let o = false, u = [], a;
for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) u.push(n[a]),
o = true; else if (!o) u.push(n[a]); else break;
n = n.slice(a);
let c = u.join(`\n`), p = c.replace(this.rules.other.blockquoteSetextReplace, `\n $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
s = s ? `${s}\n${c}` : c, r = r ? `${r}\n${p}` : p;
let k = this.lexer.state.top;
if (this.lexer.state.top = true, this.lexer.blockTokens(p, i, true), this.lexer.state.top = k,
n.length === 0) break;
let h = i.at(-1);
if (h?.type === "code") break;
if (h?.type === "blockquote") {
let R = h, f = R.raw + `\n` + n.join(`\n`), S = this.blockquote(f);
i[i.length - 1] = S, s = s.substring(0, s.length - R.raw.length) + S.raw, r = r.substring(0, r.length - R.text.length) + S.text;
break;
} else if (h?.type === "list") {
let R = h, f = R.raw + `\n` + n.join(`\n`), S = this.list(f);
i[i.length - 1] = S, s = s.substring(0, s.length - h.raw.length) + S.raw, r = r.substring(0, r.length - R.raw.length) + S.raw,
n = f.substring(i.at(-1).raw.length).split(`\n`);
continue;
}
}
return {
type: "blockquote",
raw: s,
tokens: i,
text: r
};
}
}
list(e) {
let t = this.rules.block.list.exec(e);
if (t) {
let n = t[1].trim(), s = n.length > 1, r = {
type: "list",
raw: "",
ordered: s,
start: s ? +n.slice(0, -1) : "",
loose: false,
items: []
};
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
let i = this.rules.other.listItemRegex(n), o = false;
for (;e; ) {
let a = false, c = "", p = "";
if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
c = t[0], e = e.substring(c.length);
let k = fe(t[2].split(`\n`, 1)[0], t[1].length), h = e.split(`\n`, 1)[0], R = !k.trim(), f = 0;
if (this.options.pedantic ? (f = 2, p = k.trimStart()) : R ? f = t[1].length + 1 : (f = k.search(this.rules.other.nonSpaceChar),
f = f > 4 ? 1 : f, p = k.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (c += h + `\n`,
e = e.substring(h.length + 1), a = true), !a) {
let S = this.rules.other.nextBulletRegex(f), ee = this.rules.other.hrRegex(f), te = this.rules.other.fencesBeginRegex(f), ne = this.rules.other.headingBeginRegex(f), xe = this.rules.other.htmlBeginRegex(f), be = this.rules.other.blockquoteBeginRegex(f);
for (;e; ) {
let Z = e.split(`\n`, 1)[0], C;
if (h = Z, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "),
C = h) : C = h.replace(this.rules.other.tabCharGlobal, " "), te.test(h) || ne.test(h) || xe.test(h) || be.test(h) || S.test(h) || ee.test(h)) break;
if (C.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) p += `\n` + C.slice(f); else {
if (R || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(k) || ne.test(k) || ee.test(k)) break;
p += `\n` + h;
}
R = !h.trim(), c += Z + `\n`, e = e.substring(Z.length + 1), k = C.slice(f);
}
}
r.loose || (o ? r.loose = true : this.rules.other.doubleBlankLine.test(c) && (o = true)),
r.items.push({
type: "list_item",
raw: c,
task: !!this.options.gfm && this.rules.other.listIsTask.test(p),
loose: false,
text: p,
tokens: []
}), r.raw += c;
}
let u = r.items.at(-1);
if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd(); else return;
r.raw = r.raw.trimEnd();
for (let a of r.items) {
this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []);
let c = a.tokens[0];
if (a.task && (c?.type === "text" || c?.type === "paragraph")) {
a.text = a.text.replace(this.rules.other.listReplaceTask, ""), c.raw = c.raw.replace(this.rules.other.listReplaceTask, ""),
c.text = c.text.replace(this.rules.other.listReplaceTask, "");
for (let k = this.lexer.inlineQueue.length - 1; k >= 0; k--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)) {
this.lexer.inlineQueue[k].src = this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask, "");
break;
}
let p = this.rules.other.listTaskCheckbox.exec(a.raw);
if (p) {
let k = {
type: "checkbox",
raw: p[0] + " ",
checked: p[0] !== "[ ]"
};
a.checked = k.checked, r.loose ? a.tokens[0] && [ "paragraph", "text" ].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = k.raw + a.tokens[0].raw,
a.tokens[0].text = k.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(k)) : a.tokens.unshift({
type: "paragraph",
raw: k.raw,
text: k.raw,
tokens: [ k ]
}) : a.tokens.unshift(k);
}
} else a.task && (a.task = false);
if (!r.loose) {
let p = a.tokens.filter((h => h.type === "space")), k = p.length > 0 && p.some((h => this.rules.other.anyLine.test(h.raw)));
r.loose = k;
}
}
if (r.loose) for (let a of r.items) {
a.loose = true;
for (let c of a.tokens) c.type === "text" && (c.type = "paragraph");
}
return r;
}
}
html(e) {
let t = this.rules.block.html.exec(e);
if (t) {
let n = Y(t[0]);
return {
type: "html",
block: true,
raw: n,
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
text: n
};
}
}
def(e) {
let t = this.rules.block.def.exec(e);
if (t) {
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
return {
type: "def",
tag: n,
raw: $(t[0], `\n`),
href: s,
title: r
};
}
}
table(e) {
let t = this.rules.block.table.exec(e);
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
let n = V(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`\n`) : [], i = {
type: "table",
raw: $(t[0], `\n`),
header: [],
align: [],
rows: []
};
if (n.length === s.length) {
for (let o of s) this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
for (let o = 0; o < n.length; o++) i.header.push({
text: n[o],
tokens: this.lexer.inline(n[o]),
header: true,
align: i.align[o]
});
for (let o of r) i.rows.push(V(o, i.header.length).map(((u, a) => ({
text: u,
tokens: this.lexer.inline(u),
header: false,
align: i.align[a]
}))));
return i;
}
}
lheading(e) {
let t = this.rules.block.lheading.exec(e);
if (t) {
let n = t[1].trim();
return {
type: "heading",
raw: $(t[0], `\n`),
depth: t[2].charAt(0) === "=" ? 1 : 2,
text: n,
tokens: this.lexer.inline(n)
};
}
}
paragraph(e) {
let t = this.rules.block.paragraph.exec(e);
if (t) {
let n = t[1].charAt(t[1].length - 1) === `\n` ? t[1].slice(0, -1) : t[1];
return {
type: "paragraph",
raw: t[0],
text: n,
tokens: this.lexer.inline(n)
};
}
}
text(e) {
let t = this.rules.block.text.exec(e);
if (t) return {
type: "text",
raw: t[0],
text: t[0],
tokens: this.lexer.inline(t[0])
};
}
escape(e) {
let t = this.rules.inline.escape.exec(e);
if (t) return {
type: "escape",
raw: t[0],
text: t[1]
};
}
tag(e) {
let t = this.rules.inline.tag.exec(e);
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false),
!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false),
{
type: "html",
raw: t[0],
inLink: this.lexer.state.inLink,
inRawBlock: this.lexer.state.inRawBlock,
block: false,
text: t[0]
};
}
link(e) {
let t = this.rules.inline.link.exec(e);
if (t) {
let n = t[2].trim();
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
if (!this.rules.other.endAngleBracket.test(n)) return;
let i = $(n.slice(0, -1), "\\");
if ((n.length - i.length) % 2 === 0) return;
} else {
let i = ge(t[2], "()");
if (i === -2) return;
if (i > -1) {
let u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u).trim(), t[3] = "";
}
}
let s = t[2], r = "";
if (this.options.pedantic) {
let i = this.rules.other.pedanticHrefTitle.exec(s);
i && (s = i[1], r = i[3]);
} else r = t[3] ? t[3].slice(1, -1) : "";
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)),
me(t, {
href: s && s.replace(this.rules.inline.anyPunctuation, "$1"),
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
}, t[0], this.lexer, this.rules);
}
}
reflink(e, t) {
let n;
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[s.toLowerCase()];
if (!r) {
let i = n[0].charAt(0);
return {
type: "text",
raw: i,
text: i
};
}
return me(n, r, n[0], this.lexer, this.rules);
}
}
emStrong(e, t, n = "") {
let s = this.rules.inline.emStrongLDelim.exec(e);
if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
let i = [ ...s[0] ].length - 1, o, u, a = i, c = 0, p = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
for (p.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = p.exec(t)) !== null; ) {
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o) continue;
if (u = [ ...o ].length, s[3] || s[4]) {
a += u;
continue;
} else if ((s[5] || s[6]) && i % 3 && !((i + u) % 3)) {
c += u;
continue;
}
if (a -= u, a > 0) continue;
u = Math.min(u, u + a + c);
let k = [ ...s[0] ][0].length, h = e.slice(0, i + s.index + k + u);
if (Math.min(i, u) % 2) {
let f = h.slice(1, -1);
return {
type: "em",
raw: h,
text: f,
tokens: this.lexer.inlineTokens(f)
};
}
let R = h.slice(2, -2);
return {
type: "strong",
raw: h,
text: R,
tokens: this.lexer.inlineTokens(R)
};
}
}
}
codespan(e) {
let t = this.rules.inline.code.exec(e);
if (t) {
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
return s && r && (n = n.substring(1, n.length - 1)), {
type: "codespan",
raw: t[0],
text: n
};
}
}
br(e) {
let t = this.rules.inline.br.exec(e);
if (t) return {
type: "br",
raw: t[0]
};
}
del(e, t, n = "") {
let s = this.rules.inline.delLDelim.exec(e);
if (!s) return;
if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
let i = [ ...s[0] ].length - 1, o, u, a = i, c = this.rules.inline.delRDelim;
for (c.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = c.exec(t)) !== null; ) {
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (u = [ ...o ].length,
u !== i)) continue;
if (s[3] || s[4]) {
a += u;
continue;
}
if (a -= u, a > 0) continue;
u = Math.min(u, u + a);
let p = [ ...s[0] ][0].length, k = e.slice(0, i + s.index + p + u), h = k.slice(i, -i);
return {
type: "del",
raw: k,
text: h,
tokens: this.lexer.inlineTokens(h)
};
}
}
}
autolink(e) {
let t = this.rules.inline.autolink.exec(e);
if (t) {
let n, s;
return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), {
type: "link",
raw: t[0],
text: n,
href: s,
tokens: [ {
type: "text",
raw: n,
text: n
} ]
};
}
}
url(e) {
let t;
if (t = this.rules.inline.url.exec(e)) {
let n, s;
if (t[2] === "@") n = t[0], s = "mailto:" + n; else {
let r;
do {
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
} while (r !== t[0]);
n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
}
return {
type: "link",
raw: t[0],
text: n,
href: s,
tokens: [ {
type: "text",
raw: n,
text: n
} ]
};
}
}
inlineText(e) {
let t = this.rules.inline.text.exec(e);
if (t) {
let n = this.lexer.state.inRawBlock;
return {
type: "text",
raw: t[0],
text: t[0],
escaped: n
};
}
}
};
var x = class l {
tokens;
options;
state;
inlineQueue;
tokenizer;
constructor(e) {
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T,
this.options.tokenizer = this.options.tokenizer || new w, this.tokenizer = this.options.tokenizer,
this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [],
this.state = {
inLink: false,
inRawBlock: false,
top: true
};
let t = {
other: m,
block: B.normal,
inline: A.normal
};
this.options.pedantic ? (t.block = B.pedantic, t.inline = A.pedantic) : this.options.gfm && (t.block = B.gfm,
this.options.breaks ? t.inline = A.breaks : t.inline = A.gfm), this.tokenizer.rules = t;
}
static get rules() {
return {
block: B,
inline: A
};
}
static lex(e, t) {
return new l(t).lex(e);
}
static lexInline(e, t) {
return new l(t).inlineTokens(e);
}
lex(e) {
e = e.replace(m.carriageReturn, `\n`), this.blockTokens(e, this.tokens);
for (let t = 0; t < this.inlineQueue.length; t++) {
let n = this.inlineQueue[t];
this.inlineTokens(n.src, n.tokens);
}
return this.inlineQueue = [], this.tokens;
}
blockTokens(e, t = [], n = false) {
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, ""));
let s = 1 / 0;
for (;e; ) {
if (e.length < s) s = e.length; else {
this.infiniteLoopError(e.charCodeAt(0));
break;
}
let r;
if (this.options.extensions?.block?.some((o => (r = o.call({
lexer: this
}, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false))) continue;
if (r = this.tokenizer.space(e)) {
e = e.substring(r.raw.length);
let o = t.at(-1);
r.raw.length === 1 && o !== void 0 ? o.raw += `\n` : t.push(r);
continue;
}
if (r = this.tokenizer.code(e)) {
e = e.substring(r.raw.length);
let o = t.at(-1);
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`\n`) ? "" : `\n`) + r.raw,
o.text += `\n` + r.text, this.inlineQueue.at(-1).src = o.text) : t.push(r);
continue;
}
if (r = this.tokenizer.fences(e)) {
e = e.substring(r.raw.length), t.push(r);
continue;
}
if (r = this.tokenizer.heading(e)) {
e = e.substring(r.raw.length), t.push(r);
continue;
}
if (r = this.tokenizer.hr(e)) {
e = e.substring(r.raw.length), t.push(r);
continue;
}
if (r = this.tokenizer.blockquote(e)) {
e = e.substring(r.raw.length), t.push(r);
continue;
}
if (r = this.tokenizer.list(e)) {
e = e.substring(r.raw.length), t.push(r);
continue;
}
if (r = this.tokenizer.html(e)) {
e = e.substring(r.raw.length), t.push(r);
continue;
}
if (r = this.tokenizer.def(e)) {
e = e.substring(r.raw.length);
let o = t.at(-1);
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`\n`) ? "" : `\n`) + r.raw,
o.text += `\n` + r.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
href: r.href,
title: r.title
}, t.push(r));
continue;
}
if (r = this.tokenizer.table(e)) {
e = e.substring(r.raw.length), t.push(r);
continue;
}
if (r = this.tokenizer.lheading(e)) {
e = e.substring(r.raw.length), t.push(r);
continue;
}
let i = e;
if (this.options.extensions?.startBlock) {
let o = 1 / 0, u = e.slice(1), a;
this.options.extensions.startBlock.forEach((c => {
a = c.call({
lexer: this
}, u), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
})), o < 1 / 0 && o >= 0 && (i = e.substring(0, o + 1));
}
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
let o = t.at(-1);
n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`\n`) ? "" : `\n`) + r.raw,
o.text += `\n` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r),
n = i.length !== e.length, e = e.substring(r.raw.length);
continue;
}
if (r = this.tokenizer.text(e)) {
e = e.substring(r.raw.length);
let o = t.at(-1);
o?.type === "text" ? (o.raw += (o.raw.endsWith(`\n`) ? "" : `\n`) + r.raw, o.text += `\n` + r.text,
this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r);
continue;
}
if (e) {
this.infiniteLoopError(e.charCodeAt(0));
break;
}
}
return this.state.top = true, t;
}
inline(e, t = []) {
return this.inlineQueue.push({
src: e,
tokens: t
}), t;
}
inlineTokens(e, t = []) {
this.tokenizer.lexer = this;
let n = e, s = null;
if (this.tokens.links) {
let a = Object.keys(this.tokens.links);
if (a.length > 0) for (;(s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null; ) a.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
}
for (;(s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null; ) n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
let r;
for (;(s = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; ) r = s[2] ? s[2].length : 0,
n = n.slice(0, s.index + r) + "[" + "a".repeat(s[0].length - r - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
n = this.options.hooks?.emStrongMask?.call({
lexer: this
}, n) ?? n;
let i = false, o = "", u = 1 / 0;
for (;e; ) {
if (e.length < u) u = e.length; else {
this.infiniteLoopError(e.charCodeAt(0));
break;
}
i || (o = ""), i = false;
let a;
if (this.options.extensions?.inline?.some((p => (a = p.call({
lexer: this
}, e, t)) ? (e = e.substring(a.raw.length), t.push(a), true) : false))) continue;
if (a = this.tokenizer.escape(e)) {
e = e.substring(a.raw.length), t.push(a);
continue;
}
if (a = this.tokenizer.tag(e)) {
e = e.substring(a.raw.length), t.push(a);
continue;
}
if (a = this.tokenizer.link(e)) {
e = e.substring(a.raw.length), t.push(a);
continue;
}
if (a = this.tokenizer.reflink(e, this.tokens.links)) {