"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[3513],{43513:(t,e,n)=>{n.r(e),n.d(e,{geniallyStopwatchViewScript:()=>f});var o=n(57567),i=n(66264),s=n(84054),c=n(60708),a=n(46177),r=n(53289),l=n(79883),u=n(62800),d=n(94350);const f=(t,e)=>{var n;let f;(0,a.H)(e._logger,d.M.scriptId),t.config.alarms.forEach((t=>{var e;t.active&&(null===(e=t.action)||void 0===e||e.preload())})),t.slide.audioRequirement=s.w.ShowMute;const m=t.item,p=t.config.startButtonRef;p&&(p.markAsInteractive=!0);const g=t.config.pauseButtonRef;g&&(g.markAsInteractive=!0);const v=t.config.restartButtonRef;v&&(v.markAsInteractive=!0);const h=t.config.textItemRef,w=(0,r.D)(null!==(n=null===h||void 0===h?void 0:h.text)&&void 0!==n?n:""),y=t=>{h&&(h.text=(0,r.x)((0,l.AF)(t),w))};let M=!1;function E(t){M=t,g&&(g.shown=t),p&&(p.shown=!t)}let T=0;const A=new Set;function x(){E(!0);let n=Date.now();f=e.setInterval((()=>{const o=Date.now(),i=o-n;if(n=o,M){T+=i;const t=5999e3;T>t&&(T=t)}const s=1e3*Math.floor(T/1e3);y(s);for(const n of t.config.alarms)n.active&&s>=n.time.milliseconds&&!A.has(n)&&(A.add(n),(0,u.g)({view:e,widgetItem:m,action:n.action}))}),100)}function b(){E(!1),A.clear(),T=0}const k="https://s3.eu-west-1.amazonaws.com/genially-audio-dev/64676ad5ec3dd256383244f9/520b02c3-751c-456c-816b-817a3d8050da.mpga";e.preloadAudio(k);const C=()=>{e.playAudio({source:k})},I="https://s3.eu-west-1.amazonaws.com/genially-audio-dev/64676ad5ec3dd256383244f9/038b75ee-5922-4a44-902c-4a751318bf11.mpga";e.preloadAudio(I);null===p||void 0===p||p.on(i.q.Click,(()=>{E(!0),C()})),null===g||void 0===g||g.on(i.q.Click,(()=>{E(!1);const t=m.playAnimation({type:o.K.Heartbeat,parameters:{delayMs:0,durationMs:2e3}});e.setTimeout((()=>{t.stop()}),2e3),C()})),null===v||void 0===v||v.on(i.q.Click,(()=>{b(),e.playAudio({source:I})})),m.parentSlide.on(c.m.Exiting,(()=>{b(),f&&(e.clearInterval(f),f=void 0)})),m.parentSlide.on(c.m.Entering,(()=>{E(!1),T=0,y(0)})),"print"!==e.viewMode&&m.parentSlide.on(c.m.Entered,(()=>{m.visible?x():m.once(i.q.Visible,(()=>{x()}))}))}},46177:(t,e,n)=>{n.d(e,{H:()=>o});const o=(t,e)=>{t.info(`[DEPRECATED_TIMER] ${e}`)}},53289:(t,e,n)=>{function o(t){if(t.nodeType===Node.TEXT_NODE&&t.textContent&&""!==t.textContent.trim())return t;if(t.hasChildNodes())for(let e=0;e<t.childNodes.length;e+=1){const n=o(t.childNodes[e]);if(n)return n}return null}function i(t){const e=document.createElement("div");e.innerHTML=t;const n=o(e);return n?function(t){let e="",n=t;for(;n;)n instanceof HTMLElement&&n.style.cssText&&(e=n.style.cssText+e),n=n.parentElement;return e}(n):""}function s(t,e){const n=document.createElement("span");return n.setAttribute("style",e),n.textContent=t.replace(/^\s+/g,(t=>"\xa0".repeat(t.length))).replace(/\s+$/g,(t=>"\xa0".repeat(t.length))),n.outerHTML}n.d(e,{D:()=>i,x:()=>s})},79883:(t,e,n)=>{n.d(e,{EJ:()=>a,AF:()=>c,di:()=>r});const o=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return t.toString().padStart(e,"0")};function i(t){const e=Math.floor(t/1e3);return{seconds:e%60,minutes:Math.floor(e/60)}}function s(t){const e=function(t){const e=i(t);return{seconds:e.seconds,minutes:e.minutes%60,hours:Math.floor(e.minutes/60)}}(t);return{seconds:e.seconds,minutes:e.minutes,hours:e.hours%24,days:Math.floor(e.hours/24)}}function c(t){const e=i(t);return`${o(e.minutes)}:${o(e.seconds)}`}function a(t){const e=s(t);return`${o(e.days,2)}:${o(e.hours)}:${o(e.minutes)}:${o(e.seconds)}`}function r(){const t=new Date,e=t.getTime();return e-(e+6e4*t.getTimezoneOffset())}},62800:(t,e,n)=>{n.d(e,{g:()=>i});var o=n(57567);function i(t){let{view:e,widgetItem:n,action:i}=t;const s=n.playAnimation({type:o.K.Notification,parameters:{delayMs:0,durationMs:200}});e.setTimeout((()=>{s.stop()}),2500),null===i||void 0===i||i.run()}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/3513.6dd6f8ee.chunk.js.map