/*! For license information please see formSubmit.js.LICENSE.txt */ (()=>{"use strict";const t=window.wp.hooks;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],a=i[4],s=this.prev,l=i[1],u=i[2];if(-1===i[0])return n("end"),!1;if(!l&&!u)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=s){if(s=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:O(e),r,n},"next"===this.method&&(this.arg=t),m}},r}function a(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r4&&void 0!==j[4]&&j[4],d=!1,m=null,v=null,p={},h=function(t,e){m||(m=t,v=e,p=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})},y=null,0===(g=l.querySelectorAll('input[data-unique="true"]')).length){e.next=15;break}b={},w=a(g);try{for(w.s();!(S=w.n()).done;)_=S.value,k=_.name,x=_.value,b[k]=x}catch(t){w.e(t)}finally{w.f()}return e.next=14,f(b,r,o,s);case 14:y=e.sent;case 15:E=u?[l]:Array.from(l.querySelectorAll(".srfm-block-single")),A=a(E),e.prev=17,P=i().mark((function e(){var n,o,a,s,l,u,f,m,v,p,g,b,w,S,_,k,x,E,A,P,j,q,L,C,T,I,F,N,U,G,D,R,M,B,V,H,z,J,K,W,Y,$,X,Z,Q,tt,et,rt,nt,ot,it,at,st,lt,ut,ct,ft,dt,mt,vt,pt,ht,yt,gt,bt,wt,St,_t,kt,xt,Et,At,Ot,Pt,jt,qt,Lt,Ct,Tt,It,Ft,Nt,Ut,Gt,Dt,Rt,Mt,Bt;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=O.value,s=!1,Array.isArray(null===(n=window.sureforms)||void 0===n?void 0:n.skipValidationCallbacks)&&window.sureforms.skipValidationCallbacks.forEach((function(t){"function"==typeof t&&(s=s||t(a))})),!s){e.next=5;break}return e.abrupt("return",0);case 5:if(a.closest("form").getAttribute("form-id")===r){e.next=9;break}return e.abrupt("return",0);case 9:e.t0=!0,e.next=e.t0===a.classList.contains("srfm-phone-block")?12:15;break;case 12:return l=a.querySelector(".srfm-input-phone"),u=null===(o=l)||void 0===o||null===(o=o.nextElementSibling)||void 0===o?void 0:o.value,e.abrupt("break",18);case 15:return l=a.querySelector("input, textarea, select"),u=l.value,e.abrupt("break",18);case 18:if(f=l.getAttribute("data-required"),m=l.getAttribute("data-unique"),v=l.getAttribute("name"),p=a.querySelector(".srfm-error-message"),v&&(v=v.replace(/_/g," ")),f&&"hidden"!==l.type&&("true"!==f||u?l&&(null===(b=window)||void 0===b||null===(b=b.srfm)||void 0===b||b.toggleErrorState(l.closest(".srfm-block"),!1)):(l&&(null===(g=window)||void 0===g||null===(g=g.srfm)||void 0===g||g.toggleErrorState(l.closest(".srfm-block"),!0)),p&&(p.textContent=p.getAttribute("data-error-msg")),d=!0,h(l,l.closest(".srfm-block"))),l.addEventListener("input",(function(){var t;null===(t=window)||void 0===t||null===(t=t.srfm)||void 0===t||t.toggleErrorState(l.closest(".srfm-block"),!1)}))),"true"===m&&""!==u&&((null===(w=y)||void 0===w?void 0:w.some((function(t){return"not unique"===t[v]})))?(l&&(null===(S=window)||void 0===S||null===(S=S.srfm)||void 0===S||S.toggleErrorState(l.closest(".srfm-block"),!0)),p.style.display="block",p.textContent=p.getAttribute("data-unique-msg"),d=!0,h(l,l.closest(".srfm-block"))):l&&(null===(_=window)||void 0===_||null===(_=_.srfm)||void 0===_||_.toggleErrorState(l.closest(".srfm-block"),!1),p.style.display="none")),!(a.classList.contains("srfm-multi-choice-block")||a.classList.contains("srfm-checkbox-block")||a.classList.contains("srfm-gdpr-block"))){e.next=41;break}k=a.querySelectorAll("input"),x=k[0].getAttribute("data-required"),E=!1,A=null,P=0;case 31:if(!(P0&&t.slice(0,l).length>a?null===(e=window)||void 0===e||null===(e=e.srfm)||void 0===e?void 0:e.srfmSprintfString(null===(r=window)||void 0===r||null===(r=r.srfm_submit)||void 0===r||null===(r=r.messages)||void 0===r?void 0:r.srfm_email_local_max_length,a):s>0&&t.slice(l+1).length>s?null===(n=window)||void 0===n||null===(n=n.srfm)||void 0===n?void 0:n.srfmSprintfString(null===(o=window)||void 0===o||null===(o=o.srfm_submit)||void 0===o||null===(o=o.messages)||void 0===o?void 0:o.srfm_email_domain_max_length,s):""},(G=u?U(u):"")&&(p&&(p.textContent=G,p.style.display="block"),null===(D=window)||void 0===D||null===(D=D.srfm)||void 0===D||D.toggleErrorState(F,!0),h(l,F),d=!0),N&&(R=N.querySelector(".srfm-input-email-confirm"),M=N.querySelector(".srfm-input-email-confirm").value,B=N.querySelector(".srfm-error-message"),!M&&B&&"true"===f?(B.textContent=B.getAttribute("data-error-msg"),null===(V=window)||void 0===V||null===(V=V.srfm)||void 0===V||V.toggleErrorState(N,!0),h(R,N),d=!0):M!==u?(null===(H=window)||void 0===H||null===(H=H.srfm)||void 0===H||H.toggleErrorState(N,!0),B&&(B.textContent=null===(z=window)||void 0===z||null===(z=z.srfm_submit)||void 0===z||null===(z=z.messages)||void 0===z?void 0:z.srfm_confirm_email_same),h(R,N),d=!0):null===(J=window)||void 0===J||null===(J=J.srfm)||void 0===J||J.toggleErrorState(N,!1),(K=M?U(M):"")&&(B&&(B.textContent=K,B.style.display="block"),null===(W=window)||void 0===W||null===(W=W.srfm)||void 0===W||W.toggleErrorState(N,!0),h(R,N),d=!0),R.addEventListener("input",(function(){var t;null===(t=window)||void 0===t||null===(t=t.srfm)||void 0===t||t.toggleErrorState(N,!1)}))),F.querySelector(".srfm-input-email").addEventListener("input",(function(){var t;null===(t=window)||void 0===t||null===(t=t.srfm)||void 0===t||t.toggleErrorState(F,!1)}))),a.classList.contains("srfm-upload-block")&&(Y=a.querySelector(".srfm-input-upload"),"true"!==($=Y.getAttribute("data-required"))||Y.value?l&&(null===(Z=window)||void 0===Z||null===(Z=Z.srfm)||void 0===Z||Z.toggleErrorState(l.closest(".srfm-block"),!1)):("true"===$&&p&&(p.textContent=p.getAttribute("data-error-msg")),l&&(null===(X=window)||void 0===X||null===(X=X.srfm)||void 0===X||X.toggleErrorState(l.closest(".srfm-block"),!0)),d=!0,h(Y,a)),Y.addEventListener("input",(function(){var t;l&&(null===(t=window)||void 0===t||null===(t=t.srfm)||void 0===t||t.toggleErrorState(l.closest(".srfm-block"),!1))}))),a.classList.contains("srfm-number-block")&&(Q=l.getAttribute("min"),tt=l.getAttribute("max"),et=l.getAttribute("format-type"),u&&(rt="eu-style"===et?parseFloat(u.replace(/\./g,"").replace(",",".")):parseFloat(u.replace(/,/g,"")),(Q||tt)&&(ot=!1,it="",Q&&""!==Q&&Number(rt)Number(tt)&&(ot=!0,it=null===(lt=window)||void 0===lt||null===(lt=lt.srfm)||void 0===lt?void 0:lt.srfmSprintfString(null===(ut=window)||void 0===ut||null===(ut=ut.srfm_submit)||void 0===ut||null===(ut=ut.messages)||void 0===ut?void 0:ut.srfm_input_max_value,tt)),null===(nt=window)||void 0===nt||null===(nt=nt.srfm)||void 0===nt||nt.toggleErrorState(l.closest(".srfm-block"),ot),p&&(p.textContent=ot?it:"",ot&&(d=!0,h(l,a)))))),a.classList.contains("srfm-textarea-block")&&!a.classList.contains("srfm-richtext")&&(ct=a.querySelector("textarea"))&&(ft=ct.getAttribute("data-minlength"),dt=ct.getAttribute("maxlength"),mt=Number(ft),vt=Number(dt),ft&&mt>0&&(!dt||vt<=0||mt<=vt)&&""!==u&&u.lengthi){var c,f,m;p.textContent=null===(c=window)||void 0===c||null===(c=c.srfm)||void 0===c?void 0:c.srfmSprintfString(null===(f=window)||void 0===f||null===(f=f.srfm_submit)||void 0===f||null===(f=f.messages)||void 0===f?void 0:f.srfm_dropdown_max_selections,i),null===(m=window)||void 0===m||null===(m=m.srfm)||void 0===m||m.toggleErrorState(t.closest(".srfm-block"),!0),d=!0}}}else{var v;null===(v=window)||void 0===v||null===(v=v.srfm)||void 0===v||v.toggleErrorState(t.closest(".srfm-block"),!1)}else p.textContent=p.getAttribute("data-error-msg"),null===(e=window)||void 0===e||null===(e=e.srfm)||void 0===e||e.toggleErrorState(t.closest(".srfm-block"),!0),d=!0;if(d){var y,g=(null===(y=window)||void 0===y||null===(y=y.srfm)||void 0===y?void 0:y[n])||t;h(g,t.closest(".srfm-block"),{shouldDelayOnFocus:!0})}new jt((function(){var e;if(t.value)null===(e=window)||void 0===e||null===(e=e.srfm)||void 0===e||e.toggleErrorState(t.closest(".srfm-block"),!1);else if("true"===r){var n;null===(n=window)||void 0===n||null===(n=n.srfm)||void 0===n||n.toggleErrorState(t.closest(".srfm-block"),!0)}})).observe(t,{attributes:!0,attributeFilter:["value"]})}))),a.classList.contains("srfm-multi-choice-block")){for(qt=a.querySelectorAll("input"),Lt=qt[0].getAttribute("data-min-selection"),Ct=qt[0].getAttribute("data-max-selection"),Tt=null,It=0,Ft=!1,Nt=0;Nt0&&(!Ft&&Lt>0&&(f&&Lt>1||!f)&&It0&&It>Ct&&(p.textContent=null===(Dt=window)||void 0===Dt||null===(Dt=Dt.srfm)||void 0===Dt?void 0:Dt.srfmSprintfString(null===(Rt=window)||void 0===Rt||null===(Rt=Rt.srfm_submit)||void 0===Rt||null===(Rt=Rt.messages)||void 0===Rt?void 0:Rt.srfm_multi_choice_max_selections,Ct),Ft=!0),Ft?(null===(Mt=window)||void 0===Mt||null===(Mt=Mt.srfm)||void 0===Mt||Mt.toggleErrorState(a,!0),h(Tt,a),d=!0):f||null===(Bt=window)||void 0===Bt||null===(Bt=Bt.srfm)||void 0===Bt||Bt.toggleErrorState(a,!1))}d=(0,t.applyFilters)("srfm.modifyFieldValidationResult",d,a,h);case 52:case"end":return e.stop()}}),e)})),A.s();case 20:if((O=A.n()).done){e.next=27;break}return e.delegateYield(P(),"t0",22);case 22:if(0!==e.t0){e.next=25;break}return e.abrupt("continue",25);case 25:e.next=20;break;case 27:e.next=32;break;case 29:e.prev=29,e.t1=e.catch(17),A.e(e.t1);case 32:return e.prev=32,A.f(),e.finish(32);case 35:return e.abrupt("return",!!d&&n({validateResult:d,firstErrorInput:m,scrollElement:v},p));case 36:case"end":return e.stop()}}),e,null,[[17,29,32,35]])}))),v.apply(this,arguments)}function p(){return(0,t.applyFilters)("srfm.srfmFields",["srfm-input-block","srfm-email-block-wrap","srfm-url-block","srfm-phone-block","srfm-checkbox-block","srfm-gdpr-block","srfm-number-block","srfm-multi-choice-block","srfm-datepicker-block","srfm-upload-block","srfm-rating-block","srfm-textarea-block","srfm-dropdown-block","srfm-slider-block","srfm-password-block"])}function h(){((arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||p()).forEach((function(t){return function(t,e){var r=Array.from(document.getElementsByClassName(t));if(r){var n,o=a(r);try{var s=function(){var r=n.value,o=r.querySelector("input")||r.querySelector("textarea")||r.querySelector("select");if("srfm-upload-block"===t&&(o=r.querySelector('input[type="file"]')),"srfm-rating-block"===t&&function(t,e,r){e.querySelectorAll(".srfm-icon").forEach((function(t){t.addEventListener("blur",u(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:y(t,r);case 1:case"end":return e.stop()}}),e)}))))}))}(0,r,e),"srfm-multi-choice-block"===t&&function(t,e,r){e.querySelectorAll(".srfm-input-multi-choice-single").forEach((function(t){t.addEventListener("blur",u(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:y(t,r);case 1:case"end":return e.stop()}}),e)}))))}))}(0,r,e),"srfm-email-block-wrap"===t&&function(t,e){var r=t.querySelectorAll("input"),n=t.closest(e);r.forEach((function(t){t.addEventListener("input",u(i().mark((function e(){var r,o,a,s,l,u,f,d,m,v,p,h,y,g,b,w,S,_,k;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.value=t.value.trim().toLowerCase(),r=!1,/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t.value)&&(r=!0),o=t.classList.contains("srfm-input-email-confirm")?n.querySelector(".srfm-email-confirm-block"):n.querySelector(".srfm-email-block"),a=o.querySelector(".srfm-error-message"),t.value||(a.style.display="none",o.classList.remove("srfm-valid-email-error")),!t.classList.contains("srfm-input-email-confirm")){e.next=20;break}if(l=n.querySelector(".srfm-input-email"),u=n.querySelector(".srfm-email-confirm-block"),f=u.querySelector(".srfm-error-message"),l.value===t.value){e.next=17;break}return f.style.display="block",f.textContent=null===(d=window)||void 0===d||null===(d=d.srfm_submit)||void 0===d||null===(d=d.messages)||void 0===d?void 0:d.srfm_confirm_email_same,null===(m=window)||void 0===m||null===(m=m.srfm)||void 0===m||m.toggleErrorState(n,!0),e.abrupt("return");case 17:null===(s=window)||void 0===s||null===(s=s.srfm)||void 0===s||s.toggleErrorState(n,!1),f.textContent="",f.style.display="none";case 20:v=c(),p=v.local,h=v.domain,y=t.value.lastIndexOf("@"),g="",-1!==y&&(p>0&&t.value.slice(0,y).length>p?g=null===(b=window)||void 0===b||null===(b=b.srfm)||void 0===b?void 0:b.srfmSprintfString(null===(w=window)||void 0===w||null===(w=w.srfm_submit)||void 0===w||null===(w=w.messages)||void 0===w?void 0:w.srfm_email_local_max_length,p):h>0&&t.value.slice(y+1).length>h&&(g=null===(S=window)||void 0===S||null===(S=S.srfm)||void 0===S?void 0:S.srfmSprintfString(null===(_=window)||void 0===_||null===(_=_.srfm_submit)||void 0===_||null===(_=_.messages)||void 0===_?void 0:_.srfm_email_domain_max_length,h))),""===(null==t?void 0:t.value)||r&&!g?(a.style.display="none",o.parentElement.classList.remove("srfm-valid-email-error"),a.removeAttribute("id")):(o.parentElement.classList.add("srfm-valid-email-error"),a.style.display="block",a.innerHTML=g||(null===(k=window)||void 0===k||null===(k=k.srfm_submit)||void 0===k||null===(k=k.messages)||void 0===k?void 0:k.srfm_valid_email),a.id=a.getAttribute("data-srfm-id"));case 25:case"end":return e.stop()}}),e)}))))}))}(r,e),"srfm-slider-block"===t&&function(t,e){var r=t.querySelector(".srfm-input-slider"),n=t.querySelector(".srfm-text-slider");if(r&&r.addEventListener("blur",u(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:y(r,e);case 1:case"end":return t.stop()}}),t)})))),n){var o=n.querySelector(".srfm-slider-thumb");o&&o.addEventListener("blur",u(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:y(o,e);case 1:case"end":return t.stop()}}),t)}))))}}(r,e),"srfm-dropdown-block"===t){var a=o.getAttribute("name");setTimeout((function(){var t;null===(t=window)||void 0===t||null===(t=t.srfm)||void 0===t||null===(t=t[a])||void 0===t||t.on("blur",(function(){y(o,e)}))}),500)}if("srfm-textarea-block"===t&&r.classList.contains("srfm-richtext")){var s=(o=r.querySelector("textarea.srfm-input-textarea")).getAttribute("id");setTimeout((function(){var t;null===(t=window)||void 0===t||null===(t=t.srfm)||void 0===t||null===(t=t[s])||void 0===t||t.on("editor-change",(function(){var t;(null===(t=window)||void 0===t||null===(t=t.srfm)||void 0===t||null===(t=t[s])||void 0===t?void 0:t.hasFocus())||y(o,e)}))}),500)}"srfm-phone-block"===t&&(o=r.querySelector(".srfm-input-phone")),o&&o.addEventListener("blur",u(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:y(o,e);case 1:case"end":return t.stop()}}),t)}))))};for(o.s();!(n=o.n()).done;)s()}catch(t){o.e(t)}finally{o.f()}}}(t,".srfm-form .".concat(t))})),document.querySelectorAll(".srfm-multi-choice-block").forEach((function(t){var e,r=t.querySelector(".srfm-input-multi-choice-hidden");if(r){var n=r.getAttribute("data-min-selection"),o=r.getAttribute("data-max-selection");if(n||o){var i=t.querySelector(".srfm-error-message"),a=(null===(e=window)||void 0===e||null===(e=e.srfm_submit)||void 0===e?void 0:e.messages)||{};t.addEventListener("input",(function(){var e,s=window.srfm.srfmUtility.extractValue(r.value).filter(Boolean).length;if(0!==s){var l,u=r.closest(".srfm-block"),c="";if(n&&so){var f;c=null===(f=window)||void 0===f||null===(f=f.srfm)||void 0===f?void 0:f.srfmSprintfString(a.srfm_multi_choice_max_selections,o)}i.textContent=c,null===(e=window)||void 0===e||null===(e=e.srfm)||void 0===e||e.toggleErrorState(u,Boolean(c))}else{var d;null===(d=window)||void 0===d||null===(d=d.srfm)||void 0===d||d.toggleErrorState(t,!1)}}))}}}))}var y=function(){var t=u(i().mark((function t(e,r){var n,o,a,s,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.closest(r),o=n.closest("form"),a=o.getAttribute("form-id"),s=o.getAttribute("ajaxurl"),l=o.getAttribute("data-submit-token"),t.next=8,m(a,s,l,n,!0);case 8:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),g=function(t){if(null!=t&&t.firstErrorInput){if(null!=t&&t.scrollElement){var e=t.scrollElement.getBoundingClientRect().top+window.pageYOffset-window.innerHeight/2;window.scroll({top:e,behavior:"smooth"})}null!=t&&t.shouldDelayOnFocus?setTimeout((function(){t.firstErrorInput.focus({preventScroll:!0})}),500):t.firstErrorInput.focus({preventScroll:!0})}},b=function(t,e,r,n){if(!(t||e||r||n))return!0;var o;if("v2-checkbox"===t)o=grecaptcha.getResponse();else if(e)o=hcaptcha.getResponse();else if(r){var i=r.querySelector('[name="cf-turnstile-response"]');o=(null==i?void 0:i.value)||turnstile.getResponse()}var a=(o||"").length>0;return n.style.display=a?"none":"block",a};function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}function S(){S=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(e,r,n,o){var i=r&&r.prototype instanceof d?r:d,a=Object.create(i.prototype);return l(a,"_invoke",function(e,r,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var l=k(s,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var u=c(e,r,n);if("normal"===u.type){if(o=n.done?4:2,u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=4,n.method="throw",n.arg=u.arg)}}}(e,n,new A(o||[])),!0),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=u;var f={};function d(){}function m(){}function v(){}var p={};l(p,i,(function(){return this}));var h=Object.getPrototypeOf,y=h&&h(h(O([])));y&&y!==r&&n.call(y,i)&&(p=y);var g=v.prototype=d.prototype=Object.create(p);function b(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,a,s){var l=c(t[o],t,i);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==w(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,s)}))}s(l.arg)}var o;l(this,"_invoke",(function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}),!0)}function k(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=c(o,e.i,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,f;var a=i.arg;return a?a.done?(r[e.r]=a.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){this.tryEntries.push(t)}function E(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function A(t){this.tryEntries=[[-1]],t.forEach(x,this),this.reset(!0)}function O(e){if(null!=e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o=0;--o){var i=this.tryEntries[o],a=i[4],s=this.prev,l=i[1],u=i[2];if(-1===i[0])return n("end"),!1;if(!l&&!u)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=s){if(s=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:O(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function _(t,e,r,n,o,i,a){try{var s=t[i](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(n,o)}function k(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){_(i,n,o,a,s,"next",t)}function s(t){_(i,n,o,a,s,"throw",t)}a(void 0)}))}}function x(t){var e=t.querySelector(".srfm-block.srfm-payment-block:not(.hide-element)");if(!e)return{valid:!0,slug:"no-payment-block",message:""};var r,n,o,i=e.querySelector(".srfm-payment-input"),a=i.getAttribute("data-amount-type")||"fixed";if("fixed"===a){var s,l=parseFloat(i.getAttribute("data-fixed-amount"));if(!l||isNaN(l)||l<=0)return{valid:!1,slug:"invalid-fixed-amount",message:null===(s=window.srfmPaymentUtility)||void 0===s?void 0:s.getStripeStrings("payment_amount_not_configured","Payment is currently unavailable. Please contact the site administrator to configure the payment amount.")}}else if("variable"===a){var u,c=parseFloat(i.dataset.currentAmount||0);if(isNaN(c)||c<=0)return{valid:!1,slug:"invalid-variable-amount",message:null===(u=window.srfmPaymentUtility)||void 0===u?void 0:u.getStripeStrings("invalid_variable_amount","Invalid payment amount")};var f=parseFloat(i.getAttribute("data-minimum-amount")||0);if(f>0&&c=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function G(t,e){if(t){if("string"==typeof t)return D(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?D(t,e):void 0}}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=0;--o){var i=this.tryEntries[o],a=i[4],s=this.prev,l=i[1],u=i[2];if(-1===i[0])return n("end"),!1;if(!l&&!u)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=s){if(s=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),k(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;k(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:E(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function M(t,e,r,n,o,i,a){try{var s=t[i](a),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(n,o)}function B(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){M(i,n,o,a,s,"next",t)}function s(t){M(i,n,o,a,s,"throw",t)}a(void 0)}))}}var V=null;document.addEventListener("srfm_initialize_validation",(function(t){var e,r=null==t||null===(e=t.detail)||void 0===e?void 0:e.fields;r&&Array.isArray(r)?h(r.filter((function(t){return p().includes(t)}))):h()}));var H=0;function z(){h();for(var e=Array.from(document.querySelectorAll(".srfm-form")),r=function(){var e=o[n];e.hasAttribute("data-srfm-instance")||e.setAttribute("data-srfm-instance",String(++H)),document.dispatchEvent(new CustomEvent("srfm_form_before_submission",{detail:{form:e}}));var r=ut(e),i=r.formId,a=r.submitType,s=r.successUrl,l=r.ajaxUrl,u=r.submitToken,c=r.loader,f=r.successContainer,d=r.successElement,m=r.recaptchaType,v=r.afterSubmission,p=r.captchaErrorElement,h=r.hCaptchaDiv,y=r.turnstileDiv,g=r.hasLoginBlock,b="v2-checkbox"===m||!!h||!!y;"v3-reCAPTCHA"!==m||e.hasAttribute("data-srfm-v3-click-handler")||(e.setAttribute("data-srfm-v3-click-handler","true"),e.addEventListener("click",(function(t){var r=t.target.closest("#srfm-submit-btn, .srfm-custom-button");r&&r.classList.contains("g-recaptcha")&&(V=e)}),!0)),e.addEventListener("submit",function(){var r=B(R().mark((function r(n){var o,w,S,_,k,x,E;return R().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n.preventDefault(),"FORM"!==(null==(o=n.target)?void 0:o.tagName)){r.next=10;break}if(S=null==o?void 0:o.closest(".srfm-form-container"),_=null==S?void 0:S.classList.contains("srfm-submit-button-hidden"),k=null==o?void 0:o.querySelector("button.srfm-custom-button"),x=null==k||null===(w=k.closest(".srfm-custom-button-ctn"))||void 0===w?void 0:w.classList.contains("hide-element"),!_||k&&!x){r.next=10;break}return console.warn("Form submission is disabled because the submit button is hidden."),r.abrupt("return");case 10:if(!g||e.__loginSuccess){r.next=14;break}return E=new CustomEvent("srfm_login_request",{cancelable:!0,detail:{form:e}}),e.dispatchEvent(E),r.abrupt("return");case 14:if((0,t.applyFilters)("srfm.handleCustomFormSubmission",!0,{form:e})){r.next=17;break}return r.abrupt("return");case 17:st(e,i,l,u,c,s,f,d,a,v,b?m:void 0,b?h:void 0,b?y:void 0,b?p:void 0),e.__loginSuccess=!0;case 19:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}()),document.dispatchEvent(new CustomEvent("srfm_form_after_initialization",{detail:{form:e}}))},n=0,o=e;n0?r:null}document.addEventListener("DOMContentLoaded",(function(){z()}));var $={entries:[],isOn:function(){var t;return!(null===(t=window.srfm_submit)||void 0===t||!t.logging_enabled)},add:function(t){this.isOn()&&this.entries.length<10&&this.entries.push(t)},flush:function(t){var e,r;if(this.isOn()&&this.entries.length){var n=null===(e=window.srfm_submit)||void 0===e?void 0:e.log_error_url,o=null!==(r=null==t?void 0:t.getAttribute("data-submit-token"))&&void 0!==r?r:"",i=Number(null==t?void 0:t.getAttribute("form-id"))||0;if(n){var a=JSON.stringify({form_id:i,entries:this.entries});this.entries=[],fetch(n,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json","X-WP-Submit-Token":o||""},body:a}).catch((function(){}))}else this.entries=[]}}};function X(t){return Z.apply(this,arguments)}function Z(){return(Z=B(R().mark((function t(e){var r,n,o,i;return R().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=null,t.prev=1,n=$.isOn()?e.clone():null,t.prev=3,t.next=6,e.json();case 6:r=t.sent,t.next=17;break;case 9:if(t.prev=9,t.t0=t.catch(3),!n){t.next=16;break}return t.next=14,n.text().catch((function(){return""}));case 14:i=t.sent,$.add({type:"response",status:e.status,message:"Response was not JSON: ".concat(null!==(o=null===t.t0||void 0===t.t0?void 0:t.t0.message)&&void 0!==o?o:""),body:String(i).slice(0,500)});case 16:throw t.t0;case 17:t.next=24;break;case 19:if(t.prev=19,t.t1=t.catch(1),!e.ok){t.next=23;break}return t.abrupt("return",null);case 23:throw t.t1;case 24:if(e.ok){t.next=26;break}throw r;case 26:return t.abrupt("return",r);case 27:case"end":return t.stop()}}),t,null,[[1,19],[3,9]])})))).apply(this,arguments)}function Q(t){return tt.apply(this,arguments)}function tt(){return(tt=B(R().mark((function e(r){var n,o,i,a,s,l,u,c,f,d,m,v,p,h,y,g,b,w,S,_,k,x,E,A,O,P,j,q,C,T,I,F,D,M,B,V,H;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null===(n=window.srfm_submit)||void 0===n?void 0:n.submit_form_url){e.next=3;break}return e.abrupt("return",{success:!1,data:{message:(0,L.__)("This form could not be submitted. Please refresh the page and try again.","sureforms"),log_message:"SureForms: srfm_submit.submit_form_url is unavailable, so the submission was never sent."}});case 3:i=new FormData(r),a=new FormData,s=r.getAttribute("data-submit-token"),l=["srfm-email-confirm","srfm-password-confirm"],u=U(i.entries()),e.prev=8,u.s();case 10:if((c=u.n()).done){e.next=21;break}if(R=c.value,z=2,f=function(t){if(Array.isArray(t))return t}(R)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],l=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){u=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(R,z)||G(R,z)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),d=f[0],m=f[1],!l.includes(d)){e.next=14;break}return e.abrupt("continue",19);case 14:if(""!==m&&(v=r.querySelector('[name="'.concat(d,'"]')),null!=(p=null==v?void 0:v.closest(".srfm-block-single"))&&p.classList.contains("hide-element")&&(m=""),m=(0,t.applyFilters)("srfm.filterFieldValue",m,{key:d,form:r})),!(0,t.applyFilters)("srfm.shouldSkipField",!1,{key:d,value:m,form:r})){e.next=18;break}return e.abrupt("continue",19);case 18:a.append(d,m);case 19:e.next=10;break;case 21:e.next=26;break;case 23:e.prev=23,e.t0=e.catch(8),u.e(e.t0);case 26:return e.prev=26,u.f(),e.finish(26);case 29:return(h=Y(r))&&a.append("srfm_addresses",JSON.stringify(h)),y=(0,t.applyFilters)("srfm.prepareAdditionalFormData",{},r),Object.keys(y).forEach((function(t){null!==y[t]&&void 0!==y[t]&&a.append(t,JSON.stringify(y[t]))})),g=performance.now(),e.prev=34,e.next=37,fetch(o,{method:"POST",body:a,headers:{"X-WP-Submit-Token":s}});case 37:return w=e.sent,S=w.status,_=null!==(b=w.headers.get("content-type"))&&void 0!==b?b:"",k=Math.round(performance.now()-g),e.next=43,X(w);case 43:return x=e.sent,w.ok&&!1!==(null==x?void 0:x.success)||(F=Object.keys(null!==(E=null==x||null===(A=x.data)||void 0===A?void 0:A.field_errors)&&void 0!==E?E:{}),D=null!==(O=null!==(P=null!==(j=null==x||null===(q=x.data)||void 0===q?void 0:q.log_message)&&void 0!==j?j:null==x||null===(C=x.data)||void 0===C?void 0:C.message)&&void 0!==P?P:null==x?void 0:x.message)&&void 0!==O?O:"",M=null==x||null===(T=x.data)||void 0===T||null===(T=T.api_response)||void 0===T?void 0:T["error-codes"],B=Array.isArray(M)?" [".concat(M.join(", "),"]"):"",V=null!=x&&null!==(I=x.data)&&void 0!==I&&I.code?" (".concat(x.data.code,")"):"",$.add({type:F.length?"blocked":"network",status:S,duration_ms:k,message:"Submission responded ".concat(S," (").concat(_,")").concat(V,": ").concat(D).concat(B),body:function(){try{return JSON.stringify(x).slice(0,500)}catch(t){return""}}(),field_keys:F.length?F:N(a.keys())})),e.abrupt("return",x);case 48:return e.prev=48,e.t1=e.catch(34),console.error(e.t1),$.add({type:"error",duration_ms:Math.round(performance.now()-g),message:"".concat(null!==(H=null===e.t1||void 0===e.t1?void 0:e.t1.name)&&void 0!==H?H:"Error",": ").concat("string"==typeof(null===e.t1||void 0===e.t1?void 0:e.t1.message)?e.t1.message:"").concat(null!==e.t1&&void 0!==e.t1&&e.t1.code?" (".concat(e.t1.code,")"):"")}),e.abrupt("return",{success:!1,data:{message:"string"==typeof(null===e.t1||void 0===e.t1?void 0:e.t1.message)?e.t1.message:"",log_message:null!==e.t1&&void 0!==e.t1&&e.t1.code?"SureForms submission failed (".concat(e.t1.code,")."):null}});case 53:case"end":return e.stop()}var R,z}),e,null,[[8,23,26,29],[34,48]])})))).apply(this,arguments)}function et(t,e){return rt.apply(this,arguments)}function rt(){return(rt=B(R().mark((function t(e,r){var n,o,i,a,s,l,u;return R().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=null==e||null===(n=e.data)||void 0===n?void 0:n.after_submit_url){t.next=3;break}return t.abrupt("return");case 3:return i=performance.now(),t.prev=4,t.next=7,fetch(o,{method:"GET"});case 7:return a=t.sent,s=a.status,l=Math.round(performance.now()-i),t.next=12,X(a);case 12:if(a.ok){t.next=23;break}return t.t0=$,t.t1=s,t.t2=l,t.t3="After-submission step responded ".concat(s),t.next=19,a.clone().text().then((function(t){return String(t).slice(0,500)})).catch((function(){return""}));case 19:t.t4=t.sent,t.t5={type:"network",status:t.t1,duration_ms:t.t2,message:t.t3,body:t.t4},t.t0.add.call(t.t0,t.t5),$.flush(r);case 23:t.next=30;break;case 25:t.prev=25,t.t6=t.catch(4),console.error(t.t6),$.add({type:"error",duration_ms:Math.round(performance.now()-i),message:"After-submission step failed: ".concat(null!==(u=null===t.t6||void 0===t.t6?void 0:t.t6.name)&&void 0!==u?u:"Error",": ").concat("string"==typeof(null===t.t6||void 0===t.t6?void 0:t.t6.message)?t.t6.message:"")}),$.flush(r);case 30:case"end":return t.stop()}}),t,null,[[4,25]])})))).apply(this,arguments)}function nt(e,r,n,o,i,a,s){var l,u=new CustomEvent("srfm_on_show_success_message",{cancelable:!0,detail:{form:o,element:r,message:n,submitType:a,container:e,loader:s}});document.dispatchEvent(u)&&(at(o),"hide form"===i?(o.style.opacity=1,o.style.display="none",setTimeout((function(){r.style.opacity=1}),500)):"reset form"===i&&(o.reset(),document.dispatchEvent(new CustomEvent("srfm_form_reset",{detail:{form:o}}))),r.innerHTML=n,e.classList.add("srfm-active"),null===(l=window)||void 0===l||null===(l=l.srfm)||void 0===l||l.handleInstantFormWrapperHeight(),(0,t.applyFilters)("srfm.enableScrollOnSuccess",!0)&&o.parentElement.scrollIntoView({behavior:"smooth"}))}function ot(t){var e=t.form,r=t.message,n=void 0===r?"":r,o=t.position,i=void 0===o?"footer":o,a=t.log_message,s=new CustomEvent("srfm_show_common_form_error",{detail:{form:e,message:n,position:i,log_message:void 0===a?null:a}});document.dispatchEvent(s)}function it(t){t.querySelectorAll(".srfm-common-error-message").forEach((function(t){t.setAttribute("hidden","")}))}function at(t){var e=t.querySelector('#srfm-submit-btn, button[type="submit"], .srfm-custom-button');e&&(e.disabled=!1,e.style.pointerEvents="");var r=new CustomEvent("srfm_form_submission_stop",{cancelable:!0,detail:{form:t}});document.dispatchEvent(r)}function st(t,e,r,n,o,i,a,s,l,u,c,f,d,m){return lt.apply(this,arguments)}function lt(){return(lt=B(R().mark((function t(e,r,n,o,i,a,s,l,u,c,f,d,v,p){var h,y,w,S,_,k,x,A,O,P,j,q,L,C,T,F,U,G,D,M,B,V,H,z;return R().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,i.classList.add("srfm-active"),h=new CustomEvent("srfm_form_submission_start",{cancelable:!0,detail:{form:e,loader:i,formId:r,submitType:u,successElement:l,successContainer:s}}),document.dispatchEvent(h),(y=e.querySelector('#srfm-submit-btn, button[type="submit"], .srfm-custom-button'))&&(y.disabled=!0,y.style.pointerEvents="none"),it(e),t.next=9,m(r,n,o,e);case 9:if(w=t.sent,S=b(f,d,v,p),(null==w||!w.validateResult)&&S){t.next=20;break}return i.classList.remove("srfm-active"),x=N(e.querySelectorAll(".srfm-error-message")).map((function(t){return t.textContent.trim()})).filter(Boolean).slice(0,5).join(" | "),A=(null==p||null===(_=p.textContent)||void 0===_?void 0:_.trim())||"captcha: ".concat(f||"unknown type"),$.add({type:"blocked",message:null!=w&&w.validateResult?"Blocked before submit: field validation failed. ".concat(x):"Blocked before submit: ".concat(A),field_keys:null!=w&&null!==(k=w.firstErrorInput)&&void 0!==k&&k.name?[w.firstErrorInput.name]:[]}),$.flush(e),at(e),null!=w&&w.validateResult?g(w):S||g({firstErrorInput:p,scrollElement:p}),t.abrupt("return");case 20:if(O=new CustomEvent("srfm_on_trigger_form_submission",{cancelable:!0,detail:{form:e,loader:i,formId:r,submitType:u,successElement:l,successContainer:s}}),document.dispatchEvent(O)){t.next=25;break}return i.classList.remove("srfm-active"),at(e),t.abrupt("return");case 25:return t.next=27,E(e);case 27:if(null!=(P=t.sent)&&P.valid){t.next=35;break}return $.add({type:"blocked",message:"Blocked before submit: payment. ".concat(null!==(j=null==P?void 0:P.message)&&void 0!==j?j:"")}),$.flush(e),ot({form:e,message:null==P?void 0:P.message}),i.classList.remove("srfm-active"),at(e),t.abrupt("return");case 35:return t.next=37,Q(e);case 37:null!=(q=t.sent)&&q.success?(ct(I(I({},q),{},{formId:r})),F=u,u=(null==q||null===(L=q.data)||void 0===L||null===(L=L.submission_settings)||void 0===L?void 0:L.submission_mode)||F,U=c,c=(null==q||null===(C=q.data)||void 0===C||null===(C=C.submission_settings)||void 0===C?void 0:C.after_submission)||U,"same page"===u?(nt(s,l,null!==(G=null==q?void 0:q.message)&&void 0!==G?G:"",e,c,u),i.classList.remove("srfm-active"),at(e)):["different page","custom url"].includes(u)?(null!=q&&q.redirect_url&&(a=null==q?void 0:q.redirect_url,window.location.assign(a)),i.classList.remove("srfm-active"),at(e)):nt(s,l,null!==(D=null==q?void 0:q.message)&&void 0!==D?D:"",e,c,u,i),null!=q&&null!==(T=q.data)&&void 0!==T&&T.after_submit&&et(q,e)):(M=(null==q?void 0:q.data)||{},ot(I({form:e},M)),i.classList.remove("srfm-active"),$.add({type:"blocked",message:String(M.log_message||M.message||"").slice(0,500)}),$.flush(e),at(e)),t.next=50;break;case 41:t.prev=41,t.t0=t.catch(0),$.add({type:"error",message:"Submission aborted: ".concat(null!==(B=null===t.t0||void 0===t.t0?void 0:t.t0.name)&&void 0!==B?B:"Error",": ").concat("string"==typeof(null===t.t0||void 0===t.t0?void 0:t.t0.message)?t.t0.message:""),source:null===(V=String(null!==(H=null===t.t0||void 0===t.t0?void 0:t.t0.stack)&&void 0!==H?H:"").split("\n")[1])||void 0===V||null===(V=V.trim())||void 0===V?void 0:V.slice(0,200)}),$.flush(e),z=new CustomEvent("srfm_on_trigger_form_submission_failure",{detail:{form:e,error:t.t0,loader:i,formId:r,submitType:u,successElement:l,successContainer:s}}),document.dispatchEvent(z),i.classList.remove("srfm-active"),at(e),ot({form:e});case 50:case"end":return t.stop()}var a}),t,null,[[0,41]])})))).apply(this,arguments)}function ut(t){var e=t.getAttribute("form-id"),r=t.getAttribute("message-type"),n=t.getAttribute("success-url"),o=t.getAttribute("ajaxurl"),i=t.getAttribute("data-submit-token"),a=t.querySelector(".srfm-loader"),s=t.parentElement.querySelector(".srfm-single-form.srfm-success-box"),l=null==s?void 0:s.querySelector(".srfm-success-box-description"),u=t.querySelector("#srfm-submit-btn"),c=t.getAttribute("after-submission"),f=t.querySelector(".g-recaptcha");return{formId:e,submitType:r,successUrl:n,ajaxUrl:o,submitToken:i,loader:a,successContainer:s,successElement:l,submitBtn:u,siteKey:null==f?void 0:f.getAttribute("data-sitekey"),recaptchaType:null==f?void 0:f.getAttribute("recaptcha-type"),afterSubmission:c,captchaErrorElement:t.querySelector("#captcha-error"),hCaptchaDiv:t.querySelector(".h-captcha"),turnstileDiv:t.querySelector(".cf-turnstile"),hasLoginBlock:t.querySelector(".srfm-login-block")}}function ct(t){var e=new CustomEvent("srfm_form_submission_success",{detail:{formId:"srfm-form-".concat(t.formId)}});document.dispatchEvent(e)}document.addEventListener("srfm_show_common_form_error",(function(t){var e=t.detail||{},r=e.form,n=e.message,o=void 0===n?"":n,i=e.position,a=void 0===i?"footer":i,s=e.log_message,l=void 0===s?null:s;if(r){l&&console.warn(l);var u=o||(0,L.__)("An error occurred while submitting your form. Please try again.","sureforms"),c="header"===a?"srfm-head-error":"srfm-footer-error",f=r.querySelector(".srfm-common-error-message.".concat(c));f&&(f.querySelector(".srfm-error-content").innerHTML=u,f.removeAttribute("hidden"),g({firstErrorInput:f,scrollElement:f}))}})),window.recaptchaCallback=function(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&V){var t=V;V=null;var e=ut(t),r=e.formId,n=e.submitType,o=e.ajaxUrl,i=e.submitToken,a=e.loader,s=e.successUrl,l=e.successContainer,u=e.successElement,c=e.recaptchaType,f=e.afterSubmission;if("v3-reCAPTCHA"===c)return a.classList.add("srfm-active"),void st(t,r,o,i,a,s,l,u,n,f)}Array.from(document.querySelectorAll(".srfm-form")).forEach((function(t){var e=ut(t),r=e.formId,n=e.submitType,o=e.successUrl,i=e.ajaxUrl,a=e.submitToken,s=e.loader,l=e.successContainer,u=e.successElement,c=e.submitBtn,f=e.siteKey,d=e.recaptchaType,m=e.afterSubmission,v=!1;"v2-invisible"===d&&(grecaptcha.render(c,{sitekey:f,callback:function(){st(t,r,i,a,s,o,l,u,n,m),v=!0},"error-callback":function(){var t,e,r,n,o,i;e={containerSelector:'.g-recaptcha[recaptcha-type="v2-invisible"]:not(.captcha-error-added)',message:null===(t=srfm_submit)||void 0===t||null===(t=t.messages)||void 0===t?void 0:t.srfm_google_captcha_error_message},r=e.containerSelector,o=void 0===(n=e.message)?"":n,(i=document.querySelectorAll(r))&&i.forEach((function(t){var e=t.closest(".srfm-form");e&&(ot({form:e,message:o}),t.classList.add("captcha-error-added"))}))}}),c.addEventListener("click",(function(){s.classList.add("srfm-active"),v&&st(t,r,i,a,s,o,l,u,n,m)})))}))},window.showErrorMessage=ot,window.handleBricksPreviewFormSubmission=function(){for(var t=0,e=Array.from(document.querySelectorAll(".srfm-form"));t