(function(f,c,g){c.yit_checkout=function(a,b){this.element=c(b);this._init(a)};c.yit_checkout.defaults={steps:3,elements:{steps:c(".step"),sections:c(".checkout_multistep_resume a"),buttons:'.checkout_buttons input[type="button"]'}};c.yit_checkout.prototype={_init:function(a){this.options=c.extend(!0,{},c.yit_checkout.defaults,a);this.current_step=this.options.elements.steps.filter(".current");this.user_logged_in=0<this.options.elements.steps.filter(".user_logged_in").length;this._initEvents()},_initEvents:function(){var a=
this.options.elements,b=this;a.sections.on("click.yit",function(a){a.preventDefault();a=c(this).data("step");var d=b.current_step.data("step")?b.current_step.data("step"):1;b._gotoStep(d,a)});c(document).on("click.yit",a.buttons,function(a){a.preventDefault();a=c(this).data("step");var d=b.current_step.data("step")?b.current_step.data("step"):1;b._gotoStep(d,a)});c("body").on("checkout_error",function(){if(0<c("#customer_details .woocommerce-invalid").length){var a=b.current_step.data("step")?b.current_step.data("step"):
1;b._gotoStep(a,2)}})},_gotoStep:function(a,b){if(this._validateStep(a,b)){var e=this.element,d=this.options.elements.steps.filter("[data-step="+b+"]");this.current_step.fadeOut("slow",function(){d.fadeIn("slow").addClass("current");c(this).removeClass("current");e.trigger("slide_change.yit",{step:d})});this.current_step=d;this._updateSection(b)}},_validateStep:function(a,b){var c=this.options.steps;return a<b&&b<=c?!0:this.user_logged_in&&1<b&&b<a?!0:!this.user_logged_in&&0<b&&b<a?!0:!1},_updateSection:function(a){var b=
this.options.elements.sections;b.removeClass("current").removeClass("passed").filter("[data-step="+a+"]").addClass("current");b.filter(function(){return parseInt(c(this).data("step"))<parseInt(a)}).addClass("passed")}};c.fn.yit_checkout=function(a){if("string"===typeof a){var b=Array.prototype.slice.call(arguments,1);this.each(function(){var e=c.data(this,"yit_checkout");e?c.isFunction(e[a])&&"_"!==a.charAt(0)?e[a].apply(e,b):console.error("no such method '"+a+"' for yit_checkout instance"):console.error("cannot call methods on yit_checkout prior to initialization; attempted to call method '"+
a+"'")})}else this.each(function(){c.data(this,"yit_checkout")||c.data(this,"yit_checkout",new c.yit_checkout(a,this))});return this}})(window,jQuery);