var I=32,w=9,P9=13,T=10,$0=96,b0=126,D0=91,O9=94,c=62,_9=35,K$=37,d=45,p0=61,y0=92,j0=42,O0=95,n=60,W$=64,$9=93,T0=33,e9=38,f0=58,u$=70,N9=102,l9=104,v9=119,o9=116,v$=112,p$=115,W6=160,F6=12,z6=44,d$=59,$$=63,Z9=46,M0=47,g9=39,V9=34,b9=43,k0=124,h9=123,I$=125,H9=40,D9=41,Z$=30,P$=31,r=48,i=57,u=65,l=90,J0=97,Y0=122,J$=128,d0=32,bZ={blockQuote:0,breakLine:1,breakThematic:2,codeBlock:3,codeInline:4,footnote:5,footnoteReference:6,frontmatter:7,gfmTask:8,heading:9,htmlBlock:10,htmlComment:11,htmlSelfClosing:12,image:13,link:14,orderedList:15,paragraph:16,ref:17,refCollection:18,table:19,text:20,textFormatted:21,unorderedList:22},_=bZ;import{decodeEntity as RZ}from"markdown-to-jsx/entities";function A6($){if(!H6($,"---"))return null;let Z=3;for(;Z<$.length&&($[Z]===" "||$[Z]==="	");)Z++;if(Z<$.length&&$[Z]==="\r"&&Z++,Z>=$.length||$[Z]!==`
`)return null;Z++;let J=!1;for(;Z<$.length;){let Q=Z;for(;Z<$.length&&$[Z]!==`
`&&$[Z]!=="\r";)Z++;if(Z>=$.length)break;let X=Z;if($[Z]==="\r"&&Z++,Z<$.length&&$[Z]===`
`&&Z++,H6($,"---",Q))return{endPos:Z,hasValidYaml:J};if(!J){let Y=TZ($,Q,X);if(Y<X){let V=$.charCodeAt(Y);if(V>=J0&&V<=Y0||V>=u&&V<=l||V>=r&&V<=i||V===O0){for(Y++;Y<X&&(V=$.charCodeAt(Y),V>=J0&&V<=Y0||V>=u&&V<=l||V>=r&&V<=i||V===O0||V===d||V===Z9);)Y++;Y<X&&$.charCodeAt(Y)===f0&&(Y++,Y>=X?J=!0:(V=$.charCodeAt(Y),(V===I||V===w)&&(J=!0)))}}}}return null}var wZ=/&([a-zA-Z0-9]+|#[0-9]{1,7}|#x[0-9a-fA-F]{1,6});/gi,yZ={class:"className",for:"htmlFor",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",classid:"classId",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",enctype:"encType",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap",viewbox:"viewBox"};function WJ($){var Z={};for(var J in $){var Q=J.toLowerCase(),X=yZ[Q];if(X)Z[X]=$[J];else{var Y=J.indexOf(":");Y!==-1?Z[J.slice(0,Y)+J[Y+1].toUpperCase()+J.slice(Y+2)]=$[J]:Z[J]=$[J]}}return Z}var FJ=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s|^<(div|p|h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|td|th|dl|dt|dd|hr|address|article|aside|details|dialog|figure|figcaption|footer|form|header|main|menu|nav|section|summary|textarea|fieldset|legend|center|dir|hgroup|marquee|search|output|template)\b)/i;function x9($){return $.indexOf("&")===-1?$:$.replace(wZ,(Z,J)=>{var Q=RZ(J);if(Q)return Q;if(J[0]==="#"){var X=J[1]==="x"||J[1]==="X"?parseInt(J.slice(2),16):parseInt(J.slice(1),10);return X===0||X>=55296&&X<=57343||X>1114111?"\uFFFD":X<=65535?String.fromCharCode(X):String.fromCharCode(55296+(X-65536>>10),56320+(X-65536&1023))}return Z})}var O6=/(javascript|vbscript|data(?!:image)):/i;function Q$($){if(O6.test($))return null;if($.indexOf("%")===-1)return $;try{let Z=decodeURIComponent($).replace(/[^A-Za-z0-9/:]/g,"");if(O6.test(Z))return null}catch{return null}return $}var C0={},c0,L0;for(c0=[192,193,194,195,196,197,224,225,226,227,228,229,230,198],L0=0;L0<c0.length;L0++)C0[c0[L0]]="a";for(C0[231]=C0[199]="c",C0[240]=C0[208]="d",c0=[200,201,202,203,233,232,234,235],L0=0;L0<c0.length;L0++)C0[c0[L0]]="e";for(c0=[207,239,206,238,205,237,204,236],L0=0;L0<c0.length;L0++)C0[c0[L0]]="i";for(C0[209]=C0[241]="n",c0=[248,216,339,338,213,245,212,244,211,243,210,242],L0=0;L0<c0.length;L0++)C0[c0[L0]]="o";for(c0=[220,252,219,251,218,250,217,249],L0=0;L0<c0.length;L0++)C0[c0[L0]]="u";C0[376]=C0[255]=C0[221]=C0[253]="y";function J9($){for(var Z="",J=-1,Q=$.length,X=0;X<Q;X++){var Y=$.charCodeAt(X);if(Y>=J0&&Y<=Y0||Y>=r&&Y<=i){J<0&&(J=X);continue}if(Y>=u&&Y<=l){J>=0&&(Z+=$.slice(J,X),J=-1),Z+=String.fromCharCode(Y+d0);continue}if(Y===I||Y===d){J>=0&&(Z+=$.slice(J,X),J=-1),Z+="-";continue}J>=0&&(Z+=$.slice(J,X),J=-1);var V=C0[Y];V&&(Z+=V)}return J>=0&&(Z+=$.slice(J)),Z}function H6($,Z,J){return $.startsWith(Z,J)}var D6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr","circle","ellipse","line","path","polygon","polyline","rect","use","stop","animate","set"]);function a9($){let Z=$.toLowerCase();if(D6.has(Z))return!0;let J=Z.indexOf(":");return J!==-1?(Z=Z.slice(J+1),D6.has(Z)):!1}var R9=1,B6=2,i9=4,j6=8,kZ=16,B9=32,w9=64,M6=1,LZ=2,EZ=3,SZ=4,_6=(function(){var $=new Uint8Array(128),Z;for($[w]=R9,$[T]=R9|B6,$[F6]=R9,$[P9]=R9|B6,$[I]=R9,Z=T0;Z<=M0;Z++)$[Z]=i9;for(Z=f0;Z<=W$;Z++)$[Z]=i9;for(Z=D0;Z<=$0;Z++)$[Z]=i9;for(Z=h9;Z<=b0;Z++)$[Z]=i9;for(Z=r;Z<=i;Z++)$[Z]=kZ;for(Z=u;Z<=l;Z++)$[Z]=j6;for(Z=J0;Z<=Y0;Z++)$[Z]=j6;return $})(),zJ=(function(){let $=new Uint8Array(128);return $[y0]=LZ,$[D0]=SZ,$[j0]=$[O0]=$[b0]=$[p0]=EZ,$[$0]=$[n]=$[W$]=$[$9]=$[T]=$[I]=$[T0]=M6,$[N9]=$[l9]=$[v9]=M6,$})(),v6=/[\p{P}\p{S}]/u,I6=/\p{Zs}/u,r9=[];function l$($){var Z=$.indexOf("\r"),J=$.indexOf("\0");if(Z===-1&&J===-1)return $;var Q=$.length;r9.length=0;var X=0,Y=0;for(Z===-1?Y=J:J===-1?Y=Z:Y=Z<J?Z:J;Y<Q;Y++){var V=$.charCodeAt(Y);V===P9?(X<Y&&r9.push($.slice(X,Y)),Y+1<Q&&$.charCodeAt(Y+1)===T&&Y++,r9.push(`
`),X=Y+1):V===0&&(X<Y&&r9.push($.slice(X,Y)),r9.push("\uFFFD"),X=Y+1)}return X<Q&&r9.push($.slice(X)),r9.join("")}function TZ($,Z,J){let Q=J??$.length;for(;Z<Q&&($[Z]===" "||$[Z]==="	");)Z++;return Z}function P6($){if(!$)return!1;for(var Z in $)return!0;return!1}function N6($,Z,J){for(var Q=$,X=Z.split("."),Y=0;Y<X.length&&(Q=Q?.[X[Y]],Q!==void 0);)Y++;return Q||J}function o$($){for(var Z=!1,J=0;J<$.length;J++){var Q=$.charCodeAt(J);if(Q<=I||Q===V9||Q===K$||Q===n||Q===c||Q===D0||Q===y0||Q===$9||Q===O9||Q===$0||Q>=123){Z=!0;break}}if(!Z)return $;for(var X="",J=0;J<$.length;J++){var Q=$.charCodeAt(J);if(Q===K$&&J+2<$.length){var Y=$.charCodeAt(J+1),V=$.charCodeAt(J+2);if((Y>=r&&Y<=i||Y>=u&&Y<=u$||Y>=J0&&Y<=N9)&&(V>=r&&V<=i||V>=u&&V<=u$||V>=J0&&V<=N9)){X+=$[J]+$[J+1]+$[J+2],J+=2;continue}}X+=encodeURI($[J])}return X}function OJ(...$){return $.filter(Boolean).join(" ")}function C9($,Z){if(!Z)return $;let J=N6(Z,$,void 0);return typeof J=="string"?J:typeof J=="object"&&J.component?J.component:$}function m9($,Z){if(!Z)return{};let J=N6(Z,$,void 0);return typeof J=="object"&&J.props?J.props:{}}var fZ=new Set(["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"]),N$=/<(\/?)(title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)(\s|>|\/)/gi;function b$($){return fZ.has($.toLowerCase())}function HJ($){return N$.lastIndex=0,N$.test($)}function F$($){return N$.lastIndex=0,$.replace(N$,function(Z,J,Q,X){return"&lt;"+J+Q+X})}var _J=/^<([a-zA-Z][a-zA-Z0-9-]*)\s[^>]*>/,vJ=/^<[A-Z]/,r$=["script","pre","style","textarea"],H$=new Set(r$),gZ=/<(?:pre|script|style|textarea)\b/i,R6=/<(?:pre|script|style|textarea)\b/iy,w6=/^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m,y6=/^<([a-z][^ >/\n\r]*) ?([^>]*?)>/im,C6=new Uint8Array(128);(function(){for(var $=[$0,j0,O0,b0,p0,D0,T0,n,y0,P$,l9,v9,N9],Z=0;Z<$.length;Z++)C6[$[Z]]=1})();var k6=/([a-zA-Z_][a-zA-Z0-9_-]*)=(?:"([^"]*)"|'([^']*)')/g;function m6($){return H$.has($)}function IJ($){return gZ.test($)}function u6($,Z,J){for(var Q=Z,X=J;Q<X&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;if(Q>=X)return!1;$.charCodeAt(Q)===k0&&Q++;for(var Y=0;Q<X;){for(;Q<X&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;if(Q>=X)break;if($.charCodeAt(Q)===k0&&Y>0){for(var V=Q+1;V<X&&($.charCodeAt(V)===I||$.charCodeAt(V)===w);)V++;if(V>=X)return!0}if($.charCodeAt(Q)===f0&&Q++,Q>=X||$.charCodeAt(Q)!==d)return!1;for(;Q<X&&$.charCodeAt(Q)===d;)Q++;for(Q<X&&$.charCodeAt(Q)===f0&&Q++,Y++;Q<X&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;if(Q<X)if($.charCodeAt(Q)===k0)Q++;else return!1}return Y>0}function k9($,Z){if($.charCodeAt(Z)!==n)return null;let J=Z+1,Q=$.length,X=!1;$.charCodeAt(J)===M0&&(J++,X=!0);let Y=J,V=$.charCodeAt(J);if(!(V>=J0&&V<=Y0||V>=u&&V<=l))return null;for(;J<Q&&($.charCodeAt(J)>=J0&&$.charCodeAt(J)<=Y0||$.charCodeAt(J)>=u&&$.charCodeAt(J)<=l||$.charCodeAt(J)>=r&&$.charCodeAt(J)<=i||$.charCodeAt(J)===d);)J++;let G=$.slice(Y,J);if(!G)return null;let U=J;for(;J<Q&&($.charCodeAt(J)===I||$.charCodeAt(J)===w||$.charCodeAt(J)===T);)J++;let q=$.slice(U,J);if(J===U&&J<Q){var W=$.charCodeAt(J);if(W!==c&&W!==M0)return null}let F=J,H={},K=!1;for(;J<Q;){let k=$.charCodeAt(J);if(k===c){let E=$.slice(F,J);return{tag:G,attrs:H,selfClosing:!1,end:J+1,rawAttrs:E,whitespaceBeforeAttrs:q,isClosing:X,hasSpaceBeforeSlash:K}}if(k===I||k===w||k===T){J++;continue}if(k===M0&&J+1<Q&&$.charCodeAt(J+1)===c){let E=$.slice(F,J);return K=J>F&&$.charCodeAt(J-1)===I,{tag:G,attrs:H,selfClosing:!0,end:J+2,rawAttrs:E,whitespaceBeforeAttrs:q,isClosing:X,hasSpaceBeforeSlash:K}}var M=J,O=$.charCodeAt(J);if(!(O>=J0&&O<=Y0||O>=u&&O<=l||O===O0||O===f0))return null;for(J++;J<Q;){var z=$.charCodeAt(J);if(z>=J0&&z<=Y0||z>=u&&z<=l||z>=r&&z<=i||z===O0||z===Z9||z===f0||z===d)J++;else break}for(var B=$.slice(M,J);J<Q&&($.charCodeAt(J)===I||$.charCodeAt(J)===w);)J++;if($.charCodeAt(J)!==p0){H[B]="";continue}for(J++;J<Q&&($.charCodeAt(J)===I||$.charCodeAt(J)===w);)J++;var D=$.charCodeAt(J);if(D===V9||D===g9){J++;for(var v=J;J<Q&&$.charCodeAt(J)!==D;)J++;if(J>=Q)return null;if(H[B]=$.slice(v,J),J++,J<Q){var g=$.charCodeAt(J);if(g!==I&&g!==w&&g!==T&&g!==c&&g!==M0)return null}}else if(D===h9){var P=1,v=J;for(J++;J<Q&&P>0;){var z=$.charCodeAt(J);z===h9?P++:z===I$&&P--,J++}H[B]=$.slice(v,J)}else{for(var v=J;J<Q;){var j=$.charCodeAt(J);if(j===I||j===w||j===c||j===T||j===V9||j===g9||j===p0||j===n||j===$0)break;J++}if(J===v)return null;H[B]=$.slice(v,J)}}return null}function p6($,Z,J){if(!J.streaming&&!J.optimizeForStreaming&&$.indexOf("[")===-1)return!1;for(var Q=0,X=$.length,Y=!1,V=!1;Q<X;){for(var G=$.indexOf(`
`,Q),U=G<0?X:G,q=Q,W=0;q<U&&W<4;)if($.charCodeAt(q)===I)W++,q++;else if($.charCodeAt(q)===w)W+=4,q++;else break;if(q>=U){Y=!1,Q=G<0?X:G+1;continue}if(W<4){var F=$.charCodeAt(q);if(F===$0||F===b0){for(var H=F,K=0,M=q;M<U&&$.charCodeAt(M)===H;)K++,M++;if(K>=3){var O=!0;if(H===$0){for(var z=M;z<U;z++)if($.charCodeAt(z)===$0){O=!1;break}}if(O){Y=!1;for(var B=G<0?X:G+1;B<X;){for(var D=B,v=0;D<X&&v<4;){var g=$.charCodeAt(D);if(g===I)v++,D++;else if(g===w)v+=4,D++;else break}if(v<4&&D<X&&$.charCodeAt(D)===H){for(var P=0;D<X&&$.charCodeAt(D)===H;)P++,D++;if(P>=K){for(;D<X&&($.charCodeAt(D)===I||$.charCodeAt(D)===w);)D++;if(D>=X||$.charCodeAt(D)===T){Q=D>=X?X:D+1;break}}}for(;B<X&&$.charCodeAt(B)!==T;)B++;B<X&&B++}B>=X&&(Q=X,V=!0);continue}}}}for(var j=q;j<U&&$.charCodeAt(j)===c;){j++,j<U&&$.charCodeAt(j)===I&&j++;for(var k=0;j<U&&k<4;)if($.charCodeAt(j)===I)k++,j++;else if($.charCodeAt(j)===w)k+=4,j++;else break;if(k>=4)break;Y=!1}if(!Y&&W<4&&j<U&&$.charCodeAt(j)===D0&&!(j+1<X&&$.charCodeAt(j+1)===O9)){var E=d6($,j,Z);if(E){Q=E,Y=!1;continue}}var b=$.charCodeAt(q);if(b===_9&&W<4)Y=!1;else if(W<4&&(b===d||b===j0||b===O0)){for(var N=q,R=0;N<U;){var L=$.charCodeAt(N);if(L===b)R++;else if(L!==I&&L!==w)break;N++}Y=!(R>=3&&N>=U)}else Y=!0;Q=G<0?X:G+1}return V}function d6($,Z,J){let Q=$.length;if($.charCodeAt(Z)!==D0)return null;let X=Z+1<Q&&$.charCodeAt(Z+1)===O9,Y=Z+1;for(;Y<Q;){var V=$.charCodeAt(Y);if(V===$9){Y++;break}if(V===D0)return null;V===y0&&Y+1<Q&&Y++,Y++}if(Y>Q||$.charCodeAt(Y-1)!==$9)return null;let G=$.slice(Z+1,Y-1);if(G.length>999)return null;let U=R$(G);if(!U||Y>=Q||$.charCodeAt(Y)!==f0)return null;Y++;let q=!1;for(;Y<Q;){let S=$.charCodeAt(Y);if(S===I||S===w)Y++;else if(S===T&&!q)q=!0,Y++;else break}if(X){let S=$.indexOf(`
`,Y),x=S<0?Q:S,h=$.slice(Y,x).trim();return J[U]={target:h,title:void 0},S<0?Q:S+1}var W;if(Y<Q&&$.charCodeAt(Y)===n){Y++;for(var F=Y;Y<Q&&$.charCodeAt(Y)!==c&&$.charCodeAt(Y)!==T;)$.charCodeAt(Y)===y0&&Y+1<Q&&Y++,Y++;if(Y>=Q||$.charCodeAt(Y)!==c)return null;W=$.slice(F,Y),Y++;for(var H=$.indexOf(`
`,Y),K=H<0?Q:H,M=Y;M<K&&($.charCodeAt(M)===I||$.charCodeAt(M)===w);)M++;if(M<K){if(M===Y)return null;var O=$.charCodeAt(M);if(O!==V9&&O!==g9&&O!==H9)return null}}else{for(var F=Y,z=0;Y<Q;){var V=$.charCodeAt(Y);if(V===H9)z++;else if(V===D9){if(z===0)break;z--}else{if(V===I||V===w||V===T)break;V===y0&&Y+1<Q&&Y++}Y++}if(W=$.slice(F,Y),!W)return null}for(;Y<Q&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===w);)Y++;var B=$.indexOf(`
`,Y),D=B<0?Q:B,v,g=!1,P=Y,j=Y;if(Y===D&&Y<Q)for(j=Y+1;j<Q&&($.charCodeAt(j)===I||$.charCodeAt(j)===w);)j++;if(j<Q){var k=$.charCodeAt(j);if(k===V9||k===g9||k===H9){for(var E=k===H9?41:k,b=j+1,N=b;b<Q;){var R=$.charCodeAt(b);if(R===E){for(var L=b+1;L<Q&&($.charCodeAt(L)===I||$.charCodeAt(L)===w);)L++;(L>=Q||$.charCodeAt(L)===T)&&(v=$.slice(N,b),g=!0,P=L<Q?L+1:Q);break}if(R===y0&&b+1<Q){b+=2;continue}if(R===T&&b+1<Q&&$.charCodeAt(b+1)===T)break;b++}if(!g&&j===Y)return null}}if(g)return J[U]||(J[U]={target:Y$(W),title:v!==void 0?x9(Y$(v)):v}),P;for(;Y<D&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===w);)Y++;return Y<D?null:(J[U]||(J[U]={target:Y$(W),title:v}),B<0?Q:B+1)}var o0=new Uint8Array(_6);for(o0[P$]=R9,o0[_9]|=B9,o0[c]|=B9,o0[d]|=B9|w9,o0[b9]|=B9,o0[j0]|=B9|w9,o0[O0]|=B9|w9,o0[$0]|=B9|w9,o0[b0]|=B9|w9,o0[n]|=B9|w9,o0[D0]|=w9,o0[T0]|=w9,o0[k0]|=B9,z$=r;z$<=i;z$++)o0[z$]|=B9;var z$;function L6($){if($.indexOf("[")<0&&$.indexOf("]")<0)return!1;for(var Z=0;Z<$.length;Z++){if($.charCodeAt(Z)===y0){Z++;continue}if($.charCodeAt(Z)===D0||$.charCodeAt(Z)===$9)return!0}return!1}function R$($){var Z=$.replace(/\s+/g," ").trim();return Z.indexOf("\u1E9E")!==-1?Z.replace(/\u1E9E/g,"ss").toLowerCase():Z.toLowerCase()}function n$($){return $<J$?o0[$]:$===W6?R9:0}function Y$($){return $.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,"$1")}var c6=null,l6=-1,o6=-1;function q0($,Z){if(Z===l6&&$===c6)return o6;var J=$.indexOf(`
`,Z);return J<0?$.length:J}function s($,Z){let J=q0($,Z);return J<$.length?J+1:J}function O$($,Z,J){for(;Z<J;){let Q=$.charCodeAt(Z);if(Q!==I&&Q!==w)break;Z++}return Z}function E6($,Z){let J=s($,Z);for(;J<$.length;){let Q=q0($,J);if(Q9($,J,Q))return J;J=s($,J)}return $.length}function E9($,Z,J,Q){let X=0;for(;Z+X<J&&$.charCodeAt(Z+X)===Q;)X++;return X}var V0=0,X0=0;function R0($,Z,J){for(V0=0,X0=0;Z+X0<J;){let Q=$.charCodeAt(Z+X0);if(Q===w)V0+=4-V0%4;else if(Q===I)V0++;else break;X0++}}function Q9($,Z,J){return O$($,Z,J)>=J}function r6($,Z,J,Q){let X=q0($,Z);if(R0($,Z,X),V0>3)return null;let Y=Z+X0;if($.charCodeAt(Y)!==_9)return null;let V=E9($,Y,X,35);if(V<1||V>6||(Y+=V,Y<X&&$.charCodeAt(Y)!==I&&$.charCodeAt(Y)!==w))return null;Y=O$($,Y,X);for(var G=X;G>Y&&$.charCodeAt(G-1)===I;)G--;for(var U=G;G>Y&&$.charCodeAt(G-1)===_9;)G--;if(G<U)if(G===Y||$.charCodeAt(G-1)===I)for(;G>Y&&$.charCodeAt(G-1)===I;)G--;else G=U;let q=$.slice(Y,G),W=l0(q,0,q.length,J,Q),H=(Q?.slugify||J9)(q);return{node:{type:_.heading,level:V,children:W,id:H},end:s($,X)}}function hZ($,Z,J){var Q=$.charCodeAt(Z);if(Q!==p0&&Q!==d)return!1;for(var X=Z;X<J&&$.charCodeAt(X)===Q;)X++;for(;X<J&&($.charCodeAt(X)===I||$.charCodeAt(X)===w);)X++;return X>=J}function d9($,Z){let J=q0($,Z);if(R0($,Z,J),V0>3)return null;let Q=Z+X0,X=$.charCodeAt(Q);if(X!==d&&X!==j0&&X!==O0)return null;let Y=0;for(;Q<J;){let V=$.charCodeAt(Q);if(V===X)Y++;else if(V!==I&&V!==w)return null;Q++}return Y<3?null:{node:{type:_.breakThematic},end:s($,J)}}function xZ($,Z,J){let Q=q0($,Z);if(R0($,Z,Q),V0>3)return null;let X=V0,Y=X0,V=Z+X0,G=$.charCodeAt(V);if(G!==$0&&G!==b0)return null;let U=E9($,V,Q,G);if(U<3)return null;V+=U;let q=O$($,V,Q),W=Q;if(G===$0){for(let b=q;b<Q;b++)if($.charCodeAt(b)===$0)return null}for(;W>q&&($.charCodeAt(W-1)===I||$.charCodeAt(W-1)===w);)W--;let F=$.slice(q,W),H="",K="",M=F.indexOf(" ");M===-1?H=F:(H=F.slice(0,M),K=F.slice(M+1).trim()),H=Y$(H);var O=void 0;if(K){k6.lastIndex=0;for(var z;(z=k6.exec(K))!==null;)O||(O={}),O[z[1]]=z[2]!==void 0?z[2]:z[3]}let B=s($,Q),D=B,v=$.length;for(;D<$.length;){let b=q0($,D);if(R0($,D,b),V0<4){let N=D+X0;var g=E9($,N,b,G);if(g>=U){let R=N+g;if(Q9($,R,b)){v=s($,b);break}}}D=s($,b)}var P;if(X===0)P=D>B&&$.charCodeAt(D-1)===T?$.slice(B,D-1):$.slice(B,D);else{P="";for(var j=B;j<D;){var k=q0($,j);R0($,j,k);var E=Math.min(X0,X);P+=$.slice(j+E,k)+`
`,j=s($,k)}P.length>0&&P.charCodeAt(P.length-1)===T&&(P=P.slice(0,-1))}return{node:{type:_.codeBlock,lang:H||void 0,text:P,infoString:K||void 0,attrs:O},end:v}}function CZ($,Z){let J=q0($,Z);if(R0($,Z,J),V0<4)return null;let Q="",X=Z;for(;X<$.length;){let K=q0($,X);if(R0($,X,K),Q9($,X,K)){for(var Y=0,V=s($,K);V<$.length;){var G=q0($,V);if(Q9($,V,G)){Y++,V=s($,G);continue}if(R0($,V,G),V0>=4){for(var U=0;U<=Y;U++)Q+=`
`;X=V;break}break}if(X!==V)break;continue}if(V0<4)break;let M=0,O=0;var q=0;for(let z=X;z<K&&O<4;z++){if($.charCodeAt(z)===w){var W=4-O%4;O+W>4&&(q=O+W-4),O+=W}else O++;M++}var F="";if(q>0)for(var H=0;H<q;H++)F+=" ";F+=$.slice(X+M,K),Q+=F+`
`,X=s($,K)}for(;Q.length>0&&Q.charCodeAt(Q.length-1)===T;)Q=Q.slice(0,-1);for(;Q.length>0&&Q.charCodeAt(Q.length-1)===T;)Q=Q.slice(0,-1);return Q?{node:{type:_.codeBlock,lang:void 0,text:Q,infoString:void 0,attrs:void 0},end:X}:null}function mZ($,Z,J,Q){let X=q0($,Z);if(R0($,Z,X),V0>3)return null;let Y=Z+X0;if($.charCodeAt(Y)!==c)return null;let V="",G=Z,U,q=!1,W=!1,F=!1;for(;G<$.length;){let y=q0($,G);R0($,G,y);let G0=G+X0;if($.charCodeAt(G0)===c){let p=G0+1;var H=V0+1,K=!1;if(p<y){var M=$.charCodeAt(p);M===I?(p++,H++,K=!0):M===w&&(K=!0)}for(var O="",z=!1,B=p;B<y;B++)if($.charCodeAt(B)===w){z=!0;break}if(z){var D=H;if(K&&p<y&&$.charCodeAt(p)===w){for(var v=4-D%4,g=0;g<v-1;g++)O+=" ";D+=v,p++}for(var P=p;P<y;P++)if($.charCodeAt(P)===w){for(var j=4-D%4,k=0;k<j;k++)O+=" ";D+=j}else O+=$[P],D++}else O=$.slice(p,y);if(!V&&!U){let m=O.match(/^\[!([A-Za-z]+)\]\s*$/);if(m){U=m[1].toUpperCase(),G=s($,y);continue}}V+=O+`
`;var E=O.trimStart();E.startsWith("```")||E.startsWith("~~~")?F=!F:O.startsWith("    ")||O.startsWith("	")?F=!0:E.length>0&&!F&&(F=!1),W=E.length>0,G=s($,y)}else if(V&&!Q9($,G,y)&&W){if(V0<4){var b=G+X0,N=b<y?$.charCodeAt(b):0;if(N===_9||N===c||N===$0||N===b0||N===n||(N===d||N===j0||N===O0)&&d9($,G)||(N===d||N===j0||N===b9)&&b+1<y&&($.charCodeAt(b+1)===I||$.charCodeAt(b+1)===w))break;if(N>=r&&N<=i){for(var R=b;R<y&&$.charCodeAt(R)>=r&&$.charCodeAt(R)<=i;)R++;if(R<y&&($.charCodeAt(R)===Z9||$.charCodeAt(R)===D9))break}}if(F)break;V+=$.slice(G,y)+`
`,q=!0,G=s($,y)}else break}if(!V&&!U)return null;var{inBlockQuote:L,h:S}=J;J.inBlockQuote=!0,q&&(J.h=!0);let x=L9(V||"",J,Q);return J.inBlockQuote=L,J.h=S,{node:{type:_.blockQuote,children:x,alert:U||void 0},end:G}}function i6($,Z,J){for(var Q=0,X=Z;X<J;X++)$.charCodeAt(X)===w?Q+=4-Q%4:Q++;return Q}function u9($,Z,J){if(R0($,Z,J),V0>3)return null;var Q=Z+X0;if(Q>=J)return null;var X=$.charCodeAt(Q),Y=V0,V=Q;if(X===d||X===j0||X===b9){if(V=Q+1,V<J&&$.charCodeAt(V)!==I&&$.charCodeAt(V)!==w&&$.charCodeAt(V)!==T)return null}else if(X>=r&&X<=i){for(var G=Q;G<J&&G-Q<9;){var U=$.charCodeAt(G);if(U<r||U>i)break;G++}if(G>Q&&G<J){var q=$.charCodeAt(G);if(q===Z9||q===D9){if(V=G+1,V<J&&$.charCodeAt(V)!==I&&$.charCodeAt(V)!==w&&$.charCodeAt(V)!==T)return null}else return null}else return null}else return null;var W=V,F=i6($,Z,V),H=0,K=W,M=F;if(W>=J)return{ordered:X>=r&&X<=i,marker:X>=r&&X<=i?$[G]:$[Q],start:X>=r&&X<=i?parseInt($.slice(Q,G),10):void 0,contentStart:W,contentCol:F+1,markerCol:Y,isEmpty:!0};for(;K<J&&($.charCodeAt(K)===I||$.charCodeAt(K)===w);){if($.charCodeAt(K)===w){var O=4-M%4;M+=O}else M++;K++,H++}var z=K>=J,B=M-F;return z||B>4?(M=F+1,K=W+1,H=1):H===0&&(M=F+1,K=W,H=1),{ordered:X>=r&&X<=i,marker:X>=r&&X<=i?$[G]:$[Q],start:X>=r&&X<=i?parseInt($.slice(Q,G),10):void 0,contentStart:K,contentCol:M,markerCol:Y,isEmpty:z}}var w$=0;function uZ($,Z,J,Q){var X=0,Y=Z;for(w$=0;Y<J&&X<Q;){var V=$.charCodeAt(Y);if(V===w){var G=4-X%4;if(X+G>Q){w$=X+G-Q,Y++,X=Q;break}X+=G}else if(V===I)X++;else break;Y++}return Y}function S6($,Z,J,Q){var X=q0($,Z),Y=u9($,Z,X);if(!Y)return null;var V=[],G=Z,U=Y.contentCol,q="",W=Y.isEmpty,F=!1,H=!1;if(!Y.isEmpty){for(var K=!1,M=Y.contentStart;M<X;M++)if($.charCodeAt(M)===w){K=!0;break}if(K){var O="",z=i6($,Z,Y.contentStart),B=z-Y.contentCol;if(B>0)for(var D=0;D<B;D++)O+=" ";for(var v=Y.contentStart;v<X;v++)if($.charCodeAt(v)===w){for(var g=4-z%4,P=0;P<g;P++)O+=" ";z+=g}else O+=$[v],z++;q=O+`
`}else q=$.slice(Y.contentStart,X)+`
`}for(G=s($,X);G<$.length;){var j=q0($,G);R0($,G,j);var k=$.charCodeAt(G+X0);if(V0<U&&(k===d||k===j0||k===O0)&&V0<=3&&d9($,G))break;var E=u9($,G,j);if(E&&E.ordered===Y.ordered&&E.marker===Y.marker&&E.markerCol<U){V.push({contentCol:U,raw:q,hasBlankAfter:F,isEmpty:W}),F&&(H=!0),U=E.contentCol,W=E.isEmpty,F=!1,q=E.isEmpty?"":$.slice(E.contentStart,j)+`
`,G=s($,j);continue}if(Q9($,G,j)){q+=`
`,G=s($,j);for(var b=!1,N=0;N<q.length;N++){var R=q.charCodeAt(N);if(R!==T&&R!==P9&&R!==I&&R!==w){b=!0;break}}if(W&&!b)if(G<$.length){var L=q0($,G),S=u9($,G,L);if(!S||S.ordered!==Y.ordered||S.marker!==Y.marker)break;F=!0}else break;if(G<$.length){var x=q0($,G);R0($,G,x);var h=$.charCodeAt(G+X0);if((h===d||h===j0||h===O0)&&V0<=3&&d9($,G))break;var y=u9($,G,x);if(y&&y.ordered===Y.ordered&&y.marker===Y.marker&&y.markerCol<U){F=!0;continue}if(!Q9($,G,x)&&V0<U)break}continue}if(V0>=U){var G0=uZ($,G,j,U);if(w$>0){for(var p="",m=U,a=0;a<w$;a++)p+=" ",m++;for(var A0=G0;A0<j;A0++)if($.charCodeAt(A0)===w){for(var H0=4-m%4,g0=0;g0<H0;g0++)p+=" ";m+=H0}else p+=$[A0],m++;q+=p+`
`}else q+=$.slice(G0,j)+`
`;G=s($,j);continue}for(var K0=!1,C=0;C<q.length;C++){var W0=q.charCodeAt(C);if(W0!==T&&W0!==P9&&W0!==I&&W0!==w){K0=!0;break}}if(!F&&K0&&!W){var e=G+X0,Z0=$.charCodeAt(e),U9=Z0===_9||Z0===c||Z0===n||Z0===$0||Z0===b0||(Z0===d||Z0===j0||Z0===O0||Z0===b9)&&(d9($,G)!==null||u9($,G,j)!==null)||Z0>=r&&Z0<=i&&u9($,G,j)!==null;if(!U9){q+=""+$.slice(e,j)+`
`,G=s($,j);continue}}break}if(V.push({contentCol:U,raw:q,hasBlankAfter:F,isEmpty:W}),V.length===0)return null;var U0=H;if(!U0)for(var B0=0;B0<V.length;B0++){if(V[B0].hasBlankAfter&&B0<V.length-1){U0=!0;break}if(!V[B0].isEmpty){for(var v0=V[B0].raw,t=v0.length,z0=0,A=!1,o=!1,I0=!1,_0=!1,r0=0,P0=0,Q0=-1;z0<t;){var f=v0.indexOf(`
`,z0);if(f<0&&(f=t),_0){R0(v0,z0,f);for(var N0=v0.slice(z0+X0,f),F0=0;F0<N0.length&&N0.charCodeAt(F0)===r0;)F0++;F0>=P0&&N0.slice(F0).trim()===""&&(_0=!1),z0=f<t?f+1:t;continue}if(Q9(v0,z0,f)){Q0>=0?I0=!0:A&&(o=!0),z0=f<t?f+1:t;continue}if(R0(v0,z0,f),Q0>=0){if(V0>=Q0){z0=f<t?f+1:t;continue}var m0=u9(v0,z0,f);if(m0&&m0.markerCol<Q0&&m0.contentCol<=Q0){z0=f<t?f+1:t;continue}if(m0){z0=f<t?f+1:t;continue}Q0=-1,I0&&(o=!0,I0=!1)}var q9=v0.slice(z0+X0,f),h0=q9.charCodeAt(0);if((h0===$0||h0===b0)&&V0<=3){for(var K9=0;K9<q9.length&&q9.charCodeAt(K9)===h0;)K9++;if(K9>=3){if(o&&A){U0=!0;break}_0=!0,r0=h0,P0=K9,A=!0,z0=f<t?f+1:t;continue}}var i0=V0<=3?u9(v0,z0,f):null;if(i0&&A){if(o){U0=!0;break}Q0=i0.contentCol,I0=!1,z0=f<t?f+1:t,A=!0;continue}if(o){U0=!0;break}A=!0,z0=f<t?f+1:t}if(U0)break}}for(var W9=[],F9=0;F9<V.length;F9++){for(var S9=V[F9],M9=S9.raw,a0=M9.length;a0>0&&M9.charCodeAt(a0-1)===T;)a0--;var n0=a0<M9.length?M9.slice(0,a0):M9,u0=null;if(n0.length>=3&&n0.charCodeAt(0)===D0){var s0=n0[1];(s0===" "||s0==="x"||s0==="X")&&n0.charCodeAt(2)===$9&&(u0={type:_.gfmTask,completed:s0==="x"||s0==="X"},n0=n0.slice(3))}var w0;if(S9.isEmpty&&n0.trim()==="")w0=[];else if(U0){var t0=J.inList;J.inList=!0,w0=L9(n0,J,Q),J.inList=t0}else{var e0=J.inList;if(J.inList=!0,w0=L9(n0,J,Q),J.inList=e0,w0.length===1&&w0[0].type===_.paragraph)w0=w0[0].children;else{for(var E0=[],X9=0;X9<w0.length;X9++)if(w0[X9].type===_.paragraph)for(var A9=w0[X9].children,x0=0;x0<A9.length;x0++)E0.push(A9[x0]);else E0.push(w0[X9]);w0=E0}}u0?W9.push([u0,{type:_.text,text:" "},...w0]):W9.push(w0)}return{node:{type:Y.ordered?_.orderedList:_.unorderedList,start:Y.ordered?Y.start:void 0,items:W9},end:G}}var y$=new Set(["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"]);function y9($,Z,J){let Q={};for(let[V,G]of Object.entries($)){let U=V,q=V.toLowerCase();if(q==="style"&&typeof G=="string"){let W={},F=[],H=0,K=0;for(let O=0;O<G.length;O++){let z=G.charCodeAt(O);z===H9?H++:z===D9?H--:z===d$&&H===0&&(F.push(G.slice(K,O)),K=O+1)}K<G.length&&F.push(G.slice(K));let M=!1;F.forEach(O=>{let z=O.indexOf(":");if(z===-1)return;let B=O.slice(0,z).trim(),D=O.slice(z+1).trim();if(B&&D){if(/url\s*\(\s*(javascript|vbscript|data:(?!image\/))/i.test(D)){M=!0;return}let v=B.indexOf("-")!==-1?B.replace(/-([a-z])/g,(g,P)=>P.toUpperCase()):B;W[v]=D}}),!M&&Object.keys(W).length>0&&(Q[U]=W)}else if((q==="href"||q==="src")&&J?.sanitizer){let W=J.sanitizer(G,Z,q);W!==null&&(Q[U]=W)}else if(G==="")Q[U]=!0;else if(G.length>=2&&G.charCodeAt(0)===h9&&G.charCodeAt(G.length-1)===I$){var X=G.slice(1,-1);if(X.length>0){var Y=X.charCodeAt(0);if(Y===D0||Y===h9)try{Q[U]=JSON.parse(X);continue}catch{}}if(X==="true"){Q[U]=!0;continue}if(X==="false"){Q[U]=!1;continue}if(J?.evalUnserializableExpressions)try{Q[U]=(0,eval)("("+X+")");continue}catch{}Q[U]=X}else Q[U]=G}return Q}function p9($,Z,J){let Q=Z.length;if(Q===0)return J;var X=Z.charCodeAt(0),Y=X>=u&&X<=l||X>=J0&&X<=Y0;if(!Y){for(var V=String.fromCharCode(X),G=$.length-Q,U=J;U<=G;){var q=$.indexOf(V,U);if(q===-1||q>G)return-1;for(var W=!0,F=1;F<Q;F++){var H=$.charCodeAt(q+F),K=Z.charCodeAt(F);if(H>=u&&H<=l&&(H+=d0),K>=u&&K<=l&&(K+=d0),H!==K){W=!1;break}}if(W)return q;U=q+1}return-1}X>=u&&X<=l&&(X+=d0);for(let O=J;O<=$.length-Q;O++){var M=$.charCodeAt(O);if(M>=u&&M<=l&&(M+=d0),M!==X)continue;let z=!0;for(let B=1;B<Q;B++){let D=$.charCodeAt(O+B),v=Z.charCodeAt(B);if(D>=u&&D<=l&&(D+=d0),v>=u&&v<=l&&(v+=d0),D!==v){z=!1;break}}if(z)return O}return-1}function pZ($,Z,J){let Q=Z.length;var X=Z.charCodeAt(0);X>=u&&X<=l&&(X+=d0);for(let V=Math.min(J,$.length-Q);V>=0;V--){var Y=$.charCodeAt(V);if(Y>=u&&Y<=l&&(Y+=d0),Y!==X)continue;let G=!0;for(let U=1;U<Q;U++){let q=$.charCodeAt(V+U),W=Z.charCodeAt(U);if(q>=u&&q<=l&&(q+=d0),W>=u&&W<=l&&(W+=d0),q!==W){G=!1;break}}if(G)return V}return-1}var k$=-1;function i$($,Z,J){let Q=J.toLowerCase(),X="<"+Q,Y="</"+Q,V=1,G=Z,U=$.length;for(k$=-1;G<U&&V>0;){let F=p9($,X,G),H=p9($,Y,G);if(H===-1)return-1;if(F!==-1&&F<H){let K=k9($,F);K?(K.tag.toLowerCase()===Q&&!K.isClosing&&!K.selfClosing&&!a9(K.tag)&&V++,G=K.end):G=F+1}else{var q=H+Y.length,W=q<U?$.charCodeAt(q):62;if((W===c||W===I||W===w||W===T)&&(V--,V===0)){k$=H;let K=H+Y.length;for(;K<U&&$.charCodeAt(K)!==c;)K++;return K+1}G=H+1}}return-1}function a6($,Z,J,Q){if(Q.ignoreHTMLBlocks||Q.disableParsingRawHTML)return null;var X=q0($,Z);if(R0($,Z,X),V0>3&&!J.inHTML)return null;var Y=Z+X0;if($.charCodeAt(Y)!==n)return null;var V=$.indexOf(">",Y+1);if(V!==-1&&V<X){var G=$.slice(Y+1,V);if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(G)||/^[^\s@]+@[^\s@]+$/.test(G))return null}var U=dZ($,Y);if(U>=1&&U<=5){var q=$.length;if(U===1){for(var W=$.length,F=0;F<r$.length;F++){var H=p9($,"</"+r$[F]+">",Y);H>=0&&H<W&&(W=H)}if(W<$.length){var K=$.indexOf(">",W);q=K>=0?s($,K+1):$.length}}else{var M=U===2?"-->":U===3?"?>":U===4?">":"]]>",O=$.indexOf(M,Y);O>=0&&(q=s($,O+M.length))}var z=$.slice(Y,q);if(U>=2)return{node:{type:_.htmlComment,text:z,g:!1,raw:!0,endPos:q},end:q};var B="div",D=z.match(/^<\/?([a-zA-Z][a-zA-Z0-9-]*)/);D&&(B=D[1]);var v=k9($,Y),g={},P;v&&!v.isClosing&&(g=y9(v.attrs,B,Q),P=v.whitespaceBeforeAttrs+v.rawAttrs);var j=[],k=B.toLowerCase(),E="</"+k,b=p9(z,E,0),N=z,R="";if(v&&v.isClosing)for(N=z.slice(v.end-Y);N.length>0&&N.charCodeAt(N.length-1)===T;)N=N.slice(0,-1);else if(v&&!v.isClosing){var L=v.end-Y;if(b!==-1)for(N=z.slice(L),N.charCodeAt(0)===T&&(N=N.slice(1));N.length>0&&N.charCodeAt(N.length-1)===T;)N=N.slice(0,-1);else for(N=z;N.length>0&&N.charCodeAt(N.length-1)===T;)N=N.slice(0,-1);if(b!==-1){var S=z.slice(L,b);R=S.trim()}}var x=v?v.isClosing:!1;return{node:{type:_.htmlBlock,tag:B,attrs:g,d:P,children:j,a:N,text:R,e:!0,b:x,endPos:q,f:!0},end:q}}if(U===6||U===7){var h=E6($,Z),y=h<$.length?h:$.length,G0=$.slice(Y,y),p=h<$.length?s($,h):$.length,m=k9($,Y);if(m){var a=m.tag,A0=a.toLowerCase(),H0=m.isClosing;if(H0){var g0=$.slice(m.end,y);return{node:{type:_.htmlBlock,tag:a,attrs:{},children:[],a:g0,text:g0,e:!0,b:!0,endPos:y,f:U===6},end:p}}if(m.selfClosing||a9(a))return{node:{type:_.htmlBlock,tag:a,attrs:y9(m.attrs,a,Q),d:m.whitespaceBeforeAttrs+m.rawAttrs,children:[],a:"",text:"",e:!1,b:!1,endPos:m.end,f:U===6},end:m.end<$.length&&$.charCodeAt(m.end)===T?m.end+1:m.end};var K0=J.c||0,C=$.slice(Y,y),W0=-1,e=-1;if(K0<10){for(var Z0="</"+A0,U9=m.end-Y,U0=1,B0=U9;B0<C.length&&U0>0;){var v0=p9(C,"<"+A0,B0),t=p9(C,Z0,B0);if(t===-1)break;if(v0!==-1&&v0<t){var z0=v0+A0.length+1;if(z0<C.length){var A=C.charCodeAt(z0);(A===I||A===w||A===T||A===c||A===M0)&&U0++}B0=v0+1}else{var o=t+Z0.length;if(o<C.length){var I0=C.charCodeAt(o);if((I0===c||I0===I||I0===w||I0===T)&&(U0--,U0===0)){W0=t;for(var _0=o;_0<C.length&&C.charCodeAt(_0)!==c;)_0++;e=_0+1;break}}else if(U0--,U0===0){W0=t,e=C.length;break}B0=t+1}}var r0=!1;if(W0===-1&&U===6&&!m.isClosing){var P0=i$($,m.end,A0);if(P0!==-1){for(var Q0=k$,f=m.end,N0=!1,F0=!1,m0=!1,q9=0,h0=!1,K9=!1,i0=f;i0<Q0;){var W9=$.charCodeAt(i0);if(W9===T)K9&&(N0=!0),h0||q9++,K9=!0,i0++;else if(W9===I||W9===w)i0++;else{if(!h0&&(h0=!0,q9>=2&&W9===n)){m0=!0;break}if(K9=!1,W9===n){var F9=$.charCodeAt(i0+1)|32;if((F9===v$||F9===p$||F9===o9)&&(R6.lastIndex=i0,R6.test($))){F0=!0;break}}i0++}}if(N0&&!m0&&!F0){var S9=q0($,P0);y=S9,p=s($,S9),C=$.slice(Y,y),G0=$.slice(Y,y),W0=Q0-Y,e=P0-Y,r0=!0}}}}var M9=m.rawAttrs.indexOf(`
`)!==-1||m.whitespaceBeforeAttrs.indexOf(`
`)!==-1,a0=!1;if(W0!==-1){var n0=C.slice(e).trim();a0=n0.length===0}var u0=!1,s0=y,w0=p;if(W0!==-1){var t0=Y+e,e0=q0($,t0-1);if(t0<e0){for(var E0=t0;E0<e0&&($.charCodeAt(E0)===I||$.charCodeAt(E0)===w);)E0++;if(E0<e0&&$.charCodeAt(E0)===n){var X9=k9($,E0);X9&&!X9.isClosing&&(u0=!0,s0=t0,w0=t0,a0=!0)}}if(!u0){var A9=s($,e0);if(A9<y){for(var x0=A9;x0<y&&($.charCodeAt(x0)===I||$.charCodeAt(x0)===w);)x0++;if(x0<y&&$.charCodeAt(x0)===n){var G$=k9($,x0);G$&&(u0=!0,s0=e0,w0=A9,a0=!0)}}}if(!u0&&J.inHTML){u0=!0,s0=e0,w0=s($,e0);var $Z=$.slice(t0,e0).trim();a0=$Z.length===0}}var s9=[],z9="";if(W0!==-1){z9=C.slice(m.end-Y,W0);var T9=z9.trim();if(T9){var{inline:ZZ,inHTML:JZ,c:QZ}=J;J.inHTML=!0,J.c=K0+1;var XZ=A0==="p";if(XZ)J.inline=!0,s9=l0(T9,0,T9.length,J,Q);else{var Z6=z9.indexOf(`

`)!==-1,J6=w6.test(T9),T$=y6.test(T9),YZ=Z6||J6||J.inHTML&&T$,VZ=z9.length>=2&&z9.charCodeAt(0)===T&&z9.charCodeAt(z9.length-1)===T&&!Z6;VZ&&!J6&&!T$?s9=[{type:_.text,text:T9}]:YZ||T$?(J.inline=!1,s9=L9(z9,J,Q)):(J.inline=!0,s9=l0(T9,0,T9.length,J,Q))}J.inline=ZZ,J.inHTML=JZ,J.c=QZ}}var Q6=!1;if(U===6&&W0!==-1&&!J.inHTML&&!M9){var f$=z9,GZ=/<[a-zA-Z][^>]*>/.test(f$),UZ=/\n\n/.test(f$)||/^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(f$);GZ&&!UZ&&(Q6=!0)}var qZ=!r0&&(J.inHTML||U===7||M9||!a0||Q6);if(qZ){var Y9,X6=!1;if(W0!==-1&&u0){var Y6=!1;if(J.inHTML&&e<C.length){for(var j$=e;j$<C.length&&C.charCodeAt(j$)!==T;)j$++;var g$=C.slice(e,j$).trim();Y6=g$.length>1&&g$.charCodeAt(0)===n&&g$.charCodeAt(1)!==M0}Y9=Y6?C.slice(m.end-Y):z9,X6=!0}else(U===7||J.inHTML)&&W0!==-1?(Y9=C.slice(m.end-Y),Y9.charCodeAt(0)===T&&(Y9=Y9.slice(1))):u0?Y9=$.slice(Y,s0):M9?Y9=G0:(Y9=C.slice(m.end-Y),Y9.charCodeAt(0)===T&&(Y9=Y9.slice(1)));var V6={type:_.htmlBlock,tag:a,attrs:y9(m.attrs,a,Q),d:m.whitespaceBeforeAttrs+m.rawAttrs,children:s9,a:Y9,text:Y9,e:!0,b:!1,endPos:s0,f:U===6};return X6&&(V6.k=!0),{node:V6,end:w0}}return{node:{type:_.htmlBlock,tag:a,attrs:y9(m.attrs,a,Q),d:m.whitespaceBeforeAttrs+m.rawAttrs,children:s9,a:r0?"":z9,text:z9,e:!1,b:!1,endPos:s0,f:U===6},end:w0}}var M$=G0.match(/^<(\/?)([a-zA-Z][a-zA-Z0-9-]*)/),KZ=M$?M$[2]:"div",G6=M$?M$[1]==="/":!1,h$=G0;if(G6){var U6=G0.indexOf(">");U6!==-1&&(h$=G0.slice(U6+1))}return{node:{type:_.htmlBlock,tag:KZ,attrs:{},children:[],a:h$,text:h$,e:!0,b:G6,endPos:y,f:U===6},end:p}}var S0=k9($,Y);if(!S0)return null;var f9=S0.tag,x$=f9.toLowerCase(),q6=f9.charCodeAt(0),A$=q6>=u&&q6<=l;if(!A$&&!y$.has(x$)&&!H$.has(x$)&&!x$.includes("-"))return null;if(S0.isClosing)return{node:{type:_.htmlSelfClosing,tag:f9,attrs:{},a:$.slice(Y,S0.end),b:!0,endPos:S0.end},end:S0.end};var GJ=!0,c9=i$($,S0.end,f9),U$=[];if(c9!==-1){var WZ=k$,_$=$.slice(S0.end,WZ),q$=_$.trim();if(q$){var FZ=_$.indexOf(`

`)!==-1,zZ=w6.test(q$),OZ=y6.test(q$),HZ=J.inline,DZ=J.inHTML,BZ=J.c;J.inHTML=!0,J.c=(J.c||0)+1,FZ||zZ||OZ?(J.inline=!1,U$=L9(_$,J,Q)):(J.inline=!0,U$=l0(q$,0,q$.length,J,Q)),J.inline=HZ,J.inHTML=DZ,J.c=BZ}var jZ=q0($,c9),MZ=$.slice(c9,jZ).trim(),C$=MZ?c9:s($,c9),K6=A$?$.slice(Y,c9):$.slice(Y,C$),AZ=A$?c9:C$;return{node:{type:_.htmlBlock,tag:f9,attrs:y9(S0.attrs,f9,Q),d:S0.whitespaceBeforeAttrs+S0.rawAttrs,children:U$,a:K6,text:A$?_$:K6,e:!0,b:!1,endPos:AZ,f:!1},end:C$}}var t9=E6($,S0.end),_Z=t9<$.length?s($,t9):t9,m$=$.slice(S0.end,t9);if(m$.trim()){var{inline:vZ,inHTML:IZ,c:PZ}=J;J.inline=!1,J.inHTML=!0,J.c=(J.c||0)+1,U$=L9(m$,J,Q),J.inline=vZ,J.inHTML=IZ,J.c=PZ}var NZ=$.slice(S0.end,t9);return{node:{type:_.htmlBlock,tag:f9,attrs:y9(S0.attrs,f9,Q),d:S0.whitespaceBeforeAttrs+S0.rawAttrs,children:U$,a:NZ,text:m$,e:!0,b:!1,endPos:t9,f:!1},end:_Z}}function dZ($,Z){if($.charCodeAt(Z)!==n)return 0;var J=Z+1,Q=$.length;if($.charCodeAt(J)===T0&&$.charCodeAt(J+1)===d&&$.charCodeAt(J+2)===d)return 2;if($.charCodeAt(J)===$$)return 3;if($.charCodeAt(J)===T0){var X=$.charCodeAt(J+1);if(X>=u&&X<=l)return 4;if($.slice(J+1,J+8)==="[CDATA[")return 5}for(var Y=$.charCodeAt(J)===M0,V=Y?J+1:J,G=V;G<Q;){var U=$.charCodeAt(G);if(U>=u&&U<=l||U>=J0&&U<=Y0||U>=r&&U<=i||U===d)G++;else break}if(G===V)return 0;var q=$.slice(V,G);if(H$.has(q.toLowerCase())){if(Y)return 0;var W=$.charCodeAt(G);return W===I||W===w||W===c||W===T||G>=Q?1:0}if(y$.has(q.toLowerCase())){if(Y){for(var F=G;F<Q&&($.charCodeAt(F)===I||$.charCodeAt(F)===w);)F++;return F<Q&&$.charCodeAt(F)===c?6:0}var H=G<Q?$.charCodeAt(G):-1;return H===I||H===w||H===c||H===T||H===M0||H===-1?6:0}if(Y){for(var z=G;z<Q&&($.charCodeAt(z)===I||$.charCodeAt(z)===w);)z++;if(z<Q&&$.charCodeAt(z)===c){var B=q0($,Z),D=$.slice(z+1,B).trim();if(D==="")return 7}}else{var K=q0($,Z),M=k9($,Z);if(M&&M.end<=K){var O=$.slice(M.end,K).trim();if(O==="")return 7}}return 0}function T6($,Z,J){for(var Q=0,X=$.length;Q<X&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===w);)Q++;for(;X>Q&&($.charCodeAt(X-1)===I||$.charCodeAt(X-1)===w);)X--;Q<X&&$.charCodeAt(Q)===k0&&Q++,X>Q&&$.charCodeAt(X-1)===k0&&(X-2<Q||$.charCodeAt(X-2)!==y0)&&X--;for(var Y=[],V=Q,G=!1,U=[],q=Q;q<X;){var W=$.charCodeAt(q);if(W===y0&&q+1<X){$.charCodeAt(q+1)===k0?(G||(G=!0,U=[]),U.push($.slice(V,q)),U.push("|"),q+=2,V=q):q+=2;continue}if(W===$0){for(var F=0;q<X&&$.charCodeAt(q)===$0;)F++,q++;for(var H=!1;q<X&&!H;){for(var K=0;q<X&&$.charCodeAt(q)===$0;)K++,q++;K===F?H=!0:K===0&&q++}continue}if(W===k0){var M=G?(U.push($.slice(V,q)),U.join("")):$.slice(V,q);Y.push(M.trim()),q++,V=q,G=!1,U=[];continue}q++}var O=G?(U.push($.slice(V,X)),U.join("")):$.slice(V,X);return Y.push(O.trim()),Y.map(function(z){var B=z.indexOf("\\|")!==-1?z.replace(/\\\|/g,"|"):z;return l0(B,0,B.length,Z,J)})}function f6($,Z,J,Q){let X=q0($,Z);var Y=$.indexOf("|",Z);if(Y<0||Y>=X)return null;let V=s($,X);if(V>=$.length)return null;let G=q0($,V);if(!u6($,V,G))return null;let U=$.slice(Z,X),q=$.slice(V,G);for(var W=[],F=0,H=q.length;F<H&&(q.charCodeAt(F)===I||q.charCodeAt(F)===w);)F++;for(F<H&&q.charCodeAt(F)===k0&&F++;F<H;){for(;F<H&&(q.charCodeAt(F)===I||q.charCodeAt(F)===w);)F++;if(F>=H||q.charCodeAt(F)===k0)break;var K=q.charCodeAt(F)===f0;for(K&&F++;F<H&&q.charCodeAt(F)===d;)F++;var M=F<H&&q.charCodeAt(F)===f0;for(M&&F++,W.push(K&&M?"center":M?"right":K?"left":null);F<H&&(q.charCodeAt(F)===I||q.charCodeAt(F)===w);)F++;F<H&&q.charCodeAt(F)===k0&&F++}let O=T6(U,J,Q);if(W.length!==O.length)return null;let z=[],B=s($,G);for(;B<$.length;){let k=q0($,B),E=$.slice(B,k);if(Q9($,B,k))break;if(R0($,B,k),V0<4){var D=$.charCodeAt(B+X0);if(D===c||D===_9||(D===d||D===j0||D===O0)&&d9($,B))break;if(D===$0||D===b0){for(var v=B+X0,g=0;v<k&&$.charCodeAt(v)===D;)g++,v++;if(g>=3)break}}z.push(T6(E,J,Q)),B=s($,k)}if((Q.streaming||Q.optimizeForStreaming)&&z.length===0)return null;for(var P=O.length,j=0;j<z.length;j++)if(z[j].length<P)for(;z[j].length<P;)z[j].push([]);else z[j].length>P&&(z[j].length=P);return{node:{type:_.table,header:O,cells:z,align:W},end:B}}function cZ($,Z,J){var Q=q0($,Z);if(R0($,Z,Q),V0>3)return null;var X=Z+X0;if($.charCodeAt(X)!==D0)return null;if(X+1<$.length&&$.charCodeAt(X+1)===O9){var Y=lZ($,X,J);return Y||null}J.refs||(J.refs={});var V=d6($,X,J.refs);return V===null?null:{node:{type:_.refCollection},end:V}}function lZ($,Z,J){var Q=$.length;if($.charCodeAt(Z)!==D0||Z+1>=Q||$.charCodeAt(Z+1)!==O9)return null;for(var X=Z+2,Y=X;X<Q&&$.charCodeAt(X)!==$9;){if($.charCodeAt(X)===T)return null;X++}if(X>=Q)return null;var V=("^"+$.slice(Y,X)).toLowerCase();if(X++,X>=Q||$.charCodeAt(X)!==f0)return null;for(X++;X<Q&&($.charCodeAt(X)===I||$.charCodeAt(X)===w);)X++;if(X<Q&&$.charCodeAt(X)===T)for(X++;X<Q&&($.charCodeAt(X)===I||$.charCodeAt(X)===w);)X++;var G=$.indexOf(`
`,X);G<0&&(G=Q);for(var U=$.slice(X,G).trim(),q=G<Q?G+1:Q;q<Q;){var W=q0($,q);if(R0($,q,W),V0>=2&&!Q9($,q,W))U+=`
`+$.slice(q,W),q=s($,W);else if(Q9($,q,W)){var F=s($,W);if(F<Q){var H=q0($,F);if(R0($,F,H),V0>=2){U+=`
`,q=s($,W);continue}}break}else break}return J.refs[V]||(J.refs[V]={target:U,title:void 0}),{node:{type:_.footnote},end:q}}function oZ($,Z,J,Q){let X=Z,Y=0,V=0,G=-1;for(;X<$.length;){let R=G>=0?G:q0($,X);if(G=-1,Q9($,X,R))break;if(R0($,X,R),V0<4&&V>0&&!J.h){let S=$.charCodeAt(X+X0);if(S===p0||S===d){let x=X+X0;for(;x<R&&$.charCodeAt(x)===S;)x++;for(;x<R&&($.charCodeAt(x)===I||$.charCodeAt(x)===w);)x++;if(x>=R){Y=S===p0?1:2,X=s($,R);break}}}V=R;let L=s($,R);if(L<$.length){if($.charCodeAt(L)===Z$){var U=q0($,L);X=s($,U),V=U;continue}let S=q0($,L);if(G=S,R0($,L,S),V0<4){let x=$.charCodeAt(L+X0);if(x===c){X=L;break}if(x===_9&&r6($,L,J,Q)){X=L;break}if(x===$0||x===b0){for(var q=L+X0,W=0;q<S&&$.charCodeAt(q)===x;)W++,q++;if(W>=3){X=L;break}}if(x===n){var F=L+X0+1,H=F<S?$.charCodeAt(F):0,K=H===T0||H===$$;if(!K&&H===M0){for(var M=F+1,O=M;O<S&&($.charCodeAt(O)>=u&&$.charCodeAt(O)<=l||$.charCodeAt(O)>=J0&&$.charCodeAt(O)<=Y0||$.charCodeAt(O)>=r&&$.charCodeAt(O)<=i||$.charCodeAt(O)===d);)O++;O>M&&(K=y$.has($.slice(M,O).toLowerCase()))}else if(!K){for(var z=F;z<S&&($.charCodeAt(z)>=u&&$.charCodeAt(z)<=l||$.charCodeAt(z)>=J0&&$.charCodeAt(z)<=Y0||$.charCodeAt(z)>=r&&$.charCodeAt(z)<=i||$.charCodeAt(z)===d);)z++;if(z>F){var B=$.slice(F,z).toLowerCase();K=y$.has(B)||H$.has(B)}}if(K&&a6($,L,J,Q)){X=L;break}}if(x===d||x===j0||x===b9){let h=L+X0+1;if(h<S&&($.charCodeAt(h)===I||$.charCodeAt(h)===w)){var D=O$($,h,S);if(D<S&&!d9($,L)){X=L;break}}}if(x>=r&&x<=i){let h=L+X0;for(;h<S&&$.charCodeAt(h)>=r&&$.charCodeAt(h)<=i;)h++;if(h<S&&($.charCodeAt(h)===Z9||$.charCodeAt(h)===D9)&&h-(L+X0)===1&&$.charCodeAt(L+X0)===49){var v=h+1;if(v<S&&($.charCodeAt(v)===I||$.charCodeAt(v)===w)){var g=O$($,v,S);if(g<S){X=L;break}}}}if(x===k0){let h=s($,S);if(h<$.length){let y=q0($,h);if(u6($,h,y)){X=L;break}}}if((x===d||x===j0||x===O0)&&d9($,L)){if(x!==d){X=L;break}let h=0,y=L+X0;for(;y<S&&$.charCodeAt(y)===d;)h++,y++;for(;y<S&&($.charCodeAt(y)===I||$.charCodeAt(y)===w);)y++;if(y<S){X=L;break}}}}X=s($,R)}for(var P=Y?V:X;P>Z&&($.charCodeAt(P-1)===T||$.charCodeAt(P-1)===P9||$.charCodeAt(P-1)===I||$.charCodeAt(P-1)===w);)P--;for(var j=Z;j<P&&($.charCodeAt(j)===I||$.charCodeAt(j)===w);)j++;if(j>=P)return null;for(var k=!1,E=j;E<P;E++)if($.charCodeAt(E)===Z$){k=!0;break}var b=k?$.slice(j,P).replace(/\u001E/g,""):$.slice(j,P);if(!b)return null;let N=rZ(b,0,b.length,J,Q);if(Y){let L=(Q?.slugify||J9)(b);return{node:{type:_.heading,level:Y,children:N,id:L},end:X}}return{node:{type:_.paragraph,children:N},end:X}}function rZ($,Z,J,Q,X){var Y=$.indexOf(`
`,Z);if(Y<0||Y>=J)return l0($,Z,J,Q,X);for(var V="",G=Z,U=Z;U<J;){var q=$.charCodeAt(U);if(q===$0){var W=E$($,U,J);if(W>U){for(var F=!1,H=U;H<W;H++)if($.charCodeAt(H)===T){F=!0;break}F&&(V+=$.slice(G,U),V+=$.slice(U,W).replace(/\n/g," "),G=W),U=W;continue}}if(q===n){var K=n6($,U,J);if(K>U){U=K;continue}}if(q===T){var M=!1,O=0;if(U>Z&&$.charCodeAt(U-1)===y0)M=!0,O=1;else{for(var z=0,B=U-1;B>=Z&&$.charCodeAt(B)===I;)z++,B--;z>=2&&(M=!0,O=z)}if(M)V+=$.slice(G,U-O),V+="";else{for(var D=U;D>G&&$.charCodeAt(D-1)===I;)D--;V+=$.slice(G,D)+`
`}for(U++;U<J&&$.charCodeAt(U)===I;)U++;G=U;continue}U++}return G<J&&(V+=$.slice(G,J)),l0(V,0,V.length,Q,X)}function iZ($,Z,J){if($.charCodeAt(Z)!==$0)return null;let Q=E9($,Z,J,96),X=Z+Q;for(;X<J;){let Y=$.indexOf("`",X);if(Y<0||Y>=J)return null;let V=E9($,Y,J,96);if(V===Q){let G=$.slice(Z+Q,Y);return G=G.replace(/\n/g," "),G.length>0&&G[0]===" "&&G[G.length-1]===" "&&G.trim().length>0&&(G=G.slice(1,-1)),{node:{type:_.codeInline,text:G},end:Y+V}}X=Y+V}return null}function E$($,Z,J){if($.charCodeAt(Z)!==$0)return Z;let Q=E9($,Z,J,96),X=Z+Q;for(;X<J;){let Y=$.indexOf("`",X);if(Y<0||Y>=J)return Z;let V=E9($,Y,J,96);if(V===Q)return Y+V;X=Y+V}return Z}function n6($,Z,J){if($.charCodeAt(Z)!==n)return Z;if(Z+1<J&&$.charCodeAt(Z+1)===M0){let q=Z+2;for(;q<J&&$.charCodeAt(q)!==c;)q++;return q<J?q+1:Z}if(Z+3<J&&$.charCodeAt(Z+1)===T0&&$.charCodeAt(Z+2)===d&&$.charCodeAt(Z+3)===d){let q=$.indexOf("-->",Z+4);return q>=0?q+3:Z}let Q=Z+1,X=Q;for(;Q<J;){let q=$.charCodeAt(Q);if(q>=u&&q<=l||q>=J0&&q<=Y0||q>=r&&q<=i||q===d)Q++;else break}if(Q===X)return Z;let Y=$.slice(X,Q).toLowerCase(),V=!1;for(;Q<J;){let q=$.charCodeAt(Q);if(q===c){Q++;break}if(q===M0&&Q+1<J&&$.charCodeAt(Q+1)===c){Q+=2,V=!0;break}if(q===V9||q===g9){var G=q;for(Q++;Q<J&&$.charCodeAt(Q)!==G;)Q++;Q<J&&Q++;continue}if(q===T)return Z;Q++}if(V||a9(Y))return Q;let U=1;for(;Q<J&&U>0;)if($.charCodeAt(Q)===n)if(Q+1<J&&$.charCodeAt(Q+1)===M0){let q=Q+2,W=q;for(;W<J&&($.charCodeAt(W)>=u&&$.charCodeAt(W)<=l||$.charCodeAt(W)>=J0&&$.charCodeAt(W)<=Y0);)W++;if($.slice(q,W).toLowerCase()===Y){for(;W<J&&$.charCodeAt(W)!==c;)W++;if(W<J&&W++,U--,U===0)return W}Q=W}else{let q=Q+1,W=q;for(;W<J&&($.charCodeAt(W)>=u&&$.charCodeAt(W)<=l||$.charCodeAt(W)>=J0&&$.charCodeAt(W)<=Y0);)W++;$.slice(q,W).toLowerCase()===Y&&U++,Q++}else Q++;return Q}function aZ($,Z,J,Q,X){if($.charCodeAt(Z)!==b0||Z+1>=J||$.charCodeAt(Z+1)!==b0)return null;let Y=Z+2;for(;Y+1<J;){let V=$.charCodeAt(Y);if(V===$0){let G=E$($,Y,J);if(G>Y){Y=G;continue}}if(V===b0&&$.charCodeAt(Y+1)===b0){let G=$.slice(Z+2,Y),U=l0(G,0,G.length,Q,X);return{node:{type:_.textFormatted,tag:"del",children:U},end:Y+2}}V===y0&&Y+1<J&&Y++,Y++}return null}function nZ($,Z,J,Q,X){if($.charCodeAt(Z)!==p0||Z+1>=J||$.charCodeAt(Z+1)!==p0)return null;let Y=Z+2;for(;Y+1<J;){let V=$.charCodeAt(Y);if(V===$0){let G=E$($,Y,J);if(G>Y){Y=G;continue}}if(V===p0&&$.charCodeAt(Y+1)===p0&&Y>Z+2){let G=$.slice(Z+2,Y),U=l0(G,0,G.length,Q,X);return{node:{type:_.textFormatted,tag:"mark",children:U},end:Y+2}}V===y0&&Y+1<J&&Y++,Y++}return null}function g6($,Z,J){return $<J$?!!(n$($)&i9):v6.test(Z[J])}function h6($,Z,J){return $<J$?!!(n$($)&R9):I6.test(Z[J])}function sZ($,Z,J){var Q=$.charCodeAt(Z);if(Q!==j0&&Q!==O0)return null;var X=E9($,Z,J,Q);if(X===0)return null;var Y=Z>0?$.charCodeAt(Z-1):32,V=Z+X<J?$.charCodeAt(Z+X):32,G=h6(Y,$,Z-1),U=h6(V,$,Z+X),q=Z>0?g6(Y,$,Z-1):!1,W=Z+X<J?g6(V,$,Z+X):!1,F=!U&&(!W||G||q),H=!G&&(!q||U||W),K,M;return Q===j0?(K=F,M=H):(K=F&&(!H||q),M=H&&(!F||W)),{len:X,canOpen:K,canClose:M}}function tZ($,Z,J,Q){if(Z.length!==0){for(var X=[],Y=0;Y<12;Y++)X[Y]=-1;for(var V=0;V<Z.length;){var G=Z[V];if(!G.active||!G.canClose){V++;continue}for(var U=G.ch===j0?0:1,q=U*6+G.len%3*2+(G.canOpen?1:0),W=X[q]!==void 0?X[q]:-1,F=-1,H=V-1;H>W;H--){var K=Z[H];if(!(!K.active||K.ch!==G.ch||!K.canOpen)&&!((G.canOpen||K.canClose)&&(K.len+G.len)%3===0&&K.len%3!==0)){F=H;break}}if(F<0){X[q]=V-1,!G.canOpen&&(G.active=!1),V++;continue}var M=Z[F],O=M.len>=2&&G.len>=2,z=O?2:1;M.len-=z,G.len-=z;var B=$[M.idx],D=$[G.idx];B.text=B.text.slice(0,B.text.length-z),D.text=D.text.slice(z);var v=M.idx+1,g=G.idx,P=$.slice(v,g),j={type:_.textFormatted,tag:O?"strong":"em",children:P};$.splice(v,g-v,j);for(var k=g-v-1,E=0;E<Z.length;E++)Z[E].idx>M.idx&&(Z[E].idx-=k);for(var b=F+1;b<V;b++)Z[b].active=!1;if(M.len===0&&(M.active=!1,B.text==="")){$.splice(M.idx,1);for(var N=0;N<Z.length;N++)Z[N].idx>M.idx?Z[N].idx--:Z[N].idx===M.idx&&(Z[N].idx=-1)}if(G.len===0){G.active=!1;var R=G.idx;if(D.text===""){$.splice(R,1);for(var L=0;L<Z.length;L++)Z[L].idx>R?Z[L].idx--:Z[L].idx===R&&(Z[L].idx=-1)}}else continue;V++}for(var S=0,x=0;x<$.length;x++){var h=$[x];if(h.type===_.text){var y=h;if(y.text==="")continue;if(S>0&&$[S-1].type===_.text){$[S-1].text+=y.text;continue}}$[S++]=h}$.length=S}}function x6($,Z,J,Q,X){let Y=$.charCodeAt(Z)===T0,V=Y?Z+1:Z;if($.charCodeAt(V)!==D0)return null;var G=$.indexOf("]",V+1);if(G<0||G>=J)return null;for(var U=V+1,q=-1,W=1;U<J&&W>0;){var F=$.charCodeAt(U);if(F===y0&&U+1<J){U+=2;continue}if(F===$0){var H=E$($,U,J);if(H>U){U=H;continue}}if(F===n){var K=s6($,U,J);if(K){U=K.end;continue}var M=n6($,U,J);if(M>U){U=M;continue}}F===D0?W++:F===$9&&W--,U++}if(W!==0)return null;var O=U-1,z=$.slice(V+1,O),B=U<J?$.charCodeAt(U):0,D=!1;if(B===H9){var v=!0;for(U++;U<J&&($.charCodeAt(U)===I||$.charCodeAt(U)===T);)U++;var g="",P=U;if(U<J&&$.charCodeAt(U)===n){for(U++,P=U;P<J&&$.charCodeAt(P)!==c;){if($.charCodeAt(P)===y0&&P+1<J){P+=2;continue}if($.charCodeAt(P)===T){v=!1;break}P++}v&&(P>=J||$.charCodeAt(P)!==c)&&(v=!1),v&&(g=$.slice(U,P),P++)}else if(v){for(var j=0;P<J;){var k=$.charCodeAt(P);if(k===y0&&P+1<J){P+=2;continue}if(k===H9)j++;else if(k===D9){if(j===0)break;j--}else if(k===I||k===T)break;P++}g=$.slice(U,P)}if(v){for(U=P;U<J&&($.charCodeAt(U)===I||$.charCodeAt(U)===T);)U++;var E;if(U<J){var b=$.charCodeAt(U);if(b===V9||b===g9||b===H9){var N=b===H9?41:b;U++;for(var R=U;U<J&&$.charCodeAt(U)!==N;)$.charCodeAt(U)===y0&&U+1<J&&U++,U++;U>=J?v=!1:(E=$.slice(R,U),U++)}}if(v){for(;U<J&&($.charCodeAt(U)===I||$.charCodeAt(U)===T);)U++;(U>=J||$.charCodeAt(U)!==D9)&&(v=!1)}}if(v){U++,g=Y$(g),E!==void 0&&(E=x9(Y$(E)));var L=X?.sanitizer||Q$,S=L(g,Y?"img":"a",Y?"src":"href"),x=S===null?null:g;if(Y){var h=l0(z,0,z.length,Q,X),y=L$(h);return{node:{type:_.image,target:x,alt:y,title:E},end:U}}else{var G0=Q.inAnchor;Q.inAnchor=!0;var p=G0?[{type:_.text,text:z}]:l0(z,0,z.length,Q,X);return Q.inAnchor=G0,!Q.inAnchor&&a$(p)?null:{node:{type:_.link,target:x,title:E,children:p},end:U}}}else U=O+1,D=!0}var m="",a=U;if(!D&&B===D0){var A0=U+1;a=A0;for(var H0=!1;a<J&&$.charCodeAt(a)!==$9;){if($.charCodeAt(a)===y0&&a+1<J){a+=2;continue}if($.charCodeAt(a)===D0){H0=!0;break}a++}if(H0||a>=J)return null;var g0=$.slice(A0,a);if(g0.trim())m=R$(g0);else{if(L6(z))return null;m=R$(z)}a=a+1}else{if(L6(z))return null;m=R$(z)}var K0=Q.refs[m];if(!K0)return null;if(Y)return{node:{type:_.image,target:K0.target,alt:L$(l0(z,0,z.length,Q,X)),title:K0.title},end:a};var C=Q.inAnchor;Q.inAnchor=!0;var p=C?[{type:_.text,text:z}]:l0(z,0,z.length,Q,X);return Q.inAnchor=C,!Q.inAnchor&&a$(p)?null:{node:{type:_.link,target:K0.target,title:K0.title,children:p},end:a}}function s6($,Z,J){if($.charCodeAt(Z)!==n)return null;for(var Q=Z+1;Q<J;){var X=$.charCodeAt(Q);if(X===c)break;if(X===I||X===T||X===P9||X===n)return null;Q++}if(Q>=J||$.charCodeAt(Q)!==c)return null;var Y=$.slice(Z+1,Q),V=Y.match(/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^\x00-\x20]*)$/);return V?{node:{type:_.link,target:Y,title:void 0,children:[{type:_.text,text:Y}]},end:Q+1}:Y.indexOf("@")!==-1&&/^[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])?)*$/.test(Y)?{node:{type:_.link,target:"mailto:"+Y,title:void 0,children:[{type:_.text,text:Y}]},end:Q+1}:null}function eZ($,Z,J,Q){if($.charCodeAt(Z)!==D0||Z+1>=J||$.charCodeAt(Z+1)!==O9)return null;let X=Z+2;for(;X<J&&$.charCodeAt(X)!==$9&&$.charCodeAt(X)!==T;)X++;if(X>=J||$.charCodeAt(X)!==$9)return null;let Y=$.slice(Z+2,X);return Y?{node:{type:_.footnoteReference,target:"#"+J9(Y),text:Y},end:X+1}:null}function $J($,Z,J,Q){if(Q.disableBareUrls)return null;var X="",Y=!1,V=$.charCodeAt(Z);if(V===l9||V===72?Z+8<=J&&$.charCodeAt(Z+1)===o9&&$.charCodeAt(Z+2)===o9&&$.charCodeAt(Z+3)===v$&&($.charCodeAt(Z+4)===p$&&$.charCodeAt(Z+5)===f0&&$.charCodeAt(Z+6)===M0&&$.charCodeAt(Z+7)===M0?X="https://":$.charCodeAt(Z+4)===f0&&$.charCodeAt(Z+5)===M0&&$.charCodeAt(Z+6)===M0&&(X="http://")):V===N9||V===70?Z+6<=J&&$.charCodeAt(Z+1)===o9&&$.charCodeAt(Z+2)===v$&&$.charCodeAt(Z+3)===f0&&$.charCodeAt(Z+4)===M0&&$.charCodeAt(Z+5)===M0&&(X="ftp://"):(V===v9||V===87)&&Z+4<=J&&$.charCodeAt(Z+1)===v9&&$.charCodeAt(Z+2)===v9&&$.charCodeAt(Z+3)===Z9&&(X="www.",Y=!0),!X)return null;let G=Z+X.length;for(;G<J;){let j=$.charCodeAt(G);if(j===I||j===T||j===w||j===P9||j===n||j===c)break;G++}for(var U=0,q=0,W=Z;W<G;W++){var F=$.charCodeAt(W);F===H9?U++:F===D9&&q++}let H=G;for(;H>Z+X.length;){let j=$.charCodeAt(H-1);if(j===Z9||j===z6||j===f0||j===T0||j===$$||j===D9||j===j0||j===O0||j===b0){if(j===D9){if(U>=q)break;q--}H--}else if(j===d$){for(var K=H-2;K>Z&&($.charCodeAt(K)>=u&&$.charCodeAt(K)<=l||$.charCodeAt(K)>=J0&&$.charCodeAt(K)<=Y0||$.charCodeAt(K)>=r&&$.charCodeAt(K)<=i);)K--;K>=Z&&$.charCodeAt(K)===e9?H=K:H--}else break}if(H<=Z+X.length)return null;var M=Z+(Y?4:X.length),O=$.indexOf("/",M);if((O<0||O>H)&&(O=H),Y&&$.indexOf(".",M)===-1)return null;for(var z=-1,B=-1,D=O-1;D>=M;D--)if($.charCodeAt(D)===Z9)if(z<0)z=D;else{B=D;break}for(var v=B>=0?B+1:M,D=v;D<O;D++)if($.charCodeAt(D)===O0)return null;var g=$.slice(Z,H),P=Y?"http://"+g:g;return{node:{type:_.link,target:P,title:void 0,children:[{type:_.text,text:g}]},end:H}}function ZJ($,Z,J,Q){if(Q.disableBareUrls)return null;for(var X=Z,Y=X;X<J;){var V=$.charCodeAt(X);if(V>=u&&V<=l||V>=J0&&V<=Y0||V>=r&&V<=i||V===Z9||V===T0||V===_9||V===36||V===K$||V===e9||V===g9||V===j0||V===b9||V===M0||V===p0||V===$$||V===O9||V===O0||V===$0||V===h9||V===k0||V===I$||V===b0||V===d)X++;else break}if(X===Y||X>=J||$.charCodeAt(X)!==W$)return null;X++;for(var G=X,U=-1,q=X;X<J;){var V=$.charCodeAt(X);if(V>=u&&V<=l||V>=J0&&V<=Y0||V>=r&&V<=i)X++;else if((V===d||V===O0)&&X>G)X++;else if(V===Z9){if(X===G)break;var W=$.charCodeAt(X-1);if(W===d||W===O0||X-q>63)break;if(X+1<J){var F=$.charCodeAt(X+1);if(F>=u&&F<=l||F>=J0&&F<=Y0||F>=r&&F<=i)U=X,q=X+1,X++;else break}else break}else break}if(X-q>63||U<0)return null;var H=$.charCodeAt(X-1);if(!(H>=u&&H<=l||H>=J0&&H<=Y0||H>=r&&H<=i)||X<=U+1)return null;for(var K=-1,M=U-1;M>=G;M--)if($.charCodeAt(M)===Z9){K=M;break}for(var O=K>=0?K+1:G,M=O;M<X;M++)if($.charCodeAt(M)===O0)return null;var z=$.slice(Z,X);return{node:{type:_.link,target:"mailto:"+z,title:void 0,children:[{type:_.text,text:z}]},end:X}}function a$($){for(var Z=0;Z<$.length;Z++)if($[Z].type===_.link||"children"in $[Z]&&Array.isArray($[Z].children)&&a$($[Z].children))return!0;return!1}function L$($){for(var Z="",J=0;J<$.length;J++){var Q=$[J];Q.type===_.text?Z+=Q.text:Q.type===_.breakLine?Z+=" ":Q.type===_.codeInline?Z+=Q.text:"children"in Q&&Array.isArray(Q.children)?Z+=L$(Q.children):Q.type===_.image?Z+=Q.alt||"":Q.type===_.link&&(Z+=L$(Q.children))}return Z}function n9($){let Z=$.includes("&")?x9($):$;return{type:_.text,text:Z}}function JJ($,Z,J,Q,X){if($.charCodeAt(Z)!==n)return null;var Y=Z+1;if(Y>=J)return null;var V=$.charCodeAt(Y);if(V===T0&&Y+1<J&&$.charCodeAt(Y+1)===d&&Y+2<J&&$.charCodeAt(Y+2)===d){var G=Y+3;if(G<J&&$.charCodeAt(G)===c)return{node:{type:_.htmlComment,text:"",g:!0},end:G+1};if(G+1<J&&$.charCodeAt(G)===d&&$.charCodeAt(G+1)===c)return{node:{type:_.htmlComment,text:"-",g:!0},end:G+2};var U=$.indexOf("-->",G);return U!==-1&&U<=J-3?{node:{type:_.htmlComment,text:$.slice(Z+4,U),g:!1},end:U+3}:null}if(V===$$){var q=$.indexOf("?>",Y+1);return q!==-1&&q<J?{node:{type:_.htmlSelfClosing,tag:"?",attrs:{},a:$.slice(Z,q+2),b:!1},end:q+2}:null}if(V===T0&&Y+1<J){var W=$.charCodeAt(Y+1);if(W===D0&&$.slice(Y+1,Y+8)==="[CDATA["){var F=$.indexOf("]]>",Y+8);return F!==-1&&F<J?{node:{type:_.htmlSelfClosing,tag:"![CDATA[",attrs:{},a:$.slice(Z,F+3),b:!1},end:F+3}:null}if(W>=u&&W<=l){var H=$.indexOf(">",Y+2);return H!==-1&&H<J?{node:{type:_.htmlSelfClosing,tag:"!"+$.slice(Y+1,H),attrs:{},a:$.slice(Z,H+1),b:!1},end:H+1}:null}}if(V===M0){var K=Y+1;if(K>=J)return null;var M=$.charCodeAt(K);if(!(M>=u&&M<=l||M>=J0&&M<=Y0))return null;for(K++;K<J;){var O=$.charCodeAt(K);if(O>=u&&O<=l||O>=J0&&O<=Y0||O>=r&&O<=i||O===d)K++;else break}for(;K<J&&($.charCodeAt(K)===I||$.charCodeAt(K)===w||$.charCodeAt(K)===T);)K++;if(K<J&&$.charCodeAt(K)===c){var z=$.slice(Y+1,K).trim();return{node:{type:_.htmlSelfClosing,tag:z,attrs:{},a:$.slice(Z,K+1),b:!0},end:K+1}}return null}if(!(V>=u&&V<=l||V>=J0&&V<=Y0))return null;var B=k9($,Z);if(!B)return null;var D=B.tag,v=D.toLowerCase(),g=B.selfClosing;if(g||a9(D))return{node:{type:_.htmlSelfClosing,tag:D,attrs:y9(B.attrs,D,X),a:$.slice(Z,B.end),b:!1},end:B.end};var P=H$.has(v),j=i$($.slice(0,J),B.end,D);if(j===-1)return{node:{type:_.htmlSelfClosing,tag:D,attrs:y9(B.attrs,D,X),a:$.slice(Z,B.end),b:!1},end:B.end};var k=pZ($,"</"+v,j),E=$.slice(B.end,k),b=[];if(P)E.trim()&&(b=[{type:_.text,text:E}]);else{var N=E.trim();if(N){var{inAnchor:R,inline:L}=Q;v==="a"&&(Q.inAnchor=!0);var S=N.indexOf(`

`)!==-1||/^#{1,6}\s/.test(N);S?(Q.inline=!1,b=L9(N,Q,X)):b=l0(N,0,N.length,Q,X),Q.inAnchor=R,Q.inline=L}}return{node:{type:_.htmlBlock,tag:D,attrs:y9(B.attrs,D,X),d:B.rawAttrs,children:b,a:void 0,text:E,e:!1,b:!1,endPos:j,f:!1},end:j}}var QJ=200,X$=0;function l0($,Z,J,Q,X){if(X$++,X$>QJ)return X$--,[{type:_.text,text:$.slice(Z,J)}];let Y=Q;if(X.streaming||X.optimizeForStreaming){let r0=function(Q0,f){for(var N0=1,F0=f+1;F0<Q0.length;F0++){var m0=Q0.charCodeAt(F0);if(m0===D0)N0++;else if(m0===$9&&(N0--,N0===0))return F0}return-1},A=$.slice(Z,J),o=A;for(var V=0,G=0,U=0,q=0,W=0,F=-1,H=-1,K=-1,M=-1,O=-1,z=0;z<A.length;z++){var B=A.charCodeAt(z);B===j0?z+1<A.length&&A.charCodeAt(z+1)===j0?(V++,F=z,z++):(G++,H=z):B===O0?z+1<A.length&&A.charCodeAt(z+1)===O0?(U++,K=z,z++):(q++,M=z):B===b0&&z+1<A.length&&A.charCodeAt(z+1)===b0&&(W++,O=z,z++)}var D=[];W%2===1&&O>=0&&D.push([O,2]),U%2===1&&K>=0&&D.push([K,2]),q%2===1&&M>=0&&D.push([M,1]),V%2===1&&F>=0&&D.push([F,2]),G%2===1&&H>=0&&D.push([H,1]),D.sort(function(Q0,f){return f[0]-Q0[0]});for(var v=0;v<D.length;v++){var g=D[v][0],P=D[v][1];A=A.slice(0,g)+A.slice(g+P)}let I0=0,_0=-1;for(let Q0=0;Q0<A.length;Q0++)A.charCodeAt(Q0)===$0&&(I0++,_0=Q0);if(I0%2===1&&_0!==-1){let Q0=!1,f=-1,N0=0;for(;N0<A.length;)A.charCodeAt(N0)===$0&&(Q0?(Q0=!1,f=-1):(f=N0,Q0=!0)),N0++;Q0&&f!==-1&&(A=A.slice(0,f))}for(var j=!0;j;){j=!1;for(var k=-1,E=-1,b=-1,N=!1,R=0;R<A.length;R++){var L=A.charCodeAt(R);if(L===D0&&(R===0||A.charCodeAt(R-1)!==y0)){var S=R>0&&A.charCodeAt(R-1)===T0,x=S?R-1:R,h=r0(A,R);if(h===-1)k=x,N=S,E=R+1,b=A.length;else{var y=h+1;if(y>=A.length)k=x,N=S,E=R+1,b=h;else if(A.charCodeAt(y)===H9){var G0=A.indexOf(")",y+1);G0===-1?(k=x,N=S,E=R+1,b=h,R=A.length):R=G0}else if(A.charCodeAt(y)===D0){var p=A.indexOf("]",y+1);p===-1?(k=x,N=S,E=R+1,b=h,R=A.length):R=p}else R=h}}}if(k>=0){var m=N?"":A.slice(E,b);A=A.slice(0,k)+m,j=!0}}let P0=A.match(/<([A-Z][A-Za-z0-9]*)(?:\s[^>]*)?>([^<]*)$/);if(P0&&P0.index!==void 0){var a=P0[0].length-P0[2].length,A0=a>=2&&P0[0].charCodeAt(a-2)===M0;if(!A0){for(var H0=!1,g0=0,K0=0;K0<P0.index;K0++)A.charCodeAt(K0)===$0&&g0++;if(H0=g0%2===1,!H0){let Q0=P0[1];p9(A,"</"+Q0,0)===-1&&(A=A.replace(/<[A-Z][A-Za-z0-9]*(?:\s[^>]*)?>([^<]*)$/,"$1"))}}}A!==o&&($=$.slice(0,Z)+A,J=Z+A.length)}let C=[];var W0=[];let e=Z;var Z0=X.disableAutoLink||X.disableBareUrls||Y.inAnchor?-1:$.indexOf("@",Z);for(Z0>=J&&(Z0=-1);Z<J;){let A=$.charCodeAt(Z),o=null;if(A===$0){if(o=iZ($,Z,J),!o){var U9=E9($,Z,J,$0);Z+=U9-1}}else if(A===j0||A===O0){var U0=sZ($,Z,J);if(U0){if(U0.canOpen||U0.canClose){Z>e&&C.push(n9($.slice(e,Z)));var B0=$.slice(Z,Z+U0.len),v0=n9(B0);W0.push({idx:C.length,ch:A,len:U0.len,canOpen:U0.canOpen,canClose:U0.canClose,active:!0}),C.push(v0),Z+=U0.len,e=Z;continue}Z+=U0.len-1}}else if(A===b0)o=aZ($,Z,J,Y,X);else if(A===p0)o=nZ($,Z,J,Y,X);else if(A===D0)Z+1<J&&$.charCodeAt(Z+1)===O9&&(o=eZ($,Z,J,Y)),o||(o=x6($,Z,J,Y,X));else if(A===T0&&Z+1<J&&$.charCodeAt(Z+1)===D0)o=x6($,Z,J,Y,X);else if(A===n)o=s6($,Z,J),!o&&!X.disableParsingRawHTML&&!X.ignoreHTMLBlocks&&(o=JJ($,Z,J,Y,X));else if((A===l9||A===v9||A===N9)&&!Y.inAnchor&&!X.disableAutoLink&&(Z===0||$.charCodeAt(Z-1)!==n)){var t=Z+1<J?$.charCodeAt(Z+1):0;(A===l9&&t===o9||A===N9&&t===o9||A===v9&&t===v9)&&(o=$J($,Z,J,X))}if(!o&&Z0>=0&&Z0-Z<=64&&!Y.inAnchor&&!X.disableAutoLink&&!X.disableBareUrls&&(A>=u&&A<=l||A>=J0&&A<=Y0||A>=r&&A<=i)&&(o=ZJ($,Z,J,X),!o&&Z>=Z0&&(Z0=$.indexOf("@",Z+1),Z0>=J&&(Z0=-1))),A===P$){Z>e&&C.push(n9($.slice(e,Z))),C.push({type:_.breakLine}),Z++,e=Z;continue}if(o)Z>e&&C.push(n9($.slice(e,Z))),C.push(o.node),Z=o.end,e=Z;else{if(A===y0&&Z+1<J){let I0=$.charCodeAt(Z+1);if(n$(I0)&i9){Z>e&&C.push(n9($.slice(e,Z))),C.push(n9($[Z+1])),Z+=2,e=Z;continue}}if(Z++,Z0<0||Z0-Z>64)for(;Z<J;){var z0=$.charCodeAt(Z);if(z0<J$&&!C6[z0])Z++;else break}}}if(J>e){let A=$.slice(e,J);A&&C.push(n9(A))}return W0.length>0&&tZ(C,W0,Q,X),X$--,C}var XJ=500;function L9($,Z,J){var Q=Z.i||0;if(Q>XJ)return[{type:_.text,text:$}];Z.i=Q+1;let X=Z;if((J.streaming||J.optimizeForStreaming)&&!Z.j){var Y=$.length;Y>0&&$.charCodeAt(Y-1)===T&&Y--;for(var V=Y;V>0&&$.charCodeAt(V-1)!==T;)V--;if(V>0&&$.charCodeAt(V)===k0){for(var G=!0,U=V;U<Y;U++){var q=$.charCodeAt(U);if(q!==I&&q!==w&&q!==d&&q!==f0&&q!==k0){G=!1;break}}if(G){for(var W=V-1;W>0&&$.charCodeAt(W-1)!==T;)W--;$.charCodeAt(W)===k0&&($=$.slice(0,W).trimEnd())}}var F=$.trim(),H=F.lastIndexOf(`
`),K=H===-1?F:F.slice(H+1);if(K.length>0&&K.charCodeAt(0)===k0){for(var M=!1,O=!1,z=1;z<K.length;z++){var B=K.charCodeAt(z);B===k0&&(M=!0),B===d&&(O=!0)}M&&O&&($=H===-1?"":$.slice(0,$.lastIndexOf(K)).trimEnd())}for(var D=-1,v=-1,g=-1,P=$.length-1;P>=0;P--)if($.charCodeAt(P)===n){var j=P+1<$.length?$.charCodeAt(P+1):0;if(j>=u&&j<=l||j>=J0&&j<=Y0){for(var k=P+2;k<$.length;){var E=$.charCodeAt(k);if(E>=u&&E<=l||E>=J0&&E<=Y0||E>=r&&E<=i)k++;else break}for(var b=k;b<$.length&&$.charCodeAt(b)!==c;)b++;if(b<$.length&&$.charCodeAt(b-1)!==M0){for(var N=!1,R=b+1;R<$.length;R++)if($.charCodeAt(R)===n){N=!0;break}N||(D=P,v=k,g=b+1)}}break}if(D>=0){for(var L=0,S=0;S<D;S++)$.charCodeAt(S)===$0&&L++;if(L%2===0){var x=$.slice(D+1,v);p9($,"</"+x,0)===-1&&($=$.slice(0,D)+$.slice(g))}}for(var h=$.length;h>0&&$.charCodeAt(h-1)===T;)h--;if(h>0){for(var y=h;y>0&&$.charCodeAt(y-1)!==T;)y--;for(var G0=y,p=0;G0<h&&$.charCodeAt(G0)===I&&p<3;)G0++,p++;if(y>0&&G0<h&&hZ($,G0,h)){for(var m=y-1,a=m;a>0&&$.charCodeAt(a-1)!==T;)a--;Q9($,a,m)||($=$.slice(0,y).trimEnd())}}var A0=$.length;if(A0>0){for(var H0=$.lastIndexOf(`
`),g0=H0===-1?0:H0+1,K0=A0,C=g0,W0=0;C<K0&&$.charCodeAt(C)===I&&W0<3;)C++,W0++;if(C<K0){var e=$.charCodeAt(C),Z0=!1;if(e===j0||e===d||e===b9){var U9=C+1;if(U9>=K0||$.charCodeAt(U9)===I||$.charCodeAt(U9)===w){for(var U0=U9;U0<K0&&($.charCodeAt(U0)===I||$.charCodeAt(U0)===w);)U0++;U0>=K0&&(Z0=!0)}}else if(e>=r&&e<=i){for(var B0=C;B0<K0&&$.charCodeAt(B0)>=r&&$.charCodeAt(B0)<=i;)B0++;if(B0<K0&&($.charCodeAt(B0)===Z9||$.charCodeAt(B0)===D9)){var v0=B0+1;if(v0>=K0||$.charCodeAt(v0)===I||$.charCodeAt(v0)===w){for(var t=v0;t<K0&&($.charCodeAt(t)===I||$.charCodeAt(t)===w);)t++;t>=K0&&(Z0=!0)}}}Z0&&($=$.slice(0,g0).trimEnd())}}}if(Z.inline)return l0($,0,$.length,Z,J);let z0=[],A=0,o=$.length;if(A===0&&!J.disableFrontmatter&&$.startsWith("---")){let f=A6($);if(f&&f.hasValidYaml){if(J.preserveFrontmatter!==!1){let N0=$.slice(0,f.endPos).trimEnd();z0.push({type:_.frontmatter,text:N0})}A=f.endPos}}for(;A<o;){for(var I0=$.indexOf(`
`,A),_0=I0<0?o:I0;A<o&&Q9($,A,_0);)A=_0<o?_0+1:_0,A<o&&(I0=$.indexOf(`
`,A),_0=I0<0?o:I0);if(A>=o)break;$.charCodeAt(A),R0($,A,_0);let f=null;if(c6=$,l6=A,o6=_0,$.charCodeAt(A)!==Z$&&V0>=4&&!Z.inHTML)f=CZ($,A);else if($.charCodeAt(A)!==Z$){let N0=A+X0,F0=$.charCodeAt(N0);F0===_9?f=r6($,A,Z,J):F0===c?f=mZ($,A,Z,J):F0===$0||F0===b0?f=xZ($,A,Z):F0===d||F0===j0||F0===O0?(f=d9($,A),!f&&(f=S6($,A,Z,J))):F0===b9||F0>=r&&F0<=i?f=S6($,A,Z,J):F0===n?f=a6($,A,Z,J):F0===k0?f=f6($,A,Z,J):F0===D0&&(f=cZ($,A,Z))}if(!f){for(var r0=!1,P0=A;P0<_0;P0++)if($.charCodeAt(P0)===k0){r0=!0;break}r0&&(f=f6($,A,Z,J))}if(f||(f=oZ($,A,Z,J)),f)f.node.type!==_.refCollection&&z0.push(f.node),A=f.end;else{var Q0=$.indexOf(`
`,A);A=Q0<0?o:Q0+1}}return Z.i=Q,z0}function s$($,Z){X$=0,$.charCodeAt(0)===65279&&($=$.slice(1)),$=l$($);let J={inline:!1,inAnchor:!1,inHTML:!1,inList:!1,inBlockQuote:!1,refs:{}},Q={...Z,slugify:Z?.slugify?Y=>Z.slugify(Y,J9):J9,sanitizer:Z?.sanitizer||Q$,tagfilter:Z?.tagfilter!==!1};J.j=p6($,J.refs,Q);let X=L9($,J,Q);return J.refs&&Object.keys(J.refs).length>0?[{type:_.refCollection,refs:J.refs},...X]:X}function PJ($,Z,J,Q){var X=k9($,Z);return X?{tagName:X.tag,tagLower:X.tag.toLowerCase(),attrs:X.rawAttrs,whitespaceBeforeAttrs:X.whitespaceBeforeAttrs,isSelfClosing:X.selfClosing,hasSpaceBeforeSlash:X.hasSpaceBeforeSlash,isClosing:X.isClosing,hasNewline:X.whitespaceBeforeAttrs.includes(`
`)||X.rawAttrs.includes(`
`),endPos:X.end}:null}function t6($,Z,J){X$=0,$=l$($),!Z.refs&&(Z.refs={}),Z.j=p6($,Z.refs,J);let Q=L9($,Z,J);return Z.refs&&Object.keys(Z.refs).length>0?[{type:_.refCollection,refs:Z.refs},...Q]:Q}var V$=P6;function I9($){if(!$)return $;var Z=$.indexOf("&"),J=$.indexOf("<");J!==-1&&(Z===-1||J<Z)&&(Z=J);var Q=$.indexOf(">");Q!==-1&&(Z===-1||Q<Z)&&(Z=Q);var X=$.indexOf('"');if(X!==-1&&(Z===-1||X<Z)&&(Z=X),Z===-1)return $;for(var Y=$.slice(0,Z),V=Z,G=$.length;Z<G;){var U=$.charCodeAt(Z);U<=62&&(U===e9?(Z>V&&(Y+=$.slice(V,Z)),Y+="&amp;",V=Z+1):U===n?(Z>V&&(Y+=$.slice(V,Z)),Y+="&lt;",V=Z+1):U===c?(Z>V&&(Y+=$.slice(V,Z)),Y+="&gt;",V=Z+1):U===V9&&(Z>V&&(Y+=$.slice(V,Z)),Y+="&quot;",V=Z+1)),Z++}return V<G&&(Y+=$.slice(V)),Y}function t$($){for(var Z=!1,J=0,Q=$.length;J<Q;){var X=$.charCodeAt(J);if(X===e9||X===n||X===c||X===V9){Z=!0;break}J++}return Z?$.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/&(?!([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);)/g,"&amp;"):$}function j9($){var Z="";for(var J in $){var Q=$[J];if(Q!=null)if(Z+=" ",Q===!0)Z+=J;else if(Q==="")Z+=J+'=""';else if(J==="style"&&typeof Q=="object"&&Q!==null){var X="",Y=!0;for(var V in Q){var G=Q[V];if(G!=null){Y?Y=!1:X+="; ";for(var U="",q=0;q<V.length;q++){var W=V.charCodeAt(q);W>=u&&W<=l?U+="-"+String.fromCharCode(W+d0):U+=V[q]}X+=U+": "+G}}X&&(Z+='style="'+t$(X)+'"')}else typeof Q=="string"?Z+=J+'="'+t$(Q)+'"':typeof Q=="number"&&(Z+=J+'="'+Q+'"')}return Z}var B$={};function e$($,Z){return $.type===_.footnote||$.type===_.ref||$.type===_.frontmatter&&!Z}function e6($,Z){if(!V$(Z))return $||B$;var J=$?{...$}:{};for(var Q in Z)J[Q]=Z[Q];return J}function D$($,Z,J,Q){if(!J.hasOverrides)return!Q||!V$(Q)?"<"+$+">"+Z+"</"+$+">":"<"+$+j9(Q)+">"+Z+"</"+$+">";var X=C9($,J.overrides),Y=m9($,J.overrides);if(!Q||!V$(Q))return"<"+X+j9(Y)+">"+Z+"</"+X+">";var V={...Y};for(var G in Q)V[G]=Q[G];return"<"+X+j9(V)+">"+Z+"</"+X+">"}function G9($,Z){var J="";if(Z.renderRule)for(var Q=0;Q<$.length;Q++)J+=$6($[Q],{key:Q},Z);else for(var Q=0;Q<$.length;Q++){var X=$[Q];X.type===_.text?X.text&&(J+=I9(X.text)):J+=S$(X,Z)}return J}function $6($,Z,J){return!$||typeof $!="object"?"":J.renderRule?J.renderRule(function(){return $.type===_.ref||$.type===_.refCollection||e$($,J.preserveFrontmatter)?"":S$($,J)},$,function(Q){return G9(Q,J)},Z):$.type===_.ref||$.type===_.refCollection||e$($,J.preserveFrontmatter)?"":S$($,J)}function S$($,Z){switch($.type){case _.blockQuote:{var J=$.children?G9($.children,Z):"";return $.alert?(J="<header>"+I9($.alert)+"</header>"+J,D$("blockquote",J,Z,{class:"markdown-alert-"+Z.slug($.alert.toLowerCase(),J9)})):D$("blockquote",J,Z)}case _.breakLine:return`<br />
`;case _.breakThematic:return"<hr />";case _.frontmatter:return"<pre>"+I9($.text)+"</pre>";case _.codeBlock:{var Q=$.attrs||{};if($.lang){Q={...Q};var X=x9($.lang),Y=Q.class||Q.className||"";Q.class=Y?Y+" language-"+X:"language-"+X,delete Q.className}var V=j9(Q),G=$.text||"";return"<pre><code"+V+">"+I9(G)+"</code></pre>"}case _.codeInline:return"<code>"+I9($.text||"")+"</code>";case _.footnoteReference:{var U=Z.sanitize($.target||"","a","href")||"",q=I9($.text||"");return'<a href="'+I9(U)+'"><sup>'+q+"</sup></a>"}case _.gfmTask:return"<input"+($.completed?' checked=""':"")+' disabled="" type="checkbox">';case _.heading:{var W=$.level||1,F=$.id?.trim()?{id:$.id}:void 0;return D$("h"+W,$.children?G9($.children,Z):"",Z,F)}case _.htmlComment:{var H=$;return H.raw?H.text:H.g?"<!--"+$.text+">":"<!--"+$.text+"-->"}case _.htmlBlock:{var K=$,M=K.tag||"div",O=Z.hasOverrides?C9(M,Z.overrides):M,z=Z.hasOverrides?m9(M,Z.overrides):B$,B;if(K.d!==void 0){var D=K.d,v=D.length>0&&D.charCodeAt(0)>I;B=(v?" ":"")+D+(V$(z)?" "+j9(z).trim():"")}else B=j9(e6(K.attrs,z));if(Z.tagfilter&&b$(O))return K.b?"&lt;/"+O+">":"&lt;"+O+B+">";if(K.a){if(K.e){var H0=Z.tagfilter?F$(K.a):K.a;if(K.b)return"</"+O+">"+H0;var g=O.toLowerCase(),P=m6(g);if(P){for(var j=K.a.length,k=0;k<j&&K.a.charCodeAt(k)===I;)k++;if(k<j&&K.a.charCodeAt(k)===n){var E=K.a.indexOf(">",k);if(E!==-1){var b=K.a.slice(k,E+1);if(b.charCodeAt(1)>=J0&&b.charCodeAt(1)<=Y0){for(var N=1,R=N;R<b.length&&b.charCodeAt(R)>=J0&&b.charCodeAt(R)<=Y0;)R++;var L=b.slice(N,R).toLowerCase();if(L===g){var S=K.a.slice(E+1);return b+(Z.tagfilter?F$(S):S)}}}}var x="</"+g+">",h=K.a.indexOf(x)!==-1;return h?"<"+O+B+">"+H0:"<"+O+B+">"+H0+"</"+O+">"}var y=K.a.trim();if(y.length>0&&y.charCodeAt(0)===n){var G0=y.charCodeAt(1);if(G0>=J0&&G0<=Y0||G0>=u&&G0<=l){for(var N=1,R=N;R<y.length;){var p=y.charCodeAt(R);if(p>=J0&&p<=Y0||p>=u&&p<=l||p>=r&&p<=i||p===d)R++;else break}var L=y.slice(N,R).toLowerCase();if(L===g)return H0}}if(K.k){var m=H0.indexOf("</"+g+">"),a=m!==-1?H0.slice(0,m):H0;return"<"+O+B+">"+a+"</"+O+">"}for(var A0=0;A0<H0.length&&H0.charCodeAt(A0)===I;)A0++;return"<"+O+B+">"+(A0>0?H0.slice(A0):y?H0:"")}var H0=Z.tagfilter?F$(K.a):K.a;return"<"+O+B+">"+H0+"</"+O+">"}if(K.d&&K.d.indexOf(`
`)!==-1&&K.a){var g0=Z.tagfilter?F$(K.a):K.a;return"<"+O+B+">"+g0+"</"+O+">"}if(a9(O))return"<"+O+B+">";var J=K.children?G9(K.children,Z):"";if(K.b)return"</"+O+">"+J;if(!K.e)return"<"+O+B+">"+J+"</"+O+">";for(var K0=0;K0<J.length;K0++){var C=J.charCodeAt(K0);if(C!==I&&C!==w&&C!==T&&C!==13)return"<"+O+B+">"+J+"</"+O+">"}return"<"+O+B+">"+J}case _.htmlSelfClosing:{var W0=$,e=W0.tag||"div",Z0=Z.hasOverrides?C9(e,Z.overrides):e;if(W0.a)return Z.tagfilter&&b$(Z0)?W0.a.replace(/^</,"&lt;"):W0.a;if(W0.b)return"</"+Z0+">";var U9=Z.hasOverrides?m9(e,Z.overrides):B$,U0=e6(W0.attrs,U9),B0=j9(U0);return Z.tagfilter&&b$(Z0)?"&lt;"+Z0+B0+" />":"<"+Z0+B0+" />"}case _.image:{var v0=Z.hasOverrides?C9("img",Z.overrides):"img",t=Z.hasOverrides?m9("img",Z.overrides):B$,z0=Z.sanitize($.target||"","img","src")||"",A={...t,alt:$.alt||""};return $.title&&(A.title=$.title),"<"+v0+' src="'+I9(z0)+'"'+j9(A)+" />"}case _.link:{var o=Z.hasOverrides?C9("a",Z.overrides):"a",I0=Z.hasOverrides?m9("a",Z.overrides):B$,_0=V$(I0)?{...I0}:{};if($.target!=null){var r0=o$(x9($.target)),P0=Z.sanitize(r0,"a","href");P0!==null&&(_0.href=P0===r0?P0:o$(P0))}return $.title&&(_0.title=x9($.title)),"<"+o+j9(_0)+">"+($.children?G9($.children,Z):"")+"</"+o+">"}case _.table:{for(var Q0=$,f=Q0.align||[],N0="",F0=Q0.header||[],m0=0;m0<F0.length;m0++){var q9=f[m0];N0+="<th"+(q9?' align="'+q9+'"':"")+">"+G9(F0[m0],Z)+"</th>"}for(var h0="",K9=Q0.cells||[],i0=0;i0<K9.length;i0++){var W9=K9[i0]||[];h0+="<tr>";for(var F9=0;F9<W9.length;F9++){var q9=f[F9];h0+="<td"+(q9?' align="'+q9+'"':"")+">"+G9(W9[F9],Z)+"</td>"}h0+="</tr>"}if(Z.hasOverrides){var S9=C9("table",Z.overrides),M9=j9(m9("table",Z.overrides));return"<"+S9+M9+"><thead><tr>"+N0+"</tr></thead>"+(h0?"<tbody>"+h0+"</tbody>":"")+"</"+S9+">"}return"<table><thead><tr>"+N0+"</tr></thead>"+(h0?"<tbody>"+h0+"</tbody>":"")+"</table>"}case _.text:return I9($.text||"");case _.textFormatted:return D$($.tag||"strong",$.children?G9($.children,Z):"",Z);case _.orderedList:case _.unorderedList:{for(var a0="",n0=$.items||[],u0=0;u0<n0.length;u0++)a0+="<li>"+G9(n0[u0],Z)+"</li>";var s0=$.type===_.orderedList?"ol":"ul",w0=$.type===_.orderedList&&$.start!=null&&$.start!==1?{start:$.start}:void 0;return D$(s0,a0,Z,w0)}case _.paragraph:{if(Z.forceInline)return $.children?G9($.children,Z):"";var J=$.children?G9($.children,Z):"",t0=0;if(J.indexOf(`
`)!==-1){for(var e0="",E0=0,X9=0,A9=!1,x0=0;(t0=J.indexOf(` 
`,X9))!==-1;){for(var G$=X9;G$<t0;G$++){var p=J.charCodeAt(G$);p===n?(A9=!0,x0=0):p===c?(A9=!1,x0=0):A9&&p===V9&&x0++}A9&&x0%2===1?X9=t0+2:(e0+=J.slice(E0,t0)+`
`,E0=t0+2,X9=E0)}E0>0&&(E0<J.length&&(e0+=J.slice(E0)),J=e0)}if(!Z.hasOverrides)return"<p>"+J+"</p>";var B=j9(m9("p",Z.overrides)),O=C9("p",Z.overrides);return"<"+O+B+">"+J+"</"+O+">"}default:return""}}function VJ($,Z={}){for(var J=Z.sanitizer||Q$,Q=Z.slugify||J9,X=Z.refs||{},Y=Z.overrides||{},V={},G=[],U=!1,q=0;q<$.length;q++){var W=$[q];if(W.type===_.refCollection&&!U){V=W.refs||{},U=!0;continue}e$(W,!!Z.preserveFrontmatter)||G.push(W)}for(var F in V)X[F]=V[F];var H={sanitize:J,slug:Q,refs:X,overrides:Y,hasOverrides:V$(Y),preserveFrontmatter:!!Z.preserveFrontmatter,tagfilter:!!Z.tagfilter,forceInline:!!Z.forceInline,renderRule:Z.renderRule},K="";if(Array.isArray($))if(H.renderRule)for(var M=0;M<G.length;M++)K+=$6(G[M],{key:M,refs:X},H);else for(var M=0;M<G.length;M++)K+=S$(G[M],H);else K=$6($,{refs:X},H);var O="";for(var F in X)if(F.charCodeAt(0)===O9){O||(O="<footer>");for(var z=F.slice(1),B=t6(X[F].target,{inline:!0,refs:X},{overrides:Y,sanitizer:J,slugify:function(a){return Q(a,J9)},tagfilter:Z.tagfilter!==!1}),D=[],v=0;v<B.length;v++)B[v].type!==_.refCollection&&D.push(B[v]);var g={sanitize:J,slug:Q,refs:{},overrides:Y,hasOverrides:H.hasOverrides,preserveFrontmatter:H.preserveFrontmatter,tagfilter:H.tagfilter,forceInline:!0,renderRule:H.renderRule},P=G9(D,g);O+='<div id="'+t$(Q(z,J9))+'">'+I9(z)+": "+P+"</div>"}if(O&&(O+="</footer>"),Z.wrapper===null)return K+O;var j=G.length>1,k=Z.wrapper!=null,E=k&&typeof Z.wrapper=="string",b=Z.forceWrapper||Z.forceInline&&k||j&&k;if(!b)return K+O;var N=K;if((Z.forceInline||Z.forceWrapper&&E&&!Z.wrapperWasAutoSet)&&!j&&G.length===1&&G[0].type===_.paragraph){var R=G[0];if(R.children){var L={sanitize:J,slug:Q,refs:{},overrides:Y,hasOverrides:H.hasOverrides,preserveFrontmatter:H.preserveFrontmatter,tagfilter:H.tagfilter,forceInline:!0,renderRule:H.renderRule};N=G9(R.children,L)}}var S=typeof Z.wrapper=="string"?Z.wrapper:Z.forceInline?"span":"div",x="";if(Z.wrapperProps){var h={};for(var y in Z.wrapperProps){var G0=Z.wrapperProps[y];if(G0!=null){var p=J(String(G0),S,y);p!==null&&(h[y]=p)}}x=j9(h)}return"<"+S+x+">"+N+O+"</"+S+">"}function RJ($,Z){var J=Z?.forceInline||!1,Q={...Z,overrides:Z?.overrides,sanitizer:Z?.sanitizer,slugify:Z?.slugify?function(W){return Z.slugify(W,J9)}:J9,tagfilter:Z?.tagfilter!==!1},X=s$($,{...Q,forceInline:J}),Y={...Z,forceInline:J},V=!1;if(Z?.wrapper===void 0){for(var G=0,U=0;U<X.length;U++){var q=X[U];q.type!==_.refCollection&&q.type!==_.footnote&&q.type!==_.ref&&(q.type!==_.frontmatter||!Z?.preserveFrontmatter)&&G++}G>1||Z?.forceWrapper?(Y.wrapper="div",V=!0):J&&G>0&&(Y.wrapper="span",V=!0)}return Y.wrapperWasAutoSet=V,VJ(X,Y)}export{J9 as slugify,Q$ as sanitizer,s$ as parser,RJ as compiler,VJ as astToHTML,_ as RuleType};
