import{c as e,o as t}from"./uiIdentityOverlay-Ba7GNj7m.js";import{n,t as r}from"./button-DO50qOGv.js";import{t as i}from"./jsx-runtime-CyI9ICYU.js";import{D as a,L as o,O as s,T as c,k as l,w as u}from"./index-N9uRPknx.js";var d=i(),f=t({id:`sidebar.project-group`,c3ComponentId:`c3-113`,c3ComponentLabel:`sidebar`});function p({group:t,expandedGroups:i,onToggleExpandedGroup:p,renderChatRow:m,chatsPerProject:h,onNewLocalChat:g,onRemoveProject:_,isConnected:v,startingLocalPath:y,onMergeSession:b,onOpenCoordination:x,onOpenProject:S}){let{groupKey:C,localPath:w,chats:T}=t,E=i.has(C),D=E?T:T.slice(0,h),O=T.length>h,k=v===!1,A=y===w,j=!!(b||x||S||g||_),M=`/project/${C}`,N=c(w);function P(e){S&&(e.preventDefault(),S(C))}let F=(0,d.jsx)(`a`,{href:M,"aria-label":`Open ${N} overview`,className:n(`sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between`,`rounded-lg text-left transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),onClick:P,children:(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`span`,{className:`relative size-3.5 shrink-0`,children:(0,d.jsx)(o,{className:`translate-y-[1px] size-3.5 shrink-0 text-slate-400 dark:text-slate-500 transition-all duration-200`})}),(0,d.jsxs)(a,{children:[(0,d.jsx)(l,{asChild:!0,children:(0,d.jsx)(`span`,{className:`truncate max-w-[150px] whitespace-nowrap text-sm text-slate-500 dark:text-slate-400`,children:N})}),(0,d.jsx)(s,{side:`right`,sideOffset:4,children:w})]})]})});return(0,d.jsxs)(`div`,{...e(f),className:`group/section`,children:[j?(0,d.jsx)(u,{onMergeSession:b?()=>b(C):void 0,mergeDisabled:k,onOpenCoordination:x?()=>x(C):void 0,onOpenProject:S?()=>S(C):void 0,onNewChat:g?()=>g(w):void 0,newChatDisabled:k||A,onRemove:_?()=>_(C):void 0,children:F}):F,(D.length>0||O)&&(0,d.jsxs)(`div`,{className:`space-y-[2px] mb-2 `,children:[D.map(m),O&&(0,d.jsx)(r,{variant:`link`,size:`sm`,onClick:()=>p(C),className:`pl-2.5 py-1 text-xs text-muted-foreground h-auto`,children:E?`Show less`:`Show more (${T.length-h})`})]})]})}function m({workspaceGroups:e,expandedGroups:t,onToggleExpandedGroup:n,renderChatRow:r,chatsPerProject:i,onNewLocalChat:a,onRemoveProject:o,isConnected:s,startingLocalPath:c,onMergeSession:l,onOpenCoordination:u,onOpenProject:f}){return(0,d.jsx)(d.Fragment,{children:e.map(e=>(0,d.jsx)(p,{group:e,expandedGroups:t,onToggleExpandedGroup:n,renderChatRow:r,chatsPerProject:i,onNewLocalChat:a,onRemoveProject:o,isConnected:s,startingLocalPath:c,onMergeSession:l,onOpenCoordination:u,onOpenProject:f},e.groupKey))})}export{m as LocalProjectsSection};