/* Metro module 7862; source: modules/applications/ApplicationFrecencyStore.tsx; dependencies: [6, 7, 15, 17, 18, 1378, 1348, 4238, 670, 1909, 4393, 22, 566, 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 Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import UserSettingsProtoStore from '../user_settings/UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */ import EmbeddedActivitiesStore from '../activities/EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */ import Frecency from '../../lib/Frecency.tsx'; /* Metro dependency 4393 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as UserSettingsConstantsModule from '../user_settings/UserSettingsConstants.tsx'; /* Metro dependency 670 */ import * as ServerModule from '../../flow/Server.tsx'; /* Metro dependency 1909 */ import * as ApplicationConstantsModule from './ApplicationConstants.tsx'; /* Metro dependency 4238 */ function _fun62889(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#62889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:6, offset: 0x01b6bc09, size: 539 bytes, params: 8, frame: 20 const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const FREQUENCY_ITEM_LIMIT = (ApplicationConstantsModule).FREQUENCY_ITEM_LIMIT; const ApplicationCommandType = (ServerModule).ApplicationCommandType; const CHAT = ApplicationCommandType.CHAT; object = [CHAT]; const PRIMARY_ENTRY_POINT = ApplicationCommandType.PRIMARY_ENTRY_POINT; object[1] = PRIMARY_ENTRY_POINT; object = {pendingUsages: []}; let value = Frecency; value = new value({computeBonus: function() { return 100; }, lookupKey: function(a0) { return a0; }, afterCompute: function() { }, numFrequentlyItems: FREQUENCY_ITEM_LIMIT}); const PersistedStore = (Flux).PersistedStore; value = _fun62900(PersistedStore); value.displayName = 'ApplicationFrecencyStore'; value.persistKey = 'ApplicationFrecency'; value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {APPLICATION_COMMAND_USED: APPLICATION_COMMAND_USED, EMBEDDED_ACTIVITY_OPEN: function({applicationId}) { trackApplicationUsage(applicationId); }, USER_SETTINGS_PROTO_UPDATE: USER_SETTINGS_PROTO_UPDATE_62910}); (FileImportTrackerModule).fileFinishedImporting('modules/applications/ApplicationFrecencyStore.tsx'); exports.default = value; function _isNativeReflectConstruct_62890() { // fn#62890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:227, offset: 0x01b6be24, 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_62890_isNativeReflectConstruct = function() { return !!result; })(); } function trackApplicationUsage(a0) { // fn#62893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:632, offset: 0x01b6be82, size: 86 bytes, params: 2, frame: 15 const pendingUsages = env0_11.pendingUsages; const push = pendingUsages.push; const object = {key: a0}; const Date = global.Date; object.timestamp = Date.now(); Reflect.apply(push, pendingUsages, [object]); env0_12.track(a0); env0_12.compute(); } function handleUserSettingsProtoStoreChange_62894() { // fn#62894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:740, offset: 0x01b6bed8, size: 111 bytes, params: 1, frame: 17 const applicationFrecency = UserSettingsProtoStore.frecencyWithoutFetchingLatest.applicationFrecency; const value2 = undefined; const r7 = (applicationFrecency == null ? value2 : applicationFrecency.applications) ?? ({}); const binding = env0_12; binding.overwriteHistory((importDefault(22) /* metro dependency 22 */).mapValues(r7, function(a0) { var r3; var object = {}; copyDataProperties(object, a0, r3); var value = a0.recentUses.map(global.Number); value = value.filter(_fun62896); object['recentUses'] = value; return object; }), env0_11.pendingUsages); return value2; function _fun62895(a0) { // fn#62895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:936, offset: 0x01b6bf47, size: 67 bytes, params: 2, frame: 13 const object = {}; copyDataProperties(object, a0, undefined); const recentUses = a0.recentUses; const map = recentUses.map; const Number = global.Number; let value = Reflect.apply(map, recentUses, [Number]); value = value.filter(function(a0) { return a0 > 0; }); object['recentUses'] = value; return object; } } function _fun62900(a0) { // fn#62900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:1026, offset: 0x01b6bf8a, size: 185 bytes, params: 2, frame: 16 const ApplicationFrecencyStore2 = ApplicationFrecencyStore; Inherits(ApplicationFrecencyStore2, a0); return CreateClass(ApplicationFrecencyStore2, [{key: 'initialize', value: value_62902}, {key: 'getState', value: value_62903}, {key: 'hasPendingUsage', value: value_62904}, {key: 'getApplicationFrecencyWithoutLoadingLatest', value: value_62905}, {key: 'getScoreWithoutLoadingLatest', value: value_62906}, {key: 'getTopApplicationsWithoutLoadingLatest', value: value_62907}]); function ApplicationFrecencyStore() { // fn#62901, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:1038, offset: 0x00ea76ec, size: 113 bytes, params: 1, frame: 20 const value = environment.__proto__; env1_2(this, ApplicationFrecencyStore); const value3 = env1_5(ApplicationFrecencyStore); return env1_4(this, _isNativeReflectConstruct_62890() ? global.Reflect.construct(value3, arguments, env1_5(this).constructor) : value3.apply(this, arguments)); } function value_62902(a0) { // fn#62902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:1376, offset: 0x01b6c043, size: 74 bytes, params: 2, frame: 14 var value; if (a0 != null) { value = environment.__proto__; env1_11 = a0; } this.waitFor(EmbeddedActivitiesStore, UserSettingsProtoStore); this.syncWith([UserSettingsProtoStore], handleUserSettingsProtoStoreChange_62894); } function value_62903() { // fn#62903, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1 return env1_11; } function value_62904() { // fn#62904, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:1550, offset: 0x01b6c08d, size: 26 bytes, params: 1, frame: 2 return env1_11.pendingUsages.length > 0; } function value_62905() { // fn#62905, offset: 0x00e2f9de, size: 9 bytes, params: 1, frame: 1 return env1_12; } function value_62906(a0) { // fn#62906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:1715, offset: 0x01b6c0a7, size: 37 bytes, params: 2, frame: 11 const value = environment.__proto__; return env1_12.getScore(a0) ?? 0; } function value_62907() { // fn#62907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:1822, offset: 0x01b6c0cc, size: 15 bytes, params: 1, frame: 1 return env1_12.frequently; } } function APPLICATION_COMMAND_USED({command}) { // fn#62908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:2006, offset: 0x01b6c0db, size: 104 bytes, params: 2, frame: 14 var r1; var r0; var embeddedActivitiesStoreBinding; var getLaunchState; var applicationId; var value4; var trackApplicationUsageBinding; var value; const binding = env0_10; const value2 = binding.includes(command.type); if (value2) { embeddedActivitiesStoreBinding = EmbeddedActivitiesStore; getLaunchState = embeddedActivitiesStoreBinding.getLaunchState; applicationId = command.applicationId; value4 = Reflect.apply(getLaunchState, embeddedActivitiesStoreBinding, [applicationId]); r1 = value4 == null || !value4.isLaunching; if (r1) { trackApplicationUsageBinding = trackApplicationUsage; applicationId = command.applicationId; value = undefined; trackApplicationUsageBinding(applicationId); r1 = value; } r0 = r1; } else { r0 = !!value2; } return r0; } function USER_SETTINGS_PROTO_UPDATE_62910({settings, wasSaved}) { // fn#62910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:2332, offset: 0x01b6c15b, size: 62 bytes, params: 2, frame: 4 const type = settings.type; const FRECENCY_AND_FAVORITES_SETTINGS = UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS; if (type === FRECENCY_AND_FAVORITES_SETTINGS) { if (wasSaved) { env0_11.pendingUsages = []; return undefined; } } return false; } } function _fun62896(a0) { // fn#62896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:990, offset: 0x011bbce4, size: 11 bytes, params: 2, frame: 2 return a0 > 0; } global.__d(_fun62889, 7862, [6, 7, 15, 17, 18, 1378, 1348, 4238, 670, 1909, 4393, 22, 566, 694, 2]) /* metro module 7862, dependencies: [6, 7, 15, 17, 18, 1378, 1348, 4238, 670, 1909, 4393, 22, 566, 694, 2] */;