decord/beta/source/utils/PremiumUtils.tsx

3975 lines
139 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 4769
// Function ID: 4770
// Name: PremiumUtils
2026-10-12 16:32:48 +00:00
// Dependencies: [32, 19, 4770, 1390, 4771, 4772, 4774, 4775, 1085, 1392, 4783, 1096, 3, 558, 576, 4784, 4781, 1989, 38, 1126, 2632, 3280, 4702, 4793, 4800, 6940, 4782, 13753, 1102, 504, 10504, 7761, 5640, 14294, 1396, 1398, 9504, 2]
// Exports: calculateYearlyPlanDollarSavingsAmount, calculateYearlyPlanMonthlyRateAmount, castPremiumSubscriptionAsSkuId, coerceExistingItemsToNewItemInterval, experimentalGetPrice, extendDateWithUnconsumedFractionalPremium, formatInterval, formatIntervalDuration, formatPriceString, formatSubscriptionPlanRate, formatTrialCtaIntervalDurationFromTrialOffer, formatTrialOfferIntervalDuration, getBillingInformationString, getBillingReviewSubheader, getCountryPrices, getDaysRemainingUntilSubscriptionCurrentPeriodEnds, getDaysSincePremium, getDiscountIntervalString, getDisplayNameFromSku, getExternalPlanDisplayName, getExternalSubscriptionMethodUrl, getFormattedPlanPriceFromInvoice, getFormattedRateForPlan, getFractionalPremiumUnitsHours, getFractionalPremiumUnitsHoursFromSkuIds, getGuildBoostPlanItem, getInterval, getIntervalForInvoice, getIntervalString, getIntervalStringAsNoun, getItemsFromNewAdditionalPlans, getItemsWithUpsertedPremiumGuildPlan, getItemsWithUpsertedPremiumPlanId, getItemsWithoutPremiumPlanItem, getMaxFileSizeForPremiumType, getOfferNoticeThreshold, getPlanDescriptionFromInvoice, getPlanIdForPremiumType, getPlanIdFromInvoice, getPremiumBranding, getPremiumGuildHeaderDescription, getPremiumPlanItem, getPremiumPlanOptions, getPremiumSkuIdForSubscription, getPremiumType, getPremiumTypeDisplayName, getPremiumTypeFromPlanId, getPremiumTypeFromSubscription, getSavingsPercent, getStatusFromInvoice, getSubscriptionWithNewPlansTotalServerPrice, getSwitchingPlansDisabledMessage, getTierDisplayNameByPlanId, getUnactivatedFractionalPremiumDurationString, hasPremiumSubscriptionToDisplay, isBaseSubscriptionCanceled, isBoostOnlySubscription, isDiscountOffer, isNewUser, isNitroLockedState, isPremiumBaseSubscriptionPlan, isPremiumEligible, isPremiumGroupSubscriptionPlan, isPremiumGuildSubscriptionPlan, isPremiumSubscriptionPlan, isPrepaidPaymentSource, isSubscriptionPrepaidPaymentSource, isSubscriptionStatusFailedPayment, isSwitchingPlansDisabled, isTrialOffer, subscriptionHasPremiumGuildPlan, withContextPlanPrices
2026-10-12 16:32:48 +00:00
// Module 4769 (PremiumUtils)
import LoggerDefault from "Logger" /* 3 */;
import _modDef38 from "module_38" /* 38 */;
2026-10-01 14:13:23 +00:00
import get_initialized from "get initialized" /* 504 */;
2026-10-02 13:37:24 +00:00
import react2 from "react" /* 576 */;
2026-10-07 22:43:51 +00:00
import DurationsDefault from "Durations" /* 1102 */;
import intl30 from "intl" /* 1126 */;
2026-10-12 16:32:48 +00:00
import PerksStateUtils from "PerksStateUtils" /* 1396 */;
import PremiumTypeUtils from "PremiumTypeUtils" /* 1989 */;
import _modDef2632 from "module_2632" /* 2632 */;
import _modDef3280 from "module_3280" /* 3280 */;
import _modDef4702 from "module_4702" /* 4702 */;
import SubscriptionPlanRecord from "SubscriptionPlanRecord" /* 4770 */;
import PremiumSubscription from "PremiumSubscription" /* 4781 */;
import PremiumGroupConstants from "PremiumGroupConstants" /* 4783 */;
import BillingUtils from "BillingUtils" /* 4784 */;
import openURLDefault from "openURL" /* 4800 */;
import FileSizeUtils from "FileSizeUtils" /* 5640 */;
import PriceUtils from "PriceUtils" /* 6940 */;
import NitroFileUploadExperiments from "NitroFileUploadExperiments" /* 7761 */;
import PremiumFeatureUtils from "PremiumFeatureUtils" /* 9504 */;
import CheckoutError from "CheckoutError" /* 10504 */;
import useFPDurationLeft from "useFPDurationLeft" /* 13753 */;
import ProductCatalog from "ProductCatalog" /* 14294 */;
2026-10-01 14:13:23 +00:00
import _slicedToArray from "_slicedToArray" /* 32 */;
import react from "react" /* 19 */;
2026-10-12 16:32:48 +00:00
import UserStore from "UserStore" /* 1390 */;
import BillingInfoStore from "BillingInfoStore" /* 4771 */;
import PaymentSourceStore from "PaymentSourceStore" /* 4772 */;
import SubscriptionPlanStore from "SubscriptionPlanStore" /* 4774 */;
import SubscriptionStore from "SubscriptionStore" /* 4775 */;
2026-10-07 22:43:51 +00:00
import Constants_mod from "Constants" /* 1085 */;
2026-10-12 16:32:48 +00:00
import PremiumConstants from "PremiumConstants" /* 1392 */;
2026-10-07 22:43:51 +00:00
import Constants_mod2 from "Constants" /* 1096 */;
2026-10-02 13:37:24 +00:00
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-01 14:13:23 +00:00
let importDefault, obj, subscriptionPlanId;
let SubscriptionPlans;
2026-10-02 13:37:24 +00:00
let canUseCollectibles;
let canUseQuestOrbMultiplier;
2026-10-01 14:13:23 +00:00
let closure_12;
let closure_14;
let closure_15;
let closure_16;
let closure_17;
let closure_18;
let closure_19;
let closure_20;
let closure_21;
let closure_22;
let closure_23;
let closure_24;
let closure_25;
let closure_26;
let closure_27;
let closure_28;
let closure_29;
let closure_30;
let closure_31;
let closure_32;
let closure_33;
let closure_34;
let closure_35;
let closure_36;
let closure_37;
let closure_38;
let closure_39;
let closure_40;
let closure_41;
let closure_42;
let closure_44;
let closure_45;
let closure_46;
let closure_48;
let closure_49;
let closure_50;
2026-10-02 13:37:24 +00:00
let getSkuIdForPlan;
2026-10-01 14:13:23 +00:00
let map1;
let tmp;
let tmp5;
let unpackModuleId;
2026-10-12 16:32:48 +00:00
const user2 = tmp(1398);
const DateUtils = tmp5(4793);
const f90526 = (planId) => set.has(planId.planId);
const f90539 = (planId) => set.has(planId.planId);
const f90541 = (planId) => !set.has(planId.planId);
const f90545 = (planId) => set.has(planId.planId);
const f90546 = (skuId) => skuId.skuId;
const f90547 = (acc, item) => {
2026-10-01 14:13:23 +00:00
let first;
let tmp3;
[first, tmp3] = closure_1_23[item];
let num = 1;
if (constants.HOUR !== first) {
num = 1;
if (constants.DAY === first) {
num = 24;
}
}
return acc + num * tmp3;
};
function getDefaultPrice(PREMIUM_MONTH_TIER_2, arg1, flag, currency, flag2) {
flag = arg1;
if (arg1 === undefined) {
flag = false;
}
flag2 = flag;
if (flag === undefined) {
flag2 = false;
}
let flag3 = flag2;
2026-10-01 14:13:23 +00:00
const tmp = currency;
if (flag2 === undefined) {
flag3 = true;
}
let paymentSourceId = PaymentSourceStore.defaultPaymentSourceId;
const premiumTypeSubscription = SubscriptionStore.getPremiumTypeSubscription();
2026-10-01 14:13:23 +00:00
const tmp3 = null != premiumTypeSubscription && null != premiumTypeSubscription.paymentSourceId;
if (tmp3) {
paymentSourceId = premiumTypeSubscription.paymentSourceId;
}
2026-10-01 14:13:23 +00:00
obj = { paymentSourceId, currency: tmp };
return getPrice(PREMIUM_MONTH_TIER_2, flag, flag2, obj, flag3);
}
function getPrice(planId) {
2026-10-01 14:13:23 +00:00
let contextPlanPrices;
let currency;
let currency2;
let obj21;
let obj8;
let obj9;
let paymentSourceId;
let paymentSourceId2;
let purchaseType;
let str;
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
let flag2 = arg2;
if (arg2 === undefined) {
flag2 = false;
}
obj = arg3;
if (arg3 === undefined) {
obj = {};
}
let flag3 = arg4;
if (arg4 === undefined) {
flag3 = true;
}
({ paymentSourceId, currency, contextPlanPrices } = obj);
if (null != contextPlanPrices) {
2026-10-01 14:13:23 +00:00
const tmp2 = null != currency && null != contextPlanPrices[planId] && contextPlanPrices[planId].currency !== currency;
if (null != contextPlanPrices[planId]) {
if (!tmp2) {
2026-10-01 14:13:23 +00:00
const obj3 = { amount: null, currency: null, exponent: null, tax: 0, taxInclusive: false };
({ amount: obj2.amount, currency: obj2.currency, exponent: obj2.exponent } = contextPlanPrices[planId]);
return obj3;
}
}
}
if (null != SubscriptionPlanStore.get(planId)) {
2026-10-01 14:13:23 +00:00
let first;
let str2 = map1.DEFAULT;
if (flag2) {
2026-10-01 14:13:23 +00:00
str2 = tmp10.GIFT;
} else if (flag) {
2026-10-01 14:13:23 +00:00
str2 = tmp10.PREMIUM_TIER_1;
}
2026-10-01 14:13:23 +00:00
const obj4 = { paymentSourceId, purchaseType: str2, currency };
({ paymentSourceId: paymentSourceId2, purchaseType, currency: currency2 } = obj4);
const obj5 = { paymentSourceId: paymentSourceId2, purchaseType };
const arr = experimentalGetPrices(planId, obj5);
const tmp11 = experimentalGetPrices;
if (0 === arr.length) {
const _HermesInternal = HermesInternal;
logger.warn("No prices found for planId: " + planId + ", paymentSourceId: " + paymentSourceId2 + ", purchaseType: " + purchaseType);
}
if (null != currency2) {
let found = arr.find((currency) => currency.currency === currency.toLowerCase());
if (null == found) {
let found1;
if (null != paymentSourceId2) {
2026-10-01 14:13:23 +00:00
const obj6 = { purchaseType };
const tmp11Result = tmp11(planId, obj6);
found1 = tmp11Result.find((currency) => currency.currency === currency.toLowerCase());
}
found = found1;
}
2026-10-01 14:13:23 +00:00
first = found;
} else {
first = arr[0];
}
if (null == first) {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Couldn't find price");
if (flag3) {
2026-10-01 14:13:23 +00:00
const obj7 = { extra: obj8, tags: obj9 };
obj8 = { paymentSourceId };
obj9 = { purchaseType: str2.toString(), planId, currency };
const captureBillingException2 = BillingUtils.captureBillingException;
BillingUtils;
if (currency == null) {
currency = "unknown";
}
2026-10-01 14:13:23 +00:00
const result = captureBillingException2(error, obj7);
}
throw error;
} else {
return first;
}
} else {
const _Error2 = Error;
2026-10-01 14:13:23 +00:00
const self3 = this;
const self4 = this;
const error1 = new Error("Plan not found");
if (flag3) {
2026-10-01 14:13:23 +00:00
const obj10 = { planId, currency: str };
str = currency;
const captureBillingException = BillingUtils.captureBillingException;
BillingUtils;
if (currency == null) {
str = "unknown";
}
2026-10-01 14:13:23 +00:00
const obj11 = { tags: obj10, extra: obj21 };
obj21 = { isGift: flag2 };
const merged = Object.assign(obj);
2026-10-01 14:13:23 +00:00
const result1 = captureBillingException(error1, obj11);
}
throw error1;
}
}
function getPurchaseTypePrices(planId, DEFAULT) {
2026-10-01 14:13:23 +00:00
const value = SubscriptionPlanStore.get(planId);
if (null == value) {
const _Error3 = Error;
2026-10-01 14:13:23 +00:00
const self5 = this;
const self6 = this;
const error = new Error("Plan not found");
2026-10-01 14:13:23 +00:00
obj = { tags: obj2 };
obj2 = { planId, purchaseType: DEFAULT.toString() };
const captureBillingException = BillingUtils.captureBillingException;
BillingUtils;
const result = captureBillingException(error, obj);
throw error;
} else if (null == value.prices) {
const _Error2 = Error;
const _HermesInternal3 = HermesInternal;
2026-10-01 14:13:23 +00:00
const self3 = this;
const self4 = this;
const error1 = new Error("No prices returned for " + planId + ", is your user in the experiment?");
throw error1;
} else if (null == value.prices[DEFAULT]) {
const _JSON = JSON;
const _Object = Object;
const _HermesInternal = HermesInternal;
logger.info("Purchase types: " + JSON.stringify(Object.keys(value.prices)));
const _Error = Error;
const _HermesInternal2 = HermesInternal;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error2 = new Error("No prices returned for purchase type " + DEFAULT + " for plan " + planId);
throw error2;
} else {
2026-10-01 14:13:23 +00:00
return value.prices[DEFAULT];
}
}
function experimentalGetPrices(planId, arg1) {
2026-10-01 14:13:23 +00:00
let obj3;
let obj4;
let obj7;
let paymentSourceId;
let purchaseType;
let tmp = arg1;
if (arg1 === undefined) {
2026-10-01 14:13:23 +00:00
tmp = { purchaseType: map1.DEFAULT };
obj = { purchaseType: map1.DEFAULT };
}
({ paymentSourceId, purchaseType } = tmp);
const tmp3 = getPurchaseTypePrices(planId, purchaseType);
if (null != paymentSourceId) {
if (null == tmp3.paymentSourcePrices[paymentSourceId]) {
const _JSON = JSON;
const _Object = Object;
const _HermesInternal = HermesInternal;
logger.info("Payment sources IDs: " + JSON.stringify(Object.keys(tmp3.paymentSourcePrices)));
const _HermesInternal2 = HermesInternal;
2026-10-01 14:13:23 +00:00
logger.info("prices: " + tmp3.paymentSourcePrices[paymentSourceId]);
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Missing prices for payment source on subscription plan");
2026-10-01 14:13:23 +00:00
obj2 = { extra: obj3, tags: obj4 };
obj3 = { paymentSourceId };
obj4 = { purchaseType: purchaseType.toString(), planId };
const captureBillingException = BillingUtils.captureBillingException;
BillingUtils;
const result = captureBillingException(error, obj2);
} else if (0 !== tmp3.paymentSourcePrices[paymentSourceId].length) {
return tmp3.paymentSourcePrices[paymentSourceId];
}
}
if (null == tmp3.countryPrices.prices) {
const _JSON2 = JSON;
const _HermesInternal3 = HermesInternal;
logger.info("countryPrices: " + JSON.stringify(tmp3.countryPrices));
const _Error2 = Error;
2026-10-01 14:13:23 +00:00
const self3 = this;
const self4 = this;
const error1 = new Error("Missing prices for country");
2026-10-01 14:13:23 +00:00
const obj6 = { tags: obj7 };
obj7 = { countryCode: tmp3.countryPrices.countryCode, planId };
const obj5 = BillingUtils;
const result1 = obj5.captureBillingException(error1, obj6);
throw error1;
} else {
return tmp3.countryPrices.prices;
}
}
function getServerPriceFromClientPrice(amount) {
return { amount: amount.amount, currency: amount.currency, exponent: amount.exponent };
}
function getItemPlansTotalServerPrice(items, currency, id) {
obj = { currency, amount: 0, tax: 0, taxInclusive: false };
2026-10-01 14:13:23 +00:00
obj2 = PremiumSubscription;
const baseSubscriptionItemForSubscriptionItems = obj2.getBaseSubscriptionItemForSubscriptionItems(items);
let premiumType;
if (null != baseSubscriptionItemForSubscriptionItems) {
2026-10-01 14:13:23 +00:00
premiumType = closure_42[baseSubscriptionItemForSubscriptionItems.planId].premiumType;
}
const tmpResult = PremiumTypeUtils;
2026-10-01 14:13:23 +00:00
const isPremiumAtLeastResult = tmpResult.isPremiumAtLeast(premiumType, closure_39.TIER_0);
const tmpResult2 = PremiumTypeUtils;
2026-10-01 14:13:23 +00:00
const isPremiumAtLeastResult1 = tmpResult2.isPremiumAtLeast(premiumType, closure_39.TIER_2);
const iter = items[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
2026-10-01 14:13:23 +00:00
let tmp21;
let tmp9 = nextResult;
let tmp11 = isPremiumAtLeastResult1;
if (!set.has(nextResult.planId)) {
let hasItem = set2.has(tmp9.planId);
2026-10-01 14:13:23 +00:00
let tmp15 = !hasItem && isPremiumAtLeastResult;
tmp11 = tmp15;
}
let tmp16 = tmp11;
if (undefined === id) {
let flag2 = false;
2026-10-01 14:13:23 +00:00
tmp21 = getDefaultPrice(tmp9.planId, tmp16, false, currency);
} else {
let obj3 = { paymentSourceId: id, currency };
let flag = false;
tmp21 = getPrice(tmp9.planId, tmp16, false, obj3);
}
obj.amount = obj.amount + tmp21.amount * tmp9.quantity;
continue;
}
return getServerPriceFromClientPrice(obj);
}
function getDisplayName(planId, arg1, arg2, duration) {
2026-10-01 14:13:23 +00:00
let obj8;
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
let flag2 = arg2;
if (arg2 === undefined) {
flag2 = false;
}
if (SubscriptionPlans.PREMIUM_MONTH_TIER_0 === planId) {
2026-10-01 14:13:23 +00:00
let formatResult;
const intl15 = intl30.intl;
if (flag) {
obj2 = { duration };
2026-10-07 22:43:51 +00:00
formatResult = intl15.format(tmp47(1126).t.TZXHNj, obj2);
} else {
const string8 = intl15.string;
2026-10-07 22:43:51 +00:00
const t8 = tmp47(1126).t;
if (flag2) {
formatResult = string8(t8["81iAgs"]);
} else {
formatResult = string8(t8["0efVPy"]);
}
}
return formatResult;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_YEAR_TIER_0 === planId) {
let formatResult1;
const intl14 = intl30.intl;
if (flag) {
const obj3 = { duration };
2026-10-07 22:43:51 +00:00
formatResult1 = intl14.format(tmp44(1126).t.eqRhC7, obj3);
} else {
const string7 = intl14.string;
2026-10-07 22:43:51 +00:00
const t7 = tmp44(1126).t;
if (flag2) {
formatResult1 = string7(t7.UvzqY1);
} else {
formatResult1 = string7(t7.eoVuBn);
}
}
return formatResult1;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_MONTH_TIER_1 === planId) {
let string6Result;
const intl13 = intl30.intl;
const string6 = intl13.string;
2026-10-01 14:13:23 +00:00
const t6 = intl30.t;
if (flag2) {
2026-10-01 14:13:23 +00:00
string6Result = string6(t6["g/dH5g"]);
} else {
string6Result = string6(t6["7O6qSq"]);
}
return string6Result;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_YEAR_TIER_1 === planId) {
let string5Result;
const intl12 = intl30.intl;
const string5 = intl12.string;
2026-10-01 14:13:23 +00:00
const t5 = intl30.t;
if (flag2) {
2026-10-01 14:13:23 +00:00
string5Result = string5(t5.pdZJaq);
} else {
string5Result = string5(t5.Md5xbi);
}
return string5Result;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_MONTH_TIER_2 === planId) {
let formatResult2;
const intl11 = intl30.intl;
if (flag) {
const obj4 = { duration };
2026-10-07 22:43:51 +00:00
formatResult2 = intl11.format(tmp35(1126).t.aI6QXz, obj4);
} else {
const string4 = intl11.string;
2026-10-07 22:43:51 +00:00
const t4 = tmp35(1126).t;
if (flag2) {
formatResult2 = string4(t4.SmVbHc);
} else {
formatResult2 = string4(t4.FKYNC6);
}
}
return formatResult2;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_GROUP_MONTH === planId) {
let stringResult;
const intl10 = intl30.intl;
const tmp29 = require;
if (flag2) {
2026-10-07 22:43:51 +00:00
stringResult = intl10.string(tmp29(1126).t.SmVbHc);
} else {
2026-10-01 14:13:23 +00:00
const formatToPlainString = intl10.formatToPlainString;
const obj5 = { premiumGroupProductName: closure_47() };
2026-10-12 16:32:48 +00:00
const v8bPDtb = _modDef3280["8bPDtb"];
2026-10-01 14:13:23 +00:00
stringResult = formatToPlainString(v8bPDtb, obj5);
}
return stringResult;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_YEAR_TIER_2 === planId) {
let formatResult3;
const intl9 = intl30.intl;
if (flag) {
const obj6 = { duration };
2026-10-07 22:43:51 +00:00
formatResult3 = intl9.format(tmp26(1126).t["1wBcPi"], obj6);
} else {
const string3 = intl9.string;
2026-10-07 22:43:51 +00:00
const t3 = tmp26(1126).t;
if (flag2) {
formatResult3 = string3(t3.JIq4O1);
} else {
formatResult3 = string3(t3["cfu/5d"]);
}
}
return formatResult3;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_3_MONTH_TIER_2 === planId) {
const intl8 = intl30.intl;
return intl8.string(intl30.t.wCbINr);
} else if (SubscriptionPlans.PREMIUM_6_MONTH_TIER_2 === planId) {
const intl7 = intl30.intl;
return intl7.string(intl30.t["e3/ArU"]);
} else if (SubscriptionPlans.PREMIUM_MONTH_GUILD === planId) {
let string2Result;
const intl6 = intl30.intl;
const string2 = intl6.string;
2026-10-01 14:13:23 +00:00
const t2 = intl30.t;
if (flag2) {
2026-10-01 14:13:23 +00:00
string2Result = string2(t2["6ZR3By"]);
} else {
string2Result = string2(t2["h80cx/"]);
}
return string2Result;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_YEAR_GUILD === planId) {
let stringResult1;
const intl5 = intl30.intl;
const string = intl5.string;
2026-10-01 14:13:23 +00:00
const t = intl30.t;
if (flag2) {
2026-10-01 14:13:23 +00:00
stringResult1 = string(t.YDpAzZ);
} else {
stringResult1 = string(t.ZHkls0);
}
return stringResult1;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_3_MONTH_GUILD === planId) {
const intl4 = intl30.intl;
return intl4.string(intl30.t.EZHHB6);
} else if (SubscriptionPlans.PREMIUM_6_MONTH_GUILD === planId) {
const intl3 = intl30.intl;
return intl3.string(intl30.t.X2KDO2);
} else if (SubscriptionPlans.PREMIUM_MONTH_LEGACY === planId) {
const intl2 = intl30.intl;
return intl2.string(intl30.t.PD6k79);
} else if (SubscriptionPlans.PREMIUM_YEAR_LEGACY === planId) {
const intl = intl30.intl;
return intl.string(intl30.t.LtJgTC);
} else {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Unsupported plan");
2026-10-01 14:13:23 +00:00
const obj7 = { tags: obj8 };
obj8 = { planId };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj7);
throw error;
}
}
2026-10-12 16:32:48 +00:00
function getIntervalMonths(interval, arg1) {
if (interval === constants7.MONTH) {
return arg1;
} else if (interval === tmp.YEAR) {
return 12 * arg1;
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
const self = this;
const self2 = this;
const error = new Error("" + interval + " interval subscription period not implemented");
throw error;
}
}
function getPlanDescription(arg0) {
2026-10-01 14:13:23 +00:00
let CANCELED;
let activeDiscountInfo;
let addResult;
let duration;
let duration1;
let format3Result1;
let fractionalPremiumInfo;
let hasDiscountApplied;
let hasFractionalPremiumWithSub;
let includePremiumGuilds;
let planId;
let price;
let renewalInvoiceWithEntitlementsPreview;
let renewalInvoiceWithoutEntitlementsPreview;
let stringResult;
let stringResult1;
let stringResult2;
let subscription;
let tmp5Result;
let tmp5Result3;
let tmp5Result4;
({ subscription, planId, price, activeDiscountInfo, renewalInvoiceWithoutEntitlementsPreview, renewalInvoiceWithEntitlementsPreview, hasFractionalPremiumWithSub } = arg0);
2026-10-01 14:13:23 +00:00
const id = tmp.id;
let paymentSourceId = PaymentSourceStore.defaultPaymentSourceId;
({ includePremiumGuilds, hasDiscountApplied, fractionalPremiumInfo } = arg0);
const premiumTypeSubscription = SubscriptionStore.getPremiumTypeSubscription();
2026-10-01 14:13:23 +00:00
const tmp3 = null != premiumTypeSubscription && null != premiumTypeSubscription.paymentSourceId;
if (tmp3) {
paymentSourceId = premiumTypeSubscription.paymentSourceId;
}
obj = { paymentSourceId, currency: undefined };
2026-10-01 14:13:23 +00:00
const tmp4 = getPrice(id, false, false, obj, true);
const interval = tmp.interval;
obj2 = PriceUtils;
const formatPriceResult = obj2.formatPrice(tmp4.amount, tmp4.currency);
if (constants7.MONTH === interval) {
2026-10-01 14:13:23 +00:00
const intl2 = intl30.intl;
stringResult = intl2.string(intl30.t.FPybU7);
} else if (tmp8.YEAR === interval) {
2026-10-01 14:13:23 +00:00
const intl = intl30.intl;
stringResult = intl.string(intl30.t.tfqrhj);
} else {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Unexpected interval");
throw error;
}
2026-10-01 14:13:23 +00:00
const combined = "" + formatPriceResult + "/" + stringResult;
const renewalMutations = subscription.renewalMutations;
2026-10-01 14:13:23 +00:00
let tmp16 = subscription.status === constants4.CANCELED;
const tmp14 = null != renewalInvoiceWithEntitlementsPreview && 0 === renewalInvoiceWithEntitlementsPreview.subtotal;
if (!tmp16) {
tmp16 = null != renewalMutations && isNoneSubscription(renewalMutations.planId) && !subscription.isPurchasedExternally;
const tmp17 = null != renewalMutations && isNoneSubscription(renewalMutations.planId) && !subscription.isPurchasedExternally;
}
if (!tmp16) {
let tmp19 = null == subscription.paymentSourceId && !subscription.isPurchasedExternally;
if (tmp19) {
const currentUser = UserStore.getCurrentUser();
let hasFreePremiumResult;
if (currentUser != null) {
hasFreePremiumResult = currentUser.hasFreePremium();
}
2026-10-01 14:13:23 +00:00
tmp19 = !hasFreePremiumResult;
}
2026-10-01 14:13:23 +00:00
if (tmp19) {
tmp19 = !tmp14;
}
2026-10-01 14:13:23 +00:00
tmp16 = tmp19;
}
2026-10-01 14:13:23 +00:00
let tmp23 = subscription.status === tmp15.UNPAID && null !== subscription.latestInvoice;
if (tmp23) {
const latestInvoice = subscription.latestInvoice;
let status;
if (latestInvoice != null) {
status = latestInvoice.status;
}
2026-10-01 14:13:23 +00:00
tmp23 = status === unpackModuleId.OPEN;
}
2026-10-01 14:13:23 +00:00
if (tmp16) {
CANCELED = tmp15.CANCELED;
} else {
2026-10-01 14:13:23 +00:00
CANCELED = tmp23 ? tmp15.UNPAID : subscription.status;
}
let flag;
if (renewalInvoiceWithoutEntitlementsPreview != null) {
flag = renewalInvoiceWithoutEntitlementsPreview.taxInclusive;
}
if (flag == null) {
const latestInvoice2 = subscription.latestInvoice;
let taxInclusive;
if (latestInvoice2 != null) {
taxInclusive = latestInvoice2.taxInclusive;
}
flag = taxInclusive;
}
if (flag == null) {
flag = true;
}
let num2 = 0;
2026-10-07 22:43:51 +00:00
const tmp27 = closure_28;
if (includePremiumGuilds) {
const additionalPlans = subscription.additionalPlans;
2026-10-02 13:37:24 +00:00
const items = [__initData5.GUILD];
const planIdsForSkus = SubscriptionPlanStore.getPlanIdsForSkus(items);
_modDef38(null != planIdsForSkus, "Missing guildSubscriptionPlanIds");
const found = additionalPlans.find((planId) => planIdsForSkus.includes(planId.planId));
let num3 = 0;
if (null != found) {
num3 = found.quantity;
}
num2 = num3;
}
2026-10-01 14:13:23 +00:00
const sum = tmp27 + num2;
const intl3 = intl30.intl;
if (null != price && null == subscription.paymentGateway) {
2026-10-01 14:13:23 +00:00
let formatResult;
const format = intl3.format;
2026-10-01 14:13:23 +00:00
const t = intl30.t;
if (flag) {
const obj3 = { price };
2026-10-01 14:13:23 +00:00
formatResult = format(t["cd+hqB"], obj3);
} else {
const obj4 = { price };
formatResult = format(t.NUkcpF, obj4);
}
2026-10-01 14:13:23 +00:00
stringResult1 = formatResult;
} else {
2026-10-01 14:13:23 +00:00
stringResult1 = intl3.string(intl30.t.zYx3Y6);
}
const intl4 = intl30.intl;
if (null != price && null == subscription.paymentGateway) {
let format2Result;
const format2 = intl4.format;
const t2 = intl30.t;
if (flag) {
const obj5 = { price };
format2Result = format2(t2.VsKcFB, obj5);
} else {
2026-10-01 14:13:23 +00:00
const obj6 = { price };
format2Result = format2(t2.hJ5xEX, obj6);
}
stringResult2 = format2Result;
} else {
stringResult2 = intl4.string(intl30.t["8rSipI"]);
}
const intl5 = intl30.intl;
const format3 = intl5.format;
const t3 = intl30.t;
if (null != price && null == subscription.paymentGateway) {
let format3Result;
if (flag) {
const obj7 = { price, num: sum };
format3Result = format3(t3["jRy6/J"], obj7);
} else {
const obj8 = { price, num: sum };
format3Result = format3(t3.tTNE8M, obj8);
}
format3Result1 = format3Result;
} else {
const obj9 = { num: sum };
format3Result1 = format3(t3["U+z/HJ"], obj9);
}
if (SubscriptionPlans.PREMIUM_MONTH_TIER_0 !== planId) {
if (SubscriptionPlans.PREMIUM_YEAR_TIER_0 !== planId) {
if (SubscriptionPlans.PREMIUM_MONTH_TIER_1 !== planId) {
if (SubscriptionPlans.PREMIUM_YEAR_TIER_1 !== planId) {
if (SubscriptionPlans.PREMIUM_MONTH_TIER_2 !== planId) {
if (SubscriptionPlans.PREMIUM_YEAR_TIER_2 !== planId) {
if (SubscriptionPlans.PREMIUM_3_MONTH_TIER_2 !== planId) {
if (SubscriptionPlans.PREMIUM_6_MONTH_TIER_2 !== planId) {
if (SubscriptionPlans.PREMIUM_GROUP_MONTH !== planId) {
const _Error2 = Error;
const _HermesInternal = HermesInternal;
const self3 = this;
const self4 = this;
const error1 = new Error("Invalid planId " + planId);
throw error1;
}
}
2026-10-01 14:13:23 +00:00
}
}
}
if (constants4.CANCELED === CANCELED) {
let format8Result1;
const intl14 = intl30.intl;
const format8 = intl14.format;
const t5 = intl30.t;
if (null != price && null == subscription.paymentGateway) {
let format8Result;
if (flag) {
const obj10 = { price, num: sum };
format8Result = format8(t5.xoFgRh, obj10);
} else {
const obj11 = { price, num: sum };
format8Result = format8(t5.nXdbKo, obj11);
}
format8Result1 = format8Result;
} else {
const obj12 = { num: sum };
format8Result1 = format8(t5.EcSdRH, obj12);
}
return format8Result1;
} else if (constants4.ACCOUNT_HOLD === CANCELED) {
let format7Result1;
const intl13 = intl30.intl;
const format7 = intl13.format;
const t4 = intl30.t;
if (null != price && null == subscription.paymentGateway) {
let format7Result;
if (flag) {
const obj13 = { price, num: sum };
format7Result = format7(t4["5C/0QG"], obj13);
} else {
const obj14 = { price, num: sum };
format7Result = format7(t4.xfYkhu, obj14);
}
format7Result1 = format7Result;
} else {
const obj15 = { num: sum };
format7Result1 = format7(t4.ivjxcn, obj15);
}
return format7Result1;
} else if (constants4.UNPAID === CANCELED) {
const intl12 = intl30.intl;
const obj16 = { num: sum };
return intl12.format(intl30.t["0HopYf"], obj16);
} else if (constants4.PAUSE_PENDING === CANCELED) {
let formatResult1;
let diffResult = null;
if (null != subscription.pauseEndsAt) {
2026-10-12 16:32:48 +00:00
const obj20 = _modDef4702(subscription.pauseEndsAt);
2026-10-01 14:13:23 +00:00
diffResult = obj20.diff(subscription.currentPeriodEnd, "days");
}
if (null != diffResult) {
const intl11 = intl30.intl;
const obj18 = { pauseDate: subscription.currentPeriodEnd, pauseDuration: diffResult };
formatResult1 = intl11.format(intl30.t.WUfOD5, obj18);
} else {
const intl10 = intl30.intl;
const obj19 = { pauseDate: subscription.currentPeriodEnd };
formatResult1 = intl10.format(intl30.t.VlWufv, obj19);
}
return formatResult1;
} else if (constants4.PAUSED === CANCELED) {
if (!hasFractionalPremiumWithSub) {
const intl9 = intl30.intl;
const obj21 = { resumeDate: subscription.pauseEndsAt };
format3Result1 = intl9.format(intl30.t["6RTdZA"], obj21);
}
return format3Result1;
} else if (constants4.BILLING_RETRY === CANCELED) {
const intl8 = intl30.intl;
const format6 = intl8.format;
const obj22 = { endDate: addResult.toDate() };
const prop = intl30.t["IlJ/HV"];
2026-10-12 16:32:48 +00:00
const obj17 = _modDef4702(subscription.currentPeriodStart);
2026-10-07 22:43:51 +00:00
addResult = obj17.add(set, "days");
2026-10-01 14:13:23 +00:00
return format6(prop, obj22);
} else if (constants4.PAST_DUE === CANCELED) {
const intl7 = intl30.intl;
const format5 = intl7.format;
const obj23 = {
endDate: tmp5Result.dateFormat(getBillingGracePeriodDaysAndExpiresDate(subscription).expiresDate, "LL"),
onClick() {
openURLDefault("https://support.discord.com/hc/articles/23082866222871");
}
};
const prop1 = intl30.t["d+0vwo"];
tmp5Result = DateUtils;
return format5(prop1, obj23);
} else {
let tmp53 = format3Result1;
if (hasDiscountApplied) {
let format4Result;
if (planId === SubscriptionPlans.PREMIUM_YEAR_TIER_2) {
const intl6 = intl30.intl;
const format4 = intl6.format;
let percentage;
const z2oQtA = intl30.t.z2oQtA;
if (activeDiscountInfo != null) {
percentage = activeDiscountInfo.percentage;
}
if (percentage == null) {
2026-10-12 16:32:48 +00:00
percentage = authStore4;
2026-10-01 14:13:23 +00:00
}
const obj24 = { percent: percentage, regularPrice: combined, renewalDate: getExpectedRenewalDate(subscription, fractionalPremiumInfo) };
format4Result = format4(z2oQtA, obj24);
} else {
const intl29 = intl30.intl;
const formatToPlainString = intl29.formatToPlainString;
const t10 = intl30.t;
if (flag) {
let percentage1;
const v3ZiutU = t10["3ZiutU"];
if (activeDiscountInfo != null) {
percentage1 = activeDiscountInfo.percentage;
}
2026-10-01 14:13:23 +00:00
if (percentage1 == null) {
percentage1 = closure_21;
}
2026-10-01 14:13:23 +00:00
const obj25 = { percent: percentage1, regularPrice: combined, numMonths: duration };
duration = undefined;
if (activeDiscountInfo != null) {
duration = activeDiscountInfo.duration;
}
2026-10-01 14:13:23 +00:00
if (duration == null) {
duration = closure_20;
}
2026-10-01 14:13:23 +00:00
format4Result = formatToPlainString(v3ZiutU, obj25);
} else {
let percentage2;
const prop2 = t10["G6+XOT"];
if (activeDiscountInfo != null) {
2026-10-01 14:13:23 +00:00
percentage2 = activeDiscountInfo.percentage;
}
2026-10-01 14:13:23 +00:00
if (percentage2 == null) {
percentage2 = closure_21;
}
2026-10-01 14:13:23 +00:00
const obj26 = { percent: percentage2, regularPrice: combined, numMonths: duration1 };
duration1 = undefined;
if (activeDiscountInfo != null) {
duration1 = activeDiscountInfo.duration;
}
2026-10-01 14:13:23 +00:00
if (duration1 == null) {
duration1 = closure_20;
}
format4Result = formatToPlainString(prop2, obj26);
}
}
2026-10-01 14:13:23 +00:00
tmp53 = format4Result;
}
2026-10-01 14:13:23 +00:00
return tmp53;
}
}
2026-10-01 14:13:23 +00:00
}
if (constants4.CANCELED === CANCELED) {
let stringResult3;
const intl21 = intl30.intl;
if (null != price && null == subscription.paymentGateway) {
let format11Result;
const format11 = intl21.format;
const t7 = intl30.t;
if (flag) {
const obj27 = { price };
format11Result = format11(t7.cXy8Bp, obj27);
} else {
2026-10-01 14:13:23 +00:00
const obj28 = { price };
format11Result = format11(t7["C/XsHt"], obj28);
}
2026-10-01 14:13:23 +00:00
stringResult3 = format11Result;
} else {
stringResult3 = intl21.string(intl30.t.K6tYFa);
}
return stringResult3;
} else if (constants4.ACCOUNT_HOLD === CANCELED) {
let format10Result1;
const intl20 = intl30.intl;
const format10 = intl20.format;
const t6 = intl30.t;
if (null != price && null == subscription.paymentGateway) {
let format10Result;
if (flag) {
const obj29 = { price };
format10Result = format10(t6.HBkIBi, obj29);
} else {
2026-10-01 14:13:23 +00:00
const obj30 = { price };
format10Result = format10(t6.ZsO1Sx, obj30);
}
2026-10-01 14:13:23 +00:00
format10Result1 = format10Result;
} else {
2026-10-01 14:13:23 +00:00
format10Result1 = format10(t6["0+/WH7"], {});
}
return format10Result1;
} else if (constants4.UNPAID === CANCELED) {
const intl19 = intl30.intl;
return intl19.format(intl30.t.McIzwj, {});
} else if (constants4.PAUSE_PENDING === CANCELED) {
let formatResult2;
let diffResult1 = null;
if (null != subscription.pauseEndsAt) {
2026-10-12 16:32:48 +00:00
const obj33 = _modDef4702(subscription.pauseEndsAt);
2026-10-01 14:13:23 +00:00
diffResult1 = obj33.diff(subscription.currentPeriodEnd, "days");
}
if (null != diffResult1) {
const intl18 = intl30.intl;
const obj31 = { pauseDate: subscription.currentPeriodEnd, pauseDuration: diffResult1 };
formatResult2 = intl18.format(intl30.t.WUfOD5, obj31);
} else {
const intl17 = intl30.intl;
const obj32 = { pauseDate: subscription.currentPeriodEnd };
formatResult2 = intl17.format(intl30.t.VlWufv, obj32);
}
return formatResult2;
} else if (constants4.PAUSED === CANCELED) {
if (!hasFractionalPremiumWithSub) {
const intl16 = intl30.intl;
const obj34 = { resumeDate: subscription.pauseEndsAt };
stringResult2 = intl16.format(intl30.t["6RTdZA"], obj34);
}
2026-10-01 14:13:23 +00:00
return stringResult2;
} else if (constants4.PAST_DUE === CANCELED) {
const intl15 = intl30.intl;
const format9 = intl15.format;
const obj35 = {
endDate: tmp5Result3.dateFormat(getBillingGracePeriodDaysAndExpiresDate(subscription).expiresDate, "LL"),
onClick() {
openURLDefault("https://support.discord.com/hc/articles/23082866222871");
}
};
const prop3 = intl30.t["d+0vwo"];
tmp5Result3 = DateUtils;
return format9(prop3, obj35);
} else {
return stringResult2;
}
}
}
2026-10-01 14:13:23 +00:00
if (constants4.CANCELED === CANCELED) {
let stringResult4;
const intl28 = intl30.intl;
if (null != price && null == subscription.paymentGateway) {
let format14Result;
const format14 = intl28.format;
const t9 = intl30.t;
if (flag) {
const obj36 = { price };
format14Result = format14(t9["USi/nc"], obj36);
} else {
const obj37 = { price };
format14Result = format14(t9["FS//l2"], obj37);
}
stringResult4 = format14Result;
} else {
stringResult4 = intl28.string(intl30.t.JshLzq);
}
return stringResult4;
} else if (constants4.ACCOUNT_HOLD === CANCELED) {
let format13Result1;
const intl27 = intl30.intl;
const format13 = intl27.format;
const t8 = intl30.t;
if (null != price && null == subscription.paymentGateway) {
let format13Result;
if (flag) {
const obj38 = { price };
format13Result = format13(t8["5mv+2i"], obj38);
} else {
const obj39 = { price };
format13Result = format13(t8.nkAEfZ, obj39);
}
format13Result1 = format13Result;
} else {
format13Result1 = format13(t8.SsLIXS, {});
}
return format13Result1;
} else if (constants4.UNPAID === CANCELED) {
const intl26 = intl30.intl;
return intl26.format(intl30.t.cmkbFB, {});
} else if (constants4.PAUSE_PENDING === CANCELED) {
let formatResult3;
let diffResult2 = null;
if (null != subscription.pauseEndsAt) {
2026-10-12 16:32:48 +00:00
const obj43 = _modDef4702(subscription.pauseEndsAt);
2026-10-01 14:13:23 +00:00
diffResult2 = obj43.diff(subscription.currentPeriodEnd, "days");
}
if (null != diffResult2) {
const intl25 = intl30.intl;
const obj40 = { pauseDate: subscription.currentPeriodEnd, pauseDuration: diffResult2 };
formatResult3 = intl25.format(intl30.t.WUfOD5, obj40);
} else {
const intl24 = intl30.intl;
const obj41 = { pauseDate: subscription.currentPeriodEnd };
formatResult3 = intl24.format(intl30.t.VlWufv, obj41);
}
return formatResult3;
} else if (constants4.PAUSED === CANCELED) {
if (!hasFractionalPremiumWithSub) {
const intl23 = intl30.intl;
const obj42 = { resumeDate: subscription.pauseEndsAt };
stringResult1 = intl23.format(intl30.t["6RTdZA"], obj42);
}
return stringResult1;
} else if (constants4.PAST_DUE === CANCELED) {
const intl22 = intl30.intl;
const format12 = intl22.format;
const obj44 = {
endDate: tmp5Result4.dateFormat(getBillingGracePeriodDaysAndExpiresDate(subscription).expiresDate, "LL"),
onClick() {
openURLDefault("https://support.discord.com/hc/articles/23082866222871");
}
};
const prop4 = intl30.t["d+0vwo"];
tmp5Result4 = DateUtils;
return format12(prop4, obj44);
} else {
return stringResult1;
}
}
function getNumPremiumGuildSubscriptions(additionalPlans) {
2026-10-02 13:37:24 +00:00
const items = [__initData5.GUILD];
const planIdsForSkus = SubscriptionPlanStore.getPlanIdsForSkus(items);
_modDef38(null != planIdsForSkus, "Missing guildSubscriptionPlanIds");
const found = additionalPlans.find((planId) => planIdsForSkus.includes(planId.planId));
let num = 0;
if (null != found) {
num = found.quantity;
}
return num;
}
function getBillingGracePeriodDaysAndExpiresDate(subscription) {
2026-10-01 14:13:23 +00:00
let durationResult;
let durationResult1;
let obj6;
let tmp13Result;
if (subscription.isPurchasedViaApple) {
const metadata = subscription.metadata;
let prop;
if (metadata != null) {
prop = metadata.apple_grace_period_expires_date;
}
if (null != prop) {
2026-10-12 16:32:48 +00:00
const obj11 = _modDef4702(subscription.metadata.apple_grace_period_expires_date);
2026-10-01 14:13:23 +00:00
const obj3 = { days: durationResult.days(), expiresDate: obj11 };
2026-10-12 16:32:48 +00:00
const obj13 = _modDef4702;
2026-10-01 14:13:23 +00:00
durationResult = obj13.duration(obj11.diff(subscription.currentPeriodStart));
return obj3;
}
}
if (subscription.isPurchasedViaGoogle) {
const metadata2 = subscription.metadata;
let prop1;
if (metadata2 != null) {
prop1 = metadata2.google_grace_period_expires_date;
}
if (null != prop1) {
const metadata3 = subscription.metadata;
let prop2;
if (metadata3 != null) {
prop2 = metadata3.google_original_expires_date;
}
if (null != prop2) {
2026-10-12 16:32:48 +00:00
const obj7 = _modDef4702(subscription.metadata.google_grace_period_expires_date);
2026-10-01 14:13:23 +00:00
const obj4 = { days: durationResult1.days(), expiresDate: obj7 };
2026-10-12 16:32:48 +00:00
const tmp20 = _modDef4702(subscription.metadata.google_original_expires_date);
const obj9 = _modDef4702;
2026-10-01 14:13:23 +00:00
durationResult1 = obj9.duration(obj7.diff(tmp20));
return obj4;
}
}
}
if (subscription.isPurchasedExternally) {
2026-10-12 16:32:48 +00:00
const tmp15 = subscription.isPurchasedViaApple ? closure_17 : authStore5;
2026-10-01 14:13:23 +00:00
const obj5 = { days: tmp15, expiresDate: obj6.add(tmp15, "days") };
2026-10-12 16:32:48 +00:00
obj6 = _modDef4702(subscription.currentPeriodStart);
return obj5;
} else {
const metadata4 = subscription.metadata;
let prop3;
if (metadata4 != null) {
prop3 = metadata4.grace_period_expires_date;
}
if (null != prop3) {
const metadata5 = subscription.metadata;
let prop4;
2026-10-01 14:13:23 +00:00
const tmp11 = importDefault;
2026-10-12 16:32:48 +00:00
const tmp13 = _modDef4702;
if (metadata5 != null) {
prop4 = metadata5.grace_period_expires_date;
}
2026-10-12 16:32:48 +00:00
const obj8 = { days: tmp13Result.diff(subscription.currentPeriodStart, "days"), expiresDate: tmp11(4702)(subscription.metadata.grace_period_expires_date) };
2026-10-01 14:13:23 +00:00
tmp13Result = tmp13(prop4);
return obj8;
} else {
2026-10-02 13:37:24 +00:00
const tmp8 = null == subscription.paymentSourceId ? closure_19 : __initData;
2026-10-01 14:13:23 +00:00
obj = { days: tmp8, expiresDate: obj2.add(tmp8, "days") };
2026-10-12 16:32:48 +00:00
obj2 = _modDef4702(subscription.currentPeriodStart);
return obj;
}
}
}
function getExpectedRenewalDate(premiumSubscription, fractionalPremiumInfo) {
const date = new Date(premiumSubscription.currentPeriodEnd);
let toDateResult = date;
2026-10-01 14:13:23 +00:00
const tmp2 = null == fractionalPremiumInfo || premiumSubscription.isBoostOnly || premiumSubscription.hasAnyPremiumGroup;
if (!tmp2) {
const unactivatedUnits = fractionalPremiumInfo.unactivatedUnits;
2026-10-12 16:32:48 +00:00
obj = _modDef4702(date);
let addResult = obj;
if (unactivatedUnits.length > 0) {
2026-10-12 16:32:48 +00:00
const mapped = unactivatedUnits.map(f90546);
addResult = obj.add(mapped.reduce(f90547, 0), "hours");
}
toDateResult = addResult.toDate();
}
return toDateResult;
}
2026-10-02 13:37:24 +00:00
function getCoercedPremiumGuildSubscriptionStatus(subscription) {
let additionalPlans;
let renewalMutations;
let status;
({ renewalMutations, additionalPlans, status } = subscription);
const items = [__initData5.GUILD];
const planIdsForSkus = SubscriptionPlanStore.getPlanIdsForSkus(items);
_modDef38(null != planIdsForSkus, "Missing guildSubscriptionPlanIds");
const found = additionalPlans.find((planId) => planIdsForSkus.includes(planId.planId));
let num = 0;
obj = SubscriptionPlanStore;
const tmp = __initData5;
if (null != found) {
num = found.quantity;
}
2026-10-02 13:37:24 +00:00
let tmp7 = null;
if (null != renewalMutations) {
const additionalPlans1 = renewalMutations.additionalPlans;
const items1 = [tmp.GUILD];
const planIdsForSkus1 = obj.getPlanIdsForSkus(items1);
_modDef38(null != planIdsForSkus1, "Missing guildSubscriptionPlanIds");
const found1 = additionalPlans1.find((planId) => planIdsForSkus.includes(planId.planId));
let num2 = 0;
if (null != found1) {
num2 = found1.quantity;
}
tmp7 = num2;
}
2026-10-02 13:37:24 +00:00
let CANCELED = status;
if (0 === tmp7) {
CANCELED = status;
if (0 !== num) {
CANCELED = constants4.CANCELED;
}
}
2026-10-02 13:37:24 +00:00
return CANCELED;
}
function isPremiumGuildSubscriptionCanceled(subscription) {
let tmp3;
if (subscription.isPurchasedExternally) {
tmp3 = subscription.status === constants4.CANCELED;
} else {
2026-10-02 13:37:24 +00:00
tmp3 = getCoercedPremiumGuildSubscriptionStatus(subscription) === constants4.CANCELED;
}
2026-10-02 13:37:24 +00:00
return tmp3;
}
function getFormattedPriceForPlan(id, arg1, arg2, flag, flag2) {
let tmp4;
if (flag === undefined) {
flag = false;
}
if (flag2 === undefined) {
flag2 = true;
}
if (null != arg1) {
try {
tmp4 = getPrice(id.id, false, flag, arg1, flag2);
} catch (err) {
tmp4 = getDefaultPrice(id.id, false, flag, undefined, flag2);
}
} else {
tmp4 = getDefaultPrice(id.id, false, flag, undefined, flag2);
}
obj = PriceUtils;
const formatPriceResult = obj.formatPrice(tmp4.amount, tmp4.currency);
let combined = formatPriceResult;
const tmp12 = id.currency !== constants8.USD && true === arg2;
if (tmp12) {
combined = formatPriceResult.concat("*");
}
return combined;
}
function getPremiumGuildIntervalPrice(planId, paymentSourceId, currency, user) {
let obj10;
let obj7;
if (null != paymentSourceId) {
obj = { paymentSourceId, currency };
obj2 = { paymentSourceId, currency };
} else {
obj = { country: BillingInfoStore.ipCountryCodeWithFallback, currency };
}
const value = SubscriptionPlanStore.get(planId);
const obj3 = SubscriptionPlanStore;
if (null == value) {
const _Error2 = Error;
const self3 = this;
const self4 = this;
const error = new Error("Unsupported plan");
const obj6 = { tags: obj7 };
obj7 = { planId };
const obj8 = BillingUtils;
const result = obj8.captureBillingException(error, obj6);
throw error;
} else {
const forSkuAndInterval = obj3.getForSkuAndInterval(__initData5.GUILD, value.interval, value.intervalCount);
if (null == forSkuAndInterval) {
const _Error = Error;
const self = this;
const self2 = this;
const error1 = new Error("Unsupported plan");
const obj9 = { tags: obj10 };
obj10 = { planId };
const obj5 = BillingUtils;
const result1 = obj5.captureBillingException(error1, obj9);
throw error1;
} else {
const id = forSkuAndInterval.id;
const obj4 = PremiumTypeUtils;
return getPrice(id, obj4.isPremium(user), false, obj);
}
}
}
function getDefaultCurrency() {
let currency = constants8.USD;
try {
currency = getDefaultPrice(SubscriptionPlans.PREMIUM_MONTH_TIER_2, false, false, undefined, false).currency;
} catch (err) {
}
return currency;
}
function formatTrialCtaIntervalDuration(intervalType) {
let MONTH = intervalType.intervalType;
if (MONTH === undefined) {
MONTH = constants7.MONTH;
}
let num = intervalType.intervalCount;
if (num === undefined) {
num = 1;
}
const tmp2 = getDefaultCurrency();
obj = PriceUtils;
const formatPriceResult = obj.formatPrice(0, tmp2, { maximumFractionDigits: 0, minimumFractionDigits: 0 });
if (constants7.DAY === MONTH) {
if (num >= 7) {
let formatToPlainStringResult;
if (num % 7 === 0) {
2026-10-07 22:43:51 +00:00
const intl4 = tmp3(1126).intl;
2026-10-02 13:37:24 +00:00
obj2 = { weeks: num / 7, price: formatPriceResult };
2026-10-07 22:43:51 +00:00
formatToPlainStringResult = intl4.formatToPlainString(tmp3(1126).t.C6i5Jt, obj2);
2026-10-02 13:37:24 +00:00
}
return formatToPlainStringResult;
}
2026-10-07 22:43:51 +00:00
const intl3 = tmp3(1126).intl;
2026-10-02 13:37:24 +00:00
const obj3 = { days: num, price: formatPriceResult };
2026-10-07 22:43:51 +00:00
formatToPlainStringResult = intl3.formatToPlainString(tmp3(1126).t.cR9ifw, obj3);
2026-10-02 13:37:24 +00:00
} else if (constants7.MONTH === MONTH) {
2026-10-07 22:43:51 +00:00
const intl2 = tmp3(1126).intl;
2026-10-02 13:37:24 +00:00
const obj4 = { months: num, price: formatPriceResult };
return intl2.formatToPlainString(intl30.t["8FZfNo"], obj4);
} else if (constants7.YEAR === MONTH) {
2026-10-07 22:43:51 +00:00
const intl = tmp3(1126).intl;
2026-10-02 13:37:24 +00:00
const obj5 = { years: num, price: formatPriceResult };
return intl.formatToPlainString(intl30.t.xzAcST, obj5);
} else {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Unsupported interval duration.");
throw error;
}
}
function getItemsWithUpsertedPlanIdForGroup(renewalMutations, planId, quantity, has) {
let obj3;
let closure_0 = planId;
let closure_1 = quantity;
let closure_2 = has;
if (has.has(planId)) {
let c3 = false;
renewalMutations = renewalMutations.renewalMutations;
let items;
if (renewalMutations != null) {
items = renewalMutations.items;
}
if (items == null) {
items = renewalMutations.items;
}
const mapped = items.map((planId) => {
let tmp = planId;
if (set.has(planId.planId)) {
c3 = true;
obj = { quantity, planId };
const merged = Object.assign(planId);
tmp = obj;
}
return tmp;
});
const tmp9 = c3;
if (!tmp9) {
obj2 = { planId, quantity };
const items1 = renewalMutations.items;
const found = items1.find((planId) => planId.planId === planId);
if (null != found) {
obj2.id = found.id;
}
mapped.push(obj2);
}
return mapped.filter((quantity) => 0 !== quantity.quantity);
} else {
let tmp = require;
obj = { message: "Expected planId in group", extraSentryInformation: obj3 };
const self = this;
const self2 = this;
obj3 = { newPlanId: planId, planGroup: has };
const checkoutError = new CheckoutError.CheckoutError(obj);
throw checkoutError;
}
}
function getMonthlyPrice(isGift) {
let flag = isGift.isGift;
const subscriptionPlan = isGift.subscriptionPlan;
if (flag === undefined) {
flag = false;
}
let priceOptions = isGift.priceOptions;
if (priceOptions === undefined) {
priceOptions = {};
}
let tmp2 = null;
2026-10-12 16:32:48 +00:00
if (null != __initData3[subscriptionPlan.skuId]) {
2026-10-02 13:37:24 +00:00
tmp2 = getPrice(tmp, false, flag, priceOptions);
}
return tmp2;
}
function calculateMonthlyPriceEquivalentTotal(priceOptions) {
let isGift;
let subscriptionPlan;
({ subscriptionPlan, isGift } = priceOptions);
if (isGift === undefined) {
isGift = false;
}
priceOptions = priceOptions.priceOptions;
if (priceOptions === undefined) {
priceOptions = {};
}
if (subscriptionPlan.interval === constants7.DAY) {
return null;
} else {
if (subscriptionPlan.interval === constants7.MONTH) {
if (1 === subscriptionPlan.intervalCount) {
return null;
}
}
if (isGift === undefined) {
isGift = false;
}
if (priceOptions === undefined) {
priceOptions = {};
}
let tmp5 = null;
2026-10-12 16:32:48 +00:00
if (null != __initData3[subscriptionPlan.skuId]) {
2026-10-02 13:37:24 +00:00
tmp5 = getPrice(tmp3, false, isGift, priceOptions);
}
if (null == tmp5) {
return null;
} else {
let intervalCount;
if (subscriptionPlan.interval === constants7.MONTH) {
intervalCount = subscriptionPlan.intervalCount;
} else {
intervalCount = 12 * subscriptionPlan.intervalCount;
}
return tmp5.amount * intervalCount;
}
}
}
2026-10-12 16:32:48 +00:00
function calculateDiscountPercentageForPlan(subscriptionPlan, arg1, arg2) {
2026-10-02 13:37:24 +00:00
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
let priceOptions = arg2;
if (arg2 === undefined) {
priceOptions = {};
}
2026-10-12 16:32:48 +00:00
const interval = subscriptionPlan.interval;
if (interval === constants7.MONTH) {
const tmp4 = getIntervalMonths(interval, tmp);
if (tmp4 > 1) {
try {
obj2 = { subscriptionPlan, isGift: flag, priceOptions };
const tmp6 = getMonthlyPrice(obj2);
if (null != tmp6) {
if (0 !== tmp7.amount) {
const _Math = Math;
return Math.floor(100 * (1 - getPrice(subscriptionPlan.id, false, flag, priceOptions).amount / (tmp6.amount * tmp4)));
}
2026-10-02 13:37:24 +00:00
}
2026-10-12 16:32:48 +00:00
} catch (err) {
2026-10-02 13:37:24 +00:00
}
}
}
}
const isNoneSubscription = SubscriptionPlanRecord.isNoneSubscription;
let Constants = Constants_mod2;
({ InvoiceStatusTypes: unpackModuleId, PaymentGateways: closure_12, PriceSetAssignmentPurchaseTypes: map1, SubscriptionStatusTypes: closure_14 } = Constants);
({ DISCOUNTS: closure_15, ANNUAL_DISCOUNT_PERCENTAGE_FALLBACK: closure_16, DEFAULT_APPLE_GRACE_PERIOD_DAYS: closure_17, DEFAULT_GOOGLE_GRACE_PERIOD_DAYS: closure_18, DEFAULT_MAX_GRACE_PERIOD_DAYS: closure_19, DISCOUNT_DURATION_FALLBACK: closure_20, DISCOUNT_PERCENTAGE_FALLBACK: closure_21, DiscountUserUsageLimitIntervalTypes: closure_22, FRACTIONAL_PREMIUM_SKU_INTERVAL_COUNTS: closure_23, FractionalPremiumIntervalTypes: closure_24, FractionalPremiumStates: closure_25, MAX_ACCOUNT_HOLD_DAYS: closure_26, MAX_PAYMENT_PROCESSING_TIME_DAYS: closure_27, NUM_FREE_GUILD_BOOSTS_WITH_PREMIUM: closure_28, PAID_SUBSCRIPTION_MAX_BILLING_RETRY_DAYS: closure_29, PAID_SUBSCRIPTION_MAX_GRACE_PERIOD_DAYS: closure_30, PREMIUM_GUILD_SUBSCRIPTION_PLANS: closure_31, PREMIUM_PLANS: closure_32, PREMIUM_SKU_TO_MONTHLY_PLAN: closure_33, PREMIUM_TIER_2_PLANS: closure_34, PREMIUM_TIER_2_REVERSE_FOLLOWUP_TRIAL_ID: closure_35, PREMIUM_TIER_2_TRIAL_FOR_EVERYONE_TRIAL_ID: closure_36, PREMIUM_TYPE_DISPLAY_NAME: closure_37, PremiumSubscriptionSKUs: closure_38, PremiumTypes: closure_39, PremiumUserLimits: closure_40, SubscriptionIntervalTypes: closure_41, SubscriptionPlanInfo: closure_42, SubscriptionPlans } = PremiumConstants);
({ TRIAL_FOR_EVERYONE_OFFER_EXPIRES_APPROACHING_THRESHOLD: closure_44, USER_PREMIUM_OFFER_EXPIRES_APPROACHING_4_DAY_THRESHOLD: closure_45, USER_PREMIUM_OFFER_EXPIRES_APPROACHING_7_DAY_THRESHOLD: closure_46 } = PremiumConstants);
let closure_47 = PremiumGroupConstants.getPremiumGroupProductName;
Constants = Constants_mod2;
({ CurrencyCodes: closure_48, PaymentGatewayToFriendlyName: closure_49, PREPAID_PAYMENT_SOURCES: closure_50 } = Constants);
const constants9 = { PAYMENT_SOURCE_MANAGEMENT: "https://support.apple.com/HT201266", BILLING_HISTORY: "https://support.apple.com/HT201266", SUBSCRIPTION_MANAGEMENT: "https://support.apple.com/HT202039" };
const constants10 = { SUBSCRIPTION_MANAGEMENT: "https://play.google.com/store/account/subscriptions", PAYMENT_SOURCE_MANAGEMENT: "https://play.google.com/store/paymentmethods", BILLING_HISTORY: "https://play.google.com/store/account/orderhistory" };
tmp5 = new LoggerDefault("PremiumUtils.tsx");
const logger = tmp5;
const Branding = { BUNDLE: "bundle", TIER_0: "tier_0", TIER_1: "tier_1", TIER_2: "tier_2", PREMIUM_GUILD: "premium_guild" };
let obj2 = { MID: "mid", HIGH: "high" };
let ReactCompilerGating = ReactCompilerGating_mod;
let items = [, , , , , , , , , , , , ];
({ NONE_MONTH: arr[0], NONE_3_MONTH: arr[1], NONE_6_MONTH: arr[2], NONE_YEAR: arr[3], PREMIUM_MONTH_TIER_0: arr[4], PREMIUM_MONTH_TIER_1: arr[5], PREMIUM_MONTH_TIER_2: arr[6], PREMIUM_YEAR_TIER_0: arr[7], PREMIUM_YEAR_TIER_1: arr[8], PREMIUM_YEAR_TIER_2: arr[9], PREMIUM_3_MONTH_TIER_2: arr[10], PREMIUM_6_MONTH_TIER_2: arr[11], PREMIUM_GROUP_MONTH: arr[12] } = SubscriptionPlans);
2026-10-12 16:32:48 +00:00
let tmp6 = ReactCompilerGating.isReactCompilerEnabled() ? (function usePlanSelectPriceState(currency, checkoutContext, arg2) {
2026-10-02 13:37:24 +00:00
obj = react2;
const cResult = obj.c(6);
let available_plans = null;
if (null != checkoutContext) {
available_plans = null;
if (null != checkoutContext.checkoutContext) {
available_plans = null;
if (null != checkoutContext.checkoutContext.available_plans) {
available_plans = checkoutContext.checkoutContext.available_plans;
}
}
}
if (cResult[0] === available_plans) {
let tmp3;
if (cResult[1] === currency) {
tmp3 = cResult[2];
}
const tmp9 = null != currency.currency && null != checkoutContext && checkoutContext.currency !== currency.currency && null == arg2;
if (cResult[3] === tmp3) {
let tmp11;
if (cResult[4] === tmp9) {
tmp11 = cResult[5];
}
return tmp11;
}
obj2 = { priceOptions: tmp3, planPricesLoading: tmp9 };
cResult[3] = tmp3;
cResult[4] = tmp9;
cResult[5] = obj2;
tmp11 = obj2;
}
let tmp4 = currency;
if (null != available_plans) {
const obj3 = {
contextPlanPrices: Object.fromEntries(available_plans.map((item) => {
const items = [, ];
({ id: arr[0], price: arr[1] } = item);
return items;
}))
};
const merged = Object.assign(currency);
const _Object = Object;
tmp4 = obj3;
}
cResult[0] = available_plans;
cResult[1] = currency;
cResult[2] = tmp4;
tmp3 = tmp4;
2026-10-12 16:32:48 +00:00
}) : (function usePlanSelectPriceState(arg0, arg1, arg2) {
2026-10-02 13:37:24 +00:00
let closure_0 = arg0;
const currency = arg1;
let closure_2 = arg2;
let items = [arg1];
const memo = react.useMemo(() => {
let available_plans = null;
if (null != currency) {
available_plans = null;
if (null != currency.checkoutContext) {
available_plans = null;
if (null != currency.checkoutContext.available_plans) {
available_plans = tmp.checkoutContext.available_plans;
}
}
}
return available_plans;
}, items);
const items1 = [arg0, arg1, memo, arg2];
return react.useMemo(() => {
const arr = memo;
let tmp2 = closure_0;
if (null != memo) {
obj = {
contextPlanPrices: Object.fromEntries(arr.map((item) => {
const items = [, ];
({ id: arr[0], price: arr[1] } = item);
return items;
}))
};
const merged = Object.assign(tmp);
const _Object = Object;
tmp2 = obj;
}
obj2 = { priceOptions: tmp2, planPricesLoading: tmp7 };
return obj2;
}, items1);
});
let set = new Set(items);
ReactCompilerGating = ReactCompilerGating_mod;
2026-10-12 16:32:48 +00:00
let tmp8 = ReactCompilerGating.isReactCompilerEnabled() ? (function useHasPremiumSubscriptionToDisplay() {
2026-10-02 13:37:24 +00:00
let currentUser;
let premiumTypeSubscription;
let tmp4;
let tmp5;
let tmp8;
let tmp9;
obj = react2;
const cResult = obj.c(7);
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [SubscriptionStore];
const fn = function e() {
return premiumTypeSubscription.getPremiumTypeSubscription();
};
cResult[0] = items;
cResult[1] = fn;
tmp4 = items;
tmp5 = fn;
} else {
[tmp4, tmp5] = cResult;
}
const tmpResult = get_initialized;
const stateFromStores = tmpResult.useStateFromStores(tmp4, tmp5);
if (cResult[2] === Symbol.for("react.memo_cache_sentinel")) {
const items1 = [UserStore];
const fn2 = function s() {
return currentUser.getCurrentUser();
};
cResult[2] = items1;
cResult[3] = fn2;
tmp9 = fn2;
tmp8 = items1;
} else {
tmp8 = cResult[2];
tmp9 = cResult[3];
}
const tmpResult3 = get_initialized;
const stateFromStores1 = tmpResult3.useStateFromStores(tmp8, tmp9);
let status;
const tmp12 = cResult[4];
if (stateFromStores != null) {
status = stateFromStores.status;
}
if (tmp12 === status) {
let tmp14;
if (cResult[5] === stateFromStores1) {
tmp14 = cResult[6];
}
return tmp14;
}
const tmpResult4 = PremiumTypeUtils;
let isPremiumResult = tmpResult4.isPremium(stateFromStores1);
if (!isPremiumResult) {
let status1;
if (stateFromStores != null) {
status1 = stateFromStores.status;
}
isPremiumResult = status1 === constants4.PAST_DUE || status1 === constants4.ACCOUNT_HOLD || status1 === constants4.BILLING_RETRY;
}
let status2;
if (stateFromStores != null) {
status2 = stateFromStores.status;
}
cResult[4] = status2;
cResult[5] = stateFromStores1;
cResult[6] = isPremiumResult;
tmp14 = isPremiumResult;
2026-10-12 16:32:48 +00:00
}) : (function useHasPremiumSubscriptionToDisplay() {
2026-10-02 13:37:24 +00:00
let currentUser;
let premiumTypeSubscription;
const items = [SubscriptionStore];
obj = get_initialized;
const stateFromStores = obj.useStateFromStores(items, () => premiumTypeSubscription.getPremiumTypeSubscription());
const items1 = [UserStore];
obj2 = get_initialized;
const stateFromStores1 = obj2.useStateFromStores(items1, () => currentUser.getCurrentUser());
const obj3 = PremiumTypeUtils;
let isPremiumResult = obj3.isPremium(stateFromStores1);
if (!isPremiumResult) {
let status;
if (stateFromStores != null) {
status = stateFromStores.status;
}
isPremiumResult = status === constants4.PAST_DUE || status === constants4.ACCOUNT_HOLD || status === constants4.BILLING_RETRY;
}
return isPremiumResult;
});
ReactCompilerGating = ReactCompilerGating_mod;
function getPremiumPlanItem(subscription) {
const items = subscription.items;
2026-10-12 16:32:48 +00:00
return items.find(f90526);
2026-10-02 13:37:24 +00:00
}
function getInterval(basePlanId) {
let obj7;
if (null != closure_42[basePlanId]) {
obj2 = { intervalType: null, intervalCount: null };
({ interval: obj4.intervalType, intervalCount: obj4.intervalCount } = closure_42[basePlanId]);
return obj2;
} else {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Unsupported plan");
const obj3 = { tags: obj7 };
obj7 = { planId: basePlanId };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj3);
throw error;
}
}
function getIntervalString(interval, arg1, arg2) {
let intl5;
2026-10-12 16:32:48 +00:00
let intl7;
2026-10-02 13:37:24 +00:00
let num = arg3;
if (arg3 === undefined) {
num = 1;
}
let flag = arg4;
if (arg4 === undefined) {
flag = false;
}
let TIER_2 = arg5;
if (arg5 === undefined) {
TIER_2 = closure_39.TIER_2;
}
const tmp2 = arg1;
if (!tmp2) {
const tmp3 = arg2;
if (!tmp3) {
if (constants7.MONTH === interval) {
let formatToPlainStringResult;
if (1 !== num) {
const intl3 = intl30.intl;
obj = { intervalCount: num };
formatToPlainStringResult = intl3.formatToPlainString(intl30.t["0UlZnH"], obj);
} else {
const intl2 = intl30.intl;
formatToPlainStringResult = intl2.string(intl30.t.DKzs96);
}
return formatToPlainStringResult;
} else if (tmp4.YEAR === interval) {
const intl = intl30.intl;
return intl.string(intl30.t["/Q4HRN"]);
} else {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Unexpected interval");
throw error;
}
}
}
if (constants7.MONTH === interval) {
2026-10-12 16:32:48 +00:00
if (num > 1) {
let formatToPlainString2Result;
const intl9 = intl30.intl;
const formatToPlainString2 = intl9.formatToPlainString;
const tmp24 = require;
if (flag) {
obj2 = { intervalCount: num };
formatToPlainString2Result = formatToPlainString2(_modDef2632.G1Q40N, obj2);
} else {
const obj3 = { intervalCount: num };
formatToPlainString2Result = formatToPlainString2(tmp24(1126).t["0UlZnH"], obj3);
}
return formatToPlainString2Result;
2026-10-02 13:37:24 +00:00
} else {
2026-10-12 16:32:48 +00:00
let poEovT2;
const intl10 = intl30.intl;
const formatToPlainString3 = intl10.formatToPlainString;
if (TIER_2 === closure_39.TIER_0) {
poEovT2 = tmp28(1126).t.NPKsLz;
} else {
poEovT2 = tmp28(1126).t.poEovT;
}
const obj4 = { timeInterval: intl7.string(intl30.t.FPybU7) };
intl7 = tmp28(1126).intl;
let formatToPlainString3Result = formatToPlainString3(poEovT2, obj4);
if (!flag) {
const intl8 = tmp28(1126).intl;
formatToPlainString3Result = intl8.string(tmp28(1126).t.Mh9bTt);
}
return formatToPlainString3Result;
2026-10-02 13:37:24 +00:00
}
} else if (tmp15.YEAR === interval) {
let poEovT;
const intl4 = intl30.intl;
const formatToPlainString = intl4.formatToPlainString;
if (TIER_2 === closure_39.TIER_0) {
2026-10-07 22:43:51 +00:00
poEovT = tmp19(1126).t.NPKsLz;
2026-10-02 13:37:24 +00:00
} else {
2026-10-07 22:43:51 +00:00
poEovT = tmp19(1126).t.poEovT;
2026-10-02 13:37:24 +00:00
}
2026-10-12 16:32:48 +00:00
const obj5 = { timeInterval: intl5.string(intl30.t.tfqrhj) };
2026-10-07 22:43:51 +00:00
intl5 = tmp19(1126).intl;
2026-10-12 16:32:48 +00:00
let formatToPlainStringResult1 = formatToPlainString(poEovT, obj5);
2026-10-02 13:37:24 +00:00
if (!flag) {
2026-10-07 22:43:51 +00:00
const intl6 = tmp19(1126).intl;
formatToPlainStringResult1 = intl6.string(tmp19(1126).t.DRgqMo);
2026-10-02 13:37:24 +00:00
}
return formatToPlainStringResult1;
} else {
const _Error2 = Error;
const self3 = this;
const self4 = this;
const error1 = new Error("Unexpected interval");
throw error1;
}
}
function getIntervalStringAsNoun(interval) {
if (constants7.MONTH === interval) {
const intl2 = intl30.intl;
return intl2.string(intl30.t.FPybU7);
} else if (tmp.YEAR === interval) {
const intl = intl30.intl;
return intl.string(intl30.t.tfqrhj);
} else {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Unexpected interval");
throw error;
}
}
function getPremiumType(planIdFromItems) {
let obj3;
if (null != closure_42[planIdFromItems]) {
return closure_42[planIdFromItems].premiumType;
} else {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Unsupported plan");
obj2 = { tags: obj3 };
obj3 = { planId: planIdFromItems };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj2);
throw error;
}
}
function getTierDisplayNameByPlanId(PREMIUM_MONTH_TIER_0) {
let obj3;
let premiumType;
if (closure_42[PREMIUM_MONTH_TIER_0] != null) {
premiumType = tmp.premiumType;
}
let tmp3 = null;
if (null != premiumType) {
tmp3 = closure_37[premiumType];
}
if (null != tmp3) {
const intl = intl30.intl;
return intl.string(tmp3);
} else {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Unsupported plan");
obj2 = { tags: obj3 };
obj3 = { planId: PREMIUM_MONTH_TIER_0 };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj2);
throw error;
}
}
function getPremiumPlanOptions(isPremium) {
let defaultPlanId;
2026-10-12 16:32:48 +00:00
let isThreeMonthGiftingEnabled;
2026-10-02 13:37:24 +00:00
let skuId;
2026-10-12 16:32:48 +00:00
({ skuId, defaultPlanId, isThreeMonthGiftingEnabled } = isPremium);
isPremium = isPremium.isPremium;
if (isThreeMonthGiftingEnabled === undefined) {
isThreeMonthGiftingEnabled = false;
}
2026-10-02 13:37:24 +00:00
if (null != skuId) {
2026-10-12 16:32:48 +00:00
if (isPremium) {
let items3;
2026-10-02 13:37:24 +00:00
let tmp;
if (undefined !== defaultPlanId) {
if (skuId === closure_42[defaultPlanId].skuId) {
tmp = defaultPlanId;
}
}
if (__initData5.TIER_0 === skuId) {
const items = [, ];
2026-10-12 16:32:48 +00:00
({ PREMIUM_YEAR_TIER_0: arr4[0], PREMIUM_MONTH_TIER_0: arr4[1] } = SubscriptionPlans);
items3 = items;
2026-10-02 13:37:24 +00:00
} else if (__initData5.TIER_1 === skuId) {
const items1 = [SubscriptionPlans.PREMIUM_MONTH_TIER_1];
2026-10-12 16:32:48 +00:00
items3 = items1;
2026-10-02 13:37:24 +00:00
} else if (__initData5.TIER_2 === skuId) {
2026-10-12 16:32:48 +00:00
const PREMIUM_YEAR_TIER_2 = SubscriptionPlans.PREMIUM_YEAR_TIER_2;
if (isThreeMonthGiftingEnabled) {
const items2 = [PREMIUM_YEAR_TIER_2, , ];
({ PREMIUM_3_MONTH_TIER_2: arr2[1], PREMIUM_MONTH_TIER_2: arr2[2] } = SubscriptionPlans);
items3 = items2;
} else {
items3 = [PREMIUM_YEAR_TIER_2, SubscriptionPlans.PREMIUM_MONTH_TIER_2];
}
2026-10-02 13:37:24 +00:00
} else if (__initData5.GUILD === skuId) {
return [];
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
const self = this;
const self2 = this;
const error = new Error("Unexpected SKU: " + skuId);
throw error;
}
if (undefined !== tmp) {
2026-10-12 16:32:48 +00:00
const index = items3.indexOf(tmp);
if (-1 !== index) {
items3.splice(index, 1);
items3.unshift(tmp);
}
2026-10-02 13:37:24 +00:00
}
2026-10-12 16:32:48 +00:00
return items3;
2026-10-02 13:37:24 +00:00
}
}
return [];
}
function getBillingInformationString(status, subscriptionPeriodStart, arg2, flag, fractionalPremiumInfo) {
let addResult;
let addResult1;
let addResult2;
let endsAt;
let formatPriceResult;
let intl10;
let intl12;
let intl2;
let tmp14;
let tmp = arg2;
if (arg2 === undefined) {
tmp = null;
}
if (flag === undefined) {
flag = false;
}
let tmp2 = fractionalPremiumInfo;
if (fractionalPremiumInfo === undefined) {
2026-10-12 16:32:48 +00:00
tmp2 = { isFractionalPremiumActive: false, fetched: true, fractionalState: constants6.NONE, startsAt: _modDef4702(0), endsAt: _modDef4702(0), currentEntitlementId: "", currentEntitlementEndsAt: _modDef4702(0), unactivatedUnits: [] };
obj = { isFractionalPremiumActive: false, fetched: true, fractionalState: constants6.NONE, startsAt: _modDef4702(0), endsAt: _modDef4702(0), currentEntitlementId: "", currentEntitlementEndsAt: _modDef4702(0), unactivatedUnits: [] };
2026-10-02 13:37:24 +00:00
}
let tmp6 = subscriptionPeriodStart;
if (null !== tmp) {
tmp6 = subscriptionPeriodStart;
if (status.status === constants4.PAST_DUE) {
tmp6 = tmp;
}
}
const formatPrice = PriceUtils.formatPrice;
PriceUtils;
if (flag) {
const invoiceItems = tmp6.invoiceItems;
const found = invoiceItems.filter((subscriptionPlanId) => set.has(subscriptionPlanId.subscriptionPlanId));
const mapped = found.map((amount) => amount.amount);
formatPriceResult = formatPrice(mapped.reduce((acc, item) => item + acc, 0), tmp6.currency);
tmp14 = tmp8;
} else {
formatPriceResult = formatPrice(tmp6.total, tmp6.currency);
tmp14 = tmp8;
}
const currentUser = UserStore.getCurrentUser();
let isOnReverseTrialResult;
if (currentUser != null) {
isOnReverseTrialResult = currentUser.isOnReverseTrial();
}
if (isOnReverseTrialResult) {
2026-10-01 14:13:23 +00:00
let currentPeriodEnd;
if (null != tmp2.currentEntitlementEndsAt) {
const currentEntitlementEndsAt = tmp2.currentEntitlementEndsAt;
2026-10-01 14:13:23 +00:00
currentPeriodEnd = currentEntitlementEndsAt.toDate();
} else {
currentPeriodEnd = status.currentPeriodEnd;
}
2026-10-07 22:43:51 +00:00
const intl16 = tmp14(1126).intl;
obj2 = { trialEnd: currentPeriodEnd };
2026-10-07 22:43:51 +00:00
return intl16.format(tmp14(1126).t["7ZS2m1"], obj2);
} else if (status.status === constants4.CANCELED) {
2026-10-07 22:43:51 +00:00
const intl15 = tmp14(1126).intl;
const obj4 = { endDate: subscriptionPeriodStart.subscriptionPeriodStart };
2026-10-07 22:43:51 +00:00
return intl15.format(tmp14(1126).t["Whp/qk"], obj4);
2026-10-01 14:13:23 +00:00
} else if (status.status === constants4.PAUSE_PENDING) {
2026-10-07 22:43:51 +00:00
const intl14 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
const obj5 = { pauseDate: null, resumeDate: null };
({ currentPeriodEnd: obj26.pauseDate, pauseEndsAt: obj26.resumeDate } = status);
2026-10-07 22:43:51 +00:00
return intl14.format(tmp14(1126).t.uBLUGU, obj5);
2026-10-01 14:13:23 +00:00
} else if (status.status === constants4.PAUSED) {
let format8Result;
if (tmp2.fractionalState !== constants6.NONE) {
2026-10-07 22:43:51 +00:00
const intl13 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
const format8 = intl13.format;
const obj6 = { renewalDate: endsAt.toDate(), price: formatPriceResult };
endsAt = tmp2.endsAt;
2026-10-07 22:43:51 +00:00
const Q18lRK = tmp14(1126).t.Q18lRK;
2026-10-01 14:13:23 +00:00
format8Result = format8(Q18lRK, obj6);
} else if (null == status.pauseEndsAt) {
2026-10-01 14:13:23 +00:00
let format7Result;
2026-10-07 22:43:51 +00:00
const intl11 = tmp14(1126).intl;
if (flag) {
2026-10-01 14:13:23 +00:00
const format7 = intl11.format;
2026-10-07 22:43:51 +00:00
const obj7 = { planName: intl12.string(tmp14(1126).t.Ipxkog), price: formatPriceResult };
const KTYQCg = tmp14(1126).t.KTYQCg;
intl12 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
format7Result = format7(KTYQCg, obj7);
} else {
2026-10-07 22:43:51 +00:00
format7Result = intl11.string(tmp14(1126).t.fMz6Lg);
}
2026-10-01 14:13:23 +00:00
format8Result = format7Result;
} else {
2026-10-07 22:43:51 +00:00
const intl17 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
const format9 = intl17.format;
2026-10-07 22:43:51 +00:00
const t3 = tmp14(1126).t;
if (flag) {
2026-10-01 14:13:23 +00:00
const zcgtzf = t3.zcgtzf;
2026-10-07 22:43:51 +00:00
const obj8 = { planName: intl10.string(tmp14(1126).t.Ipxkog), resumeDate: status.pauseEndsAt, price: formatPriceResult };
intl10 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
format8Result = format9(zcgtzf, obj8);
} else {
const obj9 = { resumeDate: status.pauseEndsAt };
2026-10-01 14:13:23 +00:00
format8Result = format9(t3["V8+l6k"], obj9);
}
}
2026-10-01 14:13:23 +00:00
return format8Result;
} else if (status.status === constants4.PAST_DUE) {
let format6Result;
let expiresDate = getBillingGracePeriodDaysAndExpiresDate(status).expiresDate;
let isPurchasedViaGoogle = status.isPurchasedViaGoogle;
if (isPurchasedViaGoogle) {
const metadata = status.metadata;
let prop;
if (metadata != null) {
prop = metadata.google_grace_period_expires_date;
}
isPurchasedViaGoogle = null != prop;
}
if (isPurchasedViaGoogle) {
2026-10-12 16:32:48 +00:00
expiresDate = _modDef4702(status.metadata.google_grace_period_expires_date);
}
let isPurchasedViaApple = status.isPurchasedViaApple;
if (isPurchasedViaApple) {
const metadata2 = status.metadata;
let prop1;
if (metadata2 != null) {
prop1 = metadata2.apple_grace_period_expires_date;
}
isPurchasedViaApple = null != prop1;
}
if (isPurchasedViaApple) {
2026-10-12 16:32:48 +00:00
expiresDate = _modDef4702(status.metadata.apple_grace_period_expires_date);
}
2026-10-01 14:13:23 +00:00
const isPurchasedExternally = status.isPurchasedExternally;
2026-10-07 22:43:51 +00:00
const intl9 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
const format6 = intl9.format;
2026-10-07 22:43:51 +00:00
const t2 = tmp14(1126).t;
2026-10-01 14:13:23 +00:00
if (isPurchasedExternally) {
const obj10 = { endDate: expiresDate.toDate(), paymentGatewayName: lastJoinedRecommendedGuild[status.paymentGateway], paymentSourceLink: null };
const U2hb3W = t2.U2hb3W;
const paymentGateway3 = status.paymentGateway;
if (constants2.APPLE_PARTNER !== paymentGateway3) {
2026-10-01 14:13:23 +00:00
if (constants2.APPLE_ADVANCED_COMMERCE !== paymentGateway3) {
let PAYMENT_SOURCE_MANAGEMENT2;
if (constants2.APPLE !== paymentGateway3) {
if (constants2.GOOGLE === paymentGateway3) {
PAYMENT_SOURCE_MANAGEMENT2 = constants10.PAYMENT_SOURCE_MANAGEMENT;
} else {
const _Error3 = Error;
const _HermesInternal3 = HermesInternal;
2026-10-01 14:13:23 +00:00
const self7 = this;
const self8 = this;
const error = new Error("Invalid external payment gateway " + paymentGateway3);
throw error;
}
}
obj10.paymentSourceLink = PAYMENT_SOURCE_MANAGEMENT2;
2026-10-01 14:13:23 +00:00
format6Result = format6(U2hb3W, obj10);
}
}
PAYMENT_SOURCE_MANAGEMENT2 = constants9.PAYMENT_SOURCE_MANAGEMENT;
} else {
2026-10-01 14:13:23 +00:00
const qEIzyi = t2.qEIzyi;
const obj11 = { endDate: expiresDate.toDate(), price: formatPriceResult };
2026-10-01 14:13:23 +00:00
format6Result = format6(qEIzyi, obj11);
}
2026-10-01 14:13:23 +00:00
return format6Result;
} else if (status.status === constants4.BILLING_RETRY) {
2026-10-07 22:43:51 +00:00
const intl8 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
const format5 = intl8.format;
const obj13 = { endDate: addResult.toDate(), price: formatPriceResult };
2026-10-07 22:43:51 +00:00
const EMTLOT2 = tmp14(1126).t.EMTLOT;
2026-10-12 16:32:48 +00:00
const obj18 = _modDef4702(status.currentPeriodStart);
2026-10-07 22:43:51 +00:00
addResult = obj18.add(set, "days");
2026-10-01 14:13:23 +00:00
return format5(EMTLOT2, obj13);
} else if (status.status === constants4.ACCOUNT_HOLD) {
if (status.isPurchasedViaGoogle) {
2026-10-01 14:13:23 +00:00
let format3Result;
2026-10-12 16:32:48 +00:00
const tmp14Result = tmp14(4782);
if (!tmp14Result.isGooglePlayBillingSupported()) {
2026-10-07 22:43:51 +00:00
const intl6 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
const format3 = intl6.format;
const obj14 = { endDate: addResult1.toDate(), paymentGatewayName: lastJoinedRecommendedGuild[status.paymentGateway], paymentSourceLink: null };
2026-10-07 22:43:51 +00:00
const prop2 = tmp14(1126).t["dtcxw+"];
2026-10-12 16:32:48 +00:00
const obj12 = _modDef4702(status.currentPeriodStart);
const paymentGateway2 = status.paymentGateway;
2026-10-01 14:13:23 +00:00
addResult1 = obj12.add(prioritySpeakerDucking, "days");
if (constants2.APPLE_PARTNER !== paymentGateway2) {
2026-10-01 14:13:23 +00:00
if (constants2.APPLE_ADVANCED_COMMERCE !== paymentGateway2) {
let PAYMENT_SOURCE_MANAGEMENT;
if (constants2.APPLE !== paymentGateway2) {
if (constants2.GOOGLE === paymentGateway2) {
PAYMENT_SOURCE_MANAGEMENT = constants10.PAYMENT_SOURCE_MANAGEMENT;
} else {
const _Error2 = Error;
const _HermesInternal2 = HermesInternal;
2026-10-01 14:13:23 +00:00
const self5 = this;
const self6 = this;
const error1 = new Error("Invalid external payment gateway " + paymentGateway2);
throw error1;
}
}
obj14.paymentSourceLink = PAYMENT_SOURCE_MANAGEMENT;
2026-10-01 14:13:23 +00:00
format3Result = format3(prop2, obj14);
}
}
PAYMENT_SOURCE_MANAGEMENT = constants9.PAYMENT_SOURCE_MANAGEMENT;
}
2026-10-01 14:13:23 +00:00
return format3Result;
}
2026-10-07 22:43:51 +00:00
const intl7 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
const format4 = intl7.format;
const obj16 = { endDate: addResult2.toDate(), price: formatPriceResult };
2026-10-07 22:43:51 +00:00
const EMTLOT = tmp14(1126).t.EMTLOT;
2026-10-12 16:32:48 +00:00
const obj15 = _modDef4702(status.currentPeriodStart);
2026-10-01 14:13:23 +00:00
addResult2 = obj15.add(prioritySpeakerDucking, "days");
format3Result = format4(EMTLOT, obj16);
} else {
let tmp21 = null != status.paymentSourceId;
if (tmp21) {
const paymentSourceId = status.paymentSourceId;
let flag2 = false;
if (null != paymentSourceId) {
const paymentSource = PaymentSourceStore.getPaymentSource(paymentSourceId);
2026-10-01 14:13:23 +00:00
const hasItem = null != paymentSource && set3.has(paymentSource.type);
flag2 = hasItem;
}
tmp21 = flag2;
}
if (tmp21) {
2026-10-07 22:43:51 +00:00
const intl5 = tmp14(1126).intl;
const obj17 = { prepaidEndDate: status.currentPeriodEnd };
2026-10-07 22:43:51 +00:00
return intl5.format(tmp14(1126).t.awpB0C, obj17);
2026-10-01 14:13:23 +00:00
} else if (status.status === constants4.UNPAID) {
2026-10-07 22:43:51 +00:00
const intl4 = tmp14(1126).intl;
const obj19 = { maxProcessingTimeInDays };
2026-10-07 22:43:51 +00:00
return intl4.format(tmp14(1126).t.CzTKom, obj19);
} else if (status.isPurchasedExternally) {
2026-10-07 22:43:51 +00:00
const intl3 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
const format2 = intl3.format;
const obj20 = { renewalDate: subscriptionPeriodStart.subscriptionPeriodStart, paymentGatewayName: lastJoinedRecommendedGuild[status.paymentGateway], subscriptionManagementLink: null };
const paymentGateway = status.paymentGateway;
if (constants2.APPLE_PARTNER !== paymentGateway) {
2026-10-01 14:13:23 +00:00
if (constants2.APPLE_ADVANCED_COMMERCE !== paymentGateway) {
let SUBSCRIPTION_MANAGEMENT;
if (constants2.APPLE !== paymentGateway) {
if (constants2.GOOGLE === paymentGateway) {
SUBSCRIPTION_MANAGEMENT = constants10.SUBSCRIPTION_MANAGEMENT;
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
2026-10-01 14:13:23 +00:00
const self3 = this;
const self4 = this;
const error2 = new Error("Invalid external payment gateway " + paymentGateway);
throw error2;
}
}
obj20.subscriptionManagementLink = SUBSCRIPTION_MANAGEMENT;
2026-10-01 14:13:23 +00:00
return format2(tmp29, obj20);
}
}
SUBSCRIPTION_MANAGEMENT = constants9.SUBSCRIPTION_MANAGEMENT;
} else {
2026-10-01 14:13:23 +00:00
let formatResult;
const _Date = Date;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const date = new Date(subscriptionPeriodStart.subscriptionPeriodStart);
let toDateResult = date;
2026-10-01 14:13:23 +00:00
const tmp24 = status.isBoostOnly || status.hasAnyPremiumGroup;
if (!tmp24) {
const unactivatedUnits = tmp2.unactivatedUnits;
2026-10-12 16:32:48 +00:00
const obj3 = _modDef4702(date);
let addResult3 = obj3;
if (unactivatedUnits.length > 0) {
2026-10-12 16:32:48 +00:00
const mapped1 = unactivatedUnits.map(f90546);
addResult3 = obj3.add(mapped1.reduce(f90547, 0), "hours");
}
toDateResult = addResult3.toDate();
}
2026-10-07 22:43:51 +00:00
const intl = tmp14(1126).intl;
const format = intl.format;
2026-10-07 22:43:51 +00:00
const t = tmp14(1126).t;
if (flag) {
2026-10-01 14:13:23 +00:00
const Vl3cED = t.Vl3cED;
2026-10-07 22:43:51 +00:00
const obj21 = { planName: intl2.string(tmp14(1126).t.Ipxkog), renewalDate: toDateResult, price: formatPriceResult };
intl2 = tmp14(1126).intl;
2026-10-01 14:13:23 +00:00
formatResult = format(Vl3cED, obj21);
} else {
const obj22 = { renewalDate: toDateResult, price: formatPriceResult };
2026-10-01 14:13:23 +00:00
formatResult = format(t.Q18lRK, obj22);
}
2026-10-01 14:13:23 +00:00
return formatResult;
}
}
}
2026-10-02 13:37:24 +00:00
function extendDateWithUnconsumedFractionalPremium(date, unconsumedFractionalPremiumUnits, diff, excludeReverseTrialFromCountdown) {
let tmp4;
2026-10-12 16:32:48 +00:00
const tmp3 = _modDef4702;
if (!excludeReverseTrialFromCountdown) {
tmp4 = date;
}
2026-10-01 14:13:23 +00:00
const tmp3Result = tmp3(tmp4);
let addResult = tmp3Result;
2026-10-02 13:37:24 +00:00
if (unconsumedFractionalPremiumUnits.length > 0) {
2026-10-12 16:32:48 +00:00
const mapped = unconsumedFractionalPremiumUnits.map(f90546);
addResult = tmp3Result.add(mapped.reduce(f90547, 0), "hours");
}
let addResult1 = addResult;
if (!excludeReverseTrialFromCountdown) {
addResult1 = addResult;
if (undefined !== diff) {
2026-10-12 16:32:48 +00:00
const diffResult = diff.diff(_modDef4702(), "hours", true);
addResult1 = addResult;
if (diffResult > 0) {
addResult1 = addResult.add(diffResult, "hours");
}
}
}
return addResult1.toDate();
}
function getUnactivatedFractionalPremiumDurationString(unactivatedUnits) {
unactivatedUnits = unactivatedUnits.unactivatedUnits;
2026-10-12 16:32:48 +00:00
const mapped = unactivatedUnits.map(f90546);
const reduced = mapped.reduce(f90547, 0);
if (reduced > 0) {
if (unactivatedUnits.fractionalState === constants6.NONE) {
2026-10-01 14:13:23 +00:00
const time = { days: intl30.t.fYmirx, hours: intl30.t["C3RO+g"], minutes: intl30.t.r77oHc };
const roundFPCountdownUnits = useFPDurationLeft.roundFPCountdownUnits;
useFPDurationLeft;
obj2 = DateUtils;
const result = roundFPCountdownUnits(obj2.diffAsUnits(0, reduced * DurationsDefault.Millis.HOUR));
const obj3 = DateUtils;
return obj3.unitsAsStrings(result, time);
}
}
return "";
}
function isSwitchingPlansDisabled(renewalMutations) {
2026-10-01 14:13:23 +00:00
return null != renewalMutations.renewalMutations || null != renewalMutations.trialEndsAt || renewalMutations.status === constants4.PAST_DUE;
}
function getSwitchingPlansDisabledMessage(renewalMutations) {
2026-10-01 14:13:23 +00:00
let stringResult1 = null;
if (null != renewalMutations.renewalMutations) {
let stringResult;
if (renewalMutations.renewalMutations.planId !== renewalMutations.planId) {
const intl2 = intl30.intl;
stringResult = intl2.string(intl30.t["0rzJ4J"]);
} else {
const intl = intl30.intl;
2026-10-02 13:37:24 +00:00
stringResult = intl.string(intl30.t["9dLQ0/"]);
}
stringResult1 = stringResult;
}
2026-10-02 13:37:24 +00:00
if (null != renewalMutations.trialEndsAt) {
const intl3 = intl30.intl;
stringResult1 = intl3.string(intl30.t.a9Mdb3);
}
return stringResult1;
}
function getPlanIdFromInvoice(subscription, renewalInvoicePreview) {
2026-10-01 14:13:23 +00:00
const planId = subscription.planId;
if (subscription.status !== constants4.CANCELED) {
if (subscription.status !== tmp.PAUSE_PENDING) {
_modDef38(null != renewalInvoicePreview, "Expected invoicePreview");
const invoiceItems = renewalInvoicePreview.invoiceItems;
const found = invoiceItems.find((subscriptionPlanId) => set.has(subscriptionPlanId.subscriptionPlanId));
if (null != found) {
2026-10-01 14:13:23 +00:00
let planId2;
if (!isNoneSubscription(found.subscriptionPlanId)) {
2026-10-01 14:13:23 +00:00
planId2 = found.subscriptionPlanId;
}
2026-10-01 14:13:23 +00:00
return planId2;
}
2026-10-01 14:13:23 +00:00
planId2 = subscription.planId;
}
}
2026-10-01 14:13:23 +00:00
return planId;
}
function getStatusFromInvoice(subscription, renewalInvoicePreview) {
const status = subscription.status;
if (subscription.status !== constants4.CANCELED) {
2026-10-01 14:13:23 +00:00
if (subscription.status !== constants4.PAUSE_PENDING) {
_modDef38(null != renewalInvoicePreview, "Expected invoicePreview");
const invoiceItems = renewalInvoicePreview.invoiceItems;
const found = invoiceItems.find((subscriptionPlanId) => set.has(subscriptionPlanId.subscriptionPlanId));
2026-10-12 16:32:48 +00:00
let tmp3 = null != found;
const tmp2 = subscription.isPurchasedExternally && null != subscription.renewalMutations;
if (tmp3) {
tmp3 = !isNoneSubscription(found.subscriptionPlanId);
}
if (!tmp3) {
tmp3 = tmp2;
}
let CANCELED = status;
2026-10-12 16:32:48 +00:00
if (!tmp3) {
CANCELED = tmp.CANCELED;
}
return CANCELED;
}
}
return status;
}
function isBaseSubscriptionCanceled(renewalMutations) {
renewalMutations = renewalMutations.renewalMutations;
let tmp = renewalMutations.status === constants4.CANCELED;
if (!tmp) {
2026-10-01 14:13:23 +00:00
tmp = null != renewalMutations && isNoneSubscription(renewalMutations.planId) && !renewalMutations.isPurchasedExternally;
const tmp3 = null != renewalMutations && isNoneSubscription(renewalMutations.planId) && !renewalMutations.isPurchasedExternally;
}
return tmp;
}
function getBillingReviewSubheader(arg0, id, arg2) {
2026-10-01 14:13:23 +00:00
let obj4;
id = id.id;
if (null != arg0) {
if (SubscriptionPlans.PREMIUM_MONTH_TIER_0 === id) {
2026-10-01 14:13:23 +00:00
const intl15 = intl30.intl;
return intl15.string(intl30.t["0ggVqN"]);
} else if (SubscriptionPlans.PREMIUM_YEAR_TIER_0 === id) {
const intl14 = intl30.intl;
return intl14.string(intl30.t["jm+ZQw"]);
} else if (SubscriptionPlans.PREMIUM_MONTH_TIER_1 === id) {
const intl13 = intl30.intl;
return intl13.string(intl30.t.uph4Jx);
} else if (SubscriptionPlans.PREMIUM_YEAR_TIER_1 === id) {
const intl12 = intl30.intl;
return intl12.string(intl30.t["D/l7Yt"]);
} else {
2026-10-01 14:13:23 +00:00
if (SubscriptionPlans.PREMIUM_MONTH_TIER_2 !== id) {
if (SubscriptionPlans.PREMIUM_GROUP_MONTH !== id) {
if (SubscriptionPlans.PREMIUM_YEAR_TIER_2 === id) {
const intl10 = intl30.intl;
return intl10.string(intl30.t.G0mISV);
}
}
}
2026-10-01 14:13:23 +00:00
const intl11 = intl30.intl;
return intl11.string(intl30.t["5l1MuV"]);
}
}
if (SubscriptionPlans.PREMIUM_MONTH_TIER_0 === id) {
2026-10-01 14:13:23 +00:00
let string6Result;
const intl9 = intl30.intl;
const string6 = intl9.string;
2026-10-01 14:13:23 +00:00
const t6 = intl30.t;
if (arg2) {
2026-10-01 14:13:23 +00:00
string6Result = string6(t6.cRCCJ3);
} else {
string6Result = string6(t6["/G3aKw"]);
}
return string6Result;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_YEAR_TIER_0 === id) {
let string5Result;
const intl8 = intl30.intl;
const string5 = intl8.string;
2026-10-01 14:13:23 +00:00
const t5 = intl30.t;
if (arg2) {
2026-10-01 14:13:23 +00:00
string5Result = string5(t5.cRCCJ3);
} else {
string5Result = string5(t5["2eQpsL"]);
}
return string5Result;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_MONTH_TIER_1 === id) {
let string4Result;
const intl7 = intl30.intl;
const string4 = intl7.string;
2026-10-01 14:13:23 +00:00
const t4 = intl30.t;
if (arg2) {
2026-10-01 14:13:23 +00:00
string4Result = string4(t4.cRCCJ3);
} else {
string4Result = string4(t4.gueLg5);
}
return string4Result;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_YEAR_TIER_1 === id) {
let string3Result;
const intl6 = intl30.intl;
const string3 = intl6.string;
2026-10-01 14:13:23 +00:00
const t3 = intl30.t;
if (arg2) {
2026-10-01 14:13:23 +00:00
string3Result = string3(t3.cRCCJ3);
} else {
string3Result = string3(t3["MhH/vW"]);
}
return string3Result;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_MONTH_TIER_2 === id) {
let string2Result;
const intl5 = intl30.intl;
const string2 = intl5.string;
2026-10-01 14:13:23 +00:00
const t2 = intl30.t;
if (arg2) {
2026-10-01 14:13:23 +00:00
string2Result = string2(t2.cRCCJ3);
} else {
string2Result = string2(t2.LQVQIq);
}
return string2Result;
2026-10-01 14:13:23 +00:00
} else if (SubscriptionPlans.PREMIUM_GROUP_MONTH === id) {
const intl4 = intl30.intl;
const formatToPlainString = intl4.formatToPlainString;
obj2 = { premiumGroupProductName: closure_47() };
2026-10-12 16:32:48 +00:00
const LwdrNi = _modDef3280.LwdrNi;
2026-10-01 14:13:23 +00:00
return formatToPlainString(LwdrNi, obj2);
} else if (SubscriptionPlans.PREMIUM_YEAR_TIER_2 === id) {
let stringResult;
const intl3 = intl30.intl;
const string = intl3.string;
2026-10-01 14:13:23 +00:00
const t = intl30.t;
if (arg2) {
2026-10-01 14:13:23 +00:00
stringResult = string(t.cRCCJ3);
} else {
stringResult = string(t["0nfg1x"]);
}
return stringResult;
} else {
2026-10-01 14:13:23 +00:00
if (SubscriptionPlans.PREMIUM_3_MONTH_TIER_2 !== id) {
if (SubscriptionPlans.PREMIUM_6_MONTH_TIER_2 !== id) {
if (SubscriptionPlans.NONE_MONTH !== id) {
if (SubscriptionPlans.NONE_YEAR !== id) {
if (SubscriptionPlans.NONE_3_MONTH !== id) {
if (SubscriptionPlans.NONE_6_MONTH !== id) {
if (SubscriptionPlans.PREMIUM_MONTH_GUILD !== id) {
if (SubscriptionPlans.PREMIUM_YEAR_GUILD !== id) {
if (SubscriptionPlans.PREMIUM_3_MONTH_GUILD !== id) {
if (SubscriptionPlans.PREMIUM_6_MONTH_GUILD !== id) {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("User is purchasing an unsupported plan");
2026-10-01 14:13:23 +00:00
const obj3 = { tags: obj4 };
obj4 = { planId: id };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj3);
throw error;
}
}
}
}
}
}
}
}
2026-10-01 14:13:23 +00:00
const intl = intl30.intl;
return intl.string(intl30.t.eUEeCt);
}
}
2026-10-01 14:13:23 +00:00
const intl2 = intl30.intl;
const obj5 = { intervalCount: id.intervalCount };
2026-10-01 14:13:23 +00:00
return intl2.formatToPlainString(intl30.t.BCD4fT, obj5);
}
}
function getIntervalForInvoice(arg0) {
2026-10-01 14:13:23 +00:00
const value = SubscriptionPlanStore.get(arg0.invoiceItems[0].subscriptionPlanId);
_modDef38(null != value, "Missing subscriptionPlan");
return { intervalType: value.interval, intervalCount: value.intervalCount };
}
function getGuildBoostPlanItem(items) {
let found = null;
if (null != items) {
items = items.items;
2026-10-12 16:32:48 +00:00
found = items.find(f90545);
}
return found;
}
function isBoostOnlySubscription(subscription) {
let tmp = null != subscription;
if (tmp) {
const items = subscription.items;
2026-10-12 16:32:48 +00:00
tmp = null == items.find(f90526);
}
if (tmp) {
let found = null;
if (null != subscription) {
const items1 = subscription.items;
2026-10-12 16:32:48 +00:00
found = items1.find(f90545);
}
tmp = null != found;
}
return tmp;
}
function getPremiumSkuIdForSubscription(items) {
2026-10-01 14:13:23 +00:00
let obj3;
let found = null;
if (null != items) {
items = items.items;
2026-10-12 16:32:48 +00:00
found = items.find(f90526);
}
let skuId = null;
if (null != found) {
const planId = found.planId;
2026-10-01 14:13:23 +00:00
if (null == closure_42[planId]) {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Unsupported plan");
2026-10-01 14:13:23 +00:00
obj2 = { tags: obj3 };
obj3 = { planId };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj2);
throw error;
} else {
skuId = tmp4.skuId;
}
}
return skuId;
}
function getPremiumTypeFromSubscription(subscription) {
2026-10-01 14:13:23 +00:00
let obj3;
if (null != subscription) {
2026-10-02 13:37:24 +00:00
const items = subscription.items;
2026-10-12 16:32:48 +00:00
const found = items.find(f90526);
2026-10-02 13:37:24 +00:00
if (null != found) {
const planId = found.planId;
if (null != closure_42[planId]) {
return closure_42[planId].premiumType;
} else {
2026-10-02 13:37:24 +00:00
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Unsupported plan");
obj2 = { tags: obj3 };
obj3 = { planId };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj2);
throw error;
}
}
}
}
2026-10-02 13:37:24 +00:00
function isNewUser(createdAt) {
let tmp = null != createdAt;
if (tmp) {
const _Date = Date;
createdAt = createdAt.createdAt;
const timestamp = Date.now();
tmp = timestamp - createdAt.getTime() < 2592000000;
}
2026-10-02 13:37:24 +00:00
return tmp;
}
function formatPriceString(amount, arg1) {
let stringResult;
obj = PriceUtils;
const formatPriceResult = obj.formatPrice(amount.amount, amount.currency);
if (constants7.MONTH === arg1) {
2026-10-07 22:43:51 +00:00
const intl2 = tmp(1126).intl;
stringResult = intl2.string(tmp(1126).t.FPybU7);
2026-10-02 13:37:24 +00:00
} else if (tmp4.YEAR === arg1) {
2026-10-07 22:43:51 +00:00
const intl = tmp(1126).intl;
stringResult = intl.string(tmp(1126).t.tfqrhj);
2026-10-02 13:37:24 +00:00
} else {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Unexpected interval");
throw error;
}
2026-10-02 13:37:24 +00:00
return "" + formatPriceResult + "/" + stringResult;
}
function castPremiumSubscriptionAsSkuId(skuIdForPlan) {
return skuIdForPlan;
}
function formatInterval(interval) {
if (interval === constants7.YEAR) {
const intl2 = intl30.intl;
return intl2.string(intl30.t.tfqrhj);
} else if (interval === tmp.MONTH) {
const intl = intl30.intl;
return intl.string(intl30.t.FPybU7);
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
const self = this;
const self2 = this;
const error = new Error("Invalid interval type: " + interval);
throw error;
}
}
2026-10-02 13:37:24 +00:00
function isPremiumEligible(isProvisional) {
return null != isProvisional && !isProvisional.isProvisional && !isProvisional.bot;
}
function getFractionalPremiumUnitsHours(arr) {
2026-10-12 16:32:48 +00:00
const mapped = arr.map(f90546);
return mapped.reduce(f90547, 0);
2026-10-02 13:37:24 +00:00
}
function calculateYearlyPlanDollarSavingsAmount(subscriptionPlan) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
let priceOptions = arg2;
if (arg2 === undefined) {
priceOptions = {};
}
2026-10-01 14:13:23 +00:00
obj2 = { subscriptionPlan, isGift: flag, priceOptions };
const tmp = calculateMonthlyPriceEquivalentTotal(obj2);
if (null != tmp) {
if (tmp > 0) {
const tmp5 = getPrice(subscriptionPlan.id, false, flag, priceOptions);
const diff = tmp - tmp5.amount;
let tmp7 = null;
if (diff > 0) {
2026-10-01 14:13:23 +00:00
tmp7 = { amount: diff, currency: tmp5.currency };
const obj3 = { amount: diff, currency: tmp5.currency };
}
return tmp7;
}
}
return null;
}
function calculateYearlyPlanMonthlyRateAmount(interval) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
obj = arg2;
if (arg2 === undefined) {
obj = {};
}
if (interval.interval !== constants7.YEAR) {
return null;
} else {
const tmp4 = getPrice(interval.id, false, flag, obj);
let tmp5 = null;
if (0 !== tmp4.amount) {
const _Math = Math;
2026-10-01 14:13:23 +00:00
tmp5 = { amount: Math.round(tmp4.amount / 12), currency: tmp4.currency };
obj2 = { amount: Math.round(tmp4.amount / 12), currency: tmp4.currency };
}
return tmp5;
}
}
function getDaysSincePremium(arg0) {
let num = 0;
if (null != arg0) {
const _Math = Math;
const _Date = Date;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const differenceInCalendarDays = DateUtils.differenceInCalendarDays;
DateUtils;
const _Date2 = Date;
2026-10-01 14:13:23 +00:00
const self3 = this;
const self4 = this;
const date = new Date();
const date1 = new Date(arg0);
2026-10-01 14:13:23 +00:00
num = max(differenceInCalendarDays(date, date1), 0);
}
return num;
}
function getDaysRemainingUntilSubscriptionCurrentPeriodEnds(currentPeriodEnd) {
2026-10-01 14:13:23 +00:00
const differenceInDays = DateUtils.differenceInDays;
DateUtils;
const date = new Date(currentPeriodEnd.currentPeriodEnd);
2026-10-01 14:13:23 +00:00
const date1 = new Date();
return max(1, ceil(differenceInDays(date, date1)));
}
2026-10-01 14:13:23 +00:00
let obj3 = {
isNewUser,
2026-10-01 14:13:23 +00:00
isPremiumAtLeast: PremiumTypeUtils.isPremiumAtLeast,
isPremium: PremiumTypeUtils.isPremium,
isPremiumExactly: PremiumTypeUtils.isPremiumExactly,
isPremiumEligible,
getPrice,
getDefaultPrice,
getInterval,
getIntervalString,
getIntervalStringAsNoun,
getPremiumType,
getTierDisplayNameByPlanId,
getDisplayName,
getPremiumPlanOptions,
formatInterval,
getPlanDescription,
isPremiumSku(skuId) {
2026-10-02 13:37:24 +00:00
return skuId === __initData5.TIER_0 || skuId === __initData5.TIER_1 || skuId === __initData5.TIER_2;
},
2026-10-12 16:32:48 +00:00
getIntervalMonths,
2026-10-01 14:13:23 +00:00
getUserMaxFileSize: PremiumFeatureUtils.getUserMaxFileSize,
2026-10-02 13:37:24 +00:00
getSkuIdForPlan,
getSkuIdForPremiumType(premiumType) {
2026-10-01 14:13:23 +00:00
if (closure_39.TIER_0 === premiumType) {
2026-10-02 13:37:24 +00:00
return __initData5.TIER_0;
2026-10-01 14:13:23 +00:00
} else if (closure_39.TIER_1 === premiumType) {
2026-10-02 13:37:24 +00:00
return __initData5.TIER_1;
2026-10-01 14:13:23 +00:00
} else if (closure_39.TIER_2 === premiumType) {
2026-10-02 13:37:24 +00:00
return __initData5.TIER_2;
}
},
getNumIncludedPremiumGuildSubscriptionSlots(planId) {
2026-10-01 14:13:23 +00:00
let obj3;
if (null != closure_42[planId]) {
let num = 0;
2026-10-01 14:13:23 +00:00
if (closure_42[planId].premiumType === closure_39.TIER_2) {
2026-10-07 22:43:51 +00:00
num = closure_28;
}
return num;
} else {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Unsupported plan");
2026-10-01 14:13:23 +00:00
obj2 = { tags: obj3 };
obj3 = { planId };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj2);
throw error;
}
},
getBillingInformationString,
getExpectedRenewalDate,
extendDateWithUnconsumedFractionalPremium,
getUnactivatedFractionalPremiumDurationString,
isSwitchingPlansDisabled,
getSwitchingPlansDisabledMessage,
isNoneSubscription,
getPlanIdFromInvoice,
getStatusFromInvoice,
isBaseSubscriptionCanceled,
getPremiumGuildIntervalPrice,
hasAccountCredit(entitlements) {
2026-10-01 14:13:23 +00:00
let someResult = null != entitlements && 0 !== entitlements.size;
if (someResult) {
const _Array = Array;
2026-10-01 14:13:23 +00:00
const arr = Array.from(entitlements);
someResult = arr.some((subscriptionPlanId) => {
let tmp = null != subscriptionPlanId.subscriptionPlanId;
2026-10-01 14:13:23 +00:00
const consumed = subscriptionPlanId.consumed;
if (tmp) {
tmp = null != subscriptionPlanId.parentId;
}
if (tmp) {
2026-10-01 14:13:23 +00:00
tmp = !consumed;
}
return tmp;
});
}
return someResult;
},
hasUnconsumedGiftForSubscriptionPlan(size, arg1) {
2026-10-01 14:13:23 +00:00
let closure_0 = arg1;
let someResult = null != size && 0 !== size.size && null != arg1;
if (someResult) {
const _Array = Array;
2026-10-01 14:13:23 +00:00
const arr = Array.from(size);
someResult = arr.some((subscriptionPlanId) => {
subscriptionPlanId = subscriptionPlanId.subscriptionPlanId;
let tmp = null != subscriptionPlanId;
2026-10-01 14:13:23 +00:00
const consumed = subscriptionPlanId.consumed;
if (tmp) {
tmp = null != subscriptionPlanId.parentId;
}
if (tmp) {
2026-10-01 14:13:23 +00:00
tmp = !consumed;
}
if (tmp) {
tmp = subscriptionPlanId === closure_0;
}
return tmp;
});
}
return someResult;
},
getBillingReviewSubheader,
getIntervalForInvoice,
getPremiumPlanItem,
getGuildBoostPlanItem,
isBoostOnlySubscription,
getPremiumSkuIdForSubscription,
getPremiumTypeFromSubscription,
getUnactivatedFractionalPremiumHours: getFractionalPremiumUnitsHours,
castPremiumSubscriptionAsSkuId,
2026-10-12 16:32:48 +00:00
calculateDiscountPercentageForPlan,
calculateYearlyPlanDollarSavingsAmount,
calculateYearlyPlanMonthlyRateAmount,
getDaysSincePremium,
getDaysRemainingUntilSubscriptionCurrentPeriodEnds,
canUseAnimatedEmojis(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.ANIMATED_EMOJIS, currentUser);
},
canUseEmojisEverywhere(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.EMOJIS_EVERYWHERE, currentUser);
},
canUseSoundboardEverywhere(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.SOUNDBOARD_EVERYWHERE, currentUser);
},
2026-10-02 13:37:24 +00:00
canUseCustomCallSounds(stateFromStores) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
2026-10-02 13:37:24 +00:00
return obj.canUserUse(ProductCatalog.CUSTOM_CALL_SOUNDS, stateFromStores);
},
canUploadLargeFiles(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.UPLOAD_LARGE_FILES, currentUser);
},
canUseBadges(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.PROFILE_BADGES, currentUser);
},
canUseHighVideoUploadQuality(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.INCREASED_VIDEO_UPLOAD_QUALITY, currentUser);
},
canEditDiscriminator(stateFromStores) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.CUSTOM_DISCRIMINATOR, stateFromStores);
},
hasBoostDiscount(stateFromStores) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.BOOST_DISCOUNT, stateFromStores);
},
2026-10-12 16:32:48 +00:00
canUseAnimatedAvatar(user) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
2026-10-12 16:32:48 +00:00
return obj.canUserUse(ProductCatalog.ANIMATED_AVATAR, user);
},
canInstallPremiumApplications(isPremiumWithFractionalPremiumOnly) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.INSTALL_PREMIUM_APPLICATIONS, isPremiumWithFractionalPremiumOnly);
},
canUseIncreasedMessageLength(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.INCREASED_MESSAGE_LENGTH, currentUser);
},
canUseIncreasedGuildCap(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.INCREASED_GUILD_LIMIT, currentUser);
},
canRedeemPremiumPerks(isPremiumWithFractionalPremiumOnly) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.REDEEM_PREMIUM_PERKS, isPremiumWithFractionalPremiumOnly);
},
canUsePremiumProfileCustomization(isPremiumWithFractionalPremiumOnly) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.PROFILE_PREMIUM_FEATURES, isPremiumWithFractionalPremiumOnly);
},
canUsePremiumAppIcons(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.APP_ICONS, currentUser);
},
canUsePremiumGuildMemberProfile(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.PREMIUM_GUILD_MEMBER_PROFILE, currentUser);
},
canUseClientThemes(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.CLIENT_THEMES, currentUser);
},
2026-10-02 13:37:24 +00:00
canStreamQuality(MID, user) {
2026-10-01 14:13:23 +00:00
let canUserUseResult;
if (MID === obj2.HIGH) {
obj2 = ProductCatalog;
2026-10-02 13:37:24 +00:00
canUserUseResult = obj2.canUserUse(ProductCatalog.STREAM_HIGH_QUALITY, user);
} else {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
2026-10-02 13:37:24 +00:00
canUserUseResult = obj.canUserUse(ProductCatalog.STREAM_MID_QUALITY, user);
}
return canUserUseResult;
},
2026-10-02 13:37:24 +00:00
canUseQuestOrbMultiplier,
hasFreeBoosts(stateFromStores) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.FREE_BOOSTS, stateFromStores);
},
canUseCustomStickersEverywhere(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.STICKERS_EVERYWHERE, currentUser);
},
2026-10-12 16:32:48 +00:00
canUseCustomBackgrounds(currentUser) {
2026-10-01 14:13:23 +00:00
obj = ProductCatalog;
2026-10-12 16:32:48 +00:00
return obj.canUserUse(ProductCatalog.VIDEO_FILTER_ASSETS, currentUser);
},
2026-10-02 13:37:24 +00:00
canUseCollectibles,
canUseMonthlyOrbs(stateFromStores) {
let perks;
2026-10-01 14:13:23 +00:00
const hasPerk = PerksStateUtils.hasPerk;
PerksStateUtils;
if (stateFromStores != null) {
perks = stateFromStores.perks;
}
2026-10-01 14:13:23 +00:00
return hasPerk(perks, user2.Perk.MONTHLY_ORBS);
},
canUseShopDiscounts(currentUser) {
let perks;
2026-10-01 14:13:23 +00:00
const hasPerk = PerksStateUtils.hasPerk;
PerksStateUtils;
if (currentUser != null) {
perks = currentUser.perks;
}
2026-10-12 16:32:48 +00:00
let hasPerkResult = hasPerk(perks, tmp(1398).Perk.SHOP_DISCOUNTS);
if (!hasPerkResult) {
2026-10-01 14:13:23 +00:00
const tmpResult = ProductCatalog;
2026-10-12 16:32:48 +00:00
hasPerkResult = tmpResult.canUserUse(tmp(14294).COLLECTIBLES, currentUser);
}
return hasPerkResult;
},
canUseMoreQuestOrbs(perks) {
perks = undefined;
2026-10-01 14:13:23 +00:00
const hasPerk = PerksStateUtils.hasPerk;
PerksStateUtils;
if (perks != null) {
perks = perks.perks;
}
2026-10-12 16:32:48 +00:00
let hasPerkResult = hasPerk(perks, tmp(1398).Perk.MORE_QUEST_ORBS);
if (!hasPerkResult) {
2026-10-01 14:13:23 +00:00
const tmpResult = ProductCatalog;
2026-10-12 16:32:48 +00:00
hasPerkResult = tmpResult.canUserUse(tmp(14294).QUEST_ORB_MULTIPLIER, perks);
2026-10-02 13:37:24 +00:00
}
return hasPerkResult;
},
formatPriceString,
StreamQuality: obj2
};
2026-10-12 16:32:48 +00:00
let tmp9 = ReactCompilerGating.isReactCompilerEnabled() ? (function useHasTier2Premium() {
2026-10-02 13:37:24 +00:00
let currentUser;
let tmp4;
let tmp5;
let tmp8;
obj = react2;
const cResult = obj.c(4);
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [UserStore];
const fn = function e() {
return currentUser.getCurrentUser();
};
cResult[0] = items;
cResult[1] = fn;
tmp4 = items;
tmp5 = fn;
} else {
[tmp4, tmp5] = cResult;
}
const tmpResult = get_initialized;
const stateFromStores = tmpResult.useStateFromStores(tmp4, tmp5);
if (cResult[2] !== stateFromStores) {
const tmpResult2 = PremiumTypeUtils;
const isPremiumExactlyResult = tmpResult2.isPremiumExactly(stateFromStores, closure_39.TIER_2);
cResult[2] = stateFromStores;
cResult[3] = isPremiumExactlyResult;
tmp8 = isPremiumExactlyResult;
} else {
tmp8 = cResult[3];
}
return tmp8;
2026-10-12 16:32:48 +00:00
}) : (function useHasTier2Premium() {
2026-10-02 13:37:24 +00:00
let currentUser;
const items = [UserStore];
obj = get_initialized;
const stateFromStores = obj.useStateFromStores(items, () => currentUser.getCurrentUser());
obj2 = PremiumTypeUtils;
return obj2.isPremiumExactly(stateFromStores, closure_39.TIER_2);
});
function withContextPlanPrices(arg0, arr) {
let tmp = arg0;
if (null != arr) {
obj = {
contextPlanPrices: Object.fromEntries(arr.map((item) => {
const items = [, ];
({ id: arr[0], price: arr[1] } = item);
return items;
}))
};
const merged = Object.assign(arg0);
const _Object = Object;
tmp = obj;
}
return tmp;
}
function experimentalGetPrice(id, arg1) {
let currency;
let paymentSourceId;
let purchaseType;
let tmp = arg1;
if (arg1 === undefined) {
tmp = { purchaseType: map1.DEFAULT };
obj = { purchaseType: map1.DEFAULT };
}
({ paymentSourceId, purchaseType, currency } = tmp);
const arr = experimentalGetPrices(id, { paymentSourceId, purchaseType });
const tmp3 = experimentalGetPrices;
if (0 === arr.length) {
const _HermesInternal = HermesInternal;
logger.warn("No prices found for planId: " + id + ", paymentSourceId: " + paymentSourceId + ", purchaseType: " + purchaseType);
}
if (null != currency) {
let found = arr.find((currency) => currency.currency === currency.toLowerCase());
if (null == found) {
let found1;
if (null != paymentSourceId) {
obj2 = { purchaseType };
const tmp3Result = tmp3(id, obj2);
found1 = tmp3Result.find((currency) => currency.currency === currency.toLowerCase());
}
found = found1;
}
return found;
} else {
return arr[0];
}
}
getSkuIdForPlan = function getSkuIdForPlan(planId) {
let obj3;
if (null == closure_42[planId]) {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Unsupported plan");
obj2 = { tags: obj3 };
obj3 = { planId };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj2);
throw error;
} else {
return closure_42[planId].skuId;
}
};
function subscriptionHasPremiumGuildPlan(subscription) {
const additionalPlans = subscription.additionalPlans;
const items = [__initData5.GUILD];
const planIdsForSkus = SubscriptionPlanStore.getPlanIdsForSkus(items);
_modDef38(null != planIdsForSkus, "Missing guildSubscriptionPlanIds");
const found = additionalPlans.find((planId) => planIdsForSkus.includes(planId.planId));
let num = 0;
if (null != found) {
num = found.quantity;
}
return num > 0;
}
function isPremiumBaseSubscriptionPlan(arg0) {
return set.has(arg0);
}
function isPremiumGuildSubscriptionPlan(planId) {
return set.has(planId);
}
function isSubscriptionPrepaidPaymentSource(paymentSourceId) {
let tmp = null != paymentSourceId.paymentSourceId;
if (tmp) {
paymentSourceId = paymentSourceId.paymentSourceId;
let flag = false;
if (null != paymentSourceId) {
const paymentSource = PaymentSourceStore.getPaymentSource(paymentSourceId);
const hasItem = null != paymentSource && set3.has(paymentSource.type);
flag = hasItem;
}
tmp = flag;
}
return tmp;
}
function isPrepaidPaymentSource(paymentSourceId) {
if (null == paymentSourceId) {
return false;
} else {
const paymentSource = PaymentSourceStore.getPaymentSource(paymentSourceId);
const hasItem = null != paymentSource && set3.has(paymentSource.type);
return hasItem;
}
}
function isSubscriptionStatusFailedPayment(arg0) {
return arg0 === constants4.PAST_DUE || arg0 === constants4.ACCOUNT_HOLD || arg0 === constants4.BILLING_RETRY;
}
function getFormattedPlanPriceFromInvoice(findInvoiceItemByPlanId, arg1, id) {
let amount;
const result = findInvoiceItemByPlanId.findInvoiceItemByPlanId(id.id);
if (null == result) {
obj = { paymentSourceId: null, currency: null };
({ paymentSourceId: obj.paymentSourceId, currency: obj.currency } = arg1);
amount = getPrice(id.id, false, false, obj).amount;
} else {
amount = result.amount;
}
const formatRate = PriceUtils.formatRate;
PriceUtils;
obj2 = PriceUtils;
return formatRate(obj2.formatPrice(amount, findInvoiceItemByPlanId.currency), id.interval, id.intervalCount);
}
function getExternalSubscriptionMethodUrl(paymentGateway, PAYMENT_SOURCE_MANAGEMENT) {
if (constants2.APPLE_PARTNER !== paymentGateway) {
if (constants2.APPLE_ADVANCED_COMMERCE !== paymentGateway) {
if (constants2.APPLE !== paymentGateway) {
if (constants2.GOOGLE === paymentGateway) {
return constants10[PAYMENT_SOURCE_MANAGEMENT];
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
const self = this;
const self2 = this;
const error = new Error("Invalid external payment gateway " + paymentGateway);
throw error;
}
}
}
2026-10-02 13:37:24 +00:00
}
return constants9[PAYMENT_SOURCE_MANAGEMENT];
}
function getItemsFromNewAdditionalPlans(renewalMutations, arg1) {
let closure_0 = renewalMutations;
renewalMutations = renewalMutations.renewalMutations;
let items;
if (renewalMutations != null) {
items = renewalMutations.items;
}
if (items == null) {
items = renewalMutations.items;
}
const items1 = [];
2026-10-12 16:32:48 +00:00
const found = items.find(f90539);
2026-10-02 13:37:24 +00:00
if (null != found) {
items1.push(found);
}
const items2 = [...arg1];
items1.push.apply(items2);
return items1.map((planId) => {
const items = renewalMutations.items;
for (const item10008 of items) {
if (planId.planId === item10008.planId) {
obj2 = {};
let merged = Object.assign(tmp);
let merged1 = Object.assign(planId);
obj.return();
return obj2;
}
}
return planId;
});
}
function getItemsWithoutPremiumPlanItem(arr) {
2026-10-12 16:32:48 +00:00
return arr.filter(f90541);
2026-10-02 13:37:24 +00:00
}
canUseQuestOrbMultiplier = function canUseQuestOrbMultiplier(perks) {
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.QUEST_ORB_MULTIPLIER, perks);
};
canUseCollectibles = function canUseCollectibles(user) {
obj = ProductCatalog;
return obj.canUserUse(ProductCatalog.COLLECTIBLES, user);
2026-10-01 14:13:23 +00:00
};
2026-10-02 13:37:24 +00:00
function isTrialOffer(arg0) {
return null != arg0 && "trialId" in arg0;
}
function isDiscountOffer(arg0) {
return null != arg0 && "discountId" in arg0;
}
function getFractionalPremiumUnitsHoursFromSkuIds(flatMapResult) {
2026-10-12 16:32:48 +00:00
return flatMapResult.reduce(f90547, 0);
2026-10-02 13:37:24 +00:00
}
const freezeResult = freeze(obj3);
let result = size.fileFinishedImporting("utils/PremiumUtils.tsx");
2026-10-02 13:37:24 +00:00
export default freezeResult;
export { Branding };
export const StreamQuality = obj2;
export const getPremiumBranding = function getPremiumBranding(renewalMutations) {
2026-10-01 14:13:23 +00:00
let TIER_0;
const planId = renewalMutations.planId;
if (set2.has(planId)) {
const additionalPlans = renewalMutations.additionalPlans;
2026-10-02 13:37:24 +00:00
const items = [__initData5.GUILD];
const planIdsForSkus = SubscriptionPlanStore.getPlanIdsForSkus(items);
_modDef38(null != planIdsForSkus, "Missing guildSubscriptionPlanIds");
const found = additionalPlans.find((planId) => planIdsForSkus.includes(planId.planId));
let num2 = 0;
if (null != found) {
num2 = found.quantity;
}
if (num2 > 0) {
2026-10-01 14:13:23 +00:00
TIER_0 = obj.BUNDLE;
}
return TIER_0;
}
if (planId !== SubscriptionPlans.PREMIUM_MONTH_TIER_0) {
2026-10-01 14:13:23 +00:00
if (planId !== SubscriptionPlans.PREMIUM_YEAR_TIER_0) {
if (planId !== SubscriptionPlans.PREMIUM_MONTH_TIER_1) {
if (planId !== SubscriptionPlans.PREMIUM_YEAR_TIER_1) {
if (planId !== SubscriptionPlans.PREMIUM_MONTH_TIER_2) {
if (planId !== SubscriptionPlans.PREMIUM_YEAR_TIER_2) {
if (planId !== SubscriptionPlans.PREMIUM_3_MONTH_TIER_2) {
if (planId !== SubscriptionPlans.PREMIUM_6_MONTH_TIER_2) {
TIER_0 = obj.PREMIUM_GUILD;
}
}
}
}
TIER_0 = obj.TIER_2;
}
}
TIER_0 = obj.TIER_1;
}
}
TIER_0 = obj.TIER_0;
};
export { getPremiumPlanItem };
export { getDefaultPrice };
2026-10-02 13:37:24 +00:00
export { withContextPlanPrices };
export const usePlanSelectPriceState = tmp6;
export { getPrice };
export const getCountryPrices = function getCountryPrices(planId, DEFAULT) {
if (DEFAULT === undefined) {
2026-10-01 14:13:23 +00:00
DEFAULT = map1.DEFAULT;
}
return getPurchaseTypePrices(planId, DEFAULT).countryPrices;
};
export { experimentalGetPrices };
2026-10-02 13:37:24 +00:00
export { experimentalGetPrice };
export { getServerPriceFromClientPrice };
export { getItemPlansTotalServerPrice };
export const getSubscriptionWithNewPlansTotalServerPrice = function getSubscriptionWithNewPlansTotalServerPrice(renewalMutations, arg1, arg2, arg3) {
2026-10-01 14:13:23 +00:00
let mapped;
let items = arg1;
if (null === arg1) {
2026-10-01 14:13:23 +00:00
let tmp2 = importDefault;
let tmp3 = dependencyMap;
_modDef38(null !== renewalMutations, "Subscription can't be null");
items = [];
}
2026-10-01 14:13:23 +00:00
let tmp5 = getItemPlansTotalServerPrice;
if (null !== renewalMutations) {
renewalMutations = renewalMutations.renewalMutations;
let items1;
if (renewalMutations != null) {
items1 = renewalMutations.items;
}
if (items1 == null) {
items1 = renewalMutations.items;
}
const items2 = [];
2026-10-12 16:32:48 +00:00
const found = items1.find(f90539);
if (null != found) {
items2.push(found);
}
const push = items2.push;
const items3 = [];
2026-10-01 14:13:23 +00:00
HermesBuiltin.arraySpread(items3, items, 0);
HermesBuiltin.apply(push, items3, items2);
mapped = items2.map((planId) => {
const items = renewalMutations.items;
for (const item10008 of items) {
if (planId.planId === item10008.planId) {
obj2 = {};
2026-10-01 14:13:23 +00:00
let merged = Object.assign(tmp);
let merged1 = Object.assign(planId);
obj.return();
return obj2;
}
}
return planId;
});
} else {
2026-10-12 16:32:48 +00:00
mapped = items.filter(f90541);
}
2026-10-01 14:13:23 +00:00
return tmp5(mapped, arg2, arg3);
};
export { getInterval };
export const getDiscountIntervalString = function getDiscountIntervalString(arg0) {
if (constants5.MONTH === arg0) {
2026-10-01 14:13:23 +00:00
const intl2 = intl30.intl;
return intl2.string(intl30.t.FPybU7);
} else if (constants5.YEAR === arg0) {
const intl = intl30.intl;
return intl.string(intl30.t.tfqrhj);
} else {
2026-10-01 14:13:23 +00:00
if (constants5.DAY !== arg0) {
const WEEK = tmp.WEEK;
}
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Unexpected interval");
throw error;
}
};
export { getIntervalString };
export { getIntervalStringAsNoun };
export { getPremiumType };
export { getDisplayName };
export const getDisplayNameFromSku = function getDisplayNameFromSku(skuId1) {
2026-10-01 14:13:23 +00:00
let obj3;
2026-10-02 13:37:24 +00:00
if (__initData5.TIER_0 === skuId1) {
2026-10-01 14:13:23 +00:00
const intl3 = intl30.intl;
return intl3.string(intl30.t["t9uG/o"]);
2026-10-02 13:37:24 +00:00
} else if (__initData5.TIER_1 === skuId1) {
2026-10-01 14:13:23 +00:00
const intl2 = intl30.intl;
return intl2.string(intl30.t.FSOz78);
2026-10-02 13:37:24 +00:00
} else if (__initData5.TIER_2 === skuId1) {
2026-10-01 14:13:23 +00:00
const intl = intl30.intl;
return intl.string(intl30.t.lG6a5x);
} else {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Unsupported sku");
2026-10-01 14:13:23 +00:00
obj2 = { tags: obj3 };
obj3 = { skuId: skuId1 };
obj = BillingUtils;
const result = obj.captureBillingException(error, obj2);
throw error;
}
};
export { getTierDisplayNameByPlanId };
export const getPremiumTypeDisplayName = function getPremiumTypeDisplayName(TIER_0, arg1) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
2026-10-01 14:13:23 +00:00
if (closure_39.TIER_0 === TIER_0) {
let str2 = "Basic";
if (!flag) {
2026-10-01 14:13:23 +00:00
const intl3 = intl30.intl;
str2 = intl3.string(intl30.t["t9uG/o"]);
}
return str2;
2026-10-01 14:13:23 +00:00
} else if (closure_39.TIER_1 === TIER_0) {
let str = "Classic";
if (!flag) {
2026-10-01 14:13:23 +00:00
const intl2 = intl30.intl;
str = intl2.string(intl30.t.FSOz78);
}
return str;
2026-10-01 14:13:23 +00:00
} else if (closure_39.TIER_2 === TIER_0) {
const intl = intl30.intl;
return intl.string(intl30.t.lG6a5x);
}
};
export const getPlanDescriptionFromInvoice = function getPlanDescriptionFromInvoice(hasDiscountApplied) {
2026-10-01 14:13:23 +00:00
let activeDiscountInfo;
let amount;
let formatRate;
let hasFractionalPremiumWithSub;
let includePremiumGuilds;
let obj3;
let planId;
let renewalInvoicePreview;
let renewalInvoiceWithEntitlementsPreview;
let subscription;
({ renewalInvoicePreview, subscription, includePremiumGuilds } = hasDiscountApplied);
({ renewalInvoiceWithEntitlementsPreview, planId } = hasDiscountApplied);
if (includePremiumGuilds === undefined) {
includePremiumGuilds = false;
}
let flag = hasDiscountApplied.hasDiscountApplied;
if (flag === undefined) {
flag = false;
}
({ hasFractionalPremiumWithSub, activeDiscountInfo } = hasDiscountApplied);
if (hasFractionalPremiumWithSub === undefined) {
hasFractionalPremiumWithSub = false;
}
2026-10-01 14:13:23 +00:00
const fractionalPremiumInfo = hasDiscountApplied.fractionalPremiumInfo;
const value = SubscriptionPlanStore.get(planId);
_modDef38(null != value, "Missing plan");
2026-10-01 14:13:23 +00:00
obj = { subscription, planId: value.id, price: formatRate(obj3.formatPrice(amount, renewalInvoicePreview.currency), value.interval, value.intervalCount), includePremiumGuilds, hasDiscountApplied: flag, activeDiscountInfo, renewalInvoiceWithoutEntitlementsPreview: renewalInvoicePreview, renewalInvoiceWithEntitlementsPreview, hasFractionalPremiumWithSub, fractionalPremiumInfo };
const result = renewalInvoicePreview.findInvoiceItemByPlanId(value.id);
2026-10-01 14:13:23 +00:00
const tmp4 = getPlanDescription;
if (null == result) {
2026-10-01 14:13:23 +00:00
const obj4 = { paymentSourceId: null, currency: null };
({ paymentSourceId: obj2.paymentSourceId, currency: obj2.currency } = subscription);
2026-10-01 14:13:23 +00:00
amount = getPrice(value.id, false, false, obj4).amount;
} else {
amount = result.amount;
}
2026-10-01 14:13:23 +00:00
formatRate = PriceUtils.formatRate;
PriceUtils;
obj3 = PriceUtils;
return tmp4(obj);
};
export const getExternalPlanDisplayName = function getExternalPlanDisplayName(renewalMutations) {
2026-10-01 14:13:23 +00:00
let Pi5yMJ;
let additionalPlans;
let formatToPlainStringResult;
let planId;
({ planId, additionalPlans } = renewalMutations);
let tmp = null;
if (!isNoneSubscription(planId)) {
tmp = getDisplayName(planId);
}
let found;
if (additionalPlans != null) {
found = additionalPlans.find((planId) => set.has(planId.planId));
}
let planId1;
if (found != null) {
planId1 = found.planId;
}
if (planId1 === SubscriptionPlans.PREMIUM_MONTH_GUILD) {
2026-10-01 14:13:23 +00:00
Pi5yMJ = intl30.t.Pi5yMJ;
} else {
let planId2;
if (found != null) {
planId2 = found.planId;
}
Pi5yMJ = null;
if (planId2 === tmp5.PREMIUM_YEAR_GUILD) {
2026-10-01 14:13:23 +00:00
Pi5yMJ = intl30.t.H4KPuV;
}
}
if (null != Pi5yMJ) {
2026-10-01 14:13:23 +00:00
const intl = intl30.intl;
let quantity;
2026-10-01 14:13:23 +00:00
const formatToPlainString = intl.formatToPlainString;
if (found != null) {
quantity = found.quantity;
}
obj = { num: quantity };
2026-10-01 14:13:23 +00:00
formatToPlainStringResult = formatToPlainString(Pi5yMJ, obj);
}
if (null != tmp) {
if (null != formatToPlainStringResult) {
2026-10-01 14:13:23 +00:00
const intl2 = intl30.intl;
obj2 = { premiumDescription: tmp, premiumGuildDescription: formatToPlainStringResult };
2026-10-01 14:13:23 +00:00
return intl2.formatToPlainString(intl30.t.FN5T9r, obj2);
}
}
if (null != tmp) {
return tmp;
} else if (null != formatToPlainStringResult) {
return formatToPlainStringResult;
} else {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Subscription without premium or premium guild subscription");
throw error;
}
};
export { getPremiumPlanOptions };
2026-10-02 13:37:24 +00:00
export const getPlanIdForPremiumType = function getPlanIdForPremiumType(premiumType, c3) {
const items = [, ];
({ MONTH: arr[0], YEAR: arr[1] } = constants7);
2026-10-01 14:13:23 +00:00
set = new Set(items);
2026-10-02 13:37:24 +00:00
if (set.has(c3)) {
2026-10-01 14:13:23 +00:00
if (closure_39.TIER_0 === premiumType) {
let PREMIUM_YEAR_TIER_0;
2026-10-02 13:37:24 +00:00
if (c3 === constants7.MONTH) {
2026-10-01 14:13:23 +00:00
PREMIUM_YEAR_TIER_0 = SubscriptionPlans.PREMIUM_MONTH_TIER_0;
} else {
PREMIUM_YEAR_TIER_0 = SubscriptionPlans.PREMIUM_YEAR_TIER_0;
}
return PREMIUM_YEAR_TIER_0;
2026-10-01 14:13:23 +00:00
} else if (closure_39.TIER_1 === premiumType) {
let PREMIUM_YEAR_TIER_1;
2026-10-02 13:37:24 +00:00
if (c3 === constants7.MONTH) {
2026-10-01 14:13:23 +00:00
PREMIUM_YEAR_TIER_1 = SubscriptionPlans.PREMIUM_MONTH_TIER_1;
} else {
PREMIUM_YEAR_TIER_1 = SubscriptionPlans.PREMIUM_YEAR_TIER_1;
}
return PREMIUM_YEAR_TIER_1;
2026-10-01 14:13:23 +00:00
} else if (closure_39.TIER_2 === premiumType) {
let PREMIUM_YEAR_TIER_2;
2026-10-02 13:37:24 +00:00
if (c3 === constants7.MONTH) {
2026-10-01 14:13:23 +00:00
PREMIUM_YEAR_TIER_2 = SubscriptionPlans.PREMIUM_MONTH_TIER_2;
} else {
PREMIUM_YEAR_TIER_2 = SubscriptionPlans.PREMIUM_YEAR_TIER_2;
}
return PREMIUM_YEAR_TIER_2;
} else {
const _Error2 = Error;
const _HermesInternal2 = HermesInternal;
2026-10-01 14:13:23 +00:00
const self3 = this;
const self4 = this;
const error = new Error("Unsupported premium type: " + premiumType);
throw error;
}
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
2026-10-02 13:37:24 +00:00
const error1 = new Error("Unsupported plan interval for premium type: " + c3);
throw error1;
}
};
export { getNumPremiumGuildSubscriptions };
2026-10-02 13:37:24 +00:00
export { subscriptionHasPremiumGuildPlan };
export { isPremiumBaseSubscriptionPlan };
export { isPremiumGuildSubscriptionPlan };
export const isPremiumSubscriptionPlan = function isPremiumSubscriptionPlan(arg0) {
2026-10-01 14:13:23 +00:00
const hasItem = set.has(arg0) || set.has(arg0);
return hasItem;
};
export const isPremiumGroupSubscriptionPlan = function isPremiumGroupSubscriptionPlan(arg0) {
2026-10-01 14:13:23 +00:00
return null != arg0 && arg0 === SubscriptionPlans.PREMIUM_GROUP_MONTH;
};
export { getBillingGracePeriodDaysAndExpiresDate };
export { getExpectedRenewalDate };
export { getBillingInformationString };
export { extendDateWithUnconsumedFractionalPremium };
export { getUnactivatedFractionalPremiumDurationString };
export { isSwitchingPlansDisabled };
export { getSwitchingPlansDisabledMessage };
2026-10-02 13:37:24 +00:00
export { isSubscriptionPrepaidPaymentSource };
export { isPrepaidPaymentSource };
export { getCoercedPremiumGuildSubscriptionStatus };
export { isPremiumGuildSubscriptionCanceled };
export const getPremiumGuildHeaderDescription = function getPremiumGuildHeaderDescription(arg0) {
2026-10-01 14:13:23 +00:00
let fractionalPremiumInfo;
let obj9;
let price;
let renewalInvoicePreview;
let subscription;
let user;
({ subscription, user, price, renewalInvoicePreview, fractionalPremiumInfo } = arg0);
const renewalMutations = subscription.renewalMutations;
2026-10-01 14:13:23 +00:00
const additionalPlans = subscription.additionalPlans;
const value = SubscriptionPlanStore.get(subscription.planId);
_modDef38(null != value, "Missing plan");
2026-10-01 14:13:23 +00:00
const tmp5 = getNumPremiumGuildSubscriptions(additionalPlans);
let additionalPlans1;
const tmp4 = getNumPremiumGuildSubscriptions;
if (renewalMutations != null) {
2026-10-01 14:13:23 +00:00
additionalPlans1 = renewalMutations.additionalPlans;
}
let tmp4Result = tmp5;
2026-10-01 14:13:23 +00:00
if (null != additionalPlans1) {
tmp4Result = tmp4(renewalMutations.additionalPlans);
}
const bound = Math.max(0, tmp5 - tmp4Result);
let flag = false;
let tmp10;
if (!subscription.isPurchasedExternally) {
flag = false;
tmp10 = price;
if (null == price) {
let amount = null;
if (null != renewalInvoicePreview) {
const invoiceItems = renewalInvoicePreview.invoiceItems;
const found = invoiceItems.find((subscriptionPlanId) => set.has(subscriptionPlanId.subscriptionPlanId));
if (null != found) {
amount = found.amount;
}
}
let flag2 = false;
if (null == amount) {
let tmp14 = tmp5;
2026-10-01 14:13:23 +00:00
if (tmp4Result > 0 && bound > 0) {
tmp14 = tmp4Result;
}
try {
amount = getPremiumGuildIntervalPrice(subscription.planId, subscription.paymentSourceId, subscription.currency, user).amount * tmp14;
flag2 = false;
} catch (err) {
flag2 = true;
}
}
let formatPriceResult;
if (null != amount) {
2026-10-01 14:13:23 +00:00
obj = PriceUtils;
formatPriceResult = obj.formatPrice(amount, subscription.currency);
}
tmp10 = formatPriceResult;
flag = flag2;
}
}
let str = "";
if (null != tmp10) {
2026-10-01 14:13:23 +00:00
obj2 = PriceUtils;
str = obj2.formatRate(tmp10, value.interval, value.intervalCount);
}
let flag3;
if (renewalInvoicePreview != null) {
flag3 = renewalInvoicePreview.taxInclusive;
}
if (flag3 == null) {
const latestInvoice = subscription.latestInvoice;
let taxInclusive;
if (latestInvoice != null) {
taxInclusive = latestInvoice.taxInclusive;
}
flag3 = taxInclusive;
}
if (flag3 == null) {
flag3 = true;
}
if (isPremiumGuildSubscriptionCanceled(subscription)) {
2026-10-01 14:13:23 +00:00
let format4Result;
const intl8 = intl30.intl;
const format4 = intl8.format;
const t4 = intl30.t;
if (subscription.isPurchasedExternally || flag) {
const obj3 = { quantity: tmp5 };
2026-10-01 14:13:23 +00:00
format4Result = format4(t4["3/WTrI"], obj3);
} else if (flag3) {
const obj4 = { quantity: tmp5, rate: str };
2026-10-01 14:13:23 +00:00
format4Result = format4(t4["0ozBSB"], obj4);
} else {
const obj5 = { quantity: tmp5, rate: str };
2026-10-01 14:13:23 +00:00
format4Result = format4(t4["yjsv/s"], obj5);
}
2026-10-01 14:13:23 +00:00
return format4Result;
} else {
const status = subscription.status;
if (constants4.ACCOUNT_HOLD === status) {
2026-10-01 14:13:23 +00:00
let format3Result;
const intl7 = intl30.intl;
const format3 = intl7.format;
const t3 = intl30.t;
if (subscription.isPurchasedExternally || flag) {
const obj6 = { quantity: tmp5, boostQuantity: tmp5 };
2026-10-01 14:13:23 +00:00
format3Result = format3(t3.Nlf3nc, obj6);
} else if (flag3) {
const obj7 = { quantity: tmp5, boostQuantity: tmp5, rate: str };
2026-10-01 14:13:23 +00:00
format3Result = format3(t3.oiRy7v, obj7);
} else {
const obj8 = { quantity: tmp5, boostQuantity: tmp5, rate: str };
2026-10-01 14:13:23 +00:00
format3Result = format3(t3["0QxOAi"], obj8);
}
2026-10-01 14:13:23 +00:00
return format3Result;
} else {
2026-10-01 14:13:23 +00:00
if (constants4.PAUSE_PENDING !== status) {
if (constants4.PAUSED !== status) {
if (constants4.PAST_DUE === status) {
if (subscription.isBoostOnly) {
2026-10-01 14:13:23 +00:00
const intl4 = intl30.intl;
const format2 = intl4.format;
const obj10 = {
2026-10-01 14:13:23 +00:00
endDate: obj9.dateFormat(getBillingGracePeriodDaysAndExpiresDate(subscription).expiresDate, "LL"),
onClick() {
openURLDefault("https://support.discord.com/hc/articles/23082866222871");
}
};
2026-10-01 14:13:23 +00:00
const prop = intl30.t["d+0vwo"];
obj9 = DateUtils;
return format2(prop, obj10);
}
}
2026-10-01 14:13:23 +00:00
const tmp26 = intl30;
if (tmp4Result > 0 && bound > 0) {
if (subscription.isPurchasedExternally || flag) {
const intl3 = tmp26.intl;
const obj11 = { activeQuantity: tmp4Result, pendingQuantity: bound };
2026-10-01 14:13:23 +00:00
return intl3.format(intl30.t["krRy+d"], obj11);
} else {
2026-10-01 14:13:23 +00:00
let BmaudS;
let tmp28;
const t2 = tmp26.t;
if (flag3) {
2026-10-01 14:13:23 +00:00
BmaudS = t2["4nc7+E"];
tmp28 = tmp25;
} else {
BmaudS = t2.BmaudS;
tmp28 = tmp25;
}
2026-10-07 22:43:51 +00:00
const intl2 = tmp28(1126).intl;
const obj12 = { activeQuantity: tmp4Result, pendingQuantity: bound, rate: str };
return intl2.format(BmaudS, obj12);
}
} else {
2026-10-01 14:13:23 +00:00
let formatResult;
const intl = tmp26.intl;
const format = intl.format;
2026-10-07 22:43:51 +00:00
const t = tmp25(1126).t;
2026-10-01 14:13:23 +00:00
if (subscription.isPurchasedExternally || flag) {
const obj13 = { quantity: tmp5 };
2026-10-01 14:13:23 +00:00
formatResult = format(t["5iud9s"], obj13);
} else if (flag3) {
const obj14 = { quantity: tmp5, rate: str };
formatResult = format(t.eDwrLA, obj14);
} else {
const obj15 = { quantity: tmp5, rate: str };
formatResult = format(t.ijSDcI, obj15);
}
return formatResult;
}
}
}
if (null != fractionalPremiumInfo) {
2026-10-01 14:13:23 +00:00
let stringResult;
if (!fractionalPremiumInfo.isFractionalPremiumActive) {
2026-10-01 14:13:23 +00:00
const intl5 = intl30.intl;
stringResult = intl5.string(intl30.t.CduWAm);
}
return stringResult;
}
2026-10-01 14:13:23 +00:00
const intl6 = intl30.intl;
const obj16 = { quantity: tmp5 };
2026-10-01 14:13:23 +00:00
stringResult = intl6.format(intl30.t["5iud9s"], obj16);
}
}
};
export { getFormattedPriceForPlan };
export const getFormattedRateForPlan = function getFormattedRateForPlan(interval, arg1, arg2) {
const tmp = getFormattedPriceForPlan(interval, arg1, arg2);
2026-10-01 14:13:23 +00:00
obj = PriceUtils;
return obj.formatRate(tmp, interval.interval, interval.intervalCount);
};
export { getPlanIdFromInvoice };
export { getStatusFromInvoice };
export { isBaseSubscriptionCanceled };
2026-10-02 13:37:24 +00:00
export { isSubscriptionStatusFailedPayment };
export { getFormattedPlanPriceFromInvoice };
export { getPremiumGuildIntervalPrice };
export { getBillingReviewSubheader };
export { getIntervalForInvoice };
export { getDefaultCurrency };
export const formatTrialOfferIntervalDuration = function formatTrialOfferIntervalDuration(intervalType) {
let MONTH = intervalType.intervalType;
if (MONTH === undefined) {
MONTH = constants7.MONTH;
}
let num = intervalType.intervalCount;
if (num === undefined) {
num = 1;
}
let flag = intervalType.capitalize;
if (flag === undefined) {
flag = false;
}
if (constants7.DAY === MONTH) {
2026-10-01 14:13:23 +00:00
let formatToPlainString3Result;
if (num >= 7) {
2026-10-01 14:13:23 +00:00
if (num % 7 === 0) {
let formatToPlainString4Result;
const intl4 = intl30.intl;
const formatToPlainString4 = intl4.formatToPlainString;
2026-10-01 14:13:23 +00:00
const t4 = intl30.t;
if (flag) {
2026-10-01 14:13:23 +00:00
obj2 = { weeks: num / 7 };
formatToPlainString4Result = formatToPlainString4(t4.fRNBRX, obj2);
} else {
2026-10-01 14:13:23 +00:00
const obj3 = { weeks: num / 7 };
formatToPlainString4Result = formatToPlainString4(t4.EIpHEj, obj3);
}
2026-10-01 14:13:23 +00:00
formatToPlainString3Result = formatToPlainString4Result;
}
2026-10-01 14:13:23 +00:00
return formatToPlainString3Result;
}
2026-10-01 14:13:23 +00:00
const intl3 = intl30.intl;
const formatToPlainString3 = intl3.formatToPlainString;
2026-10-01 14:13:23 +00:00
const t3 = intl30.t;
if (flag) {
const obj4 = { days: num };
2026-10-01 14:13:23 +00:00
formatToPlainString3Result = formatToPlainString3(t3["6Cdzoy"], obj4);
} else {
const obj5 = { days: num };
formatToPlainString3Result = formatToPlainString3(t3["kbBj/h"], obj5);
}
2026-10-01 14:13:23 +00:00
} else if (constants7.MONTH === MONTH) {
let formatToPlainString2Result;
const intl2 = intl30.intl;
const formatToPlainString2 = intl2.formatToPlainString;
2026-10-01 14:13:23 +00:00
const t2 = intl30.t;
if (flag) {
const obj6 = { months: num };
2026-10-01 14:13:23 +00:00
formatToPlainString2Result = formatToPlainString2(t2.x5MgxS, obj6);
} else {
const obj7 = { months: num };
formatToPlainString2Result = formatToPlainString2(t2["4SEnCZ"], obj7);
}
return formatToPlainString2Result;
2026-10-01 14:13:23 +00:00
} else if (constants7.YEAR === MONTH) {
let formatToPlainStringResult;
const intl = intl30.intl;
const formatToPlainString = intl.formatToPlainString;
2026-10-01 14:13:23 +00:00
const t = intl30.t;
if (flag) {
2026-10-01 14:13:23 +00:00
const obj8 = { years: num };
formatToPlainStringResult = formatToPlainString(t["h+63yl"], obj8);
} else {
obj = { years: num };
formatToPlainStringResult = formatToPlainString(t["9DFiHk"], obj);
}
return formatToPlainStringResult;
} else {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Unsupported interval duration.");
throw error;
}
};
export { formatTrialCtaIntervalDuration };
export const formatTrialCtaIntervalDurationFromTrialOffer = function formatTrialCtaIntervalDurationFromTrialOffer(subscriptionTrial, TIER_2) {
if (null != subscriptionTrial) {
if (null != subscriptionTrial.subscriptionTrial) {
if (subscriptionTrial.subscriptionTrial.skuId === TIER_2) {
obj = { intervalType: null, intervalCount: null };
({ interval: obj.intervalType, intervalCount: obj.intervalCount } = subscriptionTrial.subscriptionTrial);
return formatTrialCtaIntervalDuration(obj);
}
}
}
return null;
};
export const formatIntervalDuration = function formatIntervalDuration(intervalType) {
let MONTH = intervalType.intervalType;
if (MONTH === undefined) {
MONTH = constants7.MONTH;
}
let num = intervalType.intervalCount;
if (num === undefined) {
num = 1;
}
let flag = intervalType.capitalize;
if (flag === undefined) {
flag = false;
}
if (constants7.DAY === MONTH) {
2026-10-01 14:13:23 +00:00
let formatToPlainString3Result;
if (num >= 7) {
2026-10-01 14:13:23 +00:00
if (num % 7 === 0) {
let formatToPlainString4Result;
const intl4 = intl30.intl;
const formatToPlainString4 = intl4.formatToPlainString;
2026-10-01 14:13:23 +00:00
const t4 = intl30.t;
if (flag) {
2026-10-01 14:13:23 +00:00
obj2 = { weeks: num / 7 };
formatToPlainString4Result = formatToPlainString4(t4.iVZYyl, obj2);
} else {
2026-10-01 14:13:23 +00:00
const obj3 = { weeks: num / 7 };
formatToPlainString4Result = formatToPlainString4(t4.EmoBD2, obj3);
}
2026-10-01 14:13:23 +00:00
formatToPlainString3Result = formatToPlainString4Result;
}
2026-10-01 14:13:23 +00:00
return formatToPlainString3Result;
}
2026-10-01 14:13:23 +00:00
const intl3 = intl30.intl;
const formatToPlainString3 = intl3.formatToPlainString;
2026-10-01 14:13:23 +00:00
const t3 = intl30.t;
if (flag) {
const obj4 = { days: num };
2026-10-01 14:13:23 +00:00
formatToPlainString3Result = formatToPlainString3(t3.jzH70Z, obj4);
} else {
const obj5 = { days: num };
formatToPlainString3Result = formatToPlainString3(t3["k2UNz+"], obj5);
}
2026-10-01 14:13:23 +00:00
} else if (constants7.MONTH === MONTH) {
let formatToPlainString2Result;
const intl2 = intl30.intl;
const formatToPlainString2 = intl2.formatToPlainString;
2026-10-01 14:13:23 +00:00
const t2 = intl30.t;
if (flag) {
const obj6 = { months: num };
2026-10-01 14:13:23 +00:00
formatToPlainString2Result = formatToPlainString2(t2.erUSmA, obj6);
} else {
const obj7 = { months: num };
formatToPlainString2Result = formatToPlainString2(t2.kridzK, obj7);
}
return formatToPlainString2Result;
2026-10-01 14:13:23 +00:00
} else if (constants7.YEAR === MONTH) {
let formatToPlainStringResult;
const intl = intl30.intl;
const formatToPlainString = intl.formatToPlainString;
2026-10-01 14:13:23 +00:00
const t = intl30.t;
if (flag) {
2026-10-01 14:13:23 +00:00
const obj8 = { years: num };
formatToPlainStringResult = formatToPlainString(t.IfYQVC, obj8);
} else {
obj = { years: num };
formatToPlainStringResult = formatToPlainString(t.PClsrw, obj);
}
return formatToPlainStringResult;
} else {
const _Error = Error;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
const error = new Error("Unsupported interval duration.");
throw error;
}
};
2026-10-02 13:37:24 +00:00
export { getExternalSubscriptionMethodUrl };
export const hasPremiumSubscriptionToDisplay = function hasPremiumSubscriptionToDisplay(currentUser, premiumTypeSubscription) {
2026-10-01 14:13:23 +00:00
obj = PremiumTypeUtils;
let isPremiumResult = obj.isPremium(currentUser);
if (!isPremiumResult) {
let status;
if (premiumTypeSubscription != null) {
status = premiumTypeSubscription.status;
}
isPremiumResult = status === constants4.PAST_DUE || status === constants4.ACCOUNT_HOLD || status === constants4.BILLING_RETRY;
}
return isPremiumResult;
};
2026-10-02 13:37:24 +00:00
export const useHasPremiumSubscriptionToDisplay = tmp8;
export { getItemsFromNewAdditionalPlans };
export { getItemsWithoutPremiumPlanItem };
export { getItemsWithUpsertedPlanIdForGroup };
export const getItemsWithUpsertedPremiumPlanId = function getItemsWithUpsertedPremiumPlanId(renewalMutations, basePlanId) {
2026-10-01 14:13:23 +00:00
return getItemsWithUpsertedPlanIdForGroup(renewalMutations, basePlanId, 1, closure_32);
};
export const getItemsWithUpsertedPremiumGuildPlan = function getItemsWithUpsertedPremiumGuildPlan(renewalMutations, quantity, planId) {
2026-10-01 14:13:23 +00:00
return getItemsWithUpsertedPlanIdForGroup(renewalMutations, planId, quantity, closure_31);
};
2026-10-01 14:13:23 +00:00
export const coerceExistingItemsToNewItemInterval = function coerceExistingItemsToNewItemInterval(c0) {
let found = c0.find((item) => !("id" in item));
if (found == null) {
2026-10-01 14:13:23 +00:00
found = c0.find((planId) => set.has(planId.planId));
}
2026-10-01 14:13:23 +00:00
let mapped = c0;
if (null != found) {
2026-10-01 14:13:23 +00:00
const value = SubscriptionPlanStore.get(found.planId);
importDefault = value;
2026-10-01 14:13:23 +00:00
let tmp7 = _modDef38(null != value, "Missing plan");
mapped = c0.map((planId) => {
if (planId === found) {
return planId;
} else {
2026-10-01 14:13:23 +00:00
importDefault = SubscriptionPlanStore.get(planId.planId);
_modDef38(null != importDefault, "Missing plan");
obj2 = SubscriptionPlanStore;
const tmp7 = importDefault;
if (importDefault.interval === importDefault.interval) {
if (importDefault.intervalCount === importDefault.intervalCount) {
return planId;
}
}
2026-10-01 14:13:23 +00:00
const forSkuAndInterval = obj2.getForSkuAndInterval(importDefault.skuId, tmp11.interval, tmp11.intervalCount);
tmp7(38)(null != forSkuAndInterval, "Missing planForInterval");
obj = { planId: forSkuAndInterval.id };
const merged = Object.assign(planId);
return obj;
}
});
}
return mapped;
};
export const getMaxFileSizeForPremiumType = function getMaxFileSizeForPremiumType(TIER_2, arg1) {
2026-10-01 14:13:23 +00:00
let fileSize;
obj = arg1;
if (arg1 === undefined) {
obj = { useSpace: true };
}
2026-10-01 14:13:23 +00:00
if (TIER_2 === closure_39.TIER_2) {
obj2 = NitroFileUploadExperiments;
fileSize = obj2.getNitroFileUploadLimitBytes({ location: "getMaxFileSizeForPremiumType" });
} else {
fileSize = BottomSheet[TIER_2].fileSize;
}
2026-10-01 14:13:23 +00:00
const obj3 = FileSizeUtils;
const obj4 = { useKibibytes: true, useSpace: obj.useSpace };
return obj3.formatSize(fileSize / 1024, obj4);
};
export { getGuildBoostPlanItem };
export { isBoostOnlySubscription };
export { getPremiumSkuIdForSubscription };
export { getPremiumTypeFromSubscription };
export { isNewUser };
export { formatPriceString };
2026-10-12 16:32:48 +00:00
export const formatSubscriptionPlanRate = function formatSubscriptionPlanRate(interval_count) {
const tmp = "interval_count" in interval_count ? interval_count.interval_count : interval_count.intervalCount;
const tmp2 = getPrice(interval_count.id);
const formatRate = PriceUtils.formatRate;
PriceUtils;
obj = PriceUtils;
return formatRate(obj.formatPrice(tmp2.amount, tmp2.currency), interval_count.interval, tmp);
};
export { castPremiumSubscriptionAsSkuId };
2026-10-02 13:37:24 +00:00
export const getPremiumTypeFromPlanId = function getPremiumTypeFromPlanId(value) {
if (SubscriptionPlans.PREMIUM_MONTH_TIER_0 === value) {
2026-10-01 14:13:23 +00:00
return { premiumType: closure_39.TIER_0, planInterval: constants7.MONTH };
2026-10-02 13:37:24 +00:00
} else if (SubscriptionPlans.PREMIUM_YEAR_TIER_0 === value) {
2026-10-01 14:13:23 +00:00
return { premiumType: closure_39.TIER_0, planInterval: constants7.YEAR };
} else {
2026-10-02 13:37:24 +00:00
if (SubscriptionPlans.PREMIUM_MONTH_TIER_2 !== value) {
if (SubscriptionPlans.PREMIUM_GROUP_MONTH !== value) {
if (SubscriptionPlans.PREMIUM_YEAR_TIER_2 === value) {
2026-10-01 14:13:23 +00:00
return { premiumType: closure_39.TIER_2, planInterval: constants7.YEAR };
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
2026-10-01 14:13:23 +00:00
const self = this;
const self2 = this;
2026-10-02 13:37:24 +00:00
const error = new Error("Unsupported gifting planId: " + value);
throw error;
}
}
}
2026-10-01 14:13:23 +00:00
return { premiumType: closure_39.TIER_2, planInterval: constants7.MONTH };
}
};
export const isNitroLockedState = function isNitroLockedState(arg0) {
return "isNitroLocked" in arg0;
};
2026-10-01 14:13:23 +00:00
export const isPremiumAtLeast = PremiumTypeUtils.isPremiumAtLeast;
export const isPremiumAtMost = PremiumTypeUtils.isPremiumAtMost;
export const isPremium = PremiumTypeUtils.isPremium;
export const isPremiumExactly = PremiumTypeUtils.isPremiumExactly;
2026-10-02 13:37:24 +00:00
export const useHasTier2Premium = tmp9;
export const getOfferNoticeThreshold = function getOfferNoticeThreshold(trialId) {
2026-10-01 14:13:23 +00:00
const tmp2 = null != trialId && "trialId" in trialId;
if (tmp2) {
trialId = trialId.trialId;
2026-10-02 13:37:24 +00:00
if (__initData4 === trialId) {
2026-10-01 14:13:23 +00:00
return closure_45;
} else if (closure_36 === trialId) {
return numOpens;
} else {
2026-10-01 14:13:23 +00:00
return closure_46;
}
} else {
2026-10-01 14:13:23 +00:00
return closure_46;
}
};
2026-10-02 13:37:24 +00:00
export { isTrialOffer };
export { isDiscountOffer };
export { formatInterval };
export { isPremiumEligible };
export { getFractionalPremiumUnitsHours };
2026-10-02 13:37:24 +00:00
export { getFractionalPremiumUnitsHoursFromSkuIds };
export { getMonthlyPrice };
export const getSavingsPercent = function getSavingsPercent(subscriptionPlan) {
subscriptionPlan = subscriptionPlan.subscriptionPlan;
2026-10-12 16:32:48 +00:00
let tmp4 = tmp3;
if (null != subscriptionPlan) {
2026-10-12 16:32:48 +00:00
const tmp6 = calculateDiscountPercentageForPlan(subscriptionPlan, tmp, tmp2);
tmp4 = tmp3;
if (null != tmp6) {
tmp4 = tmp6;
}
}
2026-10-12 16:32:48 +00:00
return tmp4;
};
export { calculateMonthlyPriceEquivalentTotal };
2026-10-12 16:32:48 +00:00
export { calculateDiscountPercentageForPlan };
export { calculateYearlyPlanDollarSavingsAmount };
export { calculateYearlyPlanMonthlyRateAmount };
export { getDaysSincePremium };
export { getDaysRemainingUntilSubscriptionCurrentPeriodEnds };