Files
2026-07-28 01:06:53 +03:00

584 lines
28 KiB
TypeScript

/* Metro module 14418; source: modules/guilds_bar/useGuildMediaState.tsx; dependencies: [1378, 1384, 1383, 4492, 1226, 1379, 1867, 3784, 3793, 1934, 4864, 4297, 661, 677, 566, 14419, 9127, 14420, 3774, 8448, 21, 1387, 2] */
import SnowflakeUtils from '../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import EmbeddedActivitiesStore from '../activities/EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import StageInstanceStore from '../stage_channels/StageInstanceStore.tsx'; /* Metro dependency 1384 */
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import VoiceStateStore from '../../stores/VoiceStateStore.tsx'; /* Metro dependency 4297 */
import ApplicationStreamingStore from '../../stores/ApplicationStreamingStore.tsx'; /* Metro dependency 4492 */
import UserGuildSettingsStore from '../../stores/UserGuildSettingsStore.tsx'; /* Metro dependency 4864 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
import * as EmbeddedActivityLocationUtilsModule from '../activities/utils/embeddedActivityLocationUtils.tsx'; /* Metro dependency 3774 */
import * as UseGuildScheduledEventsModule from '../guild_scheduled_events/useGuildScheduledEvents.tsx'; /* Metro dependency 9127 */
import * as DontBadgeMutedVcsExperimentModule from './DontBadgeMutedVcsExperiment.tsx'; /* Metro dependency 14419 */
import * as BlockedUserUtilsModule from '../blocking/BlockedUserUtils.tsx'; /* Metro dependency 14420 */
function _fun109129(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:6, offset: 0x0233ed89, size: 355 bytes, params: 8, frame: 19
const env0_0 = require;
const _arrayLikeToArray_109132 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/guilds_bar/useGuildMediaState.tsx');
exports.default = useGuildMediaState;
function _createForOfIteratorHelperLoose_109130(a0, a1) { // fn#109130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:267, offset: 0x0233eeec, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun109131;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_109132(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_109132(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_109132(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun109131;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun109131() { // fn#109131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:838, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function canConnectToChannel(a0, a1) { // fn#109133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1177, offset: 0x0233f060, size: 117 bytes, params: 3, frame: 17
const value = a2;
const r3 = value !== undefined ? value : PermissionStore;
return a0 != null && a0.type !== (require(677) /* metro dependency 677: ChannelTypes */).ChannelTypes.GUILD_STAGE_VOICE && a1 !== a0.id && r3.canBasicChannel(BasicPermissions.VIEW_CHANNEL,
a0);
}
function useGuildMediaState(a0) { // fn#109134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1416, offset: 0x0233f0d5, size: 528 bytes, params: 2, frame: 30
const env0_0 = a0;
const value2 = undefined;
const value3 = (FluxModule).useStateFromStores([UserGuildSettingsStore],
_fun109135);
const value4 = (DontBadgeMutedVcsExperimentModule).useIsDontBadgeMutedVcsEnabled('useGuildMediaState');
const value5 = (UseGuildScheduledEventsModule).useGuildActiveEvent(a0);
const value6 = (FluxModule).useStateFromStoresArray([EmbeddedActivitiesStore,
RelationshipStore], _fun109136);
const getEmbeddedActivityLocationChannelId = EmbeddedActivityLocationUtilsModule.getEmbeddedActivityLocationChannelId;
const property = value6[0];
const value8 = (require(8448) /* metro dependency 8448: ActivitiesInTextUtils */).useIsActivitiesInTextEnabled(Reflect.apply(getEmbeddedActivityLocationChannelId,
EmbeddedActivityLocationUtilsModule, [property == null ? value2 : property.location]));
const useStateFromStoresObject = FluxModule.useStateFromStoresObject;
const selectedChannelStoreBinding = SelectedChannelStore;
const channelStoreBinding = ChannelStore;
userGuildSettingsStoreBinding = UserGuildSettingsStore;
const {guildHasVoice, guildHasVideo, selectedVoiceChannelHasVideo} = Reflect.apply(useStateFromStoresObject,
FluxModule, [[selectedChannelStoreBinding, VoiceStateStore, GuildStore, PermissionStore, channelStoreBinding,
userGuildSettingsStoreBinding], _fun109138, [a0, value3, value4]]);
return FluxModule.useStateFromStoresObject([selectedChannelStoreBinding, channelStoreBinding,
EmbeddedActivitiesStore, StageInstanceStore, ApplicationStreamingStore, PermissionStore,
userGuildSettingsStoreBinding], _fun109139, [a0, value3, selectedVoiceChannelHasVideo,
AuthenticationStore.getId(), value8, value6, value5, guildHasVoice, guildHasVideo, value4]);
function _fun109135() { // fn#109135, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1489, offset: 0x0233f2e5, size: 27 bytes, params: 1, frame: 11
return UserGuildSettingsStore.isMuted(env0_0);
}
function _fun109136() { // fn#109136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1650, offset: 0x0233f300, size: 46 bytes, params: 1, frame: 11
var environment;
const value = environment.__proto__;
return EmbeddedActivitiesStore.getEmbeddedActivitiesForGuild(env0_0).filter(function(a0) {
var r5;
var moduleValue = require(dependencyMap[17]);
var userIds = a0.userIds;
var items = [];
arraySpread(items, userIds, 0, r5);
return !moduleValue.hasBlockedOrIgnoredUserIds(items, RelationshipStore.getBlockedOrIgnoredIDs());
});
}
function _fun109138() { // fn#109138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1964, offset: 0x0233f37c, size: 451 bytes, params: 1, frame: 32
var afkChannelId;
var r15;
var r18;
var r3;
var r6;
var channelId;
var r14;
var r1;
var properties;
var properties2;
var properties3;
var propertyName;
var propertyName2;
var canConnectToChannelBinding;
var channelStoreBinding;
var getBasicChannel;
var value9;
var value10;
var userGuildSettingsStoreBinding;
var isGuildOrCategoryOrChannelMuted;
var value11;
var value12;
var done;
var value13;
var property;
var value14;
var value15;
var value16;
var hasVideo;
let value = environment.__proto__;
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
const guild = GuildStore.getGuild(env0_0);
const value5 = undefined;
reducibleJoin2: while (true) {
if (guild == null) {
afkChannelId = value5;
break reducibleJoin2;
}
afkChannelId = guild.afkChannelId;
break reducibleJoin2;
}
let voiceStateStoreBinding = VoiceStateStore;
const getUsersWithVideo = voiceStateStoreBinding.getUsersWithVideo;
const binding = env0_0;
const value6 = Reflect.apply(getUsersWithVideo, voiceStateStoreBinding, [binding]);
const filterBlockedUsersFromVoiceStates = BlockedUserUtilsModule.filterBlockedUsersFromVoiceStates;
const getVoiceStates = voiceStateStoreBinding.getVoiceStates;
const value7 = Reflect.apply(filterBlockedUsersFromVoiceStates, BlockedUserUtilsModule,
[Reflect.apply(getVoiceStates, voiceStateStoreBinding, [binding])]);
const object = {};
const value8 = false;
reducibleJoin10: while (true) {
if (env0_1) {
r3 = value8;
break reducibleJoin10;
}
properties = Object.keys(value7);
properties2 = 0;
properties3 = properties.length;
if (properties === value5) {
r3 = value8;
break reducibleJoin10;
}
r15 = properties2;
reducibleLoop4: while (true) {
propertyName = properties[r15];
propertyName2 = r15 + 1;
if (propertyName === value5) {
r3 = value8;
break reducibleJoin10;
}
channelId = value7[propertyName].channelId;
if (channelId == null) {
r15 = propertyName2;
continue reducibleLoop4;
}
canConnectToChannelBinding = canConnectToChannel;
channelStoreBinding = ChannelStore;
getBasicChannel = channelStoreBinding.getBasicChannel;
value9 = Reflect.apply(getBasicChannel, channelStoreBinding, [channelId]);
r18 = afkChannelId ?? value5;
if (canConnectToChannelBinding(value9, r18, PermissionStore)) {
value10 = true;
if (env0_2) {
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isGuildOrCategoryOrChannelMuted = userGuildSettingsStoreBinding.isGuildOrCategoryOrChannelMuted;
if (Reflect.apply(isGuildOrCategoryOrChannelMuted, userGuildSettingsStoreBinding, [env0_0,
channelId])) {
r15 = propertyName2;
continue reducibleLoop4;
}
r3 = value10;
break reducibleJoin10;
}
r3 = value10;
break reducibleJoin10;
}
r15 = propertyName2;
continue reducibleLoop4;
}
}
object.guildHasVoice = r3;
reducibleJoin20: while (true) {
if (env0_1) {
r3 = value8;
break reducibleJoin20;
}
value11 = _createForOfIteratorHelperLoose_109130(value6);
value12 = value11();
done = value12.done;
if (done) {
r3 = value8;
break reducibleJoin20;
}
r6 = value12;
reducibleLoop12: while (true) {
value13 = r6.value;
property = value7[value13];
reducibleJoin14: while (true) {
if (property == null) {
channelId = value5;
break reducibleJoin14;
}
channelId = property.channelId;
break reducibleJoin14;
}
if (channelId != null) {
canConnectToChannelBinding = canConnectToChannel;
channelStoreBinding = ChannelStore;
getBasicChannel = channelStoreBinding.getBasicChannel;
value14 = Reflect.apply(getBasicChannel, channelStoreBinding, [channelId]);
r14 = afkChannelId ?? value5;
reducibleJoin19: while (true) {
if (canConnectToChannelBinding(value14, r14, PermissionStore)) {
value15 = true;
if (env0_2) {
userGuildSettingsStoreBinding = UserGuildSettingsStore;
isGuildOrCategoryOrChannelMuted = userGuildSettingsStoreBinding.isGuildOrCategoryOrChannelMuted;
if (Reflect.apply(isGuildOrCategoryOrChannelMuted, userGuildSettingsStoreBinding, [env0_0,
channelId])) {
break reducibleJoin19;
}
r3 = value15;
break reducibleJoin20;
}
r3 = value15;
break reducibleJoin20;
}
break reducibleJoin19;
}
}
value16 = value11();
done = value16.done;
if (done) {
r3 = value8;
break reducibleJoin20;
}
r6 = value16;
continue reducibleLoop12;
}
}
object.guildHasVideo = r3;
const value17 = voiceChannelId != null;
reducibleJoin22: while (true) {
if (value17) {
voiceStateStoreBinding = VoiceStateStore;
hasVideo = voiceStateStoreBinding.hasVideo;
value = Reflect.apply(hasVideo, voiceStateStoreBinding, [voiceChannelId]);
r1 = value;
break reducibleJoin22;
}
r1 = value17;
break reducibleJoin22;
}
object.selectedVoiceChannelHasVideo = r1;
return object;
}
function _fun109139() { // fn#109139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:2854, offset: 0x0233f53f, size: 610 bytes, params: 1, frame: 30
var environment;
var guild_id;
var r6;
var r2;
var r4;
var r9;
var r7;
var r3;
var channel_id;
var r10;
var r5;
var guildHasVoice2;
var value9;
var isGuildStageVoice;
var isGuildStageVoice2;
var value10;
var applicationStreamingStoreBinding;
var getActiveStreamForUser;
var binding;
var value12;
var value15;
var value16;
var done;
var value17;
var value18;
var moduleValue2;
var getEmbeddedActivityLocationChannelId;
var location;
var value19;
var isVoiceChannelBinding;
var type;
var isVoiceChannel2;
var value20;
var value21;
var guildHasVoiceBinding;
var guildHasVideoBinding;
var value23;
var value24;
let value = environment.__proto__;
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
let channelStoreBinding = ChannelStore;
let getChannel = channelStoreBinding.getChannel;
const value3 = Reflect.apply(getChannel, channelStoreBinding, [voiceChannelId]);
const value4 = undefined;
reducibleJoin2: while (true) {
if (value3 == null) {
guild_id = value4;
break reducibleJoin2;
}
guild_id = value3.guild_id;
break reducibleJoin2;
}
const value6 = guild_id === env0_0;
if (!value6) {
reducibleJoin5: while (true) {
if (env0_1) {
return {'audio': false, 'video': false, 'screenshare': false, 'liveStage': false, 'activeEvent': false,
'activity': false, 'isCurrentUserConnected': false};
}
break reducibleJoin5;
}
}
const defaultImport = SnowflakeUtils;
const keys = defaultImport.keys;
const stageInstanceStoreBinding = StageInstanceStore;
const getStageInstancesByGuild = stageInstanceStoreBinding.getStageInstancesByGuild;
const value8 = Reflect.apply(keys, defaultImport, [Reflect.apply(getStageInstancesByGuild,
stageInstanceStoreBinding, [env0_0])]).some(_fun109140);
reducibleJoin9: while (true) {
if (value6) {
channelStoreBinding = ChannelStore;
getChannel = channelStoreBinding.getChannel;
value9 = Reflect.apply(getChannel, channelStoreBinding, [voiceChannelId]);
reducibleJoin8: while (true) {
if (value9 == null) {
r6 = value4;
break reducibleJoin8;
}
isGuildStageVoice = value9.isGuildStageVoice;
isGuildStageVoice2 = Reflect.apply(isGuildStageVoice, value9, []);
r6 = isGuildStageVoice2;
break reducibleJoin8;
}
value10 = r6 != null;
r2 = value10;
r4 = r6;
break reducibleJoin9;
}
r2 = value6;
r4 = value4;
break reducibleJoin9;
}
r2 = r2 && r4;
reducibleJoin12: while (true) {
if (value6) {
applicationStreamingStoreBinding = ApplicationStreamingStore;
getActiveStreamForUser = applicationStreamingStoreBinding.getActiveStreamForUser;
binding = env0_9;
value12 = Reflect.apply(getActiveStreamForUser, applicationStreamingStoreBinding, [binding,
env0_0]) != null;
r9 = value12;
break reducibleJoin12;
}
r9 = !!value6;
break reducibleJoin12;
}
const filterOutStreamsByBlockedOwner = BlockedUserUtilsModule.filterOutStreamsByBlockedOwner;
applicationStreamingStoreBinding = ApplicationStreamingStore;
const getAllApplicationStreams = applicationStreamingStoreBinding.getAllApplicationStreams;
const value14 = Reflect.apply(filterOutStreamsByBlockedOwner, BlockedUserUtilsModule,
[Reflect.apply(getAllApplicationStreams, applicationStreamingStoreBinding, [])]).some(_fun109141);
if (ChannelRecordModule.isVoiceChannel) {
r3 = env0_4.length > 0;
} else {
value15 = _createForOfIteratorHelperLoose_109130(env0_4);
value16 = value15();
done = value16.done;
value17 = false;
if (done) {
r3 = value17;
} else {
r7 = value16;
reducibleLoop14: while (true) {
value18 = r7.value;
channelStoreBinding = ChannelStore;
getChannel = channelStoreBinding.getChannel;
moduleValue2 = require(3774) /* metro dependency 3774: embeddedActivityLocationUtils */;
getEmbeddedActivityLocationChannelId = moduleValue2.getEmbeddedActivityLocationChannelId;
location = value18.location;
value19 = Reflect.apply(getChannel, channelStoreBinding,
[Reflect.apply(getEmbeddedActivityLocationChannelId,
moduleValue2, [location])]);
if (value19 != null) {
isVoiceChannelBinding = isVoiceChannel;
type = value19.type;
isVoiceChannel2 = isVoiceChannelBinding(type);
value20 = true;
reducibleJoin16: while (true) {
if (isVoiceChannel2) {
r3 = value20;
break reducibleLoop14;
}
break reducibleJoin16;
}
}
value21 = value15();
done = value21.done;
if (done) {
r3 = value17;
break reducibleLoop14;
}
r7 = value21;
continue reducibleLoop14;
}
}
}
const embeddedActivitiesStoreBinding = EmbeddedActivitiesStore;
const getEmbeddedActivitiesForGuild = embeddedActivitiesStoreBinding.getEmbeddedActivitiesForGuild;
value = Reflect.apply(getEmbeddedActivitiesForGuild, embeddedActivitiesStoreBinding, [env0_0]).length > 0;
if (value6) {
reducibleJoin22: while (true) {
if (env0_3 == null) {
channel_id = value4;
break reducibleJoin22;
}
channel_id = env0_3.channel_id;
break reducibleJoin22;
}
value23 = channel_id === voiceChannelId;
reducibleJoin24: while (true) {
if (value6) {
r10 = selectedVoiceChannelHasVideo;
break reducibleJoin24;
}
r10 = value6;
break reducibleJoin24;
}
value24 = true;
r3 = value;
r4 = value23;
r5 = r2;
r6 = r9;
r7 = r10;
guildHasVoice2 = value24;
} else {
guildHasVoiceBinding = guildHasVoice;
value = env0_3 != null;
guildHasVideoBinding = guildHasVideo;
r4 = value;
r5 = value8;
r6 = value14;
r7 = guildHasVideoBinding;
guildHasVoice2 = guildHasVoiceBinding;
}
return {audio: guildHasVoice2, video: r7, screenshare: r6, liveStage: r5, activeEvent: r4, activity: r3,
isCurrentUserConnected: value6 || r2};
function _fun109140(a0) { // fn#109140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:3142, offset: 0x0233f7a1, size: 75 bytes, params: 2, frame: 16
const value = environment.__proto__.__proto__;
const channel = ChannelStore.getChannel(a0);
return channel != null && PermissionStore.can((require(1387) /* metro dependency 1387: StageChannelPermissions */).JOIN_VOCAL_CHANNEL_PERMISSIONS,
channel);
}
function _fun109141(a0) { // fn#109141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:3432, offset: 0x0233f7ec, size: 65 bytes, params: 2, frame: 15
const guildId = a0.guildId;
const value = environment.__proto__;
return !(guildId !== env1_0 || env1_2 && UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(env1_0,
a0.channelId));
}
}
}
}
global.__d(_fun109129, 14418, [1378, 1384, 1383, 4492, 1226, 1379, 1867, 3784, 3793, 1934, 4864, 4297, 661, 677,
566, 14419, 9127, 14420, 3774, 8448, 21, 1387,
2]) /* metro module 14418, dependencies: [1378, 1384, 1383, 4492, 1226, 1379, 1867, 3784, 3793, 1934, 4864, 4297, 661, 677, 566, 14419, 9127, 14420, 3774, 8448, 21, 1387, 2] */;