1import{h as Ie,d as ne,e as de,u as je,r as c,s as n,j as e,B as oe,L as X,C as $e,f as Ee,J as Z,a as Le,l as Fe,k as Ue,X as De}from"./index-EuY_-FAY.js";import{D as We}from"./DashboardLayout-Gw2TxiBJ.js";import{E as Be}from"./EventSettingsContent-DjtkJf4y.js";import{A as Ye}from"./MentorApplicationsContent-Bm0qIoL7.js";import{B as b}from"./button-DwzNqib_.js";import{C as v,c as N,a as z,b as P,d as be}from"./card-CIFW0qNz.js";import{B as R}from"./badge-BiGl0epm.js";import{A as me,a as xe,b as pe}from"./avatar-DmtcMqZM.js";import{C as ze}from"./CompanyAssignmentCard-C38eVUwN.js";import{S as Qe}from"./square-pen-DgtJmqsG.js";import{M as Pe}from"./map-pin-CiJS0zpt.js";import{U as ee}from"./users-B7Eh8ycR.js";import{C as he}from"./calendar-TeXraZ6Q.js";import{T as Oe}from"./trending-up-DfxLE4nH.js";import{G as _e}from"./globe-DmqLM4zl.js";import{E as ce}from"./external-link-SoEG5yvx.js";import{L as Ce}from"./linkedin-CHWP1gWB.js";import{T as ke}from"./twitter-7bv0L9_e.js";import{f as qe}from"./index-h3IyJjLp.js";import{R as Ve}from"./rocket-D93ZlqmD.js";import{B as te}from"./building-2-AqdBhrS9.js";import{T as Ae}from"./target-Cm-J7PgS.js";import{A as Me}from"./Footer-DLYBYlrH.js";import{C as ie}from"./clock-C9pzXbgT.js";import{M as ge}from"./message-square-CX4ymtRO.js";import{p as Te}from"./parseISO-DmI85Ds7.js";import{S as Ge}from"./StartupMentoringContent-BM0TjvzA.js";import{T as He,a as Je,b as ve,c as Ne}from"./tabs-BkjaH3fl.js";import{b as Re}from"./ChatSystem-4zb8rVWu.js";import{M as we}from"./mail-BVVKtkzs.js";import{U as re}from"./user-plus-tyTYVH-R.js";import{B as ue,S as Ke}from"./search-BN9ssjqw.js";import{S as ye}from"./sparkles-CDimFECD.js";import{S as Xe}from"./send-CxotHqOi.js";import{S as Ze}from"./star-DLxjevVK.js";import{A as fe}from"./award-CK-g5_KF.js";import{H as es}from"./heart-t6FbOm2Z.js";import{M as ss}from"./message-circle-CRCqvEFj.js";import{S as ts,M as rs}from"./MediaGalleryContent-XJA4H3_o.js";import{N as as}from"./NetworkingContent-Bb1EhX8P.js";import{R as is}from"./ReviewsContent-BqM04mPl.js";import{I as ns}from"./input-CwLsOgdz.js";import{E as os}from"./EventFeedbackContent-YW07LZCC.js";import{u as ls}from"./useQuery-DeYV4IS5.js";import{u as cs}from"./useMutation-_L21eS81.js";import{F as ds}from"./FileUpload-D5YsiDk4.js";import{A as ms}from"./AskTheExpertContent-S-Z2KLkN.js";import"./list-checks-XjZkVVNc.js";import"./user-DuBvhp_O.js";import"./circle-user-C6EVL7I0.js";import"./shield-nL0KFzur.js";import"./layout-dashboard-a4gKtYLw.js";import"./index-wQwPqDfP.js";import"./index-BMKRCHpo.js";import"./index-BJKYc_OV.js";import"./index-DKmrCAge.js";import"./chevron-down-D0i5abe3.js";import"./chevron-right-R-JJXQF-.js";import"./settings-DbY5cOJ-.js";import"./users-round-B278ejjI.js";import"./presentation-1PlbYjJw.js";import"./clipboard-list-DnNVBJ_L.js";import"./handshake-ChAu9QXI.js";import"./eye-DWMmm-eV.js";import"./DashboardHeader-qK3Qmy-e.js";import"./index-BccXDNaF.js";import"./index-BSIHs9Yh.js";import"./index-C40cg7B2.js";import"./index-BONWbLIr.js";import"./index-BXTDk0Ug.js";import"./check-BFBMQrmy.js";import"./arrow-left-lIwOt_N5.js";import"./menu-QX_7UXmx.js";import"./NotificationCenter-DHgRHZeL.js";import"./index-BdQq_4o_.js";import"./plus-DP6EyEDe.js";import"./FeedbackButton-84GpwsHz.js";import"./dialog-BshpMbXa.js";import"./index-Byc0C5HR.js";import"./textarea-D6vuaKhs.js";import"./label-DHjRMKAW.js";import"./cityCoordinates-BF9Pw5Lr.js";import"./index-CCnnvLwg.js";import"./switch-C1fACMOm.js";import"./index-90AI2Mcq.js";import"./quill.snow-Dj63gIbu.js";import"./select-Zkugu-mn.js";import"./chevron-up-BGLh5JIr.js";import"./separator-CP7aABc2.js";import"./checkbox-D-yVHPM-.js";import"./command-CJk2AU3Y.js";import"./format-BJatCrh1.js";import"./popover-C1CUfueU.js";import"./CityCountryInput-DzjN59o-.js";import"./loader-circle-Caxve_ph.js";import"./chevrons-up-down-CWJDjV6L.js";import"./venueAddress-DVUbw9NQ.js";import"./filter-BX-yFJmx.js";import"./timezones-CsxV_3Uh.js";import"./image-rU_ppTuS.js";import"./list-DRGo6gHo.js";import"./save-B2VAfAIz.js";import"./index-DwFUDgNw.js";import"./index-Cb8UU1H3.js";import"./xlsx-DjuO7_Ju.js";import"./alert-dialog-Dzo3XCPR.js";import"./download-Gq_d9FhN.js";import"./circle-check-DZuRMJvy.js";import"./calendar-D4NNVj7-.js";import"./subDays-1Gd6-EPS.js";import"./isSameDay-D8qkwPfC.js";import"./chevron-left-nZrh3bY0.js";import"./tooltip-DhO4SW4a.js";import"./eachDayOfInterval-C6Nk_oxa.js";import"./differenceInMilliseconds-ycH2onZd.js";import"./mic-B2yxq-CM.js";import"./useInfiniteScroll-CcPzzG0i.js";import"./play-BEepO1Dv.js";import"./eye-off-Cp1ZERv1.js";import"./ellipsis-vertical-eBvHTnN9.js";import"./radio-group-C5oucH3a.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const xs=Ie("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const ps=Ie("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]),hs=()=>{const{user:i}=ne(),{eventSlug:h}=de(),x=je(),[m,p]=c.useState(null),[Q,l]=c.useState(null),[_,k]=c.useState(null),[a,$]=c.useState(null),[L,E]=c.useState(!0);c.useEffect(()=>{i&&G()},[i,h]);const G=async()=>{try{E(!0);const{data:q,error:F}=await n.from("profiles").select("id, name, email").eq("user_id",i==null?void 0:i.id).single();if(F)throw F;const j=h==null?void 0:h.replace(/-/g," ").replace(/\b\w/g,O=>O.toUpperCase()),{data:V,error:f}=await n.from("events").select("id").ilike("title",`%${j}%`).single();if(f)throw f;p(V.id);const{data:T,error:I}=await n.from("user_roles").select("id, company_id").eq("user_id",i==null?void 0:i.id).eq("event_id",V.id).eq("role","startup").single();if(I){console.error("Error fetching role:",I),E(!1);return}if(l(T.id),T!=null&&T.company_id){k(T.company_id);const{data:O,error:B}=await n.from("companies").select("*").eq("id",T.company_id).single();if(B)throw B;$({...O,profile_id:q.id})}E(!1)}catch(q){console.error("Error fetching startup profile:",q),E(!1)}},C=q=>q.split(" ").map(F=>F[0]).join("").toUpperCase().slice(0,2);return L?e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(oe,{size:48})}):_?a?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Startup Profile"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"View your startup details"})]}),e.jsxs(b,{onClick:()=>x(`/dashboard/company/${_}/edit`),className:"bg-primary hover:bg-primary-hover",children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"}),"Edit Profile"]})]}),e.jsx(v,{children:e.jsx(N,{className:"p-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Status:"}),e.jsx(R,{className:"ml-2",variant:a.status==="Live"?"default":"secondary",children:a.status})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Visibility:"}),e.jsx(R,{className:"ml-2",variant:"outline",children:a.visibility})]})]})})}),e.jsx(v,{children:e.jsx(N,{className:"p-6",children:e.jsxs("div",{className:"flex items-start gap-6",children:[e.jsxs(me,{className:"w-24 h-24",children:[e.jsx(xe,{src:a.logo,alt:a.name}),e.jsx(pe,{className:"text-2xl bg-gradient-to-br from-primary/20 to-primary/10 text-primary",children:C(a.name)})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:a.name}),a.tagline&&e.jsx("p",{className:"text-lg text-muted-foreground italic mb-4",children:a.tagline}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[(a.city||a.country)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Pe,{className:"w-4 h-4"}),a.city&&a.country?`${a.city}, ${a.country}`:a.city||a.country]}),a.team_size&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ee,{className:"w-4 h-4"}),a.team_size," team members"]}),a.founded_year&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(he,{className:"w-4 h-4"}),"Founded ",a.founded_year]}),a.funding_stage&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Oe,{className:"w-4 h-4"}),a.funding_stage]})]})]})]})})}),a.description&&e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(P,{children:"Description"})}),e.jsx(N,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:a.description})})]}),(a.problem||a.solution)&&e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[a.problem&&e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(P,{children:"Problem"})}),e.jsx(N,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:a.problem})})]}),a.solution&&e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(P,{children:"Solution"})}),e.jsx(N,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:a.solution})})]})]}),(a.target_market||a.business_model)&&e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[a.target_market&&e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(P,{children:"Target Market"})}),e.jsx(N,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:a.target_market})})]}),a.business_model&&e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(P,{children:"Business Model"})}),e.jsx(N,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:a.business_model})})]})]}),a.traction&&e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(P,{children:"Traction"})}),e.jsx(N,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:a.traction})})]}),(a.industry&&a.industry.length>0||a.technologies&&a.technologies.length>0)&&e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(P,{children:"Industries & Technologies"})}),e.jsxs(N,{className:"space-y-4",children:[a.industry&&a.industry.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Industries"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.industry.map((q,F)=>e.jsx(R,{variant:"secondary",children:q},F))})]}),a.technologies&&a.technologies.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Technologies"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.technologies.map((q,F)=>e.jsx(R,{variant:"outline",children:q},F))})]})]})]}),(a.website||a.linkedin||a.twitter||a.facebook||a.instagram)&&e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(P,{children:"Links"})}),e.jsx(N,{children:e.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.website&&e.jsx(b,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a.website,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(_e,{className:"w-4 h-4 mr-2"}),"Website",e.jsx(ce,{className:"w-3 h-3 ml-1"})]})}),a.linkedin&&e.jsx(b,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a.linkedin,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(Ce,{className:"w-4 h-4 mr-2"}),"LinkedIn",e.jsx(ce,{className:"w-3 h-3 ml-1"})]})}),a.twitter&&e.jsx(b,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a.twitter,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ke,{className:"w-4 h-4 mr-2"}),"Twitter",e.jsx(ce,{className:"w-3 h-3 ml-1"})]})}),a.facebook&&e.jsx(b,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a.facebook,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(xs,{className:"w-4 h-4 mr-2"}),"Facebook",e.jsx(ce,{className:"w-3 h-3 ml-1"})]})}),a.instagram&&e.jsx(b,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a.instagram,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ps,{className:"w-4 h-4 mr-2"}),"Instagram",e.jsx(ce,{className:"w-3 h-3 ml-1"})]})})]})})]})]}):e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"No startup profile found"})}):e.jsx(ze,{userId:(i==null?void 0:i.id)||"",eventId:m||"",roleId:Q||"",onCompanyAssigned:q=>{k(q),G()}})},us=({eventId:i,eventTitle:h})=>{const{user:x}=ne(),{eventSlug:m}=de(),[p,Q]=c.useState(null),[l,_]=c.useState([]),[k,a]=c.useState([]),[$,L]=c.useState(!0),[E,G]=c.useState("UTC"),C=c.useCallback(j=>{try{return qe(Te(j),E,"h:mm a")}catch{return qe(Te(j),"UTC","h:mm a")}},[E]);c.useEffect(()=>
11{i&&(x!=null&&x.id)&&q()},[i,x==null?void 0:x.id]);const q=async()=>{try{L(!0);const{data:j,error:V}=await n.from("events").select("timezone").eq("id",i).single();!V&&(j!=null&&j.timezone)&&G(j.timezone);const{data:f}=await n.from("profiles").select("id").eq("user_id",x==null?void 0:x.id).single();if(!f){console.error("No profile found for user");return}const{data:T}=await n.from("company_members").select(` 12 company_id, 13 companies!inner (id, name, tagline, description, logo, status) 14 `).eq("profile_id",f.id).eq("role","founder");if(T&&T.length>0){const H=T.map(t=>t.company_id),{data:W}=await n.from("event_startups").select("company_id").eq("event_id",i).eq("status","accepted").in("company_id",H).limit(1).maybeSingle();if(W){const t=T.find(d=>d.company_id===W.company_id);t!=null&&t.companies&&Q(t.companies)}}const{data:I}=await n.from("mentor_assignments").select("id, status, mentor_id").eq("event_id",i).eq("startup_id",x==null?void 0:x.id);if(I){const H=I.map(d=>d.mentor_id),{data:W}=await n.from("profiles").select("user_id, name").in("user_id",H),t=I.map(d=>{var u;return{...d,mentor_name:(u=W==null?void 0:W.find(o=>o.user_id===d.mentor_id))==null?void 0:u.name}});_(t)}const O=new Date,B=new Date(O);B.setHours(23,59,59,999);const{data:se}=await n.from("event_schedules").select("id, title, start_time, end_time, session_type").eq("event_id",i).gte("start_time",O.toISOString()).lte("start_time",B.toISOString()).order("start_time",{ascending:!0}).limit(3);se&&a(se)}catch(j){console.error("Error fetching data:",j)}finally{L(!1)}},F=j=>{switch(j==null?void 0:j.toLowerCase()){case"live":case"accepted":return"bg-green-100 text-green-800";
14case"pending":case"requested":return"bg-yellow-100 text-yellow-800";case"draft":return"bg-gray-100 text-gray-800";default:return"bg-blue-100 text-blue-800"}};return $?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(oe,{size:48})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-gradient-to-r from-green-50 to-blue-50 rounded-lg p-6 border border-green-100",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 bg-white rounded-lg shadow-sm",children:e.jsx(Ve,{className:"w-8 h-8 text-primary"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900",children:["Welcome to ",h]}),e.jsx("p",{className:"text-gray-600 mt-1",children:p?`Building ${p.name}`:"Your startup journey starts here"})]})]}),(p==null?void 0:p.status)&&e.jsx(R,{className:F(p.status),children:p.status})]})}),p&&e.jsxs(v,{children:[e.jsx(z,{children:e.jsxs(P,{className:"flex items-center gap-2",children:[e.jsx(te,{className:"w-5 h-5 text-primary"}),"Your Startup"]})}),e.jsx(N,{children:e.jsxs("div",{className:"flex items-start gap-4",children:[p.logo&&e.jsx("img",{src:p.logo,alt:p.name,className:"w-16 h-16 rounded-lg object-cover border border-gray-200"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:p.name}),p.tagline&&e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:p.tagline}),p.description&&e.jsx("p",{className:"text-sm text-gray-700 mt-2 line-clamp-2",children:p.description}),e.jsx("div",{className:"mt-4",children:e.jsx(b,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(X,{to:`/dashboard/${m}/startups/profile`,children:[e.jsx(Ae,{className:"w-4 h-4 mr-2"}),"Edit Profile"]})})})]})]})})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs(v,{children:[e.jsx(z,{children:e.jsxs(P,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"w-5 h-5 text-purple-600"}),"Mentoring"]}),e.jsx(b,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs(X,{to:`/dashboard/${m}/startups/mentoring`,children:["View All",e.jsx(Me,{className:"w-4 h-4 ml-2"})]})})]})}),e.jsx(N,{children:l.length===0?e.jsxs("div",{className:"text-center py-6",children:[e.jsx(ee,{className:"w-12 h-12 mx-auto text-gray-300 mb-3"}),e.jsx("p",{className:"text-gray-600 mb-3",children:"No mentor sessions yet"}),e.jsx(b,{size:"sm",asChild:!0,children:e.jsx(X,{to:`/dashboard/${m}/startups/mentoring`,children:"Request Mentors"})})]}):e.jsxs("div",{className:"space-y-3",children:[l.slice(0,3).map(j=>e.jsx("div",{className:"p-3 bg-gray-50 rounded-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-gray-900",children:j.mentor_name||"Mentor"}),e.jsxs("div",{className:"text-sm text-gray-600",children:["Session ",j.status]})]}),e.jsx(R,{className:F(j.status),children:j.status})]})},j.id)),l.length>3&&e.jsx(b,{variant:"outline",size:"sm",className:"w-full",asChild:!0,children:e.jsxs(X,{to:`/dashboard/${m}/startups/mentoring`,children:["View ",l.length-3," More"]})})]})})]}),e.jsxs(v,{children:[e.jsx(z,{children:e.jsxs(P,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"w-5 h-5 text-blue-600"}),"Today's Schedule"]}),e.jsx(b,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs(X,{to:`/dashboard/${m}/startups/schedule`,children:["Full Schedule",e.jsx(Me,{className:"w-4 h-4 ml-2"})]})})]})}),e.jsx(N,{children:k.length===0?e.jsxs("div",{className:"text-center py-6",children:[e.jsx(he,{className:"w-12 h-12 mx-auto text-gray-300 mb-3"}),e.jsx("p",{className:"text-gray-600",children:"No upcoming sessions today"})]}):e.jsx("div",{className:"space-y-3",children:k.map(j=>e.jsx("div",{className:"p-3 bg-gray-50 rounded-lg",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-gray-900",children:j.title}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 mt-1",children:[e.jsx(ie,{className:"w-3 h-3"}),C(j.start_time)," - ",C(j.end_time)]})]}),j.session_type&&e.jsx(R,{variant:"outline",className:"text-xs",children:j.session_type})]})},j.id))})})]})]}),e.jsxs(v,{children:[e.jsx(z,{children:e.jsxs(P,{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"w-5 h-5 text-primary"}),"Quick Actions"]})}),e.jsx(N,{children:e.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(b,{variant:"outline",className:"h-auto flex-col py-4",asChild:!0,children:e.jsxs(X,{to:`/dashboard/${m}/startups/mentoring`,children:[e.jsx(ee,{className:"w-5 h-5 mb-2"}),e.jsx("span",{children:"Find Mentors"})]})}),e.jsx(b,{variant:"outline",className:"h-auto flex-col py-4",asChild:!0,children:e.jsxs(X,{to:`/dashboard/${m}/startups/schedule`,children:[e.jsx(he,{className:"w-5 h-5 mb-2"}),e.jsx("span",{children:"View Schedule"})]})}),e.jsx(b,{variant:"outline",className:"h-auto flex-col py-4",asChild:!0,children:e.jsxs(X,{to:`/dashboard/${m}/startups/networking`,children:[e.jsx(ge,{className:"w-5 h-5 mb-2"}),e.jsx("span",{children:"Network"})]})}),e.jsx(b,{variant:"outline",className:"h-auto flex-col py-4",asChild:!0,children:e.jsxs(X,{to:`/dashboard/${m}/startups/profile`,children:[e.jsx(te,{className:"w-5 h-5 mb-2"}),e.jsx("span",{children:"Edit Profile"})]})})]})})]})]})},fs=({eventId:i})=>{const{user:h,profile:x}=ne(),m=je(),{eventSlug:p}=de(),[Q,l]=c.useState(!0),[_,k]=c.useState([]),[a,$]=c.useState([]),[L,E]=c.useState([]),[G,C]=c.useState([]),[q,F]=c.useState(""),[j,V]=c.useState("crew");c.useState(null),c.useState(""),c.useState(!1);const[f,T]=c.useState(null),[I,O]=c.useState(null),[B,se]=c.useState(null),H=c.useCallback(async()=>
14{if(h!=null&&h.id)try{const{data:s}=await n.from("events").select("max_crew_size").eq("id",i).single();s&&O(s.max_crew_size);const{data:r,error:M}=await n.from("user_roles").select("id, company_id").eq("user_id",h.id).eq("event_id",i).eq("role","startup").maybeSingle();if(M&&console.error("Error fetching user role:",M),se((r==null?void 0:r.id)||null),r!=null&&r.company_id){T(r.company_id);return}if(x!=null&&x.id){const{data:w,error:U}=await n.from("companies").select("id").eq("profile_id",x.id).eq("company_type","startup").limit(1).maybeSingle();if(U&&U.code!=="PGRST116")throw U;T((w==null?void 0:w.id)||null)}}catch(s){console.error("Error fetching startup:",s)}},[h==null?void 0:h.id,x==null?void 0:x.id,i]),W=c.useCallback(async()=>{if(f)try{const{data:s,error:r}=await n.from("startup_crew_members").select("id, user_id, role, joined_at").eq("event_id",i).eq("company_id",f).order("joined_at",{ascending:!1});if(r)throw r;const M=(s==null?void 0:s.map(w=>w.user_id))||[];if(M.length>0){const{data:w,error:U}=await n.from("profiles").select("user_id, name, email, avatar_url, bio, position, company").in("user_id",M);if(U)throw U;const D=s.map(A=>({...A,profile:(w==null?void 0:w.find(S=>S.user_id===A.user_id))||{name:"Unknown",email:"",avatar_url:null,bio:null,position:null,company:null}}));k(D)}else k([])}catch(s){console.error("Error fetching crew members:",s)}},[i,f]),t=c.useCallback(async()=>{if(f)try{const{data:s,error:r}=await n.from("company_members").select(` 15 profile:profile_id ( 16 name, 17 email, 18 avatar_url, 19 bio, 20 position, 21 company, 22 user_id 23 ) 24 `).eq("company_id",f);if(r)throw r;$(s||[])}
24catch(s){console.error("Error fetching team members:",s)}},[f]),d=c.useCallback(async()=>{if(f)try{const{data:s,error:r}=await n.from("startup_crew_requests").select("id, user_id, request_type, status, message, created_at").eq("event_id",i).eq("company_id",f).eq("status","pending").order("created_at",{ascending:!1});if(r)throw r;const M=(s==null?void 0:s.map(w=>w.user_id))||[];if(M.length>0){const{data:w,error:U}=await n.from("profiles").select("user_id, name, email, avatar_url, bio, position, company, main_badge, interests, linkedin, twitter, website").in("user_id",M);if(U)throw U;const D=s.map(A=>({...A,request_type:A.request_type,status:A.status,profile:(w==null?void 0:w.find(S=>S.user_id===A.user_id))||{name:"Unknown",email:"",avatar_url:null,bio:null,position:null,company:null}}));E(D),D.length>0&&V("requests")}else E([])}catch(s){console.error("Error fetching requests:",s)}},[i,f]),u=c.useCallback(async()=>{if(f)try{const{data:s,error:r}=await n.from("user_roles").select("user_id").eq("event_id",i).eq("role","attendee").eq("status","accepted");if(r)throw r;const M=(s==null?void 0:s.map(Y=>Y.user_id))||[],{data:w,error:U}=await n.from("startup_crew_members").select("user_id").eq("event_id",i);if(U)throw U;const D=(w==null?void 0:w.map(Y=>Y.user_id))||[],{data:A,error:S}=await n.from("startup_crew_requests").select("user_id").eq("event_id",i).eq("company_id",f).eq("status","pending");if(S)throw S;const K=(A==null?void 0:A.map(Y=>Y.user_id))||[],ae=M.filter(Y=>!D.includes(Y)&&!K.includes(Y));if(ae.length===0){C([]);return}const{data:Se,error:le}=await n.from("profiles").select("user_id, name, email, avatar_url, bio, position, company").in("user_id",ae);if(le)throw le;C((Se||[]).map(Y=>({user_id:Y.user_id,profile:Y})))}catch(s){console.error("Error fetching attendees:",s)}},[i,f]);c.useEffect(()=>{(async()=>{l(!0),await H(),l(!1)})()},[H]),c.useEffect(()=>{f&&(W(),t(),d(),u())},[f,W,t,d,u]);const o=async(s,r)=>{var M;if(f)try{if(I!==null){const{count:S}=await n.from("startup_crew_members").select("id",{count:"exact",head:!0}).eq("event_id",i).eq("company_id",f);if(S!==null&&S>=I){Z.error(`Maximum crew size of ${I} reached. Cannot accept more members.`);return}}const{data:w}=await n.from("startup_crew_members").select("company_id, companies:company_id(name)").eq("event_id",i).eq("user_id",r).maybeSingle();if(w){const S=((M=w.companies)==null?void 0:M.name)||"another startup";Z.error(`This user has already joined ${S}`),await n.from("startup_crew_requests").update({status:"rejected"}).eq("id",s),d();return}const{error:U}=await n.from("startup_crew_requests").update({status:"accepted"}).eq("id",s);if(U)throw U;const{error:D}=await n.from("startup_crew_members").insert({event_id:i,company_id:f,user_id:r});if(D)throw D;const{data:A}=await n.from("companies").select("name").eq("id",f).single();try{await n.functions.invoke("send-crew-request-email",{body:{type:"approved",eventId:i,companyId:f,attendeeUserId:r}})}catch(S){console.error("Error sending approval email:",S)}if(await n.from("notifications").insert({user_id:r,event_id:i,type:"success",title:"Request Accepted",message:`${(A==null?void 0:A.name)||"A startup"} accepted your request to join their crew`,action_url:`/dashboard/${i}/startups`}),I!==null){const{count:S}=await n.from("startup_crew_members").select("id",{count:"exact",head:!0}).eq("event_id",i).eq("company_id",f);if(S!==null&&S>=I){const{data:K}=await n.from("startup_crew_requests").select("id, user_id").eq("event_id",i).eq("company_id",f).eq("status","pending");if(K&&K.length>0){await n.from("startup_crew_requests").update({status:"rejected",message:"Maximum crew size reached"}).eq("event_id",i).eq("company_id",f).eq("status","pending");for(const ae of K)await n.from("notifications").insert({user_id:ae.user_id,event_id:i,type:"info",title:"Crew Request Update",message:`${(A==null?void 0:A.name)||"The startup"} has reached maximum crew size. Your request was automatically declined.`,action_url:`/dashboard/${i}/startups`});Z.info(`Maximum crew size reached. ${K.length} pending request(s) were automatically declined.`)}}}Z.success("Request accepted! Member added to crew."),d(),W(),u()}catch(w){console.error("Error accepting request:",w),Z.error(w.message||"Failed to accept request")}},g=async s=>{try{const{error:r}=await n.from("startup_crew_requests").update({status:"rejected"}).eq("id",s);if(r)throw r;Z.success("Request declined",{description:"The attendee can reapply later or explore other startup opportunities at this event.",duration:5e3}),d()}catch(r){console.error("Error rejecting request:",r),Z.error(r.message||"Failed to decline request")}},y=async s=>{try{const{error:r}=await n.from("startup_crew_members").delete().eq("id",s);if(r)throw r;Z.success("Crew member removed"),W(),u()}catch(r){console.error("Error removing member:",r),Z.error(r.message||"Failed to remove member")}};return G.filter(s=>{var r;return s.profile.name.toLowerCase().includes(q.toLowerCase())||s.profile.email.toLowerCase().includes(q.toLowerCase())||((r=s.profile.bio)==null?void 0:r.toLowerCase().includes(q.toLowerCase()))}
24),Q?e.jsx("div",{className:"flex items-center justify-center min-h-96",children:e.jsx(oe,{size:32})}):f?e.jsxs("div",{className:"space-y-4 sm:space-y-6 pb-6",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/10 via-primary/5 to-background border border-primary/20 p-4 sm:p-8",children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-primary/5 rounded-full blur-3xl"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 mb-3 sm:mb-4",children:[e.jsx("div",{className:"p-2 sm:p-3 bg-primary/10 rounded-lg sm:rounded-xl",children:e.jsx(ee,{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl sm:text-3xl font-bold text-foreground",children:"Founders' Crew"}),e.jsx("p",{className:"text-xs sm:text-base text-muted-foreground mt-0.5 sm:mt-1",children:"Build your dream team for this event"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 sm:gap-4 mt-4 sm:mt-6",children:[e.jsx(v,{className:"bg-background/50 backdrop-blur border-primary/10",children:e.jsx(N,{className:"p-3 sm:pt-6 sm:p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center sm:items-center gap-1.5 sm:gap-3 text-center sm:text-left",children:[e.jsx("div",{className:"p-1.5 sm:p-2 bg-emerald-500/10 rounded-lg hidden sm:block",children:e.jsx(te,{className:"h-5 w-5 text-emerald-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xl sm:text-2xl font-bold text-foreground",children:a.length}),e.jsx("p",{className:"text-[10px] sm:text-sm text-muted-foreground",children:"Core Team"})]})]})})}),e.jsx(v,{className:"bg-background/50 backdrop-blur border-primary/10",children:e.jsx(N,{className:"p-3 sm:pt-6 sm:p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center sm:items-center gap-1.5 sm:gap-3 text-center sm:text-left",children:[e.jsx("div",{className:"p-1.5 sm:p-2 bg-blue-500/10 rounded-lg hidden sm:block",children:e.jsx(Re,{className:"h-5 w-5 text-blue-600"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-xl sm:text-2xl font-bold text-foreground",children:[_.length,I!==null&&e.jsxs("span",{className:"text-muted-foreground font-normal",children:["/",I]})]}),e.jsx("p",{className:"text-[10px] sm:text-sm text-muted-foreground",children:"Event Crew"})]})]})})}),e.jsx(v,{className:"bg-background/50 backdrop-blur border-primary/10",children:e.jsx(N,{className:"p-3 sm:pt-6 sm:p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center sm:items-center gap-1.5 sm:gap-3 text-center sm:text-left",children:[e.jsx("div",{className:"p-1.5 sm:p-2 bg-amber-500/10 rounded-lg hidden sm:block",children:e.jsx(ie,{className:"h-5 w-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xl sm:text-2xl font-bold text-foreground",children:L.length}),e.jsx("p",{className:"text-[10px] sm:text-sm text-muted-foreground",children:"Pending"})]})]})})})]})]})]}),e.jsxs(He,{value:j,onValueChange:V,className:"w-full",children:[e.jsxs(Je,{className:`grid w-full ${L.length>0?"grid-cols-3":"grid-cols-2"} h-auto`,children:[L.length>0&&e.jsxs(ve,{value:"requests",className:"gap-1 sm:gap-2 relative text-xs sm:text-sm py-2 px-1 sm:px-3",children:[e.jsx(we,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Requests"}),e.jsx(R,{variant:"destructive",className:"ml-0.5 sm:ml-1 h-4 sm:h-5 min-w-4 sm:min-w-5 px-1 sm:px-1.5 text-[10px] sm:text-xs animate-pulse",children:L.length})]}),e.jsxs(ve,{value:"crew",className:"gap-1 sm:gap-2 text-xs sm:text-sm py-2 px-1 sm:px-3",children:[e.jsx(ee,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Event Crew"}),e.jsx("span",{className:"sm:hidden",children:"Crew"}),e.jsxs("span",{className:"text-[10px] sm:text-xs",children:["(",_.length,")"]})]}),e.jsxs(ve,{value:"team",className:"gap-1 sm:gap-2 text-xs sm:text-sm py-2 px-1 sm:px-3",children:[e.jsx(te,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Core Team"}),e.jsx("span",{className:"sm:hidden",children:"Team"}),e.jsxs("span",{className:"text-[10px] sm:text-xs",children:["(",a.length,")"]})]})]}
24),e.jsx(Ne,{value:"crew",className:"space-y-4 mt-4 sm:mt-6",children:e.jsxs(v,{children:[e.jsx(z,{className:"p-3 sm:p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-base sm:text-lg",children:"Event Crew Members"}),e.jsx(be,{className:"text-xs sm:text-sm",children:"Attendees working with your startup"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs(b,{variant:"outline",className:"gap-2 text-xs sm:text-sm h-8 sm:h-10 flex-1 sm:flex-none",onClick:()=>f&&m(`/dashboard/company/${f}`),children:[e.jsx(ee,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Invite Team"}),e.jsx("span",{className:"sm:hidden",children:"Team"})]}),e.jsxs(b,{className:"gap-2 text-xs sm:text-sm h-8 sm:h-10 flex-1 sm:flex-none",onClick:()=>m(`/dashboard/${p}/startups/invite-attendees`),children:[e.jsx(re,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Invite Attendee"}),e.jsx("span",{className:"sm:hidden",children:"Attendee"})]})]})]})}),e.jsx(N,{className:"p-3 sm:p-6 pt-0",children:_.length===0?e.jsxs("div",{className:"text-center py-8 sm:py-12",children:[e.jsx(re,{className:"h-12 w-12 sm:h-16 sm:w-16 text-muted-foreground mx-auto mb-3 sm:mb-4 opacity-50"}),e.jsx("h3",{className:"text-base sm:text-lg font-medium text-foreground mb-2",children:"No Crew Members Yet"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-4",children:"Invite attendees to join your crew"}),e.jsxs(b,{onClick:()=>m(`/dashboard/${p}/startups/invite-attendees`),className:"gap-2 text-xs sm:text-sm",size:"sm",children:[e.jsx(re,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}),"Invite First Member"]})]}):e.jsx("div",{className:"space-y-4 sm:space-y-6",children:_.map(s=>e.jsx(v,{className:"border-2 border-primary/10 bg-gradient-to-br from-background to-primary/5 overflow-hidden",children:e.jsxs(N,{className:"p-0",children:[e.jsx("div",{className:"bg-gradient-to-r from-primary/10 to-primary/5 px-3 sm:px-6 py-2 sm:py-4 border-b border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{variant:"secondary",className:"text-[10px] sm:text-xs font-semibold",children:[e.jsx(ee,{className:"h-2.5 w-2.5 sm:h-3 sm:w-3 mr-1"}),"Event Crew"]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx(ie,{className:"h-2.5 w-2.5 sm:h-3 sm:w-3"}),new Date(s.joined_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})]})]})}),e.jsx("div",{className:"p-3 sm:p-6",children:e.jsxs("div",{className:"flex gap-3 sm:gap-6",children:[e.jsx("div",{className:"shrink-0",children:e.jsxs("div",{className:"relative",children:[e.jsxs(me,{className:"h-14 w-14 sm:h-24 sm:w-24 border-2 sm:border-4 border-background shadow-lg",children:[e.jsx(xe,{src:s.profile.avatar_url}),e.jsx(pe,{className:"bg-gradient-to-br from-primary to-primary/60 text-primary-foreground text-base sm:text-2xl font-bold",children:s.profile.name.split(" ").map(r=>r[0]).join("").toUpperCase()})]}),e.jsx(b,{size:"sm",className:"absolute -bottom-1 -right-1 sm:-bottom-2 sm:-right-2 h-7 w-7 sm:h-10 sm:w-10 rounded-full p-0 shadow-lg hover:scale-110 transition-transform",onClick:r=>{r.stopPropagation(),window.openConversationWithUser&&window.openConversationWithUser(s.user_id)},children:e.jsx(ge,{className:"h-3.5 w-3.5 sm:h-5 sm:w-5"})})]})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1 sm:mb-2",children:[e.jsx("h3",{className:"text-base sm:text-2xl font-bold text-foreground truncate",children:s.profile.name}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>y(s.id),className:"text-destructive hover:text-destructive hover:bg-destructive/10 shrink-0 text-xs h-7 px-2",children:"Remove"})]}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-1 truncate",children:s.profile.email}),s.profile.position&&e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 text-xs sm:text-base text-muted-foreground mb-1",children:[e.jsx(ue,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0"}),e.jsx("span",{className:"font-medium truncate",children:s.profile.position})]}),s.profile.company&&e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsx(te,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:s.profile.company})]})]}),s.role&&e.jsx(R,{variant:"secondary",className:"text-[10px] sm:text-xs",children:s.role}),s.profile.bio&&e.jsx("div",{className:"hidden sm:block rounded-lg bg-muted/50 p-4 border border-border/50",children:e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:s.profile.bio})})]})]})})]})},s.id))})})]})}
24),e.jsx(Ne,{value:"team",className:"space-y-4 mt-4 sm:mt-6",children:e.jsxs(v,{children:[e.jsx(z,{className:"p-3 sm:p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-base sm:text-lg",children:"Core Team Members"}),e.jsx(be,{className:"text-xs sm:text-sm",children:"Your permanent startup team"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs(b,{variant:"outline",className:"gap-2 text-xs sm:text-sm h-8 sm:h-10 flex-1 sm:flex-none",onClick:()=>f&&m(`/dashboard/company/${f}`),children:[e.jsx(ee,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Invite Team"}),e.jsx("span",{className:"sm:hidden",children:"Team"})]}),e.jsxs(b,{className:"gap-2 text-xs sm:text-sm h-8 sm:h-10 flex-1 sm:flex-none",onClick:()=>m(`/dashboard/${p}/startups/invite-attendees`),children:[e.jsx(re,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Invite Attendee"}),e.jsx("span",{className:"sm:hidden",children:"Attendee"})]})]})]})}),e.jsx(N,{className:"p-3 sm:p-6 pt-0",children:a.length===0?e.jsxs("div",{className:"text-center py-8 sm:py-12",children:[e.jsx(te,{className:"h-12 w-12 sm:h-16 sm:w-16 text-muted-foreground mx-auto mb-3 sm:mb-4 opacity-50"}),e.jsx("h3",{className:"text-base sm:text-lg font-medium text-foreground mb-2",children:"No Team Members"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Add team members in your startup profile"})]}):e.jsx("div",{className:"space-y-4 sm:space-y-6",children:a.map(s=>e.jsx(v,{className:"border-2 border-primary/10 bg-gradient-to-br from-background to-primary/5 overflow-hidden",children:e.jsxs(N,{className:"p-0",children:[e.jsx("div",{className:"bg-gradient-to-r from-primary/10 to-primary/5 px-3 sm:px-6 py-2 sm:py-4 border-b border-border/50",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs(R,{variant:"default",className:"text-[10px] sm:text-xs font-semibold",children:[e.jsx(ye,{className:"h-2.5 w-2.5 sm:h-3 sm:w-3 mr-1"}),"Core Team"]})})}),e.jsx("div",{className:"px-3 sm:px-6 py-3 sm:py-5",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-5",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsxs(me,{className:"h-14 w-14 sm:h-24 sm:w-24 border-2 border-primary/20",children:[e.jsx(xe,{src:s.profile.avatar_url}),e.jsx(pe,{className:"bg-primary/10 text-primary text-base sm:text-lg",children:s.profile.name.split(" ").map(r=>r[0]).join("").toUpperCase()})]}),e.jsx(b,{size:"sm",variant:"secondary",className:"absolute -bottom-1 -right-1 sm:-bottom-2 sm:-right-2 h-7 w-7 sm:h-10 sm:w-10 rounded-full p-0 shadow-lg border-2 border-background",onClick:r=>{r.stopPropagation(),window.openConversationWithUser&&window.openConversationWithUser(s.profile.user_id)},children:e.jsx(ge,{className:"h-3 w-3 sm:h-4 sm:w-4"})})]}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1.5 sm:space-y-3",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm sm:text-lg text-foreground truncate",children:s.profile.name}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:s.profile.email})]}),s.profile.position&&e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm",children:[e.jsx(ue,{className:"h-3 w-3 sm:h-4 sm:w-4 text-primary flex-shrink-0"}),e.jsx("span",{className:"text-foreground truncate",children:s.profile.position}),s.profile.company&&e.jsxs("span",{className:"text-muted-foreground hidden sm:inline",children:["at ",s.profile.company]})]}),s.profile.bio&&e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground leading-relaxed line-clamp-2 sm:line-clamp-none",children:s.profile.bio})]})]})})]})},s.profile.user_id))})})]})}),e.jsx(Ne,{value:"requests",className:"space-y-4 mt-4 sm:mt-6",children:e.jsxs(v,{children:[e.jsxs(z,{className:"p-3 sm:p-6",children:[e.jsx(P,{className:"text-base sm:text-lg",children:"Pending Requests"}),e.jsx(be,{className:"text-xs sm:text-sm",children:"Review join requests from attendees"})]}),e.jsx(N,{className:"p-3 sm:p-6 pt-0",children:L.length===0?e.jsxs("div",{className:"text-center py-8 sm:py-12",children:[e.jsx(we,{className:"h-12 w-12 sm:h-16 sm:w-16 text-muted-foreground mx-auto mb-3 sm:mb-4 opacity-50"}),e.jsx("h3",{className:"text-base sm:text-lg font-medium text-foreground mb-2",children:"No Pending Requests"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"New requests will appear here"})]}
24):e.jsx("div",{className:"space-y-4 sm:space-y-6",children:L.map(s=>e.jsx(v,{className:"border-2 border-primary/10 bg-gradient-to-br from-background to-primary/5 overflow-hidden",children:e.jsxs(N,{className:"p-0",children:[e.jsx("div",{className:"bg-gradient-to-r from-primary/10 to-primary/5 px-3 sm:px-6 py-2 sm:py-4 border-b border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(R,{variant:s.request_type==="attendee_request"?"default":"secondary",className:"text-[10px] sm:text-xs font-semibold",children:s.request_type==="attendee_request"?e.jsxs(e.Fragment,{children:[e.jsx(we,{className:"h-2.5 w-2.5 sm:h-3 sm:w-3 mr-1"})," Join Request"]}):e.jsxs(e.Fragment,{children:[e.jsx(Xe,{className:"h-2.5 w-2.5 sm:h-3 sm:w-3 mr-1"})," Your Invitation"]})}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx(ie,{className:"h-2.5 w-2.5 sm:h-3 sm:w-3"}),new Date(s.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})]})]})}),e.jsxs("div",{className:"p-3 sm:p-6",children:[e.jsxs("div",{className:"flex gap-3 sm:gap-6",children:[e.jsx("div",{className:"shrink-0",children:e.jsxs("div",{className:"relative",children:[e.jsxs(me,{className:"h-14 w-14 sm:h-24 sm:w-24 border-2 sm:border-4 border-background shadow-lg",children:[e.jsx(xe,{src:s.profile.avatar_url||void 0}),e.jsx(pe,{className:"bg-gradient-to-br from-primary to-primary/60 text-primary-foreground text-base sm:text-2xl font-bold",children:s.profile.name.split(" ").map(r=>r[0]).join("").toUpperCase()})]}),e.jsx("div",{className:"absolute -bottom-1 -right-1 sm:-bottom-2 sm:-right-2 bg-emerald-500 rounded-full p-1 sm:p-2 shadow-lg",children:e.jsx(Re,{className:"h-3 w-3 sm:h-4 sm:w-4 text-white"})})]})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-base sm:text-2xl font-bold text-foreground mb-1 sm:mb-2 flex flex-wrap items-center gap-1 sm:gap-2",children:[e.jsx("span",{className:"truncate",children:s.profile.name}),s.profile.main_badge&&e.jsxs(R,{className:"bg-gradient-to-r from-amber-500 to-orange-500 text-white border-0 shadow-lg text-[10px] sm:text-xs",children:[e.jsx(Ze,{className:"h-2.5 w-2.5 sm:h-3 sm:w-3 mr-0.5 sm:mr-1 fill-white"}),s.profile.main_badge]})]}),s.profile.position&&e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 text-xs sm:text-base text-muted-foreground mb-0.5 sm:mb-1",children:[e.jsx(ue,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0"}),e.jsx("span",{className:"font-medium truncate",children:s.profile.position})]}),s.profile.company&&e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsx(te,{className:"h-3 w-3 sm:h-4 sm:w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:s.profile.company})]})]}),(s.profile.linkedin||s.profile.twitter||s.profile.website)&&e.jsxs("div",{className:"hidden sm:flex gap-2 flex-wrap",children:[s.profile.linkedin&&e.jsxs("a",{href:s.profile.linkedin,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-3 py-2 bg-blue-600/10 hover:bg-blue-600/20 text-blue-600 rounded-lg transition-colors text-sm",children:[e.jsx(Ce,{className:"h-4 w-4"}),"LinkedIn"]}),s.profile.twitter&&e.jsxs("a",{href:s.profile.twitter,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-3 py-2 bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 rounded-lg transition-colors text-sm",children:[e.jsx(ke,{className:"h-4 w-4"}),"Twitter"]}),s.profile.website&&e.jsxs("a",{href:s.profile.website,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-3 py-2 bg-primary/10 hover:bg-primary/20 text-primary rounded-lg transition-colors text-sm",children:[e.jsx(_e,{className:"h-4 w-4"}),"Website"]})]}),s.profile.bio&&e.jsx("div",{className:"hidden sm:block bg-gradient-to-br from-muted/30 to-muted/10 rounded-xl p-4 border border-border/50",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(fe,{className:"h-5 w-5 text-primary mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-foreground mb-1",children:"About"}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:s.profile.bio})]})]})}),s.profile.interests&&s.profile.interests.length>0&&e.jsx("div",{className:"hidden sm:block bg-gradient-to-br from-purple-500/5 to-pink-500/5 rounded-xl p-4 border border-purple-200/20",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(es,{className:"h-5 w-5 text-purple-600 mt-0.5 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-sm font-semibold text-foreground mb-2",children:"Interests"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.profile.interests.map((r,M)=>e.jsx(R,{variant:"secondary",className:"bg-purple-100 text-purple-700 border-purple-200",children:r},M))})]})]})}),s.message&&e.jsx("div",{className:"bg-gradient-to-br from-primary/5 to-primary/10 rounded-lg sm:rounded-xl p-2 sm:p-4 border border-primary/20",children:e.jsxs("div",{className:"flex items-start gap-1.5 sm:gap-2",children:[e.jsx(ss,{className:"h-4 w-4 sm:h-5 sm:w-5 text-primary mt-0.5 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"text-xs sm:text-sm font-semibold text-foreground mb-1",children:s.request_type==="attendee_request"?"Message":"Your Message"}
24),e.jsxs("p",{className:"text-xs sm:text-sm text-foreground/90 leading-relaxed italic line-clamp-3 sm:line-clamp-none",children:['"',s.message,'"']})]})]})})]})]}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 sm:gap-3 mt-4 sm:mt-6 pt-4 sm:pt-6 border-t border-border/50",children:s.request_type==="attendee_request"?e.jsxs(e.Fragment,{children:[e.jsxs(b,{size:"default",onClick:()=>o(s.id,s.user_id),className:"flex-1 gap-2 bg-gradient-to-r from-emerald-600 to-emerald-500 hover:from-emerald-700 hover:to-emerald-600 shadow-lg shadow-emerald-500/20 h-9 sm:h-11 text-xs sm:text-sm",children:[e.jsx($e,{className:"h-4 w-4 sm:h-5 sm:w-5"}),"Accept"]}),e.jsxs(b,{size:"default",variant:"outline",onClick:()=>g(s.id),className:"gap-2 border-2 hover:bg-destructive/10 hover:text-destructive hover:border-destructive/50 h-9 sm:h-11 text-xs sm:text-sm",children:[e.jsx(Ee,{className:"h-4 w-4 sm:h-5 sm:w-5"}),"Decline"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(b,{size:"default",disabled:!0,variant:"outline",className:"flex-1 gap-2 border-2 border-amber-500/50 text-amber-700 bg-amber-50 h-9 sm:h-11 text-xs sm:text-sm",children:[e.jsx(ie,{className:"h-4 w-4 sm:h-5 sm:w-5"}),e.jsx("span",{className:"hidden sm:inline",children:"Waiting for Attendee"}),e.jsx("span",{className:"sm:hidden",children:"Pending"})]}),e.jsxs(b,{size:"default",variant:"outline",onClick:()=>g(s.id),className:"gap-2 border-2 hover:bg-destructive/10 hover:text-destructive hover:border-destructive/50 h-9 sm:h-11 text-xs sm:text-sm",children:[e.jsx(Ee,{className:"h-4 w-4 sm:h-5 sm:w-5"}),"Cancel"]})]})})]})]})},s.id))})})]})})]})]}):B&&(h!=null&&h.id)?e.jsx("div",{className:"max-w-2xl mx-auto py-8",children:e.jsx(ze,{userId:h.id,eventId:i,roleId:B,onCompanyAssigned:s=>{T(s)}})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(te,{className:"h-16 w-16 text-muted-foreground mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-medium text-foreground mb-2",children:"No Startup Profile"}),e.jsx("p",{className:"text-muted-foreground",children:"You need to create a startup profile to manage your crew."})]})};function gs(){const{eventSlug:i}=de(),h=je(),{user:x}=ne(),{toast:m}=Le(),[p,Q]=c.useState([]),[l,_]=c.useState([]),[k,a]=c.useState(""),[$,L]=c.useState(!0),[E,G]=c.useState(null),[C,q]=c.useState(null),[F,j]=c.useState({}),V=[{value:"MARKETING",label:"Marketing",color:"bg-purple-500"},{value:"TECH",label:"Tech",color:"bg-blue-500"},{value:"BUSINESS",label:"Business",color:"bg-green-500"},{value:"LEGAL",label:"Legal",color:"bg-amber-500"}],f=[{value:"junior",label:"Junior (0-2 years)"},{value:"mid",label:"Mid-level (3-5 years)"},{value:"senior",label:"Senior (6-10 years)"},{value:"executive",label:"Executive (10+ years)"}];c.useEffect(()=>{i&&T()},[i]),c.useEffect(()=>{se()},[k,p]),c.useEffect(()=>{E&&(C!=null&&C.id)&&B(E,C.id)},[E,C==null?void 0:C.id]);const T=async()=>
24{try{L(!0);let t=null;const{data:d,error:u}=await n.from("events").select("id").eq("slug",i).maybeSingle();if(d)t=d;else{const o=(i==null?void 0:i.replace(/-/g," "))||"",{data:g,error:y}=await n.from("events").select("id").ilike("title",`%${o}%`).maybeSingle();t=g}if(!t){m.error({title:"Error",description:"Event not found"}),h(-1);return}G(t.id),await I(t.id),await O(t.id)}catch(t){console.error("Error fetching data:",t),m.error({title:"Error",description:"Failed to load attendees"})}finally{L(!1)}},I=async t=>{if(x!=null&&x.id)try{const{data:d,error:u}=await n.from("user_roles").select("company_id").eq("user_id",x.id).eq("event_id",t).eq("role","startup").eq("status","accepted").maybeSingle();if(u)throw u;let o=(d==null?void 0:d.company_id)||null;if(o){const{data:s}=await n.from("companies").select("id, name").eq("id",o).maybeSingle();if(s){q(s),await B(t,s.id);return}}const{data:g}=await n.from("profiles").select("id").eq("user_id",x.id).single();if(!g)return;const{data:y}=await n.from("companies").select("id, name").eq("profile_id",g.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();y&&(q(y),await B(t,y.id))}catch(d){console.error("Error fetching startup:",d)}},O=async t=>{try{const{data:d,error:u}=await n.from("user_roles").select("user_id").eq("event_id",t).eq("role","attendee").eq("status","accepted");if(u)throw u;const o=(d==null?void 0:d.map(r=>r.user_id))||[];if(o.length===0){Q([]);return}const{data:g,error:y}=await n.from("profiles").select("*").in("user_id",o);if(y)throw y;const s=(g||[]).map(r=>({id:r.id,user_id:r.user_id,name:r.name||"Attendee",email:r.email||"",avatar_url:r.avatar_url,bio:r.bio,company:r.company,position:r.position,city:r.city,country:r.country,main_badge:r.main_badge,experience_level:r.experience_level,interests:r.interests,skills:r.skills,looking_for:r.looking_for,linkedin:r.linkedin,twitter:r.twitter,website:r.website}));Q(s)}catch(d){console.error("Error fetching attendees:",d)}},B=async(t,d)=>{try{const{data:u}=await n.from("startup_crew_requests").select("user_id, status").eq("event_id",t).eq("company_id",d),o={};(u||[]).forEach(g=>{g.user_id&&(o[g.user_id]=g.status)}),j(o)}catch(u){console.error("Error fetching existing requests",u)}},se=()=>{if(!k.trim()){_(p);return}const t=k.toLowerCase(),d=p.filter(u=>{var o,g,y,s;return u.name.toLowerCase().includes(t)||u.email.toLowerCase().includes(t)||((o=u.company)==null?void 0:o.toLowerCase().includes(t))||((g=u.position)==null?void 0:g.toLowerCase().includes(t))||((y=u.skills)==null?void 0:y.some(r=>r.toLowerCase().includes(t)))||((s=u.interests)==null?void 0:s.some(r=>r.toLowerCase().includes(t)))});_(d)},H=async t=>{if(x!=null&&x.id)try{m.info({title:"Chat Feature",description:`Chat with ${t.name} - Feature coming soon!`})}catch(d){console.error("Error starting chat:",d),m.error({title:"Error",description:"Failed to start chat"})}},W=async t=>{if(!C||!E){m.error({title:"Error",description:"You need a startup and active event to invite attendees"});return}if((x==null?void 0:x.id)===t.user_id){m.info({title:"Notice",description:"You can't invite yourself"});return}try{const{data:d}=await n.from("startup_crew_requests").select("id, status").eq("event_id",E).eq("company_id",C.id).eq("user_id",t.user_id).maybeSingle();if(d){if(d.status==="pending"){m.info({title:"Already Invited",description:`${t.name} already has a pending invitation`});return}if(d.status==="accepted"){m.info({title:"Already in Crew",description:`${t.name} is already part of your crew`});return}if(d.status==="rejected"){const{error:u}=await n.from("startup_crew_requests").update({status:"pending"}).eq("id",d.id);if(u)throw u}}else{const{error:u}=await n.from("startup_crew_requests").insert({event_id:E,company_id:C.id,user_id:t.user_id,request_type:"founder_invite",status:"pending"});if(u)throw u}await n.from("notifications").insert({user_id:t.user_id,event_id:E,type:"info",title:"Startup Invitation",message:`${C.name} invited you to join their event crew`,action_url:`/dashboard/${i}/attendant/startups`}),m.success({title:"Invitation Sent",description:`Invitation sent to ${t.name}`}),j(u=>({...u,[t.user_id]:"pending"}))}catch(d){console.error("Error inviting attendee:",d),m.error({title:"Error",description:"Failed to send invitation"})}};return $?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(oe,{size:64})}):e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Invite Attendees"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Connect with attendees and invite them to join your startup team"})]}),e.jsx(b,{variant:"outline",onClick:()=>h(-1),children:"Back"})]}),e.jsxs(v,{children:[e.jsx(z,{children:e.jsxs(P,{className:"flex items-center gap-2",children:[e.jsx(Ke,{className:"h-5 w-5"}),"Search Attendees"]})}),e.jsx(N,{children:e.jsx(ns,{placeholder:"Search by name, company, skills, interests...",value:k,onChange:t=>a(t.target.value),className:"max-w-md"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(v,{children:e.jsxs(N,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold",children:p.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Attendees"})]})}),e.jsx(v,{children:e.jsxs(N,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold",children:l.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Matching Search"})]})}),e.jsx(v,{children:e.jsxs(N,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold",children:C?"1":"0"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"My Startup"})]})})]}),e.jsx("div",{className:"space-y-4",children:l.length===0?e.jsx(v,{children:e.jsx(N,{className:"py-12 text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"No attendees found"})})}):l.map(t=>{var d,u;return e.jsx(v,{className:"overflow-hidden border-0 shadow-lg bg-gradient-to-br from-primary/5 via-background to-background",children:e.jsxs(N,{className:"p-0",children:[e.jsx("div",{className:"h-32 bg-gradient-to-r from-primary/20 via-primary/10 to-primary/5 relative",children:e.jsx("div",{className:"absolute -bottom-16 left-8",children:t.avatar_url?e.jsx("img",{src:t.avatar_url,alt:t.name,className:"w-32 h-32 rounded-2xl object-cover border-4 border-background shadow-xl"}):e.jsx("div",{className:"w-32 h-32 rounded-2xl bg-gradient-to-br from-primary to-primary/70 flex items-center justify-center border-4 border-background shadow-xl",children:e.jsx("span",{className:"text-4xl font-bold text-white",children:t.name[0]})})})}),e.jsxs("div",{className:"pt-20 px-8 pb-8",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-6",children:[e.jsxs("div",{className:"space-y-3 flex-1",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold text-foreground mb-1",children:t.name}),t.position&&t.company&&e.jsxs("p",{className:"text-lg text-muted-foreground flex items-center gap-2",children:[e.jsx(ue,{className:"w-4 h-4"}),t.position," at ",e.jsx("span",{className:"font-medium text-foreground",children:t.company})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.main_badge&&e.jsxs(R,{className:"px-4 py-1.5 bg-gradient-to-r from-primary to-primary/80 text-white border-0 shadow-sm",children:[e.jsx(ye,{className:"w-3 h-3 mr-1.5"}),((d=V.find(o=>o.value===t.main_badge))==null?void 0:d.label)||t.main_badge]}),(t.city||t.country)&&e.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(Pe,{className:"w-4 h-4"}),t.city&&t.country?`${t.city}, ${t.country}`:t.city||t.country]}),t.experience_level&&e.jsxs(R,{variant:"outline",className:"capitalize",children:[e.jsx(fe,{className:"w-3 h-3 mr-1.5"}),((u=f.find(o=>o.value===t.experience_level))==null?void 0:u.label)||t.experience_level.replace("_"," ")]})]}),(t.linkedin||t.twitter||t.website)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.linkedin&&e.jsxs("a",{href:t.linkedin,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-all group",children:[e.jsx(Ce,{className:"w-4 h-4 text-blue-600 group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground",children:"LinkedIn"})]}),t.twitter&&e.jsxs("a",{href:t.twitter,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-all group",children:[e.jsx(ke,{className:"w-4 h-4 text-blue-400 group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground",children:"Twitter"})]}),t.website&&e.jsxs("a",{href:t.website,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-all group",children:[e.jsx(_e,{className:"w-4 h-4 text-primary group-hover:scale-110 transition-transform"}),e.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground",children:"Website"})]})]}),t.bio&&e.jsx("div",{className:"mt-4 p-4 rounded-xl bg-muted/50 border border-border/50",children:e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:t.bio})})]}),e.jsxs("div",{className:"flex flex-col gap-3 lg:min-w-[200px]",children:[e.jsxs(b,{onClick:()=>H(t),className:"flex items-center justify-center gap-2",variant:"default",children:[e.jsx(ge,{className:"h-4 w-4"}),"Start Chat"]}),C&&(()=>{const o=F[t.user_id];return o==="pending"?e.jsxs(b,{disabled:!0,variant:"outline",className:"flex items-center justify-center gap-2",children:[e.jsx(re,{className:"h-4 w-4"}),"Invitation Pending"]}):o==="accepted"?e.jsxs(b,{disabled:!0,variant:"outline",className:"flex items-center justify-center gap-2",children:[e.jsx(re,{className:"h-4 w-4"}),"In Crew"]}):e.jsxs(b,{onClick:()=>W(t),className:"flex items-center justify-center gap-2",variant:"outline",children:[e.jsx(re,{className:"h-4 w-4"}),"Invite to ",C.name]})})()]})]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-6 mt-6",children:[t.interests&&t.interests.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-blue-500/10",children:e.jsx(ye,{className:"w-4 h-4 text-blue-600"})}),e.jsx("h3",{className:"font-semibold",children:"Interests"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.interests.map((o,g)=>e.jsx(R,{variant:"secondary",className:"px-3 py-1 hover:bg-blue-500/10 hover:text-blue-700 transition-colors",children:o},g))})]}),t.skills&&t.skills.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(fe,{className:"w-4 h-4 text-primary"})}),e.jsx("h3",{className:"font-semibold",children:"Skills"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.skills.map((o,g)=>e.jsx(R,{className:"px-3 py-1 bg-primary/10 text-primary border-primary/20 hover:bg-primary hover:text-white transition-all",children:o},g))})]}),t.looking_for&&t.looking_for.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-green-500/10",children:e.jsx(fe,{className:"w-4 h-4 text-green-600"})}),e.jsx("h3",{className:"font-semibold",children:"Looking For"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.looking_for.map((o,g)=>e.jsx(R,{variant:"outline",className:"px-3 py-1 border-green-500/30 text-green-700 hover:bg-green-500/10 transition-colors",children:o},g))})]})]})]})]})},t.id)})})]})}const js=({eventId:i})=>{const{user:h}=ne(),{toast:x}=Le(),m=Fe(),{data:p,isLoading:Q}=ls({queryKey:["startup-final-pitch",i,h==null?void 0:h.id],queryFn:async()=>
24{if(!(h!=null&&h.id))return null;const{data:_}=await n.from("profiles").select("id").eq("user_id",h.id).single();if(!_)return null;const{data:k}=await n.from("company_members").select("company_id").eq("profile_id",_.id);if(!(k!=null&&k.length))return null;const a=k.map(E=>E.company_id),{data:$}=await n.from("event_startups").select("company_id, companies (id, name, final_pitch)").eq("event_id",i).eq("status","accepted").in("company_id",a);return $!=null&&$.length?$[0].companies:null},enabled:!!(h!=null&&h.id)}),l=cs({mutationFn:async _=>{if(!(p!=null&&p.id))throw new Error("No company found");const{error:k}=await n.from("companies").update({final_pitch:_||null}).eq("id",p.id);if(k)throw k},onSuccess:()=>{x.success({title:"Final pitch updated!"}),m.invalidateQueries({queryKey:["startup-final-pitch"]})},onError:_=>{x.error({title:"Update failed",description:_.message})}});return Q?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(oe,{size:48})}):p?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Final Pitch"}),e.jsxs("p",{className:"text-muted-foreground",children:["Upload the final pitch presentation for ",p.name]})]}),e.jsxs(v,{children:[e.jsx(z,{children:e.jsx(P,{className:"text-lg",children:"Pitch Presentation (PDF)"})}),e.jsx(N,{children:e.jsx(ds,{label:"Final Pitch PDF",currentFile:p.final_pitch,onFileUpload:_=>l.mutate(_),bucketName:"company-images",folder:"final-pitches",acceptedTypes:".pdf",maxSize:20})})]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Final Pitch"}),e.jsx("p",{className:"text-muted-foreground",children:"Upload your final pitch presentation"})]}),e.jsx(v,{children:e.jsx(N,{className:"py-8 text-center text-muted-foreground",children:"No accepted startup found for this event."})})]})};function Rr(){const{user:i}=ne(),{eventSlug:h}=de(),x=je(),m=Ue(),[p,Q]=c.useState(null),[l,_]=c.useState(null),[k,a]=c.useState(!0),[$,L]=c.useState([]),E=m.pathname.endsWith("/settings"),G=m.pathname.endsWith("/mentors"),C=m.pathname.endsWith("/profile"),q=m.pathname.endsWith("/crew"),F=m.pathname.endsWith("/mentoring"),j=m.pathname.endsWith("/schedule"),V=m.pathname.endsWith("/networking"),f=m.pathname.endsWith("/reviews"),T=m.pathname.endsWith("/invite-attendees"),I=m.pathname.endsWith("/media"),O=m.pathname.endsWith("/feedback"),B=m.pathname.endsWith("/final-pitch"),se=m.pathname.includes("/ask-the-expert"),H=o=>{_(g=>g?{...g,...o}:null)};c.useEffect(()=>{i&&h&&W()},[i,h]);const W=async()=>{var o;try{a(!0);const{data:g,error:y}=await n.from("events").select("*");if(y){console.error("Error fetching events:",y),x("/dashboard");return}const s=J=>J.toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"-").substring(0,50),r=g==null?void 0:g.find(J=>s(J.title)===h);if(!r){console.error("Event not found for slug:",h),x("/dashboard");return}_({id:r.id,title:r.title,description:r.description||"",location:r.location||"",start_date:r.start_date,end_date:r.end_date,max_participants:r.max_participants,event_type:r.event_type,status:r.status,visibility:r.visibility});const{data:M,error:w}=await n.from("user_roles").select("event_id, role, status").eq("user_id",i==null?void 0:i.id).eq("event_id",r.id);if(w){console.error("Error fetching user roles:",w);return}if(L(M||[]),!(M==null?void 0:M.some(J=>J.role==="startup"))){x("/dashboard");return}const{data:D,error:A}=await n.from("profiles").select("*").eq("user_id",i==null?void 0:i.id).single();if(A){console.error("Error fetching profile:",A);return}const{data:S,error:K}=await n.from("user_roles").select("event_id, role").eq("user_id",i==null?void 0:i.id);if(K){console.error("Error fetching all roles:",K);return}const ae=(S==null?void 0:S.map(J=>J.event_id))||[],{data:Se,error:le}=await n.from("events").select("id, title, location").in("id",ae);if(le){console.error("Error fetching events:",le);return}const Y={id:(i==null?void 0:i.id)||"",name:(D==null?void 0:D.name)||((o=i==null?void 0:i.email)==null?void 0:o.split("@")[0])||"User",email:(i==null?void 0:i.email)||"",avatar:D==null?void 0:D.avatar_url,roles:(S==null?void 0:S.map(J=>({visitor:"visitor",attendee:"attendant",mentor:"mentor",startup:"startup_foun
24der",corporate:"corporate",investor:"investor",speaker:"speaker",program_manager:"program_manager",location:"location",jury_member:"jury_member"})[J.role]||J.role))||[],primaryRole:"startup_founder",currentEventId:r.id};Q(Y)}catch(g){console.error("Error in fetchEventAndUserData:",g),x("/dashboard")}finally{a(!1)}},t=()=>{const o=$.find(g=>g.role==="startup");return(o==null?void 0:o.status)||"pending"},d=o=>{const y={pending:{title:"Application Pending",message:"Your startup founder application is currently under review. You'll be notified once it's processed.",icon:e.jsx(ie,{className:"h-12 w-12 text-yellow-500"}),bgColor:"bg-yellow-50 border-yellow-200",textColor:"text-yellow-800"},rejected:{title:"Application Not Approved",message:"Your startup founder application was not approved. Please contact the program manager for more information.",icon:e.jsx(De,{className:"h-12 w-12 text-red-500"}),bgColor:"bg-red-50 border-red-200",textColor:"text-red-800"}}[o];return y?e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4",children:e.jsxs("div",{className:`max-w-md w-full ${y.bgColor} border rounded-lg p-8 text-center`,children:[e.jsx("div",{className:"flex justify-center mb-4",children:y.icon}),e.jsx("h2",{className:`text-xl font-semibold mb-3 ${y.textColor}`,children:y.title}),e.jsx("p",{className:`${y.textColor} mb-6`,children:y.message})]})}):null};if(k)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(oe,{size:64})});if(!p||!l)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Access Denied"}),e.jsx("p",{className:"text-muted-foreground",children:"Unable to load dashboard data."})]})});const u=()=>{if(E){const g=(p==null?void 0:p.primaryRole)==="admin",y=$.some(s=>s.event_id===(l==null?void 0:l.id)&&s.role==="program_manager"&&s.status==="accepted");return!g&&!y?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md",children:[e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Access Denied"}),e.jsx("p",{className:"text-muted-foreground",children:"Only administrators and program managers can access event settings."})]})}):e.jsx(Be,{currentEvent:{id:l.id,title:l.title,description:l.description||"",location:l.location||"",start_date:l.start_date||"",end_date:l.end_date||"",status:l.status||"Draft",visibility:l.visibility||"Private"},onEventUpdate:H})}if(G)return e.jsx(Ye,{});if(C)return e.jsx(hs,{});if(q)return e.jsx(fs,{eventId:l.id});if(F)return e.jsx(Ge,{eventId:l.id});if(j)return e.jsx(ts,{eventId:l.id,eventStartDate:l.start_date,eventEndDate:l.end_date,canEdit:!1});if(V)return e.jsx(as,{eventId:l.id});if(f)return e.jsx(is,{eventId:l.id,eventTitle:l.title});if(T)return e.jsx(gs,{});if(I)return e.jsx(rs,{});if(O)return e.jsx(os,{eventId:l.id,eventTitle:l.title});if(B)return e.jsx(js,{eventId:l.id});if(se)return e.jsx(ms,{eventId:l.id});const o=t();return o!=="accepted"?d(o):e.jsx(us,{eventId:l.id,eventTitle:l.title})};return e.jsx(We,{user:p,currentEvent:{id:l.id,title:l.title,description:l.description||"",location:l.location||"",start_date:l.start_date||"",end_date:l.end_date||"",status:l.status||"Draft",visibility:l.visibility||"Private"},userEventRoles:$.map(o=>({role:o.role,status:o.status,event_id:o.event_id}
24)),currentRole:m.pathname.includes("/startups")?"startup_founder":p.primaryRole==="admin"?"program_manager":p.primaryRole,onRoleChange:o=>{const y={startup:"startups",startup_founder:"startups",program_manager:"manager",mentor:"mentor",jury_member:"jury",investor:"investor",corporate:"corporate",attendee:"attendant",visitor:"visitor"}[o]||o;x(`/dashboard/${h}/${y}/`)},children:u()})}export{Rr 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.