/* Metro module 7671; source: records/GiftCodeRecord.tsx; dependencies: [6, 7, 15, 17, 18, 1886, 7262, 3803, 1880, 3738, 1391, 2] */ function _fun61286(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61286, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7849:6, offset: 0x01b3a52b, size: 303 bytes, params: 8, frame: 20 const env0_0 = require; let Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(6) /* metro dependency 6 */; const env0_4 = importDefault(7) /* metro dependency 7 */; const env0_5 = importDefault(15) /* metro dependency 15 */; const env0_6 = importDefault(17) /* metro dependency 17 */; const env0_7 = importDefault(18) /* metro dependency 18 */; let value = importDefault(1886) /* metro dependency 1886: Record */; const promotionRecord = importDefault(7262) /* metro dependency 7262: PromotionRecord */; const subscriptionPlanRecord = importDefault(3803) /* metro dependency 3803: SubscriptionPlanRecord */; const env0_10 = (require(1880) /* metro dependency 1880: PremiumConstants */).PremiumSubscriptionSKUToPremiumType; Object = global.Object; const value2 = Object.freeze({'PAYMENT_SOURCE_REQUIRED': 1, 'EXISTING_PREMIUM_SUBSCRIPTION_DISALLOWED': 2, 'NOT_SELF_REDEEMABLE': 4}); value = _fun61290(value); (require(2) /* metro dependency 2 */).fileFinishedImporting('records/GiftCodeRecord.tsx'); exports.default = value; exports.GiftCodeFlags = value2; } function _isNativeReflectConstruct_61287() { // fn#61287, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7849:224, offset: 0x01b3a65a, size: 94 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_61287_isNativeReflectConstruct = function() { return !!result; })(); } function _fun61290(a0) { // fn#61290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7849:533, offset: 0x01b3a6b8, size: 311 bytes, params: 2, frame: 17 const closure = GiftCodeRecord; env0_7(closure, a0); return env0_4(closure, [{key: 'isExpired', value: value_61292}, {key: 'hasMultipleCopies', get: function() { return this.maxUses > 1; }}, {key: 'isClaimed', get: function() { var uses = this.uses; return uses >= this.maxUses; }}, {key: 'remainingUses', get: function() { return this.maxUses - this.uses; }}, {key: 'isSubscription', get: function() { return this.subscriptionPlanId != null; }}, {key: 'premiumSubscriptionType', get: function() { var value = null; return this.isSubscription && value != PremiumSubscriptionSKUToPremiumType[this.skuId] ? PremiumSubscriptionSKUToPremiumType[this.skuId] : value; }}, {key: 'isSelfRedeemable', get: get_61298}, {key: 'isExistingPremiumSubscriptionDisallowed', get: get_61299}, {key: 'analyticsData', get: function() { return {gift_code: this.code, gift_code_max_uses: this.maxUses}; }}, {key: 'toString', value: function() { return this.code; }}], [{key: 'createFromServer', value: value_61302}]); } function GiftCodeRecord({userId, code, skuId, applicationId, uses, maxUses, expiresAt, redeemed, storeListingId, subscriptionPlanId, subscriptionPlan, revoked, entitlementBranches, flags, subscriptionTrial, promotion, giftStyle}) { // fn#61291, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7849:545, offset: 0x01b3a7ef, size: 310 bytes, params: 2, frame: 20 let value = environment.__proto__; env1_3(this, GiftCodeRecord); const value3 = env1_6(GiftCodeRecord); value = env1_5(this, _isNativeReflectConstruct_61287() ? global.Reflect.construct(value3, [], env1_6(this).constructor) : value3.apply(this, undefined)); value.userId = userId; value.code = code; value.skuId = skuId; value.applicationId = applicationId; value.uses = uses; value.maxUses = maxUses; value.expiresAt = expiresAt; value.redeemed = redeemed; value.storeListingId = storeListingId; value.subscriptionPlanId = subscriptionPlanId; value.subscriptionPlan = subscriptionPlan; value.revoked = revoked; value.entitlementBranches = entitlementBranches; value.flags = flags; value.subscriptionTrial = subscriptionTrial; value.promotion = promotion; value.giftStyle = giftStyle; return value; } function value_61292() { // fn#61292, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7849:1275, offset: 0x01b3a925, size: 60 bytes, params: 1, frame: 13 var r0; const expiresAt = this.expiresAt; let value = expiresAt != null; if (value) { value = environment.__proto__; value = (importDefault(3738) /* metro dependency 3738 */)(); value = value.isAfter(expiresAt); r0 = value; } else { r0 = value; } return r0; } function get_61298() { // fn#61298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7849:1760, offset: 0x01b3a9dc, size: 60 bytes, params: 1, frame: 13 const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */; const hasFlag = flagUtilsModule.hasFlag; const flags = this.flags; const NOT_SELF_REDEEMABLE = env1_11.NOT_SELF_REDEEMABLE; return !Reflect.apply(hasFlag, flagUtilsModule, [flags, NOT_SELF_REDEEMABLE]); } function get_61299() { // fn#61299, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7849:1882, offset: 0x01b3aa18, size: 57 bytes, params: 1, frame: 13 const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */; const hasFlag = flagUtilsModule.hasFlag; const flags = this.flags; const EXISTING_PREMIUM_SUBSCRIPTION_DISALLOWED = env1_11.EXISTING_PREMIUM_SUBSCRIPTION_DISALLOWED; return Reflect.apply(hasFlag, flagUtilsModule, [flags, EXISTING_PREMIUM_SUBSCRIPTION_DISALLOWED]); } function value_61302(a0) { // fn#61302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7849:2156, offset: 0x01b3aa77, size: 495 bytes, params: 2, frame: 16 var r4; var r1; var object3; const object4 = {}; const user = a0.user; let value = null; object4.userId = value != user ? a0.user.id : value; object4.code = a0.code; object4.skuId = a0.sku_id; object4.applicationId = a0.application_id; const uses = a0.uses; object4.uses = uses; object4.maxUses = a0.max_uses; object4.storeListingId = value != a0.store_listing ? a0.store_listing.id : value; object4.expiresAt = value != a0.expires_at ? (importDefault(3738) /* metro dependency 3738 */)(a0.expires_at) : value; object4.redeemed = a0.redeemed; object4.subscriptionPlanId = value != a0.subscription_plan ? a0.subscription_plan.id : a0.subscription_plan_id; object4.subscriptionPlan = value != a0.subscription_plan ? SubscriptionPlanRecord.createFromServer(a0.subscription_plan) : value; object4.revoked = false; let entitlement_branches = a0.entitlement_branches; entitlement_branches = value != entitlement_branches ? a0.entitlement_branches : value; object4.entitlementBranches = entitlement_branches; let flags = a0.flags; flags = value != flags ? a0.flags : 0; object4.flags = flags; object4.giftStyle = a0.gift_style; let subscription_trial = a0.subscription_trial; if (value != subscription_trial) { object3 = {}; subscription_trial = a0.subscription_trial; object3.id = subscription_trial.id; subscription_trial = a0.subscription_trial; object3.interval = subscription_trial.interval; subscription_trial = a0.subscription_trial; object3.intervalCount = subscription_trial.interval_count; subscription_trial = a0.subscription_trial; object3.skuId = subscription_trial.sku_id; r4 = object3; } else { r4 = value; } object4.subscriptionTrial = r4; if (value != a0.promotion) { value = environment.__proto__; value = PromotionRecord.createFromServer(a0.promotion); r1 = value; } else { r1 = value; } object4.promotion = r1; value = Object.create(GiftCodeRecord.prototype, {constructor: {value: GiftCodeRecord}}); const giftCodeRecord = new GiftCodeRecord(object4); return giftCodeRecord instanceof Object ? giftCodeRecord : value; }