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