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