(function(){'use strict';const da=["DEBUG","INFO","WARN","ERROR"];var ea="main",ka=null;function la(a,b,f){if(!(1>a)){var g="EagRuntimeJS: ["+(new Date).toLocaleTimeString()+"]["+ea+"/"+(da[a]||"UNKNOWN")+"] ";a:{if(0",[a])}function ra(a){return function(){k("Unsupported function called: {}.{}",a);return 0}}function y(a,b){a[b]=ra(b)}function sa(a){return new Promise(function(b){setTimeout(b,a)})} class ua{constructor(){this.i=this.g=null;this.m=0}A(){return this.m}push(a){this.i&&(this.i._next=a);this.i=a;this.g||(this.g=a);++this.m}s(){if(this.g){const a=this.g;(this.g=a._next||null)?a._next=null:this.i=null;--this.m;return a}return null}};var va={},A={},wa={},xa={},ya={},F={},za={},H={},Ca={},Da=null,Ea=null,Fa=null,Ia=null,Ja=null,I=null,Ka=null,M=null,R=null,La=null,Ma=!1,Pa=0,S=null,Qa=!1,Ra=!1;const Sa=[];var Ta=null,Ua="_eaglercraftX",Va=!1,Wa=!1,Xa=!1,Ya=!1,Za=!0,tb=!0,ub=!1; function vb(){"string"===typeof I.localStorageNamespace&&(Ua=I.localStorageNamespace);"boolean"===typeof I.openDebugConsoleOnLaunch&&(Va=I.openDebugConsoleOnLaunch);"boolean"===typeof I.fixDebugConsoleUnloadListener&&(Wa=I.fixDebugConsoleUnloadListener);"boolean"===typeof I.forceWebGL1&&(Xa=I.forceWebGL1);"boolean"===typeof I.forceWebGL2&&(Ya=I.forceWebGL2);"boolean"===typeof I.allowExperimentalWebGL1&&(Za=I.allowExperimentalWebGL1);"boolean"===typeof I.useWebGLExt&&(tb=I.useWebGLExt);"boolean"=== typeof I.useDelayOnSwap&&(ub=I.useDelayOnSwap)} async function wb(){function a(){try{r=new AudioContext}catch(D){oa("Could not initialize audio context",D)}}vb();ka=xb;"yes"!==window.__isEaglerX188UnloadListenerSet&&(window.onbeforeunload=function(){window.__curEaglerX188UnloadListenerCB&&window.__curEaglerX188UnloadListenerCB();return!1},window.__isEaglerX188UnloadListenerSet="yes");c("Initializing EagRuntime JS context...");await yb();zb();Ka.classList.add("_eaglercraftX_root_element");Ka.style.overflow="hidden";for(var b=null,f;f=Ka.lastChild;)b||= f,Ka.removeChild(f);M=document.createElement("div");M.classList.add("_eaglercraftX_wrapper_element");M.style.position="relative";M.style.width="100%";M.style.height="100%";M.style.overflow="hidden";M.style.backgroundColor="black";Ka.appendChild(M);b&&(b.style.position="absolute",b.style.top="0px",b.style.left="0px",b.style.right="0px",b.style.bottom="0px",b.style.zIndex="2",b.classList.add("_eaglercraftX_early_splash_element"),M.appendChild(b));await sa(10);f=window.devicePixelRatio;b=f*M.clientWidth| 0;f=f*M.clientHeight|0;c("Initializing audio context");if("function"===typeof document.exitPointerLock){var g=navigator.userAgent;null!==g?(g=g.toLowerCase(),Qa=-1!==g.indexOf("mobi")||-1!==g.indexOf("tablet")):Qa=!1}else Qa=!0;var r=null;!Qa&&navigator.userActivation&&navigator.userActivation.hasBeenActive?a():(g=document.createElement("div"),g.classList.add("_eaglercraftX_press_any_key_image"),g.style.position="absolute",g.style.top="0px",g.style.left="0px",g.style.right="0px",g.style.bottom="0px", g.style.width="100%",g.style.height="100%",g.style.zIndex="3",g.style.touchAction="pan-x pan-y",g.style.background='center / contain no-repeat url("'+Fa+'"), left / 1000000% 100% no-repeat url("'+Fa+'") white',g.style.setProperty("image-rendering","pixelated"),M.appendChild(g),await new Promise(function(D,J){function G(){if(!N){N=!0;Qa?M.removeChild(O):(window.removeEventListener("keydown",G),M.removeEventListener("mousedown",G),M.removeEventListener("touchstart",G));try{a()}catch(B){J(B);return}D()}} var N=!1;if(Qa){var O=document.createElement("div");O.classList.add("_eaglercraftX_mobile_press_any_key");O.setAttribute("style","position:absolute;background-color:white;font-family:sans-serif;top:10%;left:10%;right:10%;bottom:10%;border:5px double black;padding:calc(5px + 7vh) 15px;text-align:center;font-size:20px;user-select:none;z-index:10;");O.innerHTML='

Mobile Browser Detected

Warning: EaglercraftX WASM-GC requires a lot of memory and may not be stable on most mobile devices!

(Tablets and phones with large screens work best)

'; O.querySelector("._eaglercraftX_mobile_launch_client").addEventListener("click",G);M.appendChild(O)}else window.addEventListener("keydown",G),M.addEventListener("mousedown",G),M.addEventListener("touchstart",G)}),M.removeChild(g));r?Ab(r):Bb();c("Creating main canvas");R=document.createElement("canvas");R.classList.add("_eaglercraftX_canvas_element");R.style.width="100%";R.style.height="100%";R.style.zIndex="1";R.style.touchAction="pan-x pan-y";R.style.setProperty("-webkit-touch-callout","none"); R.style.setProperty("-webkit-tap-highlight-color","rgba(255, 255, 255, 0)");R.style.setProperty("image-rendering","pixelated");R.width=b;R.height=f;M.appendChild(R);await Cb();c("Creating WebGL context");M.addEventListener("webglcontextcreationerror",function(D){k("[WebGL Error]: {}",D.statusMessage)});b={antialias:!1,depth:!1,powerPreference:"high-performance",desynchronized:!0,preserveDrawingBuffer:!1,premultipliedAlpha:!1,alpha:!1};g=!1;if(Ya){c("Note: Forcing WebGL 2.0 context");f=300;var u=R.getContext("webgl2", b);if(!u)return Db("WebGL 2.0 is not supported on this device!"),!1}else if(Xa){if(c("Note: Forcing WebGL 1.0 context"),f=200,u=R.getContext("webgl",b),!u)if(Za){if(g=!0,u=R.getContext("experimental-webgl",b),!u)return Db("WebGL is not supported on this device!"),!1}else return Db("WebGL is not supported on this device!"),!1}else if(f=300,u=R.getContext("webgl2",b),!u&&(f=200,u=R.getContext("webgl",b),!u))if(Za){if(g=!0,u=R.getContext("experimental-webgl",b),!u)return Db("WebGL is not supported on this device!"), !1}else return Db("WebGL is not supported on this device!"),!1;g&&alert('WARNING: Detected "experimental" WebGL 1.0 support, certain graphics API features may be missing, and therefore EaglercraftX may malfunction and crash!');Pa=f;La=u;Ma=g;Eb(u,f);c("OpenGL Version: {}",H.glGetString(7938));c("OpenGL Renderer: {}",H.glGetString(7937));b=H.dumpActiveExtensions();if(0===b.length)c("Unlocked the following OpenGL ES extensions: (NONE)");else for(b.sort(),c("Unlocked the following OpenGL ES extensions:"), f=0;f


Things you can try:

  1. Just try using Eaglercraft on a different device, it isn\'t a bug it\'s common sense
  2. If this screen just appeared randomly, try restarting your browser or device
  3. If you are not using Chrome/Edge, try installing the latest Google Chrome
  4. If your browser is out of date, please update it to the latest version
'; g.querySelector("#_eaglercraftX_crashReason").appendChild(document.createTextNode(a));try{var r=window.navigator.userAgent}catch(D){r=""}g.querySelector("#_eaglercraftX_crashUserAgent").appendChild(document.createTextNode(r));Ta&&Ta();window.__curEaglerX188UnloadListenerCB=null;a="No GL_RENDERER string could be queried";try{const D=document.createElement("canvas");D.width=64;D.height=64;const J=D.getContext("webgl");if(J){if(J.getExtension("WEBGL_debug_renderer_info"))var u=J.getParameter(37446); else(u=J.getParameter(WebGLRenderingContext.RENDERER))&&(u+=" [masked]");u&&(a=u)}}catch(D){}g.querySelector("#_eaglercraftX_crashWebGL").appendChild(document.createTextNode(a))}else alert("Compatibility error: "+a)}}var Rb=null; function Lb(){if(Rb)return Rb;try{var a=La,b=Ma;if(!a){b=!1;var f=document.createElement("canvas");f.width=64;f.height=64;a=f.getContext("webgl2");a||(a=f.getContext("webgl"),a||(b=!0,a=f.getContext("experimental-webgl")))}return a?(f="",0"}return"window.navigator."+a+" = "+b+"\n"}function Nb(){try{var a=[];if("object"===typeof navigator.plugins){var b=navigator.plugins.length;if(0"}return"window.navigator.plugins = "+r+"\n"} function Pb(a){try{var b=window.screen[a]}catch(f){b=""}return"window.screen."+a+" = "+b+"\n"}function Qb(){try{var a=window.location.href}catch(b){a=""}return"window.location.href = "+a+"\n"}function Ob(a){try{var b=window[a]}catch(f){b=""}return"window."+a+" = "+b+"\n"};function Sb(a,b,f){const g=document.createElement("a");g.style.position="absolute";g.style.left="0px";g.style.top="0px";g.style.zIndex="-100";g.style.color="transparent";g.innerText="Download File";g.href=b;g.target="_blank";g.download=a;M.appendChild(g);setTimeout(function(){g.click();setTimeout(function(){M.removeChild(g)},50);f&&setTimeout(f,6E4)},50)}var Tb=0,Ub=null,Vb=null,Z=null,Wb=null; function xb(a,b){if(Z)Wb&&Wb(a,b);else for(a={msg:a,err:b,next:null},Vb&&(Vb.next=a),Ub||=a,Vb=a,++Tb;256Debug Console

'); O.close();B=O.body;X=O.getElementById("loggerMessageContainer");for(d=Ub;d;)r(d.msg+"\n",d.err?"#DD0000":"#000000"),d=d.next;Vb=Ub=null;Tb=0;u();d=()=>{null!=Z&&(Z=null,b(!1))};Z.addEventListener("beforeunload",d);Z.addEventListener("unload",d)}else k("Logger popup was blocked!"),window.alert("ERROR: Popup blocked!\n\nPlease make sure you have popups enabled for this site!")}}function r(d,q){var v=O.createElement("span");v.innerText=d;v.style.color=q;X.appendChild(v);for(d=X.children;2048{Z.scrollTo(0,B.scrollHeight||B.clientHeight)},1)}A.setClipboard=function(d){try{if(window.navigator.clipboard)return window.navigator.clipboard.writeText(d),!0}catch(q){k("Failed to set clipboard data!")}return!1};A.getClipboard=new WebAssembly.Suspending(async function(){var d=null;try{window.navigator.clipboard&&(d=await navigator.clipboard.readText())}catch(q){k("Failed to read clipboard data!")}return d});var D=!1,J=null,G=null,N=null;A.displayFileChooser=function(d, q){a();if(Qa){const n=N=document.createElement("div");n.classList.add("_eaglercraftX_mobile_file_chooser_popup");n.style.position="absolute";n.style.backgroundColor="white";n.style.fontFamily="sans-serif";n.style.top="10%";n.style.left="10%";n.style.right="10%";n.style.border="5px double black";n.style.padding="15px";n.style.textAlign="left";n.style.fontSize="20px";n.style.userSelect="none";n.style.zIndex="150";var v=document.createElement("h3");v.appendChild(document.createTextNode("File Chooser")); n.appendChild(v);v=document.createElement("p");const w=G=document.createElement("input");w.type="file";w.accept=null===d?"."+q:d;w.multiple=!1;v.appendChild(w);n.appendChild(v);d=document.createElement("p");q=document.createElement("button");q.classList.add("_eaglercraftX_mobile_file_chooser_btn_cancel");q.style.fontSize="1.0em";q.addEventListener("click",function(){N===n&&(M.removeChild(n),G=N=null)});q.appendChild(document.createTextNode("Cancel"));d.appendChild(q);d.appendChild(document.createTextNode(" ")); q=document.createElement("button");q.classList.add("_eaglercraftX_mobile_file_chooser_btn_done");q.style.fontSize="1.0em";q.style.fontWeight="bold";q.addEventListener("click",function(){if(N===n){if(0{if(Z){var d=Z;X=B=O=Z=null;d.close()}})}catch(d){}(Va||f())&&g();Wb=function(d,q){var v=Z.innerHeight+Z.pageYOffset>=B.offsetHeight;r(d+"\n",q?"#DD0000":"#000000");v&&u()};A.showDebugConsole=function(){b(!0);g()};A.addLogMessage=xb;A.isShowingDebugConsole=function(){return!!Z};A.getFaviconURL=function(){return Ja}};wa.getEPKFileData=function(a){const b=Ea[a];Ea[a]=null;return b};wa.getEPKFileCount=function(){return Ea.length}; if("undefined"!==typeof window){wa.loadImageFile0=new WebAssembly.Suspending(function(a,b){return new Promise(function(f){const g=URL.createObjectURL(new Blob([a],{type:b}));if(g){const r=document.createElement("img");r.addEventListener("load",function(){URL.revokeObjectURL(g);f({width:r.width,height:r.height,img:r})});r.addEventListener("error",function(){URL.revokeObjectURL(g);f(null)});r.src=g}else f(null)})});var Xb=null,Yb=null;wa.loadImageFile1=function(a,b){const f=a.width,g=a.height;if(a= a.img)Xb||=document.createElement("canvas"),Xb.widthe&&(e=1);ha=X=0;for(var t=R;t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop);)X+=t.offsetLeft-t.scrollLeft,ha+=t.offsetTop-t.scrollTop,t=t.offsetParent;t=M.clientWidth*e|0;var Q=M.clientHeight*e|0,K=0,U=0,ja=t,fa=Q;if(aa){fa=window.visualViewport;var V=fa.scale;K=fa.pageLeft*e*V;U=fa.pageTop*e*V;ja=fa.width*e*V;fa=fa.height*e*V;1>ja&&(ja=1);1>fa&&(fa=1);0>K?(ja+=K,K=0):K>=t&&(K=t-1);0>U?(fa+=U,U=0):U>=Q&&(U=Q-1);K+ja>t&&(ja=t-K);U+fa> Q&&(fa=Q-U)}V={eventTypeMask:0};L!==e&&(L=e,V.eventTypeMask|=4,V.windowDPI=e);if(C!==t||T!==Q)C=t,T=Q,V.eventTypeMask|=1,V.windowWidth=t,V.windowHeight=Q;if(ia!==K||Na!==U||Aa!==ja||Oa!==fa)ia=K,Na=U,Aa=ja,Oa=fa,V.eventTypeMask|=2,V.visualViewportX=K,V.visualViewportY=U,V.visualViewportW=ja,V.visualViewportH=fa;0!==V.eventTypeMask&&Y(0,9,V)}function b(e){const t=e.length,Q=Array(t);for(var K=0;K=e){const Q=1E3/e;if(0===ba)ba=performance.now()+Q;else{e=performance.now();var t=ba-e|0;if(0t-Ga&&(ma=window.setTimeout(function(){try{R.requestPointerLock()}catch(Q){}},3100-(t-Ga)))}else if(-1!==ma&&window.clearTimeout(ma),ma=-1,!Ba)try{document.exitPointerLock()}catch(Q){}}}function J(){if(ca)if(h.matches){if(m)try{navigator.keyboard.unlock()}catch(e){}try{document.exitFullscreen()}catch(e){}}else{if(m)try{navigator.keyboard.lock()}catch(e){}try{R.requestFullscreen()}catch(e){}}} function G(){O()?N():d?(d.blur(),d.value="",setTimeout(function(){d&&(p?p.removeChild(d):d.remove(),d=null);p&&(M.removeChild(p),p=null)},10)):(p&&(M.removeChild(p),p=null),p=document.createElement("form"),p.setAttribute("autocomplete","off"),p.classList.add("_eaglercraftX_text_input_wrapper"),p.style.position="absolute",p.style.top="0px",p.style.left="0px",p.style.right="0px",p.style.bottom="0px",p.style.zIndex="-100",p.style.margin="0px",p.style.padding="0px",p.style.border="none",p.addEventListener("submit", function(e){e.preventDefault();e.stopPropagation();e=e.timeStamp;e&&(0!==w&&10>e-w||0!==l&&10>e-l||0!==z&&10>e-z)||(n||(c("Note: Generating return keystroke from submit event on form, this browser probably doesn't generate keydown/beforeinput/input when enter/return is pressed on the on-screen keyboard"),n=!0),Y(0,3,{eventType:0,absoluteCode:28,absoluteChar:10}))}),d=document.createElement("input"),d.type="password",d.value=" ",d.classList.add("_eaglercraftX_text_input_element"),d.setAttribute("autocomplete", "off"),d.style.position="absolute",d.style.top="0px",d.style.left="0px",d.style.right="0px",d.style.bottom="0px",d.style.zIndex="-100",d.style.margin="0px",d.style.padding="0px",d.style.border="none",d.style.setProperty("-webkit-touch-callout","default"),d.addEventListener("beforeinput",function(e){if(d===e.target){q||(c("Note: Caught beforeinput event from on-screen keyboard, browser probably does not generate global keydown/keyup events on text fields, or does not respond to cancelling keydown"), q=!0);var t=e.timeStamp;if(t){if(0!==w&&10>t-w)return;l=t}e.preventDefault();e.stopPropagation();switch(e.inputType){case "insertParagraph":case "insertLineBreak":Y(0,3,{eventType:0,absoluteCode:28,absoluteChar:10});break;case "deleteWordBackward":case "deleteSoftLineBackward":case "deleteHardLineBackward":case "deleteEntireSoftLine":case "deleteContentBackward":case "deleteContent":Y(0,3,{eventType:0,absoluteCode:14,absoluteChar:0});break;case "deleteWordForward":case "deleteSoftLineForward":case "deleteHardLineForward":case "deleteContentForward":Y(0, 3,{eventType:0,absoluteCode:211,absoluteChar:0});break;case "insertText":case "insertCompositionText":case "insertReplacementText":(e=e.data)&&0e-w||0!==l&&10>e-l)return;z=e}e=d.value;var t=e.length;0===t?Y(0,3,{eventType:0,absoluteCode:14,absoluteChar:0}):1===t?Y(0,3,{eventType:1,codepoints:e}):(e=e.trim(),t=e.length,0===t?Y(0,3,{eventType:0,absoluteCode:57, absoluteChar:32}):Y(0,3,{eventType:1,codepoints:e.charAt(t-1)}));d.value=" ";d.setSelectionRange(1,1)}}),d.addEventListener("focus",function(e){d===e.target&&(d.value=" ",d.setSelectionRange(1,1))}),d.addEventListener("select",function(e){d===e.target&&(e.preventDefault(),e.stopPropagation(),d.value=" ",d.setSelectionRange(1,1))}),p.appendChild(d),M.appendChild(p),d.value=" ",d.focus(),d.select(),d.setSelectionRange(1,1))}function N(){if(d){d.blur();d.value="";const e=d,t=p;window.setTimeout(function(){null!== t?(t.removeChild(e),t.remove()):e.remove()},10);p=d=null}else p&&(M?M.removeChild(p):p.remove(),p=null)}function O(){return!!d&&document.activeElement===d}var B=null,X=0,ha=0,p=null,d=null,q=!1,v=!1,n=!1,w=0,l=0,z=0,C=-1,T=-1,L=-1,aa=!1,ia=-1,Na=-1,Aa=-1,Oa=-1,ta=!1,pa=!1,Ba=!1,Ga=0,ma=-1,ca=!1,h=null,m=!1,x=!1,E=-1,P=!1,W=null,na=null,Ha=null,$a=null,ab=null,bb=null,cb=null,db=null,eb=null,fb=null,gb=null,hb=null,ib=null,jb=null,kb=null,lb=null,mb=null,nb=null,ob=null,pb=null,qb=null,rb=null,sb= null;B=document.createElement("div");B.classList.add("_eaglercraftX_keyboard_open_zone");B.style.display="none";B.style.position="absolute";B.style.backgroundColor="transparent";B.style.top="0px";B.style.left="0px";B.style.width="0px";B.style.height="0px";B.style.zIndex="100";B.style.touchAction="pan-x pan-y";B.style.setProperty("-webkit-touch-callout","none");B.style.setProperty("-webkit-tap-highlight-color","rgba(255, 255, 255, 0)");M.appendChild(B);a();M.addEventListener("contextmenu",W=function(e){e.preventDefault(); e.stopPropagation()});R.addEventListener("mousedown",na=function(e){e.preventDefault();e.stopPropagation();ta&&pa&&document.pointerLockElement!==R?D(1):Y(0,0,{eventType:0,posX:e.offsetX,posY:e.offsetY,button:e.button})});R.addEventListener("mouseup",Ha=function(e){e.preventDefault();e.stopPropagation();Y(0,0,{eventType:1,posX:e.offsetX,posY:e.offsetY,button:e.button})});R.addEventListener("mousemove",$a=function(e){e.preventDefault();e.stopPropagation();Y(0,0,{eventType:2,posX:e.offsetX,posY:e.offsetY, movementX:e.movementX,movementY:e.movementY})});R.addEventListener("mouseenter",ab=function(){Y(0,7,null)});R.addEventListener("mouseleave",bb=function(){Y(0,8,null)});R.addEventListener("touchstart",cb=function(e){e.preventDefault();e.stopPropagation();Y(0,2,{eventType:0,changedTouches:b(e.changedTouches),targetTouches:b(e.targetTouches)});N()});R.addEventListener("touchend",db=function(e){e.preventDefault();e.stopPropagation();Y(0,2,{eventType:2,changedTouches:b(e.changedTouches),targetTouches:b(e.targetTouches)})}); R.addEventListener("touchmove",eb=function(e){e.preventDefault();e.stopPropagation();Y(0,2,{eventType:1,changedTouches:b(e.changedTouches),targetTouches:b(e.targetTouches)})});R.addEventListener("touchcancel",fb=function(e){Y(0,2,{eventType:2,changedTouches:b(e.changedTouches),targetTouches:b(e.targetTouches)})});R.addEventListener("wheel",nb=function(e){e.preventDefault();e.stopPropagation();Y(0,0,{eventType:3,posX:e.offsetX,posY:e.offsetY,wheel:e.deltaY})});window.addEventListener("blur",pb=function(){Y(0, 6,null)});window.addEventListener("focus",ob=function(){Y(0,5,null)});window.addEventListener("keydown",ib=function(e){e.preventDefault();e.stopPropagation();"F11"!==e.key||e.repeat?(Y(0,1,f(e.repeat?2:0,e)),e.timeStamp&&"Unidentified"!==e.key&&(w=e.timeStamp)):J()});window.addEventListener("keyup",jb=function(e){e.preventDefault();e.stopPropagation();Y(0,1,f(1,e))});B.addEventListener("touchstart",kb=function(e){e.preventDefault();e.stopPropagation()});B.addEventListener("touchend",lb=function(e){e.preventDefault(); e.stopPropagation();G()});B.addEventListener("touchmove",mb=function(e){e.preventDefault();e.stopPropagation()});(ta="function"===typeof document.exitPointerLock)?(document.addEventListener("pointerlockchange",qb=function(){window.setTimeout(function(){const e=document.pointerLockElement===R;e||pa&&(Ga=performance.now()|0);pa=e},60);Ba=!1}),document.addEventListener("pointerlockerror",rb=function(){Ba=!1})):k("Pointer lock is not supported on this browser");(ca="function"===typeof document.exitFullscreen)? (h=window.matchMedia("(display-mode: fullscreen)"),(m=!(!navigator.keyboard||!navigator.keyboard.lock))&&h.addEventListener("change",sb=function(){h.matches||navigator.keyboard.unlock()})):k("Fullscreen is not supported on this browser");if("undefined"!==typeof window.visualViewport)if("body"===Ka.tagName.toLowerCase())aa=!0;else{const e=document.body;10>=Math.abs(e.clientWidth-M.clientWidth)&&10>=Math.abs(e.clientHeight-M.clientHeight)&&(aa=!0)}else aa=!1;aa&&c("Note: Detected game is embedded in body, some screens may be resized to window.visualViewport instead for a better mobile experience"); try{await g(),x=!0}catch(e){x=!1}x||k("VSync is not supported on this browser");(P="function"===typeof navigator.getGamepads)?(window.addEventListener("gamepadconnected",gb=function(){Y(0,10,{eventType:0})}),window.addEventListener("gamepaddisconnected",hb=function(e){Y(0,10,{eventType:1,gamepad:e.gamepad})})):k("Gamepad detected as unsupported!");F.keyboardLayoutSupported=function(){return!(!navigator.keyboard||!navigator.keyboard.getLayoutMap)};F.iterateKeyboardLayout=new WebAssembly.Suspending(async function(){const e= [];try{const t=await navigator.keyboard.getLayoutMap();t&&t.forEach&&t.forEach(function(Q,K){e.push({key:Q,value:K})})}catch(t){}return e});F.updateCanvasSize=function(e,t){R.width!==e&&(R.width=e);R.height!==t&&(R.height=t)};var ba=0;F.updatePlatformAndSleep=new WebAssembly.Suspending(function(e,t){a();if("string"!==typeof document.visibilityState||"visible"===document.visibilityState)return x&&t?(ba=0,g()):0>=e?(ba=0,ub?gc(0):fc()):u(e);ba=0;return r(50)});F.isVSyncSupported=function(){return x}; F.mouseSetGrabbed=D;F.isMouseGrabSupported=function(){return ta};F.isMouseGrabbed=function(){return pa};F.isPointerLocked=function(){return ta&&(Ba||document.pointerLockElement===R)};F.supportsFullscreen=function(){return ca};F.toggleFullscreen=J;F.isFullscreen=function(){return ca&&h.matches};F.touchSetOpenKeyboardZone=function(e,t,Q,K){0!==Q&&0!==K?(B.style.display="block",B.style.top=""+(T-t-K)/L+"px",B.style.left=""+e/L+"px",B.style.width=""+Q/L+"px",B.style.height=""+K/L+"px"):(B.style.display= "none",B.style.top="0px",B.style.left="0px",B.style.width="0px",B.style.height="0px")};F.touchCloseDeviceKeyboard=N;F.touchIsDeviceKeyboardOpenMAYBE=O;F.gamepadSupported=function(){return P};F.isVisualViewport=function(){return aa};Ta=function(){try{W&&(M.removeEventListener("contextmenu",W),W=null),na&&(R.removeEventListener("mousedown",na),na=null),Ha&&(R.removeEventListener("mouseup",Ha),Ha=null),$a&&(R.removeEventListener("mousemove",$a),$a=null),ab&&(R.removeEventListener("mouseenter",ab),ab= null),bb&&(R.removeEventListener("mouseleave",bb),bb=null),cb&&(R.removeEventListener("touchstart",cb),cb=null),db&&(R.removeEventListener("touchend",db),db=null),eb&&(R.removeEventListener("touchmove",eb),eb=null),fb&&(R.removeEventListener("touchcancel",fb),fb=null),gb&&(window.removeEventListener("gamepadconnected",gb),gb=null),hb&&(window.removeEventListener("gamepaddisconnected",hb),hb=null),ib&&(window.removeEventListener("keydown",ib),ib=null),jb&&(window.removeEventListener("keyup",jb),jb= null),kb&&(B.removeEventListener("touchstart",kb),kb=null),lb&&(B.removeEventListener("touchend",lb),lb=null),mb&&(B.removeEventListener("touchmove",mb),mb=null),nb&&(R.removeEventListener("wheel",nb),nb=null),ob&&(window.removeEventListener("focus",ob),ob=null),pb&&(window.removeEventListener("blur",pb),pb=null),qb&&(document.removeEventListener("pointerlockchange",qb),qb=null),rb&&(document.removeEventListener("pointerlockerror",rb),rb=null),sb&&(h.removeEventListener("change",sb),sb=null)}catch(e){k("Failed to remove event listeners! {}", e)}Ta=null}};(function(){function a(){this._socket.close()}function b(l){this._socket.send(l)}function f(l){this._socket.send(l)}function g(){return this._frameCountStr+this._frameCountBin}function r(){const l=this._queue;return l?(l._next===l&&l._prev===l?this._queue=null:(this._queue=l._next,l._prev._next=l._next,l._next._prev=l._prev),l._next=null,l._prev=null,0===l.type?--this._frameCountStr:--this._frameCountBin,l):null}function u(){var l=this._frameCountStr+this._frameCountBin;if(0===l)return null;l=Array(l); var z=0,C=this._queue;const T=C;do{l[z++]=C;var L=C._next;C._next=null;C._prev=null;C=L}while(C!==T);this._queue=null;this._frameCountBin=this._frameCountStr=0;return l}function D(){this._queue=null;this._frameCountBin=this._frameCountStr=0}function J(l,z){var C=l._queue;if(!C)return null;const T=C;do{var L=C._next;if(C.type===z)return z=C._prev,L===C&&z===C?l._queue=null:(C===T&&(l._queue=L),z._next=L,L._prev=z),C._next=null,C._prev=null,C;C=L}while(C!==T);return null}function G(l,z,C){var T=0,L= l._queue,aa=L;do{var ia=L._next;L.type===z&&(C[T++]=L);L=ia}while(L!==aa);C.length=T;for(aa=0;aa(new Date).getTime(),dateToString:d=>(new Date(d)).toString(),getYear:d=>(new Date(d)).getFullYear(),setYear:(d,q)=>{d=new Date(d);d.setFullYear(q);return d.getTime()},getMonth:d=>(new Date(d)).getMonth(),setMonth:(d, q)=>{d=new Date(d);d.setMonth(q);return d.getTime()},getDate:d=>(new Date(d)).getDate(),setDate:(d,q)=>{d=new Date(d);d.setDate(q);return d.getTime()},create:(d,q,v,n,w,l)=>(new Date(d,q,v,n,w,l)).getTime(),createFromUTC:(d,q,v,n,w,l)=>Date.UTC(d,q,v,n,w,l)}}function g(p){let d=[],q=[];p.teavmConsole={putcharStderr:function(v){10===v?(v=String.fromCharCode(...d),console.error(v),ka&&ka(v,!0),d.length=0):d.push(v)},putcharStdout:function(v){10===v?(v=String.fromCharCode(...q),console.log(v),ka&&ka(v, !1),q.length=0):q.push(v)}}}function r(p,d){let q=new FinalizationRegistry(n=>{let w=d.exports["teavm.reportGarbageCollectedValue"];"undefined"!==typeof w&&d.j(function(){w(n.B,n.C)})}),v=new FinalizationRegistry(n=>{let w=d.exports["teavm.reportGarbageCollectedString"];"function"===typeof w&&d.j(function(){w(n)})});p.teavm={createWeakRef:(n,w,l)=>{null!==l&&q.register(n,{C:w,B:l});return new WeakRef(n)},deref:n=>n.deref(),createStringWeakRef:(n,w)=>{v.register(n,w);return new WeakRef(n)},stringDeref:n=> n.deref(),takeStackTrace:()=>{var n=Error().stack;let w=[];for(let l of n.split("\n"))n=B.exec(l),null!==n&&2<=n.length&&w.push(parseInt(n[1],16));return{getStack:function(){let l;if(d.h)try{l=d.h(w)}catch(z){console.warn("Could not deobfuscate stack",z)}l||=w.map(z=>({className:"java.lang.Throwable$FakeClass",method:"fakeMethod",file:"Throwable.java",line:z}));return l}}},decorateException:n=>{new ha(d,n)}}}function u(p,d){function q(h){return h}function v(h){var m=h.charAt(0);var x=""+(n(m)?m:"_"); for(m=1;m=E;x+=E?P:"_"}return x}function n(h){return"A"<=h&&"Z">=h||"a"<=h&&"z">=h||"_"===h||"$"===h}function w(h,m,x){null===h?(new Function("value",m+" = value;"))(x):h[m]=x}function l(h){d.exports["teavm.js.throwException"](X in h?h[X]:d.exports["teavm.js.wrapException"](h))}function z(h){a:{if(h instanceof WebAssembly.Exception){var m=d.exports["teavm.javaException"];var x=d.exports["teavm.getJsException"];if(h.is(m)){h=h.getArg(m,0); m=d.exports["teavm.js.extractException"](h);if(null!==m){x=m;break a}x=x(h);"undefined"===typeof x&&(x=new ha(d,h));break a}}x=h}throw x;}function C(h){var m=[];for(let x=0;xpa.delete(h)),Ga=new WeakMap,ma=2463534242;p.teavmJso={emptyString:()=>"",stringFromCharCode:h=>String.fromCharCode(h),concatStrings:(h,m)=>h+m,stringLength:h=>h.length,charAt:(h,m)=>h.charCodeAt(m),emptyArray:()=> [],appendToArray:(h,m)=>h.push(m),unwrapBoolean:h=>h?1:0,wrapBoolean:h=>!!h,getProperty:function(h,m){try{return null!==h?h[m]:a(m)}catch(x){l(x)}},setProperty:w,setPropertyPure:w,global:h=>{try{return a(h)}catch(m){l(m)}},createClass:(h,m,x)=>{h=v(h||"JavaObject");let E;E=null===m?function(W){this[aa]=W;this[ia]=null}:function(W){m.call(this,W)};let P=T(h,function(W,na){if(W===Aa)E.call(this,na);else{if(null===x)throw Error("This class can't be instantiated directly");try{return x.apply(null,arguments)}catch(Ha){z(Ha)}}}); P.prototype=Object.create(m||Object.prototype);P.prototype.constructor=P;h=T(h,function(W){return P.call(this,Aa,W)});h[Aa]=P;h.prototype=P.prototype;return h},exportClass:h=>h[Aa],defineMethod:(h,m,x)=>{let E=[];for(let P=1;P{h[m]=C(x)},defineFunction:C,defineProperty:(h,m,x,E)=>{let P={get(){try{return x(this)}catch(W){z(W)}}};null!==E&&(P.set=function(W){try{E(this,W)}catch(na){z(na)}});Object.defineProperty(h.prototype,m,P)},defineStaticProperty:(h,m,x,E)=>{let P={get(){try{return x()}catch(W){z(W)}}};null!==E&&(P.set=function(W){try{E(W)}catch(na){z(na)}});Object.defineProperty(h,m,P)},javaObjectToJS:(h,m)=>{if(null===h)return null;var x=Oa.get(h);if("undefined"!=typeof x&&(x=x.deref(),"undefined"!==typeof x))return x; m=new m(h);Oa.set(h,new WeakRef(m));return m},unwrapJavaObject:h=>h[aa],asFunction:(h,m)=>{let x=h[ia];null===x&&(x=Object.create(null),h[ia]=x);let E=x[m];"function"!==typeof E&&(E=function(){return h[m].apply(h,arguments)},E[Na]=h,x[m]=E);return E},functionAsObject:(h,m)=>{let x=h[Na];if("undefined"!==typeof x){let E=x[ia];if(void 0!==E&&E[m]===h)return x}return{[m]:function(...E){try{return h(...E)}catch(P){z(P)}}}},wrapObject:h=>{if(null===h)return null;if("object"===typeof h||"function"===typeof h){var m= h[aa];if("object"===typeof m)return m;m=ta.get(h);if(void 0!==m&&(m=m.deref(),void 0!==m))return m;m=d.exports["teavm.jso.createWrapper"](h);ta.set(h,new WeakRef(m));return m}m=pa.get(h);if(void 0!==m&&(m=m.deref(),void 0!==m))return m;m=d.exports["teavm.jso.createWrapper"](h);pa.set(h,new WeakRef(m));Ba.register(m,h);return m},isPrimitive:(h,m)=>typeof h===m,instanceOf:(h,m)=>h instanceof m,instanceOfOrNull:(h,m)=>null===h||h instanceof m,sameRef:(h,m)=>h===m,hashCode:h=>{if("object"===typeof h|| "function"===typeof h||"symbol"===typeof h){var m=Ga.get(h);if("number"===typeof m)return m;m=ma;m^=m<<13;m^=m>>>17;ma=m^=m<<5;Ga.set(h,m);return m}return"number"===typeof h?h|0:"bigint"===typeof h?BigInt.asIntN(32,h):"boolean"===typeof h?h?1:0:0},apply:(h,m,x)=>{try{return null===h?a(m)(...x):h[m](...x)}catch(E){l(E)}},concatArray:(h,m)=>h.concat(m),getJavaException:h=>h[X]};for(var ca of"wrapByte wrapShort wrapChar wrapInt wrapFloat wrapDouble unwrapByte unwrapShort unwrapChar unwrapInt unwrapFloat unwrapDouble".split(" "))p.teavmJso[ca]= q;ca=[];for(let h=0;32>h;++h){let m=0===ca.length?"":ca.join(", "),x=[...ca,"body"].join(", ");p.teavmJso["createFunction"+h]=(new Function("wrapCallFromJavaToJs",...ca,"body",`return new Function('wrapCallFromJavaToJs', ${x}).bind(this, wrapCallFromJavaToJs);`)).bind(null,L);p.teavmJso["bindFunction"+h]=(E,...P)=>E.bind(null,...P);p.teavmJso["callFunction"+h]=(new Function("rethrowJsAsJava","fn",...ca,"try {\n"+` return fn(${m});\n`+"} catch (e) {\n rethrowJsAsJava(e);\n}")).bind(null,l);p.teavmJso["callMethod"+ h]=(new Function("rethrowJsAsJava","getGlobalName","instance","method",...ca,"try {\n return instance !== null\n"+` ? instance[method](${m})\n`+` : getGlobalName(method)(${m});\n`+"} catch (e) {\n rethrowJsAsJava(e);\n}")).bind(null,l,a);p.teavmJso["construct"+h]=(new Function("rethrowJsAsJava","constructor",...ca,"try {\n"+` return new constructor(${m});\n`+"} catch (e) {\n rethrowJsAsJava(e);\n}")).bind(null,l);p.teavmJso["arrayOf"+h]=new Function(...ca,"return ["+m+"]"); ca.push("p"+(h+1))}}async function D(p){try{const d={},q=b(d),v=p.path instanceof WebAssembly.Module?p.path:await WebAssembly.compileStreaming(fetch(p.path)),n=new WebAssembly.Instance(v,d);q.u(n.exports);return{module:v,instance:n}}catch(d){return console.warn("Could not load deobfuscator",d),null}}function J(p,d,q){let v=null,n=!1;return w=>{if(!n){n=!0;if(null!==d)try{v=q.exports.createFromExternalFile.value(d)}catch(l){console.warn("Could not load create deobfuscator",l)}if(null==v&&null!==p)try{v= q.exports.createForModule.value(p)}catch(l){console.warn("Could not create deobfuscator from module data",l)}}return null!==v?v.deobfuscate(w):[]}}async function G(p,d){if(!d.enabled||"auto"!==p&&"external"!==p)return null;if(d.l instanceof ArrayBuffer)return new Int8Array(d.l);p=await fetch(d.l);return p.ok?new Int8Array(await p.arrayBuffer()):null}function N(p){const d=new ua;p.teavm.pollAsyncCallbacks=function(){for(var q;q=d.s();)q.fn()};return function(q){d.push({fn:q,_next:null})}}let O=new Map, B=/.+:wasm-function\[[0-9]+]:0x([0-9a-f]+).*/,X=Symbol("javaException");class ha extends Error{constructor(p,d){super();this.g=p;this[X]=d;p.exports["teavm.setJsException"](d,this)}get message(){var p=this.g.exports["teavm.exceptionMessage"];return"function"===typeof p&&(p=p(this[X]),null!=p)?p:"(could not fetch message)"}}rc={load:async function(p,d){d||={};var q=d.h||{};let [v,n,w]=await Promise.all([q.enabled?D(q):Promise.resolve(null),p instanceof WebAssembly.Module?Promise.resolve(p):WebAssembly.compileStreaming(fetch(p)), G(q.v,q)]);q={};p=b(q);"undefined"!==typeof d.o&&d.o(q);p.D(N(q));d=await WebAssembly.instantiate(n,q);q={};p.u(d.exports);if(v){let l=J(null,w,v.instance);null!==l&&(p.F(l),q.deobfuscator=l)}p={exports:q,instance:d,L:{G:n,J:v?v.module:null}};for(let l in d.exports){let z=d.exports[l];z instanceof WebAssembly.Global?Object.defineProperty(q,l,{get:()=>z.value}):"function"===typeof z&&(q[l]=z)}q.memory=d.exports["teavm.memory"];q.H=w;return p},I:b,M:function(p){return new Proxy(p,{get(d,q){return new WebAssembly.Global({value:"externref", mutable:!1},d[q])}})}}})();async function sc(){try{Error.stackTraceLimit=1024;I=self.__eaglercraftXLoaderContext.getEaglercraftXOpts();self.__eaglercraftXLoaderContext.getEagRuntimeJSURL();const a=self.__eaglercraftXLoaderContext.getClassesWASMURL(),b=self.__eaglercraftXLoaderContext.getClassesDeobfWASMURL(),f=self.__eaglercraftXLoaderContext.getClassesTEADBGURL();Ea=self.__eaglercraftXLoaderContext.getEPKFiles();Ka=self.__eaglercraftXLoaderContext.getRootElement();self.__eaglercraftXLoaderContext.getImageURL(0);Fa=self.__eaglercraftXLoaderContext.getImageURL(1); Ia=self.__eaglercraftXLoaderContext.getImageURL(2);Ja=self.__eaglercraftXLoaderContext.getImageURL(3);const g=self.__eaglercraftXLoaderContext.getMainArgs();delete self.__eaglercraftXLoaderContext;if("_worker_process_"!==g[0]){if(!await wb())return}else ea="worker",await Fb();c("Loading EaglercraftX WASM GC binary...");const r=await rc.load(a,{h:{enabled:!0,path:b,v:"external",l:f},o:function(u){u.WASMGCBufferAllocator=va;u.platformApplication=A;u.platformAssets=wa;u.platformAudio=xa;u.platformFilesystem= ya;u.platformInput=F;u.platformNetworking=za;u.platformOpenGL=H;u.platformRuntime=Ca;u.teavm.notifyHeapResized=function(){Gb(r.exports.memory)}}});Gb(r.exports.memory);Da=r.exports.deobfuscator;c("Calling entry point with args: {}",JSON.stringify(g));try{await WebAssembly.promising(r.exports.main.__impl)(g)}catch(u){r.exports.main.__rethrow(u)}finally{la(2,"Main function has returned!",[])}}catch(a){Jb(a)}} "object"===typeof self.__eaglercraftXLoaderContext?self.__eaglercraftXLoaderContext.runMain(sc):console.error("???");}).call(this);