Files
discord-decomp/sources/utils/SKUUtils.tsx
T
2026-07-27 16:20:00 +03:00

391 lines
14 KiB
TypeScript

/* Metro module 9991; source: utils/SKUUtils.tsx; dependencies: [57, 661, 3974, 1244, 4141, 477, 3738, 2] */
function _fun78099(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#78099, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10177:6, offset: 0x01e1914c, size: 427 bytes, params: 8, frame: 21
const env0_0 = require;
let Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
let value = require(661) /* metro dependency 661: Constants */;
const GameGenres = value.GameGenres;
const env0_5 = value.SKUTypes;
const env0_6 = value.Routes;
const env0_7 = value.SKUProductLines;
const env0_8 = {};
const env0_9 = {};
Object = global.Object;
const freeze = Object.freeze;
object = {ALL: -1};
copyDataProperties(object, GameGenres, undefined);
value = Reflect.apply(freeze, Object, [object]);
Object = global.Object;
value = Object.keys(value);
value.forEach(_fun78100);
object = [['YYYY-MM-DD', 'MMMM DD, Y'], ['YYYY-MM', 'MMMM Y'], ['MM-DD', 'MMMM DD'], ['MM', 'MMMM'], ['YYYY', 'Y']];
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/SKUUtils.tsx');
exports.getSKUIdFromURL = getSKUIdFromURL;
exports.getGenreURLSlugFromId = getGenreURLSlugFromId;
exports.getGenreIdFromURLSlug = getGenreIdFromURLSlug;
exports.getGenreText = getGenreText;
exports.canUserInstall = canUserInstall;
exports.getReadablePreorderReleaseDate = getReadablePreorderReleaseDate;
exports.isThirdPartySKU = function(a0) {
return a0 === SKUProductLines.SOCIAL_LAYER_GAME_ITEM;
};
}
function _fun78100(a0) { // fn#78100, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10177:242, offset: 0x01e192f7, size: 73 bytes, params: 2, frame: 14
let value = a0.toLowerCase();
value = value.replace(RegExp('_', 'g'), '-');
const property = env0_10[a0];
env0_8[value] = property;
env0_9[property] = value;
}
function getSKUIdFromURL(a0) { // fn#78101, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10177:484, offset: 0x01e19340, size: 97 bytes, params: 2, frame: 16
const matchPathCompatModule = require(3974) /* metro dependency 3974: matchPathCompat */;
const matchPath = matchPathCompatModule.matchPath;
const object2 = {};
object2.path = Routes.APPLICATION_STORE_LISTING_SKU(':skuId', ':slug');
const value = Reflect.apply(matchPath, matchPathCompatModule, [a0, object2]);
const value2 = null;
return value2 != value ? value.params.skuId : value2;
}
function getGenreURLSlugFromId(a0) { // fn#78102, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10177:656, offset: 0x01e193a1, size: 16 bytes, params: 2, frame: 2
return env0_9[a0];
}
function getGenreText(a0) { // fn#78104, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10177:789, offset: 0x01e193b1, size: 5446 bytes, params: 2, frame: 15
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const ACTION = GameGenres.ACTION;
if (ACTION === a0) {
return intl.string(t['1o2/IM']);
}
const ACTION_RPG = GameGenres.ACTION_RPG;
if (ACTION_RPG === a0) {
return intl.string(t.e9Yo4H);
}
const BRAWLER = GameGenres.BRAWLER;
if (BRAWLER === a0) {
return intl.string(t.WCkEjT);
}
const HACK_AND_SLASH = GameGenres.HACK_AND_SLASH;
if (HACK_AND_SLASH === a0) {
return intl.string(t.xQ4VmK);
}
const PLATFORMER = GameGenres.PLATFORMER;
if (PLATFORMER === a0) {
return intl.string(t.WA3189);
}
const STEALTH = GameGenres.STEALTH;
if (STEALTH === a0) {
return intl.string(t['6UPFdw']);
}
const SURVIVAL = GameGenres.SURVIVAL;
if (SURVIVAL === a0) {
return intl.string(t.SVPCt9);
}
const ADVENTURE = GameGenres.ADVENTURE;
if (ADVENTURE === a0) {
return intl.string(t['15p8on']);
}
const ACTION_ADVENTURE = GameGenres.ACTION_ADVENTURE;
if (ACTION_ADVENTURE === a0) {
return intl.string(t.AxkUBp);
}
const METROIDVANIA = GameGenres.METROIDVANIA;
if (METROIDVANIA === a0) {
return intl.string(t.Iwr38m);
}
const OPEN_WORLD = GameGenres.OPEN_WORLD;
if (OPEN_WORLD === a0) {
return intl.string(t['2HRHJO']);
}
const PSYCHOLOGICAL_HORROR = GameGenres.PSYCHOLOGICAL_HORROR;
if (PSYCHOLOGICAL_HORROR === a0) {
return intl.string(t['/IwK3s']);
}
const SANDBOX = GameGenres.SANDBOX;
if (SANDBOX === a0) {
return intl.string(t['2+Vu4Q']);
}
const SURVIVAL_HORROR = GameGenres.SURVIVAL_HORROR;
if (SURVIVAL_HORROR === a0) {
return intl.string(t.CCzRiK);
}
const VISUAL_NOVEL = GameGenres.VISUAL_NOVEL;
if (VISUAL_NOVEL === a0) {
return intl.string(t.FE7rnk);
}
const DRIVING_RACING = GameGenres.DRIVING_RACING;
if (DRIVING_RACING === a0) {
return intl.string(t.Erzgca);
}
const VEHICULAR_COMBAT = GameGenres.VEHICULAR_COMBAT;
if (VEHICULAR_COMBAT === a0) {
return intl.string(t.YQHhog);
}
const MASSIVELY_MULTIPLAYER = GameGenres.MASSIVELY_MULTIPLAYER;
if (MASSIVELY_MULTIPLAYER === a0) {
return intl.string(t['5CNg1o']);
}
const MMORPG = GameGenres.MMORPG;
if (MMORPG === a0) {
return intl.string(t['c4NuO/']);
}
const ROLE_PLAYING = GameGenres.ROLE_PLAYING;
if (ROLE_PLAYING === a0) {
return intl.string(t.yayVgs);
}
const DUNGEON_CRAWLER = GameGenres.DUNGEON_CRAWLER;
if (DUNGEON_CRAWLER === a0) {
return intl.string(t.qicemc);
}
const ROGUELIKE = GameGenres.ROGUELIKE;
if (ROGUELIKE === a0) {
return intl.string(t.zWzaCv);
}
const SHOOTER = GameGenres.SHOOTER;
if (SHOOTER === a0) {
return intl.string(t['+pk6sd']);
}
const LIGHT_GUN = GameGenres.LIGHT_GUN;
if (LIGHT_GUN === a0) {
return intl.string(t.TDS96y);
}
const SHOOT_EM_UP = GameGenres.SHOOT_EM_UP;
if (SHOOT_EM_UP === a0) {
return intl.string(t.wltDUE);
}
const FPS = GameGenres.FPS;
if (FPS === a0) {
return intl.string(t.olTaq4);
}
const DUAL_JOYSTICK_SHOOTER = GameGenres.DUAL_JOYSTICK_SHOOTER;
if (DUAL_JOYSTICK_SHOOTER === a0) {
return intl.string(t['SN+NS3']);
}
const SIMULATION = GameGenres.SIMULATION;
if (SIMULATION === a0) {
return intl.string(t.sxMPdm);
}
const FLIGHT_SIMULATOR = GameGenres.FLIGHT_SIMULATOR;
if (FLIGHT_SIMULATOR === a0) {
return intl.string(t['Q7msr+']);
}
const TRAIN_SIMULATOR = GameGenres.TRAIN_SIMULATOR;
if (TRAIN_SIMULATOR === a0) {
return intl.string(t.ZtECf3);
}
const LIFE_SIMULATOR = GameGenres.LIFE_SIMULATOR;
if (LIFE_SIMULATOR === a0) {
return intl.string(t.byt5Fo);
}
const FISHING = GameGenres.FISHING;
if (FISHING === a0) {
return intl.string(t.BKwiwY);
}
const SPORTS = GameGenres.SPORTS;
if (SPORTS === a0) {
return intl.string(t.O0B7XM);
}
const BASEBALL = GameGenres.BASEBALL;
if (BASEBALL === a0) {
return intl.string(t['jPYb/z']);
}
const BASKETBALL = GameGenres.BASKETBALL;
if (BASKETBALL === a0) {
return intl.string(t['o+D1Bm']);
}
const BILLIARDS = GameGenres.BILLIARDS;
if (BILLIARDS === a0) {
return intl.string(t.PJ5o4E);
}
const BOWLING = GameGenres.BOWLING;
if (BOWLING === a0) {
return intl.string(t['82afJw']);
}
const BOXING = GameGenres.BOXING;
if (BOXING === a0) {
return intl.string(t.DQvfei);
}
const FOOTBALL = GameGenres.FOOTBALL;
if (FOOTBALL === a0) {
return intl.string(t.slOYkj);
}
const GOLF = GameGenres.GOLF;
if (GOLF === a0) {
return intl.string(t.aeQPlG);
}
const HOCKEY = GameGenres.HOCKEY;
if (HOCKEY === a0) {
return intl.string(t.g7oe5X);
}
const SKATEBOARDING_SKATING = GameGenres.SKATEBOARDING_SKATING;
if (SKATEBOARDING_SKATING === a0) {
return intl.string(t.yBDEP0);
}
const SNOWBOARDING_SKIING = GameGenres.SNOWBOARDING_SKIING;
if (SNOWBOARDING_SKIING === a0) {
return intl.string(t.GVaAci);
}
const SOCCER = GameGenres.SOCCER;
if (SOCCER === a0) {
return intl.string(t.KPznxl);
}
const TRACK_FIELD = GameGenres.TRACK_FIELD;
if (TRACK_FIELD === a0) {
return intl.string(t['hJ62Q/']);
}
const SURFING_WAKEBOARDING = GameGenres.SURFING_WAKEBOARDING;
if (SURFING_WAKEBOARDING === a0) {
return intl.string(t.PSh0CV);
}
const WRESTLING = GameGenres.WRESTLING;
if (WRESTLING === a0) {
return intl.string(t['3y9hAT']);
}
const STRATEGY = GameGenres.STRATEGY;
if (STRATEGY === a0) {
return intl.string(t.KovTD8);
}
const FOUR_X = GameGenres.FOUR_X;
if (FOUR_X === a0) {
return intl.string(t['19h4dX']);
}
const ARTILLERY = GameGenres.ARTILLERY;
if (ARTILLERY === a0) {
return intl.string(t.sBqLsP);
}
const RTS = GameGenres.RTS;
if (RTS === a0) {
return intl.string(t.yS4ddj);
}
const TOWER_DEFENSE = GameGenres.TOWER_DEFENSE;
if (TOWER_DEFENSE === a0) {
return intl.string(t.SULyIO);
}
const TURN_BASED_STRATEGY = GameGenres.TURN_BASED_STRATEGY;
if (TURN_BASED_STRATEGY === a0) {
return intl.string(t.VDsbru);
}
const WARGAME = GameGenres.WARGAME;
if (WARGAME === a0) {
return intl.string(t.YDCIrO);
}
const MOBA = GameGenres.MOBA;
if (MOBA === a0) {
return intl.string(t.i1m1t8);
}
const FIGHTING = GameGenres.FIGHTING;
if (FIGHTING === a0) {
return intl.string(t.KepcSI);
}
const PUZZLE = GameGenres.PUZZLE;
if (PUZZLE === a0) {
return intl.string(t.rm7Ggs);
}
const CARD_GAME = GameGenres.CARD_GAME;
if (CARD_GAME === a0) {
return intl.string(t.kX85vy);
}
const EDUCATION = GameGenres.EDUCATION;
if (EDUCATION === a0) {
return intl.string(t.klIi67);
}
const FITNESS = GameGenres.FITNESS;
if (FITNESS === a0) {
return intl.string(t.GOaaFb);
}
const GAMBLING = GameGenres.GAMBLING;
if (GAMBLING === a0) {
return intl.string(t['X8/Ee9']);
}
const MUSIC_RHYTHM = GameGenres.MUSIC_RHYTHM;
if (MUSIC_RHYTHM === a0) {
return intl.string(t.qPgrgw);
}
const PARTY_MINI_GAME = GameGenres.PARTY_MINI_GAME;
if (PARTY_MINI_GAME === a0) {
return intl.string(t.diBclF);
}
const PINBALL = GameGenres.PINBALL;
if (PINBALL === a0) {
return intl.string(t['1+ottx']);
}
const TRIVIA_BOARD_GAME = GameGenres.TRIVIA_BOARD_GAME;
if (TRIVIA_BOARD_GAME === a0) {
return intl.string(t.aLlxjC);
}
const TACTICAL = GameGenres.TACTICAL;
if (TACTICAL === a0) {
return intl.string(t.LRPgbt);
}
const INDIE = GameGenres.INDIE;
if (INDIE === a0) {
return intl.string(t.hz9Xvj);
}
const ARCADE = GameGenres.ARCADE;
if (ARCADE === a0) {
return intl.string(t.Sbxowr);
}
const POINT_AND_CLICK = GameGenres.POINT_AND_CLICK;
if (POINT_AND_CLICK === a0) {
return intl.string(t.vcerEn);
}
return intl.string(t['9b4eUr']);
}
function canUserInstall(a0) { // fn#78105, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10177:5333, offset: 0x01e1a8f7, size: 112 bytes, params: 2, frame: 16
const storeUtilsModule = require(4141) /* metro dependency 4141: StoreUtils */;
const nativePlatformTypeToSKUOperatingSystem = storeUtilsModule.nativePlatformTypeToSKUOperatingSystem;
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
const getPlatform = platformUtilsModule.getPlatform;
const value2 = Reflect.apply(nativePlatformTypeToSKUOperatingSystem, storeUtilsModule, [Reflect.apply(getPlatform,
platformUtilsModule, [])]);
const type = a0.type;
const DURABLE_PRIMARY = SKUTypes.DURABLE_PRIMARY;
return type === DURABLE_PRIMARY && value2 != null && a0.supportedOperatingSystems.includes(value2);
}
function getReadablePreorderReleaseDate({preorderReleaseAt, preorderApproximateReleaseDate}) { // fn#78106, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10177:5554, offset: 0x01e1a967, size: 180 bytes, params: 2, frame: 25
var r6;
var binding;
var value3;
var property;
var property2;
var value4;
var isValid;
var value5;
if (preorderReleaseAt != null) {
return preorderReleaseAt.format('MMMM DD');
}
if (preorderApproximateReleaseDate == null) {
return null;
}
let length = env0_11.length;
if (0 < length) {
r6 = 0;
loopExit3: while (true) {
binding = env0_3;
value3 = binding(env0_11[r6], 2);
property = value3[0];
property2 = value3[1];
value4 = (importDefault(3738) /* metro dependency 3738 */)(preorderApproximateReleaseDate, property, true);
isValid = value4.isValid;
if (Reflect.apply(isValid, value4, [])) {
return value4.format(property2);
}
value5 = typeof r6 === 'bigint' ? r6 + 1n : +r6 + 1;
length = env0_11.length;
if (value5 < length) {
r6 = value5;
continue;
}
break loopExit3;
}
}
return preorderApproximateReleaseDate;
}