/* Metro module 5189; source: modules/user_profile/UserProfileStore.tsx; dependencies: [6, 7, 15, 17, 18, 1949, 1885, 1226, 1867, 1228, 4396, 4896, 661, 5190, 22, 5191, 5210, 4041, 1904, 5211, 1244, 5212, 4915, 1360, 5213, 2] */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */ import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */ import MobileCacheSnapshotStore from '../../stores/MobileCacheSnapshotStore.tsx'; /* Metro dependency 1228 */ import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */ import UserRecord from '../../records/UserRecord.tsx'; /* Metro dependency 1885 */ import LocaleStore from '../user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */ import PresenceStore from '../../stores/PresenceStore.tsx'; /* Metro dependency 4396 */ import SortedGuildStore from '../../stores/SortedGuildStore.tsx'; /* Metro dependency 4896 */ import Platforms from '../../lib/Platforms.tsx'; /* Metro dependency 4915 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as CollectiblesItemTypeModule from '../../external/discord_common/js/shared/shared-constants/CollectiblesItemType.tsx'; /* Metro dependency 1904 */ import * as WidgetTypeModule from '../../external/discord_common/js/shared/shared-constants/WidgetType.tsx'; /* Metro dependency 5190 */ import * as UserProfileGameWidgetTypesModule from './UserProfileGameWidgetTypes.tsx'; /* Metro dependency 5191 */ import * as TieredTenureBadgeUtilsModule from './TieredTenureBadgeUtils.tsx'; /* Metro dependency 5211 */ import * as ApplicationWidgetConfigModule from '../application_widget/ApplicationWidgetConfig.tsx'; /* Metro dependency 5213 */ function _fun45704(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#45704, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:6, offset: 0x01195ca2, size: 890 bytes, params: 8, frame: 20 const env0_0 = require; const _arrayLikeToArray_45710 = function(a0, a1) { var r0; var r1; var r2; var value3; var length; var value5; var value = undefined; var value2 = value == null; reducibleJoin2: while (true) { if (value2) { r0 = value2; break reducibleJoin2; } value3 = value > a0.length; r0 = value3; break reducibleJoin2; } reducibleJoin4: while (true) { if (r0) { length = a0.length; r1 = length; break reducibleJoin4; } r1 = value; break reducibleJoin4; } value = (0, global.Array)(r1); var value4 = 0; if (value4 < r1) { r2 = value4; reducibleLoop5: while (true) { value[r2] = a0[r2]; value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; if (value5 < r1) { r2 = value5; continue reducibleLoop5; } break reducibleLoop5; } } return value; }; const handleProfileUpdateStart = function() { env0_28 = true; }; const handleProfileUpdateFailure = function() { env0_28 = false; }; const handleGuildMemberStatusChange = function(a0) { return resetProfileFetch(a0.user.id); }; const handleRelationshipStatusChange = function(a0) { return resetProfileFetch(a0.relationship.id); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = MobileCacheSnapshotStore; const Symbol = global.Symbol; const env0_15 = Symbol('NO GUILD ID'); let Map = global.Map; let map = new Map(); const Set = global.Set; const set = new Set(); Map = global.Map; map = new Map(); Map = global.Map; map = new Map(); const env0_20 = {}; Map = global.Map; map = new Map(); Map = global.Map; map = new Map(); Map = global.Map; map = new Map(); const env0_24 = []; const env0_25 = []; Map = global.Map; map = new Map(); value = _fun45750(value); value.displayName = 'UserProfileStore'; value.LATEST_SNAPSHOT_VERSION = 1; value = new value(); (FileImportTrackerModule).fileFinishedImporting('modules/user_profile/UserProfileStore.tsx'); exports.default = value; function _isNativeReflectConstruct_45705() { // fn#45705, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:249, offset: 0x0119601c, size: 94 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_45705_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_45708(a0, a1) { // fn#45708, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:442, offset: 0x0119607a, size: 370 bytes, params: 3, frame: 20 var r6; var r9; var r5; var value3; var regexp; const env0_0 = a0; const Symbol = global.Symbol; let value = typeof Symbol !== 'undefined'; let r1 = value && a0[global.Symbol.iterator]; r1 = !r1 ? a0['@@iterator'] : r1; if (r1) { value = r1.call(a0); return value.next.bind(value); } const Array = global.Array; if (Array.isArray(a0)) { if (r1) { } return _fun45709; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_45710(a0, value); r5 = value; } else { value3 = ({}).toString.call(a0).slice(8, -1); r6 = value3 === 'Object' && a0.constructor; r9 = r6 ? a0.constructor.name : value3; if (r9 === 'Map') { r6 = global.Array.from(a0); } else if (r9 === 'Set') { r6 = global.Array.from(a0); } else if (r9 === 'Arguments') { value = _arrayLikeToArray_45710(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_45710(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun45709; } const TypeError = global.TypeError; throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); function _fun45709() { // fn#45709, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:1013, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5 return env0_1 >= env0_0.length ? {done: true} : {done: false, value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]}; } } function createUserWidgetFromServer(a0) { // fn#45711, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:1482, offset: 0x011961ec, size: 405 bytes, params: 2, frame: 18 var ApplicationWidget; var object; var applicationWidget; var value3; const BaseGameWidget = (UserProfileGameWidgetTypesModule).BaseGameWidget; var baseGameWidget; const type = a0.data.type; var value; const WidgetType = (WidgetTypeModule).WidgetType; const CURRENT_GAMES = WidgetType.CURRENT_GAMES; if (CURRENT_GAMES === type) { value3 = (importDefault(22) /* metro dependency 22 */).uniqBy(a0.data.games.map(function(a0) { return {applicationId: a0.game_id, comment: a0.comment, tags: a0.tags}; }), 'applicationId'); object = {}; object.id = a0.id; object.type = type; object.games = value3; value = Object.create(BaseGameWidget.prototype, {constructor: {value: BaseGameWidget}}); baseGameWidget = new BaseGameWidget(); return baseGameWidget instanceof Object ? baseGameWidget : value; } const FAVORITE_GAMES = WidgetType.FAVORITE_GAMES; if (FAVORITE_GAMES === type) { value3 = (importDefault(22) /* metro dependency 22 */).uniqBy(a0.data.games.map(function(a0) { return {applicationId: a0.game_id, comment: a0.comment, tags: a0.tags}; }), 'applicationId'); object = {}; object.id = a0.id; object.type = type; object.games = value3; value = Object.create(BaseGameWidget.prototype, {constructor: {value: BaseGameWidget}}); baseGameWidget = new BaseGameWidget(); return baseGameWidget instanceof Object ? baseGameWidget : value; } const PLAYED_GAMES = WidgetType.PLAYED_GAMES; if (PLAYED_GAMES === type) { value3 = (importDefault(22) /* metro dependency 22 */).uniqBy(a0.data.games.map(function(a0) { return {applicationId: a0.game_id, comment: a0.comment, tags: a0.tags}; }), 'applicationId'); object = {}; object.id = a0.id; object.type = type; object.games = value3; value = Object.create(BaseGameWidget.prototype, {constructor: {value: BaseGameWidget}}); baseGameWidget = new BaseGameWidget(); return baseGameWidget instanceof Object ? baseGameWidget : value; } const WANT_TO_PLAY_GAMES = WidgetType.WANT_TO_PLAY_GAMES; if (WANT_TO_PLAY_GAMES === type) { value3 = (importDefault(22) /* metro dependency 22 */).uniqBy(a0.data.games.map(function(a0) { return {applicationId: a0.game_id, comment: a0.comment, tags: a0.tags}; }), 'applicationId'); object = {}; object.id = a0.id; object.type = type; object.games = value3; value = Object.create(BaseGameWidget.prototype, {constructor: {value: BaseGameWidget}}); baseGameWidget = new BaseGameWidget(); return baseGameWidget instanceof Object ? baseGameWidget : value; } const APPLICATION = WidgetType.APPLICATION; if (APPLICATION === type) { ApplicationWidget = (require(5210) /* metro dependency 5210: UserProfileApplicationWidgetTypes */).ApplicationWidget; object = {}; object.id = a0.id; object.applicationId = a0.data.application_id; value = Object.create(ApplicationWidget.prototype, {constructor: {value: ApplicationWidget}}); applicationWidget = new ApplicationWidget(); return applicationWidget instanceof Object ? applicationWidget : value; } } function checkUserProfileCollectiblesExpiration(a0, a1) { // fn#45713, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:2043, offset: 0x011963a8, size: 274 bytes, params: 3, frame: 18 var r0; var r5; var value; var items2; var value4; const env0_0 = a0; const env0_1 = a1; if (a1 != null) { value = env0_19.get(a0); if (value == null) { r0 = undefined; } else { value = value.get(a1); r0 = value; } r5 = r0; } else { r5 = env0_18.get(a0); } value = undefined; if ((r5 == null ? value : r5.collectibles) != null) { items2 = []; r5.collectibles.forEach(_fun45714); if (items2.length !== 0) { r5.collectibles = r5.collectibles.filter(_fun45716); items2.forEach(_fun45717); if ('guildId' in r5) { value4 = env0_19.get(a0); if (value4 != null) { value4.set(r5.guildId, r5); } } else { env0_18.set(a0, r5); } env0_30.emitChange(); } } return value; function _fun45714(a0) { // fn#45714, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:2234, offset: 0x011964ba, size: 428 bytes, params: 2, frame: 20 var environment; var r3; var value; var Date; var value2; var binding; var property; var skuId; var Timeout; var value4; var timeout; var start; if (a0.expiresAt != null) { value = a0.expiresAt.getTime(); Date = global.Date; value -= Date.now(); if (value <= 0) { ClassCallCheck.push(a0); } else { value2 = environment.__proto__; binding = env1_20; if (binding[env0_0] == null) { env1_20[env0_0] = {[env1_15]: {}}; } binding = env1_20; property = binding[env0_0]; r3 = require ?? env1_15; if (property[r3] == null) { env1_20[env0_0][require ?? env1_15] = {}; } binding = env1_20; property = binding[env0_0]; r3 = require ?? env1_15; property = property[r3]; skuId = a0.skuId; if (property[skuId] == null) { property = env1_20[env0_0]; property = property[require ?? env1_15]; skuId = a0.skuId; Timeout = (require(4041) /* metro dependency 4041: Timers */).Timeout; value4 = Object.create(Timeout.prototype, {constructor: {value: Timeout}}); timeout = new Timeout(); property[skuId] = timeout instanceof Object ? timeout : value4; } binding = env1_20; property = binding[env0_0]; r3 = require ?? env1_15; property = property[r3]; skuId = a0.skuId; property = property[skuId]; start = property.start; value = global.Math.min(MAX_TIMEOUT_MS, value); Reflect.apply(start, property, [value, _fun45715]); } } function _fun45715() { // fn#45715, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:2532, offset: 0x01196666, size: 28 bytes, params: 1, frame: 13 checkUserProfileCollectiblesExpiration(env1_0, require); } } function _fun45716(a0) { // fn#45716, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:2649, offset: 0x0107f58c, size: 25 bytes, params: 2, frame: 11 return !ClassCallCheck.includes(a0); } function _fun45717(a0) { // fn#45717, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:2680, offset: 0x01196682, size: 185 bytes, params: 2, frame: 17 var r2; var r3; const type = a0.type; let value = environment.__proto__; const CollectiblesItemType = (CollectiblesItemTypeModule).CollectiblesItemType; const PROFILE_EFFECT = CollectiblesItemType.PROFILE_EFFECT; if (type === PROFILE_EFFECT) { env0_2.profileEffect = undefined; } else if (a0.type === CollectiblesItemType.PROFILE_FRAME) { env0_2.profileFrame = undefined; } let property = env1_20[env0_0]; const value5 = property == null; if (value5) { r2 = property; r3 = value5; } else { property = property[require ?? env1_15]; value = property == null; r2 = property; r3 = value; } if (!r3) { delete r2[a0.skuId]; } } } function handleLogout_45718() { // fn#45718, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:2996, offset: 0x0119673b, size: 111 bytes, params: 1, frame: 10 env0_16.clear(); env0_17.clear(); env0_18.clear(); env0_19.clear(); env0_21.clear(); env0_22.clear(); env0_23.clear(); } function handleMutualFriendsFetchStart({userId}) { // fn#45719, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:3095, offset: 0x011967aa, size: 29 bytes, params: 2, frame: 11 env0_17.add(userId); } function handleMutualFriendsFetchFailure({userId}) { // fn#45720, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:3155, offset: 0x011967c7, size: 29 bytes, params: 2, frame: 11 env0_17.delete(userId); } function getMutualFriends(a0) { // fn#45721, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:3220, offset: 0x011967e4, size: 77 bytes, params: 2, frame: 12 let value = Module00022; value = value(a0); value = value.map(function(a0) { var object = {key: a0.id}; var userRecordBinding = UserRecord; var value2 = Object.create(userRecordBinding.prototype, {constructor: {value: userRecordBinding}}); var value3 = new userRecordBinding(a0); object.user = value3 instanceof Object ? value3 : value2; object.status = PresenceStore.getStatus(a0.id); return object; }); value = value.sortBy(function(a0) { var username = a0.user.username; return username.toLowerCase(); }); return value.value(); } function handleMutualFriendsFetchSuccess(a0) { // fn#45724, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:3385, offset: 0x01196895, size: 95 bytes, params: 2, frame: 17 let binding = env0_17; let userId = a0.userId; binding.delete(userId); binding = env0_21; let set = binding.set; userId = a0.userId; Reflect.apply(set, binding, [userId, getMutualFriends(a0.mutualFriends)]); binding = env0_22; set = binding.set; userId = a0.userId; Reflect.apply(set, binding, [userId, a0.mutualFriends.length]); } function handleProfileFetch({userProfile, fetchStartedAt, guildId}) { // fn#45725, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:3537, offset: 0x011968f4, size: 1720 bytes, params: 2, frame: 37 var r27; var guild_id; var r11; var r8; var set; var value7; var map; var getMutualFriendsBinding; var date; var value19; var defaultImport2; var value21; var env0_0; let r7 = guildId ?? userProfile.guild_member_profile?.guild_id; r7 = r7 ?? env0_15; let binding = env0_16; let get = binding.get; let user = userProfile.user; let id = user.id; const value5 = Reflect.apply(get, binding, [id]); if (value5 != null) { value5.delete(r7); } binding = env0_17; user = userProfile.user; binding.delete(user.id); if (userProfile.mutual_guilds != null) { env0_0 = {}; userProfile.mutual_guilds.forEach(_fun45726); binding = env0_23; set = binding.set; id = userProfile.user.id; value7 = SortedGuildStore.getFlattenedGuildIds().filter(_fun45727); Reflect.apply(set, binding, [id, value7.map(_fun45728)]); } let mutual_friends_count = userProfile.mutual_friends_count; if (mutual_friends_count != null) { mutual_friends_count = userProfile.mutual_friends_count; binding = env0_22; binding.set(userProfile.user.id, mutual_friends_count); if (mutual_friends_count === 0) { binding = env0_21; binding.set(userProfile.user.id, env0_24); } } let mutual_friends = userProfile.mutual_friends; if (mutual_friends != null) { binding = env0_21; set = binding.set; user = userProfile.user; id = user.id; getMutualFriendsBinding = getMutualFriends; mutual_friends = userProfile.mutual_friends; Reflect.apply(set, binding, [id, getMutualFriendsBinding(mutual_friends)]); binding = env0_22; set = binding.set; user = userProfile.user; id = user.id; mutual_friends = userProfile.mutual_friends; Reflect.apply(set, binding, [id, mutual_friends.length]); } if (userProfile.premium_since != null) { date = new global.Date(userProfile.premium_since); } else { r11 = null; } if (userProfile.premium_guild_since != null) { date = new global.Date(userProfile.premium_guild_since); } else { r8 = null; } const application = userProfile.application; const r22 = userProfile.badges != null ? userProfile.badges.map(_fun45729) : []; if (env0_29 != null && env0_29.userId === userProfile.user.id) { if (!(global.Date.now() > env0_29.expiresAtMs)) { mergePinnedBadges(r22, env0_29); } } const Date = global.Date; const value16 = Date.now(); binding = env0_18; set = binding.set; user = userProfile.user; id = user.id; let object = {}; const defaultImport = importDefault(dependencyMap[21]); let user_profile = userProfile.user_profile; copyDataProperties(object, defaultImport(user_profile), r27); user = userProfile.user; object['userId'] = user.id; user_profile = userProfile.user_profile; object['banner'] = user_profile?.banner; user_profile = userProfile.user_profile; object['accentColor'] = user_profile?.accent_color; user_profile = userProfile.user_profile; object['themeColors'] = user_profile?.theme_colors; user_profile = userProfile.user_profile; object['popoutAnimationParticleType'] = user_profile?.popout_animation_particle_type; user_profile = userProfile.user_profile; const bio = user_profile?.bio; const value17 = ''; object['bio'] = bio ?? value17; user_profile = userProfile.user_profile; let r23 = user_profile?.pronouns ?? value17; object['pronouns'] = r23; object['connectedAccounts'] = userProfile.connected_accounts.filter(_fun45730) ?? []; object['applicationRoleConnections'] = userProfile.application_role_connections ?? []; object['premiumSince'] = r11; object['premiumType'] = userProfile.premium_type; object['premiumGuildSince'] = r8; object['fetchStartedAt'] = fetchStartedAt; object['fetchEndedAt'] = value16; object['legacyUsername'] = userProfile.legacy_username; object['application'] = application != null ? {id: application.id, primarySkuId: application.primary_sku_id, customInstallUrl: application.custom_install_url, installParams: application.install_params, integrationTypesConfig: application.integration_types_config, flags: application.flags, popularApplicationCommandIds: application.popular_application_command_ids, storefront_available: application.storefront_available, name: application.name} : null; object['badges'] = r22; const widgets = userProfile.widgets; if (widgets == null) { r23 = undefined; } else { value19 = widgets.map(createUserWidgetFromServer); r23 = value19.filter(require(dependencyMap[23]).isNotNullish); r27 = dependencyMap; } object['widgets'] = r23; object['wishlistSettings'] = userProfile.wishlist_settings; object['private'] = userProfile.private; Reflect.apply(set, binding, [id, object]); let checkUserProfileCollectiblesExpirationBinding = checkUserProfileCollectiblesExpiration; user = userProfile.user; checkUserProfileCollectiblesExpirationBinding(user.id); let guild_member_profile = userProfile.guild_member_profile; if (guild_member_profile != null) { object = {}; defaultImport2 = importDefault(dependencyMap[21]); guild_member_profile = userProfile.guild_member_profile; copyDataProperties(object, defaultImport2(guild_member_profile), r27); user = userProfile.user; id = user.id; object['userId'] = id; guild_member_profile = userProfile.guild_member_profile; guild_id = guild_member_profile.guild_id; object['guildId'] = guild_id; guild_member_profile = userProfile.guild_member_profile; object['banner'] = guild_member_profile.banner; guild_member_profile = userProfile.guild_member_profile; object['accentColor'] = guild_member_profile.accent_color; guild_member_profile = userProfile.guild_member_profile; object['themeColors'] = guild_member_profile?.theme_colors; guild_member_profile = userProfile.guild_member_profile; object['popoutAnimationParticleType'] = guild_member_profile?.popout_animation_particle_type; guild_member_profile = userProfile.guild_member_profile; object['bio'] = guild_member_profile.bio; guild_member_profile = userProfile.guild_member_profile; object['pronouns'] = guild_member_profile.pronouns; object['badges'] = userProfile.guild_badges; object['fetchStartedAt'] = fetchStartedAt; object['fetchEndedAt'] = value16; binding = env0_19; get = binding.get; user = userProfile.user; id = user.id; value21 = Reflect.apply(get, binding, [id]); if (value21 != null) { value21.set(userProfile.guild_member_profile.guild_id, object); } else { map = new global.Map(); map.set(userProfile.guild_member_profile.guild_id, object); env0_19.set(userProfile.user.id, map); } checkUserProfileCollectiblesExpirationBinding = checkUserProfileCollectiblesExpiration; user = userProfile.user; id = user.id; guild_member_profile = userProfile.guild_member_profile; guild_id = guild_member_profile.guild_id; checkUserProfileCollectiblesExpirationBinding(id, guild_id); } function _fun45726({id, nick}) { // fn#45726, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:3838, offset: 0x01196fac, size: 64 bytes, params: 2, frame: 13 let value = environment.__proto__; value = GuildStore.getGuild(id); if (value != null) { env0_0[id] = {guild: value, nick: nick}; } } function _fun45727(a0) { // fn#45727, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:3961, offset: 0x01196fec, size: 22 bytes, params: 2, frame: 2 return env0_0[a0] != null; } function _fun45728(a0) { // fn#45728, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:3982, offset: 0x01197002, size: 46 bytes, params: 2, frame: 4 return {guild: env0_0[a0].guild, nick: env0_0[a0].nick}; } function _fun45729(a0) { // fn#45729, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:4423, offset: 0x01197030, size: 376 bytes, params: 2, frame: 23 var r2; var object; const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; let value = a0; const getTieredTenureBadgeData = TieredTenureBadgeUtilsModule.getTieredTenureBadgeData; let id = value.id; const value3 = Reflect.apply(getTieredTenureBadgeData, TieredTenureBadgeUtilsModule, [id]); id = value.id; if (id !== 'premium') { if (value3 == null) { id = value.id; if (id.startsWith('guild_booster_lvl')) { if (env0_2 == null) { r2 = value; } else { object = {}; copyDataProperties(object, value, undefined); value = intl.formatToPlainString(t.IWkAq7, {date: env0_2}); object['description'] = value; r2 = object; } } else { r2 = value; } return r2; } } if (env0_1 != null) { r2 = value3 == null ? intl.formatToPlainString(t['8zbGNR'], {date: env0_1}) : intl.formatToPlainString(t.Hu4jfi, {date: env0_1}); object = {}; copyDataProperties(object, value, undefined); object['description'] = r2; return object; } id = value.id; if (id.startsWith('guild_booster_lvl')) { if (env0_2 == null) { r2 = value; } else { object = {}; copyDataProperties(object, value, undefined); value = intl.formatToPlainString(t.IWkAq7, {date: env0_2}); object['description'] = value; r2 = object; } } else { r2 = value; } return r2; } function _fun45730({type}) { // fn#45730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:5446, offset: 0x011971a8, size: 46 bytes, params: 2, frame: 11 const value = environment.__proto__; return (Platforms).isSupported(type); } } function mergePinnedBadges(a0, a1) { // fn#45731, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:6966, offset: 0x011971d6, size: 142 bytes, params: 3, frame: 17 var r4; var Set; var value; var set; var push; var items2; if (a0 != null) { Set = global.Set; value = a0.map(function(a0) { return a0.id; }); set = new Set(); set = undefined; r4 = a1 == null ? set : a1.badges.filter(_fun45733); if (r4.length > 0) { push = a0.push; items2 = []; arraySpread(items2, r4, 0, Set); apply(push, items2, a0, Set); } return a0; } function _fun45733({id}) { // fn#45733, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:7076, offset: 0x011289b2, size: 30 bytes, params: 2, frame: 11 const binding = env0_0; return !binding.has(id); } } function handleProfileFetchStart({userId, guildId, withMutualFriends}) { // fn#45734, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:7129, offset: 0x01197264, size: 139 bytes, params: 2, frame: 17 var set; const r5 = guildId ?? env0_15; const value2 = env0_16.get(userId); if (value2 != null) { value2.add(r5); } else { set = new global.Set(); set.add(r5); env0_16.set(userId, set); } if (withMutualFriends) { env0_17.add(userId); } } function handleProfileFetchFailure({userId, guildId, apiError, fetchStartedAt}) { // fn#45735, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:7304, offset: 0x011972ef, size: 343 bytes, params: 2, frame: 19 var r3; let binding = env0_16; const value2 = binding.get(userId); if (value2 != null) { value2.delete(guildId ?? env0_15); } env0_17.delete(userId); const r8 = env0_18.get(userId) ?? ({'connectedAccounts': null, 'applicationRoleConnections': null, 'premiumSince': null, 'premiumGuildSince': null, 'application': null, 'legacyUsername': null, 'userId': null, 'banner': null, 'accentColor': null, 'bio': '', 'pronouns': '', 'premiumType': null, 'fetchStartedAt': 0, 'fetchEndedAt': 0, connectedAccounts: [], applicationRoleConnections: [], userId: userId, fetchError: undefined}); const Date = global.Date; const value4 = Date.now(); r8.fetchStartedAt = fetchStartedAt; r8.fetchEndedAt = value4; r8.fetchError = apiError; env0_18.set(userId, r8); if (guildId != null) { r3 = env0_19.get(userId)?.get(guildId); if (r3 != null) { r3.fetchStartedAt = fetchStartedAt; r3.fetchEndedAt = value4; r3.fetchError = apiError; } } if (apiError?.status === 404) { binding = env0_22; binding.set(userId, 0); binding = env0_21; binding.set(userId, env0_24); binding = env0_23; binding.set(userId, env0_25); } } function handleProfileUpdateSuccess(a0) { // fn#45737, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:8034, offset: 0x01197453, size: 459 bytes, params: 2, frame: 26 var userId; var accent_color; var banner; var bio; var pronouns; var popout_animation_particle_type; var theme_colors; var collectibles; var binding; var value2; var set; var object; var value3; var value4; let guild_id = a0.guild_id; if (guild_id != null) { userId = a0.userId; guild_id = a0.guild_id; accent_color = a0.accent_color; banner = a0.banner; bio = a0.bio; pronouns = a0.pronouns; popout_animation_particle_type = a0.popout_animation_particle_type; theme_colors = a0.theme_colors; collectibles = a0.collectibles; value3 = env0_19.get(userId); if (guild_id != null) { if (value3 != null) { value4 = value3.get(guild_id); if (value4 != null) { set = value3.set; object = {}; copyDataProperties(object, value4, undefined); copyDataProperties(object, (importDefault(5212) /* metro dependency 5212: parseUserProfileCollectibles */)({collectibles: collectibles}), undefined); object['accentColor'] = accent_color; object['banner'] = banner; object['bio'] = bio; object['pronouns'] = pronouns; object['popoutAnimationParticleType'] = popout_animation_particle_type; object['themeColors'] = theme_colors; Reflect.apply(set, value3, [guild_id, object]); checkUserProfileCollectiblesExpiration(userId, guild_id); } } } } else { userId = a0.userId; accent_color = a0.accent_color; banner = a0.banner; bio = a0.bio; pronouns = a0.pronouns; popout_animation_particle_type = a0.popout_animation_particle_type; theme_colors = a0.theme_colors; collectibles = a0.collectibles; binding = env0_18; value2 = binding.get(userId); if (value2 != null) { binding = env0_18; set = binding.set; object = {}; copyDataProperties(object, value2, collectibles); copyDataProperties(object, (importDefault(5212) /* metro dependency 5212: parseUserProfileCollectibles */)({collectibles: collectibles}), collectibles); object['accentColor'] = accent_color; object['banner'] = banner; object['bio'] = bio; object['pronouns'] = pronouns; object['popoutAnimationParticleType'] = popout_animation_particle_type; object['themeColors'] = theme_colors; Reflect.apply(set, binding, [userId, object]); checkUserProfileCollectiblesExpiration(userId); } } } function handleWidgetsUpdateSuccess({userId, widgets}) { // fn#45739, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:8916, offset: 0x0119762b, size: 131 bytes, params: 2, frame: 18 let binding = env0_18; const value2 = binding.get(userId); if (value2 == null) { return false; } binding = env0_18; const set = binding.set; const object = {}; copyDataProperties(object, value2, undefined); const value3 = widgets.map(createUserWidgetFromServer); object['widgets'] = value3.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish); Reflect.apply(set, binding, [userId, object]); } function handlePinBadgesToProfile({badges, ttlInSeconds, userId}) { // fn#45740, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:9098, offset: 0x011976ae, size: 164 bytes, params: 2, frame: 16 var object3; var r5; var mergePinnedBadgesBinding; var set; let object = {userId: userId, badges: badges}; const Date = global.Date; object.expiresAtMs = Date.now() + 1000 * ttlInSeconds; object3 = object; let binding = env0_18; const value2 = binding.get(userId); if (value2 != null) { r5 = value2.badges ?? []; mergePinnedBadgesBinding = mergePinnedBadges; mergePinnedBadgesBinding(r5, object3); binding = env0_18; set = binding.set; object = {}; copyDataProperties(object, value2, mergePinnedBadgesBinding); object['badges'] = r5; Reflect.apply(set, binding, [userId, object]); } } function handleUserUpdate_45741({user}) { // fn#45741, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:9327, offset: 0x01197752, size: 83 bytes, params: 2, frame: 15 const id = user.id; let r0 = env0_16.get(id)?.size ?? 0; r0 = !(r0 > 0) && resetProfileFetch(id); return r0; } function handleGuildStatusChange() { // fn#45742, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:9458, offset: 0x011977a5, size: 52 bytes, params: 1, frame: 14 const value = env0_18.keys(); const items2 = []; arraySpread(items2, value, 0, items2); return items2.reduce(function(a0, a1) { return resetProfileFetch(a1) || a0; }, false); } function handleLocaleStoreChange() { // fn#45746, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:9722, offset: 0x01197830, size: 63 bytes, params: 1, frame: 10 env0_16.clear(); env0_17.clear(); env0_18.clear(); env0_19.clear(); } function resetProfileFetch(a0) { // fn#45747, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:9797, offset: 0x0119786f, size: 151 bytes, params: 2, frame: 15 var r2; var _createForOfIteratorHelperLoose_45708Binding; var values; var value4; var done; var value5; var value6; if (a0 == null) { return false; } let value = environment; const value2 = env0_18.get(a0); if (value2 == null) { return false; } value2.fetchStartedAt = 0; value2.fetchEndedAt = 0; value2.fetchError = undefined; const value3 = env0_19.get(a0); reducibleJoin5: while (true) { if (value3 == null) { break reducibleJoin5; } _createForOfIteratorHelperLoose_45708Binding = _createForOfIteratorHelperLoose_45708; values = value3.values; value = _createForOfIteratorHelperLoose_45708Binding(Reflect.apply(values, value3, [])); value4 = value(); done = value4.done; if (done) { break reducibleJoin5; } r2 = value4; reducibleLoop4: while (true) { value5 = r2.value; value5.fetchStartedAt = 0; value5.fetchEndedAt = 0; value5.fetchError = undefined; value6 = value(); done = value6.done; if (done) { break reducibleJoin5; } r2 = value6; continue reducibleLoop4; } } } function handleAppWidgetConfigsFetchSuccess({applicationConfigs}) { // fn#45748, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:10107, offset: 0x01197906, size: 116 bytes, params: 2, frame: 17 var r2; var value4; var set; var applicationId; var value5; env0_26 = applicationConfigs.map(_fun45749); let binding = env0_27; binding.clear(); value = _createForOfIteratorHelperLoose_45708(env0_26); const value3 = value(); let done = value3.done; if (!done) { for (r2 = value3; true; r2 = value5) { value4 = r2.value; binding = env0_27; set = binding.set; applicationId = value4.applicationId; Reflect.apply(set, binding, [applicationId, value4]); value5 = value(); done = value5.done; if (done) { break; } } } function _fun45749(a0) { // fn#45749, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:10182, offset: 0x0119797a, size: 56 bytes, params: 2, frame: 11 let value = environment.__proto__; const ApplicationWidgetConfig = (ApplicationWidgetConfigModule).ApplicationWidgetConfig; value = Object.create(ApplicationWidgetConfig.prototype, {constructor: {value: ApplicationWidgetConfig}}); const applicationWidgetConfig = new ApplicationWidgetConfig(a0); return applicationWidgetConfig instanceof Object ? applicationWidgetConfig : value; } } function _fun45750(a0) { // fn#45750, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:10348, offset: 0x011979b2, size: 419 bytes, params: 2, frame: 16 const UserProfileStore2 = UserProfileStore; Inherits(UserProfileStore2, a0); return CreateClass(UserProfileStore2, [{key: 'initialize', value: function() { this.waitFor(SortedGuildStore); this.syncWith([LocaleStore], handleLocaleStoreChange); }}, {key: 'isFetchingProfile', value: value_45756}, {key: 'isFetchingFriends', value: value_45757}, {key: 'isSubmitting', get: get_45758}, {key: 'getUserProfile', value: value_45759}, {key: 'getGuildMemberProfile', value: value_45760}, {key: 'getMutualFriends', value: value_45761}, {key: 'getMutualFriendsCount', value: value_45762}, {key: 'getMutualGuilds', value: value_45763}, {key: 'getWidgets', value: value_45764}, {key: 'getWishlistIds', value: value_45765}, {key: 'getFirstWishlistId', value: function(a0) { var value = null; if (value == a0) { return value; } var value2 = this.getWishlistIds(a0); return value2.length > 0 ? value2[0] : value; }}, {key: 'getWishlistSettings', value: value_45767}, {key: 'takeSnapshot', value: value_45768}, {key: 'applicationWidgetConfigs', get: get_45769}, {key: 'getApplicationWidgetConfig', value: value_45770}]); function UserProfileStore() { // fn#45751, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:10360, offset: 0x01197b55, size: 342 bytes, params: 1, frame: 20 var environment; let value = environment.__proto__; env1_3(this, UserProfileStore); const handleUserUpdate_45741Binding = handleUserUpdate_45741; const handleGuildStatusChangeBinding = handleGuildStatusChange; const handleGuildMemberStatusChangeBinding = handleGuildMemberStatusChange; const handleRelationshipStatusChangeBinding = handleRelationshipStatusChange; const items2 = [{CACHE_LOADED_LAZY: CACHE_LOADED_LAZY_45752, USER_PROFILE_FETCH_START: handleProfileFetchStart, USER_PROFILE_FETCH_FAILURE: handleProfileFetchFailure, USER_PROFILE_FETCH_SUCCESS: handleProfileFetch, USER_PROFILE_UPDATE_START: handleProfileUpdateStart, USER_PROFILE_UPDATE_SUCCESS: handleProfileUpdateSuccess, USER_PROFILE_UPDATE_FAILURE: handleProfileUpdateFailure, WIDGET_PENDING_SAVE_SUCCESS: handleWidgetsUpdateSuccess, USER_PROFILE_PIN_BADGES_ON_CLIENT: handlePinBadgesToProfile, MUTUAL_FRIENDS_FETCH_START: handleMutualFriendsFetchStart, MUTUAL_FRIENDS_FETCH_SUCCESS: handleMutualFriendsFetchSuccess, MUTUAL_FRIENDS_FETCH_FAILURE: handleMutualFriendsFetchFailure, USER_UPDATE: handleUserUpdate_45741Binding, GUILD_MEMBER_UPDATE: handleUserUpdate_45741Binding, GUILD_JOIN: handleGuildStatusChangeBinding, GUILD_DELETE: handleGuildStatusChangeBinding, INVITE_ACCEPT_SUCCESS: handleGuildStatusChangeBinding, GUILD_MEMBER_ADD: handleGuildMemberStatusChangeBinding, GUILD_MEMBER_REMOVE: handleGuildMemberStatusChangeBinding, RELATIONSHIP_ADD: handleRelationshipStatusChangeBinding, RELATIONSHIP_REMOVE: handleRelationshipStatusChangeBinding, RELATIONSHIP_UPDATE: handleRelationshipStatusChangeBinding, USER_PROFILE_APPLICATION_WIDGET_CONFIGS_FETCH_SUCCESS: handleAppWidgetConfigsFetchSuccess, LOGOUT: handleLogout_45718}]; const value3 = env1_6(UserProfileStore); value = env1_5(this, _isNativeReflectConstruct_45705() ? global.Reflect.construct(value3, items2, env1_6(this).constructor) : value3.apply(this, items2)); value.loadCache = loadCache_45753; return value; function UserProfileStoreCACHE_LOADED_LAZY() { // fn#45752, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:10603, owner: UserProfileStore.CACHE_LOADED_LAZY, offset: 0x010e7f68, size: 19 bytes, params: 1, frame: 9 return env0_0.loadCache(); } function UserProfileStoreLoadCache() { // fn#45753, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:11777, owner: UserProfileStore.loadCache, offset: 0x01197cab, size: 58 bytes, params: 1, frame: 11 var environment; const binding = env0_0; const readSnapshot = binding.readSnapshot; let value = environment.__proto__; const LATEST_SNAPSHOT_VERSION = UserProfileStore.LATEST_SNAPSHOT_VERSION; value = Reflect.apply(readSnapshot, binding, [LATEST_SNAPSHOT_VERSION]); if (value != null) { value.forEach(_fun45754); } function _fun45754({userId, profile}) { // fn#45754, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:11865, offset: 0x01197ce5, size: 65 bytes, params: 2, frame: 13 var value; if (userId != null) { if (profile != null) { value = environment.__proto__.__proto__.__proto__; env3_18.set(userId, profile); } else { value = environment.__proto__.__proto__.__proto__; env3_18.delete(userId); } } } } } function value_45756(a0, a1) { // fn#45756, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:12114, offset: 0x01197d5b, size: 52 bytes, params: 3, frame: 14 const value = a1; const value3 = env1_16.get(a0); return value3 != null && value3.has(value ?? env1_15); } function value_45757(a0) { // fn#45757, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:12211, offset: 0x00fc0a0f, size: 22 bytes, params: 2, frame: 11 return env1_17.has(a0); } function get_45758() { // fn#45758, offset: 0x0108042c, size: 9 bytes, params: 1, frame: 1 return env1_28; } function value_45759(a0) { // fn#45759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:12315, offset: 0x00f7ed3c, size: 22 bytes, params: 2, frame: 11 return env1_18.get(a0); } function value_45760(a0, a1) { // fn#45760, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:12380, offset: 0x01197d8f, size: 70 bytes, params: 3, frame: 14 var r2; var r0; var value2; var value3; const value = null; if (value == a1) { r0 = value; } else { value2 = environment.__proto__; value3 = env1_19.get(a0); r2 = value == value3 ? undefined : value3.get(a1); r0 = value != r2 ? r2 : value; } return r0; } function value_45761(a0) { // fn#45761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:12506, offset: 0x01197dd5, size: 22 bytes, params: 2, frame: 11 return env1_21.get(a0); } function value_45762(a0) { // fn#45762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:12571, offset: 0x01197deb, size: 22 bytes, params: 2, frame: 11 return env1_22.get(a0); } function value_45763(a0) { // fn#45763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:12630, offset: 0x01197e01, size: 22 bytes, params: 2, frame: 11 return env1_23.get(a0); } function value_45764(a0) { // fn#45764, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:12684, offset: 0x01197e17, size: 39 bytes, params: 2, frame: 11 const value = environment.__proto__; return env1_18.get(a0)?.widgets; } function value_45765(a0) { // fn#45765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:12775, offset: 0x01197e3e, size: 73 bytes, params: 2, frame: 12 let value = environment.__proto__; value = env1_18.get(a0); return value?.wishlistSettings != null ? global.Object.keys(value.wishlistSettings) : []; } function value_45767(a0, a1) { // fn#45767, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:13047, offset: 0x01197eb8, size: 67 bytes, params: 3, frame: 13 let value = environment.__proto__; value = env1_18.get(a0); const value2 = null; const r1 = value2 == value || value2 == value.wishlistSettings ? undefined : value.wishlistSettings[a1]; return value2 != r1 ? r1 : value2; } function value_45768() { // fn#45768, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:13182, offset: 0x01197efb, size: 115 bytes, params: 1, frame: 13 let value = environment.__proto__; const id = AuthenticationStore.getId(); value = env1_18.get(id); return value != null ? {version: UserProfileStore.LATEST_SNAPSHOT_VERSION, data: [{userId: id, profile: value}]} : {version: UserProfileStore.LATEST_SNAPSHOT_VERSION, data: []}; } function get_45769() { // fn#45769, offset: 0x00df3adf, size: 9 bytes, params: 1, frame: 1 return env1_26; } function value_45770(a0) { // fn#45770, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5367:13473, offset: 0x01197f6e, size: 22 bytes, params: 2, frame: 11 return env1_27.get(a0); } } } global.__d(_fun45704, 5189, [6, 7, 15, 17, 18, 1949, 1885, 1226, 1867, 1228, 4396, 4896, 661, 5190, 22, 5191, 5210, 4041, 1904, 5211, 1244, 5212, 4915, 1360, 5213, 2]) /* metro module 5189, dependencies: [6, 7, 15, 17, 18, 1949, 1885, 1226, 1867, 1228, 4396, 4896, 661, 5190, 22, 5191, 5210, 4041, 1904, 5211, 1244, 5212, 4915, 1360, 5213, 2] */;