// @bun
function y(g){return g===32||g===9||g===10||g===13}function Oj(g){return g>=65&&g<=90||g>=97&&g<=122||g===95||g===36||g>127}function W(g){return Oj(g)||g>=48&&g<=57}function Wj(g){if(g.charCodeAt(0)===82&&g.startsWith("Record<"))return!0;if(g.charCodeAt(0)===65&&g.startsWith("Array<"))return!0;if(g.charCodeAt(0)===123&&g.includes("[")&&g.includes("]:"))return!0;if(g==="any"||g==="object"||g==="unknown")return!0;return!1}var Fj=["public","protected","private","readonly","override"];function xj(g,e,T=!0,h=!1){let Z=g,a=T,P=h,K=Z.length,_=[],b=new Map,x=new Set,j=0;if(j<K&&Z.charCodeAt(j)===65279)j++;function w(J,H){if(J<H){let X=Z.charCodeAt(J),U=Z.charCodeAt(H-1);if(X!==32&&X!==9&&X!==10&&X!==13&&U!==32&&U!==9&&U!==10&&U!==13)return Z.slice(J,H)}while(J<H&&y(Z.charCodeAt(J)))J++;while(H>J&&y(Z.charCodeAt(H-1)))H--;return Z.slice(J,H)}function O(){if(j>=K)return;let J=Z.charCodeAt(j);if(J!==32&&J!==9&&J!==10&&J!==13&&J!==47)return;while(j<K){let H=Z.charCodeAt(j);if(H===32||H===9||H===10||H===13){j++;continue}if(H===47&&j+1<K){let X=Z.charCodeAt(j+1);if(X===47){let U=Z.indexOf(`
`,j+2);j=U===-1?K:U+1;continue}if(X===42){let U=Z.indexOf("*/",j+2);j=U===-1?K:U+2;continue}}break}}function bj(J){let H=J.length,X=0,U=H;for(let Y=0;Y<H;Y++){let $=J.charCodeAt(Y);if(X){if($===92){Y++;continue}if($===X)X=0;continue}if($===39||$===34||$===96){X=$;continue}if($===47&&Y+1<H){let F=J.charCodeAt(Y+1);if(F===47){U=Y;while(U>0&&(J.charCodeAt(U-1)===32||J.charCodeAt(U-1)===9))U--;return J.slice(0,U)}if(F===42){let q=J.indexOf("*/",Y+2);if(q!==-1){J=`${J.slice(0,Y)} ${J.slice(q+2)}`,Y--;continue}}}}U=H;while(U>0&&(J.charCodeAt(U-1)===32||J.charCodeAt(U-1)===9||J.charCodeAt(U-1)===13))U--;return U<H?J.slice(0,U):J}function l(J){j++;let H=J===39?"'":'"';while(j<K){let X=Z.indexOf(H,j);if(X===-1){j=K;return}let U=0,Y=X-1;while(Y>=0&&Z.charCodeAt(Y)===92)U++,Y--;if(U%2===0){j=X+1;return}j=X+1}}function jj(){j++;let J=0;while(j<K){let H=Z.charCodeAt(j);if(H===92){j+=2;continue}if(H===96&&J===0){j++;return}if(H===36&&j+1<K&&Z.charCodeAt(j+1)===123){j+=2,J++;continue}if(H===125&&J>0){J--,j++;continue}j++}}function f(){let J=Z.charCodeAt(j);if(J===39||J===34)return l(J),!0;if(J===96)return jj(),!0;if(J===47&&j+1<K){let H=Z.charCodeAt(j+1);if(H===47){let X=Z.indexOf(`
`,j+2);return j=X===-1?K:X+1,!0}if(H===42){let X=Z.indexOf("*/",j+2);return j=X===-1?K:X+2,!0}if(wj())return vj(),!0}return!1}function wj(){let J=j-1;while(J>=0&&(Z.charCodeAt(J)===32||Z.charCodeAt(J)===9||Z.charCodeAt(J)===10||Z.charCodeAt(J)===13))J--;if(J<0)return!0;let H=Z.charCodeAt(J);if(H===61||H===40||H===91||H===33||H===38||H===124||H===63||H===58||H===44||H===59||H===123||H===125||H===94||H===126||H===43||H===45||H===42||H===37||H===60||H===62)return!0;if(W(H)){let X=J;while(X>=0&&W(Z.charCodeAt(X)))X--;let U=Z.slice(X+1,J+1);if(U==="return"||U==="typeof"||U==="void"||U==="delete"||U==="throw"||U==="new"||U==="in"||U==="of"||U==="case"||U==="instanceof"||U==="yield"||U==="await")return!0}return!1}function vj(){j++;let J=!1;while(j<K){let H=Z.charCodeAt(j);if(H===92){j+=2;continue}if(J){if(H===93)J=!1;j++;continue}if(H===91){J=!0,j++;continue}if(H===47){j++;break}if(H===10||H===13)break;j++}while(j<K&&W(Z.charCodeAt(j)))j++}function E(){let J=j;while(j<K&&W(Z.charCodeAt(j)))j++;return Z.slice(J,j)}function z(J){if(j+J.length>K)return!1;for(let H=0;H<J.length;H++)if(Z.charCodeAt(j+H)!==J.charCodeAt(H))return!1;if(j+J.length<K&&W(Z.charCodeAt(j+J.length)))return!1;return!0}function Ij(){if(j>=K)return!1;switch(Z.charCodeAt(j)){case 101:return z("export")||z("enum");case 105:return z("import")||z("interface");case 102:return z("function");case 99:return z("class")||z("const");case 116:return z("type");case 108:return z("let");case 118:return z("var");case 100:return z("declare")||z("default");case 109:return z("module");case 110:return z("namespace");case 97:return z("abstract")||z("async");default:return!1}}function p(){let J=Z.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<K&&Z.charCodeAt(j)===10)j++;while(j<K){let U=Z.charCodeAt(j);if(U===32||U===9||U===13||U===10){j++;continue}if(U===47&&j+1<K){let Y=Z.charCodeAt(j+1);if(Y===47){let $=Z.indexOf(`
`,j+2);j=$===-1?K:$+1;continue}if(Y===42){let $=Z.indexOf("*/",j+2);j=$===-1?K:$+2;continue}}break}let X=j>=K||Ij()||Z.charCodeAt(j)===125;return j=H,X}function o(){let J=Z.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<K&&Z.charCodeAt(j)===10)j++;while(j<K){let U=Z.charCodeAt(j);if(U===32||U===9||U===13||U===10){j++;continue}if(U===47&&j+1<K&&Z.charCodeAt(j+1)===47){let Y=Z.indexOf(`
`,j+2);j=Y===-1?K:Y+1;continue}break}if(j>=K)return j=H,!0;let X=Z.charCodeAt(j);if(X===124||X===38||X===46||X===63)return j=H,!1;if(z("extends")||z("keyof")||z("typeof")||z("infer")||z("is")||z("as")||z("in"))return j=H,!1;return j=H,!0}let Ej=/[{}'"`\/]/g,fj=/[()'"`\/]/g,yj=/[[\]'"`\/]/g,Aj=/[<>'"`\/]/g;function A(J,H){let X=1;j++;let U=J===123?Ej:J===40?fj:J===91?yj:Aj;U.lastIndex=j;let Y;while((Y=U.exec(Z))!==null){let $=Y.index,F=Z.charCodeAt($);if(F===39||F===34){j=$,l(F),U.lastIndex=j;continue}if(F===96){j=$,jj(),U.lastIndex=j;continue}if(F===47){if(j=$,f()){U.lastIndex=j;continue}U.lastIndex=$+1;continue}if(F===J)X++;else if(F===H){if(H===62&&$>0&&Z.charCodeAt($-1)===61){U.lastIndex=$+1;continue}if(X--,X===0)return j=$+1,j}U.lastIndex=$+1}return j=K,j}function S(){return j>0&&Z.charCodeAt(j-1)===61}let k=/[{};'"`\/\n\r()[\]]/g;function I(){let J=0,H=0,X=0;k.lastIndex=j;let U;while((U=k.exec(Z))!==null){let Y=U.index,$=Z.charCodeAt(Y);if($===39||$===34){j=Y,l($),k.lastIndex=j;continue}if($===96){j=Y,jj(),k.lastIndex=j;continue}if($===47){if(j=Y,f()){k.lastIndex=j;continue}k.lastIndex=Y+1;continue}if($===40){H++,k.lastIndex=Y+1;continue}if($===41){H--,k.lastIndex=Y+1;continue}if($===91){X++,k.lastIndex=Y+1;continue}if($===93){X--,k.lastIndex=Y+1;continue}if($===123){J++,k.lastIndex=Y+1;continue}if($===125){if(J--,J<=0&&H<=0&&X<=0){j=Y+1;return}k.lastIndex=Y+1;continue}if($===59&&J===0&&H===0&&X===0){j=Y+1;return}if(($===10||$===13)&&J===0&&H===0&&X===0){if(j=Y,p())return}k.lastIndex=Y+1}j=K}function Bj(){A(123,125);while(j<K&&y(Z.charCodeAt(j)))j++;if(z("from")){j+=4;while(j<K&&y(Z.charCodeAt(j)))j++;if(j<K){let J=Z.charCodeAt(j);if(J===39||J===34)l(J)}}while(j<K&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<K&&Z.charCodeAt(j)===59)j++}function Gj(){j++;while(j<K&&y(Z.charCodeAt(j)))j++;if(z("as")){j+=2;while(j<K&&y(Z.charCodeAt(j)))j++;E();while(j<K&&y(Z.charCodeAt(j)))j++}if(z("from")){j+=4;while(j<K&&y(Z.charCodeAt(j)))j++;if(j<K){let J=Z.charCodeAt(j);if(J===39||J===34)l(J)}}while(j<K&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<K&&Z.charCodeAt(j)===59)j++}function C(J){if(!a)return;let H=J-1;while(H>=0&&y(Z.charCodeAt(H)))H--;if(H<0)return;let X=[],U=!1;while(H>=0){if(H>=1&&Z.charCodeAt(H)===47&&Z.charCodeAt(H-1)===42){let F=Z.lastIndexOf("/*",H-2);if(F>=0){X.push(Z.slice(F,H+1)),U=!0,H=F-1;while(H>=0&&y(Z.charCodeAt(H)))H--;continue}break}let Y=H;while(Y>0&&Z.charCodeAt(Y-1)!==10)Y--;let $=w(Y,H+1);if($.startsWith("//")){if(U)break;let F=[$];H=Y-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--;while(H>=0){let q=H;while(q>0&&Z.charCodeAt(q-1)!==10)q--;let V=w(q,H+1);if(V.startsWith("//")){F.push(V),H=q-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--}else if(V===""){H=q-1;while(H>=0&&(Z.charCodeAt(H)===10||Z.charCodeAt(H)===13))H--}else break}F.reverse(),X.push(F.join(`
`));continue}break}if(X.length===0)return;return X.reverse(),X}function Tj(J){let H=J,X=!1;while(j<K){let V=Z.charCodeAt(j);if(V===59){j++;break}if(V===39||V===34){l(V),X=!0;while(j<K&&(Z.charCodeAt(j)===32||Z.charCodeAt(j)===9))j++;if(j<K&&Z.charCodeAt(j)===59)j++;break}if(V===10&&X)break;j++}let U=w(H,j),Y=U.charCodeAt(7)===116&&(U.startsWith("import type ")||U.startsWith("import type{")),$=!1;{let V=6;while(V<U.length&&(U.charCodeAt(V)===32||U.charCodeAt(V)===9))V++;if(V<U.length&&U.charCodeAt(V)===116&&U.startsWith("type",V)){V+=4;while(V<U.length&&(U.charCodeAt(V)===32||U.charCodeAt(V)===9))V++}if(V<U.length){let Q=U.charCodeAt(V);$=Q===39||Q===34}}let F="";{let V=U.indexOf("from ");if(V!==-1){let Q=V+5;while(Q<U.length&&(U.charCodeAt(Q)===32||U.charCodeAt(Q)===9))Q++;if(Q<U.length){let B=U.charCodeAt(Q);if(B===39||B===34){let N=U.indexOf(String.fromCharCode(B),Q+1);if(N!==-1)F=U.slice(Q+1,N)}}}else if($){let Q=6;while(Q<U.length&&U.charCodeAt(Q)!==39&&U.charCodeAt(Q)!==34)Q++;if(Q<U.length){let B=U.charCodeAt(Q),N=U.indexOf(String.fromCharCode(B),Q+1);if(N!==-1)F=U.slice(Q+1,N)}}}let q=C(H);return{kind:"import",name:"",text:U,isExported:!1,isTypeOnly:Y,isSideEffect:$,source:F,leadingComments:q,start:H,end:j}}function Jj(){let J=j;return A(123,125),Z.slice(J,j)}function qj(J){let H=J.indexOf("(");if(H===-1)return J;let X=J.slice(H);if(X.indexOf("=")===-1)return J;let U=!1;for(let V=0;V<X.length;V++)if(X.charCodeAt(V)===61){let B=V>0?X.charCodeAt(V-1):0,N=V+1<X.length?X.charCodeAt(V+1):0;if(B!==61&&B!==33&&B!==60&&B!==62&&N!==61&&N!==62){U=!0;break}}if(!U)return J;let Y=0,$=-1;for(let V=H;V<J.length;V++){let Q=J.charCodeAt(V);if(Q===40)Y++;else if(Q===41){if(Y--,Y===0){$=V;break}}}if($===-1)return J;let F=J.slice(H,$+1),q=c(F);return J.slice(0,H)+q+J.slice($+1)}function Nj(J){let H=J.indexOf("//")!==-1||J.indexOf("/*")!==-1,X=J.split(`
`),U=[],Y=[],$=[],F=!1,q=1/0;for(let B=0;B<X.length;B++){let N=X[B];if(H){if(F){if(N.includes("*/"))F=!1;continue}let L=N.trim();if(L.length===0)continue;let R=L.charCodeAt(0);if(R===47){let v=L.charCodeAt(1);if(v===47)continue;if(v===42){if(!L.includes("*/"))F=!0;continue}}if(R===42)continue;let G=bj(N);if(G.charCodeAt(G.length-1)===59)G=G.slice(0,-1);G=qj(G);let D=G.trim();if(!D)continue;U.push(G),Y.push(D);let M=0;while(M<G.length&&y(G.charCodeAt(M)))M++;if(D!=="{"&&D!=="}"){if(M<q)q=M}$.push(M)}else{let L=N.length;while(L>0&&(N.charCodeAt(L-1)===32||N.charCodeAt(L-1)===9||N.charCodeAt(L-1)===13))L--;if(L===0)continue;let R=L<N.length?N.slice(0,L):N;if(R.charCodeAt(R.length-1)===59)R=R.slice(0,-1);R=qj(R);let G=R.trim();if(!G)continue;U.push(R),Y.push(G);let D=0;while(D<R.length&&y(R.charCodeAt(D)))D++;if(G!=="{"&&G!=="}"){if(D<q)q=D}$.push(D)}}if(U.length===0)return"{}";if(q===1/0||q<=2)return U.join(`
`);let V=q-2,Q=Array(U.length);for(let B=0;B<U.length;B++){let N=Y[B];if(N==="{"){Q[B]=N;continue}let L=$[B];if(L>q)Q[B]=U[B];else if(L===q&&(N.charCodeAt(0)===125||N.charCodeAt(0)===93||N.charCodeAt(0)===41))Q[B]=U[B];else{let R=Math.max(0,L-V);Q[B]=" ".repeat(R)+N}}return Q.join(`
`)}function u(){if(j>=K||Z.charCodeAt(j)!==60)return"";let J=j;A(60,62);let H=Z.slice(J,j);if(H.includes(`
`)){let X="",U=!1;for(let Y=0;Y<H.length;Y++){let $=H.charCodeAt(Y);if($===32||$===9||$===10||$===13){if(!U&&X.length>0)X+=" ",U=!0}else X+=H[Y],U=!1}if(X.charCodeAt(1)===32)X=`<${X.slice(2)}`;if(X.charCodeAt(X.length-2)===32)X=`${X.slice(0,-2)}>`;return X}return H}function m(){if(j>=K||Z.charCodeAt(j)!==40)return"()";let J=j;return A(40,41),Z.slice(J,j)}function c(J){let H=J.slice(1,-1).trim();if(!H)return"()";if(J.indexOf(`
`)===-1&&H.indexOf(":")!==-1&&H.indexOf("{")===-1&&H.indexOf("[")===-1&&H.indexOf("=")===-1&&H.indexOf("@")===-1&&H.indexOf("...")===-1){let V=0,Q=0,B=0;for(let N=0;N<H.length;N++){let L=H.charCodeAt(N);if(L===40||L===60||L===123)B++;else if(L===41||L===62||L===125)B--;else if(B===0){if(L===58)V++;else if(L===44)Q++}}if(V>=Q+1){let N=!1;for(let L=0;L<Fj.length;L++){let R=Fj[L],G=H.indexOf(R);if(G!==-1){let D=G+R.length;if((G===0||!W(H.charCodeAt(G-1)))&&(D>=H.length||!W(H.charCodeAt(D)))){N=!0;break}}}if(!N)return J}}let X=[],U=0,Y=0,$=!1,F=0;for(let V=0;V<=H.length;V++){if(V===H.length){X.push(H.slice(U).trim());break}let Q=H.charCodeAt(V);if($){if(Q===92){V++;continue}if(Q===F)$=!1;continue}if(Q===39||Q===34||Q===96){$=!0,F=Q;continue}if(Q===40||Q===123||Q===91||Q===60)Y++;else if(Q===41||Q===125||Q===93||Q===62&&!(V>0&&H.charCodeAt(V-1)===61))Y--;else if(Q===44&&Y===0)X.push(H.slice(U,V).trim()),U=V+1}let q=[];for(let V of X){if(!V)continue;let Q=V.trim();if(Q.startsWith("//")||Q.startsWith("/*"))continue;let B=V;{let N=!1,L=0;for(let R=0;R<B.length-1;R++){let G=B.charCodeAt(R);if(N){if(G===92){R++;continue}if(G===L)N=!1;continue}if(G===39||G===34||G===96){N=!0,L=G;continue}if(G===47&&B.charCodeAt(R+1)===47){B=B.slice(0,R).trimEnd();break}}}if(!B.trim())continue;q.push(Rj(B))}return`(${q.join(", ")})`}function kj(J){if(!J.startsWith("{")&&!J.startsWith("["))return J;let H="",X=0,U=0,Y=!1,$=0;while(X<J.length){let F=J.charCodeAt(X);if(Y){if(F===92&&X+1<J.length){H+=J[X]+J[X+1],X+=2;continue}if(F===$)Y=!1;H+=J[X],X++;continue}if(F===39||F===34||F===96){Y=!0,$=F,H+=J[X],X++;continue}if(F===123||F===91||F===40)U++;else if(F===125||F===93||F===41)U--;if(U>=1&&F===61&&(X+1>=J.length||J.charCodeAt(X+1)!==61&&J.charCodeAt(X+1)!==62)){while(H.length>0&&(H[H.length-1]===" "||H[H.length-1]==="\t"||H[H.length-1]===`
`))H=H.slice(0,-1);X++;let q=0;while(X<J.length){let V=J.charCodeAt(X);if(V===39||V===34||V===96){let Q=V;X++;while(X<J.length){if(J.charCodeAt(X)===92){X+=2;continue}if(J.charCodeAt(X)===Q){X++;break}X++}continue}if(V===123||V===91||V===40)q++;else if(V===125||V===93||V===41){if(q===0)break;q--}else if(V===44&&q===0)break;X++}continue}if(U===1&&F===46&&X+2<J.length&&J.charCodeAt(X+1)===46&&J.charCodeAt(X+2)===46){X+=3;continue}H+=J[X],X++}return H}function Rj(J){let H=J.trim(),X=H.startsWith("...");if(X)H=H.slice(3).trim();while(H.startsWith("@")){let G=1;while(G<H.length&&W(H.charCodeAt(G)))G++;if(G<H.length&&H.charCodeAt(G)===40){let D=1;G++;while(G<H.length&&D>0){if(H.charCodeAt(G)===40)D++;else if(H.charCodeAt(G)===41)D--;G++}}H=H.slice(G).trim()}let U=!0;while(U){U=!1;for(let G of Fj)if(H.startsWith(G)&&H.length>G.length&&!W(H.charCodeAt(G.length))){let D=H.slice(G.length).trim();if(D.charCodeAt(0)===58||D.charCodeAt(0)===63&&D.length>1&&D.charCodeAt(1)===58)break;H=D,U=!0;break}}let Y=-1,$=-1,F=0,q=!1,V=0;for(let G=0;G<H.length;G++){let D=H.charCodeAt(G);if(q){if(D===92){G++;continue}if(D===V)q=!1;continue}if(D===39||D===34||D===96){q=!0,V=D;continue}if(D===40||D===123||D===91||D===60)F++;else if(D===41||D===125||D===93||D===62&&!(G>0&&H.charCodeAt(G-1)===61))F--;else if(F===0){if(D===58&&Y===-1)Y=G;else if(D===61&&$===-1&&(G===0||H.charCodeAt(G-1)!==61)&&(G+1>=H.length||H.charCodeAt(G+1)!==61&&H.charCodeAt(G+1)!==62))$=G}}let Q,B,N=$!==-1;if(Y!==-1&&($===-1||Y<$))if(Q=H.slice(0,Y).trim(),$!==-1)B=H.slice(Y+1,$).trim();else B=H.slice(Y+1).trim();else if($!==-1)Q=H.slice(0,$).trim(),B=Uj(H.slice($+1).trim());else Q=H,B="unknown";if(Q=kj(Q),(Q.startsWith("{")||Q.startsWith("["))&&Q.includes(`
`)){let G=Q.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(G.length<=40)Q=G;else Q=Q.split(`
`).map((M)=>{let v=M.trim();if(!v)return"";if(v==="{"||v==="}"||v==="["||v==="]"||v.startsWith("}")||v.startsWith("]"))return v;return`  ${v}`}).join(`
`)}let L=Q.endsWith("?")||N;if(Q.endsWith("?"))Q=Q.slice(0,-1).trim();let R=L&&!X?"?":"";if(X)return`...${Q}: ${B}`;return`${Q}${R}: ${B}`}function Lj(J){let H=0;if(H<J.length&&J.charCodeAt(H)===45)H++;if(H>=J.length)return!1;let X=J.charCodeAt(H);if(X<48||X>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++;if(H<J.length&&J.charCodeAt(H)===46){if(H++,H>=J.length||J.charCodeAt(H)<48||J.charCodeAt(H)>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++}return H===J.length}function Uj(J){let H=J.trim();if(H==="true"||H==="false")return"boolean";if(Lj(H))return"number";if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return"string";if(H.startsWith("["))return"unknown[]";if(H.startsWith("{"))return"Record<string, unknown>";return"unknown"}function Xj(J){let H=J.trim();if(H==="true"||H==="false")return H;if(Lj(H))return H;if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return H;return"unknown"}function Yj(J){if(J.endsWith("as const"))return null;let H=0,X=-1;for(let Y=0;Y<J.length;Y++){let $=J.charCodeAt(Y);if($===123||$===91||$===40)H++;else if($===125||$===93||$===41)H--;else if(H===0&&$===32&&Y+4<=J.length&&J.substring(Y,Y+4)===" as ")X=Y}if(X===-1)return null;return J.slice(X+4).trim()||null}function s(){if(O(),j<K&&Z.charCodeAt(j)===58){j++,O();let J=j,H=0;while(j<K){if(f())continue;let X=Z.charCodeAt(j);if(X===40||X===91||X===60)H++;else if(X===41||X===93||X===62&&!S())H--;else if(X===123)if(H>0)H++;else{let U=w(J,j),Y=($)=>{let F=U.length-$.length;return F>=0&&U.endsWith($)&&(F===0||!W(U.charCodeAt(F-1)))};if(U.length===0||U.endsWith("|")||U.endsWith("&")||Y("is")||Y("extends"))H++;else break}else if(X===125){if(H===0)break;H--}else if(H===0&&X===59)break;if(H===0&&o())break;j++}return w(J,j)}return""}function n(J,H,X,U){j+=8,O();let Y=j<K&&Z.charCodeAt(j)===42;if(Y)j++,O();let $=E();if(!$&&!U)return null;O();let F=u();O();let q=m();O();let V=s();if(!V)if(X&&Y)V="AsyncGenerator<unknown, void, unknown>";else if(Y)V="Generator<unknown, void, unknown>";else if(X)V="Promise<void>";else V="void";O();let Q=!1;if(j<K&&Z.charCodeAt(j)===123)Q=!0,A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let B=c(q),N=`${H?"export ":""}declare function ${$||"default"}${F}${B}: ${V};`,L=C(J);if(Q)x.add(_.length);return{kind:"function",name:$||"default",text:N,isExported:H,isDefault:U,isAsync:X,isGenerator:Y,returnType:V,generics:F||void 0,leadingComments:L,start:J,end:j}}function t(J,H,X){j+=H.length,O();let U=[];do{if(O(),j>=K)break;let Y=Z.charCodeAt(j);if(Y===123||Y===91)return I(),U;let $=E();if(!$)return I(),U;O();let F,q,V=!1;if(j<K&&Z.charCodeAt(j)===58){j++,O();let N=j,L=0;while(j<K){if(f())continue;let R=Z.charCodeAt(j);if(R===40||R===123||R===91||R===60)L++;else if(R===41||R===125||R===93||R===62&&!S())L--;else if(L===0&&(R===61||R===59||R===44))break;if(L===0&&p())break;j++}F=w(N,j)}if(j<K&&Z.charCodeAt(j)===61)if(P&&F&&!Wj(F))I();else{j++,O();let N=j,L=0,R=0;while(j<K){if(f())continue;let G=Z.charCodeAt(j);if(G===40||G===123||G===91)L++;else if(G===41||G===125||G===93)L--;else if(G===60){if(j+1>=K||Z.charCodeAt(j+1)!==61)R++}else if(G===62&&!S()){if(R>0&&(j+1>=K||Z.charCodeAt(j+1)!==61))R--}else if(L===0&&R===0&&(G===59||G===44))break;if(L===0&&R===0&&p())break;j++}if(q=w(N,j),q.endsWith(" as const")||q==="const"){if(V=!0,!F){let G=q.endsWith(" as const")?q.slice(0,-9).trim():q,D=Xj(G);F=D!=="unknown"?D:void 0}}else if(!F){let G=Yj(q);if(G)F=G}}if(j<K){let N=Z.charCodeAt(j);if(N===44){j++;continue}if(N===59)j++}let Q=C(J),B=`export declare ${H} ${$}: ${F||"unknown"};`;U.push({kind:"variable",name:$,text:B,isExported:!0,typeAnnotation:F,value:q,modifiers:V?[H,"const assertion"]:[H],leadingComments:Q,start:J,end:j});break}while(j<K);return U}function Zj(J,H){j+=9,O();let X=E();O();let U=u();O();let Y="";if(z("extends")){j+=7,O();let Q=j,B=0;while(j<K){if(f())continue;let N=Z.charCodeAt(j);if(N===60)B++;else if(N===62&&!S())B--;else if(N===123&&B===0)break;j++}Y=w(Q,j)}O();let $=j<K&&Z.charCodeAt(j)===123?Jj():"{}",F=Nj($),q=`${H?"export ":""}declare interface ${X}${U}${Y?` extends ${Y}`:""} ${F}`,V=C(J);return{kind:"interface",name:X,text:q,isExported:H,extends:Y||void 0,generics:U||void 0,leadingComments:V,start:J,end:j}}function $j(J,H){j+=4,O();let X=E();O();let U=u();if(O(),j<K&&Z.charCodeAt(j)===61)j++;O();let Y=j,$=0;while(j<K){if(f())continue;let Q=Z.charCodeAt(j);if(Q===40||Q===123||Q===91||Q===60)$++;else if(Q===41||Q===125||Q===93||Q===62&&!S())$--;else if($===0&&Q===59)break;if($===0&&p())break;j++}let F=w(Y,j);if(j<K&&Z.charCodeAt(j)===59)j++;let q=`${H?"export ":""}type ${X}${U} = ${F}`,V=C(J);return{kind:"type",name:X,text:q,isExported:H,generics:U||void 0,leadingComments:V,start:J,end:j}}function r(J,H,X){j+=4,O();let U=E();O();let Y=j;if(j<K&&Z.charCodeAt(j)===123)A(123,125);let $=w(J,j),F=C(J);return{kind:"enum",name:U,text:$,isExported:H,modifiers:X?["const"]:void 0,leadingComments:F,start:J,end:j}}function d(J,H,X){j+=5,O();let U=E()||"AnonymousClass";O();let Y=u();O();let $="";if(z("extends")){j+=7,O();let B=j,N=0;while(j<K){if(f())continue;let L=Z.charCodeAt(j);if(L===60)N++;else if(L===62&&!S())N--;else if(N===0&&(L===123||z("implements")))break;j++}$=w(B,j)}let F;if(z("implements")){j+=10,O();let B=j,N=0;while(j<K){if(f())continue;let R=Z.charCodeAt(j);if(R===60)N++;else if(R===62&&!S())N--;else if(N===0&&R===123)break;j++}let L=w(B,j);if(L)F=L.split(",").map((R)=>R.trim())}O();let q=Qj(),V=`${H?"export ":""}declare ${X?"abstract ":""}class ${U}${Y}${$?` extends ${$}`:""}${F&&F.length>0?` implements ${F.join(", ")}`:""} ${q}`,Q=C(J);return{kind:"class",name:U,text:V,isExported:H,extends:$||void 0,implements:F,generics:Y||void 0,modifiers:X?["abstract"]:void 0,leadingComments:Q,start:J,end:j}}function Qj(){if(j>=K||Z.charCodeAt(j)!==123)return"{}";j++;let J=[];while(j<K){if(O(),j>=K)break;if(Z.charCodeAt(j)===125){j++;break}if(Z.charCodeAt(j)===59){j++;continue}if(z("static")&&Dj("static")===123){j+=6,O(),A(123,125);continue}let H=!1,X=!1,U=!1,Y=!1,$=!1,F=!1,q=!1,V=!1,Q=!0;while(Q){if(O(),z("private")){H=!0,j+=7;continue}if(z("protected")){X=!0,j+=9;continue}if(z("public")){j+=6;continue}if(z("static")){U=!0,j+=6;continue}if(z("abstract")){Y=!0,j+=8;continue}if(z("readonly")){$=!0,j+=8;continue}if(z("override")){F=!0,j+=8;continue}if(z("accessor")){q=!0,j+=8;continue}if(z("async")){V=!0,j+=5;continue}if(z("declare")){j+=7;continue}break}if(O(),j>=K||Z.charCodeAt(j)===125)break;if(Z.charCodeAt(j)===35)H=!0;if(H){Vj();continue}let B="  ";if(X)B+="protected ";if(U)B+="static ";if(Y)B+="abstract ";if($)B+="readonly ";if(z("constructor")){j+=11,O();let N=m();if(O(),Cj(N,J),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let L=c(N);J.push(`  constructor${L};`)}else if(z("get"))if(j+=3,O(),j<K&&(Oj(Z.charCodeAt(j))||Z.charCodeAt(j)===91||Z.charCodeAt(j)===35)){let N=Kj();if(N.startsWith("#")){if(O(),j<K&&Z.charCodeAt(j)===40)m();if(O(),s(),O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;continue}O(),m(),O();let L=s()||"unknown";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;J.push(`${B}get ${N}(): ${L};`)}else _j("get",B,U,$,V,J);else if(z("set"))if(j+=3,O(),j<K&&(Oj(Z.charCodeAt(j))||Z.charCodeAt(j)===91||Z.charCodeAt(j)===35)){let N=Kj();if(N.startsWith("#")){if(O(),j<K&&Z.charCodeAt(j)===40)m();if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;continue}O();let L=m();if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let R=c(L);J.push(`${B}set ${N}${R};`)}else _j("set",B,U,$,V,J);else{let N=Z.charCodeAt(j)===42;if(N)j++,O();let L=Kj();if(!L){Vj();continue}gj(L,B,U,$,N,Y,V,J)}}return`{
${J.join(`
`)}
}`}function Kj(){if(j>=K)return"";let J=Z.charCodeAt(j);if(J===91){let H=j;return A(91,93),Z.slice(H,j)}if(J===35)return j++,`#${E()}`;return E()}function Dj(J){let H=j+J.length;while(H<K&&y(Z.charCodeAt(H)))H++;return H<K?Z.charCodeAt(H):0}function Vj(){let J=0;while(j<K){if(f())continue;let H=Z.charCodeAt(j);if(H===123||H===40)J++;else if(H===125||H===41){if(J===0)return;J--}else if(H===59&&J===0){j++;return}if(J===0&&o())return;j++}}function _j(J,H,X,U,Y,$){gj(J,H,X,U,!1,!1,Y,$)}function gj(J,H,X,U,Y,$,F,q){if(O(),j>=K)return;let V=Z.charCodeAt(j),Q=!1;if(V===63)Q=!0,j++,O();if(j<K&&Z.charCodeAt(j)===33)j++,O();let B=j<K?Z.charCodeAt(j):0;if(B===40||B===60){let N=B===60?u():"";O();let L=m();O();let R=s();if(!R)if(F&&Y)R="AsyncGenerator<unknown, void, unknown>";else if(Y)R="Generator<unknown, void, unknown>";else if(F)R="Promise<void>";else R="void";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let G=c(L),D=Q?"?":"",M=Y?"*":"";q.push(`${H}${M}${J}${D}${N}${G}: ${R};`)}else if(B===58||B===61||B===59||B===125||B===10||B===13){let N="";if(B===58){j++,O();let G=j,D=0;while(j<K){if(f())continue;let M=Z.charCodeAt(j);if(M===40||M===123||M===91||M===60)D++;else if(M===41||M===125||M===93||M===62&&!S()){if(D===0)break;D--}else if(D===0&&(M===59||M===61||M===44))break;if(D===0&&o())break;j++}N=w(G,j)}let L="";if(j<K&&Z.charCodeAt(j)===61)if(P&&N){j++;let G=0;while(j<K){if(f())continue;let D=Z.charCodeAt(j);if(D===40||D===123||D===91)G++;else if(D===41||D===125||D===93){if(G===0&&D===125)break;G--}else if(G===0&&D===59)break;if(G===0&&o())break;j++}}else{j++,O();let G=j,D=0;while(j<K){if(f())continue;let M=Z.charCodeAt(j);if(M===40||M===123||M===91)D++;else if(M===41||M===125||M===93){if(D===0&&M===125)break;D--}else if(D===0&&M===59)break;if(D===0&&o())break;j++}L=w(G,j)}if(j<K&&Z.charCodeAt(j)===59)j++;if(!N)if(L){let G=Yj(L);if(G)N=G;else N=X&&U?Xj(L):Uj(L)}else N="unknown";let R=Q?"?":"";q.push(`${H}${J}${R}: ${N};`)}else Vj()}function Cj(J,H){let X=J.slice(1,-1).trim();if(!X)return;let U=[],Y=0,$=0,F=!1,q=0;for(let V=0;V<=X.length;V++){if(V===X.length){U.push(X.slice(Y).trim());break}let Q=X.charCodeAt(V);if(F){if(Q===92){V++;continue}if(Q===q)F=!1;continue}if(Q===39||Q===34||Q===96){F=!0,q=Q;continue}if(Q===40||Q===123||Q===91||Q===60)$++;else if(Q===41||Q===125||Q===93||Q===62&&!(V>0&&X.charCodeAt(V-1)===61))$--;else if(Q===44&&$===0)U.push(X.slice(Y,V).trim()),Y=V+1}for(let V of U){let Q=V.startsWith("public ")||V.startsWith("public\t"),B=V.startsWith("protected ")||V.startsWith("protected\t"),N=V.startsWith("private ")||V.startsWith("private\t"),L=V.includes("readonly ");if(!Q&&!B&&!N&&!L)continue;if(N)continue;let R=V,G=[];if(Q){let v=6;while(v<R.length&&y(R.charCodeAt(v)))v++;R=R.slice(v),G.push("public")}if(B){let v=9;while(v<R.length&&y(R.charCodeAt(v)))v++;R=R.slice(v),G.push("protected")}if(L){let v=R.indexOf("readonly ");if(v!==-1){let Hj=v+8;while(Hj<R.length&&y(R.charCodeAt(Hj)))Hj++;R=R.slice(0,v)+R.slice(Hj)}G.push("readonly")}let D=G.length>0?`${G.join(" ")} `:"",M=Rj(R);H.push(`  ${D}${M};`)}}function zj(J="  "){if(j>=K||Z.charCodeAt(j)!==123)return"{}";j++;let H=[];while(j<K){if(O(),j>=K)break;if(Z.charCodeAt(j)===125){j++;break}if(Z.charCodeAt(j)===59){j++;continue}let X=!1;if(z("export"))X=!0,j+=6,O();if(z("declare"))j+=7,O();let U=X?"export ":"";if(z("function")||z("async")&&Sj("async","function")){let Y=!1;if(z("async"))Y=!0,j+=5,O();if(j+=8,O(),j<K&&Z.charCodeAt(j)===42)j++,O();let F=E();O();let q=u();O();let V=m();O();let Q=s();if(!Q)Q=Y?"Promise<void>":"void";if(O(),j<K&&Z.charCodeAt(j)===123)A(123,125);else if(j<K&&Z.charCodeAt(j)===59)j++;let B=c(V);H.push(`${J}${U}function ${F}${q}${B}: ${Q};`)}else if(z("const")||z("let")||z("var")){let Y=z("const")?"const":z("let")?"let":"var";j+=Y.length,O();let $=E();if(!$){I();continue}O();let F="";if(j<K&&Z.charCodeAt(j)===58){j++,O();let V=j,Q=0;while(j<K){if(f())continue;let B=Z.charCodeAt(j);if(B===40||B===123||B===91||B===60)Q++;else if(B===41||B===125||B===93||B===62&&!S())Q--;else if(Q===0&&(B===61||B===59||B===44))break;if(Q===0&&p())break;j++}F=w(V,j)}let q="";if(j<K&&Z.charCodeAt(j)===61){j++,O();let V=j,Q=0;while(j<K){if(f())continue;let B=Z.charCodeAt(j);if(B===40||B===123||B===91||B===60)Q++;else if(B===41||B===125||B===93||B===62&&!S())Q--;else if(Q===0&&(B===59||B===44))break;if(Q===0&&p())break;j++}q=w(V,j)}if(j<K&&Z.charCodeAt(j)===59)j++;if(!F&&q){let V=Yj(q);if(V)F=V;else if(Y==="const")F=Xj(q);else F=Uj(q)}if(!F)F="unknown";H.push(`${J}${U}${Y} ${$}: ${F};`)}else if(z("interface")){j+=9,O();let Y=E();O();let $=u();O();let F="";if(z("extends")){let V=j;while(j<K&&Z.charCodeAt(j)!==123){if(f())continue;j++}F=Z.slice(V,j)}let q=Nj(Jj());H.push(`${J}${U}interface ${Y}${$}${F} ${q}`)}else if(z("type")){j+=4,O();let Y=E();O();let $=u();if(O(),j<K&&Z.charCodeAt(j)===61){j++,O();let F=j,q=0;while(j<K){if(f())continue;let Q=Z.charCodeAt(j);if(Q===40||Q===123||Q===91||Q===60)q++;else if(Q===41||Q===125||Q===93||Q===62&&!S())q--;else if(q===0&&Q===59)break;if(q===0&&p())break;j++}let V=w(F,j);if(j<K&&Z.charCodeAt(j)===59)j++;H.push(`${J}${U}type ${Y}${$} = ${V}`)}}else if(z("class")){j+=5,O();let Y=E();O();let $=u();O();let F=j;while(j<K&&Z.charCodeAt(j)!==123){if(f())continue;j++}let q=w(F,j),V=q?` ${q}`:"",Q=Qj();H.push(`${J}${U}class ${Y}${$}${V} ${Q}`)}else if(z("enum")){j+=4,O();let Y=E();O();let $=Jj();H.push(`${J}${U}enum ${Y} ${$}`)}else if(z("namespace")||z("module")){let Y=z("namespace")?"namespace":"module";j+=Y.length,O();let $=E();O();let F=zj(J);H.push(`${J}${U}${Y} ${$} ${F}`)}else if(z("abstract"))if(j+=8,O(),z("class")){j+=5,O();let Y=E();O();let $=u();O();let F=j;while(j<K&&Z.charCodeAt(j)!==123){if(f())continue;j++}let q=w(F,j),V=q?` ${q}`:"",Q=Qj();H.push(`${J}${U}abstract class ${Y}${$}${V} ${Q}`)}else I();else if(X&&z("default")){j+=7,O();let Y=j;I();let $=w(Y,j);if($.charCodeAt($.length-1)===59)$=$.slice(0,-1);if($)H.push(`${J}export default ${$};`)}else if(!X&&(Z.charCodeAt(j)===39||Z.charCodeAt(j)===34||Z.charCodeAt(j)===96))I();else I()}if(H.length===0)return"{}";return`{
${H.join(`
`)}
}`}function Sj(J,H){let X=j+J.length;while(X<K&&y(Z.charCodeAt(X)))X++;for(let U=0;U<H.length;U++)if(X+U>=K||Z.charCodeAt(X+U)!==H.charCodeAt(U))return!1;return X+H.length>=K||!W(Z.charCodeAt(X+H.length))}function i(J,H,X){j+=X.length,O();let U="",Y=Z.charCodeAt(j);if(Y===39||Y===34){let Q=j;l(Y),U=Z.slice(Q,j)}else{U=E();while(j<K&&Z.charCodeAt(j)===46)j++,U+=`.${E()}`}O();let $=j<K&&Z.charCodeAt(j)===123?zj():"{}",F=`${H?"export ":""}declare ${X} ${U} ${$}`,q=C(J),V=U.startsWith("'")||U.startsWith('"');return{kind:"module",name:U,text:F,isExported:H,source:V?U.slice(1,-1):void 0,leadingComments:q,start:J,end:j}}while(j<K){if(O(),j>=K)break;let J=j,H=Z.charCodeAt(j);if(H===105&&z("import"))_.push(Tj(J));else if(H===101&&z("export")){j+=6,O();let X=Z.charCodeAt(j);if(X===100&&z("default")){j+=7,O();let U=Z.charCodeAt(j);if(U===102&&z("function")){let Y=n(J,!0,!1,!0);if(Y)_.push(Y)}else if(U===97&&z("async")&&Dj("async")!==59)if(j+=5,O(),z("function")){let Y=n(J,!0,!0,!0);if(Y)_.push(Y)}else{I();let Y=w(J,j);_.push({kind:"export",name:"default",text:Y,isExported:!0,isTypeOnly:!1,start:J,end:j})}else if(U===99&&z("class")){let Y=d(J,!0,!1);_.push(Y)}else if(U===97&&z("abstract")){if(j+=8,O(),z("class")){let Y=d(J,!0,!0);_.push(Y)}}else{I();let Y=w(J,j),$=C(J);_.push({kind:"export",name:"default",text:Y,isExported:!0,isTypeOnly:!1,leadingComments:$,start:J,end:j})}}else if(X===116&&z("type")){let U=j;if(j+=4,O(),j<K&&Z.charCodeAt(j)===123){Bj();let Y=w(J,j),$=C(J);_.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,leadingComments:$,start:J,end:j})}else if(j<K&&Z.charCodeAt(j)===42){Gj();let Y=w(J,j);_.push({kind:"export",name:"",text:Y,isExported:!0,isTypeOnly:!0,start:J,end:j})}else{j=U;let Y=$j(J,!0);_.push(Y)}}else if(X===105&&z("interface")){let U=Zj(J,!0);_.push(U)}else if(X===102&&z("function")){let U=n(J,!0,!1,!1);if(U)_.push(U)}else if(X===97&&z("async"))if(j+=5,O(),z("function")){let U=n(J,!0,!0,!1);if(U)_.push(U)}else I();else if(X===99)if(z("class")){let U=d(J,!0,!1);_.push(U)}else if(z("const")){let U=j;if(j+=5,O(),z("enum")){j=U+5,O();let Y=r(J,!0,!0);_.push(Y)}else{j=U;let Y=t(J,"const",!0);for(let $=0;$<Y.length;$++)_.push(Y[$])}}else I();else if(X===97&&z("abstract")){if(j+=8,O(),z("class")){let U=d(J,!0,!0);_.push(U)}}else if(X===108&&z("let")){let U=t(J,"let",!0);for(let Y=0;Y<U.length;Y++)_.push(U[Y])}else if(X===118&&z("var")){let U=t(J,"var",!0);for(let Y=0;Y<U.length;Y++)_.push(U[Y])}else if(X===101&&z("enum")){let U=r(J,!0,!1);_.push(U)}else if(X===100&&z("declare"))j+=7,O(),Mj(J,!0);else if(X===110&&z("namespace")){let U=i(J,!0,"namespace");_.push(U)}else if(X===109&&z("module")){let U=i(J,!0,"module");_.push(U)}else if(X===123){Bj();let U=w(J,j),Y=U.includes("export type"),$=C(J);_.push({kind:"export",name:"",text:U,isExported:!0,isTypeOnly:Y,leadingComments:$,start:J,end:j})}else if(X===42){Gj();let U=w(J,j),Y=C(J),$,F=U.indexOf("from ");if(F!==-1){let q=F+5;while(q<U.length&&(U.charCodeAt(q)===32||U.charCodeAt(q)===9))q++;if(q<U.length){let V=U.charCodeAt(q);if(V===39||V===34){let Q=U.indexOf(U[q],q+1);if(Q!==-1)$=U.slice(q+1,Q)}}}_.push({kind:"export",name:"",text:U,isExported:!0,isTypeOnly:!1,source:$,leadingComments:Y,start:J,end:j})}else{I();let U=w(J,j);if(U)_.push({kind:"export",name:"",text:U,isExported:!0,start:J,end:j})}}else if(H===100&&z("declare"))j+=7,O(),Mj(J,!1);else if(H===105&&z("interface")){let X=Zj(J,!1);b.set(X.name,X)}else if(H===116&&z("type")){let X=$j(J,!1);b.set(X.name,X),_.push(X)}else if(H===102&&z("function"))I();else if(H===97)if(z("async"))I();else if(z("abstract"))if(j+=8,O(),z("class")){let X=d(J,!1,!1);b.set(X.name,X),_.push(X)}else I();else j++,I();else if(H===99)if(z("class")){let X=d(J,!1,!1);b.set(X.name,X),_.push(X)}else if(z("const")){let X=j;if(j+=5,O(),z("enum")){j=X+5,O();let U=r(J,!1,!0);b.set(U.name,U),_.push(U)}else j=X,I()}else j++,I();else if(H===101&&z("enum")){let X=r(J,!1,!1);b.set(X.name,X),_.push(X)}else if(H===108&&z("let"))I();else if(H===118&&z("var"))I();else if(H===109&&z("module")){let X=i(J,!1,"module");_.push(X)}else if(H===110&&z("namespace")){let X=i(J,!1,"namespace");_.push(X)}else{let X=Z.charCodeAt(j);if(X===39||X===34){if(l(X),j<K&&Z.charCodeAt(j)===59)j++}else if(X===96){if(jj(),j<K&&Z.charCodeAt(j)===59)j++}else if(X===64){if(j++,E(),O(),j<K&&Z.charCodeAt(j)===46)j++,E(),O();if(j<K&&Z.charCodeAt(j)===40)A(40,41)}else j++,I()}}if(b.size>0)uj(_,b);if(x.size>0){let J=new Map;for(let X of _)if(X.kind==="function")J.set(X.name,(J.get(X.name)||0)+1);let H=new Set;for(let[X,U]of J)if(U>1)H.add(X);if(H.size>0){let X=new Set;for(let U of H)for(let Y=_.length-1;Y>=0;Y--)if(_[Y].kind==="function"&&_[Y].name===U&&x.has(Y)){X.add(Y);break}if(X.size>0){let U=[...X].sort((Y,$)=>$-Y);for(let Y of U)_.splice(Y,1)}}}return _;function Mj(J,H){if(z("function")){let X=n(J,H,!1,!1);if(X)_.push(X)}else if(z("async")){if(j+=5,O(),z("function")){let X=n(J,H,!0,!1);if(X)_.push(X)}}else if(z("class")){let X=d(J,H,!1);_.push(X)}else if(z("abstract")){if(j+=8,O(),z("class")){let X=d(J,H,!0);_.push(X)}}else if(z("interface")){let X=Zj(J,H);_.push(X)}else if(z("type")){let X=$j(J,H);_.push(X)}else if(z("enum")){let X=r(J,H,!1);_.push(X)}else if(z("const")){let X=j;if(j+=5,O(),z("enum")){j=X+5,O();let U=r(J,H,!0);_.push(U)}else if(H){j=X;let U=t(J,"const",!0);for(let Y=0;Y<U.length;Y++)_.push(U[Y])}else I()}else if(z("let")||z("var"))if(H){let X=z("let")?"let":"var",U=t(J,X,!0);for(let Y=0;Y<U.length;Y++)_.push(U[Y])}else I();else if(z("module")){let X=i(J,H,"module");_.push(X)}else if(z("namespace")){let X=i(J,H,"namespace");_.push(X)}else if(z("global")){j+=6,O();let U=`declare global ${j<K&&Z.charCodeAt(j)===123?zj():"{}"}`,Y=C(J);_.push({kind:"module",name:"global",text:U,isExported:!1,leadingComments:Y,start:J,end:j})}else I()}}function Pj(g,e){let T=0,h=g.length;while(T<h){let Z=g.charCodeAt(T);if(Z>=65&&Z<=90||Z>=97&&Z<=122||Z===95||Z===36||Z>127){let a=T;T++;while(T<h){let P=g.charCodeAt(T);if(P>=65&&P<=90||P>=97&&P<=122||P>=48&&P<=57||P===95||P===36||P>127)T++;else break}e.add(g.substring(a,T))}else T++}}function uj(g,e){let T=new Set,h=new Set;for(let P of g)h.add(P.name);let Z=new Set,a=[];for(let P=0;P<g.length;P++)if(g[P].kind!=="import")a.push(g[P].text),Pj(g[P].text,Z);for(;;){let P=[];for(let[b,x]of e){if(T.has(b))continue;if(Z.has(b)){if(!h.has(b))P.push(x),h.add(b);T.add(b)}}if(P.length===0)break;P.sort((b,x)=>(b.start??1/0)-(x.start??1/0));let K=[],_=0;for(let b=0;b<g.length;b++){let x=g[b].start??1/0;while(_<P.length&&(P[_].start??1/0)<=x)K.push(P[_++]);K.push(g[b])}while(_<P.length)K.push(P[_++]);g.length=0;for(let b=0;b<K.length;b++)g.push(K[b]);for(let b of P)if(b.kind!=="import")a.push(b.text),Pj(b.text,Z)}}
export{xj as nc};
