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