(()=>{"use strict";const e=function(e,t){var n=t.find(".jss-ff-el-net-promoter");n.length&&e.each(n,function(t,n){e(n).on("click","label",function(t){var n=e(this);n.addClass("active"),n.prevAll().removeClass("active"),n.nextAll().removeClass("active")})})};var t=function(e){!function(e){e.on("click",".js-repeat .repeat-plus",function(e){var t=jQuery(this),n=t.closest(".ff-el-repeat"),a=parseInt(n.data("max_repeat")),i=n.find(".ff-t-cell:first-child .ff-el-input--content > input").length;if(!(a&&a<=i)){a&&a-i==1&&n.find(".repeat-plus").hide();var r=t.closest("div"),o=r.index(),s=t.closest(".ff-el-input--content").find(".ff-t-cell").length;t.closest(".ff-el-input--content").find(".ff-t-cell").each(function(e,t){var n=jQuery(this).find(".ff-el-form-control:last-child"),a=n.attr("tabindex"),i=n.clone(),r={value:"",id:"ffrpt-"+(new Date).getTime()+e};a&&(r.tabIndex=parseInt(a)+s),i.prop(r),i.insertAfter(n)}),r.clone().insertAfter(r),t.closest(".ff-el-input--content").find(".ff-t-cell").eq(0).find("input:eq(".concat(o+1,")")).focus()}}),e.on("click",".js-repeat .repeat-minus",function(e){var t=!1,n=jQuery(this),a=n.closest("div");n.closest(".ff-el-repeat").find(".repeat-plus").show(),n.closest(".ff-el-input--content").find(".ff-t-cell").each(function(){var e=a.index(),n=jQuery(this).find(".ff-el-form-control:eq("+e+")");a.siblings().length&&(t=n.remove().length)}),t&&a.remove()})}(e),function(e){var t=window.localStorage.getItem("ff_window_type");jQuery(".ff_form_preview").length&&jQuery(".ff_flexible_table").addClass(t),e.on("screen-change",function(e,t){jQuery(".ff_form_preview").length&&("375px"===t?jQuery(".ff_flexible_table").addClass("mobile"):jQuery(".ff_flexible_table").removeClass("mobile"))}),e.on("click",".js-repeater .repeat-plus",function(e){var t=jQuery(this),n=t.closest("table"),a=t.closest("tr"),i=parseInt(n.attr("data-max_repeat")),r=n.find("tbody tr").length;if(i&&r==i)n.addClass("repeat-maxed");else{var o=a.clone();o.find("td").each(function(e,t){var n=jQuery(this).find(".ff-el-form-control:last-child"),a="ffrpt-"+(new Date).getTime()+e,i={value:n.attr("data-default")||"",id:a};n.prop(i);var r=n.attr("data-mask");r&&n.mask(r)}),o.insertAfter(a);var s=n.attr("data-root_name"),l=0;n.find("tbody tr").each(function(e,t){jQuery(this).find(".ff-el-form-control").each(function(t,n){var a=jQuery(n);0==e&&(l=a.attr("tabindex")),a.prop({name:s+"["+e+"][]"}),a.attr("data-name",s+"_"+t+"_"+e),l&&a.attr("tabindex",l)})}),o.find(".ff-el-form-control")[0].focus(),n.trigger("repeat_change"),i&&r+1==i&&n.addClass("repeat-maxed")}}),e.on("click",".js-repeater .repeat-minus",function(e){var t=jQuery(this),n=t.closest("table");if(1!=n.find("tbody tr").length){t.closest("tr").remove(),n.removeClass("repeat-maxed");var a=n.attr("data-root_name");n.find("tbody tr").each(function(e,t){jQuery(this).find(".ff-el-form-control").each(function(t,n){jQuery(n).prop({name:a+"["+e+"][]"})})}),n.trigger("repeat_change")}}),e.on("click",".js-container-repeat-buttons .repeat-plus",function(e){var t=jQuery(this),n=t.closest(".ff-repeater-container"),a=t.closest(".ff_repeater_cont_row"),i=parseInt(n.attr("data-max_repeat")),r=n.attr("data-root_name"),o=n.find(".ff_repeater_cont_row").length;if(i&&o==i)n.addClass("repeat-maxed");else{var s=a.clone();s.find(".ff_repeater_cell").each(function(e,t){var n=jQuery(this).find(".ff-el-form-control:last-child"),a="ffrpt-"+(new Date).getTime()+e,i={value:n.attr("data-default")||"",id:a};n.prop(i);var r=n.attr("data-mask");r&&n.mask(r),jQuery(this).find("label").attr("for",a)}),s.insertAfter(a);var l=0;n.find(".ff_repeater_cont_row").each(function(e,t){jQuery(this).find(".ff-el-form-control").each(function(t,n){var a=jQuery(n);0==e&&(l=a.attr("tabindex")),a.prop({name:r+"["+e+"][]"}),a.attr("data-name",r+"_"+t+"_"+e),l&&a.attr("tabindex",l)})}),s.find(".ff-el-form-control")[0].focus(),n.trigger("repeat_change"),i&&o+1==i&&n.addClass("repeat-maxed")}}),e.on("click",".js-container-repeat-buttons .repeat-minus",function(e){var t=jQuery(this),n=t.closest(".ff-repeater-container"),a=t.closest(".ff_repeater_cont_row");n.find(".ff_repeater_cont_row").length>1&&(a.remove(),n.removeClass("repeat-maxed"),n.trigger("repeat_change"))})}(e),function(e){e.on("keydown",".repeat-plus",function(e){"Enter"===e.key&&(e.preventDefault(),jQuery(this).click())}),e.on("keydown",".repeat-minus",function(e){"Enter"===e.key&&(e.preventDefault(),jQuery(this).click())})}(e)};function n(){n=function(e,t){return new r(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function r(e,n,i){var o=RegExp(e,n);return t.set(o,i||t.get(e)),a(o,r.prototype)}function o(e,n){var a=t.get(n);return Object.keys(a).reduce(function(t,n){var i=a[n];if("number"==typeof i)t[n]=e[i];else{for(var r=0;void 0===e[i[r]]&&r+1]+)(>|$)/g,function(e,t,n){if(""===n)return e;var a=r[t];return Array.isArray(a)?"$"+a.join("$"):"number"==typeof a?"$"+a:""}))}if("function"==typeof a){var s=this;return e[Symbol.replace].call(this,n,function(){var e=arguments;return"object"!=i(e[e.length-1])&&(e=[].slice.call(e)).push(o(e,s)),a.apply(this,e)})}return e[Symbol.replace].call(this,n,a)},n.apply(this,arguments)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:i}}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 r,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,r=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw r}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n"==e.operator?t&&this.parseFormattedNumericValue(n,t)>this.parseFormattedNumericValue(n,e.value):"<"==e.operator?t&&this.parseFormattedNumericValue(n,t)="==e.operator?t&&this.parseFormattedNumericValue(n,t)>=this.parseFormattedNumericValue(n,e.value):"<="==e.operator?t&&this.parseFormattedNumericValue(n,t)<=this.parseFormattedNumericValue(n,e.value):"startsWith"==e.operator?t&&t.startsWith(e.value):"endsWith"==e.operator?t&&t.endsWith(e.value):"contains"==e.operator?null!==t&&-1!=t.indexOf(e.value):"doNotContains"==e.operator?null!==t&&-1==t.indexOf(e.value):"test_regex"==e.operator&&(t=t||"",this.stringToRegex(e.value).test(t))}},{key:"stringToRegex",value:function(e){var t,a=(null===(t=String(e).match(n(/^\/(.*)\/([gimsuy]*)$/,{body:1,flags:2})))||void 0===t?void 0:t.groups)||{},i=a.body,r=a.flags;return i?(r=r||"g",RegExp(i,r)):new RegExp(e,"g")}},{key:"parseFormattedNumericValue",value:function(e,t){if(e.hasClass("ff_numeric")){var n=JSON.parse(e.attr("data-formatter"));return currency(t,n).value}return Number(t)||0}}])&&s(e.prototype,t),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,a}();const c=function(e,t,n){var a="."+n.form_instance;(function(){var i=this,r={},o={},s=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;return function(){for(var a=arguments.length,r=new Array(a),o=0;oe.length)&&(t=e.length);for(var n=0,a=Array(t);n",{value:t,text:t}))}),a.attr("disabled",!1).val(n[e])})})}else i.each(n,function(n,a){t.$theForm.find('[name="'.concat(e,"[").concat(n,']"]')).val(a).change()})}else if("[object Array]"===a){var l=t.$theForm.find("[name=".concat(e,"]"));if("file"===(l=(l=l.length?l:t.$theForm.find("[data-name=".concat(e,"]"))).length?l:t.$theForm.find("[name=".concat(e,"\\[\\]]"))).attr("type"))t.addFilesToElement(l,n);else if(l.prop("multiple"))if(i.isFunction(window.Choices)){var f=l.data("choicesjs");f&&r.push({handler:f,values:n})}else l.val(n).change();else if("repeater_field"===l.attr("data-type")){var c=l.find("tbody"),u=l.attr("data-name");i.each(n,function(e,t){0!=e?c.find("tr:last").clone().appendTo(c).find(".ff-el-form-control").each(function(n,a){var r="ffrpt-"+(new Date).getTime()+n;i(a).val(t[n]),i(a).attr({id:r,name:"".concat(u,"[").concat(e,"][]"),value:t[n]}).change()}):c.find("tr:first .ff-el-form-control").each(function(e,n){i(n).val(t[e]).change()})})}else l.each(function(e,t){-1!==i.inArray(i(t).val(),n)&&i(t).prop("checked",!0).change()})}else{var d=t.$theForm.find("[name=".concat(e,"]"));if(d.hasClass("fluentform-post-content")&&window.wp&&window.wp.editor){var p=d.attr("id");window.tinymce.get(p).setContent(n)}if("undefined"!=typeof flatpickr&&d.prop("_flatpickr")){var h=d.prop("_flatpickr");h&&(h.config.altInput?h.setDate(n,!0):d.val(n).trigger("change"))}if("radio"===d.prop("type")||"checkbox"===d.prop("type"))i("[name=".concat(e,'][value="').concat(n,'"]')).prop("checked",!0).change(),t.$theForm.find("[name=".concat(e,'][value="').concat(n,'"]')).prop("checked",!0).change(),d.closest(".ff-el-group").find(".ff-el-ratings").length&&t.$theForm.find("[name=".concat(e,'][value="').concat(n,'"]')).closest("label").trigger("mouseenter");else{d.hasClass("ff_has_multi_select")&&d.data("choicesjs")&&(d.data("choicesjs").removeActiveItems(n),d.data("choicesjs").setChoiceByValue(n));var m=d.closest(".ff-el-group").find(".fluentform-signature-pad");if(m.length){var v=m[0].getContext("2d"),g=new Image;g.src=n,g.onload=function(){v.drawImage(g,0,0)}}d.val(n).change()}}}}),r.length>0)for(var o=0;o0?a.css({transition:"width ".concat(n,"ms ease-in-out")}):a.css({transition:"none"}),a[0]&&a[0].offsetHeight,a.css("width",i+"%"),new Promise(function(e){var t=!1,i=setTimeout(function(){t||(t=!0,e())},(n||0)+120);a.one("transitionend webkitTransitionEnd oTransitionEnd",function(){t||(t=!0,clearTimeout(i),e())})})}},{key:"registerStepNavigators",value:function(e){var t=this.$,n=this;this.handleFocus(e),t(this.formSelector).on("click",".fluentform-step .step-nav button, .fluentform-step .step-nav img",function(a){var i=t(this).data("action"),r="next",o=t(this).closest(".fluentform-step"),s=n.getFormInstance();if("next"===i){try{var l=o.find(":input").not(":button").filter(function(e,n){return!t(n).closest(".has-conditions").hasClass("ff_excluded")});l.length&&s.validate(l),n.activeStep++}catch(a){if(!(a instanceof window.ffValidationError))throw a;return s.showErrorMessages(a.messages),void s.scrollToFirstError(350)}n.$theForm.trigger("ff_to_next_page",n.activeStep),t(document).trigger("ff_to_next_page",{step:n.activeStep,form:n.$theForm});var f=n.$theForm.find(".fluentform-step");n.$theForm.trigger("ff_render_dynamic_smartcodes",t(f[n.activeStep]))}else n.activeStep--,r="prev",n.$theForm.trigger("ff_to_prev_page",n.activeStep),t(document).trigger("ff_to_prev_page",{step:n.activeStep,form:n.$theForm});var c="yes"!=n.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");n.updateSlider(n.activeStep,e,c,r).then(function(){n.handleFocus(e)}).catch(function(e){console.error("An error occurred during the slider update:",e)})})}},{key:"updateSlider",value:function(e,t){var n=this,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"next",r=this.$,o=this;return new Promise(function(s){r("div"+n.formSelector+"_errors").empty(),n.activeStep=e;var l=n.$theForm.find(".ff-step-titles li"),f=n.$theForm.find(".fluentform-step"),c=f.length;if(!window.ff_disable_auto_step&&c){var u=o.$theForm.find(".fluentform-step").index(o.$theForm.find(".fluentform-step.active"));if("prev"===i||u>-1&&n.activeStep0&&n.isStepAllFieldsHidden(r(f[n.activeStep]));)n.activeStep--;else for(;n.activeStepi&&n div").length-1,u=o.$theForm.find(".fluentform-step.active > .ff_excluded").length;if(o.$theForm.find(".fluentform-step.active > .ff-t-container").length&&(l-=o.$theForm.find(".fluentform-step.active > .ff-t-container").length,l+=o.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > div").length,u+=o.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > .ff_excluded").length,o.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length&&(u-=o.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length,u-=o.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > .ff_excluded").length,u+=o.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > div").length)),l===u)return r.find(".step-nav button[data-action=".concat(i,"], .step-nav img[data-action=").concat(i,"]")).click(),void s()}o.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="next"]').css("visibility","visible"),o.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="prev"]').css("visibility","visible"),o.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="next"]').css("visibility","visible"),o.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="prev"]').css("visibility","visible"),s()}()})})}},{key:"handleFocus",value:function(e){var t=this.$,n=this,a=!1,i=function(a){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="yes"!=n.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");if(!n.isInitialLoad)if(r){var o=a.find("input, .ff-custom_html, select, textarea, button, a").filter(":visible");o.length&&i&&setTimeout(function(){o.first().focus()},e+50),n.isInitialLoad=!1}else{var s;!(null===(s=window.fluentFormVars)||void 0===s||!s.step_change_focus)&&setTimeout(function(){t("".concat(n.formSelector," .fluentform-step.active")).attr("tabindex","-1").focus().removeAttr("tabindex")},e),n.isInitialLoad=!1}};n.$theForm.off("keydown.stepNavigation").on("keydown.stepNavigation",function(e){if(!a&&(" "===e.key||32===e.keyCode)){var i=t("".concat(n.formSelector," .fluentform-step.active .ff-btn-next")),r=t("".concat(n.formSelector," .fluentform-step.active .ff-btn-prev"));return document.activeElement===i[0]?(e.preventDefault(),void i.click()):document.activeElement===r[0]?(e.preventDefault(),void r.click()):void 0}}),this.$theForm.on("ff_to_next_page ff_to_prev_page",function(){a=!0,setTimeout(function(){a=!1,i(n.$theForm.find(".fluentform-step.active"),!0)},e+50)}),"yes"!==this.$theForm.find(".ff-step-container").attr("data-disable_auto_focus")&&0!==n.$theForm.find(".fluentform-step").index(n.$theForm.find(".fluentform-step.active"))&&!this.isInitialLoad&&i(t("".concat(this.formSelector," .fluentform-step.active")),!0),this.isInitialLoad=!1}},{key:"saveStepData",value:function(e,t){var n=this.$,a=e.find(":input").filter(function(e,t){return!n(t).closest(".has-conditions").hasClass("ff_excluded")});a.filter(function(e,t){var a=n(t);return a.parents().hasClass("ff_repeater_table")&&"select"==a.attr("type")&&!a.val()}).prepend("