dootask/public/js/build/markdown-it.f75bb98e.js
2024-12-09 07:35:10 +08:00

17 lines
58 KiB
JavaScript
Vendored

import{d as Ee}from"./entities.48a44fec.js";import{L as qe}from"./linkify-it.c76d7176.js";import{p as ye}from"./punycode.js.4b3f125a.js";const fe={};function Ne(e){let n=fe[e];if(n)return n;n=fe[e]=[];for(let r=0;r<128;r++){const i=String.fromCharCode(r);n.push(i)}for(let r=0;r<e.length;r++){const i=e.charCodeAt(r);n[i]="%"+("0"+i.toString(16).toUpperCase()).slice(-2)}return n}function R(e,n){typeof n!="string"&&(n=R.defaultChars);const r=Ne(n);return e.replace(/(%[a-f0-9]{2})+/gi,function(i){let o="";for(let t=0,u=i.length;t<u;t+=3){const l=parseInt(i.slice(t+1,t+3),16);if(l<128){o+=r[l];continue}if((l&224)===192&&t+3<u){const s=parseInt(i.slice(t+4,t+6),16);if((s&192)===128){const c=l<<6&1984|s&63;c<128?o+="\uFFFD\uFFFD":o+=String.fromCharCode(c),t+=3;continue}}if((l&240)===224&&t+6<u){const s=parseInt(i.slice(t+4,t+6),16),c=parseInt(i.slice(t+7,t+9),16);if((s&192)===128&&(c&192)===128){const h=l<<12&61440|s<<6&4032|c&63;h<2048||h>=55296&&h<=57343?o+="\uFFFD\uFFFD\uFFFD":o+=String.fromCharCode(h),t+=6;continue}}if((l&248)===240&&t+9<u){const s=parseInt(i.slice(t+4,t+6),16),c=parseInt(i.slice(t+7,t+9),16),h=parseInt(i.slice(t+10,t+12),16);if((s&192)===128&&(c&192)===128&&(h&192)===128){let p=l<<18&1835008|s<<12&258048|c<<6&4032|h&63;p<65536||p>1114111?o+="\uFFFD\uFFFD\uFFFD\uFFFD":(p-=65536,o+=String.fromCharCode(55296+(p>>10),56320+(p&1023))),t+=9;continue}}o+="\uFFFD"}return o})}R.defaultChars=";/?:@&=+$,#";R.componentChars="";const he={};function Ue(e){let n=he[e];if(n)return n;n=he[e]=[];for(let r=0;r<128;r++){const i=String.fromCharCode(r);/^[0-9a-z]$/i.test(i)?n.push(i):n.push("%"+("0"+r.toString(16).toUpperCase()).slice(-2))}for(let r=0;r<e.length;r++)n[e.charCodeAt(r)]=e[r];return n}function N(e,n,r){typeof n!="string"&&(r=n,n=N.defaultChars),typeof r=="undefined"&&(r=!0);const i=Ue(n);let o="";for(let t=0,u=e.length;t<u;t++){const l=e.charCodeAt(t);if(r&&l===37&&t+2<u&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){o+=e.slice(t,t+3),t+=2;continue}if(l<128){o+=i[l];continue}if(l>=55296&&l<=57343){if(l>=55296&&l<=56319&&t+1<u){const s=e.charCodeAt(t+1);if(s>=56320&&s<=57343){o+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}o+="%EF%BF%BD";continue}o+=encodeURIComponent(e[t])}return o}N.defaultChars=";/?:@&=+$,-_.!~*'()#";N.componentChars="-_.!~*'()";function te(e){let n="";return n+=e.protocol||"",n+=e.slashes?"//":"",n+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?n+="["+e.hostname+"]":n+=e.hostname||"",n+=e.port?":"+e.port:"",n+=e.pathname||"",n+=e.search||"",n+=e.hash||"",n}function W(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const Ze=/^([a-z0-9.+-]+:)/i,He=/:[0-9]*$/,Ge=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,We=["<",">",'"',"`"," ","\r",`
`," "],Qe=["{","}","|","\\","^","`"].concat(We),Je=["'"].concat(Qe),pe=["%","/","?",";","#"].concat(Je),ae=["/","?","#"],Ve=255,de=/^[+a-z0-9A-Z_-]{0,63}$/,Xe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ke={javascript:!0,"javascript:":!0},De={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function oe(e,n){if(e&&e instanceof W)return e;const r=new W;return r.parse(e,n),r}W.prototype.parse=function(e,n){let r,i,o,t=e;if(t=t.trim(),!n&&e.split("#").length===1){const c=Ge.exec(t);if(c)return this.pathname=c[1],c[2]&&(this.search=c[2]),this}let u=Ze.exec(t);if(u&&(u=u[0],r=u.toLowerCase(),this.protocol=u,t=t.substr(u.length)),(n||u||t.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=t.substr(0,2)==="//",o&&!(u&&ke[u])&&(t=t.substr(2),this.slashes=!0)),!ke[u]&&(o||u&&!De[u])){let c=-1;for(let f=0;f<ae.length;f++)i=t.indexOf(ae[f]),i!==-1&&(c===-1||i<c)&&(c=i);let h,p;c===-1?p=t.lastIndexOf("@"):p=t.lastIndexOf("@",c),p!==-1&&(h=t.slice(0,p),t=t.slice(p+1),this.auth=h),c=-1;for(let f=0;f<pe.length;f++)i=t.indexOf(pe[f]),i!==-1&&(c===-1||i<c)&&(c=i);c===-1&&(c=t.length),t[c-1]===":"&&c--;const d=t.slice(0,c);t=t.slice(c),this.parseHost(d),this.hostname=this.hostname||"";const a=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!a){const f=this.hostname.split(/\./);for(let m=0,F=f.length;m<F;m++){const _=f[m];if(!!_&&!_.match(de)){let k="";for(let x=0,D=_.length;x<D;x++)_.charCodeAt(x)>127?k+="x":k+=_[x];if(!k.match(de)){const x=f.slice(0,m),D=f.slice(m+1),C=_.match(Xe);C&&(x.push(C[1]),D.unshift(C[2])),D.length&&(t=D.join(".")+t),this.hostname=x.join(".");break}}}}this.hostname.length>Ve&&(this.hostname=""),a&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const l=t.indexOf("#");l!==-1&&(this.hash=t.substr(l),t=t.slice(0,l));const s=t.indexOf("?");return s!==-1&&(this.search=t.substr(s),t=t.slice(0,s)),t&&(this.pathname=t),De[r]&&this.hostname&&!this.pathname&&(this.pathname=""),this};W.prototype.parseHost=function(e){let n=He.exec(e);n&&(n=n[0],n!==":"&&(this.port=n.substr(1)),e=e.substr(0,e.length-n.length)),e&&(this.hostname=e)};var Ye=Object.freeze(Object.defineProperty({__proto__:null,decode:R,encode:N,format:te,parse:oe},Symbol.toStringTag,{value:"Module"})),Ke=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,en=/[\0-\x1F\x7F-\x9F]/,nn=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Se=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,Be=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,rn=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,tn=Object.freeze(Object.defineProperty({__proto__:null,Any:Ke,Cc:en,Cf:nn,P:Se,S:Be,Z:rn},Symbol.toStringTag,{value:"Module"}));function on(e){return Object.prototype.toString.call(e)}function ie(e){return on(e)==="[object String]"}const un=Object.prototype.hasOwnProperty;function ln(e,n){return un.call(e,n)}function J(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 Me(e,n,r){return[].concat(e.slice(0,n),r,e.slice(n+1))}function ue(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 Q(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 we=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,sn=/&([a-z#][a-z0-9]{1,31});/gi,cn=new RegExp(we.source+"|"+sn.source,"gi"),fn=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function hn(e,n){if(n.charCodeAt(0)===35&&fn.test(n)){const i=n[1].toLowerCase()==="x"?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return ue(i)?Q(i):e}const r=Ee(e);return r!==e?r:e}function pn(e){return e.indexOf("\\")<0?e:e.replace(we,"$1")}function O(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(cn,function(n,r,i){return r||hn(n,i)})}const an=/[&<>"]/,dn=/[&<>"]/g,kn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function Dn(e){return kn[e]}function I(e){return an.test(e)?e.replace(dn,Dn):e}const xn=/[.?*+^$[\]\\(){}|-]/g;function Cn(e){return e.replace(xn,"\\$&")}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 j(e){return Se.test(e)||Be.test(e)}function q(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 V(e){return e=e.trim().replace(/\s+/g," "),"\u1E9E".toLowerCase()==="\u1E7E"&&(e=e.replace(/ẞ/g,"\xDF")),e.toLowerCase().toUpperCase()}const mn={mdurl:Ye,ucmicro:tn};var Fn=Object.freeze(Object.defineProperty({__proto__:null,lib:mn,assign:J,isString:ie,has:ln,unescapeMd:pn,unescapeAll:O,isValidEntityCode:ue,fromCodePoint:Q,escapeHtml:I,arrayReplaceAt:Me,isSpace:A,isWhiteSpace:$,isMdAsciiPunct:q,isPunctChar:j,escapeRE:Cn,normalizeReference:V},Symbol.toStringTag,{value:"Module"}));function gn(e,n,r){let i,o,t,u;const l=e.posMax,s=e.pos;for(e.pos=n+1,i=1;e.pos<l;){if(t=e.src.charCodeAt(e.pos),t===93&&(i--,i===0)){o=!0;break}if(u=e.pos,e.md.inline.skipToken(e),t===91){if(u===e.pos-1)i++;else if(r)return e.pos=s,-1}}let c=-1;return o&&(c=e.pos),e.pos=s,c}function _n(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=O(e.slice(n+1,o)),t.ok=!0,t;if(i===92&&o+1<r){o+=2;continue}o++}return t}let u=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&&(u++,u>32))return t;if(i===41){if(u===0)break;u--}o++}return n===o||u!==0||(t.str=O(e.slice(n,o)),t.pos=o,t.ok=!0),t}function An(e,n,r,i){let o,t=n;const u={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(i)u.str=i.str,u.marker=i.marker;else{if(t>=r)return u;let l=e.charCodeAt(t);if(l!==34&&l!==39&&l!==40)return u;n++,t++,l===40&&(l=41),u.marker=l}for(;t<r;){if(o=e.charCodeAt(t),o===u.marker)return u.pos=t+1,u.str+=O(e.slice(n,t)),u.ok=!0,u;if(o===40&&u.marker===41)return u;o===92&&t+1<r&&t++,t++}return u.can_continue=!0,u.str+=O(e.slice(n,t)),u}var bn=Object.freeze(Object.defineProperty({__proto__:null,parseLinkLabel:gn,parseLinkDestination:_n,parseLinkTitle:An},Symbol.toStringTag,{value:"Module"}));const M={};M.code_inline=function(e,n,r,i,o){const t=e[n];return"<code"+o.renderAttrs(t)+">"+I(t.content)+"</code>"};M.code_block=function(e,n,r,i,o){const t=e[n];return"<pre"+o.renderAttrs(t)+"><code>"+I(e[n].content)+`</code></pre>
`};M.fence=function(e,n,r,i,o){const t=e[n],u=t.info?O(t.info).trim():"";let l="",s="";if(u){const h=u.split(/(\s+)/g);l=h[0],s=h.slice(2).join("")}let c;if(r.highlight?c=r.highlight(t.content,l,s)||I(t.content):c=I(t.content),c.indexOf("<pre")===0)return c+`
`;if(u){const h=t.attrIndex("class"),p=t.attrs?t.attrs.slice():[];h<0?p.push(["class",r.langPrefix+l]):(p[h]=p[h].slice(),p[h][1]+=" "+r.langPrefix+l);const d={attrs:p};return`<pre><code${o.renderAttrs(d)}>${c}</code></pre>
`}return`<pre><code${o.renderAttrs(t)}>${c}</code></pre>
`};M.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)};M.hardbreak=function(e,n,r){return r.xhtmlOut?`<br />
`:`<br>
`};M.softbreak=function(e,n,r){return r.breaks?r.xhtmlOut?`<br />
`:`<br>
`:`
`};M.text=function(e,n){return I(e[n].content)};M.html_block=function(e,n){return e[n].content};M.html_inline=function(e,n){return e[n].content};function z(){this.rules=J({},M)}z.prototype.renderAttrs=function(n){let r,i,o;if(!n.attrs)return"";for(o="",r=0,i=n.attrs.length;r<i;r++)o+=" "+I(n.attrs[r][0])+'="'+I(n.attrs[r][1])+'"';return o};z.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 u=!1;if(o.block&&(u=!0,o.nesting===1&&r+1<n.length)){const l=n[r+1];(l.type==="inline"||l.hidden||l.nesting===-1&&l.tag===o.tag)&&(u=!1)}return t+=u?`>
`:">",t};z.prototype.renderInline=function(e,n,r){let i="";const o=this.rules;for(let t=0,u=e.length;t<u;t++){const l=e[t].type;typeof o[l]!="undefined"?i+=o[l](e,t,n,r,this):i+=this.renderToken(e,t,n)}return i};z.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};z.prototype.render=function(e,n,r){let i="";const o=this.rules;for(let t=0,u=e.length;t<u;t++){const l=e[t].type;l==="inline"?i+=this.renderInline(e[t].children,n,r):typeof o[l]!="undefined"?i+=o[l](e,t,n,r,this):i+=this.renderToken(e,t,n,r)}return i};function E(){this.__rules__=[],this.__cache__=null}E.prototype.__find__=function(e){for(let n=0;n<this.__rules__.length;n++)if(this.__rules__[n].name===e)return n;return-1};E.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)})})};E.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};E.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};E.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};E.prototype.push=function(e,n,r){const i=r||{};this.__rules__.push({name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null};E.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};E.prototype.enableOnly=function(e,n){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(r){r.enabled=!1}),this.enable(e,n)};E.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};E.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function B(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}B.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};B.prototype.attrPush=function(n){this.attrs?this.attrs.push(n):this.attrs=[n]};B.prototype.attrSet=function(n,r){const i=this.attrIndex(n),o=[n,r];i<0?this.attrPush(o):this.attrs[i]=o};B.prototype.attrGet=function(n){const r=this.attrIndex(n);let i=null;return r>=0&&(i=this.attrs[r][1]),i};B.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 Te(e,n,r){this.src=e,this.env=r,this.tokens=[],this.inlineMode=!1,this.md=n}Te.prototype.Token=B;const En=/\r\n?|\n/g,yn=/\0/g;function Sn(e){let n;n=e.src.replace(En,`
`),n=n.replace(yn,"\uFFFD"),e.src=n}function Bn(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 Mn(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 wn(e){return/^<a[>\s]/i.test(e)}function Tn(e){return/^<\/a\s*>/i.test(e)}function In(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 u=o.length-1;u>=0;u--){const l=o[u];if(l.type==="link_close"){for(u--;o[u].level!==l.level&&o[u].type!=="link_open";)u--;continue}if(l.type==="html_inline"&&(wn(l.content)&&t>0&&t--,Tn(l.content)&&t++),!(t>0)&&l.type==="text"&&e.md.linkify.test(l.content)){const s=l.content;let c=e.md.linkify.match(s);const h=[];let p=l.level,d=0;c.length>0&&c[0].index===0&&u>0&&o[u-1].type==="text_special"&&(c=c.slice(1));for(let a=0;a<c.length;a++){const f=c[a].url,m=e.md.normalizeLink(f);if(!e.md.validateLink(m))continue;let F=c[a].text;c[a].schema?c[a].schema==="mailto:"&&!/^mailto:/i.test(F)?F=e.md.normalizeLinkText("mailto:"+F).replace(/^mailto:/,""):F=e.md.normalizeLinkText(F):F=e.md.normalizeLinkText("http://"+F).replace(/^http:\/\//,"");const _=c[a].index;if(_>d){const C=new e.Token("text","",0);C.content=s.slice(d,_),C.level=p,h.push(C)}const k=new e.Token("link_open","a",1);k.attrs=[["href",m]],k.level=p++,k.markup="linkify",k.info="auto",h.push(k);const x=new e.Token("text","",0);x.content=F,x.level=p,h.push(x);const D=new e.Token("link_close","a",-1);D.level=--p,D.markup="linkify",D.info="auto",h.push(D),d=c[a].lastIndex}if(d<s.length){const a=new e.Token("text","",0);a.content=s.slice(d),a.level=p,h.push(a)}n[r].children=o=Me(o,u,h)}}}}const Ie=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,vn=/\((c|tm|r)\)/i,Pn=/\((c|tm|r)\)/ig,Rn={c:"\xA9",r:"\xAE",tm:"\u2122"};function On(e,n){return Rn[n.toLowerCase()]}function zn(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,On)),i.type==="link_open"&&i.info==="auto"&&n--,i.type==="link_close"&&i.info==="auto"&&n++}}function Ln(e){let n=0;for(let r=e.length-1;r>=0;r--){const i=e[r];i.type==="text"&&!n&&Ie.test(i.content)&&(i.content=i.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1\u2014").replace(/(^|\s)--(?=\s|$)/mg,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1\u2013")),i.type==="link_open"&&i.info==="auto"&&n--,i.type==="link_close"&&i.info==="auto"&&n++}}function $n(e){let n;if(!!e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type==="inline"&&(vn.test(e.tokens[n].content)&&zn(e.tokens[n].children),Ie.test(e.tokens[n].content)&&Ln(e.tokens[n].children))}const jn=/['"]/,xe=/['"]/g,Ce="\u2019";function H(e,n,r){return e.slice(0,n)+r+e.slice(n+1)}function qn(e,n){let r;const i=[];for(let o=0;o<e.length;o++){const t=e[o],u=e[o].level;for(r=i.length-1;r>=0&&!(i[r].level<=u);r--);if(i.length=r+1,t.type!=="text")continue;let l=t.content,s=0,c=l.length;e:for(;s<c;){xe.lastIndex=s;const h=xe.exec(l);if(!h)break;let p=!0,d=!0;s=h.index+1;const a=h[0]==="'";let f=32;if(h.index-1>=0)f=l.charCodeAt(h.index-1);else for(r=o-1;r>=0&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r--)if(!!e[r].content){f=e[r].content.charCodeAt(e[r].content.length-1);break}let m=32;if(s<c)m=l.charCodeAt(s);else for(r=o+1;r<e.length&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r++)if(!!e[r].content){m=e[r].content.charCodeAt(0);break}const F=q(f)||j(String.fromCharCode(f)),_=q(m)||j(String.fromCharCode(m)),k=$(f),x=$(m);if(x?p=!1:_&&(k||F||(p=!1)),k?d=!1:F&&(x||_||(d=!1)),m===34&&h[0]==='"'&&f>=48&&f<=57&&(d=p=!1),p&&d&&(p=F,d=_),!p&&!d){a&&(t.content=H(t.content,h.index,Ce));continue}if(d)for(r=i.length-1;r>=0;r--){let D=i[r];if(i[r].level<u)break;if(D.single===a&&i[r].level===u){D=i[r];let C,g;a?(C=n.md.options.quotes[2],g=n.md.options.quotes[3]):(C=n.md.options.quotes[0],g=n.md.options.quotes[1]),t.content=H(t.content,h.index,g),e[D.token].content=H(e[D.token].content,D.pos,C),s+=g.length-1,D.token===o&&(s+=C.length-1),l=t.content,c=l.length,i.length=r;continue e}}p?i.push({token:o,pos:h.index,single:a,level:u}):d&&a&&(t.content=H(t.content,h.index,Ce))}}}function Nn(e){if(!!e.md.options.typographer)for(let n=e.tokens.length-1;n>=0;n--)e.tokens[n].type!=="inline"||!jn.test(e.tokens[n].content)||qn(e.tokens[n].children,e)}function Un(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 u=i[t].children,l=u.length;for(n=0;n<l;n++)u[n].type==="text_special"&&(u[n].type="text");for(n=r=0;n<l;n++)u[n].type==="text"&&n+1<l&&u[n+1].type==="text"?u[n+1].content=u[n].content+u[n+1].content:(n!==r&&(u[r]=u[n]),r++);n!==r&&(u.length=r)}}const K=[["normalize",Sn],["block",Bn],["inline",Mn],["linkify",In],["replacements",$n],["smartquotes",Nn],["text_join",Un]];function le(){this.ruler=new E;for(let e=0;e<K.length;e++)this.ruler.push(K[e][0],K[e][1])}le.prototype.process=function(e){const n=this.ruler.getRules("");for(let r=0,i=n.length;r<i;r++)n[r](e)};le.prototype.State=Te;function w(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,u=0,l=0,s=0,c=o.length,h=!1;u<c;u++){const p=o.charCodeAt(u);if(!h)if(A(p)){l++,p===9?s+=4-s%4:s++;continue}else h=!0;(p===10||u===c-1)&&(p!==10&&u++,this.bMarks.push(t),this.eMarks.push(u),this.tShift.push(l),this.sCount.push(s),this.bsCount.push(0),h=!1,l=0,s=0,t=u+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}w.prototype.push=function(e,n,r){const i=new B(e,n,r);return i.block=!0,r<0&&this.level--,i.level=this.level,r>0&&this.level++,this.tokens.push(i),i};w.prototype.isEmpty=function(n){return this.bMarks[n]+this.tShift[n]>=this.eMarks[n]};w.prototype.skipEmptyLines=function(n){for(let r=this.lineMax;n<r&&!(this.bMarks[n]+this.tShift[n]<this.eMarks[n]);n++);return n};w.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};w.prototype.skipSpacesBack=function(n,r){if(n<=r)return n;for(;n>r;)if(!A(this.src.charCodeAt(--n)))return n+1;return n};w.prototype.skipChars=function(n,r){for(let i=this.src.length;n<i&&this.src.charCodeAt(n)===r;n++);return n};w.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};w.prototype.getLines=function(n,r,i,o){if(n>=r)return"";const t=new Array(r-n);for(let u=0,l=n;l<r;l++,u++){let s=0;const c=this.bMarks[l];let h=c,p;for(l+1<r||o?p=this.eMarks[l]+1:p=this.eMarks[l];h<p&&s<i;){const d=this.src.charCodeAt(h);if(A(d))d===9?s+=4-(s+this.bsCount[l])%4:s++;else if(h-c<this.tShift[l])s++;else break;h++}s>i?t[u]=new Array(s-i+1).join(" ")+this.src.slice(h,p):t[u]=this.src.slice(h,p)}return t.join("")};w.prototype.Token=B;const Zn=65536;function ee(e,n){const r=e.bMarks[n]+e.tShift[n],i=e.eMarks[n];return e.src.slice(r,i)}function me(e){const n=[],r=e.length;let i=0,o=e.charCodeAt(i),t=!1,u=0,l="";for(;i<r;)o===124&&(t?(l+=e.substring(u,i-1),u=i):(n.push(l+e.substring(u,i)),l="",u=i+1)),t=o===92,i++,o=e.charCodeAt(i);return n.push(l+e.substring(u)),n}function Hn(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 u=e.src.charCodeAt(t++);if(u!==124&&u!==45&&u!==58||t>=e.eMarks[o])return!1;const l=e.src.charCodeAt(t++);if(l!==124&&l!==45&&l!==58&&!A(l)||u===45&&A(l))return!1;for(;t<e.eMarks[o];){const D=e.src.charCodeAt(t);if(D!==124&&D!==45&&D!==58&&!A(D))return!1;t++}let s=ee(e,n+1),c=s.split("|");const h=[];for(let D=0;D<c.length;D++){const C=c[D].trim();if(!C){if(D===0||D===c.length-1)continue;return!1}if(!/^:?-+:?$/.test(C))return!1;C.charCodeAt(C.length-1)===58?h.push(C.charCodeAt(0)===58?"center":"right"):C.charCodeAt(0)===58?h.push("left"):h.push("")}if(s=ee(e,n).trim(),s.indexOf("|")===-1||e.sCount[n]-e.blkIndent>=4)return!1;c=me(s),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop();const p=c.length;if(p===0||p!==h.length)return!1;if(i)return!0;const d=e.parentType;e.parentType="table";const a=e.md.block.ruler.getRules("blockquote"),f=e.push("table_open","table",1),m=[n,0];f.map=m;const F=e.push("thead_open","thead",1);F.map=[n,n+1];const _=e.push("tr_open","tr",1);_.map=[n,n+1];for(let D=0;D<c.length;D++){const C=e.push("th_open","th",1);h[D]&&(C.attrs=[["style","text-align:"+h[D]]]);const g=e.push("inline","",0);g.content=c[D].trim(),g.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let k,x=0;for(o=n+2;o<r&&!(e.sCount[o]<e.blkIndent);o++){let D=!1;for(let g=0,b=a.length;g<b;g++)if(a[g](e,o,r,!0)){D=!0;break}if(D||(s=ee(e,o).trim(),!s)||e.sCount[o]-e.blkIndent>=4||(c=me(s),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop(),x+=p-c.length,x>Zn))break;if(o===n+2){const g=e.push("tbody_open","tbody",1);g.map=k=[n+2,0]}const C=e.push("tr_open","tr",1);C.map=[o,o+1];for(let g=0;g<p;g++){const b=e.push("td_open","td",1);h[g]&&(b.attrs=[["style","text-align:"+h[g]]]);const y=e.push("inline","",0);y.content=c[g]?c[g].trim():"",y.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return k&&(e.push("tbody_close","tbody",-1),k[1]=o),e.push("table_close","table",-1),m[1]=o,e.parentType=d,e.line=o,!0}function Gn(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 Wn(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 u=e.src.charCodeAt(o);if(u!==126&&u!==96)return!1;let l=o;o=e.skipChars(o,u);let s=o-l;if(s<3)return!1;const c=e.src.slice(l,o),h=e.src.slice(o,t);if(u===96&&h.indexOf(String.fromCharCode(u))>=0)return!1;if(i)return!0;let p=n,d=!1;for(;p++,!(p>=r||(o=l=e.bMarks[p]+e.tShift[p],t=e.eMarks[p],o<t&&e.sCount[p]<e.blkIndent));)if(e.src.charCodeAt(o)===u&&!(e.sCount[p]-e.blkIndent>=4)&&(o=e.skipChars(o,u),!(o-l<s)&&(o=e.skipSpaces(o),!(o<t)))){d=!0;break}s=e.sCount[n],e.line=p+(d?1:0);const a=e.push("fence","code",0);return a.info=h,a.content=e.getLines(n+1,p,s,!0),a.markup=c,a.map=[n,e.line],!0}function Qn(e,n,r,i){let o=e.bMarks[n]+e.tShift[n],t=e.eMarks[n];const u=e.lineMax;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(o)!==62)return!1;if(i)return!0;const l=[],s=[],c=[],h=[],p=e.md.block.ruler.getRules("blockquote"),d=e.parentType;e.parentType="blockquote";let a=!1,f;for(f=n;f<r;f++){const x=e.sCount[f]<e.blkIndent;if(o=e.bMarks[f]+e.tShift[f],t=e.eMarks[f],o>=t)break;if(e.src.charCodeAt(o++)===62&&!x){let C=e.sCount[f]+1,g,b;e.src.charCodeAt(o)===32?(o++,C++,b=!1,g=!0):e.src.charCodeAt(o)===9?(g=!0,(e.bsCount[f]+C)%4===3?(o++,C++,b=!1):b=!0):g=!1;let y=C;for(l.push(e.bMarks[f]),e.bMarks[f]=o;o<t;){const T=e.src.charCodeAt(o);if(A(T))T===9?y+=4-(y+e.bsCount[f]+(b?1:0))%4:y++;else break;o++}a=o>=t,s.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(g?1:0),c.push(e.sCount[f]),e.sCount[f]=y-C,h.push(e.tShift[f]),e.tShift[f]=o-e.bMarks[f];continue}if(a)break;let D=!1;for(let C=0,g=p.length;C<g;C++)if(p[C](e,f,r,!0)){D=!0;break}if(D){e.lineMax=f,e.blkIndent!==0&&(l.push(e.bMarks[f]),s.push(e.bsCount[f]),h.push(e.tShift[f]),c.push(e.sCount[f]),e.sCount[f]-=e.blkIndent);break}l.push(e.bMarks[f]),s.push(e.bsCount[f]),h.push(e.tShift[f]),c.push(e.sCount[f]),e.sCount[f]=-1}const m=e.blkIndent;e.blkIndent=0;const F=e.push("blockquote_open","blockquote",1);F.markup=">";const _=[n,0];F.map=_,e.md.block.tokenize(e,n,f);const k=e.push("blockquote_close","blockquote",-1);k.markup=">",e.lineMax=u,e.parentType=d,_[1]=e.line;for(let x=0;x<h.length;x++)e.bMarks[x+n]=l[x],e.tShift[x+n]=h[x],e.sCount[x+n]=c[x],e.bsCount[x+n]=s[x];return e.blkIndent=m,!0}function Jn(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 u=e.src.charCodeAt(t++);if(u!==42&&u!==45&&u!==95)return!1;let l=1;for(;t<o;){const c=e.src.charCodeAt(t++);if(c!==u&&!A(c))return!1;c===u&&l++}if(l<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(l+1).join(String.fromCharCode(u)),!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 ge(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 Vn(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 Xn(e,n,r,i){let o,t,u,l,s=n,c=!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,d,a;if((a=ge(e,s))>=0){if(p=!0,u=e.bMarks[s]+e.tShift[s],d=Number(e.src.slice(u,a-1)),h&&d!==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 f=e.src.charCodeAt(a-1),m=e.tokens.length;p?(l=e.push("ordered_list_open","ol",1),d!==1&&(l.attrs=[["start",d]])):l=e.push("bullet_list_open","ul",1);const F=[s,0];l.map=F,l.markup=String.fromCharCode(f);let _=!1;const k=e.md.block.ruler.getRules("list"),x=e.parentType;for(e.parentType="list";s<r;){t=a,o=e.eMarks[s];const D=e.sCount[s]+a-(e.bMarks[s]+e.tShift[s]);let C=D;for(;t<o;){const v=e.src.charCodeAt(t);if(v===9)C+=4-(C+e.bsCount[s])%4;else if(v===32)C++;else break;t++}const g=t;let b;g>=o?b=1:b=C-D,b>4&&(b=1);const y=D+b;l=e.push("list_item_open","li",1),l.markup=String.fromCharCode(f);const T=[s,0];l.map=T,p&&(l.info=e.src.slice(u,a-1));const L=e.tight,Y=e.tShift[s],Le=e.sCount[s],$e=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=y,e.tight=!0,e.tShift[s]=g-e.bMarks[s],e.sCount[s]=C,g>=o&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,s,r,!0),(!e.tight||_)&&(c=!1),_=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=$e,e.tShift[s]=Y,e.sCount[s]=Le,e.tight=L,l=e.push("list_item_close","li",-1),l.markup=String.fromCharCode(f),s=e.line,T[1]=s,s>=r||e.sCount[s]<e.blkIndent||e.sCount[s]-e.blkIndent>=4)break;let ce=!1;for(let v=0,je=k.length;v<je;v++)if(k[v](e,s,r,!0)){ce=!0;break}if(ce)break;if(p){if(a=ge(e,s),a<0)break;u=e.bMarks[s]+e.tShift[s]}else if(a=Fe(e,s),a<0)break;if(f!==e.src.charCodeAt(a-1))break}return p?l=e.push("ordered_list_close","ol",-1):l=e.push("bullet_list_close","ul",-1),l.markup=String.fromCharCode(f),F[1]=s,e.line=s,e.parentType=x,c&&Vn(e,m),!0}function Yn(e,n,r,i){let o=e.bMarks[n]+e.tShift[n],t=e.eMarks[n],u=n+1;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(o)!==91)return!1;function l(k){const x=e.lineMax;if(k>=x||e.isEmpty(k))return null;let D=!1;if(e.sCount[k]-e.blkIndent>3&&(D=!0),e.sCount[k]<0&&(D=!0),!D){const b=e.md.block.ruler.getRules("reference"),y=e.parentType;e.parentType="reference";let T=!1;for(let L=0,Y=b.length;L<Y;L++)if(b[L](e,k,x,!0)){T=!0;break}if(e.parentType=y,T)return null}const C=e.bMarks[k]+e.tShift[k],g=e.eMarks[k];return e.src.slice(C,g+1)}let s=e.src.slice(o,t+1);t=s.length;let c=-1;for(o=1;o<t;o++){const k=s.charCodeAt(o);if(k===91)return!1;if(k===93){c=o;break}else if(k===10){const x=l(u);x!==null&&(s+=x,t=s.length,u++)}else if(k===92&&(o++,o<t&&s.charCodeAt(o)===10)){const x=l(u);x!==null&&(s+=x,t=s.length,u++)}}if(c<0||s.charCodeAt(c+1)!==58)return!1;for(o=c+2;o<t;o++){const k=s.charCodeAt(o);if(k===10){const x=l(u);x!==null&&(s+=x,t=s.length,u++)}else if(!A(k))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 d=o,a=u,f=o;for(;o<t;o++){const k=s.charCodeAt(o);if(k===10){const x=l(u);x!==null&&(s+=x,t=s.length,u++)}else if(!A(k))break}let m=e.md.helpers.parseLinkTitle(s,o,t);for(;m.can_continue;){const k=l(u);if(k===null)break;s+=k,o=t,t=s.length,u++,m=e.md.helpers.parseLinkTitle(s,o,t,m)}let F;for(o<t&&f!==o&&m.ok?(F=m.str,o=m.pos):(F="",o=d,u=a);o<t;){const k=s.charCodeAt(o);if(!A(k))break;o++}if(o<t&&s.charCodeAt(o)!==10&&F)for(F="",o=d,u=a;o<t;){const k=s.charCodeAt(o);if(!A(k))break;o++}if(o<t&&s.charCodeAt(o)!==10)return!1;const _=V(s.slice(1,c));return _?(i||(typeof e.env.references=="undefined"&&(e.env.references={}),typeof e.env.references[_]=="undefined"&&(e.env.references[_]={title:F,href:p}),e.line=u),!0):!1}var Kn=["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"];const er="[a-zA-Z_:][a-zA-Z0-9:._-]*",nr="[^\"'=<>`\\x00-\\x20]+",rr="'[^']*'",tr='"[^"]*"',or="(?:"+nr+"|"+rr+"|"+tr+")",ir="(?:\\s+"+er+"(?:\\s*=\\s*"+or+")?)",ve="<[A-Za-z][A-Za-z0-9\\-]*"+ir+"*\\s*\\/?>",Pe="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",ur="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",lr="<[?][\\s\\S]*?[?]>",sr="<![A-Za-z][^>]*>",cr="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",fr=new RegExp("^(?:"+ve+"|"+Pe+"|"+ur+"|"+lr+"|"+sr+"|"+cr+")"),hr=new RegExp("^(?:"+ve+"|"+Pe+")"),P=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+Kn.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(hr.source+"\\s*$"),/^$/,!1]];function pr(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 u=e.src.slice(o,t),l=0;for(;l<P.length&&!P[l][0].test(u);l++);if(l===P.length)return!1;if(i)return P[l][2];let s=n+1;if(!P[l][1].test(u)){for(;s<r&&!(e.sCount[s]<e.blkIndent);s++)if(o=e.bMarks[s]+e.tShift[s],t=e.eMarks[s],u=e.src.slice(o,t),P[l][1].test(u)){u.length!==0&&s++;break}}e.line=s;const c=e.push("html_block","",0);return c.map=[n,s],c.content=e.getLines(n,s,e.blkIndent,!0),!0}function ar(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 u=e.src.charCodeAt(o);if(u!==35||o>=t)return!1;let l=1;for(u=e.src.charCodeAt(++o);u===35&&o<t&&l<=6;)l++,u=e.src.charCodeAt(++o);if(l>6||o<t&&!A(u))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 c=e.push("heading_open","h"+String(l),1);c.markup="########".slice(0,l),c.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(l),-1);return p.markup="########".slice(0,l),!0}function dr(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,u,l=n+1;for(;l<r&&!e.isEmpty(l);l++){if(e.sCount[l]-e.blkIndent>3)continue;if(e.sCount[l]>=e.blkIndent){let a=e.bMarks[l]+e.tShift[l];const f=e.eMarks[l];if(a<f&&(u=e.src.charCodeAt(a),(u===45||u===61)&&(a=e.skipChars(a,u),a=e.skipSpaces(a),a>=f))){t=u===61?1:2;break}}if(e.sCount[l]<0)continue;let d=!1;for(let a=0,f=i.length;a<f;a++)if(i[a](e,l,r,!0)){d=!0;break}if(d)break}if(!t)return!1;const s=e.getLines(n,l,e.blkIndent,!1).trim();e.line=l+1;const c=e.push("heading_open","h"+String(t),1);c.markup=String.fromCharCode(u),c.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(u),e.parentType=o,!0}function kr(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 c=!1;for(let h=0,p=i.length;h<p;h++)if(i[h](e,t,r,!0)){c=!0;break}if(c)break}const u=e.getLines(n,t,e.blkIndent,!1).trim();e.line=t;const l=e.push("paragraph_open","p",1);l.map=[n,e.line];const s=e.push("inline","",0);return s.content=u,s.map=[n,e.line],s.children=[],e.push("paragraph_close","p",-1),e.parentType=o,!0}const G=[["table",Hn,["paragraph","reference"]],["code",Gn],["fence",Wn,["paragraph","reference","blockquote","list"]],["blockquote",Qn,["paragraph","reference","blockquote","list"]],["hr",Jn,["paragraph","reference","blockquote","list"]],["list",Xn,["paragraph","reference","blockquote"]],["reference",Yn],["html_block",pr,["paragraph","reference","blockquote"]],["heading",ar,["paragraph","reference","blockquote"]],["lheading",dr],["paragraph",kr]];function X(){this.ruler=new E;for(let e=0;e<G.length;e++)this.ruler.push(G[e][0],G[e][1],{alt:(G[e][2]||[]).slice()})}X.prototype.tokenize=function(e,n,r){const i=this.ruler.getRules(""),o=i.length,t=e.md.options.maxNesting;let u=n,l=!1;for(;u<r&&(e.line=u=e.skipEmptyLines(u),!(u>=r||e.sCount[u]<e.blkIndent));){if(e.level>=t){e.line=r;break}const s=e.line;let c=!1;for(let h=0;h<o;h++)if(c=i[h](e,u,r,!1),c){if(s>=e.line)throw new Error("block rule didn't increment state.line");break}if(!c)throw new Error("none of the block rules matched");e.tight=!l,e.isEmpty(e.line-1)&&(l=!0),u=e.line,u<r&&e.isEmpty(u)&&(l=!0,u++,e.line=u)}};X.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)};X.prototype.State=w;function U(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}U.prototype.pushPending=function(){const e=new B("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e};U.prototype.push=function(e,n,r){this.pending&&this.pushPending();const i=new B(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};U.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 u=t-e,l=t<r?this.src.charCodeAt(t):32,s=q(o)||j(String.fromCharCode(o)),c=q(l)||j(String.fromCharCode(l)),h=$(o),p=$(l),d=!p&&(!c||h||s),a=!h&&(!s||p||c);return{can_open:d&&(n||!a||s),can_close:a&&(n||!d||c),length:u}};U.prototype.Token=B;function Dr(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 xr(e,n){let r=e.pos;for(;r<e.posMax&&!Dr(e.src.charCodeAt(r));)r++;return r===e.pos?!1:(n||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)}const Cr=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function mr(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(Cr);if(!o)return!1;const t=o[1],u=e.md.linkify.matchAtStart(e.src.slice(r-t.length));if(!u)return!1;let l=u.url;if(l.length<=t.length)return!1;l=l.replace(/\*+$/,"");const s=e.md.normalizeLink(l);if(!e.md.validateLink(s))return!1;if(!n){e.pending=e.pending.slice(0,-t.length);const c=e.push("link_open","a",1);c.attrs=[["href",s]],c.markup="linkify",c.info="auto";const h=e.push("text","",0);h.content=e.md.normalizeLinkText(l);const p=e.push("link_close","a",-1);p.markup="linkify",p.info="auto"}return e.pos+=l.length-t.length,!0}function Fr(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 se=[];for(let e=0;e<256;e++)se.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){se[e.charCodeAt(0)]=1});function gr(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 l=e.src.charCodeAt(r+1);l>=56320&&l<=57343&&(t+=e.src[r+1],r++)}const u="\\"+t;if(!n){const l=e.push("text_special","",0);o<256&&se[o]!==0?l.content=t:l.content=u,l.markup=u,l.info="escape"}return e.pos=r+1,!0}function _r(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 u=e.src.slice(o,r),l=u.length;if(e.backticksScanned&&(e.backticks[l]||0)<=o)return n||(e.pending+=u),e.pos+=l,!0;let s=r,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<t&&e.src.charCodeAt(s)===96;)s++;const h=s-c;if(h===l){if(!n){const p=e.push("code_inline","code",0);p.markup=u,p.content=e.src.slice(r,c).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=s,!0}e.backticks[h]=c}return e.backticksScanned=!0,n||(e.pending+=u),e.pos+=l,!0}function Ar(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 u=String.fromCharCode(i);if(t<2)return!1;let l;t%2&&(l=e.push("text","",0),l.content=u,t--);for(let s=0;s<t;s+=2)l=e.push("text","",0),l.content=u+u,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 _e(e,n){let r;const i=[],o=n.length;for(let t=0;t<o;t++){const u=n[t];if(u.marker!==126||u.end===-1)continue;const l=n[u.end];r=e.tokens[u.token],r.type="s_open",r.tag="s",r.nesting=1,r.markup="~~",r.content="",r=e.tokens[l.token],r.type="s_close",r.tag="s",r.nesting=-1,r.markup="~~",r.content="",e.tokens[l.token-1].type==="text"&&e.tokens[l.token-1].content==="~"&&i.push(l.token-1)}for(;i.length;){const t=i.pop();let u=t+1;for(;u<e.tokens.length&&e.tokens[u].type==="s_close";)u++;u--,t!==u&&(r=e.tokens[u],e.tokens[u]=e.tokens[t],e.tokens[t]=r)}}function br(e){const n=e.tokens_meta,r=e.tokens_meta.length;_e(e,e.delimiters);for(let i=0;i<r;i++)n[i]&&n[i].delimiters&&_e(e,n[i].delimiters)}var Re={tokenize:Ar,postProcess:br};function Er(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 u=e.push("text","",0);u.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 Ae(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],u=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,l=String.fromCharCode(o.marker),s=e.tokens[o.token];s.type=u?"strong_open":"em_open",s.tag=u?"strong":"em",s.nesting=1,s.markup=u?l+l:l,s.content="";const c=e.tokens[t.token];c.type=u?"strong_close":"em_close",c.tag=u?"strong":"em",c.nesting=-1,c.markup=u?l+l:l,c.content="",u&&(e.tokens[n[i-1].token].content="",e.tokens[n[o.end+1].token].content="",i--)}}function yr(e){const n=e.tokens_meta,r=e.tokens_meta.length;Ae(e,e.delimiters);for(let i=0;i<r;i++)n[i]&&n[i].delimiters&&Ae(e,n[i].delimiters)}var Oe={tokenize:Er,postProcess:yr};function Sr(e,n){let r,i,o,t,u="",l="",s=e.pos,c=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const h=e.pos,p=e.posMax,d=e.pos+1,a=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(a<0)return!1;let f=a+1;if(f<p&&e.src.charCodeAt(f)===40){for(c=!1,f++;f<p&&(r=e.src.charCodeAt(f),!(!A(r)&&r!==10));f++);if(f>=p)return!1;if(s=f,o=e.md.helpers.parseLinkDestination(e.src,f,e.posMax),o.ok){for(u=e.md.normalizeLink(o.str),e.md.validateLink(u)?f=o.pos:u="",s=f;f<p&&(r=e.src.charCodeAt(f),!(!A(r)&&r!==10));f++);if(o=e.md.helpers.parseLinkTitle(e.src,f,e.posMax),f<p&&s!==f&&o.ok)for(l=o.str,f=o.pos;f<p&&(r=e.src.charCodeAt(f),!(!A(r)&&r!==10));f++);}(f>=p||e.src.charCodeAt(f)!==41)&&(c=!0),f++}if(c){if(typeof e.env.references=="undefined")return!1;if(f<p&&e.src.charCodeAt(f)===91?(s=f+1,f=e.md.helpers.parseLinkLabel(e,f),f>=0?i=e.src.slice(s,f++):f=a+1):f=a+1,i||(i=e.src.slice(d,a)),t=e.env.references[V(i)],!t)return e.pos=h,!1;u=t.href,l=t.title}if(!n){e.pos=d,e.posMax=a;const m=e.push("link_open","a",1),F=[["href",u]];m.attrs=F,l&&F.push(["title",l]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=f,e.posMax=p,!0}function Br(e,n){let r,i,o,t,u,l,s,c,h="";const p=e.pos,d=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const a=e.pos+2,f=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(f<0)return!1;if(t=f+1,t<d&&e.src.charCodeAt(t)===40){for(t++;t<d&&(r=e.src.charCodeAt(t),!(!A(r)&&r!==10));t++);if(t>=d)return!1;for(c=t,l=e.md.helpers.parseLinkDestination(e.src,t,e.posMax),l.ok&&(h=e.md.normalizeLink(l.str),e.md.validateLink(h)?t=l.pos:h=""),c=t;t<d&&(r=e.src.charCodeAt(t),!(!A(r)&&r!==10));t++);if(l=e.md.helpers.parseLinkTitle(e.src,t,e.posMax),t<d&&c!==t&&l.ok)for(s=l.str,t=l.pos;t<d&&(r=e.src.charCodeAt(t),!(!A(r)&&r!==10));t++);else s="";if(t>=d||e.src.charCodeAt(t)!==41)return e.pos=p,!1;t++}else{if(typeof e.env.references=="undefined")return!1;if(t<d&&e.src.charCodeAt(t)===91?(c=t+1,t=e.md.helpers.parseLinkLabel(e,t),t>=0?o=e.src.slice(c,t++):t=f+1):t=f+1,o||(o=e.src.slice(a,f)),u=e.env.references[V(o)],!u)return e.pos=p,!1;h=u.href,s=u.title}if(!n){i=e.src.slice(a,f);const m=[];e.md.inline.parse(i,e.md,e.env,m);const F=e.push("image","img",0),_=[["src",h],["alt",""]];F.attrs=_,F.children=m,F.content=i,s&&_.push(["title",s])}return e.pos=t,e.posMax=d,!0}const Mr=/^([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])?)*)$/,wr=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Tr(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 u=e.src.charCodeAt(r);if(u===60)return!1;if(u===62)break}const t=e.src.slice(i+1,r);if(wr.test(t)){const u=e.md.normalizeLink(t);if(!e.md.validateLink(u))return!1;if(!n){const l=e.push("link_open","a",1);l.attrs=[["href",u]],l.markup="autolink",l.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(t);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=t.length+2,!0}if(Mr.test(t)){const u=e.md.normalizeLink("mailto:"+t);if(!e.md.validateLink(u))return!1;if(!n){const l=e.push("link_open","a",1);l.attrs=[["href",u]],l.markup="autolink",l.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(t);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=t.length+2,!0}return!1}function Ir(e){return/^<a[>\s]/i.test(e)}function vr(e){return/^<\/a\s*>/i.test(e)}function Pr(e){const n=e|32;return n>=97&&n<=122}function Rr(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(fr);if(!t)return!1;if(!n){const u=e.push("html_inline","",0);u.content=t[0],Ir(u.content)&&e.linkLevel++,vr(u.content)&&e.linkLevel--}return e.pos+=t[0].length,!0}const Or=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,zr=/^&([a-z][a-z0-9]{1,31});/i;function Lr(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(Or);if(t){if(!n){const u=t[1][0].toLowerCase()==="x"?parseInt(t[1].slice(1),16):parseInt(t[1],10),l=e.push("text_special","",0);l.content=ue(u)?Q(u):Q(65533),l.markup=t[0],l.info="entity"}return e.pos+=t[0].length,!0}}else{const t=e.src.slice(r).match(zr);if(t){const u=Ee(t[0]);if(u!==t[0]){if(!n){const l=e.push("text_special","",0);l.content=u,l.markup=t[0],l.info="entity"}return e.pos+=t[0].length,!0}}}return!1}function be(e){const n={},r=e.length;if(!r)return;let i=0,o=-2;const t=[];for(let u=0;u<r;u++){const l=e[u];if(t.push(0),(e[i].marker!==l.marker||o!==l.token-1)&&(i=u),o=l.token,l.length=l.length||0,!l.close)continue;n.hasOwnProperty(l.marker)||(n[l.marker]=[-1,-1,-1,-1,-1,-1]);const s=n[l.marker][(l.open?3:0)+l.length%3];let c=i-t[i]-1,h=c;for(;c>s;c-=t[c]+1){const p=e[c];if(p.marker===l.marker&&p.open&&p.end<0){let d=!1;if((p.close||l.open)&&(p.length+l.length)%3===0&&(p.length%3!==0||l.length%3!==0)&&(d=!0),!d){const a=c>0&&!e[c-1].open?t[c-1]+1:0;t[u]=u-c+a,t[c]=a,l.open=!1,p.end=u,p.close=!1,h=-1,o=-2;break}}}h!==-1&&(n[l.marker][(l.open?3:0)+(l.length||0)%3]=h)}}function $r(e){const n=e.tokens_meta,r=e.tokens_meta.length;be(e.delimiters);for(let i=0;i<r;i++)n[i]&&n[i].delimiters&&be(n[i].delimiters)}function jr(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 ne=[["text",xr],["linkify",mr],["newline",Fr],["escape",gr],["backticks",_r],["strikethrough",Re.tokenize],["emphasis",Oe.tokenize],["link",Sr],["image",Br],["autolink",Tr],["html_inline",Rr],["entity",Lr]],re=[["balance_pairs",$r],["strikethrough",Re.postProcess],["emphasis",Oe.postProcess],["fragments_join",jr]];function Z(){this.ruler=new E;for(let e=0;e<ne.length;e++)this.ruler.push(ne[e][0],ne[e][1]);this.ruler2=new E;for(let e=0;e<re.length;e++)this.ruler2.push(re[e][0],re[e][1])}Z.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]!="undefined"){e.pos=t[n];return}let u=!1;if(e.level<o){for(let l=0;l<i;l++)if(e.level++,u=r[l](e,!0),e.level--,u){if(n>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;u||e.pos++,t[n]=e.pos};Z.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 u=!1;if(e.level<o){for(let l=0;l<r;l++)if(u=n[l](e,!1),u){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(u){if(e.pos>=i)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};Z.prototype.parse=function(e,n,r,i){const o=new this.State(e,n,r,i);this.tokenize(o);const t=this.ruler2.getRules(""),u=t.length;for(let l=0;l<u;l++)t[l](o)};Z.prototype.State=U;var qr={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},Nr={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},Ur={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",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"]}}};const Zr={default:qr,zero:Nr,commonmark:Ur},Hr=/^(vbscript|javascript|file|data):/,Gr=/^data:image\/(gif|png|jpeg|webp);/;function Wr(e){const n=e.trim().toLowerCase();return Hr.test(n)?Gr.test(n):!0}const ze=["http:","https:","mailto:"];function Qr(e){const n=oe(e,!0);if(n.hostname&&(!n.protocol||ze.indexOf(n.protocol)>=0))try{n.hostname=ye.toASCII(n.hostname)}catch{}return N(te(n))}function Jr(e){const n=oe(e,!0);if(n.hostname&&(!n.protocol||ze.indexOf(n.protocol)>=0))try{n.hostname=ye.toUnicode(n.hostname)}catch{}return R(te(n),R.defaultChars+"%")}function S(e,n){if(!(this instanceof S))return new S(e,n);n||ie(e)||(n=e||{},e="default"),this.inline=new Z,this.block=new X,this.core=new le,this.renderer=new z,this.linkify=new qe,this.validateLink=Wr,this.normalizeLink=Qr,this.normalizeLinkText=Jr,this.utils=Fn,this.helpers=J({},bn),this.options={},this.configure(e),n&&this.set(n)}S.prototype.set=function(e){return J(this.options,e),this};S.prototype.configure=function(e){const n=this;if(ie(e)){const r=e;if(e=Zr[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};S.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};S.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};S.prototype.use=function(e){const n=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,n),this};S.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};S.prototype.render=function(e,n){return n=n||{},this.renderer.render(this.parse(e,n),this.options,n)};S.prototype.parseInline=function(e,n){const r=new this.core.State(e,this,n);return r.inlineMode=!0,this.core.process(r),r.tokens};S.prototype.renderInline=function(e,n){return n=n||{},this.renderer.render(this.parseInline(e,n),this.options,n)};export{S as M};