var wpforms=window.wpforms||function(s,p,d){const l={cache:{},isUpdatingToken:!1,init(){d(l.ready),d(p).on("load",function(){"function"==typeof d.ready.then?d.ready.then(l.load):l.load()}),l.bindUIActions(),l.bindOptinMonster()},ready(){l.clearUrlQuery(),l.setUserIdentifier(),l.loadValidation(),l.loadHoneypot(),l.loadDatePicker(),l.loadTimePicker(),l.loadInputMask(),l.loadSmartPhoneField(),l.loadPayments(),l.loadMailcheck(),l.loadChoicesJS(),l.initTokenUpdater(),l.restoreSubmitButtonOnEventPersisted(),l.bindSmartPhoneField(),l.bindChoicesJS(),d(".wpforms-randomize").each(function(){for(var e=d(this),t=e.children();t.length;)e.append(t.splice(Math.floor(Math.random()*t.length),1)[0])}),d(".wpforms-page-button").prop("disabled",!1),l.initFormsStartTime(),d(s).trigger("wpformsReady"),d(".wpforms-smart-phone-field").each(function(){var e=d(this);l.fixPhoneFieldSnippets(e)})},load(){},clearUrlQuery(){var e=p.location;let t=e.search;-1!==t.indexOf("wpforms_form_id=")&&(t=t.replace(/([&?]wpforms_form_id=[0-9]*$|wpforms_form_id=[0-9]*&|[?&]wpforms_form_id=[0-9]*(?=#))/,""),history.replaceState({},null,e.origin+e.pathname+t))},loadHoneypot(){d(".wpforms-form").each(function(){const e=d(this),t=e.data("formid"),r=[],a=[];var o,i,s,n;void 0!==wpforms_settings.hn_data[t]&&(d(`#wpforms-form-${t} .wpforms-field`).each(function(){var e=d(this);r.push(e.data("field-id")),a.push(e.find(".wpforms-field-label").text())}),o=l.getHoneypotRandomLabel(a.join(" ").split(" ")),i=l.getHoneypotFieldId(r),n=r[Math.floor(Math.random()*r.length)],s=`wpforms-${t}-field_`+i,d(`#wpforms-${t}-field_${n}-container`,e).before(`
`),(n=d(`#wpforms-${t}-field_${wpforms_settings.hn_data[t]}-container`,e)).find("input").attr({tabindex:"-1","aria-hidden":"true"}),n.find("label").attr("aria-hidden","true"))})},getHoneypotRandomLabel(t){let r="";for(let e=0;e<3;e++)r+=t[Math.floor(Math.random()*t.length)]+" ";return r.trim()},getHoneypotFieldId(t){var r=Math.max(...t);let a=0;for(let e=1;ea)return!1;return!0},wpforms_settings.val_filesize),d.validator.addMethod("step",function(e,t,r){i=r;const a=Math.floor(i)!==i&&i.toString().split(".")[1].length||0;function o(e){return Math.round(e*Math.pow(10,a))}var i=o(d(t).attr("min"));return e=o(e)-i,this.optional(t)||o(e)%o(r)==0}),d.validator.methods.email=function(e,t){return this.optional(t)||function(e){if("string"!=typeof e)return!1;var t=e.indexOf("@",1);if(e.length<6||254=Number(r.data("password-strength-level"))},wpforms_settings.val_password_strength),d(".wpforms-validate").each(function(){var e=d(this),t=e.data("formid");let r;r=void 0!==p["wpforms_"+t]&&p["wpforms_"+t].hasOwnProperty("validate")?p["wpforms_"+t].validate:"undefined"!=typeof wpforms_validate?wpforms_validate:{errorElement:l.isModernMarkupEnabled()?"em":"label",errorClass:"wpforms-error",validClass:"wpforms-valid",ignore:":hidden:not(textarea.wp-editor-area), .wpforms-conditional-hide textarea.wp-editor-area",ignoreTitle:!0,errorPlacement(e,t){l.isLikertScaleField(t)?(t.closest("table").hasClass("single-row")?t.closest(".wpforms-field"):t.closest("tr").find("th")).append(e):l.isWrappedField(t)?t.closest(".wpforms-field").append(e):l.isDateTimeField(t)?l.dateTimeErrorPlacement(t,e):l.isFieldInColumn(t)||l.isFieldHasHint(t)?t.parent().append(e):l.isLeadFormsSelect(t)?t.parent().parent().append(e):t.hasClass("wp-editor-area")?t.parent().parent().parent().append(e):e.insertAfter(t),l.isModernMarkupEnabled()&&e.attr({role:"alert","aria-label":wpforms_settings.errorMessagePrefix,for:""})},highlight(e,t,r){var a=d(e),o=a.closest(".wpforms-field"),i=a.attr("name");("radio"===a.attr("type")||"checkbox"===a.attr("type")?o.find('input[name="'+i+'"]'):a).addClass(t).removeClass(r),"password"===a.attr("type")&&""===a.val().trim()&&p.WPFormsPasswordField&&a.data("rule-password-strength")&&a.hasClass("wpforms-field-required")&&WPFormsPasswordField.passwordStrength("",e),o.addClass("wpforms-has-error")},unhighlight(e,t,r){var e=d(e),a=e.closest(".wpforms-field"),o=e.attr("name");("radio"===e.attr("type")||"checkbox"===e.attr("type")?a.find('input[name="'+o+'"]'):e).addClass(r).removeClass(t),a.find(":input.wpforms-error,[data-dz-errormessage]:not(:empty)").length||a.removeClass("wpforms-has-error"),l.isModernMarkupEnabled()&&e.parent().find("em.wpforms-error").remove()},submitHandler(s){function n(e,t){let r="label",a="";l.isModernMarkupEnabled()&&(r="em",a='role="alert"');var o=`<${r} id="wpforms-field_recaptcha-error" class="wpforms-error" ${a}> ${wpforms_settings.val_recaptcha_fail_msg}${r}>`;e.find(".wpforms-recaptcha-container").append(o),l.restoreSubmitButton(e,t)}function e(){const e=d(s),t=e.closest(".wpforms-container"),r=e.find(".wpforms-submit"),a=r.data("captchaInvalid"),o=r.data("alt-text"),i=r.get(0).recaptchaID;return e.data("token")&&0===d(".wpforms-token",e).length&&d('').val(e.data("token")).appendTo(e),e.find("#wpforms-field_recaptcha-error").remove(),r.prop("disabled",!0),WPFormsUtils.triggerEvent(e,"wpformsFormSubmitButtonDisable",[e,r]),o&&r.text(o),a?n(e,t):l.empty(i)&&0!==i?(d(".wpforms-input-temp-name").removeAttr("name"),void l.formSubmit(e)):(grecaptcha.execute(i).then(null,function(){grecaptcha.getResponse()||n(e,t)}),!1)}return"function"==typeof wpformsRecaptchaV3Execute?wpformsRecaptchaV3Execute(e):e()},invalidHandler(e,t){void 0!==t.errorList[0]&&l.scrollToError(d(t.errorList[0].element))},onkeyup:WPFormsUtils.debounce(function(e,t){d(e).hasClass("wpforms-novalidate-onkeyup")||9===t.which&&""===this.elementValue(e)||-1!==d.inArray(t.keyCode,[16,17,18,20,35,36,37,38,39,40,45,144,225])||(e.name in this.submitted||e.name in this.invalid)&&this.element(e)},1e3),onfocusout:function(e){let t=!1;d(e).hasClass("wpforms-novalidate-onkeyup")&&!e.value&&(t=!0),this.checkable(e)||!(e.name in this.submitted)&&this.optional(e)||(t=!0),(t=d(e).data("server-error")?!1:t)&&this.element(e)},onclick(e){let t=!1;var r=(e||{}).type;let a=d(e);-1<["checkbox","radio"].indexOf(r)&&((a=a.hasClass("wpforms-likert-scale-option")?a.closest("tr"):a.closest(".wpforms-field")).find("label.wpforms-error, em.wpforms-error").remove(),t=!0),t&&this.element(e)}},e.validate(r)}))},restrictedEmailRequest(r,a){var e=d(r),t=e.closest("form");const o=t.data("validator"),i=t.data("formid");t=e.closest(".wpforms-field").data("field-id");l.cache[i]=l.cache[i]||{},o.startRequest(r),d.post({url:wpforms_settings.ajaxurl,type:"post",data:{action:"wpforms_restricted_email",form_id:i,field_id:t,email:a},dataType:"json",success(e){var t={},e=e.success&&e.data;e||(t[r.name]=wpforms_settings.val_email_restricted,o.showErrors(t)),l.cache[i].restrictedEmailValidation=l.cache[i].restrictedEmailValidation||[],Object.prototype.hasOwnProperty.call(l.cache[i].restrictedEmailValidation,a)||(l.cache[i].restrictedEmailValidation[a]=e),o.stopRequest(r,e)}})},isFieldInColumn(e){return e.parent().hasClass("wpforms-one-half")||e.parent().hasClass("wpforms-two-fifths")||e.parent().hasClass("wpforms-one-fifth")},isFieldHasHint(e){return 0e.toLowerCase()),e.preferredCountries=e.preferredCountries.map(e=>e.toLowerCase()),p.intlTelInput(t[0],e),t.siblings('input[type="hidden"]').each(function(){var e=d(this);e.attr("name",e.attr("name").replace("wpf-temp-",""))}))})},loadSmartPhoneField(e){if(void 0!==p.intlTelInput){const o={countrySearch:!1,fixDropdownWidth:!1,preferredCountries:["us","gb"],countryListAriaLabel:wpforms_settings.country_list_label};let t;var r;if(wpforms_settings.gdpr||(o.geoIpLookup=l.currentIpToCountry),wpforms_settings.gdpr&&(r=l.mapLanguageToIso(this.getFirstBrowserLanguage()),t=-1'"()/\\|:;=@%&\s]/gi,"").substr(0,64),a=decodeURI(t.domain).replaceAll(/[<>'"()/\\|:;=@%&+_\s]/gi,"");t=''+r+"@"+a+"",t=wpforms_settings.val_email_suggestion.replace("{suggestion}",t),e.closest(".wpforms-field").find("#"+o+"_suggestion").remove(),e.parent().append('")},empty(){d("#"+o+"_suggestion").remove()}})}),d(s).on("click",".wpforms-field-email .mailcheck-suggestion",function(e){var t=d(this),r=t.closest(".wpforms-field"),a=t.data("id");e.preventDefault(),r.find("#"+a).val(t.text()),t.parent().remove()}))},loadChoicesJS(i){"function"==typeof p.Choices&&(i=i?.length?i:d(s)).find(".wpforms-field-select-style-modern .choicesjs-select, .wpforms-field-payment-select .choicesjs-select").each(function(e,t){var r,a,o;d(t).data("choicesjs")||WPFormsUtils.triggerEvent(i,"wpformsBeforeLoadElementChoices",[t]).isDefaultPrevented()||(r=p.wpforms_choicesjs_config||{},a=d(t).data("search-enabled"),o=d(t).data("remove-items-enabled"),r.searchEnabled=void 0===a||a,r.removeItems=void 0===o||o,r.removeItemButton=r.removeItems,r.searchEnabled=void 0===a||a,r.allowHTML=!0,r.callbackOnInit=function(){const t=this,r=d(t.passedElement.element),a=d(t.input.element),e=r.data("size-class");r.removeAttr("hidden").addClass(t.config.classNames.input+"--hidden"),e&&d(t.containerOuter.element).addClass(e),r.prop("multiple")&&(a.data("placeholder",a.attr("placeholder")).css("width","auto"),t.getValue(!0).length)&&a.removeAttr("placeholder"),r.on("change",function(){r.prop("multiple")&&(t.getValue(!0).length?a.removeAttr("placeholder"):a.attr("placeholder",a.data("placeholder")).css("width","auto"));var e=r.closest("form").data("validator");e&&e.element(r)})},r.callbackOnCreateTemplates=function(){const r=d(this.passedElement.element);return{option(e){var t=Choices.defaults.templates.option.call(this,e);return void 0!==e.placeholder&&!0===e.placeholder&&t.classList.add("placeholder"),r.hasClass("wpforms-payment-price")&&void 0!==e.customProperties&&null!==e.customProperties&&(t.dataset.amount=e.customProperties),t}}},d(t).data("choicesjs",new Choices(t,r)))})},bindChoicesJS(){d(s).on("click",".choices",function(e){var t=d(this),r=t.find("select").data("choicesjs");r&&t.hasClass("is-open")&&(e.target.classList.contains("choices__inner")||e.target.classList.contains("choices__arrow"))&&r.hideDropdown()})},bindUIActions(){var e=d(s);e.on("click",".wpforms-page-button",function(e){e.preventDefault(),l.pagebreakNav(this)}),e.on("change input",".wpforms-payment-price",function(){l.amountTotal(this,!0)}),e.on("change input","select.wpforms-payment-quantity",function(){l.amountTotal(this,!0),l.updateOrderSummaryItemQuantity(d(this))}),e.on("input",".wpforms-payment-user-input",function(){var e=d(this),t=e.val();e.val(t.replace(/[^0-9.,]/g,""))}),e.on("focusout",".wpforms-payment-user-input",function(){var e=d(this),t=e.val();if(!t)return t;t=l.amountSanitize(t),t=l.amountFormat(t);e.val(t)}),e.on("wpformsProcessConditionals",function(e,t){l.amountTotal(t,!0)}),e.on("wpformsProcessConditionalsField",function(e,t,r){l.updateOrderSummaryItems(d("#wpforms-form-"+t),d(`#wpforms-${t}-field_`+r),"")}),e.on("mouseenter",".wpforms-field-rating-item",function(){d(this).parent().find(".wpforms-field-rating-item").removeClass("selected hover"),d(this).prevAll().addBack().addClass("hover")}).on("mouseleave",".wpforms-field-rating-item",function(){d(this).parent().find(".wpforms-field-rating-item").removeClass("selected hover"),d(this).parent().find("input:checked").parent().prevAll().addBack().addClass("selected")}),d(s).on("change",".wpforms-field-rating-item input",function(){var e=d(this),t=e.closest(".wpforms-field-rating-items").find(".wpforms-field-rating-item");e.focus(),t.removeClass("hover selected"),e.parent().prevAll().addBack().addClass("selected")}),d(function(){d(".wpforms-field-rating-item input:checked").trigger("change")}),e.on("keydown",".wpforms-image-choices-item label",function(e){var t=d(this);if(t.closest(".wpforms-field").hasClass("wpforms-conditional-hide"))return e.preventDefault(),!1;32===e.keyCode&&(t.find("input").trigger("click"),e.preventDefault())}),p.document.documentMode&&e.on("click",".wpforms-image-choices-item img",function(){d(this).closest("label").find("input").trigger("click")}),e.on("change",".wpforms-field-checkbox input, .wpforms-field-radio input, .wpforms-field-payment-multiple input, .wpforms-field-payment-checkbox input, .wpforms-field-gdpr-checkbox input",function(e){var t=d(this);if(t.closest(".wpforms-field").hasClass("wpforms-conditional-hide"))return e.preventDefault(),!1;switch(t.attr("type")){case"radio":t.closest("ul").find("li").removeClass("wpforms-selected").find("input[type=radio]").removeProp("checked"),t.prop("checked",!0).closest("li").addClass("wpforms-selected");break;case"checkbox":t.is(":checked")?(t.closest("li").addClass("wpforms-selected"),t.prop("checked",!0)):(t.closest("li").removeClass("wpforms-selected"),t.prop("checked",!1))}}),e.on("input",".wpforms-field-file-upload",function(){var e=d(this),t=e.closest("form.wpforms-form").find('.wpforms-field-file-upload input:not(".dropzone-input")');let a=0,r=Number(wpforms_settings.post_max_size),o=''+wpforms_settings.val_post_max_size+"
";e=e.closest("form.wpforms-form").find(".wpforms-submit-container");let i=e.find("button.wpforms-submit"),s=e.prev();var n=i.closest("form"),l=n.find(".wpforms-page-next:visible");0!==n.find(".wpforms-page-indicator").length&&0!==l.length&&(i=l),t.each(function(){var e=d(this);let t=0;for(var r=e[0].files.length;t{errorMsg}'.replace(/{errorMsg}/,o)),s=e.prev()),i.prop("disabled",!0),WPFormsUtils.triggerEvent(n,"wpformsFormSubmitButtonDisable",[n,i]),WPFormsUtils.triggerEvent(n,"wpformsCombinedUploadsSizeError",[n,s]))}),e.on("change input",".wpforms-field-number-slider input[type=range]",function(e){var t=d(e.target).siblings(".wpforms-field-number-slider-hint");t.html(t.data("hint").replaceAll("{value}",""+e.target.value+""))}),e.on("keydown",".wpforms-form input",function(e){var t,r;13!==e.keyCode||0===(r=(t=d(this)).closest(".wpforms-page")).length||["text","tel","number","email","url","radio","checkbox"].indexOf(t.attr("type"))<0||(t.hasClass("wpforms-datepicker")&&t.flatpickr("close"),e.preventDefault(),(r.hasClass("last")?r.closest(".wpforms-form").find(".wpforms-submit"):r.find(".wpforms-page-next")).trigger("click"))}),e.on("keypress",".wpforms-field-number input",function(e){return/^[-0-9.]+$/.test(String.fromCharCode(e.keyCode||e.which))}),e.one("input",".wpforms-field input, .wpforms-field textarea, .wpforms-field select",l.formChanged).one("change",".wpforms-field-select-style-modern, .wpforms-timepicker",l.formChanged).one("focus",".dropzone-input",l.formChanged).one("click touchstart",".wpforms-signature-canvas",l.formChanged).one("wpformsRichTextContentChange",l.richTextContentChanged),d("form.wpforms-form").on("wpformsBeforePageChange",l.skipEmptyPages)},skipEmptyPages(e,t,r,a){var o=l.findNonEmptyPage(t,r,a);o!==t&&(e.preventDefault(),1===o&&"prev"===a?(e=r.find(".wpforms-page-2"),a=r.find(".wpforms-page-"+t),t=(e.find(".wpforms-page-prev").length?e:a).find(".wpforms-page-prev"),wpforms.navigateToPage(t,"prev",2,r,e)):(t=r.find(".wpforms-page-"+(a=o-1)),wpforms.navigateToPage(t.find(".wpforms-page-next"),"next",a,r,t)))},findNonEmptyPage(e,t,r){let a=e;for(;l.isEmptyPage(t,a);)"prev"===r?a--:a++;return a},isEmptyPage(e,t){return 1!==t&&!(e=e.find(".wpforms-page-"+t)).hasClass("last")&&(t=e.find(".wpforms-field:not(.wpforms-field-pagebreak):not(.wpforms-field-hidden)"),e.find(".wpforms-conditional-hide").length===t.length)},formChanged(e){var t=d(this).closest(".wpforms-form");l.maybeSetStartTime(t)},richTextContentChanged(e,t,r){r=r.getContainer(),r=d(r).closest(".wpforms-form");l.maybeSetStartTime(r)},initFormsStartTime(){d(".wpforms-form").each(function(){l.maybeSetStartTime(d(this))})},maybeSetStartTime(e){e.data("start_timestamp")||e.data("start_timestamp",Date.now())},entryPreviewFieldPageChange(e,t,r){console.warn("WARNING! Obsolete function called. Function wpforms.entryPreviewFieldPageChange has been deprecated, please use the WPFormsEntryPreview.pageChange function instead!"),WPFormsEntryPreview.pageChange(e,t,r)},entryPreviewFieldUpdate(e,t){console.warn("WARNING! Obsolete function called. Function wpforms.entryPreviewFieldUpdate has been deprecated, please use the WPFormsEntryPreview.update function instead!"),WPFormsEntryPreview.update(e,t)},scrollToError(e){if(0!==e.length){let t=e.find(".wpforms-field.wpforms-has-error");0!==(t=0===t.length?e.closest(".wpforms-field"):t).length&&void 0!==(e=t.offset())&&l.animateScrollTop(e.top-75,750).done(function(){var e=t.find(".wpforms-error").first();"function"==typeof e.focus&&e.trigger("focus")})}},pagebreakNav(e){const t=d(e),r=t.data("action"),a=t.data("page"),o=t.closest(".wpforms-form"),i=o.find(".wpforms-page-"+a);l.saveTinyMCE(),"next"===r&&void 0!==d.fn.validate?l.checkForInvalidFields(o,i,function(){l.navigateToPage(t,r,a,o,i)}):"prev"!==r&&"next"!==r||l.navigateToPage(t,r,a,o,i)},checkForInvalidFields(e,t,r){var a=e.data("validator");if(a)if(0'),i.render(o,{sitekey:a,callback(){wpformsRecaptchaCallback(d("#"+o))}})}},amountTotal(e,t){t=t||!1;const r=d(e).closest(".wpforms-form"),a=l.amountTotalCalc(r),o=l.amountFormatSymbol(a);r.find(".wpforms-payment-total").each(function(){"hidden"===d(this).attr("type")||"text"===d(this).attr("type")?(d(this).val(o),"text"===d(this).attr("type")&&t&&r.data("validator")&&d(this).valid()):d(this).text(o)}),l.updateOrderSummaryItems(r,d(e),o)},updateOrderSummaryItems(t,r,a){t.find(".wpforms-order-summary-preview").each(function(){const e=d(this);""!==a&&e.find(".wpforms-order-summary-preview-total .wpforms-order-summary-item-price").text(a),r.hasClass("wpforms-payment-total")?t.find(".wpforms-payment-price").each(function(){l.updateOrderSummaryItem(d(this),e)}):l.updateOrderSummaryItem(r,e)})},updateOrderSummaryItem(e,t){if(e.hasClass("wpforms-payment-price")){const o=e.closest(".wpforms-field"),i=o.data("field-id"),s=e.prop("type");var r,a;"checkbox"===s?t.find(`tr[data-field="${i}"][data-choice="${e.val()}"]`).toggle(e.is(":checked")):"radio"===s||"select-one"===s?t.find(`tr[data-field="${i}"]`).each(function(){var e=d(this).data("choice");"radio"===s?d(this).toggle(o.find(`input[value="${e}"]`).is(":checked")):d(this).toggle(e===parseInt(o.find("select").val(),10))}):(r=t.find(`tr[data-field="${i}"]`),a=e.val(),r.find(".wpforms-order-summary-item-price").text(l.amountFormatSymbol(a)),r.toggle("block"===o.css("display"))),o.hasClass("wpforms-payment-quantities-enabled")?l.updateOrderSummaryItemQuantity(e):(l.updateSummaryPriceWidth(t),l.toggleSummaryPlaceholder(t))}},updateOrderSummaryItemQuantity(e){const t=e.closest(".wpforms-field"),a=t.find("input.wpforms-payment-price, select.wpforms-payment-price"),r=e.closest(".wpforms-form"),o=t.data("field-id"),i=l.getPaymentFieldQuantity(a),s=l.getPaymentFieldAmount(a),n=a.prop("type");r.find(".wpforms-order-summary-preview").each(function(){var e,t=d(this);let r;(r="checkbox"===n||"radio"===n||"select-one"===n?(e=a.val(),t.find(`tr[data-field="${o}"][data-choice="${e}"]`)):t.find(`tr[data-field="${o}"]`)).toggle(0'),e.append(''),e.get(0).submit())},formHasCaptcha(e){return!(!e||!e.length||"undefined"==typeof hcaptcha&&"undefined"==typeof grecaptcha&&"undefined"==typeof turnstile)&&(e=e.find(".wpforms-recaptcha-container"),Boolean(e.length))},resetFormRecaptcha(r){if(l.formHasCaptcha(r)){var a=r.find(".wpforms-recaptcha-container");let e,t;e=a.hasClass("wpforms-is-hcaptcha")?hcaptcha:a.hasClass("wpforms-is-turnstile")?turnstile:grecaptcha,t=r.find(".wpforms-submit").get(0).recaptchaID,l.empty(t)&&0!==t&&(t=r.find(".g-recaptcha").data("recaptcha-id")),l.empty(t)&&0!==t||e.reset(t)}},consoleLogAjaxError(e){e?console.error("WPForms AJAX submit error:\n%s",e):console.error("WPForms AJAX submit error")},displayFormAjaxErrors(e,t){"string"==typeof t?l.displayFormAjaxGeneralErrors(e,t):(t=t&&"errors"in t?t.errors:null,l.empty(t)||l.empty(t.general)&&l.empty(t.field)?l.consoleLogAjaxError():(l.empty(t.general)||l.displayFormAjaxGeneralErrors(e,t.general),l.empty(t.field)||l.displayFormAjaxFieldErrors(e,t.field)))},displayFormAjaxGeneralErrors(e,t){var r,a;e&&e.length&&(l.empty(t)||(l.isModernMarkupEnabled()&&e.attr({"aria-invalid":"true","aria-errormessage":""}),"string"==typeof t?(a=l.isModernMarkupEnabled()?' role="alert"':"",r=l.isModernMarkupEnabled()?`${wpforms_settings.formErrorMessagePrefix}`:"",e.find(".wpforms-submit-container").before(`${r}${t}
`),l.setCurrentPage(e,{})):(a=e.data("formid"),l.printGeneralErrors(e,t,a))))},printGeneralErrors(o,e,i){d.each(e,function(e,t){switch(e){case"header":o.prepend(t);break;case"footer":r=t,0===o.find(".wpforms-page-indicator").length?o.find(".wpforms-submit-container").before(r):o.find(".wpforms-page-1").append(r);break;case"recaptcha":r=t,o.find(".wpforms-recaptcha-container").append(r)}var r,a;l.isModernMarkupEnabled()&&(a=o.attr("aria-errormessage")||"",o.attr("aria-errormessage",a+` wpforms-${i}-${e}-error`))}),o.find(".wpforms-error-container").length&&l.animateScrollTop(o.find(".wpforms-error-container").first().offset().top-100)},clearFormAjaxGeneralErrors(e){e.find(".wpforms-error-container").remove(),e.find("#wpforms-field_recaptcha-error").remove(),l.isModernMarkupEnabled()&&e.attr({"aria-invalid":"false","aria-errormessage":""})},displayFormAjaxFieldErrors(r,e){var t;r&&r.length&&(l.empty(e)||(t=r.data("validator"))&&(e=l.splitFieldErrors(e),d.each(e,function(e,t){d('[name="'+e+'"]',r).attr("data-server-error",t)}),t.showErrors(e),l.formHasCaptcha(r)||t.focusInvalid()))},splitFieldErrors:i=>(d.each(i,function(o,e){"string"!=typeof e&&d.each(e,function(e,t){var r=o.split("[").pop().replace("]",""),a=o.replace("["+r+"]","");r===e?i[o]=t:"string"==typeof e&&isNaN(e)&&(i[a+"["+e+"]"]=t)})}),i),formSubmitAjax:a=>{if(!a.length)return d.Deferred().reject();const r=a.closest(".wpforms-container"),e=a.find(".wpforms-submit-spinner");let t;r.css("opacity",.6),e.show(),l.clearFormAjaxGeneralErrors(a);var o=new FormData(a.get(0)),o=(o.append("action","wpforms_submit"),o.append("start_timestamp",a.data("start_timestamp")),o.append("end_timestamp",Date.now()),{type:"post",dataType:"json",url:wpforms_settings.ajaxurl,data:o,cache:!1,contentType:!1,processData:!1});return o.success=function(e){e?e.data&&e.data.action_required?a.trigger("wpformsAjaxSubmitActionRequired",e):e.success?(a.trigger("wpformsAjaxSubmitSuccess",e),e.data&&(e.data.redirect_url?(a.trigger("wpformsAjaxSubmitBeforeRedirect",e),p.location=e.data.redirect_url):e.data.confirmation&&(r.html(e.data.confirmation),t=r.find("div.wpforms-confirmation-scroll"),r.trigger("wpformsAjaxSubmitSuccessConfirmation",e),t.length)&&l.animateScrollTop(t.offset().top-100))):(l.resetFormRecaptcha(a),l.displayFormAjaxErrors(a,e.data),a.trigger("wpformsAjaxSubmitFailed",e),l.setCurrentPage(a,e.data)):l.consoleLogAjaxError()},o.error=function(e,t,r){l.consoleLogAjaxError(r),a.trigger("wpformsAjaxSubmitError",[e,t,r])},o.complete=function(e,t){e.responseJSON&&e.responseJSON.data&&(e.responseJSON.data.action_required||"success"===t&&e.responseJSON.data.redirect_url)||(l.restoreSubmitButton(a,r),a.trigger("wpformsAjaxSubmitCompleted",[e,t]))},WPFormsUtils.triggerEvent(a,"wpformsAjaxBeforeSubmit",[a]).isDefaultPrevented()?(l.restoreSubmitButton(a,r),d.Deferred().reject()):d.ajax(o)},setCurrentPage(r,a){if(0!==r.find(".wpforms-page-indicator").length){const i=[];if(r.find(".wpforms-page").each(function(e,t){if(1<=d(t).find(".wpforms-has-error").length)return i.push(d(t))}),0!==i.length||void 0===a.errors||void 0===a.errors.general||void 0!==a.errors.general.footer||void 0===a.errors.general.recaptcha){var o=0=1e3*wpforms_settings.token_cache_lifetime&&!this.isUpdatingToken},updateToken(t,r,a){var e=r.data("formid");const o=r.find(".wpforms-submit");this.isUpdatingToken=!0,o.prop("disabled",!0),d.post(wpforms_settings.ajaxurl,{action:"wpforms_get_token",formId:e}).done(function(e){e.success?(r.attr("data-token-time",t),r.attr("data-token",e.data.token),o.prop("disabled",!1),a.target===o[0]&&o.trigger("click")):console.error("Failed to update token: ",e)}).fail(function(e,t,r){console.error("AJAX request failed: ",t,r)}).always(function(){this.isUpdatingToken=!1,o.prop("disabled",!1)}.bind(this))},restoreSubmitButtonOnEventPersisted(){p.onpageshow=function(e){e.persisted&&d(".wpforms-form").each(function(){var e=d(this);l.restoreSubmitButton(e,e.closest(".wpforms-container"))})}}};return l}(document,window,jQuery);wpforms.init();