Files
discord-decomp/modules/autocompleter/record/InAppNavigationRecord.tsx
T
2026-11-01 12:12:55 +02:00

183 lines
7.0 KiB
TypeScript

// Metro module 5032 (f5033).
import Record from "../../../lib/Record";
import { Routes } from "../../../Constants";
import { RewardFilterTypes } from "../../quests/QuestConstants";
import { UserSettingsPath } from "../../user_settings/UserSettingsConstants";
import { settingsPathToRoute } from "../../user_settings/UserSettingsURLUtils";
import { $callWithNewTarget } from "../../../_hermes/prelude";
let c3038_5 = {
SHOP: "SHOP",
SHOP_ORBS_TAB: "SHOP_ORBS_TAB",
NITRO_HOME: "NITRO_HOME",
QUEST_HOME: "QUEST_HOME",
QUEST_ORBS: "QUEST_ORBS",
APPS_HOME: "APPS_HOME",
SETTINGS: "SETTINGS",
PLAYGROUND: "PLAYGROUND"
};
class InAppNavigationRecord extends Record {
constructor(a0) {
super();
const id = a0.collectionId != null ? `${a0.type}_${a0.collectionId}` : a0.type;
this.id = id;
this.path = a0.path;
this.type = a0.type;
this.label = a0.label;
this.collectionId = a0.collectionId;
this.IconComponent = a0.IconComponent;
}
static fromType(a0, a1, a2, a3, a4) {
if (c3038_5.SHOP === a0) {
const r241 = {
path: Routes.COLLECTIBLES_SHOP,
type: c3038_5.SHOP
};
const prototypeOf8 = Object.getPrototypeOf(InAppNavigationRecord);
const r247 = Object.create(InAppNavigationRecord.prototype);
const r249 = $callWithNewTarget(prototypeOf8, r247, InAppNavigationRecord);
const id8 = r241.collectionId != null ? `${r241.type}_${r241.collectionId}` : r241.type;
const r261 = r249 instanceof Object ? r249 : r247;
r261.id = id8;
r261.path = r241.path;
r261.type = r241.type;
r261.label = r241.label;
r261.collectionId = r241.collectionId;
r261.IconComponent = r241.IconComponent;
return r261;
}
if (c3038_5.NITRO_HOME === a0) {
const r210 = {
path: Routes.NITRO_HOME,
type: c3038_5.NITRO_HOME
};
const prototypeOf7 = Object.getPrototypeOf(InAppNavigationRecord);
const r217 = Object.create(InAppNavigationRecord.prototype);
const r219 = $callWithNewTarget(prototypeOf7, r217, InAppNavigationRecord);
const id7 = r210.collectionId != null ? `${r210.type}_${r210.collectionId}` : r210.type;
const r231 = r219 instanceof Object ? r219 : r217;
r231.id = id7;
r231.path = r210.path;
r231.type = r210.type;
r231.label = r210.label;
r231.collectionId = r210.collectionId;
r231.IconComponent = r210.IconComponent;
return r231;
}
if (c3038_5.QUEST_HOME === a0) {
const r180 = {
path: Routes.QUEST_HOME,
type: c3038_5.QUEST_HOME
};
const prototypeOf6 = Object.getPrototypeOf(InAppNavigationRecord);
const r187 = Object.create(InAppNavigationRecord.prototype);
const r189 = $callWithNewTarget(prototypeOf6, r187, InAppNavigationRecord);
const id6 = r180.collectionId != null ? `${r180.type}_${r180.collectionId}` : r180.type;
const r201 = r189 instanceof Object ? r189 : r187;
r201.id = id6;
r201.path = r180.path;
r201.type = r180.type;
r201.label = r180.label;
r201.collectionId = r180.collectionId;
r201.IconComponent = r180.IconComponent;
return r201;
}
if (c3038_5.APPS_HOME === a0) {
const r150 = {
path: Routes.GLOBAL_DISCOVERY_APPS,
type: c3038_5.APPS_HOME
};
const prototypeOf5 = Object.getPrototypeOf(InAppNavigationRecord);
const r157 = Object.create(InAppNavigationRecord.prototype);
const r159 = $callWithNewTarget(prototypeOf5, r157, InAppNavigationRecord);
const id5 = r150.collectionId != null ? `${r150.type}_${r150.collectionId}` : r150.type;
const r171 = r159 instanceof Object ? r159 : r157;
r171.id = id5;
r171.path = r150.path;
r171.type = r150.type;
r171.label = r150.label;
r171.collectionId = r150.collectionId;
r171.IconComponent = r150.IconComponent;
return r171;
}
let path = a1;
if (c3038_5.SETTINGS === a0) {
if (a1 == null) {
path = settingsPathToRoute(UserSettingsPath.ACCOUNT);
}
const r122 = {
path,
label: a2,
type: c3038_5.SETTINGS
};
const prototypeOf4 = Object.getPrototypeOf(InAppNavigationRecord);
const r128 = Object.create(InAppNavigationRecord.prototype);
const r130 = $callWithNewTarget(prototypeOf4, r128, InAppNavigationRecord);
const id4 = r122.collectionId != null ? `${r122.type}_${r122.collectionId}` : r122.type;
const r141 = r130 instanceof Object ? r130 : r128;
r141.id = id4;
r141.path = r122.path;
r141.type = r122.type;
r141.label = r122.label;
r141.collectionId = r122.collectionId;
r141.IconComponent = r122.IconComponent;
return r141;
}
if (c3038_5.PLAYGROUND === a0) {
const path2 = a1 == null ? Routes.APP : a1;
const PLAYGROUND = c3038_5.PLAYGROUND;
const prototypeOf3 = Object.getPrototypeOf(InAppNavigationRecord);
const r100 = Object.create(InAppNavigationRecord.prototype);
const r102 = $callWithNewTarget(prototypeOf3, r100, InAppNavigationRecord);
const id3 = a3 != null ? `${PLAYGROUND}_${a3}` : PLAYGROUND;
const r111 = r102 instanceof Object ? r102 : r100;
r111.id = id3;
r111.path = path2;
r111.type = PLAYGROUND;
r111.label = a2;
r111.collectionId = a3;
r111.IconComponent = a4;
return r111;
}
if (c3038_5.SHOP_ORBS_TAB === a0) {
const r62 = {
path: Routes.COLLECTIBLES_SHOP,
type: c3038_5.SHOP_ORBS_TAB
};
const prototypeOf2 = Object.getPrototypeOf(InAppNavigationRecord);
const r69 = Object.create(InAppNavigationRecord.prototype);
const r71 = $callWithNewTarget(prototypeOf2, r69, InAppNavigationRecord);
const id2 = r62.collectionId != null ? `${r62.type}_${r62.collectionId}` : r62.type;
const r83 = r71 instanceof Object ? r71 : r69;
r83.id = id2;
r83.path = r62.path;
r83.type = r62.type;
r83.label = r62.label;
r83.collectionId = r62.collectionId;
r83.IconComponent = r62.IconComponent;
return r83;
}
if (c3038_5.QUEST_ORBS === a0) {
const r36 = {
path: `${Routes.QUEST_HOME}?filter=${RewardFilterTypes.VIRTUAL_CURRENCY}`,
type: c3038_5.QUEST_ORBS
};
const prototypeOf = Object.getPrototypeOf(InAppNavigationRecord);
const r43 = Object.create(InAppNavigationRecord.prototype);
const r45 = $callWithNewTarget(prototypeOf, r43, InAppNavigationRecord);
const id = r36.collectionId != null ? `${r36.type}_${r36.collectionId}` : r36.type;
const r53 = r45 instanceof Object ? r45 : r43;
r53.id = id;
r53.path = r36.path;
r53.type = r36.type;
r53.label = r36.label;
r53.collectionId = r36.collectionId;
r53.IconComponent = r36.IconComponent;
return r53;
}
throw new Error("Unhandled InAppNavigationType");
}
}
export default InAppNavigationRecord;
export { InAppNavigationRecord };
export { c3038_5 as InAppNavigationType };