!function(u){u.each(["frontend/element_ready/wd_products.default","frontend/element_ready/wd_products_tabs.default"],function(a,e){woodmartThemeModule.wdElementorAddAction(e,function(){woodmartThemeModule.swatchesOnGrid()})}),woodmartThemeModule.swatchesOnGrid=function(){woodmartThemeModule.$body.on("click",".wd-swatches-grid .wd-swatch",function(){var a,e,t,d,r,i,s,o,n,c=u(this),l=c.data("image-src"),m=c.data("image-srcset"),g=c.data("image-sizes");void 0!==l&&""!==l&&(r=(d=c.parents(".product-grid-item")).find(".product-image-link > img, .product-image-link > picture > img"),i=d.find(".product-image-link picture source"),s=r.data("original-src"),o=r.data("original-srcset"),n=r.data("original-sizes"),void 0===s&&r.data("original-src",r.attr("src")),void 0===o&&r.data("original-srcset",r.attr("srcset")),void 0===n&&r.data("original-sizes",r.attr("sizes")),c.hasClass("wd-active")?(a=s,e=o,t=n,c.removeClass("wd-active"),d.removeClass("product-swatched"),d.trigger("wdImagesGalleryInLoopOn",d)):(c.parent().find(".wd-active").removeClass("wd-active"),c.addClass("wd-active"),d.addClass("product-swatched"),a=l,e=m,t=g,d.trigger("wdImagesGalleryInLoopOff",d)),r.attr("src")!==a&&(d.addClass("wd-loading-image"),r.attr("src",a).attr("srcset",e).attr("image_sizes",t).one("load",function(){d.removeClass("wd-loading-image")}),0<i.length&&i.attr("srcset",e).attr("image_sizes",t)))})},u(document).ready(function(){woodmartThemeModule.swatchesOnGrid()})}(jQuery);