/* Metro module 15832; source: modules/premium/SubscriptionManager.tsx; dependencies: [5, 7, 6, 15, 17, 18, 1878, 3804, 3808, 5181, 1880, 1900, 4223, 5182, 4860, 2] */ function _fun121666(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#121666, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:6, offset: 0x0254d736, size: 338 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_2 = importDefault(5) /* metro dependency 5 */; const env0_3 = importDefault(7) /* metro dependency 7 */; const env0_4 = importDefault(6) /* metro dependency 6 */; const env0_5 = importDefault(15) /* metro dependency 15 */; const env0_6 = importDefault(17) /* metro dependency 17 */; const env0_7 = importDefault(18) /* metro dependency 18 */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const billingInfoStore = importDefault(3804) /* metro dependency 3804: BillingInfoStore */; const subscriptionStore = importDefault(3808) /* metro dependency 3808: SubscriptionStore */; const entitlementStore = importDefault(5181) /* metro dependency 5181: EntitlementStore */; let value = require(1880) /* metro dependency 1880: PremiumConstants */; const env0_12 = value.PREMIUM_SUBSCRIPTION_APPLICATION; const env0_13 = value.PremiumTypes; value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */; value = _fun121670(value); value = new value(); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/SubscriptionManager.tsx'); exports.default = value; } function _isNativeReflectConstruct_121667() { // fn#121667, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:263, offset: 0x0254d888, size: 98 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_121667_isNativeReflectConstruct = function() { return !!result; })(); } function _fun121670(a0) { // fn#121670, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:466, offset: 0x0254d8ea, size: 42 bytes, params: 2, frame: 14 const closure = SubscriptionManager; env0_7(closure, a0); return env0_3(closure); } function SubscriptionManager(a0) { // fn#121671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:478, offset: 0x0254d914, size: 223 bytes, params: 2, frame: 21 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_4; binding(this, SubscriptionManager); const items = []; arraySpread(items, value, 0, items); value = env1_6(SubscriptionManager); binding = env1_5; if (_isNativeReflectConstruct_121667()) { Reflect = global.Reflect; value = Reflect.construct(value, items, env1_6(this).constructor); r0 = value; } else { value = value.apply(this, items); r0 = value; } value = binding(this, r0); value.actions = {POST_CONNECTION_OPEN: POST_CONNECTION_OPEN_121672}; binding = env1_2; value.maybeFetchSubscriptions = binding(_fun121674); value.maybeFetchMostRecentSubscription = maybeFetchMostRecentSubscription; value.maybeFetchCountryCode = binding(_fun121677); value.fetchCountryCode = binding(_fun121679); return value; } function SubscriptionManagerPOST_CONNECTION_OPEN() { // fn#121672, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:753, owner: SubscriptionManager.POST_CONNECTION_OPEN, offset: 0x0254d9f3, size: 41 bytes, params: 1, frame: 9 const binding = env0_0; binding.maybeFetchSubscriptions(); binding.maybeFetchCountryCode(); binding.maybeFetchMostRecentSubscription(); } function* _fun121674() { // fn#121674, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:880, offset: 0x0254da27, size: 260 bytes, params: 1, frame: 15 var r3; var value6; var premiumSubscription; var value12; if (false) { return undefined; } value = environment.__proto__.__proto__.__proto__; let binding = env3_8; const currentUser = binding.getCurrentUser(); const isSubscriptionFetching = env3_9.isSubscriptionFetching; binding = env3_0; const value4 = undefined; const value5 = binding(env3_1[11]); if (value5.isPremium(currentUser)) { binding = env3_10; r3 = binding.hasFetchedSubscriptions() || isSubscriptionFetching; if (r3) { binding = env3_10; premiumSubscription = binding.getPremiumSubscription(); if ((premiumSubscription == null ? value4 : premiumSubscription.paymentSourceId) != null || env3_11.applicationIdsFetched.has(env3_12)) { return value4; } binding = env3_0; value12 = binding(env3_1[13]); yield value12.fetchUserEntitlementsForApplication(env3_12); return value4; } binding = env3_0; value6 = binding(env3_1[12]); yield value6.fetchSubscriptions(); if (false) { return undefined; } binding = env3_10; premiumSubscription = binding.getPremiumSubscription(); r3 = (premiumSubscription == null ? value4 : premiumSubscription.paymentSourceId) != null || env3_11.applicationIdsFetched.has(env3_12); if (r3) { return value4; } binding = env3_0; value12 = binding(env3_1[13]); yield value12.fetchUserEntitlementsForApplication(env3_12); } return value4; } function maybeFetchMostRecentSubscription() { // fn#121675, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:1242, owner: SubscriptionManager.maybeFetchMostRecentSubscription, offset: 0x0254db2b, size: 169 bytes, params: 1, frame: 18 const value = environment.__proto__.__proto__; const currentUser = UserStore.getCurrentUser(); const value3 = undefined; const premiumTypeUtilsModule = require(1900) /* metro dependency 1900: PremiumTypeUtils */; const isPremiumAtMost = premiumTypeUtilsModule.isPremiumAtMost; const value4 = null; const premiumType = value4 == currentUser ? value3 : currentUser.premiumType; const r4 = value4 != premiumType ? premiumType : value4; const TIER_1 = PremiumTypes.TIER_1; if (value4 != currentUser && Reflect.apply(isPremiumAtMost, premiumTypeUtilsModule, [r4, TIER_1]) && currentUser.hasHadPremium() && !SubscriptionStore.getIsFetchingMostRecentSubscription()) { (require(4223) /* metro dependency 4223: BillingActionCreators */).fetchMostRecentSubscription(); } return value3; } function* _fun121677() { // fn#121677, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:1501, offset: 0x0254dbdf, size: 111 bytes, params: 1, frame: 14 if (true) { value = environment.__proto__.__proto__.__proto__; if (env3_0(env3_1[11]).isPremium(env3_8.getCurrentUser()) && !env3_9.ipCountryCodeLoaded) { value = environment.__proto__; yield SubscriptionManager.fetchCountryCode(); value = undefined; return undefined; } } } function* _fun121679() { // fn#121679, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:1639, offset: 0x0254dc59, size: 117 bytes, params: 1, frame: 15 if (true) { value = environment.__proto__.__proto__.__proto__; var value3 = env3_0(env3_1[12]); yield value3.fetchIpCountryCode(); if (false) { return undefined; } if (env3_9.ipCountryCode == null) { return undefined; } value = env3_0(env3_1[12]); yield value.fetchPaymentSources(); } }