decord/alpha/source/modules/channel/VoiceChannelAnimationStateStore.tsx

228 lines
6.4 KiB
TypeScript
Raw Permalink Normal View History

2026-10-13 12:43:34 +00:00
// Module ID: 14316
// Function ID: 14317
// Name: VoiceChannelAnimationStateStore
2026-10-10 08:08:14 +00:00
// Dependencies: [32, 4939, 5113, 504, 584, 2]
2026-07-23 10:11:24 +00:00
2026-10-13 12:43:34 +00:00
// Module 14316 (VoiceChannelAnimationStateStore)
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
import _slicedToArray from "_slicedToArray" /* 32 */;
2026-10-10 08:08:14 +00:00
import SelectedGuildStore from "SelectedGuildStore" /* 4939 */;
import VoiceStateStore from "VoiceStateStore" /* 5113 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
let closure_4;
function clearAllTimers() {
const keys = Object.keys(closure_5);
for (const item10009 of keys) {
let _clearTimeout = clearTimeout;
let clearTimeoutResult = clearTimeout(closure_5[item10009]);
continue;
}
closure_5 = {};
}
2026-07-20 16:05:17 +00:00
function resetAllState() {
2026-10-03 08:58:59 +00:00
clearAllTimers();
2026-08-24 06:08:38 +00:00
closure_4 = {};
2026-07-20 16:05:17 +00:00
}
function updateChannelAnimationState(arg0, arg1) {
2026-10-03 08:58:59 +00:00
let flag;
let obj;
2026-10-13 12:43:34 +00:00
const f118889 = () => {
2026-10-03 08:58:59 +00:00
if (null != closure_2_4[closure_0]) {
const obj = { style: constants.GENTLE_AMBIENT };
const merged = Object.assign(tmp2);
closure_2_4[closure_0] = obj;
voiceChannelAnimationStateStoreClass.emitChange();
}
delete closure_2_5[closure_0];
};
const tmp2 = closure_4[arg0];
2026-07-29 08:29:29 +00:00
let num;
2026-10-03 08:58:59 +00:00
if (tmp2 != null) {
num = tmp2.userCount;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
const bound = Math.max(0, num + arg1);
if (0 === num) {
if (bound > 0) {
const obj2 = { style: obj.GENTLE_AMBIENT_WITH_INTRO, userCount: bound };
2026-10-03 08:58:59 +00:00
closure_4[arg0] = obj2;
let closure_0 = arg0;
if (null != closure_5[arg0]) {
2026-07-29 08:29:29 +00:00
const _clearTimeout3 = clearTimeout;
2026-10-03 08:58:59 +00:00
clearTimeout(closure_5[arg0]);
delete closure_5[arg0];
2026-07-29 08:29:29 +00:00
}
const _setTimeout2 = setTimeout;
2026-10-13 12:43:34 +00:00
closure_5[arg0] = setTimeout(f118889, 2000);
2026-10-03 08:58:59 +00:00
flag = true;
2026-07-20 16:05:17 +00:00
}
return flag;
}
if (num > 0) {
if (bound > num) {
const obj3 = { style: obj.HIGH_CONTRAST, userCount: bound };
2026-10-03 08:58:59 +00:00
closure_4[arg0] = obj3;
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-10-03 08:58:59 +00:00
if (null != closure_5[arg0]) {
2026-07-29 08:29:29 +00:00
const _clearTimeout2 = clearTimeout;
2026-10-03 08:58:59 +00:00
clearTimeout(closure_5[arg0]);
delete closure_5[arg0];
2026-07-29 08:29:29 +00:00
}
const _setTimeout = setTimeout;
2026-10-13 12:43:34 +00:00
closure_5[arg0] = setTimeout(f118889, 2000);
2026-07-20 16:05:17 +00:00
flag = true;
}
}
if (0 === bound) {
2026-10-03 08:58:59 +00:00
if (null != closure_5[arg0]) {
2026-07-29 08:29:29 +00:00
const _clearTimeout = clearTimeout;
2026-10-03 08:58:59 +00:00
clearTimeout(closure_5[arg0]);
delete closure_5[arg0];
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
delete closure_4[arg0];
2026-07-20 16:05:17 +00:00
flag = true;
} else {
2026-10-03 08:58:59 +00:00
flag = null != tmp2 && bound !== num;
2026-07-20 16:05:17 +00:00
if (flag) {
2026-10-03 08:58:59 +00:00
obj = { userCount: bound };
let merged = Object.assign(tmp2);
closure_4[arg0] = obj;
2026-07-20 16:05:17 +00:00
flag = true;
}
}
}
function handleConnectionOpenOrLogout() {
2026-10-03 08:58:59 +00:00
clearAllTimers();
2026-08-24 06:08:38 +00:00
closure_4 = {};
2026-07-20 16:05:17 +00:00
return true;
}
const AnimationStyle = { GENTLE_AMBIENT: "GENTLE_AMBIENT", GENTLE_AMBIENT_WITH_INTRO: "GENTLE_AMBIENT_WITH_INTRO", HIGH_CONTRAST: "HIGH_CONTRAST" };
2026-10-03 08:58:59 +00:00
const React3 = {};
let closure_5 = {};
let guildId = null;
2026-10-03 08:58:59 +00:00
const Store = get_initializedDefault.Store;
2026-07-29 08:29:29 +00:00
class VoiceChannelAnimationStateStoreClass extends Store {
2026-10-03 08:58:59 +00:00
initialize() {
this.waitFor(VoiceStateStore, SelectedGuildStore);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
getAnimationStyle(arg0) {
let style;
if (closure_4[arg0] != null) {
style = tmp.style;
}
if (style == null) {
style = obj.GENTLE_AMBIENT;
}
return style;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getUserCount(arg0) {
let num;
if (closure_4[arg0] != null) {
num = tmp.userCount;
}
if (num == null) {
num = 0;
}
return num;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
}
const prototype = VoiceChannelAnimationStateStoreClass.prototype;
2026-07-29 08:29:29 +00:00
VoiceChannelAnimationStateStoreClass.displayName = "VoiceChannelAnimationStateStore";
2026-10-03 08:58:59 +00:00
let obj2 = {
VOICE_STATE_UPDATES: function handleVoiceStateUpdates(voiceStates) {
voiceStates = voiceStates.voiceStates;
guildId = SelectedGuildStore.getGuildId();
const obj = {};
2026-10-03 08:58:59 +00:00
const iter = voiceStates[Symbol.iterator]();
2026-07-29 08:29:29 +00:00
const nextResult = iter.next();
while (iter !== undefined) {
let tmp5 = nextResult;
if (nextResult.guildId === guildId) {
if (null != tmp5.oldChannelId) {
let num = obj[tmp5.oldChannelId];
2026-10-03 08:58:59 +00:00
let oldChannelId = tmp5.oldChannelId;
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
obj[oldChannelId] = num - 1;
2026-07-29 08:29:29 +00:00
}
if (null != tmp5.channelId) {
let num2 = obj[tmp5.channelId];
2026-10-03 08:58:59 +00:00
let channelId = tmp5.channelId;
2026-07-29 08:29:29 +00:00
if (num2 == null) {
num2 = 0;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
obj[channelId] = num2 + 1;
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
}
let flag = false;
2026-07-29 08:29:29 +00:00
const entries = Object.entries(obj);
2026-10-03 08:58:59 +00:00
const tmp11 = entries[Symbol.iterator]();
2026-07-29 08:29:29 +00:00
while (tmp11 !== undefined) {
let tmp14 = _slicedToArray(tmp12, 2);
2026-07-29 08:29:29 +00:00
if (updateChannelAnimationState(tmp14[0], tmp14[1])) {
flag = true;
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return flag;
2026-07-20 16:05:17 +00:00
},
CHANNEL_SELECT: function handleChannelSelect(guildId) {
2026-10-03 08:58:59 +00:00
let obj;
let tmp14;
let tmp15;
2026-07-20 16:05:17 +00:00
guildId = guildId.guildId;
2026-07-23 10:11:24 +00:00
if (guildId === guildId) {
2026-07-20 16:05:17 +00:00
return false;
} else if (null == guildId) {
return false;
} else {
resetAllState();
const obj2 = {};
2026-07-20 16:05:17 +00:00
const _Object2 = Object;
const values = Object.values(VoiceStateStore.getVoiceStates(guildId));
2026-07-29 08:29:29 +00:00
const iter = values[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let tmp4 = nextResult;
if (null != nextResult.channelId) {
let num = obj2[tmp4.channelId];
2026-10-03 08:58:59 +00:00
let channelId = tmp4.channelId;
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
obj2[channelId] = num + 1;
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
}
const _Object = Object;
const entries = Object.entries(obj2);
2026-07-29 08:29:29 +00:00
const tmp8 = entries[Symbol.iterator]();
while (tmp8 !== undefined) {
let tmp13 = _slicedToArray(tmp10, 2);
2026-07-29 08:29:29 +00:00
[tmp14, tmp15] = tmp13;
if (tmp15 > 0) {
2026-10-03 08:58:59 +00:00
obj = { style: obj.GENTLE_AMBIENT, userCount: tmp16 };
2026-07-29 08:29:29 +00:00
closure_4[tmp14] = obj;
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
}
return true;
}
},
CONNECTION_OPEN: handleConnectionOpenOrLogout,
LOGOUT: handleConnectionOpenOrLogout
2026-10-03 08:58:59 +00:00
};
const voiceChannelAnimationStateStoreClass = new VoiceChannelAnimationStateStoreClass(DispatcherDefault, obj2);
const result = size.fileFinishedImporting("modules/channel/VoiceChannelAnimationStateStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default voiceChannelAnimationStateStoreClass;
export { AnimationStyle };