"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[2417],{68124:(e,t,i)=>{i.d(t,{q:()=>m});var n=i(45992),o=i(37577),l=i(23119),r=i(17588),s=i(66264),d=i(60708);var a=i(29973),c=i(88138);const g=e=>{let{isInEditor:t,slides:i,showControls:o,showPagination:l,autoplay:r,options:s,fit:d,onClickSelectedImage:a,onZoomedOut:g,galleryType:u,viewId:m}=e;if(!u)return null;const h=(0,c.BR)(u);return(0,n.jsx)(h,{isInEditor:t,slides:i,showControls:o,showPagination:l,autoplay:r,options:s,fit:d,onClickSelectedImage:a,onZoomedOut:g,viewId:m})},u=o.Ay.div({display:"flex",alignItems:"center",height:"100%",cursor:"default",".is-dragging":{cursor:"grabbing","& *":{cursor:"grabbing !important"}}}),m=e=>{let{isInEditor:t=!1,fit:i,autoplay:c,widgetItem:m,slides:h,showControls:p,showPagination:f=!0,galleryType:y,viewId:v,theme:C,onZoomed:w,t:I}=e;const b=Object.assign({loop:!0,skipSnaps:!0,watchResize:!0},a.Z),F=((e,t)=>{const[i,n]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{if(!e||!t)return;const i=[t.parentSlide.on(d.m.Entered,(()=>{t.visible&&n(!0)})),t.on(s.q.Visible,(()=>{n(!0)})),t.on(s.q.Hidden,(()=>{n(!1)}))];return()=>{i.forEach((e=>e())),n(!1)}}),[e,t]),i})(c,m);return(0,n.jsx)(l.i.Provider,{value:{t:I},children:(0,n.jsx)(o.NP,{theme:C,children:(0,n.jsx)(u,{style:{display:"flex",alignItems:"center",height:"100%"},children:(0,n.jsx)(g,{isInEditor:t,slides:h,showControls:p,showPagination:f,options:b,autoplay:F,onClickSelectedImage:e=>{null===w||void 0===w||w(void 0!==e)},onZoomedOut:()=>{null===w||void 0===w||w(!1)},fit:i,galleryType:y,viewId:v})})})})}},22417:(e,t,i)=>{i.r(t),i.d(t,{geniallyGalleryEditorScript:()=>g});var n=i(45992),o=i(54072),l=i(57277),r=i(68124),s=i(88138);const d=(e,t,i)=>{const{width:n,height:o,x:l,y:r}=e,d=e.parentSlide.size,a=d.width>=d.height,c=(0,s.I)(t),g=a?o*c:n,u=a?o:n/c,m=a?g*i:g,h=a?u*i:u,p=l-(m-n)/2,f=r-(h-o)/2;e.setSize(m,h),e.setPosition(p,f)};var a=i(82927);const c=e=>null!==e,g=e=>{let{script:t,editor:i}=e;i.justCreatedFromSidebar&&t.mutateConfig((e=>{e.showControls=!i.getIsMobileGenially()})),t.on("configChange",(e=>{let{config:n,prevConfig:o}=e;var l;const r=n.nodeRichContent;if(!r)return;const c=null===o||void 0===o?void 0:o.slideList,{galleryType:g,slideList:u}=n;if(o&&g!==o.galleryType){if(null===(l=i.trackWidgetPresetChange)||void 0===l||l.call(i,`${a.v.scriptId};${g}`),c){const e=u.map((e=>e.image.source));u.push(...(0,s.Mp)(g,e)),t.mutateConfig((e=>{e.slideList=u}))}((e,t,i)=>{const n=(0,s.RM)(t),o=(0,s.RM)(i),l=s.WK.includes(i),r=s.WK.includes(t);d(e,t,l&&r?1:l&&!r?1/o:n)})(r,g,o.galleryType)}const m=(0,s.mJ)(g);r.thumbnail!==m&&(r.thumbnail=m)})),(0,l.x)({getTargetNodeItem:e=>e.nodeRichContent,renderApp:()=>{const{slideList:e,showControls:l,fit:s,galleryType:d}=t.getConfig(),a=e.map((e=>null===e.image.source?null:{image:e.image.source,title:e.title,id:(0,o.Ak)()})).filter(c);return(0,n.jsx)(r.q,{isInEditor:!0,slides:a,showControls:l,autoplay:!1,fit:s,galleryType:d,viewId:"",widgetItem:void 0,theme:i.theme,t:i.t})},nodePrefix:"gallery"})({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,a=[];function c(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 g(){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,g()}))}function m(){o&&a.length&&a.forEach((e=>{n.render(o(),e)}))}function h(){const e=t(r.getConfig());e&&"idOfThumbnailFreeNode"in e&&requestAnimationFrame((()=>{const t=document.getElementsByClassName(e.idOfThumbnailFreeNode);a=Array.from(t),m()}))}r.on("configChange",(e=>{let{config:i,prevConfig:n}=e;const o=t(i),l=n?t(n):void 0;l&&l!==o&&c(l),o&&(o!==l?(u(),h()):(g(),m()))})),r.on("dispose",(()=>{c(t(r.getConfig()))})),s.on("itemMount",(e=>{let{item:t}=e;t===r.item&&u()})),s.on("slideChange",(()=>{g()})),s.on("itemUnmount",(e=>{let{item:t}=e;t===r.item&&c()})),s.on("itemThumbnailMount",(e=>{let{item:t}=e;t===r.item&&h()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/2417.db76b454.chunk.js.map