import{a as _}from"./chunk-MK2TH4QY.mjs";import{a as P,b as j,c as D}from"./chunk-T2IUCKYP.mjs";import{a as S}from"./chunk-6NM6GRN3.mjs";import{a as T}from"./chunk-HFEGUIQL.mjs";import{b as R}from"./chunk-ENGOMVJ6.mjs";import{a as k}from"./chunk-UB5P4QTT.mjs";import{b as x,c as I}from"./chunk-QM7X6D7F.mjs";import{useState as X}from"react";import{useCurrentProfile as Y}from"@baseapp-frontend/authentication";import{AvatarWithPlaceholder as Z}from"@baseapp-frontend/design-system/components/web/avatars";import{IconButton as M}from"@baseapp-frontend/design-system/components/web/buttons";import{ThreeDotsIcon as oo}from"@baseapp-frontend/design-system/components/web/icons";import{Iconify as ro}from"@baseapp-frontend/design-system/components/web/images";import{Popover as to}from"@baseapp-frontend/design-system/components/web/popovers";import{TypographyWithEllipsis as eo}from"@baseapp-frontend/design-system/components/web/typographies";import{usePopover as io}from"@baseapp-frontend/design-system/hooks/common";import{useResponsive as no}from"@baseapp-frontend/design-system/hooks/web";import{Box as F,Typography as ao}from"@mui/material";import{useFragment as lo}from"react-relay";import{jsx as e,jsxs as f,Fragment as so}from"react/jsx-runtime";function O(o,t){return V(o)||Q(o,t)||K(o,t)||J()}function J(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K(o,t){if(o){if(typeof o=="string")return w(o,t);var r={}.toString.call(o).slice(8,-1);return r==="Object"&&o.constructor&&(r=o.constructor.name),r==="Map"||r==="Set"?Array.from(o):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(o,t):void 0}}function w(o,t){(t==null||t>o.length)&&(t=o.length);for(var r=0,i=Array(t);r<t;r++)i[r]=o[r];return i}function Q(o,t){var r=o==null?null:typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(r!=null){var i,h,u,n,l=[],s=!0,m=!1;try{if(u=(r=r.call(o)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(i=u.call(r)).done)&&(l.push(i.value),l.length!==t);s=!0);}catch(C){m=!0,h=C}finally{try{if(!s&&r.return!=null&&(n=r.return(),Object(n)!==n))return}finally{if(m)throw h}}return l}}function V(o){if(Array.isArray(o))return o}var co=function(t){var r=t.isArchived,i=t.participantsCount,h=t.roomTitleRef,u=t.onDisplayGroupDetailsClicked,n=t.roomId,l=lo(T,h),s=X(!1),m=O(s,2),C=m[0],y=m[1],g=no("up","md"),G=k(),H=G.resetChatRoom,d=l.isGroup,A=x(l),L=A.title,W=A.avatar,B=I(i),c=io(),N=Y(),a=N.currentProfile,E=R(),b=O(E,2),U=b[0],z=b[1],$=function(){c.onClose(),a!=null&&a.id&&n&&U({variables:{input:{roomId:n,profileId:a.id,archive:!r}}})},q=function(v){v.stopPropagation(),c.onOpen(v)};return f(so,{children:[e(S,{open:C,onClose:function(){return y(!1)},profileId:a?.id,roomId:n}),f(P,{children:[g?e("div",{}):e(D,{children:e(M,{"aria-label":"return to chat room list",onClick:H,sx:{maxWidth:"fit-content"},children:e(ro,{icon:"eva:arrow-ios-back-fill",width:24})})}),f(j,{onClick:d?u:void 0,isClickable:d,children:[e(Z,{className:"self-start justify-self-center",width:32,height:32,src:W,sx:{border:"none",alignSelf:"center"}}),f(F,{children:[e(eo,{component:"span",variant:"subtitle2",maxWidth:g?"300px":"200px",sx:{float:"left",clear:"left"},children:L}),d&&e(ao,{component:"span",variant:"caption",sx:{float:"left",clear:"left"},children:B})]}),f(F,{children:[e(M,{onClick:q,"aria-label":"Show chatroom options",children:e(oo,{sx:{fontSize:"24px"}})}),e(to,{open:c.open,onClose:c.onClose,slotProps:{root:{onClick:function(v){return v.stopPropagation()}}},children:e(_,{isArchived:r,isArchiveMutationInFlight:z,isGroup:d,onArchiveClicked:$,onDetailsClicked:function(){c.onClose(),u()},onLeaveClicked:function(){c.onClose(),y(!0)}})})]})]})]})]})},_o=co;export{_o as a};
//# sourceMappingURL=chunk-IXSWIEWE.mjs.map