// Metro module 1890 (f1891). import { PerkConfigType } from "./types"; import { has, deserialize, getFlag } from "../../../_bundle/HighLow"; import { PerkSource } from "../../../_bundle/Module1892"; let getPerkSource; const parseServerPerkConfigKind = function parseServerPerkConfigKind(a0) { if (a0.kind != null) { const 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 }; } return void 0; } }; getPerkSource = function getPerkSource(a0, a1) { let source; if (a0 != null) { const r20 = a0.configByPerk[String(a1)]; if (r20?.source != null) { source = r20.source; } else { const r23 = a0 == null; let r8 = false; if (!r23) { const activePerksBitmask = a0.activePerksBitmask; const r10 = Math.floor(a1 / 64); r8 = !(r10 >= activePerksBitmask.length) && has(deserialize(activePerksBitmask[r10]), getFlag(a1 % 64)); } source = r8 ? [PerkSource.SOURCE_NITRO] : void 0; } return source; } }; export function parseServerPerks(a0) { if (a0 == null) { return null; } const configByPerk = {}; for (const item of Object.entries(a0.config_by_perk)) { const [r34, r12] = item; configByPerk[r34] = { source: r12.source, kind: parseServerPerkConfigKind(r12) }; } return { activePerksBitmask: a0.active_perks_bitmask, configByPerk, rulesVersion: a0.rules_version }; } export function hasPerk(a0, a1) { if (a0 == null) { return false; } const activePerksBitmask = a0.activePerksBitmask; const r5 = Math.floor(a1 / 64); return !(r5 >= activePerksBitmask.length) && has(deserialize(activePerksBitmask[r5]), getFlag(a1 % 64)); } export { getPerkSource }; export function getPerkConfig(a0, a1) { if (a0 != null) { const r9 = a0.configByPerk[String(a1)]; if (r9 != null) { return { source: getPerkSource(a0, a1), kind: r9.kind }; } } }