/* Metro module 7356; source: modules/billing/native/StorekitIAPQueue.tsx; dependencies: [5, 6, 7, 27, 3837, 5138, 7336, 2] */ function _fun59285(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#59285, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:6, offset: 0x016e4a4f, size: 236 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(6) /* metro dependency 6 */; const env0_4 = importDefault(7) /* metro dependency 7 */; const NativeModules = (require(27) /* metro dependency 27 */).NativeModules; const env0_5 = (require(3837) /* metro dependency 3837: CountryCodeUtils */).convertToAlpha2; const env0_6 = NativeModules.RNIapIosSk2; let value = _fun59289(); value = new value(); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/billing/native/StorekitIAPQueue.tsx'); exports.default = value; } function productSK2ToIAPProduct(a0) { // fn#59286, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:194, offset: 0x016e4b3b, size: 334 bytes, params: 2, frame: 18 var object2; const r1 = a0.subscription.promotionalOffers == null ? [] : a0.subscription.promotionalOffers.map(function(a0) { return promoOfferToDiscount(a0); }); if (a0.subscription.introductoryOffer != null) { r1.push(promoOfferToDiscount(a0.subscription.introductoryOffer)); } const Number = global.Number; const price = a0.price; const toFixed = price.toFixed; const CurrencyExponents = (require(5138) /* metro dependency 5138: PriceUtils */).CurrencyExponents; const currency = a0.currency; const value = Number(Reflect.apply(toFixed, price, [CurrencyExponents[currency.toLowerCase()]])); object2 = {}; let String = global.String; object2.identifier = String(a0.id); object2.price = value; object2.currencySymbol = a0.displayPrice.split(RegExp('[0-9]', ''))[0]; object2.currencyCode = a0.currency.toLowerCase(); String = global.String; object2.priceString = String(value); object2.countryCode = ''; object2.downloadable = false; object2.description = a0.description; object2.title = a0.displayName; object2.discounts = r1; return object2; } function promoOfferToDiscount(a0) { // fn#59288, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:772, offset: 0x016e4c89, size: 175 bytes, params: 2, frame: 12 const paymentMode = a0.paymentMode; const r2 = paymentMode === 'freeTrial' ? 'FREETRIAL' : paymentMode === 'payAsYouGo' ? 'PAYASYOUGO' : paymentMode === 'payUpFront' ? 'PAYUPFRONT' : ''; const object2 = {}; object2.identifier = a0.id; object2.type = 'SUBSCRIPTION'; object2.numberOfPeriods = a0.period.value.toString(); object2.price = a0.price.toString(); object2.localizedPrice = a0.displayPrice; object2.paymentMode = r2; object2.subscriptionPeriod = a0.period.unit.toUpperCase(); return object2; } function _fun59289() { // fn#59289, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1166, offset: 0x016e4d38, size: 121 bytes, params: 1, frame: 17 const binding = env0_4; const closure = StorekitIAPQueueClass; let env0_0 = env0_2(_fun59304); return binding(closure, [{key: 'fetchSubscriptions', value: function(a0) { var env0_0 = this; var env0_1 = a0; var Promise = global.Promise; var value2 = new Promise(_fun59292); this.processQueue(); return value2; }}, {key: 'fetchProducts', value: function(a0) { var env0_0 = this; var env0_1 = a0; var Promise = global.Promise; var value2 = new Promise(_fun59297); this.processQueue(); return value2; }}, {key: 'processQueue', value: value_59305}]); } function StorekitIAPQueueClass() { // fn#59290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1187, offset: 0x016e4db1, size: 45 bytes, params: 1, frame: 13 env1_3(this, StorekitIAPQueueClass); this._queue = []; this._processingQueue = false; } function value_59291(a0) { // fn#59291, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1325, offset: 0x016e4dde, size: 61 bytes, params: 2, frame: 12 const env0_1 = a0; const Promise = global.Promise; const promise = new Promise(_fun59292); this.processQueue(); return promise; } function value_59296(a0) { // fn#59296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1575, offset: 0x016e4ee5, size: 61 bytes, params: 2, frame: 12 const env0_1 = a0; const Promise = global.Promise; const promise = new Promise(_fun59297); this.processQueue(); return promise; } function* _fun59304() { // fn#59304, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:2257, offset: 0x016e5122, size: 132 bytes, params: 1, frame: 13 var _queue; var length; var shift; var value3; var error; let value = undefined; if (false) { return value; } if (!this._processingQueue) { this._processingQueue = true; try { _queue = this._queue; } catch (error) { this._processingQueue = false; throw error; } try { length = _queue.length; } catch (error) { this._processingQueue = false; throw error; } try { value = length > 0; } catch (error) { this._processingQueue = false; throw error; } if (value) { while (true) { try { _queue = this._queue; } catch (error) { this._processingQueue = false; throw error; } try { shift = _queue.shift; } catch (error) { this._processingQueue = false; throw error; } try { value = Reflect.apply(shift, _queue, []); } catch (error) { this._processingQueue = false; throw error; } try { value = value(); } catch (error) { this._processingQueue = false; throw error; } yield value; try { value = undefined; value3 = false; } catch (error) { this._processingQueue = false; throw error; } if (value3) { this._processingQueue = false; return value; } try { _queue = this._queue; } catch (error) { this._processingQueue = false; throw error; } try { length = _queue.length; } catch (error) { this._processingQueue = false; throw error; } try { value = length > 0; } catch (error) { this._processingQueue = false; throw error; } if (value) { continue; } break; } this._processingQueue = false; return undefined; } this._processingQueue = false; } } function _fun59292(a0, a1) { // fn#59292, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1356, offset: 0x016e4e1b, size: 60 bytes, params: 3, frame: 13 const env0_0 = a0; const env0_1 = a1; const _queue = env0_0._queue; _queue.push(env2_2(_fun59294)); } function _fun59297(a0, a1) { // fn#59297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1606, offset: 0x016e4f22, size: 60 bytes, params: 3, frame: 13 const env0_0 = a0; const env0_1 = a1; const _queue = env0_0._queue; _queue.push(env2_2(_fun59299)); } function* _fun59294() { // fn#59294, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1384, offset: 0x016e4e60, size: 116 bytes, params: 1, frame: 13 var environment; var binding; var getItems; var value4; var value5; var value6; var filter; var closure; var value7; var map; var error; if (true) { value = environment.__proto__.__proto__.__proto__.__proto__; try { binding = env4_6; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { getItems = binding.getItems; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value4 = Reflect.apply(getItems, binding, [StorekitIAPQueueClass]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } yield value4; try { value5 = undefined; value6 = false; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } if (value6) { return value5; } try { filter = value5.filter; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { closure = function(a0) { return a0.subscription != null; }; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value7 = Reflect.apply(filter, value5, [closure]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { map = value7.map; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding = env4_7; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value = Reflect.apply(map, value7, [binding]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding = env1_0; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding(value); } catch (error) { value = environment.__proto__; env1_1(error); } } } function* _fun59299() { // fn#59299, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1634, offset: 0x016e4f67, size: 125 bytes, params: 1, frame: 14 var environment; var binding; var binding2; var property; var getProducts; var object2; var then; var closure; var value4; var error; if (true) { value = environment.__proto__.__proto__.__proto__.__proto__; try { binding = env4_0; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding2 = env4_1; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { property = binding2[6]; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value = binding(property); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { getProducts = value.getProducts; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { object2 = {}; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { object2.skus = StorekitIAPQueueClass; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value = Reflect.apply(getProducts, value, [object2]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { then = value.then; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { closure = function(a0) { return a0.filter(_fun59301).map(_fun59302); }; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value = Reflect.apply(then, value, [closure]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } yield value; try { value = undefined; value4 = false; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } if (value4) { return value; } try { binding = env1_0; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding(value); } catch (error) { value = environment.__proto__; env1_1(error); } } } function _fun59300(a0) { // fn#59300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1698, offset: 0x016e4fe4, size: 37 bytes, params: 2, frame: 12 return a0.filter(function(a0) { return a0.type === 'iap'; }).map(_fun59302); } function _fun59302(a0) { // fn#59302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1736, offset: 0x016e501d, size: 252 bytes, params: 2, frame: 16 var r3; var value2; var binding; var value3; var error; let value = ''; let countryCode = a0.countryCode; if (countryCode == null) { r3 = value; } else { countryCode = a0.countryCode; if (countryCode.length === 0) { r3 = value; } else { try { value2 = environment.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__; binding = env6_5; countryCode = a0.countryCode; value3 = binding(countryCode); r3 = value3; } catch (error) { r3 = value; } } } const object2 = {}; object2.identifier = a0.productId; const parseFloat = global.parseFloat; const price = a0.price; value = undefined; object2.price = parseFloat(price); const localizedPrice = a0.localizedPrice; object2.currencySymbol = localizedPrice == null ? value : localizedPrice.split(RegExp('[0-9]', ''))[0]; object2.currencyCode = a0.currency.toLowerCase(); object2.priceString = a0.price; object2.countryCode = r3; object2.downloadable = false; object2.description = a0.description; object2.title = a0.title; object2.discounts = 'discounts' in a0 ? a0.discounts : value; return object2; }