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