code-playpad 0.5.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * code-playpad — MIT © 2026 Seung Hun Lee
3
+ * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
+ * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
+ */
6
+ import{t as e}from"./worker-runtime-CNPpMRo1.js";var t='"use strict";(()=>{function Qs(i,t){let e=[0];for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);s===13?(t.charCodeAt(n+1)===10&&n++,e.push(n+1)):s===10&&e.push(n+1)}return{name:i,text:t,lineStarts:e}}function cs(i,t){let e=i.lineStarts,n=0,s=e.length-1;for(;n<s;){let r=n+s+1>>1;e[r]<=t?n=r:s=r-1}return{line:n+1,column:t-e[n]+1}}function hi(i,t){let e=i.lineStarts[t-1];if(e===void 0)return"";let n=i.lineStarts[t],s=n===void 0?i.text.length:n;for(;s>e&&(i.text.charCodeAt(s-1)===10||i.text.charCodeAt(s-1)===13);)s--;return i.text.slice(e,s)}var k={syntax:"syntax",unsupported:"unsupported",limit:"limit",cantResolve:"cant-resolve",incompatibleTypes:"incompatible-types",badOperands:"bad-operands",alreadyDefined:"already-defined",uninitialized:"var-might-not-have-been-initialized",unreported:"unreported-exception",notEffectivelyFinal:"not-effectively-final",unreachable:"unreachable",missingReturn:"missing-return",finalAssign:"final-assign",notStatement:"not-a-statement",numberTooLarge:"int-number-too-large",noMain:"no-main",unchecked:"unchecked",deprecation:"deprecation"},ln=class{items=[];error(t,e,n,s,r,a){let{line:o,column:c}=cs(t,e),u={code:s,phase:n,severity:"error",file:t.name,line:o,column:c,message:r,offset:e};return a&&a.length&&(u.details=a),this.items.push(u),u}warning(t,e,n,s,r){let a=this.error(t,e,"type",n,s,r);return a.severity="warning",a}launchError(t,e,n){let s={code:e,phase:"launch",severity:"error",file:t,line:0,column:0,message:n};return this.items.push(s),s}get hasErrors(){return this.items.some(t=>t.severity==="error")}};function Zs(i,t){let e=i.filter(o=>o.phase!=="launch"),n=i.filter(o=>o.phase==="launch"),s=[];for(let o of e){s.push(`${o.file}:${o.line}: ${o.severity}: ${o.message}`);let c=t.get(o.file);if(c&&o.line>0){let u=hi(c,o.line);s.push(u);let d="";for(let h=0;h<o.column-1;h++)d+=u[h]===" "?" ":" ";s.push(d+"^")}for(let u of o.details??[])s.push(u)}let r=e.filter(o=>o.severity==="error").length,a=e.filter(o=>o.severity==="warning").length;r&&s.push(r===1?"1 error":`${r} errors`),a&&s.push(a===1?"1 warning":`${a} warnings`),r&&s.push("error: compilation failed");for(let o of n)s.push(o.text??`error: ${o.message}`);return s.join(`\n`)+`\n`}function To(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function di(i){if(i.indexOf("\\\\u")===-1){let a=new Int32Array(i.length+1);for(let o=0;o<=i.length;o++)a[o]=o;return{text:i,offsets:a,errors:[]}}let t=[],e=[],n=[],s=0,r=0;for(;r<i.length;){let a=i.charCodeAt(r);if(a===92&&s%2===0&&i.charCodeAt(r+1)===117){let o=r+1;for(;i.charCodeAt(o)===117;)o++;let c=0,u=-1;for(let d=0;d<4;d++){let h=To(i.charCodeAt(o+d));if(h<0){u=o+d;break}c=c*16+h}if(u>=0){n.push({offset:u,message:"illegal unicode escape"}),t.push("\\\\"),e.push(r),s=1,r++;continue}t.push(String.fromCharCode(c)),e.push(r),s=0,r=o+4;continue}s=a===92?s+1:0,t.push(i[r]),e.push(r),r++}return e.push(i.length),{text:t.join(""),offsets:Int32Array.from(e),errors:n}}var So=new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while","_","true","false","null"]),xo=[">>>=","<<=",">>=",">>>","...","->","::","++","--","&&","||","==","!=","<=",">=","+=","-=","*=","/=","&=","|=","^=","%=","<<",">>","(",")","{","}","[","]",";",",",".","@","=",">","<","!","~","?",":","+","-","*","/","&","|","^","%"];function fi(i){return i>=65&&i<=90||i>=97&&i<=122||i===95||i===36}function mi(i){return fi(i)||i>=48&&i<=57}function ce(i){return i>=48&&i<=57}function vo(i){let t=i.charCodeAt(0);return t>=32&&t<127?`\'${i}\'`:`\'\\\\u${t.toString(16).padStart(4,"0")}\'`}function pi(i){let t=di(i),e=t.text,n=t.offsets,s=[],r=t.errors.map(v=>({offset:v.offset,code:"syntax",message:v.message}));if(r.length)return{tokens:[{kind:"eof",text:"",start:i.length,end:i.length}],errors:r};let a=(v,x,C="syntax")=>{r.push({offset:n[v],code:C,message:x})},o=(v,x,C,E)=>{s.push({kind:v,text:e.slice(x,C),start:n[x],end:n[C],...E})},c=e.length;c>0&&e.charCodeAt(c-1)===26&&c--;let u=0;for(;u<c;){let v=e.charCodeAt(u);if(v===32||v===9||v===12||v===10||v===13){u++;continue}if(v===47&&e.charCodeAt(u+1)===47){for(;u<c&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;continue}if(v===47&&e.charCodeAt(u+1)===42){let C=e.indexOf("*/",u+2);if(C===-1||C+2>c){a(u,"unclosed comment"),u=c;break}u=C+2;continue}if(fi(v)){let C=u;for(;u<c&&mi(e.charCodeAt(u));)u++;if(u<c&&e.charCodeAt(u)>127&&/[\\p{L}\\p{Nl}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\p{Sc}]/u.test(e[u]))for(a(u,"identifiers containing non-ASCII characters are not supported in this version","unsupported");u<c&&(mi(e.charCodeAt(u))||e.charCodeAt(u)>127);)u++;let E=e.slice(C,u);o(So.has(E)?"keyword":"identifier",C,u);continue}if(ce(v)||v===46&&ce(e.charCodeAt(u+1))){u=d(u);continue}if(v===39){u=m(u);continue}if(v===34){e.startsWith(\'"""\',u)?u=b(u):u=p(u);continue}let x=xo.find(C=>e.startsWith(C,u));if(x){o("operator",u,u+x.length),u+=x.length;continue}v>127&&/[\\p{L}\\p{Nl}\\p{Sc}\\p{Pc}]/u.test(e[u])?a(u,"identifiers containing non-ASCII characters are not supported in this version","unsupported"):a(u,`illegal character: ${vo(e[u])}`),u++}return s.push({kind:"eof",text:"",start:n[c],end:n[c]}),{tokens:s,errors:r};function d(v){let x=P=>P<c?e.charCodeAt(P):-1,C=P=>x(P)|32,E=P=>ce(P)||(P|32)>=97&&(P|32)<=102,R=(P,j)=>{let G=P;for(;G<c&&(j(x(G))||x(G)===95);)G++;return G>P&&x(G-1)===95?(a(G-1,"illegal underscore"),null):G},L=(P,j,G)=>{let tt=e.slice(G,P).replace(/_/g,""),be=BigInt((j===16?"0x":j===8?"0o":j===2?"0b":"")+(tt||"0"));return(x(P)|32)===108?(o("long-literal",v,P+1,{integer:{value:be,radix:j}}),P+1):(o("int-literal",v,P,{integer:{value:be,radix:j}}),P)},I=(P,j)=>{if(C(P)!==j)return P;let G=P+1;return(x(G)===43||x(G)===45)&&G++,ce(x(G))?R(G,ce):(a(v,"malformed floating-point literal"),null)},N=P=>{let j=C(P);return j===102?(o("float-literal",v,P+1),P+1):j===100?(o("double-literal",v,P+1),P+1):(o("double-literal",v,P),P)};if(x(v)===48&&C(v+1)===120){let P=v+2;if(x(P)===95)return a(P,"illegal underscore"),P+1;let j=R(P,E);if(j===null)return c;let G=j>P;if(x(j)===46||C(j)===112){if(x(j)===46){let Wt=R(j+1,E);if(Wt===null)return c;if(!G&&Wt===j+1)return a(v,"hexadecimal numbers must contain at least one hexadecimal digit"),Wt;j=Wt}if(C(j)!==112)return a(v,"malformed floating-point literal"),j;let tt=I(j,112);return tt===null?c:N(tt)}return G?L(j,16,P):(a(v,"hexadecimal numbers must contain at least one hexadecimal digit"),j)}if(x(v)===48&&C(v+1)===98){let P=v+2;if(x(P)===95)return a(P,"illegal underscore"),P+1;let j=R(P,ce);return j===null?c:j===P?(a(v,"binary numbers must contain at least one binary digit"),j):/[2-9]/.test(e.slice(P,j))?(a(v,"illegal digit in a binary literal"),j):L(j,2,P)}let J=v;if(ce(x(v))&&(J=R(v,ce),J===null))return c;if(x(J)===46&&(J>v||ce(x(J+1)))||C(J)===101||C(J)===102||C(J)===100)return x(J)===46&&(J=ce(x(J+1))?R(J+1,ce):J+1,J===null)?c:(J=I(J,101),J===null?c:N(J));if(x(v)===48&&J>v+1){for(let P=v+1;P<J;P++)if(x(P)===56||x(P)===57)return a(P,"illegal digit in an octal literal"),J;return L(J,8,v+1)}return L(J,10,v)}function h(v){let x=e[v+1];switch(x){case"b":return["\\b",v+2];case"s":return[" ",v+2];case"t":return[" ",v+2];case"n":return[`\n`,v+2];case"f":return["\\f",v+2];case"r":return["\\r",v+2];case\'"\':return[\'"\',v+2];case"\'":return["\'",v+2];case"\\\\":return["\\\\",v+2]}if(x!==void 0&&x>="0"&&x<="7"){let C=x<="3"?3:2,E=v+1,R="";for(;R.length<C&&E<c&&e[E]>="0"&&e[E]<="7";)R+=e[E++];return[String.fromCharCode(parseInt(R,8)),E]}return null}function m(v){let x=v+1,C="";for(;x<c;){let E=e.charCodeAt(x);if(E===39)break;if(E===10||E===13)return a(v,"unclosed character literal"),x;if(E===92){let R=h(x);if(!R)return a(x+1,"illegal escape character"),S(x);C+=R[0],x=R[1];continue}C+=e[x],x++}return x>=c?(a(v,"unclosed character literal"),x):C.length===0?(a(v,"empty character literal"),x+1):C.length>1?(a(v,"unclosed character literal"),x+1):(o("char-literal",v,x+1,{stringValue:C}),x+1)}function p(v){let x=v+1,C="";for(;x<c;){let E=e.charCodeAt(x);if(E===34)return o("string-literal",v,x+1,{stringValue:C}),x+1;if(E===10||E===13)break;if(E===92){let R=h(x);if(!R)return a(x+1,"illegal escape character"),S(x);C+=R[0],x=R[1];continue}C+=e[x],x++}return a(v,"unclosed string literal"),x}function b(v){let x=v+3;for(;x<c&&(e[x]===" "||e[x]===" "||e[x]==="\\f");)x++;if(x<c&&e[x]!==`\n`&&e[x]!=="\\r")return a(x,"illegal text block open delimiter sequence, missing line terminator"),x;if(x>=c)return a(v,"unclosed text block"),c;x+=e[x]==="\\r"&&e[x+1]===`\n`?2:1;let C=x;for(;x<c;){if(e.charCodeAt(x)===92){let R=e[x+1];if(R===`\n`||R==="\\r"){x+=R==="\\r"&&e[x+2]===`\n`?3:2;continue}let L=h(x);if(!L){a(x+1,"illegal escape character"),x+=2;continue}x=L[1];continue}if(e.startsWith(\'"""\',x))return o("text-block",v,x+3,{stringValue:wo(e.slice(C,x))}),x+3;x++}return a(v,"unclosed text block"),c}function S(v){for(;v<c&&e.charCodeAt(v)!==10&&e.charCodeAt(v)!==13;)v++;return v}}var tr=/[\\t\\x0b\\f\\x1c-\\x20\\u1680\\u2000-\\u2006\\u2008-\\u200a\\u2028\\u2029\\u205f\\u3000]/;function wo(i){let t=i.replace(/\\r\\n?/g,`\n`).split(`\n`),e=a=>[...a].every(o=>tr.test(o)),n=a=>{let o=0;for(;o<a.length&&tr.test(a[o]);)o++;return o},s=1/0;t.forEach((a,o)=>{(!e(a)||o===t.length-1)&&(s=Math.min(s,n(a)))});let r=t.map(a=>{if(e(a))return"";let o=a.length;for(;o>0&&tr.test(a[o-1]);)o--;return a.slice(s,o)});return ko(r.join(`\n`))}function ko(i){if(!i.includes("\\\\"))return i;let t="";for(let e=0;e<i.length;e++){let n=i[e];if(n!=="\\\\"){t+=n;continue}let s=i[++e];switch(s){case`\n`:continue;case"b":t+="\\b";continue;case"s":t+=" ";continue;case"t":t+=" ";continue;case"n":t+=`\n`;continue;case"f":t+="\\f";continue;case"r":t+="\\r";continue}if(s>="0"&&s<="7"){let r=s<="3"?3:2,a="";for(;a.length<r&&e<i.length&&i[e]>="0"&&i[e]<="7";)a+=i[e++];e--,t+=String.fromCharCode(parseInt(a,8));continue}t+=s}return t}var cn=Number.MAX_SAFE_INTEGER,nr=9223372036854775807n,sr=-9223372036854775808n,yi=9223372036854776e3;function wt(i){let t=BigInt.asIntN(64,i);return t>=-9007199254740991n&&t<=9007199254740991n?Number(t):t}var It=i=>typeof i=="bigint"?i:BigInt(i),un=i=>i===0?0:i;function gi(i,t){if(typeof i=="number"&&typeof t=="number"){let e=i+t;if(e<=cn&&e>=-cn)return e}return wt(It(i)+It(t))}function bi(i,t){if(typeof i=="number"&&typeof t=="number"){let e=i-t;if(e<=cn&&e>=-cn)return e}return wt(It(i)-It(t))}function Ti(i,t){if(typeof i=="number"&&typeof t=="number"){let e=i*t;if(e<=cn&&e>=-cn)return un(e)}return wt(It(i)*It(t))}function Si(i,t){return typeof i=="number"&&typeof t=="number"?un(Math.trunc(i/t)):wt(It(i)/It(t))}function xi(i,t){return typeof i=="number"&&typeof t=="number"?un(i%t):wt(It(i)%It(t))}function rr(i){return typeof i=="number"?un(-i):wt(-i)}function vi(i,t){return wt(It(i)<<BigInt(t&63))}function wi(i,t){return wt(It(i)>>BigInt(t&63))}function ki(i,t){return wt(BigInt.asUintN(64,It(i))>>BigInt(t&63))}function Ci(i,t){return wt(It(i)&It(t))}function Ei(i,t){return wt(It(i)|It(t))}function Ai(i,t){return wt(It(i)^It(t))}function ds(i){return typeof i=="number"?i|0:Number(BigInt.asIntN(32,i))}function ms(i){return Number(i)}function hn(i){if(typeof i=="number")return Math.fround(i);let t=i<0n,e=t?-i:i,n=e.toString(2).length;if(n>26){let s=BigInt(n-26),r=(e&(1n<<s)-1n)!==0n?1n:0n;e=e>>s<<1n|r;let a=Math.fround(Number(e)*2**(n-27));return t?-a:a}return Math.fround(Number(i))}function $n(i){if(Number.isNaN(i))return 0;if(i>=yi)return nr;if(i<=-yi)return sr;let t=Math.trunc(i);return Number.isSafeInteger(t)?un(t):BigInt(t)}function Mn(i){return Number.isNaN(i)?0:i>=2147483647?2147483647:i<=-2147483648?-2147483648:un(Math.trunc(i))}function Ii(i){return Number.isNaN(i)?0:Mn(Math.abs(i)>=8388608?i:Math.floor(i+.5))}function Oi(i){return $n(Math.round(i))}function Co(i,t,e,n){if(n){if(t=t.replace(/0+$/,"")||"0",e>=0){let s=t.slice(0,e+1).padEnd(e+1,"0"),r=t.slice(e+1)||"0";return`${i}${s}.${r}`}return`${i}0.${"0".repeat(-e-1)}${t}`}return`${i}${t[0]}.${t.slice(1).replace(/0+$/,"")||"0"}E${e}`}var us=new DataView(new ArrayBuffer(4));function Li(i){return us.setFloat32(0,i),us.getInt32(0)}function fs(i){return Number.isNaN(i)?2143289344:Li(i)}function Ni(i){return us.setInt32(0,i),us.getFloat32(0)}var hs=i=>10n**BigInt(i);function Je(i){if(Number.isNaN(i))return"NaN";if(i===1/0)return"Infinity";if(i===-1/0)return"-Infinity";if(i===0)return Object.is(i,-0)?"-0.0":"0.0";let t=Li(i),e=t>>>23&255,n=t&8388607,s=BigInt(e===0?n:n|8388608),r=e===0?-149:e-150,a=Math.max(0,2-r),o=(L,I)=>I>=0?L<<BigInt(I):L>>BigInt(-I),c=o(s,r+a),u=o(2n*s+1n,r-1+a),d=n===0&&e>1?o(4n*s-1n,r-2+a):o(2n*s-1n,r-1+a),h=(s&1n)===0n,m=1n<<BigInt(a),p=L=>L<0?{A:hs(-L),B:m}:{A:1n,B:hs(L)*m},b=L=>{let{A:I,B:N}=p(L),J=d*I,D=u*I,P=(J+N-1n)/N;!h&&P*N===J&&P++;let j=D/N;return!h&&j*N===D&&j--,{dLo:P,dHi:j,A:I,B:N}},S=L=>{let{dLo:I,dHi:N,A:J,B:D}=b(L);if(I>N)return null;let P=c*J,j=P/D,G=2n*P,tt=(2n*j+1n)*D;return(G>tt||G===tt&&(j&1n)===1n)&&j++,j<I&&(j=I),j>N&&(j=N),j},v=Math.floor(Math.log10(Math.abs(i)))+2,x=S(v);for(;x===null;)x=S(--v);x<10n&&(v--,x=S(v));let C=x.toString(),E=v+C.length-1,R=Math.abs(i);return Co(i<0?"-":"",C,E,R>=.001&&R<1e7)}function Eo(i,t,e){let n=o=>e?-o:o;if(i===0n)return n(0);let s=i.toString().length;if(s+t<-46)return n(0);if(s+t-1>39)return n(1/0);let r=t>=0?i*hs(t):i,a=t>=0?1n:hs(-t);return n(er(r,a))}function er(i,t){let e=s=>s.toString(2).length,n=e(i)-e(t)-24;for(;;){n<-149&&(n=-149);let s=n>=0?i:i<<BigInt(-n),r=n>=0?t<<BigInt(n):t,a=s/r;if(a>=1n<<24n){n++;continue}if(a<1n<<23n&&n>-149){n--;continue}let o=s-a*r;return(2n*o>r||2n*o===r&&(a&1n)===1n)&&a++,a===1n<<24n&&(a=1n<<23n,n++),n>104?1/0:Number(a)*2**n}}function $i(i,t){return i===0n?0:t>=0?er(i<<BigInt(t),1n):er(i,1n<<BigInt(-t))}function Mi(i){let t=i.replace(/_/g,"").replace(/[fF]$/,""),e,n;if(/^0[xX]/.test(t)){let s=/^0[xX]([0-9a-fA-F]*)(?:\\.([0-9a-fA-F]*))?[pP]([+-]?\\d+)$/.exec(t),r=s[1]??"",a=s[2]??"",o=BigInt("0x"+(r+a||"0"));n=o!==0n,e=$i(o,Number(s[3])-4*a.length)}else e=ir(t),n=/[1-9]/.test(t.replace(/[eE].*$/,""));return e===1/0?{error:"too-large"}:e===0&&n?{error:"too-small"}:{value:e}}function Pi(i,t){let e=/^([+-]?)0[xX]([0-9a-fA-F]*)(?:\\.([0-9a-fA-F]*))?[pP]([+-]?\\d+)[fFdD]?$/.exec(i);if(!e||!(e[2]||e[3]))return NaN;let n=e[3]??"",s=BigInt("0x"+((e[2]??"")+n||"0")),r=Math.max(-1e5,Math.min(1e5,Number(e[4])))-4*n.length,a=t?$i(s,r):Ji(s,r);return e[1]==="-"?-a:a}function ir(i){let t=/^([+-]?)(\\d*)(?:\\.(\\d*))?(?:[eE]([+-]?\\d+))?$/.exec(i);if(!t)return NaN;let e=t[2]??"",n=t[3]??"",s=BigInt((e+n).replace(/^0+(?=\\d)/,"")||"0"),r=Math.max(-1e5,Math.min(1e5,Number(t[4]??"0")))-n.length;return Eo(s,r,t[1]==="-")}function ue(i){if(Number.isNaN(i))return"NaN";if(i===1/0)return"Infinity";if(i===-1/0)return"-Infinity";if(i===0)return Object.is(i,-0)?"-0.0":"0.0";let t=i<0?"-":"",e=Math.abs(i),[n,s]=e.toExponential().split("e");n.includes(".")||([n,s]=e.toExponential(1).split("e"));let r=n.replace(".",""),a=Number(s);if(e>=.001&&e<1e7){if(r=r.replace(/0+$/,"")||"0",a>=0){let o=r.slice(0,a+1).padEnd(a+1,"0"),c=r.slice(a+1)||"0";return`${t}${o}.${c}`}return`${t}0.${"0".repeat(-a-1)}${r}`}return`${t}${r[0]}.${r.slice(1)||"0"}E${a}`}function Ri(i){let t=i.replace(/_/g,"").replace(/[dD]$/,""),e,n;if(/^0[xX]/.test(t)){let s=/^0[xX]([0-9a-fA-F]*)(?:\\.([0-9a-fA-F]*))?[pP]([+-]?\\d+)$/.exec(t),r=s[1]??"",a=s[2]??"",o=BigInt("0x"+(r+a||"0"));n=o!==0n,e=Ji(o,Number(s[3])-4*a.length)}else e=Number(t),n=/[1-9]/.test(t.replace(/[eE].*$/,""));return e===1/0?{error:"too-large"}:e===0&&n?{error:"too-small"}:{value:e}}function Ji(i,t){if(i===0n)return 0;let e=i.toString(2).length,n=i,s=t;if(e>64){let r=BigInt(e-64),a=(n&(1n<<r)-1n)!==0n?1n:0n;n=n>>r|a,s+=e-64}return Number(n)*2**s}function ar(i){return i.kind==="Assignment"||i.kind==="IncDec"||i.kind==="MethodCall"||i.kind==="NewObject"}var _t=class extends Error{info;constructor(t){super(t.message),this.info=t}},qe=new Set(["int","boolean","byte","short","long","char","float","double"]),Di=new Set(["public","protected","private","static","final","abstract","native","synchronized","transient","volatile","strictfp","default"]),Ao={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,">":7,"<=":7,">=":7,instanceof:7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},ji=new Set(["=","+=","-=","*=","/=","%=","&=","|=","^=","<<=",">>=",">>>="]),Io={synchronized:"\'synchronized\' statements"},Oo=new Set(["(","!","~","this","super","new","true","false","null","switch"]);function Fi(i,t,e){let n=new or(i,t,e);try{return{unit:n.compilationUnit(),error:null}}catch(s){if(s instanceof _t)return{unit:null,error:s.info};throw s}}var or=class{#O;#mt;#Mt=[];#D;#j=0;#W=!1;#z=0;constructor(t,e,n){this.#O=t,this.#mt=[...e],this.#D=n}#r(t=0){return this.#mt[Math.min(this.#j+t,this.#mt.length-1)]}#y(){return this.#mt[Math.max(this.#j-1,0)]}#s(){let t=this.#r();return this.#j<this.#mt.length-1&&this.#j++,t}#n(t,e=0){let n=this.#r(e);return(n.kind==="operator"||n.kind==="keyword")&&n.text===t}#g(t=0,e){let n=this.#r(t);return n.kind==="identifier"&&(e===void 0||n.text===e)}#h(t){return this.#n(t)?(this.#s(),!0):!1}#i(t){if(this.#n(t))return this.#s();throw this.#r().kind==="eof"&&t==="}"&&this.#H(),this.#c(this.#y().end,`\'${t}\' expected`)}#w(){let t=this.#r();if(t.kind==="identifier")return this.#s();throw t.kind==="keyword"&&t.text==="_"?this.#C(t.start,"the unnamed variable \'_\'",!0):(t.kind==="eof"&&this.#H(),this.#c(t.kind==="keyword"?t.start:this.#y().end,"<identifier> expected"))}#H(){throw this.#c(this.#y().end,"reached end of file while parsing")}#c(t,e){return new _t({offset:t,code:"syntax",message:e})}#C(t,e,n=!1){return new _t({offset:t,code:"unsupported",message:`${e} ${n?"is":"are"} not supported in this version`})}#L(){return{i:this.#j,splits:this.#Mt.length}}#F(t){for(;this.#Mt.length>t.splits;){let e=this.#Mt.pop();this.#mt.splice(e.index,2,e.token)}this.#j=t.i}#K(){let t=this.#r();if(t.kind==="operator"&&t.text===">"){this.#s();return}if(t.kind==="operator"&&(t.text===">>"||t.text===">>>"||t.text===">="||t.text===">>=")){let e={...t,text:">",end:t.start+1},n={...t,text:t.text.slice(1),start:t.start+1};this.#Mt.push({index:this.#j,token:t}),this.#mt.splice(this.#j,1,e,n),this.#s();return}throw t.kind==="eof"&&this.#H(),this.#c(t.start,"\'>\' expected")}#ft(){this.#i("<");let t=[];do{let e=this.#r();if(e.kind==="operator"&&e.text==="@")throw this.#C(e.start,"annotations");let n=this.#w(),s=[];if(this.#h("extends"))do s.push(this.#m());while(this.#h("&"));t.push({name:n.text,pos:n.start,bounds:s})}while(this.#h(","));return this.#K(),t}#bt(){if(this.#i("<"),this.#h(">"))return"diamond";let t=[];do{let e=this.#r();if(e.kind==="operator"&&e.text==="@")throw this.#C(e.start,"annotations");if(this.#h("?")){let n=null,s=!1;this.#h("extends")?n=this.#m():this.#h("super")&&(s=!0,n=this.#m()),t.push({kind:"WildcardType",bound:n,isSuper:s,pos:e.start,start:e.start,end:this.#y().end})}else t.push(this.#m())}while(this.#h(","));return this.#K(),t}#at(){if(++this.#z>this.#D.maxNestingDepth)throw new _t({offset:this.#r().start,code:"limit",message:`code is nested too deeply for this engine (limit ${this.#D.maxNestingDepth})`})}#$(){this.#z--}#N(t,...e){let n=0;for(let s of e)n=Math.max(n,s.depth);if(t.depth=n+1,t.depth>this.#D.maxExpressionDepth)throw new _t({offset:t.start,code:"limit",message:`expression is nested too deeply for this engine (limit ${this.#D.maxExpressionDepth})`});return t}compilationUnit(){let t={file:this.#O,imports:[],types:[]},e=[];if(this.#n("package"))throw this.#C(this.#r().start,"package declarations");for(;this.#n("import");)t.imports.push(this.#gt());for(;this.#r().kind!=="eof";){if(this.#h(";"))continue;let n=this.#r().start;if(this.#n("import"))throw this.#a(t,e);let s=this.#E();if(this.#n("class")||this.#n("interface")){t.types.push(this.#Bt(s,n));continue}if(this.#n("enum")){t.types.push(this.#k(s,n));continue}if(this.#n("@")&&this.#n("interface",1))throw this.#C(this.#r().start,"annotation interface declarations");if(this.#g(0,"record")&&this.#g(1)&&(this.#n("(",2)||this.#n("<",2))){t.types.push(this.#P(s,n));continue}if(this.#l()){e.push(this.#t(s,n,null));continue}throw this.#a(t,e)}if(e.length){let n=[...e,...t.types].sort((a,o)=>a.start-o.start),s=n[0],r=this.#O.replace(/^.*[\\\\/]/,"").replace(/\\.java$/,"");t.types=[{kind:"ClassDeclaration",keyword:"class",extendsTypes:[],implementsTypes:[],modifiers:{keywords:[]},name:r,namePos:s.start,keywordPos:s.start,members:n,implicit:!0,pos:s.start,start:s.start,end:n[n.length-1].end}]}return t}#gt(){let t=this.#i("import"),e=this.#n("static");e&&this.#s();let n=[this.#w().text],s=t.start,r=[],a=!1,o=this.#y().start;for(;this.#n(".");){if(s=this.#s().start,r.push(s),this.#n("*")){o=this.#s().start,a=!0;break}let u=this.#w();n.push(u.text),o=u.start}let c=this.#i(";");return{names:n,onDemand:a,lastDotPos:s,dots:r,...e?{isStatic:!0}:{},pos:o,start:t.start,end:c.end}}#a(t,e){let n=this.#mt.some(s=>s.kind==="keyword"&&(s.text==="class"||s.text==="interface"||s.text==="enum"));return!t.types.length&&!e.length&&!n?new _t({offset:0,code:"no-class",message:"no class declared in source file"}):this.#c(this.#r().start,"class, interface, annotation type, enum, record, method or field expected")}#l(){let t=this.#L();try{if(this.#n("<"))try{this.#ft()}catch{return!1}if(this.#n("void"))this.#s();else if(!this.#S())return!1;return this.#g()?(this.#s(),this.#n("(")||this.#n("=")||this.#n(";")||this.#n(",")):!1}finally{this.#F(t)}}#E(){let t={keywords:[]};for(;;){let e=this.#r();if(e.kind==="operator"&&e.text==="@"){if(this.#n("interface",1))return t;(t.annotations??=[]).push(this.#nt());continue}if(e.kind==="keyword"&&Di.has(e.text)){if(t.keywords.some(n=>n.name===e.text))throw this.#c(e.start,"repeated modifier");t.keywords.push({name:e.text,pos:e.start}),this.#s();continue}if(e.kind==="identifier"){let n=a=>this.#n("class",a)||this.#n("interface",a)||this.#g(a,"sealed")||this.#g(a,"non")||this.#n("abstract",a)||this.#r(a).kind==="keyword"&&Di.has(this.#r(a).text),s=e.text==="sealed"&&n(1),r=e.text==="non"&&this.#n("-",1)&&this.#g(2,"sealed")&&this.#r(1).start===e.end&&this.#r(2).start===this.#r(1).end&&n(3);if(s||r){let a=s?"sealed":"non-sealed";if(t.keywords.some(o=>o.name===a))throw this.#c(e.start,"repeated modifier");t.keywords.push({name:a,pos:e.start}),this.#s(),r&&(this.#s(),this.#s());continue}}return t}}#nt(){let t=this.#i("@"),e=this.#w(),n=[e.text];for(;this.#n(".")&&this.#g(1);)this.#s(),n.push(this.#s().text);let s={name:n[n.length-1],names:n,pos:t.start,namePos:e.start};if(this.#h("(")){let r=[];for(;!this.#n(")");){let a=this.#r().start,o=null;if(this.#g()&&this.#n("=",1)&&(o=this.#s().text,this.#s()),r.push({name:o,value:this.#Xt(),pos:a}),!this.#h(","))break}this.#i(")"),s.args=r}return s}#Xt(){if(this.#n("@"))throw this.#C(this.#r().start,"nested annotations");if(!this.#n("{"))return this.#f();let t=this.#s(),e=[];for(;!this.#n("}")&&(e.push(this.#Xt()),!!this.#h(",")););return this.#i("}"),{kind:"ElementArray",elements:e,pos:t.start}}#_(t,e){for(;!this.#n("}");)this.#r().kind==="eof"&&this.#H(),!this.#h(";")&&t.members.push(this.#R(t.name,e));t.end=this.#i("}").end}#M(t){if(this.#h("implements"))do t.implementsTypes.push(this.#m());while(this.#h(","))}#k(t,e){let n=this.#i("enum"),s=this.#w(),r={kind:"ClassDeclaration",keyword:"enum",extendsTypes:[],implementsTypes:[],enumConstants:[],modifiers:t,name:s.text,namePos:s.start,keywordPos:n.start,members:[],pos:s.start,start:e,end:e};if(this.#n("<"))throw this.#C(this.#r().start,"generic enums");if(this.#n("extends"))throw this.#c(this.#y().end,"\'{\' expected");for(this.#M(r),this.#i("{");this.#g()||this.#n("@");){if(this.#n("@"))throw this.#C(this.#r().start,"annotations");let a=this.#s(),o=this.#n("(")?this.#Dt():[],c;if(this.#n("{")){let u=this.#s();c={kind:"ClassDeclaration",keyword:"class",extendsTypes:[],implementsTypes:[],modifiers:{keywords:[]},name:"",namePos:a.start,keywordPos:a.start,members:[],anonymous:!0,pos:a.start,start:u.start,end:u.start},this.#_(c)}if(r.enumConstants.push({name:a.text,args:o,...c?{body:c}:{},pos:a.start,start:a.start,end:this.#y().end}),!this.#h(","))break}if(!this.#n("}")&&!this.#h(";"))throw this.#c(this.#y().end,"\',\', \'}\', or \';\' expected");return this.#_(r),r}#P(t,e){let n=this.#s(),s=this.#w(),r=this.#n("<")?this.#ft():void 0,a={...r?{typeParams:r}:{},kind:"ClassDeclaration",keyword:"record",extendsTypes:[],implementsTypes:[],components:[],modifiers:t,name:s.text,namePos:s.start,keywordPos:n.start,members:[],pos:s.start,start:e,end:e};if(this.#i("("),!this.#n(")"))do{let o=this.#J();if(o.varargs)throw this.#C(o.pos,"variable-arity record components");a.components.push(o)}while(this.#h(","));if(this.#i(")"),this.#n("extends"))throw this.#c(this.#y().end,"\'{\' expected");return this.#M(a),this.#i("{"),this.#_(a,a.name),a}#Bt(t,e){let n=this.#n("interface"),s=this.#s(),r=this.#w(),a={kind:"ClassDeclaration",keyword:n?"interface":"class",extendsTypes:[],implementsTypes:[],modifiers:t,name:r.text,namePos:r.start,keywordPos:s.start,members:[],pos:r.start,start:e,end:e};if(this.#n("<")&&(a.typeParams=this.#ft()),this.#h("extends"))do a.extendsTypes.push(this.#m());while(n&&this.#h(","));if(this.#n("implements")){if(n)throw this.#c(this.#r().start,"\'{\' expected");this.#s();do a.implementsTypes.push(this.#m());while(this.#h(","))}if(this.#g(0,"permits")){this.#s(),a.permits=[];do a.permits.push(this.#m());while(this.#h(","))}for(this.#i("{");!this.#n("}");)this.#r().kind==="eof"&&this.#H(),!this.#h(";")&&a.members.push(this.#R(a.name));return a.end=this.#i("}").end,a}#R(t,e){let n=this.#r().start;if(this.#n("{")||this.#n("static")&&this.#n("{",1)){let r={keywords:[]};this.#n("static")&&r.keywords.push({name:"static",pos:this.#s().start});let a=this.#pt();return{kind:"Initializer",modifiers:r,isStatic:r.keywords.length>0,body:a,pos:n,start:n,end:a.end}}let s=this.#E();if(this.#n("class")||this.#n("interface"))return this.#Bt(s,n);if(this.#n("enum"))return this.#k(s,n);if(this.#g(0,"record")&&this.#g(1)&&(this.#n("(",2)||this.#n("<",2)))return this.#P(s,n);if(e!==void 0&&this.#g(0,e)&&this.#n("{",1)){let r=this.#s(),a=this.#pt();return{kind:"MethodDeclaration",modifiers:s,returnType:{kind:"VoidType",pos:r.start,start:r.start,end:r.start},name:r.text,namePos:r.start,params:[],body:a,closeBracePos:a.end-1,isConstructor:!0,compact:!0,pos:r.start,start:n,end:a.end}}return this.#t(s,n,t)}#t(t,e,n){if(this.#n("<")){let a=this.#ft(),o=this.#t(t,e,n);if(o.kind!=="MethodDeclaration")throw this.#c(o.pos,"<identifier> expected");return o.typeParams=a,o}if(n!==null&&this.#g()&&this.#n("(",1)){let a=this.#r();if(a.text!==n)throw this.#c(a.start,"invalid method declaration; return type required");this.#s();let o={kind:"VoidType",pos:a.start,start:a.start,end:a.start},c=this.#d(t,o,a,e);return c.isConstructor=!0,c}let s;if(this.#n("void")){let a=this.#s();s={kind:"VoidType",pos:a.start,start:a.start,end:a.end}}else s=this.#m();let r=this.#w();if(!this.#n("(")){if(s.kind!=="VoidType"&&(this.#n("=")||this.#n(";")||this.#n(",")||this.#n("[")))return this.#p(t,s,r,e);throw this.#c(this.#y().end,"\'(\' expected")}return this.#d(t,s,r,e)}#p(t,e,n,s){let r=[],a=n;for(;;){let c=0;for(;this.#n("[")&&this.#n("]",1);)this.#s(),this.#s(),c++;let u=null;if(this.#h("=")&&(u=this.#n("{")?this.#rt():this.#f()),r.push({name:a.text,extraDims:c,init:u,pos:a.start,start:a.start,end:this.#y().end}),!this.#h(","))break;a=this.#w()}let o=this.#i(";");return{kind:"FieldDeclaration",modifiers:t,type:e,declarators:r,pos:n.start,start:s,end:o.end}}#d(t,e,n,s){let r={kind:"MethodDeclaration",modifiers:t,returnType:e,name:n.text,namePos:n.start,params:[],body:null,pos:n.start,start:s,end:s};if(this.#i("("),!this.#n(")"))do{let a=r.params[r.params.length-1];if(a?.varargs)throw this.#c(a.pos,"varargs parameter must be the last parameter");r.params.push(this.#J())}while(this.#h(","));if(this.#i(")"),this.#n("["))throw this.#C(this.#r().start,"array dimensions after a parameter list");if(this.#h("throws")){r.throwsTypes=[];do r.throwsTypes.push(this.#m());while(this.#h(","))}if(this.#h(";"))return r.end=this.#y().end,r;if(!this.#n("{"))throw this.#c(this.#y().end,"\'{\' expected");return r.body=this.#pt(),r.end=r.body.end,r.closeBracePos=r.body.end-1,r}#J(){let t=this.#r().start,e=this.#E(),n=this.#m(),s=!1;this.#h("...")&&(s=!0);let r=this.#w();for(;this.#n("[")&&this.#n("]",1);){let a=this.#s(),o=this.#s();n={kind:"ArrayType",element:n,pos:a.start,start:n.start,end:o.end}}if(s){let a=this.#y().end;n={kind:"ArrayType",element:n,pos:n.pos,start:n.start,end:a}}return{modifiers:e,type:n,name:r.text,varargs:s,pos:r.start,start:t,end:r.end}}#m(){let t=this.#r(),e;if(t.kind==="keyword"&&qe.has(t.text))this.#s(),e={kind:"PrimitiveType",name:t.text,pos:t.start,start:t.start,end:t.end};else if(t.kind==="identifier"){let n=[this.#s().text],s=!1,r,a,o;for(;;){if(this.#n("<")){let c=this.#r().start;r??=c;let u=this.#bt();if(u==="diamond")throw this.#c(this.#y().start,"illegal start of type");a=u,s=!0}if(this.#n(".")&&this.#g(1)){o=this.#s().start,n.push(this.#s().text);continue}break}e={kind:"ClassType",names:n,hasTypeArguments:s,typeArgumentsPos:r,typeArguments:a,lastDotPos:o,pos:t.start,start:t.start,end:this.#y().end}}else if(t.kind==="eof")this.#H();else throw this.#c(t.start,"<identifier> expected");for(;this.#n("[")&&this.#n("]",1);){let n=this.#s(),s=this.#s();e={kind:"ArrayType",element:e,pos:n.start,start:e.start,end:s.end}}return e}#S(){let t=this.#L();try{return this.#m(),!0}catch(e){if(!(e instanceof _t))throw e;return this.#F(t),!1}}#pt(){let t=this.#i("{");this.#at();let e=[];for(;!this.#n("}");)this.#r().kind==="eof"&&this.#H(),e.push(this.#Pt());let n=this.#i("}");return this.#$(),{kind:"Block",statements:e,pos:t.start,start:t.start,end:n.end}}#Pt(){if(this.#I())return this.#Y();if(this.#n("static")&&(this.#n("class",1)||this.#n("interface",1)))throw this.#c(this.#r().start,"illegal start of expression");let t=this.#n("class")||this.#n("interface")||this.#n("enum")||(this.#n("abstract")||this.#n("final"))&&this.#n("class",1),e=this.#g(0,"record")&&this.#g(1)&&(this.#n("(",2)||this.#n("<",2));if(t||e){let n=this.#r().start,s=this.#E(),r=this.#n("enum")?this.#k(s,n):e?this.#P(s,n):this.#Bt(s,n);return{kind:"LocalClass",declaration:r,pos:r.keywordPos,start:n,end:r.end}}return this.#A()?this.#Et():this.#Y()}#A(){if(this.#n("final")||this.#n("@")&&!this.#n("interface",1))return!0;let t=this.#r();if(t.kind==="keyword"&&qe.has(t.text))return!this.#n(".",1);if(t.kind!=="identifier")return!1;let e=this.#L();try{if(!this.#S())return!1;let n=this.#r();return n.kind==="identifier"||n.kind==="keyword"&&n.text==="_"}finally{this.#F(e)}}#Et(){let t=this.#r().start,e=this.#E();for(let a of e.keywords)if(a.name!=="final")throw this.#c(a.pos,"illegal start of expression");let n=this.#m();n.kind==="ClassType"&&n.names.length===1&&n.names[0]==="var"&&!n.hasTypeArguments&&(n={kind:"VarType",pos:n.pos,start:n.start,end:n.end});let s=[];do{let a=this.#w(),o=0;for(;this.#n("[")&&this.#n("]",1);)this.#s(),this.#s(),o++;let c=null;this.#h("=")&&(c=this.#n("{")?this.#rt():this.#f()),s.push({name:a.text,extraDims:o,init:c,pos:a.start,start:a.start,end:this.#y().end})}while(this.#h(","));let r=this.#i(";");return{kind:"LocalVariableDeclaration",modifiers:e,type:n,declarators:s,pos:t,start:t,end:r.end}}#Y(){this.#at();try{let t=this.#r();if(t.kind==="operator"&&t.text==="{")return this.#pt();if(t.kind==="operator"&&t.text===";")return this.#s(),{kind:"EmptyStatement",pos:t.start,start:t.start,end:t.end};if(t.kind==="keyword"){if((t.text==="this"||t.text==="super")&&this.#n("(",1))return this.#Rt();if(t.text==="if")return this.#Vt();if(t.text==="while")return this.#At();if(t.text==="do")return this.#U();if(t.text==="switch")return this.#tt();if(t.text==="for")return this.#o();if(t.text==="return")return this.#ae();if(t.text==="break"||t.text==="continue")return this.#zt();if(t.text==="throw")return this.#oe();if(t.text==="try")return this.#we();if(t.text==="assert")return this.#ut();let e=Io[t.text];if(e)throw this.#C(t.start,e);if(t.text==="else")throw this.#c(t.start,"\'else\' without \'if\'")}if(t.kind==="identifier"){if(this.#n(":",1))return this.#x();if(this.#I())return this.#X()}if(this.#A()){let e=this.#Et();throw this.#c(e.declarators[0].pos,"variable declaration not allowed here")}return this.#It()}finally{this.#$()}}#Rt(){let t=this.#s(),e=this.#r().start,n=this.#Dt(),s=this.#i(";");return{kind:"ConstructorCall",keyword:t.text,thisPos:t.start,args:n,pos:e,start:t.start,end:s.end}}#Vt(){let t=this.#i("if");this.#i("(");let e=this.#f();this.#i(")");let n=this.#Y(),s=null;this.#h("else")&&(s=this.#Y());let r=(s??n).end;return{kind:"IfStatement",condition:e,then:n,otherwise:s,pos:t.start,start:t.start,end:r}}#I(){if(!this.#g(0,"yield"))return!1;let t=this.#r(1);return t.kind==="eof"?!1:t.kind!=="operator"?!0:ji.has(t.text)?!1:![".","(","[","++","--",";",":",")",","].includes(t.text)}#X(){let t=this.#s(),e=this.#f(),n=this.#i(";");return{kind:"YieldStatement",value:e,pos:t.start,start:t.start,end:n.end}}#x(){let t=this.#s();this.#i(":");let e=this.#Y();return{kind:"LabeledStatement",label:t.text,body:e,pos:t.start,start:t.start,end:e.end}}#U(){let t=this.#i("do"),e=this.#Y();this.#i("while"),this.#i("(");let n=this.#f();this.#i(")");let s=this.#i(";");return{kind:"DoStatement",body:e,condition:n,pos:t.start,start:t.start,end:s.end}}#tt(){let t=this.#i("switch"),e=this.#r().start,n=this.#Q(),{cases:s,end:r}=this.#e(!1);return{kind:"SwitchStatement",selector:n,selectorPos:e,cases:s,pos:t.start,start:t.start,end:r}}#Q(){this.#i("(");let t=this.#f();return this.#i(")"),t}#e(t){this.#i("{"),this.#at();let e=[];for(;!this.#n("}");){this.#r().kind==="eof"&&this.#H();let s=this.#r(),r=[],a=!1,o={};if(this.#h("default"))a=!0;else if(this.#h("case")){let u,d,h=!1;do{if(this.#n("null")&&(this.#n(",",1)||this.#n("->",1)||this.#n(":",1))){this.#s(),h=!0;continue}if(h&&this.#n("default")){this.#s(),a=!0;continue}if(this.#st()){if(u||r.length)throw this.#C(this.#r().start,"several patterns in one case label");if(u=this.#yt(!0),this.#g(0,"when")){this.#s(),this.#W=!0;try{d=this.#f()}finally{this.#W=!1}}continue}if(this.#g()&&(this.#n("->",1)||this.#n(",",1)||this.#n(":",1))){let m=this.#s();r.push({kind:"Name",identifier:m.text,depth:1,pos:m.start,start:m.start,end:m.end})}else r.push(this.#Ot())}while(this.#h(","));if(u&&(r.length||h))throw this.#C(u.pos,"a pattern combined with other case labels");o={...u?{pattern:u}:{},...d?{guard:d}:{},...h?{nullLabel:h}:{}}}else throw this.#c(s.start,"\'case\', \'default\', or \'}\' expected");let c={labels:r,isDefault:a,arrow:!1,statements:[],body:null,...o,pos:s.start,start:s.start,end:s.end};if(this.#h("->"))if(c.arrow=!0,this.#n("{"))c.body=this.#pt();else if(this.#n("throw")){let u=this.#oe();c.body={kind:"Block",statements:[u],pos:u.pos,start:u.start,end:u.end}}else{let u=this.#f();if(!t&&!ar(u))throw this.#c(u.pos,"not a statement");this.#i(";"),c.body=u}else{if(!this.#n(":"))throw this.#c(this.#y().end,"\':\' or \'->\' expected");for(this.#s();!this.#n("case")&&!this.#n("default")&&!this.#n("}");)this.#r().kind==="eof"&&this.#H(),c.statements.push(this.#Pt())}c.end=this.#y().end,e.push(c)}let n=this.#i("}");return this.#$(),{cases:e,end:n.end}}#st(){let t=this.#L();try{this.#h("final");let e=this.#r();return!(e.kind==="identifier"||e.kind==="keyword"&&qe.has(e.text))||!this.#S()?!1:this.#g()||this.#n("(")||this.#n("_")}finally{this.#F(t)}}#yt(t){let e=this.#r().start;if(!t&&this.#n("_")){let a=this.#s();return{kind:"TypePattern",type:null,name:"_",namePos:a.start,isFinal:!1,pos:a.start,start:a.start,end:a.end}}let n=this.#h("final"),s;if(!t&&this.#g(0,"var")&&(this.#g(1)||this.#n("_",1))?(this.#s(),s=null):s=this.#m(),s&&this.#n("(")){if(n)throw this.#c(e,"illegal start of expression");this.#s();let a=[];if(!this.#n(")"))do a.push(this.#yt(!1));while(this.#h(","));let o=this.#i(")");return{kind:"RecordPattern",type:s,components:a,pos:e,start:e,end:o.end}}let r=this.#r();if(this.#n("_"))return this.#s(),{kind:"TypePattern",type:s,name:"_",namePos:r.start,isFinal:n,pos:e,start:e,end:r.end};if(!this.#g())throw this.#c(this.#y().end,"<identifier> expected");return this.#s(),{kind:"TypePattern",type:s,name:r.text,namePos:r.start,isFinal:n,pos:e,start:e,end:r.end}}#At(){let t=this.#i("while");this.#i("(");let e=this.#f();this.#i(")");let n=this.#Y();return{kind:"WhileStatement",condition:e,body:n,pos:t.start,start:t.start,end:n.end}}#o(){let t=this.#i("for");if(this.#i("("),this.#Ht())return this.#$e(t);let e=null;this.#A()?e=this.#Et():(this.#n(";")||(e=this.#ve()),this.#i(";"));let n=this.#n(";")?null:this.#f();this.#i(";");let s=this.#n(")")?[]:this.#ve();this.#i(")");let r=this.#Y();return{kind:"ForStatement",init:e,condition:n,update:s,body:r,pos:t.start,start:t.start,end:r.end}}#$e(t){let e=this.#E();for(let o of e.keywords)if(o.name!=="final")throw this.#c(o.pos,"illegal start of expression");let n=this.#m();n.kind==="ClassType"&&n.names.length===1&&n.names[0]==="var"&&!n.hasTypeArguments&&(n={kind:"VarType",pos:n.pos,start:n.start,end:n.end});let s=this.#w();this.#i(":");let r=this.#f();this.#i(")");let a=this.#Y();return{kind:"ForEachStatement",modifiers:e,type:n,name:s.text,namePos:s.start,iterable:r,body:a,pos:t.start,start:t.start,end:a.end}}#Ht(){let t=this.#L();try{return this.#E(),!this.#S()||!this.#g()?!1:(this.#s(),this.#n(":"))}catch(e){if(e instanceof _t)return!1;throw e}finally{this.#F(t)}}#ve(){let t=[];do{let e=this.#f();if(!ar(e))throw this.#c(e.pos,"not a statement");t.push(e)}while(this.#h(","));return t}#ae(){let t=this.#i("return"),e=this.#n(";")?null:this.#f(),n=this.#i(";");return{kind:"ReturnStatement",value:e,pos:t.start,start:t.start,end:n.end}}#oe(){let t=this.#i("throw"),e=this.#f(),n=this.#i(";");return{kind:"ThrowStatement",expression:e,pos:t.start,start:t.start,end:n.end}}#ut(){let t=this.#i("assert"),e=this.#f(),n=this.#h(":")?this.#f():null,s=this.#i(";");return{kind:"AssertStatement",condition:e,message:n,pos:t.start,start:t.start,end:s.end}}#we(){let t=this.#i("try"),e=[];if(this.#h("(")){for(;!this.#n(")");){let o=this.#r().start;if(this.#g()&&(this.#n(";",1)||this.#n(")",1))){let c=this.#s();e.push({kind:"variable",expression:{kind:"Name",identifier:c.text,depth:1,pos:c.start,start:c.start,end:c.end},pos:c.start,start:o,end:c.end})}else{this.#E();let c=this.#m();c.kind==="ClassType"&&c.names.length===1&&c.names[0]==="var"&&!c.hasTypeArguments&&(c={kind:"VarType",pos:c.pos,start:c.start,end:c.end});let u=this.#w();this.#i("=");let d=this.#f();e.push({kind:"declaration",type:c,name:u.text,namePos:u.start,init:d,pos:u.start,start:o,end:d.end})}if(!this.#h(";"))break}this.#i(")")}let n=this.#pt(),s=[];for(;this.#n("catch");){let o=this.#s();this.#i("(");let c=this.#E(),u=[this.#m()];for(;this.#h("|");)u.push(this.#m());let d=this.#w();this.#i(")");let h=this.#pt();s.push({types:u,name:d.text,namePos:d.start,isFinal:c.keywords.some(m=>m.name==="final"),block:h,pos:o.start,start:o.start,end:h.end})}let r=this.#h("finally")?this.#pt():null;if(!s.length&&!r&&!e.length)throw this.#c(t.start,"\'try\' without \'catch\', \'finally\' or resource declarations");let a=(r??s[s.length-1]?.block??n).end;return{kind:"TryStatement",resources:e,block:n,catches:s,finallyBlock:r,pos:t.start,start:t.start,end:a}}#zt(){let t=this.#s(),e=this.#g()?this.#s().text:void 0,n=this.#i(";");return{kind:t.text==="break"?"BreakStatement":"ContinueStatement",label:e,pos:t.start,start:t.start,end:n.end}}#rt(){let t=this.#i("{");this.#at();let e=[];for(;!this.#n("}")&&(e.push(this.#n("{")?this.#rt():this.#f()),!!this.#h(",")););let n=this.#i("}");return this.#$(),{kind:"ArrayInitializer",elements:e,pos:t.start,start:t.start,end:n.end}}#It(){let t=this.#f();if(!ar(t))throw this.#c(t.pos,"not a statement");let e=this.#i(";");return{kind:"ExpressionStatement",expression:t,pos:t.pos,start:t.start,end:e.end}}#f(){this.#at();try{let t=this.#Ot(),e=this.#r();if(e.kind==="operator"&&ji.has(e.text)){this.#s();let n=this.#f();return this.#N({kind:"Assignment",operator:e.text,target:t,value:n,depth:0,pos:e.start,start:t.start,end:n.end},t,n)}return t}finally{this.#$()}}#Ot(){let t=this.#Lt(1);if(!this.#n("?"))return t;let e=this.#s(),n=this.#f();this.#i(":");let s=this.#Ot();return this.#N({kind:"Conditional",condition:t,whenTrue:n,whenFalse:s,depth:0,pos:e.start,start:t.start,end:s.end},t,n,s)}#Lt(t){let e=this.#G();for(;;){let n=this.#r();if(n.kind!=="operator"&&!(n.kind==="keyword"&&n.text==="instanceof"))break;let s=Ao[n.text];if(s===void 0||s<t)break;if(n.text==="instanceof"){e=this.#ot(e);continue}this.#s();let r=this.#Lt(s+1);e=this.#N({kind:"Binary",operator:n.text,left:e,right:r,depth:0,pos:n.start,start:e.start,end:r.end},e,r)}return e}#ot(t){let e=this.#s(),n=!1;this.#n("final")&&(this.#s(),n=!0);let s=this.#m(),r,a;if(this.#n("(")){this.#s();let c=[];if(!this.#n(")"))do c.push(this.#yt(!1));while(this.#h(","));let u=this.#i(")");a={kind:"RecordPattern",type:s,components:c,pos:s.pos,start:s.start,end:u.end}}else if(this.#g()){let c=this.#s();r={name:c.text,pos:c.start,isFinal:n}}else if(n)throw this.#c(this.#y().end,"<identifier> expected");let o={kind:"InstanceOf",expression:t,targetType:s,...r?{binding:r}:{},...a?{recordPattern:a}:{},depth:0,pos:e.start,start:t.start,end:this.#y().end};return this.#N(o,t)}#G(){this.#at();try{let t=this.#r();if(t.kind==="operator")switch(t.text){case"-":case"+":{this.#s();let e=this.#r(),n=t.text==="-"&&e.kind==="int-literal"&&e.integer?.radix===10&&e.integer.value===2147483648n?this.#Yt(!0):t.text==="-"&&e.kind==="long-literal"&&e.integer?.radix===10&&e.integer.value===9223372036854775808n?this.#Gt(!0):this.#G();return this.#N({kind:"Unary",operator:t.text,operand:n,depth:0,pos:t.start,start:t.start,end:n.end},n)}case"!":case"~":{this.#s();let e=this.#G();return this.#N({kind:"Unary",operator:t.text,operand:e,depth:0,pos:t.start,start:t.start,end:e.end},e)}case"++":case"--":{this.#s();let e=this.#G();return this.#N({kind:"IncDec",operator:t.text,prefix:!0,operand:e,depth:0,pos:t.start,start:t.start,end:e.end},e)}case"(":if(this.#Jt()){this.#s();let e=this.#m();this.#i(")");let n=this.#G();return this.#N({kind:"Cast",targetType:e,expression:n,depth:0,pos:t.start,start:t.start,end:n.end},n)}break}return this.#u(this.#Qt())}finally{this.#$()}}#Jt(){if(this.#Zt())return!1;let t=this.#r(1);if(t.kind==="keyword"&&qe.has(t.text))return this.#n(")",2)||this.#n("[",2)&&this.#n("]",3);if(t.kind!=="identifier")return!1;let e=this.#L();try{if(this.#s(),!this.#S()||!this.#h(")"))return!1;let n=this.#r();return n.kind==="identifier"||n.kind.endsWith("-literal")||n.kind==="text-block"?!0:(n.kind==="operator"||n.kind==="keyword")&&Oo.has(n.text)}finally{this.#F(e)}}#u(t){let e=t;for(;;){let n=this.#r();if(n.kind!=="operator")return e;if(n.text==="."){this.#s();let s;if(this.#n("<")){let o=this.#bt();if(o==="diamond")throw this.#c(this.#r().start,"illegal start of type");if(s=o,!this.#g()||!this.#n("(",1))throw this.#c(this.#r().start,"<identifier> expected")}let r=this.#r();if(r.kind==="keyword"&&r.text==="class"){this.#s(),e=this.#N({kind:"ClassLiteral",target:e,depth:0,pos:n.start,start:e.start,end:r.end},e);continue}if(r.kind==="keyword"&&r.text==="this"&&(e.kind==="Name"||e.kind==="FieldAccess")){this.#s();let o=[];for(let c=e;;c=c.target){if(c.kind==="Name"){o.unshift(c.identifier);break}if(c.kind!=="FieldAccess")throw this.#c(r.start,"<identifier> expected");o.unshift(c.name)}e=this.#N({kind:"This",qualifier:o,depth:0,pos:e.start,start:e.start,end:r.end},e);continue}if(r.kind==="keyword"&&r.text==="super"&&(e.kind==="Name"||e.kind==="FieldAccess")&&(this.#n(".",1)||this.#n("::",1))){let o=[];for(let c=e;;){if(c.kind==="Name"){o.unshift(c.identifier);break}if(c.kind!=="FieldAccess")throw this.#c(r.start,"<identifier> expected");o.unshift(c.name),c=c.target}this.#s(),e=this.#N({kind:"Super",qualifier:o,qualifierPos:e.start,dotPos:n.start,depth:0,pos:r.start,start:e.start,end:r.end},e);continue}if(r.kind==="keyword"&&r.text==="new"){let o=this.#ce();if(o.kind!=="NewObject"||o.classType.kind!=="ClassType"||o.classType.names.length!==1)throw this.#c(r.start,"\'(\' expected");if(o.body)throw this.#C(r.start,"\'.new\' with an anonymous class body",!0);o.outerExpression=e,o.start=e.start,e=this.#N(o,e);continue}if(r.kind==="keyword"&&["this","super"].includes(r.text))throw this.#C(r.start,`\'.${r.text}\' expressions`);let a=this.#w();if(this.#n("(")){let o=this.#r().start,c=this.#Dt();e=this.#N({kind:"MethodCall",target:e,name:a.text,namePos:a.start,selectPos:n.start,args:c,...s?{typeArguments:s}:{},depth:0,pos:o,start:e.start,end:this.#y().end},e,...c)}else e=this.#N({kind:"FieldAccess",target:e,name:a.text,namePos:a.start,depth:0,pos:n.start,start:e.start,end:a.end},e);continue}if(n.text==="["&&this.#n("]",1)&&this.#Me()){let s=this.#Tt(e);for(;this.#n("[");){this.#s();let r=this.#i("]");s={kind:"ArrayType",element:s,pos:s.pos,start:s.start,end:r.end}}return this.#et(null,s,e.start)}if(n.text==="["){this.#s();let s=this.#f(),r=this.#i("]");e=this.#N({kind:"ArrayAccess",array:e,index:s,depth:0,pos:n.start,start:e.start,end:r.end},e,s);continue}if(n.text==="::")return this.#et(e,void 0,e.start);if(n.text==="<"&&(e.kind==="Name"||e.kind==="FieldAccess")&&this.#le())throw this.#C(n.start,"method references on a parameterized type (write a lambda)");if(n.text==="++"||n.text==="--"){this.#s(),e=this.#N({kind:"IncDec",operator:n.text,prefix:!1,operand:e,depth:0,pos:n.start,start:e.start,end:n.end},e);continue}return e}}#le(){let t=this.#L();try{return this.#bt()!=="diamond"&&this.#n("::")}catch(e){if(!(e instanceof _t))throw e;return!1}finally{this.#F(t)}}#Me(){let t=0;for(;this.#n("[",t)&&this.#n("]",t+1);)t+=2;return t>0&&this.#n("::",t)}#Tt(t){let e=[],n=t;for(;n.kind==="FieldAccess";)e.unshift(n.name),n=n.target;if(n.kind!=="Name")throw this.#c(t.pos,"<identifier> expected");return e.unshift(n.identifier),{kind:"ClassType",names:e,hasTypeArguments:!1,pos:t.pos,start:t.start,end:t.end}}#et(t,e,n){let s=this.#i("::"),r=this.#r();if(r.kind==="operator"&&r.text==="<")throw this.#C(r.start,"explicit type arguments in method references");if(!(r.kind==="identifier"||r.kind==="keyword"&&r.text==="new"))throw this.#c(r.start,"<identifier> expected");if(this.#s(),e&&r.text!=="new")throw this.#c(r.start,"<identifier> expected");return{kind:"MethodRef",target:t,...e?{arrayType:e}:{},name:r.text,namePos:r.start,depth:(t?.depth??0)+1,pos:s.start,start:n,end:r.end}}#Nt(t){let e=this.#W;this.#W=!1;try{return t()}finally{this.#W=e}}#Dt(){this.#i("(");let t=[];if(!this.#n(")"))do t.push(this.#Nt(()=>this.#f()));while(this.#h(","));return this.#i(")"),t}#Yt(t){let e=this.#s(),{value:n,radix:s}=e.integer,r;if(s===10){if(n>2147483648n||n===2147483648n&&!t)throw new _t({offset:e.start,code:"int-number-too-large",message:"integer number too large"});r=Number(BigInt.asIntN(32,n))}else{if(n>0xffffffffn)throw new _t({offset:e.start,code:"int-number-too-large",message:"integer number too large"});r=Number(BigInt.asIntN(32,n))}return{kind:"Literal",literalKind:"int",value:r,depth:1,pos:e.start,start:e.start,end:e.end}}#Gt(t){let e=this.#s(),{value:n,radix:s}=e.integer;if(s===10?n>9223372036854775808n||n===9223372036854775808n&&!t:n>0xffffffffffffffffn)throw new _t({offset:e.start,code:"int-number-too-large",message:"integer number too large"});return{kind:"Literal",literalKind:"long",value:BigInt.asIntN(64,n),depth:1,pos:e.start,start:e.start,end:e.end}}#Qt(){let t=this.#r(),e=(n,s)=>(this.#s(),{kind:"Literal",literalKind:n,value:s,depth:1,pos:t.start,start:t.start,end:t.end});switch(t.kind){case"int-literal":return this.#Yt(!1);case"long-literal":return this.#Gt(!1);case"float-literal":case"double-literal":{let n=t.kind==="float-literal",s=n?Mi(t.text):Ri(t.text);if("error"in s)throw new _t({offset:t.start,code:"fp-number-out-of-range",message:s.error==="too-large"?"floating-point number too large":"floating-point number too small"});return this.#s(),{kind:"Literal",literalKind:n?"float":"double",value:s.value,depth:1,pos:t.start,start:t.start,end:t.end}}case"char-literal":return e("char",t.stringValue??"");case"string-literal":return e("string",t.stringValue??"");case"text-block":return e("string",t.stringValue??"");case"identifier":{if(this.#n("->",1)&&!this.#W)return this.#s(),this.#jt(t.start,[{name:t.text,pos:t.start,type:null}]);if(this.#s(),this.#n("(")){let n=this.#r().start,s=this.#Dt();return this.#N({kind:"MethodCall",target:null,name:t.text,namePos:t.start,selectPos:t.start,args:s,depth:0,pos:n,start:t.start,end:this.#y().end},...s)}return{kind:"Name",identifier:t.text,depth:1,pos:t.start,start:t.start,end:t.end}}case"keyword":switch(t.text){case"true":case"false":return this.#s(),{kind:"Literal",literalKind:"boolean",value:t.text==="true",depth:1,pos:t.start,start:t.start,end:t.end};case"null":return this.#s(),{kind:"Literal",literalKind:"null",value:null,depth:1,pos:t.start,start:t.start,end:t.end};case"this":if(this.#n("(",1))throw this.#C(t.start,"constructor calls with \'this(...)\'");return this.#s(),{kind:"This",depth:1,pos:t.start,start:t.start,end:t.end};case"super":if(!this.#n(".",1)&&!this.#n("::",1))throw this.#C(t.start,"\'super\' other than in super.member or super(...)",!0);return this.#s(),{kind:"Super",depth:1,pos:t.start,start:t.start,end:t.end};case"new":return this.#ce();case"switch":{this.#s();let n=this.#r().start,s=this.#Q(),{cases:r,end:a}=this.#e(!0);return this.#N({kind:"SwitchExpression",selector:s,selectorPos:n,cases:r,depth:0,pos:t.start,start:t.start,end:a},s)}}if(qe.has(t.text)&&this.#n("[",1)&&this.#n("]",2)){this.#s();let n={kind:"PrimitiveType",name:t.text,pos:t.start,start:t.start,end:t.end};for(;this.#n("[")&&this.#n("]",1);){this.#s();let s=this.#i("]");n={kind:"ArrayType",element:n,pos:n.pos,start:n.start,end:s.end}}if(this.#n("::"))return this.#et(null,n,t.start)}if(qe.has(t.text)||t.text==="void")throw this.#C(t.start,"class literals");break;case"operator":if(t.text==="("){if(!this.#W&&this.#Zt())return this.#St();this.#s();let n=this.#Nt(()=>this.#f()),s=this.#i(")");return this.#N({kind:"Parenthesized",expression:n,depth:0,pos:t.start,start:t.start,end:s.end},n)}break;case"eof":this.#H()}throw this.#c(t.start,"illegal start of expression")}#ce(){let t=this.#i("new"),e=this.#r(),n;if(e.kind==="keyword"&&qe.has(e.text))this.#s(),n={kind:"PrimitiveType",name:e.text,pos:e.start,start:e.start,end:e.end};else if(e.kind==="identifier"){let a=[this.#s().text],o;for(;this.#n(".")&&this.#g(1);)o=this.#s().start,a.push(this.#s().text);let c,u=!1,d;if(this.#n("<")){d=this.#r().start;let h=this.#bt();if(h==="diamond"?u=!0:c=h,!this.#n("(")&&u)throw this.#C(d,"array creation with \'<>\'",!0)}if(n={kind:"ClassType",names:a,hasTypeArguments:u||c!==void 0,typeArgumentsPos:d,typeArguments:c,diamond:u,lastDotPos:o,pos:e.start,start:e.start,end:this.#y().end},this.#n("(")){let h=this.#Dt(),m;if(this.#n("{")){let p=this.#s();m={kind:"ClassDeclaration",keyword:"class",extendsTypes:[],implementsTypes:[],modifiers:{keywords:[]},name:"",namePos:p.start,keywordPos:p.start,members:[],anonymous:!0,pos:p.start,start:p.start,end:p.start},this.#at(),this.#_(m),this.#$()}return this.#N({kind:"NewObject",classType:n,args:h,...m?{body:m}:{},depth:0,pos:t.start,start:t.start,end:this.#y().end},...h)}}else throw this.#c(e.start,"<identifier> expected");if(!this.#n("["))throw this.#c(this.#y().end,"\'(\' or \'[\' expected");if(this.#n("]",1)){let a=0;for(;this.#n("[")&&this.#n("]",1);)this.#s(),this.#s(),a++;if(!this.#n("{"))throw this.#c(this.#y().end,"array dimension missing");let o=this.#rt();return this.#N({kind:"NewArray",elementType:n,dimensions:[],extraDims:a,initializer:o,depth:0,pos:t.start,start:t.start,end:o.end})}let s=[],r=0;for(;this.#n("[");){if(this.#n("]",1)){this.#s(),this.#s(),r++;continue}if(r)throw this.#c(this.#r().start,"\']\' expected");this.#s(),s.push(this.#f()),this.#i("]")}if(this.#n("{"))throw this.#c(this.#r().start,"\';\' expected");return this.#N({kind:"NewArray",elementType:n,dimensions:s,extraDims:r,initializer:null,depth:0,pos:t.start,start:t.start,end:this.#y().end},...s)}#St(){let t=this.#i("("),e=[];if(!this.#n(")"))do{if(this.#g()&&(this.#n(",",1)||this.#n(")",1))){let d=this.#s();e.push({name:d.text,pos:d.start,type:null});continue}let a=[];for(;this.#n("final");)a.push({name:"final",pos:this.#s().start});let o=a.length?{keywords:a,annotations:[]}:void 0;if(this.#g(0,"var")&&this.#g(1)){this.#s();let d=this.#w();if(this.#n("["))throw this.#c(d.start,"\'var\' is not allowed as an element type of an array");e.push({name:d.text,pos:d.start,type:null,isVar:!0,...o?{modifiers:o}:{}});continue}let c=this.#m(),u=this.#w();e.push({name:u.text,pos:u.start,type:c,...o?{modifiers:o}:{}})}while(this.#h(","));this.#i(")");let n=e.filter(r=>r.isVar).length;if(n&&n<e.length){let r=e.some(a=>a.type);throw new _t({offset:t.start,code:"syntax",message:"invalid lambda parameter declaration",details:[r?" (cannot mix \'var\' and explicitly-typed parameters)":" (cannot mix \'var\' and implicitly-typed parameters)"]})}let s=e.filter(r=>r.type).length;if(s&&s<e.length-n)throw new _t({offset:t.start,code:"syntax",message:"invalid lambda parameter declaration",details:[" (cannot mix implicitly-typed and explicitly-typed parameters)"]});return this.#jt(t.start,e)}#jt(t,e){if(this.#i("->"),this.#n("{")){let s=this.#pt();return{kind:"Lambda",params:e,body:s,depth:1,pos:t,start:t,end:s.end}}let n=this.#f();return this.#N({kind:"Lambda",params:e,body:n,depth:0,pos:t,start:t,end:n.end},n)}#Zt(){let t=0;for(let e=0;;e++){let n=this.#r(e);if(n.kind==="eof")return!1;if(n.kind==="operator")if(n.text==="(")t++;else{if(n.text===")"&&--t===0)return this.#n("->",e+1);if(n.text===";"||n.text==="{"||n.text==="}")return!1}}}};var Lo=[{module:"java-library-time",file:"time.ts",exported:"TIME_NATIVES",classes:["LocalDate","LocalTime","LocalDateTime","Duration","DayOfWeek","Month","Period","DateTimeFormatter","ChronoUnit"]},{module:"java-library-math",file:"bigmath.ts",exported:"BIGMATH_NATIVES",classes:["BigInteger","BigDecimal","MathContext","RoundingMode"],natives:["nextBigInteger()","nextBigDecimal()"]},{module:"java-library-regex",file:"matcher.ts",exported:"PATTERN_STATICS",classes:["Pattern","Matcher","MatchResult"]},{module:"java-library-bitset",file:"bitset.ts",exported:"BITSET_NATIVES",classes:["BitSet"]}],lr="javaOnlineCompilerLibrary",_i="javaOnlineCompilerLibraryParts";function Ui(i){let t=i.indexOf("."),e=i.indexOf("("),n=t>0&&(e<0||t<e)?i.slice(0,t):null;return Lo.find(s=>n!==null&&s.classes.includes(n)||s.natives?.includes(i))}var $t={Runnable:"java.lang",Stream:"java.util.stream",IntStream:"java.util.stream",LongStream:"java.util.stream",DoubleStream:"java.util.stream",Collectors:"java.util.stream",Collector:"java.util.stream",Optional:"java.util",OptionalInt:"java.util",OptionalLong:"java.util",OptionalDouble:"java.util",IntSummaryStatistics:"java.util",LongSummaryStatistics:"java.util",DoubleSummaryStatistics:"java.util",LongPredicate:"java.util.function",DoublePredicate:"java.util.function",LongConsumer:"java.util.function",DoubleConsumer:"java.util.function",LongSupplier:"java.util.function",DoubleSupplier:"java.util.function",LongFunction:"java.util.function",DoubleFunction:"java.util.function",IntToLongFunction:"java.util.function",IntToDoubleFunction:"java.util.function",LongToIntFunction:"java.util.function",LongToDoubleFunction:"java.util.function",DoubleToIntFunction:"java.util.function",DoubleToLongFunction:"java.util.function",Function:"java.util.function",BiFunction:"java.util.function",Supplier:"java.util.function",Consumer:"java.util.function",BiConsumer:"java.util.function",Predicate:"java.util.function",BiPredicate:"java.util.function",UnaryOperator:"java.util.function",BinaryOperator:"java.util.function",IntBinaryOperator:"java.util.function",IntUnaryOperator:"java.util.function",IntPredicate:"java.util.function",IntFunction:"java.util.function",IntConsumer:"java.util.function",IntSupplier:"java.util.function",ToIntFunction:"java.util.function",ToLongFunction:"java.util.function",ToDoubleFunction:"java.util.function",ToIntBiFunction:"java.util.function",LongBinaryOperator:"java.util.function",LongUnaryOperator:"java.util.function",DoubleBinaryOperator:"java.util.function",DoubleUnaryOperator:"java.util.function",BooleanSupplier:"java.util.function",ObjIntConsumer:"java.util.function",List:"java.util",ArrayList:"java.util",Map:"java.util",HashMap:"java.util",Set:"java.util",HashSet:"java.util",LinkedHashMap:"java.util",TreeMap:"java.util",TreeSet:"java.util",SortedMap:"java.util",NavigableMap:"java.util",SortedSet:"java.util",NavigableSet:"java.util",LinkedList:"java.util",Stack:"java.util",Vector:"java.util",AbstractList:"java.util",LocalDate:"java.time",LocalTime:"java.time",LocalDateTime:"java.time",Duration:"java.time",Temporal:"java.time.temporal",TemporalAccessor:"java.time.temporal",TemporalAmount:"java.time.temporal",TemporalUnit:"java.time.temporal",DayOfWeek:"java.time",Month:"java.time",Period:"java.time",DateTimeFormatter:"java.time.format",ChronoUnit:"java.time.temporal",BitSet:"java.util",Pattern:"java.util.regex",Matcher:"java.util.regex",MatchResult:"java.util.regex",Hashtable:"java.util",Dictionary:"java.util",Enumeration:"java.util",LinkedHashSet:"java.util",Entry:"java.util",Deque:"java.util",Queue:"java.util",ArrayDeque:"java.util",PriorityQueue:"java.util",Collection:"java.util",Iterator:"java.util",ListIterator:"java.util",Arrays:"java.util",Comparator:"java.util",Collections:"java.util",Random:"java.util",Scanner:"java.util",Iterable:"java.lang",Comparable:"java.lang",Class:"java.lang",Objects:"java.util",StringBuilder:"java.lang",StringBuffer:"java.lang",StringJoiner:"java.util",Number:"java.lang",Integer:"java.lang",Long:"java.lang",Double:"java.lang",Character:"java.lang",Boolean:"java.lang",Float:"java.lang",BigInteger:"java.math",EnumMap:"java.util",EnumSet:"java.util",BigDecimal:"java.math",RoundingMode:"java.math",MathContext:"java.math",Byte:"java.lang",Short:"java.lang",OutputStream:"java.io",Reader:"java.io",InputStreamReader:"java.io",StringReader:"java.io",BufferedReader:"java.io",Writer:"java.io",OutputStreamWriter:"java.io",BufferedWriter:"java.io",StringWriter:"java.io",PrintWriter:"java.io",StreamTokenizer:"java.io",StringTokenizer:"java.util",CharSequence:"java.lang"},Mt={Entry:"Map"},ps="java-library",dn=class extends Error{module;constructor(t=ps){super(`the Java library chunk ${t} is needed`),this.name="NeedsLibrary",this.module=t}},De=null,cr=new Set;function Bi(i){De=i,cr.clear()}function Vi(i,t){if(!De)throw new Error(`the Java library part ${i} was loaded before the library`);Object.assign(De.natives,t),cr.add(i)}function ur(i){for(let{name:t}of i){let e=Ui(t);if(e&&!cr.has(e.module))return e.module}return null}function mn(){return De}function se(i){if(i in $t){if(!De)throw new dn;return De.classes.get(i)}}function Xt(i){if(!De)throw new dn;return De.classes.get(i)}var U={tag:"int"},Pn={tag:"byte"},yn={tag:"short"},we={tag:"char"},ft={tag:"boolean"},Lt={tag:"long"},xt={tag:"float"},ht={tag:"double"},Tt={tag:"void"},mr={tag:"null"},ut={tag:"string"},H={tag:"object"},Gi={tag:"printstream"},A={tag:"error"};function Qt(i){return{tag:"array",element:i}}function X(i,t){return t?.length?{tag:"class",name:i.displayName,symbol:i,args:t}:{tag:"class",name:i.displayName,symbol:i}}function ke(i){return{tag:"typevar",name:i.name,symbol:i}}function he(i){return X(i,i.typeParams?.map(ke))}function ys(i){return i.symbol?.key??i.name}function dr(i){return i.symbol?.bounds[0]??H}function Vt(i,t){if(!t.size)return i;switch(i.tag){case"typevar":return t.get(ys(i))??i;case"array":return Qt(Vt(i.element,t));case"library":return i.args.length?dt(i.symbol,i.args.map(e=>Vt(e,t))):i;case"class":return i.args?.length?X(i.symbol,i.args.map(e=>Vt(e,t))):i;case"wildcard":return i.bound?{...i,bound:Vt(i.bound,t)}:i;default:return i}}function Rn(i){let t=new Map,e=i.symbol.typeParams??[];return i.args?.length===e.length&&e.forEach((n,s)=>t.set(n.key,i.args[s])),t}function Jn(i){return i.tag==="class"&&(i.symbol.typeParams?.length??0)>0&&!i.args?.length}function K(i){switch(i.tag){case"typevar":return i.symbol?K(dr(i)):H;case"wildcard":return H;case"array":return Qt(K(i.element));case"library":return i.args.length?dt(i.symbol):i;case"class":return i.args?.length?X(i.symbol):i;default:return i}}function Dn(i){let t=i.symbol,e=[];if(t.superType?e.push(t.superType):t.superclass?e.push(X(t.superclass)):t.librarySuperclass&&e.push(t.librarySuperclass),t.interfaceTypes?e.push(...t.interfaceTypes):e.push(...t.interfaces.map(s=>X(s))),e.push(...t.libraryInterfaces),!t.typeParams?.length)return e;if(!i.args?.length)return e.map(K);let n=Rn(i);return e.map(s=>Vt(s,n))}function Zt(i,t){if(i.tag==="typevar"&&i.symbol){for(let e of i.symbol.bounds){let n=Zt(e,t);if(n)return n}return null}if(i.tag!=="class")return null;if(i.symbol===t)return i;for(let e of Dn(i)){let n=Zt(e,t);if(n)return n}return null}function Ie(i,t=new Set){if(t.has(i.symbol))return[];t.add(i.symbol);let e=[];for(let n of Dn(i))n.tag==="library"?e.push(n):n.tag==="class"&&e.push(...Ie(n,t));return e}function Oe(i,t,e){if(!t.typeParams?.length)return e;let n=Zt(i,t);return n?n.args?.length?Vt(e,Rn(n)):K(e):e}function dt(i,t=[]){return{tag:"library",symbol:i,args:t}}function St(i,t,e){switch(i.tag){case"typevar":{if(i.symbol)return i;let n=t.indexOf(i.name);return n>=0&&e[n]?e[n]:H}case"array":return Qt(St(i.element,t,e));case"library":return i.args.length?dt(i.symbol,i.args.map(n=>St(n,t,e))):i;case"wildcard":return i.bound?{...i,bound:St(i.bound,t,e)}:i;default:return i}}function Yt(i,t,e){switch(i.tag){case"typevar":{if(i.symbol)return i;let n=t.indexOf(i.name);return n>=0&&e[n]?e[n]:i}case"array":return Qt(Yt(i.element,t,e));case"library":return i.args.length?dt(i.symbol,i.args.map(n=>Yt(n,t,e))):i;case"wildcard":return i.bound?{...i,bound:Yt(i.bound,t,e)}:i;default:return i}}function fr(i){return i.symbol.supertypes.map(t=>St(t,i.symbol.typeParams,i.args))}function Pt(i,t){if(i.tag!=="library")return null;if(i.symbol===t)return i;for(let e of fr(i)){let n=Pt(e,t);if(n)return n}return null}function zt(i){let t={int:"Integer",long:"Long",double:"Double",char:"Character",boolean:"Boolean",float:"Float",byte:"Byte",short:"Short"}[i.tag],e=t?mn()?.classes.get(t):void 0;return e?dt(e):null}function gt(i){return i.tag!=="library"||!i.symbol.box?null:{int:U,long:Lt,double:ht,char:we,boolean:ft,float:xt,byte:Pn,short:yn}[i.symbol.box]}function M(i){switch(i.tag){case"int":case"byte":case"short":case"char":case"boolean":case"long":case"float":case"double":case"void":return i.tag;case"null":return"<null>";case"string":return"String";case"object":return"Object";case"printstream":return"PrintStream";case"array":return M(i.element)+"[]";case"class":return i.args?.length?`${i.name}<${i.args.map(M).join(",")}>`:i.name;case"library":return i.args.length?`${i.symbol.name}<${i.args.map(M).join(",")}>`:i.symbol.name;case"diamond":return`${i.symbol.name}<>`;case"typevar":return i.name;case"wildcard":return i.poly&&i.bound?M(i.bound):i.bound?`? ${i.isSuper?"super":"extends"} ${M(i.bound)}`:"?";case"lambda":return i.text;case"error":return"<any>"}}function et(i,t){if(i.tag!==t.tag)return!1;if(i.tag==="array"&&t.tag==="array")return et(i.element,t.element);if(i.tag==="class"&&t.tag==="class"){let e=i.args??[],n=t.args??[];return i.symbol===t.symbol&&e.length===n.length&&e.every((s,r)=>et(s,n[r]))}return i.tag==="wildcard"&&t.tag==="wildcard"?i.isSuper===t.isSuper&&(i.bound===null?t.bound===null:t.bound!==null&&et(i.bound,t.bound)):i.tag==="library"&&t.tag==="library"?i.symbol===t.symbol&&i.args.length===t.args.length&&i.args.every((e,n)=>et(e,t.args[n])):i.tag==="typevar"&&t.tag==="typevar"?i.symbol===t.symbol&&i.name===t.name:i.tag==="diamond"&&t.tag==="diamond"?i.symbol===t.symbol:!0}function Q(i){return i.tag==="string"||i.tag==="null"||i.tag==="object"||i.tag==="printstream"||i.tag==="array"||i.tag==="class"||i.tag==="library"||i.tag==="typevar"||i.tag==="diamond"}function Z(i){return["int","byte","short","char","boolean","long","float","double"].includes(i.tag)}function Ot(i){return["int","byte","short","char","long","float","double"].includes(i.tag)}var Hi={byte:0,short:1,char:1,int:2,long:3,float:4,double:5};function No(i,t){return!Ot(i)||!Ot(t)||i.tag==="char"||t.tag==="char"&&i.tag==="short"?!1:Hi[t.tag]<Hi[i.tag]}function fn(i,t){return i===t||i.superclass&&fn(i.superclass,t)?!0:i.interfaces.some(e=>fn(e,t))}function pn(i,t=new Set){if(t.has(i))return[];t.add(i);let e=[...i.libraryInterfaces];i.superclass&&e.push(...pn(i.superclass,t));for(let n of i.interfaces)e.push(...pn(n,t));return e}var jn={tag:"typevar",name:"?open"};function hr(i,t){let e=t.args??[];return!i.args?.length&&e.length?!1:(i.args??[]).every((n,s)=>{let r=e[s];if(n===jn||!r)return!0;let a=n.tag==="wildcard"&&n.poly&&n.bound?n.bound:n;return a!==n&&r.tag!=="wildcard"?z(a,r):r.tag==="wildcard"?r.bound?a.tag==="wildcard"?r.isSuper?a.isSuper===!0&&a.bound!==null&&z(r.bound,a.bound):a.isSuper?r.bound.tag==="object":z(a.bound??H,r.bound):r.isSuper?z(r.bound,a):z(a,r.bound):!0:et(a,r)})}function z(i,t){if(et(i,t))return!0;if(i.tag==="null")return Q(t);if(t.tag==="object")return Q(i);if(i.tag==="array"&&t.tag==="array")return Q(i.element)&&Q(t.element)&&z(i.element,t.element);if(i.tag==="typevar"&&i.symbol)return i.symbol.bounds.some(s=>z(s,t));if(i.tag==="class"&&t.tag==="class"){let s=Zt(i,t.symbol);return s?t.args?.length?(s.args?.length??0)>0&&hr(s,t):!0:!1}if(i.tag==="class"&&i.symbol.isEnum&&t.tag==="library"&&t.symbol.name==="Comparable"){let s=t.args[0];return!s||et(s,i)||s.tag==="wildcard"&&(!s.bound||(s.isSuper?z(s.bound,i):z(i,s.bound)))}if(i.tag==="class"&&t.tag==="library")return Ie(i).some(s=>{let r=Pt(s,t.symbol);return r!==null&&hr(r,t)});if((i.tag==="string"||i.tag==="library"&&(i.symbol.box!==void 0||i.symbol.name==="StringBuilder"||i.symbol.name==="StringBuffer"))&&t.tag==="library"&&t.symbol.name==="Comparable"){let s=t.args[0];return!s||et(s,i)||s.tag==="wildcard"&&(!s.bound||(s.isSuper?z(s.bound,i):z(i,s.bound)))}if(t.tag!=="library")return!1;if(t.symbol.name==="CharSequence"&&(i.tag==="string"||i.tag==="library"&&(i.symbol.name==="StringBuilder"||i.symbol.name==="StringBuffer")))return!0;if(i.tag==="printstream")return t.symbol.name==="OutputStream";if(i.tag==="diamond")return Pt(dt(i.symbol,i.symbol.typeParams.map(()=>H)),t.symbol)!==null;let n=Pt(i,t.symbol);return n?hr(n,t):!1}function $o(i){return i.box!==void 0||i.name==="StringBuilder"||i.name==="StringBuffer"||i.name==="StringJoiner"||i.name==="Scanner"}function zi(i){switch(i.tag){case"class":return{interface:i.symbol.isInterface,final:i.symbol.isFinal};case"library":case"diamond":return{interface:i.symbol.isInterface,final:!i.symbol.isInterface&&$o(i.symbol)};case"string":return{interface:!1,final:!0};default:return null}}function ve(i,t){if(z(t,i)||z(i,t))return!0;if(i.tag==="typevar"&&i.symbol)return ve(dr(i),t);if(t.tag==="typevar"&&t.symbol)return ve(i,dr(t));if(i.tag==="array"&&t.tag==="array")return Q(i.element)&&Q(t.element)?ve(i.element,t.element):et(i.element,t.element);let e=zi(i),n=zi(t);return!e||!n?!1:e.interface&&n.interface?!0:e.interface?!n.final:n.interface?!e.final:!1}function We(i,t){return i.tag==="error"||t.tag==="error"?!0:t.tag==="lambda"?qi(i,t)===null:et(i,t)||No(i,t)?!0:Q(i)&&z(t,i)}function re(i,t){if(We(i,t))return!0;if(Z(t)&&Q(i)){if(i.tag==="object")return!0;let n=zt(t);return n!==null&&z(n,i)}let e=gt(t);return e!==null&&Z(i)&&We(i,e)}var Mo={byte:[-128,127],short:[-32768,32767],char:[0,65535]};function te(i,t,e){if(re(i,t))return!0;let n=i.tag==="library"?i.symbol.box:i.tag,s=n?Mo[n]:void 0;if(s&&["int","byte","short","char"].includes(t.tag)&&e&&(e.kind==="int"||e.kind==="char")){let r=e.value;return r>=s[0]&&r<=s[1]}return!1}function Po(i){if(i.tag==="class"&&i.symbol.isInterface&&!i.symbol.isSealed){let n=gs(i.symbol);return n.length===1?{params:n[0].params,returnType:n[0].returnType}:null}if(i.tag!=="library"||!i.symbol.functional)return null;let t=i.symbol.methods.find(n=>n.name===i.symbol.functional&&!n.isStatic),e=i.symbol.typeParams.map((n,s)=>{let r=i.args[s];return r?r.tag==="wildcard"?r.bound??H:r:H});return{params:t.params.map(n=>St(n,i.symbol.typeParams,e)),returnType:St(t.returnType,i.symbol.typeParams,e)}}function Ki(i){switch(i.tag){case"typevar":case"wildcard":case"object":return"Object";case"string":return"String";case"library":return i.symbol.qualifiedName;case"class":return i.symbol.binaryName;case"array":return Ki(i.element)+"[]";default:return i.tag}}function gs(i){let t=new Set(["equals(Object)","hashCode()","toString()"]),e=[],n=[i];for(let s=0;s<n.length;s++){let r=n[s];for(let a of r.methods){if(a.isStatic||a.isPrivate)continue;let o=`${a.name}(${a.params.map(Ki).join(",")})`;t.has(o)||(t.add(o),a.isAbstract&&e.push(a))}n.push(...r.interfaces)}return e}function qi(i,t){if(i.tag==="error")return null;let e=Po(i);return e?t.arity<0||e.params.length===t.arity?null:"incompatible parameter types in lambda expression":`${i.tag==="array"?"Array":i.tag==="library"||i.tag==="diamond"?i.symbol.name:i.tag==="class"?i.symbol.displayName:M(i)} is not a functional interface`}function je(i,t){return t.tag==="lambda"?qi(i,t)??"":Ot(i)&&Ot(t)?`possible lossy conversion from ${M(t)} to ${M(i)}`:`${M(t)} cannot be converted to ${M(i)}`}function Rt(i){switch(i.tag){case"int":return"I";case"char":return"C";case"boolean":return"Z";case"long":return"J";case"double":return"D";case"byte":return"B";case"short":return"S";case"float":return"F";case"string":return"Ljava.lang.String;";case"class":return`L${i.symbol.binaryName};`;case"library":case"diamond":return`L${i.symbol.qualifiedName};`;case"object":return"Ljava.lang.Object;";case"array":return"["+Rt(i.element);case"typevar":return Rt(K(i));default:throw new Error(`codegen: descriptor of ${M(i)}`)}}var Wi=new WeakMap,Xi=new WeakMap,Yi=new WeakMap;function pr(i){let t=Wi.get(i);return t||Wi.set(i,t={kind:"type",symbol:i}),t}function yr(i,t){let e=Xi.get(i);return e||Xi.set(i,e={kind:"method",method:i,owner:t}),e}function gr(i){let t=Yi.get(i);return t||Yi.set(i,t={kind:"program",variable:i}),t}function Qi(i,t){return i.symbol?{name:i.name,decl:gr(i.symbol)}:t?t.kind==="method"?t.method.typeParams?.includes(i.name)?{name:i.name,decl:t}:t.owner.typeParams.includes(i.name)?{name:i.name,decl:pr(t.owner)}:null:t.kind==="type"&&t.symbol.typeParams.includes(i.name)?{name:i.name,decl:t}:null:null}function Zi(i){if(i.decl.kind==="method"){let t=i.decl.method.typeParamBounds?.[i.name];return t?{type:t,decl:i.decl}:null}if(i.decl.kind==="program"){let t=i.decl.variable.bounds[0];return t?{type:t,decl:null}:null}return null}function ta(i,t,e){let n=[],s=new Set,r=(b,S)=>b.name===S.name&&b.decl===S.decl,a=b=>{if(n.some(x=>r(x,b)))return;n.push(b);let S=Zi(b);S&&o(S.type,S.decl);let v=b.decl;if(!(v.kind!=="method"||s.has(v))){s.add(v);for(let x of v.method.typeParams??[])a({name:x,decl:v});for(let x of v.method.params)o(x,v)}},o=(b,S)=>{switch(b.tag){case"typevar":{let v=Qi(b,S);v&&a(v);return}case"array":return o(b.element,S);case"wildcard":b.bound&&o(b.bound,S);return;case"library":return b.args.forEach(v=>o(v,S));case"class":return b.args?.forEach(v=>o(v,S));default:return}};a(i);for(let b of[...t,...e])o(b.type,b.decl);let c=b=>{let S=n.filter(v=>v.name===b.name);return S.length>1?`${b.name}#${S.findIndex(v=>v.decl===b.decl)+1}`:b.name},u=(b,S)=>{switch(b.tag){case"typevar":{let v=Qi(b,S);return v?c(v):b.name}case"array":return`${u(b.element,S)}[]`;case"wildcard":return b.bound?`? ${b.isSuper?"super":"extends"} ${u(b.bound,S)}`:"?";case"library":return b.args.length?`${b.symbol.name}<${b.args.map(v=>u(v,S)).join(",")}>`:b.symbol.name;case"class":return b.args?.length?`${b.name}<${b.args.map(v=>u(v,S)).join(",")}>`:b.name;default:return M(b)}},d=b=>{if(b.kind==="type")return`${b.symbol.isInterface?"interface":"class"} ${b.symbol.name}`;if(b.kind==="program")return b.variable.declaredIn;let S=b.method,v=S.params.map((x,C)=>S.varargs&&C===S.params.length-1&&x.tag==="array"?`${u(x.element,b)}...`:u(x,b));return`method <${(S.typeParams??[]).map(x=>c({name:x,decl:b})).join(",")}>${S.name}(${v.join(",")})`},h=b=>{if(b.decl.kind==="method"&&b.decl.method.typeParamShown?.[b.name])return b.decl.method.typeParamShown[b.name];let S=Zi(b);return S?u(S.type,S.decl):"Object"},m=b=>[...new Set(b.map(S=>u(S.type,S.decl)))].join(","),p=n.map(c);return[` reason: argument mismatch; inference variable ${c(i)} has incompatible bounds`,` upper bounds: ${m(t)}`,` lower bounds: ${m(e)}`,n.length===1?` where ${p[0]} is a type-variable:`:` where ${p.join(",")} are type-variables:`,...n.map((b,S)=>` ${p[S]} extends ${h(b)} declared in ${d(b.decl)}`)]}function bs(i){if(i.kind==="MethodRef")return it(i);let t=i.kind==="Lambda"?na(i):it(i);return t.length>=20?`${t.slice(0,10)}[...]${t.slice(-5)}`:t}function na(i){let t=i.params.every(n=>!n.type)?i.params.map(n=>n.name).join(","):i.params.map(n=>`${ie(n.type)} ${n.name}`).join(", "),e=i.body.kind==="Block"?sa(i.body.statements):it(i.body);return`(${t})->${e}`}function ie(i){switch(i.kind){case"PrimitiveType":return i.name;case"ClassType":return i.names.join(".")+(i.typeArguments?`<${i.typeArguments.map(ie).join(",")}>`:i.diamond?"<>":"");case"ArrayType":return`${ie(i.element)}[]`;case"WildcardType":return i.bound?`? ${i.isSuper?"super":"extends"} ${ie(i.bound)}`:"?";case"VoidType":return"void";case"VarType":return"var"}}function ea(i,t){let e={"\\b":"\\\\b"," ":"\\\\t","\\n":"\\\\n","\\f":"\\\\f","\\r":"\\\\r",\'"\':\'\\\\"\',"\'":"\\\\\'","\\\\":"\\\\\\\\"},n="";for(let s of i){let r=s.charCodeAt(0);n+=e[s]??(r<32||r>126?`\\\\u${r.toString(16).padStart(4,"0")}`:s)}return t+n+t}function it(i){switch(i.kind){case"Literal":switch(i.literalKind){case"long":return`${i.value}L`;case"double":return ue(i.value);case"float":return`${ue(parseFloat(String(i.value)))}F`;case"char":return ea(i.value,"\'");case"string":case"text-block":return ea(i.value,\'"\');default:return String(i.value)}case"Name":return i.identifier;case"FieldAccess":return`${it(i.target)}.${i.name}`;case"MethodCall":return`${i.target?it(i.target)+".":""}${i.name}(${i.args.map(it).join(", ")})`;case"Unary":return i.operator+it(i.operand);case"IncDec":return i.prefix?i.operator+it(i.operand):it(i.operand)+i.operator;case"Binary":return`${it(i.left)} ${i.operator} ${it(i.right)}`;case"Assignment":return`${it(i.target)} ${i.operator} ${it(i.value)}`;case"Parenthesized":return`(${it(i.expression)})`;case"ArrayAccess":return`${it(i.array)}[${it(i.index)}]`;case"NewArray":{let t=i.dimensions.map(e=>`[${it(e)}]`).join("")+"[]".repeat(i.extraDims);return i.initializer?`new ${ie(i.elementType)}${"[]".repeat(Math.max(1,i.extraDims))}{${i.initializer.elements.map(e=>e.kind==="ArrayInitializer"?"{...}":it(e)).join(", ")}}`:`new ${ie(i.elementType)}${t}`}case"Cast":return`(${ie(i.targetType)})${it(i.expression)}`;case"This":return"this";case"NewObject":return`${i.outerExpression?`${it(i.outerExpression)}.`:""}new ${ie(i.classType)}(${i.args.map(it).join(", ")})`;case"Conditional":return`${it(i.condition)} ? ${it(i.whenTrue)} : ${it(i.whenFalse)}`;case"SwitchExpression":return`switch (${it(i.selector)}) {...}`;case"Lambda":return na(i);case"MethodRef":return`${i.arrayType?ie(i.arrayType):i.target?it(i.target):""}::${i.name}`;case"InstanceOf":return`${it(i.expression)} instanceof ${ie(i.targetType)}${i.binding?` ${i.binding.name}`:""}`;case"Super":return"super";case"ClassLiteral":return`${it(i.target)}.class`}}function sa(i){return i.length?`{ ${i.map(Xe).join(" ")} }`:"{ }"}function Xe(i){switch(i.kind){case"Block":return sa(i.statements);case"ReturnStatement":return i.value?`return ${it(i.value)};`:"return;";case"ExpressionStatement":return`${it(i.expression)};`;case"LocalVariableDeclaration":return`${ie(i.type)} ${i.declarators.map(t=>t.init&&t.init.kind!=="ArrayInitializer"?`${t.name} = ${it(t.init)}`:t.name).join(", ")};`;case"IfStatement":return`if (${it(i.condition)}) ${Xe(i.then)}${i.otherwise?` else ${Xe(i.otherwise)}`:""}`;case"WhileStatement":return`while (${it(i.condition)}) ${Xe(i.body)}`;case"DoStatement":return`do ${Xe(i.body)} while (${it(i.condition)});`;case"ForStatement":return`for (...) ${Xe(i.body)}`;case"ForEachStatement":return`for (${ie(i.type)} ${i.name} : ${it(i.iterable)}) ${Xe(i.body)}`;case"BreakStatement":return i.label?`break ${i.label};`:"break;";case"ContinueStatement":return i.label?`continue ${i.label};`:"continue;";case"EmptyStatement":return";";case"YieldStatement":return`yield ${it(i.value)};`;default:return"..."}}function Fn(i){switch(i.kind){case"int":case"byte":case"short":case"long":return String(i.value);case"double":return ue(i.value);case"float":return Je(i.value);case"char":return String.fromCharCode(i.value);case"boolean":return i.value?"true":"false";case"string":return i.value}}function q(i){return{kind:"int",value:i|0}}function _n(i){return{kind:"char",value:i&65535}}function Jt(i){return{kind:"long",value:BigInt.asIntN(64,i)}}function Ts(i){return{kind:"byte",value:i<<24>>24}}function Ss(i){return{kind:"short",value:i<<16>>16}}function de(i){return{kind:"float",value:Math.fround(i)}}function ee(i){return{kind:"double",value:i}}function bt(i){return{kind:"boolean",value:i}}function br(i){return{kind:"string",value:i}}var Tr=new Set(["int","byte","short","char"]);function gn(i){return Tr.has(i.kind)?i.value:void 0}function bn(i){if(i.kind==="long")return i.value;if(Tr.has(i.kind))return BigInt(i.value)}function Un(i){if(i.kind==="double"||i.kind==="float")return i.value;if(i.kind==="long")return ms(wt(i.value));if(Tr.has(i.kind))return i.value}function xs(i){if(i.kind==="long")return hn(wt(i.value));let t=Un(i);return t===void 0?void 0:Math.fround(t)}function ra(i,t){if(i.kind==="boolean"||i.kind==="string")return;let e=()=>i.kind==="double"||i.kind==="float"?Mn(i.value):i.kind==="long"?ds(wt(i.value)):i.value;switch(t){case"double":return ee(Un(i));case"float":return de(xs(i));case"long":return i.kind==="double"||i.kind==="float"?Jt(BigInt($n(i.value))):Jt(bn(i));case"int":return q(e());case"byte":return Ts(e());case"short":return Ss(e());case"char":return _n(e())}}function Bn(i){return i!==void 0&&i.kind==="boolean"&&i.value}function vs(i){return i!==void 0&&i.kind==="boolean"&&!i.value}var ae=["none","message","message-cause","cause"],Gt=["none","message"],Ro=[["java.lang.Throwable",null,ae],["java.lang.Exception","java.lang.Throwable",ae],["java.lang.Error","java.lang.Throwable",ae],["java.lang.RuntimeException","java.lang.Exception",ae],["java.lang.ArithmeticException","java.lang.RuntimeException",Gt],["java.lang.ArrayStoreException","java.lang.RuntimeException",Gt],["java.lang.ClassCastException","java.lang.RuntimeException",Gt],["java.lang.IllegalArgumentException","java.lang.RuntimeException",ae],["java.lang.IllegalStateException","java.lang.RuntimeException",ae],["java.lang.IndexOutOfBoundsException","java.lang.RuntimeException",["none","message","index"],"Index out of range: "],["java.lang.ArrayIndexOutOfBoundsException","java.lang.IndexOutOfBoundsException",["none","message","index"],"Array index out of range: "],["java.lang.StringIndexOutOfBoundsException","java.lang.IndexOutOfBoundsException",["none","message","index"],"String index out of range: "],["java.lang.NegativeArraySizeException","java.lang.RuntimeException",Gt],["java.lang.NullPointerException","java.lang.RuntimeException",Gt],["java.lang.NumberFormatException","java.lang.IllegalArgumentException",Gt],["java.lang.UnsupportedOperationException","java.lang.RuntimeException",ae],["java.lang.CloneNotSupportedException","java.lang.Exception",Gt],["java.lang.InterruptedException","java.lang.Exception",Gt],["java.lang.ReflectiveOperationException","java.lang.Exception",ae],["java.lang.ClassNotFoundException","java.lang.ReflectiveOperationException",["none","message","message-cause"]],["java.lang.AssertionError","java.lang.Error",["none","object"]],["java.lang.LinkageError","java.lang.Error",["none","message","message-cause"]],["java.lang.ExceptionInInitializerError","java.lang.LinkageError",Gt],["java.lang.NoClassDefFoundError","java.lang.LinkageError",Gt],["java.lang.VirtualMachineError","java.lang.Error",ae],["java.lang.StackOverflowError","java.lang.VirtualMachineError",Gt],["java.lang.OutOfMemoryError","java.lang.VirtualMachineError",Gt],["java.util.NoSuchElementException","java.lang.RuntimeException",ae],["java.util.InputMismatchException","java.util.NoSuchElementException",Gt],["java.util.ConcurrentModificationException","java.lang.RuntimeException",ae],["java.util.EmptyStackException","java.lang.RuntimeException",["none"]],["java.util.IllegalFormatException","java.lang.IllegalArgumentException",[]],["java.util.MissingFormatArgumentException","java.util.IllegalFormatException",[]],["java.util.UnknownFormatConversionException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatConversionException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatPrecisionException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatWidthException","java.util.IllegalFormatException",[]],["java.util.MissingFormatWidthException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatCodePointException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatFlagsException","java.util.IllegalFormatException",[]],["java.util.FormatFlagsConversionMismatchException","java.util.IllegalFormatException",[]],["java.util.DuplicateFormatFlagsException","java.util.IllegalFormatException",[]],["java.util.UnknownFormatFlagsException","java.util.IllegalFormatException",[]],["java.util.regex.PatternSyntaxException","java.lang.IllegalArgumentException",[]],["java.time.DateTimeException","java.lang.RuntimeException",["message","message-cause"]],["java.time.format.DateTimeParseException","java.time.DateTimeException",[]],["java.time.temporal.UnsupportedTemporalTypeException","java.time.DateTimeException",["message","message-cause"]],["java.io.IOException","java.lang.Exception",ae],["java.io.FileNotFoundException","java.io.IOException",Gt],["java.io.EOFException","java.io.IOException",Gt],["java.io.UncheckedIOException","java.lang.RuntimeException",["message-cause","cause"]]],Tn=Ro.map(([i,t,e,n])=>({name:i,superclass:t,constructors:e,...n?{indexPrefix:n}:{}})),mt={message:0,cause:1,trace:2,suppressed:3,causeSet:4},ia=5;function aa(i){let t=i.lastIndexOf(".");return{pkg:i.slice(0,t),simple:i.slice(t+1)}}var Vn=new Set(["Object","Integer","Long","Double","Float","Short","Byte","Character","Boolean","Number","Math","StrictMath","StringBuilder","StringBuffer","CharSequence","Iterable","Comparable","Thread","Runnable","Runtime","Process","Class","Enum","Record","Void","IO","Throwable","Exception","Error","RuntimeException","ArithmeticException","ArrayIndexOutOfBoundsException","IndexOutOfBoundsException","StringIndexOutOfBoundsException","NullPointerException","ClassCastException","IllegalArgumentException","IllegalStateException","NumberFormatException","UnsupportedOperationException","NegativeArraySizeException","StackOverflowError","OutOfMemoryError","AssertionError","InterruptedException","CloneNotSupportedException","Override","Deprecated","FunctionalInterface","SuppressWarnings","SafeVarargs","Cloneable","AutoCloseable","Appendable","Readable","ThreadLocal"]),Jo=new Set(["printf","format","flush","write","append","close","checkError","writeBytes","charset"]),oa=new Set(["currentTimeMillis","nanoTime","exit","arraycopy","getProperty","getProperties","setProperty","clearProperty","lineSeparator","identityHashCode","getenv","gc","setOut","setErr","setIn","console","inheritedChannel","getLogger","load","loadLibrary","mapLibraryName","runFinalization"]),Do=new Set(["substring","indexOf","lastIndexOf","isBlank","toUpperCase","toLowerCase","trim","strip","stripLeading","stripTrailing","split","contains","startsWith","endsWith","replace","replaceAll","replaceFirst","compareToIgnoreCase","equalsIgnoreCase","concat","chars","codePoints","format","formatted","valueOf","copyValueOf","join","repeat","matches","hashCode","intern","codePointAt","codePointBefore","codePointCount","offsetByCodePoints","getBytes","getChars","lines","indent","translateEscapes","stripIndent","transform","describeConstable","resolveConstantDesc","contentEquals","regionMatches","subSequence","toString","getClass","wait","notify","notifyAll","splitWithDelimiters"]),jo=new Set(["name","ordinal","compareTo","equals","hashCode","getDeclaringClass"]),Fo=new Set(["clone","getClass","hashCode","equals","toString","wait","notify","notifyAll"]),ws={Pattern:{UNIX_LINES:{type:U,constant:q(1)},CASE_INSENSITIVE:{type:U,constant:q(2)},COMMENTS:{type:U,constant:q(4)},MULTILINE:{type:U,constant:q(8)},LITERAL:{type:U,constant:q(16)},DOTALL:{type:U,constant:q(32)},UNICODE_CASE:{type:U,constant:q(64)},CANON_EQ:{type:U,constant:q(128)},UNICODE_CHARACTER_CLASS:{type:U,constant:q(256)}},Integer:{MAX_VALUE:{type:U,constant:q(2147483647)},MIN_VALUE:{type:U,constant:q(-2147483648)},SIZE:{type:U,constant:q(32)},BYTES:{type:U,constant:q(4)}},Long:{MAX_VALUE:{type:Lt,constant:Jt(nr)},MIN_VALUE:{type:Lt,constant:Jt(sr)},SIZE:{type:U,constant:q(64)},BYTES:{type:U,constant:q(8)}},Double:{MAX_VALUE:{type:ht,constant:ee(Number.MAX_VALUE)},MIN_VALUE:{type:ht,constant:ee(Number.MIN_VALUE)},MIN_NORMAL:{type:ht,constant:ee(22250738585072014e-324)},POSITIVE_INFINITY:{type:ht,constant:ee(1/0)},NEGATIVE_INFINITY:{type:ht,constant:ee(-1/0)},NaN:{type:ht,constant:ee(NaN)},SIZE:{type:U,constant:q(64)},BYTES:{type:U,constant:q(8)}},Float:{MAX_VALUE:{type:xt,constant:de(34028234663852886e22)},MIN_VALUE:{type:xt,constant:de(1401298464324817e-60)},MIN_NORMAL:{type:xt,constant:de(11754943508222875e-54)},POSITIVE_INFINITY:{type:xt,constant:de(1/0)},NEGATIVE_INFINITY:{type:xt,constant:de(-1/0)},NaN:{type:xt,constant:de(NaN)},MAX_EXPONENT:{type:U,constant:q(127)},MIN_EXPONENT:{type:U,constant:q(-126)},SIZE:{type:U,constant:q(32)},BYTES:{type:U,constant:q(4)}},Byte:{MAX_VALUE:{type:Pn,constant:Ts(127)},MIN_VALUE:{type:Pn,constant:Ts(-128)},SIZE:{type:U,constant:q(8)},BYTES:{type:U,constant:q(1)}},Short:{MAX_VALUE:{type:yn,constant:Ss(32767)},MIN_VALUE:{type:yn,constant:Ss(-32768)},SIZE:{type:U,constant:q(16)},BYTES:{type:U,constant:q(2)}},Character:{MAX_VALUE:{type:we,constant:_n(65535)},MIN_VALUE:{type:we,constant:_n(0)},MIN_RADIX:{type:U,constant:q(2)},MAX_RADIX:{type:U,constant:q(36)},SIZE:{type:U,constant:q(16)},BYTES:{type:U,constant:q(2)}},Math:{PI:{type:ht,constant:ee(Math.PI)},E:{type:ht,constant:ee(Math.E)}},StreamTokenizer:{TT_EOF:{type:U,constant:q(-1)},TT_EOL:{type:U,constant:q(10)},TT_NUMBER:{type:U,constant:q(-2)},TT_WORD:{type:U,constant:q(-3)}}},Hn={abs:[{params:[U],returnType:U,fn:"abs-int"},{params:[Lt],returnType:Lt,fn:"abs-long"},{params:[xt],returnType:xt,fn:"abs-float"},{params:[ht],returnType:ht,fn:"abs-double"}],max:[{params:[U,U],returnType:U,fn:"max-int"},{params:[Lt,Lt],returnType:Lt,fn:"max-long"},{params:[xt,xt],returnType:xt,fn:"max-float"},{params:[ht,ht],returnType:ht,fn:"max-double"}],min:[{params:[U,U],returnType:U,fn:"min-int"},{params:[Lt,Lt],returnType:Lt,fn:"min-long"},{params:[xt,xt],returnType:xt,fn:"min-float"},{params:[ht,ht],returnType:ht,fn:"min-double"}],sqrt:[{params:[ht],returnType:ht,fn:"sqrt"}],floor:[{params:[ht],returnType:ht,fn:"floor"}],ceil:[{params:[ht],returnType:ht,fn:"ceil"}],round:[{params:[xt],returnType:U,fn:"round-float"},{params:[ht],returnType:Lt,fn:"round-double"}]},la=i=>i.target?.kind==="Name"&&i.target.staticOwner===!0,zn=i=>i.tag==="int"||i.tag==="char"||i.tag==="long"||i.tag==="byte"||i.tag==="short",ca=i=>i.tag==="char"||i.tag==="byte"||i.tag==="short"?U:i;function Xn(i,t){return i.tag==="double"||t.tag==="double"?ht:i.tag==="float"||t.tag==="float"?xt:i.tag==="long"||t.tag==="long"?Lt:U}var ks=new Set(["java.lang","java.util","java.io","java.math","java.net","java.nio","java.nio.file","java.nio.charset","java.text","java.time","java.time.format","java.time.temporal","java.util.function","java.util.stream","java.util.concurrent","java.util.concurrent.atomic","java.util.regex","java.lang.reflect","java.security","java.awt","javax.swing"]),ka=new Set(["LinkedList","TreeMap","TreeSet","LinkedHashMap","LinkedHashSet","Stack","Optional","OptionalInt","Date","Calendar","Locale","UUID","NoSuchElementException","ConcurrentModificationException","SortedMap","SortedSet","NavigableMap","NavigableSet","AbstractMap","EnumMap","EnumSet","IdentityHashMap","WeakHashMap","Properties","Timer","Formatter","Currency","InputMismatchException","Spliterator","IntSummaryStatistics","Base64","Map.Entry","Entry","EventListener","Observable","SequencedCollection"]),Cs={"java.util":[...ka].filter(i=>!i.includes(".")),"java.io":["PrintStream","InputStream","File","FileReader","FileWriter","FileInputStream","FileOutputStream","DataInputStream","DataOutputStream","BufferedInputStream","BufferedOutputStream","ByteArrayInputStream","ByteArrayOutputStream","Serializable","Closeable","Flushable","Console"],"java.math":["BigInteger","BigDecimal","RoundingMode","MathContext"],"java.time":["LocalTime","LocalDateTime","ZonedDateTime","Instant","Duration","Year","YearMonth","ZoneId","Clock"],"java.time.format":["TextStyle","FormatStyle"],"java.time.temporal":["TemporalAdjusters","TemporalUnit","Temporal"],"java.text":["DecimalFormat","NumberFormat","SimpleDateFormat","MessageFormat"],"java.util.regex":["PatternSyntaxException"],"java.util.concurrent":["ConcurrentHashMap","CopyOnWriteArrayList","ExecutorService","Executors","TimeUnit","Future","CompletableFuture","ThreadLocalRandom","CountDownLatch","ConcurrentLinkedQueue","LinkedBlockingQueue","ArrayBlockingQueue"],"java.util.concurrent.atomic":["AtomicInteger","AtomicLong","AtomicBoolean","AtomicReference"],"java.nio.file":["Files","Path","Paths"]},ua={private:0,package:1,protected:2,public:3},_o={Comparable:["compareTo"],Comparator:["compare"],Iterable:["iterator"],Iterator:["hasNext","next"]},ha=new Set(["ArrayList","LinkedList","HashMap","LinkedHashMap","TreeMap","HashSet","LinkedHashSet","TreeSet","ArrayDeque","PriorityQueue","AbstractList"]),Uo={ArrayList:["add(E)","get(int)","size()"],HashMap:["put(K,V)","get(Object)","containsKey(Object)","remove(Object)"],LinkedHashMap:["put(K,V)","get(Object)","containsKey(Object)","remove(Object)","removeEldestEntry(Entry)"],TreeMap:["get(Object)","containsKey(Object)"],AbstractList:["get(int)","size()","add(int,E)","set(int,E)","remove(int)","add(E)"]},Bo={"ArrayDeque.<init>(Collection)":["size()"],"ArrayList.<init>(Collection)":[],"Collections.addAll(Collection,T[])":["add(E)"],"Collections.binarySearch(List,T)":["size()","get(int)"],"Collections.binarySearch(List,T,Comparator)":["size()","get(int)"],"Collections.disjoint(Collection,Collection)":["size()"],"Collections.fill(List,T)":["size()"],"Collections.frequency(Collection,Object)":[],"Collections.max(Collection)":[],"Collections.max(Collection,Comparator)":[],"Collections.min(Collection)":[],"Collections.min(Collection,Comparator)":[],"Collections.reverse(List)":["size()","get(int)"],"Collections.shuffle(List)":["size()","get(int)"],"Collections.shuffle(List,Random)":["size()","get(int)"],"Collections.sort(List)":[],"Collections.sort(List,Comparator)":[],"Collections.swap(List,int,int)":["get(int)"],"Collections.unmodifiableCollection(Collection)":["*"],"Collections.unmodifiableList(List)":["*"],"Collections.unmodifiableMap(Map)":["*"],"Collections.unmodifiableSet(Set)":["*"],"HashMap.<init>(Map)":["size()"],"HashSet.<init>(Collection)":["size()"],"LinkedHashMap.<init>(Map)":["size()"],"LinkedHashSet.<init>(Collection)":["size()"],"LinkedList.<init>(Collection)":[],"List.copyOf(Collection)":[],"Map.copyOf(Map)":[],"PriorityQueue.<init>(Collection)":[],"Set.copyOf(Collection)":["size()"],"String.join(String,Iterable)":[],"TreeMap.<init>(Map)":["size()"],"TreeMap.<init>(SortedMap)":["size()"],"TreeSet.<init>(Collection)":["size()"],"TreeSet.<init>(SortedSet)":["size()"],"addAll(Collection)":["size()"],"containsAll(Collection)":[],"putAll(Map)":["size()"],"removeAll(Collection)":["size()"],"retainAll(Collection)":[],"equals(Object)":["size()","get(Object)","containsKey(Object)"]},Vo=["size()","get(int)","get(Object)","containsKey(Object)"],Ho={"java.util.regex.PatternSyntaxException":["getDescription","getIndex","getPattern"],"java.time.format.DateTimeParseException":["getParsedString","getErrorIndex"]},da=new Set(["toString()","equals(Object)","hashCode()"]),zo=new Set(["Comparable","Comparator","Iterable","Iterator"]);function ma(i){return zo.has(i.name)||i.functional!==void 0}var Es=new Set(["getClass","wait","notify","notifyAll","clone","finalize"]),As=i=>i.length?i.map(M).join(","):"no arguments";function Ca(i,t,e){if(!Q(i)){let n=e?zt(i):null;return n!==null&&Ca(n,t,!1)}return!t||t.tag==="object"?!0:i.tag==="array"?!1:t.tag==="library"&&t.symbol.isInterface||i.tag==="library"&&i.symbol.isInterface||i.tag==="class"&&i.symbol.isInterface?!0:z(K(i),K(t))||z(K(t),K(i))}function Go(i,t){let e=[];for(let o=0;o<i.length;){let c=o;for(;c<i.length&&i[c].owner===i[o].owner;)c++;e.push(...i.slice(o,c).reverse()),o=c}let n=(o,c)=>t(o,c)&&!t(c,o),s=e[0],r=null;for(let o of e.slice(1)){if(!r){n(o,s)?s=o:t(s,o)||(r=[s,o]);continue}r.every(c=>n(o,c))?(s=o,r=null):r.every(c=>n(c,o))||r.unshift(o)}let a=(r??i.slice(0,2)).slice().reverse();return[a[0],a[1]]}var fa=[ft,we,U,Lt,xt,ht,Qt(we),ut,H];function Ko(i){return(i==="println"?[[],...fa.map(e=>[e])]:fa.map(e=>[e])).map(e=>({owner:"PrintStream",name:i,params:e,returnType:Tt}))}var Gn={length:{owner:"String",name:"length",params:[],returnType:U},charAt:{owner:"String",name:"charAt",params:[U],returnType:we},equals:{owner:"String",name:"equals",params:[H],returnType:ft},isEmpty:{owner:"String",name:"isEmpty",params:[],returnType:ft},toCharArray:{owner:"String",name:"toCharArray",params:[],returnType:Qt(we)},compareTo:{owner:"String",name:"compareTo",params:[ut],returnType:U}},Le={toString:{owner:"Object",name:"toString",params:[],returnType:ut,objectMethod:"toString"},hashCode:{owner:"Object",name:"hashCode",params:[],returnType:U,objectMethod:"hashCode"},equals:{owner:"Object",name:"equals",params:[H],returnType:ft,objectMethod:"equals"}},Sr=()=>({all:!1,vars:new Set,unassigned:new Set}),Kt=()=>({all:!0,vars:new Set,unassigned:new Set}),_e=i=>({all:i.all,vars:new Set(i.vars),unassigned:new Set(i.unassigned)});function vt(i,...t){let e=i;for(let n of t){if(e.all){e=_e(n);continue}if(n.all)continue;let s=new Set;for(let a of e.vars)n.vars.has(a)&&s.add(a);let r=new Set;for(let a of e.unassigned)n.unassigned.has(a)&&r.add(a);e={all:!1,vars:s,unassigned:r}}return e}function qo(i,t){if(i.all||t.all)return i.all?_e(t.all?i:t):_e(i);let e=new Set;for(let n of i.unassigned)t.unassigned.has(n)&&e.add(n);return{all:!1,vars:new Set([...i.vars,...t.vars]),unassigned:e}}function Sn(i,t){return i.all||i.vars.has(t)}function Kn(i,t){return i.all||i.unassigned.has(t)}function Ne(i,t){if(i.all)return i;let e=_e(i);return e.vars.add(t),e.unassigned.delete(t),e}function Wo(i,t){if(i.all)return i;let e=_e(i);return e.vars.delete(t),e}function pa(i){return i.kind==="LocalVariableDeclaration"?i.declarators[0].pos:i.start}function nt(i){let t=i;for(;t.kind==="Parenthesized";)t=t.expression;return t}var Ht=(i,t)=>i.keywords.some(e=>e.name===t),Qn=class extends Error{fileName;constructor(t){super(`needs ${t}`),this.fileName=t}},Ze=class extends Error{};function Ea(i,t,e={}){return new wr(i[0].file,t,e.available??new Set).checkUnits(i,e.launch??!0)}var ya=(i,t,e)=>({file:i,launch:t,compact:e,imported:new Set,onDemand:new Set,staticSingle:new Map,staticOnDemand:[],unsupportedStaticSingle:new Map,unsupportedStaticOnDemand:[],unsupportedImports:new Map}),wr=class{#O;#mt=new WeakMap;#Mt;#D;#j=[];#W=[];#z=[];get#r(){return this.#O.file}get#y(){return this.#O.imported}get#s(){return this.#O.onDemand}get#n(){return this.#O.staticSingle}get#g(){return this.#O.staticOnDemand}get#h(){return this.#O.unsupportedStaticSingle}get#i(){return this.#O.unsupportedStaticOnDemand}get#w(){return this.#O.unsupportedImports}#H=[];#c=new Map;#C=new Map;#L=[];#F=!1;#K=0;#ft=!1;#bt=null;#at;#$=[];#N=new Map;#gt;get#a(){return this.#gt}set#a(t){this.#gt=t;let e=t?this.#mt.get(t.topLevel):void 0;e&&(this.#O=e)}#l=null;#E=null;#nt=null;#Xt=new Map;#_=!0;#M=[];#k=0;#P=[];#Bt=!1;#R=!1;#t=null;#p="";#d=new Map;#J=[];#m=[];#S=[];#pt=new Map;#Pt=[];#A=new Set;#Et=new WeakMap;#Y=[];#Rt=new Map;#Vt=new Map;#I=[];#X=[];#x=new Map;#U=new Map;#tt=0;#Q=[];constructor(t,e,n){this.#O=ya(t,!0,!1),this.#Mt=n,this.#D=e}#e(t,e,n,s){this.#D.error(this.#r,t,"type",e,n,s)}#st(t,e,n,s){let r=a=>a!==void 0&&a.has(e);for(let a=this.#a??null;a;a=a.outer)if(r(a.suppressed))return;r(this.#at)||this.#$.some(r)||this.#D.warning(this.#r,t,e,`[${e}] ${n}`,s)}#yt(t,e){let n=this.#N.get(t);if(n)return n;let s=new Set;this.#N.set(t,s);let r=new Set,a={Override:["method"],FunctionalInterface:["type"],SafeVarargs:["method","constructor"],SuppressWarnings:["type","field","method","parameter","constructor","local"],Deprecated:["type","field","method","parameter","constructor","local"]};for(let o of t.annotations??[]){if(!(Object.hasOwn(a,o.name)&&(o.names.length===1?!this.#me(o.name):o.names.join(".")===`java.lang.${o.name}`))){o.names.length===1&&!this.#me(o.name)&&!Vn.has(o.name)&&!this.#w.has(o.name)?this.#e(o.namePos,k.cantResolve,"cannot find symbol",[` symbol: class ${o.name}`,` location: class ${this.#a.displayName}`]):this.#o(o.pos,`the annotation @${o.names.join(".")}`,!0);continue}if(r.has(o.name)){this.#e(o.pos,k.syntax,`${o.name} is not a repeatable annotation interface`);continue}if(r.add(o.name),!a[o.name].includes(e)){this.#e(o.pos,k.syntax,"annotation interface not applicable to this kind of declaration");continue}let u=o.args??[];if(o.name==="SuppressWarnings"){let d=u.find(h=>h.name===null||h.name==="value");if(!d||u.some(h=>h!==d)){d?this.#o(o.pos,"elements of @SuppressWarnings other than value"):this.#e(o.pos,k.syntax,"annotation @SuppressWarnings is missing a default value for the element \'value\'");continue}for(let h of d.value.kind==="ElementArray"?d.value.elements:[d.value])h.kind==="Literal"&&(h.literalKind==="string"||h.literalKind==="text-block")?s.add(h.value):h.kind==="Literal"?this.#e(h.pos,k.incompatibleTypes,`incompatible types: ${h.literalKind} cannot be converted to String`):this.#o(h.pos,"@SuppressWarnings values other than string literals")}else o.name==="Deprecated"?u.every(h=>h.name==="since"&&h.value.kind==="Literal"&&h.value.literalKind==="string"||h.name==="forRemoval"&&h.value.kind==="Literal"&&h.value.literalKind==="boolean")||this.#o(o.pos,"these elements of @Deprecated"):u.length&&this.#o(o.pos,`elements of @${o.name}`)}return s}#At(t,e){return t.annotations?.find(n=>n.name===e)}#o(t,e,n=!1){this.#e(t,k.unsupported,`${e} ${n?"is":"are"} not supported in this version`)}checkUnits(t,e=!0){if(!t[0].unit.types.length)return this.#D.launchError(this.#r.name,k.noMain,"no class declared in source file"),null;let s=this.#O,r=[];t.forEach(({unit:c,file:u},d)=>{let h=c.types[0]?.implicit===!0,m=d===0?s:ya(u,!1,h);m.compact=h,this.#O=m,d>0&&h&&r.push({declaration:c.types[0],file:u});for(let b of c.imports)this.#oe(b);if(h)for(let b of Object.keys(Cs))this.#Tt(b);let p=this.#W.length;for(let b of c.types)this.#Nt(b,null);for(let b of this.#W.slice(p))b.file=u,this.#mt.set(b,m);if(d>0&&!h){let b=u.name.replace(/\\.java$/,"");if(!this.#W.slice(p).some(S=>S.name===b))throw new Ze(`${u.name} does not declare class ${b}, so the launcher cannot find that class there`)}}),this.#O=s,this.#Qt();for(let c of this.#j)!c.typeParams||c.local||(this.#a=c,this.#F=!1,this.#un(c.typeParams,c.declaration.typeParams));let a=c=>c.anonymous===!0||c.local===!0||c.outer!==null&&a(c.outer);for(let c of this.#j)a(c)||this.#ue(c);this.#Pe(this.#j.filter(c=>!a(c)));for(let c of this.#j)a(c)||this.#Je(c);this.#ze();let o=this.#W[0];for(let{declaration:c,file:u}of r){let d=c.symbol;if(this.#a=d,!this.#Ht(d))return this.#e(c.members[0].start,k.noMain,"compact source file does not have main method in the form of void main() or void main(String[] args)"),null;throw new Ze(`${u.name} is a compact source file; only the launched file may be one`)}if(o&&(this.#a=o),o?.declaration.implicit&&!this.#Ht(o))return this.#e(o.declaration.members[0].start,k.noMain,"compact source file does not have main method in the form of void main() or void main(String[] args)"),null;for(let c of this.#W)this.#De(c),this.#D.hasErrors||this.#Ur(c);return this.#D.hasErrors||!o?null:e?this.#$e(o):{classes:this.#j,mainClass:o,methods:this.#z,staticFields:this.#H,selectors:this.#C,main:null,mainConstructor:null}}#$e(t){let e=this.#r.name.replace(/^.*[\\\\/]/,"").replace(/\\.java$/,""),n=this.#Ht(t)?t:this.#W.find(a=>a.name===e&&a.file===t.file);if(!n)return this.#D.launchError(this.#r.name,k.noMain,`can\'t find class: ${e}`),null;let s=this.#Ht(n);if(!s)return this.#D.launchError(this.#r.name,k.noMain,`can\'t find main(String[]) or main() method in class: ${n.name}`),null;let r=null;return!s.isStatic&&(r=n.constructors.find(a=>a.params.length===0)??null,!r)?(this.#D.launchError(this.#r.name,k.noMain,`can\'t find no argument constructor in class: ${n.name}`),null):{classes:this.#j,mainClass:n,methods:this.#z,staticFields:this.#H,selectors:this.#C,main:s,mainConstructor:r}}#Ht(t){let e=t.methods.filter(n=>this.#ve(n.declaration));return e.find(n=>n.params.length===1)??e.find(n=>n.params.length===0)??null}#ve(t){if(t.isConstructor||t.name!=="main"||t.returnType.kind!=="VoidType"||Ht(t.modifiers,"private"))return!1;if(t.params.length===0)return!0;if(t.params.length!==1)return!1;let e=t.params[0].type;return e.kind==="ArrayType"&&this.#ae(e.element)}#ae(t){if(t.kind!=="ClassType"||t.hasTypeArguments)return!1;let e=t.names.join(".");return e==="String"||e==="java.lang.String"}#oe(t){if(t.isStatic)return this.#ut(t);let e=t.names,n=t.onDemand?e.join("."):e.slice(0,-1).join("."),s=e[e.length-1],r=t.onDemand?e[e.length-1]:e[e.length-2],a=e.slice(0,t.onDemand?-1:-2).join(".");if($t[r]===a&&!Mt[r]){for(let[o,c]of Object.entries(Mt))c===r&&(t.onDemand||o===s)&&this.#y.add(o);if(t.onDemand||Mt[s]===r)return}if(!ks.has(n)){this.#e(t.lastDotPos,k.cantResolve,`package ${n} does not exist`);return}if(t.onDemand){this.#s.add(n),this.#Tt(n);return}if($t[s]===n&&!Mt[s]||Tn.some(o=>o.name===`${n}.${s}`)){this.#y.add(s);return}if(n==="java.util"&&!ka.has(s)){this.#e(t.lastDotPos,k.cantResolve,"cannot find symbol",[` symbol: class ${s}`,` location: package ${n}`]);return}this.#w.set(s,`${n}.${s}`)}#ut(t){let e=t.names,n=t.onDemand?e:e.slice(0,-1),s=this.#we(t,n);if(typeof s=="object"&&s!==null){t.onDemand?this.#i.push(s.unsupported):this.#h.set(e[e.length-1],s.unsupported);return}if(s===null){t.onDemand||this.#e(t.start,k.cantResolve,"static import only from classes and interfaces");return}if(t.onDemand){this.#g.includes(s)||this.#g.push(s);for(let[o,c]of Object.entries(Mt))c===s&&this.#y.add(o);return}let r=e[e.length-1],a=Mt[r]===s;if(a&&this.#y.add(r),this.#rt(s,r)||this.#It(s,r)){let o=this.#n.get(r)??[];o.includes(s)||o.push(s),this.#n.set(r,o)}else if(!a){let o=this.#zt(s)?.isInterface?"interface":"class";this.#e(t.start,k.cantResolve,"cannot find symbol",[` symbol: static ${r}`,` location: ${o} ${s}`])}}#we(t,e){let n=e[e.length-1],s=e.slice(0,-1).join("."),r=t.dots[e.length-2]??t.start,a=e[e.length-2];return a&&Mt[n]===a&&$t[a]===e.slice(0,-2).join(".")||s==="java.lang"&&(n==="Math"||n==="System"||n==="String")||$t[n]===s&&!Mt[n]?n:ks.has(s)&&((s==="java.lang"?Vn.has(n):(Cs[s]??[]).includes(n))||Tn.some(c=>c.name===`${s}.${n}`))?{unsupported:`${s}.${n}`}:(ks.has(s)||[...ks].some(o=>o.startsWith(`${s}.`))?this.#e(r,k.cantResolve,"cannot find symbol",[` symbol: class ${n}`,` location: package ${s}`]):this.#e(r,k.cantResolve,`package ${s} does not exist`),null)}#zt(t){return t==="Math"||t==="String"||t==="System"?Xt(t):se(t)??null}#rt(t,e){if(t==="Math"&&Object.hasOwn(Hn,e))return!0;if(t==="System")return oa.has(e);let n=this.#zt(t);return n?n.methods.some(s=>s.isStatic&&s.name===e)||t!=="String"&&n.unsupported.has(e):!1}#It(t,e){if(t==="System")return e==="out"||e==="err"||e==="in";if(Object.hasOwn(ws,t)&&Object.hasOwn(ws[t],e))return!0;if(t==="Math"||t==="String")return!1;let n=this.#zt(t)?.staticFields;return n!==void 0&&Object.hasOwn(n,e)}#f(t,e){let n=(this.#n.get(t)??[]).filter(s=>e.call(this,s,t));return n.length?n:this.#g.filter(s=>e.call(this,s,t))}#Ot(t,e){let n=this.#h.get(t)??this.#i[0];return n?(this.#o(e,`the class ${n}`,!0),!0):!1}#Lt(t){for(let e=this.#a;e;e=e.outer)if(this.#kt(e,t).length)return!0;return Object.hasOwn(Le,t)||Es.has(t)}#ot(t,e){return{kind:"Name",identifier:t,depth:1,pos:e.pos,start:e.start,end:e.end,staticOwner:!0}}#G(t,e){if(this.#Lt(t.name))return!0;let n=this.#f(t.name,this.#rt);if(n.length>1){let s=this.#Jt(t,n,e);if(!s)return!1;n=[s]}return n.length===1&&(t.target=this.#ot(n[0],{pos:t.selectPos,start:t.start,end:t.start})),!0}#Jt(t,e,n){let s=e.flatMap(d=>this.#u(d,t.name).map(h=>({owner:d,...h}))),r=s.filter(d=>this.#le(d,n,!0)),a=r.length?r:s.filter(d=>this.#le(d,n,!1));if(!a.length)return e.find(d=>this.#u(d,t.name).some(h=>h.params.length===n.length))??e[0];let o=(d,h)=>d.params.length===h.params.length&&d.params.every((m,p)=>We(K(h.params[p]),K(m))),c=a.filter(d=>a.every(h=>d===h||o(d,h))),u=[...new Set(c.map(d=>d.owner))];if(u.length===1)return u[0];if(c.length>=2&&!c.some(d=>d.varargs)){let[d,h]=c,m=p=>`method ${t.name}(${p.params.map(M).join(",")}) in ${p.owner}`;return this.#e(t.selectPos,k.cantResolve,`reference to ${t.name} is ambiguous`,[` both ${m(d)} and ${m(h)} match`]),null}return this.#o(t.selectPos,`a call of ${t.name}(), which more than one static import could mean`,!0),null}#u(t,e){let n=[];if(t==="Math"&&Object.hasOwn(Hn,e))for(let r of Hn[e])n.push({params:r.params,varargs:!1});let s=t==="System"?null:this.#zt(t);for(let r of s?.methods??[])r.isStatic&&r.name===e&&n.push({params:r.params,varargs:r.varargs===!0});return n}#le(t,e,n=!1){let{params:s,varargs:r}=t;if(n&&r&&e.length!==s.length)return!1;let a=r?s.length-1:s.length;return(r?e.length<a:e.length!==a)?!1:e.every((o,c)=>{if(o.tag==="lambda"||o.tag==="diamond")return!0;let u=c<a||r&&e.length===s.length&&o.tag==="array"?s[c]:s[a].element;return n?We(K(u),o):re(K(u),o)})}#Me(t){let e=this.#f(t.identifier,this.#It);return e.length?e.length>1?(this.#e(t.pos,k.cantResolve,`reference to ${t.identifier} is ambiguous`,[` both variable ${t.identifier} in ${e[1]} and variable ${t.identifier} in ${e[0]} match`]),"error"):{kind:"FieldAccess",target:this.#ot(e[0],t),name:t.identifier,namePos:t.pos,depth:2,pos:t.pos,start:t.start,end:t.end}:null}#Tt(t){for(let e of Cs[t]??[])$t[e]||Tn.some(n=>n.name===`${t}.${e}`)||this.#w.has(e)||this.#w.set(e,`${t}.${e}`)}#et(t){let e;if(t.length===1){e=t[0];let n=$t[e];if(!n||!(Mt[e]?this.#y.has(e):n==="java.lang"||this.#y.has(e)||this.#s.has(n)||this.#O.compact))return null}else if(t.length>=3&&t[0]==="java"&&$t[t[t.length-1]]===t.slice(0,-1).join(".")&&!Mt[t[t.length-1]])e=t[t.length-1];else if(t.length===2&&Mt[t[1]]===t[0]&&this.#et([t[0]]))e=t[1];else if(t.length===4&&t[0]==="java"&&Mt[t[3]]===t[2]&&$t[t[2]]===`java.${t[1]}`)e=t[3];else return null;return se(e)??null}#Nt(t,e){let n=t.modifiers,s=t.keyword==="interface",r=t.keyword==="enum",a=t.keyword==="record";for(let c of n.keywords)if(c.name!=="public"&&!(c.name==="abstract"&&!r&&!a)&&!(c.name==="final"&&!s&&!r)){if(c.name==="sealed"||c.name==="non-sealed"){if(!r&&!a)continue;this.#e(c.pos,k.syntax,`\'${c.name}\' is not allowed here`);continue}e&&["private","protected","static"].includes(c.name)||(c.name==="strictfp"?this.#o(c.pos,`\'strictfp\' ${s?"interfaces":"classes"}`):this.#e(t.keywordPos,k.syntax,`modifier ${c.name} not allowed here`))}if(e){if(e.membersByName.has(t.name)){this.#e(t.keywordPos,k.alreadyDefined,`class ${t.name} is already defined in class ${e.displayName}`);return}}else if(this.#W.some(c=>c.name===t.name)){this.#e(t.keywordPos,k.alreadyDefined,`duplicate class: ${t.name}`);return}let o={kind:"class",name:t.name,binaryName:e?`${e.binaryName}$${t.name}`:t.name,displayName:e?.topLevel.declaration.implicit?`${e.displayName}.${t.name}`:t.name,declaration:t,outer:e,topLevel:null,isInner:e!==null&&t.keyword==="class"&&!e.isInterface&&!Ht(n,"static"),isPrivate:Ht(n,"private"),isInterface:s,isAbstract:s||Ht(n,"abstract"),isFinal:r&&!t.enumConstants?.some(c=>c.body)||a||Ht(n,"final"),...Ht(n,"sealed")?{isSealed:!0}:{},...Ht(n,"non-sealed")?{isNonSealed:!0}:{},isEnum:r,isRecord:a,enumConstants:[],components:[],superclass:null,interfaces:[],libraryInterfaces:[],hierarchyState:0,index:this.#j.length,fields:[],fieldsByName:new Map,methods:[],methodsByName:new Map,constructors:[],members:[],membersByName:new Map,instanceCount:0,outerField:-1};if(o.topLevel=e?e.topLevel:o,t.typeParams?.length){let c=a?"record":s?"interface":"class";o.typeParams=this.#cn(t.typeParams,`${c} ${o.displayName}`,o)}t.symbol=o,this.#j.push(o),e?(e.members.push(o),e.membersByName.set(o.name,o)):this.#W.push(o);for(let c of t.members)c.kind==="ClassDeclaration"&&this.#Nt(c,o);this.#Dt(o)}#Dt(t){let e=[],n=0,s=new Map,r=(a,o)=>{if(Array.isArray(a)){for(let u of a)r(u,o);return}if(a===null||typeof a!="object")return;let c=a;if(c.kind!=="ClassDeclaration"){if(c.kind==="NewObject"&&c.body){r(c.args,o);let u=c.body,d=this.#Gt(t,u,++n,o);e.push(d);return}if(c.kind==="LocalClass"){let u=c.declaration,d=(s.get(u.name)??0)+1;s.set(u.name,d),e.push(this.#Yt(t,u,d,o));return}for(let[u,d]of Object.entries(c))u!=="symbol"&&d&&typeof d=="object"&&r(d,o)}};for(let a of t.declaration.enumConstants??[])if(r(a.args,!0),a.body){let o=this.#Gt(t,a.body,++n,!0);o.enumBody=!0,e.push(o)}for(let a of t.declaration.members){if(a.kind==="ClassDeclaration")continue;let o=Ht(a.modifiers,"static")||t.isInterface&&a.kind==="FieldDeclaration";r(a,o)}e.length&&(t.anonymousClasses=e)}#Yt(t,e,n,s){let r=e.keyword;for(let c of e.modifiers.keywords)c.name!=="abstract"&&c.name!=="final"&&c.name!=="strictfp"&&this.#e(e.keywordPos,k.syntax,`modifier ${c.name} not allowed here`);let a=this.#Gt(t,e,0,s||r!=="class"),o=`${t.binaryName}$${n}${e.name}`;return Object.assign(a,{name:e.name,binaryName:o,displayName:e.name,anonymous:!1,local:!0,isInterface:r==="interface",isEnum:r==="enum",isRecord:r==="record",isAbstract:r==="interface"||Ht(e.modifiers,"abstract"),isFinal:r==="enum"||r==="record"||Ht(e.modifiers,"final")}),e.typeParams?.length&&(a.typeParams=this.#cn(e.typeParams,`${r==="record"?"record":r==="interface"?"interface":"class"} ${e.name}`,a)),a}#Gt(t,e,n,s){let r=`${t.binaryName}$${n}`,a={kind:"class",name:"",binaryName:r,displayName:`<anonymous ${r}>`,declaration:e,outer:t,topLevel:t.topLevel,isInner:!s,isPrivate:!1,isInterface:!1,isAbstract:!1,isFinal:!1,isEnum:!1,isRecord:!1,enumConstants:[],components:[],superclass:null,interfaces:[],libraryInterfaces:[],hierarchyState:0,index:this.#j.length,fields:[],fieldsByName:new Map,methods:[],methodsByName:new Map,constructors:[],members:[],membersByName:new Map,instanceCount:0,outerField:-1,anonymous:!0};e.symbol=a,this.#j.push(a);for(let o of e.members)o.kind==="ClassDeclaration"&&this.#Nt(o,a);return this.#Dt(a),a}#Qt(){let t=(o,c)=>{let{pkg:u,simple:d}=aa(o),h={kind:"ClassDeclaration",keyword:c?"interface":"class",extendsTypes:[],implementsTypes:[],modifiers:{keywords:[]},name:d,namePos:0,keywordPos:0,members:[],pos:0,start:0,end:0},m={kind:"class",name:d,binaryName:o,displayName:d,declaration:h,outer:null,topLevel:null,isInner:!1,isPrivate:!1,isInterface:c,isAbstract:c,isFinal:!1,isEnum:!1,isRecord:!1,enumConstants:[],components:[],superclass:null,interfaces:[],libraryInterfaces:[],hierarchyState:2,index:this.#j.length,fields:[],fieldsByName:new Map,methods:[],methodsByName:new Map,constructors:[],members:[],membersByName:new Map,instanceCount:c?0:ia,outerField:-1,membersEntered:!0,builtin:{pkg:u}};return m.topLevel=m,h.symbol=m,this.#j.push(m),this.#c.set(o,m),m};for(let o of Tn){let c=t(o.name,!1);c.superclass=o.superclass?this.#c.get(o.superclass):null,o.indexPrefix&&(c.builtin.indexPrefix=o.indexPrefix)}let e=this.#c.get("java.lang.Throwable"),n=X(e);this.#B(e,"getMessage",[],ut,"throwable-getMessage"),this.#B(e,"getLocalizedMessage",[],ut,"throwable-getLocalizedMessage"),this.#B(e,"getCause",[],n,"throwable-getCause"),this.#B(e,"initCause",[n],n,"throwable-initCause"),this.#B(e,"toString",[],ut,"throwable-toString"),this.#B(e,"printStackTrace",[],Tt,"throwable-printStackTrace"),this.#B(e,"addSuppressed",[n],Tt,"throwable-addSuppressed",{isFinal:!0}),this.#B(e,"getSuppressed",[],Qt(n),"throwable-getSuppressed",{isFinal:!0}),this.#B(e,"fillInStackTrace",[],n,"throwable-fillInStackTrace");let s={none:[],message:[ut],"message-cause":[ut,n],cause:[n],index:[U],object:[H]};for(let o of Tn){let c=this.#c.get(o.name);for(let u of o.constructors){let d=this.#B(c,c.name,s[u],Tt,"throwable-constructor",{isConstructor:!0});d.throwableConstructor=u}}let r=t("java.lang.AutoCloseable",!0),a=this.#B(r,"close",[],Tt,void 0,{throws:[X(this.#c.get("java.lang.Exception"))]});a.isAbstract=!0,delete a.builtin}#ce(t){if(t.length>1)return this.#c.get(t.join("."))??null;for(let e of this.#c.values()){if(e.name!==t[0])continue;let n=e.builtin.pkg;return n==="java.lang"||this.#y.has(e.name)||this.#s.has(n)||this.#O.compact?e:null}return null}#St(){return X(this.#c.get("java.lang.Throwable"))}#jt(t){return t.tag==="null"||z(t,this.#St())}#Zt(t){return t.tag==="class"&&this.#jt(t)&&!z(t,X(this.#c.get("java.lang.RuntimeException")))&&!z(t,X(this.#c.get("java.lang.Error")))}#ue(t){if(t.hierarchyState!==0)return;t.hierarchyState=1;let e=this.#a;this.#a=t,this.#F=!1,this.#L=[];let n=t.declaration,s=t.isInterface?[]:n.extendsTypes.slice(0,1);for(let a of s){let o=this.#En(a);if(!o||o.tag==="object")continue;if(o.tag==="string"){this.#e(a.pos,k.syntax,"cannot inherit from final String");continue}if(o.tag==="library"){o.symbol.isInterface?this.#e(a.pos,k.syntax,"no interface expected here"):ha.has(o.symbol.name)?t.librarySuperclass=o:this.#o(a.pos,`extending the library class ${o.symbol.name}`,!0);continue}if(o.tag!=="class")continue;let c=o.symbol;if(c.isInterface){this.#e(a.pos,k.syntax,"no interface expected here");continue}if(c.hierarchyState===1||c===t){this.#e(this.#te(t).declaration.keywordPos,k.syntax,`cyclic inheritance involving ${this.#te(t).displayName}`);continue}if(this.#ue(c),c.isFinal){this.#e(a.pos,k.syntax,`cannot inherit from final ${c.displayName}`);continue}if(c.isInner){this.#o(a.pos,"extending an inner (non-static) class",!0);continue}t.superclass=c,t.superType=o}let r=t.isInterface?n.extendsTypes:n.implementsTypes;for(let a of r){let o=this.#En(a);if(!o)continue;if(o.tag==="library"){o.symbol.isInterface?ma(o.symbol)?t.libraryInterfaces.push(o):this.#o(a.pos,`implementing the library interface ${o.symbol.name}`,!0):this.#e(a.pos,k.syntax,"interface expected here");continue}if(o.tag!=="class"||!o.symbol.isInterface){o.tag!=="error"&&this.#e(a.pos,k.syntax,"interface expected here");continue}let c=o.symbol;if(c.hierarchyState===1||c===t){this.#e(this.#te(t).declaration.keywordPos,k.syntax,`cyclic inheritance involving ${this.#te(t).displayName}`);continue}this.#ue(c),t.interfaces.includes(c)||(t.interfaces.push(c),(t.interfaceTypes??=[]).push(o))}this.#a=e,t.hierarchyState=2}#Pe(t){let e=r=>r.binaryName.replace(/\\$/g,"."),n=r=>r.isInterface?"interface":"class",s=r=>[...r.superclass?[r.superclass]:[],...r.interfaces];for(let r of t){let a=r.declaration;if(r.isSealed&&r.isFinal&&!r.isEnum&&!r.isRecord){this.#e(a.keywordPos,k.syntax,"illegal combination of modifiers: final and sealed");continue}if(r.isSealed&&r.isNonSealed){this.#e(a.keywordPos,k.syntax,"illegal combination of modifiers: sealed and non-sealed");continue}if(r.isNonSealed&&!r.isFinal&&!s(r).some(c=>c.isSealed)&&this.#e(a.keywordPos,k.syntax,"non-sealed modifier not allowed here",[` (${n(r)} ${e(r)} does not have any sealed supertypes)`]),!r.isSealed)continue;let o=a.permits;if(o){let c=[];this.#a=r.outer??r;for(let u of o){let d=this.#V(u);if(d.tag!=="class")continue;let h=d.symbol;if(c.includes(h)){this.#e(u.pos,k.syntax,"invalid permits clause",[` (must not contain duplicates: ${M(d)})`]);continue}c.push(h),s(h).includes(r)||this.#e(u.pos,k.syntax,"invalid permits clause",[` (${n(h)} ${M(d)} must extend sealed ${n(r)})`])}r.permitted=c}else r.permitted=t.filter(c=>s(c).includes(r)),r.permitted.length||this.#e(a.keywordPos,k.syntax,"sealed class must have subclasses")}for(let r of t){let a=s(r).filter(c=>c.isSealed);if(!a.length)continue;let o=a.find(c=>c.declaration.permits&&!(c.permitted??[]).includes(r));if(o){this.#e(r.declaration.keywordPos,k.syntax,`class is not allowed to extend sealed class: ${o.displayName} (as it is not listed in its \'permits\' clause)`);continue}!r.isFinal&&!r.isSealed&&!r.isNonSealed&&this.#e(r.declaration.keywordPos,k.syntax,"sealed, non-sealed or final modifiers expected")}}#Re(t){[...t.superclass?[t.superclass]:[],...t.interfaces].some(n=>n.isSealed)&&this.#e(t.declaration.keywordPos,k.syntax,`${t.anonymous?"anonymous":"local"} classes must not extend sealed classes`)}#te(t){return this.#j.filter(n=>n.hierarchyState===1).reduce((n,s)=>n.declaration.keywordPos<=s.declaration.keywordPos?n:s,t)}#En(t){if(t.kind!=="ClassType")return this.#e(t.pos,k.syntax,"unexpected type"),null;let e=this.#V(t);return e.tag==="error"?null:e}#Je(t){if(t.membersEntered)return;t.membersEntered=!0,t.superclass&&this.#Je(t.superclass);let e=this.#a;this.#a=t,t.instanceCount=t.superclass?.instanceCount??0,t.isInner&&(t.outerField=t.instanceCount++),t.isEnum&&(t.instanceCount=2,this.#ds(t)),t.isRecord&&this.#ms(t);for(let a of t.declaration.members)a.kind==="FieldDeclaration"?this.#gs(t,a):a.kind==="MethodDeclaration"&&this.#bs(t,a);t.isRecord?t.constructors.some(a=>this.#An(t,a))||this.#B(t,t.name,t.components.map(a=>a.type),Tt,"record-constructor",{isConstructor:!0}):!t.isInterface&&!t.anonymous&&!t.declaration.members.some(a=>a.kind==="MethodDeclaration"&&a.isConstructor)&&this.#Ts(t),t.isEnum&&this.#fs(t),t.isRecord&&this.#ys(t),t.librarySuperclass&&this.#ps(t);let n=t.methodsByName.get("toString")?.find(a=>!a.isStatic&&a.params.length===0&&a.returnType.tag==="string");n&&(t.toStringMethod=n);let s=t.methodsByName.get("equals")?.find(a=>!a.isStatic&&a.params.length===1&&a.params[0].tag==="object"&&a.returnType.tag==="boolean");s&&(t.equalsMethod=s);let r=t.methodsByName.get("hashCode")?.find(a=>!a.isStatic&&a.params.length===0&&a.returnType.tag==="int");r&&(t.hashCodeMethod=r),this.#a=e}#ds(t){let e=X(t);(t.declaration.enumConstants??[]).forEach((s,r)=>{if(t.fieldsByName.has(s.name)){this.#e(s.pos,k.alreadyDefined,`variable ${s.name} is already defined in enum ${t.displayName}`);return}let a={name:s.name,extraDims:0,init:null,pos:s.pos,start:s.start,end:s.end},o={kind:"FieldDeclaration",modifiers:{keywords:[]},type:{kind:"VoidType",pos:s.pos,start:s.pos,end:s.pos},declarators:[a],pos:s.pos,start:s.start,end:s.end},c={kind:"field",name:s.name,type:e,owner:t,isStatic:!0,isFinal:!0,isPrivate:!1,index:this.#H.length,order:t.fields.length,state:"done",declaration:o,declarator:a,enumConstant:{node:s,ordinal:r}};this.#H.push(c),s.field=c,t.fields.push(c),t.fieldsByName.set(c.name,c),t.enumConstants.push(c)})}#ms(t){for(let e of t.declaration.components??[]){let n=this.#V(e.type);if(n.tag==="error")continue;if(t.fieldsByName.has(e.name)){this.#e(e.pos,k.alreadyDefined,`record component ${e.name} is already defined in record ${t.displayName}`);continue}let s={name:e.name,extraDims:0,init:null,pos:e.pos,start:e.start,end:e.end},r={kind:"FieldDeclaration",modifiers:{keywords:[{name:"private",pos:e.pos},{name:"final",pos:e.pos}]},type:e.type,declarators:[s],pos:e.pos,start:e.start,end:e.end},a={kind:"field",name:e.name,type:n,owner:t,isStatic:!1,isFinal:!0,isPrivate:!0,index:t.instanceCount++,order:t.fields.length,state:"done",declaration:r,declarator:s};s.field=a,t.fields.push(a),t.fieldsByName.set(a.name,a),t.components.push(a)}}#An(t,e){return e.isConstructor&&(e.declaration.compact===!0||e.params.length===t.components.length&&e.params.every((n,s)=>et(n,t.components[s].type)))}#B(t,e,n,s,r,a={}){let o=t.declaration.keywordPos,c={kind:"MethodDeclaration",modifiers:{keywords:[]},returnType:{kind:"VoidType",pos:o,start:o,end:o},name:e,namePos:o,params:[],body:{kind:"Block",statements:[],pos:o,start:o,end:o+1},synthetic:!0,pos:o,start:o,end:o};a.isConstructor&&(c.isConstructor=!0);let u={kind:"method",name:e,owner:t,isStatic:a.isStatic??!1,isConstructor:a.isConstructor??!1,isPrivate:!1,isAbstract:!1,isFinal:a.isFinal??!1,access:a.isConstructor&&t.isEnum?"private":"public",params:n,returnType:s,index:this.#z.length,declaration:c,locals:[],maxSlots:(a.isStatic?0:1)+n.reduce((d,h)=>d+Fe(h),0),builtin:r,throws:a.throws??[]};return a.component!==void 0&&(u.component=a.component),c.symbol=u,this.#z.push(u),u.isConstructor?t.constructors.push(u):(t.methods.push(u),t.methodsByName.set(e,[...t.methodsByName.get(e)??[],u])),u}#xt(t,e,n){return(t.methodsByName.get(e)??[]).some(s=>s.params.length===n.length&&s.params.every((r,a)=>et(r,n[a])))}#fs(t){let e=X(t);this.#xt(t,"values",[])||this.#B(t,"values",[],Qt(e),"enum-values",{isStatic:!0}),this.#xt(t,"valueOf",[ut])||this.#B(t,"valueOf",[ut],e,"enum-valueOf",{isStatic:!0}),this.#xt(t,"name",[])||this.#B(t,"name",[],ut,"enum-name",{isFinal:!0}),this.#xt(t,"ordinal",[])||this.#B(t,"ordinal",[],U,"enum-ordinal",{isFinal:!0}),this.#xt(t,"compareTo",[e])||this.#B(t,"compareTo",[e],U,"enum-compareTo",{isFinal:!0}),this.#xt(t,"toString",[])||this.#B(t,"toString",[],ut,"enum-toString")}#ps(t){this.#xt(t,"toString",[])||this.#B(t,"toString",[],ut,"library-toString"),this.#xt(t,"hashCode",[])||this.#B(t,"hashCode",[],U,"library-hashCode"),this.#xt(t,"equals",[H])||this.#B(t,"equals",[H],ft,"library-equals")}#ys(t){t.components.forEach((e,n)=>{(t.methodsByName.get(e.name)??[]).find(r=>r.params.length===0)||this.#B(t,e.name,[],e.type,"record-accessor",{component:n})}),this.#xt(t,"toString",[])||this.#B(t,"toString",[],ut,"record-toString"),this.#xt(t,"hashCode",[])||this.#B(t,"hashCode",[],U,"record-hashCode"),this.#xt(t,"equals",[H])||this.#B(t,"equals",[H],ft,"record-equals")}#ze(t=this.#z){for(let e of t)e.selector===void 0&&(e.isStatic||e.isConstructor||e.isPrivate||e.lambda||(e.selector=this.#In(qn(e.name,e.params,e.returnType))))}#In(t){let e=this.#C.get(t);return e===void 0&&this.#C.set(t,e=this.#C.size),e}#gs(t,e){let n=e.modifiers.keywords.map(d=>d.name),s=this.#yt(e.modifiers,"field");for(let d of e.modifiers.keywords){if(d.name==="transient"||d.name==="volatile"){this.#o(d.pos,`\'${d.name}\' fields`);return}if(["abstract","synchronized","native","strictfp","default"].includes(d.name)){this.#e(e.declarators[0].pos,k.syntax,`modifier ${d.name} not allowed here`);return}}let r=e.type;if(r.kind==="VarType"||r.kind==="ClassType"&&r.names.length===1&&r.names[0]==="var"&&!r.hasTypeArguments&&!this.#me("var")){this.#e(r.pos,k.syntax,"\'var\' is not allowed here");return}if(t.isInterface&&(n.includes("private")||n.includes("protected"))){this.#e(e.declarators[0].pos,k.syntax,`modifier ${n.includes("private")?"private":"protected"} not allowed here`);return}if(t.isRecord&&!n.includes("static")){this.#e(e.declarators[0].pos,k.syntax,"field declaration must be static",[" (consider replacing field with record component)"]);return}let a=t.isInterface||n.includes("static"),o=t.isInterface||n.includes("final");if(t.isInterface&&e.declarators.some(d=>!d.init)){let d=e.declarators.find(h=>!h.init);this.#e(d.end,k.syntax,"= expected");return}let c=this.#L;this.#F=a,t.anonymous||(this.#L=[]);let u=this.#V(e.type);this.#F=!1,this.#L=c;for(let d of e.declarators){let h=u;for(let p=0;p<d.extraDims&&h.tag!=="error";p++)h=Qt(h);if(h.tag==="error")continue;if(t.fieldsByName.has(d.name)){this.#e(d.pos,k.alreadyDefined,`variable ${d.name} is already defined in class ${t.displayName}`);continue}let m={kind:"field",name:d.name,type:h,owner:t,isStatic:a,isFinal:o,isPrivate:n.includes("private"),index:a?this.#H.length:t.instanceCount++,order:t.fields.length,state:"pending",declaration:e,declarator:d,...s.size?{suppressed:s}:{}};a&&this.#H.push(m),d.field=m,t.fields.push(m),t.fieldsByName.set(m.name,m)}}#bs(t,e){let n=e.isConstructor===!0;for(let E of e.modifiers.keywords){if(n&&["static","final","abstract","native","synchronized","strictfp","default","transient","volatile"].includes(E.name)){this.#e(e.namePos,k.syntax,`modifier ${E.name} not allowed here`);return}if(["strictfp","native"].includes(E.name)){this.#o(E.pos,`\'${E.name}\' methods`);return}if(E.name==="default"&&!t.isInterface||E.name==="synchronized"&&t.isInterface||E.name==="transient"||E.name==="volatile"){this.#e(e.namePos,k.syntax,`modifier ${E.name} not allowed here`);return}if(t.isInterface&&(E.name==="protected"||E.name==="final")){this.#e(e.namePos,k.syntax,`modifier ${E.name} not allowed here`);return}}let s=this.#yt(e.modifiers,n?"constructor":"method");if(e.compact){if(!t.isRecord){this.#e(e.namePos,k.syntax,"invalid method declaration; return type required");return}e.params=(t.declaration.components??[]).map(E=>({...E,symbol:void 0}))}if(n&&e.typeParams?.length){this.#o(e.typeParams[0].pos,"generic constructors");return}let r=this.#L;this.#F=Ht(e.modifiers,"static");let a=e.typeParams?.length?this.#cn(e.typeParams,"",null):void 0;a&&this.#un(a,e.typeParams),this.#L=a?[...r,a]:r;let o=e.params.map(E=>this.#V(E.type)),c=e.returnType.kind==="VoidType"?Tt:this.#V(e.returnType),u=[],d=!0;for(let E of e.throwsTypes??[]){let R=this.#V(E);if(R.tag==="error"){d=!1;break}if(!this.#jt(R)){this.#q(E,R,this.#St()),d=!1;break}u.push(R)}if(this.#L=r,this.#F=!1,o.some(E=>E.tag==="error")||c.tag==="error"||!d)return;if(a){let E=e.params.map((R,L)=>R.varargs?`${M(o[L].element)}...`:M(o[L]));for(let R of a)R.declaredIn=`method <${a.map(L=>L.name).join(",")}>${e.name}(${E.join(",")})`}let h=n?t.constructors:t.methodsByName.get(e.name)??[];if(h.some(E=>E.params.length===o.length&&E.params.every((R,L)=>et(R,o[L])))){let E=n?"constructor":"method";this.#e(e.namePos,k.alreadyDefined,`${E} ${e.name}(${o.map(M).join(",")}) is already defined in class ${t.displayName}`);return}let m=h.find(E=>oe(E.name,E.params)===oe(e.name,o));if(m){let E=(R,L)=>`${R}(${L.map(M).join(",")})`;this.#e(e.namePos,k.alreadyDefined,`name clash: ${E(e.name,o)} and ${E(m.name,m.params)} have the same erasure`,Dt([...o,...m.params]));return}if(n&&t.isInterface){this.#e(e.namePos,k.syntax,"invalid method declaration; return type required");return}if(n&&t.isEnum){let E=e.modifiers.keywords.find(R=>R.name==="public"||R.name==="protected");E&&this.#e(e.namePos,k.syntax,`modifier ${E.name} not allowed here`)}let p=E=>Ht(e.modifiers,E),b=p("abstract")||t.isInterface&&!p("default")&&!p("static")&&!p("private");if(b&&(p("private")||p("static")||p("final")||p("synchronized"))){let E=p("private")?"private":p("static")?"static":p("final")?"final":"synchronized";this.#e(e.namePos,k.syntax,`illegal combination of modifiers: abstract and ${E}`);return}if(b&&e.body){let E=t.isInterface&&!p("abstract");this.#e(E?e.body.pos:e.namePos,k.syntax,E?"interface abstract methods cannot have body":"abstract methods cannot have a body");return}if(!b&&!e.body){this.#e(e.namePos,k.syntax,"missing method body, or declare abstract");return}let S=p("private")?"private":p("public")||t.isInterface?"public":p("protected")?"protected":"package",v={kind:"method",name:e.name,owner:t,isStatic:p("static"),isConstructor:n,isPrivate:p("private"),isAbstract:b,isFinal:p("final"),access:S,params:o,returnType:c,index:this.#z.length,...a?{typeParams:a}:{},declaration:e,locals:[],maxSlots:0,throws:u,...s.size?{suppressed:s}:{}},x=this.#At(e.modifiers,"SafeVarargs");if(x&&!e.params.some(E=>E.varargs))this.#e(e.namePos,k.syntax,`Invalid SafeVarargs annotation. ${n?"Constructor":"Method"} ${e.name}(${o.map(M).join(",")}) is not a varargs method.`);else if(x&&!n&&!v.isStatic&&!v.isFinal&&!v.isPrivate){let E=a?`<${a.map(R=>R.name).join(",")}>`:"";this.#e(e.namePos,k.syntax,`Invalid SafeVarargs annotation. Instance method ${E}${this.#Ft(v)} is neither final nor private.`,Dt(o))}e.symbol=v,this.#z.push(v),n?t.constructors.push(v):(t.methods.push(v),t.methodsByName.set(e.name,[...h,v]));let C=t.isRecord&&!n&&!v.isStatic&&o.length===0?t.components.find(E=>E.name===e.name):void 0;C&&(et(c,C.type)?S!=="public"&&this.#e(e.namePos,k.syntax,`invalid accessor method in record ${t.displayName}`,[" (accessor method must be public)"]):this.#e(e.namePos,k.syntax,`invalid accessor method in record ${t.displayName}`,[` (return type of accessor method ${e.name}() must match the type of record component ${e.name})`]))}#Ts(t){let e=t.declaration.namePos,n={kind:"MethodDeclaration",modifiers:{keywords:t.isPrivate?[{name:"private",pos:e}]:[]},returnType:{kind:"VoidType",pos:e,start:e,end:e},name:t.name,namePos:e,params:[],body:{kind:"Block",statements:[],pos:e,start:e,end:e+1},isConstructor:!0,synthetic:!0,pos:e,start:e,end:e},s={kind:"method",name:t.name,owner:t,isStatic:!1,isConstructor:!0,isPrivate:t.isPrivate,isAbstract:!1,isFinal:!1,access:t.isPrivate?"private":"package",params:[],returnType:Tt,index:this.#z.length,declaration:n,locals:[],maxSlots:0,throws:[]};n.symbol=s,this.#z.push(s),t.constructors.push(s)}#Ft(t){let e=t.declaration.params.map((n,s)=>n.varargs?`${M(t.params[s].element)}...`:M(t.params[s]));return`${t.name}(${e.join(",")})`}#he(){return{method:this.#l,field:this.#E,isStatic:this.#_,scopes:this.#M,nextSlot:this.#k,jumps:this.#P,typeScopes:this.#L,typeStatic:this.#F,memberSuppressed:this.#at,localSuppressed:this.#$}}#de(t){this.#l=t.method,this.#E=t.field,this.#_=t.isStatic,this.#M=t.scopes,this.#k=t.nextSlot,this.#P=t.jumps,this.#L=t.typeScopes,this.#F=t.typeStatic,this.#at=t.memberSuppressed,this.#$=t.localSuppressed}#De(t){this.#a=t;let e=this.#yt(t.declaration.modifiers,"type");e.size&&(t.suppressed=e);let n=this.#At(t.declaration.modifiers,"FunctionalInterface");if(n){let s=t.isInterface?gs(t):[];if(s.length!==1){let r=[` ${t.displayName} is not a functional interface`];t.isInterface&&r.push(s.length?` multiple non-overriding abstract methods found in interface ${t.displayName}`:` no abstract method found in interface ${t.displayName}`),this.#e(n.pos,k.syntax,"Unexpected @FunctionalInterface annotation",r)}}this.#Es(t),t.isEnum&&this.#vs(t);for(let s of t.declaration.members)if(this.#a=t,s.kind==="FieldDeclaration")for(let r of s.declarators)r.field&&this.#$n(r.field);else s.kind==="MethodDeclaration"?s.symbol&&this.#ws(s.symbol):s.kind==="Initializer"?this.#Ss(t,s):s.symbol&&this.#De(s.symbol);this.#a=t,this.#As(t)}#Ss(t,e){if(t.isInterface){this.#e(e.body.pos,k.syntax,"initializers not allowed in interfaces");return}if(t.isRecord&&!e.isStatic){this.#e(e.body.pos,k.syntax,"instance initializers not allowed in records");return}let n=e.isStatic?"static":"new",s={kind:"MethodDeclaration",modifiers:e.modifiers,returnType:{kind:"VoidType",pos:e.pos,start:e.pos,end:e.pos},name:n,namePos:e.pos,params:[],body:e.body,pos:e.pos,start:e.start,end:e.end},r={kind:"method",name:n,owner:t,isStatic:e.isStatic,isConstructor:!1,isPrivate:!0,isAbstract:!1,isFinal:!1,access:"private",params:[],returnType:Tt,index:-1,declaration:s,locals:[],maxSlots:0,throws:[],initializer:e.isStatic?"static":"instance"};e.symbol=r;let a=this.#he(),o=this.#nt,c=t.fields.find(u=>!u.enumConstant&&!u.capturedLocal&&u.declarator.pos>e.start);this.#nt={owner:t,isStatic:e.isStatic,order:c?c.order:t.fields.length},this.#a=t,this.#l=r,this.#E=null,this.#_=e.isStatic,this.#F=e.isStatic,this.#L=[],this.#at=void 0,this.#$=[],this.#M=[],this.#k=e.isStatic?0:1,r.maxSlots=this.#k,this.#P=[],this.#vt();for(let u of e.body.statements)this.#ne(u);this.#wt(),this.#de(a),this.#nt=o,this.#a=t}#xs(t,e,n){t.superclass=e,t.superType=X(e),t.hierarchyState=2;let s=this.#he(),r=this.#t,a=this.#R;this.#Je(t);let o=this.#zn(t,n);return this.#ze([...t.methods,...t.constructors]),this.#Rt.set(t,{scopes:[]}),this.#t=null,this.#R=!1,this.#De(t),this.#de(s),this.#t=r,this.#R=a,this.#a=e,o}#vs(t){for(let e of t.enumConstants){let n=e.enumConstant.node,s=this.#he();this.#l=null,this.#E=e,this.#_=!0,this.#M=[{names:new Map,nextSlot:0}],this.#k=0,this.#P=[];let r=this.#se(n.args);if(!r.some(a=>a.tag==="error")){let a=this.#it({pos:n.pos,name:t.name},this.#Be(t),r,"constructor");if(a&&!n.body&&t.enumAbstract)this.#e(n.pos,k.syntax,`${t.displayName} is abstract; cannot be instantiated`);else if(a){this.#ie(n.args,a.params),n.ctor=n.body?.symbol?this.#xs(n.body.symbol,t,a):a.method;let o=this.#Ie(a,n.pos);o&&(n.varargs=o)}this.#Ae(n.args)}this.#de(s),this.#a=t}}#ws(t){if(t.builtin)return;this.#a=t.owner,this.#l=t,this.#E=null,this.#_=t.isStatic,this.#F=t.isStatic,this.#L=t.typeParams?[t.typeParams]:[],this.#at=t.suppressed,this.#$=[],this.#M=[];let e=t.isConstructor&&t.owner.isInner?1:t.isConstructor&&t.owner.isEnum?2:0;this.#k=(t.isStatic?0:1)+e,t.maxSlots=this.#k,this.#P=[],this.#ks(t);let n=t.declaration.params[t.declaration.params.length-1];if(n?.varargs&&!wn(t.params[t.params.length-1])&&!this.#At(t.declaration.modifiers,"SafeVarargs")){let a=t.params[t.params.length-1].element;this.#st(n.pos,"unchecked",`Possible heap pollution from parameterized vararg type ${M(a)}`,Dt([a]))}if(t.isAbstract){this.#l=null;return}this.#vt(),t.declaration.params.forEach((a,o)=>{this.#yt(a.modifiers,"parameter");let c=this.#_t(a.name,t.params[o],a.pos,Ht(a.modifiers,"final"));c.parameter=o+1+e,a.symbol=c});let s=t.declaration.body.statements;t.isConstructor&&t.owner.isRecord&&!this.#An(t.owner,t)&&!(s[0]?.kind==="ConstructorCall"&&s[0].keyword==="this")&&this.#e(t.declaration.namePos,k.syntax,`constructor is not canonical, so it must invoke another constructor of class ${t.owner.displayName}`),t.isConstructor&&t.owner.isEnum&&s[0]?.kind==="ConstructorCall"&&s[0].keyword==="super"&&this.#e(s[0].thisPos,k.syntax,"call to super not allowed in enum constructor");let r=s.some(a=>a.kind==="ConstructorCall");t.isConstructor&&!r&&!t.forwardsToSuper&&this.#On(t),s.forEach((a,o)=>{a.kind==="ConstructorCall"?this.#Nn(a,o===0):this.#ne(a)}),this.#wt(),this.#l=null}#On(t){let e=t.owner.superclass,n=t.owner.librarySuperclass;if(n){let o=t.declaration.synthetic?t.owner.declaration.keywordPos:t.declaration.body.pos,c=this.#bn(n,[],o);c&&(t.superLibrary=c.call);return}if(!e)return;let s=t.declaration.synthetic?t.owner.declaration.keywordPos:t.declaration.body.pos,r=this.#it({pos:s,name:e.name},this.#Be(e,t.owner.superType),[],"constructor");if(!r||!this.#ye(r.method,s,`${e.name}()`))return;t.superConstructor=r.method;let a=this.#Ie(r,s);a&&(t.superVarargs=a)}#ks(t){let e=t.declaration,n=this.#At(e.modifiers,"Override");if(t.isConstructor)return;let s=t.isPrivate?[]:this.#Cs(t);if(!s.length){n&&this.#e(n.pos,k.syntax,"method does not override or implement a method from a supertype");return}for(let r of s){if(r.libraryClass&&!t.isStatic&&!t.builtin&&!da.has(r.native)&&!(Uo[r.libraryClass]??[]).includes(r.native)){this.#o(e.namePos,`overriding ${r.libraryClass}.${r.name}(${r.library.params.map(Me).join(", ")})`,!0);return}let a=r.fromInterface&&!t.owner.isInterface&&!t.isStatic?"implement":"override",o=`${this.#Ft(t)} in ${t.owner.displayName} cannot ${a} ${r.signature} in ${r.ownerName}`;if(t.isStatic&&!r.isStatic){this.#e(e.namePos,k.syntax,o,[" overriding method is static"]);return}if(!t.isStatic&&r.isStatic){this.#e(e.namePos,k.syntax,o,[" overridden method is static"]);return}if(t.isStatic)continue;if(r.isFinal){this.#e(e.namePos,k.syntax,o,[" overridden method is final"]);return}if(ua[t.access]<ua[r.access]){this.#e(e.namePos,k.syntax,o,[` attempting to assign weaker access privileges; was ${r.access}`]);return}let c=t.returnType;if(!(Z(r.returnType)||r.returnType.tag==="void"?et(c,r.returnType):z(c,r.returnType))){this.#e(e.namePos,k.incompatibleTypes,o,[` return type ${M(c)} is not compatible with ${M(r.returnType)}`]);return}let d=t.throws.find(h=>this.#Zt(h)&&!(r.throws??[]).some(m=>z(h,m)));if(d){this.#e(e.namePos,k.syntax,o,[` overridden method does not throw ${M(d)}`]);return}}}#Cs(t){let e=[],n=oe(t.name,t.params);for(let s of this.#Ln(t.owner))s.name===t.name&&oe(s.name,s.params)===n&&e.push(s);return e}#Ln(t){let e=[],n=new Set,s=(h,m)=>{for(let p of h.methods){if(p.isPrivate||p.lambda||p.isStatic&&h.isInterface||h.isEnum&&p.builtin&&jo.has(p.name))continue;let b=v=>p.isStatic?v:Oe(m,h,v),S=p.params.map(b);e.push({name:p.name,params:S,returnType:b(p.returnType),isStatic:p.isStatic,isFinal:p.isFinal,isAbstract:p.isAbstract,isDefault:h.isInterface&&!p.isAbstract&&!p.isStatic,access:p.access,ownerName:h.displayName,signature:this.#Ft(p),fromInterface:h.isInterface,interfaceSymbol:h.isInterface?h:void 0,throws:p.throws,method:p})}},r=he(t),a=h=>Dn(h).filter(m=>m.tag==="class"&&m.symbol.isInterface),o=h=>{if(!n.has(h.symbol)){n.add(h.symbol),s(h.symbol,h);for(let m of a(h))o(m)}},c=[r];for(let h=t.superclass;h;h=h.superclass)c.push(Zt(r,h)??X(h));for(let h of c.slice(1))s(h.symbol,h);let u=[];for(let h of c)u.push(...a(h));for(let h of u)o(h);for(let h of Ie(r)){if(!h.symbol.isInterface){for(let m of h.symbol.methods){if(m.isStatic||!m.native)continue;let p=m.params.map(b=>St(b,h.symbol.typeParams,h.args));e.push({name:m.name,params:p,returnType:St(m.returnType,h.symbol.typeParams,h.args),isStatic:!1,isFinal:!1,isAbstract:m.abstractIn!==void 0,isDefault:!1,access:m.isProtected?"protected":"public",ownerName:m.abstractIn??h.symbol.name,signature:`${m.name}(${p.map(M).join(",")})`,fromInterface:!1,library:{params:m.params,returnType:m.returnType},libraryClass:h.symbol.name,native:m.native})}continue}for(let m of _o[h.symbol.name]??(h.symbol.functional?[h.symbol.functional]:[])){let p=h.symbol.methods.find(S=>S.name===m),b=p.params.map(S=>St(S,h.symbol.typeParams,h.args));e.push({name:m,params:b,returnType:St(p.returnType,h.symbol.typeParams,h.args),isStatic:!1,isFinal:!1,isAbstract:!0,isDefault:!1,access:"public",ownerName:h.symbol.name,signature:`${m}(${b.map(M).join(",")})`,fromInterface:!0,library:{params:p.params,returnType:p.returnType}})}}let d=t.isEnum?t:t.enumBody?t.superclass:null;if(d){let h=X(d),m=(p,b,S)=>({name:p,params:b,returnType:S,isStatic:!1,isFinal:!0,isAbstract:!1,isDefault:!1,access:"public",ownerName:"Enum",signature:`${p}(${b.map(M).join(",")})`,fromInterface:!1});e.push(m("name",[],ut),m("ordinal",[],U),m("compareTo",[h],U),m("equals",[H],ft),m("hashCode",[],U))}for(let h of Object.values(Le))e.push({name:h.name,params:h.params,returnType:h.returnType,isStatic:!1,isFinal:!1,isAbstract:!1,isDefault:!1,access:"public",ownerName:"Object",signature:`${h.name}(${h.params.map(M).join(",")})`,fromInterface:!1,isObject:!0});return e}#Es(t){if(t.isInterface)return;for(let d of t.constructors)d.declaration.synthetic&&!d.forwardsToSuper&&this.#On(d);let e=new Set,n=new Map,s=he(t);for(let d=t;d;d=d.superclass){let h=Zt(s,d)??X(d);for(let m of d.methods){if(m.isAbstract||m.isStatic||m.lambda)continue;let p=oe(m.name,m.params.map(b=>Oe(h,d,b)));e.add(p),!m.isPrivate&&!n.has(p)&&n.set(p,m)}}for(let d of Object.values(Le))e.add(oe(d.name,d.params));let r=this.#Ln(t),a=new Set(t.methods.filter(d=>!d.isStatic&&!d.isConstructor).map(d=>qn(d.name,d.params,d.returnType))),o=d=>{for(let h=t.superclass;h;h=h.superclass)if(h.bridges?.some(m=>m.key===d))return!0;return!1};for(let d of r){if(d.isStatic||d.isObject||!(d.method||d.library))continue;let h=d.method??d.library,m=n.get(oe(d.name,d.params));if(!m||m===d.method||m.selector===void 0)continue;let p=qn(d.name,h.params,h.returnType);if(p===qn(m.name,m.params,m.returnType)||a.has(p)||m.owner!==t&&o(p))continue;let b=t.bridges??=[];b.some(S=>S.key===p)||b.push({key:p,name:d.name,params:h.params.map(K),returnType:K(h.returnType),target:m,selector:this.#In(p),library:!d.method,...m.builtin?{alias:!0}:{}})}for(let d of r){if(!d.libraryClass||da.has(d.native))continue;let h=n.get(oe(d.name,d.params));if(!h||h.builtin||h.selector===void 0)continue;let m=t.bridges?.find(p=>p.key===qn(d.name,d.library.params,d.library.returnType));(t.libraryOverrides??=new Map).set(d.native,m?m.selector:h.selector)}let c=new Map;for(let d of r){if(!d.isDefault)continue;let h=oe(d.name,d.params);c.set(h,[...c.get(h)??[],d])}let u=t.isEnum&&t.declaration.enumConstants?.some(d=>d.body)===!0;if(!t.isAbstract){let d=t.methods.filter(h=>h.isAbstract).map(h=>({name:h.name,params:h.params,returnType:h.returnType,isStatic:!1,isFinal:!1,isAbstract:!0,isDefault:!1,access:h.access,ownerName:t.displayName,signature:this.#Ft(h),fromInterface:!1}));for(let h of[...d,...r]){if(!h.isAbstract)continue;let m=oe(h.name,h.params);if(!(e.has(m)||c.has(m))){if(u){t.enumAbstract=!0;break}this.#e(t.declaration.keywordPos,k.syntax,`${t.displayName} is not abstract and does not override abstract method ${h.signature} in ${h.ownerName}`);return}}}for(let[d,h]of c){if(e.has(d)||h.length<2)continue;let[m,p]=h;if(!(m.interfaceSymbol&&p.interfaceSymbol&&(fn(m.interfaceSymbol,p.interfaceSymbol)||fn(p.interfaceSymbol,m.interfaceSymbol))||m.interfaceSymbol===p.interfaceSymbol)){this.#e(t.declaration.keywordPos,k.syntax,`types ${m.ownerName} and ${p.ownerName} are incompatible;`,[` class ${t.displayName} inherits unrelated defaults for ${m.signature} from types ${m.ownerName} and ${p.ownerName}`]);return}}}#Nn(t,e){let n=this.#l;if(!n?.isConstructor){this.#e(t.pos,k.syntax,"explicit constructor invocation may only appear within a constructor body");return}if(!e){this.#o(t.thisPos,`statements before \'${t.keyword}(...)\' in a constructor`);return}this.#R=!0;let s=this.#se(t.args);if(this.#R=!1,s.some(d=>d.tag==="error"))return;let r=t.keyword==="this"?n.owner:n.owner.superclass,a=t.keyword==="super"?n.owner.librarySuperclass:void 0;if(a){let d=this.#bn(a,s,t.thisPos);if(!d)return;this.#R=!0,this.#ie(t.args,d.candidate.params),this.#Ae(t.args),this.#R=!1,t.libraryCall=d.call;return}if(!r){s.length&&this.#e(t.thisPos,k.cantResolve,"constructor Object in class Object cannot be applied to given types;",[" required: no arguments",` found: ${s.map(M).join(",")}`," reason: actual and formal argument lists differ in length"]);return}if(this.#pn(r,s.length,t.thisPos))return;let o=t.keyword==="this"?he(r):n.owner.superType,c=this.#it({pos:t.thisPos,name:r.name},this.#Be(r,o),s,"constructor");if(!c||!this.#ye(c.method,t.thisPos,`${r.name}(${c.params.map(M).join(",")})`))return;this.#R=!0,this.#ie(t.args,c.params),this.#Ae(t.args),this.#R=!1,t.target=c.method;let u=this.#Ie(c,t.thisPos);u&&(t.varargs=u)}#As(t){let e=new Map;for(let s of t.constructors){let r=s.declaration.body?.statements[0];r?.kind==="ConstructorCall"&&r.keyword==="this"&&r.target&&e.set(s,r)}let n=new Set;for(let s of t.constructors){let r=new Set,a=s;for(;a&&!n.has(a);){r.add(a);let o=e.get(a),c=o?.target;if(c&&r.has(c)){this.#e(o.thisPos,k.syntax,"recursive constructor invocation"),e.delete(a);break}a=c}for(let o of r)n.add(o)}}#$n(t){if(t.state!=="pending")return;t.state="attributing";let e=this.#he(),n=this.#a;this.#a=t.owner,this.#l=null,this.#E=t,this.#_=t.isStatic,this.#F=t.isStatic,this.#L=[],this.#at=t.suppressed,this.#$=[],this.#M=[{names:new Map,nextSlot:0}],this.#k=0,this.#P=[];let s=t.declarator.init;if(s)if(s.kind==="ArrayInitializer")this.#Ce(s,t.type);else{let r=this.#v(s,t.type);this.#We(t.type,r,s)?t.isFinal&&s.constant&&(Z(t.type)||t.type.tag==="string")&&(t.constant=vn(s.constant,t.type)):this.#q(s,r,t.type)}this.#de(e),this.#a=n,t.state="done"}#vt(){this.#M.push({names:new Map,nextSlot:this.#k})}#wt(){let t=this.#M.pop();this.#k=t.nextSlot}#lt(t){for(let e=this.#M.length-1;e>=0;e--){let n=this.#M[e].names.get(t);if(n)return n}}#_t(t,e,n,s,r=!1){let a=this.#l,o=this.#lt(t)||r?null:this.#Sn(t),c=o?.method??a;!r&&(this.#lt(t)||o&&c)&&this.#e(n,k.alreadyDefined,`variable ${t} is already defined in ${c.isConstructor?"constructor":"method"} ${this.#Ft(c)}`);let u={kind:"local",name:t,type:e,index:a.locals.length,slot:this.#k,isFinal:s,declPos:n};return this.#k+=Fe(e),a.maxSlots=Math.max(a.maxSlots,this.#k),a.locals.push(u),this.#M[this.#M.length-1].names.set(t,u),u}#ee(t){let e=0;for(let n=this.#a;n;n=n.outer,e++){let s=this.#je(n,t);if(s&&!(n.enumBody&&s.isPrivate&&s.owner!==n))return{field:s,hops:e};let r=n.anonymous||n.local?this.#ar(n,t):null;if(r)return{field:r,hops:e}}return null}#je(t,e,n=new Set){if(n.has(t))return null;n.add(t);let s=t.fieldsByName.get(e);if(s)return s;if(t.superclass){let r=this.#je(t.superclass,e,n);if(r)return r}for(let r of t.interfaces){let a=this.#je(r,e,n);if(a)return a}return null}#kt(t,e){let n=[],s=new Set,r=new Set,a=he(t),o=(c,u)=>{if(!r.has(c)){r.add(c);for(let d of c.methodsByName.get(e)??[]){if(u&&(d.isPrivate||d.isStatic&&c.isInterface))continue;let h=oe(d.name,d.isStatic?d.params:d.params.map(m=>Oe(a,c,m)));s.has(h)||(s.add(h),n.push(d))}c.superclass&&o(c.superclass,!0);for(let d of c.interfaces)o(d,!0)}};return o(t,!1),n}#Ge(t){let e=this.#a;for(let n=0;n<t;n++,e=e.outer)if(!e?.isInner)return!1;return!0}#Is(t){let e=this.#a;for(let n=0;n<t&&e;n++)e=e.outer;return e}#Os(t,e){for(let n=e;n;n=n.outer)if(n===t)return!0;return!1}#Ls(t,e){for(let n=t.superclass;n;n=n.superclass){let s=n.methodsByName.get(e)?.find(r=>r.isPrivate);if(s)return s}return null}#me(t){let e=r=>{for(let a=r.length-1;a>=0;a--){let o=r[a].classes?.get(t);if(o)return o}return null},n=e(this.#M);if(n)return n;for(let r=this.#t;r;r=r.outer){let a=e(r.scopes);if(a)return a}for(let r=this.#a;r;r=r.outer){let a=r.membersByName.get(t);if(a)return a;if(r.name===t&&!r.declaration.implicit)return r;let o=r.anonymous||r.local?this.#Rt.get(r):void 0,c=o?e(o.scopes):null;if(c)return c}let s=this.#W.find(r=>r.name===t&&!r.declaration.implicit);if(s){let r=this.#mt.get(s);if(r&&!r.launch&&r!==this.#O&&`${t}.java`!==r.file.name)throw new Ze(`class ${t} is declared in ${r.file.name}, a file not named after it, and used from another file`);return s}if(this.#Mt.has(`${t}.java`))throw new Qn(`${t}.java`);return null}#Fe(t){this.#vt();for(let e of t.statements)this.#ne(e);this.#wt()}#ne(t){let e=this.#k,n=this.#Pt.length;this.#Ns(t);let s=this.#Pt.slice(n);if(t.kind==="LocalVariableDeclaration")for(let r of t.declarators)r.symbol&&s.push(r.symbol);this.#k=Math.max(e,...s.map(r=>r.slot+Fe(r.type)))}#Ns(t){switch(t.kind){case"Block":this.#Fe(t);return;case"LocalVariableDeclaration":this.#Jn(t);return;case"ExpressionStatement":this.#v(t.expression);return;case"IfStatement":{this.#fe(t.condition);let e=this.#ct(t.condition,!0),n=this.#ct(t.condition,!1);this.#Kt(e,()=>this.#on(t.then)),t.otherwise&&this.#Kt(n,()=>this.#on(t.otherwise)),n.length&&!this.#ln(t.then)&&this.#Ue(n),e.length&&t.otherwise&&!this.#ln(t.otherwise)&&this.#Ue(e);return}case"WhileStatement":this.#fe(t.condition),this.#Kt(this.#ct(t.condition,!0),()=>this.#Ke(t,t.body)),me(t.body,t)||this.#Ue(this.#ct(t.condition,!1));return;case"DoStatement":this.#Ke(t,t.body),this.#fe(t.condition),me(t.body,t)||this.#Ue(this.#ct(t.condition,!1));return;case"ForStatement":this.#Js(t);return;case"ForEachStatement":this.#Ds(t);return;case"LabeledStatement":this.#js(t);return;case"SwitchStatement":this.#Mn(t,void 0);return;case"YieldStatement":this.#Us(t);return;case"BreakStatement":t.liveSlots=this.#k,this.#Fs(t);return;case"ContinueStatement":t.liveSlots=this.#k,this.#_s(t);return;case"ReturnStatement":if(this.#l?.initializer){this.#e(t.pos,k.syntax,"return outside method");return}t.liveSlots=this.#k+(t.value&&this.#l?Fe(this.#l.returnType):0),this.#Hs(t);return;case"EmptyStatement":return;case"ConstructorCall":this.#Nn(t,!1);return;case"ThrowStatement":{let e=this.#Z(t.expression);e.tag!=="error"&&!this.#jt(e)&&this.#e(t.pos,k.incompatibleTypes,`incompatible types: ${je(this.#St(),e)}`);return}case"TryStatement":this.#Ms(t);return;case"AssertStatement":this.#fe(t.condition),t.message&&this.#Z(t.message);return;case"LocalClass":this.#$s(t.declaration);return}}#$s(t){let e=t.symbol;if(!e)return;let n=this.#M[this.#M.length-1];if(this.#M.some(h=>h.classes?.has(e.name))&&this.#l){this.#e(t.keywordPos,k.alreadyDefined,`class ${e.name} is already defined in ${this.#l.isConstructor?"constructor":"method"} ${this.#Ft(this.#l)}`);return}(n.classes??=new Map).set(e.name,e);let r=this.#he(),a=this.#a,o=this.#t,c=this.#p,u=this.#R;e.declaration.keyword==="class"&&this.#Rt.set(e,{scopes:r.scopes});let d=[e,...Cr(e,!0)];for(let h of d)h.typeParams&&(this.#a=h,this.#un(h.typeParams,h.declaration.typeParams));for(let h of d)this.#ue(h);this.#Re(e);for(let h of d)this.#Je(h);for(let h of d)this.#ze([...h.methods,...h.constructors]);this.#t=null,this.#R=!1,this.#De(e),this.#de(r),this.#a=a,this.#t=o,this.#p=c,this.#R=u}#Ms(t){this.#vt();for(let n of t.resources)this.#Ps(n);this.#Fe(t.block),this.#wt();let e=[];for(let n of t.catches){let s=[];for(let o of n.types){let c=this.#V(o);if(c.tag==="error")continue;if(!this.#jt(c)){this.#q(o,c,this.#St());continue}let u=s.find(d=>z(c,d)||z(d,c));if(u){let[d,h]=z(c,u)?[c,u]:[u,c];this.#e(o.pos,k.syntax,"Alternatives in a multi-catch statement cannot be related by subclassing",[` Alternative ${M(d)} is a subclass of alternative ${M(h)}`]);continue}if(e.some(d=>z(c,d))){this.#e(n.types.length===1?n.pos:o.pos,k.syntax,`exception ${M(c)} has already been caught`);continue}s.push(c)}e.push(...s),n.caught=s,this.#vt();let r=s.length===1?s[0]:s.length?this.#Rs(s):A,a=this.#_t(n.name,r,n.namePos,n.isFinal||n.types.length>1);n.types.length>1&&(a.multiCatch=!0),a.catchParameter=!0,n.symbol=a,this.#Fe(n.block),this.#wt()}if(t.finallyBlock){let n=this.#l,s=n.maxSlots,r=this.#k,a=n.locals.length;this.#Fe(t.finallyBlock);let o=Math.max(0,...n.locals.slice(a).map(c=>c.slot+Fe(c.type)-r));t.finallySlots={base:r,extent:o,before:s},n.finallySlots=Math.max(n.finallySlots??0,n.maxSlots)+3+2*o}}#Ps(t){if(t.kind==="variable"){let r=this.#v(t.expression),a=nt(t.expression);a.kind==="Name"&&a.symbol?.kind==="local"&&(t.symbol=a.symbol),r.tag!=="error"&&!this.#in(r)?this.#an(t.expression,r):t.closeMethod=this.#rn(r);return}if(t.type.kind==="VarType"){let r=this.#v(t.init),a=r.tag==="null"||r.tag==="void"?A:r;if(a.tag==="error"&&r.tag!=="error"&&this.#e(t.namePos,k.cantResolve,`cannot infer type for local variable ${t.name}`,[` (variable initializer is \'${r.tag}\')`]),t.symbol=this.#_t(t.name,a,t.namePos,!0),a.tag==="error")return;this.#in(a)?t.closeMethod=this.#rn(a):this.#an(t.init,a);return}let e=this.#V(t.type),n=this.#_t(t.name,e,t.namePos,!0);t.symbol=n;let s=this.#v(t.init,e);if(!(e.tag==="error"||s.tag==="error")){if(!te(e,s,t.init.constant)){this.#q(t.init,s,e);return}this.#in(e)?t.closeMethod=this.#rn(e):this.#an(t.type,e)}}#rn(t){if(t.tag==="class")return this.#kt(t.symbol,"close").find(e=>e.params.length===0)}#in(t){return t.tag==="library"?t.symbol.closeable===!0:z(t,X(this.#c.get("java.lang.AutoCloseable")))}#an(t,e){this.#e(t.pos,k.incompatibleTypes,"incompatible types: try-with-resources not applicable to variable type",[` (${M(e)} cannot be converted to AutoCloseable)`])}#Rs(t){let s=(r=>{let a=[];for(let o=r.tag==="class"?r.symbol:null;o;o=o.superclass)a.push(o);return a})(t[0]).find(r=>t.every(a=>a.tag==="class"&&z(a,X(r))));return s?X(s):this.#St()}#on(t){this.#vt(),this.#ne(t),this.#wt()}#Js(t){if(this.#vt(),t.init&&!Array.isArray(t.init))this.#Jn(t.init);else for(let s of t.init??[])this.#v(s);t.condition&&this.#fe(t.condition);let e=t.condition?this.#ct(t.condition,!0):[];this.#Kt(e,()=>{for(let s of t.update)this.#v(s);this.#Ke(t,t.body)});let n=t.condition?this.#ct(t.condition,!1):[];this.#wt(),me(t.body,t)||this.#Ue(n)}#ln(t){let e=[this.#I,this.#X,this.#x,this.#tt,this.#Q,this.#U];this.#I=[],this.#X=[],this.#x=new Map,this.#tt=0,this.#Q=[],this.#U=new Map;let n=this.#Ct(t,Kt(),!0).completes;return[this.#I,this.#X,this.#x,this.#tt,this.#Q,this.#U]=e,n}#Ke(t,e){this.#P.push({kind:"loop",node:t}),this.#on(e),this.#P.pop()}#Ds(t){let e=this.#v(t.iterable);this.#vt();let n=A,s=c=>c.tag==="library"?[c]:c.tag==="diamond"?[this.#gn(c)]:c.tag==="class"?Ie(c):c.tag==="typevar"&&c.symbol?c.symbol.bounds.flatMap(s):[],r=s(e).map(c=>Pt(c,se("Iterable"))).find(c=>c!==null)??null;e.tag==="array"?(n=e.element,t.hidden={array:this.#ke(e),length:this.#ke(U),index:this.#ke(U)}):r?(n=$e(r.args[0]??H),t.element=n,t.iterator=this.#ke(H)):e.tag!=="error"&&this.#e(t.iterable.pos,k.incompatibleTypes,"for-each not applicable to expression type",[" required: array or java.lang.Iterable",` found: ${M(e)}`]),this.#yt(t.modifiers,"local");let a=t.type.kind==="VarType"?n:this.#V(t.type),o=this.#_t(t.name,a,t.namePos,Ht(t.modifiers,"final"));o.forEach=!0,t.symbol=o,n.tag!=="error"&&a.tag!=="error"&&!te(a,n)&&this.#q(t.iterable,n,a),this.#Ke(t,t.body),this.#wt()}#js(t){this.#P.some(s=>s.kind==="label"&&s.label===t.label)&&this.#e(t.pos,k.syntax,`label ${t.label} already in use`);let e=t.body,n=["WhileStatement","DoStatement","ForStatement","ForEachStatement"].includes(e.kind);this.#P.push({kind:"label",node:t,label:t.label,loop:n?e:void 0}),this.#ne(e),this.#P.pop()}#Fs(t){for(let e=this.#P.length-1;e>=0;e--){let n=this.#P[e];if(n.kind==="switch-expression"){this.#e(t.pos,k.syntax,"attempt to break out of a switch expression");return}if(t.label===void 0?n.kind==="loop"||n.kind==="switch":n.kind==="label"&&n.label===t.label){t.target=n.node;return}}t.label!==void 0?this.#e(t.pos,k.syntax,`undefined label: ${t.label}`):this.#e(t.pos,k.syntax,"break outside switch or loop")}#_s(t){for(let e=this.#P.length-1;e>=0;e--){let n=this.#P[e];if(n.kind==="switch-expression"){this.#e(t.pos,k.syntax,"attempt to continue out of a switch expression");return}if(t.label===void 0&&n.kind==="loop"){t.target=n.node;return}if(t.label!==void 0&&n.kind==="label"&&n.label===t.label){n.loop?t.target=n.loop:this.#e(t.pos,k.syntax,`not a loop label: ${t.label}`);return}}t.label!==void 0?this.#e(t.pos,k.syntax,`undefined label: ${t.label}`):this.#e(t.pos,k.syntax,"continue outside of loop")}#Us(t){let e=[...this.#P].reverse().find(s=>s.kind==="switch-expression");if(!e){this.#e(t.pos,k.syntax,"yield outside of switch expression"),this.#v(t.value);return}t.target=e.node;let n=this.#Z(t.value,e.target);e.results.push({expression:t.value,type:n})}#ke(t){let e=this.#l;if(!e)throw new Error("checker: hidden local outside a method");let n={kind:"local",name:"",type:t,index:e.locals.length,slot:this.#k,isFinal:!1,declPos:-1};return this.#k+=Fe(t),e.maxSlots=Math.max(e.maxSlots,this.#k),e.locals.push(n),n}#Mn(t,e){let n=t.kind==="SwitchExpression",s=this.#v(t.selector),r=s.tag!=="error",a=s.tag==="class"&&s.symbol.isEnum?s.symbol:null,o=s.tag==="library"&&s.symbol.enumConstants?s.symbol:null,c=a!==null||o!==null||["int","byte","short","char","string"].includes(s.tag)||gt(s)!==null;if(r&&(t.cases.some(b=>b.pattern||b.nullLabel)||!c&&Q(s)))return this.#Bs(t,s,e);r&&!a&&!o&&!["int","byte","short","char","string"].includes(s.tag)&&(r=!1,gt(s)?this.#o(t.selectorPos,`switching on ${Ye(M(s))}`,!0):Z(s)?this.#e(t.selectorPos,k.syntax,"primitive patterns are a preview feature and are disabled by default.",[" (use --enable-preview to enable primitive patterns)"]):this.#o(t.selectorPos,`switching on ${Ye(M(s))}`,!0)),this.#vt(),r&&s.tag==="string"&&(this.#l?t.hidden={copy:this.#ke(ut),index:this.#ke(U)}:(this.#o(t.pos,"a switch on a String in a field initializer",!0),r=!1));let u=n?{kind:"switch-expression",node:t,results:[],target:e}:{kind:"switch",node:t};this.#P.push(u);let d=new Set,h=0,m=!1,p=t.cases[0]?.arrow??!1;for(let b of t.cases){if(b.arrow!==p&&!m&&(m=!0,this.#e(b.pos,k.syntax,"different case kinds used in the switch")),b.isDefault&&++h>1&&this.#e(b.pos,k.syntax,"duplicate default label"),o){b.ordinals=[];for(let S of b.labels){let v=this.#Vs(S,o);v!==null&&(d.has(`e:${v}`)&&this.#e(S.pos,k.syntax,"duplicate case label"),d.add(`e:${v}`),b.ordinals.push(v))}this.#qe(b,n,u);continue}if(a){b.ordinals=[];for(let S of b.labels){let v=this.#Pn(S,a);v!==null&&(d.has(`e:${v}`)&&this.#e(S.pos,k.syntax,"duplicate case label"),d.add(`e:${v}`),b.ordinals.push(v))}this.#qe(b,n,u);continue}for(let S of b.labels){let v=this.#v(S,r?s:void 0);if(!r||v.tag==="error")continue;if(!S.constant){this.#e(S.pos,k.syntax,"constant expression required");continue}if(!te(s,v,S.constant)){this.#q(S,v,s);continue}let x=S.constant.kind==="string"?`s:${S.constant.value}`:`n:${gn(S.constant)}`;d.has(x)&&this.#e(b.pos,k.syntax,"duplicate case label"),d.add(x)}this.#qe(b,n,u)}return this.#P.pop(),this.#wt(),a&&(t.coversAllConstants=a.enumConstants.every(b=>d.has(`e:${b.enumConstant.ordinal}`))),o&&(t.libraryEnum=ga(o),t.coversAllConstants=o.enumConstants.every((b,S)=>d.has(`e:${S}`))),n?this.#Rn(t,u.results,e):Tt}#Bs(t,e,n){let s=t.kind==="SwitchExpression";t.patternSwitch=!0;let r=e.tag==="class"&&e.symbol.isEnum?e.symbol:null;this.#vt();let a=s?{kind:"switch-expression",node:t,results:[],target:n}:{kind:"switch",node:t};this.#P.push(a);let o=!1,c=0,u=!1,d=t.cases[0]?.arrow??!1,h=[],m=new Set,p=null,b=[],S=!1,v=gt(e);t.cases.forEach((C,E)=>{C.arrow!==d&&!o&&(o=!0,this.#e(C.pos,k.syntax,"different case kinds used in the switch")),C.isDefault&&++c>1&&this.#e(C.pos,k.syntax,"duplicate default label");let R=[];C.nullLabel&&Z(e)&&this.#q({pos:C.pos},mr,e);for(let L of C.labels){if(r){let N=this.#Pn(L,r);if(N===null)continue;m.has(`e:${N}`)&&this.#e(L.pos,k.syntax,"duplicate case label"),m.add(`e:${N}`),(C.ordinals??=[]).push(N),b.push({constantOf:r,ordinal:N})}else{let N=this.#v(L,v??e);if(N.tag==="error")continue;let J=L.kind==="FieldAccess"?L.fieldSymbol:void 0;if(N.tag==="class"&&N.symbol.isEnum&&J?.enumConstant&&z(N,e)){(C.enumFields??=[]).push(J),b.push({constantOf:N.symbol,ordinal:J.enumConstant.ordinal}),h.some(j=>z(N,j))&&this.#e(L.pos,k.syntax,"this case label is dominated by a preceding case label");continue}if(!(e.tag==="string"?N.tag==="string":v!==null&&Z(N)&&L.constant!==void 0&&te(v,N,L.constant))){v&&L.constant?this.#q(L,N,v):this.#o(L.pos,`constant labels in a switch on ${Ye(M(e))}`,!0);continue}if(!L.constant){this.#e(L.pos,k.syntax,"constant expression required");continue}let P=L.constant.kind==="string"?`s:${L.constant.value}`:`n:${gn(L.constant)}`;m.has(P)&&this.#e(C.pos,k.syntax,"duplicate case label"),m.add(P)}let I=r||v?e:ut;h.some(N=>z(I,N))&&this.#e(L.pos,k.syntax,"this case label is dominated by a preceding case label")}if(C.pattern){let L=C.pattern;if(!this.#hn(L,e,!0,R))S=!0;else{let N=L.tested;(u||h.some(D=>z(K(N),K(D))))&&this.#e(L.pos,k.syntax,"this case label is dominated by a preceding case label");let J=C.guard!==void 0;L.kind==="TypePattern"&&!J&&(h.push(N),L.unconditional&&(p=C)),(!C.guard||Bn(C.guard.constant))&&b.push({pattern:L})}let I=t.cases[E-1];!C.arrow&&I&&!I.arrow&&I.statements.length&&R.length&&this.#ln({kind:"Block",statements:I.statements,pos:I.pos,start:I.start,end:I.end})&&this.#e(L.pos,k.syntax,"illegal fall-through to a pattern",[" (the previous case label is missing a break)"])}C.isDefault&&(u=!0,b.push({all:!0})),this.#Kt(R,()=>{let L=[];C.guard&&(this.#fe(C.guard),vs(C.guard.constant)&&this.#e(C.guard.pos,k.syntax,"this case label has a guard that is a constant expression with value \'false\'"),L=this.#ct(C.guard,!0)),this.#Kt(L,()=>this.#qe(C,s,a))})});let x=t.cases.find(C=>C.isDefault&&!C.nullLabel)??t.cases.find(C=>C.isDefault);return p&&x&&this.#e(x.pos,k.syntax,"switch has both an unconditional pattern and a default label"),this.#P.pop(),this.#wt(),t.exhaustive=el(e,b),!t.exhaustive&&!S&&this.#e(t.pos,k.syntax,`the switch ${s?"expression":"statement"} does not cover all possible input values`),s?this.#Rn(t,a.results,n):Tt}#Vs(t,e){let n=nt(t),s=e.enumConstants,r=n.kind==="Name"?n.identifier:n.kind==="FieldAccess"&&Ls(n.target)?.split(".").pop()===e.name?n.name:null,a=r===null?-1:s.indexOf(r);return a>=0?(t.type=dt(e),a):n.kind==="Name"?(this.#e(n.pos,k.cantResolve,"cannot find symbol",[` symbol: variable ${n.identifier}`,` location: class ${this.#a.displayName}`]),null):(this.#v(t).tag!=="error"&&this.#e(t.pos,k.syntax,"constant expression required"),null)}#Pn(t,e){let n=nt(t);if(n.kind==="Name"){let a=e.fieldsByName.get(n.identifier);return a?.enumConstant?(n.symbol=a,t.type=X(e),a.enumConstant.ordinal):(this.#e(n.pos,k.cantResolve,"cannot find symbol",[` symbol: variable ${n.identifier}`,` location: class ${this.#a.displayName}`]),null)}let s=this.#v(t);if(s.tag==="error")return null;let r=n.kind==="FieldAccess"?n.fieldSymbol:void 0;return r?.enumConstant&&r.owner===e?r.enumConstant.ordinal:(te(X(e),s)?this.#e(t.pos,k.syntax,"constant expression required"):this.#q(t,s,X(e)),null)}#qe(t,e,n){if(!t.arrow){for(let r of t.statements)this.#ne(r);return}let s=t.body;s.kind==="Block"?this.#Fe(s):e?n.results.push({expression:s,type:this.#Z(s,n.target)}):this.#v(s)}#Rn(t,e,n){if(e.some(r=>r.type.tag==="error"))return A;if(n&&n.tag!=="error"){let r=!0;for(let{expression:a,type:o}of e)te(n,o,a.constant)||(this.#e(a.pos,k.incompatibleTypes,"incompatible types: bad type in switch expression",[` ${je(n,o)}`]),r=!1);return r?n:A}let s=e.map(r=>r.type);return s.length?s.every(r=>r.tag==="boolean")?ft:s.every(r=>Ot(r))?s.every(r=>et(r,s[0]))?s[0]:s.reduce((r,a)=>Xn(r,a)):s.every(r=>Q(r))?s.reduce((r,a)=>wa(r,a)):(this.#o(t.pos,"switch expressions that need boxing"),A):A}#Hs(t){let e=this.#l.returnType;if(this.#l.lambda&&this.#l.returnType===Wn){if(!t.value)return;let s=this.#v(t.value);s.tag!=="error"&&(this.#l.returnType=zt(s)??(s.tag==="null"?H:s));return}if(this.#l.lambda){let s=`incompatible types: bad return type in ${this.#l.lambda.reference?"method reference":"lambda expression"}`;if(!t.value){e.tag!=="void"&&this.#e(t.pos,k.incompatibleTypes,s,[" missing return value"]);return}if(e.tag==="void"){this.#v(t.value),this.#e(t.value.pos,k.incompatibleTypes,"incompatible types: unexpected return value");return}let r=this.#v(t.value,e);r.tag!=="error"&&!te(e,r,t.value.constant)&&this.#e(t.value.pos,k.incompatibleTypes,s,[` ${je(e,r)}`]);return}if(!t.value){e.tag!=="void"&&this.#e(t.pos,k.incompatibleTypes,"incompatible types: missing return value");return}let n=this.#v(t.value,e.tag==="void"?void 0:e);if(e.tag==="void"){n.tag!=="error"&&this.#e(t.value.pos,k.incompatibleTypes,"incompatible types: unexpected return value");return}this.#We(e,n,t.value)||this.#q(t.value,n,e)}#fe(t){let e=this.#v(t);e.tag!=="error"&&(gt(e)??e).tag!=="boolean"&&this.#q(t,e,ft)}#Jn(t){let e=Ht(t.modifiers,"final"),n=this.#yt(t.modifiers,"local");if(this.#$=[...this.#$,n],this.#At(t.modifiers,"Deprecated"))for(let s of t.declarators)this.#st(s.pos,"deprecation","@Deprecated annotation has no effect on this variable declaration");t.type.kind==="VarType"?this.#Gs(t,e):this.#zs(t,e),this.#$=this.#$.slice(0,-1)}#zs(t,e){let n=this.#V(t.type);for(let s of t.declarators){let r=n;for(let u=0;u<s.extraDims&&r.tag!=="error";u++)r=Qt(r);let a=this.#_t(s.name,r,s.pos,e);s.symbol=a;let o=s.init;if(o||(a.noInitializer=!0),!o){e&&this.#o(s.pos,"final local variables without an initializer");continue}if(o.kind==="ArrayInitializer"){this.#Ce(o,r);continue}let c=this.#v(o,r);this.#We(r,c,o)?e&&o.constant&&(Z(r)||r.tag==="string")&&(a.constant=vn(o.constant,r)):this.#q(o,c,r)}}#Gs(t,e){let n=t.type.pos;if(t.declarators.length>1){this.#e(n,k.syntax,"\'var\' is not allowed in a compound declaration");return}let s=t.declarators[0];if(s.extraDims){this.#e(n,k.syntax,"\'var\' is not allowed as an element type of an array");return}let r=d=>this.#e(s.pos,k.cantResolve,`cannot infer type for local variable ${s.name}`,[` (${d})`]),a=s.init,o=a&&a.kind!=="ArrayInitializer"?nt(a):null,c=A;if(!a)r("cannot use \'var\' on variable without initializer");else if(a.kind==="ArrayInitializer")r("array initializer needs an explicit target-type");else if(o.kind==="Lambda")r("lambda expression needs an explicit target-type");else if(o.kind==="MethodRef")r("method reference needs an explicit target-type");else if(ol(a,s.name))r("cannot use \'var\' on self-referencing variable");else{let d=this.#v(a);d.tag==="null"?r("variable initializer is \'null\'"):d.tag==="void"?r("variable initializer is \'void\'"):c=d.tag==="diamond"?this.#gn(d):d,c.tag==="class"&&c.args?.includes(jn)&&(c=A)}let u=this.#_t(s.name,c,s.pos,e);s.symbol=u,a||(u.noInitializer=!0),a&&a.kind!=="ArrayInitializer"&&e&&a.constant&&(Z(c)||c.tag==="string")&&(u.constant=vn(a.constant,c))}#We(t,e,n){return K(t).tag==="object"&&delete nt(n).genericCast,te(t,e,n.constant)?!0:Qe(t,e)?(this.#st(n.pos,"unchecked","unchecked conversion",[` required: ${M(t)}`,` found: ${M(e)}`,...Dt([t,e])]),!0):!1}#Ce(t,e){if(e.tag==="error"){for(let n of t.elements)n.kind==="ArrayInitializer"?this.#Ce(n,A):this.#v(n);return}if(e.tag!=="array"){this.#e(t.pos,k.incompatibleTypes,`illegal initializer for ${M(e)}`);return}t.elementType=e.element;for(let n of t.elements){if(n.kind==="ArrayInitializer"){this.#Ce(n,e.element);continue}let s=this.#v(n,e.element);te(e.element,s,n.constant)||this.#q(n,s,e.element)}}#cn(t,e,n){let s=[];for(let r of t){if(s.some(a=>a.name===r.name)){this.#e(r.pos,k.alreadyDefined,`type variable ${r.name} is already defined in ${e}`);continue}s.push({kind:"typevar",name:r.name,key:`${r.name}#${this.#K++}`,bounds:[],declaredIn:e,pos:r.pos,ofClass:n})}return s}#un(t,e){this.#L=[...this.#L,t.filter(s=>!s.ofClass)];let n=this.#ft;this.#ft=!0;for(let s of t){let r=e.find(a=>a.name===s.name&&a.pos===s.pos);for(let a of r?.bounds??[]){let o=this.#V(a);if(o.tag!=="error"){if(!Q(o)||o.tag==="array"){this.#e(a.pos,k.incompatibleTypes,"unexpected type",[" required: class",` found: ${M(o)}`]);continue}o.tag==="object"&&r.bounds.length===1||s.bounds.push(o)}}}this.#ft=n,this.#L=this.#L.slice(0,-1)}#Ks(t,e){for(let s=this.#L.length-1;s>=0;s--){let r=this.#L[s].find(a=>a.name===t);if(r)return ke(r)}let n=this.#F;for(let s=this.#a??null;s;s=s.outer){let r=s.typeParams?.find(a=>a.name===t);if(r)return n?(this.#e(e,k.syntax,`non-static type variable ${t} cannot be referenced from a static context`),A):ke(r);s.isInner||(n=!0)}return null}#_e(t){if(t.kind==="WildcardType"){if(!t.bound)return{tag:"wildcard",bound:null};let e=this.#_e(t.bound);return e.tag==="error"||e.tag==="wildcard"?A:{tag:"wildcard",bound:e,isSuper:t.isSuper}}return t.kind==="PrimitiveType"?(this.#e(t.pos,k.incompatibleTypes,"unexpected type",[" required: reference",` found: ${t.name}`]),A):this.#V(t)}#qs(t,e){let n=t.typeParams??[];if(e.diamond)return X(t);if(!n.length)return this.#e(e.typeArgumentsPos??e.pos,k.syntax,`type ${t.displayName} does not take parameters`),A;let s=e.typeArguments??[];if(s.length!==n.length)return this.#e(e.typeArgumentsPos??e.pos,k.syntax,`wrong number of type arguments; required ${n.length}`),A;let r=[];for(let o of s){let c=this.#_e(o);if(c.tag==="error")return A;r.push(c)}let a=X(t,r);if(!this.#ft){let o=Rn(a);for(let c=0;c<n.length;c++){let u=r[c];if(u.tag==="wildcard")continue;if(!n[c].bounds.every(h=>z(u,Vt(h,o))))return this.#e(s[c].pos,k.incompatibleTypes,`type argument ${M(u)} is not within bounds of type-variable ${n[c].name}`,Dt([ke(n[c])])),A}}return a}#V(t,e=!1){switch(t.kind){case"PrimitiveType":return t.name==="int"?U:t.name==="boolean"?ft:t.name==="char"?we:t.name==="long"?Lt:t.name==="double"?ht:t.name==="float"?xt:t.name==="byte"?Pn:yn;case"VarType":return this.#o(t.pos,"\'var\' declarations"),A;case"WildcardType":return this.#o(t.pos,"wildcard types"),A;case"VoidType":return this.#e(t.pos,k.syntax,"\'void\' type not allowed here"),A;case"ArrayType":{let n=this.#V(t.element);return n.tag==="error"?A:Qt(n)}case"ClassType":{let n=t.names.join(".");if((n==="Object"||n==="java.lang.Object")&&!this.#pe(t.names))return t.hasTypeArguments?(this.#e(t.typeArgumentsPos??t.pos,k.syntax,"type Object does not take parameters"),A):H;if(n==="String"||n==="java.lang.String")return t.hasTypeArguments?(this.#e(t.typeArgumentsPos??t.pos,k.syntax,"type String does not take parameters"),A):ut;if(t.names.length===1){let o=this.#Ks(n,t.pos);if(o)return t.hasTypeArguments?(this.#e(t.typeArgumentsPos??t.pos,k.syntax,`type ${n} does not take parameters`),A):o}let s=this.#pe(t.names)??this.#ce(t.names);if(s)return t.hasTypeArguments?this.#qs(s,t):X(s);let r=this.#et(t.names);if(r)return this.#Ws(r,t,e);let a=t.names.length===1?this.#w.get(n):void 0;return a?(this.#o(t.pos,`the class ${a}`,!0),A):t.names.length===1&&(Vn.has(n)||n===this.#Xs())?(this.#o(t.pos,`the type ${n}`,!0),A):t.names.length>1&&(t.names[0]==="java"||t.names[0]==="javax")?(this.#o(t.pos,`the type ${n}`,!0),A):t.names.length>1?(this.#e(t.lastDotPos??t.pos,k.cantResolve,`package ${t.names.slice(0,-1).join(".")} does not exist`),A):(this.#e(t.pos,k.cantResolve,"cannot find symbol",[` symbol: class ${n}`,` location: class ${this.#a.displayName}`]),A)}}}#Ws(t,e,n=!1){let s=t.typeParams;if(t.name==="Class"&&e.typeArguments)return this.#o(e.typeArgumentsPos??e.pos,"Class<...> types (declare the variable as Class)"),A;if(!e.typeArguments)return e.diamond?{tag:"diamond",symbol:t,fromArgs:null}:dt(t);if(e.typeArguments.length!==s.length)return this.#e(e.typeArgumentsPos??e.pos,k.syntax,s.length?`wrong number of type arguments; required ${s.length}`:`type ${t.name} does not take parameters`),A;let r=[];for(let a of e.typeArguments){let o=this.#_e(a);if(o.tag==="error")return A;r.push(o)}return dt(t,r)}#pe(t){let e=this.#me(t[0]);for(let n of t.slice(1))e=e?.membersByName.get(n)??null;return e}#Xs(){return this.#W.find(t=>t.declaration.implicit)?.name}#q(t,e,n){e.tag==="error"||n.tag==="error"||this.#e(t.pos,k.incompatibleTypes,`incompatible types: ${je(n,e)}`,Dt([e,n]))}#v(t,e){let n=this.#Ys(t,e);return t.type=n,n}#Z(t,e){let n=this.#v(t,e);return n.tag==="void"?(this.#e(t.pos,k.incompatibleTypes,"\'void\' type not allowed here"),A):n}#Ys(t,e){switch(t.kind){case"Literal":switch(t.literalKind){case"int":return t.constant=q(t.value),U;case"char":return t.constant=_n(t.value.charCodeAt(0)),we;case"boolean":return t.constant=bt(t.value),ft;case"long":return t.constant=Jt(t.value),Lt;case"double":return t.constant=ee(t.value),ht;case"float":return t.constant=de(t.value),xt;case"string":return t.constant=br(t.value),ut;case"null":return mr;default:return this.#o(t.pos,`\'${t.literalKind}\' literals`),A}case"Name":return this.#or(t);case"Parenthesized":{let n=this.#v(t.expression,e);return t.expression.constant&&(t.constant=t.expression.constant),n}case"FieldAccess":return this.#_n(t);case"MethodCall":{let n=this.#fr(t,e);return this.#Ae(t.args),n}case"Unary":return this.#Mr(t);case"IncDec":return this.#Rr(t);case"Binary":return this.#Jr(t);case"Assignment":return this.#Dr(t);case"ArrayAccess":return this.#jr(t);case"NewArray":return this.#Fr(t);case"Cast":return this.#_r(t);case"This":return this.#rr(t);case"NewObject":{let n=this.#Sr(t,e);return this.#Ae(t.args),n}case"Conditional":return this.#Cr(t,e);case"SwitchExpression":return this.#Mn(t,e);case"Lambda":return this.#Tn(t,e);case"MethodRef":return t.lambda?.method?e??A:this.#Kn(t,e);case"InstanceOf":return this.#er(t);case"Super":return this.#jn(t);case"ClassLiteral":return this.#Qs(t)}}#Qs(t){let e=this.#Xe(t.target);if(!("kind"in e))return e.tag!=="error"&&this.#e(t.target.pos,k.cantResolve,"cannot find symbol",[` symbol: class ${Ls(t.target)??"?"}`,` location: class ${this.#a.displayName}`]),A;let n=s=>dt(se("Class"),[s]);if(e.symbol)return t.className=e.symbol.binaryName,t.isInterface=e.symbol.isInterface,n(X(e.symbol));if(e.name==="String")return t.className="java.lang.String",n(ut);if($t[e.name]){let s=se(e.name);return t.className=s.qualifiedName,t.isInterface=s.isInterface,n(dt(s))}return e.name==="Object"||e.name==="System"||e.name==="Math"?(t.className=`java.lang.${e.name}`,dt(se("Class"))):(this.#o(t.pos,`the class literal ${e.name}.class`,!0),A)}#Dn(t,e){if(!e&&(this.#_||this.#R))return this.#Wt(t.selectPos,"non-static method getClass() cannot be referenced from a static context"),A;if(e||this.#qt(),e&&Z(e))return this.#e(t.selectPos,k.cantResolve,`${M(e)} cannot be dereferenced`),A;let n=se("Class");return t.libraryCall={native:"Object.getClass",isStatic:!1,params:[],returnsValue:!0,display:"Object.getClass()"},dt(n)}#jn(t){return t.qualifier?this.#Zs(t,t.qualifier):this.#_?(this.#Wt(t.pos,"non-static variable super cannot be referenced from a static context"),A):(this.#qt(),this.#R?(this.#o(t.pos,"using \'super\' in the arguments of \'this(...)\' or \'super(...)\'",!0),A):this.#a.isInterface?(this.#o(t.pos,"\'super\' in an interface",!0),A):this.#a.superType??(this.#a.superclass?X(this.#a.superclass):this.#a.librarySuperclass??H))}#Zs(t,e){let n=t.dotPos??t.pos,s=e.length===1?this.#me(e[0]):this.#fn(this.#tr(e,t.qualifierPos??t.pos));if(!s){let a=e[e.length-1];return $t[a]||Vn.has(a)||this.#w.has(a)?(this.#o(t.qualifierPos??t.pos,`\'${a}.super\' of a library type`,!0),A):(this.#e(t.qualifierPos??t.pos,k.cantResolve,"cannot find symbol",[` symbol: class ${a}`,` location: class ${this.#a.displayName}`]),A)}let r=()=>(this.#e(n,k.cantResolve,`not an enclosing class: ${s.displayName}`),A);if(s.isInterface){if(this.#_||!this.#a.interfaces.includes(s))return r();let a=this.#a.interfaces.find(o=>o!==s&&fn(o,s));return a?(this.#e(n,k.cantResolve,`bad type qualifier ${s.displayName} in default super call`,[` redundant interface ${s.displayName} is extended by ${a.displayName}`]),A):(this.#qt(),this.#R?(this.#o(t.pos,"using \'super\' in the arguments of \'this(...)\' or \'super(...)\'",!0),A):(t.interfaceSymbol=s,X(s)))}if(s===this.#a){let a={...t};return delete a.qualifier,this.#jn(a)}for(let a=this.#a.outer;a;a=a.outer)if(a===s)return this.#o(t.qualifierPos??t.pos,`\'${s.displayName}.super\' of an enclosing class`,!0),A;return r()}#tr(t,e){let n={kind:"Name",identifier:t[0],depth:1,pos:e,start:e,end:e};for(let s of t.slice(1))n={kind:"FieldAccess",target:n,name:s,namePos:e,depth:1,pos:e,start:e,end:e};return n}#er(t){if(t.recordPattern){let r=this.#Z(t.expression);if(r.tag==="error")return A;if(!this.#l)return this.#o(t.recordPattern.pos,"pattern variables in field initializers"),A;let a=[];return this.#hn(t.recordPattern,r,!0,a)?(t.testedType=t.recordPattern.tested,t.patternBindings=a,ft):A}let e=this.#Z(t.expression),n=t.targetType.kind==="ClassType"&&!t.targetType.hasTypeArguments?this.#et(t.targetType.names):null,s=n&&n.typeParams.length?dt(n):this.#V(t.targetType);if(e.tag==="error"||s.tag==="error")return A;if(Z(e)||Z(s))return Z(s)?this.#e(t.targetType.pos,k.syntax,"primitive patterns are a preview feature and are disabled by default.",[" (use --enable-preview to enable primitive patterns)"]):this.#e(t.expression.pos,k.incompatibleTypes,"unexpected type",[" required: reference",` found: ${M(e)}`]),A;if(s.tag==="library"&&s.args.some(r=>r.tag!=="wildcard"||r.bound!==null))return this.#o(t.targetType.pos,"instanceof with a generic type",!0),A;if(!ve(s,e))return this.#q(t.expression,e,s),A;if(t.testedType=s,t.binding){if(!this.#l)return this.#o(t.binding.pos,"pattern variables in field initializers"),A;t.binding.symbol=this.#dn(t.binding.name,s,t.binding.pos,t.binding.isFinal)}return ft}#hn(t,e,n,s){let r=this.#nr(t,e,n,s);return r||this.#Fn(t,s),r}#Fn(t,e){if(t.kind==="RecordPattern")return t.components.forEach(n=>this.#Fn(n,e));t.symbol||t.name==="_"||(t.symbol=this.#dn(t.name,A,t.namePos,t.isFinal),e.push(t.symbol))}#nr(t,e,n,s){if(t.kind==="TypePattern"){let h;if(t.type===null)h=e;else{let m=t.type.kind==="ClassType"&&!t.type.hasTypeArguments?this.#et(t.type.names):null;if(h=m&&m.typeParams.length?dt(m):this.#V(t.type,!0),h.tag==="error")return!1;if(n&&(Z(e)||Z(h))||!n&&Z(h)!==Z(e)||Z(h)&&!et(h,e))return this.#e(t.pos,k.syntax,"primitive patterns are a preview feature and are disabled by default.",[" (use --enable-preview to enable primitive patterns)"]),!1;if(h.tag==="library"&&h.args.some(p=>p.tag!=="wildcard"||p.bound!==null))return this.#o(t.pos,"patterns of a parameterized type",!0),!1;if(!Z(h)&&!ve(h,e))return this.#q(t,e,h),!1}return t.tested=h,t.unconditional=Z(h)||z(K(e),K(h)),t.name!=="_"&&(t.symbol=this.#dn(t.name,h,t.namePos,t.isFinal),s.push(t.symbol)),!0}let r=this.#V(t.type,!0);if(r.tag==="error")return!1;if(r.tag!=="class"||!r.symbol.isRecord)return this.#e(t.pos,k.syntax,`deconstruction patterns can only be applied to records, ${M(r)} is not a record`),!1;let a=r.symbol,o=r;if(a.typeParams?.length&&!r.args?.length){let h=e.tag==="class"?Zt(e,a):null;o=h?.args?.length?h:r}if(!ve(o,e))return this.#q(t,e,o),!1;let c=a.components,u=c.map(h=>$e(Oe(o,a,h.type)));if(c.length!==t.components.length){let h=t.components.map(m=>m.kind==="TypePattern"&&m.type===null?"var":M(this.#sr(m)));return this.#e(t.pos,k.syntax,"incorrect number of nested patterns",[` required: ${u.map(M).join(",")}`,` found: ${h.join(",")}`]),!1}t.tested=o,t.accessors=c.map(h=>this.#kt(a,h.name).find(m=>!m.isStatic&&m.params.length===0));let d=!0;return t.components.forEach((h,m)=>{this.#hn(h,u[m],!1,s)||(d=!1)}),d}#sr(t){return t.type?this.#Wn(t.type):H}#dn(t,e,n,s){let r=this.#l;(this.#lt(t)||this.#Sn(t))&&this.#e(n,k.alreadyDefined,`variable ${t} is already defined in ${r.isConstructor?"constructor":"method"} ${this.#Ft(r)}`);let a={kind:"local",name:t,type:e,index:r.locals.length,slot:this.#k,isFinal:s,declPos:n,binding:!0};return this.#k+=Fe(e),r.maxSlots=Math.max(r.maxSlots,this.#k),r.locals.push(a),a}#ct(t,e){switch(t.kind){case"Parenthesized":return this.#ct(t.expression,e);case"Unary":return t.operator==="!"?this.#ct(t.operand,!e):[];case"InstanceOf":return e?t.binding?.symbol?[t.binding.symbol]:t.patternBindings??[]:[];case"Binary":return t.operator==="&&"&&e?[...this.#ct(t.left,!0),...this.#ct(t.right,!0)]:t.operator==="||"&&!e?[...this.#ct(t.left,!1),...this.#ct(t.right,!1)]:[];default:return[]}}#Kt(t,e){if(!t.length)return e();this.#vt();let n=this.#M[this.#M.length-1];for(let a of t)n.names.set(a.name,a);let s=e(),r=this.#k;return this.#wt(),this.#k=r,s}#Ue(t){let e=this.#M[this.#M.length-1];for(let n of t)e.names.has(n.name)||this.#lt(n.name)||(e.names.set(n.name,n),this.#Pt.push(n))}#rr(t){return t.qualifier?this.#ir(t,t.qualifier):this.#_?(this.#Wt(t.pos,"non-static variable this cannot be referenced from a static context"),A):(this.#qt(),this.#R?(this.#o(t.pos,"using \'this\' in the arguments of \'this(...)\'",!0),A):he(this.#a))}#ir(t,e){let n=this.#pe(e),s=0,r=this.#a;for(;r&&r!==n;)r=r.outer,s++;return!n||!r?(this.#e(t.pos,k.syntax,`not an enclosing class: ${e[e.length-1]}`),A):this.#_||!this.#Ge(s)?(this.#Wt(t.pos,"non-static variable this cannot be referenced from a static context"),A):(this.#qt(),s&&(t.outerHops=s),he(n))}#ar(t,e){let n=t.captures?.find(d=>d.local.name===e);if(n)return n.field;let s=this.#Rt.get(t);if(!s)return null;let r;for(let d=s.scopes.length-1;d>=0&&!r;d--)r=s.scopes[d].names.get(e);if(!r)return null;let a=t.declaration.pos,o={name:`val$${e}`,extraDims:0,init:null,pos:a,start:a,end:a},c={kind:"FieldDeclaration",modifiers:{keywords:[]},type:{kind:"VoidType",pos:a,start:a,end:a},declarators:[o],pos:a,start:a,end:a},u={kind:"field",name:`val$${e}`,type:r.type,owner:t,isStatic:!1,isFinal:!0,isPrivate:!0,index:t.instanceCount++,order:t.fields.length,state:"done",declaration:c,declarator:o,capturedLocal:r};return t.fields.push(u),(t.captures??=[]).push({field:u,local:r}),u}#or(t){let e=this.#lt(t.identifier);if(e)return e.captureOf&&this.#Y.push({local:e,pos:t.pos,top:this.#a.topLevel}),t.symbol=e,e.constant&&(t.constant=e.constant),e.type;let n=this.#ee(t.identifier);if(n){let{field:r,hops:a}=n,o=this.#a;for(let u=0;u<a;u++)o=o.outer;if(r.isPrivate&&r.owner!==o&&!this.#Os(r.owner,o))return this.#e(t.pos,k.cantResolve,`${r.name} has private access in ${r.owner.displayName}`),A;if(!r.isStatic){if(this.#_||!this.#Ge(a))return this.#Wt(t.pos,`non-static variable ${r.name} cannot be referenced from a static context`),A;if(this.#qt(),this.#R&&a===0)return this.#o(t.pos,"using the object\'s fields in the arguments of \'this(...)\'"),A}let c=this.#E??this.#nt;return a===0&&c&&!this.#Bt&&!r.capturedLocal&&r.owner===c.owner&&r.isStatic===c.isStatic&&r.order>=c.order?(this.#e(t.pos,k.syntax,r===c?"self-reference in initializer":"illegal forward reference"),A):(t.symbol=r,a>0&&!r.isStatic&&(t.outerHops=a),r.capturedLocal&&this.#Y.push({local:r.capturedLocal,pos:t.pos,top:this.#a.topLevel,inner:!0}),this.#mn(t,r,r.isStatic?void 0:he(o)))}let s=this.#Me(t);if(s==="error")return A;if(s){t.imported=s;let r=this.#_n(s);return s.type=r,s.constant&&(t.constant=s.constant),r}return this.#Ot(t.identifier,t.pos)?A:(this.#e(t.pos,k.cantResolve,"cannot find symbol",[` symbol: variable ${t.identifier}`,` location: class ${this.#a.displayName}`]),A)}#mn(t,e,n){if(e.isFinal&&e.state==="pending"&&this.#$n(e),e.constant&&(t.constant=e.constant),!n)return e.type;let s=$e(Oe(n,e.owner,e.type));return Ta(t,e.type,s),s}#Xe(t){if(t.kind==="Name"&&t.staticOwner)return t.symbol={kind:"type",name:t.identifier},{kind:"type",name:t.identifier,qualified:!0};if(t.kind==="Name"&&!this.#lt(t.identifier)&&!this.#ee(t.identifier)&&this.#f(t.identifier,this.#It).length)return this.#v(t);if(t.kind==="Name"&&!this.#lt(t.identifier)&&!this.#ee(t.identifier)){let e=t.identifier,n=this.#me(e);if(n)return t.symbol={kind:"type",name:e,symbol:n},{kind:"type",name:e,symbol:n};let s=this.#ce([e]);if(s)return t.symbol={kind:"type",name:e,symbol:s},{kind:"type",name:e,symbol:s};if(e==="System"||e==="String"||Vn.has(e)||$t[e]&&this.#Ye(e))return t.symbol={kind:"type",name:e},{kind:"type",name:e};if(this.#w.get(e))return t.symbol={kind:"type",name:e},{kind:"type",name:e}}if(t.kind==="FieldAccess"){if(t.target.kind==="Name"&&Mt[t.name]===t.target.identifier&&!this.#lt(t.target.identifier)&&this.#Ye(t.target.identifier))return{kind:"type",name:t.name,qualified:!0};let e=Ls(t.target);if(e?.startsWith("java.")&&!this.#lt("java")&&!this.#ee("java")){if($t[t.name]===e&&!Mt[t.name]||e==="java.lang"&&(t.name==="Math"||t.name==="System"||t.name==="String"))return{kind:"type",name:t.name,qualified:!0};let a=e.slice(e.lastIndexOf(".")+1);if(Mt[t.name]===a&&$t[a]===e.slice(0,e.lastIndexOf(".")))return{kind:"type",name:t.name,qualified:!0};if((Cs[e]??[]).includes(t.name))return this.#o(t.target.pos,`the class ${e}.${t.name}`,!0),A}let n=this.#fn(t.target),s=n?.membersByName.get(t.name);if(n&&s&&!n.fieldsByName.has(t.name))return t.typeSymbol=s,{kind:"type",name:s.name,symbol:s}}return this.#v(t)}#Ye(t){let e=$t[t];return Mt[t]?this.#y.has(t):e==="java.lang"||this.#y.has(t)||e!==void 0&&this.#s.has(e)||this.#O.compact}#fn(t){if(t.kind==="Name"&&!this.#lt(t.identifier)&&!this.#ee(t.identifier)){let e=this.#me(t.identifier);return e&&(t.symbol={kind:"type",name:t.identifier,symbol:e}),e}if(t.kind==="FieldAccess"){let e=this.#fn(t.target),n=e?.membersByName.get(t.name);if(e&&n&&!e.fieldsByName.has(t.name))return t.typeSymbol=n,n}return null}#Ee(t,e){if(!t)return` location: class ${this.#a.displayName}`;let n=nt(t);return n.kind==="Name"&&n.symbol?.kind==="local"?` location: variable ${n.identifier} of type ${M(e)}`:n.kind==="Name"&&n.symbol?.kind==="field"?` location: variable ${n.identifier} of type ${M(e)}`:n.kind==="FieldAccess"&&(n.field&&n.field!=="length"||n.fieldSymbol)?` location: variable ${n.name} of type ${M(e)}`:` location: class ${M(e)}`}#ye(t,e,n){return!t.isPrivate||t.owner.topLevel===this.#a.topLevel?!0:(this.#e(e,k.cantResolve,`${n} has private access in ${t.owner.displayName}`),!1)}#_n(t){let e=nt(t.target);if(e.kind==="Super"&&e.qualifier){if(this.#v(e).tag==="error")return A;if(e.interfaceSymbol)return this.#e(e.dotPos??e.pos,k.cantResolve,`not an enclosing class: ${e.interfaceSymbol.displayName}`),A}let n=this.#Xe(t.target);if("kind"in n&&n.kind==="type"){if(n.symbol){let d=n.symbol,h=this.#je(d,t.name);return h?h.isPrivate&&h.owner!==d?(this.#e(t.pos,k.cantResolve,`${h.name} has private access in ${h.owner.displayName}`),A):h.isStatic?this.#ye(h,t.pos,h.name)?(t.fieldSymbol=h,this.#mn(t,h)):A:(this.#Wt(t.pos,`non-static variable ${h.name} cannot be referenced from a static context`),A):(this.#e(t.pos,k.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`,` location: class ${d.displayName}`]),A)}if(n.name==="System")return t.name==="out"||t.name==="err"?(t.field=t.name==="out"?"System.out":"System.err",Gi):t.name==="in"?(t.field="System.in",dt(Xt("InputStream"))):(this.#e(t.pos,k.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`," location: class System"]),A);let a=Object.hasOwn(ws,n.name)?ws[n.name]:{},o=Object.hasOwn(a,t.name)?a[t.name]:void 0;if(o)return t.constant=o.constant,o.type;let c=$t[n.name]?n.qualified?se(n.name)??null:this.#et([n.name]):n.name==="String"&&!n.symbol?Xt("String"):null,u=c?.staticFields&&Object.hasOwn(c.staticFields,t.name)?c.staticFields[t.name]:void 0;return c&&u?(t.libraryField=`${c.name}.${t.name}`,u):(this.#o(t.pos,`the field ${n.name}.${t.name}`,!0),A)}let s=n,r=s.tag==="typevar"&&s.symbol?s.symbol.bounds.find(a=>a.tag==="class")??H:s;switch(r.tag){case"error":return A;case"class":{let a=this.#je(r.symbol,t.name);if(a)return a.isPrivate&&a.owner!==r.symbol?(this.#e(t.pos,k.cantResolve,`${a.name} has private access in ${a.owner.displayName}`),A):this.#ye(a,t.pos,a.name)?(t.fieldSymbol=a,this.#mn(t,a,a.isStatic?void 0:s)):A;break}case"library":{let a=r.symbol.instanceFields;if(a&&Object.hasOwn(a,t.name))return t.libraryField=`${r.symbol.name}#${t.name}`,a[t.name];break}case"null":return this.#e(t.pos,k.cantResolve,"<null> cannot be dereferenced"),A;case"array":if(t.name==="length")return t.field="length",U;break;default:if(Z(s)||s.tag==="void")return this.#e(t.pos,k.cantResolve,`${M(s)} cannot be dereferenced`),A}return this.#e(t.pos,k.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`,this.#Ee(t.target,s),...Dt([s])]),A}#se(t){return t.map(e=>{let n=nt(e);if(n.kind==="MethodRef")return{tag:"lambda",arity:this.#Ve(n)?.params.length??-1,text:bs(n)};if(n.kind==="Lambda")return{tag:"lambda",arity:n.params.length,text:bs(n)};let s=this.#Un(e);if(s)return this.#A.add(e),{tag:"diamond",symbol:s,fromArgs:null};let r=n.kind==="NewObject"&&n.body&&n.classType.kind==="ClassType"&&n.classType.diamond?this.#et(n.classType.names):null;if(r)return this.#A.add(e),{tag:"diamond",symbol:r,fromArgs:null};this.#bt=e;let a=this.#Z(e),o=this.#Et.get(n);if(!o||a.tag!=="library"||n.kind!=="MethodCall")return a;let c=new Map;return this.#re(o.method,o.types,c),{...a,args:a.args.map((u,d)=>{let h=o.method.returnType.tag==="library"?o.method.returnType.args[d]:void 0;if(!o.flags[d]||h?.tag!=="typevar")return u;let m=xn([h],o.symbol,va(o.symbol,o.method,o.types.length));return{tag:"wildcard",bound:u,poly:{name:h.name,lows:c.get(h.name)??[],where:m}}})}})}#Un(t){if(t.kind!=="MethodCall")return null;let e;if(t.target){let a=Ce(t.target);if(!a||this.#lt(a[0])||this.#ee(a[0]))return null;e=a.length===2&&Mt[a[1]]===a[0]&&this.#Ye(a[0])?se(a[1])??null:this.#et(a)}else{let a=this.#n.size||this.#g.length?this.#f(t.name,this.#rt):[];if(a.length!==1||this.#Lt(t.name))return null;e=this.#zt(a[0])}if(!e)return null;let n=e.methods.filter(a=>a.name===t.name&&a.isStatic);if(!n.length||n.some(a=>!a.typeParams?.length))return null;let s=n[0].returnType;return s.tag!=="library"||n.some(a=>a.returnType.tag!=="library"||a.returnType.symbol!==s.symbol)?null:t.args.length===0||t.args.some(a=>{let o=nt(a);return o.kind==="Lambda"&&o.params.some(c=>!c.type)||o.kind==="MethodRef"&&(!this.#Ve(o)||this.#yn(o))||this.#Un(o)!==null})?s.symbol:null}#Ae(t){for(let e of t)this.#A.has(e)&&(this.#A.delete(e),e.type=this.#v(e))}#Ut(t,e){return`${t}(${e.map(M).join(",")})`}#lr(t,e,n=he(t)){let s=this.#kt(t,e).map(a=>{let o=c=>a.isStatic?c:$e(Oe(n,a.owner,c));return{owner:a.owner.displayName,name:a.name,params:a.params.map(o),returnType:o(a.returnType),method:a,...Sa(a)?{varargs:!0}:{}}}),r=Le[e];return r&&Object.hasOwn(Le,e)&&!s.some(a=>a.params.length===r.params.length&&a.params.every((o,c)=>et(o,r.params[c])))&&s.push(r),s}#pn(t,e,n){return!t.builtin||t.constructors.some(s=>s.params.length===e)?!1:(this.#o(n,`this ${t.name} constructor`,!0),!0)}#cr(t,e){if(!this.#jt(X(t)))return null;let n=this.#kt(t,e.name);return(e.name==="getStackTrace"||e.name==="setStackTrace")&&!n.length?`the method Throwable.${e.name}()`:e.name==="printStackTrace"&&e.args.length&&!n.some(r=>r.params.length===e.args.length)?"printStackTrace to a stream":Ho[t.binaryName]?.includes(e.name)&&!n.length?`the method ${t.name}.${e.name}()`:null}#Be(t,e){let n=t.isEnum?"enum":t.isRecord?"record":"class",s=e?.tag==="class"?Rn(e):new Map,r=e!==void 0&&Jn(e);return t.constructors.map(a=>({owner:t.displayName,ownerKind:n,name:t.name,params:a.params.map(o=>r?K(o):Vt(o,s)),returnType:Tt,method:a,...Sa(a)?{varargs:!0}:{}}))}#Ie(t,e){if(!t.expanded||!t.method)return;let n=t.params[t.params.length-1],s=n.element;return!wn(n)&&!this.#At(t.method.declaration.modifiers,"SafeVarargs")&&this.#st(e,"unchecked",`unchecked generic array creation for varargs parameter of type ${M(n)}`,Dt([n])),{from:t.params.length-1,element:s}}#ur(t,e,n,s,r,a){let o=t.method?.typeParams;if(!o)return t;let c=o.map(h=>h.key),u=new Map,d=new Map;if(n){if(n.length!==o.length)return{...t,shown:t.params,problem:{reason:`wrong number of type arguments; required ${o.length}`,alone:!0}};o.forEach((h,m)=>u.set(h.key,n[m]))}else{ba(c,xa(t,e),e,u,d);let h=[...d.keys()].filter(m=>!u.has(m));for(let[m,p]of d)u.has(m)||u.set(m,p.reduce(vr));if(s&&(t.returnType.tag==="library"||t.returnType.tag==="class")){let m=new Map;yt(t.returnType,s,m);for(let p of h){let b=m.get(p);!b||b===jn||b.tag==="wildcard"||b.tag==="typevar"&&!b.symbol||d.get(p).every(S=>z(S,b))&&u.set(p,b)}}r.forEach((m,p)=>{let b=nt(m),S=b.kind==="MethodRef"&&t.params[p]?Is(Vt(t.params[p],u)):null;if(!S||b.kind!=="MethodRef")return;let v=this.#Ve(b,S.params[0]&&!le(S.params[0],c)?S.params[0]:void 0);v&&(v.params.forEach((x,C)=>S.params[C]&&yt(S.params[C],zt(x)??x,u)),v.returnType.tag!=="void"&&yt(S.returnType,zt(v.returnType)??v.returnType,u))}),a&&o.some(m=>!u.has(m.key))&&this.#hr(t.params,r,u,c),s&&t.returnType.tag!=="void"&&o.some(m=>!u.has(m.key))&&yt(t.returnType,s,u);for(let m of o){let p=u.get(m.key);if(!p||m.bounds.every(x=>z(p,Vt(x,u))))continue;let b=d.get(m.key)??[p],S=`inference variable ${m.name} has incompatible bounds`,v=b.length>1&&m.bounds.some(x=>le(x,[m.key]))?[S,` equality constraints: ${b.map(M).join(",")}`,` lower bounds: ${[...b].reverse().map(M).join(",")}`]:[S,` upper bounds: ${m.bounds.map(M).join(",")}`,` lower bounds: ${b.map(M).join(",")}`];return{...t,shown:t.params,problem:{reason:v.join(`\n`)}}}}for(let h of o)u.has(h.key)||u.set(h.key,K(ke(h)));return{...t,shown:t.params,params:t.params.map(h=>Vt(h,u)),returnType:Vt(t.returnType,u)}}#hr(t,e,n,s){let r=a=>le(a,s.filter(o=>!n.has(o)));e.forEach((a,o)=>{let c=nt(a);if(!t[o])return;if(c.kind==="MethodRef"&&c.name==="new"&&!c.arrayType&&c.target){let m=this.#Ze(Vt(t[o],n)),p=Ce(c.target),b=p&&!this.#lt(p[0])?this.#et(p):null;b&&!("problem"in m)&&!m.params.some(r)&&r(m.returnType)&&yt(m.returnType,{tag:"library",symbol:b,args:b.typeParams.map(()=>H)},n);return}if(c.kind!=="Lambda"||c.method)return;let u=Vt(t[o],n),d=this.#Ze(u);if("problem"in d||d.params.some(r)||!r(d.returnType))return;this.#Tn(c,u,s.filter(m=>!n.has(m)));let h=c.method?.returnType;h&&h.tag!=="error"&&h.tag!=="void"&&yt(d.returnType,zt(h)??h,n)})}#dr(t){let e=0;for(let n=this.#a;n;n=n.outer,e++)if(this.#kt(n,t).length||Object.hasOwn(Le,t))return{owner:n,hops:e};return{owner:this.#a,hops:0}}#mr(t,e){return t.tag!=="class"?null:Ie(t).find(n=>n.symbol.methods.some(s=>s.name===e&&!s.isStatic))??null}#fr(t,e){let n=null,s=t.target===null?this.#se(t.args):null;if(s&&(this.#n.size||this.#g.length)&&!s.some(m=>m.tag==="error")&&!this.#G(t,s))return A;t.target&&(n=this.#Xe(t.target));let r=s??this.#se(t.args);if(r.some(m=>m.tag==="error")||n&&"tag"in n&&n.tag==="error")return A;let a=t.typeArguments?t.typeArguments.map(m=>this.#_e(m)):null;if(a?.some(m=>m.tag==="error"))return A;let o=n;if(n&&"tag"in n&&n.tag==="typevar"&&n.symbol){let m=b=>b.tag==="class"&&this.#kt(b.symbol,t.name).length>0||b.tag==="library"&&b.symbol.methods.some(S=>S.name===t.name),p=n.symbol.bounds.find(m)??(Object.hasOwn(Le,t.name)?H:null);if(!p)return this.#e(t.selectPos,k.cantResolve,"cannot find symbol",[` symbol: method ${this.#Ut(t.name,r)}`,this.#Ee(t.target,n),...Dt([n,...r])]),A;n=p}if(t.name==="getClass"&&!r.length&&(n===null||"tag"in n)&&!(n===null&&this.#kt(this.#a,"getClass").length))return this.#Dn(t,n);let c=n===null?this.#a.isEnum:"tag"in n&&n.tag==="class"&&n.symbol.isEnum;if(t.name==="getDeclaringClass"&&!r.length&&c){let m=this.#Dn(t,n);return t.libraryCall&&(t.libraryCall.native="Enum.getDeclaringClass",t.libraryCall.display=`${n?.symbol.binaryName??this.#a.binaryName}.getDeclaringClass()`),m}let u=n!==null&&"kind"in n&&n.symbol!==void 0,d=n!==null&&"tag"in n&&n.tag==="class";if(!n||u||d){let m,p=0;if(n?m=n.symbol:{owner:m,hops:p}=this.#dr(t.name),Es.has(t.name)&&!this.#kt(m,t.name).length)return this.#o(t.selectPos,`the method Object.${t.name}()`,!0),A;let b=this.#cr(m,t);if(b)return this.#o(t.selectPos,b,!0),A;let S=d?o:he(m),v=this.#lr(m,t.name,S),x=v.map(P=>this.#ur(P,r,a,e,t.args,v.length===1)),C=t.target?nt(t.target):null,E=C?.kind==="Super"?C.interfaceSymbol:void 0;if(!x.length&&E)return this.#e(t.selectPos,k.cantResolve,"cannot find symbol",[` symbol: method ${this.#Ut(t.name,r)}`]),A;let R=P=>P.params.length===r.length&&P.params.every((j,G)=>re(j,r[G])||Qe(j,r[G]))||P.varargs===!0&&r.length>=P.params.length-1,L=!u&&!E&&!x.some(R)?this.#mr(S,t.name):null;if(L){if(!n){if(p>0)return this.#o(t.selectPos,"calling an enclosing class\'s library methods by simple name",!0),A;if(this.#_)return this.#Wt(t.selectPos,`non-static method ${t.name}(${L.symbol.methods.find(j=>j.name===t.name).params.map(M).join(",")}) cannot be referenced from a static context`),A;let P={kind:"This",depth:0,pos:t.pos,start:t.pos,end:t.pos};this.#v(P),t.target=P}return this.#Oe(t,L.symbol,L,r,e)}if(!x.length){let P=this.#Ls(m,t.name);if(P)return this.#e(t.selectPos,k.cantResolve,`${t.name}(${P.params.map(M).join(",")}) has private access in ${P.owner.displayName}`),A;if(!n&&this.#Ot(t.name,t.selectPos))return A;let j=u?` location: class ${m.displayName}`:n?this.#Ee(t.target,n):` location: class ${this.#a.displayName}`;return this.#e(t.selectPos,k.cantResolve,"cannot find symbol",[` symbol: method ${this.#Ut(t.name,r)}`,j,...Dt([...d?[n]:[],...r])]),A}let I=this.#it({pos:t.selectPos,name:t.name,args:t.args,callPos:t.pos},x,r,"method");if(!I)return A;let N=I.method?I.method.isStatic:!1;if(E&&N)return this.#e(t.pos,k.cantResolve,"illegal static interface method call",[` the receiver expression should be replaced with the type qualifier \'${E.displayName}\'`]),A;let J=u||!n&&(this.#_||!this.#Ge(p));if(!N&&J)return this.#Wt(t.selectPos,`non-static method ${t.name}(${I.params.map(M).join(",")}) cannot be referenced from a static context`),A;if(!N&&!n&&this.#qt(),!N&&!n&&this.#R&&p===0)return this.#o(t.selectPos,"calling the object\'s methods in the arguments of \'this(...)\'"),A;let D=t.target!==null&&nt(t.target).kind==="Super";if(I.method){if(!this.#ye(I.method,t.selectPos,`${t.name}(${I.params.map(M).join(",")})`))return A;if(D&&I.method.isAbstract)return this.#e(t.selectPos,k.syntax,`abstract method ${this.#Ft(I.method)} in ${I.method.owner.displayName} cannot be accessed directly`),A;if(u&&I.method.isStatic&&I.method.owner.isInterface&&I.method.owner!==m)return this.#e(t.selectPos,k.cantResolve,"cannot find symbol",[` symbol: method ${this.#Ut(t.name,r)}`,` location: class ${m.displayName}`]),A;this.#ie(t.args,I.params),t.method=I.method;let P=this.#Ie(I,t.pos);P&&(t.varargs=P);let j=I.method.params;d&&Jn(o)&&j.some(G=>Yn([G]).some(tt=>tt.ofClass))&&this.#st(t.pos,"unchecked",`unchecked call to ${this.#Ft(I.method)} as a member of the raw type ${M(o)}`,Dt(j)),this.#Bn(t.pos,`method ${t.name} in ${m.isInterface?"interface":"class"} ${m.displayName}`,j,I.params,r,t.args,Dt),this.#Qe(t.args,j.map(K)),t.qualifier=I.method.isStatic?I.method.owner.binaryName:m.binaryName}else t.objectMethod=I.objectMethod,t.qualifier=m.isInterface&&!D?m.binaryName:"Object";return D&&(t.isSuper=!0),!n&&p>0&&!N&&(t.outerHops=p),I.method&&Ta(t,I.method.returnType,I.returnType),I.returnType}if("kind"in n&&n.name==="IO")return this.#Ar(t,r);if("kind"in n&&n.name==="Math"&&Object.hasOwn(Hn,t.name))return this.#Er(t,r);if("kind"in n&&!n.symbol&&(n.name==="Math"||n.name==="String"))return this.#Oe(t,Xt(n.name),null,r,e);if("kind"in n&&this.#w.has(n.name))return this.#o(t.target.pos,`the class ${this.#w.get(n.name)}`,!0),A;if("kind"in n&&$t[n.name]&&(n.qualified||this.#Ye(n.name)))return this.#Oe(t,se(n.name),null,r,e);if("kind"in n)return n.name==="System"&&!n.symbol?oa.has(t.name)?this.#Oe(t,Xt("System"),null,r,e):(this.#e(t.selectPos,k.cantResolve,"cannot find symbol",[` symbol: method ${this.#Ut(t.name,r)}`," location: class System"]),A):(this.#o(t.selectPos,`${n.name}.${t.name}()`,!0),A);let h=n.tag==="diamond"?this.#gn(n):n;switch(h.tag){case"null":return this.#e(t.selectPos,k.cantResolve,"<null> cannot be dereferenced"),A;case"printstream":return this.#$r(t,h,r);case"library":return this.#Oe(t,h.symbol,h,r,e);case"string":{let m=Object.hasOwn(Gn,t.name)?Gn[t.name]:void 0;if(m){let p=this.#it({pos:t.selectPos,name:t.name},[m],r,"method");return p?(t.stringMethod=t.name,p.returnType):A}if(Do.has(t.name)){let p=Xt("String");return this.#Oe(t,p,dt(p),r,e)}break}case"object":case"array":{let m=Object.hasOwn(Le,t.name)?Le[t.name]:void 0;if(m){let p=this.#it({pos:t.selectPos,name:t.name},[m],r,"method");return p?(t.objectMethod=p.objectMethod,t.qualifier="Object",nt(t.target).kind==="Super"&&(t.isSuper=!0),p.returnType):A}if(h.tag==="array"&&t.name==="clone"&&!r.length)return Xt("String"),t.libraryCall={native:"Array.clone()",isStatic:!1,params:[],returnsValue:!0,display:`${Rt(h)}.clone()`},h;if(Es.has(t.name)||h.tag==="array"&&Fo.has(t.name))return this.#o(t.selectPos,h.tag==="array"?`the array method ${t.name}()`:`the method Object.${t.name}()`,!0),A;break}default:if(Z(h)||h.tag==="void")return this.#e(t.selectPos,k.cantResolve,`${M(h)} cannot be dereferenced`),A}return this.#e(t.selectPos,k.cantResolve,"cannot find symbol",[` symbol: method ${this.#Ut(t.name,r)}`,this.#Ee(t.target,h)]),A}#Oe(t,e,n,s,r){let a=n?n.args:[],o=n!==null&&!n.args.length&&e.typeParams.length>0,c=e.methods.filter(D=>D.name===t.name);if(!c.length&&(e.unsupported.has(t.name)||Es.has(t.name)))return this.#o(t.selectPos,`the ${e.name} method ${t.name}()`,!0),A;if(!c.length){let D=n?this.#Ee(t.target,n):` location: class ${e.name}`;return this.#e(t.selectPos,k.cantResolve,"cannot find symbol",[` symbol: method ${this.#Ut(t.name,s)}`,D]),A}let u=t.typeArguments?t.typeArguments.map(D=>this.#_e(D)):null,d=D=>u!==null&&u.length===(D.typeParams?.length??0)&&u.length>0,h=c.map(D=>{let P=[...D.isStatic?[]:e.typeParams,...D.typeParams??[]],j=u&&u.length===(D.typeParams?.length??0)?u:this.#yr(D,s),G=[...D.isStatic?[]:a.map(ll),...j],tt=[...D.isStatic?[]:a.map($e),...j],Wt=o&&!D.isStatic;return{owner:D.owner,name:D.name,params:D.params.map(be=>Wt?K(be):St(be,P,G)),returnType:Wt?K(D.returnType):St(D.returnType,P,tt),library:D,...D.varargs?{varargs:!0}:{}}}),m=this.#it({pos:t.selectPos,name:t.name,imported:la(t),args:t.args,callPos:t.pos},h,s,"method");if(!m)return A;let p=m.library,b=this.#re(p,s),S=!o&&s.some((D,P)=>p.params[P]!==void 0&&Qe(p.params[P],D));if(p.comparableParams&&!S&&p.comparableParams.some(D=>b.has(D)&&!Aa(b.get(D))))return this.#o(t.selectPos,`${e.name}.${t.name}() of elements that are not Comparable`,!0),A;if(!p.native)return this.#o(t.selectPos,`${e.name}.${t.name}(${p.params.map(Me).join(", ")})`,!0),A;if(!p.isStatic&&!n)return this.#e(t.selectPos,k.cantResolve,`non-static method ${t.name}(${m.params.map(M).join(",")}) cannot be referenced from a static context`),A;let v=!o&&p.typeParams?.length&&!d(p)&&t.args.some(D=>["Lambda","MethodRef"].includes(nt(D).kind)||this.#A.has(D)),x=t.args.filter(D=>this.#A.has(D)),C=v?this.#pr(p,e,a,t.args,s,r,m.params):null,E=!v&&p.isStatic&&p.typeParams?.length&&!d(p)&&r?this.#Vn(t,e,p,s,r):null;if(!v&&!r&&p.isStatic&&p.typeParams?.length&&!d(p)&&p.returnType.tag==="library"){let D=new Map;this.#re(p,s,D);let P=p.returnType.args.map(j=>j.tag==="typevar"&&!j.symbol&&D.has(j.name));P.some(Boolean)&&this.#Et.set(t,{flags:P,symbol:e,method:p,types:s})}if(E==="error")return A;let R=E?p.typeParams.map(D=>E.get(D)??H):[];E&&(m.params=m.params.map((D,P)=>St(p.params[Math.min(P,p.params.length-1)],p.typeParams,R))),this.#ie(t.args,C?C.params:m.params);let L=t.target?nt(t.target).kind:null;if(p.isProtected&&!(L==="This"||L==="Super"))return this.#e(t.selectPos,k.cantResolve,`${p.name}(${p.params.map(M).join(",")}) has protected access in ${e.name}`,xn(p.params,e,p)),A;t.libraryCall=this.#He(p,n??dt(e),m.params),u||(t.libraryMethod={method:p,symbol:e,classArgs:a}),m.expanded&&(t.libraryCall.varargsFrom=m.params.length-1),L==="Super"&&(t.libraryCall.onBase=!0);let I=D=>xn(D,e,p);if(o&&!p.isStatic&&p.params.some(D=>le(D,null))&&this.#st(t.pos,"unchecked",`unchecked call to ${p.name}(${p.params.map(M).join(",")}) as a member of the raw type ${e.name}`,I(p.params)),this.#Bn(t.pos,`method ${p.name} in ${e.isInterface?"interface":"class"} ${e.name}`,p.params,m.params,s,t.args,I),this.#Qe(t.args,p.params.map(K)),o)return $e(m.returnType);if(S)return K(p.isStatic?p.returnType:Yt(p.returnType,e.typeParams,a));let N=d(p)?m.returnType:E?St(p.returnType,p.typeParams,R):C?.returnType??this.#Hn(p,e,a,s,r)??m.returnType;if(p.typeParams?.length&&x.length&&!d(p)){let D=new Map(C?.bound??this.#re(p,s)),P=p.isStatic?p.returnType:Yt(p.returnType,e.typeParams,a);if(r?.tag==="library"&&P.tag==="library"){let j=Pt(P,r.symbol);j&&j.args.forEach((G,tt)=>fe(r.args[tt])&&yt(G,fe(r.args[tt]),D))}t.args.forEach((j,G)=>x.includes(j)&&j.type&&yt(p.params[Math.min(G,p.params.length-1)],j.type,D)),N=this.#Hn(p,e,a,s,r,D)??N}let J=N.tag==="typevar"&&!N.symbol?H:$e(N);return p.returnType.tag==="typevar"&&al(J)&&(t.genericCast=K(J)),J}#Bn(t,e,n,s,r,a,o){let c=r.map((u,d)=>s[d]!==void 0&&(!re(s[d],u)||n[d]!==void 0)&&Qe(n[d]??s[d],u));c.some(Boolean)&&(this.#st(t,"unchecked",`unchecked method invocation: ${e} is applied to given types`,[` required: ${n.map(M).join(",")}`,` found: ${r.map(M).join(",")}`,...o([...n,...r])]),c.forEach((u,d)=>{u&&this.#st(a[d].pos,"unchecked","unchecked conversion",[` required: ${M(n[d])}`,` found: ${M(r[d])}`,...o([n[d],r[d]])])}))}#Qe(t,e){t.forEach((n,s)=>{e[Math.min(s,e.length-1)]?.tag==="object"&&delete nt(n).genericCast})}#pr(t,e,n,s,r,a,o){let c=t.typeParams,u=I=>t.isStatic?I:Yt(I,e.typeParams,n),d=I=>u(t.params[Math.min(I,t.params.length-1)]),h=this.#re(t,r),m=I=>le(I,c.filter(N=>!h.has(N))),p=(I,N)=>{let J=N.params[0]&&!m(N.params[0])?N.params[0]:void 0;if(!J&&this.#yn(I))return!1;let D=this.#Ve(I,J);return D&&(D.params.forEach((P,j)=>N.params[j]&&yt(N.params[j],P,h)),D.returnType.tag!=="void"&&yt(N.returnType,zt(D.returnType)??D.returnType,h)),!0},b=[];s.forEach((I,N)=>{let J=nt(I),D=Is(d(N));D&&(J.kind==="MethodRef"?p(J,D)||b.push(N):J.kind==="Lambda"&&J.params.length&&J.params.every(P=>P.type)&&J.params.forEach((P,j)=>{let G=this.#V(P.type);G.tag!=="error"&&D.params[j]&&yt(D.params[j],G,h)}))});let S=u(t.returnType);if(a?.tag==="library"&&S.tag==="library"){let I=Pt(S,a.symbol);I&&I.args.forEach((N,J)=>fe(a.args[J])&&yt(N,fe(a.args[J]),h))}for(let I of b){let N=c.filter(D=>h.has(D)),J=Is(Yt(d(I),N,N.map(D=>h.get(D))));J&&p(nt(s[I]),J)}let v=()=>c.filter(I=>h.has(I)),x=I=>Yt(d(I),v(),v().map(N=>h.get(N)));s.forEach((I,N)=>{this.#A.has(I)&&(this.#A.delete(I),I.type=this.#v(I,x(N)),I.type.tag!=="error"&&yt(d(N),I.type,h))});let C=new Map;s.forEach((I,N)=>{let J=nt(I);if(J.kind==="Lambda"?J.method:J.kind!=="MethodRef"||J.lambda)return;let D=x(N),P=Is(D);if(!P||P.params.some(m)||!m(P.returnType))return;let j;J.kind==="Lambda"?(this.#Tn(J,D,!0),j=J.method?.returnType):J.kind==="MethodRef"&&(this.#Kn(J,D,!0),j=J.lambda?.method?.returnType),j?.tag==="diamond"&&P.returnType.tag==="typevar"?C.set(P.returnType.name,j):j&&j.tag!=="error"&&j.tag!=="void"&&yt(P.returnType,zt(j)??j,h)});for(let[I,N]of C){if(h.has(I))continue;let J=t.typeParamBounds?.[I],D=c.filter(G=>h.has(G)),P=J?Yt(u(J),D,D.map(G=>h.get(G))):void 0,j=Os(N.symbol,P);h.set(I,dt(N.symbol,N.symbol.typeParams.map(G=>j.get(G)??H)))}let E=c.map(I=>h.get(I)??H),R=I=>St(u(I),c,E);return{params:o.map((I,N)=>R(t.params[Math.min(N,t.params.length-1)])),returnType:R(t.returnType),bound:h}}#yn(t){if(!t.target||t.name==="new"||t.arrayType)return!1;let e=Ce(t.target);if(!e||this.#lt(e[0])||this.#ee(e[0]))return!1;let n=this.#pe(e);return n!==null&&(n.typeParams?.length??0)>0&&this.#kt(n,t.name).some(s=>!s.isStatic)}#Ve(t,e){if(t.arrayType){let c=this.#V(t.arrayType);return c.tag==="error"?null:{params:[U],returnType:c}}if(!t.target||t.name==="new")return null;let n=Ce(t.target);if(!n||this.#lt(n[0])||this.#ee(n[0]))return null;let s=this.#pe(n);if(s){let c=this.#kt(s,t.name);if(c.length!==1||c[0].declaration.params.some(d=>d.varargs)||c[0].typeParams?.length)return null;let u=c[0];if(u.isStatic)return{params:u.params,returnType:u.returnType};if(s.typeParams?.length&&e){let d=Zt(e,s);if(!d?.args?.length)return null;let h=m=>$e(Oe(d,u.owner,m));return{params:[d,...u.params.map(h)],returnType:h(u.returnType)}}return{params:[X(s),...u.params],returnType:u.returnType}}if(n.length===1&&n[0]==="String"){if(Object.hasOwn(Gn,t.name))return{params:[ut,...Gn[t.name].params],returnType:Gn[t.name].returnType};let c=Xt("String").methods.filter(u=>u.name===t.name);return c.length!==1||c[0].varargs?null:{params:c[0].isStatic?c[0].params:[ut,...c[0].params],returnType:c[0].returnType}}let r=this.#et(n);if(!r)return null;let a=r.methods.filter(c=>c.name===t.name);if(a.length!==1||a[0].varargs||a[0].typeParams?.length||r.typeParams.length)return null;let o=a[0];return{params:o.isStatic?o.params:[dt(r),...o.params],returnType:o.returnType}}#re(t,e,n){let s=new Map,r=new Map,a=(u,d)=>{if(u.tag==="typevar"&&!u.symbol&&t.typeParams?.includes(u.name)&&d&&d.tag!=="wildcard"){if(d.tag==="null"||d.tag==="diamond"||d.tag==="lambda"||d.tag==="error"||d.tag==="typevar"&&!d.symbol)return;let h=Q(d)?Er(d):zt(d);h&&r.set(u.name,[...r.get(u.name)??[],h]);return}yt(u,d,s)},o=t.params,c=t.varargs?o.length-1:o.length;for(let u=0;u<c;u++)a(o[u],e[u]);if(t.varargs){let u=o[o.length-1],d=e.slice(c);if(d.length===1&&d[0].tag==="array"&&Q(d[0].element))yt(u,d[0],s);else for(let m of d)a(u.element,m)}for(let[u,d]of r)s.has(u)||(s.set(u,d.reduce(vr)),n?.set(u,d));return s}#Vn(t,e,n,s,r,a=!1){let o=n.returnType;if(r.tag!=="library"||o.tag!=="library")return null;let c=Pt(o,r.symbol);if(!c)return null;let u=new Map,d=this.#re(n,s,u),h=!1;for(let[m,p]of c.args.entries()){let b=r.args[m];if(p.tag!=="typevar"||p.symbol||!u.has(p.name)||!b||b.tag==="wildcard"||b.tag==="typevar"&&!b.symbol)continue;let S=u.get(p.name);if(S.some(v=>!z(v,b))){if(a)return null;let v=S.filter((x,C)=>S.findIndex(E=>et(E,x))===C);return this.#e(t.pos,k.incompatibleTypes,`incompatible types: inference variable ${p.name} has incompatible bounds`,[` equality constraints: ${M(b)}`,` lower bounds: ${[...v].reverse().map(M).join(",")}`,...xn([p],e,va(e,n,s.length))]),"error"}et(d.get(p.name),b)||(d.set(p.name,b),h=!0)}return h?d:null}#yr(t,e){if(!t.typeParams)return[];let n=this.#re(t,e);return t.typeParams.map(s=>n.get(s)??H)}#Hn(t,e,n,s,r,a){if(!t.typeParams)return null;let o=a??this.#re(t,s),c=t.isStatic?t.returnType:Yt(t.returnType,e.typeParams,n);if(t.typeParams.every(m=>o.has(m)))return a?St(c,t.typeParams,t.typeParams.map(m=>o.get(m))):null;if(r?.tag==="library"&&c.tag==="library"){let m=Pt(c,r.symbol);m&&m.args.forEach((p,b)=>fe(r.args[b])&&yt(p,fe(r.args[b]),o))}r&&c.tag==="typevar"&&!c.symbol&&t.typeParams.includes(c.name)&&!o.has(c.name)&&Q(r)&&o.set(c.name,r);let u=t.typeParams.map(m=>o.get(m)??H),d=St(c,t.typeParams,u),h=t.typeParams.filter(m=>!o.has(m));if(!r&&h.length&&c.tag==="library"&&c.args.some(m=>m.tag==="typevar"&&h.includes(m.name))){let m=c.args.every(p=>p.tag==="typevar"&&h.includes(p.name))?null:d.args;return{tag:"diamond",symbol:c.symbol,fromArgs:m}}return d}#He(t,e,n){let s=e.tag==="library"?ga(e.symbol):M(e),r=t.name==="<init>"?"<init>":t.name,a=t.isStatic||t.name==="<init>"?0:1,o=0;return t.params.forEach((c,u)=>{(c.tag==="library"&&!c.symbol.functional&&c.symbol.name!=="Comparator"||t.name==="equals"&&u===0)&&(o|=1<<u+a)}),{...o?{unwrap:o,unwrapCalls:Bo[t.native]??Vo}:{},native:t.native,isStatic:t.isStatic,params:n,returnsValue:t.name==="<init>"||t.returnType.tag!=="void",display:`${s}.${r}(${t.params.map(Me).join(", ")})`,...t.throws?{throws:t.throws}:{}}}#gn(t){return dt(t.symbol,t.fromArgs??t.symbol.typeParams.map(()=>H))}#ie(t,e){t.forEach((n,s)=>{let r=nt(n),a=r.kind==="MethodCall"?this.#Et.get(r):void 0;if(a&&r.kind==="MethodCall"){this.#Et.delete(r);let d=e[Math.min(s,e.length-1)],h=d?this.#Vn(r,a.symbol,a.method,a.types,d,!0):null;if(h&&h!=="error"){let m=a.method.typeParams.map(b=>h.get(b)??H),p=St(a.method.returnType,a.method.typeParams,m);r.type=p,n!==r&&(n.type=p),r.libraryCall&&(r.libraryCall.params=r.libraryCall.params.map((b,S)=>St(a.method.params[Math.min(S,a.method.params.length-1)],a.method.typeParams,m)))}return}if(this.#A.has(n)){this.#A.delete(n),n.type=this.#v(n,e[Math.min(s,e.length-1)]);return}let o=nt(n).kind;if(o==="Lambda"||o==="MethodRef"){this.#v(n,e[s]);return}if(n.kind==="NewObject"&&n.openDiamond){let{symbol:d,bound:h}=n.openDiamond;delete n.openDiamond;let m=xr(d,e[Math.min(s,e.length-1)]);n.type=X(d,d.typeParams.map(p=>h.get(p.key)??m.get(p.key)??K(ke(p))));return}let c=n.type;if(c?.tag!=="diamond")return;let u=Os(c.symbol,e[s]);n.type=dt(c.symbol,c.symbol.typeParams.map((d,h)=>u.get(d)??c.fromArgs?.[h]??H))})}#bn(t,e,n){let s=t.symbol,r=s.constructors.map(c=>({owner:s.name,name:s.name,params:c.params.map(u=>St(u,s.typeParams,t.args)),returnType:Tt,library:c,...c.varargs?{varargs:!0}:{}})),a=this.#it({pos:n,name:s.name},r,e,"constructor");if(!a)return null;let o=a.library;return o.native?a.expanded?(this.#o(n,`a variable-arity constructor of ${s.name} as a superclass constructor`,!0),null):{candidate:a,call:this.#He({...o,name:"<init>"},dt(s),a.params)}:(this.#o(n,`the constructor ${s.name}(${o.params.map(Me).join(", ")})`,!0),null)}#gr(t,e,n){let s=e.tag==="library"||e.tag==="diamond"?e.symbol:null;if(!s)return A;let r=this.#se(t.args);if(r.some(S=>S.tag==="error"))return A;if(s.isInterface||s.isAbstract||s.name==="Number")return this.#e(t.pos,k.cantResolve,`${s.name} is abstract; cannot be instantiated`),A;if(!s.constructors.length)return this.#o(t.pos,`creating ${Ye(s.name)} with \'new\'`,!0),A;let a=e.tag==="diamond";n===Wn&&(n=void 0);let o=a&&n?Os(s,n,!0):new Map,c=S=>{if(!a)return e.args.slice();let v=new Map(o);return S.params.forEach((x,C)=>yt(x,r[C],v)),s.typeParams.map(x=>v.get(x)??H)},u=e.tag==="library"&&!e.args.length&&s.typeParams.length>0,d=s.constructors.map(S=>{let v=c(S);return{owner:s.name,name:s.name,params:S.params.map(x=>u?K(x):St(x,s.typeParams,v)),returnType:Tt,library:S,...S.varargs?{varargs:!0}:{}}}),h=this.#it({pos:t.pos,name:s.name,args:t.args},d,r,"constructor");if(!h)return A;let m=h.library;if(!m.native)return this.#o(t.pos,`the constructor ${s.name}(${m.params.map(Me).join(", ")})`,!0),A;u&&m.params.some(S=>le(S,null))&&this.#st(t.pos,"unchecked",`unchecked call to ${s.name}(${m.params.map(M).join(",")}) as a member of the raw type ${s.name}`,xn(m.params,s)),s.box&&this.#st(t.pos,"deprecation",`${s.name}(${m.params.map(M).join(",")}) in ${s.name} has been deprecated`),this.#ie(t.args,h.params);let p=a&&r.some((S,v)=>m.params[v]!==void 0&&Qe(m.params[v],S));p&&this.#st(t.pos,"unchecked",`unchecked method invocation: constructor <init> in class ${s.name} is applied to given types`,[` required: ${m.params.map(M).join(",")}`,` found: ${r.map(M).join(",")}`,...xn([...m.params,...r],s)]);let b;if(p)b=dt(s);else if(!a)b=e;else{let S=new Map(o);m.params.forEach((C,E)=>yt(C,r[E],S));let v=s.typeParams.every(C=>S.has(C)),x=s.typeParams.map(C=>S.get(C)??H);b=v||n?dt(s,x):{tag:"diamond",symbol:s,fromArgs:s.typeParams.some(C=>S.has(C))?x:null}}return t.libraryCall=this.#He({...m,name:"<init>"},dt(s),h.params),h.expanded&&(t.libraryCall.varargsFrom=h.params.length-1),b}#br(t,e){if(e.length)return this.#e(t.pos,k.cantResolve,"constructor Object in class Object cannot be applied to given types;",[" required: no arguments",` found: ${e.map(M).join(",")}`," reason: actual and formal argument lists differ in length"]),A;Xt("String");let n={name:"<init>",params:[],returnType:H,isStatic:!0,native:"Object.<init>()",owner:"Object"};return t.libraryCall=this.#He(n,H,[]),H}#Tr(t){let e=this.#se(t.args);if(e.some(a=>a.tag==="error"))return A;let s=Xt("String").constructors.map(a=>({owner:"String",name:"String",params:a.params,returnType:Tt,library:a})),r=this.#it({pos:t.pos,name:"String",args:t.args},s,e,"constructor");return r?(t.libraryCall=this.#He({...r.library,name:"<init>"},ut,r.params),ut):A}#Sr(t,e){if(t.body)return this.#xr(t,t.body,e);let n=this.#bt===t;this.#bt=null;let s=t.outerExpression?this.#vr(t):this.#V(t.classType);if(s.tag==="library"||s.tag==="diamond")return this.#gr(t,s,e);if(s.tag==="string")return this.#Tr(t);let r=this.#se(t.args);if(s.tag==="error"||r.some(m=>m.tag==="error"))return A;if(s.tag==="typevar")return this.#e(t.classType.pos,k.incompatibleTypes,"unexpected type",[" required: class",` found: type parameter ${s.name}`,...Dt([s])]),A;if(s.tag==="object")return this.#br(t,r);if(s.tag!=="class")return this.#o(t.pos,`creating ${Ye(M(s))} with \'new\'`,!0),A;let a=s.symbol;if(a.isEnum)return this.#e(t.pos,k.syntax,"enum classes may not be instantiated"),A;if(a.isAbstract)return this.#e(t.pos,k.cantResolve,`${a.displayName} is abstract; cannot be instantiated`),A;if(this.#pn(a,r.length,t.pos))return A;let o=t.classType.kind==="ClassType"?t.classType:null,c=o?.diamond===!0;if(c&&!a.typeParams?.length)return this.#e(o.typeArgumentsPos??t.pos,k.cantResolve,`cannot infer type arguments for ${a.displayName}`,[` reason: cannot use \'<>\' with non-generic class ${a.displayName}`]),A;let u=this.#Be(a,c?void 0:s),d=s;if(c){let m=a.typeParams,p=m.map(L=>L.key),b=xr(a,e),S=new Map;u=u.map(L=>{let I=new Map(b),N=new Map;ba(p,xa(L,r),r,I,N);for(let D of m){let P=N.get(D.key);if(!P)continue;let j=b.get(D.key);if(j&&P.some(G=>!z(G,j))){let G=[`inference variable ${D.name} has incompatible bounds`,` equality constraints: ${M(j)}`,` lower bounds: ${P.map(M).join(",")}`];return{...L,shown:L.params,problem:{reason:G.join(`\n`),diamond:!0}}}I.has(D.key)||I.set(D.key,P.reduce(vr))}let J={...L,shown:L.params,params:L.params.map(D=>Vt(D,I))};return S.set(J,I),J});let v=u.filter(L=>L.params.length===r.length),x=v.length===1&&v[0].problem?.diamond?v[0]:null;if(x){let[L,...I]=x.problem.reason.split(`\n`);return this.#e(o.typeArgumentsPos??t.pos,k.incompatibleTypes,`incompatible types: cannot infer type arguments for ${a.displayName}<>`,[` reason: ${L}`,...I.map(N=>` ${N}`),...Dt(m.map(ke))]),A}let C=this.#it({pos:t.pos,name:a.name,args:t.args},u,r,"constructor");if(!C)return A;let E=S.get(u.find(L=>L.method===C.method))??new Map;return m.filter(L=>!E.has(L.key)).length&&n&&!e?(t.openDiamond={symbol:a,bound:E},d=X(a,m.map(L=>E.get(L.key)??jn))):d=X(a,m.map(L=>E.get(L.key)??K(ke(L)))),this.#Gn(t,a,C,d)}let h=this.#it({pos:t.pos,name:a.name,args:t.args},u,r,"constructor");return h?(Jn(s)&&h.method.params.some(m=>Yn([m]).length)&&this.#st(t.pos,"unchecked",`unchecked call to ${this.#Ft(h.method).replace(/^[^(]*/,a.name)} as a member of the raw type ${a.displayName}`,Dt(h.method.params)),this.#Qe(t.args,h.method.params.map(K)),this.#Gn(t,a,h,d)):A}#xr(t,e,n){this.#bt=null;let s=e.symbol,r=this.#V(t.classType),a=this.#se(t.args);if(r.tag==="error"||a.some(C=>C.tag==="error"))return A;if(r.tag==="diamond"){let C=Os(r.symbol,n);r=dt(r.symbol,r.symbol.typeParams.map(E=>C.get(E)??H))}else if(r.tag==="class"&&t.classType.kind==="ClassType"&&t.classType.diamond&&r.symbol.typeParams?.length){let C=xr(r.symbol,n);r=X(r.symbol,r.symbol.typeParams.map(E=>C.get(E.key)??K(ke(E))))}if((r.tag==="library"||r.tag==="class")&&r.symbol.isInterface&&t.args.length)return this.#e(t.args[0].pos,k.syntax,"anonymous class implements interface; cannot have arguments"),A;let c=r.tag==="string"?"String":r.tag==="class"&&(r.symbol.isFinal||r.symbol.isEnum)?r.symbol.displayName:r.tag==="library"&&!r.symbol.isInterface&&r.symbol.box?r.symbol.name:null;if(c)return this.#e(t.classType.pos,k.syntax,`cannot inherit from final ${c}`),A;if(r.tag==="library"&&!r.symbol.isInterface){if(!ha.has(r.symbol.name))return this.#o(t.classType.pos,`extending the library class ${r.symbol.name}`,!0),A;s.librarySuperclass=r}else if(r.tag==="library"){if(!ma(r.symbol))return this.#o(t.classType.pos,`implementing the library interface ${r.symbol.name}`,!0),A;s.libraryInterfaces.push(r)}else if(r.tag==="class")if(r.symbol.isInterface)s.interfaces.push(r.symbol),s.interfaceTypes=[r];else{if(r.symbol.isInner)return this.#o(t.classType.pos,"extending an inner (non-static) class",!0),A;s.superclass=r.symbol,s.superType=r}else if(r.tag!=="object")return this.#o(t.pos,`creating ${Ye(M(r))} with \'new\'`,!0),A;if(r.tag==="class"&&r.symbol.isSealed)return this.#Re(s),A;let u=null,d=null;if(s.librarySuperclass){let C=this.#bn(s.librarySuperclass,a,t.pos);if(!C)return A;u=C.candidate,d=C.call}else if(s.superclass){if(this.#pn(s.superclass,a.length,t.pos))return A;if(u=this.#it({pos:t.pos,name:s.superclass.name},this.#Be(s.superclass,s.superType),a,"constructor"),!u)return A;if(!this.#ye(u.method,t.pos,`${s.superclass.name}(${u.method.params.map(M).join(",")})`))return A}else if(a.length)return this.#e(t.pos,k.cantResolve,"constructor Object in class Object cannot be applied to given types;",[" required: no arguments",` found: ${a.map(M).join(",")}`," reason: actual and formal argument lists differ in length"]),A;s.hierarchyState=2;let h=this.#he(),m=this.#a,p=this.#t,b=this.#p,S=this.#R;this.#Je(s);let v=this.#zn(s,u);d&&(v.superLibrary=d),this.#ze([...s.methods,...s.constructors]),this.#Rt.set(s,{scopes:h.scopes}),this.#t=null,this.#R=!1,this.#De(s),this.#de(h),this.#a=m,this.#t=p,this.#p=b,this.#R=S,u&&this.#ie(t.args,u.params),this.#Ae(t.args);let x=u?this.#Ie(u,t.pos):void 0;return x&&(t.varargs=x),s.isInner&&(t.outer=0,this.#qt()),t.ctor=v,X(s)}#zn(t,e){let n=t.declaration.pos,s=e?e.params.slice():[],r={kind:"MethodDeclaration",modifiers:{keywords:[]},returnType:{kind:"VoidType",pos:n,start:n,end:n},name:"<init>",namePos:n,params:[],body:{kind:"Block",statements:[],pos:n,start:n,end:n+1},isConstructor:!0,synthetic:!0,pos:n,start:n,end:n},a={kind:"method",name:t.binaryName.slice(t.binaryName.lastIndexOf("$")+1),owner:t,isStatic:!1,isConstructor:!0,isPrivate:!1,isAbstract:!1,isFinal:!1,access:"package",params:s,returnType:Tt,index:this.#z.length,declaration:r,locals:[],maxSlots:1+(t.isInner?1:t.enumBody?2:0)+s.reduce((o,c)=>o+Fe(c),0),throws:e?.method?.throws??[],forwardsToSuper:!0,...e?.method?{superConstructor:e.method}:{}};return r.symbol=a,this.#z.push(a),t.constructors.push(a),a}#vr(t){let e=this.#Z(t.outerExpression);if(e.tag==="error")return A;let n=t.classType,s=n.names[0];if(e.tag!=="class")return this.#o(t.pos,`\'.new\' on ${Ye(M(e))}`,!0),A;let r;for(let a=e.symbol;a&&!r;a=a.superclass)r=a.membersByName.get(s);return r?r.isInner?r.typeParams?.length||r.outer?.typeParams?.length||n.typeArguments||n.diamond?(this.#o(t.pos,"\'.new\' of a generic class, or of a generic class\'s inner class",!0),A):X(r):(this.#e(t.start,k.syntax,"qualified new of static class"),A):(this.#e(n.pos,k.cantResolve,"cannot find symbol",[` symbol: class ${s}`,` location: class ${e.symbol.displayName}`]),A)}#Gn(t,e,n,s){let r=n.method,a=this.#Ie(n,t.pos);if(a&&(t.varargs=a),!this.#ye(r,t.pos,`${e.name}(${r.params.map(M).join(",")})`))return A;if(this.#ie(t.args,n.params),e.isInner&&!t.outerExpression){let o=0;for(let u=this.#a;u&&u!==e.outer;u=u.outer)o++;let c=this.#a===e.outer||o>0&&this.#Ge(o)&&this.#Is(o)===e.outer;if(!this.#_&&!this.#R&&c&&(t.outer=o),t.outer!==void 0)this.#qt();else return this.#Wt(t.pos,"non-static variable this cannot be referenced from a static context"),A}return t.ctor=r,s}#Ze(t){if(t.tag==="library"&&t.symbol.functional){let s=t.symbol,r=s.methods.find(c=>c.name===s.functional&&!c.isStatic),a=s.typeParams.map((c,u)=>{let d=t.args[u];return d?d.tag==="wildcard"?d.bound??H:d:H}),o=c=>St(c,s.typeParams,a);return{params:r.params.map(o),returnType:o(r.returnType),iface:s.qualifiedName,samKey:r.native}}if(t.tag==="class"&&t.symbol.isInterface){let s=gs(t.symbol),r=t.symbol.displayName;if(s.length===1&&!t.symbol.isSealed){let o=s[0],c=X(t.symbol,t.args?.map(d=>$e(d))),u=d=>Oe(c,o.owner,d);return{params:o.params.map(u),returnType:u(o.returnType),iface:t.symbol.binaryName,sam:o}}let a=t.symbol.isSealed?[]:[s.length?` multiple non-overriding abstract methods found in interface ${r}`:` no abstract method found in interface ${r}`];return{problem:`${r} is not a functional interface`,details:a}}let e=t.tag==="array"?"Array":t.tag==="library"||t.tag==="diamond"?t.symbol.name:t.tag==="class"?t.symbol.displayName:M(t),n=t.tag==="library"&&t.symbol.isInterface?[` multiple non-overriding abstract methods found in interface ${t.symbol.name}`]:void 0;return{problem:`${e} is not a functional interface`,details:n}}#Tn(t,e,n=!1){if(t.method)return e??A;if(!e)return this.#e(t.pos,k.incompatibleTypes,"lambda expression not expected here"),A;if(e.tag==="error")return A;if(e.tag==="library"&&e.symbol.name==="Iterable")return this.#o(t.pos,"lambda expressions that implement Iterable"),A;let s=this.#Ze(e);if("problem"in s)return this.#e(t.pos,k.incompatibleTypes,`incompatible types: ${s.problem}`,s.details),A;if(s.params.length!==t.params.length)return this.#e(t.pos,k.incompatibleTypes,"incompatible types: incompatible parameter types in lambda expression"),A;for(let[a,o]of t.params.entries()){if(!o.type)continue;let c=this.#V(o.type);if(c.tag==="error")return A;if(!et(c,s.params[a]))return this.#e(t.pos,k.incompatibleTypes,"incompatible types: incompatible parameter types in lambda expression"),A}if(s.returnType.tag==="void"&&t.body.kind!=="Block"&&!Qo(t.body))return this.#e(t.body.pos,k.incompatibleTypes,"incompatible types: lambda body is not compatible with a void functional interface",[" (consider using a block lambda body, or use a statement expression instead)"]),A;n&&le(s.returnType,Array.isArray(n)?n:null)&&(s.returnType=Wn);let r=t.body.kind==="Block"?t.body:s.returnType.tag==="void"?{kind:"Block",statements:[{kind:"ExpressionStatement",expression:t.body,pos:t.body.pos,start:t.body.start,end:t.body.end}],pos:t.body.pos,start:t.body.start,end:t.body.end}:{kind:"Block",statements:[{kind:"ReturnStatement",value:t.body,pos:t.body.pos,start:t.body.start,end:t.body.end}],pos:t.body.pos,start:t.body.start,end:t.body.end};return this.#ge(t,s,r,[],()=>{for(let a of r.statements)this.#ne(a)}),e}#ge(t,e,n,s,r){let a=t.reference===!0,o,c=this.#p;if(a)o=`lambda$ref$${this.#z.length}`;else{c=this.#t?this.#p:this.#l?this.#l.isConstructor?"new":this.#l.name:this.#_?"static":"new";let I=this.#d.get(this.#a)??new Map;this.#d.set(this.#a,I);let N=I.get(c)??0;I.set(c,N+1),o=`lambda$${c}$${N}`}let u=[],d=new Set(t.params.map(I=>I.name));Ns(n,(I,N)=>{if(d.has(I))return;let J=this.#lt(I)??this.#Sn(I)?.local;J&&!u.some(D=>D.outer===J)&&u.push({outer:J,pos:N})});let h={keywords:[],annotations:[]},m={kind:"VoidType",pos:t.pos,start:t.pos,end:t.pos},p=t.params.map(I=>({modifiers:I.modifiers??h,type:I.type??m,name:I.name,varargs:!1,pos:I.pos,start:I.pos,end:I.pos})),b={kind:"MethodDeclaration",modifiers:h,returnType:m,name:o,namePos:t.pos,params:p,body:n,pos:t.pos,start:t.start,end:t.end},S={kind:"method",name:o,owner:this.#a,isStatic:!0,isConstructor:!1,isPrivate:!0,isAbstract:!1,isFinal:!1,access:"private",params:[...s.map(I=>I.type),...u.map(I=>I.outer.type),...e.params],returnType:e.returnType,index:this.#z.length,declaration:b,locals:[],maxSlots:0,lambda:t,throws:[],...a?{hidden:!0}:{}};b.symbol=S,this.#z.push(S),!this.#l&&!this.#t&&this.#Vt.set(this.#a,[...this.#Vt.get(this.#a)??[],S]),t.method=S,t.captures=u.map(I=>I.outer),t.capturedAt=u.map(I=>I.pos),t.functional={iface:e.iface,...e.samKey?{samKey:e.samKey}:{},...e.sam?{sam:e.sam}:{}};let v=this.#he(),x=this.#t,C=this.#p,E=this.#_;this.#t={scopes:this.#M,method:this.#l,isStatic:E,outer:this.#t},this.#p=c,this.#l=S,this.#E=null,this.#_=E,this.#M=[],this.#k=0,this.#P=[];let R=this.#D.items.length;this.#vt();let L=0;for(let I of s){let N=this.#_t(I.name,I.type,t.pos,!0,!0);N.parameter=++L}for(let I of u){let N=this.#_t(I.outer.name,I.outer.type,I.pos,!1,!0);N.parameter=++L,N.captureOf=I.outer}return p.forEach((I,N)=>{let J=this.#_t(I.name,e.params[N],I.pos,t.params[N]?.modifiers?Ht(t.params[N].modifiers,"final"):!1);J.parameter=++L,I.symbol=J}),r(),this.#wt(),t.body.kind==="Block"&&e.returnType.tag!=="void"&&this.#D.items.length===R&&this.#kr(S)&&this.#e(t.pos,k.incompatibleTypes,"incompatible types: bad return type in lambda expression",[" missing return value"]),S.usesThis&&(S.isStatic=!1,Zo(S,1)),this.#de(v),this.#t=x,this.#p=C,S}#qt(){let t=this.#l;for(let e=this.#t;t?.lambda&&e;e=e.outer)t.usesThis=!0,t=e.method}#Kn(t,e,n=!1){if(!e)return this.#e(t.start,k.incompatibleTypes,"method reference not expected here"),A;if(e.tag==="error")return A;let s=this.#Ze(e);if("problem"in s)return this.#e(t.start,k.incompatibleTypes,`incompatible types: ${s.problem}`,s.details),A;n&&le(s.returnType,null)&&(s.returnType=Wn);let r=s.params.length,a={kind:"Lambda",params:Array.from({length:r},(x,C)=>({name:`$${C}`,pos:t.start,type:null})),body:{kind:"Block",statements:[],pos:t.start,start:t.start,end:t.end},reference:!0,depth:t.depth,pos:t.start,start:t.start,end:t.end};t.lambda=a;let o=x=>({kind:"Name",identifier:`$${x}`,depth:1,pos:t.start,start:t.start,end:t.end}),c=x=>Array.from({length:r-x},(C,E)=>o(x+E)),u={depth:2,pos:t.start,start:t.start,end:t.end},d=(x,C)=>({kind:"MethodCall",target:x,name:t.name,namePos:t.namePos,selectPos:t.start,args:c(C),plainNpe:!0,...u}),h=x=>s.returnType.tag==="void"?{kind:"ExpressionStatement",expression:x,...u}:{kind:"ReturnStatement",value:x,...u},m=a.body;if(t.arrayType){let C={kind:"NewArray",elementType:t.arrayType.kind==="ArrayType"?t.arrayType.element:t.arrayType,dimensions:r?[o(0)]:[],extraDims:0,initializer:null,...u};return m.statements.push(h(C)),this.#ge(a,s,m,[],()=>this.#be(m)),e}let p=t.target;if(p.kind==="Super"||p.kind==="This")return m.statements.push(h(d(p,0))),this.#ge(a,s,m,[],()=>this.#be(m)),e;if(p.kind==="FieldAccess"&&p.target.kind==="Name"&&p.target.identifier==="System"&&(p.name==="out"||p.name==="err")&&!this.#lt("System"))return m.statements.push(h(d(p,0))),this.#ge(a,s,m,[],()=>this.#be(m)),e;if(t.name==="new"){let x=this.#wr(p)?this.#qn(p):null;if(!x)return this.#e(t.start,k.cantResolve,"cannot find symbol",[` symbol: class ${this.#Xn(p)}`,` location: class ${this.#a.displayName}`]),A;let C={kind:"NewObject",classType:x,args:c(0),...u};return m.statements.push(h(C)),this.#ge(a,s,m,[],()=>this.#be(m)),e}let b=this.#Xe(p);if("tag"in b){if(b.tag==="error")return A;t.receiver=p;let x={kind:"Name",identifier:"$recv",depth:1,pos:t.start,start:t.start,end:t.end},C=d(x,0);return m.statements.push(h(C)),this.#ge(a,s,m,[{name:"$recv",type:b}],()=>this.#be(m)),e}let S=this.#Xn(p),v=x=>h(x?d(o(0),1):d(p,0));return this.#ge(a,s,m,[],()=>{let x=D=>{let P=v(D),j=this.#D.items.length;m.statements=[P],this.#be(m);let G=this.#D.items.splice(j),tt=P.kind==="ReturnStatement"?P.value:P.expression,Wt=tt.method!==void 0||tt.libraryCall!==void 0||tt.stringMethod!==void 0||tt.mathFunction!==void 0||tt.objectMethod!==void 0,be=tt.method?tt.method.isStatic:tt.libraryCall?tt.libraryCall.isStatic:tt.mathFunction!==void 0,In=tt.method?`method ${tt.method.name}(${tt.method.params.map(M).join(",")}) in ${tt.method.owner.displayName}`:tt.libraryCall?`method ${t.name}(${tt.libraryCall.params.map(M).join(",")}) in ${S}`:void 0;return{ok:Wt&&be!==D,...In?{found:In}:{},...G[0]?{message:G[0].message}:{}}},C=x(!1),E=this.#qn(p),R=E?this.#Wn(E):null,L=R?.tag==="diamond"?dt(R.symbol):R,I=s.params[0],N=!L||L.tag==="error"||I===void 0||I===Wn||z(zt(I)??I,L)||I.tag==="typevar",J=r>0&&N?x(!0):{ok:!1};if(C.ok&&J.ok){this.#e(t.start,k.incompatibleTypes,"incompatible types: invalid method reference",[` reference to ${t.name} is ambiguous`,` both ${C.found} and ${J.found} match`]);return}if(!C.ok&&!J.ok){let D=/^non-static method (.*) cannot be referenced from a static context$/.exec(C.message??"");if(D){this.#e(t.start,k.incompatibleTypes,"incompatible types: invalid method reference",[` unexpected instance method ${D[1]} found in unbound lookup`]);return}this.#e(t.start,k.cantResolve,"invalid method reference",[" cannot find symbol",` symbol: method ${t.name}(${s.params.map(M).join(",")})`,` location: class ${S}`]);return}m.statements=[v(!C.ok)],this.#be(m)}),e}#be(t){for(let e of t.statements)this.#ne(e)}#wr(t){let e=Ce(t);return e!==null&&(this.#pe(e)!==null||this.#et(e)!==null||e.join(".")==="String")}#qn(t){let e=Ce(t);if(!e)return null;let n=this.#pe(e)?null:this.#et(e);return{kind:"ClassType",names:e,hasTypeArguments:!1,...n&&n.typeParams.length?{diamond:!0}:{},pos:t.pos,start:t.start,end:t.end}}#Wn(t){let e=this.#D.items.length,n=this.#V(t,!0);return this.#D.items.splice(e),n}#Xn(t){return Ce(t)?.join(".")??bs(t)}#kr(t){let e=this.#I,n=this.#X,s=[this.#x,this.#tt,this.#Q,this.#U];this.#I=[],this.#X=[];let r=this.#xe(t.declaration.body.statements,Kt(),!0).completes;return this.#I=e,this.#X=n,[this.#x,this.#tt,this.#Q,this.#U]=s,r}#Sn(t){for(let e=this.#t;e;e=e.outer)for(let n=e.scopes.length-1;n>=0;n--){let s=e.scopes[n].names.get(t);if(s){let r=e.method;for(let a=e.outer;a&&r?.lambda;a=a.outer)r=a.method;return{local:s,method:r}}}return null}#Wt(t,e){this.#e(t,k.cantResolve,e)}#Cr(t,e){this.#fe(t.condition);let n=t.condition.type??A,s=e!==void 0&&e.tag!=="error"?e:void 0,r=this.#Kt(this.#ct(t.condition,!0),()=>this.#Z(t.whenTrue,s)),a=this.#Kt(this.#ct(t.condition,!1),()=>this.#Z(t.whenFalse,s));if(n.tag!=="boolean"||r.tag==="error"||a.tag==="error")return A;let o,c=gt(r)??r,u=gt(a)??a;if(Z(c)&&Z(u)&&!(Q(r)&&Q(a)&&s&&Q(s)))if(c.tag==="boolean"&&u.tag==="boolean")o=ft;else if(Ot(c)&&Ot(u))o=cl(c,u,t.whenTrue.constant,t.whenFalse.constant);else return this.#o(t.pos,"conditional expressions mixing boolean and numeric operands"),A;else if(Z(r)&&a.tag==="null"||Z(a)&&r.tag==="null"){let h=Z(r)?r:a,m=this.#Yn(h);if(!m)return A;if(o=s&&Q(s)?s:m,s&&!te(s,m))return this.#q(Z(r)?t.whenTrue:t.whenFalse,h,s),A}else{if(s){let h=!0;for(let[m,p]of[[t.whenTrue,r],[t.whenFalse,a]])te(s,p,m.constant)||(this.#e(m.pos,k.incompatibleTypes,"incompatible types: bad type in conditional expression",[` ${je(s,p)}`]),h=!1);if(!h)return A}if(Z(r)||Z(a))return this.#o(t.pos,"conditional expressions that need boxing"),A;o=s&&Q(s)?s:wa(r,a)}let d=t.condition.constant;return d?.kind==="boolean"&&t.whenTrue.constant&&t.whenFalse.constant&&(t.constant=vn(d.value?t.whenTrue.constant:t.whenFalse.constant,o)),o}#Er(t,e){let n=Hn[t.name],s=n.map(o=>({owner:"Math",name:t.name,params:o.params,returnType:o.returnType})),r=this.#it({pos:t.selectPos,name:t.name,imported:la(t),args:t.args,callPos:t.pos},s,e,"method");if(!r)return A;let a=n[s.indexOf(r)];return a.fn?(t.mathFunction={fn:a.fn,params:a.params},r.returnType):(this.#o(t.selectPos,`Math.${t.name}(${r.params.map(M).join(",")})`,!0),A)}#Yn(t){let e={int:"Integer",long:"Long",double:"Double",char:"Character",boolean:"Boolean",float:"Float",byte:"Byte",short:"Short"}[t.tag],n=e?se(e):void 0;return n?dt(n):null}#Ar(t,e){if(t.name==="readln"){Xt("System");let o=[{owner:"IO",name:"readln",params:[],returnType:ut},{owner:"IO",name:"readln",params:[ut],returnType:ut}],c=this.#it({pos:t.selectPos,name:t.name,args:t.args,callPos:t.pos},o,e,"method");if(!c)return A;let u=`readln(${c.params.length?"String":""})`;return t.libraryCall={native:`IO.${u}`,isStatic:!0,params:c.params,returnsValue:!0,display:`java.lang.IO.${u}`},ut}if(t.name!=="print"&&t.name!=="println")return this.#e(t.selectPos,k.cantResolve,"cannot find symbol",[` symbol: method ${this.#Ut(t.name,e)}`," location: class IO"]),A;let n=t.name==="println"?[{owner:"IO",name:"println",params:[H],returnType:Tt},{owner:"IO",name:"println",params:[],returnType:Tt}]:[{owner:"IO",name:"print",params:[H],returnType:Tt}];if(!this.#it({pos:t.selectPos,name:t.name},n,e,"method"))return A;let r=e[0],a="none";if(r)switch(r.tag){case"int":a="int";break;case"char":a="char";break;case"boolean":a="boolean";break;case"long":a="long";break;case"double":a="double";break;case"string":case"null":a="string";break;default:a="object"}return t.print={stream:"out",newline:t.name==="println",argument:a},Tt}#Ir(t){let e=nt(t);if(e.kind==="FieldAccess")return e.field;if(e.kind==="Name"&&e.imported)return e.imported.field}#Or(t,e,n){Xt("System");let s={owner:"PrintStream",name:t.name,params:[ut,Qt(H)],returnType:Tt,varargs:!0},r=this.#it({pos:t.selectPos,name:t.name},[s],n,"method");return r?(t.libraryCall={native:`PrintStream.${e}.printf(String,Object[])`,isStatic:!0,params:r.params,returnsValue:!1,display:`java.io.PrintStream.${t.name}(String, Object[])`},r.expanded&&(t.libraryCall.varargsFrom=1),Tt):A}#Qn(t){let e=nt(t);if(e.kind!=="MethodCall"||e.typeArguments)return null;if(e.libraryMethod){let{method:a,symbol:o,classArgs:c}=e.libraryMethod,u=a.typeParams??[];if(!u.length)return null;let d=yr(a,o);return{call:e,result:a.returnType,params:a.params.map(h=>a.isStatic?h:Yt(h,o.typeParams,c)),varOf:h=>h.tag==="typevar"&&!h.symbol&&u.includes(h.name)?h.name:null,ref:h=>({name:h,decl:d}),bound:h=>{let m=a.typeParamBounds?.[h];return m?{type:m,decl:d}:null}}}let n=e.method;if(!n?.typeParams?.length)return null;let s=n.typeParams,r=a=>s.find(o=>o.name===a);return{call:e,result:n.returnType,params:n.params,varOf:a=>a.tag==="typevar"&&a.symbol&&s.includes(a.symbol)?a.name:null,ref:a=>({name:a,decl:gr(r(a))}),bound:a=>{let o=r(a).bounds[0];return o?{type:o,decl:null}:null}}}#Zn(t,e=!1){let n=this.#Qn(t);if(!n)return null;let s=n.varOf(n.result),r=e&&n.result.tag==="library"?n.result.args[n.result.args.length-1]:void 0,a=s??(r?n.varOf(r):null);if(!a)return null;let o=m=>{let p=[],b=S=>{let v=n.varOf(S);v?p.push(v):S.tag==="array"?b(S.element):S.tag==="wildcard"&&S.bound?b(S.bound):S.tag==="library"?S.args.forEach(b):S.tag==="class"&&S.args?.forEach(b)};return b(m),p},c=m=>{let p=nt(m);return p.kind==="Lambda"&&p.params.some(b=>!b.type)||p.kind==="MethodRef"&&(!this.#Ve(p)||this.#yn(p))},u=new Set,d=null,h=null;return n.call.args.forEach((m,p)=>{let b=n.params[Math.min(p,n.params.length-1)];if(!b)return;if(c(m)){!h&&o(b).includes(a)&&(h=m);return}let S=this.#Zn(m,!0);if(S){o(b).includes(a)&&(d??=S);return}for(let v of o(b))u.add(v)}),u.has(a)?null:d??{call:n,name:a,by:h}}#Lr(t,e){let n=this.#Qn(t);if(!n)return null;let s=n.varOf(n.result);if(!s)return null;let r=this.#Zn(t);if(!r)return null;let a=r.call.bound(r.name),o=r.by&&nt(r.by),c={type:H,decl:null};if(o?.kind==="MethodRef"&&o.name==="new"&&!o.arrayType){let u=o.target?Ce(o.target):null,d=u?this.#et(u):null,h=d?{type:{tag:"library",symbol:d,args:d.typeParams.map(p=>({tag:"typevar",name:p}))},decl:pr(d)}:{type:e,decl:null},m=[...a?[a]:[],n.bound(s)??c];return{bound:a?.type??null,variable:n.ref(s),upper:m,lower:h}}return{bound:a?.type??null,variable:r.call.ref(r.name),upper:[a??c],lower:o?.kind==="MethodRef"&&this.#Nr(o)||{type:e,decl:null}}}#Nr(t){let e=t.target?Ce(t.target):null,n=e&&!this.#lt(e[0])?this.#et(e):null,s=n?.methods.filter(r=>r.name===t.name)??[];return s.length!==1||!s[0].typeParams?.length?null:{type:s[0].returnType,decl:yr(s[0],n)}}#$r(t,e,n){let s=this.#Ir(t.target)==="System.err"?"err":"out";if(t.name==="printf"||t.name==="format")return this.#Or(t,s,n);if((t.name==="flush"||t.name==="close"||t.name==="checkError")&&!n.length)return Xt("System"),t.libraryCall={native:`PrintStream.${s}.${t.name}()`,isStatic:!0,params:[],returnsValue:t.name==="checkError",display:`java.io.PrintStream.${t.name}()`},t.name==="checkError"?ft:Tt;if(t.name!=="print"&&t.name!=="println")return Jo.has(t.name)?this.#o(t.selectPos,`PrintStream.${t.name}()`,!0):this.#e(t.selectPos,k.cantResolve,"cannot find symbol",[` symbol: method ${this.#Ut(t.name,n)}`,this.#Ee(t.target,e)]),A;let r=this.#it({pos:t.selectPos,name:t.name,args:t.args,callPos:t.pos},Ko(t.name),n,"method");if(!r)return A;let a=r.params[0],o="none";if(a)switch(a.tag){case"int":o="int";break;case"char":o="char";break;case"boolean":o="boolean";break;case"string":o="string";break;case"array":o="char-array";break;case"object":o="object",this.#Qe(t.args,[H]);break;case"long":o="long";break;case"double":o="double";break;case"float":o="float";break;default:throw new Error(`checker: unexpected print overload ${M(a)}`)}return t.print={stream:s,newline:t.name==="println",argument:o},Tt}#it(t,e,n,s){let r=t.args?.map((S,v)=>n[v]?this.#Lr(S,n[v]):null),a=(S,v,x=!1)=>{if(S.params.length!==n.length)return"actual and formal argument lists differ in length";if(S.problem)return S.problem.reason;for(let C=0;C<n.length;C++){let E=r?.[C];if(!(E?Ca(S.params[C],E.bound,x):v(S.params[C],n[C])))return`argument mismatch; ${tl(S.params[C],n[C])??je(S.params[C],n[C])}`}return null},o=S=>{let v=r?.findIndex((E,R)=>E&&!re(S.params[R],n[R]))??-1;if(v<0)return S;let x=r[v],C=S.shown??S.params;return this.#e(t.callPos??t.pos,k.cantResolve,`${s} ${t.name} in ${S.ownerKind??"class"} ${S.owner} cannot be applied to given types;`,[` required: ${As(C)}`,` found: ${As(n)}`,...ta(x.variable,[{type:S.params[v],decl:null},...x.upper],[x.lower])]),null},c=S=>a(S,(v,x)=>re(v,x)||Qe(v,x),!0),u=e.filter(S=>a(S,We)===null);if(u.length||(u=e.filter(S=>c(S)===null)),!u.length)for(let S of e){if(!S.varargs||n.length<S.params.length-1)continue;let v=S.params[S.params.length-1].element;if([...S.params.slice(0,-1),...n.slice(S.params.length-1).map(()=>v)].every((C,E)=>re(C,n[E])))return{...S,expanded:!0}}if(!u.length){if(e.length===1){let C=e[0],E=C.shown??C.params,R=(rl(C,n)??c(C)).split(`\n`),L=C.problem?.alone?[` reason: ${R[0]}`]:[` required: ${As(E)}`,` found: ${As(n)}`,` reason: ${R[0]}`,...R.slice(1)];return this.#e(t.pos,k.cantResolve,`${s} ${t.name} in ${C.ownerKind??"class"} ${C.owner} cannot be applied to given types;`,[...L,...C.problem?.alone?[]:Dt([...E,...n])]),null}let S=[],v=[];for(let C of t.imported?[...e].reverse():e){let E=C.shown??C.params,R=C.method?.typeParams;v.push(...E),S.push(` ${s} ${C.owner}.${R?`<${R.map(I=>I.name).join(",")}>`:""}${C.name}(${E.map(M).join(",")}) is not applicable`);let L=c(C).split(`\n`);S.push(` (${L[0]}${L.length>1?"":")"}`,...L.slice(1).map((I,N,J)=>` ${I}${N===J.length-1?")":""}`))}let x=n.length?this.#Ut(t.name,n):`${t.name}(no arguments)`;return this.#e(t.pos,k.cantResolve,`no suitable ${s} found for ${x}`,[...S,...Dt([...v,...n])]),null}let d=(S,v)=>S.params.every((x,C)=>We(v.params[C],x)),h=u.filter(S=>u.every(v=>S===v||d(S,v)));if(h.length===1)return o(h[0]);let[m,p]=Go(u,d),b=S=>`${s} ${S.name}(${S.params.map(M).join(",")}) in ${S.owner}`;return this.#e(t.pos,k.cantResolve,`reference to ${t.name} is ambiguous`,[` both ${b(m)} and ${b(p)} match`]),o(m),null}#Mr(t){let e=this.#Z(t.operand);if(e.tag==="error")return A;let n=gt(e)??e;if(t.operator==="!")return n.tag!=="boolean"?this.#xn(t,n):(t.operand.constant?.kind==="boolean"&&(t.constant=bt(!t.operand.constant.value)),ft);if(!Ot(n)||t.operator==="~"&&!zn(n))return this.#xn(t,n);let s=ca(n),r=t.operand.constant;return r&&(t.constant=ul(t.operator,r,s)),s}#xn(t,e){return this.#e(t.pos,k.badOperands,`bad operand type ${M(e)} for unary operator \'${t.operator}\'`),A}#ts(t){let e=nt(t);this.#Bt=e.kind==="Name";let n=this.#v(e);if(this.#Bt=!1,t.type=n,n.tag==="error")return null;if(e.kind==="Name"&&e.symbol?.kind==="local"){if(e.symbol.multiCatch)return this.#e(e.pos,k.finalAssign,`multi-catch parameter ${e.identifier} may not be assigned`),null;let r=e.symbol.forEach||e.symbol.parameter!==void 0||e.symbol.catchParameter;return e.symbol.isFinal&&!r?(this.#e(e.pos,k.finalAssign,`cannot assign a value to final variable ${e.identifier}`),null):(e.symbol.reassigned=!0,e.symbol.assignCount=(e.symbol.assignCount??0)+1,{kind:"local",variable:e.symbol})}let s=e.kind==="Name"&&e.symbol?.kind==="field"?e.symbol:e.kind==="FieldAccess"?e.fieldSymbol:void 0;if(s)return s.isFinal&&!this.#Pr(e,s)?(this.#e(e.pos,k.finalAssign,`cannot assign a value to ${s.isStatic?"static final":"final"} variable ${s.name}`),null):{kind:"field",field:s};if(e.kind==="ArrayAccess")return{kind:"element",type:n};if(e.kind==="Name"&&e.imported)return this.#e(e.pos,k.finalAssign,`cannot assign a value to static final variable ${e.identifier}`),null;if(e.kind==="FieldAccess"&&e.field){let r=e.field==="length"?"final variable length":`static final variable ${e.name}`;return this.#e(e.pos,k.finalAssign,`cannot assign a value to ${r}`),null}return this.#e(e.pos,k.incompatibleTypes,"unexpected type",[" required: variable"," found: value"]),null}#Pr(t,e){if(e.declarator.init)return!1;let n=this.#l?.initializer;return n&&this.#l.owner===e.owner&&n==="static"===e.isStatic?t.kind==="Name"?!t.outerHops:!e.isStatic&&t.kind==="FieldAccess"&&nt(t.target).kind==="This":e.isStatic||!this.#l?.isConstructor||this.#l.owner!==e.owner||this.#l.declaration.compact?!1:t.kind==="Name"?!t.outerHops:t.kind==="FieldAccess"&&nt(t.target).kind==="This"}#Rr(t){if(!this.#ts(t.operand))return A;let n=t.operand.type;return Ot(gt(n)??n)?n:this.#xn(t,n)}#es(t,e,n,s){return this.#e(t.pos,k.badOperands,`bad operand types for binary operator \'${e}\'`,[` first type: ${M(n)}`,` second type: ${M(s)}`]),A}#ns(t,e,n){if(t==="+"&&(e.tag==="string"||n.tag==="string"))return ut;if((t==="=="||t==="!=")&&Q(e)&&Q(n))return ve(e,n)?ft:null;let s=gt(e)??e,r=gt(n)??n,a=Ot(s)&&Ot(r);switch(t){case"+":return s.tag==="string"||r.tag==="string"?ut:a?Xn(s,r):null;case"-":case"*":case"/":case"%":return a?Xn(s,r):null;case"<<":case">>":case">>>":return zn(s)&&zn(r)?ca(s):null;case"<":case">":case"<=":case">=":return a?ft:null;case"==":case"!=":return a?ft:s.tag==="boolean"&&r.tag==="boolean"?ft:Q(s)&&Q(r)&&(z(s,r)||z(r,s))?ft:null;case"&":case"|":case"^":return zn(s)&&zn(r)?Xn(s,r):s.tag==="boolean"&&r.tag==="boolean"?ft:null;case"&&":case"||":return s.tag==="boolean"&&r.tag==="boolean"?ft:null}return null}#Jr(t){let e=this.#Z(t.left),n=t.operator==="&&"||t.operator==="||"?this.#Kt(this.#ct(t.left,t.operator==="&&"),()=>this.#Z(t.right)):this.#Z(t.right);if(e.tag==="error"||n.tag==="error")return A;let s=this.#ns(t.operator,e,n);if(!s){let o=c=>Z(c)||Q(c);return(t.operator==="=="||t.operator==="!=")&&o(e)&&o(n)&&Z(e)===Z(n)?(this.#e(t.pos,k.badOperands,`incomparable types: ${M(e)} and ${M(n)}`),A):this.#es(t,t.operator,e,n)}let r=t.left.constant,a=t.right.constant;if(r&&a){let o=hl(t.operator,r,a,s);o&&(t.constant=o)}return s}#Dr(t){let e=this.#ts(t.target),n=t.target.type??A,s=this.#Z(t.value,t.operator==="="?n:void 0);if(!e||n.tag==="error"||s.tag==="error")return e?n:A;if(t.operator==="="){if(!this.#We(n,s,t.value))return this.#q(t.value,s,n),A;let u=nt(t.target);return u.kind==="FieldAccess"&&u.fieldSymbol&&u.target.type&&Jn(u.target.type)&&Yn([u.fieldSymbol.type]).length&&this.#st(u.pos,"unchecked",`unchecked assignment to variable ${u.name} as member of raw type ${M(u.target.type)}`),n}let r=t.operator.slice(0,-1),a=this.#ns(r,n,s);if(!a)return this.#es(t,r,n,s);let o=gt(n);return(o?et(o,a):Ot(a)&&Ot(n)||et(a,n))?n:(this.#e(t.value.pos,k.incompatibleTypes,`incompatible types: ${M(a)} cannot be converted to ${M(n)}`),A)}#jr(t){let e=this.#Z(t.array),n=this.#Z(t.index);return e.tag==="error"||n.tag==="error"?A:e.tag!=="array"?(this.#e(t.pos,k.incompatibleTypes,`array required, but ${M(e)} found`),A):re(U,n)?e.element:(this.#q(t.index,n,U),A)}#Fr(t){let e=this.#V(t.elementType,!0);if(e.tag!=="error"&&!wn(e)){this.#e(t.pos,k.syntax,"generic array creation");for(let s of t.dimensions)this.#Z(s);return A}for(let s of t.dimensions){let r=this.#Z(s);r.tag!=="error"&&!re(U,r)&&this.#q(s,r,U)}if(e.tag==="error")return t.initializer&&this.#Ce(t.initializer,A),A;let n=e;for(let s=0;s<t.dimensions.length+t.extraDims;s++)n=Qt(n);return t.initializer&&this.#Ce(t.initializer,n),n}#_r(t){let e=this.#V(t.targetType),n=this.#Z(t.expression);if(e.tag==="error"||n.tag==="error")return A;let s=gt(n),r=Ot(e)&&Ot(n)||e.tag==="boolean"&&n.tag==="boolean"||Q(e)&&Q(n)&&ve(e,n)||Q(e)&&Z(n)&&te(e,n)||Z(e)&&s!==null&&(et(s,e)||Ot(s)&&Ot(e)&&re(e,s));if(!r&&Z(e)&&Q(n)&&!s){let o=this.#Yn(e);o&&ve(o,n)&&(t.checked=o,r=!0)}if(!r)return this.#q(t.expression,n,e),A;if(il(e,n))return this.#q(t.expression,n,e),A;if(Q(e)&&Q(n)&&!wn(e)&&!z(n,e)&&!Xo(e,n)){this.#st(t.expression.pos,"unchecked","unchecked cast",[` required: ${M(e)}`,` found: ${M(n)}`,...Dt([e,n])]);let o=K(e);!z(n,o)&&o.tag!=="object"&&(t.checked=o)}else Q(e)&&Q(n)&&!z(n,e)&&(t.checked=e);let a=t.expression.constant;return a&&(Z(e)||e.tag==="string")&&(t.constant=vn(a,e)),e}#Te(t,e,n){!this.#tt&&!this.#I.some(([s])=>s===t)&&this.#I.push([t,e,n])}#Se(t,e){this.#X.some(([n])=>n===t)||this.#X.push([t,e])}#Ur(t){this.#I=[],this.#X=[];let e=Cr(t);for(let n of e)this.#is(n);this.#is(t);for(let[n,s,r]of this.#I)this.#e(n,s==="missing return statement"?k.missingReturn:k.unreachable,s,r);for(let[n,s]of this.#X)this.#e(n,k.uninitialized,s);this.#J=[];for(let n of e)this.#ss(n);this.#ss(t);for(let[n,s,r]of this.#J)this.#e(n,k.unreported,s,r);for(let n of this.#Y)n.top!==t||Yo(n.local)||this.#e(n.pos,k.notEffectivelyFinal,`local variables referenced from ${n.inner?"an inner class":"a lambda expression"} must be final or effectively final`)}#ss(t){this.#a=t;for(let e of t.fields){let n=e.declarator.init;n&&this.#Le([],()=>n.kind==="ArrayInitializer"?this.#tn(n):this.#b(n));let s=e.enumConstant?.node;s&&this.#Le([],()=>{for(let r of s.args)this.#b(r);if(s.ctor)for(let r of s.ctor.throws)this.#$t(r,s.pos)})}for(let e of t.declaration.members){if(e.kind==="Initializer"&&e.symbol){this.#Le(e.isStatic?[]:this.#Br(t),()=>{for(let s of e.body.statements)this.#ht(s)});continue}if(e.kind!=="MethodDeclaration"||!e.symbol||e.symbol.isAbstract||e.symbol.builtin)continue;let n=e.symbol;this.#Le(n.throws,()=>{if(n.superConstructor)for(let s of n.superConstructor.throws)this.#$t(s,n.declaration.synthetic?t.declaration.keywordPos:n.declaration.body.pos);for(let s of n.declaration.body.statements)this.#ht(s)})}for(let e of t.constructors)!e.declaration.synthetic||e.builtin||!e.superConstructor||e.forwardsToSuper||this.#Le([],()=>{for(let n of e.superConstructor.throws)this.#$t(n,t.declaration.keywordPos)})}#Br(t){let e=t.constructors.filter(n=>!n.declaration.synthetic&&!n.builtin);return e.length?e.flatMap(n=>n.throws).filter(n=>e.every(s=>s.throws.some(r=>z(n,r)))):[]}#Le(t,e){let n=[this.#m,this.#S];this.#m=t,this.#S=[],e(),[this.#m,this.#S]=n}#$t(t,e,n){if(this.#Zt(t)){for(let s=this.#S.length-1;s>=0;s--){let r=this.#S[s];if(r.thrown.push(t),r.caught.some(a=>z(t,a)))return}this.#m.some(s=>z(t,s))||this.#J.some(([s])=>s===e)||this.#J.push([e,`unreported exception ${M(t)}; must be caught or declared to be thrown`,n])}}#ht(t){switch(t.kind){case"Block":for(let e of t.statements)this.#ht(e);return;case"LocalVariableDeclaration":for(let e of t.declarators)e.init?.kind==="ArrayInitializer"?this.#tn(e.init):e.init&&this.#b(e.init);return;case"ExpressionStatement":this.#b(t.expression);return;case"IfStatement":this.#b(t.condition),this.#ht(t.then),t.otherwise&&this.#ht(t.otherwise);return;case"WhileStatement":case"DoStatement":this.#b(t.condition),this.#ht(t.body);return;case"ForStatement":if(t.init&&!Array.isArray(t.init))this.#ht(t.init);else for(let e of t.init??[])this.#b(e);t.condition&&this.#b(t.condition);for(let e of t.update)this.#b(e);this.#ht(t.body);return;case"ForEachStatement":this.#b(t.iterable),this.#ht(t.body);return;case"LabeledStatement":this.#ht(t.body);return;case"SwitchStatement":this.#rs(t);return;case"YieldStatement":this.#b(t.value);return;case"ReturnStatement":t.value&&this.#b(t.value);return;case"ConstructorCall":for(let e of t.args)this.#b(e);if(t.target)for(let e of t.target.throws)this.#$t(e,t.thisPos);return;case"AssertStatement":this.#b(t.condition),t.message&&this.#b(t.message);return;case"LocalClass":return;case"ThrowStatement":{this.#b(t.expression);let e=nt(t.expression),n=e.kind==="Name"&&e.symbol?.kind==="local"&&!e.symbol.reassigned?this.#pt.get(e.symbol):void 0;if(n)for(let s of n)this.#$t(s,t.pos);else t.expression.type&&this.#$t(t.expression.type,t.pos);return}case"TryStatement":this.#Vr(t);return;case"BreakStatement":case"ContinueStatement":case"EmptyStatement":return}}#rs(t){this.#b(t.selector);for(let e of t.cases){for(let n of e.statements)this.#ht(n);e.body?.kind==="Block"?this.#ht(e.body):e.body&&this.#b(e.body)}}#Vr(t){let n={caught:t.catches.flatMap(r=>r.caught??[]),thrown:[]};this.#S.push(n);for(let r of t.resources)r.kind==="declaration"?this.#b(r.init):this.#b(r.expression);this.#ht(t.block);for(let r of[...t.resources].reverse()){let a=r.kind==="declaration"?r.symbol?.type:r.expression.type,o=r.kind==="declaration"?r.name:r.symbol?.name??"";for(let c of this.#Hr(a))this.#$t(c,r.pos,[` exception thrown from implicit call to close() on resource variable \'${o}\'`])}this.#S.pop();let s=[];for(let r of t.catches){if(r.types.forEach((a,o)=>{let c=r.caught?.[o];if(!c||!this.#Zt(c))return;let u=c.tag==="class"?c.symbol.binaryName:"";u==="java.lang.Exception"||u==="java.lang.Throwable"||n.thrown.some(d=>z(d,c)||z(c,d))||this.#J.push([r.types.length===1?r.pos:a.pos,`exception ${M(c)} is never thrown in body of corresponding try statement`,void 0])}),r.symbol){let a=r.caught??[];this.#pt.set(r.symbol,n.thrown.filter(o=>a.some(c=>z(o,c))&&!s.some(c=>z(o,c))))}s.push(...r.caught??[]),this.#ht(r.block)}t.finallyBlock&&this.#ht(t.finallyBlock)}#Hr(t){return t?.tag==="library"?this.#vn(t.symbol.methods.find(n=>n.name==="close"&&!n.params.length)?.throws):!t||t.tag!=="class"?[]:this.#kt(t.symbol,"close").find(n=>n.params.length===0)?.throws??[]}#vn(t){return(t??[]).map(e=>X(this.#c.get(e)))}#tn(t){for(let e of t.elements)e.kind==="ArrayInitializer"?this.#tn(e):this.#b(e)}#b(t){switch(t.kind){case"MethodCall":t.target&&this.#b(t.target);for(let e of t.args)this.#b(e);if(t.method)for(let e of t.method.throws)this.#$t(e,t.pos);for(let e of this.#vn(t.libraryCall?.throws))this.#$t(e,t.pos);return;case"NewObject":t.outerExpression&&this.#b(t.outerExpression);for(let e of t.args)this.#b(e);if(t.ctor)for(let e of t.ctor.throws)this.#$t(e,t.pos);for(let e of this.#vn(t.libraryCall?.throws))this.#$t(e,t.pos);return;case"MethodRef":t.receiver&&this.#b(t.receiver),t.lambda&&this.#b(t.lambda);return;case"Lambda":if(t.method){let e=t.method.declaration.body;this.#Le([],()=>{for(let n of e.statements)this.#ht(n)})}return;case"SwitchExpression":this.#rs(t);return;case"FieldAccess":this.#b(t.target);return;case"Unary":case"IncDec":this.#b(t.operand);return;case"Binary":this.#b(t.left),this.#b(t.right);return;case"Assignment":this.#b(t.target),this.#b(t.value);return;case"Parenthesized":this.#b(t.expression);return;case"ArrayAccess":this.#b(t.array),this.#b(t.index);return;case"NewArray":for(let e of t.dimensions)this.#b(e);t.initializer&&this.#tn(t.initializer);return;case"Cast":this.#b(t.expression);return;case"Conditional":this.#b(t.condition),this.#b(t.whenTrue),this.#b(t.whenFalse);return;case"InstanceOf":this.#b(t.expression);return;case"ClassLiteral":case"Literal":case"Name":case"This":case"Super":return}}#is(t){this.#a=t;let e=t.constructors.some(r=>!r.declaration.synthetic),n=this.#as(t,!0),s=this.#as(t,!1);this.#Xt.set(t,s);for(let r of t.fields)!r.isFinal||r.declarator.init||r.enumConstant||r.capturedLocal||(r.isStatic?n.get(r)?.assigned||this.#X.push([r.declarator.pos,`variable ${r.name} might not have been initialized`]):!e&&!t.isRecord&&!s.get(r)?.assigned&&this.#X.push([r.declarator.pos,`variable ${r.name} not initialized in the default constructor`]));for(let r of t.declaration.members)r.kind==="MethodDeclaration"&&r.symbol&&!r.symbol.declaration.synthetic&&!r.symbol.isAbstract&&this.#en(r.symbol);for(let r of this.#Vt.get(t)??[])this.#en(r)}#as(t,e){let n=new Map;for(let a of t.fields)a.isStatic===e&&a.isFinal&&!a.declarator.init&&!a.enumConstant&&!a.capturedLocal&&n.set(a,1e6+n.size);let s=Sr();for(let a of n.values())s.unassigned.add(a);for(let a of t.declaration.members){if(a.kind!=="Initializer"||a.isStatic!==e||!a.symbol)continue;this.#x=new Map,this.#tt=0,this.#Q=[],this.#U=n;let o=this.#xe(a.body.statements,s,!0);o.completes||this.#Te(a.pos,"initializer must be able to complete normally");let c=Sr();for(let u of n.values())Sn(o.after,u)&&c.vars.add(u),Kn(o.after,u)&&c.unassigned.add(u);s=c}this.#U=new Map;let r=new Map;for(let[a,o]of n)r.set(a,{assigned:Sn(s,o),unassigned:Kn(s,o)});return r}#en(t){let e=Sr();for(let o of t.declaration.params)o.symbol&&(e=Ne(e,o.symbol.index));for(let o of t.locals)o.parameter!==void 0&&(e=Ne(e,o.index));this.#x=new Map,this.#tt=0,this.#Q=[],this.#U=new Map;let n=t.declaration.body,s=n.statements[0],r=t.isConstructor&&!t.declaration.compact&&!(s?.kind==="ConstructorCall"&&s.keyword==="this");if(r){let o=this.#Xt.get(t.owner);for(let c of t.owner.fields){if(c.isStatic||!c.isFinal||c.declarator.init||c.capturedLocal)continue;let u=t.locals.length+this.#U.size;this.#U.set(c,u);let d=o?.get(c);d?.assigned&&e.vars.add(u),(!d||d.unassigned)&&e.unassigned.add(u)}}let a=this.#xe(n.statements,e,!0);if(a.completes&&!a.recovery&&t.returnType.tag!=="void"&&!t.lambda&&this.#Te(t.declaration.closeBracePos??n.end-1,"missing return statement"),r){for(let[o,c]of this.#U)Sn(a.after,c)||this.#Se(t.declaration.closeBracePos??n.end-1,`variable ${o.name} might not have been initialized`);for(let o of this.#Q)for(let[c,u]of this.#U)Sn(o.state,u)||this.#Se(o.pos,`variable ${c.name} might not have been initialized`)}this.#U=new Map}#xe(t,e,n){let s=e,r=n,a=!1;for(let o of t){r||(this.#Te(pa(o),"unreachable statement"),r=!0,a=!0,s=Kt());let c=this.#Ct(o,s,r);s=c.after,r=c.completes,c.recovery&&(a=!0)}return{after:s,completes:r,...a&&r?{recovery:!0}:{}}}#Ct(t,e,n){switch(t.kind){case"Block":return this.#xe(t.statements,e,n);case"LocalVariableDeclaration":return{after:this.#cs(t,e),completes:n};case"ExpressionStatement":return{after:this.#T(t.expression,e),completes:n};case"EmptyStatement":return{after:e,completes:n};case"ConstructorCall":{let s=e;for(let r of t.args)s=this.#T(r,s);return{after:s,completes:n}}case"IfStatement":{let s=this.#dt(t.condition,e),r=this.#Ct(t.then,s.whenTrue,n);if(!t.otherwise)return{after:vt(r.after,s.whenFalse),completes:n};let a=this.#Ct(t.otherwise,s.whenFalse,n);return{after:vt(r.after,a.after),completes:r.completes||a.completes}}case"WhileStatement":return this.#os(t,t.condition,t.body,[],e,n);case"ForStatement":{let s=e;if(t.init&&!Array.isArray(t.init))s=this.#cs(t.init,s);else for(let r of t.init??[])s=this.#T(r,s);return this.#os(t,t.condition,t.body,t.update,s,n)}case"DoStatement":return this.#Gr(t,e,n);case"ForEachStatement":return this.#Kr(t,e,n);case"LabeledStatement":{let s=this.#Ne(t),r=this.#Ct(t.body,e,n);return{after:vt(r.after,...s.breaks),completes:r.completes||s.breaks.length>0}}case"SwitchStatement":return this.#qr(t,e,n);case"YieldStatement":{let s=this.#T(t.value,e);return t.target&&this.#x.get(t.target)?.yields.push(s),{after:Kt(),completes:!1}}case"BreakStatement":return t.target&&this.#x.get(t.target)?.breaks.push(e),{after:Kt(),completes:!1};case"ContinueStatement":return t.target&&this.#x.get(t.target)?.continues.push(e),{after:Kt(),completes:!1};case"ReturnStatement":{let s=t.value?this.#T(t.value,e):e;return this.#U.size&&this.#Q.push({pos:t.pos,state:s}),{after:Kt(),completes:!1}}case"ThrowStatement":return this.#T(t.expression,e),{after:Kt(),completes:!1};case"AssertStatement":{let s=this.#dt(t.condition,e);return t.message&&this.#T(t.message,s.whenFalse),{after:e,completes:n}}case"TryStatement":return this.#zr(t,e,n);case"LocalClass":return{after:e,completes:n}}}#zr(t,e,n){let s=e;for(let h of t.resources)h.kind==="declaration"?(s=this.#T(h.init,s),h.symbol&&(s=Ne(s,h.symbol.index))):s=this.#T(h.expression,s);let r=this.#Ct(t.block,s,n);t.blockCompletes=r.completes;let a=[r],o=h=>{let m=_e(e);if(!h.all)for(let p of[...m.unassigned])h.unassigned.has(p)||m.unassigned.delete(p);return m};for(let h of t.catches){let m=o(r.after);h.symbol&&(m=Ne(m,h.symbol.index));let p=this.#Ct(h.block,m,n);h.completes=p.completes,a.push(p)}let c=a.filter(h=>h.completes),u=c.length?vt(c[0].after,...c.slice(1).map(h=>h.after)):Kt();if(!t.finallyBlock)return{after:u,completes:c.length>0};let d=this.#Ct(t.finallyBlock,o(vt(r.after,...a.map(h=>h.after))),n);return{after:qo(u,d.after),completes:c.length>0&&d.completes}}#Ne(t){let e={breaks:[],continues:[],yields:[]};return this.#x.set(t,e),e}#wn(t,e){let n=e(t,!0),s=[...t.unassigned].some(o=>!Kn(n.backEdge,o));if(!this.#U.size||t.all||!s)return n.result;let r=_e(t);for(let o of[...r.unassigned])Kn(n.backEdge,o)||r.unassigned.delete(o);this.#tt++;let a=e(r,!1);return this.#tt--,a.result}#os(t,e,n,s,r,a){return this.#wn(r,(o,c)=>{let u=e?this.#dt(e,o):{whenTrue:o,whenFalse:Kt()},d=e?e.constant:bt(!0),h=a&&!vs(d);c&&a&&!h&&this.#Te(pa(n),"unreachable statement");let m=this.#Ne(t),p=this.#Ct(n,h?u.whenTrue:Kt(),!0),b=vt(p.after,...m.continues);for(let S of s)b=this.#T(S,b);return{backEdge:b,result:{after:vt(u.whenFalse,...m.breaks),completes:a&&(!Bn(d)||m.breaks.length>0)}}})}#Gr(t,e,n){return this.#wn(e,s=>{let r=this.#Ne(t),a=this.#Ct(t.body,s,n),o=vt(a.after,...r.continues),c=this.#dt(t.condition,o),u=a.completes||r.continues.length>0;return{backEdge:c.whenTrue,result:{after:vt(c.whenFalse,...r.breaks),completes:n&&(u&&!Bn(t.condition.constant)||r.breaks.length>0)}}})}#Kr(t,e,n){let s=this.#T(t.iterable,e);return this.#wn(s,r=>{let a=this.#Ne(t),o=t.symbol?Ne(r,t.symbol.index):r,c=this.#Ct(t.body,o,n);return{backEdge:vt(c.after,...a.continues),result:{after:vt(r,...a.breaks),completes:n}}})}#qr(t,e,n){let s=this.#ls(t,this.#T(t.selector,e)),r=this.#Ne(t),a=[],o=!1;if(t.cases[0]?.arrow)for(let c of t.cases){let u=c.body,d=u.kind==="Block"?this.#Ct(u,s,n):{after:this.#T(u,s),completes:n};d.completes&&(a.push(d.after),o=!0)}else{let c=null;for(let u of t.cases){let d=c?.completes?vt(s,c.after):s;c=this.#xe(u.statements,d,n)}(!c||c.completes)&&(a.push(c?c.after:s),o=!0)}return!t.cases.some(c=>c.isDefault)&&!t.exhaustive&&(a.push(s),o=!0),a.push(...r.breaks),r.breaks.length&&(o=!0),{after:a.length?vt(a[0],...a.slice(1)):Kt(),completes:n&&o}}#ls(t,e){let n=e;for(let s of t.cases)s.guard&&(n=vt(n,this.#T(s.guard,n)));return n}#Wr(t,e){let n=this.#ls(t,this.#T(t.selector,e)),s=this.#Ne(t),r=[];if(t.cases[0]?.arrow)for(let a of t.cases){let o=a.body;if(o.kind!=="Block"){r.push(this.#T(o,n));continue}this.#xe(o.statements,n,!0).completes&&this.#Te(o.end-1,"switch rule completes without providing a value",[" (switch rules in switch expressions must either provide a value or throw)"])}else{let a=null;for(let o of t.cases){let c=a?.completes?vt(n,a.after):n;a=this.#xe(o.statements,c,!0)}a?.completes&&this.#Te(t.end-1,"switch expression completes without providing a value",[" (switch expressions must either provide a value or throw for all possible input values)"])}return!t.patternSwitch&&!t.cases.some(a=>a.isDefault)&&!t.coversAllConstants&&this.#Te(t.pos,"the switch expression does not cover all possible input values"),r.push(...s.yields),r.length?vt(r[0],...r.slice(1)):Kt()}#kn(t,e){let n=e;for(let s of t.elements)n=s.kind==="ArrayInitializer"?this.#kn(s,n):this.#T(s,n);return n}#cs(t,e){let n=e;for(let s of t.declarators){let r=s.symbol;r&&(n=Wo(n,r.index));let a=s.init;a&&(n=a.kind==="ArrayInitializer"?this.#kn(a,n):this.#T(a,n),r&&(n=Ne(n,r.index)))}return n}#dt(t,e){if(Bn(t.constant))return{whenTrue:e,whenFalse:Kt()};if(vs(t.constant))return{whenTrue:Kt(),whenFalse:e};if(t.kind==="Parenthesized")return this.#dt(t.expression,e);if(t.kind==="Unary"&&t.operator==="!"){let s=this.#dt(t.operand,e);return{whenTrue:s.whenFalse,whenFalse:s.whenTrue}}if(t.kind==="Binary"&&t.operator==="&&"){let s=this.#dt(t.left,e),r=this.#dt(t.right,s.whenTrue);return{whenTrue:r.whenTrue,whenFalse:vt(s.whenFalse,r.whenFalse)}}if(t.kind==="Binary"&&t.operator==="||"){let s=this.#dt(t.left,e),r=this.#dt(t.right,s.whenFalse);return{whenTrue:vt(s.whenTrue,r.whenTrue),whenFalse:r.whenFalse}}if(t.kind==="Conditional"&&t.type?.tag==="boolean"){let s=this.#dt(t.condition,e),r=this.#dt(t.whenTrue,s.whenTrue),a=this.#dt(t.whenFalse,s.whenFalse);return{whenTrue:vt(r.whenTrue,a.whenTrue),whenFalse:vt(r.whenFalse,a.whenFalse)}}let n=this.#T(t,e);return{whenTrue:n,whenFalse:n}}#Cn(t,e,n){return t.binding||Sn(n,t.index)?n:(this.#Se(e,`variable ${t.name} might not have been initialized`),Ne(n,t.index))}#nn(t){if(!this.#U.size)return null;let e;t.kind==="Name"&&t.symbol?.kind==="field"&&!t.outerHops?e=t.symbol:t.kind==="FieldAccess"&&t.fieldSymbol&&nt(t.target).kind==="This"&&(e=t.fieldSymbol);let n=e&&this.#U.get(e);return e&&n!==void 0?{field:e,index:n}:null}#sn(t,e,n){if(Sn(n,t.index))return n;this.#Se(e,`variable ${t.field.name} might not have been initialized`);let s=_e(n);return s.vars.add(t.index),s}#T(t,e){switch(t.kind){case"Literal":case"This":case"Super":return e;case"InstanceOf":return this.#T(t.expression,e);case"ClassLiteral":return e;case"Lambda":{let n=e;t.captures?.forEach((r,a)=>n=this.#Cn(r,t.capturedAt[a],n));let s=[this.#x,this.#tt,this.#Q,this.#U];return t.method&&this.#en(t.method),[this.#x,this.#tt,this.#Q,this.#U]=s,n}case"MethodRef":{let n=t.receiver?this.#T(t.receiver,e):e,s=[this.#x,this.#tt,this.#Q,this.#U];return t.lambda?.method&&this.#en(t.lambda.method),[this.#x,this.#tt,this.#Q,this.#U]=s,n}case"Name":{if(t.symbol?.kind==="local"&&!t.constant)return this.#Cn(t.symbol,t.pos,e);let n=this.#nn(t);return n?this.#sn(n,t.pos,e):e}case"Parenthesized":return this.#T(t.expression,e);case"FieldAccess":{let n=this.#nn(t);return n?this.#sn(n,t.pos,e):this.#T(t.target,e)}case"MethodCall":{let n=t.target?this.#T(t.target,e):e;for(let s of t.args)n=this.#T(s,n);return n}case"NewObject":{let n=t.outerExpression?this.#T(t.outerExpression,e):e;for(let s of t.args)n=this.#T(s,n);return n}case"Conditional":{let n=this.#dt(t.condition,e);return vt(this.#T(t.whenTrue,n.whenTrue),this.#T(t.whenFalse,n.whenFalse))}case"Unary":if(t.operator==="!"){let n=this.#dt(t,e);return vt(n.whenTrue,n.whenFalse)}return this.#T(t.operand,e);case"IncDec":{let n=nt(t.operand);n.kind==="Name"&&n.symbol?.kind==="local"&&this.#us(n.symbol,n.pos);let s=this.#nn(nt(t.operand));return s?this.#hs(s,nt(t.operand).pos,this.#sn(s,nt(t.operand).pos,e)):this.#T(t.operand,e)}case"Cast":return this.#T(t.expression,e);case"ArrayAccess":return this.#T(t.index,this.#T(t.array,e));case"NewArray":{let n=e;for(let s of t.dimensions)n=this.#T(s,n);return t.initializer?this.#kn(t.initializer,n):n}case"SwitchExpression":return this.#Wr(t,e);case"Binary":{if(t.operator==="&&"||t.operator==="||"){let n=this.#dt(t,e);return vt(n.whenTrue,n.whenFalse)}return this.#T(t.right,this.#T(t.left,e))}case"Assignment":{let n=nt(t.target);if(n.kind==="Name"&&n.symbol?.kind==="local"){let r=t.operator==="="?e:this.#Cn(n.symbol,n.pos,e);return r=this.#T(t.value,r),this.#us(n.symbol,n.pos),Ne(r,n.symbol.index)}let s=this.#nn(n);if(s){let r=t.operator==="="?e:this.#sn(s,n.pos,e);return r=this.#T(t.value,r),this.#hs(s,n.pos,r)}return this.#T(t.value,this.#T(t.target,e))}}}#us(t,e){t.isFinal&&(t.forEach?this.#Se(e,`variable ${t.name} might already have been assigned`):(t.parameter!==void 0||t.catchParameter)&&this.#Se(e,`final parameter ${t.name} may not be assigned`))}#hs(t,e,n){if(!Kn(n,t.index)){let s=this.#tt?"might be assigned in loop":"might already have been assigned";this.#Se(e,`variable ${t.field.name} ${s}`)}return Ne(n,t.index)}};function oe(i,t){return`${i}(${t.map(Me).join(",")})`}function Xo(i,t){if(i.tag==="library"&&t.tag==="library"){if(!i.args.length||i.args.some(n=>n.tag==="wildcard"))return!1;let e=Pt(i,t.symbol);return e!==null&&e.symbol!==i.symbol&&et(e,t)}if(i.tag!=="class"||!i.args?.length||i.args.some(e=>e.tag==="wildcard"))return!1;if(t.tag==="library"){let e=Ie(i).map(n=>Pt(n,t.symbol)).find(n=>n);return e!=null&&et(e,t)}if(t.tag==="class"){let e=Zt(i,t.symbol);return e!==null&&e.symbol!==i.symbol&&et(e,t)}return!1}function qn(i,t,e){return`${oe(i,t)}${Me(e)}`}function Fe(i){return i.tag==="long"||i.tag==="double"?2:1}function me(i,t){let e=n=>n.some(s=>me(s,t));switch(i.kind){case"BreakStatement":return i.target===t;case"Block":return e(i.statements);case"IfStatement":return me(i.then,t)||i.otherwise!==null&&me(i.otherwise,t);case"WhileStatement":case"DoStatement":case"ForStatement":case"ForEachStatement":case"LabeledStatement":return me(i.body,t);case"SwitchStatement":return i.cases.some(n=>e(n.statements)||n.body?.kind==="Block"&&me(n.body,t));case"TryStatement":return me(i.block,t)||i.catches.some(n=>me(n.block,t))||i.finallyBlock!==null&&me(i.finallyBlock,t);default:return!1}}function ga(i){return i.qualifiedName==="java.lang.String"?"String":i.qualifiedName}function Me(i){switch(i.tag){case"typevar":return i.symbol?Me(K(i)):"Object";case"wildcard":case"object":return"Object";case"string":return"String";case"library":return i.symbol.qualifiedName;case"class":return i.symbol.binaryName;case"array":return Me(i.element)+"[]";default:return M(i)}}function Aa(i){return i.tag==="typevar"&&i.symbol?i.symbol.bounds.some(t=>Aa(t)||t.tag==="library"&&t.symbol.name==="Comparable"):i.tag==="class"?i.symbol.isEnum||pn(i.symbol).some(t=>t.symbol.name==="Comparable"):i.tag==="string"||i.tag==="library"&&(i.symbol.box!==void 0||i.symbol.name==="StringBuilder"||i.symbol.name==="StringBuffer"||i.symbol.supertypes.some(t=>t.tag==="library"&&t.symbol.name==="Comparable"))}function Ls(i){if(i.kind==="Name")return i.identifier;if(i.kind!=="FieldAccess")return null;let t=Ls(i.target);return t===null?null:`${t}.${i.name}`}function Ye(i){return`${/^[AEIOU]/i.test(i)?"an":"a"} ${i}`}function fe(i){if(!i)return;let t=i.tag==="wildcard"?i.bound??void 0:i;return t?.tag==="object"?void 0:t}var Wn={tag:"typevar",name:"?return"};function le(i,t){switch(i.tag){case"typevar":return t===null?!i.symbol:t.includes(ys(i));case"class":return i.args?.some(e=>le(e,t))??!1;case"array":return le(i.element,t);case"wildcard":return i.bound!==null&&le(i.bound,t);case"library":return i.args.some(e=>le(e,t));default:return!1}}function Is(i){if(i.tag!=="library"||!i.symbol.functional)return null;let t=i.symbol.methods.find(n=>n.name===i.symbol.functional&&!n.isStatic);if(!t)return null;let e=i.symbol.typeParams.map((n,s)=>{let r=i.args[s];return r?r.tag==="wildcard"?r.bound??H:r:H});return{params:t.params.map(n=>Yt(n,i.symbol.typeParams,e)),returnType:Yt(t.returnType,i.symbol.typeParams,e)}}function Yo(i){let t=0,e=i;for(let n=i;n;n=n.captureOf)t+=n.assignCount??0,e=n;return e.isFinal&&!e.forEach?!0:e.noInitializer?t<=1:t===0}function Qo(i){return i.kind==="MethodCall"||i.kind==="Assignment"||i.kind==="IncDec"||i.kind==="NewObject"}function Ce(i){if(i.kind==="Name")return[i.identifier];if(i.kind==="FieldAccess"){let t=Ce(i.target);return t?[...t,i.name]:null}return null}var Ia=new Set(["type","symbol","method","constant","libraryCall","ctor","fieldSymbol","captures","functional","caught","finallySlots","lambda","receiver","mathFunction","interfaceSymbol","imported"]);function Ns(i,t){if(Array.isArray(i)){for(let n of i)Ns(n,t);return}if(i===null||typeof i!="object")return;let e=i;e.kind==="Name"&&typeof e.identifier=="string"&&t(e.identifier,e.pos);for(let[n,s]of Object.entries(e))Ia.has(n)||s===null||typeof s!="object"||Ns(s,t)}function Zo(i,t){for(let n of i.locals)n.slot+=t;i.maxSlots+=t,i.finallySlots!==void 0&&(i.finallySlots+=t);let e=n=>{if(Array.isArray(n)){for(let a of n)e(a);return}if(n===null||typeof n!="object")return;let s=n;if(s.kind==="Lambda"||s.kind==="MethodRef"||s.kind==="ClassDeclaration")return;typeof s.liveSlots=="number"&&(s.liveSlots=s.liveSlots+t);let r=s.finallySlots;r&&typeof r.base=="number"&&(r.base+=t,r.before+=t);for(let[a,o]of Object.entries(s))!Ia.has(a)&&o&&typeof o=="object"&&e(o)};e(i.declaration.body)}function yt(i,t,e){if(!t)return;if(i.tag==="typevar"){let s=ys(i);if(e.has(s)||t.tag==="null"||t.tag==="diamond"||t.tag==="lambda"||t.tag==="error"||t.tag==="typevar"&&!t.symbol)return;let r=t.tag==="wildcard"&&t.poly?t.bound:Q(t)?Er(t):t.tag==="wildcard"?t:zt(t);r&&e.set(s,r);return}if(i.tag==="wildcard"){i.bound&&yt(i.bound,t,e);return}if(i.tag==="array"&&t.tag==="array"){if(i.element.tag==="typevar"&&!Q(t.element))return;yt(i.element,t.element,e);return}let n=s=>s.tag==="wildcard"?s.bound??H:s;if(i.tag==="library"&&(t.tag==="library"||t.tag==="class"||t.tag==="typevar")){let s=t.tag==="library"?Pt(t,i.symbol):t.tag==="class"?Ie(t).map(r=>Pt(r,i.symbol)).find(r=>r)??null:null;if(s)i.args.forEach((r,a)=>s.args[a]&&yt(r,r.tag==="typevar"&&!kr(s.args[a])?s.args[a]:n(s.args[a]),e));else if(t.tag==="typevar"&&t.symbol)for(let r of t.symbol.bounds)yt(i,r,e);return}if(i.tag==="class"&&i.args?.length&&(t.tag==="class"||t.tag==="typevar")){let s=Zt(t,i.symbol);s?.args&&i.args.forEach((r,a)=>s.args[a]&&yt(r,n(s.args[a]),e))}}function kr(i){return i.tag==="wildcard"&&i.poly!==void 0}function tl(i,t){if(i.tag!=="library"||t.tag!=="library")return null;let e=Pt(t,i.symbol);if(!e)return null;for(let[n,s]of e.args.entries()){let r=i.args[n];if(s.tag!=="wildcard"||!s.poly||!r||r.tag==="wildcard"||!s.poly.lows.some(o=>!z(o,r)))continue;let a=s.poly.lows.filter((o,c)=>s.poly.lows.findIndex(u=>et(u,o))===c);return[`inference variable ${s.poly.name} has incompatible bounds`,` equality constraints: ${M(r)}`,` lower bounds: ${[...a].reverse().map(M).join(",")}`,...s.poly.where].join(`\n`)}return null}function Er(i){return i.tag==="library"&&i.args.some(kr)?{...i,args:i.args.map(t=>kr(t)?t.bound:t)}:i}function Os(i,t,e=!1){let n=new Map;if(t?.tag!=="library")return n;let s=dt(i,i.typeParams.map(o=>({tag:"typevar",name:o}))),r=Pt(s,t.symbol),a=o=>e&&o?.tag==="object"?o:fe(o);return r&&r.args.forEach((o,c)=>a(t.args[c])&&yt(o,a(t.args[c]),n)),n}function xr(i,t){let e=new Map;if(!t)return e;let n=he(i);if(t.tag==="class"){let s=Zt(n,t.symbol);s?.args&&t.args&&s.args.forEach((r,a)=>fe(t.args[a])&&yt(r,fe(t.args[a]),e))}else if(t.tag==="library"){let s=Ie(n).map(r=>Pt(r,t.symbol)).find(r=>r);s&&s.args.forEach((r,a)=>fe(t.args[a])&&yt(r,fe(t.args[a]),e))}return e}function ba(i,t,e,n,s){t.forEach((r,a)=>{let o=e[a];if(!(!o||o.tag==="null"||o.tag==="lambda"||o.tag==="diamond"||o.tag==="error"))if(r.tag==="typevar"&&r.symbol&&i.includes(r.symbol.key)){let c=Q(o)?Er(o):zt(o);if(!c)return;let u=s.get(r.symbol.key)??[];u.some(d=>et(d,c))||u.push(c),s.set(r.symbol.key,u)}else yt(r,o,n)})}function Ta(i,t,e){if(!Yn([t]).length||!Q(e))return;let n=K(e);n.tag!=="object"&&n.tag!=="null"&&!z(K(t),n)&&(i.genericCast=n)}function el(i,t){if(t.some(s=>"all"in s))return!0;let e=t.flatMap(s=>"pattern"in s?[s.pattern]:[]),n=t.flatMap(s=>"constantOf"in s?[s]:[]);return Ar(i,e,n,new Set)}function Ar(i,t,e,n){let s=K(i);if(t.some(o=>o.kind==="TypePattern"&&o.tested&&z(s,K(o.tested))))return!0;let r=i.tag==="typevar"&&i.symbol?sl(i):i;if(r.tag!=="class")return!1;let a=r.symbol;if(n.has(a))return!1;if(a.isEnum){let o=new Set(e.filter(c=>c.constantOf===a).map(c=>c.ordinal));return a.enumConstants.every(c=>o.has(c.enumConstant.ordinal))}if(a.isSealed&&a.permitted){if(!a.isAbstract)return!1;let o=new Set(n).add(a);return a.permitted.every(c=>Ar(X(c),t,e,o))}if(a.isRecord){let o=t.filter(u=>u.kind==="RecordPattern"&&u.tested?.tag==="class"&&u.tested.symbol===a);if(!o.length)return!1;let c=a.components.map(u=>u.type);return Oa(c,o.map(u=>u.components),n)}return!1}function Oa(i,t,e){if(!i.length)return t.length>0;let[n,...s]=i;return La(n).every(r=>{let a=t.filter(o=>nl(o[0],r,e));return Oa(s,a.map(o=>o.slice(1)),e)})}function La(i){return i.tag==="class"&&i.symbol.isSealed&&i.symbol.isAbstract&&i.symbol.permitted?i.symbol.permitted.flatMap(t=>La(X(t))):[i]}function nl(i,t,e){return i.kind==="TypePattern"?i.unconditional===!0||i.tested!==void 0&&(Z(t)?et(t,i.tested):z(K(t),K(i.tested))):t.tag==="class"&&Ar(t,[i],[],e)}function sl(i){return i.symbol?.bounds[0]??H}function Cr(i,t=!1){let e=[];for(let n of t?i.members:[...i.members,...i.anonymousClasses??[]])!t&&(n.anonymous||n.local)&&n.hierarchyState!==2||e.push(...Cr(n,t),n);return e}function Sa(i){return i.declaration.params[i.declaration.params.length-1]?.varargs===!0}function xa(i,t){let e=i.params[i.params.length-1];return!i.varargs||e?.tag!=="array"||t.length===i.params.length&&t[t.length-1].tag==="array"?i.params:[...i.params.slice(0,-1),...t.slice(i.params.length-1).map(()=>e.element)]}function rl(i,t){if(!i.varargs||i.problem||t.length<i.params.length-1)return null;let e=i.params[i.params.length-1].element;for(let n=i.params.length-1;n<t.length;n++)if(!re(e,t[n]))return`varargs mismatch; ${je(e,t[n])}`;return null}function wn(i){switch(i.tag){case"typevar":return!1;case"array":return wn(i.element);case"library":return i.args.every(t=>t.tag==="wildcard"&&!t.bound);case"class":return(i.args??[]).every(t=>t.tag==="wildcard"&&!t.bound);default:return!0}}function il(i,t){let e=n=>n.tag!=="wildcard"&&n.tag!=="typevar"&&wn(n);if(i.tag==="library"&&t.tag==="library"&&i.args.length){let n=Pt(t,i.symbol);return n!==null&&n.args.some((s,r)=>e(s)&&e(i.args[r])&&!et(s,i.args[r]))}if(i.tag==="class"&&t.tag==="class"&&i.args?.length){let n=Zt(t,i.symbol);return n?.args!==void 0&&n.args.some((s,r)=>e(s)&&e(i.args[r])&&!et(s,i.args[r]))}return!1}function al(i){return i.tag==="string"||i.tag==="class"||i.tag==="array"||i.tag==="library"&&i.symbol.box!==void 0}function va(i,t,e){if(!t.varargs||t.name!=="of"||!["List","Set"].includes(i.name)||e>10||t.params.length!==1)return t;let n=t.params[0].element;return{...t,varargs:!1,params:Array.from({length:e},()=>n)}}function xn(i,t,e){let n=[],s=a=>{a.tag==="typevar"&&!a.symbol&&!n.includes(a.name)?n.push(a.name):a.tag==="array"?s(a.element):a.tag==="wildcard"&&a.bound?s(a.bound):a.tag==="library"&&a.args.forEach(s)};if(i.forEach(s),!n.length)return[];let r=[n.length===1?` where ${n[0]} is a type-variable:`:` where ${n.join(",")} are type-variables:`];for(let a of n)if(e?.typeParams?.includes(a)){let o=e.typeParamBounds?.[a],c=e.params.map((u,d)=>e.varargs&&d===e.params.length-1&&u.tag==="array"?`${M(u.element)}...`:M(u));r.push(` ${a} extends ${e.typeParamShown?.[a]??(o?M(o):"Object")} declared in method <${e.typeParams.join(",")}>${e.name}(${c.join(",")})`)}else r.push(` ${a} extends Object declared in ${t.isInterface?"interface":"class"} ${t.name}`);return r}function Qe(i,t){if(i.tag==="array"&&t.tag==="array")return Q(i.element)&&Qe(i.element,t.element);let e=t.tag==="library"&&t.symbol.typeParams.length>0&&!t.args.length||t.tag==="class"&&(t.symbol.typeParams?.length??0)>0&&!t.args?.length,n=i.tag==="library"?i.args:i.tag==="class"?i.args??[]:[],s=n.length>0&&!n.every(r=>r.tag==="wildcard"&&!r.bound);return e&&s&&z(t,K(i))}function ol(i,t){let e=!1;return Ns(i,n=>{n===t&&(e=!0)}),e}function vr(i,t){if(z(i,t))return t;if(z(t,i))return i;let e=[],n=[i];for(;n.length;){let r=n.shift(),a=r.tag==="class"?Dn(r):r.tag==="library"?fr(r):[];for(let o of a)e.some(c=>et(c,o))||(e.push(o),n.push(o))}let s=e.filter(r=>z(t,r)&&!et(r,H));return s.find(r=>r.tag==="class"&&!r.symbol.isInterface)??s.find(r=>r.tag==="class")??s.find(r=>r.tag==="library"&&!r.symbol.isInterface)??H}function ll(i){return i.tag==="wildcard"?i.bound??H:i}function $e(i){return i.tag==="wildcard"?i.isSuper?H:i.bound??H:i}function Yn(i,t=[]){let e=n=>{switch(n.tag){case"typevar":n.symbol&&!t.includes(n.symbol)&&t.push(n.symbol);return;case"array":return e(n.element);case"wildcard":n.bound&&e(n.bound);return;case"library":return n.args.forEach(e);case"class":return n.args?.forEach(e)}};return i.forEach(e),t}function Dt(i){let t=Yn(i);if(!t.length)return[];let e=[t.length===1?` where ${t[0].name} is a type-variable:`:` where ${t.map(n=>n.name).join(",")} are type-variables:`];for(let n of t)e.push(` ${n.name} extends ${n.bounds.length?n.bounds.map(M).join(","):"Object"} declared in ${n.declaredIn}`);return e}function cl(i,t,e,n){if(et(i,t))return i;if(i.tag==="byte"&&t.tag==="short"||i.tag==="short"&&t.tag==="byte")return yn;let s={byte:[-128,127],short:[-32768,32767],char:[0,65535]},r=(a,o)=>{let c=s[a.tag];return c!==void 0&&o?.kind==="int"&&o.value>=c[0]&&o.value<=c[1]};return r(i,n)?i:r(t,e)?t:Xn(i,t)}function wa(i,t){return et(i,t)?i:i.tag==="null"?t:t.tag==="null"?i:H}function vn(i,t){return Ot(t)?ra(i,t.tag)??i:i}function ul(i,t,e){let n=vn(t,e);switch(n.kind){case"int":return q(i==="-"?-n.value:i==="~"?~n.value:n.value);case"long":return Jt(i==="-"?-n.value:i==="~"?~n.value:n.value);case"double":return ee(i==="-"?-n.value:n.value);case"float":return de(i==="-"?-n.value:n.value)}}function hl(i,t,e,n){if(i==="+"&&(t.kind==="string"||e.kind==="string"))return br(Fn(t)+Fn(e));let s=t.kind==="double"||e.kind==="double"?"double":t.kind==="float"||e.kind==="float"?"float":t.kind==="long"||e.kind==="long"?"long":"int",r=i==="<<"||i===">>"||i===">>>";if(n?.tag==="long"||!r&&s==="long"&&t.kind!=="boolean"){if(r){let d=bn(t),h=bn(e);if(d===void 0||h===void 0)return;let m=BigInt(Number(BigInt.asUintN(6,h)));return i==="<<"?Jt(d<<m):i===">>"?Jt(d>>m):Jt(BigInt.asUintN(64,d)>>m)}let c=bn(t),u=bn(e);if(c===void 0||u===void 0)return;switch(i){case"+":return Jt(c+u);case"-":return Jt(c-u);case"*":return Jt(c*u);case"/":return u===0n?void 0:Jt(c/u);case"%":return u===0n?void 0:Jt(c%u);case"&":return Jt(c&u);case"|":return Jt(c|u);case"^":return Jt(c^u);case"<":return bt(c<u);case">":return bt(c>u);case"<=":return bt(c<=u);case">=":return bt(c>=u);case"==":return bt(c===u);case"!=":return bt(c!==u)}return}if((s==="double"||s==="float")&&!r){let c=s==="float",u=c?xs(t):Un(t),d=c?xs(e):Un(e);if(u===void 0||d===void 0)return;let h=c?de:ee;switch(i){case"+":return h(u+d);case"-":return h(u-d);case"*":return h(u*d);case"/":return h(u/d);case"%":return h(u%d);case"<":return bt(u<d);case">":return bt(u>d);case"<=":return bt(u<=d);case">=":return bt(u>=d);case"==":return bt(u===d);case"!=":return bt(u!==d)}return}let a=gn(t),o=t.kind==="long"||e.kind==="long"?e.kind==="long"?Number(BigInt.asIntN(32,e.value)):gn(e):gn(e);if(a!==void 0&&o!==void 0){switch(i){case"+":return q(a+o);case"-":return q(a-o);case"*":return q(Math.imul(a,o));case"/":return o===0?void 0:q(a/o);case"%":return o===0?void 0:q(a%o);case"<<":return q(a<<o);case">>":return q(a>>o);case">>>":return q(a>>>o);case"&":return q(a&o);case"|":return q(a|o);case"^":return q(a^o);case"<":return bt(a<o);case">":return bt(a>o);case"<=":return bt(a<=o);case">=":return bt(a>=o);case"==":return bt(a===o);case"!=":return bt(a!==o)}return}if(t.kind==="boolean"&&e.kind==="boolean"){let c=t.value,u=e.value;switch(i){case"&&":case"&":return bt(c&&u);case"||":case"|":return bt(c||u);case"^":case"!=":return bt(c!==u);case"==":return bt(c===u)}return}if(t.kind==="string"&&e.kind==="string"&&(i==="=="||i==="!=")){let c=t.value===e.value;return bt(i==="=="?c:!c)}}var l={ICONST:1,SCONST:2,ACONST_NULL:3,LOAD:4,STORE:5,POP:6,DUP:7,DUP_X1:8,DUP_X2:9,DUP2:24,IADD:10,ISUB:11,IMUL:12,IDIV:13,IREM:14,INEG:15,ISHL:16,ISHR:17,IUSHR:18,IAND:19,IOR:20,IXOR:21,INOT:22,BNOT:23,I2C:25,ICMPEQ:30,ICMPNE:31,ICMPLT:32,ICMPLE:33,ICMPGT:34,ICMPGE:35,ACMPEQ:36,ACMPNE:37,JUMP:40,JUMP_IF_FALSE:41,JUMP_IF_TRUE:42,IINC:43,TOSTRING_INT:50,TOSTRING_BOOL:51,TOSTRING_REF:52,SCONCAT:53,TOSTRING_CHAR:54,PRINT:60,RETURN:70,RETURN_VALUE:71,INVOKE:72,NEWARRAY:80,NEWARRAY_REF:84,ALOAD:81,ASTORE:82,ARRAYLENGTH:83,STR_LENGTH:90,STR_CHARAT:91,STR_EQUALS:92,GETSTATIC:100,PUTSTATIC:101,GETFIELD:102,PUTFIELD:103,NEW:104,VALUEOF:110,OBJ_TOSTRING:111,OBJ_HASHCODE:112,OBJ_EQUALS:113,NCONST:120,LADD:121,LSUB:122,LMUL:123,LDIV:124,LREM:125,LNEG:126,LSHL:127,LSHR:128,LUSHR:129,LAND:130,LOR:131,LXOR:132,DADD:133,DSUB:134,DMUL:135,DDIV:136,DREM:137,DNEG:138,L2I:139,L2D:140,D2I:141,D2L:142,TOSTRING_LONG:143,TOSTRING_DOUBLE:144,NEWMULTI:145,CHECKNULL:146,MATH:147,INVOKE_NATIVE:148,BOX:149,UNBOX:150,STR_TOCHARS:151,LAMBDA:152,STR_COMPARETO:153,HOST_ARG:154,HOST_RESULT:155,INVOKE_VIRTUAL:156,CHECKCAST:157,INSTANCEOF:158,OBJ_SUPER:159,ENUM_VALUEOF:160,ATHROW:161,THROWABLE:162,I2B:163,I2S:164,I2F:165,L2F:166,D2F:167,FADD:168,FSUB:169,FMUL:170,FDIV:171,FREM:172,TOSTRING_FLOAT:173,IF_CMP:180,IF_K:181,IF_LL:182,IF_LK:183,IF_LNULL:184,LOAD2:185,LOADK:186,IADDK:187,IINC_JUMP:188,ALOAD_LL:189,IOPK:190,SET_BASE:191,BASE:192},jt={FILL_TRACE:0,PRINT_TRACE:1,ADD_SUPPRESSED:2,GET_SUPPRESSED:3,CLASS_NAME:4,PRINT_UNCAUGHT:5,INIT_CAUSE:6},dl=[[1,1],[1,0],[2,0],[1,1],[1,1],[1,0],[2,1]],Pe={INT:0,LONG:1,DOUBLE:2,CHAR:3,BOOLEAN:4,FLOAT:5,BYTE:6,SHORT:7},Ir=["int","long","double","char","boolean","float","byte","short"],lt={ABS_I:0,ABS_L:1,ABS_D:2,MAX_I:3,MAX_L:4,MAX_D:5,MIN_I:6,MIN_L:7,MIN_D:8,SQRT:9,FLOOR:10,CEIL:11,ROUND:12,ROUND_F:13},ml=[1,1,1,2,2,2,2,2,2,1,1,1,1,1],kt={NONE:0,INT:1,BOOLEAN:2,STRING:3,CHAR:4,CHAR_ARRAY:5,OBJECT:6,LONG:7,DOUBLE:8,FLOAT:9},W={INT:0,BOOLEAN:1,CHAR:2,REF:3,LONG:4,DOUBLE:5,BYTE:6,SHORT:7,FLOAT:8},tn={};for(let[i,t]of Object.entries(l))tn[t]={name:i,operands:0,pop:0,push:0};var V=(i,t,e,n)=>Object.assign(tn[i],{operands:t,pop:e,push:n});V(l.ICONST,1,0,1);V(l.SCONST,1,0,1);V(l.ACONST_NULL,0,0,1);V(l.LOAD,1,0,1);V(l.STORE,1,1,0);V(l.POP,0,1,0);V(l.SET_BASE,0,2,0);V(l.BASE,0,1,1);V(l.DUP,0,1,2);V(l.DUP_X1,0,2,3);V(l.DUP_X2,0,3,4);V(l.DUP2,0,2,4);for(let i of[l.IADD,l.ISUB,l.IMUL,l.IDIV,l.IREM,l.ISHL,l.ISHR,l.IUSHR,l.IAND,l.IOR,l.IXOR])V(i,0,2,1);for(let i of[l.ICMPEQ,l.ICMPNE,l.ICMPLT,l.ICMPLE,l.ICMPGT,l.ICMPGE,l.ACMPEQ,l.ACMPNE])V(i,0,2,1);for(let i of[l.INEG,l.INOT,l.BNOT,l.I2C,l.TOSTRING_INT,l.TOSTRING_BOOL,l.TOSTRING_REF,l.TOSTRING_CHAR])V(i,0,1,1);V(l.JUMP,1,0,0);V(l.JUMP_IF_FALSE,1,1,0);V(l.JUMP_IF_TRUE,1,1,0);V(l.IINC,2,0,0);V(l.SCONCAT,0,2,1);V(l.PRINT,3,0,0);V(l.RETURN,0,0,0);V(l.RETURN_VALUE,0,1,0);V(l.INVOKE,2,0,0);V(l.NEWARRAY,1,1,1);V(l.NEWARRAY_REF,1,1,1);V(l.ALOAD,2,2,1);V(l.ASTORE,2,3,0);V(l.ARRAYLENGTH,1,1,1);V(l.STR_LENGTH,1,1,1);V(l.STR_CHARAT,1,2,1);V(l.STR_EQUALS,1,2,1);V(l.GETSTATIC,1,0,1);V(l.PUTSTATIC,1,1,0);V(l.GETFIELD,2,1,1);V(l.PUTFIELD,2,2,0);V(l.NEW,1,0,1);V(l.VALUEOF,0,1,1);V(l.OBJ_TOSTRING,1,1,1);V(l.OBJ_HASHCODE,1,1,1);V(l.OBJ_EQUALS,1,2,1);V(l.NCONST,1,0,1);for(let i of[l.LADD,l.LSUB,l.LMUL,l.LDIV,l.LREM,l.LSHL,l.LSHR,l.LUSHR,l.LAND,l.LOR,l.LXOR])V(i,0,2,1);for(let i of[l.DADD,l.DSUB,l.DMUL,l.DDIV,l.DREM])V(i,0,2,1);for(let i of[l.LNEG,l.DNEG,l.L2I,l.L2D,l.D2I,l.D2L,l.TOSTRING_LONG,l.TOSTRING_DOUBLE])V(i,0,1,1);for(let i of[l.I2B,l.I2S,l.I2F,l.L2F,l.D2F,l.TOSTRING_FLOAT])V(i,0,1,1);for(let i of[l.FADD,l.FSUB,l.FMUL,l.FDIV,l.FREM])V(i,0,2,1);V(l.NEWMULTI,2,0,1);V(l.CHECKNULL,1,1,0);V(l.MATH,1,0,1);V(l.INVOKE_NATIVE,2,0,0);V(l.BOX,1,1,1);V(l.UNBOX,2,1,1);V(l.STR_TOCHARS,1,1,1);V(l.LAMBDA,5,0,1);V(l.STR_COMPARETO,2,2,1);V(l.HOST_ARG,1,0,1);V(l.HOST_RESULT,0,1,0);V(l.INVOKE_VIRTUAL,2,0,0);V(l.CHECKCAST,1,1,1);V(l.INSTANCEOF,1,1,1);V(l.OBJ_SUPER,1,0,1);V(l.ENUM_VALUEOF,1,1,1);V(l.ATHROW,1,1,0);V(l.THROWABLE,1,0,0);V(l.IF_CMP,2,2,0);V(l.IF_K,3,1,0);V(l.IF_LL,4,0,0);V(l.IF_LK,4,0,0);V(l.IF_LNULL,3,0,0);V(l.LOAD2,2,0,2);V(l.LOADK,2,0,2);V(l.IADDK,1,1,1);V(l.IINC_JUMP,3,0,0);V(l.ALOAD_LL,4,0,1);V(l.IOPK,2,1,1);var Or={[l.IF_CMP]:2,[l.IF_K]:3,[l.IF_LL]:4,[l.IF_LK]:4,[l.IF_LNULL]:3,[l.IINC_JUMP]:3},fl={[l.IF_LL]:[2,3],[l.IF_LK]:[2],[l.IF_LNULL]:[2],[l.LOAD2]:[1,2],[l.LOADK]:[1],[l.IINC_JUMP]:[1],[l.ALOAD_LL]:[1,2]},Lr=new Set([l.IMUL,l.IDIV,l.IREM,l.IAND,l.IOR,l.IXOR,l.ISHL,l.ISHR,l.IUSHR]),pl=new Set([l.IF_CMP,l.IF_K,l.IF_LL,l.IF_LK]),yl=new Set([l.ATHROW,l.ARRAYLENGTH,l.STR_LENGTH,l.STR_CHARAT,l.STR_EQUALS,l.OBJ_TOSTRING,l.OBJ_HASHCODE,l.OBJ_EQUALS,l.CHECKNULL,l.STR_TOCHARS,l.STR_COMPARETO]),gl=new Set([l.ALOAD,l.ASTORE,l.INVOKE,l.INVOKE_VIRTUAL,l.GETFIELD,l.PUTFIELD,l.INVOKE_NATIVE,l.UNBOX,l.STR_COMPARETO]),Na=new Set(["removeEldestEntry(Entry)"]),st=class extends Error{constructor(t){super(`invalid bytecode: ${t}`),this.name="BytecodeError"}};function $a(i,t){let e=t.classes??[],n=Math.max(0,...e.map(d=>d.instanceFieldIsReference.length)),s=i.code,r=new Set;for(let d=0;d<s.length;){let h=tn[s[d]];if(!h)throw new st(`unknown opcode ${s[d]} at ${d}`);if(r.add(d),d+=1+h.operands,d>s.length)throw new st("truncated instruction at end")}let a=new Map,o=[[0,0]],c=i.handlers??new Int32Array(0);if(c.length%4!==0)throw new st("bad handler table");for(let d=0;d<c.length;d+=4){let[h,m,p,b]=[c[d],c[d+1],c[d+2],c[d+3]];if(!r.has(h)||!(r.has(m)||m===s.length)||m<=h||!r.has(p))throw new st(`bad handler ${d/4}`);if(b<-1||b>=t.strings.length)throw new st(`bad handler type ${d/4}`);o.push([p,1])}let u=0;for(;o.length;){let[d,h]=o.pop(),m=d,p=h;for(;;){if(!r.has(m))throw new st(`control reaches non-instruction offset ${m}`);let b=a.get(m);if(b!==void 0){if(b!==p)throw new st(`stack height ${p} != ${b} at merge ${m}`);break}a.set(m,p);let S=s[m],v=tn[S],x=v.pop,C=v.push;if(S===l.PRINT&&(x=s[m+3]===kt.NONE?0:1),S===l.NEWMULTI&&(x=s[m+2]),S===l.MATH){let I=ml[s[m+1]];if(I===void 0)throw new st(`bad Math function at ${m}`);x=I}if(S===l.INVOKE||S===l.INVOKE_VIRTUAL){let I=t.methods[s[m+1]];if(!I)throw new st(`call to unknown method ${s[m+1]} at ${m}`);x=I.argCount,C=I.returnsValue?1:0}if(S===l.INVOKE_NATIVE){let I=t.natives?.[s[m+1]];if(!I)throw new st(`call to unknown native ${s[m+1]} at ${m}`);x=I.argCount,C=I.returnsValue?1:0}if((S===l.BOX||S===l.UNBOX)&&(s[m+1]<0||s[m+1]>=Ir.length))throw new st(`bad box kind at ${m}`);if(S===l.LAMBDA){let I=t.methods[s[m+1]],N=s[m+2];if(!I||N<0||N>I.argCount)throw new st(`bad lambda method at ${m}`);if(s[m+3]<0||s[m+3]>=t.strings.length||s[m+5]>=t.strings.length)throw new st(`bad lambda interface at ${m}`);x=N}if(S===l.NEW&&(s[m+1]<0||s[m+1]>=e.length))throw new st(`bad class index at ${m}`);if(S===l.INVOKE_VIRTUAL&&t.methods[s[m+1]]?.selector===void 0)throw new st(`virtual call to a method without a selector at ${m}`);if(S===l.THROWABLE){let I=dl[s[m+1]];if(!I)throw new st(`bad Throwable operation at ${m}`);[x,C]=I}if(S===l.OBJ_SUPER){let I=s[m+1];if(I<0||I>2)throw new st(`bad Object method at ${m}`);x=I===2?2:1}if((S===l.NEWARRAY_REF||S===l.NEWMULTI||S===l.CHECKCAST||S===l.INSTANCEOF)&&(s[m+1]<0||s[m+1]>=t.strings.length))throw new st(`bad descriptor index at ${m}`);if(S===l.NEWMULTI&&s[m+2]<2)throw new st(`NEWMULTI needs two or more lengths at ${m}`);if(S===l.NCONST&&(s[m+1]<0||s[m+1]>=(t.numbers?.length??0)))throw new st(`bad number index at ${m}`);if(p<x)throw new st(`stack underflow at ${m} (${v.name})`);if(p=p-x+C,u=Math.max(u,p),S===l.LOAD||S===l.STORE||S===l.IINC){let I=s[m+1];if(I<0||I>=i.maxLocals)throw new st(`bad local slot ${I} at ${m}`)}for(let I of fl[S]??[]){let N=s[m+I];if(N<0||N>=i.maxLocals)throw new st(`bad local slot ${N} at ${m}`)}if(S===l.IOPK&&!Lr.has(s[m+1]))throw new st(`bad operator at ${m}`);if(S===l.IOPK&&(s[m+1]===l.IDIV||s[m+1]===l.IREM)&&s[m+2]===0)throw new st(`division by a zero constant at ${m}`);if(pl.has(S)&&(s[m+1]<0||s[m+1]>11))throw new st(`bad condition at ${m}`);if(S===l.ALOAD_LL&&(s[m+4]<-1||s[m+4]>=t.messages.length))throw new st(`bad message index at ${m}`);if(S===l.SCONST&&(s[m+1]<0||s[m+1]>=t.strings.length))throw new st(`bad string index at ${m}`);if(S===l.GETSTATIC||S===l.PUTSTATIC||S===l.GETFIELD||S===l.PUTFIELD){let I=S<=l.PUTSTATIC?t.staticFieldIsReference?.length??0:n;if(s[m+1]<0||s[m+1]>=I)throw new st(`bad field index at ${m}`)}let E=gl.has(S)?s[m+2]:yl.has(S)?s[m+1]:null;if(E!==null&&(E<-1||E>=t.messages.length))throw new st(`bad message index at ${m}`);if(S===l.RETURN||S===l.RETURN_VALUE){if(S===l.RETURN_VALUE!==i.returnsValue)throw new st(`wrong return kind at ${m}`);if(p!==0)throw new st(`return with non-empty stack at ${m}`);break}if(S===l.ATHROW)break;let R=m+1+v.operands,L=Or[S];if(L!==void 0){let I=s[m+L];if(!r.has(I))throw new st(`jump to ${I} at ${m}`);if(o.push([I,p]),S===l.IINC_JUMP)break}if(S===l.JUMP||S===l.JUMP_IF_FALSE||S===l.JUMP_IF_TRUE){let I=s[m+1];if(!r.has(I))throw new st(`jump to ${I} at ${m}`);if(o.push([I,p]),S===l.JUMP)break}if(R>=s.length)throw new st(`falls off the end at ${m}`);m=R}}return u}function Ma(i,t){let e=i.lines,n=0;for(let s=0;s<e.length&&!(e[s]>t);s+=2)n=e[s+1];return n}var bl=l.ICMPEQ,$s=i=>i!==void 0&&i>=l.ICMPEQ&&i<=l.ICMPGE,Ms=(i,t)=>i-bl+(t===l.JUMP_IF_FALSE?6:0),Zn=i=>i===l.JUMP_IF_FALSE||i===l.JUMP_IF_TRUE;function Pa(i){let t=i.code,e=[];for(let u=0;u<t.length;u+=1+tn[t[u]].operands)e.push(u);let n=new Set;for(let u of e){let d=t[u];(d===l.JUMP||d===l.JUMP_IF_FALSE||d===l.JUMP_IF_TRUE)&&n.add(t[u+1])}let s=i.handlers??new Int32Array(0);for(let u=0;u<s.length;u+=4)n.add(s[u]).add(s[u+1]).add(s[u+2]);for(let u=0;u<i.lines.length;u+=2)n.add(i.lines[u]);let r=[],a=new Map,o=[];for(let u=0;u<e.length;){let d=C=>e[u+C],h=C=>d(C)===void 0?void 0:t[d(C)],m=(C,E=1)=>t[d(C)+E],p=C=>{for(let E=1;E<C;E++)if(d(E)===void 0||n.has(d(E)))return!1;return!0},b=(C,...E)=>{let R=r.length;for(let I=0;I<C;I++)a.set(d(I),R);r.push(...E);let L=Or[E[0]];L!==void 0&&o.push(R+L),u+=C},S=h(0);if(S===l.LOAD&&h(1)===l.LOAD&&$s(h(2))&&Zn(h(3))&&p(4)){b(4,l.IF_LL,Ms(h(2),h(3)),m(0),m(1),m(3));continue}if(S===l.LOAD&&h(1)===l.ICONST&&$s(h(2))&&Zn(h(3))&&p(4)){b(4,l.IF_LK,Ms(h(2),h(3)),m(0),m(1),m(3));continue}if(S===l.LOAD&&h(1)===l.ACONST_NULL&&(h(2)===l.ACMPEQ||h(2)===l.ACMPNE)&&Zn(h(3))&&p(4)){let C=h(2)===l.ACMPEQ==(h(3)===l.JUMP_IF_TRUE);b(4,l.IF_LNULL,C?1:0,m(0),m(3));continue}if(S===l.ICONST&&$s(h(1))&&Zn(h(2))&&p(3)){b(3,l.IF_K,Ms(h(1),h(2)),m(0),m(2));continue}if($s(S)&&Zn(h(1))&&p(2)){b(2,l.IF_CMP,Ms(S,h(1)),m(1));continue}if(S===l.LOAD&&h(1)===l.LOAD&&h(2)===l.ALOAD&&p(3)){b(3,l.ALOAD_LL,m(0),m(1),m(2),m(2,2));continue}if(S===l.ICONST&&(h(1)===l.IADD||h(1)===l.ISUB)&&p(2)){b(2,l.IADDK,h(1)===l.IADD?m(0):-m(0)|0);continue}if(S===l.ICONST&&Lr.has(h(1))&&p(2)&&!((h(1)===l.IDIV||h(1)===l.IREM)&&m(0)===0)){b(2,l.IOPK,h(1),m(0));continue}if(S===l.IINC&&h(1)===l.JUMP&&p(2)){b(2,l.IINC_JUMP,m(0),m(0,2),m(1));continue}if(S===l.LOAD&&h(1)===l.LOAD&&p(2)){b(2,l.LOAD2,m(0),m(1));continue}if(S===l.LOAD&&h(1)===l.ICONST&&p(2)){b(2,l.LOADK,m(0),m(1));continue}let v=d(0),x=1+tn[S].operands;a.set(v,r.length),(S===l.JUMP||S===l.JUMP_IF_FALSE||S===l.JUMP_IF_TRUE)&&o.push(r.length+1);for(let C=0;C<x;C++)r.push(t[v+C]);u++}if(r.length===t.length)return;a.set(t.length,r.length);let c=u=>{let d=a.get(u);if(d===void 0)throw new Error(`fuse: offset ${u} is not an instruction start`);return d};for(let u of o)r[u]=c(r[u]);i.code=Int32Array.from(r),i.lines=i.lines.map((u,d)=>d%2===0?c(u):u),i.handlers&&(i.handlers=i.handlers.map((u,d)=>d%4===3?u:c(u)))}var Sl=["getMessage","getLocalizedMessage","getCause","toString","fillInStackTrace"];function Pr(i,t){return i.declaration.members.filter(e=>e.kind==="Initializer"&&e.isStatic===t&&e.symbol!==void 0)}function Ra(i){return Math.max(i.maxSlots,i.finallySlots??0)}function Jr(i,t,e){let n=new Rr(t),s=i.classes.find(p=>p.binaryName==="java.lang.Throwable");n.useThrowable(s);let r=i.methods.map(p=>p.builtin?n.builtin(p):p.isAbstract?n.abstractStub(p):p.isConstructor?n.constructorCode(p):n.method(p)),a=new Map;for(let p of i.classes)for(let b of p.bridges??[])a.set(b,b.alias?b.target.index:r.push(n.bridge(p,b))-1);let o=xl(i,a),c=p=>i.selectors.get(p)??-1,u=i.classes.map(p=>{let b=p.fields.filter(N=>N.isStatic&&N.declarator.init&&!N.constant),S=Pr(p,!0),v=b.length||p.enumConstants.length||S.length?r.push(n.staticInitializer(p,b))-1:-1,x=new Array(p.instanceCount).fill(!1);for(let N=p;N;N=N.superclass){N.outerField>=0&&(x[N.outerField]=!0);for(let J of N.fields)J.isStatic||(x[J.index]=es(J.type));N===s&&x.fill(!0,mt.message,mt.causeSet)}let C=o.get(p),E=N=>c(N)>=0?C[c(N)]:-1,R={};C.forEach(N=>{if(N<0||N>=i.methods.length)return;let J=i.methods[N],D=`${J.name}/${J.params.length}`;(!(D in R)||J.owner===p)&&(R[D]=N)});let L=[];for(let N=p;N;N=N.superclass)L.unshift(N);for(let N of L)for(let J of N.bridges??[])J.library&&(R[`${J.name}/${J.params.length}`]=C[J.selector]);let I={};for(let N of L)for(let[J,D]of N.libraryOverrides??[])I[J]=C[D];return{name:p.binaryName,instanceFieldIsReference:x,clinit:v,toString:E("toString()String"),equals:E("equals(Object)boolean"),hashCode:E("hashCode()int"),superclass:p.superclass?.index??-1,isInterface:p.isInterface,types:vl(p),vtable:C,virtuals:R,...Object.keys(I).length?{libraryOverrides:I}:{},...p.isEnum?{enumConstants:p.enumConstants.map(N=>N.index),canonicalName:p.binaryName.replace(/\\$/g,".")}:{}}}),d=r.push(e?n.practiceLauncher(e):n.launcher(i))-1,h=r.push(n.uncaughtPrinter(s))-1,m={version:14,classes:u,strings:n.strings,numbers:n.numbers,natives:n.natives,messages:n.messages,methods:r,staticFieldIsReference:i.staticFields.map(p=>es(p.type)),staticFieldOwner:i.staticFields.map(p=>p.owner.index),entry:d,uncaught:h};for(let p of r)Pa(p),p.maxStack=$a(p,m);return m}function xl(i,t){let e=i.selectors.size,n=new Map,s=(a,o=[])=>{for(let c of a.interfaces)o.includes(c)||o.push(c),s(c,o);return a.superclass&&s(a.superclass,o),o},r=a=>{let o=n.get(a);if(o)return o;let c=a.superclass?r(a.superclass).slice():new Int32Array(e).fill(-1);for(let u of a.methods)u.selector!==void 0&&(c[u.selector]=u.index);for(let u of s(a))for(let d of u.methods){if(d.selector===void 0||d.isAbstract)continue;let h=c[d.selector];(h<0||i.methods[h].isAbstract)&&(c[d.selector]=d.index)}for(let u of a.bridges??[])c[u.selector]=t.get(u);return n.set(a,c),c};for(let a of i.classes)r(a);return n}function vl(i){let t=new Set,e=s=>{t.add(s.qualifiedName);for(let r of s.supertypes)r.tag==="library"&&e(r.symbol)},n=s=>{t.add(s.binaryName),s.isEnum&&t.add("java.lang.Enum").add("java.lang.Comparable");for(let r of s.libraryInterfaces)t.add(r.symbol.qualifiedName);s.librarySuperclass&&e(s.librarySuperclass.symbol),s.superclass&&n(s.superclass);for(let r of s.interfaces)n(r)};return n(i),i.isRecord&&t.add("java.lang.Record"),t.add("java.lang.Object"),[...t]}var Y=class{pc=-1;uses=[]};function Ue(i){switch(i.tag){case"int":return W.INT;case"boolean":return W.BOOLEAN;case"char":return W.CHAR;case"long":return W.LONG;case"double":return W.DOUBLE;case"byte":return W.BYTE;case"short":return W.SHORT;case"float":return W.FLOAT;case"string":case"class":case"array":case"library":case"diamond":case"object":case"typevar":return W.REF;default:throw new Error(`codegen: array of ${M(i)}`)}}var Ja=["int","byte/boolean","char","object","long","double","byte/boolean","short","float"];function kn(i){return i.tag==="class"?i.symbol.binaryName:i.tag==="array"?kn(i.element)+"[]":M(i)}function Re(i){let t=i;for(;t.kind==="Parenthesized";)t=t.expression;return t}function Nr(i){let t=Re(i);return t.kind==="Name"&&t.symbol?.kind==="type"||t.kind==="FieldAccess"&&t.typeSymbol!==void 0}function $r(i,t){return i.tag==="double"||t.tag==="double"?ht:i.tag==="float"||t.tag==="float"?xt:i.tag==="long"||t.tag==="long"?Lt:U}var wl=new Set(["int","byte","short","char","long","float","double"]),ts=i=>i!==void 0&&wl.has(i.tag),Mr=i=>i.tag==="int"||i.tag==="byte"||i.tag==="short"||i.tag==="char",Ee=i=>ts(i)||i?.tag==="boolean",ne={int:Pe.INT,long:Pe.LONG,double:Pe.DOUBLE,char:Pe.CHAR,boolean:Pe.BOOLEAN,float:Pe.FLOAT,byte:Pe.BYTE,short:Pe.SHORT},kl={int:"java.lang.Integer.intValue()",long:"java.lang.Long.longValue()",double:"java.lang.Double.doubleValue()",char:"java.lang.Character.charValue()",boolean:"java.lang.Boolean.booleanValue()",float:"java.lang.Float.floatValue()",byte:"java.lang.Byte.byteValue()",short:"java.lang.Short.shortValue()"},Cl={"+":{int:l.IADD,long:l.LADD,double:l.DADD,float:l.FADD},"-":{int:l.ISUB,long:l.LSUB,double:l.DSUB,float:l.FSUB},"*":{int:l.IMUL,long:l.LMUL,double:l.DMUL,float:l.FMUL},"/":{int:l.IDIV,long:l.LDIV,double:l.DDIV,float:l.FDIV},"%":{int:l.IREM,long:l.LREM,double:l.DREM,float:l.FREM},"<<":{int:l.ISHL,long:l.LSHL},">>":{int:l.ISHR,long:l.LSHR},">>>":{int:l.IUSHR,long:l.LUSHR},"&":{int:l.IAND,long:l.LAND},"|":{int:l.IOR,long:l.LOR},"^":{int:l.IXOR,long:l.LXOR}},Ps={"<":l.ICMPLT,"<=":l.ICMPLE,">":l.ICMPGT,">=":l.ICMPGE,"==":l.ICMPEQ,"!=":l.ICMPNE},El={"abs-int":lt.ABS_I,"abs-long":lt.ABS_L,"abs-double":lt.ABS_D,"max-int":lt.MAX_I,"max-long":lt.MAX_L,"max-double":lt.MAX_D,"min-int":lt.MIN_I,"min-long":lt.MIN_L,"min-double":lt.MIN_D,"abs-float":lt.ABS_D,"max-float":lt.MAX_D,"min-float":lt.MIN_D,"round-float":lt.ROUND_F,sqrt:lt.SQRT,floor:lt.FLOOR,ceil:lt.CEIL,"round-double":lt.ROUND},Rs=class{segments=[];start=-1;open(t){this.start<0&&(this.start=t)}close(t){this.start>=0&&t>this.start&&this.segments.push([this.start,t]),this.start=-1}},Rr=class{strings=[];numbers=[];natives=[];#O=new Map;messages=[];#mt=new Map;#Mt=new Map;#D=new Map;#j;get#W(){return this.#z?.topLevel?.file??this.#j}#z;#r=[];#y=[];#s=-1;#n=new Map;#g=U;#h=0;#i=!1;#w=[];#H=0;#c=0;#C=0;#L=0;#F=[];#K=[];#ft=Object.create(null);constructor(t){this.#j=t}#bt(t){return`${t.owner.binaryName}.${t.name}(${t.params.map(kn).join(", ")})`}#at(t,e){return`${t.qualifier??e.owner.binaryName}.${e.name}(${e.params.map(kn).join(", ")})`}#$(t,e,n){this.#z=t,this.#r=[],this.#y=[],this.#s=-1,this.#n=new Map,this.#g=n,this.#h=e,this.#w=[],this.#H=0,this.#c=0,this.#C=0,this.#L=0,this.#F=[],this.#K=[]}useThrowable(t){for(let e of t.methods)Sl.includes(e.name)&&(this.#ft[e.name]=e)}#N(t){if(t.lambda){let s=t.locals.filter(r=>r.parameter!==void 0).sort((r,a)=>r.parameter-a.parameter);return s.some(r=>r.type.tag==="long"||r.type.tag==="double")?Int32Array.from([...t.isStatic?[]:[0],...s.map(r=>r.slot)]):void 0}let e=t.declaration.params;if(!e.some(s=>s.symbol&&(s.symbol.type.tag==="long"||s.symbol.type.tag==="double")))return;let n=(t.isStatic?0:1)+(t.isConstructor&&t.owner.isInner?1:0)+(t.isConstructor&&(t.owner.isEnum||t.owner.enumBody)?2:0);return Int32Array.from([...Array.from({length:n},(s,r)=>r),...e.map(s=>s.symbol.slot)])}#gt(t,e){let n={className:t.binaryName,classIndex:t.index,isStatic:e.isStatic,name:e.name,display:e.display,file:this.#W.name,argCount:e.argCount,returnsValue:e.returnsValue,code:Int32Array.from(this.#r),lines:Int32Array.from(this.#y),maxLocals:Math.max(1,this.#h+this.#L),maxStack:0};return e.hidden&&(n.hidden=!0),this.#F.length&&(n.handlers=Int32Array.from(this.#F)),n}#a(t){return t.parameter!==void 0?`<parameter${t.parameter}>`:`<local${this.#l(t)}>`}#l(t){let e=t.slot;for(let n of this.#w)t.slot>=n.from&&(e+=n.by);return e}#E(){let t=this.#h+this.#C++;return this.#L=Math.max(this.#L,this.#C),t}#nt(){this.#C--}staticInitializer(t,e){this.#$(t,Math.max(1,...Pr(t,!0).map(n=>Ra(n.symbol))),U);for(let n of t.enumConstants){let{node:s,ordinal:r}=n.enumConstant;this.#p(s.pos),this.#t(l.NEW,s.ctor.owner.index,l.DUP,l.SCONST,this.#S(s.name),l.ICONST,r),this.#ot(s.args,s.ctor.params,s.varargs),this.#t(l.INVOKE,s.ctor.index,-1,l.PUTSTATIC,n.index)}return this.#Xt(t,!0,n=>e.includes(n),0),this.#t(l.RETURN),this.#gt(t,{name:"<clinit>",display:`${t.binaryName}.<clinit>()`,isStatic:!0,argCount:0,returnsValue:!1})}#Xt(t,e,n,s){for(let r of t.declaration.members)if(r.kind==="FieldDeclaration")for(let a of r.declarators){let o=a.field;o&&o.isStatic===e&&n(o)&&this.#_(o)}else r.kind==="Initializer"&&r.isStatic===e&&r.symbol&&(s&&this.#w.push({from:1,by:s}),this.#x(r.body),s&&this.#w.pop())}#_(t){let e=t.declarator.init;this.#p(t.declarator.pos),t.isStatic||this.#t(l.LOAD,0),e.kind==="ArrayInitializer"?this.#Qt(e):(this.#u(e,!0),this.#f(t.type,e)),t.isStatic?this.#t(l.PUTSTATIC,t.index):this.#t(l.PUTFIELD,t.index,-1)}constructorCode(t){let e=t.owner,n=e.isInner?1:e.isEnum||e.enumBody?2:0,s=t.params.length+1+n,r=1+n+t.params.reduce((m,p)=>m+(p.tag==="long"||p.tag==="double"?2:1),0),a=Pr(e,!1).map(m=>r-1+Ra(m.symbol));this.#$(e,Math.max(s,t.maxSlots,t.finallySlots??0,...a),U);let o=t.declaration.body,c=o.statements,u=c[0];if(u?.kind==="ConstructorCall"&&u.keyword==="this")this.#p(u.start),this.#t(l.LOAD,0),n&&this.#t(l.LOAD,1),n===2&&this.#t(l.LOAD,2),this.#ot(u.args,u.target.params,u.varargs),this.#t(l.INVOKE,u.target.index,-1),c=c.slice(1);else{if(e.isInner&&this.#t(l.LOAD,0,l.LOAD,1,l.PUTFIELD,e.outerField,-1),e.isEnum&&this.#t(l.LOAD,0,l.LOAD,1,l.PUTFIELD,0,-1,l.LOAD,0,l.LOAD,2,l.PUTFIELD,1,-1),u?.kind==="ConstructorCall")u.target?(this.#p(u.start),this.#t(l.LOAD,0),this.#ot(u.args,u.target.params,u.varargs),this.#t(l.INVOKE,u.target.index,-1)):u.libraryCall&&(this.#p(u.start),this.#t(l.LOAD,0),this.#ot(u.args,u.libraryCall.params),this.#t(l.INVOKE_NATIVE,this.#A(u.libraryCall.native,u.args.length,!0,u.libraryCall.unwrap,u.libraryCall.unwrapCalls),-1,l.SET_BASE)),c=c.slice(1);else if(t.forwardsToSuper){if(t.superLibrary){this.#p(o.pos),this.#t(l.LOAD,0);let m=1+n;for(let p of t.params)this.#t(l.LOAD,m),m+=p.tag==="long"||p.tag==="double"?2:1;this.#t(l.INVOKE_NATIVE,this.#A(t.superLibrary.native,t.params.length,!0,t.superLibrary.unwrap,t.superLibrary.unwrapCalls),-1,l.SET_BASE)}else if(t.superConstructor){this.#p(o.pos),this.#t(l.LOAD,0),e.enumBody&&this.#t(l.LOAD,1,l.LOAD,2);let m=1+n;for(let p of t.params)this.#t(l.LOAD,m),m+=p.tag==="long"||p.tag==="double"?2:1;this.#t(l.INVOKE,t.superConstructor.index,-1)}}else t.superConstructor?(this.#p(o.pos),this.#t(l.LOAD,0),this.#ot([],t.superConstructor.params,t.superVarargs),this.#t(l.INVOKE,t.superConstructor.index,-1)):t.superLibrary&&(this.#p(o.pos),this.#t(l.LOAD,0,l.INVOKE_NATIVE,this.#A(t.superLibrary.native,0,!0),-1,l.SET_BASE));this.#Xt(e,!1,m=>m.declarator.init!==void 0&&m.declarator.init!==null,r-1)}for(let m of c)this.#x(m);this.#p(o.end-1),t.declaration.compact&&t.declaration.params.forEach((m,p)=>this.#t(l.LOAD,0,l.LOAD,m.symbol.slot,l.PUTFIELD,e.components[p].index,-1)),this.#t(l.RETURN);let d=this.#gt(e,{name:"<init>",display:`${e.binaryName}.<init>(${t.params.map(kn).join(", ")})`,isStatic:!1,argCount:s,returnsValue:!1}),h=this.#N(t);return h&&(d.argSlots=h),d}launcher(t){let e=t.main,n=t.mainClass;return this.#$(n,1,U),e.isStatic||this.#t(l.NEW,n.index,l.DUP,l.INVOKE,t.mainConstructor.index,-1),e.params.length&&this.#t(l.ICONST,0,l.NEWARRAY,W.REF),this.#t(l.INVOKE,e.index,-1,l.RETURN),this.#y=[],this.#gt(n,{name:"<launch>",display:"<launch>",isStatic:!0,argCount:0,returnsValue:!1,hidden:!0})}practiceLauncher(t){let{method:e}=t,n=e.owner;return this.#$(n,1,U),e.isStatic||this.#t(l.NEW,n.index,l.DUP,l.INVOKE,t.constructor.index,-1),e.params.forEach((s,r)=>this.#t(l.HOST_ARG,r)),this.#t(l.INVOKE,e.index,-1),e.returnType.tag!=="void"&&this.#t(l.HOST_RESULT),this.#t(l.RETURN),this.#y=[],this.#gt(n,{name:"<practice>",display:"<practice>",isStatic:!0,argCount:0,returnsValue:!1,hidden:!0})}builtin(t){let e=t.owner,n=t.params.length+(t.isStatic?0:1);this.#$(e,Math.max(n,t.maxSlots,t.finallySlots??0),t.returnType),this.#p(e.declaration.keywordPos);let s=a=>this.#t(l.LOAD,0,l.GETFIELD,a.index,-1);switch(t.builtin){case"enum-values":this.#t(l.ICONST,e.enumConstants.length,l.NEWARRAY_REF,this.#S(`[L${e.binaryName};`)),e.enumConstants.forEach((a,o)=>this.#t(l.DUP,l.ICONST,o,l.GETSTATIC,a.index,l.ASTORE,W.REF,-1)),this.#t(l.RETURN_VALUE);break;case"enum-valueOf":this.#t(l.LOAD,0,l.ENUM_VALUEOF,e.index,l.RETURN_VALUE);break;case"enum-name":case"enum-toString":this.#t(l.LOAD,0,l.GETFIELD,0,-1,l.RETURN_VALUE);break;case"enum-ordinal":this.#t(l.LOAD,0,l.GETFIELD,1,-1,l.RETURN_VALUE);break;case"library-toString":this.#t(l.LOAD,0,l.BASE,l.INVOKE_NATIVE,this.#A("toString()",1,!0),-1,l.RETURN_VALUE);break;case"library-hashCode":this.#t(l.LOAD,0,l.BASE,l.INVOKE_NATIVE,this.#A("hashCode()",1,!0),-1,l.RETURN_VALUE);break;case"library-equals":this.#t(l.LOAD,0,l.BASE,l.LOAD,1,l.INVOKE_NATIVE,this.#A("equals(Object)",2,!0,2,["size()","get(Object)","containsKey(Object)"]),-1,l.RETURN_VALUE);break;case"enum-compareTo":this.#t(l.LOAD,0,l.GETFIELD,1,-1,l.LOAD,1,l.GETFIELD,1,this.#Vt(\'Cannot invoke "Object.getClass()" because "other" is null\'),l.ISUB,l.RETURN_VALUE);break;case"record-constructor":{let a=1;for(let o of e.components)this.#t(l.LOAD,0,l.LOAD,a,l.PUTFIELD,o.index,-1),a+=o.type.tag==="long"||o.type.tag==="double"?2:1;this.#t(l.RETURN);break}case"record-accessor":s(e.components[t.component]),this.#t(l.RETURN_VALUE);break;case"record-toString":this.#P(e);break;case"record-hashCode":this.#Bt(e);break;case"record-equals":this.#R(e);break;case"throwable-constructor":this.#M(t);break;case"throwable-getMessage":this.#t(l.LOAD,0,l.GETFIELD,mt.message,-1,l.RETURN_VALUE);break;case"throwable-getLocalizedMessage":this.#t(l.LOAD,0,l.INVOKE_VIRTUAL,this.#ft.getMessage.index,-1,l.RETURN_VALUE);break;case"throwable-getCause":this.#t(l.LOAD,0,l.GETFIELD,mt.cause,-1,l.RETURN_VALUE);break;case"throwable-initCause":this.#t(l.LOAD,0,l.LOAD,1,l.THROWABLE,jt.INIT_CAUSE,l.RETURN_VALUE);break;case"throwable-toString":{let a=new Y,o=this.#E();this.#t(l.LOAD,0,l.THROWABLE,jt.CLASS_NAME,l.LOAD,0,l.INVOKE_VIRTUAL,this.#ft.getLocalizedMessage.index,-1,l.STORE,o),this.#t(l.LOAD,o,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,a),this.#t(l.SCONST,this.#S(": "),l.SCONCAT,l.LOAD,o,l.SCONCAT),this.#m(a),this.#t(l.RETURN_VALUE),this.#nt();break}case"throwable-printStackTrace":this.#t(l.LOAD,0,l.THROWABLE,jt.PRINT_TRACE,l.RETURN);break;case"throwable-addSuppressed":this.#t(l.LOAD,0,l.LOAD,1,l.THROWABLE,jt.ADD_SUPPRESSED,l.RETURN);break;case"throwable-getSuppressed":this.#t(l.LOAD,0,l.THROWABLE,jt.GET_SUPPRESSED,l.RETURN_VALUE);break;case"throwable-fillInStackTrace":this.#t(l.LOAD,0,l.THROWABLE,jt.FILL_TRACE,l.RETURN_VALUE);break}let r=this.#gt(e,{name:t.isConstructor?"<init>":t.name,display:t.isConstructor?`${e.binaryName}.<init>(${t.params.map(kn).join(", ")})`:this.#bt(t),isStatic:t.isStatic,argCount:n,returnsValue:t.returnType.tag!=="void"});if(t.selector!==void 0&&(r.selector=t.selector),(t.builtin==="enum-name"||t.builtin==="enum-ordinal"||t.builtin==="enum-compareTo"||t.builtin==="enum-toString"||t.builtin.startsWith("throwable-"))&&(r.hidden=!0),t.builtin==="record-constructor"&&e.components.some(a=>a.type.tag==="long"||a.type.tag==="double")){let a=[0],o=1;for(let c of e.components)a.push(o),o+=c.type.tag==="long"||c.type.tag==="double"?2:1;r.argSlots=Int32Array.from(a)}return r}#M(t){let e=(n,s)=>{this.#t(l.LOAD,0),s(),this.#t(l.PUTFIELD,n,-1)};switch(this.#t(l.LOAD,0,l.INVOKE_VIRTUAL,this.#ft.fillInStackTrace.index,-1,l.POP),t.throwableConstructor){case"message":e(mt.message,()=>this.#t(l.LOAD,1));break;case"message-cause":e(mt.message,()=>this.#t(l.LOAD,1)),e(mt.cause,()=>this.#t(l.LOAD,2)),e(mt.causeSet,()=>this.#t(l.ICONST,1));break;case"cause":{let n=new Y;this.#t(l.LOAD,1,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,n),e(mt.message,()=>this.#t(l.LOAD,1,l.INVOKE_VIRTUAL,this.#ft.toString.index,-1)),this.#m(n),e(mt.cause,()=>this.#t(l.LOAD,1)),e(mt.causeSet,()=>this.#t(l.ICONST,1));break}case"index":e(mt.message,()=>this.#t(l.SCONST,this.#S(t.owner.builtin.indexPrefix),l.LOAD,1,l.TOSTRING_INT,l.SCONCAT));break;case"object":{e(mt.message,()=>this.#t(l.LOAD,1,l.VALUEOF,l.TOSTRING_REF));let n=new Y;this.#t(l.LOAD,1,l.INSTANCEOF,this.#S("Ljava.lang.Throwable;")),this.#d(l.JUMP_IF_FALSE,n),e(mt.cause,()=>this.#t(l.LOAD,1)),e(mt.causeSet,()=>this.#t(l.ICONST,1)),this.#m(n);break}}this.#t(l.RETURN)}uncaughtPrinter(t){return this.#$(t,1,U),this.#t(l.LOAD,0,l.THROWABLE,jt.PRINT_UNCAUGHT,l.RETURN),this.#gt(t,{name:"<uncaught>",display:"<uncaught>",isStatic:!0,argCount:1,returnsValue:!1,hidden:!0})}#k(t){this.#t(l.LOAD,0,l.GETFIELD,t.index,-1);let e={int:l.TOSTRING_INT,byte:l.TOSTRING_INT,short:l.TOSTRING_INT,char:l.TOSTRING_CHAR,boolean:l.TOSTRING_BOOL,long:l.TOSTRING_LONG,float:l.TOSTRING_FLOAT,double:l.TOSTRING_DOUBLE}[t.type.tag];e!==void 0?this.#t(e):this.#t(l.VALUEOF,l.TOSTRING_REF)}#P(t){t.components.forEach((e,n)=>{this.#t(l.SCONST,this.#S(`${n===0?`${t.name}[`:", "}${e.name}=`)),n>0&&this.#t(l.SCONCAT),this.#k(e),this.#t(l.SCONCAT)}),this.#t(l.SCONST,this.#S(t.components.length?"]":`${t.name}[]`)),t.components.length&&this.#t(l.SCONCAT),this.#t(l.RETURN_VALUE)}#Bt(t){this.#t(l.ICONST,0);for(let e of t.components){this.#t(l.ICONST,31,l.IMUL,l.LOAD,0,l.GETFIELD,e.index,-1);let n=ne[e.type.tag];if(n!==void 0)this.#t(l.BOX,n,l.OBJ_HASHCODE,-1);else{let s=new Y,r=new Y;this.#t(l.DUP,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,s),this.#t(l.OBJ_HASHCODE,-1),this.#d(l.JUMP,r),this.#m(s),this.#t(l.POP,l.ICONST,0),this.#m(r)}this.#t(l.IADD)}this.#t(l.RETURN_VALUE)}#R(t){let e=new Y,n=new Y;this.#t(l.LOAD,0,l.LOAD,1,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,e),this.#t(l.LOAD,1,l.INSTANCEOF,this.#S(`L${t.binaryName};`)),this.#d(l.JUMP_IF_FALSE,n);for(let s of t.components){let r=a=>this.#t(l.LOAD,a,l.GETFIELD,s.index,-1);if(s.type.tag==="double"||s.type.tag==="float")r(0),this.#t(l.BOX,ne[s.type.tag]),r(1),this.#t(l.BOX,ne[s.type.tag],l.OBJ_EQUALS,-1),this.#d(l.JUMP_IF_FALSE,n);else if(ne[s.type.tag]!==void 0)r(0),r(1),this.#t(l.ICMPEQ),this.#d(l.JUMP_IF_FALSE,n);else{let a=new Y;r(0),r(1),this.#t(l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,a),r(0),this.#t(l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,n),r(0),r(1),this.#t(l.OBJ_EQUALS,-1),this.#d(l.JUMP_IF_FALSE,n),this.#m(a)}}this.#m(e),this.#t(l.ICONST,1,l.RETURN_VALUE),this.#m(n),this.#t(l.ICONST,0,l.RETURN_VALUE)}abstractStub(t){let e=t.params.length+(t.isStatic?0:1);this.#$(t.owner,Math.max(1,e),t.returnType),t.returnType.tag==="void"?this.#t(l.RETURN):this.#t(l.ACONST_NULL,l.RETURN_VALUE);let n=this.#gt(t.owner,{name:t.name,display:this.#bt(t),isStatic:t.isStatic,argCount:e,returnsValue:t.returnType.tag!=="void"});return t.selector!==void 0&&(n.selector=t.selector),n}bridge(t,e){let n=[0],s=1;for(let a of e.params)n.push(s),s+=a.tag==="long"||a.tag==="double"?2:1;this.#$(t,s,e.returnType),this.#p(t.declaration.keywordPos),this.#t(l.LOAD,0),e.params.forEach((a,o)=>{this.#t(l.LOAD,n[o+1]);let c=K(e.target.params[o]);c.tag!=="object"&&Rt(c)!==Rt(a)&&es(c)&&this.#t(l.CHECKCAST,this.#S(Rt(c)))}),this.#t(l.INVOKE_VIRTUAL,e.target.index,-1,e.returnType.tag==="void"?l.RETURN:l.RETURN_VALUE);let r=this.#gt(t,{name:e.name,display:`${t.binaryName}.${e.name}(${e.params.map(kn).join(", ")})`,isStatic:!1,argCount:e.params.length+1,returnsValue:e.returnType.tag!=="void"});return r.selector=e.selector,s!==e.params.length+1&&(r.argSlots=Int32Array.from(n)),r}method(t){let e=t.params.length+(t.isStatic?0:1);this.#$(t.owner,Math.max(e,t.maxSlots,t.finallySlots??0),t.returnType);let n=t.declaration.body;this.#i=t.lambda?.reference===!0;for(let a of n.statements)this.#x(a);this.#i=!1,t.returnType.tag==="void"&&(this.#p(n.end-1),this.#t(l.RETURN));let s=this.#gt(t.owner,{name:t.name,display:this.#bt(t),isStatic:t.isStatic,argCount:e,returnsValue:t.returnType.tag!=="void"});t.selector!==void 0&&(s.selector=t.selector),t.hidden&&(s.hidden=!0);let r=this.#N(t);return r&&(s.argSlots=r),s}#t(...t){for(let e of t)this.#r.push(e)}#p(t){let{line:e}=cs(this.#W,t);e!==this.#s&&(this.#s=e,this.#y.push(this.#r.length,e))}#d(t,e){this.#t(t,-1),e.uses.push(this.#r.length-1),e.pc>=0&&(this.#r[this.#r.length-1]=e.pc)}#J(t){t.pc=this.#r.length;for(let e of t.uses)this.#r[e]=t.pc;this.#s=-1}#m(t){t.pc=this.#r.length;for(let e of t.uses)this.#r[e]=t.pc}#S(t){let e=this.#mt.get(t);return e===void 0&&(e=this.strings.length,this.strings.push(t),this.#mt.set(t,e)),e}#pt(t){if(typeof t=="number"&&t===(t|0)&&!Object.is(t,-0)){this.#t(l.ICONST,t);return}let e=typeof t=="bigint"?`L${t}`:Object.is(t,-0)?"-0":String(t),n=this.#Mt.get(e);n===void 0&&(n=this.numbers.length,this.numbers.push(t),this.#Mt.set(e,n)),this.#t(l.NCONST,n)}#Pt(t){switch(t.kind){case"int":case"byte":case"short":case"char":this.#t(l.ICONST,t.value);return;case"long":this.#pt(wt(t.value));return;case"double":case"float":this.#pt(t.value);return;case"boolean":this.#t(l.ICONST,t.value?1:0);return;case"string":this.#t(l.SCONST,this.#S(t.value));return}}#A(t,e,n,s,r){let a=`${t}/${n}`,o=this.#O.get(a);return o===void 0&&(o=this.natives.length,this.natives.push({name:t,argCount:e,returnsValue:n,...s?{unwrap:s,unwrapCalls:r??[]}:{}}),this.#O.set(a,o)),o}#Et(t,e,n,s){let r=-1;e&&(this.#u(e,!0),r=this.#X(`Cannot invoke "${t.display}"`,e),t.onBase&&this.#t(l.BASE));let a=n.length;if(t.varargsFrom===void 0)this.#ot(n,t.params);else{let c=t.varargsFrom;this.#ot(n.slice(0,c),t.params);let u=t.params[c].element,d=n.slice(c);this.#t(l.ICONST,d.length),this.#Nt(u),d.forEach((h,m)=>{this.#t(l.DUP,l.ICONST,m),this.#u(h,!0),this.#f(u,h),this.#t(l.ASTORE,Ue(u),-1)}),a=c+1}let o=a+(e?1:0);this.#t(l.INVOKE_NATIVE,this.#A(t.native,o,t.returnsValue,t.unwrap,t.unwrapCalls),r),!s&&t.returnsValue&&this.#t(l.POP)}#Y(t){let e=Re(t);switch(e.kind){case"Name":return e.symbol?.kind==="field"?e.outerHops?`${this.#et(e.outerHops)}.${e.symbol.name}`:this.#Rt(e.symbol):e.symbol?.kind!=="local"?null:this.#a(e.symbol);case"FieldAccess":{let n=e.fieldSymbol;if(!n)return null;if(n.isStatic)return this.#Rt(n);if(Re(e.target).kind==="This")return`this.${n.name}`;let s=this.#Y(e.target);return s===null?null:`${s}.${n.name}`}case"MethodCall":return e.method?this.#at(e,e.method):e.objectMethod?`${e.qualifier??"Object"}.${Da[e.objectMethod]}`:e.libraryCall?e.libraryCall.display:null;case"ArrayAccess":{let n=this.#Y(e.array);if(n===null)return null;let s=Re(e.index),r=e.index.constant&&(e.index.constant.kind==="int"||e.index.constant.kind==="char")?String(e.index.constant.value):s.kind==="Name"?this.#Y(s)??"...":"...";return`${n}[${r}]`}case"Cast":return this.#Y(e.expression);default:return null}}#Rt(t){return t.isStatic?`${t.owner.binaryName}.${t.name}`:`this.${t.name}`}#Vt(t){let e=this.#D.get(t);return e===void 0&&(e=this.messages.length,this.messages.push(t),this.#D.set(t,e)),e}#I(t,e){if(this.#i)return-1;let n=t;if(typeof e=="string")n+=` because "${e}" is null`;else{let r=Re(e);if(r.kind==="MethodCall"&&(r.method||r.objectMethod||r.libraryCall))n+=` because the return value of "${this.#Y(r)}" is null`;else{let a=this.#Y(e);a!==null&&(n+=` because "${a}" is null`)}}let s=this.#D.get(n);return s===void 0&&(s=this.messages.length,this.messages.push(n),this.#D.set(n,s)),s}#X(t,e){return Re(e).kind==="This"?-1:this.#I(t,e)}#x(t){switch(t.kind){case"Block":for(let e of t.statements)this.#x(e);return;case"EmptyStatement":return;case"LocalVariableDeclaration":for(let e of t.declarators)e.init&&(this.#p(e.pos),e.init.kind==="ArrayInitializer"?this.#Qt(e.init):(this.#u(e.init,!0),this.#f(e.symbol.type,e.init)),this.#t(l.STORE,this.#l(e.symbol)));return;case"ExpressionStatement":this.#p(t.start),this.#u(t.expression,!1);return;case"IfStatement":{let e=t.condition.constant;if(e&&e.kind==="boolean"){e.value?this.#x(t.then):t.otherwise&&this.#x(t.otherwise);return}this.#p(t.start);let n=new Y;if(this.#ut(t.condition,n,!1),this.#x(t.then),t.otherwise){let s=new Y;this.#d(l.JUMP,s),this.#J(n),this.#x(t.otherwise),this.#J(s)}else this.#J(n);return}case"WhileStatement":this.#At(t,t.start,t.condition,t.body,[]);return;case"ForStatement":if(t.init&&!Array.isArray(t.init))this.#x(t.init);else for(let e of t.init??[])this.#p(e.start),this.#u(e,!1);this.#At(t,t.start,t.condition,t.body,t.update);return;case"DoStatement":{let e=new Y,n=new Y,s=new Y;this.#n.set(t,{breakLabel:s,continueLabel:n,tryDepth:this.#K.length}),this.#J(e),this.#x(t.body),this.#J(n),this.#p(t.condition.start),this.#ut(t.condition,e,!0),this.#J(s);return}case"ForEachStatement":this.#o(t);return;case"LabeledStatement":{let e=new Y;this.#n.set(t,{breakLabel:e,tryDepth:this.#K.length}),this.#x(t.body),this.#J(e);return}case"SwitchStatement":this.#Ht(t,!1);return;case"YieldStatement":{this.#p(t.start);let e=this.#n.get(t.target);this.#u(t.value,!0),this.#f(e.resultType,t.value),this.#d(l.JUMP,e.breakLabel);return}case"BreakStatement":{this.#p(t.start);let e=this.#n.get(t.target);this.#yt(e.tryDepth??0,t.liveSlots,()=>this.#d(l.JUMP,e.breakLabel));return}case"ContinueStatement":{this.#p(t.start);let e=this.#n.get(t.target);this.#yt(e.tryDepth??0,t.liveSlots,()=>this.#d(l.JUMP,e.continueLabel));return}case"ReturnStatement":if(this.#p(t.start),t.value){if(this.#u(t.value,!0),this.#f(this.#g,t.value),!this.#K.length){this.#t(l.RETURN_VALUE);return}let e=this.#E();this.#t(l.STORE,e),this.#yt(0,t.liveSlots,()=>this.#t(l.LOAD,e,l.RETURN_VALUE)),this.#nt()}else this.#yt(0,t.liveSlots,()=>this.#t(l.RETURN));return;case"ConstructorCall":throw new Error("codegen: this(...) outside a constructor prologue");case"ThrowStatement":this.#p(t.start),this.#u(t.expression,!0),this.#t(l.ATHROW,this.#I("Cannot throw exception",t.expression));return;case"AssertStatement":return;case"LocalClass":return;case"TryStatement":this.#U(t);return}}#U(t){let e=t.catches.map(o=>({types:(o.caught??[]).map(c=>Rt(c)),body:()=>{this.#t(l.STORE,this.#l(o.symbol)),this.#x(o.block)}})),n=t.finallyBlock,s=t.resources.length?()=>this.#e(t.resources,0,()=>this.#x(t.block)):()=>this.#x(t.block);if(!e.length&&!n){s();return}let r=t.finallySlots,a=n&&r?{run:(o,c)=>{let u=o??r.base,d=c&&!this.#c;d&&(this.#H=Math.max(this.#H,u+r.extent)),d||this.#c++,this.#w.push({from:r.base,by:u-r.base}),this.#x(n),this.#w.pop(),d||this.#c--},anyAt:()=>Math.max(r.before,this.#H)+1,blockCompletes:t.blockCompletes??!0,handlerCompletes:t.catches.map(o=>o.completes??!0)}:null;this.#Q(s,e,a)}#tt(t){return{run:()=>t(),anyAt:()=>0,blockCompletes:!0,handlerCompletes:[]}}#Q(t,e,n){let s=new Rs,r=n?new Rs:null,a=new Y,o={regions:r?[s,r]:[s],finallyBody:n};this.#K.push(o),s.open(this.#r.length),r?.open(this.#r.length),t(),s.close(this.#r.length),r?.close(this.#r.length),this.#K.pop(),n?.run(void 0,n.blockCompletes),this.#d(l.JUMP,a);let c=[];for(let[u,d]of e.entries()){let h=this.#r.length;this.#s=-1,this.#K.push({regions:r?[r]:[],finallyBody:n}),r?.open(this.#r.length),d.body(),r?.close(this.#r.length),this.#K.pop(),n?.run(void 0,n.handlerCompletes[u]??!0),this.#d(l.JUMP,a);for(let m of d.types){let p=m===null?-1:this.#S(m);for(let[b,S]of s.segments)c.push(b,S,h,p)}}if(r&&n){let u=this.#r.length;this.#s=-1;let d=this.#E();this.#t(l.STORE,d),n.run(n.anyAt(),!0),this.#t(l.LOAD,d,l.ATHROW,-1),this.#nt();for(let[h,m]of r.segments)c.push(h,m,u,-1)}this.#F.push(...c),this.#J(a)}#e(t,e,n){if(e===t.length){n();return}let s=t[e];this.#p(s.start);let r=s.symbol?this.#l(s.symbol):this.#E();s.kind==="declaration"?(this.#u(s.init,!0),this.#f(s.symbol.type,s.init)):this.#u(s.expression,!0),this.#t(l.STORE,r);let a=this.#E();this.#t(l.ACONST_NULL,l.STORE,a);let o=()=>this.#st(s,r);this.#Q(()=>this.#e(t,e+1,n),[{types:[null],body:()=>this.#t(l.DUP,l.STORE,a,l.ATHROW,-1)}],this.#tt(()=>{let c=new Y,u=new Y;this.#t(l.LOAD,r,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,c),this.#t(l.LOAD,a,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,u),this.#Q(o,[{types:[null],body:()=>{let d=this.#E();this.#t(l.STORE,d,l.LOAD,a,l.LOAD,d,l.THROWABLE,jt.ADD_SUPPRESSED),this.#nt()}}],null),this.#d(l.JUMP,c),this.#m(u),o(),this.#m(c)})),s.kind==="declaration"&&!this.#c&&(this.#H=Math.max(this.#H,r+3)),this.#nt(),s.symbol||this.#nt()}#st(t,e){this.#t(l.LOAD,e),t.closeMethod?this.#t(l.INVOKE_VIRTUAL,t.closeMethod.index,-1):this.#t(l.INVOKE_NATIVE,this.#A("close()",1,!1),-1)}#yt(t,e,n){let s=this.#K.slice(t);if(!s.length){n();return}let r=this.#K;for(let a=s.length-1;a>=0;a--){for(let o of s[a].regions)o.close(this.#r.length);this.#K=r.slice(0,t+a),s[a].finallyBody?.run(e,!0)}this.#K=r,n();for(let a of s)for(let o of a.regions)o.open(this.#r.length)}#At(t,e,n,s,r){let a=n?.constant;if(a&&a.kind==="boolean"&&!a.value)return;let o=new Y,c=new Y,u=new Y;this.#n.set(t,{breakLabel:u,continueLabel:c,tryDepth:this.#K.length}),this.#J(o),this.#p(e),n&&!a&&this.#ut(n,u,!1),this.#x(s),this.#J(c);for(let d of r)this.#p(d.start),this.#u(d,!1);this.#d(l.JUMP,o),this.#J(u)}#o(t){if(t.iterator){this.#$e(t);return}let{array:e,length:n,index:s}=t.hidden,r=e.type.element;this.#p(t.start),this.#u(t.iterable,!0),this.#t(l.STORE,this.#l(e),l.LOAD,this.#l(e)),this.#t(l.ARRAYLENGTH,this.#I("Cannot read the array length",this.#a(e))),this.#t(l.STORE,this.#l(n),l.ICONST,0,l.STORE,this.#l(s));let a=new Y,o=new Y,c=new Y;this.#n.set(t,{breakLabel:c,continueLabel:o,tryDepth:this.#K.length}),this.#J(a),this.#p(t.start),this.#t(l.LOAD,this.#l(s),l.LOAD,this.#l(n),l.ICMPLT),this.#d(l.JUMP_IF_FALSE,c),this.#t(l.LOAD,this.#l(e),l.LOAD,this.#l(s),l.ALOAD,Ue(r),-1),this.#Ot(r,t.symbol.type,{description:`${this.#a(e)}[${this.#a(s)}]`}),this.#t(l.STORE,this.#l(t.symbol)),this.#x(t.body),this.#J(o),this.#p(t.start),this.#t(l.IINC,this.#l(s),1),this.#d(l.JUMP,a),this.#J(c)}#$e(t){let e=t.iterator,n=t.iterable.type,s=n.tag==="library"||n.tag==="diamond"?n.symbol.qualifiedName:"java.lang.Iterable";this.#p(t.start),this.#u(t.iterable,!0),this.#t(l.INVOKE_NATIVE,this.#A("Iterable.iterator",1,!0),this.#I(`Cannot invoke "${s}.iterator()"`,t.iterable)),this.#t(l.STORE,this.#l(e));let r=new Y,a=new Y;this.#n.set(t,{breakLabel:a,continueLabel:r,tryDepth:this.#K.length}),this.#J(r),this.#p(t.start),this.#t(l.LOAD,this.#l(e),l.INVOKE_NATIVE,this.#A("Iterator.hasNext",1,!0),-1),this.#d(l.JUMP_IF_FALSE,a),this.#t(l.LOAD,this.#l(e),l.INVOKE_NATIVE,this.#A("Iterator.next",1,!0),-1);let o=t.element??ja(n),c=t.symbol.type,u=Ee(c)?zt(c):K(c);u&&u.tag!=="object"&&(u.tag==="string"||u.tag==="class"||u.tag==="array"||u.tag==="library"&&u.symbol.box)&&this.#t(l.CHECKCAST,this.#S(Rt(u))),this.#Ot(o,t.symbol.type,{returnValue:"java.util.Iterator.next()"}),this.#t(l.STORE,this.#l(t.symbol)),this.#x(t.body),this.#d(l.JUMP,r),this.#J(a)}#Ht(t,e){if(t.patternSwitch)return this.#ve(t,e);this.#p(t.start);let n=t.selector.type?.tag==="string",s=t.selector.type,r=s?.tag==="class"&&s.symbol.isEnum?s.symbol:null;this.#u(t.selector,!0);let a;if(r)this.#t(l.GETFIELD,1,this.#I(`Cannot invoke "${r.binaryName}.ordinal()"`,t.selector)),a=this.#E(),this.#t(l.STORE,a);else if(t.libraryEnum)this.#t(l.INVOKE_NATIVE,this.#A("ordinal()",1,!0),this.#I(`Cannot invoke "${t.libraryEnum}.ordinal()"`,t.selector)),a=this.#E(),this.#t(l.STORE,a);else if(n){let h=t.hidden.copy;a=this.#l(h),this.#t(l.STORE,a,l.LOAD,a),this.#t(l.CHECKNULL,this.#I(\'Cannot invoke "String.hashCode()"\',this.#a(h)))}else a=this.#E(),this.#t(l.STORE,a);let o=new Y,c=e?t.type:void 0;this.#n.set(t,{breakLabel:o,resultType:c,tryDepth:this.#K.length});let u=t.cases.map(()=>new Y),d=o;t.cases.forEach((h,m)=>{if(h.isDefault&&(d=u[m]),r||t.libraryEnum){for(let p of h.ordinals??[])this.#t(l.LOAD,a,l.ICONST,p,l.ICMPEQ),this.#d(l.JUMP_IF_TRUE,u[m]);return}for(let p of h.labels)this.#t(l.LOAD,a),this.#Pt(p.constant),this.#t(n?l.STR_EQUALS:l.ICMPEQ,...n?[-1]:[]),this.#d(l.JUMP_IF_TRUE,u[m])}),e&&d===o&&u.length&&(d=u[0]),this.#d(l.JUMP,d),t.cases.forEach((h,m)=>{this.#J(u[m]),this.#oe(h,e,o,c)}),this.#m(o),this.#s=-1,n||this.#nt()}#ve(t,e){this.#p(t.start);let n=t.selector.type,s=n?.tag==="class"&&n.symbol.isEnum?n.symbol:null;this.#u(t.selector,!0);let r=this.#E();this.#t(l.STORE,r);let a=new Y,o=e?t.type:void 0;this.#n.set(t,{breakLabel:a,resultType:o,tryDepth:this.#K.length});let c=t.cases.map(()=>new Y),u=t.cases.findIndex(h=>h.nullLabel);this.#t(l.LOAD,r),u>=0?(this.#t(l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,c[u])):this.#t(l.CHECKNULL,-1);let d=null;t.cases.forEach((h,m)=>{if(h.isDefault&&(d=c[m]),s)for(let p of h.ordinals??[])this.#t(l.LOAD,r,l.GETFIELD,1,-1,l.ICONST,p,l.ICMPEQ),this.#d(l.JUMP_IF_TRUE,c[m]);else{let p=n?gt(n):null;for(let b of h.enumFields??[])this.#t(l.LOAD,r,l.GETSTATIC,b.index,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,c[m]);for(let b of h.enumFields?.length?[]:h.labels)this.#t(l.LOAD,r),p&&this.#t(l.UNBOX,ne[p.tag],-1),this.#Pt(b.constant),p&&this.#rt(b.type,p),this.#t(p?l.ICMPEQ:l.STR_EQUALS,...p?[]:[-1]),this.#d(l.JUMP_IF_TRUE,c[m])}if(h.pattern){let p=new Y,b=this.#ae(h.pattern,r,p,!1);h.guard&&this.#ut(h.guard,p,!1),this.#d(l.JUMP,c[m]),this.#m(p);for(let S=0;S<b;S++)this.#nt()}}),this.#d(l.JUMP,d??(t.exhaustive&&c.length?c[0]:a)),t.cases.forEach((h,m)=>{this.#J(c[m]),this.#oe(h,e,a,o)}),this.#m(a),this.#s=-1,this.#nt()}#ae(t,e,n,s){if(t.kind==="TypePattern")return!(s&&t.unconditional)&&!Ee(t.tested)&&(this.#t(l.LOAD,e,l.INSTANCEOF,this.#S(Rt(K(t.tested)))),this.#d(l.JUMP_IF_FALSE,n)),t.symbol&&this.#t(l.LOAD,e,l.STORE,this.#l(t.symbol)),0;this.#t(l.LOAD,e,l.INSTANCEOF,this.#S(Rt(K(t.tested)))),this.#d(l.JUMP_IF_FALSE,n);let r=0;return t.components.forEach((a,o)=>{let c=t.accessors[o],u=this.#E();r++,this.#t(l.LOAD,e,c.selector!==void 0?l.INVOKE_VIRTUAL:l.INVOKE,c.index,-1,l.STORE,u),r+=this.#ae(a,u,n,!0)}),r}#oe(t,e,n,s){if(!t.arrow){for(let a of t.statements)this.#x(a);return}let r=t.body;if(r.kind==="Block"){this.#x(r),e||this.#d(l.JUMP,n);return}this.#p(r.start),e?(this.#u(r,!0),this.#f(s,r)):this.#u(r,!1),this.#d(l.JUMP,n)}#ut(t,e,n){let s=t.constant;if(s&&s.kind==="boolean"){s.value===n&&this.#d(l.JUMP,e);return}if(t.kind==="Parenthesized")return this.#ut(t.expression,e,n);if(t.kind==="Unary"&&t.operator==="!")return this.#ut(t.operand,e,!n);if(t.kind==="Binary"&&(t.operator==="&&"||t.operator==="||")){if(t.operator==="&&"!==n)this.#ut(t.left,e,n),this.#ut(t.right,e,n);else{let a=new Y;this.#ut(t.left,a,!n),this.#ut(t.right,e,n),this.#m(a)}return}if(t.kind==="InstanceOf"){this.#we(t,e,n);return}this.#G(t,ft),this.#d(n?l.JUMP_IF_TRUE:l.JUMP_IF_FALSE,e)}#we(t,e,n){if(t.recordPattern){let c=this.#E();this.#u(t.expression,!0),this.#t(l.STORE,c);let u=new Y,d=this.#ae(t.recordPattern,c,n?u:e,!1);n&&this.#d(l.JUMP,e),this.#m(u);for(let h=0;h<=d;h++)this.#nt();return}let s=this.#S(Rt(this.#zt(t))),r=t.binding?.symbol;if(!r){this.#u(t.expression,!0),this.#t(l.INSTANCEOF,s),this.#d(n?l.JUMP_IF_TRUE:l.JUMP_IF_FALSE,e);return}let a=this.#E();this.#u(t.expression,!0),this.#t(l.STORE,a,l.LOAD,a,l.INSTANCEOF,s);let o=new Y;this.#d(l.JUMP_IF_FALSE,n?o:e),this.#t(l.LOAD,a,l.STORE,this.#l(r)),n&&this.#d(l.JUMP,e),this.#m(o),this.#nt()}#zt(t){return t.binding?.symbol?.type??t.testedType}#rt(t,e){t&&(t.tag==="long"&&e.tag==="double"?this.#t(l.L2D):e.tag==="float"&&t.tag==="long"?this.#t(l.L2F):e.tag==="float"&&Mr(t)&&this.#t(l.I2F))}#It(t,e){if(!ts(t)||!ts(e))return;let n=Mr(t)?"int":t.tag;switch(e.tag){case"char":case"byte":case"short":case"int":n==="long"&&this.#t(l.L2I),(n==="double"||n==="float")&&this.#t(l.D2I),e.tag==="char"&&t.tag!=="char"&&this.#t(l.I2C),e.tag==="byte"&&t.tag!=="byte"&&this.#t(l.I2B),e.tag==="short"&&t.tag!=="byte"&&t.tag!=="short"&&this.#t(l.I2S);return;case"long":(n==="double"||n==="float")&&this.#t(l.D2L);return;case"float":n==="double"?this.#t(l.D2F):this.#rt(t,e);return;case"double":n==="long"&&this.#t(l.L2D);return}}#f(t,e){this.#Ot(e.type,t,e,e.constant!==void 0)}#Ot(t,e,n,s=!1){let r=gt(t);if(Ee(e)){if(r&&(this.#t(l.UNBOX,ne[r.tag],this.#Lt(r,n)),t=r),s){this.#rt(t,e);return}e.tag==="char"&&t.tag!=="char"?this.#t(l.I2C):this.#rt(t,e);return}if(Ee(t)){let a=gt(e)?.tag??t.tag;!s&&a==="char"&&t.tag==="int"&&this.#t(l.I2C),t.tag==="long"&&a==="double"&&this.#t(l.L2D),this.#t(l.BOX,ne[a])}}#Lt(t,e){let n=`Cannot invoke "${kl[t.tag]}"`;return"returnValue"in e?this.#Vt(`${n} because the return value of "${e.returnValue}" is null`):"description"in e?this.#I(n,e.description):this.#I(n,e)}#ot(t,e,n){if(!n){t.forEach((r,a)=>{this.#u(r,!0),this.#f(e[a],r)});return}this.#ot(t.slice(0,n.from),e);let s=t.slice(n.from);this.#t(l.ICONST,s.length),this.#Nt(n.element),s.forEach((r,a)=>{this.#t(l.DUP,l.ICONST,a),this.#u(r,!0),this.#f(n.element,r),this.#t(l.ASTORE,Ue(n.element),-1)})}#G(t,e){if(this.#u(t,!0),t.constant){this.#rt(t.type,e);return}let n=gt(t.type);if(n){this.#t(l.UNBOX,ne[n.tag],this.#Lt(n,t)),this.#rt(n,e);return}this.#rt(t.type,e)}#Jt(t,e){let n=Cl[t];return e.tag==="double"?n.double:e.tag==="float"?n.float:e.tag==="long"?n.long:n.int}#u(t,e){if(e&&t.genericCast){let n=t.genericCast;t.genericCast=void 0,this.#u(t,!0),t.genericCast=n,this.#t(l.CHECKCAST,this.#S(Rt(n)));return}if(t.constant){e&&this.#Pt(t.constant);return}switch(t.kind){case"Literal":if(t.literalKind!=="null")throw new Error(`codegen: unexpected literal ${t.literalKind}`);e&&this.#t(l.ACONST_NULL);return;case"Name":{if(t.imported){this.#u(t.imported,e);return}if(t.symbol?.kind==="field"){if(!e)return;let n=t.symbol;n.isStatic?this.#t(l.GETSTATIC,n.index):(this.#Tt(t.outerHops),this.#t(l.GETFIELD,n.index,-1));return}if(t.symbol?.kind!=="local")throw new Error("codegen: unresolved name");e&&this.#t(l.LOAD,this.#l(t.symbol));return}case"This":e&&this.#Tt(t.outerHops);return;case"Super":e&&this.#t(l.LOAD,0);return;case"ClassLiteral":e&&this.#t(l.SCONST,this.#S(t.className),l.ICONST,t.isInterface?1:0,l.INVOKE_NATIVE,this.#A("Class.literal",2,!0),-1);return;case"InstanceOf":{let n=new Y,s=new Y;this.#we(t,n,!0),this.#t(l.ICONST,0),this.#d(l.JUMP,s),this.#m(n),this.#t(l.ICONST,1),this.#m(s),e||this.#t(l.POP);return}case"Parenthesized":this.#u(t.expression,e);return;case"Unary":{let n=t.type;this.#G(t.operand,n),t.operator==="-"?this.#t(n.tag==="double"||n.tag==="float"?l.DNEG:n.tag==="long"?l.LNEG:l.INEG):t.operator==="~"?n.tag==="long"?this.#t(l.ICONST,-1,l.LXOR):this.#t(l.INOT):t.operator==="!"&&this.#t(l.BNOT),e||this.#t(l.POP);return}case"Cast":{let n=t.expression.type;if(t.checked&&Ee(t.type)){this.#u(t.expression,!0),this.#t(l.CHECKCAST,this.#S(Rt(t.checked)));let r=gt(t.checked);this.#t(l.UNBOX,ne[r.tag],this.#Lt(r,t.expression)),this.#It(r,t.type),e||this.#t(l.POP);return}let s=Ee(t.type)?gt(n):null;s?this.#G(t.expression,s):this.#u(t.expression,!0),Ee(n)&&!Ee(t.type)?this.#Ot(n,t.type,t.expression,t.expression.constant!==void 0):this.#It(s??n,t.type),t.checked&&this.#t(l.CHECKCAST,this.#S(Rt(t.checked))),e||this.#t(l.POP);return}case"IncDec":this.#jt(t,e);return;case"Binary":this.#Me(t),e||this.#t(l.POP);return;case"Assignment":this.#Zt(t,e);return;case"ArrayAccess":this.#u(t.array,!0),this.#G(t.index,U),this.#Yt(t.type,t.array),e||this.#t(l.POP);return;case"NewArray":this.#Dt(t),e||this.#t(l.POP);return;case"FieldAccess":if(t.fieldSymbol){let n=t.fieldSymbol;n.isStatic?(Nr(t.target)||this.#u(t.target,!1),e&&this.#t(l.GETSTATIC,n.index)):(this.#u(t.target,!0),this.#t(l.GETFIELD,n.index,this.#X(`Cannot read field "${n.name}"`,t.target)),e||this.#t(l.POP));return}if(t.field==="System.in"){e&&this.#t(l.INVOKE_NATIVE,this.#A("System.in",0,!0),-1);return}if(t.field==="System.out"||t.field==="System.err"){e&&this.#t(l.INVOKE_NATIVE,this.#A(t.field,0,!0),-1);return}if(t.libraryField?.includes("#")){this.#u(t.target,!0),this.#t(l.INVOKE_NATIVE,this.#A(t.libraryField,1,!0),this.#X(`Cannot read field "${t.name}"`,t.target)),e||this.#t(l.POP);return}if(t.libraryField){e&&this.#t(l.INVOKE_NATIVE,this.#A(t.libraryField,0,!0),-1);return}if(t.field!=="length")throw new Error("codegen: field access used as a value");this.#u(t.target,!0),this.#t(l.ARRAYLENGTH,this.#I("Cannot read the array length",t.target)),e||this.#t(l.POP);return;case"MethodCall":this.#ce(t,e);return;case"NewObject":{if(t.libraryCall){this.#Et(t.libraryCall,null,t.args,e);return}let n=t.ctor;this.#t(l.NEW,n.owner.index,l.DUP);for(let s of n.owner.captures??[]){this.#t(l.DUP);let r=Al(this.#z,n.owner);r>=0?(this.#Tt(r),this.#t(l.GETFIELD,s.field.index,-1)):this.#t(l.LOAD,this.#l(s.local)),this.#t(l.PUTFIELD,s.field.index,-1)}t.outerExpression?(this.#u(t.outerExpression,!0),this.#t(l.DUP,l.CHECKNULL,-1)):t.outer!==void 0&&this.#Tt(t.outer),this.#ot(t.args,n.params,t.varargs),this.#t(l.INVOKE,n.index,-1),e||this.#t(l.POP);return}case"Conditional":{let n=t.condition.constant;if(n?.kind==="boolean"){let a=n.value?t.whenTrue:t.whenFalse;this.#u(a,e),e&&this.#f(t.type,a);return}let s=new Y,r=new Y;this.#ut(t.condition,s,!1),this.#u(t.whenTrue,!0),this.#f(t.type,t.whenTrue),this.#d(l.JUMP,r),this.#m(s),this.#u(t.whenFalse,!0),this.#f(t.type,t.whenFalse),this.#m(r),e||this.#t(l.POP);return}case"SwitchExpression":this.#Ht(t,!0),e||this.#t(l.POP);return;case"Lambda":this.#le(t,null,e);return;case"MethodRef":this.#le(t.lambda,t.receiver??null,e);return}}#le(t,e,n){let s=t.method,r=0;s.usesThis&&(this.#t(l.LOAD,0),r++),e&&(this.#u(e,!0),this.#t(l.DUP,l.CHECKNULL,-1),r++);for(let o of t.captures??[])this.#t(l.LOAD,this.#l(o)),r++;let a=t.functional;this.#t(l.LAMBDA,s.index,r,this.#S(a.iface),a.sam?.selector??-1,a.samKey?this.#S(a.samKey):-1),n||this.#t(l.POP)}#Me(t){let e=t.operator;if(e==="&&"||e==="||"){let a=new Y,o=new Y;this.#ut(t,a,!1),this.#t(l.ICONST,1),this.#d(l.JUMP,o),this.#m(a),this.#t(l.ICONST,0),this.#m(o);return}let n=t.left.type,s=t.right.type;if(t.type?.tag==="string"){this.#te(t.left),this.#te(t.right),this.#t(l.SCONCAT);return}if(e in Ps){let a=gt(n)??n,o=gt(s)??s,c=Ee(n)||Ee(s)||e!=="=="&&e!=="!=";if(c&&a.tag==="boolean"&&o.tag==="boolean"){this.#G(t.left,ft),this.#G(t.right,ft),this.#t(Ps[e]);return}if(c&&ts(a)&&ts(o)){let d=$r(a,o);this.#G(t.left,d),this.#G(t.right,d),this.#t(Ps[e]);return}this.#u(t.left,!0),this.#u(t.right,!0);let u=es(n)||es(s);this.#t(e==="=="?u?l.ACMPEQ:l.ICMPEQ:e==="!="?u?l.ACMPNE:l.ICMPNE:Ps[e]);return}let r=t.type;if(e==="<<"||e===">>"||e===">>>"){this.#G(t.left,r),this.#u(t.right,!0),s.tag==="long"&&this.#t(l.L2I),this.#t(this.#Jt(e,r));return}this.#G(t.left,r),this.#G(t.right,r),this.#t(this.#Jt(e,r.tag==="boolean"?U:r))}#Tt(t=0){this.#t(l.LOAD,0);let e=this.#z;for(let n=0;n<t&&e;n++,e=e.outer)this.#t(l.GETFIELD,e.outerField,-1)}#et(t){let e=r=>{let a=0;for(let o=r.outer;o;o=o.outer)a++;return a},n="this",s=this.#z;for(let r=0;r<t&&s?.outer;r++,s=s.outer)n+=`.this$${e(s)-1}`;return n}#Nt(t){Ue(t)===W.REF&&t.tag!=="string"?this.#t(l.NEWARRAY_REF,this.#S("["+Rt(t))):this.#t(l.NEWARRAY,Ue(t))}#Dt(t){if(t.initializer){this.#Qt(t.initializer);return}let e=t.type;for(let n of t.dimensions)this.#G(n,U);t.dimensions.length===1?this.#Nt(e.element):this.#t(l.NEWMULTI,this.#S(Rt(e)),t.dimensions.length)}#Yt(t,e){let n=Ue(t);this.#t(l.ALOAD,n,this.#I(`Cannot load from ${Ja[n]} array`,e))}#Gt(t,e){let n=Ue(t);this.#t(l.ASTORE,n,this.#I(`Cannot store to ${Ja[n]} array`,e))}#Qt(t){let e=t.elementType,n=Ue(e);this.#t(l.ICONST,t.elements.length),this.#Nt(e),t.elements.forEach((s,r)=>{this.#t(l.DUP,l.ICONST,r),s.kind==="ArrayInitializer"?this.#Qt(s):(this.#u(s,!0),this.#f(e,s)),this.#t(l.ASTORE,n,-1)})}#ce(t,e){if(t.print){let s=kt.NONE;if(t.print.argument!=="none"){let r=t.args[0];this.#u(r,!0),t.print.argument==="object"?(this.#t(l.VALUEOF,l.TOSTRING_REF),s=kt.STRING):s={int:kt.INT,char:kt.CHAR,boolean:kt.BOOLEAN,long:kt.LONG,float:kt.FLOAT,double:kt.DOUBLE,string:kt.STRING,"char-array":kt.CHAR_ARRAY}[t.print.argument]}this.#t(l.PRINT,t.print.stream==="err"?1:0,t.print.newline?1:0,s);return}if(t.libraryCall){let s=t.libraryCall.isStatic?null:t.target??{kind:"This",depth:1,pos:t.pos,start:t.pos,end:t.pos};this.#Et(t.libraryCall,s,t.args,e);return}if(t.mathFunction){this.#ot(t.args,t.mathFunction.params),this.#t(l.MATH,El[t.mathFunction.fn]),e||this.#t(l.POP);return}let n=t.target?Re(t.target):null;if(t.method){let s=t.method,r=-1;s.isStatic?n&&!Nr(n)&&this.#u(n,!1):n?(this.#u(n,!0),r=this.#X(`Cannot invoke "${this.#at(t,s)}"`,n)):this.#Tt(t.outerHops),this.#ot(t.args,s.params,t.varargs);let a=s.selector!==void 0&&!t.isSuper;this.#t(a?l.INVOKE_VIRTUAL:l.INVOKE,s.index,r),!e&&s.returnType.tag!=="void"&&this.#t(l.POP);return}if(t.objectMethod){let s=-1;if(n?(this.#u(n,!0),s=this.#X(`Cannot invoke "${t.qualifier??"Object"}.${Da[t.objectMethod]}"`,n)):this.#Tt(),this.#ot(t.args,t.args.map(()=>H)),t.isSuper)this.#t(l.OBJ_SUPER,{toString:0,hashCode:1,equals:2}[t.objectMethod]);else{let r={toString:l.OBJ_TOSTRING,hashCode:l.OBJ_HASHCODE,equals:l.OBJ_EQUALS}[t.objectMethod];this.#t(r,s)}e||this.#t(l.POP);return}if(t.stringMethod){this.#u(t.target,!0);for(let s of t.args)this.#u(s,!0);switch(t.stringMethod){case"length":this.#t(l.STR_LENGTH,this.#I(\'Cannot invoke "String.length()"\',t.target));break;case"charAt":this.#t(l.STR_CHARAT,this.#I(\'Cannot invoke "String.charAt(int)"\',t.target));break;case"equals":this.#t(l.STR_EQUALS,this.#I(\'Cannot invoke "String.equals(Object)"\',t.target));break;case"isEmpty":this.#t(l.STR_LENGTH,this.#I(\'Cannot invoke "String.isEmpty()"\',t.target),l.ICONST,0,l.ICMPEQ);break;case"toCharArray":this.#t(l.STR_TOCHARS,this.#I(\'Cannot invoke "String.toCharArray()"\',t.target));break;case"compareTo":this.#t(l.STR_COMPARETO,this.#I(\'Cannot invoke "String.compareTo(String)"\',t.target),this.#Vt(\'Cannot read field "value" because "anotherString" is null\'));break}e||this.#t(l.POP);return}throw new Error(`codegen: unresolved call to ${t.name}`)}#St(t,e,n){let s=gt(t);s&&this.#t(l.UNBOX,ne[s.tag],this.#Lt(s,n));let r=s??t;this.#t(l.ICONST,e,r.tag==="double"?l.DADD:r.tag==="float"?l.FADD:r.tag==="long"?l.LADD:l.IADD),r.tag==="char"&&this.#t(l.I2C),r.tag==="byte"&&this.#t(l.I2B),r.tag==="short"&&this.#t(l.I2S),s&&this.#t(l.BOX,ne[s.tag])}#jt(t,e){let n=Re(t.operand),s=t.operator==="++"?1:-1,r=t.type;if(n.kind==="Name"&&n.symbol?.kind==="local"){let o=this.#l(n.symbol);if(r.tag==="int"){e&&!t.prefix&&this.#t(l.LOAD,o),this.#t(l.IINC,o,s),e&&t.prefix&&this.#t(l.LOAD,o);return}this.#t(l.LOAD,o),e&&!t.prefix&&this.#t(l.DUP),this.#St(r,s,n),e&&t.prefix&&this.#t(l.DUP),this.#t(l.STORE,o);return}let a=this.#ue(n);if(a){if(a.isStatic)this.#Re(n),this.#t(l.GETSTATIC,a.index),e&&!t.prefix&&this.#t(l.DUP),this.#St(r,s,n),e&&t.prefix&&this.#t(l.DUP),this.#t(l.PUTSTATIC,a.index);else{let o=this.#Pe(n,a,"read");this.#t(l.DUP,l.GETFIELD,a.index,o),e&&!t.prefix&&this.#t(l.DUP_X1),this.#St(r,s,n),e&&t.prefix&&this.#t(l.DUP_X1),this.#t(l.PUTFIELD,a.index,-1)}return}if(n.kind!=="ArrayAccess")throw new Error("codegen: ++/-- target");this.#u(n.array,!0),this.#u(n.index,!0),this.#t(l.DUP2),this.#Yt(r,n.array),e&&!t.prefix&&this.#t(l.DUP_X2),this.#St(r,s,n),e&&t.prefix&&this.#t(l.DUP_X2),this.#Gt(r,n.array)}#Zt(t,e){let n=Re(t.target),s=t.target.type,r=()=>{if(t.operator==="="){this.#u(t.value,!0),this.#f(s,t.value);return}if(s.tag==="string"){this.#t(l.TOSTRING_REF),this.#te(t.value),this.#t(l.SCONCAT);return}let o=t.operator.slice(0,-1),c=t.value.type;if(o==="<<"||o===">>"||o===">>>"){let h=Mr(s)?U:s;this.#u(t.value,!0),c.tag==="long"&&this.#t(l.L2I),this.#t(this.#Jt(o,h)),this.#It(h,s);return}if(s.tag==="boolean"){this.#G(t.value,ft),this.#t(this.#Jt(o,U));return}let u=gt(s);if(u){this.#t(l.UNBOX,ne[u.tag],this.#Lt(u,n));let h=$r(u,gt(c)??c);this.#rt(u,h),this.#G(t.value,h),this.#t(this.#Jt(o,h)),this.#It(h,u),this.#t(l.BOX,ne[u.tag]);return}let d=$r(s,gt(c)??c);this.#rt(s,d),this.#G(t.value,d),this.#t(this.#Jt(o,d)),this.#It(d,s)};if(n.kind==="Name"&&n.symbol?.kind==="local"){t.operator!=="="&&this.#t(l.LOAD,this.#l(n.symbol)),r(),e&&this.#t(l.DUP),this.#t(l.STORE,this.#l(n.symbol));return}let a=this.#ue(n);if(a){if(a.isStatic)this.#Re(n),t.operator!=="="&&this.#t(l.GETSTATIC,a.index),r(),e&&this.#t(l.DUP),this.#t(l.PUTSTATIC,a.index);else if(t.operator==="="){let o=this.#Pe(n,a,"assign");r(),e&&this.#t(l.DUP_X1),this.#t(l.PUTFIELD,a.index,o)}else{let o=this.#Pe(n,a,"read");this.#t(l.DUP,l.GETFIELD,a.index,o),r(),e&&this.#t(l.DUP_X1),this.#t(l.PUTFIELD,a.index,-1)}return}if(n.kind!=="ArrayAccess")throw new Error("codegen: assignment target");this.#u(n.array,!0),this.#u(n.index,!0),t.operator!=="="&&(this.#t(l.DUP2),this.#Yt(s,n.array)),r(),e&&this.#t(l.DUP_X2),this.#Gt(s,n.array)}#ue(t){if(t.kind==="Name"&&t.symbol?.kind==="field")return t.symbol;if(t.kind==="FieldAccess")return t.fieldSymbol}#Pe(t,e,n){if(t.kind==="FieldAccess"){this.#u(t.target,!0);let s=n==="read"?"Cannot read field":"Cannot assign field";return this.#X(`${s} "${e.name}"`,t.target)}return this.#Tt(t.kind==="Name"?t.outerHops:0),-1}#Re(t){t.kind==="FieldAccess"&&!Nr(t.target)&&this.#u(t.target,!1)}#te(t){if(t.constant){this.#t(l.SCONST,this.#S(Fn(t.constant)));return}switch(this.#u(t,!0),t.type?.tag){case"int":case"byte":case"short":this.#t(l.TOSTRING_INT);return;case"float":this.#t(l.TOSTRING_FLOAT);return;case"char":this.#t(l.TOSTRING_CHAR);return;case"boolean":this.#t(l.TOSTRING_BOOL);return;case"long":this.#t(l.TOSTRING_LONG);return;case"double":this.#t(l.TOSTRING_DOUBLE);return;case"string":case"null":case"array":this.#t(l.TOSTRING_REF);return;case"class":case"object":case"library":case"diamond":case"typevar":this.#t(l.VALUEOF,l.TOSTRING_REF);return;default:throw new Error(`codegen: string conversion of ${t.type?.tag}`)}}},Da={toString:"toString()",hashCode:"hashCode()",equals:"equals(Object)"};function Al(i,t){let e=0;for(let n=i;n;n=n.outer,e++)if(n===t)return e;return-1}function es(i){return i!==void 0&&["string","null","array","class","object","library","diamond","typevar"].includes(i.tag)}function ja(i){if(i.tag==="class"){let n=pn(i.symbol).find(s=>s.symbol.name==="Iterable"||s.symbol.supertypes.some(r=>r.tag==="library"&&r.symbol.name==="Iterable"));return n?ja(n):{tag:"object"}}if(i.tag!=="library")return{tag:"object"};let t=i,e=new Set;for(;t&&t.tag==="library"&&t.symbol.name!=="Iterable"&&!e.has(t.symbol);){e.add(t.symbol);let n=t,s=n.symbol.supertypes[0];t=s?Fa(s,n):null}return t&&t.tag==="library"?t.args[0]??{tag:"object"}:{tag:"object"}}function Fa(i,t){if(i.tag==="typevar"){let e=t.symbol.typeParams.indexOf(i.name);return t.args[e]??{tag:"object"}}return i.tag==="library"?{tag:"library",symbol:i.symbol,args:i.args.map(e=>Fa(e,t))}:i}var rt=class{value;constructor(t){this.value=t}},Ut=class{kind;data;hash;descriptor;constructor(t,e,n,s=Il[t]){this.kind=t,this.data=e,this.hash=n,this.descriptor=s}},Ft=class{className;classIndex;fields;hash;base=null;constructor(t,e,n,s){this.className=t,this.classIndex=e,this.fields=n,this.hash=s}},qt=class{kind;value;constructor(t,e){this.kind=t,this.value=e}},pe=class{hash;constructor(t){this.hash=t}},ye=class extends pe{className;method;captured;iface;samSelector;samKey;constructor(t,e,n,s=[],r="java.util.Comparator",a=-1,o="compare(T,T)"){super(n),this.className=t,this.method=e,this.captured=s,this.iface=r,this.samSelector=a,this.samKey=o}},Be=class i{invoke;args;then;resumes;convert;constructor(t,e,n,s=null,r=null){this.invoke=t,this.args=e,this.then=n,this.resumes=s,this.convert=r}*[Symbol.iterator](){let t=this;for(;t instanceof i;)t=t.then(yield t);return t!==null&&typeof t=="object"&&Symbol.iterator in t?yield*t:t}},Il=["[I","[Z","[C","[Ljava.lang.String;","[J","[D","[B","[S","[F"];function Ve(i){return i instanceof Ut?Dr(i):`${i.className}@${i.hash.toString(16)}`}function Dr(i){return`${i.descriptor}@${i.hash.toString(16)}`}var Js=class{#O=new Map;intern(t){let e=this.#O.get(t);return e||(e=new rt(t),this.#O.set(t,e)),e}},Ds=class{#O=625341585;next(){let t=this.#O;return t^=t<<13,t^=t>>>17,t^=t<<5,this.#O=t>>>0,this.#O&2147483647||1}};var _a=i=>`${i.className}.${i.method}(${i.file}:${i.line})`;var _s=class{className;message;cause;constructor(t,e,n){this.className=t,this.message=e,this.cause=n}},ns=class{message;constructor(t){this.message=t}},ss=class{result;constructor(t){this.result=t}},Cn=class{thrown;constructor(t){this.thrown=t}},Us=class{frames;constructor(t){this.frames=t}},Bs=class{message;constructor(t){this.message=t}};function Ll(i,t,e){switch(i){case 12:return Math.imul(t,e);case 13:return t/e|0;case 14:return t%e|0;case 19:return t&e;case 20:return t|e;case 21:return t^e;case 16:return t<<e;case 17:return t>>e;default:return t>>>e|0}}function js(i,t,e){switch(i){case 0:return t===e;case 1:return t!==e;case 2:return t<e;case 3:return t<=e;case 4:return t>e;case 5:return t>=e;case 6:return t!==e;case 7:return t===e;case 8:return!(t<e);case 9:return!(t<=e);case 10:return!(t>e);default:return!(t>=e)}}var Nl=Object.getPrototypeOf(Object.getPrototypeOf((function*(){})())),jr=i=>typeof i=="object"&&i!==null&&Object.getPrototypeOf(Object.getPrototypeOf(i))===Nl;function Fr(i){switch(i.kind){case"double":return ue(i.value);case"float":return Je(i.value);case"char":return String.fromCharCode(i.value);case"boolean":return i.value?"true":"false";default:return String(i.value)}}var Ba={className:"",classIndex:-1,isStatic:!0,name:"<native>",display:"<native>",file:"",argCount:0,returnsValue:!1,hidden:!0,code:new Int32Array(0),lines:new Int32Array(0),maxLocals:0,maxStack:0},$l=0,Ml=1,en=2,Va=3,Br="\\0launcher",Pl=Array.from({length:5},(i,t)=>`${Br}${t}`),Ha=65536;function _r(i,t){switch(i){case W.INT:return new Int32Array(t);case W.BOOLEAN:return new Uint8Array(t);case W.CHAR:return new Uint16Array(t);case W.LONG:return new Array(t).fill(0);case W.DOUBLE:return new Float64Array(t);case W.BYTE:return new Int8Array(t);case W.SHORT:return new Int16Array(t);case W.FLOAT:return new Float32Array(t);default:return new Array(t).fill(null)}}var Fs=(i,t)=>`Index ${i} out of bounds for length ${t}`;function Rl(i){switch(i){case"I":return W.INT;case"Z":return W.BOOLEAN;case"C":return W.CHAR;case"J":return W.LONG;case"D":return W.DOUBLE;case"B":return W.BYTE;case"S":return W.SHORT;case"F":return W.FLOAT;default:return W.REF}}function Jl(i){let t="";for(let e=0;e<i.length;e+=8192)t+=String.fromCharCode(...i.subarray(e,e+8192));return t}var za=["java.lang.String","java.lang.Object","java.lang.Comparable","java.lang.CharSequence"],Vr={int:"java.lang.Integer",long:"java.lang.Long",double:"java.lang.Double",char:"java.lang.Character",boolean:"java.lang.Boolean",float:"java.lang.Float",byte:"java.lang.Byte",short:"java.lang.Short"},Dl=Object.fromEntries(Object.keys(Vr).map(i=>[i,[Vr[i],"java.lang.Object","java.lang.Comparable",...i==="char"||i==="boolean"?[]:["java.lang.Number"]]])),jl=["java.lang.Object","java.lang.Cloneable","java.io.Serializable"],Fl="com.sun.tools.javac.launcher.MemoryClassLoader @6d06d69c";function _l(i){let t=0;for(let e=0;e<i.length;e++)t=Math.imul(t,31)+i.charCodeAt(e)|0;return t}var Ur=new DataView(new ArrayBuffer(8));function Ul(i){switch(i.kind){case"int":case"char":case"byte":case"short":return i.value;case"float":return fs(i.value);case"long":{let t=BigInt.asUintN(64,BigInt(i.value));return Number(BigInt.asIntN(32,t^t>>32n))}case"double":return Ur.setFloat64(0,Number.isNaN(i.value)?NaN:i.value),Ur.getInt32(0)^Ur.getInt32(4)|0;case"boolean":return i.value?1231:1237}}function Ga(i,t,e,n,s,r=""){let a=new Js,o=new Ds,c=i.strings.map(f=>a.intern(f)),u=i.numbers,d=mn(),h=i.natives.map(f=>{let T=d?.natives[f.name];if(!T)throw new Error(`interpreter: the library native ${f.name} is not loaded`);return T}),m=i.messages,p=i.methods,b=globalThis.performance,S=e.maxDurationMs>0?b.now()+e.maxDurationMs:1/0,v=(f,T=-1)=>({method:f,code:f.code,locals:new Array(f.maxLocals).fill(0),stack:new Array(f.maxStack+1).fill(0),sp:0,pc:0,returnPc:0,initClass:T}),x=i.staticFieldIsReference.map(f=>f?null:0),C=i.staticFieldOwner,E=i.classes,R=E.map(f=>f.instanceFieldIsReference.map(T=>T?null:0)),L=new Uint8Array(E.length),I=new Int32Array(E.length).fill(-1),N=(i.loadWarnings??[]).map((f,T)=>{for(let O of f.classes)I[O]=T;return!0}),J=new Map(E.map(f=>[f.name,f.types])),D=f=>f instanceof Ft?E[f.classIndex].types:f instanceof rt?za:f instanceof qt?Dl[f.kind]:f instanceof Ut?jl:f instanceof ye?J.get(f.iface)??d?.typesOf(f.iface)??[f.iface,"java.lang.Object"]:f instanceof pe?d?.typesOf(f.className)??["java.lang.Object"]:["java.lang.Object"],P=(f,T)=>{if(f===T)return!0;let O=f.slice(1),$=T.slice(1);if($==="Ljava.lang.Object;")return O.startsWith("[")||O.startsWith("L");if(O.startsWith("[")&&$.startsWith("["))return P(O,$);if(O.startsWith("L")&&$.startsWith("L")){let _=O.slice(1,-1);return(J.get(_)??(_==="java.lang.String"?za:[_,"java.lang.Object"])).includes($.slice(1,-1))}return!1},j=(f,T)=>f instanceof rt?T==="[Ljava.lang.String;"||tt(f,T.slice(1)):f instanceof Ft&&T.length===f.className.length+3&&T.slice(2,-1)===f.className?!0:tt(f,T.slice(1)),G=new Map,tt=(f,T)=>{if(f===null||typeof f!="object")return!1;if(T.charCodeAt(0)===91)return f instanceof Ut&&P(f.descriptor,T);let O=G.get(T);return O===void 0&&G.set(T,O=T.slice(1,-1)),D(f).includes(O)},Wt=f=>f instanceof Ft?f.className:f instanceof rt?"java.lang.String":f instanceof qt?Vr[f.kind]:f instanceof Ut?f.descriptor:f.className,be=f=>{let T=f.replace(/^\\[+/,"").replace(/^L(.*);$/,"$1");return J.has(T)&&!T.includes(".")?`unnamed module of loader ${Fl}`:"module java.base of loader \'bootstrap\'"},In=(f,T)=>{let O=Wt(f),$=be(O),_=be(T),B=$===_?`${O} and ${T} are in ${$}`:`${O} is in ${$}; ${T} is in ${_}`;return`class ${O} cannot be cast to class ${T} (${B})`},ot=v(p[i.entry]),pt=[ot],F=ot.code,Ct=ot.locals,g=ot.stack,y=0,w=0,Nt=0,zr=Math.min(Ha,e.maxInstructions+1),Hs=0,Te=0,Ae=(f,T)=>({outcome:{kind:"resource-limit",limit:f,message:T},instructions:Math.min(Nt,e.maxInstructions)}),Gr=f=>{ot.pc=w;let T=[],O=f!==void 0;for(let $=pt.length-1;$>=0&&T.length<1024;$--){let _=pt[$];_.method.hidden||O&&f(_)||(O=!1,T.push({className:_.method.className,method:_.method.name,file:_.method.file,line:Ma(_.method,_.pc)}))}return T},Kr=new Map(E.map((f,T)=>[f.name,T])),as=(f,T,O=null,$)=>{let _=Kr.get(f)??Kr.get("java.lang.RuntimeException"),B=R[_].slice();return B[mt.message]=T===null?null:new rt(T),B[mt.trace]=new Us($??Gr()),O&&(B[mt.cause]=O,B[mt.causeSet]=1),new Ft(f,_,B,o.next())},ct=(f,T,O=null)=>{throw new Cn(as(f,T,O))},qr=[],fo=f=>{let T=qr[f],O=T.fields[mt.message],$=O===null?T.className:`${T.className}: ${O.value}`,_=T.fields[mt.trace]?.frames??[],B=as("java.lang.ExceptionInInitializerError",`Exception ${$} [in thread "main"]`,null,_);return ct("java.lang.NoClassDefFoundError",`Could not initialize class ${E[f].name}`,B)},On=null,zs="",Wr=()=>({outcome:{kind:"exception",className:On.className,text:zs},instructions:Nt,...Ks?{inputExhausted:Ks}:{}}),po=f=>{let T=f;for(ot.pc=w;pt.length;){let $=pt[pt.length-1],_=$.method.handlers;if(_)for(let B=0;B<_.length;B+=4){if($.pc<_[B]||$.pc>=_[B+1])continue;let at=_[B+3];if(!(at>=0&&!tt(T,i.strings[at])))return ot=$,F=$.code,Ct=$.locals,g=$.stack,y=0,g[y++]=T,w=_[B+2],null}pt.pop(),$.initClass>=0&&(L[$.initClass]=Va,qr[$.initClass]=T,!tt(T,"Ljava.lang.Error;")&&pt.length&&(ot=pt[pt.length-1],w=ot.pc,T=as("java.lang.ExceptionInInitializerError",null,T)))}if(On)return zs+=`\nException: ${T.className} thrown from the UncaughtExceptionHandler in thread "main"\n`,Wr();On=T;let O=v(p[i.uncaught]);return O.locals[0]=T,pt.push(O),ot=O,F=O.code,Ct=O.locals,g=O.stack,y=0,w=0,null},Xr=new Map,Yr=new Map,Gs=(f,T)=>{if(!(f==="boolean"||f==="byte"||(f==="int"||f==="long"||f==="short")&&T>=-128&&T<=127||f==="char"&&T<=127))return new qt(f,T);let $=f+T,_=Yr.get($);return _||Yr.set($,_=new qt(f,T)),_},Ks=!1,qs={stdout:!1,stderr:!1},He={hash:()=>o.next(),intern:f=>a.intern(f),fail:(f,T,O)=>{throw new _s(f,T,O)},raise:f=>{throw new Cn(f)},limitation:f=>{throw new Bs(f)},charge:f=>{Nt+=f},allocate:f=>{if(Te+f>e.maxArrayElements)throw new ns(`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);Te+=f},print:(f,T)=>{let O=ii(f==="out"?"stdout":"stderr",T);if(O)throw new ss(O)},closeStream:f=>{qs[f==="out"?"stdout":"stderr"]=!0},streamClosed:f=>qs[f==="out"?"stdout":"stderr"],exit:f=>{throw new ss({outcome:{kind:"exit",status:f},instructions:Nt})},seed:()=>BigInt(Math.floor(Math.random()*2**32))*2n**16n+BigInt(Math.floor(Math.random()*2**16)),stdin:()=>r,inputExhausted:()=>{Ks=!0},checkString:f=>{if(f>e.maxStringLength)throw new ns(`the program built a String longer than ${e.maxStringLength.toLocaleString("en-US")} characters`)},methodOf:(f,T,O)=>E[f.classIndex].virtuals[`${T}/${O}`]??-1,overrideOf:(f,T)=>E[f.classIndex].libraryOverrides?.[T]??-1,castMessage:In,storable:(f,T)=>j(f,T),className:f=>Wt(f),toStringMethod:f=>E[f.classIndex].toString,equalsMethod:f=>E[f.classIndex].equals,hashCodeMethod:f=>E[f.classIndex].hashCode,box:Gs,staticMethod:(f,T,O)=>p.findIndex($=>$.isStatic&&$.className===f&&$.name===T&&$.argCount===O)},os=f=>f instanceof _s?ct(f.className,f.message,f.cause?as(f.cause.className,f.cause.message,null):null):f instanceof Bs?{outcome:{kind:"engine-limitation",message:f.message},instructions:Nt}:f instanceof ns?Ae("memory",f.message):f instanceof ss?f.result:null,Ws=(f,T)=>{let O=p[f];if(pt.length>e.maxCallDepth)return ct("java.lang.StackOverflowError",null);let $=si(O,-1),_=O.argSlots;for(let B=0;B<T.length;B++)$.locals[_?_[B]:B]=T[B];return pt.push($),ot=$,F=$.code,Ct=$.locals,g=$.stack,y=0,w=0,O.isStatic&&L[O.classIndex]!==en&&an(O.classIndex),null},Xs=[],Qr=f=>{let T=ot,O;try{let _=T.then;if(_){if(O=_(f),O instanceof Be)return O.resumes?(T.then=null,T.native=O.resumes,T.convert=O.convert):T.then=O.then,Ws(O.invoke,O.args);jr(O)&&(T.then=null,T.native=O,f=void 0)}if(!T.then){let B=T.native.next(f);if(!B.done)return Ws(B.value.invoke,B.value.args);let at=T.convert;O=at?at(B.value):B.value}}catch(_){let B=os(_);if(B)return B;throw _}pt.pop();let $=T.nativeReturns;return T.native=null,T.then=null,T.convert=null,Xs.length<32&&Xs.push(T),ot=pt[pt.length-1],F=ot.code,Ct=ot.locals,g=ot.stack,y=ot.sp,w=ot.returnPc,$&&(g[y++]=O??null),null},Zr=(f,T)=>{if(ot.pc=w,ot.returnPc=T,ot.sp=y,pt.length>e.maxCallDepth)return null;let O=Xs.pop()??v(Ba);return O.nativeReturns=f,pt.push(O),ot=O,O},rn=(f,T,O)=>{let $=Zr(T,O);return $?($.native=f,Qr(void 0)):ct("java.lang.StackOverflowError",null)},ti=(f,T,O)=>{let $=Zr(T,O);return $?(f.resumes?($.native=f.resumes,$.convert=f.convert):$.then=f.then,Ws(f.invoke,f.args)):ct("java.lang.StackOverflowError",null)};function*ei(f){let T=yield*d.toString(He,f);return new rt(T)}let ni=(f,T,O)=>{y-=T.length;let $;try{$=d.natives[f](He,T)}catch(_){let B=os(_);if(B)return B;throw _}return $ instanceof Be?ti($,!0,O):jr($)?rn($,!0,O):(g[y++]=$??null,w=O,null)};for(let f of p)f.freeFrames=[];let si=(f,T)=>{let O=f.freeFrames.pop();if(!O)return v(f,T);let $=O.locals;for(let _=0;_<$.length;_++)$[_]=0;return O.sp=0,O.pc=0,O.returnPc=0,O.initClass=T,O},yo=f=>{let T=f.method.freeFrames;T&&T.length<32&&T.push(f)},ze=(f,T,O=-1)=>{ot.pc=w,ot.returnPc=T,y-=f.argCount,ot.sp=y;let $=si(f,O),_=f.argSlots;if(_)for(let B=0;B<f.argCount;B++)$.locals[_[B]]=g[y+B];else for(let B=0;B<f.argCount;B++)$.locals[B]=g[y+B];pt.push($),ot=$,F=$.code,Ct=$.locals,g=$.stack,y=0,w=0},an=f=>{if(L[f]!==$l)return L[f]===Va&&fo(f),!1;let T=I[f];T>=0&&N[T]&&(N[T]=!1,t("stderr",i.loadWarnings[T].text));let O=E[f].superclass;if(O>=0&&an(O))return!0;let $=E[f].clinit;return $<0?(L[f]=en,!1):(L[f]=Ml,ze(p[$],w,f),!0)},Et=f=>ct("java.lang.NullPointerException",f>=0?m[f]:null),ri=(f,T,O)=>{let $=T[O],_=f.slice(1);if(O===T.length-1){let at=Rl(_);return new Ut(at,_r(at,$),o.next(),f)}let B=new Array($);for(let at=0;at<$;at++)B[at]=ri(_,T,O+1);return new Ut(W.REF,B,o.next(),f)},ii=(f,T)=>{if(qs[f])return null;if(On&&f==="stderr")return zs+=T,null;if(Hs+T.length>e.maxOutputChars){let O=e.maxOutputChars-Hs;return O>0&&t(f,T.slice(0,O)),Ae("output",`the program printed more than ${e.maxOutputChars.toLocaleString("en-US")} characters`)}return Hs+=T.length,Nt+=T.length>>>6,T&&t(f,T),null},ai=[];if(s){let f={string:T=>new rt(T),box:Gs,array:(T,O,$)=>new Ut(T,O,o.next(),$),object:T=>{let O=i.classes[T];return new Ft(O.name,T,O.instanceFieldIsReference.map($=>$?null:0),o.next())},list:T=>{if(!d)throw new Error("interpreter: practice lists need the Java library");return d.newList(He,T)},allocate:T=>He.allocate(T)};try{ai=s.args(f)}catch(T){let O=os(T);if(O)return O;throw T}}for(;;)try{for(;;){if(++Nt>=zr){if(Nt>e.maxInstructions)return Ae("instructions",`the program ran more than ${e.maxInstructions.toLocaleString("en-US")} steps`);if(S!==1/0&&b.now()>S)return Ae("time",`the program ran longer than ${e.maxDurationMs} ms`);zr=Math.min(Nt+Ha,e.maxInstructions+1),n?.()}switch(F[w]){case 1:g[y++]=F[w+1],w+=2;break;case 2:g[y++]=c[F[w+1]],w+=2;break;case 3:g[y++]=null,w+=1;break;case 4:g[y++]=Ct[F[w+1]],w+=2;break;case 5:Ct[F[w+1]]=g[--y],w+=2;break;case 6:y--,w+=1;break;case 7:g[y]=g[y-1],y++,w+=1;break;case 8:{let f=g[y-1];g[y-1]=g[y-2],g[y-2]=f,g[y++]=f,w+=1;break}case 9:{let f=g[y-1];g[y-1]=g[y-2],g[y-2]=g[y-3],g[y-3]=f,g[y++]=f,w+=1;break}case 24:g[y]=g[y-2],g[y+1]=g[y-1],y+=2,w+=1;break;case 10:{let f=g[--y];g[y-1]=g[y-1]+f|0,w+=1;break}case 11:{let f=g[--y];g[y-1]=g[y-1]-f|0,w+=1;break}case 12:{let f=g[--y];g[y-1]=Math.imul(g[y-1],f),w+=1;break}case 13:{let f=g[--y];if(f===0)return ct("java.lang.ArithmeticException","/ by zero");g[y-1]=g[y-1]/f|0,w+=1;break}case 14:{let f=g[--y];if(f===0)return ct("java.lang.ArithmeticException","/ by zero");g[y-1]=g[y-1]%f|0,w+=1;break}case 15:g[y-1]=-g[y-1]|0,w+=1;break;case 16:{let f=g[--y];g[y-1]=g[y-1]<<f,w+=1;break}case 17:{let f=g[--y];g[y-1]=g[y-1]>>f,w+=1;break}case 18:{let f=g[--y];g[y-1]=g[y-1]>>>f|0,w+=1;break}case 19:{let f=g[--y];g[y-1]=g[y-1]&f,w+=1;break}case 20:{let f=g[--y];g[y-1]=g[y-1]|f,w+=1;break}case 21:{let f=g[--y];g[y-1]=g[y-1]^f,w+=1;break}case 22:g[y-1]=~g[y-1],w+=1;break;case 23:g[y-1]=g[y-1]^1,w+=1;break;case 25:g[y-1]=g[y-1]&65535,w+=1;break;case 163:g[y-1]=g[y-1]<<24>>24,w+=1;break;case 164:g[y-1]=g[y-1]<<16>>16,w+=1;break;case 165:case 167:g[y-1]=Math.fround(g[y-1]),w+=1;break;case 166:g[y-1]=hn(g[y-1]),w+=1;break;case 168:{let f=g[--y];g[y-1]=Math.fround(g[y-1]+f),w+=1;break}case 169:{let f=g[--y];g[y-1]=Math.fround(g[y-1]-f),w+=1;break}case 170:{let f=g[--y];g[y-1]=Math.fround(g[y-1]*f),w+=1;break}case 171:{let f=g[--y];g[y-1]=Math.fround(g[y-1]/f),w+=1;break}case 172:{let f=g[--y];g[y-1]=Math.fround(g[y-1]%f),w+=1;break}case 173:g[y-1]=new rt(Je(g[y-1])),w+=1;break;case 30:case 36:{let f=g[--y];g[y-1]=g[y-1]===f?1:0,w+=1;break}case 31:case 37:{let f=g[--y];g[y-1]=g[y-1]!==f?1:0,w+=1;break}case 32:{let f=g[--y];g[y-1]=g[y-1]<f?1:0,w+=1;break}case 33:{let f=g[--y];g[y-1]=g[y-1]<=f?1:0,w+=1;break}case 34:{let f=g[--y];g[y-1]=g[y-1]>f?1:0,w+=1;break}case 35:{let f=g[--y];g[y-1]=g[y-1]>=f?1:0,w+=1;break}case 40:w=F[w+1];break;case 41:w=g[--y]===0?F[w+1]:w+2;break;case 180:{let f=g[--y],T=g[--y];w=js(F[w+1],T,f)?F[w+2]:w+3;break}case 181:w=js(F[w+1],g[--y],F[w+2])?F[w+3]:w+4;break;case 182:w=js(F[w+1],Ct[F[w+2]],Ct[F[w+3]])?F[w+4]:w+5;break;case 183:w=js(F[w+1],Ct[F[w+2]],F[w+3])?F[w+4]:w+5;break;case 184:w=Ct[F[w+2]]===null==(F[w+1]===1)?F[w+3]:w+4;break;case 185:g[y++]=Ct[F[w+1]],g[y++]=Ct[F[w+2]],w+=3;break;case 186:g[y++]=Ct[F[w+1]],g[y++]=F[w+2],w+=3;break;case 187:g[y-1]=g[y-1]+F[w+1]|0,w+=2;break;case 191:{let f=g[--y],T=g[--y];T.base=f,f.owner=T,w+=1;break}case 192:{let f=g[y-1];f instanceof Ft&&f.base!==null&&(g[y-1]=f.base),w+=1;break}case 190:g[y-1]=Ll(F[w+1],g[y-1],F[w+2]),w+=3;break;case 188:{let f=F[w+1];Ct[f]=Ct[f]+F[w+2]|0,w=F[w+3];break}case 189:{let f=Ct[F[w+1]],T=Ct[F[w+2]];if(f===null)return Et(F[w+4]);if(T<0||T>=f.data.length)return ct("java.lang.ArrayIndexOutOfBoundsException",Fs(T,f.data.length));g[y++]=f.data[T],w+=5;break}case 42:w=g[--y]!==0?F[w+1]:w+2;break;case 43:{let f=F[w+1];Ct[f]=Ct[f]+F[w+2]|0,w+=3;break}case 50:g[y-1]=new rt(String(g[y-1])),w+=1;break;case 54:g[y-1]=new rt(String.fromCharCode(g[y-1])),w+=1;break;case 143:g[y-1]=new rt(String(g[y-1])),w+=1;break;case 144:g[y-1]=new rt(ue(g[y-1])),w+=1;break;case 120:g[y++]=u[F[w+1]],w+=2;break;case 121:{let f=g[--y];g[y-1]=gi(g[y-1],f),w+=1;break}case 122:{let f=g[--y];g[y-1]=bi(g[y-1],f),w+=1;break}case 123:{let f=g[--y];g[y-1]=Ti(g[y-1],f),w+=1;break}case 124:{let f=g[--y];if(f===0)return ct("java.lang.ArithmeticException","/ by zero");g[y-1]=Si(g[y-1],f),w+=1;break}case 125:{let f=g[--y];if(f===0)return ct("java.lang.ArithmeticException","/ by zero");g[y-1]=xi(g[y-1],f),w+=1;break}case 126:g[y-1]=rr(g[y-1]),w+=1;break;case 127:{let f=g[--y];g[y-1]=vi(g[y-1],f),w+=1;break}case 128:{let f=g[--y];g[y-1]=wi(g[y-1],f),w+=1;break}case 129:{let f=g[--y];g[y-1]=ki(g[y-1],f),w+=1;break}case 130:{let f=g[--y];g[y-1]=Ci(g[y-1],f),w+=1;break}case 131:{let f=g[--y];g[y-1]=Ei(g[y-1],f),w+=1;break}case 132:{let f=g[--y];g[y-1]=Ai(g[y-1],f),w+=1;break}case 133:{let f=g[--y];g[y-1]=g[y-1]+f,w+=1;break}case 134:{let f=g[--y];g[y-1]=g[y-1]-f,w+=1;break}case 135:{let f=g[--y];g[y-1]=g[y-1]*f,w+=1;break}case 136:{let f=g[--y];g[y-1]=g[y-1]/f,w+=1;break}case 137:{let f=g[--y];g[y-1]=g[y-1]%f,w+=1;break}case 138:g[y-1]=-g[y-1],w+=1;break;case 139:g[y-1]=ds(g[y-1]),w+=1;break;case 140:g[y-1]=ms(g[y-1]),w+=1;break;case 141:g[y-1]=Mn(g[y-1]),w+=1;break;case 142:g[y-1]=$n(g[y-1]),w+=1;break;case 146:if(g[--y]===null)return Et(F[w+1]);w+=2;break;case 147:{switch(F[w+1]){case lt.ABS_I:g[y-1]=Math.abs(g[y-1])|0;break;case lt.ABS_L:{let T=g[y-1];g[y-1]=T<0?rr(T):T;break}case lt.ABS_D:g[y-1]=Math.abs(g[y-1]);break;case lt.MAX_I:case lt.MAX_D:{let T=g[--y];g[y-1]=Math.max(g[y-1],T);break}case lt.MIN_I:case lt.MIN_D:{let T=g[--y];g[y-1]=Math.min(g[y-1],T);break}case lt.MAX_L:{let T=g[--y],O=g[y-1];g[y-1]=O>=T?O:T;break}case lt.MIN_L:{let T=g[--y],O=g[y-1];g[y-1]=O<=T?O:T;break}case lt.SQRT:g[y-1]=Math.sqrt(g[y-1]);break;case lt.FLOOR:g[y-1]=Math.floor(g[y-1]);break;case lt.CEIL:g[y-1]=Math.ceil(g[y-1]);break;case lt.ROUND:g[y-1]=Oi(g[y-1]);break;case lt.ROUND_F:g[y-1]=Ii(g[y-1]);break}w+=2;break}case 145:{let f=i.strings[F[w+1]],T=F[w+2],O=g.slice(y-T,y);y-=T;for(let B of O)if(B<0)return ct("java.lang.NegativeArraySizeException",String(B));let $=0,_=1;for(let B of O)_*=B,$+=_;if(Te+$>e.maxArrayElements)return Ae("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);Te+=$,Nt+=$>>>4,g[y++]=ri(f,O,0),w+=3;break}case 51:g[y-1]=new rt(g[y-1]?"true":"false"),w+=1;break;case 52:{let f=g[y-1];f===null?g[y-1]=new rt("null"):f instanceof qt?g[y-1]=new rt(Fr(f)):f instanceof rt||(g[y-1]=new rt(Ve(f))),w+=1;break}case 53:{let f=g[--y],T=g[y-1],O=T.value.length+f.value.length;if(O>e.maxStringLength)return Ae("memory",`the program built a String longer than ${e.maxStringLength.toLocaleString("en-US")} characters`);Nt+=O>>>6,g[y-1]=new rt(T.value+f.value),w+=1;break}case 60:{let f=F[w+3],T="";if(f!==kt.NONE){let $=g[--y];switch(f){case kt.INT:T=String($);break;case kt.CHAR:T=String.fromCharCode($);break;case kt.BOOLEAN:T=$?"true":"false";break;case kt.STRING:T=$===null?"null":$.value;break;case kt.LONG:T=String($);break;case kt.DOUBLE:T=ue($);break;case kt.FLOAT:T=Je($);break;case kt.CHAR_ARRAY:if($===null)return ct("java.lang.NullPointerException",\'Cannot read the array length because "cbuf" is null\');T=Jl($.data);break;default:T=$===null?"null":$ instanceof rt?$.value:Ve($)}}F[w+2]===1&&(T+=`\n`);let O=ii(F[w+1]===1?"stderr":"stdout",T);if(O)return O;w+=4;break}case 72:{let f=p[F[w+1]];if(f.isStatic&&L[f.classIndex]!==en&&an(f.classIndex))break;let T=F[w+2];if(T>=0&&g[y-f.argCount]===null)return Et(T);if(pt.length>e.maxCallDepth)return ct("java.lang.StackOverflowError",null);ze(f,w+3);break}case 70:case 71:{let f=F[w]===l.RETURN_VALUE?g[--y]:void 0,T=pt.pop();if(T.initClass>=0&&(L[T.initClass]=en),yo(T),!pt.length)return On?Wr():{outcome:{kind:"completed"},instructions:Nt};if(ot=pt[pt.length-1],ot.method===Ba){let O=Qr(f);if(O)return O;break}F=ot.code,Ct=ot.locals,g=ot.stack,y=ot.sp,w=ot.returnPc,f!==void 0&&(g[y++]=f);break}case 80:{let f=g[y-1];if(f<0)return ct("java.lang.NegativeArraySizeException",String(f));if(Te+f>e.maxArrayElements)return Ae("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);Te+=f,Nt+=f>>>4,g[y-1]=new Ut(F[w+1],_r(F[w+1],f),o.next()),w+=2;break}case 84:{let f=g[y-1];if(f<0)return ct("java.lang.NegativeArraySizeException",String(f));if(Te+f>e.maxArrayElements)return Ae("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);Te+=f,Nt+=f>>>4,g[y-1]=new Ut(W.REF,_r(W.REF,f),o.next(),i.strings[F[w+1]]),w+=2;break}case 81:{let f=g[--y],T=g[y-1];if(T===null)return Et(F[w+2]);if(f<0||f>=T.data.length)return ct("java.lang.ArrayIndexOutOfBoundsException",Fs(f,T.data.length));g[y-1]=T.data[f],w+=3;break}case 82:{let f=g[--y],T=g[--y],O=g[--y];if(O===null)return Et(F[w+2]);if(T<0||T>=O.data.length)return ct("java.lang.ArrayIndexOutOfBoundsException",Fs(T,O.data.length));if(f!==null&&F[w+1]===W.REF&&O.descriptor!=="[Ljava.lang.Object;"&&!j(f,O.descriptor))return ct("java.lang.ArrayStoreException",Wt(f));O.data[T]=f,w+=3;break}case 83:{let f=g[y-1];if(f===null)return Et(F[w+1]);g[y-1]=f.data.length,w+=2;break}case 90:{let f=g[y-1];if(f===null)return Et(F[w+1]);g[y-1]=f.value.length,w+=2;break}case 91:{let f=g[--y],T=g[y-1];if(T===null)return Et(F[w+1]);if(f<0||f>=T.value.length)return ct("java.lang.StringIndexOutOfBoundsException",Fs(f,T.value.length));g[y-1]=T.value.charCodeAt(f),w+=2;break}case 92:{let f=g[--y],T=g[y-1];if(T===null)return Et(F[w+1]);g[y-1]=f instanceof rt&&f.value===T.value?1:0,w+=2;break}case 153:{let f=g[--y],T=g[y-1];if(T===null)return Et(F[w+1]);if(f===null)return Et(F[w+2]);let O=T.value,$=f.value,_=Math.min(O.length,$.length),B=O.length-$.length;for(let at=0;at<_;at++){let Se=O.charCodeAt(at)-$.charCodeAt(at);if(Se!==0){B=Se;break}}Nt+=_>>>4,g[y-1]=B,w+=3;break}case 100:{let f=F[w+1],T=C[f];if(L[T]!==en&&an(T))break;g[y++]=x[f],w+=2;break}case 101:{let f=F[w+1],T=C[f];if(L[T]!==en&&an(T))break;x[f]=g[--y],w+=2;break}case 102:{let f=g[y-1];if(f===null)return Et(F[w+2]);g[y-1]=f.fields[F[w+1]],w+=3;break}case 103:{let f=g[--y],T=g[--y];if(T===null)return Et(F[w+2]);T.fields[F[w+1]]=f,w+=3;break}case 104:{let f=F[w+1];if(L[f]!==en&&an(f))break;g[y++]=new Ft(E[f].name,f,R[f].slice(),o.next()),w+=2;break}case 110:{let f=g[y-1];if(f instanceof Ft){let T=E[f.classIndex].toString;if(T>=0){if(pt.length>e.maxCallDepth)return ct("java.lang.StackOverflowError",null);ze(p[T],w+1);break}g[y-1]=new rt(Ve(f))}else if(f===null)g[y-1]=new rt("null");else if(f instanceof Ut)g[y-1]=new rt(Dr(f));else if(f instanceof qt)g[y-1]=new rt(Fr(f));else if(f instanceof pe){y--;let T=rn(ei(f),!0,w+1);if(T)return T;break}w+=1;break}case 148:{let f=F[w+1],T=i.natives[f],O=F[w+2];if(O>=0&&g[y-T.argCount]===null)return Et(O);let $=g.slice(y-T.argCount,y);if(y-=T.argCount,T.unwrap)for(let B=0;B<$.length;B++){let at=$[B];if(!(T.unwrap>>B&1)||!(at instanceof Ft)||at.base===null)continue;if(at.base.opaque)return{outcome:{kind:"engine-limitation",message:`passing a ${at.className}, an AbstractList subclass, to ${T.name.slice(0,T.name.indexOf("("))}()`},instructions:Nt};let Se=T.unwrapCalls,Ge=Object.keys(E[at.classIndex].libraryOverrides??{}).find(Ln=>!Na.has(Ln)&&(Se.includes("*")||Se.includes(Ln)));if(Ge!==void 0)return{outcome:{kind:"engine-limitation",message:`passing a ${at.className}, which overrides ${Ge.slice(0,Ge.indexOf("("))}(), to ${T.name.slice(0,T.name.indexOf("("))}(), which would call it`},instructions:Nt};$[B]=at.base}let _;try{_=h[f](He,$)}catch(B){let at=os(B);if(at)return at;throw B}if(_ instanceof Be){let B=ti(_,T.returnsValue,w+3);if(B)return B;break}if(jr(_)){let B=rn(_,T.returnsValue,w+3);if(B)return B;break}T.returnsValue&&(g[y++]=_??null),w+=3;break}case 149:g[y-1]=Gs(Ir[F[w+1]],g[y-1]),w+=2;break;case 150:{let f=g[y-1];if(f===null)return Et(F[w+2]);g[y-1]=f.value,w+=3;break}case 154:g[y++]=ai[F[w+1]],w+=2;break;case 155:s.result(g[--y]),w+=1;break;case 152:{let f=F[w+1],T=F[w+2],O=c[F[w+3]].value,$=F[w+5]>=0?c[F[w+5]].value:null;if(T===0){let _=Xr.get(f);_||Xr.set(f,_=new ye(`${p[f].className}$$Lambda`,f,o.next(),[],O,F[w+4],$)),g[y++]=_}else{let _=g.slice(y-T,y);y-=T,g[y++]=new ye(`${p[f].className}$$Lambda`,f,o.next(),_,O,F[w+4],$)}w+=6;break}case 151:{let f=g[y-1];if(f===null)return Et(F[w+1]);let T=new Uint16Array(f.value.length);for(let O=0;O<T.length;O++)T[O]=f.value.charCodeAt(O);if(Te+T.length>e.maxArrayElements)return Ae("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);Te+=T.length,Nt+=T.length>>>4,g[y-1]=new Ut(W.CHAR,T,o.next()),w+=2;break}case 111:{let f=g[y-1];if(f===null)return Et(F[w+1]);if(f instanceof Ft&&E[f.classIndex].toString>=0){if(pt.length>e.maxCallDepth)return ct("java.lang.StackOverflowError",null);ze(p[E[f.classIndex].toString],w+2);break}if(f instanceof pe){y--;let T=rn(ei(f),!0,w+2);if(T)return T;break}f instanceof qt?g[y-1]=new rt(Fr(f)):f instanceof rt||(g[y-1]=new rt(Ve(f))),w+=2;break}case 112:{let f=g[y-1];if(f===null)return Et(F[w+1]);if(f instanceof Ft&&E[f.classIndex].hashCode>=0){if(pt.length>e.maxCallDepth)return ct("java.lang.StackOverflowError",null);ze(p[E[f.classIndex].hashCode],w+2);break}if(f instanceof pe&&!(f instanceof ye)&&d?.natives["hashCode()"]){let T=ni("hashCode()",[f],w+2);if(T)return T;break}g[y-1]=f instanceof rt?_l(f.value):f instanceof qt?Ul(f):f.hash,w+=2;break}case 113:{let f=g[y-1],T=g[y-2];if(T===null)return Et(F[w+1]);if(T instanceof Ft&&E[T.classIndex].equals>=0){if(pt.length>e.maxCallDepth)return ct("java.lang.StackOverflowError",null);ze(p[E[T.classIndex].equals],w+2);break}if(T instanceof pe&&!(T instanceof ye)&&d?.natives["equals(Object)"]){let O=ni("equals(Object)",[T,f],w+2);if(O)return O;break}y--,T instanceof rt?g[y-1]=f instanceof rt&&f.value===T.value?1:0:T instanceof qt?g[y-1]=f instanceof qt&&f.kind===T.kind&&Object.is(f.value,T.value)?1:0:g[y-1]=T===f?1:0,w+=2;break}case 159:{let f=F[w+1];if(f===2){let T=g[--y];g[y-1]=g[y-1]===T?1:0}else{let T=g[y-1];g[y-1]=f===0?new rt(Ve(T)):T.hash}w+=2;break}case 156:{let f=p[F[w+1]],T=F[w+2],O=g[y-f.argCount];if(O===null)return Et(T);let $=f;if(O instanceof Ft){let _=E[O.classIndex].vtable[f.selector];_>=0&&($=p[_])}else if(O instanceof ye&&O.samSelector===f.selector){let _=y-f.argCount,B=g.slice(_+1,y);y=_;for(let at of O.captured)g[y++]=at;for(let at of B)g[y++]=at;$=p[O.method]}if(pt.length>e.maxCallDepth)return ct("java.lang.StackOverflowError",null);ze($,w+3);break}case 157:{let f=g[y-1],T=i.strings[F[w+1]];if(f!==null&&!tt(f,T)){let O=T.startsWith("[")?T:T.slice(1,-1);return ct("java.lang.ClassCastException",In(f,O))}w+=2;break}case 160:{let f=E[F[w+1]],T=g[y-1];if(T===null)return ct("java.lang.NullPointerException","Name is null");let O=f.enumConstants.find($=>x[$].fields[0].value===T.value);if(O===void 0)return ct("java.lang.IllegalArgumentException",`No enum constant ${f.canonicalName}.${T.value}`);g[y-1]=x[O],w+=2;break}case 158:g[y-1]=tt(g[y-1],i.strings[F[w+1]])?1:0,w+=2;break;case 161:{let f=g[--y];if(f===null)return Et(F[w+1]);throw new Cn(f)}case 162:{let f=F[w+1];if(f===jt.PRINT_TRACE||f===jt.PRINT_UNCAUGHT){let T=g[--y],O=rn(bo(T,f===jt.PRINT_UNCAUGHT),!1,w+2);if(O)return O;break}if(f===jt.FILL_TRACE){let T=g[y-1],O=E[T.classIndex].types,$=_=>(_.method.name==="<init>"||_.method.name==="fillInStackTrace")&&O.includes(_.method.className);T.fields[mt.trace]=new Us(Gr($))}else if(f===jt.ADD_SUPPRESSED){let T=g[--y],O=g[--y];if(T===O)return ct("java.lang.IllegalArgumentException","Self-suppression not permitted",T);if(T===null)return ct("java.lang.NullPointerException","Cannot suppress a null exception.");let $=O.fields[mt.suppressed];$?$.push(T):O.fields[mt.suppressed]=[T]}else if(f===jt.GET_SUPPRESSED){let T=g[y-1],O=Ys(T);He.allocate(O.length),g[y-1]=new Ut(W.REF,O.slice(),o.next(),"[Ljava.lang.Throwable;")}else if(f===jt.CLASS_NAME)g[y-1]=new rt(g[y-1].className);else if(f===jt.INIT_CAUSE){let T=g[y-1],O=g[y-2];if(O.fields[mt.causeSet]){y-=2;let $=rn(go(O,T),!1,w+2);if($)return $;break}if(T===O)return ct("java.lang.IllegalArgumentException","Self-causation not permitted",O);O.fields[mt.cause]=T,O.fields[mt.causeSet]=1,y--}w+=2;break}default:throw new Error(`interpreter: unknown opcode ${F[w]} at ${w}`)}}}catch(f){if(!(f instanceof Cn))throw f;let T=po(f.thrown);if(T)return T}function Ys(f){return f.fields[mt.suppressed]??[]}function*ls(f){let T=yield{invoke:E[f.classIndex].toString,args:[f]};return T==null?"null":T.value}function*go(f,T){let O=T===null?"a null":yield*ls(T);return ct("java.lang.IllegalStateException",`Can\'t overwrite cause with ${O}`,f)}function*bo(f,T){let O=At=>He.print("err",At),$=new Set([f]),_=At=>(At.fields[mt.trace]?.frames??[]).map(_a),B=At=>[..._(At),...Pl].slice(0,1024);function*at(At){return yield{invoke:E[At.classIndex].virtuals["getCause/0"],args:[At]}}function*Se(At,oi,li,on){if($.has(At)){O(`${on}${li}[CIRCULAR REFERENCE: ${yield*ls(At)}]\n`);return}$.add(At);let Ke=B(At),Nn=Ke.length-1;for(let xe=oi.length-1;Nn>=0&&xe>=0&&Ke[Nn]===oi[xe];xe--)Nn--;let ci=Ke.length-1-Nn;O(`${on}${li}${yield*ls(At)}\n`);for(let xe=0;xe<=Nn;xe++)Ke[xe].startsWith(Br)||O(`${on} at ${Ke[xe]}\n`);ci&&O(`${on} ... ${ci} more\n`);for(let xe of Ys(At))yield*Se(xe,Ke,"Suppressed: ",on+" ");let ui=yield*at(At);ui&&(yield*Se(ui,Ke,"Caused by: ",on))}T&&O(\'Exception in thread "main" \'),O(`${yield*ls(f)}\n`);let Ge=T?_(f):B(f);for(let At of Ge)At.startsWith(Br)||O(` at ${At}\n`);for(let At of Ys(f))yield*Se(At,Ge,"Suppressed: "," ");let Ln=yield*at(f);Ln&&(yield*Se(Ln,Ge,"Caused by: ",""))}}var Bt=class extends Error{},ge=class extends Error{},sn=class extends Error{},Ka=i=>i.replace(/\\s+/g,"");function Wa(i,t){let e=t.className?i.classes.filter(h=>h.name===t.className||h.displayName===t.className):i.classes;if(t.className&&!e.length)throw new Bt(`no class ${t.className} in the program`);let n=e.flatMap(h=>h.methods.filter(m=>m.name===t.method&&!m.lambda));if(t.params){let h=t.params.map(Ka);n=n.filter(m=>m.params.length===h.length&&m.params.every((p,b)=>Ka(M(p))===h[b]))}let s=`${t.method}(${(t.params??[]).join(", ")})`;if(!n.length)throw new Bt(`no method ${t.params?s:t.method+"(...)"}${t.className?` in class ${t.className}`:""}`);if(n.length>1)throw new Bt(`${n.length} methods named ${t.method}: list its parameter types in practice.params to choose one`);let r=n[0],a=null;if(!r.isStatic){if(r.owner.isInner)throw new Bt(`${r.name} is an instance method of an inner class; make the class static or the method static`);if(a=r.owner.constructors.find(h=>h.params.length===0)??null,!a)throw new Bt(`${r.owner.displayName} needs a constructor with no parameters, to call its instance method ${r.name}`)}let o=r.params.map((h,m)=>is(h,t,`parameter ${m+1} of ${r.name}`)),c=t.compare??{kind:"return"},u=null,d=null;if(c.kind==="argument"){if(!Number.isInteger(c.index)||c.index<0||c.index>=o.length)throw new Bt(`compare.index ${c.index} is not a parameter of ${r.name}`);d=c.index}else{if(r.returnType.tag==="void")throw new Bt(`${r.name} returns nothing: compare one of its arguments instead ({ kind: \'argument\', index })`);u=is(r.returnType,t,`the result of ${r.name}`)}return{target:{method:r,constructor:a},params:o,result:u,compareIndex:d,tolerance:c.tolerance??0,signature:`${r.owner.displayName}.${r.name}(${r.params.map(M).join(", ")})`}}function Xa(i){switch(i.tag){case"int":return"I";case"long":return"J";case"double":return"D";case"char":return"C";case"boolean":return"Z";case"string":return"Ljava.lang.String;";case"class":return`L${i.symbol.binaryName};`;case"library":return`L${i.symbol.qualifiedName};`;case"array":return`[${Xa(i.element)}`;default:return"Ljava.lang.Object;"}}var Bl={int:W.INT,boolean:W.BOOLEAN,char:W.CHAR,long:W.LONG,double:W.DOUBLE};function is(i,t,e){switch(i.tag){case"int":case"long":case"double":case"char":case"boolean":return{kind:i.tag};case"string":return{kind:"string"};case"array":return{kind:"array",element:is(i.element,t,e),arrayKind:Bl[i.element.tag]??W.REF,descriptor:Xa(i),type:M(i)};case"library":let n=i.symbol.box;if(n&&n!=="float"&&n!=="byte"&&n!=="short")return{kind:"box",box:n};if(["List","ArrayList","Collection"].includes(i.symbol.name)&&i.args[0])return{kind:"list",element:is(i.args[0],t,e)};break;case"class":return Vl(i.symbol,t,e)}throw new Bt(`${e} has type ${M(i)}, which practice cases cannot pass or compare yet`)}function Vl(i,t,e){let n=i.fields.filter(b=>!b.isStatic),s=b=>{let S=n.find(v=>v.name===b);if(!S)throw new Bt(`practice.nodes.${i.name}: ${i.name} has no field ${b}`);return S},r=n.filter(b=>b.type.tag==="class"&&b.type.symbol===i),a=n.filter(b=>!r.includes(b)),o=t.nodes?.[i.name],c=o?.kind??(r.length===1&&a.length===1?"list":r.length===2&&a.length===1?"tree":null);if(!c)throw new Bt(`${e} has type ${i.displayName}, which is not a list or tree node; describe it in practice.nodes`);let u=o?.value?s(o.value):a[0];if(!u)throw new Bt(`practice.nodes.${i.name} needs its value field`);let d=is(u.type,t,`${i.name}.${u.name}`);if(c==="list"){let b=o?.next?s(o.next):r[0];if(!b)throw new Bt(`practice.nodes.${i.name} needs its next field`);return{kind:"linked-list",cls:i,value:u,valueCodec:d,next:b}}let h=b=>r.find(S=>S.name===b),m=o?.left?s(o.left):h("left")??r[0],p=o?.right?s(o.right):h("right")??r.find(b=>b!==m);if(!m||!p)throw new Bt(`practice.nodes.${i.name} needs its left and right fields`);return{kind:"tree",cls:i,value:u,valueCodec:d,left:m,right:p}}var Hl=-2147483648,zl=2147483647,Gl=-(1n<<63n),Kl=(1n<<63n)-1n;function En(i){return JSON.stringify(i)??"undefined"}function qa(i,t,e){let n=s=>{throw new ge(`${e}: expected ${s}, got ${En(i)}`)};switch(t){case"int":return(typeof i!="number"||!Number.isInteger(i)||i<Hl||i>zl)&&n("an int"),i;case"long":{let s;if(typeof i=="string"&&/^-?\\d+$/.test(i))s=BigInt(i);else if(typeof i=="number"&&Number.isSafeInteger(i))s=BigInt(i);else return n("a long, as a decimal string");return(s<Gl||s>Kl)&&n("a long in range"),wt(s)}case"double":return typeof i=="number"?i:i==="NaN"?NaN:i==="Infinity"?1/0:i==="-Infinity"?-1/0:n(\'a double (a number, or "NaN", "Infinity", "-Infinity")\');case"char":return(typeof i!="string"||i.length!==1)&&n("a char, as a one-character string"),i.charCodeAt(0);case"boolean":return typeof i!="boolean"&&n("a boolean"),i?1:0}}function rs(i,t,e,n){switch(t.kind){case"int":case"long":case"double":case"char":case"boolean":return qa(i,t.kind,n);case"string":if(i===null)return null;if(typeof i!="string")throw new ge(`${n}: expected a String, got ${En(i)}`);return e.string(i);case"box":return i===null?null:e.box(t.box,qa(i,t.box,n));case"array":{if(i===null)return null;if(!Array.isArray(i))throw new ge(`${n}: expected ${t.type}, an array, got ${En(i)}`);e.allocate(i.length);let s=i.map((a,o)=>rs(a,t.element,e,`${n}[${o}]`)),r;switch(t.arrayKind){case W.INT:r=Int32Array.from(s);break;case W.BOOLEAN:r=Uint8Array.from(s);break;case W.CHAR:r=Uint16Array.from(s);break;case W.DOUBLE:r=Float64Array.from(s);break;default:r=s}return e.array(t.arrayKind,r,t.descriptor)}case"list":{if(i===null)return null;if(!Array.isArray(i))throw new ge(`${n}: expected a List, an array, got ${En(i)}`);return e.list(i.map((s,r)=>rs(s,t.element,e,`${n}[${r}]`)))}case"linked-list":{if(i===null)return null;if(!Array.isArray(i))throw new ge(`${n}: expected a ${t.cls.name} list, an array of values, got ${En(i)}`);e.allocate(i.length);let s=null;for(let r=i.length-1;r>=0;r--){let a=e.object(t.cls.index);a.fields[t.value.index]=rs(i[r],t.valueCodec,e,`${n}[${r}]`),a.fields[t.next.index]=s,s=a}return s}case"tree":{if(i===null)return null;if(!Array.isArray(i))throw new ge(`${n}: expected a ${t.cls.name} tree, a level-order array, got ${En(i)}`);if(!i.length||i[0]===null)return null;e.allocate(i.length);let s=c=>{let u=e.object(t.cls.index);return u.fields[t.value.index]=rs(i[c],t.valueCodec,e,`${n}[${c}]`),u},r=s(0),a=[r],o=1;for(let c=0;c<a.length&&o<i.length;c++){let u=a[c];for(let d of[t.left,t.right]){if(o>=i.length)break;if(i[o]!==null){let h=s(o);u.fields[d.index]=h,a.push(h)}o++}}return r}}}var Ya=1e5;function nn(i,t,e){let n=s=>{if(e.nodes-=s,e.nodes<0)throw new sn(`the result has more than ${Ya.toLocaleString("en-US")} elements, or is cyclic`)};switch(t.kind){case"int":return i;case"long":return String(i);case"double":return ql(i);case"char":return String.fromCharCode(i);case"boolean":return i===1;case"string":return i===null?null:i.value;case"box":return i===null?null:nn(i.value,{kind:t.box},e);case"array":{if(i===null)return null;let s=i.data;return n(s.length),Array.from(s,r=>nn(r,t.element,e))}case"list":{if(i===null)return null;let s=mn()?.listItems(i);if(!s)throw new sn("the result is not an ArrayList");return n(s.length),s.map(r=>nn(r,t.element,e))}case"linked-list":{let s=[],r=new Set;for(let a=i;a;a=a.fields[t.next.index]){if(r.has(a))throw new sn(`the ${t.cls.name} list has a cycle`);r.add(a),n(1),s.push(nn(a.fields[t.value.index],t.valueCodec,e))}return s}case"tree":{if(i===null)return[];let s=[],r=[i];for(let a=0;a<r.length;a++){let o=r[a];if(n(1),!o){s.push(null);continue}s.push(nn(o.fields[t.value.index],t.valueCodec,e)),r.push(o.fields[t.left.index],o.fields[t.right.index])}for(;s.length&&s[s.length-1]===null;)s.pop();return s}}}function ql(i){return Number.isNaN(i)?"NaN":i===1/0?"Infinity":i===-1/0?"-Infinity":i}function Vs(i,t,e=0){if(typeof i=="number"&&typeof t=="number")return i===t||Math.abs(i-t)<=e;if(Array.isArray(i)&&Array.isArray(t))return i.length===t.length&&i.every((n,s)=>Vs(n,t[s],e));if(i&&t&&typeof i=="object"&&typeof t=="object"&&!Array.isArray(i)&&!Array.isArray(t)){let n=Object.keys(i);return n.length===Object.keys(t).length&&n.every(s=>Vs(i[s],t[s],e))}return i===t}function Qa(i,t){if(t.length!==i.params.length)throw new ge(`${i.signature} takes ${i.params.length} argument${i.params.length===1?"":"s"}, the case has ${t.length}`);let e=[],n=null;return{host:{args:a=>e=t.map((o,c)=>rs(o,i.params[c],a,`argument ${c+1}`)),result:a=>{n=a}},actual:()=>{let a={nodes:Ya};return i.compareIndex!==null?nn(e[i.compareIndex],i.params[i.compareIndex],a):nn(n,i.result,a)}}}function Wl(i,t){let e=`${i}(${t.args.map(a=>JSON.stringify(a)).join(", ")})`,n=a=>JSON.stringify(a),s=[];switch(t.status){case"passed":s.push(`\\u2713 ${t.id} ${e} \\u2192 ${n(t.actual)}`);break;case"failed":s.push(`\\u2717 ${t.id} ${e} \\u2192 ${n(t.actual)}, expected ${n(t.expected)}`);break;case"completed":s.push(`\\u2022 ${t.id} ${e} \\u2192 ${n(t.actual)}`);break;case"invalid-case":s.push(`? ${t.id} invalid case: ${t.error}`);break;case"not-run":s.push(`- ${t.id} not run (${t.reason})`);break;default:s.push(`\\u2717 ${t.id} ${e}: ${t.status.replace("-"," ")}`),t.error&&s.push(...t.error.trimEnd().split(`\n`).map(a=>` ${a}`))}let r=t.stdout+t.stderr;return r&&s.push(...r.trimEnd().split(`\n`).map(a=>` | ${a}`)),s}function Za(i,t){let e=t.flatMap(r=>Wl(i,r)),n=t.filter(r=>r.expected!==void 0).length,s=t.filter(r=>r.status==="passed").length;return e.push(n?`${s} of ${n} passed`:`${t.length} case${t.length===1?"":"s"} run`),e.join(`\n`)+`\n`}var Hr={maxFiles:32,maxSourceChars:5e5,maxTotalSourceChars:1e6,maxNestingDepth:200,maxExpressionDepth:1e3,maxInstructions:2e8,maxOutputChars:1e6,maxStringLength:1e7,maxArrayElements:16e6,maxCallDepth:5e4,maxDurationMs:0},An=()=>globalThis.performance.now();function Xl(i,t){let e=Object.keys(i);return t||("Main.java"in i?"Main.java":e.find(n=>n.endsWith(".java"))??e[0]??"Main.java")}function eo(i,t={}){return no(i,t).result}function no(i,t,e=!0){let n=An(),s={...Hr,...t.limits},r=Xl(i,t.entry),a=i[r]??"",o=Qs(r,a),c=new ln,u=new Map([[r,o]]),d=null,h=x=>({result:{program:x,diagnostics:c.items,entry:r,diagnosticText:c.items.length?Zs(c.items,u):"",compileMs:An()-n},checked:d,source:o});if(Object.keys(i).length>s.maxFiles)return c.launchError(r,k.limit,`too many files for this engine (limit ${s.maxFiles})`),h(null);if(!(r in i)){let x=c.launchError(r,k.noMain,`could not find or load main class ${r}`);return x.text=`Error: Could not find or load main class ${r}\nCaused by: java.lang.ClassNotFoundException: ${r}`,h(null)}let m=Object.keys(i).filter(x=>x.endsWith(".java")&&/[\\\\/]/.test(x));if(m.length){let x=m[0].replace(/^.*[\\\\/]/,"");return c.launchError(r,k.unsupported,`${m.join(", ")}: Java files in folders are not supported in this version; put each class in a file of its own at the top level, such as ${x}`),h(null)}let p=new Set(Object.keys(i).filter(x=>x!==r&&x.endsWith(".java"))),b=[r],S=[],v=0;for(;;){for(let x of b.slice(S.length)){let C=i[x]??"",E=x===r?o:Qs(x,C);if(u.set(x,E),C.length>s.maxSourceChars)return c.launchError(x,k.limit,`${x} is too large for this engine (limit ${s.maxSourceChars.toLocaleString("en-US")} characters)`),h(null);if(v+=C.length,v>s.maxTotalSourceChars)return c.launchError(x,k.limit,`the program\'s files are too large for this engine together (limit ${s.maxTotalSourceChars.toLocaleString("en-US")} characters)`),h(null);let R=pi(C);if(R.errors.length){for(let I of R.errors)c.error(E,I.offset,"lex",I.code,I.message);return h(null)}let L=Fi(x,R.tokens,s);if(L.error)return L.error.code==="no-class"?x===r?c.launchError(x,k.noMain,L.error.message):c.launchError(r,k.unsupported,`${x} declares no class, so the launcher cannot find ${x.replace(/\\.java$/,"")} there`):c.error(E,L.error.offset,"parse",L.error.code,L.error.message,L.error.details),h(null);S.push({unit:L.unit,file:E})}try{let x=new Set([...p].filter(L=>!b.includes(L))),C=Ea(S,c,{launch:e,available:x});if(!C||c.hasErrors)return h(null);d=C;let E=e?Yl(Jr(C,o),C,c.items,u,r):null,R=E&&ur(E.natives);return R?{result:{program:null,diagnostics:[],entry:r,diagnosticText:"",compileMs:An()-n,needsLibrary:R},checked:null,source:o}:h(E)}catch(x){if(x instanceof Qn){b.push(x.fileName),S.length=0,v=0,c=new ln,u=new Map([[r,o]]);continue}if(x instanceof Ze)return c=new ln,c.launchError(r,k.unsupported,`${x.message}: not supported in this version`),h(null);if(!(x instanceof dn))throw x;return{result:{program:null,diagnostics:[],entry:r,diagnosticText:"",compileMs:An()-n,needsLibrary:x.module},checked:null,source:o}}}}function Yl(i,t,e,n,s){let r=[];for(let a of n.keys()){if(a===s)continue;let o=e.filter(u=>u.severity==="warning"&&u.file===a);if(!o.length)continue;let c=t.classes.filter(u=>u.topLevel.file?.name===a).map(u=>u.index);r.push({classes:c,text:Zs(o,n)})}return r.length&&(i.loadWarnings=r),i}var Ql={instructions:"The program ran for a very long time, so it was stopped. Look for a loop whose condition never becomes false.",output:"The program printed more output than this page can show, so it was stopped. Look for a print inside a loop that never ends.",memory:"The program used more memory (a very large array or String) than this in-browser Java engine allows, so it was stopped.",time:"The program ran longer than the time allowed, so it was stopped."},Zl="This program reached Java behavior this in-browser engine does not reproduce exactly, so it stopped rather than show something that might differ from a real JVM.";function so(i,t={}){return ro(i,t)}var tc="The program read more input than standard input had (a Scanner found nothing left to read). Type the input in the input box, one value or line for each read, then run again.";function ro(i,t,e){let n={...Hr,...t.limits},s="",r="",a=(p,b)=>{p==="stdout"?s+=b:r+=b,t.onOutput?.(p,b)};t.warnings&&a("stderr",t.warnings);let o=An(),{outcome:c,instructions:u,inputExhausted:d}=Ga(i,a,n,t.onCheckpoint,e,t.stdin??""),h=An()-o,m={stdout:s,diagnostics:[],instructions:u,compileMs:t.compileMs??0,runMs:h};switch(c.kind){case"completed":return{...m,status:"success",stderr:r,exitCode:0};case"exception":{let p=c.text;return d&&c.className==="java.util.NoSuchElementException"?{...m,status:"runtime-error",stderr:r+p,errorText:p,hint:tc,hintAbout:"stdin",exitCode:1}:{...m,status:"runtime-error",stderr:r+p,errorText:p,exitCode:1}}case"resource-limit":{let p=`Stopped: ${c.message} (limit of this in-browser Java engine).\n`;return{...m,status:"resource-limit",stderr:r+p,errorText:p,hint:Ql[c.limit],exitCode:1}}case"engine-limitation":{let p=`Stopped: ${c.message} (limitation of this in-browser Java engine).\n`;return{...m,status:"engine-limitation",stderr:r+p,errorText:p,hint:Zl,exitCode:1}}case"exit":return{...m,status:c.status===0?"success":"exited",stderr:r,exitCode:c.status,exited:!0}}}var to=500;function io(i,t,e={}){let n={...Hr,...e.limits},s=Array.isArray(t.cases)?t.cases:[],r=S=>s.map((v,x)=>({id:v.id??String(x+1),status:"not-run",args:v.args??[],expected:v.expected,stdout:"",stderr:"",reason:S,instructions:0,durationMs:0})),{result:a,checked:o,source:c}=no(i,e,!1),u={passed:0,total:s.length,diagnostics:a.diagnostics,diagnosticText:a.diagnosticText,compileMs:a.compileMs},d=S=>({...u,status:"invalid-practice",message:S,cases:r("invalid-practice")});if(!Array.isArray(t.cases)||typeof t.method!="string")return d("practice needs a method name and a list of cases");if(s.length>to)return d(`too many cases (limit ${to})`);if(a.needsLibrary)return{...u,status:"compile-error",cases:[],needsLibrary:a.needsLibrary};if(!o)return{...u,status:"compile-error",cases:r("compile-error")};let h;try{h=Wa(o,t)}catch(S){if(S instanceof Bt)return d(S.message);throw S}let m=Jr(o,c,h.target),p=ur(m.natives);if(p)return{...u,status:"compile-error",cases:[],needsLibrary:p};let b=[];for(let[S,v]of s.entries()){let x=Array.isArray(v.args)?v.args:[],C={id:v.id??String(S+1),status:"not-run",args:x,expected:v.expected,stdout:"",stderr:"",instructions:0,durationMs:0};b.push(C);let E,R;try{let L=Qa(h,x);R=L.actual,E=ro(m,{limits:n},L.host)}catch(L){if(L instanceof ge){C.status="invalid-case",C.error=L.message;continue}let I=L instanceof Error?L.message:String(L);C.reason="engine-failure";for(let N of r("engine-failure").slice(S+1))b.push(N);return{...u,status:"internal-error",message:`Internal error in the Java engine: ${I}`,cases:b,passed:b.filter(N=>N.status==="passed").length}}if(C.stdout=E.stdout,C.stderr=E.errorText?E.stderr.slice(0,E.stderr.length-E.errorText.length):E.stderr,C.instructions=E.instructions,C.durationMs=Math.round(E.runMs*100)/100,E.exited){C.status="runtime-error",C.error=`System.exit(${E.exitCode}) ended the program before ${t.method}() returned`;continue}if(E.status!=="success"){C.status=E.status==="runtime-error"||E.status==="resource-limit"||E.status==="engine-limitation"?E.status:"runtime-error",C.error=E.errorText,E.hint&&(C.hint=E.hint);continue}try{C.actual=R()}catch(L){if(!(L instanceof sn))throw L;C.status="runtime-error",C.error=`ResultEncodingError: ${L.message}`;continue}C.status=v.expected===void 0?"completed":Vs(C.actual,v.expected,h.tolerance)?"passed":"failed"}return{...u,status:"completed",cases:b,passed:b.filter(S=>S.status==="passed").length}}var ec={JString:rt,JArray:Ut,JObject:Ft,JBox:qt,JLibObject:pe,JLambda:ye,NativeThen:Be,doubleToString:ue,objectToString:Ve,normLong:wt,floatToString:Je,floatToIntBits:fs,intBitsToFloat:Ni,parseDecimalFloat:ir,parseHexFloating:Pi,l2f:hn};function ao(i){Bi(i(ec))}function oo(i,t){Vi(i,t)}var lo="0.34.1";async function nc(i){let t=globalThis,e=URL.createObjectURL(new Blob([i],{type:"text/javascript"}));try{let n=!1;if(typeof t.importScripts=="function")try{t.importScripts(e),n=!0}catch{}n||await import(e)}finally{URL.revokeObjectURL(e)}}async function sc(i,t,e){await e(t);let n=globalThis;if(i===ps){let r=n[lr];if(typeof r!="function")throw new Error("the library script did not define its factory");ao(r);return}let s=n[_i]?.[i];if(!s)throw new Error(`the script for ${i} did not define its natives`);oo(i,s)}var rc=8192,uo=16;function ho(i,t={}){let e=t.now??(()=>globalThis.performance.now()),n=[],s=0,r=0,a=0,o=null,c=(b,S)=>{o={job:b,module:S},i({type:"module-request",id:b.id,name:S})},u=()=>{if(r=e(),!n.length)return;let b=n;n=[],s=0;for(let S of b)i({type:S.type,id:a,text:S.text})},d=(b,S)=>{let v=n[n.length-1];v&&v.type===b?v.text+=S:n.push({type:b,text:S}),s+=S.length,(s>=rc||e()-r>=uo)&&u()},h=b=>{a=b.id,n=[],s=0,r=e();let S=e(),v=b.entry||"Main.java",x=b.files&&Object.keys(b.files).length?{...b.files}:{},C=Object.keys(x).length>0;!(v in x)&&(!C||b.code)&&(x[v]=b.code??"");try{let E=()=>{n.length&&e()-r>=uo&&u()};if(b.practice){m(b,x,v,S);return}let R=eo(x,{entry:v,limits:t.limits});if(R.needsLibrary){c(b,R.needsLibrary);return}let L=R.program?so(R.program,{limits:t.limits,stdin:b.stdin??"",onOutput:d,onCheckpoint:E,compileMs:R.compileMs,warnings:R.diagnosticText}):{status:"compile-error",stdout:"",stderr:R.diagnosticText,errorText:R.diagnosticText,diagnostics:R.diagnostics,exitCode:1,instructions:0,compileMs:R.compileMs,runMs:0};u();let I=e()-S;if(L.status==="success"){i({type:"result",id:b.id,durationMs:I,status:"success"});return}if(L.status==="cancelled")return;i({type:"error",id:b.id,message:L.status==="exited"?`Exited with status ${L.exitCode}.`:(L.errorText??"").replace(/\\n$/,""),hint:L.hint,...L.hintAbout?{hintAbout:L.hintAbout}:{},durationMs:I,status:L.status,...L.diagnostics.length?{diagnostics:L.diagnostics}:{}})}catch(E){u();let R=E instanceof Error?E.message:String(E);i({type:"fatal",id:b.id,message:`Internal error in the Java engine: ${R}`})}},m=(b,S,v,x)=>{let C=b.practice,E=io(S,C,{entry:v,limits:t.limits});if(E.needsLibrary){c(b,E.needsLibrary);return}let R=e()-x;switch(E.status){case"completed":i({type:"stdout",id:b.id,text:Za(C.method,E.cases)}),i({type:"result",id:b.id,durationMs:R,status:"success",cases:E.cases,passed:E.passed,total:E.total});return;case"compile-error":i({type:"error",id:b.id,message:E.diagnosticText.replace(/\\n$/,""),durationMs:R,status:"compile-error",cases:E.cases,...E.diagnostics.length?{diagnostics:E.diagnostics}:{}});return;case"invalid-practice":i({type:"error",id:b.id,message:`Practice: ${E.message}`,durationMs:R,status:"invalid-practice",cases:E.cases});return;case"internal-error":i({type:"fatal",id:b.id,message:E.message??"Internal error in the Java engine"});return}},p=async b=>{if(!o||b.name!==o.module)return;let{job:S}=o;o=null;try{if(b.code===void 0)throw new Error(b.error??"the host sent no code");await sc(b.name,b.code,t.evaluate??nc)}catch(v){let x=v instanceof Error?v.message:String(v);i({type:"fatal",id:S.id,message:`Internal error in the Java engine: could not load the Java library (${x})`});return}h(S)};return b=>{switch(b.type){case"init":i({type:"ready",version:"25",interactiveStdin:!1,java:"25",engine:lo});return;case"run":h(b);return;case"stdin-response":return;case"module":return p(b)}}}var mo=globalThis,ic=ho(i=>mo.postMessage(i));mo.onmessage=i=>ic(i.data);})();\n',n={"java-library":()=>import(`./java-library.generated-1yFV284B.js`),"java-library-time":()=>import(`./java-library-time.generated-mFyqZ0pg.js`),"java-library-math":()=>import(`./java-library-math.generated-DmUvund7.js`),"java-library-regex":()=>import(`./java-library-regex.generated-a8crcad3.js`),"java-library-bitset":()=>import(`./java-library-bitset.generated-Duwl7F-b.js`)},r=new class extends e{id=`java`;supportsPractice=!0;statusDecidesFailure=!0;get source(){return t}async loadModule(e){let t=n[e];if(!t)throw Error(`no module named ${e}`);return(await t()).JAVA_LIBRARY_SOURCE}get label(){return this.version?`Java ${this.version} (subset)`:`Java`}async editorLanguage(){let{java:e}=await import(`./dist-BKRQwpg6.js`);return e()}};export{r as javaRuntime};