/* Metro module 9500; source: modules/quests/utils/QuestRewardUtils.tsx; dependencies: [5121, 9501, 7098, 7091, 3381, 1244, 9502, 9503, 9504, 9505, 9506, 6531, 2] */ function _fun74129(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:6, offset: 0x01d82096, size: 573 bytes, params: 8, frame: 27 const env0_0 = require; const closure = function(a0) { var value = a0.rewardsConfig.rewards.find(_fun74131); var value2 = null; return (value2 == value ? undefined : value.type) !== require(dependencyMap[2]).QuestRewardTypes.COLLECTIBLE ? value2 : value; }; const closure2 = function(a0) { return a0.rewardsConfig.rewards.some(_fun74133); }; const closure3 = function(a0) { return a0.rewardsConfig.rewards.some(_fun74135); }; const closure4 = function(a0) { var r2; r2 = a0.rewardsConfig.rewards.find(_fun74137)?.premiumOrbQuantity; return r2 != null && r2 > 0; }; const closure5 = function(a0) { return a0.rewardsConfig.rewards.find(_fun74139)?.orbQuantity; }; const closure6 = isCollectibleQuestRewardPremiumExtendable; const closure7 = getQuestOrbMultiplier; const closure8 = getQuestOrbRewardQuantityForUser; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const collectiblesCategoryStore = importDefault(5121) /* metro dependency 5121: CollectiblesCategoryStore */; const Set = global.Set; const {PREMIUM_EXTENSION, PREMIUM_PERMANENT} = (require(9501) /* metro dependency 9501: QuestRewardExpirationMode */).QuestRewardExpirationMode; const set = new Set([PREMIUM_EXTENSION, PREMIUM_PERMANENT]); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/utils/QuestRewardUtils.tsx'); exports.getCollectiblesQuestReward = closure; exports.getCollectibleQuestRewardExtendableExpirationDate = getCollectibleQuestRewardExtendableExpirationDate; exports.getCollectibleQuestRewardDuration = getCollectibleQuestRewardDuration; exports.hasFractionalPremiumQuestReward = closure2; exports.hasVirtualCurrencyReward = closure3; exports.hasPremiumOrbQuantity = closure4; exports.hasCollectiblesQuestReward = hasCollectiblesQuestReward; exports.hasInGameQuestReward = function(a0) { return a0.rewardsConfig.rewards.some(_fun74150); }; exports.hasQuestRewardCode = function(a0) { return a0.rewardsConfig.rewards.some(_fun74152); }; exports.getInGameQuestReward = function(a0) { var value = a0.rewardsConfig.rewards.find(_fun74154); var value2 = null; return value2 != value ? value : value2; }; exports.getCollectiblesQuestRewardItem = getCollectiblesQuestRewardItem; exports.getVirtualCurrencyRewardOrbQuantity = closure5; exports.getVirtualCurrencyRewardPremiumOrbQuantity = function(a0) { var value = a0.rewardsConfig.rewards.find(_fun74157); var value2 = undefined; if ((value == null ? value2 : value.type) === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY) { return value.premiumOrbQuantity; } return value2; }; exports.isCollectibleQuestRewardPremiumExtendable = closure6; exports.isCollectibleQuestRewardPermanentWithPremiumSubscription = isCollectibleQuestRewardPermanentWithPremiumSubscription; exports.getQuestPrimaryReward = function(a0) { var property = a0.userStatus; var r2 = property?.claimedTier ?? 0; value = 'rewardsConfig' in a0.config; property = a0.config; return value ? property.rewardsConfig.rewards[r2] : property.rewards[r2]; }; exports.getQuestOrbMultiplier = closure7; exports.getQuestOrbMultiplierForUser = getQuestOrbMultiplierForUser; exports.getQuestOrbRewardQuantityForUser = closure8; exports.getDefaultRewardName = function(a0, a1) { return _getDefaultRewardName(a0, a1, false); }; exports.getDefaultRewardNameWithArticle = function(a0, a1) { return _getDefaultRewardName(a0, a1, true); }; exports.getRewardCodeQuestReward = function({quest, idx}) { var value = null; if (value == idx) { return value; } quest = quest.config.rewardsConfig.rewards[idx]; return quest.type !== require(dependencyMap[2]).QuestRewardTypes.REWARD_CODE ? value : quest; }; exports.isTieredRewardCodeQuest = isTieredRewardCodeQuest; exports.getDefaultPlatform = function(a0) { var property = a0.rewardsConfig.platforms; return property.length > 0 ? property[0] : require(dependencyMap[11]).QuestRewardCodePlatforms.CROSS_PLATFORM; }; exports.getPlatformString = getPlatformString; } function getCollectiblesQuestReward({rewardsConfig}) { // fn#74130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:226, offset: 0x01d822d3, size: 99 bytes, params: 2, frame: 15 const value = rewardsConfig.rewards.find(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.COLLECTIBLE; }); const type = value?.type; const QuestRewardTypes = (require(7098) /* metro dependency 7098: QuestRewardTypes */).QuestRewardTypes; const COLLECTIBLE = QuestRewardTypes.COLLECTIBLE; return type !== COLLECTIBLE ? null : value; } function hasFractionalPremiumQuestReward({rewardsConfig}) { // fn#74132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:430, offset: 0x01d82369, size: 37 bytes, params: 2, frame: 11 return rewardsConfig.rewards.some(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.FRACTIONAL_PREMIUM; }); } function hasVirtualCurrencyReward({rewardsConfig}) { // fn#74134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:570, offset: 0x01d823c1, size: 37 bytes, params: 2, frame: 11 return rewardsConfig.rewards.some(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY; }); } function hasPremiumOrbQuantity({rewardsConfig}) { // fn#74136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:701, offset: 0x01d82419, size: 67 bytes, params: 2, frame: 12 const premiumOrbQuantity = rewardsConfig.rewards.find(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY; })?.premiumOrbQuantity; return premiumOrbQuantity != null && premiumOrbQuantity > 0; } function getVirtualCurrencyRewardOrbQuantity({rewardsConfig}) { // fn#74138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:886, offset: 0x01d8245c, size: 54 bytes, params: 2, frame: 11 return rewardsConfig.rewards.find(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY; })?.orbQuantity; } function isCollectibleQuestRewardPremiumExtendable(a0) { // fn#74140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:1063, offset: 0x01d82492, size: 55 bytes, params: 2, frame: 13 const getCollectiblesQuestRewardBinding = getCollectiblesQuestReward; const value2 = undefined; const collectiblesQuestRewardBinding = getCollectiblesQuestRewardBinding(a0); const expirationMode = collectiblesQuestRewardBinding == null ? value2 : collectiblesQuestRewardBinding.expirationMode; return expirationMode != null && env0_3.has(expirationMode); } function getQuestOrbMultiplier({rewardsConfig}) { // fn#74141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:1214, offset: 0x01d824c9, size: 158 bytes, params: 2, frame: 15 const value = rewardsConfig.rewards.find(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY; }); const type = value?.type; const QuestRewardTypes = (require(7098) /* metro dependency 7098: QuestRewardTypes */).QuestRewardTypes; const VIRTUAL_CURRENCY = QuestRewardTypes.VIRTUAL_CURRENCY; if (type !== VIRTUAL_CURRENCY) { return null; } const premiumOrbQuantity = value.premiumOrbQuantity; const orbQuantity = value.orbQuantity; return premiumOrbQuantity == null || orbQuantity === 0 ? null : global.Math.round(premiumOrbQuantity / orbQuantity * 100) / 100; } function getQuestOrbRewardQuantityForUser(a0, a1) { // fn#74143, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:1519, offset: 0x01d82567, size: 158 bytes, params: 3, frame: 16 var r2; var moduleValue2; const value = a0.rewardsConfig.rewards.find(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY; }); if (value == null) { return null; } if (a1 == null) { return value.orbQuantity; } if (hasPremiumOrbQuantity(a0)) { moduleValue2 = require(9503) /* metro dependency 9503: QuestOrbMultiplierUtils */; r2 = moduleValue2.shouldReceiveQuestOrbMultiplier((require(9502) /* metro dependency 9502: QuestOrbMultiplierHooks */).getQuestOrbMultiplierEligibilityForUser(a1)) && value.premiumOrbQuantity != null ? value.premiumOrbQuantity : value.orbQuantity; } else { r2 = value.orbQuantity; } return r2; } function _getDefaultRewardName(a0, a1, a2) { // fn#74145, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:1899, offset: 0x01d82605, size: 231 bytes, params: 4, frame: 18 var r7; var intl; if (hasFractionalPremiumQuestReward(a0)) { return (require(9504) /* metro dependency 9504: FractionalPremiumUtils */).getFractionalPremiumQuestRewardName(a0); } if (hasVirtualCurrencyReward(a0)) { r7 = getQuestOrbRewardQuantityForUser(a0, a1) ?? getVirtualCurrencyRewardOrbQuantity(a0) ?? 0; intl = (require(1244) /* metro dependency 1244: indexNative */).intl; return intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t['nLXlh+'], {orbAmount: r7}); } const value = require(9505) /* metro dependency 9505: QuestCopyUtils */; const getDefaultReward = value.getDefaultReward; const messages = Reflect.apply(getDefaultReward, value, [a0]).messages; return a2 ? messages.nameWithArticle : messages.name; } function getCollectibleQuestRewardExtendableExpirationDate(a0) { // fn#74146, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:2580, offset: 0x01d826ec, size: 95 bytes, params: 2, frame: 14 var r0; var value; const collectiblesQuestReward = getCollectiblesQuestReward(a0); const value3 = null; if (value3 != collectiblesQuestReward) { if ('expiresAtPremium' in collectiblesQuestReward) { if (value3 != collectiblesQuestReward.expiresAtPremium) { value = require(7091) /* metro dependency 7091: QuestDataUtils */; value = value.getQuestFormattedDate(collectiblesQuestReward.expiresAtPremium); r0 = value; } else { r0 = value3; } } else { r0 = value3; } } else { r0 = value3; } return r0; } function getCollectibleQuestRewardDuration(a0) { // fn#74147, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:2836, offset: 0x01d8274b, size: 554 bytes, params: 2, frame: 22 var expiresAt; var Date; var prototype; var value3; var date; var value4; var value5; var value6; var value7; var value8; var value9; var value11; var value12; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; const t = (require(1244) /* metro dependency 1244: indexNative */).t; const collectiblesQuestReward = getCollectiblesQuestReward(a0); if (collectiblesQuestReward != null) { if ('expiresAt' in collectiblesQuestReward) { expiresAt = collectiblesQuestReward.expiresAt; if (expiresAt == null) { return null; } Date = global.Date; expiresAt = a0.expiresAt; prototype = Date.prototype; value3 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value4 = date instanceof Object ? date : value3; Date = global.Date; expiresAt = collectiblesQuestReward.expiresAt; prototype = Date.prototype; value5 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value6 = date instanceof Object ? date : value5; value7 = (require(3381) /* metro dependency 3381 */).differenceInDays(value6, value4); value8 = global.Math.floor(value7 / 30); value9 = 0; value11 = value8 + (value7 % 30 >= 25 ? 1 : value9); if (value11 >= 12) { return intl.formatToPlainString(t.PClsrw, {years: global.Math.floor(value11 / 12)}); } if (value11 > value9) { return intl.formatToPlainString(t.kridzK, {months: value11}); } value12 = (require(3381) /* metro dependency 3381 */).differenceInDays(value6, value4); if (value12 >= 7) { return intl.formatToPlainString(t.EmoBD2, {weeks: global.Math.ceil(value12 / 7)}); } return intl.formatToPlainString(t['k2UNz+'], {days: value12}); } } return null; } function hasCollectiblesQuestReward(a0) { // fn#74148, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:3683, offset: 0x01d82975, size: 25 bytes, params: 2, frame: 11 return getCollectiblesQuestReward(a0) != null; } function hasInGameQuestReward({rewardsConfig}) { // fn#74149, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:3789, offset: 0x01d8298e, size: 37 bytes, params: 2, frame: 11 return rewardsConfig.rewards.some(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.IN_GAME; }); } function hasQuestRewardCode({rewardsConfig}) { // fn#74151, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:3929, offset: 0x01d829e6, size: 37 bytes, params: 2, frame: 11 return rewardsConfig.rewards.some(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.REWARD_CODE; }); } function getInGameQuestReward({rewardsConfig}) { // fn#74153, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:4073, offset: 0x01d82a3e, size: 49 bytes, params: 2, frame: 11 return rewardsConfig.rewards.find(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.IN_GAME; }) ?? null; } function getCollectiblesQuestRewardItem(a0) { // fn#74155, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:4248, offset: 0x01d82a6f, size: 92 bytes, params: 2, frame: 14 const getCollectiblesQuestRewardBinding = getCollectiblesQuestReward; const value2 = undefined; const collectiblesQuestRewardBinding = getCollectiblesQuestRewardBinding(a0); const value4 = null; const product = CollectiblesCategoryStore.getProduct(value4 == collectiblesQuestRewardBinding ? value2 : collectiblesQuestRewardBinding.skuId); const r1 = value4 == product || value4 == product.items ? value2 : product.items[0]; return value4 != r1 ? r1 : value4; } function getVirtualCurrencyRewardPremiumOrbQuantity({rewardsConfig}) { // fn#74156, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:4559, offset: 0x01d82acb, size: 102 bytes, params: 2, frame: 14 const value = rewardsConfig.rewards.find(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.VIRTUAL_CURRENCY; }); const type = value?.type; const QuestRewardTypes = (require(7098) /* metro dependency 7098: QuestRewardTypes */).QuestRewardTypes; const VIRTUAL_CURRENCY = QuestRewardTypes.VIRTUAL_CURRENCY; if (type === VIRTUAL_CURRENCY) { return value.premiumOrbQuantity; } } function isCollectibleQuestRewardPermanentWithPremiumSubscription(a0) { // fn#74158, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:4953, offset: 0x01d82b31, size: 84 bytes, params: 2, frame: 14 var r0; var collectiblesQuestReward; const isCollectibleQuestRewardPremiumExtendableBinding = isCollectibleQuestRewardPremiumExtendable; const value2 = undefined; const isCollectibleQuestRewardPremiumExtendable2 = isCollectibleQuestRewardPremiumExtendableBinding(a0); if (isCollectibleQuestRewardPremiumExtendable2) { collectiblesQuestReward = getCollectiblesQuestReward(a0); r0 = (collectiblesQuestReward == null ? value2 : collectiblesQuestReward.expirationMode) === (require(9501) /* metro dependency 9501: QuestRewardExpirationMode */).QuestRewardExpirationMode.PREMIUM_PERMANENT; } else { r0 = isCollectibleQuestRewardPremiumExtendable2; } return r0; } function getQuestOrbMultiplierForUser(a0, a1) { // fn#74160, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:5494, offset: 0x01d82be0, size: 132 bytes, params: 3, frame: 17 var r0; if (a1 == null) { return 1; } var value; const questOrbMultiplier = getQuestOrbMultiplier(a0); const value3 = 1; if (hasPremiumOrbQuantity(a0)) { value = require(9503) /* metro dependency 9503: QuestOrbMultiplierUtils */; r0 = value.shouldReceiveQuestOrbMultiplier((require(9502) /* metro dependency 9502: QuestOrbMultiplierHooks */).getQuestOrbMultiplierEligibilityForUser(a1)) ? questOrbMultiplier ?? value3 : value3; } else { r0 = value3; } return r0; } function isTieredRewardCodeQuest({quest}) { // fn#74164, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:6255, offset: 0x01d82cfa, size: 119 bytes, params: 2, frame: 13 const rewardsConfig = quest.config.rewardsConfig; const assignmentMethod = rewardsConfig.assignmentMethod; const QuestRewardAssignmentMethods = (require(9506) /* metro dependency 9506: QuestRewardAssignmentMethods */).QuestRewardAssignmentMethods; const TIERED = QuestRewardAssignmentMethods.TIERED; return assignmentMethod === TIERED && rewardsConfig.rewards.length > 0 && rewardsConfig.rewards.every(function({type}) { return type === require(dependencyMap[2]).QuestRewardTypes.REWARD_CODE; }); } function getPlatformString(a0) { // fn#74167, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9686:6673, offset: 0x01d82db8, size: 482 bytes, params: 2, frame: 15 const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; const t = (require(1244) /* metro dependency 1244: indexNative */).t; const QuestRewardCodePlatforms = (require(6531) /* metro dependency 6531: QuestTypes */).QuestRewardCodePlatforms; const XBOX = QuestRewardCodePlatforms.XBOX; if (XBOX === a0) { return intl.string(t.G84UWZ); } const PLAYSTATION = QuestRewardCodePlatforms.PLAYSTATION; if (PLAYSTATION === a0) { return intl.string(t['6IeKx2']); } const SWITCH = QuestRewardCodePlatforms.SWITCH; if (SWITCH === a0) { return intl.string(t['1pp0su']); } const PC = QuestRewardCodePlatforms.PC; if (PC === a0) { return intl.string(t['YK+wUg']); } const CROSS_PLATFORM = QuestRewardCodePlatforms.CROSS_PLATFORM; if (CROSS_PLATFORM === a0) { return intl.string(t.UWVbzV); } }