decord/source/stores/ApplicationStreamPreviewStore.tsx
2026-08-12 06:57:52 +00:00

147 lines
4.6 KiB
TypeScript

// Module ID: 4525
// Function ID: 4526
// Name: reset
// Dependencies: [4408, 12, 4407, 589, 709, 2]
// Module 4525 (reset)
import { StreamTypes } from "StreamIssueReportReasons";
import { Store } from "initialize";
import set from "isStreamKey";
function reset() {
let closure_4 = {};
let closure_5 = {};
}
let closure_4 = {};
let closure_5 = {};
let set = new Set();
class ApplicationStreamPreviewStore extends Store {
}
const prototype = ApplicationStreamPreviewStore.prototype;
prototype["getPreviewURL"] = function getPreviewURL(closure_0, channelId, closure_2) {
let obj = require(4407) /* isStreamKey */;
if (null != closure_0) {
let CALL = StreamTypes.GUILD;
} else {
CALL = StreamTypes.CALL;
}
obj = { streamType: CALL, guildId: closure_0, channelId, ownerId: closure_2 };
const tmp3 = dependencyMap[obj.encodeStreamKey(obj, obj)];
let url;
if (tmp3 != null) {
url = tmp3.url;
}
return url;
};
prototype["shouldFetchPreview"] = function shouldFetchPreview(c0, closure_1, closure_2) {
let obj = require(4407) /* isStreamKey */;
if (null != c0) {
let CALL = StreamTypes.GUILD;
} else {
CALL = StreamTypes.CALL;
}
obj = { streamType: CALL, guildId: c0, channelId: closure_1, ownerId: closure_2 };
const encodeStreamKeyResult = obj.encodeStreamKey(obj);
let num = dependencyMap2[encodeStreamKeyResult];
if (num == null) {
num = 0;
}
let tmp5 = null != tmp4;
if (tmp5) {
const _Date = Date;
tmp5 = Date.now() > tmp4.expires;
}
let tmp7 = null == tmp4;
if (tmp7) {
tmp7 = num < 5;
}
if (!tmp7) {
tmp7 = tmp5;
}
if (tmp7) {
tmp7 = !set.has(encodeStreamKeyResult);
}
return tmp7;
};
prototype["getPreviewURLForStreamKey"] = function getPreviewURLForStreamKey(streamKey) {
const decodeStreamKeyResult = require(4407) /* isStreamKey */.decodeStreamKey(streamKey);
return this.getPreviewURL(decodeStreamKeyResult.guildId, decodeStreamKeyResult.channelId, decodeStreamKeyResult.ownerId);
};
prototype["getIsPreviewLoading"] = function getIsPreviewLoading(closure_0, closure_1, closure_2) {
let obj = require(4407) /* isStreamKey */;
if (null != closure_0) {
let CALL = StreamTypes.GUILD;
} else {
CALL = StreamTypes.CALL;
}
obj = { streamType: CALL, guildId: closure_0, channelId: closure_1, ownerId: closure_2 };
return set.has(obj.encodeStreamKey(obj));
};
ApplicationStreamPreviewStore.displayName = "ApplicationStreamPreviewStore";
const applicationStreamPreviewStore = new ApplicationStreamPreviewStore(require("dispatcher"), {
CONNECTION_OPEN: reset,
LOGOUT: reset,
STREAM_PREVIEW_FETCH_START: function handleStreamPreviewFetch(streamKey) {
streamKey = streamKey.streamKey;
let num = dependencyMap2[streamKey];
if (num == null) {
num = 0;
}
dependencyMap2[streamKey] = num + 1;
set.add(streamKey);
},
STREAM_PREVIEW_FETCH_SUCCESS: function handleStreamPreviewFetchSuccess(streamKey) {
streamKey = streamKey.streamKey;
closure_4[streamKey] = { url: streamKey.previewURL, expires: Date.now() + 120000 };
closure_5[streamKey] = 0;
set.delete(streamKey);
},
STREAM_PREVIEW_FETCH_FAIL: function handleStreamPreviewFetchFail(arg0) {
let retryAfter;
let streamKey;
({ streamKey, retryAfter } = arg0);
const timestamp = Date.now();
if (null == retryAfter) {
retryAfter = 10000 * dependencyMap2[streamKey];
}
closure_4[streamKey] = { url: null, expires: timestamp + retryAfter };
set.delete(streamKey);
},
VOICE_STATE_UPDATES: function handleVoiceStateUpdates(voiceStates) {
voiceStates = voiceStates.voiceStates;
const isEmptyResult = importDefault(12).isEmpty(closure_4);
let reduced = !isEmptyResult;
if (isEmptyResult) {
reduced = !importDefault(12).isEmpty(closure_5);
const tmpResult = importDefault(12);
}
if (reduced) {
reduced = voiceStates.reduce((arg0, guildId) => {
guildId = guildId.guildId;
if (guildId.selfStream) {
return arg0;
} else {
let obj = callback(table[2]);
if (null != guildId) {
let CALL = constants.GUILD;
} else {
CALL = constants.CALL;
}
obj = { streamType: null, guildId: null, channelId: null, ownerId: null };
obj[0] = CALL;
obj[1] = guildId;
obj[2] = tmp5;
obj[3] = tmp4;
obj.encodeStreamKey(obj);
delete tmp3[tmp2];
delete tmp[tmp2];
return true;
}
}, false);
}
return reduced;
}
});
const result = set.fileFinishedImporting("stores/ApplicationStreamPreviewStore.tsx");
export default applicationStreamPreviewStore;