2 lines
257 KiB
JavaScript
2 lines
257 KiB
JavaScript
var EJS=function(a){window.EJS_MODULES=a;var n={},o=[];function i(e){if(n[e])return n[e].exports;o.push(e);var t=n[e]={i:e,l:!1,exports:{}};return a[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}return window.getUsedModules=function(){return o.sort(function(e,t){return t<e?1:-1})},window.getUnusedModules=function(){for(var e=[],t=getUsedModules(),n=0;n<a.length;n++)null===a[n]||t.includes(n)||e.push(n);return e},Array.isArray,i.m=a,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)i.d(n,a,function(e){return t[e]}.bind(null,a));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=161)}([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){function t(){if(!(navigator.getGamepads||navigator.webkitGetGamepads))throw new Error("get gamepads not found!");if(this.rAF=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame,!this.rAF)throw new Error("request animation frame was not found!");this.loop()}t.prototype={gamepads:[],rAF:null,getGamepads:function(){return navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[]},loop:async function(){this.updateGamepadState(),this.rAF.call(null,this.loop.bind(this))},updateGamepadState:function(){for(var n=this.getGamepads(),a=0;a<n.length;a++)if(n[a]){for(var e=!1,o=0;o<this.gamepads.length;o++)if(this.gamepads[o]&&this.gamepads[o].index===n[a].index){if(e=!0,"function"==typeof this.onaxischanged)for(var t,i=0;i<this.gamepads[o].axes.length;i++)n[a].axes[i]===this.gamepads[o].axes[i]||(t=function(){switch(i){case 0:return"LEFT_STICK_X";case 1:return"LEFT_STICK_Y";case 2:return"RIGHT_STICK_X";case 3:return"RIGHT_STICK_Y";default:return""}}())&&this.onaxischanged({axis:t,value:n[a].axes[i],index:a,gamepadIndex:n[a].index});for(i=0;i<this.gamepads[o].buttons.length;i++){let e=1==this.gamepads[o].buttons[i],t=("object"==typeof this.gamepads[o].buttons[i]&&(e=this.gamepads[o].buttons[i].pressed),1==n[a].buttons[i]);"object"==typeof n[a].buttons[i]&&(t=n[a].buttons[i].pressed),e!==t&&(t?"function"==typeof this.onbuttondown&&this.onbuttondown({index:i,gamepadIndex:n[a].index}):"function"==typeof this.onbuttonup&&this.onbuttonup({index:i,gamepadIndex:n[a].index}))}this.gamepads[o]=n[a]}e||(this.gamepads.push(n[a]),"function"==typeof this.onconnected&&this.onconnected())}for(o=0;o<this.gamepads.length;o++)if(this.gamepads[o]){for(var s=!1,a=0;a<n.length;a++)n[a]&&this.gamepads[o].index===n[a].index&&(s=!0);s||(this.gamepads.splice(o,1),o--,"function"==typeof this.ondisconnected&&this.ondisconnected())}},on:function(e,t){this["on"+e.toLowerCase()]=t}},e.exports=t},null,null,null,null,function(e,t,n){function a(a,o){try{a=new URL(a)}catch(e){}return a&&!["http:","https:"].includes(a.protocol)?new Promise(async function(e,t){if("HEAD"===o.method)e({headers:{}});else{try{var n=await fetch(a);if(o.type&&"arraybuffer"===o.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=o.type,n.onerror=e,n.open(o.method,a,!0),n.send()})}e.exports={a:{get:async function(e,t){t=t&&t.responseType?t&&t.responseType:"text";return a(e,{method:"GET",type:t})},head:async function(e,t){t=t&&t.responseType?t&&t.responseType:"text";return a(e,{method:"HEAD",type:t})}}}},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,n){var a;!function(){"use strict";void 0!==(a="function"==typeof(a=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={}),o)this[n]=(void 0!==e[n]?e:o)[n];this.dbName=this.storePrefix+this.storeName,this.dbVersion=parseInt(this.dbVersion,10)||1,t&&(this.onStoreReady=t);var a="object"==typeof window?window:self,t=this.implementationPreference.filter(function(e){return e in a});this.implementation=t[0],this.idb=a[this.implementation],this.keyRange=a.IDBKeyRange||a.webkitIDBKeyRange||a.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 o={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),o=!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 a;o||(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),a=Array.prototype.slice.call(this.getIndexList()),this.indexes.forEach(function(e){var t,n=e.name;if(!n)return o=!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)||(o=!0,this.onError(new Error('Cannot modify index "'+n+'" for current version. Please bump version number to '+(this.dbVersion+1)+"."))),a.splice(a.indexOf(n),1)):(o=!0,this.onError(new Error('Cannot create new index "'+n+'" for current version. Please bump version number to '+(this.dbVersion+1)+".")))},this),a.length&&(o=!0,this.onError(new Error('Cannot delete index(es) "'+a.toString()+'" for current version. Please bump version number to '+(this.dbVersion+1)+"."))),o||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 a=Array.prototype.slice.call(this.getIndexList());this.indexes.forEach(function(e){var t,n=e.name;n||(o=!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})),a.splice(a.indexOf(n),1)):this.store.createIndex(n,e.keyPath,{unique:e.unique,multiEntry:e.multiEntry})},this),a.length&&a.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,a){null!==this.keyPath&&(a=n,n=t,t=e),a=a||u,n=n||f;var o=!1,i=null,s=this.db.transaction([this.storeName],this.consts.READ_WRITE);return s.oncomplete=function(){(o?n:a)(i)},s.onabort=a,s.onerror=a,(t=null!==this.keyPath?(this._addIdPropertyIfNeeded(t),s.objectStore(this.storeName).put(t)):s.objectStore(this.storeName).put(t,e)).onsuccess=function(e){o=!0,i=e.target.result},t.onerror=a,s},get:function(e,t,n){n=n||u,t=t||f;var a=!1,o=null,i=this.db.transaction([this.storeName],this.consts.READ_ONLY),e=(i.oncomplete=function(){(a?t:n)(o)},i.onabort=n,i.onerror=n,i.objectStore(this.storeName).get(e));return e.onsuccess=function(e){a=!0,o=e.target.result},e.onerror=n,i},remove:function(e,t,n){n=n||u,t=t||f;var a=!1,o=null,i=this.db.transaction([this.storeName],this.consts.READ_WRITE),e=(i.oncomplete=function(){(a?t:n)(o)},i.onabort=n,i.onerror=n,i.objectStore(this.storeName).delete(e));return e.onsuccess=function(e){a=!0,o=e.target.result},e.onerror=n,i},batch:function(e,t,i){if(i=i||u,t=t||f,"[object Array]"!=Object.prototype.toString.call(e))i(new Error("dataArray argument must be of type Array."));else if(0===e.length)return t(!0);function s(){0!=--n||l||(a=l=!0)}var n=e.length,l=!1,a=!1,r=this.db.transaction([this.storeName],this.consts.READ_WRITE);r.oncomplete=function(){(a?t:i)(a)},r.onabort=i,r.onerror=i;return e.forEach(function(e){function t(e){r.abort(),l||(l=!0,i(e,a,o))}var n,a=e.type,o=e.key,e=e.value;"remove"==a?((n=r.objectStore(this.storeName).delete(o)).onsuccess=s,n.onerror=t):"put"==a&&((n=null!==this.keyPath?(this._addIdPropertyIfNeeded(e),r.objectStore(this.storeName).put(e)):r.objectStore(this.storeName).put(e,o)).onsuccess=s,n.onerror=t)},this),r},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,a){"function"==typeof e&&(a=n=e,e={}),a=a||u,n=n||f,e=e||{},"[object Array]"!=Object.prototype.toString.call(t)&&a(new Error("dataArray argument must be of type Array."));function o(e){t[c++][i]=e.target.result,0!=--s||l||(r=l=!0)}var i=e.keyField||this.keyPath,s=t.length,l=!1,r=!1,c=0,d=this.db.transaction([this.storeName],this.consts.READ_WRITE);d.oncomplete=function(){r?n(t):a(!1)},d.onabort=a,d.onerror=a;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=o,e.onerror=function(e){d.abort(),l||(l=!0,a(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,a){if(n=n||u,t=t||f,a=a||"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 o(e){e.target.result||"dense"==a?i.push(e.target.result):"sparse"==a&&i.length++,0==--s&&(l=!0,r=i)}var i=[],s=e.length,l=!1,r=null,c=this.db.transaction([this.storeName],this.consts.READ_ONLY);c.oncomplete=function(){(l?t:n)(r)},c.onabort=n,c.onerror=n;return e.forEach(function(e){e=c.objectStore(this.storeName).get(e);e.onsuccess=o,e.onerror=function(e){n(r=e),c.abort()}},this),c},getAll:function(e,t){t=t||u,e=e||f;var n=this.db.transaction([this.storeName],this.consts.READ_ONLY),a=n.objectStore(this.storeName);return a.getAll?this._getAllNative(n,a,e,t):this._getAllCursor(n,a,e,t),n},_getAllNative:function(e,t,n,a){var o=!1,i=null,e=(e.oncomplete=function(){(o?n:a)(i)},e.onabort=a,e.onerror=a,t.getAll());e.onsuccess=function(e){o=!0,i=e.target.result},e.onerror=a},_getAllCursor:function(e,t,n,a){var o=[],i=!1,s=null,e=(e.oncomplete=function(){(i?n:a)(s)},e.onabort=a,e.onerror=a,t.openCursor());e.onsuccess=function(e){e=e.target.result;e?(o.push(e.value),e.continue()):(i=!0,s=o)},e.onError=a},clear:function(e,t){t=t||u,e=e||f;var n=!1,a=null,o=this.db.transaction([this.storeName],this.consts.READ_WRITE),i=(o.oncomplete=function(){(n?e:t)(a)},o.onabort=t,o.onerror=t,o.objectStore(this.storeName).clear());return i.onsuccess=function(e){n=!0,a=e.target.result},i.onerror=t,o},_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(i,s){return["keyPath","unique","multiEntry"].every(function(e){if("multiEntry"==e&&void 0===i[e]&&!1===s[e])return!0;if("keyPath"!=e||"[object Array]"!=Object.prototype.toString.call(s[e]))return s[e]==i[e];var t=s.keyPath,n=i.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 a=0,o=t.length;a<o;a++)if(!(n.contains&&n.contains(t[a])||n.indexOf(-1!==t[a])))return!1;return!0})},iterate:function(n,a){var e="desc"==(a=l({index:null,order:"ASC",autoContinue:!0,filterDuplicates:!1,keyRange:null,writeAccess:!1,onEnd:null,onError:u,limit:1/0,offset:0,allowItemRejection:!1},a||{})).order.toLowerCase()?"PREV":"NEXT",o=(a.filterDuplicates&&(e+="_NO_DUPLICATE"),!1),i=this.db.transaction([this.storeName],this.consts[a.writeAccess?"READ_WRITE":"READ_ONLY"]),t=i.objectStore(this.storeName),s=(a.index&&(t=t.index(a.index)),0),t=(i.oncomplete=function(){o?a.onEnd?a.onEnd():n(null):a.onError(null)},i.onabort=a.onError,i.onerror=a.onError,t.openCursor(a.keyRange,this.consts[e]));return t.onerror=a.onError,t.onsuccess=function(e){var t,e=e.target.result;e?a.offset?(e.advance(a.offset),a.offset=0):(t=n(e.value,e,i),a.allowItemRejection&&!1===t||s++,a.autoContinue&&(s+a.offset<a.limit?e.continue():o=!0)):o=!0},i},query:function(e,n){var a=[],o=0;return(n=n||{}).autoContinue=!0,n.writeAccess=!1,n.allowItemRejection=!!n.filter,n.onEnd=function(){e(a,o)},this.iterate(function(e){o++;var t=!n.filter||n.filter(e);return!1!==t&&a.push(e),t},n)},count:function(e,t){var n=(t=l({index:null,keyRange:null},t||{})).onError||u,a=!1,o=null,i=this.db.transaction([this.storeName],this.consts.READ_ONLY),s=(i.oncomplete=function(){(a?e:n)(o)},i.onabort=n,i.onerror=n,i.objectStore(this.storeName)),s=(s=t.index?s.index(t.index):s).count(t.keyRange);return s.onsuccess=function(e){a=!0,o=e.target.result},s.onError=n,i},makeKeyRange:function(e){var t,n=void 0!==e.lower,a=void 0!==e.upper;switch(!0){case void 0!==e.only:t=this.keyRange.only(e.only);break;case n&&a: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 a: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}},i={};function l(e,t){var n,a;for(n in t)(a=t[n])!==i[n]&&a!==e[n]&&(e[n]=a);return e}return e.prototype=t,e.version=t.version,e})?a.call(t,n,t,e):a)&&(e.exports=a)}()},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,n){var a;!function(){"use strict";var i={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"==a||"number"==a)e.push(this&&this[n]||n);else if(Array.isArray(n))e.push(s.apply(this,n));else if("object"==a)for(var o in n)i.call(n,o)&&n[o]&&e.push(this&&this[o]||o)}}return e.join(" ")}e.exports?e.exports=s.default=s:void 0!==(a=function(){return s}.apply(t,[]))&&(e.exports=a)}()},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 a;function o(e){return(o="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)}a=function(){function e(){}function r(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=r.id,r.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 a(e,t){var n=this;return n.nipples=[],n.idles=[],n.actives=[],n.ids=[],n.pressureIntervals={},n.manager=e,n.id=a.id,a.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,a=this;return a.ids={},a.index=0,a.collections=[],a.config(e),a.prepareCollections(),u.bindEvt(window,"resize",function(e){clearTimeout(t),t=setTimeout(function(){var t,n=u.getScroll();a.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)}),a.collections}var o,n=!!("ontouchstart"in window),i=!!window.PointerEvent,s=!!window.MSPointerEvent,l={start:"mousedown",move:"mousemove",end:"mouseup"},c={},u=(i?o={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:s?o={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:n?(o={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},c=l):o=l,{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 a={x:0,y:0};return n=u.radians(n),a.x=e.x-t*Math.cos(n),a.y=e.y-t*Math.sin(n),a},radians:function(e){return e*(Math.PI/180)},degrees:function(e){return e*(180/Math.PI)},bindEvt:function(e,t,n){for(var a,o=t.split(/[ ,]+/g),i=0;i<o.length;i+=1)a=o[i],e.addEventListener?e.addEventListener(a,n,!1):e.attachEvent&&e.attachEvent(a,n)},unbindEvt:function(e,t,n){for(var a,o=t.split(/[ ,]+/g),i=0;i<o.length;i+=1)a=o[i],e.removeEventListener?e.removeEventListener(a,n):e.detachEvent&&e.detachEvent(a,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 a,o=u.configStylePropertyObject(e);for(a in o)if(o.hasOwnProperty(a))if("string"==typeof t)o[a]=t+" "+n;else{for(var i="",s=0,l=t.length;s<l;s+=1)i+=t[s]+" "+n+", ";o[a]=i.slice(0,-2)}return o},getVendorStyle:function(e,t){var n,a=u.configStylePropertyObject(e);for(n in a)a.hasOwnProperty(n)&&(a[n]=t);return a},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,a={};for(n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)?a[n]=t[n]:e.hasOwnProperty(n)&&(a[n]=e[n]);return a},map:function(e,t){if(e.length)for(var n=0,a=e.length;n<a;n+=1)t(e[n]);else t(e)}}),d=(e.prototype.on=function(e,t){var n,a=this,o=e.split(/[ ,]+/g);a._handlers_=a._handlers_||{};for(var i=0;i<o.length;i+=1)n=o[i],a._handlers_[n]=a._handlers_[n]||[],a._handlers_[n].push(t);return a},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,a=this,o=e.split(/[ ,]+/g);a._handlers_=a._handlers_||{};for(var i=0;i<o.length;i+=1)n=o[i],a._handlers_[n]&&a._handlers_[n].length&&a._handlers_[n].forEach(function(e){e.call(a,{type:n,target:a},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,o[t],n._domHandlers_[t]),c[t]&&u.bindEvt(e,c[t],n._domHandlers_[t]),n},e.prototype.unbindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},u.unbindEvt(e,o[t],n._domHandlers_[t]),c[t]&&u.unbindEvt(e,c[t],n._domHandlers_[t]),delete n._domHandlers_[t],this},r.prototype=new e,(r.constructor=r).id=0,r.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},r.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},r.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},r.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},r.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},r.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},r.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},r.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},r.prototype.restPosition=function(e){var t=this,n=(t.frontPosition={x:0,y:0},t.options.fadeTime+"ms"),a={},n=(a.front=u.getTransitionStyle("transition",["top","left"],n),{front:{}});n.front={left:t.frontPosition.x+"px",top:t.frontPosition.y+"px"},t.applyStyles(a),t.applyStyles(n),t.restTimeout=setTimeout(function(){"function"==typeof e&&e.call(t),t.restCallback()},t.options.fadeTime)},r.prototype.restCallback=function(){var e={};e.front=u.getTransitionStyle("transition","none",""),this.applyStyles(e),this.trigger("rested",this.instance)},r.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},r.prototype.computeDirection=function(e){var t,n,a,o=e.angle.radian,i=Math.PI/4,s=Math.PI/2;if(i<o&&o<3*i&&!e.lockX?t="up":-i<o&&o<=i&&!e.lockY?t="left":3*-i<o&&o<=-i&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(n=-s<o&&o<s?"left":"right"),e.lockX||(a=0<o?"up":"down"),e.force>this.options.threshold){var l={};for(r in this.direction)this.direction.hasOwnProperty(r)&&(l[r]=this.direction[r]);var r,c={};for(r in this.direction={x:n,y:a,angle:t},e.direction=this.direction,l)l[r]===this.direction[r]&&(c[r]=!0);if(c.x&&c.y&&c.angle)return e;c.x&&c.y||this.trigger("plain",e),c.x||this.trigger("plain:"+n,e),c.y||this.trigger("plain:"+a,e),c.angle||this.trigger("dir dir:"+t,e)}return e},a.prototype=new e,(a.constructor=a).id=0,a.prototype.prepareNipples=function(){var e=this,a=e.nipples;a.on=e.on.bind(e),a.off=e.off.bind(e),a.options=e.options,a.destroy=e.destroy.bind(e),a.ids=e.ids,a.id=e.id,a.processOnMove=e.processOnMove.bind(e),a.processOnEnd=e.processOnEnd.bind(e),a.get=function(e){if(void 0===e)return a[0];for(var t=0,n=a.length;t<n;t+=1)if(a[t].identifier===e)return a[t];return!1}},a.prototype.bindings=function(){this.bindEvt(this.options.zone,"start"),this.options.zone.style.touchAction="none",this.options.zone.style.msTouchAction="none"},a.prototype.begin=function(){var e=this.options;"static"===e.mode&&((e=this.createNipple(e.position,this.manager.getIdentifier())).add(),this.idles.push(e))},a.prototype.createNipple=function(e,t){var n,a=this,o=u.getScroll(),i={},s=a.options,l=(e.x&&e.y?i={x:e.x-(o.x+a.box.left),y:e.y-(o.y+a.box.top)}:(e.top||e.right||e.bottom||e.left)&&((l=document.createElement("DIV")).style.display="hidden",l.style.top=e.top,l.style.right=e.right,l.style.bottom=e.bottom,l.style.left=e.left,l.style.position="absolute",s.zone.appendChild(l),n=l.getBoundingClientRect(),s.zone.removeChild(l),i=e,e={x:n.left+o.x,y:n.top+o.y}),new r(a,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:t,position:e,zone:s.zone,frontPosition:{x:0,y:0}}));return s.dataOnly||(u.applyPosition(l.ui.el,i),u.applyPosition(l.ui.front,l.frontPosition)),a.nipples.push(l),a.trigger("added "+l.identifier+":added",l),a.manager.trigger("added "+l.identifier+":added",l),a.bindNipple(l),l},a.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},a.prototype.bindNipple=function(e){function t(e,t){n=e.type+" "+t.id+":"+e.type,a.trigger(n,t)}var n,a=this;e.on("destroyed",a.onDestroyed.bind(a)),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)},a.prototype.pressureFn=function(t,n,e){var a=this,o=0;clearInterval(a.pressureIntervals[e]),a.pressureIntervals[e]=setInterval(function(){var e=t.force||t.pressure||t.webkitForce||0;e!==o&&(n.trigger("pressure",e),a.trigger("pressure "+n.identifier+":pressure",e),o=e)}.bind(a),100)},a.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},a.prototype.processOnStart=function(t){function e(e){e.trigger("start",e),n.trigger("start "+e.id+":start",e),e.show(),0<i&&n.pressureFn(t,e,e.identifier),n.processOnMove(t)}var n=this,a=n.options,o=n.manager.getIdentifier(t),i=t.force||t.pressure||t.webkitForce||0,s={x:t.pageX,y:t.pageY},l=n.getOrCreate(o,s);l.identifier!==o&&n.manager.removeIdentifier(l.identifier),l.identifier=o;if(0<=(o=n.idles.indexOf(l))&&n.idles.splice(o,1),n.actives.push(l),n.ids.push(l.identifier),"semi"!==a.mode)e(l);else{if(!(u.distance(s,l.position)<=a.catchDistance))return l.destroy(),void n.processOnStart(t);e(l)}return l},a.prototype.getOrCreate=function(e,t){var n,a=this,o=a.options;return/(semi|static)/.test(o.mode)?(n=a.idles[0])?(a.idles.splice(0,1),n):"semi"===o.mode?a.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):a.createNipple(t,e)},a.prototype.processOnMove=function(e){var t=this,n=t.options,a=t.manager.getIdentifier(e),o=t.nipples.get(a);if(!o)return console.error("Found zombie joystick with ID "+a),void t.manager.removeIdentifier(a);o.identifier=a;var a=o.options.size/2,i={x:e.pageX,y:e.pageY},s=u.distance(i,o.position),l=u.angle(i,o.position),r=u.radians(l),c=s/a,a=(i=a<s?u.findCoord(o.position,s=a,l):i).x-o.position.x,d=i.y-o.position.y,a=(n.lockX&&(d=0),n.lockY&&(a=0),o.frontPosition={x:a,y:d},n.dataOnly||u.applyPosition(o.ui.front,o.frontPosition),{identifier:o.identifier,position:i,force:c,pressure:e.force||e.pressure||e.webkitForce||0,distance:s,angle:{radian:r,degree:l},instance:o,lockX:n.lockX,lockY:n.lockY});(a=o.computeDirection(a)).angle={radian:u.radians(180-l),degree:180-l},o.trigger("move",a),t.trigger("move "+o.id+":move",a)},a.prototype.processOnEnd=function(e){var t=this,n=t.options,e=t.manager.getIdentifier(e),a=t.nipples.get(e),e=t.manager.removeIdentifier(a.identifier);a&&(n.dataOnly||a.hide(function(){"dynamic"===n.mode&&(a.trigger("removed",a),t.trigger("removed "+a.id+":removed",a),t.manager.trigger("removed "+a.id+":removed",a),a.destroy())}),clearInterval(t.pressureIntervals[a.identifier]),a.resetDirection(),a.trigger("end",a),t.trigger("end "+a.id+":end",a),0<=t.ids.indexOf(a.identifier)&&t.ids.splice(t.ids.indexOf(a.identifier),1),0<=t.actives.indexOf(a)&&t.actives.splice(t.actives.indexOf(a),1),/(semi|static)/.test(n.mode)?t.idles.push(a):0<=t.nipples.indexOf(a)&&t.nipples.splice(t.nipples.indexOf(a),1),t.manager.unbindDocument(),/(semi|static)/.test(n.mode)&&(t.manager.ids[e.id]=e.identifier))},a.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()},a.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 a(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,a.trigger(n,t)}var n,a=this;e.on("destroyed",a.onDestroyed.bind(a)),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,a=this,o="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=u.prepareEvent(t);return u.map(t,function(e){n=a.getIdentifier(e),u.map(a.collections,function(e,t,n){0<=n.ids.indexOf(t)&&(n[o](e),e._found_=!0)}.bind(null,e,n)),e._found_||a.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"==o(t)&&void 0!==e?e.exports=a():void 0!==(t="function"==typeof(a=a)?a.apply(t,[]):a)&&(e.exports=t)},null,function(p,o,s){"use strict";for(var m in window.EJS_RESET_VARS=[],window)window.EJS_RESET_VARS.push(m);s.r(o);function t(e){return null!=e?e.constructor:null}function n(e,t){return Boolean(e&&t&&e instanceof t)}function y(e){return null==e}function _(e){return t(e)===Object}function b(e){return t(e)===String}function T(e){return Array.isArray(e)}function x(e){return n(e,NodeList)}function w(e){return y(e)||(b(e)||T(e)||x(e))&&!e.length||_(e)&&!Object.keys(e).length}let S={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",gamepad:"Control Settings",cheat:"Cheats",menuBack:"Go back to previous menu",normal:"Normal",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",playNow:"Start Game"},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"]',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"}},j=s(0),E=s(157),M=s.n(E),D={nullOrUndefined:y,object:_,number:function(e){return t(e)===Number&&!Number.isNaN(e)},string:b,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)||!y(e)&&b(e.kind)},url:function(e){if(n(e,window.URL))return!0;let t=e;e.startsWith("http://")&&e.startsWith("https://")||(t="http://".concat(e));try{return!w(new URL(t).hostname)}catch(e){return!1}},empty:w},C=function(){let 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 r(n,a,o){let i=this,s=3<arguments.length&&void 0!==arguments[3]&&arguments[3],l=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],r=5<arguments.length&&void 0!==arguments[5]&&arguments[5];if(n&&"addEventListener"in n&&!D.empty(a)&&D.function(o)){let e=a.split(" "),t=r;C&&(t={passive:l,capture:r}),e.forEach(function(e){i&&i.eventListeners&&s&&i.eventListeners.push({element:n,type:e,callback:o,options:t}),n[s?"addEventListener":"removeEventListener"](e,o,t)})}}function F(e){r.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 P(e){r.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 ae(a){let o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",i=2<arguments.length?arguments[2]:void 0,s=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],l=4<arguments.length&&void 0!==arguments[4]&&arguments[4];r.call(this,a,o,function e(){P(a,o,e,s,l);let t=arguments.length,n=new Array(t);for(let e=0;e<t;e++)n[e]=arguments[e];i.apply(this,n)},!0,s,l)}function G(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};D.element(e)&&!D.empty(t)&&(t=new CustomEvent(t,{bubbles:n,detail:Object.assign({},a,{emulator:this})}),e.dispatchEvent(t))}let I=s(158),A=s.n(I);function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(n,a){let o=[],i=!0,t=!1,s=void 0;try{for(let e,t=n[Symbol.iterator]();!(i=(e=t.next()).done)&&(o.push(e.value),!a||o.length!==a);i=!0);}catch(e){t=!0,s=e}finally{try{i||null==_0x557ef0.return||_0x557ef0.return()}finally{if(t)throw s}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function R(e,i){e=e.length?e:[e];Array.from(e).reverse().forEach(function(e,t){let n=0<t?i.cloneNode(!0):i,a=e.parentNode,o=e.nextSibling;n.appendChild(e),o?a.insertBefore(n,o):a.appendChild(n)})}function N(n,e){D.element(n)&&!D.empty(e)&&Object.entries(e).filter(function(e){e=O(e,2)[1];return!D.nullOrUndefined(e)}).forEach(function(e){var e=O(e,2),t=e[0],e=e[1];return n.setAttribute(t,e)})}function V(e,t,n){let a=document.createElement(e);return D.object(t)&&N(a,t),D.string(n)&&(a.innerText=n),a}function k(e){D.nodeList(e)||D.array(e)?Array.from(e).forEach(k):D.element(e)&&D.element(e.parentNode)&&e.parentNode.removeChild(e)}function h(e,t){if(!D.string(e)||D.empty(e))return{};let s={},l=t;return e.split(",").forEach(function(e){let t=e.trim(),n=t.replace(".",""),a=t.replace(/[[\]]/g,"").split("="),o=a[0],i=1<a.length?a[1].replace(/["']/g,""):"";switch(t.charAt(0)){case".":D.object(l)&&D.string(l.class)&&(l.class+=" ".concat(n)),s.class=n;break;case"#":s.id=t.replace("#","");break;case"[":s[o]=i}}),s}function U(t,n){if(D.element(t)){let e=n;(e=D.boolean(e)?e:!t.hidden)?t.setAttribute("hidden",""):t.removeAttribute("hidden")}}function B(t,n,a){if(D.nodeList(t))return Array.from(t).map(function(e){return B(e,n,a)});if(D.element(t)){let e=void 0!==a?a?"add":"remove":"toggle";return t.classList[e](n),t.classList.contains(n)}return!1}function z(e,t){return D.element(e)&&e.classList.contains(t)}function L(e,t){let 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 c(e){return this.elements.container.querySelectorAll(e)}function H(e){return this.elements.container.querySelector(e)}function oe(){let e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];D.element(e)&&(e.focus(),t&&B(e,this.config.classNames.tabFocus))}function q(e){return M.a.bind(A.a)(e)}let ie,se,le,re=(ie=document.createElement("span"),se={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},le=Object.keys(se).find(function(e){return void 0!==ie.style[e]}),!!D.string(le)&&se[le]);function ce(e){setTimeout(function(){try{U(e,!0),e.offsetHeight,U(e,!1)}catch(e){}},0)}let de,X={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(){let 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]}}},Y={rangeInput:((de=document.createElement("input")).type="range")===de.type,touch:"ontouchstart"in document.documentElement,transitions:!1!==re,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches,webgl:function(){let i={DETECTED:!1};if(!i.DETECTED){let o=document.createElement("canvas");if(o&&o.getContext)for(let n=["webgl2","experimental-webgl2","webgl","experimental-webgl"],a=0,e=n.length;a<e;++a){let e=n[a],t=o.getContext(e);if(t){i.WEBGL_CONTEXT=e,i.WEBGL_VERSION=t.getParameter(t.VERSION),i.WEBGL_VENDOR=t.getParameter(t.VENDOR),i.WEBGL_SL_VERSION=t.getParameter(t.SHADING_LANGUAGE_VERSION),i.MAX_TEXTURE_SIZE=t.getParameter(t.MAX_TEXTURE_SIZE);var s=t.getExtension("WEBGL_debug_renderer_info");s&&(i.WEBGL_VENDOR=t.getParameter(s.UNMASKED_VENDOR_WEBGL),i.WEBGL_RENDERER=t.getParameter(s.UNMASKED_RENDERER_WEBGL)),i.DETECTED=!0;break}}}return i}(),wasm:"undefined"!=typeof WebAssembly&&D.object(WebAssembly),audioContext:"undefined"!=typeof AudioContext};function ue(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W(){let t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=new Array(1<o?o-1:0);for(let e=arguments.length,t=1;t<e;t++)n[t-1]=arguments[t];if(!n.length)return t;let a=n.shift();return D.object(a)?(Object.keys(a).forEach(function(e){D.object(a[e])?(Object.keys(t).includes(e)||Object.assign(t,ue({},e,{})),W(t[e],a[e])):Object.assign(t,ue({},e,a[e]))}),W.apply(void 0,[t].concat(n))):t}function fe(e,t,n){let a=0<arguments.length&&void 0!==e?e:"",o=1<arguments.length&&void 0!==t?t:"",i=2<arguments.length&&void 0!==n?n:"";return a.replace(new RegExp(o.toString().replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"),"g"),i.toString())}let pe={get:function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(D.empty(t)||D.empty(n))return"";e=n.i18n;let a=t.split(".").reduce(function(e,t){return e&&e[t]},e);if(D.empty(a))return"";t={"{seektime}":n.seekTime,"{title}":n.title};return Object.entries(t).forEach(function(e){t=2;var e=function(e){if(Array.isArray(e))return e}(e=e)||function(n,a){let o=[],i=!0,t=!1,s=void 0;try{for(let e,t=n[Symbol.iterator]();!(i=(e=t.next()).done)&&(o.push(e.value),!a||o.length!==a);i=!0);}catch(e){t=!0,s=e}finally{try{i||null==_0x2f59ed.return||_0x2f59ed.return()}finally{if(t)throw s}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}(),t=e[0],e=e[1];a=fe(a,t,e)}),a}};function me(n,a){for(let t=0;t<a.length;t++){let e=a[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}u=[{key:"supported",get:function(){try{return"localStorage"in window&&(window.localStorage.getItem("___test")||window.localStorage.setItem("___test","___test"),!0)}catch(e){return!1}}}],me((e=ge).prototype,[{key:"get",value:function(e){if(!ge.supported||!this.enabled)return null;var t=window.localStorage.getItem(this.key);if(D.empty(t))return null;t=JSON.parse(t);return D.string(e)&&e.length?t[e]:t}},{key:"set",value:function(t){if(ge.supported&&this.enabled&&D.object(t)){let e=this.get();W(e=D.empty(e)?{}:e,t),window.localStorage.setItem(this.key,JSON.stringify(e))}}}]),me(e,u);let he=ge;function ge(e,t){if(!(this instanceof ge))throw new TypeError("Cannot call a class as a function");this.enabled=!0,this.key=t}let ve,ye=s(6),_e=s(159),be=s.n(_e),Te={"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'},xe=s(57),K=s(11),J={addStyleHook:function(){B(this.elements.container,this.config.selectors.container.replace(".",""),!0),B(this.elements.container,this.config.classNames.uiSupported,!0),B(this.elements.container,this.config.classNames.hideControls,!0)},build:function(){this.listeners.media(),D.element(this.elements.controls)||(ne.inject.call(this),this.listeners.controls()),this.volume=null,this.muted=null,ne.updateVolume.call(this),B(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0},toggleControls:function(t){var a=this.elements.controls;if(a){let n=0,e=c.call(this,".".concat(q({ejs__dialogs:!0})," > .").concat(q({ejs__dialog:!0})));Array.from(e).forEach(function(e,t){!0!==e.hidden&&(n+=1)}),0<n?this.toggleControls(!1):this.toggleControls(Boolean(t||this.paused||a.pressed||a.hover))}}};function we(e){return(we="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 a(e,t){if("object"===we(e)&&e.files&&(e=e.files[0]),this.littleEndian=!1,this.offset=0,this._lastRead=null,"object"===we(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"===we(e)&&"string"==typeof e.fileName&&"boolean"==typeof e.littleEndian){this.fileName=e.fileName,this.fileType=e.fileType,this.fileSize=e.fileSize;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"===we(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,s=new ArrayBuffer(e),this._u8array=new Uint8Array(s),this._dataView=new DataView(s),t&&t.call()}}a.IS_MACHINE_LITTLE_ENDIAN=(ve=new ArrayBuffer(2),new DataView(ve).setInt16(0,256,!0),256===new Int16Array(ve)[0]),a.prototype.seek=function(e){this.offset=e},a.prototype.skip=function(e){this.offset+=e},a.prototype.isEOF=function(){return!(this.offset<this.fileSize)},a.prototype.slice=function(e,t){let n;return t=t||this.fileSize-e,void 0!==this._u8array.buffer.slice?((n=new a(0)).fileSize=t,n._u8array=new Uint8Array(this._u8array.buffer.slice(e,e+t))):(n=new a(t),this.copyToFile(n,e,t,0)),n.fileName=this.fileName,n.fileType=this.fileType,n.littleEndian=this.littleEndian,n},a.prototype.copyToFile=function(t,n,a,o){void 0===o&&(o=n),a=a||this.fileSize-n;for(let e=0;e<a;e++)t._u8array[o+e]=this._u8array[n+e]},a.prototype.save=function(){let n;try{n=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");let t=new BlobBuilder;t.append(this._u8array.buffer),n=t.getBlob(this.fileType)}saveAs(n,this.fileName)},a.prototype.readU8=function(){return this._lastRead=this._u8array[this.offset],this.offset++,this._lastRead},a.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},a.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},a.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},a.prototype.readBytes=function(t){this._lastRead=new Array(t);for(let e=0;e<t;e++)this._lastRead[e]=this._u8array[this.offset+e];return this.offset+=t,this._lastRead},a.prototype.readString=function(t){this._lastRead="";for(let e=0;e<t&&this.offset+e<this.fileSize&&0<this._u8array[this.offset+e];e++)this._lastRead=this._lastRead+String.fromCharCode(this._u8array[this.offset+e]);return this.offset+=t,this._lastRead},a.prototype.writeU8=function(e){this._u8array[this.offset]=e,this.offset++},a.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},a.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},a.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},a.prototype.writeBytes=function(t){for(let e=0;e<t.length;e++)this._u8array[this.offset+e]=t[e];this.offset+=t.length},a.prototype.writeString=function(t,n){n=n||t.length;for(let e=0;e<t.length&&e<n;e++)this._u8array[this.offset+e]=t.charCodeAt(e);for(;s<n;s++)this._u8array[this.offset+s]=0;this.offset+=n};let Q=a,i=0;function l(){this.records=[],this.truncate=!1}function Se(e){let t=new l;e.seek(5);for(var n,a;!e.isEOF();){if(4542278===(n=e.readU24())){if(e.isEOF())break;if(e.offset+3===e.fileSize){t.truncate=e.readU24();break}}(a=e.readU16())===i?t.addRLERecord(n,e.readU16(),e.readU8()):t.addSimpleRecord(n,e.readBytes(a))}return t}l.prototype.addSimpleRecord=function(e,t){this.records.push({offset:e,type:1,length:t.length,data:t})},l.prototype.addRLERecord=function(e,t,n){this.records.push({offset:e,type:i,length:t,byte:n})},l.prototype.toString=function(){nSimpleRecords=0;for(let e=nRLERecords=0;e<this.records.length;e++)this.records[e].type===i?nRLERecords++:nSimpleRecords++;let e="Simple records: "+nSimpleRecords;return e=(e+="\nRLE records: "+nRLERecords)+("\nTotal records: "+this.records.length),this.truncate&&(e+="\nTruncate at: 0x"+this.truncate.toString(16)),e},l.prototype.export=function(e){for(let e=5,t=0;t<this.records.length;t++)this.records[t].type===i?e+=8:e+=5+this.records[t].data.length;for(o+=3,this.truncate&&(o+=3),(tempFile=new Q(o)).fileName=e+".ips",tempFile.writeString("PATCH"),s=0;s<this.records.length;s++){var t=this.records[s];tempFile.writeU24(t.offset),t.type===i?(tempFile.writeU16(0),tempFile.writeU16(t.length),tempFile.writeU8(t.byte)):(tempFile.writeU16(t.data.length),tempFile.writeBytes(t.data))}return tempFile.writeString("EOF"),_0x512785.truncate&&tempFile.writeU24(_0x512785.truncate),tempFile},l.prototype.apply=function(n){let t;if(this.truncate)t=n.slice(0,this.truncate);else{for(let e=n.fileSize,t=0;t<this.records.length;t++){var a=this.records[t];a.type===i?a.offset+a.length>e&&(e=a.offset+a.length):a.offset+a.data.length>e&&(e=a.offset+a.data.length)}s===n.fileSize?t=n.slice(0,n.fileSize):(t=new Q(s),n.copyToFile(t,0))}for(n.seek(0),_0x5a0a71=0;_0x5a0a71<this.records.length;_0x5a0a71++)if(t.seek(this.records[_0x5a0a71].offset),this.records[_0x5a0a71].type===i)for(let e=0;e<this.records[_0x5a0a71].length;e++)t.writeU8(this.records[_0x5a0a71].byte);else t.writeBytes(this.records[_0x5a0a71].data);return t},"0123456789abcdef".split("");let Ee=function(){for(let t,e=[],n=0;n<256;n++){t=n;for(let e=0;e<8;e++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return o}();function Z(o,i,s){for(let e=i?new Uint8Array(o._u8array.buffer,i):o._u8array,t=-1,n=s?e.length-4:e.length,a=0;a<n;a++)t=t>>>8^Ee[255&(t^e[a])];return(-1^_0x20e2c1)>>>0}let Me=1,Ce=2,Pe=3;function Ie(){this.sourceSize=0,this.targetSize=0,this.metaData="",this.actions=[],this.sourceChecksum=0,this.targetChecksum=0,this.patchChecksum=0}function Ae(n){n.readVLV=Oe,n.littleEndian=!0;let a=new Ie;n.seek(4),a.sourceSize=n.readVLV(),a.targetSize=n.readVLV();var e=n.readVLV();e&&(a.metaData=n.readString(e));for(var o,t=n.fileSize-12;n.offset<t;){let e=n.readVLV(),t={type:3&e,length:1+(e>>2)};t.type===Me?t.bytes=n.readBytes(t.length):t.type!==Ce&&t.type!==Pe||(o=n.readVLV(),t.relativeOffset=(1&o?-1:1)*(o>>1)),a.actions.push(t)}if(a.sourceChecksum=n.readU32(),a.targetChecksum=n.readU32(),a.patchChecksum=n.readU32(),a.patchChecksum!==Z(n,0,!0))throw new Error("error_crc_patch");return a}function Oe(){for(let e=0,t=1;;){var n=this.readU8();if(e+=(127&n)*t,128&n)break;e+=t<<=7}return this._lastRead=p}function Re(e){for(;;){var t=127&e;if(0==(e>>=7)){this.writeU8(128|t);break}this.writeU8(t),e--}}function Ne(t){for(let e=0;;){if(0==(t>>=7)){e++;break}e++,t--}return o}Ie.prototype.toString=function(){var e="Source size: "+this.sourceSize;return(e=(e+="\nTarget size: "+this.targetSize)+("\nMetadata: "+this.metaData))+("\n#Actions: "+this.actions.length)},Ie.prototype.validateSource=function(e,t){return this.sourceChecksum===Z(e,t)},Ie.prototype.apply=function(o,e){if(e&&!this.validateSource(o))throw new Error("error_crc_input");for(let t=new Q(this.targetSize),n=0,e=0,a=0;a<this.actions.length;a++){var i=this.actions[a];if(0===i.type)o.copyToFile(t,t.offset,i.length),t.skip(i.length);else if(i.type===Me)t.writeBytes(i.bytes);else if(i.type===Ce){n+=i.relativeOffset;for(let e=i.length;e--;)t.writeU8(o._u8array[n]),n++}else if(i.type===Pe)for(e+=i.relativeOffset,_0x5c2263=i.length;_0x5c2263--;)t.writeU8(t._u8array[e]),e++}if(e&&this.targetChecksum!==Z(s))throw new Error("error_crc_output");return s},Ie.prototype.export=function(e){let t="BPS1".length;t=(t=(t=(t+=Ne(this.sourceSize))+Ne(this.targetSize))+Ne(this.metaData.length))+this.metaData.length;for(let e=0;e<this.actions.length;e++)t+=Ne(((_0x38dad6=this.actions[e]).length-1<<2)+_0x38dad6.type),_0x38dad6.type===Me?t+=_0x38dad6.length:_0x38dad6.type!==Ce&&_0x38dad6.type!==Pe||(t+=Ne((Math.abs(_0x38dad6.relativeOffset)<<1)+(_0x38dad6.relativeOffset<0?1:0)));let n=new Q(t+=12);for(n.fileName=e+".bps",n.littleEndian=!0,n.writeVLV=Re,n.writeString("BPS1"),n.writeVLV(this.sourceSize),n.writeVLV(this.targetSize),n.writeVLV(this.metaData.length),n.writeString(this.metaData,this.metaData.length),s=0;s<this.actions.length;s++){var a=this.actions[s];n.writeVLV((a.length-1<<2)+a.type),a.type===Me?n.writeBytes(a.bytes):a.type!==Ce&&a.type!==Pe||n.writeVLV((Math.abs(a.relativeOffset)<<1)+(a.relativeOffset<0?1:0))}return n.writeU32(this.sourceChecksum),n.writeU32(this.targetChecksum),n.writeU32(this.patchChecksum),n};let ke="UPS1";function d(){this.records=[],this.sizeInput=0,this.sizeOutput=0,this.checksumInput=0,this.checksumOutput=0}function ze(e){for(;;){var t=127&e;if(0==(e>>=7)){this.writeU8(128|t);break}this.writeU8(t),--e}}function Le(){for(let 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 p}function je(t){for(let e=0;e++,0!=(t>>=7);)--t;return o}function De(t){let e=new d;for(t.readVLV=Le,t.seek(ke.length),e.sizeInput=t.readVLV(),e.sizeOutput=t.readVLV();t.offset<t.fileSize-12;){t.readVLV();for(let e=[];t.readU8();)e.push(t._lastRead);e.addRecord(s,_0x3bca86)}return t.littleEndian=!0,e.checksumInput=t.readU32(),e.checksumOutput=t.readU32(),t.littleEndian=!1,e}d.prototype.addRecord=function(e,t){this.records.push({offset:e,XORdata:t})},d.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))},d.prototype.export=function(e){let t=ke.length;t=(t+=je(this.sizeInput))+je(this.sizeOutput);for(let e=0;e<this.records.length;e++)t=(t+=je(this.records[e].offset))+(this.records[e].XORdata.length+1);for(t+=12,(tempFile=new Q(t)).writeVLV=ze,tempFile.fileName=e+".ups",tempFile.writeString(ke),tempFile.writeVLV(this.sizeInput),tempFile.writeVLV(this.sizeOutput),s=0;s<this.records.length;s++)tempFile.writeVLV(this.records[s].offset),tempFile.writeBytes(this.records[s].XORdata),tempFile.writeU8(0);return tempFile.littleEndian=!0,tempFile.writeU32(this.checksumInput),tempFile.writeU32(this.checksumOutput),tempFile.writeU32(Z(tempFile,0,!0)),tempFile},d.prototype.validateSource=function(e,t){return Z(e,t)===this.checksumInput};var $={_FS:{createFolder:function(e,t,n,a){var o,i;$.FS&&("function"==typeof $.FS.mkdir&&window.PATH?(o=PATH.join2("string"==typeof e?e:$.FS.getPath(e),t),i=$.FS.getMode(n,a),$.FS.mkdir(o,i)):$.FS.createFolder(e,t,n,a))}},romdb:null,supportBatterySave:!(d.prototype.apply=function(t,e){e&&this.validateSource(t),tempFile=new Q(this.sizeOutput),t.copyToFile(tempFile,0,this.sizeInput),t.seek(0);for(let e=0;e<this.records.length;e++){var n=this.records[e];tempFile.skip(n.offset),t.skip(n.offset);for(let e=0;e<n.XORdata.length;e++)tempFile.writeU8((t.isEOF()?0:t.readU8())^n.XORdata[e]);tempFile.skip(1),t.skip(1)}return e&&(Z(tempFile),this.checksumOutput),tempFile}),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(){let u=this;window.URL=window.URL||window.webkitURL;let f,p,m,n=!1,a=!1,i=!1,h=0,g=!1,v={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"],a5200:["a52","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"]},y={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",atari5200:"a5200",lynx:"lynx",ws:"ws",arcade:"arcade","fba0.2.97.29":"fba0.2.97.29",jaguar:"jaguar",mame2003:"mame2003"},_=this,b=_.system,s=(f=_.customPaths&&"string"==typeof _.customPaths["extract7z.js"]?_.customPaths["extract7z.js"]:_.dataPath+"extract7z.js",p=_.customPaths&&"string"==typeof _.customPaths["extractzip.js"]?_.customPaths["extractzip.js"]:_.dataPath+"extractzip.js?v=1",m=_.customPaths&&"string"==typeof _.customPaths["libunrar.js"]?_.customPaths["libunrar.js"]:_.dataPath+"libunrar.js",V("canvas",{})),T=(this.game.appendChild(s),$.loading=V("div",{class:this.config.classNames.loading}),this.elements.container.appendChild($.loading),{"loading-info":q({"loading-info":!0}),ad:q({ad:!0}),"close-ad":q({"close-ad":!0}),"start-game":q({"start-game":!0}),on:q({on:!0}),p1:q({p1:!0}),p2:q({p2:!0}),p3:q({p3:!0}),p4:q({p4:!0})});var e;"string"==typeof _.adUrl?($.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="'+_.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"]+'">'+pe.get("playNow",_.config)+"</a>\n </div>\n </div>",e=V("iframe",{src:_.adUrl,scrolling:"no",frameborder:"no",style:"width:300px !important;height:250px !important;display: block !important;"}),$.loading.querySelector(".".concat(T.ad)).removeChild($.loading.querySelector(".".concat(T.ad," iframe"))),$.loading.querySelector(".".concat(T.ad)).appendChild(e),Y.webgl.DETECTED||(U($.loading.querySelector(".".concat(T["start-game"])),!0),$.loading.querySelector(".".concat(T.p3)).innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">Failed to initialize WebGL.</strong>'),$.loading.querySelector(".".concat(T.ad," iframe")).style.setProperty("display","block","important"),$.loading.querySelector(".".concat(T.ad," iframe")).style.setProperty("visibility","visible","important"),$.loading.querySelector(".".concat(T.ad)).style.setProperty("display","block","important"),$.loading.querySelector(".".concat(T.ad)).style.setProperty("visibility","visible","important")):($.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(pe.get("playNow",_.config),"</a>\n </div>\n </div>"),Y.webgl.DETECTED||(U($.loading.querySelector(".".concat(T["start-game"])),!0),$.loading.querySelector(".".concat(T.p3)).innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">Failed to initialize WebGL.</strong>'));let o=window.URL||window.webkitURL,x=function(e){return 80===e[0]&&75===e[1]&&(3===e[2]&&4===e[3]||5===e[2]&&6===e[3]||7===e[2]&&8===e[3])?"zip":55===e[0]&&122===e[1]&&188===e[2]&&175===e[3]&&39===e[4]&&28===e[5]?"7z":82===e[0]&&97===e[1]&&114===e[2]&&33===e[3]&&26===e[4]&&7===e[5]&&(0===e[6]||1===e[6]&&0==e[7])?"rar":void 0},w=async function(e){e=await(await fetch(e)).text(),e=new Blob([e],{type:"application/javascript"}),e=window.URL.createObjectURL(e);return new Worker(e)},S=async function(e){var t=await(await fetch(e)).text(),e=new Blob(["\nlet 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 '"+e+".mem';\n }\n};\n"+t+'\nlet unrar = function(data, password) {\n let cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n let rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n let 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 '],{type:"application/javascript"}),t=window.URL.createObjectURL(e);return new Worker(t)},E=null,M=null,r=null,d=null;try{E=new xe({dbVersion:1,storePrefix:"ejs-",storeName:"system",keyPath:null,autoIncrement:!1,onStoreReady:function(){n=!0},onError:function(){n=!0}}),M=new xe({dbVersion:1,storePrefix:"ejs-",storeName:"roms",keyPath:null,autoIncrement:!1,onStoreReady:function(){a=!0},onError:function(){a=!0}}),r=new xe({dbVersion:1,storePrefix:"ejs-",storeName:"bios",keyPath:null,autoIncrement:!1,onStoreReady:function(){i=!0},onError:function(){i=!0}}),d=new xe({dbVersion:1,storePrefix:"ejs-",storeName:"romsdata",keyPath:null,autoIncrement:!1,onStoreReady:function(){},onError:function(){}})}catch(e){n=!0,a=!0,i=!0,console.log(e)}F.call(_,_.elements.container,"start-game",function(e){_.started=!0,_.playing=!0,U($.loading.querySelector(".".concat(T["loading-info"])),!0),!ee||"undefined"!=ee.virtualGamepadContainer&&null!==ee.virtualGamepadContainer||J.toggleControls.call(_,!0);let t=q({"ejs__tooltip--visible":!0}),n=_.elements.buttons.gamepad.querySelector(".".concat(q({ejs__tooltip:!0}))),a=(B(n,t,!0),setTimeout(function(){B(n,t,!1)},5e3),"string"==typeof _.adUrl&&(U($.loading.querySelector(".".concat(T["close-ad"])),!1),!0!==_.config.noAutoAdClose&&setTimeout(function(){_.started&&$.loading.querySelector(".".concat(T.ad))&&$.loading.querySelector(".".concat(T.ad)).parentNode.removeChild($.loading.querySelector(".".concat(T.ad)))},1e4)),U($.loading.querySelector(".".concat(T["start-game"])),!0),W(ne.defaultCoreOptionsValues.call(u),ne.storage.get("core-options")||{}));"n64"===_.system&&a&&Object.keys(a).forEach(function(e){"glupen64-aspect"===e&&"16:9"===a[e]&&(s.height=s.width/16*9,$.aspectRatio=16/9)}),"arcade"!==u.system&&"fba0.2.97.29"!==u.system||a&&Object.keys(a).forEach(function(e){"fba-aspect"===e&&"PAR"===a[e]&&(s.height=s.width/16*9,$.aspectRatio=16/9)}),"gba"===_.system&&(s.height=s.width/1.5,$.aspectRatio=1.5);{let e=u;"undefined"!=typeof RI?(document.removeEventListener("mousemove",RI.eventHandler,!1),s.removeEventListener("mousedown",RI.canvasEventHandler,!1),s.removeEventListener("mouseup",RI.canvasEventHandler,!1),e.elements.container.addEventListener("mousemove",function(e){let t=0,n=0,a=e.offsetX-$.Module.canvas.offsetLeft,o=e.offsetY-$.Module.canvas.offsetTop;if("mousemove"===e.type){t=a<0?(a=0,-$.Module.canvas.offsetWidth):a>$.Module.canvas.offsetWidth?(a=$.Module.canvas.offsetWidth,$.Module.canvas.offsetWidth):a-RI.currentX,n=o<0?(o=0,-$.Module.canvas.offsetHeight):o>$.Module.canvas.offsetHeight?(o=$.Module.canvas.offsetHeight,$.Module.canvas.offsetHeight):o-RI.currentY,RI.currentX=a,RI.currentY=o;for(let e=0;e<RI.contexts.length;e+=1)HEAP32[RI.contexts[e].state+32>>2]=t,HEAP32[RI.contexts[e].state+36>>2]=n}},!1),e.elements.container.addEventListener("mousedown",RI.canvasEventHandler,!1),e.elements.container.addEventListener("mouseup",RI.canvasEventHandler,!1),o=function(l){if(l.targetTouches[0]){let t,n,a=0,o=0,e=l.target.getBoundingClientRect(),i=l.targetTouches[0].clientX-e.left,s=l.targetTouches[0].clientY-e.top;a=i<0?(i=0,-$.Module.canvas.offsetWidth):i>$.Module.canvas.offsetWidth?(i=$.Module.canvas.offsetWidth,$.Module.canvas.offsetWidth):i-RI.currentX,o=s<0?(s=0,-$.Module.canvas.offsetHeight):s>$.Module.canvas.offsetHeight?(s=$.Module.canvas.offsetHeight,$.Module.canvas.offsetHeight):s-RI.currentY,RI.currentX=i,RI.currentY=s;for(let e=0;e<RI.contexts.length;e+=1)HEAP32[RI.contexts[e].state+32>>2]=a,HEAP32[RI.contexts[e].state+36>>2]=o;switch(l.type){case"touchend":case"touchstart":if(0===l.button)n=40;else{if(2!==l.button)break;n=41}t="touchend"===l.type?0:1;for(let e=0;e<RI.contexts.length;e+=1)HEAP8[RI.contexts[e].state+n>>0]=t}}},e.elements.container.addEventListener("touchstart",o,!1),e.elements.container.addEventListener("touchend",o,!1)):(o=function(e){e=new MouseEvent(e.type,e);$.Module.canvas.dispatchEvent(e)},H.call(u,".".concat(q({ejs__dialogs:!0}))).addEventListener("mousemove",o,!1),H.call(u,".".concat(q({ejs__dialogs:!0}))).addEventListener("mousedown",o,!1),H.call(u,".".concat(q({ejs__dialogs:!0}))).addEventListener("mouseup",o,!1))}var o;"msx"===_.system&&"undefined"!=typeof RI&&(document.removeEventListener("keydown",RI.eventHandler,!1),document.removeEventListener("keyup",RI.eventHandler,!1),o=function(n){var e=n.keyCode,a=e>>3,o=1<<(7&e);switch(n.type){case"keyup":case"keydown":if(32<=a)throw"key code error! bad code: "+e;for(let t=0;t<RI.contexts.length;t++){let e=HEAP8[RI.contexts[t].state+a>>0];"keyup"===n.type?e&=~o:e|=o,HEAP8[RI.contexts[t].state+a>>0]=e}}},document.addEventListener("keydown",o,!1),document.addEventListener("keyup",o,!1)),setTimeout(function(){let o;o=X.info(),null===ee.setVolume&&"undefined"!=typeof RA?(RA.queueAudio=function(){let e,t=_.volume,n=RA.bufIndex,a=(e=RA.bufIndex?RA.buffers[RA.bufIndex-1].endTime:RA.context.currentTime,RA.buffers[n].endTime=e+RA.buffers[n].duration,RA.context.createBufferSource());if(a.buffer=RA.buffers[n],1===(t=_.muted?0:t))a.connect(RA.context.destination);else{let e=RA.context.createGain();a.connect(e),e.connect(RA.context.destination),X.isEdge||"chrome"===o.name&&parseInt(o.version,10)<=60||"firefox"===o.name&&parseInt(o.version,10)<=56||"opera"===o.name&&parseInt(o.version,10)<=44?e.gain.value=t:"firefox"===o.name?e.gain.setValueAtTime(t,RA.context.currentTime):e.gain.setValueAtTime(t,RA.context.currentTime,0)}a.start(e),RA.bufIndex+=1,RA.bufOffset=0},X.isIos&&window.addEventListener("touchstart",function(){if(RA.context){RA.context.resume();let e=RA.context.createBufferSource();e.connect(RA.context.destination),e.start()}},!1)):ee.setVolume()},500),setTimeout(function(){_.elements.container.focus()},30),void 0===window.addRunDependency&&(window.Module=void 0)}),"string"==typeof _.adUrl&&F.call(_,$.loading.querySelector(".".concat(T["close-ad"])),"click",function(e){e instanceof MouseEvent&&_.started&&$.loading.querySelector(".".concat(T.ad))&&$.loading.querySelector(".".concat(T.ad)).parentNode.removeChild($.loading.querySelector(".".concat(T.ad))),_.elements.container.focus()});let C=function(){M.db&&M.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&&!$.saveFilenames.includes(e.key)?(M.remove(e.key),d.db&&d.remove(e.key)):(delete e.data,M.put(e.key,e))})},function(){M.clear(),d.db&&d.clear()})},P=function(o){if($.gamePatch){let r=$.getStartName(!0),e=r.split("/"),t=e.pop().split(".").pop(),n=($.gamePatch.split(".").pop(),$.gamePatch.split("/").pop().split(".").shift()),a="".concat(e.join("/"),"/").concat(n,".").concat(t);a=a.replace(/\#/g,""),$.gamePatch.startsWith("blob:")&&(a=r);var c,d=$.gamePatch;if($.FS.rename(r,a),o.startName=a,r=$.getStartName(!0),"snes"===o.system||["snes2002","snes2005","snes2010"].includes(o.system)){let e,t,n,a=new Q($.FS.readFile(r)),o=Z(a),i=new Q($.FS.readFile(d)),s=i.readString(6),l=a._u8array.length%1024;s.startsWith("PATCH")?(e=Se(i),0==l&&"B19ED489"===o.toString(16).toUpperCase()&&((t=new Uint8Array(a._u8array.length+512)).set(new Uint8Array(512),0),t.set(a._u8array,512),a=new Q(t))):s.startsWith(ke)?e=De(i):s.startsWith("BPS1")&&(e=Ae(i),0<l&&"A31BEAD4"===o.toString(16).toUpperCase()&&(t=a._u8array.slice?a._u8array.slice(l):a._u8array.subarray(l),a=new Q(t)));try{(n=e.apply(a,!1))&&(0<(c=n._u8array.length%1024)&&(t=n._u8array.slice?n._u8array.slice(c):n._u8array.subarray(c),n=new Q(t)),$.FS.unlink(d),$.FS.unlink(r),$.FS.writeFile(r,n._u8array))}catch(e){}}else{let e,t,n=new Q($.FS.readFile(r)),a=new Q($.FS.readFile(d)),o=a.readString(6);o.startsWith("PATCH")?e=Se(a):o.startsWith(ke)?e=De(a):o.startsWith("BPS1")&&(e=Ae(a));try{(t=e.apply(n,!1))&&($.FS.unlink(d),$.FS.unlink(r),$.FS.writeFile(r,t._u8array))}catch(e){}}}},I=function(){var e=2===u.coreVer?"INITIAL_MEMORY":"TOTAL_MEMORY";g?(window.Module[e]=268435456,["jaguar"].includes(u.system)&&(window.Module[e]=268435456),["nds","nes","snes","arcade","mame"].includes(u.system)&&(window.Module[e]=0),["snes2002","snes2005","snes2010"].includes(u.system)&&(window.Module[e]=0),"gba"==u.system&&(window.Module[e]=0),"3do"==u.system&&(window.Module[e]=0),"n64"==u.system&&(window.Module[e]=0)):("nes"===u.system&&(window.Module[e]=134217728),window.Module[e]=h+67108864,["arcade","mame","mame2003","fba0.2.97.29"].includes(u.system)&&(window.Module[e]=h+268435456,$.isMobileDevice&&(window.Module[e]=314572800)),["n64","nds","jaguar"].includes(u.system)&&(window.Module[e]=h+268435456,$.isMobileDevice&&(window.Module[e]=314572800)),"gba"==u.system&&(window.Module[e]=268435456)),"undefined"!=typeof EJS_MEMORY&&(window.Module[e]=EJS_MEMORY)},A=function(e,t){function n(t){if(i.innerHTML="Game Data ready",t)try{I(),P(o),C();let e=[t,[$.hash,$.hash2,$.hash3].join("")];if("undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX&&e.unshift("-v"),$.Module.callMain(e),2===_.coreVer){$.Module.resumeMainLoop(),$.Module.setCanvasSize(800,600);let e=0,t=setInterval(function(){20<e&&clearInterval(t),e++,$.Module.setCanvasSize(800,600)},100)}G.call(o,o.elements.container,"start-game");try{c()}catch(e){}}catch(e){console.log(e),i.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">Doesn\'t look like your browser is supported</strong>'}else i.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">Invalid Rom</strong>'}function a(e){if(e.data){if(1===e.data.t&&(!o.startName&&r&&(o.startName=r),e.target.terminate(),n(o.startName)),2===e.data.t){let t=e.data.file.split("/"),n=t.pop(),a=n.split(".").pop();n=n.replace(/\#/g,""),$.FS.createPath("/",t.join("/"),!0,!0);for(let e=v[s].length-1;0<=e;--e)v[s][e]===a.toLowerCase()&&e>l&&(l=e,o.startName=["",t.join("/"),n].join("/"),o.startName=o.startName.replace(/\/+/,"/"));n&&($.FS.createDataFile("/".concat(t.join("/")),n,e.data.data,!0,!1),h+=e.data.data.length),r="/".concat(t.join("/"),"/").concat(n)}var t;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&&(i.innerHTML=u.localization("Decompress Game Data")+e+" "+t+"%"))}}let o=u,i=$.loading.querySelector(".".concat(T.p3)),s=(e.split(".").pop(),y[b]),l=-1,r="",c=function(){if(2===o.coreVer){o.elements.settings.panels.home.querySelector('[role="menu"]').innerHTML="",te.setNormalOptionsMenu.call(o),te.setCoreOptionsMenu.call(o);let e=$.Module.cwrap("toggleMainLoop","null",["number"]);$.Module.resumeMainLoop=function(){e(1)},$.Module.pauseMainLoop=function(){e(0)}}"string"==typeof o.loadStateOnStart&&fetch(o.loadStateOnStart).then(function(e){e.arrayBuffer().then(function(e){e=new Uint8Array(e);EJS_loadState(e)})})},d=(window.EJS_terminate=function(){if($.Module.pauseMainLoop(),o&&o.eventListeners)for(var e in o)for(let t=0;t<o.eventListeners.length;t++){let e=o.eventListeners[t];e.element.removeEventListener(e.type,e.callback,e.capture)}if(window.EJS_RESET_VARS){let t=[],n=[];for(var a in window)t.push(a);for(let e=0;e<t.length;e++)window.EJS_RESET_VARS.includes(t[e])||n.push(t[e]);for(let e=0;e<n.length;e++)window[n[e]]&&delete window[n[e]]}},!1);if(["arcade","mame","mame2003","fba0.2.97.29"].includes(o.system)||(e=t.slice?t.slice(0,10):t.subarray(0,10),"7z"===(e=x(e))?(w(f).then(function(e){e.onmessage=a,e.postMessage(t)}),d=!0):"zip"===e?(w(p).then(function(e){e.onmessage=a,e.postMessage(t)}),d=!0):"rar"===e&&(S(m).then(function(e){e.onmessage=a,e.postMessage(t)}),d=!0)),!d){o.startName=o.getStartName(),o.startName||(o.startName="rom");try{h+=t.length,$.FS.createDataFile("/",o.startName,t,!0,!1)}catch(e){console.log(e)}n(o.startName)}},c=function(){let a=u,s=$.loading.querySelector(".".concat(T.p3)),e=u.config,l=e.gameUrl,r=e.system,t=("vbanext"==r&&(r="gba"),"string"==typeof l?l.split("/"):"ga.me"),c=t[t.length-1];(c=-1<c.indexOf("?")?c.substr(0,c.indexOf("?")):c).split(".").pop(),s.innerHTML=u.localization("Download Game Data"),["arcade","mame","mame2003","fba0.2.97.29"].includes(a.system)&&a.config.gameParentUrl&&(s.innerHTML+=" (2/2)"),a.config.gamePatchUrl&&(s.innerHTML+=" (2/2)"),"string"!=typeof l?"[object Blob]"===l.toString()?l.arrayBuffer().then(function(e){A(c,new Uint8Array(e))}):"[object ArrayBuffer]"===l.toString()?A(c,new Uint8Array(l)):A(c,Uint8Array.from(l)):K.a.head(l,{}).then(function(e){function t(){K.a.get(l,{onDownloadProgress:function(e){e=e.total?"".concat(Math.floor(e.loaded/e.total*100),"%"):"";["arcade","mame","mame2003","fba0.2.97.29"].includes(a.system)&&a.config.gameParentUrl||a.config.gamePatchUrl?s.innerHTML=u.localization("Download Game Data")+" (2/2) ".concat(e):s.innerHTML=u.localization("Download Game Data")+" ".concat(e)},responseType:"arraybuffer"}).then(function(e){let a=new Uint8Array(e.data);if("string"!=typeof u.config.gameUrl||"string"==typeof u.config.gameUrl&&(u.config.gameUrl.startsWith("blob:")||u.config.gameUrl.startsWith("file:")||u.config.gameUrl.startsWith("chrome-extension:")||("file:"==window.location.protocol||"chrome-extension:"==window.location.protocol)&&1===u.config.gameUrl.split(":").length))A(c,a);else{if(i&&M.db)if(104857600<a.length)for(let e=Math.ceil(a.length/104857600),n=0;n<e;n+=1){let e=a.slice?a.slice(104857600*n,104857600*(n+1)):a.subarray(104857600*n,104857600*(n+1)),t="".concat(i);0<n&&(t="".concat(i,"-part-").concat(n)),$.saveFilenames.push(t),M.put(t,{filename:c,filesize:a.length,filetype:o,key:t,lastaccess:(new Date).valueOf(),next:"".concat(i,"-part-").concat(n+1)}),d.db&&d.put(t,{filename:c,filesize:a.length,filetype:o,key:t,data:e})}else $.saveFilenames.push(i),M.put(i,{filename:c,filesize:a.length,filetype:o,key:i,lastaccess:(new Date).valueOf()}),d.db&&d.put(i,{filename:c,filesize:a.length,filetype:o,key:i,data:a});A(c,a)}}).catch(function(e){j(e,s,u)})}let n=e.headers["content-length"],o=e.headers["content-type"],i=(e.headers["last-modified"],"".concat(r,"-").concat(c));d.db?d.get(i,function(a){if(a&&a.filename===c&&a.filesize-n==0&&a.filetype===o&&a.key)if(M.get(i,function(e){e.lastaccess=(new Date).valueOf(),M.put(e.key,e)}),104857600<a.filesize){let n=new Uint8Array(a.filesize);n.set(a.data);for(let e=Math.ceil(a.filesize/104857600),t=[],n=1;n<e;n+=1)t.push("".concat(i,"-part-").concat(n)),M.get("".concat(i,"-part-").concat(n),function(e){e.lastaccess=(new Date).valueOf(),M.put(e.key,e)});d.getBatch(_0x36180f,function(e){e.filter(function(e){return e}).length!==_0x36180f.length?t():(e.forEach(function(e,t){n.set(e.data,104857600*(t+1))}),A(a.filename,n))},function(){},"sparse")}else A(a.filename,a.data);else t()}):t()}).catch(function(e){j(e,s,u)})},O=function(){let t=$.loading.querySelector(".".concat(T.p3)),n=u.config.gamePatchUrl;if(n){let e=n.split("/"),l=e[e.length-1];(l=-1<l.indexOf("?")?l.substr(0,l.indexOf("?")):l).split(".").pop(),t.innerHTML=u.localization("Download Game Data")+" (1/2)",K.a.get(n,{onDownloadProgress:function(e){t.innerHTML=u.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){function t(a){if(a.data){if(1===a.data.t&&(a.target.terminate(),c()),2===a.data.t){let e=a.data.file.split("/"),t=e.pop(),n=t.split(".").pop();$.FS.createPath("/",e.join("/"),!0,!0),$.FS.createDataFile("/"+e.join("/"),t,a.data.data,!0,!1),h+=a.data.data.length,["ips","bps","ups"].includes(n)&&!$.gamePatch&&($.gamePatch="/"+e.join("/")+"/"+t)}var e;4===a.data.t&&0<a.data.total&&(e=Math.floor(a.data.current/a.data.total*100),a=a.data.name||"",e<=100&&0<e&&(o.innerHTML=u.localization("Decompress Game Patch")+" ".concat(a," ").concat(e,"%")))}}let n=new Uint8Array(e.data),a=l.split(".").pop(),o=$.loading.querySelector(".".concat(T.p3)),i=n.slice?n.slice(0,10):n.subarray(0,10),s=x(i);"7z"===s?w(f).then(function(e){e.onmessage=t,e.postMessage(n)}):"zip"===s?w(p).then(function(e){e.onmessage=t,e.postMessage(n)}):"rar"===s?S(m).then(function(e){e.onmessage=t,e.postMessage(n)}):(h+=n.length,$.gamePatch="/"+a,$.FS.createDataFile("/",a,n,!0,!1),c())}).catch(function(e){j(e,p,u)})}else c()},R=function(){let t=u,a=$.loading.querySelector(".".concat(T.p3)),l=u.config.gameParentUrl;if(l&&["arcade","mame","mame2003","fba0.2.97.29"].includes(t.system)){let e=l.split("/"),s=e[e.length-1];(s=-1<s.indexOf("?")?s.substr(0,s.indexOf("?")):s).split(".").pop(),a.innerHTML=u.localization("Download Game Data")+" (1/2)",t.config.gamePatchUrl&&(a.innerHTML=u.localization("Download Game Data")+" (1/3)"),K.a.head(l,{}).then(function(e){function t(){K.a.get(l,{onDownloadProgress:function(e){e=e.total?"".concat(Math.floor(e.loaded/e.total*100),"%"):"";a.innerHTML=u.localization("Download Game Data")+" (1/2) ".concat(e)},responseType:"arraybuffer"}).then(function(e){let a=new Uint8Array(e.data);if(i&&M.db)if(104857600<a.length)for(let e=Math.ceil(a.length/104857600),n=0;n<e;n+=1){let e=a.slice?a.slice(104857600*n,104857600*(n+1)):a.subarray(104857600*n,104857600*(n+1)),t="".concat(i);0<n&&(t="".concat(i,"-part-").concat(n)),$.saveFilenames.push(t),M.put(t,{filename:s,filesize:a.length,filetype:o,key:t,lastaccess:(new Date).valueOf(),next:"".concat(i,"-part-").concat(n+1)}),d.db&&d.put(t,{filename:s,filesize:a.length,filetype:o,key:t,data:e})}else $.saveFilenames.push(i),M.put(i,{filename:s,filesize:a.length,filetype:o,key:i,lastaccess:(new Date).valueOf()}),d.db&&d.put(i,{filename:s,filesize:a.length,filetype:o,key:i,data:a});e=s.replace(/\#/g,"");try{h+=a.length,$.FS.createDataFile("/",e,a,!0,!1),O()}catch(e){console.log(e)}}).catch(function(e){j(e,a,u)})}let n=e.headers["content-length"],o=e.headers["content-type"],i=(e.headers["last-modified"],"".concat(b,"-").concat(s));d.db?d.get(i,function(a){if(a&&a.filename===s&&a.filesize-n==0&&a.filetype===o&&a.key)if(104857600<a.filesize){let n=new Uint8Array(a.filesize);n.set(a.data);for(let e=Math.ceil(a.filesize/104857600),t=[],n=1;n<e;n+=1)t.push("".concat(i,"-part-").concat(n));d.getBatch(_0x6f30ae,function(e){e.filter(function(e){return e}).length!==_0x6f30ae?t():(e.forEach(function(e,t){n.set(e.data,104857600*(t+1))}),$.FS.createDataFile("/",a.filename,n,!0,!1),O())},function(){},"sparse")}else $.FS.createDataFile("/",a.filename,a.data,!0,!1),O();else t()}):t()}).catch(function(e){j(e,a,u)})}else O()},N=function(e,t){function n(n){if(n.data){if(1===n.data.t&&(o.innerHTML="BIOS ready",n.target.terminate(),R()),2===n.data.t){let e=n.data.file.split("/"),t=e.pop();t.split(".").pop(),$.FS.createPath("/",e.join("/"),!0,!0),$.FS.createDataFile("/"+e.join("/"),t,n.data.data,!0,!1),h+=n.data.data.length}var e;4===n.data.t&&0<n.data.total&&(e=Math.floor(n.data.current/n.data.total*100),n=n.data.name||"",e<=100&&0<e&&(o.innerHTML="Decompress BIOS ".concat(n," ").concat(e,"%")))}}let a=u,o=$.loading.querySelector(".".concat(T.p2)),i=(e.split(".").pop(),t.slice?t.slice(0,10):t.subarray(0,10)),s=x(i);"7z"===s?w(f).then(function(e){e.onmessage=n,e.postMessage(t)}):"rar"===s?S(m).then(function(e){e.onmessage=n,e.postMessage(t)}):"zip"!==s||["arcade","mame","mame2003","fba0.2.97.29"].includes(a.system)?(h+=t.length,o.innerHTML="BIOS ready",$.FS.createDataFile("/",e,t,!0,!1),R()):w(p).then(function(e){e.onmessage=n,e.postMessage(t)})},l=function(){$.loading.querySelector(".".concat(T.p1)).innerHTML="Game Core ready";let l=u.config.biosUrl,e=(ee.bindFunction.call(u),ee.setGamepadDialog.call(u),ee.setCacheDialog.call(u),ee.setLoadingDialog.call(u),ee.setCheatDialog.call(u),ee.initGamepad.call(u),ee.initKeyboard.call(u),ee.listeners.call(u),$._FS.createFolder("/","etc",!0,!0),$.FS.mkdir("/data"),$.FS.mkdir("/data/saves"),"undefined"!=typeof IDBFS?$.FS.mount(IDBFS,{},"/data/saves"):$.FS.mount($.FS.filesystems.IDBFS,{},"/data/saves"),$.FS.mkdir("/shader"),$.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",ne.defaultCoreOptionsValues.call(u)),n=(u.lightgun&&("nes"===u.system&&(e+='input_libretro_device_p2 = "258"\n'),"segaMS"!==u.system&&"segaMD"!==u.system&&"segaCD"!==u.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"===u.system&&(e+='input_libretro_device_p2 = "260"\n'),["snes2002","snes2005","snes2010","snesnext"].includes(u.system)&&(e+='input_libretro_device_p2 = "260"\n')),u.mouse&&("snes"===u.system&&(e+="input_libretro_device_p1 = 2\n"),["snes2002","snes2005","snes2010","snesnext"].includes(u.system)&&(e+="input_libretro_device_p1 = 2\n")),u.multitap&&["snes2002","snes2005","snes2010","snesnext","snes"].includes(u.system)&&(e+="input_libretro_device_p2 = 257\n"),"n64"===u.system&&(e+="input_libretro_device_p1 = 5\n"),e=e+"fastforward_ratio = 1.0\n"+"video_smooth = false\n",W(t,ne.storage.get("core-options")||{})),a="";if(2===u.coreVer?($.FS.createDataFile("/etc","retroarch.cfg",e,!0,!0),$._FS.createFolder("/home/web_user","retroarch",!0,!0),$._FS.createFolder("/home/web_user/retroarch","userdata",!0,!0),$.FS.createDataFile("/home/web_user/retroarch/userdata","retroarch.cfg",a,!0,!0)):($.FS.createDataFile("/etc","retroarch.cfg",e,!0,!0),$._FS.createFolder("/home/web_user",".config",!0,!0),$._FS.createFolder("/home/web_user/.config","retroarch",!0,!0),$.FS.createDataFile("/home/web_user/.config/retroarch","retroarch-core-options.cfg",a,!0,!0)),n&&Object.keys(n).forEach(function(t){if(u.lightgun&&"nes"===u.system&&"system_type"===t)return!1;a+="".concat(t,' = "').concat(n[t],'"\n'),F.call(u,u.elements.container,"start-game",function(e){ee.setVariable(t,n[t])})}),l){let e=l.split("/"),i=e[e.length-1],s=((i=-1<i.indexOf("?")?i.substr(0,i.indexOf("?")):i).split(".").pop(),$.loading.querySelector(".".concat(T.p2)));K.a.head(l,{}).then(function(e){function t(){K.a.get(l,{onDownloadProgress:function(e){e=e.total?"".concat(Math.floor(e.loaded/e.total*100),"%"):"";s.innerHTML="Download BIOS ".concat(e)},responseType:"arraybuffer"}).then(function(e){e=new Uint8Array(e.data);r.db&&r.put(b,{filename:i,filesize:e.length,filetype:a,data:e}),N(i,e)}).catch(function(e){j(e,s,u)})}let n=e.headers["content-length"],a=e.headers["content-type"],o=(e.headers["last-modified"],u.system);r.db?r.get(o,function(e){e&&e.filename===i&&e.filesize-n==0&&e.filetype===a?N(e.filename,e.data):t()}):t()}).catch(function(e){j(e,s,u)})}else R()},k=function(e){e=e.byteLength?new Uint8Array(e):e;"undefined"!=typeof GLOBAL_BASE?$.Module.HEAPU8.set(e,GLOBAL_BASE):"undefined"!=typeof Runtime&&Runtime.GLOBAL_BASE?$.Module.HEAPU8.set(e,Runtime.GLOBAL_BASE):$.Module.HEAPU8.set(e,8)},z=function(t){function n(n){if(n.data){if(1===n.data.t&&(G.call(_,_.elements.container,"script-loaded"),n.target.terminate()),2===n.data.t){let e=n.data.file.split("/").pop(),t=e.split(".").pop();$.coreFileData[e]=n.data.data,"js"!==t||e.includes(".worker.js")||(a=n.data.data),"mem"===t&&($.memData=n.data.data),"wasm"===t&&($.wasmData=n.data.data)}4===n.data.t&&0<n.data.total&&(e.innerHTML=u.localization("Decompress Game Core")+" ".concat(Math.floor(n.data.current/n.data.total*100),"%"))}}let e=$.loading.querySelector(".".concat(T.p1)),a="";F.call(_,_.elements.container,"script-loaded",function(e){{null!==$.wasmData?(window.Module.wasmBinary=$.wasmData,I(),window.Module.monitorRunDependencies=function(e){0===e&&l()},window.Module.onRuntimeInitialized=function(){}):(I(),window.Module.monitorRunDependencies=function(e){console.log("monitorRunDependencies, ",e)},window.Module.onRuntimeInitialized=function(){$.Module||($.Module=window.Module),$.Module&&$.Module.FS?$.FS=$.Module.FS:$.FS=window.FS,console.log("onRuntimeInitialized"),l()});let n=window.Module;if(null!==$.wasmData&&(n.wasmBinary=$.wasmData),X.isIos&&null!==$.wasmData){let e=new Blob([a],{type:"text/javascript"}),t=V("script",{src:o.createObjectURL(e)});document.body.appendChild(t),t.onload=function(){void 0===window.addRunDependency&&"undefined"!=typeof EmulatorJS&&($.Module=EmulatorJS(n),EmulatorJS=void 0),null!==$.memData&&2!==_.coreVer&&k($.memData),$.Module||($.Module=window.Module),$.Module&&$.Module.FS?$.FS=$.Module.FS:$.FS=window.FS}}else{try{a=function(n){let a=[];for(let t=0;t<n.length;t+=1){let e=n[t];255<e&&(e&=255),a.push(String.fromCharCode(e))}return a.join("").replace(/fullscreenElement/gi, "fullscreenElement_OFF")}(a),window.eval(a),void 0===window.addRunDependency&&"undefined"!=typeof EmulatorJS&&($.Module=EmulatorJS(n),EmulatorJS=void 0),null!==$.memData&&2!==_.coreVer&&k($.memData),$.Module||($.Module=window.Module),$.Module&&$.Module.FS?$.FS=$.Module.FS:$.FS=window.FS,window.EJS_MODULE=$.Module,window.ejs_loader=$,window.ejs_media=ee;}catch(_ex){}}return void(a=null)}});w(f).then(function(e){e.onmessage=n,e.postMessage(t)})},L=function(t){U($.loading.querySelector(".".concat(T["start-game"])),!0);let o=$.loading.querySelector(".".concat(T.p1));if(o.innerHTML=u.localization("Loading")+"...",!0===n&&!0===a&&!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){let t=null;var n;return e.includes(".worker.js")?(Object.keys($.coreFileData).includes(e)&&(t=$.coreFileData[e]),n=new Blob([""],{type:"application/javascript"}),window.URL.createObjectURL(n)):e.includes(".js.mem")&&Object.keys($.coreFileData).includes(e)?(t=$.coreFileData[e],URL.createObjectURL(new Blob([t.buffer]))):null},readAsync:function(t,n,a){if(t instanceof ArrayBuffer)setTimeout(function(){n(t)},500);else{let e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=function(){200==e.status||0==e.status&&e.response?n(e.response):a()},e.onerror=a,e.send()}}};let d=function(n,a){var e=u.customPaths&&"string"==typeof u.customPaths[n]?u.customPaths[n]:2===u.coreVer?u.dataPath+"cores/"+n+"?v="+a:u.dataPath+"old/"+n+"?v="+a;K.a.get(e,{onDownloadProgress:function(e){e.total&&Math.floor(e.loaded/e.total*100).toString();o.innerHTML=u.localization("Download Game Core")+a},responseType:"arraybuffer"}).then(function(e){let t=new Uint8Array(e.data);if(E.db&&E.put(n,{version:a,data:t}),2===u.coreVer)z(t);else{let e=t.slice?t.slice(12):t.subarray(12);e.set([55,122,188,175,39,28,0,3],0),t=null,z(e)}}).catch(function(e){j(e,o,u)})};var e=u.customPaths&&"string"==typeof u.customPaths["v.json"]?u.customPaths["v.json"]:u.dataPath+"v.json";return K.a.get(e,{}).then(function(s){let l,r=y[u.system],e=s.data[u.system],c=$.loading.querySelector(".".concat(T.p1));if(e){let n=e.version||1,t=Boolean(e.state),a=Boolean(e.asmjs),o=Boolean(e.wasm),i=(!0===u.config.oldCores&&1===e.oldCores||1!==e.newCores||!Y.wasm&&!a||$.isMobileDevice&&1===e.oldCores||(u.coreVer=2,delete Module.readAsync,Module.INITIAL_MEMORY=Module.TOTAL_MEMORY,delete Module.TOTAL_MEMORY,u.elements.settings.panels.home.querySelector('[role="menu"]').innerHTML="",te.setNormalOptionsMenu.call(u),te.setCoreOptionsMenu.call(u)),2!==u.coreVer&&e.old&&(a=Boolean(e.old.asmjs),o=Boolean(e.old.wasm)),"nds"!=u.system||Y.wasm||2===u.coreVer||(t=!1),!1===u.statesSupported&&(t=!1),$.coreFileVersion=n,$.coreFileName=r,!1);if(["webgl2","experimental-webgl2"].includes(Y.webgl.WEBGL_CONTEXT)&&(i=!0),"undefined"!=typeof EJS_N64_LEGACY&&1==EJS_N64_LEGACY&&(i=!1),"mame"==u.system){let e=u.mameCore;if(!e||null===e||2!==e.split("|").length)return void(c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+u.localization("Missing mame config")+"</strong>");s=e.split("|");$.coreFileName="".concat(u.system,"-").concat(s[0]),t="1"===s[1],D.element(u.elements.buttons.saveState)&&U(u.elements.buttons.saveState,!t),D.element(u.elements.buttons.loadState)&&U(u.elements.buttons.loadState,!t),U(ne.contextMenu.querySelectorAll("ul li").item(2),!t),U(ne.contextMenu.querySelectorAll("ul li").item(3),!t),l=2===u.coreVer?"":u.system.concat("-old-").concat(s[0],"-wasm.data"),s[0]?(Y.wasm&&o?g=!0:(c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+u.localization("Webassembly support is not detected in this browser")+"</strong>",l=""),l&&(E.db?E.get(l,function(t){if(t&&t.version===n)if(2===_.coreVer)z(t.data);else{let e=t.data.slice?t.data.slice(12):t.data.subarray(12);e.set([55,122,188,175,39,28,0,3],0),z(e)}else d(l,n)}):d(l,n))):c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+u.localization("Unsupported Game")+"</strong>"}else{l=!1;let e;if(Y.wasm&&o?(e="wasm",l=!0,"n64"!==u.system||i||2===u.coreVer||(e="legacy-wasm"),g=!0):a&&(l=!0,e="asmjs","n64"!==u.system||i||2===u.coreVer||(e="legacy-asmjs")),!0!==(l="undefined"!=typeof EJS_CUSTOM_COREFILE?EJS_CUSTOM_COREFILE:l))return void(c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+u.localization("Please upgrade your browser to the latest version")+"</strong>");l=2===u.coreVer?r+"-"+e+".data":r+"-old-"+e+".data","undefined"!=typeof EJS_CUSTOM_COREFILE&&(l=EJS_CUSTOM_COREFILE),E.db?E.get(l,function(t){if(!t||t.version!==n||"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX)d(l,n);else if(2===_.coreVer)z(t.data);else{let e=t.data.slice?t.data.slice(12):t.data.subarray(12);e.set([55,122,188,175,39,28,0,3],0),z(e)}}):d(l,n)}D.element(u.elements.buttons.saveState)&&U(u.elements.buttons.saveState,!t),D.element(u.elements.buttons.loadState)&&U(u.elements.buttons.loadState,!t),U(ne.contextMenu.querySelectorAll("ul li").item(2),!t),U(ne.contextMenu.querySelectorAll("ul li").item(3),!t),u.statesSupported=t,u.config.buttons&&(!1===u.config.buttons.playPause&&D.element(u.elements.buttons.play[0])&&U(u.elements.buttons.play[0],!0),!1===u.config.buttons.restart&&D.element(u.elements.buttons.restart)&&U(u.elements.buttons.restart,!0),!1===u.config.buttons.mute&&D.element(u.elements.buttons.mute)&&U(u.elements.buttons.mute,!0),!1===u.config.buttons.settings&&D.element(u.elements.buttons.settings)&&U(u.elements.buttons.settings,!0),!1===u.config.buttons.fullscreen&&D.element(u.elements.buttons.fullscreen)&&U(u.elements.buttons.fullscreen,!0),!1===u.config.buttons.saveState&&D.element(u.elements.buttons.saveState)&&U(u.elements.buttons.saveState,!0),!1===u.config.buttons.loadState&&D.element(u.elements.buttons.loadState)&&U(u.elements.buttons.loadState,!0),!1===u.config.buttons.screenRecord&&D.element(u.elements.buttons.screenRecord)&&U(u.elements.buttons.screenRecord,!0),!1===u.config.buttons.gamepad&&D.element(u.elements.buttons.gamepad)&&U(u.elements.buttons.gamepad,!0),!1===u.config.buttons.cheat&&D.element(u.elements.buttons.cheat)&&U(u.elements.buttons.cheat,!0),!1===u.config.buttons.volume&&D.element(u.elements.inputs.volume)&&U(u.elements.inputs.volume,!0),!1===u.config.buttons.screenshot&&U(ne.contextMenu.querySelectorAll("ul li").item(0),!0),!0===u.config.buttons.cacheManage&&U(ne.contextMenu.querySelectorAll("ul li").item(1),!1),!1===u.config.buttons.quickSave&&U(ne.contextMenu.querySelectorAll("ul li").item(2),!0),!1===u.config.buttons.quickLoad&&U(ne.contextMenu.querySelectorAll("ul li").item(3),!0))}else c.innerHTML='<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+u.localization("Invalid System")+"</strong>"}).catch(function(e){j(e,t,_)}),$.romdb=M,!1}setTimeout(L,50)};ae($.loading.querySelector(".".concat(T["start-game"])),"click touchstart",L),!0===_.startOnLoad&&$.loading.querySelector(".".concat(T["start-game"])).click()}};let g=$;function Fe(e){return function(n){if(Array.isArray(n)){for(let e=0,t=new Array(n.length);e<n.length;e++)t[e]=n[e];return s}}(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 Ge(n,a){for(let t=0;t<a.length;t++){let e=a[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}let Ve,Ue,Be,He,qe,Xe=(Ve=["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^="-"])'],Ue=function(){function u(e){var t=e.targetModal,n=e.triggers,n=void 0===n?[]:n,a=e.onShow,a=void 0===a?function(){}:a,o=e.onClose,o=void 0===o?function(){}:o,i=e.openTrigger,i=void 0===i?"data-micromodal-trigger":i,s=e.closeTrigger,s=void 0===s?"data-micromodal-close":s,l=e.disableScroll,l=void 0!==l&&l,r=e.disableFocus,r=void 0!==r&&r,c=e.awaitCloseAnimation,c=void 0!==c&&c,d=e.debugMode,d=void 0!==d&&d,e=e.closeByEsckey,e=void 0===e||e;if(!(this instanceof u))throw new TypeError("Cannot call a class as a function");this.modal=document.getElementById(t),this.config={debugMode:d,disableScroll:l,openTrigger:i,closeTrigger:s,onShow:a,onClose:o,awaitCloseAnimation:c,disableFocus:r,closeByEsckey:e},0<n.length&&this.registerTriggers.apply(this,Fe(n)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}let e,t;return e=u,t=[{key:"registerTriggers",value:function(){for(let e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach(function(e){e.addEventListener("click",function(){return u.showModal()})})}},{key:"showModal",value:function(){this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(q({"is-open":!0})),this.setFocusToFirstNode(),this.addEventListeners(),this.config.onShow(this.modal)}},{key:"closeModal",value:function(){let 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(q({"is-open":!0})),t.removeEventListener("animationend",e,!1)},!1):t.classList.remove(q({"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(){let t=this.modal.querySelectorAll(Ve);return Object.keys(t).map(function(e){return t[e]})}},{key:"setFocusToFirstNode",value:function(){if(!this.config.disableFocus){let e=this.getFocusableNodes();e.length&&e[0].focus()}}},{key:"maintainFocus",value:function(e){let t=this.getFocusableNodes();var n;this.modal.contains(document.activeElement)?(n=t.indexOf(document.activeElement),e.shiftKey&&0===n&&(t[t.length-1].focus(),e.preventDefault()),e.shiftKey||n!==t.length-1||(t[0].focus(),e.preventDefault())):t[0].focus()}}],Ge(e.prototype,t),u}(),Be=null,He=function(e){if(!document.getElementById(e))return!1},qe=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)He(n);return!0},{init:function(e){let t=Object.assign({},{openTrigger:"data-micromodal-trigger"},e),n=Fe(document.querySelectorAll("[".concat(t.openTrigger,"]"))),a=function(e,n){let a=[];return e.forEach(function(e){var t=e.attributes[n].value;void 0===a[t]&&(a[t]=[]),a[t].push(e)}),a}(n,t.openTrigger);if(!0!==t.debugMode||!1!==qe(n,a))for(var o in a){var i=a[o];t.targetModal=o,t.triggers=Fe(i),new Ue(t)}},show:function(e,t){let n=t||{};return n.targetModal=e,!0===n.debugMode&&!1===He(e)?Be=null:(Be=new Ue(n)).showModal(),Be},close:function(){Be.closeModal()}});var 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: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:function(){try{return new xe({dbVersion:1,storePrefix:"ejs-",storeName:"states",keyPath:null,autoIncrement:!1,onStoreReady:function(){},onError:function(){}})}catch(e){console.log(e)}}(),saveLoadDB:function(n){try{if(!v.saveLoaddbDB.db)return!1;if(ne&&"function"==typeof ne.getCoreOptionsValues){var e=ne.getCoreOptionsValues()["save-state-location"];if(!e||"download"===e)return!1;if(!this.getStartName())return!1;var a=ne.getCoreOptionsValues()["save-state-slot"],o=this.getStartName();if(!a)return!1;let t=o+"-"+a;return async function(){if("save"===n)try{var e=await v.saveState();v.saveLoaddbDB.put(t,e)}catch(e){return}else v.saveLoaddbDB.get(t,function(e){EJS_loadState(e)})}(),!0}return!1}catch(e){return!1}},gamepad:null,allowCheat:!0,connection:null,connected:!1,playerName:"",players:[],waitingList:{},roomMaster:null,inputsData:{},coreOptionData:{},currentFrame:0,wait:!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>'},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":q({"dialog-container":!0}),tabs:q({tabs:!0}),"dialog-title":q({"dialog-title":!0}),"dialog-content":q({"dialog-content":!0}),"dialog-buttons":q({"dialog-buttons":!0}),overlay:q({overlay:!0}),"key-setting-popup":q({"key-setting-popup":!0}),"tabs-panel":q({"tabs-panel":!0}),"tabs-content":q({"tabs-content":!0}),"button-container":q({"button-container":!0}),set:q({set:!0}),active:q({active:!0}),"btn-cancel":q({"btn-cancel":!0}),"btn-reset":q({"btn-reset":!0}),"btn-clear":q({"btn-clear":!0}),"btn-create":q({"btn-create":!0}),"btn-submit":q({"btn-submit":!0}),"btn-join-room":q({"btn-join-room":!0}),"btn-quit":q({"btn-quit":!0}),"btn-create-room":q({"btn-create-room":!0}),modal:q({modal:!0}),modal__overlay:q({modal__overlay:!0}),modal__container:q({modal__container:!0}),modal__header:q({modal__header:!0}),modal__title:q({modal__title:!0}),modal__close:q({modal__close:!0}),modal__content:q({modal__content:!0}),modal__btn:q({modal__btn:!0}),"modal__btn-primary":q({"modal__btn-primary":!0}),"micromodal-slide":q({"micromodal-slide":!0}),modal__errmsg:q({modal__errmsg:!0}),modal__footer:q({modal__footer:!0}),"cheats-add":q({"cheats-add":!0}),"cheats-list":q({"cheats-list":!0}),"cheat-code-input":q({"cheat-code-input":!0}),"cheat-name-input":q({"cheat-name-input":!0}),"ejs-switch":q({"ejs-switch":!0}),"ejs-delete-cheat":q({"ejs-delete-cheat":!0})},initShaders:function(){for(let e=Te,t=Object.keys(e),n,a=0;a<t.length;a+=1)n=e[t[a]],g.FS.writeFile("/shader/".concat(t[a]),n),ne.storage.get("shader")===t[a]&&g.FS.writeFile("/shader/shader.glslp",n)},setGamepadDialog:function(){let l=this,n=(l.elements.dialogs.gamepad.innerHTML='\n <div class="'+v.classNames["dialog-container"]+'">\n <div class="'+v.classNames["dialog-title"]+'">\n <h4>'+l.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">'+l.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">'+l.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">'+l.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">'+l.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"]+'">'+l.localization("Update")+'</a>\n <a href="#" onclick="return false" class="'+v.classNames["btn-reset"]+'">'+l.localization("Reset")+'</a>\n <a href="#" onclick="return false" class="'+v.classNames["btn-clear"]+'">'+l.localization("Clear")+'</a>\n <a href="#" onclick="return false" class="'+v.classNames["btn-cancel"]+'">'+l.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">'+l.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">'+l.localization("Gamepad")+'</div>\n <div style="text-align:center;width:50%;float:left">'+l.localization("Keyboard")+'</div>\n </div>\n </div>\n <div style="clear:both"></div>\n </div>\n </div>')),a='\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">'+l.localization("Set")+'</a>\n </div>\n <div style="clear:both"></div>\n </div>'),o;"nes"===l.system?o={0:"B",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",24:l.localization("QUICK SAVE STATE"),25:l.localization("QUICK LOAD STATE"),26:l.localization("CHANGE STATE SLOT")}:"snes"===l.system?o={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:l.localization("QUICK SAVE STATE"),25:l.localization("QUICK LOAD STATE"),26:l.localization("CHANGE STATE SLOT")}:"n64"===l.system?(o={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:l.localization("QUICK SAVE STATE"),25:l.localization("QUICK LOAD STATE"),26:l.localization("CHANGE STATE SLOT")},2===l.coreVer&&(o[0]="A",o[1]="B",delete o[8])):o="nds"===l.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:l.localization("QUICK SAVE STATE"),25:l.localization("QUICK LOAD STATE"),26:l.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:l.localization("QUICK SAVE STATE"),25:l.localization("QUICK LOAD STATE"),26:l.localization("CHANGE STATE SLOT")},["arcade","mame"].includes(l.system)&&(o[2]=l.localization("INSERT COIN")),!1===l.statesSupported&&(delete o[24],delete o[25],delete o[26]);for(let e=[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){l.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["tabs-content"])).innerHTML+=n.replace(/{index}/g,t),e.forEach(function(e){o[e]&&(l.elements.dialogs.gamepad.querySelector("#controls-".concat(t)).innerHTML+=a.replace(/{index}/g,t).replace(/{id}/g,e).replace(/{label}/g,o[e]))}),l.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="'.concat(t,'"][data-type="2"]'))&&(l.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),l.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="'.concat(t,'"][data-type="2"]'))&&(l.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),l.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="'.concat(t,'"][data-type="2"]'))&&(l.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),l.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="'.concat(t,'"][data-type="2"]'))&&(l.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),l.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="'.concat(t,'"][data-type="2"]'))&&(l.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),l.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="'.concat(t,'"][data-type="2"]'))&&(l.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),l.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="'.concat(t,'"][data-type="2"]'))&&(l.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),l.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="'.concat(t,'"][data-type="2"]'))&&(l.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc")}(t);Object.keys(v.controllers).forEach(function(a){v.controllers[a]&&Object.keys(v.controllers[a]).forEach(function(e){let t=l.elements.dialogs.gamepad.querySelector('[data-id="'.concat(e,'"][data-index="').concat(a,'"][data-type="1"]')),n=l.elements.dialogs.gamepad.querySelector('[data-id="'.concat(e,'"][data-index="').concat(a,'"][data-type="2"]'));if(!t||!n)return!1;e=v.controllers[a][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)))})}),F.call(this,l.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["btn-submit"])),"click",function(e){let t=l.elements.dialogs.gamepad.querySelectorAll("input"),o={};return Array.from(t).forEach(function(e){let t,n=e.getAttribute("data-index"),a=e.getAttribute("data-value");2===parseInt(e.getAttribute("data-type"),10)&&(t=e.getAttribute("data-value"));e=e.getAttribute("data-id");o[n]||(o[n]={}),o[n][e]||(o[n][e]={}),a&&(o[n][e].value=a),t&&(o[n][e].value2=t)}),ne.storage.set({controllers:o}),v.controllers=o,U(l.elements.dialogs.gamepad,!0),l.elements.container.focus(),e.stopPropagation(),!1}),F.call(this,l.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["btn-reset"])),"click",function(e){v.controllers=JSON.parse(JSON.stringify(v.defaultControllers)),localStorage.removeItem(ne.storage.key);let t=l.elements.dialogs.gamepad.querySelectorAll("input");for(let e=0;e<t.length;e++){var n=t[e].getAttribute("data-index"),a=t[e].getAttribute("data-type"),o=t[e].getAttribute("data-id"),i=1==a?"value":"value2";v.defaultControllers[n]&&v.defaultControllers[n][o]&&v.defaultControllers[n][o][i]?(t[e].value=1==a?v.keyMap[v.defaultControllers[n][o][i]]:"button "+(parseInt(v.defaultControllers[n][o][i])+1),t[e].setAttribute("data-value",v.defaultControllers[n][o][i])):(t[e].value="",t[e].setAttribute("data-value",""))}}),F.call(this,l.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["btn-clear"])),"click",function(e){let t={0:{},1:{},2:{},3:{}};for(var n in o)t[0][n]={},t[1][n]={},t[2][n]={},t[3][n]={};v.controllers=t,localStorage.setItem(ne.storage.key,JSON.stringify({controllers:v.controllers}));let a=l.elements.dialogs.gamepad.querySelectorAll("input");for(let e=0;e<a.length;e++)a[e].value="",a[e].setAttribute("data-value","")}),F.call(this,l.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["btn-cancel"])),"click",function(e){return U(l.elements.dialogs.gamepad,!0),l.elements.container.focus(),e.stopPropagation(),!1}),Array.from(l.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames.tabs," li"))).forEach(function(n){F.call(l,n,"mousedown",function(e){B(l.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames.tabs," li")),v.classNames.active,!1),B(n,v.classNames.active,!0);var t=n.querySelector("a").getAttribute("aria-controls");return Array.from(l.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames["tabs-content"]," .").concat(v.classNames["tabs-panel"]))).forEach(function(e){U(e,!0)}),U(l.elements.dialogs.gamepad.querySelector(".".concat(v.classNames["tabs-content"]," #").concat(t)),!1),e.stopPropagation(),!1})}),G.call(l,l.elements.dialogs.gamepad.querySelector('[aria-controls="controls-0"]').parentNode,"mousedown");let r=l.elements.dialogs.gamepad.querySelector(".".concat(v.classNames.overlay));F.call(l,r,"mousedown",function(e){U(r,!0),e.stopPropagation()}),Array.from(l.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames["button-container"]))).forEach(function(t){F.call(l,t,"mousedown",function(e){G.call(l,t.querySelector("a.".concat(v.classNames.set)),e.type,!0,{})})}),Array.from(l.elements.dialogs.gamepad.querySelectorAll(".".concat(v.classNames["tabs-panel"]," a.").concat(v.classNames.set))).forEach(function(s){F.call(l,s,"mousedown",function(e){let t=s.parentNode.parentNode,n=t.getAttribute("data-id"),a=t.getAttribute("data-index"),o=t.getAttribute("data-label"),i=(U(r,!1),r.setAttribute("data-id",n),r.setAttribute("data-index",a),"[ ".concat(o," ]"));v.gamepad.gamepads[a]&&n<16?i+='<br /><span style="font-size:12px">Gamepad:'.concat(v.gamepad.gamepads[a].id,"</span><br />"+l.localization("Press keyboard or gamepad")+"<br/>"+l.localization("Press escape (esc) to clear")):i+="<br />Press keyboard<br/>"+l.localization("Press escape (esc) to clear"),r.querySelector(".".concat(v.classNames["key-setting-popup"])).innerHTML=i,e.stopPropagation()})})},setCacheDialog:function(){let 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 "),F.call(this,t.elements.dialogs.cache.querySelector(".".concat(v.classNames["btn-cancel"])),"click",function(e){return U(t.elements.dialogs.cache,!0),t.elements.container.focus(),e.stopPropagation(),!1}),F.call(this,t.elements.dialogs.cache.querySelector(".".concat(v.classNames["dialog-title"]," a")),"click",function(e){return g.romdb&&(g.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){Xe.show("modal-6ed698f3d04061f5",{closeByEsckey:!1}),e&&console.log(""),U(this.elements.dialogs.loading,!1)},hideLoading:function(){Xe.close(),U(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(){let s=this;if(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 ");let o=s.elements.dialogs.cheat.querySelector("#modal-85cd7a1c543a484b"),i=(F.call(this,s.elements.dialogs.cheat.querySelector(".".concat(v.classNames["cheats-add"])),"click",function(e){return Xe.show("modal-85cd7a1c543a484b",{closeTrigger:"data-modal-close"}),!1}),s.elements.dialogs.cheat.querySelector(".".concat(v.classNames["cheats-list"]))),a=(F.call(this,o.querySelector(".".concat(v.classNames["modal__btn-primary"])),"click",function(e){var t=o.querySelector(".".concat(v.classNames["cheat-name-input"])).value,n=o.querySelector(".".concat(v.classNames["cheat-code-input"])).value;if(t&&n){let e=i.querySelectorAll("input:checked");o.querySelector(".".concat(v.classNames["cheat-name-input"])).value="",o.querySelector(".".concat(v.classNames["cheat-code-input"])).value="",Xe.close();var a=s.cheats.length;s.cheats.push([t,n]),i.innerHTML+='<div class="'.concat(v.classNames["ejs-switch"],'">\n <input type="checkbox" value="').concat(a,'" id="ejs-cheat-switch-').concat(a,'">\n <label for="ejs-cheat-switch-').concat(a,'">').concat(t,'</label>\n <a href="#" data-idx="').concat(a,'" onclick="return false" class="').concat(v.classNames["ejs-delete-cheat"],'">×</a>\n </div>'),e.forEach(function(e,t){i.querySelector("#ejs-cheat-switch-".concat(t)).setAttribute("checked","checked")})}return"localStorage"in window&&s.getStartName()&&(localStorage.setItem("".concat(s.system,"-").concat(s.getStartName(),"-cheats"),JSON.stringify(s.cheats)),e.stopPropagation()),!1}),function(){if("localStorage"in window&&s.getStartName()){let e=localStorage.getItem("".concat(s.system,"-").concat(s.getStartName(),"-cheats"));try{e=JSON.parse(e)}catch(e){}e&&(s.cheats=e)}i.innerHTML="",s.cheats&&Array.isArray(s.cheats)&&s.cheats.forEach(function(e,t){var n=e[0];e[1],i.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>')})});F.call(s,i,"click",function(e){if(e.target&&e.target.classList.contains(v.classNames["ejs-delete-cheat"])&&e.target.getAttribute("data-idx")){var t=e.target.getAttribute("data-idx");s.cheats.splice(t,1),"localStorage"in window&&s.getStartName()&&localStorage.setItem("".concat(s.system,"-").concat(s.getStartName(),"-cheats"),JSON.stringify(s.cheats));let n=[];i.querySelectorAll("input").forEach(function(e,t){n[t]=!!i.querySelector("#ejs-cheat-switch-".concat(t,":checked"))}),n.splice(t,1),a(),n.forEach(function(e,t){e&&i.querySelector("#ejs-cheat-switch-".concat(t)).setAttribute("checked","checked")})}return e.stopPropagation(),!1}),F.call(s,s.elements.container,"start-game",function(e){a()}),F.call(this,s.elements.dialogs.cheat.querySelector(".".concat(v.classNames["btn-cancel"])),"click",function(e){return U(s.elements.dialogs.cheat,!0),e.stopPropagation(),s.elements.container.focus(),!1}),F.call(this,s.elements.dialogs.cheat.querySelector(".".concat(v.classNames["btn-submit"])),"click",function(e){return v.resetCheat(),i.querySelectorAll("input:checked").forEach(function(e,t){e=s.cheats[e.value];e&&v.setCheat(t,1,e[1])}),U(s.elements.dialogs.cheat,!0),s.elements.container.focus(),!1}),"arcade"!==s.system&&"mame"!==s.system&&"mame2003"!==s.system&&"mame2010"!==s.system||(D.element(s.elements.buttons.cheat)&&U(s.elements.buttons.cheat,!0),v.allowCheat=!1),v.setCheat||(U(s.elements.buttons.cheat,!0),v.allowCheat=!1)}},initKeyboard:function(){let t=this,o=this,i=this.elements.dialogs.gamepad.querySelector(".".concat(v.classNames.overlay));F.call(this,document.body,"keydown keyup",function(a){if(!(112<=a.which&&a.which<=123)){let e=!t.elements.dialogs.gamepad.hidden&&!i.hidden,n="keydown"===a.type;if(n&&e){let e=i.getAttribute("data-index"),t=i.getAttribute("data-id"),n=null;if(a.key&&"escape"===v.keyMap[a.keyCode])return(n=o.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="1"]'))).setAttribute("data-value",""),n.value=""(n=o.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="2"]'))).setAttribute("data-value",""),n.value="",void U(i,!0);e=i.getAttribute("data-index"),t=i.getAttribute("data-id"),n=null,a.key&&((n=o.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="1"]'))).setAttribute("data-value",a.keyCode),n.value=v.keyMap[a.keyCode]),U(i,!0)}else Object.keys(v.controllers).forEach(function(t){Object.keys(v.controllers[t]).forEach(function(e){parseInt(v.controllers[t][e].value,10)===a.keyCode&&["24","25","26"].includes(e)&&"keydown"==a.type&&!a.repeat&&("24"==e?v.quickSaveState():"25"==e?v.quickLoadState():"26"==e&&v.changeStateSlot()),parseInt(v.controllers[t][e].value,10)===a.keyCode&&(n?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===o.elements.container&&e.preventDefault(),e.srcElement.className.split(/ +/).includes(v.classNames.set)&&e.preventDefault()})},initGamepad:function(){let l=this,o=this,r=this.elements.dialogs.gamepad.querySelector(".".concat(v.classNames.overlay)),n;try{n=new ye}catch(e){return void console.warn("gamepad not supported")}(v.gamepad=n).on("buttondown",function(n){if(l.elements.dialogs.gamepad.hidden||r.hidden)Object.keys(v.controllers[n.gamepadIndex.toString()]).forEach(function(e){var t=n.gamepadIndex.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.gamepadIndex,10)&&v.simulateInput(t,e,1)});else{var t=parseInt(r.getAttribute("data-index"),10),a=r.getAttribute("data-id");if(n.gamepadIndex===parseInt(t,10)){let e=null;(e=o.elements.dialogs.gamepad.querySelector('[data-id="'.concat(a,'"][data-index="').concat(t,'"][data-type="2"]'))).setAttribute("data-value",n.index),e.value="button ".concat(n.index+1),U(r,!0)}}}),n.on("buttonup",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.gamepadIndex,10)&&v.simulateInput(t,e,0)})})}),n.on("axischanged",function(n){var a=.5<(t=n.value)||t<-.5?0<t?1:-1:0;if(l.elements.dialogs.gamepad.hidden||r.hidden){v.prevButtons||(v.prevButtons={});let t=!1;var o=n.gamepadIndex.toString();v.prevButtons[o]||(v.prevButtons[o]={}),v.prevButtons[o][n.axis]||(v.prevButtons[o][n.axis]=0),v.prevButtons[o].buttonID||(v.prevButtons[o].buttonID=0);for(let e=0;e<Object.keys(v.controllers[o]).length;e++){var i=Object.keys(v.controllers[o])[e];v.controllers[o][i].value2&&(v.controllers[o][i].value2.split(":")[0]===n.axis&&parseInt(v.controllers[o][i].value2.split(":")[1])===a&&["24","25","26"].includes(i)&&("24"==i?(t=!0,v.quickSaveState()):"25"==i?(t=!0,v.quickLoadState()):"26"==i&&v.changeStateSlot()),0==a?v.controllers[o][i].value2.split(":")[0]===n.axis&&(v.prevButtons[o][n.axis]=a,v.prevButtons[o].buttonID=i,v.simulateInput(o,i,0)):((1===v.prevButtons[o][n.axis]&&-1==a||-1===v.prevButtons[o][n.axis]&&1==a)&&v.simulateInput(o,v.prevButtons[o].buttonID,0),v.controllers[o][i].value2.split(":")[0]===n.axis&&parseInt(v.controllers[o][i].value2.split(":")[1])===a&&(v.prevButtons[o][n.axis]=a,v.prevButtons[o].buttonID=i,t=!0,v.simulateInput(o,i,1))))}if(t)return;if(!l.elements.dialogs.gamepad.hidden&&!r.hidden)return}else if(0!=a){var t=r.getAttribute("data-id"),s=parseInt(r.getAttribute("data-index"),10);let e=l.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(s,'"][data-type="2"]'));e.setAttribute("data-value",n.axis+":"+a),e.value=n.axis+":"+a,U(r,!0)}Math.abs(n.value)<=.1&&(n.value=0);t=n.gamepadIndex;l.coreVer;"LEFT_STICK_X"===n.axis?0<n.value?(v.simulateInput(t,16,32767*n.value),v.simulateInput(t,17,0)):(v.simulateInput(t,17,-32767*n.value),v.simulateInput(t,16,0)):"LEFT_STICK_Y"===n.axis?0<n.value?(v.simulateInput(t,18,32767*n.value),v.simulateInput(t,19,0)):(v.simulateInput(t,19,-32767*n.value),v.simulateInput(t,18,0)):"RIGHT_STICK_X"===n.axis?0<n.value?(v.simulateInput(t,20,32767*n.value),v.simulateInput(t,21,0)):(v.simulateInput(t,21,-32767*n.value),v.simulateInput(t,20,0)):"RIGHT_STICK_Y"===n.axis&&(0<n.value?(v.simulateInput(t,22,32767*n.value),v.simulateInput(t,23,0)):(v.simulateInput(t,23,32767*n.value),v.simulateInput(t,22,0)))}),n.on("disconnected",function(e){[0,1,2,3].forEach(function(e){var t=n.gamepads[e];o.elements.dialogs.gamepad.querySelector("#controls-".concat(e," .gamepad-name")).innerHTML=t?t.id:"n/a"})}),n.on("connected",function(e){Object.keys(n.gamepads).forEach(function(e){var t=n.gamepads[e];o.elements.dialogs.gamepad.querySelector("#controls-".concat(e," .gamepad-name")).innerHTML=t?t.id:"n/a"})})},setShader:function(e){try{"disabled"===e?(g.FS.unlink("/shader/shader.glslp",""),v.toggleShader&&v.toggleShader(0)):(v.toggleShader&&v.toggleShader(0),e="/shader/".concat(e),g.FS.writeFile("/shader/shader.glslp",g.FS.readFile(e)),v.toggleShader&&v.toggleShader(1))}catch{}},toggleVirtualGamepad:function(r){let c=this;if(null!==v.virtualGamepadContainer)U(v.virtualGamepadContainer,!r);else{v.virtualGamepadContainer=V("div",{class:q({"ejs-virtual-gamepad":!0}),hidden:""}),this.elements.container.appendChild(v.virtualGamepadContainer);var d="height:31px;text-align:center;border:1px solid #ccc;border-radius:5px;line-height:31px;";let a="",o;c.config.VirtualGamepadSettings&&function(t){if(Array.isArray(t)){if(t.length){for(let e=0;e<t.length;e++)if("zone"!==t[e].type){if(!t[e].location)return void console.warn("Missing location value for button "+t[e].text+"! Using default gamepad settings");if(!t[e].type)return void console.warn("Missing type value for button "+t[e].text+"! Using default gamepad settings");if(!t[e].id.toString())return void console.warn("Missing id value for button "+t[e].text+"! Using default gamepad settings");if(!t[e].input_value.toString())return void console.warn("Missing input_value for button "+t[e].text+"! Using default gamepad settings")}return 1}console.warn("Vritual gamepad settings is empty! Using default gamepad settings")}else console.warn("Vritual gamepad settings is not array! Using default gamepad settings")}(c.config.VirtualGamepadSettings)?o=c.config.VirtualGamepadSettings:["gba","gb","vb","nes"].includes(c.system)?(o=[{type:"button",text:"B",id:"b",location:"right",left:-10,top:70,input_value:0},{type:"button",text:"A",id:"a",location:"right",left:60,top:70,input_value:8},{type:"zone",location:"left",left:"50%",top:"50%"},{type:"button",text:"Start",id:"start",location:"center",left:60,input_value:3},{type:"button",text:"Select",id:"select",location:"center",left:-5,input_value:2}],"gba"===c.system&&(o.push({type:"button",text:"L",id:"l",block:!0,location:"top",left:10,top:-40,input_value:10}),o.push({type:"button",text:"R",id:"r",block:!0,location:"top",right:10,top:-40,input_value:11}))):o="n64"===c.system?[{type:"button",text:"B",id:"b",location:"right",left:-10,top:95,input_value:0,input_new_cores:1},{type:"button",text:"A",id:"a",location:"right",left:40,top:150,input_value:8,input_new_cores:0},{type:"zone",location:"left",left:"50%",top:"50%"},{type:"button",text:"Start",id:"start",location:"center",left:30,top:-10,input_value:3},{type:"button",text:"L",id:"l",block:!0,location:"top",left:10,top:-40,input_value:10},{type:"button",text:"R",id:"r",block:!0,location:"top",right:10,top:-40,input_value:11},{type:"button",text:"Z",id:"z",block:!0,location:"top",left:10,input_value:12},{type:"button",text:"",id:"cu",location:"right",left:25,top:-65,input_value:23},{type:"button",text:"",id:"cd",location:"right",left:25,top:15,input_value:22},{type:"button",text:"",id:"cl",location:"right",left:-15,top:-25,input_value:21},{type:"button",text:"",id:"cr",location:"right",left:65,top:-25,input_value:20}]:["snes","nds"].includes(c.system)?[{type:"button",text:"X",id:"x",location:"right",left:40,input_value:9},{type:"button",text:"Y",id:"y",location:"right",top:40,input_value:1},{type:"button",text:"A",id:"a",location:"right",left:81,top:40,input_value:8},{type:"button",text:"B",id:"b",location:"right",left:40,top:80,input_value:0},{type:"zone",location:"left",left:"50%",top:"50%"},{type:"button",text:"Start",id:"start",location:"center",left:60,input_value:3},{type:"button",text:"Select",id:"select",location:"center",left:-5,input_value:2}]:[{type:"button",text:"Y",id:"y",location:"right",left:40,input_value:9},{type:"button",text:"X",id:"X",location:"right",top:40,input_value:1},{type:"button",text:"B",id:"b",location:"right",left:81,top:40,input_value:8},{type:"button",text:"A",id:"a",location:"right",left:40,top:80,input_value:0},{type:"zone",location:"left",left:"50%",top:"50%"},{type:"button",text:"Start",id:"start",location:"center",left:60,input_value:3},{type:"button",text:"Select",id:"select",location:"center",left:-5,input_value:2}],a=(a+='<div class="'+q({"virtual-gamepad":!0})+'" style="display: block;">')+('<div class="'+q({top:!0})+'">');for(let n=0;n<o.length;n++)if("top"===o[n].location&&"button"===o[n].type){let e={buttons:!0},t=(e["b_"+o[n].id.toLowerCase()]=!0,"");o[n].left&&(t+="left:"+o[n].left+"px;"),o[n].right&&(t+="right:"+o[n].right+"px;"),o[n].top&&(t+="top:"+o[n].top+"px;"),o[n].block&&(t+=d),a+='<div class="'+q(e)+'" style="'+t+'">'+o[n].text+"</div>"}a=(a+="</div>")+('<div class="'+q({left:!0})+'">');for(let n=0;n<o.length;n++)if("left"===o[n].location&&"button"===o[n].type){let e={buttons:!0},t=(e["b_"+o[n].id.toLowerCase()]=!0,"");o[n].left&&(t+="left:"+o[n].left+"px;"),o[n].right&&(t+="right:"+o[n].right+"px;"),o[n].top&&(t+="top:"+o[n].top+"px;"),o[n].block&&(t+=d),a+='<div class="'+q(e)+'" style="'+t+'">'+o[n].text+"</div>"}a=(a+="</div>")+('<div class="'+q({center:!0})+'">');for(let n=0;n<o.length;n++)if("center"===o[n].location&&"button"===o[n].type){let e={buttons:!0},t=(e["b_"+o[n].id.toLowerCase()]=!0,"");o[n].left&&(t+="left:"+o[n].left+"px;"),o[n].right&&(t+="right:"+o[n].right+"px;"),o[n].top&&(t+="top:"+o[n].top+"px;"),o[n].block&&(t+=d),a+='<div class="'+q(e)+'" style="'+t+'">'+o[n].text+"</div>"}a=(a+="</div>")+('<div class="'+q({right:!0})+'">');for(let n=0;n<o.length;n++)if("right"===o[n].location&&"button"===o[n].type){let e={buttons:!0},t=(e["b_"+o[n].id.toLowerCase()]=!0,"");o[n].left&&(t+="left:"+o[n].left+"px;"),o[n].right&&(t+="right:"+o[n].right+"px;"),o[n].top&&(t+="top:"+o[n].top+"px;"),o[n].block&&(t+=d),a+='<div class="'+q(e)+'" style="'+t+'">'+o[n].text+"</div>"}a+="</div></div>",v.virtualGamepadContainer.innerHTML=a,U(v.virtualGamepadContainer,!r);let n=q({"virtual-gamepad":!0}),i=q({touch:!0});X.isIos||F.call(this,H.call(this,".".concat(n)),"touchmove",function(e){e.stopPropagation()});let s;for(let e=0;e<o.length;e++)if("zone"===o[e].type){s=o[e];break}if(s){let e={},t=(e[s.location.toLowerCase()]=!0,be.a.create({zone:H.call(this,".".concat(q({"ejs-virtual-gamepad":!0})," .").concat(q(e))),mode:"static",position:{left:s.left,top:s.top},color:"red"}));function u(){if("n64"!==c.system)return{downVal:1,4:4,5:5,6:6,7:7};{let e;return"d-pad"===(e=ne&&"function"==typeof ne.getCoreOptionsValues?ne.getCoreOptionsValues()["joystick-input"]:e)?{downVal:1,4:4,5:5,6:6,7:7}:{downVal:32767,4:19,5:18,6:17,7:16}}}t.on("end",function(e,t){v.syncInput(0,u()[4],0),v.syncInput(0,u()[5],0),v.syncInput(0,u()[6],0),v.syncInput(0,u()[7],0)}),t.on("move",function(e,t){t=t.angle.degree;30<=t&&t<150?v.syncInput(0,u()[4],u().downVal):window.setTimeout(function(){v.syncInput(0,u()[4],0)},30),210<=t&&t<330?v.syncInput(0,u()[5],u().downVal):window.setTimeout(function(){v.syncInput(0,u()[5],0)},30),120<=t&&t<240?v.syncInput(0,u()[6],u().downVal):window.setTimeout(function(){v.syncInput(0,u()[6],0)},30),300<=t||0<=t&&t<60?v.syncInput(0,u()[7],u().downVal):window.setTimeout(function(){v.syncInput(0,u()[7],0)},30)})}let l=[];for(let n=0;n<o.length;n++)if("zone"!==o[n].type){let e={};e["b_"+o[n].id.toLowerCase()]=!0;let t;t=2===c.newCores&&o[n].input_new_cores?o[n].input_new_cores:o[n].input_value,l.push({id:e,number:t})}l.forEach(t=>{var e=H.call(c,".".concat(n," .").concat(q(t.id)));e&&F.call(c,e,"touchstart touchend",function(e){"touchend"===e.type?(B(e.target,i,!1),window.setTimeout(function(){v.syncInput(0,t.number,0)},30)):(B(e.target,i,!0),v.syncInput(0,t.number,1)),e.stopPropagation()})});let e=V("div",{class:q({ejs__widget:!0,ejs__widget_controls_toggle:!0})},"");e.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>',H.call(this,".".concat(q({ejs__widgets:!0}))).appendChild(e);let t;F.call(this,e,"mousedown touchstart",function(e){B(e.target,i,!0),clearTimeout(t),J.toggleControls.call(c,!0),t=setTimeout(function(){J.toggleControls.call(c,!1)},5e3)})}},setup:function(){let a=this;if(this.game){var e;if(v.playerName=a.config.playerName,B(this.elements.container,this.config.classNames.type,!0),this.elements.container.setAttribute("tabindex","0"),!this.color||(e=function(e){let n=e.toLowerCase();if(n&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(n)){if(4===n.length){for(let e="#",t=1;t<4;t+=1)e+=n.slice(t,t+1).concat(n.slice(t,t+1));n=s}for(let e=[],t=1;t<7;t+=2)e.push(parseInt("0x".concat(n.slice(t,t+2)),16));return _0x5ac4ff}return null}(this.color))&&this.elements.container.setAttribute("style","--ejs-primary-color: ".concat(e[0],", ").concat(e[1],", ").concat(e[2])),this.elements.wrapper=V("div",{class:this.config.classNames.video}),R(this.game,this.elements.wrapper),"video"!==a.game.tagName.toLocaleLowerCase()){let t=this.config.volume,n=(Object.defineProperty(a.game,"volume",{get:function(){return t},set:function(e){t=e,G.call(a,a.game,"volumechange")}}),a.storage.get("muted"));Object.defineProperty(a.game,"muted",{get:function(){return n},set:function(e){e=!!D.boolean(e)&&e;n=e,G.call(a,a.game,"volumechange")}})}window.saveSaveFiles=function(){a.getStartName()&&(console.log("saving save files"),v.saveSavFiles(),g.FS.syncfs(!1,function(){}))}}else console.warn("No game element found!")},listeners:function(){let i=this;i.elements.buttons.restart&&F.call(i,i.elements.buttons.restart,"click",function(e){v.restartGame(),v.inputsData={},saveSaveFiles()}),i.elements.buttons.screenRecord&&F.call(i,i.elements.buttons.screenRecord,"click",function(e){if(i.recordData||(i.recordData={started:!1,data:[],stopped:!1}),i.recordData.started)i.recordData.started&&(i.recordData.recorder.stop(),i.recordData.stopped=!0);else{let n;n=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"}:{},g.Module.pauseMainLoop(),i.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');let a=g.Module.canvas.captureStream(30),o=setTimeout(function(){i.playing=!0,g.Module.resumeMainLoop()},2e4);navigator.mediaDevices.getDisplayMedia({audio:!0,video:{mediaSource:"screen"}}).then(function(e){try{clearTimeout(o)}catch(e){}var t=e.getAudioTracks();for(let e=0;e<t.length;e++)a.addTrack(t[e]);e=a,i.elements.buttons.screenRecord.querySelector(".".concat(q({ejs__tooltip:!0}))).innerHTML=i.localization("Stop Screen Recording"),i.recordData.stream=e,i.recordData.recorder=new MediaRecorder(i.recordData.stream,n),i.recordData.recorder.ondataavailable=function(e){if(0<e.data.size&&i.recordData.data.push(e.data),i.recordData.stopped){let e=document.createElement("a");e.href=window.URL.createObjectURL(new Blob(i.recordData.data,{type:"video/webm"}));let t;"string"==typeof i.gameName&&(t=i.gameName),e.download=t?"".concat(t,"-recording.webm"):"record.webm",e.click(),window.URL.revokeObjectURL(e.href),delete i.recordData,i.elements.buttons.screenRecord.querySelector(".".concat(q({ejs__tooltip:!0}))).innerHTML=i.localization("Start Screen Recording")}},i.recordData.recorder.start(),i.recordData.started=!0,i.playing=!0,g.Module.resumeMainLoop()})}}),i.elements.buttons.play&&Array.from(i.elements.buttons.play).forEach(function(e){F.call(i,e,"click",function(e){i.playing?(i.playing=!1,g.Module.pauseMainLoop(),G.call(i,i.elements.container,"pause",!1,{pause:!0})):(i.playing=!0,g.Module.resumeMainLoop(),G.call(i,i.elements.container,"pause",!1,{pause:!1}))})}),i.elements.buttons.cheat&&F.call(i,i.elements.buttons.cheat,"click",function(e){U(i.elements.dialogs.cheat,!1)}),i.game.stateloadField=V("input"),i.game.stateloadField.type="file",i.game.stateloadField.onchange=function e(t){let n,a=t.target.files;0<a.length&&((n=new FileReader).file_name=a[0].name,n.onload=function(){EJS_loadState(new Uint8Array(n.result))},n.readAsArrayBuffer(a[0])),i.game.stateloadField=V("input"),i.game.stateloadField.type="file",i.game.stateloadField.onchange=e},F.call(i,i.elements.container,"loadstate",function(e){v.saveLoadDB.call(i,"load")||(D.function(i.config.onloadstate)?i.config.onloadstate.call(null,i.loadState):i.game.stateloadField.click(),i.elements.container.focus())}),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState?console.log("hidden"):console.log("active")})},bindFunction:function(){let i=this,a=i.system;if(g.Module&&g.Module._set_volume){let t=g.Module.cwrap("set_volume","null",["number"]);v.setVolume=function(){let e=0;i.volume<1&&(e=0===i.volume?-80:30*i.volume-30,t(e)),i.muted&&(e=-80),t(e)}}v.setVariable=g.Module.cwrap("set_variable","null",["string","string"]),v.simulateInputFn=g.Module.cwrap("simulate_input","null",["number","number","number"]),v.simulateInput=function(e,t,n){v.simulateInputFn(e,t,n)},v.syncInput=v.simulateInput,window.simulateInput=v.simulateInput;let t=g.Module.cwrap("shader_enable","null",["number"]),o=(v.toggleShader=function(e){return t(e)},2!==i.coreVer?v.getStateInfo=g.Module.cwrap("get_state_info","string",[]):(v.getInfoOfState=g.Module.cwrap("get_state_info","string",[]),v.getStateInfo1=g.Module.cwrap("save_state_info","null",[]),v.getStateInfo=function(){return v.getStateInfo1(),new Promise(function(t,e){let n=v.getInfoOfState();if(n)t(n);else{let e=setInterval(function(){(n=v.getInfoOfState())&&(clearInterval(e),t(n))},50)}})}),v.saveState=async function(){let n,a;var o=(a=(2!==i.coreVer?v.getStateInfo():await v.getStateInfo()).split("|"))[0]>>0;if(0<o){n=new Uint8Array(o);for(let e=a[1]>>0,t=0;t<o;t++)n[t]=g.Module.getValue(e+t)}return n},g.Module.cwrap("load_state","number",["string","number"])),e=(v.loadState=function(e,t){try{g.FS.unlink("game.state")}catch(e){}g.FS.createDataFile("/","game.state",e,!0,!0),null===t&&(t=0),"arcade"===a?setTimeout(function(){v.getStateInfo(),o("game.state",t),g.FS.unlink("game.state")},10):(o("game.state",t),setTimeout(function(){g.FS.unlink("game.state")},100)),i.elements.container.focus()},g.Module._set_cheat&&(v.setCheat=g.Module.cwrap("set_cheat","number",["number","number","string"])),g.Module._reset_cheat&&(v.resetCheat=g.Module._reset_cheat),v.quickSaveState=async function(){if(i.started){if(!1===i.statesSupported)return i.elements.widgets.stateInfoDiv.innerHTML="CANNOT CURRENTLY SAVE STATE",clearTimeout(v.saveMsgTransitions),void(v.saveMsgTransitions=setTimeout(function(){i.elements.widgets.stateInfoDiv.innerHTML=""},1500));let t;var e=(t=ne&&"function"==typeof ne.getCoreOptionsValues&&(t=ne.getCoreOptionsValues()["save-state-slot"])||1)+"-quick.state";try{g.FS.unlink(e)}catch(e){}try{var n=await v.saveState();g.FS.createDataFile("/",e,n,!0,!0),i.elements.widgets.stateInfoDiv.innerHTML="STATE SAVED TO SLOT "+t,clearTimeout(v.saveMsgTransitions),v.saveMsgTransitions=setTimeout(function(){i.elements.widgets.stateInfoDiv.innerHTML=""},1500)}catch(e){console.warn(e),i.elements.widgets.stateInfoDiv.innerHTML="FAILED TO SAVE STATE TO SLOT "+t,clearTimeout(v.saveMsgTransitions),v.saveMsgTransitions=setTimeout(function(){i.elements.widgets.stateInfoDiv.innerHTML=""},1500)}saveSaveFiles()}},v.saveMsgTransitions=null,v.quickLoadState=function(){if(i.started){if(!1===i.statesSupported)return i.elements.widgets.stateInfoDiv.innerHTML="CANNOT CURRENTLY LOAD STATE",clearTimeout(v.saveMsgTransitions),void(v.saveMsgTransitions=setTimeout(function(){i.elements.widgets.stateInfoDiv.innerHTML=""},1500));let e,t=(e=ne&&"function"==typeof ne.getCoreOptionsValues&&(e=ne.getCoreOptionsValues()["save-state-slot"])||1)+"-quick.state",n=!0;try{o(t,0),"arcade"===a&&setTimeout(function(){v.getStateInfo(),o(t,0)},10)}catch(e){n=!1}n?i.elements.widgets.stateInfoDiv.innerHTML="LOADED STATE FROM SLOT "+e:i.elements.widgets.stateInfoDiv.innerHTML="FAILED TO LOAD STATE FROM SLOT "+e,clearTimeout(v.saveMsgTransitions),v.saveMsgTransitions=setTimeout(function(){i.elements.widgets.stateInfoDiv.innerHTML=""},1500),saveSaveFiles()}},v.changeStateSlot=function(e){ne&&"function"==typeof ne.getCoreOptionsValues&&ne.getCoreOptionsValues()["save-state-slot"];let t;9<(t="number"!=typeof e?slot+1:e)&&(t=1),te.updateCoreOptions.call(i,"save-state-slot",t),i.elements.widgets.stateInfoDiv.innerHTML="SET SAVE STATE SLOT TO "+t,clearTimeout(v.saveMsgTransitions),v.saveMsgTransitions=setTimeout(function(){i.elements.widgets.stateInfoDiv.innerHTML=""},1500)},window.EJS_loadState=function(e){v.loadState(e,0)},g.Module.cwrap("cmd_take_screenshot","",[]));v.getScreenData=function(){return e(),g.FS.readFile("screenshot.png")},v.restartGame=g.Module.cwrap("system_restart","",[]),v.saveSavFiles=g.Module.cwrap("cmd_savefiles","",[]),g.Module._get_core_options&&(v.getGameCoreOptions=g.Module.cwrap("get_core_options","string",[])),v.controllers=ne.storage.get("controllers"),v.controllers||(v.controllers=JSON.parse(JSON.stringify(v.defaultControllers)))}};let ee=v;var e,u,te={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(){let 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(){let e=te.storage.get("core-options");return e=D.empty(e)?{}:e},getCoreOptions:function(){let o={};switch(this.system){case"nes":o.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"},o.fceumm_nospritelimit={label:this.localization("No Sprite Limit"),options:{enabled:this.localization("Enabled"),disabled:this.localization("Disabled")},default:"disabled"},o.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||(o.system_type={label:this.localization("4 Players Support"),options:{nes:"NES",famicom:"Famicom"},default:"nes",netplay:!0}),o.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},o.fceumm_region={label:this.localization("Region"),options:{Auto:this.localization("Auto"),NTSC:"NTSC",PAL:"PAL",Dendy:"Dendy"},default:"Auto",netplay:!0};break;case"snes":o={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":o={};break;case"gb":o={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":o={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":o={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":o={"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||(o["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":o={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"}},Y.wasm||delete o.screen_rotation;break;case"vb":case"pce":o={};break;case"segaMS":case"segaGG":case"segaMD":case"segaCD":o={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":o={picodrive_sprlim:{label:this.localization("No sprite limit"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled"}};break;case"segaSaturn":o={yabause_frameskip:{label:this.localization("Frameskip"),options:{disabled:this.localization("disabled"),enabled:this.localization("enabled")},default:"disabled"}};break;case"msx":o={bluemsx_nospritelimits:{label:this.localization("No Sprite Limit"),options:{OFF:this.localization("OFF"),ON:this.localization("ON")},default:"OFF"}};break;case"ws":case"ngp":o={};break;case"jaguar":o={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":o={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":o={"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;default:o={}}2===this.coreVer&&((o={}).fps={label:this.localization("FPS"),options:["show","hide"],default:"hide"}),!0===this.statesSupported&&(o["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&&this.getStartName()&&(o["save-state-location"]={label:this.localization("Save State Location"),options:{download:this.localization("download"),"keep in browser":this.localization("keep in browser")},default:"download"});let i=this;return ee.getGameCoreOptions&&ee.getGameCoreOptions().split("\n").forEach(function(e,t){let n=e.split("; "),a=n[0];if(0===a.indexOf("fba-dipswitch-")||2===i.coreVer){if(!n[1])return;let e=n[1].split("|"),t=a.split("|")[0].replace(/_/g," ").replace(/.+\-(.+)/,"$1");e.slice(1,-1),1!==e.length&&(o[a.split("|")[0]]={label:t,options:e,default:1<a.split("|").length?a.split("|")[1]:e[0].replace("(Default) ",""),netplay:!0})}}),o},findElements:function(){try{return this.elements.controls=H.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:c.call(this,this.config.selectors.buttons.play),pause:H.call(this,this.config.selectors.buttons.pause),restart:H.call(this,this.config.selectors.buttons.restart),mute:H.call(this,this.config.selectors.buttons.mute),settings:H.call(this,this.config.selectors.buttons.settings),fullscreen:H.call(this,this.config.selectors.buttons.fullscreen),saveState:H.call(this,this.config.selectors.buttons.saveState),screenRecord:H.call(this,this.config.selectors.buttons.screenRecord),loadState:H.call(this,this.config.selectors.buttons.loadState),gamepad:H.call(this,this.config.selectors.buttons.gamepad),cheat:H.call(this,this.config.selectors.buttons.cheat)},this.elements.inputs={volume:H.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){let n=document.createElementNS("http://www.w3.org/2000/svg","svg"),a=(N(n,W(t,{role:"presentation",focusable:"false"})),document.createElement("div"));a.innerHTML="<svg>".concat(this.icons[e],"</svg>");for(let e=a.childNodes[0].childNodes,t=0;t<e.length;t+=1)n.appendChild(e[t]);return n},createLabel:function(e){let t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=pe.get(e,this.config),a={};return a[t.class]=!0,a[this.config.classNames.hidden]=!0,V("span",Object.assign({},t,{class:[t.class,this.config.classNames.tooltip].filter(Boolean).join(" ")}),n)},createBadge:function(e){if(D.empty(e))return null;let t=V("span",{class:this.config.classNames.menu.value});return t.appendChild(V("span",{class:this.config.classNames.menu.badge},e)),t},createButton:function(e,t){let n,a,o,i,s=V("button"),l=Object.assign({},t),r=function(e){let t=(0<arguments.length&&void 0!==e?e:"").toString();return(t=function(e){e=fe((0<arguments.length&&void 0!==e?e:"").toString(),"-"," ");return e=fe(e,"_"," "),fe(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)," ","")}(t)).charAt(0).toLowerCase()+t.slice(1)}(e),c=!1;"type"in l||(l.type="button");t=q({ejs__control:!0});switch("class"in l?l.class.includes(t)||(l.class+=" ".concat(t)):l.class=t,e){case"play":c=!0,n="play",o="pause",a="play",i="pause";break;case"mute":c=!0,n="mute",o="unmute",a="volume",i="muted";break;case"fullscreen":c=!0,n="enterFullscreen",o="exitFullscreen",a="enter-fullscreen",i="exit-fullscreen";break;default:n=r,a=e}return c?(s.appendChild(te.createIcon.call(this,i,{class:q({"icon--pressed":!0})})),s.appendChild(te.createIcon.call(this,a,{class:q({"icon--not-pressed":!0})})),s.appendChild(te.createLabel.call(this,o,{class:q({"icon--pressed":!0})})),s.appendChild(te.createLabel.call(this,n,{class:q({"icon--not-pressed":!0})}))):(s.appendChild(te.createIcon.call(this,a)),s.appendChild(te.createLabel.call(this,n))),W(l,h(this.config.selectors.buttons[r],l)),N(s,l),"play"===r?(D.array(this.elements.buttons[r])||(this.elements.buttons[r]=[]),this.elements.buttons[r].push(s)):this.elements.buttons[r]=s,s},createRange:function(e,t){t=V("input",W(h(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.1,value:0,autocomplete:"off",role:"slider","aria-label":pe.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},t));return this.elements.inputs[e]=t,te.updateRangeFill.call(this,t),t},bindMenuItemShortcuts:function(a,o){let i=this;F(a,"keydown keyup",function(n){if([32,38,39,40].includes(n.which)&&(n.preventDefault(),n.stopPropagation(),"keydown"!==n.type)){let e,t=L(a,'[role="menuitemradio"]');!t&&[32,39].includes(n.which)?te.showMenuPanel.call(i,o,!0):32!==n.which&&(40===n.which||t&&39===n.which?(e=a.nextElementSibling,D.element(e)||(e=a.parentNode.firstElementChild)):(e=a.previousElementSibling,D.element(e)||(e=a.parentNode.lastElementChild)),oe.call(i,e,!0))}},!1),F(a,"keyup",function(e){13===e.which&&te.focusFirstMenuItem.call(i,null,!0)})},createMenuItem:function(e){let t=this,n=e.value,a=e.list,o=e.type,i=e.title,s=e.badge,l=void 0===s?null:s,r=e.checked,c=void 0!==r&&r,d=h(this.config.selectors.inputs[o]),u=V("button",W(d,{type:"button",role:"menuitemradio",class:"".concat(this.config.classNames.control," ").concat(d.class||"").trim(),"aria-checked":c,value:n})),f=V("span"),p=(f.innerHTML=i,D.element(l)&&f.appendChild(l),u.appendChild(f),Object.defineProperty(u,"checked",{enumerable:!0,get:function(){return"true"===u.getAttribute("aria-checked")},set:function(e){e&&Array.from(u.parentNode.children).filter(function(e){return L(e,'[role="menuitemradio"]')}).forEach(function(e){return e.setAttribute("aria-checked","false")}),u.setAttribute("aria-checked",e?"true":"false")}}),te.getCoreOptions.call(this));this.listeners.bind(u,"click keyup",function(e){D.keyboardEvent(e)&&32!==e.which||(e.preventDefault(),e.stopPropagation(),u.checked=!0,Object.keys(te.normalOptions).includes(o)&&te.updateNormalOptions.call(t,o,n),Object.keys(p).includes(o)&&te.updateCoreOptions.call(t,o,n)),te.showMenuPanel.call(t,"home",D.keyboardEvent(e))},o,!1),te.bindMenuItemShortcuts.call(this,u,o),a.appendChild(u)},updateVolume:function(){D.element(this.elements.inputs.volume)&&te.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),D.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;D.element(e)&&(e.value=t,te.updateRangeFill.call(this,e))},updateRangeFill:function(e){let t=D.event(e)?e.target:e;if(D.element(t)&&"range"===t.getAttribute("type")){if(L(t,this.config.selectors.inputs.volume)){let e=100*t.value;t.setAttribute("aria-valuenow",e),t.setAttribute("aria-valuetext","".concat(e.toFixed(1),"%"))}else t.setAttribute("aria-valuenow",t.value);X.isWebkit&&t.style.setProperty("--value","".concat(t.value/t.max*100,"%"))}},toggleMenuButton:function(e,t){U(this.elements.settings.buttons[e],!t)},updateNormalOptions:function(e,t){this.elements.settings.buttons[e].querySelector(".".concat(this.config.classNames.menu.value)).innerHTML=te.normalOptions[e].options[t];let n={};n[e]=t,te.storage.set(n),"shader"===e&&ee.setShader(t),"virtual-gamepad"===e&&ee.toggleVirtualGamepad.call(this,"enabled"===t)},updateCoreOptions:function(t,n){if("nds"==this.system&&!Y.wasm)return!0;if(te.coreOptionsValues[t]=n,"psx"===this.system&&g.Module.pauseMainLoop(),ee.setVariable(t,n),"psx"===this.system&&(setTimeout(function(){g.Module.resumeMainLoop()},100),setTimeout(function(){g.Module.resumeMainLoop()},200)),"nds"===this.system&&Y.wasm){let e=this.elements.wrapper.querySelector("canvas");if("screen_rotation"===t)switch(e.style.transform="rotate("+n+"deg)",n){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")}}if("arcade"===this.system||"fba0.2.97.29"===this.system){let e=this.elements.wrapper.querySelector("canvas");e.height="fba-aspect"===t&&"PAR"===n?e.width/16*9:e.width/4*3}let a=te.getCoreOptions.call(this),e=te.storage.get("core-options");if((e=D.empty(e)?{}:e)[t]=n,te.storage.set({"core-options":e}),this.elements.settings.buttons[t]){let e=this.elements.settings.buttons[t].querySelector(".".concat(this.config.classNames.menu.value));D.object(a[t].options)?e.innerHTML=a[t].options[n]:e.innerHTML=n}},setOptionMenuItem:function(d,u){let f=this,p=this.elements.settings.panels.home.querySelector('[role="menu"]'),m=this.elements.settings.popup.children[0];Object.keys(d).forEach(function(t){let n=t,e=V("button",W(h(f.config.selectors.buttons.settings),{type:"button",class:q({ejs__control:!0,"ejs__control--forward":!0}),role:"menuitem",item:t,"aria-haspopup":!0}));F(e,"click",function(){te.showMenuPanel.call(f,n,!1)});let a,o=V("span",null,d[t].label),i=V("span",{class:f.config.classNames.menu.value}),s=(D.object(u)&&(a=u[n]),D.empty(a)&&(a=d[n].default),D.object(d[n].options)?i.innerHTML=d[n].options[a]:i.innerHTML=a,o.appendChild(i),e.appendChild(o),p.appendChild(e),V("div",{"data-pane":escape(n),hidden:""})),l=V("button",{type:"button",class:q({ejs__control:!0,"ejs__control--back":!0})}),r=(l.appendChild(V("span",{"aria-hidden":!0},d[t].label)),l.appendChild(V("span",{class:q({"ejs__sr-only":!0})},pe.get("menuBack",f.config))),F(s,"keydown",function(e){37===e.which&&(e.preventDefault(),e.stopPropagation(),te.showMenuPanel.call(f,"home",!0))},!1),F(l,"click",function(){te.showMenuPanel.call(f,"home",!1)}),s.appendChild(l),s.appendChild(V("div",{role:"menu"})),m.appendChild(s),f.elements.settings.buttons[n]=e,(f.elements.settings.panels[n]=s).querySelector('[role="menu"]'));var c=r;if(D.element(c))for(let e=c.childNodes.length;0<e;)c.removeChild(c.lastChild),--e;D.object(d[t].options)?Object.keys(d[t].options).forEach(function(e){te.createMenuItem.call(f,{value:e,list:r,type:n,title:d[t].options[e],badge:null,checked:Boolean(a===e)})}):D.array(d[t].options)&&d[t].options.forEach(function(e){te.createMenuItem.call(f,{value:e,list:r,type:n,title:e,badge:null,checked:Boolean(a===e)})})})},setNormalOptionsMenu:function(){let t=this,i=this,e={};e.orientation=te.storage.get("orientation"),e.shader=te.storage.get("shader"),i.touch?(e["virtual-gamepad"]=te.storage.get("virtual-gamepad"),F.call(i,i.elements.container,"start-game",function(){"enabled"!==e["virtual-gamepad"]&&!D.empty(e["virtual-gamepad"])||ee.toggleVirtualGamepad.call(i,!0)})):delete te.normalOptions["virtual-gamepad"],te.setOptionMenuItem.call(this,te.normalOptions,e),F.call(i,i.elements.container,"start-game",function(){var e=te.storage.get("shader");"disabled"!==e&&ee.setShader(e);let n=t,o={};ee.getGameCoreOptions&&ee.getGameCoreOptions().split("\n").forEach(function(e,t){let n=e.split("; "),a=n[0];if(0===a.indexOf("fba-dipswitch-")||2===i.coreVer){if(!n[1])return;let e=n[1].split("|"),t=a.split("|")[0].replace(/_/g," ").replace(/.+\-(.+)/,"$1");e.slice(1,-1),1!==e.length&&(o[a.split("|")[0]]={label:t,options:e,default:1<a.split("|").length?a.split("|")[1]:e[0].replace("(Default) ",""),netplay:!0})}});e=te.storage.get("core-options");te.coreOptionsValues=e||{},te.setOptionMenuItem.call(i,o,te.coreOptionsValues),Object.keys(te.coreOptionsValues).forEach(function(e,t){te.updateCoreOptions.call(n,e,te.coreOptionsValues[e])}),"nds"==i.system&&(g.Module._fast_forward_2?g.Module._fast_forward_2(1):g.Module._fast_forward&&g.Module._fast_forward(1))})},updateCoreOptionMenuItems:function(){let t=this.elements.settings.panels.home.querySelector('[role="menu"]'),e=te.getCoreOptions.call(this);Object.keys(e).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=te.getCoreOptions.call(this),t=te.storage.get("core-options");te.coreOptionsValues=t||{},te.setOptionMenuItem.call(this,e,t)},checkMenu:function(){var e=this.elements.settings.buttons;D.empty(e)||Object.values(e).some(function(e){return!e.hidden}),U(this.elements.settings.menu,!1)},focusFirstMenuItem:function(t){var n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(!this.elements.settings.popup.hidden){let e=t;t=(e=D.element(e)?e:Object.values(this.elements.settings.panels).find(function(e){return!e.hidden})).querySelector('[role^="menuitem"]');oe.call(this,t,n)}},toggleMenu:function(n){let a=this.elements.settings.popup,o=this.elements.buttons.settings;if(D.element(a)&&D.element(o)){let e=a.hidden,t=e;if(D.boolean(n))t=n;else if(D.keyboardEvent(n)&&27===n.which)t=!1;else if(D.event(n)){var i=a.contains(n.target);if(i||!i&&n.target!==o&&t)return}o.setAttribute("aria-expanded",t),U(a,!t),B(this.elements.container,this.config.classNames.menu.open,t),t&&D.keyboardEvent(n)?te.focusFirstMenuItem.call(this,null,!0):t||e||oe.call(this,o,D.keyboardEvent(n))}},getMenuSize:function(e){let t=e.cloneNode(!0);t.style.position="absolute",t.style.opacity=0,t.removeAttribute("hidden"),e.parentNode.appendChild(t);var e=t.scrollWidth,n=t.scrollHeight;return k(t),{width:e,height:n}},showLoadStatePanel:function(){},showMenuPanel:function(){let a=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=H.call(this,'[data-pane="'.concat(escape(e),'"]'));if(D.element(o)){let n=o.parentNode,e=Array.from(n.children).find(function(e){return!e.hidden});var i,s;Y.transitions&&!Y.reducedMotion&&(n.style.width="".concat(e.scrollWidth,"px"),n.style.height="".concat(e.scrollHeight,"px"),i=te.getMenuSize.call(this,o),s=function e(t){t.target===n&&["width","height"].includes(t.propertyName)&&(n.style.width="",n.style.height="",P.call(a,n,re,e))},F.call(this,n,re,s),n.style.width="".concat(i.width,"px"),n.style.height="".concat(i.height,"px")),U(e,!0),U(o,!1),te.focusFirstMenuItem.call(this,o,t)}},setLoadState:function(e,t){e.appendChild(te.createButton.call(this,"load-state",{"aria-haspopup":!0,"aria-expanded":!1}));let n=V("div",{class:q({ejs__dialog:!0,"ejs__load-state__container":!0}),hidden:""}),a=V("div");n.appendChild(a),H.call(this,".".concat(q({ejs__dialogs:!0}))).appendChild(n),this.elements.dialogs.loadState=n},setScreenRecord:function(n,e){if(window.MediaRecorder){var a=te.createButton.call(this,"screen-record",{"aria-haspopup":!0,"aria-expanded":!1,style:"margin-right:auto;"});n.appendChild(a);let e=V("div",{class:q({ejs__dialog:!0,ejs__screenRecord__container:!0}),hidden:""}),t=V("div");e.appendChild(t),H.call(this,".".concat(q({ejs__dialogs:!0}))).appendChild(e),this.elements.dialogs.screenRecord=e}},setGamepad:function(e,t){var n=te.createButton.call(this,"gamepad",{"aria-haspopup":!0,"aria-expanded":!1,style:"margin-right:auto;"});e.appendChild(n);let a=V("div",{class:q({ejs__dialog:!0,ejs__gamepad__container:!0}),hidden:""}),o=V("div");a.appendChild(o),H.call(this,".".concat(q({ejs__dialogs:!0}))).appendChild(a),this.elements.dialogs.gamepad=a},setCheat:function(e,t){var n=te.createButton.call(this,"cheat",{"aria-haspopup":!0,"aria-expanded":!1,style:"margin-right:auto;"});e.appendChild(n);let a=V("div",{class:q({ejs__dialog:!0,ejs__cheat__container:!0}),hidden:""}),o=V("div");a.appendChild(o),H.call(this,".".concat(q({ejs__dialogs:!0}))).appendChild(a),this.elements.dialogs.cheat=a},setStateInfoBarWidget:function(){let e=V("div",{class:q({ejs__widget:!0})}),t=V("div");t.style="color: red;font-size: 17px;padding:10px;text-align:left;text-shadow:1px 1px 1px #000",e.appendChild(t),H.call(this,".".concat(q({ejs__widgets:!0}))).appendChild(e),this.elements.widgets.stateInfo=e,this.elements.widgets.stateInfoDiv=t},toggleContextMenu:function(n,a){if(z(n.target,q({ejs__dialogs:!0}))){let e=te.contextMenu.timer;if(this.started){let t=H.call(this,".".concat(q({ejs__contextmenu:!0})," ul"));if(a){te.contextMenu.style.display="block",te.contextMenu.style.left="".concat(n.layerX,"px"),te.contextMenu.style.top="".concat(n.layerY,"px");c.call(this,".".concat(q({ejs__contextmenu:!0})," ul li"));if(null===t.getAttribute("menu")){let e=V("li",{});t.appendChild(e),t.setAttribute("menu","")}e&&clearTimeout(e),e=setTimeout(function(){},4e3),te.contextMenu.timer=e}else te.contextMenu.style.display="none"}}},create:function(e){let s=this,t=(te.storage=new he(this,"ejs_".concat(this.system,"_settings")),V("div",h(this.config.selectors.controls.wrapper))),a=(te.contextMenu=V("div",{class:q({ejs__contextmenu:!0}),style:"position: absolute; display:none;z-index:-1"}),["<ul>","</ul>"]),o=[];function n(e,t,n){"function"==typeof n?o.push(n):o.push(function(){});n=a.length-1;t?a.splice(n,0,'<li hidden><a href="#" onclick="return false">'+e+"</a></li>"):a.splice(n,0,'<li><a href="#" onclick="return false">'+e+"</a></li>")}n(s.localization("Take Screenshot"),!1,function(e){var t=v.getScreenData();let n;var a=(n="string"==typeof s.gameName?s.gameName:n)?"".concat(n,"-screenshot.png"):"game.png";let o=document.createElement("a");return o.href=URL.createObjectURL(new Blob([t])),o.download=a,o.click(),setTimeout(function(){URL.revokeObjectURL(o.src)}),!1}),n(s.localization("Cache Manage"),!0,function(e){if(g.romdb){U(s.elements.dialogs.cache,!1);let n=s.elements.dialogs.cache.querySelector(".".concat(v.classNames["dialog-content"]));n.innerHTML="<div>"+s.localization("Loading")+"</div>",g.romdb.getAll(function(t){if(t){let e=V("table",{style:"width:100%;padding-left:10px;text-align:left"}),i=V("tbody");0<t.length?(n.innerHTML="",t.forEach(function(o,e){if(o.key&&!/-part-\d+$/.test(o.key)){for(let e=Math.ceil(o.filesize/104857600),t=[o.key],n=1;n<e;n+=1)t.push("".concat(o.key,"-part-").concat(n));let t=V("tr"),e=V("td"),n=V("td"),a=V("td");e.innerHTML=o.filename,n.innerHTML=function(e){let t=-1;for(;e/=1024,t++,1024<e;);return Math.max(e,.1).toFixed(1)+[" kB"," MB"," GB"," TB","PB","EB","ZB","YB"][t]}(o.filesize),a.innerHTML='<a href="#" onclick="return false">Remove</a>',t.appendChild(e),t.appendChild(n),t.appendChild(a),i.appendChild(t),a.querySelector("a").onclick=function(e){g.romdb.removeBatch(_0x277c67);try{i.removeChild(t)}catch(e){}return e.stopPropagation(),!1}}}),e.appendChild(i),n.appendChild(e)):n.innerHTML='<div style="text-align:center">'+s.localization("Empty")+"</div>"}else n.innerHTML='<div style="text-align:center">'+s.localization("Empty")+"</div>"},function(){})}return!1}),n(s.localization("Quick Save")+" (F2)",!1,function(e){v.quickSaveState(),ne.contextMenu.style.display="none"}),n(s.localization("Quick Load")+" (F4)",!1,function(e){v.quickLoadState(),ne.contextMenu.style.display="none"}),te.contextMenu.innerHTML=a.join("");var i=te.contextMenu.getElementsByTagName("li");for(let e=0;e<i.length;e++)F.call(s,i[e],"click",o[e]);this.elements.container.appendChild(te.contextMenu);var l=V("div",{class:q({ejs__dialog:!0,ejs__cache__container:!0}),hidden:""}),l=(H.call(this,".".concat(q({ejs__dialogs:!0}))).appendChild(l),this.elements.dialogs.cache=l,V("div",{class:q({ejs__dialog:!0,ejs__loading__container:!0}),hidden:""}));H.call(this,".".concat(q({ejs__dialogs:!0}))).appendChild(l),this.elements.dialogs.loading=l,t.appendChild(te.createButton.call(this,"restart")),t.appendChild(te.createButton.call(this,"play")),t.appendChild(te.createButton.call(this,"save-state",{"aria-expanded":!1})),te.setLoadState.call(this,t,e),te.setScreenRecord.call(this,t,e),te.setGamepad.call(this,t,e),te.setStateInfoBarWidget.call(this,t,e),te.setCheat.call(this,t,e),t.appendChild(V("span",{style:"flex:1"}));let r=V("div",{class:q({ejs__volume:!0})});r.appendChild(te.createButton.call(this,"mute"));l={max:1,step:.01,value:this.config.volume};r.appendChild(te.createRange.call(this,"volume",W(l,{}))),this.elements.volume=r,t.appendChild(r);let c=V("div",{class:q({ejs__menu:!0})}),d=(c.appendChild(te.createButton.call(this,"settings",{"aria-haspopup":!0,"aria-expanded":!1})),V("div",{class:q({ejs__menu__container:!0}),hidden:""})),u=V("div"),f=V("div",{"data-pane":"home"}),p=V("div",{role:"menu"}),m=(f.appendChild(p),u.appendChild(f),this.elements.settings.panels.home=f,d.appendChild(u),c.appendChild(d),t.appendChild(c),this.elements.settings.popup=d,this.elements.settings.menu=c,t.appendChild(te.createButton.call(this,"fullscreen")),this);return t.addEventListener("mousedown",function(){m.onButtonDiv=!0}),this.elements.controls=t,te.setNormalOptionsMenu.call(this),te.setCoreOptionsMenu.call(this),t},inject:function(){let e=this,t=(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"/>',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),a=(this.elements.controls=null,{id:this.id}),n=!0;D.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this.props)),this.config.controls||(this.config.controls=[]),D.element(this.config.controls)||D.string(this.config.controls)?t=this.config.controls:(t=te.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality}),n=!1);function o(e){let n=e;return Object.entries(a).forEach(function(e){t=2;var e=function(e){if(Array.isArray(e))return e}(e=e)||function(n,a){let o=[],i=!0,t=!1,s=void 0;try{for(let e,t=n[Symbol.iterator]();!(i=(e=t.next()).done)&&(o.push(e.value),!a||o.length!==a);i=!0);}catch(e){t=!0,s=e}finally{try{i||null==_0x4d9086.return||_0x4d9086.return()}finally{if(t)throw s}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}(),t=e[0],e=e[1];n=fe(n,"{".concat(t,"}"),e)}),n}let i;if(n&&(D.string(this.config.controls)?t=o(t):D.element(t)&&(t.innerHTML=o(t.innerHTML))),D.string(this.config.selectors.controls.container)&&(i=document.querySelector(this.config.selectors.controls.container)),(i=D.element(i)?i:this.elements.container)[D.element(t)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",t),D.element(this.elements.controls)||te.findElements.call(this),!D.empty(this.elements.buttons)){let t=function(t){let n=e.config.classNames.controlPressed;Object.defineProperty(t,"pressed",{enumerable:!0,get:function(){return z(t,n)},set:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];B(t,n,e)}})};Object.values(this.elements.buttons).filter(Boolean).forEach(function(e){D.array(e)||D.nodeList(e)?Array.from(e).filter(Boolean).forEach(t):t(e)})}window.navigator.userAgent.includes("Edge")&&ce(i)}},ne=te;function Ye(n,a){for(let t=0;t<a.length;t++){let e=a[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function We(){if(this.enabled){let e=this.player.elements.buttons.fullscreen;D.element(e)&&(e.pressed=this.active),G.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0),X.isIos||function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(D.element(e)){let e=c.call(this,"button:not(:disabled), input:not(:disabled), [tabindex]"),n=e[0],a=e[e.length-1];r.call(this,this.elements.container,"keydown",function(e){var t;"Tab"===e.key&&9===e.keyCode&&((t=document.activeElement)!==a||e.shiftKey?t===n&&e.shiftKey&&(a.focus(),e.preventDefault()):(n.focus(),e.preventDefault()))},t,!1)}}.call(this.player,this.target,this.active)}}function Ke(){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":"",B(this.target,this.player.config.classNames.fullscreen.fallback,e),We.call(this)}e=[{key:"native",get:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},{key:"prefix",get:function(){if(D.function(document.exitFullscreen))return"";let t="";return["webkit","moz","ms"].some(function(e){return!(!D.function(document["".concat(e,"ExitFullscreen")])&&!D.function(document["".concat(e,"CancelFullScreen")])||(t=e,0))}),t}},{key:"property",get:function(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}}],Ye((u=f).prototype,[{key:"update",value:function(){this.enabled,B(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}},{key:"enter",value:function(){this.enabled&&(f.native?this.prefix?D.empty(this.prefix)||this.target["".concat(this.prefix,"Request").concat(this.property)]():this.target.requestFullscreen():Ke.call(this,!0))}},{key:"exit",value:function(){var e;this.enabled&&(f.native?this.prefix?D.empty(this.prefix)||(e="moz"===this.prefix?"Cancel":"Exit",document["".concat(this.prefix).concat(e).concat(this.property)]()):(document.cancelFullScreen||document.exitFullscreen).call(document):Ke.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:z(this.target,this.player.config.classNames.fullscreen.fallback))}},{key:"target",get:function(){return X.isEdge?this.player.game:this.player.elements.container}}]),Ye(u,e);let Je=f;function f(e){let 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},F.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":"".concat(this.prefix,"fullscreenchange"),function(){We.call(t)}),this.update()}Ze.prototype={toggleMenu:function(e){ne.toggleMenu.call(this.emulator,e)},firstTouch:function(){let e=this.emulator,t=e.elements;e.touch=!0,B(t.container,e.config.classNames.isTouch,!0)},setTabFocus:function(e){let t=this.emulator,n=t.elements,a=t;var o;clearTimeout(this.focusTimer),"keydown"===e.type&&9!==e.which||("keydown"===e.type&&(this.lastKeyDown=e.timeStamp),o=e.timeStamp-this.lastKeyDown<=20,"focus"===e.type&&!o||(e=a.config.classNames.tabFocus,B(c.call(a,".".concat(e)),e,!1),this.focusTimer=setTimeout(function(){var e=document.activeElement;n.container.contains(e)&&B(document.activeElement,a.config.classNames.tabFocus,!0)},10)))},global:function(){let e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=this.emulator,n=t;r.call(n,document.body,"click",this.toggleMenu,e),ae.call(n,document.body,"touchstart",this.firstTouch),r.call(n,document.body,"keydown focus blur",this.setTabFocus,e,!1,!0),F.call(n,document.body,"keyup",function(e){n.started&&(113===e.which&&(e.shiftKey?null===n.elements.buttons.saveState.getAttribute("hidden")&&G.call(n,n.elements.buttons.saveState,"click"):ee.quickSaveState()),115===e.which&&(e.shiftKey?null===n.elements.buttons.loadState.getAttribute("hidden")&&G.call(n,n.elements.buttons.loadState,"click"):ee.quickLoadState()),120===e.which&&G.call(n,n.elements.buttons.mute,"click"))})},container:function(){let n,a=this.emulator,o=a.elements,i=a,t=null;F.call(i,o.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen start-game",function(e){let t=o.controls;t&&"enterfullscreen"===e.type&&(t.pressed=!1,t.hover=!1);if(["touchstart","touchmove","mousemove","start-game"].includes(e.type)){if("nds"==a.system&&"mousemove"==e.type&&g&&g.Module&&g.Module.canvas&&(document.pointerLockElement===g.Module.canvas||document.mozPointerLockElement===g.Module.canvas))return void J.toggleControls.call(i,!1);!ee||"undefined"!=ee.virtualGamepadContainer&&null!==ee.virtualGamepadContainer||(J.toggleControls.call(i,!0),e=i.touch?3e3:2e3,clearTimeout(n),n=setTimeout(function(){return J.toggleControls.call(i,!1)},e),o.controls.setAttribute("data-timer",n))}}),F.call(i,window,"resize",function(e){let t=i.elements.container.clientHeight,n=c.call(i,".".concat(q({ejs__menu__container:!0}),' [role="menu"]'));Array.from(n).forEach(function(e){e.style.maxHeight="".concat(t-95,"px"),e.style.overflow="auto"}),g.Module&&g.Module.canvas,i.elements.container.clientWidth/i.elements.container.clientHeight<1.3?B(i.elements.container,q({portrait:!0}),!0):B(i.elements.container,q({portrait:!0}),!1)}),G.call(i,window,"resize"),F.call(i,i.elements.container,"enterfullscreen",function(e){if(g.isMobileDevice&&window.screen&&screen.orientation&&"function"==typeof screen.orientation.lock)try{screen.orientation.lock("landscape")}catch(e){}else if(g.isMobileDevice&&window.ScreenOrientation&&"function"==typeof ScreenOrientation.lock)try{ScreenOrientation.lock("landscape")}catch(e){}if(2===i.coreVer&&g.Module){let e=50;clearInterval(t),t=setInterval(function(){g.Module.setCanvasSize(window.innerWidth,window.innerHeight),e<0&&clearInterval(t),e--},100)}setTimeout(function(){G.call(i,window,"resize")},300)}),F.call(i,i.elements.container,"exitfullscreen",function(e){if(g.isMobileDevice&&window.screen&&screen.orientation&&"function"==typeof screen.orientation.unlock)try{screen.orientation.unlock()}catch(e){}else if(g.isMobileDevice&&window.ScreenOrientation&&"function"==typeof ScreenOrientation.unlock)try{ScreenOrientation.unlock()}catch(e){}2===i.coreVer&&g.Module&&(clearInterval(t),g.Module.setCanvasSize(800,600)),setTimeout(function(){G.call(i,window,"resize")},300)}),F.call(i,i.elements.container,"start-game",function(e){let t=window.document.createEvent("UIEvents");t.initUIEvent("resize",!0,!1,window,0),window.dispatchEvent(t),B(i.elements.container,q({"game-started":!0}),!0)}),F.call(i,i.elements.container,"blur",function(e){let t=e.currentTarget;setTimeout(function(){t.contains(document.activeElement)||G.call(i,i.elements,"blurgame")},0)}),F.call(i,i.elements.container,"focus",function(e){let t=e.currentTarget;setTimeout(function(){t.contains(document.activeElement)&&G.call(i,i.elements,"focusgame")},0)})},media:function(){let t=this.emulator,a=t.elements,o=t;F.call(o,o.game,"volumechange",function(e){return ne.updateVolume.call(o,e)}),F.call(o,a.container,"contextmenu",function(e){o.touch||o.lightgun||ne.toggleContextMenu.call(o,e,!0),e.preventDefault()},!1),F.call(o,a.container,"mousewheel",function(e){e.stopPropagation()},!1),F.call(o,a.container,"mousedown",function(e){"nds"==t.system&&g&&g.Module&&g.Module.canvas&&!g.isMobileDevice&&document.pointerLockElement!==g.Module.canvas&&document.mozPointerLockElement!==g.Module.canvas&&t.started&&!t.connected&&setTimeout(function(){!0!==t.onButtonDiv&&(g.Module.canvas.requestPointerLock=g.Module.canvas.requestPointerLock||g.Module.canvas.mozRequestPointerLock,g.Module.canvas.requestPointerLock()),t.onButtonDiv=!1},100),o.touch||ne.toggleContextMenu.call(o,e,!1)},!1),F.call(o,o.game,"volumechange",function(){o.storage.set({volume:o.volume,muted:o.muted}),ee.setVolume&&ee.setVolume()});var e=o.config.events.concat(["keyup","keydown"]).join(" ");F.call(o,o.game,e,function(e){let t=e.detail,n=void 0===t?{}:t;"error"===e.type&&(n=o.game.error),G.call(o,a.container,e.type,!0,n)})},proxy:function(e,t,n){let a=this.emulator,o=a.config.listeners[n],i=!0;(i=D.function(o)?o.call(a,e):i)&&D.function(t)&&t.call(a,e)},bind:function(e,t,n,a){let o=this,i=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],s=this.emulator,l=s,r=l.config.listeners[a],c=D.function(r);F.call(l,e,t,function(e){return o.proxy(e,n,a)},i&&!c)},controls:function(){let i=this,l=this.emulator,t=l.elements,n=X.isIE?"change":"input";var e;this.bind(t.buttons.mute,"click",function(){l.muted=!l.muted},"mute"),this.bind(t.buttons.fullscreen,"click",function(){l.fullscreen.toggle()},"fullscreen"),this.bind(t.buttons.gamepad,"click",function(){J.toggleControls.call(l,!1),U(t.dialogs.gamepad,!1)},"mute"),this.bind(t.buttons.saveState,"click",function(){saveSaveFiles(),async function(){G.call(l,l.elements.container,"savestate-start",!1,{});var n=await ee.saveState(),a=ee.getScreenData();if(!v.saveLoadDB.call(l,"save")){if(D.function(l.config.onsavestate))l.config.onsavestate.call(null,{screenshot:a,state:n});else{let e=l.getStartName(!0,!0).split("/").pop();a=new Blob([n]),n=(e.includes(".")&&(e=e.substring(0,e.length-e.split(".").pop().length-1)),(e="string"==typeof l.gameName?l.gameName:e)?"".concat(e,".state"):"game.state");let t=document.createElement("a");t.download=n,t.href=URL.createObjectURL(a),t.click(),setTimeout(function(){URL.revokeObjectURL(t.href)},2e3)}l.elements.container.focus()}}()},"mute"),this.bind(t.buttons.loadState,"click",function(){G.call(l,l.elements.container,"loadstate",!1,{})},"mute"),this.bind(t.buttons.settings,"click",function(e){e.stopPropagation(),ne.toggleMenu.call(l,e)}),this.bind(t.buttons.settings,"keyup",function(e){var t=e.which;[13,32].includes(t)&&(13!==t?(e.preventDefault(),e.stopPropagation(),ne.toggleMenu.call(l,e)):ne.focusFirstMenuItem.call(l,null,!0))},null,!1),this.bind(t.settings.menu,"keydown",function(e){27===e.which&&ne.toggleMenu.call(l,e)}),X.isIos&&(e=c.call(l,'input[type="range"]'),Array.from(e).forEach(function(e){return i.bind(e,n,function(e){return ce(e.target)})})),X.isWebkit&&Array.from(c.call(l,'input[type="range"]')).forEach(function(e){i.bind(e,"input",function(e){return ne.updateRangeFill.call(l,e.target)})}),this.bind(t.inputs.volume,n,function(e){l.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=!l.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){let t=l.config,n=l.elements,a="focusin"===e.type,o=n.controls.getAttribute("data-timer");B(n.controls,t.classNames.noTransition,a),J.toggleControls.call(l,a),a&&(setTimeout(function(){B(n.controls,t.classNames.noTransition,!1)},0),e=i.touch?3e3:4e3,clearTimeout(o),o=setTimeout(function(){return J.toggleControls.call(l,!1)},e),n.controls.setAttribute("data-timer",o))}),this.bind(t.inputs.volume,"wheel",function(e){let t=e.webkitDirectionInvertedFromDevice,n=function(n,a){if(Array.isArray(n))return n;let o=[],i=!0,t=!1,s=void 0;try{for(let e,t=n[Symbol.iterator]();!(i=(e=t.next()).done)&&(o.push(e.value),!a||o.length!==a);i=!0);}catch(e){t=!0,s=e}finally{try{i||null==_0x1bb8de.return||_0x1bb8de.return()}finally{if(t)throw s}}return o}([e.deltaX,-e.deltaY].map(function(e){return t?-e:e}),2),a=n[0],o=n[1],i=Math.sign(Math.abs(a)>Math.abs(o)?a:o);l.increaseVolume(i/50);var s=l.game.volume;(1===i&&s<1||-1===i&&0<s)&&e.preventDefault()},"volume",!1),this.bind(t.controls,"contextmenu",function(e){e.stopPropagation()}),this.bind(t.contextMenu,"contextmenu",function(e){e.stopPropagation()})}};let Qe=Ze;function Ze(e){if(!(this instanceof Ze))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 $e(n,a){for(let t=0;t<a.length;t++){let e=a[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}u=[{key:"setup",value:function(e){let t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=null;return D.string(e)?n=Array.from(document.querySelectorAll(e)):D.nodeList(e)?n=Array.from(e):D.array(e)&&(n=e.filter(D.element)),D.empty(n)?null:n.map(function(e){return new tt(e,t)})}}],$e((e=tt).prototype,[{key:"restart",value:function(){this.currentTime=0}},{key:"increaseVolume",value:function(e){var t=this.game.muted?0:this.volume;this.volume=t+(D.number(e)?e:0)}},{key:"decreaseVolume",value:function(e){this.increaseVolume(-e)}},{key:"toggleControls",value:function(e){return!!this.started&&((e=B(this.elements.container,this.config.classNames.hideControls,void 0===e?void 0:!e))&&ne.toggleMenu.call(this,!1),!e)}},{key:"getStartName",value:function(e,t){let n;return!this.startName||!0!==e&&"rom"===this.startName?this.config.gameUrl.startsWith("blob:")?this.gameName?n=(!0===t?"":this.system+"-")+this.gameName.replace(/\#/g,""):this.config.gameId?n=(!0===t?"":this.system+"-")+this.config.gameId:!0===e&&(n=this.config.gameUrl.split("/").pop().replace(/[^a-z0-9 ,.]/gi,"")):n=this.config.gameUrl.split("/").pop().replace(/[^a-z0-9 ,.]/gi,""):n=this.startName,n}},{key:"loadState",value:function(e){ee.loadState(e,0)}},{key:"on",value:function(e,t){F.call(this,this.elements.container,e,t)}},{key:"once",value:function(e,t){ae.call(this,this.elements.container,e,t)}},{key:"off",value:function(e,t){P(this.elements.container,e,t)}},{key:"playing",set:function(){let 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){let t=e;D.string(t)&&(t=Number(t)),D.number(t)||(t=this.storage.get("volume")),(t=1<(t=D.number(t)?t:this.config.volume)?1:t)<0&&(t=0),this.config.volume=t,this.game.volume=t,!D.empty(e)&&this.muted&&0<t&&(this.muted=!1)},get:function(){return Number(this.game.volume)}},{key:"muted",set:function(e){let t=e;D.boolean(t)||(t=this.storage.get("muted")),D.boolean(t)||(t=this.config.muted),this.config.muted=t,this.game.muted=t},get:function(){return Boolean(this.game.muted)}}]),$e(e,u);let et=tt;function tt(i,s){return new Promise(async function(e,t){function o(e,t){var n=window.location.pathname.split("/").pop();let a=window.location.pathname.substring(0,window.location.pathname.length-n.length);var o,i=a.split("/"),s=e.split("/");let l=[];for(let e=0;e<i.length;e++)""!=i[e]&&l.push(i[e]);if(!(e.startsWith("/")||e.includes("://")||e.includes("http:")||e.includes("https:")||e.includes("file:")||e.includes("blob:"))){for(let e=0;e<s.length;e++)if(""!=s[e]&&"."!=s[e])if(".."==s[e]){if(0<l.length){let e=("/"===(o=e.join("/"))?"/":o.substring(0,o.length-o.split("/").pop().length)).split("/")}}else l.push(s[e]);(e=l.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}let a=this;this.version="2.3.5",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=Y.touch,this.game=i,D.string(this.game)&&(this.game=document.querySelectorAll(this.game)),(window.jQuery&&this.game instanceof jQuery||D.nodeList(this.game)||D.array(this.game))&&(this.game=this.game[0]),this.game=this.game,this.game.innerHTML="",this.config=W({},S,tt.defaults,s||{}),this.config.settings&&this.config.settings.volume&&(S.volume=this.config.settings.volume),this.config.settings&&this.config.settings.defaultControllers&&(v.defaultControllers=this.config.settings.defaultControllers),this.coreVer=1,this.lightgun=this.config.lightgun,this.loadStateOnStart=this.config.loadStateOnStart||!1,this.adUrl=this.config.adUrl||null,D.string(this.config.gameName)&&(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=[]),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{};let t={};for(var n in e)"string"==typeof e[n]&&(t[n]=o(e[n]));return t}(this.config.paths),this.dataPath=function(n){if("string"==typeof n)return o(n,!0);{n=window.location.href;let e=n;var a=e.split("/").pop();let t=e.substring(0,e.length-a.length);return"/"==n?window.location.protocol+"//"+window.location.host+"/":((t=t.startsWith("/")?window.location.protocol+"//"+window.location.host+t:t).endsWith("/")||(t+="/"),t)}}(this.config.dataPath),this.localization=await async function(e,t,n){let a={};if(n&&"string"==typeof n&&"en-US"!==n){t=t&&"string"==typeof t[n+".json"]?t[n+".json"]:e+"localization/"+n+".json";try{let e=await fetch(t);var o=await e.text(),i=JSON.parse(o);S.i18n=i.i18n,te.normalOptions=i.normalOptions}catch(e){console.warn("error setting localization",e)}}return function(e){return"string"==typeof a[e]?a[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=W({},S,tt.defaults,s||{}),Object.keys(this.config.classNames).forEach(function(n){var e=a;if(D.object(e.config.classNames[n]))Object.keys(e.config.classNames[n]).forEach(function(e){let t={};t[a.config.classNames[n][e]]=!0,a.config.classNames[n][e]=q(t)});else{let e={};e[a.config.classNames[n]]=!0,a.config.classNames[n]=q(e)}}),this.config.selectors.controls.wrapper=".".concat(q({ejs__controls:!0})),this.config.selectors.container=".".concat(q({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 Qe(this),this.storage=new he(this,"ejs_settings"),this.game.emulator=this,D.element(this.elements.container)||(this.elements.container=V("div"),R(this.game,this.elements.container));var n=V("div",{class:q({ejs__widgets:!0})}),n=(this.elements.container.appendChild(n),V("div",{class:q({ejs__dialogs:!0})}));this.elements.container.appendChild(n),J.addStyleHook.call(this),ee.setup.call(this),J.build.call(this),this.listeners.container(),this.listeners.global(),this.fullscreen=new Je(this),g.create.call(this),e(this)}.bind(this))}et.defaults={},o.default=et}]).default;
|