"}m.virtualGamepadContainer.innerHTML=o+="",V(m.virtualGamepadContainer,!e);a=pe.a.create({zone:q.call(this,".".concat(X({"ejs-virtual-gamepad":!0})," .").concat(X({left:!0}))),mode:"static",position:{left:"50%",top:"50%"},color:"red"});function r(){var e;return"n64"!==t.system||"d-pad"===(e=ae&&"function"==typeof ae.getCoreOptionsValues?ae.getCoreOptionsValues()["joystick-input"]:e)?{downVal:1,4:4,5:5,6:6,7:7}:{downVal:32767,4:19,5:18,6:17,7:16}}a.on("end",function(e,t){m.syncInput(0,r()[4],0),m.syncInput(0,r()[5],0),m.syncInput(0,r()[6],0),m.syncInput(0,r()[7],0)}),a.on("move",function(e,t){t=t.angle.degree;30<=t&&t<150?m.syncInput(0,r()[4],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[4],0)},30),210<=t&&t<330?m.syncInput(0,r()[5],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[5],0)},30),120<=t&&t<240?m.syncInput(0,r()[6],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[6],0)},30),300<=t||0<=t&&t<60?m.syncInput(0,r()[7],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[7],0)},30)});var l,c=X({"virtual-gamepad":!0}),d=X({touch:!0}),a=(W.isIos||B.call(this,q.call(this,".".concat(c)),"touchmove",function(e){e.stopPropagation()}),[{id:{b_a:!0},number:8},{id:{b_b:!0},number:0},{id:{b_x:!0},number:9},{id:{b_y:!0},number:1},{id:{b_l:!0},number:10},{id:{b_z:!0},number:12},{id:{b_r:!0},number:11},{id:{b_start:!0},number:3},{id:{b_select:!0},number:2},{id:{b_cu:!0},number:23},{id:{b_cd:!0},number:22},{id:{b_cl:!0},number:21},{id:{b_cr:!0},number:20}]),a=("n64"===t.system&&(a[0].number=0,a[1].number=1),a.forEach(t=>{B.call(this,q.call(this,".".concat(c," .").concat(X(t.id))),"touchstart touchend",function(e){["touchend"].includes(e.type)?(H(e.target,d,!1),window.setTimeout(function(){m.syncInput(0,t.number,0)},30)):(H(e.target,d,!0),m.syncInput(0,t.number,1)),e.stopPropagation()})}),U("div",{class:X({ejs__widget:!0,ejs__widget_controls_toggle:!0})},""));a.innerHTML='',q.call(this,".".concat(X({ejs__widgets:!0}))).appendChild(a),B.call(this,a,"mousedown touchstart",function(e){H(e.target,d,!0),clearTimeout(l),Q.toggleControls.call(t,!0),l=setTimeout(function(){Q.toggleControls.call(t,!1)},5e3)})}else V(m.virtualGamepadContainer,!e)},setup:function(){var e,t,n,a=this;this.game?(m.playerName=a.config.playerName,H(this.elements.container,this.config.classNames.type,!0),this.elements.container.setAttribute("tabindex","0"),this.color&&(e=function(e){var t=e.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){for(var n="#",a=1;a<4;a+=1)n+=t.slice(a,a+1).concat(t.slice(a,a+1));t=n}for(var o=[],i=1;i<7;i+=2)o.push(parseInt("0x".concat(t.slice(i,i+2)),16));return o}return null}(this.color))&&this.elements.container.setAttribute("style","--ejs-primary-color: ".concat(e[0],", ").concat(e[1],", ").concat(e[2])),this.elements.wrapper=U("div",{class:this.config.classNames.video}),I(this.game,this.elements.wrapper),"video"!==a.game.tagName.toLocaleLowerCase()&&(t=this.config.volume,Object.defineProperty(a.game,"volume",{get:function(){return t},set:function(e){t=e,G.call(a,a.game,"volumechange")}}),n=a.storage.get("muted"),Object.defineProperty(a.game,"muted",{get:function(){return n},set:function(e){e=!!F.boolean(e)&&e;n=e,G.call(a,a.game,"volumechange")}})),window.addEventListener("beforeunload",function(e){a.started&&(p.FS.syncfs(function(){}),m.saveSavFiles(),p.FS.syncfs(function(){}))},!0)):console.warn("No game element found!")},listeners:function(){var s=this;s.elements.buttons.restart&&B.call(s,s.elements.buttons.restart,"click",function(e){m.restartGame(),m.inputsData={}}),s.elements.buttons.screenRecord&&B.call(s,s.elements.buttons.screenRecord,"click",function(e){var a,o,i;s.recordData||(s.recordData={started:!1,data:[],stopped:!1}),s.recordData.started?s.recordData.started&&(s.recordData.recorder.stop(),s.recordData.stopped=!0):(a=MediaRecorder.isTypeSupported("video/webm; codecs=h264")?{mimeType:"video/webm; codecs=h264"}:MediaRecorder.isTypeSupported("video/webm; codecs=H264")?{mimeType:"video/webm; codecs=H264"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp9")?{mimeType:"video/webm; codecs=vp9"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp8")?{mimeType:"video/webm; codecs=vp8"}:MediaRecorder.isTypeSupported("video/webm; codecs=avc1")?{mimeType:"video/webm; codecs=avc1"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp9.0")?{mimeType:"video/webm; codecs=vp9.0"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp8.0")?{mimeType:"video/webm; codecs=vp8.0"}:{},p.Module.pauseMainLoop(),s.playing=!1,alert('please check "share system audio" to have audio in the recording. We only need the audio stream so your entire screen will not be recorded'),o=p.Module.canvas.captureStream(30),i=setTimeout(function(){s.playing=!0,p.Module.resumeMainLoop()},2e4),navigator.mediaDevices.getDisplayMedia({audio:!0,video:{mediaSource:"screen"}}).then(function(e){try{clearTimeout(i)}catch(e){}for(var t=e.getAudioTracks(),n=0;n>0;if(0>0,o=0;o".concat(this.icons[e],"");for(var a=t.childNodes[0].childNodes,o=0;o",""]),i=[];function n(e,t,n){"function"==typeof n?i.push(n):i.push(function(){});n=a.length-1;t?a.splice(n,0,'
"}m.virtualGamepadContainer.innerHTML=o+="",V(m.virtualGamepadContainer,!e);a=pe.a.create({zone:q.call(this,".".concat(X({"ejs-virtual-gamepad":!0})," .").concat(X({left:!0}))),mode:"static",position:{left:"50%",top:"50%"},color:"red"});function r(){var e;return"n64"!==t.system||"d-pad"===(e=ae&&"function"==typeof ae.getCoreOptionsValues?ae.getCoreOptionsValues()["joystick-input"]:e)?{downVal:1,4:4,5:5,6:6,7:7}:{downVal:32767,4:19,5:18,6:17,7:16}}a.on("end",function(e,t){m.syncInput(0,r()[4],0),m.syncInput(0,r()[5],0),m.syncInput(0,r()[6],0),m.syncInput(0,r()[7],0)}),a.on("move",function(e,t){t=t.angle.degree;30<=t&&t<150?m.syncInput(0,r()[4],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[4],0)},30),210<=t&&t<330?m.syncInput(0,r()[5],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[5],0)},30),120<=t&&t<240?m.syncInput(0,r()[6],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[6],0)},30),300<=t||0<=t&&t<60?m.syncInput(0,r()[7],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[7],0)},30)});var l,c=X({"virtual-gamepad":!0}),d=X({touch:!0}),a=(W.isIos||B.call(this,q.call(this,".".concat(c)),"touchmove",function(e){e.stopPropagation()}),[{id:{b_a:!0},number:8},{id:{b_b:!0},number:0},{id:{b_x:!0},number:9},{id:{b_y:!0},number:1},{id:{b_l:!0},number:10},{id:{b_z:!0},number:12},{id:{b_r:!0},number:11},{id:{b_start:!0},number:3},{id:{b_select:!0},number:2},{id:{b_cu:!0},number:23},{id:{b_cd:!0},number:22},{id:{b_cl:!0},number:21},{id:{b_cr:!0},number:20}]),a=("n64"===t.system&&(a[0].number=0,a[1].number=1),a.forEach(t=>{B.call(this,q.call(this,".".concat(c," .").concat(X(t.id))),"touchstart touchend",function(e){["touchend"].includes(e.type)?(H(e.target,d,!1),window.setTimeout(function(){m.syncInput(0,t.number,0)},30)):(H(e.target,d,!0),m.syncInput(0,t.number,1)),e.stopPropagation()})}),U("div",{class:X({ejs__widget:!0,ejs__widget_controls_toggle:!0})},""));a.innerHTML='',q.call(this,".".concat(X({ejs__widgets:!0}))).appendChild(a),B.call(this,a,"mousedown touchstart",function(e){H(e.target,d,!0),clearTimeout(l),Q.toggleControls.call(t,!0),l=setTimeout(function(){Q.toggleControls.call(t,!1)},5e3)})}else V(m.virtualGamepadContainer,!e)},setup:function(){var e,t,n,a=this;this.game?(m.playerName=a.config.playerName,H(this.elements.container,this.config.classNames.type,!0),this.elements.container.setAttribute("tabindex","0"),this.color&&(e=function(e){var t=e.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){for(var n="#",a=1;a<4;a+=1)n+=t.slice(a,a+1).concat(t.slice(a,a+1));t=n}for(var o=[],i=1;i<7;i+=2)o.push(parseInt("0x".concat(t.slice(i,i+2)),16));return o}return null}(this.color))&&this.elements.container.setAttribute("style","--ejs-primary-color: ".concat(e[0],", ").concat(e[1],", ").concat(e[2])),this.elements.wrapper=U("div",{class:this.config.classNames.video}),I(this.game,this.elements.wrapper),"video"!==a.game.tagName.toLocaleLowerCase()&&(t=this.config.volume,Object.defineProperty(a.game,"volume",{get:function(){return t},set:function(e){t=e,G.call(a,a.game,"volumechange")}}),n=a.storage.get("muted"),Object.defineProperty(a.game,"muted",{get:function(){return n},set:function(e){e=!!F.boolean(e)&&e;n=e,G.call(a,a.game,"volumechange")}})),window.addEventListener("beforeunload",function(e){a.started&&(p.FS.syncfs(function(){}),m.saveSavFiles(),p.FS.syncfs(function(){}))},!0)):console.warn("No game element found!")},listeners:function(){var s=this;s.elements.buttons.restart&&B.call(s,s.elements.buttons.restart,"click",function(e){m.restartGame(),m.inputsData={}}),s.elements.buttons.screenRecord&&B.call(s,s.elements.buttons.screenRecord,"click",function(e){var a,o,i;s.recordData||(s.recordData={started:!1,data:[],stopped:!1}),s.recordData.started?s.recordData.started&&(s.recordData.recorder.stop(),s.recordData.stopped=!0):(a=MediaRecorder.isTypeSupported("video/webm; codecs=h264")?{mimeType:"video/webm; codecs=h264"}:MediaRecorder.isTypeSupported("video/webm; codecs=H264")?{mimeType:"video/webm; codecs=H264"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp9")?{mimeType:"video/webm; codecs=vp9"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp8")?{mimeType:"video/webm; codecs=vp8"}:MediaRecorder.isTypeSupported("video/webm; codecs=avc1")?{mimeType:"video/webm; codecs=avc1"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp9.0")?{mimeType:"video/webm; codecs=vp9.0"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp8.0")?{mimeType:"video/webm; codecs=vp8.0"}:{},p.Module.pauseMainLoop(),s.playing=!1,alert('please check "share system audio" to have audio in the recording. We only need the audio stream so your entire screen will not be recorded'),o=p.Module.canvas.captureStream(30),i=setTimeout(function(){s.playing=!0,p.Module.resumeMainLoop()},2e4),navigator.mediaDevices.getDisplayMedia({audio:!0,video:{mediaSource:"screen"}}).then(function(e){try{clearTimeout(i)}catch(e){}for(var t=e.getAudioTracks(),n=0;n>0;if(0>0,o=0;o".concat(this.icons[e],"");for(var a=t.childNodes[0].childNodes,o=0;o",""]),i=[];function n(e,t,n){"function"==typeof n?i.push(n):i.push(function(){});n=a.length-1;t?a.splice(n,0,'