decord/beta/source/modules/routing/useGuildIdForChannelRoute.tsx

74 lines
2.3 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 5104
// Function ID: 5105
// Name: useGuildIdForChannelRoute
2026-10-12 16:32:48 +00:00
// Dependencies: [2068, 4939, 1085, 558, 576, 504, 2090, 2]
2026-10-02 13:37:24 +00:00
// Exports: getGuildIdForGenericRedirect
2026-10-12 16:32:48 +00:00
// Module 5104 (useGuildIdForChannelRoute)
2026-10-02 13:37:24 +00:00
import react from "react" /* 576 */;
2026-10-07 22:43:51 +00:00
import Constants from "Constants" /* 1085 */;
2026-10-12 16:32:48 +00:00
import FavoritesUtils from "FavoritesUtils" /* 2090 */;
import FavoriteStore from "FavoriteStore" /* 2068 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4939 */;
2026-10-02 13:37:24 +00:00
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-02 13:37:24 +00:00
let tmp;
const get_initialized = tmp(504);
2026-10-01 14:13:23 +00:00
const FAVORITES = Constants.FAVORITES;
2026-10-12 16:32:48 +00:00
const tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useGuildIdForChannelRoute(getGuildId) {
2026-10-02 13:37:24 +00:00
let tmp4;
let tmp5;
const obj = react;
const cResult = obj.c(4);
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [SelectedGuildStore];
const fn = function l() {
return guildId.getGuildId();
};
cResult[0] = items;
cResult[1] = fn;
tmp4 = items;
tmp5 = fn;
} else {
[tmp4, tmp5] = cResult;
}
const tmpResult = get_initialized;
let stateFromStores = tmpResult.useStateFromStores(tmp4, tmp5);
if (null == stateFromStores) {
let tmp9;
if (cResult[2] !== getGuildId) {
const guildId = getGuildId.getGuildId();
cResult[2] = getGuildId;
cResult[3] = guildId;
tmp9 = guildId;
} else {
tmp9 = cResult[3];
}
stateFromStores = tmp9;
}
return stateFromStores;
2026-10-12 16:32:48 +00:00
}) : (function useGuildIdForChannelRoute(getGuildId) {
2026-10-01 14:13:23 +00:00
let guildId;
const items = [SelectedGuildStore];
2026-10-01 14:13:23 +00:00
const obj = get_initialized;
let stateFromStores = obj.useStateFromStores(items, () => guildId.getGuildId());
if (null == stateFromStores) {
stateFromStores = getGuildId.getGuildId();
}
return stateFromStores;
2026-10-02 13:37:24 +00:00
});
const result = size.fileFinishedImporting("modules/routing/useGuildIdForChannelRoute.tsx");
export default tmp2;
export const getGuildIdForGenericRedirect = function getGuildIdForGenericRedirect(channel) {
2026-10-01 14:13:23 +00:00
let guildId;
const obj = FavoritesUtils;
if (!obj.isFavoritesGuildId(SelectedGuildStore.getGuildId())) {
2026-10-01 14:13:23 +00:00
guildId = channel.getGuildId();
} else if (FavoriteStore.isFavorite(channel.id)) {
guildId = FAVORITES;
}
return guildId;
};