!function(e){"use strict";var t={init:function(){var o=t,i={"jet-woo-product-gallery-grid.default":o.productGalleryGrid,"jet-woo-product-gallery-modern.default":o.productGalleryModern,"jet-woo-product-gallery-anchor-nav.default":o.productGalleryAnchorNav,"jet-woo-product-gallery-slider.default":o.productGallerySlider};if(e.each(i,function(e,t){window.elementorFrontend.hooks.addAction("frontend/element_ready/"+e,t)}),window.elementorFrontend.elements.$window.on("elementor/nested-tabs/activate",(t,i)=>{const a=e(i).find(".elementor-widget-jet-woo-product-gallery-slider"),r=a.find(".jet-woo-product-gallery-slider, .jet-woo-swiper-gallery-thumbs");r.length&&(r.each(function(){const e=this.swiper;e&&e.destroy()}),o.swiperDowngrade(),setTimeout(()=>{o.productGallerySlider(a)}))}),e(window).on("jet-popup/render-content/ajax/success",function(){o.swiperDowngrade()}),window.jetWooProductGalleryData&&window.jetWooProductGalleryData.product_types&&window.jetWooProductGalleryData.product_types.length)for(const t of window.jetWooProductGalleryData.product_types){const i=e(".woocommerce div.product").hasClass("product-type-"+t),a=e("body").hasClass("product-type-"+t);if(i||a)return void e(document).off(".jet-woo-product-gallery").on("show_variation.jet-woo-product-gallery reset_image.jet-woo-product-gallery",(e,t)=>o.showVariationImage(t))}},initBlocks:function(){JetPlugins.bulkBlocksInit([{block:"jet-gallery/gallery-anchor-nav",callback:t.productGalleryAnchorNav},{block:"jet-gallery/gallery-grid",callback:t.productGalleryGrid},{block:"jet-gallery/gallery-modern",callback:t.productGalleryModern},{block:"jet-gallery/gallery-slider",callback:t.productGallerySlider}])},swiperDowngrade:function(){if(!window.elementorFrontendConfig.experimentalFeatures.e_swiper_latest)return;const t=window.elementorFrontendConfig.environmentMode.isScriptDebug?"":".min";window.elementorFrontend.utils.assetsLoader.isAssetLoaded({src:`${window.elementorFrontendConfig.urls.assets}lib/swiper/v8/swiper${t}.js?ver=8.4.5`},"script")&&e("body").append(`<script src="${window.jetWooProductGalleryData.assets_path}/lib/swiper/swiper${t}.js?ver=5.3.6"><\/script>`)},showVariationImage:function(t){var o=e(document).find(".product").find(".jet-woo-product-gallery");e.each(o,function(){if(e(this).is("[data-variation-images]")){var o=e(this).data("variation-images"),i=e(this).find(".jet-woo-product-gallery-slider"),a=i.data("swiper-settings"),r=null,n=null,l=e(this).children().data("featured-image"),s=e(this).data("gallery-settings").videoFirst?1:0,d=i.find(".jet-woo-product-gallery__image-item").length;a&&a.loop&&d>1?(r=e(this).find('.jet-woo-product-gallery__image-item[data-swiper-slide-index="'+s+'"]'),n=e(this).find('.jet-woo-swiper-control-thumbs__item[data-swiper-slide-index="'+s+'"] img')):(r=e(this).find(".jet-woo-product-gallery__image-item").eq(s),n=e(this).find(".jet-woo-swiper-control-thumbs__item").eq(s).find("img"));var c=r.find(".wp-post-image"),p=r.find("a").eq(0);if(l||(c=r.find(".wp-post-gallery")),t&&t.image&&t.image.src&&t.image.src.length>1){var u=o[t.image_id];!function(e,t){c.wc_set_variation_attr("src",t.src),c.wc_set_variation_attr("height",t.src_h),c.wc_set_variation_attr("width",t.src_w),c.wc_set_variation_attr("srcset",t.srcset),c.wc_set_variation_attr("sizes",t.sizes),c.wc_set_variation_attr("title",e.image.title),c.wc_set_variation_attr("data-caption",e.image.caption),c.wc_set_variation_attr("alt",e.image.alt),c.wc_set_variation_attr("data-src",t.src),c.wc_set_variation_attr("data-large_image",t.full_src),c.wc_set_variation_attr("data-large_image_width",t.full_src_w),c.wc_set_variation_attr("data-large_image_height",t.full_src_h),r.wc_set_variation_attr("data-thumb",t.src),p.wc_set_variation_attr("href",e.image.full_src),n.wc_set_variation_attr("src",e.image.thumb_src),n.wc_set_variation_attr("srcset","")}(t,u)}else c.wc_reset_variation_attr("src"),c.wc_reset_variation_attr("width"),c.wc_reset_variation_attr("height"),c.wc_reset_variation_attr("srcset"),c.wc_reset_variation_attr("sizes"),c.wc_reset_variation_attr("title"),c.wc_reset_variation_attr("data-caption"),c.wc_reset_variation_attr("alt"),c.wc_reset_variation_attr("data-src"),c.wc_reset_variation_attr("data-large_image"),c.wc_reset_variation_attr("data-large_image_width"),c.wc_reset_variation_attr("data-large_image_height"),r.wc_reset_variation_attr("data-thumb"),p.wc_reset_variation_attr("href"),n.wc_reset_variation_attr("src"),n.wc_reset_variation_attr("width"),n.wc_reset_variation_attr("height")}}),e(document).trigger("jet-woo-gallery-variation-image-change")},productGallerySlider:function(o){o.find(".jet-swiper-nav").hide();const i=o.find(".jet-woo-product-gallery-slider"),a=i.data("swiper-settings"),r=o.find(".jet-woo-product-gallery").data("gallery-settings")||o.data("gallery-settings"),n=t.getElementorElementSettings(o);if(i.find(".jet-woo-product-gallery__image-item").length>1){let s={slidesPerView:1,touchReleaseOnEdges:!0,...a};if(delete s.paginationType,a.centeredSlides&&!e.isEmptyObject(n)){s.slidesPerView=+n.slider_center_mode_slides||4,s.spaceBetween=+n.slider_center_mode_space_between?+n.slider_center_mode_space_between:0;const e={slidesPerView:"slider_center_mode_slides_",spaceBetween:"slider_center_mode_space_between_"};s.breakpoints=t.handleSwiperBreakpoints(n,s,e)}if(a.showNavigation&&(s.navigation={nextEl:".jet-swiper-button-next",prevEl:".jet-swiper-button-prev"}),a.showPagination)if("thumbnails"===a.paginationType){const r=o.find(".jet-woo-swiper-gallery-thumbs"),l=i.data("swiper-thumb-settings");let d={freeMode:a.loop,slidesPerView:4,spaceBetween:10,watchSlidesVisibility:!0,watchSlidesProgress:!0,...l};if(l.showNavigation&&(d.navigation={nextEl:".jet-thumb-swiper-nav.jet-swiper-button-next",prevEl:".jet-thumb-swiper-nav.jet-swiper-button-prev"}),!e.isEmptyObject(n)){d.slidesPerView=+n.pagination_thumbnails_columns,d.spaceBetween=+n.pagination_thumbnails_space_between?+n.pagination_thumbnails_space_between:0;const e={slidesPerView:"pagination_thumbnails_columns_",spaceBetween:"pagination_thumbnails_space_between_"};d.breakpoints=t.handleSwiperBreakpoints(n,d,e)}s.thumbs={swiper:new JetSwiper(r,d)};let c=0;window.elementorFrontend&&!e.isEmptyObject(n)?(c=+n.pagination_thumbnails_columns,"desktop"!==window.elementorFrontend.getCurrentDeviceMode()&&(c=+n["pagination_thumbnails_columns_"+window.elementorFrontend.getCurrentDeviceMode()])):e.each(l.breakpoints,(t,o)=>{e(window).width()>t&&(c=o.slidesPerView)}),c>=r.find(".jet-woo-swiper-control-thumbs__item:not(.swiper-slide-duplicate)").length&&(r.addClass("jet-woo-swiper-gallery-thumbs-no-nav"),r.find(".jet-swiper-nav").hide(),r.find(".swiper-slide-duplicate").hide())}else s.pagination={el:".swiper-pagination",type:"dynamic"!==a.paginationControllerType?a.paginationControllerType:"bullets",clickable:!0,dynamicBullets:!("dynamic"!==a.paginationControllerType&&!a.dynamicBullets)};s.on={init:function(){r.hasVideo&&a.loop&&i.find(".swiper-slide-duplicate video.jet-woo-product-video-player").removeAttr("autoplay")},imagesReady:function(){if(r.hasVideo){const t=i.find(".jet-woo-product-gallery--with-video");"self_hosted"===r.videoType&&("horizontal"===a.direction?(r.videoAutoplay&&r.videoFirst&&(setTimeout(function(){d.updateAutoHeight(100)},300),a.autoHeight||l(t)),a.autoHeight&&t.on("click",()=>{setTimeout(function(){d.updateAutoHeight(100)},300)})):t.each(function(){r.videoAutoplay&&l(e(this)),e(this).on("click",()=>{l(e(this))})}))}if("vertical"===a.direction){i.find(".jet-woo-product-gallery__image-item img").each(function(){let t=e(this);t.height()>i.height()&&t.css({height:i.height()+"px",width:"auto"})})}let t=!1;e(document).on("jet-woo-gallery-variation-image-change",()=>{let e=0;t&&r.videoFirst&&(e=1),a.loop?d.slideToLoop(e,300,!0):d.slideTo(e,300,!0),t=!0})},slideChangeTransitionStart:function(){if(!r.hasVideo||!a.loop)return;const e=this.$wrapperEl,t=this.params;e.children("."+t.slideClass+"."+t.slideDuplicateClass).each(function(){const o=this.getAttribute("data-swiper-slide-index");this.innerHTML=e.children("."+t.slideClass+'[data-swiper-slide-index="'+o+'"]:not(.'+t.slideDuplicateClass+")").html()})},slideChangeTransitionEnd:function(){r.hasVideo&&a.loop&&this.slideToLoop(this.realIndex,0,!1)}};const d=new JetSwiper(i,s);a.showNavigation&&o.find(".jet-swiper-nav").show()}else o.find(".swiper-pagination").hide();function l(e){e.find(".mejs-container").hasClass("mejs-container-fullscreen")?e.find(".mejs-controls").removeAttr("style"):setTimeout(function(){e.height()>i.height()&&e.find(".mejs-controls").css({top:i.height()+"px",bottom:"auto",transform:"translateY(-100%)"})},300)}t.productGallery(o)},productGalleryGrid:function(e){t.productGallery(e)},productGalleryModern:function(e){t.productGallery(e)},productGalleryAnchorNav:function(o){var i,a,r,n=o.find(".jet-woo-product-gallery__image-item"),l=o.find(".jet-woo-product-gallery-anchor-nav-items"),s=o.find(".jet-woo-product-gallery-anchor-nav-controller"),d=s.find('[data-role="gallery-controller"]'),c=[],p=!1,u=0,w=0,g=e("#wpadminbar"),_=o.closest(".jet-popup__container-inner"),m=_.length?_:e(window),h=m[0]===window;function f(){return h?e(document).scrollTop():m.scrollTop()}function y(e){return h?e.offset().top:e.offset().top-m.offset().top+m.scrollTop()}function v(){e(n).each(function(){var t=e(this).attr("id");c[t]=y(e(this))})}function j(){for(var t in c){if(w>=c[t]-u)e(s).find("a.current-item").removeClass("current-item"),e(s).find('a[data-index="'+t+'"]').addClass("current-item")}}g.length&&(u=g.outerHeight()),t.productGallery(o),v(),i=!1,a=!1,r=!1,m.on("scroll",function(){var t=f(),o=e(l).outerHeight(!0),n=e(s).outerHeight(!0),d=y(e(l)),c=y(e(s)),p=d+o,w=c+n,g=h?u:0;p-n-g<=t||(!0===a&&!1===r&&e(s).css({top:t-d+g+"px"}),t<c&&t<w&&(i=!1,a=!0,e(s).css({top:t-d+g+"px"})),!1===i&&t>d&&(i=!0,a=!0,r=!1),!1===i&&d>t&&(i=!1,a=!1,r=!1,e(s).removeAttr("style")))}),m.scroll(function(){p||(v(),w=f(),j())}),w=f(),j(),e(d).on("click",function(){j();var t=e(this).data("index"),o=c[t];if(p=!0,e(s).find("a.current-item").removeClass("current-item"),e(this).addClass("current-item"),t,e(this).parents().hasClass("jet-popup")){let t=e(this).closest(".jet-popup__container-inner");e(t).animate({scrollTop:o+1},"fast",function(){p=!1})}else e("html, body").animate({scrollTop:o-u+1},"fast",function(){p=!1});return!1});var b=null;function k(e){b||(b=window.requestAnimationFrame(function(){b=null,e()}))}function C(){var e=o.find(".jet-woo-product-gallery-anchor-nav");if(e.length){var t=e.find(".jet-woo-product-gallery-anchor-nav-items"),i=e.find(".jet-woo-product-gallery-anchor-nav-controller");if(t.length&&i.length)if("absolute"===window.getComputedStyle(i[0]).position){e.css({"min-height":""});var a=e[0].getBoundingClientRect(),r=t[0].getBoundingClientRect(),n=i[0].getBoundingClientRect(),l=r.bottom-a.top,s=n.bottom-a.top,d=Math.ceil(Math.max(l,s));d>0&&e.css("min-height",d+"px")}else e.css({"min-height":""})}}k(C),e(window).on("resize orientationchange",function(){k(C)}),o.find(".jet-woo-product-gallery__image img, .controller-item__thumbnail img").each(function(){this.complete&&this.naturalWidth||e(this).one("load",function(){k(C)})}),o.on("jetGallery:slideChange jetGallery:layoutChange jetGallery:variationChange",function(){k(C)})},productGallery:function(t){var o,i=t.data("id")||t.parent().data("block-id"),a=t.find(".jet-woo-product-gallery").data("gallery-settings")||t.data("gallery-settings"),r=t.find(".jet-woo-product-gallery__image--with-zoom"),n=t.find(".jet-woo-product-gallery__trigger, .jet-woo-product-gallery__image-overlay"),l=e(".jet-woo-product-gallery-pswp")[0],s=t.find(".jet-woo-product-video__popup-button"),d=t.find(".jet-woo-product-video__popup-overlay"),c=t.find(".jet-woo-product-video-iframe"),p=!!c[0]&&c[0].src,u=t.find(".jet-woo-product-video-player"),w=t.find(".jet-woo-product-video-mejs-player"),g=w.data("controls")||["playpause","current","progress","duration","volume","fullscreen"],_=t.find(".jet-woo-product-video__overlay"),m=_.length>0,h=t.find(".jet-woo-product-gallery__image-overlay").length>0;o=t.find(".jet-woo-product-gallery__primary-image").length?t.find(".jet-woo-product-gallery__primary-image .jet-woo-product-gallery__image-item, .jet-woo-product-gallery__images-grid .jet-woo-product-gallery__image-item"):t.find(".jet-woo-product-gallery__image-item").filter(function(){return!e(this).closest(".swiper-slide").hasClass("swiper-slide-duplicate")});var f=j();if(a){var y={mainClass:t.parent().data("block-id")?i+"-jet-woo-product-gallery":i?"jet-woo-product-gallery-"+i:"",captionEl:a.caption?a.caption:"",fullscreenEl:!!a.fullscreen&&a.fullscreen,zoomEl:!!a.zoom&&a.zoom,shareEl:!!a.share&&a.share,counterEl:!!a.counter&&a.counter,arrowEl:!!a.arrows&&a.arrows,closeOnScroll:!1,history:!1};(a.enableGallery||h)&&(n.on("click.JetWooProductGallery",function(i){if(i.preventDefault(),e("body").hasClass("elementor-editor-active"))return;var r=e(i.target),n=t.find(".jet-woo-product-gallery__image-item.featured").hasClass("no-image"),s=r.parents(".jet-woo-product-gallery__image-item"),d=-1;o.each(function(e,t){if(t===s[0])return d=e,!1}),(n||a.videoFirst)&&(d-=1);y.index=d,new PhotoSwipe(l,PhotoSwipeUI_Default,f,y).init()}),e(document).on("jet-woo-gallery-variation-image-change",function(){f=j()})),a.enableZoom&&(v(),e(document).on("jet-woo-gallery-variation-image-change",v)),a.hasVideo&&function(){switch(a.videoIn){case"content":_[0]&&(_.on("click.JetWooProductGallery",function(t){u[0]&&function(t){let o="";e(t).hasClass("jet-woo-product-video__overlay")?(o=e(t).siblings().find(".jet-woo-product-video-player")[1],e(t).remove()):(o=e(t).parents(".jet-woo-product-video__overlay").siblings().find(".jet-woo-product-video-player")[1],e(t).parents(".jet-woo-product-video__overlay").remove());o.play(),m=!1}(t.target),c[0]&&o(t)}),a.videoAutoplay&&c[0]&&o(event)),u&&u.each(function(){e(this).on("play.JetWooProductGallery",function(){m&&(_.remove(),m=!1)})}),w[0]&&t();break;case"popup":t(),s.on("click.JetWooProductGallery",function(e){!function(){s.siblings(".jet-woo-product-video__popup-content").addClass("jet-woo-product-video__popup--show"),u[0]&&(u[0].play(),a.videoAutoplay||(u[0].pause(),u[0].currentTime=0));c[0]&&(c[0].src=p,a.videoAutoplay&&(c[0].src=c[0].src.replace("&autoplay=0","&autoplay=1")))}()}),d.on("click.JetWooProductGallery",function(e){!function(){s.siblings(".jet-woo-product-video__popup-content").removeClass("jet-woo-product-video__popup--show"),c[0]&&(c[0].src="");u&&(u[0].currentTime=0,u[0].pause())}()})}function t(){w.mediaelementplayer({videoVolume:"horizontal",hideVolumeOnTouchDevices:!1,enableProgressTooltip:!1,features:g,autoplay:!1,pauseOtherPlayers:!1}).load()}function o(t){if(a.videoAutoplay)c.each(function(){e(this).parents(".jet-woo-product-gallery__image-item").hasClass("swiper-slide-duplicate")&&(e(this)[0].src=e(this)[0].src.replace("&autoplay=1","&autoplay=0"))});else{let o="";(o=e(t.target).hasClass("jet-woo-product-video__overlay")?e(t.target).siblings().find(".jet-woo-product-video-iframe"):e(t.target).parents(".jet-woo-product-video__overlay").siblings().find(".jet-woo-product-video-iframe"))[0].src=o[0].src.replace("&autoplay=0","&autoplay=1")}_.remove(),m=!1}}()}function v(){var t=!1,o={magnify:a.zoomMagnify,touch:!1};r.each(function(o,i){var a=e(i).find("img");if(a.length){var r=a.parent().width()||0;return(a.data("large_image_width")||a.get(0)&&a.get(0).naturalWidth||0)>r?(t=!0,!1):void 0}}),t&&("ontouchstart"in document.documentElement&&(o.on="click"),r.trigger("zoom.destroy"),r.zoom(o))}function j(){var t=[];return o.length>0&&o.each(function(o,i){var a=e(i).find(".jet-woo-product-gallery__image:not(.image-with-placeholder) img");if(a.length){var r={src:a.attr("data-large_image"),w:a.attr("data-large_image_width"),h:a.attr("data-large_image_height"),title:a.attr("data-caption")?a.attr("data-caption"):a.attr("title")};t.push(r)}}),t}e(".jet-woo-product-gallery__image-item").find("img").on("click",function(e){e.preventDefault()})},getElementorElementSettings:function(e){return window.elementorFrontend&&window.elementorFrontend.isEditMode()&&e.hasClass("elementor-element-edit-mode")?t.getEditorElementSettings(e):e.data("settings")||{}},getEditorElementSettings:function(e){var t,o=e.data("model-cid");return o&&window.elementorFrontend.hasOwnProperty("config")&&window.elementorFrontend.config.hasOwnProperty("elements")&&window.elementorFrontend.config.elements.hasOwnProperty("data")&&(t=window.elementorFrontend.config.elements.data[o])?t.toJSON():{}},handleSwiperBreakpoints:function(e,t,o){const i=window.elementorFrontend.config.responsive.activeBreakpoints,a=elementorFrontend.breakpoints.getBreakpointValues(),r={mobile:2,tablet:3};let n=t.slidesPerView,l=10;return t.breakpoints={},Object.keys(i).reverse().forEach(a=>{const s=r[a]?r[a]:n;l=+e[o.spaceBetween+a]?+e[o.spaceBetween+a]:0,t.breakpoints[i[a].value]={slidesPerView:+e[o.slidesPerView+a]||s,spaceBetween:l},n=+e[o.slidesPerView+a]||s}),Object.keys(t.breakpoints).forEach(e=>{const o=parseInt(e);let r;if(o===i.mobile.value||o+1===i.mobile.value)r=0;else if(!i.widescreen||o!==i.widescreen.value&&o+1!==i.widescreen.value){const e=a.findIndex(e=>o===e||o+1===e);r=a[e-1]}else r=o;t.breakpoints[r]=t.breakpoints[o],t.breakpoints[o]={slidesPerView:t.slidesPerView,spaceBetween:t.spaceBetween}}),t.breakpoints}};e(window).on("elementor/frontend/init",t.init),window.JetPlugins&&(e(function(){JetPlugins.init()}),window.addEventListener("DOMContentLoaded",function(){t.initBlocks()})),window.JetGallery=t}(jQuery);