Files
discord-decomp/sources/stores/InstantInviteStore.tsx
T
2026-07-27 16:20:00 +03:00

234 lines
13 KiB
TypeScript

/* Metro module 8880; source: stores/InstantInviteStore.tsx; dependencies: [6, 7, 15, 17, 18, 8150, 4118, 8881, 8883, 8884, 566, 694, 2] */
function _fun69296(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:6, offset: 0x01c707c0, size: 606 bytes, params: 8, frame: 21
const normalizeInviteCodeForInstallationId = function(a0) {
return a0.toLowerCase();
};
const closure = INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
const inviteRecord = importDefault(8150) /* metro dependency 8150: InviteRecord */;
const env0_8 = (require(4118) /* metro dependency 4118: Constants */).InviteTargetTypes;
let env0_10 = {};
let env0_11 = {};
let env0_12 = {};
let env0_13 = {};
const Map = global.Map;
let map = new Map();
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun69302(Store).displayName = 'InstantInviteStore';
map = new map(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() {
env0_10 = {};
env0_11 = {};
env0_12 = {};
env0_13 = {};
env0_9 = null;
env0_15 = false;
env0_16 = false;
env0_14 = false;
}, CHANNEL_DELETE: CHANNEL_DELETE_69310, FRIEND_INVITE_CREATE_SUCCESS: FRIEND_INVITE_CREATE_SUCCESS_69311,
FRIEND_INVITE_CREATE_FAILURE: function() {
env0_16 = false;
}, FRIEND_INVITE_REVOKE_SUCCESS: FRIEND_INVITE_REVOKE_SUCCESS_69313,
INSTANT_INVITE_CREATE_SUCCESS: INSTANT_INVITE_CREATE_SUCCESS_69315,
INSTANT_INVITE_CREATE_FAILURE: INSTANT_INVITE_CREATE_FAILURE,
INSTANT_INVITE_REVOKE_SUCCESS: INSTANT_INVITE_REVOKE_SUCCESS_69317, FRIEND_INVITE_REVOKE_REQUEST: function() {
env0_15 = true;
}, FRIEND_INVITE_CREATE_REQUEST: function() {
env0_16 = true;
}, FRIEND_INVITES_FETCH_REQUEST: function() {
env0_14 = true;
}, FRIEND_INVITES_FETCH_RESPONSE: FRIEND_INVITES_FETCH_RESPONSE, INSTANT_INVITE_CLEAR: INSTANT_INVITE_CLEAR,
INSTANT_INVITE_RECEIVED_INSTALLATION_ID_SET: INSTANT_INVITE_RECEIVED_INSTALLATION_ID_SET,
INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR: closure, INVITE_MODAL_CLOSE: INVITE_MODAL_CLOSE,
LOGOUT: LOGOUT_69326});
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/InstantInviteStore.tsx');
exports.default = map;
}
function _isNativeReflectConstruct_69297() { // fn#69297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:186, offset: 0x01c70a1e, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_69297_isNativeReflectConstruct = function() {
return !!result;
})();
}
function INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR({inviteCode}) { // fn#69301, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:502, offset: 0x01c70a80, size: 92 bytes, params: 2, frame: 14
var Map;
var value3;
var map;
const value2 = normalizeInviteCodeForInstallationId(inviteCode);
let binding = env0_17;
if (binding.has(value2)) {
Map = global.Map;
binding = env0_17;
value3 = Object.create(Map.prototype, {constructor: {value: Map}});
map = new Map(binding);
(map instanceof Object ? map : value3).delete(value2);
return undefined;
}
return false;
}
function _fun69302(a0) { // fn#69302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:660, offset: 0x01c70adc, size: 180 bytes, params: 2, frame: 16
const closure = InstantInviteStore;
env0_6(closure, a0);
return env0_3(closure, [{key: 'getInvite', value: value_69304}, {key: 'getFriendInvite', value: value_69305},
{key: 'getFriendInvitesFetching', value: value_69306}, {key: 'canRevokeFriendInvite', value: value_69307},
{key: 'getReceivedInstallationIdForInviteCode', value: value_69308}]);
}
function CHANNEL_DELETE_69310({channel}) { // fn#69310, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:1664, offset: 0x01c70c90, size: 54 bytes, params: 2, frame: 4
delete env0_10[channel.id];
delete env0_11[channel.id];
delete env0_12[channel.id];
}
function FRIEND_INVITE_CREATE_SUCCESS_69311(a0) { // fn#69311, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:1781, offset: 0x01c70cc6, size: 158 bytes, params: 2, frame: 17
env0_13[a0.invite.code] = InviteRecord.createFromServer(a0.invite);
const defaultImport = importDefault(8881) /* metro dependency 8881 */;
const defaultImport2 = importDefault(8883) /* metro dependency 8883 */;
const defaultImport3 = importDefault(8884) /* metro dependency 8884 */;
const Object = global.Object;
const value3 = defaultImport(defaultImport2(defaultImport3(Object.values(env0_13), 'createdAt')));
const value4 = null;
env0_9 = value4 != value3 ? value3 : value4;
}
function FRIEND_INVITE_REVOKE_SUCCESS_69313(a0) { // fn#69313, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:2065, offset: 0x01c70d64, size: 155 bytes, params: 2, frame: 18
const invites = a0.invites;
const value = null;
if (value != invites) {
a0.invites.forEach(_fun69314);
}
const defaultImport = importDefault(8881) /* metro dependency 8881 */;
const defaultImport2 = importDefault(8883) /* metro dependency 8883 */;
const defaultImport3 = importDefault(8884) /* metro dependency 8884 */;
const Object = global.Object;
const value4 = defaultImport(defaultImport2(defaultImport3(Object.values(env0_13), 'createdAt')));
env0_9 = value != value4 ? value4 : value;
}
function INSTANT_INVITE_CREATE_SUCCESS_69315({channelId, invite}) { // fn#69315, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:2303, offset: 0x01c70e29, size: 217 bytes, params: 2, frame: 14
const fromServer = InviteRecord.createFromServer(invite);
const targetType = fromServer.targetType;
const STREAM = InviteTargetTypes.STREAM;
if (targetType !== STREAM) {
if (fromServer.targetType !== InviteTargetTypes.EMBEDDED_APPLICATION) {
env0_10[channelId] = fromServer;
} else if (fromServer.targetApplication != null) {
if (env0_12[channelId] == null) {
env0_12[channelId] = {};
}
env0_12[channelId][fromServer.targetApplication.id] = fromServer;
} else {
env0_10[channelId] = fromServer;
}
} else if (fromServer.targetUser != null) {
if (env0_11[channelId] == null) {
env0_11[channelId] = {};
}
env0_11[channelId][global.String(fromServer.targetUser.id)] = fromServer;
} else if (fromServer.targetType !== InviteTargetTypes.EMBEDDED_APPLICATION) {
env0_10[channelId] = fromServer;
} else if (fromServer.targetApplication != null) {
if (env0_12[channelId] == null) {
env0_12[channelId] = {};
}
env0_12[channelId][fromServer.targetApplication.id] = fromServer;
} else {
env0_10[channelId] = fromServer;
}
}
function INSTANT_INVITE_CREATE_FAILURE({channelId}) { // fn#69316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:2655, offset: 0x01c70f02, size: 25 bytes, params: 2, frame: 3
env0_10[channelId] = null;
}
function FRIEND_INVITES_FETCH_RESPONSE({invites}) { // fn#69321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3084, offset: 0x01c70f1b, size: 149 bytes, params: 2, frame: 17
invites.forEach(_fun69322);
const defaultImport = importDefault(8881) /* metro dependency 8881 */;
const defaultImport2 = importDefault(8883) /* metro dependency 8883 */;
const defaultImport3 = importDefault(8884) /* metro dependency 8884 */;
const Object = global.Object;
env0_9 = defaultImport(defaultImport2(defaultImport3(Object.values({}), 'createdAt'))) ?? null;
}
function INSTANT_INVITE_CLEAR({channelId}) { // fn#69323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3299, offset: 0x01c70fd6, size: 23 bytes, params: 2, frame: 2
delete env0_10[channelId];
}
function INSTANT_INVITE_RECEIVED_INSTALLATION_ID_SET({inviteCode, receivedInstallationId}) { // fn#69324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3403, offset: 0x01c70fed, size: 78 bytes, params: 2, frame: 15
const Map = global.Map;
const map = new Map(env0_17);
map.set(normalizeInviteCodeForInstallationId(inviteCode), receivedInstallationId);
}
function INVITE_MODAL_CLOSE({inviteCode}) { // fn#69325, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3643, offset: 0x01c7103b, size: 41 bytes, params: 2, frame: 12
return inviteCode != null && INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR({inviteCode: inviteCode});
}
function LOGOUT_69326() { // fn#69326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3765, offset: 0x01c71064, size: 58 bytes, params: 1, frame: 10
if (env0_17.size === 0) {
return false;
}
const Map = global.Map;
const map = new Map();
}
function value_69304(a0) { // fn#69304, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:979, offset: 0x01c70b90, size: 137 bytes, params: 2, frame: 10
let value = a1;
const value2 = undefined;
const {targetType, targetUserId, targetApplicationId} = value !== value2 ? value : {};
value = environment.__proto__;
const STREAM = InviteTargetTypes.STREAM;
return targetType !== STREAM ? targetType !== InviteTargetTypes.EMBEDDED_APPLICATION ? env1_10[a0] : targetApplicationId != null ? env1_12[a0] == null ? value2 : env1_12[a0][targetApplicationId] : env1_10[a0] : targetUserId != null ? env1_11[a0] == null ? value2 : env1_11[a0][targetUserId] : targetType !== InviteTargetTypes.EMBEDDED_APPLICATION ? env1_10[a0] : targetApplicationId != null ? env1_12[a0] == null ? value2 : env1_12[a0][targetApplicationId] : env1_10[a0];
}
function value_69307() { // fn#69307, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:1326, offset: 0x01c70c19, size: 35 bytes, params: 1, frame: 3
const value = environment.__proto__;
return env1_9 != null && !env1_15 && !env1_16;
}
function value_69308(a0) { // fn#69308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:1414, offset: 0x01c70c3c, size: 33 bytes, params: 2, frame: 13
return env1_17.get(normalizeInviteCodeForInstallationId(a0));
}
function _fun69314(a0) { // fn#69314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:2151, offset: 0x01c70dff, size: 42 bytes, params: 2, frame: 4
if (env1_13[a0.code] != null) {
delete env1_13[a0.code];
}
}
function _fun69322(a0) { // fn#69322, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3158, offset: 0x01c70fb0, size: 38 bytes, params: 2, frame: 13
env1_13[a0.code] = InviteRecord.createFromServer(a0);
}