"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[6677],{37646:(e,t,i)=>{i.d(t,{q:()=>d});var n=i(45992),o=i(37577),l=i(67619);const s=e=>{let{slides:t,onClickSelectedImage:i,onZoomedOut:o,mosaicType:s,viewId:d}=e;if(!s)return null;const r=(0,l.Hu)(s);return(0,n.jsx)(r,{slides:t,onClickSelectedImage:i,onZoomedOut:o,viewId:d})},d=e=>{let{slides:t,viewId:i,onZoomed:l,mosaicType:d,theme:r}=e;return(0,n.jsx)(o.NP,{theme:r,children:(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",height:"100%"},children:(0,n.jsx)(s,{slides:t,onClickSelectedImage:e=>{null===l||void 0===l||l(void 0!==e)},onZoomedOut:()=>{null===l||void 0===l||l(!1)},mosaicType:d,viewId:i})})})}},36677:(e,t,i)=>{i.r(t),i.d(t,{geniallyMosaicEditorScript:()=>g});var n=i(45992),o=i(54072),l=i(57277),s=i(37646),d=i(94299),r=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 s=0;s<l;s+=1)n.push((0,r.G)(o[s]));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 s=n.nodeRichContent;if(!s)return;const d=null===o||void 0===o?void 0:o.slideList,{mosaicType:r,slideList:u}=n;o&&r!==o.mosaicType&&(null===(l=i.trackWidgetPresetChange)||void 0===l||l.call(i,`${m.p.scriptId};${r}`),d&&t.mutateConfig((e=>{e.slideList=a(u,r)})),((e,t)=>{const{width:i,height:n,x:o,y:l}=e,s=e.parentSlide.size,d=s.width>=s.height,r=(0,c.u_)(t),a=d?n*r:i,m=d?n:i/r,u=o-(a-i)/2,g=l-(m-n)/2;e.setSize(a,m),e.setPosition(u,g)})(s,r));const g=(0,c.Km)(r);s.thumbnail!==g&&(s.thumbnail=g)})),(0,l.x)({getTargetNodeItem:e=>e.nodeRichContent,renderApp:()=>{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)(s.q,{slides:d,mosaicType:l,viewId:"",theme:i.theme})},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,nodePrefix:o}=e;return e=>{let{script:l,editor:s}=e,d=null;function r(e){d&&(n.unmountComponentAtNode(d),d=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 c(){d&&n.render(i(),d)}function a(){const e=t(l.getConfig());if(!e)return;const i=`${o}-${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((()=>{d="idOfFreeNode"in e?document.getElementById(e.idOfFreeNode):document.getElementById(i),c()}))}l.on("configChange",(e=>{let{config:i,prevConfig:n}=e;const o=t(i),l=n?t(n):void 0;l&&l!==o&&r(l),o&&(o!==l?a():c())})),l.on("dispose",(()=>{r(t(l.getConfig()))})),s.on("itemMount",(e=>{let{item:t}=e;t===l.item&&a()})),s.on("itemUnmount",(e=>{let{item:t}=e;t===l.item&&r()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/6677.e17e90d8.chunk.js.map