@powerlines/plugin-marked 0.1.305 → 0.1.307

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