@everymatrix/casino-play-random-game 1.29.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.
Files changed (47) hide show
  1. package/dist/casino-play-random-game/casino-play-random-game.esm.js +1 -0
  2. package/dist/casino-play-random-game/index.esm.js +0 -0
  3. package/dist/casino-play-random-game/p-0f38b3f8.js +1 -0
  4. package/dist/casino-play-random-game/p-0f957927.entry.js +1 -0
  5. package/dist/cjs/casino-play-random-game.cjs.entry.js +344 -0
  6. package/dist/cjs/casino-play-random-game.cjs.js +19 -0
  7. package/dist/cjs/index-8944e204.js +1247 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +12 -0
  11. package/dist/collection/components/casino-play-random-game/casino-play-random-game.css +347 -0
  12. package/dist/collection/components/casino-play-random-game/casino-play-random-game.js +469 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +60 -0
  15. package/dist/collection/utils/utils.js +27 -0
  16. package/dist/components/casino-play-random-game.d.ts +11 -0
  17. package/dist/components/casino-play-random-game.js +376 -0
  18. package/dist/components/index.d.ts +26 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/esm/casino-play-random-game.entry.js +340 -0
  21. package/dist/esm/casino-play-random-game.js +17 -0
  22. package/dist/esm/index-58563736.js +1221 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/loader.js +17 -0
  25. package/dist/esm/polyfills/core-js.js +11 -0
  26. package/dist/esm/polyfills/css-shim.js +1 -0
  27. package/dist/esm/polyfills/dom.js +79 -0
  28. package/dist/esm/polyfills/es5-html-element.js +1 -0
  29. package/dist/esm/polyfills/index.js +34 -0
  30. package/dist/esm/polyfills/system.js +6 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/stencil.config.js +22 -0
  34. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-play-random-game/.stencil/packages/casino-play-random-game/stencil.config.d.ts +2 -0
  35. package/dist/types/components/casino-play-random-game/casino-play-random-game.d.ts +73 -0
  36. package/dist/types/components.d.ts +117 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  39. package/dist/types/utils/locale.utils.d.ts +6 -0
  40. package/dist/types/utils/utils.d.ts +2 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +10 -0
  47. package/package.json +19 -0
