@kalamba/sdk 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/plugins.cjs CHANGED
@@ -2,4 +2,4 @@
2
2
  * BSD 3-Clause License
3
3
  * Copyright (c) 2024, Kalamba Games Limited
4
4
  */
5
- "use strict";var Gt=Object.defineProperty;var zt=(i,e,t)=>e in i?Gt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var b=(i,e,t)=>(zt(i,typeof e!="symbol"?e+"":e,t),t),dt=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var E=(i,e,t)=>(dt(i,e,"read from private field"),t?t.call(i):e.get(i)),v=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},y=(i,e,t,a)=>(dt(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./errors-66b5612a.cjs"),lt=require("./noop-b3c54b76.cjs");function U(i,e){return(t,...a)=>{console.log(`[%c${i}\x1B[m] %s`,e,t,...a)}}function Dt(i,e){return Math.round(i*100/e)}class q{constructor(e){b(this,"config");this.config=e}on(e,t,a){const n=function(s){s.data.message!==`kalamba:wrapper-casino:${e}`&&s.data.message!==`kalamba:wrapper:${e}`||t(s.data.payload)};window.addEventListener("message",n,a)}send(e,...[t]){window.postMessage({message:`kalamba:casino:${e}`,payload:t})}}const qt=U("BasicPlugin","color:#000000;font-weight:bold;");class Wt extends q{constructor(...e){super(...e),this.registerToSdkEvents(),this.registerFromSdkEvents(),qt("configured")}registerToSdkEvents(){window.addEventListener("message",e=>{try{const{type:t,payload:a}=e.data;switch(t){case"doAudioSettings":this.send("settings",{music:a==null?void 0:a.musicEnabled,sounds:a==null?void 0:a.soundEnabled});return;case"doBalanceUpdate":const{currency:n,coinValueInCents:c}=this.config.api;a.currency===n&&typeof a.balanceInCurrency=="number"?this.send("balance",{balance:Dt(a.balanceInCurrency,c)}):(a.balanceInCoins,this.send("balance",{balance:a.balanceInCoins}));return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.config.api.homeUrl)try{window.top.location=this.config.api.homeUrl}catch{window.location=this.config.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}const S=U("▼ DebuggingPlugin IN ▼","color:#444444;font-weight:bold;"),$t=U("▲ DebuggingPlugin OUT ▲","color:#444444;font-weight:bold;");class jt extends q{constructor(...e){super(...e),this.registerDebugToSdkEvents(),this.registerSdkToDebugEvents()}registerDebugToSdkEvents(){window.DebuggingPlugin={balance:e=>this._send("balance",e),bet:e=>this._send("bet",e),choice:e=>this._send("choice",e),close:e=>this._send("close",e),help:e=>this._send("help",e),history:e=>this._send("history",e),freeze:e=>this._send("freeze",e),paytable:e=>this._send("paytable",e),settings:e=>this._send("settings",e),suspend:e=>this._send("suspend",e),unfreeze:e=>this._send("unfreeze",e)}}registerSdkToDebugEvents(){this.on("autoplay",e=>S("autoplay",e)),this.on("balance",e=>S("balance",e)),this.on("bet",e=>S("bet",e)),this.on("cashier",e=>S("cashier",e)),this.on("choice",e=>S("choice",e)),this.on("close",e=>S("close",e)),this.on("error",e=>S("error",e)),this.on("loadEnd",e=>S("loadEnd",e)),this.on("loadProgress",e=>S("loadProgress",e)),this.on("loadStart",e=>S("loadStart",e)),this.on("playCycleStart",e=>S("playCycleStart",e)),this.on("playCycleEnd",e=>S("playCycleEnd",e)),this.on("playEnd",e=>S("playEnd",e)),this.on("playError",e=>S("playError",e)),this.on("playReady",e=>S("playReady",e)),this.on("playStart",e=>S("playStart",e)),this.on("settings",e=>S("settings",e))}_send(...e){$t(...e),this.send(...e)}}const Qt=U("GigPlugin","color:#000000;font-weight:bold;");class Xt extends q{constructor(...e){super(...e),this.registerToSdkEvents(),this.registerFromSdkEvents(),Qt("configured")}postMessage(e){const t={event:e};window.top.postMessage(t,"*")}registerToSdkEvents(){window.addEventListener("message",e=>{try{const{data:t}=e;switch(t){case"STOP_AUTO_PLAY":this.send("suspend");return;case"BLOCK_BETS":this.send("freeze");return;case"UNBLOCK_BETS":this.send("unfreeze");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.config.api.homeUrl)try{window.top.location=this.config.api.homeUrl}catch{window.location=this.config.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}}),this.on("playReady",()=>{this.postMessage("GAME_READY")})}}const Kt=U("OryxPlugin","color:#000000;font-weight:bold;");class Yt extends q{constructor(...e){super(...e),this.registerToSdkEvents(),this.registerFromSdkEvents(),Kt("configured")}registerToSdkEvents(){window.addEventListener("message",e=>{try{const{type:t,param:a}=e.data;switch(t){case"doBalanceUpdate":this.send("balance",{balance:a});return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){let e=0;this.on("close",()=>{window.top.postMessage({wpgaction:"close"},"*"),window.parent.postMessage({wpgaction:"close.parent"},"*")}),this.on("balance",({balance:t})=>{e!==t&&(e=t,window.top.postMessage({param:{},wpgaction:"balance"},"*"),window.parent.postMessage({param:{},wpgaction:"balance.parent"},"*"))}),this.on("loadStart",()=>{window.top.postMessage({wpgaction:"loadStart"},"*"),window.parent.postMessage({wpgaction:"loadStart.parent"},"*")}),this.on("loadEnd",()=>{window.top.postMessage({wpgaction:"loadEnd"},"*"),window.parent.postMessage({wpgaction:"loadEnd.parent"},"*")}),this.on("playStart",()=>{window.top.postMessage({wpgaction:"gameSpinStart"},"*"),window.parent.postMessage({wpgaction:"gameSpinStart.parent"},"*")}),this.on("playEnd",()=>{window.top.postMessage({wpgaction:"gameSpinEnd"},"*"),window.parent.postMessage({wpgaction:"gameSpinEnd.parent"},"*")}),this.on("cashier",({type:t})=>{switch(t){case"BALANCE_LOW":window.top.postMessage({wpgaction:"cashier"},"*"),window.parent.postMessage({wpgaction:"cashier.parent"},"*");break;case"BALANCE_INSUFFICIENT":window.top.postMessage({wpgaction:"errorOutOfMoney"},"*"),window.parent.postMessage({wpgaction:"errorOutOfMoney.parent"},"*");break}})}}const ut=U("PariplayPlugin","color:#000000;font-weight:bold;");function Ge(i){try{window.top.location=i}catch{window.location=i}}function ze(i,e){return new Promise(function(a,n){const c=new XMLHttpRequest;c.onload=function(){c.status>=200&&c.status<300?a(c.responseText):n(c.responseText)},c.open(i,e),c.send()})}function qe(){}function Jt(i){return i.filter(function(t){return t.messageType.toUpperCase()==="DATA"})}function We(i){return i.filter(function(t){return["NOTIFICATION","POPUP"].includes(t.messageType.toUpperCase())})}function Rt(i){try{return JSON.parse(i.text)}catch{return{}}}function Zt(i){return i.map(Rt).filter(Boolean).find(function(t){return t.betId!=null&&t.winId!=null})||{}}function ei(i){return i.map(Rt).filter(Boolean).find(function(t){return t.TotalBet!=null&&t.TotalWin!=null})||{}}class ti extends q{constructor(...e){super(...e),this.registerToSdkEvents(),this.registerFromSdkEvents(),ut("configured")}postMessage(e,t){const a={lang:this.config.ui.language,sender:this.config.api.game,type:e};t!=null&&(a.data=t),ut("postMessage",a),window.parent.postMessage(a,"*")}coinsToCurrency(e){return e*this.config.api.coinValueInCents/100}handleContinueButton(e,t){e.link&&ze("GET",e.link),t()}handleLinkButton(e,t){switch(e.linkType.toUpperCase()){case"AJAX":ze("GET",e.link),t();return;case"AJAXRESPONSE":ze("GET",e.link).then(()=>{t()});return;case"REDIRECT":Ge(e.link),t();return}}handleQuitButton(e,t){this.send("close"),t()}handleCashierButton(e,t){this.send("cashier",{type:"ON_DEMAND"}),t()}handleHistoryButton(e,t){this.send("history",{source:"casino"}),t()}get buttonActions(){return{CASHIER:this.handleCashierButton,CONTINUE:this.handleContinueButton,HISTORY:this.handleHistoryButton,LINK:this.handleLinkButton,QUIT:this.handleQuitButton}}processInfoUiMessages(e){return e.reduce((t,a)=>t.then(()=>new Promise(n=>{Object.assign({},a,{buttons:a.buttons.filter(c=>c.action.toUpperCase()==="CASHIER"?!!this.config.api.cashierUrl:!0).map(c=>Object.assign({},c,{onRelease:()=>{const s=a.messageType.toUpperCase()==="POPUP"?qe:n,h=this.buttonActions[c.action.toUpperCase()];h?h(c,s):s()}}))})}).catch(qe)),Promise.resolve()).then(()=>{}).catch(qe)}registerToSdkEvents(){window.addEventListener("message",e=>{try{const{type:t}=e.data;switch(t){case"pause":case"disableSpin":this.send("freeze");return;case"resume":case"enableSpin":this.send("unfreeze");return;case"stopAutobet":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){let e=0;this.on("openGameResponse",t=>{let a;try{const n=JSON.parse(JSON.parse(atob(this.config.api.integrationData.token.split(".")[1])).token),c=JSON.parse(n.integrationSpecificAttributes.sessionData||"{}");a={ClientToken:n.integrationSpecificAttributes.clientToken,CurrencyCode:n.currency,PlayerTokenId:n.user,SessionData:c}}catch{a=void 0}this.postMessage("gameDataLoaded",{LoadGameData:a,success:!0});try{const n=We(t.contract.uiMessages);this.processInfoUiMessages(n)}catch{}}),this.on("balance",({balance:t})=>{e!==t&&(e=t,this.postMessage("balance",{amount:this.coinsToCurrency(t)}))}),this.on("close",()=>{if(this.config.api.homeUrl)if(this.config.api.homeUrl==="(back)")try{window.top.history.back()}catch{window.history.back()}else this.config.api.homeUrl==="(api)"?this.postMessage("quit"):Ge(this.config.api.homeUrl)}),this.on("playEnd",t=>{this.postMessage("roundEnded",{balanceAfter:this.coinsToCurrency(t.contract.balance.coins),win:this.coinsToCurrency(t.contract.win.round)});try{const a=We(t.contract.uiMessages);this.processInfoUiMessages(a)}catch{}}),this.on("playError",t=>{var a,n;this.postMessage("ticketReceived",{ErrorCode:(a=t.data)==null?void 0:a.code,ErrorMessage:"ERROR",Status:{ErrCode:(n=t.data)==null?void 0:n.code}})}),this.on("playResponse",t=>{this.postMessage("roundStarted",{balanceBefore:this.coinsToCurrency(t.contract.balance.coins+t.contract.bet.lastPaid.base*t.contract.bet.lastPaid.multiplier)});const a=["BaseGame","PaidSpin"].includes(t.contract.stateType.thisRound),n=Jt(t.contract.uiMessages),c=We(t.contract.uiMessages),s=Zt(n),h=ei(n);this.postMessage("ticketReceived",{Balance:this.coinsToCurrency(t.contract.balance.coins),BetAmount:a?this.coinsToCurrency(t.contract.bet.lastPaid.base*t.contract.bet.lastPaid.multiplier):0,CreditTransactionId:s.betId,DebitTransactionId:s.winId,Message:c,SessionData:h,Status:{ErrCode:0},WinAmount:this.coinsToCurrency(t.contract.win.round)})}),this.on("playStart",t=>{t.bet&&this.postMessage("roundStart",{totalBet:this.coinsToCurrency(t.bet.base*t.bet.multiplier)})}),this.on("loadEnd",()=>{this.postMessage("gameReady")}),this.on("loadStart",()=>{this.postMessage("onAppFrameReady")}),this.on("cashier",()=>{this.config.api.cashierUrl&&(this.config.api.cashierUrl==="(api)"?this.postMessage("cashier"):Ge(this.config.api.cashierUrl))})}}const we=U("RelaxFEIMPlugin","color:#000000;font-weight:bold;");class ii extends q{constructor(...t){super(...t);b(this,"VERSION","1.15.0");const a=document.createElement("script");a.src=`https://d3nsdzdtjbr5ml.cloudfront.net/casino/relaxlibs/feim/${this.VERSION}/rlxfeim.min.js`,a.onload=()=>{we("loaded"),window.FEIM.configure({p2pConfig:{currency:this.config.api.currency,launchParams:{homeurl:"homeUrl"}}}),we("configured"),this.registerToSdkEvents(),this.registerFromSdkEvents()},document.body.appendChild(a)}registerToSdkEvents(){window.FEIM.on.errorMessageDismissed(()=>this.send("unfreeze")),window.FEIM.on.errorMessageDisplayed(()=>this.send("freeze")),window.FEIM.on.exitingGame(()=>we("!!! NOT IMPLEMENTED: exitingGame !!!")),window.FEIM.on.freeze(()=>this.send("freeze")),window.FEIM.on.initialized(()=>we("!!! NOT IMPLEMENTED: initialized !!!")),window.FEIM.on.pauseAutoPlay(()=>this.send("suspend")),window.FEIM.on.refreshBalance(()=>we("!!! NOT IMPLEMENTED: refreshBalance !!!")),window.FEIM.on.toggleGameHelp(()=>{this.send("help",{})}),window.FEIM.on.togglePaytable(()=>{this.send("paytable",{})}),window.FEIM.on.unfreeze(()=>this.send("unfreeze")),window.FEIM.on.updateSettings(({payload:[t]})=>this.send("settings",{sounds:t.sounds,fastPlay:t.fastPlay}))}registerFromSdkEvents(){this.on("autoplay",({action:t})=>{switch(t){case"start":window.FEIM.send.autoPlayStarted();break;case"stop":window.FEIM.send.autoPlayFinished();break}}),this.on("balance",({balance:t})=>{window.FEIM.send.balanceUpdate(t)}),this.on("bet",({base:t,multiplier:a})=>{window.FEIM.send.betUpdate(t*a)}),this.on("error",({message:t})=>{window.FEIM.send.errorMessage(t)}),this.on("close",()=>{window.FEIM.send.exitGame()}),this.on("loadEnd",()=>{window.FEIM.send.gameLoadCompleted()}),this.on("loadProgress",({progress:t})=>{window.FEIM.send.gameLoadProgress(t)}),this.on("loadStart",()=>{window.FEIM.send.gameLoadStarted()}),this.on("cashier",()=>{window.FEIM.send.openQuickDeposit()}),this.on("playCycleEnd",t=>{const a={balance:t.contract.balance.coins,bet:t.contract.bet.lastPaid.base*t.contract.bet.lastPaid.multiplier,win:{win:t.contract.win.total}};window.FEIM.send.roundFinished(a)}),this.on("playResponse",t=>{const a={balance:t.contract.balance.coins,playResponse:t.data};window.FEIM.send.roundStarted(a)}),this.on("history",()=>{window.FEIM.send.showHistory()}),this.on("settings",t=>{window.FEIM.send.updateSettings(t)})}}const $e=U("TukoPlugin","color:#000000;font-weight:bold;");class ai extends q{constructor(...t){super(...t);b(this,"PING_INTERVAL",1e4);const n=new URLSearchParams(window.location.search).get("pingCallbackUrl");n&&window.setInterval(()=>{this.ping(n)},this.PING_INTERVAL),this.registerToSdkEvents(),this.registerFromSdkEvents(),$e("configured")}ping(t){const a=new XMLHttpRequest;a.onreadystatechange=function(){a.readyState===XMLHttpRequest.DONE&&(a.status===0||a.status>=200&&a.status<400?$e("ping ok",a):$e("ping error",a))},a.open("GET",t),a.send()}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:a,payload:n}=t.data;switch(a){case"doAudioSettings":this.send("settings",{music:n==null?void 0:n.musicEnabled,sounds:n==null?void 0:n.soundEnabled});return;case"doBalanceUpdate":const{currency:c,coinValueInCents:s}=this.config.api;n.currency===c&&typeof n.balanceInCurrency=="number"?this.send("balance",{balance:Dt(n.balanceInCurrency,s)}):(n.balanceInCoins,this.send("balance",{balance:n.balanceInCoins}));return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.config.api.homeUrl)try{window.top.location=this.config.api.homeUrl}catch{window.location=this.config.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}class Bt{constructor(e){b(this,"config");this.config=e}on(e,t,a){const n=function(s){s.data.message!==`kalamba:wrapper-rgs:${e}`&&s.data.message!==`kalamba:wrapper:${e}`||t(s.data.payload)};window.addEventListener("message",n,a)}send(e,...[t]){window.postMessage({message:`kalamba:rgs:${e}`,payload:t})}}class ni{constructor(e){b(this,"socket",null);b(this,"webSocketUrl");b(this,"eventListeners",{close:[],error:[],message:[]});b(this,"connect",()=>{const e=new WebSocket(this.webSocketUrl);return e.addEventListener("message",this.handleMessage),new Promise(t=>{e.addEventListener("open",a=>{this.handleOpen(a),t(this.socket)})})});b(this,"send",e=>{if(this.socket==null)throw new Error("Cannot send message, the WebSocket connection is not open");this.socket.send(e)});b(this,"close",()=>{if(this.socket==null)throw new Error("Cannot close the WebSocket connection that is not open");this.socket.close(),this.addEventListener("error",e=>{console.log(e)})});b(this,"handleClose",e=>{this.eventListeners.close.forEach(t=>{t(e)})});b(this,"handleError",e=>{this.eventListeners.error.forEach(t=>{t(e)})});b(this,"handleMessage",e=>{this.eventListeners.message.forEach(t=>{t(e)})});b(this,"handleOpen",e=>{const t=e.target;t.addEventListener("close",this.handleClose),t.addEventListener("error",this.handleError),this.socket=t});this.webSocketUrl=e}addEventListener(e,t){this.eventListeners[e].push(t)}removeEventListener(e,t){const a=this.eventListeners[e].indexOf(t);a!==-1&&this.eventListeners[e].splice(a,1)}}function Te(i){try{return JSON.parse(i==null?void 0:i.data)}catch(e){return console.error("fakap",e),null}}function Ee(i){var e;return((e=i==null?void 0:i.header)==null?void 0:e.name)==="GameEvent"}function si(i){return Ee(i)&&i.body.event==="OPEN_GAME"}function ri(i){return i.header.code!==1||Ee(i)&&i.body.event.includes("_ERROR")}function oi(i){return Ee(i)&&i.body.event.includes("_RESULT")}function ci(i){var e;return((e=i==null?void 0:i.header)==null?void 0:e.name)==="Ping"}function ht(i){var e;return((e=i==null?void 0:i.header)==null?void 0:e.name)==="RealityCheck"}var ie,Se;class di extends ni{constructor(t,a){const n=new URL(t.apiUrl);n.searchParams.set("cageCode",t.cageCode),n.searchParams.set("gameCode",t.gameCode),n.searchParams.set("operatorCode",t.operatorCode),n.searchParams.set("playMode",t.playMode),n.searchParams.set("token",t.token),n.searchParams.set("username",t.username);super(n.toString());b(this,"cId",0);b(this,"mId",0);b(this,"seqId",10);b(this,"gameCode");v(this,ie,void 0);v(this,Se,void 0);b(this,"onMessage",t=>{const a=Te(t);(Ee(a)||ci(a)||ht(a))&&this.sendAcknowledgement(a),ht(a)&&this.handleRealityCheck(a)});this.eventListeners.realityCheck=[],this.gameCode=t.gameCode,y(this,ie,a.requestTimeoutMs),y(this,Se,a.gameVersion??"unknown"),this.addEventListener("message",this.onMessage)}handleRealityCheck(t){this.eventListeners.realityCheck.forEach(a=>{a(t.body)})}addEventListener(t,a){super.addEventListener(t,a)}removeEventListener(t,a){super.removeEventListener(t,a)}buildHeader(t,a=null){return{cId:a??++this.cId,code:a!==null?1:void 0,mId:++this.mId,name:t}}buildPayload(t,a){return JSON.stringify({body:a,header:t})}getBodyExtras(t){return{action:t,seqId:++this.seqId}}request(t,a){const n=this.buildPayload(t,a);return new Promise((c,s)=>{setTimeout(()=>s({type:"timeout"}),E(this,ie));const h=g=>{const w=Te(g);try{t.cId===(w==null?void 0:w.header.cId)&&(this.removeEventListener("message",h),w.header.code===1?c(w):s({data:w,type:"error"}))}catch{s({data:w,type:"error"})}};this.addEventListener("message",h),this.send(n)})}activateFreeRound(t){const a=this.buildHeader("ActivateFreeRound");return this.request(a,t)}authenticate(t=!1){const a=this.buildHeader("Authenticate"),n={clientType:3,version:E(this,Se),reconnect:t};return this.request(a,n).then(c=>c.body)}openGame(){const t=this.buildHeader("OpenGame"),a={gameCode:this.gameCode};return new Promise((n,c)=>{const s=h=>{const g=Te(h);si(g)?(this.removeEventListener("message",s),n(g.body)):ri(g)&&c({data:g,type:"error"})};this.addEventListener("message",s),this.request(t,a).catch(h=>{c(h)})})}sendAcknowledgement(t){const{name:a,cId:n}=t.header,c=this.buildHeader(a,n),s=this.buildPayload(c,{});this.send(s)}sendAction(t,a){const n=this.buildHeader("GameAction"),c={...this.getBodyExtras(t),data:a};return new Promise((s,h)=>{const g=w=>{const m=Te(w);Ee(m)&&c.seqId===m.body.correlationSeqId&&(this.removeEventListener("message",g),oi(m)?s(m.body):h({data:m,type:"error"}))};this.addEventListener("message",g),this.request(n,c).catch(w=>h(w))})}setRequestTimeoutMs(t){y(this,ie,t)}}ie=new WeakMap,Se=new WeakMap;function li(i){return i.contract?{contract:{balance:{coins:i.contract.balance,version:i.contract.balanceVersion},coinValueInCents:i.contract.coinValueInCents,country:i.contract.countryCode,currency:i.contract.currencyCode,jurisdiction:i.contract.jurisdictionCode,uiMessages:i.contract.uiMessages,username:i.contract.username}}:{contract:{balance:{coins:i.balance,version:i.balanceVersion},coinValueInCents:i.coinValueInCents,country:i.countryCode,currency:i.currencyCode,jurisdiction:i.jurisdictionCode,uiMessages:i.uiMessages,username:i.username}}}function ui(i){const e=({code:t})=>{switch(t){case 2:return{code:k.OpenGameErrorCode.DENIED};case 3:return{code:k.OpenGameErrorCode.NOT_FOUND};case 4:return{code:k.OpenGameErrorCode.ALREADY_LOGGED_IN};case 5:default:return{code:k.OpenGameErrorCode.ERROR}}};return{...i,data:i.data?e(i.data):void 0}}function hi(i,e){return e.contract?{contract:{bet:{available:e.contract.availableMultipliersPerBaseBet,default:{base:e.contract.defaultBet.baseBet,multiplier:e.contract.defaultBet.betMultiplier},max:e.contract.maxBetInCoins,last:e.contract.lastBet?{base:e.contract.lastBet.baseBet,multiplier:e.contract.lastBet.betMultiplier}:null,lastPaid:e.contract.lastMainGameBet?{base:e.contract.lastMainGameBet.baseBet,multiplier:e.contract.lastMainGameBet.betMultiplier}:null},balance:{coins:e.contract.balanceInCoins,version:e.contract.balanceVersion},gameModel:e.contract.gameModelFile,metaData:e.contract.metaData,roundId:e.contract.roundId,serverTime:e.contract.serverTime,sessionId:e.contract.sessionId,stateType:{thisRound:e.contract.stateTypeThisRound,nextRound:e.contract.stateTypeNextRound},uiMessages:i.contract.uiMessages.concat(e.contract.uiMessages),win:{round:e.contract.roundWin,total:e.contract.totalWin}},data:e.opaqueGameServerToUi}:{contract:{bet:{available:e.data.additionalConfigData.availableMultipliersPerBaseBet,default:{base:e.data.additionalConfigData.defaultBet.baseBet,multiplier:e.data.additionalConfigData.defaultBet.betMultiplier},max:e.data.additionalConfigData.maxAllowedOverallBetInCoins,last:e.data.gameState.betFromCurrentRound?{base:e.data.gameState.betFromCurrentRound.baseBet,multiplier:e.data.gameState.betFromCurrentRound.betMultiplier}:null,lastPaid:e.data.gameState.lastPlacedMainGameBet?{base:e.data.gameState.lastPlacedMainGameBet.baseBet,multiplier:e.data.gameState.lastPlacedMainGameBet.betMultiplier}:null},balance:{coins:e.balance,version:e.balanceVersion},gameModel:e.data.additionalConfigData.gameModelFile,metaData:e.data.gameConfigData.metaData,roundId:e.data.gameState.cycleId,serverTime:e.balanceVersion,sessionId:e.data.gameState.sessionId,stateType:{thisRound:e.data.gameState.stateTypeThisRound,nextRound:e.data.gameState.stateTypeNextRound},uiMessages:i.uiMessages,win:{round:e.data.gameState.totalWinFromCurrentRound,total:e.data.gameState.totalWinFromCurrentGameCycle}},data:e.data}}function gi(i){const e=({code:t})=>{switch(t){case 2:return{code:k.OpenGameErrorCode.GAME_UNAVAILABLE};case 3:return{code:k.OpenGameErrorCode.BONUS_RESTRICTION};case 5:return{code:k.OpenGameErrorCode.TOO_MANY_OPEN_GAMES};case 6:return{code:k.OpenGameErrorCode.RECONNECT_DATA_MISMATCH};case 4:default:return{code:k.OpenGameErrorCode.ERROR}}};return{...i,data:i.data?e(i.data):void 0}}function wi(i){return i.contract?{contract:{bet:{last:i.contract.lastBet?{base:i.contract.lastBet.baseBet,multiplier:i.contract.lastBet.betMultiplier}:null,lastPaid:{base:i.contract.lastMainGameBet.baseBet,multiplier:i.contract.lastMainGameBet.betMultiplier}},balance:{coins:i.contract.balanceInCoins,version:i.contract.balanceVersion},serverTime:i.contract.serverTime,roundId:i.contract.roundId,stateType:{thisRound:i.contract.stateTypeThisRound,nextRound:i.contract.stateTypeNextRound},uiMessages:i.contract.uiMessages,win:{round:i.contract.roundWin,total:i.contract.totalWin}},data:i.opaqueGameServerToUi}:{contract:{bet:{last:i.data.gameState.betFromCurrentRound?{base:i.data.gameState.betFromCurrentRound.baseBet,multiplier:i.data.gameState.betFromCurrentRound.betMultiplier}:null,lastPaid:{base:i.data.gameState.lastPlacedMainGameBet.baseBet,multiplier:i.data.gameState.lastPlacedMainGameBet.betMultiplier}},balance:{coins:i.balance,version:i.balanceVersion},serverTime:i.balanceVersion,roundId:i.data.gameState.cycleId,stateType:{thisRound:i.data.gameState.stateTypeThisRound,nextRound:i.data.gameState.stateTypeNextRound},uiMessages:i.data.uiMessages,win:{round:i.data.gameState.totalWinFromCurrentRound,total:i.data.gameState.totalWinFromCurrentGameCycle}},data:i.data}}function bi(i){const e=({code:t})=>{switch(t){case"GAMING_LIMITS_REACHED":return{code:k.PlayErrorCode.GAMING_LIMITS_REACHED};case"INVALID_CURRENCY":return{code:k.PlayErrorCode.INVALID_CURRENCY};case"INVALID_SESSION":return{code:k.PlayErrorCode.INVALID_SESSION};case"OUT_OF_MONEY":return{code:k.PlayErrorCode.OUT_OF_MONEY};case"UNFINISHED_ROUND_IN_PROGRESS":return{code:k.PlayErrorCode.UNFINISHED_ROUND_IN_PROGRESS};case"WALLET_ERROR":return{code:k.PlayErrorCode.WALLET_ERROR};case"ERROR":default:return{code:k.PlayErrorCode.ERROR}}};return{...i,data:i.data?e(i.data):void 0}}const pi={bul:"bg",chi:"zh",zho:"zh",hrv:"hr",cze:"cs",dan:"da",dut:"nl",eng:"en",est:"et",fin:"fi",fra:"fr",ger:"de",gre:"el",hun:"hu",ind:"id",ita:"it",jpn:"ja",kor:"ko",nor:"no",pol:"pl",por:"pt",rum:"ro",rus:"ru",srp:"sr",slo:"sk",spa:"es",swe:"sv",tha:"th",tur:"tr",ukr:"uk",vie:"vi"},mi=U("KalambaBullseyePlugin","color:#000000;font-weight:bold;");var Me;class fi extends Bt{constructor(...t){super(...t);b(this,"socket");v(this,Me,"");this.on("openGame",async()=>{try{const a=await this.openGame();this.send("openGameResponse",a)}catch(a){this.send("openGameError",a)}}),this.on("play",async a=>{try{const n=await this.play(a);this.send("playResponse",n)}catch(n){this.send("playError",n)}}),this.on("state",({version:a})=>{y(this,Me,a)}),this.on("configured",a=>{this.socket.setRequestTimeoutMs(a.ui.requestTimeoutMs)}),this.registerFromSdkEvents()}initialize(t){this.socket=new di(t,{gameVersion:E(this,Me),requestTimeoutMs:this.config.ui.requestTimeoutMs}),this.socket.addEventListener("close",a=>{a.code===1006&&this.reconnect(t)}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.socket.socket&&this.socket.socket.readyState!==WebSocket.OPEN&&this.reconnect(t)}),this.socket.addEventListener("error",a=>mi("error",a)),this.socket.addEventListener("realityCheck",a=>{this.send("realityCheck",a)})}async reconnect(t){this.initialize(t),await this.socket.connect(),await this.socket.authenticate(!0),await this.socket.openGame()}async openGame(){const t=new URLSearchParams(window.location.search),a=t.get("apiUrl"),n=t.get("cageCode"),c=t.get("gameCode"),s=t.get("operatorCode"),h=t.get("playMode"),g=t.get("token"),w=t.get("username"),m=t.get("gameHistoryUrl"),A=t.get("homeUrl")??void 0,N=t.get("cashierUrl")??void 0;this.initialize({apiUrl:a,cageCode:n,gameCode:c,operatorCode:s,playMode:h,token:g,username:w});try{await this.socket.connect()}catch{throw{type:"error",data:{code:k.OpenGameErrorCode.CONNECTION_ERROR}}}let Q;try{Q=await this.socket.authenticate()}catch(ge){throw ui(ge)}let X;try{X=await this.socket.openGame()}catch(ge){throw gi(ge)}const L=li(Q),he=hi(Q,X);this.config.api={brand:n,game:c,integration:s,jurisdiction:L.contract.jurisdiction,playMode:h,user:L.contract.username,integrationData:{token:g},country:L.contract.country,currency:L.contract.currency,coinValueInCents:L.contract.coinValueInCents,gameHistoryUrl:m,homeUrl:A,cashierUrl:N,sessionId:he.contract.sessionId,lastRoundId:he.contract.roundId};const _=t.get("languageCode");return _&&(this.config.ui.language=_.length===3?pi[_]??_:_),he}async play(t){const{contract:{bet:a,forcedOutcomes:n,...c},extra:s,actionType:h}=t,g={bet:a?{baseBet:a.base,betMultiplier:a.multiplier}:void 0,forcedOutcomes:n,...c,opaqueUiToGameServer:s};let w;try{w=await this.socket.sendAction(h,g)}catch(m){throw bi(m)}return wi(w)}registerFromSdkEvents(){this.on("history",()=>{const{api:{game:t,integration:a,integrationData:n,jurisdiction:c,user:s,gameHistoryUrl:h},ui:{language:g}}=this.config,w=s.replace(/^user_/,"").replace(new RegExp(`_${a}$`),""),m=new URL(h);m.searchParams.set("gameCode",t),m.searchParams.set("jurisdiction",c),m.searchParams.set("operatorCode",a),m.searchParams.set("token",n.token),m.searchParams.set("username",w),m.searchParams.set("languageCode",g),window.open(m.toString(),"_blank")})}}Me=new WeakMap;var Ei="2.0.0-beta.2",de="",gt="?",Ze="function",G="undefined",le="object",et="string",ye="major",d="model",r="name",l="type",u="vendor",o="version",I="architecture",Z="console",p="mobile",f="tablet",T="smarttv",J="wearable",tt="embedded",wt="user-agent",it=500,st="brands",$="formFactor",rt="fullVersionList",ee="platform",ot="platformVersion",He="bitness",W="sec-ch-ua",yi=W+"-full-version-list",vi=W+"-arch",Si=W+"-"+He,Mi=W+"-form-factor",ki=W+"-"+p,Ii=W+"-"+d,Ft=W+"-"+ee,Ci=Ft+"-version",Nt=[st,rt,p,d,ee,ot,I,$,He],P="browser",D="cpu",x="device",R="engine",O="os",te="result",Pe="Amazon",be="Apple",bt="ASUS",pt="BlackBerry",Ae="Google",mt="Huawei",ft="Lenovo",je="LG",De="Microsoft",Et="Motorola",Oe="Samsung",yt="Sharp",_e="Sony",Qe="Xiaomi",Xe="Zebra",K="Mobile ",Y=" Browser",xe="Chrome",Ti="Edge",pe="Firefox",me="Opera",vt="Facebook",St="Sogou",at="Windows",Pi=typeof window!==G,C=Pi&&window.navigator?window.navigator:void 0,H=C&&C.userAgentData?C.userAgentData:void 0,Ai=function(i,e){var t={};for(var a in i)t[a]=e[a]&&e[a].length%2===0?e[a].concat(i[a]):i[a];return t},Ve=function(i){for(var e={},t=0;t<i.length;t++)e[i[t].toUpperCase()]=i[t];return e},nt=function(i,e){if(typeof i===le&&i.length>0){for(var t in i)if(z(i[t])==z(e))return!0;return!1}return ue(i)?z(e).indexOf(z(i))!==-1:!1},Mt=function(i){for(var e in i)return/^(browser|cpu|device|engine|os)$/.test(e)},ue=function(i){return typeof i===et},Ke=function(i){if(i){for(var e=[],t=j(/\\?\"/g,i).split(","),a=0;a<t.length;a++)if(t[a].indexOf(";")>-1){var n=ve(t[a]).split(";v=");e[a]={brand:n[0],version:n[1]}}else e[a]=ve(t[a]);return e}},z=function(i){return ue(i)?i.toLowerCase():i},Ye=function(i){return ue(i)?j(/[^\d\.]/g,i).split(".")[0]:void 0},B=function(i){for(var e in i){var t=i[e];typeof t==le&&t.length==2?this[t[0]]=t[1]:this[t]=void 0}return this},j=function(i,e){return ue(e)?e.replace(i,de):e},fe=function(i){return j(/\\?\"/g,i)},ve=function(i,e){if(ue(i))return i=j(/^\s\s*/,i),typeof e===G?i:i.substring(0,it)},kt=function(i,e){if(!(!i||!e))for(var t=0,a,n,c,s,h,g;t<e.length&&!h;){var w=e[t],m=e[t+1];for(a=n=0;a<w.length&&!h&&w[a];)if(h=w[a++].exec(i),h)for(c=0;c<m.length;c++)g=h[++n],s=m[c],typeof s===le&&s.length>0?s.length===2?typeof s[1]==Ze?this[s[0]]=s[1].call(this,g):this[s[0]]=s[1]:s.length===3?typeof s[1]===Ze&&!(s[1].exec&&s[1].test)?this[s[0]]=g?s[1].call(this,g,s[2]):void 0:this[s[0]]=g?g.replace(s[1],s[2]):void 0:s.length===4&&(this[s[0]]=g?s[3].call(this,g.replace(s[1],s[2])):void 0):this[s]=g||void 0;t+=2}},Re=function(i,e){for(var t in e)if(typeof e[t]===le&&e[t].length>0){for(var a=0;a<e[t].length;a++)if(nt(e[t][a],i))return t===gt?void 0:t}else if(nt(e[t],i))return t===gt?void 0:t;return e.hasOwnProperty("*")?e["*"]:i},It={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Ct={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:["VR","XR","Watch"],"?":["Desktop","Unknown"],"*":void 0},Tt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[o,[r,K+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[o,[r,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[r,o],[/opios[\/ ]+([\w\.]+)/i],[o,[r,me+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[o,[r,me+" GX"]],[/\bopr\/([\w\.]+)/i],[o,[r,me]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[o,[r,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[r,o],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[o,[r,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[o,[r,"WeChat"]],[/konqueror\/([\w\.]+)/i],[o,[r,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[o,[r,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[o,[r,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[o,[r,"Smart "+ft+Y]],[/(avast|avg)\/([\w\.]+)/i],[[r,/(.+)/,"$1 Secure"+Y],o],[/\bfocus\/([\w\.]+)/i],[o,[r,pe+" Focus"]],[/\bopt\/([\w\.]+)/i],[o,[r,me+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[o,[r,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[o,[r,"Dolphin"]],[/coast\/([\w\.]+)/i],[o,[r,me+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[o,[r,"MIUI"+Y]],[/fxios\/([\w\.-]+)/i],[o,[r,K+pe]],[/\bqihu|(qi?ho?o?|360)browser/i],[[r,"360"+Y]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[r,/(.+)/,"$1"+Y],o],[/samsungbrowser\/([\w\.]+)/i],[o,[r,Oe+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[r,/_/g," "],o],[/metasr[\/ ]?([\d\.]+)/i],[o,[r,St+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[r,St+" Mobile"],o],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[r,o],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[r],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[r,vt],o],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[r,o],[/\bgsa\/([\w\.]+) .*safari\//i],[o,[r,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[o,[r,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[o,[r,xe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[r,xe+" WebView"],o],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[o,[r,"Android"+Y]],[/chrome\/([\w\.]+) mobile/i],[o,[r,K+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[r,o],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[o,[r,K+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[r,K+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[o,r],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[r,[o,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[r,o],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[r,K+pe],o],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[r,"Netscape"],o],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[o,[r,pe+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[r,o],[/(cobalt)\/([\w\.]+)/i],[r,[o,/[^\d\.]+./,de]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[I,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[I,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[I,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[I,"armhf"]],[/windows (ce|mobile); ppc;/i],[[I,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[I,/ower/,de,z]],[/(sun4\w)[;\)]/i],[[I,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[I,z]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[u,Oe],[l,f]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[u,Oe],[l,p]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[d,[u,be],[l,p]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[u,be],[l,f]],[/(macintosh);/i],[d,[u,be]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[u,yt],[l,p]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[u,mt],[l,f]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[u,mt],[l,p]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[u,Qe],[l,p]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[u,Qe],[l,f]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[u,"OPPO"],[l,p]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[u,"Vivo"],[l,p]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[d,[u,"Realme"],[l,p]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[u,Et],[l,p]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[u,Et],[l,f]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[u,je],[l,f]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[u,je],[l,p]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[u,ft],[l,f]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[u,"Nokia"],[l,p]],[/(pixel c)\b/i],[d,[u,Ae],[l,f]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[u,Ae],[l,p]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[u,_e],[l,p]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[u,_e],[l,f]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[u,"OnePlus"],[l,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[u,Pe],[l,f]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[u,Pe],[l,p]],[/(playbook);[-\w\),; ]+(rim)/i],[d,u,[l,f]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[u,pt],[l,p]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[u,bt],[l,f]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[u,bt],[l,p]],[/(nexus 9)/i],[d,[u,"HTC"],[l,f]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[u,[d,/_/g," "],[l,p]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[u,"Acer"],[l,f]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[u,"Meizu"],[l,p]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[d,[u,"Ulefone"],[l,p]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[u,d,[l,p]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[u,d,[l,f]],[/(surface duo)/i],[d,[u,De],[l,f]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[u,"Fairphone"],[l,p]],[/(shield[\w ]+) b/i],[d,[u,"Nvidia"],[l,f]],[/(sprint) (\w+)/i],[u,d,[l,p]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[u,De],[l,p]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[u,Xe],[l,f]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[u,Xe],[l,p]],[/smart-tv.+(samsung)/i],[u,[l,T]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[u,Oe],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[u,je],[l,T]],[/(apple) ?tv/i],[u,[d,be+" TV"],[l,T]],[/crkey/i],[[d,xe+"cast"],[u,Ae],[l,T]],[/droid.+aft(\w+)( bui|\))/i],[d,[u,Pe],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[u,yt],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[d,[u,_e],[l,T]],[/(mitv-\w{5}) bui/i],[d,[u,Qe],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[u,d,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[u,ve],[d,ve],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) (\w+)/i],[u,d,[l,Z]],[/droid.+; (shield) bui/i],[d,[u,"Nvidia"],[l,Z]],[/(playstation \w+)/i],[d,[u,_e],[l,Z]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[u,De],[l,Z]],[/((pebble))app/i],[u,d,[l,J]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[u,be],[l,J]],[/droid.+; (glass) \d/i],[d,[u,Ae],[l,J]],[/droid.+; (wt63?0{2,3})\)/i],[d,[u,Xe],[l,J]],[/(quest( 2| pro)?)/i],[d,[u,vt],[l,J]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[u,[l,tt]],[/(aeobc)\b/i],[d,[u,Pe],[l,tt]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[d,[l,p]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[l,f]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,f]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,p]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[u,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[o,[r,Ti+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[o,[r,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[r,o],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[o,r]],os:[[/microsoft (windows) (vista|xp)/i],[r,o],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[r,[o,Re,It]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[o,Re,It],[r,at]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[o,/_/g,"."],[r,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[r,"macOS"],[o,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[o,r],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[r,o],[/\(bb(10);/i],[o,[r,pt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[o,[r,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[o,[r,pe+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[o,[r,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[o,[r,"watchOS"]],[/crkey\/([\d\.]+)/i],[o,[r,xe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[r,"Chrome OS"],o],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[r,o],[/(sunos) ?([\w\.\d]*)/i],[[r,"Solaris"],o],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[r,o]]},Ue=function(){var i={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return B.call(i.init,[[P,[r,o,ye]],[D,[I]],[x,[l,d,u]],[R,[r,o]],[O,[r,o]]]),B.call(i.isIgnore,[[P,[o,ye]],[R,[o]],[O,[o]]]),B.call(i.isIgnoreRgx,[[P,/ ?browser$/i],[O,/ ?os$/i]]),B.call(i.toString,[[P,[r,o]],[D,[I]],[x,[u,d]],[R,[r,o]],[O,[r,o]]]),i}(),Oi=function(i,e){var t=Ue.init[e],a=Ue.isIgnore[e]||0,n=Ue.isIgnoreRgx[e]||0,c=Ue.toString[e]||0;function s(){B.call(this,t)}return s.prototype.getItem=function(){return i},s.prototype.withClientHints=function(){return H?H.getHighEntropyValues(Nt).then(function(h){return i.setCH(new Ht(h,!1)).parseCH().get()}):i.parseCH().get()},s.prototype.withFeatureCheck=function(){return i.detectFeature().get()},e!=te&&(s.prototype.is=function(h){var g=!1;for(var w in this)if(this.hasOwnProperty(w)&&!nt(a,w)&&z(n?j(n,this[w]):this[w])==z(n?j(n,h):h)){if(g=!0,h!=G)break}else if(h==G&&g){g=!g;break}return g},s.prototype.toString=function(){var h=de;for(var g in c)typeof this[c[g]]!==G&&(h+=(h?" ":de)+this[c[g]]);return h||G}),H||(s.prototype.then=function(h){var g=this,w=function(){for(var A in g)g.hasOwnProperty(A)&&(this[A]=g[A])};w.prototype={is:s.prototype.is,toString:s.prototype.toString};var m=new w;return h(m),m}),new s};function Ht(i,e){if(i=i||{},B.call(this,Nt),e)B.call(this,[[st,Ke(i[W])],[rt,Ke(i[yi])],[p,/\?1/.test(i[ki])],[d,fe(i[Ii])],[ee,fe(i[Ft])],[ot,fe(i[Ci])],[I,fe(i[vi])],[$,Ke(i[Mi])],[He,fe(i[Si])]]);else for(var t in i)this.hasOwnProperty(t)&&typeof i[t]!==G&&(this[t]=i[t])}function Pt(i,e,t,a){return this.get=function(n){return n?this.data.hasOwnProperty(n)?this.data[n]:void 0:this.data},this.set=function(n,c){return this.data[n]=c,this},this.setCH=function(n){return this.uaCH=n,this},this.detectFeature=function(){if(C&&C.userAgent==this.ua)switch(this.itemType){case P:C.brave&&typeof C.brave.isBrave==Ze&&this.set(r,"Brave");break;case x:!this.get(l)&&H&&H[p]&&this.set(l,p),this.get(d)=="Macintosh"&&C&&typeof C.standalone!==G&&C.maxTouchPoints&&C.maxTouchPoints>2&&this.set(d,"iPad").set(l,f);break;case O:!this.get(r)&&H&&H[ee]&&this.set(r,H[ee]);break;case te:var n=this.data,c=function(s){return n[s].getItem().detectFeature().get()};this.set(P,c(P)).set(D,c(D)).set(x,c(x)).set(R,c(R)).set(O,c(O))}return this},this.parseUA=function(){return this.itemType!=te&&kt.call(this.data,this.ua,this.rgxMap),this.itemType==P&&this.set(ye,Ye(this.get(o))),this},this.parseCH=function(){var n=this.uaCH,c=this.rgxMap;switch(this.itemType){case P:var s=n[rt]||n[st],h;if(s)for(var g in s){var w=j(/(Google|Microsoft) /,s[g].brand||s[g]),m=s[g].version;!/not.a.brand/i.test(w)&&(!h||/chrom/i.test(h)&&!/chromi/i.test(w))&&(this.set(r,w).set(o,m).set(ye,Ye(m)),h=w)}break;case D:var A=n[I];A&&(A&&n[He]=="64"&&(A+="64"),kt.call(this.data,A+";",c));break;case x:if(n[p]&&this.set(l,p),n[d]&&this.set(d,n[d]),n[d]=="Xbox"&&this.set(l,Z).set(u,De),n[$]){var N;if(typeof n[$]!="string")for(var Q=0;!N&&Q<n[$].length;)N=Re(n[$][Q++],Ct);else N=Re(n[$],Ct);this.set(l,N)}break;case O:var X=n[ee];if(X){var L=n[ot];X==at&&(L=parseInt(Ye(L),10)>=13?"11":"10"),this.set(r,X).set(o,L)}this.get(r)==at&&n[d]=="Xbox"&&this.set(r,"Xbox").set(o,void 0);break;case te:var he=this.data,_=function(ge){return he[ge].getItem().setCH(n).parseCH().get()};this.set(P,_(P)).set(D,_(D)).set(x,_(x)).set(R,_(R)).set(O,_(O))}return this},B.call(this,[["itemType",i],["ua",e],["uaCH",a],["rgxMap",t],["data",Oi(this,i)]]),this}function F(i,e,t){if(typeof i===le?(Mt(i)?(typeof e===le&&(t=e),e=i):(t=i,e=void 0),i=void 0):typeof i===et&&!Mt(e)&&(t=e,e=void 0),!(this instanceof F))return new F(i,e,t).getResult();var a=typeof i===et?i:C&&C.userAgent?C.userAgent:t&&t[wt]?t[wt]:de,n=new Ht(t,!0),c=e?Ai(Tt,e):Tt,s=function(h){return h==te?function(){return new Pt(h,a,c,n).set("ua",a).set(P,this.getBrowser()).set(D,this.getCPU()).set(x,this.getDevice()).set(R,this.getEngine()).set(O,this.getOS()).get()}:function(){return new Pt(h,a,c[h],n).parseUA().get()}};return B.call(this,[["getBrowser",s(P)],["getCPU",s(D)],["getDevice",s(x)],["getEngine",s(R)],["getOS",s(O)],["getResult",s(te)],["getUA",function(){return a}],["setUA",function(h){return ue(h)&&(a=h.length>it?ve(h,it):h),this}]]).setUA(a),this}F.VERSION=Ei;F.BROWSER=Ve([r,o,ye]);F.CPU=Ve([I]);F.DEVICE=Ve([d,u,l,Z,p,T,f,J,tt]);F.ENGINE=F.OS=Ve([r,o]);class Vt{constructor(e,t){b(this,"trackers");b(this,"config");this.trackers=e,this.config=t}on(e,t,a){const n=function(s){s.data.message!==`kalamba:wrapper-telemetry:${e}`&&s.data.message!==`kalamba:wrapper:${e}`||t(s.data.payload)};window.addEventListener("message",n,a)}track(e,t){this.trackers.forEach(a=>a.track(e,t))}}function At(i){return i.reduce((e,t)=>e+t,0)}function _i(i){const e=i.length,t=At(i)/e,a=i.map(c=>Math.pow(c-t,2)),n=At(a)/e;return Math.sqrt(n)}class Ot{constructor(){b(this,"rafId",-1);b(this,"startTime",0);b(this,"stopTime",0);b(this,"frames",[]);b(this,"calculateFPS",()=>{const e=Math.floor((this.stopTime-this.startTime)/1e3);return this.frames.map(t=>Math.floor((t-this.startTime)/1e3)).reduce((t,a,n,c)=>(c[n]!==c[n-1]?t.push(1):t[t.length-1]++,t),[]).slice(0,e)});b(this,"getReport",()=>{const e=this.calculateFPS(),t=Math.floor(this.frames.length/((this.stopTime-this.startTime)/1e3)),a=e.length>0?Math.max(...e):t,n=e.length>0?Math.min(...e):t,c=e.length>0?_i(e):0;return{fpsAvg:t,fpsMax:a,fpsMin:n,fpsStdDev:c}});b(this,"start",()=>{this.startTime=Date.now(),this.frames=[],this.trackFrames()});b(this,"stop",()=>{cancelAnimationFrame(this.rafId),this.stopTime=Date.now()});b(this,"trackFrames",()=>{this.frames.push(Date.now()),this.rafId=requestAnimationFrame(this.trackFrames)})}}const xi="landscape",Ui="portrait";function Li(){try{const i=document.createElement("canvas");return!!window.WebGLRenderingContext&&(i.getContext("webgl")||i.getContext("experimental-webgl"))instanceof WebGLRenderingContext}catch{return!1}}async function Di(){if(!window.createImageBitmap)return!1;const t=await(await fetch("data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAEAAQAcJaQAA3AA/v3AgAA=")).blob();try{return await createImageBitmap(t),!0}catch{return!1}}function Je(){return window.innerWidth>=window.innerHeight?xi:Ui}var Be,ae,ne,se,ke,Fe,Ie,Ne;class Ri extends Vt{constructor(...t){super(...t);b(this,"FPS_SAMPLE_INTERVAL",1e4);v(this,Be,0);v(this,ae,"");v(this,ne,void 0);v(this,se,void 0);v(this,ke,!1);v(this,Fe,!1);v(this,Ie,"");v(this,Ne,[]);y(this,ne,{}),y(this,se,this.deviceInfo()),this.on("state",({balance:a,version:n})=>{y(this,ae,n),y(this,Be,a)}),this.on("autoplay",({action:a})=>{["start","resume"].includes(a)?y(this,ke,!0):y(this,ke,!1)}),this.on("settings",({fastPlay:a})=>{a!==void 0&&y(this,Fe,a)}),this.registerEvents()}async registerEvents(){E(this,se).then(t=>{this.track("Device Information",t)}),this.on("loadStart",()=>{this.track("Game Loading",{progress:0,step:"initial"})}),this.on("loadProgress",t=>{this.track("Game Loading",{progress:t.progress})}),this.on("loadEnd",()=>{this.track("Game Loading",{progress:100,step:"complete"})}),this.on("error",t=>{this.track("System Message",{systemMessageText:t.messageKey,systemMessageType:t.type})}),this.on("openGameResponse",async t=>{y(this,Ie,t.contract.stateType.nextRound),y(this,ne,{balanceInCoins:t.contract.balance.coins,clientVersion:E(this,ae),coinValueInCents:this.config.api.coinValueInCents,coinValueInCentsFloat:this.config.api.coinValueInCents,currency:this.config.api.currency,defaultBaseBet:t.contract.bet.default.base,defaultBetMultiplier:t.contract.bet.default.multiplier,environment:"release",gameCode:this.config.api.game,gameCodeServer:this.config.api.game,gameModelFile:t.contract.gameModel,jurisdiction:this.config.api.jurisdiction,languageCode:this.config.ui.language,operatorName:"kalamba",partnerId:this.config.api.brand,partnerParentId:this.config.api.integration,platform:"WEB",playMode:this.config.api.playMode,referrer:window.location.hostname,serverVersion:t.contract.metaData.version}),this.track("Game Open",E(this,ne))}),this.on("playCycleEnd",async t=>{const a=await E(this,se),{base:n,multiplier:c,specialAction:s}=t.contract.bet.lastPaid??{},h=t.contract.balance.coins,g=t.contract.bet.lastPaid.base*t.contract.bet.lastPaid.multiplier,w=t.contract.win.total,m=w-g,A=s||"spin",N=t.contract.roundId;this.track("Betting Activity",{balance:h-m,balanceAfter:h,baseBet:n,betMultiplier:c,betType:A,gameVersion:E(this,ae),coinValueInCents:this.config.api.coinValueInCents,coinValueInCentsFloat:this.config.api.coinValueInCents,currency:this.config.api.currency,environment:"release",gameCode:this.config.api.game,gameCodeServer:this.config.api.game,isMobile:a.isMobile,netResult:m,operatorName:"kalamba",orientation:Je(),partnerId:this.config.api.brand,partnerParentId:this.config.api.integration,platform:"WEB",playMode:this.config.api.playMode,roundId:N,roundTypes:["BaseGame"],totalBet:g,totalWin:w}),y(this,Ne,[])}),this.on("telemetry.click",t=>{this.track("UI Interaction",{action:"click",...this.getExtraUiInteractionData(),...t})}),this.on("telemetry.orientationChange",()=>{this.track("UI Interaction",{action:"orientationChange",...this.getExtraUiInteractionData()})}),this.reportFpsSample(),this.reportFpsRound()}reportFpsSample(){const t=new Ot,a=()=>{t.stop();const c=t.getReport();this.track("FPS Performance",{...c,fpsType:"sample"}),n()},n=async()=>{t.start(),setTimeout(a,this.FPS_SAMPLE_INTERVAL)};n()}reportFpsRound(){const t=new Ot;this.on("playCycleStart",()=>{t.start()}),this.on("playCycleEnd",()=>{t.stop();const a=t.getReport();this.track("FPS Performance",{...a,fpsType:"playCycleStart->playCycleEnd"})})}getExtraUiInteractionData(){return{orientation:Je(),stateType:E(this,Ie)}}async deviceInfo(){var g;const t=new F(navigator.userAgent),a=Li(),n=await Di(),c=t.getBrowser(),s=t.getDevice(),h=t.getOS();return{browserName:c.name,browserVersion:c.version,connection:(g=navigator.connection)==null?void 0:g.effectiveType,deviceName:s.model,deviceType:s.type,isMobile:["mobile","tablet"].includes(s.type??""),isWebGLSupported:a,isWebPSupported:n,manufacturer:s.vendor,operatingSystem:h.name,operatingSystemVersion:h.version,orientation:Je(),pixelRatio:window.devicePixelRatio,screenHeight:window.screen.height,screenSize:`${window.screen.width}x${window.screen.height}`,screenWidth:window.screen.width,timezoneOffsetMinutes:new Date().getTimezoneOffset(),windowHeight:window.innerHeight,windowSize:`${window.innerWidth}x${window.innerHeight}`,windowWidth:window.innerWidth}}}Be=new WeakMap,ae=new WeakMap,ne=new WeakMap,se=new WeakMap,ke=new WeakMap,Fe=new WeakMap,Ie=new WeakMap,Ne=new WeakMap;let Le;const Bi=new Uint8Array(16);function Fi(){if(!Le&&(Le=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Le))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Le(Bi)}const M=[];for(let i=0;i<256;++i)M.push((i+256).toString(16).slice(1));function Ni(i,e=0){return M[i[e+0]]+M[i[e+1]]+M[i[e+2]]+M[i[e+3]]+"-"+M[i[e+4]]+M[i[e+5]]+"-"+M[i[e+6]]+M[i[e+7]]+"-"+M[i[e+8]]+M[i[e+9]]+"-"+M[i[e+10]]+M[i[e+11]]+M[i[e+12]]+M[i[e+13]]+M[i[e+14]]+M[i[e+15]]}const Hi=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_t={randomUUID:Hi};function xt(i,e,t){if(_t.randomUUID&&!e&&!i)return _t.randomUUID();i=i||{};const a=i.random||(i.rng||Fi)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){t=t||0;for(let n=0;n<16;++n)e[t+n]=a[n];return e}return Ni(a)}class ct{constructor(e){b(this,"config");this.config=e}}const Ut=25,Lt=1e4;var re,oe,ce,V,Ce;class Vi extends ct{constructor(...t){super(...t);v(this,re,"https://europe-west3-stargazer-328808.cloudfunctions.net/collect-events");v(this,oe,void 0);v(this,ce,void 0);v(this,V,[]);v(this,Ce,void 0);b(this,"processQueueForced");y(this,oe,new Date().getTime()),y(this,V,[]),y(this,Ce,xt()),this.processQueueForced=this.processQueue.bind(this,!0),this.schedule(),fetch(E(this,re),{method:"OPTIONS"}).catch(lt.noop),this.subscribe()}subscribe(){window.addEventListener("beforeunload",this.processQueueForced,!1),window.addEventListener("pagehide",this.processQueueForced,!1),window.addEventListener("visibilitychange",this.processQueueForced,!1)}schedule(){E(this,ce)&&clearTimeout(E(this,ce)),y(this,ce,window.setTimeout(()=>this.processQueue(),Lt))}send(t){y(this,oe,new Date().getTime());try{navigator.sendBeacon(E(this,re),JSON.stringify(t))}catch{fetch(E(this,re),{body:JSON.stringify(t),method:"POST",headers:{"Content-Type":"application/json"},keepalive:!0}).catch(lt.noop)}this.schedule()}addToQueue(t){E(this,V).push(t),this.processQueue()}processQueue(t=!1){if(!(this.config==null||!this.config.ui.feature.allowTelemetry)&&!(!t&&E(this,V).length<Ut&&new Date().getTime()-E(this,oe)<Lt))for(;E(this,V).length;){const a=E(this,V).splice(0,Ut).map(n=>({...n,sessionID:E(this,Ce),userID:this.config.api.user}));this.send(a)}}track(t,a){this.addToQueue({eventName:t,eventParams:a,eventTimestamp:new Date().getTime(),eventUUID:xt()})}}re=new WeakMap,oe=new WeakMap,ce=new WeakMap,V=new WeakMap,Ce=new WeakMap;const Gi=U("LoggingTracker","color:#000000;font-weight:bold;");class zi extends ct{track(e,t){Gi(`@${this.config.api.user}`,`[${e}]`,t)}}exports.BasicPlugin=Wt;exports.CasinoPlugin=q;exports.DebuggingPlugin=jt;exports.GigPlugin=Xt;exports.KalambaBullseyePlugin=fi;exports.KalambaStargazerPlugin=Ri;exports.KalambaStargazerTracker=Vi;exports.LoggingTracker=zi;exports.OryxPlugin=Yt;exports.PariplayPlugin=ti;exports.RelaxFEIMPlugin=ii;exports.RgsPlygin=Bt;exports.TelemetryPlugin=Vt;exports.Tracker=ct;exports.TukoPlugin=ai;
5
+ "use strict";var qt=Object.defineProperty;var Gt=(i,t,e)=>t in i?qt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var p=(i,t,e)=>(Gt(i,typeof t!="symbol"?t+"":t,e),e),dt=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var y=(i,t,e)=>(dt(i,t,"read from private field"),e?e.call(i):t.get(i)),E=(i,t,e)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,e)},v=(i,t,e,a)=>(dt(i,t,"write to private field"),a?a.call(i,e):t.set(i,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ne=require("./errors-c5948a4a.cjs"),lt=require("./noop-b3c54b76.cjs");function U(i,t){return(e,...a)=>{console.log(`[%c${i}\x1B[m] %s`,t,e,...a)}}function Ft(i,t){return Math.round(i*100/t)}class G{constructor(t){p(this,"config");this.config=t}on(t,e,a){const n=function(s){s.data.message!==`kalamba:wrapper-casino:${t}`&&s.data.message!==`kalamba:wrapper:${t}`||e(s.data.payload)};window.addEventListener("message",n,a)}send(t,...[e]){window.postMessage({message:`kalamba:casino:${t}`,payload:e})}}const Wt=U("BasicPlugin","color:#000000;font-weight:bold;");class $t extends G{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),Wt("configured")}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:e,payload:a}=t.data;switch(e){case"doAudioSettings":this.send("settings",{music:a==null?void 0:a.musicEnabled,sounds:a==null?void 0:a.soundEnabled});return;case"doBalanceUpdate":const{currency:n,coinValueInCents:r}=this.config.api;a.currency===n&&typeof a.balanceInCurrency=="number"?this.send("balance",{balance:Ft(a.balanceInCurrency,r)}):(a.balanceInCoins,this.send("balance",{balance:a.balanceInCoins}));return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.config.api.homeUrl)try{window.top.location=this.config.api.homeUrl}catch{window.location=this.config.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}const k=U("▼ DebuggingPlugin IN ▼","color:#444444;font-weight:bold;"),jt=U("▲ DebuggingPlugin OUT ▲","color:#444444;font-weight:bold;");class Kt extends G{constructor(...t){super(...t),this.registerDebugToSdkEvents(),this.registerSdkToDebugEvents()}registerDebugToSdkEvents(){window.DebuggingPlugin={balance:t=>this._send("balance",t),bet:t=>this._send("bet",t),choice:t=>this._send("choice",t),close:t=>this._send("close",t),help:t=>this._send("help",t),history:t=>this._send("history",t),freeze:t=>this._send("freeze",t),paytable:t=>this._send("paytable",t),settings:t=>this._send("settings",t),suspend:t=>this._send("suspend",t),unfreeze:t=>this._send("unfreeze",t)}}registerSdkToDebugEvents(){this.on("autoplay",t=>k("autoplay",t)),this.on("balance",t=>k("balance",t)),this.on("bet",t=>k("bet",t)),this.on("cashier",t=>k("cashier",t)),this.on("choice",t=>k("choice",t)),this.on("close",t=>k("close",t)),this.on("error",t=>k("error",t)),this.on("loadEnd",t=>k("loadEnd",t)),this.on("loadProgress",t=>k("loadProgress",t)),this.on("loadStart",t=>k("loadStart",t)),this.on("playCycleStart",t=>k("playCycleStart",t)),this.on("playCycleEnd",t=>k("playCycleEnd",t)),this.on("playEnd",t=>k("playEnd",t)),this.on("playError",t=>k("playError",t)),this.on("playReady",t=>k("playReady",t)),this.on("playStart",t=>k("playStart",t)),this.on("settings",t=>k("settings",t))}_send(...t){jt(...t),this.send(...t)}}const Qt=U("GigPlugin","color:#000000;font-weight:bold;");class Xt extends G{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),Qt("configured")}postMessage(t){const e={event:t};window.top.postMessage(e,"*")}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{data:e}=t;switch(e){case"STOP_AUTO_PLAY":this.send("suspend");return;case"BLOCK_BETS":this.send("freeze");return;case"UNBLOCK_BETS":this.send("unfreeze");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.config.api.homeUrl)try{window.top.location=this.config.api.homeUrl}catch{window.location=this.config.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}}),this.on("playReady",()=>{this.postMessage("GAME_READY")})}}const Jt=U("OryxPlugin","color:#000000;font-weight:bold;");class Yt extends G{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),Jt("configured")}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:e,param:a}=t.data;switch(e){case"doBalanceUpdate":this.send("balance",{balance:a});return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){let t=0;this.on("close",()=>{window.top.postMessage({wpgaction:"close"},"*"),window.parent.postMessage({wpgaction:"close.parent"},"*")}),this.on("balance",({balance:e})=>{t!==e&&(t=e,window.top.postMessage({param:{},wpgaction:"balance"},"*"),window.parent.postMessage({param:{},wpgaction:"balance.parent"},"*"))}),this.on("loadStart",()=>{window.top.postMessage({wpgaction:"loadStart"},"*"),window.parent.postMessage({wpgaction:"loadStart.parent"},"*")}),this.on("loadEnd",()=>{window.top.postMessage({wpgaction:"loadEnd"},"*"),window.parent.postMessage({wpgaction:"loadEnd.parent"},"*")}),this.on("playStart",()=>{window.top.postMessage({wpgaction:"gameSpinStart"},"*"),window.parent.postMessage({wpgaction:"gameSpinStart.parent"},"*")}),this.on("playEnd",()=>{window.top.postMessage({wpgaction:"gameSpinEnd"},"*"),window.parent.postMessage({wpgaction:"gameSpinEnd.parent"},"*")}),this.on("cashier",({type:e})=>{switch(e){case"BALANCE_LOW":window.top.postMessage({wpgaction:"cashier"},"*"),window.parent.postMessage({wpgaction:"cashier.parent"},"*");break;case"BALANCE_INSUFFICIENT":window.top.postMessage({wpgaction:"errorOutOfMoney"},"*"),window.parent.postMessage({wpgaction:"errorOutOfMoney.parent"},"*");break}})}}const ut=U("PariplayPlugin","color:#000000;font-weight:bold;");function ze(i){try{window.top.location=i}catch{window.location=i}}function qe(i,t){return new Promise(function(a,n){const r=new XMLHttpRequest;r.onload=function(){r.status>=200&&r.status<300?a(r.responseText):n(r.responseText)},r.open(i,t),r.send()})}function Ge(){}function Zt(i){return i.filter(function(e){return e.messageType.toUpperCase()==="DATA"})}function We(i){return i.filter(function(e){return["NOTIFICATION","POPUP"].includes(e.messageType.toUpperCase())})}function Dt(i){try{return JSON.parse(i.text)}catch{return{}}}function ei(i){return i.map(Dt).filter(Boolean).find(function(e){return e.betId!=null&&e.winId!=null})||{}}function ti(i){return i.map(Dt).filter(Boolean).find(function(e){return e.TotalBet!=null&&e.TotalWin!=null})||{}}class ii extends G{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),ut("configured")}postMessage(t,e){const a={lang:this.config.ui.language,sender:this.config.api.game,type:t};e!=null&&(a.data=e),ut("postMessage",a),window.parent.postMessage(a,"*")}coinsToCurrency(t){return t*this.config.api.coinValueInCents/100}handleContinueButton(t,e){t.link&&qe("GET",t.link),e()}handleLinkButton(t,e){switch(t.linkType.toUpperCase()){case"AJAX":qe("GET",t.link),e();return;case"AJAXRESPONSE":qe("GET",t.link).then(()=>{e()});return;case"REDIRECT":ze(t.link),e();return}}handleQuitButton(t,e){this.send("close"),e()}handleCashierButton(t,e){this.send("cashier",{type:"ON_DEMAND"}),e()}handleHistoryButton(t,e){this.send("history",{source:"casino"}),e()}get buttonActions(){return{CASHIER:this.handleCashierButton,CONTINUE:this.handleContinueButton,HISTORY:this.handleHistoryButton,LINK:this.handleLinkButton,QUIT:this.handleQuitButton}}processInfoUiMessages(t){return t.reduce((e,a)=>e.then(()=>new Promise(n=>{Object.assign({},a,{buttons:a.buttons.filter(r=>r.action.toUpperCase()==="CASHIER"?!!this.config.api.cashierUrl:!0).map(r=>Object.assign({},r,{onRelease:()=>{const s=a.messageType.toUpperCase()==="POPUP"?Ge:n,h=this.buttonActions[r.action.toUpperCase()];h?h(r,s):s()}}))})}).catch(Ge)),Promise.resolve()).then(()=>{}).catch(Ge)}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:e}=t.data;switch(e){case"pause":case"disableSpin":this.send("freeze");return;case"resume":case"enableSpin":this.send("unfreeze");return;case"stopAutobet":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){let t=0;this.on("openGameResponse",e=>{let a;try{const n=JSON.parse(JSON.parse(atob(this.config.api.integrationData.token.split(".")[1])).token),r=JSON.parse(n.integrationSpecificAttributes.sessionData||"{}");a={ClientToken:n.integrationSpecificAttributes.clientToken,CurrencyCode:n.currency,PlayerTokenId:n.user,SessionData:r}}catch{a=void 0}this.postMessage("gameDataLoaded",{LoadGameData:a,success:!0});try{const n=We(e.contract.uiMessages);this.processInfoUiMessages(n)}catch{}}),this.on("balance",({balance:e})=>{t!==e&&(t=e,this.postMessage("balance",{amount:this.coinsToCurrency(e)}))}),this.on("close",()=>{if(this.config.api.homeUrl)if(this.config.api.homeUrl==="(back)")try{window.top.history.back()}catch{window.history.back()}else this.config.api.homeUrl==="(api)"?this.postMessage("quit"):ze(this.config.api.homeUrl)}),this.on("playEnd",e=>{this.postMessage("roundEnded",{balanceAfter:this.coinsToCurrency(e.contract.balance.coins),win:this.coinsToCurrency(e.contract.win.round)});try{const a=We(e.contract.uiMessages);this.processInfoUiMessages(a)}catch{}}),this.on("playError",e=>{var a,n;this.postMessage("ticketReceived",{ErrorCode:(a=e.data)==null?void 0:a.code,ErrorMessage:"ERROR",Status:{ErrCode:(n=e.data)==null?void 0:n.code}})}),this.on("playResponse",e=>{this.postMessage("roundStarted",{balanceBefore:this.coinsToCurrency(e.contract.balance.coins+e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier)});const a=["BaseGame","PaidSpin"].includes(e.contract.stateType.thisRound),n=Zt(e.contract.uiMessages),r=We(e.contract.uiMessages),s=ei(n),h=ti(n);this.postMessage("ticketReceived",{Balance:this.coinsToCurrency(e.contract.balance.coins),BetAmount:a?this.coinsToCurrency(e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier):0,CreditTransactionId:s.betId,DebitTransactionId:s.winId,Message:r,SessionData:h,Status:{ErrCode:0},WinAmount:this.coinsToCurrency(e.contract.win.round)})}),this.on("playStart",e=>{e.bet&&this.postMessage("roundStart",{totalBet:this.coinsToCurrency(e.bet.base*e.bet.multiplier)})}),this.on("loadEnd",()=>{this.postMessage("gameReady")}),this.on("loadStart",()=>{this.postMessage("onAppFrameReady")}),this.on("cashier",()=>{this.config.api.cashierUrl&&(this.config.api.cashierUrl==="(api)"?this.postMessage("cashier"):ze(this.config.api.cashierUrl))})}}const ge=U("RelaxFEIMPlugin","color:#000000;font-weight:bold;");class ai extends G{constructor(...e){super(...e);p(this,"VERSION","1.15.0");const a=document.createElement("script");a.src=`https://d3nsdzdtjbr5ml.cloudfront.net/casino/relaxlibs/feim/${this.VERSION}/rlxfeim.min.js`,a.onload=()=>{ge("loaded"),window.FEIM.configure({p2pConfig:{currency:this.config.api.currency,launchParams:{homeurl:"homeUrl"}}}),ge("configured"),this.registerToSdkEvents(),this.registerFromSdkEvents()},document.body.appendChild(a)}registerToSdkEvents(){window.FEIM.on.errorMessageDismissed(()=>this.send("unfreeze")),window.FEIM.on.errorMessageDisplayed(()=>this.send("freeze")),window.FEIM.on.exitingGame(()=>ge("!!! NOT IMPLEMENTED: exitingGame !!!")),window.FEIM.on.freeze(()=>this.send("freeze")),window.FEIM.on.initialized(()=>ge("!!! NOT IMPLEMENTED: initialized !!!")),window.FEIM.on.pauseAutoPlay(()=>this.send("suspend")),window.FEIM.on.refreshBalance(()=>ge("!!! NOT IMPLEMENTED: refreshBalance !!!")),window.FEIM.on.toggleGameHelp(()=>{this.send("help",{})}),window.FEIM.on.togglePaytable(()=>{this.send("paytable",{})}),window.FEIM.on.unfreeze(()=>this.send("unfreeze")),window.FEIM.on.updateSettings(({payload:[e]})=>this.send("settings",{sounds:e.sounds,fastPlay:e.fastPlay}))}registerFromSdkEvents(){this.on("autoplay",({action:e})=>{switch(e){case"start":window.FEIM.send.autoPlayStarted();break;case"stop":window.FEIM.send.autoPlayFinished();break}}),this.on("balance",({balance:e})=>{window.FEIM.send.balanceUpdate(e)}),this.on("bet",({base:e,multiplier:a})=>{window.FEIM.send.betUpdate(e*a)}),this.on("error",({message:e})=>{window.FEIM.send.errorMessage(e)}),this.on("close",()=>{window.FEIM.send.exitGame()}),this.on("loadEnd",()=>{window.FEIM.send.gameLoadCompleted()}),this.on("loadProgress",({progress:e})=>{window.FEIM.send.gameLoadProgress(e)}),this.on("loadStart",()=>{window.FEIM.send.gameLoadStarted()}),this.on("cashier",()=>{window.FEIM.send.openQuickDeposit()}),this.on("playCycleEnd",e=>{const a={balance:e.contract.balance.coins,bet:e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier,win:{win:e.contract.win.total}};window.FEIM.send.roundFinished(a)}),this.on("playResponse",e=>{const a={balance:e.contract.balance.coins,playResponse:e.data};window.FEIM.send.roundStarted(a)}),this.on("history",()=>{window.FEIM.send.showHistory()}),this.on("settings",e=>{window.FEIM.send.updateSettings(e)})}}const $e=U("TukoPlugin","color:#000000;font-weight:bold;");class ni extends G{constructor(...e){super(...e);p(this,"PING_INTERVAL",1e4);const n=new URLSearchParams(window.location.search).get("pingCallbackUrl");n&&window.setInterval(()=>{this.ping(n)},this.PING_INTERVAL),this.registerToSdkEvents(),this.registerFromSdkEvents(),$e("configured")}ping(e){const a=new XMLHttpRequest;a.onreadystatechange=function(){a.readyState===XMLHttpRequest.DONE&&(a.status===0||a.status>=200&&a.status<400?$e("ping ok",a):$e("ping error",a))},a.open("GET",e),a.send()}registerToSdkEvents(){window.addEventListener("message",e=>{try{const{type:a,payload:n}=e.data;switch(a){case"doAudioSettings":this.send("settings",{music:n==null?void 0:n.musicEnabled,sounds:n==null?void 0:n.soundEnabled});return;case"doBalanceUpdate":const{currency:r,coinValueInCents:s}=this.config.api;n.currency===r&&typeof n.balanceInCurrency=="number"?this.send("balance",{balance:Ft(n.balanceInCurrency,s)}):(n.balanceInCoins,this.send("balance",{balance:n.balanceInCoins}));return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.config.api.homeUrl)try{window.top.location=this.config.api.homeUrl}catch{window.location=this.config.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}class Rt{constructor(t){p(this,"config");this.config=t}on(t,e,a){const n=function(s){s.data.message!==`kalamba:wrapper-rgs:${t}`&&s.data.message!==`kalamba:wrapper:${t}`||e(s.data.payload)};window.addEventListener("message",n,a)}send(t,...[e]){window.postMessage({message:`kalamba:rgs:${t}`,payload:e})}}class si{constructor(t){p(this,"socket",null);p(this,"webSocketUrl");p(this,"eventListeners",{close:[],error:[],message:[]});p(this,"connect",()=>{const t=new WebSocket(this.webSocketUrl);return t.addEventListener("message",this.handleMessage),new Promise(e=>{t.addEventListener("open",a=>{this.handleOpen(a),e(this.socket)})})});p(this,"send",t=>{if(this.socket==null)throw new Error("Cannot send message, the WebSocket connection is not open");this.socket.send(t)});p(this,"close",()=>{if(this.socket==null)throw new Error("Cannot close the WebSocket connection that is not open");this.socket.close(),this.addEventListener("error",t=>{console.log(t)})});p(this,"handleClose",t=>{this.eventListeners.close.forEach(e=>{e(t)})});p(this,"handleError",t=>{this.eventListeners.error.forEach(e=>{e(t)})});p(this,"handleMessage",t=>{this.eventListeners.message.forEach(e=>{e(t)})});p(this,"handleOpen",t=>{const e=t.target;e.addEventListener("close",this.handleClose),e.addEventListener("error",this.handleError),this.socket=e});this.webSocketUrl=t}addEventListener(t,e){this.eventListeners[t].push(e)}removeEventListener(t,e){const a=this.eventListeners[t].indexOf(e);a!==-1&&this.eventListeners[t].splice(a,1)}}function Ie(i){return JSON.parse(i==null?void 0:i.data)}function oi(i){var t;return((t=i==null?void 0:i.header)==null?void 0:t.name)==="Ping"}function ht(i){var t;return((t=i==null?void 0:i.header)==null?void 0:t.name)==="RealityCheck"}function Be(i){return i.header.name==="GameEvent"}function ri(i){return Be(i)&&i.body.event==="OPEN_GAME"}function gt(i){return i.header.code!==1}function ci(i){return Be(i)&&i.body.event.includes("_RESULT")}var ie,ve;class di extends si{constructor(e,a){const n=new URL(e.apiUrl);n.searchParams.set("cageCode",e.cageCode),n.searchParams.set("gameCode",e.gameCode),n.searchParams.set("operatorCode",e.operatorCode),n.searchParams.set("playMode",e.playMode),n.searchParams.set("token",e.token),n.searchParams.set("username",e.username);super(n.toString());p(this,"cId",0);p(this,"mId",0);p(this,"seqId",10);p(this,"gameCode");E(this,ie,void 0);E(this,ve,void 0);p(this,"onMessage",e=>{const a=Ie(e);(Be(a)||oi(a)||ht(a))&&this.sendAcknowledgement(a),ht(a)&&this.handleRealityCheck(a)});this.eventListeners.realityCheck=[],this.gameCode=e.gameCode,v(this,ie,a.requestTimeoutMs),v(this,ve,a.gameVersion??"unknown"),this.addEventListener("message",this.onMessage)}handleRealityCheck(e){this.eventListeners.realityCheck.forEach(a=>{a(e.body)})}addEventListener(e,a){super.addEventListener(e,a)}removeEventListener(e,a){super.removeEventListener(e,a)}buildHeader(e,a=null){return{cId:a??++this.cId,code:a!==null?1:void 0,mId:++this.mId,name:e}}buildPayload(e,a){return JSON.stringify({body:a,header:e})}getBodyExtras(e){return{action:e,seqId:++this.seqId}}request(e,a){const n=this.buildPayload(e,a);return new Promise((r,s)=>{setTimeout(()=>s({type:"timeout"}),y(this,ie));const h=g=>{const w=Ie(g);try{e.cId===w.header.cId&&(this.removeEventListener("message",h),w.header.code===1?r(w):s({message:w,type:"error"}))}catch{s({message:w,type:"error"})}};this.addEventListener("message",h),this.send(n)})}activateFreeRound(e){const a=this.buildHeader("ActivateFreeRound");return this.request(a,e)}authenticate(e=!1){const a=this.buildHeader("Authenticate"),n={clientType:3,version:y(this,ve),reconnect:e};return this.request(a,n).then(r=>r.body).catch(r=>{var s;throw{data:(s=r==null?void 0:r.message)==null?void 0:s.body,type:r.type}})}openGame(){const e=this.buildHeader("OpenGame"),a={gameCode:this.gameCode};return new Promise((n,r)=>{const s=h=>{const g=Ie(h);ri(g)?(this.removeEventListener("message",s),n(g.body)):gt(g)&&r({data:g.body,type:"error"})};this.addEventListener("message",s),this.request(e,a).catch(h=>{var g;return r({data:(g=h==null?void 0:h.message)==null?void 0:g.body,type:h.type})})})}sendAcknowledgement(e){const{name:a,cId:n}=e.header,r=this.buildHeader(a,n),s=this.buildPayload(r,{});this.send(s)}sendAction(e,a){const n=this.buildHeader("GameAction"),r={...this.getBodyExtras(e),data:a};return new Promise((s,h)=>{const g=w=>{const b=Ie(w);Be(b)&&r.seqId===b.body.correlationSeqId&&(this.removeEventListener("message",g),ci(b)?s(b.body):gt(b)&&h({data:b.body,type:"error"}))};this.addEventListener("message",g),this.request(n,r).catch(w=>{var b;return h({data:(b=w==null?void 0:w.message)==null?void 0:b.body,type:w.type})})})}setRequestTimeoutMs(e){v(this,ie,e)}}ie=new WeakMap,ve=new WeakMap;function li(i){return i.contract?{contract:{balance:{coins:i.contract.balance,version:i.contract.balanceVersion},coinValueInCents:i.contract.coinValueInCents,country:i.contract.countryCode,currency:i.contract.currencyCode,jurisdiction:i.contract.jurisdictionCode,uiMessages:i.contract.uiMessages,username:i.contract.username}}:{contract:{balance:{coins:i.balance,version:i.balanceVersion},coinValueInCents:i.coinValueInCents,country:i.countryCode,currency:i.currencyCode,jurisdiction:i.jurisdictionCode,uiMessages:i.uiMessages,username:i.username}}}function ui(i){var t,e;return{code:((t=i.data)==null?void 0:t.code)??Ne.RgsErrorCode.UNKNOWN,details:(e=i.data)==null?void 0:e.details}}function hi(i,t){return t.contract?{contract:{bet:{available:t.contract.availableMultipliersPerBaseBet,default:{base:t.contract.defaultBet.baseBet,multiplier:t.contract.defaultBet.betMultiplier},max:t.contract.maxBetInCoins,last:t.contract.lastBet?{base:t.contract.lastBet.baseBet,multiplier:t.contract.lastBet.betMultiplier}:null,lastPaid:t.contract.lastMainGameBet?{base:t.contract.lastMainGameBet.baseBet,multiplier:t.contract.lastMainGameBet.betMultiplier}:null},balance:{coins:t.contract.balanceInCoins,version:t.contract.balanceVersion},gameModel:t.contract.gameModelFile,metaData:t.contract.metaData,roundId:t.contract.roundId,serverTime:t.contract.serverTime,sessionId:t.contract.sessionId,stateType:{thisRound:t.contract.stateTypeThisRound,nextRound:t.contract.stateTypeNextRound},uiMessages:i.contract.uiMessages.concat(t.contract.uiMessages),win:{round:t.contract.roundWin,total:t.contract.totalWin}},data:t.opaqueGameServerToUi}:{contract:{bet:{available:t.data.additionalConfigData.availableMultipliersPerBaseBet,default:{base:t.data.additionalConfigData.defaultBet.baseBet,multiplier:t.data.additionalConfigData.defaultBet.betMultiplier},max:t.data.additionalConfigData.maxAllowedOverallBetInCoins,last:t.data.gameState.betFromCurrentRound?{base:t.data.gameState.betFromCurrentRound.baseBet,multiplier:t.data.gameState.betFromCurrentRound.betMultiplier}:null,lastPaid:t.data.gameState.lastPlacedMainGameBet?{base:t.data.gameState.lastPlacedMainGameBet.baseBet,multiplier:t.data.gameState.lastPlacedMainGameBet.betMultiplier}:null},balance:{coins:t.balance,version:t.balanceVersion},gameModel:t.data.additionalConfigData.gameModelFile,metaData:t.data.gameConfigData.metaData,roundId:t.data.gameState.cycleId,serverTime:t.balanceVersion,sessionId:t.data.gameState.sessionId,stateType:{thisRound:t.data.gameState.stateTypeThisRound,nextRound:t.data.gameState.stateTypeNextRound},uiMessages:i.uiMessages,win:{round:t.data.gameState.totalWinFromCurrentRound,total:t.data.gameState.totalWinFromCurrentGameCycle}},data:t.data}}function gi(i){var t,e;return{code:((t=i.data)==null?void 0:t.code)??Ne.RgsErrorCode.UNKNOWN,details:(e=i.data)==null?void 0:e.details}}function wi(i){return i.contract?{contract:{bet:{last:i.contract.lastBet?{base:i.contract.lastBet.baseBet,multiplier:i.contract.lastBet.betMultiplier}:null,lastPaid:{base:i.contract.lastMainGameBet.baseBet,multiplier:i.contract.lastMainGameBet.betMultiplier}},balance:{coins:i.contract.balanceInCoins,version:i.contract.balanceVersion},serverTime:i.contract.serverTime,roundId:i.contract.roundId,stateType:{thisRound:i.contract.stateTypeThisRound,nextRound:i.contract.stateTypeNextRound},uiMessages:i.contract.uiMessages,win:{round:i.contract.roundWin,total:i.contract.totalWin}},data:i.opaqueGameServerToUi}:{contract:{bet:{last:i.data.gameState.betFromCurrentRound?{base:i.data.gameState.betFromCurrentRound.baseBet,multiplier:i.data.gameState.betFromCurrentRound.betMultiplier}:null,lastPaid:{base:i.data.gameState.lastPlacedMainGameBet.baseBet,multiplier:i.data.gameState.lastPlacedMainGameBet.betMultiplier}},balance:{coins:i.balance,version:i.balanceVersion},serverTime:i.balanceVersion,roundId:i.data.gameState.cycleId,stateType:{thisRound:i.data.gameState.stateTypeThisRound,nextRound:i.data.gameState.stateTypeNextRound},uiMessages:i.data.uiMessages,win:{round:i.data.gameState.totalWinFromCurrentRound,total:i.data.gameState.totalWinFromCurrentGameCycle}},data:i.data}}function bi(i){var t,e;return{code:((t=i.data)==null?void 0:t.code)??Ne.RgsErrorCode.UNKNOWN,details:(e=i.data)==null?void 0:e.details}}const pi={bul:"bg",chi:"zh",zho:"zh",hrv:"hr",cze:"cs",dan:"da",dut:"nl",eng:"en",est:"et",fin:"fi",fra:"fr",ger:"de",gre:"el",hun:"hu",ind:"id",ita:"it",jpn:"ja",kor:"ko",nor:"no",pol:"pl",por:"pt",rum:"ro",rus:"ru",srp:"sr",slo:"sk",spa:"es",swe:"sv",tha:"th",tur:"tr",ukr:"uk",vie:"vi"},mi=U("KalambaBullseyePlugin","color:#000000;font-weight:bold;");var Ee;class fi extends Rt{constructor(...e){super(...e);p(this,"socket");E(this,Ee,"");this.on("openGame",async()=>{try{const a=await this.openGame();this.send("openGameResponse",a)}catch(a){this.send("openGameError",a)}}),this.on("play",async a=>{try{const n=await this.play(a);this.send("playResponse",n)}catch(n){this.send("playError",n)}}),this.on("state",({version:a})=>{v(this,Ee,a)}),this.on("configured",a=>{this.socket.setRequestTimeoutMs(a.ui.requestTimeoutMs)}),this.registerFromSdkEvents()}initialize(e){this.socket=new di(e,{gameVersion:y(this,Ee),requestTimeoutMs:this.config.ui.requestTimeoutMs}),this.socket.addEventListener("close",a=>{a.code===1006&&this.reconnect(e)}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.socket.socket&&this.socket.socket.readyState!==WebSocket.OPEN&&this.reconnect(e)}),this.socket.addEventListener("error",a=>mi("error",a)),this.socket.addEventListener("realityCheck",a=>{this.send("realityCheck",a)})}async reconnect(e){this.initialize(e),await this.socket.connect(),await this.socket.authenticate(!0),await this.socket.openGame()}async openGame(){const e=new URLSearchParams(window.location.search),a=e.get("apiUrl"),n=e.get("cageCode"),r=e.get("gameCode"),s=e.get("operatorCode"),h=e.get("playMode"),g=e.get("token"),w=e.get("username"),b=e.get("gameHistoryUrl"),P=e.get("homeUrl")??void 0,N=e.get("cashierUrl")??void 0;this.initialize({apiUrl:a,cageCode:n,gameCode:r,operatorCode:s,playMode:h,token:g,username:w});try{await this.socket.connect()}catch{throw{type:"error",data:{code:Ne.RgsErrorCode.CONNECTION_ERROR}}}let K;try{K=await this.socket.authenticate()}catch(B){throw{type:B.type,data:B.type==="error"?ui(B.data):void 0}}let Q;try{Q=await this.socket.openGame()}catch(B){throw{type:B.type,data:B.type==="error"?gi(B.data):void 0}}const L=li(K),he=hi(K,Q);this.config.api={brand:n,game:r,integration:s,jurisdiction:L.contract.jurisdiction,playMode:h,user:L.contract.username,integrationData:{token:g},country:L.contract.country,currency:L.contract.currency,coinValueInCents:L.contract.coinValueInCents,gameHistoryUrl:b,homeUrl:P,cashierUrl:N,sessionId:he.contract.sessionId,lastRoundId:he.contract.roundId};const x=e.get("languageCode");return x&&(this.config.ui.language=x.length===3?pi[x]??x:x),he}async play(e){const{contract:{bet:a,forcedOutcomes:n,...r},extra:s,actionType:h}=e,g={bet:a?{baseBet:a.base,betMultiplier:a.multiplier}:void 0,forcedOutcomes:n,...r,opaqueUiToGameServer:s};let w;try{w=await this.socket.sendAction(h,g)}catch(b){throw{type:b.type,data:b.type==="error"?bi(b.data):void 0}}return wi(w)}registerFromSdkEvents(){this.on("history",()=>{const{api:{game:e,integration:a,integrationData:n,jurisdiction:r,user:s,gameHistoryUrl:h},ui:{language:g}}=this.config,w=s.replace(/^user_/,"").replace(new RegExp(`_${a}$`),""),b=new URL(h);b.searchParams.set("gameCode",e),b.searchParams.set("jurisdiction",r),b.searchParams.set("operatorCode",a),b.searchParams.set("token",n.token),b.searchParams.set("username",w),b.searchParams.set("languageCode",g),window.open(b.toString(),"_blank")})}}Ee=new WeakMap;var yi="2.0.0-beta.2",de="",wt="?",Ze="function",z="undefined",le="object",et="string",fe="major",d="model",o="name",l="type",u="vendor",c="version",S="architecture",Z="console",m="mobile",f="tablet",T="smarttv",Y="wearable",tt="embedded",bt="user-agent",it=500,st="brands",$="formFactor",ot="fullVersionList",ee="platform",rt="platformVersion",He="bitness",W="sec-ch-ua",vi=W+"-full-version-list",Ei=W+"-arch",ki=W+"-"+He,Mi=W+"-form-factor",Si=W+"-"+m,Ii=W+"-"+d,Nt=W+"-"+ee,Ti=Nt+"-version",Ht=[st,ot,m,d,ee,rt,S,$,He],C="browser",_="cpu",O="device",F="engine",A="os",te="result",Te="Amazon",we="Apple",pt="ASUS",mt="BlackBerry",Ce="Google",ft="Huawei",yt="Lenovo",je="LG",Le="Microsoft",vt="Motorola",Pe="Samsung",Et="Sharp",Ae="Sony",Ke="Xiaomi",Qe="Zebra",X="Mobile ",J=" Browser",xe="Chrome",Ci="Edge",be="Firefox",pe="Opera",kt="Facebook",Mt="Sogou",at="Windows",Pi=typeof window!==z,I=Pi&&window.navigator?window.navigator:void 0,H=I&&I.userAgentData?I.userAgentData:void 0,Ai=function(i,t){var e={};for(var a in i)e[a]=t[a]&&t[a].length%2===0?t[a].concat(i[a]):i[a];return e},Ve=function(i){for(var t={},e=0;e<i.length;e++)t[i[e].toUpperCase()]=i[e];return t},nt=function(i,t){if(typeof i===le&&i.length>0){for(var e in i)if(q(i[e])==q(t))return!0;return!1}return ue(i)?q(t).indexOf(q(i))!==-1:!1},St=function(i){for(var t in i)return/^(browser|cpu|device|engine|os)$/.test(t)},ue=function(i){return typeof i===et},Xe=function(i){if(i){for(var t=[],e=j(/\\?\"/g,i).split(","),a=0;a<e.length;a++)if(e[a].indexOf(";")>-1){var n=ye(e[a]).split(";v=");t[a]={brand:n[0],version:n[1]}}else t[a]=ye(e[a]);return t}},q=function(i){return ue(i)?i.toLowerCase():i},Je=function(i){return ue(i)?j(/[^\d\.]/g,i).split(".")[0]:void 0},D=function(i){for(var t in i){var e=i[t];typeof e==le&&e.length==2?this[e[0]]=e[1]:this[e]=void 0}return this},j=function(i,t){return ue(t)?t.replace(i,de):t},me=function(i){return j(/\\?\"/g,i)},ye=function(i,t){if(ue(i))return i=j(/^\s\s*/,i),typeof t===z?i:i.substring(0,it)},It=function(i,t){if(!(!i||!t))for(var e=0,a,n,r,s,h,g;e<t.length&&!h;){var w=t[e],b=t[e+1];for(a=n=0;a<w.length&&!h&&w[a];)if(h=w[a++].exec(i),h)for(r=0;r<b.length;r++)g=h[++n],s=b[r],typeof s===le&&s.length>0?s.length===2?typeof s[1]==Ze?this[s[0]]=s[1].call(this,g):this[s[0]]=s[1]:s.length===3?typeof s[1]===Ze&&!(s[1].exec&&s[1].test)?this[s[0]]=g?s[1].call(this,g,s[2]):void 0:this[s[0]]=g?g.replace(s[1],s[2]):void 0:s.length===4&&(this[s[0]]=g?s[3].call(this,g.replace(s[1],s[2])):void 0):this[s]=g||void 0;e+=2}},_e=function(i,t){for(var e in t)if(typeof t[e]===le&&t[e].length>0){for(var a=0;a<t[e].length;a++)if(nt(t[e][a],i))return e===wt?void 0:e}else if(nt(t[e],i))return e===wt?void 0:e;return t.hasOwnProperty("*")?t["*"]:i},Tt={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Ct={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:["VR","XR","Watch"],"?":["Desktop","Unknown"],"*":void 0},Pt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[c,[o,X+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[c,[o,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[o,c],[/opios[\/ ]+([\w\.]+)/i],[c,[o,pe+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[c,[o,pe+" GX"]],[/\bopr\/([\w\.]+)/i],[c,[o,pe]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[c,[o,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[o,c],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[c,[o,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[c,[o,"WeChat"]],[/konqueror\/([\w\.]+)/i],[c,[o,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[c,[o,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[c,[o,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[c,[o,"Smart "+yt+J]],[/(avast|avg)\/([\w\.]+)/i],[[o,/(.+)/,"$1 Secure"+J],c],[/\bfocus\/([\w\.]+)/i],[c,[o,be+" Focus"]],[/\bopt\/([\w\.]+)/i],[c,[o,pe+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[c,[o,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[c,[o,"Dolphin"]],[/coast\/([\w\.]+)/i],[c,[o,pe+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[c,[o,"MIUI"+J]],[/fxios\/([\w\.-]+)/i],[c,[o,X+be]],[/\bqihu|(qi?ho?o?|360)browser/i],[[o,"360"+J]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[o,/(.+)/,"$1"+J],c],[/samsungbrowser\/([\w\.]+)/i],[c,[o,Pe+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[o,/_/g," "],c],[/metasr[\/ ]?([\d\.]+)/i],[c,[o,Mt+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[o,Mt+" Mobile"],c],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[o,c],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[o],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[o,kt],c],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[o,c],[/\bgsa\/([\w\.]+) .*safari\//i],[c,[o,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[c,[o,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[c,[o,xe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[o,xe+" WebView"],c],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[c,[o,"Android"+J]],[/chrome\/([\w\.]+) mobile/i],[c,[o,X+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[o,c],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[c,[o,X+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[o,X+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[c,o],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[o,[c,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[o,c],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[o,X+be],c],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[o,"Netscape"],c],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[c,[o,be+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[o,c],[/(cobalt)\/([\w\.]+)/i],[o,[c,/[^\d\.]+./,de]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[S,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[S,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[S,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[S,"armhf"]],[/windows (ce|mobile); ppc;/i],[[S,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[S,/ower/,de,q]],[/(sun4\w)[;\)]/i],[[S,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[S,q]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[u,Pe],[l,f]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[u,Pe],[l,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[d,[u,we],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[u,we],[l,f]],[/(macintosh);/i],[d,[u,we]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[u,Et],[l,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[u,ft],[l,f]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[u,ft],[l,m]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[u,Ke],[l,m]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[u,Ke],[l,f]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[u,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[u,"Vivo"],[l,m]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[d,[u,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[u,vt],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[u,vt],[l,f]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[u,je],[l,f]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[u,je],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[u,yt],[l,f]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[u,"Nokia"],[l,m]],[/(pixel c)\b/i],[d,[u,Ce],[l,f]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[u,Ce],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[u,Ae],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[u,Ae],[l,f]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[u,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[u,Te],[l,f]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[u,Te],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[d,u,[l,f]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[u,mt],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[u,pt],[l,f]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[u,pt],[l,m]],[/(nexus 9)/i],[d,[u,"HTC"],[l,f]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[u,[d,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[u,"Acer"],[l,f]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[u,"Meizu"],[l,m]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[d,[u,"Ulefone"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[u,d,[l,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[u,d,[l,f]],[/(surface duo)/i],[d,[u,Le],[l,f]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[u,"Fairphone"],[l,m]],[/(shield[\w ]+) b/i],[d,[u,"Nvidia"],[l,f]],[/(sprint) (\w+)/i],[u,d,[l,m]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[u,Le],[l,m]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[u,Qe],[l,f]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[u,Qe],[l,m]],[/smart-tv.+(samsung)/i],[u,[l,T]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[u,Pe],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[u,je],[l,T]],[/(apple) ?tv/i],[u,[d,we+" TV"],[l,T]],[/crkey/i],[[d,xe+"cast"],[u,Ce],[l,T]],[/droid.+aft(\w+)( bui|\))/i],[d,[u,Te],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[u,Et],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[d,[u,Ae],[l,T]],[/(mitv-\w{5}) bui/i],[d,[u,Ke],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[u,d,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[u,ye],[d,ye],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) (\w+)/i],[u,d,[l,Z]],[/droid.+; (shield) bui/i],[d,[u,"Nvidia"],[l,Z]],[/(playstation \w+)/i],[d,[u,Ae],[l,Z]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[u,Le],[l,Z]],[/((pebble))app/i],[u,d,[l,Y]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[u,we],[l,Y]],[/droid.+; (glass) \d/i],[d,[u,Ce],[l,Y]],[/droid.+; (wt63?0{2,3})\)/i],[d,[u,Qe],[l,Y]],[/(quest( 2| pro)?)/i],[d,[u,kt],[l,Y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[u,[l,tt]],[/(aeobc)\b/i],[d,[u,Te],[l,tt]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[d,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[l,f]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,f]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[u,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[c,[o,Ci+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[c,[o,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[o,c],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[c,o]],os:[[/microsoft (windows) (vista|xp)/i],[o,c],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[o,[c,_e,Tt]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,_e,Tt],[o,at]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[c,/_/g,"."],[o,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[o,"macOS"],[c,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[c,o],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[o,c],[/\(bb(10);/i],[c,[o,mt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[c,[o,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[c,[o,be+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[c,[o,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[c,[o,"watchOS"]],[/crkey\/([\d\.]+)/i],[c,[o,xe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[o,"Chrome OS"],c],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[o,c],[/(sunos) ?([\w\.\d]*)/i],[[o,"Solaris"],c],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[o,c]]},Oe=function(){var i={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return D.call(i.init,[[C,[o,c,fe]],[_,[S]],[O,[l,d,u]],[F,[o,c]],[A,[o,c]]]),D.call(i.isIgnore,[[C,[c,fe]],[F,[c]],[A,[c]]]),D.call(i.isIgnoreRgx,[[C,/ ?browser$/i],[A,/ ?os$/i]]),D.call(i.toString,[[C,[o,c]],[_,[S]],[O,[u,d]],[F,[o,c]],[A,[o,c]]]),i}(),xi=function(i,t){var e=Oe.init[t],a=Oe.isIgnore[t]||0,n=Oe.isIgnoreRgx[t]||0,r=Oe.toString[t]||0;function s(){D.call(this,e)}return s.prototype.getItem=function(){return i},s.prototype.withClientHints=function(){return H?H.getHighEntropyValues(Ht).then(function(h){return i.setCH(new Vt(h,!1)).parseCH().get()}):i.parseCH().get()},s.prototype.withFeatureCheck=function(){return i.detectFeature().get()},t!=te&&(s.prototype.is=function(h){var g=!1;for(var w in this)if(this.hasOwnProperty(w)&&!nt(a,w)&&q(n?j(n,this[w]):this[w])==q(n?j(n,h):h)){if(g=!0,h!=z)break}else if(h==z&&g){g=!g;break}return g},s.prototype.toString=function(){var h=de;for(var g in r)typeof this[r[g]]!==z&&(h+=(h?" ":de)+this[r[g]]);return h||z}),H||(s.prototype.then=function(h){var g=this,w=function(){for(var P in g)g.hasOwnProperty(P)&&(this[P]=g[P])};w.prototype={is:s.prototype.is,toString:s.prototype.toString};var b=new w;return h(b),b}),new s};function Vt(i,t){if(i=i||{},D.call(this,Ht),t)D.call(this,[[st,Xe(i[W])],[ot,Xe(i[vi])],[m,/\?1/.test(i[Si])],[d,me(i[Ii])],[ee,me(i[Nt])],[rt,me(i[Ti])],[S,me(i[Ei])],[$,Xe(i[Mi])],[He,me(i[ki])]]);else for(var e in i)this.hasOwnProperty(e)&&typeof i[e]!==z&&(this[e]=i[e])}function At(i,t,e,a){return this.get=function(n){return n?this.data.hasOwnProperty(n)?this.data[n]:void 0:this.data},this.set=function(n,r){return this.data[n]=r,this},this.setCH=function(n){return this.uaCH=n,this},this.detectFeature=function(){if(I&&I.userAgent==this.ua)switch(this.itemType){case C:I.brave&&typeof I.brave.isBrave==Ze&&this.set(o,"Brave");break;case O:!this.get(l)&&H&&H[m]&&this.set(l,m),this.get(d)=="Macintosh"&&I&&typeof I.standalone!==z&&I.maxTouchPoints&&I.maxTouchPoints>2&&this.set(d,"iPad").set(l,f);break;case A:!this.get(o)&&H&&H[ee]&&this.set(o,H[ee]);break;case te:var n=this.data,r=function(s){return n[s].getItem().detectFeature().get()};this.set(C,r(C)).set(_,r(_)).set(O,r(O)).set(F,r(F)).set(A,r(A))}return this},this.parseUA=function(){return this.itemType!=te&&It.call(this.data,this.ua,this.rgxMap),this.itemType==C&&this.set(fe,Je(this.get(c))),this},this.parseCH=function(){var n=this.uaCH,r=this.rgxMap;switch(this.itemType){case C:var s=n[ot]||n[st],h;if(s)for(var g in s){var w=j(/(Google|Microsoft) /,s[g].brand||s[g]),b=s[g].version;!/not.a.brand/i.test(w)&&(!h||/chrom/i.test(h)&&!/chromi/i.test(w))&&(this.set(o,w).set(c,b).set(fe,Je(b)),h=w)}break;case _:var P=n[S];P&&(P&&n[He]=="64"&&(P+="64"),It.call(this.data,P+";",r));break;case O:if(n[m]&&this.set(l,m),n[d]&&this.set(d,n[d]),n[d]=="Xbox"&&this.set(l,Z).set(u,Le),n[$]){var N;if(typeof n[$]!="string")for(var K=0;!N&&K<n[$].length;)N=_e(n[$][K++],Ct);else N=_e(n[$],Ct);this.set(l,N)}break;case A:var Q=n[ee];if(Q){var L=n[rt];Q==at&&(L=parseInt(Je(L),10)>=13?"11":"10"),this.set(o,Q).set(c,L)}this.get(o)==at&&n[d]=="Xbox"&&this.set(o,"Xbox").set(c,void 0);break;case te:var he=this.data,x=function(B){return he[B].getItem().setCH(n).parseCH().get()};this.set(C,x(C)).set(_,x(_)).set(O,x(O)).set(F,x(F)).set(A,x(A))}return this},D.call(this,[["itemType",i],["ua",t],["uaCH",a],["rgxMap",e],["data",xi(this,i)]]),this}function R(i,t,e){if(typeof i===le?(St(i)?(typeof t===le&&(e=t),t=i):(e=i,t=void 0),i=void 0):typeof i===et&&!St(t)&&(e=t,t=void 0),!(this instanceof R))return new R(i,t,e).getResult();var a=typeof i===et?i:I&&I.userAgent?I.userAgent:e&&e[bt]?e[bt]:de,n=new Vt(e,!0),r=t?Ai(Pt,t):Pt,s=function(h){return h==te?function(){return new At(h,a,r,n).set("ua",a).set(C,this.getBrowser()).set(_,this.getCPU()).set(O,this.getDevice()).set(F,this.getEngine()).set(A,this.getOS()).get()}:function(){return new At(h,a,r[h],n).parseUA().get()}};return D.call(this,[["getBrowser",s(C)],["getCPU",s(_)],["getDevice",s(O)],["getEngine",s(F)],["getOS",s(A)],["getResult",s(te)],["getUA",function(){return a}],["setUA",function(h){return ue(h)&&(a=h.length>it?ye(h,it):h),this}]]).setUA(a),this}R.VERSION=yi;R.BROWSER=Ve([o,c,fe]);R.CPU=Ve([S]);R.DEVICE=Ve([d,u,l,Z,m,T,f,Y,tt]);R.ENGINE=R.OS=Ve([o,c]);class zt{constructor(t,e){p(this,"trackers");p(this,"config");this.trackers=t,this.config=e}on(t,e,a){const n=function(s){s.data.message!==`kalamba:wrapper-telemetry:${t}`&&s.data.message!==`kalamba:wrapper:${t}`||e(s.data.payload)};window.addEventListener("message",n,a)}track(t,e){this.trackers.forEach(a=>a.track(t,e))}}function xt(i){return i.reduce((t,e)=>t+e,0)}function Oi(i){const t=i.length,e=xt(i)/t,a=i.map(r=>Math.pow(r-e,2)),n=xt(a)/t;return Math.sqrt(n)}class Ot{constructor(){p(this,"rafId",-1);p(this,"startTime",0);p(this,"stopTime",0);p(this,"frames",[]);p(this,"calculateFPS",()=>{const t=Math.floor((this.stopTime-this.startTime)/1e3);return this.frames.map(e=>Math.floor((e-this.startTime)/1e3)).reduce((e,a,n,r)=>(r[n]!==r[n-1]?e.push(1):e[e.length-1]++,e),[]).slice(0,t)});p(this,"getReport",()=>{const t=this.calculateFPS(),e=Math.floor(this.frames.length/((this.stopTime-this.startTime)/1e3)),a=t.length>0?Math.max(...t):e,n=t.length>0?Math.min(...t):e,r=t.length>0?Oi(t):0;return{fpsAvg:e,fpsMax:a,fpsMin:n,fpsStdDev:r}});p(this,"start",()=>{this.startTime=Date.now(),this.frames=[],this.trackFrames()});p(this,"stop",()=>{cancelAnimationFrame(this.rafId),this.stopTime=Date.now()});p(this,"trackFrames",()=>{this.frames.push(Date.now()),this.rafId=requestAnimationFrame(this.trackFrames)})}}const Ui="landscape",Li="portrait";function Bi(){try{const i=document.createElement("canvas");return!!window.WebGLRenderingContext&&(i.getContext("webgl")||i.getContext("experimental-webgl"))instanceof WebGLRenderingContext}catch{return!1}}async function _i(){if(!window.createImageBitmap)return!1;const e=await(await fetch("data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAEAAQAcJaQAA3AA/v3AgAA=")).blob();try{return await createImageBitmap(e),!0}catch{return!1}}function Ye(){return window.innerWidth>=window.innerHeight?Ui:Li}var Fe,ae,ne,se,ke,De,Me,Re;class Fi extends zt{constructor(...e){super(...e);p(this,"FPS_SAMPLE_INTERVAL",1e4);E(this,Fe,0);E(this,ae,"");E(this,ne,void 0);E(this,se,void 0);E(this,ke,!1);E(this,De,!1);E(this,Me,"");E(this,Re,[]);v(this,ne,{}),v(this,se,this.deviceInfo()),this.on("state",({balance:a,version:n})=>{v(this,ae,n),v(this,Fe,a)}),this.on("autoplay",({action:a})=>{["start","resume"].includes(a)?v(this,ke,!0):v(this,ke,!1)}),this.on("settings",({fastPlay:a})=>{a!==void 0&&v(this,De,a)}),this.registerEvents()}async registerEvents(){y(this,se).then(e=>{this.track("Device Information",e)}),this.on("loadStart",()=>{this.track("Game Loading",{progress:0,step:"initial"})}),this.on("loadProgress",e=>{this.track("Game Loading",{progress:e.progress})}),this.on("loadEnd",()=>{this.track("Game Loading",{progress:100,step:"complete"})}),this.on("error",e=>{this.track("System Message",{systemMessageText:e.messageKey,systemMessageType:e.type})}),this.on("openGameResponse",async e=>{v(this,Me,e.contract.stateType.nextRound),v(this,ne,{balanceInCoins:e.contract.balance.coins,clientVersion:y(this,ae),coinValueInCents:this.config.api.coinValueInCents,coinValueInCentsFloat:this.config.api.coinValueInCents,currency:this.config.api.currency,defaultBaseBet:e.contract.bet.default.base,defaultBetMultiplier:e.contract.bet.default.multiplier,environment:"release",gameCode:this.config.api.game,gameCodeServer:this.config.api.game,gameModelFile:e.contract.gameModel,jurisdiction:this.config.api.jurisdiction,languageCode:this.config.ui.language,operatorName:"kalamba",partnerId:this.config.api.brand,partnerParentId:this.config.api.integration,platform:"WEB",playMode:this.config.api.playMode,referrer:window.location.hostname,serverVersion:e.contract.metaData.version}),this.track("Game Open",y(this,ne))}),this.on("playCycleEnd",async e=>{const a=await y(this,se),{base:n,multiplier:r,specialAction:s}=e.contract.bet.lastPaid??{},h=e.contract.balance.coins,g=e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier,w=e.contract.win.total,b=w-g,P=s||"spin",N=e.contract.roundId;this.track("Betting Activity",{balance:h-b,balanceAfter:h,baseBet:n,betMultiplier:r,betType:P,gameVersion:y(this,ae),coinValueInCents:this.config.api.coinValueInCents,coinValueInCentsFloat:this.config.api.coinValueInCents,currency:this.config.api.currency,environment:"release",gameCode:this.config.api.game,gameCodeServer:this.config.api.game,isMobile:a.isMobile,netResult:b,operatorName:"kalamba",orientation:Ye(),partnerId:this.config.api.brand,partnerParentId:this.config.api.integration,platform:"WEB",playMode:this.config.api.playMode,roundId:N,roundTypes:["BaseGame"],totalBet:g,totalWin:w}),v(this,Re,[])}),this.on("telemetry.click",e=>{this.track("UI Interaction",{action:"click",...this.getExtraUiInteractionData(),...e})}),this.on("telemetry.orientationChange",()=>{this.track("UI Interaction",{action:"orientationChange",...this.getExtraUiInteractionData()})}),this.reportFpsSample(),this.reportFpsRound()}reportFpsSample(){const e=new Ot,a=()=>{e.stop();const r=e.getReport();this.track("FPS Performance",{...r,fpsType:"sample"}),n()},n=async()=>{e.start(),setTimeout(a,this.FPS_SAMPLE_INTERVAL)};n()}reportFpsRound(){const e=new Ot;this.on("playCycleStart",()=>{e.start()}),this.on("playCycleEnd",()=>{e.stop();const a=e.getReport();this.track("FPS Performance",{...a,fpsType:"playCycleStart->playCycleEnd"})})}getExtraUiInteractionData(){return{orientation:Ye(),stateType:y(this,Me)}}async deviceInfo(){var g;const e=new R(navigator.userAgent),a=Bi(),n=await _i(),r=e.getBrowser(),s=e.getDevice(),h=e.getOS();return{browserName:r.name,browserVersion:r.version,connection:(g=navigator.connection)==null?void 0:g.effectiveType,deviceName:s.model,deviceType:s.type,isMobile:["mobile","tablet"].includes(s.type??""),isWebGLSupported:a,isWebPSupported:n,manufacturer:s.vendor,operatingSystem:h.name,operatingSystemVersion:h.version,orientation:Ye(),pixelRatio:window.devicePixelRatio,screenHeight:window.screen.height,screenSize:`${window.screen.width}x${window.screen.height}`,screenWidth:window.screen.width,timezoneOffsetMinutes:new Date().getTimezoneOffset(),windowHeight:window.innerHeight,windowSize:`${window.innerWidth}x${window.innerHeight}`,windowWidth:window.innerWidth}}}Fe=new WeakMap,ae=new WeakMap,ne=new WeakMap,se=new WeakMap,ke=new WeakMap,De=new WeakMap,Me=new WeakMap,Re=new WeakMap;let Ue;const Di=new Uint8Array(16);function Ri(){if(!Ue&&(Ue=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ue))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ue(Di)}const M=[];for(let i=0;i<256;++i)M.push((i+256).toString(16).slice(1));function Ni(i,t=0){return M[i[t+0]]+M[i[t+1]]+M[i[t+2]]+M[i[t+3]]+"-"+M[i[t+4]]+M[i[t+5]]+"-"+M[i[t+6]]+M[i[t+7]]+"-"+M[i[t+8]]+M[i[t+9]]+"-"+M[i[t+10]]+M[i[t+11]]+M[i[t+12]]+M[i[t+13]]+M[i[t+14]]+M[i[t+15]]}const Hi=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ut={randomUUID:Hi};function Lt(i,t,e){if(Ut.randomUUID&&!t&&!i)return Ut.randomUUID();i=i||{};const a=i.random||(i.rng||Ri)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,t){e=e||0;for(let n=0;n<16;++n)t[e+n]=a[n];return t}return Ni(a)}class ct{constructor(t){p(this,"config");this.config=t}}const Bt=25,_t=1e4;var oe,re,ce,V,Se;class Vi extends ct{constructor(...e){super(...e);E(this,oe,"https://europe-west3-stargazer-328808.cloudfunctions.net/collect-events");E(this,re,void 0);E(this,ce,void 0);E(this,V,[]);E(this,Se,void 0);p(this,"processQueueForced");v(this,re,new Date().getTime()),v(this,V,[]),v(this,Se,Lt()),this.processQueueForced=this.processQueue.bind(this,!0),this.schedule(),fetch(y(this,oe),{method:"OPTIONS"}).catch(lt.noop),this.subscribe()}subscribe(){window.addEventListener("beforeunload",this.processQueueForced,!1),window.addEventListener("pagehide",this.processQueueForced,!1),window.addEventListener("visibilitychange",this.processQueueForced,!1)}schedule(){y(this,ce)&&clearTimeout(y(this,ce)),v(this,ce,window.setTimeout(()=>this.processQueue(),_t))}send(e){v(this,re,new Date().getTime());try{navigator.sendBeacon(y(this,oe),JSON.stringify(e))}catch{fetch(y(this,oe),{body:JSON.stringify(e),method:"POST",headers:{"Content-Type":"application/json"},keepalive:!0}).catch(lt.noop)}this.schedule()}addToQueue(e){y(this,V).push(e),this.processQueue()}processQueue(e=!1){if(!(this.config==null||!this.config.ui.feature.allowTelemetry)&&!(!e&&y(this,V).length<Bt&&new Date().getTime()-y(this,re)<_t))for(;y(this,V).length;){const a=y(this,V).splice(0,Bt).map(n=>({...n,sessionID:y(this,Se),userID:this.config.api.user}));this.send(a)}}track(e,a){this.addToQueue({eventName:e,eventParams:a,eventTimestamp:new Date().getTime(),eventUUID:Lt()})}}oe=new WeakMap,re=new WeakMap,ce=new WeakMap,V=new WeakMap,Se=new WeakMap;const zi=U("LoggingTracker","color:#000000;font-weight:bold;");class qi extends ct{track(t,e){zi(`@${this.config.api.user}`,`[${t}]`,e)}}exports.BasicPlugin=$t;exports.CasinoPlugin=G;exports.DebuggingPlugin=Kt;exports.GigPlugin=Xt;exports.KalambaBullseyePlugin=fi;exports.KalambaStargazerPlugin=Fi;exports.KalambaStargazerTracker=Vi;exports.LoggingTracker=qi;exports.OryxPlugin=Yt;exports.PariplayPlugin=ii;exports.RelaxFEIMPlugin=ai;exports.RgsPlygin=Rt;exports.TelemetryPlugin=zt;exports.Tracker=ct;exports.TukoPlugin=ni;
package/dist/plugins.d.ts CHANGED
@@ -86,12 +86,6 @@ declare type DomainToMessagePayloadMap = {
86
86
  telemetry: TelemetryOnlyMessagePayloadMap;
87
87
  };
88
88
 
89
- declare type Error_2 = {
90
- message: string;
91
- messageKey: string;
92
- type: 'CLOSE' | 'RELOAD' | 'CONTINUE';
93
- };
94
-
95
89
  declare type ForwardToPluginsMessage<P extends PluginDomain> = keyof ForwardToPluginsMessageMap<'sdk'>[P] | keyof ForwardToPluginsMessageMap<'rgs'>[P] | keyof ForwardToPluginsMessageMap<'casino'>[P] | keyof ForwardToPluginsMessageMap<'telemetry'>[P];
96
90
 
97
91
  declare interface ForwardToPluginsMessageMap<SourceDomain extends DomainPrefix> {
@@ -104,7 +98,7 @@ declare type ForwardToPluginsMessagePayload<P extends PluginDomain, M extends Fo
104
98
 
105
99
  declare type GameAction = string;
106
100
 
107
- declare type GameEventName = 'BG_RESULT' | 'OPEN_GAME' | 'SPIN_ERROR' | 'SPIN_RESULT';
101
+ declare type GameEventName = 'OPEN_GAME' | 'SPIN_RESULT' | 'BG_RESULT' | 'ERROR';
108
102
 
109
103
  export declare class GigPlugin extends CasinoPlugin {
110
104
  constructor(...args: ConstructorParameters<typeof CasinoPlugin>);
@@ -266,7 +260,7 @@ declare class KalambaWebSocketClient extends WebSocketClient {
266
260
  };
267
261
  opaqueGameServerToUi: unknown;
268
262
  data: unknown;
269
- event: "BG_RESULT" | "SPIN_RESULT";
263
+ event: "SPIN_RESULT" | "BG_RESULT";
270
264
  } & {
271
265
  correlationSeqId: number;
272
266
  event: GameEventName;
@@ -306,27 +300,6 @@ export declare class LoggingTracker extends Tracker {
306
300
 
307
301
  declare type OmitFirstParam<T extends (...args: any[]) => any> = T extends (arg: any, ...rest: infer R) => infer Result ? (...args: R) => Result : never;
308
302
 
309
- declare type OpenGameError = {
310
- type: 'timeout';
311
- } | {
312
- type: 'error';
313
- data: {
314
- code: keyof typeof OpenGameErrorCode;
315
- };
316
- };
317
-
318
- declare const OpenGameErrorCode: {
319
- readonly CONNECTION_ERROR: "CONNECTION_ERROR";
320
- readonly ALREADY_LOGGED_IN: "ALREADY_LOGGED_IN";
321
- readonly DENIED: "DENIED";
322
- readonly NOT_FOUND: "NOT_FOUND";
323
- readonly BONUS_RESTRICTION: "BONUS_RESTRICTION";
324
- readonly ERROR: "ERROR";
325
- readonly GAME_UNAVAILABLE: "GAME_UNAVAILABLE";
326
- readonly RECONNECT_DATA_MISMATCH: "RECONNECT_DATA_MISMATCH";
327
- readonly TOO_MANY_OPEN_GAMES: "TOO_MANY_OPEN_GAMES";
328
- };
329
-
330
303
  declare type OpenGameRequest = {
331
304
  gameName: string;
332
305
  /** version of game client */
@@ -396,25 +369,6 @@ export declare class PariplayPlugin extends CasinoPlugin {
396
369
  registerFromSdkEvents(): void;
397
370
  }
398
371
 
399
- declare type PlayError = {
400
- type: 'timeout';
401
- } | {
402
- type: 'error';
403
- data: {
404
- code: keyof typeof PlayErrorCode;
405
- };
406
- };
407
-
408
- declare const PlayErrorCode: {
409
- readonly ERROR: "ERROR";
410
- readonly GAMING_LIMITS_REACHED: "GAMING_LIMITS_REACHED";
411
- readonly INVALID_CURRENCY: "INVALID_CURRENCY";
412
- readonly INVALID_SESSION: "INVALID_SESSION";
413
- readonly OUT_OF_MONEY: "OUT_OF_MONEY";
414
- readonly UNFINISHED_ROUND_IN_PROGRESS: "UNFINISHED_ROUND_IN_PROGRESS";
415
- readonly WALLET_ERROR: "WALLET_ERROR";
416
- };
417
-
418
372
  declare type PlayRequest = {
419
373
  contract: ContractPlayPayload;
420
374
  extra?: unknown;
@@ -473,10 +427,56 @@ export declare class RelaxFEIMPlugin extends CasinoPlugin {
473
427
 
474
428
  declare type ResponseMessageName = 'Authenticate' | 'GameAction' | 'GameEvent' | 'OpenGame' | 'Ping' | 'RealityCheck';
475
429
 
430
+ declare type RgsError = {
431
+ type: 'timeout';
432
+ } | {
433
+ type: 'error';
434
+ data: RgsErrorData;
435
+ };
436
+
437
+ declare const RgsErrorCode: {
438
+ readonly CONNECTION_ERROR: "CONNECTION_ERROR";
439
+ readonly INVALID_BET_CURRENCY: "INVALID_BET_CURRENCY";
440
+ readonly INVALID_BET: "INVALID_BET";
441
+ readonly INVALID_CAGE_CODE: "INVALID_CAGE_CODE";
442
+ readonly INVALID_CLIENT_TYPE: "INVALID_CLIENT_TYPE";
443
+ readonly INVALID_MESSAGE_FORMAT: "INVALID_MESSAGE_FORMAT";
444
+ readonly INVALID_SESSION: "INVALID_SESSION";
445
+ readonly TOO_HIGH_BET_FREQUENCY: "TOO_HIGH_BET_FREQUENCY";
446
+ readonly TOO_HIGH_ACTION_FREQUENCY: "TOO_HIGH_ACTION_FREQUENCY";
447
+ readonly USER_LOCK_INVALID_PARAMS: "USER_LOCK_INVALID_PARAMS";
448
+ readonly USER_ALREADY_LOCKED: "USER_ALREADY_LOCKED";
449
+ readonly GAME_SERVER_ERROR: "GAME_SERVER_ERROR";
450
+ readonly SESSION_MANAGEMENT_ERROR: "SESSION_MANAGEMENT_ERROR";
451
+ readonly MESSAGE_SENDER_ERROR: "MESSAGE_SENDER_ERROR";
452
+ readonly FREE_ROUNDS_PROCESSING_ERROR: "FREE_ROUNDS_PROCESSING_ERROR";
453
+ readonly WEB_SESSION_NOT_OPEN: "WEB_SESSION_NOT_OPEN";
454
+ readonly GAMING_LIMITS_REACHED: "GAMING_LIMITS_REACHED";
455
+ readonly OUT_OF_MONEY: "OUT_OF_MONEY";
456
+ readonly UNFINISHED_ROUND_IN_PROGRESS: "UNFINISHED_ROUND_IN_PROGRESS";
457
+ readonly ACCESS_DENIED: "ACCESS_DENIED";
458
+ readonly CREDENTIALS_NOT_FOUND: "CREDENTIALS_NOT_FOUND";
459
+ readonly ALREADY_LOGGED_IN: "ALREADY_LOGGED_IN";
460
+ readonly GAME_UNAVAILABLE: "GAME_UNAVAILABLE";
461
+ readonly BONUS_RESTRICTION: "BONUS_RESTRICTION";
462
+ readonly TOO_MANY_OPEN_GAMES: "TOO_MANY_OPEN_GAMES";
463
+ readonly GAME_FROZEN: "GAME_FROZEN";
464
+ readonly WALLET_PROCESSING_ERROR: "WALLET_PROCESSING_ERROR";
465
+ readonly FORCED_OUTCOMES_NOT_ALLOWED: "FORCED_OUTCOMES_NOT_ALLOWED";
466
+ readonly MISSING_GAME_STATE: "MISSING_GAME_STATE";
467
+ readonly DATA_ACCESS_ERROR: "DATA_ACCESS_ERROR";
468
+ readonly UNKNOWN: "UNKNOWN";
469
+ };
470
+
471
+ declare type RgsErrorData = {
472
+ code: keyof typeof RgsErrorCode;
473
+ details?: unknown;
474
+ };
475
+
476
476
  declare type RgsOnlyMessagePayloadMap = {
477
- openGameError: OpenGameError;
477
+ openGameError: RgsError;
478
478
  openGameResponse: OpenGameResponse;
479
- playError: PlayError;
479
+ playError: RgsError;
480
480
  playResponse: PlayResponse;
481
481
  realityCheck: {
482
482
  duration: number;
@@ -555,6 +555,15 @@ declare interface SdkConfig {
555
555
  };
556
556
  }
557
557
 
558
+ declare type SdkError = {
559
+ messageCode: string;
560
+ type: 'CLOSE' | 'RELOAD' | 'CONTINUE';
561
+ } & ({
562
+ message: string;
563
+ } | {
564
+ messageKey: string;
565
+ });
566
+
558
567
  declare type SdkOnlyMessagePayloadMap = {
559
568
  autoplay: {
560
569
  action: 'start' | 'stop' | 'pause' | 'resume';
@@ -572,7 +581,7 @@ declare type SdkOnlyMessagePayloadMap = {
572
581
  }[];
573
582
  };
574
583
  close: never;
575
- error: Error_2;
584
+ error: SdkError;
576
585
  fullscreen: {
577
586
  lock?: OrientationLockType;
578
587
  };
@@ -591,6 +600,18 @@ declare type SdkOnlyMessagePayloadMap = {
591
600
  ready: boolean;
592
601
  };
593
602
  playStart: ContractPlayPayload;
603
+ /**
604
+ * ```typescript
605
+ * {
606
+ * en: {
607
+ * 'generic_error': 'Something went wrong',
608
+ * },
609
+ * pl: {
610
+ * 'generic_error': 'Coś poszło nie tak',
611
+ * }
612
+ * }
613
+ * ```
614
+ */
594
615
  translations: Record<string, Record<string, string>>;
595
616
  settings: Settings;
596
617
  'telemetry.click': {