// Metro module 13461 (f13462). import AuthenticationStore from "./AuthenticationStore"; import ChannelStore from "./ChannelStore"; import MediaEngineStore from "./MediaEngineStore"; import PermissionStore from "./PermissionStore"; import RTCConnectionStore from "./RTCConnectionStore"; import VoiceStateStore from "./VoiceStateStore"; import { InputModes, Permissions } from "../Constants"; import Dispatcher from "../Dispatcher"; import Module589 from "../_bundle/Module589"; let hasPermission, c9340_11; const handleUpdateVADPermission = function handleUpdateVADPermission() { const channelId = RTCConnectionStore.getChannelId(); const r0 = channelId == null; let r12 = true; if (!r0) { const channel = ChannelStore.getChannel(channelId); const voiceState = VoiceStateStore.getVoiceState(channel == null ? void 0 : channel.getGuildId(), AuthenticationStore.getId()); r12 = MediaEngineStore.getMode() !== InputModes.VOICE_ACTIVITY || channel == null || channel.isPrivate() || channel.isGuildStageVoice() || PermissionStore.can(Permissions.USE_VAD, channel) || (voiceState == null || !!voiceState.suppress || voiceState.requestToSpeakTimestamp != null); } let r37 = hasPermission !== r12; if (r37) { c9340_11 = r12; hasPermission = r12; Dispatcher.dispatch({ type: "SET_VAD_PERMISSION", hasPermission }); r37 = true; } return r37; }; hasPermission = true; c9340_11 = true; class PermissionVADStore extends Module589.Store { static displayName = "PermissionVADStore"; initialize() { this.waitFor(AuthenticationStore, ChannelStore, MediaEngineStore, PermissionStore, RTCConnectionStore, VoiceStateStore); } shouldShowWarning() { return !c9340_11; } canUseVoiceActivity() { return hasPermission; } } const permissionVADStore = new PermissionVADStore(Dispatcher, { RTC_CONNECTION_STATE: handleUpdateVADPermission, MEDIA_ENGINE_SET_AUDIO_ENABLED: handleUpdateVADPermission, AUDIO_SET_MODE: handleUpdateVADPermission, CHANNEL_UPDATES: handleUpdateVADPermission, THREAD_UPDATE: handleUpdateVADPermission, GUILD_ROLE_UPDATE: handleUpdateVADPermission, GUILD_MEMBER_UPDATE: handleUpdateVADPermission, IMPERSONATE_UPDATE: handleUpdateVADPermission, IMPERSONATE_STOP: handleUpdateVADPermission, VOICE_STATE_UPDATES: function handleVoiceStateUpdates(a0) { return a0.voiceStates.some((voiceState) => voiceState.userId === AuthenticationStore.getId() && handleUpdateVADPermission()); }, AUDIO_TOGGLE_SELF_MUTE: function handleUnclearWarning() { c9340_11 = hasPermission; }, PERMISSION_CLEAR_VAD_WARNING: function handleClearWarning() { c9340_11 = true; } }); export default permissionVADStore;