125 lines
5.2 KiB
TypeScript
125 lines
5.2 KiB
TypeScript
/* Metro module 1893; source: modules/premium/perks_state/PerksStateUtils.tsx; dependencies: [57, 1894, 483, 1895, 2] */
|
|
function _fun20531(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#20531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2020:6, offset: 0x00ecbde5, size: 171 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = hasPerk;
|
|
const closure2 = getPerkSource;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/perks_state/PerksStateUtils.tsx');
|
|
exports.parseServerPerks = parseServerPerks;
|
|
exports.hasPerk = closure;
|
|
exports.getPerkSource = closure2;
|
|
exports.getPerkConfig = getPerkConfig;
|
|
}
|
|
|
|
function parseServerPerkConfigKind(a0) { // fn#20532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2020:106, offset: 0x00ecbe90, size: 214 bytes, params: 2, frame: 15
|
|
var type;
|
|
const PerkConfigType = (require(1894) /* metro dependency 1894: types */).PerkConfigType;
|
|
if (a0.kind != null) {
|
|
type = a0.kind.type;
|
|
if (PerkConfigType.INCREASED_FILE_UPLOAD_SIZE === type) {
|
|
return {type: PerkConfigType.INCREASED_FILE_UPLOAD_SIZE, maxSize: a0.kind.max_size};
|
|
}
|
|
if (PerkConfigType.INCREASED_GUILD_LIMIT === type) {
|
|
return {type: PerkConfigType.INCREASED_GUILD_LIMIT, maxGuilds: a0.kind.max_guilds};
|
|
}
|
|
}
|
|
}
|
|
|
|
function hasPerk(a0, a1) { // fn#20533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2020:474, offset: 0x00ecbf66, size: 152 bytes, params: 3, frame: 22
|
|
var r0;
|
|
var moduleValue;
|
|
var has;
|
|
var moduleValue3;
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
const activePerksBitmask = a0.activePerksBitmask;
|
|
const Math = global.Math;
|
|
let value = Math.floor(a1 / 64);
|
|
const value2 = value >= activePerksBitmask.length;
|
|
if (value2) {
|
|
r0 = !value2;
|
|
} else {
|
|
moduleValue = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
has = moduleValue.has;
|
|
value = (importAll(483) /* metro dependency 483: BigFlagUtils */).deserialize(activePerksBitmask[value]);
|
|
moduleValue3 = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
value = Reflect.apply(has, moduleValue, [value, moduleValue3.getFlag(a1 % 64)]);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getPerkSource(a0, a1) { // fn#20534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2020:645, offset: 0x00ecbffe, size: 129 bytes, params: 3, frame: 16
|
|
var configByPerk;
|
|
var String;
|
|
var value;
|
|
var property;
|
|
if (a0 != null) {
|
|
configByPerk = a0.configByPerk;
|
|
String = global.String;
|
|
value = undefined;
|
|
property = configByPerk[String(a1)];
|
|
return (property == null ? value : property.source) != null ? property.source : hasPerk(a0,
|
|
a1) ? [(require(1895) /* metro dependency 1895: user */).PerkSource.SOURCE_NITRO] : value;
|
|
}
|
|
}
|
|
|
|
function parseServerPerks(a0) { // fn#20535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2020:920, offset: 0x00ecc07f, size: 167 bytes, params: 2, frame: 23
|
|
var r4;
|
|
var property;
|
|
var value4;
|
|
var property2;
|
|
var object3;
|
|
var source;
|
|
var value5;
|
|
if (a0 == null) {
|
|
return null;
|
|
}
|
|
const object4 = {};
|
|
const Object = global.Object;
|
|
const value = Object.entries(a0.config_by_perk);
|
|
let length = value.length;
|
|
const value2 = 0;
|
|
if (value2 < length) {
|
|
r4 = value2;
|
|
reducibleLoop2: while (true) {
|
|
property = value[r4];
|
|
value4 = env0_3(property, 2);
|
|
property = value4[value2];
|
|
property2 = value4[1];
|
|
object3 = {};
|
|
source = property2.source;
|
|
object3.source = source;
|
|
object3.kind = parseServerPerkConfigKind(property2);
|
|
object4[property] = object3;
|
|
value5 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
|
|
length = value.length;
|
|
if (value5 < length) {
|
|
r4 = value5;
|
|
continue reducibleLoop2;
|
|
}
|
|
break reducibleLoop2;
|
|
}
|
|
}
|
|
return {activePerksBitmask: a0.active_perks_bitmask, configByPerk: object4, rulesVersion: a0.rules_version};
|
|
}
|
|
|
|
function getPerkConfig(a0, a1) { // fn#20536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2020:1290, offset: 0x00ecc126, size: 75 bytes, params: 3, frame: 15
|
|
var object2;
|
|
if (a0 != null) {
|
|
var configByPerk = a0.configByPerk;
|
|
var String = global.String;
|
|
var property = configByPerk[String(a1)];
|
|
if (property != null) {
|
|
object2 = {};
|
|
object2.source = getPerkSource(a0, a1);
|
|
object2.kind = property.kind;
|
|
return object2;
|
|
}
|
|
}
|
|
}
|
|
|