(()=>{var e={1948(){document.addEventListener("DOMContentLoaded",()=>{window.elementor?.channels?.editor&&window.elementor.channels.editor.on("saved",()=>{const e=elementor?.config?.document?.id;e&&setTimeout(()=>(async e=>{try{const t=await new Promise((e,t)=>{const n=document.querySelector("#elementor-preview-iframe");if(!n)return t("Elementor iframe not found");const o=setInterval(()=>{try{n.contentDocument&&"complete"===n.contentDocument.readyState&&n.contentDocument.body&&n.contentDocument.body.innerHTML.trim().length>0&&(clearInterval(o),e(n.contentDocument))}catch(e){console.warn("Waiting for Elementor iframe...")}},500);setTimeout(()=>{clearInterval(o),t(" Timeout: Elementor iframe not ready")},1e4)}),n=t.querySelector('.elementor[data-elementor-type="wp-post"]');if(!n)throw new Error("Could not find the Elementor content area.");const o=await(async(e,t)=>{const n=t.createElement("style");n.id="temp-hide-editor-ui-for-screenshot",n.innerHTML="\n        /* Hide Elementor editor wizards and placeholders */\n        .elementor-add-new-section,\n        .elementor-editor-active .elementor-widget-empty-icon,\n        .elementor-widget-empty .elementor-widget-empty-icon,\n        .elementor-add-section-area,\n\t\t.elementor-empty-view,\n\t\t.elementor-editor-active .elementor-add-section,\n        .elementor-editor-element-settings {\n            display: none !important;\n        }\n    ",t.head.appendChild(n);const o=await html2canvas(e,{allowTaint:!0,useCORS:!0,backgroundColor:"#fff",scale:2});return t.getElementById("temp-hide-editor-ui-for-screenshot").remove(),o.toDataURL("image/jpeg",.9)})(n,t);await(async(e,t)=>await wp.apiFetch({path:`/eventin/v2/templates/${t}/thumbnail`,method:"POST",data:{thumbnail:e}}))(o,e)}catch(e){console.error("Thumbnail generation failed:",e)}})(e),1500)})})}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";n(1948)})()})();