function M() {
	return {
		async: !1,
		breaks: !1,
		extensions: null,
		gfm: !0,
		hooks: null,
		pedantic: !1,
		renderer: null,
		silent: !1,
		tokenizer: null,
		walkTokens: null
	};
}
var T = M();
function H(e) {
	T = e;
}
var _ = { exec: () => null };
function k(e, c = "") {
	let l = typeof e == "string" ? e : e.source, u = {
		replace: (e, c) => {
			let d = typeof c == "string" ? c : c.source;
			return d = d.replace(m.caret, "$1"), l = l.replace(e, d), u;
		},
		getRegex: () => new RegExp(l, c)
	};
	return u;
}
var Re = (() => {
	try {
		return !0;
	} catch {
		return !1;
	}
})(), 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,
	unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,
	caret: /(^|[^\[])\^/g,
	percentDecode: /%25/g,
	findPipe: /\|/g,
	splitPipe: / \|/,
	slashPipe: /\\\|/g,
	carriageReturn: /\r\n|\r/g,
	spaceLine: /^ +$/gm,
	notSpaceStart: /^\S*/,
	endingNewline: /\n$/,
	listItemRegex: (e) => /* @__PURE__ */ RegExp(`^( {0,3}${e})((?:[	 ][^\\n]*)?(?:\\n|$))`),
	nextBulletRegex: (e) => /* @__PURE__ */ RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),
	hrRegex: (e) => /* @__PURE__ */ RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
	fencesBeginRegex: (e) => /* @__PURE__ */ RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`),
	headingBeginRegex: (e) => /* @__PURE__ */ RegExp(`^ {0,${Math.min(3, e - 1)}}#`),
	htmlBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i"),
	blockquoteBeginRegex: (e) => /* @__PURE__ */ RegExp(`^ {0,${Math.min(3, e - 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+|$)/, N = / {0,3}(?:[*+-]|\d{1,9}[.)])/, re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, se = k(re).replace(/bull/g, N).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 = k(re).replace(/bull/g, N).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(), Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Se = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, $e = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), _e = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex(), q = "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", j = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Le = k("^ {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[ 	]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))", "i").replace("comment", j).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ie = k(Q).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", q).getRegex(), U = {
	blockquote: k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex(),
	code: Oe,
	def: $e,
	fences: we,
	heading: ye,
	hr: I,
	html: Le,
	lheading: se,
	list: _e,
	newline: Te,
	paragraph: ie,
	table: _,
	text: Se
}, te = k("^ *([^\\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}	)[^\\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", q).getRegex(), ze = {
	...U,
	lheading: Pe,
	table: te,
	paragraph: k(Q).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", te).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", q).getRegex()
}, Ce = {
	...U,
	html: k("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", j).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: k(Q).replace("hr", I).replace("heading", " *#{1,6} *[^\n]").replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
}, Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ie = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, oe = /^( {2,}|\\)\n(?!\s*$)/, Ee = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, v = /[\p{P}\p{S}]/u, K = /[\s\p{P}\p{S}]/u, ae = /[^\s\p{P}\p{S}]/u, Be = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex(), le = /(?!~)[\p{P}\p{S}]/u, De = /(?!~)[\s\p{P}\p{S}]/u, qe = /(?:[^\s\p{P}\p{S}]|~)/u, ue = /(?![*_])[\p{P}\p{S}]/u, ve = /(?![*_])[\s\p{P}\p{S}]/u, Ge = /(?:[^\s\p{P}\p{S}]|[*_])/u, He = k(/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_]))/, Ze = k(pe, "u").replace(/punct/g, v).getRegex(), Ne = k(pe, "u").replace(/punct/g, le).getRegex(), ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Qe = k(ce, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex(), Fe = k(ce, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, De).replace(/punct/g, le).getRegex(), je = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex(), Ue = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, ue).getRegex(), We = k("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, Ge).replace(/punctSpace/g, ve).replace(/punct/g, ue).getRegex(), Xe = k(/\\(punct)/, "gu").replace(/punct/g, v).getRegex(), Je = k(/^<(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(), Ve = k(j).replace("(?:-->|$)", "-->").getRegex(), Ye = k("^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", Ve).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), D = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, et = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", D).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), he = k(/^!?\[(label)\]\[(ref)\]/).replace("label", D).replace("ref", F).getRegex(), ke = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), tt = k("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex(), ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, W = {
	_backpedal: _,
	anyPunctuation: Xe,
	autolink: Je,
	blockSkip: He,
	br: oe,
	code: Ie,
	del: _,
	delLDelim: _,
	delRDelim: _,
	emStrongLDelim: Ze,
	emStrongRDelimAst: Qe,
	emStrongRDelimUnd: je,
	escape: Ae,
	link: et,
	nolink: ke,
	punctuation: Be,
	reflink: he,
	reflinkSearch: tt,
	tag: Ye,
	text: Ee,
	url: _
}, nt = {
	...W,
	link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", D).getRegex(),
	reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", D).getRegex()
}, Z = {
	...W,
	emStrongRDelimAst: Fe,
	emStrongLDelim: Ne,
	delLDelim: Ue,
	delRDelim: We,
	url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).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: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex()
}, rt = {
	...Z,
	br: k(oe).replace("{2,}", "*").getRegex(),
	text: k(Z.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
}, E = {
	normal: U,
	gfm: ze,
	pedantic: Ce
}, z = {
	normal: W,
	gfm: Z,
	breaks: rt,
	pedantic: nt
}, st = {
	"&": "&amp;",
	"<": "&lt;",
	">": "&gt;",
	"\"": "&quot;",
	"'": "&#39;"
}, de = (e) => st[e];
function O(e, c) {
	if (c) {
		if (m.escapeTest.test(e)) return e.replace(m.escapeReplace, de);
	} else if (m.escapeTestNoEncode.test(e)) return e.replace(m.escapeReplaceNoEncode, de);
	return e;
}
function X(e) {
	try {
		e = encodeURI(e).replace(m.percentDecode, "%");
	} catch {
		return null;
	}
	return e;
}
function J(e, c) {
	let l = e.replace(m.findPipe, (e, c, l) => {
		let u = !1, d = c;
		for (; --d >= 0 && l[d] === "\\";) u = !u;
		return u ? "|" : " |";
	}).split(m.splitPipe), u = 0;
	if (l[0].trim() || l.shift(), l.length > 0 && !l.at(-1)?.trim() && l.pop(), c) if (l.length > c) l.splice(c);
	else for (; l.length < c;) l.push("");
	for (; u < l.length; u++) l[u] = l[u].trim().replace(m.slashPipe, "|");
	return l;
}
function C(e, c, l) {
	let u = e.length;
	if (u === 0) return "";
	let d = 0;
	for (; d < u;) {
		let f = e.charAt(u - d - 1);
		if (f === c && !l) d++;
		else if (f !== c && l) d++;
		else break;
	}
	return e.slice(0, u - d);
}
function ge(e, c) {
	if (e.indexOf(c[1]) === -1) return -1;
	let l = 0;
	for (let u = 0; u < e.length; u++) if (e[u] === "\\") u++;
	else if (e[u] === c[0]) l++;
	else if (e[u] === c[1] && (l--, l < 0)) return u;
	return l > 0 ? -2 : -1;
}
function fe(e, c = 0) {
	let l = c, u = "";
	for (let c of e) if (c === "	") {
		let e = 4 - l % 4;
		u += " ".repeat(e), l += e;
	} else u += c, l++;
	return u;
}
function me(e, c, l, u, d) {
	let f = c.href, p = c.title || null, h = e[1].replace(d.other.outputLinkReplace, "$1");
	u.state.inLink = !0;
	let S = {
		type: e[0].charAt(0) === "!" ? "image" : "link",
		raw: l,
		href: f,
		title: p,
		text: h,
		tokens: u.inlineTokens(h)
	};
	return u.state.inLink = !1, S;
}
function it(e, c, l) {
	let u = e.match(l.other.indentCodeCompensation);
	if (u === null) return c;
	let d = u[1];
	return c.split("\n").map((e) => {
		let c = e.match(l.other.beginningSpace);
		if (c === null) return e;
		let [u] = c;
		return u.length >= d.length ? e.slice(d.length) : e;
	}).join("\n");
}
var w = class {
	options;
	rules;
	lexer;
	constructor(e) {
		this.options = e || T;
	}
	space(e) {
		let c = this.rules.block.newline.exec(e);
		if (c && c[0].length > 0) return {
			type: "space",
			raw: c[0]
		};
	}
	code(e) {
		let c = this.rules.block.code.exec(e);
		if (c) {
			let e = c[0].replace(this.rules.other.codeRemoveIndent, "");
			return {
				type: "code",
				raw: c[0],
				codeBlockStyle: "indented",
				text: this.options.pedantic ? e : C(e, "\n")
			};
		}
	}
	fences(e) {
		let c = this.rules.block.fences.exec(e);
		if (c) {
			let e = c[0], l = it(e, c[3] || "", this.rules);
			return {
				type: "code",
				raw: e,
				lang: c[2] ? c[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : c[2],
				text: l
			};
		}
	}
	heading(e) {
		let c = this.rules.block.heading.exec(e);
		if (c) {
			let e = c[2].trim();
			if (this.rules.other.endingHash.test(e)) {
				let c = C(e, "#");
				(this.options.pedantic || !c || this.rules.other.endingSpaceChar.test(c)) && (e = c.trim());
			}
			return {
				type: "heading",
				raw: c[0],
				depth: c[1].length,
				text: e,
				tokens: this.lexer.inline(e)
			};
		}
	}
	hr(e) {
		let c = this.rules.block.hr.exec(e);
		if (c) return {
			type: "hr",
			raw: C(c[0], "\n")
		};
	}
	blockquote(e) {
		let c = this.rules.block.blockquote.exec(e);
		if (c) {
			let e = C(c[0], "\n").split("\n"), l = "", u = "", d = [];
			for (; e.length > 0;) {
				let c = !1, f = [], p;
				for (p = 0; p < e.length; p++) if (this.rules.other.blockquoteStart.test(e[p])) f.push(e[p]), c = !0;
				else if (!c) f.push(e[p]);
				else break;
				e = e.slice(p);
				let h = f.join("\n"), S = h.replace(this.rules.other.blockquoteSetextReplace, "\n    $1").replace(this.rules.other.blockquoteSetextReplace2, "");
				l = l ? `${l}
${h}` : h, u = u ? `${u}
${S}` : S;
				let A = this.lexer.state.top;
				if (this.lexer.state.top = !0, this.lexer.blockTokens(S, d, !0), this.lexer.state.top = A, e.length === 0) break;
				let R = d.at(-1);
				if (R?.type === "code") break;
				if (R?.type === "blockquote") {
					let c = R, f = c.raw + "\n" + e.join("\n"), p = this.blockquote(f);
					d[d.length - 1] = p, l = l.substring(0, l.length - c.raw.length) + p.raw, u = u.substring(0, u.length - c.text.length) + p.text;
					break;
				} else if (R?.type === "list") {
					let c = R, f = c.raw + "\n" + e.join("\n"), p = this.list(f);
					d[d.length - 1] = p, l = l.substring(0, l.length - R.raw.length) + p.raw, u = u.substring(0, u.length - c.raw.length) + p.raw, e = f.substring(d.at(-1).raw.length).split("\n");
					continue;
				}
			}
			return {
				type: "blockquote",
				raw: l,
				tokens: d,
				text: u
			};
		}
	}
	list(e) {
		let c = this.rules.block.list.exec(e);
		if (c) {
			let l = c[1].trim(), u = l.length > 1, d = {
				type: "list",
				raw: "",
				ordered: u,
				start: u ? +l.slice(0, -1) : "",
				loose: !1,
				items: []
			};
			l = u ? `\\d{1,9}\\${l.slice(-1)}` : `\\${l}`, this.options.pedantic && (l = u ? l : "[*+-]");
			let f = this.rules.other.listItemRegex(l), p = !1;
			for (; e;) {
				let l = !1, u = "", h = "";
				if (!(c = f.exec(e)) || this.rules.block.hr.test(e)) break;
				u = c[0], e = e.substring(u.length);
				let S = fe(c[2].split("\n", 1)[0], c[1].length), A = e.split("\n", 1)[0], R = !S.trim(), B = 0;
				if (this.options.pedantic ? (B = 2, h = S.trimStart()) : R ? B = c[1].length + 1 : (B = S.search(this.rules.other.nonSpaceChar), B = B > 4 ? 1 : B, h = S.slice(B), B += c[1].length), R && this.rules.other.blankLine.test(A) && (u += A + "\n", e = e.substring(A.length + 1), l = !0), !l) {
					let c = this.rules.other.nextBulletRegex(B), l = this.rules.other.hrRegex(B), d = this.rules.other.fencesBeginRegex(B), f = this.rules.other.headingBeginRegex(B), p = this.rules.other.htmlBeginRegex(B), V = this.rules.other.blockquoteBeginRegex(B);
					for (; e;) {
						let G = e.split("\n", 1)[0], Y;
						if (A = G, this.options.pedantic ? (A = A.replace(this.rules.other.listReplaceNesting, "  "), Y = A) : Y = A.replace(this.rules.other.tabCharGlobal, "    "), d.test(A) || f.test(A) || p.test(A) || V.test(A) || c.test(A) || l.test(A)) break;
						if (Y.search(this.rules.other.nonSpaceChar) >= B || !A.trim()) h += "\n" + Y.slice(B);
						else {
							if (R || S.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4 || d.test(S) || f.test(S) || l.test(S)) break;
							h += "\n" + A;
						}
						R = !A.trim(), u += G + "\n", e = e.substring(G.length + 1), S = Y.slice(B);
					}
				}
				d.loose || (p ? d.loose = !0 : this.rules.other.doubleBlankLine.test(u) && (p = !0)), d.items.push({
					type: "list_item",
					raw: u,
					task: !!this.options.gfm && this.rules.other.listIsTask.test(h),
					loose: !1,
					text: h,
					tokens: []
				}), d.raw += u;
			}
			let h = d.items.at(-1);
			if (h) h.raw = h.raw.trimEnd(), h.text = h.text.trimEnd();
			else return;
			d.raw = d.raw.trimEnd();
			for (let e of d.items) {
				if (this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []), e.task) {
					if (e.text = e.text.replace(this.rules.other.listReplaceTask, ""), e.tokens[0]?.type === "text" || e.tokens[0]?.type === "paragraph") {
						e.tokens[0].raw = e.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), e.tokens[0].text = e.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
						for (let e = this.lexer.inlineQueue.length - 1; e >= 0; e--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)) {
							this.lexer.inlineQueue[e].src = this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask, "");
							break;
						}
					}
					let c = this.rules.other.listTaskCheckbox.exec(e.raw);
					if (c) {
						let l = {
							type: "checkbox",
							raw: c[0] + " ",
							checked: c[0] !== "[ ]"
						};
						e.checked = l.checked, d.loose ? e.tokens[0] && ["paragraph", "text"].includes(e.tokens[0].type) && "tokens" in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = l.raw + e.tokens[0].raw, e.tokens[0].text = l.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(l)) : e.tokens.unshift({
							type: "paragraph",
							raw: l.raw,
							text: l.raw,
							tokens: [l]
						}) : e.tokens.unshift(l);
					}
				}
				if (!d.loose) {
					let c = e.tokens.filter((e) => e.type === "space");
					d.loose = c.length > 0 && c.some((e) => this.rules.other.anyLine.test(e.raw));
				}
			}
			if (d.loose) for (let e of d.items) {
				e.loose = !0;
				for (let c of e.tokens) c.type === "text" && (c.type = "paragraph");
			}
			return d;
		}
	}
	html(e) {
		let c = this.rules.block.html.exec(e);
		if (c) return {
			type: "html",
			block: !0,
			raw: c[0],
			pre: c[1] === "pre" || c[1] === "script" || c[1] === "style",
			text: c[0]
		};
	}
	def(e) {
		let c = this.rules.block.def.exec(e);
		if (c) {
			let e = c[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), l = c[2] ? c[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", u = c[3] ? c[3].substring(1, c[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : c[3];
			return {
				type: "def",
				tag: e,
				raw: c[0],
				href: l,
				title: u
			};
		}
	}
	table(e) {
		let c = this.rules.block.table.exec(e);
		if (!c || !this.rules.other.tableDelimiter.test(c[2])) return;
		let l = J(c[1]), u = c[2].replace(this.rules.other.tableAlignChars, "").split("|"), d = c[3]?.trim() ? c[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], f = {
			type: "table",
			raw: c[0],
			header: [],
			align: [],
			rows: []
		};
		if (l.length === u.length) {
			for (let e of u) this.rules.other.tableAlignRight.test(e) ? f.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? f.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? f.align.push("left") : f.align.push(null);
			for (let e = 0; e < l.length; e++) f.header.push({
				text: l[e],
				tokens: this.lexer.inline(l[e]),
				header: !0,
				align: f.align[e]
			});
			for (let e of d) f.rows.push(J(e, f.header.length).map((e, c) => ({
				text: e,
				tokens: this.lexer.inline(e),
				header: !1,
				align: f.align[c]
			})));
			return f;
		}
	}
	lheading(e) {
		let c = this.rules.block.lheading.exec(e);
		if (c) return {
			type: "heading",
			raw: c[0],
			depth: c[2].charAt(0) === "=" ? 1 : 2,
			text: c[1],
			tokens: this.lexer.inline(c[1])
		};
	}
	paragraph(e) {
		let c = this.rules.block.paragraph.exec(e);
		if (c) {
			let e = c[1].charAt(c[1].length - 1) === "\n" ? c[1].slice(0, -1) : c[1];
			return {
				type: "paragraph",
				raw: c[0],
				text: e,
				tokens: this.lexer.inline(e)
			};
		}
	}
	text(e) {
		let c = this.rules.block.text.exec(e);
		if (c) return {
			type: "text",
			raw: c[0],
			text: c[0],
			tokens: this.lexer.inline(c[0])
		};
	}
	escape(e) {
		let c = this.rules.inline.escape.exec(e);
		if (c) return {
			type: "escape",
			raw: c[0],
			text: c[1]
		};
	}
	tag(e) {
		let c = this.rules.inline.tag.exec(e);
		if (c) return !this.lexer.state.inLink && this.rules.other.startATag.test(c[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(c[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(c[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(c[0]) && (this.lexer.state.inRawBlock = !1), {
			type: "html",
			raw: c[0],
			inLink: this.lexer.state.inLink,
			inRawBlock: this.lexer.state.inRawBlock,
			block: !1,
			text: c[0]
		};
	}
	link(e) {
		let c = this.rules.inline.link.exec(e);
		if (c) {
			let e = c[2].trim();
			if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
				if (!this.rules.other.endAngleBracket.test(e)) return;
				let c = C(e.slice(0, -1), "\\");
				if ((e.length - c.length) % 2 == 0) return;
			} else {
				let e = ge(c[2], "()");
				if (e === -2) return;
				if (e > -1) {
					let l = (c[0].indexOf("!") === 0 ? 5 : 4) + c[1].length + e;
					c[2] = c[2].substring(0, e), c[0] = c[0].substring(0, l).trim(), c[3] = "";
				}
			}
			let l = c[2], u = "";
			if (this.options.pedantic) {
				let e = this.rules.other.pedanticHrefTitle.exec(l);
				e && (l = e[1], u = e[3]);
			} else u = c[3] ? c[3].slice(1, -1) : "";
			return l = l.trim(), this.rules.other.startAngleBracket.test(l) && (l = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? l.slice(1) : l.slice(1, -1)), me(c, {
				href: l && l.replace(this.rules.inline.anyPunctuation, "$1"),
				title: u && u.replace(this.rules.inline.anyPunctuation, "$1")
			}, c[0], this.lexer, this.rules);
		}
	}
	reflink(e, c) {
		let l;
		if ((l = this.rules.inline.reflink.exec(e)) || (l = this.rules.inline.nolink.exec(e))) {
			let e = c[(l[2] || l[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
			if (!e) {
				let e = l[0].charAt(0);
				return {
					type: "text",
					raw: e,
					text: e
				};
			}
			return me(l, e, l[0], this.lexer, this.rules);
		}
	}
	emStrong(e, c, l = "") {
		let u = this.rules.inline.emStrongLDelim.exec(e);
		if (!(!u || u[3] && l.match(this.rules.other.unicodeAlphaNumeric)) && (!(u[1] || u[2]) || !l || this.rules.inline.punctuation.exec(l))) {
			let l = [...u[0]].length - 1, d, f, p = l, h = 0, S = u[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
			for (S.lastIndex = 0, c = c.slice(-1 * e.length + l); (u = S.exec(c)) != null;) {
				if (d = u[1] || u[2] || u[3] || u[4] || u[5] || u[6], !d) continue;
				if (f = [...d].length, u[3] || u[4]) {
					p += f;
					continue;
				} else if ((u[5] || u[6]) && l % 3 && !((l + f) % 3)) {
					h += f;
					continue;
				}
				if (p -= f, p > 0) continue;
				f = Math.min(f, f + p + h);
				let c = [...u[0]][0].length, S = e.slice(0, l + u.index + c + f);
				if (Math.min(l, f) % 2) {
					let e = S.slice(1, -1);
					return {
						type: "em",
						raw: S,
						text: e,
						tokens: this.lexer.inlineTokens(e)
					};
				}
				let A = S.slice(2, -2);
				return {
					type: "strong",
					raw: S,
					text: A,
					tokens: this.lexer.inlineTokens(A)
				};
			}
		}
	}
	codespan(e) {
		let c = this.rules.inline.code.exec(e);
		if (c) {
			let e = c[2].replace(this.rules.other.newLineCharGlobal, " "), l = this.rules.other.nonSpaceChar.test(e), u = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
			return l && u && (e = e.substring(1, e.length - 1)), {
				type: "codespan",
				raw: c[0],
				text: e
			};
		}
	}
	br(e) {
		let c = this.rules.inline.br.exec(e);
		if (c) return {
			type: "br",
			raw: c[0]
		};
	}
	del(e, c, l = "") {
		let u = this.rules.inline.delLDelim.exec(e);
		if (u && (!u[1] || !l || this.rules.inline.punctuation.exec(l))) {
			let l = [...u[0]].length - 1, d, f, p = l, h = this.rules.inline.delRDelim;
			for (h.lastIndex = 0, c = c.slice(-1 * e.length + l); (u = h.exec(c)) != null;) {
				if (d = u[1] || u[2] || u[3] || u[4] || u[5] || u[6], !d || (f = [...d].length, f !== l)) continue;
				if (u[3] || u[4]) {
					p += f;
					continue;
				}
				if (p -= f, p > 0) continue;
				f = Math.min(f, f + p);
				let c = [...u[0]][0].length, h = e.slice(0, l + u.index + c + f), S = h.slice(l, -l);
				return {
					type: "del",
					raw: h,
					text: S,
					tokens: this.lexer.inlineTokens(S)
				};
			}
		}
	}
	autolink(e) {
		let c = this.rules.inline.autolink.exec(e);
		if (c) {
			let e, l;
			return c[2] === "@" ? (e = c[1], l = "mailto:" + e) : (e = c[1], l = e), {
				type: "link",
				raw: c[0],
				text: e,
				href: l,
				tokens: [{
					type: "text",
					raw: e,
					text: e
				}]
			};
		}
	}
	url(e) {
		let c;
		if (c = this.rules.inline.url.exec(e)) {
			let e, l;
			if (c[2] === "@") e = c[0], l = "mailto:" + e;
			else {
				let u;
				do
					u = c[0], c[0] = this.rules.inline._backpedal.exec(c[0])?.[0] ?? "";
				while (u !== c[0]);
				e = c[0], l = c[1] === "www." ? "http://" + c[0] : c[0];
			}
			return {
				type: "link",
				raw: c[0],
				text: e,
				href: l,
				tokens: [{
					type: "text",
					raw: e,
					text: e
				}]
			};
		}
	}
	inlineText(e) {
		let c = this.rules.inline.text.exec(e);
		if (c) {
			let e = this.lexer.state.inRawBlock;
			return {
				type: "text",
				raw: c[0],
				text: c[0],
				escaped: e
			};
		}
	}
}, x = class e {
	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: !1,
			inRawBlock: !1,
			top: !0
		};
		let l = {
			other: m,
			block: E.normal,
			inline: z.normal
		};
		this.options.pedantic ? (l.block = E.pedantic, l.inline = z.pedantic) : this.options.gfm && (l.block = E.gfm, this.options.breaks ? l.inline = z.breaks : l.inline = z.gfm), this.tokenizer.rules = l;
	}
	static get rules() {
		return {
			block: E,
			inline: z
		};
	}
	static lex(c, l) {
		return new e(l).lex(c);
	}
	static lexInline(c, l) {
		return new e(l).inlineTokens(c);
	}
	lex(e) {
		e = e.replace(m.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
		for (let e = 0; e < this.inlineQueue.length; e++) {
			let c = this.inlineQueue[e];
			this.inlineTokens(c.src, c.tokens);
		}
		return this.inlineQueue = [], this.tokens;
	}
	blockTokens(e, c = [], l = !1) {
		for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, "    ").replace(m.spaceLine, "")); e;) {
			let u;
			if (this.options.extensions?.block?.some((l) => (u = l.call({ lexer: this }, e, c)) ? (e = e.substring(u.raw.length), c.push(u), !0) : !1)) continue;
			if (u = this.tokenizer.space(e)) {
				e = e.substring(u.raw.length);
				let l = c.at(-1);
				u.raw.length === 1 && l !== void 0 ? l.raw += "\n" : c.push(u);
				continue;
			}
			if (u = this.tokenizer.code(e)) {
				e = e.substring(u.raw.length);
				let l = c.at(-1);
				l?.type === "paragraph" || l?.type === "text" ? (l.raw += (l.raw.endsWith("\n") ? "" : "\n") + u.raw, l.text += "\n" + u.text, this.inlineQueue.at(-1).src = l.text) : c.push(u);
				continue;
			}
			if (u = this.tokenizer.fences(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.heading(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.hr(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.blockquote(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.list(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.html(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.def(e)) {
				e = e.substring(u.raw.length);
				let l = c.at(-1);
				l?.type === "paragraph" || l?.type === "text" ? (l.raw += (l.raw.endsWith("\n") ? "" : "\n") + u.raw, l.text += "\n" + u.raw, this.inlineQueue.at(-1).src = l.text) : this.tokens.links[u.tag] || (this.tokens.links[u.tag] = {
					href: u.href,
					title: u.title
				}, c.push(u));
				continue;
			}
			if (u = this.tokenizer.table(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.lheading(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			let d = e;
			if (this.options.extensions?.startBlock) {
				let c = Infinity, l = e.slice(1), u;
				this.options.extensions.startBlock.forEach((e) => {
					u = e.call({ lexer: this }, l), typeof u == "number" && u >= 0 && (c = Math.min(c, u));
				}), c < Infinity && c >= 0 && (d = e.substring(0, c + 1));
			}
			if (this.state.top && (u = this.tokenizer.paragraph(d))) {
				let f = c.at(-1);
				l && f?.type === "paragraph" ? (f.raw += (f.raw.endsWith("\n") ? "" : "\n") + u.raw, f.text += "\n" + u.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = f.text) : c.push(u), l = d.length !== e.length, e = e.substring(u.raw.length);
				continue;
			}
			if (u = this.tokenizer.text(e)) {
				e = e.substring(u.raw.length);
				let l = c.at(-1);
				l?.type === "text" ? (l.raw += (l.raw.endsWith("\n") ? "" : "\n") + u.raw, l.text += "\n" + u.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : c.push(u);
				continue;
			}
			if (e) {
				let c = "Infinite loop on byte: " + e.charCodeAt(0);
				if (this.options.silent) {
					console.error(c);
					break;
				} else throw Error(c);
			}
		}
		return this.state.top = !0, c;
	}
	inline(e, c = []) {
		return this.inlineQueue.push({
			src: e,
			tokens: c
		}), c;
	}
	inlineTokens(e, c = []) {
		let l = e, u = null;
		if (this.tokens.links) {
			let e = Object.keys(this.tokens.links);
			if (e.length > 0) for (; (u = this.tokenizer.rules.inline.reflinkSearch.exec(l)) != null;) e.includes(u[0].slice(u[0].lastIndexOf("[") + 1, -1)) && (l = l.slice(0, u.index) + "[" + "a".repeat(u[0].length - 2) + "]" + l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
		}
		for (; (u = this.tokenizer.rules.inline.anyPunctuation.exec(l)) != null;) l = l.slice(0, u.index) + "++" + l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
		let d;
		for (; (u = this.tokenizer.rules.inline.blockSkip.exec(l)) != null;) d = u[2] ? u[2].length : 0, l = l.slice(0, u.index + d) + "[" + "a".repeat(u[0].length - d - 2) + "]" + l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
		l = this.options.hooks?.emStrongMask?.call({ lexer: this }, l) ?? l;
		let f = !1, p = "";
		for (; e;) {
			f || (p = ""), f = !1;
			let u;
			if (this.options.extensions?.inline?.some((l) => (u = l.call({ lexer: this }, e, c)) ? (e = e.substring(u.raw.length), c.push(u), !0) : !1)) continue;
			if (u = this.tokenizer.escape(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.tag(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.link(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.reflink(e, this.tokens.links)) {
				e = e.substring(u.raw.length);
				let l = c.at(-1);
				u.type === "text" && l?.type === "text" ? (l.raw += u.raw, l.text += u.text) : c.push(u);
				continue;
			}
			if (u = this.tokenizer.emStrong(e, l, p)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.codespan(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.br(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.del(e, l, p)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (u = this.tokenizer.autolink(e)) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			if (!this.state.inLink && (u = this.tokenizer.url(e))) {
				e = e.substring(u.raw.length), c.push(u);
				continue;
			}
			let d = e;
			if (this.options.extensions?.startInline) {
				let c = Infinity, l = e.slice(1), u;
				this.options.extensions.startInline.forEach((e) => {
					u = e.call({ lexer: this }, l), typeof u == "number" && u >= 0 && (c = Math.min(c, u));
				}), c < Infinity && c >= 0 && (d = e.substring(0, c + 1));
			}
			if (u = this.tokenizer.inlineText(d)) {
				e = e.substring(u.raw.length), u.raw.slice(-1) !== "_" && (p = u.raw.slice(-1)), f = !0;
				let l = c.at(-1);
				l?.type === "text" ? (l.raw += u.raw, l.text += u.text) : c.push(u);
				continue;
			}
			if (e) {
				let c = "Infinite loop on byte: " + e.charCodeAt(0);
				if (this.options.silent) {
					console.error(c);
					break;
				} else throw Error(c);
			}
		}
		return c;
	}
}, y = class {
	options;
	parser;
	constructor(e) {
		this.options = e || T;
	}
	space(e) {
		return "";
	}
	code({ text: e, lang: c, escaped: l }) {
		let u = (c || "").match(m.notSpaceStart)?.[0], d = e.replace(m.endingNewline, "") + "\n";
		return u ? "<pre><code class=\"language-" + O(u) + "\">" + (l ? d : O(d, !0)) + "</code></pre>\n" : "<pre><code>" + (l ? d : O(d, !0)) + "</code></pre>\n";
	}
	blockquote({ tokens: e }) {
		return `<blockquote>
${this.parser.parse(e)}</blockquote>
`;
	}
	html({ text: e }) {
		return e;
	}
	def(e) {
		return "";
	}
	heading({ tokens: e, depth: c }) {
		return `<h${c}>${this.parser.parseInline(e)}</h${c}>
`;
	}
	hr(e) {
		return "<hr>\n";
	}
	list(e) {
		let c = e.ordered, l = e.start, u = "";
		for (let c = 0; c < e.items.length; c++) {
			let l = e.items[c];
			u += this.listitem(l);
		}
		let d = c ? "ol" : "ul", f = c && l !== 1 ? " start=\"" + l + "\"" : "";
		return "<" + d + f + ">\n" + u + "</" + d + ">\n";
	}
	listitem(e) {
		return `<li>${this.parser.parse(e.tokens)}</li>
`;
	}
	checkbox({ checked: e }) {
		return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
	}
	paragraph({ tokens: e }) {
		return `<p>${this.parser.parseInline(e)}</p>
`;
	}
	table(e) {
		let c = "", l = "";
		for (let c = 0; c < e.header.length; c++) l += this.tablecell(e.header[c]);
		c += this.tablerow({ text: l });
		let u = "";
		for (let c = 0; c < e.rows.length; c++) {
			let d = e.rows[c];
			l = "";
			for (let e = 0; e < d.length; e++) l += this.tablecell(d[e]);
			u += this.tablerow({ text: l });
		}
		return u &&= `<tbody>${u}</tbody>`, "<table>\n<thead>\n" + c + "</thead>\n" + u + "</table>\n";
	}
	tablerow({ text: e }) {
		return `<tr>
${e}</tr>
`;
	}
	tablecell(e) {
		let c = this.parser.parseInline(e.tokens), l = e.header ? "th" : "td";
		return (e.align ? `<${l} align="${e.align}">` : `<${l}>`) + c + `</${l}>
`;
	}
	strong({ tokens: e }) {
		return `<strong>${this.parser.parseInline(e)}</strong>`;
	}
	em({ tokens: e }) {
		return `<em>${this.parser.parseInline(e)}</em>`;
	}
	codespan({ text: e }) {
		return `<code>${O(e, !0)}</code>`;
	}
	br(e) {
		return "<br>";
	}
	del({ tokens: e }) {
		return `<del>${this.parser.parseInline(e)}</del>`;
	}
	link({ href: e, title: c, tokens: l }) {
		let u = this.parser.parseInline(l), d = X(e);
		if (d === null) return u;
		e = d;
		let f = "<a href=\"" + e + "\"";
		return c && (f += " title=\"" + O(c) + "\""), f += ">" + u + "</a>", f;
	}
	image({ href: e, title: c, text: l, tokens: u }) {
		u && (l = this.parser.parseInline(u, this.parser.textRenderer));
		let d = X(e);
		if (d === null) return O(l);
		e = d;
		let f = `<img src="${e}" alt="${O(l)}"`;
		return c && (f += ` title="${O(c)}"`), f += ">", f;
	}
	text(e) {
		return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
	}
}, $ = class {
	strong({ text: e }) {
		return e;
	}
	em({ text: e }) {
		return e;
	}
	codespan({ text: e }) {
		return e;
	}
	del({ text: e }) {
		return e;
	}
	html({ text: e }) {
		return e;
	}
	text({ text: e }) {
		return e;
	}
	link({ text: e }) {
		return "" + e;
	}
	image({ text: e }) {
		return "" + e;
	}
	br() {
		return "";
	}
	checkbox({ raw: e }) {
		return e;
	}
}, b = class e {
	options;
	renderer;
	textRenderer;
	constructor(e) {
		this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
	}
	static parse(c, l) {
		return new e(l).parse(c);
	}
	static parseInline(c, l) {
		return new e(l).parseInline(c);
	}
	parse(e) {
		let c = "";
		for (let l = 0; l < e.length; l++) {
			let u = e[l];
			if (this.options.extensions?.renderers?.[u.type]) {
				let e = u, l = this.options.extensions.renderers[e.type].call({ parser: this }, e);
				if (l !== !1 || ![
					"space",
					"hr",
					"heading",
					"code",
					"table",
					"blockquote",
					"list",
					"html",
					"def",
					"paragraph",
					"text"
				].includes(e.type)) {
					c += l || "";
					continue;
				}
			}
			let d = u;
			switch (d.type) {
				case "space":
					c += this.renderer.space(d);
					break;
				case "hr":
					c += this.renderer.hr(d);
					break;
				case "heading":
					c += this.renderer.heading(d);
					break;
				case "code":
					c += this.renderer.code(d);
					break;
				case "table":
					c += this.renderer.table(d);
					break;
				case "blockquote":
					c += this.renderer.blockquote(d);
					break;
				case "list":
					c += this.renderer.list(d);
					break;
				case "checkbox":
					c += this.renderer.checkbox(d);
					break;
				case "html":
					c += this.renderer.html(d);
					break;
				case "def":
					c += this.renderer.def(d);
					break;
				case "paragraph":
					c += this.renderer.paragraph(d);
					break;
				case "text":
					c += this.renderer.text(d);
					break;
				default: {
					let e = "Token with \"" + d.type + "\" type was not found.";
					if (this.options.silent) return console.error(e), "";
					throw Error(e);
				}
			}
		}
		return c;
	}
	parseInline(e, c = this.renderer) {
		let l = "";
		for (let u = 0; u < e.length; u++) {
			let d = e[u];
			if (this.options.extensions?.renderers?.[d.type]) {
				let e = this.options.extensions.renderers[d.type].call({ parser: this }, d);
				if (e !== !1 || ![
					"escape",
					"html",
					"link",
					"image",
					"strong",
					"em",
					"codespan",
					"br",
					"del",
					"text"
				].includes(d.type)) {
					l += e || "";
					continue;
				}
			}
			let f = d;
			switch (f.type) {
				case "escape":
					l += c.text(f);
					break;
				case "html":
					l += c.html(f);
					break;
				case "link":
					l += c.link(f);
					break;
				case "image":
					l += c.image(f);
					break;
				case "checkbox":
					l += c.checkbox(f);
					break;
				case "strong":
					l += c.strong(f);
					break;
				case "em":
					l += c.em(f);
					break;
				case "codespan":
					l += c.codespan(f);
					break;
				case "br":
					l += c.br(f);
					break;
				case "del":
					l += c.del(f);
					break;
				case "text":
					l += c.text(f);
					break;
				default: {
					let e = "Token with \"" + f.type + "\" type was not found.";
					if (this.options.silent) return console.error(e), "";
					throw Error(e);
				}
			}
		}
		return l;
	}
}, P = class {
	options;
	block;
	constructor(e) {
		this.options = e || T;
	}
	static passThroughHooks = new Set([
		"preprocess",
		"postprocess",
		"processAllTokens",
		"emStrongMask"
	]);
	static passThroughHooksRespectAsync = new Set([
		"preprocess",
		"postprocess",
		"processAllTokens"
	]);
	preprocess(e) {
		return e;
	}
	postprocess(e) {
		return e;
	}
	processAllTokens(e) {
		return e;
	}
	emStrongMask(e) {
		return e;
	}
	provideLexer() {
		return this.block ? x.lex : x.lexInline;
	}
	provideParser() {
		return this.block ? b.parse : b.parseInline;
	}
}, L = new class {
	defaults = M();
	options = this.setOptions;
	parse = this.parseMarkdown(!0);
	parseInline = this.parseMarkdown(!1);
	Parser = b;
	Renderer = y;
	TextRenderer = $;
	Lexer = x;
	Tokenizer = w;
	Hooks = P;
	constructor(...e) {
		this.use(...e);
	}
	walkTokens(e, c) {
		let l = [];
		for (let u of e) switch (l = l.concat(c.call(this, u)), u.type) {
			case "table": {
				let e = u;
				for (let u of e.header) l = l.concat(this.walkTokens(u.tokens, c));
				for (let u of e.rows) for (let e of u) l = l.concat(this.walkTokens(e.tokens, c));
				break;
			}
			case "list": {
				let e = u;
				l = l.concat(this.walkTokens(e.items, c));
				break;
			}
			default: {
				let e = u;
				this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((u) => {
					let d = e[u].flat(Infinity);
					l = l.concat(this.walkTokens(d, c));
				}) : e.tokens && (l = l.concat(this.walkTokens(e.tokens, c)));
			}
		}
		return l;
	}
	use(...e) {
		let c = this.defaults.extensions || {
			renderers: {},
			childTokens: {}
		};
		return e.forEach((e) => {
			let l = { ...e };
			if (l.async = this.defaults.async || l.async || !1, e.extensions && (e.extensions.forEach((e) => {
				if (!e.name) throw Error("extension name required");
				if ("renderer" in e) {
					let l = c.renderers[e.name];
					l ? c.renderers[e.name] = function(...c) {
						let u = e.renderer.apply(this, c);
						return u === !1 && (u = l.apply(this, c)), u;
					} : c.renderers[e.name] = e.renderer;
				}
				if ("tokenizer" in e) {
					if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
					let l = c[e.level];
					l ? l.unshift(e.tokenizer) : c[e.level] = [e.tokenizer], e.start && (e.level === "block" ? c.startBlock ? c.startBlock.push(e.start) : c.startBlock = [e.start] : e.level === "inline" && (c.startInline ? c.startInline.push(e.start) : c.startInline = [e.start]));
				}
				"childTokens" in e && e.childTokens && (c.childTokens[e.name] = e.childTokens);
			}), l.extensions = c), e.renderer) {
				let c = this.defaults.renderer || new y(this.defaults);
				for (let l in e.renderer) {
					if (!(l in c)) throw Error(`renderer '${l}' does not exist`);
					if (["options", "parser"].includes(l)) continue;
					let u = l, d = e.renderer[u], f = c[u];
					c[u] = (...e) => {
						let l = d.apply(c, e);
						return l === !1 && (l = f.apply(c, e)), l || "";
					};
				}
				l.renderer = c;
			}
			if (e.tokenizer) {
				let c = this.defaults.tokenizer || new w(this.defaults);
				for (let l in e.tokenizer) {
					if (!(l in c)) throw Error(`tokenizer '${l}' does not exist`);
					if ([
						"options",
						"rules",
						"lexer"
					].includes(l)) continue;
					let u = l, d = e.tokenizer[u], f = c[u];
					c[u] = (...e) => {
						let l = d.apply(c, e);
						return l === !1 && (l = f.apply(c, e)), l;
					};
				}
				l.tokenizer = c;
			}
			if (e.hooks) {
				let c = this.defaults.hooks || new P();
				for (let l in e.hooks) {
					if (!(l in c)) throw Error(`hook '${l}' does not exist`);
					if (["options", "block"].includes(l)) continue;
					let u = l, d = e.hooks[u], f = c[u];
					P.passThroughHooks.has(l) ? c[u] = (e) => {
						if (this.defaults.async && P.passThroughHooksRespectAsync.has(l)) return (async () => {
							let l = await d.call(c, e);
							return f.call(c, l);
						})();
						let u = d.call(c, e);
						return f.call(c, u);
					} : c[u] = (...e) => {
						if (this.defaults.async) return (async () => {
							let l = await d.apply(c, e);
							return l === !1 && (l = await f.apply(c, e)), l;
						})();
						let l = d.apply(c, e);
						return l === !1 && (l = f.apply(c, e)), l;
					};
				}
				l.hooks = c;
			}
			if (e.walkTokens) {
				let c = this.defaults.walkTokens, u = e.walkTokens;
				l.walkTokens = function(e) {
					let l = [];
					return l.push(u.call(this, e)), c && (l = l.concat(c.call(this, e))), l;
				};
			}
			this.defaults = {
				...this.defaults,
				...l
			};
		}), this;
	}
	setOptions(e) {
		return this.defaults = {
			...this.defaults,
			...e
		}, this;
	}
	lexer(e, c) {
		return x.lex(e, c ?? this.defaults);
	}
	parser(e, c) {
		return b.parse(e, c ?? this.defaults);
	}
	parseMarkdown(e) {
		return (c, l) => {
			let u = { ...l }, d = {
				...this.defaults,
				...u
			}, f = this.onError(!!d.silent, !!d.async);
			if (this.defaults.async === !0 && u.async === !1) return f(/* @__PURE__ */ Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
			if (typeof c > "u" || c === null) return f(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
			if (typeof c != "string") return f(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(c) + ", string expected"));
			if (d.hooks && (d.hooks.options = d, d.hooks.block = e), d.async) return (async () => {
				let l = d.hooks ? await d.hooks.preprocess(c) : c, u = await (d.hooks ? await d.hooks.provideLexer() : e ? x.lex : x.lexInline)(l, d), f = d.hooks ? await d.hooks.processAllTokens(u) : u;
				d.walkTokens && await Promise.all(this.walkTokens(f, d.walkTokens));
				let p = await (d.hooks ? await d.hooks.provideParser() : e ? b.parse : b.parseInline)(f, d);
				return d.hooks ? await d.hooks.postprocess(p) : p;
			})().catch(f);
			try {
				d.hooks && (c = d.hooks.preprocess(c));
				let l = (d.hooks ? d.hooks.provideLexer() : e ? x.lex : x.lexInline)(c, d);
				d.hooks && (l = d.hooks.processAllTokens(l)), d.walkTokens && this.walkTokens(l, d.walkTokens);
				let u = (d.hooks ? d.hooks.provideParser() : e ? b.parse : b.parseInline)(l, d);
				return d.hooks && (u = d.hooks.postprocess(u)), u;
			} catch (e) {
				return f(e);
			}
		};
	}
	onError(e, c) {
		return (l) => {
			if (l.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
				let e = "<p>An error occurred:</p><pre>" + O(l.message + "", !0) + "</pre>";
				return c ? Promise.resolve(e) : e;
			}
			if (c) return Promise.reject(l);
			throw l;
		};
	}
}();
function g(e, c) {
	return L.parse(e, c);
}
g.options = g.setOptions = function(e) {
	return L.setOptions(e), g.defaults = L.defaults, H(g.defaults), g;
}, g.getDefaults = M, g.defaults = T, g.use = function(...e) {
	return L.use(...e), g.defaults = L.defaults, H(g.defaults), g;
}, g.walkTokens = function(e, c) {
	return L.walkTokens(e, c);
}, g.parseInline = L.parseInline, g.Parser = b, g.parser = b.parse, g.Renderer = y, g.TextRenderer = $, g.Lexer = x, g.lexer = x.lex, g.Tokenizer = w, g.Hooks = P, g.parse = g, g.options, g.setOptions, g.use, g.walkTokens, g.parseInline, b.parse, x.lex;
export { x };
