"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[6993],{1067:(n,t,e)=>{e.d(t,{h:()=>o});var i=e(22739);function o(n,t){if(!n)return!1;let e=!1;return(0,i.L)(n.data,(n=>{n.type===t&&(e=!0)})),e}},46993:(n,t,e)=>{e.r(t),e.d(t,{geniallyCountdownViewScript:()=>f});var i=e(48237),o=e(19769),s=e(1067),r=e(66264),c=e(84054),l=e(60708),u=e(53289),d=e(79883),a=e(62800);const f=(n,t)=>{var e,f;let m,v=[],h=!1;null===(e=n.config.onEndAction)||void 0===e||e.preload();const{onEndAction:g}=n.config;let p;g&&(0,s.h)(g,i.L.PlayAudio)&&(n.slide.audioRequirement=c.w.ShowMuteAndOverlay);const T=n.config.textItemRef,y=(0,u.D)(null!==(f=null===T||void 0===T?void 0:T.text)&&void 0!==f?f:""),w=n=>{T&&(T.text=(0,u.x)((0,d.AF)(n),y))},E=n.item;function M(){p&&(t.clearInterval(p),p=void 0)}function x(){if(h||p)return;const e=Date.now(),i=null!==m&&void 0!==m?m:n.config.initialTime.milliseconds;p=t.setInterval((()=>{const o=1e3*Math.floor((Date.now()-e)/1e3),s=Math.max(i-o,0);s<=0&&M(),m=s,w(s),0===s&&((0,a.g)({view:t,widgetItem:E,action:n.config.onEndAction}),v.forEach((n=>n())))}),100)}const A=E.parentSlide;A.on(l.m.Exiting,(()=>{M()})),A.on(l.m.Entering,(()=>{const t=A.items.find((t=>{var e,i;return t.type===o.S.Activity&&(null===(e=t.Options.Timer)||void 0===e?void 0:e.TimerId)===(null===(i=n.item)||void 0===i?void 0:i.id)})),e=n.config.initialTime.milliseconds;t?w(null!==m&&void 0!==m?m:e):(m=e,w(e))})),"print"!==t.viewMode&&A.on(l.m.Entered,(()=>{E.visible?x():E.once(r.q.Visible,(()=>{x()}))}));n.setApi({pause:function(){h=!0,M()},resume:function(){h=!1,x()},restart:()=>{m=n.config.initialTime.milliseconds,M(),x()},isRunning:()=>!h,addOnTimeEndListener:n=>{v.push(n)},removeOnTimeEndListener:n=>{v=v.filter((t=>t!==n))}})}},53289:(n,t,e)=>{function i(n){if(n.nodeType===Node.TEXT_NODE&&n.textContent&&""!==n.textContent.trim())return n;if(n.hasChildNodes())for(let t=0;t<n.childNodes.length;t+=1){const e=i(n.childNodes[t]);if(e)return e}return null}function o(n){const t=document.createElement("div");t.innerHTML=n;const e=i(t);return e?function(n){let t="",e=n;for(;e;)e instanceof HTMLElement&&e.style.cssText&&(t=e.style.cssText+t),e=e.parentElement;return t}(e):""}function s(n,t){const e=document.createElement("span");return e.setAttribute("style",t),e.textContent=n.replace(/^\s+/g,(n=>"\xa0".repeat(n.length))).replace(/\s+$/g,(n=>"\xa0".repeat(n.length))),e.outerHTML}e.d(t,{D:()=>o,x:()=>s})},79883:(n,t,e)=>{e.d(t,{EJ:()=>c,AF:()=>r,di:()=>l});const i=function(n){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return n.toString().padStart(t,"0")};function o(n){const t=Math.floor(n/1e3);return{seconds:t%60,minutes:Math.floor(t/60)}}function s(n){const t=function(n){const t=o(n);return{seconds:t.seconds,minutes:t.minutes%60,hours:Math.floor(t.minutes/60)}}(n);return{seconds:t.seconds,minutes:t.minutes,hours:t.hours%24,days:Math.floor(t.hours/24)}}function r(n){const t=o(n);return`${i(t.minutes)}:${i(t.seconds)}`}function c(n){const t=s(n);return`${i(t.days,2)}:${i(t.hours)}:${i(t.minutes)}:${i(t.seconds)}`}function l(){const n=new Date,t=n.getTime();return t-(t+6e4*n.getTimezoneOffset())}},62800:(n,t,e)=>{e.d(t,{g:()=>o});var i=e(57567);function o(n){let{view:t,widgetItem:e,action:o}=n;const s=e.playAnimation({type:i.K.Notification,parameters:{delayMs:0,durationMs:200}});t.setTimeout((()=>{s.stop()}),2500),null===o||void 0===o||o.run()}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/6993.f1eb4a09.chunk.js.map