"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(53113),s=i(17588),r=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:s,options:r,fit:d,onClickSelectedImage:a,onZoomedOut:g,galleryType:u,viewId:m}=e;if(!u)return null;const p=(0,c.BR)(u);return(0,n.jsx)(p,{isInEditor:t,slides:i,showControls:o,showPagination:l,autoplay:s,options:r,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:p,showControls:h,showPagination:f=!0,galleryType:y,viewId:v,theme:w,onZoomed:C,t:I}=e;const b=Object.assign({loop:!0,skipSnaps:!0,watchResize:!0},a.Z),x=((e,t)=>{const[i,n]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{if(!e||!t)return;const i=[t.parentSlide.on(d.m.Entered,(()=>{t.visible&&n(!0)})),t.on(r.q.Visible,(()=>{n(!0)})),t.on(r.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:w,children:(0,n.jsx)(u,{style:{display:"flex",alignItems:"center",height:"100%"},children:(0,n.jsx)(g,{isInEditor:t,slides:p,showControls:h,showPagination:f,options:b,autoplay:x,onClickSelectedImage:e=>{null===C||void 0===C||C(void 0!==e)},onZoomedOut:()=>{null===C||void 0===C||C(!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),s=i(68124),r=i(88138);const d=(e,t,i)=>{const{width:n,height:o,x:l,y:s}=e,d=e.parentSlide.size,a=d.width>=d.height,c=(0,r.I)(t),g=a?o*c:n,u=a?o:n/c,m=a?g*i:g,p=a?u*i:u,h=l-(m-n)/2,f=s-(p-o)/2;e.setSize(m,p),e.setPosition(h,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 s=n.nodeRichContent;if(!s)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,r.Mp)(g,e)),t.mutateConfig((e=>{e.slideList=u}))}((e,t,i)=>{const n=(0,r.RM)(t),o=(0,r.RM)(i),l=r.WK.includes(i),s=r.WK.includes(t);d(e,t,l&&s?1:l&&!s?1/o:n)})(s,g,o.galleryType)}const m=(0,r.mJ)(g);s.thumbnail!==m&&(s.thumbnail=m)})),(0,l.x)({getTargetNodeItem:e=>e.nodeRichContent,renderApp:()=>{const{slideList:e,showControls:l,fit:r,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)(s.q,{isInEditor:!0,slides:a,showControls:l,autoplay:!1,fit:r,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,nodePrefix:o}=e;return e=>{let{script:l,editor:s}=e,r=null;function d(e){r&&(n.unmountComponentAtNode(r),r=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 a(){r&&n.render(i(),r)}function c(){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((()=>{r="idOfFreeNode"in e?document.getElementById(e.idOfFreeNode):document.getElementById(i),a()}))}l.on("configChange",(e=>{let{config:i,prevConfig:n}=e;const o=t(i),l=n?t(n):void 0;l&&l!==o&&d(l),o&&(o!==l?c():a())})),l.on("dispose",(()=>{d(t(l.getConfig()))})),s.on("itemMount",(e=>{let{item:t}=e;t===l.item&&c()})),s.on("itemUnmount",(e=>{let{item:t}=e;t===l.item&&d()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/2417.2fbbac96.chunk.js.map