import{e as W,f as q,q as I,c as d,a as t,t as y,g as r,n as B,K as A,F,s as G,h as m,v as k,C as p,o as f,H as M,_ as Z}from"./4E0AjYEK.js";const D={class:"product-carousel"},E={class:"product-carousel__left"},H={class:"product-carousel__title-wrapper"},j={class:"product-carousel__title"},J={class:"product-carousel__main"},O={class:"product-carousel__image-wrapper"},Q=["src","alt"],U={class:"product-carousel__thumbnails-wrapper"},X=["disabled"],Y=["onClick"],tt=["src","alt"],et=["disabled"],at={class:"product-carousel__right"},ot={class:"product-carousel__right-title"},rt={class:"product-carousel__right-content"},st=W({__name:"ProductCarousel",props:{items:{},introTitleKey:{},introContentKey:{}},setup(L){const c=L,{t:w}=q(),a=k(0),u=m(()=>c.items[a.value]),g=m(()=>{const o=u.value?.img;return Array.isArray(o)?o:[o]}),n=k(0);function $(){n.value<g.value.length-1&&n.value++}function P(){n.value>0&&n.value--}I(a,()=>{n.value=0});const h=k(null),z=m(()=>a.value>0),N=m(()=>a.value<c.items.length-1);function _(o,e="auto"){if(!h.value)return;const i=h.value.querySelectorAll(".product-carousel__thumb")[o];if(!i)return;const s=h.value,v=12,T=s.getBoundingClientRect(),K=i.getBoundingClientRect(),b=K.left-T.left+s.scrollLeft,C=K.right-T.left+s.scrollLeft;if(e==="left")s.scrollTo({left:b-v,behavior:"smooth"});else if(e==="right")s.scrollTo({left:C-s.clientWidth+v,behavior:"smooth"});else{const R=s.scrollLeft,V=R+s.clientWidth;b<R?s.scrollTo({left:b-v,behavior:"smooth"}):C>V&&s.scrollTo({left:C-s.clientWidth+v,behavior:"smooth"})}}function x(o){o==="left"&&a.value>0?(a.value--,p(()=>_(a.value,"left"))):o==="right"&&a.value<c.items.length-1&&(a.value++,p(()=>_(a.value,"right")))}function S(o){a.value=o,p(()=>_(o,"auto"))}return I(a,()=>{p(()=>_(a.value,"auto"))}),(o,e)=>(f(),d("div",D,[t("div",E,[t("div",H,[t("span",j,y(r(u)?.titleKey?r(w)(r(u).titleKey):""),1)]),t("div",J,[r(g).length>1?(f(),d("button",{key:0,class:"product-carousel__arrow product-carousel__arrow--left",onClick:P},[...e[2]||(e[2]=[t("span",{class:"product-carousel__arrow-icon"},"<",-1)])])):B("",!0),t("div",O,[t("img",{src:r(g)[r(n)]||"",alt:r(u)?.titleKey?r(w)(r(u).titleKey):"",class:"product-carousel__image",draggable:"false"},null,8,Q)]),r(g).length>1?(f(),d("button",{key:1,class:"product-carousel__arrow product-carousel__arrow--right",onClick:$},[...e[3]||(e[3]=[t("span",{class:"product-carousel__arrow-icon"},">",-1)])])):B("",!0)]),t("div",U,[t("button",{class:"product-carousel__thumb-arrow product-carousel__thumb-arrow--left",disabled:!r(z),onClick:e[0]||(e[0]=l=>x("left"))},[...e[4]||(e[4]=[A('<svg width="0.5rem" height="0.75rem" viewBox="0 0 8 11.8748036" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-v-4f5110a1><g id="0512" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" data-v-4f5110a1><g id="产品中心方案-曲轴" transform="translate(-280, -1334)" data-v-4f5110a1><g id="编组-21" transform="translate(260, 658)" data-v-4f5110a1><g id="编组-19" transform="translate(0, 628)" data-v-4f5110a1><g id="编组-5" transform="translate(0, 30)" data-v-4f5110a1><g id="up" transform="translate(24, 24) rotate(-270) translate(-24, -24)translate(16, 16)" data-v-4f5110a1><rect id="矩形" opacity="0" fill-rule="nonzero" x="0" y="0" width="16" height="16" data-v-4f5110a1></rect><path id="路径" d="M13.7501979,4 L12.5783229,4 C12.4986354,4 12.4236354,4.0390625 12.3767604,4.103125 L7.9376979,10.221875 L3.4986354,4.103125 C3.4517604,4.0390625 3.3767604,4 3.2970729,4 L2.1251979,4 C2.0236354,4 1.9642604,4.115625 2.0236354,4.1984375 L7.5330104,11.79375 C7.7330104,12.06875 8.1423854,12.06875 8.3408229,11.79375 L13.8501979,4.1984375 C13.9111354,4.115625 13.8517604,4 13.7501979,4 Z" fill="#000000" data-v-4f5110a1></path></g></g></g></g></g></g></svg>',1)])],8,X),t("div",{ref_key:"thumbContainerRef",ref:h,class:"product-carousel__thumbnails"},[(f(!0),d(F,null,G(L.items,(l,i)=>(f(),d("div",{key:i,class:M(["product-carousel__thumb",{"product-carousel__thumb--active":r(a)===i}]),onClick:s=>S(i)},[t("img",{src:Array.isArray(l.img)?l.img[0]:l.img,alt:r(w)(l.titleKey),class:"product-carousel__thumb-img",draggable:"false"},null,8,tt)],10,Y))),128))],512),t("button",{class:"product-carousel__thumb-arrow product-carousel__thumb-arrow--right",disabled:!r(N),onClick:e[1]||(e[1]=l=>x("right"))},[...e[5]||(e[5]=[A('<svg width="0.5rem" height="0.75rem" viewBox="0 0 8 11.8748036" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-v-4f5110a1><g id="0512" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" data-v-4f5110a1><g id="产品中心方案-曲轴" transform="translate(-1058, -1334.1252)" data-v-4f5110a1><g id="编组-21" transform="translate(260, 658)" data-v-4f5110a1><g id="编组-19" transform="translate(0, 628)" data-v-4f5110a1><g id="编组-8" transform="translate(778, 30)" data-v-4f5110a1><g id="up" transform="translate(24, 24) rotate(-90) translate(-24, -24)translate(16, 16)" data-v-4f5110a1><rect id="矩形" opacity="0" fill-rule="nonzero" x="0" y="0" width="16" height="16" data-v-4f5110a1></rect><path id="路径" d="M13.7501979,4 L12.5783229,4 C12.4986354,4 12.4236354,4.0390625 12.3767604,4.103125 L7.9376979,10.221875 L3.4986354,4.103125 C3.4517604,4.0390625 3.3767604,4 3.2970729,4 L2.1251979,4 C2.0236354,4 1.9642604,4.115625 2.0236354,4.1984375 L7.5330104,11.79375 C7.7330104,12.06875 8.1423854,12.06875 8.3408229,11.79375 L13.8501979,4.1984375 C13.9111354,4.115625 13.8517604,4 13.7501979,4 Z" fill="#000000" data-v-4f5110a1></path></g></g></g></g></g></g></svg>',1)])],8,et)])]),t("div",at,[t("div",ot,y(o.$t(c.introTitleKey)),1),t("div",rt,y(o.$t(c.introContentKey)),1)])]))}}),nt=Z(st,[["__scopeId","data-v-4f5110a1"]]);export{nt as default};
