"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[485],{45577:(e,t,n)=>{n.d(t,{q:()=>a});var i=n(45992),o=n(17588),l=n(66264),u=n(60708),d=n(90936),s=n(5441);const a=e=>{let{getItems:t,item:n,menuType:a,theme:r,shouldCloseWhenClickOutside:m=!1,itemSize:c,menuTheme:v}=e;const[h,g]=(0,o.useState)(t()),[p,f]=(0,o.useState)(!1),T=(0,o.useCallback)((()=>{f((e=>!e))}),[]);(0,o.useEffect)((()=>{const e=null===n||void 0===n?void 0:n.on(l.q.Message,(e=>{e===u.m.Entering&&(g(t()),f(!1))}));return()=>{null===e||void 0===e||e()}}),[t,n]);const w=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=(0,o.useRef)(null);return(0,o.useEffect)((()=>{const i=t=>{n.current&&!n.current.contains(t.target)&&e(t)};return document.addEventListener("mouseup",i,t),document.addEventListener("touchend",i,t),()=>{document.removeEventListener("mouseup",i,t),document.removeEventListener("touchend",i,t)}}),[n,e,t]),n}((0,o.useCallback)((()=>{m&&p&&f(!1)}),[p,m]),!0);(0,o.useEffect)((()=>{g(t())}),[t]);const y=(0,d.CO)(a);return(0,s.T)({theme:r,children:(0,i.jsx)(y,{items:h,onToggleClick:T,opened:p,ref:w,theme:r,itemSize:c,menuTheme:v})})}},93918:(e,t,n)=>{n.d(t,{N:()=>u,e:()=>s});var i=n(48237),o=n(22077);const l=e=>""===e?(0,o.A)("__new.view.widget.menu.sidebar.emptyTitlePlaceholder"):e,u=e=>e.map(((e,t)=>{var n;const o=(null===(n=e.menuItemAction.action)||void 0===n?void 0:n.type)===i.L.GoToSlide;return{text:l(e.menuItemName),key:t,onClick:()=>{},isLink:o,isActive:!1,isAllowed:o,altText:e.altText}})),d={active:!1,allowed:!1},s=(e,t)=>e.map(((e,n)=>{var o,u;const s=!!(null===(o=e.menuItemAction)||void 0===o?void 0:o.data)&&(null===(a=e.menuItemAction.data)||void 0===a?void 0:a.type)===i.L.GoToSlide;var a;const{active:r,allowed:m}=s&&(null===(u=e.menuItemAction)||void 0===u?void 0:u.data)?t.getGoToSlideState(e.menuItemAction.data):d;return{text:l(e.menuItemName),key:n,onClick:()=>{var t;return null===(t=e.menuItemAction)||void 0===t?void 0:t.run()},isLink:s,isActive:r,isAllowed:m,altText:e.altText}}))},90485:(e,t,n)=>{n.r(t),n.d(t,{geniallyMenuViewScript:()=>d});var i=n(45992),o=n(41381),l=n(45577),u=n(93918);const d=(e,t)=>{(0,o.p)({getTargetNodeItem:()=>e.item,initialState:void 0,renderApp:()=>{var n,o;const{config:d,item:s}=e,{menuItems:a,menuType:r,menuTheme:m}=d,c=()=>(0,u.e)(a,t),v={width:null!==(n=null===s||void 0===s?void 0:s.width)&&void 0!==n?n:0,height:null!==(o=null===s||void 0===s?void 0:s.height)&&void 0!==o?o:0};return()=>(0,i.jsx)(l.q,{getItems:c,item:s,menuType:r,theme:t.theme,itemSize:v,shouldCloseWhenClickOutside:!0,menuTheme:m})}})(e,t)}},41381:(e,t,n)=>{n.d(t,{p:()=>u});var i=n(70377),o=n(66264),l=n(60708);function u(e){let{getTargetNodeItem:t,renderApp:n,initialState:u}=e,d=!1;const s=[],a=e=>{s.push(e)};return e=>{const r=t(e.config),m=null===r||void 0===r?void 0:r.parentSlide;function c(){if(!r)return;let e=null;if("idOfFreeNode"in r)e=document.getElementById(r.idOfFreeNode);else{const t=document.createElement("div");t.innerHTML=r.source;let n=t.getElementsByClassName("genially-widget-app");n.length||(n=t.getElementsByClassName("genially-widget-gallery"));const{id:i}=n[0];if(!i)return;e=document.getElementById(i)}if(e){const t=o=>{if(d){const l=n({setState:t,onUnmount:a});i.render(l(o),e)}else console.warn('"rerender" was called when the widget was already unmounted. This is a no-op. Did you forget to dispose of an event handler with "onUnmount"?')};d=!0,t(u),s.push((()=>{i.unmountComponentAtNode(e)}))}}function v(){d=!1,s.forEach((e=>{e()})),s.length=0}null===r||void 0===r||r.on(o.q.Mount,(()=>{c()})),null===r||void 0===r||r.on(o.q.Unmount,(()=>{v()})),r&&"isTransversal"in r&&r.isTransversal?c():null===m||void 0===m||m.on(l.m.Entering,(()=>{d||c()})),null===m||void 0===m||m.on(l.m.Exited,(()=>{r&&"isTransversal"in r&&r.isTransversal||d&&v()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/485.56a9d67b.chunk.js.map