PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.15
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.15
6.2.15 6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 All 197 releases
← All changes | assets/js/form-save-progress.js +2 -1 6.2.10 → 6.2.15 View file →
@@ -1 +1,2 @@
1 -(()=>{"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,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,i(a.key),a)}}function i(e){var i=function(e,i){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,i||"default");if("object"!=t(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}(e,"string");return"symbol"==t(i)?i:i+""}var n,a=function(){return i=function t(e,i,n,a){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$=e,this.$theForm=i,this.fluentFormVars=n,this.formSelector=a,this.activeStep=0,this.isRtl=!!window.fluentFormVars.is_rtl,this.isPopulatingStepData=!1,this.isInitialLoad=!0,this.fluentFormVars.stepAnimationDuration=parseInt(this.fluentFormVars.stepAnimationDuration),this.stepPersistency="yes"===this.$theForm.find(".ff-step-container").attr("data-enable_step_data_persistency"),this.stepResume=!1,this.stepPersistency&&(this.stepResume="yes"===this.$theForm.find(".ff-step-container").attr("data-enable_step_page_resume"))},n=[{key:"getPublicAPI",value:function(){return{init:this.init.bind(this),updateSlider:this.updateSlider.bind(this),populateFormDataAndSetActiveStep:this.populateFormDataAndSetActiveStep.bind(this)}}},{key:"init",value:function(){this.initFormWithSavedState(),this.removePrevFromFirstStep(),this.initStepSlider(),this.maybeAutoSlider()}},{key:"removePrevFromFirstStep",value:function(){this.$theForm.find(".fluentform-step:first").find('.step-nav [data-action="prev"]').remove()}},{key:"getFormInstance",value:function(){return window.fluentFormApp(this.$theForm)}},{key:"syncStepTitleState",value:function(t,e){var i=this.$;t&&t.length&&(t.removeClass("ff_active ff_completed").removeAttr("aria-current"),i.each(t,function(t,n){var a=i(n);t<e?a.addClass("ff_completed"):t===e&&a.addClass("ff_active").attr("aria-current","step")}))}},{key:"enhanceClickableStepTitles",value:function(t){var e=this.$;e.each(t,function(t,i){e(i).attr("data-step-number",t),e(i).attr({role:"button",tabindex:"0","aria-label":"Go to step "+(t+1)})})}},{key:"syncTopTabOverflowState",value:function(){var t=this.$;this.$theForm.find(".ff-step-header--tabs-top .ff-step-titles").each(function(){var e=t(this),i=this.scrollWidth>this.clientWidth+1;e.toggleClass("ff-step-titles--overflowing",i)})}},{key:"isTabsIndicator",value:function(t){return"tabs"===t||"steps_with_nav"===t}},{key:"initFormWithSavedState",value:function(){var t=this;if(this.stepPersistency){var e=this.$,i=this;e(document).ready(function(n){var a,s;e.getJSON(t.fluentFormVars.ajaxUrl,{form_id:t.$theForm.data("form_id"),action:"fluentform_step_form_get_data",nonce:null===(a=t.fluentFormVars)||void 0===a?void 0:a.nonce,hash:null===(s=t.fluentFormVars)||void 0===s?void 0:s.hash}).then(function(t){t&&i.populateFormDataAndSetActiveStep(t)})})}}},{key:"populateFormDataAndSetActiveStep",value:function(t){var e=this,i=t.response,n=t.step_completed,a=this.$,s=[];if(this.$theForm.data("ff_restoring_draft_state",!0),this.$theForm.data("ff_restored_draft_state",!0),a.each(i,function(t,i){if(i){var n=Object.prototype.toString.call(i);if("[object Object]"===n){var r=e.$theForm.find("[data-name=".concat(t,"]"));if(r.length&&"tabular-element"===r.attr("data-type"))jQuery.each(i,function(i,n){var s=e.$theForm.find('[name="'.concat(t,"[").concat(i,']\\[\\]"]'));s.length||(s=e.$theForm.find('[name="'.concat(t,"[").concat(i,']"]'))),a.each(s,function(t,e){var i=a(e).val();-1===a.inArray(i,n)&&i!==n||a(e).prop("checked",!0).change()})});else if("chained-select"===r.attr("data-type")){var o={meta_key:r.find("select:first").attr("data-meta_key"),form_id:r.closest("form").attr("data-form_id"),action:"fluentform_get_chained_select_options",filter_options:"all",keys:i};a.getJSON(e.fluentFormVars.ajaxUrl,o).then(function(t){a.each(t,function(t,e){var n=r.find("select[data-key='".concat(t,"']"));0!=n.attr("data-index")&&a.each(e,function(t,e){n.append(a("<option />",{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&&s.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 s="ffrpt-"+(new Date).getTime()+i;a(n).val(e[i]),a(n).attr({id:s,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 s=a(this).find(".ff-el-form-control:last-child"),r="ffrpt-"+(new Date).getTime()+"_"+t+"_"+i,o={value:e[i]||"",id:r};s.prop(o),a(this).find("label").attr("for",r)}),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 p=e.$theForm.find("[name=".concat(t,"]"));if(p.hasClass("fluentform-post-content")&&window.wp&&window.wp.editor){var u=p.attr("id");window.tinymce.get(u).setContent(i)}if("undefined"!=typeof flatpickr&&p.prop("_flatpickr")){var h=p.prop("_flatpickr");h&&(h.config.altInput?h.setDate(i,!0):p.val(i).trigger("change"))}if("radio"===p.prop("type")||"checkbox"===p.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(),p.closest(".ff-el-group").find(".ff-el-ratings").length&&e.$theForm.find("[name=".concat(t,'][value="').concat(i,'"]')).closest("label").trigger("mouseenter");else{p.hasClass("ff_has_multi_select")&&p.data("choicesjs")&&(p.data("choicesjs").removeActiveItems(i),p.data("choicesjs").setChoiceByValue(i));var v=p.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)}}p.val(i).change()}}}}),s.length>0)for(var r=0;r<s.length;r++){var o,f=s[r].handler,l=s[r].values;f.removeActiveItems(l),f.setChoiceByValue(l);var c=null===(o=f.passedElement)||void 0===o?void 0:o.element;c&&a(c).trigger("change")}this.$theForm.data("ff_restoring_draft_state",!1),this.isPopulatingStepData=!0;var d=this.fluentFormVars.stepAnimationDuration;this.stepResume&&this.updateSlider(n,d,!0).then(function(){e.handleFocus(d)}).catch(function(t){console.error("An error occurred during the slider update:",t)}),this.isPopulatingStepData=!1}},{key:"initStepSlider",value:function(){var t=this.$,e=this.$theForm.find(".fluentform-step"),i=e.length,n=this.$theForm.find(".ff-step-titles li"),a=this.$theForm.find(".ff-step-container").first().data("progress_indicator"),s=this.isTabsIndicator(a);if(!window.ff_disable_auto_step){for(var r=this.activeStep,o=0;r<i&&this.isStepAllFieldsHidden(t(e[r]))&&o<i;)r++,o++;r!==this.activeStep&&r<i&&(this.activeStep=r)}e.css("display","none"),t(e[this.activeStep]).css("display","block"),e.attr("role","group"),e.attr("aria-hidden","true"),t(e[this.activeStep]).attr("aria-hidden","false"),t(e[this.activeStep]).addClass("active"),this.syncStepTitleState(n,this.activeStep);var f=e.first();f.hasClass("active")&&f.find('button[data-action="next"]').css("visibility","visible"),e.length&&!e.last().hasClass("active")&&this.$theForm.find('button[type="submit"]').css("visibility","hidden"),this.stepProgressBarHandle({activeStep:this.activeStep,totalSteps:i}),this.registerStepNavigators(this.fluentFormVars.stepAnimationDuration),s?(this.registerClickableStepNav(n,e),this.syncTopTabOverflowState(),t(window).off("resize.ff_step_tabs_"+this.$theForm.data("form_id")).on("resize.ff_step_tabs_"+this.$theForm.data("form_id"),this.syncTopTabOverflowState.bind(this))):t(window).off("resize.ff_step_tabs_"+this.$theForm.data("form_id"))}},{key:"registerClickableStepNav",value:function(t,e){var i=this.$,n=this;0!==t.length&&(this.enhanceClickableStepTitles(t),t.on("click keydown",function(t){if("keydown"!==t.type||"Enter"===t.key||" "===t.key||13===t.keyCode||32===t.keyCode){"keydown"===t.type&&t.preventDefault();var a=n.getFormInstance(),s=i(this),r=n.fluentFormVars.stepAnimationDuration,o=e.index(n.$theForm.find(".fluentform-step.active"));try{var f=parseInt(s.data("step-number"),10);if(isNaN(f))return;if(f===o)return;f>o&&i.each(e,function(t,e){if(t<f){var n=i(e).find(":input").not(":button").filter(function(t,e){return!i(e).closest(".has-conditions").hasClass("ff_excluded")});n.length&&a.validate(n)}}),n.updateSlider(f,r,!0).then(function(){n.handleFocus(r)}).catch(function(t){console.error("An error occurred during the slider update:",t)})}catch(t){if(!(t instanceof window.ffValidationError))throw t;n.updateSlider(o,r,!0).then(function(){n.handleFocus(r)}).catch(function(t){console.error("An error occurred during the slider update:",t)}),a.showErrorMessages(t.messages),a.scrollToFirstError(350)}}}))}},{key:"stepProgressBarHandle",value:function(t){var e=this.$;if(this.$theForm.find(".ff-el-progress").length){var i=t.totalSteps,n=t.activeStep,a=100/i*(n+1),s=this.$theForm.find(".ff-el-progress-title li"),r=this.$theForm.find(".ff-step-header .ff-el-progress-bar"),o=r.find("span"),f=this.$theForm.find(".ff-step-container").first(),l=this.isTabsIndicator(f.data("progress_indicator"));r.css({transition:"width 0.3s ease-in-out",width:a+"%"}),a?r.append(o.text(parseInt(a)+"%")):o.empty();var c=this.fluentFormVars.step_text,d=e(s[n]).text();c=l?parseInt(a)+"% "+this.fluentFormVars.step_completed_text:c.replace("%activeStep%",n+1).replace("%totalStep%",i).replace("%stepTitle%",d),this.$theForm.find(".ff-el-progress-status").html(c).attr("aria-live","polite"),s.css("display","none"),e(s[n]).css("display","inline")}}},{key:"isStepAllFieldsHidden",value:function(t){return this.$,t.find(".ff-el-group").not(".ff-custom_html").length,!1}},{key:"animateProgressToStep",value:function(t,e,i){this.$;var n=this.$theForm.find(".ff-step-header .ff-el-progress-bar");if(!n.length||!e)return Promise.resolve();var a=100/e*(t+1);return i&&i>0?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"),s="next",r=e(this).closest(".fluentform-step"),o=i.getFormInstance();if("next"===a){try{var f=r.find(":input").not(":button").filter(function(t,i){return!e(i).closest(".has-conditions").hasClass("ff_excluded")});f.length&&o.validate(f),i.activeStep++}catch(n){if(!(n instanceof window.ffValidationError))throw n;return o.showErrorMessages(n.messages),void o.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--,s="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,s).then(function(){i.handleFocus(t)}).catch(function(t){console.error("An error occurred during the slider update:",t)})})}},{key:"updateSlider",value:function(t,e){var i=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"next",s=this.$,r=this;return new Promise(function(o){s("div"+i.formSelector+"_errors").empty(),i.activeStep=t;var f=i.$theForm.find(".ff-step-titles li"),l=i.$theForm.find(".fluentform-step"),c=l.length;if(!window.ff_disable_auto_step&&c){var d=r.$theForm.find(".fluentform-step").index(r.$theForm.find(".fluentform-step.active"));if("prev"===a||d>-1&&i.activeStep<d)for(;i.activeStep>0&&i.isStepAllFieldsHidden(s(l[i.activeStep]));)i.activeStep--;else for(;i.activeStep<c-1&&i.isStepAllFieldsHidden(s(l[i.activeStep]));)i.activeStep++}l.css("display","none").removeClass("active").attr("aria-hidden","true"),s(l[i.activeStep]).css("display","block").addClass("active").attr("aria-hidden","false"),i.syncStepTitleState(f,i.activeStep);var p=s(l[i.activeStep]).closest(".ff-step-container").data("animation_type"),u=s(l[i.activeStep]).closest(".ff-step-container"),h=s(l[i.activeStep]).closest(".ff-step-body"),v=i.isTabsIndicator(u.data("progress_indicator"));v&&h.css("overflow","hidden");var m=s(l[i.activeStep]);m.find(".step-nav button, .step-nav img").css("visibility","hidden");var _,g=c;_="none"===p?0===e?0:e<50?50:e<200?e:window.ffTransitionTimeOut||500:e;var b,y=i.animateProgressToStep(i.activeStep,g,_);switch(p){case"slide":m.css({display:"block",position:"relative",left:i.isRtl?"-100%":"100%",opacity:0,transition:"all ".concat(e,"ms cubic-bezier(0.25, 0.1, 0.25, 1.0)")}),m[0].offsetHeight,m.css({left:"0%",opacity:1}),b=new Promise(function(t){return setTimeout(function(){m.css({position:"",left:"",transition:""}),t()},e+50)});break;case"fade":m.css({display:"block",opacity:0,transition:"opacity ".concat(e,"ms ease-in-out")}),m[0].offsetHeight,m.css("opacity",1),b=new Promise(function(t){return setTimeout(function(){m.css("transition",""),t()},e+50)});break;case"slide_down":m.css({display:"block",opacity:0,maxHeight:"0",overflow:"hidden",transition:"all ".concat(e,"ms cubic-bezier(0.25, 0.1, 0.25, 1.0)")}),m[0].offsetHeight;var w=m[0].scrollHeight;m.css({maxHeight:w+"px",opacity:1}),b=new Promise(function(t){return setTimeout(function(){m.css({maxHeight:"",overflow:"",transition:""}),t()},e+50)});break;default:var F,S=window.ffTransitionTimeOut||500;F=e<50&&e>0?50:e<S?e:S,b=new Promise(function(t){return setTimeout(t,F)})}Promise.all([b,y]).then(function(){n&&function(){if(!window.ff_disable_step_scroll){var t,e,i,n,a,o,f=r.$theForm.find(".ff_step_start");t=window.ff_scroll_top_offset?window.ff_scroll_top_offset:f.offset().top-100,n=(i=(e=f).offset().top)+e.outerHeight(),o=(a=s(window).scrollTop())+s(window).height(),n>a&&i<o&&!window.ff_force_scroll||s("html, body").animate({scrollTop:t},500,"swing")}}(),function(){v&&h.css("overflow","");var e=0===t&&!n,i=r.$theForm.hasClass("ff_submitting");!r.stepPersistency||r.isPopulatingStepData||e||i||r.saveStepData(r.$theForm,r.activeStep).then(function(t){}),r.stepProgressBarHandle({activeStep:r.activeStep,totalSteps:c});var f=r.$theForm.find('button[type="submit"]').not(".ff-btn-save-progress"),d=-1;if(f.length){var p=f[0];l.each(function(t){if(this.contains(p))return d=t,!1})}var u=l.index(r.$theForm.find(".fluentform-step.active")),m=d>=0&&u>=d;if(!m&&v){var _=r.$theForm.find(".ff-step-titles--clickable li").length;_>0&&u>=_-1&&(m=!0)}if(f.css("visibility",m?"visible":"hidden"),!window.ff_disable_auto_step){r.$theForm.find(".fluentform-step.active");var g=r.$theForm.find(".fluentform-step.active > .step-nav").length,b=r.$theForm.find(".fluentform-step.active > div").length-g,y=r.$theForm.find(".fluentform-step.active > .ff_excluded").length;if(r.$theForm.find(".fluentform-step.active > .ff-t-container").length&&(b-=r.$theForm.find(".fluentform-step.active > .ff-t-container").length,b+=r.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > div").length,y+=r.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > .ff_excluded").length,r.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length&&(y-=r.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length,y-=r.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > .ff_excluded").length,y+=r.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > div").length)),b===y){var w="prev"===a?r.activeStep-1:r.activeStep+1;if(w>=0&&w<c){var F="none"===s(l[w]).closest(".ff-step-container").data("animation_type")?50:100;return void r.updateSlider(w,F,n,a).then(function(){o()}).catch(function(t){console.error("An error occurred during step skip:",t),o()})}}}r.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="next"]').css("visibility","visible"),r.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="prev"]').css("visibility","visible"),r.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="next"]').css("visibility","visible"),r.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="prev"]').css("visibility","visible"),o()}()})})}},{key:"handleFocus",value:function(t){var e=this.$,i=this,n=!1,a=function(n){var a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s="yes"!=i.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");if(!i.isInitialLoad){var r;if(s){if(!window.ff_disable_step_scroll){var o=n.find("input, .ff-custom_html, select, textarea, button, a").filter(":visible");o.length&&a&&setTimeout(function(){o.first().focus()},t+50)}}else null!==(r=window.fluentFormVars)&&void 0!==r&&r.step_change_focus&&!window.ff_disable_step_scroll&&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")),s=e("".concat(i.formSelector," .fluentform-step.active .ff-btn-prev"));return document.activeElement===a[0]?(t.preventDefault(),void a.click()):document.activeElement===s[0]?(t.preventDefault(),void s.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,n=this.$,a=t.find(":input").filter(function(t,e){return!n(e).closest(".has-conditions").hasClass("ff_excluded")});a.filter(function(t,e){var i=n(e);return i.parents().hasClass("ff_repeater_table")&&"select"==i.attr("type")&&!i.val()}).prepend("<option selected disabled />");var s=a.serialize();n.each(t.find("[type=file]"),function(t,e){var i={},a=e.name+"[]";i[a]=[],n(e).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each(function(t,e){i[a][t]=n(this).data("src")}),n.each(i,function(t,e){if(e.length){var i={};i[t]=e,s+="&"+n.param(i)}})});var r={active_step:e,data:s,form_id:t.data("form_id"),action:"fluentform_step_form_save_data",nonce:null===(i=this.fluentFormVars)||void 0===i?void 0:i.nonce};return n.post(this.fluentFormVars.ajaxUrl,r)}},{key:"maybeAutoSlider",value:function(){var t=this.$;if("yes"==this.$theForm.find(".ff-step-container").attr("data-enable_auto_slider")){var e=function(t){if(1==t.closest(".fluentform-step.active").find(".ff-el-group:not(.ff_excluded):not(.ff-custom_html)").length)if(t.closest(".fluentform-step.active").find(".ff_excluded").length){var e=window.ffTransitionTimeOut||500;setTimeout(function(){t.closest(".fluentform-step.active").find(".ff-btn-next").trigger("click")},e)}else t.closest(".fluentform-step.active").find(".ff-btn-next").trigger("click")};this.$theForm.find(".ff-el-form-check-radio,.ff-el-net-label, .ff-el-ratings label").on("click",function(){e(t(this))}),this.$theForm.find("select").on("change",function(){e(t(this))})}}},{key:"addFilesToElement",value:function(e,i){var n=this.$,a=this,s=e.closest(".ff-el-input--content").find(".ff-uploaded-list");n.each(i,function(e,i){i="object"===t(i)?i:{url:i,data_src:i};var r=n("<div/>",{class:"ff-upload-preview","data-src":i.data_src,style:"border: 1px solid rgb(111, 117, 125)"}),o=n("<div/>",{class:"ff-upload-thumb"});o.append(n("<div/>",{class:"ff-upload-preview-img",style:"background-image: url('".concat(a.getThumbnail(i.url),"');")}));var f=n("<div/>",{class:"ff-upload-details"}),l=n("<span/>",{html:a.fluentFormVars.upload_completed_txt,class:"ff-upload-progress-inline-text ff-inline-block"}),c=i.url.substring(i.url.lastIndexOf("/")+1);c.includes("-ff-")&&(c=c.substring(c.lastIndexOf("-ff-")+4));var d=n("<div/>",{class:"ff-upload-filename",html:c}),p=n('\n <div class="ff-upload-progress-inline ff-el-progress">\n <div style="width: 100%;" class="ff-el-progress-bar"></div>\n </div>\n '),u=n("<span/>",{"data-href":"#",html:"&times;",class:"ff-upload-remove"}),h=n("<div>",{class:"ff-upload-filesize ff-inline-block",html:""}),v=n("<div>",{class:"ff-upload-error",style:"color:red;"});f.append(d,p,l,h,v,u),r.append(o,f),s.append(r)}),e.trigger("change_remaining",-i.length),e.trigger("change")}},{key:"getThumbnail",value:function(t){if(!t)return"";var e=t.split(/[#?]/)[0].split(".").pop().trim().toLowerCase();if(-1!=["jpg","jpeg","gif","png"].indexOf(e))return t;var i=document.createElement("canvas");i.width=60,i.height=60,i.style.zIndex=8,i.style.position="absolute",i.style.border="1px solid";var n=i.getContext("2d");return n.fillStyle="rgba(0, 0, 0, 0.2)",n.fillRect(0,0,60,60),n.font="13px Arial",n.fillStyle="white",n.textAlign="center",n.fillText(e,30,30,60),i.toDataURL()}}],n&&e(i.prototype,n),a&&e(i,a),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n,a}();(n=jQuery)(document.body).on("fluentform_init",function(t,e,i){var s="."+i.form_instance,r=-1,o="no";function f(t,e){var n="fluentform_save_progress_messages_"+i.id;return window[n]&&window[n][t]?window[n][t]:e}if(n(s).hasClass("ff-form-has-save-progress")){n(s).hasClass("ff-form-has-steps")&&(e.on("ff_to_next_page",function(t,e){o=e}),e.on("ff_to_prev_page",function(t,e){o=e})),n(s).find(".ff-btn-save-progress").each(function(t,i){var a=n(i);a.on("click",function(t){var i,s=this;t.preventDefault(),a.addClass("ff-working");var l=e.find(":input").filter(function(t,e){return!n(e).closest(".has-conditions").hasClass("ff_excluded")});l.filter(function(t,e){var i=n(e);return i.parents().hasClass("ff_repeater_table")&&"select"==i.attr("type")&&!i.val()}).prepend("<option selected disabled />");var c=l.serialize();n.each(e.find("[type=file]"),function(t,e){var i={},a=e.name+"[]";i[a]=[],n(e).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each(function(t,e){i[a][t]=n(this).data("src")}),n.each(i,function(t,e){if(e.length){var i={};i[t]=e,c+="&"+n.param(i)}})}),r=null===(i=window.form_state_save_vars)||void 0===i?void 0:i.key;var d={source_url:window.form_state_save_vars.source_url,action:"fluentform_save_form_progress_with_link",data:c,form_id:e.data("form_id"),hash:r,active_step:o,nonce:window.form_state_save_vars.nonce,save_progress_btn_name:n(a).attr("name")},p=d.form_id+"_save_progress_msg",u="#"+p;jQuery.post(fluentFormVars.ajaxUrl,d).then(function(t){if(t){var i;r=t.data.hash,e.find(".ff-saved-state-link"),""!=(null===(i=t.data)||void 0===i?void 0:i.message)&&(n(u).length&&n(u).slideUp("fast"),n("<div/>",{id:p,class:"ff-message-success ff-el-group"}).html(t.data.message).insertBefore(a.closest(".ff-el-group")));var o=f("copy_button",window.form_state_save_vars.copy_button||"Copy"),l='<div class="ff-el-input--content">\n <div class="ff_input-group">\n <input readonly value="'.concat(t.data.saved_url,'" class="ff-el-form-control" >\n <div class="ff_input-group-append">\n <button class="ff-btn ff-btn-md ff_btn_style ff_btn_copy_link ff_input-group-text">').concat(o,"</button>\n </div>\n </div>\n </div>"),c=n("<div/>",{class:"ff-el-group ff-saved-state-input ff-saved-state-link ff-hide-group",html:l});n(s).closest(".ff-el-group").after(c),c.fadeIn(),c.find("input.ff-el-form-control").on("keypress",function(t){13!==t.which&&13!==t.keyCode||(t.preventDefault(),n(this).siblings(".ff_input-group-append").find(".ff_btn_copy_link").click())});var d=f("email_placeholder",window.form_state_save_vars.email_placeholder_str||"Your Email Here"),h=f("email_button",window.form_state_save_vars.email_button||"Email");if(n(s).hasClass("ff_resume_email_enabled")){var v='<div class="ff-el-input--content">\n <div class="ff_input-group">\n <input type="email" class="ff-el-form-control" placeholder="'.concat(d,'">\n <div class="ff_input-group-append">\n <button class="ff-btn ff-btn-md ff_btn_style ff_btn_is_email ff_input-group-text">').concat(h,"</button>\n </div>\n </div>\n </div>"),m=n("<div/>",{class:"ff-el-group ff-saved-state-input ff-email-address ff-hide-group",html:v});n(c).after(m),m.fadeIn(),m.find("input.ff-el-form-control").on("keypress",function(t){13!==t.which&&13!==t.keyCode||(t.preventDefault(),n(this).siblings(".ff_input-group-append").find(".ff_btn_is_email").click())})}}}).fail(function(t){n(u).length&&n(u).slideUp("fast"),n("<div/>",{id:p,class:"ff-message-success ff-el-group text-danger"}).html(t.responseJSON.data.message).insertBefore(a.closest(".ff-el-group"))}).always(function(){a.parent().hide()})})}),n(s).on("click",".ff_btn_copy_link",function(t){t.preventDefault();var e=n(this).closest(".ff-el-input--content").find(".ff-el-form-control").val();navigator.clipboard.writeText(e);var i=f("copy_success",window.form_state_save_vars.copy_success_button||"Copied");n(this).html("".concat(i))}),n(s).on("click",".ff_btn_is_email",function(t){t.preventDefault();var i=n(this).closest(".ff-el-group"),a=n(this).closest(".ff-email-address").find("input").val();n(".ff-email-address").find("input").val("");var s=n(".ff-saved-state-link").find("input").val(),o={source_url:window.form_state_save_vars.source_url,action:"fluentform_email_progress_link",form_id:e.data("form_id"),to_email:a,link:s,hash:r,nonce:window.form_state_save_vars.nonce},f=o.form_id+"_save_progress_email_response",l="#"+f;jQuery.post(fluentFormVars.ajaxUrl,o).then(function(t){t&&(i.removeClass("ff-el-is-error"),n(l).length&&n(l).slideUp("fast"),n("<div/>",{id:f,class:"ff-message-success ff-el-group"}).html(t.data.response).insertAfter(i))}).fail(function(t){t&&(i.addClass("ff-el-is-error"),n(l).length&&n(l).slideUp("fast"),n("<div/>",{id:f,class:"ff-message-success ff-el-group text-danger"}).html(t.responseJSON.data.Error).insertAfter(i))})});var l=!1;void 0!==window.form_state_save_vars&&(l=window.form_state_save_vars.key),l&&(e.append('<input type="hidden" value="'.concat(l,'" class="__fluent_state_hash" name="__fluent_state_hash"/>')),"yes"==e.find(".ff-step-container").attr("data-enable_step_data_persistency")||jQuery.getJSON(fluentFormVars.ajaxUrl,{form_id:e.data("form_id"),action:"fluentform_get_form_state",hash:l,nonce:window.form_state_save_vars.nonce}).then(function(t){if(t){var i=function(t,e,i,n){return new a(t,e,i,n).getPublicAPI()}(n,e,window.fluentFormVars,s);i.populateFormDataAndSetActiveStep(t)}}))}})})();
1 +/*! For license information please see form-save-progress.js.LICENSE.txt */
2 +(()=>{"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,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,n(r.key),r)}}function n(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,n||"default");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}var i=function(){return n=function t(e,n,i,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$=e,this.$theForm=n,this.fluentFormVars=i,this.formSelector=r,this.activeStep=0,this.isRtl=!!window.fluentFormVars.is_rtl,this.isPopulatingStepData=!1,this.isInitialLoad=!0,this.fluentFormVars.stepAnimationDuration=parseInt(this.fluentFormVars.stepAnimationDuration),this.stepPersistency="yes"===this.$theForm.find(".ff-step-container").attr("data-enable_step_data_persistency"),this.stepResume=!1,this.stepPersistency&&(this.stepResume="yes"===this.$theForm.find(".ff-step-container").attr("data-enable_step_page_resume"))},i=[{key:"getPublicAPI",value:function(){return{init:this.init.bind(this),updateSlider:this.updateSlider.bind(this),populateFormDataAndSetActiveStep:this.populateFormDataAndSetActiveStep.bind(this)}}},{key:"init",value:function(){this.initFormWithSavedState(),this.removePrevFromFirstStep(),this.initStepSlider(),this.maybeAutoSlider()}},{key:"removePrevFromFirstStep",value:function(){this.$theForm.find(".fluentform-step:first").find('.step-nav [data-action="prev"]').remove()}},{key:"getFormInstance",value:function(){return window.fluentFormApp(this.$theForm)}},{key:"syncStepTitleState",value:function(t,e){var n=this.$;t&&t.length&&(t.removeClass("ff_active ff_completed").removeAttr("aria-current"),n.each(t,function(t,i){var r=n(i);t<e?r.addClass("ff_completed"):t===e&&r.addClass("ff_active").attr("aria-current","step")}))}},{key:"enhanceClickableStepTitles",value:function(t){var e=this.$;e.each(t,function(t,n){e(n).attr("data-step-number",t),e(n).attr({role:"button",tabindex:"0","aria-label":"Go to step "+(t+1)})})}},{key:"syncTopTabOverflowState",value:function(){var t=this.$;this.$theForm.find(".ff-step-header--tabs-top .ff-step-titles").each(function(){var e=t(this),n=this.scrollWidth>this.clientWidth+1;e.toggleClass("ff-step-titles--overflowing",n)})}},{key:"isTabsIndicator",value:function(t){return"tabs"===t||"steps_with_nav"===t}},{key:"isClickableIndicator",value:function(t){return this.isTabsIndicator(t)||"steps"===t}},{key:"initFormWithSavedState",value:function(){var t=this;if(this.stepPersistency){var e=this.$,n=this;e(document).ready(function(i){var r,o;e.getJSON(t.fluentFormVars.ajaxUrl,{form_id:t.$theForm.data("form_id"),action:"fluentform_step_form_get_data",nonce:null===(r=t.fluentFormVars)||void 0===r?void 0:r.nonce,hash:null===(o=t.fluentFormVars)||void 0===o?void 0:o.hash}).then(function(t){t&&n.populateFormDataAndSetActiveStep(t)})})}}},{key:"populateFormDataAndSetActiveStep",value:function(t){var e=this,n=t.response,i=t.step_completed,r=this.$,o=[];if(this.$theForm.data("ff_restoring_draft_state",!0),this.$theForm.data("ff_restored_draft_state",!0),r.each(n,function(t,n){if(n){var i=Object.prototype.toString.call(n);if("[object Object]"===i){var a=e.$theForm.find("[data-name=".concat(t,"]"));if(a.length&&"tabular-element"===a.attr("data-type"))jQuery.each(n,function(n,i){var o=e.$theForm.find('[name="'.concat(t,"[").concat(n,']\\[\\]"]'));o.length||(o=e.$theForm.find('[name="'.concat(t,"[").concat(n,']"]'))),r.each(o,function(t,e){var n=r(e).val();-1===r.inArray(n,i)&&n!==i||r(e).prop("checked",!0).change()})});else if("chained-select"===a.attr("data-type")){var s={meta_key:a.find("select:first").attr("data-meta_key"),form_id:a.closest("form").attr("data-form_id"),action:"fluentform_get_chained_select_options",filter_options:"all",keys:n};r.getJSON(e.fluentFormVars.ajaxUrl,s).then(function(t){r.each(t,function(t,e){var i=a.find("select[data-key='".concat(t,"']"));0!=i.attr("data-index")&&r.each(e,function(t,e){i.append(r("<option />",{value:e,text:e}))}),i.attr("disabled",!1).val(n[t])})})}else r.each(n,function(n,i){e.$theForm.find('[name="'.concat(t,"[").concat(n,']"]')).val(i).change()})}else if("[object Array]"===i){var l=e.$theForm.find("[name=".concat(t,"]"));if("file"===(l=(l=l.length?l:e.$theForm.find("[data-name=".concat(t,"]"))).length?l:e.$theForm.find("[name=".concat(t,"\\[\\]]"))).attr("type"))e.addFilesToElement(l,n);else if(l.prop("multiple"))if(r.isFunction(window.Choices)){var f=l.data("choicesjs");f&&o.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");r.each(n,function(t,e){0!=t?c.find("tr:last").clone().appendTo(c).find(".ff-el-form-control").each(function(n,i){var o="ffrpt-"+(new Date).getTime()+n;r(i).val(e[n]),r(i).attr({id:o,name:"".concat(u,"[").concat(t,"][]"),value:e[n]}).change()}):c.find("tr:first .ff-el-form-control").each(function(t,n){r(n).val(e[t]).change()})})}else"repeater_container"===l.attr("data-type")?(r.each(n,function(t,e){if(0!==t){var n=l.find(".ff_repeater_cont_row:first").clone();n.find(".ff_repeater_cell").each(function(n,i){var o=r(this).find(".ff-el-form-control:last-child"),a="ffrpt-"+(new Date).getTime()+"_"+t+"_"+n,s={value:e[n]||"",id:a};o.prop(s),r(this).find("label").attr("for",a)}),n.insertAfter(l.find(".ff_repeater_cont_row:last"))}else l.find(".ff_repeater_cont_row:first .ff-el-form-control").each(function(t,n){r(n).val(e[t]).change()})}),e.$theForm.trigger("repeater-container-names-update",[l]),l.trigger("repeat_change")):l.each(function(t,e){-1!==r.inArray(r(e).val(),n)&&r(e).prop("checked",!0).change()})}else{var d=e.$theForm.find("[name=".concat(t,"]"));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 m=d.prop("_flatpickr");m&&(m.config.altInput?m.setDate(n,!0):d.val(n).trigger("change"))}if("radio"===d.prop("type")||"checkbox"===d.prop("type"))e.$theForm.find("[name=".concat(t,'][value="').concat(n,'"]')).prop("checked",!0).change(),d.closest(".ff-el-group").find(".ff-el-ratings").length&&e.$theForm.find("[name=".concat(t,'][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 h=d.closest(".ff-el-group").find(".fluentform-signature-pad");if(h.length){var v=h[0].getContext("2d"),g=new Image;g.src=n,g.onload=function(){v.drawImage(g,0,0)}}d.val(n).change()}}}}),o.length>0)for(var a=0;a<o.length;a++){var s,l=o[a].handler,f=o[a].values;l.removeActiveItems(f),l.setChoiceByValue(f);var c=null===(s=l.passedElement)||void 0===s?void 0:s.element;c&&r(c).trigger("change")}this.$theForm.data("ff_restoring_draft_state",!1),this.isPopulatingStepData=!0;var u=this.fluentFormVars.stepAnimationDuration;this.stepResume&&this.updateSlider(i,u,!0).then(function(){e.handleFocus(u)}).catch(function(t){console.error("An error occurred during the slider update:",t)}),this.isPopulatingStepData=!1}},{key:"initStepSlider",value:function(){var t=this.$,e=this.$theForm.find(".fluentform-step"),n=e.length,i=this.$theForm.find(".ff-step-titles li"),r=this.$theForm.find(".ff-step-container").first().data("progress_indicator"),o=this.isClickableIndicator(r)&&this.$theForm.find(".ff-step-titles").first().hasClass("ff-step-titles--clickable");if(!window.ff_disable_auto_step){for(var a=this.activeStep,s=0;a<n&&this.isStepAllFieldsHidden(t(e[a]))&&s<n;)a++,s++;a!==this.activeStep&&a<n&&(this.activeStep=a)}e.css("display","none"),t(e[this.activeStep]).css("display","block"),e.attr("role","group"),e.attr("aria-hidden","true"),t(e[this.activeStep]).attr("aria-hidden","false"),t(e[this.activeStep]).addClass("active"),this.syncStepTitleState(i,this.activeStep);var l=e.first();l.hasClass("active")&&l.find('button[data-action="next"]').css("visibility","visible"),e.length&&!e.last().hasClass("active")&&this.$theForm.find('button[type="submit"]').css("visibility","hidden"),this.stepProgressBarHandle({activeStep:this.activeStep,totalSteps:n}),this.registerStepNavigators(this.fluentFormVars.stepAnimationDuration),o&&this.registerClickableStepNav(i,e),this.isTabsIndicator(r)?(this.syncTopTabOverflowState(),t(window).off("resize.ff_step_tabs_"+this.$theForm.data("form_id")).on("resize.ff_step_tabs_"+this.$theForm.data("form_id"),this.syncTopTabOverflowState.bind(this))):t(window).off("resize.ff_step_tabs_"+this.$theForm.data("form_id"))}},{key:"registerClickableStepNav",value:function(t,e){var n=this.$,i=this;0!==t.length&&(this.enhanceClickableStepTitles(t),t.on("click keydown",function(t){if("keydown"!==t.type||"Enter"===t.key||" "===t.key||13===t.keyCode||32===t.keyCode){"keydown"===t.type&&t.preventDefault();var r=i.getFormInstance(),o=n(this),a=i.fluentFormVars.stepAnimationDuration,s=e.index(i.$theForm.find(".fluentform-step.active"));try{var l=parseInt(o.data("step-number"),10);if(isNaN(l))return;if(l===s)return;l>s&&n.each(e,function(t,e){if(t<l){var i=n(e).find(":input").not(":button").filter(function(t,e){return!n(e).closest(".has-conditions").hasClass("ff_excluded")});i.length&&r.validate(i)}}),i.updateSlider(l,a,!0).then(function(){i.handleFocus(a)}).catch(function(t){console.error("An error occurred during the slider update:",t)})}catch(t){if(!(t instanceof window.ffValidationError))throw t;i.updateSlider(s,a,!0).then(function(){i.handleFocus(a)}).catch(function(t){console.error("An error occurred during the slider update:",t)}),r.showErrorMessages(t.messages),r.scrollToFirstError(350)}}}))}},{key:"stepProgressBarHandle",value:function(t){var e=this.$;if(this.$theForm.find(".ff-el-progress").length){var n=t.totalSteps,i=t.activeStep,r=100/n*(i+1),o=this.$theForm.find(".ff-el-progress-title li"),a=this.$theForm.find(".ff-step-header .ff-el-progress-bar"),s=a.find("span"),l=this.$theForm.find(".ff-step-container").first(),f=this.isTabsIndicator(l.data("progress_indicator"));a.css({transition:"width 0.3s ease-in-out",width:r+"%"}),r?a.append(s.text(parseInt(r)+"%")):s.empty();var c=this.fluentFormVars.step_text,u=e(o[i]).text();c=f?parseInt(r)+"% "+this.fluentFormVars.step_completed_text:c.replace("%activeStep%",i+1).replace("%totalStep%",n).replace("%stepTitle%",u),this.$theForm.find(".ff-el-progress-status").text(c).attr("aria-live","polite"),o.css("display","none"),e(o[i]).css("display","inline")}}},{key:"isStepAllFieldsHidden",value:function(t){return this.$,t.find(".ff-el-group").not(".ff-custom_html").length,!1}},{key:"animateProgressToStep",value:function(t,e,n){this.$;var i=this.$theForm.find(".ff-step-header .ff-el-progress-bar");if(!i.length||!e)return Promise.resolve();var r=100/e*(t+1);return n&&n>0?i.css({transition:"width ".concat(n,"ms ease-in-out")}):i.css({transition:"none"}),i[0]&&i[0].offsetHeight,i.css("width",r+"%"),new Promise(function(t){var e=!1,r=setTimeout(function(){e||(e=!0,t())},(n||0)+120);i.one("transitionend webkitTransitionEnd oTransitionEnd",function(){e||(e=!0,clearTimeout(r),t())})})}},{key:"registerStepNavigators",value:function(t){var e=this.$,n=this;this.handleFocus(t),e(this.formSelector).on("click",".fluentform-step .step-nav button, .fluentform-step .step-nav img",function(i){var r=e(this).data("action"),o="next",a=e(this).closest(".fluentform-step"),s=n.getFormInstance();if("next"===r){try{var l=a.find(":input").not(":button").filter(function(t,n){return!e(n).closest(".has-conditions").hasClass("ff_excluded")});l.length&&s.validate(l),n.activeStep++}catch(i){if(!(i instanceof window.ffValidationError))throw i;return s.showErrorMessages(i.messages),void s.scrollToFirstError(350)}n.$theForm.trigger("ff_to_next_page",n.activeStep),e(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",e(f[n.activeStep]))}else n.activeStep--,o="prev",n.$theForm.trigger("ff_to_prev_page",n.activeStep),e(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,t,c,o).then(function(){n.handleFocus(t)}).catch(function(t){console.error("An error occurred during the slider update:",t)})})}},{key:"updateSlider",value:function(t,e){var n=this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"next",o=this.$,a=this;return new Promise(function(s){o("div"+n.formSelector+"_errors").empty(),n.activeStep=t;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=a.$theForm.find(".fluentform-step").index(a.$theForm.find(".fluentform-step.active"));if("prev"===r||u>-1&&n.activeStep<u)for(;n.activeStep>0&&n.isStepAllFieldsHidden(o(f[n.activeStep]));)n.activeStep--;else for(;n.activeStep<c-1&&n.isStepAllFieldsHidden(o(f[n.activeStep]));)n.activeStep++}f.css("display","none").removeClass("active").attr("aria-hidden","true"),o(f[n.activeStep]).css("display","block").addClass("active").attr("aria-hidden","false"),n.syncStepTitleState(l,n.activeStep);var d=o(f[n.activeStep]).closest(".ff-step-container").data("animation_type"),p=o(f[n.activeStep]).closest(".ff-step-container"),m=o(f[n.activeStep]).closest(".ff-step-body"),h=n.isTabsIndicator(p.data("progress_indicator"));h&&m.css("overflow","hidden");var v=o(f[n.activeStep]);v.find(".step-nav button, .step-nav img").css("visibility","hidden");var g,_=c;g="none"===d?0===e?0:e<50?50:e<200?e:window.ffTransitionTimeOut||500:e;var y,b=n.animateProgressToStep(n.activeStep,_,g);switch(d){case"slide":v.css({display:"block",position:"relative",left:n.isRtl?"-100%":"100%",opacity:0,transition:"all ".concat(e,"ms cubic-bezier(0.25, 0.1, 0.25, 1.0)")}),v[0].offsetHeight,v.css({left:"0%",opacity:1}),y=new Promise(function(t){return setTimeout(function(){v.css({position:"",left:"",transition:""}),t()},e+50)});break;case"fade":v.css({display:"block",opacity:0,transition:"opacity ".concat(e,"ms ease-in-out")}),v[0].offsetHeight,v.css("opacity",1),y=new Promise(function(t){return setTimeout(function(){v.css("transition",""),t()},e+50)});break;case"slide_down":v.css({display:"block",opacity:0,maxHeight:"0",overflow:"hidden",transition:"all ".concat(e,"ms cubic-bezier(0.25, 0.1, 0.25, 1.0)")}),v[0].offsetHeight;var S=v[0].scrollHeight;v.css({maxHeight:S+"px",opacity:1}),y=new Promise(function(t){return setTimeout(function(){v.css({maxHeight:"",overflow:"",transition:""}),t()},e+50)});break;default:var w,T=window.ffTransitionTimeOut||500;w=e<50&&e>0?50:e<T?e:T,y=new Promise(function(t){return setTimeout(t,w)})}Promise.all([y,b]).then(function(){i&&function(){if(!window.ff_disable_step_scroll){var t,e,n,i,r,s,l=a.$theForm.find(".ff_step_start");t=window.ff_scroll_top_offset?window.ff_scroll_top_offset:l.offset().top-100,i=(n=(e=l).offset().top)+e.outerHeight(),s=(r=o(window).scrollTop())+o(window).height(),i>r&&n<s&&!window.ff_force_scroll||o("html, body").animate({scrollTop:t},500,"swing")}}(),function(){h&&m.css("overflow","");var e=0===t&&!i,n=a.$theForm.hasClass("ff_submitting");!a.stepPersistency||a.isPopulatingStepData||e||n||a.saveStepData(a.$theForm,a.activeStep).then(function(t){}),a.stepProgressBarHandle({activeStep:a.activeStep,totalSteps:c});var l=a.$theForm.find('button[type="submit"]').not(".ff-btn-save-progress"),u=-1;if(l.length){var d=l[0];f.each(function(t){if(this.contains(d))return u=t,!1})}var p=f.index(a.$theForm.find(".fluentform-step.active")),v=u>=0&&p>=u;if(!v&&h){var g=a.$theForm.find(".ff-step-titles--clickable li").length;g>0&&p>=g-1&&(v=!0)}if(l.css("visibility",v?"visible":"hidden"),!window.ff_disable_auto_step){a.$theForm.find(".fluentform-step.active");var _=a.$theForm.find(".fluentform-step.active > .step-nav").length,y=a.$theForm.find(".fluentform-step.active > div").length-_,b=a.$theForm.find(".fluentform-step.active > .ff_excluded").length;if(a.$theForm.find(".fluentform-step.active > .ff-t-container").length&&(y-=a.$theForm.find(".fluentform-step.active > .ff-t-container").length,y+=a.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > div").length,b+=a.$theForm.find(".fluentform-step.active > .ff-t-container > .ff-t-cell > .ff_excluded").length,a.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length&&(b-=a.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded").length,b-=a.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > .ff_excluded").length,b+=a.$theForm.find(".fluentform-step.active > .ff-t-container.ff_excluded > .ff-t-cell > div").length)),y===b){var S="prev"===r?a.activeStep-1:a.activeStep+1;if(S>=0&&S<c){var w="none"===o(f[S]).closest(".ff-step-container").data("animation_type")?50:100;return void a.updateSlider(S,w,i,r).then(function(){s()}).catch(function(t){console.error("An error occurred during step skip:",t),s()})}}}a.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="next"]').css("visibility","visible"),a.$theForm.find(".fluentform-step.active").find('.step-nav button[data-action="prev"]').css("visibility","visible"),a.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="next"]').css("visibility","visible"),a.$theForm.find(".fluentform-step.active").find('.step-nav img[data-action="prev"]').css("visibility","visible"),s()}()})})}},{key:"handleFocus",value:function(t){var e=this.$,n=this,i=!1,r=function(i){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o="yes"!=n.$theForm.find(".ff-step-container").attr("data-disable_auto_focus");if(!n.isInitialLoad){var a;if(o){if(!window.ff_disable_step_scroll){var s=i.find("input, .ff-custom_html, select, textarea, button, a").filter(":visible");s.length&&r&&setTimeout(function(){s.first().focus()},t+50)}}else null!==(a=window.fluentFormVars)&&void 0!==a&&a.step_change_focus&&!window.ff_disable_step_scroll&&setTimeout(function(){e("".concat(n.formSelector," .fluentform-step.active")).attr("tabindex","-1").focus().removeAttr("tabindex")},t);n.isInitialLoad=!1}};n.$theForm.off("keydown.stepNavigation").on("keydown.stepNavigation",function(t){if(!i&&(" "===t.key||32===t.keyCode)){var r=e("".concat(n.formSelector," .fluentform-step.active .ff-btn-next")),o=e("".concat(n.formSelector," .fluentform-step.active .ff-btn-prev"));return document.activeElement===r[0]?(t.preventDefault(),void r.click()):document.activeElement===o[0]?(t.preventDefault(),void o.click()):void 0}}),this.$theForm.on("ff_to_next_page ff_to_prev_page",function(){i=!0,setTimeout(function(){i=!1,r(n.$theForm.find(".fluentform-step.active"),!0)},t+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&&r(e("".concat(this.formSelector," .fluentform-step.active")),!0),this.isInitialLoad=!1}},{key:"saveStepData",value:function(t,e){var n,i=this.$,r=t.find(":input").filter(function(t,e){return!i(e).closest(".has-conditions").hasClass("ff_excluded")});r.filter(function(t,e){var n=i(e);return n.parents().hasClass("ff_repeater_table")&&"select"==n.attr("type")&&!n.val()}).prepend("<option selected disabled />");var o=r.serialize();i.each(t.find("[type=file]"),function(t,e){var n={},r=e.name+"[]";n[r]=[],i(e).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each(function(t,e){n[r][t]=i(this).data("src")}),i.each(n,function(t,e){if(e.length){var n={};n[t]=e,o+="&"+i.param(n)}})});var a={active_step:e,data:o,form_id:t.data("form_id"),action:"fluentform_step_form_save_data",nonce:null===(n=this.fluentFormVars)||void 0===n?void 0:n.nonce};return i.post(this.fluentFormVars.ajaxUrl,a)}},{key:"maybeAutoSlider",value:function(){var t=this.$;if("yes"==this.$theForm.find(".ff-step-container").attr("data-enable_auto_slider")){var e=function(t){if(1==t.closest(".fluentform-step.active").find(".ff-el-group:not(.ff_excluded):not(.ff-custom_html)").length)if(t.closest(".fluentform-step.active").find(".ff_excluded").length){var e=window.ffTransitionTimeOut||500;setTimeout(function(){t.closest(".fluentform-step.active").find(".ff-btn-next").trigger("click")},e)}else t.closest(".fluentform-step.active").find(".ff-btn-next").trigger("click")};this.$theForm.find(".ff-el-form-check-radio,.ff-el-net-label, .ff-el-ratings label").on("click",function(){e(t(this))}),this.$theForm.find("select").on("change",function(){e(t(this))})}}},{key:"addFilesToElement",value:function(e,n){var i=this.$,r=this,o=e.closest(".ff-el-input--content").find(".ff-uploaded-list");i.each(n,function(e,n){n="object"===t(n)?n:{url:n,data_src:n};var a=i("<div/>",{class:"ff-upload-preview","data-src":n.data_src,style:"border: 1px solid rgb(111, 117, 125)"}),s=i("<div/>",{class:"ff-upload-thumb"});s.append(i("<div/>",{class:"ff-upload-preview-img",style:"background-image: url('".concat(r.getThumbnail(n.url),"');")}));var l=i("<div/>",{class:"ff-upload-details"}),f=i("<span/>",{html:r.fluentFormVars.upload_completed_txt,class:"ff-upload-progress-inline-text ff-inline-block"}),c=n.url.substring(n.url.lastIndexOf("/")+1);c.includes("-ff-")&&(c=c.substring(c.lastIndexOf("-ff-")+4));var u=i("<div/>",{class:"ff-upload-filename",html:c}),d=i('\n <div class="ff-upload-progress-inline ff-el-progress">\n <div style="width: 100%;" class="ff-el-progress-bar"></div>\n </div>\n '),p=i("<span/>",{"data-href":"#",html:"&times;",class:"ff-upload-remove"}),m=i("<div>",{class:"ff-upload-filesize ff-inline-block",html:""}),h=i("<div>",{class:"ff-upload-error",style:"color:red;"});l.append(u,d,f,m,h,p),a.append(s,l),o.append(a)}),e.trigger("change_remaining",-n.length),e.trigger("change")}},{key:"getThumbnail",value:function(t){if(!t)return"";var e=t.split(/[#?]/)[0].split(".").pop().trim().toLowerCase();if(-1!=["jpg","jpeg","gif","png"].indexOf(e))return t;var n=document.createElement("canvas");n.width=60,n.height=60,n.style.zIndex=8,n.style.position="absolute",n.style.border="1px solid";var i=n.getContext("2d");return i.fillStyle="rgba(0, 0, 0, 0.2)",i.fillRect(0,0,60,60),i.font="13px Arial",i.fillStyle="white",i.textAlign="center",i.fillText(e,30,30,60),n.toDataURL()}}],i&&e(n.prototype,i),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,i,r}();function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],l=!0,f=!1;try{if(o=(n=n.call(t)).next,0===e);else for(;!(l=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){f=!0,r=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(f)throw r}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return r(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)?r(t,e):void 0}}(t,e)||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.")}()}const a=Object.entries,s=Object.setPrototypeOf,l=Object.isFrozen,f=Object.getPrototypeOf,c=Object.getOwnPropertyDescriptor;let u=Object.freeze,d=Object.seal,p=Object.create,m="undefined"!=typeof Reflect&&Reflect,h=m.apply,v=m.construct;u||(u=function(t){return t}),d||(d=function(t){return t}),h||(h=function(t,e){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return t.apply(e,i)}),v||(v=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return new t(...n)});const g=M(Array.prototype.forEach),_=M(Array.prototype.lastIndexOf),y=M(Array.prototype.pop),b=M(Array.prototype.push),S=M(Array.prototype.splice),w=Array.isArray,T=M(String.prototype.toLowerCase),A=M(String.prototype.toString),k=M(String.prototype.match),E=M(String.prototype.replace),F=M(String.prototype.indexOf),x=M(String.prototype.trim),N=M(Number.prototype.toString),C=M(Boolean.prototype.toString),O="undefined"==typeof BigInt?null:M(BigInt.prototype.toString),D="undefined"==typeof Symbol?null:M(Symbol.prototype.toString),I=M(Object.prototype.hasOwnProperty),R=M(Object.prototype.toString),$=M(RegExp.prototype.test),L=(P=TypeError,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return v(P,e)});var P;function M(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return h(t,e,i)}}function z(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:T;if(s&&s(t,null),!w(e))return t;let i=e.length;for(;i--;){let r=e[i];if("string"==typeof r){const t=n(r);t!==r&&(l(e)||(e[i]=t),r=t)}t[r]=!0}return t}function U(t){for(let e=0;e<t.length;e++){I(t,e)||(t[e]=null)}return t}function H(t){const e=p(null);for(const i of a(t)){var n=o(i,2);const r=n[0],a=n[1];I(t,r)&&(w(a)?e[r]=U(a):a&&"object"==typeof a&&a.constructor===Object?e[r]=H(a):e[r]=a)}return e}function j(t,e){for(;null!==t;){const n=c(t,e);if(n){if(n.get)return M(n.get);if("function"==typeof n.value)return M(n.value)}t=f(t)}return function(){return null}}const B=u(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),V=u(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),W=u(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),G=u(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Y=u(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),q=u(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),X=u(["#text"]),K=u(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Z=u(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),J=u(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Q=u(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),tt=d(/{{[\w\W]*|^[\w\W]*}}/g),et=d(/<%[\w\W]*|^[\w\W]*%>/g),nt=d(/\${[\w\W]*/g),it=d(/^data-[\-\w.\u00B7-\uFFFF]+$/),rt=d(/^aria-[\-\w]+$/),ot=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),at=d(/^(?:\w+script|data):/i),st=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),lt=d(/^html$/i),ft=d(/^[a-z][.\w]*(-[.\w]+)+$/i),ct=d(/<[/\w!]/g),ut=d(/<[/\w]/g),dt=d(/<\/no(script|embed|frames)/i),pt=d(/\/>/i),mt=1,ht=3,vt=7,gt=8,_t=9,yt=11,bt=function(){return"undefined"==typeof window?null:window},St=function(t,e,n,i){return I(t,e)&&w(t[e])?z(i.base?H(i.base):{},t[e],i.transform):n};var wt=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:bt();const n=e=>t(e);if(n.version="3.4.12",n.removed=[],!e||!e.document||e.document.nodeType!==_t||!e.Element)return n.isSupported=!1,n;let i=e.document;const r=i,o=r.currentScript;e.DocumentFragment;const s=e.HTMLTemplateElement,l=e.Node,f=e.Element,c=e.NodeFilter,m=e.NamedNodeMap;void 0===m&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const h=e.DOMParser,v=e.trustedTypes,P=f.prototype,M=j(P,"cloneNode"),U=j(P,"remove"),wt=j(P,"nextSibling"),Tt=j(P,"childNodes"),At=j(P,"parentNode"),kt=j(P,"shadowRoot"),Et=j(P,"attributes"),Ft=l&&l.prototype?j(l.prototype,"nodeType"):null,xt=l&&l.prototype?j(l.prototype,"nodeName"):null;if("function"==typeof s){const t=i.createElement("template");t.content&&t.content.ownerDocument&&(i=t.content.ownerDocument)}let Nt,Ct,Ot="",Dt=!1,It=0;const Rt=function(){if(It>0)throw L('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},$t=function(t){Rt(),It++;try{return Nt.createHTML(t)}finally{It--}},Lt=function(){return Dt||(Ct=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(n=e.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return t.createPolicy(r,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(v,o),Dt=!0),Ct},Pt=i,Mt=Pt.implementation,zt=Pt.createNodeIterator,Ut=Pt.createDocumentFragment,Ht=Pt.getElementsByTagName,jt=r.importNode;let Bt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof a&&"function"==typeof At&&Mt&&void 0!==Mt.createHTMLDocument;const Vt=tt,Wt=et,Gt=nt,Yt=it,qt=rt,Xt=at,Kt=st,Zt=ft;let Jt=ot,Qt=null;const te=z({},[...B,...V,...W,...Y,...X]);let ee=null;const ne=z({},[...K,...Z,...J,...Q]);let ie=Object.seal(p(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),re=null,oe=null;const ae=Object.seal(p(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let se=!0,le=!0,fe=!1,ce=!0,ue=!1,de=!0,pe=!1,me=!1,he=null,ve=null,ge=!1,_e=!1,ye=!1,be=!1,Se=!0,we=!1;const Te="user-content-";let Ae=!0,ke=!1,Ee={},Fe=null;const xe=z({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ne=null;const Ce=z({},["audio","video","img","source","image","track"]);let Oe=null;const De=z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ie="http://www.w3.org/1998/Math/MathML",Re="http://www.w3.org/2000/svg",$e="http://www.w3.org/1999/xhtml";let Le=$e,Pe=!1,Me=null;const ze=z({},[Ie,Re,$e],A),Ue=u(["mi","mo","mn","ms","mtext"]);let He=z({},Ue);const je=u(["annotation-xml"]);let Be=z({},je);const Ve=z({},["title","style","font","a","script"]);let We=null;const Ge=["application/xhtml+xml","text/html"];let Ye=null,qe=null;const Xe=i.createElement("form"),Ke=function(t){return t instanceof RegExp||t instanceof Function},Ze=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(qe&&qe===t)return;t&&"object"==typeof t||(t={}),t=H(t),We=-1===Ge.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Ye="application/xhtml+xml"===We?A:T,Qt=St(t,"ALLOWED_TAGS",te,{transform:Ye}),ee=St(t,"ALLOWED_ATTR",ne,{transform:Ye}),Me=St(t,"ALLOWED_NAMESPACES",ze,{transform:A}),Oe=St(t,"ADD_URI_SAFE_ATTR",De,{transform:Ye,base:De}),Ne=St(t,"ADD_DATA_URI_TAGS",Ce,{transform:Ye,base:Ce}),Fe=St(t,"FORBID_CONTENTS",xe,{transform:Ye}),re=St(t,"FORBID_TAGS",H({}),{transform:Ye}),oe=St(t,"FORBID_ATTR",H({}),{transform:Ye}),Ee=!!I(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?H(t.USE_PROFILES):t.USE_PROFILES),se=!1!==t.ALLOW_ARIA_ATTR,le=!1!==t.ALLOW_DATA_ATTR,fe=t.ALLOW_UNKNOWN_PROTOCOLS||!1,ce=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,ue=t.SAFE_FOR_TEMPLATES||!1,de=!1!==t.SAFE_FOR_XML,pe=t.WHOLE_DOCUMENT||!1,_e=t.RETURN_DOM||!1,ye=t.RETURN_DOM_FRAGMENT||!1,be=t.RETURN_TRUSTED_TYPE||!1,ge=t.FORCE_BODY||!1,Se=!1!==t.SANITIZE_DOM,we=t.SANITIZE_NAMED_PROPS||!1,Ae=!1!==t.KEEP_CONTENT,ke=t.IN_PLACE||!1,Jt=function(t){try{return $(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:ot,Le="string"==typeof t.NAMESPACE?t.NAMESPACE:$e,He=I(t,"MATHML_TEXT_INTEGRATION_POINTS")&&t.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof t.MATHML_TEXT_INTEGRATION_POINTS?H(t.MATHML_TEXT_INTEGRATION_POINTS):z({},Ue),Be=I(t,"HTML_INTEGRATION_POINTS")&&t.HTML_INTEGRATION_POINTS&&"object"==typeof t.HTML_INTEGRATION_POINTS?H(t.HTML_INTEGRATION_POINTS):z({},je);const e=I(t,"CUSTOM_ELEMENT_HANDLING")&&t.CUSTOM_ELEMENT_HANDLING&&"object"==typeof t.CUSTOM_ELEMENT_HANDLING?H(t.CUSTOM_ELEMENT_HANDLING):p(null);if(ie=p(null),I(e,"tagNameCheck")&&Ke(e.tagNameCheck)&&(ie.tagNameCheck=e.tagNameCheck),I(e,"attributeNameCheck")&&Ke(e.attributeNameCheck)&&(ie.attributeNameCheck=e.attributeNameCheck),I(e,"allowCustomizedBuiltInElements")&&"boolean"==typeof e.allowCustomizedBuiltInElements&&(ie.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),d(ie),ue&&(le=!1),ye&&(_e=!0),Ee&&(Qt=z({},X),ee=p(null),!0===Ee.html&&(z(Qt,B),z(ee,K)),!0===Ee.svg&&(z(Qt,V),z(ee,Z),z(ee,Q)),!0===Ee.svgFilters&&(z(Qt,W),z(ee,Z),z(ee,Q)),!0===Ee.mathMl&&(z(Qt,Y),z(ee,J),z(ee,Q))),ae.tagCheck=null,ae.attributeCheck=null,I(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?ae.tagCheck=t.ADD_TAGS:w(t.ADD_TAGS)&&(Qt===te&&(Qt=H(Qt)),z(Qt,t.ADD_TAGS,Ye))),I(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?ae.attributeCheck=t.ADD_ATTR:w(t.ADD_ATTR)&&(ee===ne&&(ee=H(ee)),z(ee,t.ADD_ATTR,Ye))),I(t,"ADD_URI_SAFE_ATTR")&&w(t.ADD_URI_SAFE_ATTR)&&z(Oe,t.ADD_URI_SAFE_ATTR,Ye),I(t,"FORBID_CONTENTS")&&w(t.FORBID_CONTENTS)&&(Fe===xe&&(Fe=H(Fe)),z(Fe,t.FORBID_CONTENTS,Ye)),I(t,"ADD_FORBID_CONTENTS")&&w(t.ADD_FORBID_CONTENTS)&&(Fe===xe&&(Fe=H(Fe)),z(Fe,t.ADD_FORBID_CONTENTS,Ye)),Ae&&(Qt["#text"]=!0),pe&&z(Qt,["html","head","body"]),Qt.table&&(z(Qt,["tbody"]),delete re.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw L('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw L('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const e=Nt;Nt=t.TRUSTED_TYPES_POLICY;try{Ot=$t("")}catch(t){throw Nt=e,t}}else null===t.TRUSTED_TYPES_POLICY?(Nt=void 0,Ot=""):(void 0===Nt&&(Nt=Lt()),Nt&&"string"==typeof Ot&&(Ot=$t("")));u&&u(t),qe=t},Je=z({},[...V,...W,...G]),Qe=z({},[...Y,...q]),tn=function(t){let e=At(t);e&&e.tagName||(e={namespaceURI:Le,tagName:"template"});const n=T(t.tagName),i=T(e.tagName);return!!Me[t.namespaceURI]&&(t.namespaceURI===Re?function(t,e,n){return e.namespaceURI===$e?"svg"===t:e.namespaceURI===Ie?"svg"===t&&("annotation-xml"===n||He[n]):Boolean(Je[t])}(n,e,i):t.namespaceURI===Ie?function(t,e,n){return e.namespaceURI===$e?"math"===t:e.namespaceURI===Re?"math"===t&&Be[n]:Boolean(Qe[t])}(n,e,i):t.namespaceURI===$e?function(t,e,n){return!(e.namespaceURI===Re&&!Be[n])&&!(e.namespaceURI===Ie&&!He[n])&&!Qe[t]&&(Ve[t]||!Je[t])}(n,e,i):!("application/xhtml+xml"!==We||!Me[t.namespaceURI]))},en=function(t){b(n.removed,{element:t});try{At(t).removeChild(t)}catch(e){if(U(t),!At(t))throw L("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},nn=function(t){an(t);const e=Tt(t);if(e){const t=[];g(e,e=>{b(t,e)}),g(t,t=>{try{U(t)}catch(t){}})}const n=Et(t);if(n)for(let e=n.length-1;e>=0;--e){const i=n[e],r=i&&i.name;if("string"==typeof r)try{t.removeAttribute(r)}catch(t){}}},rn=function(t,e){try{b(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){b(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(_e||ye)try{en(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},on=function(t){const e=Et(t);if(e)for(let n=e.length-1;n>=0;--n){const i=e[n],r=i&&i.name;if("string"==typeof r&&!ee[Ye(r)])try{t.removeAttribute(r)}catch(t){}}},an=function(t){const e=[t];for(;e.length>0;){const t=e.pop();(Ft?Ft(t):t.nodeType)===mt&&on(t);const n=Tt(t);if(n)for(let t=n.length-1;t>=0;--t)e.push(n[t])}},sn=function(t){let e=null,n=null;if(ge)t="<remove></remove>"+t;else{const e=k(t,/^[\r\n\t ]+/);n=e&&e[0]}"application/xhtml+xml"===We&&Le===$e&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const r=Nt?$t(t):t;if(Le===$e)try{e=(new h).parseFromString(r,We)}catch(t){}if(!e||!e.documentElement){e=Mt.createDocument(Le,"template",null);try{e.documentElement.innerHTML=Pe?Ot:r}catch(t){}}const o=e.body||e.documentElement;return t&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),Le===$e?Ht.call(e,pe?"html":"body")[0]:pe?e.documentElement:o},ln=function(t){return zt.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},fn=function(t){return t=E(t,Vt," "),t=E(t,Wt," "),t=E(t,Gt," ")},cn=function(t){var e;t.normalize();const n=zt.call(t.ownerDocument||t,t,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let i=n.nextNode();for(;i;)i.data=fn(i.data),i=n.nextNode();const r=null===(e=t.querySelectorAll)||void 0===e?void 0:e.call(t,"template");r&&g(r,t=>{dn(t.content)&&cn(t.content)})},un=function(t){const e=xt?xt(t):null;return"string"==typeof e&&("form"===Ye(e)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==Et(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==Ft(t)||t.childNodes!==Tt(t)))},dn=function(t){if(!Ft||"object"!=typeof t||null===t)return!1;try{return Ft(t)===yt}catch(t){return!1}},pn=function(t){if(!Ft||"object"!=typeof t||null===t)return!1;try{return"number"==typeof Ft(t)}catch(t){return!1}};function mn(t,e,i){0!==t.length&&g(t,t=>{t.call(n,e,i,qe)})}const hn=function(t,e){if(mn(Bt.beforeSanitizeElements,t,null),t!==e&&null===At(t))return!0;if(un(t))return en(t),!0;const i=Ye(xt?xt(t):t.nodeName);if(mn(Bt.uponSanitizeElement,t,{tagName:i,allowedTags:Qt}),t!==e&&null===At(t))return!0;if(function(t,e){return!!(de&&t.hasChildNodes()&&!pn(t.firstElementChild)&&$(ct,t.textContent)&&$(ct,t.innerHTML))||!(!de||t.namespaceURI!==$e||"style"!==e||!pn(t.firstElementChild))||t.nodeType===vt||!(!de||t.nodeType!==gt||!$(ut,t.data))}(t,i))return en(t),!0;if(re[i]||!(ae.tagCheck instanceof Function&&ae.tagCheck(i))&&!Qt[i]){const e=function(t,e){if(!re[e]&&_n(e)){if(ie.tagNameCheck instanceof RegExp&&$(ie.tagNameCheck,e))return!1;if(ie.tagNameCheck instanceof Function&&ie.tagNameCheck(e))return!1}if(Ae&&!Fe[e]){const e=At(t),n=Tt(t);if(n&&e)for(let i=n.length-1;i>=0;--i){const r=ke?n[i]:M(n[i],!0);e.insertBefore(r,wt(t))}}return en(t),!0}(t,i);return!1===e&&mn(Bt.afterSanitizeElements,t,null),e}if((Ft?Ft(t):t.nodeType)===mt&&!tn(t))return en(t),!0;if(("noscript"===i||"noembed"===i||"noframes"===i)&&$(dt,t.innerHTML))return en(t),!0;if(ue&&t.nodeType===ht){const e=fn(t.textContent);t.textContent!==e&&(b(n.removed,{element:t.cloneNode()}),t.textContent=e)}return mn(Bt.afterSanitizeElements,t,null),!1},vn=function(t,e,n){if(oe[e])return!1;if(de&&"patchsrc"===e)return!1;if(de&&"for"===e&&"label"!==t&&"output"!==t)return!1;if(Se&&("id"===e||"name"===e)&&(n in i||n in Xe))return!1;const r=ee[e]||ae.attributeCheck instanceof Function&&ae.attributeCheck(e,t);if(le&&$(Yt,e));else if(se&&$(qt,e));else if(r)if(Oe[e]);else if($(Jt,E(n,Kt,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==F(n,"data:")||!Ne[t]){if(fe&&!$(Xt,E(n,Kt,"")));else if(n)return!1}else;else if(!(_n(t)&&(ie.tagNameCheck instanceof RegExp&&$(ie.tagNameCheck,t)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(t))&&(ie.attributeNameCheck instanceof RegExp&&$(ie.attributeNameCheck,e)||ie.attributeNameCheck instanceof Function&&ie.attributeNameCheck(e,t))||"is"===e&&ie.allowCustomizedBuiltInElements&&(ie.tagNameCheck instanceof RegExp&&$(ie.tagNameCheck,n)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(n))))return!1;return!0},gn=z({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),_n=function(t){return!gn[T(t)]&&$(Zt,t)},yn=function(t,e,n,i){if(Nt&&"object"==typeof v&&"function"==typeof v.getAttributeType&&!n)switch(v.getAttributeType(t,e)){case"TrustedHTML":return $t(i);case"TrustedScriptURL":return function(t){Rt(),It++;try{return Nt.createScriptURL(t)}finally{It--}}(i)}return i},bn=function(t,e,i,r){try{i?t.setAttributeNS(i,e,r):t.setAttribute(e,r),un(t)?en(t):y(n.removed)}catch(n){rn(e,t)}},Sn=function(t){mn(Bt.beforeSanitizeAttributes,t,null);const e=t.attributes;if(!e||un(t))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ee,forceKeepAttr:void 0};let i=e.length;const r=Ye(t.nodeName);for(;i--;){const o=e[i],a=o.name,s=o.namespaceURI,l=o.value,f=Ye(a),c=l;let u="value"===a?c:x(c);n.attrName=f,n.attrValue=u,n.keepAttr=!0,n.forceKeepAttr=void 0,mn(Bt.uponSanitizeAttribute,t,n),u=n.attrValue,!we||"id"!==f&&"name"!==f||0===F(u,Te)||(rn(a,t),u=Te+u),de&&$(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)?rn(a,t):"attributename"===f&&k(u,"href")?rn(a,t):n.forceKeepAttr||(n.keepAttr&&(ce||!$(pt,u))?(ue&&(u=fn(u)),vn(r,f,u)?(u=yn(r,f,s,u),u!==c&&bn(t,a,s,u)):rn(a,t)):rn(a,t))}mn(Bt.afterSanitizeAttributes,t,null)},wn=function(t){let e=null;const n=ln(t);for(mn(Bt.beforeSanitizeShadowDOM,t,null);e=n.nextNode();){mn(Bt.uponSanitizeShadowNode,e,null),hn(e,t),Sn(e),dn(e.content)&&wn(e.content);if((Ft?Ft(e):e.nodeType)===mt){const t=kt(e);dn(t)&&(Tn(t),wn(t))}}mn(Bt.afterSanitizeShadowDOM,t,null)},Tn=function(t){const e=[{node:t,shadow:null}];for(;e.length>0;){const t=e.pop();if(t.shadow){wn(t.shadow);continue}const n=t.node,i=(Ft?Ft(n):n.nodeType)===mt,r=Tt(n);if(r)for(let t=r.length-1;t>=0;--t)e.push({node:r[t],shadow:null});if(i){const t=xt?xt(n):null;if("string"==typeof t&&"template"===Ye(t)){const t=n.content;dn(t)&&e.push({node:t,shadow:null})}}if(i){const t=kt(n);dn(t)&&e.push({node:null,shadow:t},{node:t,shadow:null})}}};return n.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,o=null,a=null,s=null;if(Pe=!t,Pe&&(t="\x3c!--\x3e"),"string"!=typeof t&&!pn(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return N(t);case"boolean":return C(t);case"bigint":return O?O(t):"0";case"symbol":return D?D(t):"Symbol()";case"undefined":default:return R(t);case"function":case"object":{if(null===t)return R(t);const e=t,n=j(e,"toString");if("function"==typeof n){const t=n(e);return"string"==typeof t?t:R(t)}return R(t)}}}(t)))throw L("dirty is not a string, aborting");if(!n.isSupported)return t;me?(Qt=he,ee=ve):Ze(e),(Bt.uponSanitizeElement.length>0||Bt.uponSanitizeAttribute.length>0)&&(Qt=H(Qt)),Bt.uponSanitizeAttribute.length>0&&(ee=H(ee)),n.removed=[];const l=ke&&"string"!=typeof t&&pn(t);if(l){!function(t){if(!de)return;const e=[t];for(;e.length>0;){const t=e.pop(),n=Ft?Ft(t):t.nodeType;if(n===vt||n===gt&&$(ut,t.data)){try{U(t)}catch(t){}continue}if(n===mt){const e=t,n=Ye(xt?xt(t):t.nodeName);try{e.hasAttribute&&e.hasAttribute("patchsrc")&&e.removeAttribute("patchsrc"),e.hasAttribute&&e.hasAttribute("for")&&"label"!==n&&"output"!==n&&e.removeAttribute("for")}catch(t){}}const i=Tt(t);if(i)for(let t=i.length-1;t>=0;--t)e.push(i[t])}}(t);const e=xt?xt(t):t.nodeName;if("string"==typeof e){const n=Ye(e);if(!Qt[n]||re[n])throw nn(t),L("root node is forbidden and cannot be sanitized in-place")}if(un(t))throw nn(t),L("root node is clobbered and cannot be sanitized in-place");try{Tn(t)}catch(e){throw nn(t),e}}else if(pn(t))i=sn("\x3c!----\x3e"),o=i.ownerDocument.importNode(t,!0),o.nodeType===mt&&"BODY"===o.nodeName||"HTML"===o.nodeName?i=o:i.appendChild(o),Tn(o);else{if(!_e&&!ue&&!pe&&-1===t.indexOf("<"))return Nt&&be?$t(t):t;if(i=sn(t),!i)return _e?null:be?Ot:""}i&&ge&&en(i.firstChild);const f=l?t:i,c=ln(f);try{for(;a=c.nextNode();)hn(a,f),Sn(a),dn(a.content)&&wn(a.content)}catch(e){throw l&&(nn(t),g(n.removed,t=>{t.element&&an(t.element)})),e}if(l)return g(n.removed,t=>{t.element&&an(t.element)}),ue&&cn(t),t;if(_e){if(ue&&cn(i),ye)for(s=Ut.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(ee.shadowroot||ee.shadowrootmode)&&(s=jt.call(r,s,!0)),s}let u=pe?i.outerHTML:i.innerHTML;return pe&&Qt["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&$(lt,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),ue&&(u=fn(u)),Nt&&be?$t(u):u},n.setConfig=function(){Ze(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),me=!0,he=Qt,ve=ee},n.clearConfig=function(){qe=null,me=!1,he=null,ve=null,Nt=Ct,Ot=""},n.isValidAttribute=function(t,e,n){qe||Ze({});const i=Ye(t),r=Ye(e);return vn(i,r,n)},n.addHook=function(t,e){"function"==typeof e&&I(Bt,t)&&b(Bt[t],e)},n.removeHook=function(t,e){if(I(Bt,t)){if(void 0!==e){const n=_(Bt[t],e);return-1===n?void 0:S(Bt[t],n,1)[0]}return y(Bt[t])}},n.removeHooks=function(t){I(Bt,t)&&(Bt[t]=[])},n.removeAllHooks=function(){Bt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Tt=["_blank","_self","_parent","_top"],At=["_self","_top","_parent"],kt=/^[A-Za-z][A-Za-z0-9_.-]*$/,Et=/^[A-Za-z][A-Za-z-]*$/,Ft=["noopener"];function xt(t){var e=t&&"string"==typeof t.tagName?t.tagName.toUpperCase():"";return"A"===e||"AREA"===e}var Nt,Ct=wt(window);function Ot(t){return null==t?"":Ct.sanitize(String(t))}Ct.addHook("uponSanitizeAttribute",function(t,e){var n,i;"target"===e.attrName&&xt(t)&&(n=e.attrValue,i=String(n||"").trim(),(Tt.includes(i.toLowerCase())||kt.test(i))&&(e.forceKeepAttr=!0))}),Ct.addHook("afterSanitizeAttributes",function(t){if(xt(t)&&"function"==typeof t.getAttribute&&"function"==typeof t.setAttribute){var e=t.getAttribute("target");if(e&&!At.includes(e.trim().toLowerCase())){var n=(t.getAttribute("rel")||"").split(/\s+/).filter(function(t){return Et.test(t)});Ft.forEach(function(t){n.includes(t)||n.push(t)}),t.setAttribute("rel",n.join(" "))}}}),(Nt=jQuery)(document.body).on("fluentform_init",function(t,e,n){var r="."+n.form_instance,o=-1,a="no";function s(t,e){var i="fluentform_save_progress_messages_"+n.id;return window[i]&&window[i][t]?window[i][t]:e}if(Nt(r).hasClass("ff-form-has-save-progress")){Nt(r).hasClass("ff-form-has-steps")&&(e.on("ff_to_next_page",function(t,e){a=e}),e.on("ff_to_prev_page",function(t,e){a=e})),Nt(r).find(".ff-btn-save-progress").each(function(t,n){var i=Nt(n);i.on("click",function(t){var n,r=this;t.preventDefault(),i.addClass("ff-working");var l=e.find(":input").filter(function(t,e){return!Nt(e).closest(".has-conditions").hasClass("ff_excluded")});l.filter(function(t,e){var n=Nt(e);return n.parents().hasClass("ff_repeater_table")&&"select"==n.attr("type")&&!n.val()}).prepend("<option selected disabled />");var f=l.serialize();Nt.each(e.find("[type=file]"),function(t,e){var n={},i=e.name+"[]";n[i]=[],Nt(e).closest("div").find(".ff-uploaded-list").find(".ff-upload-preview[data-src]").each(function(t,e){n[i][t]=Nt(this).data("src")}),Nt.each(n,function(t,e){if(e.length){var n={};n[t]=e,f+="&"+Nt.param(n)}})}),o=null===(n=window.form_state_save_vars)||void 0===n?void 0:n.key;var c={source_url:window.form_state_save_vars.source_url,action:"fluentform_save_form_progress_with_link",data:f,form_id:e.data("form_id"),hash:o,active_step:a,nonce:window.form_state_save_vars.nonce,save_progress_btn_name:Nt(i).attr("name")},u=c.form_id+"_save_progress_msg",d="#"+u;jQuery.post(fluentFormVars.ajaxUrl,c).then(function(t){if(t){var n;o=t.data.hash,e.find(".ff-saved-state-link"),""!=(null===(n=t.data)||void 0===n?void 0:n.message)&&(Nt(d).length&&Nt(d).slideUp("fast"),Nt("<div/>",{id:u,class:"ff-message-success ff-el-group"}).html(Ot(t.data.message)).insertBefore(i.closest(".ff-el-group")));var a=s("copy_button",window.form_state_save_vars.copy_button||"Copy"),l='<div class="ff-el-input--content">\n <div class="ff_input-group">\n <input readonly class="ff-el-form-control" >\n <div class="ff_input-group-append">\n <button class="ff-btn ff-btn-md ff_btn_style ff_btn_copy_link ff_input-group-text">'.concat(a,"</button>\n </div>\n </div>\n </div>"),f=Nt("<div/>",{class:"ff-el-group ff-saved-state-input ff-saved-state-link ff-hide-group",html:l});f.find("input").val(t.data.saved_url),Nt(r).closest(".ff-el-group").after(f),f.fadeIn(),f.find("input.ff-el-form-control").on("keypress",function(t){13!==t.which&&13!==t.keyCode||(t.preventDefault(),Nt(this).siblings(".ff_input-group-append").find(".ff_btn_copy_link").click())});var c=s("email_placeholder",window.form_state_save_vars.email_placeholder_str||"Your Email Here"),p=s("email_button",window.form_state_save_vars.email_button||"Email");if(Nt(r).hasClass("ff_resume_email_enabled")){var m='<div class="ff-el-input--content">\n <div class="ff_input-group">\n <input type="email" class="ff-el-form-control" placeholder="'.concat(c,'">\n <div class="ff_input-group-append">\n <button class="ff-btn ff-btn-md ff_btn_style ff_btn_is_email ff_input-group-text">').concat(p,"</button>\n </div>\n </div>\n </div>"),h=Nt("<div/>",{class:"ff-el-group ff-saved-state-input ff-email-address ff-hide-group",html:m});Nt(f).after(h),h.fadeIn(),h.find("input.ff-el-form-control").on("keypress",function(t){13!==t.which&&13!==t.keyCode||(t.preventDefault(),Nt(this).siblings(".ff_input-group-append").find(".ff_btn_is_email").click())})}}}).fail(function(t){Nt(d).length&&Nt(d).slideUp("fast"),Nt("<div/>",{id:u,class:"ff-message-success ff-el-group text-danger"}).html(Ot(t.responseJSON.data.message)).insertBefore(i.closest(".ff-el-group"))}).always(function(){i.parent().hide()})})}),Nt(r).on("click",".ff_btn_copy_link",function(t){t.preventDefault();var e=Nt(this).closest(".ff-el-input--content").find(".ff-el-form-control").val();navigator.clipboard.writeText(e);var n=s("copy_success",window.form_state_save_vars.copy_success_button||"Copied");Nt(this).html(Ot(n))}),Nt(r).on("click",".ff_btn_is_email",function(t){t.preventDefault();var n=Nt(this).closest(".ff-el-group"),i=Nt(this).closest(".ff-email-address").find("input").val();Nt(".ff-email-address").find("input").val("");var r=Nt(".ff-saved-state-link").find("input").val(),a={source_url:window.form_state_save_vars.source_url,action:"fluentform_email_progress_link",form_id:e.data("form_id"),to_email:i,link:r,hash:o,nonce:window.form_state_save_vars.nonce},s=a.form_id+"_save_progress_email_response",l="#"+s;jQuery.post(fluentFormVars.ajaxUrl,a).then(function(t){t&&(n.removeClass("ff-el-is-error"),Nt(l).length&&Nt(l).slideUp("fast"),Nt("<div/>",{id:s,class:"ff-message-success ff-el-group"}).html(Ot(t.data.response)).insertAfter(n))}).fail(function(t){t&&(n.addClass("ff-el-is-error"),Nt(l).length&&Nt(l).slideUp("fast"),Nt("<div/>",{id:s,class:"ff-message-success ff-el-group text-danger"}).html(Ot(t.responseJSON.data.Error)).insertAfter(n))})});var l=!1;void 0!==window.form_state_save_vars&&(l=window.form_state_save_vars.key),l&&(e.append(Nt("<input/>",{type:"hidden",name:"__fluent_state_hash",class:"__fluent_state_hash"}).val(l)),"yes"==e.find(".ff-step-container").attr("data-enable_step_data_persistency")||jQuery.getJSON(fluentFormVars.ajaxUrl,{form_id:e.data("form_id"),action:"fluentform_get_form_state",hash:l,nonce:window.form_state_save_vars.nonce}).then(function(t){if(t){var n=function(t,e,n,r){return new i(t,e,n,r).getPublicAPI()}(Nt,e,window.fluentFormVars,r);n.populateFormDataAndSetActiveStep(t)}}))}})})();