/* Metro module 4398; source: modules/go_live/StreamRTCConnection.tsx; dependencies: [15, 17, 102, 18, 6, 7, 4265, 4289, 4399, 1226, 1379, 4400, 4259, 4401, 4294, 4402, 661, 4291, 672, 4285, 4403, 4041, 4404, 22, 694, 4405, 4406, 4482, 683, 4488, 4489, 4303, 4490, 4491, 12382, 5252, 4301, 2] */ function _fun37323(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#37323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:6, offset: 0x010a16c5, size: 605 bytes, params: 8, frame: 24 var object2; const env0_0 = require; 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(102) /* metro dependency 102 */; const env0_6 = importDefault(18) /* metro dependency 18 */; const env0_7 = importDefault(6) /* metro dependency 6 */; const env0_8 = importDefault(7) /* metro dependency 7 */; const clipsStore = importDefault(4265) /* metro dependency 4265: ClipsStore */; const env0_10 = (require(4289) /* metro dependency 4289: SystemAnalyticsStoreNative */).getSystemAnalyticsInfo; const applicationStreamingSettingsStore = importDefault(4399) /* metro dependency 4399: ApplicationStreamingSettingsStore */; const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const hookErrorStore = importDefault(4400) /* metro dependency 4400: HookErrorStore */; const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */; const networkStore = importDefault(4401) /* metro dependency 4401: NetworkStore */; const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */; const rtcRegionStore = importDefault(4402) /* metro dependency 4402: RTCRegionStore */; let value = require(661) /* metro dependency 661: Constants */; const env0_19 = value.AnalyticEvents; const env0_20 = value.MediaEngineHookTypes; const env0_21 = value.RTCConnectionStates; const env0_22 = (require(4291) /* metro dependency 4291: Constants */).MediaEngineContextTypes; const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; const SECOND = Millis.SECOND; const env0_23 = 5 * SECOND; object2 = {DETACHED: 0}; object2[0] = 'DETACHED'; object2.WAITING = 1; object2[1] = 'WAITING'; object2.ATTACHED = 2; object2[2] = 'ATTACHED'; object2.STARTED = 3; object2[3] = 'STARTED'; object2.PLAYING = 4; object2[4] = 'PLAYING'; object2.SILENCE = 5; object2[5] = 'SILENCE'; value = _fun37327(); const value3 = _fun37338(importDefault(4301) /* metro dependency 4301: RTCConnection */); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/go_live/StreamRTCConnection.tsx'); exports.default = value3; exports.StreamRTCAnalyticsContext = value; } function _isNativeReflectConstruct_37324() { // fn#37324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:405, offset: 0x010a1922, 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_37324_isNativeReflectConstruct = function() { return !!result; })(); } function _fun37327() { // fn#37327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:816, offset: 0x010a1980, size: 251 bytes, params: 1, frame: 15 return env0_8(StreamRTCAnalyticsContext, [{key: 'setActionContext', value: function(a0) { this.actionContext = a0; }}, {key: 'updateStreamApplication', value: function(a0) { var r4; this.streamApplication = a0; var streamApplicationHistory = this.streamApplicationHistory; var items = []; var value = arraySpread(items, streamApplicationHistory, 0, r4); items[value] = a0; value + 1; this.streamApplicationHistory = items; }}, {key: 'setAnalyticsLocations', value: function(a0) { this.analyticsLocations = a0; }}, {key: 'trackViewerCount', value: function(a0) { var Math = global.Math; this.maxViewers = Math.max(a0, this.maxViewers); this.numViewers = a0; }}, {key: 'setNativePickerStyleUsed', value: function(a0) { this.nativePickerStyleUsed = a0; }}, {key: 'trackStart', value: function() { this.startTime = global.performance.now(); }}, {key: 'trackEnd', value: function() { this.endTime = global.performance.now(); }}, {key: 'getStreamApplicationFromHistory', value: function(a0) { return this.streamApplicationHistory[a0]; }}, {key: 'getDuration', value: function() { if (this.startTime == null) { return null; } return (this.endTime ?? global.performance.now()) - this.startTime; }}]); } function _fun37338(a0) { // fn#37338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:2132, offset: 0x010a1c28, size: 425 bytes, params: 2, frame: 16 const closure = StreamRTCConnection; env0_6(closure, a0); return env0_8(closure, [{key: 'isOwner', get: function() { return AuthenticationStore.getId() === this.streamContext.ownerId; }}, {key: 'destroy', value: value_37342}, {key: 'streamUpdate', value: function(a0) { var _videoQuality = this._videoQuality; if (_videoQuality != null) { if (a0) { _videoQuality.pause(); } else { _videoQuality.resume(); } } }}, {key: 'layoutChange', value: function(a0) { this.videoStreamStats.layoutChange(a0); }}, {key: 'autoQualityChange', value: function() { this.videoStreamStats.autoQualityChange(); }}, {key: 'getVideoStats', value: value_37348}, {key: 'getRegion', value: function() { return this.analyticsContext.streamRegion; }}, {key: 'getMaxViewers', value: function() { return this.analyticsContext.maxViewers; }}, {key: 'getVoiceParticipantType', value: function() { return this.isOwner ? 'streamer' : 'receiver'; }}, {key: 'initializeEvents', value: value_37352}, {key: 'reportSoundshareFailure', value: value_37368}, {key: 'getStreamAnalyticsProperties', value: value_37369}, {key: 'getSoundshareAnalyticsProperties', value: function() { var object = {rtc_connection_id: this.getRTCConnectionId()}; object.soundshare_experimental = MediaEngineStore.getExperimentalSoundshare(); return object; }}, {key: 'trackVideoStartStats', value: value_37371}, {key: 'trackVideoEndStats', value: value_37372}, {key: 'getExtraConnectionOptions', value: value_37375}]); } function StreamRTCAnalyticsContext({streamRegion, streamApplication, streamSourceType, actionContext, numViewers, goLiveModalDurationMs, analyticsLocations}) { // fn#37328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:837, offset: 0x010a1a7b, size: 144 bytes, params: 2, frame: 20 env1_7(this, StreamRTCAnalyticsContext); this.streamRegion = streamRegion; this.streamApplication = streamApplication; this.streamApplicationHistory = [streamApplication]; this.streamSourceType = streamSourceType; this.actionContext = actionContext; this.maxViewers = numViewers; this.goLiveModalDurationMs = goLiveModalDurationMs; this.numViewers = numViewers; this.analyticsLocations = analyticsLocations ?? []; } function StreamRTCConnection({sessionId, streamKey, serverId, initialLayout, analyticsContext, parentMediaSessionId, channelId}) { // fn#37339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:2144, offset: 0x010a1dd1, size: 512 bytes, params: 2, frame: 30 var environment; let value = environment.__proto__; env1_7(this, StreamRTCConnection); const value3 = (require(4285) /* metro dependency 4285: StreamKeyUtils */).decodeStreamKey(streamKey); const guildId = value3.guildId; const channelId2 = value3.channelId; const object2 = {}; object2.userId = AuthenticationStore.getId(); object2.sessionId = sessionId; object2.guildId = guildId; object2.channelId = channelId2; const STREAM = MediaEngineContextTypes.STREAM; object2.context = STREAM; object2.streamServerId = serverId; object2.streamChannelId = channelId; object2.parentMediaSessionId = parentMediaSessionId; object2.joinVoiceId = null; const items2 = [object2]; const value4 = env1_4(StreamRTCConnection); const value7 = env1_3(this, _isNativeReflectConstruct_37324() ? global.Reflect.construct(value4, items2, env1_4(this).constructor) : value4.apply(this, items2)); value = importDefault(4403) /* metro dependency 4403: SoundshareStatsAggregator */; value = new value(); value7.soundshareStats = value; value7._firstFrameDelivered = false; value7.screenshareFinishedCount = 0; value7.soundshareFailuresReported = {}; const Timeout = (require(4041) /* metro dependency 4041: Timers */).Timeout; let timeout = new Timeout(); value7.errorTimer = timeout; value7.streamContext = value3; value7.streamKey = streamKey; timeout = importDefault(4404) /* metro dependency 4404: VideoStreamStats */; timeout = new timeout(initialLayout, value7.isOwner); value7.videoStreamStats = timeout; value7.analyticsContext = analyticsContext; value7.updateVideoStreamId = (importDefault(22) /* metro dependency 22 */).debounce(_fun37340, 200); value7.videoStreamStats.start(); value7.initializeEvents(); return value7; } function value_37342(a0) { // fn#37342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:3471, offset: 0x010a2097, size: 140 bytes, params: 2, frame: 17 this.videoStreamStats.stop(); this.trackVideoEndStats(a0); this.updateVideoStreamId.cancel(); this.updateVideoStreamId(null, null); this.updateVideoStreamId.flush(); this.errorTimer.stop(); value_37342_superPropGet(StreamRTCConnection, 'destroy', this, 3)([]); } function value_37348() { // fn#37348, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:4134, offset: 0x010a21ea, size: 139 bytes, params: 1, frame: 13 var r1; const ownerId = this.streamContext.ownerId; const _videoQuality = this._videoQuality; if (_videoQuality != null) { r1 = this.isOwner ? _videoQuality.getOutboundStats()[0] ?? ({}) : _videoQuality.getInboundStats(ownerId) ?? ({}); return {duration: r1.duration, avg_bitrate: r1.avg_bitrate, avg_fps: r1.avg_fps, avg_resolution: r1.avg_resolution, inbound_bitrate_estimate_percentile99: r1.inbound_bitrate_estimate_percentile99}; } return null; } function value_37352() { // fn#37352, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:4785, offset: 0x010a22b1, size: 223 bytes, params: 1, frame: 18 let on = this.on; const RTCConnectionEvent = (require(4405) /* metro dependency 4405: RTCConnectionEvent */).RTCConnectionEvent; const State = RTCConnectionEvent.State; Reflect.apply(on, this, [State, _fun37353]); on = this.on; const Video = RTCConnectionEvent.Video; Reflect.apply(on, this, [Video, _fun37364]); on = this.on; const VideoSourceQualityChanged = RTCConnectionEvent.VideoSourceQualityChanged; Reflect.apply(on, this, [VideoSourceQualityChanged, _fun37365]); on = this.on; const SecureFramesUpdate = RTCConnectionEvent.SecureFramesUpdate; Reflect.apply(on, this, [SecureFramesUpdate, _fun37366]); on = this.on; const RosterMapUpdate = RTCConnectionEvent.RosterMapUpdate; Reflect.apply(on, this, [RosterMapUpdate, _fun37367]); } function value_37368(a0, a1, a2, a3) { // fn#37368, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:12982, offset: 0x010a3468, size: 276 bytes, params: 5, frame: 19 var Set; var value3; var set; var value8; var defaultImport; var track; var SOUNDSHARE_FAILED; var object2; const value = undefined; const r4 = (a0 == null ? value : a0.soundshareSession) ?? ''; let soundshareFailuresReported = this.soundshareFailuresReported; if (soundshareFailuresReported[r4] == null) { soundshareFailuresReported = this.soundshareFailuresReported; Set = global.Set; value3 = Object.create(Set.prototype, {constructor: {value: Set}}); set = new Set(); soundshareFailuresReported[r4] = set instanceof Object ? set : value3; } const r2 = a1 != null && !this.soundshareFailuresReported[r4].has(a1); if (r2) { this.soundshareFailuresReported[r4].add(a1); } if (a1 == null || r2) { value8 = environment.__proto__; defaultImport = importDefault(dependencyMap[28]); track = defaultImport.track; SOUNDSHARE_FAILED = AnalyticEvents.SOUNDSHARE_FAILED; object2 = {soundshare_failure_code: a1, soundshare_failure_reason: a2, soundshare_failure_will_retry: a3}; copyDataProperties(object2, importDefault(dependencyMap[30])(a0), dependencyMap); copyDataProperties(object2, this.getSoundshareAnalyticsProperties(), dependencyMap); Reflect.apply(track, defaultImport, [SOUNDSHARE_FAILED, object2]); } return value; } function value_37369() { // fn#37369, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:13488, offset: 0x010a357c, size: 351 bytes, params: 1, frame: 24 const {streamRegion, streamApplication, streamSourceType, actionContext} = this.analyticsContext; const {ownerId, guildId} = this.streamContext; const value = environment.__proto__; const getRegion = RTCRegionStore.getRegion; const getHostname = RTCConnectionStore.getHostname; const value2 = Reflect.apply(getRegion, RTCRegionStore, [Reflect.apply(getHostname, RTCConnectionStore, [])]); const {gameName, gameId, exe, distributor, sku, gameMetadata} = (require(4482) /* metro dependency 4482: GameAnalyticsUtils */).getRunningGameAnalytics(streamApplication); const object2 = {}; object2.channel_id = this.channelId; object2.rtc_connection_id = this.getRTCConnectionId(); object2.media_session_id = this.getMediaSessionId(); object2.parent_media_session_id = this.parentMediaSessionId; object2.sender_user_id = ownerId; const STREAM = MediaEngineContextTypes.STREAM; object2.context = STREAM; object2.guild_id = guildId; object2.stream_region = streamRegion; object2.stream_source_type = streamSourceType; object2.guild_region = value2; object2.participant_type = this.isOwner ? 'streamer' : 'receiver'; object2.share_application_name = gameName; object2.share_application_id = gameId; object2.share_application_executable = exe; object2.share_application_distributor = distributor; object2.share_application_distributor_game_id = sku; object2.share_application_game_metadata = gameMetadata; object2.video_layout = this.videoStreamStats.getLayout(); object2.client_event_source = actionContext; object2.voice_backend_version = this.voiceVersion; object2.rtc_worker_backend_version = this.rtcWorkerVersion; return object2; } function value_37371() { // fn#37371, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:14656, offset: 0x010a3709, size: 227 bytes, params: 1, frame: 18 var r7; const isOwner = this.isOwner; let value = null; if (isOwner) { value = environment.__proto__; value = (importDefault(4490) /* metro dependency 4490: getStreamSourceMetadataNative */)(); r7 = value; } else { r7 = value; } value = environment.__proto__; const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; const track = defaultImport.track; const VIDEO_STREAM_STARTED = AnalyticEvents.VIDEO_STREAM_STARTED; const object2 = {}; const getStreamAnalyticsProperties = this.getStreamAnalyticsProperties; copyDataProperties(object2, r7, copyDataProperties(object2, Reflect.apply(getStreamAnalyticsProperties, this, []), getStreamAnalyticsProperties)); object2['connection_type'] = NetworkStore.getType(); object2['effective_connection_speed'] = NetworkStore.getEffectiveConnectionSpeed(); object2['service_provider'] = NetworkStore.getServiceProvider(); object2['duration_go_live_modal'] = this.analyticsContext.goLiveModalDurationMs; object2['source_location_stack'] = this.analyticsContext.analyticsLocations; Reflect.apply(track, defaultImport, [VIDEO_STREAM_STARTED, object2]); } function value_37372(a0) { // fn#37372, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:15078, offset: 0x010a37ec, size: 382 bytes, params: 2, frame: 19 var environment; var r1; var isOwner; var getCodecUsageStats; var property; var object2; var settings; const env0_1 = a0; let value = environment.__proto__; const channel = ChannelStore.getChannel(this.channelId); const value3 = null; const env0_4 = value3 != channel ? channel.type : value3; const ownerId = this.streamContext.ownerId; const _videoQuality = this._videoQuality; if (value3 != _videoQuality) { var env0_2 = _videoQuality.getNetworkStats(); isOwner = this.isOwner; getCodecUsageStats = _videoQuality.getCodecUsageStats; r1 = isOwner ? Reflect.apply(getCodecUsageStats, _videoQuality, ['streamer', this.userId]) : Reflect.apply(getCodecUsageStats, _videoQuality, ['receiver', ownerId]); property = (require(4491) /* metro dependency 4491: VoiceEngineStreamingManager */).default; object2 = {}; object2.stream_application_name = property.getApplicationNames(); settings = ClipsStore.getSettings(); isOwner = this.isOwner; if (isOwner) { object2 = {}; object2.clips_enabled = (require(12382) /* metro dependency 12382: isClipsEnabled */).isClipsEnabled(); object2.clips_buffer_length = settings.clipsLength; } else { object2 = {}; } isOwner = this.isOwner; if (isOwner) { ({}).bandwidth_estimation_experiment = this.getBandwidthEstimationExperiment(); } else { object2 = {}; } value = _videoQuality.getOutboundStats(); value.forEach(_fun37373); value = _videoQuality.getInboundParticipants(); value.forEach(_fun37374); } } function value_37375() { // fn#37375, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:16884, offset: 0x010a3ce0, size: 60 bytes, params: 1, frame: 12 let value = environment.__proto__; value = require(4285) /* metro dependency 4285: StreamKeyUtils */; return {streamUserId: value.decodeStreamKey(this.streamKey).ownerId}; } function _fun37340(a0, a1) { // fn#37340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:2984, offset: 0x010a1fd1, size: 160 bytes, params: 3, frame: 18 const streamKeyUtilsModule = require(4285) /* metro dependency 4285: StreamKeyUtils */; const decodeStreamKey = streamKeyUtilsModule.decodeStreamKey; const binding = env0_0; const {guildId, channelId, ownerId} = Reflect.apply(decodeStreamKey, streamKeyUtilsModule, [binding.streamKey]); const defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */; const dispatch = defaultImport.dispatch; const object2 = {type: 'RTC_CONNECTION_VIDEO', guildId: guildId, channelId: channelId, userId: ownerId, streamId: a0, rtcServerId: a1}; object2.mediaEngineConnectionId = binding.getMediaEngineConnectionId(); const STREAM = MediaEngineContextTypes.STREAM; object2.context = STREAM; Reflect.apply(dispatch, defaultImport, [object2]); } function value_37342_superPropGet(a0, a1, a2, a3) { // fn#37343, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:3665, owner: value_37342._superPropGet, offset: 0x010a2123, size: 100 bytes, params: 5, frame: 18 let value = a0; const env0_0 = a2; const binding = env2_5; value = env2_4(1 & 3 ? value.prototype : value); value = binding(value, 'destroy', a2); return 2 & 3 ? typeof value !== 'function' ? value : _fun37344 : value; } function _fun37353(a0, a1, a2) { // fn#37353, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:4849, offset: 0x010a2390, size: 621 bytes, params: 4, frame: 19 var _connection; const BaseConnectionEvent = (require(4406) /* metro dependency 4406: mediaEngine */).BaseConnectionEvent; const defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */; const dispatch = defaultImport.dispatch; const object2 = {type: 'RTC_CONNECTION_STATE', state: a0}; copyDataProperties(object2, a1, undefined); copyDataProperties(object2, a2, undefined); object2['streamKey'] = env0_0.streamKey; Reflect.apply(dispatch, defaultImport, [object2]); const RTC_CONNECTED = RTCConnectionStates.RTC_CONNECTED; if (a0 === RTC_CONNECTED) { _connection = env0_0._connection; if (_connection != null) { _connection.on(BaseConnectionEvent.ScreenshareFinish, _fun37354); } _connection = env0_0._connection; if (_connection != null) { _connection.on(BaseConnectionEvent.SoundshareAttached, _fun37356); } _connection = env0_0._connection; if (_connection != null) { _connection.on(BaseConnectionEvent.SoundshareFailed, _fun37357); } _connection = env0_0._connection; if (_connection != null) { _connection.on(BaseConnectionEvent.SoundshareSpeaking, _fun37358); } _connection = env0_0._connection; if (_connection != null) { _connection.on(BaseConnectionEvent.SoundshareTrace, _fun37359); } _connection = env0_0._connection; if (_connection != null) { _connection.on(BaseConnectionEvent.FirstFrameStats, _fun37361); } _connection = env0_0._connection; if (_connection != null) { _connection.on(BaseConnectionEvent.FirstFrameEncryptedStats, _fun37362); } _connection = env0_0._connection; if (_connection != null) { _connection.on(BaseConnectionEvent.Destroy, _fun37363); } } } function _fun37364(a0, a1, a2, a3, a4) { // fn#37364, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:12237, offset: 0x010a32f7, size: 171 bytes, params: 6, frame: 15 var binding; let value = environment.__proto__.__proto__; value = Reflect.apply((require(4285) /* metro dependency 4285: StreamKeyUtils */).decodeStreamKey, value, [env0_0.streamKey]); let r2 = value.guildId === a0 && value.channelId === a1; if (r2) { value = value.ownerId === a2; r2 = value; } if (r2) { binding = env0_0; value = binding.getMediaSessionId(); value = value == null; if (!(value || env0_1)) { env0_0.trackVideoStartStats(); } binding = env0_0; binding.updateVideoStreamId(a3, a4); } } function _fun37365(a0, a1, a2, a3, a4, a5) { // fn#37365, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:12515, offset: 0x010a33a2, size: 94 bytes, params: 7, frame: 13 const value = environment.__proto__.__proto__; (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'MEDIA_ENGINE_VIDEO_SOURCE_QUALITY_CHANGED', guildId: a0, channelId: a1, senderUserId: a2, maxResolution: a3, maxFrameRate: a4, context: a5}); } function _fun37366() { // fn#37366, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:12739, offset: 0x010a3400, size: 47 bytes, params: 1, frame: 13 const value = environment.__proto__.__proto__; (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'RTC_CONNECTION_SECURE_FRAMES_UPDATE'}); } function _fun37367(a0) { // fn#37367, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:12865, offset: 0x010a342f, size: 57 bytes, params: 2, frame: 13 const value = environment.__proto__.__proto__; (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'RTC_CONNECTION_ROSTER_MAP_UPDATE', userIds: a0}); } function _fun37373(a0) { // fn#37373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:15647, offset: 0x010a396a, size: 479 bytes, params: 2, frame: 23 var value3; var defaultImport; var track; var VIDEO_STREAM_ENDED; var object2; var binding; var videoStreamStats; var getStats; var soundshareStats; const num_frames = a0.num_frames; let value = null; const value2 = 0; if ((value != num_frames ? num_frames : value2) > value2) { value3 = environment.__proto__.__proto__; defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; track = defaultImport.track; VIDEO_STREAM_ENDED = AnalyticEvents.VIDEO_STREAM_ENDED; object2 = {}; copyDataProperties(object2, env0_3, undefined); copyDataProperties(object2, env0_2, undefined); copyDataProperties(object2, env0_6, undefined); binding = env0_0; videoStreamStats = binding.videoStreamStats; getStats = videoStreamStats.getStats; copyDataProperties(object2, Reflect.apply(getStats, videoStreamStats, []), videoStreamStats); copyDataProperties(object2, a0, videoStreamStats); soundshareStats = binding.soundshareStats; getStats = soundshareStats.getStats; copyDataProperties(object2, Reflect.apply(getStats, soundshareStats, []), videoStreamStats); copyDataProperties(object2, binding.getStreamAnalyticsProperties(), videoStreamStats); copyDataProperties(object2, env0_7, videoStreamStats); copyDataProperties(object2, env0_8, videoStreamStats); object2['app_hardware_acceleration_enabled'] = (importDefault(4488) /* metro dependency 4488: CrossPlatformNativeUtilsNative */).getAppHardwareAccelerationEnabled(); object2['channel_type'] = type; object2['reason'] = env0_1; object2['max_viewers'] = binding.analyticsContext.maxViewers; object2['hostname'] = binding.hostname; object2['hardware_enabled'] = MediaEngineStore.getHardwareEncoding(); object2['device_performance_class'] = binding.isOwner ? (importDefault(5252) /* metro dependency 5252: getMediaPerformanceClassAndroid */)() : value; value = MediaEngineStore.getExperimentalSoundshare(); object2['soundshare_experimental'] = value; object2['quality_preset'] = ApplicationStreamingSettingsStore.getState().preset; value = importDefault(4488) /* metro dependency 4488: CrossPlatformNativeUtilsNative */; value = value.getDiscordIsElevated(); object2['discord_is_elevated'] = value; Reflect.apply(track, defaultImport, [VIDEO_STREAM_ENDED, object2]); } } function _fun37374(a0) { // fn#37374, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:16314, offset: 0x010a3b49, size: 407 bytes, params: 2, frame: 23 var value6; var defaultImport; var track; var VIDEO_STREAM_ENDED; var object2; var binding; var videoStreamStats; var getStats; var soundshareStats; const inboundStats = _videoQuality.getInboundStats(a0); const value3 = null; const value4 = undefined; const num_frames = value3 == inboundStats ? value4 : inboundStats.num_frames; const value5 = 0; if ((value3 != num_frames ? num_frames : value5) > value5) { value6 = environment.__proto__.__proto__; defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; track = defaultImport.track; VIDEO_STREAM_ENDED = AnalyticEvents.VIDEO_STREAM_ENDED; object2 = {}; copyDataProperties(object2, env0_3, undefined); copyDataProperties(object2, env0_2, undefined); copyDataProperties(object2, env0_6, undefined); binding = env0_0; videoStreamStats = binding.videoStreamStats; getStats = videoStreamStats.getStats; copyDataProperties(object2, Reflect.apply(getStats, videoStreamStats, []), videoStreamStats); copyDataProperties(object2, inboundStats, videoStreamStats); soundshareStats = binding.soundshareStats; getStats = soundshareStats.getStats; copyDataProperties(object2, Reflect.apply(getStats, soundshareStats, []), videoStreamStats); copyDataProperties(object2, binding.getStreamAnalyticsProperties(), videoStreamStats); copyDataProperties(object2, env0_7, videoStreamStats); copyDataProperties(object2, env0_8, videoStreamStats); object2['app_hardware_acceleration_enabled'] = (importDefault(4488) /* metro dependency 4488: CrossPlatformNativeUtilsNative */).getAppHardwareAccelerationEnabled(); object2['channel_type'] = type; object2['reason'] = env0_1; object2['max_viewers'] = binding.analyticsContext.maxViewers; object2['hostname'] = binding.hostname; object2['hardware_enabled'] = MediaEngineStore.getHardwareEncoding(); object2['device_performance_class'] = binding.isOwner ? (importDefault(5252) /* metro dependency 5252: getMediaPerformanceClassAndroid */)() : value3; Reflect.apply(track, defaultImport, [VIDEO_STREAM_ENDED, object2]); } return value4; } function _fun37354(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25) { // fn#37354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:5077, offset: 0x010a25fd, size: 442 bytes, params: 27, frame: 20 let value = a9; const value2 = a10; const value3 = a11; const value4 = a12; const value5 = a13; const env0_0 = a0; const env0_1 = a1; const env0_2 = a2; const env0_3 = a3; const env0_4 = a4; const env0_5 = a5; const env0_6 = a6; const env0_7 = a7; const env0_8 = a8; const env0_14 = a14; const env0_15 = a15; const env0_16 = a16; const env0_17 = a17; const env0_18 = a18; const env0_19 = a19; const env0_20 = a20; const env0_21 = a21; const env0_22 = a22; const env0_23 = a23; const env0_24 = a24; const env0_25 = a25; const binding = env1_0; const analyticsContext = binding.analyticsContext; const getStreamApplicationFromHistory = analyticsContext.getStreamApplicationFromHistory; let screenshareFinishedCount = binding.screenshareFinishedCount; const value7 = Reflect.apply(getStreamApplicationFromHistory, analyticsContext, [screenshareFinishedCount]); screenshareFinishedCount = binding.screenshareFinishedCount; binding.screenshareFinishedCount = typeof screenshareFinishedCount === 'bigint' ? screenshareFinishedCount + 1n : +screenshareFinishedCount + 1; const runningGameAnalytics = (require(4482) /* metro dependency 4482: GameAnalyticsUtils */).getRunningGameAnalytics(value7); const env0_26 = runningGameAnalytics.gameName; const env0_27 = runningGameAnalytics.gameId; const env0_28 = runningGameAnalytics.exe; const env0_29 = runningGameAnalytics.distributor; const env0_30 = binding.getMediaSessionId(); const env0_31 = binding.getRTCConnectionId(); const value10 = 0; value = (value ?? value10) + (value2 ?? value10); value += value3 ?? value10; value += value4 ?? value10; const env0_32 = value + (value5 ?? value10); getSystemAnalyticsInfo().then(_fun37355); } function _fun37356() { // fn#37356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:6981, offset: 0x010a2b18, size: 148 bytes, params: 1, frame: 19 var defaultImport; var track; var SOUNDSHARE_ATTACHED; var object2; var binding; let value = environment.__proto__.__proto__.__proto__; const goLiveSource = MediaEngineStore.getGoLiveSource(); const value3 = undefined; if ((goLiveSource == null ? value3 : goLiveSource.desktopSource) != null) { defaultImport = importDefault(dependencyMap[28]); track = defaultImport.track; SOUNDSHARE_ATTACHED = AnalyticEvents.SOUNDSHARE_ATTACHED; object2 = {}; value = importDefault(dependencyMap[30]); copyDataProperties(object2, value(goLiveSource == null ? value3 : goLiveSource.desktopSource), dependencyMap); value = environment.__proto__; binding = env1_0; copyDataProperties(object2, binding.getSoundshareAnalyticsProperties(), dependencyMap); Reflect.apply(track, defaultImport, [SOUNDSHARE_ATTACHED, object2]); } return value3; } function _fun37357({failureCode, failureReason, willRetry}) { // fn#37357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:7263, offset: 0x010a2bac, size: 91 bytes, params: 2, frame: 20 let value = environment.__proto__.__proto__.__proto__; value = MediaEngineStore.getGoLiveSource(); const binding = env1_0; binding.reportSoundshareFailure(value?.desktopSource, failureCode, failureReason, willRetry); } function _fun37358() { // fn#37358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:7490, offset: 0x010a2c07, size: 222 bytes, params: 1, frame: 20 var defaultImport; var track; var SOUNDSHARE_TRANSMITTING; var object2; var defaultImport2; var value4; var value5; var binding; const value = environment.__proto__.__proto__.__proto__; const goLiveSource = MediaEngineStore.getGoLiveSource(); const value3 = undefined; if ((goLiveSource == null ? value3 : goLiveSource.desktopSource) != null) { defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; track = defaultImport.track; SOUNDSHARE_TRANSMITTING = AnalyticEvents.SOUNDSHARE_TRANSMITTING; object2 = {}; defaultImport2 = importDefault(4489) /* metro dependency 4489: getSoundshareAnalyticsContext */; value4 = goLiveSource == null; copyDataProperties(object2, defaultImport2(value4 ? value3 : goLiveSource.desktopSource), value4); value5 = environment.__proto__; binding = env1_0; copyDataProperties(object2, binding.getSoundshareAnalyticsProperties(), value4); Reflect.apply(track, defaultImport, [SOUNDSHARE_TRANSMITTING, object2]); if (HookErrorStore.getHookError(MediaEngineHookTypes.SOUND) != null) { (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'MEDIA_ENGINE_SOUNDSHARE_TRANSMITTING'}); } } return value3; } function _fun37359(a0) { // fn#37359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:7873, offset: 0x010a2ce5, size: 404 bytes, params: 2, frame: 22 var environment; var errorTimer; var reason; var code; var retry; var binding; let value = environment.__proto__.__proto__.__proto__; const goLiveSource = MediaEngineStore.getGoLiveSource(); const soundshareStats = env1_0.soundshareStats; const value4 = undefined; soundshareStats.traceEvent(goLiveSource == null || goLiveSource.desktopSource == null ? value4 : goLiveSource.desktopSource.soundshareSession, a0); const type = a0.type; if (type === 'soundshare_attach_requested') { errorTimer = env1_0.errorTimer; errorTimer.start(env3_23, _fun37360); } else if (type === 'soundshare_recv_failed') { reason = a0.reason; code = a0.code; retry = a0.retry; if ((goLiveSource == null ? value4 : goLiveSource.desktopSource) != null) { binding = env1_0; binding.reportSoundshareFailure(goLiveSource == null ? value4 : goLiveSource.desktopSource, code, reason, retry); if (!retry) { env1_0.errorTimer.stop(); value = importDefault(694) /* metro dependency 694: Dispatcher */; value.dispatch({type: 'MEDIA_ENGINE_SOUNDSHARE_FAILED', errorMessage: reason, errorCode: code}); } } } else if (type === 'soundshare_state_transition') { if (a0.newState === env3_24.PLAYING) { env1_0.errorTimer.stop(); (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'MEDIA_ENGINE_SOUNDSHARE_TRANSMITTING'}); } } return value4; } function _fun37361(a0) { // fn#37361, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:8706, offset: 0x010a2eac, size: 651 bytes, params: 2, frame: 20 var r4; var binding; var value2; var defaultImport; var track; var RECEIVER_FIRST_FRAME_DELIVERED; var object2; var remoteVideoStreamCreatedTimestamp; let value = environment.__proto__; if (!env1_0._firstFrameDelivered) { binding = env1_0; binding._firstFrameDelivered = true; value = binding.getStreamAnalyticsProperties(); value2 = environment.__proto__.__proto__.__proto__; defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; track = defaultImport.track; RECEIVER_FIRST_FRAME_DELIVERED = AnalyticEvents.RECEIVER_FIRST_FRAME_DELIVERED; object2 = {}; object2.guild_id = value.guild_id; object2.channel_id = value.channel_id; object2.rtc_connection_id = value.rtc_connection_id; object2.media_session_id = value.media_session_id; object2.parent_media_session_id = value.parent_media_session_id; object2.num_viewers = binding.analyticsContext.numViewers; object2.time_connected_to_first_frame_delivered = binding.getDuration(); value = require(4303) /* metro dependency 4303: TimeUtils */; value = value.now(); object2.time_total_to_first_frame = value - binding.getCreatedTime(); remoteVideoStreamCreatedTimestamp = a0.remoteVideoStreamCreatedTimestamp; value = null; r4 = remoteVideoStreamCreatedTimestamp === undefined || a0.remoteUserCreatedTimestamp === undefined ? value : global.Number(a0.remoteVideoStreamCreatedTimestamp - a0.remoteUserCreatedTimestamp); object2.time_remote_user_to_video_stream_created = r4; r4 = a0.videoDataReceivedTimestamp === undefined || a0.remoteVideoStreamCreatedTimestamp === undefined ? value : global.Number(a0.videoDataReceivedTimestamp - a0.remoteVideoStreamCreatedTimestamp); object2.time_video_stream_created_to_video_data_received = r4; r4 = a0.videoSourceDeliveredFrameTimestamp === undefined || a0.videoDataReceivedTimestamp === undefined ? value : global.Number(a0.videoSourceDeliveredFrameTimestamp - a0.videoDataReceivedTimestamp); object2.time_video_data_received_to_video_source_delivered_frame = r4; r4 = a0.updateMLSExternalSenderTimestamp === undefined || a0.remoteUserCreatedTimestamp === undefined ? value : global.Number(a0.updateMLSExternalSenderTimestamp - a0.remoteUserCreatedTimestamp); object2.time_remote_user_to_mls_external_sender_updated = r4; r4 = a0.setRemoteSecureFrameKeyRatchetTimestamp === undefined || a0.remoteUserCreatedTimestamp === undefined ? value : global.Number(a0.setRemoteSecureFrameKeyRatchetTimestamp - a0.remoteUserCreatedTimestamp); object2.time_remote_user_to_secure_frame_remote_key_ratchet_set = r4; r4 = a0.setLocalSecureFrameKeyRatchetTimestamp === undefined || a0.remoteUserCreatedTimestamp === undefined ? value : global.Number(a0.setLocalSecureFrameKeyRatchetTimestamp - a0.remoteUserCreatedTimestamp); object2.time_remote_user_to_secure_frame_local_key_ratchet_set = r4; r4 = a0.firstFrameDecryptedTimestamp === undefined || a0.remoteUserCreatedTimestamp === undefined ? value : global.Number(a0.firstFrameDecryptedTimestamp - a0.remoteUserCreatedTimestamp); object2.time_remote_user_to_first_frame_decrypted = r4; Reflect.apply(track, defaultImport, [RECEIVER_FIRST_FRAME_DELIVERED, object2]); } } function _fun37362(a0) { // fn#37362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:10786, offset: 0x010a3137, size: 421 bytes, params: 2, frame: 20 let value = environment.__proto__; value = env1_0.getStreamAnalyticsProperties(); const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; const track = defaultImport.track; const STREAMER_FIRST_FRAME_ENCRYPTED = AnalyticEvents.STREAMER_FIRST_FRAME_ENCRYPTED; const object2 = {}; object2.guild_id = value.guild_id; object2.channel_id = value.channel_id; object2.rtc_connection_id = value.rtc_connection_id; object2.media_session_id = value.media_session_id; object2.parent_media_session_id = value.parent_media_session_id; const videoReceiversSetTimestamp = a0.videoReceiversSetTimestamp; value = null; object2.time_local_user_to_video_receivers_set = videoReceiversSetTimestamp === undefined || a0.localUserCreatedTimestamp === undefined ? value : global.Number(a0.videoReceiversSetTimestamp - a0.localUserCreatedTimestamp); object2.time_local_user_to_mls_external_sender_updated = a0.updateMLSExternalSenderTimestamp === undefined || a0.localUserCreatedTimestamp === undefined ? value : global.Number(a0.updateMLSExternalSenderTimestamp - a0.localUserCreatedTimestamp); object2.time_local_user_to_secure_frame_remote_key_ratchet_set = a0.setRemoteSecureFrameKeyRatchetTimestamp === undefined || a0.localUserCreatedTimestamp === undefined ? value : global.Number(a0.setRemoteSecureFrameKeyRatchetTimestamp - a0.localUserCreatedTimestamp); object2.time_local_user_to_secure_frame_local_key_ratchet_set = a0.setLocalSecureFrameKeyRatchetTimestamp === undefined || a0.localUserCreatedTimestamp === undefined ? value : global.Number(a0.setLocalSecureFrameKeyRatchetTimestamp - a0.localUserCreatedTimestamp); object2.time_local_user_to_first_frame_encrypted = a0.firstFrameEncryptedTimestamp === undefined || a0.localUserCreatedTimestamp === undefined ? value : global.Number(a0.firstFrameEncryptedTimestamp - a0.localUserCreatedTimestamp); Reflect.apply(track, defaultImport, [STREAMER_FIRST_FRAME_ENCRYPTED, object2]); } function _fun37363() { // fn#37363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:12158, offset: 0x010a32dc, size: 27 bytes, params: 1, frame: 9 env1_0.errorTimer.stop(); } function _fun37355(a0) { // fn#37355, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:5484, offset: 0x010a27b7, size: 865 bytes, params: 2, frame: 22 let value = null; const r5 = value != a0 ? {cpu_brand: a0.cpu_brand, cpu_vendor: a0.cpu_vendor, cpu_memory: a0.cpu_memory, gpu_brand: a0.gpu_brand, gpu_memory: a0.gpu_memory} : value; const value3 = 0; const value13 = (value != env0_0 ? env0_0 : value3) + (value != require ? require : value3) + (value != importDefault ? importDefault : value3) + (value != importAll ? importAll : value3) + (value != env0_4 ? env0_4 : value3) + (value != env0_5 ? env0_5 : value3) + (value != env0_15 ? env0_15 : value3) + (value != env0_19 ? env0_19 : value3) + (value != env0_18 ? env0_18 : value3) + (value != env0_24 ? env0_24 : value3) + (value != env0_23 ? env0_23 : value3); const defaultImport = importDefault(dependencyMap[28]); const track = defaultImport.track; const SCREENSHARE_FINISHED = AnalyticEvents.SCREENSHARE_FINISHED; const object2 = {screenshare_frames: env0_0}; object2.videohook_frames = require; object2.hybrid_dxgi_frames = importDefault; object2.hybrid_gdi_frames = importAll; object2.hybrid_videohook_frames = env0_4; object2.hybrid_graphics_capture_frames = env0_5; object2.hybrid_capture_method_switches = dependencyMap; object2.hybrid_gdi_bitblt_frames = env0_7; object2.hybrid_gdi_printwindow_frames = env0_8; object2.hybrid_graphics_capture_frames_unique = env0_9; object2.hybrid_dxgi_frames_unique = env0_10; object2.hybrid_videohook_frames_unique = env0_11; object2.hybrid_gdi_bitblt_frames_unique = env0_12; object2.hybrid_gdi_printwindow_frames_unique = env0_13; object2.skip_history_json = env0_14; object2.quartz_frames = env0_15; object2.screencapturekit_frames = env0_19; object2.go_live_camera_frames = env0_18; object2.total_frames = value13; object2.total_frames_unique = env0_32; object2.desktop_capturer_type = env0_16; object2.media_session_id = env0_30; object2.rtc_connection_id = env0_31; const STREAM = MediaEngineContextTypes.STREAM; object2.context = STREAM; object2.activity = env0_17; const binding = env2_0; const soundshareStats = binding.soundshareStats; const getStats = soundshareStats.getStats; object2.soundshare_session = Reflect.apply(getStats, soundshareStats, []).soundshare_last_session; const nativePickerStyleUsed = binding.analyticsContext.nativePickerStyleUsed; value = 'internal'; object2.picker_type_used = value != nativePickerStyleUsed ? 'native' : value; object2.duration = env2_0.analyticsContext.getDuration(); object2.share_game_name = gameName; object2.share_game_id = gameId; object2.share_game_exe = exe; object2.share_game_distributor = distributor; object2.hdr_frames_capable = env0_20; object2.hdr_frames = env0_21; object2.discord_is_elevated = importDefault(dependencyMap[29]).getDiscordIsElevated(); object2.target_window_elevated = env0_22; object2.pipewire_frames = env0_23; object2.x11_frames = env0_24; object2.videohook_backend = env0_25; copyDataProperties(object2, r5, soundshareStats); Reflect.apply(track, defaultImport, [SCREENSHARE_FINISHED, object2]); } function _fun37360() { // fn#37360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4570:8076, offset: 0x010a2e79, size: 51 bytes, params: 1, frame: 12 const value = environment.__proto__.__proto__.__proto__.__proto__; (importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({'type': 'MEDIA_ENGINE_SOUNDSHARE_FAILED', 'errorMessage': 'Sound Hook Failed'}); }