decord/alpha/source/stores/ApplicationStreamingStore.tsx

950 lines
30 KiB
TypeScript
Raw Permalink Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 5897
// Function ID: 5898
// Name: ApplicationStreamingStore
2026-10-10 08:08:14 +00:00
// Dependencies: [5111, 2019, 502, 2065, 2087, 2012, 4750, 5110, 2116, 5113, 1085, 5898, 1102, 5900, 5901, 5902, 5903, 2000, 5907, 504, 5946, 584, 2]
2026-07-20 16:05:17 +00:00
2026-10-10 08:08:14 +00:00
// Module 5897 (ApplicationStreamingStore)
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
import DurationsDefault from "Durations" /* 1102 */;
2026-10-09 10:00:15 +00:00
import asyncRequire from "asyncRequire" /* 2000 */;
2026-10-10 08:08:14 +00:00
import Constants2 from "Constants" /* 5898 */;
import StreamKeyUtils from "StreamKeyUtils" /* 5900 */;
import _slicedToArrayDefault from "_slicedToArray" /* 5901 */;
import getTitleFromPickedStreamContentDefault from "getTitleFromPickedStreamContent" /* 5902 */;
import StreamPermissionUtils from "StreamPermissionUtils" /* 5907 */;
import canSpectateDefault from "canSpectate" /* 5946 */;
import GameConsoleStore from "GameConsoleStore" /* 5111 */;
2026-10-09 10:00:15 +00:00
import RunningGameStore from "RunningGameStore" /* 2019 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
2026-10-10 08:08:14 +00:00
import ChannelStore from "ChannelStore" /* 2065 */;
import GuildStore from "GuildStore" /* 2087 */;
2026-10-09 10:00:15 +00:00
import MediaEngineStore from "MediaEngineStore" /* 2012 */;
2026-10-10 08:08:14 +00:00
import PermissionStore from "PermissionStore" /* 4750 */;
import RTCConnectionStore from "RTCConnectionStore" /* 5110 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2116 */;
import VoiceStateStore from "VoiceStateStore" /* 5113 */;
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let set;
let closure_18;
let closure_19;
let closure_20;
let closure_21;
let closure_22;
2026-07-20 16:05:17 +00:00
function reset() {
2026-08-24 06:08:38 +00:00
map = new Map();
streamsByUserAndGuild = {};
2026-10-03 08:58:59 +00:00
let closure_5 = {};
let closure_6 = {};
2026-08-24 06:08:38 +00:00
map1 = new Map();
2026-07-20 16:05:17 +00:00
}
function handleStreamUpdate(streamKey) {
2026-10-03 08:58:59 +00:00
let paused;
let region;
let viewerIds;
2026-07-20 16:05:17 +00:00
streamKey = streamKey.streamKey;
({ region, viewerIds, paused } = streamKey);
2026-10-03 08:58:59 +00:00
const value = map1.get(streamKey);
2026-07-21 06:55:02 +00:00
let tmp2 = null == value;
if (!tmp2) {
const _Date = Date;
2026-07-29 08:29:29 +00:00
tmp2 = Date.now() - value < closure_27;
2026-07-21 06:55:02 +00:00
}
2026-10-03 08:58:59 +00:00
!tmp2 && map1.delete(streamKey);
const obj = { state: paused ? constants.PAUSED : constants.ACTIVE };
set = map.set;
const obj2 = StreamKeyUtils;
const merged = Object.assign(obj2.decodeStreamKey(streamKey));
const result = set(streamKey, obj);
rtcStreams[streamKey] = { streamKey, region, viewerIds };
2026-07-20 16:05:17 +00:00
}
({ ApplicationStreamStates: closure_18, RTCConnectionStates: closure_19, ApplicationStreamDeleteReasons: closure_20, NULL_STRING_GUILD_ID: closure_21, BasicPermissions: closure_22 } = Constants);
2026-10-03 08:58:59 +00:00
const StreamTypes = Constants2.StreamTypes;
const selfStreamParticipantsHidden = {};
let intent = null;
let closure_27 = 10 * DurationsDefault.Millis.SECOND;
2026-07-29 08:29:29 +00:00
let map = new Map();
let streamsByUserAndGuild = {};
const rtcStreams = {};
2026-10-03 08:58:59 +00:00
const metroRequire = {};
2026-07-29 08:29:29 +00:00
let map1 = new Map();
let pid;
let id;
2026-10-03 08:58:59 +00:00
const PersistedStore = get_initializedDefault.PersistedStore;
2026-07-29 08:29:29 +00:00
class ApplicationStreamingStore extends PersistedStore {
2026-10-03 08:58:59 +00:00
initialize(selfStreamParticipantsHidden) {
const items = [PermissionStore];
this.syncWith(items, () => true);
this.waitFor(AuthenticationStore, ChannelStore, PermissionStore, RTCConnectionStore, RunningGameStore, SelectedChannelStore);
let prop;
2026-07-29 08:29:29 +00:00
if (selfStreamParticipantsHidden != null) {
2026-10-03 08:58:59 +00:00
prop = selfStreamParticipantsHidden.selfStreamParticipantsHidden;
}
if (undefined !== prop) {
let prop1;
const _Object = Object;
const tmp5 = selfStreamParticipantsHidden;
if (selfStreamParticipantsHidden != null) {
prop1 = selfStreamParticipantsHidden.selfStreamParticipantsHidden;
}
assign(tmp5, prop1);
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
getState() {
return { selfStreamParticipantsHidden };
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
isSelfStreamHidden(id) {
let flag = selfStreamParticipantsHidden[id];
if (flag == null) {
flag = false;
}
return flag;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getLastActiveStream() {
let tmp = null;
if (canSpectateDefault(MediaEngineStore)) {
const _Array = Array;
const arr = Array.from(map.values());
let arr2 = arr.pop();
if (arr2 == null) {
arr2 = null;
}
tmp = arr2;
}
return tmp;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getAllActiveStreams() {
let items;
if (canSpectateDefault(MediaEngineStore)) {
const _Array = Array;
items = Array.from(map.values());
} else {
items = [];
}
return items;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getAllActiveStreamsForChannel(channelId) {
let found;
let closure_0 = channelId;
if (canSpectateDefault(MediaEngineStore)) {
const _Array = Array;
const arr = Array.from(map.values());
found = arr.filter((channelId) => channelId.channelId === closure_0);
} else {
found = [];
}
return found;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getActiveStreamForStreamKey(id) {
let tmp = null;
if (canSpectateDefault(MediaEngineStore)) {
let value = map.get(id);
if (value == null) {
value = null;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp = value;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getActiveStreamForApplicationStream(streamForUser) {
if (canSpectateDefault(MediaEngineStore)) {
if (null != streamForUser) {
const self = this;
const obj = StreamKeyUtils;
let activeStreamForStreamKey = this.getActiveStreamForStreamKey(obj.encodeStreamKey(streamForUser));
if (activeStreamForStreamKey == null) {
activeStreamForStreamKey = null;
}
return activeStreamForStreamKey;
}
}
return null;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getCurrentUserActiveStream() {
const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId());
let activeStreamForUser = null;
if (null != channel) {
const self = this;
const getActiveStreamForUser = this.getActiveStreamForUser;
id = AuthenticationStore.getId();
activeStreamForUser = getActiveStreamForUser(id, channel.getGuildId());
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return activeStreamForUser;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
isStreamMarkedFull(encodeStreamKeyResult) {
return map1.has(encodeStreamKeyResult);
}
getActiveStreamForUser(id, guildId) {
let activeStreamForApplicationStream;
2026-07-29 08:29:29 +00:00
const self = this;
2026-10-03 08:58:59 +00:00
let closure_0 = id;
const streamForUser = this.getStreamForUser(id, guildId);
if (null != streamForUser) {
activeStreamForApplicationStream = self.getActiveStreamForApplicationStream(streamForUser);
} else {
const allActiveStreams = self.getAllActiveStreams();
activeStreamForApplicationStream = allActiveStreams.find((ownerId) => ownerId.ownerId === id);
if (activeStreamForApplicationStream == null) {
activeStreamForApplicationStream = null;
}
}
return activeStreamForApplicationStream;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getStreamerActiveStreamMetadata() {
const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId());
if (null == channel) {
return null;
} else {
const self = this;
const getActiveStreamForUser = this.getActiveStreamForUser;
id = AuthenticationStore.getId();
const activeStreamForUser = getActiveStreamForUser(id, channel.getGuildId());
let tmp4 = null;
if (null != activeStreamForUser) {
const obj2 = StreamKeyUtils;
let tmp8 = streamerActiveStreamMetadatas[obj2.encodeStreamKey(obj2, activeStreamForUser)];
if (tmp8 == null) {
tmp8 = null;
}
tmp4 = tmp8;
}
return tmp4;
}
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getStreamerActiveStreamMetadataForStream(arg0) {
let tmp = streamerActiveStreamMetadatas[arg0];
if (tmp == null) {
tmp = null;
}
return tmp;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getIsActiveStreamPreviewDisabled(arg0) {
let flag;
if (streamerActiveStreamMetadatas[arg0] != null) {
flag = tmp.previewDisabled;
}
if (flag == null) {
flag = false;
}
return flag;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getAnyStreamForUser(userId) {
if (canSpectateDefault(MediaEngineStore)) {
let tmp2 = streamsByUserAndGuild;
let tmp4 = null;
if (null != streamsByUserAndGuild[userId]) {
const _Object = Object;
const values = Object.values(tmp3);
let found = values.find((streamType) => {
streamType = streamType.streamType;
const obj = basicChannel;
basicChannel = basicChannel.getBasicChannel(streamType.channelId);
let tmp2 = streamType === constants2.CALL;
if (!tmp2) {
tmp2 = null != basicChannel && PermissionStore.canBasicChannel(constants.VIEW_CHANNEL, basicChannel);
const canBasicChannelResult = null != basicChannel && PermissionStore.canBasicChannel(constants.VIEW_CHANNEL, basicChannel);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
let flag = true;
if (!tmp2) {
const basicChannel1 = obj.getBasicChannel(streamType.channelId);
let first = null != basicChannel1;
if (first) {
const obj2 = StreamPermissionUtils;
first = obj2.canWatchStream(basicChannel1, VoiceStateStore, GuildStore, PermissionStore, GameConsoleStore)[0];
}
flag = first;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return flag;
});
if (found == null) {
found = null;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp4 = found;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp4;
} else {
return null;
2026-07-21 06:55:02 +00:00
}
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getAnyDiscoverableStreamForUser(userId) {
if (canSpectateDefault(MediaEngineStore)) {
let tmp2 = streamsByUserAndGuild;
let tmp4 = null;
if (null != streamsByUserAndGuild[userId]) {
const _Object = Object;
const values = Object.values(tmp3);
let found = values.find((streamType) => {
streamType = streamType.streamType;
const obj = basicChannel;
basicChannel = basicChannel.getBasicChannel(streamType.channelId);
let tmp2 = streamType === constants2.CALL;
if (!tmp2) {
tmp2 = null != basicChannel && PermissionStore.canBasicChannel(constants.VIEW_CHANNEL, basicChannel);
const canBasicChannelResult = null != basicChannel && PermissionStore.canBasicChannel(constants.VIEW_CHANNEL, basicChannel);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
let flag = true;
if (!tmp2) {
const basicChannel1 = obj.getBasicChannel(streamType.channelId);
let first = null != basicChannel1;
if (first) {
const obj2 = StreamPermissionUtils;
first = obj2.canWatchStream(basicChannel1, VoiceStateStore, GuildStore, PermissionStore, GameConsoleStore)[0];
}
flag = first;
}
if (flag) {
flag = false !== streamType.discoverable;
}
return flag;
});
if (found == null) {
found = null;
}
tmp4 = found;
}
return tmp4;
} else {
return null;
}
}
getStreamForUser(id, guildId) {
if (canSpectateDefault(MediaEngineStore)) {
let tmp5;
if (streamsByUserAndGuild[id] != null) {
let tmp6 = guildId;
if (guildId == null) {
tmp6 = closure_21;
}
tmp5 = tmp4[tmp6];
}
let tmp7 = null;
if (null != tmp5) {
const streamType = tmp5.streamType;
const basicChannel = ChannelStore.getBasicChannel(tmp5.channelId);
let tmp10 = streamType === StreamTypes.CALL;
const obj = ChannelStore;
if (!tmp10) {
tmp10 = null != basicChannel && PermissionStore.canBasicChannel(constants4.VIEW_CHANNEL, basicChannel);
const canBasicChannelResult = null != basicChannel && PermissionStore.canBasicChannel(constants4.VIEW_CHANNEL, basicChannel);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let flag = true;
2026-10-03 08:58:59 +00:00
if (!tmp10) {
const basicChannel1 = obj.getBasicChannel(tmp5.channelId);
2026-07-29 08:29:29 +00:00
let first = null != basicChannel1;
if (first) {
const obj2 = StreamPermissionUtils;
first = obj2.canWatchStream(basicChannel1, VoiceStateStore, GuildStore, PermissionStore, GameConsoleStore)[0];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
flag = first;
}
2026-10-03 08:58:59 +00:00
let tmp23 = null;
2026-07-29 08:29:29 +00:00
if (flag) {
2026-10-03 08:58:59 +00:00
tmp23 = tmp5;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp7 = tmp23;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp7;
} else {
return null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getRTCStream(arg0) {
let tmp = null;
if (canSpectateDefault(MediaEngineStore)) {
let tmp4 = rtcStreams[arg0];
if (tmp4 == null) {
tmp4 = null;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp = tmp4;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getAllApplicationStreams() {
let found;
const items = [];
if (canSpectateDefault(MediaEngineStore)) {
for (const key10011 in streamsByUserAndGuild) {
let tmp5 = key10011;
let keys = Object.keys();
if (keys === undefined) {
2026-07-29 08:29:29 +00:00
continue;
2026-10-03 08:58:59 +00:00
} else {
let tmp4 = keys[tmp];
while (tmp4 !== undefined) {
let arr = items.push(streamsByUserAndGuild[key10011][tmp4]);
continue;
}
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
found = items.filter((streamType) => {
let tmp = null != streamType;
if (tmp) {
streamType = streamType.streamType;
basicChannel = basicChannel.getBasicChannel(streamType.channelId);
let tmp5 = streamType === constants2.CALL;
if (!tmp5) {
tmp5 = null != basicChannel && PermissionStore.canBasicChannel(constants.VIEW_CHANNEL, basicChannel);
const canBasicChannelResult = null != basicChannel && PermissionStore.canBasicChannel(constants.VIEW_CHANNEL, basicChannel);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp = tmp5;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp;
});
} else {
found = items;
}
return found;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getAllApplicationStreamsForChannel(id) {
let found;
let closure_0 = id;
const items = [];
if (canSpectateDefault(MediaEngineStore)) {
for (const key10012 in streamsByUserAndGuild) {
let tmp6 = streamsByUserAndGuild;
let keys = Object.keys();
if (keys === undefined) {
2026-07-29 08:29:29 +00:00
continue;
2026-10-03 08:58:59 +00:00
} else {
let tmp4 = keys[tmp];
while (tmp4 !== undefined) {
let arr = items.push(streamsByUserAndGuild[key10012][tmp4]);
continue;
}
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
found = items.filter((channelId) => {
let tmp = null != channelId && channelId.channelId === id;
if (tmp) {
const streamType = channelId.streamType;
const basicChannel = ChannelStore.getBasicChannel(channelId.channelId);
let tmp6 = streamType === StreamTypes.CALL;
if (!tmp6) {
tmp6 = null != basicChannel && PermissionStore.canBasicChannel(constants.VIEW_CHANNEL, basicChannel);
const canBasicChannelResult = null != basicChannel && PermissionStore.canBasicChannel(constants.VIEW_CHANNEL, basicChannel);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
tmp = tmp6;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp;
});
} else {
found = items;
}
return found;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getViewerIds(currentUserActiveStream) {
if (canSpectateDefault(MediaEngineStore)) {
let encodeStreamKeyResult = currentUserActiveStream;
if (typeof currentUserActiveStream !== "string") {
const obj = StreamKeyUtils;
encodeStreamKeyResult = obj.encodeStreamKey(currentUserActiveStream);
}
let tmp5 = null;
if (null != encodeStreamKeyResult) {
tmp5 = rtcStreams[encodeStreamKeyResult];
}
return null != tmp5 ? tmp5.viewerIds : [];
} else {
return [];
}
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getCurrentAppIntent() {
return intent;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getStreamingState() {
let tmp;
const obj = { activeStreams: null, streamsByUserAndGuild: null, rtcStreams: null, streamerActiveStreamMetadatas: null };
if (canSpectateDefault(MediaEngineStore)) {
const _Array = Array;
obj.activeStreams = Array.from(map.entries());
obj.streamsByUserAndGuild = streamsByUserAndGuild;
obj.rtcStreams = rtcStreams;
obj.streamerActiveStreamMetadatas = streamerActiveStreamMetadatas;
tmp = obj;
} else {
obj.activeStreams = [];
obj.streamsByUserAndGuild = {};
obj.rtcStreams = {};
obj.streamerActiveStreamMetadatas = {};
tmp = obj;
}
return tmp;
}
}
const prototype = ApplicationStreamingStore.prototype;
2026-07-29 08:29:29 +00:00
ApplicationStreamingStore.displayName = "ApplicationStreamingStore";
ApplicationStreamingStore.persistKey = "ApplicationStreamingStore";
2026-10-03 08:58:59 +00:00
let obj = {
MEDIA_ENGINE_SET_GO_LIVE_SOURCE: function handleSetGoLiveSource(endReason) {
let errorCode;
let settings;
({ settings, errorCode } = endReason);
2026-07-20 16:05:17 +00:00
let desktopSettings;
2026-10-03 08:58:59 +00:00
endReason = endReason.endReason;
2026-07-29 08:29:29 +00:00
if (settings != null) {
2026-07-20 16:05:17 +00:00
desktopSettings = settings.desktopSettings;
}
if (null == desktopSettings) {
let cameraSettings;
2026-07-29 08:29:29 +00:00
if (settings != null) {
2026-07-20 16:05:17 +00:00
cameraSettings = settings.cameraSettings;
}
if (null == cameraSettings) {
if (null == errorCode) {
return false;
} else {
let flag = false;
2026-07-29 08:29:29 +00:00
let flag2 = false;
2026-07-20 16:05:17 +00:00
const keys = Object.keys();
if (keys !== undefined) {
2026-07-29 08:29:29 +00:00
flag2 = flag;
2026-07-20 16:05:17 +00:00
while (keys[tmp] !== undefined) {
2026-10-03 08:58:59 +00:00
let value = map.get(tmp7);
2026-07-20 16:05:17 +00:00
if (null == value) {
continue;
} else {
2026-10-03 08:58:59 +00:00
let obj = { state: constants.FAILED, endReason, errorCode };
set = map.set;
2026-07-20 16:05:17 +00:00
let merged = Object.assign(value);
2026-10-03 08:58:59 +00:00
let result = set(tmp7, obj);
2026-07-29 08:29:29 +00:00
flag = true;
2026-07-20 16:05:17 +00:00
continue;
}
continue;
}
}
2026-07-29 08:29:29 +00:00
return flag2;
2026-07-20 16:05:17 +00:00
}
}
}
return false;
},
NATIVE_SCREEN_SHARE_PICKER_UPDATE: function handleNativePickerUpdate(content) {
2026-10-03 08:58:59 +00:00
let tmp2;
function getGameForContent(content) {
const obj = content.applications[Symbol.iterator]();
while (obj !== undefined) {
let gameForPID = RunningGameStore.getGameForPID(tmp.id);
if (null != gameForPID) {
obj.return();
return gameForPID;
}
}
const windows = content.windows;
for (const item10023 of windows) {
if (null != item10023.owningApplication) {
let gameForPID1 = RunningGameStore.getGameForPID(tmp6.owningApplication.id);
if (null != gameForPID1) {
obj2.return();
return gameForPID1;
}
}
continue;
}
}
2026-07-20 16:05:17 +00:00
content = content.content;
if (null == content) {
return false;
} else {
2026-10-03 08:58:59 +00:00
const tmp20 = getGameForContent(content);
id = tmp20;
pid = undefined;
2026-07-29 08:29:29 +00:00
if (tmp20 != null) {
pid = tmp20.pid;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp2) {
2026-10-03 08:58:59 +00:00
let tmp4 = importDefault;
let tmp5 = dependencyMap;
2026-08-24 06:08:38 +00:00
const tmp6 = getTitleFromPickedStreamContentDefault(content);
2026-10-03 08:58:59 +00:00
let obj = { pid, id };
let tmp7 = pid;
id = undefined;
if (id != null) {
id = id.id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (null != tmp6) {
obj.sourceName = tmp6;
2026-07-20 16:05:17 +00:00
}
let flag2 = false;
let flag3 = false;
const keys = Object.keys();
if (keys !== undefined) {
2026-10-03 08:58:59 +00:00
let tmp11 = flag2;
2026-07-20 16:05:17 +00:00
flag3 = flag2;
2026-07-29 08:29:29 +00:00
while (keys[tmp] !== undefined) {
let tmp23 = streamerActiveStreamMetadatas[tmp12];
2026-07-29 08:29:29 +00:00
let startsWithResult;
if (tmp23 != null) {
let sourceId = tmp23.sourceId;
if (sourceId != null) {
startsWithResult = sourceId.startsWith("prepicked:");
}
2026-07-20 16:05:17 +00:00
}
if (!startsWithResult) {
continue;
} else {
let obj2 = {};
let merged = Object.assign(streamerActiveStreamMetadatas[tmp12]);
2026-07-20 16:05:17 +00:00
let merged1 = Object.assign(obj);
streamerActiveStreamMetadatas[tmp12] = obj2;
2026-07-20 16:05:17 +00:00
flag2 = true;
2026-07-23 10:11:24 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
continue;
}
}
return flag3;
} else {
return false;
}
}
},
OVERLAY_INITIALIZE: function handleOverlayInitialize(applicationStreamState) {
2026-10-03 08:58:59 +00:00
let closure_5;
let closure_6;
2026-07-20 16:05:17 +00:00
applicationStreamState = applicationStreamState.applicationStreamState;
streamsByUserAndGuild = applicationStreamState.streamsByUserAndGuild;
2026-08-24 06:08:38 +00:00
map = new Map(applicationStreamState.activeStreams);
2026-07-20 16:05:17 +00:00
({ rtcStreams: closure_5, streamerActiveStreamMetadatas: closure_6 } = applicationStreamState);
2026-08-24 06:08:38 +00:00
map1 = new Map();
2026-07-20 16:05:17 +00:00
},
VOICE_STATE_UPDATES: function handleVoiceStateUpdates(voiceStates) {
2026-10-03 08:58:59 +00:00
let channelId;
2026-07-20 16:05:17 +00:00
voiceStates = voiceStates.voiceStates;
return voiceStates.reduce((acc, selfStream) => {
2026-10-03 08:58:59 +00:00
let guildId;
let sessionId;
let userId;
2026-07-20 16:05:17 +00:00
({ userId, guildId, channelId, sessionId } = selfStream);
if (selfStream.selfStream) {
2026-10-03 08:58:59 +00:00
let tmp2 = null;
2026-07-20 16:05:17 +00:00
if (null != channelId) {
2026-10-03 08:58:59 +00:00
let CALL;
2026-07-20 16:05:17 +00:00
if (null != guildId) {
2026-10-03 08:58:59 +00:00
CALL = constants.GUILD;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
CALL = constants.CALL;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
let obj = { streamType: CALL, ownerId: userId, guildId, channelId, discoverable: tmp };
if (null == closure_4[obj.ownerId]) {
closure_4[obj.ownerId] = {};
2026-07-20 16:05:17 +00:00
}
let guildId2 = obj.guildId;
2026-10-03 08:58:59 +00:00
const tmp17 = closure_4[obj.ownerId];
2026-07-29 08:29:29 +00:00
if (guildId2 == null) {
guildId2 = closure_21;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp17[guildId2] = obj;
2026-07-20 16:05:17 +00:00
return true;
}
}
id = closure_10.getId();
2026-07-20 16:05:17 +00:00
if (userId === id) {
if (sessionId !== closure_10.getSessionId()) {
2026-10-03 08:58:59 +00:00
let tmp5 = null;
2026-07-29 08:29:29 +00:00
if (null != channelId.getChannelId()) {
return acc;
2026-07-21 06:55:02 +00:00
}
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
let closure_2 = false;
const item = set.forEach((item, index) => {
2026-10-03 08:58:59 +00:00
const obj = StreamKeyUtils;
const decodeStreamKeyResult = obj.decodeStreamKey(index);
2026-07-29 08:29:29 +00:00
let tmp2 = decodeStreamKeyResult.ownerId === userId;
if (tmp2) {
2026-08-24 06:08:38 +00:00
guildId = decodeStreamKeyResult.guildId;
2026-07-29 08:29:29 +00:00
if (guildId == null) {
guildId = null;
}
let tmp5 = guildId;
if (guildId == null) {
tmp5 = null;
}
tmp2 = guildId === tmp5;
}
if (tmp2) {
const tmp7 = set.delete(index) || closure_2;
2026-10-03 08:58:59 +00:00
closure_2 = tmp7;
2026-07-29 08:29:29 +00:00
}
});
2026-10-03 08:58:59 +00:00
let tmp8 = guildId;
let tmp7 = closure_2;
2026-07-29 08:29:29 +00:00
if (guildId == null) {
2026-10-03 08:58:59 +00:00
tmp8 = closure_21;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
let tmp10;
if (closure_4[userId] != null) {
tmp10 = tmp9[tmp8];
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
let flag = null != tmp10;
2026-07-20 16:05:17 +00:00
if (flag) {
2026-10-03 08:58:59 +00:00
delete closure_4[userId][tmp8];
2026-07-20 16:05:17 +00:00
flag = true;
}
2026-07-21 06:55:02 +00:00
if (!flag) {
2026-10-03 08:58:59 +00:00
flag = tmp7;
2026-07-21 06:55:02 +00:00
}
2026-07-20 16:05:17 +00:00
if (!flag) {
flag = acc;
2026-07-20 16:05:17 +00:00
}
2026-07-21 06:55:02 +00:00
return flag;
2026-07-20 16:05:17 +00:00
}, false);
},
STREAM_WATCH: function handleStreamWatch(streamKey) {
streamKey = streamKey.streamKey;
2026-10-03 08:58:59 +00:00
const obj = StreamKeyUtils;
const decodeStreamKeyResult = obj.decodeStreamKey(streamKey);
2026-07-29 08:29:29 +00:00
map.delete(streamKey);
2026-10-03 08:58:59 +00:00
const obj2 = { state: constants.CONNECTING };
set = map.set;
2026-07-20 16:05:17 +00:00
const merged = Object.assign(decodeStreamKeyResult);
2026-10-03 08:58:59 +00:00
const result = set(streamKey, obj2);
if (decodeStreamKeyResult.ownerId === AuthenticationStore.getId()) {
2026-10-03 08:58:59 +00:00
selfStreamParticipantsHidden[decodeStreamKeyResult.channelId] = false;
2026-07-20 16:05:17 +00:00
}
},
STREAM_START: function handleStreamStart(arg0) {
2026-10-03 08:58:59 +00:00
let channelId;
let gameForPID;
let guildId;
let previewDisabled;
let sourceIcon;
let sourceId;
let sourceName;
let streamType;
2026-07-20 16:05:17 +00:00
({ streamType, guildId, channelId, pid, sourceId } = arg0);
({ sourceName, sourceIcon, previewDisabled } = arg0);
2026-10-10 08:08:14 +00:00
const obj = sourceId(5900);
2026-10-03 08:58:59 +00:00
const obj2 = { streamType, guildId, channelId, ownerId: AuthenticationStore.getId() };
const encodeStreamKeyResult = obj.encodeStreamKey(obj2);
2026-07-29 08:29:29 +00:00
let startsWithResult;
2026-10-03 08:58:59 +00:00
const obj3 = AuthenticationStore;
2026-07-29 08:29:29 +00:00
if (sourceId != null) {
2026-07-20 16:05:17 +00:00
startsWithResult = sourceId.startsWith("prepicked:");
}
if (startsWithResult) {
startsWithResult = null == pid;
}
2026-07-29 08:29:29 +00:00
let startsWithResult1;
if (sourceId != null) {
startsWithResult1 = sourceId.startsWith("prepicked:");
}
if (startsWithResult1) {
if (null != closure_29) {
2026-10-03 08:58:59 +00:00
gameForPID = closure_29;
2026-07-29 08:29:29 +00:00
}
if (gameForPID == null) {
gameForPID = null;
}
id = undefined;
2026-10-03 08:58:59 +00:00
const tmp8 = closure_6;
2026-07-29 08:29:29 +00:00
if (gameForPID != null) {
id = gameForPID.id;
}
const obj4 = { id, pid, sourceName, previewDisabled, sourceIcon, sourceId };
2026-10-03 08:58:59 +00:00
tmp8[encodeStreamKeyResult] = obj4;
2026-07-29 08:29:29 +00:00
map.delete(encodeStreamKeyResult);
2026-10-03 08:58:59 +00:00
const obj5 = { streamType, guildId, channelId, ownerId: obj3.getId(), state: constants.CONNECTING };
set = map.set;
const result = set(encodeStreamKeyResult, obj5);
2026-07-20 16:05:17 +00:00
}
if (null != pid) {
gameForPID = RunningGameStore.getGameForPID(pid);
2026-07-20 16:05:17 +00:00
} else {
gameForPID = null;
if (null != sourceId) {
const runningGames = RunningGameStore.getRunningGames();
2026-10-03 08:58:59 +00:00
gameForPID = runningGames.find((windowHandle) => _slicedToArrayDefault(sourceId, windowHandle.windowHandle));
2026-07-20 16:05:17 +00:00
}
}
},
STREAM_STOP: function handleStreamStop(streamKey) {
2026-10-03 08:58:59 +00:00
streamerActiveStreamMetadatas[streamKey.streamKey] = null;
2026-07-20 16:05:17 +00:00
},
STREAM_CREATE: handleStreamUpdate,
STREAM_UPDATE: handleStreamUpdate,
STREAM_TIMED_OUT: function handleStreamTimedOut(streamKey) {
streamKey = streamKey.streamKey;
2026-10-03 08:58:59 +00:00
const value = map.get(streamKey);
2026-07-20 16:05:17 +00:00
if (null == value) {
return false;
} else {
2026-10-03 08:58:59 +00:00
const obj = { state: constants.FAILED };
set = map.set;
2026-07-20 16:05:17 +00:00
const merged = Object.assign(value);
2026-10-03 08:58:59 +00:00
const result = set(streamKey, obj);
2026-07-20 16:05:17 +00:00
}
},
STREAM_DELETE: function handleStreamDelete(unavailable) {
2026-10-03 08:58:59 +00:00
let reason;
let streamKey;
2026-07-20 16:05:17 +00:00
({ streamKey, reason } = unavailable);
2026-07-23 10:11:24 +00:00
let guildId;
2026-10-03 08:58:59 +00:00
unavailable = unavailable.unavailable;
delete rtcStreams[streamKey];
2026-07-21 06:55:02 +00:00
let flag = false;
if (reason === constants3.STREAM_FULL) {
2026-07-29 08:29:29 +00:00
flag = !map1.has(streamKey);
2026-07-21 06:55:02 +00:00
const _Date = Date;
2026-07-29 08:29:29 +00:00
const result = map1.set(streamKey, Date.now());
2026-07-21 06:55:02 +00:00
}
2026-10-03 08:58:59 +00:00
const value = map.get(streamKey);
2026-07-20 16:05:17 +00:00
if (null == value) {
2026-07-21 06:55:02 +00:00
return flag;
2026-07-20 16:05:17 +00:00
} else {
let FAILED = constants.ENDED;
2026-10-03 08:58:59 +00:00
if (unavailable) {
FAILED = tmp20.RECONNECTING;
} else if (reason === constants3.UNAUTHORIZED) {
FAILED = tmp20.FAILED;
} else if (reason === constants3.SAFETY_GUILD_RATE_LIMITED) {
const obj = StreamKeyUtils;
guildId = obj.decodeStreamKey(streamKey).guildId;
2026-10-10 08:08:14 +00:00
const promise = asyncRequire(5903, dependencyMap.paths);
2026-10-03 08:58:59 +00:00
promise.then((result) => {
result.default(guildId);
2026-07-20 16:05:17 +00:00
});
2026-10-03 08:58:59 +00:00
FAILED = tmp20.ENDED;
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
const tmp7 = value.state === constants.FAILED && reason === constants3.USER_REQUESTED;
if (tmp7) {
FAILED = tmp20.FAILED;
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
const obj2 = { state: FAILED };
set = map.set;
2026-07-20 16:05:17 +00:00
const merged = Object.assign(value);
2026-10-03 08:58:59 +00:00
const result1 = set(streamKey, obj2);
const tmp16 = FAILED === tmp20.ENDED && id !== streamKey;
if (tmp16) {
2026-07-29 08:29:29 +00:00
map.delete(streamKey);
2026-07-20 16:05:17 +00:00
}
}
},
STREAM_CLOSE: function handleStreamClose(streamKey) {
2026-07-29 08:29:29 +00:00
map.delete(streamKey.streamKey);
2026-07-20 16:05:17 +00:00
},
STREAM_UPDATE_SELF_HIDDEN: function handleUpdateSelfStreamHidden(arg0) {
2026-10-03 08:58:59 +00:00
let channelId;
let selfStreamHidden;
2026-07-20 16:05:17 +00:00
({ channelId, selfStreamHidden } = arg0);
2026-10-03 08:58:59 +00:00
const obj = StreamKeyUtils;
let isStreamKeyResult = obj.isStreamKey(id);
2026-07-20 16:05:17 +00:00
if (isStreamKeyResult) {
2026-07-29 08:29:29 +00:00
let hasItem;
2026-10-03 08:58:59 +00:00
const obj2 = id;
if (id != null) {
hasItem = obj2.includes(AuthenticationStore.getId());
2026-07-29 08:29:29 +00:00
}
isStreamKeyResult = hasItem;
2026-07-20 16:05:17 +00:00
}
if (isStreamKeyResult) {
isStreamKeyResult = false === selfStreamParticipantsHidden[channelId];
2026-07-20 16:05:17 +00:00
}
if (isStreamKeyResult) {
isStreamKeyResult = true === selfStreamHidden;
}
if (isStreamKeyResult) {
id = null;
2026-07-21 06:55:02 +00:00
}
selfStreamParticipantsHidden[channelId] = selfStreamHidden;
2026-07-21 06:55:02 +00:00
},
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelectForFullStreams(channelId) {
channelId = channelId.channelId;
2026-10-03 08:58:59 +00:00
let closure_1;
2026-07-21 06:55:02 +00:00
if (null == channelId) {
return false;
} else {
closure_1 = false;
const item = map1.forEach((item, index) => {
2026-10-03 08:58:59 +00:00
const obj = StreamKeyUtils;
if (obj.decodeStreamKey(index).channelId !== channelId) {
const tmp2 = map1.delete(index) || closure_1;
2026-10-03 08:58:59 +00:00
closure_1 = tmp2;
2026-07-21 06:55:02 +00:00
}
});
return closure_1;
2026-07-20 16:05:17 +00:00
}
},
SET_STREAM_APP_INTENT: function handleStreamSetAppIntent(intent) {
intent = intent.intent;
},
RTC_CONNECTION_STATE: function handleRTCConnectionState(arg0) {
2026-10-03 08:58:59 +00:00
let state;
let streamKey;
2026-07-20 16:05:17 +00:00
({ streamKey, state } = arg0);
if (null == streamKey) {
return false;
} else {
2026-10-03 08:58:59 +00:00
const value = map.get(streamKey);
2026-07-20 16:05:17 +00:00
if (null != value) {
if (value.state !== constants.ENDED) {
2026-10-03 08:58:59 +00:00
if (value.state === constants.FAILED) {
if (value.ownerId === AuthenticationStore.getId()) {
2026-07-20 16:05:17 +00:00
return false;
}
}
let ACTIVE = value.state;
if (constants2.DISCONNECTED === state) {
2026-07-29 08:29:29 +00:00
ACTIVE = tmp10.RECONNECTING;
} else if (tmp2.RTC_CONNECTED === state) {
ACTIVE = tmp10.ACTIVE;
2026-07-20 16:05:17 +00:00
}
if (ACTIVE === value.state) {
return false;
} else {
2026-10-03 08:58:59 +00:00
const obj = { state: ACTIVE };
set = map.set;
2026-07-20 16:05:17 +00:00
const merged = Object.assign(value);
2026-10-03 08:58:59 +00:00
const result = set(streamKey, obj);
2026-07-20 16:05:17 +00:00
}
}
}
return false;
}
},
CHANNEL_RTC_SELECT_PARTICIPANT: function handleStreamCloseAll(id) {
id = id.id;
2026-10-03 08:58:59 +00:00
const channelId = id.channelId;
const arr = Array.from(map.values());
const item = arr.forEach((state) => {
const obj = StreamKeyUtils;
let tmp3 = obj.encodeStreamKey(state) !== id;
const tmp = require;
const tmp2 = dependencyMap;
2026-07-29 08:29:29 +00:00
if (tmp3) {
tmp3 = state.state === constants.ENDED;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp3) {
2026-10-03 08:58:59 +00:00
const tmpResult = tmp(tmp2[13]);
set.delete(tmpResult.encodeStreamKey(state));
2026-07-20 16:05:17 +00:00
}
});
let isStreamKeyResult = null != id;
if (isStreamKeyResult) {
2026-10-03 08:58:59 +00:00
let tmp3 = require;
let obj = StreamKeyUtils;
isStreamKeyResult = obj.isStreamKey(id);
2026-07-20 16:05:17 +00:00
}
if (isStreamKeyResult) {
isStreamKeyResult = id.includes(AuthenticationStore.getId());
2026-07-20 16:05:17 +00:00
}
if (isStreamKeyResult) {
2026-10-03 08:58:59 +00:00
selfStreamParticipantsHidden[channelId] = false;
2026-07-20 16:05:17 +00:00
}
},
CONNECTION_OPEN: reset,
CONNECTION_CLOSED: reset,
LOGOUT: reset
2026-10-03 08:58:59 +00:00
};
const applicationStreamingStore = new ApplicationStreamingStore(DispatcherDefault, obj);
let result = size.fileFinishedImporting("stores/ApplicationStreamingStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default applicationStreamingStore;