"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"),n=$("<img>",{class:"rounded-circle me-2",width:26,src:e}),r=$("<span>",{text:" "+t.text});return r.prepend(n),r})(t)}})};return{init:function(){(()=>{const t=document.getElementById("kt_ecommerce_settings_general_form");if(!t)return;const e=t.querySelectorAll(".required");var n,r={fields:{},plugins:{trigger:new FormValidation.plugins.Trigger,bootstrap:new FormValidation.plugins.Bootstrap5({rowSelector:".fv-row",eleInvalidClass:"",eleValidClass:""})}};e.forEach((t=>{const e=t.closest(".fv-row").querySelector("input");e&&(n=e);const o=t.closest(".fv-row").querySelector("select");o&&(n=o);const i=n.getAttribute("name");r.fields[i]={validators:{notEmpty:{message:t.innerText+" is required"}}}}));var o=FormValidation.formValidation(t,r);const i=t.querySelector('[data-kt-contacts-type="submit"]');i.addEventListener("click",(function(t){t.preventDefault(),o&&o.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"}})}))}))})(),t()}}}();KTUtil.onDOMContentLoaded((function(){KTAppEcommerceSettings.init()}));