function g(){import.meta.url,import("_").catch(()=>1),async function*(){}().next()}const{__:r}=wp.i18n;function m(s){return s.reduce((t,e)=>{var o;if(!e.value)return t;if(e.name.endsWith("[]")){const c=e.name.slice(0,-2);t[c]=(o=t[c])!=null?o:[],t[c].push(e.value)}else t[e.name]=e.value;return t},{})}function p(s,a){var t;jQuery("#title").val(s),(t=window.tinyMCE)==null||t.get("content").setContent(a)}const u={1:{product_name:r("Product Name","storeagent-ai-for-woocommerce")},2:{"tones[]":r("Tones","storeagent-ai-for-woocommerce")},3:{"interesting_facts[]":r("Interesting Facts","storeagent-ai-for-woocommerce")},4:{"age_focus[]":r("Age Focus","storeagent-ai-for-woocommerce")},5:{"target_audiences[]":r("Target Audience","storeagent-ai-for-woocommerce")},7:{"keywords[]":r("Keywords","storeagent-ai-for-woocommerce")}};function f(s){const a=s.data("step"),t=u[a]||{},e={};return Object.entries(t).forEach(([o,c])=>{const i=s.find('[name="'.concat(o,'"]'));if(i.length)if(o.endsWith("[]"))if(i.is(":checkbox"))i.filter(":checked").length===0&&(e[o]=r("Please select at least one ".concat(c," option"),"storeagent-ai-for-woocommerce"));else if(i.hasClass("select2-hidden-accessible")){const n=i.val();(!n||Array.isArray(n)&&n.length===0)&&(e[o]=r("Please input at least one ".concat(c),"storeagent-ai-for-woocommerce"))}else i.map((d,l)=>jQuery(l).val()).get().filter(Boolean).length===0&&(e[o]=r("Please input at least one ".concat(c),"storeagent-ai-for-woocommerce"));else{const n=i.val();(!n||typeof n=="string"&&n.trim()==="")&&(e[o]=r("".concat(c," is required"),"storeagent-ai-for-woocommerce"))}}),{isValid:Object.keys(e).length===0,errors:e}}function h(s){const a={};return Object.keys(u).forEach(t=>{const e=s.find(".saai-product-description-form-step-".concat(t)),o=f(e);Object.assign(a,o.errors)}),{isValid:Object.keys(a).length===0,errors:a}}export{u as S,g as __vite_legacy_guard,f as a,m as p,p as u,h as v};
