import{m as ve,u as ke,e as Pe,f as de,d as ie}from"./mdurl-k9Sl0PQj.js";import{P as Re,r as ze,u as Oe}from"./uc.micro-kMc2yuuw.js";import{d as me}from"./entities-C20TfXL6.js";import{L as De}from"./linkify-it-DmNjr4Kv.js";import{p as xe}from"./punycode.js-Dj65hjkv.js";function Fe(e){return Object.prototype.toString.call(e)}function ee(e){return Fe(e)==="[object String]"}const Le=Object.prototype.hasOwnProperty;function $e(e,n){return Le.call(e,n)}function G(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){if(r){if(typeof r!="object")throw new TypeError(r+"must be object");Object.keys(r).forEach(function(i){e[i]=r[i]})}}),e}function ge(e,n,r){return[].concat(e.slice(0,n),r,e.slice(n+1))}function ne(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function H(e){if(e>65535){e-=65536;const n=55296+(e>>10),r=56320+(e&1023);return String.fromCharCode(n,r)}return String.fromCharCode(e)}const _e=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Be=/&([a-z#][a-z0-9]{1,31});/gi,je=new RegExp(_e.source+"|"+Be.source,"gi"),qe=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Ne(e,n){if(n.charCodeAt(0)===35&&qe.test(n)){const i=n[1].toLowerCase()==="x"?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return ne(i)?H(i):e}const r=me(e);return r!==e?r:e}function Ze(e){return e.indexOf("\\")<0?e:e.replace(_e,"$1")}function D(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(je,function(n,r,i){return r||Ne(n,i)})}const Ue=/[&<>"]/,He=/[&<>"]/g,Ge={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function We(e){return Ge[e]}function R(e){return Ue.test(e)?e.replace(He,We):e}const Qe=/[.?*+^$[\]\\(){}|-]/g;function Je(e){return e.replace(Qe,"\\$&")}function A(e){switch(e){case 9:case 32:return!0}return!1}function $(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function B(e){return Re.test(e)||ze.test(e)}function j(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function W(e){return e=e.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(e=e.replace(/ẞ/g,"ß")),e.toLowerCase().toUpperCase()}const Ve={mdurl:ve,ucmicro:Oe},Xe=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:ge,assign:G,escapeHtml:R,escapeRE:Je,fromCodePoint:H,has:$e,isMdAsciiPunct:j,isPunctChar:B,isSpace:A,isString:ee,isValidEntityCode:ne,isWhiteSpace:$,lib:Ve,normalizeReference:W,unescapeAll:D,unescapeMd:Ze},Symbol.toStringTag,{value:"Module"}));function Ye(e,n,r){let i,o,t,l;const c=e.posMax,s=e.pos;for(e.pos=n+1,i=1;e.pos<c;){if(t=e.src.charCodeAt(e.pos),t===93&&(i--,i===0)){o=!0;break}if(l=e.pos,e.md.inline.skipToken(e),t===91){if(l===e.pos-1)i++;else if(r)return e.pos=s,-1}}let f=-1;return o&&(f=e.pos),e.pos=s,f}function Ke(e,n,r){let i,o=n;const t={ok:!1,pos:0,str:""};if(e.charCodeAt(o)===60){for(o++;o<r;){if(i=e.charCodeAt(o),i===10||i===60)return t;if(i===62)return t.pos=o+1,t.str=D(e.slice(n+1,o)),t.ok=!0,t;if(i===92&&o+1<r){o+=2;continue}o++}return t}let l=0;for(;o<r&&(i=e.charCodeAt(o),!(i===32||i<32||i===127));){if(i===92&&o+1<r){if(e.charCodeAt(o+1)===32)break;o+=2;continue}if(i===40&&(l++,l>32))return t;if(i===41){if(l===0)break;l--}o++}return n===o||l!==0||(t.str=D(e.slice(n,o)),t.pos=o,t.ok=!0),t}function en(e,n,r,i){let o,t=n;const l={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(i)l.str=i.str,l.marker=i.marker;else{if(t>=r)return l;let c=e.charCodeAt(t);if(c!==34&&c!==39&&c!==40)return l;n++,t++,c===40&&(c=41),l.marker=c}for(;t<r;){if(o=e.charCodeAt(t),o===l.marker)return l.pos=t+1,l.str+=D(e.slice(n,t)),l.ok=!0,l;if(o===40&&l.marker===41)return l;o===92&&t+1<r&&t++,t++}return l.can_continue=!0,l.str+=D(e.slice(n,t)),l}const nn=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:Ke,parseLinkLabel:Ye,parseLinkTitle:en},Symbol.toStringTag,{value:"Module"})),I={};I.code_inline=function(e,n,r,i,o){const t=e[n];return"<code"+o.renderAttrs(t)+">"+R(t.content)+"</code>"};I.code_block=function(e,n,r,i,o){const t=e[n];return"<pre"+o.renderAttrs(t)+"><code>"+R(e[n].content)+`</code></pre>
`};I.fence=function(e,n,r,i,o){const t=e[n],l=t.info?D(t.info).trim():"";let c="",s="";if(l){const h=l.split(/(\s+)/g);c=h[0],s=h.slice(2).join("")}let f;if(r.highlight?f=r.highlight(t.content,c,s)||R(t.content):f=R(t.content),f.indexOf("<pre")===0)return f+`
`;if(l){const h=t.attrIndex("class"),p=t.attrs?t.attrs.slice():[];h<0?p.push(["class",r.langPrefix+c]):(p[h]=p[h].slice(),p[h][1]+=" "+r.langPrefix+c);const k={attrs:p};return`<pre><code${o.renderAttrs(k)}>${f}</code></pre>
`}return`<pre><code${o.renderAttrs(t)}>${f}</code></pre>
`};I.image=function(e,n,r,i,o){const t=e[n];return t.attrs[t.attrIndex("alt")][1]=o.renderInlineAsText(t.children,r,i),o.renderToken(e,n,r)};I.hardbreak=function(e,n,r){return r.xhtmlOut?`<br />
`:`<br>
`};I.softbreak=function(e,n,r){return r.breaks?r.xhtmlOut?`<br />
`:`<br>
`:`
`};I.text=function(e,n){return R(e[n].content)};I.html_block=function(e,n){return e[n].content};I.html_inline=function(e,n){return e[n].content};function F(){this.rules=G({},I)}F.prototype.renderAttrs=function(n){let r,i,o;if(!n.attrs)return"";for(o="",r=0,i=n.attrs.length;r<i;r++)o+=" "+R(n.attrs[r][0])+'="'+R(n.attrs[r][1])+'"';return o};F.prototype.renderToken=function(n,r,i){const o=n[r];let t="";if(o.hidden)return"";o.block&&o.nesting!==-1&&r&&n[r-1].hidden&&(t+=`
`),t+=(o.nesting===-1?"</":"<")+o.tag,t+=this.renderAttrs(o),o.nesting===0&&i.xhtmlOut&&(t+=" /");let l=!1;if(o.block&&(l=!0,o.nesting===1&&r+1<n.length)){const c=n[r+1];(c.type==="inline"||c.hidden||c.nesting===-1&&c.tag===o.tag)&&(l=!1)}return t+=l?`>
`:">",t};F.prototype.renderInline=function(e,n,r){let i="";const o=this.rules;for(let t=0,l=e.length;t<l;t++){const c=e[t].type;typeof o[c]<"u"?i+=o[c](e,t,n,r,this):i+=this.renderToken(e,t,n)}return i};F.prototype.renderInlineAsText=function(e,n,r){let i="";for(let o=0,t=e.length;o<t;o++)switch(e[o].type){case"text":i+=e[o].content;break;case"image":i+=this.renderInlineAsText(e[o].children,n,r);break;case"html_inline":case"html_block":i+=e[o].content;break;case"softbreak":case"hardbreak":i+=`
`;break}return i};F.prototype.render=function(e,n,r){let i="";const o=this.rules;for(let t=0,l=e.length;t<l;t++){const c=e[t].type;c==="inline"?i+=this.renderInline(e[t].children,n,r):typeof o[c]<"u"?i+=o[c](e,t,n,r,this):i+=this.renderToken(e,t,n,r)}return i};function S(){this.__rules__=[],this.__cache__=null}S.prototype.__find__=function(e){for(let n=0;n<this.__rules__.length;n++)if(this.__rules__[n].name===e)return n;return-1};S.prototype.__compile__=function(){const e=this,n=[""];e.__rules__.forEach(function(r){r.enabled&&r.alt.forEach(function(i){n.indexOf(i)<0&&n.push(i)})}),e.__cache__={},n.forEach(function(r){e.__cache__[r]=[],e.__rules__.forEach(function(i){i.enabled&&(r&&i.alt.indexOf(r)<0||e.__cache__[r].push(i.fn))})})};S.prototype.at=function(e,n,r){const i=this.__find__(e),o=r||{};if(i===-1)throw new Error("Parser rule not found: "+e);this.__rules__[i].fn=n,this.__rules__[i].alt=o.alt||[],this.__cache__=null};S.prototype.before=function(e,n,r,i){const o=this.__find__(e),t=i||{};if(o===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(o,0,{name:n,enabled:!0,fn:r,alt:t.alt||[]}),this.__cache__=null};S.prototype.after=function(e,n,r,i){const o=this.__find__(e),t=i||{};if(o===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(o+1,0,{name:n,enabled:!0,fn:r,alt:t.alt||[]}),this.__cache__=null};S.prototype.push=function(e,n,r){const i=r||{};this.__rules__.push({name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null};S.prototype.enable=function(e,n){Array.isArray(e)||(e=[e]);const r=[];return e.forEach(function(i){const o=this.__find__(i);if(o<0){if(n)return;throw new Error("Rules manager: invalid rule name "+i)}this.__rules__[o].enabled=!0,r.push(i)},this),this.__cache__=null,r};S.prototype.enableOnly=function(e,n){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(r){r.enabled=!1}),this.enable(e,n)};S.prototype.disable=function(e,n){Array.isArray(e)||(e=[e]);const r=[];return e.forEach(function(i){const o=this.__find__(i);if(o<0){if(n)return;throw new Error("Rules manager: invalid rule name "+i)}this.__rules__[o].enabled=!1,r.push(i)},this),this.__cache__=null,r};S.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function T(e,n,r){this.type=e,this.tag=n,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}T.prototype.attrIndex=function(n){if(!this.attrs)return-1;const r=this.attrs;for(let i=0,o=r.length;i<o;i++)if(r[i][0]===n)return i;return-1};T.prototype.attrPush=function(n){this.attrs?this.attrs.push(n):this.attrs=[n]};T.prototype.attrSet=function(n,r){const i=this.attrIndex(n),o=[n,r];i<0?this.attrPush(o):this.attrs[i]=o};T.prototype.attrGet=function(n){const r=this.attrIndex(n);let i=null;return r>=0&&(i=this.attrs[r][1]),i};T.prototype.attrJoin=function(n,r){const i=this.attrIndex(n);i<0?this.attrPush([n,r]):this.attrs[i][1]=this.attrs[i][1]+" "+r};function be(e,n,r){this.src=e,this.env=r,this.tokens=[],this.inlineMode=!1,this.md=n}be.prototype.Token=T;const rn=/\r\n?|\n/g,on=/\0/g;function tn(e){let n;n=e.src.replace(rn,`
`),n=n.replace(on,"�"),e.src=n}function ln(e){let n;e.inlineMode?(n=new e.Token("inline","",0),n.content=e.src,n.map=[0,1],n.children=[],e.tokens.push(n)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function cn(e){const n=e.tokens;for(let r=0,i=n.length;r<i;r++){const o=n[r];o.type==="inline"&&e.md.inline.parse(o.content,e.md,e.env,o.children)}}function sn(e){return/^<a[>\s]/i.test(e)}function fn(e){return/^<\/a\s*>/i.test(e)}function un(e){const n=e.tokens;if(e.md.options.linkify)for(let r=0,i=n.length;r<i;r++){if(n[r].type!=="inline"||!e.md.linkify.pretest(n[r].content))continue;let o=n[r].children,t=0;for(let l=o.length-1;l>=0;l--){const c=o[l];if(c.type==="link_close"){for(l--;o[l].level!==c.level&&o[l].type!=="link_open";)l--;continue}if(c.type==="html_inline"&&(sn(c.content)&&t>0&&t--,fn(c.content)&&t++),!(t>0)&&c.type==="text"&&e.md.linkify.test(c.content)){const s=c.content;let f=e.md.linkify.match(s);const h=[];let p=c.level,k=0;f.length>0&&f[0].index===0&&l>0&&o[l-1].type==="text_special"&&(f=f.slice(1));for(let a=0;a<f.length;a++){const u=f[a].url,C=e.md.normalizeLink(u);if(!e.md.validateLink(C))continue;let _=f[a].text;f[a].schema?f[a].schema==="mailto:"&&!/^mailto:/i.test(_)?_=e.md.normalizeLinkText("mailto:"+_).replace(/^mailto:/,""):_=e.md.normalizeLinkText(_):_=e.md.normalizeLinkText("http://"+_).replace(/^http:\/\//,"");const y=f[a].index;if(y>k){const g=new e.Token("text","",0);g.content=s.slice(k,y),g.level=p,h.push(g)}const d=new e.Token("link_open","a",1);d.attrs=[["href",C]],d.level=p++,d.markup="linkify",d.info="auto",h.push(d);const x=new e.Token("text","",0);x.content=_,x.level=p,h.push(x);const m=new e.Token("link_close","a",-1);m.level=--p,m.markup="linkify",m.info="auto",h.push(m),k=f[a].lastIndex}if(k<s.length){const a=new e.Token("text","",0);a.content=s.slice(k),a.level=p,h.push(a)}n[r].children=o=ge(o,l,h)}}}}const Ce=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,hn=/\((c|tm|r)\)/i,pn=/\((c|tm|r)\)/ig,an={c:"©",r:"®",tm:"™"};function kn(e,n){return an[n.toLowerCase()]}function dn(e){let n=0;for(let r=e.length-1;r>=0;r--){const i=e[r];i.type==="text"&&!n&&(i.content=i.content.replace(pn,kn)),i.type==="link_open"&&i.info==="auto"&&n--,i.type==="link_close"&&i.info==="auto"&&n++}}function mn(e){let n=0;for(let r=e.length-1;r>=0;r--){const i=e[r];i.type==="text"&&!n&&Ce.test(i.content)&&(i.content=i.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),i.type==="link_open"&&i.info==="auto"&&n--,i.type==="link_close"&&i.info==="auto"&&n++}}function xn(e){let n;if(e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type==="inline"&&(hn.test(e.tokens[n].content)&&dn(e.tokens[n].children),Ce.test(e.tokens[n].content)&&mn(e.tokens[n].children))}const gn=/['"]/,le=/['"]/g,ce="’";function Z(e,n,r){return e.slice(0,n)+r+e.slice(n+1)}function _n(e,n){let r;const i=[];for(let o=0;o<e.length;o++){const t=e[o],l=e[o].level;for(r=i.length-1;r>=0&&!(i[r].level<=l);r--);if(i.length=r+1,t.type!=="text")continue;let c=t.content,s=0,f=c.length;e:for(;s<f;){le.lastIndex=s;const h=le.exec(c);if(!h)break;let p=!0,k=!0;s=h.index+1;const a=h[0]==="'";let u=32;if(h.index-1>=0)u=c.charCodeAt(h.index-1);else for(r=o-1;r>=0&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r--)if(e[r].content){u=e[r].content.charCodeAt(e[r].content.length-1);break}let C=32;if(s<f)C=c.charCodeAt(s);else for(r=o+1;r<e.length&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r++)if(e[r].content){C=e[r].content.charCodeAt(0);break}const _=j(u)||B(String.fromCharCode(u)),y=j(C)||B(String.fromCharCode(C)),d=$(u),x=$(C);if(x?p=!1:y&&(d||_||(p=!1)),d?k=!1:_&&(x||y||(k=!1)),C===34&&h[0]==='"'&&u>=48&&u<=57&&(k=p=!1),p&&k&&(p=_,k=y),!p&&!k){a&&(t.content=Z(t.content,h.index,ce));continue}if(k)for(r=i.length-1;r>=0;r--){let m=i[r];if(i[r].level<l)break;if(m.single===a&&i[r].level===l){m=i[r];let g,b;a?(g=n.md.options.quotes[2],b=n.md.options.quotes[3]):(g=n.md.options.quotes[0],b=n.md.options.quotes[1]),t.content=Z(t.content,h.index,b),e[m.token].content=Z(e[m.token].content,m.pos,g),s+=b.length-1,m.token===o&&(s+=g.length-1),c=t.content,f=c.length,i.length=r;continue e}}p?i.push({token:o,pos:h.index,single:a,level:l}):k&&a&&(t.content=Z(t.content,h.index,ce))}}}function bn(e){if(e.md.options.typographer)for(let n=e.tokens.length-1;n>=0;n--)e.tokens[n].type!=="inline"||!gn.test(e.tokens[n].content)||_n(e.tokens[n].children,e)}function Cn(e){let n,r;const i=e.tokens,o=i.length;for(let t=0;t<o;t++){if(i[t].type!=="inline")continue;const l=i[t].children,c=l.length;for(n=0;n<c;n++)l[n].type==="text_special"&&(l[n].type="text");for(n=r=0;n<c;n++)l[n].type==="text"&&n+1<c&&l[n+1].type==="text"?l[n+1].content=l[n].content+l[n+1].content:(n!==r&&(l[r]=l[n]),r++);n!==r&&(l.length=r)}}const V=[["normalize",tn],["block",ln],["inline",cn],["linkify",un],["replacements",xn],["smartquotes",bn],["text_join",Cn]];function re(){this.ruler=new S;for(let e=0;e<V.length;e++)this.ruler.push(V[e][0],V[e][1])}re.prototype.process=function(e){const n=this.ruler.getRules("");for(let r=0,i=n.length;r<i;r++)n[r](e)};re.prototype.State=be;function v(e,n,r,i){this.src=e,this.md=n,this.env=r,this.tokens=i,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const o=this.src;for(let t=0,l=0,c=0,s=0,f=o.length,h=!1;l<f;l++){const p=o.charCodeAt(l);if(!h)if(A(p)){c++,p===9?s+=4-s%4:s++;continue}else h=!0;(p===10||l===f-1)&&(p!==10&&l++,this.bMarks.push(t),this.eMarks.push(l),this.tShift.push(c),this.sCount.push(s),this.bsCount.push(0),h=!1,c=0,s=0,t=l+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}v.prototype.push=function(e,n,r){const i=new T(e,n,r);return i.block=!0,r<0&&this.level--,i.level=this.level,r>0&&this.level++,this.tokens.push(i),i};v.prototype.isEmpty=function(n){return this.bMarks[n]+this.tShift[n]>=this.eMarks[n]};v.prototype.skipEmptyLines=function(n){for(let r=this.lineMax;n<r&&!(this.bMarks[n]+this.tShift[n]<this.eMarks[n]);n++);return n};v.prototype.skipSpaces=function(n){for(let r=this.src.length;n<r;n++){const i=this.src.charCodeAt(n);if(!A(i))break}return n};v.prototype.skipSpacesBack=function(n,r){if(n<=r)return n;for(;n>r;)if(!A(this.src.charCodeAt(--n)))return n+1;return n};v.prototype.skipChars=function(n,r){for(let i=this.src.length;n<i&&this.src.charCodeAt(n)===r;n++);return n};v.prototype.skipCharsBack=function(n,r,i){if(n<=i)return n;for(;n>i;)if(r!==this.src.charCodeAt(--n))return n+1;return n};v.prototype.getLines=function(n,r,i,o){if(n>=r)return"";const t=new Array(r-n);for(let l=0,c=n;c<r;c++,l++){let s=0;const f=this.bMarks[c];let h=f,p;for(c+1<r||o?p=this.eMarks[c]+1:p=this.eMarks[c];h<p&&s<i;){const k=this.src.charCodeAt(h);if(A(k))k===9?s+=4-(s+this.bsCount[c])%4:s++;else if(h-f<this.tShift[c])s++;else break;h++}s>i?t[l]=new Array(s-i+1).join(" ")+this.src.slice(h,p):t[l]=this.src.slice(h,p)}return t.join("")};v.prototype.Token=T;const An=65536;function X(e,n){const r=e.bMarks[n]+e.tShift[n],i=e.eMarks[n];return e.src.slice(r,i)}function se(e){const n=[],r=e.length;let i=0,o=e.charCodeAt(i),t=!1,l=0,c="";for(;i<r;)o===124&&(t?(c+=e.substring(l,i-1),l=i):(n.push(c+e.substring(l,i)),c="",l=i+1)),t=o===92,i++,o=e.charCodeAt(i);return n.push(c+e.substring(l)),n}function yn(e,n,r,i){if(n+2>r)return!1;let o=n+1;if(e.sCount[o]<e.blkIndent||e.sCount[o]-e.blkIndent>=4)return!1;let t=e.bMarks[o]+e.tShift[o];if(t>=e.eMarks[o])return!1;const l=e.src.charCodeAt(t++);if(l!==124&&l!==45&&l!==58||t>=e.eMarks[o])return!1;const c=e.src.charCodeAt(t++);if(c!==124&&c!==45&&c!==58&&!A(c)||l===45&&A(c))return!1;for(;t<e.eMarks[o];){const m=e.src.charCodeAt(t);if(m!==124&&m!==45&&m!==58&&!A(m))return!1;t++}let s=X(e,n+1),f=s.split("|");const h=[];for(let m=0;m<f.length;m++){const g=f[m].trim();if(!g){if(m===0||m===f.length-1)continue;return!1}if(!/^:?-+:?$/.test(g))return!1;g.charCodeAt(g.length-1)===58?h.push(g.charCodeAt(0)===58?"center":"right"):g.charCodeAt(0)===58?h.push("left"):h.push("")}if(s=X(e,n).trim(),s.indexOf("|")===-1||e.sCount[n]-e.blkIndent>=4)return!1;f=se(s),f.length&&f[0]===""&&f.shift(),f.length&&f[f.length-1]===""&&f.pop();const p=f.length;if(p===0||p!==h.length)return!1;if(i)return!0;const k=e.parentType;e.parentType="table";const a=e.md.block.ruler.getRules("blockquote"),u=e.push("table_open","table",1),C=[n,0];u.map=C;const _=e.push("thead_open","thead",1);_.map=[n,n+1];const y=e.push("tr_open","tr",1);y.map=[n,n+1];for(let m=0;m<f.length;m++){const g=e.push("th_open","th",1);h[m]&&(g.attrs=[["style","text-align:"+h[m]]]);const b=e.push("inline","",0);b.content=f[m].trim(),b.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let d,x=0;for(o=n+2;o<r&&!(e.sCount[o]<e.blkIndent);o++){let m=!1;for(let b=0,E=a.length;b<E;b++)if(a[b](e,o,r,!0)){m=!0;break}if(m||(s=X(e,o).trim(),!s)||e.sCount[o]-e.blkIndent>=4||(f=se(s),f.length&&f[0]===""&&f.shift(),f.length&&f[f.length-1]===""&&f.pop(),x+=p-f.length,x>An))break;if(o===n+2){const b=e.push("tbody_open","tbody",1);b.map=d=[n+2,0]}const g=e.push("tr_open","tr",1);g.map=[o,o+1];for(let b=0;b<p;b++){const E=e.push("td_open","td",1);h[b]&&(E.attrs=[["style","text-align:"+h[b]]]);const M=e.push("inline","",0);M.content=f[b]?f[b].trim():"",M.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return d&&(e.push("tbody_close","tbody",-1),d[1]=o),e.push("table_close","table",-1),C[1]=o,e.parentType=k,e.line=o,!0}function En(e,n,r){if(e.sCount[n]-e.blkIndent<4)return!1;let i=n+1,o=i;for(;i<r;){if(e.isEmpty(i)){i++;continue}if(e.sCount[i]-e.blkIndent>=4){i++,o=i;continue}break}e.line=o;const t=e.push("code_block","code",0);return t.content=e.getLines(n,o,4+e.blkIndent,!1)+`
`,t.map=[n,e.line],!0}function Sn(e,n,r,i){let o=e.bMarks[n]+e.tShift[n],t=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||o+3>t)return!1;const l=e.src.charCodeAt(o);if(l!==126&&l!==96)return!1;let c=o;o=e.skipChars(o,l);let s=o-c;if(s<3)return!1;const f=e.src.slice(c,o),h=e.src.slice(o,t);if(l===96&&h.indexOf(String.fromCharCode(l))>=0)return!1;if(i)return!0;let p=n,k=!1;for(;p++,!(p>=r||(o=c=e.bMarks[p]+e.tShift[p],t=e.eMarks[p],o<t&&e.sCount[p]<e.blkIndent));)if(e.src.charCodeAt(o)===l&&!(e.sCount[p]-e.blkIndent>=4)&&(o=e.skipChars(o,l),!(o-c<s)&&(o=e.skipSpaces(o),!(o<t)))){k=!0;break}s=e.sCount[n],e.line=p+(k?1:0);const a=e.push("fence","code",0);return a.info=h,a.content=e.getLines(n+1,p,s,!0),a.markup=f,a.map=[n,e.line],!0}function Mn(e,n,r,i){let o=e.bMarks[n]+e.tShift[n],t=e.eMarks[n];const l=e.lineMax;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(o)!==62)return!1;if(i)return!0;const c=[],s=[],f=[],h=[],p=e.md.block.ruler.getRules("blockquote"),k=e.parentType;e.parentType="blockquote";let a=!1,u;for(u=n;u<r;u++){const x=e.sCount[u]<e.blkIndent;if(o=e.bMarks[u]+e.tShift[u],t=e.eMarks[u],o>=t)break;if(e.src.charCodeAt(o++)===62&&!x){let g=e.sCount[u]+1,b,E;e.src.charCodeAt(o)===32?(o++,g++,E=!1,b=!0):e.src.charCodeAt(o)===9?(b=!0,(e.bsCount[u]+g)%4===3?(o++,g++,E=!1):E=!0):b=!1;let M=g;for(c.push(e.bMarks[u]),e.bMarks[u]=o;o<t;){const P=e.src.charCodeAt(o);if(A(P))P===9?M+=4-(M+e.bsCount[u]+(E?1:0))%4:M++;else break;o++}a=o>=t,s.push(e.bsCount[u]),e.bsCount[u]=e.sCount[u]+1+(b?1:0),f.push(e.sCount[u]),e.sCount[u]=M-g,h.push(e.tShift[u]),e.tShift[u]=o-e.bMarks[u];continue}if(a)break;let m=!1;for(let g=0,b=p.length;g<b;g++)if(p[g](e,u,r,!0)){m=!0;break}if(m){e.lineMax=u,e.blkIndent!==0&&(c.push(e.bMarks[u]),s.push(e.bsCount[u]),h.push(e.tShift[u]),f.push(e.sCount[u]),e.sCount[u]-=e.blkIndent);break}c.push(e.bMarks[u]),s.push(e.bsCount[u]),h.push(e.tShift[u]),f.push(e.sCount[u]),e.sCount[u]=-1}const C=e.blkIndent;e.blkIndent=0;const _=e.push("blockquote_open","blockquote",1);_.markup=">";const y=[n,0];_.map=y,e.md.block.tokenize(e,n,u);const d=e.push("blockquote_close","blockquote",-1);d.markup=">",e.lineMax=l,e.parentType=k,y[1]=e.line;for(let x=0;x<h.length;x++)e.bMarks[x+n]=c[x],e.tShift[x+n]=h[x],e.sCount[x+n]=f[x],e.bsCount[x+n]=s[x];return e.blkIndent=C,!0}function wn(e,n,r,i){const o=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4)return!1;let t=e.bMarks[n]+e.tShift[n];const l=e.src.charCodeAt(t++);if(l!==42&&l!==45&&l!==95)return!1;let c=1;for(;t<o;){const f=e.src.charCodeAt(t++);if(f!==l&&!A(f))return!1;f===l&&c++}if(c<3)return!1;if(i)return!0;e.line=n+1;const s=e.push("hr","hr",0);return s.map=[n,e.line],s.markup=Array(c+1).join(String.fromCharCode(l)),!0}function fe(e,n){const r=e.eMarks[n];let i=e.bMarks[n]+e.tShift[n];const o=e.src.charCodeAt(i++);if(o!==42&&o!==45&&o!==43)return-1;if(i<r){const t=e.src.charCodeAt(i);if(!A(t))return-1}return i}function ue(e,n){const r=e.bMarks[n]+e.tShift[n],i=e.eMarks[n];let o=r;if(o+1>=i)return-1;let t=e.src.charCodeAt(o++);if(t<48||t>57)return-1;for(;;){if(o>=i)return-1;if(t=e.src.charCodeAt(o++),t>=48&&t<=57){if(o-r>=10)return-1;continue}if(t===41||t===46)break;return-1}return o<i&&(t=e.src.charCodeAt(o),!A(t))?-1:o}function Tn(e,n){const r=e.level+2;for(let i=n+2,o=e.tokens.length-2;i<o;i++)e.tokens[i].level===r&&e.tokens[i].type==="paragraph_open"&&(e.tokens[i+2].hidden=!0,e.tokens[i].hidden=!0,i+=2)}function In(e,n,r,i){let o,t,l,c,s=n,f=!0;if(e.sCount[s]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&e.sCount[s]<e.blkIndent)return!1;let h=!1;i&&e.parentType==="paragraph"&&e.sCount[s]>=e.blkIndent&&(h=!0);let p,k,a;if((a=ue(e,s))>=0){if(p=!0,l=e.bMarks[s]+e.tShift[s],k=Number(e.src.slice(l,a-1)),h&&k!==1)return!1}else if((a=fe(e,s))>=0)p=!1;else return!1;if(h&&e.skipSpaces(a)>=e.eMarks[s])return!1;if(i)return!0;const u=e.src.charCodeAt(a-1),C=e.tokens.length;p?(c=e.push("ordered_list_open","ol",1),k!==1&&(c.attrs=[["start",k]])):c=e.push("bullet_list_open","ul",1);const _=[s,0];c.map=_,c.markup=String.fromCharCode(u);let y=!1;const d=e.md.block.ruler.getRules("list"),x=e.parentType;for(e.parentType="list";s<r;){t=a,o=e.eMarks[s];const m=e.sCount[s]+a-(e.bMarks[s]+e.tShift[s]);let g=m;for(;t<o;){const z=e.src.charCodeAt(t);if(z===9)g+=4-(g+e.bsCount[s])%4;else if(z===32)g++;else break;t++}const b=t;let E;b>=o?E=1:E=g-m,E>4&&(E=1);const M=m+E;c=e.push("list_item_open","li",1),c.markup=String.fromCharCode(u);const P=[s,0];c.map=P,p&&(c.info=e.src.slice(l,a-1));const L=e.tight,J=e.tShift[s],we=e.sCount[s],Te=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=M,e.tight=!0,e.tShift[s]=b-e.bMarks[s],e.sCount[s]=g,b>=o&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,s,r,!0),(!e.tight||y)&&(f=!1),y=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=Te,e.tShift[s]=J,e.sCount[s]=we,e.tight=L,c=e.push("list_item_close","li",-1),c.markup=String.fromCharCode(u),s=e.line,P[1]=s,s>=r||e.sCount[s]<e.blkIndent||e.sCount[s]-e.blkIndent>=4)break;let te=!1;for(let z=0,Ie=d.length;z<Ie;z++)if(d[z](e,s,r,!0)){te=!0;break}if(te)break;if(p){if(a=ue(e,s),a<0)break;l=e.bMarks[s]+e.tShift[s]}else if(a=fe(e,s),a<0)break;if(u!==e.src.charCodeAt(a-1))break}return p?c=e.push("ordered_list_close","ol",-1):c=e.push("bullet_list_close","ul",-1),c.markup=String.fromCharCode(u),_[1]=s,e.line=s,e.parentType=x,f&&Tn(e,C),!0}function vn(e,n,r,i){let o=e.bMarks[n]+e.tShift[n],t=e.eMarks[n],l=n+1;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(o)!==91)return!1;function c(d){const x=e.lineMax;if(d>=x||e.isEmpty(d))return null;let m=!1;if(e.sCount[d]-e.blkIndent>3&&(m=!0),e.sCount[d]<0&&(m=!0),!m){const E=e.md.block.ruler.getRules("reference"),M=e.parentType;e.parentType="reference";let P=!1;for(let L=0,J=E.length;L<J;L++)if(E[L](e,d,x,!0)){P=!0;break}if(e.parentType=M,P)return null}const g=e.bMarks[d]+e.tShift[d],b=e.eMarks[d];return e.src.slice(g,b+1)}let s=e.src.slice(o,t+1);t=s.length;let f=-1;for(o=1;o<t;o++){const d=s.charCodeAt(o);if(d===91)return!1;if(d===93){f=o;break}else if(d===10){const x=c(l);x!==null&&(s+=x,t=s.length,l++)}else if(d===92&&(o++,o<t&&s.charCodeAt(o)===10)){const x=c(l);x!==null&&(s+=x,t=s.length,l++)}}if(f<0||s.charCodeAt(f+1)!==58)return!1;for(o=f+2;o<t;o++){const d=s.charCodeAt(o);if(d===10){const x=c(l);x!==null&&(s+=x,t=s.length,l++)}else if(!A(d))break}const h=e.md.helpers.parseLinkDestination(s,o,t);if(!h.ok)return!1;const p=e.md.normalizeLink(h.str);if(!e.md.validateLink(p))return!1;o=h.pos;const k=o,a=l,u=o;for(;o<t;o++){const d=s.charCodeAt(o);if(d===10){const x=c(l);x!==null&&(s+=x,t=s.length,l++)}else if(!A(d))break}let C=e.md.helpers.parseLinkTitle(s,o,t);for(;C.can_continue;){const d=c(l);if(d===null)break;s+=d,o=t,t=s.length,l++,C=e.md.helpers.parseLinkTitle(s,o,t,C)}let _;for(o<t&&u!==o&&C.ok?(_=C.str,o=C.pos):(_="",o=k,l=a);o<t;){const d=s.charCodeAt(o);if(!A(d))break;o++}if(o<t&&s.charCodeAt(o)!==10&&_)for(_="",o=k,l=a;o<t;){const d=s.charCodeAt(o);if(!A(d))break;o++}if(o<t&&s.charCodeAt(o)!==10)return!1;const y=W(s.slice(1,f));return y?(i||(typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[y]>"u"&&(e.env.references[y]={title:_,href:p}),e.line=l),!0):!1}const Pn=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Rn="[a-zA-Z_:][a-zA-Z0-9:._-]*",zn="[^\"'=<>`\\x00-\\x20]+",On="'[^']*'",Dn='"[^"]*"',Fn="(?:"+zn+"|"+On+"|"+Dn+")",Ln="(?:\\s+"+Rn+"(?:\\s*=\\s*"+Fn+")?)",Ae="<[A-Za-z][A-Za-z0-9\\-]*"+Ln+"*\\s*\\/?>",ye="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",$n="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",Bn="<[?][\\s\\S]*?[?]>",jn="<![A-Za-z][^>]*>",qn="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",Nn=new RegExp("^(?:"+Ae+"|"+ye+"|"+$n+"|"+Bn+"|"+jn+"|"+qn+")"),Zn=new RegExp("^(?:"+Ae+"|"+ye+")"),O=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+Pn.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(Zn.source+"\\s*$"),/^$/,!1]];function Un(e,n,r,i){let o=e.bMarks[n]+e.tShift[n],t=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(o)!==60)return!1;let l=e.src.slice(o,t),c=0;for(;c<O.length&&!O[c][0].test(l);c++);if(c===O.length)return!1;if(i)return O[c][2];let s=n+1;if(!O[c][1].test(l)){for(;s<r&&!(e.sCount[s]<e.blkIndent);s++)if(o=e.bMarks[s]+e.tShift[s],t=e.eMarks[s],l=e.src.slice(o,t),O[c][1].test(l)){l.length!==0&&s++;break}}e.line=s;const f=e.push("html_block","",0);return f.map=[n,s],f.content=e.getLines(n,s,e.blkIndent,!0),!0}function Hn(e,n,r,i){let o=e.bMarks[n]+e.tShift[n],t=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4)return!1;let l=e.src.charCodeAt(o);if(l!==35||o>=t)return!1;let c=1;for(l=e.src.charCodeAt(++o);l===35&&o<t&&c<=6;)c++,l=e.src.charCodeAt(++o);if(c>6||o<t&&!A(l))return!1;if(i)return!0;t=e.skipSpacesBack(t,o);const s=e.skipCharsBack(t,35,o);s>o&&A(e.src.charCodeAt(s-1))&&(t=s),e.line=n+1;const f=e.push("heading_open","h"+String(c),1);f.markup="########".slice(0,c),f.map=[n,e.line];const h=e.push("inline","",0);h.content=e.src.slice(o,t).trim(),h.map=[n,e.line],h.children=[];const p=e.push("heading_close","h"+String(c),-1);return p.markup="########".slice(0,c),!0}function Gn(e,n,r){const i=e.md.block.ruler.getRules("paragraph");if(e.sCount[n]-e.blkIndent>=4)return!1;const o=e.parentType;e.parentType="paragraph";let t=0,l,c=n+1;for(;c<r&&!e.isEmpty(c);c++){if(e.sCount[c]-e.blkIndent>3)continue;if(e.sCount[c]>=e.blkIndent){let a=e.bMarks[c]+e.tShift[c];const u=e.eMarks[c];if(a<u&&(l=e.src.charCodeAt(a),(l===45||l===61)&&(a=e.skipChars(a,l),a=e.skipSpaces(a),a>=u))){t=l===61?1:2;break}}if(e.sCount[c]<0)continue;let k=!1;for(let a=0,u=i.length;a<u;a++)if(i[a](e,c,r,!0)){k=!0;break}if(k)break}if(!t)return!1;const s=e.getLines(n,c,e.blkIndent,!1).trim();e.line=c+1;const f=e.push("heading_open","h"+String(t),1);f.markup=String.fromCharCode(l),f.map=[n,e.line];const h=e.push("inline","",0);h.content=s,h.map=[n,e.line-1],h.children=[];const p=e.push("heading_close","h"+String(t),-1);return p.markup=String.fromCharCode(l),e.parentType=o,!0}function Wn(e,n,r){const i=e.md.block.ruler.getRules("paragraph"),o=e.parentType;let t=n+1;for(e.parentType="paragraph";t<r&&!e.isEmpty(t);t++){if(e.sCount[t]-e.blkIndent>3||e.sCount[t]<0)continue;let f=!1;for(let h=0,p=i.length;h<p;h++)if(i[h](e,t,r,!0)){f=!0;break}if(f)break}const l=e.getLines(n,t,e.blkIndent,!1).trim();e.line=t;const c=e.push("paragraph_open","p",1);c.map=[n,e.line];const s=e.push("inline","",0);return s.content=l,s.map=[n,e.line],s.children=[],e.push("paragraph_close","p",-1),e.parentType=o,!0}const U=[["table",yn,["paragraph","reference"]],["code",En],["fence",Sn,["paragraph","reference","blockquote","list"]],["blockquote",Mn,["paragraph","reference","blockquote","list"]],["hr",wn,["paragraph","reference","blockquote","list"]],["list",In,["paragraph","reference","blockquote"]],["reference",vn],["html_block",Un,["paragraph","reference","blockquote"]],["heading",Hn,["paragraph","reference","blockquote"]],["lheading",Gn],["paragraph",Wn]];function Q(){this.ruler=new S;for(let e=0;e<U.length;e++)this.ruler.push(U[e][0],U[e][1],{alt:(U[e][2]||[]).slice()})}Q.prototype.tokenize=function(e,n,r){const i=this.ruler.getRules(""),o=i.length,t=e.md.options.maxNesting;let l=n,c=!1;for(;l<r&&(e.line=l=e.skipEmptyLines(l),!(l>=r||e.sCount[l]<e.blkIndent));){if(e.level>=t){e.line=r;break}const s=e.line;let f=!1;for(let h=0;h<o;h++)if(f=i[h](e,l,r,!1),f){if(s>=e.line)throw new Error("block rule didn't increment state.line");break}if(!f)throw new Error("none of the block rules matched");e.tight=!c,e.isEmpty(e.line-1)&&(c=!0),l=e.line,l<r&&e.isEmpty(l)&&(c=!0,l++,e.line=l)}};Q.prototype.parse=function(e,n,r,i){if(!e)return;const o=new this.State(e,n,r,i);this.tokenize(o,o.line,o.lineMax)};Q.prototype.State=v;function q(e,n,r,i){this.src=e,this.env=r,this.md=n,this.tokens=i,this.tokens_meta=Array(i.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}q.prototype.pushPending=function(){const e=new T("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e};q.prototype.push=function(e,n,r){this.pending&&this.pushPending();const i=new T(e,n,r);let o=null;return r<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),i.level=this.level,r>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(i),this.tokens_meta.push(o),i};q.prototype.scanDelims=function(e,n){const r=this.posMax,i=this.src.charCodeAt(e),o=e>0?this.src.charCodeAt(e-1):32;let t=e;for(;t<r&&this.src.charCodeAt(t)===i;)t++;const l=t-e,c=t<r?this.src.charCodeAt(t):32,s=j(o)||B(String.fromCharCode(o)),f=j(c)||B(String.fromCharCode(c)),h=$(o),p=$(c),k=!p&&(!f||h||s),a=!h&&(!s||p||f);return{can_open:k&&(n||!a||s),can_close:a&&(n||!k||f),length:l}};q.prototype.Token=T;function Qn(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Jn(e,n){let r=e.pos;for(;r<e.posMax&&!Qn(e.src.charCodeAt(r));)r++;return r===e.pos?!1:(n||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)}const Vn=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Xn(e,n){if(!e.md.options.linkify||e.linkLevel>0)return!1;const r=e.pos,i=e.posMax;if(r+3>i||e.src.charCodeAt(r)!==58||e.src.charCodeAt(r+1)!==47||e.src.charCodeAt(r+2)!==47)return!1;const o=e.pending.match(Vn);if(!o)return!1;const t=o[1],l=e.md.linkify.matchAtStart(e.src.slice(r-t.length));if(!l)return!1;let c=l.url;if(c.length<=t.length)return!1;c=c.replace(/\*+$/,"");const s=e.md.normalizeLink(c);if(!e.md.validateLink(s))return!1;if(!n){e.pending=e.pending.slice(0,-t.length);const f=e.push("link_open","a",1);f.attrs=[["href",s]],f.markup="linkify",f.info="auto";const h=e.push("text","",0);h.content=e.md.normalizeLinkText(c);const p=e.push("link_close","a",-1);p.markup="linkify",p.info="auto"}return e.pos+=c.length-t.length,!0}function Yn(e,n){let r=e.pos;if(e.src.charCodeAt(r)!==10)return!1;const i=e.pending.length-1,o=e.posMax;if(!n)if(i>=0&&e.pending.charCodeAt(i)===32)if(i>=1&&e.pending.charCodeAt(i-1)===32){let t=i-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(r++;r<o&&A(e.src.charCodeAt(r));)r++;return e.pos=r,!0}const oe=[];for(let e=0;e<256;e++)oe.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){oe[e.charCodeAt(0)]=1});function Kn(e,n){let r=e.pos;const i=e.posMax;if(e.src.charCodeAt(r)!==92||(r++,r>=i))return!1;let o=e.src.charCodeAt(r);if(o===10){for(n||e.push("hardbreak","br",0),r++;r<i&&(o=e.src.charCodeAt(r),!!A(o));)r++;return e.pos=r,!0}let t=e.src[r];if(o>=55296&&o<=56319&&r+1<i){const c=e.src.charCodeAt(r+1);c>=56320&&c<=57343&&(t+=e.src[r+1],r++)}const l="\\"+t;if(!n){const c=e.push("text_special","",0);o<256&&oe[o]!==0?c.content=t:c.content=l,c.markup=l,c.info="escape"}return e.pos=r+1,!0}function er(e,n){let r=e.pos;if(e.src.charCodeAt(r)!==96)return!1;const o=r;r++;const t=e.posMax;for(;r<t&&e.src.charCodeAt(r)===96;)r++;const l=e.src.slice(o,r),c=l.length;if(e.backticksScanned&&(e.backticks[c]||0)<=o)return n||(e.pending+=l),e.pos+=c,!0;let s=r,f;for(;(f=e.src.indexOf("`",s))!==-1;){for(s=f+1;s<t&&e.src.charCodeAt(s)===96;)s++;const h=s-f;if(h===c){if(!n){const p=e.push("code_inline","code",0);p.markup=l,p.content=e.src.slice(r,f).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=s,!0}e.backticks[h]=f}return e.backticksScanned=!0,n||(e.pending+=l),e.pos+=c,!0}function nr(e,n){const r=e.pos,i=e.src.charCodeAt(r);if(n||i!==126)return!1;const o=e.scanDelims(e.pos,!0);let t=o.length;const l=String.fromCharCode(i);if(t<2)return!1;let c;t%2&&(c=e.push("text","",0),c.content=l,t--);for(let s=0;s<t;s+=2)c=e.push("text","",0),c.content=l+l,e.delimiters.push({marker:i,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function he(e,n){let r;const i=[],o=n.length;for(let t=0;t<o;t++){const l=n[t];if(l.marker!==126||l.end===-1)continue;const c=n[l.end];r=e.tokens[l.token],r.type="s_open",r.tag="s",r.nesting=1,r.markup="~~",r.content="",r=e.tokens[c.token],r.type="s_close",r.tag="s",r.nesting=-1,r.markup="~~",r.content="",e.tokens[c.token-1].type==="text"&&e.tokens[c.token-1].content==="~"&&i.push(c.token-1)}for(;i.length;){const t=i.pop();let l=t+1;for(;l<e.tokens.length&&e.tokens[l].type==="s_close";)l++;l--,t!==l&&(r=e.tokens[l],e.tokens[l]=e.tokens[t],e.tokens[t]=r)}}function rr(e){const n=e.tokens_meta,r=e.tokens_meta.length;he(e,e.delimiters);for(let i=0;i<r;i++)n[i]&&n[i].delimiters&&he(e,n[i].delimiters)}const Ee={tokenize:nr,postProcess:rr};function or(e,n){const r=e.pos,i=e.src.charCodeAt(r);if(n||i!==95&&i!==42)return!1;const o=e.scanDelims(e.pos,i===42);for(let t=0;t<o.length;t++){const l=e.push("text","",0);l.content=String.fromCharCode(i),e.delimiters.push({marker:i,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close})}return e.pos+=o.length,!0}function pe(e,n){const r=n.length;for(let i=r-1;i>=0;i--){const o=n[i];if(o.marker!==95&&o.marker!==42||o.end===-1)continue;const t=n[o.end],l=i>0&&n[i-1].end===o.end+1&&n[i-1].marker===o.marker&&n[i-1].token===o.token-1&&n[o.end+1].token===t.token+1,c=String.fromCharCode(o.marker),s=e.tokens[o.token];s.type=l?"strong_open":"em_open",s.tag=l?"strong":"em",s.nesting=1,s.markup=l?c+c:c,s.content="";const f=e.tokens[t.token];f.type=l?"strong_close":"em_close",f.tag=l?"strong":"em",f.nesting=-1,f.markup=l?c+c:c,f.content="",l&&(e.tokens[n[i-1].token].content="",e.tokens[n[o.end+1].token].content="",i--)}}function tr(e){const n=e.tokens_meta,r=e.tokens_meta.length;pe(e,e.delimiters);for(let i=0;i<r;i++)n[i]&&n[i].delimiters&&pe(e,n[i].delimiters)}const Se={tokenize:or,postProcess:tr};function ir(e,n){let r,i,o,t,l="",c="",s=e.pos,f=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const h=e.pos,p=e.posMax,k=e.pos+1,a=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(a<0)return!1;let u=a+1;if(u<p&&e.src.charCodeAt(u)===40){for(f=!1,u++;u<p&&(r=e.src.charCodeAt(u),!(!A(r)&&r!==10));u++);if(u>=p)return!1;if(s=u,o=e.md.helpers.parseLinkDestination(e.src,u,e.posMax),o.ok){for(l=e.md.normalizeLink(o.str),e.md.validateLink(l)?u=o.pos:l="",s=u;u<p&&(r=e.src.charCodeAt(u),!(!A(r)&&r!==10));u++);if(o=e.md.helpers.parseLinkTitle(e.src,u,e.posMax),u<p&&s!==u&&o.ok)for(c=o.str,u=o.pos;u<p&&(r=e.src.charCodeAt(u),!(!A(r)&&r!==10));u++);}(u>=p||e.src.charCodeAt(u)!==41)&&(f=!0),u++}if(f){if(typeof e.env.references>"u")return!1;if(u<p&&e.src.charCodeAt(u)===91?(s=u+1,u=e.md.helpers.parseLinkLabel(e,u),u>=0?i=e.src.slice(s,u++):u=a+1):u=a+1,i||(i=e.src.slice(k,a)),t=e.env.references[W(i)],!t)return e.pos=h,!1;l=t.href,c=t.title}if(!n){e.pos=k,e.posMax=a;const C=e.push("link_open","a",1),_=[["href",l]];C.attrs=_,c&&_.push(["title",c]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=u,e.posMax=p,!0}function lr(e,n){let r,i,o,t,l,c,s,f,h="";const p=e.pos,k=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const a=e.pos+2,u=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(u<0)return!1;if(t=u+1,t<k&&e.src.charCodeAt(t)===40){for(t++;t<k&&(r=e.src.charCodeAt(t),!(!A(r)&&r!==10));t++);if(t>=k)return!1;for(f=t,c=e.md.helpers.parseLinkDestination(e.src,t,e.posMax),c.ok&&(h=e.md.normalizeLink(c.str),e.md.validateLink(h)?t=c.pos:h=""),f=t;t<k&&(r=e.src.charCodeAt(t),!(!A(r)&&r!==10));t++);if(c=e.md.helpers.parseLinkTitle(e.src,t,e.posMax),t<k&&f!==t&&c.ok)for(s=c.str,t=c.pos;t<k&&(r=e.src.charCodeAt(t),!(!A(r)&&r!==10));t++);else s="";if(t>=k||e.src.charCodeAt(t)!==41)return e.pos=p,!1;t++}else{if(typeof e.env.references>"u")return!1;if(t<k&&e.src.charCodeAt(t)===91?(f=t+1,t=e.md.helpers.parseLinkLabel(e,t),t>=0?o=e.src.slice(f,t++):t=u+1):t=u+1,o||(o=e.src.slice(a,u)),l=e.env.references[W(o)],!l)return e.pos=p,!1;h=l.href,s=l.title}if(!n){i=e.src.slice(a,u);const C=[];e.md.inline.parse(i,e.md,e.env,C);const _=e.push("image","img",0),y=[["src",h],["alt",""]];_.attrs=y,_.children=C,_.content=i,s&&y.push(["title",s])}return e.pos=t,e.posMax=k,!0}const cr=/^([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])?)*)$/,sr=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function fr(e,n){let r=e.pos;if(e.src.charCodeAt(r)!==60)return!1;const i=e.pos,o=e.posMax;for(;;){if(++r>=o)return!1;const l=e.src.charCodeAt(r);if(l===60)return!1;if(l===62)break}const t=e.src.slice(i+1,r);if(sr.test(t)){const l=e.md.normalizeLink(t);if(!e.md.validateLink(l))return!1;if(!n){const c=e.push("link_open","a",1);c.attrs=[["href",l]],c.markup="autolink",c.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(t);const f=e.push("link_close","a",-1);f.markup="autolink",f.info="auto"}return e.pos+=t.length+2,!0}if(cr.test(t)){const l=e.md.normalizeLink("mailto:"+t);if(!e.md.validateLink(l))return!1;if(!n){const c=e.push("link_open","a",1);c.attrs=[["href",l]],c.markup="autolink",c.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(t);const f=e.push("link_close","a",-1);f.markup="autolink",f.info="auto"}return e.pos+=t.length+2,!0}return!1}function ur(e){return/^<a[>\s]/i.test(e)}function hr(e){return/^<\/a\s*>/i.test(e)}function pr(e){const n=e|32;return n>=97&&n<=122}function ar(e,n){if(!e.md.options.html)return!1;const r=e.posMax,i=e.pos;if(e.src.charCodeAt(i)!==60||i+2>=r)return!1;const o=e.src.charCodeAt(i+1);if(o!==33&&o!==63&&o!==47&&!pr(o))return!1;const t=e.src.slice(i).match(Nn);if(!t)return!1;if(!n){const l=e.push("html_inline","",0);l.content=t[0],ur(l.content)&&e.linkLevel++,hr(l.content)&&e.linkLevel--}return e.pos+=t[0].length,!0}const kr=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,dr=/^&([a-z][a-z0-9]{1,31});/i;function mr(e,n){const r=e.pos,i=e.posMax;if(e.src.charCodeAt(r)!==38||r+1>=i)return!1;if(e.src.charCodeAt(r+1)===35){const t=e.src.slice(r).match(kr);if(t){if(!n){const l=t[1][0].toLowerCase()==="x"?parseInt(t[1].slice(1),16):parseInt(t[1],10),c=e.push("text_special","",0);c.content=ne(l)?H(l):H(65533),c.markup=t[0],c.info="entity"}return e.pos+=t[0].length,!0}}else{const t=e.src.slice(r).match(dr);if(t){const l=me(t[0]);if(l!==t[0]){if(!n){const c=e.push("text_special","",0);c.content=l,c.markup=t[0],c.info="entity"}return e.pos+=t[0].length,!0}}}return!1}function ae(e){const n={},r=e.length;if(!r)return;let i=0,o=-2;const t=[];for(let l=0;l<r;l++){const c=e[l];if(t.push(0),(e[i].marker!==c.marker||o!==c.token-1)&&(i=l),o=c.token,c.length=c.length||0,!c.close)continue;n.hasOwnProperty(c.marker)||(n[c.marker]=[-1,-1,-1,-1,-1,-1]);const s=n[c.marker][(c.open?3:0)+c.length%3];let f=i-t[i]-1,h=f;for(;f>s;f-=t[f]+1){const p=e[f];if(p.marker===c.marker&&p.open&&p.end<0){let k=!1;if((p.close||c.open)&&(p.length+c.length)%3===0&&(p.length%3!==0||c.length%3!==0)&&(k=!0),!k){const a=f>0&&!e[f-1].open?t[f-1]+1:0;t[l]=l-f+a,t[f]=a,c.open=!1,p.end=l,p.close=!1,h=-1,o=-2;break}}}h!==-1&&(n[c.marker][(c.open?3:0)+(c.length||0)%3]=h)}}function xr(e){const n=e.tokens_meta,r=e.tokens_meta.length;ae(e.delimiters);for(let i=0;i<r;i++)n[i]&&n[i].delimiters&&ae(n[i].delimiters)}function gr(e){let n,r,i=0;const o=e.tokens,t=e.tokens.length;for(n=r=0;n<t;n++)o[n].nesting<0&&i--,o[n].level=i,o[n].nesting>0&&i++,o[n].type==="text"&&n+1<t&&o[n+1].type==="text"?o[n+1].content=o[n].content+o[n+1].content:(n!==r&&(o[r]=o[n]),r++);n!==r&&(o.length=r)}const Y=[["text",Jn],["linkify",Xn],["newline",Yn],["escape",Kn],["backticks",er],["strikethrough",Ee.tokenize],["emphasis",Se.tokenize],["link",ir],["image",lr],["autolink",fr],["html_inline",ar],["entity",mr]],K=[["balance_pairs",xr],["strikethrough",Ee.postProcess],["emphasis",Se.postProcess],["fragments_join",gr]];function N(){this.ruler=new S;for(let e=0;e<Y.length;e++)this.ruler.push(Y[e][0],Y[e][1]);this.ruler2=new S;for(let e=0;e<K.length;e++)this.ruler2.push(K[e][0],K[e][1])}N.prototype.skipToken=function(e){const n=e.pos,r=this.ruler.getRules(""),i=r.length,o=e.md.options.maxNesting,t=e.cache;if(typeof t[n]<"u"){e.pos=t[n];return}let l=!1;if(e.level<o){for(let c=0;c<i;c++)if(e.level++,l=r[c](e,!0),e.level--,l){if(n>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;l||e.pos++,t[n]=e.pos};N.prototype.tokenize=function(e){const n=this.ruler.getRules(""),r=n.length,i=e.posMax,o=e.md.options.maxNesting;for(;e.pos<i;){const t=e.pos;let l=!1;if(e.level<o){for(let c=0;c<r;c++)if(l=n[c](e,!1),l){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(l){if(e.pos>=i)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};N.prototype.parse=function(e,n,r,i){const o=new this.State(e,n,r,i);this.tokenize(o);const t=this.ruler2.getRules(""),l=t.length;for(let c=0;c<l;c++)t[c](o)};N.prototype.State=q;const _r={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},br={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},Cr={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},Ar={default:_r,zero:br,commonmark:Cr},yr=/^(vbscript|javascript|file|data):/,Er=/^data:image\/(gif|png|jpeg|webp);/;function Sr(e){const n=e.trim().toLowerCase();return yr.test(n)?Er.test(n):!0}const Me=["http:","https:","mailto:"];function Mr(e){const n=ke(e,!0);if(n.hostname&&(!n.protocol||Me.indexOf(n.protocol)>=0))try{n.hostname=xe.toASCII(n.hostname)}catch{}return Pe(de(n))}function wr(e){const n=ke(e,!0);if(n.hostname&&(!n.protocol||Me.indexOf(n.protocol)>=0))try{n.hostname=xe.toUnicode(n.hostname)}catch{}return ie(de(n),ie.defaultChars+"%")}function w(e,n){if(!(this instanceof w))return new w(e,n);n||ee(e)||(n=e||{},e="default"),this.inline=new N,this.block=new Q,this.core=new re,this.renderer=new F,this.linkify=new De,this.validateLink=Sr,this.normalizeLink=Mr,this.normalizeLinkText=wr,this.utils=Xe,this.helpers=G({},nn),this.options={},this.configure(e),n&&this.set(n)}w.prototype.set=function(e){return G(this.options,e),this};w.prototype.configure=function(e){const n=this;if(ee(e)){const r=e;if(e=Ar[r],!e)throw new Error('Wrong `markdown-it` preset "'+r+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&n.set(e.options),e.components&&Object.keys(e.components).forEach(function(r){e.components[r].rules&&n[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&n[r].ruler2.enableOnly(e.components[r].rules2)}),this};w.prototype.enable=function(e,n){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(o){r=r.concat(this[o].ruler.enable(e,!0))},this),r=r.concat(this.inline.ruler2.enable(e,!0));const i=e.filter(function(o){return r.indexOf(o)<0});if(i.length&&!n)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+i);return this};w.prototype.disable=function(e,n){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(o){r=r.concat(this[o].ruler.disable(e,!0))},this),r=r.concat(this.inline.ruler2.disable(e,!0));const i=e.filter(function(o){return r.indexOf(o)<0});if(i.length&&!n)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+i);return this};w.prototype.use=function(e){const n=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,n),this};w.prototype.parse=function(e,n){if(typeof e!="string")throw new Error("Input data should be a String");const r=new this.core.State(e,this,n);return this.core.process(r),r.tokens};w.prototype.render=function(e,n){return n=n||{},this.renderer.render(this.parse(e,n),this.options,n)};w.prototype.parseInline=function(e,n){const r=new this.core.State(e,this,n);return r.inlineMode=!0,this.core.process(r),r.tokens};w.prototype.renderInline=function(e,n){return n=n||{},this.renderer.render(this.parseInline(e,n),this.options,n)};export{w as M};
