8 lines
48 KiB
TypeScript
8 lines
48 KiB
TypeScript
/**
|
||
* Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
|
||
* Original file: /npm/markdown-it@14.1.0/index.mjs
|
||
*
|
||
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||
*/
|
||
import*as t from"/npm/mdurl@2.0.0/+esm";import*as e from"/npm/uc.micro@2.1.0/+esm";import{decodeHTML as n}from"/npm/entities@4.5.0/+esm";import r from"/npm/linkify-it@5.0.0/+esm";import s from"/npm/punycode.js@2.3.1/+esm";function o(t){return"[object String]"===function(t){return Object.prototype.toString.call(t)}(t)}const i=Object.prototype.hasOwnProperty;function c(t){return Array.prototype.slice.call(arguments,1).forEach((function(e){if(e){if("object"!=typeof e)throw new TypeError(e+"must be object");Object.keys(e).forEach((function(n){t[n]=e[n]}))}})),t}function l(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function a(t){return!(t>=55296&&t<=57343)&&(!(t>=64976&&t<=65007)&&(!!(65535&~t&&65534!=(65535&t))&&(!(t>=0&&t<=8)&&(11!==t&&(!(t>=14&&t<=31)&&(!(t>=127&&t<=159)&&!(t>1114111)))))))}function h(t){if(t>65535){const e=55296+((t-=65536)>>10),n=56320+(1023&t);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const u=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,p=new RegExp(u.source+"|"+/&([a-z#][a-z0-9]{1,31});/gi.source,"gi"),f=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function d(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(p,(function(t,e,r){return e||function(t,e){if(35===e.charCodeAt(0)&&f.test(e)){const n="x"===e[1].toLowerCase()?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return a(n)?h(n):t}const r=n(t);return r!==t?r:t}(t,r)}))}const k=/[&<>"]/,m=/[&<>"]/g,g={"&":"&","<":"<",">":">",'"':"""};function b(t){return g[t]}function _(t){return k.test(t)?t.replace(m,b):t}const C=/[.?*+^$[\]\\(){}|-]/g;function y(t){switch(t){case 9:case 32:return!0}return!1}function A(t){if(t>=8192&&t<=8202)return!0;switch(t){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 x(t){return e.P.test(t)||e.S.test(t)}function M(t){switch(t){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(t){return t=t.trim().replace(/\s+/g," "),"Ṿ"==="ẞ".toLowerCase()&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const w={mdurl:t,ucmicro:e};var S=Object.freeze({__proto__:null,lib:w,assign:c,isString:o,has:function(t,e){return i.call(t,e)},unescapeMd:function(t){return t.indexOf("\\")<0?t:t.replace(u,"$1")},unescapeAll:d,isValidEntityCode:a,fromCodePoint:h,escapeHtml:_,arrayReplaceAt:l,isSpace:y,isWhiteSpace:A,isMdAsciiPunct:M,isPunctChar:x,escapeRE:function(t){return t.replace(C,"\\$&")},normalizeReference:v});var I=Object.freeze({__proto__:null,parseLinkLabel:function(t,e,n){let r,s,o,i;const c=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos<c;){if(o=t.src.charCodeAt(t.pos),93===o&&(r--,0===r)){s=!0;break}if(i=t.pos,t.md.inline.skipToken(t),91===o)if(i===t.pos-1)r++;else if(n)return t.pos=l,-1}let a=-1;return s&&(a=t.pos),t.pos=l,a},parseLinkDestination:function(t,e,n){let r,s=e;const o={ok:!1,pos:0,str:""};if(60===t.charCodeAt(s)){for(s++;s<n;){if(r=t.charCodeAt(s),10===r)return o;if(60===r)return o;if(62===r)return o.pos=s+1,o.str=d(t.slice(e+1,s)),o.ok=!0,o;92===r&&s+1<n?s+=2:s++}return o}let i=0;for(;s<n&&(r=t.charCodeAt(s),32!==r)&&!(r<32||127===r);)if(92===r&&s+1<n){if(32===t.charCodeAt(s+1))break;s+=2}else{if(40===r&&(i++,i>32))return o;if(41===r){if(0===i)break;i--}s++}return e===s||0!==i||(o.str=d(t.slice(e,s)),o.pos=s,o.ok=!0),o},parseLinkTitle:function(t,e,n,r){let s,o=e;const i={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)i.str=r.str,i.marker=r.marker;else{if(o>=n)return i;let r=t.charCodeAt(o);if(34!==r&&39!==r&&40!==r)return i;e++,o++,40===r&&(r=41),i.marker=r}for(;o<n;){if(s=t.charCodeAt(o),s===i.marker)return i.pos=o+1,i.str+=d(t.slice(e,o)),i.ok=!0,i;if(40===s&&41===i.marker)return i;92===s&&o+1<n&&o++,o++}return i.can_continue=!0,i.str+=d(t.slice(e,o)),i}});const L={};function z(){this.rules=c({},L)}function T(){this.__rules__=[],this.__cache__=null}function E(t,e,n){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}function $(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}L.code_inline=function(t,e,n,r,s){const o=t[e];return"<code"+s.renderAttrs(o)+">"+_(o.content)+"</code>"},L.code_block=function(t,e,n,r,s){const o=t[e];return"<pre"+s.renderAttrs(o)+"><code>"+_(t[e].content)+"</code></pre>\n"},L.fence=function(t,e,n,r,s){const o=t[e],i=o.info?d(o.info).trim():"";let c,l="",a="";if(i){const t=i.split(/(\s+)/g);l=t[0],a=t.slice(2).join("")}if(c=n.highlight&&n.highlight(o.content,l,a)||_(o.content),0===c.indexOf("<pre"))return c+"\n";if(i){const t=o.attrIndex("class"),e=o.attrs?o.attrs.slice():[];t<0?e.push(["class",n.langPrefix+l]):(e[t]=e[t].slice(),e[t][1]+=" "+n.langPrefix+l);const r={attrs:e};return`<pre><code${s.renderAttrs(r)}>${c}</code></pre>\n`}return`<pre><code${s.renderAttrs(o)}>${c}</code></pre>\n`},L.image=function(t,e,n,r,s){const o=t[e];return o.attrs[o.attrIndex("alt")][1]=s.renderInlineAsText(o.children,n,r),s.renderToken(t,e,n)},L.hardbreak=function(t,e,n){return n.xhtmlOut?"<br />\n":"<br>\n"},L.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?"<br />\n":"<br>\n":"\n"},L.text=function(t,e){return _(t[e].content)},L.html_block=function(t,e){return t[e].content},L.html_inline=function(t,e){return t[e].content},z.prototype.renderAttrs=function(t){let e,n,r;if(!t.attrs)return"";for(r="",e=0,n=t.attrs.length;e<n;e++)r+=" "+_(t.attrs[e][0])+'="'+_(t.attrs[e][1])+'"';return r},z.prototype.renderToken=function(t,e,n){const r=t[e];let s="";if(r.hidden)return"";r.block&&-1!==r.nesting&&e&&t[e-1].hidden&&(s+="\n"),s+=(-1===r.nesting?"</":"<")+r.tag,s+=this.renderAttrs(r),0===r.nesting&&n.xhtmlOut&&(s+=" /");let o=!1;if(r.block&&(o=!0,1===r.nesting&&e+1<t.length)){const n=t[e+1];("inline"===n.type||n.hidden||-1===n.nesting&&n.tag===r.tag)&&(o=!1)}return s+=o?">\n":">",s},z.prototype.renderInline=function(t,e,n){let r="";const s=this.rules;for(let o=0,i=t.length;o<i;o++){const i=t[o].type;void 0!==s[i]?r+=s[i](t,o,e,n,this):r+=this.renderToken(t,o,e)}return r},z.prototype.renderInlineAsText=function(t,e,n){let r="";for(let s=0,o=t.length;s<o;s++)switch(t[s].type){case"text":case"html_inline":case"html_block":r+=t[s].content;break;case"image":r+=this.renderInlineAsText(t[s].children,e,n);break;case"softbreak":case"hardbreak":r+="\n"}return r},z.prototype.render=function(t,e,n){let r="";const s=this.rules;for(let o=0,i=t.length;o<i;o++){const i=t[o].type;"inline"===i?r+=this.renderInline(t[o].children,e,n):void 0!==s[i]?r+=s[i](t,o,e,n,this):r+=this.renderToken(t,o,e,n)}return r},T.prototype.__find__=function(t){for(let e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1},T.prototype.__compile__=function(){const t=this,e=[""];t.__rules__.forEach((function(t){t.enabled&&t.alt.forEach((function(t){e.indexOf(t)<0&&e.push(t)}))})),t.__cache__={},e.forEach((function(e){t.__cache__[e]=[],t.__rules__.forEach((function(n){n.enabled&&(e&&n.alt.indexOf(e)<0||t.__cache__[e].push(n.fn))}))}))},T.prototype.at=function(t,e,n){const r=this.__find__(t),s=n||{};if(-1===r)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=s.alt||[],this.__cache__=null},T.prototype.before=function(t,e,n,r){const s=this.__find__(t),o=r||{};if(-1===s)throw new Error("Parser rule not found: "+t);this.__rules__.splice(s,0,{name:e,enabled:!0,fn:n,alt:o.alt||[]}),this.__cache__=null},T.prototype.after=function(t,e,n,r){const s=this.__find__(t),o=r||{};if(-1===s)throw new Error("Parser rule not found: "+t);this.__rules__.splice(s+1,0,{name:e,enabled:!0,fn:n,alt:o.alt||[]}),this.__cache__=null},T.prototype.push=function(t,e,n){const r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null},T.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach((function(t){const r=this.__find__(t);if(r<0){if(e)return;throw new Error("Rules manager: invalid rule name "+t)}this.__rules__[r].enabled=!0,n.push(t)}),this),this.__cache__=null,n},T.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach((function(t){t.enabled=!1})),this.enable(t,e)},T.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach((function(t){const r=this.__find__(t);if(r<0){if(e)return;throw new Error("Rules manager: invalid rule name "+t)}this.__rules__[r].enabled=!1,n.push(t)}),this),this.__cache__=null,n},T.prototype.getRules=function(t){return null===this.__cache__&&this.__compile__(),this.__cache__[t]||[]},E.prototype.attrIndex=function(t){if(!this.attrs)return-1;const e=this.attrs;for(let n=0,r=e.length;n<r;n++)if(e[n][0]===t)return n;return-1},E.prototype.attrPush=function(t){this.attrs?this.attrs.push(t):this.attrs=[t]},E.prototype.attrSet=function(t,e){const n=this.attrIndex(t),r=[t,e];n<0?this.attrPush(r):this.attrs[n]=r},E.prototype.attrGet=function(t){const e=this.attrIndex(t);let n=null;return e>=0&&(n=this.attrs[e][1]),n},E.prototype.attrJoin=function(t,e){const n=this.attrIndex(t);n<0?this.attrPush([t,e]):this.attrs[n][1]=this.attrs[n][1]+" "+e},$.prototype.Token=E;const O=/\r\n?|\n/g,q=/\0/g;function P(t){return/^<\/a\s*>/i.test(t)}const j=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,R=/\((c|tm|r)\)/i,Z=/\((c|tm|r)\)/gi,D={c:"©",r:"®",tm:"™"};function N(t,e){return D[e.toLowerCase()]}function B(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];"text"!==r.type||e||(r.content=r.content.replace(Z,N)),"link_open"===r.type&&"auto"===r.info&&e--,"link_close"===r.type&&"auto"===r.info&&e++}}function W(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];"text"!==r.type||e||j.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1—").replace(/(^|\s)--(?=\s|$)/gm,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1–")),"link_open"===r.type&&"auto"===r.info&&e--,"link_close"===r.type&&"auto"===r.info&&e++}}const F=/['"]/,U=/['"]/g;function G(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function H(t,e){let n;const r=[];for(let s=0;s<t.length;s++){const o=t[s],i=t[s].level;for(n=r.length-1;n>=0&&!(r[n].level<=i);n--);if(r.length=n+1,"text"!==o.type)continue;let c=o.content,l=0,a=c.length;t:for(;l<a;){U.lastIndex=l;const h=U.exec(c);if(!h)break;let u=!0,p=!0;l=h.index+1;const f="'"===h[0];let d=32;if(h.index-1>=0)d=c.charCodeAt(h.index-1);else for(n=s-1;n>=0&&("softbreak"!==t[n].type&&"hardbreak"!==t[n].type);n--)if(t[n].content){d=t[n].content.charCodeAt(t[n].content.length-1);break}let k=32;if(l<a)k=c.charCodeAt(l);else for(n=s+1;n<t.length&&("softbreak"!==t[n].type&&"hardbreak"!==t[n].type);n++)if(t[n].content){k=t[n].content.charCodeAt(0);break}const m=M(d)||x(String.fromCharCode(d)),g=M(k)||x(String.fromCharCode(k)),b=A(d),_=A(k);if(_?u=!1:g&&(b||m||(u=!1)),b?p=!1:m&&(_||g||(p=!1)),34===k&&'"'===h[0]&&d>=48&&d<=57&&(p=u=!1),u&&p&&(u=m,p=g),u||p){if(p)for(n=r.length-1;n>=0;n--){let u=r[n];if(r[n].level<i)break;if(u.single===f&&r[n].level===i){let i,p;u=r[n],f?(i=e.md.options.quotes[2],p=e.md.options.quotes[3]):(i=e.md.options.quotes[0],p=e.md.options.quotes[1]),o.content=G(o.content,h.index,p),t[u.token].content=G(t[u.token].content,u.pos,i),l+=p.length-1,u.token===s&&(l+=i.length-1),c=o.content,a=c.length,r.length=n;continue t}}u?r.push({token:s,pos:h.index,single:f,level:i}):p&&f&&(o.content=G(o.content,h.index,"’"))}else f&&(o.content=G(o.content,h.index,"’"))}}}const J=[["normalize",function(t){let e;e=t.src.replace(O,"\n"),e=e.replace(q,"<EFBFBD>"),t.src=e}],["block",function(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}],["inline",function(t){const e=t.tokens;for(let n=0,r=e.length;n<r;n++){const r=e[n];"inline"===r.type&&t.md.inline.parse(r.content,t.md,t.env,r.children)}}],["linkify",function(t){const e=t.tokens;var n;if(t.md.options.linkify)for(let r=0,s=e.length;r<s;r++){if("inline"!==e[r].type||!t.md.linkify.pretest(e[r].content))continue;let s=e[r].children,o=0;for(let i=s.length-1;i>=0;i--){const c=s[i];if("link_close"!==c.type){if("html_inline"===c.type&&(n=c.content,/^<a[>\s]/i.test(n)&&o>0&&o--,P(c.content)&&o++),!(o>0)&&"text"===c.type&&t.md.linkify.test(c.content)){const n=c.content;let o=t.md.linkify.match(n);const a=[];let h=c.level,u=0;o.length>0&&0===o[0].index&&i>0&&"text_special"===s[i-1].type&&(o=o.slice(1));for(let e=0;e<o.length;e++){const r=o[e].url,s=t.md.normalizeLink(r);if(!t.md.validateLink(s))continue;let i=o[e].text;i=o[e].schema?"mailto:"!==o[e].schema||/^mailto:/i.test(i)?t.md.normalizeLinkText(i):t.md.normalizeLinkText("mailto:"+i).replace(/^mailto:/,""):t.md.normalizeLinkText("http://"+i).replace(/^http:\/\//,"");const c=o[e].index;if(c>u){const e=new t.Token("text","",0);e.content=n.slice(u,c),e.level=h,a.push(e)}const l=new t.Token("link_open","a",1);l.attrs=[["href",s]],l.level=h++,l.markup="linkify",l.info="auto",a.push(l);const p=new t.Token("text","",0);p.content=i,p.level=h,a.push(p);const f=new t.Token("link_close","a",-1);f.level=--h,f.markup="linkify",f.info="auto",a.push(f),u=o[e].lastIndex}if(u<n.length){const e=new t.Token("text","",0);e.content=n.slice(u),e.level=h,a.push(e)}e[r].children=s=l(s,i,a)}}else for(i--;s[i].level!==c.level&&"link_open"!==s[i].type;)i--}}}],["replacements",function(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)"inline"===t.tokens[e].type&&(R.test(t.tokens[e].content)&&B(t.tokens[e].children),j.test(t.tokens[e].content)&&W(t.tokens[e].children))}],["smartquotes",function(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)"inline"===t.tokens[e].type&&F.test(t.tokens[e].content)&&H(t.tokens[e].children,t)}],["text_join",function(t){let e,n;const r=t.tokens,s=r.length;for(let t=0;t<s;t++){if("inline"!==r[t].type)continue;const s=r[t].children,o=s.length;for(e=0;e<o;e++)"text_special"===s[e].type&&(s[e].type="text");for(e=n=0;e<o;e++)"text"===s[e].type&&e+1<o&&"text"===s[e+1].type?s[e+1].content=s[e].content+s[e+1].content:(e!==n&&(s[n]=s[e]),n++);e!==n&&(s.length=n)}}]];function V(){this.ruler=new T;for(let t=0;t<J.length;t++)this.ruler.push(J[t][0],J[t][1])}function K(t,e,n,r){this.src=t,this.md=e,this.env=n,this.tokens=r,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 s=this.src;for(let t=0,e=0,n=0,r=0,o=s.length,i=!1;e<o;e++){const c=s.charCodeAt(e);if(!i){if(y(c)){n++,9===c?r+=4-r%4:r++;continue}i=!0}10!==c&&e!==o-1||(10!==c&&e++,this.bMarks.push(t),this.eMarks.push(e),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),i=!1,n=0,r=0,t=e+1)}this.bMarks.push(s.length),this.eMarks.push(s.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}V.prototype.process=function(t){const e=this.ruler.getRules("");for(let n=0,r=e.length;n<r;n++)e[n](t)},V.prototype.State=$,K.prototype.push=function(t,e,n){const r=new E(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},K.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},K.prototype.skipEmptyLines=function(t){for(let e=this.lineMax;t<e&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t},K.prototype.skipSpaces=function(t){for(let e=this.src.length;t<e;t++){if(!y(this.src.charCodeAt(t)))break}return t},K.prototype.skipSpacesBack=function(t,e){if(t<=e)return t;for(;t>e;)if(!y(this.src.charCodeAt(--t)))return t+1;return t},K.prototype.skipChars=function(t,e){for(let n=this.src.length;t<n&&this.src.charCodeAt(t)===e;t++);return t},K.prototype.skipCharsBack=function(t,e,n){if(t<=n)return t;for(;t>n;)if(e!==this.src.charCodeAt(--t))return t+1;return t},K.prototype.getLines=function(t,e,n,r){if(t>=e)return"";const s=new Array(e-t);for(let o=0,i=t;i<e;i++,o++){let t=0;const c=this.bMarks[i];let l,a=c;for(l=i+1<e||r?this.eMarks[i]+1:this.eMarks[i];a<l&&t<n;){const e=this.src.charCodeAt(a);if(y(e))9===e?t+=4-(t+this.bsCount[i])%4:t++;else{if(!(a-c<this.tShift[i]))break;t++}a++}s[o]=t>n?new Array(t-n+1).join(" ")+this.src.slice(a,l):this.src.slice(a,l)}return s.join("")},K.prototype.Token=E;function Q(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function X(t){const e=[],n=t.length;let r=0,s=t.charCodeAt(r),o=!1,i=0,c="";for(;r<n;)124===s&&(o?(c+=t.substring(i,r-1),i=r):(e.push(c+t.substring(i,r)),c="",i=r+1)),o=92===s,r++,s=t.charCodeAt(r);return e.push(c+t.substring(i)),e}function Y(t,e){const n=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const s=t.src.charCodeAt(r++);if(42!==s&&45!==s&&43!==s)return-1;if(r<n){if(!y(t.src.charCodeAt(r)))return-1}return r}function tt(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let s=n;if(s+1>=r)return-1;let o=t.src.charCodeAt(s++);if(o<48||o>57)return-1;for(;;){if(s>=r)return-1;if(o=t.src.charCodeAt(s++),!(o>=48&&o<=57)){if(41===o||46===o)break;return-1}if(s-n>=10)return-1}return s<r&&(o=t.src.charCodeAt(s),!y(o))?-1:s}const et="<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",nt="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",rt=new RegExp("^(?:"+et+"|"+nt+"|\x3c!---?>|\x3c!--(?:[^-]|-[^-]|--[^>])*--\x3e|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),st=new RegExp("^(?:"+et+"|"+nt+")"),ot=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+["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"].join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(st.source+"\\s*$"),/^$/,!1]];const it=[["table",function(t,e,n,r){if(e+2>n)return!1;let s=e+1;if(t.sCount[s]<t.blkIndent)return!1;if(t.sCount[s]-t.blkIndent>=4)return!1;let o=t.bMarks[s]+t.tShift[s];if(o>=t.eMarks[s])return!1;const i=t.src.charCodeAt(o++);if(124!==i&&45!==i&&58!==i)return!1;if(o>=t.eMarks[s])return!1;const c=t.src.charCodeAt(o++);if(124!==c&&45!==c&&58!==c&&!y(c))return!1;if(45===i&&y(c))return!1;for(;o<t.eMarks[s];){const e=t.src.charCodeAt(o);if(124!==e&&45!==e&&58!==e&&!y(e))return!1;o++}let l=Q(t,e+1),a=l.split("|");const h=[];for(let t=0;t<a.length;t++){const e=a[t].trim();if(!e){if(0===t||t===a.length-1)continue;return!1}if(!/^:?-+:?$/.test(e))return!1;58===e.charCodeAt(e.length-1)?h.push(58===e.charCodeAt(0)?"center":"right"):58===e.charCodeAt(0)?h.push("left"):h.push("")}if(l=Q(t,e).trim(),-1===l.indexOf("|"))return!1;if(t.sCount[e]-t.blkIndent>=4)return!1;a=X(l),a.length&&""===a[0]&&a.shift(),a.length&&""===a[a.length-1]&&a.pop();const u=a.length;if(0===u||u!==h.length)return!1;if(r)return!0;const p=t.parentType;t.parentType="table";const f=t.md.block.ruler.getRules("blockquote"),d=[e,0];t.push("table_open","table",1).map=d,t.push("thead_open","thead",1).map=[e,e+1],t.push("tr_open","tr",1).map=[e,e+1];for(let e=0;e<a.length;e++){const n=t.push("th_open","th",1);h[e]&&(n.attrs=[["style","text-align:"+h[e]]]);const r=t.push("inline","",0);r.content=a[e].trim(),r.children=[],t.push("th_close","th",-1)}let k;t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let m=0;for(s=e+2;s<n&&!(t.sCount[s]<t.blkIndent);s++){let r=!1;for(let e=0,o=f.length;e<o;e++)if(f[e](t,s,n,!0)){r=!0;break}if(r)break;if(l=Q(t,s).trim(),!l)break;if(t.sCount[s]-t.blkIndent>=4)break;if(a=X(l),a.length&&""===a[0]&&a.shift(),a.length&&""===a[a.length-1]&&a.pop(),m+=u-a.length,m>65536)break;if(s===e+2){t.push("tbody_open","tbody",1).map=k=[e+2,0]}t.push("tr_open","tr",1).map=[s,s+1];for(let e=0;e<u;e++){const n=t.push("td_open","td",1);h[e]&&(n.attrs=[["style","text-align:"+h[e]]]);const r=t.push("inline","",0);r.content=a[e]?a[e].trim():"",r.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return k&&(t.push("tbody_close","tbody",-1),k[1]=s),t.push("table_close","table",-1),d[1]=s,t.parentType=p,t.line=s,!0},["paragraph","reference"]],["code",function(t,e,n){if(t.sCount[e]-t.blkIndent<4)return!1;let r=e+1,s=r;for(;r<n;)if(t.isEmpty(r))r++;else{if(!(t.sCount[r]-t.blkIndent>=4))break;r++,s=r}t.line=s;const o=t.push("code_block","code",0);return o.content=t.getLines(e,s,4+t.blkIndent,!1)+"\n",o.map=[e,t.line],!0}],["fence",function(t,e,n,r){let s=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(s+3>o)return!1;const i=t.src.charCodeAt(s);if(126!==i&&96!==i)return!1;let c=s;s=t.skipChars(s,i);let l=s-c;if(l<3)return!1;const a=t.src.slice(c,s),h=t.src.slice(s,o);if(96===i&&h.indexOf(String.fromCharCode(i))>=0)return!1;if(r)return!0;let u=e,p=!1;for(;(u++,!(u>=n))&&(s=c=t.bMarks[u]+t.tShift[u],o=t.eMarks[u],!(s<o&&t.sCount[u]<t.blkIndent));)if(t.src.charCodeAt(s)===i&&!(t.sCount[u]-t.blkIndent>=4||(s=t.skipChars(s,i),s-c<l||(s=t.skipSpaces(s),s<o)))){p=!0;break}l=t.sCount[e],t.line=u+(p?1:0);const f=t.push("fence","code",0);return f.info=h,f.content=t.getLines(e+1,u,l,!0),f.markup=a,f.map=[e,t.line],!0},["paragraph","reference","blockquote","list"]],["blockquote",function(t,e,n,r){let s=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];const i=t.lineMax;if(t.sCount[e]-t.blkIndent>=4)return!1;if(62!==t.src.charCodeAt(s))return!1;if(r)return!0;const c=[],l=[],a=[],h=[],u=t.md.block.ruler.getRules("blockquote"),p=t.parentType;t.parentType="blockquote";let f,d=!1;for(f=e;f<n;f++){const e=t.sCount[f]<t.blkIndent;if(s=t.bMarks[f]+t.tShift[f],o=t.eMarks[f],s>=o)break;if(62===t.src.charCodeAt(s++)&&!e){let e,n,r=t.sCount[f]+1;32===t.src.charCodeAt(s)?(s++,r++,n=!1,e=!0):9===t.src.charCodeAt(s)?(e=!0,(t.bsCount[f]+r)%4==3?(s++,r++,n=!1):n=!0):e=!1;let i=r;for(c.push(t.bMarks[f]),t.bMarks[f]=s;s<o;){const e=t.src.charCodeAt(s);if(!y(e))break;9===e?i+=4-(i+t.bsCount[f]+(n?1:0))%4:i++,s++}d=s>=o,l.push(t.bsCount[f]),t.bsCount[f]=t.sCount[f]+1+(e?1:0),a.push(t.sCount[f]),t.sCount[f]=i-r,h.push(t.tShift[f]),t.tShift[f]=s-t.bMarks[f];continue}if(d)break;let r=!1;for(let e=0,s=u.length;e<s;e++)if(u[e](t,f,n,!0)){r=!0;break}if(r){t.lineMax=f,0!==t.blkIndent&&(c.push(t.bMarks[f]),l.push(t.bsCount[f]),h.push(t.tShift[f]),a.push(t.sCount[f]),t.sCount[f]-=t.blkIndent);break}c.push(t.bMarks[f]),l.push(t.bsCount[f]),h.push(t.tShift[f]),a.push(t.sCount[f]),t.sCount[f]=-1}const k=t.blkIndent;t.blkIndent=0;const m=t.push("blockquote_open","blockquote",1);m.markup=">";const g=[e,0];m.map=g,t.md.block.tokenize(t,e,f),t.push("blockquote_close","blockquote",-1).markup=">",t.lineMax=i,t.parentType=p,g[1]=t.line;for(let n=0;n<h.length;n++)t.bMarks[n+e]=c[n],t.tShift[n+e]=h[n],t.sCount[n+e]=a[n],t.bsCount[n+e]=l[n];return t.blkIndent=k,!0},["paragraph","reference","blockquote","list"]],["hr",function(t,e,n,r){const s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let o=t.bMarks[e]+t.tShift[e];const i=t.src.charCodeAt(o++);if(42!==i&&45!==i&&95!==i)return!1;let c=1;for(;o<s;){const e=t.src.charCodeAt(o++);if(e!==i&&!y(e))return!1;e===i&&c++}if(c<3)return!1;if(r)return!0;t.line=e+1;const l=t.push("hr","hr",0);return l.map=[e,t.line],l.markup=Array(c+1).join(String.fromCharCode(i)),!0},["paragraph","reference","blockquote","list"]],["list",function(t,e,n,r){let s,o,i,c,l=e,a=!0;if(t.sCount[l]-t.blkIndent>=4)return!1;if(t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]<t.blkIndent)return!1;let h,u,p,f=!1;if(r&&"paragraph"===t.parentType&&t.sCount[l]>=t.blkIndent&&(f=!0),(p=tt(t,l))>=0){if(h=!0,i=t.bMarks[l]+t.tShift[l],u=Number(t.src.slice(i,p-1)),f&&1!==u)return!1}else{if(!((p=Y(t,l))>=0))return!1;h=!1}if(f&&t.skipSpaces(p)>=t.eMarks[l])return!1;if(r)return!0;const d=t.src.charCodeAt(p-1),k=t.tokens.length;h?(c=t.push("ordered_list_open","ol",1),1!==u&&(c.attrs=[["start",u]])):c=t.push("bullet_list_open","ul",1);const m=[l,0];c.map=m,c.markup=String.fromCharCode(d);let g=!1;const b=t.md.block.ruler.getRules("list"),_=t.parentType;for(t.parentType="list";l<n;){o=p,s=t.eMarks[l];const e=t.sCount[l]+p-(t.bMarks[l]+t.tShift[l]);let r=e;for(;o<s;){const e=t.src.charCodeAt(o);if(9===e)r+=4-(r+t.bsCount[l])%4;else{if(32!==e)break;r++}o++}const u=o;let f;f=u>=s?1:r-e,f>4&&(f=1);const k=e+f;c=t.push("list_item_open","li",1),c.markup=String.fromCharCode(d);const m=[l,0];c.map=m,h&&(c.info=t.src.slice(i,p-1));const _=t.tight,C=t.tShift[l],y=t.sCount[l],A=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=k,t.tight=!0,t.tShift[l]=u-t.bMarks[l],t.sCount[l]=r,u>=s&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,l,n,!0),t.tight&&!g||(a=!1),g=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=A,t.tShift[l]=C,t.sCount[l]=y,t.tight=_,c=t.push("list_item_close","li",-1),c.markup=String.fromCharCode(d),l=t.line,m[1]=l,l>=n)break;if(t.sCount[l]<t.blkIndent)break;if(t.sCount[l]-t.blkIndent>=4)break;let x=!1;for(let e=0,r=b.length;e<r;e++)if(b[e](t,l,n,!0)){x=!0;break}if(x)break;if(h){if(p=tt(t,l),p<0)break;i=t.bMarks[l]+t.tShift[l]}else if(p=Y(t,l),p<0)break;if(d!==t.src.charCodeAt(p-1))break}return c=h?t.push("ordered_list_close","ol",-1):t.push("bullet_list_close","ul",-1),c.markup=String.fromCharCode(d),m[1]=l,t.line=l,t.parentType=_,a&&function(t,e){const n=t.level+2;for(let r=e+2,s=t.tokens.length-2;r<s;r++)t.tokens[r].level===n&&"paragraph_open"===t.tokens[r].type&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}(t,k),!0},["paragraph","reference","blockquote"]],["reference",function(t,e,n,r){let s=t.bMarks[e]+t.tShift[e],o=t.eMarks[e],i=e+1;if(t.sCount[e]-t.blkIndent>=4)return!1;if(91!==t.src.charCodeAt(s))return!1;function c(e){const n=t.lineMax;if(e>=n||t.isEmpty(e))return null;let r=!1;if(t.sCount[e]-t.blkIndent>3&&(r=!0),t.sCount[e]<0&&(r=!0),!r){const r=t.md.block.ruler.getRules("reference"),s=t.parentType;t.parentType="reference";let o=!1;for(let s=0,i=r.length;s<i;s++)if(r[s](t,e,n,!0)){o=!0;break}if(t.parentType=s,o)return null}const s=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];return t.src.slice(s,o+1)}let l=t.src.slice(s,o+1);o=l.length;let a=-1;for(s=1;s<o;s++){const t=l.charCodeAt(s);if(91===t)return!1;if(93===t){a=s;break}if(10===t){const t=c(i);null!==t&&(l+=t,o=l.length,i++)}else if(92===t&&(s++,s<o&&10===l.charCodeAt(s))){const t=c(i);null!==t&&(l+=t,o=l.length,i++)}}if(a<0||58!==l.charCodeAt(a+1))return!1;for(s=a+2;s<o;s++){const t=l.charCodeAt(s);if(10===t){const t=c(i);null!==t&&(l+=t,o=l.length,i++)}else if(!y(t))break}const h=t.md.helpers.parseLinkDestination(l,s,o);if(!h.ok)return!1;const u=t.md.normalizeLink(h.str);if(!t.md.validateLink(u))return!1;s=h.pos;const p=s,f=i,d=s;for(;s<o;s++){const t=l.charCodeAt(s);if(10===t){const t=c(i);null!==t&&(l+=t,o=l.length,i++)}else if(!y(t))break}let k,m=t.md.helpers.parseLinkTitle(l,s,o);for(;m.can_continue;){const e=c(i);if(null===e)break;l+=e,s=o,o=l.length,i++,m=t.md.helpers.parseLinkTitle(l,s,o,m)}for(s<o&&d!==s&&m.ok?(k=m.str,s=m.pos):(k="",s=p,i=f);s<o;){if(!y(l.charCodeAt(s)))break;s++}if(s<o&&10!==l.charCodeAt(s)&&k)for(k="",s=p,i=f;s<o;){if(!y(l.charCodeAt(s)))break;s++}if(s<o&&10!==l.charCodeAt(s))return!1;const g=v(l.slice(1,a));return!!g&&(r||(void 0===t.env.references&&(t.env.references={}),void 0===t.env.references[g]&&(t.env.references[g]={title:k,href:u}),t.line=i),!0)}],["html_block",function(t,e,n,r){let s=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(!t.md.options.html)return!1;if(60!==t.src.charCodeAt(s))return!1;let i=t.src.slice(s,o),c=0;for(;c<ot.length&&!ot[c][0].test(i);c++);if(c===ot.length)return!1;if(r)return ot[c][2];let l=e+1;if(!ot[c][1].test(i))for(;l<n&&!(t.sCount[l]<t.blkIndent);l++)if(s=t.bMarks[l]+t.tShift[l],o=t.eMarks[l],i=t.src.slice(s,o),ot[c][1].test(i)){0!==i.length&&l++;break}t.line=l;const a=t.push("html_block","",0);return a.map=[e,l],a.content=t.getLines(e,l,t.blkIndent,!0),!0},["paragraph","reference","blockquote"]],["heading",function(t,e,n,r){let s=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let i=t.src.charCodeAt(s);if(35!==i||s>=o)return!1;let c=1;for(i=t.src.charCodeAt(++s);35===i&&s<o&&c<=6;)c++,i=t.src.charCodeAt(++s);if(c>6||s<o&&!y(i))return!1;if(r)return!0;o=t.skipSpacesBack(o,s);const l=t.skipCharsBack(o,35,s);l>s&&y(t.src.charCodeAt(l-1))&&(o=l),t.line=e+1;const a=t.push("heading_open","h"+String(c),1);a.markup="########".slice(0,c),a.map=[e,t.line];const h=t.push("inline","",0);return h.content=t.src.slice(s,o).trim(),h.map=[e,t.line],h.children=[],t.push("heading_close","h"+String(c),-1).markup="########".slice(0,c),!0},["paragraph","reference","blockquote"]],["lheading",function(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const s=t.parentType;t.parentType="paragraph";let o,i=0,c=e+1;for(;c<n&&!t.isEmpty(c);c++){if(t.sCount[c]-t.blkIndent>3)continue;if(t.sCount[c]>=t.blkIndent){let e=t.bMarks[c]+t.tShift[c];const n=t.eMarks[c];if(e<n&&(o=t.src.charCodeAt(e),(45===o||61===o)&&(e=t.skipChars(e,o),e=t.skipSpaces(e),e>=n))){i=61===o?1:2;break}}if(t.sCount[c]<0)continue;let e=!1;for(let s=0,o=r.length;s<o;s++)if(r[s](t,c,n,!0)){e=!0;break}if(e)break}if(!i)return!1;const l=t.getLines(e,c,t.blkIndent,!1).trim();t.line=c+1;const a=t.push("heading_open","h"+String(i),1);a.markup=String.fromCharCode(o),a.map=[e,t.line];const h=t.push("inline","",0);return h.content=l,h.map=[e,t.line-1],h.children=[],t.push("heading_close","h"+String(i),-1).markup=String.fromCharCode(o),t.parentType=s,!0}],["paragraph",function(t,e,n){const r=t.md.block.ruler.getRules("paragraph"),s=t.parentType;let o=e+1;for(t.parentType="paragraph";o<n&&!t.isEmpty(o);o++){if(t.sCount[o]-t.blkIndent>3)continue;if(t.sCount[o]<0)continue;let e=!1;for(let s=0,i=r.length;s<i;s++)if(r[s](t,o,n,!0)){e=!0;break}if(e)break}const i=t.getLines(e,o,t.blkIndent,!1).trim();t.line=o,t.push("paragraph_open","p",1).map=[e,t.line];const c=t.push("inline","",0);return c.content=i,c.map=[e,t.line],c.children=[],t.push("paragraph_close","p",-1),t.parentType=s,!0}]];function ct(){this.ruler=new T;for(let t=0;t<it.length;t++)this.ruler.push(it[t][0],it[t][1],{alt:(it[t][2]||[]).slice()})}function lt(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.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}function at(t){switch(t){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}}ct.prototype.tokenize=function(t,e,n){const r=this.ruler.getRules(""),s=r.length,o=t.md.options.maxNesting;let i=e,c=!1;for(;i<n&&(t.line=i=t.skipEmptyLines(i),!(i>=n))&&!(t.sCount[i]<t.blkIndent);){if(t.level>=o){t.line=n;break}const e=t.line;let l=!1;for(let o=0;o<s;o++)if(l=r[o](t,i,n,!1),l){if(e>=t.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");t.tight=!c,t.isEmpty(t.line-1)&&(c=!0),i=t.line,i<n&&t.isEmpty(i)&&(c=!0,i++,t.line=i)}},ct.prototype.parse=function(t,e,n,r){if(!t)return;const s=new this.State(t,e,n,r);this.tokenize(s,s.line,s.lineMax)},ct.prototype.State=K,lt.prototype.pushPending=function(){const t=new E("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},lt.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new E(t,e,n);let s=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],s={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(s),r},lt.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),s=t>0?this.src.charCodeAt(t-1):32;let o=t;for(;o<n&&this.src.charCodeAt(o)===r;)o++;const i=o-t,c=o<n?this.src.charCodeAt(o):32,l=M(s)||x(String.fromCharCode(s)),a=M(c)||x(String.fromCharCode(c)),h=A(s),u=A(c),p=!u&&(!a||h||l),f=!h&&(!l||u||a);return{can_open:p&&(e||!f||l),can_close:f&&(e||!p||a),length:i}},lt.prototype.Token=E;const ht=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;const ut=[];for(let t=0;t<256;t++)ut.push(0);function pt(t,e){let n;const r=[],s=e.length;for(let o=0;o<s;o++){const s=e[o];if(126!==s.marker)continue;if(-1===s.end)continue;const i=e[s.end];n=t.tokens[s.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[i.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="","text"===t.tokens[i.token-1].type&&"~"===t.tokens[i.token-1].content&&r.push(i.token-1)}for(;r.length;){const e=r.pop();let s=e+1;for(;s<t.tokens.length&&"s_close"===t.tokens[s].type;)s++;s--,e!==s&&(n=t.tokens[s],t.tokens[s]=t.tokens[e],t.tokens[e]=n)}}"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach((function(t){ut[t.charCodeAt(0)]=1}));var ft={tokenize:function(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e)return!1;if(126!==r)return!1;const s=t.scanDelims(t.pos,!0);let o=s.length;const i=String.fromCharCode(r);if(o<2)return!1;let c;o%2&&(c=t.push("text","",0),c.content=i,o--);for(let e=0;e<o;e+=2)c=t.push("text","",0),c.content=i+i,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:s.can_open,close:s.can_close});return t.pos+=s.length,!0},postProcess:function(t){const e=t.tokens_meta,n=t.tokens_meta.length;pt(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&pt(t,e[r].delimiters)}};function dt(t,e){for(let n=e.length-1;n>=0;n--){const r=e[n];if(95!==r.marker&&42!==r.marker)continue;if(-1===r.end)continue;const s=e[r.end],o=n>0&&e[n-1].end===r.end+1&&e[n-1].marker===r.marker&&e[n-1].token===r.token-1&&e[r.end+1].token===s.token+1,i=String.fromCharCode(r.marker),c=t.tokens[r.token];c.type=o?"strong_open":"em_open",c.tag=o?"strong":"em",c.nesting=1,c.markup=o?i+i:i,c.content="";const l=t.tokens[s.token];l.type=o?"strong_close":"em_close",l.tag=o?"strong":"em",l.nesting=-1,l.markup=o?i+i:i,l.content="",o&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--)}}var kt={tokenize:function(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e)return!1;if(95!==r&&42!==r)return!1;const s=t.scanDelims(t.pos,42===r);for(let e=0;e<s.length;e++){t.push("text","",0).content=String.fromCharCode(r),t.delimiters.push({marker:r,length:s.length,token:t.tokens.length-1,end:-1,open:s.can_open,close:s.can_close})}return t.pos+=s.length,!0},postProcess:function(t){const e=t.tokens_meta,n=t.tokens_meta.length;dt(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&dt(t,e[r].delimiters)}};const mt=/^([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])?)*)$/,gt=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;const bt=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,_t=/^&([a-z][a-z0-9]{1,31});/i;function Ct(t){const e={},n=t.length;if(!n)return;let r=0,s=-2;const o=[];for(let i=0;i<n;i++){const n=t[i];if(o.push(0),t[r].marker===n.marker&&s===n.token-1||(r=i),s=n.token,n.length=n.length||0,!n.close)continue;e.hasOwnProperty(n.marker)||(e[n.marker]=[-1,-1,-1,-1,-1,-1]);const c=e[n.marker][(n.open?3:0)+n.length%3];let l=r-o[r]-1,a=l;for(;l>c;l-=o[l]+1){const e=t[l];if(e.marker===n.marker&&(e.open&&e.end<0)){let r=!1;if((e.close||n.open)&&(e.length+n.length)%3==0&&(e.length%3==0&&n.length%3==0||(r=!0)),!r){const r=l>0&&!t[l-1].open?o[l-1]+1:0;o[i]=i-l+r,o[l]=r,n.open=!1,e.end=i,e.close=!1,a=-1,s=-2;break}}}-1!==a&&(e[n.marker][(n.open?3:0)+(n.length||0)%3]=a)}}const yt=[["text",function(t,e){let n=t.pos;for(;n<t.posMax&&!at(t.src.charCodeAt(n));)n++;return n!==t.pos&&(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}],["linkify",function(t,e){if(!t.md.options.linkify)return!1;if(t.linkLevel>0)return!1;const n=t.pos;if(n+3>t.posMax)return!1;if(58!==t.src.charCodeAt(n))return!1;if(47!==t.src.charCodeAt(n+1))return!1;if(47!==t.src.charCodeAt(n+2))return!1;const r=t.pending.match(ht);if(!r)return!1;const s=r[1],o=t.md.linkify.matchAtStart(t.src.slice(n-s.length));if(!o)return!1;let i=o.url;if(i.length<=s.length)return!1;i=i.replace(/\*+$/,"");const c=t.md.normalizeLink(i);if(!t.md.validateLink(c))return!1;if(!e){t.pending=t.pending.slice(0,-s.length);const e=t.push("link_open","a",1);e.attrs=[["href",c]],e.markup="linkify",e.info="auto";t.push("text","",0).content=t.md.normalizeLinkText(i);const n=t.push("link_close","a",-1);n.markup="linkify",n.info="auto"}return t.pos+=i.length-s.length,!0}],["newline",function(t,e){let n=t.pos;if(10!==t.src.charCodeAt(n))return!1;const r=t.pending.length-1,s=t.posMax;if(!e)if(r>=0&&32===t.pending.charCodeAt(r))if(r>=1&&32===t.pending.charCodeAt(r-1)){let e=r-1;for(;e>=1&&32===t.pending.charCodeAt(e-1);)e--;t.pending=t.pending.slice(0,e),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n<s&&y(t.src.charCodeAt(n));)n++;return t.pos=n,!0}],["escape",function(t,e){let n=t.pos;const r=t.posMax;if(92!==t.src.charCodeAt(n))return!1;if(n++,n>=r)return!1;let s=t.src.charCodeAt(n);if(10===s){for(e||t.push("hardbreak","br",0),n++;n<r&&(s=t.src.charCodeAt(n),y(s));)n++;return t.pos=n,!0}let o=t.src[n];if(s>=55296&&s<=56319&&n+1<r){const e=t.src.charCodeAt(n+1);e>=56320&&e<=57343&&(o+=t.src[n+1],n++)}const i="\\"+o;if(!e){const e=t.push("text_special","",0);s<256&&0!==ut[s]?e.content=o:e.content=i,e.markup=i,e.info="escape"}return t.pos=n+1,!0}],["backticks",function(t,e){let n=t.pos;if(96!==t.src.charCodeAt(n))return!1;const r=n;n++;const s=t.posMax;for(;n<s&&96===t.src.charCodeAt(n);)n++;const o=t.src.slice(r,n),i=o.length;if(t.backticksScanned&&(t.backticks[i]||0)<=r)return e||(t.pending+=o),t.pos+=i,!0;let c,l=n;for(;-1!==(c=t.src.indexOf("`",l));){for(l=c+1;l<s&&96===t.src.charCodeAt(l);)l++;const r=l-c;if(r===i){if(!e){const e=t.push("code_inline","code",0);e.markup=o,e.content=t.src.slice(n,c).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=l,!0}t.backticks[r]=c}return t.backticksScanned=!0,e||(t.pending+=o),t.pos+=i,!0}],["strikethrough",ft.tokenize],["emphasis",kt.tokenize],["link",function(t,e){let n,r,s,o,i="",c="",l=t.pos,a=!0;if(91!==t.src.charCodeAt(t.pos))return!1;const h=t.pos,u=t.posMax,p=t.pos+1,f=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(f<0)return!1;let d=f+1;if(d<u&&40===t.src.charCodeAt(d)){for(a=!1,d++;d<u&&(n=t.src.charCodeAt(d),y(n)||10===n);d++);if(d>=u)return!1;if(l=d,s=t.md.helpers.parseLinkDestination(t.src,d,t.posMax),s.ok){for(i=t.md.normalizeLink(s.str),t.md.validateLink(i)?d=s.pos:i="",l=d;d<u&&(n=t.src.charCodeAt(d),y(n)||10===n);d++);if(s=t.md.helpers.parseLinkTitle(t.src,d,t.posMax),d<u&&l!==d&&s.ok)for(c=s.str,d=s.pos;d<u&&(n=t.src.charCodeAt(d),y(n)||10===n);d++);}(d>=u||41!==t.src.charCodeAt(d))&&(a=!0),d++}if(a){if(void 0===t.env.references)return!1;if(d<u&&91===t.src.charCodeAt(d)?(l=d+1,d=t.md.helpers.parseLinkLabel(t,d),d>=0?r=t.src.slice(l,d++):d=f+1):d=f+1,r||(r=t.src.slice(p,f)),o=t.env.references[v(r)],!o)return t.pos=h,!1;i=o.href,c=o.title}if(!e){t.pos=p,t.posMax=f;const e=[["href",i]];t.push("link_open","a",1).attrs=e,c&&e.push(["title",c]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=d,t.posMax=u,!0}],["image",function(t,e){let n,r,s,o,i,c,l,a,h="";const u=t.pos,p=t.posMax;if(33!==t.src.charCodeAt(t.pos))return!1;if(91!==t.src.charCodeAt(t.pos+1))return!1;const f=t.pos+2,d=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(d<0)return!1;if(o=d+1,o<p&&40===t.src.charCodeAt(o)){for(o++;o<p&&(n=t.src.charCodeAt(o),y(n)||10===n);o++);if(o>=p)return!1;for(a=o,c=t.md.helpers.parseLinkDestination(t.src,o,t.posMax),c.ok&&(h=t.md.normalizeLink(c.str),t.md.validateLink(h)?o=c.pos:h=""),a=o;o<p&&(n=t.src.charCodeAt(o),y(n)||10===n);o++);if(c=t.md.helpers.parseLinkTitle(t.src,o,t.posMax),o<p&&a!==o&&c.ok)for(l=c.str,o=c.pos;o<p&&(n=t.src.charCodeAt(o),y(n)||10===n);o++);else l="";if(o>=p||41!==t.src.charCodeAt(o))return t.pos=u,!1;o++}else{if(void 0===t.env.references)return!1;if(o<p&&91===t.src.charCodeAt(o)?(a=o+1,o=t.md.helpers.parseLinkLabel(t,o),o>=0?s=t.src.slice(a,o++):o=d+1):o=d+1,s||(s=t.src.slice(f,d)),i=t.env.references[v(s)],!i)return t.pos=u,!1;h=i.href,l=i.title}if(!e){r=t.src.slice(f,d);const e=[];t.md.inline.parse(r,t.md,t.env,e);const n=t.push("image","img",0),s=[["src",h],["alt",""]];n.attrs=s,n.children=e,n.content=r,l&&s.push(["title",l])}return t.pos=o,t.posMax=p,!0}],["autolink",function(t,e){let n=t.pos;if(60!==t.src.charCodeAt(n))return!1;const r=t.pos,s=t.posMax;for(;;){if(++n>=s)return!1;const e=t.src.charCodeAt(n);if(60===e)return!1;if(62===e)break}const o=t.src.slice(r+1,n);if(gt.test(o)){const n=t.md.normalizeLink(o);if(!t.md.validateLink(n))return!1;if(!e){const e=t.push("link_open","a",1);e.attrs=[["href",n]],e.markup="autolink",e.info="auto";t.push("text","",0).content=t.md.normalizeLinkText(o);const r=t.push("link_close","a",-1);r.markup="autolink",r.info="auto"}return t.pos+=o.length+2,!0}if(mt.test(o)){const n=t.md.normalizeLink("mailto:"+o);if(!t.md.validateLink(n))return!1;if(!e){const e=t.push("link_open","a",1);e.attrs=[["href",n]],e.markup="autolink",e.info="auto";t.push("text","",0).content=t.md.normalizeLinkText(o);const r=t.push("link_close","a",-1);r.markup="autolink",r.info="auto"}return t.pos+=o.length+2,!0}return!1}],["html_inline",function(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(60!==t.src.charCodeAt(r)||r+2>=n)return!1;const s=t.src.charCodeAt(r+1);if(33!==s&&63!==s&&47!==s&&!function(t){const e=32|t;return e>=97&&e<=122}(s))return!1;const o=t.src.slice(r).match(rt);if(!o)return!1;if(!e){const e=t.push("html_inline","",0);e.content=o[0],i=e.content,/^<a[>\s]/i.test(i)&&t.linkLevel++,function(t){return/^<\/a\s*>/i.test(t)}(e.content)&&t.linkLevel--}var i;return t.pos+=o[0].length,!0}],["entity",function(t,e){const r=t.pos,s=t.posMax;if(38!==t.src.charCodeAt(r))return!1;if(r+1>=s)return!1;if(35===t.src.charCodeAt(r+1)){const n=t.src.slice(r).match(bt);if(n){if(!e){const e="x"===n[1][0].toLowerCase()?parseInt(n[1].slice(1),16):parseInt(n[1],10),r=t.push("text_special","",0);r.content=a(e)?h(e):h(65533),r.markup=n[0],r.info="entity"}return t.pos+=n[0].length,!0}}else{const s=t.src.slice(r).match(_t);if(s){const r=n(s[0]);if(r!==s[0]){if(!e){const e=t.push("text_special","",0);e.content=r,e.markup=s[0],e.info="entity"}return t.pos+=s[0].length,!0}}}return!1}]],At=[["balance_pairs",function(t){const e=t.tokens_meta,n=t.tokens_meta.length;Ct(t.delimiters);for(let t=0;t<n;t++)e[t]&&e[t].delimiters&&Ct(e[t].delimiters)}],["strikethrough",ft.postProcess],["emphasis",kt.postProcess],["fragments_join",function(t){let e,n,r=0;const s=t.tokens,o=t.tokens.length;for(e=n=0;e<o;e++)s[e].nesting<0&&r--,s[e].level=r,s[e].nesting>0&&r++,"text"===s[e].type&&e+1<o&&"text"===s[e+1].type?s[e+1].content=s[e].content+s[e+1].content:(e!==n&&(s[n]=s[e]),n++);e!==n&&(s.length=n)}]];function xt(){this.ruler=new T;for(let t=0;t<yt.length;t++)this.ruler.push(yt[t][0],yt[t][1]);this.ruler2=new T;for(let t=0;t<At.length;t++)this.ruler2.push(At[t][0],At[t][1])}xt.prototype.skipToken=function(t){const e=t.pos,n=this.ruler.getRules(""),r=n.length,s=t.md.options.maxNesting,o=t.cache;if(void 0!==o[e])return void(t.pos=o[e]);let i=!1;if(t.level<s){for(let s=0;s<r;s++)if(t.level++,i=n[s](t,!0),t.level--,i){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;i||t.pos++,o[e]=t.pos},xt.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,s=t.md.options.maxNesting;for(;t.pos<r;){const o=t.pos;let i=!1;if(t.level<s)for(let r=0;r<n;r++)if(i=e[r](t,!1),i){if(o>=t.pos)throw new Error("inline rule didn't increment state.pos");break}if(i){if(t.pos>=r)break}else t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},xt.prototype.parse=function(t,e,n,r){const s=new this.State(t,e,n,r);this.tokenize(s);const o=this.ruler2.getRules(""),i=o.length;for(let t=0;t<i;t++)o[t](s)},xt.prototype.State=lt;const Mt={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{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"]}}},commonmark:{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"]}}}},vt=/^(vbscript|javascript|file|data):/,wt=/^data:image\/(gif|png|jpeg|webp);/;function St(t){const e=t.trim().toLowerCase();return!vt.test(e)||wt.test(e)}const It=["http:","https:","mailto:"];function Lt(e){const n=t.parse(e,!0);if(n.hostname&&(!n.protocol||It.indexOf(n.protocol)>=0))try{n.hostname=s.toASCII(n.hostname)}catch(t){}return t.encode(t.format(n))}function zt(e){const n=t.parse(e,!0);if(n.hostname&&(!n.protocol||It.indexOf(n.protocol)>=0))try{n.hostname=s.toUnicode(n.hostname)}catch(t){}return t.decode(t.format(n),t.decode.defaultChars+"%")}function Tt(t,e){if(!(this instanceof Tt))return new Tt(t,e);e||o(t)||(e=t||{},t="default"),this.inline=new xt,this.block=new ct,this.core=new V,this.renderer=new z,this.linkify=new r,this.validateLink=St,this.normalizeLink=Lt,this.normalizeLinkText=zt,this.utils=S,this.helpers=c({},I),this.options={},this.configure(t),e&&this.set(e)}Tt.prototype.set=function(t){return c(this.options,t),this},Tt.prototype.configure=function(t){const e=this;if(o(t)){const e=t;if(!(t=Mt[e]))throw new Error('Wrong `markdown-it` preset "'+e+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach((function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)})),this},Tt.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach((function(e){n=n.concat(this[e].ruler.enable(t,!0))}),this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter((function(t){return n.indexOf(t)<0}));if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this},Tt.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach((function(e){n=n.concat(this[e].ruler.disable(t,!0))}),this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter((function(t){return n.indexOf(t)<0}));if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this},Tt.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},Tt.prototype.parse=function(t,e){if("string"!=typeof t)throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens},Tt.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},Tt.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},Tt.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};export{Tt as default};
|
||
//# sourceMappingURL=/sm/8f46d8c3c1217f348e56116eb47a8a3c8be84862ad790ad94a5fa63ec255196d.map
|