decord/source/modules/guilds_bar/useGuildMediaState.tsx

292 lines
11 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 15691
// Function ID: 15692
2026-07-29 08:29:29 +00:00
// Name: canConnectToChannel
2026-08-25 06:04:03 +00:00
// Dependencies: [1390, 1396, 1395, 4402, 1218, 1391, 1910, 4025, 4034, 1981, 4589, 4399, 676, 692, 589, 13175, 9185, 13176, 4015, 8492, 11, 5241, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-25 06:04:03 +00:00
// Module 15691 (canConnectToChannel)
2026-08-24 06:08:38 +00:00
import set from "set" /* 692 */;
import closure_3 from "participantFromServer" /* 1390 */;
import closure_4 from "handleStageInstanceCreateOrUpdate" /* 1396 */;
import { isVoiceChannel } from "createChannelRecord" /* 1395 */;
2026-08-25 06:04:03 +00:00
import closure_6 from "reset" /* 4402 */;
2026-08-24 06:08:38 +00:00
import closure_7 from "fetchFingerprint" /* 1218 */;
import closure_8 from "ensureGuildLoaded" /* 1391 */;
import closure_9 from "createGuildRecordFromRust" /* 1910 */;
2026-08-25 06:04:03 +00:00
import closure_10 from "getUncachedChannelPermissions" /* 4025 */;
import closure_11 from "markAllUserIdListsStale" /* 4034 */;
import closure_12 from "handleConnectionOpen" /* 1981 */;
import closure_13 from "updateUserGuildSettingsInternal" /* 4589 */;
import closure_14 from "updateVoiceState" /* 4399 */;
2026-08-24 06:08:38 +00:00
import { BasicPermissions } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function canConnectToChannel(type) {
let obj = arg2;
if (arg2 === undefined) {
2026-08-24 06:08:38 +00:00
obj = closure_10;
2026-07-20 16:05:17 +00:00
}
let canBasicChannelResult = null != type;
if (canBasicChannelResult) {
2026-08-24 06:08:38 +00:00
canBasicChannelResult = type.type !== set.ChannelTypes.GUILD_STAGE_VOICE;
2026-07-20 16:05:17 +00:00
}
if (canBasicChannelResult) {
canBasicChannelResult = arg1 !== type.id;
}
if (canBasicChannelResult) {
canBasicChannelResult = obj.canBasicChannel(BasicPermissions.VIEW_CHANNEL, type);
}
return canBasicChannelResult;
}
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/guilds_bar/useGuildMediaState.tsx");
2026-07-20 16:05:17 +00:00
export default function useGuildMediaState(guild_id) {
2026-07-23 10:11:24 +00:00
const _require = guild_id;
2026-08-24 06:08:38 +00:00
let items = [closure_13];
const stateFromStores = _require(isDontBadgeMutedVcsEnabled[14]).useStateFromStores(items, () => closure_1_13.isMuted(closure_0));
2026-07-23 10:11:24 +00:00
let obj = _require(isDontBadgeMutedVcsEnabled[14]);
isDontBadgeMutedVcsEnabled = _require(isDontBadgeMutedVcsEnabled[15]).useIsDontBadgeMutedVcsEnabled("useGuildMediaState");
2026-07-29 08:29:29 +00:00
let obj2 = _require(isDontBadgeMutedVcsEnabled[15]);
2026-07-23 10:11:24 +00:00
const guildActiveEvent = _require(isDontBadgeMutedVcsEnabled[16]).useGuildActiveEvent(guild_id);
const obj3 = _require(isDontBadgeMutedVcsEnabled[16]);
2026-08-24 06:08:38 +00:00
const items1 = [guildActiveEvent, closure_11];
2026-07-23 10:11:24 +00:00
const stateFromStoresArray = _require(isDontBadgeMutedVcsEnabled[14]).useStateFromStoresArray(items1, () => {
const embeddedActivitiesForGuild = guildActiveEvent.getEmbeddedActivitiesForGuild(closure_0);
2026-07-20 16:05:17 +00:00
return embeddedActivitiesForGuild.filter((userIds) => {
const items = [...userIds.userIds];
2026-07-29 08:29:29 +00:00
return !callback(table[17]).hasBlockedOrIgnoredUserIds(items, blockedOrIgnoredIDs.getBlockedOrIgnoredIDs());
2026-07-20 16:05:17 +00:00
});
});
2026-07-23 10:11:24 +00:00
const obj4 = _require(isDontBadgeMutedVcsEnabled[14]);
2026-07-29 08:29:29 +00:00
let tmp7 = guildActiveEvent;
2026-07-20 16:05:17 +00:00
const first = stateFromStoresArray[0];
let _location;
2026-07-29 08:29:29 +00:00
if (first != null) {
2026-07-20 16:05:17 +00:00
_location = first.location;
}
2026-07-23 10:11:24 +00:00
const embeddedActivityLocationChannelId = _require(isDontBadgeMutedVcsEnabled[18]).getEmbeddedActivityLocationChannelId(_location);
2026-07-29 08:29:29 +00:00
let tmpResult = tmp(tmp2[19]);
const isActivitiesInTextEnabled = tmpResult.useIsActivitiesInTextEnabled(embeddedActivityLocationChannelId);
tmpResult = tmp(tmp2[14]);
2026-08-24 06:08:38 +00:00
const items2 = [closure_12, closure_14, id, closure_10, selectedVoiceChannelHasVideo, closure_13];
2026-07-20 16:05:17 +00:00
const items3 = [guild_id, stateFromStores, isDontBadgeMutedVcsEnabled];
2026-07-29 08:29:29 +00:00
const stateFromStoresObject = tmpResult.useStateFromStoresObject(items2, () => {
2026-08-24 06:08:38 +00:00
const voiceChannelId = closure_1_12.getVoiceChannelId();
2026-07-29 08:29:29 +00:00
const guild = id.getGuild(afkChannelId);
afkChannelId = undefined;
if (guild != null) {
afkChannelId = guild.afkChannelId;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const usersWithVideo = closure_1_14.getUsersWithVideo(tmp3);
2026-07-23 10:11:24 +00:00
let obj = guild_id(isDontBadgeMutedVcsEnabled[17]);
2026-08-24 06:08:38 +00:00
const result = obj.filterBlockedUsersFromVoiceStates(closure_1_14.getVoiceStates(tmp3));
2026-07-29 08:29:29 +00:00
isDontBadgeMutedVcsEnabled = result;
2026-07-20 16:05:17 +00:00
let flag = false;
2026-07-29 08:29:29 +00:00
if (!usersWithVideo) {
2026-07-20 16:05:17 +00:00
flag = false;
const keys = Object.keys();
if (keys !== undefined) {
flag = false;
while (keys[tmp] !== undefined) {
2026-07-29 08:29:29 +00:00
let tmp22 = tmp9;
let channelId = result[tmp9].channelId;
2026-07-20 16:05:17 +00:00
if (null == channelId) {
continue;
} else {
let tmp10 = selectedVoiceChannelHasVideo;
let basicChannel = selectedVoiceChannelHasVideo.getBasicChannel(channelId);
2026-07-29 08:29:29 +00:00
let tmp12 = afkChannelId;
2026-08-24 06:08:38 +00:00
let obj2 = closure_1_10;
if (closure_1_10 !== undefined) {
2026-07-29 08:29:29 +00:00
let canBasicChannelResult = null != basicChannel;
if (canBasicChannelResult) {
let tmp14 = guild_id;
let tmp15 = isDontBadgeMutedVcsEnabled;
canBasicChannelResult = basicChannel.type !== guild_id(isDontBadgeMutedVcsEnabled[13]).ChannelTypes.GUILD_STAGE_VOICE;
}
if (canBasicChannelResult) {
canBasicChannelResult = tmp12 !== basicChannel.id;
}
if (canBasicChannelResult) {
2026-08-24 06:08:38 +00:00
let tmp16 = closure_1_15;
canBasicChannelResult = obj2.canBasicChannel(closure_1_15.VIEW_CHANNEL, basicChannel);
2026-07-29 08:29:29 +00:00
}
if (!canBasicChannelResult) {
continue;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
let tmp17 = isDontBadgeMutedVcsEnabled;
2026-07-20 16:05:17 +00:00
flag = true;
2026-07-29 08:29:29 +00:00
if (!isDontBadgeMutedVcsEnabled) {
2026-07-20 16:05:17 +00:00
break;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
let tmp18 = closure_1_13;
2026-07-29 08:29:29 +00:00
let tmp19 = afkChannelId;
flag = true;
2026-08-24 06:08:38 +00:00
if (!closure_1_13.isGuildOrCategoryOrChannelMuted(afkChannelId, channelId)) {
2026-07-29 08:29:29 +00:00
break;
}
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
break;
2026-07-20 16:05:17 +00:00
}
}
continue;
}
}
}
2026-07-29 08:29:29 +00:00
obj = {
guildHasVoice: flag,
guildHasVideo: (() => {
if (dependencyMap) {
return false;
} else {
const obj = dependencyMap[Symbol.iterator]();
while (obj !== undefined) {
let tmp7 = table;
let tmp8 = table[tmp5];
let channelId;
if (tmp8 != null) {
channelId = tmp8.channelId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp10 = channelId;
if (null != channelId) {
let tmp12 = selectedVoiceChannelHasVideo;
let tmp13 = channelId;
2026-08-24 06:08:38 +00:00
let tmp11 = closure_2_16;
2026-07-29 08:29:29 +00:00
let tmp15 = afkChannelId;
let basicChannel = selectedVoiceChannelHasVideo.getBasicChannel(tmp10);
2026-08-24 06:08:38 +00:00
let tmp16 = closure_2_10;
if (tmp11(basicChannel, tmp15, closure_2_10)) {
2026-07-29 08:29:29 +00:00
let tmp17 = result;
if (result) {
2026-08-24 06:08:38 +00:00
let tmp18 = closure_2_13;
2026-07-29 08:29:29 +00:00
let tmp19 = afkChannelId;
let tmp20 = channelId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp21 = obj;
obj.return();
let flag = true;
return true;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return false;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
})(),
selectedVoiceChannelHasVideo: null
};
2026-07-20 16:05:17 +00:00
let hasVideoResult = null != voiceChannelId;
if (hasVideoResult) {
2026-08-24 06:08:38 +00:00
hasVideoResult = closure_1_14.hasVideo(voiceChannelId);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = hasVideoResult;
2026-07-20 16:05:17 +00:00
return obj;
}, items3);
const guildHasVoice = stateFromStoresObject.guildHasVoice;
const guildHasVideo = stateFromStoresObject.guildHasVideo;
2026-07-23 10:11:24 +00:00
selectedVoiceChannelHasVideo = stateFromStoresObject.selectedVoiceChannelHasVideo;
id = guildHasVideo.getId();
2026-07-29 08:29:29 +00:00
let obj5 = _require(isDontBadgeMutedVcsEnabled[18]);
2026-08-24 06:08:38 +00:00
const items4 = [closure_12, selectedVoiceChannelHasVideo, tmp7, stateFromStoresArray, guildHasVoice, closure_10, closure_13];
2026-07-20 16:05:17 +00:00
const items5 = [guild_id, stateFromStores, selectedVoiceChannelHasVideo, id, isActivitiesInTextEnabled, stateFromStoresArray, guildActiveEvent, guildHasVoice, guildHasVideo, isDontBadgeMutedVcsEnabled];
2026-07-23 10:11:24 +00:00
return _require(isDontBadgeMutedVcsEnabled[14]).useStateFromStoresObject(items4, () => {
2026-08-24 06:08:38 +00:00
const voiceChannelId = closure_1_12.getVoiceChannelId();
2026-07-29 08:29:29 +00:00
let obj = selectedVoiceChannelHasVideo;
2026-07-23 10:11:24 +00:00
let channel = selectedVoiceChannelHasVideo.getChannel(voiceChannelId);
2026-08-24 06:08:38 +00:00
guild_id = undefined;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
guild_id = channel.guild_id;
}
2026-07-29 08:29:29 +00:00
let tmp5 = guild_id === guild_id;
if (!tmp5) {
2026-07-20 16:05:17 +00:00
if (stateFromStores) {
2026-07-23 10:11:24 +00:00
return { audio: false, video: false, screenshare: false, liveStage: false, activeEvent: false, activity: false, isCurrentUserConnected: false };
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const keys = stateFromStores(isDontBadgeMutedVcsEnabled[20]).keys(stateFromStoresArray.getStageInstancesByGuild(tmp4));
let tmp9 = tmp5;
let obj2 = stateFromStores(isDontBadgeMutedVcsEnabled[20]);
let tmp7 = isDontBadgeMutedVcsEnabled;
if (tmp5) {
const channel1 = obj.getChannel(voiceChannelId);
let flag;
if (channel1 != null) {
flag = channel1.isGuildStageVoice();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp9 = flag;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp10 = tmp5;
if (tmp10) {
tmp10 = null != guildHasVoice.getActiveStreamForUser(id, tmp4);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const someResult = keys.some((arg0) => {
2026-08-12 06:57:52 +00:00
basicChannel = basicChannel.getBasicChannel(arg0);
let tmp2 = null != basicChannel;
if (tmp2) {
2026-08-24 06:08:38 +00:00
tmp2 = callback(table[21])(basicChannel, closure_10);
2026-07-20 16:05:17 +00:00
}
2026-08-12 06:57:52 +00:00
return tmp2;
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
let result = guild_id(tmp7[17]).filterOutStreamsByBlockedOwner(guildHasVoice.getAllApplicationStreams());
const obj5 = guild_id(tmp7[17]);
let tmp14 = (() => {
if (closure_5) {
return arr.length > 0;
} else {
const obj = arr[Symbol.iterator]();
while (obj !== undefined) {
2026-08-24 06:08:38 +00:00
let tmp6 = closure_1_8;
let tmp7 = closure_1_0;
let tmp8 = closure_1_2;
let obj2 = closure_1_0(closure_1_2[18]);
let channel = closure_1_8.getChannel(obj2.getEmbeddedActivityLocationChannelId(tmp4.location));
2026-07-29 08:29:29 +00:00
if (null != channel) {
2026-08-24 06:08:38 +00:00
let tmp11 = closure_1_5;
2026-07-29 08:29:29 +00:00
let tmp12 = channel;
2026-08-24 06:08:38 +00:00
if (closure_1_5(tmp10.type)) {
2026-07-29 08:29:29 +00:00
let tmp13 = obj;
obj.return();
let flag = true;
return true;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return false;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
})();
if (tmp5) {
2026-07-20 16:05:17 +00:00
let channel_id;
2026-07-29 08:29:29 +00:00
if (guildActiveEvent != null) {
2026-07-20 16:05:17 +00:00
channel_id = guildActiveEvent.channel_id;
}
2026-07-29 08:29:29 +00:00
let tmp22 = tmp5;
if (tmp5) {
tmp22 = selectedVoiceChannelHasVideo;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp17 = channel_id === voiceChannelId;
2026-07-20 16:05:17 +00:00
let flag2 = true;
2026-07-29 08:29:29 +00:00
let tmp18 = tmp22;
tmp14 = tmp15;
let tmp19 = tmp10;
let tmp20 = tmp9;
2026-07-20 16:05:17 +00:00
} else {
flag2 = guildHasVoice;
2026-07-29 08:29:29 +00:00
tmp17 = null != guildActiveEvent;
tmp18 = guildHasVideo;
tmp19 = someResult1;
tmp20 = someResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { audio: flag2, video: tmp18, screenshare: tmp19, liveStage: tmp20, activeEvent: tmp17, activity: tmp14, isCurrentUserConnected: null };
if (!tmp5) {
tmp5 = tmp9;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[6] = tmp5;
2026-07-20 16:05:17 +00:00
return obj;
}, items5);
};