91 lines
55 KiB
JavaScript
91 lines
55 KiB
JavaScript
/**
|
|
* marked v18.4.0 - a markdown parser
|
|
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
* https://github.com/markedjs/marked
|
|
*/
|
|
|
|
/**
|
|
* DO NOT EDIT THIS FILE
|
|
* The code in this file is generated from files in ./src/
|
|
*/
|
|
|
|
function G(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $=G();function ge(l){$=l}var N={exec:()=>null};function j(l){let e=[];return t=>{let n=Math.max(0,Math.min(3,t-1)),r=e[n];return r||(r=l(n),e[n]=r),r}}function h(l,e=""){let t=typeof l=="string"?l:l.source,n={replace:(r,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(b.caret,"$1"),t=t.replace(r,o),n},getRegex:()=>new RegExp(t,e)};return n}var ze=((l="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+l)}catch{return!1}})(),Me="^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)",b={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,listInterruptsParagraph:/^ {0,3}(?:[*+-]|0{0,8}1[.)])[ \t]+[^ \t\n]/,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^( {1,3})(?:`{3}|~{3})/,beginningSpace:/^[ \t]{1,3}/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,multipleSpaceTabGlobal:/[ \t\r\n]+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,textIndentedContinuation:/^(?:\n(?: {4}| {0,3}\t)[ \t]*[^ \t\n][^\n]*)+/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)(\t[ \t]*)/gm,blockquoteFenceOpen:/^ {0,3}(`{3,}(?=[^`]*$)|~{3,})/,blockquoteFenceClose:/^ {0,3}(`{3,}|~{3,})[ \t]*$/,blockquoteListItemStart:/^ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|$)/,nestedBlockMarker:/^ {0,3}(?:(?:[*+-]|\d{1,9}[.)])(?: |$)|> ?)/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableHeader:new RegExp(Me+"(?:\\n|$)"),tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:j(l=>new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:j(l=>new RegExp(`^ {0,${l}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:j(l=>new RegExp(`^ {0,${l}}(?:\`{3,}(?=[^\`\\n]*(?:\\n|$))|~~~)`)),headingBeginRegex:j(l=>new RegExp(`^ {0,${l}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:j(l=>new RegExp(`^ {0,${l}}#`)),htmlBeginRegex:j(l=>new RegExp(`^ {0,${l}}(?:</?(?:${me})(?:[ \\t]+|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:j(l=>new RegExp(`^ {0,${l}}>`)),nestedContainerMarkers:/^(?: {0,3}(?:(?:[*+-]|\d{1,9}[.)])[ \t]+|>[ \t]?))+/},Ye=/^(?:[ \t]*(?:\n|$))+/,et=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,tt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*)[ \t]*(?=\n|$)|$)/,ee=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,nt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,me="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",te=h(" {0,3}(?:</?(?:tag)(?:[ \\t]+|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",me).getRegex(),Be=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?![ \t]*\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,De=h(Be).replace(/bull/g,fe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}(?=[^`\n]*(?:\n|$))|~{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(/\|table/g,"").replace(/html/g,te).getRegex(),rt=h(Be).replace(/bull/g,fe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}(?=[^`\n]*(?:\n|$))|~{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(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).replace(/html/g,te).getRegex(),xe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,st=/^[^\n]+/,be=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,it=h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<(?:\\.|[^\n<>\\])*>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",be).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),ot=h(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,fe).getRegex(),Re=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,at=h("^ {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]*/?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Re).replace("tag",me).replace("attribute",/[ \t]+[a-zA-Z:_][\w.:-]*(?:[ \t]*=[ \t]*"[^"\n]*"|[ \t]*=[ \t]*'[^'\n]*'|[ \t]*=[ \t]*[^\s"'=<>`]+)?/).getRegex(),qe=l=>h(xe).replace("hr",ee).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",l).replace("html",te).getRegex(),lt=qe(b.listInterruptsParagraph),ut=qe(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Le=/ {0,3}> ?(?:(?!blank)(paragraph)|[^\n]*)(?:\n|$)/,pt=h(/^(first)(?:next)*/).replace("first",h(Le).replace("blank",/[ \t]*(?:\n|$)| {4}/).getRegex()).replace("next",h(Le).replace("blank",/[ \t]*(?:\n|$)/).getRegex()).replace(/paragraph/g,ut).getRegex(),Oe={blockquote:pt,code:et,def:it,fences:tt,heading:nt,hr:ee,html:at,lheading:De,list:ot,newline:Ye,paragraph:lt,table:N,text:st},ct=h(Me+"(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ee).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}(?:[*+-]|0{0,8}1[.)])[ \\t]").replace("html",te).getRegex(),ht={...Oe,lheading:rt,table:ct,paragraph:h(xe).replace("hr",ee).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",b.tableHeader).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",b.listInterruptsParagraph).replace("html",te).getRegex()},dt={...Oe,html:h(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",Re).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(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:N,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h(xe).replace("hr",ee).replace("heading",` *#{1,6} *[^
|
|
]`).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").replace("lheading",De).getRegex()},gt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,He=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,ft=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,E=/[\p{P}\p{S}]/u,Q=/[\s\p{P}\p{S}]/u,ne=/[^\s\p{P}\p{S}]/u,mt=h(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Q).getRegex(),xt=/[\p{Pi}\p{Ps}"']/u,ve=/(?!~)[\p{P}\p{S}]/u,bt=/(?!~)[\s\p{P}\p{S}]/u,Rt=/(?:[^\s\p{P}\p{S}]|~)/u,Ot=h(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ze?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ze=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Tt=h(Ze,"u").replace(/punct/g,E).getRegex(),wt=h(Ze,"u").replace(/punct/g,ve).getRegex(),Pt=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,yt=h(Pt,"u").replace(/openQuote/g,xt).replace(/punct/g,E).getRegex(),je="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",St=h(je,"gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,Q).replace(/punct/g,E).getRegex(),_t=h(je,"gu").replace(/notPunctSpace/g,Rt).replace(/punctSpace/g,bt).replace(/punct/g,ve).getRegex(),$t="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Ct=h($t,"gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,Q).replace(/punct/g,E).getRegex(),It=h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,Q).replace(/punct/g,E).getRegex(),Lt="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",At=h(Lt,"gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,Q).replace(/punct/g,E).getRegex(),Et=h(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,E).getRegex(),zt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Mt=h(zt,"gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,Q).replace(/punct/g,E).getRegex(),Bt=h(/\\(punct)/,"gu").replace(/punct/g,E).getRegex(),Dt=h(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,E).getRegex(),qt=h(/^<(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(),Ht=h(Re).replace("(?:-->|$)","-->").getRegex(),vt=h("^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",Ht).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ne=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,le=h(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Ne).getRegex(),ue=/\\[^ \t\n\x00-\x1f]|\\(?=[ \t\n])|[^ \t\n\x00-\x1f\\()]/,Zt=h(/\((?:char)*\)/).replace("char",ue).getRegex(),jt=h(/\((?:char|p1)*\)/).replace("char",ue).replace("p1",Zt).getRegex(),Nt=h(/\((?:char|p2)*\)/).replace("char",ue).replace("p2",jt).getRegex(),Ft=h(/(?!<)(?:char|p3)+/).replace("char",ue).replace("p3",Nt).getRegex(),Gt=h(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",le).replace("href",h(/<(?:\\.|[^\n<>\\])*>|bareHref|(?=\))/).replace("bareHref",Ft).getRegex()).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),Qt=h(/^!?\[(label)\]\[(ref)\]/).replace("label",le).replace("ref",be).getRegex(),Wt=h(/^!?\[(ref)\](?:\[\])?/).replace("ref",be).getRegex(),Ae=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Ut=h(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Ne).getRegex(),Kt=h("reflink|nolink(?!\\()","g").replace("reflink",h(/^!?\[(label)\]\[(ref)\]/).replace("label",Ut).replace("ref",Ae).getRegex()).replace("nolink",h(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ae).getRegex()).getRegex(),Ee=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Xt=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Vt=h(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Xt).getRegex(),Te={_backpedal:N,anyPunctuation:Bt,anyPunctuationOutsideCode:Dt,autolink:qt,blockSkip:Ot,br:He,code:kt,del:N,delLDelim:N,delRDelim:N,emStrongLDelim:Tt,emStrongRDelimAst:St,emStrongRDelimUnd:It,escape:gt,link:Gt,nolink:Wt,punctuation:mt,reflink:Qt,reflinkSearch:Kt,tag:vt,text:ft,url:N},Jt={...Te,emStrongLDelim:yt,emStrongRDelimAst:Ct,emStrongRDelimUnd:At,link:h(/^!?\[(label)\]\((.*?)\)/).replace("label",le).getRegex(),reflink:h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le).getRegex()},ke={...Te,emStrongRDelimAst:_t,emStrongLDelim:wt,delLDelim:Et,delRDelim:Mt,url:h(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Vt).replace("protocol",Ee).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:h(/^(?:[A-Za-z0-9.+-]+(?=@)|[^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",Ee).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace("wwwStart",ze?"(?<![^\\s*_~(])www\\.":"www\\.").getRegex()},Yt={...ke,br:h(He).replace("{2,}","*").getRegex(),text:h(ke.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},re={normal:Oe,gfm:ht,pedantic:dt},W={normal:Te,gfm:ke,breaks:Yt,pedantic:Jt};var en={"&":"&","<":"<",">":">",'"':""","'":"'"},Fe=l=>en[l];function P(l,e){if(e){if(b.escapeTest.test(l))return l.replace(b.escapeReplace,Fe)}else if(b.escapeTestNoEncode.test(l))return l.replace(b.escapeReplaceNoEncode,Fe);return l}function Qe(l){return b.numericCharacterReference.test(l)?l.replace(b.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return"&";let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?"\uFFFD":r===38?"&":String.fromCodePoint(r)}):l}function we(l){try{l=encodeURI(l).replace(b.percentDecode,"%")}catch{return null}return l}function pe(l,e){let t=l.replace(b.findPipe,(s,o,i)=>{let a=!1,p=o;for(;--p>=0&&i[p]==="\\";)a=!a;return a?"|":" |"}),n=t.split(b.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(b.slashPipe,"|");return n}function z(l,e,t){let n=l.length;if(n===0)return"";let r=0;for(;r<n;){let s=l.charAt(n-r-1);if(s===e&&!t)r++;else if(s!==e&&t)r++;else break}return l.slice(0,n-r)}function Pe(l){let e=l.split(`
|
|
`),t=e.length-1;for(;t>=0&&b.blankLine.test(e[t]);)t--;return e.length-t<=2?l:e.slice(0,t+1).join(`
|
|
`)}function K(l,e=!1){let t=e?b.multipleSpaceGlobal:b.multipleSpaceTabGlobal;return l.trim().replace(t," ").toLowerCase().toUpperCase().toLowerCase()}function ye(l,e){if(l.indexOf(e[0])===-1&&l.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<l.length;n++)if(l[n]==="\\")n++;else if(l[n]===e[0])t++;else if(l[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}var U=new WeakMap;function Se(l){let e={"*":-1,_:-1},t=-1,n=l.length;for(let r=0;r<n;r++){let s=l[r];if(s!=="*"&&s!=="_"&&s!=="~")continue;let o=r===0?`
|
|
`:l[r-1],i=r+1;for(;i<n&&l[i]===s;)i++;o!==" "&&o!==" "&&o!==`
|
|
`&&o!=="\r"&&o!=="\f"&&(s==="~"?t=r:e[s]=r),r=i-1}return{maskedSrc:l,lastPossibleEmStrongCloserIndex:e,lastPossibleDelCloserIndex:t}}function We(l,e){let t=Se(e),n=U.get(l);n?n.push(t):U.set(l,[t])}function Ue(l){let e=U.get(l);e&&(e.pop(),e.length===0&&U.delete(l))}function ce(l,e,t){let n=U.get(l)?.at(-1);return n&&n.maskedSrc===e?n.lastPossibleEmStrongCloserIndex[t]:Se(e).lastPossibleEmStrongCloserIndex[t]}function he(l,e){let t=U.get(l)?.at(-1);return t&&t.maskedSrc===e?t.lastPossibleDelCloserIndex:Se(e).lastPossibleDelCloserIndex}function X(l,e=0){let t=e,n="";for(let r of l)if(r===" "){let s=4-t%4;n+=" ".repeat(s),t+=s}else n+=r,t++;return n}function Ke(l){let e,t=!1;return l.map(n=>{if(t)return n;let{depth:r,expanded:s,keptIndent:o,content:i}=tn(n,e?.depth??1/0);if(e?.depth!==r&&(e=void 0),e){let p=b.blockquoteFenceClose.exec(i)?.[1];return!p||p[0]!==e.marker[0]||p.length<e.marker.length?o:(e=void 0,s)}if(t=b.blockquoteListItemStart.test(i),t)return n;let a=b.blockquoteFenceOpen.exec(i)?.[1];return a&&(e={marker:a,depth:r}),s}).join(`
|
|
`)}function tn(l,e){let t=0,n=0,r=0,s=0,o="";for(;r<e;){let u=t,d=n;for(;l[u]===" "||l[u]===" ";)d+=Ge(l[u],d),u++;if(l[u]!==">"||d-s>3)break;o+=" ".repeat(d-n)+">",r++,t=u+1,n=d+1,s=l[t]===" "||l[t]===" "?n+1:n}if(r===0)return{depth:r,expanded:l,keptIndent:l,content:l};let i="",a="";for(;(l[t]===" "||l[t]===" ")&&n<s+4;){let u=Ge(l[t],n);i+=" ".repeat(u),a+=n<s&&u>1?" ".repeat(u):l[t],n+=u,t++}let p=l.slice(t);return{depth:r,expanded:o+i+p,keptIndent:o+a+p,content:" ".repeat(Math.max(0,n-s))+p}}function Ge(l,e){return l===" "?4-e%4:1}function nn(l,e){let t="";for(let n=0;n<l.length;n++){if(l[n]==="`"){let r=e.inline.code.exec(l.slice(n));if(r){t+=r[0],n+=r[0].length-1;continue}}if(l[n]==="\\"&&(l[n+1]==="["||l[n+1]==="]")){t+=l[n+1],n++;continue}t+=l[n]}return t}function Xe(l,e,t,n,r){let s=e.href,o=e.title||null,i=nn(l[1],r),a=l[0].charAt(0)==="!",p=n.state.inLink,u=n.state.linkEmitted,d=n.state.inRawBlock;n.state.inLink=!0,n.state.linkEmitted=!1;let k=n.inlineTokens(i),g=n.state.linkEmitted;if(n.state.linkEmitted=u,n.state.inLink=p,!a){if(g){n.state.inRawBlock=d;return}n.state.linkEmitted=!0}return{type:a?"image":"link",raw:t,href:s,title:o,text:i,tokens:k}}function rn(l,e,t,n){let r=l.match(t.other.indentCodeCompensation);if(r===null)return e;let s=r[1].length;return e.split(`
|
|
`).map(o=>{let i=o.match(t.other.beginningSpace);if(i===null)return o;let[a]=i,p=a.indexOf(" ");if(p!==-1&&p<s){if(n)return" ".repeat(4-s)+o.slice(p+1);if(l[s]==="~")return o}return o.slice(Math.min(a.length,s))}).join(`
|
|
`)}function Ve(l,e,t,n){if(!e.includes("<"))return!1;for(let r=0;r<e.length;r++){if(e[r]==="\\"){r++;continue}if(e[r]==="`"){let i=n.inline.code.exec(e.slice(r));if(i){r+=i[0].length-1;continue}}if(e[r]!=="<")continue;let s=l.slice(t+r),o=n.inline.tag.exec(s)||n.inline.autolink.exec(s);if(o){if(o[0].length>e.length-r)return!0;r+=o[0].length-1}}return!1}var C=class{options;rules;lexer;constructor(e){this.options=e||$}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:Pe(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=rn(n,t[3]||"",this.rules,this.lexer.state.top&&!this.lexer.state.inBlockquote);t[3]!==void 0&&(r===""||r.endsWith(`
|
|
`))&&(r+=`
|
|
`);let s=t[2];if(s){let o=0,i=s.length;for(;o<i&&(s[o]===" "||s[o]===" ");)o++;for(;i>o&&(s[i-1]===" "||s[i-1]===" ");)i--;s=s.slice(o,i).replace(this.rules.inline.anyPunctuation,"$1")}return{type:"code",raw:n,lang:s,text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=z(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceTabChar.test(r))&&(n=r.trim())}return{type:"heading",raw:z(t[0],`
|
|
`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:z(t[0],`
|
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=z(t[0],`
|
|
`).split(`
|
|
`),r="",s="",o=[];for(;n.length>0;){let i=!1,a=[],p;for(p=0;p<n.length;p++)if(this.rules.other.blockquoteStart.test(n[p]))a.push(n[p]),i=!0;else if(!i)a.push(n[p]);else break;n=n.slice(p);let u=a.join(`
|
|
`),k=(this.lexer.state.top&&!this.lexer.state.inBlockquote&&u.includes(" ")?Ke(a):u).replace(this.rules.other.blockquoteMarkerWhitespace,(w,f,m)=>m.startsWith(" ")?f+" "+m.slice(1):f+X(m,f.length)).replace(this.rules.other.blockquoteSetextReplace,`
|
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
${u}`:u,s=s?`${s}
|
|
${k}`:k;let g=this.lexer.state.top,c=this.lexer.state.inBlockquote,R=this.lexer.state.lastToken;if(this.lexer.state.top=!0,this.lexer.state.inBlockquote=!0,this.lexer.blockTokens(k,o,!0),this.lexer.state.top=g,this.lexer.state.inBlockquote=c,n.length===0)break;let x=o.at(-1);if(x?.type==="code"||x?.type==="heading"||x?.type==="hr"||x?.type==="html"||x?.type==="table")break;if(x?.type==="blockquote"){let w=x,f=n.join(`
|
|
`),m=w.raw+`
|
|
`+f.replace(this.rules.other.blockquoteSetextReplace2,"");this.lexer.state.inBlockquote=!0,this.lexer.state.lastToken=o.at(-2);let _=this.blockquote(m);this.lexer.state.inBlockquote=c,this.lexer.state.lastToken=R,o[o.length-1]=_;let T=m.substring(_.raw.length).replace(/^\n/,""),H=T?T.split(`
|
|
`).length:0,D=H?n.slice(0,-H):n;if(D.length>0&&(r=`${r}
|
|
${D.join(`
|
|
`)}`),s=s.substring(0,s.length-w.text.length)+_.text,n=n.slice(D.length),n.length>0&&this.rules.other.blockquoteStart.test(n[0]))continue;break}else if(x?.type==="list"){let w=x,f=w.raw+`
|
|
`+n.join(`
|
|
`);this.lexer.state.inBlockquote=!0,this.lexer.state.lastToken=o.at(-2);let m=this.list(f);this.lexer.state.top=g,this.lexer.state.inBlockquote=c,this.lexer.state.lastToken=R,o[o.length-1]=m;let _=m.raw.length>w.raw.length?f.slice(w.raw.length+1,m.raw.length).split(`
|
|
`).length:0;if(_>0){let T=n.slice(0,_).join(`
|
|
`);r=`${r}
|
|
${T}`,s=`${s}
|
|
${T}`}if(n=n.slice(_),n.length>0&&!this.rules.other.blockquoteStart.test(n[0]))break;continue}}return{type:"blockquote",raw:r,tokens:o,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){if(!this.options.pedantic&&this.lexer.state.lastToken?.type==="text"&&!this.rules.other.listInterruptsParagraph.test(e))return;let n=e,r=()=>n.length-e.length,s=t[1].trim(),o=s.length>1,i={type:"list",raw:"",ordered:o,start:o?+s.slice(0,-1):"",loose:!1,items:[]};s=o?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=o?s:"[*+-]");let a=this.rules.other.listItemRegex(s),p=!1;for(;e;){let g=!1,c="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;let R=r();e=e.substring(t[0].length);let x=t[2].split(`
|
|
`,1)[0],w=t[1].length,f=this.options.pedantic?X(x,w):x.replace(this.rules.other.leadingSpaceTab,D=>X(D,w)),m=e.split(`
|
|
`,1)[0],_=!f.trim(),T=0;if(this.options.pedantic?(T=2,c=f.trimStart()):_?T=w+1:(T=f.search(this.rules.other.nonSpaceChar),T=T>4?1:T,c=f.slice(T),f=c,T+=w),_&&this.rules.other.blankLine.test(m)&&(e=e.substring(m.length+1),g=!0),!g){let D=this.rules.other.nextBulletRegex(T),V=this.rules.other.hrRegex(T),ie=this.rules.other.fencesBeginRegex(T),Z=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(T):this.rules.other.headingBeginRegex(T),J=this.rules.other.htmlBeginRegex(T),oe=this.rules.other.blockquoteBeginRegex(T),ae=!1;for(;e;){let $e=e.split(`
|
|
`,1)[0],L;if(m=$e,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),L=m):L=m.replace(this.rules.other.leadingSpaceTab,I=>X(I)),ie.test(m)||Z.test(m)||J.test(m)||oe.test(m)||D.test(m)||V.test(m))break;if(L.search(this.rules.other.nonSpaceChar)>=T||!m.trim())c+=`
|
|
`+L.slice(T),ae=!1;else{if(_)break;let I=f;if(!this.options.pedantic&&!c.includes(`
|
|
`)&&!f.includes(" ")){let A;for(;!V.test(I)&&(A=this.rules.other.nestedBlockMarker.exec(I));)I=I.slice(A[0].length);if(!I.trim())break}if(I.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ie.test(I)||Z.test(I)||J.test(I)||V.test(I))break;if(!this.options.pedantic&&!ae){let A=f.replace(this.rules.other.nestedContainerMarkers,"");if(this.rules.block.fences.test(A)||this.rules.block.heading.test(A)||this.rules.block.hr.test(A))break}let Ce=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(m)&&this.rules.block.lheading.test(`${f}
|
|
${m}`)?` ${L.replace(/^ {0,3}/,"")}`:m,de=!this.options.pedantic&&!ae&&L.startsWith(" ")?this.rules.block.list.exec(f):null;if(de?.[2]){let A=de[1].length,Ie=de[2].replace(this.rules.other.leadingSpaceTab,Je=>X(Je,A)),Y=Ie.search(this.rules.other.nonSpaceChar);Y>0&&Y<=4&&!this.rules.other.nestedBlockMarker.test(Ie.slice(Y))&&L.search(this.rules.other.nonSpaceChar)>=A+Y&&this.rules.other.listInterruptsParagraph.test(L.slice(A+Y))&&(Ce=` ${L}`)}c+=`
|
|
`+Ce,ae=!0}_=!m.trim(),e=e.substring($e.length+1),f=L.slice(T)}}let H=n.slice(R,r());i.loose||(p?i.loose=!0:this.rules.other.doubleBlankLine.test(H)&&(p=!0)),i.items.push({type:"list_item",raw:H,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]})}let u=i.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;i.raw=n.slice(0,r()).trimEnd();let d=[],k=this.lexer.state.top;for(let g of i.items)if(this.lexer.state.top=!1,d.push(this.lexer.inlineQueue.length),g.tokens=this.lexer.blockTokens(g.text,[]),!i.loose){let c=g.tokens.filter(x=>x.type==="space"),R=c.length>0&&c.some(x=>this.rules.other.anyLine.test(x.raw));i.loose=R}this.lexer.state.top=k;for(let g=0;g<i.items.length;g++){let c=i.items[g],R=c.tokens[0];if(c.task&&(R?.type==="text"||R?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),R.raw=R.raw.replace(this.rules.other.listReplaceTask,""),R.text=R.text.replace(this.rules.other.listReplaceTask,"");let x=this.lexer.inlineQueue;for(let f=d[g];f<x.length;f++)if(x[f].tokens===R.tokens){x[f].src=x[f].src.replace(this.rules.other.listReplaceTask,"");break}let w=this.rules.other.listTaskCheckbox.exec(c.raw);if(w){let f={type:"checkbox",raw:w[0]+" ",checked:w[0]!=="[ ]"};c.checked=f.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}else c.task&&(c.task=!1)}if(i.loose)for(let g of i.items){g.loose=!0;for(let c of g.tokens)c.type==="text"&&(c.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){if(this.lexer.state.lastToken?.type==="paragraph"&&!this.rules.other.htmlBeginRegex(4).test(e))return;let n=Pe(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&ye(t[2],"()")!==-1)return;let n=K(t[1],this.options.pedantic),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:z(t[0],`
|
|
`),href:r,title:s}}}table(e){let t,n;if(this.options.gfm&&!this.options.pedantic){let i=this.rules.other.tableHeader.exec(e);if(!i||!this.rules.other.tableDelimiter.test(i[2])||(t=pe(i[1]),n=i[2].replace(this.rules.other.tableAlignChars,"").split("|"),t.length!==n.length))return}let r=this.rules.block.table.exec(e);if(!r||!this.rules.other.tableDelimiter.test(r[2]))return;t??=pe(r[1]),n??=r[2].replace(this.rules.other.tableAlignChars,"").split("|");let s=r[3]?.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
`):[],o={type:"table",raw:z(r[0],`
|
|
`),header:[],align:[],rows:[]};if(t.length===n.length){for(let i of n)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);for(let i=0;i<t.length;i++)o.header.push({text:t[i],tokens:this.lexer.inline(t[i]),header:!0,align:o.align[i]});for(let i of s)o.rows.push(pe(i,o.header.length).map((a,p)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:o.align[p]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:z(t[0],`
|
|
`),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t){let n=t[0],r=t[0],s=this.rules.other.textIndentedContinuation.exec(e.slice(n.length));return s&&(n+=s[0],r+=s[0].replace(this.rules.other.codeRemoveIndent,"")),{type:"text",raw:n,text:r,tokens:this.lexer.inline(r)}}}escape(e){if(e.charCodeAt(0)!==92)return;let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){if(e.charCodeAt(0)!==60)return;let t=this.rules.inline.tag.exec(e);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),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=e.charCodeAt(0);if(t!==91&&t!==33)return;let n=this.rules.inline.link.exec(e);if(n){let r=n[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Ve(e,n[1],r,this.rules))return;let s=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let p=z(s.slice(0,-1),"\\");if((s.length-p.length)%2===0)return}else{let p=ye(n[2],"()");if(p===-2)return;if(p>-1){let d=(n[0].indexOf("!")===0?5:4)+n[1].length+p;n[2]=n[2].substring(0,p),n[0]=n[0].substring(0,d).trim(),n[3]=""}}let o=z(n[0].slice(0,-1),"\\");if((n[0].length-o.length)%2===0)return;let i=n[2],a="";if(this.options.pedantic){let p=this.rules.other.pedanticHrefTitle.exec(i);p&&(i=p[1],a=p[3])}else a=n[3]?n[3].slice(1,-1):"";return this.options.pedantic&&(i=i.trim()),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?i=i.slice(1):i=i.slice(1,-1)),Xe(n,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,t){let n=e.charCodeAt(0);if(n!==91&&n!==33)return;let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Ve(e,r[1],s,this.rules))return;let o=t[K(r[2]||r[1],this.options.pedantic)];if(!o){let i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return Xe(r,o,r[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let s=r[0][0],o=n===s,i=t.length-e.length,a=i;for(;!this.options.pedantic&&a>0&&t[a-1]===s;)a--;let p=[...t.slice(Math.max(0,a-2),a)].at(-1)??"",u=p==="*"||p==="_"||!!this.rules.inline.punctuation.exec(p);a<i&&(n=p);let d=a<i?u:n==="*"||n==="_"||!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let k=r[1]||r[3]||"";if(!k||!n||d){let g=[...r[0]].length-1,c,R,x=g,w=0,f=i-a+g,m=!this.options.pedantic&&!!p.trim()&&(!!k||s==="*"&&!u);if(s!=="*"&&s!=="_")return;let _=s==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,T=ce(this,t,s),H=t.length-e.length+g;if(T<H)return;t=t.slice(-1*e.length+g);let D=T-H;for(_.lastIndex=0;(r=_.exec(t))!==null&&!(r.index>D);){if(c=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!c)continue;R=[...c].length;let V=R>x-g;if(r[3]||r[4]){x+=R;continue}else if((r[5]||r[6]||m&&V)&&f%3&&!((f+R)%3)){if(o&&(r[5]||r[6]))break;w+=R;continue}if(x-=R,x>0)continue;R=Math.min(R,R+x+w);let ie=[...r[0]][0].length,Z=e.slice(0,g+r.index+ie+R);if(Math.min(g,R)%2){let oe=Z.slice(1,-1);return{type:"em",raw:Z,text:oe,tokens:this.lexer.inlineTokens(oe)}}let J=Z.slice(2,-2);return{type:"strong",raw:Z,text:J,tokens:this.lexer.inlineTokens(J)}}}}codespan(e){if(e.charCodeAt(0)!==96)return;let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=e.charCodeAt(0);if(t!==32&&t!==92&&t!==10)return;let n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e,t,n=""){if(e.charCodeAt(0)!==126)return;let r=this.rules.inline.delLDelim.exec(e);if(!r)return;if(!(r[1]||"")||!n||this.rules.inline.punctuation.exec(n)){let o=[...r[0]].length-1,i,a,p=o,u=this.rules.inline.delRDelim,d=he(this,t),k=t.length-e.length+o;if(d<k)return;t=t.slice(-1*e.length+o);let g=d-k;for(u.lastIndex=0;(r=u.exec(t))!==null&&!(r.index>g);){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){p+=a;continue}if(p-=a,p>0)continue;a=Math.min(a,a+p);let c=[...r[0]][0].length,R=e.slice(0,o+r.index+c+a),x=R.slice(o,-o);return{type:"del",raw:R,text:x,tokens:this.lexer.inlineTokens(x)}}}}autolink(e){if(e.charCodeAt(0)!==60)return;let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,r;if(t[2]==="@")n=t[0],r="mailto:"+n;else{let s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==t[0]);n=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:n,href:r,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:n?t[0]:Qe(t[0]),escaped:n}}}};var y=class l{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||$,this.options.tokenizer=this.options.tokenizer||new C,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0,inBlockquote:!1};let t={other:b,block:re.normal,inline:W.normal};this.options.pedantic?(t.block=re.pedantic,t.inline=W.pedantic):this.options.gfm&&(t.block=re.gfm,this.options.breaks?t.inline=W.breaks:t.inline=W.gfm),this.tokenizer.rules=t}static get rules(){return{block:re,inline:W}}static lex(e,t){return new l(t).lex(e)}static lexInline(e,t){let n=new l(t);return e.includes("\r")&&(e=e.replace(b.carriageReturn,`
|
|
`)),n.inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
|
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.state.inRawBlock=!1,this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this;let r=this.state.lastToken;this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));let s=1/0,o,i=this.options.gfm&&!this.options.pedantic&&this.tokenizer.paragraph===C.prototype.paragraph;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}this.state.lastToken=t.at(-1);let a;if(this.options.extensions?.block?.some(u=>(a=u.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let u=t.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
|
|
`:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let u=t.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
|
|
`)?"":`
|
|
`)+a.raw,u.text+=`
|
|
`+a.text,this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let u=t.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
|
|
`)?"":`
|
|
`)+a.raw,u.text+=`
|
|
`+a.raw,this.inlineQueue.at(-1).src=u.text):(this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title}),t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let p=e;if(this.options.extensions?.startBlock){let u=1/0,d=e.slice(1),k;this.options.extensions.startBlock.forEach(g=>{k=g.call({lexer:this},d),typeof k=="number"&&k>=0&&(u=Math.min(u,k))}),u<1/0&&u>=0&&(p=e.substring(0,u+1))}if(this.state.top&&(a=this.tokenizer.paragraph(p))){let u=t.at(-1);(n||u===o&&i)&&u?.type==="paragraph"?(u.raw+=(u.raw.endsWith(`
|
|
`)?"":`
|
|
`)+a.raw,u.text+=`
|
|
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text,o=u):(t.push(a),o=a),n=p.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let u=t.at(-1);u?.type==="text"?(u.raw+=(u.raw.endsWith(`
|
|
`)?"":`
|
|
`)+a.raw,u.text+=`
|
|
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,this.state.lastToken=r,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let r=n[0],s=r.lastIndexOf("[");if(!(r.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,K(r.slice(s+1,-1),this.options.pedantic)))&&!(s>1&&this.linkInText(r.slice(1,s-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=e.includes(")");try{return this.#t(e,t)}finally{this.state.linkParenPossible=n}}#t(e,t){let n=e.includes("*")||e.includes("_")||e.includes("~"),r=n||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==C.prototype.emStrong||this.tokenizer.del!==C.prototype.del?this.#r(e):e;if(!n)return this.#e(e,r,t);We(this.tokenizer,r);try{return this.#e(e,r,t)}finally{Ue(this.tokenizer)}}#e(e,t,n){let r=!1,s="",o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(s=""),r=!1;let i;if(this.options.extensions?.inline?.some(u=>(i=u.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.escape(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.tag(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.link(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(i.raw.length);let u=n.at(-1);i.type==="text"&&u?.type==="text"?(u.raw+=i.raw,u.text+=i.text):n.push(i);continue}let a=e[0];if(a==="*"||a==="_"){let u=t.length-e.length;if(ce(this.tokenizer,t,a)<=u){let k=1;for(;k<e.length&&e.charCodeAt(k)===a.charCodeAt(0);)k++;let g=e.substring(0,k),c=n.at(-1);c?.type==="text"&&!c.escaped?(c.raw+=g,c.text+=g):n.push({type:"text",raw:g,text:g,escaped:!1}),e=e.substring(k),s=a,r=!0;continue}}else if(a==="~"){let u=t.length-e.length;if(he(this.tokenizer,t)<=u){let k=1;for(;k<e.length&&e.charCodeAt(k)===126;)k++;let g=e.substring(0,k),c=n.at(-1);c?.type==="text"&&!c.escaped?(c.raw+=g,c.text+=g):n.push({type:"text",raw:g,text:g,escaped:!1}),e=e.substring(k),s=a,r=!0;continue}}if(i=this.tokenizer.emStrong(e,t,s)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.codespan(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.br(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.del(e,t,s)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.autolink(e)){e=e.substring(i.raw.length),n.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(e))){e=e.substring(i.raw.length),n.push(i);continue}let p=e;if(this.options.extensions?.startInline){let u=1/0,d=e.slice(1),k;this.options.extensions.startInline.forEach(g=>{k=g.call({lexer:this},d),typeof k=="number"&&k>=0&&(u=Math.min(u,k))}),u<1/0&&u>=0&&(p=e.substring(0,u+1))}if(i=this.tokenizer.inlineText(p)){e=e.substring(i.raw.length),i.raw.slice(-1)!=="_"&&(s=i.raw.slice(-1)),r=!0;let u=n.at(-1);u?.type==="text"?(u.raw+=i.raw,u.text+=i.text):n.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#n(e){let{blockSkip:t,tag:n,autolink:r}=this.tokenizer.rules.inline,s="",o=0,i;for(t.lastIndex=0;i=t.exec(e);){let a=i.index+(i[2]?i[2].length:0),p=i.index+i[0].length;if(e.charAt(a)==="<"){let u=e.slice(a),d=n.exec(u)||r.exec(u);if(!d){t.lastIndex=a+1;continue}p=a+d[0].length,t.lastIndex=p}s+=e.slice(o,a)+"["+"a".repeat(p-a-2)+"]",o=p}return s+e.slice(o)}#r(e){let t=e;if(this.tokens.links&&e.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,r=s=>{let o=s.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,K(s.slice(o+1,-1),this.options.pedantic)))return s;if(o>1&&s.charAt(0)!=="!"){let i=s.slice(1,o-1);if(this.linkInText(i))return"["+i.replace(n,r)+"]["+"a".repeat(s.length-o-2)+"]"}return"["+"a".repeat(s.length-2)+"]"};t=t.replace(n,r)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,r,s)=>s?"+".repeat(n.length):r?r+n.slice(r.length,-r.length).replace(/`/g,"+")+r:n),t=this.#n(t),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}};function _e(l,e=!1){let t;for(let n=0;n<l.length;n++){let r=l[n],s=r;if(r.type==="codespan"||r.type==="escape"||e&&r.type==="text"){let o=P(r.text,!0);o!==r.text&&(s={...r,text:o})}else if(r.type==="link"&&r.autolink){let o=P(r.text,!0),i=r.tokens,a=i&&(i.length===1&&i[0].type==="text"&&i[0].text===r.text?o!==r.text?[{...i[0],text:o}]:i:_e(i,!0));(o!==r.text||a!==i)&&(s=a!==i?{...r,text:o,tokens:a}:{...r,text:o})}else if("tokens"in r&&r.tokens){let o=_e(r.tokens,e);o!==r.tokens&&(s={...r,tokens:o})}s!==r?(t||(t=l.slice(0,n)),t.push(s)):t&&t.push(r)}return t||l}var M=class{options;parser;constructor(e){this.options=e||$}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").trim().match(b.notSpaceStart)?.[0],s=e?e.replace(b.endingNewline,"")+`
|
|
`:"";return r?'<pre><code class="language-'+P(r)+'">'+(n?s:P(s,!0))+`</code></pre>
|
|
`:"<pre><code>"+(n?s:P(s,!0))+`</code></pre>
|
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
${this.parser.parse(e)}</blockquote>
|
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
`}hr(e){return`<hr>
|
|
`}list(e){let t=e.ordered,n=e.start,r="";for(let i=0;i<e.items.length;i++){let a=e.items[i];r+=this.listitem(a)}let s=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
|
|
`+r+"</"+s+`>
|
|
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
`}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let r="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let i=0;i<o.length;i++)n+=this.tablecell(o[i]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
<thead>
|
|
`+t+`</thead>
|
|
`+r+`</table>
|
|
`}tablerow({text:e}){return`<tr>
|
|
${e}</tr>
|
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${P(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:s}){let o=s?P(n,!0):this.parser.parseInline(r),i=we(e);if(i===null)return o;e=P(i,s);let a='<a href="'+e+'"';return t&&(a+=' title="'+P(t)+'"'),a+=">"+o+"</a>",a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(_e(r),this.parser.textRenderer));let s=we(e);if(s===null)return P(n);e=s;let o=`<img src="${P(e)}" alt="${P(n)}"`;return t&&(o+=` title="${P(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:P(e.text)}};var q=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return`
|
|
`}checkbox({raw:e}){return e}};var S=class l{options;renderer;textRenderer;constructor(e){this.options=e||$,this.options.renderer=this.options.renderer||new M,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new q,this.textRenderer.parser=this}static parse(e,t){return new l(t).parse(e)}static parseInline(e,t){return new l(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let n=0;n<e.length;n++){let r=e[n],s=this.options.extensions?.renderers;if(s&&Object.hasOwn(s,r.type)&&s[r.type]){let i=r,a=s[i.type].call({parser:this},i);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(i.type)){t+=a===!1?"":a??"";continue}}let o=r;switch(o.type){case"space":{t+=this.renderer.space(o);break}case"hr":{t+=this.renderer.hr(o);break}case"heading":{t+=this.renderer.heading(o);break}case"code":{t+=this.renderer.code(o);break}case"table":{t+=this.renderer.table(o);break}case"blockquote":{t+=this.renderer.blockquote(o);break}case"list":{t+=this.renderer.list(o);break}case"checkbox":{t+=this.renderer.checkbox(o);break}case"html":{t+=this.renderer.html(o);break}case"def":{t+=this.renderer.def(o);break}case"paragraph":{t+=this.renderer.paragraph(o);break}case"text":{t+=this.renderer.text(o);break}default:{let i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let s=e[r],o=this.options.extensions?.renderers;if(o&&Object.hasOwn(o,s.type)&&o[s.type]){let a=o[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(s.type)){n+=a===!1?"":a??"";continue}}let i=s;switch(i.type){case"escape":{n+=t.text(i);break}case"html":{n+=t.html(i);break}case"link":{n+=t.link(i);break}case"image":{n+=t.image(i);break}case"checkbox":{n+=t.checkbox(i);break}case"strong":{n+=t.strong(i);break}case"em":{n+=t.em(i);break}case"codespan":{n+=t.codespan(i);break}case"br":{n+=t.br(i);break}case"del":{n+=t.del(i);break}case"text":{n+=t.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}};var B=class{options;block;constructor(e){this.options=e||$}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?y.lex:y.lexInline}provideParser(e=this.block){return e?S.parse:S.parseInline}};function v(l,e){if(Array.isArray(e))for(let t=0;t<e.length;t++)l.push(e[t]);else l.push(e)}var se=class{defaults=G();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=S;Renderer=M;TextRenderer=q;Lexer=y;Tokenizer=C;Hooks=B;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(v(n,t.call(this,r)),r.type){case"table":{let s=r;for(let o of s.header)v(n,this.walkTokens(o.tokens,t));for(let o of s.rows)for(let i of o)v(n,this.walkTokens(i.tokens,t));break}case"list":{let s=r;v(n,this.walkTokens(s.items,t));break}default:{let s=r;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(o=>{if(s[o]){let i=s[o].flat(1/0);v(n,this.walkTokens(i,t))}}):s.tokens&&v(n,this.walkTokens(s.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s&&s.renderer){let o=s.renderer,i=t.renderers[s.name];i?t.renderers[s.name]=function(...a){let p=o.apply(this,a);return p===!1&&(p=i.apply(this,a)),p}:t.renderers[s.name]=o}if("tokenizer"in s&&s.tokenizer){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[s.level];o?o.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new M(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let i=o,a=n.renderer[i];if(a===void 0)continue;let p=s[i];s[i]=(...u)=>{let d=a.apply(s,u);return d===!1&&(d=p.apply(s,u)),d===!1?"":d??""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new C(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let i=o,a=n.tokenizer[i];if(a===void 0)continue;let p=s[i];s[i]=(...u)=>{let d=a.apply(s,u);return d===!1&&(d=p.apply(s,u)),d}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new B;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let i=o,a=n.hooks[i];if(a===void 0)continue;let p=s[i];B.passThroughHooks.has(o)?s[i]=u=>{if(s.options.async&&B.passThroughHooksRespectAsync.has(o))return(async()=>{let k=await a.call(s,u);return p.call(s,k)})();let d=a.call(s,u);return p.call(s,d)}:s[i]=(...u)=>{if(s.options.async)return(async()=>{let k=await a.apply(s,u);return k===!1&&(k=await p.apply(s,u)),k})();let d=a.apply(s,u);return d===!1&&(d=p.apply(s,u)),d}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(i){let a=[];return v(a,o.call(this,i)),s&&v(a,s.call(this,i)),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return y.lex(e,t??this.defaults)}parser(e,t){return S.parse(e,t??this.defaults)}parseMarkdown(e){return(n,r)=>{let s={...r},o={...this.defaults,...s},i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&s.async===!1)return i(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."));if(typeof n>"u"||n===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let a=o.hooks?await o.hooks.preprocess(n):n,u=await(o.hooks?await o.hooks.provideLexer(e):e?y.lex:y.lexInline)(a,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let g=await(o.hooks?await o.hooks.provideParser(e):e?S.parse:S.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(g):g})().catch(i);try{o.hooks&&(n=o.hooks.preprocess(n));let p=(o.hooks?o.hooks.provideLexer(e):e?y.lex:y.lexInline)(n,o);o.hooks&&(p=o.hooks.processAllTokens(p)),o.walkTokens&&this.walkTokens(p,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?S.parse:S.parseInline)(p,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{let r=n instanceof Error?n:new Error(String(n));if(r.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+P(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}};var F=new se;function O(l,e){return F.parse(l,e)}function sn(l,e){return F.parseInline(l,e)}O.options=O.setOptions=function(l){return F.setOptions(l),O.defaults=F.defaults,ge(O.defaults),O};O.getDefaults=G;O.defaults=$;function on(...l){return F.use(...l),O.defaults=F.defaults,ge(O.defaults),O}O.use=on;O.walkTokens=function(l,e){return F.walkTokens(l,e)};O.parseInline=sn;O.Parser=S;O.parser=S.parse;O.Renderer=M;O.TextRenderer=q;O.Lexer=y;O.lexer=y.lex;O.Tokenizer=C;O.Hooks=B;O.parse=O;var Xn=O.options,Vn=O.setOptions,Jn=O.walkTokens,Yn=O.parseInline,er=O,tr=S.parse,nr=y.lex;export{B as Hooks,y as Lexer,se as Marked,S as Parser,M as Renderer,q as TextRenderer,C as Tokenizer,$ as defaults,G as getDefaults,nr as lexer,O as marked,Xn as options,er as parse,Yn as parseInline,tr as parser,Vn as setOptions,on as use,Jn as walkTokens};
|
|
|