46 lines
39 KiB
JavaScript
46 lines
39 KiB
JavaScript
var le=Object.defineProperty;var ae=(l,n,t)=>n in l?le(l,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[n]=t;var j=(l,n,t)=>ae(l,typeof n!="symbol"?n+"":n,t);import{S as oe,i as ce,s as he,D as W,h as Z,n as P,k as D,J as ue,q as J,f as K,G as pe,H as fe}from"./index-C9aKRT5A.js";import{b as ge}from"./collect-stories-ceFdpR5E.js";function Y(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let A=Y();function de(l){A=l}const ee=/[&<>"']/,ke=new RegExp(ee.source,"g"),te=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,me=new RegExp(te.source,"g"),xe={"&":"&","<":"<",">":">",'"':""","'":"'"},Q=l=>xe[l];function w(l,n){if(n){if(ee.test(l))return l.replace(ke,Q)}else if(te.test(l))return l.replace(me,Q);return l}const be=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ne(l){return l.replace(be,(n,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const we=/(^|[^\[])\^/g;function m(l,n){l=typeof l=="string"?l:l.source,n=n||"";const t={replace:(e,i)=>(i=i.source||i,i=i.replace(we,"$1"),l=l.replace(e,i),t),getRegex:()=>new RegExp(l,n)};return t}const _e=/[^\w:]/g,ye=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function H(l,n,t){if(l){let e;try{e=decodeURIComponent(ne(t)).replace(_e,"").toLowerCase()}catch{return null}if(e.indexOf("javascript:")===0||e.indexOf("vbscript:")===0||e.indexOf("data:")===0)return null}n&&!ye.test(t)&&(t=Te(n,t));try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}const v={},$e=/^[^:]+:\/*[^/]*$/,ze=/^([^:]+:)[\s\S]*$/,Se=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Te(l,n){v[" "+l]||($e.test(l)?v[" "+l]=l+"/":v[" "+l]=C(l,"/",!0)),l=v[" "+l];const t=l.indexOf(":")===-1;return n.substring(0,2)==="//"?t?n:l.replace(ze,"$1")+n:n.charAt(0)==="/"?t?n:l.replace(Se,"$1")+n:l+n}const M={exec:function(){}};function N(l,n){const t=l.replace(/\|/g,(s,r,a)=>{let o=!1,d=r;for(;--d>=0&&a[d]==="\\";)o=!o;return o?"|":" |"}),e=t.split(/ \|/);let i=0;if(e[0].trim()||e.shift(),e.length>0&&!e[e.length-1].trim()&&e.pop(),e.length>n)e.splice(n);else for(;e.length<n;)e.push("");for(;i<e.length;i++)e[i]=e[i].trim().replace(/\\\|/g,"|");return e}function C(l,n,t){const e=l.length;if(e===0)return"";let i=0;for(;i<e;){const s=l.charAt(e-i-1);if(s===n&&!t)i++;else if(s!==n&&t)i++;else break}return l.slice(0,e-i)}function Re(l,n){if(l.indexOf(n[1])===-1)return-1;const t=l.length;let e=0,i=0;for(;i<t;i++)if(l[i]==="\\")i++;else if(l[i]===n[0])e++;else if(l[i]===n[1]&&(e--,e<0))return i;return-1}function Ie(l){l&&l.sanitize&&!l.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 F(l,n){if(n<1)return"";let t="";for(;n>1;)n&1&&(t+=l),n>>=1,l+=l;return t+l}function V(l,n,t,e){const i=n.href,s=n.title?w(n.title):null,r=l[1].replace(/\\([\[\]])/g,"$1");if(l[0].charAt(0)!=="!"){e.state.inLink=!0;const a={type:"link",raw:t,href:i,title:s,text:r,tokens:e.inlineTokens(r)};return e.state.inLink=!1,a}return{type:"image",raw:t,href:i,title:s,text:w(r)}}function Ae(l,n){const t=l.match(/^(\s+)(?:```)/);if(t===null)return n;const e=t[1];return n.split(`
|
||
`).map(i=>{const s=i.match(/^\s+/);if(s===null)return i;const[r]=s;return r.length>=e.length?i.slice(e.length):i}).join(`
|
||
`)}class B{constructor(n){this.options=n||A}space(n){const t=this.rules.block.newline.exec(n);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(n){const t=this.rules.block.code.exec(n);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:C(e,`
|
||
`)}}}fences(n){const t=this.rules.block.fences.exec(n);if(t){const e=t[0],i=Ae(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:i}}}heading(n){const t=this.rules.block.heading.exec(n);if(t){let e=t[2].trim();if(/#$/.test(e)){const i=C(e,"#");(this.options.pedantic||!i||/ $/.test(i))&&(e=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(n){const t=this.rules.block.hr.exec(n);if(t)return{type:"hr",raw:t[0]}}blockquote(n){const t=this.rules.block.blockquote.exec(n);if(t){const e=t[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(n){let t=this.rules.block.list.exec(n);if(t){let e,i,s,r,a,o,d,f,g,k,h,z,_=t[1].trim();const T=_.length>1,x={type:"list",raw:"",ordered:T,start:T?+_.slice(0,-1):"",loose:!1,items:[]};_=T?`\\d{1,9}\\${_.slice(-1)}`:`\\${_}`,this.options.pedantic&&(_=T?_:"[*+-]");const b=new RegExp(`^( {0,3}${_})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;n&&(z=!1,!(!(t=b.exec(n))||this.rules.block.hr.test(n)));){if(e=t[0],n=n.substring(e.length),f=t[2].split(`
|
||
`,1)[0].replace(/^\t+/,S=>" ".repeat(3*S.length)),g=n.split(`
|
||
`,1)[0],this.options.pedantic?(r=2,h=f.trimLeft()):(r=t[2].search(/[^ ]/),r=r>4?1:r,h=f.slice(r),r+=t[1].length),o=!1,!f&&/^ *$/.test(g)&&(e+=g+`
|
||
`,n=n.substring(g.length+1),z=!0),!z){const S=new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),$=new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),L=new RegExp(`^ {0,${Math.min(3,r-1)}}#`);for(;n&&(k=n.split(`
|
||
`,1)[0],g=k,this.options.pedantic&&(g=g.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!($.test(g)||L.test(g)||S.test(g)||y.test(n)));){if(g.search(/[^ ]/)>=r||!g.trim())h+=`
|
||
`+g.slice(r);else{if(o||f.search(/[^ ]/)>=4||$.test(f)||L.test(f)||y.test(f))break;h+=`
|
||
`+g}!o&&!g.trim()&&(o=!0),e+=k+`
|
||
`,n=n.substring(k.length+1),f=g.slice(r)}}x.loose||(d?x.loose=!0:/\n *\n *$/.test(e)&&(d=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(h),i&&(s=i[0]!=="[ ] ",h=h.replace(/^\[[ xX]\] +/,""))),x.items.push({type:"list_item",raw:e,task:!!i,checked:s,loose:!1,text:h}),x.raw+=e}x.items[x.items.length-1].raw=e.trimRight(),x.items[x.items.length-1].text=h.trimRight(),x.raw=x.raw.trimRight();const E=x.items.length;for(a=0;a<E;a++)if(this.lexer.state.top=!1,x.items[a].tokens=this.lexer.blockTokens(x.items[a].text,[]),!x.loose){const S=x.items[a].tokens.filter($=>$.type==="space"),y=S.length>0&&S.some($=>/\n.*\n/.test($.raw));x.loose=y}if(x.loose)for(a=0;a<E;a++)x.items[a].loose=!0;return x}}html(n){const t=this.rules.block.html.exec(n);if(t){const e={type:"html",raw:t[0],pre:!this.options.sanitizer&&(t[1]==="pre"||t[1]==="script"||t[1]==="style"),text:t[0]};if(this.options.sanitize){const i=this.options.sanitizer?this.options.sanitizer(t[0]):w(t[0]);e.type="paragraph",e.text=i,e.tokens=this.lexer.inline(i)}return e}}def(n){const t=this.rules.block.def.exec(n);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:i,title:s}}}table(n){const t=this.rules.block.table.exec(n);if(t){const e={type:"table",header:N(t[1]).map(i=>({text:i})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
||
`):[]};if(e.header.length===e.align.length){e.raw=t[0];let i=e.align.length,s,r,a,o;for(s=0;s<i;s++)/^ *-+: *$/.test(e.align[s])?e.align[s]="right":/^ *:-+: *$/.test(e.align[s])?e.align[s]="center":/^ *:-+ *$/.test(e.align[s])?e.align[s]="left":e.align[s]=null;for(i=e.rows.length,s=0;s<i;s++)e.rows[s]=N(e.rows[s],e.header.length).map(d=>({text:d}));for(i=e.header.length,r=0;r<i;r++)e.header[r].tokens=this.lexer.inline(e.header[r].text);for(i=e.rows.length,r=0;r<i;r++)for(o=e.rows[r],a=0;a<o.length;a++)o[a].tokens=this.lexer.inline(o[a].text);return e}}}lheading(n){const t=this.rules.block.lheading.exec(n);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(n){const t=this.rules.block.paragraph.exec(n);if(t){const e=t[1].charAt(t[1].length-1)===`
|
||
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(n){const t=this.rules.block.text.exec(n);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(n){const t=this.rules.inline.escape.exec(n);if(t)return{type:"escape",raw:t[0],text:w(t[1])}}tag(n){const t=this.rules.inline.tag.exec(n);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):w(t[0]):t[0]}}link(n){const t=this.rules.inline.link.exec(n);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const r=C(e.slice(0,-1),"\\");if((e.length-r.length)%2===0)return}else{const r=Re(t[2],"()");if(r>-1){const o=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){const r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);r&&(i=r[1],s=r[3])}else s=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(e)?i=i.slice(1):i=i.slice(1,-1)),V(t,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:s&&s.replace(this.rules.inline._escapes,"$1")},t[0],this.lexer)}}reflink(n,t){let e;if((e=this.rules.inline.reflink.exec(n))||(e=this.rules.inline.nolink.exec(n))){let i=(e[2]||e[1]).replace(/\s+/g," ");if(i=t[i.toLowerCase()],!i){const s=e[0].charAt(0);return{type:"text",raw:s,text:s}}return V(e,i,e[0],this.lexer)}}emStrong(n,t,e=""){let i=this.rules.inline.emStrong.lDelim.exec(n);if(!i||i[3]&&e.match(/[\p{L}\p{N}]/u))return;const s=i[1]||i[2]||"";if(!s||s&&(e===""||this.rules.inline.punctuation.exec(e))){const r=i[0].length-1;let a,o,d=r,f=0;const g=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(g.lastIndex=0,t=t.slice(-1*n.length+r);(i=g.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(o=a.length,i[3]||i[4]){d+=o;continue}else if((i[5]||i[6])&&r%3&&!((r+o)%3)){f+=o;continue}if(d-=o,d>0)continue;o=Math.min(o,o+d+f);const k=n.slice(0,r+i.index+(i[0].length-a.length)+o);if(Math.min(r,o)%2){const z=k.slice(1,-1);return{type:"em",raw:k,text:z,tokens:this.lexer.inlineTokens(z)}}const h=k.slice(2,-2);return{type:"strong",raw:k,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(n){const t=this.rules.inline.code.exec(n);if(t){let e=t[2].replace(/\n/g," ");const i=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return i&&s&&(e=e.substring(1,e.length-1)),e=w(e,!0),{type:"codespan",raw:t[0],text:e}}}br(n){const t=this.rules.inline.br.exec(n);if(t)return{type:"br",raw:t[0]}}del(n){const t=this.rules.inline.del.exec(n);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(n,t){const e=this.rules.inline.autolink.exec(n);if(e){let i,s;return e[2]==="@"?(i=w(this.options.mangle?t(e[1]):e[1]),s="mailto:"+i):(i=w(e[1]),s=i),{type:"link",raw:e[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(n,t){let e;if(e=this.rules.inline.url.exec(n)){let i,s;if(e[2]==="@")i=w(this.options.mangle?t(e[0]):e[0]),s="mailto:"+i;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])[0];while(r!==e[0]);i=w(e[0]),e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(n,t){const e=this.rules.inline.text.exec(n);if(e){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):w(e[0]):e[0]:i=w(this.options.smartypants?t(e[0]):e[0]),{type:"text",raw:e[0],text:i}}}}const p={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}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\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][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:M,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};p._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;p._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;p.def=m(p.def).replace("label",p._label).replace("title",p._title).getRegex();p.bullet=/(?:[*+-]|\d{1,9}[.)])/;p.listItemStart=m(/^( *)(bull) */).replace("bull",p.bullet).getRegex();p.list=m(p.list).replace(/bull/g,p.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+p.def.source+")").getRegex();p._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";p._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/;p.html=m(p.html,"i").replace("comment",p._comment).replace("tag",p._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();p.paragraph=m(p._paragraph).replace("hr",p.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",p._tag).getRegex();p.blockquote=m(p.blockquote).replace("paragraph",p.paragraph).getRegex();p.normal={...p};p.gfm={...p.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"};p.gfm.table=m(p.gfm.table).replace("hr",p.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",p._tag).getRegex();p.gfm.paragraph=m(p._paragraph).replace("hr",p.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",p.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",p._tag).getRegex();p.pedantic={...p.normal,html:m(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",p._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:M,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:m(p.normal._paragraph).replace("hr",p.hr).replace("heading",` *#{1,6} *[^
|
||
]`).replace("lheading",p.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const c={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:M,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:M,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};c._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";c.punctuation=m(c.punctuation).replace(/punctuation/g,c._punctuation).getRegex();c.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;c.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;c._comment=m(p._comment).replace("(?:-->|$)","-->").getRegex();c.emStrong.lDelim=m(c.emStrong.lDelim).replace(/punct/g,c._punctuation).getRegex();c.emStrong.rDelimAst=m(c.emStrong.rDelimAst,"g").replace(/punct/g,c._punctuation).getRegex();c.emStrong.rDelimUnd=m(c.emStrong.rDelimUnd,"g").replace(/punct/g,c._punctuation).getRegex();c._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;c._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;c._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])?)+(?![-_])/;c.autolink=m(c.autolink).replace("scheme",c._scheme).replace("email",c._email).getRegex();c._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;c.tag=m(c.tag).replace("comment",c._comment).replace("attribute",c._attribute).getRegex();c._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;c._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;c._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;c.link=m(c.link).replace("label",c._label).replace("href",c._href).replace("title",c._title).getRegex();c.reflink=m(c.reflink).replace("label",c._label).replace("ref",p._label).getRegex();c.nolink=m(c.nolink).replace("ref",p._label).getRegex();c.reflinkSearch=m(c.reflinkSearch,"g").replace("reflink",c.reflink).replace("nolink",c.nolink).getRegex();c.normal={...c};c.pedantic={...c.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:m(/^!?\[(label)\]\((.*?)\)/).replace("label",c._label).getRegex(),reflink:m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",c._label).getRegex()};c.gfm={...c.normal,escape:m(c.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.!#$%&'*+\/=?_`{\|}~-]+@)))/};c.gfm.url=m(c.gfm.url,"i").replace("email",c.gfm._extended_email).getRegex();c.breaks={...c.gfm,br:m(c.br).replace("{2,}","*").getRegex(),text:m(c.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};function Ee(l){return l.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function X(l){let n="",t,e;const i=l.length;for(t=0;t<i;t++)e=l.charCodeAt(t),Math.random()>.5&&(e="x"+e.toString(16)),n+="&#"+e+";";return n}class R{constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||A,this.options.tokenizer=this.options.tokenizer||new B,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 t={block:p.normal,inline:c.normal};this.options.pedantic?(t.block=p.pedantic,t.inline=c.pedantic):this.options.gfm&&(t.block=p.gfm,this.options.breaks?t.inline=c.breaks:t.inline=c.gfm),this.tokenizer.rules=t}static get rules(){return{block:p,inline:c}}static lex(n,t){return new R(t).lex(n)}static lexInline(n,t){return new R(t).inlineTokens(n)}lex(n){n=n.replace(/\r\n|\r/g,`
|
||
`),this.blockTokens(n,this.tokens);let t;for(;t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(n,t=[]){this.options.pedantic?n=n.replace(/\t/g," ").replace(/^ +$/gm,""):n=n.replace(/^( *)(\t+)/gm,(a,o,d)=>o+" ".repeat(d.length));let e,i,s,r;for(;n;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(e=a.call({lexer:this},n,t))?(n=n.substring(e.raw.length),t.push(e),!0):!1))){if(e=this.tokenizer.space(n)){n=n.substring(e.raw.length),e.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
||
`:t.push(e);continue}if(e=this.tokenizer.code(n)){n=n.substring(e.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
||
`+e.raw,i.text+=`
|
||
`+e.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(e);continue}if(e=this.tokenizer.fences(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.heading(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.hr(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.blockquote(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.list(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.html(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.def(n)){n=n.substring(e.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
||
`+e.raw,i.text+=`
|
||
`+e.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[e.tag]||(this.tokens.links[e.tag]={href:e.href,title:e.title});continue}if(e=this.tokenizer.table(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.lheading(n)){n=n.substring(e.raw.length),t.push(e);continue}if(s=n,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const o=n.slice(1);let d;this.options.extensions.startBlock.forEach(function(f){d=f.call({lexer:this},o),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(s=n.substring(0,a+1))}if(this.state.top&&(e=this.tokenizer.paragraph(s))){i=t[t.length-1],r&&i.type==="paragraph"?(i.raw+=`
|
||
`+e.raw,i.text+=`
|
||
`+e.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(e),r=s.length!==n.length,n=n.substring(e.raw.length);continue}if(e=this.tokenizer.text(n)){n=n.substring(e.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
|
||
`+e.raw,i.text+=`
|
||
`+e.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(e);continue}if(n){const a="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(n,t=[]){return this.inlineQueue.push({src:n,tokens:t}),t}inlineTokens(n,t=[]){let e,i,s,r=n,a,o,d;if(this.tokens.links){const f=Object.keys(this.tokens.links);if(f.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)f.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,a.index)+"["+F("a",a[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,a.index)+"["+F("a",a[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.escapedEmSt.exec(r))!=null;)r=r.slice(0,a.index+a[0].length-2)+"++"+r.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;n;)if(o||(d=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(f=>(e=f.call({lexer:this},n,t))?(n=n.substring(e.raw.length),t.push(e),!0):!1))){if(e=this.tokenizer.escape(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.tag(n)){n=n.substring(e.raw.length),i=t[t.length-1],i&&e.type==="text"&&i.type==="text"?(i.raw+=e.raw,i.text+=e.text):t.push(e);continue}if(e=this.tokenizer.link(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(e.raw.length),i=t[t.length-1],i&&e.type==="text"&&i.type==="text"?(i.raw+=e.raw,i.text+=e.text):t.push(e);continue}if(e=this.tokenizer.emStrong(n,r,d)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.codespan(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.br(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.del(n)){n=n.substring(e.raw.length),t.push(e);continue}if(e=this.tokenizer.autolink(n,X)){n=n.substring(e.raw.length),t.push(e);continue}if(!this.state.inLink&&(e=this.tokenizer.url(n,X))){n=n.substring(e.raw.length),t.push(e);continue}if(s=n,this.options.extensions&&this.options.extensions.startInline){let f=1/0;const g=n.slice(1);let k;this.options.extensions.startInline.forEach(function(h){k=h.call({lexer:this},g),typeof k=="number"&&k>=0&&(f=Math.min(f,k))}),f<1/0&&f>=0&&(s=n.substring(0,f+1))}if(e=this.tokenizer.inlineText(s,Ee)){n=n.substring(e.raw.length),e.raw.slice(-1)!=="_"&&(d=e.raw.slice(-1)),o=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=e.raw,i.text+=e.text):t.push(e);continue}if(n){const f="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return t}}class O{constructor(n){this.options=n||A}code(n,t,e){const i=(t||"").match(/\S*/)[0];if(this.options.highlight){const s=this.options.highlight(n,i);s!=null&&s!==n&&(e=!0,n=s)}return n=n.replace(/\n$/,"")+`
|
||
`,i?'<pre><code class="'+this.options.langPrefix+w(i)+'">'+(e?n:w(n,!0))+`</code></pre>
|
||
`:"<pre><code>"+(e?n:w(n,!0))+`</code></pre>
|
||
`}blockquote(n){return`<blockquote>
|
||
${n}</blockquote>
|
||
`}html(n){return n}heading(n,t,e,i){if(this.options.headerIds){const s=this.options.headerPrefix+i.slug(e);return`<h${t} id="${s}">${n}</h${t}>
|
||
`}return`<h${t}>${n}</h${t}>
|
||
`}hr(){return this.options.xhtml?`<hr/>
|
||
`:`<hr>
|
||
`}list(n,t,e){const i=t?"ol":"ul",s=t&&e!==1?' start="'+e+'"':"";return"<"+i+s+`>
|
||
`+n+"</"+i+`>
|
||
`}listitem(n){return`<li>${n}</li>
|
||
`}checkbox(n){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(n){return`<p>${n}</p>
|
||
`}table(n,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
|
||
<thead>
|
||
`+n+`</thead>
|
||
`+t+`</table>
|
||
`}tablerow(n){return`<tr>
|
||
${n}</tr>
|
||
`}tablecell(n,t){const e=t.header?"th":"td";return(t.align?`<${e} align="${t.align}">`:`<${e}>`)+n+`</${e}>
|
||
`}strong(n){return`<strong>${n}</strong>`}em(n){return`<em>${n}</em>`}codespan(n){return`<code>${n}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(n){return`<del>${n}</del>`}link(n,t,e){if(n=H(this.options.sanitize,this.options.baseUrl,n),n===null)return e;let i='<a href="'+n+'"';return t&&(i+=' title="'+t+'"'),i+=">"+e+"</a>",i}image(n,t,e){if(n=H(this.options.sanitize,this.options.baseUrl,n),n===null)return e;let i=`<img src="${n}" alt="${e}"`;return t&&(i+=` title="${t}"`),i+=this.options.xhtml?"/>":">",i}text(n){return n}}class ie{strong(n){return n}em(n){return n}codespan(n){return n}del(n){return n}html(n){return n}text(n){return n}link(n,t,e){return""+e}image(n,t,e){return""+e}br(){return""}}class se{constructor(){this.seen={}}serialize(n){return n.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(n,t){let e=n,i=0;if(this.seen.hasOwnProperty(e)){i=this.seen[n];do i++,e=n+"-"+i;while(this.seen.hasOwnProperty(e))}return t||(this.seen[n]=i,this.seen[e]=0),e}slug(n,t={}){const e=this.serialize(n);return this.getNextSafeSlug(e,t.dryrun)}}class I{constructor(n){this.options=n||A,this.options.renderer=this.options.renderer||new O,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ie,this.slugger=new se}static parse(n,t){return new I(t).parse(n)}static parseInline(n,t){return new I(t).parseInline(n)}parse(n,t=!0){let e="",i,s,r,a,o,d,f,g,k,h,z,_,T,x,b,E,S,y,$;const L=n.length;for(i=0;i<L;i++){if(h=n[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[h.type]&&($=this.options.extensions.renderers[h.type].call({parser:this},h),$!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(h.type))){e+=$||"";continue}switch(h.type){case"space":continue;case"hr":{e+=this.renderer.hr();continue}case"heading":{e+=this.renderer.heading(this.parseInline(h.tokens),h.depth,ne(this.parseInline(h.tokens,this.textRenderer)),this.slugger);continue}case"code":{e+=this.renderer.code(h.text,h.lang,h.escaped);continue}case"table":{for(g="",f="",a=h.header.length,s=0;s<a;s++)f+=this.renderer.tablecell(this.parseInline(h.header[s].tokens),{header:!0,align:h.align[s]});for(g+=this.renderer.tablerow(f),k="",a=h.rows.length,s=0;s<a;s++){for(d=h.rows[s],f="",o=d.length,r=0;r<o;r++)f+=this.renderer.tablecell(this.parseInline(d[r].tokens),{header:!1,align:h.align[r]});k+=this.renderer.tablerow(f)}e+=this.renderer.table(g,k);continue}case"blockquote":{k=this.parse(h.tokens),e+=this.renderer.blockquote(k);continue}case"list":{for(z=h.ordered,_=h.start,T=h.loose,a=h.items.length,k="",s=0;s<a;s++)b=h.items[s],E=b.checked,S=b.task,x="",b.task&&(y=this.renderer.checkbox(E),T?b.tokens.length>0&&b.tokens[0].type==="paragraph"?(b.tokens[0].text=y+" "+b.tokens[0].text,b.tokens[0].tokens&&b.tokens[0].tokens.length>0&&b.tokens[0].tokens[0].type==="text"&&(b.tokens[0].tokens[0].text=y+" "+b.tokens[0].tokens[0].text)):b.tokens.unshift({type:"text",text:y}):x+=y),x+=this.parse(b.tokens,T),k+=this.renderer.listitem(x,S,E);e+=this.renderer.list(k,z,_);continue}case"html":{e+=this.renderer.html(h.text);continue}case"paragraph":{e+=this.renderer.paragraph(this.parseInline(h.tokens));continue}case"text":{for(k=h.tokens?this.parseInline(h.tokens):h.text;i+1<L&&n[i+1].type==="text";)h=n[++i],k+=`
|
||
`+(h.tokens?this.parseInline(h.tokens):h.text);e+=t?this.renderer.paragraph(k):k;continue}default:{const U='Token with "'+h.type+'" type was not found.';if(this.options.silent){console.error(U);return}else throw new Error(U)}}}return e}parseInline(n,t){t=t||this.renderer;let e="",i,s,r;const a=n.length;for(i=0;i<a;i++){if(s=n[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]&&(r=this.options.extensions.renderers[s.type].call({parser:this},s),r!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type))){e+=r||"";continue}switch(s.type){case"escape":{e+=t.text(s.text);break}case"html":{e+=t.html(s.text);break}case"link":{e+=t.link(s.href,s.title,this.parseInline(s.tokens,t));break}case"image":{e+=t.image(s.href,s.title,s.text);break}case"strong":{e+=t.strong(this.parseInline(s.tokens,t));break}case"em":{e+=t.em(this.parseInline(s.tokens,t));break}case"codespan":{e+=t.codespan(s.text);break}case"br":{e+=t.br();break}case"del":{e+=t.del(this.parseInline(s.tokens,t));break}case"text":{e+=t.text(s.text);break}default:{const o='Token with "'+s.type+'" type was not found.';if(this.options.silent){console.error(o);return}else throw new Error(o)}}}return e}}class q{constructor(n){this.options=n||A}preprocess(n){return n}postprocess(n){return n}}j(q,"passThroughHooks",new Set(["preprocess","postprocess"]));function Le(l,n,t){return e=>{if(e.message+=`
|
||
Please report this to https://github.com/markedjs/marked.`,l){const i="<p>An error occurred:</p><pre>"+w(e.message+"",!0)+"</pre>";if(n)return Promise.resolve(i);if(t){t(null,i);return}return i}if(n)return Promise.reject(e);if(t){t(e);return}throw e}}function re(l,n){return(t,e,i)=>{typeof e=="function"&&(i=e,e=null);const s={...e};e={...u.defaults,...s};const r=Le(e.silent,e.async,i);if(typeof t>"u"||t===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(Ie(e),e.hooks&&(e.hooks.options=e),i){const a=e.highlight;let o;try{e.hooks&&(t=e.hooks.preprocess(t)),o=l(t,e)}catch(g){return r(g)}const d=function(g){let k;if(!g)try{e.walkTokens&&u.walkTokens(o,e.walkTokens),k=n(o,e),e.hooks&&(k=e.hooks.postprocess(k))}catch(h){g=h}return e.highlight=a,g?r(g):i(null,k)};if(!a||a.length<3||(delete e.highlight,!o.length))return d();let f=0;u.walkTokens(o,function(g){g.type==="code"&&(f++,setTimeout(()=>{a(g.text,g.lang,function(k,h){if(k)return d(k);h!=null&&h!==g.text&&(g.text=h,g.escaped=!0),f--,f===0&&d()})},0))}),f===0&&d();return}if(e.async)return Promise.resolve(e.hooks?e.hooks.preprocess(t):t).then(a=>l(a,e)).then(a=>e.walkTokens?Promise.all(u.walkTokens(a,e.walkTokens)).then(()=>a):a).then(a=>n(a,e)).then(a=>e.hooks?e.hooks.postprocess(a):a).catch(r);try{e.hooks&&(t=e.hooks.preprocess(t));const a=l(t,e);e.walkTokens&&u.walkTokens(a,e.walkTokens);let o=n(a,e);return e.hooks&&(o=e.hooks.postprocess(o)),o}catch(a){return r(a)}}}function u(l,n,t){return re(R.lex,I.parse)(l,n,t)}u.options=u.setOptions=function(l){return u.defaults={...u.defaults,...l},de(u.defaults),u};u.getDefaults=Y;u.defaults=A;u.use=function(...l){const n=u.defaults.extensions||{renderers:{},childTokens:{}};l.forEach(t=>{const e={...t};if(e.async=u.defaults.async||e.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if(i.renderer){const s=n.renderers[i.name];s?n.renderers[i.name]=function(...r){let a=i.renderer.apply(this,r);return a===!1&&(a=s.apply(this,r)),a}:n.renderers[i.name]=i.renderer}if(i.tokenizer){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");n[i.level]?n[i.level].unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),e.extensions=n),t.renderer){const i=u.defaults.renderer||new O;for(const s in t.renderer){const r=i[s];i[s]=(...a)=>{let o=t.renderer[s].apply(i,a);return o===!1&&(o=r.apply(i,a)),o}}e.renderer=i}if(t.tokenizer){const i=u.defaults.tokenizer||new B;for(const s in t.tokenizer){const r=i[s];i[s]=(...a)=>{let o=t.tokenizer[s].apply(i,a);return o===!1&&(o=r.apply(i,a)),o}}e.tokenizer=i}if(t.hooks){const i=u.defaults.hooks||new q;for(const s in t.hooks){const r=i[s];q.passThroughHooks.has(s)?i[s]=a=>{if(u.defaults.async)return Promise.resolve(t.hooks[s].call(i,a)).then(d=>r.call(i,d));const o=t.hooks[s].call(i,a);return r.call(i,o)}:i[s]=(...a)=>{let o=t.hooks[s].apply(i,a);return o===!1&&(o=r.apply(i,a)),o}}e.hooks=i}if(t.walkTokens){const i=u.defaults.walkTokens;e.walkTokens=function(s){let r=[];return r.push(t.walkTokens.call(this,s)),i&&(r=r.concat(i.call(this,s))),r}}u.setOptions(e)})};u.walkTokens=function(l,n){let t=[];for(const e of l)switch(t=t.concat(n.call(u,e)),e.type){case"table":{for(const i of e.header)t=t.concat(u.walkTokens(i.tokens,n));for(const i of e.rows)for(const s of i)t=t.concat(u.walkTokens(s.tokens,n));break}case"list":{t=t.concat(u.walkTokens(e.items,n));break}default:u.defaults.extensions&&u.defaults.extensions.childTokens&&u.defaults.extensions.childTokens[e.type]?u.defaults.extensions.childTokens[e.type].forEach(function(i){t=t.concat(u.walkTokens(e[i],n))}):e.tokens&&(t=t.concat(u.walkTokens(e.tokens,n)))}return t};u.parseInline=re(R.lexInline,I.parseInline);u.Parser=I;u.parser=I.parse;u.Renderer=O;u.TextRenderer=ie;u.Lexer=R;u.lexer=R.lex;u.Tokenizer=B;u.Slugger=se;u.Hooks=q;u.parse=u;u.options;u.setOptions;u.use;u.walkTokens;u.parseInline;I.parse;R.lex;const ve=ge(!0);function G(l){let n;function t(s,r){return s[2]?Me:Ce}let e=t(l),i=e(l);return{c(){i.c(),n=W()},m(s,r){i.m(s,r),Z(s,n,r)},p(s,r){e===(e=t(s))&&i?i.p(s,r):(i.d(1),i=e(s),i&&(i.c(),i.m(n.parentNode,n)))},d(s){s&&D(n),i.d(s)}}}function Ce(l){let n,t,e,i;return{c(){n=J("div"),K(n,"class","svelte-16j2cvj")},m(s,r){Z(s,n,r),e||(i=pe(t=l[3].call(null,n,l[1])),e=!0)},p(s,r){t&&fe(t.update)&&r&2&&t.update.call(null,s[1])},d(s){s&&D(n),e=!1,i()}}}function Me(l){let n;return{c(){n=J("div"),K(n,"class","svelte-16j2cvj")},m(t,e){Z(t,n,e),n.innerHTML=l[1]},p(t,e){e&2&&(n.innerHTML=t[1])},d(t){t&&D(n)}}}function qe(l){let n,t=l[0]&&G(l);return{c(){t&&t.c(),n=W()},m(e,i){t&&t.m(e,i),Z(e,n,i)},p(e,[i]){e[0]?t?t.p(e,i):(t=G(e),t.c(),t.m(n.parentNode,n)):t&&(t.d(1),t=null)},i:P,o:P,d(e){e&&D(n),t&&t.d(e)}}}function Ze(l,n,t){let e,i;ue(l,ve,o=>t(2,i=o));let{source:s=""}=n,{parseInline:r=!1}=n;const a=(o,d)=>(o.innerHTML=d,{update(f){o.innerHTML=f},destroy(){o.innerHTML=""}});return l.$$set=o=>{"source"in o&&t(0,s=o.source),"parseInline"in o&&t(4,r=o.parseInline)},l.$$.update=()=>{l.$$.dirty&17&&t(1,e=r?u.parseInline(s):u.parse(s))},[s,e,i,a,r]}class De extends oe{constructor(n){super(),ce(this,n,Ze,qe,he,{source:0,parseInline:4})}}De.__docgen={version:3,name:"Markdown.svelte",data:[{keywords:[],visibility:"public",description:"A Markdown formatted string",name:"source",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:""},{keywords:[],visibility:"public",description:"Parse markdown inline, i.e., without wrapping it in paragraph tags",name:"parseInline",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};export{De as M};
|