2024-12-19 07:29:36 -08:00

203 lines
101 KiB
JavaScript

(function(){'use strict';const ba=["DEBUG","INFO","WARN","ERROR"];var da="main",ea=null;function fa(a,b,d){if(!(1>a)){var c="EagRuntimeJS: ["+(new Date).toLocaleTimeString()+"]["+da+"/"+(ba[a]||"UNKNOWN")+"] ";a:{if(0<d.length){for(var h=[],l=0;l<d.length;++l){var t=b.indexOf("{}");if(-1!=t)h.push(b.substring(0,t)),h.push(d[l]),b=b.substring(t+2);else break}if(0<h.length){h.push(b);d=h.join("");break a}}d=b}b=c+d;3<=a?console.error(b):console.log(b);ea&&ea(b,3<=a)}}function e(a,...b){fa(1,a,b)}
function ha(a,...b){fa(2,a,b)}function g(a,...b){fa(3,a,b)}function ia(a,b){if(b){if(b.message?fa(3,'{}: {} - "{}"',[a,b.name,b.message]):fa(3,"{}: {}",[a,b.name]),"string"===typeof b.stack)for(b=la(b.stack),a=0;a<b.length;++a)fa(3," at "+b[a],[])}else fa(3,"{}: <null>",[a])}function na(a){return function(){g("Unsupported function called: {}.{}",a);return 0}}function C(a,b){a[b]=na(b)}function oa(a){return new Promise(function(b){setTimeout(b,a)})}
class qa{constructor(){this.G=this.o=null;this.u=0}K(){return this.u}push(a){this.G&&(this.G._next=a);this.G=a;this.o||(this.o=a);++this.u}j(){if(this.o){const a=this.o;(this.o=a._next||null)?a._next=null:this.G=null;--this.u;return a}return null}};var ra={},G={},wa={},xa={},ya={},I={},za={},J={},Ca={},Da={},Ea={},M={},Fa={},Ja={},Ka={},La=null,Ma=null,Na=null,Oa=null,Pa=null,Qa=null,Sa=null,Ta=null,N=null,Ua=null,Va=null,P=null,R=null,Wa=null,Xa=!1,Ya=0,Za=null,$a=!1,ab=null,bb=null,cb=!1;const db=[];var eb=null,fb="_eaglercraftX",gb=!1,hb=!1,zb=!1,Ab=!0,Bb=!1,Cb=!1,Db=!0,Eb=!0,Fb=!1;
function Gb(){"string"===typeof N.localStorageNamespace&&(fb=N.localStorageNamespace);"boolean"===typeof N.openDebugConsoleOnLaunch&&(gb=N.openDebugConsoleOnLaunch);"boolean"===typeof N.fixDebugConsoleUnloadListener&&(hb=N.fixDebugConsoleUnloadListener);"boolean"===typeof N.forceWebViewSupport&&(zb=N.forceWebViewSupport);"boolean"===typeof N.enableWebViewCSP&&(Ab=N.enableWebViewCSP);"boolean"===typeof N.forceWebGL1&&(Bb=N.forceWebGL1);"boolean"===typeof N.forceWebGL2&&(Cb=N.forceWebGL2);"boolean"===
typeof N.allowExperimentalWebGL1&&(Db=N.allowExperimentalWebGL1);"boolean"===typeof N.useWebGLExt&&(Eb=N.useWebGLExt);"boolean"===typeof N.useDelayOnSwap&&(Fb=N.useDelayOnSwap)}
async function Hb(){function a(){try{h=new AudioContext}catch(t){ia("Could not initialize audio context",t)}}Gb();ea=Ib;window.__curEaglerX188UnloadListenerCB=function(){};"yes"!==window.__isEaglerX188UnloadListenerSet&&(window.onbeforeunload=function(){window.__curEaglerX188UnloadListenerCB&&window.__curEaglerX188UnloadListenerCB();return!1},window.__isEaglerX188UnloadListenerSet="yes");e("Initializing EagRuntime JS context...");await Jb();Kb();Lb();Mb();Nb();Ob();Pb();C(Ka,"sendPacket");C(Ka,"getAvailablePackets");
C(Ka,"getNextPacket");C(Ka,"setCrashCallback");Va.classList.add("_eaglercraftX_root_element");Va.style.overflow="hidden";for(var b=null,d;d=Va.lastChild;)b||=d,Va.removeChild(d);P=document.createElement("div");P.classList.add("_eaglercraftX_wrapper_element");P.style.position="relative";P.style.width="100%";P.style.height="100%";P.style.overflow="hidden";P.style.backgroundColor="black";Va.appendChild(P);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"),P.appendChild(b));await oa(10);d=window.devicePixelRatio;b=d*P.clientWidth|0;d=d*P.clientHeight|0;e("Initializing audio context");if("function"===typeof document.exitPointerLock){var c=navigator.userAgent;null!==c?(c=c.toLowerCase(),$a=-1!==c.indexOf("mobi")||-1!==c.indexOf("tablet")):$a=!1}else $a=!0;var h=null;!$a&&navigator.userActivation&&navigator.userActivation.hasBeenActive?a():(c=document.createElement("div"),c.classList.add("_eaglercraftX_press_any_key_image"),
c.style.position="absolute",c.style.top="0px",c.style.left="0px",c.style.right="0px",c.style.bottom="0px",c.style.width="100%",c.style.height="100%",c.style.zIndex="3",c.style.touchAction="pan-x pan-y",c.style.background='center / contain no-repeat url("'+Qa+'"), left / 1000000% 100% no-repeat url("'+Qa+'") white',c.style.setProperty("image-rendering","pixelated"),P.appendChild(c),await new Promise(function(t,D){function y(){if(!B){B=!0;$a?P.removeChild(v):(window.removeEventListener("keydown",y),
P.removeEventListener("mousedown",y),P.removeEventListener("touchstart",y));try{a()}catch(S){D(S);return}t()}}var B=!1;if($a){var v=document.createElement("div");v.classList.add("_eaglercraftX_mobile_press_any_key");v.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;");v.innerHTML='<h3 style="margin-block-start:0px;margin-block-end:0px;margin:20px 5px;">Mobile Browser Detected</h3><p style="margin-block-start:0px;margin-block-end:0px;margin:20px 5px;">Warning: EaglercraftX WASM-GC requires a lot of memory and may not be stable on most mobile devices!</p><p style="margin-block-start:0px;margin-block-end:0px;margin:20px 2px;"><button style="font: 24px sans-serif;font-weight:bold;" class="_eaglercraftX_mobile_launch_client">Launch EaglercraftX</button></p><p style="margin-block-start:0px;margin-block-end:0px;margin:25px 5px;">(Tablets and phones with large screens work best)</p>';
v.querySelector("._eaglercraftX_mobile_launch_client").addEventListener("click",y);P.appendChild(v)}else window.addEventListener("keydown",y),P.addEventListener("mousedown",y),P.addEventListener("touchstart",y)}),P.removeChild(c));h?Qb(h):Rb();e("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=d;P.appendChild(R);await Sb();e("Creating WebGL context");P.addEventListener("webglcontextcreationerror",function(t){g("[WebGL Error]: {}",t.statusMessage)});b={antialias:!1,depth:!1,powerPreference:"high-performance",desynchronized:!0,preserveDrawingBuffer:!1,premultipliedAlpha:!1,alpha:!1};c=!1;if(Cb){e("Note: Forcing WebGL 2.0 context");d=300;var l=R.getContext("webgl2",
b);if(!l)return Tb("WebGL 2.0 is not supported on this device!"),!1}else if(Bb){if(e("Note: Forcing WebGL 1.0 context"),d=200,l=R.getContext("webgl",b),!l)if(Db){if(c=!0,l=R.getContext("experimental-webgl",b),!l)return Tb("WebGL is not supported on this device!"),!1}else return Tb("WebGL is not supported on this device!"),!1}else if(d=300,l=R.getContext("webgl2",b),!l&&(d=200,l=R.getContext("webgl",b),!l))if(Db){if(c=!0,l=R.getContext("experimental-webgl",b),!l)return Tb("WebGL is not supported on this device!"),
!1}else return Tb("WebGL is not supported on this device!"),!1;c&&alert('WARNING: Detected "experimental" WebGL 1.0 support, certain graphics API features may be missing, and therefore EaglercraftX may malfunction and crash!');Ya=d;Wa=l;Xa=c;Ub(l,d);e("OpenGL Version: {}",J.glGetString(7938));e("OpenGL Renderer: {}",J.glGetString(7937));b=J.dumpActiveExtensions();if(0===b.length)e("Unlocked the following OpenGL ES extensions: (NONE)");else for(b.sort(),e("Unlocked the following OpenGL ES extensions:"),
d=0;d<b.length;++d)e(" - {}",b[d]);J.glClearColor(0,0,0,1);J.glClear(16384);await oa(20);e("EagRuntime JS context initialization complete");return!0}
async function Vb(){Gb();ea=function(a,b){postMessage({ch:"~!LOGGER",txt:a,err:b})};e("Initializing EagRuntime worker JS context...");await Jb();C(G,"setClipboard");C(G,"getClipboard");C(G,"displayFileChooser");C(G,"fileChooserHasResult");C(G,"getFileChooserResult");C(G,"clearFileChooserResult");C(G,"downloadFileWithNameU8");C(G,"downloadFileWithNameA");C(G,"downloadScreenshot");C(G,"showDebugConsole");C(G,"addLogMessage");C(G,"isShowingDebugConsole");C(G,"getFaviconURL");Rb();C(I,"keyboardLayoutSupported");
C(I,"iterateKeyboardLayout");C(I,"updateCanvasSize");C(I,"updatePlatformAndSleep");C(I,"isVSyncSupported");C(I,"mouseSetGrabbed");C(I,"isMouseGrabSupported");C(I,"isMouseGrabbed");C(I,"isPointerLocked");C(I,"supportsFullscreen");C(I,"toggleFullscreen");C(I,"isFullscreen");C(I,"touchSetOpenKeyboardZone");C(I,"touchCloseDeviceKeyboard");C(I,"touchIsDeviceKeyboardOpenMAYBE");C(I,"gamepadSupported");C(I,"isVisualViewport");C(J,"getCapBits");C(J,"glEnable");C(J,"glDisable");C(J,"glClearColor");C(J,"glClearDepth");
C(J,"glClear");C(J,"glDepthFunc");C(J,"glDepthMask");C(J,"glCullFace");C(J,"glViewport");C(J,"glBlendFunc");C(J,"glBlendFuncSeparate");C(J,"glBlendEquation");C(J,"glBlendColor");C(J,"glColorMask");C(J,"glDrawBuffers");C(J,"glReadBuffer");C(J,"glReadPixels");C(J,"glPolygonOffset");C(J,"glLineWidth");C(J,"glGenBuffers");C(J,"glGenTextures");C(J,"glCreateProgram");C(J,"glCreateShader");C(J,"glCreateFramebuffer");C(J,"glCreateRenderbuffer");C(J,"glGenQueries");C(J,"glDeleteBuffers");C(J,"glDeleteTextures");
C(J,"glDeleteProgram");C(J,"glDeleteShader");C(J,"glDeleteFramebuffer");C(J,"glDeleteRenderbuffer");C(J,"glDeleteQueries");C(J,"glBindBuffer");C(J,"glBufferData");C(J,"glBufferSubData");C(J,"glEnableVertexAttribArray");C(J,"glDisableVertexAttribArray");C(J,"glVertexAttribPointer");C(J,"glActiveTexture");C(J,"glBindTexture");C(J,"glTexParameterf");C(J,"glTexParameteri");C(J,"glTexImage3D");C(J,"glTexImage2D");C(J,"glTexSubImage2D");C(J,"glCopyTexSubImage2D");C(J,"glTexStorage2D");C(J,"glPixelStorei");
C(J,"glGenerateMipmap");C(J,"glShaderSource");C(J,"glCompileShader");C(J,"glGetShaderi");C(J,"glGetShaderInfoLog");C(J,"glUseProgram");C(J,"glAttachShader");C(J,"glDetachShader");C(J,"glLinkProgram");C(J,"glGetProgrami");C(J,"glGetProgramInfoLog");C(J,"glDrawArrays");C(J,"glDrawElements");C(J,"glBindAttribLocation");C(J,"glGetAttribLocation");C(J,"glGetUniformLocation");C(J,"glGetUniformBlockIndex");C(J,"glBindBufferRange");C(J,"glUniformBlockBinding");C(J,"glUniform1f");C(J,"glUniform2f");C(J,"glUniform3f");
C(J,"glUniform4f");C(J,"glUniform1i");C(J,"glUniform2i");C(J,"glUniform3i");C(J,"glUniform4i");C(J,"glUniformMatrix2fv");C(J,"glUniformMatrix3fv");C(J,"glUniformMatrix4fv");C(J,"glUniformMatrix3x2fv");C(J,"glUniformMatrix4x2fv");C(J,"glUniformMatrix4x3fv");C(J,"glBindFramebuffer");C(J,"glCheckFramebufferStatus");C(J,"glBlitFramebuffer");C(J,"glRenderbufferStorage");C(J,"glFramebufferTexture2D");C(J,"glFramebufferTextureLayer");C(J,"glBindRenderbuffer");C(J,"glFramebufferRenderbuffer");C(J,"glGetInteger");
C(J,"glGetError");C(J,"getAllExtensions");C(J,"dumpActiveExtensions");C(J,"glGetString");C(J,"glGenVertexArrays");C(J,"glDeleteVertexArrays");C(J,"glBindVertexArray");C(J,"glVertexAttribDivisor");C(J,"glDrawArraysInstanced");C(J,"glDrawElementsInstanced");C(J,"isContextLost");C(Da,"getMic");C(Da,"setDataAvailableHandler");C(Ea,"isSupported");C(Ea,"createRTCPeerConnection");C(M,"supported");C(M,"clientLANReadyState");C(M,"clientLANCloseConnection");C(M,"clientLANSendPacket");C(M,"clientLANReadPacket");
C(M,"clientLANAvailable");C(M,"clientLANSetICEServersAndConnect");C(M,"clearLANClientState");C(M,"clientLANAwaitICECandidate");C(M,"clientLANAwaitDescription");C(M,"clientLANAwaitChannel");C(M,"clientLANClosed");C(M,"clientLANSetICECandidate");C(M,"clientLANSetDescription");C(M,"clientLANClosed");C(M,"serverLANInitializeServer");C(M,"serverLANCloseServer");C(M,"serverLANCreatePeer");C(Fa,"checkSupported");C(Fa,"checkCSPSupported");C(Fa,"sendStringMessage");C(Fa,"sendBinaryMessage");C(Fa,"beginShowing");
C(Fa,"resize");C(Fa,"endShowing");C(Ja,"startIntegratedServer");C(Ja,"sendPacket");C(Ja,"getAvailablePackets");C(Ja,"getNextPacket");C(Ja,"killWorker");C(Ja,"showCrashReportOverlay");C(Ja,"hideCrashReportOverlay");Wb();e("EagRuntime worker JS context initialization complete")}
function Xb(a){Za=a.buffer;e("WebAssembly direct memory resized to {} MiB",.01*(Za.byteLength/1024/10.24|0));new Uint8Array(Za);new Int8Array(Za);new Uint16Array(Za);new Int16Array(Za);new Uint32Array(Za);new Int32Array(Za);new Float32Array(Za)}const Yb=new qa;function T(a,b,d){Yb.push({eventType:a<<5|b,eventObj:d,_next:null})}let Zb=/.+:wasm-function\[[0-9]+]:0x([0-9a-f]+).*/;
function la(a){if(!a)return null;const b=[];for(let d of a.split("\n")){if(Oa&&(a=Zb.exec(d),null!==a&&2<=a.length&&(a=parseInt(a[1],16),!isNaN(a))))try{const c=Oa([a]);if(0<c.length){for(let h of c)b.push(""+h.className+"."+h.method+"("+h.file+":"+h.line+")");continue}}catch(c){}d=d.trim();d.startsWith("at ")&&(d=d.substring(3));b.push(d)}return b}
function $b(a){const b=a?la(a.stack):null;a="Native Browser Exception\n----------------------------------\n Line: "+(a&&"string"===typeof a.fileName?a.fileName:"unknown")+":"+(a&&"number"===typeof a.lineNumber?a.lineNumber:"unknown")+":"+(a&&"number"===typeof a.columnNumber?a.columnNumber:"unknown")+"\n Type: "+(a&&"string"===typeof a.name?a.name:"unknown")+"\n Desc: "+(a&&"string"===typeof a.message?a.message:"null")+"\n----------------------------------\n\nDeobfuscated stack trace:\n at "+
(b?b.join("\n at "):"null")+"\n\nThis exception was not handled by the WASM binary\n";if("undefined"!==typeof window)ac(a,!0);else if(bc){g("\n{}",a);try{bc(a,!0)}catch(d){console.log(d)}}else g("\n{}",a)}
function ac(a,b){g("Game crashed!");var d="Game Crashed! I have fallen and I can't get up!\n\n"+a+"\n\n",c='eaglercraft.version = "'+db[0]+'"\neaglercraft.minecraft = "'+db[2]+'"\neaglercraft.brand = "'+db[1]+'"\n\n'+cc()+"\nwindow.eaglercraftXOpts = "+JSON.stringify(N)+"\n\ncurrentTime = "+(new Date).toLocaleString()+"\n\n"+dc("userAgent")+dc("vendor")+dc("language")+dc("hardwareConcurrency")+dc("deviceMemory")+dc("platform")+dc("product")+ec()+"\n"+fc("localStorage")+fc("sessionStorage")+fc("indexedDB")+
"\nrootElement.clientWidth = "+(P?P.clientWidth:"undefined")+"\nrootElement.clientHeight = "+(P?P.clientHeight:"undefined")+"\n"+fc("innerWidth")+fc("innerHeight")+fc("outerWidth")+fc("outerHeight")+fc("devicePixelRatio")+gc("availWidth")+gc("availHeight")+gc("colorDepth")+gc("pixelDepth")+"\n"+hc()+"\n",h=d+c;const l=[];try{"object"===typeof N&&"object"===typeof N.hooks&&"function"===typeof N.hooks.crashReportShow&&N.hooks.crashReportShow(h,function(t){l.push(t)})}catch(t){ia("Uncaught exception invoking crash report hook",
t)}if(cb){g("");g("An additional crash report was supressed:");h=a.split(/[\r\n]+/);for(a=0;a<h.length;++a)g(" {}",h[a]);if(0<l.length)for(a=0;a<l.length;++a)if(h=l[a]){g("");g(" ----------[ CRASH HOOK ]----------");h=h.split(/[\r\n]+/);for(a=0;a<h.length;++a)g(" {}",h[a]);g(" ----------------------------------")}}else{cb=!0;if(0<l.length){h=d+"Got the following messages from the crash report hook registered in eaglercraftXOpts:\n\n";for(a=0;a<l.length;++a)h+="----------[ CRASH HOOK ]----------\n"+
l[a]+"\n----------------------------------\n\n";h+=c}(c=P||Va)?(b&&g("\n{}",h),b=document.createElement("img"),a=document.createElement("div"),b.setAttribute("style","z-index:100;position:absolute;top:10px;left:calc(50% - 151px);"),b.src=Sa,a.setAttribute("style","z-index:100;position:absolute;top:135px;left:10%;right:10%;bottom:50px;background-color:white;border:1px solid #cccccc;overflow-x:hidden;overflow-y:scroll;overflow-wrap:break-word;white-space:pre-wrap;font: 14px monospace;padding:10px;"),
a.classList.add("_eaglercraftX_crash_element"),c.appendChild(b),c.appendChild(a),a.appendChild(document.createTextNode(h)),eb&&eb(),window.__curEaglerX188UnloadListenerCB=null):(alert("Root element not found, crash report was printed to console"),g("\n{}",h))}}
function Tb(a){if(!cb){cb=!0;var b=P||Va;g("Compatibility error: {}",a);if(b){var d=document.createElement("img"),c=document.createElement("div");d.setAttribute("style","z-index:100;position:absolute;top:10px;left:calc(50% - 151px);");d.src=Sa;c.setAttribute("style","z-index:100;position:absolute;top:135px;left:10%;right:10%;bottom:50px;background-color:white;border:1px solid #cccccc;overflow-x:hidden;overflow-y:scroll;font:18px sans-serif;padding:40px;");c.classList.add("_eaglercraftX_incompatible_element");
b.appendChild(d);b.appendChild(c);c.innerHTML='<h2><svg style="vertical-align:middle;margin:0px 16px 8px 8px;" xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="none"><path stroke="#000000" stroke-width="3" stroke-linecap="square" d="M1.5 8.5v34h45v-28m-3-3h-10v-3m-3-3h-10m15 6h-18v-3m-3-3h-10"/><path stroke="#000000" stroke-width="2" stroke-linecap="square" d="M12 21h0m0 4h0m4 0h0m0-4h0m-2 2h0m20-2h0m0 4h0m4 0h0m0-4h0m-2 2h0"/><path stroke="#000000" stroke-width="2" stroke-linecap="square" d="M20 30h0 m2 2h0 m2 2h0 m2 2h0 m2 -2h0 m2 -2h0 m2 -2h0"/></svg>+ This device is incompatible with Eaglercraft&ensp;:(</h2><div style="margin-left:40px;"><p style="font-size:1.2em;"><b style="font-size:1.1em;">Issue:</b> <span style="color:#BB0000;" id="_eaglercraftX_crashReason"></span><br /></p><p style="margin-left:10px;font:0.9em monospace;" id="_eaglercraftX_crashUserAgent"></p><p style="margin-left:10px;font:0.9em monospace;" id="_eaglercraftX_crashWebGL"></p><p style="margin-left:10px;font:0.9em monospace;">Current Date: '+
(new Date).toLocaleString()+'</p><p><br /><span style="font-size:1.1em;border-bottom:1px dashed #AAAAAA;padding-bottom:5px;">Things you can try:</span></p><ol><li><span style="font-weight:bold;">Just try using Eaglercraft on a different device</span>, it isn\'t a bug it\'s common sense</li><li style="margin-top:7px;">If this screen just appeared randomly, try restarting your browser or device</li><li style="margin-top:7px;">If you are not using Chrome/Edge, try installing the latest Google Chrome</li><li style="margin-top:7px;">If your browser is out of date, please update it to the latest version</li></ol></div>';
c.querySelector("#_eaglercraftX_crashReason").appendChild(document.createTextNode(a));try{var h=window.navigator.userAgent}catch(t){h="<error>"}c.querySelector("#_eaglercraftX_crashUserAgent").appendChild(document.createTextNode(h));eb&&eb();window.__curEaglerX188UnloadListenerCB=null;a="No GL_RENDERER string could be queried";try{const t=document.createElement("canvas");t.width=64;t.height=64;const D=t.getContext("webgl");if(D){if(D.getExtension("WEBGL_debug_renderer_info"))var l=D.getParameter(37446);
else(l=D.getParameter(WebGLRenderingContext.RENDERER))&&(l+=" [masked]");l&&(a=l)}}catch(t){}c.querySelector("#_eaglercraftX_crashWebGL").appendChild(document.createTextNode(a))}else alert("Compatibility error: "+a)}}var ic=null;
function cc(){if(ic)return ic;try{var a=Wa,b=Xa;if(!a){b=!1;var d=document.createElement("canvas");d.width=64;d.height=64;a=d.getContext("webgl2");a||(a=d.getContext("webgl"),a||(b=!0,a=d.getContext("experimental-webgl")))}return a?(d="",0<Ya&&(d+="webgl.version = "+a.getParameter(7938)+"\n"),d=a.getExtension("WEBGL_debug_renderer_info")?d+("webgl.renderer = "+a.getParameter(37446)+"\nwebgl.vendor = "+a.getParameter(37445)+"\n"):d+("webgl.renderer = "+a.getParameter(7937)+" [masked]\nwebgl.vendor = "+
a.getParameter(7936)+" [masked]\n"),0<Ya?(d+="\nwebgl.version.id = "+Ya+"\nwebgl.experimental = "+b,200===Ya?d+="\nwebgl.ext.ANGLE_instanced_arrays = "+!!a.getExtension("ANGLE_instanced_arrays")+"\nwebgl.ext.EXT_color_buffer_half_float = "+!!a.getExtension("EXT_color_buffer_half_float")+"\nwebgl.ext.EXT_shader_texture_lod = "+!!a.getExtension("EXT_shader_texture_lod")+"\nwebgl.ext.OES_fbo_render_mipmap = "+!!a.getExtension("OES_fbo_render_mipmap")+"\nwebgl.ext.OES_texture_float = "+!!a.getExtension("OES_texture_float")+
"\nwebgl.ext.OES_texture_half_float = "+!!a.getExtension("OES_texture_half_float")+"\nwebgl.ext.OES_texture_half_float_linear = "+!!a.getExtension("OES_texture_half_float_linear"):300<=Ya&&(d+="\nwebgl.ext.EXT_color_buffer_float = "+!!a.getExtension("EXT_color_buffer_float")+"\nwebgl.ext.EXT_color_buffer_half_float = "+!!a.getExtension("EXT_color_buffer_half_float")+"\nwebgl.ext.OES_texture_float_linear = "+!!a.getExtension("OES_texture_float_linear")),d+="\nwebgl.ext.EXT_texture_filter_anisotropic = "+
!!a.getExtension("EXT_texture_filter_anisotropic")+"\n"):d+="webgl.ext.ANGLE_instanced_arrays = "+!!a.getExtension("ANGLE_instanced_arrays")+"\nwebgl.ext.EXT_color_buffer_float = "+!!a.getExtension("EXT_color_buffer_float")+"\nwebgl.ext.EXT_color_buffer_half_float = "+!!a.getExtension("EXT_color_buffer_half_float")+"\nwebgl.ext.EXT_shader_texture_lod = "+!!a.getExtension("EXT_shader_texture_lod")+"\nwebgl.ext.OES_fbo_render_mipmap = "+!!a.getExtension("OES_fbo_render_mipmap")+"\nwebgl.ext.OES_texture_float = "+
!!a.getExtension("OES_texture_float")+"\nwebgl.ext.OES_texture_float_linear = "+!!a.getExtension("OES_texture_float_linear")+"\nwebgl.ext.OES_texture_half_float = "+!!a.getExtension("OES_texture_half_float")+"\nwebgl.ext.OES_texture_half_float_linear = "+!!a.getExtension("OES_texture_half_float_linear")+"\nwebgl.ext.EXT_texture_filter_anisotropic = "+!!a.getExtension("EXT_texture_filter_anisotropic")+"\n",ic=d):ic="Failed to query GPU info!\n"}catch(c){return ic="ERROR: could not query webgl info - "+
c+"\n"}}function dc(a){try{var b=window.navigator[a]}catch(d){b="<error>"}return"window.navigator."+a+" = "+b+"\n"}function ec(){try{var a=[];if("object"===typeof navigator.plugins){var b=navigator.plugins.length;if(0<b)for(var d=0;d<b;++d){var c=navigator.plugins[d];a.push({name:c.name,filename:c.filename,desc:c.description})}}var h=JSON.stringify(a)}catch(l){h="<error>"}return"window.navigator.plugins = "+h+"\n"}
function gc(a){try{var b=window.screen[a]}catch(d){b="<error>"}return"window.screen."+a+" = "+b+"\n"}function hc(){try{var a=window.location.href}catch(b){a="<error>"}return"window.location.href = "+a+"\n"}function fc(a){try{var b=window[a]}catch(d){b="<error>"}return"window."+a+" = "+b+"\n"};function jc(a,b,d){const c=document.createElement("a");c.style.position="absolute";c.style.left="0px";c.style.top="0px";c.style.zIndex="-100";c.style.color="transparent";c.innerText="Download File";c.href=b;c.target="_blank";c.download=a;P.appendChild(c);setTimeout(function(){c.click();setTimeout(function(){P.removeChild(c)},50);d&&setTimeout(d,6E4)},50)}var kc=0,lc=null,mc=null,nc=null,oc=null;
function Ib(a,b){if(nc)oc&&oc(a,b);else for(a={msg:a,err:b,next:null},mc&&(mc.next=a),lc||=a,mc=a,++kc;256<kc;)--kc,lc&&=lc.next}
function Kb(){function a(){t=!1;D=null;null!==B?(P.removeChild(B),y=B=null):null!==y&&(P.removeChild(y),y=null)}function b(m){try{window.localStorage&&window.localStorage.setItem(K,m?"true":"false")}catch(u){}}function d(){try{if(window.localStorage){const m=window.localStorage.getItem(K);return m&&"true"===m.toLowerCase()}return!1}catch(m){return!1}}function c(){if(nc)nc.focus();else{var m=Math.round(1E3*window.devicePixelRatio);const u=Math.round(400*window.devicePixelRatio);if(nc=window.open("",
"_blank","top="+Math.round((window.screen.height-u)/2)+",left="+Math.round((window.screen.width-m)/2)+",width="+m+",height="+u+",menubar=0,status=0,titlebar=0,toolbar=0")){nc.focus();v=nc.document;v.write('<!DOCTYPE html><html><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Debug Console</title><link type="image/png" rel="shortcut icon" href="'+Ta+'" /></head><body style="overflow-x:hidden;overflow-y:scroll;padding:0px;"><p id="loggerMessageContainer" style="overflow-wrap:break-word;white-space:pre-wrap;font:14px monospace;padding:10px;"></p></body></html>');
v.close();S=v.body;U=v.getElementById("loggerMessageContainer");for(m=lc;m;)h(m.msg+"\n",m.err?"#DD0000":"#000000"),m=m.next;mc=lc=null;kc=0;l();m=()=>{null!=nc&&(nc=null,b(!1))};nc.addEventListener("beforeunload",m);nc.addEventListener("unload",m)}else g("Logger popup was blocked!"),window.alert("ERROR: Popup blocked!\n\nPlease make sure you have popups enabled for this site!")}}function h(m,u){var w=v.createElement("span");w.innerText=m;w.style.color=u;U.appendChild(w);for(m=U.children;2048<m.length;)m[0].remove()}
function l(){setTimeout(()=>{nc.scrollTo(0,S.scrollHeight||S.clientHeight)},1)}G.setClipboard=function(m){try{if(window.navigator.clipboard)return window.navigator.clipboard.writeText(m),!0}catch(u){g("Failed to set clipboard data!")}return!1};G.getClipboard=new WebAssembly.Suspending(async function(){var m=null;try{window.navigator.clipboard&&(m=await navigator.clipboard.readText())}catch(u){g("Failed to read clipboard data!")}return m});var t=!1,D=null,y=null,B=null;G.displayFileChooser=function(m,
u){a();if($a){const f=B=document.createElement("div");f.classList.add("_eaglercraftX_mobile_file_chooser_popup");f.style.position="absolute";f.style.backgroundColor="white";f.style.fontFamily="sans-serif";f.style.top="10%";f.style.left="10%";f.style.right="10%";f.style.border="5px double black";f.style.padding="15px";f.style.textAlign="left";f.style.fontSize="20px";f.style.userSelect="none";f.style.zIndex="150";var w=document.createElement("h3");w.appendChild(document.createTextNode("File Chooser"));
f.appendChild(w);w=document.createElement("p");const x=y=document.createElement("input");x.type="file";x.accept=null===m?"."+u:m;x.multiple=!1;w.appendChild(x);f.appendChild(w);m=document.createElement("p");u=document.createElement("button");u.classList.add("_eaglercraftX_mobile_file_chooser_btn_cancel");u.style.fontSize="1.0em";u.addEventListener("click",function(){B===f&&(P.removeChild(f),y=B=null)});u.appendChild(document.createTextNode("Cancel"));m.appendChild(u);m.appendChild(document.createTextNode(" "));
u=document.createElement("button");u.classList.add("_eaglercraftX_mobile_file_chooser_btn_done");u.style.fontSize="1.0em";u.style.fontWeight="bold";u.addEventListener("click",function(){if(B===f){if(0<x.files.length){const p=x.files[0];p.arrayBuffer().then(function(z){t=!0;D={fileName:p.name,fileData:z}}).catch(function(){t=!0;D=null})}else t=!0,D=null;P.removeChild(f);y=B=null}});u.appendChild(document.createTextNode("Done"));m.appendChild(u);f.appendChild(m);P.appendChild(f)}else{const f=y=document.createElement("input");
f.type="file";f.style.position="absolute";f.style.left="0px";f.style.top="0px";f.style.zIndex="-100";f.accept=null===m?"."+u:m;f.multiple=!1;f.addEventListener("change",function(){if(y===f){if(0<f.files.length){const x=f.files[0];x.arrayBuffer().then(function(p){t=!0;D={fileName:x.name,fileData:p}}).catch(function(){t=!0;D=null})}else t=!0,D=null;P.removeChild(f);y=null}});P.appendChild(f);window.setTimeout(function(){f.click()},50)}};G.fileChooserHasResult=function(){return t};G.getFileChooserResult=
function(){t=!1;const m=D;D=null;return m};G.clearFileChooserResult=a;G.downloadFileWithNameU8=function(m,u){const w=URL.createObjectURL(new Blob([u],{type:"application/octet-stream"}));jc(m,w,function(){URL.revokeObjectURL(w)})};G.downloadFileWithNameA=function(m,u){const w=URL.createObjectURL(new Blob([u],{type:"application/octet-stream"}));jc(m,w,function(){URL.revokeObjectURL(w)})};G.downloadScreenshot=function(m,u){jc(m,u.toDataURL("image/png"),null)};var v=null,S=null,U=null;const K=fb+"showDebugConsole",
r=hb?"beforeunload":"unload";try{window.addEventListener(r,()=>{if(nc){var m=nc;U=S=v=nc=null;m.close()}})}catch(m){}(gb||d())&&c();oc=function(m,u){var w=nc.innerHeight+nc.pageYOffset>=S.offsetHeight;h(m+"\n",u?"#DD0000":"#000000");w&&l()};G.showDebugConsole=function(){b(!0);c()};G.addLogMessage=Ib;G.isShowingDebugConsole=function(){return!!nc};G.getFaviconURL=function(){return Ta}};wa.getEPKFileData=function(a){const b=Pa[a];Pa[a]=null;return b};wa.getEPKFileCount=function(){return Pa.length};
if("undefined"!==typeof window){wa.loadImageFile0=new WebAssembly.Suspending(function(a,b){return new Promise(function(d){const c=URL.createObjectURL(new Blob([a],{type:b}));if(c){const h=document.createElement("img");h.addEventListener("load",function(){URL.revokeObjectURL(c);d({width:h.width,height:h.height,img:h})});h.addEventListener("error",function(){URL.revokeObjectURL(c);d(null)});h.src=c}else d(null)})});var pc=null,qc=null;wa.loadImageFile1=function(a,b){const d=a.width,c=a.height;if(a=
a.img)pc||=document.createElement("canvas"),pc.width<d&&(pc.width=d),pc.height<c&&(pc.height=c),qc||(qc=pc.getContext("2d",{willReadFrequently:!0}),qc.imageSmoothingEnabled=!1),qc.clearRect(0,0,d,c),qc.drawImage(a,0,0,d,c),b.set(qc.getImageData(0,0,d,c).data,0)}}else C(wa,"loadImageFile0"),C(wa,"loadImageFile1");function Qb(a){xa.getContext=function(){return a};xa.registerIsEndedHandler=function(b,d){d.selfEndHandler||(d.selfEndHandler=function(){d.isEnded=!0});b.addEventListener("ended",d.selfEndHandler)};xa.releaseIsEndedHandler=function(b,d){d.selfEndHandler&&b.removeEventListener("ended",d.selfEndHandler)};xa.decodeAudioBrowser=new WebAssembly.Suspending(function(b,d){return new Promise(function(c){const h=new Uint8Array(b.length);h.set(b,0);a.decodeAudioData(h.buffer,c,function(){g("Failed to load audio: {}",
d);c(null)})})})}function Rb(){xa.getContext=function(){return null};C(xa,"registerIsEndedHandler");C(xa,"releaseIsEndedHandler");C(xa,"decodeAudioBrowser")};function rc(a){return"string"===typeof a?a:"undefined"===typeof a?null:"string"===typeof a[0]?a[0]:null}function sc(a){return"undefined"===typeof a?null:"undefined"===typeof a.data?null:a.data}
ya.openDB=new WebAssembly.Suspending(function(a){return new Promise(function(b){if("undefined"===typeof indexedDB)b({failedInit:!0,failedLocked:!1,failedError:"IndexedDB not supported",database:null});else{try{var d=indexedDB.open(a,1)}catch(h){b({failedInit:!0,failedLocked:!1,failedError:"Exception opening database",database:null});return}var c=b;d.addEventListener("success",function(){c&&c({failedInit:!1,failedLocked:!1,failedError:null,database:d.result});c=null});d.addEventListener("blocked",
function(){c&&c({failedInit:!1,failedLocked:!0,failedError:"Database is locked",database:null});c=null});d.addEventListener("error",function(){c&&c({failedInit:!0,failedLocked:!1,failedError:"Opening database failed",database:null});c=null});d.addEventListener("upgradeneeded",function(){d.result.createObjectStore("filesystem",{keyPath:["path"]})})}})});
function tc(a,b){return new Promise(function(d){const c=a.transaction("filesystem","readwrite").objectStore("filesystem").delete([b]);c.addEventListener("success",function(){d(!0)});c.addEventListener("error",function(){d(!1)})})}ya.eaglerDelete=new WebAssembly.Suspending(tc);
function uc(a,b){return new Promise(function(d){const c=a.transaction("filesystem","readonly").objectStore("filesystem").get([b]);c.addEventListener("success",function(){d(sc(c.result))});c.addEventListener("error",function(){d(null)})})}ya.eaglerRead=new WebAssembly.Suspending(uc);
function vc(a,b,d){return new Promise(function(c){const h=a.transaction("filesystem","readwrite").objectStore("filesystem").put({path:b,data:d});h.addEventListener("success",function(){c(!0)});h.addEventListener("error",function(){c(!1)})})}ya.eaglerWrite=new WebAssembly.Suspending(vc);
ya.eaglerExists=new WebAssembly.Suspending(function(a,b){return new Promise(function(d){const c=a.transaction("filesystem","readonly").objectStore("filesystem").count([b]);c.addEventListener("success",function(){d(0<c.result)});c.addEventListener("error",function(){d(!1)})})});ya.eaglerMove=new WebAssembly.Suspending(async function(a,b,d){const c=await uc(a,b);return c&&await vc(a,d,c)?await tc(a,b):!1});
ya.eaglerCopy=new WebAssembly.Suspending(async function(a,b,d){return(b=await uc(a,b))&&await vc(a,d,b)});ya.eaglerSize=new WebAssembly.Suspending(function(a,b){return new Promise(function(d){const c=a.transaction("filesystem","readonly").objectStore("filesystem").get([b]);c.addEventListener("success",function(){const h=sc(c.result);d(h?h.byteLength:-1)});c.addEventListener("error",function(){d(-1)})})});
function wc(a){if(0===a.length)return-1;for(var b=0,d=0,c=a.length;d<c;++d)47===a.charCodeAt(d)&&++b;return b}
ya.eaglerIterate=new WebAssembly.Suspending(function(a,b,d){return new Promise(function(c){const h=[],l=a.transaction("filesystem","readonly").objectStore("filesystem").openCursor(),t=0===b.length,D=d?-1:wc(b);l.addEventListener("success",function(){const y=l.result;if(null===y||null===y.key)c({length:h.length,getRow:function(v){return h[v]}});else{var B=rc(y.key);null!=B&&(!t&&!B.startsWith(b)||!d&&wc(B)!==D||h.push(B));y.continue()}});l.addEventListener("error",function(){c(null)})})});async function Sb(){function a(){var k=window.devicePixelRatio;.01>k&&(k=1);U=S=0;for(var A=R;A&&!isNaN(A.offsetLeft)&&!isNaN(A.offsetTop);)S+=A.offsetLeft-A.scrollLeft,U+=A.offsetTop-A.scrollTop,A=A.offsetParent;A=P.clientWidth*k|0;var V=P.clientHeight*k|0,W=0,ca=0,sa=A,ja=V;if(O){ja=window.visualViewport;var Y=ja.scale;W=ja.pageLeft*k*Y;ca=ja.pageTop*k*Y;sa=ja.width*k*Y;ja=ja.height*k*Y;1>sa&&(sa=1);1>ja&&(ja=1);0>W?(sa+=W,W=0):W>=A&&(W=A-1);0>ca?(ja+=ca,ca=0):ca>=V&&(ca=V-1);W+sa>A&&(sa=A-W);ca+
ja>V&&(ja=V-ca)}Y={eventTypeMask:0};H!==k&&(H=k,Y.eventTypeMask|=4,Y.windowDPI=k);if(z!==A||E!==V)z=A,E=V,Y.eventTypeMask|=1,Y.windowWidth=A,Y.windowHeight=V;if(ma!==W||Z!==ca||X!==sa||Ga!==ja)ma=W,Z=ca,X=sa,Ga=ja,Y.eventTypeMask|=2,Y.visualViewportX=W,Y.visualViewportY=ca,Y.visualViewportW=sa,Y.visualViewportH=ja;0!==Y.eventTypeMask&&T(0,9,Y)}function b(k){const A=k.length,V=Array(A);for(var W=0;W<A;++W){const ca=k.item(W);V[W]={pointX:ca.pageX-S,pointY:ca.pageY-U,radius:.5*(ca.radiusX+ca.radiusY),
force:ca.force,pointUID:ca.identifier}}return V}function d(k,A){return{eventType:k,keyCode:A.code||null,keyName:A.key||null,legacyCode:"number"===typeof A.which?A.which:"number"===typeof A.keyCode?A.keyCode:0,location:A.location,mods:(A.ctrlKey?1:0)|(A.shiftKey?2:0)|(A.metaKey?4:0)}}function c(){return new Promise(function(k){if(-1!==q)throw Error("Main thread is already waiting for VSync!");const A=[!1];window.requestAnimationFrame(function(){A[0]||(A[0]=!0,-1!==q&&(window.clearTimeout(q),q=-1),
k())});q=window.setTimeout(function(){A[0]||(A[0]=!0,q=-1,k())},20)})}function h(k){return new Promise(function(A){setTimeout(A,k)})}function l(k){if(Aa){Ba=!!k;var A=performance.now()|0;if(k){try{R.requestPointerLock()}catch(V){}-1!==ta&&window.clearTimeout(ta);ta=-1;3E3>A-Ha&&(ta=window.setTimeout(function(){try{R.requestPointerLock()}catch(V){}},3100-(A-Ha)))}else{-1!==ta&&window.clearTimeout(ta);ta=-1;try{document.exitPointerLock()}catch(V){}}}}function t(){if(Ia)if(ua.matches){if(ka)try{navigator.keyboard.unlock()}catch(k){}try{document.exitFullscreen()}catch(k){}}else{if(ka)try{navigator.keyboard.lock()}catch(k){}try{R.requestFullscreen()}catch(k){}}}
function D(){B()?y():r?(r.blur(),r.value="",setTimeout(function(){r&&(K?K.removeChild(r):r.remove(),r=null);K&&(P.removeChild(K),K=null)},10)):(K&&(P.removeChild(K),K=null),K=document.createElement("form"),K.setAttribute("autocomplete","off"),K.classList.add("_eaglercraftX_text_input_wrapper"),K.style.position="absolute",K.style.top="0px",K.style.left="0px",K.style.right="0px",K.style.bottom="0px",K.style.zIndex="-100",K.style.margin="0px",K.style.padding="0px",K.style.border="none",K.addEventListener("submit",
function(k){k.preventDefault();k.stopPropagation();k=k.timeStamp;k&&(0!==f&&10>k-f||0!==x&&10>k-x||0!==p&&10>k-p)||(w||(e("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"),w=!0),T(0,3,{eventType:0,absoluteCode:28,absoluteChar:10}))}),r=document.createElement("input"),r.type="password",r.value=" ",r.classList.add("_eaglercraftX_text_input_element"),r.setAttribute("autocomplete",
"off"),r.style.position="absolute",r.style.top="0px",r.style.left="0px",r.style.right="0px",r.style.bottom="0px",r.style.zIndex="-100",r.style.margin="0px",r.style.padding="0px",r.style.border="none",r.style.setProperty("-webkit-touch-callout","default"),r.addEventListener("beforeinput",function(k){if(r===k.target){m||(e("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"),
m=!0);var A=k.timeStamp;if(A){if(0!==f&&10>A-f)return;x=A}k.preventDefault();k.stopPropagation();switch(k.inputType){case "insertParagraph":case "insertLineBreak":T(0,3,{eventType:0,absoluteCode:28,absoluteChar:10});break;case "deleteWordBackward":case "deleteSoftLineBackward":case "deleteHardLineBackward":case "deleteEntireSoftLine":case "deleteContentBackward":case "deleteContent":T(0,3,{eventType:0,absoluteCode:14,absoluteChar:0});break;case "deleteWordForward":case "deleteSoftLineForward":case "deleteHardLineForward":case "deleteContentForward":T(0,
3,{eventType:0,absoluteCode:211,absoluteChar:0});break;case "insertText":case "insertCompositionText":case "insertReplacementText":(k=k.data)&&0<k.length&&T(0,3,{eventType:1,codepoints:k});break;case "insertFromPaste":case "insertFromPasteAsQuotation":case "insertFromDrop":case "insertFromYank":case "insertLink":(k=k.data)&&0<k.length&&T(0,4,k);break;case "historyUndo":case "historyRedo":case "deleteByDrag":case "deleteByCut":break;default:e('Ignoring InputEvent.inputType "{}" from on-screen keyboard',
k.inputType)}}}),r.addEventListener("input",function(k){if(r===k.target){u||(e("Note: Caught legacy input events from on-screen keyboard, browser could be outdated and doesn't support beforeinput event, or does not respond to cancelling beforeinput"),u=!0);if(k=k.timeStamp){if(0!==f&&10>k-f||0!==x&&10>k-x)return;p=k}k=r.value;var A=k.length;0===A?T(0,3,{eventType:0,absoluteCode:14,absoluteChar:0}):1===A?T(0,3,{eventType:1,codepoints:k}):(k=k.trim(),A=k.length,0===A?T(0,3,{eventType:0,absoluteCode:57,
absoluteChar:32}):T(0,3,{eventType:1,codepoints:k.charAt(A-1)}));r.value=" ";r.setSelectionRange(1,1)}}),r.addEventListener("focus",function(k){r===k.target&&(r.value=" ",r.setSelectionRange(1,1))}),r.addEventListener("select",function(k){r===k.target&&(k.preventDefault(),k.stopPropagation(),r.value=" ",r.setSelectionRange(1,1))}),K.appendChild(r),P.appendChild(K),r.value=" ",r.focus(),r.select(),r.setSelectionRange(1,1))}function y(){if(r){r.blur();r.value="";const k=r,A=K;window.setTimeout(function(){null!==
A?(A.removeChild(k),A.remove()):k.remove()},10);K=r=null}else K&&(P?P.removeChild(K):K.remove(),K=null)}function B(){return!!r&&document.activeElement===r}var v=null,S=0,U=0,K=null,r=null,m=!1,u=!1,w=!1,f=0,x=0,p=0,z=-1,E=-1,H=-1,O=!1,ma=-1,Z=-1,X=-1,Ga=-1,Aa=!1,Ba=!1,Ha=0,ta=-1,Ia=!1,ua=null,ka=!1,n=!1,q=-1,F=!1,L=null,Q=null,aa=null,pa=null,Ra=null,ib=null,jb=null,kb=null,lb=null,mb=null,nb=null,ob=null,pb=null,qb=null,rb=null,sb=null,tb=null,ub=null,vb=null,wb=null,xb=null,yb=null;v=document.createElement("div");
v.classList.add("_eaglercraftX_keyboard_open_zone");v.style.display="none";v.style.position="absolute";v.style.backgroundColor="transparent";v.style.top="0px";v.style.left="0px";v.style.width="0px";v.style.height="0px";v.style.zIndex="100";v.style.touchAction="pan-x pan-y";v.style.setProperty("-webkit-touch-callout","none");v.style.setProperty("-webkit-tap-highlight-color","rgba(255, 255, 255, 0)");P.appendChild(v);a();P.addEventListener("contextmenu",L=function(k){k.preventDefault();k.stopPropagation()});
R.addEventListener("mousedown",Q=function(k){k.preventDefault();k.stopPropagation();Aa&&Ba&&document.pointerLockElement!==R?l(1):T(0,0,{eventType:0,posX:k.offsetX,posY:k.offsetY,button:k.button})});R.addEventListener("mouseup",aa=function(k){k.preventDefault();k.stopPropagation();T(0,0,{eventType:1,posX:k.offsetX,posY:k.offsetY,button:k.button})});R.addEventListener("mousemove",pa=function(k){k.preventDefault();k.stopPropagation();T(0,0,{eventType:2,posX:k.offsetX,posY:k.offsetY,movementX:k.movementX,
movementY:k.movementY})});R.addEventListener("mouseenter",Ra=function(){T(0,7,null)});R.addEventListener("mouseleave",ib=function(){T(0,8,null)});R.addEventListener("touchstart",jb=function(k){k.preventDefault();k.stopPropagation();T(0,2,{eventType:0,changedTouches:b(k.changedTouches),targetTouches:b(k.targetTouches)});y()});R.addEventListener("touchend",kb=function(k){k.preventDefault();k.stopPropagation();T(0,2,{eventType:2,changedTouches:b(k.changedTouches),targetTouches:b(k.targetTouches)})});
R.addEventListener("touchmove",lb=function(k){k.preventDefault();k.stopPropagation();T(0,2,{eventType:1,changedTouches:b(k.changedTouches),targetTouches:b(k.targetTouches)})});R.addEventListener("touchcancel",mb=function(k){T(0,2,{eventType:2,changedTouches:b(k.changedTouches),targetTouches:b(k.targetTouches)})});R.addEventListener("wheel",ub=function(k){k.preventDefault();k.stopPropagation();T(0,0,{eventType:3,posX:k.offsetX,posY:k.offsetY,wheel:k.deltaY})});window.addEventListener("blur",wb=function(){T(0,
6,null)});window.addEventListener("focus",vb=function(){T(0,5,null)});window.addEventListener("keydown",pb=function(k){k.preventDefault();k.stopPropagation();"F11"!==k.key||k.repeat?(T(0,1,d(k.repeat?2:0,k)),k.timeStamp&&"Unidentified"!==k.key&&(f=k.timeStamp)):t()});window.addEventListener("keyup",qb=function(k){k.preventDefault();k.stopPropagation();T(0,1,d(1,k))});v.addEventListener("touchstart",rb=function(k){k.preventDefault();k.stopPropagation()});v.addEventListener("touchend",sb=function(k){k.preventDefault();
k.stopPropagation();D()});v.addEventListener("touchmove",tb=function(k){k.preventDefault();k.stopPropagation()});(Aa="function"===typeof document.exitPointerLock)?document.addEventListener("pointerlockchange",xb=function(){window.setTimeout(function(){const k=document.pointerLockElement===R;k||Ba&&(Ha=performance.now()|0);Ba=k},60)}):g("Pointer lock is not supported on this browser");(Ia="function"===typeof document.exitFullscreen)?(ua=window.matchMedia("(display-mode: fullscreen)"),(ka=!(!navigator.keyboard||
!navigator.keyboard.lock))&&ua.addEventListener("change",yb=function(){ua.matches||navigator.keyboard.unlock()})):g("Fullscreen is not supported on this browser");if("undefined"!==typeof window.visualViewport)if("body"===Va.tagName.toLowerCase())O=!0;else{const k=document.body;10>=Math.abs(k.clientWidth-P.clientWidth)&&10>=Math.abs(k.clientHeight-P.clientHeight)&&(O=!0)}else O=!1;O&&e("Note: Detected game is embedded in body, some screens may be resized to window.visualViewport instead for a better mobile experience");
try{await c(),n=!0}catch(k){n=!1}n||g("VSync is not supported on this browser");(F="function"===typeof navigator.getGamepads)?(window.addEventListener("gamepadconnected",nb=function(){T(0,10,{eventType:0})}),window.addEventListener("gamepaddisconnected",ob=function(k){T(0,10,{eventType:1,gamepad:k.gamepad})})):g("Gamepad detected as unsupported!");I.keyboardLayoutSupported=function(){return!(!navigator.keyboard||!navigator.keyboard.getLayoutMap)};I.iterateKeyboardLayout=new WebAssembly.Suspending(async function(){const k=
[];try{const A=await navigator.keyboard.getLayoutMap();A&&A.forEach&&A.forEach(function(V,W){k.push({key:V,value:W})})}catch(A){}return k});I.updateCanvasSize=function(k,A){R.width!==k&&(R.width=k);R.height!==A&&(R.height=A)};var va=0;I.updatePlatformAndSleep=new WebAssembly.Suspending(function(k,A){a();if("string"!==typeof document.visibilityState||"visible"===document.visibilityState){if(n&&A)return va=0,c();if(0>=k)return va=0,Fb?xc(0):yc();a:{if(0<k&&1E3>k)if(0===va)va=performance.now();else{A=
performance.now();const V=1E3/k;k=A-va;2E3<k||0>k?(k=V,va=A):va+=V;if(0<=k&&k<V){A=h(V-k);break a}}else va=0;A=Fb?xc(0):yc()}return A}va=0;return h(50)});I.isVSyncSupported=function(){return n};I.mouseSetGrabbed=l;I.isMouseGrabSupported=function(){return Aa};I.isMouseGrabbed=function(){return Ba};I.isPointerLocked=function(){return Aa&&document.pointerLockElement===R};I.supportsFullscreen=function(){return Ia};I.toggleFullscreen=t;I.isFullscreen=function(){return Ia&&ua.matches};I.touchSetOpenKeyboardZone=
function(k,A,V,W){0!==V&&0!==W?(v.style.display="block",v.style.top=""+(E-A-W)/H+"px",v.style.left=""+k/H+"px",v.style.width=""+V/H+"px",v.style.height=""+W/H+"px"):(v.style.display="none",v.style.top="0px",v.style.left="0px",v.style.width="0px",v.style.height="0px")};I.touchCloseDeviceKeyboard=y;I.touchIsDeviceKeyboardOpenMAYBE=B;I.gamepadSupported=function(){return F};I.isVisualViewport=function(){return O};eb=function(){try{L&&(P.removeEventListener("contextmenu",L),L=null),Q&&(R.removeEventListener("mousedown",
Q),Q=null),aa&&(R.removeEventListener("mouseup",aa),aa=null),pa&&(R.removeEventListener("mousemove",pa),pa=null),Ra&&(R.removeEventListener("mouseenter",Ra),Ra=null),ib&&(R.removeEventListener("mouseleave",ib),ib=null),jb&&(R.removeEventListener("touchstart",jb),jb=null),kb&&(R.removeEventListener("touchend",kb),kb=null),lb&&(R.removeEventListener("touchmove",lb),lb=null),mb&&(R.removeEventListener("touchcancel",mb),mb=null),nb&&(window.removeEventListener("gamepadconnected",nb),nb=null),ob&&(window.removeEventListener("gamepaddisconnected",
ob),ob=null),pb&&(window.removeEventListener("keydown",pb),pb=null),qb&&(window.removeEventListener("keyup",qb),qb=null),rb&&(v.removeEventListener("touchstart",rb),rb=null),sb&&(v.removeEventListener("touchend",sb),sb=null),tb&&(v.removeEventListener("touchmove",tb),tb=null),ub&&(R.removeEventListener("wheel",ub),ub=null),vb&&(window.removeEventListener("focus",vb),vb=null),wb&&(window.removeEventListener("blur",wb),wb=null),xb&&(document.removeEventListener("pointerlockchange",xb),xb=null),yb&&
(ua.removeEventListener("change",yb),yb=null)}catch(k){g("Failed to remove event listeners! {}",k)}eb=null}};(function(){function a(){this._socket.close()}function b(f){this._socket.send(f)}function d(f){this._socket.send(f)}function c(){return this._frameCountStr+this._frameCountBin}function h(){const f=this._queue;return f?(f._next===f&&f._prev===f?this._queue=null:(this._queue=f._next,f._prev._next=f._next,f._next._prev=f._prev),f._next=null,f._prev=null,0===f.type?--this._frameCountStr:--this._frameCountBin,f):null}function l(){var f=this._frameCountStr+this._frameCountBin;if(0===f)return null;f=Array(f);
var x=0,p=this._queue;const z=p;do{f[x++]=p;var E=p._next;p._next=null;p._prev=null;p=E}while(p!==z);this._queue=null;this._frameCountBin=this._frameCountStr=0;return f}function t(){this._queue=null;this._frameCountBin=this._frameCountStr=0}function D(f,x){var p=f._queue;if(!p)return null;const z=p;do{var E=p._next;if(p.type===x)return x=p._prev,E===p&&x===p?f._queue=null:(p===z&&(f._queue=E),x._next=E,E._prev=x),p._next=null,p._prev=null,p;p=E}while(p!==z);return null}function y(f,x,p){var z=0,E=
f._queue,H=E;do{var O=E._next;E.type===x&&(p[z++]=E);E=O}while(E!==H);p.length=z;for(H=0;H<z;++H)E=p[H],O=E._next,x=E._prev,O===E&&x===E?f._queue=null:(E===f._queue&&(f._queue=O),x._next=O,O._prev=x)}function B(){return this._frameCountStr}function v(){if(0===this._frameCountStr)return null;const f=D(this,0);f?--this._frameCountStr:this._frameCountStr=0;return f}function S(){var f=this._frameCountStr;if(0===f)return null;f=Array(f);y(this,0,f);this._frameCountStr=0;return f}function U(){const f=this._frameCountStr;
if(0===f)return null;y(this,0,Array(f));this._frameCountStr=0}function K(){return this._frameCountBin}function r(){if(0===this._frameCountBin)return null;const f=D(this,1);f?--this._frameCountBin:this._frameCountBin=0;return f}function m(){var f=this._frameCountBin;if(0===f)return null;f=Array(f);y(this,1,f);this._frameCountBin=0;return f}function u(){const f=this._frameCountBin;if(0===f)return null;y(this,1,Array(f));this._frameCountBin=0}function w(f){const x="string"===typeof f;f={type:x?0:1,data:f,
timestamp:performance.now(),_next:null,_prev:null};const p=this._queue;if(p){const z=p._prev;z._next=f;f._prev=z;f._next=p;p._prev=f}else this._queue=f,f._next=f,f._prev=f;x?++this._frameCountStr:++this._frameCountBin}za.createWebSocketHandle=function(f){let x;try{x=new WebSocket(f)}catch(z){return g("Failed to create WebSocket: {}",f),ia("Exception Caught",z),null}x.binaryType="arraybuffer";const p={state:1,_socket:x,_queue:null,_frameCountStr:0,_frameCountBin:0,_addRecievedFrame:w,closeSocket:a,
sendStringFrame:b,sendBinaryFrame:d,availableFrames:c,getNextFrame:h,getAllFrames:l,clearFrames:t,availableStringFrames:B,getNextStringFrame:v,getAllStringFrames:S,clearStringFrames:U,availableBinaryFrames:K,getNextBinaryFrame:r,getAllBinaryFrames:m,clearBinaryFrames:u};x.addEventListener("open",function(){p.state=2});x.addEventListener("message",function(z){p._addRecievedFrame(z.data)});x.addEventListener("close",function(){3!==p.state&&(p.state=0)});x.addEventListener("error",function(){1===p.state&&
(p.state=3)});return p}})();function Ub(a,b){var d=Eb;const c=d&&200===b?a.getExtension("OES_vertex_array_object"):null,h=d&&200===b?a.getExtension("ANGLE_instanced_arrays"):null,l=d&&200===b&&null!==h,t=d&&(310===b||300===b)&&null!==a.getExtension("EXT_color_buffer_float"),D=d&&!t&&(310===b||300===b||200===b)&&null!==a.getExtension("EXT_color_buffer_half_float"),y=d&&200===b&&null!==a.getExtension("EXT_shader_texture_lod"),B=d&&200===b&&null!==a.getExtension("OES_fbo_render_mipmap"),v=d&&200===b&&null!==c,S=d&&200===b&&null!==
a.getExtension("OES_texture_float"),U=d&&300<=b&&null!==a.getExtension("OES_texture_float_linear"),K=d&&200===b&&null!==a.getExtension("OES_texture_half_float"),r=d&&200===b&&null!==a.getExtension("OES_texture_half_float_linear");d=d&&null!==a.getExtension("EXT_texture_filter_anisotropic");const m=null!==a.getExtension("WEBGL_debug_renderer_info"),u=300<=b?0:200===b&&v?1:-1,w=300<=b?0:200===b&&l?1:-1,f=[b,u,w,0,0];if(300<=b||B)f[3]|=4;if(300<=b||y)f[3]|=8;300<=b&&(f[3]|=16);(320<=b||(300<=b||S)&&
(t||D))&&(f[3]|=32);(320<=b||(300<=b||K)&&t)&&(f[3]|=64);d&&(f[3]|=128);(300<=b||r)&&(f[4]|=1);300<=b&&U&&(f[4]|=2);J.getCapBits=function(p){return f[p]};J.glEnable=a.enable.bind(a);J.glDisable=a.disable.bind(a);J.glClearColor=a.clearColor.bind(a);J.glClearDepth=a.clearDepth.bind(a);J.glClear=a.clear.bind(a);J.glDepthFunc=a.depthFunc.bind(a);J.glDepthMask=a.depthMask.bind(a);J.glCullFace=a.cullFace.bind(a);J.glViewport=a.viewport.bind(a);J.glBlendFunc=a.blendFunc.bind(a);J.glBlendFuncSeparate=a.blendFuncSeparate.bind(a);
J.glBlendEquation=a.blendEquation.bind(a);J.glBlendColor=a.blendColor.bind(a);J.glColorMask=a.colorMask.bind(a);J.glDrawBuffers=300<=b?a.drawBuffers.bind(a):na("glDrawBuffers");J.glReadBuffer=300<=b?a.readBuffer.bind(a):na("glReadBuffer");J.glReadPixels=a.readPixels.bind(a);J.glPolygonOffset=a.polygonOffset.bind(a);J.glLineWidth=a.lineWidth.bind(a);J.glGenBuffers=a.createBuffer.bind(a);J.glGenTextures=a.createTexture.bind(a);J.glCreateProgram=a.createProgram.bind(a);J.glCreateShader=a.createShader.bind(a);
J.glCreateFramebuffer=a.createFramebuffer.bind(a);J.glCreateRenderbuffer=a.createRenderbuffer.bind(a);J.glGenQueries=300<=b?a.createQuery.bind(a):na("glGenQueries");J.glDeleteBuffers=a.deleteBuffer.bind(a);J.glDeleteTextures=a.deleteTexture.bind(a);J.glDeleteProgram=a.deleteProgram.bind(a);J.glDeleteShader=a.deleteShader.bind(a);J.glDeleteFramebuffer=a.deleteFramebuffer.bind(a);J.glDeleteRenderbuffer=a.deleteRenderbuffer.bind(a);J.glDeleteQueries=300<=b?a.deleteQuery.bind(a):na("glDeleteQueries");
J.glBindBuffer=a.bindBuffer.bind(a);J.glBufferData=a.bufferData.bind(a);J.glBufferSubData=a.bufferSubData.bind(a);J.glEnableVertexAttribArray=a.enableVertexAttribArray.bind(a);J.glDisableVertexAttribArray=a.disableVertexAttribArray.bind(a);J.glVertexAttribPointer=a.vertexAttribPointer.bind(a);J.glActiveTexture=a.activeTexture.bind(a);J.glBindTexture=a.bindTexture.bind(a);J.glTexParameterf=a.texParameterf.bind(a);J.glTexParameteri=a.texParameteri.bind(a);J.glTexImage3D=300<=b?a.texImage3D.bind(a):
na("glTexImage3D");J.glTexImage2D=a.texImage2D.bind(a);J.glTexSubImage2D=a.texSubImage2D.bind(a);J.glCopyTexSubImage2D=a.copyTexSubImage2D.bind(a);J.glTexStorage2D=300<=b?a.texStorage2D.bind(a):na("glTexStorage2D");J.glPixelStorei=a.pixelStorei.bind(a);J.glGenerateMipmap=a.generateMipmap.bind(a);J.glShaderSource=a.shaderSource.bind(a);J.glCompileShader=a.compileShader.bind(a);J.glGetShaderi=a.getShaderParameter.bind(a);J.glGetShaderInfoLog=a.getShaderInfoLog.bind(a);J.glUseProgram=a.useProgram.bind(a);
J.glAttachShader=a.attachShader.bind(a);J.glDetachShader=a.detachShader.bind(a);J.glLinkProgram=a.linkProgram.bind(a);J.glGetProgrami=a.getProgramParameter.bind(a);J.glGetProgramInfoLog=a.getProgramInfoLog.bind(a);J.glDrawArrays=a.drawArrays.bind(a);J.glDrawElements=a.drawElements.bind(a);J.glBindAttribLocation=a.bindAttribLocation.bind(a);J.glGetAttribLocation=a.getAttribLocation.bind(a);J.glGetUniformLocation=a.getUniformLocation.bind(a);J.glGetUniformBlockIndex=300<=b?a.getUniformBlockIndex.bind(a):
na("glGetUniformBlockIndex");J.glBindBufferRange=300<=b?a.bindBufferRange.bind(a):na("glBindBufferRange");J.glUniformBlockBinding=300<=b?a.uniformBlockBinding.bind(a):na("glUniformBlockBinding");J.glUniform1f=a.uniform1f.bind(a);J.glUniform2f=a.uniform2f.bind(a);J.glUniform3f=a.uniform3f.bind(a);J.glUniform4f=a.uniform4f.bind(a);J.glUniform1i=a.uniform1i.bind(a);J.glUniform2i=a.uniform2i.bind(a);J.glUniform3i=a.uniform3i.bind(a);J.glUniform4i=a.uniform4i.bind(a);J.glUniformMatrix2fv=a.uniformMatrix2fv.bind(a);
J.glUniformMatrix3fv=a.uniformMatrix3fv.bind(a);J.glUniformMatrix4fv=a.uniformMatrix4fv.bind(a);J.glUniformMatrix3x2fv=300<=b?a.uniformMatrix3x2fv.bind(a):na("glUniformMatrix3x2fv");J.glUniformMatrix4x2fv=300<=b?a.uniformMatrix4x2fv.bind(a):na("glUniformMatrix4x2fv");J.glUniformMatrix4x3fv=300<=b?a.uniformMatrix4x3fv.bind(a):na("glUniformMatrix4x3fv");J.glBindFramebuffer=a.bindFramebuffer.bind(a);J.glCheckFramebufferStatus=a.checkFramebufferStatus.bind(a);J.glBlitFramebuffer=300<=b?a.blitFramebuffer.bind(a):
na("glBlitFramebuffer");J.glRenderbufferStorage=a.renderbufferStorage.bind(a);J.glFramebufferTexture2D=a.framebufferTexture2D.bind(a);J.glFramebufferTextureLayer=300<=b?a.framebufferTextureLayer.bind(a):na("glFramebufferTextureLayer");J.glBindRenderbuffer=a.bindRenderbuffer.bind(a);J.glFramebufferRenderbuffer=a.framebufferRenderbuffer.bind(a);J.glGetError=a.getError.bind(a);J.getAllExtensions=a.getSupportedExtensions.bind(a);J.isContextLost=a.isContextLost.bind(a);const x=[];l&&x.push("ANGLE_instanced_arrays");
t&&x.push("EXT_color_buffer_float");D&&x.push("EXT_color_buffer_half_float");y&&x.push("EXT_shader_texture_lod");B&&x.push("OES_fbo_render_mipmap");v&&x.push("OES_vertex_array_object");S&&x.push("OES_texture_float");U&&x.push("OES_texture_float_linear");K&&x.push("OES_texture_half_float");r&&x.push("OES_texture_half_float_linear");d&&x.push("EXT_texture_filter_anisotropic");m&&x.push("WEBGL_debug_renderer_info");J.dumpActiveExtensions=function(){return x};J.glGetInteger=function(p){p=a.getParameter(p);
return"number"===typeof p?p:0};J.glGetString=function(p){if(m)switch(p){case 7936:p=a.getParameter(37445);null==p&&(p=a.getParameter(7936));break;case 7937:p=a.getParameter(37446);null==p&&(p=a.getParameter(7937));break;default:p=a.getParameter(p)}else p=a.getParameter(p);return"string"===typeof p?p:null};switch(u){case 0:J.glGenVertexArrays=a.createVertexArray.bind(a);J.glDeleteVertexArrays=a.deleteVertexArray.bind(a);J.glBindVertexArray=a.bindVertexArray.bind(a);break;case 1:J.glGenVertexArrays=
c.createVertexArrayOES.bind(c);J.glDeleteVertexArrays=c.deleteVertexArrayOES.bind(c);J.glBindVertexArray=c.bindVertexArrayOES.bind(c);break;default:C(J,"glGenVertexArrays"),C(J,"glDeleteVertexArrays"),C(J,"glBindVertexArray")}switch(w){case 0:J.glVertexAttribDivisor=a.vertexAttribDivisor.bind(a);J.glDrawArraysInstanced=a.drawArraysInstanced.bind(a);J.glDrawElementsInstanced=a.drawElementsInstanced.bind(a);break;case 1:J.glVertexAttribDivisor=h.vertexAttribDivisorANGLE.bind(h);J.glDrawArraysInstanced=
h.drawArraysInstancedANGLE.bind(h);J.glDrawElementsInstanced=h.drawElementsInstancedANGLE.bind(h);break;default:C(J,"glVertexAttribDivisor"),C(J,"glDrawArraysInstanced"),C(J,"glDrawElementsInstanced")}};var zc=!1;const Ac=new MessageChannel;var Bc=null;Ac.port2.addEventListener("message",function(){Bc()});async function Jb(){Ac.port1.start();Ac.port2.start();Bc=function(){Bc=null};Ac.port1.postMessage(0);Bc?await new Promise(function(a){setTimeout(function(){Bc?g("Immediate continue hack is not supported"):zc=!0;a()},25)}):g("Immediate continue hack is not supported")}Ca.getRootElement=function(){return Va};Ca.getParentElement=function(){return P};Ca.getCanvasElement=function(){return R};
Ca.getEaglercraftXOpts=function(){return N};Ca.getEventCount=Yb.K.bind(Yb);Ca.getNextEvent=Yb.j.bind(Yb);
Ca.queueAsyncDownload=function(a,b,d){try{fetch(a,{cache:b?"force-cache":"no-store",mode:"cors"}).then(function(c){return c.arrayBuffer()}).then(function(c){T(1,0,{requestId:d,arrayBuffer:c})}).catch(function(c){g("Failed to complete async download: {}",a);ia("Exception Caught",c);T(1,0,{requestId:d,arrayBuffer:null})})}catch(c){g("Failed to fetch: {}",a),ia("Exception Caught",c),T(1,0,{requestId:d,arrayBuffer:null})}};
Ca.download=new WebAssembly.Suspending(function(a,b){return new Promise(function(d){try{fetch(a,{cache:b?"force-cache":"no-store",mode:"cors"}).then(function(c){return c.arrayBuffer()}).then(function(c){d(c)}).catch(function(c){g("Failed to complete download: {}",a);ia("Exception Caught",c);d(null)})}catch(c){g("Failed to fetch: {}",a),ia("Exception Caught",c),d(null)}})});Ca.writeCrashReport=function(a){ac(a,!1)};Ca.steadyTimeMillis=performance.now.bind(performance);
function xc(a){return new Promise(function(b){setTimeout(b,a)})}Ca.sleep=new WebAssembly.Suspending(xc);function Cc(a){zc?(Bc=a,Ac.port1.postMessage(0)):setTimeout(a,0)}function yc(){return new Promise(Cc)}Ca.immediateContinue=new WebAssembly.Suspending(yc);Ca.setCrashReportString=function(a,b){db[a]=b};var Dc="undefined"!==typeof window,Ec=null;function Fc(){return new Promise(function(a){if("navigator"in window&&"mediaDevices"in window.navigator&&"getUserMedia"in window.navigator.mediaDevices)try{window.navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(b){a(b)}).catch(function(b){g("getUserMedia Error! (async)");ia("Exception Caught",b);a(null)})}catch(b){g("getUserMedia Error!"),a(null)}else g("No getUserMedia!"),a(null)})}
async function Gc(){return Dc?null===Ec&&(Ec=await Fc(),null===Ec)?(Dc=!1,null):Ec:null}
function Lb(){function a(b){const d=new Date;return b.replace("${date}",d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)+" "+("0"+d.getHours()).slice(-2)+"-"+("0"+d.getMinutes()).slice(-2)+"-"+("0"+d.getSeconds()).slice(-2))}Da.getMic=new WebAssembly.Suspending(Gc);Da.setDataAvailableHandler=function(b,d,c){const h=performance.now();b.addEventListener("dataavailable",function(l){if(d)Hc(l.data,performance.now()-h|0,function(t){const D=URL.createObjectURL(t);jc(a(c),
D,function(){URL.revokeObjectURL(D)})},{U:function(t){e(t)}});else{const t=URL.createObjectURL(l.data);jc(a(c),t,function(){URL.revokeObjectURL(t)})}})}};function Mb(){function a(h){try{const l=JSON.parse(h);this._peerConnection.setRemoteDescription(l).then(()=>{l.hasOwnProperty("type")&&"offer"===l.type&&this._peerConnection.createAnswer().then(t=>{this._peerConnection.setLocalDescription(t).then(()=>{T(2,1,{objId:this.objId,data:JSON.stringify(t)})}).catch(D=>{g('Failed to set local description for "{}"! {}',this.objId,D.message);T(2,3,{objId:this.objId})})}).catch(t=>{g('Failed to create answer for "{}"! {}',this.objId,t.message);T(2,3,{objId:this.objId})})}).catch(t=>
{g('Failed to set remote description for "{}"! {}',this.objId,t.message);T(2,3,{objId:this.objId})})}catch(l){g(l.message),T(2,3,{objId:this.objId})}}function b(h){try{this._peerConnection.addIceCandidate(new RTCIceCandidate(JSON.parse(h))).catch(l=>{g('Failed to parse ice candidate for "{}"! {}',this.objId,l.message);T(2,3,{objId:this.objId})})}catch(l){g(l.message),T(2,3,{objId:this.objId})}}function d(){this._peerConnection.close()}Ea.isSupported=function(){return"undefined"!==typeof navigator.mediaDevices&&
"undefined"!==typeof navigator.mediaDevices.getUserMedia&&"srcObject"in HTMLAudioElement.prototype};let c=0;Ea.createRTCPeerConnection=function(h,l,t){try{const y=c++;var D;const B=new RTCPeerConnection({iceServers:JSON.parse(h),optional:[{DtlsSrtpKeyAgreement:!0}]});B.addEventListener("icecandidate",v=>{v.candidate&&T(2,0,{objId:y,data:JSON.stringify({sdpMLineIndex:""+v.candidate.sdpMLineIndex,candidate:v.candidate.candidate})})});B.addEventListener("track",v=>{v=v.streams[0];D._aud=document.createElement("audio");
D._aud.autoplay=!0;D._aud.muted=!0;D._aud.srcObject=v;T(2,2,{objId:y,stream:v})});t.getTracks().forEach(function(v){B.addTrack(v,t)});l&&B.createOffer().then(v=>{B.setLocalDescription(v).then(()=>{T(2,1,{objId:y,data:JSON.stringify(v)})}).catch(S=>{g('Failed to set local description for "{}"! {}',y,S.message);T(2,3,{objId:y})})}).catch(v=>{g('Failed to set create offer for "{}"! {}',y,v.message);T(2,3,{objId:y})});B.addEventListener("connectionstatechange",()=>{const v=B.connectionState;"disconnected"!==
v&&"failed"!==v||T(2,3,{objId:y})});return D={objId:y,_peerConnection:B,setRemoteDescription:a,addRemoteICECandidate:b,closeHandle:d}}catch(y){return g(y.message),null}}};function Nb(){const a=new qa;let b;b={iceServers:[],g:null,h:null,readyState:1,v:null,description:null,D:!1,C:!0,disconnect:function(c){if(b.h){try{b.h.close()}catch(h){}b.h=null}if(b.g){try{b.g.close()}catch(h){}b.g=null}c||(b.C=!0);b.readyState=0}};M.supported=function(){return"undefined"!==typeof RTCPeerConnection};M.clientLANReadyState=function(){return b.readyState};M.clientLANCloseConnection=function(){b.disconnect(!1)};M.clientLANSendPacket=function(c){if(null!==b.h&&"open"===b.h.readyState)try{b.h.send(c)}catch(h){b.disconnect(!1)}else b.disconnect(!1)};
M.clientLANReadPacket=function(){const c=a.j();return c?new Uint8Array(c.data):null};M.clientLANAvailable=function(){return a.u};M.clientLANSetICEServersAndConnect=function(c){b.iceServers.length=0;for(let h of c)c=h.split(";"),1===c.length?b.iceServers.push({urls:c[0]}):3===c.length&&b.iceServers.push({urls:c[0],username:c[1],credential:c[2]});2!==b.readyState&&1!==b.readyState||b.disconnect(!0);try{if(b.h){try{b.h.close()}catch(h){}b.h=null}if(b.g)try{b.g.close()}catch(h){}b.g=new RTCPeerConnection({iceServers:b.iceServers,
optional:[{DtlsSrtpKeyAgreement:!0}]});b.readyState=1}catch(h){ia("Could not create LAN client RTCPeerConnection!",h);b.readyState=-2;return}try{const h=[];b.g.addEventListener("icecandidate",t=>{if(t.candidate){if(0===h.length){const D=[0,0],y=()=>{if(null!==b.g&&"disconnected"!==b.g.connectionState){const B=++D[1];D[0]!==h.length&&3>B?(D[0]=h.length,setTimeout(y,2E3)):(b.v=JSON.stringify(h),h.length=0)}};setTimeout(y,2E3)}h.push({sdpMLineIndex:t.candidate.sdpMLineIndex,candidate:t.candidate.candidate})}});
b.h=b.g.createDataChannel("lan");b.h.binaryType="arraybuffer";let l;l=()=>{0<h.length?setTimeout(l,10):(b.C=!1,b.D=!0)};b.h.addEventListener("open",l);b.h.addEventListener("message",t=>{a.push({data:t.data,_next:null})});b.g.createOffer().then(t=>{b.g.setLocalDescription(t).then(()=>{b.description=JSON.stringify(t)}).catch(D=>{g("Failed to set local description! {}",D.message);b.readyState=-1;b.disconnect(!1)})}).catch(t=>{g("Failed to set create offer! {}",t.message);b.readyState=-1;b.disconnect(!1)});
b.g.addEventListener("connectionstatechange",()=>{var t=b.g.connectionState;"disconnected"===t?b.disconnect(!1):"connected"===t?b.readyState=2:"failed"===t&&(b.readyState=-1,b.disconnect(!1))})}catch(h){if(b.h){try{b.h.close()}catch(l){}b.h=null}if(b.g){try{b.g.close()}catch(l){}b.g=null}ia("Could not create LAN client RTCDataChannel!",h);b.readyState=-2}};M.clearLANClientState=function(){b.v=b.description=null;b.D=!1;b.C=!0};M.clientLANAwaitICECandidate=function(){if(null===b.v)return null;const c=
b.v;b.v=null;return c};M.clientLANAwaitDescription=function(){if(null===b.description)return null;const c=b.description;b.description=null;return c};M.clientLANAwaitChannel=function(){return b.D?(b.D=!1,!0):!1};M.clientLANClosed=function(){return b.C};M.clientLANSetICECandidate=function(c){try{const h=JSON.parse(c);for(c=0;c<h.length;++c)b.g.addIceCandidate(new RTCIceCandidate(h[c]))}catch(h){ia("Uncaught exception setting remote ICE candidates",h),b.readyState=-1,b.disconnect(!1)}};M.clientLANSetDescription=
function(c){try{b.g.setRemoteDescription(JSON.parse(c))}catch(h){ia("Uncaught exception setting remote description",h),b.readyState=-1,b.disconnect(!1)}};let d;d={iceServers:[],A:new Map,F:new Map,disconnect:function(c){const h=d.A.get(c);if(h){d.A.delete(c);h.l&&d.F.delete(h.l);try{h.disconnect()}catch(l){}h.s(4,null)}}};M.serverLANInitializeServer=function(c){d.iceServers.length=0;for(let h of c)c=h.split(";"),1===c.length?d.iceServers.push({urls:c[0]}):3===c.length&&d.iceServers.push({urls:c[0],
username:c[1],credential:c[2]})};M.serverLANCloseServer=function(){for(let c of Object.values(d.A))if(c){try{c.disconnect()}catch(h){}c.s(4,null)}d.A.clear()};M.serverLANCreatePeer=function(c){try{const h=new qa;let l;l={i:c,g:new RTCPeerConnection({iceServers:d.iceServers,optional:[{DtlsSrtpKeyAgreement:!0}]}),h:null,l:null,s:function(y,B){h.push({type:y,data:B,_next:null})},disconnect:function(){l.h&&l.h.close();l.g.close()}};d.A.set(l.i,l);const t=[];l.g.addEventListener("icecandidate",y=>{if(y.candidate){if(0===
t.length){const B=[0,0],v=()=>{if(null!==l.g&&"disconnected"!==l.g.connectionState){const S=++B[1];B[0]!==t.length&&3>S?(B[0]=t.length,setTimeout(v,2E3)):(l.s(0,JSON.stringify(t)),t.length=0)}};setTimeout(v,2E3)}t.push({sdpMLineIndex:y.candidate.sdpMLineIndex,candidate:y.candidate.candidate})}});let D;D=y=>{0<t.length?setTimeout(D,10,y):y.channel&&(y=y.channel,null!==l.h?y.close():(l.h=y,l.s(2,null),l.h.addEventListener("message",B=>{B=B.data;l.l?bb(l.l,B):l.s(3,new Uint8Array(B))})))};l.g.addEventListener("datachannel",
D);l.g.addEventListener("connectionstatechange",()=>{const y=l.g.connectionState;"disconnected"!==y&&"failed"!==y||d.disconnect(l.i)});return{peerId:l.i,countAvailableEvents:function(){return h.u},nextEvent:function(){return h.j()},writePacket:function(y){let B=!1;if(null!==l.h&&"open"===l.h.readyState)try{l.h.send(y)}catch(v){B=!0}else B=!0;B&&d.disconnect(l.i)},handleRemoteICECandidates:function(y){try{const B=JSON.parse(y);for(let v of B)l.g.addIceCandidate(new RTCIceCandidate(v))}catch(B){g('Failed to parse ice candidate for "{}"! {}',
l.i,B.message),d.disconnect(l.i)}},handleRemoteDescription:function(y){try{const B=JSON.parse(y);l.g.setRemoteDescription(B).then(()=>{B.hasOwnProperty("type")&&"offer"===B.type&&l.g.createAnswer().then(v=>{l.g.setLocalDescription(v).then(()=>{l.s(1,JSON.stringify(v))}).catch(S=>{g('Failed to set local description for "{}"! {}',l.i,S.message);d.disconnect(l.i)})}).catch(v=>{g('Failed to create answer for "{}"! {}',l.i,v.message);d.disconnect(l.i)})}).catch(v=>{g('Failed to set remote description for "{}"! {}',
l.i,v.message);d.disconnect(l.i)})}catch(B){g('Failed to parse remote description for "{}"! {}',l.i,B.message),d.disconnect(l.i)}},mapIPC:function(y){l.l?y||(d.F.delete(l.l),l.l=null):y&&(l.l=y,d.F.set(y,l))},disconnect:function(){d.disconnect(l.i)}}}catch(h){return ia("Failed to create WebRTC LAN peer!",h),null}};ab=function(c,h){if(c=d.F.get(c)){let l=!1;if(c.h&&"open"===c.h.readyState)try{c.h.send(h)}catch(t){l=!0}else l=!0;l&&d.disconnect(c.i);return!0}return!1}};function Ob(){function a(p,z){p.allow=z;return p.allow===z}function b(p,z){const E=p.sandbox;for(var H=0;H<z.length;++H)E.add(z[H]);for(H=0;H<z.length;++H)if(!E.contains(z[H]))return!1;for(H=0;H<E.length;++H)if(!z.find(O=>O===E[H]))return!1;return!0}function d(p){if(S)f=document.createElement("iframe"),f.allow="",f.referrerPolicy="strict-origin",f.sandbox.add("allow-downloads"),p.scriptEnabled&&(f.sandbox.add("allow-scripts"),f.sandbox.add("allow-pointer-lock"));else{f=document.createElement("iframe");
f.referrerPolicy="strict-origin";var z=["allow-downloads"];p.scriptEnabled&&(z.push("allow-scripts"),z.push("allow-pointer-lock"));if(!a(f,"")||!b(f,z)){g("Caught safety exception while opening webview!");null!==f&&(f.remove(),f=null);g("Things you can try:");g("1. Set window.eaglercraftXOpts.forceWebViewSupport to true");g("2. Set window.eaglercraftXOpts.enableWebViewCSP to false");g("(these settings may compromise security)");c();w.innerHTML='<div style="padding-top:13vh;"><h1 style="text-align:center;"><img width="48" height="48" style="vertical-align:middle;" src="'+
Ta+'">&emsp;IFrame Safety Error</h1><h4 style="text-align:center;">The content cannot be displayed safely!</h4><h4 style="text-align:center;">Check console for more details</h4></div>';return}}f.j=!0;f.o="lazy";z=!1;if(1===p.contentMode){if(U&&v)if("string"===typeof f.csp){var E="default-src 'none';",H=p.strictCSPEnable?"":r?" https:":" http: https:";E=p.scriptEnabled?E+(" script-src 'unsafe-eval' 'unsafe-inline' data: blob:"+H+"; style-src 'unsafe-eval' 'unsafe-inline' data: blob:")+(H+"; img-src data: blob:")+
(H+"; font-src data: blob:")+(H+"; child-src data: blob:")+(H+"; frame-src data: blob:; media-src data: mediastream: blob:")+(H+"; connect-src data: blob:")+(H+"; worker-src data: blob:")+(H+";"):E+(" style-src data: 'unsafe-inline'"+H+"; img-src data:")+(H+"; font-src data:")+(H+"; media-src data:")+(H+";");f.csp=E}else ha("This browser does not support CSP attribute on iframes! (try Chrome)"),z=!0;else z=!0;z&&p.strictCSPEnable&&ha("Strict CSP was requested for this webview, but that feature is not available!")}else z=
!0;f.style.border="none";f.style.backgroundColor="white";f.style.width="100%";f.style.height="100%";f.classList.add("_eaglercraftX_webview_iframe_element");u.appendChild(f);1===p.contentMode?(E=y.decode(p.blob),p.blob=null,f.srcdoc=E):f.src=p.uri;const O=m,ma=f;let Z=!1;f.addEventListener("mouseover",function(){O!==m||ma!==f||Z||(Z=!0,f.contentWindow.focus())});f.addEventListener("mouseout",function(){O===m&&ma===f&&Z&&(Z=!1,window.focus())});p.scriptEnabled&&p.serverMessageAPIEnabled&&(x=function(X){if(O===
m&&ma===f&&X.source===ma.contentWindow){X=X.data;if("object"===typeof X&&1===X.ver&&"string"===typeof X.channel&&0<X.channel.length){if("boolean"===typeof X.open){T(3,0,{eventType:X.open?0:1,channelName:X.channel});return}if("string"===typeof X.data){T(3,1,{eventType:0,channelName:X.channel,eventData:X.data});return}if(X.data instanceof ArrayBuffer){T(3,1,{eventType:1,channelName:X.channel,eventData:X.data});return}}ha("WebView sent an invalid message!")}else ha("Recieved message from on dead IFrame handler: (#{}) {}",
O,ma.src)});e('WebView is loading: "{}"',1===p.contentMode?"about:srcdoc":f.src);e("JavaScript: {}, Strict CSP: {}, Message API: {}",p.scriptEnabled,p.strictCSPEnable&&!z,p.serverMessageAPIEnabled)}function c(){null!==w&&(++m,w.remove(),w=null);w=document.createElement("div");w.style.backgroundColor="white";w.style.width="100%";w.style.height="100%";w.classList.add("_eaglercraftX_webview_permission_screen");u.appendChild(w)}function h(p){c();w.innerHTML='<div style="padding-top:13vh;"><div style="margin:auto;max-width:450px;border:6px double black;text-align:center;padding:20px;"><h2><img width="32" height="32" style="vertical-align:middle;" src="'+
Ta+'">&emsp;Allow JavaScript</h2><p style="font-family:monospace;text-decoration:underline;word-wrap:break-word;" class="_eaglercraftX_permission_target_url"></p><h4 style="line-height:1.4em;">Strict CSP: '+(1!==p.contentMode?'<span style="color:red;">Impossible</span>':v&&U?p.strictCSPEnable?'<span style="color:green;">Enabled</span>':'<span style="color:red;">Disabled</span>':'<span style="color:red;">Unsupported</span>')+"&ensp;|&ensp;Message API: "+(p.serverMessageAPIEnabled?'<span style="color:red;">Enabled</span>':
'<span style="color:green;">Disabled</span>')+'</h4><p><input class="_eaglercraftX_remember_javascript" type="checkbox" checked> Remember my choice</p><p><button style="font-size:1.5em;" class="_eaglercraftX_allow_javascript">Allow</button>&emsp;<button style="font-size:1.5em;" class="_eaglercraftX_block_javascript">Block</button></p></div></div>';const z=m;if(1!==p.contentMode){const E=p.url;w.querySelector("._eaglercraftX_permission_target_url").innerText=255<E.length()?E.substring(0,253)+"...":
E}w.querySelector("._eaglercraftX_allow_javascript").addEventListener("click",function(){if(m===z&&null!==w){const E=w.querySelector("._eaglercraftX_remember_javascript");null!==E&&E.checked&&T(3,2,null);w.remove();w=null;++m;d(p)}});w.querySelector("._eaglercraftX_block_javascript").addEventListener("click",function(){if(m===z&&null!==w){const E=w.querySelector("._eaglercraftX_remember_javascript");null!==E&&E.checked&&T(3,3,null);l(p)}})}function l(p){c();w.innerHTML='<div style="padding-top:13vh;"><h1 style="text-align:center;"><img width="48" height="48" style="vertical-align:middle;" src="'+
Ta+'">&emsp;Content Blocked</h1><h4 style="text-align:center;">You chose to block JavaScript execution for this embed</h4><p style="text-align:center;"><button style="font-size:1.0em;" class="_eaglercraftX_re_evaluate_javascript">Re-evaluate</button></p></div>';const z=m;w.querySelector("._eaglercraftX_re_evaluate_javascript").addEventListener("click",function(){m===z&&null!==w&&(T(3,4,null),h(p))})}function t(p,z,E,H){if(u){const O=window.devicePixelRatio;u.style.top=""+z/O+"px";u.style.left=""+
p/O+"px";u.style.width=""+(E/O-10)+"px";u.style.height=""+(H/O-10)+"px"}}function D(){++m;f&&(f.remove(),f=null);x=null;w&&(w.remove(),w=null);u&&(u.remove(),u=null);window.focus()}const y=new TextDecoder("utf-8");var B=!1,v=!1,S=zb,U=Ab;if(S)v=B=!0;else{v=B=!1;try{var K=document.createElement("iframe");B=null!=K&&"string"===typeof K.allow&&"object"===typeof K.sandbox;v=U&&B&&"string"===typeof K.csp}catch(p){g("Error checking iframe support"),g(p)}}B?!v&&U&&ha("This browser does not support CSP attribute on iframes! (try Chrome)"):
g("This browser does not meet the safety requirements for webview support, this feature will be disabled");const r=location.protocol&&"https:"===location.protocol.toLowerCase();var m=0,u=null,w=null,f=null,x=null;window.addEventListener("message",function(p){x&&p.source!==window&&x(p)});Fa.checkSupported=function(){return B};Fa.checkCSPSupported=function(){return v};Fa.sendStringMessage=function(p,z){try{var E;null!=f&&null!=(E=f.contentWindow)?E.postMessage({ver:1,channel:p,type:"string",data:z},
"*"):g("Server tried to send the WebView a message, but the message channel is not open!")}catch(H){ia("Failed to send string message to WebView!",H)}};Fa.sendBinaryMessage=function(p,z){try{var E;if(null!=f&&null!=(E=f.contentWindow)){const H=new Uint8Array(z.length);H.set(z,0);E.postMessage({ver:1,channel:p,type:"binary",data:H.buffer},"*")}else g("Server tried to send the WebView a message, but the message channel is not open!")}catch(H){ia("Failed to send string message to WebView!",H)}};Fa.beginShowing=
function(p,z,E,H,O,ma){if(B)try{switch(null!==u&&D(),u=document.createElement("div"),u.classList.add("_eaglercraftX_webview_container_element"),u.style.border="5px solid #333333",u.style.zIndex="11",u.style.position="absolute",u.style.backgroundColor="#DDDDDD",u.style.fontFamily="sans-serif",t(E,H,O,ma),P.appendChild(u),p){case 0:d(z);break;case 1:if(1===z.contentMode){const Z=new Uint8Array(z.blob.length);Z.set(z.blob,0);z.blob=Z}h(z);break;case 2:if(1===z.contentMode){const Z=new Uint8Array(z.blob.length);
Z.set(z.blob,0);z.blob=Z}l(z)}}catch(Z){ia("Failed to begin showing WebView!",Z)}};Fa.resize=t;Fa.endShowing=D};function Pb(){var a=null;const b=new qa;var d=null;Ja.startIntegratedServer=new WebAssembly.Suspending(async function(){d||=URL.createObjectURL(new Blob(['"use strict"; (function(ctx, globals) {globals.__eaglerXOnMessage = function(o) {globals.__eaglerXOnMessage = function(oo) { console.error("Dropped IPC packet that was sent too early!"); };const eagRuntimeJSURL = URL.createObjectURL(new Blob([ o.eagruntimeJS ], { type: "text/javascript;charset=utf-8" }));ctx.getEaglercraftXOpts = function() { return o.eaglercraftXOpts; };ctx.getEagRuntimeJSURL = function() { return eagRuntimeJSURL; };ctx.getClassesWASMURL = function() { return o.classesWASM; };ctx.getClassesDeobfWASMURL = function() { return o.classesDeobfWASM; };ctx.getClassesTEADBGURL = function() { return o.classesTEADBG; };ctx.getEPKFiles = function() { return null; };ctx.getRootElement = function() { return null; };ctx.getMainArgs = function() { return ["_worker_process_"]; };ctx.getImageURL = function(idx) { return null; };ctx.runMain = function(mainFunc) { mainFunc(); };importScripts(eagRuntimeJSURL);};addEventListener("message", function(evt) { globals.__eaglerXOnMessage(evt.data); });})(self.__eaglercraftXLoaderContext = {}, self);'],
{type:"text/javascript;charset=utf8"}));try{a=new Worker(d)}catch(t){return ia("Failed to create worker",t),!1}a.addEventListener("error",function(t){ia("Worker Error",t.error)});a.addEventListener("message",function(t){const D=t.data.ch;D?"~!LOGGER"===D?Ib(t.data.txt,t.data.err):(t=t.data.dat)?ab(D,t)||b.push({ch:D,data:new Uint8Array(t),_next:null}):g("Recieved IPC packet with null buffer"):g("Recieved IPC packet with null channel")});const h=new Int8Array(Na.length);h.set(Na,0);try{var l=await fetch(Ua,
{cache:"force-cache"}).then(t=>t.arrayBuffer())}catch(t){ia("Failed to fetch eagruntime.js contents",t);try{a.terminate()}catch(D){}return!1}a.postMessage({eaglercraftXOpts:N,eagruntimeJS:l,classesWASM:La,classesDeobfWASM:Ma,classesTEADBG:h.buffer});return!0});Ja.sendPacket=function(h,l){if(a){const t=new Uint8Array(l.length);t.set(l,0);a.postMessage({ch:h,dat:t.buffer})}};bb=function(h,l){a&&a.postMessage({ch:h,dat:l})};Ja.getAvailablePackets=b.K.bind(b);Ja.getNextPacket=b.j.bind(b);Ja.killWorker=
function(){a&&(a.terminate(),a=null)};var c=null;Ja.showCrashReportOverlay=function(h,l,t,D,y){c||(c=document.createElement("div"),c.setAttribute("style","z-index:99;position:absolute;background-color:black;color:white;overflow-x:hidden;overflow-y:scroll;overflow-wrap:break-word;white-space:pre-wrap;font:18px sans-serif;padding:20px;display:none;"),c.classList.add("_eaglercraftX_integratedserver_crash_element"),P.appendChild(c));c.innerText="";c.innerText="CURRENT DATE: "+(new Date).toLocaleString()+
"\n\n"+h;h=window.devicePixelRatio;c.style.top=""+t/h+"px";c.style.left=""+l/h+"px";c.style.width=""+(D/h-20)+"px";c.style.height=""+(y/h-20)+"px";c.style.display="block"};Ja.hideCrashReportOverlay=function(){c&&(c.style.display="none")}};var bc=null;function Wb(){const a=new qa;self.__eaglerXOnMessage=function(b){const d=b.ch;b=b.dat;d?b?a.push({ch:d,data:new Uint8Array(b),_next:null}):g("Recieved IPC packet with null buffer"):g("Recieved IPC packet with null channel")};Ka.sendPacket=function(b,d){const c=new Uint8Array(d.length);c.set(d,0);postMessage({ch:b,dat:c.buffer})};Ka.getAvailablePackets=a.K.bind(a);Ka.getNextPacket=a.j.bind(a);Ka.setCrashCallback=function(){return{call:function(b){bc=b}}}};ra.getByteBufferView=function(a,b){return new Int8Array(Za,a,b)};ra.getUnsignedByteBufferView=function(a,b){return new Uint8Array(Za,a,b)};ra.getUnsignedClampedByteBufferView=function(a,b){return new Uint8ClampedArray(Za,a,b)};ra.getShortBufferView=function(a,b){return new Int16Array(Za,a,b)};ra.getUnsignedShortBufferView=function(a,b){return new Uint16Array(Za,a,b)};ra.getIntBufferView=function(a,b){return new Int32Array(Za,a,b)};ra.getFloatBufferView=function(a,b){return new Float32Array(Za,a,b)};const Ic={172351395:{name:"EBML",type:"Container"},646:{name:"EBMLVersion",type:"Uint"},759:{name:"EBMLReadVersion",type:"Uint"},754:{name:"EBMLMaxIDLength",type:"Uint"},755:{name:"EBMLMaxSizeLength",type:"Uint"},642:{name:"DocType",type:"String"},647:{name:"DocTypeVersion",type:"Uint"},645:{name:"DocTypeReadVersion",type:"Uint"},108:{name:"Void",type:"Binary"},63:{name:"CRC-32",type:"Binary"},190023271:{name:"SignatureSlot",type:"Container"},16010:{name:"SignatureAlgo",type:"Uint"},16026:{name:"SignatureHash",
type:"Uint"},16037:{name:"SignaturePublicKey",type:"Binary"},16053:{name:"Signature",type:"Binary"},15963:{name:"SignatureElements",type:"Container"},15995:{name:"SignatureElementList",type:"Container"},9522:{name:"SignedElement",type:"Binary"},139690087:{name:"Segment",type:"Container"},21863284:{name:"SeekHead",type:"Container"},3515:{name:"Seek",type:"Container"},5035:{name:"SeekID",type:"Binary"},5036:{name:"SeekPosition",type:"Uint"},88713574:{name:"Info",type:"Container"},13220:{name:"SegmentUID",
type:"Binary"},13188:{name:"SegmentFilename",type:"String"},1882403:{name:"PrevUID",type:"Binary"},1868715:{name:"PrevFilename",type:"String"},2013475:{name:"NextUID",type:"Binary"},1999803:{name:"NextFilename",type:"String"},1092:{name:"SegmentFamily",type:"Binary"},10532:{name:"ChapterTranslate",type:"Container"},10748:{name:"ChapterTranslateEditionUID",type:"Uint"},10687:{name:"ChapterTranslateCodec",type:"Uint"},10661:{name:"ChapterTranslateID",type:"Binary"},710577:{name:"TimecodeScale",type:"Uint"},
1161:{name:"Duration",type:"Float"},1121:{name:"DateUTC",type:"Date"},15273:{name:"Title",type:"String"},3456:{name:"MuxingApp",type:"String"},5953:{name:"WritingApp",type:"String"},103:{name:"Timecode",type:"Uint"},6228:{name:"SilentTracks",type:"Container"},6359:{name:"SilentTrackNumber",type:"Uint"},39:{name:"Position",type:"Uint"},43:{name:"PrevSize",type:"Uint"},35:{name:"SimpleBlock",type:"Binary"},32:{name:"BlockGroup",type:"Container"},33:{name:"Block",type:"Binary"},34:{name:"BlockVirtual",
type:"Binary"},13729:{name:"BlockAdditions",type:"Container"},38:{name:"BlockMore",type:"Container"},110:{name:"BlockAddID",type:"Uint"},37:{name:"BlockAdditional",type:"Binary"},27:{name:"BlockDuration",type:"Uint"},122:{name:"ReferencePriority",type:"Uint"},123:{name:"ReferenceBlock",type:"Int"},125:{name:"ReferenceVirtual",type:"Int"},36:{name:"CodecState",type:"Binary"},13730:{name:"DiscardPadding",type:"Int"},14:{name:"Slices",type:"Container"},104:{name:"TimeSlice",type:"Container"},76:{name:"LaceNumber",
type:"Uint"},77:{name:"FrameNumber",type:"Uint"},75:{name:"BlockAdditionID",type:"Uint"},78:{name:"Delay",type:"Uint"},79:{name:"SliceDuration",type:"Uint"},72:{name:"ReferenceFrame",type:"Container"},73:{name:"ReferenceOffset",type:"Uint"},74:{name:"ReferenceTimeCode",type:"Uint"},47:{name:"EncryptedBlock",type:"Binary"},106212971:{name:"Tracks",type:"Container"},46:{name:"TrackEntry",type:"Container"},87:{name:"TrackNumber",type:"Uint"},13253:{name:"TrackUID",type:"Uint"},3:{name:"TrackType",type:"Uint"},
57:{name:"FlagEnabled",type:"Uint"},8:{name:"FlagDefault",type:"Uint"},5546:{name:"FlagForced",type:"Uint"},28:{name:"FlagLacing",type:"Uint"},11751:{name:"MinCache",type:"Uint"},11768:{name:"MaxCache",type:"Uint"},254851:{name:"DefaultDuration",type:"Uint"},216698:{name:"DefaultDecodedFieldDuration",type:"Uint"},209231:{name:"TrackTimecodeScale",type:"Float"},4991:{name:"TrackOffset",type:"Int"},5614:{name:"MaxBlockAdditionID",type:"Uint"},4974:{name:"Name",type:"String"},177564:{name:"Language",
type:"String"},6:{name:"CodecID",type:"String"},9122:{name:"CodecPrivate",type:"Binary"},362120:{name:"CodecName",type:"String"},13382:{name:"AttachmentLink",type:"Uint"},1742487:{name:"CodecSettings",type:"String"},1785920:{name:"CodecInfoURL",type:"String"},438848:{name:"CodecDownloadURL",type:"String"},42:{name:"CodecDecodeAll",type:"Uint"},12203:{name:"TrackOverlay",type:"Uint"},5802:{name:"CodecDelay",type:"Uint"},5819:{name:"SeekPreRoll",type:"Uint"},9764:{name:"TrackTranslate",type:"Container"},
9980:{name:"TrackTranslateEditionUID",type:"Uint"},9919:{name:"TrackTranslateCodec",type:"Uint"},9893:{name:"TrackTranslateTrackID",type:"Binary"},96:{name:"Video",type:"Container"},26:{name:"FlagInterlaced",type:"Uint"},5048:{name:"StereoMode",type:"Uint"},5056:{name:"AlphaMode",type:"Uint"},5049:{name:"OldStereoMode",type:"Uint"},48:{name:"PixelWidth",type:"Uint"},58:{name:"PixelHeight",type:"Uint"},5290:{name:"PixelCropBottom",type:"Uint"},5307:{name:"PixelCropTop",type:"Uint"},5324:{name:"PixelCropLeft",
type:"Uint"},5341:{name:"PixelCropRight",type:"Uint"},5296:{name:"DisplayWidth",type:"Uint"},5306:{name:"DisplayHeight",type:"Uint"},5298:{name:"DisplayUnit",type:"Uint"},5299:{name:"AspectRatioType",type:"Uint"},963876:{name:"ColourSpace",type:"Binary"},1029411:{name:"GammaValue",type:"Float"},230371:{name:"FrameRate",type:"Float"},97:{name:"Audio",type:"Container"},53:{name:"SamplingFrequency",type:"Float"},14517:{name:"OutputSamplingFrequency",type:"Float"},31:{name:"Channels",type:"Uint"},15739:{name:"ChannelPositions",
type:"Binary"},8804:{name:"BitDepth",type:"Uint"},98:{name:"TrackOperation",type:"Container"},99:{name:"TrackCombinePlanes",type:"Container"},100:{name:"TrackPlane",type:"Container"},101:{name:"TrackPlaneUID",type:"Uint"},102:{name:"TrackPlaneType",type:"Uint"},105:{name:"TrackJoinBlocks",type:"Container"},109:{name:"TrackJoinUID",type:"Uint"},64:{name:"TrickTrackUID",type:"Uint"},65:{name:"TrickTrackSegmentUID",type:"Binary"},70:{name:"TrickTrackFlag",type:"Uint"},71:{name:"TrickMasterTrackUID",
type:"Uint"},68:{name:"TrickMasterTrackSegmentUID",type:"Binary"},11648:{name:"ContentEncodings",type:"Container"},8768:{name:"ContentEncoding",type:"Container"},4145:{name:"ContentEncodingOrder",type:"Uint"},4146:{name:"ContentEncodingScope",type:"Uint"},4147:{name:"ContentEncodingType",type:"Uint"},4148:{name:"ContentCompression",type:"Container"},596:{name:"ContentCompAlgo",type:"Uint"},597:{name:"ContentCompSettings",type:"Binary"},4149:{name:"ContentEncryption",type:"Container"},2017:{name:"ContentEncAlgo",
type:"Uint"},2018:{name:"ContentEncKeyID",type:"Binary"},2019:{name:"ContentSignature",type:"Binary"},2020:{name:"ContentSigKeyID",type:"Binary"},2021:{name:"ContentSigAlgo",type:"Uint"},2022:{name:"ContentSigHashAlgo",type:"Uint"},206814059:{name:"Cues",type:"Container"},59:{name:"CuePoint",type:"Container"},51:{name:"CueTime",type:"Uint"},55:{name:"CueTrackPositions",type:"Container"},119:{name:"CueTrack",type:"Uint"},113:{name:"CueClusterPosition",type:"Uint"},112:{name:"CueRelativePosition",type:"Uint"},
50:{name:"CueDuration",type:"Uint"},4984:{name:"CueBlockNumber",type:"Uint"},106:{name:"CueCodecState",type:"Uint"},91:{name:"CueReference",type:"Container"},22:{name:"CueRefTime",type:"Uint"},23:{name:"CueRefCluster",type:"Uint"},4959:{name:"CueRefNumber",type:"Uint"},107:{name:"CueRefCodecState",type:"Uint"},155296873:{name:"Attachments",type:"Container"},8615:{name:"AttachedFile",type:"Container"},1662:{name:"FileDescription",type:"String"},1646:{name:"FileName",type:"String"},1632:{name:"FileMimeType",
type:"String"},1628:{name:"FileData",type:"Binary"},1710:{name:"FileUID",type:"Uint"},1653:{name:"FileReferral",type:"Binary"},1633:{name:"FileUsedStartTime",type:"Uint"},1634:{name:"FileUsedEndTime",type:"Uint"},4433776:{name:"Chapters",type:"Container"},1465:{name:"EditionEntry",type:"Container"},1468:{name:"EditionUID",type:"Uint"},1469:{name:"EditionFlagHidden",type:"Uint"},1499:{name:"EditionFlagDefault",type:"Uint"},1501:{name:"EditionFlagOrdered",type:"Uint"},54:{name:"ChapterAtom",type:"Container"},
13252:{name:"ChapterUID",type:"Uint"},5716:{name:"ChapterStringUID",type:"String"},17:{name:"ChapterTimeStart",type:"Uint"},18:{name:"ChapterTimeEnd",type:"Uint"},24:{name:"ChapterFlagHidden",type:"Uint"},1432:{name:"ChapterFlagEnabled",type:"Uint"},11879:{name:"ChapterSegmentUID",type:"Binary"},11964:{name:"ChapterSegmentEditionUID",type:"Uint"},9155:{name:"ChapterPhysicalEquiv",type:"Uint"},15:{name:"ChapterTrack",type:"Container"},9:{name:"ChapterTrackNumber",type:"Uint"},0:{name:"ChapterDisplay",
type:"Container"},5:{name:"ChapString",type:"String"},892:{name:"ChapLanguage",type:"String"},894:{name:"ChapCountry",type:"String"},10564:{name:"ChapProcess",type:"Container"},10581:{name:"ChapProcessCodecID",type:"Uint"},1293:{name:"ChapProcessPrivate",type:"Binary"},10513:{name:"ChapProcessCommand",type:"Container"},10530:{name:"ChapProcessTime",type:"Uint"},10547:{name:"ChapProcessData",type:"Binary"},39109479:{name:"Tags",type:"Container"},13171:{name:"Tag",type:"Container"},9152:{name:"Targets",
type:"Container"},10442:{name:"TargetTypeValue",type:"Uint"},9162:{name:"TargetType",type:"String"},9157:{name:"TagTrackUID",type:"Uint"},9161:{name:"TagEditionUID",type:"Uint"},9156:{name:"TagChapterUID",type:"Uint"},9158:{name:"TagAttachmentUID",type:"Uint"},10184:{name:"SimpleTag",type:"Container"},1443:{name:"TagName",type:"String"},1146:{name:"TagLanguage",type:"String"},1156:{name:"TagDefault",type:"Uint"},1159:{name:"TagString",type:"String"},1157:{name:"TagBinary",type:"Binary"}};
function Jc(a,b){a.prototype=Object.create(b.prototype);a.prototype.constructor=a}function Kc(a,b){this.name=a||"Unknown";this.type=b||"Unknown"}Kc.prototype.j=function(){};Kc.prototype.m=function(){};function Lc(a,b){Kc.call(this,a,b||"Uint")}Jc(Lc,Kc);Lc.prototype.j=function(){this.data="";for(var a=0;a<this.source.length;a++){var b=this.source[a].toString(16);this.data+=1===b.length%2?"0"+b:b}};
Lc.prototype.m=function(){var a=this.data.length/2;this.source=new Uint8Array(a);for(var b=0;b<a;b++)this.source[b]=parseInt(this.data.substr(2*b,2),16)};Lc.prototype.L=function(){return parseInt(this.data,16)};Lc.prototype.H=function(a){a=a.toString(16);this.data=1===a.length%2?"0"+a:a;this.m()};function Mc(a,b){Kc.call(this,a,b||"Float")}Jc(Mc,Kc);Mc.prototype.j=function(){var a=this.source.reverse();this.data=(new (this.source&&4===this.source.length?Float32Array:Float64Array)(a.buffer))[0]};
Mc.prototype.m=function(){var a=new (this.source&&4===this.source.length?Float32Array:Float64Array)([this.data]);this.source=(new Uint8Array(a.buffer)).reverse()};Mc.prototype.L=function(){return this.data};Mc.prototype.H=function(a){this.data=a;this.m()};function Nc(a,b){Kc.call(this,a,b||"Container")}Jc(Nc,Kc);function Oc(a){var b=a.source[a.offset++],d=8-b.toString(2).length;b-=1<<7-d;for(var c=0;c<d;c++)b*=256,b+=a.source[a.offset++];return b}
Nc.prototype.j=function(){this.data=[];for(this.offset=0;this.offset<this.source.length;this.offset=b){var a=Oc(this);var b=Oc(this);b=Math.min(this.offset+b,this.source.length);var d=this.source.slice(this.offset,b),c=Ic[a]||{name:"Unknown",type:"Unknown"},h=Kc;switch(c.type){case "Container":h=Nc;break;case "Uint":h=Lc;break;case "Float":h=Mc}h=c=new h(c.name,c.type);h.source=d;h.j();this.data.push({id:a,$:a.toString(16),data:c})}};
function Pc(a,b,d){for(var c=1,h=128;b>=h&&8>c;c++,h*=128);if(!d)for(b=h+b,d=c-1;0<=d;d--)h=b%256,a.source[a.offset+d]=h,b=(b-h)/256;a.offset+=c}function Qc(a,b){for(var d=a.offset=0;d<a.data.length;d++){var c=a.data[d],h=c.data.source,l=h.length;Pc(a,c.id,b);Pc(a,l,b);b||a.source.set(h,a.offset);a.offset+=l}return a.offset}Nc.prototype.m=function(){var a=Qc(this,"draft");this.source=new Uint8Array(a);Qc(this,null)};
function Rc(a,b){for(var d=0;d<a.data.length;d++){var c=a.data[d];if(c.id===b)return c.data}return null}function Sc(a){Nc.call(this,"File","File");this.source=a;this.j()}Jc(Sc,Nc);
function Tc(a,b,d){d=d&&d.U;void 0===d?d=function(D){console.log(D)}:d||=function(){};var c=Rc(a,139690087);if(!c)return d("[fix-webm-duration] Segment section is missing"),!1;var h=Rc(c,88713574);if(!h)return d("[fix-webm-duration] Info section is missing"),!1;var l=Rc(h,710577);if(!l)return d("[fix-webm-duration] TimecodeScale section is missing"),!1;var t=Rc(h,1161);if(t)if(0>=t.L())d("[fix-webm-duration] Duration section is present, but the value is empty"),t.H(b);else return d("[fix-webm-duration] Duration section is present"),
!1;else d("[fix-webm-duration] Duration section is missing"),t=new Mc("Duration","Float"),t.H(b),h.data.push({id:1161,data:t});l.H(1E6);h.m();c.m();a.m();return!0}function Hc(a,b,d,c){try{var h=new FileReader;h.onloadend=function(){try{var l=new Sc(new Uint8Array(h.result));Tc(l,b,c)&&(a=new Blob([l.source.buffer],{type:a.type||"video/webm"}))}catch(t){}d(a)};h.readAsArrayBuffer(a)}catch(l){d(a)}};var Uc;
(function(){function a(r){let m=v.get(r);"undefined"===typeof m&&(m=new Function("return "+r+";"),v.set(r,m));return m()}function b(r){let m={exports:null,B:null,I:null};d(r);c(r);h(r,m);l(r,m);r.teavmMath=Math;return{O(u){m.exports=u},Y(u){m.B=u},X(u){m.I=u}}}function d(r){r.teavmDate={currentTimeMillis:()=>(new Date).getTime(),dateToString:m=>(new Date(m)).toString(),getYear:m=>(new Date(m)).getFullYear(),setYear:(m,u)=>{m=new Date(m);m.setFullYear(u);return m.getTime()},getMonth:m=>(new Date(m)).getMonth(),setMonth:(m,
u)=>{m=new Date(m);m.setMonth(u);return m.getTime()},getDate:m=>(new Date(m)).getDate(),setDate:(m,u)=>{m=new Date(m);m.setDate(u);return m.getTime()},create:(m,u,w,f,x,p)=>(new Date(m,u,w,f,x,p)).getTime(),createFromUTC:(m,u,w,f,x,p)=>Date.UTC(m,u,w,f,x,p)}}function c(r){let m=[],u=[];r.teavmConsole={putcharStderr:function(w){10===w?(w=String.fromCharCode(...m),console.error(w),ea&&ea(w,!0),m.length=0):m.push(w)},putcharStdout:function(w){10===w?(w=String.fromCharCode(...u),console.log(w),ea&&ea(w,
!1),u.length=0):u.push(w)}}}function h(r,m){let u=new FinalizationRegistry(f=>{let x=m.exports["teavm.reportGarbageCollectedValue"];"undefined"!==typeof x&&m.I(function(){x(f.V,f.W)})}),w=new FinalizationRegistry(f=>{let x=m.exports["teavm.reportGarbageCollectedString"];"function"===typeof x&&m.I(function(){x(f)})});r.teavm={createWeakRef:(f,x,p)=>{null!==p&&u.register(f,{W:x,V:p});return new WeakRef(f)},deref:f=>f.deref(),createStringWeakRef:(f,x)=>{w.register(f,x);return new WeakRef(f)},stringDeref:f=>
f.deref(),takeStackTrace:()=>{var f=Error().stack;let x=[];for(let p of f.split("\n"))f=S.exec(p),null!==f&&2<=f.length&&x.push(parseInt(f[1],16));return{getStack:function(){let p;if(m.B)try{p=m.B(x)}catch(z){console.warn("Could not deobfuscate stack",z)}p||=x.map(z=>({className:"java.lang.Throwable$FakeClass",method:"fakeMethod",file:"Throwable.java",line:z}));return p}}},decorateException:f=>{new K(m,f)}}}function l(r,m){function u(n){return n}function w(n){var q=n.charAt(0);var F=""+(f(q)?q:"_");
for(q=1;q<n.length;++q){let Q=n.charAt(q);var L=Q;L=f(L)||"0"<=L&&"9">=L;F+=L?Q:"_"}return F}function f(n){return"A"<=n&&"Z">=n||"a"<=n&&"z">=n||"_"===n||"$"===n}function x(n,q,F){null===n?(new Function("value",q+" = value;"))(F):n[q]=F}function p(n){m.exports["teavm.js.throwException"](U in n?n[U]:m.exports["teavm.js.wrapException"](n))}function z(n){a:{if(n instanceof WebAssembly.Exception){var q=m.exports["teavm.javaException"];var F=m.exports["teavm.getJsException"];if(n.is(q)){n=n.getArg(q,0);
q=m.exports["teavm.js.extractException"](n);if(null!==q){F=q;break a}F=F(n);"undefined"===typeof F&&(F=new K(m,n));break a}}F=n}throw F;}function E(n){var q=[];for(let F=0;F<n.length;++F)q.push("p"+F);q=0===q.length?"":q.join(", ");q=(new Function("rethrowJavaAsJs","fn",`return function(${q}) {\n`+" try {\n"+` return fn(${q});\n`+" } catch (e) {\n rethrowJavaAsJs(e);\n }\n};"))(z,n);q.__impl=n;q.__rethrow=z;return q}function H(n,q){return(new Function("constructor",`return function ${n}(marker, javaObject) {\n`+
" return constructor.call(this, marker, javaObject);\n}\n"))(q)}function O(n){try{return n()}catch(q){p(q)}}let ma=Symbol("javaObject"),Z=Symbol("functions"),X=Symbol("functionOrigin"),Ga=Symbol("wrapperCallMarker"),Aa=new WeakMap,Ba=new WeakMap,Ha=new Map,ta=new FinalizationRegistry(n=>Ha.delete(n)),Ia=new WeakMap,ua=2463534242;r.teavmJso={emptyString:()=>"",stringFromCharCode:n=>String.fromCharCode(n),concatStrings:(n,q)=>n+q,stringLength:n=>n.length,charAt:(n,q)=>n.charCodeAt(q),emptyArray:()=>
[],appendToArray:(n,q)=>n.push(q),unwrapBoolean:n=>n?1:0,wrapBoolean:n=>!!n,getProperty:function(n,q){try{return null!==n?n[q]:a(q)}catch(F){p(F)}},setProperty:x,setPropertyPure:x,global:n=>{try{return a(n)}catch(q){p(q)}},createClass:(n,q,F)=>{n=w(n||"JavaObject");let L;L=null===q?function(aa){this[ma]=aa;this[Z]=null}:function(aa){q.call(this,aa)};let Q=H(n,function(aa,pa){if(aa===Ga)L.call(this,pa);else{if(null===F)throw Error("This class can't be instantiated directly");try{return F.apply(null,
arguments)}catch(Ra){z(Ra)}}});Q.prototype=Object.create(q||Object.prototype);Q.prototype.constructor=Q;n=H(n,function(aa){return Q.call(this,Ga,aa)});n[Ga]=Q;n.prototype=Q.prototype;return n},exportClass:n=>n[Ga],defineMethod:(n,q,F)=>{let L=[];for(let Q=1;Q<F.length;++Q)L.push("p"+Q);n.prototype[q]=(new Function("rethrowJavaAsJs","fn",`return function(${0===L.length?"":L.join(", ")}) {\n`+" try {\n"+` return fn(${["this",L].join(", ")});\n`+" } catch (e) {\n rethrowJavaAsJs(e);\n }\n};"))(z,
F)},defineStaticMethod:(n,q,F)=>{n[q]=E(F)},defineFunction:E,defineProperty:(n,q,F,L)=>{let Q={get(){try{return F(this)}catch(aa){z(aa)}}};null!==L&&(Q.set=function(aa){try{L(this,aa)}catch(pa){z(pa)}});Object.defineProperty(n.prototype,q,Q)},defineStaticProperty:(n,q,F,L)=>{let Q={get(){try{return F()}catch(aa){z(aa)}}};null!==L&&(Q.set=function(aa){try{L(aa)}catch(pa){z(pa)}});Object.defineProperty(n,q,Q)},javaObjectToJS:(n,q)=>{if(null===n)return null;var F=Aa.get(n);if("undefined"!=typeof F&&
(F=F.deref(),"undefined"!==typeof F))return F;q=new q(n);Aa.set(n,new WeakRef(q));return q},unwrapJavaObject:n=>n[ma],asFunction:(n,q)=>{let F=n[Z];null===F&&(F=Object.create(null),n[Z]=F);let L=F[q];"function"!==typeof L&&(L=function(){return n[q].apply(n,arguments)},L[X]=n,F[q]=L);return L},functionAsObject:(n,q)=>{let F=n[X];if("undefined"!==typeof F){let L=F[Z];if(void 0!==L&&L[q]===n)return F}return{[q]:function(...L){try{return n(...L)}catch(Q){z(Q)}}}},wrapObject:n=>{if(null===n)return null;
if("object"===typeof n||"function"===typeof n){var q=n[ma];if("object"===typeof q)return q;q=Ba.get(n);if(void 0!==q&&(q=q.deref(),void 0!==q))return q;q=m.exports["teavm.jso.createWrapper"](n);Ba.set(n,new WeakRef(q));return q}q=Ha.get(n);if(void 0!==q&&(q=q.deref(),void 0!==q))return q;q=m.exports["teavm.jso.createWrapper"](n);Ha.set(n,new WeakRef(q));ta.register(q,n);return q},isPrimitive:(n,q)=>typeof n===q,instanceOf:(n,q)=>n instanceof q,instanceOfOrNull:(n,q)=>null===n||n instanceof q,sameRef:(n,
q)=>n===q,hashCode:n=>{if("object"===typeof n||"function"===typeof n||"symbol"===typeof n){var q=Ia.get(n);if("number"===typeof q)return q;q=ua;q^=q<<13;q^=q>>>17;ua=q^=q<<5;Ia.set(n,q);return q}return"number"===typeof n?n|0:"bigint"===typeof n?BigInt.asIntN(32,n):"boolean"===typeof n?n?1:0:0},apply:(n,q,F)=>{try{return null===n?a(q)(...F):n[q](...F)}catch(L){p(L)}},concatArray:(n,q)=>n.concat(q),getJavaException:n=>n[U]};for(var ka of"wrapByte wrapShort wrapChar wrapInt wrapFloat wrapDouble unwrapByte unwrapShort unwrapChar unwrapInt unwrapFloat unwrapDouble".split(" "))r.teavmJso[ka]=
u;ka=[];for(let n=0;32>n;++n){let q=0===ka.length?"":ka.join(", "),F=[...ka,"body"].join(", ");r.teavmJso["createFunction"+n]=(new Function("wrapCallFromJavaToJs",...ka,"body",`return new Function('wrapCallFromJavaToJs', ${F}).bind(this, wrapCallFromJavaToJs);`)).bind(null,O);r.teavmJso["bindFunction"+n]=(L,...Q)=>L.bind(null,...Q);r.teavmJso["callFunction"+n]=(new Function("rethrowJsAsJava","fn",...ka,"try {\n"+` return fn(${q});\n`+"} catch (e) {\n rethrowJsAsJava(e);\n}")).bind(null,p);r.teavmJso["callMethod"+
n]=(new Function("rethrowJsAsJava","getGlobalName","instance","method",...ka,"try {\n return instance !== null\n"+` ? instance[method](${q})\n`+` : getGlobalName(method)(${q});\n`+"} catch (e) {\n rethrowJsAsJava(e);\n}")).bind(null,p,a);r.teavmJso["construct"+n]=(new Function("rethrowJsAsJava","constructor",...ka,"try {\n"+` return new constructor(${q});\n`+"} catch (e) {\n rethrowJsAsJava(e);\n}")).bind(null,p);r.teavmJso["arrayOf"+n]=new Function(...ka,"return ["+q+"]");
ka.push("p"+(n+1))}}async function t(r){try{const m={},u=b(m),w=r.path instanceof WebAssembly.Module?r.path:await WebAssembly.compileStreaming(fetch(r.path)),f=new WebAssembly.Instance(w,m);u.O(f.exports);return{module:w,instance:f}}catch(m){return console.warn("Could not load deobfuscator",m),null}}function D(r,m,u){let w=null,f=!1;return x=>{if(!f){f=!0;if(null!==m)try{w=u.exports.createFromExternalFile.value(m)}catch(p){console.warn("Could not load create deobfuscator",p)}if(null==w&&null!==r)try{w=
u.exports.createForModule.value(r)}catch(p){console.warn("Could not create deobfuscator from module data",p)}}return null!==w?w.deobfuscate(x):[]}}async function y(r,m){if(!m.enabled||"auto"!==r&&"external"!==r)return null;if(m.J instanceof ArrayBuffer)return new Int8Array(m.J);r=await fetch(m.J);return r.ok?new Int8Array(await r.arrayBuffer()):null}function B(r){const m=new qa;r.teavm.pollAsyncCallbacks=function(){for(var u;u=m.j();)u.fn()};return function(u){m.push({fn:u,_next:null})}}let v=new Map,
S=/.+:wasm-function\[[0-9]+]:0x([0-9a-f]+).*/,U=Symbol("javaException");class K extends Error{constructor(r,m){super();this.j=r;this[U]=m;r.exports["teavm.setJsException"](m,this)}get message(){var r=this.j.exports["teavm.exceptionMessage"];return"function"===typeof r&&(r=r(this[U]),null!=r)?r:"(could not fetch message)"}}Uc={load:async function(r,m){m||={};var u=m.B||{};let [w,f,x]=await Promise.all([u.enabled?t(u):Promise.resolve(null),r instanceof WebAssembly.Module?Promise.resolve(r):WebAssembly.compileStreaming(fetch(r)),
y(u.T,u)]);u={};r=b(u);"undefined"!==typeof m.M&&m.M(u);r.X(B(u));m=await WebAssembly.instantiate(f,u);u={};r.O(m.exports);if(w){let p=D(null,x,w.instance);null!==p&&(r.Y(p),u.deobfuscator=p)}r={exports:u,instance:m,N:{P:f,S:w?w.module:null}};for(let p in m.exports){let z=m.exports[p];z instanceof WebAssembly.Global?Object.defineProperty(u,p,{get:()=>z.value}):"function"===typeof z&&(u[p]=z)}u.memory=m.exports["teavm.memory"];u.R=x;return r},Z:b,aa:function(r){return new Proxy(r,{get(m,u){return new WebAssembly.Global({value:"externref",
mutable:!1},m[u])}})}}})();async function Vc(){try{N=self.__eaglercraftXLoaderContext.getEaglercraftXOpts();Ua=self.__eaglercraftXLoaderContext.getEagRuntimeJSURL();const a=self.__eaglercraftXLoaderContext.getClassesWASMURL(),b=self.__eaglercraftXLoaderContext.getClassesDeobfWASMURL(),d=self.__eaglercraftXLoaderContext.getClassesTEADBGURL();Pa=self.__eaglercraftXLoaderContext.getEPKFiles();Va=self.__eaglercraftXLoaderContext.getRootElement();self.__eaglercraftXLoaderContext.getImageURL(0);Qa=self.__eaglercraftXLoaderContext.getImageURL(1);
Sa=self.__eaglercraftXLoaderContext.getImageURL(2);Ta=self.__eaglercraftXLoaderContext.getImageURL(3);const c=self.__eaglercraftXLoaderContext.getMainArgs();if("_worker_process_"!==c[0]){if(!await Hb())return}else da="worker",await Vb();e("Loading EaglercraftX WASM GC binary...");const h=await Uc.load(a,{B:{enabled:!0,path:b,T:"external",J:d},M:function(l){l.WASMGCBufferAllocator=ra;l.platformApplication=G;l.platformAssets=wa;l.platformAudio=xa;l.platformFilesystem=ya;l.platformInput=I;l.platformNetworking=
za;l.platformOpenGL=J;l.platformRuntime=Ca;l.platformScreenRecord=Da;l.platformVoiceClient=Ea;l.platformWebRTC=M;l.platformWebView=Fa;l.clientPlatformSingleplayer=Ja;l.serverPlatformSingleplayer=Ka;l.teavm.notifyHeapResized=function(){Xb(h.exports.memory)}}});La=h.N.P;Ma=h.N.S;Na=h.exports.R;Xb(h.exports.memory);Oa=h.exports.deobfuscator;e("Calling entry point with args: {}",JSON.stringify(c));try{await WebAssembly.promising(h.exports.main.__impl)(c)}catch(l){h.exports.main.__rethrow(l)}finally{ha("Main function has returned!")}}catch(a){$b(a)}}
"object"===typeof self.__eaglercraftXLoaderContext?self.__eaglercraftXLoaderContext.runMain(Vc):console.error("???");}).call(this);