"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[7030],{87001:(e,n,t)=>{t.d(n,{q:()=>r});var i=t(45992),o=t(17588),l=t(60708);const r=e=>{let{url:n,config:t,view:r,editor:s,palette:d,slide:a,isThumbnail:u=!1}=e;const c=(0,o.useRef)(null),m=(0,o.useRef)(!1),v=function(e){var n,t;const i={type:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"config",data:JSON.parse(JSON.stringify(e))};null===(t=null===(n=c.current)||void 0===n?void 0:n.contentWindow)||void 0===t||t.postMessage(i,"*")};return(0,o.useEffect)((()=>s?s.on("documentColorsChanged",(e=>{let{colors:n}=e;v(n,"palette")})):()=>{})),(0,o.useEffect)((()=>a?a.on(l.m.PaletteUpdated,(e=>{v(e.colors,"palette")})):()=>{})),(0,o.useEffect)((()=>{v(t)}),[t]),(0,o.useEffect)((()=>{if(!c.current||m.current)return()=>{};const e=e=>{var n,i,o,l,s;if(e.source===(null===(n=c.current)||void 0===n?void 0:n.contentWindow))if("ready"===e.data.type)s=Object.assign(Object.assign({},t),{isThumbnail:u,appMode:r?"view":"editor"}),v(d,"palette"),v(s,"init"),m.current=!0;else if("interactivity"===e.data.type){if(u)return;const n=e.data.data;"object"===typeof n?null===(i=null===r||void 0===r?void 0:r.runAction)||void 0===i||i.call(r,n):"string"===typeof n&&(null===(l=null===(o=null===r||void 0===r?void 0:r.getAction)||void 0===o?void 0:o.call(r,n))||void 0===l||l.run())}};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}})),(0,i.jsx)("iframe",{ref:c,src:n,style:{pointerEvents:r?"auto":"none",width:"100%",height:"100%"},title:"Genially App"})}},13844:(e,n,t)=>{t.d(n,{D:()=>o});var i=t(45992);const o=()=>(0,i.jsx)("div",{style:{backgroundColor:"#414141",width:"100%",height:"100%"}})},96901:(e,n,t)=>{t.d(n,{Y:()=>o,m:()=>i});const i=e=>{let{scriptId:n,developmentUrl:t,version:i="1.0.0"}=e;return t?`${t}/index.html`:`https://plugins.genially.com/${n}/${i}/index.html`},o=e=>e.startsWith("@ai.genially/")},37030:(e,n,t)=>{t.r(n),t.d(n,{geniallyCodeViewScript:()=>d});var i=t(45992),o=t(41381),l=t(87001),r=t(13844),s=t(96901);const d=(e,n)=>{const t=function(){let{isThumbnail:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var o;const{developmentUrl:r,config:d,scriptId:a,version:u}=e,c=(0,s.m)({scriptId:a,developmentUrl:r,version:u});return(0,i.jsx)(l.q,{palette:n.getDocumentColors(),config:d,view:n,slide:null===(o=e.item)||void 0===o?void 0:o.parentSlide,url:c,isThumbnail:t})};(0,o.p)({getTargetNodeItem:()=>e.item,initialState:void 0,renderThumbnailApp:()=>(0,s.Y)(e.scriptId||"")?(0,i.jsx)(r.D,{}):t({isThumbnail:!0}),renderApp:()=>()=>t()})(e,n)}},41381:(e,n,t)=>{t.d(n,{p:()=>r});var i=t(70377),o=t(66264),l=t(60708);function r(e){let{getTargetNodeItem:n,renderApp:t,renderThumbnailApp:r,initialState:s}=e,d=!1;const a=[],u=e=>{a.push(e)};return e=>{const c=n(e.config),m=null===c||void 0===c?void 0:c.parentSlide;function v(){if(!c)return;let e=null;if("idOfFreeNode"in c)e=document.getElementById(c.idOfFreeNode);else{const n=document.createElement("div");n.innerHTML=c.source;let t=n.getElementsByClassName("genially-widget-app");t.length||(t=n.getElementsByClassName("genially-widget-gallery"));const{id:i}=t[0];if(!i)return;e=document.getElementById(i)}if(e){const n=o=>{if(d){const l=t({setState:n,onUnmount:u});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,n(s),a.push((()=>{i.unmountComponentAtNode(e)}))}}function f(){d=!1,a.forEach((e=>{e()})),a.length=0}null===c||void 0===c||c.on(o.q.Mount,(()=>{v()})),null===c||void 0===c||c.on(o.q.Unmount,(()=>{f()})),c&&"isTransversal"in c&&c.isTransversal?v():null===m||void 0===m||m.on(l.m.Entering,(()=>{d||v()})),null===m||void 0===m||m.on(l.m.Exited,(()=>{c&&"isTransversal"in c&&c.isTransversal||d&&f()})),null===m||void 0===m||m.on(l.m.ThumbnailMount,(()=>{!function(){if(!r||!c||!("idOfThumbnailFreeNode"in c))return;const e=document.getElementsByClassName(c.idOfThumbnailFreeNode);Array.from(e).forEach((e=>{i.unmountComponentAtNode(e)}))}(),function(){if(!r||!c||!("idOfThumbnailFreeNode"in c))return;const e=document.getElementsByClassName(c.idOfThumbnailFreeNode);Array.from(e).forEach((e=>{i.render(r(),e)}))}()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/7030.72e67eb2.chunk.js.map