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