@kalamba/sdk 0.16.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/plugins.cjs CHANGED
@@ -2,4 +2,4 @@
2
2
  * BSD 3-Clause License
3
3
  * Copyright (c) 2025, Kalamba Games Limited
4
4
  */
5
- "use strict";var Xt=Object.defineProperty;var lt=s=>{throw TypeError(s)};var Jt=(s,t,e)=>t in s?Xt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var m=(s,t,e)=>Jt(s,typeof t!="symbol"?t+"":t,e),ut=(s,t,e)=>t.has(s)||lt("Cannot "+e);var y=(s,t,e)=>(ut(s,t,"read from private field"),e?e.call(s):t.get(s)),C=(s,t,e)=>t.has(s)?lt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),E=(s,t,e,i)=>(ut(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Fe=require("./errors-BXO3dlhS.cjs"),at=require("./v4-C9_uc0A9.cjs");function O(s,t){return(e,...i)=>{console.log(`[%c${s}\x1B[m] %s`,t,e,...i)}}function Ft(s,t){return Math.round(s*100/t)}class F{constructor(t,e){m(this,"config");m(this,"sdkConfig");this.config=t,this.sdkConfig=e}on(t,e,i){const a=function(n){n.data.message!==`kalamba:wrapper-casino:${t}`&&n.data.message!==`kalamba:wrapper:${t}`||e(n.data.payload)};window.addEventListener("message",a,i)}send(t,...[e]){window.postMessage({message:`kalamba:casino:${t}`,payload:e})}}const Yt=O("BasicPlugin","color:#000000;font-weight:bold;");class Zt extends F{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),Yt("configured")}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:e,payload:i}=t.data;switch(e){case"doAudioSettings":this.send("settings",{music:i==null?void 0:i.musicEnabled,sounds:i==null?void 0:i.soundEnabled});return;case"doBalanceUpdate":const{currency:a,coinValueInCents:r}=this.sdkConfig.api;i.currency===a&&typeof i.balanceInCurrency=="number"?this.send("balance",{balance:Ft(i.balanceInCurrency,r)}):(i.balanceInCoins,this.send("balance",{balance:i.balanceInCoins}));return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.sdkConfig.api.homeUrl)try{window.top.location=this.sdkConfig.api.homeUrl}catch{window.location=this.sdkConfig.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}const v=O("▼ DebuggingPlugin IN ▼","color:#444444;font-weight:bold;"),ei=O("▲ DebuggingPlugin OUT ▲","color:#444444;font-weight:bold;");class ti extends F{constructor(...t){super(...t),this.registerDebugToSdkEvents(),this.registerSdkToDebugEvents()}registerDebugToSdkEvents(){window.DebuggingPlugin={balance:t=>this._send("balance",t),bet:t=>this._send("bet",t),choice:t=>this._send("choice",t),close:t=>this._send("close",t),help:t=>this._send("help",t),history:t=>this._send("history",t),freeze:t=>this._send("freeze",t),paytable:t=>this._send("paytable",t),settings:t=>this._send("settings",t),suspend:t=>this._send("suspend",t),unfreeze:t=>this._send("unfreeze",t)}}registerSdkToDebugEvents(){this.on("autoplay",t=>v("autoplay",t)),this.on("balance",t=>v("balance",t)),this.on("bet",t=>v("bet",t)),this.on("cashier",t=>v("cashier",t)),this.on("choice",t=>v("choice",t)),this.on("close",t=>v("close",t)),this.on("error",t=>v("error",t)),this.on("loadEnd",t=>v("loadEnd",t)),this.on("loadProgress",t=>v("loadProgress",t)),this.on("loadStart",t=>v("loadStart",t)),this.on("playCycleStart",t=>v("playCycleStart",t)),this.on("playCycleEnd",t=>v("playCycleEnd",t)),this.on("playEnd",t=>v("playEnd",t)),this.on("playError",t=>v("playError",t)),this.on("playReady",t=>v("playReady",t)),this.on("playStart",t=>v("playStart",t)),this.on("settings",t=>v("settings",t))}_send(...t){ei(...t),this.send(...t)}}const ii=O("GigPlugin","color:#000000;font-weight:bold;");class si extends F{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),ii("configured")}postMessage(t){const e={event:t};window.top.postMessage(e,"*")}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{data:e}=t;switch(e){case"STOP_AUTO_PLAY":this.send("suspend");return;case"BLOCK_BETS":this.send("freeze");return;case"UNBLOCK_BETS":this.send("unfreeze");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.sdkConfig.api.homeUrl)try{window.top.location=this.sdkConfig.api.homeUrl}catch{window.location=this.sdkConfig.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}}),this.on("playReady",()=>{this.postMessage("GAME_READY")})}}const ai=O("OryxPlugin","color:#000000;font-weight:bold;");class ni extends F{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),ai("configured")}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:e,param:i}=t.data;switch(e){case"doBalanceUpdate":this.send("balance",{balance:i});return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){let t=0;this.on("close",()=>{window.top.postMessage({wpgaction:"close"},"*"),window.parent.postMessage({wpgaction:"close.parent"},"*")}),this.on("balance",({balance:e})=>{t!==e&&(t=e,window.top.postMessage({param:{},wpgaction:"balance"},"*"),window.parent.postMessage({param:{},wpgaction:"balance.parent"},"*"))}),this.on("loadStart",()=>{window.top.postMessage({wpgaction:"loadStart"},"*"),window.parent.postMessage({wpgaction:"loadStart.parent"},"*")}),this.on("loadEnd",()=>{window.top.postMessage({wpgaction:"loadEnd"},"*"),window.parent.postMessage({wpgaction:"loadEnd.parent"},"*")}),this.on("playStart",()=>{window.top.postMessage({wpgaction:"gameSpinStart"},"*"),window.parent.postMessage({wpgaction:"gameSpinStart.parent"},"*")}),this.on("playEnd",()=>{window.top.postMessage({wpgaction:"gameSpinEnd"},"*"),window.parent.postMessage({wpgaction:"gameSpinEnd.parent"},"*")}),this.on("cashier",({type:e})=>{switch(e){case"BALANCE_LOW":window.top.postMessage({wpgaction:"cashier"},"*"),window.parent.postMessage({wpgaction:"cashier.parent"},"*");break;case"BALANCE_INSUFFICIENT":window.top.postMessage({wpgaction:"errorOutOfMoney"},"*"),window.parent.postMessage({wpgaction:"errorOutOfMoney.parent"},"*");break}})}}const Ge=O("PariplayPlugin","color:#000000;font-weight:bold;");function He(s){try{window.top.location=s}catch{window.location=s}}function Ve(s,t){return new Promise(function(i,a){const r=new XMLHttpRequest;r.onload=function(){r.status>=200&&r.status<300?i(r.responseText):a(r.responseText)},r.open(s,t),r.send()})}function ze(){}function oi(s){return s.filter(function(e){return e.messageType.toUpperCase()==="DATA"})}function qe(s){return s.filter(function(e){return["NOTIFICATION","POPUP"].includes(e.messageType.toUpperCase())})}function Nt(s){try{return JSON.parse(s.text)}catch{return{}}}function ri(s){return s.map(Nt).filter(Boolean).find(function(e){return e.betId!=null&&e.winId!=null})||{}}function ci(s){return s.map(Nt).filter(Boolean).find(function(e){return e.TotalBet!=null&&e.TotalWin!=null})||{}}class di extends F{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),Ge("configured")}postMessage(t,e){const i={lang:this.sdkConfig.ui.language,sender:this.sdkConfig.api.game,type:t};e!=null&&(i.data=e),Ge("postMessage",i),window.parent.postMessage(i,"*")}coinsToCurrency(t){return t*this.sdkConfig.api.coinValueInCents/100}handleContinueButton(t,e){t.link&&Ve("GET",t.link),e()}handleLinkButton(t,e){switch(t.linkType.toUpperCase()){case"AJAX":Ve("GET",t.link),e();return;case"AJAXRESPONSE":Ve("GET",t.link).then(()=>{e()});return;case"REDIRECT":He(t.link),e();return}}handleQuitButton(t,e){this.send("close"),e()}handleCashierButton(t,e){this.send("cashier",{type:"ON_DEMAND"}),e()}handleHistoryButton(t,e){this.send("history",{source:"casino"}),e()}get buttonActions(){return{CASHIER:this.handleCashierButton,CONTINUE:this.handleContinueButton,HISTORY:this.handleHistoryButton,LINK:this.handleLinkButton,QUIT:this.handleQuitButton}}processInfoUiMessages(t){return t.reduce((e,i)=>e.then(()=>new Promise(a=>{const r=Object.assign({},i,{buttons:i.buttons.filter(n=>n.action.toUpperCase()==="CASHIER"?!!this.sdkConfig.api.cashierUrl:!0).map(n=>Object.assign({},n,{onRelease:()=>{const h=i.messageType.toUpperCase()==="POPUP"?ze:a,g=this.buttonActions[n.action.toUpperCase()];g?g(n,h):h()}}))});Ge("showMessage",r)}).catch(ze)),Promise.resolve()).then(()=>{}).catch(ze)}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:e}=t.data;switch(e){case"pause":case"disableSpin":this.send("freeze");return;case"resume":case"enableSpin":this.send("unfreeze");return;case"stopAutobet":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){let t=0;this.on("openGameResponse",e=>{let i;try{const a=JSON.parse(JSON.parse(atob(this.sdkConfig.api.integrationData.token.split(".")[1])).token),r=JSON.parse(a.integrationSpecificAttributes.sessionData||"{}");i={ClientToken:a.integrationSpecificAttributes.clientToken,CurrencyCode:a.currency,PlayerTokenId:a.user,SessionData:r}}catch{i=void 0}this.postMessage("gameDataLoaded",{LoadGameData:i,success:!0});try{const a=qe(e.contract.uiMessages);this.processInfoUiMessages(a)}catch{}}),this.on("balance",({balance:e})=>{t!==e&&(t=e,this.postMessage("balance",{amount:this.coinsToCurrency(e)}))}),this.on("close",()=>{if(this.sdkConfig.api.homeUrl)if(this.sdkConfig.api.homeUrl==="(back)")try{window.top.history.back()}catch{window.history.back()}else this.sdkConfig.api.homeUrl==="(api)"?this.postMessage("quit"):He(this.sdkConfig.api.homeUrl)}),this.on("playEnd",e=>{this.postMessage("roundEnded",{balanceAfter:this.coinsToCurrency(e.contract.balance.coins),win:this.coinsToCurrency(e.contract.win.round)});try{const i=qe(e.contract.uiMessages);this.processInfoUiMessages(i)}catch{}}),this.on("playError",e=>{var i,a;this.postMessage("ticketReceived",{ErrorCode:(i=e.data)==null?void 0:i.code,ErrorMessage:"ERROR",Status:{ErrCode:(a=e.data)==null?void 0:a.code}})}),this.on("playResponse",e=>{this.postMessage("roundStarted",{balanceBefore:this.coinsToCurrency(e.contract.balance.coins+e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier)});const i=["BaseGame","PaidSpin"].includes(e.contract.stateType.thisRound),a=oi(e.contract.uiMessages),r=qe(e.contract.uiMessages),n=ri(a),h=ci(a);this.postMessage("ticketReceived",{Balance:this.coinsToCurrency(e.contract.balance.coins),BetAmount:i?this.coinsToCurrency(e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier):0,CreditTransactionId:n.betId,DebitTransactionId:n.winId,Message:r,SessionData:h,Status:{ErrCode:0},WinAmount:this.coinsToCurrency(e.contract.win.round)})}),this.on("playStart",e=>{e.bet&&this.postMessage("roundStart",{totalBet:this.coinsToCurrency(e.bet.base*e.bet.multiplier)})}),this.on("loadEnd",()=>{this.postMessage("gameReady")}),this.on("loadStart",()=>{this.postMessage("onAppFrameReady")}),this.on("cashier",()=>{this.sdkConfig.api.cashierUrl&&(this.sdkConfig.api.cashierUrl==="(api)"?this.postMessage("cashier"):He(this.sdkConfig.api.cashierUrl))})}}const ue=O("RelaxFEIMPlugin","color:#000000;font-weight:bold;");class li extends F{constructor(...e){super(...e);m(this,"VERSION","1.17.0");const i=document.createElement("script");i.src=`https://d3nsdzdtjbr5ml.cloudfront.net/casino/relaxlibs/feim/${this.VERSION}/rlxfeim.min.js`,i.onload=()=>{ue("loaded"),window.FEIM.configure({p2pConfig:{currency:this.sdkConfig.api.currency,launchParams:{homeurl:"homeUrl"}}}),ue("configured"),this.registerToSdkEvents(),this.registerFromSdkEvents()},document.body.appendChild(i)}registerToSdkEvents(){window.FEIM.on.errorMessageDismissed(()=>this.send("unfreeze")),window.FEIM.on.errorMessageDisplayed(()=>this.send("freeze")),window.FEIM.on.exitingGame(()=>ue("!!! NOT IMPLEMENTED: exitingGame !!!")),window.FEIM.on.freeze(()=>this.send("freeze")),window.FEIM.on.initialized(()=>ue("!!! NOT IMPLEMENTED: initialized !!!")),window.FEIM.on.pauseAutoPlay(()=>this.send("suspend")),window.FEIM.on.refreshBalance(()=>ue("!!! NOT IMPLEMENTED: refreshBalance !!!")),window.FEIM.on.toggleGameHelp(()=>{this.send("help",{})}),window.FEIM.on.togglePaytable(()=>{this.send("paytable",{})}),window.FEIM.on.unfreeze(()=>this.send("unfreeze")),window.FEIM.on.updateSettings(({payload:[e]})=>this.send("settings",{sounds:e.sounds,fastPlay:e.fastPlay}))}registerFromSdkEvents(){this.on("autoplay",({action:e})=>{switch(e){case"start":window.FEIM.send.autoPlayStarted();break;case"stop":window.FEIM.send.autoPlayFinished();break}}),this.on("balance",({balance:e})=>{window.FEIM.send.balanceUpdate(e)}),this.on("bet",({base:e,multiplier:i})=>{window.FEIM.send.betUpdate(e*i)}),this.on("error",({message:e})=>{window.FEIM.send.errorMessage(e)}),this.on("close",()=>{window.FEIM.send.exitGame()}),this.on("loadEnd",()=>{window.FEIM.send.gameLoadCompleted()}),this.on("loadProgress",({progress:e})=>{window.FEIM.send.gameLoadProgress(e)}),this.on("loadStart",()=>{window.FEIM.send.gameLoadStarted()}),this.on("cashier",()=>{window.FEIM.send.openQuickDeposit()}),this.on("playCycleEnd",e=>{const i={balance:e.contract.balance.coins,bet:e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier,win:{win:e.contract.win.total}};window.FEIM.send.roundFinished(i)}),this.on("playResponse",e=>{const i={balance:e.contract.balance.coins,playResponse:e.data};window.FEIM.send.roundStarted(i)}),this.on("history",()=>{window.FEIM.send.showHistory()}),this.on("settings",e=>{window.FEIM.send.updateSettings(e)})}}const We=O("TukoPlugin","color:#000000;font-weight:bold;");class ui extends F{constructor(...e){super(...e);m(this,"PING_INTERVAL",1e4);const a=new URLSearchParams(window.location.search).get("pingCallbackUrl");a&&window.setInterval(()=>{this.ping(a)},this.PING_INTERVAL),this.registerToSdkEvents(),this.registerFromSdkEvents(),We("configured")}ping(e){const i=new XMLHttpRequest;i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&(i.status===0||i.status>=200&&i.status<400?We("ping ok",i):We("ping error",i))},i.open("GET",e),i.send()}registerToSdkEvents(){window.addEventListener("message",e=>{try{const{type:i,payload:a}=e.data;switch(i){case"doAudioSettings":this.send("settings",{music:a==null?void 0:a.musicEnabled,sounds:a==null?void 0:a.soundEnabled});return;case"doBalanceUpdate":const{currency:r,coinValueInCents:n}=this.sdkConfig.api;a.currency===r&&typeof a.balanceInCurrency=="number"?this.send("balance",{balance:Ft(a.balanceInCurrency,n)}):(a.balanceInCoins,this.send("balance",{balance:a.balanceInCoins}));return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.sdkConfig.api.homeUrl)try{window.top.location=this.sdkConfig.api.homeUrl}catch{window.location=this.sdkConfig.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}const ht=O("QuantaPlugin","color:#000000;font-weight:bold;");class hi extends F{constructor(...t){super(...t),this.registerFromSdkEvents(),ht("configured")}postMessage(t){const e={event:t};ht("QuantaPlugin::postMessage",e),window.parent.postMessage(e,"*")}registerFromSdkEvents(){this.on("close",()=>{this.postMessage("GameClosed")}),this.on("loadEnd",()=>{this.postMessage("GameLoaded")}),this.on("playCycleStart",()=>{this.postMessage("RoundStarted")}),this.on("playCycleEnd",()=>{this.postMessage("RoundEnded")}),this.on("playError",()=>{this.postMessage("RoundEnded")})}}var gi="2.0.0-beta.3",re="",gt="?",Ye="function",H="undefined",ce="object",Ze="string",we="major",l="model",o="name",d="type",u="vendor",c="version",M="architecture",J="console",b="mobile",f="tablet",I="smarttv",Ae="wearable",pt="xr",et="embedded",mt="user-agent",tt=500,nt="brands",W="formFactors",ot="fullVersionList",Y="platform",rt="platformVersion",Ne="bitness",z="sec-ch-ua",pi=z+"-full-version-list",mi=z+"-arch",wi=z+"-"+Ne,bi=z+"-form-factors",fi=z+"-"+b,yi=z+"-"+l,Dt=z+"-"+Y,ki=Dt+"-version",Gt=[nt,ot,b,l,Y,rt,M,W,Ne],T="browser",L="cpu",R="device",_="engine",P="os",Z="result",ve="Amazon",he="Apple",wt="ASUS",bt="BlackBerry",Ce="Google",ft="Huawei",yt="Lenovo",$e="LG",Oe="Microsoft",kt="Motorola",Me="Samsung",Et="Sharp",Se="Sony",je="Xiaomi",Ke="Zebra",Q="Mobile ",X=" Browser",Ie="Chrome",Ei="Edge",ge="Firefox",pe="Opera",vt="Facebook",Ct="Sogou",it="Windows",vi=typeof window!==H,S=vi&&window.navigator?window.navigator:void 0,D=S&&S.userAgentData?S.userAgentData:void 0,Ci=function(s,t){var e={},i=t;if(!Re(t)){i={};for(var a in t)for(var r in t[a])i[r]=t[a][r].concat(i[r]?i[r]:[])}for(var n in s)e[n]=i[n]&&i[n].length%2===0?i[n].concat(s[n]):s[n];return e},De=function(s){for(var t={},e=0;e<s.length;e++)t[s[e].toUpperCase()]=s[e];return t},st=function(s,t){if(typeof s===ce&&s.length>0){for(var e in s)if(V(s[e])==V(t))return!0;return!1}return de(s)?V(t).indexOf(V(s))!==-1:!1},Re=function(s,t){for(var e in s)return/^(browser|cpu|device|engine|os)$/.test(e)||(t?Re(s[e]):!1)},de=function(s){return typeof s===Ze},Qe=function(s){if(s){for(var t=[],e=$(/\\?\"/g,s).split(","),i=0;i<e.length;i++)if(e[i].indexOf(";")>-1){var a=be(e[i]).split(";v=");t[i]={brand:a[0],version:a[1]}}else t[i]=be(e[i]);return t}},V=function(s){return de(s)?s.toLowerCase():s},Xe=function(s){return de(s)?$(/[^\d\.]/g,s).split(".")[0]:void 0},B=function(s){for(var t in s){var e=s[t];typeof e==ce&&e.length==2?this[e[0]]=e[1]:this[e]=void 0}return this},$=function(s,t){return de(t)?t.replace(s,re):t},me=function(s){return $(/\\?\"/g,s)},be=function(s,t){if(de(s))return s=$(/^\s\s*/,s),typeof t===H?s:s.substring(0,tt)},Mt=function(s,t){if(!(!s||!t))for(var e=0,i,a,r,n,h,g;e<t.length&&!h;){var w=t[e],p=t[e+1];for(i=a=0;i<w.length&&!h&&w[i];)if(h=w[i++].exec(s),h)for(r=0;r<p.length;r++)g=h[++a],n=p[r],typeof n===ce&&n.length>0?n.length===2?typeof n[1]==Ye?this[n[0]]=n[1].call(this,g):this[n[0]]=n[1]:n.length===3?typeof n[1]===Ye&&!(n[1].exec&&n[1].test)?this[n[0]]=g?n[1].call(this,g,n[2]):void 0:this[n[0]]=g?g.replace(n[1],n[2]):void 0:n.length===4&&(this[n[0]]=g?n[3].call(this,g.replace(n[1],n[2])):void 0):this[n]=g||void 0;e+=2}},xe=function(s,t){for(var e in t)if(typeof t[e]===ce&&t[e].length>0){for(var i=0;i<t[e].length;i++)if(st(t[e][i],s))return e===gt?void 0:e}else if(st(t[e],s))return e===gt?void 0:e;return t.hasOwnProperty("*")?t["*"]:s},St={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},It={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Tt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[c,[o,Q+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[c,[o,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[o,c],[/opios[\/ ]+([\w\.]+)/i],[c,[o,pe+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[c,[o,pe+" GX"]],[/\bopr\/([\w\.]+)/i],[c,[o,pe]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[c,[o,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\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|duckduckgo|klar)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[o,c],[/\bddg\/([\w\.]+)/i],[c,[o,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[c,[o,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[c,[o,"WeChat"]],[/konqueror\/([\w\.]+)/i],[c,[o,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[c,[o,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[c,[o,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[c,[o,"Smart "+yt+X]],[/(avast|avg)\/([\w\.]+)/i],[[o,/(.+)/,"$1 Secure"+X],c],[/\bfocus\/([\w\.]+)/i],[c,[o,ge+" Focus"]],[/\bopt\/([\w\.]+)/i],[c,[o,pe+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[c,[o,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[c,[o,"Dolphin"]],[/coast\/([\w\.]+)/i],[c,[o,pe+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[c,[o,"MIUI"+X]],[/fxios\/([\w\.-]+)/i],[c,[o,Q+ge]],[/\bqihu|(qi?ho?o?|360)browser/i],[[o,"360"+X]],[/\b(qq)\/([\w\.]+)/i],[[o,/(.+)/,"$1Browser"],c],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[o,/(.+)/,"$1"+X],c],[/samsungbrowser\/([\w\.]+)/i],[c,[o,Me+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[o,/_/g," "],c],[/metasr[\/ ]?([\d\.]+)/i],[c,[o,Ct+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[o,Ct+" Mobile"],c],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[o,c],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[o],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[o,vt],c],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[o,c],[/\bgsa\/([\w\.]+) .*safari\//i],[c,[o,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[c,[o,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[c,[o,Ie+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[o,Ie+" WebView"],c],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[c,[o,"Android"+X]],[/chrome\/([\w\.]+) mobile/i],[c,[o,Q+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[o,c],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[c,[o,Q+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[o,Q+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[c,o],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[o,[c,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[o,c],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[o,Q+ge],c],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[o,"Netscape"],c],[/(wolvic)\/([\w\.]+)/i],[o,c],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[c,[o,ge+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\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|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[o,[c,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[o,[c,/[^\d\.]+./,re]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[M,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[M,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[M,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[M,"armhf"]],[/windows (ce|mobile); ppc;/i],[[M,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[M,/ower/,re,V]],[/(sun4\w)[;\)]/i],[[M,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[M,V]]],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],[l,[u,Me],[d,f]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[u,Me],[d,b]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[u,he],[d,b]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[u,he],[d,f]],[/(macintosh);/i],[l,[u,he]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[u,Et],[d,b]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[u,ft],[d,f]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[u,ft],[d,b]],[/\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],[[l,/_/g," "],[u,je],[d,b]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[u,je],[d,f]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[u,"OPPO"],[d,b]],[/\b(opd2\d{3}a?) bui/i],[l,[u,"OPPO"],[d,f]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[u,"Vivo"],[d,b]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[l,[u,"Realme"],[d,b]],[/\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],[l,[u,kt],[d,b]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[u,kt],[d,f]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[u,$e],[d,f]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[u,$e],[d,b]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[u,yt],[d,f]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[u,"Nokia"],[d,b]],[/(pixel c)\b/i],[l,[u,Ce],[d,f]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[u,Ce],[d,b]],[/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],[l,[u,Se],[d,b]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[u,Se],[d,f]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[u,"OnePlus"],[d,b]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[u,ve],[d,f]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[u,ve],[d,b]],[/(playbook);[-\w\),; ]+(rim)/i],[l,u,[d,f]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[u,bt],[d,b]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[u,wt],[d,f]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[u,wt],[d,b]],[/(nexus 9)/i],[l,[u,"HTC"],[d,f]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[u,[l,/_/g," "],[d,b]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[u,"Acer"],[d,f]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[u,"Meizu"],[d,b]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[l,[u,"Ulefone"],[d,b]],[/(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,l,[d,b]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[u,l,[d,f]],[/(surface duo)/i],[l,[u,Oe],[d,f]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[u,"Fairphone"],[d,b]],[/(shield[\w ]+) b/i],[l,[u,"Nvidia"],[d,f]],[/(sprint) (\w+)/i],[u,l,[d,b]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[u,Oe],[d,b]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[u,Ke],[d,f]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[u,Ke],[d,b]],[/smart-tv.+(samsung)/i],[u,[d,I]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[u,Me],[d,I]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[u,$e],[d,I]],[/(apple) ?tv/i],[u,[l,he+" TV"],[d,I]],[/crkey/i],[[l,Ie+"cast"],[u,Ce],[d,I]],[/droid.+aft(\w+)( bui|\))/i],[l,[u,ve],[d,I]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[u,Et],[d,I]],[/(bravia[\w ]+)( bui|\))/i],[l,[u,Se],[d,I]],[/(mitv-\w{5}) bui/i],[l,[u,je],[d,I]],[/Hbbtv.*(technisat) (.*);/i],[u,l,[d,I]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[u,be],[l,be],[d,I]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,I]],[/(ouya)/i,/(nintendo) (\w+)/i],[u,l,[d,J]],[/droid.+; (shield) bui/i],[l,[u,"Nvidia"],[d,J]],[/(playstation \w+)/i],[l,[u,Se],[d,J]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[u,Oe],[d,J]],[/((pebble))app/i],[u,l,[d,Ae]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[u,he],[d,Ae]],[/droid.+; (wt63?0{2,3})\)/i],[l,[u,Ke],[d,Ae]],[/droid.+; (glass) \d/i],[l,[u,Ce],[d,pt]],[/(quest( \d| pro)?)/i],[l,[u,vt],[d,pt]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[u,[d,et]],[/(aeobc)\b/i],[l,[u,ve],[d,et]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[d,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,f]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,f]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,b]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[u,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[c,[o,Ei+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[c,[o,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[o,c],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[c,o]],os:[[/microsoft (windows) (vista|xp)/i],[o,c],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[o,[c,xe,St]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,xe,St],[o,it]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[c,/_/g,"."],[o,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[o,"macOS"],[c,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[c,o],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[o,c],[/\(bb(10);/i],[c,[o,bt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[c,[o,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[c,[o,ge+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[c,[o,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[c,[o,"watchOS"]],[/crkey\/([\d\.]+)/i],[c,[o,Ie+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[o,"Chrome OS"],c],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[o,c],[/(sunos) ?([\w\.\d]*)/i],[[o,"Solaris"],c],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[o,c]]},Te=function(){var s={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return B.call(s.init,[[T,[o,c,we,d]],[L,[M]],[R,[d,l,u]],[_,[o,c]],[P,[o,c]]]),B.call(s.isIgnore,[[T,[c,we]],[_,[c]],[P,[c]]]),B.call(s.isIgnoreRgx,[[T,/ ?browser$/i],[P,/ ?os$/i]]),B.call(s.toString,[[T,[o,c]],[L,[M]],[R,[u,l]],[_,[o,c]],[P,[o,c]]]),s}(),Mi=function(s,t){var e=Te.init[t],i=Te.isIgnore[t]||0,a=Te.isIgnoreRgx[t]||0,r=Te.toString[t]||0;function n(){B.call(this,e)}return n.prototype.getItem=function(){return s},n.prototype.withClientHints=function(){return D?D.getHighEntropyValues(Gt).then(function(h){return s.setCH(new Ht(h,!1)).parseCH().get()}):s.parseCH().get()},n.prototype.withFeatureCheck=function(){return s.detectFeature().get()},t!=Z&&(n.prototype.is=function(h){var g=!1;for(var w in this)if(this.hasOwnProperty(w)&&!st(i,w)&&V(a?$(a,this[w]):this[w])==V(a?$(a,h):h)){if(g=!0,h!=H)break}else if(h==H&&g){g=!g;break}return g},n.prototype.toString=function(){var h=re;for(var g in r)typeof this[r[g]]!==H&&(h+=(h?" ":re)+this[r[g]]);return h||H}),D||(n.prototype.then=function(h){var g=this,w=function(){for(var k in g)g.hasOwnProperty(k)&&(this[k]=g[k])};w.prototype={is:n.prototype.is,toString:n.prototype.toString};var p=new w;return h(p),p}),new n};function Ht(s,t){if(s=s||{},B.call(this,Gt),t)B.call(this,[[nt,Qe(s[z])],[ot,Qe(s[pi])],[b,/\?1/.test(s[fi])],[l,me(s[yi])],[Y,me(s[Dt])],[rt,me(s[ki])],[M,me(s[mi])],[W,Qe(s[bi])],[Ne,me(s[wi])]]);else for(var e in s)this.hasOwnProperty(e)&&typeof s[e]!==H&&(this[e]=s[e])}function Pt(s,t,e,i){return this.get=function(a){return a?this.data.hasOwnProperty(a)?this.data[a]:void 0:this.data},this.set=function(a,r){return this.data[a]=r,this},this.setCH=function(a){return this.uaCH=a,this},this.detectFeature=function(){if(S&&S.userAgent==this.ua)switch(this.itemType){case T:S.brave&&typeof S.brave.isBrave==Ye&&this.set(o,"Brave");break;case R:!this.get(d)&&D&&D[b]&&this.set(d,b),this.get(l)=="Macintosh"&&S&&typeof S.standalone!==H&&S.maxTouchPoints&&S.maxTouchPoints>2&&this.set(l,"iPad").set(d,f);break;case P:!this.get(o)&&D&&D[Y]&&this.set(o,D[Y]);break;case Z:var a=this.data,r=function(n){return a[n].getItem().detectFeature().get()};this.set(T,r(T)).set(L,r(L)).set(R,r(R)).set(_,r(_)).set(P,r(P))}return this},this.parseUA=function(){return this.itemType!=Z&&Mt.call(this.data,this.ua,this.rgxMap),this.itemType==T&&this.set(we,Xe(this.get(c))),this},this.parseCH=function(){var a=this.uaCH,r=this.rgxMap;switch(this.itemType){case T:var n=a[ot]||a[nt],h;if(n)for(var g in n){var w=$(/(Google|Microsoft) /,n[g].brand||n[g]),p=n[g].version;!/not.a.brand/i.test(w)&&(!h||/chrom/i.test(h)&&!/chromi/i.test(w))&&(this.set(o,w).set(c,p).set(we,Xe(p)),h=w)}break;case L:var k=a[M];k&&(k&&a[Ne]=="64"&&(k+="64"),Mt.call(this.data,k+";",r));break;case R:if(a[b]&&this.set(d,b),a[l]&&this.set(l,a[l]),a[l]=="Xbox"&&this.set(d,J).set(u,Oe),a[W]){var N;if(typeof a[W]!="string")for(var j=0;!N&&j<a[W].length;)N=xe(a[W][j++],It);else N=xe(a[W],It);this.set(d,N)}break;case P:var K=a[Y];if(K){var U=a[rt];K==it&&(U=parseInt(Xe(U),10)>=13?"11":"10"),this.set(o,K).set(c,U)}this.get(o)==it&&a[l]=="Xbox"&&this.set(o,"Xbox").set(c,void 0);break;case Z:var le=this.data,A=function(Ee){return le[Ee].getItem().setCH(a).parseCH().get()};this.set(T,A(T)).set(L,A(L)).set(R,A(R)).set(_,A(_)).set(P,A(P))}return this},B.call(this,[["itemType",s],["ua",t],["uaCH",i],["rgxMap",e],["data",Mi(this,s)]]),this}function x(s,t,e){if(typeof s===ce?(Re(s,!0)?(typeof t===ce&&(e=t),t=s):(e=s,t=void 0),s=void 0):typeof s===Ze&&!Re(t,!0)&&(e=t,t=void 0),!(this instanceof x))return new x(s,t,e).getResult();var i=typeof s===Ze?s:S&&S.userAgent?S.userAgent:e&&e[mt]?e[mt]:re,a=new Ht(e,!0),r=t?Ci(Tt,t):Tt,n=function(h){return h==Z?function(){return new Pt(h,i,r,a).set("ua",i).set(T,this.getBrowser()).set(L,this.getCPU()).set(R,this.getDevice()).set(_,this.getEngine()).set(P,this.getOS()).get()}:function(){return new Pt(h,i,r[h],a).parseUA().get()}};return B.call(this,[["getBrowser",n(T)],["getCPU",n(L)],["getDevice",n(R)],["getEngine",n(_)],["getOS",n(P)],["getResult",n(Z)],["getUA",function(){return i}],["setUA",function(h){return de(h)&&(i=h.length>tt?be(h,tt):h),this}]]).setUA(i),this}x.VERSION=gi;x.BROWSER=De([o,c,we,d]);x.CPU=De([M]);x.DEVICE=De([l,u,d,J,b,I,f,Ae,et]);x.ENGINE=x.OS=De([o,c]);class Vt{constructor(t,e){m(this,"config");m(this,"sdkConfig");this.config=t,this.sdkConfig=e}on(t,e,i){const a=function(n){n.data.message!==`kalamba:wrapper-rgs:${t}`&&n.data.message!==`kalamba:wrapper:${t}`||e(n.data.payload)};window.addEventListener("message",a,i)}send(t,...[e]){window.postMessage({message:`kalamba:rgs:${t}`,payload:e})}}class Si{constructor(t){m(this,"socket",null);m(this,"webSocketUrl");m(this,"eventListeners",{close:[],error:[],message:[]});m(this,"connect",async()=>{const t=new WebSocket(this.webSocketUrl);return t.addEventListener("message",this.handleMessage),new Promise(e=>{t.addEventListener("open",i=>{this.handleOpen(i),e(this.socket)},{once:!0})})});m(this,"send",t=>{if(this.socket==null)throw new Error("Cannot send message, the WebSocket connection is not open");this.socket.send(t)});m(this,"close",()=>{if(this.socket==null)throw new Error("Cannot close the WebSocket connection that is not open");this.socket.close()});m(this,"handleClose",t=>{this.eventListeners.close.forEach(e=>{e(t)}),this.socket.removeEventListener("message",this.handleMessage),this.socket.removeEventListener("close",this.handleClose),this.socket.removeEventListener("error",this.handleError),this.socket=null});m(this,"handleError",t=>{this.eventListeners.error.forEach(e=>{e(t)})});m(this,"handleMessage",t=>{this.eventListeners.message.forEach(e=>{e(t)})});m(this,"handleOpen",t=>{const e=t.target;e.addEventListener("close",this.handleClose),e.addEventListener("error",this.handleError),this.socket=e});this.webSocketUrl=t}addEventListener(t,e){this.eventListeners[t].push(e)}removeEventListener(t,e){const i=this.eventListeners[t].indexOf(e);i!==-1&&this.eventListeners[t].splice(i,1)}}function Pe(s){return JSON.parse(s==null?void 0:s.data)}function Ii(s){var t;return((t=s==null?void 0:s.header)==null?void 0:t.name)==="Ping"}function At(s){var t;return((t=s==null?void 0:s.header)==null?void 0:t.name)==="RealityCheck"}function Ue(s){return s.header.name==="GameEvent"}function Ti(s){return Ue(s)&&s.body.event==="OPEN_GAME"}function Ot(s){return s.header.code!==1}function Pi(s){return Ue(s)&&s.body.event.includes("_RESULT")}var ee,fe;class Ai extends Si{constructor(e,i){const a=new URL(e.apiUrl);a.searchParams.set("cageCode",e.cageCode),a.searchParams.set("gameCode",e.gameCode),a.searchParams.set("operatorCode",e.operatorCode),a.searchParams.set("playMode",e.playMode),a.searchParams.set("token",e.token),a.searchParams.set("username",e.username);super(a.toString());m(this,"cId",0);m(this,"mId",0);m(this,"seqId",0);m(this,"gameCode");C(this,ee);C(this,fe);m(this,"onMessage",e=>{const i=Pe(e);(Ue(i)||Ii(i)||At(i))&&this.sendAcknowledgement(i),At(i)&&this.handleRealityCheck(i)});this.eventListeners.realityCheck=[],this.gameCode=e.gameCode,E(this,ee,i.requestTimeoutMs),E(this,fe,i.gameVersion??"unknown"),this.addEventListener("message",this.onMessage)}handleRealityCheck(e){this.eventListeners.realityCheck.forEach(i=>{i(e.body)})}addEventListener(e,i){super.addEventListener(e,i)}removeEventListener(e,i){super.removeEventListener(e,i)}buildHeader(e,i=null){return{cId:i??++this.cId,code:i!==null?1:void 0,mId:++this.mId,name:e}}buildPayload(e,i){return JSON.stringify({body:i,header:e})}getBodyExtras(e){return{action:e,seqId:++this.seqId}}request(e,i){const a=this.buildPayload(e,i);return new Promise((r,n)=>{setTimeout(()=>n({type:"timeout"}),y(this,ee));const h=g=>{const w=Pe(g);try{e.cId===w.header.cId&&(this.removeEventListener("message",h),w.header.code===1?r(w):n({message:w,type:"error"}))}catch{n({message:w,type:"error"})}};this.addEventListener("message",h),this.send(a)})}freeRounds(e){const i=this.buildHeader("ActivateFreeRound");return this.request(i,e).then(a=>a.body).catch(a=>{var r;throw{data:(r=a==null?void 0:a.message)==null?void 0:r.body,type:a.type}})}async authenticate(e=!1){const i=this.buildHeader("Authenticate"),a={clientType:3,version:y(this,fe),reconnect:e};return this.request(i,a).then(r=>r.body).catch(r=>{var n;throw{data:(n=r==null?void 0:r.message)==null?void 0:n.body,type:r.type}})}async openGame(){const e=this.buildHeader("OpenGame"),i={gameCode:this.gameCode};return new Promise((a,r)=>{const n=h=>{const g=Pe(h);Ti(g)?(this.removeEventListener("message",n),a(g.body)):Ot(g)&&r({data:g.body,type:"error"})};this.addEventListener("message",n),this.request(e,i).catch(h=>{var g;return r({data:(g=h==null?void 0:h.message)==null?void 0:g.body,type:h.type})})})}sendAcknowledgement(e){const{name:i,cId:a}=e.header,r=this.buildHeader(i,a),n=this.buildPayload(r,{});this.send(n)}sendAction(e,i){const a=this.buildHeader("GameAction"),r={...this.getBodyExtras(e),data:i};return new Promise((n,h)=>{const g=w=>{const p=Pe(w);Ue(p)&&r.seqId===p.body.correlationSeqId&&(this.removeEventListener("message",g),Pi(p)?n(p.body):Ot(p)&&h({data:p.body,type:"error"}))};this.addEventListener("message",g),this.request(a,r).catch(w=>{var p;return h({data:(p=w==null?void 0:w.message)==null?void 0:p.body,type:w.type})})})}setRequestTimeoutMs(e){E(this,ee,e)}}ee=new WeakMap,fe=new WeakMap;const Oi={CA_BC:"CA",CA_ON:"CA",GER:"DE",US_CT:"US",US_MI:"US",US_NJ:"US",USA:"US"};function Rt(s){return!s||s==="NOT_APPLICABLE"?null:Oi[s]??s}function zt(s){const t=s.contract;return t?{contract:{balance:{coins:t.balance,version:t.balanceVersion},coinValueInCents:t.coinValueInCents,country:t.countryCode,currency:t.currencyCode,jurisdiction:Rt(t.jurisdictionCode),uiMessages:t.uiMessages,username:t.username}}:{contract:{balance:{coins:s.balance,version:s.balanceVersion},coinValueInCents:s.coinValueInCents,country:s.countryCode,currency:s.currencyCode,jurisdiction:Rt(s.jurisdictionCode),uiMessages:s.uiMessages,username:s.username}}}function qt(s){var t,e;return{code:((t=s.data)==null?void 0:t.code)??Fe.RgsErrorCode.UNKNOWN,details:(e=s.data)==null?void 0:e.details}}function Wt(s,t){const e=t.contract;if(!e){const i=t.data;return{contract:{bet:{available:i.additionalConfigData.availableMultipliersPerBaseBet,default:{base:i.additionalConfigData.defaultBet.baseBet,multiplier:i.additionalConfigData.defaultBet.betMultiplier},max:i.additionalConfigData.maxAllowedOverallBetInCoins??null,last:i.gameState.betFromCurrentRound?{base:i.gameState.betFromCurrentRound.baseBet,multiplier:i.gameState.betFromCurrentRound.betMultiplier}:null,lastPaid:i.gameState.lastPlacedMainGameBet?{base:i.gameState.lastPlacedMainGameBet.baseBet,multiplier:i.gameState.lastPlacedMainGameBet.betMultiplier}:null},balance:{coins:t.balance,version:t.balanceVersion},freeRounds:(i.FREE_ROUNDS??[]).map(a=>({conf:{base:a.conf.baseBet,multiplier:a.conf.betMultiplier,numAwarded:a.conf.numAwarded},data:{numPlayed:a.data.numPlayed,win:a.data.winAmount,numLeft:a.data.numLeft},id:a.id,rejectable:a.rejectable,skippable:a.skippable,status:a.status,type:a.type})),gameModel:i.additionalConfigData.gameModelFile,metaData:i.gameConfigData.metaData,roundId:i.gameState.cycleId,serverTime:t.balanceVersion,sessionId:i.gameState.sessionId,stateType:{thisRound:i.gameState.stateTypeThisRound,nextRound:i.gameState.stateTypeNextRound},uiMessages:s.uiMessages,win:{max:i.maxWin??null,round:i.gameState.totalWinFromCurrentRound,total:i.gameState.totalWinFromCurrentGameCycle}},data:i}}return{contract:{bet:{available:e.availableMultipliersPerBaseBet,default:{base:e.defaultBet.baseBet,multiplier:e.defaultBet.betMultiplier},max:e.maxBetInCoins??null,last:e.lastBet?{base:e.lastBet.baseBet,multiplier:e.lastBet.betMultiplier}:null,lastPaid:e.lastMainGameBet?{base:e.lastMainGameBet.baseBet,multiplier:e.lastMainGameBet.betMultiplier}:null},balance:{coins:e.balanceInCoins,version:e.balanceVersion},freeRounds:(e.freeRounds??[]).map(i=>({conf:{base:i.conf.baseBet,multiplier:i.conf.betMultiplier,numAwarded:i.conf.numAwarded},data:{numPlayed:i.data.numPlayed,win:i.data.winAmount,numLeft:i.data.numLeft},id:i.id,rejectable:i.rejectable,skippable:i.skippable,status:i.status,type:i.type})),gameModel:e.gameModelFile,metaData:e.metaData,roundId:e.roundId,serverTime:e.serverTime,sessionId:e.sessionId,stateType:{thisRound:e.stateTypeThisRound,nextRound:e.stateTypeNextRound},uiMessages:s.contract.uiMessages.concat(e.uiMessages),win:{max:e.maxWinInCoins??null,round:e.roundWin,total:e.totalWin}},data:t.opaqueGameServerToUi}}function $t(s){var t,e;return{code:((t=s.data)==null?void 0:t.code)??Fe.RgsErrorCode.UNKNOWN,details:(e=s.data)==null?void 0:e.details}}function jt(s){const t=s.contract;if(!t){const e=s.data;return{contract:{bet:{last:e.gameState.betFromCurrentRound?{base:e.gameState.betFromCurrentRound.baseBet,multiplier:e.gameState.betFromCurrentRound.betMultiplier}:null,lastPaid:{base:(e.gameState.lastPlacedMainGameBet??e.gameState.betFromCurrentRound).baseBet,multiplier:(e.gameState.lastPlacedMainGameBet??e.gameState.betFromCurrentRound).betMultiplier}},balance:{coins:s.balance,version:s.balanceVersion},freeRounds:(e.FREE_ROUNDS??[]).map(i=>({conf:{base:i.conf.baseBet,multiplier:i.conf.betMultiplier,numAwarded:i.conf.numAwarded},data:{numPlayed:i.data.numPlayed,win:i.data.winAmount,numLeft:i.data.numLeft},id:i.id,rejectable:i.rejectable,skippable:i.skippable,status:i.status,type:i.type})),serverTime:s.balanceVersion,roundId:e.gameState.cycleId,stateType:{thisRound:e.gameState.stateTypeThisRound,nextRound:e.gameState.stateTypeNextRound},uiMessages:e.uiMessages,win:{round:e.gameState.totalWinFromCurrentRound,total:e.gameState.totalWinFromCurrentGameCycle}},data:e}}return{contract:{bet:{last:t.lastBet?{base:t.lastBet.baseBet,multiplier:t.lastBet.betMultiplier}:null,lastPaid:{base:t.lastMainGameBet.baseBet,multiplier:t.lastMainGameBet.betMultiplier}},balance:{coins:t.balanceInCoins,version:t.balanceVersion},freeRounds:(t.freeRounds??[]).map(e=>({conf:{base:e.conf.baseBet,multiplier:e.conf.betMultiplier,numAwarded:e.conf.numAwarded},data:{numPlayed:e.data.numPlayed,win:e.data.winAmount,numLeft:e.data.numLeft},id:e.id,rejectable:e.rejectable,skippable:e.skippable,status:e.status,type:e.type})),serverTime:t.serverTime,roundId:t.roundId,stateType:{thisRound:t.stateTypeThisRound,nextRound:t.stateTypeNextRound},uiMessages:t.uiMessages,win:{round:t.roundWin,total:t.totalWin}},data:s.opaqueGameServerToUi}}function Kt(s){var t,e;return{code:((t=s.data)==null?void 0:t.code)??Fe.RgsErrorCode.UNKNOWN,details:(e=s.data)==null?void 0:e.details}}const Ri={parseAuthenticateResponse:zt,parseAuthenticateError:qt,parseOpenGameResponse:Wt,parseOpenGameError:$t,parsePlayResponse:jt,parsePlayError:Kt},xi={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"},{device:Ui}=x(navigator.userAgent),Li=O("KalambaBullseyePlugin","color:#000000;font-weight:bold;");class _i extends Vt{constructor(...e){super(...e);m(this,"socket");m(this,"error");this.on("openGame",async()=>{try{this.error=void 0;const i=await this.openGame();this.send("openGameResponse",i)}catch(i){this.error=i,this.send("openGameError",i)}}),this.on("play",async i=>{try{this.error=void 0;const a=await this.play(i);this.send("playResponse",a)}catch(a){this.error=a,this.send("playError",a)}}),this.on("freeRounds",async i=>{try{this.error=void 0,await this.socket.freeRounds(i),this.send("freeRoundsResponse",i)}catch(a){this.error=a,this.send("freeRoundsError",a)}}),this.on("configured",i=>{this.socket.setRequestTimeoutMs(i.ui.requestTimeoutMs)}),this.registerFromSdkEvents()}initialize(e){this.socket=new Ai(e,{gameVersion:this.config.gameVersion,requestTimeoutMs:this.sdkConfig.ui.requestTimeoutMs}),["fireboltroulette"].includes(e.gameCode)||(this.socket.addEventListener("close",i=>{i.code===1008?this.error||this.send("error",{type:"CLOSE",messageCode:"TOO_MANY_OPEN_GAMES",messageKey:"RgsError.TOO_MANY_OPEN_GAMES"}):i.code===1011?this.error||this.send("error",{type:"CLOSE",messageCode:"UNKNOWN",messageKey:"RgsError.UNKNOWN"}):this.reconnect()}),["mobile","tablet"].includes(Ui.type??"")&&document.addEventListener("visibilitychange",async()=>{document.hidden||(this.socket.socket?this.socket.socket&&[WebSocket.CONNECTING,WebSocket.OPEN].includes(this.socket.socket.readyState)&&this.socket.close():this.reconnect())})),this.socket.addEventListener("error",i=>Li("error",i)),this.socket.addEventListener("realityCheck",i=>{this.send("realityCheck",i)})}async reconnect(){try{await this.socket.connect(),await this.socket.authenticate(!0),await this.socket.openGame()}catch{this.send("error",{type:"CLOSE",messageCode:"CONNECTION_ERROR",messageKey:"RgsError.CONNECTION_ERROR"})}}async openGame(){var Ee,dt;const e=new URLSearchParams(window.location.search),i=e.get("apiUrl"),a=e.get("cageCode"),r=e.get("gameCode"),n=e.get("operatorCode"),h=e.get("playMode"),g=e.get("token"),w=e.get("username"),p=e.get("gameHistoryUrl"),k=e.get("homeUrl")??void 0,N=e.get("cashierUrl")??void 0;this.initialize({apiUrl:i,cageCode:a,gameCode:r,operatorCode:n,playMode:h,token:g,username:w});try{await this.socket.connect()}catch{throw{type:"error",data:{code:Fe.RgsErrorCode.CONNECTION_ERROR}}}let j;try{j=await this.socket.authenticate()}catch(q){throw{type:q.type,data:q.type==="error"?qt(q.data):void 0}}let K;try{K=await this.socket.openGame()}catch(q){throw{type:q.type,data:q.type==="error"?$t(q.data):void 0}}const U=zt(j),le=Wt(j,K);this.sdkConfig.api={...this.sdkConfig.api,brand:a,game:r,integration:n,jurisdiction:U.contract.jurisdiction,playMode:h,user:U.contract.username,integrationData:{token:g},country:U.contract.country,currency:U.contract.currency,coinValueInCents:U.contract.coinValueInCents,gameHistoryUrl:p,homeUrl:k,cashierUrl:N,backendSessionId:le.contract.sessionId,lastRoundId:le.contract.roundId};const A=(dt=(Ee=e.get("languageCode"))==null?void 0:Ee.split("_"))==null?void 0:dt[0];return A&&(this.sdkConfig.ui.language=A.length===3?xi[A]??A:A),le}async play(e){for(;!this.socket.socket;)await new Promise(k=>setTimeout(()=>k(),500));const{contract:{bet:i,forcedOutcomes:a,...r},extra:n,payloadToInject:h,actionType:g}=e,w={bet:i?{baseBet:i.base,betMultiplier:i.multiplier}:void 0,forcedOutcomes:a,...r,...h,opaqueUiToGameServer:n};let p;try{p=await this.socket.sendAction(g,w)}catch(k){throw{type:k.type,data:k.type==="error"?Kt(k.data):void 0}}return jt(p)}registerFromSdkEvents(){this.on("history",()=>{const{api:{game:e,integration:i,integrationData:a,jurisdiction:r,user:n,gameHistoryUrl:h},ui:{language:g}}=this.sdkConfig,w=n.replace(/^user_/,"").replace(new RegExp(`_${i}$`),""),p=new URL(window.location.href);p.hostname=p.hostname.replace(/^v\./,"").replace(/^play\./,"history."),p.pathname=p.pathname.replace(/(\/[0-9]+\.[0-9]+\.[0-9]+)?\/wrapper\.html/,"/list/index.html"),p.search="",p.searchParams.set("apiUrl",new URL(h).origin),p.searchParams.set("gameCode",e),p.searchParams.set("jurisdiction",r),p.searchParams.set("operatorCode",i),p.searchParams.set("token",a.token),p.searchParams.set("username",w),p.searchParams.set("languageCode",g),this.config.gameHistoryUrl&&p.searchParams.set("gameHistoryUrl",this.config.gameHistoryUrl),window.open(p.toString(),"_blank")})}}class Qt{constructor(t,e,i){m(this,"trackers");m(this,"config");m(this,"sdkConfig");this.trackers=t,this.config=e,this.sdkConfig=i}on(t,e,i){const a=function(n){n.data.message!==`kalamba:wrapper-telemetry:${t}`&&n.data.message!==`kalamba:wrapper:${t}`||e(n.data.payload)};window.addEventListener("message",a,i)}track(t,e){this.trackers.forEach(i=>i.track(t,e))}}function xt(s){return s.reduce((t,e)=>t+e,0)}function Bi(s){const t=s.length,e=xt(s)/t,i=s.map(r=>Math.pow(r-e,2)),a=xt(i)/t;return Math.sqrt(a)}class Ut{constructor(){m(this,"rafId",-1);m(this,"startTime",0);m(this,"stopTime",0);m(this,"frames",[]);m(this,"calculateFPS",()=>{const t=Math.floor((this.stopTime-this.startTime)/1e3);return this.frames.map(e=>Math.floor((e-this.startTime)/1e3)).reduce((e,i,a,r)=>(r[a]!==r[a-1]?e.push(1):e[e.length-1]++,e),[]).slice(0,t)});m(this,"getReport",()=>{const t=this.calculateFPS(),e=Math.floor(this.frames.length/((this.stopTime-this.startTime)/1e3)),i=t.length>0?Math.max(...t):e,a=t.length>0?Math.min(...t):e,r=t.length>0?Bi(t):0;return{fpsAvg:e,fpsMax:i,fpsMin:a,fpsStdDev:r}});m(this,"start",()=>{this.startTime=Date.now(),this.frames=[],this.trackFrames()});m(this,"stop",()=>{cancelAnimationFrame(this.rafId),this.stopTime=Date.now()});m(this,"trackFrames",()=>{this.frames.push(Date.now()),this.rafId=requestAnimationFrame(this.trackFrames)})}}const Fi="landscape",Ni="portrait";function Di(){try{const s=document.createElement("canvas");return!!window.WebGLRenderingContext&&(s.getContext("webgl")||s.getContext("experimental-webgl"))instanceof WebGLRenderingContext}catch{return!1}}async function Gi(){if(!window.createImageBitmap)return!1;const e=await(await fetch("data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAEAAQAcJaQAA3AA/v3AgAA=")).blob();try{return await createImageBitmap(e),!0}catch{return!1}}function Je(){return window.innerWidth>=window.innerHeight?Fi:Ni}var Le,te,ie,se,ye,_e,ke,Be;class Hi extends Qt{constructor(...e){super(...e);m(this,"FPS_SAMPLE_INTERVAL",1e4);C(this,Le,0);C(this,te);C(this,ie);C(this,se);C(this,ye,!1);C(this,_e,!1);C(this,ke,"");C(this,Be,[]);E(this,ie,{}),E(this,se,this.deviceInfo()),E(this,te,this.config.gameVersion),this.on("state",({balance:i})=>{E(this,Le,i)}),this.on("autoplay",({action:i})=>{["start","resume"].includes(i)?E(this,ye,!0):E(this,ye,!1)}),this.on("settings",({fastPlay:i})=>{i!==void 0&&E(this,_e,i)}),this.registerEvents()}async registerEvents(){y(this,se).then(e=>{this.track("Device Information",e)}),this.on("loadStart",()=>{this.track("Game Loading",{progress:0,step:"initial"})}),this.on("loadProgress",e=>{this.track("Game Loading",{progress:e.progress})}),this.on("loadEnd",()=>{this.track("Game Loading",{progress:100,step:"complete"})}),this.on("error",e=>{this.track("System Message",{systemMessageText:e.messageCode,systemMessageType:e.type})}),this.on("openGameResponse",async e=>{E(this,ke,e.contract.stateType.nextRound),E(this,ie,{balanceInCoins:e.contract.balance.coins,clientVersion:y(this,te),coinValueInCents:this.sdkConfig.api.coinValueInCents,coinValueInCentsFloat:this.sdkConfig.api.coinValueInCents,currency:this.sdkConfig.api.currency,defaultBaseBet:e.contract.bet.default.base,defaultBetMultiplier:e.contract.bet.default.multiplier,environment:"release",gameCode:this.sdkConfig.api.game,gameCodeServer:this.sdkConfig.api.game,gameModelFile:e.contract.gameModel,jurisdiction:this.sdkConfig.api.jurisdiction,languageCode:this.sdkConfig.ui.language,operatorName:"kalamba",partnerId:this.sdkConfig.api.brand,partnerParentId:this.sdkConfig.api.integration,platform:"WEB",playMode:this.sdkConfig.api.playMode,referrer:window.location.hostname,rootTrackingSessionID:this.sdkConfig.api.sessionId,backendSessionID:this.sdkConfig.api.backendSessionId,serverVersion:e.contract.metaData.version}),this.track("Game Open",y(this,ie))}),this.on("playCycleEnd",async e=>{const i=await y(this,se),{base:a,multiplier:r,specialAction:n}=e.contract.bet.lastPaid??{},h=e.contract.balance.coins,g=e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier,w=e.contract.win.total,p=w-g,k=n||"spin",N=e.contract.roundId;this.track("Betting Activity",{balance:h-p,balanceAfter:h,baseBet:a,betMultiplier:r,betType:k,gameVersion:y(this,te),coinValueInCents:this.sdkConfig.api.coinValueInCents,coinValueInCentsFloat:this.sdkConfig.api.coinValueInCents,currency:this.sdkConfig.api.currency,environment:"release",gameCode:this.sdkConfig.api.game,gameCodeServer:this.sdkConfig.api.game,isMobile:i.isMobile,netResult:p,operatorName:"kalamba",orientation:Je(),partnerId:this.sdkConfig.api.brand,partnerParentId:this.sdkConfig.api.integration,platform:"WEB",playMode:this.sdkConfig.api.playMode,roundId:N,roundTypes:["BaseGame"],totalBet:g,totalWin:w}),E(this,Be,[])}),this.on("telemetry.click",e=>{this.track("UI Interaction",{action:"click",...this.getExtraUiInteractionData(),...e})}),this.on("telemetry.orientationChange",()=>{this.track("UI Interaction",{action:"orientationChange",...this.getExtraUiInteractionData()})}),this.reportFpsSample(),this.reportFpsRound()}reportFpsSample(){const e=new Ut,i=()=>{e.stop();const r=e.getReport();this.track("FPS Performance",{...r,fpsType:"sample"}),a()},a=async()=>{e.start(),setTimeout(i,this.FPS_SAMPLE_INTERVAL)};a()}reportFpsRound(){const e=new Ut;this.on("playCycleStart",()=>{e.start()}),this.on("playCycleEnd",()=>{e.stop();const i=e.getReport();this.track("FPS Performance",{...i,fpsType:"playCycleStart->playCycleEnd"})})}getExtraUiInteractionData(){return{orientation:Je(),stateType:y(this,ke)}}async deviceInfo(){var h;const{browser:e,device:i,os:a}=x(navigator.userAgent),r=Di(),n=await Gi();return{browserName:e.name,browserVersion:e.version,connection:(h=navigator.connection)==null?void 0:h.effectiveType,deviceName:i.model,deviceType:i.type,isMobile:["mobile","tablet"].includes(i.type??""),isWebGLSupported:r,isWebPSupported:n,manufacturer:i.vendor,operatingSystem:a.name,operatingSystemVersion:a.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}}}Le=new WeakMap,te=new WeakMap,ie=new WeakMap,se=new WeakMap,ye=new WeakMap,_e=new WeakMap,ke=new WeakMap,Be=new WeakMap;var Vi=at.requireNoop();const Lt=at.getDefaultExportFromCjs(Vi);class ct{constructor(t,e){m(this,"config");m(this,"sdkConfig");this.config=t,this.sdkConfig=e}}const _t=25,Bt=1e4;var ae,ne,oe,G;class zi extends ct{constructor(...e){super(...e);C(this,ae,"https://europe-west3-stargazer-328808.cloudfunctions.net/collect-events");C(this,ne);C(this,oe);C(this,G,[]);m(this,"processQueueForced");E(this,ne,new Date().getTime()),E(this,G,[]),this.processQueueForced=this.processQueue.bind(this,!0),this.schedule(),fetch(y(this,ae),{method:"OPTIONS"}).catch(Lt),this.subscribe()}subscribe(){window.addEventListener("beforeunload",this.processQueueForced,!1),window.addEventListener("pagehide",this.processQueueForced,!1),window.addEventListener("visibilitychange",this.processQueueForced,!1)}schedule(){y(this,oe)&&clearTimeout(y(this,oe)),E(this,oe,window.setTimeout(()=>this.processQueue(),Bt))}send(e){E(this,ne,new Date().getTime());try{navigator.sendBeacon(y(this,ae),JSON.stringify(e))}catch{fetch(y(this,ae),{body:JSON.stringify(e),method:"POST",headers:{"Content-Type":"application/json"},keepalive:!0}).catch(Lt)}this.schedule()}addToQueue(e){y(this,G).push(e),this.processQueue()}processQueue(e=!1){if(!(this.sdkConfig==null||!this.sdkConfig.ui.feature.allowTelemetry)&&!(!e&&y(this,G).length<_t&&new Date().getTime()-y(this,ne)<Bt))for(;y(this,G).length;){const i=y(this,G).splice(0,_t).map(a=>({...a,sessionID:this.sdkConfig.api.sessionId,userID:this.sdkConfig.api.user}));this.send(i)}}track(e,i){this.addToQueue({eventName:e,eventParams:i,eventTimestamp:new Date().getTime(),eventUUID:at.v4()})}}ae=new WeakMap,ne=new WeakMap,oe=new WeakMap,G=new WeakMap;const qi=O("LoggingTracker","color:#000000;font-weight:bold;");class Wi extends ct{track(t,e){qi(`@${this.sdkConfig.api.user}`,`[${t}]`,e)}}exports.BasicPlugin=Zt;exports.CasinoPlugin=F;exports.DebuggingPlugin=ti;exports.GigPlugin=si;exports.KalambaBullseyeParsers=Ri;exports.KalambaBullseyePlugin=_i;exports.KalambaStargazerPlugin=Hi;exports.KalambaStargazerTracker=zi;exports.LoggingTracker=Wi;exports.OryxPlugin=ni;exports.PariplayPlugin=di;exports.QuantaPlugin=hi;exports.RelaxFEIMPlugin=li;exports.RgsPlugin=Vt;exports.TelemetryPlugin=Qt;exports.Tracker=ct;exports.TukoPlugin=ui;
5
+ "use strict";var ai=Object.defineProperty;var ft=s=>{throw TypeError(s)};var ni=(s,t,e)=>t in s?ai(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var b=(s,t,e)=>ni(s,typeof t!="symbol"?t+"":t,e),yt=(s,t,e)=>t.has(s)||ft("Cannot "+e);var k=(s,t,e)=>(yt(s,t,"read from private field"),e?e.call(s):t.get(s)),M=(s,t,e)=>t.has(s)?ft("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),v=(s,t,e,i)=>(yt(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const He=require("./errors-BXO3dlhS.cjs"),ze=require("./encoders-DVHzIpWT.cjs"),gt=require("./v4-CoqWKwnX.cjs");function x(s,t){return(e,...i)=>{console.log(`[%c${s}\x1B[m] %s`,t,e,...i)}}function Wt(s,t){return Math.round(s*100/t)}class D{constructor(t,e){b(this,"config");b(this,"sdkConfig");this.config=t,this.sdkConfig=e}on(t,e,i){const a=function(r){r.data.message!==`kalamba:wrapper-casino:${t}`&&r.data.message!==`kalamba:wrapper:${t}`||e(r.data.payload)};window.addEventListener("message",a,i)}send(t,...[e]){window.postMessage({message:`kalamba:casino:${t}`,payload:e})}}const oi=x("BasicPlugin","color:#000000;font-weight:bold;");class ri extends D{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),oi("configured")}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:e,payload:i}=t.data;switch(e){case"doAudioSettings":this.send("settings",{music:i==null?void 0:i.musicEnabled,sounds:i==null?void 0:i.soundEnabled});return;case"doBalanceUpdate":const{currency:a,coinValueInCents:d}=this.sdkConfig.api;i.currency===a&&typeof i.balanceInCurrency=="number"?this.send("balance",{balance:Wt(i.balanceInCurrency,d)}):(i.balanceInCoins,this.send("balance",{balance:i.balanceInCoins}));return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.sdkConfig.api.homeUrl)try{window.top.location=this.sdkConfig.api.homeUrl}catch{window.location=this.sdkConfig.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}const E=x("▼ DebuggingPlugin IN ▼","color:#444444;font-weight:bold;"),ci=x("▲ DebuggingPlugin OUT ▲","color:#444444;font-weight:bold;");class di extends D{constructor(...t){super(...t),this.registerDebugToSdkEvents(),this.registerSdkToDebugEvents()}registerDebugToSdkEvents(){window.DebuggingPlugin={balance:t=>this._send("balance",t),bet:t=>this._send("bet",t),choice:t=>this._send("choice",t),close:t=>this._send("close",t),help:t=>this._send("help",t),history:t=>this._send("history",t),freeze:t=>this._send("freeze",t),paytable:t=>this._send("paytable",t),settings:t=>this._send("settings",t),suspend:t=>this._send("suspend",t),unfreeze:t=>this._send("unfreeze",t)}}registerSdkToDebugEvents(){this.on("autoplay",t=>E("autoplay",t)),this.on("balance",t=>E("balance",t)),this.on("bet",t=>E("bet",t)),this.on("cashier",t=>E("cashier",t)),this.on("choice",t=>E("choice",t)),this.on("close",t=>E("close",t)),this.on("error",t=>E("error",t)),this.on("loadEnd",t=>E("loadEnd",t)),this.on("loadProgress",t=>E("loadProgress",t)),this.on("loadStart",t=>E("loadStart",t)),this.on("playCycleStart",t=>E("playCycleStart",t)),this.on("playCycleEnd",t=>E("playCycleEnd",t)),this.on("playEnd",t=>E("playEnd",t)),this.on("playError",t=>E("playError",t)),this.on("playReady",t=>E("playReady",t)),this.on("playStart",t=>E("playStart",t)),this.on("settings",t=>E("settings",t))}_send(...t){ci(...t),this.send(...t)}}const li=x("GigPlugin","color:#000000;font-weight:bold;");class ui extends D{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),li("configured")}postMessage(t){const e={event:t};window.top.postMessage(e,"*")}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{data:e}=t;switch(e){case"STOP_AUTO_PLAY":this.send("suspend");return;case"BLOCK_BETS":this.send("freeze");return;case"UNBLOCK_BETS":this.send("unfreeze");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.sdkConfig.api.homeUrl)try{window.top.location=this.sdkConfig.api.homeUrl}catch{window.location=this.sdkConfig.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}}),this.on("playReady",()=>{this.postMessage("GAME_READY")})}}const hi=x("OryxPlugin","color:#000000;font-weight:bold;");class gi extends D{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),hi("configured")}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:e,param:i}=t.data;switch(e){case"doBalanceUpdate":this.send("balance",{balance:i});return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){let t=0;this.on("close",()=>{window.top.postMessage({wpgaction:"close"},"*"),window.parent.postMessage({wpgaction:"close.parent"},"*")}),this.on("balance",({balance:e})=>{t!==e&&(t=e,window.top.postMessage({param:{},wpgaction:"balance"},"*"),window.parent.postMessage({param:{},wpgaction:"balance.parent"},"*"))}),this.on("loadStart",()=>{window.top.postMessage({wpgaction:"loadStart"},"*"),window.parent.postMessage({wpgaction:"loadStart.parent"},"*")}),this.on("loadEnd",()=>{window.top.postMessage({wpgaction:"loadEnd"},"*"),window.parent.postMessage({wpgaction:"loadEnd.parent"},"*")}),this.on("playStart",()=>{window.top.postMessage({wpgaction:"gameSpinStart"},"*"),window.parent.postMessage({wpgaction:"gameSpinStart.parent"},"*")}),this.on("playEnd",()=>{window.top.postMessage({wpgaction:"gameSpinEnd"},"*"),window.parent.postMessage({wpgaction:"gameSpinEnd.parent"},"*")}),this.on("cashier",({type:e})=>{switch(e){case"BALANCE_LOW":window.top.postMessage({wpgaction:"cashier"},"*"),window.parent.postMessage({wpgaction:"cashier.parent"},"*");break;case"BALANCE_INSUFFICIENT":window.top.postMessage({wpgaction:"errorOutOfMoney"},"*"),window.parent.postMessage({wpgaction:"errorOutOfMoney.parent"},"*");break}})}}const We=x("PariplayPlugin","color:#000000;font-weight:bold;");function je(s){try{window.top.location=s}catch{window.location=s}}function $e(s,t){return new Promise(function(i,a){const d=new XMLHttpRequest;d.onload=function(){d.status>=200&&d.status<300?i(d.responseText):a(d.responseText)},d.open(s,t),d.send()})}function Ke(){}function pi(s){return s.filter(function(e){return e.messageType.toUpperCase()==="DATA"})}function Qe(s){return s.filter(function(e){return["NOTIFICATION","POPUP"].includes(e.messageType.toUpperCase())})}function jt(s){try{return JSON.parse(s.text)}catch{return{}}}function wi(s){return s.map(jt).filter(Boolean).find(function(e){return e.betId!=null&&e.winId!=null})||{}}function mi(s){return s.map(jt).filter(Boolean).find(function(e){return e.TotalBet!=null&&e.TotalWin!=null})||{}}class bi extends D{constructor(...t){super(...t),this.registerToSdkEvents(),this.registerFromSdkEvents(),We("configured")}postMessage(t,e){const i={lang:this.sdkConfig.ui.language,sender:this.sdkConfig.api.game,type:t};e!=null&&(i.data=e),We("postMessage",i),window.parent.postMessage(i,"*")}coinsToCurrency(t){return t*this.sdkConfig.api.coinValueInCents/100}handleContinueButton(t,e){t.link&&$e("GET",t.link),e()}handleLinkButton(t,e){switch(t.linkType.toUpperCase()){case"AJAX":$e("GET",t.link),e();return;case"AJAXRESPONSE":$e("GET",t.link).then(()=>{e()});return;case"REDIRECT":je(t.link),e();return}}handleQuitButton(t,e){this.send("close"),e()}handleCashierButton(t,e){this.send("cashier",{type:"ON_DEMAND"}),e()}handleHistoryButton(t,e){this.send("history",{source:"casino"}),e()}get buttonActions(){return{CASHIER:this.handleCashierButton,CONTINUE:this.handleContinueButton,HISTORY:this.handleHistoryButton,LINK:this.handleLinkButton,QUIT:this.handleQuitButton}}processInfoUiMessages(t){return t.reduce((e,i)=>e.then(()=>new Promise(a=>{const d=Object.assign({},i,{buttons:i.buttons.filter(r=>r.action.toUpperCase()==="CASHIER"?!!this.sdkConfig.api.cashierUrl:!0).map(r=>Object.assign({},r,{onRelease:()=>{const g=i.messageType.toUpperCase()==="POPUP"?Ke:a,h=this.buttonActions[r.action.toUpperCase()];h?h(r,g):g()}}))});We("showMessage",d)}).catch(Ke)),Promise.resolve()).then(()=>{}).catch(Ke)}registerToSdkEvents(){window.addEventListener("message",t=>{try{const{type:e}=t.data;switch(e){case"pause":case"disableSpin":this.send("freeze");return;case"resume":case"enableSpin":this.send("unfreeze");return;case"stopAutobet":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){let t=0;this.on("openGameResponse",e=>{let i;try{const a=JSON.parse(JSON.parse(atob(this.sdkConfig.api.integrationData.token.split(".")[1])).token),d=JSON.parse(a.integrationSpecificAttributes.sessionData||"{}");i={ClientToken:a.integrationSpecificAttributes.clientToken,CurrencyCode:a.currency,PlayerTokenId:a.user,SessionData:d}}catch{i=void 0}this.postMessage("gameDataLoaded",{LoadGameData:i,success:!0});try{const a=Qe(e.contract.uiMessages);this.processInfoUiMessages(a)}catch{}}),this.on("balance",({balance:e})=>{t!==e&&(t=e,this.postMessage("balance",{amount:this.coinsToCurrency(e)}))}),this.on("close",()=>{if(this.sdkConfig.api.homeUrl)if(this.sdkConfig.api.homeUrl==="(back)")try{window.top.history.back()}catch{window.history.back()}else this.sdkConfig.api.homeUrl==="(api)"?this.postMessage("quit"):je(this.sdkConfig.api.homeUrl)}),this.on("playEnd",e=>{this.postMessage("roundEnded",{balanceAfter:this.coinsToCurrency(e.contract.balance.coins),win:this.coinsToCurrency(e.contract.win.round)});try{const i=Qe(e.contract.uiMessages);this.processInfoUiMessages(i)}catch{}}),this.on("playError",e=>{this.postMessage("ticketReceived",{ErrorCode:e.type==="error"?e.data.code:"TIMEOUT",ErrorMessage:"ERROR",Status:{ErrCode:e.type==="error"?e.data.code:"TIMEOUT"}})}),this.on("playResponse",e=>{this.postMessage("roundStarted",{balanceBefore:this.coinsToCurrency(e.contract.balance.coins+e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier)});const i=["BaseGame","PaidSpin"].includes(e.contract.stateType.thisRound),a=pi(e.contract.uiMessages),d=Qe(e.contract.uiMessages),r=wi(a),g=mi(a);this.postMessage("ticketReceived",{Balance:this.coinsToCurrency(e.contract.balance.coins),BetAmount:i?this.coinsToCurrency(e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier):0,CreditTransactionId:r.betId,DebitTransactionId:r.winId,Message:d,SessionData:g,Status:{ErrCode:0},WinAmount:this.coinsToCurrency(e.contract.win.round)})}),this.on("playStart",e=>{e.bet&&this.postMessage("roundStart",{totalBet:this.coinsToCurrency(e.bet.base*e.bet.multiplier)})}),this.on("loadEnd",()=>{this.postMessage("gameReady")}),this.on("loadStart",()=>{this.postMessage("onAppFrameReady")}),this.on("cashier",()=>{this.sdkConfig.api.cashierUrl&&(this.sdkConfig.api.cashierUrl==="(api)"?this.postMessage("cashier"):je(this.sdkConfig.api.cashierUrl))})}}const we=x("RelaxFEIMPlugin","color:#000000;font-weight:bold;");class fi extends D{constructor(...e){super(...e);b(this,"VERSION","1.17.0");const i=document.createElement("script");i.src=`https://d3nsdzdtjbr5ml.cloudfront.net/casino/relaxlibs/feim/${this.VERSION}/rlxfeim.min.js`,i.onload=()=>{we("loaded"),window.FEIM.configure({p2pConfig:{currency:this.sdkConfig.api.currency,launchParams:{homeurl:"homeUrl"}}}),we("configured"),this.registerToSdkEvents(),this.registerFromSdkEvents()},document.body.appendChild(i)}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:[e]})=>this.send("settings",{sounds:e.sounds,fastPlay:e.fastPlay}))}registerFromSdkEvents(){this.on("autoplay",({action:e})=>{switch(e){case"start":window.FEIM.send.autoPlayStarted();break;case"stop":window.FEIM.send.autoPlayFinished();break}}),this.on("balance",({balance:e})=>{window.FEIM.send.balanceUpdate(e)}),this.on("bet",({base:e,multiplier:i})=>{window.FEIM.send.betUpdate(e*i)}),this.on("error",e=>{const i="message"in e?e.message:"Unknown error";window.FEIM.send.errorMessage(i)}),this.on("close",()=>{window.FEIM.send.exitGame()}),this.on("loadEnd",()=>{window.FEIM.send.gameLoadCompleted()}),this.on("loadProgress",({progress:e})=>{window.FEIM.send.gameLoadProgress(e)}),this.on("loadStart",()=>{window.FEIM.send.gameLoadStarted()}),this.on("cashier",()=>{window.FEIM.send.openQuickDeposit()}),this.on("playCycleEnd",e=>{const i={balance:e.contract.balance.coins,bet:e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier,win:{win:e.contract.win.total}};window.FEIM.send.roundFinished(i)}),this.on("playResponse",e=>{const i={balance:e.contract.balance.coins,playResponse:e.data};window.FEIM.send.roundStarted(i)}),this.on("history",()=>{window.FEIM.send.showHistory()}),this.on("settings",e=>{window.FEIM.send.updateSettings(e)})}}const Xe=x("TukoPlugin","color:#000000;font-weight:bold;");class yi extends D{constructor(...e){super(...e);b(this,"PING_INTERVAL",1e4);const a=new URLSearchParams(window.location.search).get("pingCallbackUrl");a&&window.setInterval(()=>{this.ping(a)},this.PING_INTERVAL),this.registerToSdkEvents(),this.registerFromSdkEvents(),Xe("configured")}ping(e){const i=new XMLHttpRequest;i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&(i.status===0||i.status>=200&&i.status<400?Xe("ping ok",i):Xe("ping error",i))},i.open("GET",e),i.send()}registerToSdkEvents(){window.addEventListener("message",e=>{try{const{type:i,payload:a}=e.data;switch(i){case"doAudioSettings":this.send("settings",{music:a==null?void 0:a.musicEnabled,sounds:a==null?void 0:a.soundEnabled});return;case"doBalanceUpdate":const{currency:d,coinValueInCents:r}=this.sdkConfig.api;a.currency===d&&typeof a.balanceInCurrency=="number"?this.send("balance",{balance:Wt(a.balanceInCurrency,r)}):(a.balanceInCoins,this.send("balance",{balance:a.balanceInCoins}));return;case"doGamePause":this.send("freeze");return;case"doGameResume":this.send("unfreeze");return;case"doGameSuspend":this.send("suspend");return;default:return}}catch{}})}registerFromSdkEvents(){this.on("close",()=>{if(this.sdkConfig.api.homeUrl)try{window.top.location=this.sdkConfig.api.homeUrl}catch{window.location=this.sdkConfig.api.homeUrl}else try{window.top.history.back()}catch{window.history.back()}})}}const kt=x("QuantaPlugin","color:#000000;font-weight:bold;");class ki extends D{constructor(...t){super(...t),this.registerFromSdkEvents(),kt("configured")}postMessage(t){const e={event:t};kt("QuantaPlugin::postMessage",e),window.parent.postMessage(e,"*")}registerFromSdkEvents(){this.on("close",()=>{this.postMessage("GameClosed")}),this.on("loadEnd",()=>{this.postMessage("GameLoaded")}),this.on("playCycleStart",()=>{this.postMessage("RoundStarted")}),this.on("playCycleEnd",()=>{this.postMessage("RoundEnded")}),this.on("playError",()=>{this.postMessage("RoundEnded")})}}var vi="2.0.3",dt=500,vt="user-agent",le="",Et="?",_e="function",j="undefined",ue="object",lt="string",S="browser",B="cpu",U="device",O="engine",A="os",te="result",l="name",n="type",c="vendor",u="version",T="architecture",Se="major",o="model",Ce="console",w="mobile",f="tablet",y="smarttv",R="wearable",Je="xr",Me="embedded",me="inapp",pt="brands",Y="formFactors",wt="fullVersionList",ie="platform",mt="platformVersion",Ve="bitness",$="sec-ch-ua",Ei=$+"-full-version-list",Ci=$+"-arch",Mi=$+"-"+Ve,Si=$+"-form-factors",Ti=$+"-"+w,Ii=$+"-"+o,$t=$+"-"+ie,Pi=$t+"-version",Kt=[pt,wt,w,o,ie,mt,T,Y,Ve],xe="Amazon",Z="Apple",Ct="ASUS",Mt="BlackBerry",J="Google",St="Huawei",Tt="Lenovo",It="Honor",Re="LG",Ye="Microsoft",Ze="Motorola",et="Nvidia",Pt="OnePlus",tt="OPPO",be="Samsung",At="Sharp",fe="Sony",it="Xiaomi",st="Zebra",Ot="Chrome",xt="Chromium",V="Chromecast",Ai="Edge",ye="Firefox",ke="Opera",at="Facebook",Rt="Sogou",ee="Mobile ",ve=" Browser",ut="Windows",Oi=typeof window!==j,I=Oi&&window.navigator?window.navigator:void 0,q=I&&I.userAgentData?I.userAgentData:void 0,xi=function(s,t){var e={},i=t;if(!Be(t)){i={};for(var a in t)for(var d in t[a])i[d]=t[a][d].concat(i[d]?i[d]:[])}for(var r in s)e[r]=i[r]&&i[r].length%2===0?i[r].concat(s[r]):s[r];return e},qe=function(s){for(var t={},e=0;e<s.length;e++)t[s[e].toUpperCase()]=s[e];return t},ht=function(s,t){if(typeof s===ue&&s.length>0){for(var e in s)if(F(s[e])==F(t))return!0;return!1}return ge(s)?F(t).indexOf(F(s))!==-1:!1},Be=function(s,t){for(var e in s)return/^(browser|cpu|device|engine|os)$/.test(e)||(t?Be(s[e]):!1)},ge=function(s){return typeof s===lt},nt=function(s){if(s){for(var t=[],e=he(/\\?\"/g,s).split(","),i=0;i<e.length;i++)if(e[i].indexOf(";")>-1){var a=Te(e[i]).split(";v=");t[i]={brand:a[0],version:a[1]}}else t[i]=Te(e[i]);return t}},F=function(s){return ge(s)?s.toLowerCase():s},ot=function(s){return ge(s)?he(/[^\d\.]/g,s).split(".")[0]:void 0},N=function(s){for(var t in s){var e=s[t];typeof e==ue&&e.length==2?this[e[0]]=e[1]:this[e]=void 0}return this},he=function(s,t){return ge(t)?t.replace(s,le):t},Ee=function(s){return he(/\\?\"/g,s)},Te=function(s,t){if(ge(s))return s=he(/^\s\s*/,s),typeof t===j?s:s.substring(0,dt)},rt=function(s,t){if(!(!s||!t))for(var e=0,i,a,d,r,g,h;e<t.length&&!g;){var p=t[e],m=t[e+1];for(i=a=0;i<p.length&&!g&&p[i];)if(g=p[i++].exec(s),g)for(d=0;d<m.length;d++)h=g[++a],r=m[d],typeof r===ue&&r.length>0?r.length===2?typeof r[1]==_e?this[r[0]]=r[1].call(this,h):this[r[0]]=r[1]:r.length===3?typeof r[1]===_e&&!(r[1].exec&&r[1].test)?this[r[0]]=h?r[1].call(this,h,r[2]):void 0:this[r[0]]=h?h.replace(r[1],r[2]):void 0:r.length===4&&(this[r[0]]=h?r[3].call(this,h.replace(r[1],r[2])):void 0):this[r]=h||void 0;e+=2}},z=function(s,t){for(var e in t)if(typeof t[e]===ue&&t[e].length>0){for(var i=0;i<t[e].length;i++)if(ht(t[e][i],s))return e===Et?void 0:e}else if(ht(t[e],s))return e===Et?void 0:e;return t.hasOwnProperty("*")?t["*"]:s},Ut={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"},Lt={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},_t={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[u,[l,ee+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[u,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,u],[/opios[\/ ]+([\w\.]+)/i],[u,[l,ke+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[u,[l,ke+" GX"]],[/\bopr\/([\w\.]+)/i],[u,[l,ke]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[u,[l,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[u,[l,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[l,u],[/quark(?:pc)?\/([-\w\.]+)/i],[u,[l,"Quark"]],[/\bddg\/([\w\.]+)/i],[u,[l,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[u,[l,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[u,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[u,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[u,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[u,[l,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[u,[l,"Smart "+Tt+ve]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure"+ve],u],[/\bfocus\/([\w\.]+)/i],[u,[l,ye+" Focus"]],[/\bopt\/([\w\.]+)/i],[u,[l,ke+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[u,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[u,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[u,[l,ke+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[u,[l,"MIUI"+ve]],[/fxios\/([\w\.-]+)/i],[u,[l,ee+ye]],[/\bqihoobrowser\/?([\w\.]*)/i],[u,[l,"360"]],[/\b(qq)\/([\w\.]+)/i],[[l,/(.+)/,"$1Browser"],u],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1"+ve],u],[/samsungbrowser\/([\w\.]+)/i],[u,[l,be+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[u,[l,Rt+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[l,Rt+" Mobile"],u],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[l,u],[/(lbbrowser|rekonq)/i],[l],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[u,l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,at],u,[n,me]],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[l,u,[n,me]],[/\bgsa\/([\w\.]+) .*safari\//i],[u,[l,"GSA"],[n,me]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[u,[l,"TikTok"],[n,me]],[/\[(linkedin)app\]/i],[l,[n,me]],[/(chromium)[\/ ]([-\w\.]+)/i],[l,u],[/headlesschrome(?:\/([\w\.]+)| )/i],[u,[l,Ot+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,Ot+" WebView"],u],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[u,[l,"Android"+ve]],[/chrome\/([\w\.]+) mobile/i],[u,[l,ee+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,u],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[u,[l,ee+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[l,ee+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[u,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[u,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[l,u],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[l,ee+ye],u],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],u],[/(wolvic|librewolf)\/([\w\.]+)/i],[l,u],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[u,[l,ye+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[l,[u,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[l,[u,/[^\d\.]+./,le]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[T,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[T,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[T,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[T,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[T,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[T,/ower/,le,F]],[/ sun4\w[;\)]/i],[[T,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[T,F]]],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],[o,[c,be],[n,f]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[o,[c,be],[n,w]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[o,[c,Z],[n,w]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[o,[c,Z],[n,f]],[/(macintosh);/i],[o,[c,Z]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[o,[c,At],[n,w]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[o,[c,It],[n,f]],[/honor([-\w ]+)[;\)]/i],[o,[c,It],[n,w]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[o,[c,St],[n,f]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[o,[c,St],[n,w]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[o,/_/g," "],[c,it],[n,f]],[/\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|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[o,/_/g," "],[c,it],[n,w]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[o,[c,tt],[n,w]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[o,[c,z,{OnePlus:["304","403","203"],"*":tt}],[n,f]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[o,[c,"BLU"],[n,w]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[o,[c,"Vivo"],[n,w]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[o,[c,"Realme"],[n,w]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[o,[c,Ze],[n,w]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[o,[c,Ze],[n,f]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[o,[c,Re],[n,f]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch))(\w+)/i,/\blg-?([\d\w]+) bui/i],[o,[c,Re],[n,w]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[o,[c,Tt],[n,f]],[/(nokia) (t[12][01])/i],[c,o,[n,f]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[o,/_/g," "],[n,w],[c,"Nokia"]],[/(pixel (c|tablet))\b/i],[o,[c,J],[n,f]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[o,[c,J],[n,w]],[/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],[o,[c,fe],[n,w]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[o,"Xperia Tablet"],[c,fe],[n,f]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[o,[c,Pt],[n,w]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[o,[c,xe],[n,f]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[o,/(.+)/g,"Fire Phone $1"],[c,xe],[n,w]],[/(playbook);[-\w\),; ]+(rim)/i],[o,c,[n,f]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[o,[c,Mt],[n,w]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[o,[c,Ct],[n,f]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[o,[c,Ct],[n,w]],[/(nexus 9)/i],[o,[c,"HTC"],[n,f]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[c,[o,/_/g," "],[n,w]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[o,[c,"TCL"],[n,f]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[o,[c,"TCL"],[n,w]],[/(itel) ((\w+))/i],[[c,F],o,[n,z,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[o,[c,"Acer"],[n,f]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[o,[c,"Meizu"],[n,w]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[o,[c,"Ulefone"],[n,w]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[o,[c,"Energizer"],[n,w]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[o,[c,"Cat"],[n,w]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[o,[c,"Smartfren"],[n,w]],[/droid.+; (a(?:015|06[35]|142p?))/i],[o,[c,"Nothing"],[n,w]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[o,[c,"Archos"],[n,f]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[o,[c,"Archos"],[n,w]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[c,o,[n,f]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[c,o,[n,w]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[c,o,[n,f]],[/(surface duo)/i],[o,[c,Ye],[n,f]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[o,[c,"Fairphone"],[n,w]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[o,[c,et],[n,f]],[/(sprint) (\w+)/i],[c,o,[n,w]],[/(kin\.[onetw]{3})/i],[[o,/\./g," "],[c,Ye],[n,w]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[o,[c,st],[n,f]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[o,[c,st],[n,w]],[/smart-tv.+(samsung)/i],[c,[n,y]],[/hbbtv.+maple;(\d+)/i],[[o,/^/,"SmartTV"],[c,be],[n,y]],[/tcast.+(lg)e?. ([-\w]+)/i],[c,o,[n,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[c,Re],[n,y]],[/(apple) ?tv/i],[c,[o,Z+" TV"],[n,y]],[/crkey.*devicetype\/chromecast/i],[[o,V+" Third Generation"],[c,J],[n,y]],[/crkey.*devicetype\/([^/]*)/i],[[o,/^/,"Chromecast "],[c,J],[n,y]],[/fuchsia.*crkey/i],[[o,V+" Nest Hub"],[c,J],[n,y]],[/crkey/i],[[o,V],[c,J],[n,y]],[/(portaltv)/i],[o,[c,at],[n,y]],[/droid.+aft(\w+)( bui|\))/i],[o,[c,xe],[n,y]],[/(shield \w+ tv)/i],[o,[c,et],[n,y]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[o,[c,At],[n,y]],[/(bravia[\w ]+)( bui|\))/i],[o,[c,fe],[n,y]],[/(mi(tv|box)-?\w+) bui/i],[o,[c,it],[n,y]],[/Hbbtv.*(technisat) (.*);/i],[c,o,[n,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[c,Te],[o,Te],[n,y]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[o,[n,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[n,y]],[/(ouya)/i,/(nintendo) (\w+)/i],[c,o,[n,Ce]],[/droid.+; (shield)( bui|\))/i],[o,[c,et],[n,Ce]],[/(playstation \w+)/i],[o,[c,fe],[n,Ce]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[o,[c,Ye],[n,Ce]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[o,[c,be],[n,R]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[c,o,[n,R]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[o,[c,tt],[n,R]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[o,[c,Z],[n,R]],[/(opwwe\d{3})/i],[o,[c,Pt],[n,R]],[/(moto 360)/i],[o,[c,Ze],[n,R]],[/(smartwatch 3)/i],[o,[c,fe],[n,R]],[/(g watch r)/i],[o,[c,Re],[n,R]],[/droid.+; (wt63?0{2,3})\)/i],[o,[c,st],[n,R]],[/droid.+; (glass) \d/i],[o,[c,J],[n,Je]],[/(pico) (4|neo3(?: link|pro)?)/i],[c,o,[n,Je]],[/(quest( \d| pro)?s?).+vr/i],[o,[c,at],[n,Je]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[c,[n,Me]],[/(aeobc)\b/i],[o,[c,xe],[n,Me]],[/(homepod).+mac os/i],[o,[c,Z],[n,Me]],[/windows iot/i],[[n,Me]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[o,[n,z,{mobile:"Mobile",xr:"VR","*":f}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[n,f]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[n,w]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[o,[c,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[u,[l,Ai+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[l,u],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[u,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,u],[/ladybird\//i],[[l,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[u,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,u],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[l,[u,z,Ut]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,z,Ut],[l,ut]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[u,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,"macOS"],[u,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[u,[l,V+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[u,[l,V+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[u,[l,V+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[u,[l,V+" Linux"]],[/crkey\/([\d\.]+)/i],[u,[l,V]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[u,l],[/(ubuntu) ([\w\.]+) like android/i],[[l,/(.+)/,"$1 Touch"],u],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/\.; ]?([\d\.]*)/i],[l,u],[/\(bb(10);/i],[u,[l,Mt]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[u,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[u,[l,ye+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[u,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[u,[l,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,"Chrome OS"],u],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/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)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,u],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],u],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,u]]},Ue=function(){var s={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return N.call(s.init,[[S,[l,u,Se,n]],[B,[T]],[U,[n,o,c]],[O,[l,u]],[A,[l,u]]]),N.call(s.isIgnore,[[S,[u,Se]],[O,[u]],[A,[u]]]),N.call(s.isIgnoreRgx,[[S,/ ?browser$/i],[A,/ ?os$/i]]),N.call(s.toString,[[S,[l,u]],[B,[T]],[U,[c,o]],[O,[l,u]],[A,[l,u]]]),s}(),Ri=function(s,t){var e=Ue.init[t],i=Ue.isIgnore[t]||0,a=Ue.isIgnoreRgx[t]||0,d=Ue.toString[t]||0;function r(){N.call(this,e)}return r.prototype.getItem=function(){return s},r.prototype.withClientHints=function(){return q?q.getHighEntropyValues(Kt).then(function(g){return s.setCH(new Qt(g,!1)).parseCH().get()}):s.parseCH().get()},r.prototype.withFeatureCheck=function(){return s.detectFeature().get()},t!=te&&(r.prototype.is=function(g){var h=!1;for(var p in this)if(this.hasOwnProperty(p)&&!ht(i,p)&&F(a?he(a,this[p]):this[p])==F(a?he(a,g):g)){if(h=!0,g!=j)break}else if(g==j&&h){h=!h;break}return h},r.prototype.toString=function(){var g=le;for(var h in d)typeof this[d[h]]!==j&&(g+=(g?" ":le)+this[d[h]]);return g||j}),q||(r.prototype.then=function(g){var h=this,p=function(){for(var C in h)h.hasOwnProperty(C)&&(this[C]=h[C])};p.prototype={is:r.prototype.is,toString:r.prototype.toString};var m=new p;return g(m),m}),new r};function Qt(s,t){if(s=s||{},N.call(this,Kt),t)N.call(this,[[pt,nt(s[$])],[wt,nt(s[Ei])],[w,/\?1/.test(s[Ti])],[o,Ee(s[Ii])],[ie,Ee(s[$t])],[mt,Ee(s[Pi])],[T,Ee(s[Ci])],[Y,nt(s[Si])],[Ve,Ee(s[Mi])]]);else for(var e in s)this.hasOwnProperty(e)&&typeof s[e]!==j&&(this[e]=s[e])}function Bt(s,t,e,i){return this.get=function(a){return a?this.data.hasOwnProperty(a)?this.data[a]:void 0:this.data},this.set=function(a,d){return this.data[a]=d,this},this.setCH=function(a){return this.uaCH=a,this},this.detectFeature=function(){if(I&&I.userAgent==this.ua)switch(this.itemType){case S:I.brave&&typeof I.brave.isBrave==_e&&this.set(l,"Brave");break;case U:!this.get(n)&&q&&q[w]&&this.set(n,w),this.get(o)=="Macintosh"&&I&&typeof I.standalone!==j&&I.maxTouchPoints&&I.maxTouchPoints>2&&this.set(o,"iPad").set(n,f);break;case A:!this.get(l)&&q&&q[ie]&&this.set(l,q[ie]);break;case te:var a=this.data,d=function(r){return a[r].getItem().detectFeature().get()};this.set(S,d(S)).set(B,d(B)).set(U,d(U)).set(O,d(O)).set(A,d(A))}return this},this.parseUA=function(){return this.itemType!=te&&rt.call(this.data,this.ua,this.rgxMap),this.itemType==S&&this.set(Se,ot(this.get(u))),this},this.parseCH=function(){var a=this.uaCH,d=this.rgxMap;switch(this.itemType){case S:case O:var r=a[wt]||a[pt],g;if(r)for(var h in r){var p=r[h].brand||r[h],m=r[h].version;this.itemType==S&&!/not.a.brand/i.test(p)&&(!g||/chrom/i.test(g)&&p!=xt)&&(p=z(p,{Chrome:"Google Chrome",Edge:"Microsoft Edge","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"}),this.set(l,p).set(u,m).set(Se,ot(m)),g=p),this.itemType==O&&p==xt&&this.set(u,m)}break;case B:var C=a[T];C&&(C&&a[Ve]=="64"&&(C+="64"),rt.call(this.data,C+";",d));break;case U:if(a[w]&&this.set(n,w),a[o]&&(this.set(o,a[o]),!this.get(n)||!this.get(c))){var P={};rt.call(P,"droid 9; "+a[o]+")",d),!this.get(n)&&P.type&&this.set(n,P.type),!this.get(c)&&P.vendor&&this.set(c,P.vendor)}if(a[Y]){var G;if(typeof a[Y]!="string")for(var pe=0;!G&&pe<a[Y].length;)G=z(a[Y][pe++],Lt);else G=z(a[Y],Lt);this.set(n,G)}break;case A:var _=a[ie];if(_){var K=a[mt];_==ut&&(K=parseInt(ot(K),10)>=13?"11":"10"),this.set(l,_).set(u,K)}this.get(l)==ut&&a[o]=="Xbox"&&this.set(l,"Xbox").set(u,void 0);break;case te:var Q=this.data,H=function(Oe){return Q[Oe].getItem().setCH(a).parseCH().get()};this.set(S,H(S)).set(B,H(B)).set(U,H(U)).set(O,H(O)).set(A,H(A))}return this},N.call(this,[["itemType",s],["ua",t],["uaCH",i],["rgxMap",e],["data",Ri(this,s)]]),this}function L(s,t,e){if(typeof s===ue?(Be(s,!0)?(typeof t===ue&&(e=t),t=s):(e=s,t=void 0),s=void 0):typeof s===lt&&!Be(t,!0)&&(e=t,t=void 0),e&&typeof e.append===_e){var i={};e.forEach(function(h,p){i[p]=h}),e=i}if(!(this instanceof L))return new L(s,t,e).getResult();var a=typeof s===lt?s:e&&e[vt]?e[vt]:I&&I.userAgent?I.userAgent:le,d=new Qt(e,!0),r=t?xi(_t,t):_t,g=function(h){return h==te?function(){return new Bt(h,a,r,d).set("ua",a).set(S,this.getBrowser()).set(B,this.getCPU()).set(U,this.getDevice()).set(O,this.getEngine()).set(A,this.getOS()).get()}:function(){return new Bt(h,a,r[h],d).parseUA().get()}};return N.call(this,[["getBrowser",g(S)],["getCPU",g(B)],["getDevice",g(U)],["getEngine",g(O)],["getOS",g(A)],["getResult",g(te)],["getUA",function(){return a}],["setUA",function(h){return ge(h)&&(a=h.length>dt?Te(h,dt):h),this}]]).setUA(a),this}L.VERSION=vi;L.BROWSER=qe([l,u,Se,n]);L.CPU=qe([T]);L.DEVICE=qe([o,c,n,Ce,w,y,f,R,Me]);L.ENGINE=L.OS=qe([l,u]);class Xt{constructor(t,e){b(this,"config");b(this,"sdkConfig");this.config=t,this.sdkConfig=e}on(t,e,i){const a=function(r){r.data.message!==`kalamba:wrapper-rgs:${t}`&&r.data.message!==`kalamba:wrapper:${t}`||e(r.data.payload)};window.addEventListener("message",a,i)}send(t,...[e]){window.postMessage({message:`kalamba:rgs:${t}`,payload:e})}}class Ui{constructor(t){b(this,"socket",null);b(this,"webSocketUrl");b(this,"eventListeners",{close:[],error:[],message:[]});b(this,"connect",async()=>{const t=new WebSocket(this.webSocketUrl);return t.addEventListener("message",this.handleMessage),new Promise(e=>{t.addEventListener("open",i=>{this.handleOpen(i),e(this.socket)},{once:!0})})});b(this,"send",t=>{if(this.socket==null)throw new Error("Cannot send message, the WebSocket connection is not open");this.socket.send(t)});b(this,"close",()=>{if(this.socket==null)throw new Error("Cannot close the WebSocket connection that is not open");this.socket.close()});b(this,"handleClose",t=>{this.eventListeners.close.forEach(e=>{e(t)}),this.socket.removeEventListener("message",this.handleMessage),this.socket.removeEventListener("close",this.handleClose),this.socket.removeEventListener("error",this.handleError),this.socket=null});b(this,"handleError",t=>{this.eventListeners.error.forEach(e=>{e(t)})});b(this,"handleMessage",t=>{this.eventListeners.message.forEach(e=>{e(t)})});b(this,"handleOpen",t=>{const e=t.target;e.addEventListener("close",this.handleClose),e.addEventListener("error",this.handleError),this.socket=e});this.webSocketUrl=t}addEventListener(t,e){this.eventListeners[t].push(e)}removeEventListener(t,e){const i=this.eventListeners[t].indexOf(e);i!==-1&&this.eventListeners[t].splice(i,1)}}function Le(s){return JSON.parse(s==null?void 0:s.data)}function Li(s){var t;return((t=s==null?void 0:s.header)==null?void 0:t.name)==="Ping"}function Ft(s){var t;return((t=s==null?void 0:s.header)==null?void 0:t.name)==="RealityCheck"}function Fe(s){return s.header.name==="GameEvent"}function _i(s){return Fe(s)&&s.body.event==="OPEN_GAME"}function Nt(s){return s.header.code!==1}function Bi(s){return Fe(s)&&s.body.event.includes("_RESULT")}var se,Ie;class Fi extends Ui{constructor(e,i){const a=new URL(e.apiUrl);a.searchParams.set("cageCode",e.cageCode),a.searchParams.set("gameCode",e.gameCode),a.searchParams.set("operatorCode",e.operatorCode),a.searchParams.set("playMode",e.playMode),a.searchParams.set("token",e.token),a.searchParams.set("username",e.username);super(a.toString());b(this,"cId",0);b(this,"mId",0);b(this,"seqId",0);b(this,"gameCode");M(this,se);M(this,Ie);b(this,"onMessage",e=>{const i=Le(e);(Fe(i)||Li(i)||Ft(i))&&this.sendAcknowledgement(i),Ft(i)&&this.handleRealityCheck(i)});this.eventListeners.realityCheck=[],this.gameCode=e.gameCode,v(this,se,i.requestTimeoutMs),v(this,Ie,i.gameVersion??"unknown"),this.addEventListener("message",this.onMessage)}handleRealityCheck(e){this.eventListeners.realityCheck.forEach(i=>{i(e.body)})}addEventListener(e,i){super.addEventListener(e,i)}removeEventListener(e,i){super.removeEventListener(e,i)}buildHeader(e,i=null){return{cId:i??++this.cId,code:i!==null?1:void 0,mId:++this.mId,name:e}}buildPayload(e,i){return JSON.stringify({body:i,header:e})}getBodyExtras(e){return{action:e,seqId:++this.seqId}}request(e,i){const a=this.buildPayload(e,i);return new Promise((d,r)=>{setTimeout(()=>r({type:"timeout"}),k(this,se));const g=h=>{const p=Le(h);try{e.cId===p.header.cId&&(this.removeEventListener("message",g),p.header.code===1?d(p):r({message:p,type:"error"}))}catch{r({message:p,type:"error"})}};this.addEventListener("message",g),this.send(a)})}freeRounds(e){const i=this.buildHeader("ActivateFreeRound");return this.request(i,e).then(a=>a.body).catch(a=>{var d;throw{data:(d=a==null?void 0:a.message)==null?void 0:d.body,type:a.type}})}async authenticate(e=!1){const i=this.buildHeader("Authenticate"),a={clientType:3,version:k(this,Ie),reconnect:e};return this.request(i,a).then(d=>d.body).catch(d=>{var r;throw{data:(r=d==null?void 0:d.message)==null?void 0:r.body,type:d.type}})}async openGame(){const e=this.buildHeader("OpenGame"),i={gameCode:this.gameCode};return new Promise((a,d)=>{const r=g=>{const h=Le(g);_i(h)?(this.removeEventListener("message",r),a(h.body)):Nt(h)&&d({data:h.body,type:"error"})};this.addEventListener("message",r),this.request(e,i).catch(g=>{var h;return d({data:(h=g==null?void 0:g.message)==null?void 0:h.body,type:g.type})})})}sendAcknowledgement(e){const{name:i,cId:a}=e.header,d=this.buildHeader(i,a),r=this.buildPayload(d,{});this.send(r)}sendAction(e,i){const a=this.buildHeader("GameAction"),d={...this.getBodyExtras(e),data:i};return new Promise((r,g)=>{const h=p=>{const m=Le(p);Fe(m)&&d.seqId===m.body.correlationSeqId&&(this.removeEventListener("message",h),Bi(m)?r(m.body):Nt(m)&&g({data:m.body,type:"error"}))};this.addEventListener("message",h),this.request(a,d).catch(p=>{var m;return g({data:(m=p==null?void 0:p.message)==null?void 0:m.body,type:p.type})})})}setRequestTimeoutMs(e){v(this,se,e)}}se=new WeakMap,Ie=new WeakMap;const Ni={CA_BC:"CA",CA_ON:"CA",GER:"DE",US_CT:"US",US_MI:"US",US_NJ:"US",USA:"US"};function Dt(s){return!s||s==="NOT_APPLICABLE"?null:Ni[s]??s}function Jt(s){const t=s.contract;return t?{contract:{balance:{coins:t.balance,version:t.balanceVersion},coinValueInCents:t.coinValueInCents,country:t.countryCode,currency:t.currencyCode,jurisdiction:Dt(t.jurisdictionCode),uiMessages:t.uiMessages,username:t.username}}:{contract:{balance:{coins:s.balance,version:s.balanceVersion},coinValueInCents:s.coinValueInCents,country:s.countryCode,currency:s.currencyCode,jurisdiction:Dt(s.jurisdictionCode),uiMessages:s.uiMessages,username:s.username}}}function Yt(s){var t,e;return{code:((t=s.data)==null?void 0:t.code)??He.RgsErrorCode.UNKNOWN,details:(e=s.data)==null?void 0:e.details}}function Zt(s,t,e){const i=t.contract;if(!i){const a=t.data;return{contract:{bet:{available:a.additionalConfigData.availableMultipliersPerBaseBet,default:{base:a.additionalConfigData.defaultBet.baseBet,multiplier:a.additionalConfigData.defaultBet.betMultiplier},max:a.additionalConfigData.maxAllowedOverallBetInCoins??null,last:a.gameState.betFromCurrentRound?{base:a.gameState.betFromCurrentRound.baseBet,multiplier:a.gameState.betFromCurrentRound.betMultiplier}:null,lastPaid:a.gameState.lastPlacedMainGameBet?{base:a.gameState.lastPlacedMainGameBet.baseBet,multiplier:a.gameState.lastPlacedMainGameBet.betMultiplier}:null},balance:{coins:t.balance,version:t.balanceVersion},freeRounds:(a.FREE_ROUNDS??[]).map(d=>({conf:{base:d.conf.baseBet,multiplier:d.conf.betMultiplier,numAwarded:d.conf.numAwarded},data:{numPlayed:d.data.numPlayed,win:d.data.winAmount,numLeft:d.data.numLeft},id:d.id,rejectable:d.rejectable,skippable:d.skippable,status:d.status,type:d.type})),gameModel:a.additionalConfigData.gameModelFile,metaData:a.gameConfigData.metaData,roundId:a.gameState.cycleId,serverTime:t.balanceVersion,sessionId:a.gameState.sessionId,stateType:{thisRound:a.gameState.stateTypeThisRound,nextRound:a.gameState.stateTypeNextRound},uiMessages:s.uiMessages,win:{max:a.maxWin??null,round:a.gameState.totalWinFromCurrentRound,total:a.gameState.totalWinFromCurrentGameCycle}},data:a}}return{contract:{bet:{available:i.availableMultipliersPerBaseBet,default:{base:i.defaultBet.baseBet,multiplier:i.defaultBet.betMultiplier},max:i.maxBetInCoins??null,last:i.lastBet?{base:i.lastBet.baseBet,multiplier:i.lastBet.betMultiplier}:null,lastPaid:i.lastMainGameBet?{base:i.lastMainGameBet.baseBet,multiplier:i.lastMainGameBet.betMultiplier}:null},balance:{coins:i.balanceInCoins,version:i.balanceVersion},freeRounds:(i.freeRounds??[]).map(a=>({conf:{base:a.conf.baseBet,multiplier:a.conf.betMultiplier,numAwarded:a.conf.numAwarded},data:{numPlayed:a.data.numPlayed,win:a.data.winAmount,numLeft:a.data.numLeft},id:a.id,rejectable:a.rejectable,skippable:a.skippable,status:a.status,type:a.type})),gameModel:i.gameModelFile,metaData:i.metaData,roundId:i.roundId,serverTime:i.serverTime,sessionId:i.sessionId,stateType:{thisRound:i.stateTypeThisRound,nextRound:i.stateTypeNextRound},uiMessages:s.contract.uiMessages.concat(i.uiMessages),win:{max:i.maxWinInCoins??null,round:i.roundWin,total:i.totalWin}},data:e?e(t.opaqueGameServerToUi):t.opaqueGameServerToUi}}function ei(s){var t,e;return{code:((t=s.data)==null?void 0:t.code)??He.RgsErrorCode.UNKNOWN,details:(e=s.data)==null?void 0:e.details}}function ti(s,t){const e=s.contract;if(!e){const i=s.data;return{contract:{bet:{last:i.gameState.betFromCurrentRound?{base:i.gameState.betFromCurrentRound.baseBet,multiplier:i.gameState.betFromCurrentRound.betMultiplier}:null,lastPaid:{base:(i.gameState.lastPlacedMainGameBet??i.gameState.betFromCurrentRound).baseBet,multiplier:(i.gameState.lastPlacedMainGameBet??i.gameState.betFromCurrentRound).betMultiplier}},balance:{coins:s.balance,version:s.balanceVersion},freeRounds:(i.FREE_ROUNDS??[]).map(a=>({conf:{base:a.conf.baseBet,multiplier:a.conf.betMultiplier,numAwarded:a.conf.numAwarded},data:{numPlayed:a.data.numPlayed,win:a.data.winAmount,numLeft:a.data.numLeft},id:a.id,rejectable:a.rejectable,skippable:a.skippable,status:a.status,type:a.type})),serverTime:s.balanceVersion,roundId:i.gameState.cycleId,stateType:{thisRound:i.gameState.stateTypeThisRound,nextRound:i.gameState.stateTypeNextRound},uiMessages:i.uiMessages,win:{round:i.gameState.totalWinFromCurrentRound,total:i.gameState.totalWinFromCurrentGameCycle}},data:i}}return{contract:{bet:{last:e.lastBet?{base:e.lastBet.baseBet,multiplier:e.lastBet.betMultiplier}:null,lastPaid:{base:e.lastMainGameBet.baseBet,multiplier:e.lastMainGameBet.betMultiplier}},balance:{coins:e.balanceInCoins,version:e.balanceVersion},freeRounds:(e.freeRounds??[]).map(i=>({conf:{base:i.conf.baseBet,multiplier:i.conf.betMultiplier,numAwarded:i.conf.numAwarded},data:{numPlayed:i.data.numPlayed,win:i.data.winAmount,numLeft:i.data.numLeft},id:i.id,rejectable:i.rejectable,skippable:i.skippable,status:i.status,type:i.type})),serverTime:e.serverTime,roundId:e.roundId,stateType:{thisRound:e.stateTypeThisRound,nextRound:e.stateTypeNextRound},uiMessages:e.uiMessages,win:{round:e.roundWin,total:e.totalWin}},data:t?t(s.opaqueGameServerToUi):s.opaqueGameServerToUi}}function ii(s){var t,e;return{code:((t=s.data)==null?void 0:t.code)??He.RgsErrorCode.UNKNOWN,details:(e=s.data)==null?void 0:e.details}}const Di={parseAuthenticateResponse:Jt,parseAuthenticateError:Yt,parseOpenGameResponse:Zt,parseOpenGameError:ei,parsePlayResponse:ti,parsePlayError:ii},Gi={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"},{device:Hi}=L(navigator.userAgent),Vi=x("KalambaBullseyePlugin","color:#000000;font-weight:bold;");class qi extends Xt{constructor(...e){super(...e);b(this,"socket");b(this,"error");this.on("openGame",async()=>{try{this.error=void 0;const i=await this.openGame();this.send("openGameResponse",i)}catch(i){this.error=i,this.send("openGameError",i)}}),this.on("play",async i=>{try{this.error=void 0;const a=await this.play(i);this.send("playResponse",a)}catch(a){this.error=a,this.send("playError",a)}}),this.on("freeRounds",async i=>{try{this.error=void 0,await this.socket.freeRounds(i),this.send("freeRoundsResponse",i)}catch(a){this.error=a,this.send("freeRoundsError",a)}}),this.on("configured",i=>{this.socket.setRequestTimeoutMs(i.ui.requestTimeoutMs)}),this.registerFromSdkEvents()}initialize(e){this.socket=new Fi(e,{gameVersion:this.config.gameVersion,requestTimeoutMs:this.sdkConfig.ui.requestTimeoutMs}),["fireboltroulette"].includes(e.gameCode)||(this.socket.addEventListener("close",i=>{i.code===1008?this.error||this.send("error",{type:"CLOSE",messageCode:"TOO_MANY_OPEN_GAMES",messageKey:"RgsError.TOO_MANY_OPEN_GAMES"}):i.code===1011?this.error||this.send("error",{type:"CLOSE",messageCode:"UNKNOWN",messageKey:"RgsError.UNKNOWN"}):this.reconnect()}),["mobile","tablet"].includes(Hi.type??"")&&document.addEventListener("visibilitychange",async()=>{document.hidden||(this.socket.socket?this.socket.socket&&[WebSocket.CONNECTING,WebSocket.OPEN].includes(this.socket.socket.readyState)&&this.socket.close():this.reconnect())})),this.socket.addEventListener("error",i=>Vi("error",i)),this.socket.addEventListener("realityCheck",i=>{this.send("realityCheck",i)})}async reconnect(){try{await this.socket.connect(),await this.socket.authenticate(!0),await this.socket.openGame()}catch{this.send("error",{type:"CLOSE",messageCode:"CONNECTION_ERROR",messageKey:"RgsError.CONNECTION_ERROR"})}}async openGame(){var H,Oe;const e=new URLSearchParams(window.location.search),i=e.get("apiUrl"),a=e.get("cageCode"),d=e.get("gameCode"),r=e.get("operatorCode"),g=e.get("playMode"),h=e.get("token"),p=e.get("username"),m=e.get("gameHistoryUrl"),C=e.get("homeUrl")??void 0,P=e.get("cashierUrl")??void 0;this.initialize({apiUrl:i,cageCode:a,gameCode:d,operatorCode:r,playMode:g,token:h,username:p});try{await this.socket.connect()}catch{throw{type:"error",data:{code:He.RgsErrorCode.CONNECTION_ERROR}}}let G;try{G=await this.socket.authenticate()}catch(X){throw{type:X.type,data:X.type==="error"?Yt(X.data):void 0}}let pe;try{pe=await this.socket.openGame()}catch(X){throw{type:X.type,data:X.type==="error"?ei(X.data):void 0}}const _=Jt(G),K=Zt(G,pe,this.config.dataDecoder&&ze.decoders[this.config.dataDecoder]);this.sdkConfig.api={...this.sdkConfig.api,brand:a,game:d,integration:r,jurisdiction:_.contract.jurisdiction,playMode:g,user:_.contract.username,integrationData:{token:h},country:_.contract.country,currency:_.contract.currency,coinValueInCents:_.contract.coinValueInCents,gameHistoryUrl:m,homeUrl:C,cashierUrl:P,backendSessionId:K.contract.sessionId,lastRoundId:K.contract.roundId};const Q=(Oe=(H=e.get("languageCode"))==null?void 0:H.split("_"))==null?void 0:Oe[0];return Q&&(this.sdkConfig.ui.language=Q.length===3?Gi[Q]??Q:Q),K}async play(e){for(;!this.socket.socket;)await new Promise(P=>setTimeout(()=>P(),500));const{contract:{bet:i,forcedOutcomes:a,...d},extra:r,payloadToInject:g,actionType:h}=e,p=this.config.dataEncoder&&ze.encoders[this.config.dataEncoder],m={bet:i?{baseBet:i.base,betMultiplier:i.multiplier}:void 0,forcedOutcomes:a,...d,...g,opaqueUiToGameServer:p?p(r):r};let C;try{C=await this.socket.sendAction(h,m)}catch(P){throw{type:P.type,data:P.type==="error"?ii(P.data):void 0}}return ti(C,this.config.dataDecoder&&ze.decoders[this.config.dataDecoder])}registerFromSdkEvents(){this.on("history",()=>{const{api:{game:e,integration:i,integrationData:a,jurisdiction:d,user:r,gameHistoryUrl:g},ui:{language:h}}=this.sdkConfig,p=r.replace(/^user_/,"").replace(new RegExp(`_${i}$`),""),m=new URL(window.location.href);m.hostname=m.hostname.replace(/^v\./,"").replace(/^play\./,"history."),m.pathname=m.pathname.replace(/(\/[0-9]+\.[0-9]+\.[0-9]+)?\/wrapper\.html/,"/list/index.html"),m.search="",m.searchParams.set("apiUrl",new URL(g).origin),m.searchParams.set("gameCode",e),d&&m.searchParams.set("jurisdiction",d),m.searchParams.set("operatorCode",i),m.searchParams.set("token",a.token),m.searchParams.set("username",p),m.searchParams.set("languageCode",h),this.config.gameHistoryUrl&&m.searchParams.set("gameHistoryUrl",this.config.gameHistoryUrl),window.open(m.toString(),"_blank")})}}class si{constructor(t,e,i){b(this,"trackers");b(this,"config");b(this,"sdkConfig");this.trackers=t,this.config=e,this.sdkConfig=i}on(t,e,i){const a=function(r){r.data.message!==`kalamba:wrapper-telemetry:${t}`&&r.data.message!==`kalamba:wrapper:${t}`||e(r.data.payload)};window.addEventListener("message",a,i)}track(t,e){this.trackers.forEach(i=>i.track(t,e))}}function Gt(s){return s.reduce((t,e)=>t+e,0)}function zi(s){const t=s.length,e=Gt(s)/t,i=s.map(d=>Math.pow(d-e,2)),a=Gt(i)/t;return Math.sqrt(a)}class Ht{constructor(){b(this,"rafId",-1);b(this,"startTime",0);b(this,"stopTime",0);b(this,"frames",[]);b(this,"calculateFPS",()=>{const t=Math.floor((this.stopTime-this.startTime)/1e3);return this.frames.map(e=>Math.floor((e-this.startTime)/1e3)).reduce((e,i,a,d)=>(d[a]!==d[a-1]?e.push(1):e[e.length-1]++,e),[]).slice(0,t)});b(this,"getReport",()=>{const t=this.calculateFPS(),e=Math.floor(this.frames.length/((this.stopTime-this.startTime)/1e3)),i=t.length>0?Math.max(...t):e,a=t.length>0?Math.min(...t):e,d=t.length>0?zi(t):0;return{fpsAvg:e,fpsMax:i,fpsMin:a,fpsStdDev:d}});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 Wi="landscape",ji="portrait";function $i(){try{const s=document.createElement("canvas");return!!window.WebGLRenderingContext&&(s.getContext("webgl")||s.getContext("experimental-webgl"))instanceof WebGLRenderingContext}catch{return!1}}async function Ki(){if(!window.createImageBitmap)return!1;const e=await(await fetch("data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoCAAEAAQAcJaQAA3AA/v3AgAA=")).blob();try{return await createImageBitmap(e),!0}catch{return!1}}function ct(){return window.innerWidth>=window.innerHeight?Wi:ji}var Ne,ae,ne,oe,Pe,De,Ae,Ge;class Qi extends si{constructor(...e){super(...e);b(this,"FPS_SAMPLE_INTERVAL",1e4);M(this,Ne,0);M(this,ae);M(this,ne);M(this,oe);M(this,Pe,!1);M(this,De,!1);M(this,Ae,"");M(this,Ge,[]);v(this,ne,{}),v(this,oe,this.deviceInfo()),v(this,ae,this.config.gameVersion),this.on("state",({balance:i})=>{v(this,Ne,i)}),this.on("autoplay",({action:i})=>{["start","resume"].includes(i)?v(this,Pe,!0):v(this,Pe,!1)}),this.on("settings",({fastPlay:i})=>{i!==void 0&&v(this,De,i)}),this.registerEvents()}async registerEvents(){k(this,oe).then(e=>{this.track("Device Information",e)}),this.on("loadStart",()=>{this.track("Game Loading",{progress:0,step:"initial"})}),this.on("loadProgress",e=>{this.track("Game Loading",{progress:e.progress})}),this.on("loadEnd",()=>{this.track("Game Loading",{progress:100,step:"complete"})}),this.on("error",e=>{this.track("System Message",{systemMessageText:e.messageCode,systemMessageType:e.type})}),this.on("openGameResponse",async e=>{v(this,Ae,e.contract.stateType.nextRound),v(this,ne,{balanceInCoins:e.contract.balance.coins,clientVersion:k(this,ae),coinValueInCents:this.sdkConfig.api.coinValueInCents,coinValueInCentsFloat:this.sdkConfig.api.coinValueInCents,currency:this.sdkConfig.api.currency,defaultBaseBet:e.contract.bet.default.base,defaultBetMultiplier:e.contract.bet.default.multiplier,environment:"release",gameCode:this.sdkConfig.api.game,gameCodeServer:this.sdkConfig.api.game,gameModelFile:e.contract.gameModel,jurisdiction:this.sdkConfig.api.jurisdiction,languageCode:this.sdkConfig.ui.language,operatorName:"kalamba",partnerId:this.sdkConfig.api.brand,partnerParentId:this.sdkConfig.api.integration,platform:"WEB",playMode:this.sdkConfig.api.playMode,referrer:window.location.hostname,rootTrackingSessionID:this.sdkConfig.api.sessionId,backendSessionID:this.sdkConfig.api.backendSessionId,serverVersion:e.contract.metaData.version}),this.track("Game Open",k(this,ne))}),this.on("playCycleEnd",async e=>{const i=await k(this,oe),{base:a,multiplier:d}=e.contract.bet.lastPaid??{},r=e.contract.balance.coins,g=e.contract.bet.lastPaid.base*e.contract.bet.lastPaid.multiplier,h=e.contract.win.total,p=h-g,m="spin",C=e.contract.roundId;this.track("Betting Activity",{balance:r-p,balanceAfter:r,baseBet:a,betMultiplier:d,betType:m,gameVersion:k(this,ae),coinValueInCents:this.sdkConfig.api.coinValueInCents,coinValueInCentsFloat:this.sdkConfig.api.coinValueInCents,currency:this.sdkConfig.api.currency,environment:"release",gameCode:this.sdkConfig.api.game,gameCodeServer:this.sdkConfig.api.game,isMobile:i.isMobile,netResult:p,operatorName:"kalamba",orientation:ct(),partnerId:this.sdkConfig.api.brand,partnerParentId:this.sdkConfig.api.integration,platform:"WEB",playMode:this.sdkConfig.api.playMode,roundId:C,roundTypes:["BaseGame"],totalBet:g,totalWin:h}),v(this,Ge,[])}),this.on("telemetry.click",e=>{this.track("UI Interaction",{action:"click",...this.getExtraUiInteractionData(),...e})}),this.on("telemetry.orientationChange",()=>{this.track("UI Interaction",{action:"orientationChange",...this.getExtraUiInteractionData()})}),this.reportFpsSample(),this.reportFpsRound()}reportFpsSample(){const e=new Ht,i=()=>{e.stop();const d=e.getReport();this.track("FPS Performance",{...d,fpsType:"sample"}),a()},a=async()=>{e.start(),setTimeout(i,this.FPS_SAMPLE_INTERVAL)};a()}reportFpsRound(){const e=new Ht;this.on("playCycleStart",()=>{e.start()}),this.on("playCycleEnd",()=>{e.stop();const i=e.getReport();this.track("FPS Performance",{...i,fpsType:"playCycleStart->playCycleEnd"})})}getExtraUiInteractionData(){return{orientation:ct(),stateType:k(this,Ae)}}async deviceInfo(){var g;const{browser:e,device:i,os:a}=L(navigator.userAgent),d=$i(),r=await Ki();return{browserName:e.name,browserVersion:e.version,connection:(g=navigator.connection)==null?void 0:g.effectiveType,deviceName:i.model,deviceType:i.type,isMobile:["mobile","tablet"].includes(i.type??""),isWebGLSupported:d,isWebPSupported:r,manufacturer:i.vendor,operatingSystem:a.name,operatingSystemVersion:a.version,orientation:ct(),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}}}Ne=new WeakMap,ae=new WeakMap,ne=new WeakMap,oe=new WeakMap,Pe=new WeakMap,De=new WeakMap,Ae=new WeakMap,Ge=new WeakMap;var Xi=gt.requireNoop();const Vt=gt.getDefaultExportFromCjs(Xi);class bt{constructor(t,e){b(this,"config");b(this,"sdkConfig");this.config=t,this.sdkConfig=e}}const qt=25,zt=1e4;var re,ce,de,W;class Ji extends bt{constructor(...e){super(...e);M(this,re,"https://europe-west3-stargazer-328808.cloudfunctions.net/collect-events");M(this,ce);M(this,de);M(this,W,[]);b(this,"processQueueForced");v(this,ce,new Date().getTime()),v(this,W,[]),this.processQueueForced=this.processQueue.bind(this,!0),this.schedule(),fetch(k(this,re),{method:"OPTIONS"}).catch(Vt),this.subscribe()}subscribe(){window.addEventListener("beforeunload",this.processQueueForced,!1),window.addEventListener("pagehide",this.processQueueForced,!1),window.addEventListener("visibilitychange",this.processQueueForced,!1)}schedule(){k(this,de)&&clearTimeout(k(this,de)),v(this,de,window.setTimeout(()=>this.processQueue(),zt))}send(e){v(this,ce,new Date().getTime());try{navigator.sendBeacon(k(this,re),JSON.stringify(e))}catch{fetch(k(this,re),{body:JSON.stringify(e),method:"POST",headers:{"Content-Type":"application/json"},keepalive:!0}).catch(Vt)}this.schedule()}addToQueue(e){k(this,W).push(e),this.processQueue()}processQueue(e=!1){if(!(this.sdkConfig==null||!this.sdkConfig.ui.feature.allowTelemetry)&&!(!e&&k(this,W).length<qt&&new Date().getTime()-k(this,ce)<zt))for(;k(this,W).length;){const i=k(this,W).splice(0,qt).map(a=>({...a,sessionID:this.sdkConfig.api.sessionId,userID:this.sdkConfig.api.user}));this.send(i)}}track(e,i){this.addToQueue({eventName:e,eventParams:i,eventTimestamp:new Date().getTime(),eventUUID:gt.v4()})}}re=new WeakMap,ce=new WeakMap,de=new WeakMap,W=new WeakMap;const Yi=x("LoggingTracker","color:#000000;font-weight:bold;");class Zi extends bt{track(t,e){Yi(`@${this.sdkConfig.api.user}`,`[${t}]`,e)}}exports.BasicPlugin=ri;exports.CasinoPlugin=D;exports.DebuggingPlugin=di;exports.GigPlugin=ui;exports.KalambaBullseyeParsers=Di;exports.KalambaBullseyePlugin=qi;exports.KalambaStargazerPlugin=Qi;exports.KalambaStargazerTracker=Ji;exports.LoggingTracker=Zi;exports.OryxPlugin=gi;exports.PariplayPlugin=bi;exports.QuantaPlugin=ki;exports.RelaxFEIMPlugin=fi;exports.RgsPlugin=Xt;exports.TelemetryPlugin=si;exports.Tracker=bt;exports.TukoPlugin=yi;
package/dist/plugins.d.ts CHANGED
@@ -109,6 +109,14 @@ export declare class DebuggingPlugin extends CasinoPlugin {
109
109
  _send(...args: Parameters<typeof DebuggingPlugin.prototype.send>): ReturnType<typeof DebuggingPlugin.prototype.send>;
110
110
  }
111
111
 
112
+ declare type Decoder = (data: any) => unknown;
113
+
114
+ declare type Decoders = keyof typeof decoders;
115
+
116
+ declare const decoders: {
117
+ json: (text: string, reviver?: (this: any, key: string, value: any) => any) => any;
118
+ };
119
+
112
120
  declare type DomainAllowedPayloadMap<P extends DomainPrefix> = DomainToMessagePayloadMap[P];
113
121
 
114
122
  declare type DomainMessage<P extends DomainPrefix> = keyof DomainAllowedPayloadMap<P>;
@@ -125,6 +133,15 @@ declare type DomainToMessagePayloadMap = {
125
133
  telemetry: TelemetryOnlyMessagePayloadMap;
126
134
  };
127
135
 
136
+ declare type Encoders = keyof typeof encoders;
137
+
138
+ declare const encoders: {
139
+ json: {
140
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
141
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
142
+ };
143
+ };
144
+
128
145
  declare type ForwardToPluginsMessage<P extends PluginDomain> = keyof ForwardToPluginsMessageMap<'sdk'>[P] | keyof ForwardToPluginsMessageMap<'rgs'>[P] | keyof ForwardToPluginsMessageMap<'casino'>[P] | keyof ForwardToPluginsMessageMap<'telemetry'>[P];
129
146
 
130
147
  declare interface ForwardToPluginsMessageMap<SourceDomain extends DomainPrefix> {
@@ -530,11 +547,11 @@ declare function parseAuthenticateResponse(authResponse: AuthenticateResponse['b
530
547
 
531
548
  declare function parseOpenGameError(errorResponse: any): RgsErrorData;
532
549
 
533
- declare function parseOpenGameResponse(authResponse: AuthenticateResponse['body'], openGameResponse: OpenGameGameEvent['body']): OpenGameResponse;
550
+ declare function parseOpenGameResponse(authResponse: AuthenticateResponse['body'], openGameResponse: OpenGameGameEvent['body'], dataDecoder?: Decoder): OpenGameResponse;
534
551
 
535
552
  declare function parsePlayError(errorResponse: any): RgsErrorData;
536
553
 
537
- declare function parsePlayResponse(playResponse: ResultGameEvent['body']): PlayResponse;
554
+ declare function parsePlayResponse(playResponse: ResultGameEvent['body'], dataDecoder?: Decoder): PlayResponse;
538
555
 
539
556
  declare type PlayRequest = {
540
557
  contract: ContractPlayPayload;
@@ -934,6 +951,8 @@ declare interface WebSocketResponse<Name extends ResponseMessageName, Header = R
934
951
  }
935
952
 
936
953
  declare type WrapperConfig = {
954
+ dataDecoder?: Decoders;
955
+ dataEncoder?: Encoders;
937
956
  gameName: string;
938
957
  gameVersion: string;
939
958
  gameHistoryUrl?: string;