1import{c as A,r as m,N as $,f as P,j as e,b as L,L as z,g as F,h as T,X as R,C as G,M as O,i as U,A as Y}from"./index-cP4L_Hak.js";import{C as W}from"./calendar-C24ahGNO.js";const H=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],B=A("tag",H),V=()=>{const{allEvents:p}=m.useContext($),[f]=P(),[l,D]=m.useState(()=>{const t=f.get("date");if(/^\d{4}-\d{2}-\d{2}$/.test(t||"")){const[a,s,r]=t.split("-").map(Number),d=new Date(a,s-1,r);if(!Number.isNaN(d.getTime()))return d}return new Date}),[n,x]=m.useState(null),[h,w]=m.useState([]);m.useEffect(()=>{let t=!0;return(async()=>{const s=l.getFullYear(),r=l.getMonth(),d=`${s}-${String(r+1).padStart(2,"0")}-01`,o=new Date(s,r+1,0).getDate(),i=`${s}-${String(r+1).padStart(2,"0")}-${String(o).padStart(2,"0")}`;try{const c=await U.get(`${Y.base_url}calendar-events`,{params:{from:d,to:i}});t&&c.data.success&&w((c.data.events||[]).map(g=>({...g,start_date:String(g.start_date).slice(0,10),end_date:g.end_date?String(g.end_date).slice(0,10):null,source:"calendar"})))}catch(c){console.error("Unable to load managed calendar events:",c),t&&w([])}})(),()=>{t=!1}},[l]),m.useEffect(()=>{const t=f.get("event");if(!t)return;const a=h.find(s=>String(s.id)===String(t));a&&x(a)},[h,f]);const u=[{id:1,title:"UG/PG Admissions",date:new Date(2026,0,2),time:"10:00 AM",type:"admissions",description:"Reporting & Registration of new PG/Ph.D/UG students in the 2nd Semester ",venue:"Admin Block"},{id:2,title:"Induction / Orientation",date:new Date(2026,0,7),time:"9:00 AM",type:"admissions",description:"Induction / Orientation of new PG/Ph.D/UG students.",venue:"Various Seminar Halls"},{id:3,title:"UG/PG Admissions",date:new Date(2026,0,9),time:"10:00 AM",type:"admissions",description:"Last date of Late registration (for new PG/Ph.D/UG students)",venue:"Admin Block"},{id:4,title:"Lohri Celebration",date:new Date(2026,0,13),time:"6:00 PM",type:"cultural",description:"Lohri Celebration with sweets and bonfire",venue:"Near Annapurna Mess"},{id:5,title:"Republic Day",date:new Date(2026,0,26),time:"9:30 AM",type:"holiday",description:"IIT Ropar will celebrate Republic day on 26th January from 9:30 onwards",venue:"Near Admin Block"},{id:6,title:"AI Workshop",date:new Date(2025,10,22),time:"2:00 PM",type:"workshop",description:"Hands-on workshop on Machine Learning and AI fundamentals.",venue:"Computer Lab 3"},{id:7,title:"Independence Day",date:new Date(2025,11,16),type:"holiday",description:"National Holiday - Independence Day of Bangladesh"},{id:8,title:"Research Conference",date:new Date(2025,11,5),time:"9:00 AM",type:"conference",description:"International conference on emerging technologies and research methodologies.",venue:"Seminar Hall"}];for(let t=0;t<p.length;t++)p[t].source!=="calendar"&&u.push({...p[t],source:"news"});for(let t=0;t<h.length;t++)u.push(h[t]);const b={convocation:{bg:"#8b5cf6",text:"#fff"},exam:{bg:"#ef4444",text:"#fff"},academic:{bg:"#0f766e",text:"#fff"},academics:{bg:"#0f766e",text:"#fff"},technical:{bg:"#3b82f6",text:"#fff"},alumni:{bg:"#10b981",text:"#fff"},cultural:{bg:"#f59e0b",text:"#fff"},workshop:{bg:"#06b6d4",text:"#fff"},holiday:{bg:"#ec4899",text:"#fff"},restricted_holiday:{bg:"#4869ecff",text:"#f8f3f3ff"},conference:{bg:"#787aedff",text:"#fff"},admissions:{bg:"#97a149ff",text:"#f8f3f3ff"},seminar:{bg:"#7c3aed",text:"#fff"},other:{bg:"#64748b",text:"#fff"},event:{bg:"#3b82f6",text:"#fff"}},k=t=>{const a=t.getFullYear(),s=t.getMonth(),r=new Date(a,s,1),o=new Date(a,s+1,0).getDate(),i=r.getDay();return{daysInMonth:o,startingDayOfWeek:i}},_=t=>u.filter(a=>{if(a.date instanceof Date)return a.date.getDate()===t&&a.date.getMonth()===l.getMonth()&&a.date.getFullYear()===l.getFullYear();if(a.event_date){const s=new Date(a.event_date);return s.getDate()===t&&s.getMonth()===l.getMonth()&&s.getFullYear()===l.getFullYear()}if(a.start_date){const s=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,"0")}-${String(t).padStart(2,"0")}`,r=a.end_date||a.start_date;return s>=a.start_date&&s<=r}return!1}),j=t=>{D(new Date(l.getFullYear(),l.getMonth()+t,1)),x(null)},{daysInMonth:C,startingDayOfWeek:N}=k(l),S=["January","February","March","April","May","June","July","August","September","October","November","December"],M=(t,a)=>t?t.length>a?t.slice(0,a)+"...":t:"",y=t=>t.category||t.event_type||t.eventType||t.type||"event",v=t=>b[y(t)]||b.event,I=t=>{if(t.date instanceof Date)return t.date.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"});if(t.event_date)return new Date(t.event_date).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"});if(t.start_date){const a=r=>{const[d,o,i]=r.split("-").map(Number);return new Date(d,o-1,i).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})},s=a(t.start_date);return t.end_date&&t.end_date!==t.start_date?`${s} â ${a(t.end_date)}`:s}return"Date not available"},E=()=>{const t=[],a=[];for(let s=0;s<N;s++)a.push(e.jsx("div",{className:"calendar-blank-day min-h-[110px] bg-transparent"},`blank-${s}`));for(let s=1;s<=C;s++){const r=_(s),d=(N+s-1)%7,o=d===0||d===6;t.push(e.jsxs("div",{className:["calendar-day min-h-[110px] border border-gray-200 p-2.5 transition duration-200",o?"bg-red-50/70":"bg-white",r.length>0?"cursor-pointer hover:-translate-y-0.5 hover:shadow-sm":"",r.length>0&&o?"hover:bg-red-100/70":"",r.length>0&&!o?"hover:bg-slate-50":""].join(" "),children:[e.jsx("div",{className:`calendar-day-number mb-1 text-sm font-semibold ${o?"text-red-600":"text-slate-700"}`,children:s}),e.jsxs("div",{className:"flex flex-col gap-1",children:[r.slice(0,3).map(i=>{const c=v(i);return e.jsxs("div",{onClick:()=>x(i),className:"cursor-pointer rounded-md px-1.5 py-1 text-[10px] leading-tight shadow-sm",style:{backgroundColor:c.bg,color:c.text,overflow:"hidden",
1wordWrap:"break-word",whiteSpace:"normal"},children:[(i.time||i.start_time)&&e.jsx("span",{className:"block font-bold",children:i.time||i.start_time}),M(i.title,38)]},`${i.source||"static"}-${i.news_id||i.id}`)}),r.length>3&&e.jsxs("div",{className:"calendar-more-events px-1.5 py-0.5 text-[10px] font-semibold text-slate-500",children:["+",r.length-3," more"]})]})]},s))}return[...a,...t]};return e.jsxs("div",{className:"institute-calendar-page bg-slate-50",children:[e.jsxs("section",{className:"relative overflow-hidden",style:{backgroundImage:`linear-gradient(rgba(4, 18, 32, 0.62), rgba(11, 81, 142, 0.68)), url(${L})`,backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"cover"},children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_right,rgba(240,165,0,0.24),transparent_28%),radial-gradient(circle_at_bottom_left,rgba(255,255,255,0.12),transparent_22%)]"}),e.jsx("div",{className:"relative mx-auto max-w-7xl px-4 py-20 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2 text-sm font-medium text-white/80",children:[e.jsx(z,{to:"/",className:"transition hover:text-[#f0a500]",children:"Home"}),e.jsx("span",{className:"text-white/50",children:">"}),e.jsx("span",{className:"text-white",children:"Institute Calendar"})]}),e.jsx("h1",{className:"text-4xl font-bold tracking-tight text-white sm:text-5xl",children:"Institute Calendar"}),e.jsx("p",{className:"mt-4 max-w-2xl text-sm leading-7 text-white/85 sm:text-base",children:"Explore upcoming academic, cultural, and institute-wide events at IIT Ropar. Stay informed about important dates, celebrations, and activities happening on campus."})]})})]}),e.jsxs("section",{className:"mx-auto max-w-7xl px-4 py-10 sm:px-6 lg:px-8 lg:py-14",children:[e.jsxs("div",{className:"calendar-shell overflow-hidden rounded-[28px] border border-slate-200 bg-white shadow-[0_20px_60px_rgba(15,23,42,0.08)]",children:[e.jsx("div",{className:"calendar-toolbar bg-[linear-gradient(135deg,#0b518e_0%,#083c6a_55%,#0f766e_100%)] px-5 py-6 text-white sm:px-8",children:e.jsxs("div",{className:"flex flex-col gap-5 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 sm:justify-start",children:[e.jsx("button",{onClick:()=>j(-1),className:"flex h-11 w-11 items-center justify-center rounded-full border border-white/20 bg-white/10 text-white transition hover:bg-white/20","aria-label":"Previous month",children:e.jsx(F,{size:20})}),e.jsxs("div",{className:"text-center sm:min-w-[260px] sm:text-left",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.3em] text-white/70",children:"Current View"}),e.jsxs("h2",{className:"mt-1 text-2xl font-bold sm:text-3xl",children:[S[l.getMonth()]," ",l.getFullYear()]})]}),e.jsx("button",{onClick:()=>j(1),className:"flex h-11 w-11 items-center justify-center rounded-full border border-white/20 bg-white/10 text-white transition hover:bg-white/20","aria-label":"Next month",children:e.jsx(T,{size:20})})]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:Object.entries(b).map(([t,a])=>e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-white/15 bg-white/10 px-3 py-2 text-xs font-medium text-white/90 backdrop-blur-sm",children:[e.jsx("span",{className:"h-3 w-3 rounded-full ring-2 ring-white/20",style:{backgroundColor:a.bg}}),e.jsx("span",{className:"capitalize",children:t})]},t))})]})}),e.jsx("div",{className:"p-3 sm:p-5 lg:p-6",children:e.jsxs("div",{className:"calendar-grid overflow-hidden rounded-[24px] border border-slate-200 bg-slate-50",children:[e.jsx("div",{className:"calendar-weekdays grid grid-cols-7 border-b border-slate-200 bg-white",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(t=>e.jsx("div",{className:"calendar-weekday px-2 py-3 text-center text-xs font-bold uppercase tracking-[0.2em] text-slate-500 sm:px-4 sm:text-sm",children:t},t))}),e.jsx("div",{className:"grid grid-cols-7 gap-0",children:E()})]})})]}),n&&e.jsx("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center bg-slate-950/60 p-4 backdrop-blur-sm",onClick:()=>x(null),children:e.jsxs("div",{className:"calendar-event-modal max-h-[90vh] w-full max-w-2xl overflow-hidden rounded-[28px] bg-white shadow-[0_24px_80px_rgba(15,23,42,0.35)]",onClick:t=>t.stopPropagation(),children:[e.jsx("div",{className:"px-6 py-6 text-white sm:px-8",style:{background:`linear-gradient(135deg, ${v(n).bg} 0%, #0b518e 100%)`,color:v(n).text},children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.28em] text-white/80",children:y(n)}),e.jsx("h3",{className:"text-2xl font-bold leading-tight sm:text-3xl",children:n.title})]}),e.jsx("button",{onClick:()=>x(null),className:"flex h-10 w-10 items-center justify-center rounded-full border border-white/20 bg-white/10 text-white transition hover:bg-white/20","aria-label":"Close event details",children:e.jsx(R,{size:20})})]})}),e.jsxs("div",{className:"calendar-modal-content space-y-5 px-6 py-6 sm:px-8",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx("div",{className:"calendar-event-detail rounded-2xl border border-slate-200 bg-slate-50 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"rounded-xl bg-[#0b518e]/10 p-2 text-[#0b518e]",children:e.jsx(W,{size:18})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-slate-500",children:"Date"}),e.jsx("p",{className:"mt-1 text-sm font-semibold leading-6 text-slate-800",children:I(n)})]})]})}),(n.time||n.event_time||n.start_time)&&e.jsx("div",{className:"calendar-event-detail rounded-2xl border border-slate-200 bg-slate-50 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"rounded-xl bg-[#f0a500]/10 p-2 text-[#f0a500]",children:e.jsx(G,{size:18})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-slate-500",children:"Time"}),e.jsx("p",{className:"mt-1 text-sm font-semibold text-slate-800",children:n.time||n.event_time||n.start_time})]})]})}),e.jsx("div",{className:"calendar-event-detail rounded-2xl border border-slate-200 bg-slate-50 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-2 text-emerald-600",children:e.jsx(O,{size:18})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-slate-500",children:"Venue"}),e.jsx("p",{className:"mt-1 text-sm font-semibold text-slate-800",children:n.venue||n.event_location||"IIT Ropar"})]})]})}),(n?.category||n?.event_type||n?.eventType||n?.type)&&e.jsx("div",{className:"calendar-event-detail rounded-2xl border border-slate-200 bg-slate-50 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"rounded-xl bg-violet-500/10 p-2 text-violet-600",children:e.jsx(B,{size:18})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.2em] text-slate-500",children:"Category"}),e.jsx("p",{className:"mt-1 text-sm font-semibold capitalize text-slate-800",children:y(n)})]})]})})]}),e.jsxs("div",{className:"calendar-event-description rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-slate-500",children:"Description"}),e.jsx("p",{className:"mt-3 max-h-[180px] overflow-y-auto pr-1 text-sm leading-7 text-slate-700",children:(()=>{const t=n.description||n.event_description||"",a=t.split(" ");return a.length>25?a.slice(0,70).join(" ")+"...":t})()})]})]})]})})]})]})};export{V as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.