(()=>{window.Helpers.initCustomOptionCheck();let e=document.querySelector(".flatpickr"),t=document.querySelector(".contact-number-mask"),o=$("#plCountry"),i=document.querySelector("#plFurnishingDetails");t&&(t.addEventListener("input",e=>{e=e.target.value.replace(/\D/g,"");t.value=formatGeneral(e,{blocks:[3,3,4],delimiters:[" "," "]})}),registerCursorTracker({input:t,delimiter:" "})),o&&(o.wrap('<div class="position-relative"></div>'),o.select2({placeholder:"Select country",dropdownParent:o.parent()})),e&&e.flatpickr(),i&&new Tagify(i,{whitelist:["Fridge","TV","AC","WiFi","RO","Washing Machine","Sofa","Bed","Dining Table","Microwave","Cupboard"],maxTags:10,dropdown:{maxItems:20,classname:"tags-inline",enabled:0,closeOnSelect:!1}});var l=document.querySelector("#wizard-property-listing");if(null!==l){var s=l.querySelector("#wizard-property-listing-form"),u=s.querySelector("#personal-details"),c=s.querySelector("#property-details"),d=s.querySelector("#property-features"),p=s.querySelector("#property-area"),m=s.querySelector("#price-details"),g=[].slice.call(s.querySelectorAll(".btn-next")),s=[].slice.call(s.querySelectorAll(".btn-prev"));let t=new Stepper(l,{linear:!0}),o=FormValidation.formValidation(u,{fields:{plFirstName:{validators:{notEmpty:{message:"Please enter your first name"}}},plLastName:{validators:{notEmpty:{message:"Please enter your last name"}}}},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(){t.next()}),i=FormValidation.formValidation(c,{fields:{plPropertyType:{validators:{notEmpty:{message:"Please select property type"}}},plZipCode:{validators:{notEmpty:{message:"Please enter zip code"},stringLength:{min:4,max:10,message:"The zip code must be more than 4 and less than 10 characters long"}}}},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}}).on("core.form.valid",function(){t.next()});l=$("#plPropertyType");l.length&&(l.wrap('<div class="position-relative"></div>'),l.select2({placeholder:"Select property type",dropdownParent:l.parent()}).on("change",function(){i.revalidateField("plPropertyType")}));let a=FormValidation.formValidation(d,{fields:{},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}}).on("core.form.valid",function(){t.next()}),r=FormValidation.formValidation(p,{fields:{},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}}).on("core.form.valid",function(){t.next()}),n=FormValidation.formValidation(m,{fields:{},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}}).on("core.form.valid",function(){alert("Submitted..!!")});g.forEach(e=>{e.addEventListener("click",e=>{switch(t._currentIndex){case 0:o.validate();break;case 1:i.validate();break;case 2:a.validate();break;case 3:r.validate();break;case 4:n.validate()}})}),s.forEach(e=>{e.addEventListener("click",e=>{switch(t._currentIndex){case 4:case 3:case 2:case 1:t.previous()}})})}})();