/* Metro module 15711; source: modules/feedback/FeedbackManager.tsx; dependencies: [6, 7, 15, 17, 18, 6825, 4294, 15712, 9906, 6824, 3829, 587, 22, 15713, 4860, 2] */ function _fun120555(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:6, offset: 0x0252faa1, size: 933 bytes, params: 8, frame: 29 var object6; const env0_0 = require; const _arrayLikeToArray_120561 = function(a0, a1) { var r0; var r1; var r2; var value3; var length; var value5; var value = undefined; var value2 = value == null; reducibleJoin2: while (true) { if (value2) { r0 = value2; break reducibleJoin2; } value3 = value > a0.length; r0 = value3; break reducibleJoin2; } reducibleJoin4: while (true) { if (r0) { length = a0.length; r1 = length; break reducibleJoin4; } r1 = value; break reducibleJoin4; } value = (0, global.Array)(r1); var value4 = 0; if (value4 < r1) { r2 = value4; reducibleLoop5: while (true) { value[r2] = a0[r2]; value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; if (value5 < r1) { r2 = value5; continue reducibleLoop5; } break reducibleLoop5; } } return value; }; const triggerRateEligibilityCheck = function(a0) { var Math = global.Math; return Math.random() < a0.chance; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_2 = importDefault(6) /* metro dependency 6 */; const env0_3 = importDefault(7) /* metro dependency 7 */; const env0_4 = importDefault(15) /* metro dependency 15 */; const env0_5 = importDefault(17) /* metro dependency 17 */; const env0_6 = importDefault(18) /* metro dependency 18 */; const hotspotStore = importDefault(6825) /* metro dependency 6825: HotspotStore */; const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */; const feedbackOverrideStore = importDefault(15712) /* metro dependency 15712: FeedbackOverrideStore */; let value = require(9906) /* metro dependency 9906: Constants */; const FeedbackGroup = value.FeedbackGroup; const FeedbackType = value.FeedbackType; const env0_10 = value.FeedbackTypePrecedence; const env0_11 = value.MAX_REPRESENTABLE_DATE; object6 = {'chance': 0.2, 'cooldown': 86400000}; const object7 = {}; const VOICE = FeedbackType.VOICE; const object9 = {}; copyDataProperties(object9, object6, undefined); let AV = FeedbackGroup.AV; object9['group'] = AV; const HotspotLocations = (require(6824) /* metro dependency 6824: hotspot */).HotspotLocations; const VOICE_CALL_FEEDBACK = HotspotLocations.VOICE_CALL_FEEDBACK; object9['hotspot'] = VOICE_CALL_FEEDBACK; object9['storageKey'] = 'lastVoiceFeedback'; const VOICE2 = FeedbackType.VOICE; object9['feedbackType'] = VOICE2; object9['eligibilityChecks'] = [function() { if (RTCConnectionStore.getWasEverRtcConnected()) { return RTCConnectionStore.getWasEverMultiParticipant(); } return true; }]; object7[VOICE] = object9; const STREAM = FeedbackType.STREAM; const object10 = {}; copyDataProperties(object10, object6, undefined); AV = FeedbackGroup.AV; object10['group'] = AV; const REPORT_PROBLEM_POST_STREAM = HotspotLocations.REPORT_PROBLEM_POST_STREAM; object10['hotspot'] = REPORT_PROBLEM_POST_STREAM; object10['storageKey'] = 'lastStreamFeedback'; const STREAM2 = FeedbackType.STREAM; object10['feedbackType'] = STREAM2; object7[STREAM] = object10; const VIDEO_BACKGROUND = FeedbackType.VIDEO_BACKGROUND; const object11 = {}; copyDataProperties(object11, object6, undefined); AV = FeedbackGroup.AV; object11['group'] = AV; const VIDEO_BACKGROUND_FEEDBACK = HotspotLocations.VIDEO_BACKGROUND_FEEDBACK; object11['hotspot'] = VIDEO_BACKGROUND_FEEDBACK; object11['storageKey'] = 'lastVideoBackgroundFeedback'; const VIDEO_BACKGROUND2 = FeedbackType.VIDEO_BACKGROUND; object11['feedbackType'] = VIDEO_BACKGROUND2; object7[VIDEO_BACKGROUND] = object11; const ACTIVITY = FeedbackType.ACTIVITY; AV = FeedbackGroup.AV; const POST_ACTIVITY_FEEDBACK = HotspotLocations.POST_ACTIVITY_FEEDBACK; const ACTIVITY2 = FeedbackType.ACTIVITY; object7[ACTIVITY] = {'cooldown': 0, 'chance': 0.5, 'group': null, 'hotspot': null, 'storageKey': 'lastActivityFeedback', group: AV, hotspot: POST_ACTIVITY_FEEDBACK, feedbackType: ACTIVITY2}; const IN_APP_REPORTS = FeedbackType.IN_APP_REPORTS; const SAFETY = FeedbackGroup.SAFETY; const IN_APP_REPORTS_FEEDBACK = HotspotLocations.IN_APP_REPORTS_FEEDBACK; const IN_APP_REPORTS2 = FeedbackType.IN_APP_REPORTS; object7[IN_APP_REPORTS] = {'cooldown': 172800000, 'chance': 0.5, 'group': null, 'hotspot': null, 'storageKey': 'inAppReportsFeedback', group: SAFETY, hotspot: IN_APP_REPORTS_FEEDBACK, feedbackType: IN_APP_REPORTS2}; const SEARCH_RESULTS = FeedbackType.SEARCH_RESULTS; const object12 = {}; copyDataProperties(object12, object6, undefined); const SEARCH = FeedbackGroup.SEARCH; object12['group'] = SEARCH; const SEARCH_RESULTS_FEEDBACK = HotspotLocations.SEARCH_RESULTS_FEEDBACK; object12['hotspot'] = SEARCH_RESULTS_FEEDBACK; object12['storageKey'] = 'searchResultsFeedback'; const SEARCH_RESULTS2 = FeedbackType.SEARCH_RESULTS; object12['feedbackType'] = SEARCH_RESULTS2; object12['eligibilityChecks'] = [searchResultsEligibilityCheck]; object7[SEARCH_RESULTS] = object12; value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */; value = _fun120571(value); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/feedback/FeedbackManager.tsx'); exports.default = value; exports.FeedbackConfig = object7; } function _isNativeReflectConstruct_120556() { // fn#120556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:280, offset: 0x0252fe46, 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_120556_isNativeReflectConstruct = function() { return !!result; })(); } function _createForOfIteratorHelperLoose_120559(a0, a1) { // fn#120559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:473, offset: 0x0252fea8, size: 372 bytes, params: 3, frame: 20 var r6; var r9; var r5; var value3; var regexp; const env0_0 = a0; const Symbol = global.Symbol; let value = typeof Symbol !== 'undefined'; let r1 = value && a0[global.Symbol.iterator]; r1 = !r1 ? a0['@@iterator'] : r1; if (r1) { value = r1.call(a0); return value.next.bind(value); } const Array = global.Array; if (Array.isArray(a0)) { if (r1) { } return _fun120560; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_120561(a0, value); r5 = value; } else { value3 = ({}).toString.call(a0).slice(8, -1); r6 = value3 === 'Object' && a0.constructor; r9 = r6 ? a0.constructor.name : value3; if (r9 === 'Map') { r6 = global.Array.from(a0); } else if (r9 === 'Set') { r6 = global.Array.from(a0); } else if (r9 === 'Arguments') { value = _arrayLikeToArray_120561(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_120561(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun120560; } const TypeError = global.TypeError; throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); } function optOutEligibilityCheck(a0) { // fn#120562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:2666, offset: 0x0253001c, size: 218 bytes, params: 2, frame: 17 const env0_0 = a0; const value2 = undefined; const InAppFeedbackStates = (require(3829) /* metro dependency 3829: UserSettings */).InAppFeedbackStates; const property = InAppFeedbackStates.getSetting()[a0.feedbackType]; const optOutExpiryTime = property == null ? value2 : property.optOutExpiryTime; const r2 = optOutExpiryTime != null && !global.Number.isNaN(optOutExpiryTime) && global.Date.now() < optOutExpiryTime; const hasHotspot2 = HotspotStore.hasHotspot(a0.hotspot); const value7 = !hasHotspot2; if (hasHotspot2 ? value7 : !r2) { InAppFeedbackStates.updateSetting(_fun120563); } return !r2 && !value7; } function recencyEligibilityCheck({cooldown}, a1) { // fn#120565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3082, offset: 0x0253015d, size: 355 bytes, params: 3, frame: 19 var r2; var r4; var Storage; const env0_0 = a1; const InAppFeedbackStates = (require(3829) /* metro dependency 3829: UserSettings */).InAppFeedbackStates; const lastImpressionTime = InAppFeedbackStates.getSetting()[a1.feedbackType]?.lastImpressionTime; let r7 = lastImpressionTime != null && !global.Number.isNaN(lastImpressionTime); r7 = !r7 ? a1.storageKey == null : r7; if (r7) { r4 = undefined; } else { Storage = (require(587) /* metro dependency 587: Storage */).Storage; r2 = Storage.get(a1.storageKey) ?? undefined; if (r2 == null || global.Number.isNaN(r2)) { r4 = r2; } else { InAppFeedbackStates.updateSetting(_fun120566); r4 = r2; } } let value = require(22) /* metro dependency 22 */; value = value.max([lastImpressionTime, r4]); value = (value ?? 0) + cooldown; const Date = global.Date; return value < Date.now(); } function groupRecencyEligibilityCheck(a0) { // fn#120567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3555, offset: 0x02530303, size: 115 bytes, params: 2, frame: 16 var value6; var value7; const env0_0 = a0; const _createForOfIteratorHelperLoose_120559Binding = _createForOfIteratorHelperLoose_120559; const Object = global.Object; const value4 = _createForOfIteratorHelperLoose_120559Binding(Object.values(env0_12).filter(_fun120568)); const value5 = value4(); let done = value5.done; if (done) { return true; } let r1 = value5; loopExit1: while (true) { value6 = r1.value; if (recencyEligibilityCheck(a0, value6)) { value7 = value4(); done = value7.done; if (done) { return true; } r1 = value7; continue; } break loopExit1; } return false; } function searchResultsEligibilityCheck() { // fn#120570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:2529, offset: 0x025303bc, size: 56 bytes, params: 1, frame: 12 const value = require(15713) /* metro dependency 15713: SearchResultsFeedbackExperiment */; const getIsSearchResultsFeedbackExperimentEnabled = value.getIsSearchResultsFeedbackExperimentEnabled; return !!Reflect.apply(getIsSearchResultsFeedbackExperimentEnabled, value, [{location: 'FeedbackManager'}]); } function _fun120571(a0) { // fn#120571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3780, offset: 0x025303f4, size: 72 bytes, params: 2, frame: 15 const closure = FeedbackManager_120572; env0_6(closure, a0); return env0_3(closure, [{key: 'possiblyShowFeedbackModal', value: value_120576}]); } function _fun120563(a0) { // fn#120563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:2932, offset: 0x025300f6, size: 70 bytes, params: 2, frame: 14 const object3 = {}; copyDataProperties(object3, a0, a0); const binding = env0_0; const feedbackType = binding.feedbackType; const object4 = {}; copyDataProperties(object4, a0[binding.feedbackType], a0); object4['optOutExpiryTime'] = MAX_REPRESENTABLE_DATE; object3[feedbackType] = object4; return object3; } function _fun120566(a0) { // fn#120566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3414, offset: 0x025302c0, size: 67 bytes, params: 2, frame: 15 const object3 = {}; copyDataProperties(object3, a0, a0); const feedbackType = require.feedbackType; const object4 = {}; copyDataProperties(object4, a0[require.feedbackType], a0); object4['lastImpressionTime'] = env0_1; object3[feedbackType] = object4; return object3; } function _fun120568({group}) { // fn#120568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3665, offset: 0x02530376, size: 28 bytes, params: 2, frame: 2 return group === env0_0.group; } function FeedbackManager_120572(a0) { // fn#120572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3792, offset: 0x0253043c, size: 188 bytes, params: 2, frame: 21 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_2; binding(this, FeedbackManager_120572); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_5(FeedbackManager_120572); binding = env1_4; if (_isNativeReflectConstruct_120556()) { Reflect = global.Reflect; value = Reflect.construct(value, items2, env1_5(this).constructor); r0 = value; } else { value = value.apply(this, items2); r0 = value; } value = binding(this, r0); value.feedbackTypeToShow = null; value.showFeedbackModalDebounced = (require(22) /* metro dependency 22 */).debounce(_fun120573, 200); return value; } function value_120576(a0, a1, a2) { // fn#120576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4435, offset: 0x025305c5, size: 100 bytes, params: 4, frame: 15 var environment; var value; if (feedbackTypeIsEligibleToBeShown(a0)) { if (this.feedbackTypeToShow == null) { this.feedbackTypeToShow = a0; this.showFeedbackModalDebounced(a1, a2); } else { value = environment.__proto__; if (FeedbackTypePrecedence[this.feedbackTypeToShow] < FeedbackTypePrecedence[a0]) { if (a2 != null) { a2(); } } else { this.feedbackTypeToShow = a0; this.showFeedbackModalDebounced(a1, a2); } } } else if (a2 != null) { a2(); } } function _fun120573(a0, a1) { // fn#120573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4098, offset: 0x025304f8, size: 77 bytes, params: 3, frame: 13 var binding; if (env0_0.feedbackTypeToShow != null) { binding = env0_0; ((a0) => { var env0_0 = a0; var InAppFeedbackStates = (require(3829) /* metro dependency 3829: UserSettings */).InAppFeedbackStates; InAppFeedbackStates.updateSetting(_fun120575); })(binding.feedbackTypeToShow); binding.feedbackTypeToShow = null; a0(); } else if (a1 != null) { a1(); } } function feedbackTypeIsEligibleToBeShown(a0) { // fn#120577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4452, owner: value_120576.feedbackTypeIsEligibleToBeShown, offset: 0x02530629, size: 128 bytes, params: 2, frame: 14 var environment; const value = environment.__proto__.__proto__; let r3 = FeedbackOverrideStore.getFeedbackConfig(a0) ?? env2_12[a0]; r3 = r3.eligibilityChecks ?? []; return [triggerRateEligibilityCheck, optOutEligibilityCheck, groupRecencyEligibilityCheck].every(_fun120578) && r3.every(_fun120579); } function updateLastFeedbackDate(a0) { // fn#120574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4135, offset: 0x02530545, size: 60 bytes, params: 2, frame: 12 const env0_0 = a0; const InAppFeedbackStates = (require(3829) /* metro dependency 3829: UserSettings */).InAppFeedbackStates; InAppFeedbackStates.updateSetting(_fun120575); } function _fun120575(a0) { // fn#120575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4215, offset: 0x02530581, size: 68 bytes, params: 2, frame: 14 const object3 = {}; copyDataProperties(object3, a0, undefined); const binding = env0_0; const object4 = {}; copyDataProperties(object4, a0[binding], undefined); const Date = global.Date; object4['lastImpressionTime'] = Date.now(); object3[binding] = object4; return object3; }