"use strict";

export function extractUniqueMembersFromRooms(rooms) {
  const uniqueMembersMap = new Map();
  rooms.forEach(room => {
    if (room.members) {
      room.members.forEach(member => {
        if (member && member?.xmppUsername) {
          uniqueMembersMap.set(member.xmppUsername, member);
        }
      });
    }
  });
  const uniqueMembersArray = Array.from(uniqueMembersMap.values());
  const uniqueMembersObject = uniqueMembersArray.reduce((acc, member) => {
    if (member.xmppUsername) {
      acc[member.xmppUsername] = member;
    }
    return acc;
  }, {});
  const uniqueMembersSet = new Set(uniqueMembersMap.keys());
  return {
    array: uniqueMembersArray,
    object: uniqueMembersObject,
    map: uniqueMembersMap,
    set: uniqueMembersSet
  };
}
//# sourceMappingURL=extractUniqueMembersFromRooms.js.map