MeshCentral/public/scripts/marked-min.js
si458 f23792881e more general web fixes and updates
Signed-off-by: si458 <simonsmith5521@gmail.com>
2024-10-28 11:26:30 +00:00

11 lines
35 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,function(n){"use strict";function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function t(e){n.defaults=e}n.defaults=e();const s=/[&<>"']/,Q=new RegExp(s.source,"g"),r=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,B=new RegExp(r.source,"g"),M={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},i=e=>M[e];function l(e,t){if(t){if(s.test(e))return e.replace(Q,i)}else if(r.test(e))return e.replace(B,i);return e}const O=/(^|[^\[])\^/g;function a(e,t){let s="string"==typeof e?e:e.source;t=t||"";const r={replace:(e,t)=>{let n="string"==typeof t?t:t.source;return n=n.replace(O,"$1"),s=s.replace(e,n),r},getRegex:()=>new RegExp(s,t)};return r}function o(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}var c={exec:()=>null};function h(e,t){const n=e.replace(/\|/g,(e,t,n)=>{let s=!1,r=t;for(;0<=--r&&"\\"===n[r];)s=!s;return s?"|":" |"}),s=n.split(/ \|/);let r=0;if(s[0].trim()||s.shift(),0<s.length&&!s[s.length-1].trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(/\\\|/g,"|");return s}function u(e,t,n){var s=e.length;if(0===s)return"";let r=0;for(;r<s;){var i=e.charAt(s-r-1);if(i!==t||n){if(i===t||!n)break;r++}else r++}return e.slice(0,s-r)}function j(e,t,n,s){var r=t.href,t=t.title?l(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?(s.state.inLink=!0,e={type:"link",raw:n,href:r,title:t,text:i,tokens:s.inlineTokens(i)},s.state.inLink=!1,e):{type:"image",raw:n,href:r,title:t,text:l(i)}}class m{options;rules;lexer;constructor(e){this.options=e||n.defaults}space(e){e=this.rules.block.newline.exec(e);if(e&&0<e[0].length)return{type:"space",raw:e[0]}}code(e){const t=this.rules.block.code.exec(e);if(t)return e=t[0].replace(/^(?: {1,4}| {0,3}\t)/gm,""),{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:u(e,"\n")}}fences(e){const t=this.rules.block.fences.exec(e);var n;if(t)return n=function(e,t){if(null===(e=e.match(/^(\s+)(?:```)/)))return t;const n=e[1];return t.split("\n").map(e=>{var t=e.match(/^\s+/);if(null===t)return e;var[t]=t;return t.length>=n.length?e.slice(n.length):e}).join("\n")}(e=t[0],t[3]||""),{type:"code",raw:e,lang:t[2]&&t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"),text:n}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const n=u(e,"#");!this.options.pedantic&&n&&!/ $/.test(n)||(e=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){e=this.rules.block.hr.exec(e);if(e)return{type:"hr",raw:u(e[0],"\n")}}blockquote(e){e=this.rules.block.blockquote.exec(e);if(e){let n=u(e[0],"\n").split("\n"),s="",r="";const o=[];for(;0<n.length;){let e=!1;const c=[];let t;for(t=0;t<n.length;t++)if(/^ {0,3}>/.test(n[t]))c.push(n[t]),e=!0;else{if(e)break;c.push(n[t])}n=n.slice(t);const h=c.join("\n");var i=h.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1").replace(/^ {0,3}>[ \t]?/gm,""),l=(s=s?s+`
`+h:h,r=r?r+`
`+i:i,this.lexer.state.top);if(this.lexer.state.top=!0,this.lexer.blockTokens(i,o,!0),this.lexer.state.top=l,0===n.length)break;i=o[o.length-1];if("code"===i?.type)break;if("blockquote"===i?.type){var l=i,a=l.raw+"\n"+n.join("\n"),a=this.blockquote(a);o[o.length-1]=a,s=s.substring(0,s.length-l.raw.length)+a.raw,r=r.substring(0,r.length-l.text.length)+a.text;break}if("list"===i?.type){l=i;const p=l.raw+"\n"+n.join("\n");a=this.list(p);o[o.length-1]=a,s=s.substring(0,s.length-i.raw.length)+a.raw,r=r.substring(0,r.length-l.raw.length)+a.raw,n=p.substring(o[o.length-1].raw.length).split("\n")}}return{type:"blockquote",raw:s,tokens:o,text:r}}}list(h){let p=this.rules.block.list.exec(h);if(p){let e=p[1].trim();var t=1<e.length;const k={type:"list",raw:"",ordered:t,start:t?+e.slice(0,-1):"",loose:!1,items:[]},g=(e=t?"\\d{1,9}\\"+e.slice(-1):"\\"+e,this.options.pedantic&&(e=t?e:"[*+-]"),new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`));let c=!1;for(;h;){let e=!1,t="",n="";if(!(p=g.exec(h)))break;if(this.rules.block.hr.test(h))break;t=p[0],h=h.substring(t.length);let s=p[2].split("\n",1)[0].replace(/^\t+/,e=>" ".repeat(3*e.length)),r=h.split("\n",1)[0],i=!s.trim(),l=0;if(this.options.pedantic?(l=2,n=s.trimStart()):i?l=p[1].length+1:(l=4<(l=p[2].search(/[^ ]/))?1:l,n=s.slice(l),l+=p[1].length),i&&/^[ \t]*$/.test(r)&&(t+=r+"\n",h=h.substring(r.length+1),e=!0),!e){const f=new RegExp(`^ {0,${Math.min(3,l-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),d=new RegExp(`^ {0,${Math.min(3,l-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),x=new RegExp(`^ {0,${Math.min(3,l-1)}}(?:\`\`\`|~~~)`),b=new RegExp(`^ {0,${Math.min(3,l-1)}}#`),w=new RegExp(`^ {0,${Math.min(3,l-1)}}<[a-z].*>`,"i");for(;h;){var u=h.split("\n",1)[0];let e;if(r=u,e=this.options.pedantic?r=r.replace(/^ {1,4}(?=( {4})*[^ ])/g," "):r.replace(/\t/g," "),x.test(r))break;if(b.test(r))break;if(w.test(r))break;if(f.test(r))break;if(d.test(r))break;if(e.search(/[^ ]/)>=l||!r.trim())n+="\n"+e.slice(l);else{if(i)break;if(4<=s.replace(/\t/g," ").search(/[^ ]/))break;if(x.test(s))break;if(b.test(s))break;if(d.test(s))break;n+="\n"+r}i||r.trim()||(i=!0),t+=u+"\n",h=h.substring(u.length+1),s=e.slice(l)}}k.loose||(c?k.loose=!0:/\n[ \t]*\n[ \t]*$/.test(t)&&(c=!0));let a=null,o;this.options.gfm&&(a=/^\[[ xX]\] /.exec(n))&&(o="[ ] "!==a[0],n=n.replace(/^\[[ xX]\] +/,"")),k.items.push({type:"list_item",raw:t,task:!!a,checked:o,loose:!1,text:n,tokens:[]}),k.raw+=t}k.items[k.items.length-1].raw=k.items[k.items.length-1].raw.trimEnd(),k.items[k.items.length-1].text=k.items[k.items.length-1].text.trimEnd(),k.raw=k.raw.trimEnd();for(let e=0;e<k.items.length;e++)if(this.lexer.state.top=!1,k.items[e].tokens=this.lexer.blockTokens(k.items[e].text,[]),!k.loose){const s=k.items[e].tokens.filter(e=>"space"===e.type);var n=0<s.length&&s.some(e=>/\n.*\n/.test(e.raw));k.loose=n}if(k.loose)for(let e=0;e<k.items.length;e++)k.items[e].loose=!0;return k}}html(e){e=this.rules.block.html.exec(e);if(e)return{type:"html",block:!0,raw:e[0],pre:"pre"===e[1]||"script"===e[1]||"style"===e[1],text:e[0]}}def(e){const t=this.rules.block.def.exec(e);var n,s;if(t)return e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]&&t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"),{type:"def",tag:e,raw:t[0],href:n,title:s}}table(e){const t=this.rules.block.table.exec(e);if(t&&/[:|]/.test(t[2])){var n=h(t[1]),e=t[2].replace(/^\||\| *$/g,"").split("|"),s=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[];const r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===e.length){for(const i of e)/^ *-+: *$/.test(i)?r.align.push("right"):/^ *:-+: *$/.test(i)?r.align.push("center"):/^ *:-+ *$/.test(i)?r.align.push("left"):r.align.push(null);for(let e=0;e<n.length;e++)r.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:r.align[e]});for(const l of s)r.rows.push(h(l,r.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:r.align[t]})));return r}}}lheading(e){const 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){const t=this.rules.block.paragraph.exec(e);if(t)return e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1],{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}text(e){e=this.rules.block.text.exec(e);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(e){e=this.rules.inline.escape.exec(e);if(e)return{type:"escape",raw:e[0],text:l(e[1])}}tag(e){e=this.rules.inline.tag.exec(e);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:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){const s=this.rules.inline.link.exec(n);if(s){const i=s[2].trim();if(!this.options.pedantic&&/^</.test(i)){if(!/>$/.test(i))return;n=u(i.slice(0,-1),"\\");if((i.length-n.length)%2==0)return}else{var r,n=function(t,n){if(-1===t.indexOf(n[1]))return-1;let s=0;for(let e=0;e<t.length;e++)if("\\"===t[e])e++;else if(t[e]===n[0])s++;else if(t[e]===n[1]&&--s<0)return e;return-1}(s[2],"()");-1<n&&(r=(0===s[0].indexOf("!")?5:4)+s[1].length+n,s[2]=s[2].substring(0,n),s[0]=s[0].substring(0,r).trim(),s[3]="")}let e=s[2],t="";return this.options.pedantic?(n=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(e))&&(e=n[1],t=n[3]):t=s[3]?s[3].slice(1,-1):"",e=e.trim(),/^</.test(e)&&(e=this.options.pedantic&&!/>$/.test(i)?e.slice(1):e.slice(1,-1)),j(s,{href:e&&e.replace(this.rules.inline.anyPunctuation,"$1"),title:t&&t.replace(this.rules.inline.anyPunctuation,"$1")},s[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const s=(n[2]||n[1]).replace(/\s+/g," ");e=t[s.toLowerCase()];return e?j(n,e,n[0],this.lexer):{type:"text",raw:t=n[0].charAt(0),text:t}}}emStrong(r,i,e=""){let l=this.rules.inline.emStrongLDelim.exec(r);if(l&&((!l[3]||!e.match(/[\p{L}\p{N}]/u))&&(!(l[1]||l[2]||"")||!e||this.rules.inline.punctuation.exec(e)))){var a=[...l[0]].length-1;let e,t,n=a,s=0;const c="*"===l[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,i=i.slice(-1*r.length+a);null!=(l=c.exec(i));)if(e=l[1]||l[2]||l[3]||l[4]||l[5]||l[6])if(t=[...e].length,l[3]||l[4])n+=t;else if((l[5]||l[6])&&a%3&&!((a+t)%3))s+=t;else if(!(0<(n-=t))){t=Math.min(t,t+n+s);var o=[...l[0]][0].length;const h=r.slice(0,a+l.index+o+t);if(Math.min(a,t)%2)return o=h.slice(1,-1),{type:"em",raw:h,text:o,tokens:this.lexer.inlineTokens(o)};o=h.slice(2,-2);return{type:"strong",raw:h,text:o,tokens:this.lexer.inlineTokens(o)}}}}codespan(t){const n=this.rules.inline.code.exec(t);if(n){let e=n[2].replace(/\n/g," ");var t=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return e=l(e=t&&s?e.substring(1,e.length-1):e,!0),{type:"codespan",raw:n[0],text:e}}}br(e){e=this.rules.inline.br.exec(e);if(e)return{type:"br",raw:e[0]}}del(e){e=this.rules.inline.del.exec(e);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){n=this.rules.inline.autolink.exec(n);if(n){let e,t;return t="@"===n[2]?"mailto:"+(e=l(n[1])):e=l(n[1]),{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let n;if(n=this.rules.inline.url.exec(e)){let e,t;if("@"===n[2])e=l(n[0]),t="mailto:"+e;else{for(var s;s=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"",s!==n[0];);e=l(n[0]),t="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(t){t=this.rules.inline.text.exec(t);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:l(t[0]),{type:"text",raw:t[0],text:e}}}}var p=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,k=/(?:[*+-]|\d{1,9}[.)])/,g=a(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,k).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),f=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,d=/(?!\s*\])(?:\\.|[^\[\]\\])+/,x=a(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",d).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),k=a(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,k).getRegex(),b="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",w=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,y=a("^ {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[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",w).replace("tag",b).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$=a(f).replace("hr",p).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",b).getRegex(),x={blockquote:a(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",$).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:x,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:p,html:y,lheading:g,list:k,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:$,table:c,text:/^[^\n]+/},y=a("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",p).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\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",b).getRegex(),k={...x,table:y,paragraph:a(f).replace("hr",p).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",y).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",b).getRegex()},$={...x,html:a("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",w).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:c,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:a(f).replace("hr",p).replace("heading"," *#{1,6} *[^\n]").replace("lheading",g).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},y=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,b=/^( {2,}|\\)\n(?!\s*$)/,f="\\p{P}\\p{S}",p=a(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,f).getRegex(),g=a(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,f).getRegex(),D=a("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,f).getRegex(),z=a("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,f).getRegex(),f=a(/\\([punct])/,"gu").replace(/punct/g,f).getRegex(),C=a(/^<(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(),w=a(w).replace("(?:--\x3e|$)","--\x3e").getRegex(),w=a("^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",w).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),v=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,R=a(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",v).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),T=a(/^!?\[(label)\]\[(ref)\]/).replace("label",v).replace("ref",d).getRegex(),d=a(/^!?\[(ref)\](?:\[\])?/).replace("ref",d).getRegex(),f={_backpedal:c,anyPunctuation:f,autolink:C,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:b,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:c,emStrongLDelim:g,emStrongRDelimAst:D,emStrongRDelimUnd:z,escape:y,link:R,nolink:d,punctuation:p,reflink:T,reflinkSearch:a("reflink|nolink(?!\\()","g").replace("reflink",T).replace("nolink",d).getRegex(),tag:w,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:c},C={...f,link:a(/^!?\[(label)\]\((.*?)\)/).replace("label",v).getRegex(),reflink:a(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",v).getRegex()},g={...f,escape:a(y).replace("])","~|])").getRegex(),url:a(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},D={...g,br:a(b).replace("{2,}","*").getRegex(),text:a(g.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};const _={normal:x,gfm:k,pedantic:$},A={normal:f,gfm:g,breaks:D,pedantic:C};class S{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||n.defaults,this.options.tokenizer=this.options.tokenizer||new m,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,(this.tokenizer.lexer=this).inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:_.normal,inline:A.normal};this.options.pedantic?(t.block=_.pedantic,t.inline=A.pedantic):this.options.gfm&&(t.block=_.gfm,this.options.breaks?t.inline=A.breaks:t.inline=A.gfm),this.tokenizer.rules=t}static get rules(){return{block:_,inline:A}}static lex(e,t){const n=new S(t);return n.lex(e)}static lexInline(e,t){const n=new S(t);return n.inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){var t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(s,t=[],e=!1){this.options.pedantic&&(s=s.replace(/\t/g," ").replace(/^ +$/gm,""));let n,r,i;for(;s;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(e=>!!(n=e.call({lexer:this},s,t))&&(s=s.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.space(s))s=s.substring(n.raw.length),1===n.raw.length&&0<t.length?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(s))s=s.substring(n.raw.length),!(r=t[t.length-1])||"paragraph"!==r.type&&"text"!==r.type?t.push(n):(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.fences(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(s))s=s.substring(n.raw.length),!(r=t[t.length-1])||"paragraph"!==r.type&&"text"!==r.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(r.raw+="\n"+n.raw,r.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.table(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(s))s=s.substring(n.raw.length),t.push(n);else{if(i=s,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const a=s.slice(1);let n;this.options.extensions.startBlock.forEach(e=>{"number"==typeof(n=e.call({lexer:this},a))&&0<=n&&(t=Math.min(t,n))}),t<1/0&&0<=t&&(i=s.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i)))r=t[t.length-1],e&&"paragraph"===r?.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),e=i.length!==s.length,s=s.substring(n.raw.length);else if(n=this.tokenizer.text(s))s=s.substring(n.raw.length),(r=t[t.length-1])&&"text"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);else if(s){var l="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(l);break}throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(s,t=[]){let n,e,r,i=s,l,a,o;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(0<h.length)for(;null!=(l=this.tokenizer.rules.inline.reflinkSearch.exec(i));)h.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(;null!=(l=this.tokenizer.rules.inline.blockSkip.exec(i));)i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(l=this.tokenizer.rules.inline.anyPunctuation.exec(i));)i=i.slice(0,l.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;s;)if(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(e=>!!(n=e.call({lexer:this},s,t))&&(s=s.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.escape(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(s))s=s.substring(n.raw.length),(e=t[t.length-1])&&"text"===n.type&&"text"===e.type?(e.raw+=n.raw,e.text+=n.text):t.push(n);else if(n=this.tokenizer.link(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(s,this.tokens.links))s=s.substring(n.raw.length),(e=t[t.length-1])&&"text"===n.type&&"text"===e.type?(e.raw+=n.raw,e.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(s,i,o))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(s))s=s.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(s))s=s.substring(n.raw.length),t.push(n);else if(!this.state.inLink&&(n=this.tokenizer.url(s)))s=s.substring(n.raw.length),t.push(n);else{if(r=s,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const p=s.slice(1);let n;this.options.extensions.startInline.forEach(e=>{"number"==typeof(n=e.call({lexer:this},p))&&0<=n&&(t=Math.min(t,n))}),t<1/0&&0<=t&&(r=s.substring(0,t+1))}if(n=this.tokenizer.inlineText(r))s=s.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),a=!0,(e=t[t.length-1])&&"text"===e.type?(e.raw+=n.raw,e.text+=n.text):t.push(n);else if(s){var c="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}}return t}}class I{options;parser;constructor(e){this.options=e||n.defaults}space(e){return""}code({text:e,lang:t,escaped:n}){t=(t||"").match(/^\S*/)?.[0],e=e.replace(/\n$/,"")+"\n";return t?'<pre><code class="language-'+l(t)+'">'+(n?e:l(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:l(e,!0))+"</code></pre>\n"}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>\n"}list(t){var e=t.ordered,n=t.start;let s="";for(let e=0;e<t.items.length;e++){var r=t.items[e];s+=this.listitem(r)}var i=e?"ol":"ul";return"<"+i+(e&&1!==n?' start="'+n+'"':"")+">\n"+s+"</"+i+">\n"}listitem(e){let t="";var n;return e.task&&(n=this.checkbox({checked:!!e.checked}),e.loose?0<e.tokens.length&&"paragraph"===e.tokens[0].type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&0<e.tokens[0].tokens.length&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" "}):t+=n+" "),`<li>${t+=this.parser.parse(e.tokens,!!e.loose)}</li>
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(t){var e="";let n="";for(let e=0;e<t.header.length;e++)n+=this.tablecell(t.header[e]);e+=this.tablerow({text:n});let s="";for(let e=0;e<t.rows.length;e++){var r=t.rows[e];n="";for(let e=0;e<r.length;e++)n+=this.tablecell(r[e]);s+=this.tablerow({text:n})}return"<table>\n<thead>\n"+e+"</thead>\n"+(s=s&&`<tbody>${s}</tbody>`)+"</table>\n"}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){var t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){var n=this.parser.parseInline(n),s=o(e);if(null===s)return n;let r='<a href="'+(e=s)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>"}image({href:e,title:t,text:n}){var s=o(e);if(null===s)return n;let r=`<img src="${e=s}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">"}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class E{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""}}class q{options;renderer;textRenderer;constructor(e){this.options=e||n.defaults,this.options.renderer=this.options.renderer||new I,this.renderer=this.options.renderer,this.renderer.options=this.options,(this.renderer.parser=this).textRenderer=new E}static parse(e,t){const n=new q(t);return n.parse(e)}static parseInline(e,t){const n=new q(t);return n.parseInline(e)}parse(n,s=!0){let r="";for(let t=0;t<n.length;t++){var e=n[t];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[e.type]){var i=e,l=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==l||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(i.type)){r+=l||"";continue}}var a=e;switch(a.type){case"space":r+=this.renderer.space(a);continue;case"hr":r+=this.renderer.hr(a);continue;case"heading":r+=this.renderer.heading(a);continue;case"code":r+=this.renderer.code(a);continue;case"table":r+=this.renderer.table(a);continue;case"blockquote":r+=this.renderer.blockquote(a);continue;case"list":r+=this.renderer.list(a);continue;case"html":r+=this.renderer.html(a);continue;case"paragraph":r+=this.renderer.paragraph(a);continue;case"text":{var o;let e=this.renderer.text(a);for(;t+1<n.length&&"text"===n[t+1].type;)o=n[++t],e+="\n"+this.renderer.text(o);r+=s?this.renderer.paragraph({type:"paragraph",raw:e,text:e,tokens:[{type:"text",raw:e,text:e}]}):e;continue}default:var c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}return r}parseInline(t,n){n=n||this.renderer;let s="";for(let e=0;e<t.length;e++){var r=t[e];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){var i=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==i||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){s+=i||"";continue}}var l=r;switch(l.type){case"escape":s+=n.text(l);break;case"html":s+=n.html(l);break;case"link":s+=n.link(l);break;case"image":s+=n.image(l);break;case"strong":s+=n.strong(l);break;case"em":s+=n.em(l);break;case"codespan":s+=n.codespan(l);break;case"br":s+=n.br(l);break;case"del":s+=n.del(l);break;case"text":s+=n.text(l);break;default:var a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}return s}}class Z{options;block;constructor(e){this.options=e||n.defaults}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?S.lex:S.lexInline}provideParser(){return this.block?q.parse:q.parseInline}}class H{defaults=e();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=q;Renderer=I;TextRenderer=E;Lexer=S;Tokenizer=m;Hooks=Z;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":var s=r;for(const i of s.header)n=n.concat(this.walkTokens(i.tokens,t));for(const l of s.rows)for(const a of l)n=n.concat(this.walkTokens(a.tokens,t));break;case"list":s=r;n=n.concat(this.walkTokens(s.items,t));break;default:{const o=r;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(e=>{e=o[e].flat(1/0);n=n.concat(this.walkTokens(e,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){const w=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{const t={...e};if(t.async=this.defaults.async||t.async||!1,e.extensions&&(e.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){const s=w.renderers[n.name];s?w.renderers[n.name]=function(...e){let t=n.renderer.apply(this,e);return t=!1===t?s.apply(this,e):t}:w.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||"block"!==n.level&&"inline"!==n.level)throw new Error("extension level must be 'block' or 'inline'");const e=w[n.level];e?e.unshift(n.tokenizer):w[n.level]=[n.tokenizer],n.start&&("block"===n.level?w.startBlock?w.startBlock.push(n.start):w.startBlock=[n.start]:"inline"===n.level&&(w.startInline?w.startInline.push(n.start):w.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(w.childTokens[n.name]=n.childTokens)}),t.extensions=w),e.renderer){const i=this.defaults.renderer||new I(this.defaults);for(const l in e.renderer){if(!(l in i))throw new Error(`renderer '${l}' does not exist`);if(!["options","parser"].includes(l)){var n=l;const a=e.renderer[n],o=i[n];i[n]=(...e)=>{let t=a.apply(i,e);return(t=!1===t?o.apply(i,e):t)||""}}}t.renderer=i}if(e.tokenizer){const c=this.defaults.tokenizer||new m(this.defaults);for(const h in e.tokenizer){if(!(h in c))throw new Error(`tokenizer '${h}' does not exist`);if(!["options","rules","lexer"].includes(h)){var s=h;const p=e.tokenizer[s],u=c[s];c[s]=(...e)=>{let t=p.apply(c,e);return t=!1===t?u.apply(c,e):t}}}t.tokenizer=c}if(e.hooks){const k=this.defaults.hooks||new Z;for(const g in e.hooks){if(!(g in k))throw new Error(`hook '${g}' does not exist`);if(!["options","block"].includes(g)){var r=g;const f=e.hooks[r],d=k[r];Z.passThroughHooks.has(g)?k[r]=e=>{if(this.defaults.async)return Promise.resolve(f.call(k,e)).then(e=>d.call(k,e));e=f.call(k,e);return d.call(k,e)}:k[r]=(...e)=>{let t=f.apply(k,e);return t=!1===t?d.apply(k,e):t}}}t.hooks=k}if(e.walkTokens){const x=this.defaults.walkTokens,b=e.walkTokens;t.walkTokens=function(e){let t=[];return t.push(b.call(this,e)),t=x?t.concat(x.call(this,e)):t}}this.defaults={...this.defaults,...t}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return S.lex(e,t??this.defaults)}parser(e,t){return q.parse(e,t??this.defaults)}parseMarkdown(l){return(n,e)=>{e={...e};const s={...this.defaults,...e},t=this.onError(!!s.silent,!!s.async);if(!0===this.defaults.async&&!1===e.async)return t(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==n)return t(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return t(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));s.hooks&&((s.hooks.options=s).hooks.block=l);const r=s.hooks?s.hooks.provideLexer():l?S.lex:S.lexInline,i=s.hooks?s.hooks.provideParser():l?q.parse:q.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(e=>r(e,s)).then(e=>s.hooks?s.hooks.processAllTokens(e):e).then(e=>s.walkTokens?Promise.all(this.walkTokens(e,s.walkTokens)).then(()=>e):e).then(e=>i(e,s)).then(e=>s.hooks?s.hooks.postprocess(e):e).catch(t);try{s.hooks&&(n=s.hooks.preprocess(n));let e=r(n,s),t=(s.hooks&&(e=s.hooks.processAllTokens(e)),s.walkTokens&&this.walkTokens(e,s.walkTokens),i(e,s));return t=s.hooks?s.hooks.postprocess(t):t}catch(e){return t(e)}}}onError(n,s){return e=>{var t;if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",n)return t="<p>An error occurred:</p><pre>"+l(e.message+"",!0)+"</pre>",s?Promise.resolve(t):t;if(s)return Promise.reject(e);throw e}}}const P=new H;function L(e,t){return P.parse(e,t)}L.options=L.setOptions=function(e){return P.setOptions(e),t(L.defaults=P.defaults),L},L.getDefaults=e,L.defaults=n.defaults,L.use=function(...e){return P.use(...e),t(L.defaults=P.defaults),L},L.walkTokens=function(e,t){return P.walkTokens(e,t)},L.parseInline=P.parseInline,L.Parser=q,L.parser=q.parse,L.Renderer=I,L.TextRenderer=E,L.Lexer=S,L.lexer=S.lex,L.Tokenizer=m,L.Hooks=Z;z=(L.parse=L).options,R=L.setOptions,p=L.use,T=L.walkTokens,d=L.parseInline,w=L,c=q.parse,v=S.lex;n.Hooks=Z,n.Lexer=S,n.Marked=H,n.Parser=q,n.Renderer=I,n.TextRenderer=E,n.Tokenizer=m,n.getDefaults=e,n.lexer=v,n.marked=L,n.options=z,n.parse=w,n.parseInline=d,n.parser=c,n.setOptions=R,n.use=p,n.walkTokens=T});