import*as z9 from"react";import{Image as eZ,Linking as d6,Text as g0,View as L0}from"react-native";var I=32,N=9,j9=13,L=10,a=96,M0=126,W0=91,r0=94,d=62,K9=35,G$=37,u=45,f0=61,v0=92,O0=42,V0=95,e=60,K$=64,p0=93,E0=33,x$=38,x0=58,g$=70,B9=102,m9=104,W9=119,u9=116,H$=112,T$=115,Q6=160,X6=12,Y6=44,f$=59,s9=63,d0=46,H0=47,S9=39,M9=34,A9=43,I0=124,E9=123,D$=125,t0=40,e0=41,t9=30,j$=31,o=48,r=57,p=65,c=90,G0=97,q0=122,e9=128,i0=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 MZ}from"markdown-to-jsx/entities";function W6($){if(!K6($,"---"))return null;let J=3;for(;J<$.length&&($[J]===" "||$[J]==="	");)J++;if(J<$.length&&$[J]==="\r"&&J++,J>=$.length||$[J]!==`
`)return null;J++;let Z=!1;for(;J<$.length;){let Q=J;for(;J<$.length&&$[J]!==`
`&&$[J]!=="\r";)J++;if(J>=$.length)break;let X=J;if($[J]==="\r"&&J++,J<$.length&&$[J]===`
`&&J++,K6($,"---",Q))return{endPos:J,hasValidYaml:Z};if(!Z){let Y=bZ($,Q,X);if(Y<X){let K=$.charCodeAt(Y);if(K>=G0&&K<=q0||K>=p&&K<=c||K>=o&&K<=r||K===V0){for(Y++;Y<X&&(K=$.charCodeAt(Y),K>=G0&&K<=q0||K>=p&&K<=c||K>=o&&K<=r||K===V0||K===u||K===d0);)Y++;Y<X&&$.charCodeAt(Y)===x0&&(Y++,Y>=X?Z=!0:(K=$.charCodeAt(Y),(K===I||K===N)&&(Z=!0)))}}}}return null}var AZ=/&([a-zA-Z0-9]+|#[0-9]{1,7}|#x[0-9a-fA-F]{1,6});/gi,vZ={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 x9($){var J={};for(var Z in $){var Q=Z.toLowerCase(),X=vZ[Q];if(X)J[X]=$[Z];else{var Y=Z.indexOf(":");Y!==-1?J[Z.slice(0,Y)+Z[Y+1].toUpperCase()+Z.slice(Y+2)]=$[Z]:J[Z]=$[Z]}}return J}var z6=/(\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 M$($){return $.indexOf("&")===-1?$:$.replace(AZ,(J,Z)=>{var Q=MZ(Z);if(Q)return Q;if(Z[0]==="#"){var X=Z[1]==="x"||Z[1]==="X"?parseInt(Z.slice(2),16):parseInt(Z.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 J})}var G6=/(javascript|vbscript|data(?!:image)):/i;function c9($){if(G6.test($))return null;if($.indexOf("%")===-1)return $;try{let J=decodeURIComponent($).replace(/[^A-Za-z0-9/:]/g,"");if(G6.test(J))return null}catch{return null}return $}var T0={},C0,R0;for(C0=[192,193,194,195,196,197,224,225,226,227,228,229,230,198],R0=0;R0<C0.length;R0++)T0[C0[R0]]="a";for(T0[231]=T0[199]="c",T0[240]=T0[208]="d",C0=[200,201,202,203,233,232,234,235],R0=0;R0<C0.length;R0++)T0[C0[R0]]="e";for(C0=[207,239,206,238,205,237,204,236],R0=0;R0<C0.length;R0++)T0[C0[R0]]="i";for(T0[209]=T0[241]="n",C0=[248,216,339,338,213,245,212,244,211,243,210,242],R0=0;R0<C0.length;R0++)T0[C0[R0]]="o";for(C0=[220,252,219,251,218,250,217,249],R0=0;R0<C0.length;R0++)T0[C0[R0]]="u";T0[376]=T0[255]=T0[221]=T0[253]="y";function a0($){for(var J="",Z=-1,Q=$.length,X=0;X<Q;X++){var Y=$.charCodeAt(X);if(Y>=G0&&Y<=q0||Y>=o&&Y<=r){Z<0&&(Z=X);continue}if(Y>=p&&Y<=c){Z>=0&&(J+=$.slice(Z,X),Z=-1),J+=String.fromCharCode(Y+i0);continue}if(Y===I||Y===u){Z>=0&&(J+=$.slice(Z,X),Z=-1),J+="-";continue}Z>=0&&(J+=$.slice(Z,X),Z=-1);var K=T0[Y];K&&(J+=K)}return Z>=0&&(J+=$.slice(Z)),J}function K6($,J,Z){return $.startsWith(J,Z)}var V6=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 l9($){let J=$.toLowerCase();if(V6.has(J))return!0;let Z=J.indexOf(":");return Z!==-1?(J=J.slice(Z+1),V6.has(J)):!1}var v9=1,q6=2,d9=4,U6=8,_Z=16,$9=32,_9=64,F6=1,IZ=2,PZ=3,NZ=4,O6=(function(){var $=new Uint8Array(128),J;for($[N]=v9,$[L]=v9|q6,$[X6]=v9,$[j9]=v9|q6,$[I]=v9,J=E0;J<=H0;J++)$[J]=d9;for(J=x0;J<=K$;J++)$[J]=d9;for(J=W0;J<=a;J++)$[J]=d9;for(J=E9;J<=M0;J++)$[J]=d9;for(J=o;J<=r;J++)$[J]=_Z;for(J=p;J<=c;J++)$[J]=U6;for(J=G0;J<=q0;J++)$[J]=U6;return $})(),WJ=(function(){let $=new Uint8Array(128);return $[v0]=IZ,$[W0]=NZ,$[O0]=$[V0]=$[M0]=$[f0]=PZ,$[a]=$[e]=$[K$]=$[p0]=$[L]=$[I]=$[E0]=F6,$[B9]=$[m9]=$[W9]=F6,$})(),H6=/[\p{P}\p{S}]/u,D6=/\p{Zs}/u,p9=[];function h$($){var J=$.indexOf("\r"),Z=$.indexOf("\0");if(J===-1&&Z===-1)return $;var Q=$.length;p9.length=0;var X=0,Y=0;for(J===-1?Y=Z:Z===-1?Y=J:Y=J<Z?J:Z;Y<Q;Y++){var K=$.charCodeAt(Y);K===j9?(X<Y&&p9.push($.slice(X,Y)),Y+1<Q&&$.charCodeAt(Y+1)===L&&Y++,p9.push(`
`),X=Y+1):K===0&&(X<Y&&p9.push($.slice(X,Y)),p9.push("\uFFFD"),X=Y+1)}return X<Q&&p9.push($.slice(X)),p9.join("")}function bZ($,J,Z){let Q=Z??$.length;for(;J<Q&&($[J]===" "||$[J]==="	");)J++;return J}function zJ($){if(!$)return!1;for(var J in $)return!0;return!1}function $$($,J,Z){for(var Q=$,X=J.split("."),Y=0;Y<X.length&&(Q=Q?.[X[Y]],Q!==void 0);)Y++;return Q||Z}function j6($){for(var J=!1,Z=0;Z<$.length;Z++){var Q=$.charCodeAt(Z);if(Q<=I||Q===M9||Q===G$||Q===e||Q===d||Q===W0||Q===v0||Q===p0||Q===r0||Q===a||Q>=123){J=!0;break}}if(!J)return $;for(var X="",Z=0;Z<$.length;Z++){var Q=$.charCodeAt(Z);if(Q===G$&&Z+2<$.length){var Y=$.charCodeAt(Z+1),K=$.charCodeAt(Z+2);if((Y>=o&&Y<=r||Y>=p&&Y<=g$||Y>=G0&&Y<=B9)&&(K>=o&&K<=r||K>=p&&K<=g$||K>=G0&&K<=B9)){X+=$[Z]+$[Z+1]+$[Z+2],Z+=2;continue}}X+=encodeURI($[Z])}return X}function OJ(...$){return $.filter(Boolean).join(" ")}function HJ($,J){if(!J)return $;let Z=$$(J,$,void 0);return typeof Z=="string"?Z:typeof Z=="object"&&Z.component?Z.component:$}function DJ($,J){if(!J)return{};let Z=$$(J,$,void 0);return typeof Z=="object"&&Z.props?Z.props:{}}var RZ=new Set(["title","textarea","style","xmp","iframe","noembed","noframes","script","plaintext"]),B$=/<(\/?)(title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)(\s|>|\/)/gi;function m$($){return RZ.has($.toLowerCase())}function jJ($){return B$.lastIndex=0,B$.test($)}function u$($){return B$.lastIndex=0,$.replace(B$,function(J,Z,Q,X){return"&lt;"+Z+Q+X})}var IJ=/^<([a-zA-Z][a-zA-Z0-9-]*)\s[^>]*>/,PJ=/^<[A-Z]/,p$=["script","pre","style","textarea"],U$=new Set(p$),wZ=/<(?:pre|script|style|textarea)\b/i,M6=/<(?:pre|script|style|textarea)\b/iy,A6=/^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m,v6=/^<([a-z][^ >/\n\r]*) ?([^>]*?)>/im,L6=new Uint8Array(128);(function(){for(var $=[a,O0,V0,M0,f0,W0,E0,e,v0,j$,m9,W9,B9],J=0;J<$.length;J++)L6[$[J]]=1})();var _6=/([a-zA-Z_][a-zA-Z0-9_-]*)=(?:"([^"]*)"|'([^']*)')/g;function l$($){return U$.has($)}function NJ($){return wZ.test($)}function S6($,J,Z){for(var Q=J,X=Z;Q<X&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===N);)Q++;if(Q>=X)return!1;$.charCodeAt(Q)===I0&&Q++;for(var Y=0;Q<X;){for(;Q<X&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===N);)Q++;if(Q>=X)break;if($.charCodeAt(Q)===I0&&Y>0){for(var K=Q+1;K<X&&($.charCodeAt(K)===I||$.charCodeAt(K)===N);)K++;if(K>=X)return!0}if($.charCodeAt(Q)===x0&&Q++,Q>=X||$.charCodeAt(Q)!==u)return!1;for(;Q<X&&$.charCodeAt(Q)===u;)Q++;for(Q<X&&$.charCodeAt(Q)===x0&&Q++,Y++;Q<X&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===N);)Q++;if(Q<X)if($.charCodeAt(Q)===I0)Q++;else return!1}return Y>0}function P9($,J){if($.charCodeAt(J)!==e)return null;let Z=J+1,Q=$.length,X=!1;$.charCodeAt(Z)===H0&&(Z++,X=!0);let Y=Z,K=$.charCodeAt(Z);if(!(K>=G0&&K<=q0||K>=p&&K<=c))return null;for(;Z<Q&&($.charCodeAt(Z)>=G0&&$.charCodeAt(Z)<=q0||$.charCodeAt(Z)>=p&&$.charCodeAt(Z)<=c||$.charCodeAt(Z)>=o&&$.charCodeAt(Z)<=r||$.charCodeAt(Z)===u);)Z++;let q=$.slice(Y,Z);if(!q)return null;let V=Z;for(;Z<Q&&($.charCodeAt(Z)===I||$.charCodeAt(Z)===N||$.charCodeAt(Z)===L);)Z++;let G=$.slice(V,Z);if(Z===V&&Z<Q){var U=$.charCodeAt(Z);if(U!==d&&U!==H0)return null}let F=Z,O={},z=!1;for(;Z<Q;){let E=$.charCodeAt(Z);if(E===d){let S=$.slice(F,Z);return{tag:q,attrs:O,selfClosing:!1,end:Z+1,rawAttrs:S,whitespaceBeforeAttrs:G,isClosing:X,hasSpaceBeforeSlash:z}}if(E===I||E===N||E===L){Z++;continue}if(E===H0&&Z+1<Q&&$.charCodeAt(Z+1)===d){let S=$.slice(F,Z);return z=Z>F&&$.charCodeAt(Z-1)===I,{tag:q,attrs:O,selfClosing:!0,end:Z+2,rawAttrs:S,whitespaceBeforeAttrs:G,isClosing:X,hasSpaceBeforeSlash:z}}var j=Z,H=$.charCodeAt(Z);if(!(H>=G0&&H<=q0||H>=p&&H<=c||H===V0||H===x0))return null;for(Z++;Z<Q;){var W=$.charCodeAt(Z);if(W>=G0&&W<=q0||W>=p&&W<=c||W>=o&&W<=r||W===V0||W===d0||W===x0||W===u)Z++;else break}for(var D=$.slice(j,Z);Z<Q&&($.charCodeAt(Z)===I||$.charCodeAt(Z)===N);)Z++;if($.charCodeAt(Z)!==f0){O[D]="";continue}for(Z++;Z<Q&&($.charCodeAt(Z)===I||$.charCodeAt(Z)===N);)Z++;var B=$.charCodeAt(Z);if(B===M9||B===S9){Z++;for(var v=Z;Z<Q&&$.charCodeAt(Z)!==B;)Z++;if(Z>=Q)return null;if(O[D]=$.slice(v,Z),Z++,Z<Q){var T=$.charCodeAt(Z);if(T!==I&&T!==N&&T!==L&&T!==d&&T!==H0)return null}}else if(B===E9){var P=1,v=Z;for(Z++;Z<Q&&P>0;){var W=$.charCodeAt(Z);W===E9?P++:W===D$&&P--,Z++}O[D]=$.slice(v,Z)}else{for(var v=Z;Z<Q;){var M=$.charCodeAt(Z);if(M===I||M===N||M===d||M===L||M===M9||M===S9||M===f0||M===e||M===a)break;Z++}if(Z===v)return null;O[D]=$.slice(v,Z)}}return null}function E6($,J,Z){if(!Z.streaming&&!Z.optimizeForStreaming&&$.indexOf("[")===-1)return!1;for(var Q=0,X=$.length,Y=!1,K=!1;Q<X;){for(var q=$.indexOf(`
`,Q),V=q<0?X:q,G=Q,U=0;G<V&&U<4;)if($.charCodeAt(G)===I)U++,G++;else if($.charCodeAt(G)===N)U+=4,G++;else break;if(G>=V){Y=!1,Q=q<0?X:q+1;continue}if(U<4){var F=$.charCodeAt(G);if(F===a||F===M0){for(var O=F,z=0,j=G;j<V&&$.charCodeAt(j)===O;)z++,j++;if(z>=3){var H=!0;if(O===a){for(var W=j;W<V;W++)if($.charCodeAt(W)===a){H=!1;break}}if(H){Y=!1;for(var D=q<0?X:q+1;D<X;){for(var B=D,v=0;B<X&&v<4;){var T=$.charCodeAt(B);if(T===I)v++,B++;else if(T===N)v+=4,B++;else break}if(v<4&&B<X&&$.charCodeAt(B)===O){for(var P=0;B<X&&$.charCodeAt(B)===O;)P++,B++;if(P>=z){for(;B<X&&($.charCodeAt(B)===I||$.charCodeAt(B)===N);)B++;if(B>=X||$.charCodeAt(B)===L){Q=B>=X?X:B+1;break}}}for(;D<X&&$.charCodeAt(D)!==L;)D++;D<X&&D++}D>=X&&(Q=X,K=!0);continue}}}}for(var M=G;M<V&&$.charCodeAt(M)===d;){M++,M<V&&$.charCodeAt(M)===I&&M++;for(var E=0;M<V&&E<4;)if($.charCodeAt(M)===I)E++,M++;else if($.charCodeAt(M)===N)E+=4,M++;else break;if(E>=4)break;Y=!1}if(!Y&&U<4&&M<V&&$.charCodeAt(M)===W0&&!(M+1<X&&$.charCodeAt(M+1)===r0)){var S=x6($,M,J);if(S){Q=S,Y=!1;continue}}var R=$.charCodeAt(G);if(R===K9&&U<4)Y=!1;else if(U<4&&(R===u||R===O0||R===V0)){for(var b=G,w=0;b<V;){var y=$.charCodeAt(b);if(y===R)w++;else if(y!==I&&y!==N)break;b++}Y=!(w>=3&&b>=V)}else Y=!0;Q=q<0?X:q+1}return K}function x6($,J,Z){let Q=$.length;if($.charCodeAt(J)!==W0)return null;let X=J+1<Q&&$.charCodeAt(J+1)===r0,Y=J+1;for(;Y<Q;){var K=$.charCodeAt(Y);if(K===p0){Y++;break}if(K===W0)return null;K===v0&&Y+1<Q&&Y++,Y++}if(Y>Q||$.charCodeAt(Y-1)!==p0)return null;let q=$.slice(J+1,Y-1);if(q.length>999)return null;let V=A$(q);if(!V||Y>=Q||$.charCodeAt(Y)!==x0)return null;Y++;let G=!1;for(;Y<Q;){let g=$.charCodeAt(Y);if(g===I||g===N)Y++;else if(g===L&&!G)G=!0,Y++;else break}if(X){let g=$.indexOf(`
`,Y),C=g<0?Q:g,f=$.slice(Y,C).trim();return Z[V]={target:f,title:void 0},g<0?Q:g+1}var U;if(Y<Q&&$.charCodeAt(Y)===e){Y++;for(var F=Y;Y<Q&&$.charCodeAt(Y)!==d&&$.charCodeAt(Y)!==L;)$.charCodeAt(Y)===v0&&Y+1<Q&&Y++,Y++;if(Y>=Q||$.charCodeAt(Y)!==d)return null;U=$.slice(F,Y),Y++;for(var O=$.indexOf(`
`,Y),z=O<0?Q:O,j=Y;j<z&&($.charCodeAt(j)===I||$.charCodeAt(j)===N);)j++;if(j<z){if(j===Y)return null;var H=$.charCodeAt(j);if(H!==M9&&H!==S9&&H!==t0)return null}}else{for(var F=Y,W=0;Y<Q;){var K=$.charCodeAt(Y);if(K===t0)W++;else if(K===e0){if(W===0)break;W--}else{if(K===I||K===N||K===L)break;K===v0&&Y+1<Q&&Y++}Y++}if(U=$.slice(F,Y),!U)return null}for(;Y<Q&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===N);)Y++;var D=$.indexOf(`
`,Y),B=D<0?Q:D,v,T=!1,P=Y,M=Y;if(Y===B&&Y<Q)for(M=Y+1;M<Q&&($.charCodeAt(M)===I||$.charCodeAt(M)===N);)M++;if(M<Q){var E=$.charCodeAt(M);if(E===M9||E===S9||E===t0){for(var S=E===t0?41:E,R=M+1,b=R;R<Q;){var w=$.charCodeAt(R);if(w===S){for(var y=R+1;y<Q&&($.charCodeAt(y)===I||$.charCodeAt(y)===N);)y++;(y>=Q||$.charCodeAt(y)===L)&&(v=$.slice(b,R),T=!0,P=y<Q?y+1:Q);break}if(w===v0&&R+1<Q){R+=2;continue}if(w===L&&R+1<Q&&$.charCodeAt(R+1)===L)break;R++}if(!T&&M===Y)return null}}if(T)return Z[V]||(Z[V]={target:J$(U),title:v!==void 0?M$(J$(v)):v}),P;for(;Y<B&&($.charCodeAt(Y)===I||$.charCodeAt(Y)===N);)Y++;return Y<B?null:(Z[V]||(Z[V]={target:J$(U),title:v}),D<0?Q:D+1)}var m0=new Uint8Array(O6);for(m0[j$]=v9,m0[K9]|=$9,m0[d]|=$9,m0[u]|=$9|_9,m0[A9]|=$9,m0[O0]|=$9|_9,m0[V0]|=$9|_9,m0[a]|=$9|_9,m0[M0]|=$9|_9,m0[e]|=$9|_9,m0[W0]|=_9,m0[E0]|=_9,m0[I0]|=$9,V$=o;V$<=r;V$++)m0[V$]|=$9;var V$;function I6($){if($.indexOf("[")<0&&$.indexOf("]")<0)return!1;for(var J=0;J<$.length;J++){if($.charCodeAt(J)===v0){J++;continue}if($.charCodeAt(J)===W0||$.charCodeAt(J)===p0)return!0}return!1}function A$($){var J=$.replace(/\s+/g," ").trim();return J.indexOf("\u1E9E")!==-1?J.replace(/\u1E9E/g,"ss").toLowerCase():J.toLowerCase()}function o$($){return $<e9?m0[$]:$===Q6?v9:0}function J$($){return $.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,"$1")}var g6=null,T6=-1,f6=-1;function J0($,J){if(J===T6&&$===g6)return f6;var Z=$.indexOf(`
`,J);return Z<0?$.length:Z}function i($,J){let Z=J0($,J);return Z<$.length?Z+1:Z}function q$($,J,Z){for(;J<Z;){let Q=$.charCodeAt(J);if(Q!==I&&Q!==N)break;J++}return J}function P6($,J){let Z=i($,J);for(;Z<$.length;){let Q=J0($,Z);if(c0($,Z,Q))return Z;Z=i($,Z)}return $.length}function b9($,J,Z,Q){let X=0;for(;J+X<Z&&$.charCodeAt(J+X)===Q;)X++;return X}var $0=0,t=0;function A0($,J,Z){for($0=0,t=0;J+t<Z;){let Q=$.charCodeAt(J+t);if(Q===N)$0+=4-$0%4;else if(Q===I)$0++;else break;t++}}function c0($,J,Z){return q$($,J,Z)>=Z}function C6($,J,Z,Q){let X=J0($,J);if(A0($,J,X),$0>3)return null;let Y=J+t;if($.charCodeAt(Y)!==K9)return null;let K=b9($,Y,X,35);if(K<1||K>6||(Y+=K,Y<X&&$.charCodeAt(Y)!==I&&$.charCodeAt(Y)!==N))return null;Y=q$($,Y,X);for(var q=X;q>Y&&$.charCodeAt(q-1)===I;)q--;for(var V=q;q>Y&&$.charCodeAt(q-1)===K9;)q--;if(q<V)if(q===Y||$.charCodeAt(q-1)===I)for(;q>Y&&$.charCodeAt(q-1)===I;)q--;else q=V;let G=$.slice(Y,q),U=h0(G,0,G.length,Z,Q),O=(Q?.slugify||a0)(G);return{node:{type:_.heading,level:K,children:U,id:O},end:i($,X)}}function yZ($,J,Z){var Q=$.charCodeAt(J);if(Q!==f0&&Q!==u)return!1;for(var X=J;X<Z&&$.charCodeAt(X)===Q;)X++;for(;X<Z&&($.charCodeAt(X)===I||$.charCodeAt(X)===N);)X++;return X>=Z}function f9($,J){let Z=J0($,J);if(A0($,J,Z),$0>3)return null;let Q=J+t,X=$.charCodeAt(Q);if(X!==u&&X!==O0&&X!==V0)return null;let Y=0;for(;Q<Z;){let K=$.charCodeAt(Q);if(K===X)Y++;else if(K!==I&&K!==N)return null;Q++}return Y<3?null:{node:{type:_.breakThematic},end:i($,Z)}}function kZ($,J,Z){let Q=J0($,J);if(A0($,J,Q),$0>3)return null;let X=$0,Y=t,K=J+t,q=$.charCodeAt(K);if(q!==a&&q!==M0)return null;let V=b9($,K,Q,q);if(V<3)return null;K+=V;let G=q$($,K,Q),U=Q;if(q===a){for(let R=G;R<Q;R++)if($.charCodeAt(R)===a)return null}for(;U>G&&($.charCodeAt(U-1)===I||$.charCodeAt(U-1)===N);)U--;let F=$.slice(G,U),O="",z="",j=F.indexOf(" ");j===-1?O=F:(O=F.slice(0,j),z=F.slice(j+1).trim()),O=J$(O);var H=void 0;if(z){_6.lastIndex=0;for(var W;(W=_6.exec(z))!==null;)H||(H={}),H[W[1]]=W[2]!==void 0?W[2]:W[3]}let D=i($,Q),B=D,v=$.length;for(;B<$.length;){let R=J0($,B);if(A0($,B,R),$0<4){let b=B+t;var T=b9($,b,R,q);if(T>=V){let w=b+T;if(c0($,w,R)){v=i($,R);break}}}B=i($,R)}var P;if(X===0)P=B>D&&$.charCodeAt(B-1)===L?$.slice(D,B-1):$.slice(D,B);else{P="";for(var M=D;M<B;){var E=J0($,M);A0($,M,E);var S=Math.min(t,X);P+=$.slice(M+S,E)+`
`,M=i($,E)}P.length>0&&P.charCodeAt(P.length-1)===L&&(P=P.slice(0,-1))}return{node:{type:_.codeBlock,lang:O||void 0,text:P,infoString:z||void 0,attrs:H},end:v}}function LZ($,J){let Z=J0($,J);if(A0($,J,Z),$0<4)return null;let Q="",X=J;for(;X<$.length;){let z=J0($,X);if(A0($,X,z),c0($,X,z)){for(var Y=0,K=i($,z);K<$.length;){var q=J0($,K);if(c0($,K,q)){Y++,K=i($,q);continue}if(A0($,K,q),$0>=4){for(var V=0;V<=Y;V++)Q+=`
`;X=K;break}break}if(X!==K)break;continue}if($0<4)break;let j=0,H=0;var G=0;for(let W=X;W<z&&H<4;W++){if($.charCodeAt(W)===N){var U=4-H%4;H+U>4&&(G=H+U-4),H+=U}else H++;j++}var F="";if(G>0)for(var O=0;O<G;O++)F+=" ";F+=$.slice(X+j,z),Q+=F+`
`,X=i($,z)}for(;Q.length>0&&Q.charCodeAt(Q.length-1)===L;)Q=Q.slice(0,-1);for(;Q.length>0&&Q.charCodeAt(Q.length-1)===L;)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 SZ($,J,Z,Q){let X=J0($,J);if(A0($,J,X),$0>3)return null;let Y=J+t;if($.charCodeAt(Y)!==d)return null;let K="",q=J,V,G=!1,U=!1,F=!1;for(;q<$.length;){let k=J0($,q);A0($,q,k);let D0=q+t;if($.charCodeAt(D0)===d){let Q0=D0+1;var O=$0+1,z=!1;if(Q0<k){var j=$.charCodeAt(Q0);j===I?(Q0++,O++,z=!0):j===N&&(z=!0)}for(var H="",W=!1,D=Q0;D<k;D++)if($.charCodeAt(D)===N){W=!0;break}if(W){var B=O;if(z&&Q0<k&&$.charCodeAt(Q0)===N){for(var v=4-B%4,T=0;T<v-1;T++)H+=" ";B+=v,Q0++}for(var P=Q0;P<k;P++)if($.charCodeAt(P)===N){for(var M=4-B%4,E=0;E<M;E++)H+=" ";B+=M}else H+=$[P],B++}else H=$.slice(Q0,k);if(!K&&!V){let m=H.match(/^\[!([A-Za-z]+)\]\s*$/);if(m){V=m[1].toUpperCase(),q=i($,k);continue}}K+=H+`
`;var S=H.trimStart();S.startsWith("```")||S.startsWith("~~~")?F=!F:H.startsWith("    ")||H.startsWith("	")?F=!0:S.length>0&&!F&&(F=!1),U=S.length>0,q=i($,k)}else if(K&&!c0($,q,k)&&U){if($0<4){var R=q+t,b=R<k?$.charCodeAt(R):0;if(b===K9||b===d||b===a||b===M0||b===e||(b===u||b===O0||b===V0)&&f9($,q)||(b===u||b===O0||b===A9)&&R+1<k&&($.charCodeAt(R+1)===I||$.charCodeAt(R+1)===N))break;if(b>=o&&b<=r){for(var w=R;w<k&&$.charCodeAt(w)>=o&&$.charCodeAt(w)<=r;)w++;if(w<k&&($.charCodeAt(w)===d0||$.charCodeAt(w)===e0))break}}if(F)break;K+=$.slice(q,k)+`
`,G=!0,q=i($,k)}else break}if(!K&&!V)return null;var{inBlockQuote:y,g}=Z;Z.inBlockQuote=!0,G&&(Z.g=!0);let C=N9(K||"",Z,Q);return Z.inBlockQuote=y,Z.g=g,{node:{type:_.blockQuote,children:C,alert:V||void 0},end:q}}function h6($,J,Z){for(var Q=0,X=J;X<Z;X++)$.charCodeAt(X)===N?Q+=4-Q%4:Q++;return Q}function g9($,J,Z){if(A0($,J,Z),$0>3)return null;var Q=J+t;if(Q>=Z)return null;var X=$.charCodeAt(Q),Y=$0,K=Q;if(X===u||X===O0||X===A9){if(K=Q+1,K<Z&&$.charCodeAt(K)!==I&&$.charCodeAt(K)!==N&&$.charCodeAt(K)!==L)return null}else if(X>=o&&X<=r){for(var q=Q;q<Z&&q-Q<9;){var V=$.charCodeAt(q);if(V<o||V>r)break;q++}if(q>Q&&q<Z){var G=$.charCodeAt(q);if(G===d0||G===e0){if(K=q+1,K<Z&&$.charCodeAt(K)!==I&&$.charCodeAt(K)!==N&&$.charCodeAt(K)!==L)return null}else return null}else return null}else return null;var U=K,F=h6($,J,K),O=0,z=U,j=F;if(U>=Z)return{ordered:X>=o&&X<=r,marker:X>=o&&X<=r?$[q]:$[Q],start:X>=o&&X<=r?parseInt($.slice(Q,q),10):void 0,contentStart:U,contentCol:F+1,markerCol:Y,isEmpty:!0};for(;z<Z&&($.charCodeAt(z)===I||$.charCodeAt(z)===N);){if($.charCodeAt(z)===N){var H=4-j%4;j+=H}else j++;z++,O++}var W=z>=Z,D=j-F;return W||D>4?(j=F+1,z=U+1,O=1):O===0&&(j=F+1,z=U,O=1),{ordered:X>=o&&X<=r,marker:X>=o&&X<=r?$[q]:$[Q],start:X>=o&&X<=r?parseInt($.slice(Q,q),10):void 0,contentStart:z,contentCol:j,markerCol:Y,isEmpty:W}}var v$=0;function EZ($,J,Z,Q){var X=0,Y=J;for(v$=0;Y<Z&&X<Q;){var K=$.charCodeAt(Y);if(K===N){var q=4-X%4;if(X+q>Q){v$=X+q-Q,Y++,X=Q;break}X+=q}else if(K===I)X++;else break;Y++}return Y}function N6($,J,Z,Q){var X=J0($,J),Y=g9($,J,X);if(!Y)return null;var K=[],q=J,V=Y.contentCol,G="",U=Y.isEmpty,F=!1,O=!1;if(!Y.isEmpty){for(var z=!1,j=Y.contentStart;j<X;j++)if($.charCodeAt(j)===N){z=!0;break}if(z){var H="",W=h6($,J,Y.contentStart),D=W-Y.contentCol;if(D>0)for(var B=0;B<D;B++)H+=" ";for(var v=Y.contentStart;v<X;v++)if($.charCodeAt(v)===N){for(var T=4-W%4,P=0;P<T;P++)H+=" ";W+=T}else H+=$[v],W++;G=H+`
`}else G=$.slice(Y.contentStart,X)+`
`}for(q=i($,X);q<$.length;){var M=J0($,q);A0($,q,M);var E=$.charCodeAt(q+t);if($0<V&&(E===u||E===O0||E===V0)&&$0<=3&&f9($,q))break;var S=g9($,q,M);if(S&&S.ordered===Y.ordered&&S.marker===Y.marker&&S.markerCol<V){K.push({contentCol:V,raw:G,hasBlankAfter:F,isEmpty:U}),F&&(O=!0),V=S.contentCol,U=S.isEmpty,F=!1,G=S.isEmpty?"":$.slice(S.contentStart,M)+`
`,q=i($,M);continue}if(c0($,q,M)){G+=`
`,q=i($,M);for(var R=!1,b=0;b<G.length;b++){var w=G.charCodeAt(b);if(w!==L&&w!==j9&&w!==I&&w!==N){R=!0;break}}if(U&&!R)if(q<$.length){var y=J0($,q),g=g9($,q,y);if(!g||g.ordered!==Y.ordered||g.marker!==Y.marker)break;F=!0}else break;if(q<$.length){var C=J0($,q);A0($,q,C);var f=$.charCodeAt(q+t);if((f===u||f===O0||f===V0)&&$0<=3&&f9($,q))break;var k=g9($,q,C);if(k&&k.ordered===Y.ordered&&k.marker===Y.marker&&k.markerCol<V){F=!0;continue}if(!c0($,q,C)&&$0<V)break}continue}if($0>=V){var D0=EZ($,q,M,V);if(v$>0){for(var Q0="",m=V,n=0;n<v$;n++)Q0+=" ",m++;for(var y0=D0;y0<M;y0++)if($.charCodeAt(y0)===N){for(var l0=4-m%4,u0=0;u0<l0;u0++)Q0+=" ";m+=l0}else Q0+=$[y0],m++;G+=Q0+`
`}else G+=$.slice(D0,M)+`
`;q=i($,M);continue}for(var z0=!1,h=0;h<G.length;h++){var j0=G.charCodeAt(h);if(j0!==L&&j0!==j9&&j0!==I&&j0!==N){z0=!0;break}}if(!F&&z0&&!U){var Z0=q+t,K0=$.charCodeAt(Z0),V9=K0===K9||K0===d||K0===e||K0===a||K0===M0||(K0===u||K0===O0||K0===V0||K0===A9)&&(f9($,q)!==null||g9($,q,M)!==null)||K0>=o&&K0<=r&&g9($,q,M)!==null;if(!V9){G+=""+$.slice(Z0,M)+`
`,q=i($,M);continue}}break}if(K.push({contentCol:V,raw:G,hasBlankAfter:F,isEmpty:U}),K.length===0)return null;var X0=O;if(!X0)for(var B0=0;B0<K.length;B0++){if(K[B0].hasBlankAfter&&B0<K.length-1){X0=!0;break}if(!K[B0].isEmpty){for(var _0=K[B0].raw,s=_0.length,U0=0,A=!1,l=!1,P0=!1,N0=!1,Z9=0,k0=0,Y0=-1;U0<s;){var x=_0.indexOf(`
`,U0);if(x<0&&(x=s),N0){A0(_0,U0,x);for(var w0=_0.slice(U0+t,x),F0=0;F0<w0.length&&w0.charCodeAt(F0)===Z9;)F0++;F0>=k0&&w0.slice(F0).trim()===""&&(N0=!1),U0=x<s?x+1:s;continue}if(c0(_0,U0,x)){Y0>=0?P0=!0:A&&(l=!0),U0=x<s?x+1:s;continue}if(A0(_0,U0,x),Y0>=0){if($0>=Y0){U0=x<s?x+1:s;continue}var q9=g9(_0,U0,x);if(q9&&q9.markerCol<Y0&&q9.contentCol<=Y0){U0=x<s?x+1:s;continue}if(q9){U0=x<s?x+1:s;continue}Y0=-1,P0&&(l=!0,P0=!1)}var r9=_0.slice(U0+t,x),R9=r9.charCodeAt(0);if((R9===a||R9===M0)&&$0<=3){for(var O9=0;O9<r9.length&&r9.charCodeAt(O9)===R9;)O9++;if(O9>=3){if(l&&A){X0=!0;break}N0=!0,Z9=R9,k0=O9,A=!0,U0=x<s?x+1:s;continue}}var U9=$0<=3?g9(_0,U0,x):null;if(U9&&A){if(l){X0=!0;break}Y0=U9.contentCol,P0=!1,U0=x<s?x+1:s,A=!0;continue}if(l){X0=!0;break}A=!0,U0=x<s?x+1:s}if(X0)break}}for(var H9=[],C9=0;C9<K.length;C9++){for(var Q$=K[C9],D9=Q$.raw,J9=D9.length;J9>0&&D9.charCodeAt(J9-1)===L;)J9--;var Q9=J9<D9.length?D9.slice(0,J9):D9,X9=null;if(Q9.length>=3&&Q9.charCodeAt(0)===W0){var n0=Q9[1];(n0===" "||n0==="x"||n0==="X")&&Q9.charCodeAt(2)===p0&&(X9={type:_.gfmTask,completed:n0==="x"||n0==="X"},Q9=Q9.slice(3))}var b0;if(Q$.isEmpty&&Q9.trim()==="")b0=[];else if(X0){var w9=Z.inList;Z.inList=!0,b0=N9(Q9,Z,Q),Z.inList=w9}else{var F9=Z.inList;if(Z.inList=!0,b0=N9(Q9,Z,Q),Z.inList=F9,b0.length===1&&b0[0].type===_.paragraph)b0=b0[0].children;else{for(var Y9=[],y9=0;y9<b0.length;y9++)if(b0[y9].type===_.paragraph)for(var i9=b0[y9].children,G9=0;G9<i9.length;G9++)Y9.push(i9[G9]);else Y9.push(b0[y9]);b0=Y9}}X9?H9.push([X9,{type:_.text,text:" "},...b0]):H9.push(b0)}return{node:{type:Y.ordered?_.orderedList:_.unorderedList,start:Y.ordered?Y.start:void 0,items:H9},end:q}}var _$=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 I9($,J,Z){let Q={};for(let[K,q]of Object.entries($)){let V=K,G=K.toLowerCase();if(G==="style"&&typeof q=="string"){let U={},F=[],O=0,z=0;for(let H=0;H<q.length;H++){let W=q.charCodeAt(H);W===t0?O++:W===e0?O--:W===f$&&O===0&&(F.push(q.slice(z,H)),z=H+1)}z<q.length&&F.push(q.slice(z));let j=!1;F.forEach(H=>{let W=H.indexOf(":");if(W===-1)return;let D=H.slice(0,W).trim(),B=H.slice(W+1).trim();if(D&&B){if(/url\s*\(\s*(javascript|vbscript|data:(?!image\/))/i.test(B)){j=!0;return}let v=D.indexOf("-")!==-1?D.replace(/-([a-z])/g,(T,P)=>P.toUpperCase()):D;U[v]=B}}),!j&&Object.keys(U).length>0&&(Q[V]=U)}else if((G==="href"||G==="src")&&Z?.sanitizer){let U=Z.sanitizer(q,J,G);U!==null&&(Q[V]=U)}else if(q==="")Q[V]=!0;else if(q.length>=2&&q.charCodeAt(0)===E9&&q.charCodeAt(q.length-1)===D$){var X=q.slice(1,-1);if(X.length>0){var Y=X.charCodeAt(0);if(Y===W0||Y===E9)try{Q[V]=JSON.parse(X);continue}catch{}}if(X==="true"){Q[V]=!0;continue}if(X==="false"){Q[V]=!1;continue}if(Z?.evalUnserializableExpressions)try{Q[V]=(0,eval)("("+X+")");continue}catch{}Q[V]=X}else Q[V]=q}return Q}function T9($,J,Z){let Q=J.length;if(Q===0)return Z;var X=J.charCodeAt(0),Y=X>=p&&X<=c||X>=G0&&X<=q0;if(!Y){for(var K=String.fromCharCode(X),q=$.length-Q,V=Z;V<=q;){var G=$.indexOf(K,V);if(G===-1||G>q)return-1;for(var U=!0,F=1;F<Q;F++){var O=$.charCodeAt(G+F),z=J.charCodeAt(F);if(O>=p&&O<=c&&(O+=i0),z>=p&&z<=c&&(z+=i0),O!==z){U=!1;break}}if(U)return G;V=G+1}return-1}X>=p&&X<=c&&(X+=i0);for(let H=Z;H<=$.length-Q;H++){var j=$.charCodeAt(H);if(j>=p&&j<=c&&(j+=i0),j!==X)continue;let W=!0;for(let D=1;D<Q;D++){let B=$.charCodeAt(H+D),v=J.charCodeAt(D);if(B>=p&&B<=c&&(B+=i0),v>=p&&v<=c&&(v+=i0),B!==v){W=!1;break}}if(W)return H}return-1}function xZ($,J,Z){let Q=J.length;var X=J.charCodeAt(0);X>=p&&X<=c&&(X+=i0);for(let K=Math.min(Z,$.length-Q);K>=0;K--){var Y=$.charCodeAt(K);if(Y>=p&&Y<=c&&(Y+=i0),Y!==X)continue;let q=!0;for(let V=1;V<Q;V++){let G=$.charCodeAt(K+V),U=J.charCodeAt(V);if(G>=p&&G<=c&&(G+=i0),U>=p&&U<=c&&(U+=i0),G!==U){q=!1;break}}if(q)return K}return-1}var I$=-1;function d$($,J,Z){let Q=Z.toLowerCase(),X="<"+Q,Y="</"+Q,K=1,q=J,V=$.length;for(I$=-1;q<V&&K>0;){let F=T9($,X,q),O=T9($,Y,q);if(O===-1)return-1;if(F!==-1&&F<O){let z=P9($,F);z?(z.tag.toLowerCase()===Q&&!z.isClosing&&!z.selfClosing&&!l9(z.tag)&&K++,q=z.end):q=F+1}else{var G=O+Y.length,U=G<V?$.charCodeAt(G):62;if((U===d||U===I||U===N||U===L)&&(K--,K===0)){I$=O;let z=O+Y.length;for(;z<V&&$.charCodeAt(z)!==d;)z++;return z+1}q=O+1}}return-1}function m6($,J,Z,Q){if(Q.ignoreHTMLBlocks||Q.disableParsingRawHTML)return null;var X=J0($,J);if(A0($,J,X),$0>3&&!Z.inHTML)return null;var Y=J+t;if($.charCodeAt(Y)!==e)return null;var K=$.indexOf(">",Y+1);if(K!==-1&&K<X){var q=$.slice(Y+1,K);if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(q)||/^[^\s@]+@[^\s@]+$/.test(q))return null}var V=gZ($,Y);if(V>=1&&V<=5){var G=$.length;if(V===1){for(var U=$.length,F=0;F<p$.length;F++){var O=T9($,"</"+p$[F]+">",Y);O>=0&&O<U&&(U=O)}if(U<$.length){var z=$.indexOf(">",U);G=z>=0?i($,z+1):$.length}}else{var j=V===2?"-->":V===3?"?>":V===4?">":"]]>",H=$.indexOf(j,Y);H>=0&&(G=i($,H+j.length))}var W=$.slice(Y,G);if(V>=2)return{node:{type:_.htmlComment,text:W,h:!1,raw:!0,endPos:G},end:G};var D="div",B=W.match(/^<\/?([a-zA-Z][a-zA-Z0-9-]*)/);B&&(D=B[1]);var v=P9($,Y),T={},P;v&&!v.isClosing&&(T=I9(v.attrs,D,Q),P=v.whitespaceBeforeAttrs+v.rawAttrs);var M=[],E=D.toLowerCase(),S="</"+E,R=T9(W,S,0),b=W,w="";if(v&&v.isClosing)for(b=W.slice(v.end-Y);b.length>0&&b.charCodeAt(b.length-1)===L;)b=b.slice(0,-1);else if(v&&!v.isClosing){var y=v.end-Y;if(R!==-1)for(b=W.slice(y),b.charCodeAt(0)===L&&(b=b.slice(1));b.length>0&&b.charCodeAt(b.length-1)===L;)b=b.slice(0,-1);else for(b=W;b.length>0&&b.charCodeAt(b.length-1)===L;)b=b.slice(0,-1);if(R!==-1){var g=W.slice(y,R);w=g.trim()}}var C=v?v.isClosing:!1;return{node:{type:_.htmlBlock,tag:D,attrs:T,f:P,children:M,a:b,text:w,d:!0,b:C,endPos:G,e:!0},end:G}}if(V===6||V===7){var f=P6($,J),k=f<$.length?f:$.length,D0=$.slice(Y,k),Q0=f<$.length?i($,f):$.length,m=P9($,Y);if(m){var n=m.tag,y0=n.toLowerCase(),l0=m.isClosing;if(l0){var u0=$.slice(m.end,k);return{node:{type:_.htmlBlock,tag:n,attrs:{},children:[],a:u0,text:u0,d:!0,b:!0,endPos:k,e:V===6},end:Q0}}if(m.selfClosing||l9(n))return{node:{type:_.htmlBlock,tag:n,attrs:I9(m.attrs,n,Q),f:m.whitespaceBeforeAttrs+m.rawAttrs,children:[],a:"",text:"",d:!1,b:!1,endPos:m.end,e:V===6},end:m.end<$.length&&$.charCodeAt(m.end)===L?m.end+1:m.end};var z0=Z.c||0,h=$.slice(Y,k),j0=-1,Z0=-1;if(z0<10){for(var K0="</"+y0,V9=m.end-Y,X0=1,B0=V9;B0<h.length&&X0>0;){var _0=T9(h,"<"+y0,B0),s=T9(h,K0,B0);if(s===-1)break;if(_0!==-1&&_0<s){var U0=_0+y0.length+1;if(U0<h.length){var A=h.charCodeAt(U0);(A===I||A===N||A===L||A===d||A===H0)&&X0++}B0=_0+1}else{var l=s+K0.length;if(l<h.length){var P0=h.charCodeAt(l);if((P0===d||P0===I||P0===N||P0===L)&&(X0--,X0===0)){j0=s;for(var N0=l;N0<h.length&&h.charCodeAt(N0)!==d;)N0++;Z0=N0+1;break}}else if(X0--,X0===0){j0=s,Z0=h.length;break}B0=s+1}}var Z9=!1;if(j0===-1&&V===6&&!m.isClosing){var k0=d$($,m.end,y0);if(k0!==-1){for(var Y0=I$,x=m.end,w0=!1,F0=!1,q9=!1,r9=0,R9=!1,O9=!1,U9=x;U9<Y0;){var H9=$.charCodeAt(U9);if(H9===L)O9&&(w0=!0),R9||r9++,O9=!0,U9++;else if(H9===I||H9===N)U9++;else{if(!R9&&(R9=!0,r9>=2&&H9===e)){q9=!0;break}if(O9=!1,H9===e){var C9=$.charCodeAt(U9+1)|32;if((C9===H$||C9===T$||C9===u9)&&(M6.lastIndex=U9,M6.test($))){F0=!0;break}}U9++}}if(w0&&!q9&&!F0){var Q$=J0($,k0);k=Q$,Q0=i($,Q$),h=$.slice(Y,k),D0=$.slice(Y,k),j0=Y0-Y,Z0=k0-Y,Z9=!0}}}}var D9=m.rawAttrs.indexOf(`
`)!==-1||m.whitespaceBeforeAttrs.indexOf(`
`)!==-1,J9=!1;if(j0!==-1){var Q9=h.slice(Z0).trim();J9=Q9.length===0}var X9=!1,n0=k,b0=Q0;if(j0!==-1){var w9=Y+Z0,F9=J0($,w9-1);if(w9<F9){for(var Y9=w9;Y9<F9&&($.charCodeAt(Y9)===I||$.charCodeAt(Y9)===N);)Y9++;if(Y9<F9&&$.charCodeAt(Y9)===e){var y9=P9($,Y9);y9&&!y9.isClosing&&(X9=!0,n0=w9,b0=w9,J9=!0)}}if(!X9){var i9=i($,F9);if(i9<k){for(var G9=i9;G9<k&&($.charCodeAt(G9)===I||$.charCodeAt(G9)===N);)G9++;if(G9<k&&$.charCodeAt(G9)===e){var l6=P9($,G9);l6&&(X9=!0,n0=F9,b0=i9,J9=!0)}}}if(!X9&&Z.inHTML){X9=!0,n0=F9,b0=i($,F9);var o6=$.slice(w9,F9).trim();J9=o6.length===0}}var a9=[],s0="";if(j0!==-1){s0=h.slice(m.end-Y,j0);var k9=s0.trim();if(k9){var{inline:r6,inHTML:i6,c:a6}=Z;Z.inHTML=!0,Z.c=z0+1;var n6=y0==="p";if(n6)Z.inline=!0,a9=h0(k9,0,k9.length,Z,Q);else{var r$=s0.indexOf(`

`)!==-1,i$=A6.test(k9),R$=v6.test(k9),s6=r$||i$||Z.inHTML&&R$,t6=s0.length>=2&&s0.charCodeAt(0)===L&&s0.charCodeAt(s0.length-1)===L&&!r$;t6&&!i$&&!R$?a9=[{type:_.text,text:k9}]:s6||R$?(Z.inline=!1,a9=N9(s0,Z,Q)):(Z.inline=!0,a9=h0(k9,0,k9.length,Z,Q))}Z.inline=r6,Z.inHTML=i6,Z.c=a6}}var a$=!1;if(V===6&&j0!==-1&&!Z.inHTML&&!D9){var w$=s0,e6=/<[a-zA-Z][^>]*>/.test(w$),$Z=/\n\n/.test(w$)||/^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(w$);e6&&!$Z&&(a$=!0)}var ZZ=!Z9&&(Z.inHTML||V===7||D9||!J9||a$);if(ZZ){var o0,n$=!1;if(j0!==-1&&X9){var s$=!1;if(Z.inHTML&&Z0<h.length){for(var F$=Z0;F$<h.length&&h.charCodeAt(F$)!==L;)F$++;var y$=h.slice(Z0,F$).trim();s$=y$.length>1&&y$.charCodeAt(0)===e&&y$.charCodeAt(1)!==H0}o0=s$?h.slice(m.end-Y):s0,n$=!0}else(V===7||Z.inHTML)&&j0!==-1?(o0=h.slice(m.end-Y),o0.charCodeAt(0)===L&&(o0=o0.slice(1))):X9?o0=$.slice(Y,n0):D9?o0=D0:(o0=h.slice(m.end-Y),o0.charCodeAt(0)===L&&(o0=o0.slice(1)));var t$={type:_.htmlBlock,tag:n,attrs:I9(m.attrs,n,Q),f:m.whitespaceBeforeAttrs+m.rawAttrs,children:a9,a:o0,text:o0,d:!0,b:!1,endPos:n0,e:V===6};return n$&&(t$.k=!0),{node:t$,end:b0}}return{node:{type:_.htmlBlock,tag:n,attrs:I9(m.attrs,n,Q),f:m.whitespaceBeforeAttrs+m.rawAttrs,children:a9,a:Z9?"":s0,text:s0,d:!1,b:!1,endPos:n0,e:V===6},end:b0}}var W$=D0.match(/^<(\/?)([a-zA-Z][a-zA-Z0-9-]*)/),JZ=W$?W$[2]:"div",e$=W$?W$[1]==="/":!1,k$=D0;if(e$){var $6=D0.indexOf(">");$6!==-1&&(k$=D0.slice($6+1))}return{node:{type:_.htmlBlock,tag:JZ,attrs:{},children:[],a:k$,text:k$,d:!0,b:e$,endPos:k,e:V===6},end:Q0}}var S0=P9($,Y);if(!S0)return null;var L9=S0.tag,L$=L9.toLowerCase(),Z6=L9.charCodeAt(0),z$=Z6>=p&&Z6<=c;if(!z$&&!_$.has(L$)&&!U$.has(L$)&&!L$.includes("-"))return null;if(S0.isClosing)return{node:{type:_.htmlSelfClosing,tag:L9,attrs:{},a:$.slice(Y,S0.end),b:!0,endPos:S0.end},end:S0.end};var VJ=!0,h9=d$($,S0.end,L9),X$=[];if(h9!==-1){var QZ=I$,O$=$.slice(S0.end,QZ),Y$=O$.trim();if(Y$){var XZ=O$.indexOf(`

`)!==-1,YZ=A6.test(Y$),GZ=v6.test(Y$),KZ=Z.inline,VZ=Z.inHTML,qZ=Z.c;Z.inHTML=!0,Z.c=(Z.c||0)+1,XZ||YZ||GZ?(Z.inline=!1,X$=N9(O$,Z,Q)):(Z.inline=!0,X$=h0(Y$,0,Y$.length,Z,Q)),Z.inline=KZ,Z.inHTML=VZ,Z.c=qZ}var UZ=J0($,h9),FZ=$.slice(h9,UZ).trim(),S$=FZ?h9:i($,h9),J6=z$?$.slice(Y,h9):$.slice(Y,S$),WZ=z$?h9:S$;return{node:{type:_.htmlBlock,tag:L9,attrs:I9(S0.attrs,L9,Q),f:S0.whitespaceBeforeAttrs+S0.rawAttrs,children:X$,a:J6,text:z$?O$:J6,d:!0,b:!1,endPos:WZ,e:!1},end:S$}}var n9=P6($,S0.end),zZ=n9<$.length?i($,n9):n9,E$=$.slice(S0.end,n9);if(E$.trim()){var{inline:OZ,inHTML:HZ,c:DZ}=Z;Z.inline=!1,Z.inHTML=!0,Z.c=(Z.c||0)+1,X$=N9(E$,Z,Q),Z.inline=OZ,Z.inHTML=HZ,Z.c=DZ}var jZ=$.slice(S0.end,n9);return{node:{type:_.htmlBlock,tag:L9,attrs:I9(S0.attrs,L9,Q),f:S0.whitespaceBeforeAttrs+S0.rawAttrs,children:X$,a:jZ,text:E$,d:!0,b:!1,endPos:n9,e:!1},end:zZ}}function gZ($,J){if($.charCodeAt(J)!==e)return 0;var Z=J+1,Q=$.length;if($.charCodeAt(Z)===E0&&$.charCodeAt(Z+1)===u&&$.charCodeAt(Z+2)===u)return 2;if($.charCodeAt(Z)===s9)return 3;if($.charCodeAt(Z)===E0){var X=$.charCodeAt(Z+1);if(X>=p&&X<=c)return 4;if($.slice(Z+1,Z+8)==="[CDATA[")return 5}for(var Y=$.charCodeAt(Z)===H0,K=Y?Z+1:Z,q=K;q<Q;){var V=$.charCodeAt(q);if(V>=p&&V<=c||V>=G0&&V<=q0||V>=o&&V<=r||V===u)q++;else break}if(q===K)return 0;var G=$.slice(K,q);if(U$.has(G.toLowerCase())){if(Y)return 0;var U=$.charCodeAt(q);return U===I||U===N||U===d||U===L||q>=Q?1:0}if(_$.has(G.toLowerCase())){if(Y){for(var F=q;F<Q&&($.charCodeAt(F)===I||$.charCodeAt(F)===N);)F++;return F<Q&&$.charCodeAt(F)===d?6:0}var O=q<Q?$.charCodeAt(q):-1;return O===I||O===N||O===d||O===L||O===H0||O===-1?6:0}if(Y){for(var W=q;W<Q&&($.charCodeAt(W)===I||$.charCodeAt(W)===N);)W++;if(W<Q&&$.charCodeAt(W)===d){var D=J0($,J),B=$.slice(W+1,D).trim();if(B==="")return 7}}else{var z=J0($,J),j=P9($,J);if(j&&j.end<=z){var H=$.slice(j.end,z).trim();if(H==="")return 7}}return 0}function b6($,J,Z){for(var Q=0,X=$.length;Q<X&&($.charCodeAt(Q)===I||$.charCodeAt(Q)===N);)Q++;for(;X>Q&&($.charCodeAt(X-1)===I||$.charCodeAt(X-1)===N);)X--;Q<X&&$.charCodeAt(Q)===I0&&Q++,X>Q&&$.charCodeAt(X-1)===I0&&(X-2<Q||$.charCodeAt(X-2)!==v0)&&X--;for(var Y=[],K=Q,q=!1,V=[],G=Q;G<X;){var U=$.charCodeAt(G);if(U===v0&&G+1<X){$.charCodeAt(G+1)===I0?(q||(q=!0,V=[]),V.push($.slice(K,G)),V.push("|"),G+=2,K=G):G+=2;continue}if(U===a){for(var F=0;G<X&&$.charCodeAt(G)===a;)F++,G++;for(var O=!1;G<X&&!O;){for(var z=0;G<X&&$.charCodeAt(G)===a;)z++,G++;z===F?O=!0:z===0&&G++}continue}if(U===I0){var j=q?(V.push($.slice(K,G)),V.join("")):$.slice(K,G);Y.push(j.trim()),G++,K=G,q=!1,V=[];continue}G++}var H=q?(V.push($.slice(K,X)),V.join("")):$.slice(K,X);return Y.push(H.trim()),Y.map(function(W){var D=W.indexOf("\\|")!==-1?W.replace(/\\\|/g,"|"):W;return h0(D,0,D.length,J,Z)})}function R6($,J,Z,Q){let X=J0($,J);var Y=$.indexOf("|",J);if(Y<0||Y>=X)return null;let K=i($,X);if(K>=$.length)return null;let q=J0($,K);if(!S6($,K,q))return null;let V=$.slice(J,X),G=$.slice(K,q);for(var U=[],F=0,O=G.length;F<O&&(G.charCodeAt(F)===I||G.charCodeAt(F)===N);)F++;for(F<O&&G.charCodeAt(F)===I0&&F++;F<O;){for(;F<O&&(G.charCodeAt(F)===I||G.charCodeAt(F)===N);)F++;if(F>=O||G.charCodeAt(F)===I0)break;var z=G.charCodeAt(F)===x0;for(z&&F++;F<O&&G.charCodeAt(F)===u;)F++;var j=F<O&&G.charCodeAt(F)===x0;for(j&&F++,U.push(z&&j?"center":j?"right":z?"left":null);F<O&&(G.charCodeAt(F)===I||G.charCodeAt(F)===N);)F++;F<O&&G.charCodeAt(F)===I0&&F++}let H=b6(V,Z,Q);if(U.length!==H.length)return null;let W=[],D=i($,q);for(;D<$.length;){let E=J0($,D),S=$.slice(D,E);if(c0($,D,E))break;if(A0($,D,E),$0<4){var B=$.charCodeAt(D+t);if(B===d||B===K9||(B===u||B===O0||B===V0)&&f9($,D))break;if(B===a||B===M0){for(var v=D+t,T=0;v<E&&$.charCodeAt(v)===B;)T++,v++;if(T>=3)break}}W.push(b6(S,Z,Q)),D=i($,E)}if((Q.streaming||Q.optimizeForStreaming)&&W.length===0)return null;for(var P=H.length,M=0;M<W.length;M++)if(W[M].length<P)for(;W[M].length<P;)W[M].push([]);else W[M].length>P&&(W[M].length=P);return{node:{type:_.table,header:H,cells:W,align:U},end:D}}function TZ($,J,Z){var Q=J0($,J);if(A0($,J,Q),$0>3)return null;var X=J+t;if($.charCodeAt(X)!==W0)return null;if(X+1<$.length&&$.charCodeAt(X+1)===r0){var Y=fZ($,X,Z);return Y||null}Z.refs||(Z.refs={});var K=x6($,X,Z.refs);return K===null?null:{node:{type:_.refCollection},end:K}}function fZ($,J,Z){var Q=$.length;if($.charCodeAt(J)!==W0||J+1>=Q||$.charCodeAt(J+1)!==r0)return null;for(var X=J+2,Y=X;X<Q&&$.charCodeAt(X)!==p0;){if($.charCodeAt(X)===L)return null;X++}if(X>=Q)return null;var K=("^"+$.slice(Y,X)).toLowerCase();if(X++,X>=Q||$.charCodeAt(X)!==x0)return null;for(X++;X<Q&&($.charCodeAt(X)===I||$.charCodeAt(X)===N);)X++;if(X<Q&&$.charCodeAt(X)===L)for(X++;X<Q&&($.charCodeAt(X)===I||$.charCodeAt(X)===N);)X++;var q=$.indexOf(`
`,X);q<0&&(q=Q);for(var V=$.slice(X,q).trim(),G=q<Q?q+1:Q;G<Q;){var U=J0($,G);if(A0($,G,U),$0>=2&&!c0($,G,U))V+=`
`+$.slice(G,U),G=i($,U);else if(c0($,G,U)){var F=i($,U);if(F<Q){var O=J0($,F);if(A0($,F,O),$0>=2){V+=`
`,G=i($,U);continue}}break}else break}return Z.refs[K]||(Z.refs[K]={target:V,title:void 0}),{node:{type:_.footnote},end:G}}function CZ($,J,Z,Q){let X=J,Y=0,K=0,q=-1;for(;X<$.length;){let w=q>=0?q:J0($,X);if(q=-1,c0($,X,w))break;if(A0($,X,w),$0<4&&K>0&&!Z.g){let g=$.charCodeAt(X+t);if(g===f0||g===u){let C=X+t;for(;C<w&&$.charCodeAt(C)===g;)C++;for(;C<w&&($.charCodeAt(C)===I||$.charCodeAt(C)===N);)C++;if(C>=w){Y=g===f0?1:2,X=i($,w);break}}}K=w;let y=i($,w);if(y<$.length){if($.charCodeAt(y)===t9){var V=J0($,y);X=i($,V),K=V;continue}let g=J0($,y);if(q=g,A0($,y,g),$0<4){let C=$.charCodeAt(y+t);if(C===d){X=y;break}if(C===K9&&C6($,y,Z,Q)){X=y;break}if(C===a||C===M0){for(var G=y+t,U=0;G<g&&$.charCodeAt(G)===C;)U++,G++;if(U>=3){X=y;break}}if(C===e){var F=y+t+1,O=F<g?$.charCodeAt(F):0,z=O===E0||O===s9;if(!z&&O===H0){for(var j=F+1,H=j;H<g&&($.charCodeAt(H)>=p&&$.charCodeAt(H)<=c||$.charCodeAt(H)>=G0&&$.charCodeAt(H)<=q0||$.charCodeAt(H)>=o&&$.charCodeAt(H)<=r||$.charCodeAt(H)===u);)H++;H>j&&(z=_$.has($.slice(j,H).toLowerCase()))}else if(!z){for(var W=F;W<g&&($.charCodeAt(W)>=p&&$.charCodeAt(W)<=c||$.charCodeAt(W)>=G0&&$.charCodeAt(W)<=q0||$.charCodeAt(W)>=o&&$.charCodeAt(W)<=r||$.charCodeAt(W)===u);)W++;if(W>F){var D=$.slice(F,W).toLowerCase();z=_$.has(D)||U$.has(D)}}if(z&&m6($,y,Z,Q)){X=y;break}}if(C===u||C===O0||C===A9){let f=y+t+1;if(f<g&&($.charCodeAt(f)===I||$.charCodeAt(f)===N)){var B=q$($,f,g);if(B<g&&!f9($,y)){X=y;break}}}if(C>=o&&C<=r){let f=y+t;for(;f<g&&$.charCodeAt(f)>=o&&$.charCodeAt(f)<=r;)f++;if(f<g&&($.charCodeAt(f)===d0||$.charCodeAt(f)===e0)&&f-(y+t)===1&&$.charCodeAt(y+t)===49){var v=f+1;if(v<g&&($.charCodeAt(v)===I||$.charCodeAt(v)===N)){var T=q$($,v,g);if(T<g){X=y;break}}}}if(C===I0){let f=i($,g);if(f<$.length){let k=J0($,f);if(S6($,f,k)){X=y;break}}}if((C===u||C===O0||C===V0)&&f9($,y)){if(C!==u){X=y;break}let f=0,k=y+t;for(;k<g&&$.charCodeAt(k)===u;)f++,k++;for(;k<g&&($.charCodeAt(k)===I||$.charCodeAt(k)===N);)k++;if(k<g){X=y;break}}}}X=i($,w)}for(var P=Y?K:X;P>J&&($.charCodeAt(P-1)===L||$.charCodeAt(P-1)===j9||$.charCodeAt(P-1)===I||$.charCodeAt(P-1)===N);)P--;for(var M=J;M<P&&($.charCodeAt(M)===I||$.charCodeAt(M)===N);)M++;if(M>=P)return null;for(var E=!1,S=M;S<P;S++)if($.charCodeAt(S)===t9){E=!0;break}var R=E?$.slice(M,P).replace(/\u001E/g,""):$.slice(M,P);if(!R)return null;let b=hZ(R,0,R.length,Z,Q);if(Y){let y=(Q?.slugify||a0)(R);return{node:{type:_.heading,level:Y,children:b,id:y},end:X}}return{node:{type:_.paragraph,children:b},end:X}}function hZ($,J,Z,Q,X){var Y=$.indexOf(`
`,J);if(Y<0||Y>=Z)return h0($,J,Z,Q,X);for(var K="",q=J,V=J;V<Z;){var G=$.charCodeAt(V);if(G===a){var U=N$($,V,Z);if(U>V){for(var F=!1,O=V;O<U;O++)if($.charCodeAt(O)===L){F=!0;break}F&&(K+=$.slice(q,V),K+=$.slice(V,U).replace(/\n/g," "),q=U),V=U;continue}}if(G===e){var z=u6($,V,Z);if(z>V){V=z;continue}}if(G===L){var j=!1,H=0;if(V>J&&$.charCodeAt(V-1)===v0)j=!0,H=1;else{for(var W=0,D=V-1;D>=J&&$.charCodeAt(D)===I;)W++,D--;W>=2&&(j=!0,H=W)}if(j)K+=$.slice(q,V-H),K+="";else{for(var B=V;B>q&&$.charCodeAt(B-1)===I;)B--;K+=$.slice(q,B)+`
`}for(V++;V<Z&&$.charCodeAt(V)===I;)V++;q=V;continue}V++}return q<Z&&(K+=$.slice(q,Z)),h0(K,0,K.length,Q,X)}function mZ($,J,Z){if($.charCodeAt(J)!==a)return null;let Q=b9($,J,Z,96),X=J+Q;for(;X<Z;){let Y=$.indexOf("`",X);if(Y<0||Y>=Z)return null;let K=b9($,Y,Z,96);if(K===Q){let q=$.slice(J+Q,Y);return q=q.replace(/\n/g," "),q.length>0&&q[0]===" "&&q[q.length-1]===" "&&q.trim().length>0&&(q=q.slice(1,-1)),{node:{type:_.codeInline,text:q},end:Y+K}}X=Y+K}return null}function N$($,J,Z){if($.charCodeAt(J)!==a)return J;let Q=b9($,J,Z,96),X=J+Q;for(;X<Z;){let Y=$.indexOf("`",X);if(Y<0||Y>=Z)return J;let K=b9($,Y,Z,96);if(K===Q)return Y+K;X=Y+K}return J}function u6($,J,Z){if($.charCodeAt(J)!==e)return J;if(J+1<Z&&$.charCodeAt(J+1)===H0){let G=J+2;for(;G<Z&&$.charCodeAt(G)!==d;)G++;return G<Z?G+1:J}if(J+3<Z&&$.charCodeAt(J+1)===E0&&$.charCodeAt(J+2)===u&&$.charCodeAt(J+3)===u){let G=$.indexOf("-->",J+4);return G>=0?G+3:J}let Q=J+1,X=Q;for(;Q<Z;){let G=$.charCodeAt(Q);if(G>=p&&G<=c||G>=G0&&G<=q0||G>=o&&G<=r||G===u)Q++;else break}if(Q===X)return J;let Y=$.slice(X,Q).toLowerCase(),K=!1;for(;Q<Z;){let G=$.charCodeAt(Q);if(G===d){Q++;break}if(G===H0&&Q+1<Z&&$.charCodeAt(Q+1)===d){Q+=2,K=!0;break}if(G===M9||G===S9){var q=G;for(Q++;Q<Z&&$.charCodeAt(Q)!==q;)Q++;Q<Z&&Q++;continue}if(G===L)return J;Q++}if(K||l9(Y))return Q;let V=1;for(;Q<Z&&V>0;)if($.charCodeAt(Q)===e)if(Q+1<Z&&$.charCodeAt(Q+1)===H0){let G=Q+2,U=G;for(;U<Z&&($.charCodeAt(U)>=p&&$.charCodeAt(U)<=c||$.charCodeAt(U)>=G0&&$.charCodeAt(U)<=q0);)U++;if($.slice(G,U).toLowerCase()===Y){for(;U<Z&&$.charCodeAt(U)!==d;)U++;if(U<Z&&U++,V--,V===0)return U}Q=U}else{let G=Q+1,U=G;for(;U<Z&&($.charCodeAt(U)>=p&&$.charCodeAt(U)<=c||$.charCodeAt(U)>=G0&&$.charCodeAt(U)<=q0);)U++;$.slice(G,U).toLowerCase()===Y&&V++,Q++}else Q++;return Q}function uZ($,J,Z,Q,X){if($.charCodeAt(J)!==M0||J+1>=Z||$.charCodeAt(J+1)!==M0)return null;let Y=J+2;for(;Y+1<Z;){let K=$.charCodeAt(Y);if(K===a){let q=N$($,Y,Z);if(q>Y){Y=q;continue}}if(K===M0&&$.charCodeAt(Y+1)===M0){let q=$.slice(J+2,Y),V=h0(q,0,q.length,Q,X);return{node:{type:_.textFormatted,tag:"del",children:V},end:Y+2}}K===v0&&Y+1<Z&&Y++,Y++}return null}function pZ($,J,Z,Q,X){if($.charCodeAt(J)!==f0||J+1>=Z||$.charCodeAt(J+1)!==f0)return null;let Y=J+2;for(;Y+1<Z;){let K=$.charCodeAt(Y);if(K===a){let q=N$($,Y,Z);if(q>Y){Y=q;continue}}if(K===f0&&$.charCodeAt(Y+1)===f0&&Y>J+2){let q=$.slice(J+2,Y),V=h0(q,0,q.length,Q,X);return{node:{type:_.textFormatted,tag:"mark",children:V},end:Y+2}}K===v0&&Y+1<Z&&Y++,Y++}return null}function w6($,J,Z){return $<e9?!!(o$($)&d9):H6.test(J[Z])}function y6($,J,Z){return $<e9?!!(o$($)&v9):D6.test(J[Z])}function dZ($,J,Z){var Q=$.charCodeAt(J);if(Q!==O0&&Q!==V0)return null;var X=b9($,J,Z,Q);if(X===0)return null;var Y=J>0?$.charCodeAt(J-1):32,K=J+X<Z?$.charCodeAt(J+X):32,q=y6(Y,$,J-1),V=y6(K,$,J+X),G=J>0?w6(Y,$,J-1):!1,U=J+X<Z?w6(K,$,J+X):!1,F=!V&&(!U||q||G),O=!q&&(!G||V||U),z,j;return Q===O0?(z=F,j=O):(z=F&&(!O||G),j=O&&(!F||U)),{len:X,canOpen:z,canClose:j}}function cZ($,J,Z,Q){if(J.length!==0){for(var X=[],Y=0;Y<12;Y++)X[Y]=-1;for(var K=0;K<J.length;){var q=J[K];if(!q.active||!q.canClose){K++;continue}for(var V=q.ch===O0?0:1,G=V*6+q.len%3*2+(q.canOpen?1:0),U=X[G]!==void 0?X[G]:-1,F=-1,O=K-1;O>U;O--){var z=J[O];if(!(!z.active||z.ch!==q.ch||!z.canOpen)&&!((q.canOpen||z.canClose)&&(z.len+q.len)%3===0&&z.len%3!==0)){F=O;break}}if(F<0){X[G]=K-1,!q.canOpen&&(q.active=!1),K++;continue}var j=J[F],H=j.len>=2&&q.len>=2,W=H?2:1;j.len-=W,q.len-=W;var D=$[j.idx],B=$[q.idx];D.text=D.text.slice(0,D.text.length-W),B.text=B.text.slice(W);var v=j.idx+1,T=q.idx,P=$.slice(v,T),M={type:_.textFormatted,tag:H?"strong":"em",children:P};$.splice(v,T-v,M);for(var E=T-v-1,S=0;S<J.length;S++)J[S].idx>j.idx&&(J[S].idx-=E);for(var R=F+1;R<K;R++)J[R].active=!1;if(j.len===0&&(j.active=!1,D.text==="")){$.splice(j.idx,1);for(var b=0;b<J.length;b++)J[b].idx>j.idx?J[b].idx--:J[b].idx===j.idx&&(J[b].idx=-1)}if(q.len===0){q.active=!1;var w=q.idx;if(B.text===""){$.splice(w,1);for(var y=0;y<J.length;y++)J[y].idx>w?J[y].idx--:J[y].idx===w&&(J[y].idx=-1)}}else continue;K++}for(var g=0,C=0;C<$.length;C++){var f=$[C];if(f.type===_.text){var k=f;if(k.text==="")continue;if(g>0&&$[g-1].type===_.text){$[g-1].text+=k.text;continue}}$[g++]=f}$.length=g}}function k6($,J,Z,Q,X){let Y=$.charCodeAt(J)===E0,K=Y?J+1:J;if($.charCodeAt(K)!==W0)return null;var q=$.indexOf("]",K+1);if(q<0||q>=Z)return null;for(var V=K+1,G=-1,U=1;V<Z&&U>0;){var F=$.charCodeAt(V);if(F===v0&&V+1<Z){V+=2;continue}if(F===a){var O=N$($,V,Z);if(O>V){V=O;continue}}if(F===e){var z=p6($,V,Z);if(z){V=z.end;continue}var j=u6($,V,Z);if(j>V){V=j;continue}}F===W0?U++:F===p0&&U--,V++}if(U!==0)return null;var H=V-1,W=$.slice(K+1,H),D=V<Z?$.charCodeAt(V):0,B=!1;if(D===t0){var v=!0;for(V++;V<Z&&($.charCodeAt(V)===I||$.charCodeAt(V)===L);)V++;var T="",P=V;if(V<Z&&$.charCodeAt(V)===e){for(V++,P=V;P<Z&&$.charCodeAt(P)!==d;){if($.charCodeAt(P)===v0&&P+1<Z){P+=2;continue}if($.charCodeAt(P)===L){v=!1;break}P++}v&&(P>=Z||$.charCodeAt(P)!==d)&&(v=!1),v&&(T=$.slice(V,P),P++)}else if(v){for(var M=0;P<Z;){var E=$.charCodeAt(P);if(E===v0&&P+1<Z){P+=2;continue}if(E===t0)M++;else if(E===e0){if(M===0)break;M--}else if(E===I||E===L)break;P++}T=$.slice(V,P)}if(v){for(V=P;V<Z&&($.charCodeAt(V)===I||$.charCodeAt(V)===L);)V++;var S;if(V<Z){var R=$.charCodeAt(V);if(R===M9||R===S9||R===t0){var b=R===t0?41:R;V++;for(var w=V;V<Z&&$.charCodeAt(V)!==b;)$.charCodeAt(V)===v0&&V+1<Z&&V++,V++;V>=Z?v=!1:(S=$.slice(w,V),V++)}}if(v){for(;V<Z&&($.charCodeAt(V)===I||$.charCodeAt(V)===L);)V++;(V>=Z||$.charCodeAt(V)!==e0)&&(v=!1)}}if(v){V++,T=J$(T),S!==void 0&&(S=M$(J$(S)));var y=X?.sanitizer||c9,g=y(T,Y?"img":"a",Y?"src":"href"),C=g===null?null:T;if(Y){var f=h0(W,0,W.length,Q,X),k=P$(f);return{node:{type:_.image,target:C,alt:k,title:S},end:V}}else{var D0=Q.inAnchor;Q.inAnchor=!0;var Q0=D0?[{type:_.text,text:W}]:h0(W,0,W.length,Q,X);return Q.inAnchor=D0,!Q.inAnchor&&c$(Q0)?null:{node:{type:_.link,target:C,title:S,children:Q0},end:V}}}else V=H+1,B=!0}var m="",n=V;if(!B&&D===W0){var y0=V+1;n=y0;for(var l0=!1;n<Z&&$.charCodeAt(n)!==p0;){if($.charCodeAt(n)===v0&&n+1<Z){n+=2;continue}if($.charCodeAt(n)===W0){l0=!0;break}n++}if(l0||n>=Z)return null;var u0=$.slice(y0,n);if(u0.trim())m=A$(u0);else{if(I6(W))return null;m=A$(W)}n=n+1}else{if(I6(W))return null;m=A$(W)}var z0=Q.refs[m];if(!z0)return null;if(Y)return{node:{type:_.image,target:z0.target,alt:P$(h0(W,0,W.length,Q,X)),title:z0.title},end:n};var h=Q.inAnchor;Q.inAnchor=!0;var Q0=h?[{type:_.text,text:W}]:h0(W,0,W.length,Q,X);return Q.inAnchor=h,!Q.inAnchor&&c$(Q0)?null:{node:{type:_.link,target:z0.target,title:z0.title,children:Q0},end:n}}function p6($,J,Z){if($.charCodeAt(J)!==e)return null;for(var Q=J+1;Q<Z;){var X=$.charCodeAt(Q);if(X===d)break;if(X===I||X===L||X===j9||X===e)return null;Q++}if(Q>=Z||$.charCodeAt(Q)!==d)return null;var Y=$.slice(J+1,Q),K=Y.match(/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^\x00-\x20]*)$/);return K?{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 lZ($,J,Z,Q){if($.charCodeAt(J)!==W0||J+1>=Z||$.charCodeAt(J+1)!==r0)return null;let X=J+2;for(;X<Z&&$.charCodeAt(X)!==p0&&$.charCodeAt(X)!==L;)X++;if(X>=Z||$.charCodeAt(X)!==p0)return null;let Y=$.slice(J+2,X);return Y?{node:{type:_.footnoteReference,target:"#"+a0(Y),text:Y},end:X+1}:null}function oZ($,J,Z,Q){if(Q.disableBareUrls)return null;var X="",Y=!1,K=$.charCodeAt(J);if(K===m9||K===72?J+8<=Z&&$.charCodeAt(J+1)===u9&&$.charCodeAt(J+2)===u9&&$.charCodeAt(J+3)===H$&&($.charCodeAt(J+4)===T$&&$.charCodeAt(J+5)===x0&&$.charCodeAt(J+6)===H0&&$.charCodeAt(J+7)===H0?X="https://":$.charCodeAt(J+4)===x0&&$.charCodeAt(J+5)===H0&&$.charCodeAt(J+6)===H0&&(X="http://")):K===B9||K===70?J+6<=Z&&$.charCodeAt(J+1)===u9&&$.charCodeAt(J+2)===H$&&$.charCodeAt(J+3)===x0&&$.charCodeAt(J+4)===H0&&$.charCodeAt(J+5)===H0&&(X="ftp://"):(K===W9||K===87)&&J+4<=Z&&$.charCodeAt(J+1)===W9&&$.charCodeAt(J+2)===W9&&$.charCodeAt(J+3)===d0&&(X="www.",Y=!0),!X)return null;let q=J+X.length;for(;q<Z;){let M=$.charCodeAt(q);if(M===I||M===L||M===N||M===j9||M===e||M===d)break;q++}for(var V=0,G=0,U=J;U<q;U++){var F=$.charCodeAt(U);F===t0?V++:F===e0&&G++}let O=q;for(;O>J+X.length;){let M=$.charCodeAt(O-1);if(M===d0||M===Y6||M===x0||M===E0||M===s9||M===e0||M===O0||M===V0||M===M0){if(M===e0){if(V>=G)break;G--}O--}else if(M===f$){for(var z=O-2;z>J&&($.charCodeAt(z)>=p&&$.charCodeAt(z)<=c||$.charCodeAt(z)>=G0&&$.charCodeAt(z)<=q0||$.charCodeAt(z)>=o&&$.charCodeAt(z)<=r);)z--;z>=J&&$.charCodeAt(z)===x$?O=z:O--}else break}if(O<=J+X.length)return null;var j=J+(Y?4:X.length),H=$.indexOf("/",j);if((H<0||H>O)&&(H=O),Y&&$.indexOf(".",j)===-1)return null;for(var W=-1,D=-1,B=H-1;B>=j;B--)if($.charCodeAt(B)===d0)if(W<0)W=B;else{D=B;break}for(var v=D>=0?D+1:j,B=v;B<H;B++)if($.charCodeAt(B)===V0)return null;var T=$.slice(J,O),P=Y?"http://"+T:T;return{node:{type:_.link,target:P,title:void 0,children:[{type:_.text,text:T}]},end:O}}function rZ($,J,Z,Q){if(Q.disableBareUrls)return null;for(var X=J,Y=X;X<Z;){var K=$.charCodeAt(X);if(K>=p&&K<=c||K>=G0&&K<=q0||K>=o&&K<=r||K===d0||K===E0||K===K9||K===36||K===G$||K===x$||K===S9||K===O0||K===A9||K===H0||K===f0||K===s9||K===r0||K===V0||K===a||K===E9||K===I0||K===D$||K===M0||K===u)X++;else break}if(X===Y||X>=Z||$.charCodeAt(X)!==K$)return null;X++;for(var q=X,V=-1,G=X;X<Z;){var K=$.charCodeAt(X);if(K>=p&&K<=c||K>=G0&&K<=q0||K>=o&&K<=r)X++;else if((K===u||K===V0)&&X>q)X++;else if(K===d0){if(X===q)break;var U=$.charCodeAt(X-1);if(U===u||U===V0||X-G>63)break;if(X+1<Z){var F=$.charCodeAt(X+1);if(F>=p&&F<=c||F>=G0&&F<=q0||F>=o&&F<=r)V=X,G=X+1,X++;else break}else break}else break}if(X-G>63||V<0)return null;var O=$.charCodeAt(X-1);if(!(O>=p&&O<=c||O>=G0&&O<=q0||O>=o&&O<=r)||X<=V+1)return null;for(var z=-1,j=V-1;j>=q;j--)if($.charCodeAt(j)===d0){z=j;break}for(var H=z>=0?z+1:q,j=H;j<X;j++)if($.charCodeAt(j)===V0)return null;var W=$.slice(J,X);return{node:{type:_.link,target:"mailto:"+W,title:void 0,children:[{type:_.text,text:W}]},end:X}}function c$($){for(var J=0;J<$.length;J++)if($[J].type===_.link||"children"in $[J]&&Array.isArray($[J].children)&&c$($[J].children))return!0;return!1}function P$($){for(var J="",Z=0;Z<$.length;Z++){var Q=$[Z];Q.type===_.text?J+=Q.text:Q.type===_.breakLine?J+=" ":Q.type===_.codeInline?J+=Q.text:"children"in Q&&Array.isArray(Q.children)?J+=P$(Q.children):Q.type===_.image?J+=Q.alt||"":Q.type===_.link&&(J+=P$(Q.children))}return J}function o9($){let J=$.includes("&")?M$($):$;return{type:_.text,text:J}}function iZ($,J,Z,Q,X){if($.charCodeAt(J)!==e)return null;var Y=J+1;if(Y>=Z)return null;var K=$.charCodeAt(Y);if(K===E0&&Y+1<Z&&$.charCodeAt(Y+1)===u&&Y+2<Z&&$.charCodeAt(Y+2)===u){var q=Y+3;if(q<Z&&$.charCodeAt(q)===d)return{node:{type:_.htmlComment,text:"",h:!0},end:q+1};if(q+1<Z&&$.charCodeAt(q)===u&&$.charCodeAt(q+1)===d)return{node:{type:_.htmlComment,text:"-",h:!0},end:q+2};var V=$.indexOf("-->",q);return V!==-1&&V<=Z-3?{node:{type:_.htmlComment,text:$.slice(J+4,V),h:!1},end:V+3}:null}if(K===s9){var G=$.indexOf("?>",Y+1);return G!==-1&&G<Z?{node:{type:_.htmlSelfClosing,tag:"?",attrs:{},a:$.slice(J,G+2),b:!1},end:G+2}:null}if(K===E0&&Y+1<Z){var U=$.charCodeAt(Y+1);if(U===W0&&$.slice(Y+1,Y+8)==="[CDATA["){var F=$.indexOf("]]>",Y+8);return F!==-1&&F<Z?{node:{type:_.htmlSelfClosing,tag:"![CDATA[",attrs:{},a:$.slice(J,F+3),b:!1},end:F+3}:null}if(U>=p&&U<=c){var O=$.indexOf(">",Y+2);return O!==-1&&O<Z?{node:{type:_.htmlSelfClosing,tag:"!"+$.slice(Y+1,O),attrs:{},a:$.slice(J,O+1),b:!1},end:O+1}:null}}if(K===H0){var z=Y+1;if(z>=Z)return null;var j=$.charCodeAt(z);if(!(j>=p&&j<=c||j>=G0&&j<=q0))return null;for(z++;z<Z;){var H=$.charCodeAt(z);if(H>=p&&H<=c||H>=G0&&H<=q0||H>=o&&H<=r||H===u)z++;else break}for(;z<Z&&($.charCodeAt(z)===I||$.charCodeAt(z)===N||$.charCodeAt(z)===L);)z++;if(z<Z&&$.charCodeAt(z)===d){var W=$.slice(Y+1,z).trim();return{node:{type:_.htmlSelfClosing,tag:W,attrs:{},a:$.slice(J,z+1),b:!0},end:z+1}}return null}if(!(K>=p&&K<=c||K>=G0&&K<=q0))return null;var D=P9($,J);if(!D)return null;var B=D.tag,v=B.toLowerCase(),T=D.selfClosing;if(T||l9(B))return{node:{type:_.htmlSelfClosing,tag:B,attrs:I9(D.attrs,B,X),a:$.slice(J,D.end),b:!1},end:D.end};var P=U$.has(v),M=d$($.slice(0,Z),D.end,B);if(M===-1)return{node:{type:_.htmlSelfClosing,tag:B,attrs:I9(D.attrs,B,X),a:$.slice(J,D.end),b:!1},end:D.end};var E=xZ($,"</"+v,M),S=$.slice(D.end,E),R=[];if(P)S.trim()&&(R=[{type:_.text,text:S}]);else{var b=S.trim();if(b){var{inAnchor:w,inline:y}=Q;v==="a"&&(Q.inAnchor=!0);var g=b.indexOf(`

`)!==-1||/^#{1,6}\s/.test(b);g?(Q.inline=!1,R=N9(b,Q,X)):R=h0(b,0,b.length,Q,X),Q.inAnchor=w,Q.inline=y}}return{node:{type:_.htmlBlock,tag:B,attrs:I9(D.attrs,B,X),f:D.rawAttrs,children:R,a:void 0,text:S,d:!1,b:!1,endPos:M,e:!1},end:M}}var aZ=200,Z$=0;function h0($,J,Z,Q,X){if(Z$++,Z$>aZ)return Z$--,[{type:_.text,text:$.slice(J,Z)}];let Y=Q;if(X.streaming||X.optimizeForStreaming){let Z9=function(Y0,x){for(var w0=1,F0=x+1;F0<Y0.length;F0++){var q9=Y0.charCodeAt(F0);if(q9===W0)w0++;else if(q9===p0&&(w0--,w0===0))return F0}return-1},A=$.slice(J,Z),l=A;for(var K=0,q=0,V=0,G=0,U=0,F=-1,O=-1,z=-1,j=-1,H=-1,W=0;W<A.length;W++){var D=A.charCodeAt(W);D===O0?W+1<A.length&&A.charCodeAt(W+1)===O0?(K++,F=W,W++):(q++,O=W):D===V0?W+1<A.length&&A.charCodeAt(W+1)===V0?(V++,z=W,W++):(G++,j=W):D===M0&&W+1<A.length&&A.charCodeAt(W+1)===M0&&(U++,H=W,W++)}var B=[];U%2===1&&H>=0&&B.push([H,2]),V%2===1&&z>=0&&B.push([z,2]),G%2===1&&j>=0&&B.push([j,1]),K%2===1&&F>=0&&B.push([F,2]),q%2===1&&O>=0&&B.push([O,1]),B.sort(function(Y0,x){return x[0]-Y0[0]});for(var v=0;v<B.length;v++){var T=B[v][0],P=B[v][1];A=A.slice(0,T)+A.slice(T+P)}let P0=0,N0=-1;for(let Y0=0;Y0<A.length;Y0++)A.charCodeAt(Y0)===a&&(P0++,N0=Y0);if(P0%2===1&&N0!==-1){let Y0=!1,x=-1,w0=0;for(;w0<A.length;)A.charCodeAt(w0)===a&&(Y0?(Y0=!1,x=-1):(x=w0,Y0=!0)),w0++;Y0&&x!==-1&&(A=A.slice(0,x))}for(var M=!0;M;){M=!1;for(var E=-1,S=-1,R=-1,b=!1,w=0;w<A.length;w++){var y=A.charCodeAt(w);if(y===W0&&(w===0||A.charCodeAt(w-1)!==v0)){var g=w>0&&A.charCodeAt(w-1)===E0,C=g?w-1:w,f=Z9(A,w);if(f===-1)E=C,b=g,S=w+1,R=A.length;else{var k=f+1;if(k>=A.length)E=C,b=g,S=w+1,R=f;else if(A.charCodeAt(k)===t0){var D0=A.indexOf(")",k+1);D0===-1?(E=C,b=g,S=w+1,R=f,w=A.length):w=D0}else if(A.charCodeAt(k)===W0){var Q0=A.indexOf("]",k+1);Q0===-1?(E=C,b=g,S=w+1,R=f,w=A.length):w=Q0}else w=f}}}if(E>=0){var m=b?"":A.slice(S,R);A=A.slice(0,E)+m,M=!0}}let k0=A.match(/<([A-Z][A-Za-z0-9]*)(?:\s[^>]*)?>([^<]*)$/);if(k0&&k0.index!==void 0){var n=k0[0].length-k0[2].length,y0=n>=2&&k0[0].charCodeAt(n-2)===H0;if(!y0){for(var l0=!1,u0=0,z0=0;z0<k0.index;z0++)A.charCodeAt(z0)===a&&u0++;if(l0=u0%2===1,!l0){let Y0=k0[1];T9(A,"</"+Y0,0)===-1&&(A=A.replace(/<[A-Z][A-Za-z0-9]*(?:\s[^>]*)?>([^<]*)$/,"$1"))}}}A!==l&&($=$.slice(0,J)+A,Z=J+A.length)}let h=[];var j0=[];let Z0=J;var K0=X.disableAutoLink||X.disableBareUrls||Y.inAnchor?-1:$.indexOf("@",J);for(K0>=Z&&(K0=-1);J<Z;){let A=$.charCodeAt(J),l=null;if(A===a){if(l=mZ($,J,Z),!l){var V9=b9($,J,Z,a);J+=V9-1}}else if(A===O0||A===V0){var X0=dZ($,J,Z);if(X0){if(X0.canOpen||X0.canClose){J>Z0&&h.push(o9($.slice(Z0,J)));var B0=$.slice(J,J+X0.len),_0=o9(B0);j0.push({idx:h.length,ch:A,len:X0.len,canOpen:X0.canOpen,canClose:X0.canClose,active:!0}),h.push(_0),J+=X0.len,Z0=J;continue}J+=X0.len-1}}else if(A===M0)l=uZ($,J,Z,Y,X);else if(A===f0)l=pZ($,J,Z,Y,X);else if(A===W0)J+1<Z&&$.charCodeAt(J+1)===r0&&(l=lZ($,J,Z,Y)),l||(l=k6($,J,Z,Y,X));else if(A===E0&&J+1<Z&&$.charCodeAt(J+1)===W0)l=k6($,J,Z,Y,X);else if(A===e)l=p6($,J,Z),!l&&!X.disableParsingRawHTML&&!X.ignoreHTMLBlocks&&(l=iZ($,J,Z,Y,X));else if((A===m9||A===W9||A===B9)&&!Y.inAnchor&&!X.disableAutoLink&&(J===0||$.charCodeAt(J-1)!==e)){var s=J+1<Z?$.charCodeAt(J+1):0;(A===m9&&s===u9||A===B9&&s===u9||A===W9&&s===W9)&&(l=oZ($,J,Z,X))}if(!l&&K0>=0&&K0-J<=64&&!Y.inAnchor&&!X.disableAutoLink&&!X.disableBareUrls&&(A>=p&&A<=c||A>=G0&&A<=q0||A>=o&&A<=r)&&(l=rZ($,J,Z,X),!l&&J>=K0&&(K0=$.indexOf("@",J+1),K0>=Z&&(K0=-1))),A===j$){J>Z0&&h.push(o9($.slice(Z0,J))),h.push({type:_.breakLine}),J++,Z0=J;continue}if(l)J>Z0&&h.push(o9($.slice(Z0,J))),h.push(l.node),J=l.end,Z0=J;else{if(A===v0&&J+1<Z){let P0=$.charCodeAt(J+1);if(o$(P0)&d9){J>Z0&&h.push(o9($.slice(Z0,J))),h.push(o9($[J+1])),J+=2,Z0=J;continue}}if(J++,K0<0||K0-J>64)for(;J<Z;){var U0=$.charCodeAt(J);if(U0<e9&&!L6[U0])J++;else break}}}if(Z>Z0){let A=$.slice(Z0,Z);A&&h.push(o9(A))}return j0.length>0&&cZ(h,j0,Q,X),Z$--,h}var nZ=500;function N9($,J,Z){var Q=J.i||0;if(Q>nZ)return[{type:_.text,text:$}];J.i=Q+1;let X=J;if((Z.streaming||Z.optimizeForStreaming)&&!J.j){var Y=$.length;Y>0&&$.charCodeAt(Y-1)===L&&Y--;for(var K=Y;K>0&&$.charCodeAt(K-1)!==L;)K--;if(K>0&&$.charCodeAt(K)===I0){for(var q=!0,V=K;V<Y;V++){var G=$.charCodeAt(V);if(G!==I&&G!==N&&G!==u&&G!==x0&&G!==I0){q=!1;break}}if(q){for(var U=K-1;U>0&&$.charCodeAt(U-1)!==L;)U--;$.charCodeAt(U)===I0&&($=$.slice(0,U).trimEnd())}}var F=$.trim(),O=F.lastIndexOf(`
`),z=O===-1?F:F.slice(O+1);if(z.length>0&&z.charCodeAt(0)===I0){for(var j=!1,H=!1,W=1;W<z.length;W++){var D=z.charCodeAt(W);D===I0&&(j=!0),D===u&&(H=!0)}j&&H&&($=O===-1?"":$.slice(0,$.lastIndexOf(z)).trimEnd())}for(var B=-1,v=-1,T=-1,P=$.length-1;P>=0;P--)if($.charCodeAt(P)===e){var M=P+1<$.length?$.charCodeAt(P+1):0;if(M>=p&&M<=c||M>=G0&&M<=q0){for(var E=P+2;E<$.length;){var S=$.charCodeAt(E);if(S>=p&&S<=c||S>=G0&&S<=q0||S>=o&&S<=r)E++;else break}for(var R=E;R<$.length&&$.charCodeAt(R)!==d;)R++;if(R<$.length&&$.charCodeAt(R-1)!==H0){for(var b=!1,w=R+1;w<$.length;w++)if($.charCodeAt(w)===e){b=!0;break}b||(B=P,v=E,T=R+1)}}break}if(B>=0){for(var y=0,g=0;g<B;g++)$.charCodeAt(g)===a&&y++;if(y%2===0){var C=$.slice(B+1,v);T9($,"</"+C,0)===-1&&($=$.slice(0,B)+$.slice(T))}}for(var f=$.length;f>0&&$.charCodeAt(f-1)===L;)f--;if(f>0){for(var k=f;k>0&&$.charCodeAt(k-1)!==L;)k--;for(var D0=k,Q0=0;D0<f&&$.charCodeAt(D0)===I&&Q0<3;)D0++,Q0++;if(k>0&&D0<f&&yZ($,D0,f)){for(var m=k-1,n=m;n>0&&$.charCodeAt(n-1)!==L;)n--;c0($,n,m)||($=$.slice(0,k).trimEnd())}}var y0=$.length;if(y0>0){for(var l0=$.lastIndexOf(`
`),u0=l0===-1?0:l0+1,z0=y0,h=u0,j0=0;h<z0&&$.charCodeAt(h)===I&&j0<3;)h++,j0++;if(h<z0){var Z0=$.charCodeAt(h),K0=!1;if(Z0===O0||Z0===u||Z0===A9){var V9=h+1;if(V9>=z0||$.charCodeAt(V9)===I||$.charCodeAt(V9)===N){for(var X0=V9;X0<z0&&($.charCodeAt(X0)===I||$.charCodeAt(X0)===N);)X0++;X0>=z0&&(K0=!0)}}else if(Z0>=o&&Z0<=r){for(var B0=h;B0<z0&&$.charCodeAt(B0)>=o&&$.charCodeAt(B0)<=r;)B0++;if(B0<z0&&($.charCodeAt(B0)===d0||$.charCodeAt(B0)===e0)){var _0=B0+1;if(_0>=z0||$.charCodeAt(_0)===I||$.charCodeAt(_0)===N){for(var s=_0;s<z0&&($.charCodeAt(s)===I||$.charCodeAt(s)===N);)s++;s>=z0&&(K0=!0)}}}K0&&($=$.slice(0,u0).trimEnd())}}}if(J.inline)return h0($,0,$.length,J,Z);let U0=[],A=0,l=$.length;if(A===0&&!Z.disableFrontmatter&&$.startsWith("---")){let x=W6($);if(x&&x.hasValidYaml){if(Z.preserveFrontmatter!==!1){let w0=$.slice(0,x.endPos).trimEnd();U0.push({type:_.frontmatter,text:w0})}A=x.endPos}}for(;A<l;){for(var P0=$.indexOf(`
`,A),N0=P0<0?l:P0;A<l&&c0($,A,N0);)A=N0<l?N0+1:N0,A<l&&(P0=$.indexOf(`
`,A),N0=P0<0?l:P0);if(A>=l)break;$.charCodeAt(A),A0($,A,N0);let x=null;if(g6=$,T6=A,f6=N0,$.charCodeAt(A)!==t9&&$0>=4&&!J.inHTML)x=LZ($,A);else if($.charCodeAt(A)!==t9){let w0=A+t,F0=$.charCodeAt(w0);F0===K9?x=C6($,A,J,Z):F0===d?x=SZ($,A,J,Z):F0===a||F0===M0?x=kZ($,A,J):F0===u||F0===O0||F0===V0?(x=f9($,A),!x&&(x=N6($,A,J,Z))):F0===A9||F0>=o&&F0<=r?x=N6($,A,J,Z):F0===e?x=m6($,A,J,Z):F0===I0?x=R6($,A,J,Z):F0===W0&&(x=TZ($,A,J))}if(!x){for(var Z9=!1,k0=A;k0<N0;k0++)if($.charCodeAt(k0)===I0){Z9=!0;break}Z9&&(x=R6($,A,J,Z))}if(x||(x=CZ($,A,J,Z)),x)x.node.type!==_.refCollection&&U0.push(x.node),A=x.end;else{var Y0=$.indexOf(`
`,A);A=Y0<0?l:Y0+1}}return J.i=Q,U0}function sZ($,J){Z$=0,$.charCodeAt(0)===65279&&($=$.slice(1)),$=h$($);let Z={inline:!1,inAnchor:!1,inHTML:!1,inList:!1,inBlockQuote:!1,refs:{}},Q={...J,slugify:J?.slugify?Y=>J.slugify(Y,a0):a0,sanitizer:J?.sanitizer||c9,tagfilter:J?.tagfilter!==!1};Z.j=E6($,Z.refs,Q);let X=N9($,Z,Q);return Z.refs&&Object.keys(Z.refs).length>0?[{type:_.refCollection,refs:Z.refs},...X]:X}function bJ($,J,Z,Q){var X=P9($,J);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 b$($,J,Z){Z$=0,$=h$($),!J.refs&&(J.refs={}),J.j=E6($,J.refs,Z);let Q=N9($,J,Z);return J.refs&&Object.keys(J.refs).length>0?[{type:_.refCollection,refs:J.refs},...Q]:Q}var $J=/^\n+/,c6=z9.createContext(void 0);function ZJ($,J,Z,Q,X,Y,K,q){let V=q.styles||{};switch($.type){case _.blockQuote:{let G=$;return Q(L0,{key:Z.key,style:V.blockquote},J(G.children,Z))}case _.breakLine:return`
`;case _.breakThematic:return Q(L0,{key:Z.key,style:V.thematicBreak});case _.frontmatter:if(q.preserveFrontmatter){let G=$;return Q(g0,{key:Z.key,style:V.codeBlock},G.text)}return null;case _.codeBlock:{let G=$;return Q(L0,{key:Z.key,style:V.codeBlock},Q(g0,{style:V.codeInline},G.text))}case _.codeInline:{let G=$;return Q(g0,{key:Z.key,style:V.codeInline},G.text)}case _.footnoteReference:{let G=$,U=X(G.target,"a","href");return U?Q(g0,{key:Z.key,onPress:()=>{q.onLinkPress?q.onLinkPress(U,G.text):d6.openURL(U).catch(()=>{})},style:V.link},Q(g0,{style:{fontWeight:"bold"}},G.text)):null}case _.gfmTask:{let G=$;return Q(g0,{key:Z.key,style:V.gfmTask},G.completed?"[x]":"[ ]")}case _.heading:{let G=$,U=`heading${G.level}`,F=V[U];return Q(g0,{key:Z.key,style:F},J(G.children,Z))}case _.htmlBlock:{let G=$;if(q.tagfilter&&m$(G.tag)){let U=typeof G.a=="string"?G.a:`<${G.tag}>`;return Q(g0,{key:Z.key},U)}if(G.a&&G.d){let O=function(D){return(D.type===_.htmlSelfClosing||D.type===_.htmlBlock)&&D.b?[]:D.type===_.paragraph?D.children?.flatMap(O)||[]:D.type===_.text?D.text?.trim()?[D]:[]:D.type===_.htmlBlock&&D.children?[{...D,children:D.children?.flatMap(O)}]:[D]},U=G.tag.toLowerCase();if(l$(U)){let D=G.a.replace(new RegExp("\\s*</"+U+">\\s*$","i"),"");return q.tagfilter&&(D=u$(D)),Q(G.tag,{key:Z.key,...x9(G.attrs||{})},D)}if(/<\/?pre\b/i.test(G.a)){let D=q.tagfilter?u$(G.a):G.a;return Q(g0,{key:Z.key,style:V.codeBlock},D)}if(G.children&&G.children.length>0)return Q(G.tag,{key:Z.key,...x9(G.attrs||{})},J(G.children.flatMap(O),Z));let z=G.a.replace(/>\s+</g,"><").replace(/\n+/g," ").trim();if(new RegExp(`^<${G.tag}(\\s[^>]*)?>(\\s*</${G.tag}>)?$`,"i").test(z))return Q(G.tag,{key:Z.key,...x9(G.attrs||{})});let W=b$(z,{inline:!1,refs:K,inHTML:!1},{slugify:D=>Y(D,a0),sanitizer:(D,B,v)=>X(D,B,v),tagfilter:!0});return Q(G.tag,{key:Z.key,...x9(G.attrs||{})},J(W.flatMap(O),Z))}return l9(G.tag)?Q(G.tag,{key:Z.key,...x9(G.attrs||{})}):Q(G.tag,{key:Z.key,...x9(G.attrs||{})},G.children?J(G.children,Z):"")}case _.htmlSelfClosing:{let G=$;if(q.tagfilter&&m$(G.tag)){let U=typeof G.a=="string"?G.a:`<${G.tag} />`;return Q(g0,{key:Z.key},U)}return Q(G.tag,{key:Z.key,...x9(G.attrs||{})})}case _.image:{let G=$,U=X(G.target,"img","src");return U?Q("img",{key:Z.key,source:{uri:U},accessibilityLabel:G.alt||void 0,style:V.image}):null}case _.link:{let G=$,U={textDecorationLine:"underline"},F=V.link?[U,V.link]:U,O={key:Z.key,style:F};if(G.target!=null){let z=j6(G.target);O.onPress=()=>{q.onLinkPress?q.onLinkPress(z,G.title):d6.openURL(z).catch(()=>{})},q.onLinkLongPress&&(O.onLongPress=()=>q.onLinkLongPress(z,G.title))}return Q("a",O,J(G.children,Z))}case _.table:{let G=$;return Q(L0,{key:Z.key,style:V.table},Q(L0,{style:V.tableHeader},Q(L0,{style:{flexDirection:"row"}},G.header.map(function(F,O){return Q(L0,{key:O,style:[V.tableHeaderCell,G.align[O]!=null?{alignItems:G.align[O]==="center"?"center":G.align[O]==="right"?"flex-end":"flex-start"}:{}]},J(F,Z))}))),G.cells.length>0?Q(L0,{},G.cells.map(function(F,O){return Q(L0,{key:O,style:{flexDirection:"row"}},F.map(function(j,H){return Q(L0,{key:H,style:[V.tableCell,G.align[H]!=null?{alignItems:G.align[H]==="center"?"center":G.align[H]==="right"?"flex-end":"flex-start"}:{}]},J(j,Z))}))})):null)}case _.text:return $.text;case _.textFormatted:{let G=$,F={em:{fontStyle:"italic"},strong:{fontWeight:"bold"},del:{textDecorationLine:"line-through"}}[G.tag],O=V[G.tag]||F;return Q(g0,{key:Z.key,style:O},J(G.children,Z))}case _.orderedList:case _.unorderedList:{let G=$,U=$.type===_.orderedList,F=U?V.listOrdered:V.listUnordered;return Q(L0,{key:Z.key,style:F},G.items.map((O,z)=>{let j=U&&"start"in G&&G.start!=null?G.start+z:z+1,H=U?`${j}.`:"\u2022",W=U?V.listItemNumber:V.listItemBullet;return Q(L0,{key:z,style:{flexDirection:"row"}},Q(g0,{style:W},H+" "),Q(L0,{style:V.listItem},J(O,Z)))}))}case _.paragraph:return Q("p",{key:Z.key,style:V.paragraph},J($.children,Z));case _.ref:return null;default:return null}}var JJ=($,J,Z,Q,X,Y)=>{let K=(G,U,F)=>{let O=(j,H)=>{let W=Array.isArray(j)?j:[j];return U(W,H||F)},z=()=>ZJ(G,O,F,J,Z,Q,X,Y);return $?$(z,G,U,F):z()},q=G=>G.map(U=>"text"in U?U.text:""),V=(G,U={})=>{let F=Array.isArray(G)?G:[G],O=(U.renderDepth||0)+1;if(O>2500)return q(F);U.renderDepth=O;let z=U.key,j=[],H=!1;for(let W=0;W<F.length;W++){U.key=W;let D=K(F[W],V,U),B=typeof D=="string";if(B&&H)j[j.length-1]+=D;else if(D!==null)if(Array.isArray(D))for(let v=0;v<D.length;v++)j.push(D[v]);else j.push(D);H=B}return U.key=z,U.renderDepth=O-1,j.length===1?j[0]:j};return V},QJ=($,J)=>{if(!J||typeof $!="string")return $;let Z=$$(J,$,void 0);return Z?typeof Z=="function"||typeof Z=="object"&&Z!==null&&"render"in Z?Z:$$(J,`${$}.component`,$):$},XJ=$=>{let J=$.toLowerCase();return J==="img"?eZ:J==="div"||J==="section"||J==="article"||J==="aside"||J==="header"||J==="footer"||J==="main"||J==="nav"||J==="figure"||J==="figcaption"||J==="blockquote"||J==="ul"||J==="ol"||J==="li"||J==="table"||J==="thead"||J==="tbody"||J==="tr"||J==="th"||J==="td"?L0:l$(J)?L0:g0};function YJ($,J){let Z={...J||{}};Z.overrides=Z.overrides||{};let Q=Z.slugify||a0,X=Z.sanitizer||c9,Y=Z.createElement||z9.createElement;function K(H,W,...D){if(typeof H!="string")return Y(H,W,...D);let B=$$(Z.overrides||{},`${H}.props`,{}),v=QJ(H,Z.overrides||{}),T={...W,...B,style:W.style||B.style||void 0};if(typeof v=="function"||typeof v=="object"&&v!==null)return Y(v,T,...D);let P=XJ(v);return Y(P,T,...D)}let q={slugify:H=>Q(H,a0),sanitizer:(H,W,D)=>X(H,W,D),tagfilter:Z.tagfilter!==!1,disableAutoLink:Z.disableAutoLink,disableParsingRawHTML:Z.disableParsingRawHTML,enforceAtxHeadings:Z.enforceAtxHeadings},V=$[0]&&$[0].type===_.refCollection?$[0].refs:{},G=JJ(Z.renderRule,K,(H,W,D)=>X(H,W,D),Q,V,Z),U=G($,{inline:Z.forceInline,refs:V}),F=Array.isArray(U)?U:[U],O=[];for(let H in V)H.charCodeAt(0)===r0&&O.push({identifier:H,footnote:V[H].target});if(O.length&&F.push(Y(L0,{key:"footer"},O.map(function(W){let D=W.identifier.charCodeAt(0)===r0?W.identifier.slice(1):W.identifier,B=b$(W.footnote,{inline:!0,refs:V},q),v=G(B,{inline:!0,refs:V}),T=typeof v=="string"?Y(g0,{},v):v;return Y(L0,{key:W.identifier},Y(g0,{},D+": "),T)}))),Z.wrapper===null)return F;let z=Z.wrapper||(Z.forceInline?g0:L0),j;if(F.length>1||Z.forceWrapper)j=F;else if(F.length===1){let H=F[0];return typeof H=="string"?Y(g0,{key:"outer",...Z.wrapperProps},H):H}else return null;return Y(z,{key:"outer",...Z.wrapperProps},j)}function GJ($="",J={}){let Z={...J||{}};Z.overrides=Z.overrides||{};let Q=Z.slugify||a0,X=Z.sanitizer||c9;function Y(V){let G=Z.forceInline||!Z.forceBlock&&!z6.test(V),U={slugify:z=>Q(z,a0),sanitizer:(z,j,H)=>X(z,j,H),tagfilter:Z.tagfilter!==!1,disableAutoLink:Z.disableAutoLink,disableParsingRawHTML:Z.disableParsingRawHTML,enforceAtxHeadings:Z.enforceAtxHeadings},F=V;if(!G){let z=F.length;for(;z>0&&(F[z-1]===`
`||F[z-1]==="\r");)z--;F=F.slice(0,z),F=`${F.replace($J,"")}

`}let O=b$(G?V:F,{inline:G,refs:K},U);return YJ(O,{...Z,forceInline:G})}let K={};return Y($)}var kJ=({options:$,children:J})=>z9.createElement(c6.Provider,{value:$},J),KJ=({children:$,options:J,...Z})=>{let Q=z9.useContext(c6),X=z9.useMemo(()=>{var q=Object.assign({},Q,J);return q.styles=Object.assign({},Q?.styles,J?.styles),q.overrides=Object.assign({},Q?.overrides,J?.overrides),q.wrapperProps=Object.assign({},Q?.wrapperProps,J?.wrapperProps,Z),q},[Q,J,Z]),Y=$??"";return z9.useMemo(()=>GJ(Y,X),[Y,X])},gJ=KJ;export{a0 as slugify,c9 as sanitizer,sZ as parser,gJ as default,GJ as compiler,YJ as astToNative,_ as RuleType,kJ as MarkdownProvider,c6 as MarkdownContext,KJ as Markdown};
