"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[5262],{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:d,palette:s,slide:a,isThumbnail:c=!1,fullSource:u}=e;const m=(0,o.useRef)(null),f=(0,o.useRef)(!1),p=r&&r.isOffline,g=p&&u,v=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=m.current)||void 0===t?void 0:t.contentWindow)||void 0===n||n.postMessage(i,"*")};return(0,o.useEffect)((()=>d?d.on("documentColorsChanged",(e=>{let{colors:t}=e;v(t,"palette")})):()=>{})),(0,o.useEffect)((()=>a?a.on(l.m.PaletteUpdated,(e=>{v(e.colors,"palette")})):()=>{})),(0,o.useEffect)((()=>{v(n)}),[n]),(0,o.useEffect)((()=>{if(!m.current||f.current)return()=>{};const e=e=>{var t,i,o,l,d;if(e.source===(null===(t=m.current)||void 0===t?void 0:t.contentWindow))if("ready"===e.data.type)d=Object.assign(Object.assign({},n),{isThumbnail:c,appMode:r?"view":"editor",offline:p}),v(s,"palette"),v(d,"init"),f.current=!0;else if("interactivity"===e.data.type){if(c)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())}else"playAudio"===e.data.type&&(null===r||void 0===r||r.playAudio(e.data.data.data))};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}})),(0,i.jsx)("iframe",{ref:m,src:g?void 0:t,srcDoc:g?u: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%"}})},15262:(e,t,n)=>{n.r(t),n.d(t,{geniallyCodeEditorScript:()=>s});var i=n(45992),o=n(57277),l=n(87001),r=n(13844),d=n(96901);const s=e=>{let{script:t,editor:n}=e;const s=t.item;if(!s)return;const a=function(){let{isThumbnail:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=t.getConfig(),r=(0,d.m)({scriptId:s.scriptId,developmentUrl:s.developmentUrl,version:s.version});return(0,i.jsx)(l.q,{palette:n.getDocumentColors(),editor:n,config:o,url:r,isThumbnail:e})};(0,o.x)({getTargetNodeItem:()=>t.item,renderThumbnailApp:()=>(0,d.Y)(s.scriptId||"")?(0,i.jsx)(r.D,{}):a({isThumbnail:!0}),renderApp:()=>a(),nodePrefix:"geniallyCode"})({script:t,editor:n})}},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/")},57277:(e,t,n)=>{n.d(t,{x:()=>o});var i=n(70377);function o(e){let{getTargetNodeItem:t,renderApp:n,renderThumbnailApp:o,nodePrefix:l}=e;return e=>{let{script:r,editor:d}=e,s=null,a=[];function c(e){s&&(i.unmountComponentAtNode(s),s=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 u(){s&&i.render(n(),s)}function m(){const e=t(r.getConfig());if(!e)return;const n=`${l}-${e.id}`;"innerHtml"in e&&(e.innerHtml=`<div class="card-iframe"><div id="${n}" class="genially-widget-app" style="width: 100%; height: 100%;"></div></div>`),requestAnimationFrame((()=>{s="idOfFreeNode"in e?document.getElementById(e.idOfFreeNode)||null:document.getElementById(n)||null,u()}))}function f(){o&&a.length&&a.forEach((e=>{i.render(o(),e)}))}function p(){const e=t(r.getConfig());e&&"idOfThumbnailFreeNode"in e&&requestAnimationFrame((()=>{const t=document.getElementsByClassName(e.idOfThumbnailFreeNode);a=Array.from(t),f()}))}r.on("configChange",(e=>{let{config:n,prevConfig:i}=e;const o=t(n),l=i?t(i):void 0;l&&l!==o&&c(l),o&&(o!==l?(m(),p()):(u(),f()))})),r.on("dispose",(()=>{c(t(r.getConfig()))})),d.on("itemMount",(e=>{let{item:t}=e;t===r.item&&m()})),d.on("slideChange",(()=>{u()})),d.on("itemUnmount",(e=>{let{item:t}=e;t===r.item&&c()})),d.on("itemThumbnailMount",(e=>{let{item:t}=e;t===r.item&&p()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/5262.e9a69d7e.chunk.js.map