"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[5262],{87001:(e,t,n)=>{n.d(t,{q:()=>l});var i=n(45992),o=n(17588),r=n(60708);const l=e=>{let{url:t,config:n,view:l,editor:d,palette:a,slide:s,isThumbnail:c=!1,fullSource:u}=e;const m=(0,o.useRef)(null),g=(0,o.useRef)(!1),f=!!d,v=l&&l.isOffline,p=v&&u,h=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;h(t,"palette")})):()=>{})),(0,o.useEffect)((()=>s?s.on(r.m.PaletteUpdated,(e=>{h(e.colors,"palette")})):()=>{})),(0,o.useEffect)((()=>{h(n)}),[n]),(0,o.useEffect)((()=>{if(!m.current||g.current)return()=>{};const e=e=>{var t,i,o,r,s,u,p;if(e.source===(null===(t=m.current)||void 0===t?void 0:t.contentWindow))switch(e.data.type){case"ready":p=Object.assign(Object.assign({},n),{isThumbnail:c,appMode:l?"view":"editor",offline:v,logrocketData:f&&!c?d.getLogrocketId():void 0}),h(a,"palette"),h(p,"init"),g.current=!0;break;case"interactivity":{if(c)return;const t=e.data.data;"object"===typeof t?null===(i=null===l||void 0===l?void 0:l.runAction)||void 0===i||i.call(l,t):"string"===typeof t&&(null===(r=null===(o=null===l||void 0===l?void 0:l.getAction)||void 0===o?void 0:o.call(l,t))||void 0===r||r.run());break}case"playAudio":null===l||void 0===l||l.playAudio(e.data.data.data);break;case"setState":null===l||void 0===l||l.setVar("state",e.data.data);break;case"getState":{const t=(null===l||void 0===l?void 0:l.getVar("state"))||{},n={type:"stateResponse",requestId:e.data.requestId,data:JSON.parse(JSON.stringify(t))};null===(u=null===(s=m.current)||void 0===s?void 0:s.contentWindow)||void 0===u||u.postMessage(n,"*");break}}};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}})),(0,i.jsx)("iframe",{ref:m,src:p?void 0:t,srcDoc:p?u:void 0,style:{pointerEvents:l?"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:()=>a});var i=n(45992),o=n(57277),r=n(87001),l=n(13844),d=n(96901);const a=e=>{let{script:t,editor:n}=e;const a=t.item;if(!a)return;const s=function(){let{isThumbnail:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=t.getConfig(),l=(0,d.m)({scriptId:a.scriptId,developmentUrl:a.developmentUrl,version:a.version});return(0,i.jsx)(r.q,{palette:n.getDocumentColors(),editor:n,config:o,url:l,isThumbnail:e})};(0,o.x)({getTargetNodeItem:()=>t.item,renderThumbnailApp(){let{important:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,d.Y)(a.scriptId||"")&&!e?(0,i.jsx)(l.D,{}):s({isThumbnail:!0})},renderApp:()=>s(),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:r}=e;return e=>{let{script:l,editor:d}=e,a=null,s=[];function c(e){a&&(i.unmountComponentAtNode(a),a=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(){a&&i.render(n(),a)}function m(){const e=t(l.getConfig());if(!e)return;const n=`${r}-${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((()=>{a="idOfFreeNode"in e?document.getElementById(e.idOfFreeNode)||null:document.getElementById(n)||null,u()}))}function g(){o&&s.length&&s.forEach((e=>{const t="true"===e.dataset.critical,{renderingSlideId:n}=e.dataset;i.render(o({important:t,renderingSlideId:n}),e)}))}function f(){const e=t(l.getConfig());e&&"idOfThumbnailFreeNode"in e&&requestAnimationFrame((()=>{const t=document.getElementsByClassName(e.idOfThumbnailFreeNode);s=Array.from(t).filter((e=>e instanceof HTMLElement)),g()}))}l.on("configChange",(e=>{let{config:n,prevConfig:i}=e;const o=t(n),r=i?t(i):void 0;r&&r!==o&&c(r),o&&(o!==r?(m(),f()):(u(),g()))})),l.on("dispose",(()=>{c(t(l.getConfig()))})),d.on("itemMount",(e=>{let{item:t}=e;t===l.item&&m()})),d.on("slideChange",(()=>{u()})),d.on("itemUnmount",(e=>{let{item:t}=e;t===l.item&&c()})),d.on("itemThumbnailMount",(e=>{let{item:t}=e;t===l.item&&f()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/5262.c5198cb0.chunk.js.map