"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[6677],{37646(e,t,i){i.d(t,{q:()=>s});var n=i(45992),o=i(37577),l=i(23119),r=i(67619);const d=e=>{let{slides:t,onClickSelectedImage:i,onZoomedOut:o,mosaicType:l,viewId:d}=e;if(!l)return null;const s=(0,r.Hu)(l);return(0,n.jsx)(s,{slides:t,onClickSelectedImage:i,onZoomedOut:o,viewId:d})},s=e=>{let{slides:t,viewId:i,onZoomed:r,mosaicType:s,theme:c,t:a}=e;return(0,n.jsx)(l.i.Provider,{value:{t:a},children:(0,n.jsx)(o.NP,{theme:c,children:(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",height:"100%"},children:(0,n.jsx)(d,{slides:t,onClickSelectedImage:e=>{null===r||void 0===r||r(void 0!==e)},onZoomedOut:()=>{null===r||void 0===r||r(!1)},mosaicType:s,viewId:i})})})})}},36677(e,t,i){i.d(t,{geniallyMosaicEditorScript:()=>g});var n=i(45992),o=i(54072),l=i(57277),r=i(37646),d=i(94299),s=i(34412),c=i(67619);const a=(e,t)=>{const i=[...e],n=i.map((e=>e.image.source));i.push(...((e,t)=>{const i=t.length,n=[],o=d.t.filter((e=>!t.includes(e)));if(0===o.length)return n;const l=Math.min(o.length,(0,c.wl)(e)-i);for(let r=0;r<l;r+=1)n.push((0,s.G)(o[r]));return n})(t,n));const o=((e,t)=>{const i=t.length;return Math.max(0,i-(0,c.wl)(e))})(t,n);for(let l=0;l<o;l+=1)i.pop();return i};var m=i(64237);const u=e=>null!==e,g=e=>{let{script:t,editor:i}=e;t.on("configChange",(e=>{let{config:n,prevConfig:o}=e;var l;const r=t.item;if(!r)return;const d=null===o||void 0===o?void 0:o.slideList,{mosaicType:s,slideList:u}=n;o&&s!==o.mosaicType&&(null===(l=i.trackWidgetPresetChange)||void 0===l||l.call(i,`${m.p.scriptId};${s}`),d&&t.mutateConfig((e=>{e.slideList=a(u,s)})),((e,t)=>{const{width:i,height:n,x:o,y:l}=e,r=e.parentSlide.size,d=r.width>=r.height,s=(0,c.u_)(t),a=d?n*s:i,m=d?n:i/s,u=o-(a-i)/2,g=l-(m-n)/2;e.setSize(a,m),e.setPosition(u,g)})(r,s));const g=(0,c.Km)(s);r.thumbnail!==g&&(r.thumbnail=g)}));const d=()=>{const{slideList:e,mosaicType:l}=t.getConfig(),d=e.map((e=>null===e.image.source?null:{image:e.image.source,title:e.title,id:(0,o.Ak)()})).filter(u);return(0,n.jsx)(r.q,{slides:d,mosaicType:l,viewId:"",theme:i.theme,t:i.t})};(0,l.x)({getTargetNodeItem:()=>t.item,renderApp:d,renderThumbnailApp:d,nodePrefix:"mosaic"})({script:t,editor:i})}},57277(e,t,i){i.d(t,{x:()=>o});var n=i(70377);function o(e){let{getTargetNodeItem:t,renderApp:i,renderThumbnailApp:o,nodePrefix:l}=e;return e=>{let{script:r,editor:d}=e,s=null,c=[];function a(e){s&&(n.unmountComponentAtNode(s),s=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 m(){s&&n.render(i(),s)}function u(){const e=t(r.getConfig());if(!e)return;const i=`${l}-${e.id}`;"innerHtml"in e&&(e.innerHtml=`<div class="card-iframe"><div id="${i}" class="genially-widget-app" style="width: 100%; height: 100%;"></div></div>`),requestAnimationFrame((()=>{s="idOfFreeNode"in e?document.getElementById(e.idOfFreeNode)||null:document.getElementById(i)||null,m()}))}function g(){o&&c.length&&c.forEach((e=>{const t="true"===e.dataset.critical,{renderingSlideId:i}=e.dataset;n.render(o({important:t,renderingSlideId:i}),e)}))}function h(){const e=t(r.getConfig());e&&"idOfThumbnailFreeNode"in e&&requestAnimationFrame((()=>{const t=document.getElementsByClassName(e.idOfThumbnailFreeNode);c=Array.from(t).filter((e=>e instanceof HTMLElement)),g()}))}r.on("configChange",(e=>{let{config:i,prevConfig:n}=e;const o=t(i),l=n?t(n):void 0;l&&l!==o&&a(l),o&&(o!==l?(u(),h()):(m(),g()))})),r.on("scriptIdChange",(e=>{let{scriptId:t,prevScriptId:i}=e;i!==t&&(a(),u(),h())})),r.on("dispose",(()=>{a(t(r.getConfig()))})),d.on("itemMount",(e=>{let{item:t}=e;t===r.item&&u()})),d.on("slideChange",(()=>{m()})),d.on("itemUnmount",(e=>{let{item:t}=e;t===r.item&&a()})),d.on("itemThumbnailMount",(e=>{let{item:t}=e;t===r.item&&h()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/6677.44c6825c.chunk.js.map