/* Metro module 13422; source: modules/parent_tools/SpendingLimitDisplay.tsx; dependencies: [1348, 5116, 1880, 566, 13350, 5137, 5138, 1244, 2224, 2] */ function _fun102130(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#102130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13612:6, offset: 0x0222e30d, size: 199 bytes, params: 8, frame: 20 const env0_0 = require; const closure = getSpendingLimitDisplayState; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */; const familyCenterStore = importDefault(5116) /* metro dependency 5116: FamilyCenterStore */; const env0_5 = (require(1880) /* metro dependency 1880: PremiumConstants */).SubscriptionIntervalTypes; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/parent_tools/SpendingLimitDisplay.tsx'); exports.useSpendingLimitFromUserSettings = function() { return require(dependencyMap[3]).useStateFromStores([UserSettingsProtoStore], _fun102133, undefined, require(dependencyMap[4]).spendingLimitEqual); }; exports.CLOSE_TO_LIMIT_THRESHOLD_MAJOR_UNITS = 10; exports.getSpendingLimitDisplayState = closure; exports.useSpendingLimitDisplayState = useSpendingLimitDisplayState; } function getSpendingLimitDisplayState(a0, a1) { // fn#102131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13612:152, offset: 0x0222e3d4, size: 380 bytes, params: 3, frame: 23 var object3; var intl; var formatToPlainString; var object4; if (a0 == null) { return {kind: 'off'}; } if (a0.amount === 0) { return {kind: 'blocked'}; } const currency = a0.currency; const priceUtilsModule = require(5137) /* metro dependency 5137: PriceUtils */; const formatRate = priceUtilsModule.formatRate; const moduleValue2 = priceUtilsModule; const value2 = moduleValue2.formatPrice(a0.amount, currency); const MONTH = SubscriptionIntervalTypes.MONTH; const value3 = Reflect.apply(formatRate, priceUtilsModule, [value2, MONTH, 1]); if (a1 >= a0.amount) { return {kind: 'spent', monthlyText: value3}; } const CurrencyExponents = (require(5138) /* metro dependency 5138: PriceUtils */).CurrencyExponents; let property = CurrencyExponents[a0.currency]; let r0 = property ?? 2; const value5 = a0.amount - a1; if (value5 <= 10 * exponentiationOperator(10, r0, undefined)) { object3 = {kind: 'close-to-limit', monthlyText: value3}; intl = (require(1244) /* metro dependency 1244: indexNative */).intl; formatToPlainString = intl.formatToPlainString; property = (importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */)['+Q+bU1']; object4 = {}; object4.amount = priceUtilsModule.formatPrice(value5, currency); object3.remainingText = Reflect.apply(formatToPlainString, intl, [property, object4]); r0 = object3; } else { r0 = {kind: 'on', monthlyText: value3}; } return r0; } function useSpendingLimitFromUserSettings() { // fn#102132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13612:769, offset: 0x0222e550, size: 83 bytes, params: 1, frame: 18 return (require(566) /* metro dependency 566: flux */).useStateFromStores([UserSettingsProtoStore], _fun102133, undefined, (require(13350) /* metro dependency 13350: SpendingLimitUtils */).spendingLimitEqual); } function useSpendingLimitDisplayState(a0) { // fn#102134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13612:1203, offset: 0x0222e60b, size: 101 bytes, params: 2, frame: 15 const value2 = undefined; const monthlyPurchases = (require(566) /* metro dependency 566: flux */).useStateFromStores([FamilyCenterStore], function() { return FamilyCenterStore.getMonthlyPurchases(); }); return getSpendingLimitDisplayState(a0, (monthlyPurchases == null ? value2 : monthlyPurchases.total_amount) ?? 0); } function _fun102133() { // fn#102133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13612:852, offset: 0x0222e5a3, size: 104 bytes, params: 1, frame: 14 var r0; var object2; let value = environment.__proto__; const safetySettings = UserSettingsProtoStore.settings.safetySettings; value = null; const oneTimePurchaseLimit = value == safetySettings || value == safetySettings.spendingLimitSettings ? undefined : safetySettings.spendingLimitSettings.oneTimePurchaseLimit; if (value == oneTimePurchaseLimit) { r0 = value; } else { object2 = {}; object2.amount = global.Number(oneTimePurchaseLimit.amount); object2.currency = oneTimePurchaseLimit.currency; r0 = object2; } return r0; }