jQuery(function(a){if("undefined"==typeof wc_single_product_params)return!1;a("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){a(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var b=window.location.hash,c=window.location.href,d=a(this).find(".wc-tabs, ul.tabs").first();b.toLowerCase().indexOf("comment-")>=0||"#reviews"===b||"#tab-reviews"===b?d.find("li.reviews_tab a").click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?d.find("li.reviews_tab a").click():d.find("li:first a").click()}).on("click",".wc-tabs li a, ul.tabs li a",function(b){b.preventDefault();var c=a(this),d=c.closest(".wc-tabs-wrapper, .woocommerce-tabs"),e=d.find(".wc-tabs, ul.tabs");e.find("li").removeClass("active"),d.find(".wc-tab, .panel:not(.panel .panel)").hide(),c.closest("li").addClass("active"),d.find(c.attr("href")).show()}).on("click","a.woocommerce-review-link",function(){return a(".reviews_tab a").click(),!0}).on("init","#rating",function(){a("#rating").hide().before('

12345

')}).on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating"),d=a(this).closest(".stars");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),d.addClass("selected"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();if(b.length>0&&!c&&"yes"===wc_single_product_params.review_rating_required)return window.alert(wc_single_product_params.i18n_required_rating_text),!1}),a(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init");var b=function(b,c){this.$target=b,this.$images=a(".woocommerce-product-gallery__image",b),b.data("product_gallery",this),this.flexslider_enabled=a.isFunction(a.fn.flexslider)&&wc_single_product_params.flexslider_enabled,this.zoom_enabled=a.isFunction(a.fn.zoom)&&wc_single_product_params.zoom_enabled,this.photoswipe_enabled="undefined"!=typeof PhotoSwipe&&wc_single_product_params.photoswipe_enabled,c&&(this.flexslider_enabled=!1!==c.photoswipe_enabled&&this.flexslider_enabled,this.zoom_enabled=!1!==c.zoom_enabled&&this.zoom_enabled,this.photoswipe_enabled=!1!==c.photoswipe_enabled&&this.photoswipe_enabled),this.initFlexslider=this.initFlexslider.bind(this),this.initZoom=this.initZoom.bind(this),this.initPhotoswipe=this.initPhotoswipe.bind(this),this.onResetSlidePosition=this.onResetSlidePosition.bind(this),this.getGalleryItems=this.getGalleryItems.bind(this),this.openPhotoswipe=this.openPhotoswipe.bind(this),this.flexslider_enabled&&(this.initFlexslider(),b.on("woocommerce_gallery_reset_slide_position",this.onResetSlidePosition)),this.zoom_enabled&&(this.initZoom(),b.on("woocommerce_gallery_init_zoom",this.initZoom)),this.photoswipe_enabled&&this.initPhotoswipe()};b.prototype.initFlexslider=function(){var b=this.$images;this.$target.flexslider({selector:".woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image",animation:wc_single_product_params.flexslider.animation,smoothHeight:wc_single_product_params.flexslider.smoothHeight,directionNav:wc_single_product_params.flexslider.directionNav,controlNav:wc_single_product_params.flexslider.controlNav,slideshow:wc_single_product_params.flexslider.slideshow,animationSpeed:wc_single_product_params.flexslider.animationSpeed,animationLoop:wc_single_product_params.flexslider.animationLoop,start:function(){var c=0;b.each(function(){var b=a(this).height();b>c&&(c=b)}),b.each(function(){a(this).css("min-height",c)})}})},b.prototype.initZoom=function(){var b=this.$images,c=this.$target.width(),d=!1;this.flexslider_enabled||(b=b.first()),a(b).each(function(b,e){var f=a(e).find("img");if(f.attr("width")>c)return d=!0,!1}),d&&(b.trigger("zoom.destroy"),b.zoom({touch:!1}))},b.prototype.initPhotoswipe=function(){this.zoom_enabled&&this.$images.length>0&&(this.$target.prepend('🔍'),this.$target.on("click",".woocommerce-product-gallery__trigger",this.openPhotoswipe)),this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)},b.prototype.onResetSlidePosition=function(){this.$target.flexslider(0)},b.prototype.getGalleryItems=function(){var b=this.$images,c=[];return b.length>0&&b.each(function(b,d){var e=a(d).find("img"),f=e.attr("data-large_image"),g=e.attr("data-large_image_width"),h=e.attr("data-large_image_height"),i={src:f,w:g,h:h,title:e.attr("title")};c.push(i)}),c},b.prototype.openPhotoswipe=function(b){b.preventDefault();var c,d=a(".pswp")[0],e=this.getGalleryItems(),f=a(b.target);c=f.is(".woocommerce-product-gallery__trigger")?this.$target.find(".flex-active-slide"):f.closest(".woocommerce-product-gallery__image");var g={index:a(c).index(),shareEl:!1,closeOnScroll:!1,history:!1,hideAnimationDuration:0,showAnimationDuration:0},h=new PhotoSwipe(d,PhotoSwipeUI_Default,e,g);h.init()},a.fn.wc_product_gallery=function(a){return new b(this,a),this},a(".woocommerce-product-gallery").wc_product_gallery()});