decord/source/stores/CallStore.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

194 lines
5.9 KiB
TypeScript

// Module ID: 5328
// Function ID: 5329
// Name: CallStore
// Dependencies: [1957, 2011, 4426, 1074, 573, 1272, 12, 504, 2]
// Module 5328 (CallStore)
import _modDef12 from "module_12" /* 12 */;
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import HTTPUtils from "HTTPUtils" /* 1272 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4426 */;
require = fn;
function callConnect() {
let channelId = arg1;
if (arg1 === undefined) {
channelId = SelectedChannelStore.getChannelId();
}
const channel = ChannelStore.getChannel(channelId);
let tmp3 = null == channel;
if (!tmp3) {
tmp3 = null != channel.getGuildId();
}
if (!tmp3) {
tmp3 = null == channelId;
}
if (!tmp3) {
let tmp5 = null != obj[channelId];
if (tmp5) {
tmp5 = !arg0;
}
tmp3 = tmp5;
}
let flag = !tmp3;
if (!tmp3) {
let tmp8 = obj[channelId];
if (tmp8 == null) {
obj = { channelId, ringing: [] };
tmp8 = obj;
}
obj[channelId] = tmp8;
const obj2 = { type: "CALL_CONNECT", channelId };
DispatcherDefault.dispatch(obj2);
flag = true;
}
return flag;
}
const Endpoints = fn(1074).Endpoints;
let calls = {};
const enqueuedRings = {};
const Store = initializeDefault.Store;
class CallStore extends Store {
}
const prototype = CallStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(ChannelStore, SelectedChannelStore, SelectedGuildStore);
};
prototype["getCall"] = function getCall(channelId) {
return obj[channelId];
};
prototype["getCalls"] = function getCalls() {
return Object.values(obj);
};
prototype["getMessageId"] = function getMessageId(channelId) {
const call = this.getCall(channelId);
let messageId = null;
if (null != call) {
messageId = call.messageId;
}
return messageId;
};
prototype["isCallActive"] = function isCallActive(channelId, id) {
let messageId = obj[channelId];
if (!(null != messageId && !messageId.unavailable)) {
return tmp;
} else if (null != id) {
messageId = messageId.messageId;
let tmp3 = messageId === id;
} else {
tmp3 = null != messageId.region;
}
};
prototype["isCallUnavailable"] = function isCallUnavailable(id) {
return null != obj[id] && obj[id].unavailable;
};
prototype["getInternalState"] = function getInternalState() {
calls = { calls, enqueuedRings };
return calls;
};
CallStore.displayName = "CallStore";
calls = {
CONNECTION_OPEN: function handleConnectionOpen() {
return callConnect(true);
},
CONNECTION_CLOSED: function handleConnectionClosed() {
closure_8 = {};
},
OVERLAY_INITIALIZE: function handleOverlayInitialize(callStoreInternalState) {
callStoreInternalState = callStoreInternalState.callStoreInternalState;
const obj = {};
const merged = Object.assign(callStoreInternalState.calls);
const merged1 = Object.assign(callStoreInternalState.enqueuedRings);
closure_8 = {};
},
CONNECTION_RESUMED: function handleConnectionResumed() {
return callConnect(true);
},
CHANNEL_SELECT: function handleChannelSelect(channelId) {
return callConnect(false, channelId.channelId);
},
CHANNEL_DELETE: function handleChannelDelete(channel) {
channel = channel.channel;
if (null != enqueuedRings[channel.id]) {
const id = channel.id;
delete tmp4[tmp3];
}
if (null == obj[channel.id]) {
return false;
} else {
const id2 = channel.id;
delete tmp2[tmp];
}
},
CALL_CREATE: function handleCallCreate(channelId) {
channelId = channelId.channelId;
const obj = { channelId, messageId: channelId.messageId, region: channelId.region, ringing: Object.keys(channelId.ongoingRings), unavailable: false, regionUpdated: false };
obj[channelId] = obj;
if (null != enqueuedRings[channelId]) {
delete tmp[tmp2];
let tmp3 = arr;
if (1 !== enqueuedRings[channelId].indexOf("all")) {
tmp3 = null;
}
const HTTP = HTTPUtils.HTTP;
const request = { url: Endpoints.CALL_RING(channelId), body: null, oldFormErrors: true, rejectWithError: true };
const obj2 = { recipients: tmp3 };
request.body = obj2;
HTTP.post(request);
}
},
CALL_UPDATE: function handleCallUpdate(arg0) {
({ channelId, region } = arg0);
let tmp2 = null != tmp;
({ messageId, ongoingRings } = arg0);
if (tmp2) {
tmp2 = tmp.regionUpdated || tmp.region !== region;
const tmp3 = tmp.regionUpdated || tmp.region !== region;
}
const obj = {};
const merged = Object.assign(obj[channelId]);
obj.messageId = messageId;
obj.region = region;
obj.ringing = Object.keys(ongoingRings);
obj.regionUpdated = tmp2;
obj[channelId] = obj;
},
CALL_DELETE: function handleCallDelete(arg0) {
({ channelId, unavailable } = arg0);
if (true === unavailable) {
if (null != tmp3) {
const obj = {};
const merged = Object.assign(tmp3);
obj.unavailable = unavailable;
}
tmp4[channelId] = { channelId, ringing: [], messageId: null, region: null, regionUpdated: false, unavailable };
if (null != enqueuedRings[channelId]) {
delete tmp[tmp2];
}
}
},
CALL_ENQUEUE_RING: function handleCallEnqueueRing(arg0) {
({ channelId, recipients } = arg0);
let items = enqueuedRings[channelId];
if (items == null) {
items = [];
}
if (recipients == null) {
recipients = ["all"];
}
enqueuedRings[channelId] = _modDef12.union(items, recipients);
},
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelect(channelId) {
if (null == channelId.channelId) {
closure_8 = {};
}
}
};
const callStore = new CallStore(DispatcherDefault, calls);
const size = fn(2);
const result = size.fileFinishedImporting("stores/CallStore.tsx");
export default callStore;