1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[45105,98678],{16650:(e,t,a)=>{a.d(t,{A:()=>u});var s=a(12115),r=a(37882),n=a(37777),i=a(90056),l=a(24851),d=a(30982),o=a(83301),c=a(15872);let u=function(){let[e,t]=(0,s.useState)([]),[a,u]=(0,s.useState)(!1),[m,x]=(0,s.useState)({}),[p,h]=(0,s.useState)(null),[f,g]=(0,s.useState)(null),[b,v]=(0,s.useState)(!0),{data:j,status:N}=(0,r.useSession)(),w=j?.user?.accountSelected?.type==="organization",y=(0,s.useCallback)(async()=>{if(!w){t([]),u(!1),x({}),h(null),g(null),v(!1);return}v(!0);try{let e=await (0,n.M)(),a=(0,l.Qv)(e,{expectList:!0});if(u(a),t(a?[]:e.data),!d.nc){x({}),h(null),g(null);return}let s=await (0,i.C)(),r=(0,l.a_)([s],{expectList:!0});g(r),x(r?{}:s.data.reduce((e,t)=>(t?.agentId&&(e[t.agentId]=t),e),{})),h(r?null:s.summary??null)}finally{v(!1)}},[w]);(0,s.useEffect)(()=>{if(!w)return;let e=()=>y();return window.addEventListener(c.D,e),()=>window.removeEventListener(c.D,e)},[w,y]),(0,s.useEffect)(()=>{"loading"!==N&&y()},[y,N]);let A=(0,s.useMemo)(()=>e.map(e=>{let t=(0,l.b5)(e,m[e?.id],f);return{...e,activity:t,lastActivityAt:(0,o.sw)(t)}}),[e,m,f]),E=(0,s.useMemo)(()=>{if(f)return null;if(Number.isFinite(p?.pendingProposals))return{total:p.pendingProposals,atLeast:!1};let e=0,t=!1,a=!1;for(let s of Object.values(m)){let r=s?.pendingDecisions;
1if(!Number.isFinite(r)){a=!0;continue}t=!0,e+=r}return t?{total:e,atLeast:a}:null},[p,m,f]);return{agents:A,agentsError:a,activityError:f,loading:b,enabled:w,reload:y,pendingDecisions:E}}},19824:(e,t,a)=>{a.d(t,{pq:()=>r});var s=a(87358);s.env.NEXT_PUBLIC_MANDATORY_PAYMENT_CUTOFF_DATE,s.env.NEXT_PUBLIC_MANDATORY_PAYMENT_GATE_ENABLED;let r=["PENDING_PAYMENT","PAYMENT_FAILED"]},37777:(e,t,a)=>{a.d(t,{M:()=>r});var s=a(9339);let r=(0,s.createServerReference)("008b22728f249848442fb1b347568b64225268ae1d",s.callServer,void 0,s.findSourceMapURL,"getOrganizationAgents")},42083:(e,t,a)=>{a.d(t,{Io:()=>l,R8:()=>i,gV:()=>n,iG:()=>d,l$:()=>r,pM:()=>o});var s=a(19824);let r="/chat/astro",n="/astro",i=Object.freeze({UNIFIED_CHAT:"astro",APPS_GRID:"menu"}),l=i.UNIFIED_CHAT;function d(e={}){let{accountType:t,subscriptionStatus:a=null}=e??{};return!("personal"===t||s.pq.includes(a))}function o(e,t={}){return e===i.APPS_GRID?"/apps":d(t)?r:n}},43629:(e,t,a)=>{a.d(t,{Tabs:()=>l,TabsContent:()=>c,TabsList:()=>d,TabsTrigger:()=>o});var s=a(95155),r=a(12115),n=a(16639),i=a(86190);let l=n.bL,d=r.forwardRef(({className:e,...t},a)=>(0,s.jsx)(n.B8,{ref:a,className:(0,i.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));d.displayName=n.B8.displayName;let o=r.forwardRef(({className:e,...t},a)=>(0,s.jsx)(n.l9,{ref:a,className:(0,i.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:font-semibold data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));o.displayName=n.l9.displayName;let c=r.forwardRef(({className:e,...t},a)=>(0,s.jsx)(n.UC,{ref:a,className:(0,i.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));c.displayName=n.UC.displayName},45105:(e,t,a)=>{a.d(t,{A:()=>ec});var s=a(95155),r=a(72034),n=a(73321),i=a(12115),l=a(20740),d=a(85705),o=a(86190),c=a(35625);a(37882);let u=Object.freeze(["id","name","profileImageURL"]);var m=a(96271),x=a(96205),p=a(99701),h=a(98500),f=a.n(h),g=a(94938),b=a(68459),v=a(7810),j=a(48106),N=a(41313),w=a(33810),y=a(50910),A=a(27264),E=a(93279),S=a(9339);let C=(0,S.createServerReference)("40b84ba78cf8869feb57056a78a13b92a8ac844bbe",S.callServer,void 0,S.findSourceMapURL,"leaveSpace"),k=(0,S.createServerReference)("405d91c18b7fb64c0e664144458cf991c6e8b70e11",S.callServer,void 0,S.findSourceMapURL,"leaveTopic"),D=(e,t,a)=>{t&&(e.preventDefault(),t(a))},T=({href:e,chat:t,handleChatOpen:a,id:r,lastMessage:n,sender:i,receiver:l,isSenderOnline:d,isClient:o})=>{let c=(0,y.c)("CHAT");if(!n||!n.sender)return null;let{invitation:u}=n||null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex min-w-0 flex-1 gap-3",children:(0,s.jsxs)(f(),{className:"flex min-w-0 w-full items-center gap-4",href:e,onClick:e=>D(e,a,t),children:[d?(0,s.jsx)(p.f,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"left"},variant:"dot",children:(0,s.jsx)(g.A,{alt:i?i.user.name:l.user.name,src:i?i.user.profilePicture:l.user.profilePicture})}):(0,s.jsx)(g.A,{alt:i?i.user.name:l.user.name,src:i?i.user.profilePicture:l.user.profilePicture}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col items-start overflow-hidden",children:[(0,s.jsx)("h3",{className:"font-semibold truncate w-full",children:i?i.user.name:l.user.name}),u?(0,s.jsx)("div",{className:"flex min-w-0 w-full flex-row items-start overflow-hidden",children:(0,s.jsxs)("p",{className:"text-xs text-muted-foreground w-full whitespace-nowrap overflow-ellipsis overflow-hidden",children:["Invitation to"," ",(0,s.jsx)("span",{className:"font-bold",children:n.content})]})}):n.attachment?(0,s.jsx)("p",{className:"text-xs text-muted-foreground w-full truncate overflow-none whitespace-nowrap overflow-ellipsis",children:"image"===n.attachment.type?(0,s.jsx)("span",{className:"font-semibold",children:" \uD83D\uDCF7 Photo"}):(0,s.jsx)("span",{className:"font-semibold",children:" \uD83C\uDFA5 Video"})}):(0,s.jsx)("p",{className:"text-xs text-muted-foreground w-full truncate overflow-none whitespace-nowrap overflow-ellipsis",children:n.content})]})]})}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[(0,s.jsx)("p",{className:"whitespace-nowrap text-xs text-muted-foreground",children:o&&(0,s.jsx)(x.default,{value:n.timestamp,strict:!0})}),(0,s.jsxs)("div",{className:"flex gap-1",children:[n.sender.id!==l.user.id&&l.unreadCount>0&&(0,s.jsx)("span",{className:"font-bold text-xs bg-destructive text-destructive-foreground rounded-full px-1.5 py-0.5",children:l.unreadCount}),(0,s.jsx)(A.default,{actions:[{label:"Delete chat",message:c("DELETE_CHAT_MESSAGE"),onClick:E._,icon:(0,s.jsx)(b.A,{size:20,className:"text-primary hover:text-primary-500"})}],chatId:r})]})]})]})},R=({href:e,chat:t,handleChatOpen:a,id:r,name:n,lastMessage:i,receiver:l,currentUser:d,type:c})=>{let u=l?.unreadCount??0;return(0,s.jsxs)("div",{className:"flex min-w-0 gap-3 items-center w-full justify-between",children:[(0,s.jsxs)(f(),{className:"flex min-w-0
1w-full gap-4 items-center",href:e,onClick:e=>D(e,a,t),children:[(0,s.jsxs)("div",{className:"relative shrink-0",children:[(0,s.jsx)(g.A,{...(0,o.nj)(n),alt:n,variant:"rounded"}),(0,s.jsx)(w.TooltipProvider,{children:(0,s.jsxs)(w.Tooltip,{children:[(0,s.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,s.jsx)("div",{className:"absolute -bottom-2 -right-2 bg-muted text-muted-foreground border p-1 rounded-full",children:"space-chat"===c?(0,s.jsx)(v.A,{size:14}):(0,s.jsx)(j.A,{size:14})})}),(0,s.jsx)(w.TooltipContent,{side:"right",children:(0,s.jsx)("p",{children:"space-chat"===c?"Space Chat":"Topic"})})]})})]}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col items-start overflow-hidden",children:[(0,s.jsx)("h3",{className:"font-semibold truncate w-full",children:n}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground w-full truncate overflow-none whitespace-nowrap overflow-ellipsis line-clamp-2",children:[(0,s.jsxs)("span",{className:"font-semibold",children:[i?.sender?.id===d.id?"You":i?.sender?.name,":"]})," ",i.attachment?(0,s.jsx)("span",{className:"font-semibold",children:"image"===i.attachment.type?(0,s.jsx)("span",{className:"font-semibold",children:" \uD83D\uDCF7 Photo"}):(0,s.jsx)("span",{className:"font-semibold",children:" \uD83C\uDFA5 Video"})}):i.content]})]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[u>0&&(0,s.jsx)("span",{className:"font-bold text-xs bg-destructive text-destructive-foreground rounded-full px-1.5 py-0.5",children:u}),(0,s.jsx)(A.default,{actions:[{label:"space-chat"===c?"Leave space":"Leave topic",onClick:"space-chat"===c?C:k,icon:(0,s.jsx)(N.A,{size:20})}],chatId:r})]})]})},P=({currentUser:e,chat:t,handleChatOpen:a=null})=>{let r=(0,n.usePathname)(),{id:d,participants:o,lastMessage:c,type:u,name:x}=t,{onlineUsers:p}=(0,l.F)({currentUser:e}),[h,f]=(0,i.useState)(!1),g=o.find(t=>t.user.id!==e.id),b=o.find(t=>t.user.id===e.id),v="space-chat"===u||"topic-chat"===u?d:g?g.user.id:b.user.id,j=r.includes(v);(0,i.useEffect)(()=>{f(!0)},[]);let N=!!g&&p?.some(e=>e.id===g?.user.id);if(!c)return null;let w=(0,m.gU)(t,e?.id);return(0,s.jsx)("div",{className:`hover:bg-muted p-2 ${j&&"bg-muted"} rounded-lg`,children:(0,s.jsx)("div",{className:"flex w-full gap-2 py-1",children:((e,t)=>{switch(e){case"space-chat":case"topic-chat":return(0,s.jsx)(R,{...t});case"private-chat":return(0,s.jsx)(T,{...t});default:return null}})(u,{href:w,chat:t,handleChatOpen:a,id:d,lastMessage:c,sender:g,receiver:b,isSenderOnline:N,isClient:h,name:x,currentUser:e,type:u})})})};var L=a(68189),_=a(57657),I=a(98678),M=a(92018),O=a(37618);let U=({isPreview:e,fab:t=!1})=>{let a=(0,n.useRouter)(),[r,l]=(0,i.useState)(!1),d=(0,y.c)("CHAT"),o=()=>{e?l(!0):a.push("/chat/compose")};return t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(L.Button,{variant:"ghost",size:"icon",className:"fixed bottom-24 right-4 z-40 h-12 w-12 rounded-full bg-primary-100 text-primary shadow-lg transition-colors hover:bg-primary hover:text-primary-foreground active:scale-95 md:hidden ","aria-label":d("COMPOSE_MESSAGE"),onClick:o,children:(0,s.jsx)(M.A,{className:"h-[22px] w-[22px]"})}),(0,s.jsx)(_.Dialog,{open:r,onOpenChange:l,children:(0,s.jsx)(_.DialogContent,{className:"font-sans",children:(0,s.jsx)(I.c5,{isPreview:!0})})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(w.TooltipProvider,{children:(0,s.jsxs)(w.Tooltip,{children:[(0,s.jsx)(w.TooltipTrigger,{asChild:!0,children:(0,s.jsx)(L.Button,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full bg-primary-100 text-primary transition-colors hover:bg-primary hover:text-primary-foreground ","aria-label":d("COMPOSE_MESSAGE"),onClick:o,children:(0,s.jsx)(O.A,{className:"h-[18px] w-[18px]"})})}),(0,s.jsx)(w.TooltipContent,{side:"left",children:(0,s.jsx)("p",{children:d("COMPOSE_MESSAGE")})})]})}),(0,s.jsx)(_.Dialog,{open:r,onOpenChange:l,children:(0,s.jsx)(_.DialogContent,{className:"font-sans",children:(0,s.jsx)(I.c5,{isPreview:!0})})})]})};var z=a(61878),F=a(6296),H=a(58276),$=a(18310),G=a(67192),Y=a(5772),B=a(45049),Q=a(42083);let V=()=>{let e=(0,y.c)("applications.chat.pane"),t=(0,n.usePathname)(),a=/\/chat(\/astro)?\/?$/.test(t??""),r=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary-100",children:[(0,s.jsx)(Y.default,{src:"/Icons/Astro_slive.svg",alt:"",width:24,height:24,unoptimized:!0,"aria-hidden":"true",className:"dark:hidden"}),(0,s.jsx)(Y.default,{src:"/Icons/Astro_slive-dark.svg",alt:"",width:24,height:24,unoptimized:!0,"aria-hidden":"true",className:"hidden dark:block"})]}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col items-start",children:[(0,s.jsx)("h3",{className:"w-full truncate font-semibold dark:text-foreground",children:e("astro.name")}
1),(0,s.jsx)("p",{className:"w-full truncate text-xs text-muted-foreground",children:e("astro.tagline")})]}),(0,s.jsx)(B.A,{size:13,"aria-hidden":"true",className:"shrink-0 rotate-45 text-muted-foreground dark:text-muted-foreground"})]});return(0,s.jsx)("div",{className:"px-0",children:(0,s.jsx)(f(),{href:Q.l$,"aria-current":a?"page":void 0,className:(0,o.cn)("flex items-center gap-4 rounded-lg p-2 hover:bg-muted dark:hover:bg-muted","flex",a&&"chat-row-active"),children:r})})};var q=a(93053);let W="/chat/decisions",X=({count:e=null,atLeast:t=!1})=>{let a=(0,y.c)("applications.chat.pane"),r=((0,n.usePathname)()||"").endsWith(W),i=Number.isFinite(e)&&e>0;return(0,s.jsxs)(f(),{href:W,"aria-current":r?"page":void 0,className:(0,o.cn)("flex w-full items-center gap-4 rounded-lg p-2 transition-colors","hover:bg-muted dark:hover:bg-muted","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",r&&"chat-row-active"),children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary-100",children:(0,s.jsx)(q.A,{className:"h-5 w-5 text-primary"})}),(0,s.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col items-start",children:[(0,s.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold dark:text-foreground",children:a("decisions.title")}),i&&(0,s.jsx)("span",{className:"me-1 grid h-5 min-w-[20px] shrink-0 place-items-center rounded-full bg-primary-500 px-1 text-[11px] font-bold leading-none tabular-nums text-primary-foreground","aria-label":a(t?"decisions.badgeAtLeast":"decisions.badgeExact",{count:e}),children:t?`${e}+`:e})]}),(0,s.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground dark:text-muted-foreground",children:a("decisions.subtitle")})]}),(0,s.jsx)(B.A,{size:13,"aria-hidden":"true",className:"shrink-0 rotate-45 text-muted-foreground "})]})};var J=a(48368),K=a(73943),Z=a(24851),ee=a(83301);let et=({agent:e})=>{let t=(0,y.c)("applications.chat.pane.agents"),a=(0,n.usePathname)(),r=e?.activity??null,i=(0,Z.NA)(r)===Z.eG.UNAVAILABLE,l=a?.includes(`/chat/agent/${e?.id}`),d=r?.pendingDecisions,c=Number.isFinite(d)&&d>0,u=null;if(c&&r?.oldestPendingAt){let e=new Date(r.oldestPendingAt).getTime();if(Number.isFinite(e)){let t=Math.floor((Date.now()-e)/864e5);t>=1&&(u=t)}
1}let m=e?.role||"";i?m=t("unavailable"):r?.openQuestionsCount>0?m=t("asking",{count:r.openQuestionsCount}):c?m=null!==u?`${t("decidingShort",{count:d})} \xb7 ${t("oldestDays",{days:u})}`:t("deciding",{count:d}):r?.pendingProposalsCount>0&&(m=t("pending",{count:r.pendingProposalsCount}));let p=!i&&(0,Z.ne)(r?.lastDigestAt)&&!ee.p8.includes(r?.lastDigest?.status);return(0,s.jsxs)(f(),{href:`/chat/agent/${e?.id}`,"aria-current":l?"page":void 0,className:(0,o.cn)("flex items-center gap-4 rounded-lg p-2","hover:bg-muted dark:hover:bg-muted",l&&"chat-row-active"),children:[(0,s.jsxs)("div",{className:"relative shrink-0",children:[(0,s.jsx)(K.A,{variant:"mark",emoji:e?.avatar?.emoji,color:/^#[0-9a-fA-F]{6}$/.test(e?.color??"")?e.color:void 0,size:"sm",dimmed:i}),c&&(0,s.jsx)("span",{"aria-label":t("needsDecision"),title:t("needsDecision"),role:"status",className:(0,o.cn)("absolute -right-0.5 -top-0.5 h-3 w-3 rounded-full","border-2 border-background bg-primary")}),(0,s.jsx)("span",{role:"img","aria-label":t("badgeLabel"),title:t("badgeLabel"),className:"absolute -bottom-2 -right-2 flex items-center justify-center",children:(0,s.jsx)(Y.default,{src:"/Images/agent_badge.svg",alt:"",width:22,height:22,unoptimized:!0,"aria-hidden":"true"})})]}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col items-start",children:[(0,s.jsxs)("div",{className:"flex w-full items-baseline gap-2",children:[(0,s.jsx)("h3",{className:"min-w-0 flex-1 truncate font-semibold ",children:e?.name}),e?.lastActivityAt?(0,s.jsx)("span",{className:"shrink-0 whitespace-nowrap text-[11px] text-muted-foreground dark:text-muted-foreground",children:(0,s.jsx)(x.default,{value:e.lastActivityAt,fallback:"",strict:!0})}):null]}),m&&(0,s.jsx)("p",{className:(0,o.cn)("w-full truncate text-xs",i?"text-destructive":"text-muted-foreground dark:text-muted-foreground"),children:m}),p&&(0,s.jsxs)("p",{className:"flex w-full items-center gap-1 text-xs text-muted-foreground dark:text-muted-foreground",children:[(0,s.jsx)(J.A,{"aria-hidden":"true",className:"h-3.5 w-3.5 shrink-0 text-primary"}),(0,s.jsx)("span",{className:"truncate",children:t("reported")})]})]})]})};var ea=a(33210),es=a(64479),er=a(43629),en=a(1732);let ei=({value:e,onValueChange:t,unreadCount:a=0,agentCount:r=null,showAgents:n=!0,showTodo:i=!0})=>{let l=(0,y.c)("applications.chat.pane.filters"),d=(0,m.RJ)(e),c=m.nu.includes(d),u=n?m.TY:m.TY.filter(e=>e!==m.DS.AGENTS),x=i?m.nu:m.nu.filter(e=>e!==m.DS.TODO);return(0,s.jsxs)("div",{className:"flex w-full items-center gap-1.5",children:[(0,s.jsx)(er.Tabs,{value:c?"":d,onValueChange:t,className:"min-w-0 flex-1",children:(0,s.jsx)(er.TabsList,{"aria-label":l("label"),className:"h-auto w-full justify-start gap-1.5 bg-transparent p-0",children:u.map(e=>{let t=e===m.DS.UNREAD?a:e===m.DS.AGENTS?r:null,n=e===m.DS.UNREAD?l("unreadScope"):void 0;return(0,s.jsxs)(er.TabsTrigger,{value:e,title:n,className:(0,o.cn)("shrink-0 rounded-full border px-2.5 py-1 text-xs font-medium","border-border bg-background text-muted-foreground","dark:border-border text-muted-foreground","data-[state=active]:border-primary data-[state=active]:bg-primary","data-[state=active]:text-primary-foreground data-[state=active]:shadow-none"),children:[l(e),t>0&&(0,s.jsx)("span",{className:"ms-1.5 font-semibold",children:t})]},e)})})}),c?(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1 rounded-full border border-primary bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground",children:[(0,s.jsx)("span",{children:l(d)}),(0,s.jsx)("button",{type:"button","aria-label":l("clear"),title:l("clear"),onClick:()=>t(m.DS.ALL),className:"rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70",children:(0,s.jsx)(ea.A,{"aria-hidden":"true",className:"h-3 w-3"})})]}):(0,s.jsxs)(en.AM,{children:[(0,s.jsx)(en.Wv,{asChild:!0,children:(0,s.jsx)(L.Button,{size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0","aria-label":l("more"),title:l("more"),children:(0,s.jsx)(es.A,{"aria-hidden":"true",className:"h-4 w-4"})})}),(0,s.jsxs)(en.hl,{align:"end",className:"w-48 space-y-1.5",children:[(0,s.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:l("more")}),x.map(e=>(0,s.jsx)(L.Button,{size:"sm",variant:"outline",className:"h-7 w-full justify-start rounded-full px-3 text-xs",onClick:()=>t(e),children:l(e)},e))]})]})]})};var el=a(63040),ed=a(16650);let eo=({entries:e=[],status:t,currentUser:a,type:n="directMessage",handleChatOpen:i=null})=>{let l=(0,y.c)("CHAT");return"pending"===t?(0,s.jsxs)("div",{className:"p-4 space-y-3",children:[(0,s.jsx)(r.A,{variant:"text",width:100,height:23}),Array.from({length:10},(e,t)=>(0,s.jsxs)("div",{className:"flex gap-2 border-b py-2",children:[(0,s.jsx)(r.A,{variant:"circular",width:40,height:40}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)(r.A,{variant:"text",width:100,height:18}),(0,s.jsx)(r.A,{variant:"text",width:50,height:18})]})]},t))]}):"error"===t?(0,s.jsxs)("div",{className:"text-center p-10",children:[(0,s.jsx)("p",{className:"font-semibold text-lg",children:l("ERROR")}),(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:l("TRY_AGAIN")}),(0,s.jsx)("button",{className:"text-primary border border-primary rounded-md px-2 py-0.5 text-xs mt-2",onClick:()=>window.location.reload(),children:l("REFRESH")})]}):"success"===t?0===e.length?null:(0,s.jsx)("div",{className:"pt-0 md:pb-0 space-y-2",children:(0,s.jsx)(H.ScrollArea,{className:"divide-y divide-border h-full [&_[data-radix-scroll-area-viewport]>div]:!block",children:e.map(e=>"agent"===e.kind?(0,s.jsx)(et,{agent:e.agent},e.key):(0,s.jsx)(P,{currentUser:a,chat:e.chat,type:n,handleChatOpen:i},e.key))})}):void 0},ec=({currentUser:e,isPreview:t=!1,handleChatOpen:a=null,className:r,collapsed:x=!1})=>{(({currentUser:e})=>{e=e.user||e;let{chatSocket:t,isChatConnected:a}=(0,d.F)(),s=(0,c.jE)(),{chats:r,refetchChats:m}=(0,l.F)({currentUser:e}),x=(0,n.usePathname)(),p=(0,i.useRef)(x);p.current=x,(0,i.useEffect)(()=>
1{if(!t)return;let a=e=>{s.setQueryData(["online-users"],Array.isArray(e)?e.map(e=>{let t={};if(!e||"object"!=typeof e)return t;for(let a of u)void 0!==e[a]&&(t[a]=e[a]);return t}):[])},r=e=>{(0,o.eT)(),m()},n=e=>{(0,o.eT)(),m()},i=(t,a)=>{a&&(e&&e.id!==t.sender.id&&(0,o.eT)(),s.setQueryData(["chats"],s=>{if(!s||!s.Data||0===s.Data.length)return s;let r=[...s.Data],n=r.findIndex(e=>e.id===a);if(-1===n)r.push({id:a,participants:[{user:{id:t.sender.id,name:t.sender.name,profilePicture:t.sender.profilePicture},unreadCount:0}],lastMessage:t});else{let s=r[n],i=e?.id===t.sender.id,l=p.current?.includes(a);r[n]={...s,participants:(s.participants||[]).map(t=>i||l||t?.user?.id!==e?.id?t:{...t,unreadCount:(t.unreadCount||0)+1}),lastMessage:t}}return{...s,Data:r}}))},l=e=>i(e,e?.topicId),d=e=>i(e,e?.chatId),c=t=>{(e=e.user||e)&&e.id!==t.sender.id&&(0,o.eT)(),s.setQueryData(["chats"],e=>{e&&e.Data&&e.Data.length;let a=[...e.Data],s=(a=a.filter(e=>null!==e.lastMessage)).findIndex(e=>e.id===t.chatId);if(-1===s){let e={id:t.chatId,participants:[{user:{id:t.sender.id,name:t.sender.name,profilePicture:t.sender.profilePicture},unreadCount:0},{user:{id:t.receiver.id,name:t.receiver.name,profilePicture:t.receiver.profilePicture},unreadCount:0}],lastMessage:t};a.push(e)}else{let e=a[s];
1e.participants.forEach(e=>{e.user.id==t.receiver.id&&(e.unreadCount=(e.unreadCount||0)+1)});let r={...e,lastMessage:t};a[s]=r}return a.sort((e,t)=>new Date(t.lastMessage?.timestamp)-new Date(e.lastMessage?.timestamp)),{...e,Data:a}})};return t.on("users-online",a),t.on("new-space",r),t.on("new-topic",n),t.on("topic-chat",l),t.on("space-chat",d),t.on("message-chat-private",c),()=>{t.off("users-online",a),t.off("new-space",r),t.off("new-topic",n),t.off("topic-chat",l),t.off("space-chat",d),t.off("message-chat-private",c)}},[t])})({currentUser:e});let{chats:p,chatsStatus:h}=(0,l.F)({currentUser:e}),f=p?.Data||[],g="/chat",[b,v]=(0,i.useState)(!1),j=(0,$.I)(),[N,w]=(0,i.useState)(""),[A,E]=(0,i.useState)(m.DS.ALL),S=(0,y.c)("CHAT"),C=(0,y.c)("applications.chat.pane"),k=(0,y.c)("applications.chat.pane.filters"),D=(0,y.c)("applications.chat.pane.agents"),T=(0,i.useMemo)(()=>(0,m.g)(f,e?.id),[f,e?.id]),R=(0,i.useMemo)(()=>{let t=(0,m.KH)(f,A,e?.id);return(0,m.I7)(t,N,e?.id).filter(m.N_)},[f,A,N,e?.id]),{agents:P,agentsError:L,enabled:_,pendingDecisions:I}=(0,ed.A)(),M=_&&(A===m.DS.ALL||A===m.DS.AGENTS),O=_&&(A===m.DS.ALL||A===m.DS.TODO),H=(0,i.useMemo)(()=>{if(!M)return[];let e=N?.trim?.().toLowerCase();return e?P.filter(t=>t?.name?.toLowerCase?.().includes(e)||t?.role?.toLowerCase?.().includes(e)):P},[P,M,N]),Y=(0,i.useMemo)(()=>(0,m.Qc)([...R.map(t=>({kind:"chat",key:`chat-${t.id}`,at:(0,m.P6)(t),weight:(0,m.Q1)(t,e?.id)?Z.NP.UNREAD_MESSAGE:Z.NP.NONE,chat:t})),...H.map(e=>({kind:"agent",key:`agent-${e.id}`,at:e.lastActivityAt,weight:(0,Z.OM)(e.activity),agent:e}))]),[R,H,e?.id]);(0,i.useEffect)(()=>((0,el.$D)([{type:"conversation_list",items:Y.map(t=>"agent"===t.kind?{kind:"agent",name:t.agent?.name??"",unread:!1}:{kind:"chat",name:(0,m.iS)(t.chat,e?.id),unread:(0,m.Q1)(t.chat,e?.id),href:(0,m.gU)(t.chat,e?.id)})}]),()=>(0,el.$D)([{type:"conversation_list",items:null}])),[Y,e?.id]);let B=(0,n.usePathname)(),Q=e=>e?B.includes(`${g}/`):B.includes(g),q=Q()?"w-full md:w-[340px]":"w-full",W=x&&!b;if((0,i.useEffect)(()=>{let e=()=>{v(window.innerWidth<900)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),!Q(!0)||!b)return(0,s.jsxs)(G.P.aside,{"data-tour":"messages-panel",initial:!1,animate:{marginInlineStart:W?-340:0,opacity:+!W},transition:j?{duration:.12}:{marginInlineStart:{type:"spring",stiffness:260,damping:30,mass:.8},opacity:W?{duration:.16,delay:.14,ease:"easeIn"}:{duration:.18,ease:"easeOut"}},"aria-hidden":W||void 0,inert:W||void 0,className:(0,o.cn)(`${q} bg-background [scrollbar-gutter:stable_both-edges] [&::-webkit-scrollbar-thumb]:bg-muted-foreground [&::-webkit-scrollbar-track]:bg-transparent md:border-e md:border-border dark:md:border-border dark:[&::-webkit-scrollbar-thumb]:bg-muted-foreground ${!t&&"overflow-y-auto"} custom-scrollbar pb-12 md:pb-0`,x&&"max-md:!ms-0 max-md:!opacity-100"),children:[(0,s.jsxs)("div",{className:(0,o.cn)("sticky top-0 left-0 z-20 w-full bg-background px-2 py-3",r),children:[(0,s.jsxs)("div",{className:"mb-4 hidden justify-between items-center md:flex",children:[(0,s.jsx)("h2",{className:"text-2xl font-bold",children:S("TITLE")}),(0,s.jsx)(U,{isPreview:t})]}),(0,s.jsx)("div",{className:"mb-3 mt-0 md:mt-4",children:(0,s.jsxs)("form",{className:"relative",role:"search",children:[(0,s.jsx)("input",{type:"text","aria-label":S("SEARCH_PLACEHOLDER"),className:"bg-white-base w-full h-8 px-4 pr-10 rounded-xl py-5 placeholder:text-muted-foreground placeholder:text-md focus:outline-none focus:ring-2 focus:ring-stellarPrimary focus:border-transparent",placeholder:S("SEARCH_PLACEHOLDER"),value:N,onChange:e=>w(e.target.value)}),(0,s.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none",children:(0,s.jsx)(z.A,{size:"24px",color:"#495363"})})]})}),(0,s.jsx)(ei,{value:A,onValueChange:E,unreadCount:T,showAgents:_,agentCount:L?null:P.length,showTodo:_})]}),(0,s.jsxs)("div",{className:"space-y-0 px-2",children:[A===m.DS.ALL&&(0,s.jsx)(V,{}),O&&(0,s.jsx)(X,{count:I?.total??null,atLeast:I?.atLeast===!0}),M&&L&&(0,s.jsx)("div",{className:"px-2 py-2",children:(0,s.jsx)("p",{className:"text-xs text-destructive",children:D("loadFailed")})}),Y.length>0?(0,s.jsx)(eo,{entries:Y,status:"success",currentUser:e,handleChatOpen:a}):"success"===h?!L&&(0,s.jsx)("div",{className:"p-4 pt-0 md:pb-0",children:(0,s.jsx)("p",{className:"text-center text-sm text-muted-foreground dark:text-muted-foreground",children:N.length>0?(0,s.jsxs)(s.Fragment,{children:[S("NO_RESULTS")," ",(0,s.jsx)("span",{className:"font-bold",children:N})]}):k(`empty.${A}`)})}):(0,s.jsx)(eo,{entries:[],status:h,currentUser:e,handleChatOpen:a}),Y.length>0&&"pending"===h&&(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2 px-4 py-3 text-xs text-muted-foreground dark:text-muted-foreground",role:"status","aria-live":"polite",children:[(0,s.jsx)(F.A,{"aria-hidden":"true",className:"h-3.5 w-3.5 animate-spin"}),(0,s.jsx)("span",{children:C("loadingConversations")})]}),Y.length>0&&"error"===h&&(0,s.jsx)(eo,{entries:[],status:"error",currentUser:e,handleChatOpen:a})]}),(0,s.jsx)(U,{isPreview:t,fab:!0})]})}},90056:(e,t,a)=>{a.d(t,{C:()=>r});var s=a(9339);let r=(0,s.createServerReference)("000f5ba14915fd53aeef012cdf305f33b497476133",s.callServer,void 0,s.findSourceMapURL,"getAllAgentsSummary")}
1,98678:(e,t,a)=>{a.d(t,{c5:()=>l.A,z3:()=>k,C9:()=>T});var s=a(95155);a(5772);var r=a(12115),n=a(30069);let i=a(17906).H$;(0,n.io)(i,{autoConnect:!1});var l=a(53194),d=a(33790),o=a(94938),c=a(80723),u=a(68189),m=a(98500),x=a.n(m),p=a(73321),h=a(42399),f=a(99003),g=a(72740),b=a(9339);let v=(0,b.createServerReference)("40a4d6892b7e0c88709a29cb8dbc8c4519ca06ca6e",b.callServer,void 0,b.findSourceMapURL,"createGroupChat");var j=a(2614),N=a(35625),w=a(11697),y=a(50910),A=a(32610),E=a(89865),S=a(38838),C=a(12298);let k=()=>{let e=(0,w.Ym)(),[t,a]=(0,r.useState)(null),[n,i]=(0,r.useState)(1),m=(0,y.c)("CHAT.SPACE_WIZARD"),b=(0,y.c)("CHAT"),k=(0,p.useRouter)(),D=(0,N.jE)(),T=(0,r.useMemo)(()=>h.Ik().shape({name:h.Yj().required(m("NAME_REQUIRED")),participants:h.YO().min(1,m("PARTICIPANTS_MIN"))}),[m]),{handleSubmit:R,control:P,formState:{errors:L,isSubmitting:_},watch:I,setValue:M}=(0,f.mN)({resolver:(0,g.t)(T),defaultValues:{name:"",participants:[]}}),O=I("participants"),U=(0,S.J)(O),[z,F]=(0,r.useState)(!1),[H,$]=(0,r.useState)(null),G=(0,r.useRef)(!1),[Y,B]=(0,r.useState)(!1),Q=async t=>{if(!G.current){G.current=!0,B(!0);try{let a=await v(t);if(!a.Error){j.toast.success(m("SUCCESS")),D.invalidateQueries({queryKey:["chats"]}),k.push(`/chat/space/${a.Data.id}`);return}j.toast.error((0,A.y)(a.Message,e,a.raw||m("ERROR")))}catch(e){console.error(e),j.toast.error(m("ERROR"))}G.current=!1,B(!1)}};return(0,s.jsxs)("div",{className:"relative bg-card min-h-full rounded-lg shadow ",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 p-4 pb-1 border-b rounded-t",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-7",children:[(0,s.jsxs)("div",{className:"flex items-center gap-7",children:[(0,s.jsxs)(x(),{href:"/chat",replace:!0,className:"text-muted-foreground bg-transparent hover:bg-muted hover:text-foreground rounded-lg text-sm h-8 w-8 flex items-center justify-center",children:[(0,s.jsx)(d.default,{}),(0,s.jsx)("span",{className:"sr-only",children:b("CLOSE")})]}),(0,s.jsx)(u.Button,{type:"button",variant:"ghost",size:"icon",onClick:()=>{n>1?i(e=>e-1):k.replace("/chat/compose")},"aria-label":n>1?b("PREVIOUS_STEP"):b("DISCARD_AND_EXIT"),className:"text-muted-foreground bg-transparent hover:bg-muted hover:text-foreground rounded-lg text-sm h-8 w-8 items-center text-center",children:(0,s.jsx)(c.A,{className:"h-5 w-5"})}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("h3",{className:"text-xl font-semibold text-foreground",children:m("HEADER")}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:1===n?m("ADD_PARTICIPANTS_STEP"):m("NAME_SPACE_STEP")})]})]}),(0,s.jsx)("button",{type:"button",onClick:1===n?()=>{i(2)}:R(e=>{if(!G.current){if((0,E.Up)(U,O.length)){$(e),F(!0);return}Q(e)}}),disabled:0===O.length||_||Y,className:"text-primary-foreground font-semibold text-sm rounded-lg h-8 px-3 bg-primary disabled:opacity-50 disabled:cursor-not-allowed",children:1===n?m("NEXT"):m("CREATE")})]}),1===n&&O.length>0&&(0,s.jsx)("div",{className:"grid grid-cols-3 gap-2 overflow-y-auto overflow-x-none max-h-28 custom-scrollbar",children:O.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{M("participants",O.filter(t=>t.id!==e.id))},"aria-label":b("REMOVE_PARTICIPANT"),className:"flex items-center text-start gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",children:"x"}),(0,s.jsx)(o.A,{className:"w-10 h-10 rounded-full object-cover bg-background",src:e.profileImageURL,width:40,height:40,alt:e.name}),(0,s.jsxs)("div",{className:"flex-1 flex-col min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-foreground truncate",children:e.name}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground truncate",children:e.username}),U.isExternal(e)&&(0,s.jsx)(C.E,{organizationName:U.organizationName})]})]},e.id||t))}),1===n?(0,s.jsx)(l.z,{label:m("SEARCH_PLACEHOLDER"),setResults:a}):2===n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.xI,{name:"name",control:P,render:({field:e})=>(0,s.jsx)("input",{...e,type:"text",className:"w-full h-8 px-2 border rounded-lg focus:outline-none focus:ring-1 focus:ring-primary",placeholder:m("SPACE_NAME_PLACEHOLDER"),"aria-invalid":!!L.name,"aria-describedby":L.name?"space-name-error":void 0})}),L.name&&(0,s.jsx)("span",{id:"space-name-error",role:"alert",className:"text-destructive text-sm",children:L.name.message})]}):null]}),(0,s.jsx)("div",{className:"p-4 md:p-5 overflow-y-auto max-h-[25rem] custom-scrollbar",children:t&&t.length>0&&1===n&&(0,s.jsx)("div",{className:"flex flex-col gap-3",children:t.map((e,t)=>(0,s.jsxs)("button",{onClick:()=>{!O.find(t=>
1t.id===e.id)&&M("participants",[...O,e])},className:"flex items-center text-start gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",children:[(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)(o.A,{className:"w-10 h-10 rounded-full object-cover bg-background",src:e.profileImageURL.includes("localhost")?"/Icons/Default_pfp.svg":e.profileImageURL,width:40,height:40,alt:e.name})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-foreground truncate",children:e.name}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground truncate",children:e.username})]})]},e.id||t))})}),(0,s.jsx)(C.A,{open:z,onOpenChange:F,externals:U.externals,status:U.status,scope:"space",organizationName:U.organizationName,onConfirm:()=>{F(!1),H&&Q(H)},confirming:Y})]})},D=(0,b.createServerReference)("40e4c79f69d3f2dcfeb1181ea5691b622b851add6b",b.callServer,void 0,b.findSourceMapURL,"createThread"),T=({spaceId:e})=>{let t=(0,y.c)("components.newThreadModal"),a=(0,p.useRouter)(),r=(0,N.jE)(),n=h.Ik().shape({name:h.Yj().required(t("ERROR_NAME_REQUIRED")),spaceId:h.Yj().required()}),{handleSubmit:i,control:l,formState:{errors:o}}=(0,f.mN)({resolver:(0,g.t)(n),defaultValues:{name:"",spaceId:e}}),c=async s=>{try{let n=await D(s);if(n.Error)return void j.toast.error(n.Message?.en??n.Message);j.toast.success(t("SUCCESS_TOAST")),r.setQueryData([e],e=>{if(!e?.pages?.length)return e;let t=e.pages.map(e=>({...e,Data:{...e.Data,threads:[...e.Data.threads,n.Data]}}));return{...e,pages:t}}),a.back()}catch(e){console.error(e),j.toast.error(t("GENERAL_ERROR"))}};return(0,s.jsxs)("div",{className:"relative bg-card min-h-full rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4 p-4 pb-1 border-b rounded-t",children:[(0,s.jsxs)("button",{onClick:()=>a.back(),className:"text-muted-foreground hover:bg-muted rounded-lg h-8 w-8 flex items-center justify-center",children:[(0,s.jsx)(d.default,{}),(0,s.jsx)("span",{className:"sr-only",children:t("CLOSE_MODAL")})]}),(0,s.jsx)("h3",{className:"text-xl font-semibold text-foreground",children:t("TITLE")})]}),(0,s.jsxs)("form",{onSubmit:i(c),className:"flex flex-col gap-4 px-5 py-8",children:[(0,s.jsx)(f.xI,{name:"name",control:l,render:({field:e})=>(0,s.jsx)("input",{...e,type:"text",placeholder:t("NAME_PLACEHOLDER"),className:"w-full h-10 px-4 border rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500"})}),o.name&&(0,s.jsx)("span",{className:"text-destructive text-sm",children:o.name.message}),(0,s.jsx)("button",{type:"submit",className:"bg-primary text-primary-foreground rounded-lg h-10 hover:bg-primary-500",children:t("BUTTON_CREATE")})]})]})}},99701:(e,t,a)=>{a.d(t,{f:()=>n}),a(95155);var s=a(42131),r=a(66080);let n=(0,s.Ay)(r.A)(({theme:e})=>({"& .MuiBadge-badge":{backgroundColor:"hsl(var(--brand))",color:"hsl(var(--brand))",boxShadow:`0 0 0 2px ${e.palette.background.paper}`,"&::after":{position:"absolute",top:0,left:0,width:"100%",height:"100%",borderRadius:"50%",animation:"ripple 1.2s infinite ease-in-out",border:"1px solid currentColor",content:'""'}},"@keyframes ripple":{"0%":{transform:"scale(.8)",opacity:1},"100%":{transform:"scale(2.4)",opacity:0}
1}}))}}]);
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.