!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).markdownitDocutils={})}(this,(function(e){"use strict";class t{constructor(e){this.state=e}run(e){return[]}}const n={raw:class extends t{run(e){const t=new this.state.Token("code_inline","code",0);return t.content=e.content,[t]}}},i="math_inline";const r={math:class extends t{run(e){const t=new this.state.Token(i,"span",0);return t.attrSet("class","math inline"),t.markup="$",t.content=e.content,[t]}}};function o(e,t){t.parseRoles&&e.inline.ruler.before("backticks","parse_roles",s),e.core.ruler.after(t.rolesAfter||"inline","run_roles",function(e){function t(t){var n;for(const i of t.tokens)if("inline"===i.type&&i.children){const r=[];for(const o of i.children)if("role"===o.type&&(null===(n=o.meta)||void 0===n?void 0:n.name)in e)try{const n=new e[o.meta.name](t),s=new t.Token("parsed_role_open","",1);s.content=o.content,s.hidden=!0,s.meta={name:o.meta.name},s.block=!1;const a=[s];a.push(...n.run({parentMap:i.map,content:o.content}));const l=new t.Token("parsed_role_close","",-1);l.block=!1,l.hidden=!0,a.push(l),r.push(...a)}catch(e){const n=new t.Token("role_error","",0);n.content=o.content,n.info=o.info,n.meta=o.meta,n.map=o.map,n.meta.error_message=e.message,n.meta.error_name=e.name,r.push(n)}else r.push(o);i.children=r}return!0}return t}(t.roles||{})),e.renderer.rules.role=(e,t)=>{const n=e[t];return`${n.meta.name}${n.content}`},function(e,t){var n;(null===(n=null==t?void 0:t.roles)||void 0===n?void 0:n.math)&&!e.renderer.rules.math_inline&&(e.renderer.rules.math_inline=(n,i)=>{var r,o,s;const a=null!==(s=null===(o=null===(r=null==t?void 0:t.opts)||void 0===r?void 0:r.math)||void 0===o?void 0:o.renderer)&&void 0!==s?s:t=>e.utils.escapeHtml(t),l=n[i],c=a(l.content.trim(),{displayMode:!1});return`${c}`})}(e,t)}function s(e,t){if(92===e.src.charCodeAt(e.pos-1))return!1;const n=l.exec(e.src.slice(e.pos));if(null==n)return!1;const[i,r,,o]=n;if(e.pos+=i.length,!t){const t=e.push("role","",0);t.meta={name:r},t.content=o}return!0}let a;try{a=new RegExp("^\\{([a-zA-Z_\\-+:]{1,36})\\}(`+)(?!`)(.+?)(?]+)>$/;const v={eq:class extends t{run(e){const t=new this.state.Token("ref_open","a",1),n=new this.state.Token("text","",0),i=new this.state.Token("ref_close","a",-1);return b(this.state,{open:t,content:n,close:i},{kind:"eq",label:e.content},{kind:f.equation,contentFromTarget:e=>`(${e.number})`}),[t,n,i]}},ref:class extends t{run(e){const t=k.exec(e.content),[,n,i]=null!=t?t:[],r=null==n?void 0:n.trim(),o=new this.state.Token("ref_open","a",1),s=new this.state.Token("text","",0),a=new this.state.Token("ref_close","a",-1);return b(this.state,{open:o,content:s,close:a},{kind:"ref",label:i||e.content,value:r},{contentFromTarget:e=>r||e.title}),[o,s,a]}},numref:class extends t{run(e){const t=k.exec(e.content),[,n,i]=null!=t?t:[],r=null==n?void 0:n.trim(),o=new this.state.Token("ref_open","a",1),s=new this.state.Token("text","",0),a=new this.state.Token("ref_close","a",-1);return b(this.state,{open:o,content:s,close:a},{kind:"numref",label:i||e.content,value:r},{contentFromTarget:e=>t?r.replace(/%s/g,String(e.number)).replace(/\{number\}/g,String(e.number)):e.title.trim()}),[o,s,a]}}},_=Object.assign(Object.assign(Object.assign(Object.assign({},n),d),r),v); /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ function y(e){return null==e}var w={isNothing:y,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:y(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;na&&(t=i-a+(o=" ... ").length),n-i>a&&(n=i+a-(s=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+s,pos:i-t+o.length}}function j(e,t){return w.repeat(" ",t-e.length)+e}var O=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,i=/\r?\n|\r|\0/g,r=[0],o=[],s=-1;n=i.exec(e.buffer);)o.push(n.index),r.push(n.index+n[0].length),e.position<=n.index&&s<0&&(s=r.length-2);s<0&&(s=r.length-1);var a,l,c="",u=Math.min(e.line+t.linesAfter,o.length).toString().length,p=t.maxLength-(t.indent+u+3);for(a=1;a<=t.linesBefore&&!(s-a<0);a++)l=C(e.buffer,r[s-a],o[s-a],e.position-(r[s]-r[s-a]),p),c=w.repeat(" ",t.indent)+j((e.line-a+1).toString(),u)+" | "+l.str+"\n"+c;for(l=C(e.buffer,r[s],o[s],e.position,p),c+=w.repeat(" ",t.indent)+j((e.line+1).toString(),u)+" | "+l.str+"\n",c+=w.repeat("-",t.indent+u+3+l.pos)+"^\n",a=1;a<=t.linesAfter&&!(s+a>=o.length);a++)l=C(e.buffer,r[s+a],o[s+a],e.position-(r[s]-r[s+a]),p),c+=w.repeat(" ",t.indent)+j((e.line+a+1).toString(),u)+" | "+l.str+"\n";return c.replace(/\n$/,"")},I=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],S=["scalar","sequence","mapping"];var E=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===I.indexOf(t))throw new T('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===S.indexOf(this.kind))throw new T('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function $(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)})),n[t]=e})),n}function N(e){return this.extend(e)}N.prototype.extend=function(e){var t=[],n=[];if(e instanceof E)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new T("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof E))throw new T("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new T("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new T("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof E))throw new T("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(N.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=$(i,"implicit"),i.compiledExplicit=$(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),J=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var B=/^[-+]?[0-9]+e/;var K=new E("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!J.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||w.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(w.isNegativeZero(e))return"-0.0";return n=e.toString(10),B.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),z=D.extend({implicit:[U,Y,W,K]}),G=z,V=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),H=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var Z=new E("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==V.exec(e)||null!==H.exec(e))},construct:function(e){var t,n,i,r,o,s,a,l,c=0,u=null;if(null===(t=V.exec(e))&&(t=H.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],s=+t[5],a=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),l=new Date(Date.UTC(n,i,r,o,s,a,c)),u&&l.setTime(l.getTime()-u),l},instanceOf:Date,represent:function(e){return e.toISOString()}});var Q=new E("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),X="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var ee=new E("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=X;for(n=0;n64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=X,s=0,a=[];for(t=0;t>16&255),a.push(s>>8&255),a.push(255&s)),s=s<<6|o.indexOf(i.charAt(t));return 0===(n=r%4*6)?(a.push(s>>16&255),a.push(s>>8&255),a.push(255&s)):18===n?(a.push(s>>10&255),a.push(s>>2&255)):12===n&&a.push(s>>4&255),new Uint8Array(a)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,s=X;for(t=0;t>18&63],i+=s[r>>12&63],i+=s[r>>6&63],i+=s[63&r]),r=(r<<8)+e[t];return 0===(n=o%3)?(i+=s[r>>18&63],i+=s[r>>12&63],i+=s[r>>6&63],i+=s[63&r]):2===n?(i+=s[r>>10&63],i+=s[r>>4&63],i+=s[r<<2&63],i+=s[64]):1===n&&(i+=s[r>>2&63],i+=s[r<<4&63],i+=s[64],i+=s[64]),i}}),te=Object.prototype.hasOwnProperty,ne=Object.prototype.toString;var ie=new E("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,s=[],a=e;for(t=0,n=a.length;t>10),56320+(e-65536&1023))}for(var Ae=new Array(256),xe=new Array(256),Te=0;Te<256;Te++)Ae[Te]=ye(Te)?1:0,xe[Te]=ye(Te);function Ce(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||le,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function je(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=O(n),new T(t,n)}function Oe(e,t){throw je(e,t)}function Ie(e,t){e.onWarning&&e.onWarning.call(null,je(e,t))}var Se={YAML:function(e,t,n){var i,r,o;null!==e.version&&Oe(e,"duplication of %YAML directive"),1!==n.length&&Oe(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&Oe(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&Oe(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&Ie(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&Oe(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],de.test(i)||Oe(e,"ill-formed tag handle (first argument) of the TAG directive"),ce.call(e.tagMap,i)&&Oe(e,'there is a previously declared suffix for "'+i+'" tag handle'),fe.test(r)||Oe(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){Oe(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function Ee(e,t,n,i){var r,o,s,a;if(t1&&(e.result+=w.repeat("\n",t-1))}function De(e,t){var n,i,r=e.tag,o=e.anchor,s=[],a=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=s),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,Oe(e,"tab characters must not be used in indentation")),45===i)&&ke(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,Fe(e,!0,-1)&&e.lineIndent<=t)s.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,Re(e,t,3,!1,!0),s.push(e.result),Fe(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)Oe(e,"bad indentation of a sequence entry");else if(e.lineIndentt?f=1:e.lineIndent===t?f=0:e.lineIndentt?f=1:e.lineIndent===t?f=0:e.lineIndentt)&&(b&&(s=e.line,a=e.lineStart,l=e.position),Re(e,t,4,!0,r)&&(b?m=e.result:g=e.result),b||(Ne(e,h,d,f,m,g,s,a,l),f=m=g=null),Fe(e,!0,-1),c=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==c)Oe(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===r?Oe(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?Oe(e,"repeat of an indentation width identifier"):(u=t+r-1,c=!0)}if(be(o)){do{o=e.input.charCodeAt(++e.position)}while(be(o));if(35===o)do{o=e.input.charCodeAt(++e.position)}while(!ge(o)&&0!==o)}for(;0!==o;){for(Me(e),e.lineIndent=0,o=e.input.charCodeAt(e.position);(!c||e.lineIndentu&&(u=e.lineIndent),ge(o))p++;else{if(e.lineIndent0){for(r=s,o=0;r>0;r--)(s=_e(a=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+s:Oe(e,"expected hexadecimal character");e.result+=we(o),e.position++}else Oe(e,"unknown escape sequence");n=i=e.position}else ge(a)?(Ee(e,n,i,!0),qe(e,Fe(e,!1,t)),n=i=e.position):e.position===e.lineStart&&Le(e)?Oe(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}Oe(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?g=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!ke(i)&&!ve(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&Oe(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),ce.call(e.anchorMap,n)||Oe(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Fe(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,s,a,l,c,u,p=e.kind,h=e.result;if(ke(u=e.input.charCodeAt(e.position))||ve(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(ke(i=e.input.charCodeAt(e.position+1))||n&&ve(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,s=!1;0!==u;){if(58===u){if(ke(i=e.input.charCodeAt(e.position+1))||n&&ve(i))break}else if(35===u){if(ke(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&Le(e)||n&&ve(u))break;if(ge(u)){if(a=e.line,l=e.lineStart,c=e.lineIndent,Fe(e,!1,-1),e.lineIndent>=t){s=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=a,e.lineStart=l,e.lineIndent=c;break}}s&&(Ee(e,r,o,!1),qe(e,e.line-a),r=o=e.position,s=!1),be(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return Ee(e,r,o,!1),!!e.result||(e.kind=p,e.result=h,!1)}(e,h,1===n)&&(g=!0,null===e.tag&&(e.tag="?")):(g=!0,null===e.tag&&null===e.anchor||Oe(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===f&&(g=a&&De(e,d))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&Oe(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),l=0,c=e.implicitTypes.length;l"),null!==e.result&&p.kind!==e.kind&&Oe(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result,e.tag)?(e.result=p.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):Oe(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||g}function Pe(e){var t,n,i,r,o=e.position,s=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(Fe(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(s=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!ke(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&Oe(e,"directive name must not be less than one character in length");0!==r;){for(;be(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!ge(r));break}if(ge(r))break;for(t=e.position;0!==r&&!ke(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&Me(e),ce.call(Se,n)?Se[n](e,n,i):Ie(e,'unknown document directive "'+n+'"')}Fe(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,Fe(e,!0,-1)):s&&Oe(e,"directives end mark is expected"),Re(e,e.lineIndent-1,4,!1,!0),Fe(e,!0,-1),e.checkLineBreaks&&pe.test(e.input.slice(o,e.position))&&Ie(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Le(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,Fe(e,!0,-1)):e.position=55296&&i<=56319&&t+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function lt(e){return/^\n* /.test(e)}function ct(e,t,n,i,r,o,s,a){var l,c,u=0,p=null,h=!1,d=!1,f=-1!==i,m=-1,g=rt(c=at(e,0))&&c!==Ve&&!it(c)&&45!==c&&63!==c&&58!==c&&44!==c&&91!==c&&93!==c&&123!==c&&125!==c&&35!==c&&38!==c&&42!==c&&33!==c&&124!==c&&61!==c&&62!==c&&39!==c&&34!==c&&37!==c&&64!==c&&96!==c&&function(e){return!it(e)&&58!==e}(at(e,e.length-1));if(t||s)for(l=0;l=65536?l+=2:l++){if(!rt(u=at(e,l)))return 5;g=g&&st(u,p,a),p=u}else{for(l=0;l=65536?l+=2:l++){if(10===(u=at(e,l)))h=!0,f&&(d=d||l-m-1>i&&" "!==e[m+1],m=l);else if(!rt(u))return 5;g=g&&st(u,p,a),p=u}d=d||f&&l-m-1>i&&" "!==e[m+1]}return h||d?n>9&<(e)?5:s?2===o?5:2:d?4:3:!g||s||r(e)?2===o?5:2:1}function ut(e,t,n,i,r){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Ze.indexOf(t)||Qe.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var o=e.indent*Math.max(1,n),s=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),a=i||e.flowLevel>-1&&n>=e.flowLevel;switch(ct(t,a,e.indent,s,(function(t){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n"+pt(t,e.indent)+ht(tt(function(e,t){var n,i,r=/(\n+)([^\n]*)/g,o=(a=e.indexOf("\n"),a=-1!==a?a:e.length,r.lastIndex=a,dt(e.slice(0,a),t)),s="\n"===e[0]||" "===e[0];var a;for(;i=r.exec(e);){var l=i[1],c=i[2];n=" "===c[0],o+=l+(s||n||""===c?"":"\n")+dt(c,t),s=n}return o}(t,s),o));case 5:return'"'+function(e){for(var t,n="",i=0,r=0;r=65536?r+=2:r++)i=at(e,r),!(t=He[i])&&rt(i)?(n+=e[r],i>=65536&&(n+=e[r+1])):n+=t||Xe(i);return n}(t)+'"';default:throw new T("impossible error: invalid scalar style")}}()}function pt(e,t){var n=lt(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function ht(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function dt(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,s=0,a=0,l="";n=r.exec(e);)(a=n.index)-o>t&&(i=s>o?s:a,l+="\n"+e.slice(o,i),o=i+1),s=a;return l+="\n",e.length-o>t&&s>o?l+=e.slice(o,s)+"\n"+e.slice(s+1):l+=e.slice(o),l.slice(1)}function ft(e,t,n,i){var r,o,s,a="",l=e.tag;for(r=0,o=n.length;r tag resolver accepts not "'+l+'" style');i=a.represent[l](t,l)}e.dump=i}return!0}return!1}function gt(e,t,n,i,r,o,s){e.tag=null,e.dump=n,mt(e,n,!1)||mt(e,n,!0);var a,l=ze.call(e.dump),c=i;i&&(i=e.flowLevel<0||e.flowLevel>t);var u,p,h="[object Object]"===l||"[object Array]"===l;if(h&&(p=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||p||2!==e.indent&&t>0)&&(r=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(h&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===l)i&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var r,o,s,a,l,c,u="",p=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new T("sortKeys must be a boolean or a function");for(r=0,o=h.length;r1024)&&(e.dump&&10===e.dump.charCodeAt(0)?c+="?":c+="? "),c+=e.dump,l&&(c+=nt(e,t)),gt(e,t+1,a,!0,l)&&(e.dump&&10===e.dump.charCodeAt(0)?c+=":":c+=": ",u+=c+=e.dump));e.tag=p,e.dump=u||"{}"}(e,t,e.dump,r),p&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var i,r,o,s,a,l="",c=e.tag,u=Object.keys(n);for(i=0,r=u.length;i1024&&(a+="? "),a+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),gt(e,t,s,!1,!1)&&(l+=a+=e.dump));e.tag=c,e.dump="{"+l+"}"}(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===l)i&&0!==e.dump.length?(e.noArrayIndent&&!s&&t>0?ft(e,t-1,e.dump,r):ft(e,t,e.dump,r),p&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var i,r,o,s="",a=e.tag;for(i=0,r=n.length;i",e.dump=a+" "+e.dump)}return!0}function bt(e,t){var n,i,r=[],o=[];for(kt(e,r,o),n=0,i=o.length;nr){if(!t.final_argument_whitespace)throw new At(`maximum ${r} argument(s) allowed, ${i.length} supplied`);{const t=e.split(/\s+/);i=t.splice(0,r-1),i.push(t.join(" "))}}return i}(n,t):n&&(o=0,r=[n].concat(r)),r.length&&!r[0].trim()&&(r.shift(),o++),r.length&&!t.has_content)throw new At("Has content but content not allowed");return{map:e.map?e.map:[0,0],args:a,options:s,body:r.join("\n"),bodyMap:e.map?[r.length>0?e.map[0]+o:e.map[1],r.length>0?e.map[1]-1:e.map[1]]:[0,0]}}function Tt(e,t){let n=1,i={},r=null;if(e.length&&e[0].startsWith("---")){n++;const t=[];r=[];let i=!1;for(const o of e.slice(1))o.startsWith("---")?(n++,i=!0):i?t.push(o):(n++,r.push(o));e=t}else if(e.length&&e[0].startsWith(":")){const t=[];r=[];let i=!1;for(const o of e)i||o.startsWith(":")?i?t.push(o):(n++,r.push(o.slice(1))):(i=!0,t.push(o));e=t}if(null!==r)try{const e=yt.load(r.join("\n"));if(null===e||"object"!=typeof e)throw new At(`not dict: ${e}`);i=e}catch(e){throw new At(`Invalid options YAML: ${e}`)}if(t.rawOptions)return[e,i,n];for(const[e,n]of Object.entries(i)){const r=t.option_spec?t.option_spec[e]:null;if(!r)throw new At(`Unknown option: ${e}`);let o=n;null!==n&&!1!==n||(o="");try{o=r(`${o||""}`)}catch(t){throw new At(`Invalid option value: (option: '${e}'; value: ${n})\n${t}`)}i[e]=o}return[e,i,n]}function Ct(e,t){var n;let i=t.directivesAfter||"block";(null===(n=t.replaceFences)||void 0===n||n)&&(e.core.ruler.after(i,"fence_to_directive",jt),i="fence_to_directive"),e.core.ruler.after(i,"run_directives",function(e){function t(t){const n=[];for(const i of t.tokens)if("directive"===i.type&&i.info in e)try{const r=new e[i.info](t),o=xt(i,r),[s,a]=Tt(i.content.trim()?i.content.split(/\r?\n/):[],r),l=new t.Token("parsed_directive_open","",1);l.info=i.info,l.hidden=!0,l.content=s.join("\n").trim(),l.meta={arg:i.meta.arg,opts:a};const c=[l];c.push(...r.run(o));const u=new t.Token("parsed_directive_close","",-1);u.hidden=!0,c.push(u),c[1].meta=Object.assign(Object.assign({directive:!0},o.options),c[1].meta),n.push(...c)}catch(e){const r=new t.Token("directive_error","",0);r.content=i.content,r.info=i.info,r.meta=i.meta,r.map=i.map,r.meta.error_message=e.message,r.meta.error_name=e.name,n.push(r)}else n.push(i);return t.tokens=n,!0}return t}(t.directives||{})),e.renderer.rules.directive=(e,t)=>{const n=e[t];return`\n`},e.renderer.rules.directive_error=(e,t)=>{const n=e[t];let i="";return n.content&&(i=`\n---\n${n.content}`),`\n`}}function jt(e){for(const t of e.tokens)if("fence"===t.type||"colon_fence"===t.type){const e=t.info.match(/^\{([^\s}]+)\}\s*(.*)$/);e&&(t.type="directive",t.info=e[1],t.meta={arg:e[2]})}return!0}function Ot(e){return e.toLowerCase().split(/\s+/).join("-").replace(/[^a-z0-9]+/,"-").replace(/^[-0-9]+|-+$/,"")}class It extends Error{constructor(){super(...arguments),this.name="OptionSpecError"}}const St=e=>e,Et=e=>{if(!e)throw new It("Argument required but none supplied");return e},$t=e=>{if(e.trim())throw new It(`No argument is allowed: "${e}" supplied`);return null},Nt=e=>`${e||""}`.split(/\s+/).map((e=>Ot(e)));function Mt(e){if(!e)throw new It("Value is not set");const t=Number.parseFloat(e);if(Number.isNaN(t)||!Number.isInteger(t))throw new It(`Value "${e}" is not an integer`);return t}function Ft(e){const t=Mt(e);if(t<0)throw new It(`Value "${e}" must be positive or zero`);return t}const Lt=e=>e?Ft(e):null,qt=e=>Ft(e=`${e||""}`.replace(/\s+%$/,""));function Dt(e,t){const n=new RegExp(`^(?[0-9.]+)\\s*(?${t.join("|")})$`).exec(e);if(!n||!n.groups)throw new It(`not a positive measure of one of the following units: ${t.join("|")}`);return n.groups.number+n.groups.units}const Ut=["em","ex","px","in","cm","mm","pt","pc"],Yt=e=>Dt(e,[...Ut,""]),Rt=(e,t="")=>{try{return Dt(e,[...Ut,"%"])}catch(n){return Yt(e)+t}},Pt=(e,t="")=>"image"===e.toLowerCase()?"image":Rt(e,t);function Wt(e){return t=>{if(t=t.toLowerCase().trim(),e.includes(t))return t;throw new It(`must be in: ${e.join("|")}`)}}const Jt=e=>e;var Bt=Object.freeze({__proto__:null,make_id:Ot,OptionSpecError:It,unchanged:St,unchanged_required:Et,flag:$t,class_option:Nt,int:Mt,nonnegative_int:Ft,optional_int:Lt,percentage:qt,length_or_unitless:Yt,length_or_percentage_or_unitless:Rt,length_or_percentage_or_unitless_figure:Pt,create_choice:Wt,uri:Jt});class Kt extends wt{constructor(){super(...arguments),this.final_argument_whitespace=!0,this.has_content=!0,this.option_spec={class:Nt,name:St},this.title="",this.kind=""}run(e){var t;const n=[],i=this.createToken("admonition_open","aside",1,{map:e.map,block:!0,meta:{kind:this.kind}});(null===(t=e.options.class)||void 0===t?void 0:t.length)>=1?(i.attrSet("class",e.options.class.join(" ")),i.attrJoin("class","admonition")):i.attrSet("class","admonition"),this.kind&&i.attrJoin("class",this.kind),n.push(i);const r=this.createToken("admonition_title_open","header",1);r.attrSet("class","admonition-title"),n.push(r);const o=e.args[0]||this.title;n.push(this.createToken("inline","",0,{map:[e.map[0],e.map[0]],content:o,children:[]})),n.push(this.createToken("admonition_title_close","header",-1,{block:!0}));const s=this.nestedParse(e.body,e.bodyMap[0]);return n.push(...s),n.push(this.createToken("admonition_close","aside",-1,{block:!0})),n}}const zt={admonition:class extends Kt{constructor(){super(...arguments),this.required_arguments=1}},attention:class extends Kt{constructor(){super(...arguments),this.title="Attention",this.kind="attention"}},caution:class extends Kt{constructor(){super(...arguments),this.title="Caution",this.kind="caution"}},danger:class extends Kt{constructor(){super(...arguments),this.title="Danger",this.kind="danger"}},error:class extends Kt{constructor(){super(...arguments),this.title="Error",this.kind="error"}},important:class extends Kt{constructor(){super(...arguments),this.title="Important",this.kind="important"}},hint:class extends Kt{constructor(){super(...arguments),this.title="Hint",this.kind="hint"}},note:class extends Kt{constructor(){super(...arguments),this.title="Note",this.kind="note"}},seealso:class extends Kt{constructor(){super(...arguments),this.title="See Also",this.kind="seealso"}},tip:class extends Kt{constructor(){super(...arguments),this.title="Tip",this.kind="tip"}},warning:class extends Kt{constructor(){super(...arguments),this.title="Warning",this.kind="warning"}}};const Gt={code:class extends wt{constructor(){super(...arguments),this.required_arguments=0,this.optional_arguments=1,this.final_argument_whitespace=!1,this.has_content=!0,this.option_spec={"number-lines":Lt,force:$t,name:St,class:Nt}}run(e){this.assert_has_content(e);return[this.createToken("fence","code",0,{info:e.args?e.args[0]:"",content:e.body,map:e.bodyMap})]}},"code-block":class extends wt{constructor(){super(...arguments),this.required_arguments=0,this.optional_arguments=1,this.final_argument_whitespace=!1,this.has_content=!0,this.option_spec={linenos:$t,"lineno-start":Mt,dedent:Lt,"emphasize-lines":Et,caption:Et,force:$t,name:St,class:Nt}}run(e){this.assert_has_content(e);return[this.createToken("fence","code",0,{info:e.args?e.args[0]:"",content:e.body,map:e.bodyMap})]}},"code-cell":class extends wt{constructor(){super(...arguments),this.required_arguments=0,this.optional_arguments=1,this.final_argument_whitespace=!1,this.has_content=!0,this.rawOptions=!0}run(e){return[this.createToken("fence","code",0,{info:e.args?e.args[0]:"",content:e.body,map:e.bodyMap})]}}},Vt={alt:St,height:Yt,width:Rt,scale:qt,target:Et,class:Nt,name:St};class Ht extends wt{constructor(){super(...arguments),this.required_arguments=1,this.optional_arguments=0,this.final_argument_whitespace=!0,this.option_spec=Object.assign(Object.assign({},Vt),{align:Wt(["left","center","right","top","middle","bottom"])})}create_image(e){const t=e.args[0]||"",n=this.createToken("image","img",0,{map:e.map,block:!0});n.attrSet("src",t),n.attrSet("alt",e.options.alt||"");const i=[];return e.options.alt&&this.state.md.inline.parse(e.options.alt,this.state.md,this.state.env,i),n.children=i,e.options.height&&n.attrSet("height",e.options.height),e.options.width&&n.attrSet("width",e.options.width),e.options.align&&n.attrJoin("class",`align-${e.options.align}`),e.options.class&&n.attrJoin("class",e.options.class.join(" ")),n}run(e){return[this.create_image(e)]}}const Zt={image:Ht,figure:class extends Ht{constructor(){super(...arguments),this.option_spec=Object.assign(Object.assign({},Vt),{align:Wt(["left","center","right"]),figwidth:Pt,figclass:Nt}),this.has_content=!0}run(e){const t=this.createToken("figure_open","figure",1,{map:e.map,block:!0});let n;e.options.figclass&&t.attrJoin("class",e.options.figclass.join(" ")),e.options.align&&t.attrJoin("class",`align-${e.options.align}`),e.options.figwidth&&"image"!==e.options.figwidth&&t.attrSet("width",e.options.figwidth),e.options.name&&(n=g(this.state,t,f.figure,e.options.name,e.body.trim()),t.attrJoin("class","numbered"));const i=this.create_image(e);i.map=[e.map[0],e.map[0]];let r=[],o=[];if(e.body){const[t,...i]=e.body.split("\n\n"),s=i.join("\n\n"),a=e.bodyMap[0],l=this.createToken("figure_caption_open","figcaption",1,{block:!0});n&&l.attrSet("number",`${n.number}`);if(r=[l,...this.nestedParse(t,a),this.createToken("figure_caption_close","figcaption",-1,{block:!0})],s){const e=a+t.split("\n").length+1;o=[this.createToken("figure_legend_open","",1,{block:!0}),...this.nestedParse(s,e),this.createToken("figure_legend_close","",-1,{block:!0})]}}const s=this.createToken("figure_close","figure",-1,{block:!0});return[t,i,...r,...o,s]}}};class Qt{constructor(e,t=!0){if(this.children=[],this.children=[],t)this._set_children_from_tokens(e);else{if(0===e.length)throw new Error("Tree creation: Can only create root from empty token sequence.");if(1===e.length){const t=e[0];if(t.nesting)throw new Error("Unequal nesting level at the start and end of token stream.");this.token=t,null!==t.children&&t.children.length>0&&this._set_children_from_tokens(t.children)}else this.nester_tokens={opening:e[0],closing:e[e.length-1]},this._set_children_from_tokens(e.slice(1,-1))}}_set_children_from_tokens(e){const t=[...e].reverse();let n;for(;t.length>0&&(n=t.pop(),n);){if(!n.nesting){this._add_child([n]);continue}if(1!==n.nesting)throw new Error("Invalid token nesting");const e=[n];let i=1;for(;t.length>0&&0!==i;)n=t.pop(),n&&(e.push(n),i+=n.nesting);if(i)throw new Error(`unclosed tokens starting: ${e[0]}`);this._add_child(e)}}_add_child(e){const t=new Qt(e,!1);t.parent=this,this.children.push(t)}to_tokens(){const e=[];return function e(t,n){if("root"===t.type)for(const i of t.children)e(i,n);else if(t.token)n.push(t.token);else{if(!t.nester_tokens)throw new Error("No nested token available");n.push(t.nester_tokens.opening);for(const i of t.children)e(i,n);n.push(t.nester_tokens.closing)}}(this,e),e}get is_root(){return!(this.token||this.nester_tokens)}get is_nested(){return!!this.nester_tokens}get siblings(){return this.parent?this.parent.children:[this]}*walk(e=!0){e&&(yield this);for(const e of this.children)yield*e.walk(!0)}get type(){var e,t,n;if(this.is_root)return"root";if(this.token)return this.token.type;if(null===(e=this.nester_tokens)||void 0===e?void 0:e.opening.type.endsWith("_open"))return null===(t=this.nester_tokens)||void 0===t?void 0:t.opening.type.slice(0,-5);if(this.nester_tokens)return null===(n=this.nester_tokens)||void 0===n?void 0:n.opening.type;throw new Error("no internal token")}attribute_token(){if(this.token)return this.token;if(this.nester_tokens)return this.nester_tokens.opening;throw new Error("Tree node does not have the accessed attribute")}get tag(){return this.attribute_token().tag}get level(){return this.attribute_token().level}get content(){return this.attribute_token().content}get markup(){return this.attribute_token().markup}get info(){return this.attribute_token().info}get meta(){return this.attribute_token().meta}get block(){return this.attribute_token().block}get hidden(){return this.attribute_token().hidden}get map(){return this.attribute_token().map}get attrs(){return this.attribute_token().attrs}}const Xt={"list-table":class extends wt{constructor(){super(...arguments),this.required_arguments=0,this.optional_arguments=1,this.final_argument_whitespace=!0,this.has_content=!0,this.option_spec={"header-rows":Ft,"stub-columns":Ft,width:Rt,widths:St,class:Nt,name:St,align:Wt(["left","center","right"])}}run(e){this.assert_has_content(e);const t=e.options["header-rows"]||0,n=this.nestedParse(e.body,e.bodyMap[0]);if(n.length<2||"bullet_list_open"!==n[0].type||"bullet_list_close"!==n[n.length-1].type)throw new At("Content is not a single bullet list");const i=[],r=this.createToken("table_open","table",1,{map:e.bodyMap});e.options.align&&r.attrJoin("class",`align-${e.options.align}`),e.options.class&&r.attrJoin("class",e.options.class.join(" ")),i.push(r),e.args.length&&e.args[0]&&(i.push(this.createToken("table_caption_open","caption",1)),i.push(this.createToken("inline","",0,{map:[e.map[0],e.map[0]],content:e.args[0],children:[]})),i.push(this.createToken("table_caption_close","caption",-1)));let o,s="th";t?(i.push(this.createToken("thead_open","thead",1,{level:1})),s="th"):(i.push(this.createToken("tbody_open","tbody",1,{level:1})),s="td");let a=0;for(const e of new Qt(n.slice(1,-1)).children){a+=1,this.assert("list_item"===e.type,`list item ${a} not of type 'list_item': ${e.type}`),this.assert(1===e.children.length&&"bullet_list"===e.children[0].type,`list item ${a} content not a nested bullet list`);const n=e.children[0].children;void 0===o?o=n.length:this.assert(n.length===o,`list item ${a} does not contain the same number of columns as previous items`),t&&a===t+1&&(i.push(this.createToken("thead_close","thead",-1,{level:1})),i.push(this.createToken("tbody_open","tbody",1,{level:1})),s="td"),i.push(this.createToken("tr_open","tr",1,{map:e.map,level:2}));for(const e of n)i.push(this.createToken(`${s}_open`,s,1,{map:e.map,level:3})),i.push(...e.to_tokens().slice(1,-1)),i.push(this.createToken(`${s}_close`,s,-1,{level:3}));i.push(this.createToken("tr_close","tr",-1,{level:2}))}if(t&&a{const t=m(e);return t.references.forEach((e=>{const{label:n,tokens:i,contentFromTarget:r}=e,o=(e,t)=>(i.open.attrJoin("class","error"),i.open.tag=i.close.tag="code",i.content.content=r&&t?r(t):e,!0),s=t.targets[n];return s?e.kind&&s.kind!==e.kind?o(`Reference "${n}" does not match kind "${e.kind}"`):(i.open.attrSet("href",`#${s.label}`),s.title&&i.open.attrSet("title",s.title),void(r&&(i.content.content=r(s).trim()))):o(n,{kind:e.kind||"",label:n,title:n,number:`"${n}"`})})),!0}))}const rn={parseRoles:!0,replaceFences:!0,rolesAfter:"inline",directivesAfter:"block",directives:tn,roles:_};function on(e,t){const n=Object.assign(Object.assign({},rn),t);e.use(o,n),e.use(Ct,n),e.use(nn,n)}e.Directive=wt,e.Role=t,e.default=on,e.directiveOptions=Bt,e.directivePlugin=Ct,e.directivesDefault=tn,e.docutilsPlugin=on,e.rolePlugin=o,e.rolesDefault=_,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=index.umd.min.js.map