import{d as U,k as X,s as T,r as c,E as J,h as K,i as Q,a as i,b as x,e as p,u as a,t as L,F as W,A as Y,f as v,L as y,w as Z,v as ee,o as u,X as te,z as oe,G as se,j as ne}from"./m2W8DxR4.js";import{_ as le}from"./D_lKd_s-.js";import{_ as ae,a as re}from"./XVpmYxmA.js";import{_ as ce}from"./CUZc3WDI.js";import{s as ie}from"./x_rD_Ya3.js";import"./ByXNX2C_.js";const ue={key:0,class:"gallery-wrapper"},de={key:0,class:"project-title"},_e={class:"gallery"},pe={class:"gallery-container ws-no-scrollbar"},ve=["onScroll","onMouseenter","onMouseleave"],me={key:0,class:"bg-surface-background hover:bg-surface-background/90 border-surface-border pointer-events-auto absolute bottom-2 left-1/2 z-10 -translate-x-1/2 transform animate-bounce cursor-pointer rounded-full border p-2 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl"},fe={class:"gallery-controls"},ge=["aria-label"],he=["aria-label"],be={key:1,class:"project-description"},xe={class:"line-clamp-2"},ye={key:1},we=U({__name:"StackedProductsCarousel",props:{projects:{}},setup(B){const{locale:w}=X(),o=B,N=T(()=>w.value==="ar"),s=c(0),E=c(!0),V=c(5e3);let h=null;const j=c(!1),k=c("next"),b=c({}),S=c({}),R=(e,t)=>{S.value[e]=t||null},d=e=>{var r;const t=((r=o.projects)==null?void 0:r.length)||0;return t===0?1:(e-s.value+t)%t+1},m=T(()=>{if(!o.projects||o.projects.length===0)return null;const e=o.projects.length;return o.projects.find((t,n)=>d(n)===3)??o.projects[s.value%e]}),D=()=>{o.projects&&o.projects.forEach(e=>{e.is_scroll&&(b.value[e.id]=!0)})},G=(e,t)=>{const n=t.target;n&&(b.value[e]=n.scrollTop===0)},M=()=>{var t;const e=((t=o.projects)==null?void 0:t.length)||0;e<5||(N.value?s.value=(s.value+1)%e:s.value=(s.value-1+e)%e)},A=()=>{var t;const e=((t=o.projects)==null?void 0:t.length)||0;e<5||(N.value?s.value=(s.value-1+e)%e:s.value=(s.value+1)%e)},z=()=>{var t;const e=((t=o.projects)==null?void 0:t.length)||0;!E.value||e<5||j.value||(I(),h=ie(()=>{k.value==="next"?A():M()},V.value))},I=()=>{h&&(clearInterval(h),h=null)},P=()=>{j.value=!0,I()},$=()=>{j.value=!1,z()};J(()=>s.value,()=>{se(()=>{var e;for(const[t,n]of Object.entries(S.value))if(n){n.scrollTop=0;const r=Number(t),f=(e=o.projects)==null?void 0:e.find(C=>C.id===r);f!=null&&f.is_scroll&&(b.value[r]=!0)}})});const O=()=>{k.value="prev",M()},F=()=>{k.value="next",A()};return K(()=>{z(),D()}),Q(()=>{I()}),(e,t)=>{const n=te,r=le,f=ae,C=re,q=ee,H=ce;return o.projects&&o.projects.length>=5?(u(),i("div",ue,[a(m)?(u(),i("h3",de,L(a(m).title),1)):x("",!0),p("div",_e,[p("div",pe,[(u(!0),i(W,null,Y(o.projects,(l,_)=>(u(),i("div",{key:l.id,ref_for:!0,ref:g=>R(l.id,g),class:y(["gallery-item ws-no-scrollbar overlay-gradient",`gallery-item-${d(_)}`,d(_)!==3?"overlay-visible":""]),onScroll:g=>l.is_scroll&&G(l.id,g),onMouseenter:g=>d(_)===3?P():null,onMouseleave:g=>d(_)===3?$():null},[v(n,{src:l.slider,alt:l.title,"data-index":_+1,class:y(["w-full",l.is_scroll?"":"h-full object-contain"]),width:946,format:"webp",quality:"85",loading:"lazy",decoding:"async",densities:"x1 x2",placeholder:[24,16,55,0],"placeholder-class":"img-pixel",sizes:"100vw sm:100vw md:85vw lg:80vw xl:946px"},null,8,["src","alt","data-index","class"]),d(_)===3&&l.is_scroll&&a(b)[l.id]?(u(),i("div",me,[v(r,{class:"text-foreground h-[20px] w-[20px]"})])):x("",!0)],42,ve))),128))]),p("div",fe,[p("button",{"aria-label":e.$t("ariaLabels.prevBtn"),class:"gallery-controls-previous",onMouseenter:P,onMouseleave:$,onClick:O},[v(f,{class:y(["h-5 w-5",a(w)==="en"?"scale-x-[-1]":""])},null,8,["class"])],40,ge),p("button",{"aria-label":e.$t("ariaLabels.nextBtn"),class:"gallery-controls-next",onMouseenter:P,onMouseleave:$,onClick:F},[v(C,{class:y(["h-5 w-5",a(w)==="en"?"scale-x-[-1]":""])},null,8,["class"])],40,he)])]),a(m)?(u(),i("div",be,[p("p",xe,L(a(m).short_description),1),v(q,{class:"ws-gradient-border mx-auto w-fit px-4 py-2",to:`/our-projects/${a(m).slug}`},{default:Z(()=>[oe(L(e.$t("projectsHighlight.know-more-button")),1)]),_:1},8,["to"])])):x("",!0)])):o.projects&&o.projects.length<5?(u(),i("div",ye,[v(H,{size:"100%","custom-message":e.$t("projectsCarousel.notEnoughProjects")},null,8,["custom-message"])])):x("",!0)}}}),Le=ne(we,[["__scopeId","data-v-30008e39"]]);export{Le as default};
