window.MS=window.MS||{},window.MS.imageZoom=function(e,m){$(function(){"string"==typeof e&&(e=$(e)),"string"==typeof m&&(m=$(m)),e.on("mouseenter",function(){$(this).find(".zoom-mask").css({display:"block"}),m.addClass("show")}).on("mouseleave",function(){$(this).find(".zoom-mask").css({display:"none"}),m.removeClass("show")}).on("mousemove",function(e){var o=e.originalEvent,i=o.pageX,a=o.pageY,n=$(this),t=n.find(".zoom-mask"),s=n.offset(),d=n.width(),e=n.height(),o=(t.offset(),t.width()),n=t.height(),i=i-s.left-o/2,a=a-s.top-n/2,i=Math.min(Math.max(i,0),d-o),a=Math.min(Math.max(a,0),e-n);t.css({left:i+"px",top:a+"px"}),m.css({left:s.left+ +d+10+"px",top:s.top+"px"});s=m.find(".pb-image-zoom-image"),d=s.width()/d,i=-Math.min(d*i,s.width()-m.width()),a=-Math.min(d*a,s.height()-m.height());s.css({left:i+"px",top:a+"px"})})})},$(function(){if(window.__goodsSlider=new Swiper(".pb-goods-images .big",{thumbs:{swiper:new Swiper(".pb-goods-images .small",{spaceBetween:10,slidesPerView:"auto",freeMode:!0,watchSlidesVisibility:!0,watchSlidesProgress:!0,on:{click:function(){window.__data&&window.__data.doShowSlideCover&&window.__data.doShowSlideCover()}}})},autoplay:{delay:3e3,pauseOnMouseEnter:!0},on:{init:function(e){$(".pb-image-zoom-image").css("background-image","url("+$(e.slides[e.activeIndex]).attr("data-background-image")+")"),$(".pb-goods-images .small .swiper-slide").on("mouseover",function(){e.slideTo($(this).index())})},activeIndexChange:function(e){$(".pb-image-zoom-image").css("background-image","url("+$(e.slides[e.activeIndex]).attr("data-background-image")+")")}}}),window.MS.imageZoom("[data-goods-covers]",".pb-image-zoom-preview"),window.__goods3dImages&&0<window.__goods3dImages.length){const e=Tridi.create({element:".pb-3d-image-container .images",images:window.__goods3dImages,autoplay:!0,touch:!0,autoplaySpeed:200,stopAutoplayOnClick:!0,resumeAutoplayOnMouseleave:!0,resumeAutoplayDelay:3e3,spinner:!0});$(".pb-3d-image-container").on("click","[data-close]",function(){$(".pb-3d-image-container").hide()}),$(".pb-3d-images-btn").on("click",function(){$(".pb-3d-image-container").show(),e.load()}),$(".pb-3d-image-container .images").on("touchmove",function(e){return e.preventDefault(),!1})}});