/* Metro module 5137; source: utils/PriceUtils.tsx; dependencies: [1949, 3804, 1880, 482, 477, 5138, 5140, 5142, 1244, 3802, 2] */ function _fun45261(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#45261, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5315:6, offset: 0x01185e28, size: 304 bytes, params: 8, frame: 25 const env0_0 = require; const closure = formatSingleCurrencyPrice; const closure2 = formatDualPriceForBG; const closure3 = formatPrice; const closure4 = formatRate; const closure5 = function(a0) { var r0; var value = a0; if (value.length > 5) { value = value.replace(RegExp('\\.00(?=[\\s)]|$)', 'g'), ''); r0 = value; } else { r0 = value; } return r0; }; let Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */; const billingInfoStore = importDefault(3804) /* metro dependency 3804: BillingInfoStore */; const env0_4 = (require(1880) /* metro dependency 1880: PremiumConstants */).SubscriptionIntervalTypes; const env0_5 = (require(482) /* metro dependency 482: Constants */).CurrencyCodes; Object = global.Object; const env0_6 = Object.freeze(['en-CA', 'en-AU', 'en-NZ']); (require(2) /* metro dependency 2 */).fileFinishedImporting('utils/PriceUtils.tsx'); exports.formatSingleCurrencyPrice = closure; exports.formatDualPriceForBG = closure2; exports.formatPrice = closure3; exports.formatRate = closure4; exports.formatPercent = function(a0, a1) { var Intl = global.Intl; return Intl.NumberFormat(a0, {'style': 'percent', 'minimumFractionDigits': 0}).format(a1); }; exports.formatSubscriptionPlanRate = formatSubscriptionPlanRate; exports.maybeShortenPrice = closure5; exports.shortenAndFormatPrice = function(a0, a1, a2) { return maybeShortenPrice(formatPrice(a0, a1, a2)); }; } function formatSingleCurrencyPrice(a0, a1, a2) { // fn#45262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5315:219, offset: 0x01185f58, size: 273 bytes, params: 4, frame: 20 var r0; let value = a2; const object2 = {}; copyDataProperties(object2, value ?? ({}), undefined); const r4 = value?.localeOverride ?? LocaleStore.locale; if (r4 === 'en-US' && env0_6.includes(LocaleStore.systemLocale)) { object2.currencyDisplay = 'code'; } if (value) { value = require(477) /* metro dependency 477: PlatformUtils */; value = value.isWindows(); r0 = value; } else { r0 = value; } r0 = r0 && LocaleStore.systemLocale === 'en-GB'; if (r0) { object2.currencyDisplay = 'code'; } if (object2.maximumFractionDigits === 0 && object2.minimumFractionDigits == null) { object2.minimumFractionDigits = 0; } return (require(5138) /* metro dependency 5138: PriceUtils */).formatPrice(a0, a1, r4, object2); } function formatDualPriceForBG(a0, a1) { // fn#45263, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5315:633, offset: 0x01186069, size: 101 bytes, params: 3, frame: 18 const formatSingleCurrencyPriceBinding = formatSingleCurrencyPrice; const EUR = CurrencyCodes.EUR; const value2 = formatSingleCurrencyPriceBinding(a0, EUR, a1); const value3 = 1.95583 * a0; const BGN = CurrencyCodes.BGN; return '' + value2 + ' (' + formatSingleCurrencyPriceBinding(value3, BGN, a1) + ')'; } function formatPrice(a0, a1, a2) { // fn#45264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5315:766, offset: 0x011860ce, size: 321 bytes, params: 4, frame: 20 var r7; var r0; var value5; var platformName; var storeFront; let Date = global.Date; let value = Date.now(); Date = global.Date; const date = new Date('2026-08-05T22:00:00Z'); const getTime = date.getTime; value = value >= Reflect.apply(getTime, date, []); if (value) { r0 = false; } else { value5 = undefined; platformName = (require(477) /* metro dependency 477: PlatformUtils */).getPlatformName(); if (platformName === 'android') { r7 = (require(5140) /* metro dependency 5140: IAPStoreAndroid */).default.getUserCountry(); } else if (platformName === 'ios') { storeFront = (require(5142) /* metro dependency 5142: GenericIAPStore */).default.getStoreFront(); r7 = storeFront == null ? value5 : storeFront.country; } else { r7 = BillingInfoStore.ipCountryCode; } r0 = r7 === 'BG' && (a1 == null ? value5 : a1.toLowerCase()) === CurrencyCodes.EUR; } r0 = r0 ? formatDualPriceForBG(a0, a2) : formatSingleCurrencyPrice(a0, a1, a2); return r0; } function formatRate(a0, a1, a2) { // fn#45265, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5315:1231, offset: 0x0118620f, size: 342 bytes, params: 4, frame: 19 var Error; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; const t = (require(1244) /* metro dependency 1244: indexNative */).t; var value; const YEAR = SubscriptionIntervalTypes.YEAR; if (a1 === YEAR) { return intl.formatToPlainString(t['rS8FA+'], {price: a0}); } let MONTH = SubscriptionIntervalTypes.MONTH; if (a1 !== MONTH) { if (a1 !== SubscriptionIntervalTypes.MONTH) { Error = global.Error; value = 'Unsupported interval type: ' + a1 + ', and interval count: ' + a2; throw new Error(); } if (a2 > 1) { return intl.formatToPlainString(t['Qc+9ww'], {price: a0, intervalCount: a2}); } Error = global.Error; value = 'Unsupported interval type: ' + a1 + ', and interval count: ' + a2; throw new Error(); } if (a2 === 1) { return intl.formatToPlainString(t.AbOLNu, {price: a0}); } MONTH = SubscriptionIntervalTypes.MONTH; if (a1 !== MONTH) { Error = global.Error; value = 'Unsupported interval type: ' + a1 + ', and interval count: ' + a2; throw new Error(); } if (a2 > 1) { return intl.formatToPlainString(t['Qc+9ww'], {price: a0, intervalCount: a2}); } Error = global.Error; value = 'Unsupported interval type: ' + a1 + ', and interval count: ' + a2; const value2 = Object.create(Error.prototype, {constructor: {value: Error}}); const error = new Error(); throw error instanceof Object ? error : value2; } function formatSubscriptionPlanRate(a0) { // fn#45268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5315:2057, offset: 0x011863ca, size: 110 bytes, params: 2, frame: 17 const r4 = 'interval_count' in a0 ? a0.interval_count : a0.intervalCount; const price = (require(3802) /* metro dependency 3802: PremiumUtils */).getPrice(a0.id); return formatRate(formatPrice(price.amount, price.currency), a0.interval, r4); }