import{o as e,r as t,t as n}from"./jsx-runtime-BbTa8W_M-1776590214964.js";import{r}from"./app-CXDQ5oEH-1776590214964.js";import{t as i}from"./useTranslation-D1etqd9u-1776590214964.js";import{t as a}from"./chevron-left-BPh9np_P-1776590214964.js";import{t as o}from"./chevron-right-CQG1mCkM-1776590214964.js";import{t as s}from"./layout-grid-DztuFZtQ-1776590214964.js";import{t as c}from"./button-WiAFyHfP-1776590214964.js";import{t as l}from"./card-Cby8flFO-1776590214964.js";import{t as u}from"./CategoryModal-SlbMTIwJ-1776590214964.js";var d=e(t(),1),f=n();function p({dbCategories:e,banners:t}){let{t:n}=i(),[p,m]=(0,d.useState)(0),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(null),y=(0,d.useCallback)(()=>{m(e=>(e+1)%t.length)},[t.length]),b=()=>{m(e=>(e-1+t.length)%t.length)};(0,d.useEffect)(()=>{if(t.length<=1)return;let e=setInterval(y,5e3);return()=>clearInterval(e)},[t.length,y]);let x=(e=null)=>{v(e),g(!0)};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u,{isOpen:h,onClose:()=>g(!1),categories:e,initialCategoryId:_}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-4 gap-4 mb-8`,children:[(0,f.jsxs)(l,{className:`hidden lg:block border-none shadow-sm h-[380px] overflow-hidden bg-card relative`,children:[(0,f.jsx)(`div`,{className:`p-4 font-bold border-b bg-muted/10 text-foreground`,children:n(`Categories`)}),(0,f.jsx)(`div`,{className:`p-2 flex flex-col overflow-y-auto h-[320px] no-scrollbar pb-16`,children:e.map(e=>(0,f.jsxs)(`button`,{onClick:()=>x(e.id),className:`flex items-center justify-between w-full p-2.5 hover:bg-muted rounded-lg transition-colors text-sm text-left group outline-none`,children:[(0,f.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`p-1 w-8 h-8 rounded-md bg-muted/50 flex items-center justify-center overflow-hidden shrink-0`,children:e.image_path?(0,f.jsx)(`img`,{src:`/storage/${e.image_path}`,className:`w-5 h-5 object-contain grayscale opacity-80`,alt:e.name}):(0,f.jsx)(s,{className:`w-4 h-4 text-muted-foreground`})}),(0,f.jsx)(`span`,{className:`font-semibold text-foreground/80 group-hover:text-foreground line-clamp-1`,children:e.name})]}),(0,f.jsx)(o,{className:`w-4 h-4 shrink-0 text-muted-foreground opacity-50`})]},e.id))}),(0,f.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-24 bg-gradient-to-t from-card via-card/90 to-transparent flex items-end justify-center pb-4 pointer-events-none`,children:(0,f.jsxs)(c,{onClick:()=>x(),variant:`outline`,className:`rounded-full shadow-lg bg-background text-foreground font-bold px-6 pointer-events-auto border-border/50 hover:bg-muted hover:text-primary transition-all`,children:[n(`View all`),` `,(0,f.jsx)(o,{className:`w-4 h-4 ml-1`})]})})]}),(0,f.jsx)(`div`,{className:`lg:col-span-3 rounded-2xl shadow-lg h-[150px] sm:h-[280px] lg:h-[380px] relative overflow-hidden bg-muted group`,children:t.length>0?(0,f.jsxs)(f.Fragment,{children:[t.map((e,t)=>(0,f.jsx)(`div`,{className:`absolute inset-0 transition-opacity duration-1000 ease-in-out ${t===p?`opacity-100 z-10`:`opacity-0 z-0`}`,children:e.link?(0,f.jsx)(`a`,{href:e.link,className:`block w-full h-full`,children:(0,f.jsx)(`img`,{src:`/storage/${e.image_path}`,alt:e.title,className:`w-full h-full object-cover`})}):(0,f.jsx)(`img`,{src:`/storage/${e.image_path}`,alt:e.title,className:`w-full h-full object-cover`})},e.id)),t.length>1&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`button`,{onClick:b,className:`absolute left-4 top-1/2 -translate-y-1/2 z-20 w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-black/20 hover:bg-black/50 text-white flex items-center justify-center backdrop-blur-sm transition-all opacity-0 group-hover:opacity-100 outline-none`,children:(0,f.jsx)(a,{className:`w-5 h-5`})}),(0,f.jsx)(`button`,{onClick:y,className:`absolute right-4 top-1/2 -translate-y-1/2 z-20 w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-black/20 hover:bg-black/50 text-white flex items-center justify-center backdrop-blur-sm transition-all opacity-0 group-hover:opacity-100 outline-none`,children:(0,f.jsx)(o,{className:`w-5 h-5`})})]})]}):(0,f.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center bg-gradient-to-br from-primary via-primary/95 to-primary/80 text-primary-foreground p-4 sm:p-8 text-center relative overflow-hidden`,children:[(0,f.jsx)(`h2`,{className:`text-xl sm:text-3xl md:text-5xl font-extrabold mb-2 leading-tight relative z-10`,children:n(`Discover exceptional deals`)}),(0,f.jsx)(`p`,{className:`opacity-80 text-xs sm:text-sm md:text-lg max-w-lg relative z-10 font-medium`,children:n(`Shop our curated collections with global shipping.`)}),(0,f.jsx)(`div`,{className:`mt-4 sm:mt-8 relative z-10`,children:(0,f.jsx)(c,{size:`sm`,sm:`lg`,variant:`secondary`,className:`rounded-full px-6 font-bold`,asChild:!0,children:(0,f.jsx)(r,{href:`/`,children:n(`Start Shopping`)})})})]})})]})]})}export{p as default};