$((function(){var e=function(e){$(".contact-error-message").html(e).show()},t=function(t){var r="";$.each(t,(function(e,t){""!==r&&(r+="<br />"),r+=t})),e(r)};$(document).on("submit",".contact-form",(function(r){r.preventDefault(),r.stopPropagation();var s=$(this),o=s.find("button[type=submit]");$(".contact-success-message").html("").hide(),$(".contact-error-message").html("").hide(),$.ajax({type:"POST",cache:!1,url:s.prop("action"),data:new FormData(s[0]),contentType:!1,processData:!1,beforeSend:function(){return o.addClass("button-loading")},success:function(t){var r=t.error,o=t.message;r?e(o):(s[0].reset(),function(e){$(".contact-success-message").html(e).show()}(o)),"undefined"!=typeof refreshRecaptcha&&refreshRecaptcha()},error:function(r){var s;"undefined"!=typeof refreshRecaptcha&&refreshRecaptcha(),void 0!==(s=r).errors&&s.errors.length?t(s.errors):void 0!==s.responseJSON?void 0!==s.responseJSON.errors?422===s.status&&t(s.responseJSON.errors):void 0!==s.responseJSON.message?e(s.responseJSON.message):$.each(s.responseJSON,(function(t,r){$.each(r,(function(t,r){e(r)}))})):e(s.statusText)},complete:function(){return o.removeClass("button-loading")}})}))}));