$(function(){var e=$(".select2");e.length&&e.each(function(){var e=$(this);e.wrap('<div class="position-relative"></div>'),e.select2({placeholder:"Select an country",dropdownParent:e.parent()})})}),document.addEventListener("DOMContentLoaded",function(e){var m=document.querySelector("#multiStepsValidation");if(null!==m){var d=m.querySelector("#multiStepsForm");let e=d.querySelector("#accountDetailsValidation");var c=d.querySelector("#personalInfoValidation"),p=d.querySelector("#billingLinksValidation"),g=[].slice.call(d.querySelectorAll(".btn-next")),d=[].slice.call(d.querySelectorAll(".btn-prev"));let t=document.querySelector(".multi-steps-exp-date"),a=document.querySelector(".multi-steps-cvv"),n=document.querySelector(".multi-steps-mobile"),r=document.querySelector(".multi-steps-pincode"),i=document.querySelector(".multi-steps-card"),s=(t&&(t.addEventListener("input",e=>{t.value=formatDate(e.target.value,{date:!0,delimiter:"/",datePattern:["m","y"]})}),registerCursorTracker({input:t,delimiter:"/"})),a&&a.addEventListener("input",e=>{e=e.target.value.replace(/\D/g,"");a.value=formatNumeral(e,{numeral:!0,numeralPositiveOnly:!0})}),n&&(n.addEventListener("input",e=>{e=e.target.value.replace(/\D/g,"");n.value=formatGeneral(e,{blocks:[3,3,4],delimiters:[" "," "]})}),registerCursorTracker({input:n,delimiter:" "})),r&&r.addEventListener("input",e=>{r.value=formatNumeral(e.target.value,{delimiter:"",numeral:!0})}),i&&(i.addEventListener("input",e=>{i.value=formatCreditCard(e.target.value);e=e.target.value.replace(/\D/g,""),e=getCreditCardType(e);document.querySelector(".card-type").innerHTML=e&&"unknown"!==e&&"general"!==e?`<img src="${assetsPath}img/icons/payments/${e}-cc.png" height="20"/>`:""}),registerCursorTracker({input:i,delimiter:" "})),new Stepper(m,{linear:!0})),l=FormValidation.formValidation(e,{fields:{multiStepsUsername:{validators:{notEmpty:{message:"Please enter username"},stringLength:{min:6,max:30,message:"The name must be more than 6 and less than 30 characters long"},regexp:{regexp:/^[a-zA-Z0-9 ]+$/,message:"The name can only consist of alphabetical, number and space"}}},multiStepsEmail:{validators:{notEmpty:{message:"Please enter email address"},emailAddress:{message:"The value is not a valid email address"}}},multiStepsPass:{validators:{notEmpty:{message:"Please enter password"}}},multiStepsConfirmPass:{validators:{notEmpty:{message:"Confirm Password is required"},identical:{compare:function(){return e.querySelector('[name="multiStepsPass"]').value},message:"The password and its confirm are not the same"}}}},plugins:{trigger:new FormValidation.plugins.Trigger,bootstrap5:new FormValidation.plugins.Bootstrap5({eleValidClass:"",rowSelector:".form-control-validation"}),autoFocus:new FormValidation.plugins.AutoFocus,submitButton:new FormValidation.plugins.SubmitButton},init:e=>{e.on("plugins.message.placed",function(e){e.element.parentElement.classList.contains("input-group")&&e.element.parentElement.insertAdjacentElement("afterend",e.messageElement)})}}).on("core.form.valid",function(){s.next()}),o=FormValidation.formValidation(c,{fields:{multiStepsFirstName:{validators:{notEmpty:{message:"Please enter first name"}}},multiStepsAddress:{validators:{notEmpty:{message:"Please enter your address"}}}},plugins:{trigger:new FormValidation.plugins.Trigger,bootstrap5:new FormValidation.plugins.Bootstrap5({eleValidClass:"",rowSelector:function(e,t){switch(e){case"multiStepsFirstName":case"multiStepsAddress":return".form-control-validation";default:return".row"}}}),autoFocus:new FormValidation.plugins.AutoFocus,submitButton:new FormValidation.plugins.SubmitButton}}).on("core.form.valid",function(){s.next()}),u=FormValidation.formValidation(p,{fields:{multiStepsCard:{validators:{notEmpty:{message:"Please enter card number"}}}},plugins:{trigger:new FormValidation.plugins.Trigger,bootstrap5:new FormValidation.plugins.Bootstrap5({eleValidClass:"",rowSelector:function(e,t){return".form-control-validation"}}),autoFocus:new FormValidation.plugins.AutoFocus,submitButton:new FormValidation.plugins.SubmitButton},init:e=>{e.on("plugins.message.placed",function(e){e.element.parentElement.classList.contains("input-group")&&e.element.parentElement.insertAdjacentElement("afterend",e.messageElement)})}}).on("core.form.valid",function(){alert("Submitted..!!")});g.forEach(e=>{e.addEventListener("click",e=>{switch(s._currentIndex){case 0:l.validate();break;case 1:o.validate();break;case 2:u.validate()}})}),d.forEach(e=>{e.addEventListener("click",e=>{switch(s._currentIndex){case 2:case 1:s.previous()}})})}});