@everymatrix/casino-tournament-duration 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/casino-tournament-duration/casino-tournament-duration.esm.js +1 -0
  2. package/dist/casino-tournament-duration/index.esm.js +0 -0
  3. package/dist/casino-tournament-duration/p-05f4af89.entry.js +1 -0
  4. package/dist/casino-tournament-duration/p-efeaf265.js +1 -0
  5. package/dist/cjs/casino-tournament-duration.cjs.entry.js +180 -0
  6. package/dist/cjs/casino-tournament-duration.cjs.js +19 -0
  7. package/dist/cjs/index-8e0377fe.js +1138 -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-tournament-duration/casino-tournament-duration.css +60 -0
  12. package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.js +228 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +80 -0
  15. package/dist/collection/utils/utils.js +3 -0
  16. package/dist/components/casino-tournament-duration.d.ts +11 -0
  17. package/dist/components/casino-tournament-duration.js +206 -0
  18. package/dist/components/index.d.ts +26 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/esm/casino-tournament-duration.entry.js +176 -0
  21. package/dist/esm/casino-tournament-duration.js +17 -0
  22. package/dist/esm/index-a10d1dd0.js +1113 -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-tournament-duration/.stencil/packages/casino-tournament-duration/stencil.config.d.ts +2 -0
  35. package/dist/types/components/casino-tournament-duration/casino-tournament-duration.d.ts +23 -0
  36. package/dist/types/components.d.ts +49 -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 +1 -0
  40. package/dist/types/utils/utils.d.ts +1 -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 t,b as n}from"./p-efeaf265.js";(()=>{const n=import.meta.url,a={};return""!==n&&(a.resourcesUrl=new URL(".",n).href),t(a)})().then((t=>n([["p-05f4af89",[[1,"casino-tournament-duration",{startDate:[1,"start-date"],endDate:[1,"end-date"],status:[1],language:[1],clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],tournamentUntilStartDays:[32],tournamentLeftDays:[32],showRemain:[32],limitStylingAppends:[32],stylingContainer:[32]}]]]],t)));
