/* Metro module 8319; source: modules/messages/VoiceSessionUtils.tsx; dependencies: [31, 5221, 1379, 1878, 8320, 566, 8213, 4634, 1244, 22, 2] */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import UserAffinitiesV2Store from '../user_affinities/UserAffinitiesV2Store.tsx'; /* Metro dependency 5221 */ import GetHumanizedCallDuration from './getHumanizedCallDuration.tsx'; /* Metro dependency 8213 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as Module00022Module from '../../by-id/module-00022.js'; /* Metro dependency 22 */ import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as UseMessageAuthorModule from './useMessageAuthor.tsx'; /* Metro dependency 4634 */ function _fun66244(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66244, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:6, offset: 0x01bf4d30, size: 201 bytes, params: 8, frame: 20 const env0_0 = require; const closure = function(a0) { return require(dependencyMap[4]).maybeSortByProbability(_fun66246(a0), UserAffinitiesV2Store.getUserAffinitiesMap(), 'VoiceSessionUtils - participants'); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/messages/VoiceSessionUtils.tsx'); exports.getSortedVoiceSessionParticipants = closure; exports.useSortedVoiceSessionParticipants = useSortedVoiceSessionParticipants; exports.getVoiceSessionMessageContent = getVoiceSessionMessageContent; function getSortedVoiceSessionParticipants(a0) { // fn#66245, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:136, offset: 0x01bf4df9, size: 77 bytes, params: 2, frame: 16 return (require(8320) /* metro dependency 8320: maybeSortByProbability */).maybeSortByProbability(((a0) => { var r0; var env0_0 = a0; var property = a0.call; r0 = property == null ? undefined : property.participants.reduce(_fun66247, []); r0 = r0 ?? []; return r0; })(a0), UserAffinitiesV2Store.getUserAffinitiesMap(), 'VoiceSessionUtils - participants'); function _fun66246(a0) { // fn#66246, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:189, offset: 0x01bf4e46, size: 64 bytes, params: 2, frame: 15 const env0_0 = a0; const call = a0.call; let r0 = call == null ? undefined : call.participants.reduce(_fun66247, []); r0 = r0 ?? []; return r0; function _fun66247(a0, a1) { // fn#66247, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:264, offset: 0x01bf4e86, size: 96 bytes, params: 3, frame: 15 var r0; var items2; let value = a0; const user = UserStore.getUser(a1); if (user == null) { r0 = value; } else if (user.id === env0_0.author.id) { r0 = value; } else { items2 = []; value = arraySpread(items2, value, 0, value); items2[value] = user; value + 1; r0 = items2; } return r0; } } } function useSortedVoiceSessionParticipants(a0) { // fn#66248, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:638, offset: 0x01bf4ee6, size: 121 bytes, params: 2, frame: 18 return ReactModule.useMemo(_fun66255, [((a0) => { var env0_0 = a0; return (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([UserStore], _fun66250, [a0.author.id, a0.call]); })(a0), (require(566) /* metro dependency 566: flux */).useStateFromStores([UserAffinitiesV2Store], function() { return UserAffinitiesV2Store.getUserAffinitiesMap(); }, [])]); function _fun66249(a0) { // fn#66249, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:691, offset: 0x01bf4f5f, size: 96 bytes, params: 2, frame: 17 const env0_0 = a0; return (FluxModule).useStateFromStoresArray([UserStore], _fun66250, [a0.author.id, a0.call]); function _fun66250() { // fn#66250, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:731, offset: 0x01bf4fbf, size: 109 bytes, params: 1, frame: 14 var r0; var value; if (env0_0.call?.participants != null) { value = env0_0.call.participants.map(function(a0) { return UserStore.getUser(a0); }); value = value.filter(_fun66252); value = value.filter(_fun66253); r0 = value; } else { r0 = []; } return r0; function _fun66253({id}) { // fn#66253, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:868, offset: 0x01bf5043, size: 32 bytes, params: 2, frame: 2 return id !== env1_0.author.id; } } } function _fun66255() { // fn#66255, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:1009, offset: 0x01bf5076, size: 57 bytes, params: 1, frame: 15 let value = environment.__proto__; value = require(8320) /* metro dependency 8320: maybeSortByProbability */; return value.maybeSortByProbability(env0_0, env0_1, 'VoiceSessionUtils - participants'); } } function getVoiceSessionMessageContent(a0) { // fn#66256, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:1125, offset: 0x01bf50af, size: 461 bytes, params: 2, frame: 24 var nick; var r0; const intl = (IndexNativeModule).intl; var formatToPlainString; const t = (IndexNativeModule).t; var atbXuX; var object; var length; const identity = (Module00022Module).identity; var property; const env0_0 = ChannelStore.getChannel(a0.channel_id); const value2 = undefined; const value3 = (GetHumanizedCallDuration)(a0); const messageAuthor = (UseMessageAuthorModule).getMessageAuthor(a0); const value6 = getSortedVoiceSessionParticipants(a0).map(_fun66257); if (value3 == null) { r0 = intl.formatToPlainString(t.HzBfIN, {username: messageAuthor.nick, usernameOnClick: identity}); } else { formatToPlainString = intl.formatToPlainString; atbXuX = t.atbXuX; object = {}; length = value6.length; object.userCount = length + 1; nick = messageAuthor.nick; object.username = nick; object.usernameOnClick = identity; property = value6[0]; nick = property == null ? value2 : property.messageAuthor.nick; object.username2 = nick; object.username2OnClick = identity; property = value6[1]; nick = property == null ? value2 : property.messageAuthor.nick; object.username3 = nick; object.username3OnClick = identity; length = value6.length; object.otherCount = length - 1; object.duration = value3; r0 = Reflect.apply(formatToPlainString, intl, [atbXuX, object]); } return r0; function _fun66257(a0) { // fn#66257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:1291, offset: 0x01bf527c, size: 60 bytes, params: 2, frame: 14 const object = {user: a0}; const value = environment.__proto__; object.messageAuthor = (require(4634) /* metro dependency 4634: useMessageAuthor */).getUserAuthor(a0, env0_0); return object; } } } function _fun66252(a0) { // fn#66252, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8504:847, offset: 0x00d0b2f0, size: 11 bytes, params: 2, frame: 2 return a0 != null; } global.__d(_fun66244, 8319, [31, 5221, 1379, 1878, 8320, 566, 8213, 4634, 1244, 22, 2]) /* metro module 8319, dependencies: [31, 5221, 1379, 1878, 8320, 566, 8213, 4634, 1244, 22, 2] */;