code-playpad 0.3.0 → 0.4.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.
- package/JAVA-COMPATIBILITY.md +272 -0
- package/README.md +315 -45
- package/dist/cdn.js +2 -0
- package/dist/{element-BYcX5Z6z.js → element-Bh4TdnGA.js} +12 -11
- package/dist/element.d.ts +10 -1
- package/dist/element.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/java-CDMXnFT7.js +6 -0
- package/dist/java-DrWI9a5Q.js +1 -0
- package/dist/java-library.generated-Bg_JSWb_.js +6 -0
- package/dist/{javascript-hfFD1Fg2.js → javascript-C1_thu8i.js} +1 -1
- package/dist/{javascript-BhISU47e.js → javascript-EtrNZmfD.js} +1 -1
- package/dist/{pyodide-j1wg1W9_.js → pyodide-BeJ9RqWJ.js} +1 -1
- package/dist/{pyodide-BTGQ_X_F.js → pyodide-CqcU3YGb.js} +1 -1
- package/dist/react.d.ts +4 -2
- package/dist/react.js +1 -1
- package/dist/runtime/java-library.generated.d.ts +8 -0
- package/dist/runtime/java-worker.generated.d.ts +3 -3
- package/dist/runtime/worker-runtime.d.ts +17 -1
- package/dist/standalone.d.ts +6 -2
- package/dist/standalone.js +12 -11
- package/dist/types.d.ts +76 -0
- package/dist/worker-runtime-CNPpMRo1.js +9 -0
- package/dist/worker-runtime-Kjkt5ChF.js +4 -0
- package/package.json +4 -3
- package/dist/java-1ISFU8hm.js +0 -1
- package/dist/java-DSEX5tzl.js +0 -6
- package/dist/worker-runtime-CmbgEzLA.js +0 -9
- package/dist/worker-runtime-mfgjcG5l.js +0 -4
package/dist/java-1ISFU8hm.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./worker-runtime-mfgjcG5l.js";var t='"use strict";(()=>{function Ut(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 gt(i,t){let e=i.lineStarts,n=0,s=e.length-1;for(;n<s;){let a=n+s+1>>1;e[a]<=t?n=a:s=a-1}return{line:n+1,column:t-e[n]+1}}function Jt(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 b={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",unreachable:"unreachable",missingReturn:"missing-return",finalAssign:"final-assign",notStatement:"not-a-statement",numberTooLarge:"int-number-too-large",noMain:"no-main"},yt=class{items=[];error(t,e,n,s,a,o){let{line:h,column:m}=gt(t,e),d={code:s,phase:n,severity:"error",file:t.name,line:h,column:m,message:a,offset:e};return o&&o.length&&(d.details=o),this.items.push(d),d}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 _t(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 h=t.get(o.file);if(h&&o.line>0){let m=Jt(h,o.line);s.push(m);let d="";for(let x=0;x<o.column-1;x++)d+=m[x]===" "?" ":" ";s.push(d+"^")}for(let m of o.details??[])s.push(m)}let a=e.filter(o=>o.severity==="error").length;a&&(s.push(a===1?"1 error":`${a} errors`),s.push("error: compilation failed"));for(let o of n)s.push(`error: ${o.message}`);return s.join(`\n`)+`\n`}function ke(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function Vt(i){if(i.indexOf("\\\\u")===-1){let o=new Int32Array(i.length+1);for(let h=0;h<=i.length;h++)o[h]=h;return{text:i,offsets:o,errors:[]}}let t=[],e=[],n=[],s=0,a=0;for(;a<i.length;){let o=i.charCodeAt(a);if(o===92&&s%2===0&&i.charCodeAt(a+1)===117){let h=a+1;for(;i.charCodeAt(h)===117;)h++;let m=0,d=-1;for(let x=0;x<4;x++){let y=ke(i.charCodeAt(h+x));if(y<0){d=h+x;break}m=m*16+y}if(d>=0){n.push({offset:d,message:"illegal unicode escape"}),t.push("\\\\"),e.push(a),s=1,a++;continue}t.push(String.fromCharCode(m)),e.push(a),s=0,a=h+4;continue}s=o===92?s+1:0,t.push(i[a]),e.push(a),a++}return e.push(i.length),{text:t.join(""),offsets:Int32Array.from(e),errors:n}}var Se=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"]),we=[">>>=","<<=",">>=",">>>","...","->","::","++","--","&&","||","==","!=","<=",">=","+=","-=","*=","/=","&=","|=","^=","%=","<<",">>","(",")","{","}","[","]",";",",",".","@","=",">","<","!","~","?",":","+","-","*","/","&","|","^","%"];function Gt(i){return i>=65&&i<=90||i>=97&&i<=122||i===95||i===36}function Bt(i){return Gt(i)||i>=48&&i<=57}function j(i){return i>=48&&i<=57}function Ae(i){let t=i.charCodeAt(0);return t>=32&&t<127?`\'${i}\'`:`\'\\\\u${t.toString(16).padStart(4,"0")}\'`}function jt(i){let t=Vt(i),e=t.text,n=t.offsets,s=[],a=t.errors.map(u=>({offset:u.offset,code:"syntax",message:u.message}));if(a.length)return{tokens:[{kind:"eof",text:"",start:i.length,end:i.length}],errors:a};let o=(u,g,l="syntax")=>{a.push({offset:n[u],code:l,message:g})},h=(u,g,l,c)=>{s.push({kind:u,text:e.slice(g,l),start:n[g],end:n[l],...c})},m=e.length;m>0&&e.charCodeAt(m-1)===26&&m--;let d=0;for(;d<m;){let u=e.charCodeAt(d);if(u===32||u===9||u===12||u===10||u===13){d++;continue}if(u===47&&e.charCodeAt(d+1)===47){for(;d<m&&e.charCodeAt(d)!==10&&e.charCodeAt(d)!==13;)d++;continue}if(u===47&&e.charCodeAt(d+1)===42){let l=e.indexOf("*/",d+2);if(l===-1||l+2>m){o(d,"unclosed comment"),d=m;break}d=l+2;continue}if(Gt(u)){let l=d;for(;d<m&&Bt(e.charCodeAt(d));)d++;if(d<m&&e.charCodeAt(d)>127&&/[\\p{L}\\p{Nl}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\p{Sc}]/u.test(e[d]))for(o(d,"identifiers containing non-ASCII characters are not supported in this version","unsupported");d<m&&(Bt(e.charCodeAt(d))||e.charCodeAt(d)>127);)d++;let c=e.slice(l,d);h(Se.has(c)?"keyword":"identifier",l,d);continue}if(j(u)||u===46&&j(e.charCodeAt(d+1))){d=x(d);continue}if(u===39){d=A(d);continue}if(u===34){e.startsWith(\'"""\',d)?d=k(d):d=P(d);continue}let g=we.find(l=>e.startsWith(l,d));if(g){h("operator",d,d+g.length),d+=g.length;continue}u>127&&/[\\p{L}\\p{Nl}\\p{Sc}\\p{Pc}]/u.test(e[d])?o(d,"identifiers containing non-ASCII characters are not supported in this version","unsupported"):o(d,`illegal character: ${Ae(e[d])}`),d++}return s.push({kind:"eof",text:"",start:n[m],end:n[m]}),{tokens:s,errors:a};function x(u){let g=w=>w<m?e.charCodeAt(w):-1,l=w=>g(w)|32,c=w=>j(w)||(w|32)>=97&&(w|32)<=102,p=(w,E)=>{let N=w;for(;N<m&&(E(g(N))||g(N)===95);)N++;return N>w&&g(N-1)===95?(o(N-1,"illegal underscore"),null):N},U=(w,E,N)=>{let nt=e.slice(N,w).replace(/_/g,""),S=BigInt((E===16?"0x":E===8?"0o":E===2?"0b":"")+(nt||"0"));return(g(w)|32)===108?(h("long-literal",u,w+1,{integer:{value:S,radix:E}}),w+1):(h("int-literal",u,w,{integer:{value:S,radix:E}}),w)},ct=(w,E)=>{if(l(w)!==E)return w;let N=w+1;return(g(N)===43||g(N)===45)&&N++,j(g(N))?p(N,j):(o(u,"malformed floating-point literal"),null)},tt=w=>{let E=l(w);return E===102?(h("float-literal",u,w+1),w+1):E===100?(h("double-literal",u,w+1),w+1):(h("double-literal",u,w),w)};if(g(u)===48&&l(u+1)===120){let w=u+2;if(g(w)===95)return o(w,"illegal underscore"),w+1;let E=p(w,c);if(E===null)return m;let N=E>w;if(g(E)===46||l(E)===112){if(g(E)===46){let f=p(E+1,c);if(f===null)return m;if(!N&&f===E+1)return o(u,"hexadecimal numbers must contain at least one hexadecimal digit"),f;E=f}if(l(E)!==112)return o(u,"malformed floating-point literal"),E;let nt=ct(E,112);return nt===null?m:tt(nt)}return N?U(E,16,w):(o(u,"hexadecimal numbers must contain at least one hexadecimal digit"),E)}if(g(u)===48&&l(u+1)===98){let w=u+2;if(g(w)===95)return o(w,"illegal underscore"),w+1;let E=p(w,j);return E===null?m:E===w?(o(u,"binary numbers must contain at least one binary digit"),E):/[2-9]/.test(e.slice(w,E))?(o(u,"illegal digit in a binary literal"),E):U(E,2,w)}let O=u;if(j(g(u))&&(O=p(u,j),O===null))return m;if(g(O)===46&&(O>u||j(g(O+1)))||l(O)===101||l(O)===102||l(O)===100)return g(O)===46&&(O=j(g(O+1))?p(O+1,j):O+1,O===null)?m:(O=ct(O,101),O===null?m:tt(O));if(g(u)===48&&O>u+1){for(let w=u+1;w<O;w++)if(g(w)===56||g(w)===57)return o(w,"illegal digit in an octal literal"),O;return U(O,8,u+1)}return U(O,10,u)}function y(u){let g=e[u+1];switch(g){case"b":return["\\b",u+2];case"s":return[" ",u+2];case"t":return[" ",u+2];case"n":return[`\n`,u+2];case"f":return["\\f",u+2];case"r":return["\\r",u+2];case\'"\':return[\'"\',u+2];case"\'":return["\'",u+2];case"\\\\":return["\\\\",u+2]}if(g!==void 0&&g>="0"&&g<="7"){let l=g<="3"?3:2,c=u+1,p="";for(;p.length<l&&c<m&&e[c]>="0"&&e[c]<="7";)p+=e[c++];return[String.fromCharCode(parseInt(p,8)),c]}return null}function A(u){let g=u+1,l="";for(;g<m;){let c=e.charCodeAt(g);if(c===39)break;if(c===10||c===13)return o(u,"unclosed character literal"),g;if(c===92){let p=y(g);if(!p)return o(g+1,"illegal escape character"),C(g);l+=p[0],g=p[1];continue}l+=e[g],g++}return g>=m?(o(u,"unclosed character literal"),g):l.length===0?(o(u,"empty character literal"),g+1):l.length>1?(o(u,"unclosed character literal"),g+1):(h("char-literal",u,g+1,{stringValue:l}),g+1)}function P(u){let g=u+1,l="";for(;g<m;){let c=e.charCodeAt(g);if(c===34)return h("string-literal",u,g+1,{stringValue:l}),g+1;if(c===10||c===13)break;if(c===92){let p=y(g);if(!p)return o(g+1,"illegal escape character"),C(g);l+=p[0],g=p[1];continue}l+=e[g],g++}return o(u,"unclosed string literal"),g}function k(u){let g=u+3;for(;g<m;){if(e.charCodeAt(g)===92){g+=2;continue}if(e.startsWith(\'"""\',g))return h("text-block",u,g+3),g+3;g++}return o(u,"unclosed text block"),m}function C(u){for(;u<m&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;return u}}var B=class extends Error{info;constructor(t){super(t.message),this.info=t}},st=new Set(["int","boolean","byte","short","long","char","float","double"]),Ht=new Set(["public","protected","private","static","final","abstract","native","synchronized","transient","volatile","strictfp","default"]),Ee={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,">":7,"<=":7,">=":7,instanceof:7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},Ce=new Set(["=","+=","-=","*=","/=","%=","&=","|=","^=","<<=",">>=",">>>="]),ve={do:"\'do\' loops",switch:"\'switch\' statements",throw:"\'throw\' statements",try:"\'try\' statements",synchronized:"\'synchronized\' statements",assert:"\'assert\' statements"},Ie=new Set(["(","!","~","this","super","new","true","false","null","switch"]);function zt(i,t,e){let n=new Ct(i,t,e);try{return{unit:n.compilationUnit(),error:null}}catch(s){if(s instanceof B)return{unit:null,error:s.info};throw s}}var Ct=class{#T;#k;#u;#f=0;#y=0;constructor(t,e,n){this.#T=t,this.#k=e,this.#u=n}#s(t=0){return this.#k[Math.min(this.#f+t,this.#k.length-1)]}#p(){return this.#k[Math.max(this.#f-1,0)]}#r(){let t=this.#s();return this.#f<this.#k.length-1&&this.#f++,t}#e(t,e=0){let n=this.#s(e);return(n.kind==="operator"||n.kind==="keyword")&&n.text===t}#t(t=0,e){let n=this.#s(t);return n.kind==="identifier"&&(e===void 0||n.text===e)}#o(t){return this.#e(t)?(this.#r(),!0):!1}#a(t){if(this.#e(t))return this.#r();throw this.#s().kind==="eof"&&t==="}"&&this.#x(),this.#c(this.#p().end,`\'${t}\' expected`)}#b(){let t=this.#s();if(t.kind==="identifier")return this.#r();throw t.kind==="keyword"&&t.text==="_"?this.#i(t.start,"the unnamed variable \'_\'",!0):(t.kind==="eof"&&this.#x(),this.#c(t.kind==="keyword"?t.start:this.#p().end,"<identifier> expected"))}#x(){throw this.#c(this.#p().end,"reached end of file while parsing")}#c(t,e){return new B({offset:t,code:"syntax",message:e})}#i(t,e,n=!1){return new B({offset:t,code:"unsupported",message:`${e} ${n?"is":"are"} not supported in this version`})}#E(){if(++this.#y>this.#u.maxNestingDepth)throw new B({offset:this.#s().start,code:"limit",message:`code is nested too deeply for this engine (limit ${this.#u.maxNestingDepth})`})}#S(){this.#y--}#d(t,...e){let n=0;for(let s of e)n=Math.max(n,s.depth);if(t.depth=n+1,t.depth>this.#u.maxExpressionDepth)throw new B({offset:t.start,code:"limit",message:`expression is nested too deeply for this engine (limit ${this.#u.maxExpressionDepth})`});return t}compilationUnit(){let t={file:this.#T,types:[]},e=[];if(this.#e("package"))throw this.#i(this.#s().start,"package declarations");if(this.#e("import"))throw this.#i(this.#s().start,"import declarations");for(;this.#s().kind!=="eof";){if(this.#o(";"))continue;let n=this.#s().start;if(this.#e("import"))throw this.#A(t,e);let s=this.#h();if(this.#e("class")){t.types.push(this.#l(s,n));continue}if(this.#e("interface")||this.#e("enum")||this.#e("@")&&this.#e("interface",1))throw this.#i(this.#s().start,`${this.#e("enum")?"enum":"interface"} declarations`);if(this.#t(0,"record")&&this.#t(1))throw this.#i(this.#s().start,"record declarations");if(this.#n()){e.push(this.#$(s,n,null));continue}throw this.#A(t,e)}if(e.length){let n=t.types[0];if(n)throw this.#i(n.keywordPos,"classes declared in a compact source file");let s=e[0],a=this.#T.replace(/^.*[\\\\/]/,"").replace(/\\.java$/,"");t.types.push({kind:"ClassDeclaration",keyword:"class",modifiers:{keywords:[]},name:a,namePos:s.start,keywordPos:s.start,members:e,implicit:!0,pos:s.start,start:s.start,end:e[e.length-1].end})}return t}#A(t,e){let n=this.#k.some(s=>s.kind==="keyword"&&(s.text==="class"||s.text==="interface"||s.text==="enum"));return!t.types.length&&!e.length&&!n?new B({offset:0,code:"no-class",message:"no class declared in source file"}):this.#c(this.#s().start,"class, interface, annotation type, enum, record, method or field expected")}#n(){let t=this.#f;try{if(this.#e("void"))this.#r();else if(!this.#O())return!1;return this.#t()?(this.#r(),this.#e("(")||this.#e("=")||this.#e(";")||this.#e(",")):!1}finally{this.#f=t}}#h(){let t={keywords:[]};for(;;){let e=this.#s();if(e.kind==="operator"&&e.text==="@"){if(this.#e("interface",1))return t;throw this.#i(e.start,"annotations")}if(e.kind==="keyword"&&Ht.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.#r();continue}if(e.kind==="identifier"){let n=e.text==="sealed"&&(this.#e("class",1)||this.#e("interface",1)||this.#s(1).kind==="keyword"&&Ht.has(this.#s(1).text)),s=e.text==="non"&&this.#e("-",1)&&this.#t(2,"sealed");if(n||s)throw this.#i(e.start,"sealed and non-sealed classes")}return t}}#l(t,e){let n=this.#a("class"),s=this.#b(),a={kind:"ClassDeclaration",keyword:"class",modifiers:t,name:s.text,namePos:s.start,keywordPos:n.start,members:[],pos:s.start,start:e,end:e};if(this.#e("<"))throw this.#i(this.#s().start,"generic classes");for(let o of["extends","implements"])if(this.#e(o))throw this.#i(this.#s().start,`\'${o}\' clauses`);if(this.#t(0,"permits"))throw this.#i(this.#s().start,"\'permits\' clauses");for(this.#a("{");!this.#e("}");)this.#s().kind==="eof"&&this.#x(),!this.#o(";")&&a.members.push(this.#P(a.name));return a.end=this.#a("}").end,a}#P(t){let e=this.#s().start;if(this.#e("{")||this.#e("static")&&this.#e("{",1))throw this.#i(e,"initializer blocks");let n=this.#h();if(this.#e("class")||this.#e("interface")||this.#e("enum")||this.#t(0,"record")&&this.#t(1))throw this.#i(this.#s().start,"nested types");return this.#$(n,e,t)}#$(t,e,n){if(this.#e("<"))throw this.#i(this.#s().start,"generic methods");if(n!==null&&this.#t(0,n)&&this.#e("(",1))throw this.#i(this.#s().start,"constructors");let s;if(this.#e("void")){let o=this.#r();s={kind:"VoidType",pos:o.start,start:o.start,end:o.end}}else s=this.#R();let a=this.#b();if(!this.#e("(")){if(s.kind!=="VoidType"&&(this.#e("=")||this.#e(";")||this.#e(",")||this.#e("[")))return this.#F(t,s,a,e);throw this.#c(this.#p().end,"\'(\' expected")}return this.#U(t,s,a,e)}#F(t,e,n,s){let a=[],o=n;for(;;){let m=0;for(;this.#e("[")&&this.#e("]",1);)this.#r(),this.#r(),m++;let d=null;if(this.#o("=")&&(d=this.#e("{")?this.#_():this.#m()),a.push({name:o.text,extraDims:m,init:d,pos:o.start,start:o.start,end:this.#p().end}),!this.#o(","))break;o=this.#b()}let h=this.#a(";");return{kind:"FieldDeclaration",modifiers:t,type:e,declarators:a,pos:n.start,start:s,end:h.end}}#U(t,e,n,s){let a={kind:"MethodDeclaration",modifiers:t,returnType:e,name:n.text,namePos:n.start,params:[],body:null,pos:n.start,start:s,end:s};if(this.#a("("),!this.#e(")"))do a.params.push(this.#H());while(this.#o(","));if(this.#a(")"),this.#e("["))throw this.#i(this.#s().start,"array dimensions after a parameter list");if(this.#e("throws"))throw this.#i(this.#s().start,"\'throws\' clauses");if(this.#o(";"))return a.end=this.#p().end,a;if(!this.#e("{"))throw this.#c(this.#p().end,"\'{\' expected");return a.body=this.#D(),a.end=a.body.end,a.closeBracePos=a.body.end-1,a}#H(){let t=this.#s().start,e=this.#h(),n=this.#R(),s=!1;this.#o("...")&&(s=!0);let a=this.#b();for(;this.#e("[")&&this.#e("]",1);){let o=this.#r(),h=this.#r();n={kind:"ArrayType",element:n,pos:o.start,start:n.start,end:h.end}}if(s){let o=this.#p().end;n={kind:"ArrayType",element:n,pos:n.pos,start:n.start,end:o}}return{modifiers:e,type:n,name:a.text,varargs:s,pos:a.start,start:t,end:a.end}}#R(){let t=this.#s(),e;if(t.kind==="keyword"&&st.has(t.text))this.#r(),e={kind:"PrimitiveType",name:t.text,pos:t.start,start:t.start,end:t.end};else if(t.kind==="identifier"){let n=[this.#r().text],s=!1,a,o;for(;;){if(this.#e("<")&&(a??=this.#s().start,this.#z(),s=!0),this.#e(".")&&this.#t(1)){o=this.#r().start,n.push(this.#r().text);continue}break}e={kind:"ClassType",names:n,hasTypeArguments:s,typeArgumentsPos:a,lastDotPos:o,pos:t.start,start:t.start,end:this.#p().end}}else if(t.kind==="eof")this.#x();else throw this.#c(t.start,"<identifier> expected");for(;this.#e("[")&&this.#e("]",1);){let n=this.#r(),s=this.#r();e={kind:"ArrayType",element:e,pos:n.start,start:e.start,end:s.end}}return e}#z(){let t=0;do{let e=this.#s();if(e.kind==="operator"){if(e.text==="<")t++;else if(e.text===">")t--;else if(e.text===">>")t-=2;else if(e.text===">>>")t-=3;else if(![".",",","?","[","]","&","@"].includes(e.text))throw this.#c(e.start,"\'>\' expected")}else if(e.kind==="eof")this.#x();else{if(e.kind==="keyword"&&!st.has(e.text)&&e.text!=="extends"&&e.text!=="super")throw this.#c(e.start,"\'>\' expected");if(!["identifier","keyword"].includes(e.kind))throw this.#c(e.start,"\'>\' expected")}if(this.#r(),t<0)throw this.#c(e.start,"illegal start of type")}while(t>0)}#O(){let t=this.#f;try{return this.#R(),!0}catch(e){if(!(e instanceof B))throw e;return this.#f=t,!1}}#D(){let t=this.#a("{");this.#E();let e=[];for(;!this.#e("}");)this.#s().kind==="eof"&&this.#x(),e.push(this.#v());let n=this.#a("}");return this.#S(),{kind:"Block",statements:e,pos:t.start,start:t.start,end:n.end}}#v(){if(this.#M())return this.#J();if(this.#e("class")||this.#e("interface")||this.#e("enum")||(this.#e("abstract")||this.#e("static"))&&this.#e("class",1))throw this.#i(this.#s().start,"local classes");if(this.#t(0,"record")&&this.#t(1)&&this.#e("(",2))throw this.#i(this.#s().start,"local records");return this.#L()}#M(){if(this.#e("final")||this.#e("@")&&!this.#e("interface",1))return!0;let t=this.#s();if(t.kind==="keyword"&&st.has(t.text))return!this.#e(".",1);if(t.kind!=="identifier")return!1;let e=this.#f;try{if(!this.#O())return!1;let n=this.#s();return n.kind==="identifier"||n.kind==="keyword"&&n.text==="_"}finally{this.#f=e}}#J(){let t=this.#s().start,e=this.#h();for(let o of e.keywords)if(o.name!=="final")throw this.#c(o.pos,"illegal start of expression");let n=this.#R();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 o=this.#b(),h=0;for(;this.#e("[")&&this.#e("]",1);)this.#r(),this.#r(),h++;let m=null;this.#o("=")&&(m=this.#e("{")?this.#_():this.#m()),s.push({name:o.text,extraDims:h,init:m,pos:o.start,start:o.start,end:this.#p().end})}while(this.#o(","));let a=this.#a(";");return{kind:"LocalVariableDeclaration",modifiers:e,type:n,declarators:s,pos:t,start:t,end:a.end}}#L(){this.#E();try{let t=this.#s();if(t.kind==="operator"&&t.text==="{")return this.#D();if(t.kind==="operator"&&t.text===";")return this.#r(),{kind:"EmptyStatement",pos:t.start,start:t.start,end:t.end};if(t.kind==="keyword"){if(t.text==="if")return this.#et();if(t.text==="while")return this.#W();if(t.text==="for")return this.#B();if(t.text==="return")return this.#K();if(t.text==="break"||t.text==="continue")return this.#q();let e=ve[t.text];if(e)throw this.#i(t.start,e);if(t.text==="else")throw this.#c(t.start,"\'else\' without \'if\'")}if(t.kind==="identifier"){if(this.#e(":",1))throw this.#i(t.start,"labeled statements");if(t.text==="yield"&&!this.#e("=",1)&&!this.#e(".",1)&&!this.#e("(",1))throw this.#i(t.start,"\'yield\' statements")}if(this.#M()){let e=this.#J();throw this.#c(e.declarators[0].pos,"variable declaration not allowed here")}return this.#N()}finally{this.#S()}}#et(){let t=this.#a("if");this.#a("(");let e=this.#m();this.#a(")");let n=this.#L(),s=null;this.#o("else")&&(s=this.#L());let a=(s??n).end;return{kind:"IfStatement",condition:e,then:n,otherwise:s,pos:t.start,start:t.start,end:a}}#W(){let t=this.#a("while");this.#a("(");let e=this.#m();this.#a(")");let n=this.#L();return{kind:"WhileStatement",condition:e,body:n,pos:t.start,start:t.start,end:n.end}}#B(){let t=this.#a("for");if(this.#a("("),this.#nt())throw this.#i(t.start,"enhanced \'for\' loops (for (T x : array))");let e=null;this.#M()?e=this.#J():(this.#e(";")||(e=this.#Q()),this.#a(";"));let n=this.#e(";")?null:this.#m();this.#a(";");let s=this.#e(")")?[]:this.#Q();this.#a(")");let a=this.#L();return{kind:"ForStatement",init:e,condition:n,update:s,body:a,pos:t.start,start:t.start,end:a.end}}#nt(){let t=this.#f;try{return this.#h(),!this.#O()||!this.#t()?!1:(this.#r(),this.#e(":"))}catch(e){if(e instanceof B)return!1;throw e}finally{this.#f=t}}#Q(){let t=[];do{let e=this.#m();if(e.kind!=="Assignment"&&e.kind!=="IncDec"&&e.kind!=="MethodCall")throw this.#c(e.pos,"not a statement");t.push(e)}while(this.#o(","));return t}#K(){let t=this.#a("return"),e=this.#e(";")?null:this.#m(),n=this.#a(";");return{kind:"ReturnStatement",value:e,pos:t.start,start:t.start,end:n.end}}#q(){let t=this.#r();if(this.#t())throw this.#i(this.#s().start,`labeled \'${t.text}\' statements`);let e=this.#a(";");return{kind:t.text==="break"?"BreakStatement":"ContinueStatement",pos:t.start,start:t.start,end:e.end}}#_(){let t=this.#a("{");this.#E();let e=[];for(;!this.#e("}");){if(this.#e("{"))throw this.#i(this.#s().start,"multidimensional arrays");if(e.push(this.#m()),!this.#o(","))break}let n=this.#a("}");return this.#S(),{kind:"ArrayInitializer",elements:e,pos:t.start,start:t.start,end:n.end}}#N(){let t=this.#m();if(t.kind!=="Assignment"&&t.kind!=="IncDec"&&t.kind!=="MethodCall")throw this.#c(t.pos,"not a statement");let e=this.#a(";");return{kind:"ExpressionStatement",expression:t,pos:t.pos,start:t.start,end:e.end}}#m(){this.#E();try{let t=this.#w(),e=this.#s();if(e.kind==="operator"&&Ce.has(e.text)){this.#r();let n=this.#m();return this.#d({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.#S()}}#w(){let t=this.#C(1);if(this.#e("?"))throw this.#i(this.#s().start,"conditional expressions (?:)");return t}#C(t){let e=this.#V();for(;;){let n=this.#s();if(n.kind!=="operator"&&!(n.kind==="keyword"&&n.text==="instanceof"))break;let s=Ee[n.text];if(s===void 0||s<t)break;if(n.text==="instanceof")throw this.#i(n.start,"\'instanceof\' expressions");this.#r();let a=this.#C(s+1);e=this.#d({kind:"Binary",operator:n.text,left:e,right:a,depth:0,pos:n.start,start:e.start,end:a.end},e,a)}return e}#V(){this.#E();try{let t=this.#s();if(t.kind==="operator")switch(t.text){case"-":case"+":{this.#r();let e=this.#s(),n=t.text==="-"&&e.kind==="int-literal"&&e.integer?.radix===10&&e.integer.value===2147483648n?this.#Y(!0):this.#V();return this.#d({kind:"Unary",operator:t.text,operand:n,depth:0,pos:t.start,start:t.start,end:n.end},n)}case"!":case"~":{this.#r();let e=this.#V();return this.#d({kind:"Unary",operator:t.text,operand:e,depth:0,pos:t.start,start:t.start,end:e.end},e)}case"++":case"--":{this.#r();let e=this.#V();return this.#d({kind:"IncDec",operator:t.text,prefix:!0,operand:e,depth:0,pos:t.start,start:t.start,end:e.end},e)}case"(":if(this.#st()){this.#r();let e=this.#R();this.#a(")");let n=this.#V();return this.#d({kind:"Cast",targetType:e,expression:n,depth:0,pos:t.start,start:t.start,end:n.end},n)}break}return this.#rt(this.#X())}finally{this.#S()}}#st(){let t=this.#s(1);if(t.kind==="keyword"&&st.has(t.text))return this.#e(")",2)||this.#e("[",2)&&this.#e("]",3);if(t.kind!=="identifier")return!1;let e=this.#f;try{if(this.#r(),!this.#O()||!this.#o(")"))return!1;let n=this.#s();return n.kind==="identifier"||n.kind.endsWith("-literal")||n.kind==="text-block"?!0:(n.kind==="operator"||n.kind==="keyword")&&Ie.has(n.text)}finally{this.#f=e}}#rt(t){let e=t;for(;;){let n=this.#s();if(n.kind!=="operator")return e;if(n.text==="."){if(this.#r(),this.#e("<"))throw this.#i(this.#s().start,"explicit type arguments");let s=this.#s();if(s.kind==="keyword"&&["class","this","super","new"].includes(s.text))throw this.#i(s.start,`\'.${s.text}\' expressions`);let a=this.#b();if(this.#e("(")){let o=this.#s().start,h=this.#G();e=this.#d({kind:"MethodCall",target:e,name:a.text,namePos:a.start,selectPos:n.start,args:h,depth:0,pos:o,start:e.start,end:this.#p().end},e,...h)}else e=this.#d({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.#r();let s=this.#m(),a=this.#a("]");e=this.#d({kind:"ArrayAccess",array:e,index:s,depth:0,pos:n.start,start:e.start,end:a.end},e,s);continue}if(n.text==="::")throw this.#i(n.start,"method references");if(n.text==="++"||n.text==="--"){this.#r(),e=this.#d({kind:"IncDec",operator:n.text,prefix:!1,operand:e,depth:0,pos:n.start,start:e.start,end:n.end},e);continue}return e}}#G(){this.#a("(");let t=[];if(!this.#e(")"))do t.push(this.#m());while(this.#o(","));return this.#a(")"),t}#Y(t){let e=this.#r(),{value:n,radix:s}=e.integer,a;if(s===10){if(n>2147483648n||n===2147483648n&&!t)throw new B({offset:e.start,code:"int-number-too-large",message:"integer number too large"});a=Number(BigInt.asIntN(32,n))}else{if(n>0xffffffffn)throw new B({offset:e.start,code:"int-number-too-large",message:"integer number too large"});a=Number(BigInt.asIntN(32,n))}return{kind:"Literal",literalKind:"int",value:a,depth:1,pos:e.start,start:e.start,end:e.end}}#X(){let t=this.#s(),e=(n,s)=>(this.#r(),{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.#Y(!1);case"long-literal":return e("long",t.text);case"float-literal":return e("float",t.text);case"double-literal":return e("double",t.text);case"char-literal":return e("char",t.stringValue??"");case"string-literal":return e("string",t.stringValue??"");case"text-block":throw this.#i(t.start,"text blocks");case"identifier":{if(this.#e("->",1))throw this.#i(t.start,"lambda expressions");if(this.#r(),this.#e("(")){let n=this.#s().start,s=this.#G();return this.#d({kind:"MethodCall",target:null,name:t.text,namePos:t.start,selectPos:t.start,args:s,depth:0,pos:n,start:t.start,end:this.#p().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.#r(),{kind:"Literal",literalKind:"boolean",value:t.text==="true",depth:1,pos:t.start,start:t.start,end:t.end};case"null":return this.#r(),{kind:"Literal",literalKind:"null",value:null,depth:1,pos:t.start,start:t.start,end:t.end};case"this":if(this.#e("(",1))throw this.#i(t.start,"constructor calls with \'this(...)\'");return this.#r(),{kind:"This",depth:1,pos:t.start,start:t.start,end:t.end};case"super":throw this.#i(t.start,"\'super\'",!0);case"new":return this.#it();case"switch":throw this.#i(t.start,"\'switch\' expressions")}if(st.has(t.text)||t.text==="void")throw this.#i(t.start,"class literals");break;case"operator":if(t.text==="("){if(this.#at())throw this.#i(t.start,"lambda expressions");this.#r();let n=this.#m(),s=this.#a(")");return this.#d({kind:"Parenthesized",expression:n,depth:0,pos:t.start,start:t.start,end:s.end},n)}break;case"eof":this.#x()}throw this.#c(t.start,"illegal start of expression")}#it(){let t=this.#a("new"),e=this.#s(),n;if(e.kind==="keyword"&&st.has(e.text))this.#r(),n={kind:"PrimitiveType",name:e.text,pos:e.start,start:e.start,end:e.end};else if(e.kind==="identifier"){let h=[this.#r().text],m;for(;this.#e(".")&&this.#t(1);)m=this.#r().start,h.push(this.#r().text);if(this.#e("<")||this.#e("("))throw this.#i(t.start,"creating objects with \'new\'");n={kind:"ClassType",names:h,hasTypeArguments:!1,lastDotPos:m,pos:e.start,start:e.start,end:this.#p().end}}else throw this.#c(e.start,"<identifier> expected");if(!this.#e("["))throw this.#c(this.#p().end,"\'(\' or \'[\' expected");let s=this.#r();if(this.#o("]")){if(this.#e("["))throw this.#i(s.start,"multidimensional arrays");if(!this.#e("{"))throw this.#c(this.#p().end,"array dimension missing");let h=this.#_();return this.#d({kind:"NewArray",elementType:n,length:null,initializer:h,depth:0,pos:t.start,start:t.start,end:h.end},...h.elements)}let a=this.#m(),o=this.#a("]");if(this.#e("["))throw this.#i(s.start,"multidimensional arrays");return this.#d({kind:"NewArray",elementType:n,length:a,initializer:null,depth:0,pos:t.start,start:t.start,end:o.end},a)}#at(){let t=0;for(let e=0;;e++){let n=this.#s(e);if(n.kind==="eof")return!1;if(n.kind==="operator")if(n.text==="(")t++;else{if(n.text===")"&&--t===0)return this.#e("->",e+1);if(n.text===";"||n.text==="{"||n.text==="}")return!1}}}};var $={tag:"int"},rt={tag:"char"},_={tag:"boolean"},Kt={tag:"long"},Yt={tag:"float"},Xt={tag:"double"},Y={tag:"void"},Qt={tag:"null"},ht={tag:"string"},ut={tag:"object"},qt={tag:"printstream"},T={tag:"error"};function it(i){return{tag:"array",element:i}}function Zt(i){return{tag:"class",name:i}}function I(i){switch(i.tag){case"int":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 I(i.element)+"[]";case"class":return i.name;case"error":return"<any>"}}function at(i,t){return i.tag!==t.tag?!1:i.tag==="array"&&t.tag==="array"?at(i.element,t.element):i.tag==="class"&&t.tag==="class"?i.name===t.name:!0}function K(i){return i.tag==="string"||i.tag==="null"||i.tag==="object"||i.tag==="printstream"||i.tag==="array"||i.tag==="class"}function H(i){return["int","char","boolean","long","float","double"].includes(i.tag)}function G(i){return["int","char","long","float","double"].includes(i.tag)}var Wt={char:0,int:1,long:2,float:3,double:4};function Re(i,t){return!G(i)||!G(t)||i.tag==="char"?!1:Wt[t.tag]<Wt[i.tag]}function ot(i,t){return at(i,t)?!0:i.tag==="null"?K(t):t.tag==="object"?K(i):!1}function q(i,t){return i.tag==="error"||t.tag==="error"||at(i,t)||Re(i,t)?!0:K(i)&&ot(t,i)}function te(i,t){return q(i,t)?!0:i.tag==="object"&&H(t)}function lt(i,t,e){if(q(i,t))return!0;if(i.tag==="char"&&t.tag==="int"&&e?.kind==="int"){let n=e.value;return n>=0&&n<=65535}return!1}function vt(i,t){return G(i)&&G(t)?`possible lossy conversion from ${I(t)} to ${I(i)}`:`${I(t)} cannot be converted to ${I(i)}`}function dt(i){switch(i.kind){case"int":return String(i.value);case"char":return String.fromCharCode(i.value);case"boolean":return i.value?"true":"false";case"string":return i.value}}function D(i){return{kind:"int",value:i|0}}function It(i){return{kind:"char",value:i&65535}}function F(i){return{kind:"boolean",value:i}}function Rt(i){return{kind:"string",value:i}}function ft(i){return i.kind==="int"||i.kind==="char"?i.value:void 0}function Ot(i){return i!==void 0&&i.kind==="boolean"&&i.value}function Nt(i){return i!==void 0&&i.kind==="boolean"&&!i.value}var ee=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"]),Oe=new Set(["printf","format","flush","write","append","close","checkError","writeBytes","charset"]),Ne=new Set(["currentTimeMillis","nanoTime","exit","arraycopy","getProperty","getProperties","setProperty","clearProperty","lineSeparator","identityHashCode","getenv","gc","setOut","setErr","setIn","console","inheritedChannel","getLogger","load","loadLibrary","mapLibraryName","runFinalization"]),Pe=new Set(["substring","indexOf","lastIndexOf","isEmpty","isBlank","toUpperCase","toLowerCase","trim","strip","stripLeading","stripTrailing","split","contains","startsWith","endsWith","replace","replaceAll","replaceFirst","compareTo","compareToIgnoreCase","equalsIgnoreCase","concat","toCharArray","chars","codePoints","format","formatted","valueOf","copyValueOf","join","repeat","matches","hashCode","intern","codePointAt","codePointBefore","codePointCount","offsetByCodePoints","getBytes","getChars","lines","indent","translateEscapes","transform","describeConstable","resolveConstantDesc","contentEquals","regionMatches","subSequence","toString","getClass","wait","notify","notifyAll","splitWithDelimiters"]),De=new Set(["clone","getClass","hashCode","equals","toString","wait","notify","notifyAll"]),ne=[_,rt,$,Kt,Yt,Xt,it(rt),ht,ut];function Me(i){return(i==="println"?[[],...ne.map(e=>[e])]:ne.map(e=>[e])).map(e=>({owner:"PrintStream",name:i,params:e,returnType:Y}))}var Le={length:{owner:"String",name:"length",params:[],returnType:$},charAt:{owner:"String",name:"charAt",params:[$],returnType:rt},equals:{owner:"String",name:"equals",params:[ut],returnType:_}},$e=()=>({all:!1,vars:new Set}),X=()=>({all:!0,vars:new Set}),Mt=i=>({all:i.all,vars:new Set(i.vars)});function Q(i,...t){let e=i;for(let n of t){if(e.all){e=Mt(n);continue}if(n.all)continue;let s=new Set;for(let a of e.vars)n.vars.has(a)&&s.add(a);e={all:!1,vars:s}}return e}function Fe(i,t){return i.all||i.vars.has(t)}function bt(i,t){if(i.all)return i;let e=Mt(i);return e.vars.add(t),e}function Ue(i,t){if(i.all)return i;let e=Mt(i);return e.vars.delete(t),e}function se(i){return i.kind==="LocalVariableDeclaration"?i.declarators[0].pos:i.start}function pt(i){let t=i;for(;t.kind==="Parenthesized";)t=t.expression;return t}function re(i,t,e){return new Dt(t,e).checkUnit(i)}var Dt=class{#T;#k;#u="";#f=!1;#y=[];#s=new Map;#p=[];#r=new Map;#e=0;#t=0;#o=null;#a=null;#b=!0;#x=[];#c=0;#i=0;#E=!1;#S=[];#d=[];#A=[];constructor(t,e){this.#T=t,this.#k=e}#n(t,e,n,s){this.#k.error(this.#T,t,"type",e,n,s)}#h(t,e,n=!1){this.#n(t,b.unsupported,`${e} ${n?"is":"are"} not supported in this version`)}checkUnit(t){let[e,...n]=t.types;if(!e)return this.#k.launchError(this.#T.name,b.noMain,"no class declared in source file"),null;for(let a of n)this.#h(a.namePos,"multiple top-level classes");this.#u=e.name,this.#f=e.implicit===!0;for(let a of e.modifiers.keywords)a.name==="public"||a.name==="final"||(a.name==="abstract"||a.name==="strictfp"?this.#h(a.pos,`\'${a.name}\' classes`):this.#n(e.keywordPos,b.syntax,`modifier ${a.name} not allowed here`));for(let a of e.members)a.kind==="FieldDeclaration"?this.#F(a):this.#U(a);let s=this.#l();if(!s)return this.#f?this.#n(e.members[0].start,b.noMain,"compact source file does not have main method in the form of void main() or void main(String[] args)"):this.#k.hasErrors||this.#k.launchError(this.#T.name,b.noMain,`can\'t find main(String[]) or main() method in class: ${this.#u}`),null;for(let a of e.members)if(a.kind==="FieldDeclaration")for(let o of a.declarators)o.field&&this.#D(o.field);else a.symbol&&this.#O(a.symbol);if(this.#k.hasErrors)return null;for(let a of this.#p)a.isFinal&&!a.declarator.init&&this.#d.push([a.declarator.pos,a.isStatic?`variable ${a.name} might not have been initialized`:`variable ${a.name} not initialized in the default constructor`]);for(let a of this.#y)this.#Et(a);for(let[a,o]of this.#S)this.#n(a,o==="missing return statement"?b.missingReturn:b.unreachable,o);for(let[a,o]of this.#d)this.#n(a,b.uninitialized,o);return this.#k.hasErrors?null:{mainClass:e,methods:this.#y,fields:this.#p,staticCount:this.#e,instanceCount:this.#t,main:s}}#l(){let t=this.#y.filter(e=>this.#P(e.declaration));return t.find(e=>e.params.length===1)??t.find(e=>e.params.length===0)??null}#P(t){if(t.name!=="main"||t.returnType.kind!=="VoidType"||t.modifiers.keywords.some(n=>n.name==="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.#$(e.element)}#$(t){if(t.kind!=="ClassType"||t.hasTypeArguments)return!1;let e=t.names.join(".");return e==="String"||e==="java.lang.String"}#F(t){let e=t.modifiers.keywords.map(o=>o.name);for(let o of t.modifiers.keywords){if(o.name==="transient"||o.name==="volatile"){this.#h(o.pos,`\'${o.name}\' fields`);return}if(["abstract","synchronized","native","strictfp","default"].includes(o.name)){this.#n(t.declarators[0].pos,b.syntax,`modifier ${o.name} not allowed here`);return}}if(t.type.kind==="VarType"){this.#n(t.type.pos,b.syntax,"\'var\' is not allowed here");return}let n=e.includes("static"),s=e.includes("final"),a=this.#N(t.type);for(let o of t.declarators){let h=a;if(o.extraDims>0&&a.tag!=="error"){if(o.extraDims>1||a.tag==="array"){this.#h(o.pos,"multidimensional arrays");continue}h=it(a)}if(h.tag==="error")continue;if(this.#r.has(o.name)){this.#n(o.pos,b.alreadyDefined,`variable ${o.name} is already defined in class ${this.#u}`);continue}let m={kind:"field",name:o.name,type:h,isStatic:n,isFinal:s,index:n?this.#e++:this.#t++,order:this.#p.length,state:"pending",declaration:t,declarator:o};o.field=m,this.#p.push(m),this.#r.set(m.name,m)}}#U(t){for(let h of t.modifiers.keywords){if(["synchronized","strictfp","native","abstract"].includes(h.name)){this.#h(h.pos,`\'${h.name}\' methods`);return}if(h.name==="default"||h.name==="transient"||h.name==="volatile"){this.#n(t.namePos,b.syntax,`modifier ${h.name} not allowed here`);return}}let e=this.#P(t);for(let h of t.params)if(h.varargs&&!e){this.#h(h.pos,"variable-arity (varargs) methods");return}let n=t.params.map(h=>this.#N(h.type)),s=t.returnType.kind==="VoidType"?Y:this.#N(t.returnType);if(n.some(h=>h.tag==="error")||s.tag==="error")return;let a=this.#s.get(t.name)??[];if(a.some(h=>h.params.length===n.length&&h.params.every((m,d)=>at(m,n[d])))){this.#n(t.namePos,b.alreadyDefined,`method ${t.name}(${n.map(I).join(",")}) is already defined in class ${this.#u}`);return}if(!t.body){this.#n(t.namePos,b.syntax,"missing method body, or declare abstract");return}let o={kind:"method",name:t.name,isStatic:t.modifiers.keywords.some(h=>h.name==="static"),params:n,returnType:s,index:this.#y.length,declaration:t,locals:[],maxSlots:0};t.symbol=o,this.#y.push(o),this.#s.set(t.name,[...a,o])}#H(t){let e=t.declaration.params.map((n,s)=>n.varargs?`${I(t.params[s].element)}...`:I(t.params[s]));return`${t.name}(${e.join(",")})`}#R(){return{method:this.#o,field:this.#a,isStatic:this.#b,scopes:this.#x,nextSlot:this.#c,loopDepth:this.#i}}#z(t){this.#o=t.method,this.#a=t.field,this.#b=t.isStatic,this.#x=t.scopes,this.#c=t.nextSlot,this.#i=t.loopDepth}#O(t){this.#o=t,this.#a=null,this.#b=t.isStatic,this.#x=[],this.#c=t.isStatic?0:1,t.maxSlots=this.#c,this.#i=0,this.#v(),t.declaration.params.forEach((e,n)=>{let s=this.#L(e.name,t.params[n],e.pos,e.modifiers.keywords.some(a=>a.name==="final"));s.parameter=n+1,e.symbol=s});for(let e of t.declaration.body.statements)this.#W(e);this.#M(),this.#o=null}#D(t){if(t.state!=="pending")return;t.state="attributing";let e=this.#R();this.#o=null,this.#a=t,this.#b=t.isStatic,this.#x=[{names:new Map,nextSlot:0}],this.#c=0,this.#i=0;let n=t.declarator.init;if(n)if(n.kind==="ArrayInitializer")this.#_(n,t.type);else{let s=this.#w(n);lt(t.type,s,n.constant)?t.isFinal&&n.constant&&(H(t.type)||t.type.tag==="string")&&(t.constant=Pt(n.constant,t.type)):this.#m(n,s,t.type)}this.#z(e),t.state="done"}#v(){this.#x.push({names:new Map,nextSlot:this.#c})}#M(){let t=this.#x.pop();this.#c=t.nextSlot}#J(t){for(let e=this.#x.length-1;e>=0;e--){let n=this.#x[e].names.get(t);if(n)return n}}#L(t,e,n,s){let a=this.#o;this.#J(t)&&this.#n(n,b.alreadyDefined,`variable ${t} is already defined in method ${this.#H(a)}`);let o={kind:"local",name:t,type:e,index:a.locals.length,slot:this.#c++,isFinal:s,declPos:n};return a.maxSlots=Math.max(a.maxSlots,this.#c),a.locals.push(o),this.#x[this.#x.length-1].names.set(t,o),o}#et(t){this.#v();for(let e of t.statements)this.#W(e);this.#M()}#W(t){switch(t.kind){case"Block":this.#et(t);return;case"LocalVariableDeclaration":this.#q(t);return;case"ExpressionStatement":this.#w(t.expression);return;case"IfStatement":this.#K(t.condition),this.#B(t.then),t.otherwise&&this.#B(t.otherwise);return;case"WhileStatement":this.#K(t.condition),this.#i++,this.#B(t.body),this.#i--;return;case"ForStatement":this.#nt(t);return;case"BreakStatement":this.#i===0&&this.#n(t.pos,b.syntax,"break outside switch or loop");return;case"ContinueStatement":this.#i===0&&this.#n(t.pos,b.syntax,"continue outside of loop");return;case"ReturnStatement":this.#Q(t);return;case"EmptyStatement":return}}#B(t){this.#v(),this.#W(t),this.#M()}#nt(t){if(this.#v(),t.init&&!Array.isArray(t.init))this.#q(t.init);else for(let e of t.init??[])this.#w(e);t.condition&&this.#K(t.condition);for(let e of t.update)this.#w(e);this.#i++,this.#B(t.body),this.#i--,this.#M()}#Q(t){let e=this.#o.returnType;if(!t.value){e.tag!=="void"&&this.#n(t.pos,b.incompatibleTypes,"incompatible types: missing return value");return}let n=this.#w(t.value);if(e.tag==="void"){n.tag!=="error"&&this.#n(t.value.pos,b.incompatibleTypes,"incompatible types: unexpected return value");return}lt(e,n,t.value.constant)||this.#m(t.value,n,e)}#K(t){let e=this.#w(t);e.tag!=="error"&&e.tag!=="boolean"&&this.#m(t,e,_)}#q(t){let e=t.modifiers.keywords.some(s=>s.name==="final"),n=this.#N(t.type);for(let s of t.declarators){let a=n;s.extraDims>0&&n.tag!=="error"&&(s.extraDims>1||n.tag==="array"?(this.#h(s.pos,"multidimensional arrays"),a=T):a=it(n));let o=this.#L(s.name,a,s.pos,e);s.symbol=o;let h=s.init;if(!h){e&&this.#h(s.pos,"final local variables without an initializer");continue}if(h.kind==="ArrayInitializer"){this.#_(h,a);continue}let m=this.#w(h);lt(a,m,h.constant)?e&&h.constant&&(H(a)||a.tag==="string")&&(o.constant=Pt(h.constant,a)):this.#m(h,m,a)}}#_(t,e){if(e.tag==="error"){for(let n of t.elements)this.#w(n);return}if(e.tag!=="array"){this.#n(t.pos,b.incompatibleTypes,`illegal initializer for ${I(e)}`);return}t.elementType=e.element;for(let n of t.elements){let s=this.#w(n);lt(e.element,s,n.constant)||this.#m(n,s,e.element)}}#N(t){switch(t.kind){case"PrimitiveType":return t.name==="int"?$:t.name==="boolean"?_:t.name==="char"?rt:(this.#h(t.pos,`the type ${t.name}`,!0),T);case"VarType":return this.#h(t.pos,"\'var\' declarations"),T;case"VoidType":return this.#n(t.pos,b.syntax,"\'void\' type not allowed here"),T;case"ArrayType":{if(t.element.kind==="ArrayType")return this.#h(t.pos,"multidimensional arrays"),T;let e=this.#N(t.element);return e.tag==="error"?T:it(e)}case"ClassType":{let e=t.names.join(".");return e==="String"||e==="java.lang.String"?t.hasTypeArguments?(this.#n(t.typeArgumentsPos??t.pos,b.syntax,"type String does not take parameters"),T):ht:t.names.length===1&&(ee.has(e)||e===this.#u)?(this.#h(t.pos,`the type ${e}`,!0),T):t.names.length>1&&(t.names[0]==="java"||t.names[0]==="javax")?(this.#h(t.pos,`the type ${e}`,!0),T):t.names.length>1?(this.#n(t.lastDotPos??t.pos,b.cantResolve,`package ${t.names.slice(0,-1).join(".")} does not exist`),T):(this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: class ${e}`,` location: class ${this.#u}`]),T)}}}#m(t,e,n){e.tag==="error"||n.tag==="error"||this.#n(t.pos,b.incompatibleTypes,`incompatible types: ${vt(n,e)}`)}#w(t){let e=this.#V(t);return t.type=e,e}#C(t){let e=this.#w(t);return e.tag==="void"?(this.#n(t.pos,b.incompatibleTypes,"\'void\' type not allowed here"),T):e}#V(t){switch(t.kind){case"Literal":switch(t.literalKind){case"int":return t.constant=D(t.value),$;case"char":return t.constant=It(t.value.charCodeAt(0)),rt;case"boolean":return t.constant=F(t.value),_;case"string":return t.constant=Rt(t.value),ht;case"null":return Qt;default:return this.#h(t.pos,`\'${t.literalKind}\' literals`),T}case"Name":return this.#rt(t);case"Parenthesized":{let e=this.#w(t.expression);return t.expression.constant&&(t.constant=t.expression.constant),e}case"FieldAccess":return this.#it(t);case"MethodCall":return this.#mt(t);case"Unary":return this.#bt(t);case"IncDec":return this.#xt(t);case"Binary":return this.#Tt(t);case"Assignment":return this.#kt(t);case"ArrayAccess":return this.#St(t);case"NewArray":return this.#wt(t);case"Cast":return this.#At(t);case"This":return this.#st(t)}}#st(t){return this.#b?(this.#n(t.pos,b.cantResolve,"non-static variable this cannot be referenced from a static context"),T):Zt(this.#u)}#rt(t){let e=this.#J(t.identifier);if(e)return t.symbol=e,e.constant&&(t.constant=e.constant),e.type;let n=this.#r.get(t.identifier);if(n){if(!n.isStatic&&this.#b)return this.#n(t.pos,b.cantResolve,`non-static variable ${n.name} cannot be referenced from a static context`),T;let s=this.#a;return s&&!this.#E&&n.isStatic===s.isStatic&&n.order>=s.order?(this.#n(t.pos,b.syntax,n===s?"self-reference in initializer":"illegal forward reference"),T):(t.symbol=n,this.#G(t,n))}return this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: variable ${t.identifier}`,` location: class ${this.#u}`]),T}#G(t,e){return e.isFinal&&e.state==="pending"&&this.#D(e),e.constant&&(t.constant=e.constant),e.type}#Y(t){if(t.kind==="Name"&&!this.#J(t.identifier)&&!this.#r.has(t.identifier)){let e=t.identifier,n=e===this.#u&&!this.#f;if(e==="System"||e==="String"||n||ee.has(e))return t.symbol={kind:"type",name:e},{kind:"type",name:e}}return this.#w(t)}#X(t,e){if(!t)return` location: class ${this.#u}`;let n=pt(t);return n.kind==="Name"&&n.symbol?.kind==="local"?` location: variable ${n.identifier} of type ${I(e)}`:n.kind==="FieldAccess"&&n.field&&n.field!=="length"?` location: variable ${n.name} of type ${I(e)}`:` location: class ${I(e)}`}#it(t){let e=this.#Y(t.target);if("kind"in e&&e.kind==="type"){if(e.name==="System")return t.name==="out"||t.name==="err"?(t.field=t.name==="out"?"System.out":"System.err",qt):t.name==="in"?(this.#h(t.pos,"System.in (reading input)",!0),T):(this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`," location: class System"]),T);if(e.name===this.#u){let s=this.#r.get(t.name);return s?s.isStatic?(t.fieldSymbol=s,this.#G(t,s)):(this.#n(t.pos,b.cantResolve,`non-static variable ${s.name} cannot be referenced from a static context`),T):(this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`,` location: class ${this.#u}`]),T)}return this.#h(t.pos,`static members of ${e.name}`),T}let n=e;switch(n.tag){case"error":return T;case"class":{let s=this.#r.get(t.name);if(s)return t.fieldSymbol=s,this.#G(t,s);break}case"null":return this.#n(t.pos,b.cantResolve,"<null> cannot be dereferenced"),T;case"array":if(t.name==="length")return t.field="length",$;break;default:if(H(n)||n.tag==="void")return this.#n(t.pos,b.cantResolve,`${I(n)} cannot be dereferenced`),T}return this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`,this.#X(t.target,n)]),T}#at(t){return t.map(e=>this.#C(e))}#j(t,e){return`${t}(${e.map(I).join(",")})`}#mt(t){let e=null;t.target&&(e=this.#Y(t.target));let n=this.#at(t.args);if(n.some(h=>h.tag==="error")||e&&"tag"in e&&e.tag==="error")return T;let s=e!==null&&"kind"in e&&e.name===this.#u,a=e!==null&&"tag"in e&&e.tag==="class";if(!e||s||a){let h=(this.#s.get(t.name)??[]).map(x=>({owner:this.#u,name:x.name,params:x.params,returnType:x.returnType,method:x}));if(!h.length)return this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,n)}`,` location: class ${this.#u}`]),T;let m=this.#Z(t,h,n);if(!m)return T;let d=m.method;return!d.isStatic&&(s||!e&&this.#b)?(this.#n(t.selectPos,b.cantResolve,`non-static method ${d.name}(${d.params.map(I).join(",")}) cannot be referenced from a static context`),T):(t.method=d,m.returnType)}if("kind"in e&&e.name==="IO")return this.#gt(t,n);if("kind"in e)return e.name==="System"&&!Ne.has(t.name)?(this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,n)}`," location: class System"]),T):(this.#h(t.selectPos,`${e.name}.${t.name}()`,!0),T);let o=e;switch(o.tag){case"null":return this.#n(t.selectPos,b.cantResolve,"<null> cannot be dereferenced"),T;case"printstream":return this.#yt(t,o,n);case"string":{let h=Le[t.name];if(h){let m=this.#Z(t,[h],n);return m?(t.stringMethod=t.name,m.returnType):T}if(Pe.has(t.name))return this.#h(t.selectPos,`the String method ${t.name}()`,!0),T;break}case"array":if(De.has(t.name))return this.#h(t.selectPos,`the array method ${t.name}()`,!0),T;break;default:if(H(o)||o.tag==="void")return this.#n(t.selectPos,b.cantResolve,`${I(o)} cannot be dereferenced`),T}return this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,n)}`,this.#X(t.target,o)]),T}#gt(t,e){if(t.name==="readln")return this.#h(t.selectPos,"IO.readln() (reading input)",!0),T;if(t.name!=="print"&&t.name!=="println")return this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,e)}`," location: class IO"]),T;let n=t.name==="println"?[{owner:"IO",name:"println",params:[ut],returnType:Y},{owner:"IO",name:"println",params:[],returnType:Y}]:[{owner:"IO",name:"print",params:[ut],returnType:Y}];if(!this.#Z(t,n,e))return T;let a=e[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":case"null":o="string";break;default:o="object"}return t.print={stream:"out",newline:t.name==="println",argument:o},Y}#yt(t,e,n){let s=pt(t.target).kind==="FieldAccess"&&pt(t.target).field==="System.err"?"err":"out";if(t.name!=="print"&&t.name!=="println")return Oe.has(t.name)?this.#h(t.selectPos,`PrintStream.${t.name}()`,!0):this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,n)}`,this.#X(t.target,e)]),T;let a=this.#Z(t,Me(t.name),n);if(!a)return T;let o=a.params[0],h="none";if(o)switch(o.tag){case"int":h="int";break;case"char":h="char";break;case"boolean":h="boolean";break;case"string":h="string";break;case"array":h="char-array";break;case"object":h="object";break;default:throw new Error(`checker: unexpected print overload ${I(o)}`)}return t.print={stream:s,newline:t.name==="println",argument:h},Y}#Z(t,e,n){let s=(k,C)=>{if(k.params.length!==n.length)return"actual and formal argument lists differ in length";for(let u=0;u<n.length;u++)if(!C(k.params[u],n[u]))return`argument mismatch; ${vt(k.params[u],n[u])}`;return null},a=k=>s(k,te),o=e.filter(k=>s(k,q)===null);o.length||(o=e.filter(k=>a(k)===null));let h=k=>k.length?k.map(I).join(","):"no arguments";if(!o.length){if(e.length===1){let u=e[0];return this.#n(t.selectPos,b.cantResolve,`method ${t.name} in class ${u.owner} cannot be applied to given types;`,[` required: ${h(u.params)}`,` found: ${h(n)}`,` reason: ${a(u)}`]),null}let k=[];for(let u of e)k.push(` method ${u.owner}.${u.name}(${u.params.map(I).join(",")}) is not applicable`),k.push(` (${a(u)})`);let C=n.length?this.#j(t.name,n):`${t.name}(no arguments)`;return this.#n(t.selectPos,b.cantResolve,`no suitable method found for ${C}`,k),null}let m=(k,C)=>k.params.every((u,g)=>q(C.params[g],u)),d=o.filter(k=>o.every(C=>k===C||m(k,C)));if(d.length===1)return d[0];let x=o.filter(k=>!o.some(C=>C!==k&&m(C,k)&&!m(k,C))),[y,A]=x,P=k=>`method ${k.name}(${k.params.map(I).join(",")}) in ${k.owner}`;return this.#n(t.selectPos,b.cantResolve,`reference to ${t.name} is ambiguous`,[` both ${P(y)} and ${P(A)} match`]),null}#bt(t){let e=this.#C(t.operand);if(e.tag==="error")return T;if(t.operator==="!")return e.tag!=="boolean"?this.#ot(t,e):(t.operand.constant?.kind==="boolean"&&(t.constant=F(!t.operand.constant.value)),_);if(!G(e))return this.#ot(t,e);let n=t.operand.constant&&ft(t.operand.constant);return n!==void 0&&(t.operator==="-"?t.constant=D(-n):t.operator==="+"?t.constant=D(n):t.constant=D(~n)),$}#ot(t,e){return this.#n(t.pos,b.badOperands,`bad operand type ${I(e)} for unary operator \'${t.operator}\'`),T}#lt(t){let e=pt(t);this.#E=e.kind==="Name";let n=this.#w(e);if(this.#E=!1,t.type=n,n.tag==="error")return null;if(e.kind==="Name"&&e.symbol?.kind==="local")return e.symbol.isFinal?(this.#n(e.pos,b.finalAssign,`cannot assign a value to final variable ${e.identifier}`),null):{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.#n(e.pos,b.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==="FieldAccess"&&e.field){let a=e.field==="length"?"final variable length":`static final variable ${e.name}`;return this.#n(e.pos,b.finalAssign,`cannot assign a value to ${a}`),null}return this.#n(e.pos,b.incompatibleTypes,"unexpected type",[" required: variable"," found: value"]),null}#xt(t){if(!this.#lt(t.operand))return T;let n=t.operand.type;return n.tag!=="int"&&n.tag!=="char"?this.#ot(t,n):n}#ct(t,e,n,s){return this.#n(t.pos,b.badOperands,`bad operand types for binary operator \'${e}\'`,[` first type: ${I(n)}`,` second type: ${I(s)}`]),T}#ht(t,e,n){let s=G(e)&&G(n);switch(t){case"+":return e.tag==="string"||n.tag==="string"?ht:s?$:null;case"-":case"*":case"/":case"%":case"<<":case">>":case">>>":return s?$:null;case"<":case">":case"<=":case">=":return s?_:null;case"==":case"!=":return s?_:e.tag==="boolean"&&n.tag==="boolean"?_:K(e)&&K(n)&&(ot(e,n)||ot(n,e))?_:null;case"&":case"|":case"^":return s?$:e.tag==="boolean"&&n.tag==="boolean"?_:null;case"&&":case"||":return e.tag==="boolean"&&n.tag==="boolean"?_:null}return null}#Tt(t){let e=this.#C(t.left),n=this.#C(t.right);if(e.tag==="error"||n.tag==="error")return T;let s=this.#ht(t.operator,e,n);if(!s){let h=m=>H(m)||K(m);return(t.operator==="=="||t.operator==="!=")&&h(e)&&h(n)&&H(e)===H(n)?(this.#n(t.pos,b.badOperands,`incomparable types: ${I(e)} and ${I(n)}`),T):this.#ct(t,t.operator,e,n)}let a=t.left.constant,o=t.right.constant;if(a&&o){let h=Je(t.operator,a,o);h&&(t.constant=h)}return s}#kt(t){let e=this.#lt(t.target),n=t.target.type??T,s=this.#C(t.value);if(!e||n.tag==="error"||s.tag==="error")return e?n:T;if(t.operator==="=")return lt(n,s,t.value.constant)?n:(this.#m(t.value,s,n),T);let a=t.operator.slice(0,-1),o=this.#ht(a,n,s);return o?G(o)&&G(n)||at(o,n)?n:(this.#n(t.value.pos,b.incompatibleTypes,`incompatible types: ${I(o)} cannot be converted to ${I(n)}`),T):this.#ct(t,a,n,s)}#St(t){let e=this.#C(t.array),n=this.#C(t.index);return e.tag==="error"||n.tag==="error"?T:e.tag!=="array"?(this.#n(t.pos,b.incompatibleTypes,`array required, but ${I(e)} found`),T):q($,n)?e.element:(this.#m(t.index,n,$),T)}#wt(t){let e=this.#N(t.elementType);if(t.length){let s=this.#C(t.length);s.tag!=="error"&&!q($,s)&&this.#m(t.length,s,$)}if(e.tag==="error"){for(let s of t.initializer?.elements??[])this.#w(s);return T}let n=it(e);return t.initializer&&this.#_(t.initializer,n),n}#At(t){let e=this.#N(t.targetType),n=this.#C(t.expression);if(e.tag==="error"||n.tag==="error")return T;if(!(G(e)&&G(n)||e.tag==="boolean"&&n.tag==="boolean"||K(e)&&K(n)&&(ot(n,e)||ot(e,n))))return this.#m(t.expression,n,e),T;let a=t.expression.constant;return a&&(H(e)||e.tag==="string")&&(t.constant=Pt(a,e)),e}#Et(t){let e=$e();for(let a of t.declaration.params)a.symbol&&(e=bt(e,a.symbol.index));this.#A=[];let n=t.declaration.body;this.#ut(n.statements,e,!0).completes&&t.returnType.tag!=="void"&&this.#S.push([t.declaration.closeBracePos??n.end-1,"missing return statement"])}#ut(t,e,n){let s=e,a=n,o=!1;for(let h of t){!a&&!o&&(this.#S.push([se(h),"unreachable statement"]),o=!0,a=!0,s=X());let m=this.#tt(h,s,a);s=m.after,a=m.completes}return{after:s,completes:a}}#tt(t,e,n){switch(t.kind){case"Block":return this.#ut(t.statements,e,n);case"LocalVariableDeclaration":return{after:this.#ft(t,e),completes:n};case"ExpressionStatement":return{after:this.#g(t.expression,e),completes:n};case"EmptyStatement":return{after:e,completes:n};case"IfStatement":{let s=this.#I(t.condition,e),a=this.#tt(t.then,s.whenTrue,n);if(!t.otherwise)return{after:Q(a.after,s.whenFalse),completes:n};let o=this.#tt(t.otherwise,s.whenFalse,n);return{after:Q(a.after,o.after),completes:a.completes||o.completes}}case"WhileStatement":return this.#dt(t.condition,t.body,[],e,n);case"ForStatement":{let s=e;if(t.init&&!Array.isArray(t.init))s=this.#ft(t.init,s);else for(let a of t.init??[])s=this.#g(a,s);return this.#dt(t.condition,t.body,t.update,s,n)}case"BreakStatement":return this.#A[this.#A.length-1]?.breaks.push(e),{after:X(),completes:!1};case"ContinueStatement":return this.#A[this.#A.length-1]?.continues.push(e),{after:X(),completes:!1};case"ReturnStatement":return t.value&&this.#g(t.value,e),{after:X(),completes:!1}}}#dt(t,e,n,s,a){let o=t?this.#I(t,s):{whenTrue:s,whenFalse:X()},h=t?t.constant:F(!0),m=a&&!Nt(h);a&&!m&&this.#S.push([se(e),"unreachable statement"]);let d={breaks:[],continues:[]};this.#A.push(d);let x=this.#tt(e,m?o.whenTrue:X(),!0);this.#A.pop();let y=Q(x.after,...d.continues);for(let P of n)y=this.#g(P,y);let A=d.breaks.length>0;return{after:Q(o.whenFalse,...d.breaks),completes:a&&(!Ot(h)||A)}}#ft(t,e){let n=e;for(let s of t.declarators){let a=s.symbol;a&&(n=Ue(n,a.index));let o=s.init;if(o){if(o.kind==="ArrayInitializer")for(let h of o.elements)n=this.#g(h,n);else n=this.#g(o,n);a&&(n=bt(n,a.index))}}return n}#I(t,e){if(Ot(t.constant))return{whenTrue:e,whenFalse:X()};if(Nt(t.constant))return{whenTrue:X(),whenFalse:e};if(t.kind==="Parenthesized")return this.#I(t.expression,e);if(t.kind==="Unary"&&t.operator==="!"){let s=this.#I(t.operand,e);return{whenTrue:s.whenFalse,whenFalse:s.whenTrue}}if(t.kind==="Binary"&&t.operator==="&&"){let s=this.#I(t.left,e),a=this.#I(t.right,s.whenTrue);return{whenTrue:a.whenTrue,whenFalse:Q(s.whenFalse,a.whenFalse)}}if(t.kind==="Binary"&&t.operator==="||"){let s=this.#I(t.left,e),a=this.#I(t.right,s.whenFalse);return{whenTrue:Q(s.whenTrue,a.whenTrue),whenFalse:a.whenFalse}}let n=this.#g(t,e);return{whenTrue:n,whenFalse:n}}#pt(t,e,n){return Fe(n,t.index)?n:(this.#d.push([e,`variable ${t.name} might not have been initialized`]),bt(n,t.index))}#g(t,e){switch(t.kind){case"Literal":case"This":return e;case"Name":return t.symbol?.kind==="local"&&!t.constant?this.#pt(t.symbol,t.pos,e):e;case"Parenthesized":return this.#g(t.expression,e);case"FieldAccess":return this.#g(t.target,e);case"MethodCall":{let n=t.target?this.#g(t.target,e):e;for(let s of t.args)n=this.#g(s,n);return n}case"Unary":if(t.operator==="!"){let n=this.#I(t,e);return Q(n.whenTrue,n.whenFalse)}return this.#g(t.operand,e);case"IncDec":return this.#g(t.operand,e);case"Cast":return this.#g(t.expression,e);case"ArrayAccess":return this.#g(t.index,this.#g(t.array,e));case"NewArray":{let n=t.length?this.#g(t.length,e):e;for(let s of t.initializer?.elements??[])n=this.#g(s,n);return n}case"Binary":{if(t.operator==="&&"||t.operator==="||"){let n=this.#I(t,e);return Q(n.whenTrue,n.whenFalse)}return this.#g(t.right,this.#g(t.left,e))}case"Assignment":{let n=pt(t.target);if(n.kind==="Name"&&n.symbol?.kind==="local"){let s=t.operator==="="?e:this.#pt(n.symbol,n.pos,e);return s=this.#g(t.value,s),bt(s,n.symbol.index)}return this.#g(t.value,this.#g(t.target,e))}}}};function Pt(i,t){let e=ft(i);return t.tag==="char"&&e!==void 0?It(e):t.tag==="int"&&e!==void 0?D(e):i}function Je(i,t,e){if(i==="+"&&(t.kind==="string"||e.kind==="string"))return Rt(dt(t)+dt(e));let n=ft(t),s=ft(e);if(n!==void 0&&s!==void 0){switch(i){case"+":return D(n+s);case"-":return D(n-s);case"*":return D(Math.imul(n,s));case"/":return s===0?void 0:D(n/s);case"%":return s===0?void 0:D(n%s);case"<<":return D(n<<s);case">>":return D(n>>s);case">>>":return D(n>>>s);case"&":return D(n&s);case"|":return D(n|s);case"^":return D(n^s);case"<":return F(n<s);case">":return F(n>s);case"<=":return F(n<=s);case">=":return F(n>=s);case"==":return F(n===s);case"!=":return F(n!==s)}return}if(t.kind==="boolean"&&e.kind==="boolean"){let a=t.value,o=e.value;switch(i){case"&&":case"&":return F(a&&o);case"||":case"|":return F(a||o);case"^":case"!=":return F(a!==o);case"==":return F(a===o)}return}if(t.kind==="string"&&e.kind==="string"&&(i==="=="||i==="!=")){let a=t.value===e.value;return F(i==="=="?a:!a)}}var r={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,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},L={NONE:0,INT:1,BOOLEAN:2,STRING:3,CHAR:4,CHAR_ARRAY:5,OBJECT:6},z={INT:0,BOOLEAN:1,CHAR:2,STRING:3},xt={};for(let[i,t]of Object.entries(r))xt[t]={name:i,operands:0,pop:0,push:0};var v=(i,t,e,n)=>Object.assign(xt[i],{operands:t,pop:e,push:n});v(r.ICONST,1,0,1);v(r.SCONST,1,0,1);v(r.ACONST_NULL,0,0,1);v(r.LOAD,1,0,1);v(r.STORE,1,1,0);v(r.POP,0,1,0);v(r.DUP,0,1,2);v(r.DUP_X1,0,2,3);v(r.DUP_X2,0,3,4);v(r.DUP2,0,2,4);for(let i of[r.IADD,r.ISUB,r.IMUL,r.IDIV,r.IREM,r.ISHL,r.ISHR,r.IUSHR,r.IAND,r.IOR,r.IXOR])v(i,0,2,1);for(let i of[r.ICMPEQ,r.ICMPNE,r.ICMPLT,r.ICMPLE,r.ICMPGT,r.ICMPGE,r.ACMPEQ,r.ACMPNE])v(i,0,2,1);for(let i of[r.INEG,r.INOT,r.BNOT,r.I2C,r.TOSTRING_INT,r.TOSTRING_BOOL,r.TOSTRING_REF,r.TOSTRING_CHAR])v(i,0,1,1);v(r.JUMP,1,0,0);v(r.JUMP_IF_FALSE,1,1,0);v(r.JUMP_IF_TRUE,1,1,0);v(r.IINC,2,0,0);v(r.SCONCAT,0,2,1);v(r.PRINT,3,0,0);v(r.RETURN,0,0,0);v(r.RETURN_VALUE,0,1,0);v(r.INVOKE,1,0,0);v(r.NEWARRAY,1,1,1);v(r.ALOAD,2,2,1);v(r.ASTORE,2,3,0);v(r.ARRAYLENGTH,1,1,1);v(r.STR_LENGTH,1,1,1);v(r.STR_CHARAT,1,2,1);v(r.STR_EQUALS,1,2,1);v(r.GETSTATIC,1,0,1);v(r.PUTSTATIC,1,1,0);v(r.GETFIELD,1,1,1);v(r.PUTFIELD,1,2,0);v(r.NEW,0,0,1);var _e=new Set([r.ARRAYLENGTH,r.STR_LENGTH,r.STR_CHARAT,r.STR_EQUALS]),M=class extends Error{constructor(t){super(`invalid bytecode: ${t}`),this.name="BytecodeError"}};function ie(i,t){let e=i.code,n=new Set;for(let h=0;h<e.length;){let m=xt[e[h]];if(!m)throw new M(`unknown opcode ${e[h]} at ${h}`);if(n.add(h),h+=1+m.operands,h>e.length)throw new M("truncated instruction at end")}let s=new Map,a=[[0,0]],o=0;for(;a.length;){let[h,m]=a.pop(),d=h,x=m;for(;;){if(!n.has(d))throw new M(`control reaches non-instruction offset ${d}`);let y=s.get(d);if(y!==void 0){if(y!==x)throw new M(`stack height ${x} != ${y} at merge ${d}`);break}s.set(d,x);let A=e[d],P=xt[A],k=P.pop,C=P.push;if(A===r.PRINT&&(k=e[d+3]===L.NONE?0:1),A===r.INVOKE){let l=t.methods[e[d+1]];if(!l)throw new M(`call to unknown method ${e[d+1]} at ${d}`);k=l.argCount,C=l.returnsValue?1:0}if(x<k)throw new M(`stack underflow at ${d} (${P.name})`);if(x=x-k+C,o=Math.max(o,x),A===r.LOAD||A===r.STORE||A===r.IINC){let l=e[d+1];if(l<0||l>=i.maxLocals)throw new M(`bad local slot ${l} at ${d}`)}if(A===r.SCONST&&(e[d+1]<0||e[d+1]>=t.strings.length))throw new M(`bad string index at ${d}`);if(A===r.GETSTATIC||A===r.PUTSTATIC||A===r.GETFIELD||A===r.PUTFIELD){let l=A<=r.PUTSTATIC?t.staticFieldIsReference?.length??0:t.instanceFieldIsReference?.length??0;if(e[d+1]<0||e[d+1]>=l)throw new M(`bad field index at ${d}`)}let u=A===r.ALOAD||A===r.ASTORE?e[d+2]:_e.has(A)?e[d+1]:null;if(u!==null&&(u<-1||u>=t.messages.length))throw new M(`bad message index at ${d}`);if(A===r.RETURN||A===r.RETURN_VALUE){if(A===r.RETURN_VALUE!==i.returnsValue)throw new M(`wrong return kind at ${d}`);if(x!==0)throw new M(`return with non-empty stack at ${d}`);break}let g=d+1+P.operands;if(A===r.JUMP||A===r.JUMP_IF_FALSE||A===r.JUMP_IF_TRUE){let l=e[d+1];if(!n.has(l))throw new M(`jump to ${l} at ${d}`);if(a.push([l,x]),A===r.JUMP)break}if(g>=e.length)throw new M(`falls off the end at ${d}`);d=g}}return o}function ae(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}function ce(i,t){let e=new Lt(t,i.mainClass.name),n=i.methods.map(y=>e.method(y)),s=i.fields,a=s.filter(y=>y.isStatic&&y.declarator.init),o=a.length?n.push(e.initializer("<clinit>",a))-1:-1,h=i.main,m=h.isStatic?-1:n.push(e.initializer("<init>",s.filter(y=>!y.isStatic&&y.declarator.init)))-1,d=n.push(e.launcher(h,o,m))-1,x={version:3,className:i.mainClass.name,strings:e.strings,messages:e.messages,methods:n,staticFieldIsReference:s.filter(y=>y.isStatic).map(y=>kt(y.type)),instanceFieldIsReference:s.filter(y=>!y.isStatic).map(y=>kt(y.type)),entry:d};for(let y of n)y.maxStack=ie(y,x);return x}var W=class{pc=-1;uses=[]};function Tt(i){switch(i.tag){case"int":return z.INT;case"boolean":return z.BOOLEAN;case"char":return z.CHAR;case"string":return z.STRING;default:throw new Error(`codegen: array of ${I(i)}`)}}var oe=["int","byte/boolean","char","object"];function Z(i){let t=i;for(;t.kind==="Parenthesized";)t=t.expression;return t}var Lt=class{strings=[];messages=[];#T=new Map;#k=new Map;#u;#f;#y=[];#s=[];#p=-1;#r=[];constructor(t,e){this.#u=t,this.#f=e}#e(t){return`${this.#f}.${t.name}(${t.params.map(I).join(", ")})`}initializer(t,e){this.#y=[],this.#s=[],this.#p=-1;for(let s of e){let a=s.declarator.init;this.#o(s.declarator.pos),s.isStatic||this.#t(r.LOAD,0),a.kind==="ArrayInitializer"?this.#F(a):(this.#l(a,!0),this.#U(s.type,a)),this.#t(s.isStatic?r.PUTSTATIC:r.PUTFIELD,s.index)}this.#t(r.RETURN);let n=t==="<init>";return{className:this.#f,name:t,display:`${this.#f}.${t}()`,file:this.#u.name,argCount:n?1:0,returnsValue:!1,code:Int32Array.from(this.#y),lines:Int32Array.from(this.#s),maxLocals:1,maxStack:0}}launcher(t,e,n){let s=[];return e>=0&&s.push(r.INVOKE,e),t.isStatic||s.push(r.NEW,r.DUP,r.INVOKE,n),t.params.length&&s.push(r.ICONST,0,r.NEWARRAY,z.STRING),s.push(r.INVOKE,t.index,r.RETURN),{className:this.#f,name:"<launch>",display:"<launch>",file:this.#u.name,argCount:0,returnsValue:!1,hidden:!0,code:Int32Array.from(s),lines:Int32Array.from([]),maxLocals:1,maxStack:0}}method(t){let e=t.declaration.body;this.#y=[],this.#s=[],this.#p=-1,this.#r=[];for(let n of e.statements)this.#d(n);return t.returnType.tag==="void"&&(this.#o(e.end-1),this.#t(r.RETURN)),{className:this.#f,name:t.name,display:this.#e(t),file:this.#u.name,argCount:t.params.length+(t.isStatic?0:1),returnsValue:t.returnType.tag!=="void",code:Int32Array.from(this.#y),lines:Int32Array.from(this.#s),maxLocals:Math.max(1,t.maxSlots),maxStack:0}}#t(...t){for(let e of t)this.#y.push(e)}#o(t){let{line:e}=gt(this.#u,t);e!==this.#p&&(this.#p=e,this.#s.push(this.#y.length,e))}#a(t,e){this.#t(t,-1),e.uses.push(this.#y.length-1),e.pc>=0&&(this.#y[this.#y.length-1]=e.pc)}#b(t){t.pc=this.#y.length;for(let e of t.uses)this.#y[e]=t.pc;this.#p=-1}#x(t){let e=this.#T.get(t);return e===void 0&&(e=this.strings.length,this.strings.push(t),this.#T.set(t,e)),e}#c(t){switch(t.kind){case"int":case"char":this.#t(r.ICONST,t.value);return;case"boolean":this.#t(r.ICONST,t.value?1:0);return;case"string":this.#t(r.SCONST,this.#x(t.value));return}}#i(t){let e=Z(t);switch(e.kind){case"Name":return e.symbol?.kind==="field"?this.#E(e.symbol):e.symbol?.kind!=="local"?null:e.symbol.parameter!==void 0?`<parameter${e.symbol.parameter}>`:`<local${e.symbol.slot}>`;case"FieldAccess":return e.fieldSymbol?this.#E(e.fieldSymbol):null;case"ArrayAccess":{let n=this.#i(e.array);if(n===null)return null;let s=Z(e.index),a=e.index.constant&&(e.index.constant.kind==="int"||e.index.constant.kind==="char")?String(e.index.constant.value):s.kind==="Name"?this.#i(s)??"...":"...";return`${n}[${a}]`}case"Cast":return this.#i(e.expression);default:return null}}#E(t){return t.isStatic?`${this.#f}.${t.name}`:`this.${t.name}`}#S(t,e){let n=Z(e),s=t;if(n.kind==="MethodCall"&&n.method)s+=` because the return value of "${this.#e(n.method)}" is null`;else{let o=this.#i(e);o!==null&&(s+=` because "${o}" is null`)}let a=this.#k.get(s);return a===void 0&&(a=this.messages.length,this.messages.push(s),this.#k.set(s,a)),a}#d(t){switch(t.kind){case"Block":for(let e of t.statements)this.#d(e);return;case"EmptyStatement":return;case"LocalVariableDeclaration":for(let e of t.declarators)e.init&&(this.#o(e.pos),e.init.kind==="ArrayInitializer"?this.#F(e.init):this.#l(e.init,!0),this.#t(r.STORE,e.symbol.slot));return;case"ExpressionStatement":this.#o(t.start),this.#l(t.expression,!1);return;case"IfStatement":{let e=t.condition.constant;if(e&&e.kind==="boolean"){e.value?this.#d(t.then):t.otherwise&&this.#d(t.otherwise);return}this.#o(t.start);let n=new W;if(this.#n(t.condition,n,!1),this.#d(t.then),t.otherwise){let s=new W;this.#a(r.JUMP,s),this.#b(n),this.#d(t.otherwise),this.#b(s)}else this.#b(n);return}case"WhileStatement":this.#A(t.start,t.condition,t.body,[]);return;case"ForStatement":if(t.init&&!Array.isArray(t.init))this.#d(t.init);else for(let e of t.init??[])this.#o(e.start),this.#l(e,!1);this.#A(t.start,t.condition,t.body,t.update);return;case"BreakStatement":this.#o(t.start),this.#a(r.JUMP,this.#r[this.#r.length-1].breakLabel);return;case"ContinueStatement":this.#o(t.start),this.#a(r.JUMP,this.#r[this.#r.length-1].continueLabel);return;case"ReturnStatement":this.#o(t.start),t.value?(this.#l(t.value,!0),this.#t(r.RETURN_VALUE)):this.#t(r.RETURN);return}}#A(t,e,n,s){let a=e?.constant;if(a&&a.kind==="boolean"&&!a.value)return;let o=new W,h=new W,m=new W;this.#b(o),this.#o(t),e&&!a&&this.#n(e,m,!1),this.#r.push({breakLabel:m,continueLabel:h}),this.#d(n),this.#r.pop(),this.#b(h);for(let d of s)this.#o(d.start),this.#l(d,!1);this.#a(r.JUMP,o),this.#b(m)}#n(t,e,n){let s=t.constant;if(s&&s.kind==="boolean"){s.value===n&&this.#a(r.JUMP,e);return}if(t.kind==="Parenthesized")return this.#n(t.expression,e,n);if(t.kind==="Unary"&&t.operator==="!")return this.#n(t.operand,e,!n);if(t.kind==="Binary"&&(t.operator==="&&"||t.operator==="||")){if(t.operator==="&&"!==n)this.#n(t.left,e,n),this.#n(t.right,e,n);else{let o=new W;this.#n(t.left,o,!n),this.#n(t.right,e,n),this.#h(o)}return}this.#l(t,!0),this.#a(n?r.JUMP_IF_TRUE:r.JUMP_IF_FALSE,e)}#h(t){t.pc=this.#y.length;for(let e of t.uses)this.#y[e]=t.pc}#l(t,e){if(t.constant){e&&this.#c(t.constant);return}switch(t.kind){case"Literal":if(t.literalKind!=="null")throw new Error(`codegen: unexpected literal ${t.literalKind}`);e&&this.#t(r.ACONST_NULL);return;case"Name":{if(t.symbol?.kind==="field"){if(!e)return;t.symbol.isStatic?this.#t(r.GETSTATIC,t.symbol.index):this.#t(r.LOAD,0,r.GETFIELD,t.symbol.index);return}if(t.symbol?.kind!=="local")throw new Error("codegen: unresolved name");e&&this.#t(r.LOAD,t.symbol.slot);return}case"This":e&&this.#t(r.LOAD,0);return;case"Parenthesized":this.#l(t.expression,e);return;case"Unary":this.#l(t.operand,!0),t.operator==="-"?this.#t(r.INEG):t.operator==="~"?this.#t(r.INOT):t.operator==="!"&&this.#t(r.BNOT),e||this.#t(r.POP);return;case"Cast":this.#l(t.expression,!0),t.type?.tag==="char"&&t.expression.type?.tag!=="char"&&this.#t(r.I2C),e||this.#t(r.POP);return;case"IncDec":this.#R(t,e);return;case"Binary":{if(t.operator==="&&"||t.operator==="||"){let n=new W,s=new W;this.#n(t,n,!1),this.#t(r.ICONST,1),this.#a(r.JUMP,s),this.#h(n),this.#t(r.ICONST,0),this.#h(s)}else if(t.type?.tag==="string")this.#v(t.left),this.#v(t.right),this.#t(r.SCONCAT);else{this.#l(t.left,!0),this.#l(t.right,!0);let n=kt(t.left.type)||kt(t.right.type);this.#t(le(t.operator,n))}e||this.#t(r.POP);return}case"Assignment":this.#z(t,e);return;case"ArrayAccess":this.#l(t.array,!0),this.#l(t.index,!0),this.#P(t.type,t.array),e||this.#t(r.POP);return;case"NewArray":t.initializer?this.#F(t.initializer):(this.#l(t.length,!0),this.#t(r.NEWARRAY,Tt(t.type.element))),e||this.#t(r.POP);return;case"FieldAccess":if(t.fieldSymbol){let n=t.fieldSymbol;n.isStatic?(Z(t.target).kind==="This"&&this.#t(r.LOAD,0,r.POP),e&&this.#t(r.GETSTATIC,n.index)):(this.#l(t.target,!0),this.#t(r.GETFIELD,n.index),e||this.#t(r.POP));return}if(t.field!=="length")throw new Error("codegen: field access used as a value");this.#l(t.target,!0),this.#t(r.ARRAYLENGTH,this.#S("Cannot read the array length",t.target)),e||this.#t(r.POP);return;case"MethodCall":this.#H(t,e);return}}#P(t,e){let n=Tt(t);this.#t(r.ALOAD,n,this.#S(`Cannot load from ${oe[n]} array`,e))}#$(t,e){let n=Tt(t);this.#t(r.ASTORE,n,this.#S(`Cannot store to ${oe[n]} array`,e))}#F(t){let e=t.elementType,n=Tt(e);this.#t(r.ICONST,t.elements.length,r.NEWARRAY,n),t.elements.forEach((s,a)=>{this.#t(r.DUP,r.ICONST,a),this.#l(s,!0),this.#U(e,s),this.#t(r.ASTORE,n,-1)})}#U(t,e){t.tag==="char"&&e.type?.tag!=="char"&&!e.constant&&this.#t(r.I2C)}#H(t,e){if(t.print){let n=L.NONE;t.print.argument!=="none"&&(this.#l(t.args[0],!0),n={int:L.INT,char:L.CHAR,boolean:L.BOOLEAN,string:L.STRING,"char-array":L.CHAR_ARRAY,object:L.OBJECT}[t.print.argument]),this.#t(r.PRINT,t.print.stream==="err"?1:0,t.print.newline?1:0,n);return}if(t.method){let n=t.target?Z(t.target):null;t.method.isStatic?n?.kind==="This"&&this.#t(r.LOAD,0,r.POP):n?this.#l(n,!0):this.#t(r.LOAD,0);for(let s of t.args)this.#l(s,!0);this.#t(r.INVOKE,t.method.index),!e&&t.method.returnType.tag!=="void"&&this.#t(r.POP);return}if(t.stringMethod){this.#l(t.target,!0);for(let n of t.args)this.#l(n,!0);switch(t.stringMethod){case"length":this.#t(r.STR_LENGTH,this.#S(\'Cannot invoke "String.length()"\',t.target));break;case"charAt":this.#t(r.STR_CHARAT,this.#S(\'Cannot invoke "String.charAt(int)"\',t.target));break;case"equals":this.#t(r.STR_EQUALS,this.#S(\'Cannot invoke "String.equals(Object)"\',t.target));break}e||this.#t(r.POP);return}throw new Error(`codegen: unresolved call to ${t.name}`)}#R(t,e){let n=Z(t.operand),s=t.operator==="++"?1:-1,a=t.type?.tag==="char";if(n.kind==="Name"&&n.symbol?.kind==="local"){let h=n.symbol.slot;if(!a){e&&!t.prefix&&this.#t(r.LOAD,h),this.#t(r.IINC,h,s),e&&t.prefix&&this.#t(r.LOAD,h);return}this.#t(r.LOAD,h),e&&!t.prefix&&this.#t(r.DUP),this.#t(r.ICONST,s,r.IADD,r.I2C),e&&t.prefix&&this.#t(r.DUP),this.#t(r.STORE,h);return}let o=this.#O(n);if(o){o.isStatic?(this.#t(r.GETSTATIC,o.index),e&&!t.prefix&&this.#t(r.DUP),this.#t(r.ICONST,s,r.IADD),a&&this.#t(r.I2C),e&&t.prefix&&this.#t(r.DUP),this.#t(r.PUTSTATIC,o.index)):(this.#D(n),this.#t(r.DUP,r.GETFIELD,o.index),e&&!t.prefix&&this.#t(r.DUP_X1),this.#t(r.ICONST,s,r.IADD),a&&this.#t(r.I2C),e&&t.prefix&&this.#t(r.DUP_X1),this.#t(r.PUTFIELD,o.index));return}if(n.kind!=="ArrayAccess")throw new Error("codegen: ++/-- target");this.#l(n.array,!0),this.#l(n.index,!0),this.#t(r.DUP2),this.#P(t.type,n.array),e&&!t.prefix&&this.#t(r.DUP_X2),this.#t(r.ICONST,s,r.IADD),a&&this.#t(r.I2C),e&&t.prefix&&this.#t(r.DUP_X2),this.#$(t.type,n.array)}#z(t,e){let n=Z(t.target),s=t.target.type,a=()=>{if(t.operator==="="){this.#l(t.value,!0),this.#U(s,t.value);return}if(s.tag==="string"){this.#t(r.TOSTRING_REF),this.#v(t.value),this.#t(r.SCONCAT);return}this.#l(t.value,!0),this.#t(le(t.operator.slice(0,-1),!1)),s.tag==="char"&&this.#t(r.I2C)};if(n.kind==="Name"&&n.symbol?.kind==="local"){t.operator!=="="&&this.#t(r.LOAD,n.symbol.slot),a(),e&&this.#t(r.DUP),this.#t(r.STORE,n.symbol.slot);return}let o=this.#O(n);if(o){o.isStatic?(t.operator!=="="&&this.#t(r.GETSTATIC,o.index),a(),e&&this.#t(r.DUP),this.#t(r.PUTSTATIC,o.index)):(this.#D(n),t.operator!=="="&&this.#t(r.DUP,r.GETFIELD,o.index),a(),e&&this.#t(r.DUP_X1),this.#t(r.PUTFIELD,o.index));return}if(n.kind!=="ArrayAccess")throw new Error("codegen: assignment target");this.#l(n.array,!0),this.#l(n.index,!0),t.operator!=="="&&(this.#t(r.DUP2),this.#P(s,n.array)),a(),e&&this.#t(r.DUP_X2),this.#$(s,n.array)}#O(t){if(t.kind==="Name"&&t.symbol?.kind==="field")return t.symbol;if(t.kind==="FieldAccess")return t.fieldSymbol}#D(t){t.kind==="FieldAccess"?this.#l(t.target,!0):this.#t(r.LOAD,0)}#v(t){if(t.constant){this.#t(r.SCONST,this.#x(dt(t.constant)));return}switch(this.#l(t,!0),t.type?.tag){case"int":this.#t(r.TOSTRING_INT);return;case"char":this.#t(r.TOSTRING_CHAR);return;case"boolean":this.#t(r.TOSTRING_BOOL);return;case"string":case"null":case"array":case"class":this.#t(r.TOSTRING_REF);return;default:throw new Error(`codegen: string conversion of ${t.type?.tag}`)}}};function kt(i){return i!==void 0&&(i.tag==="string"||i.tag==="null"||i.tag==="array"||i.tag==="class")}function le(i,t){switch(i){case"+":return r.IADD;case"-":return r.ISUB;case"*":return r.IMUL;case"/":return r.IDIV;case"%":return r.IREM;case"<<":return r.ISHL;case">>":return r.ISHR;case">>>":return r.IUSHR;case"&":return r.IAND;case"|":return r.IOR;case"^":return r.IXOR;case"<":return r.ICMPLT;case"<=":return r.ICMPLE;case">":return r.ICMPGT;case">=":return r.ICMPGE;case"==":return t?r.ACMPEQ:r.ICMPEQ;case"!=":return t?r.ACMPNE:r.ICMPNE}throw new Error(`codegen: operator ${i}`)}var V=class{value;constructor(t){this.value=t}},mt=class{kind;data;hash;constructor(t,e,n){this.kind=t,this.data=e,this.hash=n}},St=class{className;fields;hash;constructor(t,e,n){this.className=t,this.fields=e,this.hash=n}};function $t(i){return i instanceof mt?Ge(i):`${i.className}@${i.hash.toString(16)}`}var Be=["[I","[Z","[C","[Ljava.lang.String;"];function Ge(i){return`${Be[i.kind]}@${i.hash.toString(16)}`}var wt=class{#T=new Map;intern(t){let e=this.#T.get(t);return e||(e=new V(t),this.#T.set(t,e)),e}},At=class{#T=625341585;next(){let t=this.#T;return t^=t<<13,t^=t>>>17,t^=t<<5,this.#T=t>>>0,this.#T&2147483647||1}};var he=65536;function je(i,t){switch(i){case z.INT:return new Int32Array(t);case z.BOOLEAN:return new Uint8Array(t);case z.CHAR:return new Uint16Array(t);default:return new Array(t).fill(null)}}var Ft=(i,t)=>`Index ${i} out of bounds for length ${t}`;function He(i){let t="";for(let e=0;e<i.length;e+=8192)t+=String.fromCharCode(...i.subarray(e,e+8192));return t}function ue(i,t,e,n){let s=new wt,a=new At,o=i.strings.map(f=>s.intern(f)),h=i.messages,m=i.methods,d=globalThis.performance,x=e.maxDurationMs>0?d.now()+e.maxDurationMs:1/0,y=f=>({method:f,code:f.code,locals:new Array(f.maxLocals).fill(0),stack:new Array(f.maxStack+1).fill(0),sp:0,pc:0}),A=i.staticFieldIsReference.map(f=>f?null:0),P=i.instanceFieldIsReference.map(f=>f?null:0),k=y(m[i.entry]),C=[k],u=k.code,g=k.locals,l=k.stack,c=0,p=0,U=0,ct=Math.min(he,e.maxInstructions+1),tt=0,O=0,et=(f,S)=>({outcome:{kind:"resource-limit",limit:f,message:S},instructions:Math.min(U,e.maxInstructions)}),w=()=>{k.pc=p;let f=[];for(let S=C.length-1;S>=0;S--){let R=C[S];R.method.hidden||f.push({className:R.method.className,method:R.method.name,file:R.method.file,line:ae(R.method,R.pc)})}return f},E=(f,S)=>{let R={className:f,message:S,frames:w()};return C.some(J=>J.method.name==="<clinit>")&&(R={className:"java.lang.ExceptionInInitializerError",message:null,frames:[],cause:R}),{outcome:{kind:"exception",throwable:R},instructions:U}},N=f=>E("java.lang.NullPointerException",f>=0?h[f]:null),nt=(f,S)=>{if(tt+S.length>e.maxOutputChars){let R=e.maxOutputChars-tt;return R>0&&t(f,S.slice(0,R)),et("output",`the program printed more than ${e.maxOutputChars.toLocaleString("en-US")} characters`)}return tt+=S.length,U+=S.length>>>6,S&&t(f,S),null};for(;;){if(++U>=ct){if(U>e.maxInstructions)return et("instructions",`the program ran more than ${e.maxInstructions.toLocaleString("en-US")} steps`);if(x!==1/0&&d.now()>x)return et("time",`the program ran longer than ${e.maxDurationMs} ms`);ct=Math.min(U+he,e.maxInstructions+1),n?.()}switch(u[p]){case r.ICONST:l[c++]=u[p+1],p+=2;break;case r.SCONST:l[c++]=o[u[p+1]],p+=2;break;case r.ACONST_NULL:l[c++]=null,p+=1;break;case r.LOAD:l[c++]=g[u[p+1]],p+=2;break;case r.STORE:g[u[p+1]]=l[--c],p+=2;break;case r.POP:c--,p+=1;break;case r.DUP:l[c]=l[c-1],c++,p+=1;break;case r.DUP_X1:{let f=l[c-1];l[c-1]=l[c-2],l[c-2]=f,l[c++]=f,p+=1;break}case r.DUP_X2:{let f=l[c-1];l[c-1]=l[c-2],l[c-2]=l[c-3],l[c-3]=f,l[c++]=f,p+=1;break}case r.DUP2:l[c]=l[c-2],l[c+1]=l[c-1],c+=2,p+=1;break;case r.IADD:{let f=l[--c];l[c-1]=l[c-1]+f|0,p+=1;break}case r.ISUB:{let f=l[--c];l[c-1]=l[c-1]-f|0,p+=1;break}case r.IMUL:{let f=l[--c];l[c-1]=Math.imul(l[c-1],f),p+=1;break}case r.IDIV:{let f=l[--c];if(f===0)return E("java.lang.ArithmeticException","/ by zero");l[c-1]=l[c-1]/f|0,p+=1;break}case r.IREM:{let f=l[--c];if(f===0)return E("java.lang.ArithmeticException","/ by zero");l[c-1]=l[c-1]%f|0,p+=1;break}case r.INEG:l[c-1]=-l[c-1]|0,p+=1;break;case r.ISHL:{let f=l[--c];l[c-1]=l[c-1]<<f,p+=1;break}case r.ISHR:{let f=l[--c];l[c-1]=l[c-1]>>f,p+=1;break}case r.IUSHR:{let f=l[--c];l[c-1]=l[c-1]>>>f|0,p+=1;break}case r.IAND:{let f=l[--c];l[c-1]=l[c-1]&f,p+=1;break}case r.IOR:{let f=l[--c];l[c-1]=l[c-1]|f,p+=1;break}case r.IXOR:{let f=l[--c];l[c-1]=l[c-1]^f,p+=1;break}case r.INOT:l[c-1]=~l[c-1],p+=1;break;case r.BNOT:l[c-1]=l[c-1]^1,p+=1;break;case r.I2C:l[c-1]=l[c-1]&65535,p+=1;break;case r.ICMPEQ:case r.ACMPEQ:{let f=l[--c];l[c-1]=l[c-1]===f?1:0,p+=1;break}case r.ICMPNE:case r.ACMPNE:{let f=l[--c];l[c-1]=l[c-1]!==f?1:0,p+=1;break}case r.ICMPLT:{let f=l[--c];l[c-1]=l[c-1]<f?1:0,p+=1;break}case r.ICMPLE:{let f=l[--c];l[c-1]=l[c-1]<=f?1:0,p+=1;break}case r.ICMPGT:{let f=l[--c];l[c-1]=l[c-1]>f?1:0,p+=1;break}case r.ICMPGE:{let f=l[--c];l[c-1]=l[c-1]>=f?1:0,p+=1;break}case r.JUMP:p=u[p+1];break;case r.JUMP_IF_FALSE:p=l[--c]===0?u[p+1]:p+2;break;case r.JUMP_IF_TRUE:p=l[--c]!==0?u[p+1]:p+2;break;case r.IINC:{let f=u[p+1];g[f]=g[f]+u[p+2]|0,p+=3;break}case r.TOSTRING_INT:l[c-1]=new V(String(l[c-1])),p+=1;break;case r.TOSTRING_CHAR:l[c-1]=new V(String.fromCharCode(l[c-1])),p+=1;break;case r.TOSTRING_BOOL:l[c-1]=new V(l[c-1]?"true":"false"),p+=1;break;case r.TOSTRING_REF:{let f=l[c-1];f===null?l[c-1]=new V("null"):f instanceof V||(l[c-1]=new V($t(f))),p+=1;break}case r.SCONCAT:{let f=l[--c],S=l[c-1],R=S.value.length+f.value.length;if(R>e.maxStringLength)return et("memory",`the program built a String longer than ${e.maxStringLength.toLocaleString("en-US")} characters`);U+=R>>>6,l[c-1]=new V(S.value+f.value),p+=1;break}case r.PRINT:{let f=u[p+3],S="";if(f!==L.NONE){let J=l[--c];switch(f){case L.INT:S=String(J);break;case L.CHAR:S=String.fromCharCode(J);break;case L.BOOLEAN:S=J?"true":"false";break;case L.STRING:S=J===null?"null":J.value;break;case L.CHAR_ARRAY:if(J===null)return E("java.lang.NullPointerException",\'Cannot read the array length because "cbuf" is null\');S=He(J.data);break;default:S=J===null?"null":J instanceof V?J.value:$t(J)}}u[p+2]===1&&(S+=`\n`);let R=nt(u[p+1]===1?"stderr":"stdout",S);if(R)return R;p+=4;break}case r.INVOKE:{let f=m[u[p+1]];if(C.length>e.maxCallDepth)return E("java.lang.StackOverflowError",null);k.pc=p,c-=f.argCount,k.sp=c;let S=y(f);for(let R=0;R<f.argCount;R++)S.locals[R]=l[c+R];C.push(S),k=S,u=S.code,g=S.locals,l=S.stack,c=0,p=0;break}case r.RETURN:case r.RETURN_VALUE:{let f=u[p]===r.RETURN_VALUE?l[--c]:void 0;if(C.pop(),!C.length)return{outcome:{kind:"completed"},instructions:U};k=C[C.length-1],u=k.code,g=k.locals,l=k.stack,c=k.sp,p=k.pc+2,f!==void 0&&(l[c++]=f);break}case r.NEWARRAY:{let f=l[c-1];if(f<0)return E("java.lang.NegativeArraySizeException",String(f));if(O+f>e.maxArrayElements)return et("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);O+=f,U+=f>>>4,l[c-1]=new mt(u[p+1],je(u[p+1],f),a.next()),p+=2;break}case r.ALOAD:{let f=l[--c],S=l[c-1];if(S===null)return N(u[p+2]);if(f<0||f>=S.data.length)return E("java.lang.ArrayIndexOutOfBoundsException",Ft(f,S.data.length));l[c-1]=S.data[f],p+=3;break}case r.ASTORE:{let f=l[--c],S=l[--c],R=l[--c];if(R===null)return N(u[p+2]);if(S<0||S>=R.data.length)return E("java.lang.ArrayIndexOutOfBoundsException",Ft(S,R.data.length));R.data[S]=f,p+=3;break}case r.ARRAYLENGTH:{let f=l[c-1];if(f===null)return N(u[p+1]);l[c-1]=f.data.length,p+=2;break}case r.STR_LENGTH:{let f=l[c-1];if(f===null)return N(u[p+1]);l[c-1]=f.value.length,p+=2;break}case r.STR_CHARAT:{let f=l[--c],S=l[c-1];if(S===null)return N(u[p+1]);if(f<0||f>=S.value.length)return E("java.lang.StringIndexOutOfBoundsException",Ft(f,S.value.length));l[c-1]=S.value.charCodeAt(f),p+=2;break}case r.STR_EQUALS:{let f=l[--c],S=l[c-1];if(S===null)return N(u[p+1]);l[c-1]=f instanceof V&&f.value===S.value?1:0,p+=2;break}case r.GETSTATIC:l[c++]=A[u[p+1]],p+=2;break;case r.PUTSTATIC:A[u[p+1]]=l[--c],p+=2;break;case r.GETFIELD:l[c-1]=l[c-1].fields[u[p+1]],p+=2;break;case r.PUTFIELD:{let f=l[--c];l[--c].fields[u[p+1]]=f,p+=2;break}case r.NEW:l[c++]=new St(i.className,P.slice(),a.next()),p+=1;break;default:throw new Error(`interpreter: unknown opcode ${u[p]} at ${p}`)}}}var de=i=>i.message===null?i.className:`${i.className}: ${i.message}`;function fe(i){let t=[`Exception in thread "main" ${de(i)}`],e=n=>{for(let s of n.frames.slice(0,1024))t.push(` at ${s.className}.${s.method}(${s.file}:${s.line})`)};e(i);for(let n=i.cause;n;n=n.cause)t.push(`Caused by: ${de(n)}`),e(n);return t.join(`\n`)+`\n`}var pe={maxFiles:32,maxSourceChars:5e5,maxNestingDepth:200,maxExpressionDepth:1e3,maxInstructions:2e8,maxOutputChars:1e6,maxStringLength:1e7,maxArrayElements:16e6,maxCallDepth:5e4,maxDurationMs:0},Et=()=>globalThis.performance.now();function ze(i,t){let e=Object.keys(i);return t&&t in i?t:"Main.java"in i?"Main.java":e.find(n=>n.endsWith(".java"))??e[0]??"Main.java"}function We(i,t={}){let e=Et(),n={...pe,...t.limits},s=ze(i,t.entry),a=new yt,o=i[s]??"",h=Ut(s,o),m=new Map([[s,h]]),d=P=>({program:P,diagnostics:a.items,entry:s,diagnosticText:a.items.length?_t(a.items,m):"",compileMs:Et()-e});if(Object.keys(i).length>n.maxFiles)return a.launchError(s,b.limit,`too many files for this engine (limit ${n.maxFiles})`),d(null);if(!(s in i))return a.launchError(s,b.noMain,`file not found: ${s}`),d(null);if(o.length>n.maxSourceChars)return a.launchError(s,b.limit,`${s} is too large for this engine (limit ${n.maxSourceChars.toLocaleString("en-US")} characters)`),d(null);let x=jt(o);if(x.errors.length){for(let P of x.errors)a.error(h,P.offset,"lex",P.code,P.message);return d(null)}let y=zt(s,x.tokens,n);if(y.error)return y.error.code==="no-class"?a.launchError(s,b.noMain,y.error.message):a.error(h,y.error.offset,"parse",y.error.code,y.error.message),d(null);let A=re(y.unit,h,a);return!A||a.hasErrors?d(null):d(ce(A,h))}var Ke={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."};function Ye(i,t={}){let e={...pe,...t.limits},n="",s="",a=(y,A)=>{y==="stdout"?n+=A:s+=A,t.onOutput?.(y,A)},o=Et(),{outcome:h,instructions:m}=ue(i,a,e,t.onCheckpoint),d=Et()-o,x={stdout:n,diagnostics:[],instructions:m,compileMs:t.compileMs??0,runMs:d};switch(h.kind){case"completed":return{...x,status:"success",stderr:s,exitCode:0};case"exception":{let y=fe(h.throwable);return{...x,status:"runtime-error",stderr:s+y,errorText:y,exitCode:1}}case"resource-limit":{let y=`Stopped: ${h.message} (limit of this in-browser Java engine).\n`;return{...x,status:"resource-limit",stderr:s+y,errorText:y,hint:Ke[h.limit],exitCode:1}}}}function me(i,t={}){let e=We(i,t);return e.program?Ye(e.program,{...t,compileMs:e.compileMs}):{status:"compile-error",stdout:"",stderr:e.diagnosticText,errorText:e.diagnosticText,diagnostics:e.diagnostics,exitCode:1,instructions:0,compileMs:e.compileMs,runMs:0}}var ge="0.3.0";var Xe=8192,be=16;function xe(i,t={}){let e=t.now??(()=>globalThis.performance.now()),n=[],s=0,a=0,o=0,h=()=>{if(a=e(),!n.length)return;let x=n;n=[],s=0;for(let y of x)i({type:y.type,id:o,text:y.text})},m=(x,y)=>{let A=n[n.length-1];A&&A.type===x?A.text+=y:n.push({type:x,text:y}),s+=y.length,(s>=Xe||e()-a>=be)&&h()},d=x=>{o=x.id,n=[],s=0,a=e();let y=e(),A=x.entry||"Main.java",P=x.files&&Object.keys(x.files).length?{...x.files}:{};A in P||(P[A]=x.code??"");try{let k=()=>{n.length&&e()-a>=be&&h()},C=me(P,{entry:A,limits:t.limits,onOutput:m,onCheckpoint:k});h();let u=e()-y;if(C.status==="success"){i({type:"result",id:x.id,durationMs:u,status:"success"});return}if(C.status==="cancelled")return;i({type:"error",id:x.id,message:(C.errorText??"").replace(/\\n$/,""),hint:C.hint,durationMs:u,status:C.status,...C.diagnostics.length?{diagnostics:C.diagnostics}:{}})}catch(k){h();let C=k instanceof Error?k.message:String(k);i({type:"fatal",id:x.id,message:`Internal error in the Java engine: ${C}`})}};return x=>{switch(x.type){case"init":i({type:"ready",version:"25",interactiveStdin:!1,java:"25",engine:ge});return;case"run":d(x);return;case"stdin-response":return}}}var Te=globalThis,Qe=xe(i=>Te.postMessage(i));Te.onmessage=i=>Qe(i.data);})();\n',n=new class extends e{id=`java`;get source(){return t}get label(){return this.version?`Java ${this.version} (subset)`:`Java`}async editorLanguage(){let{java:e}=await import(`@codemirror/lang-java`);return e()}};export{n as javaRuntime};
|
package/dist/java-DSEX5tzl.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
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-CmbgEzLA.js";var t='"use strict";(()=>{function Ut(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 gt(i,t){let e=i.lineStarts,n=0,s=e.length-1;for(;n<s;){let a=n+s+1>>1;e[a]<=t?n=a:s=a-1}return{line:n+1,column:t-e[n]+1}}function Jt(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 b={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",unreachable:"unreachable",missingReturn:"missing-return",finalAssign:"final-assign",notStatement:"not-a-statement",numberTooLarge:"int-number-too-large",noMain:"no-main"},yt=class{items=[];error(t,e,n,s,a,o){let{line:h,column:m}=gt(t,e),d={code:s,phase:n,severity:"error",file:t.name,line:h,column:m,message:a,offset:e};return o&&o.length&&(d.details=o),this.items.push(d),d}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 _t(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 h=t.get(o.file);if(h&&o.line>0){let m=Jt(h,o.line);s.push(m);let d="";for(let x=0;x<o.column-1;x++)d+=m[x]===" "?" ":" ";s.push(d+"^")}for(let m of o.details??[])s.push(m)}let a=e.filter(o=>o.severity==="error").length;a&&(s.push(a===1?"1 error":`${a} errors`),s.push("error: compilation failed"));for(let o of n)s.push(`error: ${o.message}`);return s.join(`\n`)+`\n`}function ke(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function Vt(i){if(i.indexOf("\\\\u")===-1){let o=new Int32Array(i.length+1);for(let h=0;h<=i.length;h++)o[h]=h;return{text:i,offsets:o,errors:[]}}let t=[],e=[],n=[],s=0,a=0;for(;a<i.length;){let o=i.charCodeAt(a);if(o===92&&s%2===0&&i.charCodeAt(a+1)===117){let h=a+1;for(;i.charCodeAt(h)===117;)h++;let m=0,d=-1;for(let x=0;x<4;x++){let y=ke(i.charCodeAt(h+x));if(y<0){d=h+x;break}m=m*16+y}if(d>=0){n.push({offset:d,message:"illegal unicode escape"}),t.push("\\\\"),e.push(a),s=1,a++;continue}t.push(String.fromCharCode(m)),e.push(a),s=0,a=h+4;continue}s=o===92?s+1:0,t.push(i[a]),e.push(a),a++}return e.push(i.length),{text:t.join(""),offsets:Int32Array.from(e),errors:n}}var Se=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"]),we=[">>>=","<<=",">>=",">>>","...","->","::","++","--","&&","||","==","!=","<=",">=","+=","-=","*=","/=","&=","|=","^=","%=","<<",">>","(",")","{","}","[","]",";",",",".","@","=",">","<","!","~","?",":","+","-","*","/","&","|","^","%"];function Gt(i){return i>=65&&i<=90||i>=97&&i<=122||i===95||i===36}function Bt(i){return Gt(i)||i>=48&&i<=57}function j(i){return i>=48&&i<=57}function Ae(i){let t=i.charCodeAt(0);return t>=32&&t<127?`\'${i}\'`:`\'\\\\u${t.toString(16).padStart(4,"0")}\'`}function jt(i){let t=Vt(i),e=t.text,n=t.offsets,s=[],a=t.errors.map(u=>({offset:u.offset,code:"syntax",message:u.message}));if(a.length)return{tokens:[{kind:"eof",text:"",start:i.length,end:i.length}],errors:a};let o=(u,g,l="syntax")=>{a.push({offset:n[u],code:l,message:g})},h=(u,g,l,c)=>{s.push({kind:u,text:e.slice(g,l),start:n[g],end:n[l],...c})},m=e.length;m>0&&e.charCodeAt(m-1)===26&&m--;let d=0;for(;d<m;){let u=e.charCodeAt(d);if(u===32||u===9||u===12||u===10||u===13){d++;continue}if(u===47&&e.charCodeAt(d+1)===47){for(;d<m&&e.charCodeAt(d)!==10&&e.charCodeAt(d)!==13;)d++;continue}if(u===47&&e.charCodeAt(d+1)===42){let l=e.indexOf("*/",d+2);if(l===-1||l+2>m){o(d,"unclosed comment"),d=m;break}d=l+2;continue}if(Gt(u)){let l=d;for(;d<m&&Bt(e.charCodeAt(d));)d++;if(d<m&&e.charCodeAt(d)>127&&/[\\p{L}\\p{Nl}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\p{Sc}]/u.test(e[d]))for(o(d,"identifiers containing non-ASCII characters are not supported in this version","unsupported");d<m&&(Bt(e.charCodeAt(d))||e.charCodeAt(d)>127);)d++;let c=e.slice(l,d);h(Se.has(c)?"keyword":"identifier",l,d);continue}if(j(u)||u===46&&j(e.charCodeAt(d+1))){d=x(d);continue}if(u===39){d=A(d);continue}if(u===34){e.startsWith(\'"""\',d)?d=k(d):d=P(d);continue}let g=we.find(l=>e.startsWith(l,d));if(g){h("operator",d,d+g.length),d+=g.length;continue}u>127&&/[\\p{L}\\p{Nl}\\p{Sc}\\p{Pc}]/u.test(e[d])?o(d,"identifiers containing non-ASCII characters are not supported in this version","unsupported"):o(d,`illegal character: ${Ae(e[d])}`),d++}return s.push({kind:"eof",text:"",start:n[m],end:n[m]}),{tokens:s,errors:a};function x(u){let g=w=>w<m?e.charCodeAt(w):-1,l=w=>g(w)|32,c=w=>j(w)||(w|32)>=97&&(w|32)<=102,p=(w,E)=>{let N=w;for(;N<m&&(E(g(N))||g(N)===95);)N++;return N>w&&g(N-1)===95?(o(N-1,"illegal underscore"),null):N},U=(w,E,N)=>{let nt=e.slice(N,w).replace(/_/g,""),S=BigInt((E===16?"0x":E===8?"0o":E===2?"0b":"")+(nt||"0"));return(g(w)|32)===108?(h("long-literal",u,w+1,{integer:{value:S,radix:E}}),w+1):(h("int-literal",u,w,{integer:{value:S,radix:E}}),w)},ct=(w,E)=>{if(l(w)!==E)return w;let N=w+1;return(g(N)===43||g(N)===45)&&N++,j(g(N))?p(N,j):(o(u,"malformed floating-point literal"),null)},tt=w=>{let E=l(w);return E===102?(h("float-literal",u,w+1),w+1):E===100?(h("double-literal",u,w+1),w+1):(h("double-literal",u,w),w)};if(g(u)===48&&l(u+1)===120){let w=u+2;if(g(w)===95)return o(w,"illegal underscore"),w+1;let E=p(w,c);if(E===null)return m;let N=E>w;if(g(E)===46||l(E)===112){if(g(E)===46){let f=p(E+1,c);if(f===null)return m;if(!N&&f===E+1)return o(u,"hexadecimal numbers must contain at least one hexadecimal digit"),f;E=f}if(l(E)!==112)return o(u,"malformed floating-point literal"),E;let nt=ct(E,112);return nt===null?m:tt(nt)}return N?U(E,16,w):(o(u,"hexadecimal numbers must contain at least one hexadecimal digit"),E)}if(g(u)===48&&l(u+1)===98){let w=u+2;if(g(w)===95)return o(w,"illegal underscore"),w+1;let E=p(w,j);return E===null?m:E===w?(o(u,"binary numbers must contain at least one binary digit"),E):/[2-9]/.test(e.slice(w,E))?(o(u,"illegal digit in a binary literal"),E):U(E,2,w)}let O=u;if(j(g(u))&&(O=p(u,j),O===null))return m;if(g(O)===46&&(O>u||j(g(O+1)))||l(O)===101||l(O)===102||l(O)===100)return g(O)===46&&(O=j(g(O+1))?p(O+1,j):O+1,O===null)?m:(O=ct(O,101),O===null?m:tt(O));if(g(u)===48&&O>u+1){for(let w=u+1;w<O;w++)if(g(w)===56||g(w)===57)return o(w,"illegal digit in an octal literal"),O;return U(O,8,u+1)}return U(O,10,u)}function y(u){let g=e[u+1];switch(g){case"b":return["\\b",u+2];case"s":return[" ",u+2];case"t":return[" ",u+2];case"n":return[`\n`,u+2];case"f":return["\\f",u+2];case"r":return["\\r",u+2];case\'"\':return[\'"\',u+2];case"\'":return["\'",u+2];case"\\\\":return["\\\\",u+2]}if(g!==void 0&&g>="0"&&g<="7"){let l=g<="3"?3:2,c=u+1,p="";for(;p.length<l&&c<m&&e[c]>="0"&&e[c]<="7";)p+=e[c++];return[String.fromCharCode(parseInt(p,8)),c]}return null}function A(u){let g=u+1,l="";for(;g<m;){let c=e.charCodeAt(g);if(c===39)break;if(c===10||c===13)return o(u,"unclosed character literal"),g;if(c===92){let p=y(g);if(!p)return o(g+1,"illegal escape character"),C(g);l+=p[0],g=p[1];continue}l+=e[g],g++}return g>=m?(o(u,"unclosed character literal"),g):l.length===0?(o(u,"empty character literal"),g+1):l.length>1?(o(u,"unclosed character literal"),g+1):(h("char-literal",u,g+1,{stringValue:l}),g+1)}function P(u){let g=u+1,l="";for(;g<m;){let c=e.charCodeAt(g);if(c===34)return h("string-literal",u,g+1,{stringValue:l}),g+1;if(c===10||c===13)break;if(c===92){let p=y(g);if(!p)return o(g+1,"illegal escape character"),C(g);l+=p[0],g=p[1];continue}l+=e[g],g++}return o(u,"unclosed string literal"),g}function k(u){let g=u+3;for(;g<m;){if(e.charCodeAt(g)===92){g+=2;continue}if(e.startsWith(\'"""\',g))return h("text-block",u,g+3),g+3;g++}return o(u,"unclosed text block"),m}function C(u){for(;u<m&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;return u}}var B=class extends Error{info;constructor(t){super(t.message),this.info=t}},st=new Set(["int","boolean","byte","short","long","char","float","double"]),Ht=new Set(["public","protected","private","static","final","abstract","native","synchronized","transient","volatile","strictfp","default"]),Ee={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,">":7,"<=":7,">=":7,instanceof:7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},Ce=new Set(["=","+=","-=","*=","/=","%=","&=","|=","^=","<<=",">>=",">>>="]),ve={do:"\'do\' loops",switch:"\'switch\' statements",throw:"\'throw\' statements",try:"\'try\' statements",synchronized:"\'synchronized\' statements",assert:"\'assert\' statements"},Ie=new Set(["(","!","~","this","super","new","true","false","null","switch"]);function zt(i,t,e){let n=new Ct(i,t,e);try{return{unit:n.compilationUnit(),error:null}}catch(s){if(s instanceof B)return{unit:null,error:s.info};throw s}}var Ct=class{#T;#k;#u;#f=0;#y=0;constructor(t,e,n){this.#T=t,this.#k=e,this.#u=n}#s(t=0){return this.#k[Math.min(this.#f+t,this.#k.length-1)]}#p(){return this.#k[Math.max(this.#f-1,0)]}#r(){let t=this.#s();return this.#f<this.#k.length-1&&this.#f++,t}#e(t,e=0){let n=this.#s(e);return(n.kind==="operator"||n.kind==="keyword")&&n.text===t}#t(t=0,e){let n=this.#s(t);return n.kind==="identifier"&&(e===void 0||n.text===e)}#o(t){return this.#e(t)?(this.#r(),!0):!1}#a(t){if(this.#e(t))return this.#r();throw this.#s().kind==="eof"&&t==="}"&&this.#x(),this.#c(this.#p().end,`\'${t}\' expected`)}#b(){let t=this.#s();if(t.kind==="identifier")return this.#r();throw t.kind==="keyword"&&t.text==="_"?this.#i(t.start,"the unnamed variable \'_\'",!0):(t.kind==="eof"&&this.#x(),this.#c(t.kind==="keyword"?t.start:this.#p().end,"<identifier> expected"))}#x(){throw this.#c(this.#p().end,"reached end of file while parsing")}#c(t,e){return new B({offset:t,code:"syntax",message:e})}#i(t,e,n=!1){return new B({offset:t,code:"unsupported",message:`${e} ${n?"is":"are"} not supported in this version`})}#E(){if(++this.#y>this.#u.maxNestingDepth)throw new B({offset:this.#s().start,code:"limit",message:`code is nested too deeply for this engine (limit ${this.#u.maxNestingDepth})`})}#S(){this.#y--}#d(t,...e){let n=0;for(let s of e)n=Math.max(n,s.depth);if(t.depth=n+1,t.depth>this.#u.maxExpressionDepth)throw new B({offset:t.start,code:"limit",message:`expression is nested too deeply for this engine (limit ${this.#u.maxExpressionDepth})`});return t}compilationUnit(){let t={file:this.#T,types:[]},e=[];if(this.#e("package"))throw this.#i(this.#s().start,"package declarations");if(this.#e("import"))throw this.#i(this.#s().start,"import declarations");for(;this.#s().kind!=="eof";){if(this.#o(";"))continue;let n=this.#s().start;if(this.#e("import"))throw this.#A(t,e);let s=this.#h();if(this.#e("class")){t.types.push(this.#l(s,n));continue}if(this.#e("interface")||this.#e("enum")||this.#e("@")&&this.#e("interface",1))throw this.#i(this.#s().start,`${this.#e("enum")?"enum":"interface"} declarations`);if(this.#t(0,"record")&&this.#t(1))throw this.#i(this.#s().start,"record declarations");if(this.#n()){e.push(this.#$(s,n,null));continue}throw this.#A(t,e)}if(e.length){let n=t.types[0];if(n)throw this.#i(n.keywordPos,"classes declared in a compact source file");let s=e[0],a=this.#T.replace(/^.*[\\\\/]/,"").replace(/\\.java$/,"");t.types.push({kind:"ClassDeclaration",keyword:"class",modifiers:{keywords:[]},name:a,namePos:s.start,keywordPos:s.start,members:e,implicit:!0,pos:s.start,start:s.start,end:e[e.length-1].end})}return t}#A(t,e){let n=this.#k.some(s=>s.kind==="keyword"&&(s.text==="class"||s.text==="interface"||s.text==="enum"));return!t.types.length&&!e.length&&!n?new B({offset:0,code:"no-class",message:"no class declared in source file"}):this.#c(this.#s().start,"class, interface, annotation type, enum, record, method or field expected")}#n(){let t=this.#f;try{if(this.#e("void"))this.#r();else if(!this.#O())return!1;return this.#t()?(this.#r(),this.#e("(")||this.#e("=")||this.#e(";")||this.#e(",")):!1}finally{this.#f=t}}#h(){let t={keywords:[]};for(;;){let e=this.#s();if(e.kind==="operator"&&e.text==="@"){if(this.#e("interface",1))return t;throw this.#i(e.start,"annotations")}if(e.kind==="keyword"&&Ht.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.#r();continue}if(e.kind==="identifier"){let n=e.text==="sealed"&&(this.#e("class",1)||this.#e("interface",1)||this.#s(1).kind==="keyword"&&Ht.has(this.#s(1).text)),s=e.text==="non"&&this.#e("-",1)&&this.#t(2,"sealed");if(n||s)throw this.#i(e.start,"sealed and non-sealed classes")}return t}}#l(t,e){let n=this.#a("class"),s=this.#b(),a={kind:"ClassDeclaration",keyword:"class",modifiers:t,name:s.text,namePos:s.start,keywordPos:n.start,members:[],pos:s.start,start:e,end:e};if(this.#e("<"))throw this.#i(this.#s().start,"generic classes");for(let o of["extends","implements"])if(this.#e(o))throw this.#i(this.#s().start,`\'${o}\' clauses`);if(this.#t(0,"permits"))throw this.#i(this.#s().start,"\'permits\' clauses");for(this.#a("{");!this.#e("}");)this.#s().kind==="eof"&&this.#x(),!this.#o(";")&&a.members.push(this.#P(a.name));return a.end=this.#a("}").end,a}#P(t){let e=this.#s().start;if(this.#e("{")||this.#e("static")&&this.#e("{",1))throw this.#i(e,"initializer blocks");let n=this.#h();if(this.#e("class")||this.#e("interface")||this.#e("enum")||this.#t(0,"record")&&this.#t(1))throw this.#i(this.#s().start,"nested types");return this.#$(n,e,t)}#$(t,e,n){if(this.#e("<"))throw this.#i(this.#s().start,"generic methods");if(n!==null&&this.#t(0,n)&&this.#e("(",1))throw this.#i(this.#s().start,"constructors");let s;if(this.#e("void")){let o=this.#r();s={kind:"VoidType",pos:o.start,start:o.start,end:o.end}}else s=this.#R();let a=this.#b();if(!this.#e("(")){if(s.kind!=="VoidType"&&(this.#e("=")||this.#e(";")||this.#e(",")||this.#e("[")))return this.#F(t,s,a,e);throw this.#c(this.#p().end,"\'(\' expected")}return this.#U(t,s,a,e)}#F(t,e,n,s){let a=[],o=n;for(;;){let m=0;for(;this.#e("[")&&this.#e("]",1);)this.#r(),this.#r(),m++;let d=null;if(this.#o("=")&&(d=this.#e("{")?this.#_():this.#m()),a.push({name:o.text,extraDims:m,init:d,pos:o.start,start:o.start,end:this.#p().end}),!this.#o(","))break;o=this.#b()}let h=this.#a(";");return{kind:"FieldDeclaration",modifiers:t,type:e,declarators:a,pos:n.start,start:s,end:h.end}}#U(t,e,n,s){let a={kind:"MethodDeclaration",modifiers:t,returnType:e,name:n.text,namePos:n.start,params:[],body:null,pos:n.start,start:s,end:s};if(this.#a("("),!this.#e(")"))do a.params.push(this.#H());while(this.#o(","));if(this.#a(")"),this.#e("["))throw this.#i(this.#s().start,"array dimensions after a parameter list");if(this.#e("throws"))throw this.#i(this.#s().start,"\'throws\' clauses");if(this.#o(";"))return a.end=this.#p().end,a;if(!this.#e("{"))throw this.#c(this.#p().end,"\'{\' expected");return a.body=this.#D(),a.end=a.body.end,a.closeBracePos=a.body.end-1,a}#H(){let t=this.#s().start,e=this.#h(),n=this.#R(),s=!1;this.#o("...")&&(s=!0);let a=this.#b();for(;this.#e("[")&&this.#e("]",1);){let o=this.#r(),h=this.#r();n={kind:"ArrayType",element:n,pos:o.start,start:n.start,end:h.end}}if(s){let o=this.#p().end;n={kind:"ArrayType",element:n,pos:n.pos,start:n.start,end:o}}return{modifiers:e,type:n,name:a.text,varargs:s,pos:a.start,start:t,end:a.end}}#R(){let t=this.#s(),e;if(t.kind==="keyword"&&st.has(t.text))this.#r(),e={kind:"PrimitiveType",name:t.text,pos:t.start,start:t.start,end:t.end};else if(t.kind==="identifier"){let n=[this.#r().text],s=!1,a,o;for(;;){if(this.#e("<")&&(a??=this.#s().start,this.#z(),s=!0),this.#e(".")&&this.#t(1)){o=this.#r().start,n.push(this.#r().text);continue}break}e={kind:"ClassType",names:n,hasTypeArguments:s,typeArgumentsPos:a,lastDotPos:o,pos:t.start,start:t.start,end:this.#p().end}}else if(t.kind==="eof")this.#x();else throw this.#c(t.start,"<identifier> expected");for(;this.#e("[")&&this.#e("]",1);){let n=this.#r(),s=this.#r();e={kind:"ArrayType",element:e,pos:n.start,start:e.start,end:s.end}}return e}#z(){let t=0;do{let e=this.#s();if(e.kind==="operator"){if(e.text==="<")t++;else if(e.text===">")t--;else if(e.text===">>")t-=2;else if(e.text===">>>")t-=3;else if(![".",",","?","[","]","&","@"].includes(e.text))throw this.#c(e.start,"\'>\' expected")}else if(e.kind==="eof")this.#x();else{if(e.kind==="keyword"&&!st.has(e.text)&&e.text!=="extends"&&e.text!=="super")throw this.#c(e.start,"\'>\' expected");if(!["identifier","keyword"].includes(e.kind))throw this.#c(e.start,"\'>\' expected")}if(this.#r(),t<0)throw this.#c(e.start,"illegal start of type")}while(t>0)}#O(){let t=this.#f;try{return this.#R(),!0}catch(e){if(!(e instanceof B))throw e;return this.#f=t,!1}}#D(){let t=this.#a("{");this.#E();let e=[];for(;!this.#e("}");)this.#s().kind==="eof"&&this.#x(),e.push(this.#v());let n=this.#a("}");return this.#S(),{kind:"Block",statements:e,pos:t.start,start:t.start,end:n.end}}#v(){if(this.#M())return this.#J();if(this.#e("class")||this.#e("interface")||this.#e("enum")||(this.#e("abstract")||this.#e("static"))&&this.#e("class",1))throw this.#i(this.#s().start,"local classes");if(this.#t(0,"record")&&this.#t(1)&&this.#e("(",2))throw this.#i(this.#s().start,"local records");return this.#L()}#M(){if(this.#e("final")||this.#e("@")&&!this.#e("interface",1))return!0;let t=this.#s();if(t.kind==="keyword"&&st.has(t.text))return!this.#e(".",1);if(t.kind!=="identifier")return!1;let e=this.#f;try{if(!this.#O())return!1;let n=this.#s();return n.kind==="identifier"||n.kind==="keyword"&&n.text==="_"}finally{this.#f=e}}#J(){let t=this.#s().start,e=this.#h();for(let o of e.keywords)if(o.name!=="final")throw this.#c(o.pos,"illegal start of expression");let n=this.#R();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 o=this.#b(),h=0;for(;this.#e("[")&&this.#e("]",1);)this.#r(),this.#r(),h++;let m=null;this.#o("=")&&(m=this.#e("{")?this.#_():this.#m()),s.push({name:o.text,extraDims:h,init:m,pos:o.start,start:o.start,end:this.#p().end})}while(this.#o(","));let a=this.#a(";");return{kind:"LocalVariableDeclaration",modifiers:e,type:n,declarators:s,pos:t,start:t,end:a.end}}#L(){this.#E();try{let t=this.#s();if(t.kind==="operator"&&t.text==="{")return this.#D();if(t.kind==="operator"&&t.text===";")return this.#r(),{kind:"EmptyStatement",pos:t.start,start:t.start,end:t.end};if(t.kind==="keyword"){if(t.text==="if")return this.#et();if(t.text==="while")return this.#W();if(t.text==="for")return this.#B();if(t.text==="return")return this.#K();if(t.text==="break"||t.text==="continue")return this.#q();let e=ve[t.text];if(e)throw this.#i(t.start,e);if(t.text==="else")throw this.#c(t.start,"\'else\' without \'if\'")}if(t.kind==="identifier"){if(this.#e(":",1))throw this.#i(t.start,"labeled statements");if(t.text==="yield"&&!this.#e("=",1)&&!this.#e(".",1)&&!this.#e("(",1))throw this.#i(t.start,"\'yield\' statements")}if(this.#M()){let e=this.#J();throw this.#c(e.declarators[0].pos,"variable declaration not allowed here")}return this.#N()}finally{this.#S()}}#et(){let t=this.#a("if");this.#a("(");let e=this.#m();this.#a(")");let n=this.#L(),s=null;this.#o("else")&&(s=this.#L());let a=(s??n).end;return{kind:"IfStatement",condition:e,then:n,otherwise:s,pos:t.start,start:t.start,end:a}}#W(){let t=this.#a("while");this.#a("(");let e=this.#m();this.#a(")");let n=this.#L();return{kind:"WhileStatement",condition:e,body:n,pos:t.start,start:t.start,end:n.end}}#B(){let t=this.#a("for");if(this.#a("("),this.#nt())throw this.#i(t.start,"enhanced \'for\' loops (for (T x : array))");let e=null;this.#M()?e=this.#J():(this.#e(";")||(e=this.#Q()),this.#a(";"));let n=this.#e(";")?null:this.#m();this.#a(";");let s=this.#e(")")?[]:this.#Q();this.#a(")");let a=this.#L();return{kind:"ForStatement",init:e,condition:n,update:s,body:a,pos:t.start,start:t.start,end:a.end}}#nt(){let t=this.#f;try{return this.#h(),!this.#O()||!this.#t()?!1:(this.#r(),this.#e(":"))}catch(e){if(e instanceof B)return!1;throw e}finally{this.#f=t}}#Q(){let t=[];do{let e=this.#m();if(e.kind!=="Assignment"&&e.kind!=="IncDec"&&e.kind!=="MethodCall")throw this.#c(e.pos,"not a statement");t.push(e)}while(this.#o(","));return t}#K(){let t=this.#a("return"),e=this.#e(";")?null:this.#m(),n=this.#a(";");return{kind:"ReturnStatement",value:e,pos:t.start,start:t.start,end:n.end}}#q(){let t=this.#r();if(this.#t())throw this.#i(this.#s().start,`labeled \'${t.text}\' statements`);let e=this.#a(";");return{kind:t.text==="break"?"BreakStatement":"ContinueStatement",pos:t.start,start:t.start,end:e.end}}#_(){let t=this.#a("{");this.#E();let e=[];for(;!this.#e("}");){if(this.#e("{"))throw this.#i(this.#s().start,"multidimensional arrays");if(e.push(this.#m()),!this.#o(","))break}let n=this.#a("}");return this.#S(),{kind:"ArrayInitializer",elements:e,pos:t.start,start:t.start,end:n.end}}#N(){let t=this.#m();if(t.kind!=="Assignment"&&t.kind!=="IncDec"&&t.kind!=="MethodCall")throw this.#c(t.pos,"not a statement");let e=this.#a(";");return{kind:"ExpressionStatement",expression:t,pos:t.pos,start:t.start,end:e.end}}#m(){this.#E();try{let t=this.#w(),e=this.#s();if(e.kind==="operator"&&Ce.has(e.text)){this.#r();let n=this.#m();return this.#d({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.#S()}}#w(){let t=this.#C(1);if(this.#e("?"))throw this.#i(this.#s().start,"conditional expressions (?:)");return t}#C(t){let e=this.#V();for(;;){let n=this.#s();if(n.kind!=="operator"&&!(n.kind==="keyword"&&n.text==="instanceof"))break;let s=Ee[n.text];if(s===void 0||s<t)break;if(n.text==="instanceof")throw this.#i(n.start,"\'instanceof\' expressions");this.#r();let a=this.#C(s+1);e=this.#d({kind:"Binary",operator:n.text,left:e,right:a,depth:0,pos:n.start,start:e.start,end:a.end},e,a)}return e}#V(){this.#E();try{let t=this.#s();if(t.kind==="operator")switch(t.text){case"-":case"+":{this.#r();let e=this.#s(),n=t.text==="-"&&e.kind==="int-literal"&&e.integer?.radix===10&&e.integer.value===2147483648n?this.#Y(!0):this.#V();return this.#d({kind:"Unary",operator:t.text,operand:n,depth:0,pos:t.start,start:t.start,end:n.end},n)}case"!":case"~":{this.#r();let e=this.#V();return this.#d({kind:"Unary",operator:t.text,operand:e,depth:0,pos:t.start,start:t.start,end:e.end},e)}case"++":case"--":{this.#r();let e=this.#V();return this.#d({kind:"IncDec",operator:t.text,prefix:!0,operand:e,depth:0,pos:t.start,start:t.start,end:e.end},e)}case"(":if(this.#st()){this.#r();let e=this.#R();this.#a(")");let n=this.#V();return this.#d({kind:"Cast",targetType:e,expression:n,depth:0,pos:t.start,start:t.start,end:n.end},n)}break}return this.#rt(this.#X())}finally{this.#S()}}#st(){let t=this.#s(1);if(t.kind==="keyword"&&st.has(t.text))return this.#e(")",2)||this.#e("[",2)&&this.#e("]",3);if(t.kind!=="identifier")return!1;let e=this.#f;try{if(this.#r(),!this.#O()||!this.#o(")"))return!1;let n=this.#s();return n.kind==="identifier"||n.kind.endsWith("-literal")||n.kind==="text-block"?!0:(n.kind==="operator"||n.kind==="keyword")&&Ie.has(n.text)}finally{this.#f=e}}#rt(t){let e=t;for(;;){let n=this.#s();if(n.kind!=="operator")return e;if(n.text==="."){if(this.#r(),this.#e("<"))throw this.#i(this.#s().start,"explicit type arguments");let s=this.#s();if(s.kind==="keyword"&&["class","this","super","new"].includes(s.text))throw this.#i(s.start,`\'.${s.text}\' expressions`);let a=this.#b();if(this.#e("(")){let o=this.#s().start,h=this.#G();e=this.#d({kind:"MethodCall",target:e,name:a.text,namePos:a.start,selectPos:n.start,args:h,depth:0,pos:o,start:e.start,end:this.#p().end},e,...h)}else e=this.#d({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.#r();let s=this.#m(),a=this.#a("]");e=this.#d({kind:"ArrayAccess",array:e,index:s,depth:0,pos:n.start,start:e.start,end:a.end},e,s);continue}if(n.text==="::")throw this.#i(n.start,"method references");if(n.text==="++"||n.text==="--"){this.#r(),e=this.#d({kind:"IncDec",operator:n.text,prefix:!1,operand:e,depth:0,pos:n.start,start:e.start,end:n.end},e);continue}return e}}#G(){this.#a("(");let t=[];if(!this.#e(")"))do t.push(this.#m());while(this.#o(","));return this.#a(")"),t}#Y(t){let e=this.#r(),{value:n,radix:s}=e.integer,a;if(s===10){if(n>2147483648n||n===2147483648n&&!t)throw new B({offset:e.start,code:"int-number-too-large",message:"integer number too large"});a=Number(BigInt.asIntN(32,n))}else{if(n>0xffffffffn)throw new B({offset:e.start,code:"int-number-too-large",message:"integer number too large"});a=Number(BigInt.asIntN(32,n))}return{kind:"Literal",literalKind:"int",value:a,depth:1,pos:e.start,start:e.start,end:e.end}}#X(){let t=this.#s(),e=(n,s)=>(this.#r(),{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.#Y(!1);case"long-literal":return e("long",t.text);case"float-literal":return e("float",t.text);case"double-literal":return e("double",t.text);case"char-literal":return e("char",t.stringValue??"");case"string-literal":return e("string",t.stringValue??"");case"text-block":throw this.#i(t.start,"text blocks");case"identifier":{if(this.#e("->",1))throw this.#i(t.start,"lambda expressions");if(this.#r(),this.#e("(")){let n=this.#s().start,s=this.#G();return this.#d({kind:"MethodCall",target:null,name:t.text,namePos:t.start,selectPos:t.start,args:s,depth:0,pos:n,start:t.start,end:this.#p().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.#r(),{kind:"Literal",literalKind:"boolean",value:t.text==="true",depth:1,pos:t.start,start:t.start,end:t.end};case"null":return this.#r(),{kind:"Literal",literalKind:"null",value:null,depth:1,pos:t.start,start:t.start,end:t.end};case"this":if(this.#e("(",1))throw this.#i(t.start,"constructor calls with \'this(...)\'");return this.#r(),{kind:"This",depth:1,pos:t.start,start:t.start,end:t.end};case"super":throw this.#i(t.start,"\'super\'",!0);case"new":return this.#it();case"switch":throw this.#i(t.start,"\'switch\' expressions")}if(st.has(t.text)||t.text==="void")throw this.#i(t.start,"class literals");break;case"operator":if(t.text==="("){if(this.#at())throw this.#i(t.start,"lambda expressions");this.#r();let n=this.#m(),s=this.#a(")");return this.#d({kind:"Parenthesized",expression:n,depth:0,pos:t.start,start:t.start,end:s.end},n)}break;case"eof":this.#x()}throw this.#c(t.start,"illegal start of expression")}#it(){let t=this.#a("new"),e=this.#s(),n;if(e.kind==="keyword"&&st.has(e.text))this.#r(),n={kind:"PrimitiveType",name:e.text,pos:e.start,start:e.start,end:e.end};else if(e.kind==="identifier"){let h=[this.#r().text],m;for(;this.#e(".")&&this.#t(1);)m=this.#r().start,h.push(this.#r().text);if(this.#e("<")||this.#e("("))throw this.#i(t.start,"creating objects with \'new\'");n={kind:"ClassType",names:h,hasTypeArguments:!1,lastDotPos:m,pos:e.start,start:e.start,end:this.#p().end}}else throw this.#c(e.start,"<identifier> expected");if(!this.#e("["))throw this.#c(this.#p().end,"\'(\' or \'[\' expected");let s=this.#r();if(this.#o("]")){if(this.#e("["))throw this.#i(s.start,"multidimensional arrays");if(!this.#e("{"))throw this.#c(this.#p().end,"array dimension missing");let h=this.#_();return this.#d({kind:"NewArray",elementType:n,length:null,initializer:h,depth:0,pos:t.start,start:t.start,end:h.end},...h.elements)}let a=this.#m(),o=this.#a("]");if(this.#e("["))throw this.#i(s.start,"multidimensional arrays");return this.#d({kind:"NewArray",elementType:n,length:a,initializer:null,depth:0,pos:t.start,start:t.start,end:o.end},a)}#at(){let t=0;for(let e=0;;e++){let n=this.#s(e);if(n.kind==="eof")return!1;if(n.kind==="operator")if(n.text==="(")t++;else{if(n.text===")"&&--t===0)return this.#e("->",e+1);if(n.text===";"||n.text==="{"||n.text==="}")return!1}}}};var $={tag:"int"},rt={tag:"char"},_={tag:"boolean"},Kt={tag:"long"},Yt={tag:"float"},Xt={tag:"double"},Y={tag:"void"},Qt={tag:"null"},ht={tag:"string"},ut={tag:"object"},qt={tag:"printstream"},T={tag:"error"};function it(i){return{tag:"array",element:i}}function Zt(i){return{tag:"class",name:i}}function I(i){switch(i.tag){case"int":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 I(i.element)+"[]";case"class":return i.name;case"error":return"<any>"}}function at(i,t){return i.tag!==t.tag?!1:i.tag==="array"&&t.tag==="array"?at(i.element,t.element):i.tag==="class"&&t.tag==="class"?i.name===t.name:!0}function K(i){return i.tag==="string"||i.tag==="null"||i.tag==="object"||i.tag==="printstream"||i.tag==="array"||i.tag==="class"}function H(i){return["int","char","boolean","long","float","double"].includes(i.tag)}function G(i){return["int","char","long","float","double"].includes(i.tag)}var Wt={char:0,int:1,long:2,float:3,double:4};function Re(i,t){return!G(i)||!G(t)||i.tag==="char"?!1:Wt[t.tag]<Wt[i.tag]}function ot(i,t){return at(i,t)?!0:i.tag==="null"?K(t):t.tag==="object"?K(i):!1}function q(i,t){return i.tag==="error"||t.tag==="error"||at(i,t)||Re(i,t)?!0:K(i)&&ot(t,i)}function te(i,t){return q(i,t)?!0:i.tag==="object"&&H(t)}function lt(i,t,e){if(q(i,t))return!0;if(i.tag==="char"&&t.tag==="int"&&e?.kind==="int"){let n=e.value;return n>=0&&n<=65535}return!1}function vt(i,t){return G(i)&&G(t)?`possible lossy conversion from ${I(t)} to ${I(i)}`:`${I(t)} cannot be converted to ${I(i)}`}function dt(i){switch(i.kind){case"int":return String(i.value);case"char":return String.fromCharCode(i.value);case"boolean":return i.value?"true":"false";case"string":return i.value}}function D(i){return{kind:"int",value:i|0}}function It(i){return{kind:"char",value:i&65535}}function F(i){return{kind:"boolean",value:i}}function Rt(i){return{kind:"string",value:i}}function ft(i){return i.kind==="int"||i.kind==="char"?i.value:void 0}function Ot(i){return i!==void 0&&i.kind==="boolean"&&i.value}function Nt(i){return i!==void 0&&i.kind==="boolean"&&!i.value}var ee=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"]),Oe=new Set(["printf","format","flush","write","append","close","checkError","writeBytes","charset"]),Ne=new Set(["currentTimeMillis","nanoTime","exit","arraycopy","getProperty","getProperties","setProperty","clearProperty","lineSeparator","identityHashCode","getenv","gc","setOut","setErr","setIn","console","inheritedChannel","getLogger","load","loadLibrary","mapLibraryName","runFinalization"]),Pe=new Set(["substring","indexOf","lastIndexOf","isEmpty","isBlank","toUpperCase","toLowerCase","trim","strip","stripLeading","stripTrailing","split","contains","startsWith","endsWith","replace","replaceAll","replaceFirst","compareTo","compareToIgnoreCase","equalsIgnoreCase","concat","toCharArray","chars","codePoints","format","formatted","valueOf","copyValueOf","join","repeat","matches","hashCode","intern","codePointAt","codePointBefore","codePointCount","offsetByCodePoints","getBytes","getChars","lines","indent","translateEscapes","transform","describeConstable","resolveConstantDesc","contentEquals","regionMatches","subSequence","toString","getClass","wait","notify","notifyAll","splitWithDelimiters"]),De=new Set(["clone","getClass","hashCode","equals","toString","wait","notify","notifyAll"]),ne=[_,rt,$,Kt,Yt,Xt,it(rt),ht,ut];function Me(i){return(i==="println"?[[],...ne.map(e=>[e])]:ne.map(e=>[e])).map(e=>({owner:"PrintStream",name:i,params:e,returnType:Y}))}var Le={length:{owner:"String",name:"length",params:[],returnType:$},charAt:{owner:"String",name:"charAt",params:[$],returnType:rt},equals:{owner:"String",name:"equals",params:[ut],returnType:_}},$e=()=>({all:!1,vars:new Set}),X=()=>({all:!0,vars:new Set}),Mt=i=>({all:i.all,vars:new Set(i.vars)});function Q(i,...t){let e=i;for(let n of t){if(e.all){e=Mt(n);continue}if(n.all)continue;let s=new Set;for(let a of e.vars)n.vars.has(a)&&s.add(a);e={all:!1,vars:s}}return e}function Fe(i,t){return i.all||i.vars.has(t)}function bt(i,t){if(i.all)return i;let e=Mt(i);return e.vars.add(t),e}function Ue(i,t){if(i.all)return i;let e=Mt(i);return e.vars.delete(t),e}function se(i){return i.kind==="LocalVariableDeclaration"?i.declarators[0].pos:i.start}function pt(i){let t=i;for(;t.kind==="Parenthesized";)t=t.expression;return t}function re(i,t,e){return new Dt(t,e).checkUnit(i)}var Dt=class{#T;#k;#u="";#f=!1;#y=[];#s=new Map;#p=[];#r=new Map;#e=0;#t=0;#o=null;#a=null;#b=!0;#x=[];#c=0;#i=0;#E=!1;#S=[];#d=[];#A=[];constructor(t,e){this.#T=t,this.#k=e}#n(t,e,n,s){this.#k.error(this.#T,t,"type",e,n,s)}#h(t,e,n=!1){this.#n(t,b.unsupported,`${e} ${n?"is":"are"} not supported in this version`)}checkUnit(t){let[e,...n]=t.types;if(!e)return this.#k.launchError(this.#T.name,b.noMain,"no class declared in source file"),null;for(let a of n)this.#h(a.namePos,"multiple top-level classes");this.#u=e.name,this.#f=e.implicit===!0;for(let a of e.modifiers.keywords)a.name==="public"||a.name==="final"||(a.name==="abstract"||a.name==="strictfp"?this.#h(a.pos,`\'${a.name}\' classes`):this.#n(e.keywordPos,b.syntax,`modifier ${a.name} not allowed here`));for(let a of e.members)a.kind==="FieldDeclaration"?this.#F(a):this.#U(a);let s=this.#l();if(!s)return this.#f?this.#n(e.members[0].start,b.noMain,"compact source file does not have main method in the form of void main() or void main(String[] args)"):this.#k.hasErrors||this.#k.launchError(this.#T.name,b.noMain,`can\'t find main(String[]) or main() method in class: ${this.#u}`),null;for(let a of e.members)if(a.kind==="FieldDeclaration")for(let o of a.declarators)o.field&&this.#D(o.field);else a.symbol&&this.#O(a.symbol);if(this.#k.hasErrors)return null;for(let a of this.#p)a.isFinal&&!a.declarator.init&&this.#d.push([a.declarator.pos,a.isStatic?`variable ${a.name} might not have been initialized`:`variable ${a.name} not initialized in the default constructor`]);for(let a of this.#y)this.#Et(a);for(let[a,o]of this.#S)this.#n(a,o==="missing return statement"?b.missingReturn:b.unreachable,o);for(let[a,o]of this.#d)this.#n(a,b.uninitialized,o);return this.#k.hasErrors?null:{mainClass:e,methods:this.#y,fields:this.#p,staticCount:this.#e,instanceCount:this.#t,main:s}}#l(){let t=this.#y.filter(e=>this.#P(e.declaration));return t.find(e=>e.params.length===1)??t.find(e=>e.params.length===0)??null}#P(t){if(t.name!=="main"||t.returnType.kind!=="VoidType"||t.modifiers.keywords.some(n=>n.name==="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.#$(e.element)}#$(t){if(t.kind!=="ClassType"||t.hasTypeArguments)return!1;let e=t.names.join(".");return e==="String"||e==="java.lang.String"}#F(t){let e=t.modifiers.keywords.map(o=>o.name);for(let o of t.modifiers.keywords){if(o.name==="transient"||o.name==="volatile"){this.#h(o.pos,`\'${o.name}\' fields`);return}if(["abstract","synchronized","native","strictfp","default"].includes(o.name)){this.#n(t.declarators[0].pos,b.syntax,`modifier ${o.name} not allowed here`);return}}if(t.type.kind==="VarType"){this.#n(t.type.pos,b.syntax,"\'var\' is not allowed here");return}let n=e.includes("static"),s=e.includes("final"),a=this.#N(t.type);for(let o of t.declarators){let h=a;if(o.extraDims>0&&a.tag!=="error"){if(o.extraDims>1||a.tag==="array"){this.#h(o.pos,"multidimensional arrays");continue}h=it(a)}if(h.tag==="error")continue;if(this.#r.has(o.name)){this.#n(o.pos,b.alreadyDefined,`variable ${o.name} is already defined in class ${this.#u}`);continue}let m={kind:"field",name:o.name,type:h,isStatic:n,isFinal:s,index:n?this.#e++:this.#t++,order:this.#p.length,state:"pending",declaration:t,declarator:o};o.field=m,this.#p.push(m),this.#r.set(m.name,m)}}#U(t){for(let h of t.modifiers.keywords){if(["synchronized","strictfp","native","abstract"].includes(h.name)){this.#h(h.pos,`\'${h.name}\' methods`);return}if(h.name==="default"||h.name==="transient"||h.name==="volatile"){this.#n(t.namePos,b.syntax,`modifier ${h.name} not allowed here`);return}}let e=this.#P(t);for(let h of t.params)if(h.varargs&&!e){this.#h(h.pos,"variable-arity (varargs) methods");return}let n=t.params.map(h=>this.#N(h.type)),s=t.returnType.kind==="VoidType"?Y:this.#N(t.returnType);if(n.some(h=>h.tag==="error")||s.tag==="error")return;let a=this.#s.get(t.name)??[];if(a.some(h=>h.params.length===n.length&&h.params.every((m,d)=>at(m,n[d])))){this.#n(t.namePos,b.alreadyDefined,`method ${t.name}(${n.map(I).join(",")}) is already defined in class ${this.#u}`);return}if(!t.body){this.#n(t.namePos,b.syntax,"missing method body, or declare abstract");return}let o={kind:"method",name:t.name,isStatic:t.modifiers.keywords.some(h=>h.name==="static"),params:n,returnType:s,index:this.#y.length,declaration:t,locals:[],maxSlots:0};t.symbol=o,this.#y.push(o),this.#s.set(t.name,[...a,o])}#H(t){let e=t.declaration.params.map((n,s)=>n.varargs?`${I(t.params[s].element)}...`:I(t.params[s]));return`${t.name}(${e.join(",")})`}#R(){return{method:this.#o,field:this.#a,isStatic:this.#b,scopes:this.#x,nextSlot:this.#c,loopDepth:this.#i}}#z(t){this.#o=t.method,this.#a=t.field,this.#b=t.isStatic,this.#x=t.scopes,this.#c=t.nextSlot,this.#i=t.loopDepth}#O(t){this.#o=t,this.#a=null,this.#b=t.isStatic,this.#x=[],this.#c=t.isStatic?0:1,t.maxSlots=this.#c,this.#i=0,this.#v(),t.declaration.params.forEach((e,n)=>{let s=this.#L(e.name,t.params[n],e.pos,e.modifiers.keywords.some(a=>a.name==="final"));s.parameter=n+1,e.symbol=s});for(let e of t.declaration.body.statements)this.#W(e);this.#M(),this.#o=null}#D(t){if(t.state!=="pending")return;t.state="attributing";let e=this.#R();this.#o=null,this.#a=t,this.#b=t.isStatic,this.#x=[{names:new Map,nextSlot:0}],this.#c=0,this.#i=0;let n=t.declarator.init;if(n)if(n.kind==="ArrayInitializer")this.#_(n,t.type);else{let s=this.#w(n);lt(t.type,s,n.constant)?t.isFinal&&n.constant&&(H(t.type)||t.type.tag==="string")&&(t.constant=Pt(n.constant,t.type)):this.#m(n,s,t.type)}this.#z(e),t.state="done"}#v(){this.#x.push({names:new Map,nextSlot:this.#c})}#M(){let t=this.#x.pop();this.#c=t.nextSlot}#J(t){for(let e=this.#x.length-1;e>=0;e--){let n=this.#x[e].names.get(t);if(n)return n}}#L(t,e,n,s){let a=this.#o;this.#J(t)&&this.#n(n,b.alreadyDefined,`variable ${t} is already defined in method ${this.#H(a)}`);let o={kind:"local",name:t,type:e,index:a.locals.length,slot:this.#c++,isFinal:s,declPos:n};return a.maxSlots=Math.max(a.maxSlots,this.#c),a.locals.push(o),this.#x[this.#x.length-1].names.set(t,o),o}#et(t){this.#v();for(let e of t.statements)this.#W(e);this.#M()}#W(t){switch(t.kind){case"Block":this.#et(t);return;case"LocalVariableDeclaration":this.#q(t);return;case"ExpressionStatement":this.#w(t.expression);return;case"IfStatement":this.#K(t.condition),this.#B(t.then),t.otherwise&&this.#B(t.otherwise);return;case"WhileStatement":this.#K(t.condition),this.#i++,this.#B(t.body),this.#i--;return;case"ForStatement":this.#nt(t);return;case"BreakStatement":this.#i===0&&this.#n(t.pos,b.syntax,"break outside switch or loop");return;case"ContinueStatement":this.#i===0&&this.#n(t.pos,b.syntax,"continue outside of loop");return;case"ReturnStatement":this.#Q(t);return;case"EmptyStatement":return}}#B(t){this.#v(),this.#W(t),this.#M()}#nt(t){if(this.#v(),t.init&&!Array.isArray(t.init))this.#q(t.init);else for(let e of t.init??[])this.#w(e);t.condition&&this.#K(t.condition);for(let e of t.update)this.#w(e);this.#i++,this.#B(t.body),this.#i--,this.#M()}#Q(t){let e=this.#o.returnType;if(!t.value){e.tag!=="void"&&this.#n(t.pos,b.incompatibleTypes,"incompatible types: missing return value");return}let n=this.#w(t.value);if(e.tag==="void"){n.tag!=="error"&&this.#n(t.value.pos,b.incompatibleTypes,"incompatible types: unexpected return value");return}lt(e,n,t.value.constant)||this.#m(t.value,n,e)}#K(t){let e=this.#w(t);e.tag!=="error"&&e.tag!=="boolean"&&this.#m(t,e,_)}#q(t){let e=t.modifiers.keywords.some(s=>s.name==="final"),n=this.#N(t.type);for(let s of t.declarators){let a=n;s.extraDims>0&&n.tag!=="error"&&(s.extraDims>1||n.tag==="array"?(this.#h(s.pos,"multidimensional arrays"),a=T):a=it(n));let o=this.#L(s.name,a,s.pos,e);s.symbol=o;let h=s.init;if(!h){e&&this.#h(s.pos,"final local variables without an initializer");continue}if(h.kind==="ArrayInitializer"){this.#_(h,a);continue}let m=this.#w(h);lt(a,m,h.constant)?e&&h.constant&&(H(a)||a.tag==="string")&&(o.constant=Pt(h.constant,a)):this.#m(h,m,a)}}#_(t,e){if(e.tag==="error"){for(let n of t.elements)this.#w(n);return}if(e.tag!=="array"){this.#n(t.pos,b.incompatibleTypes,`illegal initializer for ${I(e)}`);return}t.elementType=e.element;for(let n of t.elements){let s=this.#w(n);lt(e.element,s,n.constant)||this.#m(n,s,e.element)}}#N(t){switch(t.kind){case"PrimitiveType":return t.name==="int"?$:t.name==="boolean"?_:t.name==="char"?rt:(this.#h(t.pos,`the type ${t.name}`,!0),T);case"VarType":return this.#h(t.pos,"\'var\' declarations"),T;case"VoidType":return this.#n(t.pos,b.syntax,"\'void\' type not allowed here"),T;case"ArrayType":{if(t.element.kind==="ArrayType")return this.#h(t.pos,"multidimensional arrays"),T;let e=this.#N(t.element);return e.tag==="error"?T:it(e)}case"ClassType":{let e=t.names.join(".");return e==="String"||e==="java.lang.String"?t.hasTypeArguments?(this.#n(t.typeArgumentsPos??t.pos,b.syntax,"type String does not take parameters"),T):ht:t.names.length===1&&(ee.has(e)||e===this.#u)?(this.#h(t.pos,`the type ${e}`,!0),T):t.names.length>1&&(t.names[0]==="java"||t.names[0]==="javax")?(this.#h(t.pos,`the type ${e}`,!0),T):t.names.length>1?(this.#n(t.lastDotPos??t.pos,b.cantResolve,`package ${t.names.slice(0,-1).join(".")} does not exist`),T):(this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: class ${e}`,` location: class ${this.#u}`]),T)}}}#m(t,e,n){e.tag==="error"||n.tag==="error"||this.#n(t.pos,b.incompatibleTypes,`incompatible types: ${vt(n,e)}`)}#w(t){let e=this.#V(t);return t.type=e,e}#C(t){let e=this.#w(t);return e.tag==="void"?(this.#n(t.pos,b.incompatibleTypes,"\'void\' type not allowed here"),T):e}#V(t){switch(t.kind){case"Literal":switch(t.literalKind){case"int":return t.constant=D(t.value),$;case"char":return t.constant=It(t.value.charCodeAt(0)),rt;case"boolean":return t.constant=F(t.value),_;case"string":return t.constant=Rt(t.value),ht;case"null":return Qt;default:return this.#h(t.pos,`\'${t.literalKind}\' literals`),T}case"Name":return this.#rt(t);case"Parenthesized":{let e=this.#w(t.expression);return t.expression.constant&&(t.constant=t.expression.constant),e}case"FieldAccess":return this.#it(t);case"MethodCall":return this.#mt(t);case"Unary":return this.#bt(t);case"IncDec":return this.#xt(t);case"Binary":return this.#Tt(t);case"Assignment":return this.#kt(t);case"ArrayAccess":return this.#St(t);case"NewArray":return this.#wt(t);case"Cast":return this.#At(t);case"This":return this.#st(t)}}#st(t){return this.#b?(this.#n(t.pos,b.cantResolve,"non-static variable this cannot be referenced from a static context"),T):Zt(this.#u)}#rt(t){let e=this.#J(t.identifier);if(e)return t.symbol=e,e.constant&&(t.constant=e.constant),e.type;let n=this.#r.get(t.identifier);if(n){if(!n.isStatic&&this.#b)return this.#n(t.pos,b.cantResolve,`non-static variable ${n.name} cannot be referenced from a static context`),T;let s=this.#a;return s&&!this.#E&&n.isStatic===s.isStatic&&n.order>=s.order?(this.#n(t.pos,b.syntax,n===s?"self-reference in initializer":"illegal forward reference"),T):(t.symbol=n,this.#G(t,n))}return this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: variable ${t.identifier}`,` location: class ${this.#u}`]),T}#G(t,e){return e.isFinal&&e.state==="pending"&&this.#D(e),e.constant&&(t.constant=e.constant),e.type}#Y(t){if(t.kind==="Name"&&!this.#J(t.identifier)&&!this.#r.has(t.identifier)){let e=t.identifier,n=e===this.#u&&!this.#f;if(e==="System"||e==="String"||n||ee.has(e))return t.symbol={kind:"type",name:e},{kind:"type",name:e}}return this.#w(t)}#X(t,e){if(!t)return` location: class ${this.#u}`;let n=pt(t);return n.kind==="Name"&&n.symbol?.kind==="local"?` location: variable ${n.identifier} of type ${I(e)}`:n.kind==="FieldAccess"&&n.field&&n.field!=="length"?` location: variable ${n.name} of type ${I(e)}`:` location: class ${I(e)}`}#it(t){let e=this.#Y(t.target);if("kind"in e&&e.kind==="type"){if(e.name==="System")return t.name==="out"||t.name==="err"?(t.field=t.name==="out"?"System.out":"System.err",qt):t.name==="in"?(this.#h(t.pos,"System.in (reading input)",!0),T):(this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`," location: class System"]),T);if(e.name===this.#u){let s=this.#r.get(t.name);return s?s.isStatic?(t.fieldSymbol=s,this.#G(t,s)):(this.#n(t.pos,b.cantResolve,`non-static variable ${s.name} cannot be referenced from a static context`),T):(this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`,` location: class ${this.#u}`]),T)}return this.#h(t.pos,`static members of ${e.name}`),T}let n=e;switch(n.tag){case"error":return T;case"class":{let s=this.#r.get(t.name);if(s)return t.fieldSymbol=s,this.#G(t,s);break}case"null":return this.#n(t.pos,b.cantResolve,"<null> cannot be dereferenced"),T;case"array":if(t.name==="length")return t.field="length",$;break;default:if(H(n)||n.tag==="void")return this.#n(t.pos,b.cantResolve,`${I(n)} cannot be dereferenced`),T}return this.#n(t.pos,b.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`,this.#X(t.target,n)]),T}#at(t){return t.map(e=>this.#C(e))}#j(t,e){return`${t}(${e.map(I).join(",")})`}#mt(t){let e=null;t.target&&(e=this.#Y(t.target));let n=this.#at(t.args);if(n.some(h=>h.tag==="error")||e&&"tag"in e&&e.tag==="error")return T;let s=e!==null&&"kind"in e&&e.name===this.#u,a=e!==null&&"tag"in e&&e.tag==="class";if(!e||s||a){let h=(this.#s.get(t.name)??[]).map(x=>({owner:this.#u,name:x.name,params:x.params,returnType:x.returnType,method:x}));if(!h.length)return this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,n)}`,` location: class ${this.#u}`]),T;let m=this.#Z(t,h,n);if(!m)return T;let d=m.method;return!d.isStatic&&(s||!e&&this.#b)?(this.#n(t.selectPos,b.cantResolve,`non-static method ${d.name}(${d.params.map(I).join(",")}) cannot be referenced from a static context`),T):(t.method=d,m.returnType)}if("kind"in e&&e.name==="IO")return this.#gt(t,n);if("kind"in e)return e.name==="System"&&!Ne.has(t.name)?(this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,n)}`," location: class System"]),T):(this.#h(t.selectPos,`${e.name}.${t.name}()`,!0),T);let o=e;switch(o.tag){case"null":return this.#n(t.selectPos,b.cantResolve,"<null> cannot be dereferenced"),T;case"printstream":return this.#yt(t,o,n);case"string":{let h=Le[t.name];if(h){let m=this.#Z(t,[h],n);return m?(t.stringMethod=t.name,m.returnType):T}if(Pe.has(t.name))return this.#h(t.selectPos,`the String method ${t.name}()`,!0),T;break}case"array":if(De.has(t.name))return this.#h(t.selectPos,`the array method ${t.name}()`,!0),T;break;default:if(H(o)||o.tag==="void")return this.#n(t.selectPos,b.cantResolve,`${I(o)} cannot be dereferenced`),T}return this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,n)}`,this.#X(t.target,o)]),T}#gt(t,e){if(t.name==="readln")return this.#h(t.selectPos,"IO.readln() (reading input)",!0),T;if(t.name!=="print"&&t.name!=="println")return this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,e)}`," location: class IO"]),T;let n=t.name==="println"?[{owner:"IO",name:"println",params:[ut],returnType:Y},{owner:"IO",name:"println",params:[],returnType:Y}]:[{owner:"IO",name:"print",params:[ut],returnType:Y}];if(!this.#Z(t,n,e))return T;let a=e[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":case"null":o="string";break;default:o="object"}return t.print={stream:"out",newline:t.name==="println",argument:o},Y}#yt(t,e,n){let s=pt(t.target).kind==="FieldAccess"&&pt(t.target).field==="System.err"?"err":"out";if(t.name!=="print"&&t.name!=="println")return Oe.has(t.name)?this.#h(t.selectPos,`PrintStream.${t.name}()`,!0):this.#n(t.selectPos,b.cantResolve,"cannot find symbol",[` symbol: method ${this.#j(t.name,n)}`,this.#X(t.target,e)]),T;let a=this.#Z(t,Me(t.name),n);if(!a)return T;let o=a.params[0],h="none";if(o)switch(o.tag){case"int":h="int";break;case"char":h="char";break;case"boolean":h="boolean";break;case"string":h="string";break;case"array":h="char-array";break;case"object":h="object";break;default:throw new Error(`checker: unexpected print overload ${I(o)}`)}return t.print={stream:s,newline:t.name==="println",argument:h},Y}#Z(t,e,n){let s=(k,C)=>{if(k.params.length!==n.length)return"actual and formal argument lists differ in length";for(let u=0;u<n.length;u++)if(!C(k.params[u],n[u]))return`argument mismatch; ${vt(k.params[u],n[u])}`;return null},a=k=>s(k,te),o=e.filter(k=>s(k,q)===null);o.length||(o=e.filter(k=>a(k)===null));let h=k=>k.length?k.map(I).join(","):"no arguments";if(!o.length){if(e.length===1){let u=e[0];return this.#n(t.selectPos,b.cantResolve,`method ${t.name} in class ${u.owner} cannot be applied to given types;`,[` required: ${h(u.params)}`,` found: ${h(n)}`,` reason: ${a(u)}`]),null}let k=[];for(let u of e)k.push(` method ${u.owner}.${u.name}(${u.params.map(I).join(",")}) is not applicable`),k.push(` (${a(u)})`);let C=n.length?this.#j(t.name,n):`${t.name}(no arguments)`;return this.#n(t.selectPos,b.cantResolve,`no suitable method found for ${C}`,k),null}let m=(k,C)=>k.params.every((u,g)=>q(C.params[g],u)),d=o.filter(k=>o.every(C=>k===C||m(k,C)));if(d.length===1)return d[0];let x=o.filter(k=>!o.some(C=>C!==k&&m(C,k)&&!m(k,C))),[y,A]=x,P=k=>`method ${k.name}(${k.params.map(I).join(",")}) in ${k.owner}`;return this.#n(t.selectPos,b.cantResolve,`reference to ${t.name} is ambiguous`,[` both ${P(y)} and ${P(A)} match`]),null}#bt(t){let e=this.#C(t.operand);if(e.tag==="error")return T;if(t.operator==="!")return e.tag!=="boolean"?this.#ot(t,e):(t.operand.constant?.kind==="boolean"&&(t.constant=F(!t.operand.constant.value)),_);if(!G(e))return this.#ot(t,e);let n=t.operand.constant&&ft(t.operand.constant);return n!==void 0&&(t.operator==="-"?t.constant=D(-n):t.operator==="+"?t.constant=D(n):t.constant=D(~n)),$}#ot(t,e){return this.#n(t.pos,b.badOperands,`bad operand type ${I(e)} for unary operator \'${t.operator}\'`),T}#lt(t){let e=pt(t);this.#E=e.kind==="Name";let n=this.#w(e);if(this.#E=!1,t.type=n,n.tag==="error")return null;if(e.kind==="Name"&&e.symbol?.kind==="local")return e.symbol.isFinal?(this.#n(e.pos,b.finalAssign,`cannot assign a value to final variable ${e.identifier}`),null):{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.#n(e.pos,b.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==="FieldAccess"&&e.field){let a=e.field==="length"?"final variable length":`static final variable ${e.name}`;return this.#n(e.pos,b.finalAssign,`cannot assign a value to ${a}`),null}return this.#n(e.pos,b.incompatibleTypes,"unexpected type",[" required: variable"," found: value"]),null}#xt(t){if(!this.#lt(t.operand))return T;let n=t.operand.type;return n.tag!=="int"&&n.tag!=="char"?this.#ot(t,n):n}#ct(t,e,n,s){return this.#n(t.pos,b.badOperands,`bad operand types for binary operator \'${e}\'`,[` first type: ${I(n)}`,` second type: ${I(s)}`]),T}#ht(t,e,n){let s=G(e)&&G(n);switch(t){case"+":return e.tag==="string"||n.tag==="string"?ht:s?$:null;case"-":case"*":case"/":case"%":case"<<":case">>":case">>>":return s?$:null;case"<":case">":case"<=":case">=":return s?_:null;case"==":case"!=":return s?_:e.tag==="boolean"&&n.tag==="boolean"?_:K(e)&&K(n)&&(ot(e,n)||ot(n,e))?_:null;case"&":case"|":case"^":return s?$:e.tag==="boolean"&&n.tag==="boolean"?_:null;case"&&":case"||":return e.tag==="boolean"&&n.tag==="boolean"?_:null}return null}#Tt(t){let e=this.#C(t.left),n=this.#C(t.right);if(e.tag==="error"||n.tag==="error")return T;let s=this.#ht(t.operator,e,n);if(!s){let h=m=>H(m)||K(m);return(t.operator==="=="||t.operator==="!=")&&h(e)&&h(n)&&H(e)===H(n)?(this.#n(t.pos,b.badOperands,`incomparable types: ${I(e)} and ${I(n)}`),T):this.#ct(t,t.operator,e,n)}let a=t.left.constant,o=t.right.constant;if(a&&o){let h=Je(t.operator,a,o);h&&(t.constant=h)}return s}#kt(t){let e=this.#lt(t.target),n=t.target.type??T,s=this.#C(t.value);if(!e||n.tag==="error"||s.tag==="error")return e?n:T;if(t.operator==="=")return lt(n,s,t.value.constant)?n:(this.#m(t.value,s,n),T);let a=t.operator.slice(0,-1),o=this.#ht(a,n,s);return o?G(o)&&G(n)||at(o,n)?n:(this.#n(t.value.pos,b.incompatibleTypes,`incompatible types: ${I(o)} cannot be converted to ${I(n)}`),T):this.#ct(t,a,n,s)}#St(t){let e=this.#C(t.array),n=this.#C(t.index);return e.tag==="error"||n.tag==="error"?T:e.tag!=="array"?(this.#n(t.pos,b.incompatibleTypes,`array required, but ${I(e)} found`),T):q($,n)?e.element:(this.#m(t.index,n,$),T)}#wt(t){let e=this.#N(t.elementType);if(t.length){let s=this.#C(t.length);s.tag!=="error"&&!q($,s)&&this.#m(t.length,s,$)}if(e.tag==="error"){for(let s of t.initializer?.elements??[])this.#w(s);return T}let n=it(e);return t.initializer&&this.#_(t.initializer,n),n}#At(t){let e=this.#N(t.targetType),n=this.#C(t.expression);if(e.tag==="error"||n.tag==="error")return T;if(!(G(e)&&G(n)||e.tag==="boolean"&&n.tag==="boolean"||K(e)&&K(n)&&(ot(n,e)||ot(e,n))))return this.#m(t.expression,n,e),T;let a=t.expression.constant;return a&&(H(e)||e.tag==="string")&&(t.constant=Pt(a,e)),e}#Et(t){let e=$e();for(let a of t.declaration.params)a.symbol&&(e=bt(e,a.symbol.index));this.#A=[];let n=t.declaration.body;this.#ut(n.statements,e,!0).completes&&t.returnType.tag!=="void"&&this.#S.push([t.declaration.closeBracePos??n.end-1,"missing return statement"])}#ut(t,e,n){let s=e,a=n,o=!1;for(let h of t){!a&&!o&&(this.#S.push([se(h),"unreachable statement"]),o=!0,a=!0,s=X());let m=this.#tt(h,s,a);s=m.after,a=m.completes}return{after:s,completes:a}}#tt(t,e,n){switch(t.kind){case"Block":return this.#ut(t.statements,e,n);case"LocalVariableDeclaration":return{after:this.#ft(t,e),completes:n};case"ExpressionStatement":return{after:this.#g(t.expression,e),completes:n};case"EmptyStatement":return{after:e,completes:n};case"IfStatement":{let s=this.#I(t.condition,e),a=this.#tt(t.then,s.whenTrue,n);if(!t.otherwise)return{after:Q(a.after,s.whenFalse),completes:n};let o=this.#tt(t.otherwise,s.whenFalse,n);return{after:Q(a.after,o.after),completes:a.completes||o.completes}}case"WhileStatement":return this.#dt(t.condition,t.body,[],e,n);case"ForStatement":{let s=e;if(t.init&&!Array.isArray(t.init))s=this.#ft(t.init,s);else for(let a of t.init??[])s=this.#g(a,s);return this.#dt(t.condition,t.body,t.update,s,n)}case"BreakStatement":return this.#A[this.#A.length-1]?.breaks.push(e),{after:X(),completes:!1};case"ContinueStatement":return this.#A[this.#A.length-1]?.continues.push(e),{after:X(),completes:!1};case"ReturnStatement":return t.value&&this.#g(t.value,e),{after:X(),completes:!1}}}#dt(t,e,n,s,a){let o=t?this.#I(t,s):{whenTrue:s,whenFalse:X()},h=t?t.constant:F(!0),m=a&&!Nt(h);a&&!m&&this.#S.push([se(e),"unreachable statement"]);let d={breaks:[],continues:[]};this.#A.push(d);let x=this.#tt(e,m?o.whenTrue:X(),!0);this.#A.pop();let y=Q(x.after,...d.continues);for(let P of n)y=this.#g(P,y);let A=d.breaks.length>0;return{after:Q(o.whenFalse,...d.breaks),completes:a&&(!Ot(h)||A)}}#ft(t,e){let n=e;for(let s of t.declarators){let a=s.symbol;a&&(n=Ue(n,a.index));let o=s.init;if(o){if(o.kind==="ArrayInitializer")for(let h of o.elements)n=this.#g(h,n);else n=this.#g(o,n);a&&(n=bt(n,a.index))}}return n}#I(t,e){if(Ot(t.constant))return{whenTrue:e,whenFalse:X()};if(Nt(t.constant))return{whenTrue:X(),whenFalse:e};if(t.kind==="Parenthesized")return this.#I(t.expression,e);if(t.kind==="Unary"&&t.operator==="!"){let s=this.#I(t.operand,e);return{whenTrue:s.whenFalse,whenFalse:s.whenTrue}}if(t.kind==="Binary"&&t.operator==="&&"){let s=this.#I(t.left,e),a=this.#I(t.right,s.whenTrue);return{whenTrue:a.whenTrue,whenFalse:Q(s.whenFalse,a.whenFalse)}}if(t.kind==="Binary"&&t.operator==="||"){let s=this.#I(t.left,e),a=this.#I(t.right,s.whenFalse);return{whenTrue:Q(s.whenTrue,a.whenTrue),whenFalse:a.whenFalse}}let n=this.#g(t,e);return{whenTrue:n,whenFalse:n}}#pt(t,e,n){return Fe(n,t.index)?n:(this.#d.push([e,`variable ${t.name} might not have been initialized`]),bt(n,t.index))}#g(t,e){switch(t.kind){case"Literal":case"This":return e;case"Name":return t.symbol?.kind==="local"&&!t.constant?this.#pt(t.symbol,t.pos,e):e;case"Parenthesized":return this.#g(t.expression,e);case"FieldAccess":return this.#g(t.target,e);case"MethodCall":{let n=t.target?this.#g(t.target,e):e;for(let s of t.args)n=this.#g(s,n);return n}case"Unary":if(t.operator==="!"){let n=this.#I(t,e);return Q(n.whenTrue,n.whenFalse)}return this.#g(t.operand,e);case"IncDec":return this.#g(t.operand,e);case"Cast":return this.#g(t.expression,e);case"ArrayAccess":return this.#g(t.index,this.#g(t.array,e));case"NewArray":{let n=t.length?this.#g(t.length,e):e;for(let s of t.initializer?.elements??[])n=this.#g(s,n);return n}case"Binary":{if(t.operator==="&&"||t.operator==="||"){let n=this.#I(t,e);return Q(n.whenTrue,n.whenFalse)}return this.#g(t.right,this.#g(t.left,e))}case"Assignment":{let n=pt(t.target);if(n.kind==="Name"&&n.symbol?.kind==="local"){let s=t.operator==="="?e:this.#pt(n.symbol,n.pos,e);return s=this.#g(t.value,s),bt(s,n.symbol.index)}return this.#g(t.value,this.#g(t.target,e))}}}};function Pt(i,t){let e=ft(i);return t.tag==="char"&&e!==void 0?It(e):t.tag==="int"&&e!==void 0?D(e):i}function Je(i,t,e){if(i==="+"&&(t.kind==="string"||e.kind==="string"))return Rt(dt(t)+dt(e));let n=ft(t),s=ft(e);if(n!==void 0&&s!==void 0){switch(i){case"+":return D(n+s);case"-":return D(n-s);case"*":return D(Math.imul(n,s));case"/":return s===0?void 0:D(n/s);case"%":return s===0?void 0:D(n%s);case"<<":return D(n<<s);case">>":return D(n>>s);case">>>":return D(n>>>s);case"&":return D(n&s);case"|":return D(n|s);case"^":return D(n^s);case"<":return F(n<s);case">":return F(n>s);case"<=":return F(n<=s);case">=":return F(n>=s);case"==":return F(n===s);case"!=":return F(n!==s)}return}if(t.kind==="boolean"&&e.kind==="boolean"){let a=t.value,o=e.value;switch(i){case"&&":case"&":return F(a&&o);case"||":case"|":return F(a||o);case"^":case"!=":return F(a!==o);case"==":return F(a===o)}return}if(t.kind==="string"&&e.kind==="string"&&(i==="=="||i==="!=")){let a=t.value===e.value;return F(i==="=="?a:!a)}}var r={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,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},L={NONE:0,INT:1,BOOLEAN:2,STRING:3,CHAR:4,CHAR_ARRAY:5,OBJECT:6},z={INT:0,BOOLEAN:1,CHAR:2,STRING:3},xt={};for(let[i,t]of Object.entries(r))xt[t]={name:i,operands:0,pop:0,push:0};var v=(i,t,e,n)=>Object.assign(xt[i],{operands:t,pop:e,push:n});v(r.ICONST,1,0,1);v(r.SCONST,1,0,1);v(r.ACONST_NULL,0,0,1);v(r.LOAD,1,0,1);v(r.STORE,1,1,0);v(r.POP,0,1,0);v(r.DUP,0,1,2);v(r.DUP_X1,0,2,3);v(r.DUP_X2,0,3,4);v(r.DUP2,0,2,4);for(let i of[r.IADD,r.ISUB,r.IMUL,r.IDIV,r.IREM,r.ISHL,r.ISHR,r.IUSHR,r.IAND,r.IOR,r.IXOR])v(i,0,2,1);for(let i of[r.ICMPEQ,r.ICMPNE,r.ICMPLT,r.ICMPLE,r.ICMPGT,r.ICMPGE,r.ACMPEQ,r.ACMPNE])v(i,0,2,1);for(let i of[r.INEG,r.INOT,r.BNOT,r.I2C,r.TOSTRING_INT,r.TOSTRING_BOOL,r.TOSTRING_REF,r.TOSTRING_CHAR])v(i,0,1,1);v(r.JUMP,1,0,0);v(r.JUMP_IF_FALSE,1,1,0);v(r.JUMP_IF_TRUE,1,1,0);v(r.IINC,2,0,0);v(r.SCONCAT,0,2,1);v(r.PRINT,3,0,0);v(r.RETURN,0,0,0);v(r.RETURN_VALUE,0,1,0);v(r.INVOKE,1,0,0);v(r.NEWARRAY,1,1,1);v(r.ALOAD,2,2,1);v(r.ASTORE,2,3,0);v(r.ARRAYLENGTH,1,1,1);v(r.STR_LENGTH,1,1,1);v(r.STR_CHARAT,1,2,1);v(r.STR_EQUALS,1,2,1);v(r.GETSTATIC,1,0,1);v(r.PUTSTATIC,1,1,0);v(r.GETFIELD,1,1,1);v(r.PUTFIELD,1,2,0);v(r.NEW,0,0,1);var _e=new Set([r.ARRAYLENGTH,r.STR_LENGTH,r.STR_CHARAT,r.STR_EQUALS]),M=class extends Error{constructor(t){super(`invalid bytecode: ${t}`),this.name="BytecodeError"}};function ie(i,t){let e=i.code,n=new Set;for(let h=0;h<e.length;){let m=xt[e[h]];if(!m)throw new M(`unknown opcode ${e[h]} at ${h}`);if(n.add(h),h+=1+m.operands,h>e.length)throw new M("truncated instruction at end")}let s=new Map,a=[[0,0]],o=0;for(;a.length;){let[h,m]=a.pop(),d=h,x=m;for(;;){if(!n.has(d))throw new M(`control reaches non-instruction offset ${d}`);let y=s.get(d);if(y!==void 0){if(y!==x)throw new M(`stack height ${x} != ${y} at merge ${d}`);break}s.set(d,x);let A=e[d],P=xt[A],k=P.pop,C=P.push;if(A===r.PRINT&&(k=e[d+3]===L.NONE?0:1),A===r.INVOKE){let l=t.methods[e[d+1]];if(!l)throw new M(`call to unknown method ${e[d+1]} at ${d}`);k=l.argCount,C=l.returnsValue?1:0}if(x<k)throw new M(`stack underflow at ${d} (${P.name})`);if(x=x-k+C,o=Math.max(o,x),A===r.LOAD||A===r.STORE||A===r.IINC){let l=e[d+1];if(l<0||l>=i.maxLocals)throw new M(`bad local slot ${l} at ${d}`)}if(A===r.SCONST&&(e[d+1]<0||e[d+1]>=t.strings.length))throw new M(`bad string index at ${d}`);if(A===r.GETSTATIC||A===r.PUTSTATIC||A===r.GETFIELD||A===r.PUTFIELD){let l=A<=r.PUTSTATIC?t.staticFieldIsReference?.length??0:t.instanceFieldIsReference?.length??0;if(e[d+1]<0||e[d+1]>=l)throw new M(`bad field index at ${d}`)}let u=A===r.ALOAD||A===r.ASTORE?e[d+2]:_e.has(A)?e[d+1]:null;if(u!==null&&(u<-1||u>=t.messages.length))throw new M(`bad message index at ${d}`);if(A===r.RETURN||A===r.RETURN_VALUE){if(A===r.RETURN_VALUE!==i.returnsValue)throw new M(`wrong return kind at ${d}`);if(x!==0)throw new M(`return with non-empty stack at ${d}`);break}let g=d+1+P.operands;if(A===r.JUMP||A===r.JUMP_IF_FALSE||A===r.JUMP_IF_TRUE){let l=e[d+1];if(!n.has(l))throw new M(`jump to ${l} at ${d}`);if(a.push([l,x]),A===r.JUMP)break}if(g>=e.length)throw new M(`falls off the end at ${d}`);d=g}}return o}function ae(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}function ce(i,t){let e=new Lt(t,i.mainClass.name),n=i.methods.map(y=>e.method(y)),s=i.fields,a=s.filter(y=>y.isStatic&&y.declarator.init),o=a.length?n.push(e.initializer("<clinit>",a))-1:-1,h=i.main,m=h.isStatic?-1:n.push(e.initializer("<init>",s.filter(y=>!y.isStatic&&y.declarator.init)))-1,d=n.push(e.launcher(h,o,m))-1,x={version:3,className:i.mainClass.name,strings:e.strings,messages:e.messages,methods:n,staticFieldIsReference:s.filter(y=>y.isStatic).map(y=>kt(y.type)),instanceFieldIsReference:s.filter(y=>!y.isStatic).map(y=>kt(y.type)),entry:d};for(let y of n)y.maxStack=ie(y,x);return x}var W=class{pc=-1;uses=[]};function Tt(i){switch(i.tag){case"int":return z.INT;case"boolean":return z.BOOLEAN;case"char":return z.CHAR;case"string":return z.STRING;default:throw new Error(`codegen: array of ${I(i)}`)}}var oe=["int","byte/boolean","char","object"];function Z(i){let t=i;for(;t.kind==="Parenthesized";)t=t.expression;return t}var Lt=class{strings=[];messages=[];#T=new Map;#k=new Map;#u;#f;#y=[];#s=[];#p=-1;#r=[];constructor(t,e){this.#u=t,this.#f=e}#e(t){return`${this.#f}.${t.name}(${t.params.map(I).join(", ")})`}initializer(t,e){this.#y=[],this.#s=[],this.#p=-1;for(let s of e){let a=s.declarator.init;this.#o(s.declarator.pos),s.isStatic||this.#t(r.LOAD,0),a.kind==="ArrayInitializer"?this.#F(a):(this.#l(a,!0),this.#U(s.type,a)),this.#t(s.isStatic?r.PUTSTATIC:r.PUTFIELD,s.index)}this.#t(r.RETURN);let n=t==="<init>";return{className:this.#f,name:t,display:`${this.#f}.${t}()`,file:this.#u.name,argCount:n?1:0,returnsValue:!1,code:Int32Array.from(this.#y),lines:Int32Array.from(this.#s),maxLocals:1,maxStack:0}}launcher(t,e,n){let s=[];return e>=0&&s.push(r.INVOKE,e),t.isStatic||s.push(r.NEW,r.DUP,r.INVOKE,n),t.params.length&&s.push(r.ICONST,0,r.NEWARRAY,z.STRING),s.push(r.INVOKE,t.index,r.RETURN),{className:this.#f,name:"<launch>",display:"<launch>",file:this.#u.name,argCount:0,returnsValue:!1,hidden:!0,code:Int32Array.from(s),lines:Int32Array.from([]),maxLocals:1,maxStack:0}}method(t){let e=t.declaration.body;this.#y=[],this.#s=[],this.#p=-1,this.#r=[];for(let n of e.statements)this.#d(n);return t.returnType.tag==="void"&&(this.#o(e.end-1),this.#t(r.RETURN)),{className:this.#f,name:t.name,display:this.#e(t),file:this.#u.name,argCount:t.params.length+(t.isStatic?0:1),returnsValue:t.returnType.tag!=="void",code:Int32Array.from(this.#y),lines:Int32Array.from(this.#s),maxLocals:Math.max(1,t.maxSlots),maxStack:0}}#t(...t){for(let e of t)this.#y.push(e)}#o(t){let{line:e}=gt(this.#u,t);e!==this.#p&&(this.#p=e,this.#s.push(this.#y.length,e))}#a(t,e){this.#t(t,-1),e.uses.push(this.#y.length-1),e.pc>=0&&(this.#y[this.#y.length-1]=e.pc)}#b(t){t.pc=this.#y.length;for(let e of t.uses)this.#y[e]=t.pc;this.#p=-1}#x(t){let e=this.#T.get(t);return e===void 0&&(e=this.strings.length,this.strings.push(t),this.#T.set(t,e)),e}#c(t){switch(t.kind){case"int":case"char":this.#t(r.ICONST,t.value);return;case"boolean":this.#t(r.ICONST,t.value?1:0);return;case"string":this.#t(r.SCONST,this.#x(t.value));return}}#i(t){let e=Z(t);switch(e.kind){case"Name":return e.symbol?.kind==="field"?this.#E(e.symbol):e.symbol?.kind!=="local"?null:e.symbol.parameter!==void 0?`<parameter${e.symbol.parameter}>`:`<local${e.symbol.slot}>`;case"FieldAccess":return e.fieldSymbol?this.#E(e.fieldSymbol):null;case"ArrayAccess":{let n=this.#i(e.array);if(n===null)return null;let s=Z(e.index),a=e.index.constant&&(e.index.constant.kind==="int"||e.index.constant.kind==="char")?String(e.index.constant.value):s.kind==="Name"?this.#i(s)??"...":"...";return`${n}[${a}]`}case"Cast":return this.#i(e.expression);default:return null}}#E(t){return t.isStatic?`${this.#f}.${t.name}`:`this.${t.name}`}#S(t,e){let n=Z(e),s=t;if(n.kind==="MethodCall"&&n.method)s+=` because the return value of "${this.#e(n.method)}" is null`;else{let o=this.#i(e);o!==null&&(s+=` because "${o}" is null`)}let a=this.#k.get(s);return a===void 0&&(a=this.messages.length,this.messages.push(s),this.#k.set(s,a)),a}#d(t){switch(t.kind){case"Block":for(let e of t.statements)this.#d(e);return;case"EmptyStatement":return;case"LocalVariableDeclaration":for(let e of t.declarators)e.init&&(this.#o(e.pos),e.init.kind==="ArrayInitializer"?this.#F(e.init):this.#l(e.init,!0),this.#t(r.STORE,e.symbol.slot));return;case"ExpressionStatement":this.#o(t.start),this.#l(t.expression,!1);return;case"IfStatement":{let e=t.condition.constant;if(e&&e.kind==="boolean"){e.value?this.#d(t.then):t.otherwise&&this.#d(t.otherwise);return}this.#o(t.start);let n=new W;if(this.#n(t.condition,n,!1),this.#d(t.then),t.otherwise){let s=new W;this.#a(r.JUMP,s),this.#b(n),this.#d(t.otherwise),this.#b(s)}else this.#b(n);return}case"WhileStatement":this.#A(t.start,t.condition,t.body,[]);return;case"ForStatement":if(t.init&&!Array.isArray(t.init))this.#d(t.init);else for(let e of t.init??[])this.#o(e.start),this.#l(e,!1);this.#A(t.start,t.condition,t.body,t.update);return;case"BreakStatement":this.#o(t.start),this.#a(r.JUMP,this.#r[this.#r.length-1].breakLabel);return;case"ContinueStatement":this.#o(t.start),this.#a(r.JUMP,this.#r[this.#r.length-1].continueLabel);return;case"ReturnStatement":this.#o(t.start),t.value?(this.#l(t.value,!0),this.#t(r.RETURN_VALUE)):this.#t(r.RETURN);return}}#A(t,e,n,s){let a=e?.constant;if(a&&a.kind==="boolean"&&!a.value)return;let o=new W,h=new W,m=new W;this.#b(o),this.#o(t),e&&!a&&this.#n(e,m,!1),this.#r.push({breakLabel:m,continueLabel:h}),this.#d(n),this.#r.pop(),this.#b(h);for(let d of s)this.#o(d.start),this.#l(d,!1);this.#a(r.JUMP,o),this.#b(m)}#n(t,e,n){let s=t.constant;if(s&&s.kind==="boolean"){s.value===n&&this.#a(r.JUMP,e);return}if(t.kind==="Parenthesized")return this.#n(t.expression,e,n);if(t.kind==="Unary"&&t.operator==="!")return this.#n(t.operand,e,!n);if(t.kind==="Binary"&&(t.operator==="&&"||t.operator==="||")){if(t.operator==="&&"!==n)this.#n(t.left,e,n),this.#n(t.right,e,n);else{let o=new W;this.#n(t.left,o,!n),this.#n(t.right,e,n),this.#h(o)}return}this.#l(t,!0),this.#a(n?r.JUMP_IF_TRUE:r.JUMP_IF_FALSE,e)}#h(t){t.pc=this.#y.length;for(let e of t.uses)this.#y[e]=t.pc}#l(t,e){if(t.constant){e&&this.#c(t.constant);return}switch(t.kind){case"Literal":if(t.literalKind!=="null")throw new Error(`codegen: unexpected literal ${t.literalKind}`);e&&this.#t(r.ACONST_NULL);return;case"Name":{if(t.symbol?.kind==="field"){if(!e)return;t.symbol.isStatic?this.#t(r.GETSTATIC,t.symbol.index):this.#t(r.LOAD,0,r.GETFIELD,t.symbol.index);return}if(t.symbol?.kind!=="local")throw new Error("codegen: unresolved name");e&&this.#t(r.LOAD,t.symbol.slot);return}case"This":e&&this.#t(r.LOAD,0);return;case"Parenthesized":this.#l(t.expression,e);return;case"Unary":this.#l(t.operand,!0),t.operator==="-"?this.#t(r.INEG):t.operator==="~"?this.#t(r.INOT):t.operator==="!"&&this.#t(r.BNOT),e||this.#t(r.POP);return;case"Cast":this.#l(t.expression,!0),t.type?.tag==="char"&&t.expression.type?.tag!=="char"&&this.#t(r.I2C),e||this.#t(r.POP);return;case"IncDec":this.#R(t,e);return;case"Binary":{if(t.operator==="&&"||t.operator==="||"){let n=new W,s=new W;this.#n(t,n,!1),this.#t(r.ICONST,1),this.#a(r.JUMP,s),this.#h(n),this.#t(r.ICONST,0),this.#h(s)}else if(t.type?.tag==="string")this.#v(t.left),this.#v(t.right),this.#t(r.SCONCAT);else{this.#l(t.left,!0),this.#l(t.right,!0);let n=kt(t.left.type)||kt(t.right.type);this.#t(le(t.operator,n))}e||this.#t(r.POP);return}case"Assignment":this.#z(t,e);return;case"ArrayAccess":this.#l(t.array,!0),this.#l(t.index,!0),this.#P(t.type,t.array),e||this.#t(r.POP);return;case"NewArray":t.initializer?this.#F(t.initializer):(this.#l(t.length,!0),this.#t(r.NEWARRAY,Tt(t.type.element))),e||this.#t(r.POP);return;case"FieldAccess":if(t.fieldSymbol){let n=t.fieldSymbol;n.isStatic?(Z(t.target).kind==="This"&&this.#t(r.LOAD,0,r.POP),e&&this.#t(r.GETSTATIC,n.index)):(this.#l(t.target,!0),this.#t(r.GETFIELD,n.index),e||this.#t(r.POP));return}if(t.field!=="length")throw new Error("codegen: field access used as a value");this.#l(t.target,!0),this.#t(r.ARRAYLENGTH,this.#S("Cannot read the array length",t.target)),e||this.#t(r.POP);return;case"MethodCall":this.#H(t,e);return}}#P(t,e){let n=Tt(t);this.#t(r.ALOAD,n,this.#S(`Cannot load from ${oe[n]} array`,e))}#$(t,e){let n=Tt(t);this.#t(r.ASTORE,n,this.#S(`Cannot store to ${oe[n]} array`,e))}#F(t){let e=t.elementType,n=Tt(e);this.#t(r.ICONST,t.elements.length,r.NEWARRAY,n),t.elements.forEach((s,a)=>{this.#t(r.DUP,r.ICONST,a),this.#l(s,!0),this.#U(e,s),this.#t(r.ASTORE,n,-1)})}#U(t,e){t.tag==="char"&&e.type?.tag!=="char"&&!e.constant&&this.#t(r.I2C)}#H(t,e){if(t.print){let n=L.NONE;t.print.argument!=="none"&&(this.#l(t.args[0],!0),n={int:L.INT,char:L.CHAR,boolean:L.BOOLEAN,string:L.STRING,"char-array":L.CHAR_ARRAY,object:L.OBJECT}[t.print.argument]),this.#t(r.PRINT,t.print.stream==="err"?1:0,t.print.newline?1:0,n);return}if(t.method){let n=t.target?Z(t.target):null;t.method.isStatic?n?.kind==="This"&&this.#t(r.LOAD,0,r.POP):n?this.#l(n,!0):this.#t(r.LOAD,0);for(let s of t.args)this.#l(s,!0);this.#t(r.INVOKE,t.method.index),!e&&t.method.returnType.tag!=="void"&&this.#t(r.POP);return}if(t.stringMethod){this.#l(t.target,!0);for(let n of t.args)this.#l(n,!0);switch(t.stringMethod){case"length":this.#t(r.STR_LENGTH,this.#S(\'Cannot invoke "String.length()"\',t.target));break;case"charAt":this.#t(r.STR_CHARAT,this.#S(\'Cannot invoke "String.charAt(int)"\',t.target));break;case"equals":this.#t(r.STR_EQUALS,this.#S(\'Cannot invoke "String.equals(Object)"\',t.target));break}e||this.#t(r.POP);return}throw new Error(`codegen: unresolved call to ${t.name}`)}#R(t,e){let n=Z(t.operand),s=t.operator==="++"?1:-1,a=t.type?.tag==="char";if(n.kind==="Name"&&n.symbol?.kind==="local"){let h=n.symbol.slot;if(!a){e&&!t.prefix&&this.#t(r.LOAD,h),this.#t(r.IINC,h,s),e&&t.prefix&&this.#t(r.LOAD,h);return}this.#t(r.LOAD,h),e&&!t.prefix&&this.#t(r.DUP),this.#t(r.ICONST,s,r.IADD,r.I2C),e&&t.prefix&&this.#t(r.DUP),this.#t(r.STORE,h);return}let o=this.#O(n);if(o){o.isStatic?(this.#t(r.GETSTATIC,o.index),e&&!t.prefix&&this.#t(r.DUP),this.#t(r.ICONST,s,r.IADD),a&&this.#t(r.I2C),e&&t.prefix&&this.#t(r.DUP),this.#t(r.PUTSTATIC,o.index)):(this.#D(n),this.#t(r.DUP,r.GETFIELD,o.index),e&&!t.prefix&&this.#t(r.DUP_X1),this.#t(r.ICONST,s,r.IADD),a&&this.#t(r.I2C),e&&t.prefix&&this.#t(r.DUP_X1),this.#t(r.PUTFIELD,o.index));return}if(n.kind!=="ArrayAccess")throw new Error("codegen: ++/-- target");this.#l(n.array,!0),this.#l(n.index,!0),this.#t(r.DUP2),this.#P(t.type,n.array),e&&!t.prefix&&this.#t(r.DUP_X2),this.#t(r.ICONST,s,r.IADD),a&&this.#t(r.I2C),e&&t.prefix&&this.#t(r.DUP_X2),this.#$(t.type,n.array)}#z(t,e){let n=Z(t.target),s=t.target.type,a=()=>{if(t.operator==="="){this.#l(t.value,!0),this.#U(s,t.value);return}if(s.tag==="string"){this.#t(r.TOSTRING_REF),this.#v(t.value),this.#t(r.SCONCAT);return}this.#l(t.value,!0),this.#t(le(t.operator.slice(0,-1),!1)),s.tag==="char"&&this.#t(r.I2C)};if(n.kind==="Name"&&n.symbol?.kind==="local"){t.operator!=="="&&this.#t(r.LOAD,n.symbol.slot),a(),e&&this.#t(r.DUP),this.#t(r.STORE,n.symbol.slot);return}let o=this.#O(n);if(o){o.isStatic?(t.operator!=="="&&this.#t(r.GETSTATIC,o.index),a(),e&&this.#t(r.DUP),this.#t(r.PUTSTATIC,o.index)):(this.#D(n),t.operator!=="="&&this.#t(r.DUP,r.GETFIELD,o.index),a(),e&&this.#t(r.DUP_X1),this.#t(r.PUTFIELD,o.index));return}if(n.kind!=="ArrayAccess")throw new Error("codegen: assignment target");this.#l(n.array,!0),this.#l(n.index,!0),t.operator!=="="&&(this.#t(r.DUP2),this.#P(s,n.array)),a(),e&&this.#t(r.DUP_X2),this.#$(s,n.array)}#O(t){if(t.kind==="Name"&&t.symbol?.kind==="field")return t.symbol;if(t.kind==="FieldAccess")return t.fieldSymbol}#D(t){t.kind==="FieldAccess"?this.#l(t.target,!0):this.#t(r.LOAD,0)}#v(t){if(t.constant){this.#t(r.SCONST,this.#x(dt(t.constant)));return}switch(this.#l(t,!0),t.type?.tag){case"int":this.#t(r.TOSTRING_INT);return;case"char":this.#t(r.TOSTRING_CHAR);return;case"boolean":this.#t(r.TOSTRING_BOOL);return;case"string":case"null":case"array":case"class":this.#t(r.TOSTRING_REF);return;default:throw new Error(`codegen: string conversion of ${t.type?.tag}`)}}};function kt(i){return i!==void 0&&(i.tag==="string"||i.tag==="null"||i.tag==="array"||i.tag==="class")}function le(i,t){switch(i){case"+":return r.IADD;case"-":return r.ISUB;case"*":return r.IMUL;case"/":return r.IDIV;case"%":return r.IREM;case"<<":return r.ISHL;case">>":return r.ISHR;case">>>":return r.IUSHR;case"&":return r.IAND;case"|":return r.IOR;case"^":return r.IXOR;case"<":return r.ICMPLT;case"<=":return r.ICMPLE;case">":return r.ICMPGT;case">=":return r.ICMPGE;case"==":return t?r.ACMPEQ:r.ICMPEQ;case"!=":return t?r.ACMPNE:r.ICMPNE}throw new Error(`codegen: operator ${i}`)}var V=class{value;constructor(t){this.value=t}},mt=class{kind;data;hash;constructor(t,e,n){this.kind=t,this.data=e,this.hash=n}},St=class{className;fields;hash;constructor(t,e,n){this.className=t,this.fields=e,this.hash=n}};function $t(i){return i instanceof mt?Ge(i):`${i.className}@${i.hash.toString(16)}`}var Be=["[I","[Z","[C","[Ljava.lang.String;"];function Ge(i){return`${Be[i.kind]}@${i.hash.toString(16)}`}var wt=class{#T=new Map;intern(t){let e=this.#T.get(t);return e||(e=new V(t),this.#T.set(t,e)),e}},At=class{#T=625341585;next(){let t=this.#T;return t^=t<<13,t^=t>>>17,t^=t<<5,this.#T=t>>>0,this.#T&2147483647||1}};var he=65536;function je(i,t){switch(i){case z.INT:return new Int32Array(t);case z.BOOLEAN:return new Uint8Array(t);case z.CHAR:return new Uint16Array(t);default:return new Array(t).fill(null)}}var Ft=(i,t)=>`Index ${i} out of bounds for length ${t}`;function He(i){let t="";for(let e=0;e<i.length;e+=8192)t+=String.fromCharCode(...i.subarray(e,e+8192));return t}function ue(i,t,e,n){let s=new wt,a=new At,o=i.strings.map(f=>s.intern(f)),h=i.messages,m=i.methods,d=globalThis.performance,x=e.maxDurationMs>0?d.now()+e.maxDurationMs:1/0,y=f=>({method:f,code:f.code,locals:new Array(f.maxLocals).fill(0),stack:new Array(f.maxStack+1).fill(0),sp:0,pc:0}),A=i.staticFieldIsReference.map(f=>f?null:0),P=i.instanceFieldIsReference.map(f=>f?null:0),k=y(m[i.entry]),C=[k],u=k.code,g=k.locals,l=k.stack,c=0,p=0,U=0,ct=Math.min(he,e.maxInstructions+1),tt=0,O=0,et=(f,S)=>({outcome:{kind:"resource-limit",limit:f,message:S},instructions:Math.min(U,e.maxInstructions)}),w=()=>{k.pc=p;let f=[];for(let S=C.length-1;S>=0;S--){let R=C[S];R.method.hidden||f.push({className:R.method.className,method:R.method.name,file:R.method.file,line:ae(R.method,R.pc)})}return f},E=(f,S)=>{let R={className:f,message:S,frames:w()};return C.some(J=>J.method.name==="<clinit>")&&(R={className:"java.lang.ExceptionInInitializerError",message:null,frames:[],cause:R}),{outcome:{kind:"exception",throwable:R},instructions:U}},N=f=>E("java.lang.NullPointerException",f>=0?h[f]:null),nt=(f,S)=>{if(tt+S.length>e.maxOutputChars){let R=e.maxOutputChars-tt;return R>0&&t(f,S.slice(0,R)),et("output",`the program printed more than ${e.maxOutputChars.toLocaleString("en-US")} characters`)}return tt+=S.length,U+=S.length>>>6,S&&t(f,S),null};for(;;){if(++U>=ct){if(U>e.maxInstructions)return et("instructions",`the program ran more than ${e.maxInstructions.toLocaleString("en-US")} steps`);if(x!==1/0&&d.now()>x)return et("time",`the program ran longer than ${e.maxDurationMs} ms`);ct=Math.min(U+he,e.maxInstructions+1),n?.()}switch(u[p]){case r.ICONST:l[c++]=u[p+1],p+=2;break;case r.SCONST:l[c++]=o[u[p+1]],p+=2;break;case r.ACONST_NULL:l[c++]=null,p+=1;break;case r.LOAD:l[c++]=g[u[p+1]],p+=2;break;case r.STORE:g[u[p+1]]=l[--c],p+=2;break;case r.POP:c--,p+=1;break;case r.DUP:l[c]=l[c-1],c++,p+=1;break;case r.DUP_X1:{let f=l[c-1];l[c-1]=l[c-2],l[c-2]=f,l[c++]=f,p+=1;break}case r.DUP_X2:{let f=l[c-1];l[c-1]=l[c-2],l[c-2]=l[c-3],l[c-3]=f,l[c++]=f,p+=1;break}case r.DUP2:l[c]=l[c-2],l[c+1]=l[c-1],c+=2,p+=1;break;case r.IADD:{let f=l[--c];l[c-1]=l[c-1]+f|0,p+=1;break}case r.ISUB:{let f=l[--c];l[c-1]=l[c-1]-f|0,p+=1;break}case r.IMUL:{let f=l[--c];l[c-1]=Math.imul(l[c-1],f),p+=1;break}case r.IDIV:{let f=l[--c];if(f===0)return E("java.lang.ArithmeticException","/ by zero");l[c-1]=l[c-1]/f|0,p+=1;break}case r.IREM:{let f=l[--c];if(f===0)return E("java.lang.ArithmeticException","/ by zero");l[c-1]=l[c-1]%f|0,p+=1;break}case r.INEG:l[c-1]=-l[c-1]|0,p+=1;break;case r.ISHL:{let f=l[--c];l[c-1]=l[c-1]<<f,p+=1;break}case r.ISHR:{let f=l[--c];l[c-1]=l[c-1]>>f,p+=1;break}case r.IUSHR:{let f=l[--c];l[c-1]=l[c-1]>>>f|0,p+=1;break}case r.IAND:{let f=l[--c];l[c-1]=l[c-1]&f,p+=1;break}case r.IOR:{let f=l[--c];l[c-1]=l[c-1]|f,p+=1;break}case r.IXOR:{let f=l[--c];l[c-1]=l[c-1]^f,p+=1;break}case r.INOT:l[c-1]=~l[c-1],p+=1;break;case r.BNOT:l[c-1]=l[c-1]^1,p+=1;break;case r.I2C:l[c-1]=l[c-1]&65535,p+=1;break;case r.ICMPEQ:case r.ACMPEQ:{let f=l[--c];l[c-1]=l[c-1]===f?1:0,p+=1;break}case r.ICMPNE:case r.ACMPNE:{let f=l[--c];l[c-1]=l[c-1]!==f?1:0,p+=1;break}case r.ICMPLT:{let f=l[--c];l[c-1]=l[c-1]<f?1:0,p+=1;break}case r.ICMPLE:{let f=l[--c];l[c-1]=l[c-1]<=f?1:0,p+=1;break}case r.ICMPGT:{let f=l[--c];l[c-1]=l[c-1]>f?1:0,p+=1;break}case r.ICMPGE:{let f=l[--c];l[c-1]=l[c-1]>=f?1:0,p+=1;break}case r.JUMP:p=u[p+1];break;case r.JUMP_IF_FALSE:p=l[--c]===0?u[p+1]:p+2;break;case r.JUMP_IF_TRUE:p=l[--c]!==0?u[p+1]:p+2;break;case r.IINC:{let f=u[p+1];g[f]=g[f]+u[p+2]|0,p+=3;break}case r.TOSTRING_INT:l[c-1]=new V(String(l[c-1])),p+=1;break;case r.TOSTRING_CHAR:l[c-1]=new V(String.fromCharCode(l[c-1])),p+=1;break;case r.TOSTRING_BOOL:l[c-1]=new V(l[c-1]?"true":"false"),p+=1;break;case r.TOSTRING_REF:{let f=l[c-1];f===null?l[c-1]=new V("null"):f instanceof V||(l[c-1]=new V($t(f))),p+=1;break}case r.SCONCAT:{let f=l[--c],S=l[c-1],R=S.value.length+f.value.length;if(R>e.maxStringLength)return et("memory",`the program built a String longer than ${e.maxStringLength.toLocaleString("en-US")} characters`);U+=R>>>6,l[c-1]=new V(S.value+f.value),p+=1;break}case r.PRINT:{let f=u[p+3],S="";if(f!==L.NONE){let J=l[--c];switch(f){case L.INT:S=String(J);break;case L.CHAR:S=String.fromCharCode(J);break;case L.BOOLEAN:S=J?"true":"false";break;case L.STRING:S=J===null?"null":J.value;break;case L.CHAR_ARRAY:if(J===null)return E("java.lang.NullPointerException",\'Cannot read the array length because "cbuf" is null\');S=He(J.data);break;default:S=J===null?"null":J instanceof V?J.value:$t(J)}}u[p+2]===1&&(S+=`\n`);let R=nt(u[p+1]===1?"stderr":"stdout",S);if(R)return R;p+=4;break}case r.INVOKE:{let f=m[u[p+1]];if(C.length>e.maxCallDepth)return E("java.lang.StackOverflowError",null);k.pc=p,c-=f.argCount,k.sp=c;let S=y(f);for(let R=0;R<f.argCount;R++)S.locals[R]=l[c+R];C.push(S),k=S,u=S.code,g=S.locals,l=S.stack,c=0,p=0;break}case r.RETURN:case r.RETURN_VALUE:{let f=u[p]===r.RETURN_VALUE?l[--c]:void 0;if(C.pop(),!C.length)return{outcome:{kind:"completed"},instructions:U};k=C[C.length-1],u=k.code,g=k.locals,l=k.stack,c=k.sp,p=k.pc+2,f!==void 0&&(l[c++]=f);break}case r.NEWARRAY:{let f=l[c-1];if(f<0)return E("java.lang.NegativeArraySizeException",String(f));if(O+f>e.maxArrayElements)return et("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);O+=f,U+=f>>>4,l[c-1]=new mt(u[p+1],je(u[p+1],f),a.next()),p+=2;break}case r.ALOAD:{let f=l[--c],S=l[c-1];if(S===null)return N(u[p+2]);if(f<0||f>=S.data.length)return E("java.lang.ArrayIndexOutOfBoundsException",Ft(f,S.data.length));l[c-1]=S.data[f],p+=3;break}case r.ASTORE:{let f=l[--c],S=l[--c],R=l[--c];if(R===null)return N(u[p+2]);if(S<0||S>=R.data.length)return E("java.lang.ArrayIndexOutOfBoundsException",Ft(S,R.data.length));R.data[S]=f,p+=3;break}case r.ARRAYLENGTH:{let f=l[c-1];if(f===null)return N(u[p+1]);l[c-1]=f.data.length,p+=2;break}case r.STR_LENGTH:{let f=l[c-1];if(f===null)return N(u[p+1]);l[c-1]=f.value.length,p+=2;break}case r.STR_CHARAT:{let f=l[--c],S=l[c-1];if(S===null)return N(u[p+1]);if(f<0||f>=S.value.length)return E("java.lang.StringIndexOutOfBoundsException",Ft(f,S.value.length));l[c-1]=S.value.charCodeAt(f),p+=2;break}case r.STR_EQUALS:{let f=l[--c],S=l[c-1];if(S===null)return N(u[p+1]);l[c-1]=f instanceof V&&f.value===S.value?1:0,p+=2;break}case r.GETSTATIC:l[c++]=A[u[p+1]],p+=2;break;case r.PUTSTATIC:A[u[p+1]]=l[--c],p+=2;break;case r.GETFIELD:l[c-1]=l[c-1].fields[u[p+1]],p+=2;break;case r.PUTFIELD:{let f=l[--c];l[--c].fields[u[p+1]]=f,p+=2;break}case r.NEW:l[c++]=new St(i.className,P.slice(),a.next()),p+=1;break;default:throw new Error(`interpreter: unknown opcode ${u[p]} at ${p}`)}}}var de=i=>i.message===null?i.className:`${i.className}: ${i.message}`;function fe(i){let t=[`Exception in thread "main" ${de(i)}`],e=n=>{for(let s of n.frames.slice(0,1024))t.push(` at ${s.className}.${s.method}(${s.file}:${s.line})`)};e(i);for(let n=i.cause;n;n=n.cause)t.push(`Caused by: ${de(n)}`),e(n);return t.join(`\n`)+`\n`}var pe={maxFiles:32,maxSourceChars:5e5,maxNestingDepth:200,maxExpressionDepth:1e3,maxInstructions:2e8,maxOutputChars:1e6,maxStringLength:1e7,maxArrayElements:16e6,maxCallDepth:5e4,maxDurationMs:0},Et=()=>globalThis.performance.now();function ze(i,t){let e=Object.keys(i);return t&&t in i?t:"Main.java"in i?"Main.java":e.find(n=>n.endsWith(".java"))??e[0]??"Main.java"}function We(i,t={}){let e=Et(),n={...pe,...t.limits},s=ze(i,t.entry),a=new yt,o=i[s]??"",h=Ut(s,o),m=new Map([[s,h]]),d=P=>({program:P,diagnostics:a.items,entry:s,diagnosticText:a.items.length?_t(a.items,m):"",compileMs:Et()-e});if(Object.keys(i).length>n.maxFiles)return a.launchError(s,b.limit,`too many files for this engine (limit ${n.maxFiles})`),d(null);if(!(s in i))return a.launchError(s,b.noMain,`file not found: ${s}`),d(null);if(o.length>n.maxSourceChars)return a.launchError(s,b.limit,`${s} is too large for this engine (limit ${n.maxSourceChars.toLocaleString("en-US")} characters)`),d(null);let x=jt(o);if(x.errors.length){for(let P of x.errors)a.error(h,P.offset,"lex",P.code,P.message);return d(null)}let y=zt(s,x.tokens,n);if(y.error)return y.error.code==="no-class"?a.launchError(s,b.noMain,y.error.message):a.error(h,y.error.offset,"parse",y.error.code,y.error.message),d(null);let A=re(y.unit,h,a);return!A||a.hasErrors?d(null):d(ce(A,h))}var Ke={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."};function Ye(i,t={}){let e={...pe,...t.limits},n="",s="",a=(y,A)=>{y==="stdout"?n+=A:s+=A,t.onOutput?.(y,A)},o=Et(),{outcome:h,instructions:m}=ue(i,a,e,t.onCheckpoint),d=Et()-o,x={stdout:n,diagnostics:[],instructions:m,compileMs:t.compileMs??0,runMs:d};switch(h.kind){case"completed":return{...x,status:"success",stderr:s,exitCode:0};case"exception":{let y=fe(h.throwable);return{...x,status:"runtime-error",stderr:s+y,errorText:y,exitCode:1}}case"resource-limit":{let y=`Stopped: ${h.message} (limit of this in-browser Java engine).\n`;return{...x,status:"resource-limit",stderr:s+y,errorText:y,hint:Ke[h.limit],exitCode:1}}}}function me(i,t={}){let e=We(i,t);return e.program?Ye(e.program,{...t,compileMs:e.compileMs}):{status:"compile-error",stdout:"",stderr:e.diagnosticText,errorText:e.diagnosticText,diagnostics:e.diagnostics,exitCode:1,instructions:0,compileMs:e.compileMs,runMs:0}}var ge="0.3.0";var Xe=8192,be=16;function xe(i,t={}){let e=t.now??(()=>globalThis.performance.now()),n=[],s=0,a=0,o=0,h=()=>{if(a=e(),!n.length)return;let x=n;n=[],s=0;for(let y of x)i({type:y.type,id:o,text:y.text})},m=(x,y)=>{let A=n[n.length-1];A&&A.type===x?A.text+=y:n.push({type:x,text:y}),s+=y.length,(s>=Xe||e()-a>=be)&&h()},d=x=>{o=x.id,n=[],s=0,a=e();let y=e(),A=x.entry||"Main.java",P=x.files&&Object.keys(x.files).length?{...x.files}:{};A in P||(P[A]=x.code??"");try{let k=()=>{n.length&&e()-a>=be&&h()},C=me(P,{entry:A,limits:t.limits,onOutput:m,onCheckpoint:k});h();let u=e()-y;if(C.status==="success"){i({type:"result",id:x.id,durationMs:u,status:"success"});return}if(C.status==="cancelled")return;i({type:"error",id:x.id,message:(C.errorText??"").replace(/\\n$/,""),hint:C.hint,durationMs:u,status:C.status,...C.diagnostics.length?{diagnostics:C.diagnostics}:{}})}catch(k){h();let C=k instanceof Error?k.message:String(k);i({type:"fatal",id:x.id,message:`Internal error in the Java engine: ${C}`})}};return x=>{switch(x.type){case"init":i({type:"ready",version:"25",interactiveStdin:!1,java:"25",engine:ge});return;case"run":d(x);return;case"stdin-response":return}}}var Te=globalThis,Qe=xe(i=>Te.postMessage(i));Te.onmessage=i=>Qe(i.data);})();\n',n=new class extends e{id=`java`;get source(){return t}get label(){return this.version?`Java ${this.version} (subset)`:`Java`}async editorLanguage(){let{java:e}=await import(`./dist-BKRQwpg6.js`);return e()}};export{n as javaRuntime};
|
|
@@ -1,9 +0,0 @@
|
|
|
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{n as e,r as t,t as n}from"./hints-v5iHTd1l.js";var r=1,i=class{#e=null;#t=null;#n=`module`;#r=null;#i=null;#a=!1;#o=!1;#s=``;#c=new Set;#l=[];#u=null;#d=!1;initPayload(){return{}}get ready(){return this.#a}get interactiveStdin(){return this.#o}get version(){return this.#s}load(e){e&&this.#c.add(e);let n=()=>{e&&this.#c.delete(e)};if(!this.#r){let e=new Promise((e,n)=>{this.#i={resolve:e,reject:n};let r;try{if(typeof Worker>`u`)throw Error(`Worker constructor missing`);let e=new Blob([this.source],{type:`text/javascript`});this.#t=URL.createObjectURL(e),r=new Worker(this.#t,{type:this.#n})}catch(e){this.#i=null,n(new t(`Could not start a Web Worker: ${e.message}`));return}this.#e=r,r.onmessage=t=>{let r=t.data;if(r.type===`ready`){this.#s=r.version,this.#o=r.interactiveStdin===!0,this.#a=!0,this.#i=null,this.#h({phase:`ready`,message:`${this.label} ready`}),e();return}if(r.type===`fatal`&&!this.#a){this.#p(r.message,e,n);return}this.#g(r)},r.onerror=t=>{let r=t.message||`Worker failed to start`;this.#a?this.#u&&this.#v(this.#u,Error(r)):this.#p(r,e,n)},r.postMessage({type:`init`,...this.initPayload()})});this.#r=e,e.catch(()=>{this.#r===e&&(this.#r=null)})}return this.#r.then(n,e=>{throw n(),e})}run(e,t={}){let n,i,a=new Promise((e,t)=>{n=e,i=t}),o,s=new Promise(e=>{o=e}),c={id:r++,code:e,options:t,stdout:``,stderr:``,resolve:n,reject:i,promise:a,started:!1,settled:!1,done:s,markDone:()=>{c.settled=!0,o()}};return this.#l.push(c),this.#y(),a}stop(t){if(t){let n=this.#l.findIndex(e=>e.promise===t);if(n!==-1){this.#v(this.#l.splice(n,1)[0],new e);return}let r=this.#u;if(!r||r.promise!==t||r.settled)return;if(!r.started){this.#v(r,new e);return}}this.#f()}#f(){let t=this.#e!==null,n=this.#i;if(this.#m(),this.#u&&this.#v(this.#u,new e),t){let e=this.load();n&&e.then(n.resolve,n.reject),e.catch(()=>{})}}#p(e,t,n){if(this.#m(),this.#n===`module`){this.#n=`classic`,this.load().then(t,n);return}n(Error(e))}#m(){this.#e?.terminate(),this.#e=null,this.#t&&=(URL.revokeObjectURL(this.#t),null),this.#r=null,this.#i=null,this.#a=!1}#h(e){for(let t of this.#c)t(e)}#g(e){if(e.type===`progress`){this.#h({phase:e.phase,message:e.message});return}let t=this.#u;if(!(!t||!(`id`in e)||e.id!==t.id))switch(e.type){case`stdout`:t.stdout+=e.text,t.options.onStdout?.(e.text);break;case`echo`:t.options.onEcho?.(e.text);break;case`stdin-request`:this.#_(t,e.request);break;case`stderr`:t.stderr+=e.text,t.options.onStderr?.(e.text);break;case`result`:t.resolve({stdout:t.stdout,stderr:t.stderr||void 0,value:e.value,durationMs:Math.round(e.durationMs)}),t.markDone();break;case`error`:case`fatal`:{let r=(t.stderr&&!t.stderr.endsWith(`
|
|
7
|
-
`)?`
|
|
8
|
-
`:``)+e.message+`
|
|
9
|
-
`;t.stderr+=r,t.options.onStderr?.(r);let i={stdout:t.stdout,stderr:t.stderr,hint:`hint`in e?e.hint:void 0,durationMs:Math.round(`durationMs`in e?e.durationMs:0)};`hintAbout`in e&&e.hintAbout===`stdin`&&n.add(i),t.resolve(i),t.markDone();break}}}#_(e,t){let n=this.#e,r=r=>{this.#e===n&&this.#u===e&&n?.postMessage({type:`stdin-response`,request:t,text:r})},i=e.options.onStdinRequest;if(!i){r(null);return}i().then(r,()=>r(null))}#v(e,t){e.reject(t),e.markDone()}async#y(){if(!this.#d){this.#d=!0;try{for(;this.#l.length;){let e=this.#l.shift();this.#u=e;try{if(await this.load(),e.settled)continue;e.started=!0,e.options.onStart?.(),this.#e.postMessage({type:`run`,id:e.id,code:e.code,stdin:e.options.stdin,files:e.options.files,entry:e.options.entry}),await e.done}catch(t){this.#v(e,t)}finally{this.#u=null}}}finally{this.#d=!1}}}};export{i as t};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{d as e,l as t,u as n}from"./element-BYcX5Z6z.js";var r=1,i=class{#e=null;#t=null;#n=`module`;#r=null;#i=null;#a=!1;#o=!1;#s=``;#c=new Set;#l=[];#u=null;#d=!1;initPayload(){return{}}get ready(){return this.#a}get interactiveStdin(){return this.#o}get version(){return this.#s}load(t){t&&this.#c.add(t);let n=()=>{t&&this.#c.delete(t)};if(!this.#r){let t=new Promise((t,n)=>{this.#i={resolve:t,reject:n};let r;try{if(typeof Worker>`u`)throw Error(`Worker constructor missing`);let e=new Blob([this.source],{type:`text/javascript`});this.#t=URL.createObjectURL(e),r=new Worker(this.#t,{type:this.#n})}catch(t){this.#i=null,n(new e(`Could not start a Web Worker: ${t.message}`));return}this.#e=r,r.onmessage=e=>{let r=e.data;if(r.type===`ready`){this.#s=r.version,this.#o=r.interactiveStdin===!0,this.#a=!0,this.#i=null,this.#h({phase:`ready`,message:`${this.label} ready`}),t();return}if(r.type===`fatal`&&!this.#a){this.#p(r.message,t,n);return}this.#g(r)},r.onerror=e=>{let r=e.message||`Worker failed to start`;this.#a?this.#u&&this.#v(this.#u,Error(r)):this.#p(r,t,n)},r.postMessage({type:`init`,...this.initPayload()})});this.#r=t,t.catch(()=>{this.#r===t&&(this.#r=null)})}return this.#r.then(n,e=>{throw n(),e})}run(e,t={}){let n,i,a=new Promise((e,t)=>{n=e,i=t}),o,s=new Promise(e=>{o=e}),c={id:r++,code:e,options:t,stdout:``,stderr:``,resolve:n,reject:i,promise:a,started:!1,settled:!1,done:s,markDone:()=>{c.settled=!0,o()}};return this.#l.push(c),this.#y(),a}stop(e){if(e){let t=this.#l.findIndex(t=>t.promise===e);if(t!==-1){this.#v(this.#l.splice(t,1)[0],new n);return}let r=this.#u;if(!r||r.promise!==e||r.settled)return;if(!r.started){this.#v(r,new n);return}}this.#f()}#f(){let e=this.#e!==null,t=this.#i;if(this.#m(),this.#u&&this.#v(this.#u,new n),e){let e=this.load();t&&e.then(t.resolve,t.reject),e.catch(()=>{})}}#p(e,t,n){if(this.#m(),this.#n===`module`){this.#n=`classic`,this.load().then(t,n);return}n(Error(e))}#m(){this.#e?.terminate(),this.#e=null,this.#t&&=(URL.revokeObjectURL(this.#t),null),this.#r=null,this.#i=null,this.#a=!1}#h(e){for(let t of this.#c)t(e)}#g(e){if(e.type===`progress`){this.#h({phase:e.phase,message:e.message});return}let n=this.#u;if(!(!n||!(`id`in e)||e.id!==n.id))switch(e.type){case`stdout`:n.stdout+=e.text,n.options.onStdout?.(e.text);break;case`echo`:n.options.onEcho?.(e.text);break;case`stdin-request`:this.#_(n,e.request);break;case`stderr`:n.stderr+=e.text,n.options.onStderr?.(e.text);break;case`result`:n.resolve({stdout:n.stdout,stderr:n.stderr||void 0,value:e.value,durationMs:Math.round(e.durationMs)}),n.markDone();break;case`error`:case`fatal`:{let r=(n.stderr&&!n.stderr.endsWith(`
|
|
2
|
-
`)?`
|
|
3
|
-
`:``)+e.message+`
|
|
4
|
-
`;n.stderr+=r,n.options.onStderr?.(r);let i={stdout:n.stdout,stderr:n.stderr,hint:`hint`in e?e.hint:void 0,durationMs:Math.round(`durationMs`in e?e.durationMs:0)};`hintAbout`in e&&e.hintAbout===`stdin`&&t.add(i),n.resolve(i),n.markDone();break}}}#_(e,t){let n=this.#e,r=r=>{this.#e===n&&this.#u===e&&n?.postMessage({type:`stdin-response`,request:t,text:r})},i=e.options.onStdinRequest;if(!i){r(null);return}i().then(r,()=>r(null))}#v(e,t){e.reject(t),e.markDone()}async#y(){if(!this.#d){this.#d=!0;try{for(;this.#l.length;){let e=this.#l.shift();this.#u=e;try{if(await this.load(),e.settled)continue;e.started=!0,e.options.onStart?.(),this.#e.postMessage({type:`run`,id:e.id,code:e.code,stdin:e.options.stdin,files:e.options.files,entry:e.options.entry}),await e.done}catch(t){this.#v(e,t)}finally{this.#u=null}}}finally{this.#d=!1}}}};export{i as t};
|