decord/source/stores/CallStore.tsx

200 lines
6.1 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 5103
// Function ID: 5104
2026-07-29 08:29:29 +00:00
// Name: callConnect
2026-08-25 06:04:03 +00:00
// Dependencies: [1391, 1981, 4202, 676, 709, 530, 12, 589, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 5103 (callConnect)
2026-08-24 06:08:38 +00:00
import applyDefault from "apply" /* 12 */;
import sendRequest from "sendRequest" /* 530 */;
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import closure_3 from "ensureGuildLoaded" /* 1391 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "handleConnectionOpen" /* 1981 */;
import closure_5 from "handleConnectionOpen" /* 4202 */;
2026-08-24 06:08:38 +00:00
import { Endpoints } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
function callConnect() {
let channelId = arg1;
if (arg1 === undefined) {
2026-07-20 16:05:17 +00:00
channelId = channelId.getChannelId();
}
2026-07-23 10:11:24 +00:00
channel = channel.getChannel(channelId);
2026-07-29 08:29:29 +00:00
let tmp3 = null == channel;
if (!tmp3) {
tmp3 = null != channel.getGuildId();
}
if (!tmp3) {
tmp3 = null == channelId;
}
if (!tmp3) {
let tmp5 = null != dependencyMap[channelId];
if (tmp5) {
tmp5 = !arg0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp3 = tmp5;
}
let flag = !tmp3;
if (!tmp3) {
let tmp8 = dependencyMap[channelId];
if (tmp8 == null) {
let obj = { channelId: null, ringing: null };
obj[0] = channelId;
obj[1] = [];
tmp8 = obj;
}
dependencyMap[channelId] = tmp8;
obj = { type: "CALL_CONNECT", channelId: null };
obj[1] = channelId;
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch(obj);
2026-07-29 08:29:29 +00:00
flag = true;
2026-08-24 06:08:38 +00:00
const obj3 = dispatcherDefault;
2026-07-29 08:29:29 +00:00
const tmp7 = dependencyMap;
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
}
2026-07-29 08:29:29 +00:00
let closure_7 = {};
let closure_8 = {};
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class CallStore extends Store {
}
const prototype = CallStore.prototype;
prototype["initialize"] = function initialize() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_3, closure_4, closure_5);
2026-07-29 08:29:29 +00:00
};
prototype["getCall"] = function getCall(channelId) {
return dependencyMap[channelId];
};
prototype["getCalls"] = function getCalls() {
return Object.values(closure_7);
};
prototype["getMessageId"] = function getMessageId(channelId) {
const call = this.getCall(channelId);
let messageId = null;
if (null != call) {
messageId = call.messageId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return messageId;
};
prototype["isCallActive"] = function isCallActive(closure_0, closure_1) {
let messageId = dependencyMap[closure_0];
if (!(null != messageId && !messageId.unavailable)) {
return tmp;
} else if (null != closure_1) {
messageId = messageId.messageId;
let tmp3 = messageId === closure_1;
} else {
tmp3 = null != messageId.region;
}
};
prototype["isCallUnavailable"] = function isCallUnavailable(id) {
return null != dependencyMap[id] && dependencyMap[id].unavailable;
};
prototype["getInternalState"] = function getInternalState() {
return { calls: closure_7, enqueuedRings: closure_8 };
};
CallStore.displayName = "CallStore";
2026-08-24 06:08:38 +00:00
const callStore = new CallStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen() {
return callConnect(true);
},
CONNECTION_CLOSED: function handleConnectionClosed() {
2026-08-24 06:08:38 +00:00
closure_7 = {};
closure_8 = {};
2026-07-20 16:05:17 +00:00
},
OVERLAY_INITIALIZE: function handleOverlayInitialize(callStoreInternalState) {
callStoreInternalState = callStoreInternalState.callStoreInternalState;
let obj = {};
const merged = Object.assign(callStoreInternalState.calls);
obj = {};
const merged1 = Object.assign(callStoreInternalState.enqueuedRings);
},
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;
2026-07-23 10:11:24 +00:00
if (null != dependencyMap2[channel.id]) {
2026-07-20 16:05:17 +00:00
const id = channel.id;
2026-07-23 10:11:24 +00:00
delete tmp4[tmp3];
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (null == dependencyMap[channel.id]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const id2 = channel.id;
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
}
},
CALL_CREATE: function handleCallCreate(channelId) {
channelId = channelId.channelId;
let obj = { channelId, messageId: channelId.messageId, region: channelId.region, ringing: Object.keys(channelId.ongoingRings), unavailable: false, regionUpdated: false };
2026-07-29 08:29:29 +00:00
closure_7[channelId] = obj;
2026-07-23 10:11:24 +00:00
if (null != dependencyMap2[channelId]) {
delete tmp[tmp2];
2026-07-29 08:29:29 +00:00
let tmp3 = arr;
if (1 !== dependencyMap2[channelId].indexOf("all")) {
2026-07-23 10:11:24 +00:00
tmp3 = null;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const HTTP = sendRequest.HTTP;
2026-07-29 08:29:29 +00:00
obj = { url: null, body: null, oldFormErrors: true, rejectWithError: true };
obj[0] = Endpoints.CALL_RING(channelId);
obj = { recipients: null };
obj[0] = tmp3;
obj[1] = obj;
2026-07-20 16:05:17 +00:00
HTTP.post(obj);
}
},
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 = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(dependencyMap[channelId]);
2026-07-29 08:29:29 +00:00
obj.messageId = messageId;
obj.region = region;
obj.ringing = Object.keys(ongoingRings);
obj.regionUpdated = tmp2;
2026-07-23 10:11:24 +00:00
dependencyMap[channelId] = obj;
2026-07-20 16:05:17 +00:00
},
CALL_DELETE: function handleCallDelete(arg0) {
({ channelId, unavailable } = arg0);
if (true === unavailable) {
2026-07-23 10:11:24 +00:00
if (null != tmp3) {
2026-07-29 08:29:29 +00:00
const obj = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(tmp3);
2026-07-29 08:29:29 +00:00
obj.unavailable = unavailable;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4[channelId] = { channelId, ringing: [], messageId: null, region: null, regionUpdated: false, unavailable };
2026-07-23 10:11:24 +00:00
if (null != dependencyMap2[channelId]) {
delete tmp[tmp2];
2026-07-20 16:05:17 +00:00
}
}
},
CALL_ENQUEUE_RING: function handleCallEnqueueRing(arg0) {
({ channelId, recipients } = arg0);
2026-07-23 10:11:24 +00:00
let items = dependencyMap2[channelId];
2026-07-29 08:29:29 +00:00
if (items == null) {
2026-07-20 16:05:17 +00:00
items = [];
}
2026-07-29 08:29:29 +00:00
if (recipients == null) {
2026-07-23 10:11:24 +00:00
recipients = ["all"];
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
dependencyMap2[channelId] = applyDefault.union(items, recipients);
2026-07-20 16:05:17 +00:00
},
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelect(channelId) {
if (null == channelId.channelId) {
2026-08-24 06:08:38 +00:00
closure_8 = {};
2026-07-20 16:05:17 +00:00
}
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("stores/CallStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default callStore;