import{o as e,r as t,t as n}from"./jsx-runtime-BbTa8W_M-1776590214964.js";import{t as r}from"./chevron-left-BPh9np_P-1776590214964.js";import{t as i}from"./chevron-right-CQG1mCkM-1776590214964.js";import{t as a}from"./ProductCard-cuRTv_LB-1776590214964.js";var o=e(t(),1),s=n();function c({title:e,icon:t,products:n}){if(!n||n.length===0)return null;let c=(0,o.useRef)(null),[l,u]=(0,o.useState)(!1),[d,f]=(0,o.useState)(!1),p=()=>{if(c.current){let{scrollLeft:e,scrollWidth:t,clientWidth:n}=c.current;u(e>0),f(Math.ceil(e+n)<t-2)}};(0,o.useEffect)(()=>(p(),window.addEventListener(`resize`,p),()=>window.removeEventListener(`resize`,p)),[n]);let m=e=>{if(c.current){let t=window.innerWidth<768?200:450;c.current.scrollBy({left:e===`left`?-t:t,behavior:`smooth`})}};return(0,s.jsxs)(`div`,{className:`mb-12 w-full overflow-hidden relative group`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-3 mb-6`,children:[t&&(0,s.jsx)(`div`,{className:`p-2 bg-primary/10 rounded-lg text-primary shrink-0`,children:(0,s.jsx)(t,{className:`w-6 h-6`})}),(0,s.jsx)(`h2`,{className:`text-xl md:text-2xl font-bold tracking-tight text-foreground`,children:e})]}),(0,s.jsxs)(`div`,{className:`relative`,children:[l&&(0,s.jsx)(`button`,{onClick:()=>m(`left`),className:`absolute -left-2 sm:-left-4 top-1/2 -translate-y-1/2 z-30 w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-card border shadow-xl flex items-center justify-center hover:bg-muted transition-all text-primary`,"aria-label":`Scroll left`,children:(0,s.jsx)(r,{className:`w-6 h-6`})}),(0,s.jsx)(`div`,{ref:c,onScroll:p,className:`flex overflow-x-auto no-scrollbar gap-4 sm:gap-6 pb-4 scroll-smooth snap-x sm:snap-none`,children:n.map(e=>(0,s.jsx)(`div`,{className:`w-[160px] sm:w-[220px] md:w-[250px] shrink-0 snap-start`,children:(0,s.jsx)(a,{product:e})},e.id))}),d&&(0,s.jsx)(`button`,{onClick:()=>m(`right`),className:`absolute -right-2 sm:-right-4 top-1/2 -translate-y-1/2 z-30 w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-card border shadow-xl flex items-center justify-center hover:bg-muted transition-all text-primary`,"aria-label":`Scroll right`,children:(0,s.jsx)(i,{className:`w-6 h-6`})})]})]})}export{c as default};