mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.Docs.git
synced 2025-11-19 21:16:31 +08:00
57 lines
40 KiB
JavaScript
57 lines
40 KiB
JavaScript
function K(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let q={baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const W=/[&<>"']/,Y=/[&<>"']/g,ee=/[<>"']|&(?!#?\w+;)/,te=/[<>"']|&(?!#?\w+;)/g,ne={"&":"&","<":"<",">":">",'"':""","'":"'"},M=h=>ne[h];function T(h,t){if(t){if(W.test(h))return h.replace(Y,M)}else if(ee.test(h))return h.replace(te,M);return h}const re=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function F(h){return h.replace(re,(t,e)=>(e=e.toLowerCase())==="colon"?":":e.charAt(0)==="#"?e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):"")}const se=/(^|[^\[])\^/g;function _(h,t){h=h.source||h,t=t||"";const e={replace:(n,r)=>(r=(r=r.source||r).replace(se,"$1"),h=h.replace(n,r),e),getRegex:()=>new RegExp(h,t)};return e}const ie=/[^\w:]/g,le=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function B(h,t,e){if(h){let n;try{n=decodeURIComponent(F(e)).replace(ie,"").toLowerCase()}catch{return null}if(n.indexOf("javascript:")===0||n.indexOf("vbscript:")===0||n.indexOf("data:")===0)return null}t&&!le.test(e)&&(e=function(n,r){C[" "+n]||(ae.test(n)?C[" "+n]=n+"/":C[" "+n]=Z(n,"/",!0));const s=(n=C[" "+n]).indexOf(":")===-1;return r.substring(0,2)==="//"?s?r:n.replace(oe,"$1")+r:r.charAt(0)==="/"?s?r:n.replace(ce,"$1")+r:n+r}(t,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const C={},ae=/^[^:]+:\/*[^/]*$/,oe=/^([^:]+:)[\s\S]*$/,ce=/^([^:]+:\/*[^/]*)[\s\S]*$/,N={exec:function(){}};function R(h){let t,e,n=1;for(;n<arguments.length;n++)for(e in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,e)&&(h[e]=t[e]);return h}function Q(h,t){const e=h.replace(/\|/g,(r,s,i)=>{let o=!1,p=s;for(;--p>=0&&i[p]==="\\";)o=!o;return o?"|":" |"}).split(/ \|/);let n=0;if(e[0].trim()||e.shift(),e.length>0&&!e[e.length-1].trim()&&e.pop(),e.length>t)e.splice(t);else for(;e.length<t;)e.push("");for(;n<e.length;n++)e[n]=e[n].trim().replace(/\\\|/g,"|");return e}function Z(h,t,e){const n=h.length;if(n===0)return"";let r=0;for(;r<n;){const s=h.charAt(n-r-1);if(s!==t||e){if(s===t||!e)break;r++}else r++}return h.substr(0,n-r)}function V(h){h&&h.sanitize&&!h.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function U(h,t){if(t<1)return"";let e="";for(;t>1;)1&t&&(e+=h),t>>=1,h+=h;return e+h}function j(h,t,e,n){const r=t.href,s=t.title?T(t.title):null,i=h[1].replace(/\\([\[\]])/g,"$1");if(h[0].charAt(0)!=="!"){n.state.inLink=!0;const o={type:"link",raw:e,href:r,title:s,text:i,tokens:n.inlineTokens(i,[])};return n.state.inLink=!1,o}return{type:"image",raw:e,href:r,title:s,text:T(i)}}class O{constructor(t){this.options=t||q}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Z(n,`
|
||
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=function(s,i){const o=s.match(/^(\s+)(?:```)/);if(o===null)return i;const p=o[1];return i.split(`
|
||
`).map(g=>{const a=g.match(/^\s+/);if(a===null)return g;const[l]=a;return l.length>=p.length?g.slice(p.length):g}).join(`
|
||
`)}(n,e[3]||"");return{type:"code",raw:n,lang:e[2]?e[2].trim():e[2],text:r}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(/#$/.test(n)){const s=Z(n,"#");this.options.pedantic?n=s.trim():s&&!/ $/.test(s)||(n=s.trim())}const r={type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:[]};return this.lexer.inline(r.text,r.tokens),r}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){const n=e[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:e[0],tokens:this.lexer.blockTokens(n,[]),text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n,r,s,i,o,p,g,a,l,c,d,w,m=e[1].trim();const b=m.length>1,f={type:"list",raw:"",ordered:b,start:b?+m.slice(0,-1):"",loose:!1,items:[]};m=b?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=b?m:"[*+-]");const S=new RegExp(`^( {0,3}${m})((?: [^\\n]*)?(?:\\n|$))`);for(;t&&(w=!1,e=S.exec(t))&&!this.rules.block.hr.test(t);){if(n=e[0],t=t.substring(n.length),a=e[2].split(`
|
||
`,1)[0],l=t.split(`
|
||
`,1)[0],this.options.pedantic?(i=2,d=a.trimLeft()):(i=e[2].search(/[^ ]/),i=i>4?1:i,d=a.slice(i),i+=e[1].length),p=!1,!a&&/^ *$/.test(l)&&(n+=l+`
|
||
`,t=t.substring(l.length+1),w=!0),!w){const $=new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])`);for(;t&&(c=t.split(`
|
||
`,1)[0],a=c,this.options.pedantic&&(a=a.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!$.test(a));){if(a.search(/[^ ]/)>=i||!a.trim())d+=`
|
||
`+a.slice(i);else{if(p)break;d+=`
|
||
`+a}p||a.trim()||(p=!0),n+=c+`
|
||
`,t=t.substring(c.length+1)}}f.loose||(g?f.loose=!0:/\n *\n *$/.test(n)&&(g=!0)),this.options.gfm&&(r=/^\[[ xX]\] /.exec(d),r&&(s=r[0]!=="[ ] ",d=d.replace(/^\[[ xX]\] +/,""))),f.items.push({type:"list_item",raw:n,task:!!r,checked:s,loose:!1,text:d}),f.raw+=n}f.items[f.items.length-1].raw=n.trimRight(),f.items[f.items.length-1].text=d.trimRight(),f.raw=f.raw.trimRight();const y=f.items.length;for(o=0;o<y;o++){this.lexer.state.top=!1,f.items[o].tokens=this.lexer.blockTokens(f.items[o].text,[]);const $=f.items[o].tokens.filter(z=>z.type==="space"),A=$.every(z=>{const I=z.raw.split("");let L=0;for(const J of I)if(J===`
|
||
`&&(L+=1),L>1)return!0;return!1});!f.loose&&$.length&&A&&(f.loose=!0,f.items[o].loose=!0)}return f}}html(t){const e=this.rules.block.html.exec(t);if(e){const n={type:"html",raw:e[0],pre:!this.options.sanitizer&&(e[1]==="pre"||e[1]==="script"||e[1]==="style"),text:e[0]};return this.options.sanitize&&(n.type="paragraph",n.text=this.options.sanitizer?this.options.sanitizer(e[0]):T(e[0]),n.tokens=[],this.lexer.inline(n.text,n.tokens)),n}}def(t){const e=this.rules.block.def.exec(t);if(e)return e[3]&&(e[3]=e[3].substring(1,e[3].length-1)),{type:"def",tag:e[1].toLowerCase().replace(/\s+/g," "),raw:e[0],href:e[2],title:e[3]}}table(t){const e=this.rules.block.table.exec(t);if(e){const n={type:"table",header:Q(e[1]).map(r=>({text:r})),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
|
||
`):[]};if(n.header.length===n.align.length){n.raw=e[0];let r,s,i,o,p=n.align.length;for(r=0;r<p;r++)/^ *-+: *$/.test(n.align[r])?n.align[r]="right":/^ *:-+: *$/.test(n.align[r])?n.align[r]="center":/^ *:-+ *$/.test(n.align[r])?n.align[r]="left":n.align[r]=null;for(p=n.rows.length,r=0;r<p;r++)n.rows[r]=Q(n.rows[r],n.header.length).map(g=>({text:g}));for(p=n.header.length,s=0;s<p;s++)n.header[s].tokens=[],this.lexer.inlineTokens(n.header[s].text,n.header[s].tokens);for(p=n.rows.length,s=0;s<p;s++)for(o=n.rows[s],i=0;i<o.length;i++)o[i].tokens=[],this.lexer.inlineTokens(o[i].text,o[i].tokens);return n}}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e){const n={type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n={type:"paragraph",raw:e[0],text:e[1].charAt(e[1].length-1)===`
|
||
`?e[1].slice(0,-1):e[1],tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}text(t){const e=this.rules.block.text.exec(t);if(e){const n={type:"text",raw:e[0],text:e[0],tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:T(e[1])}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):T(e[0]):e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const i=Z(n.slice(0,-1),"\\");if((n.length-i.length)%2==0)return}else{const i=function(o,p){if(o.indexOf(p[1])===-1)return-1;const g=o.length;let a=0,l=0;for(;l<g;l++)if(o[l]==="\\")l++;else if(o[l]===p[0])a++;else if(o[l]===p[1]&&(a--,a<0))return l;return-1}(e[2],"()");if(i>-1){const o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){const i=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),/^</.test(r)&&(r=this.options.pedantic&&!/>$/.test(n)?r.slice(1):r.slice(1,-1)),j(e,{href:r&&r.replace(this.rules.inline._escapes,"$1"),title:s&&s.replace(this.rules.inline._escapes,"$1")},e[0],this.lexer)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(/\s+/g," ");if(r=e[r.toLowerCase()],!r||!r.href){const s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return j(n,r,n[0],this.lexer)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrong.lDelim.exec(t);if(!r||r[3]&&n.match(/[\p{L}\p{N}]/u))return;const s=r[1]||r[2]||"";if(!s||s&&(n===""||this.rules.inline.punctuation.exec(n))){const i=r[0].length-1;let o,p,g=i,a=0;const l=r[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,e=e.slice(-1*t.length+i);(r=l.exec(e))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(p=o.length,r[3]||r[4]){g+=p;continue}if((r[5]||r[6])&&i%3&&!((i+p)%3)){a+=p;continue}if(g-=p,g>0)continue;if(p=Math.min(p,p+g+a),Math.min(i,p)%2){const d=t.slice(1,i+r.index+p);return{type:"em",raw:t.slice(0,i+r.index+p+1),text:d,tokens:this.lexer.inlineTokens(d,[])}}const c=t.slice(2,i+r.index+p-1);return{type:"strong",raw:t.slice(0,i+r.index+p+1),text:c,tokens:this.lexer.inlineTokens(c,[])}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(/\n/g," ");const r=/[^ ]/.test(n),s=/^ /.test(n)&&/ $/.test(n);return r&&s&&(n=n.substring(1,n.length-1)),n=T(n,!0),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2],[])}}autolink(t,e){const n=this.rules.inline.autolink.exec(t);if(n){let r,s;return n[2]==="@"?(r=T(this.options.mangle?e(n[1]):n[1]),s="mailto:"+r):(r=T(n[1]),s=r),{type:"link",raw:n[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(t,e){let n;if(n=this.rules.inline.url.exec(t)){let r,s;if(n[2]==="@")r=T(this.options.mangle?e(n[0]):n[0]),s="mailto:"+r;else{let i;do i=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(i!==n[0]);r=T(n[0]),s=n[1]==="www."?"http://"+r:r}return{type:"link",raw:n[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t,e){const n=this.rules.inline.text.exec(t);if(n){let r;return r=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):T(n[0]):n[0]:T(this.options.smartypants?e(n[0]):n[0]),{type:"text",raw:n[0],text:r}}}}const k={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,html:"^ {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|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:N,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};k.def=_(k.def).replace("label",k._label).replace("title",k._title).getRegex(),k.bullet=/(?:[*+-]|\d{1,9}[.)])/,k.listItemStart=_(/^( *)(bull) */).replace("bull",k.bullet).getRegex(),k.list=_(k.list).replace(/bull/g,k.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+k.def.source+")").getRegex(),k._tag="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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",k._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,k.html=_(k.html,"i").replace("comment",k._comment).replace("tag",k._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k.paragraph=_(k._paragraph).replace("hr",k.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",k._tag).getRegex(),k.blockquote=_(k.blockquote).replace("paragraph",k.paragraph).getRegex(),k.normal=R({},k),k.gfm=R({},k.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),k.gfm.table=_(k.gfm.table).replace("hr",k.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",k._tag).getRegex(),k.gfm.paragraph=_(k._paragraph).replace("hr",k.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",k.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",k._tag).getRegex(),k.pedantic=R({},k.normal,{html:_(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",k._comment).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,paragraph:_(k.normal._paragraph).replace("hr",k.hr).replace("heading",` *#{1,6} *[^
|
||
]`).replace("lheading",k.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const u={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:N,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:N,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};function he(h){return h.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function H(h){let t,e,n="";const r=h.length;for(t=0;t<r;t++)e=h.charCodeAt(t),Math.random()>.5&&(e="x"+e.toString(16)),n+="&#"+e+";";return n}u._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",u.punctuation=_(u.punctuation).replace(/punctuation/g,u._punctuation).getRegex(),u.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,u.escapedEmSt=/\\\*|\\_/g,u._comment=_(k._comment).replace("(?:-->|$)","-->").getRegex(),u.emStrong.lDelim=_(u.emStrong.lDelim).replace(/punct/g,u._punctuation).getRegex(),u.emStrong.rDelimAst=_(u.emStrong.rDelimAst,"g").replace(/punct/g,u._punctuation).getRegex(),u.emStrong.rDelimUnd=_(u.emStrong.rDelimUnd,"g").replace(/punct/g,u._punctuation).getRegex(),u._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,u._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,u._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])?)+(?![-_])/,u.autolink=_(u.autolink).replace("scheme",u._scheme).replace("email",u._email).getRegex(),u._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,u.tag=_(u.tag).replace("comment",u._comment).replace("attribute",u._attribute).getRegex(),u._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,u._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,u._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,u.link=_(u.link).replace("label",u._label).replace("href",u._href).replace("title",u._title).getRegex(),u.reflink=_(u.reflink).replace("label",u._label).replace("ref",k._label).getRegex(),u.nolink=_(u.nolink).replace("ref",k._label).getRegex(),u.reflinkSearch=_(u.reflinkSearch,"g").replace("reflink",u.reflink).replace("nolink",u.nolink).getRegex(),u.normal=R({},u),u.pedantic=R({},u.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:_(/^!?\[(label)\]\((.*?)\)/).replace("label",u._label).getRegex(),reflink:_(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",u._label).getRegex()}),u.gfm=R({},u.normal,{escape:_(u.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),u.gfm.url=_(u.gfm.url,"i").replace("email",u.gfm._extended_email).getRegex(),u.breaks=R({},u.gfm,{br:_(u.br).replace("{2,}","*").getRegex(),text:_(u.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});class v{constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||q,this.options.tokenizer=this.options.tokenizer||new O,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const e={block:k.normal,inline:u.normal};this.options.pedantic?(e.block=k.pedantic,e.inline=u.pedantic):this.options.gfm&&(e.block=k.gfm,this.options.breaks?e.inline=u.breaks:e.inline=u.gfm),this.tokenizer.rules=e}static get rules(){return{block:k,inline:u}}static lex(t,e){return new v(e).lex(t)}static lexInline(t,e){return new v(e).inlineTokens(t)}lex(t){let e;for(t=t.replace(/\r\n|\r/g,`
|
||
`).replace(/\t/g," "),this.blockTokens(t,this.tokens);e=this.inlineQueue.shift();)this.inlineTokens(e.src,e.tokens);return this.tokens}blockTokens(t,e=[]){let n,r,s,i;for(this.options.pedantic&&(t=t.replace(/^ +$/gm,""));t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(o=>!!(n=o.call({lexer:this},t,e))&&(t=t.substring(n.raw.length),e.push(n),!0))))if(n=this.tokenizer.space(t))t=t.substring(n.raw.length),n.raw.length===1&&e.length>0?e[e.length-1].raw+=`
|
||
`:e.push(n);else if(n=this.tokenizer.code(t))t=t.substring(n.raw.length),r=e[e.length-1],!r||r.type!=="paragraph"&&r.type!=="text"?e.push(n):(r.raw+=`
|
||
`+n.raw,r.text+=`
|
||
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.fences(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.heading(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.hr(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.blockquote(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.list(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.html(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.def(t))t=t.substring(n.raw.length),r=e[e.length-1],!r||r.type!=="paragraph"&&r.type!=="text"?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(r.raw+=`
|
||
`+n.raw,r.text+=`
|
||
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.table(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.lheading(t))t=t.substring(n.raw.length),e.push(n);else{if(s=t,this.options.extensions&&this.options.extensions.startBlock){let o=1/0;const p=t.slice(1);let g;this.options.extensions.startBlock.forEach(function(a){g=a.call({lexer:this},p),typeof g=="number"&&g>=0&&(o=Math.min(o,g))}),o<1/0&&o>=0&&(s=t.substring(0,o+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s)))r=e[e.length-1],i&&r.type==="paragraph"?(r.raw+=`
|
||
`+n.raw,r.text+=`
|
||
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):e.push(n),i=s.length!==t.length,t=t.substring(n.raw.length);else if(n=this.tokenizer.text(t))t=t.substring(n.raw.length),r=e[e.length-1],r&&r.type==="text"?(r.raw+=`
|
||
`+n.raw,r.text+=`
|
||
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):e.push(n);else if(t){const o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}throw new Error(o)}}return this.state.top=!0,e}inline(t,e){this.inlineQueue.push({src:t,tokens:e})}inlineTokens(t,e=[]){let n,r,s,i,o,p,g=t;if(this.tokens.links){const a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(g))!=null;)a.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(g=g.slice(0,i.index)+"["+U("a",i[0].length-2)+"]"+g.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.blockSkip.exec(g))!=null;)g=g.slice(0,i.index)+"["+U("a",i[0].length-2)+"]"+g.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(i=this.tokenizer.rules.inline.escapedEmSt.exec(g))!=null;)g=g.slice(0,i.index)+"++"+g.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;t;)if(o||(p=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(a=>!!(n=a.call({lexer:this},t,e))&&(t=t.substring(n.raw.length),e.push(n),!0))))if(n=this.tokenizer.escape(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.tag(t))t=t.substring(n.raw.length),r=e[e.length-1],r&&n.type==="text"&&r.type==="text"?(r.raw+=n.raw,r.text+=n.text):e.push(n);else if(n=this.tokenizer.link(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.reflink(t,this.tokens.links))t=t.substring(n.raw.length),r=e[e.length-1],r&&n.type==="text"&&r.type==="text"?(r.raw+=n.raw,r.text+=n.text):e.push(n);else if(n=this.tokenizer.emStrong(t,g,p))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.codespan(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.br(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.del(t))t=t.substring(n.raw.length),e.push(n);else if(n=this.tokenizer.autolink(t,H))t=t.substring(n.raw.length),e.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(t,H))){if(s=t,this.options.extensions&&this.options.extensions.startInline){let a=1/0;const l=t.slice(1);let c;this.options.extensions.startInline.forEach(function(d){c=d.call({lexer:this},l),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(s=t.substring(0,a+1))}if(n=this.tokenizer.inlineText(s,he))t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(p=n.raw.slice(-1)),o=!0,r=e[e.length-1],r&&r.type==="text"?(r.raw+=n.raw,r.text+=n.text):e.push(n);else if(t){const a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}throw new Error(a)}}else t=t.substring(n.raw.length),e.push(n);return e}}class P{constructor(t){this.options=t||q}code(t,e,n){const r=(e||"").match(/\S*/)[0];if(this.options.highlight){const s=this.options.highlight(t,r);s!=null&&s!==t&&(n=!0,t=s)}return t=t.replace(/\n$/,"")+`
|
||
`,r?'<pre><code class="'+this.options.langPrefix+T(r,!0)+'">'+(n?t:T(t,!0))+`</code></pre>
|
||
`:"<pre><code>"+(n?t:T(t,!0))+`</code></pre>
|
||
`}blockquote(t){return`<blockquote>
|
||
`+t+`</blockquote>
|
||
`}html(t){return t}heading(t,e,n,r){return this.options.headerIds?"<h"+e+' id="'+this.options.headerPrefix+r.slug(n)+'">'+t+"</h"+e+`>
|
||
`:"<h"+e+">"+t+"</h"+e+`>
|
||
`}hr(){return this.options.xhtml?`<hr/>
|
||
`:`<hr>
|
||
`}list(t,e,n){const r=e?"ol":"ul";return"<"+r+(e&&n!==1?' start="'+n+'"':"")+`>
|
||
`+t+"</"+r+`>
|
||
`}listitem(t){return"<li>"+t+`</li>
|
||
`}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(t){return"<p>"+t+`</p>
|
||
`}table(t,e){return e&&(e="<tbody>"+e+"</tbody>"),`<table>
|
||
<thead>
|
||
`+t+`</thead>
|
||
`+e+`</table>
|
||
`}tablerow(t){return`<tr>
|
||
`+t+`</tr>
|
||
`}tablecell(t,e){const n=e.header?"th":"td";return(e.align?"<"+n+' align="'+e.align+'">':"<"+n+">")+t+"</"+n+`>
|
||
`}strong(t){return"<strong>"+t+"</strong>"}em(t){return"<em>"+t+"</em>"}codespan(t){return"<code>"+t+"</code>"}br(){return this.options.xhtml?"<br/>":"<br>"}del(t){return"<del>"+t+"</del>"}link(t,e,n){if((t=B(this.options.sanitize,this.options.baseUrl,t))===null)return n;let r='<a href="'+T(t)+'"';return e&&(r+=' title="'+e+'"'),r+=">"+n+"</a>",r}image(t,e,n){if((t=B(this.options.sanitize,this.options.baseUrl,t))===null)return n;let r='<img src="'+t+'" alt="'+n+'"';return e&&(r+=' title="'+e+'"'),r+=this.options.xhtml?"/>":">",r}text(t){return t}}class X{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,e,n){return""+n}image(t,e,n){return""+n}br(){return""}}class G{constructor(){this.seen={}}serialize(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(t,e){let n=t,r=0;if(this.seen.hasOwnProperty(n)){r=this.seen[t];do r++,n=t+"-"+r;while(this.seen.hasOwnProperty(n))}return e||(this.seen[t]=r,this.seen[n]=0),n}slug(t,e={}){const n=this.serialize(t);return this.getNextSafeSlug(n,e.dryrun)}}class E{constructor(t){this.options=t||q,this.options.renderer=this.options.renderer||new P,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new X,this.slugger=new G}static parse(t,e){return new E(e).parse(t)}static parseInline(t,e){return new E(e).parseInline(t)}parse(t,e=!0){let n,r,s,i,o,p,g,a,l,c,d,w,m,b,f,S,y,$,A,z="";const I=t.length;for(n=0;n<I;n++)if(c=t[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[c.type]&&(A=this.options.extensions.renderers[c.type].call({parser:this},c),A!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)))z+=A||"";else switch(c.type){case"space":continue;case"hr":z+=this.renderer.hr();continue;case"heading":z+=this.renderer.heading(this.parseInline(c.tokens),c.depth,F(this.parseInline(c.tokens,this.textRenderer)),this.slugger);continue;case"code":z+=this.renderer.code(c.text,c.lang,c.escaped);continue;case"table":for(a="",g="",i=c.header.length,r=0;r<i;r++)g+=this.renderer.tablecell(this.parseInline(c.header[r].tokens),{header:!0,align:c.align[r]});for(a+=this.renderer.tablerow(g),l="",i=c.rows.length,r=0;r<i;r++){for(p=c.rows[r],g="",o=p.length,s=0;s<o;s++)g+=this.renderer.tablecell(this.parseInline(p[s].tokens),{header:!1,align:c.align[s]});l+=this.renderer.tablerow(g)}z+=this.renderer.table(a,l);continue;case"blockquote":l=this.parse(c.tokens),z+=this.renderer.blockquote(l);continue;case"list":for(d=c.ordered,w=c.start,m=c.loose,i=c.items.length,l="",r=0;r<i;r++)f=c.items[r],S=f.checked,y=f.task,b="",f.task&&($=this.renderer.checkbox(S),m?f.tokens.length>0&&f.tokens[0].type==="paragraph"?(f.tokens[0].text=$+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&f.tokens[0].tokens[0].type==="text"&&(f.tokens[0].tokens[0].text=$+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:$}):b+=$),b+=this.parse(f.tokens,m),l+=this.renderer.listitem(b,y,S);z+=this.renderer.list(l,d,w);continue;case"html":z+=this.renderer.html(c.text);continue;case"paragraph":z+=this.renderer.paragraph(this.parseInline(c.tokens));continue;case"text":for(l=c.tokens?this.parseInline(c.tokens):c.text;n+1<I&&t[n+1].type==="text";)c=t[++n],l+=`
|
||
`+(c.tokens?this.parseInline(c.tokens):c.text);z+=e?this.renderer.paragraph(l):l;continue;default:{const L='Token with "'+c.type+'" type was not found.';if(this.options.silent)return void console.error(L);throw new Error(L)}}return z}parseInline(t,e){e=e||this.renderer;let n,r,s,i="";const o=t.length;for(n=0;n<o;n++)if(r=t[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]&&(s=this.options.extensions.renderers[r.type].call({parser:this},r),s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)))i+=s||"";else switch(r.type){case"escape":i+=e.text(r.text);break;case"html":i+=e.html(r.text);break;case"link":i+=e.link(r.href,r.title,this.parseInline(r.tokens,e));break;case"image":i+=e.image(r.href,r.title,r.text);break;case"strong":i+=e.strong(this.parseInline(r.tokens,e));break;case"em":i+=e.em(this.parseInline(r.tokens,e));break;case"codespan":i+=e.codespan(r.text);break;case"br":i+=e.br();break;case"del":i+=e.del(this.parseInline(r.tokens,e));break;case"text":i+=e.text(r.text);break;default:{const p='Token with "'+r.type+'" type was not found.';if(this.options.silent)return void console.error(p);throw new Error(p)}}return i}}function x(h,t,e){if(h==null)throw new Error("marked(): input parameter is undefined or null");if(typeof h!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(h)+", string expected");if(typeof t=="function"&&(e=t,t=null),V(t=R({},x.defaults,t||{})),e){const n=t.highlight;let r;try{r=v.lex(h,t)}catch(o){return e(o)}const s=function(o){let p;if(!o)try{t.walkTokens&&x.walkTokens(r,t.walkTokens),p=E.parse(r,t)}catch(g){o=g}return t.highlight=n,o?e(o):e(null,p)};if(!n||n.length<3||(delete t.highlight,!r.length))return s();let i=0;return x.walkTokens(r,function(o){o.type==="code"&&(i++,setTimeout(()=>{n(o.text,o.lang,function(p,g){if(p)return s(p);g!=null&&g!==o.text&&(o.text=g,o.escaped=!0),i--,i===0&&s()})},0))}),void(i===0&&s())}try{const n=v.lex(h,t);return t.walkTokens&&x.walkTokens(n,t.walkTokens),E.parse(n,t)}catch(n){if(n.message+=`
|
||
Please report this to https://github.com/markedjs/marked.`,t.silent)return"<p>An error occurred:</p><pre>"+T(n.message+"",!0)+"</pre>";throw n}}x.options=x.setOptions=function(h){var t;return R(x.defaults,h),t=x.defaults,q=t,x},x.getDefaults=K,x.defaults=q,x.use=function(...h){const t=R({},...h),e=x.defaults.extensions||{renderers:{},childTokens:{}};let n;h.forEach(r=>{if(r.extensions&&(n=!0,r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if(s.renderer){const i=e.renderers?e.renderers[s.name]:null;e.renderers[s.name]=i?function(...o){let p=s.renderer.apply(this,o);return p===!1&&(p=i.apply(this,o)),p}:s.renderer}if(s.tokenizer){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");e[s.level]?e[s.level].unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}s.childTokens&&(e.childTokens[s.name]=s.childTokens)})),r.renderer){const s=x.defaults.renderer||new P;for(const i in r.renderer){const o=s[i];s[i]=(...p)=>{let g=r.renderer[i].apply(s,p);return g===!1&&(g=o.apply(s,p)),g}}t.renderer=s}if(r.tokenizer){const s=x.defaults.tokenizer||new O;for(const i in r.tokenizer){const o=s[i];s[i]=(...p)=>{let g=r.tokenizer[i].apply(s,p);return g===!1&&(g=o.apply(s,p)),g}}t.tokenizer=s}if(r.walkTokens){const s=x.defaults.walkTokens;t.walkTokens=function(i){r.walkTokens.call(this,i),s&&s.call(this,i)}}n&&(t.extensions=e),x.setOptions(t)})},x.walkTokens=function(h,t){for(const e of h)switch(t.call(x,e),e.type){case"table":for(const n of e.header)x.walkTokens(n.tokens,t);for(const n of e.rows)for(const r of n)x.walkTokens(r.tokens,t);break;case"list":x.walkTokens(e.items,t);break;default:x.defaults.extensions&&x.defaults.extensions.childTokens&&x.defaults.extensions.childTokens[e.type]?x.defaults.extensions.childTokens[e.type].forEach(function(n){x.walkTokens(e[n],t)}):e.tokens&&x.walkTokens(e.tokens,t)}},x.parseInline=function(h,t){if(h==null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof h!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(h)+", string expected");V(t=R({},x.defaults,t||{}));try{const e=v.lexInline(h,t);return t.walkTokens&&x.walkTokens(e,t.walkTokens),E.parseInline(e,t)}catch(e){if(e.message+=`
|
||
Please report this to https://github.com/markedjs/marked.`,t.silent)return"<p>An error occurred:</p><pre>"+T(e.message+"",!0)+"</pre>";throw e}},x.Parser=E,x.parser=E.parse,x.Renderer=P,x.TextRenderer=X,x.Lexer=v,x.lexer=v.lex,x.Tokenizer=O,x.Slugger=G,x.parse=x;/*!
|
||
* The reveal.js markdown plugin. Handles parsing of
|
||
* markdown inside of presentations as well as loading
|
||
* of external markdown documents.
|
||
*/const D=/\[([\s\d,|-]*)\]/,pe={"&":"&","<":"<",">":">",'"':""","'":"'"},ue=()=>{let h;function t(a){var l=(a.querySelector("[data-template]")||a.querySelector("script")||a).textContent,c=(l=l.replace(new RegExp("__SCRIPT_END__","g"),"<\/script>")).match(/^\n?(\s*)/)[1].length,d=l.match(/^\n?(\t*)/)[1].length;return d>0?l=l.replace(new RegExp("\\n?\\t{"+d+"}","g"),`
|
||
`):c>1&&(l=l.replace(new RegExp("\\n? {"+c+"}","g"),`
|
||
`)),l}function e(a){for(var l=a.attributes,c=[],d=0,w=l.length;d<w;d++){var m=l[d].name,b=l[d].value;/data\-(markdown|separator|vertical|notes)/gi.test(m)||(b?c.push(m+'="'+b+'"'):c.push(m))}return c.join(" ")}function n(a){return(a=a||{}).separator=a.separator||`\r?
|
||
---\r?
|
||
`,a.notesSeparator=a.notesSeparator||"notes?:",a.attributes=a.attributes||"",a}function r(a,l){l=n(l);var c=a.split(new RegExp(l.notesSeparator,"mgi"));return c.length===2&&(a=c[0]+'<aside class="notes">'+x(c[1].trim())+"</aside>"),'<script type="text/template">'+(a=a.replace(/<\/script>/g,"__SCRIPT_END__"))+"<\/script>"}function s(a,l){l=n(l);for(var c,d,w,m=new RegExp(l.separator+(l.verticalSeparator?"|"+l.verticalSeparator:""),"mg"),b=new RegExp(l.separator),f=0,S=!0,y=[];c=m.exec(a);)!(d=b.test(c[0]))&&S&&y.push([]),w=a.substring(f,c.index),d&&S?y.push(w):y[y.length-1].push(w),f=m.lastIndex,S=d;(S?y:y[y.length-1]).push(a.substring(f));for(var $="",A=0,z=y.length;A<z;A++)y[A]instanceof Array?($+="<section "+l.attributes+">",y[A].forEach(function(I){$+="<section data-markdown>"+r(I,l)+"</section>"}),$+="</section>"):$+="<section "+l.attributes+" data-markdown>"+r(y[A],l)+"</section>";return $}function i(a){return new Promise(function(l){var c=[];[].slice.call(a.querySelectorAll("section[data-markdown]:not([data-markdown-parsed])")).forEach(function(d,w){d.getAttribute("data-markdown").length?c.push(function(m){return new Promise(function(b,f){var S=new XMLHttpRequest,y=m.getAttribute("data-markdown"),$=m.getAttribute("data-charset");$!=null&&$!=""&&S.overrideMimeType("text/html; charset="+$),S.onreadystatechange=function(A,z){z.readyState===4&&(z.status>=200&&z.status<300||z.status===0?b(z,y):f(z,y))}.bind(this,m,S),S.open("GET",y,!0);try{S.send()}catch(A){console.warn("Failed to get the Markdown file "+y+". Make sure that the presentation and the file are served by a HTTP server and the file can be found there. "+A),b(S,y)}})}(d).then(function(m,b){d.outerHTML=s(m.responseText,{separator:d.getAttribute("data-separator"),verticalSeparator:d.getAttribute("data-separator-vertical"),notesSeparator:d.getAttribute("data-separator-notes"),attributes:e(d)})},function(m,b){d.outerHTML='<section data-state="alert">ERROR: The attempt to fetch '+b+" failed with HTTP status "+m.status+".Check your browser's JavaScript console for more details.<p>Remember that you need to serve the presentation HTML from a HTTP server.</p></section>"})):d.outerHTML=s(t(d),{separator:d.getAttribute("data-separator"),verticalSeparator:d.getAttribute("data-separator-vertical"),notesSeparator:d.getAttribute("data-separator-notes"),attributes:e(d)})}),Promise.all(c).then(l)})}function o(a,l,c){var d,w,m=new RegExp(c,"mg"),b=new RegExp('([^"= ]+?)="([^"]+?)"|(data-[^"= ]+?)(?=[" ])',"mg"),f=a.nodeValue;if(d=m.exec(f)){var S=d[1];for(f=f.substring(0,d.index)+f.substring(m.lastIndex),a.nodeValue=f;w=b.exec(S);)w[2]?l.setAttribute(w[1],w[2]):l.setAttribute(w[3],"");return!0}return!1}function p(a,l,c,d,w){if(l!=null&&l.childNodes!=null&&l.childNodes.length>0)for(var m=l,b=0;b<l.childNodes.length;b++){var f=l.childNodes[b];if(b>0)for(var S=b-1;S>=0;){var y=l.childNodes[S];if(typeof y.setAttribute=="function"&&y.tagName!="BR"){m=y;break}S-=1}var $=a;f.nodeName=="section"&&($=f,m=f),typeof f.setAttribute!="function"&&f.nodeType!=Node.COMMENT_NODE||p($,f,m,d,w)}l.nodeType==Node.COMMENT_NODE&&o(l,c,d)==0&&o(l,a,w)}function g(){var a=h.getRevealElement().querySelectorAll("[data-markdown]:not([data-markdown-parsed])");return[].slice.call(a).forEach(function(l){l.setAttribute("data-markdown-parsed",!0);var c=l.querySelector("aside.notes"),d=t(l);l.innerHTML=x(d),p(l,l,null,l.getAttribute("data-element-attributes")||l.parentNode.getAttribute("data-element-attributes")||"\\.element\\s*?(.+?)$",l.getAttribute("data-attributes")||l.parentNode.getAttribute("data-attributes")||"\\.slide:\\s*?(\\S.+?)$"),c&&l.appendChild(c)}),Promise.resolve()}return{id:"markdown",init:function(a){h=a;let{renderer:l,animateLists:c,...d}=h.getConfig().markdown||{};return l||(l=new x.Renderer,l.code=(w,m)=>{let b="";return D.test(m)&&(b=m.match(D)[1].trim(),b=`data-line-numbers="${b}"`,m=m.replace(D,"").trim()),`<pre><code ${b} class="${m}">${w=w.replace(/([&<>'"])/g,f=>pe[f])}</code></pre>`}),c===!0&&(l.listitem=w=>`<li class="fragment">${w}</li>`),x.setOptions({renderer:l,...d}),i(h.getRevealElement()).then(g)},processSlides:i,convertSlides:g,slidify:s,marked:x}};export{ue as default};
|