/* Metro module 4302; source: modules/media_engine/DeviceFrecencyStore.tsx; dependencies: [6, 7, 15, 17, 18, 4259, 1878, 4291, 4303, 4393, 566, 22, 694, 2] */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */ import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import MediaEngineStore from '../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../external/discord_common/js/packages/media-engine/Constants.tsx'; /* Metro dependency 4291 */ import * as TimeUtilsModule from '../../external/discord_common/js/packages/time-utils/TimeUtils.tsx'; /* Metro dependency 4303 */ function _fun36830(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#36830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:6, offset: 0x01098db8, size: 852 bytes, params: 8, frame: 23 const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const DeviceTypes = ConstantsModule.DeviceTypes; object = {}; let AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; object.inputDeviceFrecency = AUDIO_INPUT; let AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; object.outputDeviceFrecency = AUDIO_OUTPUT; let VIDEO_INPUT = DeviceTypes.VIDEO_INPUT; object.videoDeviceFrecency = VIDEO_INPUT; object = {afterCompute: function() { }, computeBonus: function() { return 100; }, lookupKey: function(a0) { return a0; }, maxSamples: 256, numFrequentlyItems: Infinity}; const object2 = {}; AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; const StopWatch = (TimeUtilsModule).StopWatch; let stopWatch = new StopWatch(); object2[AUDIO_INPUT] = stopWatch; AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; object2[AUDIO_OUTPUT] = new StopWatch(); VIDEO_INPUT = DeviceTypes.VIDEO_INPUT; object2[VIDEO_INPUT] = new StopWatch(); const object3 = {}; AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; object3[AUDIO_INPUT] = {}; AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; object3[AUDIO_OUTPUT] = {}; VIDEO_INPUT = DeviceTypes.VIDEO_INPUT; object3[VIDEO_INPUT] = {}; const object4 = {}; AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; stopWatch = importDefault(4393) /* metro dependency 4393: Frecency */; stopWatch = new stopWatch(object); object4[AUDIO_INPUT] = stopWatch; AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; stopWatch = importDefault(4393) /* metro dependency 4393: Frecency */; stopWatch = new stopWatch(object); object4[AUDIO_OUTPUT] = stopWatch; VIDEO_INPUT = DeviceTypes.VIDEO_INPUT; stopWatch = importDefault(4393) /* metro dependency 4393: Frecency */; stopWatch = new stopWatch(object); object4[VIDEO_INPUT] = stopWatch; const PersistedStore = (Flux).PersistedStore; stopWatch = _fun36838(PersistedStore); stopWatch.displayName = 'DeviceFrecencyStore'; stopWatch.persistKey = 'DeviceFrecencyStore'; stopWatch.migrations = [_fun36860]; stopWatch = new stopWatch(importDefault(694) /* metro dependency 694: Dispatcher */, {AUDIO_SET_INPUT_DEVICE: function(a0) { return handleSetDevice(DeviceTypes.AUDIO_INPUT, a0); }, AUDIO_SET_OUTPUT_DEVICE: function(a0) { return handleSetDevice(DeviceTypes.AUDIO_OUTPUT, a0); }, MEDIA_ENGINE_SET_VIDEO_DEVICE: function(a0) { return handleSetDevice(DeviceTypes.VIDEO_INPUT, a0); }, SPEAKING: SPEAKING, RTC_CONNECTION_CLIENT_CONNECT: RTC_CONNECTION_CLIENT_CONNECT_36866}); (FileImportTrackerModule).fileFinishedImporting('modules/media_engine/DeviceFrecencyStore.tsx'); exports.default = stopWatch; function _isNativeReflectConstruct_36831() { // fn#36831, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:240, offset: 0x0109910c, 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_36831_isNativeReflectConstruct = function() { return !!result; })(); } function handleSetDevice(a0, {oldId}) { // fn#36834, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:643, offset: 0x0109916a, size: 72 bytes, params: 3, frame: 14 let binding = env0_16; if (binding.isSampling(a0)) { binding = env0_16; binding.stopSampling(a0, oldId); binding = env0_16; binding.startSampling(a0); return undefined; } return false; } function _fun36838(a0) { // fn#36838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1040, offset: 0x010991b7, size: 256 bytes, params: 2, frame: 16 const DeviceFrecencyStore2 = DeviceFrecencyStore; Inherits(DeviceFrecencyStore2, a0); return CreateClass(DeviceFrecencyStore2, [{key: 'initialize', value: function(a0) { var env0_0 = a0; this.waitFor(MediaEngineStore, UserStore); var AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; [AUDIO_INPUT, DeviceTypes.AUDIO_OUTPUT, DeviceTypes.VIDEO_INPUT].forEach(_fun36841); }}, {key: 'reset', value: function() { var AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; [AUDIO_INPUT, DeviceTypes.AUDIO_OUTPUT, DeviceTypes.VIDEO_INPUT].forEach(_fun36843); }}, {key: 'track', value: value_36844}, {key: 'isSampling', value: value_36845}, {key: 'startSampling', value: value_36846}, {key: 'stopSampling', value: value_36847}, {key: 'getState', value: value_36852}, {key: 'getDeviceIdsSortedByFrecency', value: value_36853}, {key: 'getUsageStats', value: value_36854}]); function DeviceFrecencyStore() { // fn#36839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1052, offset: 0x010992b7, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_2(this, DeviceFrecencyStore); const value3 = env1_5(DeviceFrecencyStore); return env1_4(this, _isNativeReflectConstruct_36831() ? global.Reflect.construct(value3, arguments, env1_5(this).constructor) : value3.apply(this, arguments)); } function value_36840(a0) { // fn#36840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1365, offset: 0x01099328, size: 92 bytes, params: 2, frame: 15 const env0_0 = a0; this.waitFor(MediaEngineStore, UserStore); const AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; const AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; const VIDEO_INPUT = DeviceTypes.VIDEO_INPUT; [AUDIO_INPUT, AUDIO_OUTPUT, VIDEO_INPUT].forEach(_fun36841); function _fun36841(a0) { // fn#36841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1449, offset: 0x01099384, size: 88 bytes, params: 2, frame: 14 var value3; const value2 = undefined; if ((env0_0 == null ? value2 : env0_0[a0]) != null) { value3 = environment.__proto__.__proto__; env2_15[a0].overwriteHistory(env0_0[a0]); } env2_13[a0].reset(); return value2; } } function value_36842() { // fn#36842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1547, offset: 0x010993dc, size: 62 bytes, params: 1, frame: 11 const AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; const AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; const VIDEO_INPUT = DeviceTypes.VIDEO_INPUT; [AUDIO_INPUT, AUDIO_OUTPUT, VIDEO_INPUT].forEach(_fun36843); function _fun36843(a0) { // fn#36843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1612, offset: 0x0109941a, size: 38 bytes, params: 2, frame: 11 env2_13[a0].reset(); env2_14[a0] = {}; } } function value_36844(a0, a1, a2) { // fn#36844, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1661, offset: 0x01099440, size: 94 bytes, params: 4, frame: 15 if (env1_14[a0][a1] == null) { env1_14[a0][a1] = 0; } env1_14[a0][a1] += a2; env1_15[a0].track(a1, {usesSinceLastTrack: a2}); } function value_36845(a0) { // fn#36845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1778, offset: 0x0109949e, size: 26 bytes, params: 2, frame: 9 return env1_13[a0].isRunning(); } function value_36846(a0) { // fn#36846, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1843, offset: 0x010994b8, size: 27 bytes, params: 2, frame: 9 env1_13[a0].start(); } function value_36847(a0, a1) { // fn#36847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1896, offset: 0x010994d3, size: 117 bytes, params: 3, frame: 18 var r4; let value = a1; const property = env1_13[a0]; property.stop(); const value4 = property.elapsed().asMilliseconds(); if (value4 > 0) { if (value != null) { r4 = value; } else { value = ((a0) => ({[DeviceTypes.AUDIO_INPUT]: {getCurrentDeviceId: _fun36849}, [DeviceTypes.AUDIO_OUTPUT]: {getCurrentDeviceId: _fun36850}, [DeviceTypes.VIDEO_INPUT]: {getCurrentDeviceId: _fun36851}})[a0])(a0); value = value.getCurrentDeviceId(MediaEngineStore); r4 = value; } this.track(a0, r4, value4); } property.reset(); function getConfigForDeviceType(a0) { // fn#36848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:1989, owner: value_36847.getConfigForDeviceType, offset: 0x01099548, size: 89 bytes, params: 2, frame: 6 const AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; const AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; const VIDEO_INPUT = DeviceTypes.VIDEO_INPUT; return ({[AUDIO_INPUT]: {getCurrentDeviceId: function(a0) { return a0.getInputDeviceId(); }}, [AUDIO_OUTPUT]: {getCurrentDeviceId: function(a0) { return a0.getOutputDeviceId(); }}, [VIDEO_INPUT]: {getCurrentDeviceId: function(a0) { return a0.getVideoDeviceId(); }}})[a0]; } } function value_36852() { // fn#36852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:2298, offset: 0x010995ce, size: 96 bytes, params: 1, frame: 5 const AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; const binding = env1_15; const AUDIO_INPUT2 = DeviceTypes.AUDIO_INPUT; const AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; const AUDIO_OUTPUT2 = DeviceTypes.AUDIO_OUTPUT; const VIDEO_INPUT = DeviceTypes.VIDEO_INPUT; const VIDEO_INPUT2 = DeviceTypes.VIDEO_INPUT; return {[AUDIO_INPUT]: binding[AUDIO_INPUT2].usageHistory, [AUDIO_OUTPUT]: binding[AUDIO_OUTPUT2].usageHistory, [VIDEO_INPUT]: binding[VIDEO_INPUT2].usageHistory}; } function value_36853(a0) { // fn#36853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:2501, offset: 0x0109962e, size: 22 bytes, params: 2, frame: 2 return env1_15[a0].frequently; } function value_36854() { // fn#36854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:2565, offset: 0x01099644, size: 238 bytes, params: 1, frame: 15 var environment; const object = {}; let value = environment.__proto__; let AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; object[AUDIO_INPUT] = []; let AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; object[AUDIO_OUTPUT] = []; const VIDEO_INPUT = DeviceTypes.VIDEO_INPUT; object[VIDEO_INPUT] = []; AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; [AUDIO_INPUT, AUDIO_OUTPUT].forEach(_fun36855); const object2 = {}; AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; object2.duration_input_device_used_ids = object[AUDIO_INPUT].map(function(a0) { var r1; var r2; var item3; var iterator = a0[Symbol.iterator](); var iterator2 = iterator.next; var item2 = Reflect.apply(iterator2, iterator, []); var item = item2.value; item2 = item2.done ? undefined : iterator; var value = undefined; var value2 = item2 === value; var r0 = value2 ? value : item; if (value2) { r1 = item2; r2 = value2; } else { item3 = Reflect.apply(iterator2, item2, []); item = item3.value; item3 = item3.done ? undefined : item2; value = item3 === value; r1 = item3; r2 = value; } if (!r2) { r1.return(); } return r0; }); AUDIO_INPUT = DeviceTypes.AUDIO_INPUT; object2.duration_input_device_used_ms = object[AUDIO_INPUT].map(function(a0) { var r0; var r1; var r2; var item3; var value3; var iterator = a0[Symbol.iterator](); var iterator2 = iterator.next; var item2 = Reflect.apply(iterator2, iterator, []); var item = item2.value; item2 = item2.done ? undefined : iterator; var value = undefined; var value2 = item2 === value; if (value2) { r0 = value; r1 = item2; r2 = value2; } else { item3 = Reflect.apply(iterator2, item2, []); item = item3.value; item3 = item3.done ? undefined : item2; value3 = item3 === value; if (value3) { r0 = value; r1 = item3; r2 = value3; } else { r0 = item; r1 = item3; r2 = value3; } } if (!r2) { r1.return(); } return r0; }); AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; object2.duration_output_device_used_ids = object[AUDIO_OUTPUT].map(function(a0) { var r1; var r2; var item3; var iterator = a0[Symbol.iterator](); var iterator2 = iterator.next; var item2 = Reflect.apply(iterator2, iterator, []); var item = item2.value; item2 = item2.done ? undefined : iterator; var value = undefined; var value2 = item2 === value; var r0 = value2 ? value : item; if (value2) { r1 = item2; r2 = value2; } else { item3 = Reflect.apply(iterator2, item2, []); item = item3.value; item3 = item3.done ? undefined : item2; value = item3 === value; r1 = item3; r2 = value; } if (!r2) { r1.return(); } return r0; }); AUDIO_OUTPUT = DeviceTypes.AUDIO_OUTPUT; object2.duration_output_device_used_ms = object[AUDIO_OUTPUT].map(function(a0) { var r0; var r1; var r2; var item3; var value3; var iterator = a0[Symbol.iterator](); var iterator2 = iterator.next; var item2 = Reflect.apply(iterator2, iterator, []); var item = item2.value; item2 = item2.done ? undefined : iterator; var value = undefined; var value2 = item2 === value; if (value2) { r0 = value; r1 = item2; r2 = value2; } else { item3 = Reflect.apply(iterator2, item2, []); item = item3.value; item3 = item3.done ? undefined : item2; value3 = item3 === value; if (value3) { r0 = value; r1 = item3; r2 = value3; } else { r0 = item; r1 = item3; r2 = value3; } } if (!r2) { r1.return(); } return r0; }); return object2; function _fun36855(a0) { // fn#36855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:2688, offset: 0x01099732, size: 92 bytes, params: 2, frame: 13 let binding = env0_0; if (binding.isSampling(a0)) { binding = env0_0; binding.stopSampling(a0); binding.startSampling(a0); } binding = env0_1; const Object = global.Object; binding[a0] = Object.entries(env2_14[a0]); } } } function _fun36860(a0) { // fn#36860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:3169, offset: 0x010997f8, size: 49 bytes, params: 2, frame: 13 return (Module00022).mapKeys(a0, _fun36861); function _fun36861(a0, a1) { // fn#36861, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:3192, offset: 0x01099829, size: 16 bytes, params: 3, frame: 2 return env1_12[a1]; } } function SPEAKING({context, userId, speakingFlags}) { // fn#36865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:3424, offset: 0x01099893, size: 213 bytes, params: 2, frame: 16 var binding; const DEFAULT = MediaEngineContextTypes.DEFAULT; if (context !== DEFAULT) { return false; } const id = UserStore.getCurrentUser()?.id; if (id == null) { return false; } const r3 = userId === id ? DeviceTypes.AUDIO_INPUT : DeviceTypes.AUDIO_OUTPUT; const NONE = SpeakingFlags.NONE; if (speakingFlags !== NONE) { if (speakingFlags === SpeakingFlags.NONE) { return false; } binding = env0_16; if (binding.isSampling(r3)) { return false; } binding = env0_16; binding.startSampling(r3); } else { binding = env0_16; if (binding.isSampling(r3)) { env0_16.stopSampling(r3); return undefined; } if (speakingFlags === SpeakingFlags.NONE) { return false; } binding = env0_16; if (binding.isSampling(r3)) { return false; } env0_16.startSampling(r3); } } function RTC_CONNECTION_CLIENT_CONNECT_36866() { // fn#36866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:3771, offset: 0x01099968, size: 21 bytes, params: 1, frame: 9 env0_16.reset(); } } function getConfigForDeviceTypeGetCurrentDeviceId(a0) { // fn#36849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:2067, owner: value_36847.getConfigForDeviceType.getCurrentDeviceId, offset: 0x010995a1, size: 15 bytes, params: 2, frame: 9 return a0.getInputDeviceId(); } function getConfigForDeviceTypeGetCurrentDeviceId_36850(a0) { // fn#36850, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:2129, owner: value_36847.getConfigForDeviceType.getCurrentDeviceId, offset: 0x010995b0, size: 15 bytes, params: 2, frame: 9 return a0.getOutputDeviceId(); } function getConfigForDeviceTypeGetCurrentDeviceId_36851(a0) { // fn#36851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4474:2191, owner: value_36847.getConfigForDeviceType.getCurrentDeviceId, offset: 0x010995bf, size: 15 bytes, params: 2, frame: 9 return a0.getVideoDeviceId(); } global.__d(_fun36830, 4302, [6, 7, 15, 17, 18, 4259, 1878, 4291, 4303, 4393, 566, 22, 694, 2]) /* metro module 4302, dependencies: [6, 7, 15, 17, 18, 4259, 1878, 4291, 4303, 4393, 566, 22, 694, 2] */;