­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ (()=>{"use strict";function t(e){return t="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},t(e)}function e(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i",{value:e,text:e}))}),n.attr("disabled",!1).val(i[t])})})}else a.each(i,function(i,n){e.$theForm.find('[name="'.concat(t,"[").concat(i,']"]')).val(n).change()})}else if("[object Array]"===n){var f=e.$theForm.find("[name=".concat(t,"]"));if("file"===(f=(f=f.length?f:e.$theForm.find("[data-name=".concat(t,"]"))).length?f:e.$theForm.find("[name=".concat(t,"\\[\\]]"))).attr("type"))e.addFilesToElement(f,i);else if(f.prop("multiple"))if(a.isFunction(window.Choices)){var l=f.data("choicesjs");l&&r.push({handler:l,values:i})}else f.val(i).change();else if("repeater_field"===f.attr("data-type")){var c=f.find("tbody"),d=f.attr("data-name");a.each(i,function(t,e){0!=t?c.find("tr:last").clone().appendTo(c).find(".ff-el-form-control").each(function(i,n){var r="ffrpt-"+(new Date).getTime()+i;a(n).val(e[i]),a(n).attr({id:r,name:"".concat(d,"[").concat(t,"][]"),value:e[i]}).change()}):c.find("tr:first .ff-el-form-control").each(function(t,i){a(i).val(e[t]).change()})})}else"repeater_container"===f.attr("data-type")?(a.each(i,function(t,e){if(0!==t){var i=f.find(".ff_repeater_cont_row:first").clone();i.find(".ff_repeater_cell").each(function(i,n){var r=a(this).find(".ff-el-form-control:last-child"),o="ffrpt-"+(new Date).getTime()+"_"+t+"_"+i,s={value:e[i]||"",id:o};r.prop(s),a(this).find("label").attr("for",o)}),i.insertAfter(f.find(".ff_repeater_cont_row:last"))}else f.find(".ff_repeater_cont_row:first .ff-el-form-control").each(function(t,i){a(i).val(e[t]).change()})}),e.$theForm.trigger("repeater-container-names-update",[f]),f.trigger("repeat_change")):f.each(function(t,e){-1!==a.inArray(a(e).val(),i)&&a(e).prop("checked",!0).change()})}else{var u=e.$theForm.find("[name=".concat(t,"]"));if(u.hasClass("fluentform-post-content")&&window.wp&&window.wp.editor){var p=u.attr("id");window.tinymce.get(p).setContent(i)}if("undefined"!=typeof flatpickr&&u.prop("_flatpickr")){var h=u.prop("_flatpickr");h&&(h.config.altInput?h.setDate(i,!0):u.val(i).trigger("change"))}if("radio"===u.prop("type")||"checkbox"===u.prop("type"))a("[name=".concat(t,'][value="').concat(i,'"]')).prop("checked",!0).change(),e.$theForm.find("[name=".concat(t,'][value="').concat(i,'"]')).prop("checked",!0).change(),u.closest(".ff-el-group").find(".ff-el-ratings").length&&e.$theForm.find("[name=".concat(t,'][value="').concat(i,'"]')).closest("label").trigger("mouseenter");else{u.hasClass("ff_has_multi_select")&&u.data("choicesjs")&&(u.data("choicesjs").removeActiveItems(i),u.data("choicesjs").setChoiceByValue(i));var v=u.closest(".ff-el-group").find(".fluentform-signature-pad");if(v.length){var m=v[0].getContext("2d"),_=new Image;_.src=i,_.onload=function(){m.drawImage(_,0,0)}}u.val(i).change()}}}}),r.length>0)for(var o=0;o0?n.css({transition:"width ".concat(i,"ms ease-in-out")}):n.css({transition:"none"}),n[0]&&n[0].offsetHeight,n.css("width",a+"%"),new Promise(function(t){var e=!1,a=setTimeout(function(){e||(e=!0,t())},(i||0)+120);n.one("transitionend webkitTransitionEnd oTransitionEnd",function(){e||(e=!0,clearTimeout(a),t())})})}},{key:"registerStepNavigators",value:function(t){var e=this.$,i=this;this.handleFocus(t),e(this.formSelector).on("click",".fluentform-step .step-nav button, .fluentform-step .step-nav img",function(n){var a=e(this).data("action"),r="next",o=e(this).closest(".fluentform-step"),s=i.getFormInstance();if("next"===a){try{var f=o.find(":input").not(":button").filter(function(t,i){return!e(i).closest(".has-conditions").hasClass("ff_excluded")});f.length&&s.validate(f),i.activeStep++}catch(n){if(!(n instanceof window.ffValidationError))throw n;return s.showErrorMessages(n.messages),void s.scrollToFirstError(350)}i.$theForm.trigger("ff_to_next_page",i.activeStep),e(document).trigger("ff_to_next_page",{step:i.activeStep,form:i.$theForm});var l=i.$theForm.find(".fluentform-step");i.$theForm.trigger("ff_render_dynamic_smartcodes",e(l[i.activeStep]))}else i.activeStep--,r="prev",i.$theForm.trigger("ff_to_prev_page",i.activeStep),e(document).trigger("ff_to_prev_page",{step:i.activeStep,form:i.$theForm});var c="yes"!=i.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");i.updateSlider(i.activeStep,t,c,r).then(function(){i.handleFocus(t)}).catch(function(t){console.error("An error occurred during the slider update:",t)})})}},{key:"updateSlider",value:function(t,i){var n=this,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"next",o=this.$,s=this;return new Promise(function(f){o("div"+n.formSelector+"_errors").empty(),n.activeStep=t;var l=n.$theForm.find(".ff-step-titles li"),c=n.$theForm.find(".fluentform-step"),d=c.length;if(!window.ff_disable_auto_step&&d){var u=s.$theForm.find(".fluentform-step").index(s.$theForm.find(".fluentform-step.active"));if("prev"===r||u>-1&&n.activeStep0&&n.isStepAllFieldsHidden(o(c[n.activeStep]));)n.activeStep--;else for(;n.activeStep0?50:ia&&i div").length-1,l=s.$theForm.find(".fluentform-step.active > .ff_excluded").length;if(s.$theForm.find(".fluentform-step.active > .ff-t-container").length&&(n-=s.$theForm.find(".fluentform-step.active > .ff-t-container").length,n+=s.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > div").length,l+=s.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > .ff_excluded").length,s.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length&&(l-=s.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length,l-=s.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > .ff_excluded").length,l+=s.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > div").length)),n===l){var u="prev"===r?s.activeStep-1:s.activeStep+1;if(u>=0&&u1&&void 0!==arguments[1]&&arguments[1],r="yes"!=i.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");if(!i.isInitialLoad)if(r){var o=n.find("input, .ff-custom_html, select, textarea, button, a").filter(":visible");o.length&&a&&setTimeout(function(){o.first().focus()},t+50),i.isInitialLoad=!1}else{var s;!(null===(s=window.fluentFormVars)||void 0===s||!s.step_change_focus)&&setTimeout(function(){e("".concat(i.formSelector," .fluentform-step.active")).attr("tabindex","-1").focus().removeAttr("tabindex")},t),i.isInitialLoad=!1}};i.$theForm.off("keydown.stepNavigation").on("keydown.stepNavigation",function(t){if(!n&&(" "===t.key||32===t.keyCode)){var a=e("".concat(i.formSelector," .fluentform-step.active .ff-btn-next")),r=e("".concat(i.formSelector," .fluentform-step.active .ff-btn-prev"));return document.activeElement===a[0]?(t.preventDefault(),void a.click()):document.activeElement===r[0]?(t.preventDefault(),void r.click()):void 0}}),this.$theForm.on("ff_to_next_page ff_to_prev_page",function(){n=!0,setTimeout(function(){n=!1,a(i.$theForm.find(".fluentform-step.active"),!0)},t+50)}),"yes"!==this.$theForm.find(".ff-step-container").attr("data-disable_auto_focus")&&0!==i.$theForm.find(".fluentform-step").index(i.$theForm.find(".fluentform-step.active"))&&!this.isInitialLoad&&a(e("".concat(this.formSelector," .fluentform-step.active")),!0),this.isInitialLoad=!1}},{key:"saveStepData",value:function(t,e){var i=this.$,n=t.find(":input").filter(function(t,e){return!i(e).closest(".has-conditions").hasClass("ff_excluded")});n.filter(function(t,e){var n=i(e);return n.parents().hasClass("ff_repeater_table")&&"select"==n.attr("type")&&!n.val()}).prepend("