`}tablecell(e){let 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`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${P(e,!0)}`}br(e){return" "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,text:n,tokens:r,autolink:s}){let o=s?P(n,!0):this.parser.parseInline(r),i=we(e);if(i===null)return o;e=P(i,s);let a='"+o+"",a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(_e(r),this.parser.textRenderer));let s=we(e);if(s===null)return P(n);e=s;let o=`",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:P(e.text)}};var q=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return`
`}checkbox({raw:e}){return e}};var S=class l{options;renderer;textRenderer;constructor(e){this.options=e||$,this.options.renderer=this.options.renderer||new M,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new q,this.textRenderer.parser=this}static parse(e,t){return new l(t).parse(e)}static parseInline(e,t){return new l(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let n=0;n{if(s[o]){let i=s[o].flat(1/0);v(n,this.walkTokens(i,t))}}):s.tokens&&v(n,this.walkTokens(s.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s&&s.renderer){let o=s.renderer,i=t.renderers[s.name];i?t.renderers[s.name]=function(...a){let p=o.apply(this,a);return p===!1&&(p=i.apply(this,a)),p}:t.renderers[s.name]=o}if("tokenizer"in s&&s.tokenizer){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[s.level];o?o.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new M(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let i=o,a=n.renderer[i];if(a===void 0)continue;let p=s[i];s[i]=(...u)=>{let d=a.apply(s,u);return d===!1&&(d=p.apply(s,u)),d===!1?"":d??""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new C(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let i=o,a=n.tokenizer[i];if(a===void 0)continue;let p=s[i];s[i]=(...u)=>{let d=a.apply(s,u);return d===!1&&(d=p.apply(s,u)),d}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new B;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let i=o,a=n.hooks[i];if(a===void 0)continue;let p=s[i];B.passThroughHooks.has(o)?s[i]=u=>{if(s.options.async&&B.passThroughHooksRespectAsync.has(o))return(async()=>{let k=await a.call(s,u);return p.call(s,k)})();let d=a.call(s,u);return p.call(s,d)}:s[i]=(...u)=>{if(s.options.async)return(async()=>{let k=await a.apply(s,u);return k===!1&&(k=await p.apply(s,u)),k})();let d=a.apply(s,u);return d===!1&&(d=p.apply(s,u)),d}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(i){let a=[];return v(a,o.call(this,i)),s&&v(a,s.call(this,i)),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return y.lex(e,t??this.defaults)}parser(e,t){return S.parse(e,t??this.defaults)}parseMarkdown(e){return(n,r)=>{let s={...r},o={...this.defaults,...s},i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&s.async===!1)return i(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(typeof n>"u"||n===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let a=o.hooks?await o.hooks.preprocess(n):n,u=await(o.hooks?await o.hooks.provideLexer(e):e?y.lex:y.lexInline)(a,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let g=await(o.hooks?await o.hooks.provideParser(e):e?S.parse:S.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(g):g})().catch(i);try{o.hooks&&(n=o.hooks.preprocess(n));let p=(o.hooks?o.hooks.provideLexer(e):e?y.lex:y.lexInline)(n,o);o.hooks&&(p=o.hooks.processAllTokens(p)),o.walkTokens&&this.walkTokens(p,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?S.parse:S.parseInline)(p,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{let r=n instanceof Error?n:new Error(String(n));if(r.message+=`
Please report this to https://github.com/markedjs/marked.`,e){let s="
An error occurred:
"+P(r.message+"",!0)+"
";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}};var F=new se;function O(l,e){return F.parse(l,e)}function sn(l,e){return F.parseInline(l,e)}O.options=O.setOptions=function(l){return F.setOptions(l),O.defaults=F.defaults,ge(O.defaults),O};O.getDefaults=G;O.defaults=$;function on(...l){return F.use(...l),O.defaults=F.defaults,ge(O.defaults),O}O.use=on;O.walkTokens=function(l,e){return F.walkTokens(l,e)};O.parseInline=sn;O.Parser=S;O.parser=S.parse;O.Renderer=M;O.TextRenderer=q;O.Lexer=y;O.lexer=y.lex;O.Tokenizer=C;O.Hooks=B;O.parse=O;var Xn=O.options,Vn=O.setOptions,Jn=O.walkTokens,Yn=O.parseInline,er=O,tr=S.parse,nr=y.lex;export{B as Hooks,y as Lexer,se as Marked,S as Parser,M as Renderer,q as TextRenderer,C as Tokenizer,$ as defaults,G as getDefaults,nr as lexer,O as marked,Xn as options,er as parse,Yn as parseInline,tr as parser,Vn as setOptions,on as use,Jn as walkTokens};