!function(e){"use strict";e.extend(e.nmTheme,{shop_init:function(){var o=this;if(o.shopSelectConfig={onOpen:function(){var o=e(this);o.closest("tr").addClass("open");var s=o.closest("tr")[0].getBoundingClientRect().width;o.children(".sod_list_wrapper").css("width",s+"px"),o.children("select").trigger("focusin")},onChange:function(){e(this).closest("tr").removeClass("open")},onClose:function(){e(this).closest("tr").removeClass("open")}},o.isShop){o.shopAjax=!1,o.scrollOffsetDesktop=parseInt(nm_wp_vars.shopScrollOffset),o.scrollOffsetTablet=parseInt(nm_wp_vars.shopScrollOffsetTablet),o.scrollOffsetMobile=parseInt(nm_wp_vars.shopScrollOffsetMobile),o.infloadScroll=!1,o.categoryClicked=!1,o.shopLoaderSpeed=300,o.shopScrollSpeed=410,o.$shopBrowseWrap=e("#nm-shop-browse-wrap"),o.imageLazyLoading="0"!=nm_wp_vars.shopImageLazyLoad,"0"!=nm_wp_vars.shopFiltersAjax?o.filtersEnableAjax=!o.isTouch||"1"==nm_wp_vars.shopFiltersAjax:o.filtersEnableAjax=!1,o.shopSetScrollOffset(),o.shopSetMinHeight();var s=null;o.$window.on("resize",(function(){s&&clearTimeout(s),s=setTimeout((function(){o.shopSetMinHeight(),o.shopSetScrollOffset()}),250)})),o.$pageIncludes.hasClass("banner-slider")?o.$document.on("banner-slider-loaded",(function(){o.shopUrlHashScroll()})):o.shopUrlHashScroll(),o.imageLazyLoading&&setTimeout((function(){o.$shopWrap.addClass("images-show")}),50),o.filtersEnableAjax&&o.$window.on("popstate.nmshop",(function(e){e.originalEvent.state&&e.originalEvent.state.nmShop&&o.shopGetPage(window.location.href,!0)})),e("#nm-main-menu-ul").children(".shop-link").find("> a").on("click",(function(e){e.preventDefault(),o.shopScrollToTop()})),o.$shopWrap.on("click.nmShopFiltersReset","#nm-shop-filters-reset",(function(e){e.preventDefault(),o.shopFiltersReset(this)})),o.$shopWrap.on("click.nmShopSearchTaxonomyReset","#nm-shop-search-taxonomy-reset",(function(e){e.preventDefault(),o.shopSearchTaxonomyReset(this)}))}o.$document.on("woocommerce_update_variation_values",".variations_form",(function(){o.singleProductVariationsUpdate()})),"undefined"!=typeof wc_add_to_cart_params&&"yes"!==wc_add_to_cart_params.cart_redirect_after_add?(o.$body.on("adding_to_cart",(function(e,s,n){if(o.$cartPanel.length){var t=o.quickviewIsOpen()?400:0;setTimeout((function(){o.cartPanelShow(!0,!0)}),t)}else o.$pageOverlay.addClass("nm-loader"),o.pageOverlayShow()})),o.$body.on("added_to_cart",(function(e,s,n){o.$cartPanel.length?o.cartPanelHideLoader():(o.pageOverlayClick(),o.$pageOverlay.removeClass("nm-loader"))}))):o.$document.off("click",".add_to_cart_button"),o.shopLoadExtension()},shopLoadExtension:function(){var o=this;e.nmThemeExtensions.add_to_cart&&e.nmThemeExtensions.add_to_cart.call(o),o.isShop&&(e.nmThemeExtensions.infload&&e.nmThemeExtensions.infload.call(o),e.nmThemeExtensions.filters&&e.nmThemeExtensions.filters.call(o)),o.$pageIncludes.hasClass("quickview")&&e.nmThemeExtensions.quickview&&e.nmThemeExtensions.quickview.call(o)},shopUrlHashScroll:function(){"#shop"===window.location.hash&&this.shopScrollToTop(!0)},shopCheckVariationDetails:function(e){var o=e.children(),s=!0;if(o.length)for(var n=0;n<o.length;n++)if(o.eq(n).children().length){s=!1;break}s?e.hide():e.show()},shopSetScrollOffset:function(){var e=this,o=e.$body.width();e.scrollOffset=o>863?e.$header.hasClass("static-on-scroll")?e.$header.outerHeight():e.scrollOffsetDesktop:o>383?e.scrollOffsetTablet:e.scrollOffsetMobile},shopSetMinHeight:function(){var o=this,s=e("#nm-footer").outerHeight(!0);o.$shopWrap.css("min-height",o.$window.height()-(s+o.scrollOffset)+"px")},shopScrollToTop:function(o,s){var n=this,t=0;if(n.$window.width()>399)var a=Math.round(n.$shopWrap.offset().top-n.scrollOffset);else a=Math.round(e("#nm-shop-products").offset().top-24-n.scrollOffset);return Math.abs(a-n.$html.scrollTop())<50||(o&&n.shopSetMinHeight(),s?e("html, body").scrollTop(a):(t=n.shopScrollSpeed,e("html, body").animate({scrollTop:a},n.shopScrollSpeed))),t},shopShowNotices:function(){var e=this;e.$body.addClass("nm-woocommerce-message-show"),e.isShop&&"0"!=nm_wp_vars.cartPanelHideOnAtcScroll&&e.shopScrollToTop()},shopRemoveNotices:function(){e("#nm-shop-notices-wrap").empty()},shopShowLoader:function(o){var s=e("#nm-shop-products-overlay");o&&s.addClass("no-anim"),s.addClass("show"),this.$shopWrap.addClass("loading")},shopHideLoader:function(o){var s=this,n=e("#nm-shop-products-overlay");o||n.removeClass("no-anim"),n.removeClass("nm-loader").addClass("fade-out"),setTimeout((function(){n.removeClass("show fade-out").addClass("nm-loader")}),s.shopLoaderSpeed),s.infloadScroll&&(s.infscrollLock=!1,s.$window.trigger("scroll")),s.$shopWrap.removeClass("loading")},shopFiltersReset:function(o){var s=e(o),n=s.data("shop-override-url")?s.data("shop-override-url"):location.href.replace(location.search,"");this.filtersEnableAjax?this.shopGetPage(n):window.location.href=n},shopSearchTaxonomyReset:function(o){var s=this,n=e(o);if(n.closest(".nm-shop-results-bar").hasClass("is-search"))var t=s.urlGetParameter("s")?n.data("shop-url"):location.href.replace(location.search,"");else t=n.data("shop-url");s.filtersEnableAjax?s.shopGetPage(t):window.location.href=t},singleProductVariationsInit:function(o){var s=this,n=o.children(".variations"),t=o.children(".single_variation_wrap").children(".single_variation");if(s.shopCustomSelect)for(var a,i=n.find("select"),l=0;l<i.length;l++)(a=i.eq(l)).parent().hasClass("nm-select-hidden")||a.selectOrDie(s.shopSelectConfig);var r=null;n.find(".nm-variation-control").children("li").on("click",(function(){if(!r){var o=e(this),s=o.parent(),n=s.parent().children(".nm-select-hidden").find("select"),t=o.data("value");o.hasClass("selected")?(o.removeClass("selected"),n.val("").trigger("change")):(s.children(".selected").removeClass("selected"),o.addClass("selected"),n.val(t).trigger("change")),r=setTimeout((function(){r=null}),300)}})),s.shopCheckVariationDetails(t),t.on("show_variation",(function(){s.shopCheckVariationDetails(e(this))})),t.on("hide_variation",(function(){t.css("display","none")}))},singleProductVariationsUpdate:function(){var o=this;e(".variations_form").find("select").each((function(){var s=e(this);if(o.shopCustomSelect&&s.selectOrDie("update"),s.parent(".nm-select-hidden").length)for(var n,t,a,i,l=s.closest(".value").children(".nm-variation-control").children("li"),r=0;r<l.length;r++)t=(n=e(l[r])).data("value"),(a=s.children('[value="'+t+'"]')).length?(i=a.attr("disabled"),a.hasClass("enabled")?n.removeClass("hidden disabled"):void 0!==i&&!1!==i&&n.removeClass("hidden").addClass("disabled")):n.removeClass("disabled").addClass("hidden")}))},quickviewIsOpen:function(){return!(!e("#nm-quickview").is(":visible")||e("#nm-quickview").hasClass("fade-out"))}}),e.nmThemeExtensions.shop=e.nmTheme.shop_init}(jQuery);