!function(t,i,n,a){"use strict";function o(i,n){this.element=t(i),this.$el=this.element,this.totalSteps=0,this.step=0,this.hashStep=!1,this.settings=t.extend({},s,n),this._defaults=s,this._name=e,this.init()}var e="forminatorFrontPagination",s={totalSteps:0,step:0,hashStep:0,inline_validation:!1};t.extend(o.prototype,{init:function(){this.totalSteps=this.settings.totalSteps,this.step=this.settings.step,this.settings.hashStep&&this.step>0?this.go_to(this.step):this.go_to(0),this.render_navigation(),this.render_footer_navigation(),this.init_events(),this.update_buttons(),this.update_navigation()},init_events:function(){var t=this;this.$el.find(".forminator-pagination-prev").click(function(i){i.preventDefault(),t.handle_click("prev")}),this.$el.find(".forminator-pagination-next").click(function(i){i.preventDefault(),t.handle_click("next")}),this.$el.on("reset",function(i){t.on_form_reset(i)}),this.$el.on("forminator.front.pagination.focus.input",function(i,n){t.on_focus_input(i,n)})},on_form_reset:function(t){this.go_to(0),this.update_buttons()},on_focus_input:function(t,i){var n=this.get_page_of_input(i);this.go_to(n),this.update_buttons()},render_footer_navigation:function(){this.$el.append('<div class="forminator-pagination--footer"><button class="forminator-button forminator-pagination-prev"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">'+i.ForminatorFront.cform.pagination_prev+'</span></button><button class="forminator-button forminator-pagination-next"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">'+i.ForminatorFront.cform.pagination_next+"</span></button></div>")},render_navigation:function(){var i=this.$el.find(".forminator-pagination--nav");if(i.length){var n=this.$el.find(".forminator-pagination").not(".forminator-pagination-start");n.each(function(){var n=t(this),a=n.data("label"),o=n.data("step")-1;i.append('<li class="forminator-nav-step forminator-nav-step-'+o+'"><span class="forminator-step-text">'+a+'</span><span class="forminator-step-dot" aria-label="hidden"></span></li>')});this.$el.find(".forminator-pagination-start").each(function(){var a=t(this),o=a.data("label"),e=n.length;i.append('<li class="forminator-nav-step forminator-nav-step-'+e+'"><span class="forminator-step-text">'+o+'</span><span class="forminator-step-dot" aria-label="hidden"></span></li>')})}},handle_click:function(t){if("prev"===t&&0!==this.step)this.go_to(this.step-1);else if("next"===t){if(this.settings.inline_validation&&!this.is_step_inputs_valid())return;this.go_to(this.step+1)}this.update_buttons()},is_step_inputs_valid:function(){var t=!0,i=0,n=this.$el.data("validator"),a=this.$el.find("[data-step="+this.step+"]");return void 0===n||(a.find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(":hidden:not(.forminator-wp-editor-required, .forminator-input-file-required)").not('[gramm="true"]').each(function(a,o){(t=n.element(o))||(0===i&&o.focus(),i++)}),0===i)},get_page_of_input:function(i){var n=this.step,a=t(i).closest(".forminator-pagination");if(a.length>0){var o=t(a).data("step");void 0!==o&&(n=+o)}return n},update_buttons:function(){if(0===this.step?this.$el.find(".forminator-pagination-prev").attr("disabled",!0):this.$el.find(".forminator-pagination-prev").removeAttr("disabled"),this.step===this.totalSteps&&(this.step--,this.$el.submit()),this.step===this.totalSteps-1){var t=this.$el.find(".forminator-pagination-submit").html();this.$el.find(".forminator-pagination-next .forminator-button--text").html(t)}else this.$el.find(".forminator-pagination-next .forminator-button--text").html(i.ForminatorFront.cform.pagination_next)},go_to:function(t){if(this.step=t,t===this.totalSteps)return!1;this.$el.find(".forminator-pagination").hide(),this.$el.find("[data-step="+t+"]").show();var i=this.$el.data("forminatorFront");void 0!==i&&i.responsive_captcha(),this.update_navigation()},update_navigation:function(){this.$el.find(".forminator-step-current").removeClass("forminator-step-current"),this.$el.find(".forminator-nav-step-"+this.step).addClass("forminator-step-current")}}),t.fn[e]=function(i){return this.each(function(){t.data(this,e)||t.data(this,e,new o(this,i))})}}(jQuery,window,document);