function StatsHandler(n,t,i,r,u,f,e){window._paq=window._paq||[];this.gId=n;this.channel=t;this.endPoint=i;this.platform=r;this.language=u;this.practice=f;this.matomoSiteId=e;this.gameLoaded=!1;this.initialSoundReceived=!1;this.oldOrientation="";this.currentOrientation="";this.loadStartTime=0;this.loadEndTime=0;this.connectStartTime=(new Date).getTime();this.connectEndTime=0;this.isHyperSpinActive=!1;this.sentSpinEventsList=[];this.debug=!1;this.platform="";this.gameSpecificVariables={tutorial:{autoInit:!1,startTimeStampMS:-1}};i&&this.addMatomoScript();this.loadingStart()}function LoginRequest(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y){function g(n){var t=n.split("\r\n").filter(function(n){return n!==""});t.forEach(function(n){var t=n.split(/(?: ([^"\s]+|(?:"(?:[^"\\]|\\.)*")))/g).filter(function(n){return n!==""}).map(function(n){return n.toString().replace(/(^""$)|(^")|(((?:[^\\]))"$)/g,"$4")}),i=t[0].replace("d=",""),r;p[i]=t;switch(i){case LoginRequest.COMMAND_SESSION:b=t[1];d||(d=!0,r=LoginRequest.COMMAND_LOGIN+" "+tt,nt(r,g));break;case LoginRequest.COMMAND_LOGIN:k=!0}});k&&rt()}function rt(){var r=p[LoginRequest.COMMAND_LOGIN][1],n,t,i;if(r>0)n={},n.sessionId=b,n.cId=r,n.currency=p[LoginRequest.COMMAND_LOGIN][2],p[LoginRequest.COMMAND_LOGIN][3]&&p[LoginRequest.COMMAND_LOGIN][3]!=='""'&&(n.aamsSessionString=p[LoginRequest.COMMAND_LOGIN][3].trim().replace(/"/g,"")),p[LoginRequest.COMMAND_LOGIN][4]!==undefined&&(n.jurisdiction=p[LoginRequest.COMMAND_LOGIN][4].trim().replace(/"/g,"")),p[LoginRequest.COMMAND_LOGIN][5]!==undefined&&(n.externalId=p[LoginRequest.COMMAND_LOGIN][5].trim().replace(/"/g,"")),p[LoginRequest.COMMAND_LOGIN][6]!==undefined&&(n.identityToken=p[LoginRequest.COMMAND_LOGIN][6].trim().replace(/"/g,"")),p[LoginRequest.COMMAND_SERVERTIME]!==undefined&&(n.serverTime=p[LoginRequest.COMMAND_SERVERTIME][1].replace(/"/g,"").trim(),n.serverTimeDelta=new Date(n.serverTime)-Date.now()),c(n,w);else{if(ut(p[LoginRequest.COMMAND_LOGIN][2]))return window.location=p[LoginRequest.COMMAND_LOGIN][2];t=p[LoginRequest.COMMAND_LOGIN].slice(2).join(" ").replace(/"/g,"").trim();i=a;i.hasOwnProperty(t)&&(t=i[t]);l(t,"CONNECTION_ERROR")}}function ut(n){var t=new RegExp("(http|ftp|https)://([w_-]+(?:(?:.[w_-]+)+))([w.,@@?^=%&:/~+#-]*[w@@?^=%&/~+#-])?");return t.test(n)?!0:!1}function nt(t,i){var r=new XMLHttpRequest;r.open("POST",n);r.setRequestHeader("Content-type","text/plain");r.onerror=ft;r.onabort=et;r.ontimeout=ot;i&&(r.onreadystatechange=function(){r.status===200&&r.readyState===4&&i(r.responseText)});w<LoginRequest.PACKET_INDEX_LIMIT&&r.send("d="+w+++"\r\n"+b+"\r\n"+t+"\r\n")}function ft(){l(PNGLocalizationManager.get("COREWEB.LOGIN.ERRORMESSAGE","An error occured while connecting to the server"))}function et(){l(PNGLocalizationManager.get("COREWEB.LOGIN.ABORTMESSAGE","The connection to the server was aborted"))}function ot(){l(PNGLocalizationManager.get("COREWEB.LOGIN.TIMEOUTMESSAGE","Connection timeout"))}var w=1,p={},b="0",tt=i?'"'+i+'" "" "'+f+'" "" "'+v+'" "'+y+'"':'"'+r+'" "'+u+'" "'+f+'" "" "'+v+'" "'+y+'"',k=!1,d=!1,it=[LoginRequest.COMMAND_SESSION,t,'"'+e+'"',o,'"'+encodeURIComponent(navigator.userAgent)+'"','"'+s+'"','"'+h+'"'].join(" ");nt(it,g)}function LauncherMessage(n){if(this.msgBox=document.createElement("div"),this.msgBox.id="pngLauncherMessage",this.title=document.createElement("h2"),this.title.textContent=n.title||PNGLocalizationManager.get("COREWEB.LAUNCHERMESSAGE.TITLE","Something went wrong"),this.msgBox.appendChild(this.title),this.msgText=document.createElement("p"),this.msgText.id="launcherMessageText",this.msgText.textContent=n.msg,this.msgBox.appendChild(this.msgText),this.channel=n.channel,this.lobbyUrl=n.lobbyUrl?decodeURIComponent(n.lobbyUrl):"",this.cancelbutton=document.createElement("button"),this.cancelbutton.innerHTML=this.channel==="desktop"||this.channel==="mini"||this.channel==="cabinet"?n.cancelText||PNGLocalizationManager.get("COREWEB.LAUNCHERMESSAGE.OK","OK"):n.cancelText||PNGLocalizationManager.get("COREWEB.LAUNCHERMESSAGE.PREVIOUSPAGE","Previous Page"),this.cancelbutton.id="cancelButton",this.cancelbutton.className="pngMsgBoxButton",this.cancelbutton.onclick=n.cancelCB||this.onExit.bind(this),this.msgBox.appendChild(this.cancelbutton),n.confirmCB&&(this.confirmbutton=document.createElement("button"),this.confirmbutton.innerHTML=n.confirmText,this.confirmbutton.className="pngMsgBoxButton",this.confirmbutton.id="confirmbutton",this.confirmbutton.onclick=n.confirmCB,this.msgBox.appendChild(this.confirmbutton)),typeof PngPreloader!="undefined")PngPreloader.onLauncherMessage(!0);document.body.insertAdjacentElement("afterbegin",this.msgBox)}var PNGLocalizationManager=PNGLocalizationManager||function(){function t(t){n=t}function i(t,i){return(n||{}).hasOwnProperty(t)?n[t]:i}var n={};return{init:t,get:i}}(),PNGModules=PNGModules||function(){function e(t){for(var i=0;i<t.length;++i)n[t[i].name]=t[i]}function o(t,i){return r(t)?(n[t].initiate=i,!0):(console.warn("Module with name "+t+" tried to register itself but it's not configured correctly."),!1)}function s(t,i,r,f){var e=n[t].order,o;return a(t,i,e)?(o=e.map(function(n,t){return v(e[t])}),n[t].initiate=f,n[t].gridCells=o,n[t].position={current:[]},u(n[t],i),!0):(console.warn("Failed to insert module: "+t+" into grid. It will not be initialized."),!1)}function u(n,t){if(n.gridCells&&n.position){if(t.length!==n.gridCells.length)return;for(var i=0;i<t.length;++i)n.position.current[i]!==t[i]&&(n.gridCells[i].parentElement&&n.gridCells[i].parentElement.removeChild(n.gridCells[i]),y(t[i],n.gridCells[i]),n.position.current[i]=t[i])}}function h(n,t){return f(n)?(console.warn("module with name "+n+" already defined as internal module."),!1):(i[n]=t,!0)}function r(t){return n.hasOwnProperty(t)}function f(n){return i.hasOwnProperty(n)}function c(){return Object.freeze(n)}function l(){return Object.freeze(i)}function a(n,t,i){return r(n)?!Array.isArray(t)||!Array.isArray(i)?(console.warn("module with name "+n+" should provide position and order in arrays."),!1):t.length!==i.length?(console.warn("module with name "+n+" should provide order for each position."),!1):!0:(console.warn("module with name "+n+" hasn't been registered correctly."),!1)}function v(n){var t=document.createElement("div");return t.className="grid-cell",t.style.order=n.toString(),t}function y(n,i){var r="";switch(n){case t.RIGHT:r="#right-column";break;case t.LEFT:r="#left-column";break;case t.TOP:r="#game-row-top";break;case t.BOTTOM:r="#game-row-bottom";break;default:console.warn("Failed to position element.",n);return}document.querySelector(r).appendChild(i)}var n={},i={},t={LEFT:"left-column",TOP:"game-column-top",BOTTOM:"game-column-bot",RIGHT:"right-column"};return{setAvailableModules:e,addExternalModule:o,addExternalModuleInGrid:s,addInternalModule:h,hasExternalModule:r,hasInternalModule:f,gridPosition:t,order:{OUTER:"outer",INNER:"inner"},getExternalModules:c,getInternalModules:l,reevaluateLayout:u}}(),PNGResources,Engage,RCComponent;StatsHandler.prototype.Megaton=1;StatsHandler.prototype.Flash=2;StatsHandler.prototype.LegacyMobile=3;StatsHandler.prototype.addMatomoScript=function(){window._paq.push(["setDocumentTitle","Megaton "+this.channel]);window._paq.push(["setTrackerUrl",this.endPoint+"piwik.php"]);window._paq.push(["setSiteId",this.matomoSiteId]);var n=document.createElement("script"),t=document.getElementsByTagName("script")[0];n.type="text/javascript";n.async=!0;n.defer=!0;n.src=this.endPoint+"piwik.js";t.parentNode.insertBefore(n,t)};StatsHandler.prototype.addGameListeners=function(){var i=this.HandleEvent.bind(this),n,t;for(n in this.gameEvents)this.gameEvents.hasOwnProperty(n)&&window.extcom.addEventListener(this.gameEvents[n],i);t=window.extcom.gameCalls();t.GET_SOUND()};StatsHandler.prototype.setDebug=function(n){this.debug=n};StatsHandler.prototype.gameEvents={Loader:"LOADER",LoginAnswer:"LOGINANSWER",Settings:"SETTINGS",RoundStart:"round_start",OnRoundStart:"onroundstart",SoundOn:"SOUND_ON",SoundOff:"SOUND_OFF",OnHelp:"UIHELP",OnShowPaytable:"UISHOWPAYTABLE",OnHistory:"UIHISTORY",AutoplayStarted:"AUTOPLAY_STARTED",Message:"MESSAGE",ExternalTutorialAutoInit:"EXTERNAL_TUTORIAL_AUTOINIT",ExternalTutorialInit:"EXTERNAL_TUTORIAL_INIT",ExternalTutorialStarted:"EXTERNAL_TUTORIAL_STARTED",ExternalTutorialExit:"EXTERNAL_TUTORIAL_EXIT",ExternalTutorialFinish:"EXTERNAL_TUTORIAL_FINISH",HyperSpinActivated:"HYPERSPIN_ACTIVATE",HyperSpinDeactivated:"HYPERSPIN_DEACTIVATE"};StatsHandler.prototype.internalEvents={Load:"load",Loaded:"loaded",Connected:"connected",LoadTime:"loadtime",LoginTime:"logintime",Language:"language"};StatsHandler.prototype.legacyEvents={AutoplayStarted:"autoplay",SoundOn:"soundon",SoundOff:"soundoff",InitialSoundOn:"initialsoundon",InitialSoundOff:"initialsoundoff",ShowPaytable:"showpaytable",ShowHelp:"showhelp",ConnectionLost:"connectionlost"};StatsHandler.prototype.analyticEvents={Loaded:"Loaded",Load:"Load",LoadTime:"Load Time",LoginTime:"Login time",Connected:"Connected",InitialSoundOn:"Initial Sound On",InitialSoundOff:"Initial Sound Off",SoundOn:"Sound On",SoundOff:"Sound Off",ShowHelp:"Show Help",ShowPaytable:"Show Paytable",ShowHistory:"Show History",AutoplayStarted:"AutoplayStarted",Language:"Language",ConnectionFailure:"Connection Failure",ConnectionLost:"Connection Lost",TutorialStartedInPractice:"Tutorial Started In Practice",TutorialStarted:"Tutorial Started",TutorialRevisit:"Tutorial Revisit",TutorialAborted:"Tutorial Aborted",TutorialTimeAborted:"Tutorial Time Aborted",TutorialSkipped:"Tutorial Skipped",TutorialTimeCompleted:"Tutorial Time Completed",TutorialCompleted:"Tutorial Completed",SpinLandscape:"Spin /Landscape",SpinPortrait:"Spin /Portrait",HyperSpinLandscape:"HyperSpin /Landscape",HyperSpinPortrait:"HyperSpin /Portrait"};StatsHandler.prototype.HandleEvent=function(n){var i,r,t,u,f,e;this.log(n.type);i=typeof n=="object"?n.type:n;r=arguments[1];switch(i){case this.gameEvents.Loader:n.id===3&&this.LoadingComplete();break;case this.gameEvents.LoginAnswer:n.userId>0&&this.connectingComplete();break;case this.gameEvents.Settings:this.paseSettings(n);break;case this.internalEvents.Load:this.addStatEvent(this.analyticEvents.Load);break;case this.internalEvents.Loaded:this.gameLoaded=!0;this.addStatEvent(this.analyticEvents.Loaded);break;case this.internalEvents.Connected:this.addStatEvent(this.analyticEvents.Connected);break;case this.gameEvents.RoundStart:case this.gameEvents.OnRoundStart:if(this.channel!=="mobile")break;this.oldOrientation=this.currentOrientation;this.currentOrientation=window.innerWidth>window.innerHeight?"ls":"pt";this.oldOrientation!==this.currentOrientation&&(this.sentSpinEventsList=[]);t="";t=this.currentOrientation==="pt"?this.isHyperSpinActive?this.analyticEvents.HyperSpinPortrait:this.analyticEvents.SpinPortrait:this.isHyperSpinActive?this.analyticEvents.HyperSpinLandscape:this.analyticEvents.SpinLandscape;this.sentSpinEventsList.indexOf(t)===-1&&(this.sentSpinEventsList.push(t),this.addStatEvent(t));break;case this.legacyEvents.InitialSoundOn:this.gameLoaded&&this.addStatEvent(this.analyticEvents.InitialSoundOn);break;case this.legacyEvents.InitialSoundOff:this.gameLoaded&&this.addStatEvent(this.analyticEvents.InitialSoundOff);break;case this.gameEvents.SoundOn:this.initialSoundReceived||(this.addStatEvent(this.analyticEvents.InitialSoundOn),this.initialSoundReceived=!0);break;case this.gameEvents.SoundOff:this.initialSoundReceived||(this.addStatEvent(this.analyticEvents.InitialSoundOff),this.initialSoundReceived=!0);break;case this.legacyEvents.SoundOn:this.gameLoaded&&this.addStatEvent(this.analyticEvents.SoundOn);break;case this.legacyEvents.SoundOff:this.gameLoaded&&this.addStatEvent(this.analyticEvents.SoundOff);break;case this.legacyEvents.ShowHelp:case this.gameEvents.OnHelp:this.addStatEvent(this.analyticEvents.ShowHelp);break;case this.legacyEvents.ShowPaytable:case this.gameEvents.OnShowPaytable:this.addStatEvent(this.analyticEvents.ShowPaytable);break;case this.gameEvents.OnHistory:this.addStatEvent(this.analyticEvents.ShowHistory);break;case this.gameEvents.AutoplayStarted:this.addStatEvent(this.analyticEvents.AutoplayStarted,n.playsLeft);break;case this.legacyEvents.AutoplayStarted:this.addStatEvent(this.analyticEvents.AutoplayStarted,r.numautoplays);break;case this.internalEvents.LoadTime:this.addStatEvent(this.analyticEvents.LoadTime,n.time);break;case this.internalEvents.LoginTime:this.addStatEvent(this.analyticEvents.LoginTime,n.time);break;case this.legacyEvents.ConnectionLost:this.addStatEvent(this.analyticEvents.ConnectionLost);break;case this.gameEvents.Message:n.flags===4?this.addStatEvent(this.analyticEvents.ConnectionLost):n.flags===3&&this.addStatEvent(this.analyticEvents.ConnectionFailure);break;case this.gameEvents.ExternalTutorialAutoInit:this.gameSpecificVariables.tutorial.autoInit=!0;break;case this.gameEvents.ExternalTutorialInit:this.gameSpecificVariables.tutorial.autoInit=!1;break;case this.gameEvents.ExternalTutorialStarted:u=this.practice==="1"?this.analyticEvents.TutorialStartedInPractice:this.analyticEvents.TutorialStarted;this.addStatEvent(u);this.gameSpecificVariables.tutorial.startTimeStampMS=(new Date).getTime();this.gameSpecificVariables.tutorial.autoInit||this.addStatEvent(this.analyticEvents.TutorialRevisit);break;case this.gameEvents.ExternalTutorialExit:this.gameSpecificVariables.tutorial.startTimeStampMS!==-1?(f=Date.now()-this.gameSpecificVariables.tutorial.startTimeStampMS,this.gameSpecificVariables.tutorial.startTimeStampMS=-1,this.addStatEvent(this.analyticEvents.TutorialAborted),this.addStatEvent(this.analyticEvents.TutorialTimeAborted,f)):this.addStatEvent(this.analyticEvents.TutorialSkipped);break;case this.gameEvents.ExternalTutorialFinish:this.gameSpecificVariables.tutorial.startTimeStampMS!==-1&&(e=Date.now()-this.gameSpecificVariables.tutorial.startTimeStampMS,this.addStatEvent(this.analyticEvents.TutorialTimeCompleted,e));this.gameSpecificVariables.tutorial.startTimeStampMS=-1;this.gameSpecificVariables.tutorial.autoInit=!1;this.addStatEvent(this.analyticEvents.TutorialCompleted);break;case this.gameEvents.HyperSpinActivated:this.isHyperSpinActive=!0;break;case this.gameEvents.HyperSpinDeactivated:this.isHyperSpinActive=!1}};StatsHandler.prototype.addStatEvent=function(n,t){typeof t!="undefined"?window._paq.push(["trackEvent","Game",n,this.gId,t]):window._paq.push(["trackEvent","Game",n,this.gId]);this.log("Sent event to matomo: "+n," with value: "+t)};StatsHandler.prototype.loadingStart=function(){this.log("LoadingStart");this.loadStartTime=(new Date).getTime();this.HandleEvent({type:"load"})};StatsHandler.prototype.LoadingComplete=function(){this.loadEndTime=(new Date).getTime();var n=this.loadEndTime-this.loadStartTime;this.HandleEvent({type:"loaded"});this.HandleEvent({type:"loadtime",time:n})};StatsHandler.prototype.connectingComplete=function(){this.connectEndTime=(new Date).getTime();var n=this.connectEndTime-this.connectStartTime;this.HandleEvent({type:"connected"});this.HandleEvent({type:"logintime",time:n})};StatsHandler.prototype.lastSettings=undefined;StatsHandler.prototype.copyObject=function(n){var t={};for(prop in n)t[prop]=n[prop];return t};StatsHandler.prototype.paseSettings=function(n){var t,i;if(this.lastSettings===undefined){this.lastSettings={};for(key in n.settings)key!="children"&&(this.lastSettings[key]=n.settings[key]);return}t=[];for(key in n.settings)(key!=="children"||key!=="_children")&&key[0]==="_"&&this.lastSettings[key]!=n.settings[key]&&t.push({id:key,newVal:n.settings[key]});if(this.lastSettings===undefined){this.lastSettings=n;return}for(i=0;i<t.length;i++)this.onSettingsChange(t[i]);for(key in n.settings)key!="children"&&(this.lastSettings[key]=n.settings[key])};StatsHandler.prototype.onSettingsChange=function(n){this.log("Settings changed: "+n.id);switch(n.id){case"_sound":n.newVal===!0?this.addStatEvent(this.analyticEvents.SoundOn):n.newVal===!1&&this.addStatEvent(this.analyticEvents.SoundOff)}};StatsHandler.prototype.log=function(){var t,i,n;if(this.debug){for(t="",i="",n=0;n<arguments.length;n++)typeof arguments[n]=="string"&&arguments[n].match("background")?i=arguments[n]:t+=" "+arguments[n];console.log(t,i)}};StatsHandler.prototype.ConnectingStart=function(){};PNGResources=PNGResources||function(){function i(n,t,i){function h(){var t=document.createElement("script");t.type="text/javascript";t.src=n[r].src;t.crossOrigin="anonymous";o?(t.onreadystatechange=function(){(this.readyState==="loaded"||this.readyState==="complete")&&u()},t.onerror=e):(t.addEventListener("load",u,!1),t.addEventListener("error",e,!1));s.appendChild(t)}function c(){var f=document.getElementsByTagName("head")[0],i=document.createElement("link");i.type="text/css";i.rel="stylesheet";i.href=n[r].src;n[r].required?(i.addEventListener("error",t,!1),i.addEventListener("load",u,!1)):u();f.appendChild(i)}function f(){if(/.js$/g.test(n[r].src))h();else if(/.css$/g.test(n[r].src))c();else{if(console.warn("Tried to load unsupported file type.",n[r].src),n[r].required)return t();u()}}function e(){if(--n[r].retries)f();else{if(n[r].required)return t();u()}}function u(){r++;r===n.length?i():f()}var r=0,o=navigator.userAgent.indexOf("MSIE")!==-1,s=document.getElementsByTagName("head")[0];f()}function r(r,u,o,s,h){var l=r.gameURL.split("/"),v=l[l.length-2],a,c;u=t(u);a=function(){new LauncherMessage({msg:PNGLocalizationManager.get("COREWEB.RESOURCES.LOADFAILMESSAGE","Failed to load resources."),channel:u,lobbyUrl:r.lobbyUrl});EngageProxy.postMessage({type:"COREWEB_ERROR",data:{_flags:4,_title:PNGLocalizationManager.get("COREWEB.RESOURCES.ENGAGE.ERRORTITLE","Gameloader Error"),_message:PNGLocalizationManager.get("COREWEB.RESOURCES.ENGAGE.ERRORMESSAGE","Error loading script")}})};c=[];switch(r.bundleMode){case n.Old:c=[{src:"${RESOURCEROOT}games/common.bundle.js",retries:10,required:!0},{src:"${RESOURCEROOT}games/${GAMENAME}/${GAMENAME}_main.bundle.js",retries:10,required:!0},{src:"${RESOURCEROOT}games/${GAMENAME}/${GAMENAME}_${CHANNEL}${UIVERSION}.bundle.js",retries:10,required:!0}];break;case n.GameSeparation:c=[{src:"${RESOURCEROOT}games/${GAMENAME}/${GAMENAME}_${CHANNEL}${UIVERSION}.bundle.js",retries:10,required:!0}];break;default:return}c=c.concat(f()).concat(e(s)).map(function(n){return n.src=n.src.replace(/\$\{RESOURCEROOT\}/g,r.resourceRoot).replace(/\$\{GAMENAME\}/g,v).replace(/\$\{CHANNEL\}/g,u).replace(/\$\{COREWEBURL\}/g,h).replace(/\$\{BRAND\}/g,r.brand).replace(/\$\{UIVERSION\}/g,r.uiVersion||""),n});i(c,a,o)}function u(i,r){r=t(r);var u={internalModules:{},externalModules:{},start:undefined},f=i.uiVersion||"";return new Promise(function(t){switch(i.bundleMode){case n.Old:PNGModules.addInternalModule("ui",window[r+f+"_Entry"]);u.internalModules=PNGModules.getInternalModules()||{};u.externalModules=PNGModules.getExternalModules()||{};u.internalModules.ui=window[r+f+"_Entry"];u.start=window.main_Entry.start;t(u);break;case n.GameSeparation:PNGModules.addInternalModule("ui",window[r+f+"_Entry"]);u.internalModules=PNGModules.getInternalModules()||{};u.externalModules=PNGModules.getExternalModules()||{};u.internalModules.ui=window[r+f+"_Entry"];u.start=window[r+f+"_Entry"].start;t(u)}})}function f(){var n=[{src:"${COREWEBURL}Content/javascript/3rdparty/bluebird.core.min.js",name:"bluebird.core",condition:typeof window.Promise=="undefined"}];return n.filter(function(n){return n.condition})}function e(n){var t=[];return Object.keys(n).forEach(function(i){var r=n[i];r.dependencies&&r.dependencies.forEach(function(n){t.push({src:n,retries:2,required:r.required})});r.resources&&r.resources.forEach(function(n){t.push({src:n,retries:2,required:r.required})});r.script&&t.push({src:r.script,name:r.name,retries:2,required:r.required})}),t}function o(n,i){var r,f,e,u,o,c;n=t(n);r=JSON.parse(i.gameModules);s(r,n,i);f={bundle:[]};e=f.bundle;for(u in r)r.hasOwnProperty(u)&&r[u].resource&&h(i,u)&&(o=i.uiVersion||"",c=r[u].resource.replace("${CHANNEL}",n+o),e.push({name:u,url:c}));return f}function t(n){switch(n){case"cabinet":return"desktop";default:return n}}function s(n,t,i){n.language={script:"",resource:"resources/lang/${language}/locale.json"};t==="desktop"&&i.showHelpInPaytable==="True"&&n.hasOwnProperty("bundleconfig")&&n.bundleconfig.resource!==undefined&&(n.germanydesktopbundle={script:"",resource:n.bundleconfig.resource.replace("config_${CHANNEL}","germany_desktop_additional_resources")})}function h(n,t){switch(t){case"featurepreview":return n.showSplash==="True";case"mysteryjackpot":return n.hasMysteryJackpot==="True";case"guaranteedjackpot":return n.hasGuaranteedJackpot==="True";default:return!0}}var n={GameSeparation:"0",Old:"1"};return{getBundleObject:o,getEntries:u,initiateScriptLoad:r}}();LoginRequest.COMMAND_SESSION="103";LoginRequest.COMMAND_LOGIN="101";LoginRequest.COMMAND_SERVERTIME="127";LoginRequest.PACKET_INDEX_LIMIT=3;PlatformManager={init:function(n,t,i){this.coreWebUrl=n;this.embedMode=t;this.channel=i},devices:{iPhone4:{type:"iPhone",version:"4"},iPhone5:{type:"iPhone",version:"5"},iPhone6:{type:"iPhone",version:"6"},iPhone6p:{type:"iPhone",version:"6+"}},deviceTypes:{mobile:"mobile",tablet:"tablet"},debug:!1,errwebglrenderingcontextErrorCode:"errwebglrenderingcontext",errstencilErrorCode:"errstencil",checkStencilBuffer:function(){var i={stencil:!0},n,t;try{return window.WebGLRenderingContext?(n=document.createElement("canvas"),t=n.getContext("webgl",i)||n.getContext("experimental-webgl",i),!(t&&t.getContextAttributes().stencil)?this.errstencilErrorCode:""):this.errwebglrenderingcontextErrorCode}catch(r){return this.errstencilErrorCode}},checkHardwareAcceleration:function(){var n=PlatformManager.collectWebGlInfo();if(n.majorPerformanceCaveat==="Yes")return"errhardwareaccelerationdisabled"},isHighResolutionDisplay:function(){if(window.matchMedia){var n=window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen  and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");return n&&n.matches||window.devicePixelRatio>1}return window.devicePixelRatio>1},checkFeatureSupport:function(n){var i={},t,r,u,f;if(i.enforcehardwareacceleration=this.checkHardwareAcceleration,i.stencilbuffer=this.checkStencilBuffer,t=n.requiredPlatformFeatureSupport,t==="")return!1;for(t=t.split(","),r=0;r<t.length;r++)if(u=t[r].toLowerCase(),typeof i[u]=="function"&&(f=i[u](),f))return f;return""},getIOSVersion:function(){return Number((navigator.userAgent.match(/\b[1-9]?[0-9]+_[0-9]+(?:_[0-9]+)?\b/)||[""])[0].split("_",1))},checkIOSSupport:function(){return this.isIOs()&&this.getIOSVersion()>=8?"":"errios"},checkPlusDevice:function(){return this.checkIOSSupport()&&this.getIPhoneVersion()===this.devices.iPhone6p.version?!0:!1},isDevice:function(n){switch(n.type){case"iPhone":return this.isIOs()&&this.getIPhoneVersion()===n.version;case"iPad":return this.isIOs()&&this.isIpad();default:return!1}},isIpad:function(){return/iPad/i.test(navigator.userAgent)},isIphone:function(){return/iPhone/i.test(navigator.userAgent)},isIOs:function(){return/iPhone|iPod|iPad/.test(navigator.userAgent)},isIE11:function(){return/Trident/.test(navigator.userAgent)},isEdge:function(){return/Edge/.test(navigator.userAgent)},isFirefox:function(){return/Firefox/.test(navigator.userAgent)},isFirefoxWebpSupportedVersion:function(){if(this.isFirefox()){const n=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),t=n?parseInt(n[1],10):0;if(t>64)return!0}return!1},isUnsupportedEdgeWebp:function(){var n,t;if(isEdge()){n=navigator.userAgent.indexOf("Edge/");try{if(t=parseInt(navigator.userAgent.substring(n+5,navigator.userAgent.indexOf(".",n)),10),t<=18)return!0}catch(i){return!1}}return!1},isOldIpad:function(){var n=Math.max(window.screen.height,window.screen.width),t=Math.min(window.screen.height,window.screen.width);return t===768&&n===1024&&window.devicePixelRatio===1?!0:!1},getIPhoneVersion:function(){var n=Math.max(window.screen.height,window.screen.width),t=Math.min(window.screen.height,window.screen.width);return t===320&&n===480?"4":t===320&&n===568?"5":t===375&&n===667?"6":t===414&&n===736?"6+":"none"},checkAndroidSupport:function(){var n=navigator.userAgent.match(/Android[\/\s](\d+\.?\d?)?/);return n?new Number(n[1])>=4.4&&!(/firefox/gi.test(navigator.userAgent)&&!/opera/gi.test(navigator.userAgent))?"":"errandroid":"errandroid"},checkWindowsSupport:function(){return"errwindows"},checkDesktopChromeSupport:function(){return!/Android|iPhone|iPod|iPad/.test(navigator.userAgent)&&navigator.userAgent.match("Chrome")?"":"errdesktopchrome"},checkConfiguredBlockedDevice:function(){var n=this.configuration.customDeviceBlockRegex,t,i;if(!n)return!1;for(n=n.split(","),t=0;t<n.length;t++)if(i=new RegExp(n[t],"gi"),i.test(navigator.userAgent))return!0;return!1},checkSupportedDevice:function(n){if(this.configuration=n,this.checkConfiguredBlockedDevice()===!0)return"errconfigblock";var t=this.checkFeatureSupport(n);return t?t:navigator.userAgent.match("Windows Phone")?this.checkWindowsSupport():navigator.userAgent.match("Android")?this.checkAndroidSupport():navigator.userAgent.match(/iPhone|iPod|iPad/)?this.checkIOSSupport():""},logDeviceError:function(n){var i=this.coreWebUrl+"casino/LogDeviceError",t=new XMLHttpRequest;t.open("POST",i,!0);t.setRequestHeader("Content-Type","application/json");t.send(JSON.stringify({errorInfo:n}))},checkWebAudioSupport:function(){return typeof window.AudioContext=="function"||typeof window.AudioContext=="object"||typeof window.webkitAudioContext=="function"||typeof window.webkitAudioContext=="object"},checkSoundSupport:function(){return navigator.userAgent.match("Windows Phone")?this.checkWebAudioSupport():this.isIpad()&&this.isOldIpad()?!1:!0},checkVideoSupport:function(){return PlatformManager.isIOs()&&PlatformManager.getIOSVersion()<10?!1:!0},checkWebpActiveSupport:function(){let n=document.createElement("canvas");return!(n.getContext&&n.getContext("2d"))?!1:n.toDataURL("image/webp").indexOf("data:image/webp")==0},checkJp2ActiveSupport:function(){let n=document.createElement("canvas");return!(n.getContext&&n.getContext("2d"))?!1:n.toDataURL("image/jp2").indexOf("data:image/jp2")==0},checkWebpSupport:function(){return this.checkWebpActiveSupport()?!0:this.isFirefoxWebpSupportedVersion()?!0:!1},checkJP2Support:function(){return this.checkJp2ActiveSupport()?!0:!1},checkFullScreenSupport:function(n){return this.embedMode!=""?"False":(navigator.userAgent.match("Android")&&navigator.userAgent.match("Chrome"))!==null?n:"False"},checkDisabledSpacebarToSpinSupport:function(n){return this.channel==="desktop"||this.channel==="cabinet"?n.disableSpacebarToSpin:"True"},checkAutoPreventDefault:function(){return"True"},checkIosChrome:function(){return navigator.userAgent.match("CriOS")?!0:!1},isIosVersionInBlackList:function(){return GameLoader.configuration.swipeToHideIosBlacklist.slice(1,-1).split(",").map(Number).includes(PlatformManager.getIOSVersion())},getDeviceType:function(){return/iPad/.test(navigator.userAgent)?this.deviceTypes.tablet:/Android/.test(navigator.userAgent)?Math.min(window.screen.width,window.screen.height)>600?this.deviceTypes.tablet:this.deviceTypes.mobile:this.deviceTypes.mobile},addSwipeToFullscreen:{background:undefined,arrowDot:undefined,hand:undefined,sizeInterval:undefined,gamewrapper:undefined,allowScrollToFullscreen:undefined,playerProtectionSweden:undefined,playerProtectionUK:undefined,isPreventingPinchZoom:!0,isShowing:!0,init:function(n){this.gamewrapper=n;this.background=document.createElement("div");this.background.id="pngSwipebackground";document.getElementById("mask").style.display="block";this.background.addEventListener("touchstart",this.onTouchStart);this.background.addEventListener("touchmove",this.onTouchMove);window.addEventListener("resize",this.onResize);this.arrowDot=document.createElement("div");this.arrowDot.id="pngArrowDot";this.hand=document.createElement("div");this.hand.id="pngSwipeHand";this.background.appendChild(this.arrowDot);this.background.appendChild(this.hand);document.body.appendChild(this.background);PlatformManager.checkIosChrome()&&(document.body.style.height="2000px");PlatformManager.getIOSVersion()>=13&&(document.body.style.overflowY="scroll");this.sizeInterval=setInterval(this.pollSize.bind(this),1e3)},pollSize:function(){var n,t,i;window.innerHeight<window.innerWidth?(PlatformManager.checkIosChrome()?(t=Math.min(window.screen.height,window.screen.width),n=t-20>window.innerHeight):GameLoader.configuration.disableSwipeToFullscreenLandscapeIos==="False"?(i=window.outerHeight||document.body.clientHeight,n=!(window.innerHeight+window.pageYOffset>=document.body.offsetHeight&&i===window.innerHeight)):n=!1,this.show(n)):GameLoader.configuration.disableSwipeToFullscreenPortraitIos==="False"?(n=document.documentElement.clientHeight>=window.innerHeight,this.show(n)):this.show(!1);typeof document.getElementById("gameWrapper")!="undefined"&&document.getElementById("gameWrapper").clientWidth>window.innerWidth?(this.show(!0),this.background.removeEventListener("touchmove",this.onTouchMove),this.background.removeEventListener("touchstart",this.onTouchStart),this.isPreventingPinchZoom=!1):this.isPreventingPinchZoom||(this.background.addEventListener("touchmove",this.onTouchMove),this.background.addEventListener("touchstart",this.onTouchStart),this.isPreventingPinchZoom=!0);(GameLoader.configuration.disableSwipeToFullscreenIos==="True"&&!PlatformManager.checkIosChrome()||PlatformManager.isIosVersionInBlackList())&&this.show(!1)},show:function(n){n&&GameLoader.loaderComplete?(this.updateBackgroundPositionForSwipeToHide(),this.background.classList.add("pngSwipeBgShow"),this.background.classList.remove("pngFadeOutAnim"),this.gamewrapper.style.pointerEvents="none",this.isShowing||window.scroll(0,0),this.isShowing=!0):(this.background.classList.remove("pngSwipeBgShow"),this.background.classList.add("pngFadeOutAnim"),this.gamewrapper.style.pointerEvents="",this.isShowing=!1)},updateBackgroundPositionForSwipeToHide:function(){var n;PNGModules.hasExternalModule("playerProtectionSweden")&&(this.playerProtectionSweden||(this.playerProtectionSweden=document.querySelector(".pps-top-bar-mobile")),this.playerProtectionSweden&&(n=this.playerProtectionSweden.clientHeight,this.background.style.top=n?n+"px":0));PNGModules.hasExternalModule("playerProtectionUK")&&(this.playerProtectionUK||(this.playerProtectionUK=document.querySelector(".pps-top-bar-mobile")),this.playerProtectionUK&&(n=this.playerProtectionUK.clientHeight,this.background.style.top=n?n+"px":0))},onResize:function(){var n=document.getElementById("mask"),t,i;if(n){if(PlatformManager.isIosVersionInBlackList()&&!PlatformManager.checkIosChrome()&&window.innerHeight>=window.innerWidth){n.style.removeProperty("height");return}n.style.height=window.innerHeight*3+"px"}t=39;i=window.orientation===90||window.orientation===270||window.orientation===-90?window.screen.width-window.innerHeight<=t:window.screen.height-window.innerHeight<=t;i?(window.scroll(0,window.innerHeight),window.addEventListener("scroll",this.onScroll)):(this.allowScrollToFullscreen=!0,window.removeEventListener("scroll",this.onScroll))},onScroll:function(){var n=document.documentElement,t=(window.pageYOffset||n.scrollTop)-(n.clientTop||0);t!==window.innerHeight&&this.allowScrollToFullscreen===!0?(window.scroll(0,window.innerHeight),this.allowScrollToFullscreen=!0):(this.allowScrollToFullscreen=!1,window.removeEventListener("scroll",this.onScroll))},onTouchStart:function(n){n.touches.length>1&&n.preventDefault()},onTouchMove:function(n){n.touches.length>1&&n.preventDefault()}},isStandalone:function(){return this.embedMode==="iframe"?!0:window.navigator.standalone},collectWebGlInfo:function(){try{var t={platform:navigator.platform,userAgent:navigator.userAgent},e,i=document.createElement("canvas"),n;function u(t,i,r){return n=t.getContext(i,{stencil:r}),e=i,!!n}function r(n){return"["+n[0]+", "+n[1]+"]"}function l(){var i=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic"),t;return i?(t=n.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT),t===0&&(t=2),t):"n/a"}function o(n,t){return t?""+Math.pow(2,n):"2^"+n}function f(n,t){var i=t?" bit mantissa":"";return"[-"+o(n.rangeMin,t)+", "+o(n.rangeMax,t)+"] ("+n.precision+i+")"}function s(t){var i=n.getShaderPrecisionFormat(t,n.HIGH_FLOAT),r=n.getShaderPrecisionFormat(t,n.MEDIUM_FLOAT),e=n.getShaderPrecisionFormat(t,n.LOW_FLOAT),u=i;return i.precision===0&&(u=r),"High: "+f(i,!0)+" Medium: "+f(r,!0)+" Low: "+f(e,!0)+f(u,!1)}function a(n){var t=n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT),i=t.precision!==0?"highp/":"mediump/";return t=n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT),i+(t.rangeMax!==0?"highp":"lowp")}function h(n){return n!==0&&(n&n-1)==0}function v(n){var t=r(n.getParameter(n.ALIASED_LINE_WIDTH_RANGE)),i=(navigator.platform==="Win32"||navigator.platform==="Win64")&&n.getParameter(n.RENDERER)!=="Internet Explorer"&&n.getParameter(n.RENDERER)!=="Microsoft Edge"&&t===r([1,1]);return i?h(n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS))&&h(n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS))?"Yes, D3D11":"Yes, D3D9":"No"}function y(){var n=document.createElement("canvas"),t=n.getContext(e,{failIfMajorPerformanceCaveat:!0});return(n.remove(),!t)?"Yes":typeof t.getContextAttributes().failIfMajorPerformanceCaveat=="undefined"?"Not implemented":"No"}function p(n){var t=1,i=n.getExtension("WEBGL_draw_buffers");return i!=null&&(t=n.getParameter(i.MAX_DRAW_BUFFERS_WEBGL)),t}function c(n){var t={renderer:"",vendor:""},i=n.getExtension("WEBGL_debug_renderer_info");return i!=null&&(t.renderer=n.getParameter(i.UNMASKED_RENDERER_WEBGL),t.vendor=n.getParameter(i.UNMASKED_VENDOR_WEBGL)),t}return(u(i,"webgl",!0)||u(i,"experimental-webgl",!0)||u(i,"webgl",!1)||u(i,"experimental-webgl",!1),i.remove(),!n)?"Browser supports WebGL but initialization failed":(t.contextName=e,t.glVersion=n.getParameter(n.VERSION),t.shadingLanguageVersion=n.getParameter(n.SHADING_LANGUAGE_VERSION),t.vendor=n.getParameter(n.VENDOR),t.renderer=n.getParameter(n.RENDERER),t.unMaskedVendor=c(n).vendor,t.unMaskedRenderer=c(n).renderer,t.antialias=n.getContextAttributes().antialias?"Available":"Not available",t.angle=v(n),t.majorPerformanceCaveat=y(),t.maxColorBuffers=p(n),t.redBits=n.getParameter(n.RED_BITS),t.greenBits=n.getParameter(n.GREEN_BITS),t.blueBits=n.getParameter(n.BLUE_BITS),t.alphaBits=n.getParameter(n.ALPHA_BITS),t.depthBits=n.getParameter(n.DEPTH_BITS),t.stencilBits=n.getParameter(n.STENCIL_BITS),t.maxRenderBufferSize=n.getParameter(n.MAX_RENDERBUFFER_SIZE),t.maxCombinedTextureImageUnits=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS),t.maxCubeMapTextureSize=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),t.maxFragmentUniformVectors=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),t.maxTextureImageUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),t.maxTextureSize=n.getParameter(n.MAX_TEXTURE_SIZE),t.maxVaryingVectors=n.getParameter(n.MAX_VARYING_VECTORS),t.maxVertexAttributes=n.getParameter(n.MAX_VERTEX_ATTRIBS),t.maxVertexTextureImageUnits=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),t.maxVertexUniformVectors=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),t.aliasedLineWidthRange=r(n.getParameter(n.ALIASED_LINE_WIDTH_RANGE)),t.aliasedPointSizeRange=r(n.getParameter(n.ALIASED_POINT_SIZE_RANGE)),t.maxViewportDimensions=r(n.getParameter(n.MAX_VIEWPORT_DIMS)),t.maxAnisotropy=l(),t.vertexShaderBestPrecision=s(n.VERTEX_SHADER),t.fragmentShaderBestPrecision=s(n.FRAGMENT_SHADER),t.fragmentShaderFloatIntPrecision=a(n),t.extensions=n.getSupportedExtensions(),t)}catch(w){return{unexpectedError:w}}},log:function(n){this.configuration.debug&&console.log(n)}};LauncherMessage.prototype.onExit=function(){if(this.channel==="mobile"){var n=this.lobbyUrl;n!==""?location.href=n:history.back()}else this.msgBox.parentElement.removeChild(this.msgBox)};LauncherMessage.prototype.remove=function(){if(typeof PngPreloader!="undefined")PngPreloader.onLauncherMessage(!1);this.msgBox&&this.msgBox.parentElement&&this.msgBox.parentElement.removeChild(this.msgBox)};Engage={debug:!1,state:-1,gameStateVariables:{freeGameStarted:!1},mainLoopInterval:undefined,redirectUrl:undefined,modules:[],initialized:!1,inGameMessageQueue:[],requestQueue:[],gameHostInterface:undefined,gameCalls:undefined,iframeCom:undefined,iframeOverlayUrl:undefined,cleanup:function(){this.dispatchEvent({type:"cleanup"});this.initialized&&(this.gameCalls=undefined,clearInterval(this.mainLoopInterval),this.mainLoopInterval=undefined,this.requestQueue.length=0,this.inGameMessageQueue.length=0,this.initialized=!1,this.removeAllEventListeners())},init:function(n,t){return this.gameHostInterface=n||extcom,this.registerGameListeners(),t&&t!==""&&(this.iframeOverlayUrl=t,this.iframeCom.init(this.request.bind(this))),this.initialized=!0,this.mainLoopInterval=setInterval(this.mainLoop.bind(this),100),this.state=Engage.CANSHOWMESSAGE,this.dispatchEvent({type:"initialized"}),this.initialized},registerGameListeners:function(){var n;if(typeof this.gameHostInterface=="object"||typeof this.gameHostInterface=="function"){for(this.gameCalls=this.gameHostInterface.gameCalls(),n=0;n<this.internalGenericGameEvents.length;n++)this.log(this.gameHostInterface.addEventListener(this.internalGenericGameEvents[n],this.parseGameMessage.bind(this)));for(n=0;n<this.internalVideoSlotGameEvents.length;n++)this.log(this.gameHostInterface.addEventListener(this.internalVideoSlotGameEvents[n],this.parseGameMessage.bind(this)))}else this.log("extcom object not defined. External communictation in game not accessible")},internalGenericGameEvents:["LOADER","GAME_READY","GAME_IDLE","LOGOUT","LOGINANSWER","LOGOUTANSWER","round_start","round_end","round_balance","round_win","SESSIONRESPONSE","UIHELP","UIPLAYFORREAL","PAYTABLE_CHANGED","UIHISTORY","CURRENCY","PLAYFORREAL","RECONNECTEND","MESSAGE","BET","BALANCE","AVAILABLE_COINS","SELECTED_COIN","SELECTED_COIN_VALUE","BET_UPDATE","AVAILABLE_COIN_VALUES","WIN","WIN_SHOW","WIN_PAYLINE","ACTIVE_CARDS","GAME_SCREEN_ENABLED","GAME_SCREEN_DISABLED","RELOAD_GAME","EXTERNAL_MESSAGE_OK","EXTERNAL_MESSAGE_EXIT","EXTERNAL_MESSAGE_ACTION","SERVERMESSAGE","REALITYCHECKEVENT","SPLASH_SHOW","SPLASH_HIDE","SOUND_ON","SOUND_OFF","FASTPLAY_ON","FASTPLAY_OFF","LEFTHANDMODE_ON","LEFTHANDMODE_OFF","MODAL_SHOWING","MODAL_HIDING","JP_POPUP_SHOWING","JP_POPUP_HIDING","LOADER_CRITICAL_ERROR","JACKPOT_WIN","SESSIONTOKEN"],internalVideoSlotGameEvents:["UISPIN","AUTOPLAY_STARTED","AUTOPLAY_TRIGGER","AUTOPLAY_ENDED","AUTOPLAYS_LEFT","FREESPIN_START","FREESPIN_END","BONUS_STARTED","BONUS_ENDED","SELECTED_LINES","AVAILABLE_LINES","GAMBLE_ANSWER","UIGAMBLE","UICOLLECT","FREEGAMEMESSAGE","SPIN_START","REEL_ALL_STOPPED","GAMBLE_AVAILABLE","UIEXTRABALL_AVAILABLE","extraball_on_select_event","FREEGAME_START","FREEGAME_END","FREEGAME_LOGOUT","WIN_START"],allowedRequests:["gameDisable","gameEnable","gameEnd","refreshBalance","externalBalance","inGameMessage","inGameMessageOk","inGameMessageAction","inGameMessageExit","modalOk","modalCancel","modalExit","stopAutoplay","logout","soundOn","soundOff","showHelp","openGameHelp","setCoins","setCoinValue","setLines","incCoins","decCoins","incCoinValue","decCoinValue","incLines","decLines","togglePaytable","betMax","spin","gamble","collect","autoPlay","setFastplay","getFastplay","setLeftHandMode","getLeftHandMode","pause","getBet","getBalance","getWin","getAvailableCoins","getAvailableCoinValues","getSelectedLines","getAvailableLines","getSelectedCoin","getSelectedCoinValue","getActiveCards","getAutoplaysLeft","closeMysteryJackpotPopup","buyExtraBall","externalMessageHandled","openSettings"],allowedRequest:function(n){for(var t=0;t<this.allowedRequests.length;t++)if(this.allowedRequests[t]===n)return!0;return!1},request:function(n){if(this.initialized===!1){this.log("Engage is not yet initialized! Waiting for game to be ready");return}if(this.iframeCom&&n.addEvent)this.log("Engage: Processing Received addEvent: "+n.addEvent),this.addEventListener(n.addEvent);else if(n.req)if(this.log("Engage: Processing external request","%c"+n.req,"background: #222; color: yellow"),this.allowedRequest(n.req)){this.requestQueue.push(n.req);switch(n.req){case"gameDisable":this.stopAutoPlay();break;case"gameEnd":n.data&&(this.redirectUrl=n.data.redirectUrl);this.logout();break;case"logout":this.logout();break;case"refreshBalance":this.refreshInGameBalance();break;case"externalBalance":this.externalInGameBalance(n.balance);break;case"inGameMessage":this.inGameMessageQueue.push(n);break;case"inGameMessageOk":this.inGameMessageOk(n.data.id);break;case"inGameMessageAction":this.inGameMessageAction(n.data.id);break;case"inGameMessageExit":this.inGameMessageExit(n.data.id);break;case"modalOk":this.modalOk();break;case"modalCancel":this.modalCancel();break;case"modalExit":this.modalExit();break;case"stopAutoplay":this.stopAutoPlay();break;case"soundOn":this.soundOn();break;case"soundOff":this.soundOff();break;case"setCoins":this.setCoins(n);break;case"setCoinValue":this.setCoinValue(n);break;case"setLines":this.setLines(n);break;case"togglePaytable":this.togglePaytable(n.data.pageNum);break;case"betMax":this.betMax();break;case"spin":this.spin();break;case"gamble":this.gamble(n);break;case"collect":this.collect();break;case"pause":this.pause(n.data.pause);break;case"autoPlay":this.autoPlay(n);break;case"getBet":this.getBet();break;case"getBalance":this.getBalance();break;case"getWin":this.getWin();break;case"getAvailableCoins":this.getAvailableCoins();break;case"getAvailableCoinValues":this.getAvailableCoinValues();break;case"getSelectedLines":this.getSelectedLines();break;case"getAvailableLines":this.getAvailableLines();break;case"getActiveCards":this.getActiveCards();break;case"getSelectedCoin":this.getSelectedCoin();break;case"getSelectedCoinValue":this.getSelectedCoinValue();break;case"getAutoplaysLeft":this.getAutoplaysLeft();break;case"incCoins":this.incCoins();break;case"decCoins":this.decCoins();break;case"incCoinValue":this.incCoinValue();break;case"decCoinValue":this.decCoinValue();break;case"incLines":this.incLines();break;case"decLines":this.decLines();break;case"showHelp":case"openGameHelp":this.showHelp();break;case"setFastplay":this.setFastPlay(n);break;case"getFastplay":this.getFastPlay();break;case"setLeftHandMode":this.setLeftHandMode(n.data.value);break;case"getLeftHandMode":this.getLeftHandMode();break;case"closeMysteryJackpotPopup":this.closeMysteryJackpotPopup();break;case"buyExtraBall":this.buyExtraBall();break;case"externalMessageHandled":this.externalMessageHandled();break;case"openSettings":this.openSettings()}}else this.log("ERROR! "+n.req+" is not a supported request"),this.dispatchEvent({type:"error",msg:n.req+" is not a supported request"});for(var i,t=0;t<this.modules.length;t++)i=this.modules[t].request(n),i!=undefined&&this.dispatchEvent(i)},mainLoop:function(){switch(this.requestQueue[0]){case"gameDisable":this.state===Engage.CANSHOWMESSAGE&&(this.stopAutoPlay(),this.disableGame(),this.iframeCom.initialized&&(this.iframeCom.setIframeInteractive(!0),this.iframeCom.frame.style.display="block",this.iframeCom.dispatchMessage({type:"gameDisabled"})),this.requestQueue.shift());break;case"gameEnable":this.enableGame();this.iframeCom.initialized&&(this.iframeCom.setIframeInteractive(!1),this.iframeCom.frame.style.display="none",this.iframeCom.dispatchMessage({type:"gameEnabled"}),window.focus());this.requestQueue.shift();break;case"inGameMessage":if(this.state===Engage.CANSHOWMESSAGE){var n=this.inGameMessageQueue[0];this.inGameMessage(n.data);this.dispatchEvent({type:"inGameMessageShowing"});this.inGameMessageQueue.shift();this.requestQueue.shift()}break;default:this.requestQueue.shift()}},parseGameMessage:function(n){this.initialized||this.init();switch(n.type){case"GAME_SCREEN_ENABLED":this.processGameMessage("gameEnabled");break;case"GAME_SCREEN_DISABLED":this.processGameMessage("gameDisabled");break;case"round_start":n._inGame&&(this.processGameMessage("running"),this.processGameMessage("roundStarted"));break;case"round_end":this.processGameMessage("gameIdle");this.processGameMessage("roundEnded");break;case"GAME_READY":this.gameCalls.STOP_AUTOPLAY||(this.stopAutoPlay=function(){});this.processGameMessage("gameReady");break;case"GAME_IDLE":this.processGameMessage("gameIdle");break;case"LOGOUTANSWER":case"LOGOUT":this.processGameMessage("logout");switch(n.reason){case"Exit":case"Script":case"ServerMessage":this.processGameMessage("backToLobby")}break;case"round_balance":this.processGameMessage("balanceUpdate",n);break;case"SPIN_START":this.processGameMessage("spinStarted");break;case"REEL_ALL_STOPPED":this.processGameMessage("spinEnded");break;case"WIN_PAYLINE":this.processGameMessage("paylineWin",n);break;case"round_win":n._amount>0&&this.processGameMessage("roundWin",n);break;case"AUTOPLAY_STARTED":this.processGameMessage("autoplayStarted",n);break;case"AUTOPLAY_TRIGGER":this.processGameMessage("autoplayNextRound",n);break;case"AUTOPLAY_ENDED":this.processGameMessage("autoplayEnded",n);break;case"AUTOPLAYS_LEFT":n._amount>=0&&this.processGameMessage("autoplaysLeft",{autoplaysLeft:n._amount});break;case"FREESPIN_START":this.processGameMessage("freespinStarted",n);break;case"FREESPIN_END":this.processGameMessage("freespinEnded",n);break;case"BONUS_STARTED":this.processGameMessage("bonusGameStarted",n);break;case"BONUS_ENDED":this.processGameMessage("bonusGameEnded",n);break;case"EXTERNAL_MESSAGE_OK":this.processGameMessage("externalMessageOk",n);break;case"EXTERNAL_MESSAGE_EXIT":this.processGameMessage("externalMessageExit",n);break;case"EXTERNAL_MESSAGE_ACTION":this.processGameMessage("externalMessageAction",n);break;case"UIGAMBLE":this.processGameMessage("gambleStarted");break;case"GAMBLE_AVAILABLE":this.processGameMessage("gambleAvailable");break;case"UICOLLECT":this.processGameMessage("gambleEnded");break;case"GAMBLE_ANSWER":n._winCode>0?this.processGameMessage("gambleWon"):(this.processGameMessage("gambleLost"),this.processGameMessage("gambleEnded"));break;case"RELOAD_GAME":this.processGameMessage("reloadGame");break;case"SESSIONRESPONSE":this.processGameMessage("sessionID",n);break;case"SETTINGS":this.processGameMessage("settings",n);break;case"SOUND_ON":this.processGameMessage("soundOn");break;case"SOUND_OFF":this.processGameMessage("soundOff");break;case"FASTPLAY_ON":this.processGameMessage("fastPlayOn");break;case"FASTPLAY_OFF":this.processGameMessage("fastPlayOff");break;case"LEFTHANDMODE_ON":this.processGameMessage("leftHandModeOn");break;case"LEFTHANDMODE_OFF":this.processGameMessage("leftHandModeOff");break;case"PAYTABLE_CHANGED":this.processGameMessage("paytableChanged",n);break;case"UIPLAYFORREAL":case"PLAYFORREAL":this.processGameMessage("playForReal");break;case"LOADER":n._id===6?this.processGameMessage("gameError",{_titleText:"Loader error",_messageText:"An error occured while loading a resource. Retrying...",id:9}):this.processGameMessage("loader",n);break;case"LOADER_CRITICAL_ERROR":this.processGameMessage("gameError",{_titleText:"Critical loader error",_messageText:"An error occured while loading a resource. code: "+n._data.code,id:10});break;case"RECONNECTEND":this.processGameMessage("reconnectend");break;case"CURRENCY":break;case"HANDLE_GAME_ERROR":arguments[1][1]>0&&this.processGameMessage("gameError",n);break;case"REALITYCHECKEVENT":this.processGameMessage("realitycheckevent",n);break;case"FREEGAMEMESSAGE":case"SERVERMESSAGE":case"MESSAGE":arguments[0]._flags===4?this.processGameMessage("gameError",n):this.processGameMessage("message",n);break;case"BET":this.processGameMessage("bet",n);break;case"BALANCE":this.processGameMessage("balance",n);break;case"WIN_START":this.processGameMessage("winStart");break;case"WIN_SHOW":this.processGameMessage("winShow",n);break;case"WIN":this.processGameMessage("win",n);break;case"UIHELP":this.processGameMessage("gameHelpOpened",n);break;case"UIHISTORY":this.processGameMessage("gameHistoryOpened",n);break;case"AVAILABLE_COINS":this.processGameMessage("availableCoins",n);break;case"SPLASH_SHOW":this.processGameMessage("splashShow",n);break;case"SPLASH_HIDE":this.processGameMessage("splashHide",n);break;case"AVAILABLE_COIN_VALUES":this.processGameMessage("availableCoinValues",n);break;case"SELECTED_LINES":this.processGameMessage("selectedLines",n);break;case"AVAILABLE_LINES":this.processGameMessage("availableLines",n);break;case"ACTIVE_CARDS":this.processGameMessage("activeCards",n);break;case"SELECTED_COIN":this.processGameMessage("selectedCoin",n);break;case"SELECTED_COIN_VALUE":this.processGameMessage("selectedCoinValue",n);break;case"JACKPOT_WIN":this.processGameMessage("jackpotWin",n);break;case"BET_UPDATE":this.processGameMessage("betUpdated",n);break;case"MODAL_SHOWING":this.processGameMessage("modalShowing",n);break;case"MODAL_HIDING":this.processGameMessage("modalHiding",n);break;case"JP_POPUP_SHOWING":this.processGameMessage("jackpotPopupShowing",n);break;case"JP_POPUP_HIDING":this.processGameMessage("jackpotPopupHiding",n);break;case"UIEXTRABALL_AVAILABLE":this.processGameMessage("extraballAvailable");break;case"extraball_on_select_event":this.processGameMessage("extraballBought");break;case"FREEGAME_START":n._resumed===!1&&(this.gameStateVariables.freeGameStarted=!0,this.processGameMessage("freeGameStarted"));this.gameStateVariables.freeGameStarted===!1&&n._resumed===!0&&(this.gameStateVariables.freeGameStarted=!0,this.processGameMessage("freeGameResumed"));break;case"FREEGAME_END":case"FREEGAME_LOGOUT":this.processGameMessage("freeGameEnded");break;default:this.log("%cEngage: game event",n.type,"is not defined and will not be passed to Engage","background: #222; color: white")}},gambleModeStarted:!1,processGameMessage:function(n,t){this.log("Processing game message: "+n);var i={type:n};switch(n){case"jackpotWin":i.jackpotWin=t._amountInMoney;i.currency=t._currency;break;case"loader":i.loader=t;break;case"gameIdle":this.state=Engage.CANSHOWMESSAGE;break;case"gambleStarted":this.state=Engage.GAMEROUNDACTIVE;this.gambleModeStarted=!0;break;case"gambleEnded":this.gambleModeStarted!==!0&&(i.type="");this.gambleModeStarted=!1;break;case"running":this.state=Engage.GAMEROUNDACTIVE;break;case"logout":this.redirectUrl!=undefined&&(location.href=this.redirectUrl);break;case"balanceUpdate":i.rawBalance=t._amount;i.currency=t._currency;i.data={rawBalance:t._amount,currency:t._currency};break;case"balance":i.data={};t._amount>=0&&(i.data.BalanceInCoins=t._amount);i.data.BalanceInMoney=t._amountInMoney;i.data.Currency=t._currency;break;case"bet":case"betUpdated":i.data={};t._amount>=0&&(i.data.BetInCoins=t._amount);i.data.BetInMoney=t._amountInMoney;i.data.Currency=t._currency;t._lines>=0&&(i.data.Lines=t._lines);t._coins>=0&&(i.data.Coins=t._coins);t._denomination>=0&&(i.data.CoinValue=t._denomination);break;case"win":i.data={};t._amount>=0&&(i.data.WinInCoins=t._amount);i.data.WinInMoney=t._amountInMoney;i.data.Currency=t._currency;break;case"paytableChanged":i.data={PageNum:t._pageNum,Visible:t._visible};break;case"roundWin":i.winAmount=t._amount;i.data=t._amount;break;case"winShow":i.data={};t._winData._line>=0?(i.data.type="lineWin",i.data.winData=t._winData):(i.data.type="scatterWin",i.data.winData=t._winData);break;case"availableLines":case"availableCoins":case"selectedLines":case"activeCards":case"selectedCoin":i.data=t._amount;break;case"selectedCoinValue":i.data={amount:t._amount,amountInMoney:t._amountInMoney};break;case"availableCoinValues":i.data=t._denom;break;case"externalMessageOk":case"externalMessageExit":case"externalMessageAction":i.id=t._id;break;case"autoplayStarted":i.data={numAutoplay:t.playsLeft};break;case"autoplayNextRound":i.data={numAutoplayLeft:t.playsLeft};break;case"autoplaysLeft":i.data={numAutoplayLeft:t.autoplaysLeft};break;case"realitycheckevent":i.data={type:t.type,bet:t._bet,minutes:t._minutes,win:t._win};break;case"message":case"gameError":i.data={title:t._titleText,message:t._messageText,internalId:t.id};break;case"settings":return;case"modalShowing":i.buttons={ok:t.ok,cancel:t.cancel,exit:t.exit};break;case"bonusGameStarted":i.data={bonusSymbol:t.bonusSymbol}}this.dispatchEvent(i)},inGameMessage:function(n){this.gameCalls.EXTERNAL_MESSAGE?(n.exitBtn==undefined&&(n.exitBtn=""),n.actionBtn==undefined&&(n.actionBtn=""),this.gameCalls.EXTERNAL_MESSAGE(n)):(this.log("Warning! ExternalMessage is not a registred in GAME"),this.dispatchEvent({type:"error",msg:"ExternalMessage is not a registred in GAME"}))},inGameMessageOk:function(n){this.gameCalls.EX_MESSAGE_OK(n)},inGameMessageAction:function(n){this.gameCalls.EX_MESSAGE_ACTION(n)},inGameMessageExit:function(n){this.gameCalls.EX_MESSAGE_EXIT(n)},modalOk:function(){this.gameCalls.MODAL_OK()},modalCancel:function(){this.gameCalls.MODAL_CANCEL()},modalExit:function(){this.gameCalls.MODAL_EXIT()},externalMessageHandled:function(){this.gameCalls.EXTERNAL_MESSAGE_CLOSE()},openSettings:function(){this.gameCalls.OPEN_SETTINGS()},disableGame:function(){this.gameCalls.DISABLE_SCREEN?this.gameCalls.DISABLE_SCREEN(!0):(this.log("Warning! DisableGame is not a registred in GAME"),this.dispatchEvent({type:"error",msg:"DisableGame is not a registred in GAME"}))},enableGame:function(){this.gameCalls.ENABLE_SCREEN?this.gameCalls.ENABLE_SCREEN(!1):(this.log("Warning! EnableGame is not a registred in GAME"),this.dispatchEvent({type:"error",msg:"EnableGame is not a registred in GAME"}))},disableUI:function(){return this.gameCalls.DISABLE_BUTTONS?(this.gameCalls.DISABLE_BUTTONS(),!0):(this.disableGame(),!1)},enableUI:function(){return this.gameCalls.ENABLE_BUTTONS?(this.gameCalls.ENABLE_BUTTONS(),!0):(this.enableGame(),!1)},logout:function(){this.gameCalls.LOGOUT?this.gameCalls.LOGOUT():(this.log("Warning! Logout is not a registred in GAME"),this.dispatchEvent({type:"error",msg:"Logout is not a registred in GAME"}))},stopAutoPlay:function(){this.gameCalls.STOP_AUTOPLAY?this.gameCalls.STOP_AUTOPLAY():(this.log("Warning! StopAutoplay is not a registred in GAME"),this.dispatchEvent({type:"error",msg:"StopAutoplay is not a registred in GAME"}))},refreshInGameBalance:function(){this.gameCalls.BALANCE_UPDATE?this.gameCalls.BALANCE_UPDATE():(this.log("Warning! RefreshBalance is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" RefreshBalance is not a registred in GAME"}))},externalInGameBalance:function(n){this.gameCalls.EXTERNAL_BALANCE_UPDATE?this.gameCalls.EXTERNAL_BALANCE_UPDATE({balance:n,inGame:!0}):(this.log("Warning! externalInGameBalance is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" externalInGameBalance is not a registred in GAME"}))},getBalance:function(){this.gameCalls.GET_BALANCE?this.gameCalls.GET_BALANCE():(this.log("Warning! GetBalance is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GetBalance is not a registred in GAME"}))},getBet:function(){this.gameCalls.GET_BET?this.gameCalls.GET_BET():(this.log("Warning! GetBet is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GetBet is not a registred in GAME"}))},getWin:function(){this.gameCalls.GET_WIN?this.gameCalls.GET_WIN():(this.log("Warning! GetWin is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GetWin is not a registred in GAME"}))},getSelectedCoin:function(){this.gameCalls.GET_SELECTED_COIN?this.gameCalls.GET_SELECTED_COIN():(this.log("Warning! GetSelectedCoin is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GetSelectedCoin is not a registred in GAME"}))},getSelectedCoinValue:function(){this.gameCalls.GET_SELECTED_COIN_VALUE?this.gameCalls.GET_SELECTED_COIN_VALUE():(this.log("Warning! GetSelectedCoinValue is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GetSelectedCoinValue is not a registred in GAME"}))},getSelectedLines:function(){this.gameCalls.GET_SELECTED_LINES?this.gameCalls.GET_SELECTED_LINES():(this.log("Warning! GetSelectedLines is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GetSelectedLines is not a registred in GAME"}))},getAvailableLines:function(){this.gameCalls.GET_AVAILABLE_LINES?this.gameCalls.GET_AVAILABLE_LINES():(this.log("Warning! GET_AVAILABLE_LINES is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GET_AVAILABLE_LINES is not a registred in GAME"}))},getAvailableCoins:function(){this.gameCalls.GET_AVAILABLE_COINS?this.gameCalls.GET_AVAILABLE_COINS():(this.log("Warning! GetAvailableCoins is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GetAvailableCoins is not a registred in GAME"}))},getAvailableCoinValues:function(){this.gameCalls.GET_AVAILABLE_COIN_VALUES?this.gameCalls.GET_AVAILABLE_COIN_VALUES():(this.log("Warning! GetAvailableCoinValues is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GetAvailableCoinValues is not a registred in GAME"}))},getAutoplaysLeft:function(){this.gameCalls.GET_AP_LEFT?this.gameCalls.GET_AP_LEFT():(this.log("Warning! getAutoplaysLeft is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" getAutoplaysLeft is not a registred in GAME"}))},getActiveCards:function(){this.gameCalls.GET_ACTIVE_CARDS?this.gameCalls.GET_ACTIVE_CARDS():(this.log("Warning! GetActiveCards is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GetActiveCards is not a registred in GAME"}))},getLocalizedString:function(n){if(this.gameCalls.GET_LOCALIZED_STRING)return this.gameCalls.GET_LOCALIZED_STRING(n);this.log("Warning! GetLocalizedString is not a registred in GAME");this.dispatchEvent({type:"error",msg:" GetLocalizedString is not a registred in GAME"})},soundOn:function(){this.gameCalls.SET_SOUND?this.gameCalls.SET_SOUND(1):(this.log("Warning! SetSound is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" SetSound is not a registred in GAME"}))},soundOff:function(){this.gameCalls.SET_SOUND?this.gameCalls.SET_SOUND(0):(this.log("Warning! SetSound is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" SetSound is not a registred in GAME"}))},setCoins:function(n){this.gameCalls.SET_COINS?this.gameCalls.SET_COINS(n.data):(this.log("Warning! SetCoin is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" SetCoin is not a registred in GAME"}))},setCoinValue:function(n){this.gameCalls.SET_COIN_VALUE?this.gameCalls.SET_COIN_VALUE(n.data):(this.log("Warning! SetCoinValue is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" SetCoinValue is not a registred in GAME"}))},setLines:function(n){this.gameCalls.SET_LINES?this.gameCalls.SET_LINES(n.data):(this.log("Warning! SetLines is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" SetLines is not a registred in GAME"}))},incCoins:function(){this.gameCalls.INC_COINS?this.gameCalls.INC_COINS():(this.log("Warning! INC_COINS is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" INC_COINS is not a registred in GAME"}))},decCoins:function(){this.gameCalls.DEC_COINS?this.gameCalls.DEC_COINS():(this.log("Warning! DEC_COINS is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" DEC_COINS is not a registred in GAME"}))},incCoinValue:function(){this.gameCalls.INC_COIN_VALUE?this.gameCalls.INC_COIN_VALUE():(this.log("Warning! INC_COIN_VALUE is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" INC_COIN_VALUE is not a registred in GAME"}))},decCoinValue:function(){this.gameCalls.DEC_COIN_VALUE?this.gameCalls.DEC_COIN_VALUE():(this.log("Warning! DEC_COIN_VALUE is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" DEC_COIN_VALUE is not a registred in GAME"}))},incLines:function(){this.gameCalls.INC_LINES?this.gameCalls.INC_LINES():(this.log("Warning! INC_LINES is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" INC_LINES is not a registred in GAME"}))},decLines:function(){this.gameCalls.DEC_LINES?this.gameCalls.DEC_LINES():(this.log("Warning! DEC_LINES is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" DEC_LINES is not a registred in GAME"}))},togglePaytable:function(n){this.gameCalls.TOGGLE_PAYTABLE?this.gameCalls.TOGGLE_PAYTABLE(n):(this.log("Warning! TogglePaytable is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" TOGGLE_PAYTABLE is not a registred in GAME"}))},showHelp:function(){this.gameCalls.OPEN_GAMEHELP?this.gameCalls.OPEN_GAMEHELP():(this.log("Warning! OPEN_GAMEHELP is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" OPEN_GAMEHELP is not a registred in GAME"}))},betMax:function(){this.gameCalls.BET_MAX?this.gameCalls.BET_MAX():(this.log("Warning! BetMax is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" BetMax is not a registred in GAME"}))},spin:function(){this.gameCalls.SPIN?this.gameCalls.SPIN():(this.log("Warning! Spin is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" Spin is not a registred in GAME"}))},gamble:function(n){this.gameCalls.GAMBLE?n.data?this.gameCalls.GAMBLE(n.data):this.gameCalls.GAMBLE():(this.log("Warning! Gamble is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" Gamble is not a registred in GAME"}))},collect:function(){this.gameCalls.COLLECT?this.gameCalls.COLLECT():(this.log("Warning! Collect is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" Collect is not a registred in GAME"}))},pause:function(n){this.gameCalls.PAUSE?this.gameCalls.PAUSE(n):(this.log("Warning! Pause is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" Pause is not a registred in GAME"}))},autoPlay:function(n){this.gameCalls.AUTOPLAY?n.data?this.gameCalls.AUTOPLAY(n.data):this.gameCalls.AUTOPLAY():(this.log("Warning! AutoPlay is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" AutoPlay is not a registred in GAME"}))},setFastPlay:function(n){this.gameCalls.SET_FASTPLAY?this.gameCalls.SET_FASTPLAY(n.data.value):(this.log("Warning! SET_FASTPLAY is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" SET_FASTPLAY is not a registred in GAME"}))},getFastPlay:function(){this.gameCalls.GET_FASTPLAY?this.gameCalls.GET_FASTPLAY():(this.log("Warning! GET_FASTPLAY is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GET_FASTPLAY is not a registred in GAME"}))},setLeftHandMode:function(n){this.gameCalls.SET_LEFTHAND_MODE?this.gameCalls.SET_LEFTHAND_MODE(n):(this.log("Warning! SET_LEFTHAND_MODE is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" SET_LEFTHAND_MODE is not a registred in GAME"}))},getLeftHandMode:function(){this.gameCalls.GET_LEFTHAND_MODE?this.gameCalls.GET_LEFTHAND_MODE():(this.log("Warning! GET_LEFTHAND_MODE is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" GET_LEFTHAND_MODE is not a registred in GAME"}))},closeMysteryJackpotPopup:function(){this.gameCalls.CLOSE_MJP_POPUP?this.gameCalls.CLOSE_MJP_POPUP():(this.log("Warning! CLOSE_MJP_POPUP is not a registred in GAME"),this.dispatchEvent({type:"error",msg:" CLOSE_MJP_POPUP is not a registred in GAME"}))},buyExtraBall:function(){this.gameCalls.BUY_EXTRA_BALL?this.gameCalls.BUY_EXTRA_BALL():(this.log("Warning! BUY_EXTRA_BALL is not registered in GAME"),this.dispatchEvent({type:"errore",msg:"BUY_EXTRA_BALL is not registered in GAME"}))},parseSettings:function(n){var t,i;if(this.lastSettings===undefined){this.lastSettings={};for(key in n.settings)key!="children"&&(this.lastSettings[key]=n.settings[key]);return}t=[];for(key in n.settings)(key!=="children"||key!=="_children")&&key[0]==="_"&&this.lastSettings[key]!=n.settings[key]&&t.push({id:key,newVal:n.settings[key]});if(this.lastSettings===undefined){this.lastSettings=n;return}for(i=0;i<t.length;i++)this.onSettingsChange(t[i]);for(key in n.settings)key!="children"&&(this.lastSettings[key]=n.settings[key])},onSettingsChange:function(n){this.log("Settings changed: "+n.id);this.dispatchEvent({type:n.id,data:n.newVal})},listeners:{},addEventListener:function(n,t){var i={type:n},r;this.listeners[i.type]||(this.listeners[i.type]=[]);r=this.listeners[i.type];r.indexOf(t)===-1&&r.push(t)},removeEventListener:function(n,t){var u={type:n},i=this.listeners[u.type],r;i&&(r=i.indexOf(t),r!==-1&&i.splice(r,1))},removeAllEventListeners:function(){var n,t;for(n in this.listeners)if(this.listeners.hasOwnProperty(n)){for(t=0;t<this.listeners[n].length;t++)this.listeners[n][t]=undefined;this.listeners[n].length=0;delete this.listeners[n]}},dispatchEvent:function(n){var t,i;if(this.iframeCom.initialized&&(t=this.listeners[n.type],t&&this.iframeCom.dispatchMessage(n)),t=this.listeners[n.type],t)for(i=0;i<t.length;i++)typeof t[i]=="function"&&t[i](n)},registerModule:function(n){n.parent=this;this.modules.push(n)},enableDebug:function(){Engage.debug=!0},log:function(){var t,i,n;if(this.debug){for(t="",i="",n=0;n<arguments.length;n++)typeof arguments[n]=="string"&&arguments[n].match("background")?i=arguments[n]:t+=" "+arguments[n];console.log(t,i)}}};Engage.iframeCom={debug:!1,domain:undefined,source:undefined,targetOrigin:undefined,initialized:!1,frame:undefined,boundProcessMessage:undefined,cleanup:function(){this.boundProcessMessage&&(window.removeEventListener("message",this.boundProcessMessage,!1),this.boundProcessMessage=undefined);this.initialized=!1},init:function(n){this.cleanup();this.targetOrigin=Engage.iframeOverlayUrl;this.requestCallback=n;this.createIframe("msgIframe",this.parseTargetOriginUrl(this.targetOrigin));this.boundProcessMessage=this.processMessage.bind(this);window.addEventListener("message",this.boundProcessMessage,!1);this.initialized=!0},processMessage:function(n){this.requestCallback(n.data)},parseTargetOriginUrl:function(n){var r=n.match(/http/g),i,t;if(r==null){for(this.targetOrigin=window.location.origin+"/"+this.targetOrigin,i=this.targetOrigin+"?x=",t=0;t<Engage.modules.length;t++)Engage.modules[t].resolveParameters&&(i+=Engage.modules[t].resolveParameters());return i}return n},createIframe:function(n,t){this.frame=document.createElement("iframe");this.frame.id=n;this.frame.src=t;this.frame.scrolling="no";this.frame.style.position="fixed";this.frame.style.top="0px";this.frame.style.left="0px";this.frame.style.pointerEvents="none";this.frame.style.width="100%";this.frame.style.height="100%";this.frame.allowtransparency="true";this.frame.style.zIndex="999999999";this.frame.style.border="none";this.frame.style.display="none";document.body.appendChild(this.frame);this.source=this.frame.contentWindow;this.frame.onload=function(){this.dispatchMessage({type:"initialized"})}.bind(this)},setIframeInteractive:function(n){this.frame.style.pointerEvents=n?"all":"none"},dispatchMessage:function(n){this.source!=undefined?this.source.postMessage(n,this.targetOrigin):this.log("%cERROR! Iframe source is not defined! No message posted.","background: red; color: white")},log:function(){var t,i,n;if(this.debug){for(t="",i="",n=0;n<arguments.length;n++)typeof arguments[n]=="string"&&arguments[n].match("background")?i=arguments[n]:t+=" "+arguments[n];console.log(t,i)}},setDebug:function(n){this.debug=n;this.testModule=this.frame.contentWindow.EngageTestModule;this.dispatchMessage({type:"debug"})},dispatchGameEvent:function(n){var t=this.listeners[n.type];t?this.dispatchMessage(n):this.log("Engage: No external listener registred for event","%c"+n.type,"background: yellow; color: black")}};Engage.CANSHOWMESSAGE=0;Engage.GAMEROUNDACTIVE=1;PNGExternal=Engage;PNGHostInterface=Engage;Engage.RealityCheck={parent:undefined,request:function(n){switch(n.rcreq){case"getRCStrings":return{type:"rcStrings",data:{strings:this.getRCStrings()}};case"onGameEnd":n.data.redirectUrl!=""&&(window.location=n.data.redirectUrl);break;case"onAccountHistory":if(n.data.redirectUrl!="")if(n.data.urlMode=="samepage")window.location=n.data.redirectUrl;else{var t=window.open(n.data.redirectUrl,"_blank");t.focus()}break;default:return undefined}},getRCStrings:function(){!this.parent.gameHostInterface||!this.parent.gameHostInterface.GetLocalizedString;for(key in RCComponent.localizedStrings){var n=this.parent.getLocalizedString(RCComponent.localizedStrings[key]);n&&(RCComponent.localizedStrings[key]=n)}return RCComponent.localizedStrings}};Engage.registerModule(Engage.RealityCheck);RCComponent={debug:!1,proceedUrl:undefined,exitUrl:undefined,historyUrl:undefined,continueUrl:undefined,lobbyUrl:undefined,platform:undefined,historyUrlMode:undefined,brand:undefined,redirectUrl:undefined,startTime:0,initialSessionTime:undefined,rcIntervalTime:undefined,totalTime:0,showing:!1,messageData:{id:"",title:"",message:"",okBtn:"",exitBtn:"",actionBtn:"",redirect:!1},rcInterval:undefined,localizedStrings:{title:"IDS_RC_HEADING",playtime:"IDS_RC_PLAYTIME",minutes:"IDS_RC_MINUTES",continueorend:"IDS_RC_CONTINUE",btncontinue:"IDS_BTN_CONTINUE",btnexit:"IDS_BTN_EXIT",btnaccounthistory:"IDS_BTN_ACCOUNTHISTORY"},init:function(n){this.exitUrl=n.exitUrl;this.historyUrl=n.historyUrl;this.continueUrl=n.continueUrl;this.lobbyUrl=n.lobbyUrl;this.platform=n.platform;this.historyUrlMode=n.historyUrlMode;this.initialSessionTime=n.initialSessionTime;this.rcIntervalTime=n.rcIntervalTime;this.brand=n.brand;Engage.addEventListener("rcStrings",RCComponent.onEngageEvent.bind(RCComponent));Engage.addEventListener("loader",RCComponent.onEngageEvent.bind(RCComponent));Engage.addEventListener("externalMessageOk",RCComponent.onEngageEvent.bind(RCComponent));Engage.addEventListener("externalMessageExit",RCComponent.onEngageEvent.bind(RCComponent));Engage.addEventListener("externalMessageAction",RCComponent.onEngageEvent.bind(RCComponent))},setupTimeLogic:function(){this.totalTime=this.initialSessionTime*1e3;this.startTime=(new Date).getTime();var n=this.initialSessionTime%this.rcIntervalTime;n=this.rcIntervalTime-n;this.rcInterval=setTimeout(function(){RCComponent.onRealityCheck("activate")}.bind(this),n*1e3)},buildRealityCheckMessage:function(){var n,t=this.totalTime/1e3,i=this.secondsToHHMMSS(t),r=this.localizedStrings.playtime.replace("%d",i).replace("%x","").replace(".","");return n=r+"\n"+this.localizedStrings.continueorend,this.messageData.id="realitycheckmessage",this.messageData.title=this.localizedStrings.title,this.messageData.message=n,this.messageData.okBtn=this.localizedStrings.btncontinue,this.messageData.exitBtn=this.localizedStrings.btnexit,this.messageData.actionBtn=this.localizedStrings.btnaccounthistory,this.messageData.redirect=!1,this.showing=!0,this.messageData},onContinuePlaying:function(){this.rcInterval=setTimeout(function(){RCComponent.onRealityCheck("activate")}.bind(this),this.rcIntervalTime*1e3);this.showing=!1},onStopPlaying:function(){this.platform==="mobile"&&(this.lobbyUrl="");Engage.request({rcreq:"onGameEnd",data:{redirectUrl:this.lobbyUrl==""?this.exitUrl:this.lobbyUrl}})},onAccountHistory:function(){Engage.request({rcreq:"onAccountHistory",data:{redirectUrl:this.historyUrl,urlMode:this.historyUrlMode}})},setLocalizedString:function(n){for(var t in this.localizedStrings)this.localizedStrings[t]==n.id&&(this.localizedStrings[t]=n.string)},onEngageEvent:function(n){this.log("RCComponent Received message: ","%c"+n.type,"background: blue; color: white");switch(n.type){case"loader":n.loader._id===3&&Engage.request({rcreq:"getRCStrings"});break;case"rcStrings":this.setupTimeLogic();break;case"externalMessageOk":n.id=="realitycheckmessage"&&(this.notifyOperator(this.continueUrl),this.onContinuePlaying());break;case"externalMessageExit":n.id=="realitycheckmessage"&&(this.notifyOperator(this.exitUrl),this.onStopPlaying());break;case"externalMessageAction":n.id=="realitycheckmessage"&&this.onAccountHistory()}},onRealityCheck:function(n){switch(n){case"activate":this.showing||(this.totalTime=this.initialSessionTime*1e3+((new Date).getTime()-this.startTime),this.log("RCComponent: Requesting to activate Reality Check message! totalTime:",this.totalTime/1e3),clearTimeout(this.rcInterval),Engage.request({req:"inGameMessage",data:this.buildRealityCheckMessage()}))}},notifyOperator:function(n){if(n!=""){var t=new XMLHttpRequest;t.onreadystatechange=function(){t.readyState==4&&t.status==200};t.open("GET",n,!0);this.brand==="bet365"&&(t.withCredentials=!0);t.send()}},log:function(){var t,i,n;if(this.debug){for(t="",i="",n=0;n<arguments.length;n++)typeof arguments[n]=="string"&&arguments[n].match("background")?i=arguments[n]:t+=" "+arguments[n];console.log(t,i)}},secondsToHHMMSS:function(n){var u=parseInt(n,10),t=Math.floor(u/3600),i=Math.floor((u-t*3600)/60),r=u-t*3600-i*60;return t<10&&(t="0"+t),i<10&&(i="0"+i),r<10&&(r="0"+r),t+":"+i+":"+r}}