forked from EmulatorOS/games
-
Notifications
You must be signed in to change notification settings - Fork 0
/
emulator.min.js
1 lines (1 loc) · 483 KB
/
emulator.min.js
1
var EJS=function(n){window.EJS_MODULES=n;var o={},i=[];function a(e){if(o[e])return o[e].exports;i.push(e);var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}return window.aba=function(){return i.sort(function(e,t){return t<e?1:-1})},Array.isArray,a.m=n,a.c=o,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)a.d(n,o,function(e){return t[e]}.bind(null,o));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=396)}([function(e){e.exports=function(e,t,n){console.warn(e),e&&e.response&&0===e.response.status?t.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;"><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors">'+n.localization("CORS Error")+"</a></strong>":t.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+n.localization("Network Error")+"</strong>"}},null,null,null,null,null,function(e,t,n){!function(e){"use strict";function o(){}function t(e){var t=this,n=window;this.update=o,this.requestAnimationFrame=e||n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame,this.tickFunction=function(){t.update(),t.startTicker()},this.startTicker=function(){t.requestAnimationFrame.apply(n,[t.tickFunction])}}function n(){}function i(e,t){this.listener=e,this.gamepadGetter=t,this.knownGamepads=[]}function a(t){this.listener=t,window.addEventListener("gamepadconnected",function(e){t._connect(e.gamepad)}),window.addEventListener("gamepaddisconnected",function(e){t._disconnect(e.gamepad)})}function l(e){this.updateStrategy=e||new t,this.gamepads=[],this.listeners={},this.platform=r,this.deadzone=.03,this.maximizeThreshold=.97}var r={getType:function(){return"null"},isSupported:function(){return!1},update:o};t.prototype.start=function(e){this.update=e||o,this.startTicker()},n.prototype.update=o,n.prototype.start=function(e){this.update=e||o},i.factory=function(e){var t=r,n=window&&window.navigator;return n&&(void 0!==n.getGamepads?t=new i(e,function(){return n.getGamepads()}):void 0!==n.webkitGamepads?t=new i(e,function(){return n.webkitGamepads()}):void 0!==n.webkitGetGamepads&&(t=new i(e,function(){return n.webkitGetGamepads()}))),t},i.getType=function(){return"WebKit"},i.prototype.getType=function(){return i.getType()},i.prototype.isSupported=function(){return!0},i.prototype.update=function(){for(var e,t=Array.prototype.slice.call(this.gamepadGetter(),0),n=this.knownGamepads.length-1;0<=n;n--)e=this.knownGamepads[n],t.indexOf(e)<0&&(this.knownGamepads.splice(n,1),this.listener._disconnect(e));for(n=0;n<t.length;n++)(e=t[n])&&this.knownGamepads.indexOf(e)<0&&(this.knownGamepads.push(e),this.listener._connect(e))},a.factory=function(e){var t=r;return t=window&&void 0!==window.addEventListener?new a(e):t},a.getType=function(){return"Firefox"},a.prototype.getType=function(){return a.getType()},a.prototype.isSupported=function(){return-1!==(window&&window.navigator).userAgent.indexOf("Firefox")},a.prototype.update=o;l.UpdateStrategies={AnimFrameUpdateStrategy:t,ManualUpdateStrategy:n},l.PlatformFactories=[a.factory,i.factory],l.Type={N64:"n64",PLAYSTATION:"playstation",LOGITECH:"logitech",XBOX:"xbox",ECKA:"ecka",UNKNOWN:"unknown"},l.Event={CONNECTED:"connected",UNSUPPORTED:"unsupported",DISCONNECTED:"disconnected",TICK:"tick",BUTTON_DOWN:"button-down",BUTTON_UP:"button-up",AXIS_CHANGED:"axis-changed"},l.StandardButtons=["BUTTON_1","BUTTON_2","BUTTON_3","BUTTON_4","LEFT_TOP_SHOULDER","RIGHT_TOP_SHOULDER","LEFT_BOTTOM_SHOULDER","RIGHT_BOTTOM_SHOULDER","SELECT_BACK","START_FORWARD","LEFT_STICK","RIGHT_STICK","DPAD_UP","DPAD_DOWN","DPAD_LEFT","DPAD_RIGHT","HOME"],l.StandardAxes=["LEFT_STICK_X","LEFT_STICK_Y","RIGHT_STICK_X","RIGHT_STICK_Y"];function d(e,t,n){return t<e.length?e[t]:n+(t-e.length+1)}var u;function s(){return 0}l.StandardMapping={env:{},buttons:{byButton:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},axes:{byAxis:[0,1,2,3]}},l.Mappings=[{env:{platform:a.getType(),type:l.Type.N64},buttons:{byButton:[2,1,3,0,4,5,-1,-1,8,9,-1,-1,12,13,14,15,-1]},axes:{byAxis:[1,2,-1,-1]}},{env:{platform:i.getType(),type:l.Type.N64},buttons:{byButton:[2,1,3,0,4,5,-1,-1,8,9,-1,-1,12,13,14,15,-1]},axes:{byAxis:[0,1,-1,-1]}},{env:{platform:a.getType(),type:l.Type.XBOX},buttons:{byButton:[0,1,2,3,4,5,15,16,9,8,6,7,11,12,13,14,10]},axes:{byAxis:[0,1,2,3]}},{env:{platform:a.getType(),type:l.Type.PLAYSTATION},buttons:{byButton:[14,13,15,12,10,11,8,9,0,3,1,2,4,6,7,5,16]},axes:{byAxis:[0,1,2,3]}},{env:{platform:i.getType(),type:l.Type.LOGITECH},buttons:{byButton:[1,2,0,3,4,5,6,7,8,9,10,11,11,12,13,14,10]},axes:{byAxis:[0,1,2,3]}},{env:{platform:a.getType(),type:l.Type.LOGITECH},buttons:{byButton:[0,1,2,3,4,5,-1,-1,6,7,8,9,11,12,13,14,10],byAxis:[-1,-1,-1,-1,-1,-1,[2,0,1],[2,0,-1]]},axes:{byAxis:[0,1,3,4]}},{env:{platform:i.getType(),type:l.Type.ECKA},buttons:{byButton:[2,1,3,0,4,5,6,7,8,9,10,11,11,12,13,14,10],byAxis:[-1,-1,-1,-1,-1,-1,[2,0,1],[2,0,-1]]},axes:{byAxis:[0,1,3,4]}},{env:{platform:i.getType(),type:l.Type.UNKNOWN},buttons:{byButton:[0,1,2,3,4,5,-1,-1,6,7,8,9,11,12,13,14,15,16,17,10]},axes:{byAxis:[0,1,2,5]}}],l.prototype.init=function(){var e=l.resolvePlatform(this),t=this;return this.platform=e,this.updateStrategy.start(function(){t._update()}),this.buttonState=[],this.extraButtonState=[],e.isSupported()},l.prototype.bind=function(e,t){return void 0===this.listeners[e]&&(this.listeners[e]=[]),this.listeners[e].push(t),this},l.prototype.unbind=function(e,t){if(void 0!==e){if(void 0!==t){if(void 0===this.listeners[e])return!1;for(var n=0;n<this.listeners[e].length;n++)if(this.listeners[e][n]===t)return this.listeners[e].splice(n,1),!0;return!1}this.listeners[e]=[]}else this.listeners={}},l.prototype.count=function(){return this.gamepads.length},l.prototype._fire=function(e,n){if(void 0!==this.listeners[e]){for(var t=0;t<this.listeners[e].length;t++)this.listeners[e][t].apply(this.listeners[e][t],[n]);var o=this;n.gamepad&&n.gamepad.extra_buttons&&n.gamepad.extra_buttons.forEach(function(e,t){o.extraButtonState[n.gamepad.index]||(o.extraButtonState[n.gamepad.index]=[]),o.extraButtonState[n.gamepad.index][t]=e})}},l.getNullPlatform=function(){return Object.create(r)},l.resolvePlatform=function(e){for(var t=r,n=0;!t.isSupported()&&n<l.PlatformFactories.length;n++)t=l.PlatformFactories[n](e);return t},l.prototype._connect=function(e){var t,n,o=this._resolveMapping(e);for(e.state={},e.lastState={},e.updater=[],this.buttonState[e.index]||(this.buttonState[e.index]=[]),this.extraButtonState[e.index]||(this.extraButtonState[e.index]=[]),t=o.buttons.byButton.length,n=0;n<t;n++)this._addButtonUpdater(e,o,n);for(t=o.axes.byAxis.length,n=0;n<t;n++)this._addAxisUpdater(e,o,n);if(this.gamepads[e.index]=e,!this.gamepads[e.index].extra_buttons)for(this.gamepads[e.index].extra_buttons=[],n=e.buttons.length;n<16;n++)this.extraButtonState[e.index][n]?this.gamepads[e.index].extra_buttons[n]=this.extraButtonState[e.index][n]:this.gamepads[e.index].extra_buttons[n]={pressed:!1,value:0};this._fire(l.Event.CONNECTED,e)},l.prototype._addButtonUpdater=function(i,e,t){var a=d(l.StandardButtons,t,"EXTRA_BUTTON_"),r=this._createButtonGetter(i,e.buttons,t),s=this,c={gamepad:i,control:a,index:t,gamepadIndex:i.index};i.state[a]=0,i.lastState[a]=0,null==this.buttonState[i.index][a]&&(this.buttonState[i.index][a]=0),i.updater.push(function(){var e=r(),t=i.lastState[a],n=.5<e,o=.5<t;i.state[a]=e,n&&!o?s._fire(l.Event.BUTTON_DOWN,Object.create(c)):(!n&&o||s.buttonState[i.index][a]!=e)&&s._fire(l.Event.BUTTON_UP,Object.create(c)),0!==e&&1!==e&&e!==t&&s._fireAxisChangedEvent(i,a,e),i.lastState[a]=e,s.buttonState[i.index][a]=e})},l.prototype._addAxisUpdater=function(n,e,t){var o=d(l.StandardAxes,t,"EXTRA_AXIS_"),i=this._createAxisGetter(n,e.axes,t),a=this;n.state[o]=0,n.lastState[o]=0,null==this.buttonState[n.index][o]&&(this.buttonState[n.index][o]=0),n.updater.push(function(){var e=i(),t=a.buttonState[n.index][o];(n.state[o]=e)!==t&&a._fireAxisChangedEvent(n,o,e),n.lastState[o]=e,a.buttonState[n.index][o]=e})},l.prototype._fireAxisChangedEvent=function(e,t,n){this._fire(l.Event.AXIS_CHANGED,{gamepad:e,axis:t,value:n})},l.prototype._createButtonGetter=(u=function(){return 0},function(t,e,n){var o,i,a,r,s=u,c=this;return-1!==(o=e.byButton[n])?"number"==typeof o&&o<t.buttons.length&&(s=function(){var e=t.buttons[o];return"number"==typeof e?e:"number"==typeof e.value?e.value:0}):e.byAxis&&n<e.byAxis.length&&(e=o=e.byAxis[n],"[object Array]"===Object.prototype.toString.call(e)&&3==o.length&&o[0]<t.axes.length&&(i=s=function(){var e=t.axes[o[0]];return c._applyDeadzoneMaximize(e)},a=o[1],r=o[2],n=u,a<r?n=function(){var e=r-a;return(e=(i()-a)/e)<0?0:e}:r<a&&(n=function(){var e=a-r;return 1<(e=(i()-r)/e)?0:1-e}),s=n)),s}),l.prototype._createAxisGetter=function(t,e,n){var o,i=s,a=this;return i=-1!==(o=e.byAxis[n])&&"number"==typeof o&&o<t.axes.length?function(){var e=t.axes[o];return a._applyDeadzoneMaximize(e)}:i},l.prototype._disconnect=function(e){var t,n=[];for(void 0!==this.gamepads[e.index]&&delete this.gamepads[e.index],t=0;t<this.gamepads.length;t++)void 0!==this.gamepads[t]&&(n[t]=this.gamepads[t]);this.gamepads=n,this._fire(l.Event.DISCONNECTED,e)},l.prototype._resolveControllerType=function(e){return-1!==(e=e.toLowerCase().replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")).indexOf("playstation")?l.Type.PLAYSTATION:-1!==e.indexOf("logitech")||-1!==e.indexOf("wireless gamepad")?l.Type.LOGITECH:-1!==e.indexOf("xbox")||-1!==e.indexOf("360")?l.Type.XBOX:-1!==e.indexOf("79-6-generic")&&-1!==e.indexOf("joystick")||-1!==e.indexOf("vendor: 0079 product: 0006")&&-1!==e.indexOf("generic usb joystick")?l.Type.N64:"usb joystick (vendor: 0e8f product: 0002)"===e?l.Type.ECKA:l.Type.UNKNOWN},l.prototype._resolveMapping=function(e){for(var t,n=l.Mappings,o=null,i={platform:this.platform.getType(),type:this._resolveControllerType(e.id)},a=0;!o&&a<n.length;a++)t=n[a],l.envMatchesFilter(t.env,i)&&(o=t);return o||l.StandardMapping},l.envMatchesFilter=function(e,t){var n,o=!0;for(n in e)e[n]!==t[n]&&(o=!1);return o},l.prototype._update=function(){this.platform.update(),this.gamepads.forEach(function(e){e&&e.updater.forEach(function(e){e()})}),0<this.gamepads.length&&this._fire(l.Event.TICK,this.gamepads)},l.prototype._applyDeadzoneMaximize=function(e,t,n){return t=void 0!==t?t:this.deadzone,n=void 0!==n?n:this.maximizeThreshold,0<=e?e<t?e=0:n<e&&(e=1):-t<e?e=0:e<-n&&(e=-1),e},e.Gamepad=l}(e.exports||window)},null,null,null,null,function(e,t,n){function o(o,i){try{o=new URL(o)}catch(e){}return o&&!["http:","https:"].includes(o.protocol)?new Promise(async function(e,t){if("HEAD"===i.method)e({headers:{}});else{try{var n=await fetch(o);if(i.type&&"arraybuffer"===i.type.toLowerCase())n=await n.arrayBuffer();else{n=await n.text();try{n=JSON.parse(n)}catch(e){}}}catch(e){t(e)}e({data:n,headers:{}})}}):new Promise(function(t,e){var n=new XMLHttpRequest;n.onload=function(){if(n.readyState===n.DONE){var e=n.response;try{e=JSON.parse(e)}catch(e){}t({data:e,headers:{"content-length":n.getResponseHeader("content-length"),"content-type":n.getResponseHeader("content-type"),"last-modified":n.getResponseHeader("last-modified")}})}},n.responseType=i.type,n.onerror=e,n.open(i.method,o,!0),n.send()})}e.exports={a:{get:async function(e,t){t=t&&t.responseType?t&&t.responseType:"text";return o(e,{method:"GET",type:t})},head:async function(e,t){t=t&&t.responseType?t&&t.responseType:"text";return o(e,{method:"HEAD",type:t})}}}},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,function(e,t){var n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,function(e,t){var n,o,e=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function r(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return(n=setTimeout)(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}var s,c=[],l=!1,d=-1;function u(){l&&s&&(l=!1,s.length?c=s.concat(c):d=-1,c.length&&f())}function f(){if(!l){var e=r(u);l=!0;for(var t=c.length;t;){for(s=c,c=[];++d<t;)s&&s[d].run();d=-1,t=c.length}s=null,l=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===a||!o)&&clearTimeout)return(o=clearTimeout)(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function h(){}e.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||r(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=h,e.addListener=h,e.once=h,e.off=h,e.removeListener=h,e.removeAllListeners=h,e.emit=h,e.prependListener=h,e.prependOnceListener=h,e.listeners=function(e){return[]},e.binding=function(e){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},function(e,t,n){function o(e){if(e){var t,n=e;for(t in o.prototype)n[t]=o.prototype[t];return n}}(e.exports=o).prototype.on=o.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},o.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,o=this._callbacks["$"+e];if(!o)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<o.length;i++)if((n=o[i])===t||n.fn===t){o.splice(i,1);break}return this},o.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var o=0,i=(n=n.slice(0)).length;o<i;++o)n[o].apply(this,t);return this},o.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},o.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,m,t){var o,n=t(382),a=t(151),f=t(384),r=t(385),g=t(386),i=("undefined"!=typeof ArrayBuffer&&(o=t(387)),"undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent)),s="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),v=i||s,y=(m.protocol=3,m.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6}),c=n(y),p={type:"error",data:"parser error"},b=t(388);function l(e,t,n){for(var i=new Array(e.length),o=r(e.length,n),a=0;a<e.length;a++)!function(n,e,o){t(e,function(e,t){i[n]=t,o(e,i)})}(a,e[a],o)}m.encodePacket=function(e,t,n,o){"function"==typeof t&&(o=t,t=!1),"function"==typeof n&&(o=n,n=null);var i=void 0===e.data?void 0:e.data.buffer||e.data;if("undefined"!=typeof ArrayBuffer&&i instanceof ArrayBuffer){var a=e,r=o;if(!t)return m.encodeBase64Packet(a,r);var s=a.data,c=new Uint8Array(s),l=new Uint8Array(1+s.byteLength);l[0]=y[a.type];for(var d=0;d<c.length;d++)l[d+1]=c[d];return r(l.buffer)}if(void 0!==b&&i instanceof b){s=e,a=t,r=o;if(!a)return m.encodeBase64Packet(s,r);if(v){var u=s,f=a,p=r;if(!f)return m.encodeBase64Packet(u,p);var h=new FileReader;return h.onload=function(){m.encodePacket({type:u.type,data:h.result},f,!0,p)},h.readAsArrayBuffer(u.data)}return(a=new Uint8Array(1))[0]=y[s.type],r(new b([a.buffer,s.data]))}if(i&&i.base64)return o("b"+m.packets[e.type]+e.data.data);t=y[e.type];return void 0!==e.data&&(t+=n?g.encode(String(e.data),{strict:!1}):String(e.data)),o(""+t)},m.encodeBase64Packet=function(t,n){var o,i,a="b"+m.packets[t.type];if(void 0!==b&&t.data instanceof b)return(i=new FileReader).onload=function(){var e=i.result.split(",")[1];n(a+e)},i.readAsDataURL(t.data);try{o=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(e){for(var r=new Uint8Array(t.data),s=new Array(r.length),c=0;c<r.length;c++)s[c]=r[c];o=String.fromCharCode.apply(null,s)}return a+=btoa(o),n(a)},m.decodePacket=function(e,t,n){if(void 0===e)return p;if("string"==typeof e){if("b"===e.charAt(0))return m.decodeBase64Packet(e.substr(1),t);if(n&&!1===(e=function(e){try{e=g.decode(e,{strict:!1})}catch(e){return!1}return e}(e)))return p;var o=e.charAt(0);return Number(o)==o&&c[o]?1<e.length?{type:c[o],data:e.substring(1)}:{type:c[o]}:p}o=new Uint8Array(e)[0],n=f(e,1);return b&&"blob"===t&&(n=new b([n])),{type:c[o],data:n}},m.decodeBase64Packet=function(e,t){var n=c[e.charAt(0)];if(!o)return{type:n,data:{base64:!0,data:e.substr(1)}};e=o.decode(e.substr(1));return{type:n,data:e="blob"===t&&b?new b([e]):e}},m.encodePayload=function(e,n,o){"function"==typeof n&&(o=n,n=null);var i=a(e);return n&&i?b&&!v?m.encodePayloadAsBlob(e,o):m.encodePayloadAsArrayBuffer(e,o):e.length?void l(e,function(e,t){m.encodePacket(e,!!i&&n,!1,function(e){t(null,e.length+":"+e)})},function(e,t){return o(t.join(""))}):o("0:")},m.decodePayload=function(e,t,n){if("string"!=typeof e)return m.decodePayloadAsBinary(e,t,n);if("function"==typeof t&&(n=t,t=null),""===e)return n(p,0,1);for(var o,i,a="",r=0,s=e.length;r<s;r++){var c=e.charAt(r);if(":"===c){if(""===a||a!=(o=Number(a)))return n(p,0,1);if(a!=(i=e.substr(r+1,o)).length)return n(p,0,1);if(i.length){if(i=m.decodePacket(i,t,!1),p.type===i.type&&p.data===i.data)return n(p,0,1);if(!1===n(i,r+o,s))return}r+=o,a=""}else a+=c}return""!==a?n(p,0,1):void 0},m.encodePayloadAsArrayBuffer=function(e,o){if(!e.length)return o(new ArrayBuffer(0));l(e,function(e,t){m.encodePacket(e,!0,!0,function(e){return t(null,e)})},function(e,t){var n=t.reduce(function(e,t){return e+(e="string"==typeof t?t.length:t.byteLength).toString().length+e+2},0),r=new Uint8Array(n),s=0;return t.forEach(function(e){var t="string"==typeof e,n=e;if(t){for(var o=new Uint8Array(e.length),i=0;i<e.length;i++)o[i]=e.charCodeAt(i);n=o.buffer}r[s++]=t?0:1;for(var a=n.byteLength.toString(),i=0;i<a.length;i++)r[s++]=parseInt(a[i]);for(r[s++]=255,o=new Uint8Array(n),i=0;i<o.length;i++)r[s++]=o[i]}),o(r.buffer)})},m.encodePayloadAsBlob=function(e,n){l(e,function(e,r){m.encodePacket(e,!0,!0,function(e){var t=new Uint8Array(1);if(t[0]=1,"string"==typeof e){for(var n=new Uint8Array(e.length),o=0;o<e.length;o++)n[o]=e.charCodeAt(o);e=n.buffer,t[0]=0}for(var i=(e instanceof ArrayBuffer?e.byteLength:e.size).toString(),a=new Uint8Array(i.length+1),o=0;o<i.length;o++)a[o]=parseInt(i[o]);a[i.length]=255,b&&(t=new b([t.buffer,a.buffer,e]),r(null,t))})},function(e,t){return n(new b(t))})},m.decodePayloadAsBinary=function(e,n,o){"function"==typeof n&&(o=n,n=null);for(var t=e,i=[];0<t.byteLength;){for(var a=new Uint8Array(t),r=0===a[0],s="",c=1;255!==a[c];c++){if(310<s.length)return o(p,0,1);s+=a[c]}var t=f(t,2+s.length),s=parseInt(s),l=f(t,0,s);if(r)try{l=String.fromCharCode.apply(null,new Uint8Array(l))}catch(e){for(var d=new Uint8Array(l),l="",c=0;c<d.length;c++)l+=String.fromCharCode(d[c])}i.push(l),t=f(t,s)}var u=i.length;i.forEach(function(e,t){o(m.decodePacket(e,n,!0),t,u)})}},function(e,t,n){var a=n(373),o=n(105),r=n(148),s=n(74)("socket.io-client"),c=(e.exports=t=i,t.managers={});function i(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var e=a(e),n=e.source,o=e.id,i=e.path,i=c[o]&&i in c[o].nsps,i=t.forceNew||t["force new connection"]||!1===t.multiplex||i?(s("ignoring socket cache for %s",n),r(n,t)):(c[o]||(s("new io instance for %s",n),c[o]=r(n,t)),c[o]);return e.query&&!t.query&&(t.query=e.query),i.socket(e.path,t)}t.protocol=o.protocol,t.connect=i,t.Manager=n(148),t.Socket=n(154)},null,null,null,null,function(e,t,n){var o;!function(){"use strict";void 0!==(o="function"==typeof(o=function(){function u(e){throw e}function f(){}function e(e,t){for(var n in void 0===t&&"function"==typeof e&&(t=e),"[object Object]"!=Object.prototype.toString.call(e)&&(e={}),i)this[n]=(void 0!==e[n]?e:i)[n];this.dbName=this.storePrefix+this.storeName,this.dbVersion=parseInt(this.dbVersion,10)||1,t&&(this.onStoreReady=t);var o="object"==typeof window?window:self,t=this.implementationPreference.filter(function(e){return e in o});this.implementation=t[0],this.idb=o[this.implementation],this.keyRange=o.IDBKeyRange||o.webkitIDBKeyRange||o.mozIDBKeyRange,this.consts={READ_ONLY:"readonly",READ_WRITE:"readwrite",VERSION_CHANGE:"versionchange",NEXT:"next",NEXT_NO_DUPLICATE:"nextunique",PREV:"prev",PREV_NO_DUPLICATE:"prevunique"},this.openDB()}var i={storeName:"Store",storePrefix:"IDBWrapper-",dbVersion:1,keyPath:"id",autoIncrement:!0,onStoreReady:function(){},onError:u,indexes:[],implementationPreference:["indexedDB","webkitIndexedDB","mozIndexedDB","shimIndexedDB"]},t={constructor:e,version:"1.7.2",db:null,dbName:null,dbVersion:null,store:null,storeName:null,storePrefix:null,keyPath:null,autoIncrement:null,indexes:null,implementationPreference:null,implementation:"",onStoreReady:null,onError:null,_insertIdCount:0,openDB:function(){var e=this.idb.open(this.dbName,this.dbVersion),i=!1;e.onerror=function(e){var t;("error"in(t=e).target?"VersionError"==t.target.error.name:"errorCode"in t.target&&12==t.target.errorCode)?this.onError(new Error("The version number provided is lower than the existing one.")):(e=e.target.error||(t="IndexedDB unknown error occurred when opening DB "+this.dbName+" version "+this.dbVersion,"errorCode"in e.target&&(t+=" with error code "+e.target.errorCode),new Error(t)),this.onError(e))}.bind(this),e.onsuccess=function(e){var o;i||(this.db?this.onStoreReady():(this.db=e.target.result,"string"!=typeof this.db.version?this.db.objectStoreNames.contains(this.storeName)?(e=this.db.transaction([this.storeName],this.consts.READ_ONLY),this.store=e.objectStore(this.storeName),o=Array.prototype.slice.call(this.getIndexList()),this.indexes.forEach(function(e){var t,n=e.name;if(!n)return i=!0,void this.onError(new Error("Cannot create index: No index name given."));this.normalizeIndexData(e),this.hasIndex(n)?(t=this.store.index(n),this.indexComplies(t,e)||(i=!0,this.onError(new Error('Cannot modify index "'+n+'" for current version. Please bump version number to '+(this.dbVersion+1)+"."))),o.splice(o.indexOf(n),1)):(i=!0,this.onError(new Error('Cannot create new index "'+n+'" for current version. Please bump version number to '+(this.dbVersion+1)+".")))},this),o.length&&(i=!0,this.onError(new Error('Cannot delete index(es) "'+o.toString()+'" for current version. Please bump version number to '+(this.dbVersion+1)+"."))),i||this.onStoreReady()):this.onError(new Error("Object store couldn't be created.")):this.onError(new Error("The IndexedDB implementation in this browser is outdated. Please upgrade your browser."))))}.bind(this),e.onupgradeneeded=function(e){this.db=e.target.result,this.db.objectStoreNames.contains(this.storeName)?this.store=e.target.transaction.objectStore(this.storeName):(e={autoIncrement:this.autoIncrement},null!==this.keyPath&&(e.keyPath=this.keyPath),this.store=this.db.createObjectStore(this.storeName,e));var o=Array.prototype.slice.call(this.getIndexList());this.indexes.forEach(function(e){var t,n=e.name;n||(i=!0,this.onError(new Error("Cannot create index: No index name given."))),this.normalizeIndexData(e),this.hasIndex(n)?(t=this.store.index(n),this.indexComplies(t,e)||(this.store.deleteIndex(n),this.store.createIndex(n,e.keyPath,{unique:e.unique,multiEntry:e.multiEntry})),o.splice(o.indexOf(n),1)):this.store.createIndex(n,e.keyPath,{unique:e.unique,multiEntry:e.multiEntry})},this),o.length&&o.forEach(function(e){this.store.deleteIndex(e)},this)}.bind(this)},deleteDatabase:function(e,t){var n;this.idb.deleteDatabase?(this.db.close(),(n=this.idb.deleteDatabase(this.dbName)).onsuccess=e,n.onerror=t):t(new Error("Browser does not support IndexedDB deleteDatabase!"))},put:function(e,t,n,o){null!==this.keyPath&&(o=n,n=t,t=e),o=o||u,n=n||f;var i=!1,a=null,r=this.db.transaction([this.storeName],this.consts.READ_WRITE);return r.oncomplete=function(){(i?n:o)(a)},r.onabort=o,r.onerror=o,(t=null!==this.keyPath?(this._addIdPropertyIfNeeded(t),r.objectStore(this.storeName).put(t)):r.objectStore(this.storeName).put(t,e)).onsuccess=function(e){i=!0,a=e.target.result},t.onerror=o,r},get:function(e,t,n){n=n||u,t=t||f;var o=!1,i=null,a=this.db.transaction([this.storeName],this.consts.READ_ONLY),e=(a.oncomplete=function(){(o?t:n)(i)},a.onabort=n,a.onerror=n,a.objectStore(this.storeName).get(e));return e.onsuccess=function(e){o=!0,i=e.target.result},e.onerror=n,a},remove:function(e,t,n){n=n||u,t=t||f;var o=!1,i=null,a=this.db.transaction([this.storeName],this.consts.READ_WRITE),e=(a.oncomplete=function(){(o?t:n)(i)},a.onabort=n,a.onerror=n,a.objectStore(this.storeName).delete(e));return e.onsuccess=function(e){o=!0,i=e.target.result},e.onerror=n,a},batch:function(e,t,a){if(a=a||u,t=t||f,"[object Array]"!=Object.prototype.toString.call(e))a(new Error("dataArray argument must be of type Array."));else if(0===e.length)return t(!0);function r(){0!=--n||s||(o=s=!0)}var n=e.length,s=!1,o=!1,c=this.db.transaction([this.storeName],this.consts.READ_WRITE);c.oncomplete=function(){(o?t:a)(o)},c.onabort=a,c.onerror=a;return e.forEach(function(e){function t(e){c.abort(),s||(s=!0,a(e,o,i))}var n,o=e.type,i=e.key,e=e.value;"remove"==o?((n=c.objectStore(this.storeName).delete(i)).onsuccess=r,n.onerror=t):"put"==o&&((n=null!==this.keyPath?(this._addIdPropertyIfNeeded(e),c.objectStore(this.storeName).put(e)):c.objectStore(this.storeName).put(e,i)).onsuccess=r,n.onerror=t)},this),c},putBatch:function(e,t,n){e=e.map(function(e){return{type:"put",value:e}});return this.batch(e,t,n)},upsertBatch:function(t,e,n,o){"function"==typeof e&&(o=n=e,e={}),o=o||u,n=n||f,e=e||{},"[object Array]"!=Object.prototype.toString.call(t)&&o(new Error("dataArray argument must be of type Array."));function i(e){t[l++][a]=e.target.result,0!=--r||s||(c=s=!0)}var a=e.keyField||this.keyPath,r=t.length,s=!1,c=!1,l=0,d=this.db.transaction([this.storeName],this.consts.READ_WRITE);d.oncomplete=function(){c?n(t):o(!1)},d.onabort=o,d.onerror=o;return t.forEach(function(e){var t=e.key,e=null!==this.keyPath?(this._addIdPropertyIfNeeded(e),d.objectStore(this.storeName).put(e)):d.objectStore(this.storeName).put(e,t);e.onsuccess=i,e.onerror=function(e){d.abort(),s||(s=!0,o(e))}},this),d},removeBatch:function(e,t,n){e=e.map(function(e){return{type:"remove",key:e}});return this.batch(e,t,n)},getBatch:function(e,t,n,o){if(n=n||u,t=t||f,o=o||"sparse","[object Array]"!=Object.prototype.toString.call(e))n(new Error("keyArray argument must be of type Array."));else if(0===e.length)return t([]);function i(e){e.target.result||"dense"==o?a.push(e.target.result):"sparse"==o&&a.length++,0==--r&&(s=!0,c=a)}var a=[],r=e.length,s=!1,c=null,l=this.db.transaction([this.storeName],this.consts.READ_ONLY);l.oncomplete=function(){(s?t:n)(c)},l.onabort=n,l.onerror=n;return e.forEach(function(e){e=l.objectStore(this.storeName).get(e);e.onsuccess=i,e.onerror=function(e){n(c=e),l.abort()}},this),l},getAll:function(e,t){t=t||u,e=e||f;var n=this.db.transaction([this.storeName],this.consts.READ_ONLY),o=n.objectStore(this.storeName);return o.getAll?this._getAllNative(n,o,e,t):this._getAllCursor(n,o,e,t),n},_getAllNative:function(e,t,n,o){var i=!1,a=null,e=(e.oncomplete=function(){(i?n:o)(a)},e.onabort=o,e.onerror=o,t.getAll());e.onsuccess=function(e){i=!0,a=e.target.result},e.onerror=o},_getAllCursor:function(e,t,n,o){var i=[],a=!1,r=null,e=(e.oncomplete=function(){(a?n:o)(r)},e.onabort=o,e.onerror=o,t.openCursor());e.onsuccess=function(e){e=e.target.result;e?(i.push(e.value),e.continue()):(a=!0,r=i)},e.onError=o},clear:function(e,t){t=t||u,e=e||f;var n=!1,o=null,i=this.db.transaction([this.storeName],this.consts.READ_WRITE),a=(i.oncomplete=function(){(n?e:t)(o)},i.onabort=t,i.onerror=t,i.objectStore(this.storeName).clear());return a.onsuccess=function(e){n=!0,o=e.target.result},a.onerror=t,i},_addIdPropertyIfNeeded:function(e){void 0===e[this.keyPath]&&(e[this.keyPath]=this._insertIdCount+++Date.now())},getIndexList:function(){return this.store.indexNames},hasIndex:function(e){return this.store.indexNames.contains(e)},normalizeIndexData:function(e){e.keyPath=e.keyPath||e.name,e.unique=!!e.unique,e.multiEntry=!!e.multiEntry},indexComplies:function(a,r){return["keyPath","unique","multiEntry"].every(function(e){if("multiEntry"==e&&void 0===a[e]&&!1===r[e])return!0;if("keyPath"!=e||"[object Array]"!=Object.prototype.toString.call(r[e]))return r[e]==a[e];var t=r.keyPath,n=a.keyPath;if("string"==typeof n)return t.toString()==n;if("function"!=typeof n.contains&&"function"!=typeof n.indexOf)return!1;if(n.length!==t.length)return!1;for(var o=0,i=t.length;o<i;o++)if(!(n.contains&&n.contains(t[o])||n.indexOf(-1!==t[o])))return!1;return!0})},iterate:function(n,o){var e="desc"==(o=s({index:null,order:"ASC",autoContinue:!0,filterDuplicates:!1,keyRange:null,writeAccess:!1,onEnd:null,onError:u,limit:1/0,offset:0,allowItemRejection:!1},o||{})).order.toLowerCase()?"PREV":"NEXT",i=(o.filterDuplicates&&(e+="_NO_DUPLICATE"),!1),a=this.db.transaction([this.storeName],this.consts[o.writeAccess?"READ_WRITE":"READ_ONLY"]),t=a.objectStore(this.storeName),r=(o.index&&(t=t.index(o.index)),0),t=(a.oncomplete=function(){i?o.onEnd?o.onEnd():n(null):o.onError(null)},a.onabort=o.onError,a.onerror=o.onError,t.openCursor(o.keyRange,this.consts[e]));return t.onerror=o.onError,t.onsuccess=function(e){var t,e=e.target.result;e?o.offset?(e.advance(o.offset),o.offset=0):(t=n(e.value,e,a),o.allowItemRejection&&!1===t||r++,o.autoContinue&&(r+o.offset<o.limit?e.continue():i=!0)):i=!0},a},query:function(e,n){var o=[],i=0;return(n=n||{}).autoContinue=!0,n.writeAccess=!1,n.allowItemRejection=!!n.filter,n.onEnd=function(){e(o,i)},this.iterate(function(e){i++;var t=!n.filter||n.filter(e);return!1!==t&&o.push(e),t},n)},count:function(e,t){var n=(t=s({index:null,keyRange:null},t||{})).onError||u,o=!1,i=null,a=this.db.transaction([this.storeName],this.consts.READ_ONLY),r=(a.oncomplete=function(){(o?e:n)(i)},a.onabort=n,a.onerror=n,a.objectStore(this.storeName)),r=(r=t.index?r.index(t.index):r).count(t.keyRange);return r.onsuccess=function(e){o=!0,i=e.target.result},r.onError=n,a},makeKeyRange:function(e){var t,n=void 0!==e.lower,o=void 0!==e.upper;switch(!0){case void 0!==e.only:t=this.keyRange.only(e.only);break;case n&&o:t=this.keyRange.bound(e.lower,e.upper,e.excludeLower,e.excludeUpper);break;case n:t=this.keyRange.lowerBound(e.lower,e.excludeLower);break;case o:t=this.keyRange.upperBound(e.upper,e.excludeUpper);break;default:throw new Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value, or an "only" value.')}return t}},a={};function s(e,t){var n,o;for(n in t)(o=t[n])!==a[n]&&o!==e[n]&&(e[n]=o);return e}return e.prototype=t,e.version=t.version,e})?o.call(t,n,t,e):o)&&(e.exports=o)}()},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,function(e,o,t){!function o(i,a,r){function s(t,e){if(!a[t]){if(!i[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}n=a[t]={exports:{}};i[t][0].call(n.exports,function(e){return s(i[t][1][e]||e)},n,n.exports,o,i,a,r)}return a[t].exports}for(var c="function"==typeof require&&require,e=0;e<r.length;e++)s(r[e]);return s}({1:[function(e,t,n){o.Buffer=e("buffer").Buffer},{buffer:3}],2:[function(e,t,n){"use strict";n.byteLength=function(e){var e=d(e),t=e[0],e=e[1];return 3*(t+e)/4-e},n.toByteArray=function(e){for(var t,n=d(e),o=n[0],n=n[1],i=new l(3*(o+n)/4-n),a=0,r=0<n?o-4:o,s=0;s<r;s+=4)t=c[e.charCodeAt(s)]<<18|c[e.charCodeAt(s+1)]<<12|c[e.charCodeAt(s+2)]<<6|c[e.charCodeAt(s+3)],i[a++]=t>>16&255,i[a++]=t>>8&255,i[a++]=255&t;return 2===n&&(t=c[e.charCodeAt(s)]<<2|c[e.charCodeAt(s+1)]>>4,i[a++]=255&t),1===n&&(t=c[e.charCodeAt(s)]<<10|c[e.charCodeAt(s+1)]<<4|c[e.charCodeAt(s+2)]>>2,i[a++]=t>>8&255,i[a++]=255&t),i},n.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,r=n-o;a<r;a+=16383)i.push(function(e,t,n){for(var o,i=[],a=t;a<n;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(s[(o=o)>>18&63]+s[o>>12&63]+s[o>>6&63]+s[63&o]);return i.join("")}(e,a,r<a+16383?r:a+16383));return 1==o?(t=e[n-1],i.push(s[t>>2]+s[t<<4&63]+"==")):2==o&&(t=(e[n-2]<<8)+e[n-1],i.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"=")),i.join("")};for(var s=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,a=o.length;i<a;++i)s[i]=o[i],c[o.charCodeAt(i)]=i;function d(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");e=e.indexOf("=");return[e=-1===e?t:e,e===t?0:4-e%4]}c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},{}],3:[function(k,e,O){!function(e){!function(){"use strict";var x=k("base64-js"),a=k("ieee754"),t=(O.Buffer=u,O.SlowBuffer=function(e){return u.alloc(+(e=+e!=e?0:e))},O.INSPECT_MAX_BYTES=50,2147483647);function d(e){if(t<e)throw new RangeError('The value "'+e+'" is invalid for option "size"');e=new Uint8Array(e);return e.__proto__=u.prototype,e}function u(e,t,n){if("number"!=typeof e)return o(e,t,n);if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return r(e)}function o(e,t,n){if("string"==typeof e){var o=e,i=t;if(!u.isEncoding(i="string"==typeof i&&""!==i?i:"utf8"))throw new TypeError("Unknown encoding: "+i);var a=0|h(o,i),r=d(a);return r=(o=r.write(o,i))!==a?r.slice(0,o):r}if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(A(e,ArrayBuffer)||e&&A(e.buffer,ArrayBuffer)){i=e,a=t,o=n;if(a<0||i.byteLength<a)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<a+(o||0))throw new RangeError('"length" is outside of buffer bounds');return(i=void 0===a&&void 0===o?new Uint8Array(i):void 0===o?new Uint8Array(i,a):new Uint8Array(i,a,o)).__proto__=u.prototype,i}if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return u.from(r,t,n);var s,c,l=u.isBuffer(s=e)?(0!==(c=d(l=0|p(s.length))).length&&s.copy(c,0,0,l),c):void 0!==s.length?"number"!=typeof s.length||M(s.length)?d(0):f(s):"Buffer"===s.type&&Array.isArray(s.data)?f(s.data):void 0;if(l)return l;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function i(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function r(e){return i(e),d(e<0?0:0|p(e))}function f(e){for(var t=e.length<0?0:0|p(e.length),n=d(t),o=0;o<t;o+=1)n[o]=255&e[o];return n}function p(e){if(t<=e)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+t.toString(16)+" bytes");return 0|e}function h(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||A(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,o=2<arguments.length&&!0===arguments[2];if(!o&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return S(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return T(e).length;default:if(i)return o?-1:S(e).length;t=(""+t).toLowerCase(),i=!0}}function n(e,t,n){var o=e[t];e[t]=e[n],e[n]=o}function s(e,t,n,o,i){if(0===e.length)return-1;if("string"==typeof n?(o=n,n=0):2147483647<n?n=2147483647:n<-2147483648&&(n=-2147483648),(n=(n=M(n=+n)?i?0:e.length-1:n)<0?e.length+n:n)>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,o)),u.isBuffer(t))return 0===t.length?-1:c(e,t,n,o,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(i?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,n):c(e,[t],n,o,i);throw new TypeError("val must be string, number or Buffer")}function c(e,t,n,o,i){var a=1,r=e.length,s=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;r/=a=2,s/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i)for(var l=-1,d=n;d<r;d++)if(c(e,d)===c(t,-1===l?0:d-l)){if(d-(l=-1===l?d:l)+1===s)return l*a}else-1!==l&&(d-=d-l),l=-1;else for(d=n=r<n+s?r-s:n;0<=d;d--){for(var u=!0,f=0;f<s;f++)if(c(e,d+f)!==c(t,f)){u=!1;break}if(u)return d}return-1}function y(e,t,n,o){return E(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,o)}function C(e,t,n){n=Math.min(e.length,n);for(var o=[],i=t;i<n;){var a,r,s,c,l=e[i],d=null,u=239<l?4:223<l?3:191<l?2:1;if(i+u<=n)switch(u){case 1:l<128&&(d=l);break;case 2:128==(192&(a=e[i+1]))&&127<(c=(31&l)<<6|63&a)&&(d=c);break;case 3:a=e[i+1],r=e[i+2],128==(192&a)&&128==(192&r)&&2047<(c=(15&l)<<12|(63&a)<<6|63&r)&&(c<55296||57343<c)&&(d=c);break;case 4:a=e[i+1],r=e[i+2],s=e[i+3],128==(192&a)&&128==(192&r)&&128==(192&s)&&65535<(c=(15&l)<<18|(63&a)<<12|(63&r)<<6|63&s)&&c<1114112&&(d=c)}null===d?(d=65533,u=1):65535<d&&(d-=65536,o.push(d>>>10&1023|55296),d=56320|1023&d),o.push(d),i+=u}var f=o,p=f.length;if(p<=g)return String.fromCharCode.apply(String,f);for(var h="",m=0;m<p;)h+=String.fromCharCode.apply(String,f.slice(m,m+=g));return h}O.kMaxLength=t,(u.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),u.poolSize=8192,u.from=o,u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,u.alloc=function(e,t,n){return t=t,n=n,i(e=e),!(e<=0)&&void 0!==t?"string"==typeof n?d(e).fill(t,n):d(e).fill(t):d(e)},u.allocUnsafe=r,u.allocUnsafeSlow=r,u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(A(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),A(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,o=t.length,i=0,a=Math.min(n,o);i<a;++i)if(e[i]!==t[i]){n=e[i],o=t[i];break}return n<o?-1:o<n?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);if(void 0===t)for(i=t=0;i<e.length;++i)t+=e[i].length;for(var n=u.allocUnsafe(t),o=0,i=0;i<e.length;++i){var a=e[i];if(A(a,Uint8Array)&&(a=u.from(a)),!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,o),o+=a.length}return n},u.byteLength=h,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)n(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)n(this,t,t+3),n(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)n(this,t,t+7),n(this,t+1,t+6),n(this,t+2,t+5),n(this,t+3,t+4);return this},u.prototype.toLocaleString=u.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):function(e,t,n){var o,i=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((n=void 0===n||n>this.length?this.length:n)<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var a=this,r=t,s=n,c=a.length;(!s||s<0||c<s)&&(s=c);for(var l="",d=r=!r||r<0?0:r;d<s;++d)l+=function(e){return e<16?"0"+e.toString(16):e.toString(16)}(a[d]);return l;case"utf8":case"utf-8":return C(this,t,n);case"ascii":var u=this,c=t,f=n,p="";f=Math.min(u.length,f);for(var h=c;h<f;++h)p+=String.fromCharCode(127&u[h]);return p;case"latin1":case"binary":var m=this,r=t,g=n,v="";g=Math.min(m.length,g);for(var y=r;y<g;++y)v+=String.fromCharCode(m[y]);return v;case"base64":return b=this,o=n,0===(w=t)&&o===b.length?x.fromByteArray(b):x.fromByteArray(b.slice(w,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":for(var b=t,w=n,_=this.slice(b,w),S="",T=0;T<_.length;T+=2)S+=String.fromCharCode(_[T]+256*_[T+1]);return S;default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(u.isBuffer(e))return this===e||0===u.compare(this,e);throw new TypeError("Argument must be a Buffer")},u.prototype.inspect=function(){var e="",t=O.INSPECT_MAX_BYTES,e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim();return this.length>t&&(e+=" ... "),"<Buffer "+e+">"},u.prototype.compare=function(e,t,n,o,i){if(A(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===n&&(n=e?e.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),(t=void 0===t?0:t)<0||n>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(i<=o&&n<=t)return 0;if(i<=o)return-1;if(n<=t)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(o>>>=0),r=(n>>>=0)-(t>>>=0),s=Math.min(a,r),c=this.slice(o,i),l=e.slice(t,n),d=0;d<s;++d)if(c[d]!==l[d]){a=c[d],r=l[d];break}return a<r?-1:r<a?1:0},u.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},u.prototype.indexOf=function(e,t,n){return s(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return s(this,e,t,n,!1)},u.prototype.write=function(e,t,n,o){if(void 0===t)o="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)o=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===o&&(o="utf8")):(o=n,n=void 0)}var i=this.length-t;if((void 0===n||i<n)&&(n=i),0<e.length&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o=o||"utf8";for(var a,r,s,c,l,d=!1;;)switch(o){case"hex":var u=this,f=e,p=t,h=n,m=(p=Number(p)||0,u.length-p);(!h||(h=Number(h))>m)&&(h=m),(m=f.length)/2<h&&(h=m/2);for(var g=0;g<h;++g){var v=parseInt(f.substr(2*g,2),16);if(M(v))return g;u[p+g]=v}return g;case"utf8":case"utf-8":return m=t,l=n,E(S(e,(c=this).length-m),c,m,l);case"ascii":return y(this,e,t,n);case"latin1":case"binary":return y(this,e,t,n);case"base64":return c=this,l=t,s=n,E(T(e),c,l,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s=t,r=n,E(function(e,t){for(var n,o,i=[],a=0;a<e.length&&!((t-=2)<0);++a)o=(n=e.charCodeAt(a))>>8,i.push(n%256),i.push(o);return i}(e,(a=this).length-s),a,s,r);default:if(d)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),d=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var g=4096;function l(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(n<e+t)throw new RangeError("Trying to access beyond buffer length")}function m(e,t,n,o,i,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(i<t||t<a)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}function v(e,t,n,o){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function b(e,t,n,o,i){return t=+t,n>>>=0,i||v(e,0,n,4),a.write(e,t,n,o,23,4),n+4}function w(e,t,n,o,i){return t=+t,n>>>=0,i||v(e,0,n,8),a.write(e,t,n,o,52,8),n+8}u.prototype.slice=function(e,t){var n=this.length,n=((e=~~e)<0?(e+=n)<0&&(e=0):n<e&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):n<t&&(t=n),t<e&&(t=e),this.subarray(e,t));return n.__proto__=u.prototype,n},u.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||l(e,t,this.length);for(var o=this[e],i=1,a=0;++a<t&&(i*=256);)o+=this[e+a]*i;return o},u.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||l(e,t,this.length);for(var o=this[e+--t],i=1;0<t&&(i*=256);)o+=this[e+--t]*i;return o},u.prototype.readUInt8=function(e,t){return e>>>=0,t||l(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||l(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||l(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||l(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||l(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||l(e,t,this.length);for(var o=this[e],i=1,a=0;++a<t&&(i*=256);)o+=this[e+a]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||l(e,t,this.length);for(var o=t,i=1,a=this[e+--o];0<o&&(i*=256);)a+=this[e+--o]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return e>>>=0,t||l(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||l(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt16BE=function(e,t){e>>>=0,t||l(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||l(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||l(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return e>>>=0,t||l(e,4,this.length),a.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||l(e,4,this.length),a.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||l(e,8,this.length),a.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||l(e,8,this.length),a.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,o){e=+e,t>>>=0,n>>>=0,o||m(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},u.prototype.writeUIntBE=function(e,t,n,o){e=+e,t>>>=0,n>>>=0,o||m(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;0<=--i&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeIntLE=function(e,t,n,o){e=+e,t>>>=0,o||m(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var i=0,a=1,r=0;for(this[t]=255&e;++i<n&&(a*=256);)e<0&&0===r&&0!==this[t+i-1]&&(r=1),this[t+i]=(e/a>>0)-r&255;return t+n},u.prototype.writeIntBE=function(e,t,n,o){e=+e,t>>>=0,o||m(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var i=n-1,a=1,r=0;for(this[t+i]=255&e;0<=--i&&(a*=256);)e<0&&0===r&&0!==this[t+i+1]&&(r=1),this[t+i]=(e/a>>0)-r&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||m(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeFloatLE=function(e,t,n){return b(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return b(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return w(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return w(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,o){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n=n||0,o||0===o||(o=this.length),t>=e.length&&(t=e.length),(o=0<o&&o<n?n:o)===n)return 0;if(0===e.length||0===this.length)return 0;if((t=t||0)<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length);var i=(o=e.length-t<o-n?e.length-t+n:o)-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,o);else if(this===e&&n<t&&t<o)for(var a=i-1;0<=a;--a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,o),t);return i},u.prototype.fill=function(e,t,n,o){if("string"==typeof e){if("string"==typeof t?(o=t,t=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o);var i;1===e.length&&(i=e.charCodeAt(0),("utf8"===o&&i<128||"latin1"===o)&&(e=i))}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,"number"==typeof(e=e||0))for(a=t;a<n;++a)this[a]=e;else{var r=u.isBuffer(e)?e:u.from(e,o),s=r.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-t;++a)this[a+t]=r[a%s]}return this};var _=/[^+/0-9A-Za-z-_]/g;function S(e,t){var n;t=t||1/0;for(var o=e.length,i=null,a=[],r=0;r<o;++r){if(55295<(n=e.charCodeAt(r))&&n<57344){if(!i){if(56319<n){-1<(t-=3)&&a.push(239,191,189);continue}if(r+1===o){-1<(t-=3)&&a.push(239,191,189);continue}i=n;continue}if(n<56320){-1<(t-=3)&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&-1<(t-=3)&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function T(e){return x.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(_,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function E(e,t,n,o){for(var i=0;i<o&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function A(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function M(e){return e!=e}}.call(this)}.call(this,k("buffer").Buffer)},{"base64-js":2,buffer:3,ieee754:4}],4:[function(e,t,n){n.read=function(e,t,n,o,i){var a,r,s=8*i-o-1,c=(1<<s)-1,l=c>>1,d=-7,u=n?i-1:0,f=n?-1:1,i=e[t+u];for(u+=f,a=i&(1<<-d)-1,i>>=-d,d+=s;0<d;a=256*a+e[t+u],u+=f,d-=8);for(r=a&(1<<-d)-1,a>>=-d,d+=o;0<d;r=256*r+e[t+u],u+=f,d-=8);if(0===a)a=1-l;else{if(a===c)return r?NaN:1/0*(i?-1:1);r+=Math.pow(2,o),a-=l}return(i?-1:1)*r*Math.pow(2,a-o)},n.write=function(e,t,n,o,i,a){var r,s,c=8*a-i-1,l=(1<<c)-1,d=l>>1,u=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:a-1,p=o?1:-1,a=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,r=l):(r=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-r))<1&&(r--,o*=2),2<=(t+=1<=r+d?u/o:u*Math.pow(2,1-d))*o&&(r++,o/=2),l<=r+d?(s=0,r=l):1<=r+d?(s=(t*o-1)*Math.pow(2,i),r+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),r=0));8<=i;e[n+f]=255&s,f+=p,s/=256,i-=8);for(r=r<<i|s,c+=i;0<c;e[n+f]=255&r,f+=p,r/=256,c-=8);e[n+f-p]|=128*a}},{}]},{},[1])},function(e,t,n){e.exports=n(77)},function(e,t){t.encode=function(e){var t,n="";for(t in e)e.hasOwnProperty(t)&&(n.length&&(n+="&"),n+=encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return n},t.decode=function(e){for(var t={},n=e.split("&"),o=0,i=n.length;o<i;o++){var a=n[o].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}},function(e,t){e.exports=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(n,i,o){!function(t){function e(){var e;try{e=i.storage.debug}catch(e){}return e=!e&&void 0!==t&&"env"in t?t.env.DEBUG:e}(i=n.exports=o(389)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},i.formatArgs=function(e){var t,n,o=this.useColors;e[0]=(o?"%c":"")+this.namespace+(o?" %c":" ")+e[0]+(o?"%c ":" ")+"+"+i.humanize(this.diff),o&&(o="color: "+this.color,e.splice(1,0,o,"color: inherit"),e[n=t=0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(t++,"%c"===e&&(n=t))}),e.splice(n,0,o))},i.save=function(e){try{null==e?i.storage.removeItem("debug"):i.storage.debug=e}catch(e){}},i.load=e,i.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},i.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),i.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],i.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},i.enable(e())}.call(this,o(49))},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,function(e,t){var i=36e5,a=864e5;function r(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}e.exports=function(e,t){t=t||{};var n=typeof e;if(!("string"==n&&0<e.length)){if("number"==n&&!1===isNaN(e))return t.long?r(n=e,a,"day")||r(n,i,"hour")||r(n,6e4,"minute")||r(n,1e3,"second")||n+" ms":a<=(t=e)?Math.round(t/a)+"d":i<=t?Math.round(t/i)+"h":6e4<=t?Math.round(t/6e4)+"m":1e3<=t?Math.round(t/1e3)+"s":t+"ms";throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}n=e;if(!(100<(n=String(n)).length)){n=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(n);if(n){var o=parseFloat(n[1]);switch((n[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"days":case"day":case"d":return o*a;case"hours":case"hour":case"hrs":case"hr":case"h":return o*i;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*o;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}}}},function(e,r,t){var s=t(375)("socket.io-parser"),n=t(50),o=t(377),i=t(147);function a(){}r.protocol=4,r.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],r.CONNECT=0,r.DISCONNECT=1,r.EVENT=2,r.ACK=3,r.ERROR=4,r.BINARY_EVENT=5,r.BINARY_ACK=6,r.Encoder=a,r.Decoder=d;var c=r.ERROR+'"encode error"';function l(e){var t=""+e.type;if(r.BINARY_EVENT!==e.type&&r.BINARY_ACK!==e.type||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data){var n=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(e.data);if(!1===n)return c;t+=n}return s("encoded %j as %s",e,t),t}function d(){this.reconstructor=null}function u(e){this.reconPack=e,this.buffers=[]}function f(e){return{type:r.ERROR,data:"parser error: "+e}}a.prototype.encode=function(e,t){var n;s("encoding packet %j",e),r.BINARY_EVENT===e.type||r.BINARY_ACK===e.type?(n=t,o.removeBlobs(e,function(e){var e=o.deconstructPacket(e),t=l(e.packet),e=e.buffers;e.unshift(t),n(e)})):t([l(e)])},n(d.prototype),d.prototype.add=function(e){var t;if("string"==typeof e)t=function(e){var t=0,n={type:Number(e.charAt(0))};if(null==r.types[n.type])return f("unknown packet type "+n.type);if(r.BINARY_EVENT===n.type||r.BINARY_ACK===n.type){for(var o="";"-"!==e.charAt(++t)&&(o+=e.charAt(t),t!=e.length););if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1))for(n.nsp="";++t&&","!==(i=e.charAt(t))&&(n.nsp+=i,t!==e.length););else n.nsp="/";var i,a=e.charAt(t+1);if(""!==a&&Number(a)==a){for(n.id="";++t;){if(null==(i=e.charAt(t))||Number(i)!=i){--t;break}if(n.id+=e.charAt(t),t===e.length)break}n.id=Number(n.id)}if(e.charAt(++t)){a=function(e){try{return JSON.parse(e)}catch(e){return!1}}(e.substr(t));if(!1===a||n.type!==r.ERROR&&!Array.isArray(a))return f("invalid payload");n.data=a}return s("decoded %s as %j",e,n),n}(e),r.BINARY_EVENT===t.type||r.BINARY_ACK===t.type?(this.reconstructor=new u(t),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",t)):this.emit("decoded",t);else{if(!i(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(t=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,this.emit("decoded",t))}},d.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},u.prototype.takeBinaryData=function(e){return this.buffers.push(e),this.buffers.length===this.reconPack.attachments?(e=o.reconstructPacket(this.reconPack,this.buffers),this.finishedReconstruction(),e):null},u.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,n){var o=n(380);e.exports=function(e){var t=e.xdomain,n=e.xscheme,e=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||o))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!n&&e)return new XDomainRequest}catch(e){}if(!t)try{return new self[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}},function(e,t,n){var o=n(51);function i(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}n(50)((e.exports=i).prototype),i.prototype.onError=function(e,t){e=new Error(e);return e.type="TransportError",e.description=t,this.emit("error",e),this},i.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},i.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},i.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},i.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},i.prototype.onData=function(e){e=o.decodePacket(e,this.socket.binaryType);this.onPacket(e)},i.prototype.onPacket=function(e){this.emit("packet",e)},i.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(n,o,e){!function(e){var t;void 0!==(t="function"==typeof(t=function(){"use strict";function c(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){i(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function r(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&t.status<=299}function s(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(n)}}var l="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof e&&e.global===e?e:void 0,i=l.saveAs||("object"!=typeof window||window!==l?function(){}:"download"in HTMLAnchorElement.prototype?function(e,t,n){var o=l.URL||l.webkitURL,i=document.createElement("a");t=t||e.name||"download",i.download=t,i.rel="noopener","string"==typeof e?(i.href=e,i.origin===location.origin?s(i):r(i.href)?c(e,t,n):s(i,i.target="_blank")):(i.href=o.createObjectURL(e),setTimeout(function(){o.revokeObjectURL(i.href)},4e4),setTimeout(function(){s(i)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,n){var o,i,a;t=t||e.name||"download","string"!=typeof e?navigator.msSaveOrOpenBlob((i=e,void 0===(a=n)?a={autoBom:!1}:"object"!=typeof a&&(console.warn("Deprecated: Expected third argument to be a object"),a={autoBom:!a}),a.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\ufeff",i],{type:i.type}):i),t):r(e)?c(e,t,n):((o=document.createElement("a")).href=e,o.target="_blank",setTimeout(function(){s(o)}))}:function(e,t,n,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof e)return c(e,t,n);var i,a,r,t="application/octet-stream"===e.type,n=/constructor/i.test(l.HTMLElement)||l.safari,s=/CriOS\/[\d]+/.test(navigator.userAgent);(s||t&&n)&&"object"==typeof FileReader?((i=new FileReader).onloadend=function(){var e=i.result,e=s?e:e.replace(/^data:[^;]*;/,"data:attachment/file;");o?o.location.href=e:location=e,o=null},i.readAsDataURL(e)):(a=l.URL||l.webkitURL,r=a.createObjectURL(e),o?o.location=r:location.href=r,o=null,setTimeout(function(){a.revokeObjectURL(r)},4e4))});l.saveAs=i.saveAs=i,n.exports=i})?t.apply(o,[]):t)&&(n.exports=t)}.call(this,e(31))},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(t,e){!function(e){t.exports=e}.call(this,{})},function(e,t){var s=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,c=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(e){var t=e,n=e.indexOf("["),o=e.indexOf("]");-1!=n&&-1!=o&&(e=e.substring(0,n)+e.substring(n,o).replace(/:/g,";")+e.substring(o,e.length));for(var i=s.exec(e||""),a={},r=14;r--;)a[c[r]]=i[r]||"";return-1!=n&&-1!=o&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},null,function(e,t,n){!function(t){e.exports=function(e){return n&&t.isBuffer(e)||o&&(e instanceof ArrayBuffer||i(e))};var n="function"==typeof t&&"function"==typeof t.isBuffer,o="function"==typeof ArrayBuffer,i=function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer}}.call(this,n(73).Buffer)},function(e,t,n){var c=n(378),a=n(154),o=n(50),i=n(105),l=n(155),r=n(156),d=n(74)("socket.io-client:manager"),s=n(153),u=n(394),f=Object.prototype.hasOwnProperty;function p(e,t){if(!(this instanceof p))return new p(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new u({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];e=t.parser||i;this.encoder=new e.Encoder,this.decoder=new e.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}(e.exports=p).prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)f.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},p.prototype.updateSocketIds=function(){for(var e in this.nsps)f.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},p.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},o(p.prototype),p.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},p.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},p.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},p.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},p.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},p.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},p.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},p.prototype.open=p.prototype.connect=function(n,e){if(d("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;d("opening %s",this.uri),this.engine=c(this.uri,this.opts);var t,o,i=this.engine,a=this,r=(this.readyState="opening",this.skipReconnect=!1,l(i,"open",function(){a.onopen(),n&&n()})),s=l(i,"error",function(e){var t;d("connect_error"),a.cleanup(),a.readyState="closed",a.emitAll("connect_error",e),n?((t=new Error("Connection error")).data=e,n(t)):a.maybeReconnectOnOpen()});return!1!==this._timeout&&(t=this._timeout,d("connect attempt will timeout after %d",t),o=setTimeout(function(){d("connect attempt timed out after %d",t),r.destroy(),i.close(),i.emit("error","timeout"),a.emitAll("connect_timeout",t)},t),this.subs.push({destroy:function(){clearTimeout(o)}})),this.subs.push(r),this.subs.push(s),this},p.prototype.onopen=function(){d("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(l(e,"data",r(this,"ondata"))),this.subs.push(l(e,"ping",r(this,"onping"))),this.subs.push(l(e,"pong",r(this,"onpong"))),this.subs.push(l(e,"error",r(this,"onerror"))),this.subs.push(l(e,"close",r(this,"onclose"))),this.subs.push(l(this.decoder,"decoded",r(this,"ondecoded")))},p.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},p.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},p.prototype.ondata=function(e){this.decoder.add(e)},p.prototype.ondecoded=function(e){this.emit("packet",e)},p.prototype.onerror=function(e){d("error",e),this.emitAll("error",e)},p.prototype.socket=function(e,t){var n,o=this.nsps[e];function i(){~s(n.connecting,o)||n.connecting.push(o)}return o||(o=new a(this,e,t),this.nsps[e]=o,n=this,o.on("connecting",i),o.on("connect",function(){o.id=n.generateId(e)}),this.autoConnect&&i()),o},p.prototype.destroy=function(e){e=s(this.connecting,e);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},p.prototype.packet=function(n){d("writing packet %j",n);var o=this;n.query&&0===n.type&&(n.nsp+="?"+n.query),o.encoding?o.packetBuffer.push(n):(o.encoding=!0,this.encoder.encode(n,function(e){for(var t=0;t<e.length;t++)o.engine.write(e[t],n.options);o.encoding=!1,o.processPacketQueue()}))},p.prototype.processPacketQueue=function(){var e;0<this.packetBuffer.length&&!this.encoding&&(e=this.packetBuffer.shift(),this.packet(e))},p.prototype.cleanup=function(){d("cleanup");for(var e=this.subs.length,t=0;t<e;t++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},p.prototype.close=p.prototype.disconnect=function(){d("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},p.prototype.onclose=function(e){d("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},p.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e,t,n=this;this.backoff.attempts>=this._reconnectionAttempts?(d("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1):(e=this.backoff.duration(),d("will wait %dms before reconnect attempt",e),this.reconnecting=!0,t=setTimeout(function(){n.skipReconnect||(d("attempting reconnect"),n.emitAll("reconnect_attempt",n.backoff.attempts),n.emitAll("reconnecting",n.backoff.attempts),n.skipReconnect||n.open(function(e){e?(d("reconnect attempt error"),n.reconnecting=!1,n.reconnect(),n.emitAll("reconnect_error",e.data)):(d("reconnect success"),n.onreconnect())}))},e),this.subs.push({destroy:function(){clearTimeout(t)}}))},p.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){var r=n(106),s=n(381),c=n(390),n=n(391);t.polling=function(e){var t,n,o=!1,i=!1,a=!1!==e.jsonp;if("undefined"!=typeof location&&(t="https:"===location.protocol,n=(n=location.port)||(t?443:80),o=e.hostname!==location.hostname||n!==e.port,i=e.secure!==t),e.xdomain=o,e.xscheme=i,"open"in new r(e)&&!e.forceJSONP)return new s(e);if(a)return new c(e);throw new Error("JSONP disabled")},t.websocket=n},function(e,t,n){var o=n(107),i=n(75),a=n(51),r=n(76),s=n(152),c=n(77)("engine.io-client:polling"),l=(e.exports=d,null!=new(n(106))({xdomain:!1}).responseType);function d(e){var t=e&&e.forceBase64;l&&!t||(this.supportsBinary=!1),o.call(this,e)}r(d,o),d.prototype.name="polling",d.prototype.doOpen=function(){this.poll()},d.prototype.pause=function(e){var t,n=this;function o(){c("paused"),n.readyState="paused",e()}this.readyState="pausing",this.polling||!this.writable?(t=0,this.polling&&(c("we are currently polling - waiting to pause"),t++,this.once("pollComplete",function(){c("pre-pause polling complete"),--t||o()})),this.writable||(c("we are currently writing - waiting to pause"),t++,this.once("drain",function(){c("pre-pause writing complete"),--t||o()}))):o()},d.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},d.prototype.onData=function(e){var o=this;c("polling got data %s",e),a.decodePayload(e,this.socket.binaryType,function(e,t,n){if("opening"===o.readyState&&o.onOpen(),"close"===e.type)return o.onClose(),!1;o.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():c('ignoring poll - transport state "%s"',this.readyState))},d.prototype.doClose=function(){var e=this;function t(){c("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(c("transport open - closing"),t()):(c("transport not open - deferring close"),this.once("open",t))},d.prototype.write=function(e){function t(){n.writable=!0,n.emit("drain")}var n=this;this.writable=!1;a.encodePayload(e,this.supportsBinary,function(e){n.doWrite(e,t)})},d.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=s()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"==t&&443!==Number(this.port)||"http"==t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(t,e,n){!function(a){var e=Object.prototype.toString,r="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===e.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===e.call(File);t.exports=function e(t){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(var n=0,o=t.length;n<o;n++)if(e(t[n]))return!0;return!1}if("function"==typeof a&&a.isBuffer&&a.isBuffer(t)||"function"==typeof ArrayBuffer&&t instanceof ArrayBuffer||r&&t instanceof Blob||s&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return e(t.toJSON(),!0);for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&e(t[i]))return!0;return!1}}.call(this,n(73).Buffer)},function(e,t,n){"use strict";var o,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),a=64,r={},s=0,c=0;function l(e){for(var t="";t=i[e%a]+t,0<(e=Math.floor(e/a)););return t}function d(){var e=l(+new Date);return e!==o?(s=0,o=e):e+"."+l(s++)}for(;c<a;c++)r[i[c]]=c;d.encode=l,d.decode=function(e){var t=0;for(c=0;c<e.length;c++)t=t*a+r[e.charAt(c)];return t},e.exports=d},function(e,t){var o=[].indexOf;e.exports=function(e,t){if(o)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}},function(e,t,n){var i=n(105),o=n(50),a=n(393),r=n(155),s=n(156),c=n(74)("socket.io-client:socket"),l=n(75),d=n(151),u=(e.exports=p,{connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1}),f=o.prototype.emit;function p(e,t,n){this.io=e,this.nsp=t,(this.json=this).ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}o(p.prototype),p.prototype.subEvents=function(){var e;this.subs||(e=this.io,this.subs=[r(e,"open",s(this,"onopen")),r(e,"packet",s(this,"onpacket")),r(e,"close",s(this,"onclose"))])},p.prototype.open=p.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},p.prototype.send=function(){var e=a(arguments);return e.unshift("message"),this.emit.apply(this,e),this},p.prototype.emit=function(e){if(u.hasOwnProperty(e))return f.apply(this,arguments),this;var t=a(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:d(t))?i.BINARY_EVENT:i.EVENT,data:t,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},p.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},p.prototype.onopen=function(){var e;c("transport is open - connecting"),"/"!==this.nsp&&(this.query?(e="object"==typeof this.query?l.encode(this.query):this.query,c("sending connect packet with query %s",e),this.packet({type:i.CONNECT,query:e})):this.packet({type:i.CONNECT}))},p.prototype.onclose=function(e){c("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},p.prototype.onpacket=function(e){var t=e.nsp===this.nsp,n=e.type===i.ERROR&&"/"===e.nsp;if(t||n)switch(e.type){case i.CONNECT:this.onconnect();break;case i.EVENT:case i.BINARY_EVENT:this.onevent(e);break;case i.ACK:case i.BINARY_ACK:this.onack(e);break;case i.DISCONNECT:this.ondisconnect();break;case i.ERROR:this.emit("error",e.data)}},p.prototype.onevent=function(e){var t=e.data||[];c("emitting event %j",t),null!=e.id&&(c("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?f.apply(this,t):this.receiveBuffer.push(t)},p.prototype.ack=function(t){var n=this,o=!1;return function(){var e;o||(o=!0,e=a(arguments),c("sending ack %j",e),n.packet({type:d(e)?i.BINARY_ACK:i.ACK,id:t,data:e}))}},p.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(c("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):c("bad ack %s",e.id)},p.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},p.prototype.emitBuffered=function(){for(var e=0;e<this.receiveBuffer.length;e++)f.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},p.prototype.ondisconnect=function(){c("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},p.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},p.prototype.close=p.prototype.disconnect=function(){return this.connected&&(c("performing disconnect (%s)",this.nsp),this.packet({type:i.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},p.prototype.compress=function(e){return this.flags.compress=e,this},p.prototype.binary=function(e){return this.flags.binary=e,this}},function(e,t){e.exports=function(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}}},function(e,t){var o=[].slice;e.exports=function(e,t){if("function"!=typeof(t="string"==typeof t?e[t]:t))throw new Error("bind() requires a function");var n=o.call(arguments,2);return function(){return t.apply(e,n.concat(o.call(arguments)))}}},function(e,t,n){var o;!function(){"use strict";var a={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"==o||"number"==o)e.push(this&&this[n]||n);else if(Array.isArray(n))e.push(r.apply(this,n));else if("object"==o)for(var i in n)a.call(n,i)&&n[i]&&e.push(this&&this[i]||i)}}return e.join(" ")}e.exports?e.exports=r.default=r:void 0!==(o=function(){return r}.apply(t,[]))&&(e.exports=o)}()},function(e,t,n){e.exports={"ejs-wrapper":"ejs--de6433374cb30211f10e148b320b2f",ejs:"ejs--7a5f920ceffb2913f6dbda780573cf","ejs--full-ui":"ejs--f3a002bba9836fe4ebfed357a45521","controls-tabs":"ejs--008adea3c1ef33a8fc94892a1e97e6",overlay:"ejs--85a95eb6bf74a40ab61b91a91e5bff","key-setting-popup":"ejs--d169a219343bc32dd4aecc3f6b7f25","loading-info":"ejs--782e3572812f983b3a150eec177391",p1:"ejs--c426dd1d179aa351e6cec47e1d9438",p2:"ejs--31e7e81db48819ee35ec6f50378a2e",p3:"ejs--20d4eb2646d396f558a645dc0574f1",p4:"ejs--4de05306c8b099bdeb4585571ac095",ejs__contextmenu:"ejs--c7957d8666bb6b8fc7c3e9c021aaf8",ad:"ejs--cbcfe0a1421cadac9a04c81d6431d6","close-ad":"ejs--f3a1903d935f6cf720d4a0498db62a","start-game":"ejs--73f9b4e94a7a1fe74e11107d5ab2ef",pulse:"ejs--9bd947b3e6427453595f083d740a7c",ejs__control:"ejs--8732295ca5c4902a060d34706a8146","ejs__tab-focus":"ejs--a83b6c705e103e81a7762d0ed5e64b","ejs__control--pressed":"ejs--b1238136ec472a92297159882cf4b8","icon--pressed":"ejs--ec731619062226d943da67f5d83009","icon--not-pressed":"ejs--dc7068585e3d84fe0e676864c1439e","label--pressed":"ejs--0c6561f9155750b0aeeed6da5da7bf","label--not-pressed":"ejs--13d64e30c1333cc99391af48ddabaa","ejs--video":"ejs--d5f430a99a1619b3434bf58e34a99c",ejs__controls:"ejs--1acedc5ed6816abe96dd27d910fd74",ejs__progress:"ejs--f1aa376719b564cae0e653157cde14",ejs__time:"ejs--90d2780f99bcc76fdb6b0378a7238e",ejs__menu:"ejs--c7bfb2d1b75a40fdaaf90624bea9e7",ejs__volume:"ejs--36ceeeec0df37a9cf4bbe05fa204ec","ejs--hide-controls":"ejs--1b8cb7f2294b1eb5de5238daea3513","ejs--fullscreen-enabled":"ejs--19409fe2057ab935a7e46abb5b4f49",ejs__tooltip:"ejs--74c6d4176d27e37a19d2e9e61de8f4",ejs__menu__container:"ejs--013213afedeeb6878089b1ca1b4e47","ejs-popup":"ejs--c2532bfe04554193cc42b3be753700","ejs__control--forward":"ejs--0b4cdb4057d1a4623e60836ccc6275","ejs__control--back":"ejs--a7ad9de0cb0ca672b6703c50de7db9",ejs__menu__value:"ejs--f91e90fe7cabc875aff9a431bf5389","ejs__tooltip--visible":"ejs--6ea27aa07e60d1d6e4c9782740028a","ejs--menu-open":"ejs--da54136ccf8c6b0b16d98e8b8e8b88","ejs__video-wrapper":"ejs--057800d021995e1347ec07cb748672",portrait:"ejs--64f1256f556fb94454b930cb3ea7f2","game-started":"ejs--7da7949f602347007818e6d192eb23",ejs__progress__buffer:"ejs--f8d706413436fd119cf01aaf5a9d9d","ejs--audio":"ejs--bd0222e58d71b0a304d6037dfcffd5","ejs--loading":"ejs--2521e1257996f264de36e77cc9c5ee",ejs__dialogs:"ejs--d31688f864f56d6426ebbf2217d6ee",ejs__dialog:"ejs--5e71fd80268afbb1d588e40b993508",ejs__cache__container:"ejs--1e0f0672f67d0e96592314c9ed78b0",ejs__loading__container:"ejs--d7e6a6a8f38bfaa256fe5d709a8258","ejs__load-state__container":"ejs--b183f581b5336c4908ad258d3e1cc7",ejs__screenRecord__container:"ejs--b183f581b5336cashrqd258d3e1cc7",ejs__netplay__container:"ejs--158ea9dd34e3e7af2d837f8b05babb",ejs__gamepad__container:"ejs--3f0897a8158ba363a0ee0afe4da7c5","dialog-container":"ejs--38cc09882a55e98c76168dbe838aa0","dialog-title":"ejs--b373c9d5029d49324fb8ac3ece96c1","dialog-content":"ejs--a5e2629abb9a5bcbc8b2c1307922d2","dialog-buttons":"ejs--580e3c22e63f8a1eb29694fd0b141b","btn-cancel":"ejs--ad20569e1449d7b8e99e6465960456","btn-reset":"ejs--ad20569e1449d7b8e99e6465963825","btn-clear":"ejs--ad20569e1449d7b8e99e6468571053",tabs:"ejs--8e7922427f460a31935084b7acfb1a",active:"ejs--68d337c212ec6a5bc43125440d422b","tabs-content":"ejs--31eb28817642bb1bfe0a2c422108bb","tabs-panel":"ejs--f932566a0af5314da834324c901978","button-container":"ejs--c233fb69cbef43078bc39e9d1efac8","btn-submit":"ejs--bdb54e9fc47f9805b506b746e897bf","btn-create-room":"ejs--67d03ee7480b871ad6507d6319a839","btn-quit":"ejs--c2d931157456c1d438d40a2f66af2c",set:"ejs--6604c83041a275a78837c452a71dd8","btn-join-room":"ejs--99150e15f962c63c689cadc81ef40d","netplay-player-name":"ejs--71527b6509aa48afce3ce1a11c02f0","netplay-player-name-input":"ejs--7ad35768e3f6b9faf97db01d5b60ae","netplay-player-name-set":"ejs--9c403e5e107a3e4374ba244b636400","netplay-roomlist":"ejs--d6a46533fa6e510a571af5c28b440a","netplay-create-room":"ejs--57ca9b3853cc7de731483cfcc95a59","netplay-room-name-input":"ejs--0885d5e25e19127b6b516014426a1b","netplay-room-password-input":"ejs--25023d28756fdb9dfbbfb6dccb8677","netplay-create-room-set":"ejs--75b3a8d35aacc6424ed7422fdeaaaa","netplay-room":"ejs--eefdf28d69ed2d20f197308981bb61","cheats-add":"ejs--9e670880bb57e824400fa00f09aaad","cheats-list":"ejs--2b4e3c245b7b25dfdac5e09155a68e","cheat-code-input":"ejs--572b0b3a0345a6b01b01a15a02842c","cheat-name-input":"ejs--a7d7f80c8999469c991ea452a85dd9",ejs__widgets:"ejs--952c974392296e7f643d51db380157",ejs__widget:"ejs--0d7e216cf12ae73705b5d5bb0452fc",ejs__widget_controls_toggle:"ejs--666d4296310579687cf3cf3d2cf951",ejs__widget_netplay:"ejs--c0a5e71f6613caab66d6ae15a5a00f","virtual-gamepad":"ejs--2440e3b831017ff8327c939e2a4413",top:"ejs--b8d8b771d0bbb94e2bbd03054f53fd",left:"ejs--c83d70cb63c933edc073c7fe92e32b",buttons:"ejs--6e7015634623fd6a82e6a7d3488c84",center:"ejs--49fa47c86a131e4ca8fb268bfdde89",right:"ejs--7d2b19f77fd0ccabf94dc1ca39ae18",touch:"ejs--d708d9d486f1eca73a593d5c09f8ad",modal:"ejs--eefec939452eb92fad035932d0f47c",modal__overlay:"ejs--f1f43b27384834c8c22c6f81d0c5ae",modal__container:"ejs--c4ee33766a01ed0356c3ec07898e96",modal__header:"ejs--a073f32023da1ced805c5f95a4e81c",modal__footer:"ejs--ed44f59bb8cd49177586b140658c6c",modal__title:"ejs--81470ba5e6a6d68014839ad4d9a977",modal__close:"ejs--c3c85789c2a7f56d8b26dba75b7e1f",modal__content:"ejs--db44f5520e6f4fd0dd34b478bb9ee8",modal__btn:"ejs--319bcec5dee9444e1a2a53d6503b7c","modal__btn-primary":"ejs--eaf3c1cba25d415d92ac48d7db34dd",modal__errmsg:"ejs--940087708c06b6129ce2bfa45f1d89","micromodal-slide":"ejs--bef295f3125e9ba83d4f3677264bae","is-open":"ejs--60c17e0d149099f207b06f27edae6a",mmfadeIn:"ejs--9d7aa2bd5ee276be085e5b2a0bbc2e",mmslideIn:"ejs--8b069266f76099cc6bc220f6ea56cc",mmfadeOut:"ejs--184b7558ffeb569c1790654537477b",mmslideOut:"ejs--379a464ad0e66ea5fc601e5f2fd73e","ejs-switch":"ejs--4c3e63d4005bd8a0468e9c74a35f62","ejs-delete-cheat":"ejs--90bcdd71cd0d2307e9ee0dffa916da","icon--exit-fullscreen":"ejs--2b3dd6e2e26c0f0dc4ac5779dedd5e","ejs--fullscreen-fallback":"ejs--412041671de21945d3e028b6ae84c9","ejs--no-transition":"ejs--33643265135cf89e6c0a0d9866d6f1","ejs__sr-only":"ejs--6f0e996cd15e5fb6be0256918531d7","ejs-fade-in":"ejs--7cadf43f3d9eb17c7e3c36de84973b"}},function(e,t,n){var o;function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}o=function(){function e(){}function c(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1},this.config(t),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=c.id,c.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}function o(e,t){var n=this;return n.nipples=[],n.idles=[],n.actives=[],n.ids=[],n.pressureIntervals={},n.manager=e,n.id=o.id,o.id+=1,n.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,lockX:!1,lockY:!1},n.config(t),"static"!==n.options.mode&&"semi"!==n.options.mode||(n.options.multitouch=!1),n.options.multitouch||(n.options.maxNumberOfNipples=1),n.updateBox(),n.prepareNipples(),n.bindings(),n.begin(),n.nipples}function t(e){var t,o=this;return o.ids={},o.index=0,o.collections=[],o.config(e),o.prepareCollections(),u.bindEvt(window,"resize",function(e){clearTimeout(t),t=setTimeout(function(){var t,n=u.getScroll();o.collections.forEach(function(e){e.forEach(function(e){t=e.el.getBoundingClientRect(),e.position={x:n.x+t.left,y:n.y+t.top}})})},100)}),o.collections}var i,n=!!("ontouchstart"in window),a=!!window.PointerEvent,r=!!window.MSPointerEvent,s={start:"mousedown",move:"mousemove",end:"mouseup"},l={},u=(a?i={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:r?i={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:n?(i={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},l=s):i=s,{distance:function(e,t){var n=t.x-e.x,t=t.y-e.y;return Math.sqrt(n*n+t*t)},angle:function(e,t){var n=t.x-e.x,t=t.y-e.y;return u.degrees(Math.atan2(t,n))},findCoord:function(e,t,n){var o={x:0,y:0};return n=u.radians(n),o.x=e.x-t*Math.cos(n),o.y=e.y-t*Math.sin(n),o},radians:function(e){return e*(Math.PI/180)},degrees:function(e){return e*(180/Math.PI)},bindEvt:function(e,t,n){for(var o,i=t.split(/[ ,]+/g),a=0;a<i.length;a+=1)o=i[a],e.addEventListener?e.addEventListener(o,n,!1):e.attachEvent&&e.attachEvent(o,n)},unbindEvt:function(e,t,n){for(var o,i=t.split(/[ ,]+/g),a=0;a<i.length;a+=1)o=i[a],e.removeEventListener?e.removeEventListener(o,n):e.detachEvent&&e.detachEvent(o,n)},trigger:function(e,t,n){t=new CustomEvent(t,n);e.dispatchEvent(t)},prepareEvent:function(e){return e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e},getScroll:function(){return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},applyPosition:function(e,t){t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},getTransitionStyle:function(e,t,n){var o,i=u.configStylePropertyObject(e);for(o in i)if(i.hasOwnProperty(o))if("string"==typeof t)i[o]=t+" "+n;else{for(var a="",r=0,s=t.length;r<s;r+=1)a+=t[r]+" "+n+", ";i[o]=a.slice(0,-2)}return i},getVendorStyle:function(e,t){var n,o=u.configStylePropertyObject(e);for(n in o)o.hasOwnProperty(n)&&(o[n]=t);return o},configStylePropertyObject:function(t){var n={};return n[t]="",["webkit","Moz","o"].forEach(function(e){n[e+t.charAt(0).toUpperCase()+t.slice(1)]=""}),n},extend:function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},safeExtend:function(e,t){var n,o={};for(n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)?o[n]=t[n]:e.hasOwnProperty(n)&&(o[n]=e[n]);return o},map:function(e,t){if(e.length)for(var n=0,o=e.length;n<o;n+=1)t(e[n]);else t(e)}}),d=(e.prototype.on=function(e,t){var n,o=this,i=e.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var a=0;a<i.length;a+=1)n=i[a],o._handlers_[n]=o._handlers_[n]||[],o._handlers_[n].push(t);return o},e.prototype.off=function(e,t){var n=this;return n._handlers_=n._handlers_||{},void 0===e?n._handlers_={}:void 0===t?n._handlers_[e]=null:n._handlers_[e]&&0<=n._handlers_[e].indexOf(t)&&n._handlers_[e].splice(n._handlers_[e].indexOf(t),1),n},e.prototype.trigger=function(e,t){var n,o=this,i=e.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var a=0;a<i.length;a+=1)n=i[a],o._handlers_[n]&&o._handlers_[n].length&&o._handlers_[n].forEach(function(e){e.call(o,{type:n,target:o},t)})},e.prototype.config=function(e){this.options=this.defaults||{},e&&(this.options=u.safeExtend(this.options,e))},e.prototype.bindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},n._domHandlers_[t]=function(){"function"==typeof n["on"+t]?n["on"+t].apply(n,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},u.bindEvt(e,i[t],n._domHandlers_[t]),l[t]&&u.bindEvt(e,l[t],n._domHandlers_[t]),n},e.prototype.unbindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},u.unbindEvt(e,i[t],n._domHandlers_[t]),l[t]&&u.unbindEvt(e,l[t],n._domHandlers_[t]),delete n._domHandlers_[t],this},c.prototype=new e,(c.constructor=c).id=0,c.prototype.buildEl=function(e){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},c.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=u.getVendorStyle("borderRadius","50%"),e=u.getTransitionStyle("transition","opacity",e),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:this.options.color,opacity:".5"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:this.options.color,opacity:".5"},u.extend(n.el,e),u.extend(n.back,t),u.extend(n.front,t),this.applyStyles(n),this},c.prototype.applyStyles=function(e){for(var t in this.ui)if(this.ui.hasOwnProperty(t))for(var n in e[t])this.ui[t].style[n]=e[t][n];return this},c.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},c.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},c.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},c.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),"function"==typeof e&&e.call(this)},t.options.fadeTime)),t},c.prototype.hide=function(t){var n=this;return n.options.dataOnly||(n.ui.el.style.opacity=n.options.restOpacity,clearTimeout(n.removeTimeout),clearTimeout(n.showTimeout),clearTimeout(n.restTimeout),n.removeTimeout=setTimeout(function(){var e="dynamic"===n.options.mode?"none":"block";n.ui.el.style.display=e,"function"==typeof t&&t.call(n),n.trigger("hidden",n.instance)},n.options.fadeTime),n.options.restJoystick&&n.restPosition()),n},c.prototype.restPosition=function(e){var t=this,n=(t.frontPosition={x:0,y:0},t.options.fadeTime+"ms"),o={},n=(o.front=u.getTransitionStyle("transition",["top","left"],n),{front:{}});n.front={left:t.frontPosition.x+"px",top:t.frontPosition.y+"px"},t.applyStyles(o),t.applyStyles(n),t.restTimeout=setTimeout(function(){"function"==typeof e&&e.call(t),t.restCallback()},t.options.fadeTime)},c.prototype.restCallback=function(){var e={};e.front=u.getTransitionStyle("transition","none",""),this.applyStyles(e),this.trigger("rested",this.instance)},c.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},c.prototype.computeDirection=function(e){var t,n,o,i=e.angle.radian,a=Math.PI/4,r=Math.PI/2;if(a<i&&i<3*a&&!e.lockX?t="up":-a<i&&i<=a&&!e.lockY?t="left":3*-a<i&&i<=-a&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(n=-r<i&&i<r?"left":"right"),e.lockX||(o=0<i?"up":"down"),e.force>this.options.threshold){var s={};for(c in this.direction)this.direction.hasOwnProperty(c)&&(s[c]=this.direction[c]);var c,l={};for(c in this.direction={x:n,y:o,angle:t},e.direction=this.direction,s)s[c]===this.direction[c]&&(l[c]=!0);if(l.x&&l.y&&l.angle)return e;l.x&&l.y||this.trigger("plain",e),l.x||this.trigger("plain:"+n,e),l.y||this.trigger("plain:"+o,e),l.angle||this.trigger("dir dir:"+t,e)}return e},o.prototype=new e,(o.constructor=o).id=0,o.prototype.prepareNipples=function(){var e=this,o=e.nipples;o.on=e.on.bind(e),o.off=e.off.bind(e),o.options=e.options,o.destroy=e.destroy.bind(e),o.ids=e.ids,o.id=e.id,o.processOnMove=e.processOnMove.bind(e),o.processOnEnd=e.processOnEnd.bind(e),o.get=function(e){if(void 0===e)return o[0];for(var t=0,n=o.length;t<n;t+=1)if(o[t].identifier===e)return o[t];return!1}},o.prototype.bindings=function(){this.bindEvt(this.options.zone,"start"),this.options.zone.style.touchAction="none",this.options.zone.style.msTouchAction="none"},o.prototype.begin=function(){var e=this.options;"static"===e.mode&&((e=this.createNipple(e.position,this.manager.getIdentifier())).add(),this.idles.push(e))},o.prototype.createNipple=function(e,t){var n,o=this,i=u.getScroll(),a={},r=o.options,s=(e.x&&e.y?a={x:e.x-(i.x+o.box.left),y:e.y-(i.y+o.box.top)}:(e.top||e.right||e.bottom||e.left)&&((s=document.createElement("DIV")).style.display="hidden",s.style.top=e.top,s.style.right=e.right,s.style.bottom=e.bottom,s.style.left=e.left,s.style.position="absolute",r.zone.appendChild(s),n=s.getBoundingClientRect(),r.zone.removeChild(s),a=e,e={x:n.left+i.x,y:n.top+i.y}),new c(o,{color:r.color,size:r.size,threshold:r.threshold,fadeTime:r.fadeTime,dataOnly:r.dataOnly,restJoystick:r.restJoystick,restOpacity:r.restOpacity,mode:r.mode,identifier:t,position:e,zone:r.zone,frontPosition:{x:0,y:0}}));return r.dataOnly||(u.applyPosition(s.ui.el,a),u.applyPosition(s.ui.front,s.frontPosition)),o.nipples.push(s),o.trigger("added "+s.identifier+":added",s),o.manager.trigger("added "+s.identifier+":added",s),o.bindNipple(s),s},o.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},o.prototype.bindNipple=function(e){function t(e,t){n=e.type+" "+t.id+":"+e.type,o.trigger(n,t)}var n,o=this;e.on("destroyed",o.onDestroyed.bind(o)),e.on("shown hidden rested dir plain",t),e.on("dir:up dir:right dir:down dir:left",t),e.on("plain:up plain:right plain:down plain:left",t)},o.prototype.pressureFn=function(t,n,e){var o=this,i=0;clearInterval(o.pressureIntervals[e]),o.pressureIntervals[e]=setInterval(function(){var e=t.force||t.pressure||t.webkitForce||0;e!==i&&(n.trigger("pressure",e),o.trigger("pressure "+n.identifier+":pressure",e),i=e)}.bind(o),100)},o.prototype.onstart=function(e){var t=this,n=t.options;return e=u.prepareEvent(e),t.updateBox(),u.map(e,function(e){t.actives.length<n.maxNumberOfNipples&&t.processOnStart(e)}),t.manager.bindDocument(),!1},o.prototype.processOnStart=function(t){function e(e){e.trigger("start",e),n.trigger("start "+e.id+":start",e),e.show(),0<a&&n.pressureFn(t,e,e.identifier),n.processOnMove(t)}var n=this,o=n.options,i=n.manager.getIdentifier(t),a=t.force||t.pressure||t.webkitForce||0,r={x:t.pageX,y:t.pageY},s=n.getOrCreate(i,r);s.identifier!==i&&n.manager.removeIdentifier(s.identifier),s.identifier=i;if(0<=(i=n.idles.indexOf(s))&&n.idles.splice(i,1),n.actives.push(s),n.ids.push(s.identifier),"semi"!==o.mode)e(s);else{if(!(u.distance(r,s.position)<=o.catchDistance))return s.destroy(),void n.processOnStart(t);e(s)}return s},o.prototype.getOrCreate=function(e,t){var n,o=this,i=o.options;return/(semi|static)/.test(i.mode)?(n=o.idles[0])?(o.idles.splice(0,1),n):"semi"===i.mode?o.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):o.createNipple(t,e)},o.prototype.processOnMove=function(e){var t=this,n=t.options,o=t.manager.getIdentifier(e),i=t.nipples.get(o);if(!i)return console.error("Found zombie joystick with ID "+o),void t.manager.removeIdentifier(o);i.identifier=o;var o=i.options.size/2,a={x:e.pageX,y:e.pageY},r=u.distance(a,i.position),s=u.angle(a,i.position),c=u.radians(s),l=r/o,o=(a=o<r?u.findCoord(i.position,r=o,s):a).x-i.position.x,d=a.y-i.position.y,o=(n.lockX&&(d=0),n.lockY&&(o=0),i.frontPosition={x:o,y:d},n.dataOnly||u.applyPosition(i.ui.front,i.frontPosition),{identifier:i.identifier,position:a,force:l,pressure:e.force||e.pressure||e.webkitForce||0,distance:r,angle:{radian:c,degree:s},instance:i,lockX:n.lockX,lockY:n.lockY});(o=i.computeDirection(o)).angle={radian:u.radians(180-s),degree:180-s},i.trigger("move",o),t.trigger("move "+i.id+":move",o)},o.prototype.processOnEnd=function(e){var t=this,n=t.options,e=t.manager.getIdentifier(e),o=t.nipples.get(e),e=t.manager.removeIdentifier(o.identifier);o&&(n.dataOnly||o.hide(function(){"dynamic"===n.mode&&(o.trigger("removed",o),t.trigger("removed "+o.id+":removed",o),t.manager.trigger("removed "+o.id+":removed",o),o.destroy())}),clearInterval(t.pressureIntervals[o.identifier]),o.resetDirection(),o.trigger("end",o),t.trigger("end "+o.id+":end",o),0<=t.ids.indexOf(o.identifier)&&t.ids.splice(t.ids.indexOf(o.identifier),1),0<=t.actives.indexOf(o)&&t.actives.splice(t.actives.indexOf(o),1),/(semi|static)/.test(n.mode)?t.idles.push(o):0<=t.nipples.indexOf(o)&&t.nipples.splice(t.nipples.indexOf(o),1),t.manager.unbindDocument(),/(semi|static)/.test(n.mode)&&(t.manager.ids[e.id]=e.identifier))},o.prototype.onDestroyed=function(e,t){var n=this;0<=n.nipples.indexOf(t)&&n.nipples.splice(n.nipples.indexOf(t),1),0<=n.actives.indexOf(t)&&n.actives.splice(n.actives.indexOf(t),1),0<=n.idles.indexOf(t)&&n.idles.splice(n.idles.indexOf(t),1),0<=n.ids.indexOf(t.identifier)&&n.ids.splice(n.ids.indexOf(t.identifier),1),n.manager.removeIdentifier(t.identifier),n.manager.unbindDocument()},o.prototype.destroy=function(){var e,t=this;for(e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(e){e.destroy()}),t.pressureIntervals)t.pressureIntervals.hasOwnProperty(e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off()},t.prototype=new e,(t.constructor=t).prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var n;return e.collections.every(function(e){return!(n=e.get(t))}),n}},t.prototype.create=function(e){return this.createCollection(e)},t.prototype.createCollection=function(e){e=new o(this,e);return this.bindCollection(e),this.collections.push(e),e},t.prototype.bindCollection=function(e){function t(e,t){n=e.type+" "+t.id+":"+e.type,o.trigger(n,t)}var n,o=this;e.on("destroyed",o.onDestroyed.bind(o)),e.on("shown hidden rested dir plain",t),e.on("dir:up dir:right dir:down dir:left",t),e.on("plain:up plain:right plain:down plain:left",t)},t.prototype.bindDocument=function(){this.binded||(this.bindEvt(document,"move").bindEvt(document,"end"),this.binded=!0)},t.prototype.unbindDocument=function(e){Object.keys(this.ids).length&&!0!==e||(this.unbindEvt(document,"move").unbindEvt(document,"end"),this.binded=!1)},t.prototype.getIdentifier=function(e){var t;return e?void 0===(t=void 0===e.identifier?e.pointerId:e.identifier)&&(t=this.latest||0):t=this.index,void 0===this.ids[t]&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},t.prototype.removeIdentifier=function(e){var t,n={};for(t in this.ids)if(this.ids[t]===e){n.id=t,n.identifier=this.ids[t],delete this.ids[t];break}return n},t.prototype.onmove=function(e){return this.onAny("move",e),!1},t.prototype.onend=function(e){return this.onAny("end",e),!1},t.prototype.oncancel=function(e){return this.onAny("end",e),!1},t.prototype.onAny=function(e,t){var n,o=this,i="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=u.prepareEvent(t);return u.map(t,function(e){n=o.getIdentifier(e),u.map(o.collections,function(e,t,n){0<=n.ids.indexOf(t)&&(n[i](e),e._found_=!0)}.bind(null,e,n)),e._found_||o.removeIdentifier(n)}),!1},t.prototype.destroy=function(){var e=this;e.unbindDocument(!0),e.ids={},e.index=0,e.collections.forEach(function(e){e.destroy()}),e.off()},t.prototype.onDestroyed=function(e,t){if(this.collections.indexOf(t)<0)return!1;this.collections.splice(this.collections.indexOf(t),1)},new t);return{create:function(e){return d.create(e)},factory:d}},"object"==i(t)&&void 0!==e?e.exports=o():void 0!==(t="function"==typeof(o=o)?o.apply(t,[]):o)&&(e.exports=t)},function(e,t,T){!function(y,b,w){var _;function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(){"use strict";function o(t){return function(e){return new g(!0).update(e)[t]()}}function i(t){var n=require("crypto"),o=require("buffer").Buffer;return function(e){if("string"==typeof e)return n.createHash("md5").update(e,"utf8").digest("hex");if(null==e)throw l;return e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),Array.isArray(e)||ArrayBuffer.isView(e)||e.constructor===o?n.createHash("md5").update(new o(e)).digest("hex"):t(e)}}var e,t,l="input is invalid type",n="object"===("undefined"==typeof window?"undefined":S(window)),a=n?window:{},n=!(n=a.JS_MD5_NO_WINDOW?!1:n)&&"object"===("undefined"==typeof self?"undefined":S(self)),r=!a.JS_MD5_NO_NODE_JS&&"object"===(void 0===y?"undefined":S(y))&&y.versions&&y.versions.node,n=(r?a=b:n&&(a=self),!a.JS_MD5_NO_COMMON_JS&&"object"===S(w)&&w.exports),s=T(144),d=!a.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,c="0123456789abcdef".split(""),u=[128,32768,8388608,-2147483648],f=[0,8,16,24],p=["hex","array","digest","buffer","arrayBuffer","base64"],h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),m=[];d&&(e=new ArrayBuffer(68),t=new Uint8Array(e),m=new Uint32Array(e)),!a.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!d||!a.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===S(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});function g(e){e?(m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m,this.buffer8=t):d?(e=new ArrayBuffer(68),this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}g.prototype.update=function(e){if(!this.finalized){var t,n=S(e);if("string"!==n){if("object"!==n)throw l;if(null===e)throw l;if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||d&&ArrayBuffer.isView(e)))throw l;t=!0}for(var o,i,a=0,r=e.length,s=this.blocks,c=this.buffer8;a<r;){if(this.hashed&&(this.hashed=!1,s[0]=s[16],s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)if(d)for(i=this.start;a<r&&i<64;++a)c[i++]=e[a];else for(i=this.start;a<r&&i<64;++a)s[i>>2]|=e[a]<<f[3&i++];else if(d)for(i=this.start;a<r&&i<64;++a)(o=e.charCodeAt(a))<128?c[i++]=o:(o<2048?c[i++]=192|o>>6:(o<55296||57344<=o?c[i++]=224|o>>12:(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),c[i++]=240|o>>18,c[i++]=128|o>>12&63),c[i++]=128|o>>6&63),c[i++]=128|63&o);else for(i=this.start;a<r&&i<64;++a)(o=e.charCodeAt(a))<128?s[i>>2]|=o<<f[3&i++]:(o<2048?s[i>>2]|=(192|o>>6)<<f[3&i++]:(o<55296||57344<=o?s[i>>2]|=(224|o>>12)<<f[3&i++]:(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),s[i>>2]|=(240|o>>18)<<f[3&i++],s[i>>2]|=(128|o>>12&63)<<f[3&i++]),s[i>>2]|=(128|o>>6&63)<<f[3&i++]),s[i>>2]|=(128|63&o)<<f[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,64<=i?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return 4294967295<this.bytes&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},g.prototype.finalize=function(){var e,t;this.finalized||(this.finalized=!0,(e=this.blocks)[(t=this.lastByteIndex)>>2]|=u[3&t],56<=t&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash())},g.prototype.hash=function(){var e,t,n,o,i,a=this.blocks,r=this.first?((r=((e=((e=a[0]-680876937)<<7|e>>>25)-271733879<<0)^(t=((t=(-271733879^(n=((n=(-1732584194^2004318071&e)+a[1]-117830708)<<12|n>>>20)+e<<0)&(-271733879^e))+a[2]-1126478375)<<17|t>>>15)+n<<0)&(n^e))+a[3]-1316259209)<<22|r>>>10)+t<<0:(e=this.h0,r=this.h1,t=this.h2,((r+=((e=((e+=((n=this.h3)^r&(t^n))+a[0]-680876936)<<7|e>>>25)+r<<0)^(t=((t+=(r^(n=((n+=(t^e&(r^t))+a[1]-389564586)<<12|n>>>20)+e<<0)&(e^r))+a[2]+606105819)<<17|t>>>15)+n<<0)&(n^e))+a[3]-1044525330)<<22|r>>>10)+t<<0);r=((r+=((e=((e+=(n^r&(t^n))+a[4]-176418897)<<7|e>>>25)+r<<0)^(t=((t+=(r^(n=((n+=(t^e&(r^t))+a[5]+1200080426)<<12|n>>>20)+e<<0)&(e^r))+a[6]-1473231341)<<17|t>>>15)+n<<0)&(n^e))+a[7]-45705983)<<22|r>>>10)+t<<0,r=((r+=((e=((e+=(n^r&(t^n))+a[8]+1770035416)<<7|e>>>25)+r<<0)^(t=((t+=(r^(n=((n+=(t^e&(r^t))+a[9]-1958414417)<<12|n>>>20)+e<<0)&(e^r))+a[10]-42063)<<17|t>>>15)+n<<0)&(n^e))+a[11]-1990404162)<<22|r>>>10)+t<<0,r=((r+=((e=((e+=(n^r&(t^n))+a[12]+1804603682)<<7|e>>>25)+r<<0)^(t=((t+=(r^(n=((n+=(t^e&(r^t))+a[13]-40341101)<<12|n>>>20)+e<<0)&(e^r))+a[14]-1502002290)<<17|t>>>15)+n<<0)&(n^e))+a[15]+1236535329)<<22|r>>>10)+t<<0,r=((r+=((n=((n+=(r^t&((e=((e+=(t^n&(r^t))+a[1]-165796510)<<5|e>>>27)+r<<0)^r))+a[6]-1069501632)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^r&(n^e))+a[11]+643717713)<<14|t>>>18)+n<<0)^n))+a[0]-373897302)<<20|r>>>12)+t<<0,r=((r+=((n=((n+=(r^t&((e=((e+=(t^n&(r^t))+a[5]-701558691)<<5|e>>>27)+r<<0)^r))+a[10]+38016083)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^r&(n^e))+a[15]-660478335)<<14|t>>>18)+n<<0)^n))+a[4]-405537848)<<20|r>>>12)+t<<0,r=((r+=((n=((n+=(r^t&((e=((e+=(t^n&(r^t))+a[9]+568446438)<<5|e>>>27)+r<<0)^r))+a[14]-1019803690)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^r&(n^e))+a[3]-187363961)<<14|t>>>18)+n<<0)^n))+a[8]+1163531501)<<20|r>>>12)+t<<0,r=((r+=((n=((n+=(r^t&((e=((e+=(t^n&(r^t))+a[13]-1444681467)<<5|e>>>27)+r<<0)^r))+a[2]-51403784)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^r&(n^e))+a[7]+1735328473)<<14|t>>>18)+n<<0)^n))+a[12]-1926607734)<<20|r>>>12)+t<<0,r=((r+=((i=(n=((n+=((o=r^t)^(e=((e+=(o^n)+a[5]-378558)<<4|e>>>28)+r<<0))+a[8]-2022574463)<<11|n>>>21)+e<<0)^e)^(t=((t+=(i^r)+a[11]+1839030562)<<16|t>>>16)+n<<0))+a[14]-35309556)<<23|r>>>9)+t<<0,r=((r+=((i=(n=((n+=((o=r^t)^(e=((e+=(o^n)+a[1]-1530992060)<<4|e>>>28)+r<<0))+a[4]+1272893353)<<11|n>>>21)+e<<0)^e)^(t=((t+=(i^r)+a[7]-155497632)<<16|t>>>16)+n<<0))+a[10]-1094730640)<<23|r>>>9)+t<<0,r=((r+=((i=(n=((n+=((o=r^t)^(e=((e+=(o^n)+a[13]+681279174)<<4|e>>>28)+r<<0))+a[0]-358537222)<<11|n>>>21)+e<<0)^e)^(t=((t+=(i^r)+a[3]-722521979)<<16|t>>>16)+n<<0))+a[6]+76029189)<<23|r>>>9)+t<<0,r=((r+=((i=(n=((n+=((o=r^t)^(e=((e+=(o^n)+a[9]-640364487)<<4|e>>>28)+r<<0))+a[12]-421815835)<<11|n>>>21)+e<<0)^e)^(t=((t+=(i^r)+a[15]+530742520)<<16|t>>>16)+n<<0))+a[2]-995338651)<<23|r>>>9)+t<<0,r=((r+=((n=((n+=(r^((e=((e+=(t^(r|~n))+a[0]-198630844)<<6|e>>>26)+r<<0)|~t))+a[7]+1126891415)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~r))+a[14]-1416354905)<<15|t>>>17)+n<<0)|~e))+a[5]-57434055)<<21|r>>>11)+t<<0,r=((r+=((n=((n+=(r^((e=((e+=(t^(r|~n))+a[12]+1700485571)<<6|e>>>26)+r<<0)|~t))+a[3]-1894986606)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~r))+a[10]-1051523)<<15|t>>>17)+n<<0)|~e))+a[1]-2054922799)<<21|r>>>11)+t<<0,r=((r+=((n=((n+=(r^((e=((e+=(t^(r|~n))+a[8]+1873313359)<<6|e>>>26)+r<<0)|~t))+a[15]-30611744)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~r))+a[6]-1560198380)<<15|t>>>17)+n<<0)|~e))+a[13]+1309151649)<<21|r>>>11)+t<<0,r=((r+=((n=((n+=(r^((e=((e+=(t^(r|~n))+a[4]-145523070)<<6|e>>>26)+r<<0)|~t))+a[11]-1120210379)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~r))+a[2]+718787259)<<15|t>>>17)+n<<0)|~e))+a[9]-343485551)<<21|r>>>11)+t<<0,this.first?(this.h0=e+1732584193<<0,this.h1=r-271733879<<0,this.h2=t-1732584194<<0,this.h3=n+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+r<<0,this.h2=this.h2+t<<0,this.h3=this.h3+n<<0)},g.prototype.toString=g.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,o=this.h3;return c[e>>4&15]+c[15&e]+c[e>>12&15]+c[e>>8&15]+c[e>>20&15]+c[e>>16&15]+c[e>>28&15]+c[e>>24&15]+c[t>>4&15]+c[15&t]+c[t>>12&15]+c[t>>8&15]+c[t>>20&15]+c[t>>16&15]+c[t>>28&15]+c[t>>24&15]+c[n>>4&15]+c[15&n]+c[n>>12&15]+c[n>>8&15]+c[n>>20&15]+c[n>>16&15]+c[n>>28&15]+c[n>>24&15]+c[o>>4&15]+c[15&o]+c[o>>12&15]+c[o>>8&15]+c[o>>20&15]+c[o>>16&15]+c[o>>28&15]+c[o>>24&15]},g.prototype.array=g.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,o=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&o,o>>8&255,o>>16&255,o>>24&255]},g.prototype.buffer=g.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},g.prototype.base64=function(){for(var e,t,n,o="",i=this.array(),a=0;a<15;)e=i[a++],t=i[a++],n=i[a++],o+=h[e>>>2]+h[63&(e<<4|t>>>4)]+h[63&(t<<2|n>>>6)]+h[63&n];return e=i[a],o+(h[e>>>2]+h[e<<4&63]+"==")};var v=function(){var t=o("hex");(t=r?i(t):t).create=function(){return new g},t.update=function(e){return t.create().update(e)};for(var e=0;e<p.length;++e){var n=p[e];t[n]=o(n)}return t}();n?w.exports=v:(a.md5=v,!s||void 0!==(_=function(){return v}.call(v,T,v,w))&&(w.exports=_))}()}.call(this,T(49),T(31),T(143)(e))},function(e,r,Ge){"use strict";!function(g,Le,De){var e=Ge(52),Be=Ge.n(e);function ze(e){return(ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ue(){var r=this,i=new t,n=(r.chunks={},r.users={},r.readAsArrayBuffer=function(t,n,e){var o={file:t,earlyCallback:function(e){n(s(e,{currentPosition:-1}))},extra:e||{userid:0}};t.extra&&Object.keys(t.extra).length&&Object.keys(t.extra).forEach(function(e){o.extra[e]=t.extra[e]}),i.readAsArrayBuffer(r,o)},r.getNextChunk=function(e,t,n){void 0!==e.currentPosition&&(i=e.currentPosition,e=e.uuid);var o=r.chunks[e];if(o){var i,a=o[i=void 0!==n?(r.users[n+""]||(r.users[n+""]={fileUUID:e,userid:n,currentPosition:-1}),void 0!==i&&(r.users[n+""].currentPosition=i),r.users[n+""].currentPosition++,r.users[n+""].currentPosition):(void 0!==i&&(r.chunks[e].currentPosition=i),r.chunks[e].currentPosition++,r.chunks[e].currentPosition)];if(!a)return delete r.chunks[e],void r.convertToArrayBuffer({chunkMissing:!0,currentPosition:i,uuid:e},t);a=s(a),void 0!==n&&(a.remoteUserId=n+""),a.start&&r.onBegin(a),a.end&&r.onEnd(a),r.onProgress(a),r.convertToArrayBuffer(a,function(e){a.currentPosition!=a.maxChunks?t(e,!1):t(e,!0)})}},new o(r));function s(e,t){if(null==e||"object"!=ze(e))return e;if(e.constructor!=Object&&e.constructor!=Array)return e;if(e.constructor==Date||e.constructor==RegExp||e.constructor==Function||e.constructor==String||e.constructor==Number||e.constructor==Boolean)return new e.constructor(e);for(var n in t=t||new e.constructor,e)t[n]=void 0===t[n]?s(e[n],null):t[n];return t}r.addChunk=function(e,t){e&&n.receive(e,function(e){r.convertToArrayBuffer({readyForNextChunk:!0,currentPosition:e.currentPosition,uuid:e.uuid},t)})},r.chunkMissing=function(e){delete n.chunks[e.uuid],delete n.chunksWaiters[e.uuid]},r.onBegin=function(){},r.onEnd=function(){},r.onProgress=function(){},r.convertToObject=a.ConvertToObject,r.convertToArrayBuffer=a.ConvertToArrayBuffer,r.setMultipleUsers=function(){}}function t(){this.readAsArrayBuffer=function(t,n){var e,i,a,r,s,c,l,d,u,f,p,h,o=n.earlyCallback;delete n.earlyCallback,i=(i=function(e){t.chunks[e.uuid]||(t.chunks[e.uuid]={currentPosition:-1}),n.extra=n.extra||{userid:0},e.userid=n.userid||n.extra.userid||0,e.extra=n.extra,(t.chunks[e.uuid][e.currentPosition]=e).end&&o&&(o(e.uuid),o=null),200<e.maxChunks&&200==e.currentPosition&&o&&(o(e.uuid),o=null)})||function(e){postMessage(e)},(a=(e=n).file).uuid||(a.uuid=(100*Math.random()).toString().replace(/\./g,"")),r=e.chunkSize||15e3,e.extra&&e.extra.chunkSize&&(r=e.extra.chunkSize),c=0,e=r,l=Math.floor(Math.min(1e8,e)/r)*r,d=Math.ceil(a.size/r),a.maxChunks=d,f=[],i({currentPosition:u=0,uuid:a.uuid,maxChunks:d,size:a.size,name:a.name,type:a.type,lastModifiedDate:(a.lastModifiedDate||new Date).toString(),start:!0}),(h=new FileReader).onloadend=function(e){if(e.target.readyState==FileReader.DONE){a.name;var t=e.target.result;s=Math.ceil(t.byteLength/r);for(var n=0;n<s;n++){var o=n*r;f[u]=t.slice(o,Math.min(o+r,t.byteLength)),i({uuid:a.uuid,buffer:f[u],currentPosition:u,maxChunks:d,size:a.size,name:a.name,lastModifiedDate:(a.lastModifiedDate||new Date).toString(),type:a.type}),u++}(++c+1)*l<a.size?(p=a.slice(c*l,(c+1)*l),h.readAsArrayBuffer(p)):c*l<a.size?(p=a.slice(c*l,a.size),h.readAsArrayBuffer(p)):(a.url=URL.createObjectURL(a),i({currentPosition:u,uuid:a.uuid,maxChunks:d,size:a.size,name:a.name,lastModifiedDate:(a.lastModifiedDate||new Date).toString(),url:URL.createObjectURL(a),type:a.type,end:!0}))}},u+=1,p=a.slice(c*l,(c+1)*l),h.readAsArrayBuffer(p)}}function Fe(){var a=this,r=function(){};function n(e,n,t){e=e||function(){};var o,i=document.createElement("input"),t=(i.type="file",n&&(i.multiple=!0),t&&(i.webkitdirectory=!0),i.accept=a.accept,i.onclick=function(){i.clickStarted=!0},document.body.onfocus=function(){setTimeout(function(){i.clickStarted&&(i.clickStarted=!1,i.value||r())},500)},i.onchange=function(){if(n){if(!i.files.length)return void console.error("No file selected.");var t=[];return Array.from(i.files).forEach(function(e){e.url=e.webkitRelativePath,t.push(e)}),void e(t)}i.files[0]?(e(i.files[0]),i.parentNode.removeChild(i)):console.error("No file selected.")},i.style.display="none",(document.body||document.documentElement).appendChild(i),i);"function"==typeof t.click?t.click():"function"==typeof t.change?t.change():(void 0!==document.createEvent("Event")&&"function"==typeof(o=document.createEvent("Event")).initEvent&&"function"==typeof t.dispatchEvent?o.initEvent("click",!0,!0):o=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}),t.dispatchEvent(o))}a.selectSingleFile=function(e,t){t&&(r=t),n(e)},a.selectMultipleFiles=function(e,t){t&&(r=t),n(e,!0)},a.selectDirectory=function(e,t){t&&(r=t),n(e,!0,!0)},a.accept="*.*"}function o(r){var s=this;s.chunks={},s.chunksWaiters={},s.receive=function t(n,o){var i,a,e;n.uuid?(n.start&&!s.chunks[n.uuid]&&(s.chunks[n.uuid]={},r.onBegin&&r.onBegin(n)),!n.end&&n.buffer&&(s.chunks[n.uuid][n.currentPosition]=n.buffer),n.end&&(i=s.chunks[n.uuid],a=[],Object.keys(i).forEach(function(e,t){a.push(i[e])}),(e=je(e=new Blob(a,{type:n.type}),n)).url=URL.createObjectURL(e),e.uuid=n.uuid,e.size||console.error("Something went wrong. Blob Size is 0."),r.onEnd&&r.onEnd(e),delete s.chunks[n.uuid],delete s.chunksWaiters[n.uuid]),n.buffer&&r.onProgress&&r.onProgress(n),n.end||(o(n),s.chunksWaiters[n.uuid]=function(){setTimeout(function e(){n.buffer&&s.chunks[n.uuid]&&(n.currentPosition==n.maxChunks||s.chunks[n.uuid][n.currentPosition]||(o(n),setTimeout(e,5e3)))},5e3)},s.chunksWaiters[n.uuid]())):r.convertToObject(n,function(e){t(e)})}}var a={ConvertToArrayBuffer:function(e,t){i.pack(e,function(e){t(e.buffer)})},ConvertToObject:function(e,t){i.unpack(e,t)}};function je(e,t){if(e=e||{},!t)return e;for(var n in t)try{e[n]=t[n]}catch(e){}return e}function v(e,t){var n,o,i=0,a=e.getUint8(t,!1),r=(t+=y,a!==_.ARRAY&&a!==_.OBJECT||(c=e.getUint16(t,!1),t+=b),n=e.getUint32(t,!1),t+=w,S[a]),s=null===r?0:window[r+"Array"].BYTES_PER_ELEMENT;switch(a){case _.NULL:case _.UNDEFINED:p=null;break;case _.STRING:for(var c=n/s,l=[],i=0;i<c;i++){var d=e.getUint16(t,!1);t+=s,l.push(String.fromCharCode(d))}p=l.join("");break;case _.NUMBER:p=e.getFloat64(t,!1),t+=s;break;case _.BOOLEAN:p=1===e.getUint8(t,!1),t+=s;break;case _.INT8ARRAY:case _.INT16ARRAY:case _.INT32ARRAY:case _.UINT8ARRAY:case _.UINT16ARRAY:case _.UINT32ARRAY:case _.FLOAT32ARRAY:case _.FLOAT64ARRAY:case _.ARRAYBUFFER:o=e.buffer.slice(t,t+n),t+=n,p=a===_.ARRAYBUFFER?o:new window[r+"Array"](o);break;case _.BLOB:var u,f,p=window.Blob?(t=(f=v(e,(u=v(e,t)).cursor)).cursor,new Blob([f.value],{type:u.value})):(o=e.buffer.slice(t,t+n),t+=n,new g(o));break;case _.ARRAY:for(p=[],i=0;i<c;i++)t=(o=v(e,t)).cursor,p.push(o.value);break;case _.OBJECT:for(p={},i=0;i<c;i++){var h=v(e,t),m=v(e,h.cursor);t=m.cursor,p[h.value]=m.value}break;default:throw"TypeError: Type not supported."}return{value:p,cursor:t}}function f(e,i){for(var a=e.length,r=[],s=0,c=0,t=0;t<e.length;t++)!function(o){n(e[o],function(e){if(r[o]=e,c+=e[0].header_size+e[0].byte_length,++s===a){for(var t=[],n=0;n<r.length;n++)t=t.concat(r[n]);i(t,c)}})}(t)}var y=Uint8Array.BYTES_PER_ELEMENT,b=Uint16Array.BYTES_PER_ELEMENT,w=Uint32Array.BYTES_PER_ELEMENT,_={NULL:0,UNDEFINED:1,STRING:2,NUMBER:3,BOOLEAN:4,ARRAY:5,OBJECT:6,INT8ARRAY:7,INT16ARRAY:8,INT32ARRAY:9,UINT8ARRAY:10,UINT16ARRAY:11,UINT32ARRAY:12,FLOAT32ARRAY:13,FLOAT64ARRAY:14,ARRAYBUFFER:15,BLOB:16,FILE:16,BUFFER:17},S=[null,null,"Uint16","Float64","Uint8",null,null,"Int8","Int16","Int32","Uint8","Uint16","Uint32","Float32","Float64","Uint8","Uint8","Uint8"],n=function(n,o){var i=y+w,e=0,a=0,t=n,r=function(e){var t=void 0;if(void 0===e)t=_.UNDEFINED;else if(null===e)t=_.NULL;else{var n=e.constructor.name,o=e.constructor.toString().match(/\w+/g)[1];if(void 0!==n&&void 0!==_[n.toUpperCase()])t=_[n.toUpperCase()];else if(void 0!==o&&void 0!==_[o.toUpperCase()])t=_[o.toUpperCase()];else switch(ze(e)){case"string":t=_.STRING;break;case"number":t=_.NUMBER;break;case"boolean":t=_.BOOLEAN;break;case"object":e instanceof Array?t=_.ARRAY:e instanceof Int8Array?t=_.INT8ARRAY:e instanceof Int16Array?t=_.INT16ARRAY:e instanceof Int32Array?t=_.INT32ARRAY:e instanceof Uint8Array?t=_.UINT8ARRAY:e instanceof Uint16Array?t=_.UINT16ARRAY:e instanceof Uint32Array?t=_.UINT32ARRAY:e instanceof Float32Array?t=_.FLOAT32ARRAY:e instanceof Float64Array?t=_.FLOAT64ARRAY:e instanceof ArrayBuffer?t=_.ARRAYBUFFER:e instanceof Blob?t=_.BLOB:e instanceof g?t=_.BUFFER:e instanceof Object&&(t=_.OBJECT)}}return t}(n),s=null==S[r]?0:window[S[r]+"Array"].BYTES_PER_ELEMENT;switch(r){case _.UNDEFINED:case _.NULL:break;case _.NUMBER:case _.BOOLEAN:e=s;break;case _.STRING:e+=(a=n.length)*s;break;case _.INT8ARRAY:case _.INT16ARRAY:case _.INT32ARRAY:case _.UINT8ARRAY:case _.UINT16ARRAY:case _.UINT32ARRAY:case _.FLOAT32ARRAY:case _.FLOAT64ARRAY:e+=(a=n.length)*s;break;case _.ARRAY:return void f(n,function(e,t){o([{type:r,length:n.length,header_size:i+b,byte_length:t,value:null}].concat(e))});case _.OBJECT:var c,l=[];for(c in n)n.hasOwnProperty(c)&&(l.push(c),l.push(n[c]),a++);return void f(l,function(e,t){o([{type:r,length:a,header_size:i+b,byte_length:t,value:null}].concat(e))});case _.ARRAYBUFFER:e+=n.byteLength;break;case _.BLOB:var d=n.type,u=new FileReader;return u.onload=function(e){f([d,e.target.result],function(e,t){o([{type:r,length:a,header_size:i,byte_length:t,value:null}].concat(e))})},u.onerror=function(e){throw"FileReader Error: "+e},void u.readAsArrayBuffer(n);case _.BUFFER:e+=n.length;break;default:throw'TypeError: Type "'+n.constructor.name+'" not supported.'}o([{type:r,length:a,header_size:i,byte_length:e,value:t}].concat([]))},i={pack:function(e,t){try{n(e,function(e){t(function(e){for(var t=0,n=0,o=0,i=new ArrayBuffer(e[0].byte_length+e[0].header_size),a=new DataView(i),n=0;n<e.length;n++){e[n].header_size;var r=e[n].type,s=e[n].length,c=e[n].value,l=e[n].byte_length,d=S[r],u=null===d?0:window[d+"Array"].BYTES_PER_ELEMENT;switch(r===_.BUFFER?a.setUint8(t,_.BLOB,!1):a.setUint8(t,r,!1),t+=y,r!==_.ARRAY&&r!==_.OBJECT||(a.setUint16(t,s,!1),t+=b),a.setUint32(t,l,!1),t+=w,r){case _.NULL:case _.UNDEFINED:break;case _.STRING:for(o=0;o<s;o++,t+=u)a.setUint16(t,c.charCodeAt(o),!1);break;case _.NUMBER:case _.BOOLEAN:a["set"+d](t,c,!1),t+=u;break;case _.INT8ARRAY:case _.INT16ARRAY:case _.INT32ARRAY:case _.UINT8ARRAY:case _.UINT16ARRAY:case _.UINT32ARRAY:case _.FLOAT32ARRAY:case _.FLOAT64ARRAY:new Uint8Array(a.buffer,t,l).set(new Uint8Array(c.buffer)),t+=l;break;case _.ARRAYBUFFER:case _.BUFFER:new Uint8Array(a.buffer,t,l).set(new Uint8Array(c)),t+=l;break;case _.BLOB:case _.ARRAY:case _.OBJECT:break;default:throw"TypeError: Unexpected type found."}}return a}(e))})}catch(e){throw e}},unpack:function(e,t){try{t(function(e){e=e instanceof DataView?e:new DataView(e);return v(e,0).value}(e))}catch(e){throw e}}};r.a=function(D,B){function n(a,e){function r(e){return!e.audio&&!e.video&&!e.screen&&e.data}var t="",t=(t=(t=(t=(t+="?userid="+a.userid)+("&sessionid="+a.sessionid))+("&msgEvent="+a.socketMessageEvent))+("&socketCustomEvent="+a.socketCustomEvent))+("&autoCloseEntireSession="+!!a.autoCloseEntireSession);!0===a.session.broadcast&&(t+="&oneToMany=true"),t+="&maxParticipantsAllowed="+a.maxParticipantsAllowed,a.enableScalableBroadcast&&(t=t+"&enableScalableBroadcast=true"+("&maxRelayLimitPerUser="+(a.maxRelayLimitPerUser||2))),t+="&extra="+JSON.stringify(a.extra||{}),a.socketCustomParameters&&(t+=a.socketCustomParameters);try{Be.a.sockets={}}catch(e){}if(a.socketURL||(a.socketURL="/"),"/"!=a.socketURL.substr(a.socketURL.length-1,1))throw'"socketURL" MUST end with a slash.';a.enableLogs&&("/"==a.socketURL?console.info("socket.io url is: ",location.origin+"/"):console.info("socket.io url is: ",a.socketURL));try{a.socket=Be()(a.socketURL+t)}catch(e){a.socket=Be.a.connect(a.socketURL+t,a.socketOptions)}var s=a.multiPeersHandler;function c(e,t){a.peersBackup[e]||(a.peersBackup[e]={userid:e,extra:{}}),a.peersBackup[e].extra=t}a.socket.on("extra-data-updated",function(e,t){a.peers[e]&&(a.peers[e].extra=t,a.onExtraDataUpdated({userid:e,extra:t}),c(e,t))}),a.socket.on(a.socketMessageEvent,function e(t){if(t.remoteUserId==a.userid)if(a.peers[t.sender]&&a.peers[t.sender].extra!=t.message.extra&&(a.peers[t.sender].extra=t.extra,a.onExtraDataUpdated({userid:t.sender,extra:t.extra}),c(t.sender,t.extra)),t.message.streamSyncNeeded&&a.peers[t.sender]){var n=a.streamEvents[t.message.streamid];if(n&&n.stream){var o=t.message.action;if("ended"===o||"inactive"===o||"stream-removed"===o)return a.peersBackup[n.userid]&&(n.extra=a.peersBackup[n.userid].extra),void a.onstreamended(n);var i="both"!=t.message.type?t.message.type:null;"function"==typeof n.stream[o]&&n.stream[o](i)}}else if("dropPeerConnection"!==t.message){if(t.message.allParticipants)return-1===t.message.allParticipants.indexOf(t.sender)&&t.message.allParticipants.push(t.sender),void t.message.allParticipants.forEach(function(e){s[a.peers[e]?"renegotiatePeer":"createNewPeer"](e,{localPeerSdpConstraints:{OfferToReceiveAudio:a.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:a.sdpConstraints.mandatory.OfferToReceiveVideo},remotePeerSdpConstraints:{OfferToReceiveAudio:a.session.oneway?!!a.session.audio:a.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:a.session.oneway?!!a.session.video||!!a.session.screen:a.sdpConstraints.mandatory.OfferToReceiveVideo},isOneWay:!!a.session.oneway||"one-way"===a.direction,isDataOnly:r(a.session)})});if(t.message.newParticipant)t.message.newParticipant==a.userid||a.peers[t.message.newParticipant]||s.createNewPeer(t.message.newParticipant,t.message.userPreferences||{localPeerSdpConstraints:{OfferToReceiveAudio:a.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:a.sdpConstraints.mandatory.OfferToReceiveVideo},remotePeerSdpConstraints:{OfferToReceiveAudio:a.session.oneway?!!a.session.audio:a.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:a.session.oneway?!!a.session.video||!!a.session.screen:a.sdpConstraints.mandatory.OfferToReceiveVideo},isOneWay:!!a.session.oneway||"one-way"===a.direction,isDataOnly:r(a.session)});else if(t.message.readyForOffer&&(a.attachStreams.length&&(a.waitingForLocalMedia=!1),a.waitingForLocalMedia))setTimeout(function(){e(t)},1);else if(t.message.newParticipationRequest&&t.sender!==a.userid){a.peers[t.sender]&&a.deletePeer(t.sender);n={extra:t.extra||{},localPeerSdpConstraints:t.message.remotePeerSdpConstraints||{OfferToReceiveAudio:a.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:a.sdpConstraints.mandatory.OfferToReceiveVideo},remotePeerSdpConstraints:t.message.localPeerSdpConstraints||{OfferToReceiveAudio:a.session.oneway?!!a.session.audio:a.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:a.session.oneway?!!a.session.video||!!a.session.screen:a.sdpConstraints.mandatory.OfferToReceiveVideo},isOneWay:void 0!==t.message.isOneWay?t.message.isOneWay:!!a.session.oneway||"one-way"===a.direction,isDataOnly:void 0!==t.message.isDataOnly?t.message.isDataOnly:r(a.session),dontGetRemoteStream:void 0!==t.message.isOneWay?t.message.isOneWay:!!a.session.oneway||"one-way"===a.direction,dontAttachLocalStream:!!t.message.dontGetRemoteStream,connectionDescription:t,successCallback:function(){}};a.onNewParticipant(t.sender,n)}else{if(t.message.changedUUID&&a.peers[t.message.oldUUID]&&(a.peers[t.message.newUUID]=a.peers[t.message.oldUUID],delete a.peers[t.message.oldUUID]),t.message.userLeft)return s.onUserLeft(t.sender),void(t.message.autoCloseEntireSession&&a.leave());s.addNegotiatedMessage(t.message,t.sender)}}else a.deletePeer(t.sender)});var n=!1;a.socket.resetProps=function(){n=!1},a.socket.on("connect",function(){n||(n=!0,a.enableLogs&&console.info("socket.io connection is opened."),setTimeout(function(){a.socket.emit("extra-data-updated",a.extra)},1e3),e&&e(a.socket))}),a.socket.on("disconnect",function(){a.enableLogs&&console.warn("socket.io connection is closed"),a.close()}),a.socket.on("user-disconnected",function(e){e!==a.userid&&(a.onUserStatusChanged({userid:e,status:"offline",extra:a.peers[e]&&a.peers[e].extra||{}}),a.deletePeer(e))}),a.socket.on("user-connected",function(e){e!==a.userid&&a.onUserStatusChanged({userid:e,status:"online",extra:a.peers[e]&&a.peers[e].extra||{}})}),a.socket.on("closed-entire-session",function(e,t){a.leave(),a.onEntireSessionClosed({sessionid:e,userid:e,extra:t})}),a.socket.on("userid-already-taken",function(e,t){a.onUserIdAlreadyTaken(e,t)}),a.socket.on("logs",function(e){a.enableLogs&&console.debug("server-logs",e)}),a.socket.on("number-of-broadcast-viewers-updated",function(e){a.onNumberOfBroadcastViewersUpdated(e)}),a.socket.on("set-isInitiator-true",function(e){e==a.sessionid&&(a.isInitiator=!0)})}function z(i){var a=this,o=["getAllParticipants","getLength","selectFirst","streams","send","forEach"];function r(){i.fbr=new Ue,i.fbr.onProgress=function(e){i.onFileProgress(e)},i.fbr.onBegin=function(e){i.onFileStart(e)},i.fbr.onEnd=function(e){i.onFileEnd(e)}}i.peers={getLength:function(){var e,t=0;for(e in this)-1==o.indexOf(e)&&t++;return t},selectFirst:function(){var e,t;for(t in this)-1==o.indexOf(t)&&(e=this[t]);return e},getAllParticipants:function(e){var t,n=[];for(t in this)-1==o.indexOf(t)&&t!=e&&n.push(t);return n},forEach:function(t){this.getAllParticipants().forEach(function(e){t(i.peers[e])})},send:function(t,e){var n=this;if(!q(t.size)&&!q(t.type)){if(i.enableFileSharing)return void a.shareFile(t,e);"string"!=typeof t&&(t=JSON.stringify(t))}if("text"===t.type||t instanceof ArrayBuffer||t instanceof DataView){if("text"===t.type&&(t=JSON.stringify(t)),e){var o=i.peers[e];if(o)return o.channels.length?void o.channels.forEach(function(e){e.send(t)}):(i.peers[e].createDataChannel(),i.renegotiate(e),void setTimeout(function(){n.send(t,e)},3e3))}this.getAllParticipants().forEach(function(e){if(!n[e].channels.length)return i.peers[e].createDataChannel(),i.renegotiate(e),void setTimeout(function(){n[e].channels.forEach(function(e){e.send(t)})},3e3);n[e].channels.forEach(function(e){e.send(t)})})}else Me.send({text:t,channel:this,connection:i,remoteUserId:e})}},this.uuid=i.userid,this.getLocalConfig=function(e,n,t){return{streamsToShare:(t=t||{}).streamsToShare||{},rtcMultiConnection:i,connectionDescription:t.connectionDescription,userid:n,localPeerSdpConstraints:t.localPeerSdpConstraints,remotePeerSdpConstraints:t.remotePeerSdpConstraints,dontGetRemoteStream:!!t.dontGetRemoteStream,dontAttachLocalStream:!!t.dontAttachLocalStream,renegotiatingPeer:!!t.renegotiatingPeer,peerRef:t.peerRef,channels:t.channels||[],onLocalSdp:function(e){a.onNegotiationNeeded(e,n)},onLocalCandidate:function(e){(e=be.processCandidates(i,e))&&a.onNegotiationNeeded(e,n)},remoteSdp:e,onDataChannelMessage:function(e){var t;!i.fbr&&i.enableFileSharing&&r(),"string"!=typeof e&&i.enableFileSharing?(t=this,e instanceof ArrayBuffer||e instanceof DataView?i.fbr.convertToObject(e,function(e){t.onDataChannelMessage(e)}):e.readyForNextChunk?i.fbr.getNextChunk(e,function(t,e){i.peers[n].channels.forEach(function(e){e.send(t)})},n):e.chunkMissing?i.fbr.chunkMissing(e):i.fbr.addChunk(e,function(e){i.peers[n].peer.channel.send(e)})):a.onDataChannelMessage(e,n)},onDataChannelError:function(e){a.onDataChannelError(e,n)},onDataChannelOpened:function(e){a.onDataChannelOpened(e,n)},onDataChannelClosed:function(e){a.onDataChannelClosed(e,n)},onRemoteStream:function(e){i.peers[n]&&i.peers[n].streams.push(e),a.onGettingRemoteMedia(e,n)},onRemoteStreamRemoved:function(e){a.onRemovingRemoteMedia(e,n)},onPeerStateChanged:function(e){a.onPeerStateChanged(e),"new"===e.iceConnectionState&&a.onNegotiationStarted(n,e),"connected"===e.iceConnectionState&&a.onNegotiationCompleted(n,e),-1!==e.iceConnectionState.search(/closed|failed/gi)&&(a.onUserLeft(n),a.disconnectWith(n))}}},this.createNewPeer=function(e,t){if(!(i.maxParticipantsAllowed<=i.getAllParticipants().length)){if(t=t||{},i.isInitiator&&i.session.audio&&"two-way"===i.session.audio&&!t.streamsToShare&&(t.isOneWay=!1,t.isDataOnly=!1,t.session=i.session),!t.isOneWay&&!t.isDataOnly)return t.isOneWay=!0,void this.onNegotiationNeeded({enableMedia:!0,userPreferences:t},e);t=i.setUserPreferences(t,e);t=this.getLocalConfig(null,e,t);i.peers[e]=new he(t)}},this.createAnsweringPeer=function(e,t,n){n=i.setUserPreferences(n||{},t);e=this.getLocalConfig(e,t,n);i.peers[t]=new he(e)},this.renegotiatePeer=function(e,t,n){i.peers[e]?((t=t||{}).renegotiatingPeer=!0,t.peerRef=i.peers[e].peer,t.channels=i.peers[e].channels,n=this.getLocalConfig(n,e,t),i.peers[e]=new he(n)):i.enableLogs&&console.error("Peer ("+e+") does not exist. Renegotiation skipped.")},this.replaceTrack=function(t,n,o){if(!i.peers[n])throw"This peer ("+n+") does not exist.";var e=i.peers[n].peer;e.getSenders&&"function"==typeof e.getSenders&&e.getSenders().length?e.getSenders().forEach(function(e){o&&"video"===e.track.kind&&(i.peers[n].peer.lastVideoTrack=e.track,e.replaceTrack(t)),o||"audio"!==e.track.kind||(i.peers[n].peer.lastAudioTrack=e.track,e.replaceTrack(t))}):(console.warn("RTPSender.replaceTrack is NOT supported."),this.renegotiatePeer(n))},this.onNegotiationNeeded=function(e,t){},this.addNegotiatedMessage=function(e,t){return e.type&&e.sdp?("answer"==e.type&&i.peers[t]&&i.peers[t].addRemoteSdp(e),"offer"==e.type&&(e.renegotiatingPeer?this.renegotiatePeer(t,null,e):this.createAnsweringPeer(e,t)),void(i.enableLogs&&console.log("Remote peer's sdp:",e.sdp))):e.candidate?(i.peers[t]&&i.peers[t].addRemoteCandidate(e),void(i.enableLogs&&console.log("Remote peer's candidate pairs:",e.candidate))):(e.enableMedia&&(i.session=e.userPreferences.session||i.session,i.session.oneway&&i.attachStreams.length&&(i.attachStreams=[]),e.userPreferences.isDataOnly&&i.attachStreams.length&&(i.attachStreams.length=[]),n={},i.attachStreams.forEach(function(e){n[e.streamid]={isAudio:!!e.isAudio,isVideo:!!e.isVideo,isScreen:!!e.isScreen}}),e.userPreferences.streamsToShare=n,a.onNegotiationNeeded({readyForOffer:!0,userPreferences:e.userPreferences},t)),void(e.readyForOffer&&i.onReadyForOffer(t,e.userPreferences)));var n},this.onGettingRemoteMedia=function(e,t){},this.onRemovingRemoteMedia=function(e,t){},this.onGettingLocalMedia=function(e){},this.onLocalMediaError=function(e,t){i.onMediaError(e,t)},this.shareFile=function(e,n){r(),i.fbr.readAsArrayBuffer(e,function(t){var e=i.getAllParticipants();(e=n?[n]:e).forEach(function(e){i.fbr.getNextChunk(t,function(t){i.peers[e].channels.forEach(function(e){e.send(t)})},e)})},{userid:i.userid,chunkSize:"Firefox"===DetectRTC.browser.name?15e3:i.chunkSize||0})};var n=new Ce(i);this.onDataChannelMessage=function(e,t){n.receive(JSON.parse(e),t,i.peers[t]?i.peers[t].extra:{})},this.onDataChannelClosed=function(e,t){e.userid=t,e.extra=i.peers[t]?i.peers[t].extra:{},i.onclose(e)},this.onDataChannelError=function(e,t){e.userid=t,event.extra=i.peers[t]?i.peers[t].extra:{},i.onerror(e)},this.onDataChannelOpened=function(e,t){i.peers[t].channels.length?i.peers[t].channels=[e]:(i.peers[t].channels.push(e),i.onopen({userid:t,extra:i.peers[t]?i.peers[t].extra:{},channel:e}))},this.onPeerStateChanged=function(e){i.onPeerStateChanged(e)},this.onNegotiationStarted=function(e,t){},this.onNegotiationCompleted=function(e,t){},this.getRemoteStreams=function(e){return e=e||i.peers.getAllParticipants()[0],i.peers[e]?i.peers[e].streams:[]}}function U(e,t,n){"undefined"!=typeof CustomEvent&&(t=new CustomEvent(t,{arguments:n,__exposedProps__:n}),e.dispatchEvent(t))}function F(t,n){n.stream&&n.stream&&n.stream.addEventListener&&(n.stream.addEventListener("mute",function(e){(e=t.streamEvents[n.streamid]).session={audio:"audio"===e.muteType,video:"video"===e.muteType},t.onmute(e)},!1),n.stream.addEventListener("unmute",function(e){(e=t.streamEvents[n.streamid]).session={audio:"audio"===e.unmuteType,video:"video"===e.unmuteType},t.onunmute(e)},!1))}function f(){if(window.crypto&&window.crypto.getRandomValues&&-1===navigator.userAgent.indexOf("Safari")){for(var e=window.crypto.getRandomValues(new Uint32Array(3)),t="",n=0,o=e.length;n<o;n++)t+=e[n].toString(36);return t}return(Math.random()*(new Date).getTime()).toString(36).replace(/\./g,"")}function j(n,t,o){if(o.autoCreateMediaElement){var i,e=!1,a=(S(n,"video").length||n.isVideo||n.isScreen||(e=!0),"Firefox"===DetectRTC.browser.name&&(o.session.video||o.session.screen)&&(e=!1),document.createElement(e?"audio":"video"));a.srcObject=n;try{a.setAttributeNode(document.createAttribute("autoplay")),a.setAttributeNode(document.createAttribute("playsinline")),a.setAttributeNode(document.createAttribute("controls"))}catch(e){a.setAttribute("autoplay",!0),a.setAttribute("playsinline",!0),a.setAttribute("controls",!0)}"Firefox"===DetectRTC.browser.name&&(i="ended","oninactive"in a&&(i="inactive"),a.addEventListener(i,function(){var t,e;currentUserMediaRequest.remove(n.idInstance),"local"===n.type&&(i="ended","oninactive"in n&&(i="inactive"),M.onSyncNeeded(n.streamid,i),o.attachStreams.forEach(function(e,t){n.streamid===e.streamid&&delete o.attachStreams[t]}),t=[],o.attachStreams.forEach(function(e){e&&t.push(e)}),o.attachStreams=t,(e=o.streamEvents[n.streamid])?o.onstreamended(e):this.parentNode&&this.parentNode.removeChild(this))},!1));var r,e=a.play();void 0!==e?(r=!1,setTimeout(function(){r||(r=!0,t(a))},1e3),e.then(function(){r||(r=!0,t(a))}).catch(function(e){r||(r=!0,t(a))})):t(a)}else t({})}function G(e,t){window.removeEventListener(e,t),window.addEventListener(e,t,!1)}function V(e){var t=[];return e.forEach(function(e){e&&t.push(e)}),t}function c(e){return!e.audio&&!e.video&&!e.screen&&e.data}function q(e){return void 0===e}(t=void 0!==Le?Le:null)&&"undefined"==typeof window&&void 0!==Le&&(Le.navigator={userAgent:"Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45",getUserMedia:function(){}},Le.console||(Le.console={}),void 0===Le.console.debug&&(Le.console.debug=Le.console.info=Le.console.error=Le.console.log=Le.console.log||function(){console.log(arguments)}),"undefined"==typeof document&&(t.document={},document.createElement=document.captureStream=document.mozCaptureStream=function(){var e={getContext:function(){return e},play:function(){},pause:function(){},drawImage:function(){},toDataURL:function(){return""}};return e},document.addEventListener=document.removeEventListener=t.addEventListener=t.removeEventListener=function(){},t.HTMLVideoElement=t.HTMLMediaElement=function(){}),void 0===Be.a&&(t.io=function(){return{on:function(e,t){t=t||function(){},"connect"===e&&t()},emit:function(e,t,n){n=n||function(){},"open-room"!==e&&"join-room"!==e||n(!0,t.sessionid,null)}}}),"undefined"==typeof location&&(t.location={protocol:"file:",href:"",hash:"",origin:"self"}),"undefined"==typeof screen&&(t.screen={width:0,height:0}),"undefined"==typeof URL&&(t.URL={createObjectURL:function(){return""},revokeObjectURL:function(){return""}}),t.window=Le);var e,t="Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45",s=("object"===(void 0===De?"undefined":ze(De))&&"object"===ze(De.versions)&&De.versions.node&&!De.browser&&(e=De.versions.node.toString().replace("v",""),t="Nodejs/"+e+" (NodeOS) AppleWebKit/"+e+" (KHTML, like Gecko) Nodejs/"+e+" Nodejs/"+e),e=void 0!==Le?Le:window,"undefined"==typeof window&&("undefined"==typeof window&&void 0!==Le&&(Le.navigator={userAgent:t,getUserMedia:function(){}},e.window=Le),"undefined"==typeof location&&(e.location={protocol:"file:",href:"",hash:""}),"undefined"==typeof screen&&(e.screen={width:0,height:0})),window.navigator),t=(void 0!==s?(void 0!==s.webkitGetUserMedia&&(s.getUserMedia=s.webkitGetUserMedia),void 0!==s.mozGetUserMedia&&(s.getUserMedia=s.mozGetUserMedia)):s={getUserMedia:function(){},userAgent:t},!!/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i.test(s.userAgent||"")),H=!(-1===s.userAgent.indexOf("Edge")||!s.msSaveOrOpenBlob&&!s.msSaveBlob),W=!!window.opera||0<=s.userAgent.indexOf(" OPR/"),X=void 0!==window.InstallTrigger,Y=/^((?!chrome|android).)*safari/i.test(s.userAgent),J=!!window.chrome&&!W,K="undefined"!=typeof document&&!!document.documentMode&&!H;function Q(e,t){var n=0,o=!1,i=window.setInterval(function(){e()&&(window.clearInterval(i),t(o)),50<n++&&(window.clearInterval(i),t(o=!0))},10)}var o,$,i={Android:function(){return s.userAgent.match(/Android/i)},BlackBerry:function(){return s.userAgent.match(/BlackBerry|BB10/i)},iOS:function(){return s.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return s.userAgent.match(/Opera Mini/i)},Windows:function(){return s.userAgent.match(/IEMobile/i)},any:function(){return i.Android()||i.BlackBerry()||i.iOS()||i.Opera()||i.Windows()},getOsName:function(){var e="Unknown OS";return i.Android()&&(e="Android"),i.BlackBerry()&&(e="BlackBerry"),i.iOS()&&(e="iOS"),i.Opera()&&(e="Opera Mini"),e=i.Windows()?"Windows":e}},a="Unknown OS",r="Unknown OS Version",l=((y=function(){for(var e,t=s.appVersion,n=s.userAgent,o="-",i=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 3.11",r:/Win16/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/},{s:"Search Bot",r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}],a=0;e=i[a];a++)if(e.r.test(n)){o=e.s;break}var r="-";switch(/Windows/.test(o)&&(/Windows (.*)/.test(o)&&(r=/Windows (.*)/.exec(o)[1]),o="Windows"),o){case"Mac OS X":/Mac OS X (10[\.\_\d]+)/.test(n)&&(r=/Mac OS X (10[\.\_\d]+)/.exec(n)[1]);break;case"Android":/Android ([\.\_\d]+)/.test(n)&&(r=/Android ([\.\_\d]+)/.exec(n)[1]);break;case"iOS":/OS (\d+)_(\d+)_?(\d+)?/.test(n)&&(r=(r=/OS (\d+)_(\d+)_?(\d+)?/.exec(t))[1]+"."+r[2]+"."+(0|r[3]))}return{osName:o,osVersion:r}}())&&y.osName&&"-"!=y.osName?(a=y.osName,r=y.osVersion):i.any()&&"Android"==(a=i.getOsName())&&(r=!!(y=(l=(l||s.userAgent).toLowerCase()).match(/android\s([0-9\.]*)/))&&y[1]),"object"===(void 0===De?"undefined":ze(De))&&"object"===ze(De.versions)&&De.versions.node),Z=("Unknown OS"===a&&l&&(a="Nodejs",r=De.versions.node.toString().replace("v","")),!1),ee=!1,te=(["captureStream","mozCaptureStream","webkitCaptureStream"].forEach(function(e){"undefined"!=typeof document&&"function"==typeof document.createElement&&(!Z&&e in document.createElement("canvas")&&(Z=!0),!ee&&e in document.createElement("video")&&(ee=!0))}),/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/),ne=/([0-9]{1,3}(\.[0-9]{1,3}){3})/,oe=/[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}/,d=[],u=[],p=[],h=[],ie=(s.mediaDevices&&s.mediaDevices.enumerateDevices&&(s.enumerateDevices=function(e){var t=s.mediaDevices.enumerateDevices();t&&t.then?s.mediaDevices.enumerateDevices().then(e).catch(function(){e([])}):e([])}),!1),ae=((void 0!==C&&"getSources"in C||s.mediaDevices&&s.mediaDevices.enumerateDevices)&&(ie=!0),!1),re=!1,se=!1,m=!1,g=!1,v=window.DetectRTC||{};v.browser=function(){s.appVersion;var e,t,n=s.userAgent,o=s.appName,i=""+parseFloat(s.appVersion),a=parseInt(s.appVersion,10);if(Y&&!J&&-1!==n.indexOf("CriOS")&&(J=!(Y=!1)),W){o="Opera";try{a=(i=s.userAgent.split("OPR/")[1].split(" ")[0]).split(".")[0]}catch(e){i="0.0.0.0",a=0}}else K?(i=0<(e=n.indexOf("rv:"))?n.substring(e+3):(e=n.indexOf("MSIE"),n.substring(e+5)),o="IE"):J?(e=n.indexOf("Chrome"),o="Chrome",i=n.substring(e+7)):Y?(e=n.indexOf("Safari"),o="Safari",i=n.substring(e+7),-1!==(e=n.indexOf("Version"))&&(i=n.substring(e+8)),-1!==s.userAgent.indexOf("Version/")&&(i=s.userAgent.split("Version/")[1].split(" ")[0])):X?(e=n.indexOf("Firefox"),o="Firefox",i=n.substring(e+8)):(t=n.lastIndexOf(" ")+1)<(e=n.lastIndexOf("/"))&&(o=n.substring(t,e),i=n.substring(e+1),o.toLowerCase()===o.toUpperCase()&&(o=s.appName));return H&&(o="Edge",i=s.userAgent.split("Edge/")[1]),-1!==(t=i.search(/[; \)]/))&&(i=i.substring(0,t)),a=parseInt(""+i,10),isNaN(a)&&(i=""+parseFloat(s.appVersion),a=parseInt(s.appVersion,10)),{fullVersion:i,version:a,name:o,isPrivateBrowsing:!1}}();try{if(window.webkitRequestFileSystem)window.webkitRequestFileSystem(window.TEMPORARY,1,function(){o=!1},function(e){o=!0});else if(window.indexedDB&&/Firefox/.test(window.navigator.userAgent)){try{($=window.indexedDB.open("test")).onerror=function(){return!0}}catch(e){o=!0}void 0===o&&Q(function(){return"done"===$.readyState},function(e){e||(o=!$.result)})}else if(function(){var e=window.navigator.userAgent.toLowerCase();if(0!==e.indexOf("msie")||0!==e.indexOf("trident"))return e=/(?:msie|rv:)\s?([\d\.]+)/.exec(e),e&&10<=parseInt(e[1],10)}()){o=!1;try{window.indexedDB||(o=!0)}catch(e){o=!0}}else if(window.localStorage&&/Safari/.test(window.navigator.userAgent)){try{window.localStorage.setItem("test",1)}catch(e){o=!0}void 0===o&&(o=!1,window.localStorage.removeItem("test"))}}catch(e){o=!1}Q(function(){return void 0!==o},function(e){var t;t=o,v.browser.isPrivateBrowsing=!!t}),v.browser["is"+v.browser.name]=!0,v.osName=a,v.osVersion=r,"object"===(void 0===De?"undefined":ze(De))&&"object"===ze(De.versions)&&De.versions["node-webkit"];var ce=!1,y=(["RTCPeerConnection","webkitRTCPeerConnection","mozRTCPeerConnection","RTCIceGatherer"].forEach(function(e){ce||e in window&&(ce=!0)}),v.isWebRTCSupported=ce,v.isORTCSupported="undefined"!=typeof RTCIceGatherer,!1),b=((v.browser.isChrome&&35<=v.browser.version||v.browser.isFirefox&&34<=v.browser.version||v.browser.isEdge&&17<=v.browser.version||"Android"===v.osName&&v.browser.isChrome)&&(y=!0),/^(https:|chrome-extension:)$/g.test(location.protocol||"")||("undefined"!=typeof document&&"string"==typeof document.domain&&document.domain.search&&-1===document.domain.search(/localhost|127.0./g)&&(v.browser.isChrome||v.browser.isEdge||v.browser.isOpera)||v.browser.isFirefox)&&(y=!1),v.isScreenCapturingSupported=y,{isSupported:!1,isCreateMediaStreamSourceSupported:!1}),l=(["AudioContext","webkitAudioContext","mozAudioContext","msAudioContext"].forEach(function(e){b.isSupported||e in window&&(b.isSupported=!0,window[e]&&"createMediaStreamSource"in window[e].prototype&&(b.isCreateMediaStreamSourceSupported=!0))}),v.isAudioContextSupported=b.isSupported,v.isCreateMediaStreamSourceSupported=b.isCreateMediaStreamSourceSupported,!1),a=(v.browser.isChrome&&31<v.browser.version&&(l=!0),v.isRtpDataChannelsSupported=l,!1),r=((v.browser.isFirefox&&28<v.browser.version||v.browser.isChrome&&25<v.browser.version||v.browser.isOpera&&11<=v.browser.version)&&(a=!0),v.isSctpDataChannelsSupported=a,v.isMobileDevice=t,!1),w=((s.getUserMedia||s.mediaDevices&&s.mediaDevices.getUserMedia)&&(r=!0),v.browser.isChrome&&46<=v.browser.version&&!/^(https:|chrome-extension:)$/g.test(location.protocol||"")&&"undefined"!=typeof document&&"string"==typeof document.domain&&document.domain.search&&-1===document.domain.search(/localhost|127.0./g)&&(r="Requires HTTPs"),"Nodejs"===v.osName&&(r=!1),v.isGetUserMediaSupported=r,y="",screen.width&&(y+=(screen.width||"")+" x "+(screen.height||"")),v.displayResolution=y,v.displayAspectRatio=((l=screen.width)/(t=function e(t,n){return 0==n?t:e(n,t%n)}(l,a=screen.height))/(a/t)).toFixed(2),v.isCanvasSupportsStreamCapturing=Z,v.isVideoSupportsStreamCapturing=ee,"Chrome"==v.browser.name&&53<=v.browser.version&&(v.isCanvasSupportsStreamCapturing||(v.isCanvasSupportsStreamCapturing="Requires chrome flag: enable-experimental-web-platform-features"),v.isVideoSupportsStreamCapturing||(v.isVideoSupportsStreamCapturing="Requires chrome flag: enable-experimental-web-platform-features")),v.DetectLocalIPAddress=function(n,e){if(v.isWebRTCSupported){var o=!0,i=!0;if("undefined"!=typeof document&&"function"==typeof document.getElementById){var a={};if(!(r=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection)){var t=document.getElementById("iframe");if(!t)return;var t=t.contentWindow,r=t.RTCPeerConnection||t.mozRTCPeerConnection||t.webkitRTCPeerConnection}if(r){var t=null,s=new r({iceServers:[{urls:"stun:stun.l.google.com:19302"}]},t="Chrome"===v.browser&&v.browser.version<58?{optional:[{RtpDataChannels:!0}]}:t);if(e&&(s.addStream?s.addStream(e):s.addTrack&&e.getTracks()[0]&&s.addTrack(e.getTracks()[0],e)),s.onicecandidate=function(e){e.candidate&&c(e.candidate.candidate)},!e)try{s.createDataChannel("sctp",{})}catch(e){}v.isPromisesSupported?s.createOffer().then(function(e){s.setLocalDescription(e).then(l)}):s.createOffer(function(e){s.setLocalDescription(e,l,function(){})},function(){})}}function c(e){var t=ne.exec(e);t&&(t=t[1],e.match(te),void 0===a[t]&&((e=t).match(te)?n("Local: "+e,o=!1,i):e.match(oe)?n("Public: "+e,o,i=!1):n("Public: "+e,o,i)),a[t]=!0)}function l(){s.localDescription.sdp.split("\n").forEach(function(e){0===e.indexOf("a=candidate:")&&c(e)})}}},v.isWebSocketsSupported="WebSocket"in window&&2===window.WebSocket.CLOSING,v.isWebSocketsBlocked=!v.isWebSocketsSupported,"Nodejs"===v.osName&&(v.isWebSocketsSupported=!0,v.isWebSocketsBlocked=!1),v.checkWebSocketsSupport=function(t){t=t||function(){};try{var e,n=new WebSocket("wss://echo.websocket.org:443/");n.onopen=function(){v.isWebSocketsBlocked=!1,e=(new Date).getTime(),n.send("ping")},n.onmessage=function(){v.WebsocketLatency=(new Date).getTime()-e+"ms",t(),n.close(),n=null},n.onerror=function(){v.isWebSocketsBlocked=!0,t()}}catch(e){v.isWebSocketsBlocked=!0,t()}},v.load=function(e){var t,o;t=e=e||function(){},ie?(!s.enumerateDevices&&window.MediaStreamTrack&&window.MediaStreamTrack.getSources&&(s.enumerateDevices=window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack)),!s.enumerateDevices&&s.enumerateDevices&&(s.enumerateDevices=s.enumerateDevices.bind(s)),s.enumerateDevices?(d=[],u=[],p=[],g=m=se=re=ae=!(h=[]),o={},s.enumerateDevices(function(e){e.forEach(function(e){var t,n={};for(t in e)try{"function"!=typeof e[t]&&(n[t]=e[t])}catch(e){}o[n.deviceId+n.label+n.kind]||("audio"===n.kind&&(n.kind="audioinput"),"video"===n.kind&&(n.kind="videoinput"),n.deviceId||(n.deviceId=n.id),n.id||(n.id=n.deviceId),n.label?("videoinput"!==n.kind||g||(g=!0),"audioinput"!==n.kind||m||(m=!0)):(n.isCustomLabel=!0,"videoinput"===n.kind?n.label="Camera "+(h.length+1):"audioinput"===n.kind?n.label="Microphone "+(u.length+1):"audiooutput"===n.kind?n.label="Speaker "+(p.length+1):n.label="Please invoke getUserMedia once.",void 0!==v&&v.browser.isChrome&&46<=v.browser.version&&!/^(https:|chrome-extension:)$/g.test(location.protocol||"")&&"undefined"!=typeof document&&"string"==typeof document.domain&&document.domain.search&&-1===document.domain.search(/localhost|127.0./g)&&(n.label="HTTPs is required to get label of this "+n.kind+" device.")),"audioinput"===n.kind&&(ae=!0,-1===u.indexOf(n)&&u.push(n)),"audiooutput"===n.kind&&(re=!0,-1===p.indexOf(n)&&p.push(n)),"videoinput"===n.kind&&(se=!0,-1===h.indexOf(n)&&h.push(n)),d.push(n),o[n.deviceId+n.label+n.kind]=n)}),void 0!==v&&(v.MediaDevices=d,v.hasMicrophone=ae,v.hasSpeakers=re,v.hasWebcam=se,v.isWebsiteHasWebcamPermissions=g,v.isWebsiteHasMicrophonePermissions=m,v.audioInputDevices=u,v.audioOutputDevices=p,v.videoInputDevices=h),t&&t()})):t&&t()):t&&t()},v.MediaDevices=void 0!==d?d:[],v.hasMicrophone=ae,v.hasSpeakers=re,v.hasWebcam=se,v.isWebsiteHasWebcamPermissions=g,v.isWebsiteHasMicrophonePermissions=m,v.audioInputDevices=u,v.audioOutputDevices=p,v.videoInputDevices=h,r=!1,"undefined"!=typeof document&&"function"==typeof document.createElement&&"setSinkId"in document.createElement("video")&&(r=!0),v.isSetSinkIdSupported=r,y=!1,v.browser.isFirefox&&"undefined"!=typeof mozRTCPeerConnection?"getSenders"in mozRTCPeerConnection.prototype&&(y=!0):v.browser.isChrome&&"undefined"!=typeof webkitRTCPeerConnection&&"getSenders"in webkitRTCPeerConnection.prototype&&(y=!0),v.isRTPSenderReplaceTracksSupported=y,l=!1,v.browser.isFirefox&&38<v.browser.version&&(l=!0),v.isRemoteStreamProcessingSupported=l,a=!1,void 0!==C&&"applyConstraints"in C.prototype&&(a=!0),v.isApplyConstraintsSupported=a,t=!1,v.browser.isFirefox&&43<=v.browser.version&&(t=!0),v.isMultiMonitorScreenCapturingSupported=t,v.isPromisesSupported=!!("Promise"in window),v.version="1.3.7",void 0===v&&(window.DetectRTC={}),void 0===(r=window.MediaStream)&&"undefined"!=typeof webkitMediaStream&&(r=webkitMediaStream),v.MediaStream=void 0!==r&&"function"==typeof r&&Object.keys(r.prototype),v.MediaStreamTrack=void 0!==C&&Object.keys(C.prototype),y=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,v.RTCPeerConnection=void 0!==y&&Object.keys(y.prototype),window.DetectRTC=v,"function"==typeof define&&Ge(144)&&define("DetectRTC",[],function(){return v}),"undefined"!=typeof cordova&&(DetectRTC.isMobileDevice=!0,DetectRTC.browser.name="Chrome"),navigator&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Crosswalk")&&(DetectRTC.isMobileDevice=!0,DetectRTC.browser.name="Chrome"),window.addEventListener||(window.addEventListener=function(e,t,n){e.attachEvent&&e.attachEvent("on"+t,n)}),window.attachEventListener=function(e,t,n,o){e.addEventListener(t,n,o)},window.MediaStream);function _(e,t){return!(e.session.audio&&"two-way"===e.session.audio||("Firefox"!==DetectRTC.browser.name||!1===t)&&("Chrome"!==DetectRTC.browser.name||DetectRTC.browser.version<50||!0!==typeof t&&(void 0!==t||!e.session.audio||!e.session.screen||e.session.video)))}function le(e){return"Firefox"===DetectRTC.browser.name||"Chrome"===DetectRTC.browser.name&&{mandatory:{chromeMediaSource:e.mandatory.chromeMediaSource,chromeMediaSourceId:e.mandatory.chromeMediaSourceId}}}function S(e,t){return e&&e.getTracks?e.getTracks().filter(function(e){return e.kind===(t||"audio")}):[]}function de(){var e;"undefined"!=typeof cordova&&void 0!==cordova.plugins&&void 0!==cordova.plugins.iosrtc&&(e=cordova.plugins.iosrtc,window.webkitRTCPeerConnection=e.RTCPeerConnection,window.RTCSessionDescription=e.RTCSessionDescription,window.RTCIceCandidate=e.RTCIceCandidate,window.MediaStream=e.MediaStream,window.MediaStreamTrack=e.MediaStreamTrack,navigator.getUserMedia=navigator.webkitGetUserMedia=e.getUserMedia,e.debug.enable("iosrtc*"),"function"==typeof e.selectAudioOutput&&e.selectAudioOutput(window.iOSDefaultAudioOutputDevice||"speaker"),e.registerGlobals())}void 0===(w=void 0===w&&"undefined"!=typeof webkitMediaStream?webkitMediaStream:w)||"stop"in w.prototype||(w.prototype.stop=function(){this.getTracks().forEach(function(e){e.stop()})}),window.iOSDefaultAudioOutputDevice=window.iOSDefaultAudioOutputDevice||"speaker",document.addEventListener("deviceready",de,!1),de();var T,x={};function ue(e){return{OfferToReceiveAudio:!!e.OfferToReceiveAudio,OfferToReceiveVideo:!!e.OfferToReceiveVideo}}void 0!==window.RTCPeerConnection?T=window.RTCPeerConnection:"undefined"!=typeof mozRTCPeerConnection?T=mozRTCPeerConnection:"undefined"!=typeof webkitRTCPeerConnection&&(T=webkitRTCPeerConnection);var fe=window.RTCSessionDescription||window.mozRTCSessionDescription,pe=window.RTCIceCandidate||window.mozRTCIceCandidate,C=window.MediaStreamTrack;function he(n){if(void 0!==window.RTCPeerConnection?T=window.RTCPeerConnection:"undefined"!=typeof mozRTCPeerConnection?T=mozRTCPeerConnection:"undefined"!=typeof webkitRTCPeerConnection&&(T=webkitRTCPeerConnection),fe=window.RTCSessionDescription||window.mozRTCSessionDescription,pe=window.RTCIceCandidate||window.mozRTCIceCandidate,C=window.MediaStreamTrack,!T)throw"WebRTC 1.0 (RTCPeerConnection) API are NOT available in this browser.";var o=n.rtcMultiConnection,i=(this.extra=(n.remoteSdp||o).extra,this.userid=n.userid,this.streams=[],this.channels=n.channels||[],this.connectionDescription=n.connectionDescription,this.addStream=function(e){o.addStream(e,i.userid)},this.removeStream=function(e){o.removeStream(e,i.userid)},this);n.remoteSdp&&(this.connectionDescription=n.remoteSdp.connectionDescription);var a,r={},e=(x.sdpConstraints=ue({OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}),!!n.renegotiatingPeer),t=(n.remoteSdp&&(e=!!n.remoteSdp.renegotiatingPeer),[]);if(o.attachStreams.forEach(function(e){e&&t.push(e)}),e)a=n.peerRef;else{var s="all";!o.candidates.turn&&!o.candidates.relay||o.candidates.stun||o.candidates.reflexive||o.candidates.host||(s="relay");try{var c={iceServers:o.iceServers,iceTransportPolicy:o.iceTransportPolicy||s};void 0!==o.iceCandidatePoolSize&&(c.iceCandidatePoolSize=o.iceCandidatePoolSize),void 0!==o.bundlePolicy&&(c.bundlePolicy=o.bundlePolicy),void 0!==o.rtcpMuxPolicy&&(c.rtcpMuxPolicy=o.rtcpMuxPolicy),"Chrome"===DetectRTC.browser.name&&(c.sdpSemantics=o.sdpSemantics||"unified-plan"),o.iceServers&&o.iceServers.length||(c=null,o.optionalArgument=null),a=new T(c,o.optionalArgument)}catch(e){try{c={iceServers:o.iceServers},a=new T(c)}catch(e){a=new T}}}!a.getRemoteStreams&&a.getReceivers&&(a.getRemoteStreams=function(){var t=new w;return a.getReceivers().forEach(function(e){t.addTrack(e.track)}),[t]}),!a.getLocalStreams&&a.getSenders&&(a.getLocalStreams=function(){var t=new w;return a.getSenders().forEach(function(e){t.addTrack(e.track)}),[t]}),a.onicecandidate=function(e){e.candidate?o.trickleIce&&n.onLocalCandidate({candidate:e.candidate.candidate,sdpMid:e.candidate.sdpMid,sdpMLineIndex:e.candidate.sdpMLineIndex}):o.trickleIce||(e=a.localDescription,n.onLocalSdp({type:e.type,sdp:e.sdp,remotePeerSdpConstraints:n.remotePeerSdpConstraints||!1,renegotiatingPeer:!!n.renegotiatingPeer||!1,connectionDescription:i.connectionDescription,dontGetRemoteStream:!!n.dontGetRemoteStream,extra:o?o.extra:{},streamsToShare:u}))},t.forEach(function(t){n.remoteSdp&&n.remoteSdp.remotePeerSdpConstraints&&n.remoteSdp.remotePeerSdpConstraints.dontGetRemoteStream||n.dontAttachLocalStream||(t=o.beforeAddingStream(t,i))&&(a.getLocalStreams().forEach(function(e){t&&e.id==t.id&&(t=null)}),t&&t.getTracks&&t.getTracks().forEach(function(e){try{a.addTrack(e,t)}catch(e){}}))}),a.oniceconnectionstatechange=a.onsignalingstatechange=function(){var e=i.extra;o.peers[i.userid]&&(e=o.peers[i.userid].extra||e),a&&(n.onPeerStateChanged({iceConnectionState:a.iceConnectionState,iceGatheringState:a.iceGatheringState,signalingState:a.signalingState,extra:e,userid:i.userid}),a&&a.iceConnectionState&&-1!==a.iceConnectionState.search(/closed|failed/gi)&&i.streams instanceof Array&&i.streams.forEach(function(e){e=o.streamEvents[e.id]||{streamid:e.id,stream:e,type:"remote"};o.onstreamended(e)}))};var s={OfferToReceiveAudio:!!t.length,OfferToReceiveVideo:!!t.length},l=(n.localPeerSdpConstraints&&(s=n.localPeerSdpConstraints),x.sdpConstraints=ue(s),{}),c=(a.ontrack=function(t){var e;t&&"track"===t.type&&(t.stream=t.streams[t.streams.length-1],t.stream.id||(t.stream.id=t.track.id),l[t.stream.id]&&"Safari"!==DetectRTC.browser.name?t.track&&(t.track.onended=function(){a.onremovestream(t)}):(l[t.stream.id]=t.stream.id,e={},n.remoteSdp&&n.remoteSdp.streamsToShare?e=n.remoteSdp.streamsToShare:n.streamsToShare&&(e=n.streamsToShare),(e=e[t.stream.id])?(t.stream.isAudio=e.isAudio,t.stream.isVideo=e.isVideo,t.stream.isScreen=e.isScreen):(t.stream.isVideo=!!S(t.stream,"video").length,t.stream.isAudio=!t.stream.isVideo,t.stream.isScreen=!1),t.stream.streamid=t.stream.id,r[t.stream.id]=t.stream,n.onRemoteStream(t.stream),t.stream.getTracks().forEach(function(e){e.onended=function(){a.onremovestream(t)}}),t.stream.onremovetrack=function(){a.onremovestream(t)}))},a.onremovestream=function(e){e.stream.streamid=e.stream.id,r[e.stream.id]&&delete r[e.stream.id],n.onRemoteStreamRemoved(e.stream)},"function"!=typeof a.removeStream&&(a.removeStream=function(t){t.getTracks().forEach(function(e){a.removeTrack(e,t)})}),this.addRemoteCandidate=function(e){a.addIceCandidate(new pe(e))},this.addRemoteSdp=function(t,n){n=n||function(){},"Safari"!==DetectRTC.browser.name&&(t.sdp=o.processSdp(t.sdp)),a.setRemoteDescription(new fe(t)).then(n,function(e){o.enableLogs&&console.error("setRemoteDescription failed","\n",e,"\n",t.sdp),n()}).catch(function(e){o.enableLogs&&console.error("setRemoteDescription failed","\n",e,"\n",t.sdp),n()})},!0);function d(t){t.binaryType="arraybuffer",t.onmessage=function(e){n.onDataChannelMessage(e.data)},t.onopen=function(){n.onDataChannelOpened(t)},t.onerror=function(e){n.onDataChannelError(e)},t.onclose=function(e){n.onDataChannelClosed(e)},t.internalSend=t.send,t.send=function(e){"open"===t.readyState&&t.internalSend(e)},a.channel=t}n.remoteSdp&&(c=!1),this.createDataChannel=function(){d(a.createDataChannel("sctp",{}))},!0!==o.session.data||e||(c?this.createDataChannel():a.ondatachannel=function(e){d(e.channel)}),this.enableDisableVideoEncoding=function(e){var t,n;a.getSenders().forEach(function(e){t||"video"!==e.track.kind||(t=e)}),t&&t.getParameters&&((n=t.getParameters()).encodings[1]&&(n.encodings[1].active=!!e),n.encodings[2]&&(n.encodings[2].active=!!e),t.setParameters(n))},n.remoteSdp&&(n.remoteSdp.remotePeerSdpConstraints&&(s=n.remoteSdp.remotePeerSdpConstraints),x.sdpConstraints=ue(s),this.addRemoteSdp(n.remoteSdp,function(){f("createAnswer")})),"two-way"!=o.session.audio&&"two-way"!=o.session.video&&"two-way"!=o.session.screen||(x.sdpConstraints=ue({OfferToReceiveAudio:"two-way"==o.session.audio||n.remoteSdp&&n.remoteSdp.remotePeerSdpConstraints&&n.remoteSdp.remotePeerSdpConstraints.OfferToReceiveAudio,OfferToReceiveVideo:"two-way"==o.session.video||"two-way"==o.session.screen||n.remoteSdp&&n.remoteSdp.remotePeerSdpConstraints&&n.remoteSdp.remotePeerSdpConstraints.OfferToReceiveAudio}));var u={};function f(e){a[e](x.sdpConstraints).then(function(e){"Safari"!==DetectRTC.browser.name&&(e.sdp=o.processSdp(e.sdp)),a.setLocalDescription(e).then(function(){o.trickleIce&&(n.onLocalSdp({type:e.type,sdp:e.sdp,remotePeerSdpConstraints:n.remotePeerSdpConstraints||!1,renegotiatingPeer:!!n.renegotiatingPeer||!1,connectionDescription:i.connectionDescription,dontGetRemoteStream:!!n.dontGetRemoteStream,extra:o?o.extra:{},streamsToShare:u}),o.onSettingLocalDescription(i))},function(e){o.enableLogs&&console.error("setLocalDescription error",e)})},function(e){o.enableLogs&&console.error("sdp-error",e)})}a.getLocalStreams().forEach(function(e){u[e.streamid]={isAudio:!!e.isAudio,isVideo:!!e.isVideo,isScreen:!!e.isScreen}}),c&&f("createOffer"),a.nativeClose=a.close,a.close=function(){if(a){try{a.nativeClose!==a.close&&a.nativeClose()}catch(e){}a=null,i.peer=null}},this.peer=a}var E={removeVPX:function(e){var t=ve(e);return e=ge(e,"vp9",t,!0),ge(e,"vp8",t,!0)},disableNACK:function(e){if(e&&"string"==typeof e)return(e=(e=(e=e.replace("a=rtcp-fb:126 nack\r\n","")).replace("a=rtcp-fb:126 nack pli\r\n","a=rtcp-fb:126 pli\r\n")).replace("a=rtcp-fb:97 nack\r\n","")).replace("a=rtcp-fb:97 nack pli\r\n","a=rtcp-fb:97 pli\r\n");throw"Invalid arguments."},prioritize:function(o,e){if(e&&e.getSenders&&e.getSenders().length){if(!o||"string"!=typeof o)throw"Invalid arguments.";e.getSenders().forEach(function(e){for(var t=e.getParameters(),n=0;n<t.codecs.length;n++)if(t.codecs[n].mimeType==o){t.codecs.unshift(t.codecs.splice(n,1));break}e.setParameters(t)})}},removeNonG722:function(e){return e.replace(/m=audio ([0-9]+) RTP\/SAVPF ([0-9 ]*)/g,"m=audio $1 RTP/SAVPF 9")},setApplicationSpecificBandwidth:function(e,t,n){return e=e,n=n,!(t=t)||void 0!==Te&&Te||(n&&(t.screen?t.screen<300&&console.warn("It seems that you are using wrong bandwidth value for screen. Screen sharing is expected to fail."):console.warn("It seems that you are not using bandwidth for screen. Screen sharing is expected to fail.")),t.screen&&n&&(e=(e=e.replace(/b=AS([^\r\n]+\r\n)/g,"")).replace(/a=mid:video\r\n/g,"a=mid:video\r\nb=AS:"+t.screen+"\r\n")),(t.audio||t.video)&&(e=e.replace(/b=AS([^\r\n]+\r\n)/g,"")),t.audio&&(e=e.replace(/a=mid:audio\r\n/g,"a=mid:audio\r\nb=AS:"+t.audio+"\r\n")),t.screen?e=e.replace(/a=mid:video\r\n/g,"a=mid:video\r\nb=AS:"+t.screen+"\r\n"):t.video&&(e=e.replace(/a=mid:video\r\n/g,"a=mid:video\r\nb=AS:"+t.video+"\r\n"))),e},setVideoBitrates:function(e,t){var n,o,i=void 0,t=(i=t||{}).min,i=i.max,a=e.split("\r\n"),r=A(a,"a=rtpmap","VP8/90000");return(n=r?ye(a[r]):n)?((r=A(a,"a=rtpmap","rtx/90000"))&&(o=ye(a[r])),r&&null!==(r=A(a,"a=fmtp:"+o.toString()))&&(o="\r\n",a[r]=a[r].concat(o+="a=fmtp:"+n+" x-google-min-bitrate="+(t||"228")+"; x-google-max-bitrate="+(i||"228")),e=a.join("\r\n")),e):e},setOpusAttributes:function(e,t){var n=void 0,t=(n=t||{},e.split("\r\n")),o=A(t,"a=rtpmap","opus/48000");if(!(i=o?ye(t[o]):i))return e;if(null===(o=A(t,"a=fmtp:"+i.toString())))return e;var i="",i=(i+="; stereo="+(void 0!==n.stereo?n.stereo:"1"))+("; sprop-stereo="+(void 0!==n["sprop-stereo"]?n["sprop-stereo"]:"1"));return void 0!==n.maxaveragebitrate&&(i+="; maxaveragebitrate="+(n.maxaveragebitrate||1048576)),void 0!==n.maxplaybackrate&&(i+="; maxplaybackrate="+(n.maxplaybackrate||1048576)),void 0!==n.cbr&&(i+="; cbr="+(void 0!==n.cbr?n.cbr:"1")),void 0!==n.useinbandfec&&(i+="; useinbandfec="+n.useinbandfec),void 0!==n.usedtx&&(i+="; usedtx="+n.usedtx),void 0!==n.maxptime&&(i+="\r\na=maxptime:"+n.maxptime),t[o]=t[o].concat(i),t.join("\r\n")},preferVP9:function(e){return me(e,"vp9")},preferCodec:me,forceStereoAudio:function(e){for(var t=e.split("\r\n"),n=null,o=0;o<t.length;o++)if(-1!==t[o].search("opus/48000")){var i=extractSdp(t[o],/:(\d+) opus\/48000/i);break}for(o=0;o<t.length;o++)if(-1!==t[o].search("a=fmtp")&&extractSdp(t[o],/a=fmtp:(\d+)/)===i){n=o;break}return null===n?e:(t[n]=t[n].concat("; stereo=1; sprop-stereo=1"),t.join("\r\n"))}};function me(e,t){var n=ve(e);return!n.videoCodecNumbers||"vp8"===t&&n.vp8LineNumber===n.videoCodecNumbers[0]||"vp9"===t&&n.vp9LineNumber===n.videoCodecNumbers[0]||"h264"===t&&n.h264LineNumber===n.videoCodecNumbers[0]?e:ge(e,t,n)}function ge(e,t,n,o){var i="";if("vp8"===t){if(!n.vp8LineNumber)return e;i=n.vp8LineNumber}if("vp9"===t){if(!n.vp9LineNumber)return e;i=n.vp9LineNumber}if("h264"===t){if(!n.h264LineNumber)return e;i=n.h264LineNumber}var t=n.videoCodecNumbersOriginal.split("SAVPF")[0]+"SAVPF ",a=o?[]:[i];return n.videoCodecNumbers.forEach(function(e){e!==i&&a.push(e)}),t+=a.join(" "),e.replace(n.videoCodecNumbersOriginal,t)}function ve(e){var n={};return e.split("\n").forEach(function(t){0===t.indexOf("m=video")&&(n.videoCodecNumbers=[],t.split("SAVPF")[1].split(" ").forEach(function(e){(e=e.trim())&&e.length&&(n.videoCodecNumbers.push(e),n.videoCodecNumbersOriginal=t)})),-1===t.indexOf("VP8/90000")||n.vp8LineNumber||(n.vp8LineNumber=t.replace("a=rtpmap:","").split(" ")[0]),-1===t.indexOf("VP9/90000")||n.vp9LineNumber||(n.vp9LineNumber=t.replace("a=rtpmap:","").split(" ")[0]),-1===t.indexOf("H264/90000")||n.h264LineNumber||(n.h264LineNumber=t.replace("a=rtpmap:","").split(" ")[0])}),n}function A(e,t,n){for(var o=e,i=t,a=n,r=o.length,s=0;s<r;++s)if(0===o[s].indexOf(i)&&(!a||-1!==o[s].toLowerCase().indexOf(a.toLowerCase())))return s;return null}function ye(e){var t=new RegExp("a=rtpmap:(d+) w+/d+"),e=e.match(t);return e&&2===e.length?e[1]:null}window.BandwidthHandler=E;var be={processCandidates:function(e,t){var n=t.candidate,o=e.candidates,i=o.stun,a=o.turn;if(q(o.reflexive)||(i=o.reflexive),q(o.relay)||(a=o.relay),(o.host||!n.match(/typ host/g))&&(a||!n.match(/typ relay/g))&&(i||!n.match(/typ srflx/g))){o=e.iceProtocols;if((o.udp||!n.match(/ udp /g))&&(o.tcp||!n.match(/ tcp /g)))return e.enableLogs&&console.debug("Your candidate pairs:",n),{candidate:n,sdpMid:t.sdpMid,sdpMLineIndex:t.sdpMLineIndex}}}},l=function(e){return[{urls:["stun:webrtcweb.com:7788"],username:"muazkh",credential:"muazkh"},{urls:["turn:webrtcweb.com:7788","turn:webrtcweb.com:8877","turn:webrtcweb.com:4455"],username:"muazkh",credential:"muazkh"},{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302","stun:stun.l.google.com:19302?transport=udp"]}]};function we(i){if(!0!==currentUserMediaRequest.mutex){currentUserMediaRequest.mutex=!0;var t,n,o,a=JSON.stringify(i.localMediaConstraints);if(currentUserMediaRequest.streams[a])r(currentUserMediaRequest.streams[a].stream,!0);else{if(/BB10|BlackBerry/i.test(navigator.userAgent||"")||void 0===navigator.mediaDevices||"function"!=typeof navigator.mediaDevices.getUserMedia)return navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia,void navigator.getUserMedia(i.localMediaConstraints,function(e){e.streamid=e.streamid||e.id||f(),e.idInstance=a,r(e)},function(e){i.onLocalMediaError(e,i.localMediaConstraints)});void 0===navigator.mediaDevices&&(navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia,o=function(){},navigator.mediaDevices={getUserMedia:function(e){return navigator.getUserMedia(e,function(e){e(stream),t=stream},function(e){o(e),n=e}),{then:function(e){if(!t)return{then:function(e){n?e(n):o=e}};e(t)}}}}),navigator.mediaDevices.getUserMedia(i.localMediaConstraints).then(function(e){e.streamid=e.streamid||e.id||f(),e.idInstance=a,r(e)}).catch(function(e){i.onLocalMediaError(e,i.localMediaConstraints)})}}else currentUserMediaRequest.queueRequests.push(i);function r(e,t){o=i.localMediaConstraints,n=e,o.mandatory&&o.mandatory.chromeMediaSource||o.mozMediaSource||o.mediaSource?n.isScreen=!0:o.video?n.isVideo=!0:o.audio&&(n.isAudio=!0);var n,o="ended";"oninactive"in e&&(o="inactive"),e.addEventListener(o,function(){delete currentUserMediaRequest.streams[a],currentUserMediaRequest.mutex=!1,currentUserMediaRequest.queueRequests.indexOf(i)&&(delete currentUserMediaRequest.queueRequests[currentUserMediaRequest.queueRequests.indexOf(i)],currentUserMediaRequest.queueRequests=V(currentUserMediaRequest.queueRequests))},!1),currentUserMediaRequest.streams[a]={stream:e},currentUserMediaRequest.mutex=!1,currentUserMediaRequest.queueRequests.length&&we(currentUserMediaRequest.queueRequests.shift()),i.onGettingLocalMedia(e,t)}}window.currentUserMediaRequest={streams:[],mutex:!1,queueRequests:[],remove:function(e){this.mutex=!1;var t=this.streams[e];t&&(t=t.stream.currentUserMediaRequestOptions,this.queueRequests.indexOf(t)&&(delete this.queueRequests[this.queueRequests.indexOf(t)],this.queueRequests=V(this.queueRequests)),this.streams[e].stream=null,delete this.streams[e])}};var M={setHandlers:function(o,i,a){var e;o&&o.addEventListener&&(void 0!==i&&1!=i||(e="ended","oninactive"in o&&(e="inactive"),o.addEventListener(e,function(){M.onSyncNeeded(this.streamid,e)},!1)),o.mute=function(e,t){e=_e(e),void 0!==t&&(i=t),void 0!==e&&"audio"!=e||S(o,"audio").forEach(function(e){e.enabled=!1,a.streamEvents[o.streamid].isAudioMuted=!0}),void 0!==e&&"video"!=e||S(o,"video").forEach(function(e){e.enabled=!1}),void 0!==i&&1!=i||M.onSyncNeeded(o.streamid,"mute",e),a.streamEvents[o.streamid].muteType=e||"both",U(o,"mute",e)},o.unmute=function(e,t){var n;e=_e(e),void 0!==t&&(i=t),a.streamEvents[o.streamid].mediaElement&&((n=a.streamEvents[o.streamid].mediaElement).volume=0,function e(t,n,o,i){n<=(i=(i||0)+1)||setTimeout(function(){o(),e(t,n,o,i)},t)}(200,5,function(){try{n.volume+=.2}catch(e){n.volume=1}})),void 0!==e&&"audio"!=e||S(o,"audio").forEach(function(e){e.enabled=!0,a.streamEvents[o.streamid].isAudioMuted=!1}),void 0!==e&&"video"!=e||(S(o,"video").forEach(function(e){e.enabled=!0}),void 0!==e&&"video"==e&&a.streamEvents[o.streamid].isAudioMuted&&function e(t){t=t||0,++t<100&&a.streamEvents[o.streamid].isAudioMuted&&(o.mute("audio"),setTimeout(function(){e(t)},50))}()),void 0!==i&&1!=i||M.onSyncNeeded(o.streamid,"unmute",e),a.streamEvents[o.streamid].unmuteType=e||"both",U(o,"unmute",e)})},onSyncNeeded:function(e,t,n){}};function _e(e){if(e)return"string"==typeof e||void 0===e?e:e.audio&&e.video?null:e.audio?"audio":e.video?"video":void 0}window.addEventListener("message",function(e){if(e.origin==window.location.origin){e=e.data;if("PermissionDeniedError"==e){if(R="PermissionDeniedError",O)return void O("PermissionDeniedError");throw new Error("PermissionDeniedError")}"rtcmulticonnection-extension-loaded"==e&&(R="desktop"),e.sourceId&&O&&O(k=e.sourceId,!0===e.canRequestAudioTrack)}});var k,O,R="screen";function Se(e){if(e){if("desktop"==R)return e(!0);window.postMessage("are-you-there","*"),setTimeout(function(){e("screen"!=R)},2e3)}}var Te=void 0!==window.InstallTrigger;window.opera||navigator.userAgent.indexOf(" OPR/");function xe(e,t){if(Te)return t("not-chrome");2!=arguments.length&&(t=e,e="ajhifddimkapgcifgcodmmfdlknahffk");var n=document.createElement("img");n.src="chrome-extension://"+e+"/icon.png",n.onload=function(){R="screen",window.postMessage("are-you-there","*"),setTimeout(function(){t("screen"==R?"installed-disabled":"installed-enabled")},2e3)},n.onerror=function(){t("not-installed")}}function Ce(r){var s={};return{receive:function(e,t,n){var o,i,a=e.uuid;s[a]||(s[a]=[]),s[a].push(e.message),e.last&&(o=s[a].join(""),i={data:o=e.isobject?JSON.parse(o):o,userid:t,extra:n,latency:(new Date).getTime()-e.sendingTime},r.autoTranslateText?(i.original=i.data,r.Translator.TranslateText(i.data,function(e){i.data=e,r.onmessage(i)})):r.onmessage(i),delete s[a])}}}window.chrome;var P,I,Ee,N,Ae,Me={send:function(e){var i=e.connection,a=e.channel,r=e.remoteUserId,e=e.text,s=i.chunkSize||1e3,c="",l=!1,d=("string"!=typeof e&&(l=!0,e=JSON.stringify(e)),f()),u=(new Date).getTime();!function e(t,n){var o={type:"text",uuid:d,sendingTime:u};t&&(n=t,o.packets=parseInt(n.length/s)),n.length>s?o.message=n.slice(0,s):(o.message=n,o.last=!0,o.isobject=l),a.send(o,r),(c=n.slice(o.message.length)).length&&setTimeout(function(){e(null,c)},i.chunkInterval||100)}(e)}},a={handle:function(n){var o={};n.onFileStart=function(e){var t=document.createElement("div");if(t.title=e.name,t.innerHTML="<label>0%</label> <progress></progress>",e.remoteUserId&&(t.innerHTML+=" (Sharing with:"+e.remoteUserId+")"),n.filesContainer||(n.filesContainer=document.body||document.documentElement),n.filesContainer.insertBefore(t,n.filesContainer.firstChild),!e.remoteUserId)return o[e.uuid]={div:t,progress:t.querySelector("progress"),label:t.querySelector("label")},void(o[e.uuid].progress.max=e.maxChunks);o[e.uuid]||(o[e.uuid]={}),o[e.uuid][e.remoteUserId]={div:t,progress:t.querySelector("progress"),label:t.querySelector("label")},o[e.uuid][e.remoteUserId].progress.max=e.maxChunks},n.onFileProgress=function(e){var t=o[e.uuid];!t||e.remoteUserId&&!(t=o[e.uuid][e.remoteUserId])||(t.progress.value=e.currentPosition||e.maxChunks||t.progress.max,e=t.progress,t=t.label,-1!==e.position&&(e=+e.position.toFixed(2).split(".")[1]||100,t.innerHTML=e+"%"))},n.onFileEnd=function(e){var t=o[e.uuid];t?e.remoteUserId&&!(t=o[e.uuid][e.remoteUserId])||(t=t.div,-1!=e.type.indexOf("image")?t.innerHTML='<a href="'+e.url+'" download="'+e.name+'">Download <strong style="color:red;">'+e.name+'</strong> </a><br /><img src="'+e.url+'" title="'+e.name+'" style="max-width: 80%;">':t.innerHTML='<a href="'+e.url+'" download="'+e.name+'">Download <strong style="color:red;">'+e.name+'</strong> </a><br /><iframe src="'+e.url+'" title="'+e.name+'" style="width: 80%;border: 0;height: inherit;margin-top:1em;"></iframe>'):console.error("No such progress-helper element exist.",e)}}},t={handle:function(i){i.autoTranslateText=!1,i.language="en",i.googKey="AIzaSyCgB5hmFY74WYB-EoWkhr9cAGr6TiTHrEE",i.Translator={TranslateText:function(e,t){var n=document.createElement("script"),e=(n.type="text/javascript",encodeURIComponent(e)),o="method"+i.token(),o=(window[o]=function(e){e.data&&e.data.translations[0]&&t?t(e.data.translations[0].translatedText):e.error&&"Daily Limit Exceeded"===e.error.message?console.error('Text translation failed. Error message: "Daily Limit Exceeded."'):e.error?console.error(e.error.message):console.error(e)},"https://www.googleapis.com/language/translate/v2?key="+i.googKey+"&target="+(i.language||"en-US")+"&callback=window."+o+"&q="+e);n.src=o,document.getElementsByTagName("head")[0].appendChild(n)},getListOfLanguages:function(t){var n=new XMLHttpRequest,e=(n.onreadystatechange=function(){var e;n.readyState==XMLHttpRequest.DONE&&((e=JSON.parse(n.responseText))&&e.data&&e.data.languages?t(e.data.languages):e.error&&"Daily Limit Exceeded"===e.error.message?console.error('Text translation failed. Error message: "Daily Limit Exceeded."'):e.error?console.error(e.error.message):console.error(e))},"https://www.googleapis.com/language/translate/v2/languages?key="+i.googKey+"&target=en");n.open("GET",e,!0),n.send(null)}}}};function L(t){if(P.socketAutoReConnect=!0,P.socket)t&&t(P.socket);else{if(void 0===n)if("undefined"!=typeof FirebaseConnection)window.SocketConnection=FirebaseConnection;else{if("undefined"==typeof PubNubConnection)throw"SocketConnection.js seems missed.";window.SocketConnection=PubNubConnection}new n(P,function(e){t&&t(P.socket)})}}function ke(n,o){P.socket.emit("join-room",{sessionid:P.sessionid,session:P.session,mediaConstraints:P.mediaConstraints,sdpConstraints:P.sdpConstraints,streams:Re(),extra:P.extra,password:void 0!==P.password&&"object"!==ze(P.password)?P.password:""},function(e,t){if(!0===e){if(P.enableLogs&&console.log("isRoomJoined: ",e," roomid: ",P.sessionid),P.peers[P.sessionid])return;I.onNegotiationNeeded(n)}!1===e&&P.enableLogs&&console.warn("isRoomJoined: ",t," roomid: ",P.sessionid),o(e,P.sessionid,t)})}function Oe(n){P.enableLogs&&console.log("Sending open-room signal to socket.io"),P.waitingForLocalMedia=!1,P.socket.emit("open-room",{sessionid:P.sessionid,session:P.session,mediaConstraints:P.mediaConstraints,sdpConstraints:P.sdpConstraints,streams:Re(),extra:P.extra,identifier:P.publicRoomIdentifier,password:void 0!==P.password&&"object"!==ze(P.password)?P.password:""},function(e,t){!0===e&&(P.enableLogs&&console.log("isRoomOpened: ",e," roomid: ",P.sessionid),n(e,P.sessionid)),!1===e&&(P.enableLogs&&console.warn("isRoomOpened: ",t," roomid: ",P.sessionid),n(e,P.sessionid,t))})}function Re(){try{return P.streamEvents.selectAll("local").map(function(e){return{streamid:e.streamid,tracks:e.stream.getTracks().length}})}catch(e){return[]}}function Pe(e,n){var t,o;P.dontCaptureUserMedia||e.isDataOnly?n():(t={},e.localPeerSdpConstraints.OfferToReceiveAudio&&(t.audio=P.mediaConstraints.audio),e.localPeerSdpConstraints.OfferToReceiveVideo&&(t.video=P.mediaConstraints.video),(o=e.session||P.session).oneway&&"two-way"!==o.audio&&"two-way"!==o.video&&"two-way"!==o.screen?n():((o=o.oneway&&o.audio&&"two-way"===o.audio?{audio:!0}:o).audio||o.video||o.screen)&&(o.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:_(P)}).then(function(e){e.isScreen=!0,I.onGettingLocalMedia(e),!o.audio&&!o.video||_(P)?n(e):P.invokeGetUserMedia(null,n)},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){P.invokeGetUserMedia({audio:!!_(P)&&le(t),video:t,isScreen:!0},!o.audio&&!o.video||_(P)?n:P.invokeGetUserMedia(null,n))}):(o.audio||o.video)&&P.invokeGetUserMedia(null,n,o)))}function Ie(e,t){e?(t.audio&&S(e,"audio").forEach(function(e){e.applyConstraints(t.audio)}),t.video&&S(e,"video").forEach(function(e){e.applyConstraints(t.video)})):P.enableLogs&&console.error("No stream to applyConstraints.")}function Ne(t,e,n){e?I.replaceTrack(t,e,n):P.peers.getAllParticipants().forEach(function(e){I.replaceTrack(t,e,n)})}B=B||{useDefaultDevices:!0},(P=this).channel=P.sessionid=(D||location.href.replace(/\/|:|#|\?|\$|\^|%|\.|`|~|!|\+|@|\[|\||]|\|*. /g,"").split("\n").join("").split("\r").join(""))+"",I=new z(P),Ee={},I.onGettingLocalMedia=function(t,i){if(i=i||function(){},Ee[t.streamid])i();else{Ee[t.streamid]=!0;try{t.type="local"}catch(e){}P.setStreamEndHandler(t),j(t,function(e){e.id=t.streamid,e.muted=!0,e.volume=0,-1===P.attachStreams.indexOf(t)&&P.attachStreams.push(t),void 0!==M&&M.setHandlers(t,!0,P),P.streamEvents[t.streamid]={stream:t,type:"local",mediaElement:e,userid:P.userid,extra:P.extra,streamid:t.streamid,isAudioMuted:!0};try{var n=P,o=P.streamEvents[t.streamid];if(o.stream&&S(o.stream,"audio").length){if(!n||!o)throw"Both arguments are required.";if(n.onspeaking&&n.onsilence){if("undefined"==typeof hark)throw"hark.js not found.";hark(o.stream,{onspeaking:function(){n.onspeaking(o)},onsilence:function(){n.onsilence(o)},onvolumechange:function(e,t){n.onvolumechange&&n.onvolumechange(je({volume:e,threshold:t},o))}})}}F(P,P.streamEvents[t.streamid]),P.onstream(P.streamEvents[t.streamid])}catch(e){}i()},P)}},I.onGettingRemoteMedia=function(t,n){try{t.type="remote"}catch(e){}P.setStreamEndHandler(t,"remote-stream"),j(t,function(e){e.id=t.streamid,void 0!==M&&M.setHandlers(t,!1,P),P.streamEvents[t.streamid]={stream:t,type:"remote",userid:n,extra:P.peers[n]?P.peers[n].extra:{},mediaElement:e,streamid:t.streamid},F(P,P.streamEvents[t.streamid]),P.onstream(P.streamEvents[t.streamid])},P)},I.onRemovingRemoteMedia=function(e,t){var n=(n=P.streamEvents[e.streamid])||{stream:e,type:"remote",userid:t,extra:P.peers[t]?P.peers[t].extra:{},streamid:e.streamid,mediaElement:P.streamEvents[e.streamid]?P.streamEvents[e.streamid].mediaElement:null};P.peersBackup[n.userid]&&(n.extra=P.peersBackup[n.userid].extra),P.onstreamended(n),delete P.streamEvents[e.streamid]},I.onNegotiationNeeded=function(e,t,n){n=n||function(){};var o={remoteUserId:t=t||e.remoteUserId,message:e=e||"",sender:P.userid};e.remoteUserId&&e.message&&e.sender&&(o=e),L(function(){P.socket.emit(P.socketMessageEvent,o,n)})},I.onUserLeft=function(e){P.deletePeer(e)},I.disconnectWith=function(e,t){P.socket&&P.socket.emit("disconnect-with",e,t||function(){}),P.deletePeer(e)},P.socketOptions={transport:"polling"},P.openOrJoin=function(e,r){r=r||function(){},P.checkPresence(e,function(e,t){var n,o,i,a;e?(P.sessionid=t,e=!!P.session.oneway,n=c(P.session),o={OfferToReceiveAudio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:P.sdpConstraints.mandatory.OfferToReceiveVideo},i={OfferToReceiveAudio:e?!!P.session.audio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:e?!!P.session.video||!!P.session.screen:P.sdpConstraints.mandatory.OfferToReceiveVideo},Pe((a={remoteUserId:P.sessionid,message:{newParticipationRequest:!0,isOneWay:e,isDataOnly:n,localPeerSdpConstraints:i,remotePeerSdpConstraints:o},sender:P.userid}).message,function(){ke(a,r)})):(P.waitingForLocalMedia=!0,P.isInitiator=!0,P.sessionid=t||P.sessionid,c(P.session)?Oe(r):P.captureUserMedia(function(){Oe(r)}))})},P.waitingForLocalMedia=!1,P.open=function(e,t){t=t||function(){},P.waitingForLocalMedia=!0,P.isInitiator=!0,P.sessionid=e||P.sessionid,L(function(){c(P.session)?Oe(t):P.captureUserMedia(function(){Oe(t)})})},P.peersBackup={},P.deletePeer=function(e){if(e&&P.peers[e]){var t={userid:e,extra:P.peers[e]?P.peers[e].extra:{}};if(P.peersBackup[t.userid]&&(t.extra=P.peersBackup[t.userid].extra),P.onleave(t),P.peers[e]){P.peers[e].streams.forEach(function(e){e.stop()});t=P.peers[e].peer;if(t&&"closed"!==t.iceConnectionState)try{t.close()}catch(e){}P.peers[e]&&(P.peers[e].peer=null,delete P.peers[e])}}},P.rejoin=function(e){var t;!P.isInitiator&&e&&Object.keys(e).length&&(t={},P.peers[e.remoteUserId]&&(t=P.peers[e.remoteUserId].extra,P.deletePeer(e.remoteUserId)),e&&e.remoteUserId&&(P.join(e.remoteUserId),P.onReConnecting({userid:e.remoteUserId,extra:t})))},P.join=function(e,t){P.sessionid=!!e&&(e.sessionid||e.remoteUserId||e)||P.sessionid,P.sessionid+="";var n=!1,o=!1,i=!1,a=!1,r=((e&&e.session||!e||"string"==typeof e)&&(i=!!(e=e&&e.session||P.session).oneway,a=c(e),o={OfferToReceiveAudio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:P.sdpConstraints.mandatory.OfferToReceiveVideo},n={OfferToReceiveAudio:i?!!P.session.audio:P.sdpConstraints.mandatory.OfferToReceiveAudio,OfferToReceiveVideo:i?!!P.session.video||!!P.session.screen:P.sdpConstraints.mandatory.OfferToReceiveVideo}),function(){}),s=("function"==typeof(t=t||{})&&(r=t,t={}),void 0!==t.localPeerSdpConstraints&&(n=t.localPeerSdpConstraints),void 0!==t.remotePeerSdpConstraints&&(o=t.remotePeerSdpConstraints),void 0!==t.isOneWay&&(i=t.isOneWay),void 0!==t.isDataOnly&&(a=t.isDataOnly),{remoteUserId:P.sessionid,message:{newParticipationRequest:!0,isOneWay:i,isDataOnly:a,localPeerSdpConstraints:n,remotePeerSdpConstraints:o},sender:P.userid});return Pe(s.message,function(){L(function(){ke(s,r)})}),s},P.publicRoomIdentifier="",P.getUserMedia=P.captureUserMedia=function(o,i){o=o||function(){};var a=i||P.session;P.dontCaptureUserMedia||c(a)?o():(a.audio||a.video||a.screen)&&(a.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:_(P)}).then(function(e){if(e.isScreen=!0,I.onGettingLocalMedia(e),!a.audio&&!a.video||_(P))o(e);else{var t,n={};for(t in a)"screen"!==t&&(n[t]=a[t]);P.invokeGetUserMedia(i,o,n)}},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){if(e)throw e;P.invokeGetUserMedia({audio:!!_(P)&&le(t),video:t,isScreen:!0},function(e){if(!a.audio&&!a.video||_(P))o(e);else{var t,n={};for(t in a)"screen"!==t&&(n[t]=a[t]);P.invokeGetUserMedia(i,o,n)}})}):(a.audio||a.video)&&P.invokeGetUserMedia(i,o,a))},P.onbeforeunload=function(e,t){P.closeBeforeUnload&&(P.peers.getAllParticipants().forEach(function(e){I.onNegotiationNeeded({userLeft:!0},e),P.peers[e]&&P.peers[e].peer&&P.peers[e].peer.close(),delete P.peers[e]}),t||P.closeSocket(),P.isInitiator=!1)},window.ignoreBeforeUnload?P.closeBeforeUnload=!1:(P.closeBeforeUnload=!0,window.addEventListener("beforeunload",P.onbeforeunload,!1)),P.userid=f(),P.changeUserId=function(e,t){t=t||function(){},P.userid=e||f(),P.socket.emit("changed-uuid",P.userid,t)},P.extra={},P.attachStreams=[],P.session={audio:!0,video:!0},P.enableFileSharing=!1,P.bandwidth={screen:!1,audio:!1,video:!1},P.codecs={audio:"opus",video:"VP9"},P.processSdp=function(e){return function(){var t=!1;try{if("undefined"==typeof RTCRtpTransceiver)return;if(!("currentDirection"in RTCRtpTransceiver.prototype))return;var e=new T;try{e.addTransceiver("audio"),t=!0}catch(e){}e.close()}catch(e){t=!1}return t&&function(){var t=!1;try{var e=new T({sdpSemantics:"unified-plan"});try{var n=e.getConfiguration(),t="unified-plan"==n.sdpSemantics||(n.sdpSemantics,!1)}catch(e){t=!1}}catch(e){t=!1}return t}()}()||"Safari"!==DetectRTC.browser.name&&("VP8"===P.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"vp8")),"VP9"===P.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"vp9")),"H264"===P.codecs.video.toUpperCase()&&(e=E.preferCodec(e,"h264")),"G722"===P.codecs.audio&&(e=E.removeNonG722(e)),"Firefox"!==DetectRTC.browser.name&&((P.bandwidth.video||P.bandwidth.screen)&&(e=E.setApplicationSpecificBandwidth(e,P.bandwidth,!!P.session.screen)),P.bandwidth.video&&(e=E.setVideoBitrates(e,{min:8*P.bandwidth.video*1024,max:8*P.bandwidth.video*1024})),P.bandwidth.audio&&(e=E.setOpusAttributes(e,{maxaveragebitrate:8*P.bandwidth.audio*1024,maxplaybackrate:8*P.bandwidth.audio*1024,stereo:1,maxptime:3})))),e},void 0!==E&&(P.BandwidthHandler=P.CodecsHandler=E),P.mediaConstraints={audio:{mandatory:{},optional:P.bandwidth.audio?[{bandwidth:8*P.bandwidth.audio*1024||1048576}]:[]},video:{mandatory:{},optional:P.bandwidth.video?[{bandwidth:8*P.bandwidth.video*1024||1048576},{facingMode:"user"}]:[{facingMode:"user"}]}},"Firefox"===DetectRTC.browser.name&&(P.mediaConstraints={audio:!0,video:!0}),B.useDefaultDevices||DetectRTC.isMobileDevice||DetectRTC.load(function(){var t,n;if(DetectRTC.MediaDevices.forEach(function(e){"audioinput"===e.kind&&!1!==P.mediaConstraints.audio&&(t=e),"videoinput"===e.kind&&!1!==P.mediaConstraints.video&&(n=e)}),t){if("Firefox"===DetectRTC.browser.name)return void(!0!==P.mediaConstraints.audio?P.mediaConstraints.audio.deviceId=t.id:P.mediaConstraints.audio={deviceId:t.id});1==P.mediaConstraints.audio&&(P.mediaConstraints.audio={mandatory:{},optional:[]}),P.mediaConstraints.audio.optional||(P.mediaConstraints.audio.optional=[]);var e=[{sourceId:t.id}];P.mediaConstraints.audio.optional=e.concat(P.mediaConstraints.audio.optional)}n&&("Firefox"===DetectRTC.browser.name?!0!==P.mediaConstraints.video?P.mediaConstraints.video.deviceId=n.id:P.mediaConstraints.video={deviceId:n.id}:(1==P.mediaConstraints.video&&(P.mediaConstraints.video={mandatory:{},optional:[]}),P.mediaConstraints.video.optional||(P.mediaConstraints.video.optional=[]),e=[{sourceId:n.id}],P.mediaConstraints.video.optional=e.concat(P.mediaConstraints.video.optional)))}),P.sdpConstraints={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0},optional:[{VoiceActivityDetection:!1}]},P.sdpSemantics=null,P.iceCandidatePoolSize=null,P.bundlePolicy=null,P.rtcpMuxPolicy=null,P.iceTransportPolicy=null,P.optionalArgument={optional:[{DtlsSrtpKeyAgreement:!0},{googImprovedWifiBwe:!0},{googScreencastMinBitrate:300},{googIPv6:!0},{googDscp:!0},{googCpuUnderuseThreshold:55},{googCpuOveruseThreshold:85},{googSuspendBelowMinBitrate:!0},{googCpuOveruseDetection:!0}],mandatory:{}},P.iceServers=l(P),P.candidates={host:!0,stun:!0,turn:!0},P.iceProtocols={tcp:!0,udp:!0},P.onopen=function(e){P.enableLogs&&console.info("Data connection has been opened between you & ",e.userid)},P.onclose=function(e){P.enableLogs&&console.warn("Data connection has been closed between you & ",e.userid)},P.onerror=function(e){P.enableLogs&&console.error(e.userid,"data-error",e)},P.onmessage=function(e){P.enableLogs&&console.debug("data-message",e.userid,e.data)},P.send=function(e,t){P.peers.send(e,t)},P.close=P.disconnect=P.leave=function(){P.onbeforeunload(!1,!0)},P.closeEntireSession=function(t){t=t||function(){},P.socket.emit("close-entire-session",function e(){P.getAllParticipants().length?setTimeout(e,100):(P.onEntireSessionClosed({sessionid:P.sessionid,userid:P.userid,extra:P.extra}),P.changeUserId(null,function(){P.close(),t()}))})},P.onEntireSessionClosed=function(e){P.enableLogs&&console.info("Entire session is closed: ",e.sessionid,e.extra)},P.onstream=function(e){var t=P.videosContainer,t=(t.insertBefore(e.mediaElement,t.firstChild),e.mediaElement.play());void 0===t?setTimeout(function(){e.mediaElement.play()},2e3):t.catch(function(){}).then(function(){setTimeout(function(){e.mediaElement.play()},2e3)})},P.onstreamended=function(e){e.mediaElement||(e.mediaElement=document.getElementById(e.streamid)),e.mediaElement&&e.mediaElement.parentNode&&e.mediaElement.parentNode.removeChild(e.mediaElement)},P.direction="many-to-many",P.removeStream=function(t,n){var o;P.attachStreams.forEach(function(e){e.id===t&&(o=e)}),o?(P.peers.getAllParticipants().forEach(function(e){if(!n||e===n){e=P.peers[e];try{e.peer.removeStream(o)}catch(e){}}}),P.renegotiate()):console.warn("No such stream exist.",t)},P.addStream=function(n,t){if(n.getTracks)return-1===P.attachStreams.indexOf(n)&&(n.streamid||(n.streamid=n.id),P.attachStreams.push(n)),void P.renegotiate(t);function o(e){n.streamCallback&&n.streamCallback(e),P.renegotiate(t)}c(n)?P.renegotiate(t):(n.audio||n.video||n.screen)&&(n.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:_(P)}).then(function(e){e.isScreen=!0,I.onGettingLocalMedia(e),!n.audio&&!n.video||_(P)?o(e):P.invokeGetUserMedia(null,function(e){o(e)})},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){if(e)return"PermissionDeniedError"===e?(n.streamCallback&&n.streamCallback(null),void(P.enableLogs&&console.error("User rejected to share his screen."))):alert(e);P.invokeGetUserMedia({audio:!!_(P)&&le(t),video:t,isScreen:!0},function(e){!n.audio&&!n.video||_(P)?o(e):P.invokeGetUserMedia(null,function(e){o(e)})})}):(n.audio||n.video)&&P.invokeGetUserMedia(null,o))},P.invokeGetUserMedia=function(n,o,e){e=e||P.session,we({onGettingLocalMedia:function(e){var t=n.video;t&&(t.mediaSource||t.mozMediaSource||t.mandatory&&t.mandatory.chromeMediaSource)&&(e.isScreen=!0),e.isScreen||(e.isVideo=!!S(e,"video").length,e.isAudio=!e.isVideo&&S(e,"audio").length),I.onGettingLocalMedia(e,function(){"function"==typeof o&&o(e)})},onLocalMediaError:function(e,t){I.onLocalMediaError(e,t)},localMediaConstraints:(n=n||P.mediaConstraints)||{audio:!!e.audio&&n.audio,video:!!e.video&&n.video}})},P.applyConstraints=function(t,e){var n;C&&C.prototype.applyConstraints?e?Ie(n=P.streamEvents[e]?P.streamEvents[e].stream:n,t):P.attachStreams.forEach(function(e){Ie(e,t)}):alert("track.applyConstraints is NOT supported in your browser.")},P.replaceTrack=function(n,t,o){if(n=n||{},T.prototype.getSenders)if(n instanceof C)Ne(n,t,o);else{if(n instanceof w)return S(n,"video").length&&Ne(S(n,"video")[0],t,!0),void(S(n,"audio").length&&Ne(S(n,"audio")[0],t,!1));if(c(n))throw"connection.replaceTrack requires audio and/or video and/or screen.";(n.audio||n.video||n.screen)&&(n.screen?"Edge"===DetectRTC.browser.name?navigator.getDisplayMedia({video:!0,audio:_(P)}).then(function(e){e.isScreen=!0,I.onGettingLocalMedia(e),!n.audio&&!n.video||_(P)?i(e):P.invokeGetUserMedia(null,i)},function(e){console.error("Unable to capture screen on Edge. HTTPs and version 17+ is required.")}):P.getScreenConstraints(function(e,t){if(e)return alert(e);P.invokeGetUserMedia({audio:!!_(P)&&le(t),video:t,isScreen:!0},!n.audio&&!n.video||_(P)?i:P.invokeGetUserMedia(null,i))}):(n.audio||n.video)&&P.invokeGetUserMedia(null,i))}else P.addStream(n);function i(e){P.replaceTrack(e,t,o||n.video||n.screen)}},P.resetTrack=function(e,n){(e="string"==typeof(e=e||P.getAllParticipants())?[e]:e).forEach(function(e){var t=P.peers[e].peer;void 0!==n&&!0!==n||!t.lastVideoTrack||P.replaceTrack(t.lastVideoTrack,e,!0),void 0!==n&&!1!==n||!t.lastAudioTrack||P.replaceTrack(t.lastAudioTrack,e,!1)})},P.renegotiate=function(e){e?I.renegotiatePeer(e):P.peers.getAllParticipants().forEach(function(e){I.renegotiatePeer(e)})},P.setStreamEndHandler=function(o,i){var e;o&&o.addEventListener&&(i=!!i,!o.alreadySetEndHandler)&&(o.alreadySetEndHandler=!0,e="ended","oninactive"in o&&(e="inactive"),o.addEventListener(e,function(){o.idInstance&¤tUserMediaRequest.remove(o.idInstance),i||(t=[],P.attachStreams.forEach(function(e){e.id!=o.id&&t.push(e)}),P.attachStreams=t);var e,t,n=(n=P.streamEvents[o.streamid])||{stream:o,streamid:o.streamid,type:i?"remote":"local",userid:P.userid,extra:P.extra,mediaElement:P.streamEvents[o.streamid]?P.streamEvents[o.streamid].mediaElement:null};i&&P.peers[n.userid]&&(e=P.peers[n.userid].peer,t=[],e.getRemoteStreams().forEach(function(e){e.id!=o.id&&t.push(e)}),P.peers[n.userid].streams=t),n.userid===P.userid&&"remote"===n.type||(P.peersBackup[n.userid]&&(n.extra=P.peersBackup[n.userid].extra),P.onstreamended(n),delete P.streamEvents[o.streamid])},!1))},P.onMediaError=function(e,t){P.enableLogs&&console.error(e,t)},P.autoCloseEntireSession=!1,P.filesContainer=P.videosContainer=document.body||document.documentElement,P.isInitiator=!1,P.shareFile=I.shareFile,a.handle(P),t.handle(P),P.token=f,P.onNewParticipant=function(e,t){P.acceptParticipationRequest(e,t)},P.acceptParticipationRequest=function(e,t){t.successCallback&&(t.successCallback(),delete t.successCallback),I.createNewPeer(e,t)},void 0!==M&&(P.StreamsHandler=M),P.onleave=function(e){},P.invokeSelectFileDialog=function(e){var t=new Fe;t.accept="*.*",t.selectSingleFile(e)},P.onmute=function(e){var t;e&&e.mediaElement&&("both"===e.muteType||"video"===e.muteType?(e.mediaElement.src=null,void 0!==(t=e.mediaElement.pause())?t.then(function(){e.mediaElement.poster=e.snapshot||"https://cdn.webrtc-experiment.com/images/muted.png"}):e.mediaElement.poster=e.snapshot||"https://cdn.webrtc-experiment.com/images/muted.png"):"audio"===e.muteType&&(e.mediaElement.muted=!0))},P.onunmute=function(e){e&&e.mediaElement&&e.stream&&("both"===e.unmuteType||"video"===e.unmuteType?(e.mediaElement.poster=null,e.mediaElement.srcObject=e.stream,e.mediaElement.play()):"audio"===e.unmuteType&&(e.mediaElement.muted=!1))},P.onExtraDataUpdated=function(e){e.status="online",P.onUserStatusChanged(e,!0)},P.getAllParticipants=function(e){return P.peers.getAllParticipants(e)},void 0!==M&&(M.onSyncNeeded=function(t,n,o){P.peers.getAllParticipants().forEach(function(e){I.onNegotiationNeeded({streamid:t,action:n,streamSyncNeeded:!0,type:o||"both"},e)})}),P.connectSocket=function(e){L(e)},P.closeSocket=function(){try{Be.a.sockets={}}catch(e){}P.socket&&("function"==typeof P.socket.disconnect&&P.socket.disconnect(),"function"==typeof P.socket.resetProps&&P.socket.resetProps(),P.socket=null)},P.getSocket=function(e){return!e&&P.enableLogs&&console.warn("getSocket.callback paramter is required."),e=e||function(){},P.socket?e(P.socket):L(function(){e(P.socket)}),P.socket},P.getRemoteStreams=I.getRemoteStreams,Ae=["selectFirst","selectAll","forEach"],P.streamEvents={selectFirst:function(e){return P.streamEvents.selectAll(e)[0]},selectAll:function(n){"video"==(n="audio"==(n="screen"==(n="remote"==(n="local"==(n=n||{local:!0,remote:!0,isScreen:!0,isAudio:!0,isVideo:!0})?{local:!0}:n)?{remote:!0}:n)?{isScreen:!0}:n)?{isAudio:!0}:n)&&(n={isVideo:!0});var o=[];return Object.keys(P.streamEvents).forEach(function(e){var t=P.streamEvents[e];-1===Ae.indexOf(e)&&(e=!0,n.local&&"local"===t.type&&(e=!1),n.remote&&"remote"===t.type&&(e=!1),n.isScreen&&t.stream.isScreen&&(e=!1),n.isVideo&&t.stream.isVideo&&(e=!1),n.isAudio&&t.stream.isAudio&&(e=!1),!1===(e=n.userid&&t.userid===n.userid?!1:e)&&o.push(t))}),o}},P.socketURL="/",P.socketMessageEvent="RTCMultiConnection-Message",P.socketCustomEvent="RTCMultiConnection-Custom-Message",P.DetectRTC=DetectRTC,P.setCustomSocketEvent=function(e){e&&(P.socketCustomEvent=e),P.socket&&P.socket.emit("set-custom-socket-event-listener",P.socketCustomEvent)},P.getNumberOfBroadcastViewers=function(e,t){P.socket&&e&&t&&P.socket.emit("get-number-of-users-in-specific-broadcast",e,t)},P.onNumberOfBroadcastViewersUpdated=function(e){P.enableLogs&&P.isInitiator&&console.info("Number of broadcast (",e.broadcastId,") viewers",e.numberOfBroadcastViewers)},P.onUserStatusChanged=function(e,t){P.enableLogs&&!t&&console.info(e.userid,e.status)},P.getUserMediaHandler=we,P.multiPeersHandler=I,P.enableLogs=!0,P.setCustomSocketHandler=function(e){void 0!==n&&(n=e)},P.chunkSize=4e4,P.maxParticipantsAllowed=1e3,P.disconnectWith=I.disconnectWith,P.checkPresence=function(e,o){e=e||P.sessionid,"SSEConnection"!==n.name?P.socket?P.socket.emit("check-presence",e+"",function(e,t,n){P.enableLogs&&console.log("checkPresence.isRoomExist: ",e," roomid: ",t),o(e,t,n)}):P.connectSocket(function(){P.checkPresence(e,o)}):SSEConnection.checkPresence(e,function(e,t,n){if(!P.socket)return e||(P.userid=t),void P.connectSocket(function(){o(e,t,n)});o(e,t)})},P.onReadyForOffer=function(e,t){P.multiPeersHandler.createNewPeer(e,t)},P.setUserPreferences=function(e){return P.dontAttachStream&&(e.dontAttachLocalStream=!0),P.dontGetRemoteStream&&(e.dontGetRemoteStream=!0),e},P.updateExtraData=function(){P.socket.emit("extra-data-updated",P.extra)},P.enableScalableBroadcast=!1,P.maxRelayLimitPerUser=3,P.dontCaptureUserMedia=!1,P.dontAttachStream=!1,P.dontGetRemoteStream=!1,P.onReConnecting=function(e){P.enableLogs&&console.info("ReConnecting with",e.userid,"...")},P.beforeAddingStream=function(e){return e},P.beforeRemovingStream=function(e){return e},P.checkIfChromeExtensionAvailable=Se,"undefined"!=typeof isFirefoxExtensionAvailable&&(P.checkIfChromeExtensionAvailable=isFirefoxExtensionAvailable),P.getChromeExtensionStatus=xe,P.getScreenConstraints=function(n,e){_(P,e)&&(e=!0);var o,i=function(e,t){e||(t=P.modifyScreenConstraints(t),n(e,t))};Te?i(null,{mozMediaSource:"window",mediaSource:"window"}):(o={mandatory:{chromeMediaSource:R,maxWidth:1920<screen.width?screen.width:1920,maxHeight:1080<screen.height?screen.height:1080},optional:[]},"desktop"!=R||k?("desktop"==R&&(o.mandatory.chromeMediaSourceId=k),i(null,o)):e?(e=function(e,t){o.mandatory.chromeMediaSourceId=e,t&&(o.canRequestAudioTrack=!0),i("PermissionDeniedError"==e?e:null,o)},k?e(k):(O=e,window.postMessage("audio-plus-tab","*"))):(e=function(e){o.mandatory.chromeMediaSourceId=e,i("PermissionDeniedError"==e?e:null,o)},k?e(k):(O=e,window.postMessage("get-sourceId","*"))))},P.modifyScreenConstraints=function(e){return e},P.onPeerStateChanged=function(e){P.enableLogs&&-1!==e.iceConnectionState.search(/closed|failed/gi)&&console.error("Peer connection is closed between you & ",e.userid,e.extra,"state:",e.iceConnectionState)},P.isOnline=!0,G("online",function(){P.isOnline=!0}),G("offline",function(){P.isOnline=!1}),P.isLowBandwidth=!1,navigator&&navigator.connection&&navigator.connection.type&&(P.isLowBandwidth=-1!==navigator.connection.type.toString().toLowerCase().search(/wifi|cell/g),P.isLowBandwidth)&&(P.bandwidth={audio:!1,video:!1,screen:!1},P.mediaConstraints.audio&&P.mediaConstraints.audio.optional&&P.mediaConstraints.audio.optional.length&&(N=[],P.mediaConstraints.audio.optional.forEach(function(e){void 0===e.bandwidth&&N.push(e)}),P.mediaConstraints.audio.optional=N),P.mediaConstraints.video&&P.mediaConstraints.video.optional&&P.mediaConstraints.video.optional.length&&(N=[],P.mediaConstraints.video.optional.forEach(function(e){void 0===e.bandwidth&&N.push(e)}),P.mediaConstraints.video.optional=N)),P.getExtraData=function(e,o){if(!e)throw"remoteUserId is required.";if(!o)return P.peers[e]?P.peers[e].extra:P.peersBackup[e]?P.peersBackup[e].extra:{};P.socket.emit("get-remote-user-extra-data",e,function(e,t,n){o(e,t,n)})},B.autoOpenOrJoin&&P.openOrJoin(P.sessionid),P.onUserIdAlreadyTaken=function(e,t){P.close(),P.closeSocket(),P.isInitiator=!1,P.userid=P.token(),P.join(P.sessionid),P.enableLogs&&console.warn("Userid already taken.",e,"Your new userid:",P.userid)},P.trickleIce=!0,P.version="3.6.5",P.onSettingLocalDescription=function(e){P.enableLogs&&console.info("Set local description for remote user",e.userid)},P.resetScreen=function(){k=null,DetectRTC&&DetectRTC.screen&&delete DetectRTC.screen.sourceId,currentUserMediaRequest={streams:[],mutex:!1,queueRequests:[]}},P.autoCreateMediaElement=!0,P.password=null,P.setPassword=function(e,t){t=t||function(){},P.socket?P.socket.emit("set-password",e,t):(P.password=e,t(!0,P.sessionid,null))},P.errors={ROOM_NOT_AVAILABLE:"Room not available",INVALID_PASSWORD:"Invalid password",USERID_NOT_AVAILABLE:"User ID does not exist",ROOM_PERMISSION_DENIED:"Room permission denied",ROOM_FULL:"Room full",DID_NOT_JOIN_ANY_ROOM:"Did not join any room yet",INVALID_SOCKET:"Invalid socket",PUBLIC_IDENTIFIER_MISSING:"publicRoomIdentifier is required",INVALID_ADMIN_CREDENTIAL:"Invalid username or password attempted"}}}.call(this,Ge(73).Buffer,Ge(31),Ge(49))},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,function(e,t){e.exports=function(a){var r=[];return r.toString=function(){return this.map(function(e){n=e[1]||"";var t,n,o,i=(o=e[3])?a&&"function"==typeof btoa?(t="/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */",i=o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"}),[n].concat(i).concat([t]).join("\n")):[n].join("\n"):n;return e[2]?"@media "+e[2]+"{"+i+"}":i}).join("")},r.i=function(e,t){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(n[i]=!0)}for(o=0;o<e.length;o++){var a=e[o];"number"==typeof a[0]&&n[a[0]]||(t&&!a[2]?a[2]=t:t&&(a[2]="("+a[2]+") and ("+t+")"),r.push(a))}},r}},null,function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,o=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){t=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(t)?e:(e=0===t.indexOf("//")?t:0===t.indexOf("/")?n+t:o+t.replace(/^\.\//,""),"url("+JSON.stringify(e)+")")})}},function(e,t,n){"use strict";t.byteLength=function(e){var e=d(e),t=e[0],e=e[1];return 3*(t+e)/4-e},t.toByteArray=function(e){for(var t,n=d(e),o=n[0],n=n[1],i=new l(3*(o+n)/4-n),a=0,r=0<n?o-4:o,s=0;s<r;s+=4)t=c[e.charCodeAt(s)]<<18|c[e.charCodeAt(s+1)]<<12|c[e.charCodeAt(s+2)]<<6|c[e.charCodeAt(s+3)],i[a++]=t>>16&255,i[a++]=t>>8&255,i[a++]=255&t;return 2===n&&(t=c[e.charCodeAt(s)]<<2|c[e.charCodeAt(s+1)]>>4,i[a++]=255&t),1===n&&(t=c[e.charCodeAt(s)]<<10|c[e.charCodeAt(s+1)]<<4|c[e.charCodeAt(s+2)]>>2,i[a++]=t>>8&255,i[a++]=255&t),i},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,r=n-o;a<r;a+=16383)i.push(function(e,t,n){for(var o,i=[],a=t;a<n;a+=3)o=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(s[(o=o)>>18&63]+s[o>>12&63]+s[o>>6&63]+s[63&o]);return i.join("")}(e,a,r<a+16383?r:a+16383));return 1==o?(t=e[n-1],i.push(s[t>>2]+s[t<<4&63]+"==")):2==o&&(t=(e[n-2]<<8)+e[n-1],i.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"=")),i.join("")};for(var s=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,a=o.length;i<a;++i)s[i]=o[i],c[o.charCodeAt(i)]=i;function d(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");e=e.indexOf("=");return[e=-1===e?t:e,e===t?0:4-e%4]}c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,o,i){var a,r,s=8*i-o-1,c=(1<<s)-1,l=c>>1,d=-7,u=n?i-1:0,f=n?-1:1,i=e[t+u];for(u+=f,a=i&(1<<-d)-1,i>>=-d,d+=s;0<d;a=256*a+e[t+u],u+=f,d-=8);for(r=a&(1<<-d)-1,a>>=-d,d+=o;0<d;r=256*r+e[t+u],u+=f,d-=8);if(0===a)a=1-l;else{if(a===c)return r?NaN:1/0*(i?-1:1);r+=Math.pow(2,o),a-=l}return(i?-1:1)*r*Math.pow(2,a-o)},t.write=function(e,t,n,o,i,a){var r,s,c=8*a-i-1,l=(1<<c)-1,d=l>>1,u=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=o?0:a-1,p=o?1:-1,a=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,r=l):(r=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-r))<1&&(r--,o*=2),2<=(t+=1<=r+d?u/o:u*Math.pow(2,1-d))*o&&(r++,o/=2),l<=r+d?(s=0,r=l):1<=r+d?(s=(t*o-1)*Math.pow(2,i),r+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),r=0));8<=i;e[n+f]=255&s,f+=p,s/=256,i-=8);for(r=r<<i|s,c+=i;0<c;e[n+f]=255&r,f+=p,r/=256,c-=8);e[n+f-p]|=128*a}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){var o=n(145),i=n(74)("socket.io-client:url");e.exports=function(e,t){var n=e,e=(t=t||"undefined"!=typeof location&&location,"string"==typeof(e=null==e?t.protocol+"//"+t.host:e)&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),n=o(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/",-1!==n.host.indexOf(":")?"["+n.host+"]":n.host);return n.id=n.protocol+"://"+e+":"+n.port,n.href=n.protocol+"://"+e+(t&&t.port===n.port?"":":"+n.port),n}},function(e,c,t){function n(e){var r;function s(){if(s.enabled){var o=s,e=+new Date,t=e-(r||e);o.diff=t,o.prev=r,o.curr=e,r=e;for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];i[0]=c.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var a=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,function(e,t){if("%%"===e)return e;a++;var n,t=c.formatters[t];return"function"==typeof t&&(n=i[a],e=t.call(o,n),i.splice(a,1),a--),e}),c.formatArgs.call(o,i),(s.log||c.log||console.log.bind(console)).apply(o,i)}}return s.namespace=e,s.enabled=c.enabled(e),s.useColors=c.useColors(),s.color=function(e){var t,n=0;for(t in e)n=(n<<5)-n+e.charCodeAt(t),n|=0;return c.colors[Math.abs(n)%c.colors.length]}(e),s.destroy=o,"function"==typeof c.init&&c.init(s),c.instances.push(s),s}function o(){var e=c.instances.indexOf(this);return-1!==e&&(c.instances.splice(e,1),!0)}(c=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},c.disable=function(){c.enable("")},c.enable=function(e){c.save(e),c.names=[],c.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),n=t.length,o=0;o<n;o++)t[o]&&("-"===(e=t[o].replace(/\*/g,".*?"))[0]?c.skips.push(new RegExp("^"+e.substr(1)+"$")):c.names.push(new RegExp("^"+e+"$")));for(o=0;o<c.instances.length;o++){var i=c.instances[o];i.enabled=c.enabled(i.namespace)}},c.enabled=function(e){if("*"===e[e.length-1])return!0;for(var t=0,n=c.skips.length;t<n;t++)if(c.skips[t].test(e))return!1;for(t=0,n=c.names.length;t<n;t++)if(c.names[t].test(e))return!0;return!1},c.humanize=t(104),c.instances=[],c.names=[],c.skips=[],c.formatters={}},function(e,t,n){e.exports=n(77)},function(e,c,t){function n(e){var r;function s(){if(s.enabled){var o=s,e=+new Date,t=e-(r||e);o.diff=t,o.prev=r,o.curr=e,r=e;for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];i[0]=c.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var a=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,function(e,t){if("%%"===e)return e;a++;var n,t=c.formatters[t];return"function"==typeof t&&(n=i[a],e=t.call(o,n),i.splice(a,1),a--),e}),c.formatArgs.call(o,i),(s.log||c.log||console.log.bind(console)).apply(o,i)}}return s.namespace=e,s.enabled=c.enabled(e),s.useColors=c.useColors(),s.color=function(e){var t,n=0;for(t in e)n=(n<<5)-n+e.charCodeAt(t),n|=0;return c.colors[Math.abs(n)%c.colors.length]}(e),s.destroy=o,"function"==typeof c.init&&c.init(s),c.instances.push(s),s}function o(){var e=c.instances.indexOf(this);return-1!==e&&(c.instances.splice(e,1),!0)}(c=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},c.disable=function(){c.enable("")},c.enable=function(e){c.save(e),c.names=[],c.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),n=t.length,o=0;o<n;o++)t[o]&&("-"===(e=t[o].replace(/\*/g,".*?"))[0]?c.skips.push(new RegExp("^"+e.substr(1)+"$")):c.names.push(new RegExp("^"+e+"$")));for(o=0;o<c.instances.length;o++){var i=c.instances[o];i.enabled=c.enabled(i.namespace)}},c.enabled=function(e){if("*"===e[e.length-1])return!0;for(var t=0,n=c.skips.length;t<n;t++)if(c.skips[t].test(e))return!1;for(t=0,n=c.names.length;t<n;t++)if(c.names[t].test(e))return!0;return!1},c.humanize=t(104),c.instances=[],c.names=[],c.skips=[],c.formatters={}},function(e,t,n){var d=n(147),n=Object.prototype.toString,u="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===n.call(Blob),f="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===n.call(File);t.deconstructPacket=function(e){var t=[],n=e.data;return e.data=function e(t,n){if(!t)return t;var o,i;if(d(t))return o={_placeholder:!0,num:n.length},n.push(t),o;if(Array.isArray(t)){for(var a=new Array(t.length),r=0;r<t.length;r++)a[r]=e(t[r],n);return a}if("object"!=typeof t||t instanceof Date)return t;for(i in a={},t)a[i]=e(t[i],n);return a}(n,t),e.attachments=t.length,{packet:e,buffers:t}},t.reconstructPacket=function(e,t){return e.data=function e(t,n){if(!t)return t;if(t&&t._placeholder)return n[t.num];if(Array.isArray(t))for(var o=0;o<t.length;o++)t[o]=e(t[o],n);else if("object"==typeof t)for(var i in t)t[i]=e(t[i],n);return t}(e.data,t),e.attachments=void 0,e},t.removeBlobs=function(e,s){var c=0,l=e;!function e(t,n,o){if(!t)return t;if(u&&t instanceof Blob||f&&t instanceof File){c++;var i=new FileReader;i.onload=function(){o?o[n]=this.result:l=this.result,--c||s(l)},i.readAsArrayBuffer(t)}else if(Array.isArray(t))for(var a=0;a<t.length;a++)e(t[a],a,t);else if("object"==typeof t&&!d(t))for(var r in t)e(t[r],r,t)}(l),c||s(l)}},function(e,t,n){e.exports=n(379),e.exports.parser=n(51)},function(e,t,n){var o=n(149),i=n(50),u=n(77)("engine.io-client:socket"),a=n(153),r=n(51),s=n(145),c=n(75);function f(e,t){if(!(this instanceof f))return new f(e,t);t=t||{},e&&"object"==typeof e&&(t=e,e=null),e?(e=s(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=s(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=c.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),"undefined"!=typeof self&&!this.isReactNative||(t.extraHeaders&&0<Object.keys(t.extraHeaders).length&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}(e.exports=f).priorWebsocketSuccess=!1,i(f.prototype),f.protocol=r.protocol,(f.Socket=f).Transport=n(107),f.transports=n(149),f.parser=n(51),f.prototype.createTransport=function(e){u('creating transport "%s"',e);var t=function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}(this.query),n=(t.EIO=4,t.transport=e,this.transportOptions[e]||{});return this.id&&(t.sid=this.id),new o[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},f.prototype.open=function(){var e,t;if(this.rememberUpgrade&&f.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return t=this,void setTimeout(function(){t.emit("error","No transports available")},0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},f.prototype.setTransport=function(e){u("setting transport %s",e.name);var t=this;this.transport&&(u("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),(this.transport=e).on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},f.prototype.probe=function(n){u('probing transport "%s"',n);var o=this.createTransport(n,{probe:1}),t=!1,i=this;function e(){var e;i.onlyBinaryUpgrades&&(e=!this.supportsBinary&&i.transport.supportsBinary,t=t||e),t||(u('probe transport "%s" opened',n),o.send([{type:"ping",data:"probe"}]),o.once("packet",function(e){t||("pong"===e.type&&"probe"===e.data?(u('probe transport "%s" pong',n),i.upgrading=!0,i.emit("upgrading",o),o&&(f.priorWebsocketSuccess="websocket"===o.name,u('pausing current transport "%s"',i.transport.name),i.transport.pause(function(){t||"closed"!==i.readyState&&(u("changing transport and sending upgrade packet"),d(),i.setTransport(o),o.send([{type:"upgrade"}]),i.emit("upgrade",o),o=null,i.upgrading=!1,i.flush())}))):(u('probe transport "%s" failed',n),(e=new Error("probe error")).transport=o.name,i.emit("upgradeError",e)))}))}function a(){t||(t=!0,d(),o.close(),o=null)}function r(e){var t=new Error("probe error: "+e);t.transport=o.name,a(),u('probe transport "%s" failed because of error: %s',n,e),i.emit("upgradeError",t)}function s(){r("transport closed")}function c(){r("socket closed")}function l(e){o&&e.name!==o.name&&(u('"%s" works - aborting "%s"',e.name,o.name),a())}function d(){o.removeListener("open",e),o.removeListener("error",r),o.removeListener("close",s),i.removeListener("close",c),i.removeListener("upgrading",l)}f.priorWebsocketSuccess=!1,o.once("open",e),o.once("error",r),o.once("close",s),this.once("close",c),this.once("upgrading",l),o.open()},f.prototype.onOpen=function(){if(u("socket open"),this.readyState="open",f.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){u("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},f.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(u('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else u('packet received with socket readyState "%s"',this.readyState)},f.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},f.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){"closed"!==t.readyState&&t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)},f.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){u("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)},e.pingInterval)},f.prototype.ping=function(){var e=this;this.sendPacket("ping",function(){e.emit("ping")})},f.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),(this.prevBufferLen=0)===this.writeBuffer.length?this.emit("drain"):this.flush()},f.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(u("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},f.prototype.write=f.prototype.send=function(e,t,n){return this.sendPacket("message",e,t,n),this},f.prototype.sendPacket=function(e,t,n,o){"function"==typeof t&&(o=t,t=void 0),"function"==typeof n&&(o=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState&&((n=n||{}).compress=!1!==n.compress,this.emit("packetCreate",e={type:e,data:t,options:n}),this.writeBuffer.push(e),o&&this.once("flush",o),this.flush())},f.prototype.close=function(){var e;function t(){e.onClose("forced close"),u("socket closing - telling transport to close"),e.transport.close()}function n(){e.removeListener("upgrade",n),e.removeListener("upgradeError",n),t()}function o(){e.once("upgrade",n),e.once("upgradeError",n)}return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",(e=this).writeBuffer.length?this.once("drain",function(){(this.upgrading?o:t)()}):(this.upgrading?o:t)()),this},f.prototype.onError=function(e){u("socket error %j",e),f.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},f.prototype.onClose=function(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(u('socket close with reason: "%s"',e),clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)},f.prototype.filterUpgrades=function(e){for(var t=[],n=0,o=e.length;n<o;n++)~a(this.transports,e[n])&&t.push(e[n]);return t}},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}},function(e,t,n){var i=n(106),o=n(150),a=n(50),r=n(76),s=n(77)("engine.io-client:polling-xhr");function c(){}function l(e){var t,n;o.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,"undefined"!=typeof location&&(t="https:"===location.protocol,n=(n=location.port)||(t?443:80),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==t)}function d(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}function u(){for(var e in d.requests)d.requests.hasOwnProperty(e)&&d.requests[e].abort()}e.exports=l,e.exports.Request=d,r(l,o),l.prototype.supportsBinary=!0,l.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new d(e)},l.prototype.doWrite=function(e,t){var e=this.request({method:"POST",data:e,isBinary:"string"!=typeof e&&void 0!==e}),n=this;e.on("success",t),e.on("error",function(e){n.onError("xhr post error",e)}),this.sendXhr=e},l.prototype.doPoll=function(){s("xhr poll");var e=this.request(),t=this;e.on("data",function(e){t.onData(e)}),e.on("error",function(e){t.onError("xhr poll error",e)}),this.pollXhr=e},a(d.prototype),d.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR},t=(e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,this.xhr=new i(e)),n=this;try{s("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var o in t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(o)&&t.setRequestHeader(o,this.extraHeaders[o])}catch(e){}if("POST"===this.method)try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=!0),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){n.onLoad()},t.onerror=function(){n.onError(t.responseText)}):t.onreadystatechange=function(){if(2===t.readyState)try{var e=t.getResponseHeader("Content-Type");n.supportsBinary&&"application/octet-stream"===e&&(t.responseType="arraybuffer")}catch(e){}4===t.readyState&&(200===t.status||1223===t.status?n.onLoad():setTimeout(function(){n.onError(t.status)},0))},s("xhr data %s",this.data),t.send(this.data)}catch(e){return void setTimeout(function(){n.onError(e)},0)}"undefined"!=typeof document&&(this.index=d.requestsCount++,d.requests[this.index]=this)},d.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},d.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},d.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},d.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=c:this.xhr.onreadystatechange=c,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete d.requests[this.index],this.xhr=null}},d.prototype.onLoad=function(){var e,t;try{try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e="application/octet-stream"===t&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},d.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},d.prototype.abort=function(){this.cleanup()},d.requestsCount=0,d.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",u):"function"==typeof addEventListener&&(n="onpagehide"in self?"pagehide":"unload",addEventListener(n,u,!1)))},function(e,t){e.exports=Object.keys||function(e){var t,n=[],o=Object.prototype.hasOwnProperty;for(t in e)o.call(e,t)&&n.push(t);return n}},function(e,t){},function(e,t){e.exports=function(e,t,n){var o=e.byteLength;if(t=t||0,n=n||o,e.slice)return e.slice(t,n);if(t<0&&(t+=o),n<0&&(n+=o),o<n&&(n=o),o<=t||n<=t||0===o)return new ArrayBuffer(0);for(var i=new Uint8Array(e),a=new Uint8Array(n-t),r=t,s=0;r<n;r++,s++)a[s]=i[r];return a.buffer}},function(e,t){function r(){}e.exports=function(e,n,o){var i=!1;return o=o||r,0===(a.count=e)?n():a;function a(e,t){if(a.count<=0)throw new Error("after called too many times");--a.count,e?(i=!0,n(e),n=o):0!==a.count||i||n(null,t)}}},function(e,t){var d,u,f,p=String.fromCharCode;function h(e){for(var t,n,o=[],i=0,a=e.length;i<a;)55296<=(t=e.charCodeAt(i++))&&t<=56319&&i<a?56320==(64512&(n=e.charCodeAt(i++)))?o.push(((1023&t)<<10)+(1023&n)+65536):(o.push(t),i--):o.push(t);return o}function m(e,t){if(!(55296<=e&&e<=57343))return 1;if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function s(e,t){return p(e>>t&63|128)}function g(){if(u<=f)throw Error("Invalid byte index");var e=255&d[f];if(f++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}e.exports={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,o=h(e),i=o.length,a=-1,r="";++a<i;)r+=function(e,t){if(0==(4294967168&e))return p(e);var n="";return 0==(4294965248&e)?n=p(e>>6&31|192):0==(4294901760&e)?(m(e,t)||(e=65533),n=p(e>>12&15|224),n+=s(e,6)):0==(4292870144&e)&&(n=p(e>>18&7|240),n=(n+=s(e,12))+s(e,6)),n+p(63&e|128)}(o[a],n);return r},decode:function(e,t){var n=!1!==(t=t||{}).strict;d=h(e),u=d.length,f=0;for(var o,i=[];!1!==(o=function(e){var t,n;if(u<f)throw Error("Invalid byte index");if(f==u)return!1;if(t=255&d[f],f++,0==(128&t))return t;if(192==(224&t)){if(128<=(n=(31&t)<<6|g()))return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if(2048<=(n=(15&t)<<12|g()<<6|g()))return m(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&65536<=(n=(7&t)<<18|g()<<12|g()<<6|g())&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}(n));)i.push(o);for(var a,r=i,s=r.length,c=-1,l="";++c<s;)65535<(a=r[c])&&(l+=p((a-=65536)>>>10&1023|55296),a=56320|1023&a),l+=p(a);return l}}},function(e,t){!function(){"use strict";for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=new Uint8Array(256),e=0;e<a.length;e++)d[a.charCodeAt(e)]=e;t.encode=function(e){for(var t=new Uint8Array(e),n=t.length,o="",i=0;i<n;i+=3)o=(o=(o=(o+=a[t[i]>>2])+a[(3&t[i])<<4|t[i+1]>>4])+a[(15&t[i+1])<<2|t[i+2]>>6])+a[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1)+"=":n%3==1&&(o=o.substring(0,o.length-2)+"=="),o},t.decode=function(e){for(var t,n,o,i,a=.75*e.length,r=e.length,s=0,a=("="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--),new ArrayBuffer(a)),c=new Uint8Array(a),l=0;l<r;l+=4)t=d[e.charCodeAt(l)],n=d[e.charCodeAt(l+1)],o=d[e.charCodeAt(l+2)],i=d[e.charCodeAt(l+3)],c[s++]=t<<2|n>>4,c[s++]=(15&n)<<4|o>>2,c[s++]=(3&o)<<6|63&i;return a}}()},function(e,t){var o=void 0!==o?o:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,n=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),i=n&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),a=o&&o.prototype.append&&o.prototype.getBlob;function r(e){return e.map(function(e){var t,n;return e.buffer instanceof ArrayBuffer?(t=e.buffer,e.byteLength!==t.byteLength&&((n=new Uint8Array(e.byteLength)).set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer),t):e})}function s(e,t){t=t||{};var n=new o;return r(e).forEach(function(e){n.append(e)}),t.type?n.getBlob(t.type):n.getBlob()}function c(e,t){return new Blob(r(e),t||{})}"undefined"!=typeof Blob&&(s.prototype=Blob.prototype,c.prototype=Blob.prototype),e.exports=n?i?Blob:c:a?s:void 0},function(e,c,t){function n(e){var r;function s(){if(s.enabled){var o=s,e=+new Date,t=e-(r||e);o.diff=t,o.prev=r,o.curr=e,r=e;for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];i[0]=c.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var a=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,function(e,t){if("%%"===e)return e;a++;var n,t=c.formatters[t];return"function"==typeof t&&(n=i[a],e=t.call(o,n),i.splice(a,1),a--),e}),c.formatArgs.call(o,i),(s.log||c.log||console.log.bind(console)).apply(o,i)}}return s.namespace=e,s.enabled=c.enabled(e),s.useColors=c.useColors(),s.color=function(e){var t,n=0;for(t in e)n=(n<<5)-n+e.charCodeAt(t),n|=0;return c.colors[Math.abs(n)%c.colors.length]}(e),s.destroy=o,"function"==typeof c.init&&c.init(s),c.instances.push(s),s}function o(){var e=c.instances.indexOf(this);return-1!==e&&(c.instances.splice(e,1),!0)}(c=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},c.disable=function(){c.enable("")},c.enable=function(e){c.save(e),c.names=[],c.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),n=t.length,o=0;o<n;o++)t[o]&&("-"===(e=t[o].replace(/\*/g,".*?"))[0]?c.skips.push(new RegExp("^"+e.substr(1)+"$")):c.names.push(new RegExp("^"+e+"$")));for(o=0;o<c.instances.length;o++){var i=c.instances[o];i.enabled=c.enabled(i.namespace)}},c.enabled=function(e){if("*"===e[e.length-1])return!0;for(var t=0,n=c.skips.length;t<n;t++)if(c.skips[t].test(e))return!1;for(t=0,n=c.names.length;t<n;t++)if(c.names[t].test(e))return!0;return!1},c.humanize=t(104),c.instances=[],c.names=[],c.skips=[],c.formatters={}},function(r,e,s){!function(n){var o=s(150),e=s(76);r.exports=t;var i,l=/\n/g,d=/\\n/g;function a(){}function t(e){o.call(this,e),this.query=this.query||{},i||(e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:{},i=e.___eio=e.___eio||[]),this.index=i.length;var t=this;i.push(function(e){t.onData(e)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){t.script&&(t.script.onerror=a)},!1)}e(t,o),t.prototype.supportsBinary=!1,t.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),o.prototype.doClose.call(this)},t.prototype.doPoll=function(){var t=this,e=document.createElement("script"),n=(this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)},document.getElementsByTagName("script")[0]);n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},t.prototype.doWrite=function(e,t){var n,o,i,a,r=this;function s(){c(),t()}function c(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(e){r.onError("jsonp polling iframe removal error",e)}try{var e='<iframe src="javascript:0" name="'+r.iframeId+'">';n=document.createElement(e)}catch(e){(n=document.createElement("iframe")).name=r.iframeId,n.src="javascript:0"}n.id=r.iframeId,r.form.appendChild(n),r.iframe=n}this.form||(o=document.createElement("form"),i=document.createElement("textarea"),a=this.iframeId="eio_iframe_"+this.index,o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=a,o.method="POST",o.setAttribute("accept-charset","utf-8"),i.name="d",o.appendChild(i),document.body.appendChild(o),this.form=o,this.area=i),this.form.action=this.uri(),c(),e=e.replace(d,"\\\n"),this.area.value=e.replace(l,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&s()}:this.iframe.onload=s}}.call(this,s(31))},function(u,e,f){!function(a){var t,n,o=f(107),r=f(51),i=f(75),e=f(76),s=f(152),c=f(77)("engine.io-client:websocket");if("undefined"!=typeof WebSocket)t=WebSocket;else if("undefined"!=typeof self)t=self.WebSocket||self.MozWebSocket;else try{n=f(392)}catch(e){}var l=t||n;function d(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=t&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(l=n),o.call(this,e)}e(u.exports=d,o),d.prototype.name="websocket",d.prototype.supportsBinary=!0,d.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new l(e,t):new l(e):new l(e,t,n)}catch(e){return this.emit("error",e)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},d.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},d.prototype.write=function(e){var o=this;this.writable=!1;for(var i=e.length,t=0,n=i;t<n;t++)!function(n){r.encodePacket(n,o.supportsBinary,function(e){var t;o.usingBrowserWebSocket||(t={},n.options&&(t.compress=n.options.compress),o.perMessageDeflate&&("string"==typeof e?a.byteLength(e):e.length)<o.perMessageDeflate.threshold&&(t.compress=!1));try{o.usingBrowserWebSocket?o.ws.send(e):o.ws.send(e,t)}catch(e){c("websocket closed before onclose event")}--i||(o.emit("flush"),setTimeout(function(){o.writable=!0,o.emit("drain")},0))})}(e[t])},d.prototype.onClose=function(){o.prototype.onClose.call(this)},d.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},d.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"==t&&443!==Number(this.port)||"ws"==t&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=s()),this.supportsBinary||(e.b64=1),(e=i.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e},d.prototype.check=function(){return!(!l||"__initialize"in l&&this.name===d.prototype.name)}}.call(this,f(73).Buffer)},null,function(e,t){e.exports=function(e,t){for(var n=[],o=(t=t||0)||0;o<e.length;o++)n[o-t]=e[o];return n}},function(e,t){function n(e){this.ms=(e=e||{}).min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=0<e.jitter&&e.jitter<=1?e.jitter:0,this.attempts=0}(e.exports=n).prototype.duration=function(){var e,t,n=this.ms*Math.pow(this.factor,this.attempts++);return this.jitter&&(e=Math.random(),t=Math.floor(e*this.jitter*n),n=0==(1&Math.floor(10*e))?n-t:n+t),0|Math.min(n,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},null,function(p,y,e){"use strict";for(var b in window.EJS_RESET_VARS=[],window)window.EJS_RESET_VARS.push(b);e.r(y);function t(e){return null!=e?e.constructor:null}function n(e,t){return Boolean(e&&t&&e instanceof t)}function w(e){return null==e}function _(e){return t(e)===Object}function S(e){return t(e)===String}function T(e){return Array.isArray(e)}function x(e){return n(e,NodeList)}function C(e){return w(e)||(S(e)||T(e)||x(e))&&!e.length||_(e)&&!Object.keys(e).length}var E={volume:.5,muted:!1,i18n:{restart:"Restart",play:"Play",pause:"Pause",played:"Played",volume:"Volume",mute:"Mute (F9)",unmute:"Unmute (F9)",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",settings:"Settings",saveState:"Save State (Shift + F2)",loadState:"Load State (Shift + F4)",screenRecord:"Start Screen Recording",netplay:"Netplay",gamepad:"Control Settings",cheat:"Cheats",menuBack:"Go back to previous menu",normal:"Normal",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",playNow:"Play Now"},listeners:{play:null,pause:null,restart:null,rewind:null,mute:null,volume:null,fullscreen:null},events:["ready"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".ejs",controls:{container:null,wrapper:".jes__controls"},buttons:{play:'[data-btn="play"]',pause:'[data-btn="pause"]',mute:'[data-btn="mute"]',fullscreen:'[data-btn="fullscreen"]',settings:'[data-btn="settings"]',saveState:'[data-btn="save-state"]',loadState:'[data-btn="load-state"]',screenRecord:'[data-btn="screen-record"]',gamepad:'[data-btn="gamepad"]',netplay:'[data-btn="netplay"]',cheat:'[data-btn="cheat"]'},inputs:{volume:'[data-range="volume"]'}},classNames:{type:"ejs--video",video:"ejs__video-wrapper",poster:"ejs__poster",posterEnabled:"ejs__poster-enabled",control:"ejs__control",controlPressed:"ejs__control--pressed",playing:"ejs--playing",paused:"ejs--paused",stopped:"ejs--stopped",loading:"ejs--loading",hover:"ejs--hover",tooltip:"ejs__tooltip",hidden:"ejs__sr-only",hideControls:"ejs--hide-controls",isIos:"ejs--is-ios",isTouch:"ejs--is-touch",uiSupported:"ejs--full-ui",noTransition:"ejs--no-transition",menu:{value:"ejs__menu__value",badge:"ejs__badge",open:"ejs--menu-open"},fullscreen:{enabled:"ejs--fullscreen-enabled",fallback:"ejs--fullscreen-fallback"},tabFocus:"ejs__tab-focus"}},B=e(0),o=e(157),A=e.n(o),z={nullOrUndefined:w,object:_,number:function(e){return t(e)===Number&&!Number.isNaN(e)},string:S,boolean:function(e){return t(e)===Boolean},function:function(e){return t(e)===Function},array:T,weakMap:function(e){return n(e,WeakMap)},nodeList:x,element:function(e){return n(e,Element)},textNode:function(e){return t(e)===Text},event:function(e){return n(e,Event)},keyboardEvent:function(e){return n(e,KeyboardEvent)},cue:function(e){return n(e,window.TextTrackCue)||n(e,window.VTTCue)},track:function(e){return n(e,TextTrack)||!w(e)&&S(e.kind)},url:function(e){if(n(e,window.URL))return!0;var t=e;e.startsWith("http://")&&e.startsWith("https://")||(t="http://".concat(e));try{return!C(new URL(t).hostname)}catch(e){return!1}},empty:C},M=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,null}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}();function l(t,e,n){var o,i=this,a=3<arguments.length&&void 0!==arguments[3]&&arguments[3],r=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],s=5<arguments.length&&void 0!==arguments[5]&&arguments[5];t&&"addEventListener"in t&&!z.empty(e)&&z.function(n)&&(e=e.split(" "),o=M?{passive:r,capture:s}:s,e.forEach(function(e){i&&i.eventListeners&&a&&i.eventListeners.push({element:t,type:e,callback:n,options:o}),t[a?"addEventListener":"removeEventListener"](e,n,o)}))}function U(e){l.call(this,e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",2<arguments.length?arguments[2]:void 0,!0,!(3<arguments.length&&void 0!==arguments[3])||arguments[3],4<arguments.length&&void 0!==arguments[4]&&arguments[4])}function k(e){l.call(this,e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",2<arguments.length?arguments[2]:void 0,!1,!(3<arguments.length&&void 0!==arguments[3])||arguments[3],4<arguments.length&&void 0!==arguments[4]&&arguments[4])}function ne(i){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",r=2<arguments.length?arguments[2]:void 0,s=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],c=4<arguments.length&&void 0!==arguments[4]&&arguments[4];l.call(this,i,a,function e(){k(i,a,e,s,c);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];r.apply(this,n)},!0,s,c)}function F(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};z.element(e)&&!z.empty(t)&&(t=new CustomEvent(t,{bubbles:n,detail:Object.assign({},o,{emulator:this})}),e.dispatchEvent(t))}var o=e(158),O=e.n(o);function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],o=!0,i=!1,a=void 0;try{for(var r,s=e[Symbol.iterator]();!(o=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);o=!0);}catch(e){i=!0,a=e}finally{try{o||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function P(e,i){e=e.length?e:[e];Array.from(e).reverse().forEach(function(e,t){var t=0<t?i.cloneNode(!0):i,n=e.parentNode,o=e.nextSibling;t.appendChild(e),o?n.insertBefore(t,o):n.appendChild(t)})}function I(n,e){z.element(n)&&!z.empty(e)&&Object.entries(e).filter(function(e){e=R(e,2)[1];return!z.nullOrUndefined(e)}).forEach(function(e){var e=R(e,2),t=e[0],e=e[1];return n.setAttribute(t,e)})}function j(e,t,n){e=document.createElement(e);return z.object(t)&&I(e,t),z.string(n)&&(e.innerText=n),e}function N(e){z.nodeList(e)||z.array(e)?Array.from(e).forEach(N):z.element(e)&&z.element(e.parentNode)&&e.parentNode.removeChild(e)}function L(e,t){if(!z.string(e)||z.empty(e))return{};var a={},r=t;return e.split(",").forEach(function(e){var t=e.trim(),n=t.replace(".",""),e=t.replace(/[[\]]/g,"").split("="),o=e[0],i=1<e.length?e[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":z.object(r)&&z.string(r.class)&&(r.class+=" ".concat(n)),a.class=n;break;case"#":a.id=t.replace("#","");break;case"[":a[o]=i}}),a}function G(e,t){z.element(e)&&((t=z.boolean(t=t)?t:!e.hidden)?e.setAttribute("hidden",""):e.removeAttribute("hidden"))}function V(e,t,n){return z.nodeList(e)?Array.from(e).map(function(e){return V(e,t,n)}):!!z.element(e)&&(e.classList[void 0!==n?n?"add":"remove":"toggle"](t),e.classList.contains(t))}function D(e,t){return z.element(e)&&e.classList.contains(t)}function oe(e,t){var n={Element:Element};return(n.matches||n.webkitMatchesSelector||n.mozMatchesSelector||n.msMatchesSelector||function(){return Array.from(document.querySelectorAll(t)).includes(this)}).call(e,t)}function s(e){return this.elements.container.querySelectorAll(e)}function q(e){return this.elements.container.querySelector(e)}function ie(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];z.element(e)&&(e.focus(),t&&V(e,this.config.classNames.tabFocus))}function H(e){return A.a.bind(O.a)(e)}ae=document.createElement("span"),o={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},a=Object.keys(o).find(function(e){return void 0!==ae.style[e]});var ae,re=!!z.string(a)&&o[a];function se(e){setTimeout(function(){try{G(e,!0),e.offsetHeight,G(e,!1)}catch(e){}},0)}var W={isEdge:"Netscape"===navigator.appName&&-1<navigator.appVersion.indexOf("Edge"),isIE:!!document.documentMode,isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:/(iPad|iPhone|iPod)/gi.test(navigator.platform),info:function(){var e=/(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d\.apre]+)/.exec(navigator.userAgent);return{name:e[1].toLowerCase(),version:e[2]}}},X={rangeInput:((o=document.createElement("input")).type="range")===o.type,touch:"ontouchstart"in document.documentElement,transitions:!1!==re,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches,webgl:function(){var e={DETECTED:!1};if(!e.DETECTED){var t=document.createElement("canvas");if(t&&t.getContext)for(var n=["webgl2","experimental-webgl2","webgl","experimental-webgl"],o=0,i=n.length;o<i;++o){var a=n[o],r=t.getContext(a);if(r){e.WEBGL_CONTEXT=a,e.WEBGL_VERSION=r.getParameter(r.VERSION),e.WEBGL_VENDOR=r.getParameter(r.VENDOR),e.WEBGL_SL_VERSION=r.getParameter(r.SHADING_LANGUAGE_VERSION),e.MAX_TEXTURE_SIZE=r.getParameter(r.MAX_TEXTURE_SIZE);a=r.getExtension("WEBGL_debug_renderer_info");a&&(e.WEBGL_VENDOR=r.getParameter(a.UNMASKED_VENDOR_WEBGL),e.WEBGL_RENDERER=r.getParameter(a.UNMASKED_RENDERER_WEBGL)),e.DETECTED=!0;break}}}return e}(),wasm:"undefined"!=typeof WebAssembly&&z.object(WebAssembly),audioContext:"undefined"!=typeof AudioContext};function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Y(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length,n=new Array(1<e?e-1:0),o=1;o<e;o++)n[o-1]=arguments[o];if(!n.length)return t;var i=n.shift();return z.object(i)?(Object.keys(i).forEach(function(e){z.object(i[e])?(Object.keys(t).includes(e)||Object.assign(t,ce({},e,{})),Y(t[e],i[e])):Object.assign(t,ce({},e,i[e]))}),Y.apply(void 0,[t].concat(n))):t}function le(e,t,n){e=0<arguments.length&&void 0!==e?e:"",t=1<arguments.length&&void 0!==t?t:"",n=2<arguments.length&&void 0!==n?n:"";return e.replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"),"g"),n.toString())}var de=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(z.empty(e)||z.empty(t))return"";n=t.i18n;var n,o=e.split(".").reduce(function(e,t){return e&&e[t]},n);if(z.empty(o))return"";e={"{seektime}":t.seekTime,"{title}":t.title};return Object.entries(e).forEach(function(e){t=2;var e=function(e){if(Array.isArray(e))return e}(e=e)||function(e,t){var n=[],o=!0,i=!1,a=void 0;try{for(var r,s=e[Symbol.iterator]();!(o=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);o=!0);}catch(e){i=!0,a=e}finally{try{o||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}(),t=e[0],e=e[1];o=le(o,t,e)}),o};function ue(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}a=[{key:"supported",get:function(){try{return"localStorage"in window&&(window.localStorage.getItem("___test")||window.localStorage.setItem("___test","___test"),!0)}catch(e){return!1}}}],ue((o=pe).prototype,[{key:"get",value:function(e){if(!pe.supported||!this.enabled)return null;var t=window.localStorage.getItem(this.key);if(z.empty(t))return null;t=JSON.parse(t);return z.string(e)&&e.length?t[e]:t}},{key:"set",value:function(e){var t;pe.supported&&this.enabled&&z.object(e)&&(t=this.get(),Y(t=z.empty(t)?{}:t,e),window.localStorage.setItem(this.key,JSON.stringify(t)))}}]),ue(o,a);var fe=pe;function pe(e,t){if(!(this instanceof pe))throw new TypeError("Cannot call a class as a function");this.enabled=!0,this.key=t}var o=e(108),he=e.n(o),i=e(6),a=e(159),me=e.n(a),ge={"2xScaleHQ.glslp":'shaders = 1\n\nshader0 = "2xScaleHQ.glsl"\nfilter_linear0 = false\nscale_type_0 = source\n',"4xScaleHQ.glslp":'shaders = 1\n\nshader0 = "4xScaleHQ.glsl"\nfilter_linear0 = false\nscale_type_0 = source\n',"crt-easymode.glslp":"shaders = 1\n\nshader0 = crt-easymode.glsl\nfilter_linear0 = false\nscale_type_0 = source\n","crt-aperture.glslp":"shaders = 1\n\nshader0 = crt-aperture.glsl\nfilter_linear0 = false\n","crt-geom.glslp":"shaders = 1\n\nshader0 = crt-geom.glsl\nfilter_linear0 = false\nscale_type_0 = source\n","2xScaleHQ.glsl":"/*\n2xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - [email protected]\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 dx = vec2(x, 0.0);\nvec2 dy = vec2(0.0, y);\nt1 = vec4(vTexCoord - dg1, vTexCoord - dy);\nt2 = vec4(vTexCoord - dg2, vTexCoord + dx);\nt3 = vec4(vTexCoord + dg1, vTexCoord + dy);\nt4 = vec4(vTexCoord + dg2, vTexCoord - dx);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 0.325; // start smoothing wt.\nfloat k = -0.250; // wt. decrease factor\nfloat max_w = 0.25; // max filter weight\nfloat min_w =-0.05; // min filter weight\nfloat lum_add = 0.25; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c00 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 c10 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 c20 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 c01 = COMPAT_TEXTURE(Source, t4.zw).xyz; \nvec3 c11 = COMPAT_TEXTURE(Source, vTexCoord).xyz; \nvec3 c21 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 c02 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 c12 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 c22 = COMPAT_TEXTURE(Source, t3.xy).xyz; \n\nfloat md1 = dot(abs(c00 - c22), dt);\nfloat md2 = dot(abs(c02 - c20), dt);\n\nfloat w1 = dot(abs(c22 - c11), dt) * md2;\nfloat w2 = dot(abs(c02 - c11), dt) * md1;\nfloat w3 = dot(abs(c00 - c11), dt) * md2;\nfloat w4 = dot(abs(c20 - c11), dt) * md1;\n\nfloat t1 = w1 + w3;\nfloat t2 = w2 + w4;\nfloat ww = max(t1, t2) + 0.0001;\n\nc11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww);\n\nfloat lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add);\nfloat lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add);\n\nw1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w);\nw2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w);\nw3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w);\nw4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w);\nFragColor = vec4(w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11, 1.0);\n} \n#endif\n","4xScaleHQ.glsl":"/*\n4xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - [email protected]\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 sd1 = dg1 * 0.5;\nvec2 sd2 = dg2 * 0.5;\nvec2 ddx = vec2(x, 0.0);\nvec2 ddy = vec2(0.0, y);\nt1 = vec4(vTexCoord - sd1, vTexCoord - ddy);\nt2 = vec4(vTexCoord - sd2, vTexCoord + ddx);\nt3 = vec4(vTexCoord + sd1, vTexCoord + ddy);\nt4 = vec4(vTexCoord + sd2, vTexCoord - ddx);\nt5 = vec4(vTexCoord - dg1, vTexCoord - dg2);\nt6 = vec4(vTexCoord + dg1, vTexCoord + dg2);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 1.0; // start smoothing wt.\nfloat k = -1.10; // wt. decrease factor\nfloat max_w = 0.75; // max filter weight\nfloat min_w = 0.03; // min filter weight\nfloat lum_add = 0.33; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c = COMPAT_TEXTURE(Source, vTexCoord).xyz;\nvec3 i1 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 i2 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 i3 = COMPAT_TEXTURE(Source, t3.xy).xyz; \nvec3 i4 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 o1 = COMPAT_TEXTURE(Source, t5.xy).xyz; \nvec3 o3 = COMPAT_TEXTURE(Source, t6.xy).xyz; \nvec3 o2 = COMPAT_TEXTURE(Source, t5.zw).xyz;\nvec3 o4 = COMPAT_TEXTURE(Source, t6.zw).xyz;\nvec3 s1 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 s2 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 s3 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 s4 = COMPAT_TEXTURE(Source, t4.zw).xyz; \n\nfloat ko1=dot(abs(o1-c),dt);\nfloat ko2=dot(abs(o2-c),dt);\nfloat ko3=dot(abs(o3-c),dt);\nfloat ko4=dot(abs(o4-c),dt);\n\nfloat k1=min(dot(abs(i1-i3),dt),max(ko1,ko3));\nfloat k2=min(dot(abs(i2-i4),dt),max(ko2,ko4));\n\nfloat w1 = k2; if(ko3<ko1) w1*=ko3/ko1;\nfloat w2 = k1; if(ko4<ko2) w2*=ko4/ko2;\nfloat w3 = k2; if(ko1<ko3) w3*=ko1/ko3;\nfloat w4 = k1; if(ko2<ko4) w4*=ko2/ko4;\n\nc=(w1*o1+w2*o2+w3*o3+w4*o4+0.001*c)/(w1+w2+w3+w4+0.001);\nw1 = k*dot(abs(i1-c)+abs(i3-c),dt)/(0.125*dot(i1+i3,dt)+lum_add);\nw2 = k*dot(abs(i2-c)+abs(i4-c),dt)/(0.125*dot(i2+i4,dt)+lum_add);\nw3 = k*dot(abs(s1-c)+abs(s3-c),dt)/(0.125*dot(s1+s3,dt)+lum_add);\nw4 = k*dot(abs(s2-c)+abs(s4-c),dt)/(0.125*dot(s2+s4,dt)+lum_add);\n\nw1 = clamp(w1+mx,min_w,max_w); \nw2 = clamp(w2+mx,min_w,max_w);\nw3 = clamp(w3+mx,min_w,max_w); \nw4 = clamp(w4+mx,min_w,max_w);\n\nFragColor = vec4((w1*(i1+i3)+w2*(i2+i4)+w3*(s1+s3)+w4*(s2+s4)+c)/(2.0*(w1+w2+w3+w4)+1.0), 1.0);\n} \n#endif\n","crt-easymode.glsl":"#if defined(VERTEX)\n\n #if __VERSION__ >= 130\n #define COMPAT_VARYING out\n #define COMPAT_ATTRIBUTE in\n #define COMPAT_TEXTURE texture\n #else\n #define COMPAT_VARYING varying\n #define COMPAT_ATTRIBUTE attribute\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _oPosition1;\n vec4 _r0005;\n COMPAT_ATTRIBUTE vec4 VertexCoord;\n COMPAT_ATTRIBUTE vec4 TexCoord;\n COMPAT_VARYING vec4 TEX0;\n \n uniform mat4 MVPMatrix;\n uniform int FrameDirection;\n uniform int FrameCount;\n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _oTex;\n _r0005 = VertexCoord.x*MVPMatrix[0];\n _r0005 = _r0005 + VertexCoord.y*MVPMatrix[1];\n _r0005 = _r0005 + VertexCoord.z*MVPMatrix[2];\n _r0005 = _r0005 + VertexCoord.w*MVPMatrix[3];\n _oPosition1 = _r0005;\n _oTex = TexCoord.xy;\n gl_Position = _r0005;\n TEX0.xy = TexCoord.xy;\n }\n #elif defined(FRAGMENT)\n \n #if __VERSION__ >= 130\n #define COMPAT_VARYING in\n #define COMPAT_TEXTURE texture\n out vec4 FragColor;\n #else\n #define COMPAT_VARYING varying\n #define FragColor gl_FragColor\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _ret_0;\n float _TMP30;\n float _TMP29;\n float _TMP28;\n float _TMP13;\n float _TMP32;\n float _TMP11;\n float _TMP10;\n float _TMP31;\n float _TMP9;\n float _TMP8;\n float _TMP15;\n float _TMP14;\n float _TMP33;\n vec4 _TMP34;\n vec4 _TMP27;\n vec4 _TMP25;\n vec4 _TMP23;\n vec4 _TMP21;\n vec4 _TMP26;\n vec4 _TMP24;\n vec4 _TMP22;\n vec4 _TMP20;\n float _TMP4;\n vec4 _TMP3;\n vec4 _TMP2;\n float _TMP19;\n float _TMP18;\n float _TMP17;\n float _TMP16;\n vec4 _TMP1;\n vec2 _TMP0;\n uniform sampler2D Texture;\n input_dummy _IN1;\n float _TMP43;\n float _x_step0044;\n float _curve0044;\n float _a0048;\n float _val0052;\n float _a0052;\n vec4 _TMP57;\n vec4 _x0072;\n vec2 _c0086;\n vec4 _x0088;\n vec4 _x0094;\n vec2 _c0098;\n vec4 _x0100;\n vec2 _c0104;\n vec4 _x0106;\n vec4 _sample_min0110;\n vec4 _sample_max0110;\n vec4 _r0112;\n vec4 _TMP117;\n vec2 _co0124;\n vec2 _c0126;\n vec4 _x0128;\n vec4 _x0134;\n vec2 _c0138;\n vec4 _x0140;\n vec2 _c0144;\n vec4 _x0146;\n vec4 _sample_min0150;\n vec4 _sample_max0150;\n vec4 _r0152;\n vec4 _TMP157;\n float _TMP163;\n float _x_step0164;\n float _curve0164;\n float _a0168;\n float _val0172;\n float _a0172;\n float _TMP183;\n float _TMP189;\n float _x0190;\n float _a0196;\n float _x0198;\n vec2 _x0200;\n float _x0208;\n COMPAT_VARYING vec4 TEX0;\n \n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _dx1;\n vec2 _dy;\n vec2 _pix_co;\n vec2 _tex_co;\n vec2 _dist;\n vec3 _col2;\n vec3 _col21;\n vec4 _coeffs1;\n float _luma;\n float _bright;\n float _scan_weight;\n vec2 _mod_fac;\n int _dot_no;\n vec3 _mask_weight;\n vec3 _TMP37;\n _dx1 = vec2(1.00000000E+00/TextureSize.x, 0.00000000E+00);\n _dy = vec2(0.00000000E+00, 1.00000000E+00/TextureSize.y);\n _pix_co = TEX0.xy*TextureSize - vec2( 5.00000000E-01, 5.00000000E-01);\n _TMP0 = floor(_pix_co);\n _tex_co = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/TextureSize;\n _dist = fract(_pix_co);\n _x_step0044 = float((_dist.x >= 5.00000000E-01));\n _a0048 = 2.50000000E-01 - (_dist.x - _x_step0044)*(_dist.x - _x_step0044);\n _TMP33 = inversesqrt(_a0048);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0052 = 5.00000000E-01 - _dist.x;\n _val0052 = float((_a0052 > 0.00000000E+00));\n _TMP15 = _val0052 - float((_a0052 < 0.00000000E+00));\n _curve0044 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP43 = _dist.x + 2.50000000E-01*(_curve0044 - _dist.x);\n _coeffs1 = 3.14159274E+00*vec4(1.00000000E+00 + _TMP43, _TMP43, 1.00000000E+00 - _TMP43, 2.00000000E+00 - _TMP43);\n _TMP1 = abs(_coeffs1);\n _TMP57 = max(_TMP1, vec4( 9.99999975E-06, 9.99999975E-06, 9.99999975E-06, 9.99999975E-06));\n _TMP16 = sin(_TMP57.x);\n _TMP17 = sin(_TMP57.y);\n _TMP18 = sin(_TMP57.z);\n _TMP19 = sin(_TMP57.w);\n _TMP2 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _x0072 = _TMP57/2.00000000E+00;\n _TMP16 = sin(_x0072.x);\n _TMP17 = sin(_x0072.y);\n _TMP18 = sin(_x0072.z);\n _TMP19 = sin(_x0072.w);\n _TMP3 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _coeffs1 = ((2.00000000E+00*_TMP2)*_TMP3)/(_TMP57*_TMP57);\n _TMP4 = dot(_coeffs1, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _coeffs1 = _coeffs1/_TMP4;\n _c0086 = _tex_co - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0086);\n _x0088 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0088;\n _TMP22 = COMPAT_TEXTURE(Texture, _tex_co);\n _x0094 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0094;\n _c0098 = _tex_co + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0098);\n _x0100 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0100;\n _c0104 = _tex_co + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0104);\n _x0106 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0106;\n _r0112 = _coeffs1.x*_TMP21;\n _r0112 = _r0112 + _coeffs1.y*_TMP23;\n _r0112 = _r0112 + _coeffs1.z*_TMP25;\n _r0112 = _r0112 + _coeffs1.w*_TMP27;\n _sample_min0110 = min(_TMP23, _TMP25);\n _sample_max0110 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0110, _r0112);\n _TMP117 = max(_sample_min0110, _TMP34);\n _co0124 = _tex_co + _dy;\n _c0126 = _co0124 - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0126);\n _x0128 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0128;\n _TMP22 = COMPAT_TEXTURE(Texture, _co0124);\n _x0134 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0134;\n _c0138 = _co0124 + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0138);\n _x0140 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0140;\n _c0144 = _co0124 + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0144);\n _x0146 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0146;\n _r0152 = _coeffs1.x*_TMP21;\n _r0152 = _r0152 + _coeffs1.y*_TMP23;\n _r0152 = _r0152 + _coeffs1.z*_TMP25;\n _r0152 = _r0152 + _coeffs1.w*_TMP27;\n _sample_min0150 = min(_TMP23, _TMP25);\n _sample_max0150 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0150, _r0152);\n _TMP157 = max(_sample_min0150, _TMP34);\n _x_step0164 = float((_dist.y >= 5.00000000E-01));\n _a0168 = 2.50000000E-01 - (_dist.y - _x_step0164)*(_dist.y - _x_step0164);\n _TMP33 = inversesqrt(_a0168);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0172 = 5.00000000E-01 - _dist.y;\n _val0172 = float((_a0172 > 0.00000000E+00));\n _TMP15 = _val0172 - float((_a0172 < 0.00000000E+00));\n _curve0164 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP163 = _dist.y + (_curve0164 - _dist.y);\n _col2 = _TMP117.xyz + _TMP163*(_TMP157.xyz - _TMP117.xyz);\n _luma = dot(vec3( 2.12599993E-01, 7.15200007E-01, 7.22000003E-02), _col2);\n _TMP8 = max(_col2.y, _col2.z);\n _TMP9 = max(_col2.x, _TMP8);\n _bright = (_TMP9 + _luma)/2.00000000E+00;\n _TMP31 = min(6.49999976E-01, _bright);\n _TMP183 = max(3.49999994E-01, _TMP31);\n _x0190 = _bright*1.50000000E+00;\n _TMP31 = min(1.50000000E+00, _x0190);\n _TMP189 = max(1.50000000E+00, _TMP31);\n _a0196 = TEX0.y*2.00000000E+00*3.14159274E+00*TextureSize.y;\n _TMP10 = cos(_a0196);\n _x0198 = _TMP10*5.00000000E-01 + 5.00000000E-01;\n _TMP11 = pow(_x0198, _TMP189);\n _scan_weight = 1.00000000E+00 - _TMP11;\n _x0200 = (TEX0.xy*OutputSize*TextureSize)/InputSize;\n _mod_fac = floor(_x0200);\n _x0208 = _mod_fac.x/3.00000000E+00;\n _TMP32 = floor(_x0208);\n _TMP13 = _mod_fac.x - 3.00000000E+00*_TMP32;\n _dot_no = int(_TMP13);\n if (_dot_no == 0) {\n _mask_weight = vec3( 1.00000000E+00, 6.99999988E-01, 6.99999988E-01);\n } else {\n if (_dot_no == 1) {\n _mask_weight = vec3( 6.99999988E-01, 1.00000000E+00, 6.99999988E-01);\n } else {\n _mask_weight = vec3( 6.99999988E-01, 6.99999988E-01, 1.00000000E+00);\n }\n }\n if (InputSize.y >= 4.00000000E+02) {\n _scan_weight = 1.00000000E+00;\n }\n _col21 = _col2.xyz;\n _col2 = _col2*vec3(_scan_weight, _scan_weight, _scan_weight);\n _col2 = _col2 + _TMP183*(_col21 - _col2);\n _col2 = _col2*_mask_weight;\n _TMP28 = pow(_col2.x, 5.55555582E-01);\n _TMP29 = pow(_col2.y, 5.55555582E-01);\n _TMP30 = pow(_col2.z, 5.55555582E-01);\n _col2 = vec3(_TMP28, _TMP29, _TMP30);\n _TMP37 = _col2*1.20000005E+00;\n _ret_0 = vec4(_TMP37.x, _TMP37.y, _TMP37.z, 1.00000000E+00);\n FragColor = _ret_0;\n return;\n }\n #endif\n","crt-aperture.glsl":'\n/*\nCRT Shader by EasyMode\nLicense: GPL\n*/\n/*\n#pragma parameter SHARPNESS_IMAGE "Sharpness Image" 1.0 1.0 5.0 1.0\n#pragma parameter SHARPNESS_EDGES "Sharpness Edges" 3.0 1.0 5.0 1.0\n#pragma parameter GLOW_WIDTH "Glow Width" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HEIGHT "Glow Height" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HALATION "Glow Halation" 0.1 0.0 1.0 0.01\n#pragma parameter GLOW_DIFFUSION "Glow Diffusion" 0.05 0.0 1.0 0.01\n#pragma parameter MASK_COLORS "Mask Colors" 2.0 2.0 3.0 1.0\n#pragma parameter MASK_STRENGTH "Mask Strength" 0.3 0.0 1.0 0.05\n#pragma parameter MASK_SIZE "Mask Size" 1.0 1.0 9.0 1.0\n#pragma parameter SCANLINE_SIZE_MIN "Scanline Size Min." 0.5 0.5 1.5 0.05\n#pragma parameter SCANLINE_SIZE_MAX "Scanline Size Max." 1.5 0.5 1.5 0.05\n#pragma parameter GAMMA_INPUT "Gamma Input" 2.4 1.0 5.0 0.1\n#pragma parameter GAMMA_OUTPUT "Gamma Output" 2.4 1.0 5.0 0.1\n#pragma parameter BRIGHTNESS "Brightness" 1.5 0.0 2.0 0.05\n* */\n\n#define Coord TEX0\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define OUT out\n#define IN in\n#define tex2D texture\n#else\n#define OUT varying \n#define IN attribute \n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nIN vec4 VertexCoord;\nIN vec4 Color;\nIN vec2 TexCoord;\nOUT vec4 color;\nOUT vec2 Coord;\n\nuniform mat4 MVPMatrix;\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\ncolor = Color;\nCoord = TexCoord;\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define IN in\n#define tex2D texture\nout vec4 FragColor;\n#else\n#define IN varying\n#define FragColor gl_FragColor\n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nIN vec2 Coord;\n\n#ifdef PARAMETER_UNIFORM\nuniform PRECISION float SHARPNESS_IMAGE;\nuniform PRECISION float SHARPNESS_EDGES;\nuniform PRECISION float GLOW_WIDTH;\nuniform PRECISION float GLOW_HEIGHT;\nuniform PRECISION float GLOW_HALATION;\nuniform PRECISION float GLOW_DIFFUSION;\nuniform PRECISION float MASK_COLORS;\nuniform PRECISION float MASK_STRENGTH;\nuniform PRECISION float MASK_SIZE;\nuniform PRECISION float SCANLINE_SIZE_MIN;\nuniform PRECISION float SCANLINE_SIZE_MAX;\nuniform PRECISION float GAMMA_INPUT;\nuniform PRECISION float GAMMA_OUTPUT;\nuniform PRECISION float BRIGHTNESS;\n#else\n#define SHARPNESS_IMAGE 1.0\n#define SHARPNESS_EDGES 3.0\n#define GLOW_WIDTH 0.5\n#define GLOW_HEIGHT 0.5\n#define GLOW_HALATION 0.1\n#define GLOW_DIFFUSION 0.05\n#define MASK_COLORS 2.0\n#define MASK_STRENGTH 0.3\n#define MASK_SIZE 1.0\n#define SCANLINE_SIZE_MIN 0.5\n#define SCANLINE_SIZE_MAX 1.5\n#define GAMMA_INPUT 2.4\n#define GAMMA_OUTPUT 2.4\n#define BRIGHTNESS 1.5\n#endif\n\n#define FIX(c) max(abs(c), 1e-5)\n#define PI 3.141592653589\n#define saturate(c) clamp(c, 0.0, 1.0)\n#define TEX2D(c) pow(tex2D(tex, c).rgb, vec3(GAMMA_INPUT))\n\nmat3 get_color_matrix(sampler2D tex, vec2 co, vec2 dx)\n{\nreturn mat3(TEX2D(co - dx), TEX2D(co), TEX2D(co + dx));\n}\n\nvec3 blur(mat3 m, float dist, float rad)\n{\nvec3 x = vec3(dist - 1.0, dist, dist + 1.0) / rad;\nvec3 w = exp2(x * x * -1.0);\n\nreturn (m[0] * w.x + m[1] * w.y + m[2] * w.z) / (w.x + w.y + w.z);\n}\n\nvec3 filter_gaussian(sampler2D tex, vec2 co, vec2 tex_size)\n{\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 dy = vec2(0.0, 1.0 / tex_size.y);\nvec2 pix_co = co * tex_size;\nvec2 tex_co = (floor(pix_co) + 0.5) / tex_size;\nvec2 dist = (fract(pix_co) - 0.5) * -1.0;\n\nmat3 line0 = get_color_matrix(tex, tex_co - dy, dx);\nmat3 line1 = get_color_matrix(tex, tex_co, dx);\nmat3 line2 = get_color_matrix(tex, tex_co + dy, dx);\nmat3 column = mat3(blur(line0, dist.x, GLOW_WIDTH),\n blur(line1, dist.x, GLOW_WIDTH),\n blur(line2, dist.x, GLOW_WIDTH));\n\nreturn blur(column, dist.y, GLOW_HEIGHT);\n}\n\nvec3 filter_lanczos(sampler2D tex, vec2 co, vec2 tex_size, float sharp)\n{\ntex_size.x *= sharp;\n\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 pix_co = co * tex_size - vec2(0.5, 0.0);\nvec2 tex_co = (floor(pix_co) + vec2(0.5, 0.0)) / tex_size;\nvec2 dist = fract(pix_co);\nvec4 coef = PI * vec4(dist.x + 1.0, dist.x, dist.x - 1.0, dist.x - 2.0);\n\ncoef = FIX(coef);\ncoef = 2.0 * sin(coef) * sin(coef / 2.0) / (coef * coef);\ncoef /= dot(coef, vec4(1.0));\n\nvec4 col1 = vec4(TEX2D(tex_co), 1.0);\nvec4 col2 = vec4(TEX2D(tex_co + dx), 1.0);\n\nreturn (mat4(col1, col1, col2, col2) * coef).rgb;\n}\n\nvec3 get_scanline_weight(float x, vec3 col)\n{\nvec3 beam = mix(vec3(SCANLINE_SIZE_MIN), vec3(SCANLINE_SIZE_MAX), col);\nvec3 x_mul = 2.0 / beam;\nvec3 x_offset = x_mul * 0.5;\n\nreturn smoothstep(0.0, 1.0, 1.0 - abs(x * x_mul - x_offset)) * x_offset;\n}\n\nvec3 get_mask_weight(float x)\n{\nfloat i = mod(floor(x * OutputSize.x * TextureSize.x / (InputSize.x * MASK_SIZE)), MASK_COLORS);\n\nif (i == 0.0) return mix(vec3(1.0, 0.0, 1.0), vec3(1.0, 0.0, 0.0), MASK_COLORS - 2.0);\nelse if (i == 1.0) return vec3(0.0, 1.0, 0.0);\nelse return vec3(0.0, 0.0, 1.0);\n}\n\nvoid main()\n{\nvec3 col_glow = filter_gaussian(Texture, Coord, TextureSize);\nvec3 col_soft = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_IMAGE);\nvec3 col_sharp = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_EDGES);\nvec3 col = sqrt(col_sharp * col_soft);\n\ncol *= get_scanline_weight(fract(Coord.y * TextureSize.y), col_soft);\ncol_glow = saturate(col_glow - col);\ncol += col_glow * col_glow * GLOW_HALATION;\ncol = mix(col, col * get_mask_weight(Coord.x) * MASK_COLORS, MASK_STRENGTH);\ncol += col_glow * GLOW_DIFFUSION;\ncol = pow(col * BRIGHTNESS, vec3(1.0 / GAMMA_OUTPUT));\n\nFragColor = vec4(col, 1.0);\n}\n\n#endif\n',"crt-geom.glsl":'\n/*\nCRT-interlaced\n\nCopyright (C) 2010-2012 cgwg, Themaister and DOLLS\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2 of the License, or (at your option)\nany later version.\n\n(cgwg gave their consent to have the original version of this shader\ndistributed under the GPL in this message:\n\nhttp://board.byuu.org/viewtopic.php?p=26075#p26075\n\n"Feel free to distribute my shaders under the GPL. After all, the\nbarrel distortion code was taken from the Curvature shader, which is\nunder the GPL."\n)\nThis shader variant is pre-configured with screen curvature\n*/\n/*\n#pragma parameter CRTgamma "CRTGeom Target Gamma" 2.4 0.1 5.0 0.1\n#pragma parameter monitorgamma "CRTGeom Monitor Gamma" 2.2 0.1 5.0 0.1\n#pragma parameter d "CRTGeom Distance" 1.6 0.1 3.0 0.1\n#pragma parameter CURVATURE "CRTGeom Curvature Toggle" 1.0 0.0 1.0 1.0\n#pragma parameter R "CRTGeom Curvature Radius" 2.0 0.1 10.0 0.1\n#pragma parameter cornersize "CRTGeom Corner Size" 0.03 0.001 1.0 0.005\n#pragma parameter cornersmooth "CRTGeom Corner Smoothness" 1000.0 80.0 2000.0 100.0\n#pragma parameter x_tilt "CRTGeom Horizontal Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter y_tilt "CRTGeom Vertical Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter overscan_x "CRTGeom Horiz. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter overscan_y "CRTGeom Vert. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter DOTMASK "CRTGeom Dot Mask Toggle" 0.3 0.0 0.3 0.3\n#pragma parameter SHARPER "CRTGeom Sharpness" 1.0 1.0 3.0 1.0\n#pragma parameter scanline_weight "CRTGeom Scanline Weight" 0.3 0.1 0.5 0.05\n*/\n\n#ifndef PARAMETER_UNIFORM\n#define CRTgamma 2.4\n#define monitorgamma 2.2\n#define d 1.6\n#define CURVATURE 1.0\n#define R 2.0\n#define cornersize 0.03\n#define cornersmooth 1000.0\n#define x_tilt 0.0\n#define y_tilt 0.0\n#define overscan_x 100.0\n#define overscan_y 100.0\n#define DOTMASK 0.3\n#define SHARPER 1.0\n#define scanline_weight 0.3\n#endif\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\n#define FIX(c) max(abs(c), 1e-5);\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = R*acos(a);\nreturn uv*r/sin(r/R);\n}\n\nvec2 fwtrans(vec2 uv)\n{\nfloat r = FIX(sqrt(dot(uv,uv)));\nuv *= sin(r/R)/r;\nfloat x = 1.0-cos(r/R);\nfloat D = d/R + x*cosangle.x*cosangle.y+dot(uv,sinangle);\nreturn d*(uv*cosangle-x*sinangle)/D;\n}\n\nvec3 maxscale()\n{\nvec2 c = bkwtrans(-R * sinangle / (1.0 + R/d*cosangle.x*cosangle.y));\nvec2 a = vec2(0.5,0.5)*aspect;\nvec2 lo = vec2(fwtrans(vec2(-a.x,c.y)).x, fwtrans(vec2(c.x,-a.y)).y)/aspect;\nvec2 hi = vec2(fwtrans(vec2(+a.x,c.y)).x, fwtrans(vec2(c.x,+a.y)).y)/aspect;\nreturn vec3((hi+lo)*aspect*0.5,max(hi.x-lo.x,hi.y-lo.y));\n}\n\nvoid main()\n{\n// START of parameters\n\n// gamma of simulated CRT\n//\tCRTgamma = 1.8;\n// gamma of display monitor (typically 2.2 is correct)\n//\tmonitorgamma = 2.2;\n// overscan (e.g. 1.02 for 2% overscan)\noverscan = vec2(1.00,1.00);\n// aspect ratio\naspect = vec2(1.0, 0.75);\n// lengths are measured in units of (approximately) the width\n// of the monitor simulated distance from viewer to monitor\n//\td = 2.0;\n// radius of curvature\n//\tR = 1.5;\n// tilt angle in radians\n// (behavior might be a bit wrong if both components are\n// nonzero)\nconst vec2 angle = vec2(0.0,0.0);\n// size of curved corners\n//\tcornersize = 0.03;\n// border smoothness parameter\n// decrease if borders are too aliased\n//\tcornersmooth = 1000.0;\n\n// END of parameters\n\nvec4 _oColor;\nvec2 _otexCoord;\ngl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];\n_oPosition1 = gl_Position;\n_oColor = COLOR;\n_otexCoord = TexCoord.xy;\nCOL0 = COLOR;\nTEX0.xy = TexCoord.xy;\n\n// Precalculate a bunch of useful values we\'ll need in the fragment\n// shader.\nsinangle = sin(vec2(x_tilt, y_tilt)) + vec2(0.001);//sin(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\ncosangle = cos(vec2(x_tilt, y_tilt)) + vec2(0.001);//cos(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\nstretch = maxscale();\n\nilfac = vec2(1.0,clamp(floor(InputSize.y/200.0), 1.0, 2.0));\n\n// The size of one texel, in texture-coordinates.\nvec2 sharpTextureSize = vec2(SHARPER * TextureSize.x, TextureSize.y);\none = ilfac / sharpTextureSize;\n\n// Resulting X pixel-coordinate of the pixel we\'re drawing.\nmod_factor = TexCoord.x * TextureSize.x * OutputSize.x / InputSize.x;\n\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nstruct output_dummy {\nvec4 _color;\n};\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\n\n// Comment the next line to disable interpolation in linear gamma (and\n// gain speed).\n#define LINEAR_PROCESSING\n\n// Enable screen curvature.\n// #define CURVATURE\n\n// Enable 3x oversampling of the beam profile\n#define OVERSAMPLE\n\n// Use the older, purely gaussian beam profile\n//#define USEGAUSSIAN\n\n// Macros.\n#define FIX(c) max(abs(c), 1e-5);\n#define PI 3.141592653589\n\n#ifdef LINEAR_PROCESSING\n# define TEX2D(c) pow(COMPAT_TEXTURE(Texture, (c)), vec4(CRTgamma))\n#else\n# define TEX2D(c) COMPAT_TEXTURE(Texture, (c))\n#endif\n\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = FIX(R*acos(a));\nreturn uv*r/sin(r/R);\n}\n\nvec2 transform(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord-vec2(0.5))*aspect*stretch.z+stretch.xy;\nreturn (bkwtrans(coord)/vec2(overscan_x / 100.0, overscan_y / 100.0)/aspect+vec2(0.5)) * InputSize / TextureSize;\n}\n\nfloat corner(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord - vec2(0.5)) * vec2(overscan_x / 100.0, overscan_y / 100.0) + vec2(0.5);\ncoord = min(coord, vec2(1.0)-coord) * aspect;\nvec2 cdist = vec2(cornersize);\ncoord = (cdist - min(coord,cdist));\nfloat dist = sqrt(dot(coord,coord));\nreturn clamp((cdist.x-dist)*cornersmooth,0.0, 1.0);\n}\n\n// Calculate the influence of a scanline on the current pixel.\n//\n// \'distance\' is the distance in texture coordinates from the current\n// pixel to the scanline in question.\n// \'color\' is the colour of the scanline at the horizontal location of\n// the current pixel.\nvec4 scanlineWeights(float distance, vec4 color)\n{\n// "wid" controls the width of the scanline beam, for each RGB\n// channel The "weights" lines basically specify the formula\n// that gives you the profile of the beam, i.e. the intensity as\n// a function of distance from the vertical center of the\n// scanline. In this case, it is gaussian if width=2, and\n// becomes nongaussian for larger widths. Ideally this should\n// be normalized so that the integral across the beam is\n// independent of its width. That is, for a narrower beam\n// "weights" should have a higher peak at the center of the\n// scanline than for a wider beam.\n#ifdef USEGAUSSIAN\nvec4 wid = 0.3 + 0.1 * pow(color, vec4(3.0));\nvec4 weights = vec4(distance / wid);\nreturn 0.4 * exp(-weights * weights) / wid;\n#else\nvec4 wid = 2.0 + 2.0 * pow(color, vec4(4.0));\nvec4 weights = vec4(distance / scanline_weight);\nreturn 1.4 * exp(-pow(weights * inversesqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);\n#endif\n}\n\nvoid main()\n{\n// Here\'s a helpful diagram to keep in mind while trying to\n// understand the code:\n//\n// | | | | |\n// -------------------------------\n// | | | | |\n// | 01 | 11 | 21 | 31 | <-- current scanline\n// | | @ | | |\n// -------------------------------\n// | | | | |\n// | 02 | 12 | 22 | 32 | <-- next scanline\n// | | | | |\n// -------------------------------\n// | | | | |\n//\n// Each character-cell represents a pixel on the output\n// surface, "@" represents the current pixel (always somewhere\n// in the bottom half of the current scan-line, or the top-half\n// of the next scanline). The grid of lines represents the\n// edges of the texels of the underlying texture.\n\n// Texture coordinates of the texel containing the active pixel.\nvec2 xy = (CURVATURE > 0.5) ? transform(TEX0.xy) : TEX0.xy;\n\nfloat cval = corner(xy);\n\n// Of all the pixels that are mapped onto the texel we are\n// currently rendering, which pixel are we currently rendering?\nvec2 ilvec = vec2(0.0,ilfac.y > 1.5 ? mod(float(FrameCount),2.0) : 0.0);\nvec2 ratio_scale = (xy * TextureSize - vec2(0.5) + ilvec)/ilfac;\n#ifdef OVERSAMPLE\nfloat filter_ = InputSize.y/OutputSize.y;//fwidth(ratio_scale.y);\n#endif\nvec2 uv_ratio = fract(ratio_scale);\n\n// Snap to the center of the underlying texel.\nxy = (floor(ratio_scale)*ilfac + vec2(0.5) - ilvec) / TextureSize;\n\n// Calculate Lanczos scaling coefficients describing the effect\n// of various neighbour texels in a scanline on the current\n// pixel.\nvec4 coeffs = PI * vec4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);\n\n// Prevent division by zero.\ncoeffs = FIX(coeffs);\n\n// Lanczos2 kernel.\ncoeffs = 2.0 * sin(coeffs) * sin(coeffs / 2.0) / (coeffs * coeffs);\n\n// Normalize.\ncoeffs /= dot(coeffs, vec4(1.0));\n\n// Calculate the effective colour of the current and next\n// scanlines at the horizontal location of the current pixel,\n// using the Lanczos coefficients above.\nvec4 col = clamp(mat4(\n TEX2D(xy + vec2(-one.x, 0.0)),\n TEX2D(xy),\n TEX2D(xy + vec2(one.x, 0.0)),\n TEX2D(xy + vec2(2.0 * one.x, 0.0))) * coeffs,\n 0.0, 1.0);\nvec4 col2 = clamp(mat4(\n TEX2D(xy + vec2(-one.x, one.y)),\n TEX2D(xy + vec2(0.0, one.y)),\n TEX2D(xy + one),\n TEX2D(xy + vec2(2.0 * one.x, one.y))) * coeffs,\n 0.0, 1.0);\n\n#ifndef LINEAR_PROCESSING\ncol = pow(col , vec4(CRTgamma));\ncol2 = pow(col2, vec4(CRTgamma));\n#endif\n\n// Calculate the influence of the current and next scanlines on\n// the current pixel.\nvec4 weights = scanlineWeights(uv_ratio.y, col);\nvec4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2);\n#ifdef OVERSAMPLE\nuv_ratio.y =uv_ratio.y+1.0/3.0*filter_;\nweights = (weights+scanlineWeights(uv_ratio.y, col))/3.0;\nweights2=(weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2))/3.0;\nuv_ratio.y =uv_ratio.y-2.0/3.0*filter_;\nweights=weights+scanlineWeights(abs(uv_ratio.y), col)/3.0;\nweights2=weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2)/3.0;\n#endif\n\nvec3 mul_res = (col * weights + col2 * weights2).rgb * vec3(cval);\n\n// dot-mask emulation:\n// Output pixels are alternately tinted green and magenta.\nvec3 dotMaskWeights = mix(\nvec3(1.0, 1.0 - DOTMASK, 1.0),\nvec3(1.0 - DOTMASK, 1.0, 1.0 - DOTMASK),\nfloor(mod(mod_factor, 2.0))\n);\n\nmul_res *= dotMaskWeights;\n\n// Convert the image gamma for display on our output device.\nmul_res = pow(mul_res, vec3(1.0 / monitorgamma));\n\n// Color the texel.\noutput_dummy _OUT;\n_OUT._color = vec4(mul_res, 1.0);\nFragColor = _OUT._color;\nreturn;\n} \n#endif\n\n'},o=e(57),ve=e.n(o),J=e(11),K={addStyleHook:function(){V(this.elements.container,this.config.selectors.container.replace(".",""),!0),V(this.elements.container,this.config.classNames.uiSupported,!0),V(this.elements.container,this.config.classNames.hideControls,!0)},build:function(){this.listeners.media(),z.element(this.elements.controls)||(te.inject.call(this),this.listeners.controls()),this.volume=null,this.muted=null,te.updateVolume.call(this),V(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0},toggleControls:function(e){var n,t,o=this.elements.controls;o&&(n=0,t=s.call(this,".".concat(H({ejs__dialogs:!0})," > .").concat(H({ejs__dialog:!0}))),Array.from(t).forEach(function(e,t){!0!==e.hidden&&(n+=1)}),0<n?this.toggleControls(!1):this.toggleControls(Boolean(e||this.paused||o.pressed||o.hover)))}};function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if("object"===ye(e)&&e.files&&(e=e.files[0]),this.littleEndian=!1,this.offset=0,this._lastRead=null,"object"===ye(e)&&e.name&&e.size){if("function"!=typeof window.FileReader)throw new Error("Incompatible Browser");this.fileName=e.name,this.fileType=e.type,this.fileSize=e.size,this._fileReader=new FileReader,(this._fileReader.marcFile=this)._fileReader.addEventListener("load",function(){this.marcFile._u8array=new Uint8Array(this.result),this.marcFile._dataView=new DataView(this.result),t&&t.call()},!1),this._fileReader.readAsArrayBuffer(e)}else if("object"===ye(e)&&"string"==typeof e.fileName&&"boolean"==typeof e.littleEndian){this.fileName=e.fileName,this.fileType=e.fileType,this.fileSize=e.fileSize;var n=new ArrayBuffer(e);this._u8array=new Uint8Array(this.fileType),this._dataView=new DataView(this.fileType),e.copyToFile(this,0),t&&t.call()}else if("object"===ye(e)&&"number"==typeof e.byteLength)this.fileName="file.bin",this.fileType="application/octet-stream",this.fileSize=e.byteLength,void 0!==e.buffer&&(e=e.buffer),this._u8array=new Uint8Array(e),this._dataView=new DataView(e),t&&t.call();else{if("number"!=typeof e)throw new Error("Invalid source");this.fileName="file.bin",this.fileType="application/octet-stream",this.fileSize=e,n=new ArrayBuffer(e),this._u8array=new Uint8Array(n),this._dataView=new DataView(n),t&&t.call()}}r.IS_MACHINE_LITTLE_ENDIAN=(a=new ArrayBuffer(2),new DataView(a).setInt16(0,256,!0),256===new Int16Array(a)[0]),r.prototype.seek=function(e){this.offset=e},r.prototype.skip=function(e){this.offset+=e},r.prototype.isEOF=function(){return!(this.offset<this.fileSize)},r.prototype.slice=function(e,t){var n;return t=t||this.fileSize-e,void 0!==this._u8array.buffer.slice?((n=new r(0)).fileSize=t,n._u8array=new Uint8Array(this._u8array.buffer.slice(e,e+t))):(n=new r(t),this.copyToFile(n,e,t,0)),n.fileName=this.fileName,n.fileType=this.fileType,n.littleEndian=this.littleEndian,n},r.prototype.copyToFile=function(e,t,n,o){void 0===o&&(o=t),n=n||this.fileSize-t;for(var i=0;i<n;i++)e._u8array[o+i]=this._u8array[t+i]},r.prototype.save=function(){var t;try{t=new Blob([this._u8array],{type:this.fileType})}catch(e){if(window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,"InvalidStateError"!==e.name||!window.BlobBuilder)throw new Error("Incompatible Browser");var n=new BlobBuilder;n.append(this._u8array.buffer),t=n.getBlob(this.fileType)}saveAs(t,this.fileName)},r.prototype.readU8=function(){return this._lastRead=this._u8array[this.offset],this.offset++,this._lastRead},r.prototype.readU16=function(){return this.littleEndian?this._lastRead=this._u8array[this.offset]+(this._u8array[this.offset+1]<<8):this._lastRead=(this._u8array[this.offset]<<8)+this._u8array[this.offset+1],this.offset+=2,this._lastRead>>>0},r.prototype.readU24=function(){return this.littleEndian?this._lastRead=this._u8array[this.offset]+(this._u8array[this.offset+1]<<8)+(this._u8array[this.offset+2]<<16):this._lastRead=(this._u8array[this.offset]<<16)+(this._u8array[this.offset+1]<<8)+this._u8array[this.offset+2],this.offset+=3,this._lastRead>>>0},r.prototype.readU32=function(){return this.littleEndian?this._lastRead=this._u8array[this.offset]+(this._u8array[this.offset+1]<<8)+(this._u8array[this.offset+2]<<16)+(this._u8array[this.offset+3]<<24):this._lastRead=(this._u8array[this.offset]<<24)+(this._u8array[this.offset+1]<<16)+(this._u8array[this.offset+2]<<8)+this._u8array[this.offset+3],this.offset+=4,this._lastRead>>>0},r.prototype.readBytes=function(e){this._lastRead=new Array(e);for(var t=0;t<e;t++)this._lastRead[t]=this._u8array[this.offset+t];return this.offset+=e,this._lastRead},r.prototype.readString=function(e){this._lastRead="";for(var t=0;t<e&&this.offset+t<this.fileSize&&0<this._u8array[this.offset+t];t++)this._lastRead=this._lastRead+String.fromCharCode(this._u8array[this.offset+t]);return this.offset+=e,this._lastRead},r.prototype.writeU8=function(e){this._u8array[this.offset]=e,this.offset++},r.prototype.writeU16=function(e){this.littleEndian?(this._u8array[this.offset]=255&e,this._u8array[this.offset+1]=e>>8):(this._u8array[this.offset]=e>>8,this._u8array[this.offset+1]=255&e),this.offset+=2},r.prototype.writeU24=function(e){this.littleEndian?(this._u8array[this.offset]=255&e,this._u8array[this.offset+1]=(65280&e)>>8,this._u8array[this.offset+2]=(16711680&e)>>16):(this._u8array[this.offset]=(16711680&e)>>16,this._u8array[this.offset+1]=(65280&e)>>8,this._u8array[this.offset+2]=255&e),this.offset+=3},r.prototype.writeU32=function(e){this.littleEndian?(this._u8array[this.offset]=255&e,this._u8array[this.offset+1]=(65280&e)>>8,this._u8array[this.offset+2]=(16711680&e)>>16,this._u8array[this.offset+3]=(4278190080&e)>>24):(this._u8array[this.offset]=(4278190080&e)>>24,this._u8array[this.offset+1]=(16711680&e)>>16,this._u8array[this.offset+2]=(65280&e)>>8,this._u8array[this.offset+3]=255&e),this.offset+=4},r.prototype.writeBytes=function(e){for(var t=0;t<e.length;t++)this._u8array[this.offset+t]=e[t];this.offset+=e.length},r.prototype.writeString=function(e,t){t=t||e.length;for(var n=0;n<e.length&&n<t;n++)this._u8array[this.offset+n]=e.charCodeAt(n);for(;n<t;n++)this._u8array[this.offset+n]=0;this.offset+=t};var Q=r,c=0;function d(){this.records=[],this.truncate=!1}function be(e){var t=new d;e.seek(5);for(var n,o;!e.isEOF();){if(4542278===(n=e.readU24())){if(e.isEOF())break;if(e.offset+3===e.fileSize){t.truncate=e.readU24();break}}(o=e.readU16())===c?t.addRLERecord(n,e.readU16(),e.readU8()):t.addSimpleRecord(n,e.readBytes(o))}return t}d.prototype.addSimpleRecord=function(e,t){this.records.push({offset:e,type:1,length:t.length,data:t})},d.prototype.addRLERecord=function(e,t,n){this.records.push({offset:e,type:c,length:t,byte:n})},d.prototype.toString=function(){nSimpleRecords=0;for(var e=nRLERecords=0;e<this.records.length;e++)this.records[e].type===c?nRLERecords++:nSimpleRecords++;var t="Simple records: "+nSimpleRecords,t=(t+="\nRLE records: "+nRLERecords)+("\nTotal records: "+this.records.length);return this.truncate&&(t+="\nTruncate at: 0x"+this.truncate.toString(16)),t},d.prototype.export=function(e){for(var t=5,n=0;n<this.records.length;n++)this.records[n].type===c?t+=8:t+=5+this.records[n].data.length;for(t+=3,this.truncate&&(t+=3),(tempFile=new Q(t)).fileName=e+".ips",tempFile.writeString("PATCH"),n=0;n<this.records.length;n++){var o=this.records[n];tempFile.writeU24(o.offset),o.type===c?(tempFile.writeU16(0),tempFile.writeU16(o.length),tempFile.writeU8(o.byte)):(tempFile.writeU16(o.data.length),tempFile.writeBytes(o.data))}return tempFile.writeString("EOF"),o.truncate&&tempFile.writeU24(o.truncate),tempFile},d.prototype.apply=function(e){var t;if(this.truncate)t=e.slice(0,this.truncate);else{for(var n=e.fileSize,o=0;o<this.records.length;o++){var i=this.records[o];i.type===c?i.offset+i.length>n&&(n=i.offset+i.length):i.offset+i.data.length>n&&(n=i.offset+i.data.length)}n===e.fileSize?t=e.slice(0,e.fileSize):(t=new Q(n),e.copyToFile(t,0))}for(e.seek(0),o=0;o<this.records.length;o++)if(t.seek(this.records[o].offset),this.records[o].type===c)for(var a=0;a<this.records[o].length;a++)t.writeU8(this.records[o].byte);else t.writeBytes(this.records[o].data);return t},"0123456789abcdef".split("");var we=function(){for(var e=[],t=0;t<256;t++){for(var n=t,o=0;o<8;o++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e}();function $(e,t,n){for(var o=t?new Uint8Array(e._u8array.buffer,t):e._u8array,i=-1,a=n?o.length-4:o.length,r=0;r<a;r++)i=i>>>8^we[255&(i^o[r])];return(-1^i)>>>0}var _e=1,Se=2,Te=3;function xe(){this.sourceSize=0,this.targetSize=0,this.metaData="",this.actions=[],this.sourceChecksum=0,this.targetChecksum=0,this.patchChecksum=0}function Ce(e){e.readVLV=Ee,e.littleEndian=!0;var t=new xe,n=(e.seek(4),t.sourceSize=e.readVLV(),t.targetSize=e.readVLV(),e.readVLV());n&&(t.metaData=e.readString(n));for(var o=e.fileSize-12;e.offset<o;){var i,a=e.readVLV(),a={type:3&a,length:1+(a>>2)};a.type===_e?a.bytes=e.readBytes(a.length):a.type!==Se&&a.type!==Te||(i=e.readVLV(),a.relativeOffset=(1&i?-1:1)*(i>>1)),t.actions.push(a)}if(t.sourceChecksum=e.readU32(),t.targetChecksum=e.readU32(),t.patchChecksum=e.readU32(),t.patchChecksum!==$(e,0,!0))throw new Error("error_crc_patch");return t}function Ee(){for(var e=0,t=1;;){var n=this.readU8();if(e+=(127&n)*t,128&n)break;e+=t<<=7}return this._lastRead=e}function Ae(e){for(;;){var t=127&e;if(0==(e>>=7)){this.writeU8(128|t);break}this.writeU8(t),e--}}function Me(e){for(var t=0;;){if(0==(e>>=7)){t++;break}t++,e--}return t}xe.prototype.toString=function(){var e="Source size: "+this.sourceSize;return(e=(e+="\nTarget size: "+this.targetSize)+("\nMetadata: "+this.metaData))+("\n#Actions: "+this.actions.length)},xe.prototype.validateSource=function(e,t){return this.sourceChecksum===$(e,t)},xe.prototype.apply=function(e,t){if(t&&!this.validateSource(e))throw new Error("error_crc_input");for(var n=new Q(this.targetSize),o=0,i=0,a=0;a<this.actions.length;a++){var r=this.actions[a];if(0===r.type)e.copyToFile(n,n.offset,r.length),n.skip(r.length);else if(r.type===_e)n.writeBytes(r.bytes);else if(r.type===Se){o+=r.relativeOffset;for(var s=r.length;s--;)n.writeU8(e._u8array[o]),o++}else if(r.type===Te)for(i+=r.relativeOffset,s=r.length;s--;)n.writeU8(n._u8array[i]),i++}if(t&&this.targetChecksum!==$(n))throw new Error("error_crc_output");return n},xe.prototype.export=function(e){for(var t="BPS1".length,t=(t=(t=(t+=Me(this.sourceSize))+Me(this.targetSize))+Me(this.metaData.length))+this.metaData.length,n=0;n<this.actions.length;n++)t+=Me(((i=this.actions[n]).length-1<<2)+i.type),i.type===_e?t+=i.length:i.type!==Se&&i.type!==Te||(t+=Me((Math.abs(i.relativeOffset)<<1)+(i.relativeOffset<0?1:0)));var o=new Q(t+=12);for(o.fileName=e+".bps",o.littleEndian=!0,o.writeVLV=Ae,o.writeString("BPS1"),o.writeVLV(this.sourceSize),o.writeVLV(this.targetSize),o.writeVLV(this.metaData.length),o.writeString(this.metaData,this.metaData.length),n=0;n<this.actions.length;n++){var i=this.actions[n];o.writeVLV((i.length-1<<2)+i.type),i.type===_e?o.writeBytes(i.bytes):i.type!==Se&&i.type!==Te||o.writeVLV((Math.abs(i.relativeOffset)<<1)+(i.relativeOffset<0?1:0))}return o.writeU32(this.sourceChecksum),o.writeU32(this.targetChecksum),o.writeU32(this.patchChecksum),o};var ke="UPS1";function u(){this.records=[],this.sizeInput=0,this.sizeOutput=0,this.checksumInput=0,this.checksumOutput=0}function Oe(e){for(;;){var t=127&e;if(0==(e>>=7)){this.writeU8(128|t);break}this.writeU8(t),--e}}function Re(){for(var e=0,t=1;;){var n=this.readU8();if(-1==n)throw new Error("Can't read UPS VLV at 0x"+(this.offset-1).toString(16));if(e+=(127&n)*t,0!=(128&n))break;e+=t<<=7}return e}function Pe(e){for(var t=0;t++,0!=(e>>=7);)--e;return t}function Ie(e){var t=new u;for(e.readVLV=Re,e.seek(ke.length),t.sizeInput=e.readVLV(),t.sizeOutput=e.readVLV();e.offset<e.fileSize-12;){for(var n=e.readVLV(),o=[];e.readU8();)o.push(e._lastRead);t.addRecord(n,o)}return e.littleEndian=!0,t.checksumInput=e.readU32(),t.checksumOutput=e.readU32(),e.littleEndian=!1,t}u.prototype.addRecord=function(e,t){this.records.push({offset:e,XORdata:t})},u.prototype.toString=function(){var e="Records: "+(void 0).records.length;return(e=(e=(e+="\nInput file size: "+(void 0).sizeInput)+("\nOutput file size: "+(void 0).sizeOutput))+("\nInput file checksum: "+padZeroes((void 0).checksumInput,4)))+("\nOutput file checksum: "+padZeroes((void 0).checksumOutput,4))},u.prototype.export=function(e){for(var t=ke.length,t=(t+=Pe(this.sizeInput))+Pe(this.sizeOutput),n=0;n<this.records.length;n++)t=(t+=Pe(this.records[n].offset))+(this.records[n].XORdata.length+1);for((tempFile=new Q(t+=12)).writeVLV=Oe,tempFile.fileName=e+".ups",tempFile.writeString(ke),tempFile.writeVLV(this.sizeInput),tempFile.writeVLV(this.sizeOutput),n=0;n<this.records.length;n++)tempFile.writeVLV(this.records[n].offset),tempFile.writeBytes(this.records[n].XORdata),tempFile.writeU8(0);return tempFile.littleEndian=!0,tempFile.writeU32(this.checksumInput),tempFile.writeU32(this.checksumOutput),tempFile.writeU32($(tempFile,0,!0)),tempFile},u.prototype.validateSource=function(e,t){return $(e,t)===this.checksumInput},u.prototype.apply=function(e,t){t&&this.validateSource(e),tempFile=new Q(this.sizeOutput),e.copyToFile(tempFile,0,this.sizeInput),e.seek(0);for(var n=0;n<this.records.length;n++){var o=this.records[n];tempFile.skip(o.offset),e.skip(o.offset);for(var i=0;i<o.XORdata.length;i++)tempFile.writeU8((e.isEOF()?0:e.readU8())^o.XORdata[i]);tempFile.skip(1),e.skip(1)}return t&&($(tempFile),this.checksumOutput),tempFile};var o=e(160),Ne=e.n(o),Z={_FS:{createPath:function(e,t,n,o){Z.FS&&("function"!=typeof Z.FS.createPath?Z.FS.mkdir(t):Z.FS.createPath(e,t,n,o))},createDataFile:function(e,t,n,o,i,a){var r,s;Z.FS&&("function"!=typeof Z.FS.createDataFile?(s=t,r=(r=e).endsWith("/")||s.startsWith("/")?r+s:r+"/"+s,Z.FS.writeFile(r,n)):Z.FS.createDataFile(e,t,n,o,i,a))},createFolder:function(e,t,n,o){var i,a;Z.FS&&("function"!=typeof Z.FS.createFolder?(a=t,i=(i=e).endsWith("/")||a.startsWith("/")?i+a:i+"/"+a,Z.FS.mkdir(i)):Z.FS.createFolder(e,t,n,o))}},romdb:null,supportBatterySave:!1,hash:"2b35cacf70ae",hash2:"f5cbb3f38c0bb20e4",hash3:"88cc8ad0c350400499a0",loading:null,gamePatch:null,saveFilenames:[],FS:null,Module:null,aspectRatio:4/3,memData:null,wasmData:null,coreFileData:{},coreFileName:"",coreFileVersion:"",isMobileDevice:!!/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i.test(navigator.userAgent||""),create:function(){var p=this;window.URL=window.URL||window.webkitURL;var e,n=!1,o=!1,i=!1,f=0,h=!1,m={psx:["bin","iso","cue","img","mdf","pbp","toc","cbn","m3u"],nds:["nds","bin"],nes:["fds","nes","unif","unf"],snes:["smc","fig","sfc","gd3","gd7","dx2","bsx","swc"],snes2002:["smc","fig","sfc","gd3","gd7","dx2","bsx","swc"],snes2005:["smc","fig","sfc","gd3","gd7","dx2","bsx","swc"],snes2010:["smc","fig","sfc","gd3","gd7","dx2","bsx","swc"],gb:["gb","gbc","dmg"],gba:["gb","gbc","gba"],vbanext:["gba"],vb:["vb","vboy","bin"],"3do":["iso","bin","cue"],lynx:["lnx"],jaguar:["j64","jag","rom","abs","cof","bin","prg"],a7800:["a78","bin"],a2600:["a26","bin"],ngp:["ngp","ngc"],n64:["n64","v64","z64","bin","u1","ndd"],pce:["pce","bin","iso","cue","ccd","img","chd"],sega:["mdx","md","smd","gen","bin","iso","cue","sms","gg","sg","68k","chd"],segacd:["mdx","md","smd","gen","bin","iso","cue","sms","gg","sg","68k","chd"],"32x":["32x","bin","gen","smd","md","cue","iso","sms"],saturn:["bin","cue","iso"],msx:["rom","mx1","mx2","dsk","cas"],bluemsx:["rom","ri","mx1","mx2","col","dsk","cas","sg","sc","m3u"],ws:["ws","wsc"],arcade:["zip"],"fba0.2.97.29":["zip"],mame2003:["zip"],mame:["zip"],dos:["zip"]},g={psx:"psx",nds:"nds",nes:"nes",snes:"snes",snes2002:"snes2002",snes2005:"snes2005",snes2010:"snes2010",gb:"gb",gbc:"gb",gba:"gba",vbanext:"vbanext",vb:"vb",n64:"n64","3do":"3do",segaMS:"sega",segaGG:"sega",segaMD:"sega",segaCD:"segacd",sega32x:"32x",segaSaturn:"saturn",ngp:"ngp",pce:"pce",msx:"bluemsx",atari2600:"a2600",atari7800:"a7800",lynx:"lynx",ws:"ws",arcade:"arcade","fba0.2.97.29":"fba0.2.97.29",jaguar:"jaguar",mame2003:"mame2003",dos:"dos"},v=this,y=v.system,b=v.customPaths&&"string"==typeof v.customPaths["extract7z.js"]?v.customPaths["extract7z.js"]:v.dataPath+"extract7z.js",w=v.customPaths&&"string"==typeof v.customPaths["extractzip.js"]?v.customPaths["extractzip.js"]:v.dataPath+"extractzip.js?v=1",_=v.customPaths&&"string"==typeof v.customPaths["libunrar.js"]?v.customPaths["libunrar.js"]:v.dataPath+"libunrar.js",S=j("canvas",{}),T=(this.game.appendChild(S),Z.loading=j("div",{class:this.config.classNames.loading}),this.elements.container.appendChild(Z.loading),{"loading-info":H({"loading-info":!0}),ad:H({ad:!0}),"close-ad":H({"close-ad":!0}),"start-game":H({"start-game":!0}),on:H({on:!0}),p1:H({p1:!0}),p2:H({p2:!0}),p3:H({p3:!0}),p4:H({p4:!0})}),a=("string"==typeof v.adUrl?(Z.loading.innerHTML='\n <div>\n <div class="'+T.ad+'" style="display:block !important;width:300px !important">\n <div class="'+T["close-ad"]+'" hidden><a href="#" onclick="return false"></a></div>\n <iframe scrolling="no" frameborder="no" style="width:300px !important;height:250px !important;display: block !important;" src="'+v.adUrl+'"></iframe>\n </div>\n <div class="'+T["loading-info"]+'" style="position: absolute;bottom: 20px;left: 50%;transform: translateX(-50%);">\n <div class="'+T.p1+'"></div>\n <div class="'+T.p2+'"></div>\n <div class="'+T.p3+'"></div>\n </div>\n <div style="position: absolute;bottom: 20px;left: 50%;transform: translateX(-50%);">\n <a href="#" onclick="return false" class="'+T["start-game"]+'">'+de("playNow",v.config)+"</a>\n </div>\n </div>",e=j("iframe",{src:v.adUrl,scrolling:"no",frameborder:"no",style:"width:300px !important;height:250px !important;display: block !important;"}),Z.loading.querySelector(".".concat(T.ad)).removeChild(Z.loading.querySelector(".".concat(T.ad," iframe"))),Z.loading.querySelector(".".concat(T.ad)).appendChild(e),X.webgl.DETECTED||(G(Z.loading.querySelector(".".concat(T["start-game"])),!0),Z.loading.querySelector(".".concat(T.p3)).innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">Failed to initialize WebGL.</strong>'),Z.loading.querySelector(".".concat(T.ad," iframe")).style.setProperty("display","block","important"),Z.loading.querySelector(".".concat(T.ad," iframe")).style.setProperty("visibility","visible","important"),Z.loading.querySelector(".".concat(T.ad)).style.setProperty("display","block","important"),Z.loading.querySelector(".".concat(T.ad)).style.setProperty("visibility","visible","important")):(Z.loading.innerHTML='\n <div>\n <div class="'.concat(T["loading-info"],'" style="position: absolute;bottom: 20px;left: 50%;transform: translateX(-50%);">\n <div class="').concat(T.p1,'"></div>\n <div class="').concat(T.p2,'"></div>\n <div class="').concat(T.p3,'"></div>\n </div>\n <div style="position: absolute;bottom: 20px;left: 50%;transform: translateX(-50%);">\n <a href="#" onclick="return false" class="').concat(T["start-game"],'">').concat(de("playNow",v.config),"</a>\n </div>\n </div>"),X.webgl.DETECTED||(G(Z.loading.querySelector(".".concat(T["start-game"])),!0),Z.loading.querySelector(".".concat(T.p3)).innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">Failed to initialize WebGL.</strong>')),window.URL||window.webkitURL),x=function(e){var t;return 80===e[0]&&75===e[1]&&3===e[2]&&4===e[3]||80===e[0]&&75===e[1]&&5===e[2]&&6===e[3]||80===e[0]&&75===e[1]&&7===e[2]&&8===e[3]?t="zip":55===e[0]&&122===e[1]&&188===e[2]&&175===e[3]&&39===e[4]&&28===e[5]?t="7z":82===e[0]&&97===e[1]&&114===e[2]&&33===e[3]&&26===e[4]&&7===e[5]&&0==e[6]&&(t="rar"),t},C=function(e){var e=new Blob(['importScripts("'+e+'");'],{type:"application/javascript"}),n=window.URL.createObjectURL(e);return new Promise(function(e,t){e(new Worker(n))})},E=function(e,t){var n="",t=("rar"==t&&(n="\nvar dataToPass = [];\nModule = {\n monitorRunDependencies: function(left) {\n if (left == 0) {\n setTimeout(function() {\n unrar(dataToPass, null);\n }, 100);\n }\n },\n onRuntimeInitialized: function() {\n },\n locateFile: function(file) {\n return '".concat(e+".mem","';\n }\n};\nimportScripts(\"").concat(e,'");\nvar unrar = function(data, password) {\n var cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n var rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n var rec = function(entry) {\n if (entry.type === \'file\') {\n postMessage({"t":2,"file":entry.fullFileName,"size":entry.fileSize,"data":entry.fileContent});\n } else if (entry.type === \'dir\') {\n Object.keys(entry.ls).forEach(function(k) {\n rec(entry.ls[k]);\n })\n } else {\n throw "Unknown type";\n }\n }\n rec(rarContent);\n postMessage({"t":1});\n return rarContent;\n};\nonmessage = function(data) {\n dataToPass.push({name: \'test.rar\', content: data.data});\n};\n ')),new Blob([n],{type:"application/javascript"})),o=window.URL.createObjectURL(t);return new Promise(function(e,t){e(new Worker(o))})},A=null,d=null,c=null,u=null;try{A=new ve.a({dbVersion:1,storePrefix:"ejs-",storeName:"system",keyPath:null,autoIncrement:!1,onStoreReady:function(){n=!0},onError:function(){n=!0}}),d=new ve.a({dbVersion:1,storePrefix:"ejs-",storeName:"roms",keyPath:null,autoIncrement:!1,onStoreReady:function(){o=!0},onError:function(){o=!0}}),c=new ve.a({dbVersion:1,storePrefix:"ejs-",storeName:"bios",keyPath:null,autoIncrement:!1,onStoreReady:function(){i=!0},onError:function(){i=!0}}),u=new ve.a({dbVersion:1,storePrefix:"ejs-",storeName:"romsdata",keyPath:null,autoIncrement:!1,onStoreReady:function(){},onError:function(){}})}catch(e){i=o=n=!0,console.log(e)}U.call(v,v.elements.container,"start-game",function(e){v.started=!0,v.playing=!0,G(Z.loading.querySelector(".".concat(T["loading-info"])),!0),!ee||"undefined"!=ee.virtualGamepadContainer&&null!==ee.virtualGamepadContainer||K.toggleControls.call(v,!0);var t,n,o,i,a,r,s,c,l=H({"ejs__tooltip--visible":!0}),d=v.elements.buttons.gamepad.querySelector(".".concat(H({ejs__tooltip:!0}))),u=(V(d,l,!0),setTimeout(function(){V(d,l,!1)},5e3),"string"==typeof v.adUrl&&(G(Z.loading.querySelector(".".concat(T["close-ad"])),!1),!0!==v.config.noAutoAdClose&&setTimeout(function(){v.started&&Z.loading.querySelector(".".concat(T.ad))&&Z.loading.querySelector(".".concat(T.ad)).parentNode.removeChild(Z.loading.querySelector(".".concat(T.ad)))},1e4)),G(Z.loading.querySelector(".".concat(T["start-game"])),!0),Y(te.defaultCoreOptionsValues.call(p),te.storage.get("core-options")||{})),f=("n64"===v.system&&u&&Object.keys(u).forEach(function(e){"glupen64-aspect"===e&&"16:9"===u[e]&&(S.height=S.width/16*9,Z.aspectRatio=16/9)}),"arcade"!==p.system&&"fba0.2.97.29"!==p.system||u&&Object.keys(u).forEach(function(e){"fba-aspect"===e&&"PAR"===u[e]&&(S.height=S.width/16*9,Z.aspectRatio=16/9)}),"gba"===v.system&&(S.height=S.width/1.5,Z.aspectRatio=1.5),window.setTimeout(function(){},150),f=p,"undefined"!=typeof RI?(document.removeEventListener("mousemove",RI.eventHandler,!1),S.removeEventListener("mousedown",RI.canvasEventHandler,!1),S.removeEventListener("mouseup",RI.canvasEventHandler,!1),f.elements.container.addEventListener("mousemove",function(e){var t=0,n=0,o=e.offsetX-Z.Module.canvas.offsetLeft,i=e.offsetY-Z.Module.canvas.offsetTop;if("mousemove"===e.type){t=o<0?(o=0,-Z.Module.canvas.offsetWidth):o>Z.Module.canvas.offsetWidth?(o=Z.Module.canvas.offsetWidth,Z.Module.canvas.offsetWidth):o-RI.currentX,n=i<0?(i=0,-Z.Module.canvas.offsetHeight):i>Z.Module.canvas.offsetHeight?(i=Z.Module.canvas.offsetHeight,Z.Module.canvas.offsetHeight):i-RI.currentY,RI.currentX=o,RI.currentY=i;for(var a=0;a<RI.contexts.length;a+=1)HEAP32[RI.contexts[a].state+32>>2]=t,HEAP32[RI.contexts[a].state+36>>2]=n}},!1),f.elements.container.addEventListener("mousedown",RI.canvasEventHandler,!1),f.elements.container.addEventListener("mouseup",RI.canvasEventHandler,!1),f.elements.container.addEventListener("touchstart",t=function(e){if(e.targetTouches[0]){var t,n=0,o=0,i=e.target.getBoundingClientRect(),a=e.targetTouches[0].clientX-i.left,i=e.targetTouches[0].clientY-i.top,n=a<0?(a=0,-Z.Module.canvas.offsetWidth):a>Z.Module.canvas.offsetWidth?(a=Z.Module.canvas.offsetWidth,Z.Module.canvas.offsetWidth):a-RI.currentX,o=i<0?(i=0,-Z.Module.canvas.offsetHeight):i>Z.Module.canvas.offsetHeight?(i=Z.Module.canvas.offsetHeight,Z.Module.canvas.offsetHeight):i-RI.currentY;RI.currentX=a,RI.currentY=i;for(var r=0;r<RI.contexts.length;r+=1)HEAP32[RI.contexts[r].state+32>>2]=n,HEAP32[RI.contexts[r].state+36>>2]=o;switch(e.type){case"touchend":case"touchstart":if(0===e.button)t=40;else{if(2!==e.button)break;t=41}for(var s="touchend"===e.type?0:1,c=0;c<RI.contexts.length;c+=1)HEAP8[RI.contexts[c].state+t>>0]=s}}},!1),f.elements.container.addEventListener("touchend",t,!1)):(f=function(e){e=new MouseEvent(e.type,e);Z.Module.canvas.dispatchEvent(e)},q.call(p,".".concat(H({ejs__dialogs:!0}))).addEventListener("mousemove",f,!1),q.call(p,".".concat(H({ejs__dialogs:!0}))).addEventListener("mousedown",f,!1),q.call(p,".".concat(H({ejs__dialogs:!0}))).addEventListener("mouseup",f,!1)),"msx"===v.system&&"undefined"!=typeof RI&&(document.removeEventListener("keydown",RI.eventHandler,!1),document.removeEventListener("keyup",RI.eventHandler,!1),t=function(e){var t=e.keyCode,n=t>>3,o=1<<(7&t);switch(e.type){case"keyup":case"keydown":if(32<=n)throw"key code error! bad code: "+t;for(var i=0;i<RI.contexts.length;i++){var a=HEAP8[RI.contexts[i].state+n>>0];"keyup"===e.type?a&=~o:a|=o,HEAP8[RI.contexts[i].state+n>>0]=a}}},document.addEventListener("keydown",t,!1),document.addEventListener("keyup",t,!1)),setTimeout(function(){var i=W.info();null===ee.setVolume&&"undefined"!=typeof RA?(RA.queueAudio=function(){var e=v.volume,t=RA.bufIndex,n=RA.bufIndex?RA.buffers[RA.bufIndex-1].endTime:RA.context.currentTime,o=(RA.buffers[t].endTime=n+RA.buffers[t].duration,RA.context.createBufferSource());o.buffer=RA.buffers[t],1===(e=v.muted?0:e)?o.connect(RA.context.destination):(t=RA.context.createGain(),o.connect(t),t.connect(RA.context.destination),W.isEdge||"chrome"===i.name&&parseInt(i.version,10)<=60||"firefox"===i.name&&parseInt(i.version,10)<=56||"opera"===i.name&&parseInt(i.version,10)<=44?t.gain.value=e:"firefox"===i.name?t.gain.setValueAtTime(e,RA.context.currentTime):t.gain.setValueAtTime(e,RA.context.currentTime,0)),o.start(n),RA.bufIndex+=1,RA.bufOffset=0},W.isIos&&window.addEventListener("touchstart",function(){var e;RA.context&&(RA.context.resume(),(e=RA.context.createBufferSource()).connect(RA.context.destination),e.start())},!1)):ee.setVolume()},500),setTimeout(function(){v.elements.container.focus()},30),void 0===window.addRunDependency&&(window.Module=void 0),Z.FS.readFile(v.startName));f.length<=33554432&&".cue"!=v.startName.substr(-4)&&(o="snes"===v.system||["snes2002","snes2005","snes2010"].includes(v.system)?(n=f.length%1024,new Q(n?f.slice?f.slice(n):f.subarray(n):f)):new Q(f),i=Ne.a.create(),a=new FileReader,r=0,s=o._u8array.length,c=function(){var e;r<s?(e=Math.min(r+2097152,s),a.readAsArrayBuffer(new Blob([o._u8array.slice(r,e)])),r=e):(console.log(i.hex()),v.hash=i.hex(),"function"==typeof window.ejsromshash&&window.ejsromshash(v.hash))},a.onload=function(e){try{i.update(e.target.result),c()}catch(e){console.log(e)}},c())}),"string"==typeof v.adUrl&&U.call(v,Z.loading.querySelector(".".concat(T["close-ad"])),"click",function(e){e instanceof MouseEvent&&v.started&&Z.loading.querySelector(".".concat(T.ad))&&Z.loading.querySelector(".".concat(T.ad)).parentNode.removeChild(Z.loading.querySelector(".".concat(T.ad))),v.elements.container.focus()});var p=this,M=function(){d.db&&d.getAll(function(e){Array.isArray(e)&&10<e.length&&e.sort(function(e,t){return(t.lastaccess||0)-(e.lastaccess||0)}).forEach(function(e,t){10<t&&!Z.saveFilenames.includes(e.key)?(d.remove(e.key),u.db&&u.remove(e.key)):(delete e.data,d.put(e.key,e))})},function(){d.clear(),u.db&&u.clear()})},k=function(e){if(Z.gamePatch){var t=e.startName.split("/"),n=t.pop().split(".").pop(),o=(Z.gamePatch.split(".").pop(),Z.gamePatch.split("/").pop().split(".").shift()),t=(t="".concat(t.join("/"),"/").concat(o,".").concat(n)).replace(/\#/g,""),o=Z.gamePatch;if(Z.FS.rename(e.startName,t),e.startName=t,"snes"===e.system||["snes2002","snes2005","snes2010"].includes(e.system)){var i,a,r,s,n=new Q(Z.FS.readFile(e.startName)),t=$(n),c=new Q(Z.FS.readFile(o)),l=c.readString(6),d=n._u8array.length%1024;l.startsWith("PATCH")?(i=be(c),0==d&&"B19ED489"===t.toString(16).toUpperCase()&&((a=new Uint8Array(n._u8array.length+512)).set(new Uint8Array(512),0),a.set(n._u8array,512),n=new Q(a))):l.startsWith(ke)?i=Ie(c):l.startsWith("BPS1")&&(i=Ce(c),0<d&&"A31BEAD4"===t.toString(16).toUpperCase()&&(a=n._u8array.slice?n._u8array.slice(d):n._u8array.subarray(d),n=new Q(a)));try{(r=i.apply(n,!1))&&(0<(s=r._u8array.length%1024)&&(a=r._u8array.slice?r._u8array.slice(s):r._u8array.subarray(s),r=new Q(a)),Z.FS.unlink(o),Z.FS.unlink(e.startName),Z.FS.writeFile(e.startName,r._u8array))}catch(e){}}else{var u,f,l=new Q(Z.FS.readFile(e.startName)),c=new Q(Z.FS.readFile(o)),t=c.readString(6);t.startsWith("PATCH")?u=be(c):t.startsWith(ke)?u=Ie(c):t.startsWith("BPS1")&&(u=Ce(c));try{(f=u.apply(l,!1))&&(Z.FS.unlink(o),Z.FS.unlink(e.startName),Z.FS.writeFile(e.startName,f._u8array))}catch(e){}}}},O=function(){h?(window.Module.TOTAL_MEMORY=268435456,["jaguar"].includes(p.system)&&(window.Module.TOTAL_MEMORY=268435456),["nds","nes","snes","arcade","mame"].includes(p.system)&&(window.Module.TOTAL_MEMORY=0),["snes2002","snes2005","snes2010"].includes(p.system)&&(window.Module.TOTAL_MEMORY=0),"gba"==p.system&&(window.Module.TOTAL_MEMORY=0),"3do"==p.system&&(window.Module.TOTAL_MEMORY=0),"n64"==p.system&&(window.Module.TOTAL_MEMORY=0)):("nes"===p.system&&(window.Module.TOTAL_MEMORY=134217728),window.Module.TOTAL_MEMORY=f+67108864,["arcade","mame","mame2003","fba0.2.97.29"].includes(p.system)&&(window.Module.TOTAL_MEMORY=f+268435456,Z.isMobileDevice&&(window.Module.TOTAL_MEMORY=314572800)),["n64","nds","jaguar"].includes(p.system)&&(window.Module.TOTAL_MEMORY=f+268435456,Z.isMobileDevice&&(window.Module.TOTAL_MEMORY=314572800)),"gba"==p.system&&(window.Module.TOTAL_MEMORY=268435456)),"undefined"!=typeof EJS_MEMORY&&(window.Module.TOTAL_MEMORY=EJS_MEMORY)},R=function(e,t){function r(){var e;2===s.coreVer&&(e=Z.Module.cwrap("toggleMainLoop","null",["number"]),Z.Module.resumeMainLoop=function(){e(1)},Z.Module.pauseMainLoop=function(){e(0)}),"string"==typeof s.loadStateOnStart&&fetch(s.loadStateOnStart).then(function(e){e.arrayBuffer().then(function(e){e=new Uint8Array(e);EJS_loadState(e)})})}function n(e){if(e.data){if(1===e.data.t){c.innerHTML="Game Data ready",e.target.terminate();try{O(),k(s),M(),!s.startName&&u&&(s.startName=u);var t=[s.startName,[Z.hash,Z.hash2,Z.hash3].join("")];"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX&&t.unshift("-v"),Z.Module.callMain(t),2===v.coreVer&&(Z.Module.resumeMainLoop(),Z.Module.setCanvasSize(800,600)),F.call(s,s.elements.container,"start-game")}catch(e){console.log(e),c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">Failed to start game</strong>'}try{r()}catch(e){}}if(2===e.data.t){var n=e.data.file.split("/"),o=(i=n.pop()).split(".").pop(),i=i.replace(/\#/g,"");Z._FS.createPath("/",n.join("/"),!0,!0);for(var a=m[l].length-1;0<=a;--a)m[l][a]===o.toLowerCase()&&d<a&&(d=a,s.startName=["",n.join("/"),i].join("/"),s.startName=s.startName.replace(/\/+/,"/"));i&&(Z._FS.createDataFile("/".concat(n.join("/")),i,e.data.data,!0,!1),f+=e.data.data.length),u="/".concat(n.join("/"),"/").concat(i)}4===e.data.t&&0<e.data.total&&(t=Math.floor(e.data.current/e.data.total*100),e=e.data.name||"",t<=100&&0<t&&(c.innerHTML=p.localization("Decompress Game Data")+" ".concat(e," ").concat(t,"%")))}}var s=p,c=Z.loading.querySelector(".".concat(T.p3)),l=(e.split(".").pop(),g[y]),d=-1,u="",o=(window.EJS_terminate=function(){if(Z.Module.pauseMainLoop(),s&&s.eventListeners)for(var e in s)for(var t=0;t<s.eventListeners.length;t++)(n=s.eventListeners[t]).element.removeEventListener(n.type,n.callback,n.capture);if(window.EJS_RESET_VARS){var n=[],o=[];for(e in window)n.push(e);for(t=0;t<n.length;t++)window.EJS_RESET_VARS.includes(n[t])||o.push(n[t]);for(t=0;t<o.length;t++)window[o[t]]&&delete window[o[t]]}},!1);if(["arcade","mame","mame2003","fba0.2.97.29"].includes(s.system)||(i=t.slice?t.slice(0,10):t.subarray(0,10),"7z"===(i=x(i))?(C(b).then(function(e){e.onmessage=n,e.postMessage(t)}),o=!0):"zip"===i?(C(w).then(function(e){e.onmessage=n,e.postMessage(t)}),o=!0):"rar"==i&&(E(_,"rar").then(function(e){e.onmessage=n,e.postMessage(t)}),o=!0)),!o){var i=e.replace(/\#/g,"");try{f+=t.length,Z._FS.createDataFile("/",i,t,!0,!1)}catch(e){console.log(e)}O(),s.startName=i,k(s),M();try{var a=[s.startName,[Z.hash,Z.hash2,Z.hash3].join("")];"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX&&a.unshift("-v"),Z.Module.callMain(a),2===v.coreVer&&(Z.Module.resumeMainLoop(),Z.Module.setCanvasSize(800,600)),F.call(s,s.elements.container,"start-game")}catch(e){console.log(e),c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">Failed to start game</strong>'}try{r()}catch(e){}}},s=function(){var t=p,n=Z.loading.querySelector(".".concat(T.p3)),e=p.config,o=(e.gameId,e.gameUrl),i=e.system,e=("vbanext"==i&&(i="gba"),o.split("/")),l=e[e.length-1];(l=-1<l.indexOf("?")?l.substr(0,l.indexOf("?")):l).split(".").pop(),n.innerHTML=p.localization("Download Game Data"),["arcade","mame","mame2003","fba0.2.97.29"].includes(t.system)&&t.config.gameParentUrl&&(n.innerHTML+=" (2/2)"),t.config.gamePatchUrl&&(n.innerHTML+=" (2/2)"),J.a.head(o,{}).then(function(e){function a(){J.a.get(o,{onDownloadProgress:function(e){e=e.total?"".concat(Math.floor(e.loaded/e.total*100),"%"):"";["arcade","mame","mame2003","fba0.2.97.29"].includes(t.system)&&t.config.gameParentUrl||t.config.gamePatchUrl?n.innerHTML=p.localization("Download Game Data")+" (2/2) ".concat(e):n.innerHTML=p.localization("Download Game Data")+" ".concat(e)},responseType:"arraybuffer"}).then(function(e){var t=new Uint8Array(e.data);if(p.config.gameUrl.startsWith("blob:")||p.config.gameUrl.startsWith("file:")||p.config.gameUrl.startsWith("chrome-extension:")||("file:"==window.location.protocol||"chrome-extension:"==window.location.protocol)&&1==p.config.gameUrl.split(":").length)R(l,t);else{if(c&&d.db)if(104857600<t.length)for(var n=Math.ceil(t.length/104857600),o=0;o<n;o+=1){var i=t.slice?t.slice(104857600*o,104857600*(o+1)):t.subarray(104857600*o,104857600*(o+1)),a="".concat(c);0<o&&(a="".concat(c,"-part-").concat(o)),Z.saveFilenames.push(a),d.put(a,{filename:l,filesize:t.length,filetype:s,key:a,lastaccess:(new Date).valueOf(),next:"".concat(c,"-part-").concat(o+1)}),u.db&&u.put(a,{filename:l,filesize:t.length,filetype:s,key:a,data:i})}else Z.saveFilenames.push(c),d.put(c,{filename:l,filesize:t.length,filetype:s,key:c,lastaccess:(new Date).valueOf()}),u.db&&u.put(c,{filename:l,filesize:t.length,filetype:s,key:c,data:t});R(l,t)}}).catch(function(e){B(e,n,p)})}var r=e.headers["content-length"],s=e.headers["content-type"],c=(e.headers["last-modified"],"".concat(i,"-").concat(l));u.db?u.get(c,function(t){if(t&&t.filename===l&&t.filesize-r==0&&t.filetype===s&&t.key)if(d.get(c,function(e){e.lastaccess=(new Date).valueOf(),d.put(e.key,e)}),104857600<t.filesize){var n=new Uint8Array(t.filesize);n.set(t.data);for(var e=Math.ceil(t.filesize/104857600),o=[],i=1;i<e;i+=1)o.push("".concat(c,"-part-").concat(i)),d.get("".concat(c,"-part-").concat(i),function(e){e.lastaccess=(new Date).valueOf(),d.put(e.key,e)});u.getBatch(o,function(e){e.filter(function(e){return e}).length!==o.length?a():(e.forEach(function(e,t){n.set(e.data,104857600*(t+1))}),R(t.filename,n))},function(){},"sparse")}else R(t.filename,t.data);else a()}):a()}).catch(function(e){B(e,n,p)})},P=function(){var e,r,t=Z.loading.querySelector(".".concat(T.p3)),n=p.config.gamePatchUrl;n?(e=n.split("/"),(r=-1<(r=e[e.length-1]).indexOf("?")?r.substr(0,r.indexOf("?")):r).split(".").pop(),t.innerHTML=p.localization("Download Game Data")+" (1/2)",J.a.get(n,{onDownloadProgress:function(e){t.innerHTML=p.localization("Download Game Data")+" (1/2) ";e=e.total?"".concat(Math.floor(e.loaded/e.total*100),"%"):"";t.innerHTML+=e},responseType:"arraybuffer"}).then(function(e){var t,n,i,o,e=new Uint8Array(e.data);function a(e){var t,n,o;e.data&&(1===e.data.t&&(e.target.terminate(),s()),2===e.data.t&&(n=(t=(o=e.data.file.split("/")).pop()).split(".").pop(),Z._FS.createPath("/",o.join("/"),!0,!0),Z._FS.createDataFile("/"+o.join("/"),t,e.data.data,!0,!1),f+=e.data.data.length,["ips","bps","ups"].includes(n)&&!Z.gamePatch&&(Z.gamePatch="/"+o.join("/")+"/"+t)),4===e.data.t&&0<e.data.total&&(n=Math.floor(e.data.current/e.data.total*100),o=e.data.name||"",n<=100&&0<n&&(i.innerHTML=p.localization("Decompress Game Patch")+" ".concat(o," ").concat(n,"%"))))}t=r,n=e,i=Z.loading.querySelector(".".concat(T.p3)),t.split(".").pop(),e=!1,o=n.slice?n.slice(0,10):n.subarray(0,10),"7z"===(o=x(o))?(C(b).then(function(e){e.onmessage=a,e.postMessage(n)}),e=!0):"zip"===o?(C(w).then(function(e){e.onmessage=a,e.postMessage(n)}),e=!0):"rar"==o&&(E(_,"rar").then(function(e){e.onmessage=messageCallBack,e.postMessage(n)}),e=!0),e||(f+=n.length,Z.gamePatch="/".concat(t),Z._FS.createDataFile("/",t,n,!0,!1),s())}).catch(function(e){B(e,w,p)})):s()},l=function(){var e,l,t=p,n=Z.loading.querySelector(".".concat(T.p3)),o=p.config.gameParentUrl;o&&["arcade","mame","mame2003","fba0.2.97.29"].includes(t.system)?(e=o.split("/"),(l=-1<(l=e[e.length-1]).indexOf("?")?l.substr(0,l.indexOf("?")):l).split(".").pop(),n.innerHTML=p.localization("Download Game Data")+" (1/2)",t.config.gamePatchUrl&&(n.innerHTML=p.localization("Download Game Data")+" (1/3)"),J.a.head(o,{}).then(function(e){function a(){J.a.get(o,{onDownloadProgress:function(e){e=e.total?"".concat(Math.floor(e.loaded/e.total*100),"%"):"";n.innerHTML=p.localization("Download Game Data")+" (1/2) ".concat(e)},responseType:"arraybuffer"}).then(function(e){var t=new Uint8Array(e.data);if(c&&d.db)if(104857600<t.length)for(var n=Math.ceil(t.length/104857600),o=0;o<n;o+=1){var i=t.slice?t.slice(104857600*o,104857600*(o+1)):t.subarray(104857600*o,104857600*(o+1)),a="".concat(c);0<o&&(a="".concat(c,"-part-").concat(o)),Z.saveFilenames.push(a),d.put(a,{filename:l,filesize:t.length,filetype:s,key:a,lastaccess:(new Date).valueOf(),next:"".concat(c,"-part-").concat(o+1)}),u.db&&u.put(a,{filename:l,filesize:t.length,filetype:s,key:a,data:i})}else Z.saveFilenames.push(c),d.put(c,{filename:l,filesize:t.length,filetype:s,key:c,lastaccess:(new Date).valueOf()}),u.db&&u.put(c,{filename:l,filesize:t.length,filetype:s,key:c,data:t});e=l.replace(/\#/g,"");try{f+=t.length,Z._FS.createDataFile("/",e,t,!0,!1),P()}catch(e){console.log(e)}}).catch(function(e){B(e,n,p)})}var r=e.headers["content-length"],s=e.headers["content-type"],c=(e.headers["last-modified"],"".concat(y,"-").concat(l));u.db?u.get(c,function(t){if(t&&t.filename===l&&t.filesize-r==0&&t.filetype===s&&t.key)if(104857600<t.filesize){var n=new Uint8Array(t.filesize);n.set(t.data);for(var e=Math.ceil(t.filesize/104857600),o=[],i=1;i<e;i+=1)o.push("".concat(c,"-part-").concat(i));u.getBatch(o,function(e){e.filter(function(e){return e}).length!==o?a():(e.forEach(function(e,t){n.set(e.data,104857600*(t+1))}),Z._FS.createDataFile("/",t.filename,n,!0,!1),P())},function(){},"sparse")}else Z._FS.createDataFile("/",t.filename,t.data,!0,!1),P();else a()}):a()}).catch(function(e){B(e,n,p)})):P()},I=function(e,t){function n(e){var t,n;e.data&&(1===e.data.t&&(i.innerHTML="BIOS ready",e.target.terminate(),l()),2===e.data.t&&((n=(t=e.data.file.split("/")).pop()).split(".").pop(),Z._FS.createPath("/",t.join("/"),!0,!0),Z._FS.createDataFile("/"+t.join("/"),n,e.data.data,!0,!1),f+=e.data.data.length),4===e.data.t&&0<e.data.total&&(t=Math.floor(e.data.current/e.data.total*100),n=e.data.name||"",t<=100&&0<t&&(i.innerHTML="Decompress BIOS ".concat(n," ").concat(t,"%"))))}var o=p,i=Z.loading.querySelector(".".concat(T.p2)),a=(e.split(".").pop(),!1),r=t.slice?t.slice(0,10):t.subarray(0,10),r=x(r);"7z"===r?(C(b).then(function(e){e.onmessage=n,e.postMessage(t)}),a=!0):"zip"!==r||["arcade","mame","mame2003","fba0.2.97.29"].includes(o.system)?"rar"===r&&(E(_,"rar").then(function(e){e.onmessage=messageCallBack,e.postMessage(t)}),a=!0):(C(w).then(function(e){e.onmessage=n,e.postMessage(t)}),a=!0),a||(f+=t.length,i.innerHTML="BIOS ready",Z._FS.createDataFile("/",e,t,!0,!1),l())},r=function(){Z.loading.querySelector(".".concat(T.p1)).innerHTML="Game Core ready";var i,a,r=p.config.biosUrl,s=p,e=(ee.bindFunction.call(p),ee.setGamepadDialog.call(p),ee.setCacheDialog.call(p),ee.setLoadingDialog.call(p),ee.setNetplayDialog.call(p),ee.setCheatDialog.call(p),ee.initGamepad.call(p),ee.initKeyboard.call(p),ee.listeners.call(p),Z._FS.createFolder("/","etc",!0,!0),Z.FS.mkdir("/data"),Z.FS.mkdir("/data/saves"),"undefined"!=typeof IDBFS?Z.FS.mount(IDBFS,{},"/data/saves"):Z.FS.mount(Z.FS.filesystems.IDBFS,{},"/data/saves"),Z.FS.mkdir("/shader"),Z.FS.syncfs(!0,function(e){}),ee.initShaders(),""),t=(e=(e=(e=(e=(e+="savefile_directory = /data/saves\n")+"video_vsync = true\n"+"screenshot_directory = /\n")+"video_shader = /shader/shader.glslp\n"+"video_shader_enable = true\n")+"video_font_enable = false\n"+"video_scale = 1.0\n")+"video_gpu_screenshot = false\n"+"audio_latency = 96\n",te.defaultCoreOptionsValues.call(p)),n=(s.lightgun&&("nes"===p.system&&(e+='input_libretro_device_p2 = "258"\n'),"segaMS"!==p.system&&"segaMD"!==p.system&&"segaCD"!==p.system||(t.genesis_plus_gx_gun_cursor="yes",t.genesis_plus_gx_invert_mouse="yes",t.genesis_plus_gx_bram="per game",e+='input_libretro_device_p2 = "260"\n'),"snes"===p.system&&(e+='input_libretro_device_p2 = "260"\n'),["snes2002","snes2005","snes2010","snesnext"].includes(p.system)&&(e+='input_libretro_device_p2 = "260"\n')),s.mouse&&("snes"===p.system&&(e+="input_libretro_device_p1 = 2\n"),["snes2002","snes2005","snes2010","snesnext"].includes(p.system)&&(e+="input_libretro_device_p1 = 2\n")),s.multitap&&("snes"===p.system&&(e+="input_libretro_device_p2 = 257\n"),["snes2002","snes2005","snes2010","snesnext"].includes(p.system)&&(e+="input_libretro_device_p2 = 257\n")),"n64"===p.system&&(e+="input_libretro_device_p1 = 5\n"),s.system,e=e+"fastforward_ratio = 1.0\n"+"video_smooth = false\n",Y(t,te.storage.get("core-options")||{})),o="";2===s.coreVer?(Z._FS.createDataFile("/etc","retroarch.cfg",e,!0,!0),Z._FS.createFolder("/home/web_user","retroarch",!0,!0),Z._FS.createFolder("/home/web_user/retroarch","userdata",!0,!0),Z._FS.createDataFile("/home/web_user/retroarch/userdata","retroarch.cfg",o,!0,!0)):(Z._FS.createDataFile("/etc","retroarch.cfg",e,!0,!0),Z._FS.createFolder("/home/web_user",".config",!0,!0),Z._FS.createFolder("/home/web_user/.config","retroarch",!0,!0),Z._FS.createDataFile("/home/web_user/.config/retroarch","retroarch-core-options.cfg",o,!0,!0)),n&&Object.keys(n).forEach(function(t){if(s.lightgun&&"nes"===s.system&&"system_type"===t)return!1;o+="".concat(t,' = "').concat(n[t],'"\n'),U.call(s,s.elements.container,"start-game",function(e){ee.setVariable(t,n[t])})}),r?(t=r.split("/"),(i=-1<(i=t[t.length-1]).indexOf("?")?i.substr(0,i.indexOf("?")):i).split(".").pop(),a=Z.loading.querySelector(".".concat(T.p2)),J.a.head(r,{}).then(function(e){function t(){J.a.get(r,{onDownloadProgress:function(e){e=e.total?"".concat(Math.floor(e.loaded/e.total*100),"%"):"";a.innerHTML="Download BIOS ".concat(e)},responseType:"arraybuffer"}).then(function(e){e=new Uint8Array(e.data);c.db&&c.put(y,{filename:i,filesize:e.length,filetype:o,data:e}),I(i,e)}).catch(function(e){B(e,a,p)})}var n=e.headers["content-length"],o=e.headers["content-type"],e=(e.headers["last-modified"],s.system);c.db?c.get(e,function(e){e&&e.filename===i&&e.filesize-n==0&&e.filetype===o?I(e.filename,e.data):t()}):t()}).catch(function(e){B(e,a,p)})):l()},N=function(e){e=e.byteLength?new Uint8Array(e):e;"undefined"!=typeof GLOBAL_BASE?Z.Module.HEAPU8.set(e,GLOBAL_BASE):"undefined"!=typeof Runtime&&Runtime.GLOBAL_BASE?Z.Module.HEAPU8.set(e,Runtime.GLOBAL_BASE):Z.Module.HEAPU8.set(e,8)},L=function(t){function n(e){var t,n;e.data&&(1===e.data.t&&(F.call(v,v.elements.container,"script-loaded"),e.target.terminate()),2===e.data.t&&(n=(t=e.data.file.split("/").pop()).split(".").pop(),Z.coreFileData[t]=e.data.data,"js"!==n||t.includes(".worker.js")||(i=e.data.data),"mem"===n&&(Z.memData=e.data.data),"wasm"===n&&(Z.wasmData=e.data.data)),4===e.data.t&&0<e.data.total&&(o.innerHTML=p.localization("Decompress Game Core")+" ".concat(Math.floor(e.data.current/e.data.total*100),"%")))}var o=Z.loading.querySelector(".".concat(T.p1)),i="";U.call(v,v.elements.container,"script-loaded",function(e){var t,n;null!==Z.wasmData?(window.Module.wasmBinary=Z.wasmData,O(),window.Module.monitorRunDependencies=function(e){0===e&&r()},window.Module.onRuntimeInitialized=function(){}):(O(),window.Module.monitorRunDependencies=function(e){console.log("monitorRunDependencies, ",e)},window.Module.onRuntimeInitialized=function(){Z.Module||(Z.Module=window.Module),Z.Module&&Z.Module.FS?Z.FS=Z.Module.FS:Z.FS=window.FS,console.log("onRuntimeInitialized"),r()}),n=window.Module,null!==Z.wasmData&&(n.wasmBinary=Z.wasmData),W.isIos&&null!==Z.wasmData?(t=new Blob([i],{type:"text/javascript"}),t=j("script",{src:a.createObjectURL(t)}),document.body.appendChild(t),t.onload=function(){void 0===window.addRunDependency&&"undefined"!=typeof EmulatorJS&&(Z.Module=EmulatorJS(n),EmulatorJS=void 0),null!==Z.memData&&N(Z.memData),Z.Module||(Z.Module=window.Module),Z.Module&&Z.Module.FS?Z.FS=Z.Module.FS:Z.FS=window.FS}):(i=function(e){for(var t=[],n=0;n<e.length;n+=1){var o=e[n];255<o&&(o&=255),t.push(String.fromCharCode(o))}return t.join("")}(i),window.eval(i),void 0===window.addRunDependency&&"undefined"!=typeof EmulatorJS&&(Z.Module=EmulatorJS(n),EmulatorJS=void 0),null!==Z.memData&&N(Z.memData),Z.Module||(Z.Module=window.Module),Z.Module&&Z.Module.FS?Z.FS=Z.Module.FS:Z.FS=window.FS,window.EJS_MODULE=Z.Module,window.ejs_loader=Z,window.ejs_media=ee),i=null});C(b).then(function(e){e.onmessage=n,e.postMessage(t)})},D=this;ne(Z.loading.querySelector(".".concat(T["start-game"])),"click touchstart",function(t){var e,u;return G(Z.loading.querySelector(".".concat(T["start-game"])),!0),(t=Z.loading.querySelector(".".concat(T.p1))).innerHTML=D.localization("Loading")+"...",!0===n&&!0===o&&!0===i&&(window.Module={TOTAL_MEMORY:268435456,noInitialRun:!0,arguments:[],preRun:[],postRun:[],canvas:S,print:function(e){!0===window.EJS_DEBUG_XX&&console.log(e)},printErr:function(e){!0===window.EJS_DEBUG_XX&&console.log(e)},totalDependencies:0,monitorRunDependencies:function(e){},locateFile:function(e){var t,n=null;return e.includes(".worker.js")?(Object.keys(Z.coreFileData).includes(e)&&(n=Z.coreFileData[e]),t=new Blob([""],{type:"application/javascript"}),window.URL.createObjectURL(t)):e.includes(".js.mem")&&(n=Object.keys(Z.coreFileData).includes(e)?Z.coreFileData[e]:n)?(Z.memData=null,n.buffer):e},readAsync:function(e,t,n){var o;e instanceof ArrayBuffer?setTimeout(function(){t(e)},500):((o=new XMLHttpRequest).open("GET",e,!0),o.responseType="arraybuffer",o.onload=function(){200==o.status||0==o.status&&o.response?t(o.response):n()},o.onerror=n,o.send(null))}},e=Math.ceil((new Date).valueOf()/1e3),e=v.customPaths&&"string"==typeof v.customPaths["v.json"]?v.customPaths["v.json"]:v.dataPath+"v.json?t="+e,u=function(n,o){var e=v.customPaths&&"string"==typeof v.customPaths[n]?v.customPaths[n]:2===v.coreVer?v.dataPath+"cores/"+n+"?v="+o:v.dataPath+"old/"+n+"?v="+o;J.a.get(e,{onDownloadProgress:function(e){e=e.total?"".concat(Math.floor(e.loaded/e.total*100),"%"):"";t.innerHTML=D.localization("Download Game Core")+" ".concat(e)},responseType:"arraybuffer"}).then(function(e){var t,e=new Uint8Array(e.data);A.db&&A.put(n,{version:o,data:e}),2===v.coreVer?L(e):((t=e.slice?e.slice(12):e.subarray(12)).set([55,122,188,175,39,28,0,3],0),e=null,L(t))}).catch(function(e){B(e,t,v)})},J.a.get(e,{}).then(function(e){var t=g[D.system],e=e.data[D.system],n=e.version||1,o=Boolean(e.netplay),i=Boolean(e.state),a=Boolean(e.asmjs),r=Boolean(e.wasm),e=(2!==v.coreVer&&e.old&&(a=Boolean(e.old.asmjs),r=Boolean(e.old.wasm)),"nds"!=D.system||X.wasm||(i=!1),!1===v.statesSupported&&(i=!1),Z.coreFileVersion=n,Z.coreFileName=t,!1);if(["webgl2","experimental-webgl2"].includes(X.webgl.WEBGL_CONTEXT)&&(e=!0),"undefined"!=typeof EJS_N64_LEGACY&&1==EJS_N64_LEGACY&&(e=!1),"mame"==D.system){var s=D.mameCore;if(!s||null===s||2!==s.split("|").length)return void(c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+D.localization("Missing mame config")+"</strong>");var c=s.split("|");Z.coreFileName="".concat(D.system,"-").concat(c[0]),i="1"===c[1],z.element(D.elements.buttons.saveState)&&G(D.elements.buttons.saveState,!i),z.element(D.elements.buttons.loadState)&&G(D.elements.buttons.loadState,!i),G(te.contextMenu.querySelectorAll("ul li").item(2),!i),G(te.contextMenu.querySelectorAll("ul li").item(3),!i),d=2===D.coreVer?"":D.system.concat("-old-").concat(c[0],"-wasm.data"),c[0]?(X.wasm&&r?h=!0:(c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+D.localization("Webassembly support is not detected in this browser")+"</strong>",d=""),d&&(A.db?A.get(d,function(e){e&&e.version===n?2===v.coreVer?L(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),L(e)):u(d,n)}):u(d,n))):c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+D.localization("Unsupported Game")+"</strong>"}else{var l,d=!1;if(X.wasm&&r?(l="wasm",d=!0,"n64"!==D.system||e||(l="legacy-wasm"),h=!0):a&&(d=!0,l="asmjs","n64"!==D.system||e||(l="legacy-asmjs")),!0!==(d="undefined"!=typeof EJS_CUSTOM_COREFILE?EJS_CUSTOM_COREFILE:d))return void(c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+D.localization("Please upgrade your browser to the latest version")+"</strong>");d=2===D.coreVer?t+"-"+l+".data":t+"-old-"+l+".data","undefined"!=typeof EJS_CUSTOM_COREFILE&&(d=EJS_CUSTOM_COREFILE),A.db?A.get(d,function(e){!e||e.version!==n||"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX?u(d,n):2===v.coreVer?L(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),L(e))}):u(d,n)}2!==D.coreVer||"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX||z.element(D.elements.buttons.gamepad)&&G(D.elements.buttons.gamepad,!0),o||z.element(D.elements.buttons.netplay)&&G(D.elements.buttons.netplay,!0),z.element(D.elements.buttons.saveState)&&G(D.elements.buttons.saveState,!i),z.element(D.elements.buttons.loadState)&&G(D.elements.buttons.loadState,!i),G(te.contextMenu.querySelectorAll("ul li").item(2),!i),G(te.contextMenu.querySelectorAll("ul li").item(3),!i),v.setStatesSupported(i)}).catch(function(e){B(e,t,v)}),Z.romdb=d),!1}),!0===v.startOnLoad&&Z.loading.querySelector(".".concat(T["start-game"])).click()}},m=Z,Le=e(161);function De(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Be(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}ze=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],Be(Ve.prototype,[{key:"registerTriggers",value:function(){for(var t=this,e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];n.forEach(function(e){e.addEventListener("click",function(){return t.showModal()})})}},{key:"showModal",value:function(){this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(H({"is-open":!0})),this.setFocusToFirstNode(),this.addEventListeners(),this.config.onShow(this.modal)}},{key:"closeModal",value:function(){var t=this.modal;this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.config.onClose(this.modal),this.config.awaitCloseAnimation?this.modal.addEventListener("animationend",function e(){t.classList.remove(H({"is-open":!0})),t.removeEventListener("animationend",e,!1)},!1):t.classList.remove(H({"is-open":!0}))}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(e){e.target.hasAttribute(this.config.closeTrigger)&&(this.closeModal(),e.preventDefault())}},{key:"onKeydown",value:function(e){this.config.closeByEsckey&&27===e.keyCode&&this.closeModal(e),9===e.keyCode&&this.maintainFocus(e)}},{key:"getFocusableNodes",value:function(){var t=this.modal.querySelectorAll(ze);return Object.keys(t).map(function(e){return t[e]})}},{key:"setFocusToFirstNode",value:function(){var e;this.config.disableFocus||(e=this.getFocusableNodes()).length&&e[0].focus()}},{key:"maintainFocus",value:function(e){var t,n=this.getFocusableNodes();this.modal.contains(document.activeElement)?(t=n.indexOf(document.activeElement),e.shiftKey&&0===t&&(n[n.length-1].focus(),e.preventDefault()),e.shiftKey||t!==n.length-1||(n[0].focus(),e.preventDefault())):n[0].focus()}}]),Ue=Ve;var ze,Ue,Fe,je,Ge,g={init:function(e){var n,o,t=Object.assign({},{openTrigger:"data-micromodal-trigger"},e),e=De(document.querySelectorAll("[".concat(t.openTrigger,"]"))),i=(n=t.openTrigger,o=[],e.forEach(function(e){var t=e.attributes[n].value;void 0===o[t]&&(o[t]=[]),o[t].push(e)}),o);if(!0!==t.debugMode||!1!==Ge(e,i))for(var a in i){var r=i[a];t.targetModal=a,t.triggers=De(r),new Ue(t)}},show:function(e,t){t=t||{};return t.targetModal=e,!0===t.debugMode&&!1===je(e)?Fe=null:(Fe=new Ue(t)).showModal(),Fe},close:function(){Fe.closeModal()}},v={defaultControllers:{0:{0:{value:"88",value2:"1"},1:{value:"83",value2:"3"},2:{value:"16",value2:"8"},3:{value:"13",value2:"9"},4:{value:"38",value2:"12"},5:{value:"40",value2:"13"},6:{value:"37",value2:"14"},7:{value:"39",value2:"15"},8:{value:"90",value2:"0"},9:{value:"65",value2:"2"},10:{value:"81",value2:"4"},11:{value:"69",value2:"5"},12:{value:"82",value2:"6"},13:{value:"87",value2:"7"},14:{},15:{},16:{value:"72"},17:{value:"70"},18:{value:"71"},19:{value:"84"},20:{value:"76"},21:{value:"74"},22:{value:"75"},23:{value:"73"},24:{},25:{},26:{}},1:{},2:{},3:{}},controllers:{},virtualGamepadContainer:Fe=null,keyMap:{8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",19:"pause/break",20:"caps lock",27:"escape",32:"space",33:"page up",34:"page down",35:"end",36:"home",37:"left arrow",38:"up arrow",39:"right arrow",40:"down arrow",45:"insert",46:"delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",91:"left window key",92:"right window key",93:"select key",96:"numpad 0",97:"numpad 1",98:"numpad 2",99:"numpad 3",100:"numpad 4",101:"numpad 5",102:"numpad 6",103:"numpad 7",104:"numpad 8",105:"numpad 9",106:"multiply",107:"add",109:"subtract",110:"decimal point",111:"divide",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"num lock",145:"scroll lock",186:"semi-colon",187:"equal sign",188:"comma",189:"dash",190:"period",191:"forward slash",192:"grave accent",219:"open bracket",220:"back slash",221:"close braket",222:"single quote"},saveLoaddbDB:{put:function(t,n){var o=indexedDB.open("ejs-states",1);o.onerror=function(){},o.onsuccess=function(){var e=o.result.transaction(["states"],"readwrite").objectStore("states").put(n,t);e.onerror=function(){},e.onsuccess=function(){}},o.onupgradeneeded=function(){var e=o.result;e.objectStoreNames.contains("states")||e.createObjectStore("states")}},get:function(o){return new Promise(function(t,e){var n=indexedDB.open("ejs-states",1);n.onerror=function(){},n.onsuccess=function(){var e=n.result.transaction(["states"],"readwrite").objectStore("states").get(o);e.onsuccess=async function(e){e=e.target.result;e&&t(e)},e.onerror=function(){}},n.onupgradeneeded=function(){var e=n.result;e.objectStoreNames.contains("states")||e.createObjectStore("states")}})}},saveLoadDB:function(e){try{if(te&&"function"==typeof te.getCoreOptionsValues){var t=te.getCoreOptionsValues()["save-state-location"],n=te.getCoreOptionsValues()["save-state-slot"],o=this.config.gameUrl.split("/").pop();if(this.gameName&&(o=this.gameName),!this.gameName&&this.config.gameUrl.startsWith("blob:")||!window.indexedDB)return!1;var i=o+"-"+n;if(!t||"download"===t)return!1;if("save"===e)try{var a=v.saveState();v.saveLoaddbDB.put(i,a)}catch(e){return!1}else v.saveLoaddbDB.get(i).then(function(e){EJS_loadState(e)});return!0}return!1}catch(e){return!1}},gamepad:null,allowCheat:!0,connection:null,connected:!(Ge=function(e,t){if(e.length<=0&&(console.warn("MicroModal v".concat(version,": ❗Please specify at least one %c'micromodal-trigger'"),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<a href="#" data-micromodal-trigger="my-modal"></a>')),!t)return!0;for(var n in t)je(n);return!0}),playerName:"",players:[],waitingList:{},roomMaster:null,inputsData:{},coreOptionData:{},currentFrame:0,wait:!(je=function(e){if(!document.getElementById(e))return!1}),progressHelper:{},icons:{lock:'<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="lock" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="svg-inline--fa fa-lock fa-w-14 fa-3x"><path fill="currentColor" d="M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z" class=""></path></svg>'},disableInput:!1,disableControl:function(e){if(e){for(var t=0;t<24;t+=1)v.simulateInputFn(0,t,0),v.simulateInputFn(1,t,0),v.simulateInputFn(2,t,0),v.simulateInputFn(3,t,0);v.disableInput=!0}else v.disableInput=!1},loadRoomsListTimer:null,loadRoomsList:function(){},stopLoadRooms:function(){v.loadRoomsListTimer&&clearTimeout(v.loadRoomsListTimer)},openRoom:function(){},isPaused:null,setVolume:null,setVariable:null,simulateInput:null,simulateInputFn:null,toggleShader:null,saveState:null,screenRecord:null,loadState:null,quickSaveState:null,quickLoadState:null,changeStateSlot:null,getScreenData:null,getStateInfo:null,setCheat:null,resetCheat:null,getGameCoreOptions:null,classNames:{"dialog-container":H({"dialog-container":!0}),tabs:H({tabs:!0}),"dialog-title":H({"dialog-title":!0}),"dialog-content":H({"dialog-content":!0}),"dialog-buttons":H({"dialog-buttons":!0}),overlay:H({overlay:!0}),"key-setting-popup":H({"key-setting-popup":!0}),"tabs-panel":H({"tabs-panel":!0}),"tabs-content":H({"tabs-content":!0}),"button-container":H({"button-container":!0}),set:H({set:!0}),active:H({active:!0}),"btn-cancel":H({"btn-cancel":!0}),"btn-reset":H({"btn-reset":!0}),"btn-clear":H({"btn-clear":!0}),"btn-create":H({"btn-create":!0}),"btn-submit":H({"btn-submit":!0}),"btn-join-room":H({"btn-join-room":!0}),"btn-quit":H({"btn-quit":!0}),"btn-create-room":H({"btn-create-room":!0}),"netplay-player-name":H({"netplay-player-name":!0}),"netplay-roomlist":H({"netplay-roomlist":!0}),"netplay-room-name-input":H({"netplay-room-name-input":!0}),"netplay-room-password-input":H({"netplay-room-password-input":!0}),"netplay-create-room-set":H({"netplay-create-room-set":!0}),"netplay-room":H({"netplay-room":!0}),modal:H({modal:!0}),modal__overlay:H({modal__overlay:!0}),modal__container:H({modal__container:!0}),modal__header:H({modal__header:!0}),modal__title:H({modal__title:!0}),modal__close:H({modal__close:!0}),modal__content:H({modal__content:!0}),modal__btn:H({modal__btn:!0}),"modal__btn-primary":H({"modal__btn-primary":!0}),"micromodal-slide":H({"micromodal-slide":!0}),modal__errmsg:H({modal__errmsg:!0}),modal__footer:H({modal__footer:!0}),"cheats-add":H({"cheats-add":!0}),"cheats-list":H({"cheats-list":!0}),"cheat-code-input":H({"cheat-code-input":!0}),"cheat-name-input":H({"cheat-name-input":!0}),"ejs-switch":H({"ejs-switch":!0}),"ejs-delete-cheat":H({"ejs-delete-cheat":!0})},initShaders:function(){for(var e,t=ge,n=Object.keys(t),o=0;o<n.length;o+=1)e=t[n[o]],m.FS.writeFile("/shader/".concat(n[o]),e),te.storage.get("shader")===n[o]&&m.FS.writeFile("/shader/shader.glslp",e)},setGamepadDialog:function(){var a,s=this,e=(s.elements.dialogs.gamepad.innerHTML='\n <div class="'+v.classNames["dialog-container"]+'">\n <div class="'+v.classNames["dialog-title"]+'">\n <h4>'+s.localization("Control Settings")+'</h4>\n </div>\n \n <ul class="'+v.classNames.tabs+'" id="controls-tabs">\n <li class="tabs-title" role="presentation"><a href="#" onclick="return false" role="tab" aria-controls="controls-0" aria-selected="false" id="controls-0-label">'+s.localization("Player 1")+'</a></li>\n <li class="tabs-title" role="presentation"><a href="#" onclick="return false" role="tab" aria-controls="controls-1" aria-selected="false" id="controls-1-label">'+s.localization("Player 2")+'</a></li>\n <li class="tabs-title" role="presentation"><a href="#" onclick="return false" role="tab" aria-controls="controls-2" aria-selected="false" id="controls-2-label">'+s.localization("Player 3")+'</a></li>\n <li class="tabs-title" role="presentation"><a href="#" onclick="return false" role="tab" aria-controls="controls-3" aria-selected="false" id="controls-3-label">'+s.localization("Player 4")+'</a></li>\n </ul>\n <div class="'+v.classNames["dialog-content"]+'">\n <div class="'+v.classNames["tabs-content"]+' controls">\n \n </div>\n </div>\n <div class="'+v.classNames["dialog-buttons"]+'">\n <a href="#" onclick="return false" class="'+v.classNames["btn-submit"]+'">'+s.localization("Update")+'</a>\n <a href="#" onclick="return false" class="'+v.classNames["btn-reset"]+'">'+s.localization("Reset")+'</a>\n <a href="#" onclick="return false" class="'+v.classNames["btn-clear"]+'">'+s.localization("Clear")+'</a>\n <a href="#" onclick="return false" class="'+v.classNames["btn-cancel"]+'">'+s.localization("Cancel")+'</a>\n </div>\n <div class="'+v.classNames.overlay+'" hidden>\n <div class="'+v.classNames["key-setting-popup"]+'">\n <span>[Select]</span><br />\n <div style="color:#fff !important">'+s.localization("Press keyboard or gamepad")+"</div>\n </div>\n </div>\n </div>\n ",'\n <div class="'.concat(v.classNames["tabs-panel"],'" id="controls-{index}" hidden>\n <div>\n <div style="">\n <div class="gamepad" style="font-size:12px">Connected gamepad: <span class="gamepad-name">n/a</span></div>\n </div>\n <div style="width:25%;float:left"> </div>\n <div style="font-size:12px;width:50%;float:left">\n <div class="row">\n <div style="text-align:center;width:50%;float:left">'+s.localization("Gamepad")+'</div>\n <div style="text-align:center;width:50%;float:left">'+s.localization("Keyboard")+'</div>\n </div>\n </div>\n <div style="clear:both"></div>\n </div>\n </div>')),n='\n <div class="'.concat(v.classNames["button-container"],'" data-id="{id}" data-index="{index}" data-label="{label}" style="margin-bottom:10px">\n <div style="width:25%;float:left;font-size:12px">\n <label>{label}:</label>\n </div>\n <div style="width:50%;float:left">\n <div>\n <div style="width:50%;float:left;padding: 0 5px;">\n <input style="text-align:center;height:25px;width: 100%;" type="text" data-id="{id}" data-value="" data-type="2" data-index="{index}" readonly="" placeholder="">\n </div>\n <div style="width:50%;float:left;padding: 0 5px;">\n <input style="text-align:center;height:25px;width: 100%;" type="text" data-id="{id}" data-value="" data-type="1" data-index="{index}" readonly="" placeholder="">\n </div>\n <div style="clear:both"></div>\n </div>\n </div>\n <div style="width:25%;float:left">\n <a class="').concat(v.classNames.set,'" href="#" onclick="return false">'+s.localization("Set")+'</a>\n </div>\n <div style="clear:both"></div>\n </div>');a="nes"===s.system?{0:"B",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",24:s.localization("QUICK SAVE STATE"),25:s.localization("QUICK LOAD STATE"),26:s.localization("CHANGE STATE SLOT")}:"snes"===s.system?{0:"B",1:"Y",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",9:"X",10:"L",11:"R",24:s.localization("QUICK SAVE STATE"),25:s.localization("QUICK LOAD STATE"),26:s.localization("CHANGE STATE SLOT")}:"n64"===s.system?{0:"B",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",10:"L",11:"R",12:"Z",19:"L STICK UP",18:"L STICK DOWN",17:"L STICK LEFT",16:"L STICK RIGHT",23:"R STICK UP",22:"R STICK DOWN",21:"R STICK LEFT",20:"R STICK RIGHT",24:s.localization("QUICK SAVE STATE"),25:s.localization("QUICK LOAD STATE"),26:s.localization("CHANGE STATE SLOT")}:"nds"===s.system?{0:"B",1:"Y",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",9:"X",10:"L",11:"R",14:"Microphone",24:s.localization("QUICK SAVE STATE"),25:s.localization("QUICK LOAD STATE"),26:s.localization("CHANGE STATE SLOT")}:{0:"B",1:"Y",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",9:"X",10:"L",11:"R",12:"L2",13:"R2",14:"L3",15:"R3",19:"L STICK UP",18:"L STICK DOWN",17:"L STICK LEFT",16:"L STICK RIGHT",23:"R STICK UP",22:"R STICK DOWN",21:"R STICK LEFT",20:"R STICK RIGHT",24:s.localization("QUICK SAVE STATE"),25:s.localization("QUICK LOAD STATE"),26:s.localization("CHANGE STATE SLOT")},["arcade","mame"].includes(s.system)&&(a[2]=s.localization("INSERT COIN")),!1===s.statesSupported&&(delete a[24],delete a[25],delete a[26]);for(var o=[2,3,4,5,6,7,8,0,9,1,10,11,12,13,14,15,19,18,17,16,23,22,21,20,24,25,26],t=0;t<=3;t+=1)!function(t){s.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["tabs-content"])).innerHTML+=e.replace(/{index}/g,t),o.forEach(function(e){a[e]&&(s.elements.dialogs.gamepad.querySelector("#controls-".concat(t)).innerHTML+=n.replace(/{index}/g,t).replace(/{id}/g,e).replace(/{label}/g,a[e]))}),s.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="'.concat(t,'"][data-type="2"]'))&&(s.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),s.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="'.concat(t,'"][data-type="2"]'))&&(s.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),s.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="'.concat(t,'"][data-type="2"]'))&&(s.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),s.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="'.concat(t,'"][data-type="2"]'))&&(s.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),s.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="'.concat(t,'"][data-type="2"]'))&&(s.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),s.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="'.concat(t,'"][data-type="2"]'))&&(s.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),s.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="'.concat(t,'"][data-type="2"]'))&&(s.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),s.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="'.concat(t,'"][data-type="2"]'))&&(s.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc")}(t);Object.keys(v.controllers).forEach(function(o){v.controllers[o]&&Object.keys(v.controllers[o]).forEach(function(e){var t=s.elements.dialogs.gamepad.querySelector('[data-id="'.concat(e,'"][data-index="').concat(o,'"][data-type="1"]')),n=s.elements.dialogs.gamepad.querySelector('[data-id="'.concat(e,'"][data-index="').concat(o,'"][data-type="2"]'));if(!t||!n)return!1;e=v.controllers[o][e];e&&(e.type&&1!==parseInt(e.type,10)?n.value="":e.value&&(t.value=v.keyMap[e.value]||"",t.setAttribute("data-value",e.value)),e.value2&&(n.value=isNaN(e.value2)?e.value2:"button ".concat(parseInt(e.value2,10)+1),n.setAttribute("data-value",e.value2)))})}),U.call(this,s.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["btn-submit"])),"click",function(e){var t=s.elements.dialogs.gamepad.querySelectorAll("input"),i={};return Array.from(t).forEach(function(e){var t,n=e.getAttribute("data-index"),o=e.getAttribute("data-value"),e=(2===parseInt(e.getAttribute("data-type"),10)&&(t=e.getAttribute("data-value")),e.getAttribute("data-id"));i[n]||(i[n]={}),i[n][e]||(i[n][e]={}),o&&(i[n][e].value=o),t&&(i[n][e].value2=t)}),te.storage.set({controllers:i}),v.controllers=i,G(s.elements.dialogs.gamepad,!0),s.elements.container.focus(),e.stopPropagation(),!1}),U.call(this,s.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["btn-reset"])),"click",function(e){v.controllers=JSON.parse(JSON.stringify(v.defaultControllers)),localStorage.removeItem(te.storage.key);for(var t=s.elements.dialogs.gamepad.querySelectorAll("input"),n=0;n<t.length;n++){var o=t[n].getAttribute("data-index"),i=t[n].getAttribute("data-type"),a=t[n].getAttribute("data-id"),r=1==i?"value":"value2";v.defaultControllers[o]&&v.defaultControllers[o][a]&&v.defaultControllers[o][a][r]?(t[n].value=1==i?v.keyMap[v.defaultControllers[o][a][r]]:"button "+(parseInt(v.defaultControllers[o][a][r])+1),t[n].setAttribute("data-value",v.defaultControllers[o][a][r])):(t[n].value="",t[n].setAttribute("data-value",""))}}),U.call(this,s.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["btn-clear"])),"click",function(e){var t,n={0:{},1:{},2:{},3:{}};for(t in a)n[0][t]={},n[1][t]={},n[2][t]={},n[3][t]={};v.controllers=n,localStorage.setItem(te.storage.key,JSON.stringify({controllers:v.controllers}));for(var o=s.elements.dialogs.gamepad.querySelectorAll("input"),i=0;i<o.length;i++)o[i].value="",o[i].setAttribute("data-value","")}),U.call(this,s.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["btn-cancel"])),"click",function(e){return G(s.elements.dialogs.gamepad,!0),s.elements.container.focus(),e.stopPropagation(),!1}),Array.from(s.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames.tabs," li"))).forEach(function(n){U.call(s,n,"mousedown",function(e){V(s.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames.tabs," li")),v.classNames.active,!1),V(n,v.classNames.active,!0);var t=n.querySelector("a").getAttribute("aria-controls");return Array.from(s.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames["tabs-content"]," .").concat(v.classNames["tabs-panel"]))).forEach(function(e){G(e,!0)}),G(s.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["tabs-content"]," #").concat(t)),!1),e.stopPropagation(),!1})}),F.call(s,s.elements.dialogs.gamepad.querySelector('[aria-controls="controls-0"]').parentNode,"mousedown");var r=s.elements.dialogs.gamepad.querySelector(".".concat(v.classNames.overlay));U.call(s,r,"mousedown",function(e){G(r,!0),e.stopPropagation()}),Array.from(s.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames["button-container"]))).forEach(function(t){U.call(s,t,"mousedown",function(e){F.call(s,t.querySelector("a.".concat(v.classNames.set)),e.type,!0,{})})}),Array.from(s.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames["tabs-panel"]," a.").concat(v.classNames.set))).forEach(function(i){U.call(s,i,"mousedown",function(e){var t=i.parentNode.parentNode,n=t.getAttribute("data-id"),o=t.getAttribute("data-index"),t=t.getAttribute("data-label"),t=(G(r,!1),r.setAttribute("data-id",n),r.setAttribute("data-index",o),"[ ".concat(t," ]"));v.gamepad.gamepads[o]&&n<16?t+='<br /><span style="font-size:12px">Gamepad:'.concat(v.gamepad.gamepads[o].id,"</span><br />"+s.localization("Press keyboard or gamepad")+"<br/>"+s.localization("Press escape (esc) to clear")):t+="<br />Press keyboard<br/>"+s.localization("Press escape (esc) to clear"),r.querySelector(".".concat(v.classNames["key-setting-popup"])).innerHTML=t,e.stopPropagation()})})},setCacheDialog:function(){var t=this;t.elements.dialogs.cache.innerHTML='\n <div class="'.concat(v.classNames["dialog-container"],'">\n <div class="').concat(v.classNames["dialog-title"],'">\n <h4>'+t.localization("Cache Manager")+'</h4>\n </div>\n <div class="').concat(v.classNames["dialog-content"],'">\n\n </div>\n <div class="').concat(v.classNames["dialog-buttons"],'">\n <a href="#" onclick="return false" class="').concat(v.classNames["btn-cancel"],'">'+t.localization("Close")+"</a>\n </div>\n </div>\n "),U.call(this,t.elements.dialogs.cache.querySelector(".".concat(v.classNames["btn-cancel"])),"click",function(e){return G(t.elements.dialogs.cache,!0),t.elements.container.focus(),e.stopPropagation(),!1}),U.call(this,t.elements.dialogs.cache.querySelector(".".concat(v.classNames["dialog-title"]," a")),"click",function(e){return m.romdb&&(m.romdb.clear(),t.elements.dialogs.cache.querySelector(".".concat(v.classNames["dialog-content"])).innerHTML='<div style="text-align:center">'+t.localization("Empty")+"</div>"),e.stopPropagation(),!1})},showLoading:function(e){g.show("modal-6ed698f3d04061f5",{closeByEsckey:!1}),e&&console.log(""),G(this.elements.dialogs.loading,!1)},hideLoading:function(){g.close(),G(this.elements.dialogs.loading,!0)},setLoadingDialog:function(){this.elements.dialogs.loading&&(this.elements.dialogs.loading.innerHTML='\n <div class="'.concat(v.classNames.modal," ").concat(v.classNames["micromodal-slide"],'" id="modal-6ed698f3d04061f5" aria-hidden="true">\n <div class="').concat(v.classNames.modal__overlay,'" tabindex="-1">\n <div class="').concat(v.classNames.modal__container,'" role="dialog" aria-modal="true" aria-labelledby="modal-6ed698f3d04061f5-title">\n '+this.localization("Loading")+"...\n </div>\n </div>\n </div>"))},setCheatDialog:function(){var a,r,o,s=this;s.elements.dialogs.cheat&&(s.elements.dialogs.cheat.innerHTML='\n <div class="'.concat(v.classNames["dialog-container"],'">\n <div class="').concat(v.classNames["dialog-title"],'">\n <h4>Cheats</h4>\n </div>\n <div class="').concat(v.classNames["dialog-content"],'">\n <div class="').concat(v.classNames["cheats-list"],'">\n \n </div>\n </div>\n <div class="').concat(v.classNames["dialog-buttons"],'">\n <a href="#" onclick="return false" class="').concat(v.classNames["cheats-add"],'">'+s.localization("Add Cheat")+'</a>\n <a href="#" onclick="return false" class="').concat(v.classNames["btn-submit"],'">'+s.localization("OK")+'</a>\n <a href="#" onclick="return false" class="').concat(v.classNames["btn-cancel"],'">Close</a>\n </div>\n </div>\n\n \n\n <div class="').concat(v.classNames.modal," ").concat(v.classNames["micromodal-slide"],'" id="modal-85cd7a1c543a484b" aria-hidden="true">\n <div class="').concat(v.classNames.modal__overlay,'" tabindex="-1" data-modal-close>\n <div class="').concat(v.classNames.modal__container,'" style="width:100%" role="dialog" aria-modal="true" aria-labelledby="modal-85cd7a1c543a484b-title">\n <div class="').concat(v.classNames.modal__header,'">\n <h2 class="').concat(v.classNames.modal__title,'" id="modal-85cd7a1c543a484b-title">\n '+s.localization("Add Cheat Code")+'\n </h2>\n <button class="').concat(v.classNames.modal__close,'" aria-label="Close modal" data-modal-close></button>\n </div>\n <main class="').concat(v.classNames.modal__content,'" id="modal-85cd7a1c543a484b-content">\n\n <div class="').concat(v.classNames.modal__errmsg,'"></div>\n <strong>'+s.localization("Code")+'</strong><br />\n <textarea style="width:100%;height:80px;" class="').concat(v.classNames["cheat-code-input"],'"></textarea><br />\n <strong>'+s.localization("Description")+'</strong><br />\n <input type="text" class="').concat(v.classNames["cheat-name-input"],'" /><br />\n\n </main>\n <footer class="').concat(v.classNames.modal__footer,'">\n <button class="').concat(v.classNames.modal__btn," ").concat(v.classNames["modal__btn-primary"],'">'+s.localization("Submit")+'</button>\n <button class="').concat(v.classNames.modal__btn,'" data-modal-close aria-label="Close">'+s.localization("Close")+"</button>\n </footer>\n </div>\n </div>\n </div>\n "),a=s.elements.dialogs.cheat.querySelector("#modal-85cd7a1c543a484b"),U.call(this,s.elements.dialogs.cheat.querySelector(".".concat(v.classNames["cheats-add"])),"click",function(e){return g.show("modal-85cd7a1c543a484b",{closeTrigger:"data-modal-close"}),!1}),r=s.elements.dialogs.cheat.querySelector(".".concat(v.classNames["cheats-list"])),U.call(this,a.querySelector(".".concat(v.classNames["modal__btn-primary"])),"click",function(e){var t,n,o=a.querySelector(".".concat(v.classNames["cheat-name-input"])).value,i=a.querySelector(".".concat(v.classNames["cheat-code-input"])).value;return o&&i&&(t=r.querySelectorAll("input:checked"),a.querySelector(".".concat(v.classNames["cheat-name-input"])).value="",a.querySelector(".".concat(v.classNames["cheat-code-input"])).value="",g.close(),n=s.cheats.length,s.cheats.push([o,i]),r.innerHTML+='<div class="'.concat(v.classNames["ejs-switch"],'">\n <input type="checkbox" value="').concat(n,'" id="ejs-cheat-switch-').concat(n,'">\n <label for="ejs-cheat-switch-').concat(n,'">').concat(o,'</label>\n <a href="#" data-idx="').concat(n,'" onclick="return false" class="').concat(v.classNames["ejs-delete-cheat"],'">×</a>\n </div>'),t.forEach(function(e,t){r.querySelector("#ejs-cheat-switch-".concat(t)).setAttribute("checked","checked")})),"localStorage"in window&&localStorage.setItem("".concat(s.system,"-").concat(s.startName,"-cheats"),JSON.stringify(s.cheats)),e.stopPropagation(),!1}),o=function(){if("localStorage"in window){var e=localStorage.getItem("".concat(s.system,"-").concat(s.startName,"-cheats"));try{e=JSON.parse(e)}catch(e){}e&&(s.cheats=e)}r.innerHTML="",s.cheats&&Array.isArray(s.cheats)&&s.cheats.forEach(function(e,t){var n=e[0];e[1],r.innerHTML+='<div class="'.concat(v.classNames["ejs-switch"],'">\n <input type="checkbox" value="').concat(t,'" id="ejs-cheat-switch-').concat(t,'">\n <label for="ejs-cheat-switch-').concat(t,'">').concat(n,'</label>\n <a href="#" data-idx="').concat(t,'" onclick="return false" class="').concat(v.classNames["ejs-delete-cheat"],'">×</a>\n </div>')})},U.call(s,r,"click",function(e){var t,n;return e.target&&e.target.classList.contains(v.classNames["ejs-delete-cheat"])&&e.target.getAttribute("data-idx")&&(t=e.target.getAttribute("data-idx"),s.cheats.splice(t,1),"localStorage"in window&&localStorage.setItem("".concat(s.system,"-").concat(s.startName,"-cheats"),JSON.stringify(s.cheats)),n=[],r.querySelectorAll("input").forEach(function(e,t){n[t]=!!r.querySelector("#ejs-cheat-switch-".concat(t,":checked"))}),n.splice(t,1),o(),n.forEach(function(e,t){e&&r.querySelector("#ejs-cheat-switch-".concat(t)).setAttribute("checked","checked")})),e.stopPropagation(),!1}),U.call(s,s.elements.container,"start-game",function(e){o()}),U.call(this,s.elements.dialogs.cheat.querySelector(".".concat(v.classNames["btn-cancel"])),"click",function(e){return G(s.elements.dialogs.cheat,!0),e.stopPropagation(),s.elements.container.focus(),!1}),U.call(this,s.elements.dialogs.cheat.querySelector(".".concat(v.classNames["btn-submit"])),"click",function(e){return v.resetCheat(),r.querySelectorAll("input:checked").forEach(function(e,t){e=s.cheats[e.value];e&&v.setCheat(t,1,e[1])}),G(s.elements.dialogs.cheat,!0),s.elements.container.focus(),!1}),"arcade"!==s.system&&"mame"!==s.system&&"mame2003"!==s.system&&"mame2010"!==s.system||(z.element(s.elements.buttons.cheat)&&G(s.elements.buttons.cheat,!0),v.allowCheat=!1),v.setCheat||(G(s.elements.buttons.cheat,!0),v.allowCheat=!1))},setNetplayDialog:function(){var n,a,o,i,l,s,c,d,e,r,u,f,p=this,h=this;h.elements.dialogs.netplay&&(h.elements.dialogs.netplay.innerHTML='\n <div class="'.concat(v.classNames["dialog-container"],'">\n <div class="').concat(v.classNames["dialog-title"],'">\n <h4>'+h.localization("Netplay")+'</h4>\n </div>\n <div class="').concat(v.classNames["dialog-content"],'">\n <div class="').concat(v.classNames["netplay-roomlist"],'" hidden>\n <strong>'+h.localization("Rooms")+'</strong>\n <table style="width:100%" cellspacing=0>\n <thead>\n <tr>\n <td>'+h.localization("Room Name")+"</td>\n <td>"+h.localization("Players")+'</td>\n <td></td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td></td>\n <td></td>\n <td></td>\n </tr>\n </tbody>\n </table>\n </div>\n\n <div class="').concat(v.classNames["netplay-room"],'" hidden>\n <strong>'+h.localization("Room Name")+"</strong>\n <div data-room-password>"+h.localization("Password")+': <span></span></div>\n <table style="width:100%" cellspacing="0">\n <thead>\n <tr>\n <td>'+h.localization("Player")+"</td>\n <td>"+h.localization("Name")+"</td>\n <td></td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>1</td>\n <td>"+h.localization("Name")+" 1</td>\n <td></td>\n </tr>\n <tr>\n <td>2</td>\n <td>"+h.localization("Name")+" 2</td>\n <td></td>\n </tr>\n <tr>\n <td>3</td>\n <td>"+h.localization("Name")+" 3</td>\n <td></td>\n </tr>\n <tr>\n <td>4</td>\n <td>"+h.localization("Name")+' 4</td>\n <td></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n <div class="').concat(v.classNames["dialog-buttons"],'">\n <a href="#" onclick="return false" class="').concat(v.classNames["btn-quit"],'">'+h.localization("Quit Room")+'</a>\n <a href="#" onclick="return false" class="').concat(v.classNames["btn-create-room"],'">'+h.localization("Create a Room")+'</a>\n <a href="#" onclick="return false" class="').concat(v.classNames["btn-cancel"],'">'+h.localization("Close")+'</a>\n </div>\n </div>\n\n \n <div class="').concat(v.classNames.modal," ").concat(v.classNames["micromodal-slide"],'" id="modal-9de6c4e9ce2b9361" aria-hidden="true">\n <div class="').concat(v.classNames.modal__overlay,'" tabindex="-1">\n <div class="').concat(v.classNames.modal__container,'" role="dialog" aria-modal="true" aria-labelledby="modal-9de6c4e9ce2b9361-title">\n <div class="').concat(v.classNames.modal__header,'">\n <h2 class="').concat(v.classNames.modal__title,'" id="modal-9de6c4e9ce2b9361-title">\n '+h.localization("Set Player Name")+'\n </h2>\n </div>\n <main class="').concat(v.classNames.modal__content,'" id="modal-9de6c4e9ce2b9361-content">\n\n <div class="').concat(v.classNames.modal__errmsg,'"></div>\n <strong>'+h.localization("Player Name")+'</strong><br />\n <input type="text" maxlength="10" class="').concat(v.classNames["netplay-player-name"],'" /><br />\n\n </main>\n <footer class="').concat(v.classNames.modal__footer,'">\n <button class="').concat(v.classNames.modal__btn," ").concat(v.classNames["modal__btn-primary"],'">'+h.localization("Submit")+'</button>\n </footer>\n </div>\n </div>\n </div>\n \n <div class="').concat(v.classNames.modal," ").concat(v.classNames["micromodal-slide"],'" id="modal-85cd7a1c543a484a" aria-hidden="true">\n <div class="').concat(v.classNames.modal__overlay,'" tabindex="-1" data-modal-close>\n <div class="').concat(v.classNames.modal__container,'" role="dialog" aria-modal="true" aria-labelledby="modal-85cd7a1c543a484a-title">\n <div class="').concat(v.classNames.modal__header,'">\n <h2 class="').concat(v.classNames.modal__title,'" id="modal-85cd7a1c543a484a-title">\n '+h.localization("Create a Room")+'\n </h2>\n <button class="').concat(v.classNames.modal__close,'" aria-label="Close modal" data-modal-close></button>\n </div>\n <main class="').concat(v.classNames.modal__content,'" id="modal-85cd7a1c543a484a-content">\n\n <div class="').concat(v.classNames.modal__errmsg,'"></div>\n <strong>'+h.localization("Room Name")+'</strong><br />\n <input type="text" maxlength="10" class="').concat(v.classNames["netplay-room-name-input"],'" /><br />\n <strong>Max Players</strong><br />\n <select data-max-players>\n <option value="2">2</option>\n <option value="3">3</option>\n <option value="4">4</option>\n </select>\n <br />\n <strong>'+h.localization("Password (optional)")+'</strong><br />\n <input type="text" maxlength="10" class="').concat(v.classNames["netplay-room-password-input"],'" /><br />\n\n </main>\n <footer class="').concat(v.classNames.modal__footer,'">\n <button class="').concat(v.classNames.modal__btn," ").concat(v.classNames["modal__btn-primary"],'">'+h.localization("Submit")+'</button>\n <button class="').concat(v.classNames.modal__btn,'" data-modal-close aria-label="Close">'+h.localization("Close")+'</button>\n </footer>\n </div>\n </div>\n </div>\n \n <div class="').concat(v.classNames.modal," ").concat(v.classNames["micromodal-slide"],'" id="modal-5aa765d61d8327de" aria-hidden="true">\n <div class="').concat(v.classNames.modal__overlay,'" tabindex="-1" data-modal-close>\n <div class="').concat(v.classNames.modal__container,'" role="dialog" aria-modal="true" aria-labelledby="modal-5aa765d61d8327de-title">\n <div class="').concat(v.classNames.modal__header,'">\n <h2 class="').concat(v.classNames.modal__title,'" id="modal-5aa765d61d8327de-title">\n '+h.localization("Password")+'\n </h2>\n <button class="').concat(v.classNames.modal__close,'" aria-label="Close modal" data-modal-close></button>\n </div>\n <main class="').concat(v.classNames.modal__content,'" id="modal-5aa765d61d8327de-content">\n\n <div class="').concat(v.classNames.modal__errmsg,'"></div>\n <input type="text" maxlength="10" class="').concat(v.classNames["netplay-room-password-input"],'" /><br />\n\n </main>\n <footer class="').concat(v.classNames.modal__footer,'">\n <button class="').concat(v.classNames.modal__btn," ").concat(v.classNames["modal__btn-primary"],'">'+h.localization("Submit")+'</button>\n <button class="').concat(v.classNames.modal__btn,'" data-modal-close aria-label="Close">'+h.localization("Close")+'</button>\n </footer>\n </div>\n </div>\n </div>\n \n \n <div class="').concat(v.classNames.modal," ").concat(v.classNames["micromodal-slide"],'" id="modal-7d8fd50ed642340b" aria-hidden="true">\n <div class="').concat(v.classNames.modal__overlay,'" tabindex="-1" data-modal-close>\n <div class="').concat(v.classNames.modal__container,'" role="dialog" aria-modal="true" aria-labelledby="modal-7d8fd50ed642340b-title">\n <div class="').concat(v.classNames.modal__header,'">\n <h2 class="').concat(v.classNames.modal__title,'" id="modal-7d8fd50ed642340b-title"></h2>\n <button class="').concat(v.classNames.modal__close,'" aria-label="Close modal" data-modal-close></button>\n </div>\n <main class="').concat(v.classNames.modal__content,'" id="modal-7d8fd50ed642340b-content">\n \n </main>\n <footer class="').concat(v.classNames.modal__footer,'">\n <button class="').concat(v.classNames.modal__btn," ").concat(v.classNames["modal__btn-primary"],'" data-modal-close>OK</button>\n </footer>\n </div>\n </div>\n </div>\n \n '),U.call(this,h.elements.dialogs.netplay.querySelector(".".concat(v.classNames["btn-cancel"])),"click",function(e){return G(h.elements.dialogs.netplay,!0),v.disableControl(!1),v.stopLoadRooms(),e.stopPropagation(),h.elements.container.focus(),!1}),window.setInterval(function(){var o="<ul>";v.players.forEach(function(e,t){var n=null;e?(v.connection.peers[e]?n=v.connection.peers[e].extra:v.connection.userid===e&&(n=v.connection.extra),o+="<li>".concat(t+1,". ").concat(n.name,"</li>")):o+="<li>".concat(t+1,". </li>")}),o+="</ul>",h.elements.widgets.netplay.innerHTML=o},500),n=h.elements.dialogs.netplay.querySelector("#modal-9de6c4e9ce2b9361"),a=h.elements.dialogs.netplay.querySelector("#modal-85cd7a1c543a484a"),o=h.elements.dialogs.netplay.querySelector("#modal-7d8fd50ed642340b"),i=h.elements.dialogs.netplay.querySelector("#modal-5aa765d61d8327de"),l={},v.connection=new Le.a,(e=p.socketUrl).endsWith("/")||(e+="/"),v.connection.socketURL="/",v.connection.socketURL=e,v.connection.socketMessageEvent="emulatorjs-message",v.connection.socketCustomEvent="emulatorjs-custom-message",e=W.info(),v.connection.extra={name:v.playerName,game_id:h.config.gameId,browser_name:e.name,room_name:" ",domain:document.domain},v.connection.socketMessageEvent="netplay",v.connection.enableFileSharing=!0,v.connection.enableLogs=!1,v.connection.session={data:!0},v.connection.sdpConstraints.mandatory={OfferToReceiveAudio:!1,OfferToReceiveVideo:!1},v.connection.onclose=function(e){},v.connection.iceServers=[{urls:"turn:turn.emulatorjs.com:3478",credential:"dSnmrtehverella",username:"ejs"},{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302","stun:stun.l.google.com:19302?transport=udp"]}],v.connection.maxParticipantsAllowed=4,s=v.netPlayInitFrame=0,c=!1,Module.postMainLoop=function(){var e,t;if(v.currentFrame=parseInt(v.currentFrameNum(),10),v.connected)if(s+=1,v.connection.isInitiator)if(1<=s){for(var n=[],o=v.currentFrame-1;o<v.currentFrame;o+=1)v.inputsData[o]?v.inputsData[o].forEach(function(e,t){n.push("".concat(e.index,"|").concat(e.key,"|").concat(e.status,"|").concat(e.frame))}):n.push("-1|||".concat(o));v.connection.send(JSON.stringify({act:"sync-control",value:n})),s=0,v.currentFrame%100==0&&Object.keys(v.inputsData).forEach(function(e,t){e<v.currentFrame-50&&(v.inputsData[e]=null,delete v.inputsData[e])});return}else return;else{if(v.coreOptionData[v.currentFrame]&&(e=v.coreOptionData[v.currentFrame].key,t=v.coreOptionData[v.currentFrame].value,te.updateCoreOptions.call(h,e,t),delete v.coreOptionData[v.currentFrame]),v.currentFrame<=0||v.inputsData[v.currentFrame])v.wait=!1,v.systemPause(0),m.Module.resumeMainLoop(),e=v.inputsData[v.currentFrame],v.inputsData[v.currentFrame]=null,delete v.inputsData[v.currentFrame],(e=e||[]).forEach(function(e,t){0<=e.index&&v.simulateInputFn(e.index,e.key,e.status)});else{v.wait=!0,v.systemPause(1),m.Module.pauseMainLoop();var i=!1,a=Object.keys(v.inputsData);0==a.length&&(i=!0);for(var r=0;r<a.length;r+=1)if(a[r]>v.currentFrame){console.log("lost",v.currentFrame),i=!0;break}i?v.wait||(!c||c<(new Date).valueOf()-3e3)&&(v.inputsData={},c=(new Date).valueOf(),v.connection.send(JSON.stringify({act:"sync-mem",value:v.connection.userid}),v.roomMaster)):(v.wait=!0,v.systemPause(1),m.Module.pauseMainLoop())}v.currentFrame%100==0&&Object.keys(v.inputsData).forEach(function(e,t){e<v.currentFrame-50&&(v.inputsData[e]=null,delete v.inputsData[e])})}},v.connection.onopen=function(n){v.connected=!0,v.connection.isInitiator&&(-1===v.players.indexOf(n.userid)&&(0<v.players.filter(function(e,t){return null==e}).length?v.players.forEach(function(e,t){null!=e||v.players.includes(n.userid)||(v.players[t]=n.userid)}):v.players.push(n.userid)),v.connection.send(JSON.stringify({act:"get-players-result",value:v.players,coreOptions:te.coreOptionsValues,newuser:n.userid,master:v.connection.userid}))),te.updateCoreOptionMenuItems.call(h)},v.connection.onFileStart=function(e){var t=e.name.split("-");"reset"!==t[0]&&0!=t[0]||(v.inputsData={},v.disableControl(!0)),v.progressHelper[e.remoteUserId]={},v.progressHelper[e.remoteUserId].max=e.maxChunks,v.showLoading.call(h),v.connection.isInitiator?(v.wait=!0,v.systemPause(1),m.Module.pauseMainLoop()):v.inputsData={}},v.connection.onFileProgress=function(e){var t=v.progressHelper[e.remoteUserId];t.current=e.currentPosition||e.maxChunks||t.max},d=!(v.connection.onFileEnd=function(e){v.hideLoading.call(h);var t=e.name.split("-"),n=t[0]>>0;"reset"===t[0]?(n=0,v.connection.isInitiator?(v.systemPause(0),v.disableControl(!1),h.playing=!0,m.Module.resumeMainLoop()):J.a.get(e.url,{responseType:"arraybuffer"}).then(function(e){v.inputsData={};e=new Uint8Array(e.data);v.loadState(e,n),v.wait=!1,v.systemPause(0),v.disableInput=!1,h.playing=!0,m.Module.resumeMainLoop()})):"game.state"===t[1]&&(v.connection.isInitiator?(v.openRoom(h),v.wait=!1,v.systemPause(0),m.Module.resumeMainLoop()):(v.netPlayInitFrame=n,J.a.get(e.url,{responseType:"arraybuffer"}).then(function(e){e=new Uint8Array(e.data);v.loadState(e,n),v.wait=!1,v.disableInput=!1,v.connection.send(JSON.stringify({act:"wait-end",value:v.connection.userid})),v.hideLoading.call(h),h.playing=!0,m.Module.resumeMainLoop()}))),v.connection.isInitiator||console.log("recv mem end",v.currentFrame,e.name)}),v.connection.onmessage=function(e){var t,r,n,e=e.data||e;try{t=JSON.parse(e)}catch(e){t=null}if(t){if("room-master"===t.act&&(v.roomMaster=t.value),t.act,"short-pause"!==t.act||d||(v.systemPause(1),m.Module.pauseMainLoop(),d=!0,v.wait=!0,setTimeout(function(){v.systemPause(0),m.Module.resumeMainLoop(),v.wait=!1,d=!1},48)),"sync-control"===t.act&&(e=t.value,h.playing||v.wait,r=v.connection.userid,v.players.indexOf(r),v.connection.isInitiator,e.forEach(function(e,t){var e=e.split("|"),n=e[0]>>0,o=e[1]>>0,i=e[2]>>0,e=e[3]>>0,a=v.currentFrame;v.inputsData[e]||(v.inputsData[e]=[]),-1!=n&&e===a&&v.simulateInputFn(n,o,i),v.connection.isInitiator?0<=n&&(v.inputsData[a]||(v.inputsData[a]=[]),-2!=o&&(v.inputsData[a].push({index:n,key:o,status:i,frame:a}),v.simulateInputFn(n,o,i)),d||e<=a-10&&(v.systemPause(1),m.Module.pauseMainLoop(),d=!0,v.wait=!0,setTimeout(function(){v.systemPause(0),m.Module.resumeMainLoop(),v.wait=!1,d=!1},48))):(""!==n&&v.inputsData[e].push({index:n,key:o,status:i,frame:e}),v.inputsData[v.currentFrame]&&m.Module.resumeMainLoop(),a+10<=e&&e>v.netPlayInitFrame+100&&v.connection.send(JSON.stringify({act:"short-pause",value:r}),v.roomMaster))})),t.act,t.act,"update-core-option"!==t.act||v.connection.isInitiator||(v.coreOptionData[t.frame]={key:t.key,value:t.value}),"restart-game"===t.act&&(v.inputsData={},v.connection.send(JSON.stringify({act:"sync-mem",value:v.connection.userid}),v.roomMaster)),"pause"===t.act&&m.Module.pauseMainLoop(),"resume"===t.act&&m.Module.resumeMainLoop(),"wait"===t.act&&(v.wait=!0,v.systemPause(1),t.value!==v.connection.userid&&(v.waitingList[t.value]=1),v.disableControl(!0)),"wait-end"===t.act&&(v.waitingList[t.value]&&delete v.waitingList[t.value],0===Object.keys(v.waitingList).length&&(v.wait=!1,v.systemPause(0),v.disableInput=!1)),"sync-mem"===t.act){v.wait=!0,v.systemPause(1);e=t.value;v.disableControl(!0),v.connection.send(JSON.stringify({act:"wait",value:e}));for(var o=v.getStateInfo().split("|"),i=o[0]>>0,a=new Uint8Array(i),s=o[1]>>0,c=0;c<i;c+=1)a[c]=m.Module.getValue(s+c);m._FS.createDataFile("/","game.state",a,!0,!0),m.Module.cwrap("load_state","number",["string","number"])("game.state",0),m.FS.unlink("game.state"),v.inputsData={};o=new File([a],"".concat(0,"-game.state"),{type:"",lastModified:new Date});v.connection.shareFile(o,e)}t.act,"get-players-result"===t.act&&(v.players=t.value,v.roomMaster=t.master,t.newuser===v.connection.userid)&&(n=te.coreOptionsValues,t.coreOptions&&Object.keys(t.coreOptions).forEach(function(e){n[e]!==t.coreOptions[e]&&te.updateCoreOptions.call(h,e,t.coreOptions[e])}),v.showLoading.call(h),v.disableControl(!0),setTimeout(function(){v.connection.send(JSON.stringify({act:"sync-mem",value:v.connection.userid}),v.roomMaster)},1),v.roomMaster&&v.connection.peers[v.roomMaster]&&(v.connection.extra.room_name=v.connection.peers[v.roomMaster].extra.room_name,v.connection.updateExtraData()),v.connection.peers[v.roomMaster]&&(l=v.connection.peers[v.roomMaster].extra),v.openRoom(h))}},v.connection.onUserStatusChanged=function(e){var t;"offline"===e.status&&0<=(t=v.players.indexOf(e.userid))&&(v.players[t]=null),e.status},v.connection.onExtraDataUpdated=function(e){e.userid===v.connection.userid&&(v.connection.extra=e.extra)},v.connection.onleave=function(e){var t;e.userid&&0<=(t=v.players.indexOf(e.userid))&&(v.players[t]=null),v.waitingList[e.userid]&&delete v.waitingList[e.userid],v.connection.isInitiator&&0===Object.keys(v.waitingList).length&&v.wait&&(v.wait=!1,v.systemPause(0),v.disableInput=!1,v.connection.send(JSON.stringify({act:"wait-end",value:v.connection.userid}))),v.openRoom(h),v.inputsData={},v.hideLoading.call(h)},v.connection.close=e=function(){try{v.connection.onbeforeunload()}catch(e){}v.connected=!1,v.connection.password=null,v.players=[],v.connection.peersBackup=[],v.waitingList={},v.inputsData={},v.hideLoading.call(h),G(h.elements.buttons.restart,!1),G(h.elements.buttons.loadState,!1),G(h.elements.buttons.saveState,!1),v.allowCheat&&G(h.elements.buttons.cheat,!1),G(te.contextMenu.querySelectorAll("ul li").item(2),!1),G(te.contextMenu.querySelectorAll("ul li").item(3),!1),Array.from(h.elements.buttons.play).forEach(function(e){G(e,!1)}),te.updateCoreOptionMenuItems.call(h)},v.connection.disconnect=e,v.connection.leave=e,u=function(e,t,n){v.hideLoading.call(h),e?(v.stopLoadRooms(),G(h.elements.buttons.restart,!0),G(h.elements.buttons.loadState,!0),G(h.elements.buttons.saveState,!0),v.resetCheat(),G(h.elements.buttons.cheat,!0),G(te.contextMenu.querySelectorAll("ul li").item(2),!0),G(te.contextMenu.querySelectorAll("ul li").item(3),!0),Array.from(h.elements.buttons.play).forEach(function(e){G(e,!0)}),v.connection.socket&&v.connection.socket.on("set-isInitiator-true",function(e){e===v.connection.sessionid&&(v.connection.socket.emit("extra-data-updated",v.connection.extra),v.connection.send(JSON.stringify({act:"room-master",value:v.connection.userid})),v.roomMaster=v.connection.userid,v.systemPause(0),m.Module.resumeMainLoop(),te.updateCoreOptionMenuItems.call(h),G(h.elements.buttons.restart,!1),G(h.elements.buttons.loadState,!1),G(h.elements.buttons.saveState,!1),Array.from(h.elements.buttons.play).forEach(function(e){G(e,!1)}))})):(g.close(),o.querySelector("#modal-7d8fd50ed642340b-content").innerHTML=n,g.show("modal-7d8fd50ed642340b",{closeTrigger:"data-modal-close"}))},f=function(e){var t=e.target.getAttribute("data-id");if("Y"===e.target.getAttribute("data-password"))g.show("modal-5aa765d61d8327de",{closeTrigger:"data-modal-close"}),i.setAttribute("data-id",t);else{v.showLoading.call(h),v.connection.userid=v.connection.token();try{v.connection.join(t,u)}catch(e){v.hideLoading.call(h),o.querySelector("#modal-7d8fd50ed642340b-content").innerHTML="Error",g.show("modal-7d8fd50ed642340b",{closeTrigger:"data-modal-close"})}}return e.stopPropagation(),!1},v.loadRoomsList=function(){G(h.elements.dialogs.netplay.querySelector(".".concat(v.classNames["netplay-roomlist"])),!1),G(h.elements.dialogs.netplay.querySelector(".".concat(v.classNames["netplay-room"])),!0),G(h.elements.dialogs.netplay.querySelector(".".concat(v.classNames["btn-create-room"])),!1),G(h.elements.dialogs.netplay.querySelector(".".concat(v.classNames["btn-quit"])),!0);var e=h.listUrl,c=(e.endsWith("/")||(e+="/"),h.elements.dialogs.netplay.querySelector(".".concat(v.classNames["netplay-roomlist"])).querySelector("tbody")),e=[e,"list?game_id=",h.config.gameId,"&domain=",document.domain].join("");J.a.get(e,{}).then(function(a){var r,s;a.data&&(r=[],s=[],c.querySelectorAll("tr").forEach(function(e){s.push(e.getAttribute("id"))}),Object.keys(a.data).forEach(function(e){var t=a.data[e],n=(r.push(e),s.includes(e)&&(n=c.querySelector('tr[id="'.concat(e,'"]')),c.removeChild(n)),document.createElement("tr")),o=(n.setAttribute("id",e),t.password?v.icons.lock:""),i=t.password?"Y":"N",e=t.current<t.max?'<span data-id="'.concat(e,'" data-password="').concat(i,'" class="').concat(v.classNames["btn-join-room"],'">Join</span>'):"",i=t.country||"?";n.innerHTML="<td>[".concat(i,"] ").concat(o," ").concat(t.room_name,"</td><td>").concat(t.current,"/").concat(t.max,"</td><td>").concat(e,"</td>"),U.call(p,n.querySelector(".".concat(v.classNames["btn-join-room"])),"click",f),c.appendChild(n)}),c.querySelectorAll("tr").forEach(function(e){r.includes(e.id)||c.removeChild(e)})),v.loadRoomsListTimer=setTimeout(v.loadRoomsList,2e3)}).catch(function(e){console.log("Network Error",e),v.loadRoomsListTimer=setTimeout(v.loadRoomsList,2e3)})},v.openRoom=function(e){v.stopLoadRooms(),G(e.elements.dialogs.netplay.querySelector(".".concat(v.classNames["netplay-roomlist"])),!0),G(e.elements.dialogs.netplay.querySelector(".".concat(v.classNames["netplay-room"])),!1),G(e.elements.dialogs.netplay.querySelector(".".concat(v.classNames["btn-create-room"])),!0),G(e.elements.dialogs.netplay.querySelector(".".concat(v.classNames["btn-quit"])),!1),v.resetCheat(),G(e.elements.buttons.cheat,!0);var e=e.elements.dialogs.netplay.querySelector(".".concat(v.classNames["netplay-room"])),t=e.querySelector("[data-room-password]"),o=(null===v.connection.password?G(t,!0):(G(t,!1),t.querySelector("span").innerText=v.connection.password),e.querySelector("tbody"));o.innerHTML="",e.querySelector("strong").innerText=l.room_name,v.players.forEach(function(e,t){var n=null;e&&(v.connection.peers[e]?n=v.connection.peers[e].extra:v.connection.userid===e&&(n=v.connection.extra),n&&n.name)&&((e=document.createElement("tr")).innerHTML="<td>".concat(t+1,"</td><td>").concat(n.name,"</td><td></td>"),o.appendChild(e))})},U.call(this,i.querySelector(".".concat(v.classNames["modal__btn-primary"])),"click",function(e){var t=i.querySelector(".".concat(v.classNames["netplay-room-password-input"])).value,t=(v.showLoading.call(h),v.connection.password=t,i.getAttribute("data-id"));v.connection.join(t,function(e,t,n){u(e,0,n),e&&i.classList.remove(H({"is-open":!0}))}),e.stopPropagation()}),U.call(this,n.querySelector(".".concat(v.classNames["modal__btn-primary"])),"click",function(e){var t=(t=n.querySelector(".".concat(v.classNames["netplay-player-name"])).value).replace(/<|>/g,"");n.querySelector(".".concat(v.classNames.modal__errmsg)).innerHTML="",t.trim()&&(v.playerName=t.trim(),v.connection.extra.name=t.trim(),g.close()),e.stopPropagation()}),U.call(this,a.querySelector(".".concat(v.classNames["modal__btn-primary"])),"click",function(e){var t=(t=a.querySelector(".".concat(v.classNames["netplay-room-name-input"])).value).replace(/<|>/g,""),n=a.querySelector("select[data-max-players] option:checked").value;4<(n=n<2?2:n)&&(n=4);for(var o=0;o<n;o++)v.players[o]=null;v.connection.maxParticipantsAllowed=n;var i=a.querySelector(".".concat(v.classNames["netplay-room-password-input"])).value;a.querySelector(".".concat(v.classNames.modal__errmsg)).innerHTML="",t.trim()?(v.connection.extra.room_name=t.trim(),""!==i.trim()&&(v.connection.password=i.trim()),v.showLoading.call(h),v.connection.open(v.connection.token(),function(e,t,n){v.hideLoading.call(h),e?(v.players[0]=v.connection.userid,v.roomMaster=v.connection.userid,r.closeModal(),v.stopLoadRooms(),l=v.connection.extra,v.openRoom(h),G(te.contextMenu.querySelectorAll("ul li").item(2),!0),G(te.contextMenu.querySelectorAll("ul li").item(3),!0)):a.querySelector(".".concat(v.classNames.modal__errmsg)).innerHTML=n})):r.closeModal(),e.stopPropagation()}),U.call(this,h.elements.dialogs.netplay.querySelector(".".concat(v.classNames["btn-create-room"])),"click",function(e){return r=g.show("modal-85cd7a1c543a484a",{closeTrigger:"data-modal-close",onClose:function(){h.elements.container.focus()}}),e.stopPropagation(),!1}),U.call(this,h.elements.dialogs.netplay.querySelector(".".concat(v.classNames["btn-quit"])),"click",function(e){return v.connection.close(),v.stopLoadRooms(),v.loadRoomsList(),v.inputsData={},e.stopPropagation(),!1})),window._0x378b5c=v},initKeyboard:function(){var a=this,r=this,s=this.elements.dialogs.gamepad.querySelector(".".concat(v.classNames.overlay));U.call(this,document.body,"keydown keyup",function(n){if(!(112<=n.which&&n.which<=123)){var e=!a.elements.dialogs.gamepad.hidden&&!s.hidden,o="keydown"===n.type;if(o&&e){var e=s.getAttribute("data-index"),t=s.getAttribute("data-id"),i=null;if(n.key&&"escape"===v.keyMap[n.keyCode])return(i=r.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="1"]'))).setAttribute("data-value",""),i.value=""(i=r.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="2"]'))).setAttribute("data-value",""),i.value="",void G(s,!0);e=s.getAttribute("data-index"),t=s.getAttribute("data-id"),i=null;n.key&&((i=r.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="1"]'))).setAttribute("data-value",n.keyCode),i.value=v.keyMap[n.keyCode]),G(s,!0)}else Object.keys(v.controllers).forEach(function(t){Object.keys(v.controllers[t]).forEach(function(e){parseInt(v.controllers[t][e].value,10)===n.keyCode&&["24","25","26"].includes(e)&&"keydown"==n.type&&!n.repeat&&("24"==e?v.quickSaveState():"25"==e?v.quickLoadState():"26"==e&&v.changeStateSlot()),parseInt(v.controllers[t][e].value,10)===n.keyCode&&(o?16<=e&&e<=23?v.simulateInput(t,e,32767):v.simulateInput(t,e,1):v.simulateInput(t,e,0))})})}}),document.body.addEventListener("keydown",function(e){var t=e.keyCode||e.which;[32,37,38,39,40,112,113,114,115,116,117,118,119,120,121,122,123].includes(t)&&e.srcElement===r.elements.container&&e.preventDefault(),e.srcElement.className.split(/ +/).includes(v.classNames.set)&&e.preventDefault()})},initGamepad:function(){var c=this,r=this,l=this.elements.dialogs.gamepad.querySelector(".".concat(v.classNames.overlay)),n=new i.Gamepad;(v.gamepad=n).init()&&(n.bind(i.Gamepad.Event.TICK,function(e){e.forEach(function(e){var t;e&&e.axes&&e.axes[9]&&((t=e.axes[9])<3.28571?1==t?(e.extra_buttons[12].pressed||(e.extra_buttons[12]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:12,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[14].pressed||(e.extra_buttons[14]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:14,gamepad:e,gamepadIndex:e.index}))):t<=-.7142857&&-.714291<=t?(e.extra_buttons[12].pressed||(e.extra_buttons[12]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:12,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[15].pressed||(e.extra_buttons[15]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:15,gamepad:e,gamepadIndex:e.index}))):.42856<=t&&t<=.42858?(e.extra_buttons[13].pressed||(e.extra_buttons[13]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:13,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[14].pressed||(e.extra_buttons[14]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:14,gamepad:e,gamepadIndex:e.index}))):-.14287<=t&&t<=-.14285?(e.extra_buttons[13].pressed||(e.extra_buttons[13]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:13,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[15].pressed||(e.extra_buttons[15]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:15,gamepad:e,gamepadIndex:e.index}))):t<=-1&&-1.01<=t?e.extra_buttons[12].pressed||(e.extra_buttons[12]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:12,gamepad:e,gamepadIndex:e.index})):.142857<=t&&t<=.142858?e.extra_buttons[13].pressed||(e.extra_buttons[13]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:13,gamepad:e,gamepadIndex:e.index})):.7142857<=t&&t<=.7142858?e.extra_buttons[14].pressed||(e.extra_buttons[14]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:14,gamepad:e,gamepadIndex:e.index})):t<=-.42857&&-.42858<=t&&(e.extra_buttons[15].pressed||(e.extra_buttons[15]={pressed:!0,value:1},n._fire(i.Gamepad.Event.BUTTON_DOWN,{index:15,gamepad:e,gamepadIndex:e.index}))):(e.extra_buttons[12].pressed&&(e.extra_buttons[12]={pressed:!1,value:0},n._fire(i.Gamepad.Event.BUTTON_UP,{index:12,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[13].pressed&&(e.extra_buttons[13]={pressed:!1,value:0},n._fire(i.Gamepad.Event.BUTTON_UP,{index:13,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[14].pressed&&(e.extra_buttons[14]={pressed:!1,value:0},n._fire(i.Gamepad.Event.BUTTON_UP,{index:14,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[15].pressed&&(e.extra_buttons[15]={pressed:!1,value:0},n._fire(i.Gamepad.Event.BUTTON_UP,{index:15,gamepad:e,gamepadIndex:e.index}))))})}),n.bind(i.Gamepad.Event.BUTTON_DOWN,function(n){if(c.elements.dialogs.gamepad.hidden||l.hidden)Object.keys(v.controllers[n.gamepad.index.toString()]).forEach(function(e){var t=n.gamepad.index.toString();parseInt(v.controllers[t][e].value2,10)===parseInt(n.index,10)&&["24","25","26"].includes(e)&&("24"==e?v.quickSaveState():"25"==e?v.quickLoadState():"26"==e&&v.changeStateSlot()),parseInt(v.controllers[t][e].value2,10)===parseInt(n.index,10)&&parseInt(t,10)===parseInt(n.gamepad.index,10)&&v.simulateInput(t,e,1)});else{var e,t=parseInt(l.getAttribute("data-index"),10),o=l.getAttribute("data-id");if(n.gamepad.index===parseInt(t,10)){for(var i=0;i<32&&(!(e=(e=n.gamepad.buttons[i])?e:n.gamepad.extra_buttons[i])||!("number"==typeof e&&1===e||"number"==typeof e.value&&1===e.value));i+=1);var a=null;(a=r.elements.dialogs.gamepad.querySelector('[data-id="'.concat(o,'"][data-index="').concat(t,'"][data-type="2"]'))).setAttribute("data-value",n.index),a.value="button ".concat(n.index+1),G(l,!0)}}}),n.bind(i.Gamepad.Event.BUTTON_UP,function(n){Object.keys(v.controllers).forEach(function(t){Object.keys(v.controllers[t]).forEach(function(e){parseInt(v.controllers[t][e].value2,10)===parseInt(n.index,10)&&parseInt(t,10)===parseInt(n.gamepad.index,10)&&v.simulateInput(t,e,0)})})}),n.bind(i.Gamepad.Event.AXIS_CHANGED,function(e){var t,n=.5<(t=parseFloat(e.value))||t<.5?0<t?1:-1:0;if(c.elements.dialogs.gamepad.hidden||l.hidden){v.prevButtons||(v.prevButtons={});var o=!1,i=e.gamepad.index.toString();v.prevButtons[i]||(v.prevButtons[i]={}),v.prevButtons[i][e.axis]||(v.prevButtons[i][e.axis]=0),v.prevButtons[i].buttonID||(v.prevButtons[i].buttonID=0);for(var a=0;a<Object.keys(v.controllers[i]).length;a++){var r=Object.keys(v.controllers[i])[a];v.controllers[i][r].value2&&(v.controllers[i][r].value2.split(":")[0]===e.axis&&parseInt(v.controllers[i][r].value2.split(":")[1])===n&&["24","25","26"].includes(r)&&("24"==r?(o=!0,v.quickSaveState()):"25"==r?(o=!0,v.quickLoadState()):"26"==r&&v.changeStateSlot()),0==n?v.controllers[i][r].value2.split(":")[0]===e.axis&&(v.prevButtons[i][e.axis]=n,v.prevButtons[i].buttonID=r,v.simulateInput(i,r,0)):((1===v.prevButtons[i][e.axis]&&-1==n||-1===v.prevButtons[i][e.axis]&&1==n)&&v.simulateInput(i,v.prevButtons[i].buttonID,0),v.controllers[i][r].value2.split(":")[0]===e.axis&&parseInt(v.controllers[i][r].value2.split(":")[1])===n&&(v.prevButtons[i][e.axis]=n,v.prevButtons[i].buttonID=r,o=!0,v.simulateInput(i,r,1))))}if(o)return;if(!c.elements.dialogs.gamepad.hidden&&!l.hidden)return}else 0!=n&&(t=l.getAttribute("data-id"),s=parseInt(l.getAttribute("data-index"),10),(t=c.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(s,'"][data-type="2"]'))).setAttribute("data-value",e.axis+":"+n),t.value=e.axis+":"+n,G(l,!0));Math.abs(e.value)<=.1&&(e.value=0);var s=e.gamepad.index;"LEFT_STICK_X"===e.axis&&(0<e.value?(v.simulateInput(s,16,32767*e.value),v.simulateInput(s,17,0)):(v.simulateInput(s,17,32767*e.value),v.simulateInput(s,16,0))),"LEFT_STICK_Y"===e.axis&&(0<e.value?(v.simulateInput(s,18,32767*e.value),v.simulateInput(s,19,0)):(v.simulateInput(s,19,32767*e.value),v.simulateInput(s,18,0))),"RIGHT_STICK_X"===e.axis&&(0<e.value?(v.simulateInput(s,20,32767*e.value),v.simulateInput(s,21,0)):(v.simulateInput(s,21,32767*e.value),v.simulateInput(s,20,0))),"RIGHT_STICK_Y"===e.axis&&(0<e.value?(v.simulateInput(s,22,32767*e.value),v.simulateInput(s,23,0)):(v.simulateInput(s,23,32767*e.value),v.simulateInput(s,22,0)))}),n.bind(i.Gamepad.Event.DISCONNECTED,function(e){[0,1,2,3].forEach(function(e){var t=n.gamepads[e];r.elements.dialogs.gamepad.querySelector("#controls-".concat(e," .gamepad-name")).innerHTML=t?t.id:"n/a"})}),n.bind(i.Gamepad.Event.CONNECTED,function(e){Object.keys(n.gamepads).forEach(function(e){var t=n.gamepads[e];r.elements.dialogs.gamepad.querySelector("#controls-".concat(e," .gamepad-name")).innerHTML=t?t.id:"n/a"})}))},setShader:function(e){"disabled"===e?(m.FS.unlink("/shader/shader.glslp",""),v.toggleShader&&v.toggleShader(0)):(v.toggleShader&&v.toggleShader(0),e="/shader/".concat(e),m.FS.writeFile("/shader/shader.glslp",function(e){if(!(e instanceof Int32Array))throw new Error("uintArrayToString: Only accepts Int32Array parameter");for(var t="",n=0,o=e.length;n<o;n+=1){var i=e[n];if(65535<i)throw new Error("Invalid value attempted to be serialised");t+=String.fromCharCode(i)}return t}(new Int32Array(m.FS.readFile(e)))),v.toggleShader&&v.toggleShader(1))},toggleVirtualGamepad:function(e){var t=this;if(null===v.virtualGamepadContainer){v.virtualGamepadContainer=j("div",{class:H({"ejs-virtual-gamepad":!0}),hidden:""}),this.elements.container.appendChild(v.virtualGamepadContainer);var n,o="height:31px;text-align:center;border:1px solid #ccc;border-radius:5px;line-height:31px;",i="";n=["snes","nds"].includes(t.system)?{order:["X","Y","A","B"],orderCSS:["left:40px;","top:40px;","left:81px;top:40px;","left:40px;top:80px;"],LandR:!0}:["gba","gb","vb","nes"].includes(t.system)?{order:["B","A"],orderCSS:["left:-10px;top:70px;","left:60px;top:70px;"],LandR:"gba"===t.system}:["n64"].includes(t.system)?{order:["B","A"],orderCSS:["left:-10px;top:95px;","left:40px;top:150px;"],LandR:!0}:{order:["Y","X","B","A"],orderCSS:["left:40px;","top:40px;","left:81px;top:40px;","left:40px;top:80px;"],LandR:!0},i=(i+='<div class="'+H({"virtual-gamepad":!0})+'" style="display: block;">')+('<div class="'+H({top:!0})+'">'),!0===n.LandR&&(i="n64"===t.system?(i=(i+='<div class="'+H({buttons:!0,b_l:!0})+'" style="left:10px;top:-40px;'+o+'">L</div>')+'<div class="'+H({buttons:!0,b_z:!0})+'" style="left:10px;'+o+'">Z</div>')+'<div class="'+H({buttons:!0,b_r:!0})+'" style="right:10px;top:-40px;'+o+'">R</div>':(i+='<div class="'+H({buttons:!0,b_l:!0})+'" style="left:10px;'+o+'">L</div>')+'<div class="'+H({buttons:!0,b_r:!0})+'" style="right:10px;'+o+'">R</div>'),i=(i=(i+="</div>")+('<div class="'+H({left:!0})+'"></div>'))+('<div class="'+H({center:!0})+'">'),"n64"===t.system?i+='<div class="'+H({buttons:!0,b_start:!0})+'" style="left:40px;">'+t.localization("Start")+"</div>":i=(i+='<div class="'+H({buttons:!0,b_start:!0})+'" style="left:60px;">'+t.localization("Start")+"</div>")+'<div class="'+H({buttons:!0,b_select:!0})+'" style="left:-5px;">'+t.localization("Select")+"</div>",i=(i+="</div>")+('<div class="'+H({right:!0})+'">'),"n64"===t.system&&(i=(i=(i=(i+='<div class="'+H({buttons:!0,b_cu:!0})+'" style="left:25px;top:-65px;"></div>')+'<div class="'+H({buttons:!0,b_cd:!0})+'" style="left:25px;top:15px;"></div>')+'<div class="'+H({buttons:!0,b_cl:!0})+'" style="left:-15px;top:-25px;"></div>')+'<div class="'+H({buttons:!0,b_cr:!0})+'" style="left:65px;top:-25px;"></div>');for(var a=0;a<n.order.length;a++){var r={buttons:!0};r["b_"+n.order[a].toLowerCase()]=!0,i+='<div class="'+H(r)+'" style="'+n.orderCSS[a]+'">'+n.order[a]+"</div>"}v.virtualGamepadContainer.innerHTML=i+="</div></div>",G(v.virtualGamepadContainer,!e);o=me.a.create({zone:q.call(this,".".concat(H({"ejs-virtual-gamepad":!0})," .").concat(H({left:!0}))),mode:"static",position:{left:"50%",top:"50%"},color:"red"});function s(){var e;return"n64"!==t.system||"d-pad"===(e=te&&"function"==typeof te.getCoreOptionsValues?te.getCoreOptionsValues()["joystick-input"]:e)?{downVal:1,4:4,5:5,6:6,7:7}:{downVal:32767,4:19,5:18,6:17,7:16}}o.on("end",function(e,t){v.syncInput(0,s()[4],0),v.syncInput(0,s()[5],0),v.syncInput(0,s()[6],0),v.syncInput(0,s()[7],0)}),o.on("move",function(e,t){t=t.angle.degree;30<=t&&t<150?v.syncInput(0,s()[4],s().downVal):window.setTimeout(function(){v.syncInput(0,s()[4],0)},30),210<=t&&t<330?v.syncInput(0,s()[5],s().downVal):window.setTimeout(function(){v.syncInput(0,s()[5],0)},30),120<=t&&t<240?v.syncInput(0,s()[6],s().downVal):window.setTimeout(function(){v.syncInput(0,s()[6],0)},30),300<=t||0<=t&&t<60?v.syncInput(0,s()[7],s().downVal):window.setTimeout(function(){v.syncInput(0,s()[7],0)},30)});var c,l=H({"virtual-gamepad":!0}),d=H({touch:!0}),o=(W.isIos||U.call(this,q.call(this,".".concat(l)),"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}].forEach(t=>{U.call(this,q.call(this,".".concat(l," .").concat(H(t.id))),"touchstart touchend mousedown mouseup mouseout",function(e){e.sourceCapabilities.firesTouchEvents&&e.type.includes("mouse")||(["touchend","mouseup","mouseout"].includes(e.type)?(V(e.target,d,!1),window.setTimeout(function(){v.syncInput(0,t.number,0)},30)):(V(e.target,d,!0),v.syncInput(0,t.number,1)),e.stopPropagation())})}),j("div",{class:H({ejs__widget:!0,ejs__widget_controls_toggle:!0})},""));o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96zM0 256C0 238.3 14.33 224 32 224H416C433.7 224 448 238.3 448 256C448 273.7 433.7 288 416 288H32C14.33 288 0 273.7 0 256zM416 448H32C14.33 448 0 433.7 0 416C0 398.3 14.33 384 32 384H416C433.7 384 448 398.3 448 416C448 433.7 433.7 448 416 448z"/></svg>',q.call(this,".".concat(H({ejs__widgets:!0}))).appendChild(o),U.call(this,o,"mousedown touchstart",function(e){e.sourceCapabilities.firesTouchEvents&&e.type.includes("mouse")||(V(e.target,d,!0),clearTimeout(c),K.toggleControls.call(t,!0),c=setTimeout(function(){K.toggleControls.call(t,!1)},5e3))})}else G(v.virtualGamepadContainer,!e)},setup:function(){var e,t,n,o=this;this.game?(v.playerName=o.config.playerName,V(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="#",o=1;o<4;o+=1)n+=t.slice(o,o+1).concat(t.slice(o,o+1));t=n}for(var i=[],a=1;a<7;a+=2)i.push(parseInt("0x".concat(t.slice(a,a+2)),16));return i}return null}(this.color))&&this.elements.container.setAttribute("style","--ejs-primary-color: ".concat(e[0],", ").concat(e[1],", ").concat(e[2])),this.elements.wrapper=j("div",{class:this.config.classNames.video}),P(this.game,this.elements.wrapper),"video"!==o.game.tagName.toLocaleLowerCase()&&(t=this.config.volume,Object.defineProperty(o.game,"volume",{get:function(){return t},set:function(e){t=e,F.call(o,o.game,"volumechange")}}),n=o.storage.get("muted"),Object.defineProperty(o.game,"muted",{get:function(){return n},set:function(e){e=!!z.boolean(e)&&e;n=e,F.call(o,o.game,"volumechange")}})),window.addEventListener("beforeunload",function(e){if(o.started){var t=o.startName.split("/").pop().split("."),t=t.slice(0,t.length-1).join(".");m.FS.syncfs(function(e){});try{var n="srm";"nds"===o.system&&(n="dsv"),m.FS.unlink("/data/saves/".concat(t,".").concat(n))}catch(e){console.log("fail to save")}v.saveSavFiles(),m.FS.syncfs(function(e){})}},!0)):console.warn("No game element found!")},listeners:function(){var r=this;r.elements.buttons.restart&&U.call(r,r.elements.buttons.restart,"click",function(e){if(v.restartGame(),v.inputsData={},v.connected&&v.connection.isInitiator){for(var t=v.getStateInfo().split("|"),n=t[0]>>0,o=(t[2],new Uint8Array(n)),i=t[1]>>0,a=0;a<n;a+=1)o[a]=m.Module.getValue(i+a);t=new File([o],"0-game.state",{type:"",lastModified:new Date});v.connection.shareFile(t),v.inputsData={},v.wait=!0,v.systemPause(1),m.Module.pauseMainLoop(),v.disableControl(!0)}}),r.elements.buttons.screenRecord&&U.call(r,r.elements.buttons.screenRecord,"click",function(e){var o,i,a;r.recordData||(r.recordData={started:!1,data:[],stopped:!1}),r.recordData.started?r.recordData.started&&(r.recordData.recorder.stop(),r.recordData.stopped=!0):(o=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"}:{},m.Module.pauseMainLoop(),r.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'),i=m.Module.canvas.captureStream(30),a=setTimeout(function(){r.playing=!0,m.Module.resumeMainLoop()},2e4),navigator.mediaDevices.getDisplayMedia({audio:!0,video:{mediaSource:"screen"}}).then(function(e){try{clearTimeout(a)}catch(e){}for(var t=e.getAudioTracks(),n=0;n<t.length;n++)i.addTrack(t[n]);e=i,r.elements.buttons.screenRecord.querySelector(".".concat(H({ejs__tooltip:!0}))).innerHTML=r.localization("Stop Screen Recording"),r.recordData.stream=e,r.recordData.recorder=new MediaRecorder(r.recordData.stream,o),r.recordData.recorder.ondataavailable=function(e){var t;0<e.data.size&&r.recordData.data.push(e.data),r.recordData.stopped&&((e=document.createElement("a")).href=window.URL.createObjectURL(new Blob(r.recordData.data,{type:"video/webm"})),"string"==typeof r.gameName&&(t=r.gameName),e.download=t?"".concat(t,"-recording.webm"):"record.webm",e.click(),window.URL.revokeObjectURL(e.href),delete r.recordData,r.elements.buttons.screenRecord.querySelector(".".concat(H({ejs__tooltip:!0}))).innerHTML=r.localization("Start Screen Recording"))},r.recordData.recorder.start(),r.recordData.started=!0,r.playing=!0,m.Module.resumeMainLoop()}))}),r.elements.buttons.play&&Array.from(r.elements.buttons.play).forEach(function(e){U.call(r,e,"click",function(e){r.playing?(r.playing=!1,m.Module.pauseMainLoop(),v.connected&&v.connection.isInitiator&&v.connection.send(JSON.stringify({act:"pause"})),F.call(r,r.elements.container,"pause",!1,{pause:!0})):(r.playing=!0,m.Module.resumeMainLoop(),v.connected&&v.connection.isInitiator&&v.connection.send(JSON.stringify({act:"resume"})),F.call(r,r.elements.container,"pause",!1,{pause:!1}))})}),r.elements.buttons.netplay&&U.call(r,r.elements.buttons.netplay,"click",function(e){v.disableControl(!0),G(r.elements.dialogs.netplay,!1),0<v.players.length?v.openRoom(r):(v.stopLoadRooms(),v.loadRoomsList()),v.playerName||g.show("modal-9de6c4e9ce2b9361",{closeByEsckey:!1})}),r.elements.buttons.cheat&&U.call(r,r.elements.buttons.cheat,"click",function(e){G(r.elements.dialogs.cheat,!1)}),U.call(r,r.elements.container,"savestate",function(e){var t;v.saveLoadDB.call(r,"save")||(t=e.detail.state,z.function(r.config.onsavestate)?r.config.onsavestate.call(null,{screenshot:e.detail.screenshot,state:t}):(e=new Blob([t]),t=(t=r.startName.split("/").pop().split(".")).slice(0,t.length-1).join("."),t=(t="string"==typeof r.gameName?r.gameName:t)?"".concat(t,".state"):"game.state",he()(e,t)),r.elements.container.focus())}),r.game.stateloadField=j("input"),r.game.stateloadField.type="file",r.game.stateloadField.onchange=function e(t){var n,t=t.target.files;0<t.length&&((n=new FileReader).file_name=t[0].name,n.onload=function(){var e=new Uint8Array(n.result);EJS_loadState(e)},n.readAsArrayBuffer(t[0])),r.game.stateloadField=j("input"),r.game.stateloadField.type="file",r.game.stateloadField.onchange=e},U.call(r,r.elements.container,"loadstate",function(e){v.saveLoadDB.call(r,"load")||(z.function(r.config.onloadstate)?r.config.onloadstate.call(null,r.loadState):r.game.stateloadField.click(),r.elements.container.focus())}),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState?console.log("hidden"):console.log("active")})},bindFunction:function(){var t,r=this,s=r.system,c=(m.Module&&m.Module._set_volume&&(t=m.Module.cwrap("set_volume","null",["number"]),v.setVolume=function(){var e=0;r.volume<1&&(e=0===r.volume?-80:30*r.volume-30,t(e)),r.muted&&(e=-80),t(e)}),v.setVariable=m.Module.cwrap("set_variable","null",["string","string"]),v.simulateInputFn=m.Module.cwrap("simulate_input","null",["number","number","number"]),{0:null,1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null,9:null,10:null,11:null,12:null,13:null,14:null,15:null,16:null,17:null,18:null,19:null,20:null,21:null,22:null,23:null,24:null,25:null,26:null,27:null,28:null,29:null,30:null,31:null}),n=(v.simulateInput=function(e,t,n){var o,i,a;v.connected?r.playing&&!v.disableInput&&(i=v.connection.userid,o=v.roomMaster===i,i=v.players.indexOf(i),a=v.currentFrameNum(),e>>0==0&&(c[t]!==n&&(o?(v.inputsData[a]||(v.inputsData[a]=[]),v.inputsData[a].push({index:i,key:t,status:n,frame:a}),v.simulateInputFn(i,t,n)):v.connection.send(JSON.stringify({act:"sync-control",value:["".concat(i,"|").concat(t,"|").concat(n,"|").concat(a)]}),v.roomMaster)),c[t]=n)):v.disableInput||v.simulateInputFn(e,t,n)},v.syncInput=v.simulateInput,window.simulateInput=v.simulateInput,m.Module.cwrap("shader_enable","null",["number"])),l=(v.toggleShader=function(e){return n(e)},v.getStateInfo=m.Module.cwrap("get_state_info","string",[]),v.saveState=function(){var e=v.getStateInfo().split("|"),t=e[0]>>0;if(0<t)for(var n=new Uint8Array(t),o=e[1]>>0,i=0;i<t;i++)n[i]=m.Module.getValue(o+i);return n},m.Module.cwrap("load_state","number",["string","number"])),e=(v.loadState=function(e,t){try{m.FS.unlink("game.state")}catch(e){}if(m._FS.createDataFile("/","game.state",e,!0,!0),null===t&&(t=0),"arcade"===s?setTimeout(function(){v.getStateInfo(),l("game.state",t),m.FS.unlink("game.state")},10):(l("game.state",t),setTimeout(function(){m.FS.unlink("game.state")},100)),v.connected&&v.connection.isInitiator){for(var e=v.getStateInfo().split("|"),n=e[0]>>0,o=(e[2],new Uint8Array(n)),i=e[1]>>0,a=0;a<n;a+=1)o[a]=m.Module.getValue(i+a);e=new File([o],"0-game.state",{type:"",lastModified:new Date});v.connection.shareFile(e),v.inputsData={},v.wait=!0,v.systemPause(1),m.Module.pauseMainLoop(),v.disableControl(!0)}r.elements.container.focus()},m.Module._set_cheat&&(v.setCheat=m.Module.cwrap("set_cheat","number",["number","number","string"])),m.Module._reset_cheat&&(v.resetCheat=m.Module._reset_cheat),v.quickSaveState=function(){if(r.started&&!v.connected){if(!1===r.statesSupported)return r.elements.widgets.stateInfoDiv.innerHTML="CANNOT CURRENTLY SAVE STATE",clearTimeout(v.saveMsgTransitions),void(v.saveMsgTransitions=setTimeout(function(){r.elements.widgets.stateInfoDiv.innerHTML=""},1500));var t,e=(t=te&&"function"==typeof te.getCoreOptionsValues&&te.getCoreOptionsValues()["save-state-slot"]||1)+"-quick.state";try{m.FS.unlink(e)}catch(e){}try{var n=v.saveState();m._FS.createDataFile("/",e,n,!0,!0),r.elements.widgets.stateInfoDiv.innerHTML="STATE SAVED TO SLOT "+t,clearTimeout(v.saveMsgTransitions),v.saveMsgTransitions=setTimeout(function(){r.elements.widgets.stateInfoDiv.innerHTML=""},1500)}catch(e){r.elements.widgets.stateInfoDiv.innerHTML="FAILED TO SAVE STATE TO SLOT "+t,clearTimeout(v.saveMsgTransitions),v.saveMsgTransitions=setTimeout(function(){r.elements.widgets.stateInfoDiv.innerHTML=""},1500)}}},v.saveMsgTransitions=null,v.quickLoadState=function(){if(r.started&&!v.connected){if(!1===r.statesSupported)return r.elements.widgets.stateInfoDiv.innerHTML="CANNOT CURRENTLY LOAD STATE",clearTimeout(v.saveMsgTransitions),void(v.saveMsgTransitions=setTimeout(function(){r.elements.widgets.stateInfoDiv.innerHTML=""},1500));var e,t=(e=te&&"function"==typeof te.getCoreOptionsValues&&te.getCoreOptionsValues()["save-state-slot"]||1)+"-quick.state",n=!0;try{l(t,0),"arcade"===s&&setTimeout(function(){v.getStateInfo(),l(t,0)},10)}catch(e){n=!1}r.elements.widgets.stateInfoDiv.innerHTML=n?"LOADED STATE FROM SLOT "+e:"FAILED TO LOAD STATE FROM SLOT "+e,clearTimeout(v.saveMsgTransitions),v.saveMsgTransitions=setTimeout(function(){r.elements.widgets.stateInfoDiv.innerHTML=""},1500)}},v.changeStateSlot=function(e){var t;t=te&&"function"==typeof te.getCoreOptionsValues&&te.getCoreOptionsValues()["save-state-slot"]||1,h.updateCoreOptions.call(r,"save-state-slot",t=9<(t="number"!=typeof e?t+1:e)?1:t),r.elements.widgets.stateInfoDiv.innerHTML="SET SAVE STATE SLOT TO "+t,clearTimeout(v.saveMsgTransitions),v.saveMsgTransitions=setTimeout(function(){r.elements.widgets.stateInfoDiv.innerHTML=""},1500)},window.EJS_loadState=function(t){v.loadState(t,0),setTimeout(function(){var e;v.connected&&(e=new File([t],"0-game.state",{type:"",lastModified:new Date}),v.connection.shareFile(e),v.inputsData={},v.wait=!0,v.systemPause(1),m.Module.pauseMainLoop(),v.disableControl(!0))},30)},m.Module.cwrap("cmd_take_screenshot","",[]));v.getScreenData=function(){return v.toggleShader(0),e(),v.toggleShader(1),m.FS.readFile("screenshot.png")},v.restartGame=m.Module.cwrap("system_restart","",[]),v.currentFrameNum=m.Module.cwrap("get_current_frame_count","",[]),v.saveSavFiles=m.Module.cwrap("cmd_savefiles","",[]),m.Module._get_core_options&&(v.getGameCoreOptions=m.Module.cwrap("get_core_options","string",[])),v.systemPause=function(e){return!1},v.controllers=te.storage.get("controllers"),v.controllers||(v.controllers=JSON.parse(JSON.stringify(v.defaultControllers)))}},ee=v;function Ve(e){var t=e.targetModal,n=e.triggers,n=void 0===n?[]:n,o=e.onShow,o=void 0===o?function(){}:o,i=e.onClose,i=void 0===i?function(){}:i,a=e.openTrigger,a=void 0===a?"data-micromodal-trigger":a,r=e.closeTrigger,r=void 0===r?"data-micromodal-close":r,s=e.disableScroll,s=void 0!==s&&s,c=e.disableFocus,c=void 0!==c&&c,l=e.awaitCloseAnimation,l=void 0!==l&&l,d=e.debugMode,d=void 0!==d&&d,e=e.closeByEsckey,e=void 0===e||e;if(!(this instanceof Ve))throw new TypeError("Cannot call a class as a function");this.modal=document.getElementById(t),this.config={debugMode:d,disableScroll:s,openTrigger:a,closeTrigger:r,onShow:o,onClose:i,awaitCloseAnimation:l,disableFocus:c,closeByEsckey:e},0<n.length&&this.registerTriggers.apply(this,De(n)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}var h={storage:null,coreOptionsValues:{},contextMenu:null,normalOptions:{shader:{label:"Shader",options:{disabled:"Disabled","2xScaleHQ.glslp":"2xScaleHQ","4xScaleHQ.glslp":"4xScaleHQ","crt-easymode.glslp":"CRT easymode","crt-aperture.glslp":"CRT aperture","crt-geom.glslp":"CRT geom"},default:"disabled"},"virtual-gamepad":{label:"Virtual Gamepad",options:{disabled:"Disabled",enabled:"Enabled"},default:"enabled"}},defaultCoreOptionsValues:function(){var e={};switch(this.system){case"pce":e={pce_nospritelimit:"enabled"};break;case"jaguar":e={virtualjaguar_doom_res_hack:"enabled"};break;case"psx":e={pcsx_rearmed_memcard2:"enabled"};break;case"nds":e={}}return e},getCoreOptionsValues:function(){var e=h.storage.get("core-options");return e=z.empty(e)?{}:e},getCoreOptions:function(){var i={};switch(this.system){case"nes":i.fceumm_palette={label:this.localization("Color Palette"),options:{default:this.localization("Default"),asqrealc:"asqrealc","nintendo-vc":"nintendo-vc",rgb:"rgb","yuv-v3":"yuv-v3","unsaturated-final":"unsaturated-final","sony-cxa2025as-us":"sony-cxa2025as-us",pal:"pal","bmf-final2":"bmf-final2","bmf-final3":"bmf-final3","smooth-fbx":"smooth-fbx","composite-direct-fbx":"composite-direct-fbx","pvm-style-d93-fbx":"pvm-style-d93-fbx",nescap:"nescap","ntsc-hardware-fbx":"ntsc-hardware-fbx","nes-classic-fbx-fs":"nes-classic-fbx-fs",wavebeam:"wavebeam"},default:"default"},i.fceumm_nospritelimit={label:this.localization("No Sprite Limit"),options:{enabled:this.localization("Enabled"),disabled:this.localization("Disabled")},default:"disabled"},i.fceumm_sndquality={label:this.localization("Sound Quality"),options:{Low:this.localization("Low"),High:this.localization("High"),"Very High":this.localization("Very High")},default:"Low"},this.lightgun||(i.system_type={label:this.localization("4 Players Support"),options:{nes:"NES",famicom:"Famicom"},default:"nes",netplay:!0}),i.fceumm_turbo_enable={label:this.localization("Turbo Enable"),options:{None:this.localization("None"),"Player 1":this.localization("Player 1"),"Player 2":this.localization("Player 2"),Both:this.localization("Both")},default:"None",netplay:!0},i.fceumm_region={label:this.localization("Region"),options:{Auto:this.localization("Auto"),NTSC:"NTSC",PAL:"PAL",Dendy:"Dendy"},default:"Auto",netplay:!0};break;case"snes":i={snes9x_next_overclock:{label:this.localization("SuperFX Overclock"),options:{disabled:this.localization("Disabled")+"(10MHz)","40MHz":"40MHz","60MHz":"60MHz","80MHz":"80MHz","100MHz":"100MHz"},default:"disabled",netplay:!0}};break;case"snes2002":case"snes2005":case"snes2010":i={};break;case"gb":i={gambatte_gb_colorization:{label:this.localization("GB Colorization"),options:{disabled:this.localization("Disabled"),auto:this.localization("auto"),internal:this.localization("internal")},default:"disabled"},gambatte_gb_internal_palette:{label:this.localization("Internal Palette"),options:{"GBC - Blue":this.localization("GBC - Blue"),"GBC - Brown":this.localization("GBC - Brown"),"GBC - Dark Blue":this.localization("GBC - Dark Blue"),"GBC - Dark Brown":this.localization("GBC - Dark Brown"),"GBC - Dark Green":this.localization("GBC - Dark Green"),"GBC - Grayscale":this.localization("GBC - Grayscale"),"GBC - Green":this.localization("GBC - Green"),"GBC - Inverted":this.localization("GBC - Inverted"),"GBC - Orange":this.localization("GBC - Orange"),"GBC - Pastel Mix":this.localization("GBC - Pastel Mix"),"GBC - Red":this.localization("GBC - Red"),"GBC - Yellow":this.localization("GBC - Yellow")},default:"GBC - Blue"}};break;case"gba":i={mgba_solar_sensor_level:{label:this.localization("Solar sensor level"),options:["0","1","2","3","4","5","6","7","8","9","10"],default:"0"},mgba_frameskip:{label:this.localization("Frameskip"),options:["0","1","2","3","4","5","6","7","8","9","10"],default:"0"}};break;case"vbanext":i={vbanext_turboenable:{label:this.localization("Enable Turbo Buttons"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled"},vbanext_turbodelay:{label:this.localization("Turbo Delay in frames"),options:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"],default:"2"}};break;case"n64":i={"glupen64-aspect":{label:this.localization("Aspect Ratio (Need to refresh page)"),options:["4:3","16:9"],default:"4:3"},"glupen64-43screensize":{label:this.localization("4:3 Resolution"),options:["320x240","640x480","960x720","1280x960"],default:"320x240"},"glupen64-169screensize":{label:this.localization("16:9 Resolution"),options:["640x360","960x540","1280x720"],default:"640x360"},"glupen64-pak1":{label:this.localization("Player 1 Pak"),options:{none:this.localization("none"),memory:this.localization("memory"),rumble:this.localization("rumble")},default:"none",netplay:!0},"glupen64-pak2":{label:this.localization("Player 2 Pak"),options:{none:this.localization("none"),memory:this.localization("memory"),rumble:this.localization("rumble")},default:"none",netplay:!0},"glupen64-pak3":{label:this.localization("Player 3 Pak"),options:{none:this.localization("none"),memory:this.localization("memory"),rumble:this.localization("rumble")},default:"none",netplay:!0},"glupen64-pak4":{label:this.localization("Player 4 Pak"),options:{none:this.localization("none"),memory:this.localization("memory"),rumble:this.localization("rumble")},default:"none",netplay:!0}},!ee||"undefined"==ee.virtualGamepadContainer&&null===ee.virtualGamepadContainer||(i["joystick-input"]={label:this.localization("Joystick input keys"),options:{"d-pad":this.localization("d-pad"),"analog-stick":this.localization("Analog Stick")},default:"analog-stick",netplay:!0});break;case"nds":i={desmume_screens_layout:{label:this.localization("Screen layout"),options:{"top/bottom":this.localization("top/bottom"),"bottom/top":this.localization("bottom/top"),"left/right":this.localization("left/right"),"right/left":this.localization("right/left"),"top only":this.localization("top only"),"bottom only":this.localization("bottom only"),"quick switch":this.localization("quick switch"),"hybrid/top":this.localization("hybrid/top"),"hybrid/bottom":this.localization("hybrid/bottom")},default:"top/bottom"},screen_rotation:{label:this.localization("Screen Rotation"),options:{0:"0°",90:"90°",180:"180°",270:"270°"},default:0},desmume_frameskip:{label:this.localization("Frameskip"),options:["0","1","2","3","4","5","6","7","8","9"],default:"0"}},X.wasm||delete i.screen_rotation;break;case"vb":case"pce":i={};break;case"segaMS":case"segaGG":case"segaMD":case"segaCD":i={genesis_plus_gx_no_sprite_limit:{label:this.localization("No Sprite Limit"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled"},genesis_plus_gx_overclock:{label:this.localization("CPU speed"),options:["100%","125%","150%","175%","200%"],default:"100%",netplay:!0},genesis_plus_gx_sound_output:{label:this.localization("Sound output"),options:{stereo:this.localization("stereo"),mono:this.localization("mono")},default:"stereo"}};break;case"sega32x":i={picodrive_sprlim:{label:this.localization("No sprite limit"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled"}};break;case"segaSaturn":i={yabause_frameskip:{label:this.localization("Frameskip"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled"}};break;case"msx":i={bluemsx_nospritelimits:{label:this.localization("No Sprite Limit"),options:{OFF:this.localization("OFF"),ON:this.localization("ON")},default:"OFF"}};break;case"ws":case"ngp":i={};break;case"jaguar":i={virtualjaguar_usefastblitter:{label:this.localization("Fast Blitter"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled"},virtualjaguar_bios:{label:this.localization("Bios"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled"}};break;case"psx":i={pcsx_rearmed_frameskip:{label:this.localization("Frameskip"),options:[0,1,2,3],default:0,netplay:!0},pcsx_rearmed_memcard2:{label:this.localization("Enable second memory card"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"enabled",netplay:!0},pcsx_rearmed_pad1type:{label:this.localization("Pad 1 Type"),options:{default:this.localization("default"),none:this.localization("none"),standard:this.localization("standard"),analog:this.localization("analog"),negcon:this.localization("negcon")},default:"default",netplay:!0},pcsx_rearmed_pad2type:{label:this.localization("Pad 2 Type"),options:{default:this.localization("default"),none:this.localization("none"),standard:this.localization("standard"),analog:this.localization("analog"),negcon:this.localization("negcon")},default:"default",netplay:!0},pcsx_rearmed_pad3type:{label:this.localization("Pad 3 Type"),options:{default:this.localization("default"),none:this.localization("none"),standard:this.localization("standard"),analog:this.localization("analog"),negcon:this.localization("negcon")},default:"default",netplay:!0},pcsx_rearmed_pad4type:{label:this.localization("Pad 4 Type"),options:{default:this.localization("default"),none:this.localization("none"),standard:this.localization("standard"),analog:this.localization("analog"),negcon:this.localization("negcon")},default:"default",netplay:!0},pcsx_rearmed_vibration:{label:this.localization("Enable Vibration"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"enabled",netplay:!0},pcsx_rearmed_neon_interlace_enable:{label:this.localization("Enable interlacing mode(s)"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled",netplay:!0},pcsx_rearmed_neon_enhancement_enable:{label:this.localization("Enhanced resolution (slow)"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled",netplay:!0},pcsx_rearmed_neon_enhancement_no_main:{label:this.localization("Enhanced resolution speed hack"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled",netplay:!0}};break;case"arcade":case"fba0.2.97.29":i={"fba-aspect":{label:this.localization("Aspect ratio"),options:["DAR","PAR"],default:"DAR"},"fba-frameskip":{label:this.localization("Frameskip"),options:["0","1","2","3","4","5"],default:"0",netplay:!0},"fba-cpu-speed-adjust":{label:this.localization("CPU overclock"),options:["100","110","120","130","140","150","160","170","180","190","200"],default:"100",netplay:!0},"fba-diagnostic-input":{label:this.localization("Diagnostic Input"),options:["None","Hold Start","Start + A + B","Hold Start + A + B","Start + L + R","Hold Start + L + R","Hold Select","Select + A + B","Hold Select + A + B","Select + L + R","Hold Select + L + R"],default:"None",netplay:!0},"fba-neogeo-mode":{label:this.localization("Force Neo Geo mode"),options:["MVS","AES","UNIBIOS","DIPSWITCH"],default:"MVS",netplay:!0}};break;case"mame2003":case"mame2010":case"mame":case"dos":i={};break;default:i={},console.warn("Unsupported emulator")}return 2===this.coreVer&&(i={}),!0===this.statesSupported&&(i["save-state-slot"]={label:this.localization("Save State Slot"),options:[1,2,3,4,5,6,7,8,9],default:1}),!0!==this.statesSupported||!window.indexedDB||"string"!=typeof this.gameName&&this.config.gameUrl.startsWith("blob:")||(i["save-state-location"]={label:this.localization("Save State Location"),options:{download:this.localization("download"),"keep in browser":this.localization("keep in browser")},default:"download"}),ee.getGameCoreOptions&&ee.getGameCoreOptions().split("\n").forEach(function(e,t){var n,e=e.split("; "),o=e[0];0===o.indexOf("fba-dipswitch-")&&(e=e[1].split("|"),n=o.replace(/_/g," ").replace(/.+\-(.+)/,"$1"),i[o]={label:n,options:e.slice(1,-1),default:e[0].replace("(Default) ",""),netplay:!0})}),i},supportNetPlay:function(){if(this.lightgun||this.mouse)return!1;var e=window.RTCPeerConnection||window.webkitPeerConnection00||window.webkitRTCPeerConnection||window.mozRTCPeerConnection,t=window.mozRTCIceCandidate||window.RTCIceCandidate,n=window.mozRTCSessionDescription||window.RTCSessionDescription;return!!(e&&t&&n)&&!!(e&&"createDataChannel"in e.prototype)},isNetPlay:function(){},findElements:function(){try{return this.elements.controls=q.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:s.call(this,this.config.selectors.buttons.play),pause:q.call(this,this.config.selectors.buttons.pause),restart:q.call(this,this.config.selectors.buttons.restart),mute:q.call(this,this.config.selectors.buttons.mute),settings:q.call(this,this.config.selectors.buttons.settings),fullscreen:q.call(this,this.config.selectors.buttons.fullscreen),saveState:q.call(this,this.config.selectors.buttons.saveState),screenRecord:q.call(this,this.config.selectors.buttons.screenRecord),loadState:q.call(this,this.config.selectors.buttons.loadState),gamepad:q.call(this,this.config.selectors.buttons.gamepad),netplay:q.call(this,this.config.selectors.buttons.netplay),cheat:q.call(this,this.config.selectors.buttons.cheat)},this.elements.inputs={volume:q.call(this,this.config.selectors.inputs.volume)},!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),!1}},createIcon:function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t=(I(n,Y(t,{role:"presentation",focusable:"false"})),document.createElement("div"));t.innerHTML="<svg>".concat(this.icons[e],"</svg>");for(var o=t.childNodes[0].childNodes,i=0;i<o.length;i+=1)n.appendChild(o[i]);return n},createLabel:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=de(e,this.config),n={};return n[t.class]=!0,n[this.config.classNames.hidden]=!0,j("span",Object.assign({},t,{class:[t.class,this.config.classNames.tooltip].filter(Boolean).join(" ")}),e)},createBadge:function(e){if(z.empty(e))return null;var t=j("span",{class:this.config.classNames.menu.value});return t.appendChild(j("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){var n,o,i,a,r=j("button"),t=Object.assign({},t),s=function(e){return(e=function(e){e=le((0<arguments.length&&void 0!==e?e:"").toString(),"-"," ");return e=le(e,"_"," "),le(function(e){return(0<arguments.length&&void 0!==e?e:"").toString().replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})}(e)," ","")}(e=(0<arguments.length&&void 0!==e?e:"").toString())).charAt(0).toLowerCase()+e.slice(1)}(e),c=!1,l=("type"in t||(t.type="button"),H({ejs__control:!0}));switch("class"in t?t.class.includes(l)||(t.class+=" ".concat(l)):t.class=l,e){case"play":c=!0,o=n="play",a=i="pause";break;case"mute":c=!0,n="mute",i="unmute",o="volume",a="muted";break;case"fullscreen":c=!0,n="enterFullscreen",i="exitFullscreen",o="enter-fullscreen",a="exit-fullscreen";break;default:n=s,o=e}return c?(r.appendChild(h.createIcon.call(this,a,{class:H({"icon--pressed":!0})})),r.appendChild(h.createIcon.call(this,o,{class:H({"icon--not-pressed":!0})})),r.appendChild(h.createLabel.call(this,i,{class:H({"icon--pressed":!0})})),r.appendChild(h.createLabel.call(this,n,{class:H({"icon--not-pressed":!0})}))):(r.appendChild(h.createIcon.call(this,o)),r.appendChild(h.createLabel.call(this,n))),Y(t,L(this.config.selectors.buttons[s],t)),I(r,t),"play"===s?(z.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(r)):this.elements.buttons[s]=r,r},createRange:function(e,t){t=j("input",Y(L(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.1,value:0,autocomplete:"off",role:"slider","aria-label":de(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=t,h.updateRangeFill.call(this,t),t},bindMenuItemShortcuts:function(o,i){var a=this;U(o,"keydown keyup",function(e){var t,n;[32,38,39,40].includes(e.which)&&(e.preventDefault(),e.stopPropagation(),"keydown"!==e.type)&&(!(n=oe(o,'[role="menuitemradio"]'))&&[32,39].includes(e.which)?h.showMenuPanel.call(a,i,!0):32!==e.which&&(40===e.which||n&&39===e.which?(t=o.nextElementSibling,z.element(t)||(t=o.parentNode.firstElementChild)):(t=o.previousElementSibling,z.element(t)||(t=o.parentNode.lastElementChild)),ie.call(a,t,!0)))},!1),U(o,"keyup",function(e){13===e.which&&h.focusFirstMenuItem.call(a,null,!0)})},createMenuItem:function(e){var t=this,n=e.value,o=e.list,i=e.type,a=e.title,r=e.badge,r=void 0===r?null:r,e=e.checked,e=void 0!==e&&e,s=L(this.config.selectors.inputs[i]),c=j("button",Y(s,{type:"button",role:"menuitemradio",class:"".concat(this.config.classNames.control," ").concat(s.class||"").trim(),"aria-checked":e,value:n})),s=j("span"),l=(s.innerHTML=a,z.element(r)&&s.appendChild(r),c.appendChild(s),Object.defineProperty(c,"checked",{enumerable:!0,get:function(){return"true"===c.getAttribute("aria-checked")},set:function(e){e&&Array.from(c.parentNode.children).filter(function(e){return oe(e,'[role="menuitemradio"]')}).forEach(function(e){return e.setAttribute("aria-checked","false")}),c.setAttribute("aria-checked",e?"true":"false")}}),h.getCoreOptions.call(this));this.listeners.bind(c,"click keyup",function(e){z.keyboardEvent(e)&&32!==e.which||(e.preventDefault(),e.stopPropagation(),c.checked=!0,Object.keys(h.normalOptions).includes(i)&&h.updateNormalOptions.call(t,i,n),Object.keys(l).includes(i)&&(l[i].netplay&&ee.connected?ee.connection.isInitiator&&(h.updateCoreOptions.call(t,i,n),ee.connection.send(JSON.stringify({act:"update-core-option",key:i,value:n,frame:ee.currentFrame}))):h.updateCoreOptions.call(t,i,n)),h.showMenuPanel.call(t,"home",z.keyboardEvent(e)))},i,!1),h.bindMenuItemShortcuts.call(this,c,i),o.appendChild(c)},updateVolume:function(){z.element(this.elements.inputs.volume)&&h.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),z.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume)},setRange:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;z.element(e)&&(e.value=t,h.updateRangeFill.call(this,e))},updateRangeFill:function(e){var t,e=z.event(e)?e.target:e;z.element(e)&&"range"===e.getAttribute("type")&&(oe(e,this.config.selectors.inputs.volume)?(t=100*e.value,e.setAttribute("aria-valuenow",t),e.setAttribute("aria-valuetext","".concat(t.toFixed(1),"%"))):e.setAttribute("aria-valuenow",e.value),W.isWebkit&&e.style.setProperty("--value","".concat(e.value/e.max*100,"%")))},toggleMenuButton:function(e,t){G(this.elements.settings.buttons[e],!t)},updateNormalOptions:function(e,t){this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML=h.normalOptions[e].options[t];var n={};n[e]=t,h.storage.set(n),"shader"===e&&ee.setShader(t),"virtual-gamepad"===e&&ee.toggleVirtualGamepad.call(this,"enabled"===t)},updateCoreOptions:function(e,t){if("nds"==this.system&&!X.wasm)return!0;if(h.coreOptionsValues[e]=t,"psx"===this.system&&m.Module.pauseMainLoop(),ee.setVariable(e,t),"psx"===this.system&&(setTimeout(function(){m.Module.resumeMainLoop()},100),setTimeout(function(){m.Module.resumeMainLoop()},200)),"nds"===this.system&&X.wasm){var n=this.elements.wrapper.querySelector("canvas");if("screen_rotation"===e)switch(n.style.transform="rotate("+t+"deg)",t){case"0":ee.setVariable("desmume_input_rotation","0");break;case"90":ee.setVariable("desmume_input_rotation","270");break;case"180":ee.setVariable("desmume_input_rotation","180");break;case"270":ee.setVariable("desmume_input_rotation","90")}}"arcade"!==this.system&&"fba0.2.97.29"!==this.system||((n=this.elements.wrapper.querySelector("canvas")).height="fba-aspect"===e&&"PAR"===t?n.width/16*9:n.width/4*3);var n=h.getCoreOptions.call(this),o=h.storage.get("core-options");(o=z.empty(o)?{}:o)[e]=t,h.storage.set({"core-options":o}),this.elements.settings.buttons[e]&&(o=this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)),z.object(n[e].options)?o.innerHTML=n[e].options[t]:o.innerHTML=t)},setOptionMenuItem:function(l,d){var u=this,f=this.elements.settings.panels.home.querySelector('[role="menu"]'),p=this.elements.settings.popup.children[0];Object.keys(l).forEach(function(t){var n=t,e=j("button",Y(L(u.config.selectors.buttons.settings),{type:"button",class:H({ejs__control:!0,"ejs__control--forward":!0}),role:"menuitem",item:t,"aria-haspopup":!0}));U(e,"click",function(){h.showMenuPanel.call(u,n,!1)});var o,i=j("span",null,l[t].label),a=j("span",{class:u.config.classNames.menu.value}),a=(z.object(d)&&(o=d[n]),z.empty(o)&&(o=l[n].default),z.object(l[n].options)?a.innerHTML=l[n].options[o]:a.innerHTML=o,i.appendChild(a),e.appendChild(i),f.appendChild(e),j("div",{"data-pane":escape(n),hidden:""})),i=j("button",{type:"button",class:H({ejs__control:!0,"ejs__control--back":!0})}),r=(i.appendChild(j("span",{"aria-hidden":!0},l[t].label)),i.appendChild(j("span",{class:H({"ejs__sr-only":!0})},de("menuBack",u.config))),U(a,"keydown",function(e){37===e.which&&(e.preventDefault(),e.stopPropagation(),h.showMenuPanel.call(u,"home",!0))},!1),U(i,"click",function(){h.showMenuPanel.call(u,"home",!1)}),a.appendChild(i),a.appendChild(j("div",{role:"menu"})),p.appendChild(a),u.elements.settings.buttons[n]=e,(u.elements.settings.panels[n]=a).querySelector('[role="menu"]')),s=r;if(z.element(s))for(var c=s.childNodes.length;0<c;)s.removeChild(s.lastChild),--c;z.object(l[t].options)?Object.keys(l[t].options).forEach(function(e){h.createMenuItem.call(u,{value:e,list:r,type:n,title:l[t].options[e],badge:null,checked:Boolean(o===e)})}):z.array(l[t].options)&&l[t].options.forEach(function(e){h.createMenuItem.call(u,{value:e,list:r,type:n,title:e,badge:null,checked:Boolean(o===e)})})})},setNormalOptionsMenu:function(){var t=this,o=this,e={};e.orientation=h.storage.get("orientation"),e.shader=h.storage.get("shader"),o.touch?(e["virtual-gamepad"]=h.storage.get("virtual-gamepad"),U.call(o,o.elements.container,"start-game",function(){"enabled"!==e["virtual-gamepad"]&&!z.empty(e["virtual-gamepad"])||ee.toggleVirtualGamepad.call(o,!0)})):delete h.normalOptions["virtual-gamepad"],h.setOptionMenuItem.call(this,h.normalOptions,e),U.call(o,o.elements.container,"start-game",function(){var n=t,i={},e=(ee.getGameCoreOptions&&ee.getGameCoreOptions().split("\n").forEach(function(e,t){var n,e=e.split("; "),o=e[0];0===o.indexOf("fba-dipswitch-")&&(e=e[1].split("|"),n=o.replace(/_/g," ").replace(/.+\-(.+)/,"$1"),i[o]={label:n,options:e.slice(1,-1),default:e[0].replace("(Default) ",""),netplay:!0})}),h.storage.get("core-options"));h.coreOptionsValues=e||{},h.setOptionMenuItem.call(o,i,h.coreOptionsValues),Object.keys(h.coreOptionsValues).forEach(function(e,t){h.updateCoreOptions.call(n,e,h.coreOptionsValues[e])}),"nds"==o.system&&(m.Module._fast_forward_2?m.Module._fast_forward_2(1):m.Module._fast_forward&&m.Module._fast_forward(1))})},updateCoreOptionMenuItems:function(){var t=this.elements.settings.panels.home.querySelector('[role="menu"]'),n=h.getCoreOptions.call(this);ee.connected&&!ee.connection.isInitiator?Object.keys(n).forEach(function(e){n[e].netplay&&t.querySelector('[item="'.concat(e,'"]')).setAttribute("disabled","")}):Object.keys(n).forEach(function(e){t.querySelector('[item="'.concat(e,'"]')).removeAttribute("disabled")})},setCoreOptionsMenu:function(){this.elements.settings.panels.home.querySelector('[role="menu"]'),this.elements.settings.popup.children[0];var e=h.getCoreOptions.call(this),t=h.storage.get("core-options");h.coreOptionsValues=t||{},h.setOptionMenuItem.call(this,e,t)},checkMenu:function(){var e=this.elements.settings.buttons;z.empty(e)||Object.values(e).some(function(e){return!e.hidden}),G(this.elements.settings.menu,!1)},focusFirstMenuItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.elements.settings.popup.hidden||(e=(e=z.element(e=e)?e:Object.values(this.elements.settings.panels).find(function(e){return!e.hidden})).querySelector('[role^="menuitem"]'),ie.call(this,e,t))},toggleMenu:function(e){var t=this.elements.settings.popup,n=this.elements.buttons.settings;if(z.element(t)&&z.element(n)){var o=t.hidden,i=o;if(z.boolean(e))i=e;else if(z.keyboardEvent(e)&&27===e.which)i=!1;else if(z.event(e)){var a=t.contains(e.target);if(a||!a&&e.target!==n&&i)return}n.setAttribute("aria-expanded",i),G(t,!i),V(this.elements.container,this.config.classNames.menu.open,i),i&&z.keyboardEvent(e)?h.focusFirstMenuItem.call(this,null,!0):i||o||ie.call(this,n,z.keyboardEvent(e))}},getMenuSize:function(e){var t=e.cloneNode(!0),e=(t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t),t.scrollWidth),n=t.scrollHeight;return N(t),{width:e,height:n}},showLoadStatePanel:function(){},showMenuPanel:function(){var n,e,t,o=this,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",a=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=q.call(this,'[data-pane="'.concat(escape(i),'"]'));z.element(i)&&(n=i.parentNode,e=Array.from(n.children).find(function(e){return!e.hidden}),X.transitions&&!X.reducedMotion&&(n.style.width="".concat(e.scrollWidth,"px"),n.style.height="".concat(e.scrollHeight,"px"),t=h.getMenuSize.call(this,i),U.call(this,n,re,function e(t){t.target===n&&["width","height"].includes(t.propertyName)&&(n.style.width="",n.style.height="",k.call(o,n,re,e))}),n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px")),G(e,!0),G(i,!1),h.focusFirstMenuItem.call(this,i,a))},setLoadState:function(e,t){e.appendChild(h.createButton.call(this,"load-state",{"aria-haspopup":!0,"aria-expanded":!1}));var e=j("div",{class:H({ejs__dialog:!0,"ejs__load-state__container":!0}),hidden:""}),n=j("div");e.appendChild(n),q.call(this,".".concat(H({ejs__dialogs:!0}))).appendChild(e),this.elements.dialogs.loadState=e},setScreenRecord:function(e,t){var n;window.MediaRecorder&&(n=h.createButton.call(this,"screen-record",{"aria-haspopup":!0,"aria-expanded":!1,style:"margin-right:auto;"}),e.appendChild(n),e=j("div",{class:H({ejs__dialog:!0,ejs__screenRecord__container:!0}),hidden:""}),n=j("div"),e.appendChild(n),q.call(this,".".concat(H({ejs__dialogs:!0}))).appendChild(e),this.elements.dialogs.screenRecord=e)},setGamepad:function(e,t){var n=h.createButton.call(this,"gamepad",{"aria-haspopup":!0,"aria-expanded":!1,style:"margin-right:auto;"}),e=(e.appendChild(n),j("div",{class:H({ejs__dialog:!0,ejs__gamepad__container:!0}),hidden:""})),n=j("div");e.appendChild(n),q.call(this,".".concat(H({ejs__dialogs:!0}))).appendChild(e),this.elements.dialogs.gamepad=e},setCheat:function(e,t){var n=h.createButton.call(this,"cheat",{"aria-haspopup":!0,"aria-expanded":!1,style:"margin-right:auto;"}),e=(e.appendChild(n),j("div",{class:H({ejs__dialog:!0,ejs__cheat__container:!0}),hidden:""})),n=j("div");e.appendChild(n),q.call(this,".".concat(H({ejs__dialogs:!0}))).appendChild(e),this.elements.dialogs.cheat=e},setStateInfoBarWidget:function(){var e=j("div",{class:H({ejs__widget:!0})}),t=j("div");t.style="color: red;font-size: 17px;padding:10px;text-align:left;text-shadow:1px 1px 1px #000",e.appendChild(t),q.call(this,".".concat(H({ejs__widgets:!0}))).appendChild(e),this.elements.widgets.stateInfo=e,this.elements.widgets.stateInfoDiv=t},setNetplayWidgets:function(){var e=j("div",{class:H({ejs__widget:!0,ejs__widget_netplay:!0})}),t=j("div");e.appendChild(t),q.call(this,".".concat(H({ejs__widgets:!0}))).appendChild(e),this.elements.widgets.netplay=e},setNetplay:function(e,t){e.appendChild(h.createButton.call(this,"netplay",{"aria-haspopup":!0,"aria-expanded":!1}));var e=j("div",{class:H({ejs__dialog:!0,ejs__netplay__container:!0}),hidden:""}),n=j("div");e.appendChild(n),q.call(this,".".concat(H({ejs__dialogs:!0}))).appendChild(e),this.elements.dialogs.netplay=e,h.setNetplayWidgets.call(this)},toggleContextMenu:function(e,t){var n,o;D(e.target,H({ejs__dialogs:!0}))&&(n=h.contextMenu.timer,this.started&&(o=q.call(this,".".concat(H({ejs__contextmenu:!0})," ul")),t?(h.contextMenu.style.display="block",h.contextMenu.style.left="".concat(e.layerX,"px"),h.contextMenu.style.top="".concat(e.layerY,"px"),s.call(this,".".concat(H({ejs__contextmenu:!0})," ul li")),null===o.getAttribute("menu")&&((t=j("li",{})).appendChild(j("a",{target:"_blank",href:"https://github.com/ethanaobrien/emulatorjs"},"EmulatorJS v".concat(this.version))),o.appendChild(t),o.setAttribute("menu","")),n&&clearTimeout(n),n=setTimeout(function(){},4e3),h.contextMenu.timer=n):h.contextMenu.style.display="none"))},create:function(e){var o=this,t=(h.storage=new fe(this,"ejs_".concat(this.system,"_settings")),j("div",L(this.config.selectors.controls.wrapper))),i=(h.contextMenu=j("div",{class:H({ejs__contextmenu:!0}),style:"position: absolute; display:none;z-index:9"}),["<ul>","</ul>"]),a=[];function n(e,t,n){"function"==typeof n?a.push(n):a.push(function(){});n=i.length-1;t?i.splice(n,0,'<li hidden><a href="#" onclick="return false">'+e+"</a></li>"):i.splice(n,0,'<li><a href="#" onclick="return false">'+e+"</a></li>")}n(o.localization("Take Screenshot"),!1,function(e){var t=v.getScreenData(),n=(n="string"==typeof o.gameName?o.gameName:n)?"".concat(n,"-screenshot.png"):"game.png";return he()(new Blob([t]),n),!1}),n(o.localization("Cache Manage"),!0,function(e){var n;return m.romdb&&(G(o.elements.dialogs.cache,!1),(n=o.elements.dialogs.cache.querySelector(".".concat(v.classNames["dialog-content"]))).innerHTML="<div>"+o.localization("Loading")+"</div>",m.romdb.getAll(function(e){var t,l;e?(t=j("table",{style:"width:100%;padding-left:10px;text-align:left"}),l=j("tbody"),0<e.length?(n.innerHTML="",e.forEach(function(e,t){if(e.key&&!/-part-\d+$/.test(e.key)){for(var n=Math.ceil(e.filesize/104857600),o=[e.key],i=1;i<n;i+=1)o.push("".concat(e.key,"-part-").concat(i));var a=j("tr"),r=j("td"),s=j("td"),c=j("td");r.innerHTML=e.filename,s.innerHTML=function(e){for(var t=-1;t++,1024<(e/=1024););return Math.max(e,.1).toFixed(1)+[" kB"," MB"," GB"," TB","PB","EB","ZB","YB"][t]}(e.filesize),c.innerHTML='<a href="#" onclick="return false">Remove</a>',a.appendChild(r),a.appendChild(s),a.appendChild(c),l.appendChild(a),c.querySelector("a").onclick=function(e){m.romdb.removeBatch(o);try{l.removeChild(a)}catch(e){}return e.stopPropagation(),!1}}}),t.appendChild(l),n.appendChild(t)):n.innerHTML='<div style="text-align:center">'+o.localization("Empty")+"</div>"):n.innerHTML='<div style="text-align:center">'+o.localization("Empty")+"</div>"},function(){})),!1}),n(o.localization("Quick Save")+" (F2)",!1,function(e){v.quickSaveState(),te.contextMenu.style.display="none"}),n(o.localization("Quick Load")+" (F4)",!1,function(e){v.quickLoadState(),te.contextMenu.style.display="none"}),h.contextMenu.innerHTML=i.join("");for(var r=h.contextMenu.getElementsByTagName("li"),s=0;s<r.length;s++)U.call(o,r[s],"click",a[s]);this.elements.container.appendChild(h.contextMenu);var c=j("div",{class:H({ejs__dialog:!0,ejs__cache__container:!0}),hidden:""}),c=(q.call(this,".".concat(H({ejs__dialogs:!0}))).appendChild(c),this.elements.dialogs.cache=c,j("div",{class:H({ejs__dialog:!0,ejs__loading__container:!0}),hidden:""})),c=(q.call(this,".".concat(H({ejs__dialogs:!0}))).appendChild(c),this.elements.dialogs.loading=c,t.appendChild(h.createButton.call(this,"restart")),t.appendChild(h.createButton.call(this,"play")),t.appendChild(h.createButton.call(this,"save-state",{"aria-expanded":!1})),h.setLoadState.call(this,t,e),h.setScreenRecord.call(this,t,e),h.supportNetPlay.call(this,t)&&0<parseInt(this.config.gameId,10)&&h.setNetplay.call(this,t,e),h.setGamepad.call(this,t,e),h.setStateInfoBarWidget.call(this,t,e),h.setCheat.call(this,t,e),t.appendChild(j("span",{style:"flex:1"})),j("div",{class:H({ejs__volume:!0})})),e=(c.appendChild(h.createButton.call(this,"mute")),{max:1,step:.01,value:this.config.volume}),e=(c.appendChild(h.createRange.call(this,"volume",Y(e,{}))),this.elements.volume=c,t.appendChild(c),j("div",{class:H({ejs__menu:!0})})),c=(e.appendChild(h.createButton.call(this,"settings",{"aria-haspopup":!0,"aria-expanded":!1})),j("div",{class:H({ejs__menu__container:!0}),hidden:""})),l=j("div"),d=j("div",{"data-pane":"home"}),u=j("div",{role:"menu"}),f=(d.appendChild(u),l.appendChild(d),this.elements.settings.panels.home=d,c.appendChild(l),e.appendChild(c),t.appendChild(e),this.elements.settings.popup=c,this.elements.settings.menu=e,t.appendChild(h.createButton.call(this,"fullscreen")),this);return t.addEventListener("mousedown",function(){f.onButtonDiv=!0}),this.elements.controls=t,h.setNormalOptionsMenu.call(this),h.setCoreOptionsMenu.call(this),t},inject:function(){var n=this,e=(this.icons={"enter-fullscreen":'<path d="M10 3h3.6l-4 4L11 8.4l4-4V8h2V1h-7zM7 9.6l-4 4V10H1v7h7v-2H4.4l4-4z"/>',"exit-fullscreen":'<path d="M1 12h3.6l-4 4L2 17.4l4-4V17h2v-7H1zM16 .6l-4 4V1h-2v7h7V6h-3.6l4-4z"/>',gamepad:'<svg viewBox="0 0 640 512"><path fill="currentColor" d="M480 96H160C71.6 96 0 167.6 0 256s71.6 160 160 160c44.8 0 85.2-18.4 114.2-48h91.5c29 29.6 69.5 48 114.2 48 88.4 0 160-71.6 160-160S568.4 96 480 96zM256 276c0 6.6-5.4 12-12 12h-52v52c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-52H76c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h52v-52c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h52c6.6 0 12 5.4 12 12v40zm184 68c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm80-80c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48z"/></svg>',"load-state":'<svg viewBox="0 0 576 512"><path fill="currentColor" d="M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"/></svg>',muted:'<path d="M12.4 12.5l2.1-2.1 2.1 2.1 1.4-1.4L15.9 9 18 6.9l-1.4-1.4-2.1 2.1-2.1-2.1L11 6.9 13.1 9 11 11.1zM3.786 6.008H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601L3.786 6.008z"/>',netplay:'<svg viewBox="0 0 512 512"><path fill="currentColor" d="M364.215 192h131.43c5.439 20.419 8.354 41.868 8.354 64s-2.915 43.581-8.354 64h-131.43c5.154-43.049 4.939-86.746 0-128zM185.214 352c10.678 53.68 33.173 112.514 70.125 151.992.221.001.44.008.661.008s.44-.008.661-.008c37.012-39.543 59.467-98.414 70.125-151.992H185.214zm174.13-192h125.385C452.802 84.024 384.128 27.305 300.95 12.075c30.238 43.12 48.821 96.332 58.394 147.925zm-27.35 32H180.006c-5.339 41.914-5.345 86.037 0 128h151.989c5.339-41.915 5.345-86.037-.001-128zM152.656 352H27.271c31.926 75.976 100.6 132.695 183.778 147.925-30.246-43.136-48.823-96.35-58.393-147.925zm206.688 0c-9.575 51.605-28.163 104.814-58.394 147.925 83.178-15.23 151.852-71.949 183.778-147.925H359.344zm-32.558-192c-10.678-53.68-33.174-112.514-70.125-151.992-.221 0-.44-.008-.661-.008s-.44.008-.661.008C218.327 47.551 195.872 106.422 185.214 160h141.572zM16.355 192C10.915 212.419 8 233.868 8 256s2.915 43.581 8.355 64h131.43c-4.939-41.254-5.154-84.951 0-128H16.355zm136.301-32c9.575-51.602 28.161-104.81 58.394-147.925C127.872 27.305 59.198 84.024 27.271 160h125.385z"/></svg>',pause:'<path d="M6 1H3c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1zM12 1c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1h-3z"/>',play:'<path d="M15.562 8.1L3.87.225C3.052-.337 2 .225 2 1.125v15.75c0 .9 1.052 1.462 1.87.9L15.563 9.9c.584-.45.584-1.35 0-1.8z"/>',restart:'<path d="M9.7 1.2l.7 6.4 2.1-2.1c1.9 1.9 1.9 5.1 0 7-.9 1-2.2 1.5-3.5 1.5-1.3 0-2.6-.5-3.5-1.5-1.9-1.9-1.9-5.1 0-7 .6-.6 1.4-1.1 2.3-1.3l-.6-1.9C6 2.6 4.9 3.2 4 4.1 1.3 6.8 1.3 11.2 4 14c1.3 1.3 3.1 2 4.9 2 1.9 0 3.6-.7 4.9-2 2.7-2.7 2.7-7.1 0-9.9L16 1.9l-6.3-.7z"/>',"save-state":'<svg viewBox="0 0 448 512"><path fill="currentColor" d="M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"/></svg>',"screen-record":'<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px",viewBox="0 0 39.989 39.989" style="enable-background:new 0 0 39.989 39.989;" xml:space="preserve"><path id="XMLID_155_" d="M19.994,0C8.952,0,0,8.952,0,19.995c0,11.043,8.952,19.994,19.994,19.994s19.995-8.952,19.995-19.994,C39.989,8.952,31.037,0,19.994,0z M19.994,27.745c-4.28,0-7.75-3.47-7.75-7.75s3.47-7.75,7.75-7.75s7.75,3.47,7.75,7.75,S24.275,27.745,19.994,27.745z"/></svg>',settings:'<path d="M16.135 7.784a2 2 0 0 1-1.23-2.969c.322-.536.225-.998-.094-1.316l-.31-.31c-.318-.318-.78-.415-1.316-.094a2 2 0 0 1-2.969-1.23C10.065 1.258 9.669 1 9.219 1h-.438c-.45 0-.845.258-.997.865a2 2 0 0 1-2.969 1.23c-.536-.322-.999-.225-1.317.093l-.31.31c-.318.318-.415.781-.093 1.317a2 2 0 0 1-1.23 2.969C1.26 7.935 1 8.33 1 8.781v.438c0 .45.258.845.865.997a2 2 0 0 1 1.23 2.969c-.322.536-.225.998.094 1.316l.31.31c.319.319.782.415 1.316.094a2 2 0 0 1 2.969 1.23c.151.607.547.865.997.865h.438c.45 0 .845-.258.997-.865a2 2 0 0 1 2.969-1.23c.535.321.997.225 1.316-.094l.31-.31c.318-.318.415-.781.094-1.316a2 2 0 0 1 1.23-2.969c.607-.151.865-.547.865-.997v-.438c0-.451-.26-.846-.865-.997zM9 12a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"/>',volume:'<path d="M15.5999996,3.3 C15.1999996,2.9 14.5999996,2.9 14.1999996,3.3 C13.7999996,3.7 13.7999996,4.3 14.1999996,4.7 C15.3999996,5.9 15.9999996,7.4 15.9999996,9 C15.9999996,10.6 15.3999996,12.1 14.1999996,13.3 C13.7999996,13.7 13.7999996,14.3 14.1999996,14.7 C14.3999996,14.9 14.6999996,15 14.8999996,15 C15.1999996,15 15.3999996,14.9 15.5999996,14.7 C17.0999996,13.2 17.9999996,11.2 17.9999996,9 C17.9999996,6.8 17.0999996,4.8 15.5999996,3.3 L15.5999996,3.3 Z"></path>\n <path d="M11.2819745,5.28197449 C10.9060085,5.65794047 10.9060085,6.22188944 11.2819745,6.59785542 C12.0171538,7.33303477 12.2772954,8.05605449 12.2772954,9.00000021 C12.2772954,9.93588462 11.851678,10.9172014 11.2819745,11.4869049 C10.9060085,11.8628709 10.9060085,12.4268199 11.2819745,12.8027859 C11.4271642,12.9479755 11.9176724,13.0649528 12.2998149,12.9592565 C12.4124479,12.9281035 12.5156669,12.8776063 12.5978555,12.8027859 C13.773371,11.732654 14.1311161,10.1597914 14.1312523,9.00000021 C14.1312723,8.8299555 14.1286311,8.66015647 14.119665,8.4897429 C14.0674781,7.49784946 13.8010171,6.48513613 12.5978554,5.28197449 C12.2218894,4.9060085 11.6579405,4.9060085 11.2819745,5.28197449 Z"></path>\n <path d="M3.78571429,6.00820648 L0.714285714,6.00820648 C0.285714286,6.00820648 0,6.30901277 0,6.76022222 L0,11.2723167 C0,11.7235261 0.285714286,12.0243324 0.714285714,12.0243324 L3.78571429,12.0243324 L7.85714286,15.8819922 C8.35714286,16.1827985 9,15.8819922 9,15.2803796 L9,2.75215925 C9,2.15054666 8.35714286,1.77453879 7.85714286,2.15054666 L3.78571429,6.00820648 Z"></path>',cheat:'<svg viewBox="0 0 496 512"><path fill="currentColor" d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm4 72.6c-20.8 25-51.5 39.4-84 39.4s-63.2-14.3-84-39.4c-8.5-10.2-23.7-11.5-33.8-3.1-10.2 8.5-11.5 23.6-3.1 33.8 30 36 74.1 56.6 120.9 56.6s90.9-20.6 120.9-56.6c8.5-10.2 7.1-25.3-3.1-33.8-10.1-8.4-25.3-7.1-33.8 3.1z" class=""></path></svg>'},this.id=Math.floor(1e4*Math.random()),null),t=(this.elements.controls=null,{id:this.id}),o=!0;z.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this.props)),this.config.controls||(this.config.controls=[]),z.element(this.config.controls)||z.string(this.config.controls)?e=this.config.controls:(e=h.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality}),o=!1);function i(e){var n=e;return Object.entries(t).forEach(function(e){t=2;var e=function(e){if(Array.isArray(e))return e}(e=e)||function(e,t){var n=[],o=!0,i=!1,a=void 0;try{for(var r,s=e[Symbol.iterator]();!(o=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);o=!0);}catch(e){i=!0,a=e}finally{try{o||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}(),t=e[0],e=e[1];n=le(n,"{".concat(t,"}"),e)}),n}var a,r;o&&(z.string(this.config.controls)?e=i(e):z.element(e)&&(e.innerHTML=i(e.innerHTML))),z.string(this.config.selectors.controls.container)&&(a=document.querySelector(this.config.selectors.controls.container)),(a=z.element(a)?a:this.elements.container)[z.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),z.element(this.elements.controls)||h.findElements.call(this),z.empty(this.elements.buttons)||(r=function(e){var t=n.config.classNames.controlPressed;Object.defineProperty(e,"pressed",{enumerable:!0,get:function(){return D(e,t)},set:function(){V(e,t,0<arguments.length&&void 0!==arguments[0]&&arguments[0])}})},Object.values(this.elements.buttons).filter(Boolean).forEach(function(e){z.array(e)||z.nodeList(e)?Array.from(e).filter(Boolean).forEach(r):r(e)})),window.navigator.userAgent.includes("Edge")&&se(a)}},te=h;function qe(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function He(){var e;this.enabled&&(e=this.player.elements.buttons.fullscreen,z.element(e)&&(e.pressed=this.active),F.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0),W.isIos||function(){var n,o,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];z.element(e)&&(e=s.call(this,"button:not(:disabled), input:not(:disabled), [tabindex]"),n=e[0],o=e[e.length-1],l.call(this,this.elements.container,"keydown",function(e){var t;"Tab"===e.key&&9===e.keyCode&&((t=document.activeElement)!==o||e.shiftKey?t===n&&e.shiftKey&&(o.focus(),e.preventDefault()):(n.focus(),e.preventDefault()))},t,!1))}.call(this.player,this.target,this.active))}function We(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];e?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=e?"hidden":"",V(this.target,this.player.config.classNames.fullscreen.fallback,e),He.call(this)}a=[{key:"native",get:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},{key:"prefix",get:function(){if(z.function(document.exitFullscreen))return"";var t="";return["webkit","moz","ms"].some(function(e){return!(!z.function(document["".concat(e,"ExitFullscreen")])&&!z.function(document["".concat(e,"CancelFullScreen")])||(t=e,0))}),t}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}],qe((o=f).prototype,[{key:"update",value:function(){this.enabled,V(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(f.native?this.prefix?z.empty(this.prefix)||this.target["".concat(this.prefix,"Request").concat(this.property)]():this.target.requestFullscreen():We.call(this,!0))}},{key:"exit",value:function(){var e;this.enabled&&(f.native?this.prefix?z.empty(this.prefix)||(e="moz"===this.prefix?"Cancel":"Exit",document["".concat(this.prefix).concat(e).concat(this.property)]()):(document.cancelFullScreen||document.exitFullscreen).call(document):We.call(this,!1))}},{key:"toggle",value:function(){this.active?this.exit():this.enter()}},{key:"enabled",get:function(){return f.native}},{key:"active",get:function(){return!!this.enabled&&(f.native?(this.prefix?document["".concat(this.prefix).concat(this.property,"Element")]:document.fullscreenElement)===this.target:D(this.target,this.player.config.classNames.fullscreen.fallback))}},{key:"target",get:function(){return W.isEdge?this.player.game:this.player.elements.container}}]),qe(o,a);var Xe=f;function f(e){var t=this;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this.player=e,this.prefix=f.prefix,this.property=f.property,this.scrollPosition={x:0,y:0},U.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":"".concat(this.prefix,"fullscreenchange"),function(){He.call(t)}),this.update()}Je.prototype={toggleMenu:function(e){te.toggleMenu.call(this.emulator,e)},firstTouch:function(){var e=this.emulator,t=e.elements;e.touch=!0,V(t.container,e.config.classNames.isTouch,!0)},setTabFocus:function(e){var t=this.emulator,n=t.elements,o=t;clearTimeout(this.focusTimer),"keydown"===e.type&&9!==e.which||("keydown"===e.type&&(this.lastKeyDown=e.timeStamp),t=e.timeStamp-this.lastKeyDown<=20,"focus"===e.type&&!t||(e=o.config.classNames.tabFocus,V(s.call(o,".".concat(e)),e,!1),this.focusTimer=setTimeout(function(){var e=document.activeElement;n.container.contains(e)&&V(document.activeElement,o.config.classNames.tabFocus,!0)},10)))},global:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=this.emulator;l.call(t,document.body,"click",this.toggleMenu,e),ne.call(t,document.body,"touchstart",this.firstTouch),l.call(t,document.body,"keydown focus blur",this.setTabFocus,e,!1,!0),U.call(t,document.body,"keyup",function(e){t.started&&(113===e.which&&(e.shiftKey?null===t.elements.buttons.saveState.getAttribute("hidden")&&F.call(t,t.elements.buttons.saveState,"click"):ee.quickSaveState()),115===e.which&&(e.shiftKey?null===t.elements.buttons.loadState.getAttribute("hidden")&&F.call(t,t.elements.buttons.loadState,"click"):ee.quickLoadState()),120===e.which&&F.call(t,t.elements.buttons.mute,"click"))})},container:function(){var n,o=this.emulator,i=o.elements,a=o,r=null;U.call(a,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen start-game",function(e){var t=i.controls;t&&"enterfullscreen"===e.type&&(t.pressed=!1,t.hover=!1);if(["touchstart","touchmove","mousemove","start-game"].includes(e.type)){if("nds"==o.system&&"mousemove"==e.type&&m&&m.Module&&m.Module.canvas&&(document.pointerLockElement===m.Module.canvas||document.mozPointerLockElement===m.Module.canvas))return void K.toggleControls.call(a,!1);!ee||"undefined"!=ee.virtualGamepadContainer&&null!==ee.virtualGamepadContainer||(K.toggleControls.call(a,!0),t=a.touch?3e3:2e3,clearTimeout(n),n=setTimeout(function(){return K.toggleControls.call(a,!1)},t),i.controls.setAttribute("data-timer",n))}}),U.call(a,window,"resize",function(e){var t=a.elements.container.clientHeight,n=s.call(a,".".concat(H({ejs__menu__container:!0}),' [role="menu"]'));Array.from(n).forEach(function(e){e.style.maxHeight="".concat(t-95,"px"),e.style.overflow="auto"}),m.Module&&m.Module.canvas,a.elements.container.clientWidth/a.elements.container.clientHeight<1.3?V(a.elements.container,H({portrait:!0}),!0):V(a.elements.container,H({portrait:!0}),!1)}),F.call(a,window,"resize"),U.call(a,a.elements.container,"enterfullscreen",function(e){if(m.isMobileDevice&&window.screen&&screen.orientation&&"function"==typeof screen.orientation.lock)try{screen.orientation.lock("landscape")}catch(e){}else if(m.isMobileDevice&&window.ScreenOrientation&&"function"==typeof ScreenOrientation.lock)try{ScreenOrientation.lock("landscape")}catch(e){}var t;2===a.coreVer&&m.Module&&(t=50,clearInterval(r),r=setInterval(function(){m.Module.setCanvasSize(window.innerWidth,window.innerHeight),t<0&&clearInterval(r),t--},100)),setTimeout(function(){F.call(a,window,"resize")},300)}),U.call(a,a.elements.container,"exitfullscreen",function(e){if(m.isMobileDevice&&window.screen&&screen.orientation&&"function"==typeof screen.orientation.unlock)try{screen.orientation.unlock()}catch(e){}else if(m.isMobileDevice&&window.ScreenOrientation&&"function"==typeof ScreenOrientation.unlock)try{ScreenOrientation.unlock()}catch(e){}2===a.coreVer&&m.Module&&(clearInterval(r),m.Module.setCanvasSize(800,600)),setTimeout(function(){F.call(a,window,"resize")},300)}),U.call(a,a.elements.container,"start-game",function(e){var t=window.document.createEvent("UIEvents");t.initUIEvent("resize",!0,!1,window,0),window.dispatchEvent(t),V(a.elements.container,H({"game-started":!0}),!0)}),U.call(a,a.elements.container,"blur",function(e){var t=e.currentTarget;setTimeout(function(){t.contains(document.activeElement)||F.call(a,a.elements,"blurgame")},0)}),U.call(a,a.elements.container,"focus",function(e){var t=e.currentTarget;setTimeout(function(){t.contains(document.activeElement)&&F.call(a,a.elements,"focusgame")},0)})},media:function(){var t=this.emulator,n=t.elements,o=t,e=(U.call(o,o.game,"volumechange",function(e){return te.updateVolume.call(o,e)}),U.call(o,n.container,"contextmenu",function(e){o.touch||o.lightgun||te.toggleContextMenu.call(o,e,!0),e.preventDefault()},!1),U.call(o,n.container,"mousewheel",function(e){e.stopPropagation()},!1),U.call(o,n.container,"mousedown",function(e){"nds"==t.system&&m&&m.Module&&m.Module.canvas&&!m.isMobileDevice&&document.pointerLockElement!==m.Module.canvas&&document.mozPointerLockElement!==m.Module.canvas&&t.started&&!t.connected&&setTimeout(function(){!0!==t.onButtonDiv&&(m.Module.canvas.requestPointerLock=m.Module.canvas.requestPointerLock||m.Module.canvas.mozRequestPointerLock,m.Module.canvas.requestPointerLock()),t.onButtonDiv=!1},100),o.touch||te.toggleContextMenu.call(o,e,!1)},!1),U.call(o,o.game,"volumechange",function(){o.storage.set({volume:o.volume,muted:o.muted}),ee.setVolume&&ee.setVolume()}),o.config.events.concat(["keyup","keydown"]).join(" "));U.call(o,o.game,e,function(e){var t=e.detail,t=void 0===t?{}:t;"error"===e.type&&(t=o.game.error),F.call(o,n.container,e.type,!0,t)})},proxy:function(e,t,n){var o=this.emulator,n=o.config.listeners[n],i=!0;(i=z.function(n)?n.call(o,e):i)&&z.function(t)&&t.call(o,e)},bind:function(e,t,n,o){var i=this,a=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],r=this.emulator,s=r.config.listeners[o],s=z.function(s);U.call(r,e,t,function(e){return i.proxy(e,n,o)},a&&!s)},controls:function(){var e,i=this,a=this.emulator,t=a.elements,n=W.isIE?"change":"input";this.bind(t.buttons.mute,"click",function(){a.muted=!a.muted},"mute"),this.bind(t.buttons.fullscreen,"click",function(){a.fullscreen.toggle()},"fullscreen"),this.bind(t.buttons.gamepad,"click",function(){K.toggleControls.call(a,!1),G(t.dialogs.gamepad,!1)},"mute"),this.bind(t.buttons.saveState,"click",function(){F.call(a,a.elements.container,"savestate-start",!1,{});var e=ee.saveState(),t=ee.getScreenData();F.call(a,a.elements.container,"savestate",!1,{state:e,screenshot:t})},"mute"),this.bind(t.buttons.loadState,"click",function(){F.call(a,a.elements.container,"loadstate",!1,{})},"mute"),this.bind(t.buttons.settings,"click",function(e){e.stopPropagation(),te.toggleMenu.call(a,e)}),this.bind(t.buttons.settings,"keyup",function(e){var t=e.which;[13,32].includes(t)&&(13!==t?(e.preventDefault(),e.stopPropagation(),te.toggleMenu.call(a,e)):te.focusFirstMenuItem.call(a,null,!0))},null,!1),this.bind(t.settings.menu,"keydown",function(e){27===e.which&&te.toggleMenu.call(a,e)}),W.isIos&&(e=s.call(a,'input[type="range"]'),Array.from(e).forEach(function(e){return i.bind(e,n,function(e){return se(e.target)})})),W.isWebkit&&Array.from(s.call(a,'input[type="range"]')).forEach(function(e){i.bind(e,"input",function(e){return te.updateRangeFill.call(a,e.target)})}),this.bind(t.inputs.volume,n,function(e){a.volume=e.target.value},"volume"),this.bind(t.controls,"mouseenter mouseleave",function(e){"mouseleave"===e.type&&null===e.toElement?t.controls.hover=!0:t.controls.hover=!a.touch&&"mouseenter"===e.type}),this.bind(t.controls,"mousedown mouseup touchstart touchend touchcancel",function(e){["mousedown","touchstart"].includes(e.type)?(t.controls.pressed=!0,e=t.controls.getAttribute("data-timer2"),clearTimeout(e)):(e=setTimeout(function(){t.controls.pressed=!1},4e3),t.controls.setAttribute("data-timer2",e))}),this.bind(t.controls,"focusin focusout",function(e){var t=a.config,n=a.elements,e="focusin"===e.type,o=n.controls.getAttribute("data-timer");V(n.controls,t.classNames.noTransition,e),K.toggleControls.call(a,e),e&&(setTimeout(function(){V(n.controls,t.classNames.noTransition,!1)},0),e=i.touch?3e3:4e3,clearTimeout(o),o=setTimeout(function(){return K.toggleControls.call(a,!1)},e),n.controls.setAttribute("data-timer",o))}),this.bind(t.inputs.volume,"wheel",function(e){var t=e.webkitDirectionInvertedFromDevice,n=function(e,t){if(Array.isArray(e))return e;var n=[],o=!0,i=!1,a=void 0;try{for(var r,s=e[Symbol.iterator]();!(o=(r=s.next()).done)&&(n.push(r.value),!t||n.length!==t);o=!0);}catch(e){i=!0,a=e}finally{try{o||null==s.return||s.return()}finally{if(i)throw a}}return n}([e.deltaX,-e.deltaY].map(function(e){return t?-e:e}),2),o=n[0],n=n[1],o=Math.sign(Math.abs(o)>Math.abs(n)?o:n),n=(a.increaseVolume(o/50),a.game.volume);(1===o&&n<1||-1===o&&0<n)&&e.preventDefault()},"volume",!1),this.bind(t.controls,"contextmenu",function(e){e.stopPropagation()}),this.bind(t.contextMenu,"contextmenu",function(e){e.stopPropagation()})}};var Ye=Je;function Je(e){if(!(this instanceof Je))throw new TypeError("Cannot call a class as a function");this.emulator=e,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}function Ke(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e=[{key:"setup",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=null;return z.string(e)?n=Array.from(document.querySelectorAll(e)):z.nodeList(e)?n=Array.from(e):z.array(e)&&(n=e.filter(z.element)),z.empty(n)?null:n.map(function(e){return new Qe(e,t)})}}],Ke((o=Qe).prototype,[{key:"restart",value:function(){this.currentTime=0}},{key:"increaseVolume",value:function(e){var t=this.game.muted?0:this.volume;this.volume=t+(z.number(e)?e:0)}},{key:"decreaseVolume",value:function(e){this.increaseVolume(-e)}},{key:"toggleControls",value:function(e){return!!this.started&&((e=V(this.elements.container,this.config.classNames.hideControls,void 0===e?void 0:!e))&&te.toggleMenu.call(this,!1),!e)}},{key:"setStatesSupported",value:function(e){this.statesSupported=e}},{key:"loadState",value:function(e){ee.loadState(e,0)}},{key:"on",value:function(e,t){U.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){ne.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){k(this.elements.container,e,t)}},{key:"playing",set:function(){var t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];Array.from(this.elements.buttons.play||[]).forEach(function(e){e.pressed=t}),this.paused=!t},get:function(){return Boolean(this.ready&&!this.paused)}},{key:"volume",set:function(e){var t=e;z.string(t)&&(t=Number(t)),z.number(t)||(t=this.storage.get("volume")),z.number(t)||(t=this.config.volume),this.config.volume=t=(t=1<t?1:t)<0?0:t,this.game.volume=t,!z.empty(e)&&this.muted&&0<t&&(this.muted=!1)},get:function(){return Number(this.game.volume)}},{key:"muted",set:function(e){z.boolean(e)||(e=this.storage.get("muted")),z.boolean(e)||(e=this.config.muted),this.config.muted=e,this.game.muted=e},get:function(){return Boolean(this.game.muted)}}]),Ke(o,e);a=Qe;function Qe(c,l){return new Promise(async function(e,t){function o(e,t){for(var n,o=window.location.pathname.split("/").pop(),i=window.location.pathname.substring(0,window.location.pathname.length-o.length).split("/"),a=e.split("/"),r=[],s=0;s<i.length;s++)""!=i[s]&&r.push(i[s]);if(!(e.startsWith("/")||e.includes("://")||e.includes("http:")||e.includes("https:")||e.includes("file:")||e.includes("blob:"))){for(var c=0;c<a.length;c++)""!=a[c]&&"."!=a[c]&&(".."==a[c]?0<r.length&&(r=("/"===(n=r.join("/"))?"/":n.substring(0,n.length-n.split("/").pop().length)).split("/")):r.push(a[c]));(e=r.join("/")).startsWith("/")||(e="/"+e),e=window.location.protocol+"//"+window.location.host+e}return!(e=e.startsWith("/")?window.location.protocol+"//"+window.location.host+e:e).endsWith("/")&&t&&(e+="/"),e}var n,i=this,a=(this.version="1.2.2",this.system="",this.adUrl=null,this.gameName=null,this.loadStateOnStart=!1,this.statesSupported=!0,this.mameCore=null,this.startOnLoad=!1,this.dataPath="",this.customPaths=null,this.hash="",this.lightgun=!1,this.mouse=!1,this.multitap=!1,this.ready=!1,this.paused=!0,this.started=!1,this.touch=X.touch,this.game=c,z.string(this.game)&&(this.game=document.querySelectorAll(this.game)),(window.jQuery&&this.game instanceof jQuery||z.nodeList(this.game)||z.array(this.game))&&(this.game=this.game[0]),this.game=this.game,this.game.innerHTML="",this.config=Y({},E,Qe.defaults,l||{}),this.coreVer=(n=this.config.system,!0===this.config.useBeta&&window.WebAssembly&&["nes","snes","gb","nds"].includes(n)?2:1),this.lightgun=this.config.lightgun,this.loadStateOnStart=this.config.loadStateOnStart||!1,this.adUrl=this.config.adUrl||null,this.gameName=this.config.gameName||null,this.mouse=this.config.mouse,this.multitap=this.config.multitap,this.cheats=this.config.cheats,this.cheats||(this.cheats=[]),n=this.config.oldNetplayServer,"string"==typeof(a=this.config.netplayUrl)?a:!0===n?"https://ws.emulatorjs.com/":"https://emuserver.emulatorjs.ga/"),r=(this.listUrl=a,this.socketUrl=a,this.mameCore=this.config.mameCore||null,this.color=this.config.color,this.startOnLoad=this.config.startOnLoad||!1,this.statesSupported=this.config.statesSupported||!0,this.customPaths=function(e){if(!e)return{};var t,n={};for(t in e)"string"==typeof e[t]&&(n[t]=o(e[t]));return n}(this.config.paths),this.dataPath="string"!=typeof(n=this.config.dataPath)?(a=window.location.href,r=(s=a).split("/").pop(),s=s.substring(0,s.length-r.length),"/"==a?window.location.protocol+"//"+window.location.host+"/":((s=s.startsWith("/")?window.location.protocol+"//"+window.location.host+s:s).endsWith("/")||(s+="/"),s)):o(n,!0),this.localization=await async function(e,t,n){var o={};if(n&&"string"==typeof n&&"en-US"!==n){t=t&&"string"==typeof t[n+".json"]?t[n+".json"]:e+"localization/"+n+".json";try{var i=await(await fetch(t)).text(),o=JSON.parse(i);E.i18n=o.i18n,h.normalOptions=o.normalOptions}catch(e){console.warn("error setting localization",e)}}return function(e){return"string"==typeof o[e]?o[e]:(n&&"en-US"!==n&&"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX&&console.warn('Missing translation for "'+e+'". Language is set to "'+n+'"'),e)}}(this.dataPath,this.customPaths,this.config.lang),this.config=Y({},E,Qe.defaults,l||{}),Object.keys(this.config.classNames).forEach(function(n){var e=i;z.object(e.config.classNames[n])?Object.keys(e.config.classNames[n]).forEach(function(e){var t={};t[i.config.classNames[n][e]]=!0,i.config.classNames[n][e]=H(t)}):((e={})[i.config.classNames[n]]=!0,i.config.classNames[n]=H(e))}),this.config.selectors.controls.wrapper=".".concat(H({ejs__controls:!0})),this.config.selectors.container=".".concat(H({ejs:!0})),this.system=this.config.system,this.elements={container:null,buttons:{},display:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}},dialogs:{gamepad:null,loading:null,netplay:null},widgets:{}},this.fullscreen={active:!1},this.config.mute=!0,this.eventListeners=[],this.listeners=new Ye(this),this.storage=new fe(this,"ejs_settings"),this.game.emulator=this,z.element(this.elements.container)||(this.elements.container=j("div"),P(this.game,this.elements.container)),j("div",{class:H({ejs__widgets:!0})})),a=(this.elements.container.appendChild(r),j("div",{class:H({ejs__dialogs:!0})})),s=(this.elements.container.appendChild(a),K.addStyleHook.call(this),ee.setup.call(this),K.build.call(this),this.listeners.container(),this.listeners.global(),this.fullscreen=new Xe(this),m.create.call(this),document.createElement("script"));s.src=this.customPaths&&"string"==typeof this.customPaths["webrtc-adapter.js"]?this.customPaths["webrtc-adapter.js"]:this.dataPath+"webrtc-adapter.js",document.body.appendChild(s),e(this)}.bind(this))}a.defaults={},y.default=a}]).default;