"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[2215],{81359:(e,t,n)=>{n.d(t,{q:()=>C});var i=n(45992),r=n(37577),o=n(82068),s=n(17588);const a=e=>{const t=new Image;return t.src=e,t},c=(e,t)=>{try{if(Array.from(document.fonts).some((t=>t.family===e)))return;new FontFace(e,`url(${t})`).load().then((e=>{document.fonts.add(e)}))}catch(n){console.warn("Error preloading font",n)}},l="https://img.genially.com/60ef11e790ed4a0ff835b724/0ecdb3d6-1773-46ee-927b-362b2b911e74.gif";a(l);const u="Comfortaa";c(u,"https://fonts.gstatic.com/s/comfortaa/v47/1PtCg8LJRfWJmhDAuUsSQamb1W0lwk4S4WjMXL830efAesmwYSFoxBEP_I28dnyM.woff2");const d=r.Ay.div.attrs((e=>{let{$computedHeight:t}=e;return{style:{borderRadius:t/1.855+"px"}}}))((()=>({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"93%",height:"65%",background:"rgb(21, 53, 80)",display:"flex",flexDirection:"row",alignItems:"center"}))),m=r.Ay.img({marginLeft:"-7%",height:"157%"}),f=r.Ay.div.attrs((e=>{let{$parentHeight:t}=e;return{style:{fontSize:t/1.96+"px"}}}))((e=>{let{theme:t}=e;return{marginLeft:"-7%",color:"white",fontFamily:`'${u}', "Source Sans Pro", _fb_`,fontWeight:t.font.weight.bold}}));var h=n(79883);const g=e=>{const[t,n]=(0,s.useState)(0);return(0,s.useEffect)((()=>{if(!e.current)return;const t=new ResizeObserver((e=>{n(e[0].contentRect.height)}));return t.observe(e.current),()=>t.disconnect()}),[e]),t},p=e=>{let{timeInMillis:t}=e;const n=(0,s.useRef)(null),r=g(n),o=(0,h.AF)(t);return(0,i.jsxs)(d,{ref:n,$computedHeight:r,children:[(0,i.jsx)(m,{src:l,alt:""}),(0,i.jsx)(f,{$parentHeight:r,children:o})]})},b=e=>{let{initialTime:t}=e;return(0,i.jsx)(p,{timeInMillis:t})},$=a("https://images.genially.com/widgets/countdown/sportwatch.avif"),v="Offside";c(v,"https://fonts.gstatic.com/s/offside/v24/HI_KiYMWKa9QrAykc5boR72elpU.woff2");const y=r.Ay.div({position:"relative",height:"100%",aspectRatio:"1/1"}),w=r.Ay.div({width:"100%",height:"100%",position:"absolute",top:"0",left:"0",backgroundImage:`url(${$.src})`,backgroundSize:"contain",backgroundPosition:"center",backgroundRepeat:"no-repeat"}),x=r.Ay.div((e=>{let{$width:t,$height:n,$top:i,$right:r}=e;return{position:"absolute",backgroundColor:"rgb(13, 37, 53)",width:t,height:n,top:i,right:r}})),T=r.Ay.div((e=>{let{theme:t,$distance:n,$startFromBottom:i=!1}=e;return r.AH`
    content: '';
    position: absolute;
    width: 10%;
    height: 10%;
    background-color: ${t.color.content.info.default()};
    border-radius: 50%;
    top: 0%;
    left: 50%;
    transform-origin: 0 ${n};
    animation-name: ${(e=>{const t=e?180:0;return(0,r.i7)({"0%":{transform:`rotate(${0+t}deg) translateX(-50%)`},"100%":{transform:`rotate(${360+t}deg) translateX(-50%)`}})})(i)};
    animation-duration: 4s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
  `})),A=r.Ay.div.attrs((e=>{let{$parentHeight:t}=e;return{style:{fontSize:t/3.7+"px"}}}))((()=>({position:"absolute",top:"48%",left:"50%",transform:"translate(-50%, -48%)",fontFamily:`'${v}', "Source Sans Pro", _fb_`,color:"rgb(191, 212, 232)"}))),F=e=>{let{timeInMillis:t}=e;const n=(0,s.useRef)(null),r=g(n),o=(0,h.AF)(t);return(0,i.jsxs)(y,{ref:n,children:[(0,i.jsx)(x,{$width:"21%",$height:"21%",$top:"11%",$right:"22%",children:(0,i.jsx)(T,{$distance:"480%"})}),(0,i.jsx)(x,{$width:"27%",$height:"27%",$top:"64.5%",$right:"37%",children:(0,i.jsx)(T,{$distance:"500%",$startFromBottom:!0})}),(0,i.jsx)(w,{}),(0,i.jsx)(A,{$parentHeight:r,children:o})]})},k=e=>{let{initialTime:t,onTimeEnd:n}=e;const{remainingTime:r,initTimer:o}=((e,t)=>{const n=(0,s.useRef)(),i=(0,s.useRef)(!1),[r,o]=(0,s.useState)(e),a=(0,s.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=void 0)}),[n]);(0,s.useEffect)((()=>()=>a()),[a]);const c=(0,s.useCallback)((()=>{i.current=!0,a()}),[a]),l=(0,s.useCallback)((()=>{if(i.current||n.current)return;const e=Date.now();n.current=setInterval((()=>{const n=1e3*Math.floor((Date.now()-e)/1e3),i=Math.max(r-n,0);o(i),0===i&&(c(),t())}),1e3)}),[c,r,t]),u=(0,s.useCallback)((()=>{i.current=!1,l()}),[l]),d=(0,s.useCallback)((()=>{o(e),a(),l()}),[e,a,l]);return{remainingTime:r,initTimer:l,pauseTimer:c,resumeTimer:u,restartTimer:d}})(t,n);return(0,s.useEffect)((()=>{o()}),[o]),(0,i.jsx)(F,{timeInMillis:r})},C=e=>{let{theme:t,initialTime:n,onTimeEnd:s,disabled:a}=e;const c=n>o.l?o.l:n;return(0,i.jsx)(r.NP,{theme:t,children:a?(0,i.jsx)(b,{initialTime:c}):(0,i.jsx)(k,{initialTime:c,onTimeEnd:s})})}},32215:(e,t,n)=>{n.r(t),n.d(t,{geniallyTimerEditorScript:()=>a});var i=n(45992),r=n(13847),o=n(57277),s=n(81359);const a=e=>{let{script:t,editor:n}=e;const a=t.item;a&&("preserveAspectRatio"in a&&(a.preserveAspectRatio=!0),(0,o.x)({getTargetNodeItem:()=>t.item,renderApp:()=>{const{initialTime:e}=t.getConfig();return(0,i.jsx)(s.q,{theme:r.iF.themes.newPrimary,initialTime:e.milliseconds,disabled:!0})},nodePrefix:"timer"})({script:t,editor:n}))}},57277:(e,t,n)=>{n.d(t,{x:()=>r});var i=n(70377);function r(e){let{getTargetNodeItem:t,renderApp:n,renderThumbnailApp:r,nodePrefix:o}=e;return e=>{let{script:s,editor:a}=e,c=null,l=[];function u(e){c&&(i.unmountComponentAtNode(c),c=null),e&&"innerHtml"in e&&(e.innerHtml='<div class="card-iframe"><div style="width: 100%; height: 100%; background: #FF0000; color: #FFFFFF;">Deleted</div><script><\/script></div>')}function d(){c&&i.render(n(),c)}function m(){const e=t(s.getConfig());if(!e)return;const n=`${o}-${e.id}`;"innerHtml"in e&&(e.innerHtml=`<div class="card-iframe"><div id="${n}" class="genially-widget-app" style="width: 100%; height: 100%;"></div></div>`),requestAnimationFrame((()=>{c="idOfFreeNode"in e?document.getElementById(e.idOfFreeNode)||null:document.getElementById(n)||null,d()}))}function f(){r&&l.length&&l.forEach((e=>{i.render(r(),e)}))}function h(){const e=t(s.getConfig());e&&"idOfThumbnailFreeNode"in e&&requestAnimationFrame((()=>{const t=document.getElementsByClassName(e.idOfThumbnailFreeNode);l=Array.from(t),f()}))}s.on("configChange",(e=>{let{config:n,prevConfig:i}=e;const r=t(n),o=i?t(i):void 0;o&&o!==r&&u(o),r&&(r!==o?(m(),h()):(d(),f()))})),s.on("dispose",(()=>{u(t(s.getConfig()))})),a.on("itemMount",(e=>{let{item:t}=e;t===s.item&&m()})),a.on("slideChange",(()=>{d()})),a.on("itemUnmount",(e=>{let{item:t}=e;t===s.item&&u()})),a.on("itemThumbnailMount",(e=>{let{item:t}=e;t===s.item&&h()}))}}},79883:(e,t,n)=>{n.d(t,{EJ:()=>a,AF:()=>s,di:()=>c});const i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return e.toString().padStart(t,"0")};function r(e){const t=Math.floor(e/1e3);return{seconds:t%60,minutes:Math.floor(t/60)}}function o(e){const t=function(e){const t=r(e);return{seconds:t.seconds,minutes:t.minutes%60,hours:Math.floor(t.minutes/60)}}(e);return{seconds:t.seconds,minutes:t.minutes,hours:t.hours%24,days:Math.floor(t.hours/24)}}function s(e){const t=r(e);return`${i(t.minutes)}:${i(t.seconds)}`}function a(e){const t=o(e);return`${i(t.days,2)}:${i(t.hours)}:${i(t.minutes)}:${i(t.seconds)}`}function c(){const e=new Date,t=e.getTime();return t-(t+6e4*e.getTimezoneOffset())}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/2215.4ff984a6.chunk.js.map