/* empty css                   */function R(){import.meta.url,import("_").catch(()=>1),async function*(){}().next()}(function(g,y,e){const{__:l,_x:_,sprintf:u}=g.wp.i18n;e(function(){e("#dialog").dialog({autoOpen:!1,show:{effect:"blind",duration:1e3},hide:{effect:"explode",duration:1e3}});const f=(t,a)=>{const o=document.getElementById(t);if(!o)return console.error("Template ".concat(t," not found")),document.createDocumentFragment();const n=o.content.cloneNode(!0);return n.querySelectorAll("*").forEach(r=>{if(r.hasAttribute("name")){const s=r.getAttribute("name")||"";r.setAttribute("name",s.replace(/\{\{ROW_INDEX\}\}/g,String(a)))}if(r.hasAttribute("value")){const s=r.getAttribute("value")||"";r.setAttribute("value",s.replace(/\{\{ROW_INDEX\}\}/g,String(a)))}if(r.hasAttribute("class")){const s=r.getAttribute("class")||"";r.setAttribute("class",s.replace(/\{\{ROW_INDEX\}\}/g,String(a)))}}),n},d=()=>{e(document.body).trigger("init_woosea_select2")},m=()=>{const t=e("tr.rowCount:last input[type=hidden]").val();return t!==void 0?Number(t):0};e(".add-field-mapping").on("click",function(){const t=m(),a=e("#addrow").val(),o=Number(t)+Number(a),n=Number(a)+1;e("#addrow").val(n);const i=f("adt-field-mapping-row-template",o);e("#woosea-fieldmapping-table tbody").append(i),d()}),e(".add-own-mapping").on("click",function(){const t=m(),a=e("#addrow").val(),o=Number(t)+Number(a),n=Number(a)+1;e("#addrow").val(n);const i=f("adt-custom-field-mapping-row-template",o);e("#woosea-fieldmapping-table tbody").append(i),d()});const v=t=>{const a=t.indexOf("PARAM_")>=0?/.*/:/^[a-zA-Zа-яА-Я_-]*$/,o=2,n=50;return a.test(t)?t.length<o?{valid:!1,message:u(l("Sorry, your custom field name needs to be at least %d letters long.","woo-product-feed-pro"),o)}:t.length>n?{valid:!1,message:u(l("Sorry, your custom field name cannot be over %d letters long.","woo-product-feed-pro"),n)}:{valid:!0}:{valid:!1,message:l("Sorry, when creating new custom fields only letters are allowed (so no white spaces, numbers or any other character are allowed).","woo-product-feed-pro")}},h=t=>{e(".notice").replaceWith("<div class='notice notice-error is-dismissible'><p>".concat(t,"</p></div>"))};e("#savebutton").on("click",function(){let t=!0,a="";e("#own-input-field").each(function(){const o=e(this).val(),n=v(o);if(!n.valid)return t=!1,a=n.message||"",!1}),t?e("#fieldmapping")[0].submit():(e("form").submit(function(o){return o.preventDefault(),!1}),h(a))}),e(document).on("change",".select-field",function(){const t=e(this),a=t.closest(".adt-field-mapping-select-field-wrapper"),o=a.find(".adt-static-value-wrapper"),n=a.find(".adt-page-url-attribute-wrapper"),i=a.find(".adt-post-url-attribute-wrapper"),r=o.find('input[type="text"]'),s=o.find('input[type="hidden"]'),b=n.find(".adt-page-url-select"),c=n.find('input[type="hidden"]'),w=i.find(".adt-post-url-select"),p=i.find('input[type="hidden"]');switch(o.hide(),r.prop("disabled",!0).val(""),s.prop("disabled",!0).val("false"),n.hide(),b.prop("disabled",!0).val(""),c.prop("disabled",!0).val("false"),i.hide(),w.prop("disabled",!0).val(""),p.prop("disabled",!0).val("false"),t.val()){case"static_value":o.show(),r.prop("disabled",!1),s.val("true"),s.prop("disabled",!1),r.focus();break;case"page_url":n.show(),b.prop("disabled",!1),c.val("true"),c.prop("disabled",!1),d();break;case"post_url":i.show(),w.prop("disabled",!1),p.val("true"),p.prop("disabled",!1),d();break}}),e(".delete-field-mapping").on("click",function(){confirm(l("Are you sure you want to delete the selected field mappings?","woo-product-feed-pro"))&&e("table tbody").find('input[name="record"]').each(function(){e(this).is(":checked")&&e(this).parents("tr").remove()})})})})(window,document,jQuery);export{R as __vite_legacy_guard};
