1import{br as q,bm as G,dd as J,p as Z,o as K,r as a,c1 as P,bn as N,de as H,j as e,ar as b,a2 as W,f as X,aU as ee,a as I,l as y,n as te,aI as se,aJ as re,e as ae,V as B,h as ne,U as le,w as oe,df as ie,dg as ce,v as O}from"./index-DXwXIAv0.js";import{P as de}from"./PublicOrDashboardShell-DdKaFG__.js";function me(s){return q(s,G(J(s),1))}const ue="Africa/Nairobi",h=(s,l)=>ie(s,ue,l),V={workshop:"bg-secondary/15 text-secondary",hackathon:"bg-primary/15 text-primary",pitch_day:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",bootcamp:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",networking:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400",demo_day:"bg-primary/15 text-primary",webinar:"bg-muted text-muted-foreground",conference:"bg-secondary/15 text-secondary",community:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",other:"bg-muted text-muted-foreground"},xe={workshop:"Workshop",hackathon:"Hackathon",pitch_day:"Pitch Day",bootcamp:"Bootcamp",networking:"Networking",demo_day:"Demo Day",webinar:"Webinar",conference:"Conference",community:"Community",other:"Event"},he={in_person:"In-person",virtual:"Virtual",hybrid:"Hybrid"},ge=[{key:"all",label:"All types"},{key:"workshop",label:"Workshops"},{key:"hackathon",label:"Hackathons"},{key:"pitch_day",label:"Pitch Days"},{key:"bootcamp",label:"Bootcamps"},{key:"networking",label:"Networking"},{key:"demo_day",label:"Demo Days"},{key:"webinar",label:"Webinars"},{key:"conference",label:"Conferences"},{key:"community",label:"Community"}],pe=[{key:"all",label:"Any format"},{key:"in_person",label:"In-person"},{key:"virtual",label:"Virtual"},{key:"hybrid",label:"Hybrid"}],fe=[{key:"all",label:"Anytime"},{key:"today",label:"Today"},{key:"week",label:"This week"},{key:"free",label:"Free only"}],be=s=>N(s)?"Today":me(s)?"Tomorrow":H(s,{weekStartsOn:1})?h(s,"EEEE"):h(s,"EEE d MMM"),ke=()=>{const{profile:s}=Z(),l=K(),[d,g]=a.useState([]),[o,w]=a.useState(!0),[m,v]=a.useState("all"),[u,_]=a.useState("all"),[c,E]=a.useState("all"),[C,T]=a.useState(null),[F,S]=a.useState(""),[i,U]=a.useState("upcoming");a.useEffect(()=>{w(!0),P({upcoming:i==="upcoming"}).then(t=>{g(t),w(!1)})},[i]);const x=F.trim().toLowerCase(),p=a.useMemo(()=>d.filter(t=>{if(m!=="all"&&t.event_type!==m||u!=="all"&&t.format!==u)return!1;const r=new Date(t.starts_at);return!(c==="today"&&!N(r)||c==="week"&&!H(r,{weekStartsOn:1})||c==="free"&&!t.is_free||x&&!`${t.title||""} ${t.short_description||""} ${t.description||""} ${t.city||""}`.toLowerCase().includes(x))}),[d,m,u,c,x]),A=a.useMemo(()=>[...d].filter(t=>i==="upcoming").sort((t,r)=>(r.registration_count??0)-(t.registration_count??0)).slice(0,3),[d,i]),z=async t=>{if(!s){l(`/events/${t.id}`);return}const r=s.email??s.contact_email??"";T(t.id);const{error:n}=await ce({eventId:t.id,userId:s.id,registrantName:s.full_name,registrantEmail:r,registrantPhone:s.phone||void 0});if(T(null),n){O.error(n.message);return}O.success(`Registered for "${t.title}"`,{description:"Check your email for confirmation."}),P({upcoming:i==="upcoming"}).then(j=>g(j))},L=t=>{const r=t.id,n=new Date(t.starts_at),j=new Date(t.ends_at),f=t.max_attendees,$=t.registration_count??0,M=f!==null&&$>=f,D=t.poster_url||"",R=t.meeting_link||"",Q=Math.round((j.getTime()-n.getTime())/6e4);return e.jsxs(se,{className:"group shadow-card hover:shadow-lg hover:-translate-y-0.5 transition-all overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"relative aspect-[16/9] bg-gradient-to-br from-primary/20 via-secondary/20 to-primary/30 cursor-pointer overflow-hidden",onClick:()=>l(`/events/${r}`),children:[D?e.jsx("img",{src:D,alt:t.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"}):e.jsx(I,{className:"h-12 w-12 text-primary/50 absolute inset-0 m-auto"}),e.jsxs("div",{className:"absolute top-3 left-3 bg-background/95 backdrop-blur-sm rounded-md px-2.5 py-1.5 text-center shadow-sm",children:[e.jsx("div",{className:"text-[10px] uppercase font-semibold text-primary leading-none",children:h(n,"MMM")}),e.jsx("div",{className:"text-xl font-bold leading-none mt-0.5",children:h(n,"d")})]}),e.jsxs("div",{className:"absolute top-3 right-3 flex gap-1.5",children:[e.jsx(b,{className:`${V[t.event_type]??V.other} border-0 text-xs shadow-sm`,children:xe[t.event_type]??"Event"}),t.is_free?e.jsx(b,{className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400 border-0 text-xs shadow-sm",children:"Free"}):null]})]}),e.jsxs(re,{className:"p-5 flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-2",children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[be(n)," · ",h(n,"h:mm a")]}),e.jsx("span",{className:"text-border",children:"â¢"}),e.jsxs("span",{children:[Q,"m"]})]}),e.jsx("h3",{className:"font-heading font-semibold text-base text-foreground line-clamp-2 cursor-pointer hover:text-primary transition-colors",onClick:()=>l(`/events/${r}`),children:t.title}),t.short_description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1.5 line-clamp-2",children:t.short_description}),e.jsxs("div",{className:"flex items-center gap-3 mt-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[t.format==="virtual"?e.jsx(B,{className:"h-3.5 w-3.5"}):e.jsx(ne,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"truncate",children:t.format==="virtual"?"Virtual":t.city||t.country||he[t.format]||"TBA"})]}),e.jsx("span",{className:"text-border",children:"â¢"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[$,f?`/${f}`:""]})]}),M&&e.jsx(b,{className:"bg-destructive/15 text-destructive border-0 text-[10px] ml-auto",children:"Full"})]}),e.jsxs("div",{className:"flex gap-2 mt-4 pt-4 border-t",children:[e.jsx(y,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>l(`/events/${r}`),children:"Details"}),!M&&e.jsx(y,{size:"sm",className:"flex-1",disabled:C===r,onClick:()=>z(t),children:C===r?e.jsx(oe,{className:"h-3.5 w-3.5 animate-spin"}):"Register"}),R&&N(n)&&e.jsx(y,{size:"sm",variant:"secondary",onClick:()=>window.open(R,"_blank"),children:e.jsx(B,{className:"h-3.5 w-3.5"})})]})]})]},r)},Y=e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary/10 via-secondary/10 to-primary/20 border border-border/50 p-6 md:p-10",children:[e.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-30 pointer-events-none"}),e.jsxs("div",{className:"relative max-w-3xl",children:[e.jsxs(b,{className:"bg-background/80 backdrop-blur text-primary border-0 mb-3",children:[e.jsx(W,{className:"h-3 w-3 mr-1.5"})," Founder events"]}),e.jsx("h1",{className:"font-heading text-3xl md:text-5xl font-bold text-foreground tracking-tight",children:"Where founders learn, connect, and ship."}),e.jsx("p",{className:"text-muted-foreground mt-3 md:text-lg max-w-2xl",children:"Workshops, hackathons, pitch days, and community meet-ups across the Nailab network."}),e.jsxs("div",{className:"relative mt-6 max-w-xl",children:[e.jsx(X,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"Search events, topics, citiesâ¦",value:F,onChange:t=>S(t.target.value),className:"w-full pl-11 pr-4 h-12 rounded-full border border-input bg-background/90 backdrop-blur text-sm shadow-sm focus:outline-none focus:ring-2 focus:ring-ring"})]})]})]}),i==="upcoming"&&A.length>0&&!o&&e.jsxs("section",{children:[e.jsx("div",{className:"flex items-end justify-between mb-4",children:e.jsxs("div",{children:[e.jsxs("h2",{className:"font-heading text-xl font-semibold flex items-center gap-2",children:[e.jsx(W,{className:"h-5 w-5 text-primary"})," Featured this week"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Most-popular upcoming events."})]})}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:A.map(L)})]}),e.jsx("section",{children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[e.jsxs("aside",{className:"lg:w-60 shrink-0 space-y-5",children:[e.jsx("div",{className:"inline-flex rounded-md border border-input bg-background p-1 w-full",children:["upcoming","past"].map(t=>e.jsx("button",{onClick:()=>U(t),className:`flex-1 px-3 py-1.5 text-sm font-medium rounded transition-colors ${i===t?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"}`,children:t==="upcoming"?"Upcoming":"Past"},t))}),e.jsx(k,{title:"When",options:fe,value:c,onChange:E}),e.jsx(k,{title:"Type",options:ge,value:m,onChange:v}),e.jsx(k,{title:"Format",options:pe,value:u,onChange:_})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:o?"Loading eventsâ¦":`${p.length} ${p.length===1?"event":"events"}`})}),o?e.jsx("div",{className:"grid sm:grid-cols-2 xl:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(t=>e.jsx(ee,{className:"h-72 rounded-xl"},t))}):p.length===0?e.jsxs("div",{className:"text-center py-20 border border-dashed rounded-xl",children:[e.jsx(I,{className:"h-12 w-12 text-muted-foreground
1/40 mx-auto mb-4"}),e.jsxs("h3",{className:"font-heading text-lg font-semibold text-foreground",children:["No ",i==="upcoming"?"upcoming":"past"," events"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:x||m!=="all"||u!=="all"||c!=="all"?"Try adjusting your search or filters.":"Check back soon for new events."}),(x||m!=="all"||u!=="all"||c!=="all")&&e.jsxs(y,{variant:"ghost",size:"sm",className:"mt-4",onClick:()=>{S(""),v("all"),_("all"),E("all")},children:["Clear filters ",e.jsx(te,{className:"h-3.5 w-3.5 ml-1.5"})]})]}):e.jsx("div",{className:"grid sm:grid-cols-2 xl:grid-cols-3 gap-4",children:p.map(L)})]})]})})]});return e.jsx(de,{children:Y})};function k({title:s,options:l,value:d,onChange:g}){return e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-2",children:s}),e.jsx("div",{className:"flex flex-wrap gap-1.5 lg:flex-col lg:items-stretch",children:l.map(o=>e.jsx("button",{onClick:()=>g(o.key),className:`text-left px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${d===o.key?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted hover:text-foreground"}`,children:o.label},o.key))})]})}export{ke 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.