@boldare/askdare 0.1.0-rc.4 → 0.2.0-rc.0

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