document.addEventListener("DOMContentLoaded",function(e){{let t=document.querySelector(".credit-card-mask"),n=document.querySelector(".expiry-date-mask"),a=document.querySelector(".cvv-code-mask"),e=(t&&(t.addEventListener("input",e=>{t.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="19"/>`:""}),registerCursorTracker({input:t,delimiter:" "})),n&&(n.addEventListener("input",e=>{n.value=formatDate(e.target.value,{delimiter:"/",datePattern:["m","y"]})}),registerCursorTracker({input:n,delimiter:"/"})),a&&a.addEventListener("input",e=>{e=e.target.value.replace(/\D/g,"");a.value=formatNumeral(e,{numeral:!0,numeralPositiveOnly:!0})}),document.getElementById("formAccountSettings")),r=document.querySelector(".mobile-number"),i=document.querySelector(".zip-code"),o=document.getElementById("creditCardForm");e&&FormValidation.formValidation(e,{fields:{companyName:{validators:{notEmpty:{message:"Please enter company name"}}},billingEmail:{validators:{notEmpty:{message:"Please enter billing email"},emailAddress:{message:"Please enter valid email address"}}}},plugins:{trigger:new FormValidation.plugins.Trigger,bootstrap5:new FormValidation.plugins.Bootstrap5({eleValidClass:"",rowSelector:".form-control-validation"}),submitButton:new FormValidation.plugins.SubmitButton,autoFocus:new FormValidation.plugins.AutoFocus}}),o&&FormValidation.formValidation(o,{fields:{paymentCard:{validators:{notEmpty:{message:"Please enter your credit card number"}}}},plugins:{trigger:new FormValidation.plugins.Trigger,bootstrap5:new FormValidation.plugins.Bootstrap5({eleValidClass:""}),submitButton:new FormValidation.plugins.SubmitButton,autoFocus:new FormValidation.plugins.AutoFocus},init:e=>{e.on("plugins.message.placed",function(e){e.element.parentElement.classList.contains("input-group")&&e.element.parentElement.insertAdjacentElement("afterend",e.messageElement)})}});var l=document.querySelector(".cancel-subscription");l&&(l.onclick=function(){Swal.fire({text:"Are you sure you would like to cancel your subscription?",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes",customClass:{confirmButton:"btn btn-primary me-2",cancelButton:"btn btn-label-secondary"},buttonsStyling:!1}).then(function(e){e.value?Swal.fire({icon:"success",title:"Unsubscribed!",text:"Your subscription cancelled successfully.",customClass:{confirmButton:"btn btn-success"}}):e.dismiss===Swal.DismissReason.cancel&&Swal.fire({title:"Cancelled",text:"Unsubscription Cancelled!!",icon:"error",customClass:{confirmButton:"btn btn-success"}})})}),r&&(r.addEventListener("input",e=>{e=e.target.value.replace(/\D/g,"");r.value=formatGeneral(e,{blocks:[3,3,4],delimiters:[" "," "]})}),registerCursorTracker({input:r,delimiter:" "})),i&&i.addEventListener("input",e=>{i.value=formatNumeral(e.target.value,{delimiter:"",numeral:!0})})}}),$(function(){var e=$(".select2");e.length&&e.each(function(){var e=$(this);e.wrap('<div class="position-relative"></div>'),e.select2({dropdownParent:e.parent()})})});