/* Metro module 7735; source: modules/calls/VideoSpeakerStore.tsx; dependencies: [6, 7, 15, 17, 18, 4492, 1226, 4259, 4607, 4606, 4299, 4285, 22, 566, 694, 2] */ function _fun61916(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:6, offset: 0x01b4e36f, size: 444 bytes, params: 8, frame: 22 const env0_0 = require; const _arrayLikeToArray_61922 = 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 = updateSpeaker; const closure2 = AUDIO_SET_LOCAL_VIDEO_DISABLED_61924; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_4 = importDefault(6) /* metro dependency 6 */; const env0_5 = importDefault(7) /* metro dependency 7 */; const env0_6 = importDefault(15) /* metro dependency 15 */; const env0_7 = importDefault(17) /* metro dependency 17 */; const env0_8 = importDefault(18) /* metro dependency 18 */; const applicationStreamingStore = importDefault(4492) /* metro dependency 4492: ApplicationStreamingStore */; const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */; const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */; const speakingStore = importDefault(4607) /* metro dependency 4607: SpeakingStore */; const channelRTCStore = importDefault(4606) /* metro dependency 4606: ChannelRTCStore */; const env0_14 = (require(4299) /* metro dependency 4299: CallConstants */).ParticipantTypes; const env0_15 = (importDefault(22) /* metro dependency 22 */).throttle(closure, 300, {trailing: true}); const Store = (importDefault(566) /* metro dependency 566: flux */).Store; _fun61925(Store).displayName = 'VideoSpeakerStore'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {AUDIO_SET_LOCAL_VIDEO_DISABLED: closure2}); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/calls/VideoSpeakerStore.tsx'); exports.default = value; } function _isNativeReflectConstruct_61917() { // fn#61917, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:233, offset: 0x01b4e52b, 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_61917_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_61920(a0, a1) { // fn#61920, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:426, offset: 0x01b4e589, 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 _fun61921; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_61922(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_61922(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_61922(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun61921; } 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 updateSpeaker() { // fn#61923, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:1336, offset: 0x01b4e6fb, size: 776 bytes, params: 1, frame: 28 var r4; var r5; var r8; var r6; var id; var r9; var r10; var r11; var r14; var r3; var selectedParticipantId; var isParticipantPoppedOut; var lastActiveStream; var getParticipant; var value8; var binding; var moduleValue; var value11; var id2; var value14; var items3; var items2; var value15; var value16; var done; var value17; var value18; var user; var isLocalVideoDisabled; var push; var getSpeakingDuration; var value19; var value20; var length; var property; var userId; var duration; var value21; var value22; var value23; const value = a0; const value2 = undefined; const r2 = !(value !== value2) || value; const value3 = null; if (value3 == env0_2) { r3 = value3; } else { selectedParticipantId = ChannelRTCStore.getSelectedParticipantId(env0_2); r4 = value3 != selectedParticipantId && ChannelRTCStore.isParticipantPoppedOut(env0_2, selectedParticipantId); r5 = r4 ? value3 : selectedParticipantId; lastActiveStream = ApplicationStreamingStore.getLastActiveStream(); r8 = value3 != r5 ? ChannelRTCStore.getParticipant(env0_2, r5) : value3; value8 = (value3 == r8 ? value2 : r8.type) !== ParticipantTypes.ACTIVITY; if (value8) { r6 = (value3 == r8 ? value2 : r8.type) !== ParticipantTypes.USER || value3 != r8.voiceState && r8.voiceState.selfVideo; r4 = r6; } else { r4 = value8; } r8 = r4 ? r5 : value3; if (value3 == lastActiveStream) { r4 = r8; } else if (value3 != r8) { r4 = r8; } else { getParticipant = ChannelRTCStore.getParticipant; binding = env0_2; moduleValue = require(4285) /* metro dependency 4285: StreamKeyUtils */; value11 = Reflect.apply(getParticipant, ChannelRTCStore, [binding, moduleValue.encodeStreamKey(lastActiveStream)]); id = value3 == value11 ? value2 : value11.id; r6 = value3 == id || ChannelRTCStore.isParticipantPoppedOut(env0_2, id); r4 = r6 ? r8 : id; } if (value3 != r4) { r3 = r4; } else { id2 = AuthenticationStore.getId(); value14 = global.Date.now(); items3 = []; items2 = []; value15 = _createForOfIteratorHelperLoose_61920(ChannelRTCStore.getVideoParticipants(env0_2)); value16 = value15(); done = value16.done; value17 = 0; if (!done) { r9 = value16; while (true) { value18 = r9.value; user = value18.user; id = user.id; if (id !== id2) { isLocalVideoDisabled = MediaEngineStore.isLocalVideoDisabled; user = value18.user; id = user.id; if (Reflect.apply(isLocalVideoDisabled, MediaEngineStore, [id])) { break; } isParticipantPoppedOut = ChannelRTCStore.isParticipantPoppedOut; binding = env0_2; id = value18.id; if (Reflect.apply(isParticipantPoppedOut, ChannelRTCStore, [binding, id])) { break; } push = items3.push; user = value18.user; id = user.id; Reflect.apply(push, items3, [id]); getSpeakingDuration = SpeakingStore.getSpeakingDuration; user = value18.user; id = user.id; value19 = Reflect.apply(getSpeakingDuration, SpeakingStore, [id, value14]); if (value17 === value19) { break; } push = items2.push; user = value18.user; id = user.id; Reflect.apply(push, items2, [{userId: id, duration: value19}]); break; } value20 = value15(); done = value20.done; if (done) { break; } r9 = value20; continue; } } length = items2.length; if (value17 < length) { r9 = value17; r10 = value2; r11 = value2; while (true) { property = items2[r9]; userId = property.userId; duration = property.duration; value21 = value3 == r10; if (value21) { r14 = value21; } else { value22 = duration < r10; r14 = value22; } if (r14) { r10 = duration; r11 = userId; continue; } continue; value23 = typeof r9 === 'bigint' ? r9 + 1n : +r9 + 1; length = items2.length; if (value23 < length) { r9 = value23; continue; } r6 = r11; break; } } else { r6 = value2; } r3 = value3 != r6 ? r6 : value3 == env0_3 ? items3[value17] : items3.includes(env0_3) ? env0_3 : items3[value17]; } } if (env0_3 !== r3) { if (r2) { env0_16.emitChange(); } } return value2; } function AUDIO_SET_LOCAL_VIDEO_DISABLED_61924() { // fn#61924, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:2389, offset: 0x01b4ea03, size: 17 bytes, params: 1, frame: 9 env0_15(); return false; } function _fun61925(a0) { // fn#61925, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:2443, offset: 0x01b4ea14, size: 93 bytes, params: 2, frame: 16 const closure = VideoSpeakerStoreClass; env0_8(closure, a0); return env0_5(closure, [{key: 'initialize', value: function() { this.waitFor(ChannelRTCStore, AuthenticationStore, SpeakingStore, ApplicationStreamingStore, MediaEngineStore); this.syncWith([ChannelRTCStore, ApplicationStreamingStore], AUDIO_SET_LOCAL_VIDEO_DISABLED_61924); }}, {key: 'getSpeaker', value: value_61928}]); } function VideoSpeakerStoreClass() { // fn#61926, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:2455, offset: 0x01b4ea71, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_4(this, VideoSpeakerStoreClass); const value3 = env1_7(VideoSpeakerStoreClass); return env1_6(this, _isNativeReflectConstruct_61917() ? global.Reflect.construct(value3, arguments, env1_7(this).constructor) : value3.apply(this, arguments)); } function value_61928(a0) { // fn#61928, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7913:2888, offset: 0x01b4eb31, size: 69 bytes, params: 2, frame: 12 const value = environment.__proto__; if (env1_2 !== a0) { env1_2 = a0; env1_3 = null; updateSpeaker(false); } return env1_3 ?? AuthenticationStore.getId(); }