class NGIO{static get STATUS_INITIALIZED(){return"initialized"}static get STATUS_CHECKING_LOCAL_VERSION(){return"checking-local-version"}static get STATUS_LOCAL_VERSION_CHECKED(){return"local-version-checked"}static get STATUS_PRELOADING_ITEMS(){return"preloading-items"}static get STATUS_ITEMS_PRELOADED(){return"items-preloaded"}static get STATUS_READY(){return"ready"}static get STATUS_SESSION_UNINITIALIZED(){return NewgroundsIO.SessionState.SESSION_UNINITIALIZED}static get STATUS_WAITING_FOR_SERVER(){return NewgroundsIO.SessionState.WAITING_FOR_SERVER}static get STATUS_LOGIN_REQUIRED(){return NewgroundsIO.SessionState.LOGIN_REQUIRED}static get STATUS_WAITING_FOR_USER(){return NewgroundsIO.SessionState.WAITING_FOR_USER}static get STATUS_LOGIN_CANCELLED(){return NewgroundsIO.SessionState.LOGIN_CANCELLED}static get STATUS_LOGIN_SUCCESSFUL(){return NewgroundsIO.SessionState.LOGIN_SUCCESSFUL}static get STATUS_LOGIN_FAILED(){return NewgroundsIO.SessionState.LOGIN_FAILED}static get STATUS_USER_LOGGED_OUT(){return NewgroundsIO.SessionState.USER_LOGGED_OUT}static get STATUS_SERVER_UNAVAILABLE(){return NewgroundsIO.SessionState.SERVER_UNAVAILABLE}static get STATUS_EXCEEDED_MAX_ATTEMPTS(){return NewgroundsIO.SessionState.EXCEEDED_MAX_ATTEMPTS}static get isWaitingStatus(){return NewgroundsIO.SessionState.SESSION_WAITING.indexOf(this.#a)>=0||[this.STATUS_PRELOADING_ITEMS,this.LOCAL_VERSION_CHECKED,this.STATUS_CHECKING_LOCAL_VERSION].indexOf(this.#a)>=0}static get PERIOD_TODAY(){return"D"}static get PERIOD_CURRENT_WEEK(){return"W"}static get PERIOD_CURRENT_MONTH(){return"M"}static get PERIOD_CURRENT_YEAR(){return"Y"}static get PERIOD_ALL_TIME(){return"A"}static get PERIODS(){return[NGIO.PERIOD_TODAY,NGIO.PERIOD_CURRENT_WEEK,NGIO.PERIOD_CURRENT_MONTH,NGIO.PERIOD_CURRENT_YEAR,NGIO.PERIOD_ALL_TIME]}static get ngioCore(){return this.#b}static #b=null;static get medalScore(){return this.#c}static #c=-1;static get medals(){return this.#d}static #d=null;static get scoreBoards(){return this.#e}static #e=null;static get saveSlots(){return this.#f}static #f=null;static get lastExecution(){return this.#g}static #g=new Date;static get lastConnectionStatus(){return this.#a}static #a=new Date;static get sessionError(){return this.#h}static #h=null;static get legalHost(){return this.#i}static #i=!0;static get isDeprecated(){return this.#j}static #j=!0;static get newestVersion(){return this.#k}static #k=!0;static get loginPageOpen(){return this.#l}static #l=!1;static get gatewayVersion(){return this.#m}static #m=!0;static get lastMedalUnlocked(){return this.#n}static #n=!0;static get lastBoardPosted(){return this.#o}static #o=!0;static get lastScorePosted(){return this.#p}static #p=!0;static get lastGetScoresResult(){return this.#q}static #q=!0;static get lastSaveSlotLoaded(){return this.#r}static #r=!0;static get lastSaveSlotSaved(){return this.#s}static #s=!0;static get lastDateTime(){return this.#t}static #t="0000-00-00";static get lastLoggedEvent(){return this.#u}static #u=null;static get lastTimeStamp(){return this.#v}static #v=0;static get lastPingSuccess(){return this.#w}static #w=!0;static get isInitialized(){return null!==this.ngioCore}static get session(){return this.isInitialized?this.ngioCore.session:null}static get user(){return null===this.session?null:this.ngioCore.session.user}static get hasSession(){return null!==this.session}static get hasUser(){return null!==this.user}static get isReady(){return this.#a===this.STATUS_READY}static get version(){return this.#x}static #x="0.0.0";static get debugMode(){return this.#y}static #y=!1;static #z={autoLogNewView:!1,preloadMedals:!1,preloadScoreBoards:!1,preloadSaveSlots:!1};static #A=!1;static #B=!1;static #C=!1;static #D=!1;static init(e,t,s){if(!this.isInitialized){if(this.#b=new NewgroundsIO.Core(e,t),this.#b.addEventListener("serverResponse",function(e){NGIO.#E(e)}),s&&"object"==typeof s){"string"==typeof s.version&&(this.#x=s.version);let o=["debugMode","checkHostLicense","autoLogNewView","preloadMedals","preloadScoreBoards","preloadSaveSlots"];for(let r=0;r{t.hasData&&e++}),e}static getSaveSlotData(e,t,s){null===this.saveSlots&&(console.error("getSaveSlotData data called without any preloaded save slots."),s?t.call(s,null):t(null));let o=this.getSaveSlot(e);this.#r=o,o.getData(t,s)}static setSaveSlotData(e,t,s,o){if(null==this.saveSlots){console.error("setSaveSlotData data called without any preloaded save slots."),"function"==typeof s&&(o?s(o,null):s(null));return}var r=this.getSaveSlot(e);if(null==r){console.error("Slot #"+e+" does not exist."),"function"==typeof s&&(o?s(o,null):s(null));return}r.setData(t,function(){"function"==typeof s&&(o?s(o,this.lastSaveSlotSaved):s(this.lastSaveSlotSaved))},this)}static logEvent(e,t,s){this.ngioCore.executeComponent(this.ngioCore.getComponent("Event.logEvent",{event_name:e}),function(){"function"==typeof t&&(s?t(s,this.lastLoggedEvent):t(this.lastLoggedEvent))},this)}static getDateTime(e,t){this.ngioCore.executeComponent(this.ngioCore.getComponent("Gateway.getDatetime"),function(){"function"==typeof e&&(t?e(t,this.lastDateTime,this.lastTimeStamp):e(this.lastDateTime,this.lastTimeStamp))},this)}static keepSessionAlive(){if(this.hasUser)(new Date-this.#g).Seconds>=3e4&&(this.#g=new Date,this.ngioCore.executeComponent(this.ngioCore.getComponent("Gateway.ping")))}static getConnectionStatus(e,t){this.#D||null===this.#a||null==this.session||(this.#D=!0,this.#a===this.STATUS_INITIALIZED?(this.#a=this.STATUS_CHECKING_LOCAL_VERSION,this.#G(e,t),this.#H(e,t)):this.#A?this.#a===this.STATUS_LOGIN_SUCCESSFUL?(this.#a=this.STATUS_PRELOADING_ITEMS,this.#G(e,t),this.#I(function(){this.#G(e,t),this.#B=!1},this)):this.#a===this.STATUS_ITEMS_PRELOADED?(this.#l=!1,this.#a=this.STATUS_READY,this.#G(e,t),this.#B=!1):this.keepSessionAlive():this.#B?this.#J(e,t):this.#a!==this.STATUS_CHECKING_LOCAL_VERSION&&this.session.update(function(){this.#J(e,t)},this),this.#D=!1)}static #J(e,t){(this.session.statusChanged||this.#B)&&(this.#a=this.session.status,(this.session.status==NewgroundsIO.SessionState.LOGIN_SUCCESSFUL||this.#B)&&(this.#a=NewgroundsIO.SessionState.LOGIN_SUCCESSFUL,this.#A=!0),this.#G(e,t)),this.#B=!1}static #G(s,o){o?s.call(o,this.#a):s(this.#a)}static #H(r,i){if(this.#C){this.#a=this.STATUS_LOCAL_VERSION_CHECKED,this.#G(r,i);return}this.ngioCore.queueComponent(this.ngioCore.getComponent("App.getCurrentVersion",{version:this.#x})),this.ngioCore.queueComponent(this.ngioCore.getComponent("Gateway.getVersion")),this.#z.autoLogNewView&&this.ngioCore.queueComponent(this.ngioCore.getComponent("App.logView")),this.#z.checkHostLicense&&this.ngioCore.queueComponent(this.ngioCore.getComponent("App.getHostLicense")),this.ngioCore.executeQueue(function(){this.#a=this.STATUS_LOCAL_VERSION_CHECKED,this.#C=!0,this.#G(r,i),this.#j&&console.warn("NGIO - Version mistmatch! Published version is: "+this.#k+", this version is: "+this.version),this.#i||(console.warn("NGIO - This host has been blocked fom hosting this game!"),this.#A=!0,this.#a=this.STATUS_ITEMS_PRELOADED,this.#G(r,i))},this)}static #I(){this.#z.preloadMedals&&(this.ngioCore.queueComponent(this.ngioCore.getComponent("Medal.getMedalScore")),this.ngioCore.queueComponent(this.ngioCore.getComponent("Medal.getList"))),this.#z.preloadScoreBoards&&this.ngioCore.queueComponent(this.ngioCore.getComponent("ScoreBoard.getBoards")),null!==this.user&&this.#z.preloadSaveSlots&&this.ngioCore.queueComponent(this.ngioCore.getComponent("CloudSave.loadSlots")),this.ngioCore.hasQueue?this.ngioCore.executeQueue(function(){this.#a=this.STATUS_ITEMS_PRELOADED},this):this.#a=this.STATUS_ITEMS_PRELOADED}static #F(){this.#a=this.STATUS_INITIALIZED,this.#l=!1,this.#B=!1,this.#A=!1}static #K(n){if(this.#f){let a=this.#f.length;for(let u=0;u>>2]|=(s[r>>>2]>>>24-8*(r%4)&255)<<24-8*((o+r)%4);else if(65535>>2]=s[r>>>2];else t.push.apply(t,s);return this.sigBytes+=e,this},clamp:function(){var t=this.words,s=this.sigBytes;t[s>>>2]&=4294967295<<32-8*(s%4),t.length=e.ceil(s/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var s=[],o=0;o>>2]>>>24-8*(o%4)&255;s.push((r>>>4).toString(16)),s.push((15&r).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,s=[],o=0;o>>3]|=parseInt(e.substr(o,2),16)<<24-4*(o%8);return new n.init(s,t/2)}},l=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var s=[],o=0;o>>2]>>>24-8*(o%4)&255));return s.join("")},parse:function(e){for(var t=e.length,s=[],o=0;o>>2]|=(255&e.charCodeAt(o))<<24-8*(o%4);return new n.init(s,t)}},p=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},c=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new n.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var s=this._data,o=s.words,r=s.sigBytes,i=this.blockSize,a=r/(4*i),a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0);if(t=a*i,r=e.min(4*t,r),t){for(var u=0;u>>2]>>>24-8*(r%4)&255)<<16|(t[r+1>>>2]>>>24-8*((r+1)%4)&255)<<8|t[r+2>>>2]>>>24-8*((r+2)%4)&255,n=0;4>n&&r+.75*n>>6*(3-n)&63));if(t=o.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var s=e.length,o=this._map,r=o.charAt(64);r&&-1!=(r=e.indexOf(r))&&(s=r);for(var r=[],i=0,n=0;n>>6-2*(n%4);r[i>>>2]|=(a|u)<<24-8*(i%4),i++}return t.create(r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,s,o,r,i,n){return((e=e+(t&s|~t&o)+r+n)<>>32-i)+t}function s(e,t,s,o,r,i,n){return((e=e+(t&o|s&~o)+r+n)<>>32-i)+t}function o(e,t,s,o,r,i,n){return((e=e+(t^s^o)+r+n)<>>32-i)+t}function r(e,t,s,o,r,i,n){return((e=e+(s^(t|~o))+r+n)<>>32-i)+t}for(var i=CryptoJS,n=i.lib,a=n.WordArray,u=n.Hasher,n=i.algo,l=[],p=0;64>p;p++)l[p]=4294967296*e.abs(e.sin(p+1))|0;n=n.MD5=u.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,i){for(var n=0;16>n;n++){var a=i+n,u=e[a];e[a]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360}var n=this._hash.words,a=e[i+0],u=e[i+1],p=e[i+2],c=e[i+3],h=e[i+4],d=e[i+5],g=e[i+6],f=e[i+7],w=e[i+8],O=e[i+9],I=e[i+10],m=e[i+11],S=e[i+12],N=e[i+13],b=e[i+14],y=e[i+15],v=n[0],$=n[1],C=n[2],E=n[3],v=t(v,$,C,E,a,7,l[0]),E=t(E,v,$,C,u,12,l[1]),C=t(C,E,v,$,p,17,l[2]),$=t($,C,E,v,c,22,l[3]),v=t(v,$,C,E,h,7,l[4]),E=t(E,v,$,C,d,12,l[5]),C=t(C,E,v,$,g,17,l[6]),$=t($,C,E,v,f,22,l[7]),v=t(v,$,C,E,w,7,l[8]),E=t(E,v,$,C,O,12,l[9]),C=t(C,E,v,$,I,17,l[10]),$=t($,C,E,v,m,22,l[11]),v=t(v,$,C,E,S,7,l[12]),E=t(E,v,$,C,N,12,l[13]),C=t(C,E,v,$,b,17,l[14]),$=t($,C,E,v,y,22,l[15]),v=s(v,$,C,E,u,5,l[16]),E=s(E,v,$,C,g,9,l[17]),C=s(C,E,v,$,m,14,l[18]),$=s($,C,E,v,a,20,l[19]),v=s(v,$,C,E,d,5,l[20]),E=s(E,v,$,C,I,9,l[21]),C=s(C,E,v,$,y,14,l[22]),$=s($,C,E,v,h,20,l[23]),v=s(v,$,C,E,O,5,l[24]),E=s(E,v,$,C,b,9,l[25]),C=s(C,E,v,$,c,14,l[26]),$=s($,C,E,v,w,20,l[27]),v=s(v,$,C,E,N,5,l[28]),E=s(E,v,$,C,p,9,l[29]),C=s(C,E,v,$,f,14,l[30]),$=s($,C,E,v,S,20,l[31]),v=o(v,$,C,E,d,4,l[32]),E=o(E,v,$,C,w,11,l[33]),C=o(C,E,v,$,m,16,l[34]),$=o($,C,E,v,b,23,l[35]),v=o(v,$,C,E,u,4,l[36]),E=o(E,v,$,C,h,11,l[37]),C=o(C,E,v,$,f,16,l[38]),$=o($,C,E,v,I,23,l[39]),v=o(v,$,C,E,N,4,l[40]),E=o(E,v,$,C,a,11,l[41]),C=o(C,E,v,$,c,16,l[42]),$=o($,C,E,v,g,23,l[43]),v=o(v,$,C,E,O,4,l[44]),E=o(E,v,$,C,S,11,l[45]),C=o(C,E,v,$,y,16,l[46]),$=o($,C,E,v,p,23,l[47]),v=r(v,$,C,E,a,6,l[48]),E=r(E,v,$,C,f,10,l[49]),C=r(C,E,v,$,b,15,l[50]),$=r($,C,E,v,d,21,l[51]),v=r(v,$,C,E,S,6,l[52]),E=r(E,v,$,C,c,10,l[53]),C=r(C,E,v,$,I,15,l[54]),$=r($,C,E,v,u,21,l[55]),v=r(v,$,C,E,w,6,l[56]),E=r(E,v,$,C,y,10,l[57]),C=r(C,E,v,$,g,15,l[58]),$=r($,C,E,v,N,21,l[59]),v=r(v,$,C,E,h,6,l[60]),E=r(E,v,$,C,m,10,l[61]),C=r(C,E,v,$,p,15,l[62]),$=r($,C,E,v,O,21,l[63]);n[0]=n[0]+v|0,n[1]=n[1]+$|0,n[2]=n[2]+C|0,n[3]=n[3]+E|0},_doFinalize:function(){var t=this._data,s=t.words,o=8*this._nDataBytes,r=8*t.sigBytes;s[r>>>5]|=128<<24-r%32;var i=e.floor(o/4294967296);for(s[(r+64>>>9<<4)+15]=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360,s[(r+64>>>9<<4)+14]=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360,t.sigBytes=4*(s.length+1),this._process(),s=(t=this._hash).words,o=0;4>o;o++)r=s[o],s[o]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360;return t},clone:function(){var e=u.clone.call(this);return e._hash=this._hash.clone(),e}}),i.MD5=u._createHelper(n),i.HmacMD5=u._createHmacHelper(n)}(Math),function(){var e=CryptoJS,t=e.lib,s=t.Base,o=t.WordArray,t=e.algo,r=t.EvpKDF=s.extend({cfg:s.extend({keySize:4,hasher:t.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var s=this.cfg,r=s.hasher.create(),i=o.create(),n=i.words,a=s.keySize,s=s.iterations;n.length>>2]}},s.BlockCipher=u.extend({cfg:u.cfg.extend({mode:l,padding:c}),reset:function(){u.reset.call(this);var e=this.cfg,t=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var s=e.createEncryptor;else s=e.createDecryptor,this._minBufferSize=1;this._mode=s.call(e,this,t&&t.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var h=s.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),l=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.create([1398893684,1701076831]).concat(e).concat(t):t).toString(n)},parse:function(e){var t=(e=n.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var s=r.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return h.create({ciphertext:e,salt:s})}},d=s.SerializableCipher=o.extend({cfg:o.extend({format:l}),encrypt:function(e,t,s,o){o=this.cfg.extend(o);var r=e.createEncryptor(s,o);return t=r.finalize(t),r=r.cfg,h.create({ciphertext:t,key:s,iv:r.iv,algorithm:e,mode:r.mode,padding:r.padding,blockSize:e.blockSize,formatter:o.format})},decrypt:function(e,t,s,o){return o=this.cfg.extend(o),t=this._parse(t,o.format),e.createDecryptor(s,o).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),t=(t.kdf={}).OpenSSL={execute:function(e,t,s,o){return o||(o=r.random(8)),e=a.create({keySize:t+s}).compute(e,o),s=r.create(e.words.slice(t),4*s),e.sigBytes=4*t,h.create({key:e,iv:s,salt:o})}},g=s.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:t}),encrypt:function(e,t,s,o){return s=(o=this.cfg.extend(o)).kdf.execute(s,e.keySize,e.ivSize),o.iv=s.iv,(e=d.encrypt.call(this,e,t,s.key,o)).mixIn(s),e},decrypt:function(e,t,s,o){return o=this.cfg.extend(o),t=this._parse(t,o.format),s=o.kdf.execute(s,e.keySize,e.ivSize,t.salt),o.iv=s.iv,d.decrypt.call(this,e,t,s.key,o)}})}(),function(){for(var e=CryptoJS,t=e.lib.BlockCipher,s=e.algo,o=[],r=[],i=[],n=[],a=[],u=[],l=[],p=[],c=[],h=[],d=[],g=0;256>g;g++)d[g]=128>g?g<<1:g<<1^283;for(var f=0,w=0,g=0;256>g;g++){var O=w^w<<1^w<<2^w<<3^w<<4,O=O>>>8^255&O^99;o[f]=O,r[O]=f;var I=d[f],m=d[I],S=d[m],N=257*d[O]^16843008*O;i[f]=N<<24|N>>>8,n[f]=N<<16|N>>>16,a[f]=N<<8|N>>>24,u[f]=N,N=16843009*S^65537*m^257*I^16843008*f,l[O]=N<<24|N>>>8,p[O]=N<<16|N>>>16,c[O]=N<<8|N>>>24,h[O]=N,f?(f=I^d[d[d[S^I]]],w^=d[d[w]]):f=w=1}var b=[0,1,2,4,8,16,32,64,128,27,54],s=s.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,s=e.sigBytes/4,e=4*((this._nRounds=s+6)+1),r=this._keySchedule=[],i=0;i>>24]<<24|o[n>>>16&255]<<16|o[n>>>8&255]<<8|o[255&n]):(n=o[(n=n<<8|n>>>24)>>>24]<<24|o[n>>>16&255]<<16|o[n>>>8&255]<<8|o[255&n],n^=b[i/s|0]<<24),r[i]=r[i-s]^n}for(s=0,t=this._invKeySchedule=[];ss||4>=i?n:l[o[n>>>24]]^p[o[n>>>16&255]]^c[o[n>>>8&255]]^h[o[255&n]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,i,n,a,u,o)},decryptBlock:function(e,t){var s=e[t+1];e[t+1]=e[t+3],e[t+3]=s,this._doCryptBlock(e,t,this._invKeySchedule,l,p,c,h,r),s=e[t+1],e[t+1]=e[t+3],e[t+3]=s},_doCryptBlock:function(e,t,s,o,r,i,n,a){for(var u=this._nRounds,l=e[t]^s[0],p=e[t+1]^s[1],c=e[t+2]^s[2],h=e[t+3]^s[3],d=4,g=1;g>>24]^r[p>>>16&255]^i[c>>>8&255]^n[255&h]^s[d++],w=o[p>>>24]^r[c>>>16&255]^i[h>>>8&255]^n[255&l]^s[d++],O=o[c>>>24]^r[h>>>16&255]^i[l>>>8&255]^n[255&p]^s[d++],h=o[h>>>24]^r[l>>>16&255]^i[p>>>8&255]^n[255&c]^s[d++],l=f,p=w,c=O;f=(a[l>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&h])^s[d++],w=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^s[d++],O=(a[c>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&p])^s[d++],h=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^s[d++],e[t]=f,e[t+1]=w,e[t+2]=O,e[t+3]=h},keySize:8});e.AES=t._createHelper(s)}();var NewgroundsIO=NewgroundsIO||{};NewgroundsIO.objects=NewgroundsIO.objects?NewgroundsIO.objects:{},NewgroundsIO.results=NewgroundsIO.results?NewgroundsIO.results:{},NewgroundsIO.components=NewgroundsIO.components?NewgroundsIO.components:{},(()=>{class e extends EventTarget{#O="https://www.newgrounds.io/gateway_v3.php";#P=!1;#Q=null;#R=null;#S=[];#T=null;#U=null;#V={};get GATEWAY_URI(){return this.#O}get debug(){return this.#P}set debug(e){this.#P=!!e}get appID(){return this.#Q}get componentQueue(){return this.#S}get hasQueue(){return this.#S.length>0}get host(){return this.#T}get session(){return this.#U}get user(){return this.#U?this.#U.user:null}get uriParams(){return this.#V}constructor(e,t){if(super(),void 0===e)throw"Missing required appID!";if(void 0===t)throw"Missing required aesKey!";if(this.#Q=e,this.#R=CryptoJS.enc.Base64.parse(t),this.#S=[],this.#V={},window&&window.location&&window.location.href?window.location.hostname?this.#T=window.location.hostname.toLowerCase():"file:"==window.location.href.toLowerCase().substr(0,5)?this.#T="":this.#T="":this.#T="","undefined"!=typeof window&&window.location){var s,o=window.location.href.split("?").pop();if(o)for(var r,i=o.split("&"),n=0;n{t instanceof NewgroundsIO.BaseComponent||(r._verifyComponent(e)||(o=!1),t.setCore(r))}),!o)return}else{if(!this._verifyComponent(e))return;e.setCore(this)}let i=this,n=this._getRequest(e);new NewgroundsIO.objects.Response;var a=new XMLHttpRequest;a.onreadystatechange=function(){if(4==a.readyState){var e;try{e=JSON.parse(a.responseText)}catch(o){(e={success:!1,app_id:i.app_id}).error={message:String(o),code:8002}}let r=i._populateResponse(e);i.dispatchEvent(new CustomEvent("serverResponse",{detail:r})),t&&(s?t.call(s,r):t(r))}};var u=void 0!==Array.prototype.toJSON?Array.prototype.toJSON:null;u&&delete Array.prototype.toJSON;let l=new FormData;l.append("request",JSON.stringify(n)),u&&(Array.prototype.toJSON=u),a.open("POST",this.GATEWAY_URI,!0),a.send(l)}loadComponent(e){if(!this._verifyComponent(e))return;e.setCore(this);let t=this._getRequest(e),s=this.GATEWAY_URI+"?request="+encodeURIComponent(JSON.stringify(t));window.open(s,"_blank")}onServerResponse(e){}_populateResponse(e){if(e.success){if(Array.isArray(e.result))for(let t=0;t{let o=s._getExecute(e);t.push(o)})):t=this._getExecute(e);let o=new NewgroundsIO.objects.Request({execute:t});return this.debug&&(o.debug=!0),o.setCore(this),o}_verifyComponent(e){return e instanceof NewgroundsIO.BaseComponent?!!e.isValid():(console.error("NewgroundsIO Type Mismatch: Expecting a NewgroundsIO.components.XXXX instance, got",e),!1)}}NewgroundsIO.Core=e})(),(()=>{class e{get type(){return this.__type}__type="object";__object="BaseObject";__properties=[];__required=[];__ngioCore=null;isValid(){if(0===this.__required.length)return!0;let e=!0;return this.__required.forEach(function(t){null===this[t]?(console.error("NewgroundsIO Error: "+this.__object+" "+this.__type+" is invalid, missing value for '"+t+"'"),e=!1):this[t]instanceof NewgroundsIO.BaseObject&&!this[t].isValid()&&(e=!1)},this),e}setCore(e){this._doSetCore(e,[])}objectMap={};arrayMap={};fromJSON(e,t){var s,o,r={};for(this.setCore(t),s=0;s{s instanceof NewgroundsIO.BaseObject&&-1===t.indexOf(s)&&s._doSetCore(e,t)},this),"host"!==s||this.host||(this.host=e.host)},this)):console.error("NewgroundsIO Error: Expecting NewgroundsIO.Core instance, got",e)}toJSON(){return this.__doToJSON()}__doToJSON(){if(void 0===this.__properties)return{};let e={};return this.__properties.forEach(function(t){null!==this[t]&&(e[t]="function"==typeof this[t].toJSON?this[t].toJSON():this[t])},this),e}toSecureJSON(){return this.__ngioCore&&this.__ngioCore instanceof NewgroundsIO.Core?{secure:this.__ngioCore.encrypt(JSON.stringify(this.__doToJSON()))}:(console.error("NewgroundsIO Error: Unable to create secure JSON object without calling setCore() first."),this.__doToJSON())}toString(){return this.__type}clone(e){return void 0===e&&(e=new this.constructor),this.__properties.forEach(t=>{e[t]=this[t]}),e.__ngioCore=this.__ngioCore,e}}NewgroundsIO.BaseObject=e;class t extends e{constructor(){super(),this.__type="component",this.__object="BaseComponent",this.__properties=["host","echo"],this._echo=null}get host(){return this.__ngioCore?this.__ngioCore.host:null}get echo(){return this._echo}set echo(e){this.echo=""+e}}NewgroundsIO.BaseComponent=t;class s extends e{constructor(){super(),this.__type="result",this.__object="BaseResult",this.__properties=["echo","error","success"],this._echo=null,this._error=null,this._success=null}get component(){return this.__object}get echo(){return this._echo}get error(){return this._error}set error(e){this._error=e}get success(){return!!this._success}set success(e){this._success=!!e}}NewgroundsIO.BaseResult=s})(),NewgroundsIO.SessionState={SESSION_UNINITIALIZED:"session-uninitialized",WAITING_FOR_SERVER:"waiting-for-server",LOGIN_REQUIRED:"login-required",WAITING_FOR_USER:"waiting-for-user",LOGIN_CANCELLED:"login-cancelled",LOGIN_SUCCESSFUL:"login-successful",LOGIN_FAILED:"login-failed",USER_LOGGED_OUT:"user-logged-out",SERVER_UNAVAILABLE:"server-unavailable",EXCEEDED_MAX_ATTEMPTS:"exceeded-max-attempts"},NewgroundsIO.SessionState.SESSION_WAITING=[NewgroundsIO.SessionState.SESSION_UNINITIALIZED,NewgroundsIO.SessionState.WAITING_FOR_SERVER,NewgroundsIO.SessionState.WAITING_FOR_USER,NewgroundsIO.SessionState.LOGIN_CANCELLED,NewgroundsIO.SessionStateLOGIN_FAILED],(()=>{class e extends NewgroundsIO.BaseComponent{constructor(){super(),this.__object="App.checkSession",this.__requireSession=!0}}void 0===NewgroundsIO.components.App&&(NewgroundsIO.components.App={}),NewgroundsIO.components.App.checkSession=e})(),(()=>{class e extends NewgroundsIO.BaseComponent{constructor(){super(),this.__object="App.endSession",this.__requireSession=!0}}void 0===NewgroundsIO.components.App&&(NewgroundsIO.components.App={}),NewgroundsIO.components.App.endSession=e})(),(()=>{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="App.getCurrentVersion",["version"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="App.getHostLicense",["host"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="App.logView",["host"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="App.startSession",["force"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="CloudSave.clearSlot",this.__requireSession=!0,["id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="CloudSave.loadSlot",this.__requireSession=!0,["id","app_id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="CloudSave.loadSlots",this.__requireSession=!0,["app_id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="CloudSave.setData",this.__requireSession=!0,["id","data"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="Event.logEvent",["host","event_name"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(){super(),this.__object="Gateway.getDatetime"}}void 0===NewgroundsIO.components.Gateway&&(NewgroundsIO.components.Gateway={}),NewgroundsIO.components.Gateway.getDatetime=e})(),(()=>{class e extends NewgroundsIO.BaseComponent{constructor(){super(),this.__object="Gateway.getVersion"}}void 0===NewgroundsIO.components.Gateway&&(NewgroundsIO.components.Gateway={}),NewgroundsIO.components.Gateway.getVersion=e})(),(()=>{class e extends NewgroundsIO.BaseComponent{constructor(){super(),this.__object="Gateway.ping"}}void 0===NewgroundsIO.components.Gateway&&(NewgroundsIO.components.Gateway={}),NewgroundsIO.components.Gateway.ping=e})(),(()=>{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="Loader.loadAuthorUrl",["host","redirect","log_stat"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="Loader.loadMoreGames",["host","redirect","log_stat"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="Loader.loadNewgrounds",["host","redirect","log_stat"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="Loader.loadOfficialUrl",["host","redirect","log_stat"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="Loader.loadReferral",["host","referral_name","redirect","log_stat"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="Medal.getList",["app_id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(){super(),this.__object="Medal.getMedalScore",this.__requireSession=!0}}void 0===NewgroundsIO.components.Medal&&(NewgroundsIO.components.Medal={}),NewgroundsIO.components.Medal.getMedalScore=e})(),(()=>{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="Medal.unlock",this.__isSecure=!0,this.__requireSession=!0,["id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(){super(),this.__object="ScoreBoard.getBoards"}}void 0===NewgroundsIO.components.ScoreBoard&&(NewgroundsIO.components.ScoreBoard={}),NewgroundsIO.components.ScoreBoard.getBoards=e})(),(()=>{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="ScoreBoard.getScores",["id","period","tag","social","user","skip","limit","app_id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseComponent{constructor(e){super();let t=this;if(this.__object="ScoreBoard.postScore",this.__isSecure=!0,this.__requireSession=!0,["id","value","tag"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="Debug",["exec_time","request"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="Error",["message","code"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="Execute",["component","parameters","secure"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="Medal",["id","name","description","icon","value","difficulty","secret","unlocked"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="Request",["app_id","execute","session_id","debug"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="Response",["app_id","success","debug","result","error","api_version","help_url"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="SaveSlot",["id","size","datetime","timestamp","url"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="Score",["user","value","formatted_value","tag"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="ScoreBoard",["id","name"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="Session",["id","user","expired","remember","passport_url"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s=this.#aS?this.#aL=NewgroundsIO.SessionState.EXCEEDED_MAX_ATTEMPTS:(this.#aL=NewgroundsIO.SessionState.SESSION_UNINITIALIZED,this.#aR++)),this.status==NewgroundsIO.SessionState.SESSION_UNINITIALIZED&&(this.#aU=localStorage.getItem(this.storageKey),this.#aT?this.id=this.#aT:this.#aU&&(this.id=this.#aU),this.mode=this.id&&"null"!==this.id?"check":"new");var s=new Date;if(!(s-this.#aO<5e3))switch(this.#aO=s,this.mode){case"new":this.mode="wait",this.startSession();break;case"check":this.mode="wait",this.checkSession()}}}startSession(){this.#aP=!1,this.resetSession(),this.#aL=NewgroundsIO.SessionState.WAITING_FOR_SERVER;var e=this.__ngioCore.getComponent("App.startSession");this.__ngioCore.executeComponent(e,this._onStartSession,this)}_onStartSession(e){if(!0===e.success){let t=e.result;if(Array.isArray(t)){for(let s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="User",["id","name","icons","supporter"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseObject{constructor(e){super();let t=this;if(this.__object="UserIcons",["small","medium","large"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="App.checkSession",["session"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="App.getCurrentVersion",["current_version","client_deprecated"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="App.getHostLicense",["host_approved"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="App.startSession",["session"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="CloudSave.clearSlot",["slot"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="CloudSave.loadSlot",["slot","app_id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="CloudSave.loadSlots",["slots","app_id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="CloudSave.setData",["slot"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Event.logEvent",["event_name"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Gateway.getDatetime",["datetime","timestamp"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Gateway.getVersion",["version"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Gateway.ping",["pong"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Loader.loadAuthorUrl",["url"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Loader.loadMoreGames",["url"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Loader.loadNewgrounds",["url"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Loader.loadOfficialUrl",["url"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Loader.loadReferral",["url"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Medal.getList",["medals","app_id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Medal.getMedalScore",["medal_score"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="Medal.unlock",["medal","medal_score"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="ScoreBoard.getBoards",["scoreboards"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="ScoreBoard.getScores",["period","social","limit","scoreboard","scores","user","app_id"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s{class e extends NewgroundsIO.BaseResult{constructor(e){super();let t=this;if(this.__object="ScoreBoard.postScore",["scoreboard","score"].forEach(e=>{0>t.__properties.indexOf(e)&&t.__properties.push(e)}),e&&"object"==typeof e)for(var s=0;s