// Metro module 16203 (f16204). import AuthenticationStore from "../../stores/AuthenticationStore"; import GuildRoomStore from "./GuildRoomStore"; import { GUILD_ROOM_BACKGROUND_CONFIG, GUILD_ROOM_SPATIAL_AUDIO_MODE } from "./GuildRoomConstants"; import { GuildRoomBackgrounds } from "../../_bundle/Module16199"; import { useStateFromStores } from "../../_bundle/Module589"; import GuildRoomsExperiment from "./GuildRoomsExperiment"; let c11638_7; const computeLivingRoomWorldPoints = function computeLivingRoomWorldPoints({ users, currentUserId, channelId: channelId2 }) { let r15 = users.get(currentUserId)?.position; if (r15 == null) { r15 = null; } let c22883_1 = r15; let r20 = GuildRoomStore.getRoom(channelId2)?.background; if (r20 == null) { r20 = GuildRoomBackgrounds.DEFAULT; } const aspectRatio = GUILD_ROOM_BACKGROUND_CONFIG[r20].aspectRatio; return Object.fromEntries([...users.values()].filter((item) => item.userId !== currentUserId).map(({ userId, position }) => { const r11 = [userId, ,]; let r12 = c22883_1; if (r12 == null) { r12 = c11638_7; } r11[1] = { worldX: (position.x - r12.x) / 100 * aspectRatio * 8, worldY: 0, worldZ: 8 * ((position.y - r12.y) / 100) }; return r11; })); }; c11638_7 = { x: 50, y: 50 }; export { computeLivingRoomWorldPoints }; export function livingRoomWorldPointToMediaEnginePoint(a0) { return { x: a0.worldX, y: a0.worldY, z: a0.worldZ }; } export function useGuildRoomSpatialAudio({ channelId, guildId, mode }) { let c22884_2; c22884_2 = void 0; const stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId()); const available = GuildRoomsExperiment.useExperiment({ guildId, location: "SpatialAudioPanel" }).interactionsEnabled && guildId != null; const r24 = available && mode === GUILD_ROOM_SPATIAL_AUDIO_MODE; c22884_2 = r24; return { available, worldPoints: useStateFromStores([GuildRoomStore], () => c22884_2 && channelId != null ? computeLivingRoomWorldPoints({ users: GuildRoomStore.getRoomUsers(channelId), currentUserId: stateFromStores, channelId }) : {}, [r24, channelId, stateFromStores]) }; }