@powerlines/plugin-marked 0.1.203 → 0.1.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,6 +1,1487 @@
1
+ import "./plugin-C3MaN5jp.mjs";
2
+ import "./types-CTUnla4x.mjs";
1
3
  import defu from "defu";
2
- import { marked } from "marked";
3
4
 
5
+ //#region ../../node_modules/.pnpm/marked@17.0.1/node_modules/marked/lib/marked.esm.js
6
+ /**
7
+ * marked v17.0.1 - a markdown parser
8
+ * Copyright (c) 2018-2025, MarkedJS. (MIT License)
9
+ * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
10
+ * https://github.com/markedjs/marked
11
+ */
12
+ /**
13
+ * DO NOT EDIT THIS FILE
14
+ * The code in this file is generated from files in ./src/
15
+ */
16
+ function L() {
17
+ return {
18
+ async: !1,
19
+ breaks: !1,
20
+ extensions: null,
21
+ gfm: !0,
22
+ hooks: null,
23
+ pedantic: !1,
24
+ renderer: null,
25
+ silent: !1,
26
+ tokenizer: null,
27
+ walkTokens: null
28
+ };
29
+ }
30
+ var T = L();
31
+ function Z(u) {
32
+ T = u;
33
+ }
34
+ var C = { exec: () => null };
35
+ function k(u, e = "") {
36
+ let t = typeof u == "string" ? u : u.source, n = {
37
+ replace: (r, i) => {
38
+ let s = typeof i == "string" ? i : i.source;
39
+ return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
40
+ },
41
+ getRegex: () => new RegExp(t, e)
42
+ };
43
+ return n;
44
+ }
45
+ var me = (() => {
46
+ try {
47
+ return true;
48
+ } catch {
49
+ return !1;
50
+ }
51
+ })(), m = {
52
+ codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
53
+ outputLinkReplace: /\\([\[\]])/g,
54
+ indentCodeCompensation: /^(\s+)(?:```)/,
55
+ beginningSpace: /^\s+/,
56
+ endingHash: /#$/,
57
+ startingSpaceChar: /^ /,
58
+ endingSpaceChar: / $/,
59
+ nonSpaceChar: /[^ ]/,
60
+ newLineCharGlobal: /\n/g,
61
+ tabCharGlobal: /\t/g,
62
+ multipleSpaceGlobal: /\s+/g,
63
+ blankLine: /^[ \t]*$/,
64
+ doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
65
+ blockquoteStart: /^ {0,3}>/,
66
+ blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
67
+ blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
68
+ listReplaceTabs: /^\t+/,
69
+ listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
70
+ listIsTask: /^\[[ xX]\] +\S/,
71
+ listReplaceTask: /^\[[ xX]\] +/,
72
+ listTaskCheckbox: /\[[ xX]\]/,
73
+ anyLine: /\n.*\n/,
74
+ hrefBrackets: /^<(.*)>$/,
75
+ tableDelimiter: /[:|]/,
76
+ tableAlignChars: /^\||\| *$/g,
77
+ tableRowBlankLine: /\n[ \t]*$/,
78
+ tableAlignRight: /^ *-+: *$/,
79
+ tableAlignCenter: /^ *:-+: *$/,
80
+ tableAlignLeft: /^ *:-+ *$/,
81
+ startATag: /^<a /i,
82
+ endATag: /^<\/a>/i,
83
+ startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
84
+ endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
85
+ startAngleBracket: /^</,
86
+ endAngleBracket: />$/,
87
+ pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
88
+ unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
89
+ escapeTest: /[&<>"']/,
90
+ escapeReplace: /[&<>"']/g,
91
+ escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
92
+ escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
93
+ unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,
94
+ caret: /(^|[^\[])\^/g,
95
+ percentDecode: /%25/g,
96
+ findPipe: /\|/g,
97
+ splitPipe: / \|/,
98
+ slashPipe: /\\\|/g,
99
+ carriageReturn: /\r\n|\r/g,
100
+ spaceLine: /^ +$/gm,
101
+ notSpaceStart: /^\S*/,
102
+ endingNewline: /\n$/,
103
+ listItemRegex: (u) => /* @__PURE__ */ new RegExp(`^( {0,3}${u})((?:[ ][^\\n]*)?(?:\\n|$))`),
104
+ nextBulletRegex: (u) => /* @__PURE__ */ new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
105
+ hrRegex: (u) => /* @__PURE__ */ new RegExp(`^ {0,${Math.min(3, u - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
106
+ fencesBeginRegex: (u) => /* @__PURE__ */ new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:\`\`\`|~~~)`),
107
+ headingBeginRegex: (u) => /* @__PURE__ */ new RegExp(`^ {0,${Math.min(3, u - 1)}}#`),
108
+ htmlBeginRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}<(?:[a-z].*>|!--)`, "i")
109
+ }, xe = /^(?:[ \t]*(?:\n|$))+/, be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Re = /^ {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+|$)/, Te = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, N = /(?:[*+-]|\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(), Oe = 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]+)*)/, we = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ye = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Pe = k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).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", j = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Se = 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", v).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), U = {
110
+ blockquote: k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex(),
111
+ code: be,
112
+ def: ye,
113
+ fences: Re,
114
+ heading: Te,
115
+ hr: I,
116
+ html: Se,
117
+ lheading: se,
118
+ list: Pe,
119
+ newline: xe,
120
+ paragraph: ie,
121
+ table: C,
122
+ text: we
123
+ }, 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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), _e = {
124
+ ...U,
125
+ lheading: Oe,
126
+ table: te,
127
+ 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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex()
128
+ }, Le = {
129
+ ...U,
130
+ 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(),
131
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
132
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
133
+ fences: C,
134
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
135
+ paragraph: k(Q).replace("hr", I).replace("heading", ` *#{1,6} *[^
136
+ ]`).replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
137
+ }, Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, oe = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, K = /[\s\p{P}\p{S}]/u, ae = /[^\s\p{P}\p{S}]/u, Ce = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex(), le = /(?!~)[\p{P}\p{S}]/u, Ie = /(?!~)[\s\p{P}\p{S}]/u, Ee = /(?:[^\s\p{P}\p{S}]|~)/u, Be = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", me ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qe = k(ue, "u").replace(/punct/g, D).getRegex(), ve = k(ue, "u").replace(/punct/g, le).getRegex(), pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De = k(pe, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(), He = k(pe, "gu").replace(/notPunctSpace/g, Ee).replace(/punctSpace/g, Ie).replace(/punct/g, le).getRegex(), Ze = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, D).getRegex(), Ge = k(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), Ne = 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(), Qe = k(j).replace("(?:-->|$)", "-->").getRegex(), Fe = 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", Qe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ce = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), he = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ue = k("reflink|nolink(?!\\()", "g").replace("reflink", ce).replace("nolink", he).getRegex(), ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, W = {
138
+ _backpedal: C,
139
+ anyPunctuation: Ge,
140
+ autolink: Ne,
141
+ blockSkip: Be,
142
+ br: oe,
143
+ code: ze,
144
+ del: C,
145
+ emStrongLDelim: qe,
146
+ emStrongRDelimAst: De,
147
+ emStrongRDelimUnd: Ze,
148
+ escape: Me,
149
+ link: je,
150
+ nolink: he,
151
+ punctuation: Ce,
152
+ reflink: ce,
153
+ reflinkSearch: Ue,
154
+ tag: Fe,
155
+ text: Ae,
156
+ url: C
157
+ }, Ke = {
158
+ ...W,
159
+ link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
160
+ reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
161
+ }, G = {
162
+ ...W,
163
+ emStrongRDelimAst: He,
164
+ emStrongLDelim: ve,
165
+ 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(),
166
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
167
+ del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
168
+ 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()
169
+ }, We = {
170
+ ...G,
171
+ br: k(oe).replace("{2,}", "*").getRegex(),
172
+ text: k(G.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
173
+ }, E = {
174
+ normal: U,
175
+ gfm: _e,
176
+ pedantic: Le
177
+ }, M = {
178
+ normal: W,
179
+ gfm: G,
180
+ breaks: We,
181
+ pedantic: Ke
182
+ };
183
+ var Xe = {
184
+ "&": "&amp;",
185
+ "<": "&lt;",
186
+ ">": "&gt;",
187
+ "\"": "&quot;",
188
+ "'": "&#39;"
189
+ }, ke = (u) => Xe[u];
190
+ function w(u, e) {
191
+ if (e) {
192
+ if (m.escapeTest.test(u)) return u.replace(m.escapeReplace, ke);
193
+ } else if (m.escapeTestNoEncode.test(u)) return u.replace(m.escapeReplaceNoEncode, ke);
194
+ return u;
195
+ }
196
+ function X(u) {
197
+ try {
198
+ u = encodeURI(u).replace(m.percentDecode, "%");
199
+ } catch {
200
+ return null;
201
+ }
202
+ return u;
203
+ }
204
+ function J(u, e) {
205
+ let n = u.replace(m.findPipe, (i, s, a) => {
206
+ let o = !1, l = s;
207
+ for (; --l >= 0 && a[l] === "\\";) o = !o;
208
+ return o ? "|" : " |";
209
+ }).split(m.splitPipe), r = 0;
210
+ if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
211
+ else for (; n.length < e;) n.push("");
212
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
213
+ return n;
214
+ }
215
+ function z(u, e, t) {
216
+ let n = u.length;
217
+ if (n === 0) return "";
218
+ let r = 0;
219
+ for (; r < n;) {
220
+ let i = u.charAt(n - r - 1);
221
+ if (i === e && !t) r++;
222
+ else if (i !== e && t) r++;
223
+ else break;
224
+ }
225
+ return u.slice(0, n - r);
226
+ }
227
+ function de(u, e) {
228
+ if (u.indexOf(e[1]) === -1) return -1;
229
+ let t = 0;
230
+ for (let n = 0; n < u.length; n++) if (u[n] === "\\") n++;
231
+ else if (u[n] === e[0]) t++;
232
+ else if (u[n] === e[1] && (t--, t < 0)) return n;
233
+ return t > 0 ? -2 : -1;
234
+ }
235
+ function ge(u, e, t, n, r) {
236
+ let i = e.href, s = e.title || null, a = u[1].replace(r.other.outputLinkReplace, "$1");
237
+ n.state.inLink = !0;
238
+ let o = {
239
+ type: u[0].charAt(0) === "!" ? "image" : "link",
240
+ raw: t,
241
+ href: i,
242
+ title: s,
243
+ text: a,
244
+ tokens: n.inlineTokens(a)
245
+ };
246
+ return n.state.inLink = !1, o;
247
+ }
248
+ function Je(u, e, t) {
249
+ let n = u.match(t.other.indentCodeCompensation);
250
+ if (n === null) return e;
251
+ let r = n[1];
252
+ return e.split(`
253
+ `).map((i) => {
254
+ let s = i.match(t.other.beginningSpace);
255
+ if (s === null) return i;
256
+ let [a] = s;
257
+ return a.length >= r.length ? i.slice(r.length) : i;
258
+ }).join(`
259
+ `);
260
+ }
261
+ var y = class {
262
+ options;
263
+ rules;
264
+ lexer;
265
+ constructor(e) {
266
+ this.options = e || T;
267
+ }
268
+ space(e) {
269
+ let t = this.rules.block.newline.exec(e);
270
+ if (t && t[0].length > 0) return {
271
+ type: "space",
272
+ raw: t[0]
273
+ };
274
+ }
275
+ code(e) {
276
+ let t = this.rules.block.code.exec(e);
277
+ if (t) {
278
+ let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
279
+ return {
280
+ type: "code",
281
+ raw: t[0],
282
+ codeBlockStyle: "indented",
283
+ text: this.options.pedantic ? n : z(n, `
284
+ `)
285
+ };
286
+ }
287
+ }
288
+ fences(e) {
289
+ let t = this.rules.block.fences.exec(e);
290
+ if (t) {
291
+ let n = t[0], r = Je(n, t[3] || "", this.rules);
292
+ return {
293
+ type: "code",
294
+ raw: n,
295
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
296
+ text: r
297
+ };
298
+ }
299
+ }
300
+ heading(e) {
301
+ let t = this.rules.block.heading.exec(e);
302
+ if (t) {
303
+ let n = t[2].trim();
304
+ if (this.rules.other.endingHash.test(n)) {
305
+ let r = z(n, "#");
306
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
307
+ }
308
+ return {
309
+ type: "heading",
310
+ raw: t[0],
311
+ depth: t[1].length,
312
+ text: n,
313
+ tokens: this.lexer.inline(n)
314
+ };
315
+ }
316
+ }
317
+ hr(e) {
318
+ let t = this.rules.block.hr.exec(e);
319
+ if (t) return {
320
+ type: "hr",
321
+ raw: z(t[0], `
322
+ `)
323
+ };
324
+ }
325
+ blockquote(e) {
326
+ let t = this.rules.block.blockquote.exec(e);
327
+ if (t) {
328
+ let n = z(t[0], `
329
+ `).split(`
330
+ `), r = "", i = "", s = [];
331
+ for (; n.length > 0;) {
332
+ let a = !1, o = [], l;
333
+ for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = !0;
334
+ else if (!a) o.push(n[l]);
335
+ else break;
336
+ n = n.slice(l);
337
+ let p = o.join(`
338
+ `), c = p.replace(this.rules.other.blockquoteSetextReplace, `
339
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
340
+ r = r ? `${r}
341
+ ${p}` : p, i = i ? `${i}
342
+ ${c}` : c;
343
+ let g = this.lexer.state.top;
344
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(c, s, !0), this.lexer.state.top = g, n.length === 0) break;
345
+ let h = s.at(-1);
346
+ if (h?.type === "code") break;
347
+ if (h?.type === "blockquote") {
348
+ let R = h, f = R.raw + `
349
+ ` + n.join(`
350
+ `), O = this.blockquote(f);
351
+ s[s.length - 1] = O, r = r.substring(0, r.length - R.raw.length) + O.raw, i = i.substring(0, i.length - R.text.length) + O.text;
352
+ break;
353
+ } else if (h?.type === "list") {
354
+ let R = h, f = R.raw + `
355
+ ` + n.join(`
356
+ `), O = this.list(f);
357
+ s[s.length - 1] = O, r = r.substring(0, r.length - h.raw.length) + O.raw, i = i.substring(0, i.length - R.raw.length) + O.raw, n = f.substring(s.at(-1).raw.length).split(`
358
+ `);
359
+ continue;
360
+ }
361
+ }
362
+ return {
363
+ type: "blockquote",
364
+ raw: r,
365
+ tokens: s,
366
+ text: i
367
+ };
368
+ }
369
+ }
370
+ list(e) {
371
+ let t = this.rules.block.list.exec(e);
372
+ if (t) {
373
+ let n = t[1].trim(), r = n.length > 1, i = {
374
+ type: "list",
375
+ raw: "",
376
+ ordered: r,
377
+ start: r ? +n.slice(0, -1) : "",
378
+ loose: !1,
379
+ items: []
380
+ };
381
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
382
+ let s = this.rules.other.listItemRegex(n), a = !1;
383
+ for (; e;) {
384
+ let l = !1, p = "", c = "";
385
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
386
+ p = t[0], e = e.substring(p.length);
387
+ let g = t[2].split(`
388
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (O) => " ".repeat(3 * O.length)), h = e.split(`
389
+ `, 1)[0], R = !g.trim(), f = 0;
390
+ if (this.options.pedantic ? (f = 2, c = g.trimStart()) : R ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = g.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
391
+ `, e = e.substring(h.length + 1), l = !0), !l) {
392
+ let O = this.rules.other.nextBulletRegex(f), V = this.rules.other.hrRegex(f), Y = this.rules.other.fencesBeginRegex(f), ee = this.rules.other.headingBeginRegex(f), fe = this.rules.other.htmlBeginRegex(f);
393
+ for (; e;) {
394
+ let H = e.split(`
395
+ `, 1)[0], A;
396
+ if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), Y.test(h) || ee.test(h) || fe.test(h) || O.test(h) || V.test(h)) break;
397
+ if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
398
+ ` + A.slice(f);
399
+ else {
400
+ if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Y.test(g) || ee.test(g) || V.test(g)) break;
401
+ c += `
402
+ ` + h;
403
+ }
404
+ !R && !h.trim() && (R = !0), p += H + `
405
+ `, e = e.substring(H.length + 1), g = A.slice(f);
406
+ }
407
+ }
408
+ i.loose || (a ? i.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (a = !0)), i.items.push({
409
+ type: "list_item",
410
+ raw: p,
411
+ task: !!this.options.gfm && this.rules.other.listIsTask.test(c),
412
+ loose: !1,
413
+ text: c,
414
+ tokens: []
415
+ }), i.raw += p;
416
+ }
417
+ let o = i.items.at(-1);
418
+ if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
419
+ else return;
420
+ i.raw = i.raw.trimEnd();
421
+ for (let l of i.items) {
422
+ if (this.lexer.state.top = !1, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
423
+ if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), l.tokens[0]?.type === "text" || l.tokens[0]?.type === "paragraph") {
424
+ l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
425
+ for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
426
+ this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
427
+ break;
428
+ }
429
+ }
430
+ let p = this.rules.other.listTaskCheckbox.exec(l.raw);
431
+ if (p) {
432
+ let c = {
433
+ type: "checkbox",
434
+ raw: p[0] + " ",
435
+ checked: p[0] !== "[ ]"
436
+ };
437
+ l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({
438
+ type: "paragraph",
439
+ raw: c.raw,
440
+ text: c.raw,
441
+ tokens: [c]
442
+ }) : l.tokens.unshift(c);
443
+ }
444
+ }
445
+ if (!i.loose) {
446
+ let p = l.tokens.filter((g) => g.type === "space");
447
+ i.loose = p.length > 0 && p.some((g) => this.rules.other.anyLine.test(g.raw));
448
+ }
449
+ }
450
+ if (i.loose) for (let l of i.items) {
451
+ l.loose = !0;
452
+ for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
453
+ }
454
+ return i;
455
+ }
456
+ }
457
+ html(e) {
458
+ let t = this.rules.block.html.exec(e);
459
+ if (t) return {
460
+ type: "html",
461
+ block: !0,
462
+ raw: t[0],
463
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
464
+ text: t[0]
465
+ };
466
+ }
467
+ def(e) {
468
+ let t = this.rules.block.def.exec(e);
469
+ if (t) {
470
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
471
+ return {
472
+ type: "def",
473
+ tag: n,
474
+ raw: t[0],
475
+ href: r,
476
+ title: i
477
+ };
478
+ }
479
+ }
480
+ table(e) {
481
+ let t = this.rules.block.table.exec(e);
482
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
483
+ let n = J(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
484
+ `) : [], s = {
485
+ type: "table",
486
+ raw: t[0],
487
+ header: [],
488
+ align: [],
489
+ rows: []
490
+ };
491
+ if (n.length === r.length) {
492
+ for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
493
+ for (let a = 0; a < n.length; a++) s.header.push({
494
+ text: n[a],
495
+ tokens: this.lexer.inline(n[a]),
496
+ header: !0,
497
+ align: s.align[a]
498
+ });
499
+ for (let a of i) s.rows.push(J(a, s.header.length).map((o, l) => ({
500
+ text: o,
501
+ tokens: this.lexer.inline(o),
502
+ header: !1,
503
+ align: s.align[l]
504
+ })));
505
+ return s;
506
+ }
507
+ }
508
+ lheading(e) {
509
+ let t = this.rules.block.lheading.exec(e);
510
+ if (t) return {
511
+ type: "heading",
512
+ raw: t[0],
513
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
514
+ text: t[1],
515
+ tokens: this.lexer.inline(t[1])
516
+ };
517
+ }
518
+ paragraph(e) {
519
+ let t = this.rules.block.paragraph.exec(e);
520
+ if (t) {
521
+ let n = t[1].charAt(t[1].length - 1) === `
522
+ ` ? t[1].slice(0, -1) : t[1];
523
+ return {
524
+ type: "paragraph",
525
+ raw: t[0],
526
+ text: n,
527
+ tokens: this.lexer.inline(n)
528
+ };
529
+ }
530
+ }
531
+ text(e) {
532
+ let t = this.rules.block.text.exec(e);
533
+ if (t) return {
534
+ type: "text",
535
+ raw: t[0],
536
+ text: t[0],
537
+ tokens: this.lexer.inline(t[0])
538
+ };
539
+ }
540
+ escape(e) {
541
+ let t = this.rules.inline.escape.exec(e);
542
+ if (t) return {
543
+ type: "escape",
544
+ raw: t[0],
545
+ text: t[1]
546
+ };
547
+ }
548
+ tag(e) {
549
+ let t = this.rules.inline.tag.exec(e);
550
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
551
+ type: "html",
552
+ raw: t[0],
553
+ inLink: this.lexer.state.inLink,
554
+ inRawBlock: this.lexer.state.inRawBlock,
555
+ block: !1,
556
+ text: t[0]
557
+ };
558
+ }
559
+ link(e) {
560
+ let t = this.rules.inline.link.exec(e);
561
+ if (t) {
562
+ let n = t[2].trim();
563
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
564
+ if (!this.rules.other.endAngleBracket.test(n)) return;
565
+ let s = z(n.slice(0, -1), "\\");
566
+ if ((n.length - s.length) % 2 === 0) return;
567
+ } else {
568
+ let s = de(t[2], "()");
569
+ if (s === -2) return;
570
+ if (s > -1) {
571
+ let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
572
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
573
+ }
574
+ }
575
+ let r = t[2], i = "";
576
+ if (this.options.pedantic) {
577
+ let s = this.rules.other.pedanticHrefTitle.exec(r);
578
+ s && (r = s[1], i = s[3]);
579
+ } else i = t[3] ? t[3].slice(1, -1) : "";
580
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), ge(t, {
581
+ href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
582
+ title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
583
+ }, t[0], this.lexer, this.rules);
584
+ }
585
+ }
586
+ reflink(e, t) {
587
+ let n;
588
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
589
+ let i = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
590
+ if (!i) {
591
+ let s = n[0].charAt(0);
592
+ return {
593
+ type: "text",
594
+ raw: s,
595
+ text: s
596
+ };
597
+ }
598
+ return ge(n, i, n[0], this.lexer, this.rules);
599
+ }
600
+ }
601
+ emStrong(e, t, n = "") {
602
+ let r = this.rules.inline.emStrongLDelim.exec(e);
603
+ if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
604
+ if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
605
+ let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
606
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null;) {
607
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
608
+ if (o = [...a].length, r[3] || r[4]) {
609
+ l += o;
610
+ continue;
611
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
612
+ p += o;
613
+ continue;
614
+ }
615
+ if (l -= o, l > 0) continue;
616
+ o = Math.min(o, o + l + p);
617
+ let g = [...r[0]][0].length, h = e.slice(0, s + r.index + g + o);
618
+ if (Math.min(s, o) % 2) {
619
+ let f = h.slice(1, -1);
620
+ return {
621
+ type: "em",
622
+ raw: h,
623
+ text: f,
624
+ tokens: this.lexer.inlineTokens(f)
625
+ };
626
+ }
627
+ let R = h.slice(2, -2);
628
+ return {
629
+ type: "strong",
630
+ raw: h,
631
+ text: R,
632
+ tokens: this.lexer.inlineTokens(R)
633
+ };
634
+ }
635
+ }
636
+ }
637
+ codespan(e) {
638
+ let t = this.rules.inline.code.exec(e);
639
+ if (t) {
640
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
641
+ return r && i && (n = n.substring(1, n.length - 1)), {
642
+ type: "codespan",
643
+ raw: t[0],
644
+ text: n
645
+ };
646
+ }
647
+ }
648
+ br(e) {
649
+ let t = this.rules.inline.br.exec(e);
650
+ if (t) return {
651
+ type: "br",
652
+ raw: t[0]
653
+ };
654
+ }
655
+ del(e) {
656
+ let t = this.rules.inline.del.exec(e);
657
+ if (t) return {
658
+ type: "del",
659
+ raw: t[0],
660
+ text: t[2],
661
+ tokens: this.lexer.inlineTokens(t[2])
662
+ };
663
+ }
664
+ autolink(e) {
665
+ let t = this.rules.inline.autolink.exec(e);
666
+ if (t) {
667
+ let n, r;
668
+ return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), {
669
+ type: "link",
670
+ raw: t[0],
671
+ text: n,
672
+ href: r,
673
+ tokens: [{
674
+ type: "text",
675
+ raw: n,
676
+ text: n
677
+ }]
678
+ };
679
+ }
680
+ }
681
+ url(e) {
682
+ let t;
683
+ if (t = this.rules.inline.url.exec(e)) {
684
+ let n, r;
685
+ if (t[2] === "@") n = t[0], r = "mailto:" + n;
686
+ else {
687
+ let i;
688
+ do
689
+ i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
690
+ while (i !== t[0]);
691
+ n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
692
+ }
693
+ return {
694
+ type: "link",
695
+ raw: t[0],
696
+ text: n,
697
+ href: r,
698
+ tokens: [{
699
+ type: "text",
700
+ raw: n,
701
+ text: n
702
+ }]
703
+ };
704
+ }
705
+ }
706
+ inlineText(e) {
707
+ let t = this.rules.inline.text.exec(e);
708
+ if (t) {
709
+ let n = this.lexer.state.inRawBlock;
710
+ return {
711
+ type: "text",
712
+ raw: t[0],
713
+ text: t[0],
714
+ escaped: n
715
+ };
716
+ }
717
+ }
718
+ };
719
+ var x = class u {
720
+ tokens;
721
+ options;
722
+ state;
723
+ inlineQueue;
724
+ tokenizer;
725
+ constructor(e) {
726
+ this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
727
+ inLink: !1,
728
+ inRawBlock: !1,
729
+ top: !0
730
+ };
731
+ let t = {
732
+ other: m,
733
+ block: E.normal,
734
+ inline: M.normal
735
+ };
736
+ this.options.pedantic ? (t.block = E.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = E.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
737
+ }
738
+ static get rules() {
739
+ return {
740
+ block: E,
741
+ inline: M
742
+ };
743
+ }
744
+ static lex(e, t) {
745
+ return new u(t).lex(e);
746
+ }
747
+ static lexInline(e, t) {
748
+ return new u(t).inlineTokens(e);
749
+ }
750
+ lex(e) {
751
+ e = e.replace(m.carriageReturn, `
752
+ `), this.blockTokens(e, this.tokens);
753
+ for (let t = 0; t < this.inlineQueue.length; t++) {
754
+ let n = this.inlineQueue[t];
755
+ this.inlineTokens(n.src, n.tokens);
756
+ }
757
+ return this.inlineQueue = [], this.tokens;
758
+ }
759
+ blockTokens(e, t = [], n = !1) {
760
+ for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e;) {
761
+ let r;
762
+ if (this.options.extensions?.block?.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
763
+ if (r = this.tokenizer.space(e)) {
764
+ e = e.substring(r.raw.length);
765
+ let s = t.at(-1);
766
+ r.raw.length === 1 && s !== void 0 ? s.raw += `
767
+ ` : t.push(r);
768
+ continue;
769
+ }
770
+ if (r = this.tokenizer.code(e)) {
771
+ e = e.substring(r.raw.length);
772
+ let s = t.at(-1);
773
+ s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
774
+ `) ? "" : `
775
+ `) + r.raw, s.text += `
776
+ ` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
777
+ continue;
778
+ }
779
+ if (r = this.tokenizer.fences(e)) {
780
+ e = e.substring(r.raw.length), t.push(r);
781
+ continue;
782
+ }
783
+ if (r = this.tokenizer.heading(e)) {
784
+ e = e.substring(r.raw.length), t.push(r);
785
+ continue;
786
+ }
787
+ if (r = this.tokenizer.hr(e)) {
788
+ e = e.substring(r.raw.length), t.push(r);
789
+ continue;
790
+ }
791
+ if (r = this.tokenizer.blockquote(e)) {
792
+ e = e.substring(r.raw.length), t.push(r);
793
+ continue;
794
+ }
795
+ if (r = this.tokenizer.list(e)) {
796
+ e = e.substring(r.raw.length), t.push(r);
797
+ continue;
798
+ }
799
+ if (r = this.tokenizer.html(e)) {
800
+ e = e.substring(r.raw.length), t.push(r);
801
+ continue;
802
+ }
803
+ if (r = this.tokenizer.def(e)) {
804
+ e = e.substring(r.raw.length);
805
+ let s = t.at(-1);
806
+ s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
807
+ `) ? "" : `
808
+ `) + r.raw, s.text += `
809
+ ` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
810
+ href: r.href,
811
+ title: r.title
812
+ }, t.push(r));
813
+ continue;
814
+ }
815
+ if (r = this.tokenizer.table(e)) {
816
+ e = e.substring(r.raw.length), t.push(r);
817
+ continue;
818
+ }
819
+ if (r = this.tokenizer.lheading(e)) {
820
+ e = e.substring(r.raw.length), t.push(r);
821
+ continue;
822
+ }
823
+ let i = e;
824
+ if (this.options.extensions?.startBlock) {
825
+ let s = Infinity, a = e.slice(1), o;
826
+ this.options.extensions.startBlock.forEach((l) => {
827
+ o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
828
+ }), s < Infinity && s >= 0 && (i = e.substring(0, s + 1));
829
+ }
830
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
831
+ let s = t.at(-1);
832
+ n && s?.type === "paragraph" ? (s.raw += (s.raw.endsWith(`
833
+ `) ? "" : `
834
+ `) + r.raw, s.text += `
835
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
836
+ continue;
837
+ }
838
+ if (r = this.tokenizer.text(e)) {
839
+ e = e.substring(r.raw.length);
840
+ let s = t.at(-1);
841
+ s?.type === "text" ? (s.raw += (s.raw.endsWith(`
842
+ `) ? "" : `
843
+ `) + r.raw, s.text += `
844
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
845
+ continue;
846
+ }
847
+ if (e) {
848
+ let s = "Infinite loop on byte: " + e.charCodeAt(0);
849
+ if (this.options.silent) {
850
+ console.error(s);
851
+ break;
852
+ } else throw new Error(s);
853
+ }
854
+ }
855
+ return this.state.top = !0, t;
856
+ }
857
+ inline(e, t = []) {
858
+ return this.inlineQueue.push({
859
+ src: e,
860
+ tokens: t
861
+ }), t;
862
+ }
863
+ inlineTokens(e, t = []) {
864
+ let n = e, r = null;
865
+ if (this.tokens.links) {
866
+ let o = Object.keys(this.tokens.links);
867
+ if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null;) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
868
+ }
869
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
870
+ let i;
871
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null;) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
872
+ n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
873
+ let s = !1, a = "";
874
+ for (; e;) {
875
+ s || (a = ""), s = !1;
876
+ let o;
877
+ if (this.options.extensions?.inline?.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue;
878
+ if (o = this.tokenizer.escape(e)) {
879
+ e = e.substring(o.raw.length), t.push(o);
880
+ continue;
881
+ }
882
+ if (o = this.tokenizer.tag(e)) {
883
+ e = e.substring(o.raw.length), t.push(o);
884
+ continue;
885
+ }
886
+ if (o = this.tokenizer.link(e)) {
887
+ e = e.substring(o.raw.length), t.push(o);
888
+ continue;
889
+ }
890
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
891
+ e = e.substring(o.raw.length);
892
+ let p = t.at(-1);
893
+ o.type === "text" && p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
894
+ continue;
895
+ }
896
+ if (o = this.tokenizer.emStrong(e, n, a)) {
897
+ e = e.substring(o.raw.length), t.push(o);
898
+ continue;
899
+ }
900
+ if (o = this.tokenizer.codespan(e)) {
901
+ e = e.substring(o.raw.length), t.push(o);
902
+ continue;
903
+ }
904
+ if (o = this.tokenizer.br(e)) {
905
+ e = e.substring(o.raw.length), t.push(o);
906
+ continue;
907
+ }
908
+ if (o = this.tokenizer.del(e)) {
909
+ e = e.substring(o.raw.length), t.push(o);
910
+ continue;
911
+ }
912
+ if (o = this.tokenizer.autolink(e)) {
913
+ e = e.substring(o.raw.length), t.push(o);
914
+ continue;
915
+ }
916
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
917
+ e = e.substring(o.raw.length), t.push(o);
918
+ continue;
919
+ }
920
+ let l = e;
921
+ if (this.options.extensions?.startInline) {
922
+ let p = Infinity, c = e.slice(1), g;
923
+ this.options.extensions.startInline.forEach((h) => {
924
+ g = h.call({ lexer: this }, c), typeof g == "number" && g >= 0 && (p = Math.min(p, g));
925
+ }), p < Infinity && p >= 0 && (l = e.substring(0, p + 1));
926
+ }
927
+ if (o = this.tokenizer.inlineText(l)) {
928
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = !0;
929
+ let p = t.at(-1);
930
+ p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
931
+ continue;
932
+ }
933
+ if (e) {
934
+ let p = "Infinite loop on byte: " + e.charCodeAt(0);
935
+ if (this.options.silent) {
936
+ console.error(p);
937
+ break;
938
+ } else throw new Error(p);
939
+ }
940
+ }
941
+ return t;
942
+ }
943
+ };
944
+ var P = class {
945
+ options;
946
+ parser;
947
+ constructor(e) {
948
+ this.options = e || T;
949
+ }
950
+ space(e) {
951
+ return "";
952
+ }
953
+ code({ text: e, lang: t, escaped: n }) {
954
+ let r = (t || "").match(m.notSpaceStart)?.[0], i = e.replace(m.endingNewline, "") + `
955
+ `;
956
+ return r ? "<pre><code class=\"language-" + w(r) + "\">" + (n ? i : w(i, !0)) + `</code></pre>
957
+ ` : "<pre><code>" + (n ? i : w(i, !0)) + `</code></pre>
958
+ `;
959
+ }
960
+ blockquote({ tokens: e }) {
961
+ return `<blockquote>
962
+ ${this.parser.parse(e)}</blockquote>
963
+ `;
964
+ }
965
+ html({ text: e }) {
966
+ return e;
967
+ }
968
+ def(e) {
969
+ return "";
970
+ }
971
+ heading({ tokens: e, depth: t }) {
972
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
973
+ `;
974
+ }
975
+ hr(e) {
976
+ return `<hr>
977
+ `;
978
+ }
979
+ list(e) {
980
+ let t = e.ordered, n = e.start, r = "";
981
+ for (let a = 0; a < e.items.length; a++) {
982
+ let o = e.items[a];
983
+ r += this.listitem(o);
984
+ }
985
+ let i = t ? "ol" : "ul", s = t && n !== 1 ? " start=\"" + n + "\"" : "";
986
+ return "<" + i + s + `>
987
+ ` + r + "</" + i + `>
988
+ `;
989
+ }
990
+ listitem(e) {
991
+ return `<li>${this.parser.parse(e.tokens)}</li>
992
+ `;
993
+ }
994
+ checkbox({ checked: e }) {
995
+ return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
996
+ }
997
+ paragraph({ tokens: e }) {
998
+ return `<p>${this.parser.parseInline(e)}</p>
999
+ `;
1000
+ }
1001
+ table(e) {
1002
+ let t = "", n = "";
1003
+ for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
1004
+ t += this.tablerow({ text: n });
1005
+ let r = "";
1006
+ for (let i = 0; i < e.rows.length; i++) {
1007
+ let s = e.rows[i];
1008
+ n = "";
1009
+ for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
1010
+ r += this.tablerow({ text: n });
1011
+ }
1012
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
1013
+ <thead>
1014
+ ` + t + `</thead>
1015
+ ` + r + `</table>
1016
+ `;
1017
+ }
1018
+ tablerow({ text: e }) {
1019
+ return `<tr>
1020
+ ${e}</tr>
1021
+ `;
1022
+ }
1023
+ tablecell(e) {
1024
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
1025
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1026
+ `;
1027
+ }
1028
+ strong({ tokens: e }) {
1029
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
1030
+ }
1031
+ em({ tokens: e }) {
1032
+ return `<em>${this.parser.parseInline(e)}</em>`;
1033
+ }
1034
+ codespan({ text: e }) {
1035
+ return `<code>${w(e, !0)}</code>`;
1036
+ }
1037
+ br(e) {
1038
+ return "<br>";
1039
+ }
1040
+ del({ tokens: e }) {
1041
+ return `<del>${this.parser.parseInline(e)}</del>`;
1042
+ }
1043
+ link({ href: e, title: t, tokens: n }) {
1044
+ let r = this.parser.parseInline(n), i = X(e);
1045
+ if (i === null) return r;
1046
+ e = i;
1047
+ let s = "<a href=\"" + e + "\"";
1048
+ return t && (s += " title=\"" + w(t) + "\""), s += ">" + r + "</a>", s;
1049
+ }
1050
+ image({ href: e, title: t, text: n, tokens: r }) {
1051
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1052
+ let i = X(e);
1053
+ if (i === null) return w(n);
1054
+ e = i;
1055
+ let s = `<img src="${e}" alt="${n}"`;
1056
+ return t && (s += ` title="${w(t)}"`), s += ">", s;
1057
+ }
1058
+ text(e) {
1059
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
1060
+ }
1061
+ };
1062
+ var $ = class {
1063
+ strong({ text: e }) {
1064
+ return e;
1065
+ }
1066
+ em({ text: e }) {
1067
+ return e;
1068
+ }
1069
+ codespan({ text: e }) {
1070
+ return e;
1071
+ }
1072
+ del({ text: e }) {
1073
+ return e;
1074
+ }
1075
+ html({ text: e }) {
1076
+ return e;
1077
+ }
1078
+ text({ text: e }) {
1079
+ return e;
1080
+ }
1081
+ link({ text: e }) {
1082
+ return "" + e;
1083
+ }
1084
+ image({ text: e }) {
1085
+ return "" + e;
1086
+ }
1087
+ br() {
1088
+ return "";
1089
+ }
1090
+ checkbox({ raw: e }) {
1091
+ return e;
1092
+ }
1093
+ };
1094
+ var b = class u {
1095
+ options;
1096
+ renderer;
1097
+ textRenderer;
1098
+ constructor(e) {
1099
+ this.options = e || T, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
1100
+ }
1101
+ static parse(e, t) {
1102
+ return new u(t).parse(e);
1103
+ }
1104
+ static parseInline(e, t) {
1105
+ return new u(t).parseInline(e);
1106
+ }
1107
+ parse(e) {
1108
+ let t = "";
1109
+ for (let n = 0; n < e.length; n++) {
1110
+ let r = e[n];
1111
+ if (this.options.extensions?.renderers?.[r.type]) {
1112
+ let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
1113
+ if (a !== !1 || ![
1114
+ "space",
1115
+ "hr",
1116
+ "heading",
1117
+ "code",
1118
+ "table",
1119
+ "blockquote",
1120
+ "list",
1121
+ "html",
1122
+ "def",
1123
+ "paragraph",
1124
+ "text"
1125
+ ].includes(s.type)) {
1126
+ t += a || "";
1127
+ continue;
1128
+ }
1129
+ }
1130
+ let i = r;
1131
+ switch (i.type) {
1132
+ case "space":
1133
+ t += this.renderer.space(i);
1134
+ break;
1135
+ case "hr":
1136
+ t += this.renderer.hr(i);
1137
+ break;
1138
+ case "heading":
1139
+ t += this.renderer.heading(i);
1140
+ break;
1141
+ case "code":
1142
+ t += this.renderer.code(i);
1143
+ break;
1144
+ case "table":
1145
+ t += this.renderer.table(i);
1146
+ break;
1147
+ case "blockquote":
1148
+ t += this.renderer.blockquote(i);
1149
+ break;
1150
+ case "list":
1151
+ t += this.renderer.list(i);
1152
+ break;
1153
+ case "checkbox":
1154
+ t += this.renderer.checkbox(i);
1155
+ break;
1156
+ case "html":
1157
+ t += this.renderer.html(i);
1158
+ break;
1159
+ case "def":
1160
+ t += this.renderer.def(i);
1161
+ break;
1162
+ case "paragraph":
1163
+ t += this.renderer.paragraph(i);
1164
+ break;
1165
+ case "text":
1166
+ t += this.renderer.text(i);
1167
+ break;
1168
+ default: {
1169
+ let s = "Token with \"" + i.type + "\" type was not found.";
1170
+ if (this.options.silent) return console.error(s), "";
1171
+ throw new Error(s);
1172
+ }
1173
+ }
1174
+ }
1175
+ return t;
1176
+ }
1177
+ parseInline(e, t = this.renderer) {
1178
+ let n = "";
1179
+ for (let r = 0; r < e.length; r++) {
1180
+ let i = e[r];
1181
+ if (this.options.extensions?.renderers?.[i.type]) {
1182
+ let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1183
+ if (a !== !1 || ![
1184
+ "escape",
1185
+ "html",
1186
+ "link",
1187
+ "image",
1188
+ "strong",
1189
+ "em",
1190
+ "codespan",
1191
+ "br",
1192
+ "del",
1193
+ "text"
1194
+ ].includes(i.type)) {
1195
+ n += a || "";
1196
+ continue;
1197
+ }
1198
+ }
1199
+ let s = i;
1200
+ switch (s.type) {
1201
+ case "escape":
1202
+ n += t.text(s);
1203
+ break;
1204
+ case "html":
1205
+ n += t.html(s);
1206
+ break;
1207
+ case "link":
1208
+ n += t.link(s);
1209
+ break;
1210
+ case "image":
1211
+ n += t.image(s);
1212
+ break;
1213
+ case "checkbox":
1214
+ n += t.checkbox(s);
1215
+ break;
1216
+ case "strong":
1217
+ n += t.strong(s);
1218
+ break;
1219
+ case "em":
1220
+ n += t.em(s);
1221
+ break;
1222
+ case "codespan":
1223
+ n += t.codespan(s);
1224
+ break;
1225
+ case "br":
1226
+ n += t.br(s);
1227
+ break;
1228
+ case "del":
1229
+ n += t.del(s);
1230
+ break;
1231
+ case "text":
1232
+ n += t.text(s);
1233
+ break;
1234
+ default: {
1235
+ let a = "Token with \"" + s.type + "\" type was not found.";
1236
+ if (this.options.silent) return console.error(a), "";
1237
+ throw new Error(a);
1238
+ }
1239
+ }
1240
+ }
1241
+ return n;
1242
+ }
1243
+ };
1244
+ var S = class {
1245
+ options;
1246
+ block;
1247
+ constructor(e) {
1248
+ this.options = e || T;
1249
+ }
1250
+ static passThroughHooks = new Set([
1251
+ "preprocess",
1252
+ "postprocess",
1253
+ "processAllTokens",
1254
+ "emStrongMask"
1255
+ ]);
1256
+ static passThroughHooksRespectAsync = new Set([
1257
+ "preprocess",
1258
+ "postprocess",
1259
+ "processAllTokens"
1260
+ ]);
1261
+ preprocess(e) {
1262
+ return e;
1263
+ }
1264
+ postprocess(e) {
1265
+ return e;
1266
+ }
1267
+ processAllTokens(e) {
1268
+ return e;
1269
+ }
1270
+ emStrongMask(e) {
1271
+ return e;
1272
+ }
1273
+ provideLexer() {
1274
+ return this.block ? x.lex : x.lexInline;
1275
+ }
1276
+ provideParser() {
1277
+ return this.block ? b.parse : b.parseInline;
1278
+ }
1279
+ };
1280
+ var B = class {
1281
+ defaults = L();
1282
+ options = this.setOptions;
1283
+ parse = this.parseMarkdown(!0);
1284
+ parseInline = this.parseMarkdown(!1);
1285
+ Parser = b;
1286
+ Renderer = P;
1287
+ TextRenderer = $;
1288
+ Lexer = x;
1289
+ Tokenizer = y;
1290
+ Hooks = S;
1291
+ constructor(...e) {
1292
+ this.use(...e);
1293
+ }
1294
+ walkTokens(e, t) {
1295
+ let n = [];
1296
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
1297
+ case "table": {
1298
+ let i = r;
1299
+ for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
1300
+ for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
1301
+ break;
1302
+ }
1303
+ case "list": {
1304
+ let i = r;
1305
+ n = n.concat(this.walkTokens(i.items, t));
1306
+ break;
1307
+ }
1308
+ default: {
1309
+ let i = r;
1310
+ this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
1311
+ let a = i[s].flat(Infinity);
1312
+ n = n.concat(this.walkTokens(a, t));
1313
+ }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
1314
+ }
1315
+ }
1316
+ return n;
1317
+ }
1318
+ use(...e) {
1319
+ let t = this.defaults.extensions || {
1320
+ renderers: {},
1321
+ childTokens: {}
1322
+ };
1323
+ return e.forEach((n) => {
1324
+ let r = { ...n };
1325
+ if (r.async = this.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((i) => {
1326
+ if (!i.name) throw new Error("extension name required");
1327
+ if ("renderer" in i) {
1328
+ let s = t.renderers[i.name];
1329
+ s ? t.renderers[i.name] = function(...a) {
1330
+ let o = i.renderer.apply(this, a);
1331
+ return o === !1 && (o = s.apply(this, a)), o;
1332
+ } : t.renderers[i.name] = i.renderer;
1333
+ }
1334
+ if ("tokenizer" in i) {
1335
+ if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1336
+ let s = t[i.level];
1337
+ s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
1338
+ }
1339
+ "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
1340
+ }), r.extensions = t), n.renderer) {
1341
+ let i = this.defaults.renderer || new P(this.defaults);
1342
+ for (let s in n.renderer) {
1343
+ if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
1344
+ if (["options", "parser"].includes(s)) continue;
1345
+ let a = s, o = n.renderer[a], l = i[a];
1346
+ i[a] = (...p) => {
1347
+ let c = o.apply(i, p);
1348
+ return c === !1 && (c = l.apply(i, p)), c || "";
1349
+ };
1350
+ }
1351
+ r.renderer = i;
1352
+ }
1353
+ if (n.tokenizer) {
1354
+ let i = this.defaults.tokenizer || new y(this.defaults);
1355
+ for (let s in n.tokenizer) {
1356
+ if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
1357
+ if ([
1358
+ "options",
1359
+ "rules",
1360
+ "lexer"
1361
+ ].includes(s)) continue;
1362
+ let a = s, o = n.tokenizer[a], l = i[a];
1363
+ i[a] = (...p) => {
1364
+ let c = o.apply(i, p);
1365
+ return c === !1 && (c = l.apply(i, p)), c;
1366
+ };
1367
+ }
1368
+ r.tokenizer = i;
1369
+ }
1370
+ if (n.hooks) {
1371
+ let i = this.defaults.hooks || new S();
1372
+ for (let s in n.hooks) {
1373
+ if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
1374
+ if (["options", "block"].includes(s)) continue;
1375
+ let a = s, o = n.hooks[a], l = i[a];
1376
+ S.passThroughHooks.has(s) ? i[a] = (p) => {
1377
+ if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
1378
+ let g = await o.call(i, p);
1379
+ return l.call(i, g);
1380
+ })();
1381
+ let c = o.call(i, p);
1382
+ return l.call(i, c);
1383
+ } : i[a] = (...p) => {
1384
+ if (this.defaults.async) return (async () => {
1385
+ let g = await o.apply(i, p);
1386
+ return g === !1 && (g = await l.apply(i, p)), g;
1387
+ })();
1388
+ let c = o.apply(i, p);
1389
+ return c === !1 && (c = l.apply(i, p)), c;
1390
+ };
1391
+ }
1392
+ r.hooks = i;
1393
+ }
1394
+ if (n.walkTokens) {
1395
+ let i = this.defaults.walkTokens, s = n.walkTokens;
1396
+ r.walkTokens = function(a) {
1397
+ let o = [];
1398
+ return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
1399
+ };
1400
+ }
1401
+ this.defaults = {
1402
+ ...this.defaults,
1403
+ ...r
1404
+ };
1405
+ }), this;
1406
+ }
1407
+ setOptions(e) {
1408
+ return this.defaults = {
1409
+ ...this.defaults,
1410
+ ...e
1411
+ }, this;
1412
+ }
1413
+ lexer(e, t) {
1414
+ return x.lex(e, t ?? this.defaults);
1415
+ }
1416
+ parser(e, t) {
1417
+ return b.parse(e, t ?? this.defaults);
1418
+ }
1419
+ parseMarkdown(e) {
1420
+ return (n, r) => {
1421
+ let i = { ...r }, s = {
1422
+ ...this.defaults,
1423
+ ...i
1424
+ }, a = this.onError(!!s.silent, !!s.async);
1425
+ if (this.defaults.async === !0 && i.async === !1) return a(/* @__PURE__ */ new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1426
+ if (typeof n > "u" || n === null) return a(/* @__PURE__ */ new Error("marked(): input parameter is undefined or null"));
1427
+ if (typeof n != "string") return a(/* @__PURE__ */ new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1428
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
1429
+ let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
1430
+ s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
1431
+ let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
1432
+ return s.hooks ? await s.hooks.postprocess(h) : h;
1433
+ })().catch(a);
1434
+ try {
1435
+ s.hooks && (n = s.hooks.preprocess(n));
1436
+ let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
1437
+ s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
1438
+ let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
1439
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
1440
+ } catch (o) {
1441
+ return a(o);
1442
+ }
1443
+ };
1444
+ }
1445
+ onError(e, t) {
1446
+ return (n) => {
1447
+ if (n.message += `
1448
+ Please report this to https://github.com/markedjs/marked.`, e) {
1449
+ let r = "<p>An error occurred:</p><pre>" + w(n.message + "", !0) + "</pre>";
1450
+ return t ? Promise.resolve(r) : r;
1451
+ }
1452
+ if (t) return Promise.reject(n);
1453
+ throw n;
1454
+ };
1455
+ }
1456
+ };
1457
+ var _ = new B();
1458
+ function d(u, e) {
1459
+ return _.parse(u, e);
1460
+ }
1461
+ d.options = d.setOptions = function(u) {
1462
+ return _.setOptions(u), d.defaults = _.defaults, Z(d.defaults), d;
1463
+ };
1464
+ d.getDefaults = L;
1465
+ d.defaults = T;
1466
+ d.use = function(...u) {
1467
+ return _.use(...u), d.defaults = _.defaults, Z(d.defaults), d;
1468
+ };
1469
+ d.walkTokens = function(u, e) {
1470
+ return _.walkTokens(u, e);
1471
+ };
1472
+ d.parseInline = _.parseInline;
1473
+ d.Parser = b;
1474
+ d.parser = b.parse;
1475
+ d.Renderer = P;
1476
+ d.TextRenderer = $;
1477
+ d.Lexer = x;
1478
+ d.lexer = x.lex;
1479
+ d.Tokenizer = y;
1480
+ d.Hooks = S;
1481
+ d.parse = d;
1482
+ var Dt = d.options, Ht = d.setOptions, Zt = d.use, Gt = d.walkTokens, Nt = d.parseInline, Qt = d, Ft = b.parse, jt = x.lex;
1483
+
1484
+ //#endregion
4
1485
  //#region src/index.ts
5
1486
  /**
6
1487
  * Marked Plugin
@@ -26,12 +1507,13 @@ const plugin = (options = {}) => {
26
1507
  },
27
1508
  async configResolved() {
28
1509
  this.marked ??= {};
29
- this.marked.parse ??= async (src, override = {}) => marked.parse(src, defu(override, this.config.marked));
30
- this.marked.use ??= (...args) => marked.use(...args);
1510
+ this.marked.parse ??= async (src, override = {}) => d.parse(src, defu(override, this.config.marked));
1511
+ this.marked.use ??= (...args) => d.use(...args);
31
1512
  }
32
1513
  };
33
1514
  };
34
1515
  var src_default = plugin;
35
1516
 
36
1517
  //#endregion
37
- export { src_default as default, plugin };
1518
+ export { src_default as default, plugin };
1519
+ //# sourceMappingURL=index.mjs.map