import{a as s}from"./chunk-Q63I6SEV.mjs";import{a as c}from"./chunk-5GQV6TVL.mjs";import{c as f}from"./chunk-A5QFDUFT.mjs";import{useCurrentProfile as A}from"@baseapp-frontend/authentication";import{useFragment as p}from"react-relay";import g from"relay-connection-handler-plus";var _=function(r){var n,o=p(s,r);return{title:o?.title,avatar:o==null||(n=o.image)===null||n===void 0?void 0:n.url}},P=function(r){var n,o,d=A(),m=d.currentProfile,u=p(c,r);if(!(u!=null&&u.participants))return{title:"Error: No participants"};var e=u.participants.edges.find(function(l){var v,i;return(l==null||(v=l.node)===null||v===void 0||(v=v.profile)===null||v===void 0?void 0:v.id)&&(l==null||(i=l.node)===null||i===void 0||(i=i.profile)===null||i===void 0?void 0:i.id)!==m?.id});return{title:e==null||(n=e.node)===null||n===void 0||(n=n.profile)===null||n===void 0?void 0:n.name,avatar:e==null||(o=e.node)===null||o===void 0||(o=o.profile)===null||o===void 0||(o=o.image)===null||o===void 0?void 0:o.url}},S=function(r){var n=P(r),o=_(r);return r.isGroup?o:n},T=function(r){if(r!=null)return"".concat(r," member").concat(r!==1?"s":"")},G=function(r,n,o){var d=r.get(n);return d?g.getConnections(d,"roomsList_chatRooms",o):[]},I=function(r){var n,o,d,m=A(),u=m.currentProfile,e=r==null||(n=r.edges)===null||n===void 0?void 0:n.find(function(i){var t;return(i==null||(t=i.node)===null||t===void 0||(t=t.profile)===null||t===void 0?void 0:t.id)===u?.id}),l=(e==null||(o=e.node)===null||o===void 0?void 0:o.role)===f.admin,v=l&&(r==null||(d=r.edges)===null||d===void 0?void 0:d.filter(function(i){var t;return(i==null||(t=i.node)===null||t===void 0?void 0:t.role)===f.admin}).length)===1;return{isAdmin:l,isSoleAdmin:v}};export{_ as a,S as b,T as c,G as d,I as e};
//# sourceMappingURL=chunk-AZ65ECT7.mjs.map