| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- import{m as t,u as e,e as n,f as r,d as s}from"./mdurl.Dwcmq5MZ.js";import{u as o,P as i,r as c}from"./uc.micro.CRGj88R_.js";import{d as l}from"./entities.zpoy7YfM.js";import{L as a}from"./linkify-it.xinbW_ni.js";import{p as h}from"./punycode.js.BkBFhtvi.js";function u(t){return"[object String]"===function(t){return Object.prototype.toString.call(t)}(t)}const p=Object.prototype.hasOwnProperty;function f(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 d(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function k(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 m(t){if(t>65535){const e=55296+((t-=65536)>>10),n=56320+(1023&t);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const g=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,b=new RegExp(g.source+"|"+/&([a-z#][a-z0-9]{1,31});/gi.source,"gi"),_=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function C(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(b,function(t,e,n){return e||function(t,e){if(35===e.charCodeAt(0)&&_.test(e)){const n="x"===e[1].toLowerCase()?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return k(n)?m(n):t}const n=l(t);return n!==t?n:t}(t,n)})}const y=/[&<>"]/,A=/[&<>"]/g,x={"&":"&","<":"<",">":">",'"':"""};function M(t){return x[t]}function v(t){return y.test(t)?t.replace(A,M):t}const S=/[.?*+^$[\]\\(){}|-]/g;function w(t){switch(t){case 9:case 32:return!0}return!1}function I(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:
- // \t
- case 10:
- // \n
- case 11:
- // \v
- case 12:
- // \f
- case 13:
- // \r
- case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function L(t){return i.test(t)||c.test(t)}function z(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 T(t){return t=t.trim().replace(/\s+/g," "),"Ṿ"==="ẞ".toLowerCase()&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const E={mdurl:t,ucmicro:o},O=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:d,assign:f,escapeHtml:v,escapeRE:function(t){return t.replace(S,"\\$&")},fromCodePoint:m,has:function(t,e){return p.call(t,e)},isMdAsciiPunct:z,isPunctChar:L,isSpace:w,isString:u,isValidEntityCode:k,isWhiteSpace:I,lib:E,normalizeReference:T,unescapeAll:C,unescapeMd:function(t){return t.indexOf("\\")<0?t:t.replace(g,"$1")}},Symbol.toStringTag,{value:"Module"}));const $=Object.freeze(Object.defineProperty({__proto__:null,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=C(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=C(t.slice(e,s)),o.pos=s,o.ok=!0),o},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},parseLinkTitle:function(t,e,n,r){let s,o=e;const i={
- // if `true`, this is a valid link title
- ok:!1,
- // if `true`, this link can be continued on the next line
- can_continue:!1,
- // if `ok`, it's the position of the first character after the closing marker
- pos:0,
- // if `ok`, it's the unescaped title
- str:"",
- // expected closing marker character code
- 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+=C(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+=C(t.slice(e,o)),i}},Symbol.toStringTag,{value:"Module"})),j={};function q(){this.rules=f({},j)}function P(){this.__rules__=[],this.__cache__=null}function R(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 Z(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}j.code_inline=function(t,e,n,r,s){const o=t[e];return"<code"+s.renderAttrs(o)+">"+v(o.content)+"</code>"},j.code_block=function(t,e,n,r,s){const o=t[e];return"<pre"+s.renderAttrs(o)+"><code>"+v(t[e].content)+"</code></pre>\n"},j.fence=function(t,e,n,r,s){const o=t[e],i=o.info?C(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)||v(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`},j.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)},j.hardbreak=function(t,e,n){return n.xhtmlOut?"<br />\n":"<br>\n"},j.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?"<br />\n":"<br>\n":"\n"},j.text=function(t,e){return v(t[e].content)},j.html_block=function(t,e){return t[e].content},j.html_inline=function(t,e){return t[e].content},q.prototype.renderAttrs=function(t){let e,n,r;if(!t.attrs)return"";for(r="",e=0,n=t.attrs.length;e<n;e++)r+=" "+v(t.attrs[e][0])+'="'+v(t.attrs[e][1])+'"';return r},q.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},q.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},q.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},q.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},P.prototype.__find__=function(t){for(let e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1},P.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))})})},P.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},P.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},P.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},P.prototype.push=function(t,e,n){const r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null},P.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},P.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(t){t.enabled=!1}),this.enable(t,e)},P.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},P.prototype.getRules=function(t){return null===this.__cache__&&this.__compile__(),this.__cache__[t]||[]},R.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},R.prototype.attrPush=function(t){this.attrs?this.attrs.push(t):this.attrs=[t]},R.prototype.attrSet=function(t,e){const n=this.attrIndex(t),r=[t,e];n<0?this.attrPush(r):this.attrs[n]=r},R.prototype.attrGet=function(t){const e=this.attrIndex(t);let n=null;return e>=0&&(n=this.attrs[e][1]),n},R.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},Z.prototype.Token=R;const D=/\r\n?|\n/g,N=/\0/g;function B(t){return/^<a[>\s]/i.test(t)}function W(t){return/^<\/a\s*>/i.test(t)}const U=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,F=/\((c|tm|r)\)/i,G=/\((c|tm|r)\)/gi,H={c:"©",r:"®",tm:"™"};function J(t,e){return H[e.toLowerCase()]}function V(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(G,J)),"link_open"===r.type&&"auto"===r.info&&e--,"link_close"===r.type&&"auto"===r.info&&e++}}function X(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];"text"!==r.type||e||U.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 K=/['"]/,Q=/['"]/g;function Y(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function tt(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;){Q.lastIndex=l;const h=Q.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=z(d)||L(String.fromCharCode(d)),g=z(k)||L(String.fromCharCode(k)),b=I(d),_=I(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=Y(o.content,h.index,p),t[u.token].content=Y(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=Y(o.content,h.index,"’"))}else f&&(o.content=Y(o.content,h.index,"’"))}}}const et=[["normalize",function(t){let e;e=t.src.replace(D,"\n"),e=e.replace(N,"�"),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;if(t.md.options.linkify)for(let n=0,r=e.length;n<r;n++){if("inline"!==e[n].type||!t.md.linkify.pretest(e[n].content))continue;let r=e[n].children,s=0;for(let o=r.length-1;o>=0;o--){const i=r[o];if("link_close"!==i.type){if("html_inline"===i.type&&(B(i.content)&&s>0&&s--,W(i.content)&&s++),!(s>0)&&"text"===i.type&&t.md.linkify.test(i.content)){const s=i.content;let c=t.md.linkify.match(s);const l=[];let a=i.level,h=0;c.length>0&&0===c[0].index&&o>0&&"text_special"===r[o-1].type&&(c=c.slice(1));for(let e=0;e<c.length;e++){const n=c[e].url,r=t.md.normalizeLink(n);if(!t.md.validateLink(r))continue;let o=c[e].text;o=c[e].schema?"mailto:"!==c[e].schema||/^mailto:/i.test(o)?t.md.normalizeLinkText(o):t.md.normalizeLinkText("mailto:"+o).replace(/^mailto:/,""):t.md.normalizeLinkText("http://"+o).replace(/^http:\/\//,"");const i=c[e].index;if(i>h){const e=new t.Token("text","",0);e.content=s.slice(h,i),e.level=a,l.push(e)}const u=new t.Token("link_open","a",1);u.attrs=[["href",r]],u.level=a++,u.markup="linkify",u.info="auto",l.push(u);const p=new t.Token("text","",0);p.content=o,p.level=a,l.push(p);const f=new t.Token("link_close","a",-1);f.level=--a,f.markup="linkify",f.info="auto",l.push(f),h=c[e].lastIndex}if(h<s.length){const e=new t.Token("text","",0);e.content=s.slice(h),e.level=a,l.push(e)}e[n].children=r=d(r,o,l)}}else for(o--;r[o].level!==i.level&&"link_open"!==r[o].type;)o--}}}],["replacements",function(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)"inline"===t.tokens[e].type&&(F.test(t.tokens[e].content)&&V(t.tokens[e].children),U.test(t.tokens[e].content)&&X(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&&K.test(t.tokens[e].content)&&tt(t.tokens[e].children,t)}],
- // `text_join` finds `text_special` tokens (for escape sequences)
- // and joins them with the rest of the text
- ["text_join",function(t){let e,n;const r=t.tokens,s=r.length;for(let o=0;o<s;o++){if("inline"!==r[o].type)continue;const t=r[o].children,s=t.length;for(e=0;e<s;e++)"text_special"===t[e].type&&(t[e].type="text");for(e=n=0;e<s;e++)"text"===t[e].type&&e+1<s&&"text"===t[e+1].type?t[e+1].content=t[e].content+t[e+1].content:(e!==n&&(t[n]=t[e]),n++);e!==n&&(t.length=n)}}]];function nt(){this.ruler=new P;for(let t=0;t<et.length;t++)this.ruler.push(et[t][0],et[t][1])}function rt(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 o=0,i=0,c=0,l=0,a=s.length,h=!1;i<a;i++){const t=s.charCodeAt(i);if(!h){if(w(t)){c++,9===t?l+=4-l%4:l++;continue}h=!0}10!==t&&i!==a-1||(10!==t&&i++,this.bMarks.push(o),this.eMarks.push(i),this.tShift.push(c),this.sCount.push(l),this.bsCount.push(0),h=!1,c=0,l=0,o=i+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}nt.prototype.process=function(t){const e=this.ruler.getRules("");for(let n=0,r=e.length;n<r;n++)e[n](t)},nt.prototype.State=Z,rt.prototype.push=function(t,e,n){const r=new R(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},rt.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},rt.prototype.skipEmptyLines=function(t){for(let e=this.lineMax;t<e&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t},rt.prototype.skipSpaces=function(t){for(let e=this.src.length;t<e;t++){if(!w(this.src.charCodeAt(t)))break}return t},rt.prototype.skipSpacesBack=function(t,e){if(t<=e)return t;for(;t>e;)if(!w(this.src.charCodeAt(--t)))return t+1;return t},rt.prototype.skipChars=function(t,e){for(let n=this.src.length;t<n&&this.src.charCodeAt(t)===e;t++);return t},rt.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},rt.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(w(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("")},rt.prototype.Token=R;function st(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function ot(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 it(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(!w(t.src.charCodeAt(r)))return-1}return r}function ct(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),!w(o))?-1:s}const lt="<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",at="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",ht=new RegExp("^(?:"+lt+"|"+at+"|\x3c!---?>|\x3c!--(?:[^-]|-[^-]|--[^>])*--\x3e|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),ut=new RegExp("^(?:"+lt+"|"+at+")"),pt=[[/^<(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(ut.source+"\\s*$"),/^$/,!1]];const ft=[
- // First 2 params - rule name & source. Secondary array - list of rules,
- // which can be terminated by this one.
- ["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&&!w(c))return!1;if(45===i&&w(c))return!1;for(;o<t.eMarks[s];){const e=t.src.charCodeAt(o);if(124!==e&&45!==e&&58!==e&&!w(e))return!1;o++}let l=st(t,e+1),a=l.split("|");const h=[];for(let g=0;g<a.length;g++){const t=a[g].trim();if(!t){if(0===g||g===a.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;58===t.charCodeAt(t.length-1)?h.push(58===t.charCodeAt(0)?"center":"right"):58===t.charCodeAt(0)?h.push("left"):h.push("")}if(l=st(t,e).trim(),-1===l.indexOf("|"))return!1;if(t.sCount[e]-t.blkIndent>=4)return!1;a=ot(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 g=0;g<a.length;g++){const e=t.push("th_open","th",1);h[g]&&(e.attrs=[["style","text-align:"+h[g]]]);const n=t.push("inline","",0);n.content=a[g].trim(),n.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=st(t,s).trim(),!l)break;if(t.sCount[s]-t.blkIndent>=4)break;if(a=ot(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(!w(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 s=0,o=u.length;s<o;s++)if(u[s](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 b=0;b<h.length;b++)t.bMarks[b+e]=c[b],t.tShift[b+e]=h[b],t.sCount[b+e]=a[b],t.bsCount[b+e]=l[b];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&&!w(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=ct(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=it(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 s=0,o=b.length;s<o;s++)if(b[s](t,l,n,!0)){x=!0;break}if(x)break;if(h){if(p=ct(t,l),p<0)break;i=t.bMarks[l]+t.tShift[l]}else if(p=it(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 i=0,c=r.length;i<c;i++)if(r[i](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(!w(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(!w(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(!w(l.charCodeAt(s)))break;s++}if(s<o&&10!==l.charCodeAt(s)&&k)for(k="",s=p,i=f;s<o;){if(!w(l.charCodeAt(s)))break;s++}if(s<o&&10!==l.charCodeAt(s))return!1;const g=T(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<pt.length&&!pt[c][0].test(i);c++);if(c===pt.length)return!1;if(r)return pt[c][2];let l=e+1;if(!pt[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),pt[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&&!w(i))return!1;if(r)return!0;o=t.skipSpacesBack(o,s);const l=t.skipCharsBack(o,35,s);l>s&&w(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 dt(){this.ruler=new P;for(let t=0;t<ft.length;t++)this.ruler.push(ft[t][0],ft[t][1],{alt:(ft[t][2]||[]).slice()})}function kt(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 mt(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}}dt.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)}},dt.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)},dt.prototype.State=rt,kt.prototype.pushPending=function(){const t=new R("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},kt.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new R(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},kt.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=z(s)||L(String.fromCharCode(s)),a=z(c)||L(String.fromCharCode(c)),h=I(s),u=I(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}},kt.prototype.Token=R;const gt=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;const bt=[];for(let Zt=0;Zt<256;Zt++)bt.push(0);function _t(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){bt[t.charCodeAt(0)]=1});const Ct={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 l=0;l<o;l+=2)c=t.push("text","",0),c.content=i+i,t.delimiters.push({marker:r,length:0,
- // disable "rule of 3" length checks meant for emphasis
- 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;_t(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&_t(t,e[r].delimiters)}};function yt(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&&// check that first two markers match and adjacent
- e[n-1].marker===r.marker&&e[n-1].token===r.token-1&&// check that last two markers are adjacent (we can safely assume they match)
- 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--)}}const At={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 o=0;o<s.length;o++){t.push("text","",0).content=String.fromCharCode(r),t.delimiters.push({
- // Char code of the starting marker (number).
- marker:r,
- // Total length of these series of delimiters.
- length:s.length,
- // A position of the token this delimiter corresponds to.
- token:t.tokens.length-1,
- // If this delimiter is matched as a valid opener, `end` will be
- // equal to its position, otherwise it's `-1`.
- end:-1,
- // Boolean flags that determine if this delimiter could open or close
- // an emphasis.
- 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;yt(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&yt(t,e[r].delimiters)}};const xt=/^([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])?)*)$/,Mt=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;const vt=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,St=/^&([a-z][a-z0-9]{1,31});/i;function wt(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 It=[["text",function(t,e){let n=t.pos;for(;n<t.posMax&&!mt(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(gt);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;let c=i.length;for(;c>0&&42===i.charCodeAt(c-1);)c--;c!==i.length&&(i=i.slice(0,c));const l=t.md.normalizeLink(i);if(!t.md.validateLink(l))return!1;if(!e){t.pending=t.pending.slice(0,-s.length);const e=t.push("link_open","a",1);e.attrs=[["href",l]],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&&w(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),w(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!==bt[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",Ct.tokenize],["emphasis",At.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),w(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),w(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),w(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[T(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),w(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),w(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),w(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[T(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(Mt.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(xt.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(ht);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 n=t.pos,r=t.posMax;if(38!==t.src.charCodeAt(n))return!1;if(n+1>=r)return!1;if(35===t.src.charCodeAt(n+1)){const r=t.src.slice(n).match(vt);if(r){if(!e){const e="x"===r[1][0].toLowerCase()?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=t.push("text_special","",0);n.content=k(e)?m(e):m(65533),n.markup=r[0],n.info="entity"}return t.pos+=r[0].length,!0}}else{const r=t.src.slice(n).match(St);if(r){const n=l(r[0]);if(n!==r[0]){if(!e){const e=t.push("text_special","",0);e.content=n,e.markup=r[0],e.info="entity"}return t.pos+=r[0].length,!0}}}return!1}]],Lt=[["balance_pairs",function(t){const e=t.tokens_meta,n=t.tokens_meta.length;wt(t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&wt(e[r].delimiters)}],["strikethrough",Ct.postProcess],["emphasis",At.postProcess],
- // rules for pairs separate '**' into its own text tokens, which may be left unused,
- // rule below merges unused segments back with the rest of the text
- ["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 zt(){this.ruler=new P;for(let t=0;t<It.length;t++)this.ruler.push(It[t][0],It[t][1]);this.ruler2=new P;for(let t=0;t<Lt.length;t++)this.ruler2.push(Lt[t][0],Lt[t][1])}zt.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 c=0;c<r;c++)if(t.level++,i=n[c](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},zt.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()},zt.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 c=0;c<i;c++)o[c](s)},zt.prototype.State=kt;const Tt={default:{options:{
- // Enable HTML tags in source
- html:!1,
- // Use '/' to close single tags (<br />)
- xhtmlOut:!1,
- // Convert '\n' in paragraphs into <br>
- breaks:!1,
- // CSS language prefix for fenced blocks
- langPrefix:"language-",
- // autoconvert URL-like texts to links
- linkify:!1,
- // Enable some language-neutral replacements + quotes beautification
- typographer:!1,
- // Double + single quotes replacement pairs, when typographer enabled,
- // and smartquotes on. Could be either a String or an Array.
- // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
- // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
- quotes:"“”‘’",
- /* “”‘’ */
- // Highlighter function. Should return escaped HTML,
- // or '' if the source string is not changed and should be escaped externaly.
- // If result starts with <pre... internal wrapper is skipped.
- // function (/*str, lang*/) { return ''; }
- highlight:null,
- // Internal protection, recursion limit
- maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{
- // Enable HTML tags in source
- html:!1,
- // Use '/' to close single tags (<br />)
- xhtmlOut:!1,
- // Convert '\n' in paragraphs into <br>
- breaks:!1,
- // CSS language prefix for fenced blocks
- langPrefix:"language-",
- // autoconvert URL-like texts to links
- linkify:!1,
- // Enable some language-neutral replacements + quotes beautification
- typographer:!1,
- // Double + single quotes replacement pairs, when typographer enabled,
- // and smartquotes on. Could be either a String or an Array.
- // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
- // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
- quotes:"“”‘’",
- /* “”‘’ */
- // Highlighter function. Should return escaped HTML,
- // or '' if the source string is not changed and should be escaped externaly.
- // If result starts with <pre... internal wrapper is skipped.
- // function (/*str, lang*/) { return ''; }
- highlight:null,
- // Internal protection, recursion limit
- maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{
- // Enable HTML tags in source
- html:!0,
- // Use '/' to close single tags (<br />)
- xhtmlOut:!0,
- // Convert '\n' in paragraphs into <br>
- breaks:!1,
- // CSS language prefix for fenced blocks
- langPrefix:"language-",
- // autoconvert URL-like texts to links
- linkify:!1,
- // Enable some language-neutral replacements + quotes beautification
- typographer:!1,
- // Double + single quotes replacement pairs, when typographer enabled,
- // and smartquotes on. Could be either a String or an Array.
- // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
- // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
- quotes:"“”‘’",
- /* “”‘’ */
- // Highlighter function. Should return escaped HTML,
- // or '' if the source string is not changed and should be escaped externaly.
- // If result starts with <pre... internal wrapper is skipped.
- // function (/*str, lang*/) { return ''; }
- highlight:null,
- // Internal protection, recursion limit
- 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"]}}}},Et=/^(vbscript|javascript|file|data):/,Ot=/^data:image\/(gif|png|jpeg|webp);/;function $t(t){const e=t.trim().toLowerCase();return!Et.test(e)||Ot.test(e)}const jt=["http:","https:","mailto:"];function qt(t){const s=e(t,!0);if(s.hostname&&(!s.protocol||jt.indexOf(s.protocol)>=0))try{s.hostname=h.toASCII(s.hostname)}catch(o){}return n(r(s))}function Pt(t){const n=e(t,!0);if(n.hostname&&(!n.protocol||jt.indexOf(n.protocol)>=0))try{n.hostname=h.toUnicode(n.hostname)}catch(o){}return s(r(n),s.defaultChars+"%")}function Rt(t,e){if(!(this instanceof Rt))return new Rt(t,e);e||u(t)||(e=t||{},t="default"),this.inline=new zt,this.block=new dt,this.core=new nt,this.renderer=new q,this.linkify=new a,this.validateLink=$t,this.normalizeLink=qt,this.normalizeLinkText=Pt,this.utils=O,this.helpers=f({},$),this.options={},this.configure(t),e&&this.set(e)}Rt.prototype.set=function(t){return f(this.options,t),this},Rt.prototype.configure=function(t){const e=this;if(u(t)){const e=t;if(!(t=Tt[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},Rt.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},Rt.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},Rt.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},Rt.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},Rt.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},Rt.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},Rt.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};export{Rt as M};
|