decord/beta/source/modules/video_calls/useMuteStates.tsx
2026-10-07 22:43:51 +00:00

113 lines
3.9 KiB
TypeScript

// Module ID: 6848
// Function ID: 6849
// Name: useMuteStates
// Dependencies: [2105, 502, 1999, 4509, 4909, 1085, 558, 576, 504, 2]
// Module 6848 (useMuteStates)
import Constants from "Constants" /* 1085 */;
import ImpersonateStore from "ImpersonateStore" /* 2105 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import MediaEngineStore from "MediaEngineStore" /* 1999 */;
import PermissionStore from "PermissionStore" /* 4509 */;
import VoiceStateStore from "VoiceStateStore" /* 4909 */;
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
let _require;
function getMuteStates(voiceStateStore) {
let authenticationStore;
let channel;
let flag;
let suppress;
({ channel, authenticationStore } = voiceStateStore);
if (authenticationStore === undefined) {
authenticationStore = AuthenticationStore;
}
voiceStateStore = voiceStateStore.voiceStateStore;
if (voiceStateStore === undefined) {
voiceStateStore = VoiceStateStore;
}
let mediaEngineStore = voiceStateStore.mediaEngineStore;
if (mediaEngineStore === undefined) {
mediaEngineStore = MediaEngineStore;
}
let permissionStore = voiceStateStore.permissionStore;
if (permissionStore === undefined) {
permissionStore = PermissionStore;
}
let impersonateStore = voiceStateStore.impersonateStore;
if (impersonateStore === undefined) {
impersonateStore = ImpersonateStore;
}
let voiceState = null;
if (null != channel) {
const getVoiceState = voiceStateStore.getVoiceState;
const guildId = channel.getGuildId();
voiceState = getVoiceState(guildId, authenticationStore.getId());
}
let guildId1;
const tmp3 = mediaEngineStore.isSelfMute() || mediaEngineStore.isSelfMutedTemporarily();
if (channel != null) {
guildId1 = channel.getGuildId();
}
const obj = { selfMute: tmp3, suppress, mute: flag };
suppress = undefined;
const isViewingRolesResult = impersonateStore.isViewingRoles(guildId1) && !permissionStore.can(Permissions.SPEAK, channel);
if (voiceState != null) {
suppress = voiceState.suppress;
}
if (!suppress) {
suppress = isViewingRolesResult;
}
flag = undefined;
if (voiceState != null) {
flag = voiceState.mute;
}
if (flag == null) {
flag = false;
}
return obj;
}
const Permissions = Constants.Permissions;
const tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? ((channel) => {
let first;
let tmp10;
_require = channel;
let obj = require("react");
const cResult = obj.c(3);
const tmp = _require;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [AuthenticationStore, VoiceStateStore, MediaEngineStore, PermissionStore, ImpersonateStore];
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] !== channel) {
const fn = function l() {
const obj = { channel, authenticationStore: AuthenticationStore, voiceStateStore: VoiceStateStore, mediaEngineStore: MediaEngineStore, permissionStore: PermissionStore, impersonateStore: ImpersonateStore };
return getMuteStates(obj);
};
cResult[1] = channel;
cResult[2] = fn;
tmp10 = fn;
} else {
tmp10 = cResult[2];
}
const tmpResult = tmp(504);
return tmpResult.useStateFromStoresObject(first, tmp10);
}) : ((channel) => {
_require = channel;
let obj = require("get initialized");
const items = [AuthenticationStore, VoiceStateStore, MediaEngineStore, PermissionStore, ImpersonateStore];
return obj.useStateFromStoresObject(items, () => {
const obj = { channel, authenticationStore: AuthenticationStore, voiceStateStore: VoiceStateStore, mediaEngineStore: MediaEngineStore, permissionStore: PermissionStore, impersonateStore: ImpersonateStore };
return getMuteStates(obj);
});
});
const result = size.fileFinishedImporting("modules/video_calls/useMuteStates.tsx");
export default tmp2;
export { getMuteStates };