File without changes
@@ -0,0 +1 @@
1
+ import{r as t,h as s}from"./p-efeaf265.js";const i=["ro","en","zh-hk","fr","hu","tr","el","es","pt"],e={en:{finished:"Finished",starting:"Starting in ",left:"left",minutes:"minutes",hours:"hours",days:"days"},"zh-hk":{finished:"完成的",starting:"開始於",left:"剩下",minutes:"分鐘",hours:"小時",days:"天"},fr:{finished:"Fini",starting:"Début dans ",left:"restant",minutes:"minutes",hours:"heures",days:"jours"},ro:{finished:"Finalizat",starting:"Începe în",left:"rămase",minutes:"minute",hours:"ore",days:"zile"},tr:{finished:"Sona ermiş",starting:"Başlamasına ",left:"kaldı",minutes:"dakika",hours:"saat",days:"gün"},el:{finished:"Ολοκληρωμένα",starting:"Αρχίζει σε ",left:"απομένουν",minutes:"λεπτά",hours:"ώρες",days:"ημέρες"},es:{finished:"Finalizado",starting:"Iniciando en ",left:"izquierda",minutes:"minutos",hours:"horas",days:"días"},hu:{finished:"Befejezve",starting:"Kezdésig",left:"bal",minutes:"perc",hours:"óra",days:"nap"},pt:{finished:"Finalizado",starting:"Começando em",left:"Abandonou",minutes:"Minutos",hours:"Horas",days:"Dias"}},r=(t,s)=>{const r=s;return e[void 0!==r&&i.includes(r)?r:"en"][t]},n=class{constructor(s){t(this,s),this.clientStyling="",this.clientStylingUrl="",this.limitStylingAppends=!1,this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=document.createElement("style");setTimeout((()=>{t.innerHTML=this.clientStylingUrl,this.stylingContainer.prepend(t)}),1)}}getDateTimeDiff(t,s){return(new Date(s).getTime()-new Date(t).getTime())/6e4}getDuration(){const t=new Date;this.tournamentLeftDays=this.getDateTimeDiff(t,this.endDate),this.tournamentUntilStartDays=this.getDateTimeDiff(t,this.startDate),this.showRemain=this.getTextByDiff(this.tournamentLeftDays)}formatDate(t){let s=new Date(t),i=new Intl.DateTimeFormat(this.language,{month:"long"}).format(s);return`${s.getDate()} ${i}, ${s.toLocaleString("en-GB",{hour:"numeric",minute:"numeric"})}, ${s.getUTCFullYear()}`}getTextByDiff(t){if(t<1440){const s=t%60;return[t/60,s,60*(s-Math.floor(s))].map((t=>(t=>{const s=Math.floor(t);return s<10?`0${s}`:`${s}`})(t))).join(":")}return Math.ceil(t/1440)+" "+r("days")}getProgress(){if(this.tournamentLeftDays<=0)return 100;const t=this.getDateTimeDiff(this.startDate,this.endDate);return Math.floor(100/t*(t-this.tournamentLeftDays))}componentWillLoad(){this.startDate&&this.endDate&&(this.getDuration(),this.getTextByDiff(this.tournamentLeftDays))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){if(this.startDate&&this.endDate)return s("div",{ref:t=>this.stylingContainer=t},s("div",{class:"TournamentDuration"},s("div",{class:"TournamentDates"},s("div",{class:"StartDate",part:"StartDate"},this.formatDate(this.startDate)),s("div",{class:"EndDate",part:"EndDate"},this.formatDate(this.endDate))),s("div",{class:"ProgressBarWrapper"},s("div",{class:"ProgressBar",part:"ProgressBar"},"Finished"==this.status||"Closing"==this.status||"Closed"==this.status?s("div",null,s("div",{class:"ProgressBarFillEnd"}),s("div",{class:"Finished",part:"Finished"},r("finished",this.language))):this.tournamentUntilStartDays>0?s("div",null,s("div",{class:"ProgressBarFillStarting"}),s("div",{class:"Remaining",part:"Remaining"},r("starting",this.language)," ",this.getTextByDiff(this.tournamentUntilStartDays))):s("div",null,s("div",{class:"ProgressBarFill",part:"ProgressBarFill",style:{width:`${this.getProgress()}%`}}),this.tournamentLeftDays>0&&s("div",{class:"Remaining",part:"Remaining"},this.showRemain," ",r("left",this.language)))))))}};n.style=":host{display:block}.TournamentDates{display:flex;justify-content:space-between}.StartDate{font-size:10px;font-weight:700;color:var(--emfe-w-color-gray-300, #58586B)}.EndDate{font-size:10px;font-weight:700;align-content:flex-end;color:var(--emfe-w-color-gray-300, #58586B)}.ProgressBar{margin:5px 0;height:8px;background:var(--emfe-w-color-white, #FFFFFF)}.ProgressBarInactive{margin:5px 20px 10px 20px;height:8px;background:var(--emfe-w-color-gray-100, #E6E6E6)}.ProgressBarFill{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillEnd{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillStarting{background-color:var(--emfe-w-color-gray-300, #58586B);height:8px}.Remaining,.Finished{font-size:10px;font-weight:700;padding-top:6px;text-align:right;text-transform:uppercase}.Finished{color:var(--emfe-w-color-green, #48952a)}";export{n as casino_tournament_duration}
@@ -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)},r=e=>Promise.resolve(e),i=(()=>{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=!1,o=!1,r=[];const i=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!f(l))&&(l+=""),s&&o?r[r.length-1].i+=l:r.push(s?d(null,l):l),o=s)};if(i(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const c=d(e,null);return c.u=t,r.length>0&&(c.$=r),c},d=(e,t)=>({t:0,h:e,i:t,m:null,$:null,u:null}),h={},y=(e,t,n,l,s,o)=>{if(n!==l){let r=H(e,t);if(t.toLowerCase(),"class"===t){const t=e.classList,s=p(n),o=p(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("ref"===t)l&&l(e);else{const i=f(l);if((r||i&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&o||s)&&!i&&e.setAttribute(t,l=!0===l?"":l)}}},m=/\s/,p=e=>e?e.split(m):[],b=(e,t,n,l)=>{const s=11===t.m.nodeType&&t.m.host?t.m.host:t.m,o=e&&e.u||a,r=t.u||a;for(l in o)l in r||y(s,l,o[l],void 0,n,t.t);for(l in r)y(s,l,o[l],r[l],n,t.t)},w=(t,n,l)=>{let o,r,i=n.$[l],c=0;if(null!==i.i)o=i.m=s.createTextNode(i.i);else if(o=i.m=s.createElement(i.h),b(null,i,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),i.$)for(c=0;c<i.$.length;++c)r=w(t,i,c),r&&o.appendChild(r);return o},S=(e,n,l,s,o,r)=>{let i,c=e;for(c.shadowRoot&&c.tagName===t&&(c=c.shadowRoot);o<=r;++o)s[o]&&(i=w(null,l,o),i&&(s[o].m=i,c.insertBefore(i,n)))},g=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.m,v(l),s.remove())},j=(e,t)=>e.h===t.h,M=(e,t)=>{const n=t.m=e.m,l=e.$,s=t.$,o=t.i;null===o?(b(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,r=0,i=t.length-1,c=t[0],u=t[i],a=l.length-1,f=l[0],$=l[a];for(;o<=i&&r<=a;)null==c?c=t[++o]:null==u?u=t[--i]:null==f?f=l[++r]:null==$?$=l[--a]:j(c,f)?(M(c,f),c=t[++o],f=l[++r]):j(u,$)?(M(u,$),u=t[--i],$=l[--a]):j(c,$)?(M(c,$),e.insertBefore(c.m,u.m.nextSibling),c=t[++o],$=l[--a]):j(u,f)?(M(u,f),e.insertBefore(u.m,c.m),u=t[--i],f=l[++r]):(s=w(t&&t[r],n,r),f=l[++r],s&&c.m.parentNode.insertBefore(s,c.m));o>i?S(e,null==l[a+1]?null:l[a+1].m,n,l,r,a):r>a&&g(t,o,i)})(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)},k=(e,t)=>{t&&!e.p&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.p=t)))},C=(e,t)=>{if(e.t|=16,!(4&e.t))return k(e,e.S),Y((()=>O(e,t)));e.t|=512},O=(e,t)=>{const n=e.g;let l;return t&&(l=N(n,"componentWillLoad")),R(l,(()=>P(e,n,t)))},P=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.M,n=e.j,l=t.t,o=((e,t)=>{let n=u(t),l=B.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.j,o=n.v||d(null,null),r=(e=>e&&e.h===h)(l)?l:$(null,null,l);t=s.tagName,r.h=null,r.t|=4,n.v=r,r.m=o.m=s.shadowRoot||s,e=s["s-sc"],M(o,r)})(n,l)}catch(e){V(e,n.j)}return null},E=e=>{const t=e.j,n=e.S;N(e.g,"componentDidRender"),64&e.t||(e.t|=64,T(t),e.k(t),n||L()),e.p&&(e.p(),e.p=void 0),512&e.t&&X((()=>C(e,!1))),e.t&=-517},L=()=>{T(s.documentElement),X((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"casino-tournament-duration"}});return e.dispatchEvent(t),t})(l)))},N=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){V(e)}},R=(e,t)=>e&&e.then?e.then(t):t(),T=e=>e.classList.add("hydrated"),W=(e,t,n)=>{if(t.C){const l=Object.entries(t.C),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>q(this).O.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=q(e),o=s.O.get(t),r=s.t,i=s.g;n=((e,t)=>null==e||f(e)?e:1&t?e+"":e)(n,l.C[t][0]),8&r&&void 0!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.O.set(t,n),i&&2==(18&r)&&C(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},A=(e,t={})=>{const n=[],r=t.exclude||[],c=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),d=[];let h,y=!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],C:t[2],P:t[3]};l.C=t[2];const s=l.o,a=class extends HTMLElement{constructor(e){super(e),F(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),y?d.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=q(e),n=t.M,l=()=>{};if(!(1&t.t)){t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){k(t,t.S=n);break}}n.C&&Object.entries(n.C).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=z(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(W(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){V(e)}t.t&=-9,e()}if(s.style){let e=s.style;const t=u(n);if(!B.has(t)){const l=()=>{};((e,t,n)=>{let l=B.get(e);i&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,B.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.S,r=()=>C(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>{}))}componentOnReady(){return q(this).L}};l.N=e[0],r.includes(s)||c.get(s)||(n.push(s),c.define(s,W(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),y=!1,d.length?d.map((e=>e.connectedCallback())):o.jmp((()=>h=setTimeout(L,30)))},U=new WeakMap,q=e=>U.get(e),D=(e,t)=>U.set(t.g=e,t),F=(e,t)=>{const n={t:0,j:e,M:t,O:new Map};return n.L=new Promise((e=>n.k=e)),e["s-p"]=[],e["s-rc"]=[],U.set(e,n)},H=(e,t)=>t in e,V=(e,t)=>(0,console.error)(e,t),_=new Map,z=e=>{const t=e.o.replace(/-/g,"_"),n=e.N,l=_.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(_.set(n,e),e[t])),V)},B=new Map,G=[],I=[],J=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?X(Q):o.raf(Q))},K=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){V(e)}e.length=0},Q=()=>{K(G),K(I),(n=G.length>0)&&o.raf(Q)},X=e=>r().then(e),Y=J(I,!0);export{A as b,$ as h,r as p,D as r}
@@ -0,0 +1,180 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-8e0377fe.js');
6
+
7
+ const DEFAULT_LANGUAGE = 'en';
8
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'zh-hk', 'fr', 'hu', 'tr', 'el', 'es', 'pt'];
9
+ const TRANSLATIONS = {
10
+ en: {
11
+ finished: 'Finished',
12
+ starting: 'Starting in ',
13
+ left: 'left',
14
+ minutes: 'minutes',
15
+ hours: 'hours',
16
+ days: 'days',
17
+ },
18
+ 'zh-hk': {
19
+ finished: '完成的',
20
+ starting: '開始於',
21
+ left: '剩下',
22
+ minutes: '分鐘',
23
+ hours: '小時',
24
+ days: '天',
25
+ },
26
+ fr: {
27
+ finished: 'Fini',
28
+ starting: 'Début dans ',
29
+ left: 'restant',
30
+ minutes: 'minutes',
31
+ hours: 'heures',
32
+ days: 'jours',
33
+ },
34
+ ro: {
35
+ finished: 'Finalizat',
36
+ starting: 'Începe în',
37
+ left: 'rămase',
38
+ minutes: 'minute',
39
+ hours: 'ore',
40
+ days: 'zile',
41
+ },
42
+ tr: {
43
+ finished: 'Sona ermiş',
44
+ starting: 'Başlamasına ',
45
+ left: 'kaldı',
46
+ minutes: 'dakika',
47
+ hours: 'saat',
48
+ days: 'gün',
49
+ },
50
+ el: {
51
+ finished: 'Ολοκληρωμένα',
52
+ starting: 'Αρχίζει σε ',
53
+ left: 'απομένουν',
54
+ minutes: 'λεπτά',
55
+ hours: 'ώρες',
56
+ days: 'ημέρες',
57
+ },
58
+ es: {
59
+ finished: 'Finalizado',
60
+ starting: 'Iniciando en ',
61
+ left: 'izquierda',
62
+ minutes: 'minutos',
63
+ hours: 'horas',
64
+ days: 'días',
65
+ },
66
+ hu: {
67
+ finished: 'Befejezve',
68
+ starting: 'Kezdésig',
69
+ left: 'bal',
70
+ minutes: 'perc',
71
+ hours: 'óra',
72
+ days: 'nap',
73
+ },
74
+ pt: {
75
+ finished: 'Finalizado',
76
+ starting: 'Começando em',
77
+ left: 'Abandonou',
78
+ minutes: 'Minutos',
79
+ hours: 'Horas',
80
+ days: 'Dias',
81
+ }
82
+ };
83
+ const translate = (key, customLang) => {
84
+ const lang = customLang;
85
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
86
+ };
87
+
88
+ const casinoTournamentDurationCss = ":host{display:block}.TournamentDates{display:flex;justify-content:space-between}.StartDate{font-size:10px;font-weight:700;color:var(--emfe-w-color-gray-300, #58586B)}.EndDate{font-size:10px;font-weight:700;align-content:flex-end;color:var(--emfe-w-color-gray-300, #58586B)}.ProgressBar{margin:5px 0;height:8px;background:var(--emfe-w-color-white, #FFFFFF)}.ProgressBarInactive{margin:5px 20px 10px 20px;height:8px;background:var(--emfe-w-color-gray-100, #E6E6E6)}.ProgressBarFill{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillEnd{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillStarting{background-color:var(--emfe-w-color-gray-300, #58586B);height:8px}.Remaining,.Finished{font-size:10px;font-weight:700;padding-top:6px;text-align:right;text-transform:uppercase}.Finished{color:var(--emfe-w-color-green, #48952a)}";
89
+
90
+ const CasinoTournamentDuration = class {
91
+ constructor(hostRef) {
92
+ index.registerInstance(this, hostRef);
93
+ this.clientStyling = '';
94
+ this.clientStylingUrl = '';
95
+ this.limitStylingAppends = false;
96
+ this.setClientStyling = () => {
97
+ let sheet = document.createElement('style');
98
+ sheet.innerHTML = this.clientStyling;
99
+ this.stylingContainer.prepend(sheet);
100
+ };
101
+ this.setClientStylingURL = () => {
102
+ let cssFile = document.createElement('style');
103
+ setTimeout(() => {
104
+ cssFile.innerHTML = this.clientStylingUrl;
105
+ this.stylingContainer.prepend(cssFile);
106
+ }, 1);
107
+ };
108
+ }
109
+ getDateTimeDiff(dateString1, dateString2) {
110
+ return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
111
+ }
112
+ getDuration() {
113
+ const dateNow = new Date();
114
+ this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endDate);
115
+ this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startDate);
116
+ this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
117
+ }
118
+ formatDate(date) {
119
+ const dateOptions = { month: 'long' };
120
+ let currentDate = new Date(date);
121
+ let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
122
+ let currentDay = currentDate.getDate();
123
+ return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
124
+ }
125
+ getTextByDiff(diff) {
126
+ const renderText = (amount, type) => amount + ' ' + translate(type);
127
+ const renderTimeColumn = (column) => {
128
+ const columnInt = Math.floor(column);
129
+ if (columnInt < 10) {
130
+ return `0${columnInt}`;
131
+ }
132
+ else {
133
+ return `${columnInt}`;
134
+ }
135
+ };
136
+ if (diff < 1440) {
137
+ const hours = diff / 60;
138
+ const minutes = diff % 60;
139
+ const seconds = (minutes - Math.floor(minutes)) * 60;
140
+ return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
141
+ }
142
+ return renderText(Math.ceil(diff / (60 * 24)), 'days');
143
+ }
144
+ getProgress() {
145
+ if (this.tournamentLeftDays <= 0)
146
+ return 100;
147
+ const tournamentDuration = this.getDateTimeDiff(this.startDate, this.endDate);
148
+ const step = 100 / tournamentDuration;
149
+ const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
150
+ return width;
151
+ }
152
+ componentWillLoad() {
153
+ if (this.startDate && this.endDate) {
154
+ this.getDuration();
155
+ this.getTextByDiff(this.tournamentLeftDays);
156
+ }
157
+ }
158
+ componentDidRender() {
159
+ if (!this.limitStylingAppends && this.stylingContainer) {
160
+ if (this.clientStyling)
161
+ this.setClientStyling();
162
+ if (this.clientStylingUrl)
163
+ this.setClientStylingURL();
164
+ this.limitStylingAppends = true;
165
+ }
166
+ }
167
+ render() {
168
+ if (this.startDate && this.endDate) {
169
+ return index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "TournamentDuration" }, index.h("div", { class: "TournamentDates" }, index.h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startDate)), index.h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endDate))), index.h("div", { class: "ProgressBarWrapper" }, index.h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
170
+ index.h("div", null, index.h("div", { class: "ProgressBarFillEnd" }), index.h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
171
+ this.tournamentUntilStartDays > 0 ?
172
+ index.h("div", null, index.h("div", { class: "ProgressBarFillStarting" }), index.h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
173
+ index.h("div", null, index.h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
174
+ index.h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
175
+ }
176
+ }
177
+ };
178
+ CasinoTournamentDuration.style = casinoTournamentDurationCss;
179
+
180
+ exports.casino_tournament_duration = CasinoTournamentDuration;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-8e0377fe.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-tournament-duration.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-tournament-duration.cjs",[[1,"casino-tournament-duration",{"startDate":[1,"start-date"],"endDate":[1,"end-date"],"status":[1],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"tournamentUntilStartDays":[32],"tournamentLeftDays":[32],"showRemain":[32],"limitStylingAppends":[32],"stylingContainer":[32]}]]]], options);
19
+ });