@@ -0,0 +1 @@
1
+ import{p as i,b as n}from"./p-0f38b3f8.js";(()=>{const n=import.meta.url,a={};return""!==n&&(a.resourcesUrl=new URL(".",n).href),i(a)})().then((i=>n([["p-0f957927",[[1,"casino-play-random-game",{endpoint:[513],datasource:[513],language:[513],specificCategory:[513,"specific-category"],iconVisible:[513,"icon-visible"],iconVisibleOnAnim:[513,"icon-visible-on-anim"],launchByGameCard:[513,"launch-by-game-card"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],hasErrors:[32],limitStylingAppends:[32],isLoading:[32],gamesToShow:[32],selectedGame:[32],animationDone:[32],animationStarted:[32]}]]]],i)));
File without changes
@@ -0,0 +1 @@
1
+ let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},i=e=>Promise.resolve(e),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),c=new WeakMap,u=e=>"sc-"+e.o,a={},f=e=>"object"==(e=typeof e)||"function"===e,$=(e,t,...n)=>{let l=null,s=null,o=!1,i=!1,r=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof e&&!f(l))&&(l+=""),o&&i?r[r.length-1].i+=l:r.push(o?y(null,l):l),i=o)};if(c(n),t){t.key&&(s=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const u=y(e,null);return u.u=t,r.length>0&&(u.$=r),u.h=s,u},y=(e,t)=>({t:0,m:e,i:t,p:null,$:null,u:null,h:null}),d={},h=(e,t,n,s,i,r)=>{if(n!==s){let c=_(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,l=p(n),o=p(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if("key"===t);else if("ref"===t)s&&s(e);else if(c||"o"!==t[0]||"n"!==t[1]){const l=f(s);if((c||l&&null!==s)&&!i)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?c=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!c||4&r||i)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):_(l,u)?u.slice(2):u[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},m=/\s/,p=e=>e?e.split(m):[],b=(e,t,n,l)=>{const s=11===t.p.nodeType&&t.p.host?t.p.host:t.p,o=e&&e.u||a,i=t.u||a;for(l in o)l in i||h(s,l,o[l],void 0,n,t.t);for(l in i)h(s,l,o[l],i[l],n,t.t)},w=(t,n,l)=>{let o,i,r=n.$[l],c=0;if(null!==r.i)o=r.p=s.createTextNode(r.i);else if(o=r.p=s.createElement(r.m),b(null,r,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),r.$)for(c=0;c<r.$.length;++c)i=w(t,r,c),i&&o.appendChild(i);return o},S=(e,n,l,s,o,i)=>{let r,c=e;for(c.shadowRoot&&c.tagName===t&&(c=c.shadowRoot);o<=i;++o)s[o]&&(r=w(null,l,o),r&&(s[o].p=r,c.insertBefore(r,n)))},g=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.p,v(l),s.remove())},k=(e,t)=>e.m===t.m&&e.h===t.h,j=(e,t)=>{const n=t.p=e.p,l=e.$,s=t.$,o=t.i;null===o?(b(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o,i=0,r=0,c=0,u=0,a=t.length-1,f=t[0],$=t[a],y=l.length-1,d=l[0],h=l[y];for(;i<=a&&r<=y;)if(null==f)f=t[++i];else if(null==$)$=t[--a];else if(null==d)d=l[++r];else if(null==h)h=l[--y];else if(k(f,d))j(f,d),f=t[++i],d=l[++r];else if(k($,h))j($,h),$=t[--a],h=l[--y];else if(k(f,h))j(f,h),e.insertBefore(f.p,$.p.nextSibling),f=t[++i],h=l[--y];else if(k($,d))j($,d),e.insertBefore($.p,f.p),$=t[--a],d=l[++r];else{for(c=-1,u=i;u<=a;++u)if(t[u]&&null!==t[u].h&&t[u].h===d.h){c=u;break}c>=0?(o=t[c],o.m!==d.m?s=w(t&&t[r],n,c):(j(o,d),t[c]=void 0,s=o.p),d=l[++r]):(s=w(t&&t[r],n,r),d=l[++r]),s&&f.p.parentNode.insertBefore(s,f.p)}i>a?S(e,null==l[y+1]?null:l[y+1].p,n,l,r,y):r>y&&g(t,i,a)})(n,l,t,s):null!==s?(null!==e.i&&(n.textContent=""),S(n,null,t,s,0,s.length-1)):null!==l&&g(l,0,l.length-1)):e.i!==o&&(n.data=o)},v=e=>{e.u&&e.u.ref&&e.u.ref(null),e.$&&e.$.map(v)},M=e=>F(e).S,C=(e,t)=>{t&&!e.g&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.g=t)))},O=(e,t)=>{if(e.t|=16,!(4&e.t))return C(e,e.k),ee((()=>L(e,t)));e.t|=512},L=(e,t)=>{const n=e.j;let l;return t&&(l=T(n,"componentWillLoad")),W(l,(()=>P(e,n,t)))},P=async(e,t,n)=>{const l=e.S,o=l["s-rc"];n&&(e=>{const t=e.v,n=e.S,l=t.t,o=((e,t)=>{let n=u(t),l=I.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=c.get(e=e.head||e);o||c.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);x(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>E(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},x=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.S,o=n.v,i=n.M||y(null,null),r=(e=>e&&e.m===d)(l)?l:$(null,null,l);t=s.tagName,o.C&&(r.u=r.u||{},o.C.map((([e,t])=>r.u[t]=s[e]))),r.m=null,r.t|=4,n.M=r,r.p=i.p=s.shadowRoot||s,e=s["s-sc"],j(i,r)})(n,l)}catch(e){z(e,n.S)}return null},E=e=>{const t=e.S,n=e.j,l=e.k;64&e.t||(e.t|=64,A(t),T(n,"componentDidLoad"),e.O(t),l||N()),e.g&&(e.g(),e.g=void 0),512&e.t&&Z((()=>O(e,!1))),e.t&=-517},N=()=>{A(s.documentElement),Z((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"casino-play-random-game"}});return e.dispatchEvent(t),t})(l)))},T=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){z(e)}},W=(e,t)=>e&&e.then?e.then(t):t(),A=e=>e.classList.add("hydrated"),R=(e,t,n)=>{if(t.L){e.watchers&&(t.P=e.watchers);const l=Object.entries(t.L),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>F(this).N.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=F(e),o=s.S,i=s.N.get(t),r=s.t,c=s.j;if(n=((e,t)=>null==e||f(e)?e:1&t?e+"":e)(n,l.L[t][0]),(!(8&r)||void 0===i)&&n!==i&&(!Number.isNaN(i)||!Number.isNaN(n))&&(s.N.set(t,n),c)){if(l.P&&128&r){const e=l.P[t];e&&e.map((e=>{try{c[e](n,i,t)}catch(e){z(e,o)}}))}2==(18&r)&&O(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){o.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(s.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.C.push([e,s]),s}))}}return e},U=e=>{T(e,"connectedCallback")},q=(e,t={})=>{const n=[],i=t.exclude||[],c=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),y=[];let d,h=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],o:t[1],L:t[2],T:t[3]};l.L=t[2],l.C=[],l.P={};const s=l.o,a=class extends HTMLElement{constructor(e){super(e),V(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){d&&(clearTimeout(d),d=null),h?y.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=F(e),n=t.v,l=()=>{};if(1&t.t)U(t.j);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){C(t,t.k=n);break}}n.L&&Object.entries(n.L).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=G(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.P=s.watchers,R(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){z(e)}t.t&=-9,t.t|=128,e(),U(t.j)}if(s.style){let e=s.style;const t=u(n);if(!I.has(t)){const l=()=>{};((e,t,n)=>{let l=I.get(e);r&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,I.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.k,i=()=>O(t,!0);o&&o["s-rc"]?o["s-rc"].push(i):i()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>{}))}componentOnReady(){return F(this).W}};l.A=e[0],i.includes(s)||c.get(s)||(n.push(s),c.define(s,R(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),h=!1,y.length?y.map((e=>e.connectedCallback())):o.jmp((()=>d=setTimeout(N,30)))},D=new WeakMap,F=e=>D.get(e),H=(e,t)=>D.set(t.j=e,t),V=(e,t)=>{const n={t:0,S:e,v:t,N:new Map};return n.W=new Promise((e=>n.O=e)),e["s-p"]=[],e["s-rc"]=[],D.set(e,n)},_=(e,t)=>t in e,z=(e,t)=>(0,console.error)(e,t),B=new Map,G=e=>{const t=e.o.replace(/-/g,"_"),n=e.A,l=B.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(B.set(n,e),e[t])),z)},I=new Map,J=[],K=[],Q=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?Z(Y):o.raf(Y))},X=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){z(e)}e.length=0},Y=()=>{X(J),X(K),(n=J.length>0)&&o.raf(Y)},Z=e=>i().then(e),ee=Q(K,!0);export{q as b,M as g,$ as h,i as p,H as r}
@@ -0,0 +1 @@
1
+ import{r as n,h as a,g as e}from"./p-0f38b3f8.js";const t={en:{error:"Error",randomGameLoading:"Loading ...",playRandomGame:"Play a random game",playNowRandomGame:"Play now",spinRandomGame:"Spin"},ro:{error:"Eroare",playRandomGame:"Play a random game",playNowRandomGame:"Play now",spinRandomGame:"Spin"},fr:{error:"Error",playRandomGame:"Play a random game",playNowRandomGame:"Play now",spinRandomGame:"Spin"},hr:{error:"Greška",playRandomGame:"Play a random game",playNowRandomGame:"Play now",spinRandomGame:"Spin"},hu:{error:"Greška",playRandomGame:"Play a random game",playNowRandomGame:"Play now",spinRandomGame:"Spin"}},o=n=>new Promise((a=>{fetch(n).then((n=>n.json())).then((n=>{Object.keys(n).forEach((a=>{for(let e in n[a])t[a][e]=n[a][e]})),a(!0)}))})),i=(n,a,e)=>{let o=t[void 0!==a?a:"en"][n];if(void 0!==e)for(const[n,a]of Object.entries(e.values)){const e=new RegExp(`{${n}}`,"g");o=o.replace(e,a)}return o},r=class{constructor(a){n(this,a),this.language="en",this.specificCategory="",this.iconVisible="",this.iconVisibleOnAnim="",this.launchByGameCard="",this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.selectedGame=null,this.animationDone=!1,this.animationStarted=!1,this.animation=null,this.selectedGameIndex=null,this.selectedGameEl=null,this.iconVisibility=null,this.shuffle=n=>{let a,e=n.length;for(;0!==e;)a=Math.floor(Math.random()*e),e--,[n[e],n[a]]=[n[a],n[e]];return n},this.setClientStyling=()=>{let n=document.createElement("style");n.innerHTML=this.clientStyling,this.host.shadowRoot.prepend(n)},this.setClientStylingURL=()=>{let n=new URL(this.clientStylingUrl),a=document.createElement("style");fetch(n.href).then((n=>n.text())).then((n=>{a.innerHTML=n,this.clientStyling=n,setTimeout((()=>{this.host.shadowRoot.prepend(a)}),1)}))}}watchEndpoint(n,a){n&&n!=a&&this.endpoint&&this.fetchGameList()}handleNewTranslations(){this.isLoading=!0,o(this.translationUrl).then((()=>{this.isLoading=!1}))}connectedCallback(){this.iconVisibility="true"===this.iconVisible}componentWillLoad(){if(this.translationUrl.length>2&&o(this.translationUrl),this.endpoint&&this.language&&this.datasource)return this.fetchGameList()}componentDidLoad(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}fetchGameList(){let n=new URL(`${this.endpoint}/v1/casino/games`);return n.searchParams.append("device",(()=>{const n=(()=>{let n=window.navigator.userAgent;return n.toLowerCase().match(/android/i)?"Android":n.toLowerCase().match(/iphone/i)?"iPhone":n.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(n)return"PC"===n?"dk":"mtWeb"})()),n.searchParams.append("datasource",this.datasource),n.searchParams.append("fields","gId,id,href,thumbnail,name,vendor,launchUrl,subVendor"),n.searchParams.append("expand","vendor"),n.searchParams.append("pagination","offset=0,limit=423"),n.searchParams.append("language",this.language),this.specificCategory&&n.searchParams.append("filter",`categories(id=${this.specificCategory})`),new Promise(((a,e)=>{this.isLoading=!0,fetch(n.href).then((n=>n.json())).then((n=>{this.gamesToShow=this.setUpGames(null==n?void 0:n.items),a(!0)})).catch((n=>{console.error(n),this.hasErrors=!0,e(n)})).finally((()=>{this.isLoading=!1}))}))}setUpGames(n){const a=this.shuffle(n).slice(0,40);return a.concat(a)}selectRandomGame(){const n=this.gamesToShow.length/2;this.selectedGameIndex=Math.floor(Math.random()*(n-3)),this.selectedGameIndex+=n,this.selectedGameEl=this.gameContainer.children[this.selectedGameIndex]}playRandomGame(){this.animateGames(),"function"==typeof gtag&&gtag("event","PlayRandomGame",{context:"CasinoPlayRandomGame"})}respin(){this.animateGames(),"function"==typeof gtag&&gtag("event","RespinRandomGame",{context:"CasinoPlayRandomGame"})}animateGames(){this.iconVisibility="true"===this.iconVisibleOnAnim,this.animationStarted=!0,this.animationDone=!1,this.animation&&this.animation.cancel(),this.selectedGameEl&&(this.selectedGameEl.classList.remove("TheRandomGame"),this.selectedGame=null,this.selectedGameIndex=null),this.selectRandomGame();const n=window.getComputedStyle(this.gameContainer).getPropertyValue("gap"),a=parseInt(n,10),e=this.selectedGameEl.offsetWidth;this.animation=this.gameContainer.animate([{transform:"translateX(0px)",scale:1},{scale:.75},{transform:`translateX(-${(e+a)*this.selectedGameIndex+e/2-this.gameContainer.offsetWidth/2}px)`,scale:1}],{duration:3e3,easing:"cubic-bezier(0.5, 0, 0.5, 1.2)",fill:"forwards"}),this.animation.onfinish=()=>{this.animationDone=!0,this.selectedGameEl.classList.add("TheRandomGame"),this.selectedGame=this.gamesToShow[this.selectedGameIndex]}}playGame(){this.selectedGame&&(window.postMessage({type:"PlayRandomGame",gameId:this.selectedGame.id,launchUrl:this.selectedGame.launchUrl,gameName:this.selectedGame.name,subVendor:this.selectedGame.subVendor},window.location.href),"function"==typeof gtag&&gtag("event","OpenRandomGame",{context:"CasinoPlayRandomGame"}))}showGameInfo(){window.postMessage({type:"InfoRandomGame",gameId:this.selectedGame.id,launchUrl:this.selectedGame.launchUrl,gameName:this.selectedGame.name,subVendor:this.selectedGame.subVendor},window.location.href),"function"==typeof gtag&&gtag("event","OpenRandomGameInfo",{context:"CasinoPlayRandomGame"})}renderGameDetails(){return a("div",{class:"RandomButtonsWrapper"},a("div",{class:"RandomGameDetails"},a("span",{class:"RandomGameTitle"},this.selectedGame.name),a("span",{class:"RandomGameInfo",onClick:()=>this.showGameInfo()},"i")),a("div",{class:"RandomButtons"},a("button",{class:"RandomButton On",onClick:()=>this.respin()},i("spinRandomGame")),!this.launchByGameCard&&a("button",{class:"RandomButton On",onClick:()=>this.playGame()},i("playNowRandomGame"))))}render(){return this.hasErrors?a("div",{class:"RandomGameError"},a("div",{class:"Title"},i("error",this.language))):this.isLoading?void 0:a("div",{class:"RandomGameWrapper"},a("div",{class:"GameContainerGradient"}),a("div",{class:"GamesContainer",ref:n=>this.gameContainer=n},this.gamesToShow&&this.gamesToShow.map(((n,e)=>a("div",{class:"RandomGameCard",key:e,onClick:"true"===this.launchByGameCard?()=>this.playGame():null},a("div",{class:"RandomGameVendor"},n.vendor.name),a("img",{class:"RandomGameImage",src:n.thumbnail,alt:n.name,title:n.name}),this.selectedGame&&this.selectedGameIndex===e&&this.renderGameDetails())))),a("div",{class:"ButtonWrapper "+(this.animationDone?"HideAnimation":"")},a("div",{class:"ButtonContainer"},this.iconVisibility&&a("div",{class:"ButtonIcon "+(this.animationStarted?"Flip":"")},a("div",{class:"QustionMark "+(this.animationStarted?"Flip":"")},"?"),a("div",{class:"HexagonMark"},a("div",{class:"HexagonMarkBorder"}))),!this.animationStarted&&a("div",{class:"RandomButton "+(this.animationStarted?"HideAnimation":""),onClick:()=>this.playRandomGame()},i("playRandomGame")))))}get host(){return e(this)}static get watchers(){return{endpoint:["watchEndpoint"],datasource:["watchEndpoint"],language:["watchEndpoint"],translationUrl:["handleNewTranslations"]}}};r.style=":host {\n display: block;\n font-family: inherit;\n}\n\n.RandomGameWrapper {\n width: 100%;\n overflow: hidden;\n background: transparent;\n position: relative;\n}\n\n.GameContainerGradient {\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100%;\n background: linear-gradient(90deg, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 0%, rgba(7, 7, 42, 0.5) 25%, rgba(7, 7, 42, 0) 50%, rgba(7, 7, 42, 0.5) 75%, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 100%);\n pointer-events: none;\n z-index: 1;\n}\n\n.GamesContainer {\n display: flex;\n height: 330px;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: flex-start;\n align-items: center;\n align-content: flex-start;\n gap: 20px;\n}\n\n.RandomGameCard {\n position: relative;\n width: 256px;\n height: 170px;\n border-radius: 5px;\n filter: blur(5px);\n}\n.RandomGameCard .RandomGameVendor {\n position: absolute;\n font-size: 12px;\n bottom: 10px;\n left: 10px;\n color: var(--emfe-w-color-white, #FFFFFF);\n}\n\n.TheRandomGame {\n animation-name: ZoomFadeIn;\n animation-duration: 0.5s;\n animation-fill-mode: forwards;\n -webkit-animation-name: ZoomFadeIn;\n -webkit-animation-duration: 0.5s;\n -webkit-animation-fill-mode: forwards;\n opacity: 1;\n cursor: pointer;\n filter: blur(0);\n}\n\n.RandomGameImage {\n width: 256px;\n height: 170px;\n}\n\n.RandomGameDetails {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n color: var(--emfe-w-casino-typography, var(--emfe-w-color-white, #FFFFFF));\n font-size: 14px;\n width: 100%;\n}\n.RandomGameDetails .RandomGameTitle {\n line-height: 18px;\n}\n.RandomGameDetails .RandomGameInfo {\n border-radius: 50%;\n width: 16px;\n height: 16px;\n font-size: 12px;\n font-weight: 400;\n border: solid 1px var(--emfe-w-casino-typography, var(--emfe-w-color-white, #FFFFFF));\n text-align: center;\n margin: 4px 0;\n line-height: 14px;\n cursor: pointer;\n}\n.RandomGameDetails .RandomGamePlay {\n background: var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n border: none;\n border-radius: 5px;\n width: 200px;\n height: 40px;\n font-size: 14px;\n cursor: pointer;\n}\n\n.ButtonWrapper {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.ButtonContainer {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 10px;\n width: 100%;\n}\n\n.ButtonIcon {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 5px;\n}\n\n.QustionMark {\n position: relative;\n font-size: 80px;\n font-weight: 700;\n color: var(--emfe-w-color-white, #FFFFFF);\n z-index: 5;\n bottom: 20px;\n text-shadow: 0px 4px 0px var(--emfe-w-color-black, #000000);\n}\n\n.HexagonMark {\n position: absolute;\n width: 70px;\n height: 85px;\n background: linear-gradient(90deg, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)) 0%, var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)) 100%);\n clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0% 70%, 0% 30%);\n}\n\n.HexagonMarkBorder {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n top: 5px;\n left: 5px;\n width: 60px;\n height: 75px;\n background: linear-gradient(180deg, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)) 0%, var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)) 100%);\n clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0% 70%, 0% 30%);\n}\n\n.RandomButtons {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: 5px;\n width: 100%;\n}\n\n.RandomButton {\n font-size: 18px;\n text-transform: uppercase;\n width: max-content;\n border-radius: 5px;\n padding: 5px 25px;\n border: solid 3px var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n opacity: 1;\n text-shadow: 1px 1px 2px var(--emfe-w-color-black, #000000);\n animation: ButtonEffect 3s linear infinite;\n background-image: linear-gradient(to right, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)), var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)), var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)));\n background-size: 300% 100%;\n cursor: pointer;\n}\n.RandomButton:hover {\n opacity: 0.8;\n}\n\n.HideAnimation {\n filter: blur(5px);\n animation: AnimateButton 0.2s forwards;\n}\n\n.Flip {\n animation-name: Flip, Blur;\n animation-duration: 0.75s, 3s;\n animation-iteration-count: infinite, 1;\n -webkit-animation-name: Flip, Blur;\n -webkit-animation-duration: 0.75s, 3s;\n -webkit-animation-iteration-count: infinite, 1;\n}\n\n@keyframes ButtonEffect {\n 0% {\n background-position: 0% 50%;\n }\n 33% {\n background-position: 100% 50%;\n }\n 66% {\n background-position: 200% 50%;\n }\n 100% {\n background-position: 300% 50%;\n }\n}\n@keyframes ZoomFadeIn {\n 0% {\n transform: scale(0.2) translateY(0);\n filter: blur(5px);\n opacity: 0.3;\n }\n 50% {\n transform: scale(1.1) translateY(-30px);\n filter: blur(2px);\n opacity: 0.7;\n }\n 100% {\n transform: scale(1) translateY(-30px);\n filter: blur(0px);\n opacity: 1;\n }\n}\n@keyframes AnimateButton {\n 0% {\n opacity: 0.7;\n }\n 50% {\n opacity: 0.4;\n }\n 100% {\n opacity: 0;\n display: none;\n }\n}\n@keyframes Flip {\n 0% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n 100% {\n transform: rotateY(360deg);\n }\n}\n@keyframes Blur {\n 0% {\n filter: blur(0);\n }\n 50% {\n filter: blur(1px);\n }\n 100% {\n filter: blur(3px);\n }\n}\n@container (max-width: 475px) {\n .GameContainerGradient {\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100%;\n background: linear-gradient(90deg, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 0%, rgba(7, 7, 42, 0.2) 25%, rgba(7, 7, 42, 0) 50%, rgba(7, 7, 42, 0.2) 75%, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 100%);\n pointer-events: none;\n z-index: 1;\n }\n\n .RandomGameCard {\n width: 102px;\n height: 146px;\n border-radius: 5px;\n filter: blur(5px);\n }\n\n .RandomGameImage {\n width: 102px;\n height: 146px;\n }\n\n .RandomGameDetails {\n font-size: 14px;\n width: 100%;\n }\n .RandomGameDetails .RandomGameTitle {\n line-height: 18px;\n width: 75%;\n }\n .RandomGameDetails .RandomGameInfo {\n border-radius: 50%;\n width: 16px;\n height: 16px;\n font-size: 12px;\n line-height: 14px;\n }\n .RandomGameDetails .RandomGamePlay {\n background: var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n border: none;\n border-radius: 5px;\n width: 200px;\n height: 40px;\n font-size: 14px;\n cursor: pointer;\n }\n\n .RandomGameCard .RandomGameVendor {\n font-size: 12px;\n bottom: 5px;\n right: 5px;\n }\n\n .RandomButtons {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 5px;\n width: 100%;\n }\n\n .RandomButton {\n font-size: 18px;\n text-transform: uppercase;\n width: max-content;\n border-radius: 5px;\n padding: 5px 25px;\n border: solid 3px var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n opacity: 1;\n text-shadow: 1px 1px 2px var(--emfe-w-color-black, #000000);\n animation: ButtonEffect 3s linear infinite;\n background-image: linear-gradient(to right, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)), var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)), var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)));\n background-size: 300% 100%;\n cursor: pointer;\n }\n .RandomButton:hover {\n opacity: 0.8;\n }\n}";export{r as casino_play_random_game}
@@ -0,0 +1,344 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-8944e204.js');
6
+
7
+ const getDevice = () => {
8
+ let userAgent = window.navigator.userAgent;
9
+ if (userAgent.toLowerCase().match(/android/i)) {
10
+ return 'Android';
11
+ }
12
+ if (userAgent.toLowerCase().match(/iphone/i)) {
13
+ return 'iPhone';
14
+ }
15
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
16
+ return 'iPad';
17
+ }
18
+ return 'PC';
19
+ };
20
+ const getDevicePlatform = () => {
21
+ const device = getDevice();
22
+ if (device) {
23
+ if (device === 'PC') {
24
+ return 'dk';
25
+ }
26
+ else if (device === 'iPad' || device === 'iPhone') {
27
+ return 'mtWeb';
28
+ }
29
+ else {
30
+ return 'mtWeb';
31
+ }
32
+ }
33
+ };
34
+
35
+ const DEFAULT_LANGUAGE = 'en';
36
+ const TRANSLATIONS = {
37
+ en: {
38
+ error: 'Error',
39
+ randomGameLoading: 'Loading ...',
40
+ playRandomGame: 'Play a random game',
41
+ playNowRandomGame: 'Play now',
42
+ spinRandomGame: 'Spin'
43
+ },
44
+ ro: {
45
+ error: 'Eroare',
46
+ playRandomGame: 'Play a random game',
47
+ playNowRandomGame: 'Play now',
48
+ spinRandomGame: 'Spin'
49
+ },
50
+ fr: {
51
+ error: 'Error',
52
+ playRandomGame: 'Play a random game',
53
+ playNowRandomGame: 'Play now',
54
+ spinRandomGame: 'Spin'
55
+ },
56
+ hr: {
57
+ error: 'Greška',
58
+ playRandomGame: 'Play a random game',
59
+ playNowRandomGame: 'Play now',
60
+ spinRandomGame: 'Spin'
61
+ },
62
+ hu: {
63
+ error: 'Greška',
64
+ playRandomGame: 'Play a random game',
65
+ playNowRandomGame: 'Play now',
66
+ spinRandomGame: 'Spin'
67
+ }
68
+ };
69
+ const getTranslations = (url) => {
70
+ // fetch url, get the data, replace the TRANSLATIONS content
71
+ return new Promise((resolve) => {
72
+ fetch(url)
73
+ .then((res) => res.json())
74
+ .then((data) => {
75
+ Object.keys(data).forEach((item) => {
76
+ for (let key in data[item]) {
77
+ TRANSLATIONS[item][key] = data[item][key];
78
+ }
79
+ });
80
+ resolve(true);
81
+ });
82
+ });
83
+ };
84
+ const translate = (key, customLang, values) => {
85
+ const lang = customLang;
86
+ let translation = TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
87
+ if (values !== undefined) {
88
+ for (const [key, value] of Object.entries(values.values)) {
89
+ const regex = new RegExp(`{${key}}`, 'g');
90
+ translation = translation.replace(regex, value);
91
+ }
92
+ }
93
+ return translation;
94
+ };
95
+
96
+ const casinoPlayRandomGameCss = ":host {\n display: block;\n font-family: inherit;\n}\n\n.RandomGameWrapper {\n width: 100%;\n overflow: hidden;\n background: transparent;\n position: relative;\n}\n\n.GameContainerGradient {\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100%;\n background: linear-gradient(90deg, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 0%, rgba(7, 7, 42, 0.5) 25%, rgba(7, 7, 42, 0) 50%, rgba(7, 7, 42, 0.5) 75%, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 100%);\n pointer-events: none;\n z-index: 1;\n}\n\n.GamesContainer {\n display: flex;\n height: 330px;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: flex-start;\n align-items: center;\n align-content: flex-start;\n gap: 20px;\n}\n\n.RandomGameCard {\n position: relative;\n width: 256px;\n height: 170px;\n border-radius: 5px;\n filter: blur(5px);\n}\n.RandomGameCard .RandomGameVendor {\n position: absolute;\n font-size: 12px;\n bottom: 10px;\n left: 10px;\n color: var(--emfe-w-color-white, #FFFFFF);\n}\n\n.TheRandomGame {\n animation-name: ZoomFadeIn;\n animation-duration: 0.5s;\n animation-fill-mode: forwards;\n -webkit-animation-name: ZoomFadeIn;\n -webkit-animation-duration: 0.5s;\n -webkit-animation-fill-mode: forwards;\n opacity: 1;\n cursor: pointer;\n filter: blur(0);\n}\n\n.RandomGameImage {\n width: 256px;\n height: 170px;\n}\n\n.RandomGameDetails {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n color: var(--emfe-w-casino-typography, var(--emfe-w-color-white, #FFFFFF));\n font-size: 14px;\n width: 100%;\n}\n.RandomGameDetails .RandomGameTitle {\n line-height: 18px;\n}\n.RandomGameDetails .RandomGameInfo {\n border-radius: 50%;\n width: 16px;\n height: 16px;\n font-size: 12px;\n font-weight: 400;\n border: solid 1px var(--emfe-w-casino-typography, var(--emfe-w-color-white, #FFFFFF));\n text-align: center;\n margin: 4px 0;\n line-height: 14px;\n cursor: pointer;\n}\n.RandomGameDetails .RandomGamePlay {\n background: var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n border: none;\n border-radius: 5px;\n width: 200px;\n height: 40px;\n font-size: 14px;\n cursor: pointer;\n}\n\n.ButtonWrapper {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.ButtonContainer {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 10px;\n width: 100%;\n}\n\n.ButtonIcon {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 5px;\n}\n\n.QustionMark {\n position: relative;\n font-size: 80px;\n font-weight: 700;\n color: var(--emfe-w-color-white, #FFFFFF);\n z-index: 5;\n bottom: 20px;\n text-shadow: 0px 4px 0px var(--emfe-w-color-black, #000000);\n}\n\n.HexagonMark {\n position: absolute;\n width: 70px;\n height: 85px;\n background: linear-gradient(90deg, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)) 0%, var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)) 100%);\n clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0% 70%, 0% 30%);\n}\n\n.HexagonMarkBorder {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n top: 5px;\n left: 5px;\n width: 60px;\n height: 75px;\n background: linear-gradient(180deg, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)) 0%, var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)) 100%);\n clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0% 70%, 0% 30%);\n}\n\n.RandomButtons {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: 5px;\n width: 100%;\n}\n\n.RandomButton {\n font-size: 18px;\n text-transform: uppercase;\n width: max-content;\n border-radius: 5px;\n padding: 5px 25px;\n border: solid 3px var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n opacity: 1;\n text-shadow: 1px 1px 2px var(--emfe-w-color-black, #000000);\n animation: ButtonEffect 3s linear infinite;\n background-image: linear-gradient(to right, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)), var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)), var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)));\n background-size: 300% 100%;\n cursor: pointer;\n}\n.RandomButton:hover {\n opacity: 0.8;\n}\n\n.HideAnimation {\n filter: blur(5px);\n animation: AnimateButton 0.2s forwards;\n}\n\n.Flip {\n animation-name: Flip, Blur;\n animation-duration: 0.75s, 3s;\n animation-iteration-count: infinite, 1;\n -webkit-animation-name: Flip, Blur;\n -webkit-animation-duration: 0.75s, 3s;\n -webkit-animation-iteration-count: infinite, 1;\n}\n\n@keyframes ButtonEffect {\n 0% {\n background-position: 0% 50%;\n }\n 33% {\n background-position: 100% 50%;\n }\n 66% {\n background-position: 200% 50%;\n }\n 100% {\n background-position: 300% 50%;\n }\n}\n@keyframes ZoomFadeIn {\n 0% {\n transform: scale(0.2) translateY(0);\n filter: blur(5px);\n opacity: 0.3;\n }\n 50% {\n transform: scale(1.1) translateY(-30px);\n filter: blur(2px);\n opacity: 0.7;\n }\n 100% {\n transform: scale(1) translateY(-30px);\n filter: blur(0px);\n opacity: 1;\n }\n}\n@keyframes AnimateButton {\n 0% {\n opacity: 0.7;\n }\n 50% {\n opacity: 0.4;\n }\n 100% {\n opacity: 0;\n display: none;\n }\n}\n@keyframes Flip {\n 0% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n 100% {\n transform: rotateY(360deg);\n }\n}\n@keyframes Blur {\n 0% {\n filter: blur(0);\n }\n 50% {\n filter: blur(1px);\n }\n 100% {\n filter: blur(3px);\n }\n}\n@container (max-width: 475px) {\n .GameContainerGradient {\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100%;\n background: linear-gradient(90deg, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 0%, rgba(7, 7, 42, 0.2) 25%, rgba(7, 7, 42, 0) 50%, rgba(7, 7, 42, 0.2) 75%, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 100%);\n pointer-events: none;\n z-index: 1;\n }\n\n .RandomGameCard {\n width: 102px;\n height: 146px;\n border-radius: 5px;\n filter: blur(5px);\n }\n\n .RandomGameImage {\n width: 102px;\n height: 146px;\n }\n\n .RandomGameDetails {\n font-size: 14px;\n width: 100%;\n }\n .RandomGameDetails .RandomGameTitle {\n line-height: 18px;\n width: 75%;\n }\n .RandomGameDetails .RandomGameInfo {\n border-radius: 50%;\n width: 16px;\n height: 16px;\n font-size: 12px;\n line-height: 14px;\n }\n .RandomGameDetails .RandomGamePlay {\n background: var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n border: none;\n border-radius: 5px;\n width: 200px;\n height: 40px;\n font-size: 14px;\n cursor: pointer;\n }\n\n .RandomGameCard .RandomGameVendor {\n font-size: 12px;\n bottom: 5px;\n right: 5px;\n }\n\n .RandomButtons {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 5px;\n width: 100%;\n }\n\n .RandomButton {\n font-size: 18px;\n text-transform: uppercase;\n width: max-content;\n border-radius: 5px;\n padding: 5px 25px;\n border: solid 3px var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n opacity: 1;\n text-shadow: 1px 1px 2px var(--emfe-w-color-black, #000000);\n animation: ButtonEffect 3s linear infinite;\n background-image: linear-gradient(to right, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)), var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)), var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)));\n background-size: 300% 100%;\n cursor: pointer;\n }\n .RandomButton:hover {\n opacity: 0.8;\n }\n}";
97
+
98
+ const CasinoPlayRandomGame = class {
99
+ constructor(hostRef) {
100
+ index.registerInstance(this, hostRef);
101
+ /**
102
+ * Language of the widget
103
+ */
104
+ this.language = 'en';
105
+ /**
106
+ * Configure a specific category for randomising the games.
107
+ */
108
+ this.specificCategory = '';
109
+ /**
110
+ * Icon visible initially
111
+ */
112
+ this.iconVisible = '';
113
+ /**
114
+ * Icon visible while rolling
115
+ */
116
+ this.iconVisibleOnAnim = '';
117
+ /**
118
+ * Open event on the game card.
119
+ */
120
+ this.launchByGameCard = '';
121
+ /**
122
+ * Client custom styling via string
123
+ */
124
+ this.clientStyling = '';
125
+ /**
126
+ * Client custom styling via url
127
+ */
128
+ this.clientStylingUrl = '';
129
+ /**
130
+ * Translations via URL
131
+ */
132
+ this.translationUrl = '';
133
+ this.hasErrors = false;
134
+ this.limitStylingAppends = false;
135
+ this.isLoading = true;
136
+ this.selectedGame = null;
137
+ this.animationDone = false;
138
+ this.animationStarted = false;
139
+ this.animation = null;
140
+ this.selectedGameIndex = null;
141
+ this.selectedGameEl = null;
142
+ this.iconVisibility = null;
143
+ this.shuffle = (array) => {
144
+ let currentIndex = array.length;
145
+ let randomIndex;
146
+ while (currentIndex !== 0) {
147
+ randomIndex = Math.floor(Math.random() * currentIndex);
148
+ currentIndex--;
149
+ [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
150
+ }
151
+ return array;
152
+ };
153
+ this.setClientStyling = () => {
154
+ let sheet = document.createElement('style');
155
+ sheet.innerHTML = this.clientStyling;
156
+ this.host.shadowRoot.prepend(sheet);
157
+ };
158
+ this.setClientStylingURL = () => {
159
+ let url = new URL(this.clientStylingUrl);
160
+ let cssFile = document.createElement('style');
161
+ fetch(url.href)
162
+ .then((res) => res.text())
163
+ .then((data) => {
164
+ cssFile.innerHTML = data;
165
+ this.clientStyling = data;
166
+ setTimeout(() => { this.host.shadowRoot.prepend(cssFile); }, 1);
167
+ });
168
+ };
169
+ }
170
+ watchEndpoint(newValue, oldValue) {
171
+ if (newValue && newValue != oldValue && this.endpoint) {
172
+ this.fetchGameList();
173
+ }
174
+ }
175
+ handleNewTranslations() {
176
+ this.isLoading = true;
177
+ getTranslations(this.translationUrl).then(() => {
178
+ this.isLoading = false;
179
+ });
180
+ }
181
+ connectedCallback() {
182
+ this.iconVisibility = this.iconVisible === 'true' ? true : false;
183
+ }
184
+ componentWillLoad() {
185
+ if (this.translationUrl.length > 2) {
186
+ getTranslations(this.translationUrl);
187
+ }
188
+ if (this.endpoint && this.language && this.datasource) {
189
+ return this.fetchGameList();
190
+ }
191
+ }
192
+ componentDidLoad() {
193
+ if (!this.limitStylingAppends && this.host) {
194
+ if (this.clientStyling)
195
+ this.setClientStyling();
196
+ if (this.clientStylingUrl)
197
+ this.setClientStylingURL();
198
+ this.limitStylingAppends = true;
199
+ }
200
+ }
201
+ fetchGameList() {
202
+ let url = new URL(`${this.endpoint}/v1/casino/games`);
203
+ url.searchParams.append('device', getDevicePlatform());
204
+ url.searchParams.append('datasource', this.datasource);
205
+ url.searchParams.append('fields', 'gId,id,href,thumbnail,name,vendor,launchUrl,subVendor');
206
+ url.searchParams.append('expand', 'vendor');
207
+ // Number of games chosen
208
+ url.searchParams.append('pagination', 'offset=0,limit=423');
209
+ url.searchParams.append('language', this.language);
210
+ if (this.specificCategory) {
211
+ url.searchParams.append('filter', `categories(id=${this.specificCategory})`);
212
+ }
213
+ return new Promise((resolve, reject) => {
214
+ this.isLoading = true;
215
+ fetch(url.href)
216
+ .then((res) => res.json())
217
+ .then((data) => {
218
+ this.gamesToShow = this.setUpGames(data === null || data === void 0 ? void 0 : data.items);
219
+ resolve(true);
220
+ }).catch((err) => {
221
+ console.error(err);
222
+ this.hasErrors = true;
223
+ reject(err);
224
+ }).finally(() => {
225
+ this.isLoading = false;
226
+ });
227
+ });
228
+ }
229
+ setUpGames(games) {
230
+ // Only 40 games will be selected at a time; the random game will be selected from these.
231
+ const shuffledGames = this.shuffle(games).slice(0, 40);
232
+ // Clone the games
233
+ return shuffledGames.concat(shuffledGames);
234
+ }
235
+ selectRandomGame() {
236
+ const originalGamesLength = this.gamesToShow.length / 2;
237
+ // Substract 3 to ensure there are always at least 5 cards after the selected one
238
+ this.selectedGameIndex = Math.floor(Math.random() * (originalGamesLength - 3));
239
+ // Offset by the length of the original to select from the cloned part
240
+ this.selectedGameIndex += originalGamesLength;
241
+ this.selectedGameEl = this.gameContainer.children[this.selectedGameIndex];
242
+ }
243
+ playRandomGame() {
244
+ this.animateGames();
245
+ //@ts-ignore
246
+ if (typeof gtag == 'function') {
247
+ //@ts-ignore
248
+ gtag('event', 'PlayRandomGame', {
249
+ 'context': 'CasinoPlayRandomGame'
250
+ });
251
+ }
252
+ }
253
+ respin() {
254
+ this.animateGames();
255
+ //@ts-ignore
256
+ if (typeof gtag == 'function') {
257
+ //@ts-ignore
258
+ gtag('event', 'RespinRandomGame', {
259
+ 'context': 'CasinoPlayRandomGame'
260
+ });
261
+ }
262
+ }
263
+ animateGames() {
264
+ this.iconVisibility = this.iconVisibleOnAnim === 'true' ? true : false;
265
+ this.animationStarted = true;
266
+ this.animationDone = false;
267
+ if (this.animation)
268
+ this.animation.cancel();
269
+ if (this.selectedGameEl) {
270
+ this.selectedGameEl.classList.remove('TheRandomGame');
271
+ this.selectedGame = null;
272
+ this.selectedGameIndex = null;
273
+ }
274
+ this.selectRandomGame();
275
+ const gapStyle = window.getComputedStyle(this.gameContainer).getPropertyValue('gap');
276
+ const gap = parseInt(gapStyle, 10);
277
+ const cardWidth = this.selectedGameEl.offsetWidth;
278
+ const gameContainerWidth = this.gameContainer.offsetWidth;
279
+ const translation = ((cardWidth + gap) * this.selectedGameIndex) + // Width of game cards up to the selected
280
+ (cardWidth / 2) - // Additional half card width to center to the selected game
281
+ (gameContainerWidth / 2); // Minus half the container width to center the card
282
+ const containerRolling = [
283
+ { transform: `translateX(0px)`, scale: 1 },
284
+ { scale: 0.75 },
285
+ { transform: `translateX(-${translation}px)`, scale: 1 }
286
+ ];
287
+ const containerTiming = {
288
+ duration: 3000,
289
+ easing: 'cubic-bezier(0.5, 0, 0.5, 1.2)',
290
+ fill: 'forwards'
291
+ };
292
+ this.animation = this.gameContainer.animate(containerRolling, containerTiming);
293
+ this.animation.onfinish = () => {
294
+ this.animationDone = true;
295
+ this.selectedGameEl.classList.add('TheRandomGame');
296
+ this.selectedGame = this.gamesToShow[this.selectedGameIndex];
297
+ };
298
+ }
299
+ playGame() {
300
+ if (!this.selectedGame)
301
+ return;
302
+ window.postMessage({ type: 'PlayRandomGame', gameId: this.selectedGame.id, launchUrl: this.selectedGame.launchUrl, gameName: this.selectedGame.name, subVendor: this.selectedGame.subVendor }, window.location.href);
303
+ //@ts-ignore
304
+ if (typeof gtag == 'function') {
305
+ //@ts-ignore
306
+ gtag('event', 'OpenRandomGame', {
307
+ 'context': 'CasinoPlayRandomGame'
308
+ });
309
+ }
310
+ }
311
+ ;
312
+ showGameInfo() {
313
+ window.postMessage({ type: 'InfoRandomGame', gameId: this.selectedGame.id, launchUrl: this.selectedGame.launchUrl, gameName: this.selectedGame.name, subVendor: this.selectedGame.subVendor }, window.location.href);
314
+ //@ts-ignore
315
+ if (typeof gtag == 'function') {
316
+ //@ts-ignore
317
+ gtag('event', 'OpenRandomGameInfo', {
318
+ 'context': 'CasinoPlayRandomGame'
319
+ });
320
+ }
321
+ }
322
+ renderGameDetails() {
323
+ return index.h("div", { class: "RandomButtonsWrapper" }, index.h("div", { class: "RandomGameDetails" }, index.h("span", { class: "RandomGameTitle" }, this.selectedGame.name), index.h("span", { class: "RandomGameInfo", onClick: () => this.showGameInfo() }, "i")), index.h("div", { class: "RandomButtons" }, index.h("button", { class: "RandomButton On", onClick: () => this.respin() }, translate('spinRandomGame')), !this.launchByGameCard &&
324
+ index.h("button", { class: "RandomButton On", onClick: () => this.playGame() }, translate('playNowRandomGame'))));
325
+ }
326
+ render() {
327
+ if (this.hasErrors) {
328
+ return (index.h("div", { class: "RandomGameError" }, index.h("div", { class: "Title" }, translate('error', this.language))));
329
+ }
330
+ if (!this.isLoading) {
331
+ return index.h("div", { class: "RandomGameWrapper" }, index.h("div", { class: 'GameContainerGradient' }), index.h("div", { class: 'GamesContainer', ref: (el) => this.gameContainer = el }, this.gamesToShow && this.gamesToShow.map((game, index$1) => (index.h("div", { class: 'RandomGameCard', key: index$1, onClick: this.launchByGameCard === 'true' ? () => this.playGame() : null }, index.h("div", { class: "RandomGameVendor" }, game.vendor.name), index.h("img", { class: 'RandomGameImage', src: game.thumbnail, alt: game.name, title: game.name }), this.selectedGame && this.selectedGameIndex === index$1 && this.renderGameDetails())))), index.h("div", { class: `ButtonWrapper ${this.animationDone ? 'HideAnimation' : ''}` }, index.h("div", { class: "ButtonContainer" }, this.iconVisibility && index.h("div", { class: `ButtonIcon ${this.animationStarted ? 'Flip' : ''}` }, index.h("div", { class: `QustionMark ${this.animationStarted ? 'Flip' : ''}` }, "?"), index.h("div", { class: "HexagonMark" }, index.h("div", { class: "HexagonMarkBorder" }))), !this.animationStarted && index.h("div", { class: `RandomButton ${this.animationStarted ? 'HideAnimation' : ''}`, onClick: () => this.playRandomGame() }, translate('playRandomGame')))));
332
+ }
333
+ }
334
+ get host() { return index.getElement(this); }
335
+ static get watchers() { return {
336
+ "endpoint": ["watchEndpoint"],
337
+ "datasource": ["watchEndpoint"],
338
+ "language": ["watchEndpoint"],
339
+ "translationUrl": ["handleNewTranslations"]
340
+ }; }
341
+ };
342
+ CasinoPlayRandomGame.style = casinoPlayRandomGameCss;
343
+
344
+ exports.casino_play_random_game = CasinoPlayRandomGame;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-8944e204.js');
4
+
5
+ /*
6
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ const patchBrowser = () => {
9
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('casino-play-random-game.cjs.js', document.baseURI).href));
10
+ const opts = {};
11
+ if (importMeta !== '') {
12
+ opts.resourcesUrl = new URL('.', importMeta).href;
13
+ }
14
+ return index.promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(options => {
18
+ return index.bootstrapLazy([["casino-play-random-game.cjs",[[1,"casino-play-random-game",{"endpoint":[513],"datasource":[513],"language":[513],"specificCategory":[513,"specific-category"],"iconVisible":[513,"icon-visible"],"iconVisibleOnAnim":[513,"icon-visible-on-anim"],"launchByGameCard":[513,"launch-by-game-card"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"gamesToShow":[32],"selectedGame":[32],"animationDone":[32],"animationStarted":[32]}]]]], options);
19
+ });