import{j as e,L as C,a as I,r as o,s as m,b as w}from"./index-nY9tUGNj.js";import{F as S}from"./index-BN0z_J3y.js";import{C as k,G as g,a as E,b as N,Z as A,D,I as l,c as F,A as z,d as G}from"./ZoomIn-CBRUWvdG.js";import{m as c}from"./proxy-BuGY5lsQ.js";import{B as R}from"./Box-Cn42_dj1.js";import"./iconBase-B7xKm6cd.js";import"./clsx-B-dksMZM.js";import"./Transition-C9llJ9-M.js";import"./objectWithoutPropertiesLoose-Cv5OCJ0e.js";const $=()=>e.jsx("div",{className:"events",children:e.jsx("div",{className:"breadcrumb-wrapper",children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"page-heading text-center",children:[e.jsx("h2",{children:"நிகழ்வுகள்"}),e.jsx("div",{children:e.jsxs("p",{children:[" ",e.jsx(C,{to:"/",children:"முகப்பு "}),e.jsxs("span",{children:[" ",e.jsx(S,{})," "]})," நிகழ்வுகள் "]})})]})})})}),B=()=>{var x;const[j,d]=o.useState(!1),[a,i]=o.useState(0),[u,h]=o.useState(null),[s,y]=o.useState([]);o.useEffect(()=>{(async()=>{try{console.log("Fetching gallery data...");const r=(await w.get("galleries")).data;Array.isArray(r)?y(r):console.error("Unexpected API response format:",r)}catch(t){console.error("Error fetching gallery data:",t)}})()},[]);const f=n=>{i(n),d(!0)},p=()=>d(!1),v=()=>i((a+s.length-1)%s.length);console.log(s),console.log(a);const b=()=>i((a+1)%s.length);return e.jsxs(k,{className:"mt-4 mb-4",children:[e.jsx(g,{container:!0,spacing:3,className:"justify-content-center",children:s.length>0?s.map((n,t)=>e.jsx(g,{item:!0,xs:6,sm:6,md:4,children:e.jsx(c.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:t*.1},onMouseEnter:()=>h(t),onMouseLeave:()=>h(null),style:{position:"relative",cursor:"pointer"},children:e.jsxs(E,{onClick:()=>f(t),children:[e.jsx(N,{component:"img",height:"300",image:`${m}/${n.image_path}`,alt:`Gallery ${t+1}`,loading:"lazy"}),u===t&&e.jsx(c.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(5px)",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"4px"},children:e.jsx(A,{sx:{fontSize:50,color:"white"}})})]})})},t)):e.jsx("div",{className:"no-testimonials",children:e.jsx("p",{children:"No images available"})})}),e.jsx(D,{fullScreen:!0,open:j,onClose:p,children:e.jsxs(R,{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",position:"relative",bgcolor:"black",children:[e.jsx(l,{onClick:p,sx:{position:"absolute",top:20,right:20,color:"white"},children:e.jsx(F,{sx:{fontSize:30}})}),e.jsx(l,{onClick:v,sx:{position:"absolute",left:20,color:"white"},children:e.jsx(z,{sx:{fontSize:40}})}),e.jsx(c.img,{src:`${m}/${(x=s[a])==null?void 0:x.image_path}`,alt:"Lightbox",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.5,ease:"easeOut"},style:{maxWidth:"100%",maxHeight:"90vh",objectFit:"contain",borderRadius:"8px"}},a),e.jsx(l,{onClick:b,sx:{position:"absolute",right:20,color:"white"},children:e.jsx(G,{sx:{fontSize:40}})})]})})]})},L=I.memo(B),J=()=>e.jsxs("div",{children:[e.jsx($,{}),e.jsx(L,{})]});export{J as default};
