(()=>{"use strict";const e=window.React,n=window.wp.blocks,t=window.wp.element,i=JSON.parse('{"UU":"em/event-when"}');(0,n.registerBlockType)(i.UU,{edit:function(){const n=(0,t.useRef)(null);function i(){const e=n.current;if(!e)return;const t=window._wpMetaBoxUrl;t&&fetch(t,{credentials:"same-origin"}).then(e=>e.text()).then(n=>{const t=(new DOMParser).parseFromString(n,"text/html"),i=t.getElementById("em-event-when")?.querySelector(".inside"),c=t.getElementById("em-event-recurring")?.querySelector(".inside");if("function"==typeof window.em_unsetup_ui_elements)try{window.em_unsetup_ui_elements(e)}catch(e){}if(e.innerHTML="",i&&e.insertAdjacentHTML("beforeend",i.innerHTML),c&&e.insertAdjacentHTML("beforeend",'<div class="em-recurrences-section">'+c.innerHTML+"</div>"),"function"==typeof window.em_setup_ui_elements)try{window.em_setup_ui_elements(e)}catch(e){}}).catch(e=>{console.error("[EM] event-when block: fetch failed",e)})}return(0,t.useEffect)(()=>(i(),window.emReloadWhenBlock=i,()=>{window.emReloadWhenBlock=null;const e=n.current;if(e&&"function"==typeof window.em_unsetup_ui_elements)try{window.em_unsetup_ui_elements(e)}catch(e){}}),[]),(0,e.createElement)("div",{className:"em-event-when-block em",ref:n})},save:()=>null})})();