(()=>{"use strict";var e,t={63599(e,t,a){window.React;const n=window.wp.element;var o=a(3453);const l=window.wp.i18n,i=window.wp.components,c=function(e){var t,a,c,s=e.isVisible,r=e.onClose,u=(0,n.useState)(!1),d=(0,o.A)(u,2),m=d[0],p=d[1],b=function(){r()};return s?React.createElement(i.Modal,{title:(0,l.__)("AI Product Generator","essential-blocks"),size:"large",onRequestClose:b,className:"eb-ai-woo-popover"},"1"!==(null===(t=window.EssentialBlocksLocalize)||void 0===t?void 0:t.hasOpenAiApiKey)&&React.createElement("div",{className:"eb-ai-api-key-warning"},React.createElement("p",null,(0,l.__)("Please add your OpenAI API Key to use this feature.","essential-blocks")," ",React.createElement("a",{href:"".concat(null===(a=window.EssentialBlocksLocalize)||void 0===a?void 0:a.eb_admin_url,"admin.php?page=essential-blocks&tab=ai-suite"),target:"_blank",rel:"noopener noreferrer"},(0,l.__)("Go to Settings","essential-blocks")))),React.createElement("div",{className:"eb-ai-woo-popover-content"},React.createElement("div",{className:"eb-ai-header"},React.createElement("div",{className:"eb-ai-logo"},React.createElement("img",{src:"".concat(null===(c=window.EssentialBlocksLocalize)||void 0===c?void 0:c.eb_plugins_url,"assets/images/eb-logo.svg"),alt:"Essential Blocks Icon",className:"eb-ai-logo-icon"})),React.createElement("div",{className:"eb-ai-header-content"},React.createElement("h4",{style:{margin:"0 0 8px 0",fontSize:"16px",fontWeight:"600"}},(0,l.__)("AI Product Generator","essential-blocks")),React.createElement("p",{style:{margin:"0 0 16px 0",fontSize:"13px",color:"#666"}},"Generate WooCommerce products with the power of AI")),React.createElement(i.Button,{variant:"custom",className:"eb-ai-close-button",onClick:b},React.createElement(i.Dashicon,{icon:"no-alt"}))),React.createElement("div",{className:"eb-ai-content"},React.createElement("div",{className:"eb-ai-hello-message"},React.createElement("h3",null,(0,l.__)("Hello!","essential-blocks")),React.createElement("p",null,(0,l.__)("This is a placeholder for the AI product generation feature. The actual AI functionality will be implemented in future iterations.","essential-blocks")),React.createElement("div",{className:"eb-ai-demo-actions"},React.createElement(i.Button,{variant:"primary",onClick:function(){p(!0),setTimeout(function(){p(!1),alert((0,l.__)("AI product generation will be implemented here!","essential-blocks"))},2e3)},disabled:m,className:"eb-ai-demo-button"},m?React.createElement(React.Fragment,null,React.createElement("span",{className:"eb-ai-generating-spinner"}),(0,l.__)("Generating...","essential-blocks")):(0,l.__)("Demo Generate","essential-blocks"))))))):null},s=function(){var e,t,a=(0,n.useState)(!1),s=(0,o.A)(a,2),r=s[0],u=s[1];return null!==(e=window.EssentialBlocksLocalize)&&void 0!==e&&e.hasOpenAiApiKey?React.createElement(React.Fragment,null,React.createElement(i.Button,{onClick:function(){u(!r)},className:"eb-ai-woo-button page-title-action",variant:"secondary"},React.createElement("img",{src:"".concat(null===(t=window.EssentialBlocksLocalize)||void 0===t?void 0:t.eb_plugins_url,"assets/images/eb-logo.svg"),alt:"Essential Blocks Icon",className:"eb-ai-woo-button-icon"}),(0,l.__)("Generate with AI","essential-blocks")),r&&React.createElement(c,{isVisible:r,onClose:function(){u(!1)}})):null};console.log("AI for WooCommerce loaded"),document.addEventListener("DOMContentLoaded",function(){var e=function(){var e=window.location.href;return e.includes("post.php")&&e.includes("action=edit")&&document.querySelector("body.post-type-product")||e.includes("post-new.php")&&e.includes("post_type=product")};if(console.log("isWooProductPage",e()),e()){var t=document.createElement("div");t.classList.add("eb-ai-woo-button-wrapper"),(0,n.createRoot)(t).render(React.createElement(s,null));var a=function(){var e=document.querySelector(".page-title-action");e&&!document.querySelector(".eb-ai-woo-button-wrapper")&&e.parentNode.insertBefore(t,e.nextSibling)};a(),setTimeout(a,100),setTimeout(a,500),setTimeout(a,1e3),new MutationObserver(function(e){e.forEach(function(e){"childList"===e.type&&a()})}).observe(document.body,{childList:!0,subtree:!0})}})}},a={};function n(e){var o=a[e];if(void 0!==o)return o.exports;var l=a[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,a,o,l)=>{if(!a){var i=1/0;for(u=0;u<e.length;u++){for(var[a,o,l]=e[u],c=!0,s=0;s<a.length;s++)(!1&l||i>=l)&&Object.keys(n.O).every(e=>n.O[e](a[s]))?a.splice(s--,1):(c=!1,l<i&&(i=l));if(c){e.splice(u--,1);var r=o();void 0!==r&&(t=r)}}return t}l=l||0;for(var u=e.length;u>0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[a,o,l]},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.j=2422,(()=>{var e={2422:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var o,l,[i,c,s]=a,r=0;if(i.some(t=>0!==e[t])){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(s)var u=s(n)}for(t&&t(a);r<i.length;r++)l=i[r],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(u)},a=globalThis.webpackChunkessential_blocks=globalThis.webpackChunkessential_blocks||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var o=n.O(void 0,[3935],()=>n(63599));o=n.O(o)})();