!function(){"use strict";function e(){const e=document.querySelectorAll(".eryndo-contact-form");0!==e.length&&e.forEach((function(e){e.addEventListener("submit",t)}))}function t(e){e.preventDefault(),e.stopPropagation();const t=e.target,o=t.querySelector(".submit-button"),r=t.querySelector(".form-messages")||function(e){const t=document.createElement("div");return t.className="form-messages",e.appendChild(t),t}(t);if("undefined"==typeof eryndoContactForm)return void n(r,"Configuration error. Please contact the site administrator.","error");o.disabled=!0,o.classList.add("submitting"),r.innerHTML="";const a=new FormData(t);a.append("action","eryndo_contact_form_submit"),a.append("nonce",eryndoContactForm.nonce);const s=t.getAttribute("data-recipient");return s&&a.append("recipient_email",s),fetch(eryndoContactForm.ajaxUrl,{method:"POST",body:a,credentials:"same-origin"}).then((function(e){if(!e.ok)throw new Error("Network response was not ok");return e.json()})).then((function(e){e.success?(n(r,e.data.message,"success"),t.reset()):n(r,e.data.message||"An error occurred. Please try again.","error")})).catch((function(e){n(r,"An error occurred. Please try again.","error")})).finally((function(){o.disabled=!1,o.classList.remove("submitting")})),!1}function n(e,t,n){const o=document.createElement("div");o.className="form-message "+n+"-message",o.textContent=t,o.style.opacity="1",o.style.transition="opacity 0.4s ease",e.appendChild(o),setTimeout((function(){o.style.opacity="0",setTimeout((function(){o.parentNode&&o.remove()}),400)}),5e3)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}();