Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
144 lines
4.6 KiB
TypeScript
144 lines
4.6 KiB
TypeScript
// Module ID: 11603
|
|
// Function ID: 11604
|
|
// Name: ApplicationFrecencyHooks
|
|
// Dependencies: [19, 8592, 1084, 2026, 504, 11, 6941, 2]
|
|
// Exports: useSortApplicationsViaFrecency
|
|
|
|
// Module 11603 (ApplicationFrecencyHooks)
|
|
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import ApplicationFrecencyStore from "ApplicationFrecencyStore" /* 8592 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
const require = fn;
|
|
const UserSettingsTypes = fn(1084).UserSettingsTypes;
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/applications/ApplicationFrecencyHooks.tsx");
|
|
|
|
export const useSortApplicationsViaFrecency = function useSortApplicationsViaFrecency(found, stateFromStoresArray) {
|
|
_require = found;
|
|
const effect = memo.useEffect(() => {
|
|
const FrecencyUserSettingsActionCreators = closure_0(stateFromStores[3]).FrecencyUserSettingsActionCreators;
|
|
const ifUncached = FrecencyUserSettingsActionCreators.loadIfUncached(memo2.FRECENCY_AND_FAVORITES_SETTINGS);
|
|
}, []);
|
|
let items = [memo1];
|
|
stateFromStores = require("initialize").useStateFromStores(items, () => memo1.getApplicationFrecencyWithoutLoadingLatest());
|
|
let items1 = [found, stateFromStoresArray];
|
|
memo = memo.useMemo(() => {
|
|
if (null != stateFromStoresArray) {
|
|
if (0 !== stateFromStoresArray.length) {
|
|
let mapped = closure_0.map((item) => {
|
|
const obj = {};
|
|
const merged = Object.assign(item);
|
|
let flag;
|
|
if (stateFromStoresArray != null) {
|
|
flag = stateFromStoresArray.some((application) => application.application.id === item.id);
|
|
}
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
obj.isUserApp = flag;
|
|
return obj;
|
|
});
|
|
}
|
|
return mapped;
|
|
}
|
|
mapped = closure_0;
|
|
}, items1);
|
|
const items2 = [found, stateFromStoresArray];
|
|
memo1 = memo.useMemo(() => {
|
|
found = undefined;
|
|
if (stateFromStoresArray != null) {
|
|
found = stateFromStoresArray.filter((item) => !found.some((id) => id.id === item.application.id));
|
|
}
|
|
return found;
|
|
}, items2);
|
|
const items3 = [memo, stateFromStores, memo1];
|
|
const memo2 = memo.useMemo(() => {
|
|
if (memo1 != null) {
|
|
const item = arr.forEach((id) => {
|
|
const obj = closure_1(stateFromStores[5]);
|
|
const obj2 = entry;
|
|
if (null == entry.getEntry(id.application.id)) {
|
|
const obj3 = { timestamp: extractTimestampResult };
|
|
obj2.track(id.application.id, obj3);
|
|
}
|
|
});
|
|
}
|
|
stateFromStores.compute();
|
|
let mapped;
|
|
if (memo1 != null) {
|
|
mapped = arr.map((application) => found(stateFromStores[6]).getApplicationCommandSection(application.application, true));
|
|
}
|
|
if (mapped == null) {
|
|
mapped = [];
|
|
}
|
|
const items = [...memo];
|
|
const items1 = [...mapped];
|
|
items.push.apply(items1);
|
|
const sorted = items.sort((id, id2) => {
|
|
let num = stateFromStores.getScore(id2.id);
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
let num2 = stateFromStores.getScore(id.id);
|
|
if (num2 == null) {
|
|
num2 = 0;
|
|
}
|
|
let diff = num - num2;
|
|
if (0 === diff) {
|
|
const name = id.name;
|
|
diff = name.localeCompare(id2.name);
|
|
}
|
|
return diff;
|
|
});
|
|
return items;
|
|
}, items3);
|
|
const items4 = [memo2, memo, stateFromStores, stateFromStoresArray];
|
|
return memo.useMemo(() => {
|
|
if (stateFromStoresArray != null) {
|
|
const item = stateFromStoresArray.forEach((id) => {
|
|
const extractTimestampResult = SnowflakeUtilsDefault.extractTimestamp(id.id);
|
|
let tmp2 = null == applyResult;
|
|
if (!tmp2) {
|
|
tmp2 = extractTimestampResult > applyResult;
|
|
}
|
|
if (tmp2) {
|
|
closure_0 = id;
|
|
}
|
|
});
|
|
}
|
|
const item1 = memo.forEach((id) => {
|
|
const entry = stateFromStores.getEntry(id.id);
|
|
let recentUses;
|
|
if (entry != null) {
|
|
recentUses = entry.recentUses;
|
|
}
|
|
if (recentUses == null) {
|
|
recentUses = [];
|
|
}
|
|
const items = [...recentUses];
|
|
applyResult = Math.max.apply(items);
|
|
let tmp3 = null == applyResult;
|
|
if (!tmp3) {
|
|
tmp3 = applyResult > applyResult;
|
|
}
|
|
if (tmp3) {
|
|
closure_0 = id;
|
|
}
|
|
});
|
|
let str;
|
|
if (closure_0 != null) {
|
|
const application = closure_0.application;
|
|
if (application != null) {
|
|
str = application.id;
|
|
}
|
|
}
|
|
if (str == null) {
|
|
str = "";
|
|
}
|
|
let items = [...memo2.filter((id) => id.id === str), ...memo2.filter((id) => id.id !== str)];
|
|
return items;
|
|
}, items4);
|
|
};
|