"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[2641],{2641:(t,e,n)=>{n.r(e),n.d(e,{geniallyCountdownEditorScript:()=>r});var o=n(19769),i=n(53289),s=n(79883);const r=t=>{let{script:e}=t;const n=()=>e.getConfig().textItemRef;e.on("configChange",(t=>{let{config:r,prevConfig:l}=t;var c,u;const d=e.item;if(!d)return;const a=null===l||void 0===l?void 0:l.textItemRef,f=n();if(!f)return;a&&(a.textEditable=!0);let m=(0,i.D)(f.text);if((null===l||void 0===l?void 0:l.color)!==r.color){const t=`color: ${r.color}`;m=m.concat(`;${t}`);const e=d.items.find((t=>{let{type:e,name:n}=t;return e===o.S.Svg&&"tempoImg"===n}));e&&e.setColors(r.color)}f.textEditable=!1;const g=r.initialTime.milliseconds;if(f.text=(0,i.x)((0,s.AF)(g),m),(null===(c=null===l||void 0===l?void 0:l.fontFamily)||void 0===c?void 0:c.name)!==(null===(u=r.fontFamily)||void 0===u?void 0:u.name)&&f&&f.setFontFamily(r.fontFamily.name,r.fontFamily.url),(null===l||void 0===l?void 0:l.backgroundColor)!==r.backgroundColor){const t=d.items.find((t=>{let{type:e,name:n}=t;return e===o.S.Svg&&"tempoImg"!==n}));t&&t.setColors(r.backgroundColor)}})),e.on("dispose",(()=>{const t=n();t&&(t.textEditable=!0)})),e.setApi({setTime(t,e){const o=n();if(!o)return;const r=(0,i.D)(o.text),l=60*t*1e3+1e3*e;o.text=(0,i.x)((0,s.AF)(l),r)}})}},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:()=>l,AF:()=>r,di:()=>c});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 r(t){const e=i(t);return`${o(e.minutes)}:${o(e.seconds)}`}function l(t){const e=s(t);return`${o(e.days,2)}:${o(e.hours)}:${o(e.minutes)}:${o(e.seconds)}`}function c(){const t=new Date,e=t.getTime();return e-(e+6e4*t.getTimezoneOffset())}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/2641.39191e4f.chunk.js.map