import{z as G}from"./vendor-zwitch-C2o2j-tx.js";import{l as Q}from"./vendor-longest-streak-CtXnX3Xp.js";import{c as C}from"./vendor-micromark-util-classify-character-Bc1Mydac.js";import{v as U}from"./vendor-unist-util-visit-8PRsQcuP.js";import{t as B}from"./vendor-mdast-util-to-string-C_aolqmU.js";import{E as D}from"./vendor-unist-util-visit-parents-BHoKBdZX.js";import{p as H}from"./vendor-mdast-util-phrasing-4oVbNLC3.js";import{d as Z}from"./vendor-micromark-util-decode-string-fHsnqYdj.js";const K={}.hasOwnProperty;function L(n,t){let e=-1,r;if(t.extensions)for(;++e "),l.shift(2);const o=e.indentLines(e.containerFlow(n,l.current()),J);return c(),o}function J(n,t,e){return">"+(e?"":" ")+n}function S(n,t){return I(n,t.inConstruct,!0)&&!I(n,t.notInConstruct,!1)}function I(n,t,e){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return e;let r=-1;for(;++r",...i.current()})),a+=i.move(">")):(s=e.enter("destinationRaw"),a+=i.move(e.safe(n.url,{before:a,after:n.title?" ":` `,...i.current()}))),s(),n.title&&(s=e.enter(`title${l}`),a+=i.move(" "+c),a+=i.move(e.safe(n.title,{before:a,after:c,...i.current()})),a+=i.move(c),s()),o(),a}function ne(n){const t=n.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function m(n){return"&#x"+n.toString(16).toUpperCase()+";"}function b(n,t,e){const r=C(n),c=C(t);return r===void 0?c===void 0?e==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}F.peek=te;function F(n,t,e,r){const c=ne(e),l=e.enter("emphasis"),o=e.createTracker(r),s=o.move(c);let i=o.move(e.containerPhrasing(n,{after:c,before:s,...o.current()}));const a=i.charCodeAt(0),u=b(r.before.charCodeAt(r.before.length-1),a,c);u.inside&&(i=m(a)+i.slice(1));const f=i.charCodeAt(i.length-1),h=b(r.after.charCodeAt(0),f,c);h.inside&&(i=i.slice(0,-1)+m(f));const d=o.move(c);return l(),e.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},s+i+d}function te(n,t,e){return e.options.emphasis||"*"}function P(n,t){let e=!1;return U(n,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return e=!0,D}),!!((!n.depth||n.depth<3)&&B(n)&&(t.options.setext||e))}function re(n,t,e,r){const c=Math.max(Math.min(6,n.depth||1),1),l=e.createTracker(r);if(P(n,e)){const u=e.enter("headingSetext"),f=e.enter("phrasing"),h=e.containerPhrasing(n,{...l.current(),before:` `,after:` `});return f(),u(),h+` `+(c===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` `))+1))}const o="#".repeat(c),s=e.enter("headingAtx"),i=e.enter("phrasing");l.move(o+" ");let a=e.containerPhrasing(n,{before:"# ",after:` `,...l.current()});return/^[\t ]/.test(a)&&(a=m(a.charCodeAt(0))+a.slice(1)),a=a?o+" "+a:o,e.options.closeAtx&&(a+=" "+o),i(),s(),a}T.peek=ie;function T(n){return n.value||""}function ie(){return"<"}E.peek=oe;function E(n,t,e,r){const c=x(e),l=c==='"'?"Quote":"Apostrophe",o=e.enter("image");let s=e.enter("label");const i=e.createTracker(r);let a=i.move("![");return a+=i.move(e.safe(n.alt,{before:a,after:"]",...i.current()})),a+=i.move("]("),s(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(s=e.enter("destinationLiteral"),a+=i.move("<"),a+=i.move(e.safe(n.url,{before:a,after:">",...i.current()})),a+=i.move(">")):(s=e.enter("destinationRaw"),a+=i.move(e.safe(n.url,{before:a,after:n.title?" ":")",...i.current()}))),s(),n.title&&(s=e.enter(`title${l}`),a+=i.move(" "+c),a+=i.move(e.safe(n.title,{before:a,after:c,...i.current()})),a+=i.move(c),s()),a+=i.move(")"),o(),a}function oe(){return"!"}R.peek=ce;function R(n,t,e,r){const c=n.referenceType,l=e.enter("imageReference");let o=e.enter("label");const s=e.createTracker(r);let i=s.move("![");const a=e.safe(n.alt,{before:i,after:"]",...s.current()});i+=s.move(a+"]["),o();const u=e.stack;e.stack=[],o=e.enter("reference");const f=e.safe(e.associationId(n),{before:i,after:"]",...s.current()});return o(),e.stack=u,l(),c==="full"||!a||a!==f?i+=s.move(f+"]"):c==="shortcut"?i=i.slice(0,-1):i+=s.move("]"),i}function ce(){return"!"}z.peek=ae;function z(n,t,e){let r=n.value||"",c="`",l=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(r);)c+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l\u007F]/.test(n.url))}j.peek=se;function j(n,t,e,r){const c=x(e),l=c==='"'?"Quote":"Apostrophe",o=e.createTracker(r);let s,i;if($(n,e)){const u=e.stack;e.stack=[],s=e.enter("autolink");let f=o.move("<");return f+=o.move(e.containerPhrasing(n,{before:f,after:">",...o.current()})),f+=o.move(">"),s(),e.stack=u,f}s=e.enter("link"),i=e.enter("label");let a=o.move("[");return a+=o.move(e.containerPhrasing(n,{before:a,after:"](",...o.current()})),a+=o.move("]("),i(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(i=e.enter("destinationLiteral"),a+=o.move("<"),a+=o.move(e.safe(n.url,{before:a,after:">",...o.current()})),a+=o.move(">")):(i=e.enter("destinationRaw"),a+=o.move(e.safe(n.url,{before:a,after:n.title?" ":")",...o.current()}))),i(),n.title&&(i=e.enter(`title${l}`),a+=o.move(" "+c),a+=o.move(e.safe(n.title,{before:a,after:c,...o.current()})),a+=o.move(c),i()),a+=o.move(")"),s(),a}function se(n,t,e){return $(n,e)?"<":"["}M.peek=le;function M(n,t,e,r){const c=n.referenceType,l=e.enter("linkReference");let o=e.enter("label");const s=e.createTracker(r);let i=s.move("[");const a=e.containerPhrasing(n,{before:i,after:"]",...s.current()});i+=s.move(a+"]["),o();const u=e.stack;e.stack=[],o=e.enter("reference");const f=e.safe(e.associationId(n),{before:i,after:"]",...s.current()});return o(),e.stack=u,l(),c==="full"||!a||a!==f?i+=s.move(f+"]"):c==="shortcut"?i=i.slice(0,-1):i+=s.move("]"),i}function le(){return"["}function w(n){const t=n.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function ue(n){const t=w(n),e=n.options.bulletOther;if(!e)return t==="*"?"-":"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(e===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+e+"`) to be different");return e}function fe(n){const t=n.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function O(n){const t=n.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function he(n,t,e,r){const c=e.enter("list"),l=e.bulletCurrent;let o=n.ordered?fe(e):w(e);const s=n.ordered?o==="."?")":".":ue(e);let i=t&&e.bulletLastUsed?o===e.bulletLastUsed:!1;if(!n.ordered){const u=n.children?n.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&e.stack[e.stack.length-1]==="list"&&e.stack[e.stack.length-2]==="listItem"&&e.stack[e.stack.length-3]==="list"&&e.stack[e.stack.length-4]==="listItem"&&e.indexStack[e.indexStack.length-1]===0&&e.indexStack[e.indexStack.length-2]===0&&e.indexStack[e.indexStack.length-3]===0&&(i=!0),O(e)===o&&u){let f=-1;for(;++f-1?t.start:1)+(e.options.incrementListMarker===!1?0:t.children.indexOf(n))+l);let o=l.length+1;(c==="tab"||c==="mixed"&&(t&&t.type==="list"&&t.spread||n.spread))&&(o=Math.ceil(o/4)*4);const s=e.createTracker(r);s.move(l+" ".repeat(o-l.length)),s.shift(o);const i=e.enter("listItem"),a=e.indentLines(e.containerFlow(n,s.current()),u);return i(),a;function u(f,h,d){return h?(d?"":" ".repeat(o))+f:(d?l:l+" ".repeat(o-l.length))+f}}function me(n,t,e,r){const c=e.enter("paragraph"),l=e.enter("phrasing"),o=e.containerPhrasing(n,r);return l(),c(),o}function ke(n,t,e,r){return(n.children.some(function(o){return H(o)})?e.containerPhrasing:e.containerFlow).call(e,n,r)}function ge(n){const t=n.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}q.peek=be;function q(n,t,e,r){const c=ge(e),l=e.enter("strong"),o=e.createTracker(r),s=o.move(c+c);let i=o.move(e.containerPhrasing(n,{after:c,before:s,...o.current()}));const a=i.charCodeAt(0),u=b(r.before.charCodeAt(r.before.length-1),a,c);u.inside&&(i=m(a)+i.slice(1));const f=i.charCodeAt(i.length-1),h=b(r.after.charCodeAt(0),f,c);h.inside&&(i=i.slice(0,-1)+m(f));const d=o.move(c+c);return l(),e.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},s+i+d}function be(n,t,e){return e.options.strong||"*"}function ve(n,t,e,r){return e.safe(n.value,r)}function xe(n){const t=n.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function we(n,t,e){const r=(O(e)+(e.options.ruleSpaces?" ":"")).repeat(xe(e));return e.options.ruleSpaces?r.slice(0,-1):r}const Ce={blockquote:X,break:_,code:V,definition:ee,emphasis:F,hardBreak:_,heading:re,html:T,image:E,imageReference:R,inlineCode:z,link:j,linkReference:M,list:he,listItem:pe,paragraph:me,root:ke,strong:q,text:ve,thematicBreak:we},Ae=[Ie];function Ie(n,t,e,r){if(t.type==="code"&&v(t,r)&&(n.type==="list"||n.type===t.type&&v(n,r)))return!1;if("spread"in e&&typeof e.spread=="boolean")return n.type==="paragraph"&&(n.type===t.type||t.type==="definition"||t.type==="heading"&&P(t,r))?void 0:e.spread?1:0}const g=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],_e=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:` `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:g},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:g},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r *])`},{character:"*",inConstruct:"phrasing",notInConstruct:g},{atBreak:!0,character:"+",after:`(?:[ \r ])`},{atBreak:!0,character:"-",after:`(?:[ \r -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:g},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:g},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:g},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:g},{atBreak:!0,character:"~"}];function ye(n){return n.label||!n.identifier?n.label||"":Z(n.identifier)}function Be(n){if(!n._compiled){const t=(n.atBreak?"[\\r\\n][\\t ]*":"")+(n.before?"(?:"+n.before+")":"");n._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(n.character)?"\\":"")+n.character+(n.after?"(?:"+n.after+")":""),"g")}return n._compiled}function Le(n,t,e){const r=t.indexStack,c=n.children||[],l=[];let o=-1,s=e.before,i;r.push(-1);let a=t.createTracker(e);for(;++o0&&(s==="\r"||s===` `)&&u.type==="html"&&(l[l.length-1]=l[l.length-1].replace(/(\r?\n|\r)$/," "),s=" ",a=t.createTracker(e),a.move(l.join("")));let h=t.handle(u,n,t,{...a.current(),after:f,before:s});i&&i===h.slice(0,1)&&(h=m(i.charCodeAt(0))+h.slice(1));const d=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,i=void 0,d&&(l.length>0&&d.before&&s===l[l.length-1].slice(-1)&&(l[l.length-1]=l[l.length-1].slice(0,-1)+m(s.charCodeAt(0))),d.after&&(i=f)),a.move(h),l.push(h),s=h.slice(-1)}return r.pop(),l.join("")}function Se(n,t,e){const r=t.indexStack,c=n.children||[],l=t.createTracker(e),o=[];let s=-1;for(r.push(-1);++s `}return` `}const Pe=/\r?\n|\r/g;function Te(n,t){const e=[];let r=0,c=0,l;for(;l=Pe.exec(n);)o(n.slice(r,l.index)),e.push(l[0]),r=l.index+l[0].length,c++;return o(n.slice(r)),e.join("");function o(s){e.push(t(s,c,!s))}}function Ee(n,t,e){const r=(e.before||"")+(t||"")+(e.after||""),c=[],l=[],o={};let s=-1;for(;++s=a||u+1