(function(){"use strict";window.kadenceAdvancedForm={error_item:1,clearForm(a){a.reset()},ensureLiveRegion(a){let b=a.querySelector(".kb-form-live-region");return b||(b=document.createElement("div"),b.className="kb-form-live-region",b.setAttribute("aria-live","polite"),b.setAttribute("aria-atomic","true"),b.setAttribute("role","status"),b.style.position="absolute",b.style.left="-10000px",b.style.width="1px",b.style.height="1px",b.style.overflow="hidden",a.appendChild(b)),b},announceMessage(a,b,c="polite"){const d=window.kadenceAdvancedForm.ensureLiveRegion(a);d.textContent="",d.setAttribute("aria-live",c),setTimeout(()=>{d.textContent=b},100)},insertAfter(a,b){b.parentNode.insertBefore(a,b.nextSibling)},markError(a,b,c,d=null,e=null){let f="";if(c.classList.contains("kb-adv-form-has-error")||c.classList.add("kb-adv-form-has-error"),a.classList.add("has-error"),b){switch(b){case"required":const c=a.getAttribute("data-kb-required-message");if(c&&""!==c){f=c;break}f=a.getAttribute("data-required-message"),f&&""!==f&&void 0!==f||(f=a.getAttribute("data-label"),(!f||""===f||void 0===f)&&(f=kb_adv_form_params.item),f=f+" "+kb_adv_form_params[b]);break;case"mismatch":f=a.getAttribute("data-mismatch-message"),f&&""!==f&&void 0!==f||(f=a.getAttribute("data-label"),(!f||""===f||void 0===f)&&(f=kb_adv_form_params.item),f=f+" "+kb_adv_form_params[b]);break;case"validation":f=a.getAttribute("data-validation-message"),f&&""!==f&&void 0!==f||(f=a.getAttribute("data-label"),(!f||""===f||void 0===f)&&(f=kb_adv_form_params.item),f=f+" "+kb_adv_form_params[b]);break;case"custom":const d=e?.message;f=d?d:a.getAttribute("data-label")+" has an issue"}const c=a.parentNode.querySelector(".kb-adv-form-error-msg");c&&c.remove();const g=a.getAttribute("name")+"-error";a.setAttribute("aria-describedby",g),a.setAttribute("aria-invalid","true");const h=document.createElement("div");h.id=g,h.classList.add("kb-adv-form-error-msg"),h.classList.add("kb-adv-form-message"),h.classList.add("kb-adv-form-warning"),h.innerHTML=window.kadenceAdvancedForm.strip_tags(f,"