"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(23119),r=i(67619);const s=e=>{let{slides:t,onClickSelectedImage:i,onZoomedOut:o,mosaicType:l,viewId:s}=e;if(!l)return null;const d=(0,r.Hu)(l);return(0,n.jsx)(d,{slides:t,onClickSelectedImage:i,onZoomedOut:o,viewId:s})},d=e=>{let{slides:t,viewId:i,onZoomed:r,mosaicType:d,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)(s,{slides:t,onClickSelectedImage:e=>{null===r||void 0===r||r(void 0!==e)},onZoomedOut:()=>{null===r||void 0===r||r(!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),r=i(37646),s=i(94299),d=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=s.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,d.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=n.nodeRichContent;if(!r)return;const s=null===o||void 0===o?void 0:o.slideList,{mosaicType:d,slideList:u}=n;o&&d!==o.mosaicType&&(null===(l=i.trackWidgetPresetChange)||void 0===l||l.call(i,`${m.p.scriptId};${d}`),s&&t.mutateConfig((e=>{e.slideList=a(u,d)})),((e,t)=>{const{width:i,height:n,x:o,y:l}=e,r=e.parentSlide.size,s=r.width>=r.height,d=(0,c.u_)(t),a=s?n*d:i,m=s?n:i/d,u=o-(a-i)/2,g=l-(m-n)/2;e.setSize(a,m),e.setPosition(u,g)})(r,d));const g=(0,c.Km)(d);r.thumbnail!==g&&(r.thumbnail=g)})),(0,l.x)({getTargetNodeItem:e=>e.nodeRichContent,renderApp:()=>{const{slideList:e,mosaicType:l}=t.getConfig(),s=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:s,mosaicType:l,viewId:"",theme:i.theme,t:i.t})},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:s}=e,d=null,c=[];function a(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 m(){d&&n.render(i(),d)}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((()=>{d="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;n.render(o(t),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("dispose",(()=>{a(t(r.getConfig()))})),s.on("itemMount",(e=>{let{item:t}=e;t===r.item&&u()})),s.on("slideChange",(()=>{m()})),s.on("itemUnmount",(e=>{let{item:t}=e;t===r.item&&a()})),s.on("itemThumbnailMount",(e=>{let{item:t}=e;t===r.item&&h()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/6677.f8be8d3c.chunk.js.map