"use strict";!function(e){var t=!1,o=e("body"),n=e("#page"),i={init:function(){e(document).ready(i.ready),e(document).ajaxComplete(i.ajaxComplete),o.on("added_to_cart",i.addedToCart),i.bindUIActions()},ready:function(){i.customDropdown(),i.quantButtons()},ajaxComplete:function(){i.quantButtons()},addedToCart:function(){i.showCartDropdown()},bindUIActions:function(){i.removeCartItem()},quantButtons:function(){var t,o,n,i,a=e("div.quantity:not(.appended), td.quantity:not(.appended)").find(".qty");a.length&&"date"!==a.prop("type")&&"hidden"!==a.prop("type")&&(a.parent().addClass("appended"),a.after('-+'),e(".bloghash-woo-plus, .bloghash-woo-minus").unbind("click"),e(".bloghash-woo-plus, .bloghash-woo-minus").on("click",(function(r){r.preventDefault(),i=e(this),n=i.parent().find("input"),o=n.val(),t=0,i.hasClass("bloghash-woo-plus")?t=parseInt(o)+1:o>0&&(t=parseInt(o)-1),n.val(t),a.trigger("change")})))},showCartDropdown:function(){e(".bloghash-header-widget__cart").length&&(e(".bloghash-header-widget__cart").addClass("dropdown-visible"),setTimeout((function(){e("#bloghash-header-inner").find(".bloghash-cart").find(".bloghash-cart-count").addClass("animate-pop")}),100),t&&(clearTimeout(t),t=!1),t=setTimeout((function(){e(".bloghash-header-widget__cart").removeClass("dropdown-visible").find(".dropdown-item").removeAttr("style")}),5e3))},customDropdown:function(){if(e("form.woocommerce-ordering").length){var t=e("form.woocommerce-ordering .orderby"),o=e("form.woocommerce-ordering"),n=e("form.woocommerce-ordering .orderby option:selected").text();o.append(''+n+''),t.addClass("custom-select-loaded");var i=e("#bloghash-orderby");t.width(i.width()).css("height",i.height()+"px"),t.change((function(){i.find("span").html(e("form.woocommerce-ordering .orderby option:selected").text()),e(this).width(i.width())}))}},removeCartItem:function(){var t;e(".bloghash-remove-cart-item").length&&n.on("click",".bloghash-remove-cart-item",(function(n){n.preventDefault(),(t=e(this)).closest(".bloghash-cart-item").addClass("removing");var i={action:"bloghash_remove_wc_cart_item",_ajax_nonce:bloghash_vars.nonce,product_key:t.data("product_key")};e.post(bloghash_vars.ajaxurl,i,(function(e){e.success?o.trigger("wc_fragment_refresh"):t.closest(".bloghash-cart-item").removeClass("removing")}))}))}};i.init(),window.bloghash_wc=i}(jQuery);