!function(g){woodmartThemeModule.$document.on("pjax:complete wdProductsTabsLoaded wdShopPageInit wdLoadMoreLoadProducts",function(){woodmartThemeModule.imagesGalleryInLoop()}),woodmartThemeModule.$document.on("wdRecentlyViewedProductLoaded",function(){g(".wd-products-element .products, .wd-carousel-container.products .product-grid-item").each(function(e,d){let r=g(this);r.trigger("wdImagesGalleryInLoopOn",r)})}),g.each(["frontend/element_ready/wd_products.default","frontend/element_ready/wd_products_tabs.default","frontend/element_ready/wd_archive_products.default"],function(e,d){woodmartThemeModule.wdElementorAddAction(d,function(){woodmartThemeModule.imagesGalleryInLoop()})}),woodmartThemeModule.imagesGalleryInLoop=function(){function r(e){g(e).on("mouseover mouseout",".wd-product-grid-slide",function(i){let l=g(this),n=l.closest(".product-grid-item"),e=n.closest(".products"),d=0<e.length&&e.data("grid-gallery")?e.data("grid-gallery"):{},r=woodmart_settings.grid_gallery_control;if(!("hover"!==(r=d.hasOwnProperty("grid_gallery_control")&&(null===d.grid_gallery_control||"string"==typeof d.grid_gallery_control&&0<d.grid_gallery_control.length)?d.grid_gallery_control:r)||woodmartThemeModule.$window.width()<=1024)){let e=n.find(".wd-product-grid-slider-pagin"),d=n.find(".product-image-link > img, .product-image-link > picture > img"),r=n.find(".product-image-link picture source"),t,o,a;(a="mouseover"===i.type?(i=l.data("image-id"),t=l.data("image-url"),o=l.data("image-srcset"),e.find(`[data-image-id="${i}"]`)):(t=n.find('.wd-product-grid-slide[data-image-id="0"]').data("image-url"),o=n.find('.wd-product-grid-slide[data-image-id="0"]').data("image-srcset"),e.find('[data-image-id="0"]'))).siblings().removeClass("wd-active"),a.addClass("wd-active"),d.attr("src",t),o&&(d.attr("srcset",o),r.attr("srcset",o))}}).on("click",".wd-prev, .wd-next",function(i){i.preventDefault();let l=g(this),e=l.closest(".products"),d=0<e.length&&e.data("grid-gallery")?e.data("grid-gallery"):{},r=woodmart_settings.grid_gallery_control,t=woodmart_settings.grid_gallery_enable_arrows;if(d.hasOwnProperty("grid_gallery_control")&&(null===d.grid_gallery_control||"string"==typeof d.grid_gallery_control&&0<d.grid_gallery_control.length)&&(r=d.grid_gallery_control),d.hasOwnProperty("grid_gallery_enable_arrows")&&(null===d.grid_gallery_enable_arrows||"string"==typeof d.grid_gallery_enable_arrows&&0<d.grid_gallery_enable_arrows.length)&&(t=d.grid_gallery_enable_arrows),!(woodmartThemeModule.$window.width()<1024&&(!t||"none"===t)||1024<woodmartThemeModule.$window.width()&&(!r||"arrows"!==r))){let e=l.closest(".product-grid-item"),d=e.find(".product-image-link > img, .product-image-link > picture > img"),r=e.find(".product-image-link picture source"),t=e.find(".wd-product-grid-slide"),o=t.hasClass("wd-active")?e.find(".wd-product-grid-slide.wd-active").data("image-id"):0,a=(g(this).hasClass("wd-prev")?o--:g(this).hasClass("wd-next")&&o++,-1===o?o=t.length-1:t.length===o&&(o=0),e.find(`.wd-product-grid-slide[data-image-id="${o}"]`));var i=a.data("image-url"),n=a.data("image-srcset");t.removeClass("wd-active"),a.addClass("wd-active"),d.attr("src",i),n&&(d.attr("srcset",n),r.attr("srcset",n))}})}g(".product-grid-item").each(function(e,d){r(d)}),woodmartThemeModule.$document.on("wdImagesGalleryInLoopOff",".product-grid-item",function(e,d=this){g(d).off("mouseover mouseout",".wd-product-grid-slide").off("click",".wd-prev, .wd-next")}).on("wdImagesGalleryInLoopOn",".product-grid-item",function(e,d=this){r(d)})},g(document).ready(function(){woodmartThemeModule.imagesGalleryInLoop()})}(jQuery);