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

867 lines
37 KiB
TypeScript

/* Metro module 11049; source: modules/stickers/StickersHooks.tsx; dependencies: [5, 57, 31, 1867, 3969, 4896, 1878, 6582, 6583, 661, 566, 11050, 3829, 4643, 9077, 4785, 8249, 1244, 3789, 9767, 6943, 2] */
function _fun84552(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#84552, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:6, offset: 0x01f4f93c, size: 476 bytes, params: 8, frame: 23
let env0_0 = require;
const _arrayLikeToArray_84555 = 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 = useFavoriteStickerIds;
const closure2 = function() {
var value2 = useFavoriteStickerIds();
var env0_0 = value2;
return require(dependencyMap[10]).useStateFromStoresArray([StickersStore], _fun84558, [value2]);
};
const closure3 = useLatestFrecentStickerIds;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const env0_4 = importDefault(57) /* metro dependency 57 */;
const env0_5 = importAll(31) /* metro dependency 31 */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const selectedGuildStore = importDefault(3969) /* metro dependency 3969: SelectedGuildStore */;
const sortedGuildStore = importDefault(4896) /* metro dependency 4896: SortedGuildStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const stickersPersistedStore = importDefault(6582) /* metro dependency 6582: StickersPersistedStore */;
const stickersStore = importDefault(6583) /* metro dependency 6583: StickersStore */;
const env0_12 = (require(661) /* metro dependency 661: Constants */).Permissions;
const closure4 = useFetchStickerPacks;
const env0_14 = [];
const closure5 = useStickerPackCategories;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/stickers/StickersHooks.tsx');
exports.useFetchStickerPack = useFetchStickerPack;
exports.useShouldAnimateSticker = useShouldAnimateSticker;
exports.useStickersGrid = useStickersGrid;
exports.useHasSendableSticker = function() {
return true;
};
exports.useFetchStickerPacks = closure4;
exports.useFavoriteStickerIds = closure;
exports.useFavoriteStickers = closure2;
exports.useLatestFrecentStickerIds = closure3;
exports.useLatestFrecentStickers = function() {
var value2 = useLatestFrecentStickerIds();
var env0_0 = value2;
return require(dependencyMap[10]).useStateFromStoresArray([StickersStore], _fun84590, [value2]);
};
exports.useStickerPackCategories = closure5;
exports.useStickerForRenderableSticker = useStickerForRenderableSticker;
exports.useFilteredStickerPackCategories = useFilteredStickerPackCategories;
}
function _createForOfIteratorHelperLoose_84553(a0, a1) { // fn#84553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:214, offset: 0x01f4fb18, size: 372 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 _fun84554;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_84555(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_84555(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_84555(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun84554;
}
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 useFavoriteStickerIds() { // fn#84556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:1214, offset: 0x01f4fc8c, size: 66 bytes, params: 1, frame: 13
const value2 = undefined;
const frecencyUserSettingsHooksModule = require(9767) /* metro dependency 9767: FrecencyUserSettingsHooks */;
const useFrecencySettings = frecencyUserSettingsHooksModule.useFrecencySettings;
const favoriteStickers = Reflect.apply(useFrecencySettings, frecencyUserSettingsHooksModule, []).favoriteStickers;
return (favoriteStickers == null ? value2 : favoriteStickers.stickerIds) ?? env0_14;
}
function useFavoriteStickers() { // fn#84557, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:1355, offset: 0x01f4fcce, size: 81 bytes, params: 1, frame: 17
return (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([StickersStore], _fun84558,
[useFavoriteStickerIds()]);
}
function useLatestFrecentStickerIds() { // fn#84561, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:1595, offset: 0x01f4fdba, size: 125 bytes, params: 1, frame: 16
const value2 = undefined;
const value3 = (require(9767) /* metro dependency 9767: FrecencyUserSettingsHooks */).useFrecencySettings();
return (value3 == null || value3.stickerFrecency == null ? value2 : value3.stickerFrecency.stickers) == null ? env0_14 : global.Object.keys(value3 == null || value3.stickerFrecency == null ? value2 : value3.stickerFrecency.stickers);
}
function useFetchStickerPacks() { // fn#84562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:1149, offset: 0x01f4fe37, size: 35 bytes, params: 1, frame: 13
env0_5.useEffect(_fun84563, []);
}
function useStickerPackCategories(a0) { // fn#84564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:1853, offset: 0x01f4fe7f, size: 221 bytes, params: 2, frame: 23
const env0_0 = a0;
const value2 = useFavoriteStickers();
const {packs,
frequentlyUsedStickers} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([StickersStore,
StickersPersistedStore], function() {
var object = {};
object.packs = StickersStore.getPremiumPacks();
object.frequentlyUsedStickers = StickersPersistedStore.stickerFrecencyWithoutFetchingLatest.frequently;
return object;
}, []);
const currentUser = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
return UserStore.getCurrentUser();
});
const value4 = _fun84567(a0);
return value4.useMemo(_fun84574, [packs, value2, frequentlyUsedStickers, value4, currentUser, a0]);
}
function useFetchStickerPack(a0) { // fn#84578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:3931, offset: 0x01f50561, size: 112 bytes, params: 2, frame: 17
const env0_0 = a0;
useFetchStickerPacks();
env0_5.useEffect(_fun84580, [a0, (require(566) /* metro dependency 566: flux */).useStateFromStores([StickersStore],
function() {
return StickersStore.hasLoadedStickerPacks;
})]);
}
function useShouldAnimateSticker(a0) { // fn#84581, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:4143, offset: 0x01f50635, size: 70 bytes, params: 2, frame: 14
const AnimateStickers = (require(3829) /* metro dependency 3829: UserSettings */).AnimateStickers;
return (require(4643) /* metro dependency 4643: StickersUtils */).shouldAnimateSticker(AnimateStickers.useSetting(),
a0);
}
function useStickersGrid({collapsedStickersCategories, filteredStickers, listPaddingRight, listWidth, stickerNodeMargin, stickerNodeWidth, stickersCategories}) { // fn#84582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:4255, offset: 0x01f5067b, size: 168 bytes, params: 2, frame: 20
listPaddingRight = listPaddingRight === undefined ? 0 : listPaddingRight;
listWidth = listWidth === undefined ? 0 : listWidth;
stickerNodeMargin = stickerNodeMargin === undefined ? 0 : stickerNodeMargin;
return stickerNodeWidth.useMemo(_fun84583, [collapsedStickersCategories, filteredStickers, listPaddingRight,
listWidth, stickerNodeMargin, stickerNodeWidth, stickersCategories]);
}
function useLatestFrecentStickers() { // fn#84589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:6337, offset: 0x01f50ce3, size: 81 bytes, params: 1, frame: 17
return (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([StickersStore], _fun84590,
[useLatestFrecentStickerIds()]);
}
function useStickerForRenderableSticker(a0) { // fn#84593, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:6608, offset: 0x01f50d61, size: 361 bytes, params: 2, frame: 25
const value = a1;
const env0_0 = a0;
const r8 = value !== undefined ? value : false;
const env0_4 = undefined;
let env0_5 = undefined;
const stickerById = (require(566) /* metro dependency 566: flux */).useStateFromStores([StickersStore], _fun84594);
let binding = env0_5;
let useState = binding.useState;
const value2 = Reflect.apply(useState, binding, [true]);
const binding2 = env0_4;
const value3 = binding2(value2, 2);
const property = value3[0];
const env0_2 = value3[1];
useState = binding.useState;
const value4 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property2 = value4[0];
const env0_3 = value4[1];
const r1 = (require(4643) /* metro dependency 4643: StickersUtils */).isGuildSticker(a0) || (require(4643) /* metro dependency 4643: StickersUtils */).isStandardSticker(a0);
binding = env0_5;
env0_5 = binding.useRef({hasFetched: property2, isReturnable: r1, renderableSticker: a0, shouldFetch: property,
stickersStoreDefinition: stickerById});
binding.useEffect(_fun84595);
binding.useEffect(_fun84596, [r8]);
return r1 ? [a0, property2] : [stickerById ?? null, property2];
}
function useFilteredStickerPackCategories(a0) { // fn#84599, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:7287, offset: 0x01f50fb4, size: 55 bytes, params: 2, frame: 14
return env0_5.useMemo(_fun84600, [useStickerPackCategories(a0)]);
}
function _fun84558() { // fn#84558, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:1462, offset: 0x01f4fd1f, size: 45 bytes, params: 1, frame: 12
return env0_0.map(function(a0) {
return StickersStore.getStickerById(a0);
}).filter(_fun84560);
}
function _fun84563() { // fn#84563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:1167, offset: 0x01f4fe5a, size: 37 bytes, params: 1, frame: 11
const value = environment.__proto__;
(require(11050) /* metro dependency 11050: StickersActionCreators */).fetchStickerPacks();
}
function _fun84567(a0) { // fn#84567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:2142, offset: 0x01f4ff8b, size: 212 bytes, params: 2, frame: 23
const env0_0 = a0;
const allGuildStickers = (require(566) /* metro dependency 566: flux */).useStateFromStores([StickersStore],
function() {
return StickersStore.getAllGuildStickers();
});
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([SortedGuildStore,
GuildStore], _fun84569, []);
const currentUser = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
return UserStore.getCurrentUser();
});
return env1_5.useMemo(_fun84572, [allGuildStickers, value2, currentUser, a0]);
}
function _fun84574() { // fn#84574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:3122, offset: 0x01f502ef, size: 352 bytes, params: 1, frame: 21
const packsBinding = packs;
const value3 = undefined;
const value4 = packsBinding.map((require(4643) /* metro dependency 4643: StickersUtils */).createStickerPackCategory);
let object2 = {};
const StickerCategoryTypes = (require(4785) /* metro dependency 4785: StickersTypes */).StickerCategoryTypes;
let FAVORITE = StickerCategoryTypes.FAVORITE;
object2.type = FAVORITE;
FAVORITE = StickerCategoryTypes.FAVORITE;
object2.id = FAVORITE;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
object2.name = Reflect.apply(string, intl, [t.y3LQCG]);
object2.stickers = env0_1;
const items2 = [object2];
object2 = {};
let RECENT = StickerCategoryTypes.RECENT;
object2.type = RECENT;
RECENT = StickerCategoryTypes.RECENT;
object2.id = RECENT;
object2.name = (require(1244) /* metro dependency 1244: indexNative */).intl.string(t['6hjpXW']);
let r4 = frequentlyUsedStickers == null ? value3 : frequentlyUsedStickers.filter(_fun84575);
r4 = r4 ?? [];
object2.stickers = r4;
items2[1] = object2;
arraySpread(items2, value4, arraySpread(items2, env0_5, 2, intl), intl);
return items2;
}
function _fun84580() { // fn#84580, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:4041, offset: 0x01f505e0, size: 85 bytes, params: 1, frame: 13
var value5;
if (hasLoadedStickerPacks && StickersStore.getStickerPack(env0_0) == null) {
value5 = environment.__proto__;
(require(11050) /* metro dependency 11050: StickersActionCreators */).fetchStickerPack(env0_0);
}
}
function _fun84583() { // fn#84583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:4417, offset: 0x01f50723, size: 575 bytes, params: 1, frame: 31
var environment;
var r6;
var r0;
var closure;
var sendable;
var length;
var value8;
const StickerCategoryTypes = (require(4785) /* metro dependency 4785: StickersTypes */).StickerCategoryTypes;
var sendableWithPremium;
var value9;
var _createForOfIteratorHelperLoose_84553Binding;
var stickersCategoriesBinding;
var value10;
var value11;
var value12;
var done;
var value13;
var stickers;
var type;
var EMPTY_GUILD_UPSELL;
var binding;
var collapsedStickersCategoriesBinding;
var has;
var id;
var value14;
var value15;
let Math = global.Math;
let floor = Math.floor;
const listWidthBinding = listWidth;
const listPaddingRightBinding = listPaddingRight;
const value2 = listWidthBinding - listPaddingRightBinding;
const stickerNodeMarginBinding = stickerNodeMargin;
const value3 = value2 + stickerNodeMarginBinding;
const stickerNodeWidthBinding = stickerNodeWidth;
const value4 = Reflect.apply(floor, Math, [value3 / (stickerNodeWidthBinding + stickerNodeMarginBinding)]);
Math = global.Math;
floor = Math.floor;
const Math2 = global.Math;
const value7 = Reflect.apply(floor, Math, [Math2.max(stickerNodeMarginBinding,
(listWidthBinding - listPaddingRightBinding - stickerNodeWidthBinding * value4) / (value4 - 1))]);
const items2 = [];
let env0_4 = 0;
let env0_5 = 0;
if (listWidthBinding !== 0) {
closure = addGridSection;
if (filteredStickers == null) {
value9 = environment.__proto__;
_createForOfIteratorHelperLoose_84553Binding = _createForOfIteratorHelperLoose_84553;
stickersCategoriesBinding = stickersCategories;
value10 = undefined;
value11 = _createForOfIteratorHelperLoose_84553Binding(stickersCategoriesBinding);
value12 = value11();
done = value12.done;
if (!done) {
r6 = value12;
while (true) {
value13 = r6.value;
stickers = value13.stickers;
length = stickers.length;
if (!(length > 0)) {
type = value13.type;
EMPTY_GUILD_UPSELL = StickerCategoryTypes.EMPTY_GUILD_UPSELL;
if (type !== EMPTY_GUILD_UPSELL) {
break;
}
items2[env0_5] = 0;
binding = env0_5;
env0_5 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
break;
}
binding = env0_4;
env0_4 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
stickers = value13.stickers;
type = value13.type;
if (collapsedStickersCategories == null) {
r0 = value10;
continue;
}
collapsedStickersCategoriesBinding = collapsedStickersCategories;
has = collapsedStickersCategoriesBinding.has;
id = value13.id;
value14 = Reflect.apply(has, collapsedStickersCategoriesBinding, [id]);
r0 = value14;
closure(stickers, type, r0 === true);
value15 = value11();
done = value15.done;
if (done) {
break;
}
r6 = value15;
continue;
}
}
} else {
sendable = filteredStickers.sendable;
length = sendable.length;
if (length > 0) {
sendable = filteredStickers.sendable;
value8 = environment.__proto__;
closure(sendable, StickerCategoryTypes.SEARCH_RESULTS);
}
sendableWithPremium = filteredStickers.sendableWithPremium;
length = sendableWithPremium.length;
if (length > 0) {
sendableWithPremium = filteredStickers.sendableWithPremium;
value = environment.__proto__;
closure(sendableWithPremium, StickerCategoryTypes.SEARCH_RESULTS);
}
}
}
return {rowCount: env0_4, rowCountBySection: items2, stickersGrid: [], gutterWidth: value7, columnCounts: []};
}
function _fun84590() { // fn#84590, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:6454, offset: 0x01f50d34, size: 45 bytes, params: 1, frame: 12
return env0_0.map(function(a0) {
return StickersStore.getStickerById(a0);
}).filter(function(a0) {
return a0 !== undefined;
});
}
function _fun84594() { // fn#84594, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:6659, offset: 0x01f50eca, size: 32 bytes, params: 1, frame: 11
return StickersStore.getStickerById(env0_0.id);
}
function _fun84596() { // fn#84596, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:6989, offset: 0x01f50eea, size: 29 bytes, params: 1, frame: 11
env1_3(_fun84598)();
}
function _fun84600() { // fn#84600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:7343, offset: 0x01f50feb, size: 33 bytes, params: 1, frame: 13
return env0_0.filter(_fun84601, []);
}
function _fun84560(a0) { // fn#84560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:1506, offset: 0x01f4fd63, size: 87 bytes, params: 2, frame: 15
var r1;
var r0;
var isGuildSticker2;
let value = a0 != null;
if (value) {
value = environment.__proto__.__proto__;
isGuildSticker2 = (require(4643) /* metro dependency 4643: StickersUtils */).isGuildSticker(a0);
if (isGuildSticker2) {
value = require(4643) /* metro dependency 4643: StickersUtils */;
value = value.isAvailableGuildSticker(a0);
r1 = value;
} else {
r1 = !isGuildSticker2;
}
r0 = r1;
} else {
r0 = value;
}
return r0;
}
function _fun84569() { // fn#84569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:2259, offset: 0x01f50072, size: 46 bytes, params: 1, frame: 12
var environment;
const value = environment.__proto__.__proto__;
SortedGuildStore.getFlattenedGuildIds().forEach(_fun84570);
return [];
}
function _fun84572() { // fn#84572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:2451, offset: 0x01f500e2, size: 494 bytes, params: 1, frame: 25
var r6;
var r1;
var value6;
var name;
var id;
var value7;
var value8;
var length;
var value9;
var push;
const StickerCategoryTypes = (require(4785) /* metro dependency 4785: StickersTypes */).StickerCategoryTypes;
var GUILD;
var value10;
var binding;
var getGuild;
var value12;
var moduleValue;
var canManageAllExpressions;
var index;
const items2 = [];
const _createForOfIteratorHelperLoose_84553Binding = _createForOfIteratorHelperLoose_84553;
const value3 = undefined;
const value4 = _createForOfIteratorHelperLoose_84553Binding(env0_2);
const value5 = value4();
let done = value5.done;
if (!done) {
r6 = value5;
while (true) {
value6 = r6.value;
name = value6.name;
id = value6.id;
value7 = allGuildStickers.get(id);
value8 = value7 != null;
if (value8) {
length = value7.length;
value9 = length !== 0;
r1 = value9;
} else {
r1 = value8;
}
if (!r1) {
continue;
}
push = items2.push;
GUILD = StickerCategoryTypes.GUILD;
Reflect.apply(push, items2, [{type: GUILD, id: id, name: name, stickers: value7}]);
value10 = value4();
done = value10.done;
if (done) {
break;
}
r6 = value10;
continue;
}
}
r1 = env0_0 == null ? value3 : env0_0.getGuildId();
if (r1 != null) {
getGuild = GuildStore.getGuild;
binding = env0_0;
value12 = Reflect.apply(getGuild, GuildStore, [binding.getGuildId()]);
moduleValue = require(9077) /* metro dependency 9077: useManageResourcePermissions */;
canManageAllExpressions = moduleValue.getManageResourcePermissions(value12).canManageAllExpressions;
index = items2.findIndex(_fun84573);
if (index >= 1) {
items2.unshift(items2.splice(index, 1)[0]);
} else {
r1 = index === -1 && value12 != null;
r1 = r1 && canManageAllExpressions;
if (r1) {
items2.unshift({type: StickerCategoryTypes.EMPTY_GUILD_UPSELL, id: value12.id, name: value12.name,
stickers: []});
}
}
if (currentUser != null) {
(importAll(3789) /* metro dependency 3789: PermissionUtils */).can({permission: Permissions.USE_EXTERNAL_EMOJIS,
user: currentUser, context: env0_0});
}
}
return items2;
}
function _fun84575(a0) { // fn#84575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:3511, offset: 0x01f5044f, size: 247 bytes, params: 2, frame: 21
var environment;
var r0;
var r3;
var r1;
var value3;
var getStickerSendability;
var value6;
const env0_0 = a0;
let value = environment.__proto__.__proto__;
const value2 = undefined;
const stickersUtilsModule = require(4643) /* metro dependency 4643: StickersUtils */;
if (stickersUtilsModule.isGuildSticker(a0)) {
value3 = StickersStore.getStickersByGuildId(a0.guild_id);
r3 = value3 == null ? value2 : value3.some(_fun84576);
r1 = r3 != null && r3;
if (r1) {
value = require(6943) /* metro dependency 6943: StickerSendability */;
getStickerSendability = value.getStickerSendability;
value6 = environment.__proto__;
value = Reflect.apply(getStickerSendability, value, [a0, currentUser, env1_0]);
value = value !== (require(6943) /* metro dependency 6943: StickerSendability */).StickerSendability.NONSENDABLE;
r1 = value;
}
r0 = r1;
} else {
value = stickersUtilsModule;
if (value.isStandardSticker(a0)) {
value = environment.__proto__;
value = packs.some(_fun84577);
r0 = value;
} else {
r0 = value2;
}
}
return r0;
}
function addGridSection(a0, a1) { // fn#84584, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:4552, offset: 0x01f50962, size: 650 bytes, params: 3, frame: 31
var environment;
var r2;
var r10;
var r16;
var id;
var length2;
var moduleValue3;
var value13;
var value14;
var value15;
var value16;
var value17;
var value18;
var value19;
var value20;
var push;
var object2;
var StickerGridItemTypes;
var CREATE_STICKER;
var intl;
var string;
var t;
var value21;
let value = a2;
const env0_0 = a1;
const value2 = undefined;
const r12 = value !== value2 ? value : false;
value = environment.__proto__.__proto__;
const stickersUtilsModule = require(4643) /* metro dependency 4643: StickersUtils */;
const isGuildSticker = stickersUtilsModule.isGuildSticker;
const value3 = 0;
const r4 = Reflect.apply(isGuildSticker, stickersUtilsModule,
[a0[value3]]) ? GuildStore.getGuild(a0[value3].guild_id) : value2;
const useManageResourcePermissionsModule = require(9077) /* metro dependency 9077: useManageResourcePermissions */;
const getManageResourcePermissions = useManageResourcePermissionsModule.getManageResourcePermissions;
const canCreateExpressions = Reflect.apply(getManageResourcePermissions, useManageResourcePermissionsModule,
[r4]).canCreateExpressions;
const guildId = SelectedGuildStore.getGuildId();
const stickersCategoriesBinding = stickersCategories;
const index = stickersCategoriesBinding.findIndex(function({type}) {
return type === require(dependencyMap[15]).StickerCategoryTypes.FAVORITE;
});
const index2 = stickersCategoriesBinding.findIndex(function({type}) {
return type === require(dependencyMap[15]).StickerCategoryTypes.RECENT;
});
let length = a0.length;
const value7 = r4 != null;
if (value7) {
id = r4.id;
r2 = guildId === id;
} else {
r2 = value7;
}
r2 = r2 && canCreateExpressions;
if (r2) {
length2 = a0.length;
moduleValue3 = require(8249) /* metro dependency 8249: GuildBoostingUtils */;
r2 = length2 < moduleValue3.getTotalStickerCountForTier(r4.premiumTier);
}
const r5 = r2 ? typeof length === 'bigint' ? length + 1n : +length + 1 : length;
const Math = global.Math;
const value12 = Math.ceil(r5 / env0_0);
let binding = env0_2;
binding[env0_5] = r12 ? value3 : value12;
if (value3 < value12) {
r10 = value3;
while (true) {
binding = env0_0;
value13 = r10 * binding;
value14 = value13 + binding;
value15 = a0.slice(value13, value14);
value16 = value15.map(_fun84587);
value17 = env0_5 > index2;
if (value17) {
value18 = env0_5 > index;
r16 = value18;
} else {
r16 = value17;
}
if (!r16) {
continue;
}
value19 = r4 != null;
r16 = value19;
if (!r16) {
continue;
}
length = a0.length;
value20 = r5 > length;
r16 = value20;
if (!r16) {
continue;
}
push = value16.push;
object2 = {};
StickerGridItemTypes = (require(4785) /* metro dependency 4785: StickersTypes */).StickerGridItemTypes;
CREATE_STICKER = StickerGridItemTypes.CREATE_STICKER;
object2.type = CREATE_STICKER;
id = r4.id;
object2.guild_id = id;
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
string = intl.string;
t = (require(1244) /* metro dependency 1244: indexNative */).t;
object2.name = Reflect.apply(string, intl, [t['UwF+Cw']]);
object2.gridSectionIndex = env0_5;
object2.rowIndex = env0_4;
length = value16.length;
object2.columnIndex = length;
object2.visibleRowIndex = env0_6;
Reflect.apply(push, value16, [object2]);
if (r12) {
continue;
}
binding = env0_6;
env0_6 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
binding = env0_3;
binding.push(value16);
binding = env0_1;
push = binding.push;
length = value16.length;
Reflect.apply(push, binding, [length]);
binding = env0_4;
env0_4 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
value21 = typeof r10 === 'bigint' ? r10 + 1n : +r10 + 1;
if (value21 < value12) {
r10 = value21;
continue;
}
break;
}
}
binding = env0_5;
env0_5 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
return value2;
}
function* _fun84598() { // fn#84598, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:6997, offset: 0x01f50f12, size: 162 bytes, params: 1, frame: 17
var value3;
var binding;
var binding2;
var property;
var value4;
var fetchSticker;
var id;
var sticker;
var value5;
var value6;
var error;
if (true) {
value = environment.__proto__.__proto__;
var current = env2_5.current;
if (importAll) {
if (current.isReturnable) {
return undefined;
}
if (current.stickersStoreDefinition != null) {
return undefined;
}
if (current.shouldFetch) {
if (current.hasFetched) {
return undefined;
}
dependencyMap(false);
value3 = environment.__proto__.__proto__.__proto__;
try {
binding = env3_0;
} catch (error) {
env2_3(true);
return undefined;
}
try {
binding2 = env3_2;
} catch (error) {
env2_3(true);
return undefined;
}
try {
property = binding2[11];
} catch (error) {
env2_3(true);
return undefined;
}
try {
value4 = binding(property);
} catch (error) {
env2_3(true);
return undefined;
}
try {
fetchSticker = value4.fetchSticker;
} catch (error) {
env2_3(true);
return undefined;
}
try {
id = current.renderableSticker.id;
} catch (error) {
env2_3(true);
return undefined;
}
try {
sticker = Reflect.apply(fetchSticker, value4, [id]);
} catch (error) {
env2_3(true);
return undefined;
}
yield sticker;
try {
value5 = undefined;
value6 = false;
} catch (error) {
env2_3(true);
return undefined;
}
if (value6) {
return value5;
}
env2_3(true);
return undefined;
}
}
}
}
function _fun84601(a0) { // fn#84601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:7357, offset: 0x01f5100c, size: 71 bytes, params: 2, frame: 13
const type = a0.type;
const value = environment.__proto__.__proto__;
const StickerCategoryTypes = (require(4785) /* metro dependency 4785: StickersTypes */).StickerCategoryTypes;
const EMPTY_GUILD_UPSELL = StickerCategoryTypes.EMPTY_GUILD_UPSELL;
return type === EMPTY_GUILD_UPSELL || a0.stickers.length > 0;
}
function _fun84570(a0) { // fn#84570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:2318, offset: 0x01f500a0, size: 48 bytes, params: 2, frame: 11
let value = environment.__proto__.__proto__.__proto__;
value = GuildStore.getGuild(a0);
if (value != null) {
env0_0.push(value);
}
}
function _fun84573({id}) { // fn#84573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:2821, offset: 0x01f502d0, size: 31 bytes, params: 2, frame: 10
const binding = env1_0;
const getGuildId = binding.getGuildId;
return id === Reflect.apply(getGuildId, binding, []);
}
function _fun84577({id}) { // fn#84577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:3770, offset: 0x01f50546, size: 27 bytes, params: 2, frame: 2
return id === env0_0.pack_id;
}
function _fun84587(a0, a1) { // fn#84587, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11235:5042, offset: 0x01f50c52, size: 145 bytes, params: 3, frame: 14
const object2 = {};
let value = environment.__proto__.__proto__.__proto__;
const StickerGridItemTypes = (require(4785) /* metro dependency 4785: StickersTypes */).StickerGridItemTypes;
const STICKER = StickerGridItemTypes.STICKER;
object2.type = STICKER;
object2.sticker = a0;
value = require(4643) /* metro dependency 4643: StickersUtils */;
value = value.isStandardSticker(a0);
object2.packId = value ? a0.pack_id : 'TODO - fix';
value = environment.__proto__;
object2.gridSectionIndex = env1_5;
object2.rowIndex = env1_4;
object2.columnIndex = a1;
object2.visibleRowIndex = env1_6;
object2.category = require;
return object2;
}