/* Metro module 11932; source: modules/guild_progress/native/GuildProgressUtils.tsx; dependencies: [1935, 1867, 3784, 11933, 11927, 661, 4080, 11934, 1962, 11935, 566, 11930, 1244, 21, 2] */ import SnowflakeUtils from '../../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */ import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */ import GuildChannelStore from '../../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */ import PermissionStore from '../../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */ import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */ import GuildProgressStore from '../GuildProgressStore.tsx'; /* Metro dependency 11933 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */ import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as GuildProgressConstantsModule from '../GuildProgressConstants.tsx'; /* Metro dependency 11927 */ function _fun91564(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:6, offset: 0x0206a08d, size: 307 bytes, params: 8, frame: 20 const env0_0 = require; const useIOSCompletionStates2 = useIOSCompletionStates; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/guild_progress/native/GuildProgressUtils.tsx'); exports.MIN_PROGRESS_PERCENT = 3; exports.PROGRESS_BACKGROUND_COLOR = 'rgba(78, 93, 148, 0.3)'; exports.openActionSheet = openActionSheet; exports.hideActionSheet = hideActionSheet_91572; exports.createGuildProgress = createGuildProgress; exports.useIOSCompletionStates = useIOSCompletionStates2; exports.useGuildProgressStep = useGuildProgressStep; exports.useIsEligibleForGuildProgress = useIsEligibleForGuildProgress; function useIOSCompletionStates(a0) { // fn#91565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:214, offset: 0x0206a1c0, size: 459 bytes, params: 2, frame: 23 var r3; var length; var length2; const env0_0 = a0; const value2 = undefined; let useStateFromStores = FluxModule.useStateFromStores; let items2 = [PermissionStore]; const value3 = Reflect.apply(useStateFromStores, FluxModule, [items2, _fun91566]); const value4 = (require(11930) /* metro dependency 11930: GuildProgressHooks */).useGuildPersonalized(a0); const value5 = (require(11930) /* metro dependency 11930: GuildProgressHooks */).useGuildPopulated(a0); const defaultChannel = FluxModule.useStateFromStores([GuildChannelStore], _fun91567); const value6 = (require(11930) /* metro dependency 11930: GuildProgressHooks */).useChannelsMessaged(defaultChannel != null ? [defaultChannel] : []); useStateFromStores = FluxModule.useStateFromStores; const r6 = value6 || Reflect.apply(useStateFromStores, FluxModule, [[GuildProgressStore], _fun91568]); const progress = FluxModule.useStateFromStores([GuildProgressStore], _fun91569); if (value3) { items2 = [value5, value4, r6]; length = items2.filter(function(a0) { return a0; }).length; length2 = items2.length; r3 = progress == null ? value2 : progress.has(Steps.COMPLETED); r3 = !r3 ? length === length2 : r3; return {guildPopulated: value5, guildPersonalized: value4, guildMessaged: r6, completed: r3, dismissed: progress == null || progress.has(Steps.DISMISSED), numFinished: r3 ? length2 : length, totalSteps: length2}; } return {'guildPopulated': false, 'guildPersonalized': false, 'guildMessaged': false, 'guildChannelCreated': false, 'completed': true, 'dismissed': true, 'numFinished': 0, 'totalSteps': 0}; function _fun91566() { // fn#91566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:288, offset: 0x0206a38b, size: 38 bytes, params: 1, frame: 13 const permissionStoreBinding = PermissionStore; const can = permissionStoreBinding.can; const ADMINISTRATOR = Permissions.ADMINISTRATOR; return Reflect.apply(can, permissionStoreBinding, [ADMINISTRATOR, env0_0]); } function _fun91567() { // fn#91567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:421, offset: 0x0206a3b1, size: 32 bytes, params: 1, frame: 11 return GuildChannelStore.getDefaultChannel(env0_0.id); } function _fun91568() { // fn#91568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:535, offset: 0x0206a3d1, size: 73 bytes, params: 1, frame: 13 const value = environment.__proto__; const r1 = GuildProgressStore.getProgress(env0_0.id)?.has(Steps.MESSAGE); return r1 != null && r1; } function _fun91569() { // fn#91569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:667, offset: 0x0206a41a, size: 32 bytes, params: 1, frame: 11 return GuildProgressStore.getProgress(env0_0.id); } } function openActionSheet(a0) { // fn#91571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:1260, offset: 0x0206a43a, size: 112 bytes, params: 2, frame: 18 const defaultImport = importDefault(dependencyMap[6]); const openLazy = defaultImport.openLazy; let value = require(dependencyMap[8]); value = value(dependencyMap[7], dependencyMap.paths); Reflect.apply(openLazy, defaultImport, [value, 'guild-progress-' + a0.id, {guild: a0}]); } function hideActionSheet_91572(a0) { // fn#91572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:1382, offset: 0x0206a4aa, size: 65 bytes, params: 2, frame: 14 (ActionSheetActionCreators).hideActionSheet('guild-progress-' + a0); } function createGuildProgress(a0) { // fn#91573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:1480, offset: 0x0206a4eb, size: 64 bytes, params: 2, frame: 12 if (GuildStore.getGuild(a0) != null) { (importDefault(11935) /* metro dependency 11935: GuildProgressActionCreators */).createProgress(a0); } } function useGuildProgressStep(a0) { // fn#91574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:1631, offset: 0x0206a52b, size: 527 bytes, params: 2, frame: 23 var r5; var r0; var r10; var value6; var value7; const {guildPopulated, guildPersonalized, guildMessaged, completed, totalSteps} = useIOSCompletionStates(a0); const intl = (IndexNativeModule).intl; let string = intl.string; const t = (IndexNativeModule).t; let object = [Reflect.apply(string, intl, [t.q9n0Ta])]; string = intl.string; const DWB2YZ = t.DWB2YZ; object[1] = Reflect.apply(string, intl, [DWB2YZ]); object[2] = intl.string(t.dNktpr); const value4 = 0; if (guildPopulated) { object[value4] = null; r5 = 1; } else { r5 = value4; } if (guildPersonalized) { value6 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1; object[1] = null; r0 = value6; } else { r0 = r5; } if (guildMessaged) { value7 = typeof r0 === 'bigint' ? r0 + 1n : +r0 + 1; object[3] = null; r10 = value7; } else { r10 = r0; } const r7 = object.find(function(a0) { return a0 != null; }) ?? intl.string(t['+Gyklt']); object = {}; const Math = global.Math; object.percentComplete = Math.max(3, 100 * r10 / totalSteps); object.subtitle = r10 < totalSteps ? intl.formatToPlainString(t.zhHW5c, {currStep: r10 + 1, total: totalSteps, step: r7}) : intl.string(t['+Gyklt']); object.completed = completed; return object; } function useIsEligibleForGuildProgress(a0) { // fn#91576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:2281, offset: 0x0206a73a, size: 133 bytes, params: 2, frame: 18 const env0_0 = a0; const value2 = (FluxModule).useStateFromStores([PermissionStore], _fun91577); const defaultImport = SnowflakeUtils; const value3 = defaultImport.extractTimestamp(a0.id); const Date = global.Date; return value2 && !(value3 < Date.now() - WELCOME_OLD_GUILD_AGE_THRESHOLD); function _fun91577() { // fn#91577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12118:2362, offset: 0x0206a38b, size: 38 bytes, params: 1, frame: 13 const permissionStoreBinding = PermissionStore; const can = permissionStoreBinding.can; const ADMINISTRATOR = Permissions.ADMINISTRATOR; return Reflect.apply(can, permissionStoreBinding, [ADMINISTRATOR, env0_0]); } } } global.__d(_fun91564, 11932, [1935, 1867, 3784, 11933, 11927, 661, 4080, 11934, 1962, 11935, 566, 11930, 1244, 21, 2]) /* metro module 11932, dependencies: [1935, 1867, 3784, 11933, 11927, 661, 4080, 11934, 1962, 11935, 566, 11930, 1244, 21, 2] */;