import{r as a,e as u,j as e}from"./app-BiexncSX.js";import{X as m}from"./x-Cp4MPESs.js";import{C as d}from"./chevron-left-CfTNJLZd.js";import{C as h}from"./chevron-right-D-bIFB2o.js";function y({images:r,open:o,setOpen:i,initialIndex:c=0}){const[l,n]=a.useState(c);if(a.useEffect(()=>{o&&n(c)},[o,c]),a.useEffect(()=>{if(!o)return;const t=s=>{s.key==="Escape"&&i(!1),s.key==="ArrowRight"&&f(),s.key==="ArrowLeft"&&x()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[o,l]),!o)return null;const x=()=>n(t=>(t-1+r.length)%r.length),f=()=>n(t=>(t+1)%r.length);return u.createPortal(e.jsxs("div",{className:"fixed inset-0 z-9999 bg-black/95 flex flex-col items-center justify-center",children:[e.jsx("button",{onClick:()=>i(!1),className:"absolute top-5 right-5 text-white ",children:e.jsx(m,{className:"w-8 h-8"})}),e.jsxs("div",{className:"relative w-full max-w-6xl h-[75vh] flex items-center justify-center px-4",children:[e.jsxs("button",{onClick:x,className:"absolute left-3 text-white",children:["        ",e.jsx(d,{size:40}),"      "]}),e.jsx("img",{src:r[l].url,alt:r[l].alt_text,className:"max-h-full max-w-full object-contain rounded-lg"}),e.jsxs("button",{onClick:f,className:"absolute right-3 text-white",children:["  ",e.jsx(h,{size:40}),"     "]})]}),e.jsx("div",{className:"flex gap-3 mt-6 overflow-x-auto overflow-y-hidden px-4",children:r.map((t,s)=>e.jsx("img",{src:t.url,onClick:()=>n(s),className:`h-16 w-24 object-contain rounded-md cursor-pointer transition
                        ${s===l?"scale-105 opacity-100":"opacity-50"}`},s))})]}),document.body)}export{y as F};
