Files
discord-decomp/sources/modules/emojis/EmojiStore.tsx
T
2026-07-27 16:20:00 +03:00

2120 lines
88 KiB
TypeScript

/* Metro module 6540; source: modules/emojis/EmojiStore.tsx; dependencies: [15, 17, 18, 57, 5, 6, 7, 4107, 6541, 1949, 1348, 1945, 1381, 1938, 1867, 4896, 1878, 6542, 6543, 1881, 661, 6544, 670, 3797, 6545, 21, 22, 672, 1910, 1929, 20, 5232, 694, 4393, 44, 4100, 1360, 6546, 6547, 6579, 3775, 3738, 6581, 3801, 3800, 566, 2] */
function _fun51423(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#51423, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:6, offset: 0x01237f9f, size: 1443 bytes, params: 8, frame: 27
let env0_0 = require;
const _arrayLikeToArray_51429 = 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 loadSavedEmojis = function() {
return _loadSavedEmojis.apply(this, arguments);
};
const closure = function(a0) {
var guildId = a0.guildId;
var value2 = GuildRoleStore.getRole(guildId, a0.role.id);
if (value2 != null) {
if (require(dependencyMap[40]).isSubscriptionRole(value2)) {
updateGuildEmoji(guildId);
rebuildEmojis();
return undefined;
}
}
return false;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(15) /* metro dependency 15 */;
const env0_4 = importDefault(17) /* metro dependency 17 */;
const env0_5 = importDefault(18) /* metro dependency 18 */;
const env0_6 = importDefault(57) /* metro dependency 57 */;
const env0_7 = importDefault(5) /* metro dependency 5 */;
const env0_8 = importDefault(6) /* metro dependency 6 */;
const env0_9 = importDefault(7) /* metro dependency 7 */;
const experimentStore = importDefault(4107) /* metro dependency 4107: ExperimentStore */;
const subscriptionRoleStore = importDefault(6541) /* metro dependency 6541: SubscriptionRoleStore */;
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */;
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
const guildMembershipStore = importDefault(1381) /* metro dependency 1381: GuildMembershipStore */;
const guildRoleStore = importDefault(1938) /* metro dependency 1938: GuildRoleStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const sortedGuildStore = importDefault(4896) /* metro dependency 4896: SortedGuildStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const rawGuildEmojiStore = importDefault(6542) /* metro dependency 6542: RawGuildEmojiStore */;
const topEmojiStore = importDefault(6543) /* metro dependency 6543: TopEmojiStore */;
let value = require(1881) /* metro dependency 1881: EmojiConstants */;
const env0_22 = value.EmojiDisabledReasons;
const env0_23 = value.EmojiIntention;
const env0_24 = (require(661) /* metro dependency 661: Constants */).NULL_STRING_GUILD_ID;
const EmojiCategories = (require(6544) /* metro dependency 6544: EmojiPickerConstants */).EmojiCategories;
const env0_26 = (require(670) /* metro dependency 670: UserSettingsConstants */).UserSettingsTypes;
const TOP_GUILD_EMOJI = EmojiCategories.TOP_GUILD_EMOJI;
object = [TOP_GUILD_EMOJI.toString()];
const FAVORITES = EmojiCategories.FAVORITES;
object[1] = FAVORITES.toString();
const RECENT = EmojiCategories.RECENT;
object[2] = RECENT.toString();
const CUSTOM = EmojiCategories.CUSTOM;
object[3] = CUSTOM.toString();
const concat = object.concat;
const getCategories = (importDefault(3797) /* metro dependency 3797: UnicodeEmojis */).getCategories;
value = Reflect.apply(concat, object, [Reflect.apply(getCategories, value, [])]);
object = {pendingUsages: [], emojiReactionPendingUsages: []};
let Set = global.Set;
let value2 = Object.create(Set.prototype, {constructor: {value: Set}});
let set = new Set();
object.expandedSectionsByGuildIds = set instanceof Object ? set : value2;
const env0_29 = _fun51449();
const snowflakeUtils = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
const fromTimestamp = snowflakeUtils.fromTimestamp;
const Date = global.Date;
let value5 = Date.now();
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
const DAY = Millis.DAY;
const env0_30 = Reflect.apply(fromTimestamp, snowflakeUtils, [value5 - 60 * DAY]);
const env0_31 = [];
const env0_32 = [];
Set = global.Set;
set = new Set();
object = {Unloaded: 0};
object[0] = 'Unloaded';
object.Loading = 1;
object[1] = 'Loading';
object.Loaded = 2;
object[2] = 'Loaded';
const env0_35 = object.Unloaded;
arraySpread([], value, 0, DAY);
const env0_37 = {};
const env0_38 = {};
const Map = global.Map;
let map = new Map();
const closure2 = function(a0) {
var env0_0 = a0;
return {computeBonus: _fun51464, lookupKey: _fun51465, afterCompute: _fun51466, numFrequentlyItems: 42};
};
map = _fun51468();
map._lastInstance = null;
const resetFrequentlyUsed = map.resetFrequentlyUsed;
const frecency = importDefault(4393) /* metro dependency 4393: Frecency */;
const object3 = {};
copyDataProperties(object3, closure2(resetFrequentlyUsed), 0);
const value10 = new frecency(object3);
const env0_43 = createEmojiReactionFrecency(map.resetFrequentlyUsedReactionEmojis);
const PersistedStore = (importDefault(566) /* metro dependency 566: flux */).PersistedStore;
const value12 = _fun51512(PersistedStore);
value12.displayName = 'EmojiStore';
value12.persistKey = 'EmojiStoreV2';
value12.migrations = [function(a0) {
var r1;
var object = {};
copyDataProperties(object, a0, r1);
return object;
}];
const value15 = new value12(importDefault(694) /* metro dependency 694: Dispatcher */, {LOGOUT: LOGOUT_51543,
BACKGROUND_SYNC: function() {
deleteEverything();
}, CONNECTION_OPEN: CONNECTION_OPEN_51545, OVERLAY_INITIALIZE: OVERLAY_INITIALIZE_51547,
CACHED_EMOJIS_LOADED: CACHED_EMOJIS_LOADED, GUILD_MEMBER_UPDATE: function(a0) {
var guildId = a0.guildId;
var id = a0.user.id;
var value2 = UserStore.getCurrentUser();
var value3 = undefined;
if (id === (value2 == null ? value3 : value2.id)) {
updateGuildEmoji(guildId);
rebuildEmojis();
}
return value3;
}, GUILD_CREATE: function(a0) {
updateGuildEmoji(a0.guild.id);
rebuildEmojis();
}, GUILD_UPDATE: function(a0) {
updateGuildEmoji(a0.guild.id);
rebuildEmojis();
}, GUILD_EMOJIS_UPDATE: function({guildId}) {
updateGuildEmoji(guildId);
rebuildEmojis();
}, GUILD_DELETE: GUILD_DELETE_51553, MESSAGE_REACTION_ADD: MESSAGE_REACTION_ADD_51554,
EMOJI_TRACK_USAGE: function({emojiUsed}) {
trackUsage(emojiUsed);
}, USER_SETTINGS_PROTO_UPDATE: USER_SETTINGS_PROTO_UPDATE_51556, GUILD_ROLE_CREATE: closure,
GUILD_ROLE_UPDATE: closure, TOP_EMOJIS_FETCH_SUCCESS: TOP_EMOJIS_FETCH_SUCCESS,
TOGGLE_GUILD_EXPANDED_STATE: TOGGLE_GUILD_EXPANDED_STATE});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/emojis/EmojiStore.tsx');
exports.default = value15;
exports.LoadState = object;
exports.EmojiDisambiguations = map;
}
function _isNativeReflectConstruct_51424() { // fn#51424, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:447, offset: 0x01238542, 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_51424_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_51427(a0, a1) { // fn#51427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:640, offset: 0x012385a0, 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 _fun51428;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_51429(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_51429(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_51429(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun51428;
}
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 getUsableEmoji(a0) { // fn#51430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:3552, offset: 0x01238712, size: 75 bytes, params: 2, frame: 15
const getEmojiToGroupIdBinding = getEmojiToGroupId;
const value2 = undefined;
const property = getEmojiToGroupIdBinding()[a0];
return property != null ? (env0_37[property] == null ? value2 : env0_37[property].getUsableEmoji(a0)) ?? value2 : value2;
}
function getEmojiToGroupId() { // fn#51431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:3689, offset: 0x0123875d, size: 128 bytes, params: 1, frame: 20
var r7;
var r2;
var binding;
var properties;
var properties2;
var properties3;
var propertyName;
var propertyName2;
var _createForOfIteratorHelperLoose_51427Binding;
var property;
var emojiIds;
var value2;
var value3;
var done;
var value4;
var value5;
loadSavedEmojis();
reducibleJoin5: while (true) {
if (env0_38 != null) {
break reducibleJoin5;
}
env0_38 = {};
binding = env0_37;
properties = Object.keys(binding);
properties2 = 0;
properties3 = properties.length;
if (properties === undefined) {
break reducibleJoin5;
}
r7 = properties2;
reducibleLoop2: while (true) {
propertyName = properties[r7];
propertyName2 = r7 + 1;
if (propertyName === undefined) {
break reducibleJoin5;
}
_createForOfIteratorHelperLoose_51427Binding = _createForOfIteratorHelperLoose_51427;
property = env0_37[propertyName];
emojiIds = property.emojiIds;
value2 = _createForOfIteratorHelperLoose_51427Binding(Reflect.apply(emojiIds, property, []));
value3 = value2();
done = value3.done;
if (done) {
r7 = propertyName2;
continue reducibleLoop2;
}
r2 = value3;
reducibleLoop4: while (true) {
value4 = r2.value;
env0_38[value4] = propertyName;
value5 = value2();
done = value5.done;
if (done) {
r7 = propertyName2;
continue reducibleLoop2;
}
r2 = value5;
continue reducibleLoop4;
}
continue reducibleLoop2;
}
}
return env0_38;
}
function _loadSavedEmojis() { // fn#51433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:3947, offset: 0x012387fb, size: 48 bytes, params: 1, frame: 14
return env0_7(_fun51435).apply(this, arguments);
}
function deleteEverything() { // fn#51438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:12447, offset: 0x0123897a, size: 61 bytes, params: 1, frame: 10
env0_37 = {};
env0_38 = {};
env0_41.reset();
env0_39.clear();
env0_35 = env0_34.Unloaded;
}
function deleteGuildEmoji(a0) { // fn#51439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:12518, offset: 0x012389b7, size: 32 bytes, params: 2, frame: 4
if (env0_37[a0] != null) {
delete env0_37[a0];
}
}
function rebuildEmojis() { // fn#51440, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:12571, offset: 0x012389d7, size: 73 bytes, params: 1, frame: 10
let binding = env0_41;
binding.reset();
const Loaded = env0_34.Loaded;
if (Unloaded === Loaded) {
binding = env0_42;
binding.compute();
binding = env0_43;
binding.compute();
}
}
function updateGuildEmoji(a0) { // fn#51441, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:12653, offset: 0x01238a20, size: 148 bytes, params: 2, frame: 19
var currentUser;
var canUseRoleSubscriptionIAP2;
deleteGuildEmoji(a0);
env0_41.clear(a0);
const guildEmojis = RawGuildEmojiStore.getGuildEmojis(a0);
if (guildEmojis != null) {
currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
canUseRoleSubscriptionIAP2 = (require(6579) /* metro dependency 6579: IAPEligibility */).canUseRoleSubscriptionIAP(a0);
env0_37[a0] = new env0_29(a0, currentUser.id, guildEmojis);
}
}
}
function handleUserSettingsProtoStoreChange_51442() { // fn#51442, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:12858, offset: 0x01238ab4, size: 593 bytes, params: 1, frame: 22
var r5;
var emojis;
var r6;
var r2;
var r22;
var diversitySurrogate;
var value3;
var defaultImport;
var setDefaultDiversitySurrogate;
var items;
var defaultImport5;
var hasLoaded;
var FRECENCY_AND_FAVORITES_SETTINGS;
var length;
var value6;
var property;
var track;
var value7;
var defaultImport7;
var value8;
var value9;
const textAndImages = UserSettingsProtoStore.settings.textAndImages;
const value2 = undefined;
reducibleJoin3: while (true) {
if (textAndImages == null) {
r5 = value2;
break reducibleJoin3;
}
diversitySurrogate = textAndImages.diversitySurrogate;
if (diversitySurrogate == null) {
r5 = value2;
break reducibleJoin3;
}
value3 = diversitySurrogate.value;
r5 = value3;
break reducibleJoin3;
}
reducibleJoin5: while (true) {
if (r5 == null) {
break reducibleJoin5;
}
defaultImport = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
setDefaultDiversitySurrogate = defaultImport.setDefaultDiversitySurrogate;
Reflect.apply(setDefaultDiversitySurrogate, defaultImport, [r5]);
break reducibleJoin5;
}
let binding = env0_41;
binding.reset();
const frecencyWithoutFetchingLatest = UserSettingsProtoStore.frecencyWithoutFetchingLatest;
const emojiFrecency = frecencyWithoutFetchingLatest.emojiFrecency;
reducibleJoin7: while (true) {
if (emojiFrecency == null) {
emojis = value2;
break reducibleJoin7;
}
emojis = emojiFrecency.emojis;
break reducibleJoin7;
}
reducibleJoin9: while (true) {
if (emojis != null) {
r6 = emojis;
break reducibleJoin9;
}
r6 = {};
break reducibleJoin9;
}
const emojiReactionFrecency = frecencyWithoutFetchingLatest.emojiReactionFrecency;
reducibleJoin11: while (true) {
if (emojiReactionFrecency == null) {
emojis = value2;
break reducibleJoin11;
}
emojis = emojiReactionFrecency.emojis;
break reducibleJoin11;
}
reducibleJoin13: while (true) {
if (emojis != null) {
r2 = emojis;
break reducibleJoin13;
}
r2 = {};
break reducibleJoin13;
}
binding = env0_42;
let overwriteHistory = binding.overwriteHistory;
const value4 = (importDefault(22) /* metro dependency 22 */).mapValues(r6, function(a0) {
var r3;
var object = {};
copyDataProperties(object, a0, r3);
var value = a0.recentUses.map(global.Number);
value = value.filter(_fun51444);
object['recentUses'] = value;
return object;
});
let pendingUsages = env0_28.pendingUsages;
Reflect.apply(overwriteHistory, binding, [value4, pendingUsages]);
binding = env0_43;
overwriteHistory = binding.overwriteHistory;
const value5 = (importDefault(22) /* metro dependency 22 */).mapValues(r2, function(a0) {
var r3;
var object = {};
copyDataProperties(object, a0, r3);
var value = a0.recentUses.map(global.Number);
value = value.filter(_fun51446);
object['recentUses'] = value;
return object;
});
let emojiReactionPendingUsages = env0_28.emojiReactionPendingUsages;
Reflect.apply(overwriteHistory, binding, [value5, emojiReactionPendingUsages]);
const defaultImport4 = importDefault(22) /* metro dependency 22 */;
let isEmpty = defaultImport4.isEmpty;
reducibleJoin18: while (true) {
if (!Reflect.apply(isEmpty, defaultImport4, [r6])) {
break reducibleJoin18;
}
defaultImport5 = defaultImport4;
isEmpty = defaultImport5.isEmpty;
pendingUsages = env0_28.pendingUsages;
if (!Reflect.apply(isEmpty, defaultImport5, [pendingUsages])) {
break reducibleJoin18;
}
hasLoaded = UserSettingsProtoStore.hasLoaded;
FRECENCY_AND_FAVORITES_SETTINGS = UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS;
if (!Reflect.apply(hasLoaded, UserSettingsProtoStore, [FRECENCY_AND_FAVORITES_SETTINGS])) {
break reducibleJoin18;
}
items = ['thumbsup', 'eyes', 'laughing', 'watermelon', 'fork_and_knife', 'yum', 'weary', 'tired_face', 'poop',
'100'];
length = items.length;
value6 = 0;
if (!(value6 < length)) {
break reducibleJoin18;
}
r22 = value6;
reducibleLoop17: while (true) {
property = items[r22];
binding = env0_42;
track = binding.track;
Reflect.apply(track, binding, [property]);
value7 = typeof r22 === 'bigint' ? r22 + 1n : +r22 + 1;
length = items.length;
if (value7 < length) {
r22 = value7;
continue reducibleLoop17;
}
break reducibleJoin18;
}
}
const defaultImport6 = defaultImport4;
isEmpty = defaultImport6.isEmpty;
reducibleJoin23: while (true) {
if (!Reflect.apply(isEmpty, defaultImport6, [r2])) {
break reducibleJoin23;
}
defaultImport7 = defaultImport4;
isEmpty = defaultImport7.isEmpty;
emojiReactionPendingUsages = env0_28.emojiReactionPendingUsages;
if (!Reflect.apply(isEmpty, defaultImport7, [emojiReactionPendingUsages])) {
break reducibleJoin23;
}
hasLoaded = UserSettingsProtoStore.hasLoaded;
FRECENCY_AND_FAVORITES_SETTINGS = UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS;
if (!Reflect.apply(hasLoaded, UserSettingsProtoStore, [FRECENCY_AND_FAVORITES_SETTINGS])) {
break reducibleJoin23;
}
items = ['100', '100', 'thumbsup', 'thumbsup', 'thumbsdown', 'thumbsdown', 'heart', 'point_up', 'eyes', 'weary',
'laughing', 'white_check_mark', 'x'];
length = items.length;
value8 = 0;
if (!(value8 < length)) {
break reducibleJoin23;
}
r2 = value8;
reducibleLoop22: while (true) {
property = items[r2];
binding = env0_43;
track = binding.track;
Reflect.apply(track, binding, [property]);
value9 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
length = items.length;
if (value9 < length) {
r2 = value9;
continue reducibleLoop22;
}
break reducibleJoin23;
}
}
return value2;
}
function trackUsage(a0) { // fn#51447, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:14098, offset: 0x01238d8b, size: 206 bytes, params: 2, frame: 20
var r3;
var r10;
var value4;
var id;
var uniqueName;
var name;
var binding;
var pendingUsages;
var push;
var object2;
var Date;
var value5;
if (a0 == null) {
return false;
}
const value2 = _createForOfIteratorHelperLoose_51427(a0);
const value3 = value2();
let done = value3.done;
if (!done) {
r3 = value3;
while (true) {
value4 = r3.value;
id = value4.id;
if (id != null) {
r10 = id;
} else {
uniqueName = value4.uniqueName;
r10 = uniqueName;
}
if (r10 != null) {
continue;
}
name = value4.name;
r10 = name;
if (r10 == null) {
continue;
}
binding = env0_42;
binding.track(r10);
pendingUsages = env0_28.pendingUsages;
push = pendingUsages.push;
object2 = {key: r10};
Date = global.Date;
object2.timestamp = Date.now();
Reflect.apply(push, pendingUsages, [object2]);
value5 = value2();
done = value5.done;
if (done) {
break;
}
r3 = value5;
continue;
}
}
const value6 = a0.length > 0;
if (value6 && Unloaded === env0_34.Loaded) {
env0_42.compute();
}
return value6;
}
function _fun51449() { // fn#51449, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:1771, offset: 0x01238ec0, size: 245 bytes, params: 1, frame: 15
return env0_9(GuildEmojis_51450, [{key: 'getEmoji', value: function(a0) {
return this._emojiMap[a0];
}}, {key: 'getUsableEmoji', value: function(a0) {
var value = this.getEmoji(a0);
return value != null && this.isUsable(value) ? value : undefined;
}}, {key: 'isUsable', value: value_51453}, {key: 'emojiIds', value: value_51455}, {key: 'emojis', get: function() {
if (this._emojis == null) {
this._emojis = global.Object.values(this._emojiMap);
}
return this._emojis;
}}, {key: 'emoticons', get: function() {
if (this._emoticons == null) {
this._emoticons = this.usableEmojis.filter(_fun51458);
}
return this._emoticons;
}}, {key: '_computeEmojiUsability', value: value_51459}, {key: 'usableEmojis', get: function() {
this._computeEmojiUsability();
return this._usableEmojis;
}}, {key: 'hiddenEmojiIds', get: function() {
this._computeEmojiUsability();
return this._hiddenEmojiIds;
}}]);
}
function createBaseEmojiFrecencyOptions(a0) { // fn#51463, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:4386, offset: 0x012392ba, size: 51 bytes, params: 2, frame: 3
const env0_0 = a0;
return {computeBonus: function() {
return 100;
}, lookupKey: lookupKey_51465, afterCompute: afterCompute_51466, numFrequentlyItems: 42};
}
function _fun51468() { // fn#51468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:4633, offset: 0x012393bc, size: 590 bytes, params: 1, frame: 17
return env0_9(EmojiDisambiguations, [{key: 'getDisambiguatedEmoji', value: function() {
return this.disambiguatedEmoji;
}}, {key: 'getCustomEmoji', value: function() {
return this.customEmojis;
}}, {key: 'getGroupedCustomEmoji', value: function() {
return this.customEmojisByGroup;
}}, {key: 'getByName', value: function(a0) {
var r1;
var value = this.emojisByName.get(a0);
if (value != null) {
return value;
}
value = this.unicodeAliases.get(a0);
if (value != null) {
value = this.emojisByName.get(value);
r1 = value;
} else {
r1 = undefined;
}
return r1;
}}, {key: 'getEmoticonByName', value: function(a0) {
return this.emoticonsByName.get(a0);
}}, {key: 'getById', value: function(a0) {
return this.emojisById.get(a0);
}}, {key: 'getCustomEmoticonRegex', value: function() {
var RegExp;
var value = this.emoticonRegex == null;
if (value && this.escapedEmoticonNames != null && this.escapedEmoticonNames !== '') {
RegExp = global.RegExp;
value = '^\\b(' + this.escapedEmoticonNames + ')\\b';
value = new RegExp(value);
this.emoticonRegex = value;
}
return this.emoticonRegex;
}}, {key: 'getFrequentlyUsedEmojisWithoutFetchingLatest', value: value_51485},
{key: 'rebuildFrequentlyUsedReactionsEmojisWithoutFetchingLatest', value: value_51487},
{key: 'getFrequentlyUsedReactionEmojisWithoutFetchingLatest', value: function() {
return this.rebuildFrequentlyUsedReactionsEmojisWithoutFetchingLatest().frequentlyUsedReactionEmojis;
}}, {key: 'isFrequentlyUsedReactionEmojiWithoutFetchingLatest', value: function(a0) {
var value = a0;
var frequentlyUsedReactionNamesAndIds = this.rebuildFrequentlyUsedReactionsEmojisWithoutFetchingLatest().frequentlyUsedReactionNamesAndIds;
if (value.id != null) {
return frequentlyUsedReactionNamesAndIds.has(value.id);
}
return frequentlyUsedReactionNamesAndIds.has((importDefault(dependencyMap[23]).convertSurrogateToBase(value.surrogates) ?? value).name);
}}, {key: 'rebuildFavoriteEmojisWithoutFetchingLatest', value: value_51491},
{key: 'favoriteEmojisWithoutFetchingLatest', get: function() {
return this.rebuildFavoriteEmojisWithoutFetchingLatest().favorites;
}}, {key: 'getEmojiInPriorityOrderWithoutFetchingLatest', value: function() {
var value = this.getFrequentlyUsedReactionEmojisWithoutFetchingLatest();
var value3 = new global.Set();
value = this.favoriteEmojisWithoutFetchingLatest.concat(value);
return value.filter(_fun51495);
}}, {key: 'getTopEmojiWithoutFetchingLatest', value: value_51496}, {key: 'getNewlyAddedEmojiForGuild',
value: value_51501}, {key: 'getEscapedCustomEmoticonNames', value: function() {
return this.escapedEmoticonNames;
}}, {key: 'nameMatchesChain', value: value_51503}], [{key: 'get', value: value_51505}, {key: 'reset',
value: function() {
EmojiDisambiguations._lastInstance = null;
}}, {key: 'resetFrequentlyUsed', value: function() {
if (EmojiDisambiguations._lastInstance != null) {
EmojiDisambiguations._lastInstance.frequentlyUsed = null;
}
}}, {key: 'resetFrequentlyUsedReactionEmojis', value: function() {
if (EmojiDisambiguations._lastInstance != null) {
EmojiDisambiguations._lastInstance.frequentlyUsedReactionEmojis = null;
EmojiDisambiguations._lastInstance.frequentlyUsedReactionNamesAndIds = null;
}
}}, {key: 'clear', value: function(a0) {
if (EmojiDisambiguations._lastInstance != null && EmojiDisambiguations._lastInstance.guildId === a0) {
EmojiDisambiguations._lastInstance = null;
}
}}]);
}
function createEmojiReactionFrecency(a0) { // fn#51510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:12166, offset: 0x0123a5e5, size: 98 bytes, params: 2, frame: 14
const defaultImport = importDefault(4393) /* metro dependency 4393: Frecency */;
const object2 = {};
copyDataProperties(object2, createBaseEmojiFrecencyOptions(a0), undefined);
object2['computeFrecency'] = function(a0, a1, a2) {
if (a2.maxTotalUse == null) {
return 0;
}
var value = a0 / a2.maxTotalUse * 0.2;
var value2 = a1 / 1000;
var Math = global.Math;
return Math.trunc(1000 * (value + value2 * 0.8));
};
object2['calculateMaxTotalUse'] = true;
let value = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}});
const defaultImport2 = new defaultImport(object2);
return defaultImport2 instanceof Object ? defaultImport2 : value;
}
function _fun51512(a0) { // fn#51512, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:14569, offset: 0x0123a6ad, size: 588 bytes, params: 2, frame: 16
const closure = EmojiStore;
env0_5(closure, a0);
return env0_9(closure, [{key: 'initialize', value: value_51514}, {key: 'getState', value: value_51515},
{key: 'loadState', get: function() {
return Unloaded;
}}, {key: 'hasPendingUsage', value: value_51517}, {key: 'expandedSectionsByGuildIds', get: get_51518},
{key: 'categories', get: get_51519}, {key: 'diversitySurrogate', get: get_51520},
{key: 'emojiFrecencyWithoutFetchingLatest', get: get_51521}, {key: 'emojiReactionFrecencyWithoutFetchingLatest',
get: get_51522}, {key: 'getGuildEmoji', value: value_51523}, {key: 'getHiddenEmojiIds', value: value_51524},
{key: 'getUsableGuildEmoji', value: value_51525}, {key: 'getGuilds', value: value_51526},
{key: 'getDisambiguatedEmojiContext', value: value_51527}, {key: 'getSearchResultsOrder', value: value_51528},
{key: 'searchWithoutFetchingLatest', value: value_51531}, {key: 'getUsableCustomEmojiById',
value: function(a0) {
loadSavedEmojis();
return getUsableEmoji(a0);
}}, {key: 'getCustomEmojiById', value: value_51535}, {key: 'getTopEmoji', value: value_51536},
{key: 'getNewlyAddedEmoji', value: value_51537}, {key: 'getTopEmojisMetadata', value: value_51538},
{key: 'hasUsableEmojiInAnyGuild', value: value_51539}, {key: 'hasFavoriteEmojis', value: value_51541}]);
}
function LOGOUT_51543() { // fn#51543, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:19126, offset: 0x0123b352, size: 35 bytes, params: 1, frame: 3
env0_28.pendingUsages = [];
env0_28.emojiReactionPendingUsages = [];
}
function CONNECTION_OPEN_51545(a0) { // fn#51545, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:19286, offset: 0x0123b384, size: 157 bytes, params: 2, frame: 15
var r4;
var r2;
var updateGuildEmojiBinding;
var value4;
var id;
var value5;
var every;
var Unloaded;
var Loaded;
deleteEverything();
const _createForOfIteratorHelperLoose_51427Binding = _createForOfIteratorHelperLoose_51427;
let guilds = a0.guilds;
const value2 = _createForOfIteratorHelperLoose_51427Binding(guilds);
const value3 = value2();
let done = value3.done;
if (!done) {
r4 = value3;
reducibleLoop1: while (true) {
updateGuildEmojiBinding = updateGuildEmoji;
value4 = r4.value;
id = value4.id;
updateGuildEmojiBinding(id);
value5 = value2();
done = value5.done;
if (done) {
break reducibleLoop1;
}
r4 = value5;
continue reducibleLoop1;
}
}
reducibleJoin6: while (true) {
reducibleJoin4: while (true) {
if (a0.unavailableGuilds.length !== 0) {
break reducibleJoin4;
}
guilds = a0.guilds;
every = guilds.every;
if (Reflect.apply(every, guilds, [function(a0) {
return a0.emojis.op === 'full_sync';
}])) {
Loaded = env0_34.Loaded;
r2 = Loaded;
break reducibleJoin6;
}
break reducibleJoin4;
}
Unloaded = env0_34.Unloaded;
r2 = Unloaded;
break reducibleJoin6;
}
rebuildEmojis();
}
function OVERLAY_INITIALIZE_51547(a0) { // fn#51547, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:19574, offset: 0x0123b43b, size: 77 bytes, params: 2, frame: 17
var propertyName;
deleteEverything();
for (propertyName in a0.emojis) {
updateGuildEmoji(propertyName);
}
env0_35 = env0_34.Loaded;
rebuildEmojis();
}
function CACHED_EMOJIS_LOADED({emojis}) { // fn#51548, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:19720, offset: 0x0123b488, size: 111 bytes, params: 2, frame: 18
var r3;
var value4;
var property;
var isMember;
var value5;
const value2 = _createForOfIteratorHelperLoose_51427(emojis);
const value3 = value2();
let done = value3.done;
if (!done) {
r3 = value3;
while (true) {
value4 = r3.value;
property = env0_6(value4, 1)[0];
isMember = GuildMembershipStore.isMember;
if (Reflect.apply(isMember, GuildMembershipStore, [property])) {
updateGuildEmoji(property);
}
value5 = value2();
done = value5.done;
if (done) {
break;
}
r3 = value5;
continue;
}
}
rebuildEmojis();
}
function GUILD_DELETE_51553({guild}) { // fn#51553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:20370, offset: 0x0123b587, size: 56 bytes, params: 2, frame: 13
deleteGuildEmoji(guild.id);
env0_39.delete(guild.id);
rebuildEmojis();
}
function MESSAGE_REACTION_ADD_51554(a0) { // fn#51554, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:20484, offset: 0x0123b5bf, size: 367 bytes, params: 2, frame: 22
var r0;
var r4;
var r11;
var id;
var value;
var getByName;
var defaultImport;
var convertSurrogateToName;
var name;
var items2;
var value2;
var value3;
var done;
var value4;
var uniqueName;
var binding;
var emojiReactionPendingUsages;
var push;
var object2;
var Date;
var value5;
if (a0.optimistic) {
id = a0.emoji.id;
if (id == null) {
value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
getByName = value.getByName;
defaultImport = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
convertSurrogateToName = defaultImport.convertSurrogateToName;
name = a0.emoji.name;
value = Reflect.apply(getByName, value, [Reflect.apply(convertSurrogateToName, defaultImport, [name,
false])]);
r0 = value;
} else {
id = a0.emoji.id;
if (id !== '0') {
r0 = a0.emoji;
} else {
value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
getByName = value.getByName;
defaultImport = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
convertSurrogateToName = defaultImport.convertSurrogateToName;
name = a0.emoji.name;
value = Reflect.apply(getByName, value, [Reflect.apply(convertSurrogateToName, defaultImport, [name,
false])]);
r0 = value;
}
}
if (r0 == null) {
return false;
}
items2 = [r0];
if (items2 != null) {
value2 = _createForOfIteratorHelperLoose_51427(items2);
value3 = value2();
done = value3.done;
if (!done) {
r4 = value3;
while (true) {
value4 = r4.value;
id = value4.id;
if (id != null) {
r11 = id;
} else {
uniqueName = value4.uniqueName;
r11 = uniqueName;
}
if (r11 != null) {
continue;
}
name = value4.name;
r11 = name;
if (r11 == null) {
continue;
}
binding = env0_43;
binding.track(r11);
emojiReactionPendingUsages = env0_28.emojiReactionPendingUsages;
push = emojiReactionPendingUsages.push;
object2 = {key: r11};
Date = global.Date;
object2.timestamp = Date.now();
Reflect.apply(push, emojiReactionPendingUsages, [object2]);
value5 = value2();
done = value5.done;
if (done) {
break;
}
r4 = value5;
continue;
}
}
if (items2.length > 0 && Unloaded === env0_34.Loaded) {
env0_43.compute();
}
}
trackUsage([r0]);
return undefined;
}
return false;
}
function USER_SETTINGS_PROTO_UPDATE_51556({settings, wasSaved}) { // fn#51556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:21127, offset: 0x0123b747, size: 117 bytes, params: 2, frame: 15
var binding;
const type = settings.type;
const defaultImport = importDefault(6547) /* metro dependency 6547: EmojiTerms */;
defaultImport.setEmojiLocale(LocaleStore.locale);
const FRECENCY_AND_FAVORITES_SETTINGS = UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS;
if (type === FRECENCY_AND_FAVORITES_SETTINGS) {
if (wasSaved) {
binding = env0_28;
binding.pendingUsages = [];
binding = env0_28;
binding.emojiReactionPendingUsages = [];
return undefined;
}
}
return false;
}
function TOP_EMOJIS_FETCH_SUCCESS({guildId, topEmojisMetadata}) { // fn#51557, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:21433, offset: 0x0123b7bc, size: 130 bytes, params: 2, frame: 18
const binding = env0_39;
const set = binding.set;
const object2 = {};
object2.emojiIds = topEmojisMetadata.map(function(a0) {
return a0.emojiId;
});
let value = importDefault(3738) /* metro dependency 3738 */;
value = value((importDefault(3738) /* metro dependency 3738 */)());
value = value.add(1, 'days');
object2.topEmojisTTL = value.valueOf();
Reflect.apply(set, binding, [guildId, object2]);
}
function TOGGLE_GUILD_EXPANDED_STATE({guildId}) { // fn#51559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:21626, offset: 0x0123b849, size: 124 bytes, params: 2, frame: 14
const Set = global.Set;
let expandedSectionsByGuildIds = env0_28.expandedSectionsByGuildIds;
const set = new Set(expandedSectionsByGuildIds);
expandedSectionsByGuildIds = env0_28.expandedSectionsByGuildIds;
if (expandedSectionsByGuildIds.has(guildId)) {
set.delete(guildId);
} else {
set.add(guildId);
}
const object2 = {};
copyDataProperties(object2, env0_28, expandedSectionsByGuildIds);
object2['expandedSectionsByGuildIds'] = set;
}
function* _fun51435() { // fn#51435, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:4002, offset: 0x01238834, size: 224 bytes, params: 1, frame: 17
var environment;
if (true) {
value = environment.__proto__.__proto__;
var binding = env2_35;
var Unloaded = env2_34.Unloaded;
if (binding === Unloaded) {
binding = env2_1;
if (binding(env2_2[28]).database() == null) {
return undefined;
}
env2_35 = env2_34.Loading;
binding = env2_0;
var value5 = binding(env2_2[29]);
yield value5.tryLoadOrResetCacheGatewayAsync('EmojiStore.loadSavedEmojis', _fun51436);
var value6 = undefined;
if (false) {
return value6;
}
env2_35 = env2_34.Loaded;
if (value6 != null) {
value = env2_1(env2_2[32]);
value.dispatch({type: 'CACHED_EMOJIS_LOADED', emojis: value6});
}
}
}
}
function _fun51443(a0) { // fn#51443, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:13267, offset: 0x01238d05, size: 67 bytes, params: 2, frame: 13
const object2 = {};
copyDataProperties(object2, a0, undefined);
const recentUses = a0.recentUses;
const map = recentUses.map;
const Number = global.Number;
let value = Reflect.apply(map, recentUses, [Number]);
value = value.filter(function(a0) {
return a0 > 0;
});
object2['recentUses'] = value;
return object2;
}
function _fun51445(a0) { // fn#51445, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:13392, offset: 0x01238d48, size: 67 bytes, params: 2, frame: 13
const object2 = {};
copyDataProperties(object2, a0, undefined);
const recentUses = a0.recentUses;
const map = recentUses.map;
const Number = global.Number;
let value = Reflect.apply(map, recentUses, [Number]);
value = value.filter(function(a0) {
return a0 > 0;
});
object2['recentUses'] = value;
return object2;
}
function GuildEmojis_51450(a0, a1, a2) { // fn#51450, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:1792, offset: 0x01238fb5, size: 103 bytes, params: 4, frame: 14
let value = a3;
const r2 = value !== undefined ? value : false;
value = environment.__proto__;
env1_8(this, GuildEmojis_51450);
this._emojis = null;
this._emoticons = null;
this._usableEmojis = null;
this._hiddenEmojiIds = null;
this._canSeeServerSubIAP = false;
this.id = a0;
this._userId = a1;
this._emojiMap = a2;
this._canSeeServerSubIAP = r2;
}
function value_51453(a0) { // fn#51453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:2224, offset: 0x0123905f, size: 188 bytes, params: 2, frame: 17
var environment;
var r1;
var r0;
var value4;
var isPurchasableRoleSubscriptionEmoji2;
const env0_0 = a0;
if (a0.roles.length === 0) {
return true;
}
const value = environment.__proto__;
const member = GuildMemberStore.getMember(this.id, this._userId);
const value3 = member != null;
if (value3) {
value4 = member.roles.some(_fun51454);
if (value4) {
r1 = !!value4;
} else {
isPurchasableRoleSubscriptionEmoji2 = (require(6545) /* metro dependency 6545: RoleSubscriptionEmojiUtils */).isPurchasableRoleSubscriptionEmoji(a0);
r1 = isPurchasableRoleSubscriptionEmoji2 ? this._canSeeServerSubIAP || SubscriptionRoleStore.getUserIsAdmin(a0.guildId) : !!isPurchasableRoleSubscriptionEmoji2;
}
r0 = r1;
} else {
r0 = value3;
}
return r0;
}
function value_51455() { // fn#51455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:2498, offset: 0x0123911b, size: 46 bytes, params: 1, frame: 11
let value = environment.__proto__;
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
return value.keys(this._emojiMap);
}
function get_51457() { // fn#51457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:2685, offset: 0x0123917e, size: 52 bytes, params: 1, frame: 12
var usableEmojis;
if (this._emoticons == null) {
usableEmojis = this.usableEmojis;
this._emoticons = usableEmojis.filter(function(a0) {
return !a0.require_colons;
});
}
return this._emoticons;
}
function value_51459() { // fn#51459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:2847, offset: 0x012391c0, size: 208 bytes, params: 1, frame: 19
var environment;
var r6;
var _hiddenEmojiIds;
var items2;
var Set;
var prototype;
var value;
var set;
var value2;
var _createForOfIteratorHelperLoose_51427Binding;
var emojis;
var value3;
var value4;
var done;
var value5;
var isUsable;
var add;
var id;
var push;
var value6;
var defaultImport;
var sortBy;
reducibleJoin8: while (true) {
reducibleJoin7: while (true) {
if (this._usableEmojis == null) {
items2 = [];
Set = global.Set;
prototype = Set.prototype;
value = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value = set instanceof Object ? set : value;
value2 = environment.__proto__;
_createForOfIteratorHelperLoose_51427Binding = _createForOfIteratorHelperLoose_51427;
emojis = this.emojis;
value3 = _createForOfIteratorHelperLoose_51427Binding(emojis);
value4 = value3();
done = value4.done;
if (done) {
break reducibleJoin7;
}
r6 = value4;
reducibleLoop3: while (true) {
value5 = r6.value;
isUsable = this.isUsable;
if (Reflect.apply(isUsable, this, [value5])) {
push = items2.push;
Reflect.apply(push, items2, [value5]);
} else {
add = value.add;
id = value5.id;
Reflect.apply(add, value, [id]);
}
value6 = value3();
done = value6.done;
if (done) {
break reducibleJoin7;
}
r6 = value6;
continue reducibleLoop3;
}
} else {
_hiddenEmojiIds = this._hiddenEmojiIds;
if (_hiddenEmojiIds != null) {
break reducibleJoin8;
}
items2 = [];
Set = global.Set;
prototype = Set.prototype;
value = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value = set instanceof Object ? set : value;
value2 = environment.__proto__;
_createForOfIteratorHelperLoose_51427Binding = _createForOfIteratorHelperLoose_51427;
emojis = this.emojis;
value3 = _createForOfIteratorHelperLoose_51427Binding(emojis);
value4 = value3();
done = value4.done;
if (done) {
break reducibleJoin7;
}
r6 = value4;
reducibleLoop3: while (true) {
value5 = r6.value;
isUsable = this.isUsable;
if (Reflect.apply(isUsable, this, [value5])) {
push = items2.push;
Reflect.apply(push, items2, [value5]);
} else {
add = value.add;
id = value5.id;
Reflect.apply(add, value, [id]);
}
value6 = value3();
done = value6.done;
if (done) {
break reducibleJoin7;
}
r6 = value6;
continue reducibleLoop3;
}
}
}
defaultImport = importDefault(22) /* metro dependency 22 */;
sortBy = defaultImport.sortBy;
this._usableEmojis = Reflect.apply(sortBy, defaultImport, [items2, function(a0) {
return a0.name;
}]);
this._hiddenEmojiIds = value;
break reducibleJoin8;
}
}
function createBaseEmojiFrecencyOptionsLookupKey(a0) { // fn#51465, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:4422, owner: createBaseEmojiFrecencyOptions.lookupKey, offset: 0x012392ed, size: 56 bytes, params: 2, frame: 13
const value = environment.__proto__;
return (importDefault(3797) /* metro dependency 3797: UnicodeEmojis */).getByName(a0) ?? getUsableEmoji(a0);
}
function createBaseEmojiFrecencyOptionsAfterCompute() { // fn#51466, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:4505, owner: createBaseEmojiFrecencyOptions.afterCompute, offset: 0x01239325, size: 129 bytes, params: 1, frame: 16
var environment;
var splice;
var binding2;
env0_0();
const value = environment.__proto__;
let binding = env1_27;
const items2 = [];
arraySpread(items2, binding, 0, undefined);
env1_36 = items2;
const defaultImport = importDefault(22) /* metro dependency 22 */;
const some = defaultImport.some;
binding = env1_37;
if (!Reflect.apply(some, defaultImport, [binding, function(a0) {
return a0.usableEmojis.length > 0;
}])) {
binding = env1_36;
splice = binding.splice;
binding2 = env1_27;
Reflect.apply(splice, binding, [binding2.indexOf(EmojiCategories.CUSTOM), 1]);
}
}
function EmojiDisambiguations(a0) { // fn#51469, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:4644, offset: 0x0123960a, size: 640 bytes, params: 2, frame: 25
var environment;
var r6;
var value21;
var value22;
var set;
var value23;
var slice;
var value24;
const value = environment.__proto__;
env1_8(this, EmojiDisambiguations);
this.favorites = null;
this.favoriteNamesAndIds = null;
this.topEmojis = null;
this.disambiguatedEmoji = [];
this.emoticonRegex = null;
this.frequentlyUsed = null;
this.frequentlyUsedReactionEmojis = null;
this.frequentlyUsedReactionNamesAndIds = null;
let Map = global.Map;
const value3 = Object.create(Map.prototype, {constructor: {value: Map}});
let map = new Map();
this.unicodeAliases = map instanceof Object ? map : value3;
Map = global.Map;
const value5 = Object.create(Map.prototype, {constructor: {value: Map}});
map = new Map();
this.customEmojis = map instanceof Object ? map : value5;
Map = global.Map;
const value7 = Object.create(Map.prototype, {constructor: {value: Map}});
map = new Map();
this.customEmojisByGroup = map instanceof Object ? map : value7;
Map = global.Map;
const value9 = Object.create(Map.prototype, {constructor: {value: Map}});
map = new Map();
this.emoticonsByName = map instanceof Object ? map : value9;
Map = global.Map;
const value11 = Object.create(Map.prototype, {constructor: {value: Map}});
map = new Map();
this.emojisByName = map instanceof Object ? map : value11;
Map = global.Map;
const value13 = Object.create(Map.prototype, {constructor: {value: Map}});
map = new Map();
this.emojisById = map instanceof Object ? map : value13;
Map = global.Map;
const value15 = Object.create(Map.prototype, {constructor: {value: Map}});
map = new Map();
this.newlyAddedEmoji = map instanceof Object ? map : value15;
this.isFavoriteEmojiWithoutFetchingLatest = isFavoriteEmojiWithoutFetchingLatest;
this.guildId = a0;
Map = global.Map;
map = new Map();
const items2 = [];
(importDefault(3797) /* metro dependency 3797: UnicodeEmojis */).forEach(_fun51473);
addGuildEmoji(this.guildId);
const _createForOfIteratorHelperLoose_51427Binding = _createForOfIteratorHelperLoose_51427;
let newlyAddedEmoji = this.newlyAddedEmoji;
const value19 = _createForOfIteratorHelperLoose_51427Binding(newlyAddedEmoji.keys());
const value20 = value19();
let done = value20.done;
if (!done) {
r6 = value20;
while (true) {
value21 = r6.value;
newlyAddedEmoji = this.newlyAddedEmoji;
value22 = newlyAddedEmoji.get(value21);
if (value22 != null) {
newlyAddedEmoji = this.newlyAddedEmoji;
set = newlyAddedEmoji.set;
value23 = value22.sort(_fun51476);
slice = value23.slice;
Reflect.apply(set, newlyAddedEmoji, [value21, Reflect.apply(slice, value23, [0, 3])]);
} else {
newlyAddedEmoji = this.newlyAddedEmoji;
newlyAddedEmoji.set(value21, []);
}
value24 = value19();
done = value24.done;
if (done) {
break;
}
r6 = value24;
continue;
}
}
SortedGuildStore.getFlattenedGuildIds().forEach(_fun51477);
this.escapedEmoticonNames = items2.join('|');
}
function value_51485() { // fn#51485, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:7769, offset: 0x01239df9, size: 155 bytes, params: 1, frame: 18
var environment;
if (this.frequentlyUsed == null) {
var value = environment.__proto__;
var value2 = env1_42.frequently.map(_fun51486);
value = (importDefault(6546) /* metro dependency 6546: dedupeEmojisByNameOrId */)(value2.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish));
value = value.values();
var items2 = [];
arraySpread(items2, value, 0, require);
this.frequentlyUsed = items2;
}
return this.frequentlyUsed;
}
function value_51487() { // fn#51487, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:8103, offset: 0x01239ee6, size: 244 bytes, params: 1, frame: 18
var environment;
var value;
const isNotNullish = (require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish;
var value4;
var items;
var Set;
var value5;
var set;
if (this.frequentlyUsedReactionEmojis == null) {
value = environment.__proto__;
value = (importDefault(6546) /* metro dependency 6546: dedupeEmojisByNameOrId */)(env1_43.frequently.map(_fun51488).filter(isNotNullish));
value4 = value.values();
items = [];
arraySpread(items, value4, 0, require);
this.frequentlyUsedReactionEmojis = items;
Set = global.Set;
value = value.keys();
this.frequentlyUsedReactionNamesAndIds = new Set();
} else {
if (this.frequentlyUsedReactionNamesAndIds != null) {
return {frequentlyUsedReactionEmojis: this.frequentlyUsedReactionEmojis,
frequentlyUsedReactionNamesAndIds: this.frequentlyUsedReactionNamesAndIds};
}
value = environment.__proto__;
value4 = (importDefault(6546) /* metro dependency 6546: dedupeEmojisByNameOrId */)(env1_43.frequently.map(_fun51488).filter(isNotNullish)).values();
items = [];
arraySpread(items, value4, 0, require);
this.frequentlyUsedReactionEmojis = items;
Set = global.Set;
value = value.keys();
value5 = Object.create(Set.prototype, {constructor: {value: Set}});
set = new Set();
this.frequentlyUsedReactionNamesAndIds = set instanceof Object ? set : value5;
}
return {frequentlyUsedReactionEmojis: this.frequentlyUsedReactionEmojis,
frequentlyUsedReactionNamesAndIds: this.frequentlyUsedReactionNamesAndIds};
}
function value_51491() { // fn#51491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:9273, offset: 0x0123a065, size: 273 bytes, params: 1, frame: 18
var environment;
var value;
var items;
const isNotNullish = (require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish;
var value5;
var Set;
var value6;
var set;
if (this.favorites == null) {
value = environment.__proto__;
value = (importDefault(6546) /* metro dependency 6546: dedupeEmojisByNameOrId */)((UserSettingsProtoStore.frecencyWithoutFetchingLatest.favoriteEmojis?.emojis ?? []).map(_fun51492).filter(isNotNullish));
value5 = value.values();
items = [];
arraySpread(items, value5, 0, require);
this.favorites = items;
Set = global.Set;
value = value.keys();
this.favoriteNamesAndIds = new Set();
} else {
if (this.favoriteNamesAndIds != null) {
return {favorites: this.favorites, favoriteNamesAndIds: this.favoriteNamesAndIds};
}
value = environment.__proto__;
value5 = (importDefault(6546) /* metro dependency 6546: dedupeEmojisByNameOrId */)((UserSettingsProtoStore.frecencyWithoutFetchingLatest.favoriteEmojis?.emojis ?? []).map(_fun51492).filter(isNotNullish)).values();
items = [];
arraySpread(items, value5, 0, require);
this.favorites = items;
Set = global.Set;
value = value.keys();
value6 = Object.create(Set.prototype, {constructor: {value: Set}});
set = new Set();
this.favoriteNamesAndIds = set instanceof Object ? set : value6;
}
return {favorites: this.favorites, favoriteNamesAndIds: this.favoriteNamesAndIds};
}
function value_51494() { // fn#51494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:9982, offset: 0x0123a1cc, size: 80 bytes, params: 1, frame: 13
let value = this.getFrequentlyUsedReactionEmojisWithoutFetchingLatest();
const Set = global.Set;
const set = new Set();
value = this.favoriteEmojisWithoutFetchingLatest.concat(value);
return value.filter(_fun51495);
}
function value_51496(a0) { // fn#51496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:10213, offset: 0x0123a248, size: 194 bytes, params: 2, frame: 17
var environment;
var items2;
if (this.topEmojis == null) {
var value = environment.__proto__;
var value2 = env1_39.get(a0);
var topEmojiIdsByGuildId = TopEmojiStore.getTopEmojiIdsByGuildId(a0);
if (value2 != null) {
value = undefined;
value = ((value2 == null ? value : value2.emojiIds) ?? topEmojiIdsByGuildId).map(_fun51497);
items2 = [];
value.forEach(_fun51498);
value = this.getNewlyAddedEmojiForGuild(a0);
var env0_2 = value.map(function(a0) {
return a0.id;
});
this.topEmojis = items2.filter(_fun51500);
return this.topEmojis;
}
if (topEmojiIdsByGuildId == null) {
return env1_31;
}
value = undefined;
value = ((value2 == null ? value : value2.emojiIds) ?? topEmojiIdsByGuildId).map(_fun51497);
items2 = [];
value.forEach(_fun51498);
value = this.getNewlyAddedEmojiForGuild(a0);
var env0_2 = value.map(function(a0) {
return a0.id;
});
this.topEmojis = items2.filter(_fun51500);
}
return this.topEmojis;
}
function value_51501(a0) { // fn#51501, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:10696, offset: 0x0123a39e, size: 56 bytes, params: 2, frame: 12
var value;
if (this.newlyAddedEmoji == null) {
value = environment.__proto__;
return env1_31;
}
return this.newlyAddedEmoji.get(a0) ?? env1_31;
}
function value_51503(a0) { // fn#51503, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:10921, offset: 0x0123a3e1, size: 71 bytes, params: 2, frame: 13
var environment;
const env0_0 = a0;
let value = environment.__proto__;
value = importDefault(22) /* metro dependency 22 */;
const getDisambiguatedEmoji = this.getDisambiguatedEmoji;
value = value(Reflect.apply(getDisambiguatedEmoji, this, []));
return value.filter(_fun51504);
}
function value_51505(a0) { // fn#51505, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:11154, offset: 0x0123a4d7, size: 100 bytes, params: 2, frame: 12
var value4;
var emojiDisambiguations;
const value = a0;
const r1 = value !== undefined ? value : null;
if (!(EmojiDisambiguations._lastInstance != null && EmojiDisambiguations._lastInstance.guildId === r1)) {
value4 = Object.create(EmojiDisambiguations.prototype, {constructor: {value: EmojiDisambiguations}});
emojiDisambiguations = new EmojiDisambiguations(r1);
EmojiDisambiguations._lastInstance = emojiDisambiguations instanceof Object ? emojiDisambiguations : value4;
}
return EmojiDisambiguations._lastInstance;
}
function EmojiStore() { // fn#51513, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:14581, offset: 0x0123a8f9, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_8(this, EmojiStore);
const value3 = env1_4(EmojiStore);
return env1_3(this, _isNativeReflectConstruct_51424() ? global.Reflect.construct(value3, arguments,
env1_4(this).constructor) : value3.apply(this, arguments));
}
function value_51514(a0) { // fn#51514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:14849, offset: 0x0123a96a, size: 214 bytes, params: 2, frame: 35
var binding;
var expandedSectionsByGuildIds;
var Set;
var value2;
var set;
this.waitFor(ExperimentStore, GuildMemberStore, GuildMembershipStore, GuildRoleStore, GuildStore, LocaleStore,
RawGuildEmojiStore, SortedGuildStore, SubscriptionRoleStore, TopEmojiStore, UserSettingsProtoStore, UserStore);
if (a0 != null) {
if (a0.pendingUsages != null) {
env1_28.pendingUsages = a0.pendingUsages;
}
if (a0.emojiReactionPendingUsages != null) {
env1_28.emojiReactionPendingUsages = a0.emojiReactionPendingUsages;
}
expandedSectionsByGuildIds = a0.expandedSectionsByGuildIds;
if (expandedSectionsByGuildIds != null) {
binding = env1_28;
Set = global.Set;
expandedSectionsByGuildIds = a0.expandedSectionsByGuildIds;
value2 = Object.create(Set.prototype, {constructor: {value: Set}});
set = new Set();
binding.expandedSectionsByGuildIds = set instanceof Object ? set : value2;
}
}
this.syncWith([UserSettingsProtoStore], handleUserSettingsProtoStoreChange_51442);
}
function value_51517() { // fn#51517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:15340, offset: 0x0123aa40, size: 48 bytes, params: 1, frame: 4
const value = environment.__proto__;
return env1_28.pendingUsages.length > 0 || env1_28.emojiReactionPendingUsages.length > 0;
}
function get_51518() { // fn#51518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:15462, offset: 0x0123aa70, size: 15 bytes, params: 1, frame: 1
return env1_28.expandedSectionsByGuildIds;
}
function get_51520() { // fn#51520, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:15585, offset: 0x0123aa7f, size: 53 bytes, params: 1, frame: 11
let value = environment.__proto__;
value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
value = value.getDefaultDiversitySurrogate();
return value ?? '';
}
function value_51523(a0) { // fn#51523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:15837, offset: 0x0123aab4, size: 60 bytes, params: 2, frame: 13
const loadSavedEmojisBinding = loadSavedEmojis;
const value2 = undefined;
loadSavedEmojisBinding();
const r3 = a0 == null ? value2 : env1_37[a0];
return (r3 == null ? value2 : r3.emojis) ?? env1_32;
}
function value_51524(a0) { // fn#51524, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:15977, offset: 0x0123aaf0, size: 62 bytes, params: 2, frame: 13
const loadSavedEmojisBinding = loadSavedEmojis;
const value2 = undefined;
loadSavedEmojisBinding();
const r3 = a0 == null ? value2 : env1_37[a0];
return (r3 == null ? value2 : r3.hiddenEmojiIds) ?? env1_33;
}
function value_51525(a0) { // fn#51525, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:16127, offset: 0x0123ab2e, size: 49 bytes, params: 2, frame: 12
const loadSavedEmojisBinding = loadSavedEmojis;
const value2 = undefined;
loadSavedEmojisBinding();
const property = env1_37[a0];
return (property == null ? value2 : property.usableEmojis) ?? env1_32;
}
function value_51527(a0) { // fn#51527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:16314, offset: 0x0123ab5f, size: 32 bytes, params: 2, frame: 11
loadSavedEmojis();
return env1_41.get(a0);
}
function value_51528(a0, a1, a2, a3, a4) { // fn#51528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:16397, offset: 0x0123ab7f, size: 598 bytes, params: 6, frame: 29
var r11;
var r2;
var config;
var boostFavorites;
var boostCapitalizedWords;
var boostAtEnd;
var boostsIgnoreDisambiguators;
var RegExp;
var value10;
var prototype;
var value11;
var regExp;
var value12;
var value13;
var value14;
var value15;
var value16;
var value17;
var value18;
var value19;
var value20;
var test;
let value = a0;
const env0_0 = a3;
const env0_1 = a4;
const value2 = a1.toLowerCase();
const value4 = (importDefault(4100) /* metro dependency 4100: RegexUtils */).escape(value2);
if (value.length > 0) {
config = (importDefault(6581) /* metro dependency 6581: EmojiSearchRankingTweaksExperiment */).getConfig({location: 'getSearchResultsOrder'});
boostFavorites = config.boostFavorites;
boostCapitalizedWords = config.boostCapitalizedWords;
boostAtEnd = config.boostAtEnd;
boostsIgnoreDisambiguators = config.boostsIgnoreDisambiguators;
RegExp = global.RegExp;
value10 = '^' + value4;
prototype = RegExp.prototype;
value11 = Object.create(prototype, {constructor: {value: RegExp}});
regExp = new RegExp(value10, 'i');
value12 = regExp instanceof Object ? regExp : value11;
RegExp = global.RegExp;
value13 = '' + value4 + '$';
prototype = RegExp.prototype;
value14 = Object.create(prototype, {constructor: {value: RegExp}});
regExp = new RegExp(value13, 'i');
value15 = regExp instanceof Object ? regExp : value14;
RegExp = global.RegExp;
value16 = '(^|_|[A-Z])' + value4 + 's?([A-Z]|_|$)';
prototype = RegExp.prototype;
value17 = Object.create(prototype, {constructor: {value: RegExp}});
regExp = new RegExp();
value18 = regExp instanceof Object ? regExp : value17;
RegExp = global.RegExp;
value19 = '(^|_|[A-Z])' + value4 + 's?([A-Z]|_|$)|(^|_|[a-z])' + (importDefault(4100) /* metro dependency 4100: RegexUtils */).escape(value2.slice(0,
1).toUpperCase() + value2.slice(1)) + 's?([A-Z]|_|$)';
prototype = RegExp.prototype;
value20 = Object.create(prototype, {constructor: {value: RegExp}});
regExp = new RegExp();
r11 = boostCapitalizedWords ? regExp instanceof Object ? regExp : value20 : value18;
test = r11.test;
var env0_6 = test.bind(r11);
test = value12.test;
var env0_7 = test.bind(value12);
test = value15.test;
var env0_8 = test.bind(value15);
value = (importDefault(22) /* metro dependency 22 */).orderBy(value, [_fun51529, function(a0) {
return a0.names != null ? a0.names[0] : a0.name;
}], ['desc', 'asc']);
r2 = value;
} else {
r2 = value;
}
return a2 > 0 ? r2.slice(0, a2) : r2;
}
function value_51531({channel, query, count, intention, includeExternalGuilds, matchComparator, showOnlyUnicode}) { // fn#51531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:17393, offset: 0x0123af55, size: 385 bytes, params: 2, frame: 26
var object2;
var environment;
var r2;
var RegExp;
var regExp;
count = count === undefined ? 0 : count;
if (includeExternalGuilds !== undefined) {
}
let value = environment.__proto__;
loadSavedEmojis();
if (matchComparator != null) {
r2 = matchComparator;
} else {
RegExp = global.RegExp;
regExp = new RegExp('' + (importDefault(4100) /* metro dependency 4100: RegexUtils */).escape(query.toLowerCase().replaceAll(RegExp('[ _]',
'g'), '')), 'i');
r2 = value_51531R;
}
value = env1_41.get(channel != null ? channel.getGuildId() : null);
const value11 = value.nameMatchesChain(r2).reduce(_fun51533, {unlocked: [], locked: []});
object2 = {};
object2.unlocked = this.getSearchResultsOrder(value11.unlocked, query, count, intention, value);
object2.locked = this.getSearchResultsOrder(value11.locked, query, 0, intention, value);
return object2;
}
function value_51535(a0) { // fn#51535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:18258, offset: 0x0123b1e1, size: 81 bytes, params: 2, frame: 15
const value = environment.__proto__;
const loadSavedEmojisBinding = loadSavedEmojis;
const value2 = undefined;
loadSavedEmojisBinding();
const property = getEmojiToGroupId()[a0];
return property != null ? (env1_37[property] == null ? value2 : env1_37[property].getEmoji(a0)) ?? value2 : value2;
}
function value_51536(a0) { // fn#51536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:18451, offset: 0x0123b232, size: 60 bytes, params: 2, frame: 12
var r0;
var value;
if (a0 == null) {
value = environment.__proto__;
r0 = env1_31;
} else {
value = environment.__proto__;
loadSavedEmojis();
value = env1_41.get(a0);
value = value.getTopEmojiWithoutFetchingLatest(a0);
r0 = value;
}
return r0;
}
function value_51537(a0) { // fn#51537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:18579, offset: 0x0123b26e, size: 58 bytes, params: 2, frame: 12
var r0;
var value;
if (a0 == null) {
value = environment.__proto__;
r0 = env1_31;
} else {
value = environment.__proto__;
loadSavedEmojis();
value = env1_41.get(a0);
value = value.getNewlyAddedEmojiForGuild(a0);
r0 = value;
}
return r0;
}
function value_51539() { // fn#51539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:18771, offset: 0x0123b2be, size: 67 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
loadSavedEmojis();
return (importDefault(21) /* metro dependency 21: SnowflakeUtils */).keys(env1_37).some(_fun51540);
}
function value_51541(a0) { // fn#51541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:18895, offset: 0x0123b322, size: 48 bytes, params: 2, frame: 11
let value = environment.__proto__;
value = env1_41.get(a0);
return value != null && value.favoriteEmojisWithoutFetchingLatest.length > 0;
}
function _fun51436() { // fn#51436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:4167, offset: 0x01238914, size: 57 bytes, params: 1, frame: 15
var environment;
const value = environment.__proto__.__proto__.__proto__;
return env3_1(env3_2[30]).timeAsync('💾', 'loadSavedEmojis', _fun51437);
}
function isFavoriteEmojiWithoutFetchingLatest(a0) { // fn#51470, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:5172, owner: EmojiDisambiguations.isFavoriteEmojiWithoutFetchingLatest, offset: 0x0123988a, size: 130 bytes, params: 2, frame: 14
const value = a0;
if (value == null) {
return false;
}
const binding = env0_0;
const favoriteNamesAndIds = binding.rebuildFavoriteEmojisWithoutFetchingLatest().favoriteNamesAndIds;
if (value.id != null) {
return favoriteNamesAndIds.has(value.id);
}
const defaultImport = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
return favoriteNamesAndIds.has((defaultImport.convertSurrogateToBase(value.surrogates) ?? value).name);
}
function disambiguateEmoji(a0) { // fn#51471, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:5451, owner: EmojiDisambiguations.disambiguateEmoji, offset: 0x0123990c, size: 432 bytes, params: 2, frame: 21
var r3;
var object2;
var value7;
var newlyAddedEmoji;
let value = a0;
const name = value.name;
let binding = env0_1;
const value3 = binding.get(name);
const value4 = 0;
const r10 = value3 ?? value4;
binding = env0_1;
binding.set(name, r10 + 1);
if (r10 > value4) {
object2 = {};
copyDataProperties(object2, value, undefined);
object2['name'] = '' + name + '~' + r10;
object2['originalName'] = name;
r3 = object2;
} else {
r3 = value;
}
binding = env0_0;
const emojisByName = binding.emojisByName;
emojisByName.set(r3.name, r3);
const emojisById = binding.emojisById;
emojisById.set(r3.id, r3);
const customEmojis = binding.customEmojis;
customEmojis.set(r3.name, r3);
const guildId = value.guildId;
let customEmojisByGroup = binding.customEmojisByGroup;
const value6 = customEmojisByGroup.has(guildId);
customEmojisByGroup = env0_0.customEmojisByGroup;
if (value6) {
value7 = customEmojisByGroup.get(guildId);
if (value7 != null) {
value7.push(r3);
}
} else {
customEmojisByGroup.set(guildId, [r3]);
}
const defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
if (defaultImport.compare(value.id, env2_30) >= value4) {
newlyAddedEmoji = env0_0.newlyAddedEmoji;
value = newlyAddedEmoji.has(guildId);
newlyAddedEmoji = env0_0.newlyAddedEmoji;
if (value) {
value = newlyAddedEmoji.get(guildId);
if (value != null) {
value.push(r3);
}
} else {
newlyAddedEmoji.set(guildId, [r3]);
}
}
env0_0.disambiguatedEmoji.push(r3);
}
function disambiguateEmoticon(a0) { // fn#51472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:5984, owner: EmojiDisambiguations.disambiguateEmoticon, offset: 0x01239abc, size: 119 bytes, params: 2, frame: 16
var binding;
var push;
var value2;
var defaultImport;
var escape;
var set;
let emoticonsByName = env0_0.emoticonsByName;
const has = emoticonsByName.has;
let name = a0.name;
if (!Reflect.apply(has, emoticonsByName, [name])) {
binding = env0_2;
push = binding.push;
value2 = environment.__proto__.__proto__;
defaultImport = importDefault(4100) /* metro dependency 4100: RegexUtils */;
escape = defaultImport.escape;
name = a0.name;
Reflect.apply(push, binding, [Reflect.apply(escape, defaultImport, [name])]);
emoticonsByName = env0_0.emoticonsByName;
set = emoticonsByName.set;
name = a0.name;
Reflect.apply(set, emoticonsByName, [name, a0]);
}
}
function _fun51473(a0) { // fn#51473, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:6110, offset: 0x01239b33, size: 189 bytes, params: 2, frame: 17
const env0_0 = a0;
a0.names.slice(1).forEach(_fun51474);
let binding = env0_1;
const value2 = binding.get(a0.name);
const value3 = 0;
const r2 = value2 ?? value3;
(importDefault(44) /* metro dependency 44 */)(value3 === r2, 'Expected existing count to be 0');
binding = env0_1;
binding.set(a0.name, r2 + 1);
binding = env0_0;
const emojisByName = binding.emojisByName;
emojisByName.set(a0.name, a0);
binding.disambiguatedEmoji.push(a0);
}
function addGuildEmoji(a0) { // fn#51475, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:6372, owner: EmojiDisambiguations.addGuildEmoji, offset: 0x01239c19, size: 112 bytes, params: 2, frame: 19
let value = a0;
const property = env2_37[value ?? NULL_STRING_GUILD_ID];
if (property != null) {
value = importDefault(22) /* metro dependency 22 */;
value.each(property.usableEmojis, disambiguateEmoji);
value = importDefault(22) /* metro dependency 22 */;
value.each(property.emoticons, disambiguateEmoticon);
}
}
function _fun51476({id}, {id}) { // fn#51476, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:6709, offset: 0x01239c89, size: 55 bytes, params: 3, frame: 13
const value = environment.__proto__.__proto__;
return (importDefault(21) /* metro dependency 21: SnowflakeUtils */).compare(id, id);
}
function _fun51477(a0) { // fn#51477, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:6823, offset: 0x01239cc0, size: 34 bytes, params: 2, frame: 11
if (a0 !== env0_0.guildId) {
addGuildEmoji(a0);
}
}
function _fun51486(a0) { // fn#51486, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:7860, offset: 0x01239e94, size: 82 bytes, params: 2, frame: 12
var r0;
var value;
var binding;
if (a0.id != null) {
binding = env0_0;
r0 = binding.getById(a0.id);
} else {
value = environment.__proto__.__proto__;
value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
value = value.getByName(a0.name);
r0 = value;
}
return r0;
}
function _fun51492(a0) { // fn#51492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:9527, offset: 0x0123a176, size: 65 bytes, params: 2, frame: 13
var r0;
let value = env0_0.getById(a0);
if (value != null) {
r0 = value;
} else {
value = environment.__proto__.__proto__;
value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
value = value.getByName(a0);
r0 = value;
}
return r0;
}
function _fun51495(a0) { // fn#51495, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:10135, offset: 0x0123a21c, size: 44 bytes, params: 2, frame: 12
var r0;
const value2 = env0_0.has(a0);
if (value2) {
r0 = !value2;
} else {
env0_0.add(a0);
r0 = true;
}
return r0;
}
function _fun51497(a0) { // fn#51497, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:10380, offset: 0x0123a30a, size: 88 bytes, params: 2, frame: 17
var r0;
var getByName;
var defaultImport;
let value = env0_0.getById(a0);
if (value != null) {
r0 = value;
} else {
value = environment.__proto__.__proto__;
value = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
getByName = value.getByName;
defaultImport = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
value = Reflect.apply(getByName, value, [defaultImport.convertSurrogateToName(a0, false)]);
r0 = value;
}
return r0;
}
function _fun51498(a0) { // fn#51498, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:10502, offset: 0x0123a362, size: 30 bytes, params: 2, frame: 11
if (a0 != null) {
env0_1.push(a0);
}
}
function _fun51500({id}) { // fn#51500, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:10609, offset: 0x0123a380, size: 30 bytes, params: 2, frame: 11
const binding = env0_2;
return !binding.includes(id);
}
function _fun51504({names, name}) { // fn#51504, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:10987, offset: 0x0123a428, size: 175 bytes, params: 2, frame: 19
var r0;
var r1;
let value = names != null;
if (value) {
value = environment.__proto__.__proto__;
value = importDefault(22) /* metro dependency 22 */;
value = value.some(names, env0_0);
r0 = value;
} else {
r0 = value;
}
const r2 = name != null && env0_0(name);
value = name != null;
if (value) {
value = environment.__proto__.__proto__;
value = importDefault(22) /* metro dependency 22 */;
value = value.some((importDefault(6547) /* metro dependency 6547: EmojiTerms */).getTermsForEmoji(name),
env0_0);
r1 = value;
} else {
r1 = value;
}
r0 = !r0 ? r2 : r0;
r0 = !r0 ? r1 : r0;
return r0;
}
function _fun51529(a0) { // fn#51529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:16940, offset: 0x0123add5, size: 350 bytes, params: 2, frame: 22
var r8;
var r7;
var r4;
var r5;
var r1;
var r0;
var value4;
var value8;
var value9;
var value11;
let value = a0.uniqueName != null;
const r13 = value ? a0.names[0] : boostsIgnoreDisambiguators ? a0.name.split('~')[0] : a0.name;
const r6 = value ? r13 : a0.id;
value = 0;
if (r13 == null) {
r0 = value;
} else if (r6 == null) {
r0 = value;
} else {
value4 = r13.toLowerCase();
r8 = value4 !== env0_2 ? value : 4;
r7 = env0_6(value4) || env0_6(r13) ? 2 : value;
value8 = env0_7(r13);
value9 = 1;
r5 = value8 ? value9 : boostAtEnd && env0_8(r13) ? 0.75 : value;
r4 = boostFavorites && env0_1.isFavoriteEmojiWithoutFetchingLatest(a0) ? 0.5 : value;
value = value9 + r8 + r7 + r5 + r4;
value11 = environment.__proto__.__proto__;
r4 = importAll === EmojiIntention.REACTION ? env2_43.getScore(r6) : env2_42.getScore(r6);
if (r4 == null) {
r1 = value;
} else {
value *= r4 / 100;
r1 = value;
}
r0 = r1;
}
return r0;
}
function value_51531R(a0) { // fn#51532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:17637, owner: value_51531.r, offset: 0x0123b0d6, size: 42 bytes, params: 2, frame: 15
const binding = env0_4;
return binding.test(a0.replaceAll('_', ''));
}
function _fun51533(a0, a1) { // fn#51533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:17755, offset: 0x0123b100, size: 198 bytes, params: 3, frame: 17
const EmojiTypes = (require(3800) /* metro dependency 3800: EmojiTypes */).EmojiTypes;
const value = environment.__proto__.__proto__;
const emojiUnavailableReason = (importDefault(3801) /* metro dependency 3801: EmojiUtils */).getEmojiUnavailableReason({emoji: a1,
channel: channel, intention: intention, forceIncludeExternalGuilds: includeExternalGuilds});
const PREMIUM_LOCKED = EmojiDisabledReasons.PREMIUM_LOCKED;
if (emojiUnavailableReason !== PREMIUM_LOCKED) {
if (!(emojiUnavailableReason != null || showOnlyUnicode && a1.type !== EmojiTypes.UNICODE)) {
a0.unlocked.push(a1);
}
} else if (showOnlyUnicode) {
if (!(emojiUnavailableReason != null || showOnlyUnicode && a1.type !== EmojiTypes.UNICODE)) {
a0.unlocked.push(a1);
}
} else {
a0.locked.push(a1);
}
return a0;
}
function _fun51540(a0) { // fn#51540, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:18830, offset: 0x0123b301, size: 33 bytes, params: 2, frame: 2
return env2_37[a0].usableEmojis.length > 0;
}
function _fun51437() { // fn#51437, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:4216, offset: 0x0123894d, size: 45 bytes, params: 1, frame: 11
const value = environment.__proto__.__proto__.__proto__.__proto__;
return env4_1(env4_2[31]).getAsync(env1_0);
}
function _fun51474(a0) { // fn#51474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6718:6146, offset: 0x01239bf0, size: 41 bytes, params: 2, frame: 13
const unicodeAliases = env1_0.unicodeAliases;
return unicodeAliases.set(a0, env0_0.name);
}