@kalamba/sdk 0.7.0 → 0.8.1
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/{errors-c5948a4a.cjs → errors-358575c3.cjs} +1 -1
- package/dist/{errors-867a013a.js → errors-afd9f527.js} +44 -11
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +33 -19
- package/dist/index.js +52 -45
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.ts +43 -27
- package/dist/plugins.js +408 -409
- package/dist/wrapper.cjs +1 -1
- package/dist/wrapper.d.ts +48 -29
- package/dist/wrapper.js +692 -642
- package/package.json +1 -1
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 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;
|
|
5
|
+
"use strict";var zt=Object.defineProperty;var qt=(i,t,e)=>t in i?zt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var b=(i,t,e)=>(qt(i,typeof t!="symbol"?t+"":t,e),e),ct=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var y=(i,t,e)=>(ct(i,t,"read from private field"),e?e.call(i):t.get(i)),C=(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)=>(ct(i,t,"write to private field"),a?a.call(i,e):t.set(i,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Re=require("./errors-358575c3.cjs"),dt=require("./noop-b3c54b76.cjs");function U(i,t){return(e,...a)=>{console.log(`[%c${i}\x1B[m] %s`,t,e,...a)}}function _t(i,t){return Math.round(i*100/t)}class G{constructor(t,e){b(this,"config");b(this,"sdkConfig");this.config=t,this.sdkConfig=e}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 Gt=U("BasicPlugin","color:#000000;font-weight:bold;");class Wt extends G{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),Gt("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.sdkConfig.api;a.currency===n&&typeof a.balanceInCurrency=="number"?this.send("balance",{balance:_t(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.sdkConfig.api.homeUrl)try{window.top.location=this.sdkConfig.api.homeUrl}catch{window.location=this.sdkConfig.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}const k=U("▼ DebuggingPlugin IN ▼","color:#444444;font-weight:bold;"),$t=U("▲ DebuggingPlugin OUT ▲","color:#444444;font-weight:bold;");class jt 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){$t(...t),this.send(...t)}}const Kt=U("GigPlugin","color:#000000;font-weight:bold;");class Qt extends G{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),Kt("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.sdkConfig.api.homeUrl)try{window.top.location=this.sdkConfig.api.homeUrl}catch{window.location=this.sdkConfig.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}}),this.on("playReady",()=>{this.postMessage("GAME_READY")})}}const Xt=U("OryxPlugin","color:#000000;font-weight:bold;");class Jt extends G{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),Xt("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 lt=U("PariplayPlugin","color:#000000;font-weight:bold;");function Ve(i){try{window.top.location=i}catch{window.location=i}}function ze(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 qe(){}function Yt(i){return i.filter(function(e){return e.messageType.toUpperCase()==="DATA"})}function Ge(i){return i.filter(function(e){return["NOTIFICATION","POPUP"].includes(e.messageType.toUpperCase())})}function Ft(i){try{return JSON.parse(i.text)}catch{return{}}}function Zt(i){return i.map(Ft).filter(Boolean).find(function(e){return e.betId!=null&&e.winId!=null})||{}}function ei(i){return i.map(Ft).filter(Boolean).find(function(e){return e.TotalBet!=null&&e.TotalWin!=null})||{}}class ti extends G{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),lt("configured")}postMessage(t,e){const a={lang:this.sdkConfig.ui.language,sender:this.sdkConfig.api.game,type:t};e!=null&&(a.data=e),lt("postMessage",a),window.parent.postMessage(a,"*")}coinsToCurrency(t){return t*this.sdkConfig.api.coinValueInCents/100}handleContinueButton(t,e){t.link&&ze("GET",t.link),e()}handleLinkButton(t,e){switch(t.linkType.toUpperCase()){case"AJAX":ze("GET",t.link),e();return;case"AJAXRESPONSE":ze("GET",t.link).then(()=>{e()});return;case"REDIRECT":Ve(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.sdkConfig.api.cashierUrl:!0).map(r=>Object.assign({},r,{onRelease:()=>{const s=a.messageType.toUpperCase()==="POPUP"?qe:n,h=this.buttonActions[r.action.toUpperCase()];h?h(r,s):s()}}))})}).catch(qe)),Promise.resolve()).then(()=>{}).catch(qe)}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.sdkConfig.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=Ge(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.sdkConfig.api.homeUrl)if(this.sdkConfig.api.homeUrl==="(back)")try{window.top.history.back()}catch{window.history.back()}else this.sdkConfig.api.homeUrl==="(api)"?this.postMessage("quit"):Ve(this.sdkConfig.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=Ge(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=Yt(e.contract.uiMessages),r=Ge(e.contract.uiMessages),s=Zt(n),h=ei(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.sdkConfig.api.cashierUrl&&(this.sdkConfig.api.cashierUrl==="(api)"?this.postMessage("cashier"):Ve(this.sdkConfig.api.cashierUrl))})}}const ge=U("RelaxFEIMPlugin","color:#000000;font-weight:bold;");class ii extends G{constructor(...e){super(...e);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=()=>{ge("loaded"),window.FEIM.configure({p2pConfig:{currency:this.sdkConfig.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 We=U("TukoPlugin","color:#000000;font-weight:bold;");class ai extends G{constructor(...e){super(...e);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(),We("configured")}ping(e){const a=new XMLHttpRequest;a.onreadystatechange=function(){a.readyState===XMLHttpRequest.DONE&&(a.status===0||a.status>=200&&a.status<400?We("ping ok",a):We("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.sdkConfig.api;n.currency===r&&typeof n.balanceInCurrency=="number"?this.send("balance",{balance:_t(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.sdkConfig.api.homeUrl)try{window.top.location=this.sdkConfig.api.homeUrl}catch{window.location=this.sdkConfig.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}class Dt{constructor(t,e){b(this,"config");b(this,"sdkConfig");this.config=t,this.sdkConfig=e}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 ni{constructor(t){b(this,"socket",null);b(this,"webSocketUrl");b(this,"eventListeners",{close:[],error:[],message:[]});b(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)})})});b(this,"send",t=>{if(this.socket==null)throw new Error("Cannot send message, the WebSocket connection is not open");this.socket.send(t)});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",t=>{console.log(t)})});b(this,"handleClose",t=>{this.eventListeners.close.forEach(e=>{e(t)})});b(this,"handleError",t=>{this.eventListeners.error.forEach(e=>{e(t)})});b(this,"handleMessage",t=>{this.eventListeners.message.forEach(e=>{e(t)})});b(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 Me(i){return JSON.parse(i==null?void 0:i.data)}function si(i){var t;return((t=i==null?void 0:i.header)==null?void 0:t.name)==="Ping"}function ut(i){var t;return((t=i==null?void 0:i.header)==null?void 0:t.name)==="RealityCheck"}function Le(i){return i.header.name==="GameEvent"}function oi(i){return Le(i)&&i.body.event==="OPEN_GAME"}function ht(i){return i.header.code!==1}function ri(i){return Le(i)&&i.body.event.includes("_RESULT")}var ie,ve;class ci extends ni{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());b(this,"cId",0);b(this,"mId",0);b(this,"seqId",10);b(this,"gameCode");C(this,ie,void 0);C(this,ve,void 0);b(this,"onMessage",e=>{const a=Me(e);(Le(a)||si(a)||ut(a))&&this.sendAcknowledgement(a),ut(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=Me(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=Me(h);oi(g)?(this.removeEventListener("message",s),n(g.body)):ht(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 p=Me(w);Le(p)&&r.seqId===p.body.correlationSeqId&&(this.removeEventListener("message",g),ri(p)?s(p.body):ht(p)&&h({data:p.body,type:"error"}))};this.addEventListener("message",g),this.request(n,r).catch(w=>{var p;return h({data:(p=w==null?void 0:w.message)==null?void 0:p.body,type:w.type})})})}setRequestTimeoutMs(e){v(this,ie,e)}}ie=new WeakMap,ve=new WeakMap;function di(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 li(i){var t,e;return{code:((t=i.data)==null?void 0:t.code)??Re.RgsErrorCode.UNKNOWN,details:(e=i.data)==null?void 0:e.details}}function ui(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 hi(i){var t,e;return{code:((t=i.data)==null?void 0:t.code)??Re.RgsErrorCode.UNKNOWN,details:(e=i.data)==null?void 0:e.details}}function gi(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 wi(i){var t,e;return{code:((t=i.data)==null?void 0:t.code)??Re.RgsErrorCode.UNKNOWN,details:(e=i.data)==null?void 0:e.details}}const bi={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"},pi=U("KalambaBullseyePlugin","color:#000000;font-weight:bold;");class mi extends Dt{constructor(...e){super(...e);b(this,"socket");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("configured",a=>{this.socket.setRequestTimeoutMs(a.ui.requestTimeoutMs)}),this.registerFromSdkEvents()}initialize(e){this.socket=new ci(e,{gameVersion:this.config.gameVersion,requestTimeoutMs:this.sdkConfig.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=>pi("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"),p=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:Re.RgsErrorCode.CONNECTION_ERROR}}}let K;try{K=await this.socket.authenticate()}catch(B){throw{type:B.type,data:B.type==="error"?li(B.data):void 0}}let Q;try{Q=await this.socket.openGame()}catch(B){throw{type:B.type,data:B.type==="error"?hi(B.data):void 0}}const L=di(K),he=ui(K,Q);this.sdkConfig.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:p,homeUrl:P,cashierUrl:N,sessionId:he.contract.sessionId,lastRoundId:he.contract.roundId};const x=e.get("languageCode");return x&&(this.sdkConfig.ui.language=x.length===3?bi[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(p){throw{type:p.type,data:p.type==="error"?wi(p.data):void 0}}return gi(w)}registerFromSdkEvents(){this.on("history",()=>{const{api:{game:e,integration:a,integrationData:n,jurisdiction:r,user:s,gameHistoryUrl:h},ui:{language:g}}=this.sdkConfig,w=s.replace(/^user_/,"").replace(new RegExp(`_${a}$`),""),p=new URL(h);p.searchParams.set("gameCode",e),p.searchParams.set("jurisdiction",r),p.searchParams.set("operatorCode",a),p.searchParams.set("token",n.token),p.searchParams.set("username",w),p.searchParams.set("languageCode",g),window.open(p.toString(),"_blank")})}}var fi="2.0.0-beta.2",de="",gt="?",Ye="function",z="undefined",le="object",Ze="string",fe="major",d="model",o="name",l="type",u="vendor",c="version",M="architecture",Z="console",m="mobile",f="tablet",I="smarttv",Y="wearable",et="embedded",wt="user-agent",tt=500,nt="brands",$="formFactor",st="fullVersionList",ee="platform",ot="platformVersion",Ne="bitness",W="sec-ch-ua",yi=W+"-full-version-list",vi=W+"-arch",ki=W+"-"+Ne,Ei=W+"-form-factor",Ci=W+"-"+m,Mi=W+"-"+d,Rt=W+"-"+ee,Si=Rt+"-version",Nt=[nt,st,m,d,ee,ot,M,$,Ne],T="browser",_="cpu",O="device",F="engine",A="os",te="result",Se="Amazon",we="Apple",bt="ASUS",pt="BlackBerry",Ie="Google",mt="Huawei",ft="Lenovo",$e="LG",Ue="Microsoft",yt="Motorola",Te="Samsung",vt="Sharp",Pe="Sony",je="Xiaomi",Ke="Zebra",X="Mobile ",J=" Browser",Ae="Chrome",Ii="Edge",be="Firefox",pe="Opera",kt="Facebook",Et="Sogou",it="Windows",Ti=typeof window!==z,S=Ti&&window.navigator?window.navigator:void 0,H=S&&S.userAgentData?S.userAgentData:void 0,Pi=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},He=function(i){for(var t={},e=0;e<i.length;e++)t[i[e].toUpperCase()]=i[e];return t},at=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},Ct=function(i){for(var t in i)return/^(browser|cpu|device|engine|os)$/.test(t)},ue=function(i){return typeof i===Ze},Qe=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},Xe=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,tt)},Mt=function(i,t){if(!(!i||!t))for(var e=0,a,n,r,s,h,g;e<t.length&&!h;){var w=t[e],p=t[e+1];for(a=n=0;a<w.length&&!h&&w[a];)if(h=w[a++].exec(i),h)for(r=0;r<p.length;r++)g=h[++n],s=p[r],typeof s===le&&s.length>0?s.length===2?typeof s[1]==Ye?this[s[0]]=s[1].call(this,g):this[s[0]]=s[1]:s.length===3?typeof s[1]===Ye&&!(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}},Be=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(at(t[e][a],i))return e===gt?void 0:e}else if(at(t[e],i))return e===gt?void 0:e;return t.hasOwnProperty("*")?t["*"]:i},St={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"},It={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:["VR","XR","Watch"],"?":["Desktop","Unknown"],"*":void 0},Tt={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 "+ft+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,Te+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[o,/_/g," "],c],[/metasr[\/ ]?([\d\.]+)/i],[c,[o,Et+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[o,Et+" 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,Ae+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[o,Ae+" 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],[[M,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[M,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[M,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[M,"armhf"]],[/windows (ce|mobile); ppc;/i],[[M,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[M,/ower/,de,q]],[/(sun4\w)[;\)]/i],[[M,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[M,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,Te],[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,Te],[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,vt],[l,m]],[/\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,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,je],[l,m]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[u,je],[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,yt],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[u,yt],[l,f]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[u,$e],[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,$e],[l,m]],[/(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,m]],[/(pixel c)\b/i],[d,[u,Ie],[l,f]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[u,Ie],[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,Pe],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[u,Pe],[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,Se],[l,f]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[u,Se],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[d,u,[l,f]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[u,pt],[l,m]],[/(?:\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,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,Ue],[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,Ue],[l,m]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[u,Ke],[l,f]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[u,Ke],[l,m]],[/smart-tv.+(samsung)/i],[u,[l,I]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[u,Te],[l,I]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[u,$e],[l,I]],[/(apple) ?tv/i],[u,[d,we+" TV"],[l,I]],[/crkey/i],[[d,Ae+"cast"],[u,Ie],[l,I]],[/droid.+aft(\w+)( bui|\))/i],[d,[u,Se],[l,I]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[u,vt],[l,I]],[/(bravia[\w ]+)( bui|\))/i],[d,[u,Pe],[l,I]],[/(mitv-\w{5}) bui/i],[d,[u,je],[l,I]],[/Hbbtv.*(technisat) (.*);/i],[u,d,[l,I]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[u,ye],[d,ye],[l,I]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,I]],[/(ouya)/i,/(nintendo) (\w+)/i],[u,d,[l,Z]],[/droid.+; (shield) bui/i],[d,[u,"Nvidia"],[l,Z]],[/(playstation \w+)/i],[d,[u,Pe],[l,Z]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[u,Ue],[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,Ie],[l,Y]],[/droid.+; (wt63?0{2,3})\)/i],[d,[u,Ke],[l,Y]],[/(quest( 2| pro)?)/i],[d,[u,kt],[l,Y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[u,[l,et]],[/(aeobc)\b/i],[d,[u,Se],[l,et]],[/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,Ii+"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,Be,St]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,Be,St],[o,it]],[/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,pt]],[/(?: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,Ae+"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]]},xe=function(){var i={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return D.call(i.init,[[T,[o,c,fe]],[_,[M]],[O,[l,d,u]],[F,[o,c]],[A,[o,c]]]),D.call(i.isIgnore,[[T,[c,fe]],[F,[c]],[A,[c]]]),D.call(i.isIgnoreRgx,[[T,/ ?browser$/i],[A,/ ?os$/i]]),D.call(i.toString,[[T,[o,c]],[_,[M]],[O,[u,d]],[F,[o,c]],[A,[o,c]]]),i}(),Ai=function(i,t){var e=xe.init[t],a=xe.isIgnore[t]||0,n=xe.isIgnoreRgx[t]||0,r=xe.toString[t]||0;function s(){D.call(this,e)}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()},t!=te&&(s.prototype.is=function(h){var g=!1;for(var w in this)if(this.hasOwnProperty(w)&&!at(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 p=new w;return h(p),p}),new s};function Ht(i,t){if(i=i||{},D.call(this,Nt),t)D.call(this,[[nt,Qe(i[W])],[st,Qe(i[yi])],[m,/\?1/.test(i[Ci])],[d,me(i[Mi])],[ee,me(i[Rt])],[ot,me(i[Si])],[M,me(i[vi])],[$,Qe(i[Ei])],[Ne,me(i[ki])]]);else for(var e in i)this.hasOwnProperty(e)&&typeof i[e]!==z&&(this[e]=i[e])}function Pt(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(S&&S.userAgent==this.ua)switch(this.itemType){case T:S.brave&&typeof S.brave.isBrave==Ye&&this.set(o,"Brave");break;case O:!this.get(l)&&H&&H[m]&&this.set(l,m),this.get(d)=="Macintosh"&&S&&typeof S.standalone!==z&&S.maxTouchPoints&&S.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(T,r(T)).set(_,r(_)).set(O,r(O)).set(F,r(F)).set(A,r(A))}return this},this.parseUA=function(){return this.itemType!=te&&Mt.call(this.data,this.ua,this.rgxMap),this.itemType==T&&this.set(fe,Xe(this.get(c))),this},this.parseCH=function(){var n=this.uaCH,r=this.rgxMap;switch(this.itemType){case T:var s=n[st]||n[nt],h;if(s)for(var g in s){var w=j(/(Google|Microsoft) /,s[g].brand||s[g]),p=s[g].version;!/not.a.brand/i.test(w)&&(!h||/chrom/i.test(h)&&!/chromi/i.test(w))&&(this.set(o,w).set(c,p).set(fe,Xe(p)),h=w)}break;case _:var P=n[M];P&&(P&&n[Ne]=="64"&&(P+="64"),Mt.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,Ue),n[$]){var N;if(typeof n[$]!="string")for(var K=0;!N&&K<n[$].length;)N=Be(n[$][K++],It);else N=Be(n[$],It);this.set(l,N)}break;case A:var Q=n[ee];if(Q){var L=n[ot];Q==it&&(L=parseInt(Xe(L),10)>=13?"11":"10"),this.set(o,Q).set(c,L)}this.get(o)==it&&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(T,x(T)).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",Ai(this,i)]]),this}function R(i,t,e){if(typeof i===le?(Ct(i)?(typeof t===le&&(e=t),t=i):(e=i,t=void 0),i=void 0):typeof i===Ze&&!Ct(t)&&(e=t,t=void 0),!(this instanceof R))return new R(i,t,e).getResult();var a=typeof i===Ze?i:S&&S.userAgent?S.userAgent:e&&e[wt]?e[wt]:de,n=new Ht(e,!0),r=t?Pi(Tt,t):Tt,s=function(h){return h==te?function(){return new Pt(h,a,r,n).set("ua",a).set(T,this.getBrowser()).set(_,this.getCPU()).set(O,this.getDevice()).set(F,this.getEngine()).set(A,this.getOS()).get()}:function(){return new Pt(h,a,r[h],n).parseUA().get()}};return D.call(this,[["getBrowser",s(T)],["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>tt?ye(h,tt):h),this}]]).setUA(a),this}R.VERSION=fi;R.BROWSER=He([o,c,fe]);R.CPU=He([M]);R.DEVICE=He([d,u,l,Z,m,I,f,Y,et]);R.ENGINE=R.OS=He([o,c]);class Vt{constructor(t,e,a){b(this,"trackers");b(this,"config");b(this,"sdkConfig");this.trackers=t,this.config=e,this.sdkConfig=a}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 At(i){return i.reduce((t,e)=>t+e,0)}function xi(i){const t=i.length,e=At(i)/t,a=i.map(r=>Math.pow(r-e,2)),n=At(a)/t;return Math.sqrt(n)}class xt{constructor(){b(this,"rafId",-1);b(this,"startTime",0);b(this,"stopTime",0);b(this,"frames",[]);b(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)});b(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?xi(t):0;return{fpsAvg:e,fpsMax:a,fpsMin:n,fpsStdDev:r}});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 Oi="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 Bi(){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 Je(){return window.innerWidth>=window.innerHeight?Oi:Ui}var _e,ae,ne,se,ke,Fe,Ee,De;class _i extends Vt{constructor(...e){super(...e);b(this,"FPS_SAMPLE_INTERVAL",1e4);C(this,_e,0);C(this,ae,"");C(this,ne,void 0);C(this,se,void 0);C(this,ke,!1);C(this,Fe,!1);C(this,Ee,"");C(this,De,[]);v(this,ne,{}),v(this,se,this.deviceInfo()),this.on("state",({balance:a,version:n})=>{v(this,ae,n),v(this,_e,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,Fe,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.messageCode,systemMessageType:e.type})}),this.on("openGameResponse",async e=>{v(this,Ee,e.contract.stateType.nextRound),v(this,ne,{balanceInCoins:e.contract.balance.coins,clientVersion:y(this,ae),coinValueInCents:this.sdkConfig.api.coinValueInCents,coinValueInCentsFloat:this.sdkConfig.api.coinValueInCents,currency:this.sdkConfig.api.currency,defaultBaseBet:e.contract.bet.default.base,defaultBetMultiplier:e.contract.bet.default.multiplier,environment:"release",gameCode:this.sdkConfig.api.game,gameCodeServer:this.sdkConfig.api.game,gameModelFile:e.contract.gameModel,jurisdiction:this.sdkConfig.api.jurisdiction,languageCode:this.sdkConfig.ui.language,operatorName:"kalamba",partnerId:this.sdkConfig.api.brand,partnerParentId:this.sdkConfig.api.integration,platform:"WEB",playMode:this.sdkConfig.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,p=w-g,P=s||"spin",N=e.contract.roundId;this.track("Betting Activity",{balance:h-p,balanceAfter:h,baseBet:n,betMultiplier:r,betType:P,gameVersion:y(this,ae),coinValueInCents:this.sdkConfig.api.coinValueInCents,coinValueInCentsFloat:this.sdkConfig.api.coinValueInCents,currency:this.sdkConfig.api.currency,environment:"release",gameCode:this.sdkConfig.api.game,gameCodeServer:this.sdkConfig.api.game,isMobile:a.isMobile,netResult:p,operatorName:"kalamba",orientation:Je(),partnerId:this.sdkConfig.api.brand,partnerParentId:this.sdkConfig.api.integration,platform:"WEB",playMode:this.sdkConfig.api.playMode,roundId:N,roundTypes:["BaseGame"],totalBet:g,totalWin:w}),v(this,De,[])}),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 xt,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 xt;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:Je(),stateType:y(this,Ee)}}async deviceInfo(){var g;const e=new R(navigator.userAgent),a=Li(),n=await Bi(),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: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}}}_e=new WeakMap,ae=new WeakMap,ne=new WeakMap,se=new WeakMap,ke=new WeakMap,Fe=new WeakMap,Ee=new WeakMap,De=new WeakMap;let Oe;const Fi=new Uint8Array(16);function Di(){if(!Oe&&(Oe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Oe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Oe(Fi)}const E=[];for(let i=0;i<256;++i)E.push((i+256).toString(16).slice(1));function Ri(i,t=0){return E[i[t+0]]+E[i[t+1]]+E[i[t+2]]+E[i[t+3]]+"-"+E[i[t+4]]+E[i[t+5]]+"-"+E[i[t+6]]+E[i[t+7]]+"-"+E[i[t+8]]+E[i[t+9]]+"-"+E[i[t+10]]+E[i[t+11]]+E[i[t+12]]+E[i[t+13]]+E[i[t+14]]+E[i[t+15]]}const Ni=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ot={randomUUID:Ni};function Ut(i,t,e){if(Ot.randomUUID&&!t&&!i)return Ot.randomUUID();i=i||{};const a=i.random||(i.rng||Di)();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 Ri(a)}class rt{constructor(t,e){b(this,"config");b(this,"sdkConfig");this.config=t,this.sdkConfig=e}}const Lt=25,Bt=1e4;var oe,re,ce,V,Ce;class Hi extends rt{constructor(...e){super(...e);C(this,oe,"https://europe-west3-stargazer-328808.cloudfunctions.net/collect-events");C(this,re,void 0);C(this,ce,void 0);C(this,V,[]);C(this,Ce,void 0);b(this,"processQueueForced");v(this,re,new Date().getTime()),v(this,V,[]),v(this,Ce,Ut()),this.processQueueForced=this.processQueue.bind(this,!0),this.schedule(),fetch(y(this,oe),{method:"OPTIONS"}).catch(dt.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(),Bt))}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(dt.noop)}this.schedule()}addToQueue(e){y(this,V).push(e),this.processQueue()}processQueue(e=!1){if(!(this.sdkConfig==null||!this.sdkConfig.ui.feature.allowTelemetry)&&!(!e&&y(this,V).length<Lt&&new Date().getTime()-y(this,re)<Bt))for(;y(this,V).length;){const a=y(this,V).splice(0,Lt).map(n=>({...n,sessionID:y(this,Ce),userID:this.sdkConfig.api.user}));this.send(a)}}track(e,a){this.addToQueue({eventName:e,eventParams:a,eventTimestamp:new Date().getTime(),eventUUID:Ut()})}}oe=new WeakMap,re=new WeakMap,ce=new WeakMap,V=new WeakMap,Ce=new WeakMap;const Vi=U("LoggingTracker","color:#000000;font-weight:bold;");class zi extends rt{track(t,e){Vi(`@${this.sdkConfig.api.user}`,`[${t}]`,e)}}exports.BasicPlugin=Wt;exports.CasinoPlugin=G;exports.DebuggingPlugin=jt;exports.GigPlugin=Qt;exports.KalambaBullseyePlugin=mi;exports.KalambaStargazerPlugin=_i;exports.KalambaStargazerTracker=Hi;exports.LoggingTracker=zi;exports.OryxPlugin=Jt;exports.PariplayPlugin=ti;exports.RelaxFEIMPlugin=ii;exports.RgsPlygin=Dt;exports.TelemetryPlugin=Vt;exports.Tracker=rt;exports.TukoPlugin=ai;
|
package/dist/plugins.d.ts
CHANGED
|
@@ -51,8 +51,9 @@ declare type CasinoOnlyMessagePayloadMap = {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
export declare abstract class CasinoPlugin {
|
|
54
|
-
config:
|
|
55
|
-
|
|
54
|
+
config: WrapperConfig;
|
|
55
|
+
sdkConfig: SdkConfig;
|
|
56
|
+
constructor(config: WrapperConfig, sdkConfig: SdkConfig);
|
|
56
57
|
protected on<M extends DomainMessage<'wrapper'> | ForwardToPluginsMessage<'casino'>>(message: M, listener: (payload: M extends DomainMessage<'wrapper'> ? DomainMessagePayload<'wrapper', M> : M extends ForwardToPluginsMessage<'casino'> ? ForwardToPluginsMessagePayload<'casino', M> : never) => void, options?: AddEventListenerOptions): void;
|
|
57
58
|
protected send<M extends DomainMessage<'casino'>>(message: M, ...[payload]: DomainMessagePayload<'casino', M> extends never ? [] : [payload: DomainMessagePayload<'casino', M>]): void;
|
|
58
59
|
}
|
|
@@ -112,7 +113,6 @@ declare type History_2 = {
|
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
export declare class KalambaBullseyePlugin extends RgsPlygin {
|
|
115
|
-
#private;
|
|
116
116
|
socket: KalambaWebSocketClient;
|
|
117
117
|
constructor(...args: ConstructorParameters<typeof RgsPlygin>);
|
|
118
118
|
initialize(init: KalambaWebSocketClientInit): void;
|
|
@@ -300,12 +300,6 @@ export declare class LoggingTracker extends Tracker {
|
|
|
300
300
|
|
|
301
301
|
declare type OmitFirstParam<T extends (...args: any[]) => any> = T extends (arg: any, ...rest: infer R) => infer Result ? (...args: R) => Result : never;
|
|
302
302
|
|
|
303
|
-
declare type OpenGameRequest = {
|
|
304
|
-
gameName: string;
|
|
305
|
-
/** version of game client */
|
|
306
|
-
version: string;
|
|
307
|
-
};
|
|
308
|
-
|
|
309
303
|
declare type OpenGameResponse = {
|
|
310
304
|
contract: {
|
|
311
305
|
bet: {
|
|
@@ -427,13 +421,6 @@ export declare class RelaxFEIMPlugin extends CasinoPlugin {
|
|
|
427
421
|
|
|
428
422
|
declare type ResponseMessageName = 'Authenticate' | 'GameAction' | 'GameEvent' | 'OpenGame' | 'Ping' | 'RealityCheck';
|
|
429
423
|
|
|
430
|
-
declare type RgsError = {
|
|
431
|
-
type: 'timeout';
|
|
432
|
-
} | {
|
|
433
|
-
type: 'error';
|
|
434
|
-
data: RgsErrorData;
|
|
435
|
-
};
|
|
436
|
-
|
|
437
424
|
declare const RgsErrorCode: {
|
|
438
425
|
readonly CONNECTION_ERROR: "CONNECTION_ERROR";
|
|
439
426
|
readonly INVALID_BET_CURRENCY: "INVALID_BET_CURRENCY";
|
|
@@ -473,10 +460,17 @@ declare type RgsErrorData = {
|
|
|
473
460
|
details?: unknown;
|
|
474
461
|
};
|
|
475
462
|
|
|
463
|
+
declare type RgsErrorWithType = {
|
|
464
|
+
type: 'timeout';
|
|
465
|
+
} | {
|
|
466
|
+
type: 'error';
|
|
467
|
+
data: RgsErrorData;
|
|
468
|
+
};
|
|
469
|
+
|
|
476
470
|
declare type RgsOnlyMessagePayloadMap = {
|
|
477
|
-
openGameError:
|
|
471
|
+
openGameError: RgsErrorWithType;
|
|
478
472
|
openGameResponse: OpenGameResponse;
|
|
479
|
-
playError:
|
|
473
|
+
playError: RgsErrorWithType;
|
|
480
474
|
playResponse: PlayResponse;
|
|
481
475
|
realityCheck: {
|
|
482
476
|
duration: number;
|
|
@@ -486,8 +480,9 @@ declare type RgsOnlyMessagePayloadMap = {
|
|
|
486
480
|
};
|
|
487
481
|
|
|
488
482
|
export declare abstract class RgsPlygin {
|
|
489
|
-
config:
|
|
490
|
-
|
|
483
|
+
config: WrapperConfig;
|
|
484
|
+
sdkConfig: SdkConfig;
|
|
485
|
+
constructor(config: WrapperConfig, sdkConfig: SdkConfig);
|
|
491
486
|
protected on<M extends DomainMessage<'wrapper'> | ForwardToPluginsMessage<'rgs'>>(message: M, listener: (payload: M extends DomainMessage<'wrapper'> ? DomainMessagePayload<'wrapper', M> : M extends ForwardToPluginsMessage<'rgs'> ? ForwardToPluginsMessagePayload<'rgs', M> : never) => void, options?: AddEventListenerOptions): void;
|
|
492
487
|
protected send<M extends DomainMessage<'rgs'>>(message: M, ...[payload]: DomainMessagePayload<'rgs', M> extends never ? [] : [payload: DomainMessagePayload<'rgs', M>]): void;
|
|
493
488
|
}
|
|
@@ -549,6 +544,12 @@ declare interface SdkConfig {
|
|
|
549
544
|
maximumBet?: number;
|
|
550
545
|
minimumSpinDuration: number;
|
|
551
546
|
requestTimeoutMs: number;
|
|
547
|
+
incompleteGameResolution: {
|
|
548
|
+
type: 'NONE' | 'MANUAL';
|
|
549
|
+
} | {
|
|
550
|
+
daysToAutoResolution: number;
|
|
551
|
+
type: 'AUTOMATIC';
|
|
552
|
+
};
|
|
552
553
|
realityCheck: RealityCheckConfig;
|
|
553
554
|
skipInsufficientFundsCheck: boolean;
|
|
554
555
|
skipSplash: boolean;
|
|
@@ -565,6 +566,7 @@ declare type SdkError = {
|
|
|
565
566
|
});
|
|
566
567
|
|
|
567
568
|
declare type SdkOnlyMessagePayloadMap = {
|
|
569
|
+
configure: Partial<WrapperConfig>;
|
|
568
570
|
autoplay: {
|
|
569
571
|
action: 'start' | 'stop' | 'pause' | 'resume';
|
|
570
572
|
};
|
|
@@ -591,7 +593,7 @@ declare type SdkOnlyMessagePayloadMap = {
|
|
|
591
593
|
progress: number;
|
|
592
594
|
};
|
|
593
595
|
loadStart: never;
|
|
594
|
-
openGame:
|
|
596
|
+
openGame: never;
|
|
595
597
|
play: PlayRequest;
|
|
596
598
|
playCycleEnd: PlayResponse;
|
|
597
599
|
playCycleStart: ContractPlayPayload;
|
|
@@ -619,6 +621,9 @@ declare type SdkOnlyMessagePayloadMap = {
|
|
|
619
621
|
name: string;
|
|
620
622
|
};
|
|
621
623
|
'telemetry.orientationChange': never;
|
|
624
|
+
freeRoundsOffer: any;
|
|
625
|
+
freeRoundsInfo: any;
|
|
626
|
+
freeRoundsComplete: any;
|
|
622
627
|
};
|
|
623
628
|
|
|
624
629
|
declare type Settings = {
|
|
@@ -634,8 +639,9 @@ declare type TelemetryOnlyMessagePayloadMap = {
|
|
|
634
639
|
|
|
635
640
|
export declare abstract class TelemetryPlugin {
|
|
636
641
|
trackers: Tracker[];
|
|
637
|
-
config:
|
|
638
|
-
|
|
642
|
+
config: WrapperConfig;
|
|
643
|
+
sdkConfig: SdkConfig;
|
|
644
|
+
constructor(trackers: Tracker[], config: WrapperConfig, sdkConfig: SdkConfig);
|
|
639
645
|
protected on<M extends DomainMessage<'wrapper'> | ForwardToPluginsMessage<'telemetry'>>(message: M, listener: (payload: M extends DomainMessage<'wrapper'> ? DomainMessagePayload<'wrapper', M> : M extends ForwardToPluginsMessage<'telemetry'> ? ForwardToPluginsMessagePayload<'telemetry', M> : never) => void, options?: AddEventListenerOptions): void;
|
|
640
646
|
protected track(event: unknown, data: Record<string, unknown>): void;
|
|
641
647
|
}
|
|
@@ -665,8 +671,9 @@ declare type ToTelemetryPluginsForwardedMessageMap = {
|
|
|
665
671
|
};
|
|
666
672
|
|
|
667
673
|
export declare abstract class Tracker {
|
|
668
|
-
config:
|
|
669
|
-
|
|
674
|
+
config: WrapperConfig;
|
|
675
|
+
sdkConfig: SdkConfig;
|
|
676
|
+
constructor(config: WrapperConfig, sdkConfig: SdkConfig);
|
|
670
677
|
abstract track(event: unknown, data: Record<string, unknown>): void;
|
|
671
678
|
}
|
|
672
679
|
|
|
@@ -711,10 +718,21 @@ declare interface WebSocketResponse<Name extends ResponseMessageName, Header = R
|
|
|
711
718
|
};
|
|
712
719
|
}
|
|
713
720
|
|
|
721
|
+
declare type WrapperConfig = {
|
|
722
|
+
gameName: string;
|
|
723
|
+
gameVersion: string;
|
|
724
|
+
showFreeRounds: boolean;
|
|
725
|
+
showRealityCheck: boolean;
|
|
726
|
+
showErrors: boolean;
|
|
727
|
+
showBars: boolean;
|
|
728
|
+
skipErrors: ((typeof RgsErrorCode)[keyof typeof RgsErrorCode] | 'TIMEOUT')[];
|
|
729
|
+
};
|
|
730
|
+
|
|
714
731
|
declare type WrapperOnlyMessagePayloadMap = {
|
|
715
732
|
bet: Bet;
|
|
716
733
|
close: never;
|
|
717
734
|
configured: SdkConfig;
|
|
735
|
+
error: SdkError;
|
|
718
736
|
freeze: never;
|
|
719
737
|
history: History_2;
|
|
720
738
|
resume: never;
|
|
@@ -726,8 +744,6 @@ declare type WrapperOnlyMessagePayloadMap = {
|
|
|
726
744
|
declare type WrapperState = {
|
|
727
745
|
balance: number;
|
|
728
746
|
bet: Bet;
|
|
729
|
-
gameName: string;
|
|
730
|
-
version: string;
|
|
731
747
|
};
|
|
732
748
|
|
|
733
749
|
export { }
|