import{o as ge}from"./chunk-NQ4DUWMN.js";import{K as X,M as he,N as ue,Z as fe,h as m,ha as P,j as pe}from"./chunk-ZOEWSKT6.js";import{a as b,b as A,j as k,k as ce,l as v}from"./chunk-MGYUK2XN.js";function de(a){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];var s=Array.from(typeof a=="string"?[a]:a);s[s.length-1]=s[s.length-1].replace(/\r?\n([\t ]*)$/,"");var n=s.reduce(function(l,o){var c=o.match(/\n([\t ]+|(?!\s).)/g);return c?l.concat(c.map(function(p){var h,u;return(u=(h=p.match(/[\t ]/g))===null||h===void 0?void 0:h.length)!==null&&u!==void 0?u:0})):l},[]);if(n.length){var r=new RegExp(`
[	 ]{`+Math.min.apply(Math,n)+"}","g");s=s.map(function(l){return l.replace(r,`
`)})}s[0]=s[0].replace(/^\r?\n/,"");var i=s[0];return e.forEach(function(l,o){var c=i.match(/(?:^|\n)( *)$/),p=c?c[1]:"",h=l;typeof l=="string"&&l.includes(`
`)&&(h=String(l).split(`
`).map(function(u,f){return f===0?u:""+p+u}).join(`
`)),i+=h+s[o+1]}),i}function Y(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _=Y();function ye(a){_=a}var $e=/[&<>"']/,Qe=new RegExp($e.source,"g"),Te=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Fe=new RegExp(Te.source,"g"),He={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xe=a=>He[a];function w(a,e){if(e){if($e.test(a))return a.replace(Qe,xe)}else if(Te.test(a))return a.replace(Fe,xe);return a}var Ne=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Ue(a){return a.replace(Ne,(e,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)):""))}var Xe=/(^|[^\[])\^/g;function x(a,e){let t=typeof a=="string"?a:a.source;e=e||"";let s={replace:(n,r)=>{let i=typeof r=="string"?r:r.source;return i=i.replace(Xe,"$1"),t=t.replace(n,i),s},getRegex:()=>new RegExp(t,e)};return s}function ke(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch(e){return null}return a}var q={exec:()=>null};function me(a,e){let t=a.replace(/\|/g,(r,i,l)=>{let o=!1,c=i;for(;--c>=0&&l[c]==="\\";)o=!o;return o?"|":" |"}),s=t.split(/ \|/),n=0;if(s[0].trim()||s.shift(),s.length>0&&!s[s.length-1].trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;n<s.length;n++)s[n]=s[n].trim().replace(/\\\|/g,"|");return s}function C(a,e,t){let s=a.length;if(s===0)return"";let n=0;for(;n<s;){let r=a.charAt(s-n-1);if(r===e&&!t)n++;else if(r!==e&&t)n++;else break}return a.slice(0,s-n)}function Ge(a,e){if(a.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<a.length;s++)if(a[s]==="\\")s++;else if(a[s]===e[0])t++;else if(a[s]===e[1]&&(t--,t<0))return s;return-1}function be(a,e,t,s){let n=e.href,r=e.title?w(e.title):null,i=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){s.state.inLink=!0;let l={type:"link",raw:t,href:n,title:r,text:i,tokens:s.inlineTokens(i)};return s.state.inLink=!1,l}return{type:"image",raw:t,href:n,title:r,text:w(i)}}function Ke(a,e){let t=a.match(/^(\s+)(?:```)/);if(t===null)return e;let s=t[1];return e.split(`
`).map(n=>{let r=n.match(/^\s+/);if(r===null)return n;let[i]=r;return i.length>=s.length?n.slice(s.length):n}).join(`
`)}var L=class{constructor(e){k(this,"options");k(this,"rules");k(this,"lexer");this.options=e||_}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let s=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?s:C(s,`
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let s=t[0],n=Ke(s,t[3]||"");return{type:"code",raw:s,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let s=t[2].trim();if(/#$/.test(s)){let n=C(s,"#");(this.options.pedantic||!n||/ $/.test(n))&&(s=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:C(t[0],`
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let s=C(t[0],`
`).split(`
`),n="",r="",i=[];for(;s.length>0;){let l=!1,o=[],c;for(c=0;c<s.length;c++)if(/^ {0,3}>/.test(s[c]))o.push(s[c]),l=!0;else if(!l)o.push(s[c]);else break;s=s.slice(c);let p=o.join(`
`),h=p.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
    $1`).replace(/^ {0,3}>[ \t]?/gm,"");n=n?`${n}
${p}`:p,r=r?`${r}
${h}`:h;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=u,s.length===0)break;let f=i[i.length-1];if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let g=f,y=g.raw+`
`+s.join(`
`),$=this.blockquote(y);i[i.length-1]=$,n=n.substring(0,n.length-g.raw.length)+$.raw,r=r.substring(0,r.length-g.text.length)+$.text;break}else if((f==null?void 0:f.type)==="list"){let g=f,y=g.raw+`
`+s.join(`
`),$=this.list(y);i[i.length-1]=$,n=n.substring(0,n.length-f.raw.length)+$.raw,r=r.substring(0,r.length-g.raw.length)+$.raw,s=y.substring(i[i.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),n=s.length>1,r={type:"list",raw:"",ordered:n,start:n?+s.slice(0,-1):"",loose:!1,items:[]};s=n?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=n?s:"[*+-]");let i=new RegExp(`^( {0,3}${s})((?:[	 ][^\\n]*)?(?:\\n|$))`),l=!1;for(;e;){let o=!1,c="",p="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let h=t[2].split(`
`,1)[0].replace(/^\t+/,N=>" ".repeat(3*N.length)),u=e.split(`
`,1)[0],f=!h.trim(),g=0;if(this.options.pedantic?(g=2,p=h.trimStart()):f?g=t[1].length+1:(g=t[2].search(/[^ ]/),g=g>4?1:g,p=h.slice(g),g+=t[1].length),f&&/^ *$/.test(u)&&(c+=u+`
`,e=e.substring(u.length+1),o=!0),!o){let N=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),le=new RegExp(`^ {0,${Math.min(3,g-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),oe=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:\`\`\`|~~~)`),ae=new RegExp(`^ {0,${Math.min(3,g-1)}}#`);for(;e;){let U=e.split(`
`,1)[0];if(u=U,this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g,"  ")),oe.test(u)||ae.test(u)||N.test(u)||le.test(e))break;if(u.search(/[^ ]/)>=g||!u.trim())p+=`
`+u.slice(g);else{if(f||h.search(/[^ ]/)>=4||oe.test(h)||ae.test(h)||le.test(h))break;p+=`
`+u}!f&&!u.trim()&&(f=!0),c+=U+`
`,e=e.substring(U.length+1),h=u.slice(g)}}r.loose||(l?r.loose=!0:/\n *\n *$/.test(c)&&(l=!0));let y=null,$;this.options.gfm&&(y=/^\[[ xX]\] /.exec(p),y&&($=y[0]!=="[ ] ",p=p.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:c,task:!!y,checked:$,loose:!1,text:p,tokens:[]}),r.raw+=c}r.items[r.items.length-1].raw=r.items[r.items.length-1].raw.trimEnd(),r.items[r.items.length-1].text=r.items[r.items.length-1].text.trimEnd(),r.raw=r.raw.trimEnd();for(let o=0;o<r.items.length;o++)if(this.lexer.state.top=!1,r.items[o].tokens=this.lexer.blockTokens(r.items[o].text,[]),!r.loose){let c=r.items[o].tokens.filter(h=>h.type==="space"),p=c.length>0&&c.some(h=>/\n.*\n/.test(h.raw));r.loose=p}if(r.loose)for(let o=0;o<r.items.length;o++)r.items[o].loose=!0;return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let s=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:s,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;let s=me(t[1]),n=t[2].replace(/^\||\| *$/g,"").split("|"),r=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
`):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(s.length===n.length){for(let l of n)/^ *-+: *$/.test(l)?i.align.push("right"):/^ *:-+: *$/.test(l)?i.align.push("center"):/^ *:-+ *$/.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<s.length;l++)i.header.push({text:s[l],tokens:this.lexer.inline(s[l]),header:!0,align:i.align[l]});for(let l of r)i.rows.push(me(l,i.header.length).map((o,c)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:i.align[c]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);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(e){let t=this.rules.block.paragraph.exec(e);if(t){let s=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:s,tokens:this.lexer.inline(s)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:w(t[1])}}tag(e){let t=this.rules.inline.tag.exec(e);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:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let s=t[2].trim();if(!this.options.pedantic&&/^</.test(s)){if(!/>$/.test(s))return;let i=C(s.slice(0,-1),"\\");if((s.length-i.length)%2===0)return}else{let i=Ge(t[2],"()");if(i>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let i=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);i&&(n=i[1],r=i[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(this.options.pedantic&&!/>$/.test(s)?n=n.slice(1):n=n.slice(1,-1)),be(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){let n=(s[2]||s[1]).replace(/\s+/g," "),r=t[n.toLowerCase()];if(!r){let i=s[0].charAt(0);return{type:"text",raw:i,text:i}}return be(s,r,s[0],this.lexer)}}emStrong(e,t,s=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n||n[3]&&s.match(/[\p{L}\p{N}]/u))return;if(!(n[1]||n[2]||"")||!s||this.rules.inline.punctuation.exec(s)){let i=[...n[0]].length-1,l,o,c=i,p=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,t=t.slice(-1*e.length+i);(n=h.exec(t))!=null;){if(l=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!l)continue;if(o=[...l].length,n[3]||n[4]){c+=o;continue}else if((n[5]||n[6])&&i%3&&!((i+o)%3)){p+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+p);let u=[...n[0]][0].length,f=e.slice(0,i+n.index+u+o);if(Math.min(i,o)%2){let y=f.slice(1,-1);return{type:"em",raw:f,text:y,tokens:this.lexer.inlineTokens(y)}}let g=f.slice(2,-2);return{type:"strong",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let s=t[2].replace(/\n/g," "),n=/[^ ]/.test(s),r=/^ /.test(s)&&/ $/.test(s);return n&&r&&(s=s.substring(1,s.length-1)),s=w(s,!0),{type:"codespan",raw:t[0],text:s}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let s,n;return t[2]==="@"?(s=w(t[1]),n="mailto:"+s):(s=w(t[1]),n=s),{type:"link",raw:t[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}url(e){var s,n;let t;if(t=this.rules.inline.url.exec(e)){let r,i;if(t[2]==="@")r=w(t[0]),i="mailto:"+r;else{let l;do l=t[0],t[0]=(n=(s=this.rules.inline._backpedal.exec(t[0]))==null?void 0:s[0])!=null?n:"";while(l!==t[0]);r=w(t[0]),t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let s;return this.lexer.state.inRawBlock?s=t[0]:s=w(t[0]),{type:"text",raw:t[0],text:s}}}},Ve=/^(?: *(?:\n|$))+/,Ye=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Je=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Z=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,et=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Re=/(?:[*+-]|\d{1,9}[.)])/,ze=x(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Re).replace(/blockCode/g,/ {4}/).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/).getRegex(),J=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tt=/^[^\n]+/,ee=/(?!\s*\])(?:\\.|[^\[\]\\])+/,nt=x(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",ee).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),st=x(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Re).getRegex(),D="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",te=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rt=x("^ {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",te).replace("tag",D).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Se=x(J).replace("hr",Z).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex(),it=x(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Se).getRegex(),ne={blockquote:it,code:Ye,def:nt,fences:Je,heading:et,hr:Z,html:rt,lheading:ze,list:st,newline:Ve,paragraph:Se,table:q,text:tt},we=x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").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",D).getRegex(),lt=A(b({},ne),{table:we,paragraph:x(J).replace("hr",Z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",we).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",D).getRegex()}),ot=A(b({},ne),{html:x(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",te).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:q,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:x(J).replace("hr",Z).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ze).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Ie=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,at=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_e=/^( {2,}|\\)\n(?!\s*$)/,ct=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,W="\\p{P}\\p{S}",pt=x(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,W).getRegex(),ht=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,ut=x(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,W).getRegex(),ft=x("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,W).getRegex(),gt=x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,W).getRegex(),dt=x(/\\([punct])/,"gu").replace(/punct/g,W).getRegex(),xt=x(/^<(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(),kt=x(te).replace("(?:-->|$)","-->").getRegex(),mt=x("^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",kt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),O=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,bt=x(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",O).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ae=x(/^!?\[(label)\]\[(ref)\]/).replace("label",O).replace("ref",ee).getRegex(),Le=x(/^!?\[(ref)\](?:\[\])?/).replace("ref",ee).getRegex(),wt=x("reflink|nolink(?!\\()","g").replace("reflink",Ae).replace("nolink",Le).getRegex(),se={_backpedal:q,anyPunctuation:dt,autolink:xt,blockSkip:ht,br:_e,code:at,del:q,emStrongLDelim:ut,emStrongRDelimAst:ft,emStrongRDelimUnd:gt,escape:Ie,link:bt,nolink:Le,punctuation:pt,reflink:Ae,reflinkSearch:wt,tag:mt,text:ct,url:q},yt=A(b({},se),{link:x(/^!?\[(label)\]\((.*?)\)/).replace("label",O).getRegex(),reflink:x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",O).getRegex()}),G=A(b({},se),{escape:x(Ie).replace("])","~|])").getRegex(),url:x(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),$t=A(b({},G),{br:x(_e).replace("{2,}","*").getRegex(),text:x(G.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),M={normal:ne,gfm:lt,pedantic:ot},B={normal:se,gfm:G,breaks:$t,pedantic:yt},T=class a{constructor(e){k(this,"tokens");k(this,"options");k(this,"state");k(this,"tokenizer");k(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_,this.options.tokenizer=this.options.tokenizer||new L,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 t={block:M.normal,inline:B.normal};this.options.pedantic?(t.block=M.pedantic,t.inline=B.pedantic):this.options.gfm&&(t.block=M.gfm,this.options.breaks?t.inline=B.breaks:t.inline=B.gfm),this.tokenizer.rules=t}static get rules(){return{block:M,inline:B}}static lex(e,t){return new a(t).lex(e)}static lexInline(e,t){return new a(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.options.pedantic?e=e.replace(/\t/g,"    ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(l,o,c)=>o+"    ".repeat(c.length));let n,r,i;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(n=l.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+n.raw,r.text+=`
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+n.raw,r.text+=`
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startBlock){let l=1/0,o=e.slice(1),c;this.options.extensions.startBlock.forEach(p=>{c=p.call({lexer:this},o),typeof c=="number"&&c>=0&&(l=Math.min(l,c))}),l<1/0&&l>=0&&(i=e.substring(0,l+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i))){r=t[t.length-1],s&&(r==null?void 0:r.type)==="paragraph"?(r.raw+=`
`+n.raw,r.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),s=i.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),r=t[t.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):t.push(n);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let s,n,r,i=e,l,o,c;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)p.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,l.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(o||(c=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(p=>(s=p.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))){if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),n=t[t.length-1],n&&s.type==="text"&&n.type==="text"?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length),n=t[t.length-1],n&&s.type==="text"&&n.type==="text"?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(s=this.tokenizer.emStrong(e,i,c)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.del(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),t.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),t.push(s);continue}if(r=e,this.options.extensions&&this.options.extensions.startInline){let p=1/0,h=e.slice(1),u;this.options.extensions.startInline.forEach(f=>{u=f.call({lexer:this},h),typeof u=="number"&&u>=0&&(p=Math.min(p,u))}),p<1/0&&p>=0&&(r=e.substring(0,p+1))}if(s=this.tokenizer.inlineText(r)){e=e.substring(s.raw.length),s.raw.slice(-1)!=="_"&&(c=s.raw.slice(-1)),o=!0,n=t[t.length-1],n&&n.type==="text"?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(e){let p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return t}},E=class{constructor(e){k(this,"options");k(this,"parser");this.options=e||_}space(e){return""}code({text:e,lang:t,escaped:s}){var i;let n=(i=(t||"").match(/^\S*/))==null?void 0:i[0],r=e.replace(/\n$/,"")+`
`;return n?'<pre><code class="language-'+w(n)+'">'+(s?r:w(r,!0))+`</code></pre>
`:"<pre><code>"+(s?r:w(r,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){let t=e.ordered,s=e.start,n="";for(let l=0;l<e.items.length;l++){let o=e.items[l];n+=this.listitem(o)}let r=t?"ol":"ul",i=t&&s!==1?' start="'+s+'"':"";return"<"+r+i+`>
`+n+"</"+r+`>
`}listitem(e){let t="";if(e.task){let s=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=s+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=s+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:s+" ",text:s+" "}):t+=s+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t="",s="";for(let r=0;r<e.header.length;r++)s+=this.tablecell(e.header[r]);t+=this.tablerow({text:s});let n="";for(let r=0;r<e.rows.length;r++){let i=e.rows[r];s="";for(let l=0;l<i.length;l++)s+=this.tablecell(i[l]);n+=this.tablerow({text:s})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+n+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:s}){let n=this.parser.parseInline(s),r=ke(e);if(r===null)return n;e=r;let i='<a href="'+e+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>",i}image({href:e,title:t,text:s}){let n=ke(e);if(n===null)return s;e=n;let r=`<img src="${e}" alt="${s}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}},j=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},R=class a{constructor(e){k(this,"options");k(this,"renderer");k(this,"textRenderer");this.options=e||_,this.options.renderer=this.options.renderer||new E,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new j}static parse(e,t){return new a(t).parse(e)}static parseInline(e,t){return new a(t).parseInline(e)}parse(e,t=!0){let s="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){let l=r,o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){s+=o||"";continue}}let i=r;switch(i.type){case"space":{s+=this.renderer.space(i);continue}case"hr":{s+=this.renderer.hr(i);continue}case"heading":{s+=this.renderer.heading(i);continue}case"code":{s+=this.renderer.code(i);continue}case"table":{s+=this.renderer.table(i);continue}case"blockquote":{s+=this.renderer.blockquote(i);continue}case"list":{s+=this.renderer.list(i);continue}case"html":{s+=this.renderer.html(i);continue}case"paragraph":{s+=this.renderer.paragraph(i);continue}case"text":{let l=i,o=this.renderer.text(l);for(;n+1<e.length&&e[n+1].type==="text";)l=e[++n],o+=`
`+this.renderer.text(l);t?s+=this.renderer.paragraph({type:"paragraph",raw:o,text:o,tokens:[{type:"text",raw:o,text:o}]}):s+=o;continue}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}parseInline(e,t){t=t||this.renderer;let s="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){let l=this.options.extensions.renderers[r.type].call({parser:this},r);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){s+=l||"";continue}}let i=r;switch(i.type){case"escape":{s+=t.text(i);break}case"html":{s+=t.html(i);break}case"link":{s+=t.link(i);break}case"image":{s+=t.image(i);break}case"strong":{s+=t.strong(i);break}case"em":{s+=t.em(i);break}case"codespan":{s+=t.codespan(i);break}case"br":{s+=t.br(i);break}case"del":{s+=t.del(i);break}case"text":{s+=t.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},S=class{constructor(e){k(this,"options");this.options=e||_}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}};k(S,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var z,Ee,V,ve,K=class{constructor(...e){ce(this,z);k(this,"defaults",Y());k(this,"options",this.setOptions);k(this,"parse",v(this,z,V).call(this,T.lex,R.parse));k(this,"parseInline",v(this,z,V).call(this,T.lexInline,R.parseInline));k(this,"Parser",R);k(this,"Renderer",E);k(this,"TextRenderer",j);k(this,"Lexer",T);k(this,"Tokenizer",L);k(this,"Hooks",S);this.use(...e)}walkTokens(e,t){var n,r;let s=[];for(let i of e)switch(s=s.concat(t.call(this,i)),i.type){case"table":{let l=i;for(let o of l.header)s=s.concat(this.walkTokens(o.tokens,t));for(let o of l.rows)for(let c of o)s=s.concat(this.walkTokens(c.tokens,t));break}case"list":{let l=i;s=s.concat(this.walkTokens(l.items,t));break}default:{let l=i;(r=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&r[l.type]?this.defaults.extensions.childTokens[l.type].forEach(o=>{let c=l[o].flat(1/0);s=s.concat(this.walkTokens(c,t))}):l.tokens&&(s=s.concat(this.walkTokens(l.tokens,t)))}}return s}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{let n=b({},s);if(n.async=this.defaults.async||n.async||!1,s.extensions&&(s.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=t.renderers[r.name];i?t.renderers[r.name]=function(...l){let o=r.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[r.level];i?i.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),n.extensions=t),s.renderer){let r=this.defaults.renderer||new E(this.defaults);for(let i in s.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=s.renderer[l];s.useNewRenderer||(o=v(this,z,Ee).call(this,o,l,r));let c=r[l];r[l]=(...p)=>{let h=o.apply(r,p);return h===!1&&(h=c.apply(r,p)),h||""}}n.renderer=r}if(s.tokenizer){let r=this.defaults.tokenizer||new L(this.defaults);for(let i in s.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=s.tokenizer[l],c=r[l];r[l]=(...p)=>{let h=o.apply(r,p);return h===!1&&(h=c.apply(r,p)),h}}n.tokenizer=r}if(s.hooks){let r=this.defaults.hooks||new S;for(let i in s.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(i==="options")continue;let l=i,o=s.hooks[l],c=r[l];S.passThroughHooks.has(i)?r[l]=p=>{if(this.defaults.async)return Promise.resolve(o.call(r,p)).then(u=>c.call(r,u));let h=o.call(r,p);return c.call(r,h)}:r[l]=(...p)=>{let h=o.apply(r,p);return h===!1&&(h=c.apply(r,p)),h}}n.hooks=r}if(s.walkTokens){let r=this.defaults.walkTokens,i=s.walkTokens;n.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),r&&(o=o.concat(r.call(this,l))),o}}this.defaults=b(b({},this.defaults),n)}),this}setOptions(e){return this.defaults=b(b({},this.defaults),e),this}lexer(e,t){return T.lex(e,t!=null?t:this.defaults)}parser(e,t){return R.parse(e,t!=null?t:this.defaults)}};z=new WeakSet,Ee=function(e,t,s){switch(t){case"heading":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,s.parser.parseInline(n.tokens),n.depth,Ue(s.parser.parseInline(n.tokens,s.parser.textRenderer)))};case"code":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text,n.lang,!!n.escaped)};case"table":return function(n){if(!n.type||n.type!==t)return e.apply(this,arguments);let r="",i="";for(let o=0;o<n.header.length;o++)i+=this.tablecell({text:n.header[o].text,tokens:n.header[o].tokens,header:!0,align:n.align[o]});r+=this.tablerow({text:i});let l="";for(let o=0;o<n.rows.length;o++){let c=n.rows[o];i="";for(let p=0;p<c.length;p++)i+=this.tablecell({text:c[p].text,tokens:c[p].tokens,header:!1,align:n.align[p]});l+=this.tablerow({text:i})}return e.call(this,r,l)};case"blockquote":return function(n){if(!n.type||n.type!==t)return e.apply(this,arguments);let r=this.parser.parse(n.tokens);return e.call(this,r)};case"list":return function(n){if(!n.type||n.type!==t)return e.apply(this,arguments);let r=n.ordered,i=n.start,l=n.loose,o="";for(let c=0;c<n.items.length;c++){let p=n.items[c],h=p.checked,u=p.task,f="";if(p.task){let g=this.checkbox({checked:!!h});l?p.tokens.length>0&&p.tokens[0].type==="paragraph"?(p.tokens[0].text=g+" "+p.tokens[0].text,p.tokens[0].tokens&&p.tokens[0].tokens.length>0&&p.tokens[0].tokens[0].type==="text"&&(p.tokens[0].tokens[0].text=g+" "+p.tokens[0].tokens[0].text)):p.tokens.unshift({type:"text",text:g+" "}):f+=g+" "}f+=this.parser.parse(p.tokens,l),o+=this.listitem({type:"list_item",raw:f,text:f,task:u,checked:!!h,loose:l,tokens:p.tokens})}return e.call(this,o,r,i)};case"html":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text,n.block)};case"paragraph":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,this.parser.parseInline(n.tokens))};case"escape":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text)};case"link":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.href,n.title,this.parser.parseInline(n.tokens))};case"image":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.href,n.title,n.text)};case"strong":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,this.parser.parseInline(n.tokens))};case"em":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,this.parser.parseInline(n.tokens))};case"codespan":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text)};case"del":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,this.parser.parseInline(n.tokens))};case"text":return function(n){return!n.type||n.type!==t?e.apply(this,arguments):e.call(this,n.text)}}return e},V=function(e,t){return(s,n)=>{let r=b({},n),i=b(b({},this.defaults),r);this.defaults.async===!0&&r.async===!1&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);let l=v(this,z,ve).call(this,!!i.silent,!!i.async);if(typeof s=="undefined"||s===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(s):s).then(o=>e(o,i)).then(o=>i.hooks?i.hooks.processAllTokens(o):o).then(o=>i.walkTokens?Promise.all(this.walkTokens(o,i.walkTokens)).then(()=>o):o).then(o=>t(o,i)).then(o=>i.hooks?i.hooks.postprocess(o):o).catch(l);try{i.hooks&&(s=i.hooks.preprocess(s));let o=e(s,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let c=t(o,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(o){return l(o)}}},ve=function(e,t){return s=>{if(s.message+=`
Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+w(s.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(s);throw s}};var I=new K;function d(a,e){return I.parse(a,e)}d.options=d.setOptions=function(a){return I.setOptions(a),d.defaults=I.defaults,ye(d.defaults),d};d.getDefaults=Y;d.defaults=_;d.use=function(...a){return I.use(...a),d.defaults=I.defaults,ye(d.defaults),d};d.walkTokens=function(a,e){return I.walkTokens(a,e)};d.parseInline=I.parseInline;d.Parser=R;d.parser=R.parse;d.Renderer=E;d.TextRenderer=j;d.Lexer=T;d.lexer=T.lex;d.Tokenizer=L;d.Hooks=S;d.parse=d;var zt=d.options,St=d.setOptions,It=d.use,_t=d.walkTokens,At=d.parseInline;var Lt=R.parse,Et=T.lex;function Ce(a,{markdownAutoWrap:e}){let s=a.replace(/<br\/>/g,`
`).replace(/\n{2,}/g,`
`),n=de(s);return e===!1?n.replace(/ /g,"&nbsp;"):n}m(Ce,"preprocessMarkdown");function Be(a,e={}){let t=Ce(a,e),s=d.lexer(t),n=[[]],r=0;function i(l,o="normal"){l.type==="text"?l.text.split(`
`).forEach((p,h)=>{h!==0&&(r++,n.push([])),p.split(" ").forEach(u=>{u&&n[r].push({content:u,type:o})})}):l.type==="strong"||l.type==="em"?l.tokens.forEach(c=>{i(c,l.type)}):l.type==="html"&&n[r].push({content:l.text,type:"normal"})}return m(i,"processNode"),s.forEach(l=>{var o;l.type==="paragraph"?(o=l.tokens)==null||o.forEach(c=>{i(c)}):l.type==="html"&&n[r].push({content:l.text,type:"normal"})}),n}m(Be,"markdownToLines");function qe(a,{markdownAutoWrap:e}={}){let t=d.lexer(a);function s(n){var r,i,l;return n.type==="text"?e===!1?n.text.replace(/\n */g,"<br/>").replace(/ /g,"&nbsp;"):n.text.replace(/\n */g,"<br/>"):n.type==="strong"?`<strong>${(r=n.tokens)==null?void 0:r.map(s).join("")}</strong>`:n.type==="em"?`<em>${(i=n.tokens)==null?void 0:i.map(s).join("")}</em>`:n.type==="paragraph"?`<p>${(l=n.tokens)==null?void 0:l.map(s).join("")}</p>`:n.type==="space"?"":n.type==="html"?`${n.text}`:`Unsupported markdown: ${n.type}`}return m(s,"output"),t.map(s).join("")}m(qe,"markdownToHTML");function je(a){return Intl.Segmenter?[...new Intl.Segmenter().segment(a)].map(e=>e.segment):[...a]}m(je,"splitTextToChars");function Ze(a,e){let t=je(e.content);return ie(a,[],t,e.type)}m(Ze,"splitWordToFitWidth");function ie(a,e,t,s){if(t.length===0)return[{content:e.join(""),type:s},{content:"",type:s}];let[n,...r]=t,i=[...e,n];return a([{content:i.join(""),type:s}])?ie(a,i,r,s):(e.length===0&&n&&(e.push(n),t.shift()),[{content:e.join(""),type:s},{content:t.join(""),type:s}])}m(ie,"splitWordToFitWidthRecursion");function We(a,e){if(a.some(({content:t})=>t.includes(`
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return Q(a,e)}m(We,"splitLineToFitWidth");function Q(a,e,t=[],s=[]){var l;if(a.length===0)return s.length>0&&t.push(s),t.length>0?t:[];let n="";a[0].content===" "&&(n=" ",a.shift());let r=(l=a.shift())!=null?l:{content:" ",type:"normal"},i=[...s];if(n!==""&&i.push({content:n,type:"normal"}),i.push(r),e(i))return Q(a,e,t,i);if(s.length>0)t.push(s),a.unshift(r);else if(r.content){let[o,c]=Ze(e,r);t.push([o]),c.content&&a.unshift(c)}return Q(a,e,t)}m(Q,"splitLineToFitWidthRecursion");function re(a,e){e&&a.attr("style",e)}m(re,"applyStyle");async function Pe(a,e,t,s,n=!1){let r=a.append("foreignObject");r.attr("width",`${10*t}px`),r.attr("height",`${10*t}px`);let i=r.append("xhtml:div"),l=e.label;e.label&&X(e.label)&&(l=await he(e.label.replace(ue.lineBreakRegex,`
`),fe()));let o=e.isNode?"nodeLabel":"edgeLabel",c=i.append("span");c.html(l),re(c,e.labelStyle),c.attr("class",`${o} ${s}`),re(i,e.labelStyle),i.style("display","table-cell"),i.style("white-space","nowrap"),i.style("line-height","1.5"),i.style("max-width",t+"px"),i.style("text-align","center"),i.attr("xmlns","http://www.w3.org/1999/xhtml"),n&&i.attr("class","labelBkg");let p=i.node().getBoundingClientRect();return p.width===t&&(i.style("display","table"),i.style("white-space","break-spaces"),i.style("width",t+"px"),p=i.node().getBoundingClientRect()),r.node()}m(Pe,"addHtmlSpan");function F(a,e,t){return a.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",e*t-.1+"em").attr("dy",t+"em")}m(F,"createTspan");function Me(a,e,t){let s=a.append("text"),n=F(s,1,e);H(n,t);let r=n.node().getComputedTextLength();return s.remove(),r}m(Me,"computeWidthOfText");function Tt(a,e,t){var i;let s=a.append("text"),n=F(s,1,e);H(n,[{content:t,type:"normal"}]);let r=(i=n.node())==null?void 0:i.getBoundingClientRect();return r&&s.remove(),r}m(Tt,"computeDimensionOfText");function Oe(a,e,t,s=!1){let r=e.append("g"),i=r.insert("rect").attr("class","background").attr("style","stroke: none"),l=r.append("text").attr("y","-10.1"),o=0;for(let c of t){let p=m(u=>Me(r,1.1,u)<=a,"checkWidth"),h=p(c)?[c]:We(c,p);for(let u of h){let f=F(l,o,1.1);H(f,u),o++}}if(s){let c=l.node().getBBox(),p=2;return i.attr("x",c.x-p).attr("y",c.y-p).attr("width",c.width+2*p).attr("height",c.height+2*p),r.node()}else return l.node()}m(Oe,"createFormattedText");function H(a,e){a.text(""),e.forEach((t,s)=>{let n=a.append("tspan").attr("font-style",t.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",t.type==="strong"?"bold":"normal");s===0?n.text(t.content):n.text(" "+t.content)})}m(H,"updateTextContentAndStyles");function De(a){return a.replace(/fa[bklrs]?:fa-[\w-]+/g,e=>`<i class='${e.replace(":"," ")}'></i>`)}m(De,"replaceIconSubstring");var Pt=m(async(a,e="",{style:t="",isTitle:s=!1,classes:n="",useHtmlLabels:r=!0,isNode:i=!0,width:l=200,addSvgBackground:o=!1}={},c)=>{if(pe.debug("XYZ createText",e,t,s,n,r,i,"addSvgBackground: ",o),r){let p=qe(e,c),h=De(ge(p)),u=e.replace(/\\\\/g,"\\"),f={isNode:i,label:X(e)?u:h,labelStyle:t.replace("fill:","color:")};return await Pe(a,f,l,n,o)}else{let p=e.replace(/<br\s*\/?>/g,"<br/>"),h=Be(p.replace("<br>","<br/>"),c),u=Oe(l,a,h,e?o:!1);if(i){/stroke:/.exec(t)&&(t=t.replace("stroke:","lineColor:"));let f=t.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");P(u).attr("style",f)}else{let f=t.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");P(u).select("rect").attr("style",f.replace(/background:/g,"fill:"));let g=t.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");P(u).select("text").attr("style",g)}return u}},"createText");export{de as a,Tt as b,De as c,Pt as d};
