426 lines
16 KiB
TypeScript
426 lines
16 KiB
TypeScript
/* Metro module 6718; source: modules/guild_profile/GuildProfileBuilders.tsx; dependencies: [6540, 3797, 6719, 1360, 6720, 2] */
|
|
function _fun52753(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#52753, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6896:6, offset: 0x0133654f, size: 209 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_52756 = 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 closure = buildGuildProfileFromServer;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = (require(6540) /* metro dependency 6540: EmojiStore */).EmojiDisambiguations;
|
|
object = {label: ''};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_profile/GuildProfileBuilders.tsx');
|
|
exports.buildGuildProfileFromServer = closure;
|
|
exports.buildGuildProfileUpdateForServer = buildGuildProfileUpdateForServer;
|
|
exports.buildTopGamesFromServer = function(a0) {
|
|
return a0.reduce(_fun52764, {});
|
|
};
|
|
exports.buildGuildProfileFromInvite = buildGuildProfileFromInvite;
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_52754(a0, a1) { // fn#52754, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6896:132, offset: 0x01336620, 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 _fun52755;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_52756(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_52756(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_52756(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun52755;
|
|
}
|
|
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 getEmoji_52757({guildId, emojiId, emojiName}) { // fn#52757, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6896:1042, offset: 0x01336792, size: 128 bytes, params: 2, frame: 17
|
|
var r1;
|
|
var r0;
|
|
var value;
|
|
const value2 = EmojiDisambiguations.get(guildId);
|
|
if (emojiId != null) {
|
|
if (emojiId != null) {
|
|
r1 = value2 != null ? value2.getById(emojiId) : null;
|
|
} else if (emojiName != null) {
|
|
value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
|
|
value = value.getByName(emojiName);
|
|
r1 = value;
|
|
} else {
|
|
r1 = null;
|
|
}
|
|
r0 = r1;
|
|
} else if (emojiName == null) {
|
|
r0 = null;
|
|
} else {
|
|
if (emojiId != null) {
|
|
r1 = value2 != null ? value2.getById(emojiId) : null;
|
|
} else if (emojiName != null) {
|
|
value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
|
|
value = value.getByName(emojiName);
|
|
r1 = value;
|
|
} else {
|
|
r1 = null;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function buildGuildProfileTraitsFromServer(a0, a1) { // fn#52758, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6896:1224, offset: 0x01336812, size: 262 bytes, params: 3, frame: 24
|
|
var r3;
|
|
var r1;
|
|
var r13;
|
|
var value8;
|
|
var position;
|
|
var value9;
|
|
var value10;
|
|
var object2;
|
|
var label;
|
|
var getEmoji_52757Binding;
|
|
var emoji_id;
|
|
var emoji_name;
|
|
var emoji_52757Binding;
|
|
var value12;
|
|
const Array = global.Array;
|
|
const value2 = undefined;
|
|
const MAX_TRAITS = (require(6719) /* metro dependency 6719: GuildProfileLimits */).MAX_TRAITS;
|
|
const value3 = Object.create(Array.prototype, {constructor: {value: Array}});
|
|
const array = new Array(MAX_TRAITS);
|
|
const value5 = (array instanceof Object ? array : value3).fill(env0_4);
|
|
const value6 = _createForOfIteratorHelperLoose_52754(a1);
|
|
const value7 = value6();
|
|
let done = value7.done;
|
|
if (!done) {
|
|
r3 = value7;
|
|
while (true) {
|
|
value8 = r3.value;
|
|
position = value8.position;
|
|
value9 = position < 0;
|
|
if (value9) {
|
|
r1 = value9;
|
|
} else {
|
|
value10 = value8.position >= MAX_TRAITS;
|
|
r1 = value10;
|
|
}
|
|
if (r1) {
|
|
continue;
|
|
}
|
|
position = value8.position;
|
|
object2 = {};
|
|
label = value8.label;
|
|
object2.label = label;
|
|
getEmoji_52757Binding = getEmoji_52757;
|
|
emoji_id = value8.emoji_id;
|
|
emoji_name = value8.emoji_name;
|
|
emoji_52757Binding = getEmoji_52757Binding({guildId: a0, emojiId: emoji_id, emojiName: emoji_name});
|
|
if (emoji_52757Binding != null) {
|
|
r13 = emoji_52757Binding;
|
|
continue;
|
|
}
|
|
r13 = value2;
|
|
continue;
|
|
object2.emoji = r13;
|
|
value5[position] = object2;
|
|
value12 = value6();
|
|
done = value12.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r3 = value12;
|
|
continue;
|
|
}
|
|
}
|
|
return value5;
|
|
}
|
|
|
|
function buildGuildProfileFromServer(a0) { // fn#52759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6896:1569, offset: 0x01336918, size: 362 bytes, params: 2, frame: 16
|
|
const object2 = {};
|
|
let id = a0.id;
|
|
object2.id = id;
|
|
object2.name = a0.name;
|
|
const description = a0.description;
|
|
let value = null;
|
|
let value2 = '';
|
|
object2.description = value != description ? description : value2;
|
|
object2.icon = a0.icon_hash;
|
|
object2.customBanner = a0.custom_banner_hash;
|
|
object2.onlineCount = a0.online_count;
|
|
object2.memberCount = a0.member_count;
|
|
const brand_color_primary = a0.brand_color_primary;
|
|
object2.brandColorPrimary = value == brand_color_primary || value2 === brand_color_primary ? value : brand_color_primary;
|
|
object2.visibility = a0.visibility;
|
|
const buildGuildProfileTraitsFromServerBinding = buildGuildProfileTraitsFromServer;
|
|
id = a0.id;
|
|
const traits = a0.traits;
|
|
object2.traits = buildGuildProfileTraitsFromServerBinding(id, value != traits ? traits : []);
|
|
const game_application_ids = a0.game_application_ids;
|
|
object2.gameApplicationIds = value != game_application_ids ? game_application_ids : [];
|
|
const game_activity = a0.game_activity;
|
|
object2.gameActivity = value == game_activity ? {} : global.Object.entries(game_activity).reduce(function(a0, a1) {
|
|
var r1;
|
|
var r3;
|
|
var r4;
|
|
var item3;
|
|
var value3;
|
|
var iterator = a1[Symbol.iterator]();
|
|
var iterator2 = iterator.next;
|
|
var item2 = Reflect.apply(iterator2, iterator, []);
|
|
var item = item2.value;
|
|
item2 = item2.done ? undefined : iterator;
|
|
var value = undefined;
|
|
var value2 = item2 === value;
|
|
var r2 = value2 ? value : item;
|
|
if (value2) {
|
|
r1 = item2;
|
|
r3 = value;
|
|
r4 = value2;
|
|
} else {
|
|
item3 = Reflect.apply(iterator2, item2, []);
|
|
item = item3.value;
|
|
item3 = item3.done ? undefined : item2;
|
|
value3 = item3 === value;
|
|
if (value3) {
|
|
r1 = item3;
|
|
r3 = value;
|
|
r4 = value3;
|
|
} else {
|
|
r1 = item3;
|
|
r3 = item;
|
|
r4 = value3;
|
|
}
|
|
}
|
|
if (!r4) {
|
|
r1.return();
|
|
}
|
|
a0[r2] = {level: r3.activity_level, score: r3.activity_score};
|
|
return a0;
|
|
}, {});
|
|
object2.games = a0.games;
|
|
const features = a0.features;
|
|
object2.features = value != features ? features : [];
|
|
object2.tag = a0.tag;
|
|
object2.badge = a0.badge;
|
|
object2.badgeColorPrimary = a0.badge_color_primary;
|
|
object2.badgeColorSecondary = a0.badge_color_secondary;
|
|
object2.badgeHash = a0.badge_hash;
|
|
object2.premiumSubscriberCount = a0.premium_subscription_count;
|
|
object2.premiumTier = a0.premium_tier;
|
|
return object2;
|
|
}
|
|
|
|
function buildGuildProfileUpdateForServer(a0) { // fn#52761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6896:2596, offset: 0x01336ae2, size: 325 bytes, params: 2, frame: 17
|
|
var value;
|
|
const object2 = {};
|
|
if (a0.name != null) {
|
|
object2.name = a0.name;
|
|
}
|
|
if (a0.description != null) {
|
|
object2.description = a0.description;
|
|
}
|
|
if (a0.icon !== undefined) {
|
|
object2.icon = a0.icon;
|
|
}
|
|
if (a0.customBanner !== undefined) {
|
|
object2.custom_banner = a0.customBanner;
|
|
}
|
|
if (a0.visibility != null) {
|
|
object2.visibility = a0.visibility;
|
|
}
|
|
if (a0.brandColorPrimary !== undefined) {
|
|
object2.brand_color_primary = a0.brandColorPrimary;
|
|
}
|
|
if (a0.traits != null) {
|
|
value = a0.traits.map(_fun52762);
|
|
object2.traits = value.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
|
|
}
|
|
if (a0.gameApplicationIds != null) {
|
|
object2.game_application_ids = a0.gameApplicationIds;
|
|
}
|
|
if (a0.tag !== undefined) {
|
|
object2.tag = a0.tag;
|
|
}
|
|
if (a0.badge !== undefined) {
|
|
object2.badge = a0.badge;
|
|
}
|
|
if (a0.badgeColorPrimary !== undefined) {
|
|
object2.badge_color_primary = a0.badgeColorPrimary;
|
|
}
|
|
if (a0.badgeColorSecondary !== undefined) {
|
|
object2.badge_color_secondary = a0.badgeColorSecondary;
|
|
}
|
|
return object2;
|
|
}
|
|
|
|
function buildTopGamesFromServer(a0) { // fn#52763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6896:3589, offset: 0x01336cbb, size: 26 bytes, params: 2, frame: 13
|
|
return a0.reduce(function(a0, a1) {
|
|
a0[a1.game_application_id] = {level: a1.activity_level, score: a1.activity_score};
|
|
return a0;
|
|
}, {});
|
|
}
|
|
|
|
function buildGuildProfileFromInvite(a0) { // fn#52765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6896:3763, offset: 0x01336cff, size: 332 bytes, params: 2, frame: 18
|
|
var r5;
|
|
var approximate_presence_count;
|
|
var approximate_member_count;
|
|
var r1;
|
|
var object2;
|
|
var description;
|
|
var value4;
|
|
var features;
|
|
const guild = a0.guild;
|
|
const profile = a0.profile;
|
|
const value = null;
|
|
let r0 = value != profile ? buildGuildProfileFromServer(profile) : value;
|
|
if (value == r0) {
|
|
if (value == guild) {
|
|
r1 = value;
|
|
} else {
|
|
object2 = {};
|
|
object2.id = guild.id;
|
|
object2.name = guild.name;
|
|
description = guild.description;
|
|
r5 = value != description ? description : '';
|
|
object2.description = r5;
|
|
object2.icon = guild.icon;
|
|
object2.customBanner = guild.banner;
|
|
approximate_presence_count = guild.approximate_presence_count;
|
|
approximate_presence_count = value == approximate_presence_count ? a0.approximate_presence_count : approximate_presence_count;
|
|
value4 = 0;
|
|
object2.onlineCount = value != approximate_presence_count ? approximate_presence_count : value4;
|
|
approximate_member_count = guild.approximate_member_count;
|
|
approximate_member_count = value == approximate_member_count ? a0.approximate_member_count : approximate_member_count;
|
|
r5 = value != approximate_member_count ? approximate_member_count : value4;
|
|
object2.memberCount = r5;
|
|
object2.visibility = (require(6720) /* metro dependency 6720: GuildProfileTypes */).GuildProfileVisibility.NOT_SPECIFIED;
|
|
object2.traits = [];
|
|
object2.gameApplicationIds = [];
|
|
object2.gameActivity = {};
|
|
features = guild.features;
|
|
r5 = value != features ? features : [];
|
|
object2.features = r5;
|
|
object2.brandColorPrimary = value;
|
|
object2.tag = value;
|
|
object2.badge = value;
|
|
object2.badgeHash = value;
|
|
object2.badgeColorPrimary = value;
|
|
object2.badgeColorSecondary = value;
|
|
object2.premiumSubscriberCount = guild.premium_subscription_count;
|
|
object2.premiumTier = guild.premium_tier;
|
|
r1 = object2;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun52762(a0, a1) { // fn#52762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6896:2991, offset: 0x01336c27, size: 148 bytes, params: 3, frame: 8
|
|
var r0;
|
|
var object2;
|
|
var emoji;
|
|
const value = null;
|
|
const value2 = undefined;
|
|
if (value == (value == a0 ? value2 : a0.label)) {
|
|
r0 = value;
|
|
} else if (a0.label.length <= 0) {
|
|
r0 = value;
|
|
} else {
|
|
object2 = {};
|
|
object2.label = a0.label;
|
|
object2.position = a1;
|
|
emoji = a0.emoji;
|
|
object2.emoji_id = value == emoji ? value2 : emoji.id;
|
|
emoji = a0.emoji;
|
|
object2.emoji_name = value == emoji ? value2 : emoji.name;
|
|
emoji = a0.emoji;
|
|
object2.emoji_animated = value == emoji ? value2 : emoji.animated;
|
|
r0 = object2;
|
|
}
|
|
return r0;
|
|
}
|
|
|