59 lines
41 KiB
JavaScript
59 lines
41 KiB
JavaScript
module.exports=[22734,(a,b,c)=>{b.exports=a.x("fs",()=>require("fs"))},31790,a=>{"use strict";a.s(["EbookViewer",()=>b]);let b=(0,a.i(36931).registerClientReference)(function(){throw Error("Attempted to call EbookViewer() from the server but EbookViewer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/components/content/EbookViewer.tsx <module evaluation>","EbookViewer")},37177,a=>{"use strict";a.s(["EbookViewer",()=>b]);let b=(0,a.i(36931).registerClientReference)(function(){throw Error("Attempted to call EbookViewer() from the server but EbookViewer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/components/content/EbookViewer.tsx","EbookViewer")},54726,a=>{"use strict";a.i(31790);var b=a.i(37177);a.n(b)},73032,24914,a=>{"use strict";function b(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var c=b(),d={exec:()=>null};function e(a,b=""){let c="string"==typeof a?a:a.source,d={replace:(a,b)=>{let e="string"==typeof b?b:b.source;return e=e.replace(g.caret,"$1"),c=c.replace(a,e),d},getRegex:()=>new RegExp(c,b)};return d}var f=(()=>{try{return!!RegExp("(?<=1)(?<!1)")}catch{return!1}})(),g={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,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,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:a=>RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:a=>RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:a=>RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:a=>RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:a=>RegExp(`^ {0,${Math.min(3,a-1)}}#`),htmlBeginRegex:a=>RegExp(`^ {0,${Math.min(3,a-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:a=>RegExp(`^ {0,${Math.min(3,a-1)}}>`)},h=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,i=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,j=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,k=e(j).replace(/bull/g,i).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(),l=e(j).replace(/bull/g,i).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(),m=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,n=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,o=e(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",n).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),p=e(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,i).getRegex(),q="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",r=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,s=e("^ {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",r).replace("tag",q).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),t=e(m).replace("hr",h).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",q).getRegex(),u={blockquote:e(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",t).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:o,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:h,html:s,lheading:k,list:p,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:t,table:d,text:/^[^\n]+/},v=e("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",h).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",q).getRegex(),w={...u,lheading:l,table:v,paragraph:e(m).replace("hr",h).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",v).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",q).getRegex()},x={...u,html:e(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",r).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:d,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:e(m).replace("hr",h).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",k).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},y=/^( {2,}|\\)\n(?!\s*$)/,z=/[\p{P}\p{S}]/u,A=/[\s\p{P}\p{S}]/u,B=/[^\s\p{P}\p{S}]/u,C=e(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,A).getRegex(),D=/(?!~)[\p{P}\p{S}]/u,E=/(?![*_])[\p{P}\p{S}]/u,F=e(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",f?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),G=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,H=e(G,"u").replace(/punct/g,z).getRegex(),I=e(G,"u").replace(/punct/g,D).getRegex(),J="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",K=e(J,"gu").replace(/notPunctSpace/g,B).replace(/punctSpace/g,A).replace(/punct/g,z).getRegex(),L=e(J,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,D).getRegex(),M=e("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,B).replace(/punctSpace/g,A).replace(/punct/g,z).getRegex(),N=e(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,E).getRegex(),O=e("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|[*_])/u).replace(/punctSpace/g,/(?![*_])[\s\p{P}\p{S}]/u).replace(/punct/g,E).getRegex(),P=e(/\\(punct)/,"gu").replace(/punct/g,z).getRegex(),Q=e(/^<(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(),R=e(r).replace("(?:-->|$)","-->").getRegex(),S=e("^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",R).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),T=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,U=e(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",T).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),V=e(/^!?\[(label)\]\[(ref)\]/).replace("label",T).replace("ref",n).getRegex(),W=e(/^!?\[(ref)\](?:\[\])?/).replace("ref",n).getRegex(),X=e("reflink|nolink(?!\\()","g").replace("reflink",V).replace("nolink",W).getRegex(),Y=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Z={_backpedal:d,anyPunctuation:P,autolink:Q,blockSkip:F,br:y,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:d,delLDelim:d,delRDelim:d,emStrongLDelim:H,emStrongRDelimAst:K,emStrongRDelimUnd:M,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:U,nolink:W,punctuation:C,reflink:V,reflinkSearch:X,tag:S,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:d},$={...Z,link:e(/^!?\[(label)\]\((.*?)\)/).replace("label",T).getRegex(),reflink:e(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",T).getRegex()},_={...Z,emStrongRDelimAst:L,emStrongLDelim:I,delLDelim:N,delRDelim:O,url:e(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Y).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:e(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Y).getRegex()},aa={..._,br:e(y).replace("{2,}","*").getRegex(),text:e(_.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ab={normal:u,gfm:w,pedantic:x},ac={normal:Z,gfm:_,breaks:aa,pedantic:$},ad={"&":"&","<":"<",">":">",'"':""","'":"'"},ae=a=>ad[a];function af(a,b){if(b){if(g.escapeTest.test(a))return a.replace(g.escapeReplace,ae)}else if(g.escapeTestNoEncode.test(a))return a.replace(g.escapeReplaceNoEncode,ae);return a}function ag(a){try{a=encodeURI(a).replace(g.percentDecode,"%")}catch{return null}return a}function ah(a,b){let c=a.replace(g.findPipe,(a,b,c)=>{let d=!1,e=b;for(;--e>=0&&"\\"===c[e];)d=!d;return d?"|":" |"}).split(g.splitPipe),d=0;if(c[0].trim()||c.shift(),c.length>0&&!c.at(-1)?.trim()&&c.pop(),b)if(c.length>b)c.splice(b);else for(;c.length<b;)c.push("");for(;d<c.length;d++)c[d]=c[d].trim().replace(g.slashPipe,"|");return c}function ai(a,b,c){let d=a.length;if(0===d)return"";let e=0;for(;e<d;){let f=a.charAt(d-e-1);if(f!==b||c)if(f!==b&&c)e++;else break;else e++}return a.slice(0,d-e)}function aj(a,b,c,d,e){let f=b.href,g=b.title||null,h=a[1].replace(e.other.outputLinkReplace,"$1");d.state.inLink=!0;let i={type:"!"===a[0].charAt(0)?"image":"link",raw:c,href:f,title:g,text:h,tokens:d.inlineTokens(h)};return d.state.inLink=!1,i}var ak=class{options;rules;lexer;constructor(a){this.options=a||c}space(a){let b=this.rules.block.newline.exec(a);if(b&&b[0].length>0)return{type:"space",raw:b[0]}}code(a){let b=this.rules.block.code.exec(a);if(b){let a=b[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:b[0],codeBlockStyle:"indented",text:this.options.pedantic?a:ai(a,`
|
|
`)}}}fences(a){let b=this.rules.block.fences.exec(a);if(b){let a=b[0],c=function(a,b,c){let d=a.match(c.other.indentCodeCompensation);if(null===d)return b;let e=d[1];return b.split(`
|
|
`).map(a=>{let b=a.match(c.other.beginningSpace);if(null===b)return a;let[d]=b;return d.length>=e.length?a.slice(e.length):a}).join(`
|
|
`)}(a,b[3]||"",this.rules);return{type:"code",raw:a,lang:b[2]?b[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):b[2],text:c}}}heading(a){let b=this.rules.block.heading.exec(a);if(b){let a=b[2].trim();if(this.rules.other.endingHash.test(a)){let b=ai(a,"#");(this.options.pedantic||!b||this.rules.other.endingSpaceChar.test(b))&&(a=b.trim())}return{type:"heading",raw:b[0],depth:b[1].length,text:a,tokens:this.lexer.inline(a)}}}hr(a){let b=this.rules.block.hr.exec(a);if(b)return{type:"hr",raw:ai(b[0],`
|
|
`)}}blockquote(a){let b=this.rules.block.blockquote.exec(a);if(b){let a=ai(b[0],`
|
|
`).split(`
|
|
`),c="",d="",e=[];for(;a.length>0;){let b=!1,f=[],g;for(g=0;g<a.length;g++)if(this.rules.other.blockquoteStart.test(a[g]))f.push(a[g]),b=!0;else if(b)break;else f.push(a[g]);a=a.slice(g);let h=f.join(`
|
|
`),i=h.replace(this.rules.other.blockquoteSetextReplace,`
|
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");c=c?`${c}
|
|
${h}`:h,d=d?`${d}
|
|
${i}`:i;let j=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(i,e,!0),this.lexer.state.top=j,0===a.length)break;let k=e.at(-1);if(k?.type==="code")break;if(k?.type==="blockquote"){let b=k.raw+`
|
|
`+a.join(`
|
|
`),f=this.blockquote(b);e[e.length-1]=f,c=c.substring(0,c.length-k.raw.length)+f.raw,d=d.substring(0,d.length-k.text.length)+f.text;break}if(k?.type==="list"){let b=k.raw+`
|
|
`+a.join(`
|
|
`),f=this.list(b);e[e.length-1]=f,c=c.substring(0,c.length-k.raw.length)+f.raw,d=d.substring(0,d.length-k.raw.length)+f.raw,a=b.substring(e.at(-1).raw.length).split(`
|
|
`);continue}}return{type:"blockquote",raw:c,tokens:e,text:d}}}list(a){let b=this.rules.block.list.exec(a);if(b){let c=b[1].trim(),d=c.length>1,e={type:"list",raw:"",ordered:d,start:d?+c.slice(0,-1):"",loose:!1,items:[]};c=d?`\\d{1,9}\\${c.slice(-1)}`:`\\${c}`,this.options.pedantic&&(c=d?c:"[*+-]");let f=this.rules.other.listItemRegex(c),g=!1;for(;a;){let c=!1,d="",h="";if(!(b=f.exec(a))||this.rules.block.hr.test(a))break;d=b[0],a=a.substring(d.length);let i=function(a,b=0){let c=b,d="";for(let b of a)if(" "===b){let a=4-c%4;d+=" ".repeat(a),c+=a}else d+=b,c++;return d}(b[2].split(`
|
|
`,1)[0],b[1].length),j=a.split(`
|
|
`,1)[0],k=!i.trim(),l=0;if(this.options.pedantic?(l=2,h=i.trimStart()):k?l=b[1].length+1:(l=(l=i.search(this.rules.other.nonSpaceChar))>4?1:l,h=i.slice(l),l+=b[1].length),k&&this.rules.other.blankLine.test(j)&&(d+=j+`
|
|
`,a=a.substring(j.length+1),c=!0),!c){let b=this.rules.other.nextBulletRegex(l),c=this.rules.other.hrRegex(l),e=this.rules.other.fencesBeginRegex(l),f=this.rules.other.headingBeginRegex(l),g=this.rules.other.htmlBeginRegex(l),m=this.rules.other.blockquoteBeginRegex(l);for(;a;){let n=a.split(`
|
|
`,1)[0],o;if(j=n,o=this.options.pedantic?j=j.replace(this.rules.other.listReplaceNesting," "):j.replace(this.rules.other.tabCharGlobal," "),e.test(j)||f.test(j)||g.test(j)||m.test(j)||b.test(j)||c.test(j))break;if(o.search(this.rules.other.nonSpaceChar)>=l||!j.trim())h+=`
|
|
`+o.slice(l);else{if(k||i.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||e.test(i)||f.test(i)||c.test(i))break;h+=`
|
|
`+j}k=!j.trim(),d+=n+`
|
|
`,a=a.substring(n.length+1),i=o.slice(l)}}e.loose||(g?e.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(g=!0)),e.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),e.raw+=d}let h=e.items.at(-1);if(!h)return;for(let a of(h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd(),e.raw=e.raw.trimEnd(),e.items)){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let a=this.lexer.inlineQueue.length-1;a>=0;a--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[a].src)){this.lexer.inlineQueue[a].src=this.lexer.inlineQueue[a].src.replace(this.rules.other.listReplaceTask,"");break}}let b=this.rules.other.listTaskCheckbox.exec(a.raw);if(b){let c={type:"checkbox",raw:b[0]+" ",checked:"[ ]"!==b[0]};a.checked=c.checked,e.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=c.raw+a.tokens[0].raw,a.tokens[0].text=c.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(c)):a.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):a.tokens.unshift(c)}}if(!e.loose){let b=a.tokens.filter(a=>"space"===a.type);e.loose=b.length>0&&b.some(a=>this.rules.other.anyLine.test(a.raw))}}if(e.loose)for(let a of e.items)for(let b of(a.loose=!0,a.tokens))"text"===b.type&&(b.type="paragraph");return e}}html(a){let b=this.rules.block.html.exec(a);if(b)return{type:"html",block:!0,raw:b[0],pre:"pre"===b[1]||"script"===b[1]||"style"===b[1],text:b[0]}}def(a){let b=this.rules.block.def.exec(a);if(b){let a=b[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),c=b[2]?b[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=b[3]?b[3].substring(1,b[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):b[3];return{type:"def",tag:a,raw:b[0],href:c,title:d}}}table(a){let b=this.rules.block.table.exec(a);if(!b||!this.rules.other.tableDelimiter.test(b[2]))return;let c=ah(b[1]),d=b[2].replace(this.rules.other.tableAlignChars,"").split("|"),e=b[3]?.trim()?b[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
`):[],f={type:"table",raw:b[0],header:[],align:[],rows:[]};if(c.length===d.length){for(let a of d)this.rules.other.tableAlignRight.test(a)?f.align.push("right"):this.rules.other.tableAlignCenter.test(a)?f.align.push("center"):this.rules.other.tableAlignLeft.test(a)?f.align.push("left"):f.align.push(null);for(let a=0;a<c.length;a++)f.header.push({text:c[a],tokens:this.lexer.inline(c[a]),header:!0,align:f.align[a]});for(let a of e)f.rows.push(ah(a,f.header.length).map((a,b)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:f.align[b]})));return f}}lheading(a){let b=this.rules.block.lheading.exec(a);if(b)return{type:"heading",raw:b[0],depth:"="===b[2].charAt(0)?1:2,text:b[1],tokens:this.lexer.inline(b[1])}}paragraph(a){let b=this.rules.block.paragraph.exec(a);if(b){let a=b[1].charAt(b[1].length-1)===`
|
|
`?b[1].slice(0,-1):b[1];return{type:"paragraph",raw:b[0],text:a,tokens:this.lexer.inline(a)}}}text(a){let b=this.rules.block.text.exec(a);if(b)return{type:"text",raw:b[0],text:b[0],tokens:this.lexer.inline(b[0])}}escape(a){let b=this.rules.inline.escape.exec(a);if(b)return{type:"escape",raw:b[0],text:b[1]}}tag(a){let b=this.rules.inline.tag.exec(a);if(b)return!this.lexer.state.inLink&&this.rules.other.startATag.test(b[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(b[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(b[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(b[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:b[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:b[0]}}link(a){let b=this.rules.inline.link.exec(a);if(b){let a=b[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(a)){if(!this.rules.other.endAngleBracket.test(a))return;let b=ai(a.slice(0,-1),"\\");if((a.length-b.length)%2==0)return}else{let a=function(a,b){if(-1===a.indexOf(")"))return -1;let c=0;for(let b=0;b<a.length;b++)if("\\"===a[b])b++;else if("("===a[b])c++;else if(")"===a[b]&&--c<0)return b;return c>0?-2:-1}(b[2],0);if(-2===a)return;if(a>-1){let c=(0===b[0].indexOf("!")?5:4)+b[1].length+a;b[2]=b[2].substring(0,a),b[0]=b[0].substring(0,c).trim(),b[3]=""}}let c=b[2],d="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(c);a&&(c=a[1],d=a[3])}else d=b[3]?b[3].slice(1,-1):"";return c=c.trim(),this.rules.other.startAngleBracket.test(c)&&(c=this.options.pedantic&&!this.rules.other.endAngleBracket.test(a)?c.slice(1):c.slice(1,-1)),aj(b,{href:c&&c.replace(this.rules.inline.anyPunctuation,"$1"),title:d&&d.replace(this.rules.inline.anyPunctuation,"$1")},b[0],this.lexer,this.rules)}}reflink(a,b){let c;if((c=this.rules.inline.reflink.exec(a))||(c=this.rules.inline.nolink.exec(a))){let a=b[(c[2]||c[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!a){let a=c[0].charAt(0);return{type:"text",raw:a,text:a}}return aj(c,a,c[0],this.lexer,this.rules)}}emStrong(a,b,c=""){let d=this.rules.inline.emStrongLDelim.exec(a);if(!(!d||d[3]&&c.match(this.rules.other.unicodeAlphaNumeric))&&(!(d[1]||d[2])||!c||this.rules.inline.punctuation.exec(c))){let c=[...d[0]].length-1,e,f,g=c,h=0,i="*"===d[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(i.lastIndex=0,b=b.slice(-1*a.length+c);null!=(d=i.exec(b));){if(!(e=d[1]||d[2]||d[3]||d[4]||d[5]||d[6]))continue;if(f=[...e].length,d[3]||d[4]){g+=f;continue}if((d[5]||d[6])&&c%3&&!((c+f)%3)){h+=f;continue}if((g-=f)>0)continue;f=Math.min(f,f+g+h);let b=[...d[0]][0].length,i=a.slice(0,c+d.index+b+f);if(Math.min(c,f)%2){let a=i.slice(1,-1);return{type:"em",raw:i,text:a,tokens:this.lexer.inlineTokens(a)}}let j=i.slice(2,-2);return{type:"strong",raw:i,text:j,tokens:this.lexer.inlineTokens(j)}}}}codespan(a){let b=this.rules.inline.code.exec(a);if(b){let a=b[2].replace(this.rules.other.newLineCharGlobal," "),c=this.rules.other.nonSpaceChar.test(a),d=this.rules.other.startingSpaceChar.test(a)&&this.rules.other.endingSpaceChar.test(a);return c&&d&&(a=a.substring(1,a.length-1)),{type:"codespan",raw:b[0],text:a}}}br(a){let b=this.rules.inline.br.exec(a);if(b)return{type:"br",raw:b[0]}}del(a,b,c=""){let d=this.rules.inline.delLDelim.exec(a);if(d&&(!d[1]||!c||this.rules.inline.punctuation.exec(c))){let c=[...d[0]].length-1,e,f,g=c,h=this.rules.inline.delRDelim;for(h.lastIndex=0,b=b.slice(-1*a.length+c);null!=(d=h.exec(b));){if(!(e=d[1]||d[2]||d[3]||d[4]||d[5]||d[6])||(f=[...e].length)!==c)continue;if(d[3]||d[4]){g+=f;continue}if((g-=f)>0)continue;f=Math.min(f,f+g);let b=[...d[0]][0].length,h=a.slice(0,c+d.index+b+f),i=h.slice(c,-c);return{type:"del",raw:h,text:i,tokens:this.lexer.inlineTokens(i)}}}}autolink(a){let b=this.rules.inline.autolink.exec(a);if(b){let a,c;return c="@"===b[2]?"mailto:"+(a=b[1]):a=b[1],{type:"link",raw:b[0],text:a,href:c,tokens:[{type:"text",raw:a,text:a}]}}}url(a){let b;if(b=this.rules.inline.url.exec(a)){let a,c;if("@"===b[2])c="mailto:"+(a=b[0]);else{let d;do d=b[0],b[0]=this.rules.inline._backpedal.exec(b[0])?.[0]??"";while(d!==b[0])a=b[0],c="www."===b[1]?"http://"+b[0]:b[0]}return{type:"link",raw:b[0],text:a,href:c,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(a){let b=this.rules.inline.text.exec(a);if(b){let a=this.lexer.state.inRawBlock;return{type:"text",raw:b[0],text:b[0],escaped:a}}}},al=class a{tokens;options;state;inlineQueue;tokenizer;constructor(a){this.tokens=[],this.tokens.links=Object.create(null),this.options=a||c,this.options.tokenizer=this.options.tokenizer||new ak,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let b={other:g,block:ab.normal,inline:ac.normal};this.options.pedantic?(b.block=ab.pedantic,b.inline=ac.pedantic):this.options.gfm&&(b.block=ab.gfm,this.options.breaks?b.inline=ac.breaks:b.inline=ac.gfm),this.tokenizer.rules=b}static get rules(){return{block:ab,inline:ac}}static lex(b,c){return new a(c).lex(b)}static lexInline(b,c){return new a(c).inlineTokens(b)}lex(a){a=a.replace(g.carriageReturn,`
|
|
`),this.blockTokens(a,this.tokens);for(let a=0;a<this.inlineQueue.length;a++){let b=this.inlineQueue[a];this.inlineTokens(b.src,b.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(a,b=[],c=!1){for(this.options.pedantic&&(a=a.replace(g.tabCharGlobal," ").replace(g.spaceLine,""));a;){let d;if(this.options.extensions?.block?.some(c=>!!(d=c.call({lexer:this},a,b))&&(a=a.substring(d.raw.length),b.push(d),!0)))continue;if(d=this.tokenizer.space(a)){a=a.substring(d.raw.length);let c=b.at(-1);1===d.raw.length&&void 0!==c?c.raw+=`
|
|
`:b.push(d);continue}if(d=this.tokenizer.code(a)){a=a.substring(d.raw.length);let c=b.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
`)?"":`
|
|
`)+d.raw,c.text+=`
|
|
`+d.text,this.inlineQueue.at(-1).src=c.text):b.push(d);continue}if((d=this.tokenizer.fences(a))||(d=this.tokenizer.heading(a))||(d=this.tokenizer.hr(a))||(d=this.tokenizer.blockquote(a))||(d=this.tokenizer.list(a))||(d=this.tokenizer.html(a))){a=a.substring(d.raw.length),b.push(d);continue}if(d=this.tokenizer.def(a)){a=a.substring(d.raw.length);let c=b.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
`)?"":`
|
|
`)+d.raw,c.text+=`
|
|
`+d.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[d.tag]||(this.tokens.links[d.tag]={href:d.href,title:d.title},b.push(d));continue}if((d=this.tokenizer.table(a))||(d=this.tokenizer.lheading(a))){a=a.substring(d.raw.length),b.push(d);continue}let e=a;if(this.options.extensions?.startBlock){let b=1/0,c=a.slice(1),d;this.options.extensions.startBlock.forEach(a=>{"number"==typeof(d=a.call({lexer:this},c))&&d>=0&&(b=Math.min(b,d))}),b<1/0&&b>=0&&(e=a.substring(0,b+1))}if(this.state.top&&(d=this.tokenizer.paragraph(e))){let f=b.at(-1);c&&f?.type==="paragraph"?(f.raw+=(f.raw.endsWith(`
|
|
`)?"":`
|
|
`)+d.raw,f.text+=`
|
|
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=f.text):b.push(d),c=e.length!==a.length,a=a.substring(d.raw.length);continue}if(d=this.tokenizer.text(a)){a=a.substring(d.raw.length);let c=b.at(-1);c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
`)?"":`
|
|
`)+d.raw,c.text+=`
|
|
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):b.push(d);continue}if(a){let b="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(b);break}throw Error(b)}}return this.state.top=!0,b}inline(a,b=[]){return this.inlineQueue.push({src:a,tokens:b}),b}inlineTokens(a,b=[]){let c,d=a,e=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;null!=(e=this.tokenizer.rules.inline.reflinkSearch.exec(d));)a.includes(e[0].slice(e[0].lastIndexOf("[")+1,-1))&&(d=d.slice(0,e.index)+"["+"a".repeat(e[0].length-2)+"]"+d.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(e=this.tokenizer.rules.inline.anyPunctuation.exec(d));)d=d.slice(0,e.index)+"++"+d.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(e=this.tokenizer.rules.inline.blockSkip.exec(d));)c=e[2]?e[2].length:0,d=d.slice(0,e.index+c)+"["+"a".repeat(e[0].length-c-2)+"]"+d.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);d=this.options.hooks?.emStrongMask?.call({lexer:this},d)??d;let f=!1,g="";for(;a;){let c;if(f||(g=""),f=!1,this.options.extensions?.inline?.some(d=>!!(c=d.call({lexer:this},a,b))&&(a=a.substring(c.raw.length),b.push(c),!0)))continue;if((c=this.tokenizer.escape(a))||(c=this.tokenizer.tag(a))||(c=this.tokenizer.link(a))){a=a.substring(c.raw.length),b.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length);let d=b.at(-1);"text"===c.type&&d?.type==="text"?(d.raw+=c.raw,d.text+=c.text):b.push(c);continue}if((c=this.tokenizer.emStrong(a,d,g))||(c=this.tokenizer.codespan(a))||(c=this.tokenizer.br(a))||(c=this.tokenizer.del(a,d,g))||(c=this.tokenizer.autolink(a))||!this.state.inLink&&(c=this.tokenizer.url(a))){a=a.substring(c.raw.length),b.push(c);continue}let e=a;if(this.options.extensions?.startInline){let b=1/0,c=a.slice(1),d;this.options.extensions.startInline.forEach(a=>{"number"==typeof(d=a.call({lexer:this},c))&&d>=0&&(b=Math.min(b,d))}),b<1/0&&b>=0&&(e=a.substring(0,b+1))}if(c=this.tokenizer.inlineText(e)){a=a.substring(c.raw.length),"_"!==c.raw.slice(-1)&&(g=c.raw.slice(-1)),f=!0;let d=b.at(-1);d?.type==="text"?(d.raw+=c.raw,d.text+=c.text):b.push(c);continue}if(a){let b="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(b);break}throw Error(b)}}return b}},am=class{options;parser;constructor(a){this.options=a||c}space(a){return""}code({text:a,lang:b,escaped:c}){let d=(b||"").match(g.notSpaceStart)?.[0],e=a.replace(g.endingNewline,"")+`
|
|
`;return d?'<pre><code class="language-'+af(d)+'">'+(c?e:af(e,!0))+`</code></pre>
|
|
`:"<pre><code>"+(c?e:af(e,!0))+`</code></pre>
|
|
`}blockquote({tokens:a}){return`<blockquote>
|
|
${this.parser.parse(a)}</blockquote>
|
|
`}html({text:a}){return a}def(a){return""}heading({tokens:a,depth:b}){return`<h${b}>${this.parser.parseInline(a)}</h${b}>
|
|
`}hr(a){return`<hr>
|
|
`}list(a){let b=a.ordered,c=a.start,d="";for(let b=0;b<a.items.length;b++){let c=a.items[b];d+=this.listitem(c)}let e=b?"ol":"ul";return"<"+e+(b&&1!==c?' start="'+c+'"':"")+`>
|
|
`+d+"</"+e+`>
|
|
`}listitem(a){return`<li>${this.parser.parse(a.tokens)}</li>
|
|
`}checkbox({checked:a}){return"<input "+(a?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:a}){return`<p>${this.parser.parseInline(a)}</p>
|
|
`}table(a){let b="",c="";for(let b=0;b<a.header.length;b++)c+=this.tablecell(a.header[b]);b+=this.tablerow({text:c});let d="";for(let b=0;b<a.rows.length;b++){let e=a.rows[b];c="";for(let a=0;a<e.length;a++)c+=this.tablecell(e[a]);d+=this.tablerow({text:c})}return d&&(d=`<tbody>${d}</tbody>`),`<table>
|
|
<thead>
|
|
`+b+`</thead>
|
|
`+d+`</table>
|
|
`}tablerow({text:a}){return`<tr>
|
|
${a}</tr>
|
|
`}tablecell(a){let b=this.parser.parseInline(a.tokens),c=a.header?"th":"td";return(a.align?`<${c} align="${a.align}">`:`<${c}>`)+b+`</${c}>
|
|
`}strong({tokens:a}){return`<strong>${this.parser.parseInline(a)}</strong>`}em({tokens:a}){return`<em>${this.parser.parseInline(a)}</em>`}codespan({text:a}){return`<code>${af(a,!0)}</code>`}br(a){return"<br>"}del({tokens:a}){return`<del>${this.parser.parseInline(a)}</del>`}link({href:a,title:b,tokens:c}){let d=this.parser.parseInline(c),e=ag(a);if(null===e)return d;let f='<a href="'+(a=e)+'"';return b&&(f+=' title="'+af(b)+'"'),f+=">"+d+"</a>"}image({href:a,title:b,text:c,tokens:d}){d&&(c=this.parser.parseInline(d,this.parser.textRenderer));let e=ag(a);if(null===e)return af(c);a=e;let f=`<img src="${a}" alt="${af(c)}"`;return b&&(f+=` title="${af(b)}"`),f+=">"}text(a){return"tokens"in a&&a.tokens?this.parser.parseInline(a.tokens):"escaped"in a&&a.escaped?a.text:af(a.text)}},an=class{strong({text:a}){return a}em({text:a}){return a}codespan({text:a}){return a}del({text:a}){return a}html({text:a}){return a}text({text:a}){return a}link({text:a}){return""+a}image({text:a}){return""+a}br(){return""}checkbox({raw:a}){return a}},ao=class a{options;renderer;textRenderer;constructor(a){this.options=a||c,this.options.renderer=this.options.renderer||new am,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new an}static parse(b,c){return new a(c).parse(b)}static parseInline(b,c){return new a(c).parseInline(b)}parse(a){let b="";for(let c=0;c<a.length;c++){let d=a[c];if(this.options.extensions?.renderers?.[d.type]){let a=this.options.extensions.renderers[d.type].call({parser:this},d);if(!1!==a||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){b+=a||"";continue}}switch(d.type){case"space":b+=this.renderer.space(d);break;case"hr":b+=this.renderer.hr(d);break;case"heading":b+=this.renderer.heading(d);break;case"code":b+=this.renderer.code(d);break;case"table":b+=this.renderer.table(d);break;case"blockquote":b+=this.renderer.blockquote(d);break;case"list":b+=this.renderer.list(d);break;case"checkbox":b+=this.renderer.checkbox(d);break;case"html":b+=this.renderer.html(d);break;case"def":b+=this.renderer.def(d);break;case"paragraph":b+=this.renderer.paragraph(d);break;case"text":b+=this.renderer.text(d);break;default:{let a='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw Error(a)}}}return b}parseInline(a,b=this.renderer){let c="";for(let d=0;d<a.length;d++){let e=a[d];if(this.options.extensions?.renderers?.[e.type]){let a=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==a||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(e.type)){c+=a||"";continue}}switch(e.type){case"escape":case"text":c+=b.text(e);break;case"html":c+=b.html(e);break;case"link":c+=b.link(e);break;case"image":c+=b.image(e);break;case"checkbox":c+=b.checkbox(e);break;case"strong":c+=b.strong(e);break;case"em":c+=b.em(e);break;case"codespan":c+=b.codespan(e);break;case"br":c+=b.br(e);break;case"del":c+=b.del(e);break;default:{let a='Token with "'+e.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw Error(a)}}}return c}},ap=class{options;block;constructor(a){this.options=a||c}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(a){return a}postprocess(a){return a}processAllTokens(a){return a}emStrongMask(a){return a}provideLexer(){return this.block?al.lex:al.lexInline}provideParser(){return this.block?ao.parse:ao.parseInline}},aq=new class{defaults=b();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ao;Renderer=am;TextRenderer=an;Lexer=al;Tokenizer=ak;Hooks=ap;constructor(...a){this.use(...a)}walkTokens(a,b){let c=[];for(let d of a)switch(c=c.concat(b.call(this,d)),d.type){case"table":for(let a of d.header)c=c.concat(this.walkTokens(a.tokens,b));for(let a of d.rows)for(let d of a)c=c.concat(this.walkTokens(d.tokens,b));break;case"list":c=c.concat(this.walkTokens(d.items,b));break;default:{let a=d;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let e=a[d].flat(1/0);c=c.concat(this.walkTokens(e,b))}):a.tokens&&(c=c.concat(this.walkTokens(a.tokens,b)))}}return c}use(...a){let b=this.defaults.extensions||{renderers:{},childTokens:{}};return a.forEach(a=>{let c={...a};if(c.async=this.defaults.async||c.async||!1,a.extensions&&(a.extensions.forEach(a=>{if(!a.name)throw Error("extension name required");if("renderer"in a){let c=b.renderers[a.name];c?b.renderers[a.name]=function(...b){let d=a.renderer.apply(this,b);return!1===d&&(d=c.apply(this,b)),d}:b.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||"block"!==a.level&&"inline"!==a.level)throw Error("extension level must be 'block' or 'inline'");let c=b[a.level];c?c.unshift(a.tokenizer):b[a.level]=[a.tokenizer],a.start&&("block"===a.level?b.startBlock?b.startBlock.push(a.start):b.startBlock=[a.start]:"inline"===a.level&&(b.startInline?b.startInline.push(a.start):b.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(b.childTokens[a.name]=a.childTokens)}),c.extensions=b),a.renderer){let b=this.defaults.renderer||new am(this.defaults);for(let c in a.renderer){if(!(c in b))throw Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;let d=a.renderer[c],e=b[c];b[c]=(...a)=>{let c=d.apply(b,a);return!1===c&&(c=e.apply(b,a)),c||""}}c.renderer=b}if(a.tokenizer){let b=this.defaults.tokenizer||new ak(this.defaults);for(let c in a.tokenizer){if(!(c in b))throw Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;let d=a.tokenizer[c],e=b[c];b[c]=(...a)=>{let c=d.apply(b,a);return!1===c&&(c=e.apply(b,a)),c}}c.tokenizer=b}if(a.hooks){let b=this.defaults.hooks||new ap;for(let c in a.hooks){if(!(c in b))throw Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;let d=a.hooks[c],e=b[c];ap.passThroughHooks.has(c)?b[c]=a=>{if(this.defaults.async&&ap.passThroughHooksRespectAsync.has(c))return(async()=>{let c=await d.call(b,a);return e.call(b,c)})();let f=d.call(b,a);return e.call(b,f)}:b[c]=(...a)=>{if(this.defaults.async)return(async()=>{let c=await d.apply(b,a);return!1===c&&(c=await e.apply(b,a)),c})();let c=d.apply(b,a);return!1===c&&(c=e.apply(b,a)),c}}c.hooks=b}if(a.walkTokens){let b=this.defaults.walkTokens,d=a.walkTokens;c.walkTokens=function(a){let c=[];return c.push(d.call(this,a)),b&&(c=c.concat(b.call(this,a))),c}}this.defaults={...this.defaults,...c}}),this}setOptions(a){return this.defaults={...this.defaults,...a},this}lexer(a,b){return al.lex(a,b??this.defaults)}parser(a,b){return ao.parse(a,b??this.defaults)}parseMarkdown(a){return(b,c)=>{let d={...c},e={...this.defaults,...d},f=this.onError(!!e.silent,!!e.async);if(!0===this.defaults.async&&!1===d.async)return f(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 b>"u"||null===b)return f(Error("marked(): input parameter is undefined or null"));if("string"!=typeof b)return f(Error("marked(): input parameter is of type "+Object.prototype.toString.call(b)+", string expected"));if(e.hooks&&(e.hooks.options=e,e.hooks.block=a),e.async)return(async()=>{let c=e.hooks?await e.hooks.preprocess(b):b,d=await (e.hooks?await e.hooks.provideLexer():a?al.lex:al.lexInline)(c,e),f=e.hooks?await e.hooks.processAllTokens(d):d;e.walkTokens&&await Promise.all(this.walkTokens(f,e.walkTokens));let g=await (e.hooks?await e.hooks.provideParser():a?ao.parse:ao.parseInline)(f,e);return e.hooks?await e.hooks.postprocess(g):g})().catch(f);try{e.hooks&&(b=e.hooks.preprocess(b));let c=(e.hooks?e.hooks.provideLexer():a?al.lex:al.lexInline)(b,e);e.hooks&&(c=e.hooks.processAllTokens(c)),e.walkTokens&&this.walkTokens(c,e.walkTokens);let d=(e.hooks?e.hooks.provideParser():a?ao.parse:ao.parseInline)(c,e);return e.hooks&&(d=e.hooks.postprocess(d)),d}catch(a){return f(a)}}}onError(a,b){return c=>{if(c.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,a){let a="<p>An error occurred:</p><pre>"+af(c.message+"",!0)+"</pre>";return b?Promise.resolve(a):a}if(b)return Promise.reject(c);throw c}}};function ar(a,b){return aq.parse(a,b)}function as(a){let b,c=ar.parse(a,{breaks:!0,gfm:!0}).replace(/<img /g,'<img loading="lazy" decoding="async" '),d=c.split(/(?=<h1[\s>])/i).filter(a=>a.trim());d.length<=1&&(d=c.split(/(?=<h2[\s>])/i).filter(a=>a.trim()));let e=[],f=/<h1[^>]*>(.*?)<\/h1>/gi;for(;null!==(b=f.exec(c));)e.push(b[1].replace(/<[^>]+>/g,""));if(0===e.length){let a=/<h2[^>]*>(.*?)<\/h2>/gi;for(;null!==(b=a.exec(c));)e.push(b[1].replace(/<[^>]+>/g,""))}return{chunks:d.map(a=>{let b=(a.match(/<img\b/g)||[]).length,c=Math.max(300,Math.round(.6*a.replace(/<[^>]+>/g,"").length+350*b));return{html:a,estimatedHeight:c}}),headers:e}}function at(a,b=400){return Math.max(1,Math.ceil(a/b))}ar.options=ar.setOptions=function(a){return aq.setOptions(a),ar.defaults=aq.defaults,c=ar.defaults,ar},ar.getDefaults=b,ar.defaults=c,ar.use=function(...a){return aq.use(...a),ar.defaults=aq.defaults,c=ar.defaults,ar},ar.walkTokens=function(a,b){return aq.walkTokens(a,b)},ar.parseInline=aq.parseInline,ar.Parser=ao,ar.parser=ao.parse,ar.Renderer=am,ar.TextRenderer=an,ar.Lexer=al,ar.lexer=al.lex,ar.Tokenizer=ak,ar.Hooks=ap,ar.parse=ar,ar.options,ar.setOptions,ar.use,ar.walkTokens,ar.parseInline,ao.parse,al.lex,a.s(["estimateReadingMinutes",()=>at,"parseEbookMarkdown",()=>as],73032),a.s(["CLOUDPHONE_EBOOK_CONFIG",0,{title:"云手机",backHref:"/",requireAuth:!1,estimatedMinutes:25,storagePrefix:"nomadvip-ebook-cloudphone"},"EBOOK_CONFIG",0,{title:"数字游民",backHref:"/",requireAuth:!1,estimatedMinutes:45,storagePrefix:"nomadvip-ebook"}],24914)}]; |