Files
discord-decomp/modules/routing/KeybindRouterStore.tsx
T
2026-11-01 12:12:55 +02:00

69 lines
1.7 KiB
TypeScript

// Metro module 10876 (f10877).
import { ME, Routes } from "../../Constants";
import { matchPath } from "./matchPathCompat";
import { RouteParam } from "./RouteUtils";
import { createWithEqualityFn } from "../../_bundle/identity_700";
import { batchUpdates } from "../../_bundle/Module705";
const getMatchData = function getMatchData(a0) {
let r7 = a0;
const r26 = matchPath(a0 == null ? "" : a0, {
path: Routes.CHANNEL(RouteParam.guildId(), RouteParam.channelId({
optional: true
}), ":messageId?")
});
if (r26 != null) {
const params = r26.params;
const guildId3 = params.guildId;
let channelId3 = params.channelId;
const guildId4 = guildId3 !== ME ? guildId3 : null;
if (channelId3 == null) {
channelId3 = null;
}
return {
guildId: guildId4,
channelId: channelId3
};
}
if (a0 == null) {
r7 = "";
}
const r38 = matchPath(r7, {
path: Routes.GUILD_BOOSTING_MARKETING(RouteParam.guildId())
});
return r38 != null ? {
guildId: r38.params.guildId,
channelId: null
} : {
guildId: null,
channelId: null
};
};
const withEqualityFn = createWithEqualityFn((c18334_0) => ({
path: null,
basePath: "/",
guildId: null,
channelId: null,
updatePath: (a0) => {
const path = a0;
const matchData = getMatchData(a0);
const { guildId, channelId } = matchData;
batchUpdates(() => c18334_0({
path,
guildId,
channelId
}));
},
resetPath: (a0) => {
const basePath = a0;
const matchData = getMatchData(a0);
const { guildId: guildId2, channelId: channelId2 } = matchData;
batchUpdates(() => c18334_0({
path: null,
guildId: guildId2,
channelId: channelId2,
basePath
}));
}
}));
export default withEqualityFn;