decord/alpha/source/modules/hub/HubProgressBarUtils.tsx

232 lines
6.9 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 12349
// Function ID: 12350
// Name: HubProgressBarUtils
2026-10-09 10:00:15 +00:00
// Dependencies: [19, 1244, 5758, 8680, 1085, 558, 576, 504, 1209, 1126, 1388, 1403, 2]
2026-10-03 08:58:59 +00:00
// Exports: getHubProgressTitleForStep, getNextHubProgressStep
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 12349 (HubProgressBarUtils)
2026-10-03 08:58:59 +00:00
import react2 from "react" /* 576 */;
import Constants from "Constants" /* 1085 */;
import intl4 from "intl" /* 1126 */;
2026-10-09 10:00:15 +00:00
import GlobalUtils from "GlobalUtils" /* 1388 */;
import FlagUtils from "FlagUtils" /* 1403 */;
import HubProgressBarConstants from "HubProgressBarConstants" /* 8680 */;
2026-10-03 08:58:59 +00:00
import react from "react" /* 19 */;
2026-10-09 10:00:15 +00:00
import UserSettingsProtoStore from "UserSettingsProtoStore" /* 1244 */;
import ConnectedAccountsStore from "ConnectedAccountsStore" /* 5758 */;
2026-10-03 08:58:59 +00:00
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
2026-07-21 06:55:02 +00:00
2026-10-03 08:58:59 +00:00
const require = globalThis.__r;
let _require, set;
2026-07-29 08:29:29 +00:00
2026-10-03 08:58:59 +00:00
let tmp;
const get_initialized = tmp(504);
2026-10-08 09:57:35 +00:00
const preloaded_user_settings = tmp(1209);
2026-10-03 08:58:59 +00:00
function convertHubProgressFlagSetToSet(stateFromStores) {
set = new Set();
for (const item10013 of HUB_PROGRESS_STEP_ORDER) {
let tmp = item10013;
let obj2 = FlagUtils;
if (obj2.hasFlag(stateFromStores, item10013)) {
let addResult = set.add(tmp);
}
continue;
}
return set;
}
const HUB_PROGRESS_STEP_ORDER = HubProgressBarConstants.HUB_PROGRESS_STEP_ORDER;
const PlatformTypes = Constants.PlatformTypes;
let ReactCompilerGating = ReactCompilerGating_mod;
2026-10-08 09:57:35 +00:00
let closure_7 = ReactCompilerGating.isReactCompilerEnabled() ? (function useContactSyncEverEnabled() {
2026-10-03 08:58:59 +00:00
let localAccount;
let tmp4;
let tmp5;
const obj = react2;
const cResult = obj.c(2);
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [ConnectedAccountsStore];
const fn = function s() {
return null != localAccount.getLocalAccount(constants.CONTACTS);
};
cResult[0] = items;
cResult[1] = fn;
tmp4 = items;
tmp5 = fn;
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
[tmp4, tmp5] = cResult;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const tmpResult = get_initialized;
return tmpResult.useStateFromStores(tmp4, tmp5);
2026-10-08 09:57:35 +00:00
}) : (function useContactSyncEverEnabled() {
2026-10-03 08:58:59 +00:00
let localAccount;
const items = [ConnectedAccountsStore];
const obj = get_initialized;
return obj.useStateFromStores(items, () => null != localAccount.getLocalAccount(constants.CONTACTS));
});
ReactCompilerGating = ReactCompilerGating_mod;
2026-10-08 09:57:35 +00:00
let closure_9 = ReactCompilerGating.isReactCompilerEnabled() ? (function useCompletedStepsFromSettings(arg0) {
2026-10-03 08:58:59 +00:00
let closure_0;
let first;
let tmp6;
let tmp8;
_require = arg0;
const tmp = _require;
const obj = require("react");
const cResult = obj.c(5);
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [UserSettingsProtoStore];
let num = 0;
cResult[0] = items;
first = items;
} else {
first = cResult[0];
}
if (cResult[1] !== arg0) {
2026-10-08 09:57:35 +00:00
const fn = function n() {
2026-10-03 08:58:59 +00:00
let num = 0;
if (null != closure_0) {
const guilds = UserSettingsProtoStore.settings.guilds;
let num2;
if (guilds != null) {
if (guilds.guilds[tmp] != null) {
num2 = tmp3.hubProgress;
}
}
if (num2 == null) {
num2 = 0;
}
num = num2;
}
return num;
};
let num2 = 1;
cResult[1] = arg0;
cResult[2] = fn;
tmp6 = fn;
} else {
tmp6 = cResult[2];
}
const tmpResult = tmp(504);
const stateFromStores = tmpResult.useStateFromStores(first, tmp6);
if (cResult[3] !== stateFromStores) {
const tmp10 = convertHubProgressFlagSetToSet(stateFromStores);
cResult[3] = stateFromStores;
cResult[4] = tmp10;
tmp8 = tmp10;
} else {
tmp8 = cResult[4];
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp8;
2026-10-08 09:57:35 +00:00
}) : (function useCompletedStepsFromSettings(arg0) {
2026-10-03 08:58:59 +00:00
let closure_0;
let stateFromStores;
_require = arg0;
const items = [UserSettingsProtoStore];
2026-10-03 08:58:59 +00:00
const obj = require("get initialized");
stateFromStores = obj.useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
let num = 0;
2026-10-03 08:58:59 +00:00
if (null != closure_0) {
const guilds = UserSettingsProtoStore.settings.guilds;
2026-07-29 08:29:29 +00:00
let num2;
if (guilds != null) {
if (guilds.guilds[tmp] != null) {
num2 = tmp3.hubProgress;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (num2 == null) {
num2 = 0;
2026-07-20 16:05:17 +00:00
}
num = num2;
}
return num;
});
const items1 = [stateFromStores];
2026-10-03 08:58:59 +00:00
return react.useMemo(() => convertHubProgressFlagSetToSet(stateFromStores), items1);
});
ReactCompilerGating = ReactCompilerGating_mod;
2026-10-08 09:57:35 +00:00
let tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useHubProgressBarCompletedSteps(id) {
2026-10-03 08:58:59 +00:00
const obj = react2;
const cResult = obj.c(2);
id = undefined;
const tmp4 = closure_9;
if (id != null) {
id = id.id;
}
const tmp4Result = tmp4(id);
let tmp7 = tmp4Result;
if (closure_7()) {
let tmp8;
if (cResult[0] !== tmp4Result) {
const _Set = Set;
const self = this;
const self2 = this;
set = new Set(tmp4Result);
set.add(preloaded_user_settings.HubProgressStep.CONTACT_SYNC);
cResult[0] = tmp4Result;
cResult[1] = set;
tmp8 = set;
} else {
tmp8 = cResult[1];
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp7 = tmp8;
}
return tmp7;
2026-10-08 09:57:35 +00:00
}) : (function useHubProgressBarCompletedSteps(id) {
2026-10-03 08:58:59 +00:00
id = undefined;
let tmp = closure_9;
if (id != null) {
id = id.id;
}
const tmpResult = tmp(id);
let closure_0 = tmpResult;
const tmp4 = closure_7();
let closure_1 = tmp4;
const items = [tmpResult, tmp4];
return react.useMemo(function() {
const tmp = closure_1;
if (tmp) {
2026-07-20 16:05:17 +00:00
const _Set = Set;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
set = new Set(closure_0);
set.add(preloaded_user_settings.HubProgressStep.CONTACT_SYNC);
2026-07-20 16:05:17 +00:00
return set;
} else {
2026-10-03 08:58:59 +00:00
return closure_0;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
}, items);
});
const result = size.fileFinishedImporting("modules/hub/HubProgressBarUtils.tsx");
export const getHubProgressTitleForStep = function getHubProgressTitleForStep(nextHubProgressStep) {
if (preloaded_user_settings.HubProgressStep.JOIN_GUILD === nextHubProgressStep) {
const intl3 = tmp(1126).intl;
return intl3.string(intl4.t.iNR25n);
} else if (preloaded_user_settings.HubProgressStep.INVITE_USER === nextHubProgressStep) {
const intl2 = tmp(1126).intl;
return intl2.string(intl4.t["3NlTYU"]);
} else if (preloaded_user_settings.HubProgressStep.CONTACT_SYNC === nextHubProgressStep) {
const intl = tmp(1126).intl;
return intl.string(intl4.t.HFvFte);
} else if (preloaded_user_settings.HubProgressStep.NO_PROGRESS === nextHubProgressStep) {
return null;
} else {
const tmpResult = GlobalUtils;
tmpResult.assertNever(nextHubProgressStep);
}
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
export const useHubProgressBarCompletedSteps = tmp2;
2026-07-20 16:05:17 +00:00
export const getNextHubProgressStep = function getNextHubProgressStep(hubProgressBarCompletedSteps) {
2026-07-29 08:29:29 +00:00
for (const item10007 of HUB_PROGRESS_STEP_ORDER) {
let tmp = item10007;
2026-10-03 08:58:59 +00:00
if (hubProgressBarCompletedSteps.has(item10007)) {
2026-07-29 08:29:29 +00:00
continue;
} else {
obj.return();
return tmp;
2026-07-20 16:05:17 +00:00
}
}
return null;
};