(function(a){'use strict';a.fn.tp_woo_variation_swatches_form=function(){return this.each(function(){var b=a(this);b.addClass("swatches-support").on("click",".tp-swatches",function(c){c.preventDefault();var d=a(this),e=d.closest(".value").find("select"),f=d.attr("data-value");if(!d.hasClass("disabled"))return e.trigger("focusin"),e.find("option[value=\""+f+"\"]").length?void(d.hasClass("selected")?(e.val(""),d.removeClass("selected")):(d.addClass("selected").siblings(".selected").removeClass("selected"),e.val(f)),e.change()):(d.siblings(".tp-swatches").removeClass("selected"),e.val("").change(),void b.trigger("tp-woo_no_matching_variations",[d]))}).on("click",".reset_variations",function(){b.find(".tp-swatches.selected").removeClass("selected"),b.find(".tp-swatches.disabled").removeClass("disabled")}).on("woocommerce_update_variation_values",function(){setTimeout(function(){b.find("tbody tr").each(function(){var b=a(this),c=b.find("select").find("option"),d=c.filter(":selected"),e=[];c.each(function(a,b){""!==b.value&&e.push(b.value)}),b.find(".tp-swatches").each(function(){var b=a(this),c=b.attr("data-value");-1<e.indexOf(c)?b.removeClass("disabled"):(b.addClass("disabled"),d.length&&c===d.val()&&b.removeClass("selected"))})})},50)}).on("tp-woo_no_matching_variations",function(){window.alert(wc_add_to_cart_variation_params.i18n_no_matching_variations_text)})})},a(function(){a(".variations_form").tp_woo_variation_swatches_form(),a(document.body).trigger("tp-woo_initialized")})})(jQuery);