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