1import{j as e,r as v}from"./vendor-radix-DLGwGdby.js";import{q as Ve,h as S,A as N,g as j,v as K,w as B,x as z,y as I,z as _,I as w,ax as ue,s as pe,bo as Le,bp as Me,B as U,bq as Oe,br as J,cx as me,Q as Ue,R as qe,U as He,V as Qe,a2 as Ke,O as Be,W as ze,J as Ie,K as P,C as Je,b as We,c as Xe,d as Ge,e as Ye,aX as R,t as y}from"./index-Cz1Nuibl.js";import{u as Ze}from"./useDebounce-C6WaUO4R.js";import{u as ee}from"./useDropdownOptions-DXM1Ytyj.js";import{u as et}from"./useUrlSort-BPZC7RwV.js";import{B as tt,u as st}from"./BulkActionBar-BxQtdwCf.js";import{P as at}from"./PageHeader-DadO5fKg.js";import{S as it,a as O}from"./SummaryCard-CE7LCVA1.js";import{b as lt}from"./useAdminSummary-Tzvbx28g.js";import{A as nt}from"./AdvancedFilterBar-BNtJwTwe.js";import{f as rt,T as dt,a as ct,b as te,c as E,d as ot,e as b}from"./table-DxmE8Wef.js";import{A as ut}from"./AdminPagination-6qEaDgP-.js";import{S as F}from"./SortableTableHead-Lp3V85rI.js";import{P as pt}from"./ProfileCompletenessCell-C8tgnrww.js";import{a3 as se,aM as ae,bu as mt,aE as ht,aP as be,aF as xt,R as he,c9 as gt,f as bt,_ as yt}from"./vendor-lucide-BWW0XcuW.js";import{f as jt}from"./vendor-datefns-CU7NMMYW.js";import{A as ft,a as vt,b as _t,c as St,d as Nt,e as Ct,f as wt,g as $t}from"./alert-dialog-DcLzGzcI.js";import"./vendor-recharts-dzgay_RI.js";const xe={visibility:"",industry:"",startup_stage:"",funding_stage:"",country:"",city:"",created_from:"",created_to:""};function At(){const a=new URLSearchParams(window.location.search);return{visibility:a.get("visibility")??"",industry:a.get("industry")??"",startup_stage:a.get("startup_stage")??"",funding_stage:a.get("funding_stage")??"",country:a.get("country")??"",city:a.get("city")??"",created_from:a.get("created_from")??"",created_to:a.get("created_to")??""}}function ge(a){const d=new URLSearchParams(window.location.search);Object.keys(a).forEach(i=>{a[i]?d.set(i,a[i]):d.delete(i)});const m=d.toString();window.history.replaceState(null,"",m?`${window.location.pathname}?${m}`:window.location.pathname)}function Tt(a,d,m,i,h,u){return Ve({queryKey:["admin-startups",a,d,m,i,h,u],queryFn:()=>{const n=new URLSearchParams({page:String(a),limit:String(d)});return m&&n.set("search",m),i.visibility&&n.set("visibility",i.visibility),i.industry&&n.set("industry",i.industry),i.startup_stage&&n.set("startup_stage",i.startup_stage),i.funding_stage&&n.set("funding_stage",i.funding_stage),i.country&&n.set("country",i.country),i.city&&n.set("city",i.city),i.created_from&&n.set("created_from",i.created_from),i.created_to&&n.set("created_to",i.created_to),h&&n.set("sort_by",h),u&&n.set("sort_dir",u),S.get(`${N}/admin/startups?${n.toString()}`)}})}function Dt({filters:a,updateFilter:d,clearAllFilters:m,activeFilters:i,industryOptions:h,startupStageOptions:u,fundingStageOptions:n}){return e.jsxs(nt,{activeFilters:i,onClearAll:m,children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-xs text-muted-foreground",children:"Visibility"}),e.jsxs(K,{value:a.visibility||"_all",onValueChange:t=>d("visibility",t==="_all"?"":t),children:[e.jsx(B,{"data-testid":"select-filter-visibility",children:e.jsx(z,{placeholder:"All"})}),e.jsxs(I,{children:[e.jsx(_,{value:"_all",children:"All"}),e.jsx(_,{value:"public",children:"Public"}),e.jsx(_,{value:"hidden",children:"Hidden"}),e.jsx(_,{value:"unset",children:"Unset"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-xs text-muted-foreground",children:"Industry"}),e.jsxs(K,{value:a.industry||"_all",onValueChange:t=>d("industry",t==="_all"?"":t),children:[e.jsx(B,{"data-testid":"select-filter-industry",children:e.jsx(z,{placeholder:"All"})}),e.jsxs(I,{children:[e.jsx(_,{value:"_all",children:"All"}),h.map(t=>e.jsx(_,{value:t.value,children:t.label},t.value))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-xs text-muted-foreground",children:"Startup Stage"}),e.jsxs(K,{value:a.startup_stage||"_all",onValueChange:t=>d("startup_stage",t==="_all"?"":t),children:[e.jsx(B,{"data-testid":"select-filter-startup-stage",children:e.jsx(z,{placeholder:"All"})}),e.jsxs(I,{children:[e.jsx(_,{value:"_all",children:"All"}),u.map(t=>e.jsx(_,{value:t.value,children:t.label},t.value))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-xs text-muted-foreground",children:"Funding Stage"}),e.jsxs(K,{value:a.funding_stage||"_all",onValueChange:t=>d("funding_stage",t==="_all"?"":t),children:[e.jsx(B,{"data-testid":"select-filter-funding-stage",children:e.jsx(z,{placeholder:"All"})}),e.jsxs(I,{children:[e.jsx(_,{value:"_all",children:"All"}),n.map(t=>e.jsx(_,{value:t.value,children:t.label},t.value))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{htmlFor:"input-filter-country",className:"text-xs text-muted-foreground",children:"Country"}),e.jsx(w,{id:"input-filter-country",value:a.country,onChange:t=>d("country",t.target.value),placeholder:"Any country","data-testid":"input-filter-country"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{htmlFor:"input-filter-city",className:"text-xs text-muted-foreground",children:"City"}),e.jsx(w,{id:"input-filter-city",value:a.city,onChange:t=>d("city",t.target.value),placeholder:"Any city","data-testid":"input-filter-city"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-xs text-muted-foreground",children:"Joined From"}),e.jsx(w,{type:"date",value:a.created_from,onChange:t=>d("created_from",t.target.value),"data-testid":"input-filter-created-from"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-xs text-muted-foreground",children:"Joined To"}),e.jsx(w,{type:"date",value:a.created_to,onChange:t=>d("created_to",t.target.value),"data-testid":"input-filter-created-to"})]})]})}function kt({startups:a,isLoading:d,isError:m,total:i,page:h,totalPages:u,sortBy:n,sortDir:t,onSort:f,selectedIds:x,selectAllResults:$,isAllPageSelected:g,isIndeterminate:c,onToggleRow:W,onTogglePage:o,onSelectAllResults:A,onClearSelection:X,onBulkAction:T,onBulkSetPublic:k,onBulkDelete:q,onToggleVisibility:D,onNudge:V,onOpenEdit:G,onSetDeleteTarget:L,onPageChange:H}){const p=x.size;
1return d?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading startups..."}):m?e.jsx("div",{className:"text-center py-8 text-destructive",children:"Failed to load startups. Please refresh the page or sign in again."}):e.jsxs(e.Fragment,{children:[e.jsx(tt,{selectedCount:p,totalCount:i,selectAllResults:$,onSelectAllResults:A,onClearSelection:X,actions:[{label:"Set Public",icon:e.jsx(se,{className:"h-3.5 w-3.5"}),confirmTitle:`Set ${p} startup${p!==1?"s":""} to public?`,confirmDescription:"Selected startups will become visible in the public directory.",confirmLabel:"Set Public",onClick:()=>k([...x],!0)},{label:"Set Hidden",icon:e.jsx(ae,{className:"h-3.5 w-3.5"}),confirmTitle:`Set ${p} startup${p!==1?"s":""} to hidden?`,confirmDescription:"Selected startups will be hidden from the public directory.",confirmLabel:"Set Hidden",onClick:()=>k([...x],!1)},{label:"Publish",confirmTitle:`Publish ${p} startup${p!==1?"s":""}?`,confirmDescription:"Selected startups will become visible in the public directory.",onClick:()=>T([...x],"publish")},{label:"Unpublish",confirmTitle:`Unpublish ${p} startup${p!==1?"s":""}?`,confirmDescription:"Selected startups will be hidden from the public directory.",onClick:()=>T([...x],"unpublish")},{label:"Nudge",confirmTitle:`Send profile nudge to ${p} startup${p!==1?"s":""}?`,confirmDescription:"Profile completion emails will be sent to selected startups with incomplete profiles.",onClick:()=>T([...x],"nudge")},{label:"Delete",variant:"destructive",confirmTitle:`Delete ${p} startup${p!==1?"s":""}?`,confirmDescription:"This will permanently delete the selected startups. This action cannot be undone.",onClick:()=>q([...x])}]}),e.jsx(rt,{children:e.jsxs(dt,{children:[e.jsx(ct,{children:e.jsxs(te,{children:[e.jsx(E,{className:"w-[40px]",children:e.jsx(ue,{checked:g,"data-state":c?"indeterminate":void 0,onCheckedChange:o,"aria-label":"Select all on page"})}),e.jsx(F,{column:"startup_name",sortBy:n,sortDir:t,onSort:f,children:"Startup"}),e.jsx(E,{className:"hidden md:table-cell",children:"Owner"}),e.jsx(E,{className:"hidden md:table-cell",children:"Country"}),e.jsx(E,{className:"hidden md:table-cell",children:"City"}),e.jsx(F,{column:"industry",sortBy:n,sortDir:t,onSort:f,className:"hidden lg:table-cell",children:"Industry"}),e.jsx(F,{column:"startup_stage",sortBy:n,sortDir:t,onSort:f,className:"hidden lg:table-cell",children:"Stage"}),e.jsx(F,{column:"completeness",sortBy:n,sortDir:t,onSort:f,className:"hidden md:table-cell",children:"Completeness"}),e.jsx(F,{column:"is_public",sortBy:n,sortDir:t,onSort:f,children:"Visibility"}),e.jsx(F,{column:"created_at",sortBy:n,sortDir:t,onSort:f,className:"hidden md:table-cell",children:"Created"}),e.jsx(E,{className:"hidden lg:table-cell",children:"Last Nudge"}),e.jsx(E,{className:"w-[70px]"})]})}),e.jsxs(ot,{children:[a.map(l=>e.jsxs(te,{"data-testid":`row-startup-${l.id}`,"data-selected":x.has(l.id),children:[e.jsx(b,{children:e.jsx(ue,{checked:x.has(l.id),onCheckedChange:()=>W(l.id),"aria-label":`Select ${l.startup_name}`})}),e.jsxs(b,{children:[e.jsx("div",{className:"font-medium","data-testid":`text-startup-name-${l.id}`,children:l.startup_name}),l.tagline&&e.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:l.tagline})]}),e.jsxs(b,{className:"hidden md:table-cell",children:[e.jsx("div",{className:"text-sm",children:l.profile?.full_name||"â"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l.profile?.email||"â"})]}),e.jsx(b,{className:"hidden md:table-cell",children:e.jsx("div",{className:"max-w-[140px] truncate text-sm",title:l.incorporation_country??void 0,children:l.incorporation_country||"â"})}),e.jsx(b,{className:"hidden md:table-cell",children:e.jsx("div",{className:"max-w-[140px] truncate text-sm",title:l.city??void 0,children:l.city||"â"})}),e.jsx(b,{className:"hidden lg:table-cell",children:l.industry?e.jsx(pe,{variant:"outline",className:"text-xs",children:l.industry}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"â"})}),e.jsx(b,{className:"hidden lg:table-cell",children:e.jsx("div",{className:"text-sm",children:l.startup_stage||"â"})}),e.jsx(b,{className:"hidden md:table-cell",children:e.jsx(pt,{pct:l.completeness??0,thresholds:{good:90,warn:50},onNudge:()=>V(l)})}),e.jsx(b,{children:e.jsx(pe,{variant:l.is_public?"default":"outline",children:l.is_public?"Public":"Hidden"})}),e.jsx(b,{className:"hidden md:table-cell text-muted-foreground text-sm",children:jt(new Date(l.created_at),"MMM d, yyyy")}),e.jsx(b,{className:"hidden lg:table-cell text-muted-foreground text-sm",children:l.profile_nudge_sent_at?new Date(l.profile_nudge_sent_at).toLocaleDateString():"â"}),e.jsx(b,{children:e.jsxs(Le,{children:[e.jsx(Me,{asChild:!0,children:e.jsx(U,{"data-testid":`button-actions-${l.id}`,variant:"ghost",size:"icon",children:e.jsx(mt,{className:"h-4 w-4"})})}),e.jsxs(Oe,{align:"end",children:[e.jsxs(J,{onClick:()=>G(l),children:[e.jsx(ht,{className:"h-4 w-4 me-2"})," Edit Profile"]}),e.jsx(me,{}),e.jsx(J,{onClick:()=>D(l.id,!!l.is_public),children:l.is_public?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-4 w-4 me-2"})," Unpublish"]}):e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"h-4 w-4 me-2"})," Publish"]})}),e.jsxs(J,{onClick:()=>V(l),children:[e.jsx(be,{className:"h-4 w-4 me-2"})," Send Profile Nudge"]}),e.jsx(me,{}),e.jsxs(J,{className:"text-destructive focus:text-destructive",onClick:()=>L(l),children:[e.jsx(xt,{className:"h-4 w-4 me-2"})," Delete Startup"]})]})]})})]},l.id)),a.length===0&&e.jsx(te,{children:e.jsx(b,{colSpan:12,className:"text-center py-8 text-muted-foreground",children:"No startups found"})})]})]})}),u>1&&e.jsx(ut,{page:h,totalPages:u,total:i,onPageChange:H})]})}
1function Pt({isEditOpen:a,setIsEditOpen:d,editTarget:m,editForm:i,setEditForm:h,onSaveEdit:u,isEditPending:n,deleteTarget:t,setDeleteTarget:f,onConfirmDelete:x,isDeletePending:$}){return e.jsxs(e.Fragment,{children:[e.jsx(Ue,{open:a,onOpenChange:d,children:e.jsxs(qe,{className:"sm:max-w-[500px]",children:[e.jsxs(He,{children:[e.jsx(Qe,{children:"Edit Startup"}),e.jsx(Ke,{children:m?.profile?.email||m?.startup_name})]}),e.jsxs("div",{className:"space-y-4 overflow-y-auto flex-1 min-h-0",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{children:"Startup Name"}),e.jsx(w,{"data-testid":"input-edit-startup-name",value:i.startup_name,onChange:g=>h(c=>({...c,startup_name:g.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{children:"Tagline"}),e.jsx(w,{"data-testid":"input-edit-tagline",value:i.tagline,onChange:g=>h(c=>({...c,tagline:g.target.value})),placeholder:"Short one-liner"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{children:"Website"}),e.jsx(w,{"data-testid":"input-edit-website",value:i.website,onChange:g=>h(c=>({...c,website:g.target.value})),placeholder:"https://..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{children:"About"}),e.jsx(Be,{"data-testid":"textarea-edit-description",value:i.description,onChange:g=>h(c=>({...c,description:g.target.value})),rows:4,placeholder:"Full description shown on the startup's public profile and directory cards"})]})]}),e.jsxs(ze,{children:[e.jsx(U,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(U,{"data-testid":"button-save-startup",onClick:u,disabled:n||!i.startup_name.trim(),children:n?"Saving...":"Save Changes"})]})]})}),e.jsx(ft,{open:!!t,onOpenChange:g=>{g||f(null)},children:e.jsxs(vt,{children:[e.jsxs(_t,{children:[e.jsx(St,{children:"Delete Startup"}),e.jsxs(Nt,{children:["Are you sure you want to permanently delete"," ",e.jsx("span",{className:"font-semibold",children:t?.startup_name}),"? This action cannot be undone."]})]}),e.jsxs(Ct,{children:[e.jsx(wt,{children:"Cancel"}),e.jsx($t,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>t&&x(t.id),disabled:$,children:$?"Deleting...":"Delete"})]})]})})]})}function Gt(){const a=Ie(),[d,m]=v.useState(""),i=Ze(d,300),[h,u]=v.useState(1),n=20,[t,f]=v.useState(At),{sortBy:x,sortDir:$,handleSort:g}=et(()=>u(1),"admin-startups-sort",["startup_name","industry","startup_stage","is_public","created_at","completeness"]),c=v.useCallback((s,r)=>{f(C=>{const M={...C,[s]:r};return ge(M),M}),u(1)},[]),W=v.useCallback(()=>{f(xe),ge(xe),u(1)},[]),{data:o,isLoading:A}=lt({search:i||void 0,created_from:t.created_from||void 0,created_to:t.created_to||void 0,industry:t.industry||void 0,funding_stage:t.funding_stage||void 0,country:t.country||void 0,city:t.city||void 0,visibility:t.visibility||void 0,startup_stage:t.startup_stage||void 0}),[X,T]=v.useState(!1),[k,q]=v.useState(null),[D,V]=v.useState({startup_name:"",tagline:"",description:"",website:""}),[G,L]=v.useState(null),[H,p]=v.useState(!1),{data:l,isLoading:ye,isError:je}=Tt(h,n,i,t,x,$),ie=l?.data||[],Y=l?.total??0,fe=Math.ceil(Y/n),{selected:ve,selectAllResults:_e,setSelectAllResults:Z,setAllIds:le,isAllOnPageSelected:Se,isIndeterminate:Ne,toggleRow:Ce,toggleAllOnPage:we,clearSelection:Q}=st(ie.map(s=>s.id)),$e=v.useCallback(async()=>{Z(!0);try{const s=new URLSearchParams;i&&s.set("search",i),Object.entries(t).forEach(([C,M])=>{M&&s.set(C,M)});const r=await S.get(`${N}/admin/startups/ids?${s}`);le(r.ids)}catch{Z(!1)}},[i,t,Z,le]),{data:ne=[]}=ee("industry"),{data:re=[]}=ee("startup_stage"),{data:de=[]}=ee("funding_stage"),Ae=P({mutationFn:({ids:s,action:r})=>S.patch(`${N}/admin/startups/bulk`,{ids:s,action:r}),onSuccess:(s,{action:r})=>{if(r==="nudge")y.success(`Nudge sent to ${s.updated??0} startup${(s.updated??0)!==1?"s":""}`);else{const C=r==="publish"?"published":"unpublished";y.success(s.failed>0?`${s.updated} startup${s.updated!==1?"s":""} ${C}, ${s.failed} failed`:`${s.updated} startup${s.updated!==1?"s":""} ${C}`)}a.invalidateQueries({queryKey:["admin-startups"]}),Q()},onError:R("Bulk update failed")}),Te=P({mutationFn:({ids:s,is_public:r})=>S.patch(`${N}/admin/startups/bulk-visibility`,{ids:s,is_public:r}),onSuccess:(s,{is_public:r})=>{const C=r?"set to public":"set to hidden";y.success(s.failed>0?`${s.updated} startup${s.updated!==1?"s":""} ${C}, ${s.failed} failed`:`${s.updated} startup${s.updated!==1?"s":""} ${C}`),a.invalidateQueries({queryKey:["admin-startups"]}),a.invalidateQueries({queryKey:["admin-startups-summary"]}),Q()},onError:R("Bulk visibility update failed")}),De=P({mutationFn:s=>S.delete(`${N}/admin/startups/bulk`,{ids:s}),onSuccess:s=>{y.success(s.failed>0?`${s.deleted} startup${s.deleted!==1?"s":""} deleted, ${s.failed} failed`:`${s.deleted} startup${s.deleted!==1?"s":""} deleted`),a.invalidateQueries({queryKey:["admin-startups"]}),Q()},onError:R("Bulk delete failed")}),ke=P({mutationFn:({id:s,is_public:r})=>S.patch(`${N}/admin/startups/${s}`,{is_public:r}),onSuccess:()=>{y.success("Visibility updated"),a.invalidateQueries({queryKey:["admin-startups"]})},onError:R("Failed to update visibility")}),ce=P({mutationFn:s=>S.delete(`${N}/admin/startups/${s}`),onSuccess:()=>{y.success("Startup deleted"),a.invalidateQueries({queryKey:["admin-startups"]}),L(null)},onError:R("Failed to delete startup")}),oe=P({mutationFn:()=>
1{if(!k)throw new Error("No startup selected");return S.patch(`${N}/admin/startups/${k.id}`,{startup_name:D.startup_name,tagline:D.tagline||null,description:D.description||null,website:D.website||null})},onSuccess:()=>{y.success("Startup updated"),a.invalidateQueries({queryKey:["admin-startups"]}),T(!1),q(null)},onError:R("Failed to update startup")}),Pe=async s=>{try{const r=await S.post(`${N}/admin/startups/${s.id}/nudge`,{});r.sent?(y.success(`Nudge email sent to ${s.profile?.full_name||"startup owner"}`),a.invalidateQueries({queryKey:["admin-startups"]})):y.info(r.reason==="already_complete"?"Profile is already complete â no nudge needed":"Nudge skipped")}catch{y.error("Failed to send nudge")}},Re=async()=>{p(!0);try{const s=await S.post(`${N}/admin/startups/nudge-all`,{});y.success(`Nudged ${s.emailsSent} startup${s.emailsSent!==1?"s":""} with incomplete profiles`)}catch{y.error("Failed to run nudge job")}finally{p(!1)}},Ee=s=>{q(s),V({startup_name:s.startup_name,tagline:s.tagline||"",description:s.description||"",website:s.website||""}),T(!0)},Fe=[t.visibility&&{label:"Visibility",displayValue:t.visibility==="public"?"Public":t.visibility==="hidden"?"Hidden":"Unset",onRemove:()=>c("visibility","")},t.industry&&{label:"Industry",displayValue:ne.find(s=>s.value===t.industry)?.label??t.industry,onRemove:()=>c("industry","")},t.startup_stage&&{label:"Startup Stage",displayValue:re.find(s=>s.value===t.startup_stage)?.label??t.startup_stage,onRemove:()=>c("startup_stage","")},t.funding_stage&&{label:"Funding Stage",displayValue:de.find(s=>s.value===t.funding_stage)?.label??t.funding_stage,onRemove:()=>c("funding_stage","")},t.country&&{label:"Country",displayValue:t.country,onRemove:()=>c("country","")},t.city&&{label:"City",displayValue:t.city,onRemove:()=>c("city","")},t.created_from&&{label:"From",displayValue:t.created_from,onRemove:()=>c("created_from","")},t.created_to&&{label:"To",displayValue:t.created_to,onRemove:()=>c("created_to","")}].filter(Boolean);return e.jsxs("div",{className:"p-4 sm:p-6 space-y-6",children:[e.jsx(at,{title:"Startups",description:"View and manage all startup profiles on the platform"}),e.jsxs(it,{children:[e.jsx(O,{label:"Total Startups",value:o?.total,trend:o?.trend,icon:e.jsx(he,{className:"h-3.5 w-3.5"}),isLoading:A,color:"#6366f1"}),e.jsx(O,{label:"Public",value:o?.publicCount,trend:o?.publicTrend??o?.trend,icon:e.jsx(se,{className:"h-3.5 w-3.5"}),isLoading:A,onClick:()=>c("visibility",t.visibility==="public"?"":"public"),isActive:t.visibility==="public",color:"#22c55e"}),e.jsx(O,{label:"Hidden",value:o?.hiddenCount,trend:o?.hiddenTrend??o?.trend,icon:e.jsx(ae,{className:"h-3.5 w-3.5"}),isLoading:A,onClick:()=>c("visibility",t.visibility==="hidden"?"":"hidden"),isActive:t.visibility==="hidden",color:"#f59e0b"}),e.jsx(O,{label:"Unset",value:o?.unsetCount,trend:o?.unsetTrend??o?.trend,icon:e.jsx(gt,{className:"h-3.5 w-3.5"}),isLoading:A,onClick:()=>c("visibility",t.visibility==="unset"?"":"unset"),isActive:t.visibility==="unset",color:"#94a3b8"}),o?.byStage&&Object.keys(o.byStage).length>0&&Object.entries(o.byStage).sort((s,r)=>r[1]-s[1]).map(([s,r])=>e.jsx(O,{label:s.charAt(0).toUpperCase()+s.slice(1).replace(/_/g," "),value:r,trend:o.byStageTrend?.[s]??o.trend,icon:e.jsx(he,{className:"h-3.5 w-3.5"}),isLoading:A,onClick:()=>c("startup_stage",t.startup_stage===s?"":s),isActive:t.startup_stage===s,color:"#a78bfa"},s))]}),e.jsxs(Je,{children:[e.jsxs(We,{children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("div",{children:[e.jsx(Xe,{children:"All Startups"}),e.jsxs(Ge,{children:[Y," total startups"]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative",children:[e.jsx(bt,{className:"absolute start-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(w,{"data-testid":"input-search-startups",placeholder:"Search startups...",value:d,onChange:s=>{m(s.target.value),u(1)},className:"ps-8 w-[220px]"})]}),e.jsxs(U,{variant:"outline",size:"sm",onClick:Re,disabled:H,className:"gap-1.5",title:"Send profile completion emails to all eligible startups",children:[e.jsx(be,{className:"h-4 w-4"}),H?"Nudging...":"Nudge eligible"]}),e.jsx(U,{variant:"outline",size:"icon",onClick:()=>a.invalidateQueries({queryKey:["admin-startups"]}),children:e.jsx(yt,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"pt-2",children:e.jsx(Dt,{filters:t,updateFilter:c,clearAllFilters:W,activeFilters:Fe,industryOptions:ne,startupStageOptions:re,fundingStageOptions:de})})]}),e.jsx(Ye,{children:e.jsx(kt,{startups:ie,isLoading:ye,isError:je,total:Y,page:h,totalPages:fe,sortBy:x,sortDir:$,onSort:g,selectedIds:ve,selectAllResults:_e,isAllPageSelected:Se,isIndeterminate:Ne,onToggleRow:Ce,onTogglePage:we,onSelectAllResults:$e,onClearSelection:Q,onBulkAction:(s,r)=>Ae.mutate({ids:s,action:r}),onBulkSetPublic:(s,r)=>Te.mutate({ids:s,is_public:r}),onBulkDelete:s=>De.mutate(s),onToggleVisibility:(s,r)=>ke.mutate({id:s,is_public:!r}),onNudge:Pe,onOpenEdit:Ee,onSetDeleteTarget:L,onPageChange:u})})]}),e.jsx(Pt,{isEditOpen:X,setIsEditOpen:T,editTarget:k,editForm:D,setEditForm:V,onSaveEdit:()=>oe.mutate(),isEditPending:oe.isPending,deleteTarget:G,setDeleteTarget:L,onConfirmDelete:s=>ce.mutate(s),isDeletePending:ce.isPending})]})}
1export{Gt 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.