"use strict";var KTAppEcommerceSettings=function(){const t=()=>{$('[data-kt-ecommerce-settings-type="select2_flags"]').select2({templateResult:function(t){return(t=>{if(!t.id)return t.text;var e="assets/media/"+t.element.getAttribute("data-kt-select2-country"),r=$("<img>",{class:"rounded-circle me-2",width:26,src:e}),n=$("<span>",{text:" "+t.text});return n.prepend(r),n})(t)}})};return{init:function(){["kt_ecommerce_settings_general_form","kt_ecommerce_settings_general_store","kt_ecommerce_settings_general_localization","kt_ecommerce_settings_general_products","kt_ecommerce_settings_general_customers"].forEach((t=>{const e=document.getElementById(t);if(!e)return;const r=e.querySelectorAll(".required");var n,o={fields:{},plugins:{trigger:new FormValidation.plugins.Trigger,bootstrap:new FormValidation.plugins.Bootstrap5({rowSelector:".fv-row",eleInvalidClass:"",eleValidClass:""})}};r.forEach((t=>{const e=t.closest(".row").querySelector("input");e&&(n=e);const r=t.closest(".row").querySelector("textarea");r&&(n=r);const s=t.closest(".row").querySelector("select");s&&(n=s);const i=n.getAttribute("name");o.fields[i]={validators:{notEmpty:{message:t.innerText+" is required"}}}}));var s=FormValidation.formValidation(e,o);const i=e.querySelector('[data-kt-ecommerce-settings-type="submit"]');i.addEventListener("click",(function(t){t.preventDefault(),s&&s.validate().then((function(t){console.log("validated!"),"Valid"==t?(i.setAttribute("data-kt-indicator","on"),i.disabled=!0,setTimeout((function(){i.removeAttribute("data-kt-indicator"),i.disabled=!1,Swal.fire({text:"Form has been successfully submitted!",icon:"success",buttonsStyling:!1,confirmButtonText:"Ok, got it!",customClass:{confirmButton:"btn btn-primary"}})}),2e3)):Swal.fire({text:"Oops! There are some error(s) detected.",icon:"error",buttonsStyling:!1,confirmButtonText:"Ok, got it!",customClass:{confirmButton:"btn btn-primary"}})}))}))})),document.querySelectorAll('[data-kt-ecommerce-settings-type="tagify"]').forEach((t=>{new Tagify(t)})),t()}}}();KTUtil.onDOMContentLoaded((function(){KTAppEcommerceSettings.init()}));