2026-07-25 08:10:48 +00:00
// Module ID: 11471
// Function ID: 89330
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-25 08:10:48 +00:00
// Dependencies: [5, 57, 31, 5630, 11472, 653, 11473, 10102, 4030, 9359, 7923, 675, 11475, 3804, 7633, 2]
2026-07-20 16:05:17 +00:00
// Exports: useMessageRequestActions
2026-07-25 08:10:48 +00:00
// Module 11471 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import ME from "ME" ;
import _slicedToArray from "_slicedToArray" ;
import result from "result" ;
import _isNativeReflectConstruct from "_isNativeReflectConstruct" ;
import MESSAGE_REQUEST_ACCEPT_CONFIRMATION_MODAL from "MESSAGE_REQUEST_ACCEPT_CONFIRMATION_MODAL" ;
import { AnalyticEvents } from "ME" ;
let closure_7 ;
let closure_8 ;
const require = arg1 ;
function _createForOfIteratorHelperLoose ( iterable ) {
let closure_0 = iterable ;
iterable = "undefined" !== typeof Symbol ;
if ( iterable ) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol ;
2026-07-23 10:11:24 +00:00
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( ! iterable ) {
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( iterable ) {
const iter = iterable . call ( iterable ) ;
2026-07-20 16:05:17 +00:00
const next = iter . next ;
return next . bind ( iter ) ;
} else {
const _Array = Array ;
2026-07-23 10:11:24 +00:00
let tmp = iterable ;
if ( ! Array . isArray ( iterable ) ) {
2026-07-20 16:05:17 +00:00
let tmp2 ;
2026-07-23 10:11:24 +00:00
if ( iterable ) {
if ( "string" === typeof iterable ) {
tmp2 = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
const toString = { } . toString ;
2026-07-23 10:11:24 +00:00
const substr = toString . call ( iterable ) . slice ( 8 , - 1 ) ;
2026-07-20 16:05:17 +00:00
let name = substr ;
if ( tmp3 ) {
2026-07-23 10:11:24 +00:00
name = iterable . constructor . name ;
2026-07-20 16:05:17 +00:00
}
if ( "Map" !== name ) {
if ( "Set" !== name ) {
if ( "Arguments" === name ) {
2026-07-23 10:11:24 +00:00
let arr = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ ;
2026-07-20 16:05:17 +00:00
}
}
tmp2 = arr ;
}
const _Array2 = Array ;
2026-07-23 10:11:24 +00:00
arr = Array . from ( iterable ) ;
const callResult = toString . call ( iterable ) ;
tmp3 = "Object" === substr && iterable . constructor ;
2026-07-20 16:05:17 +00:00
}
}
tmp = tmp2 ;
if ( ! tmp2 ) {
const _TypeError = TypeError ;
const typeError = new TypeError ( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
throw typeError ;
}
}
if ( tmp ) {
2026-07-23 10:11:24 +00:00
closure_0 = tmp ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c1 = 0 ;
2026-07-20 16:05:17 +00:00
return ( ) = > {
2026-07-23 10:11:24 +00:00
if ( closure_1 >= length . length ) {
2026-07-20 16:05:17 +00:00
let obj = { done : true } ;
} else {
obj = { done : false } ;
closure_1 = tmp3 + 1 ;
2026-07-23 10:11:24 +00:00
obj . value = length [ + closure_1 ] ;
2026-07-20 16:05:17 +00:00
}
return obj ;
} ;
}
}
function _arrayLikeToArray ( arg0 , arg1 ) {
let length ;
if ( tmp ) {
length = arg0 . length ;
}
const ArrayResult = Array ( length ) ;
for ( let num = 0 ; num < length ; num = num + 1 ) {
ArrayResult [ num ] = arg0 [ num ] ;
}
return ArrayResult ;
}
2026-07-23 10:11:24 +00:00
( { MessageRequestAnalyticsAction : closure_7 , BATCH_REJECT_LIMIT : closure_8 } = MESSAGE_REQUEST_ACCEPT_CONFIRMATION_MODAL ) ;
let result = require ( "result" ) . fileFinishedImporting ( "modules/message_request/hooks/useMessageRequestActions.tsx" ) ;
2026-07-20 16:05:17 +00:00
export const useMessageRequestActions = function useMessageRequestActions ( user ) {
2026-07-23 10:11:24 +00:00
let result ;
let _isNativeReflectConstruct ;
let closure_7 ;
2026-07-20 16:05:17 +00:00
let tmp5 ;
let tmp7 ;
let tmp9 ;
user = user . user ;
const onAcceptSuccess = user . onAcceptSuccess ;
const onRejectSuccess = user . onRejectSuccess ;
const onError = user . onError ;
2026-07-23 10:11:24 +00:00
let c9 ;
let callback ;
2026-07-20 16:05:17 +00:00
const tmp2 = callback ( React . useState ( false ) , 2 ) ;
const first = tmp2 [ 0 ] ;
2026-07-23 10:11:24 +00:00
callback = tmp2 [ 1 ] ;
const tmp = onAcceptSuccess ( onRejectSuccess [ 6 ] ) ( ) ;
[ tmp5 , result ] = callback ( React . useState ( false ) , 2 ) ;
let tmp4 = callback ( React . useState ( false ) , 2 ) ;
[ tmp7 , _isNativeReflectConstruct ] = callback ( React . useState ( false ) , 2 ) ;
2026-07-20 16:05:17 +00:00
const tmp6 = callback ( React . useState ( false ) , 2 ) ;
[ tmp9 , closure_7 ] = callback ( React . useState ( false ) , 2 ) ;
const tmp10 = callback ( React . useState ( false ) , 2 ) ;
let closure_8 = tmp10 [ 1 ] ;
let tmp11 = first ;
if ( ! first ) {
tmp11 = tmp5 ;
}
if ( ! tmp11 ) {
tmp11 = tmp7 ;
}
2026-07-23 10:11:24 +00:00
c9 = tmp11 ;
2026-07-20 16:05:17 +00:00
const items = [ tmp11 , onAcceptSuccess , onError ] ;
2026-07-23 10:11:24 +00:00
callback = React . useCallback ( ( ( ) = > {
2026-07-20 16:05:17 +00:00
// CreateGeneratorClosureLongIndex (0x67)
let closure_0 = onError ( tmp ) ;
return function ( ) {
return callback ( . . . arguments ) ;
} ;
2026-07-23 10:11:24 +00:00
} ) ( ) , items ) ;
2026-07-20 16:05:17 +00:00
const items1 = [ tmp11 , onRejectSuccess , onError ] ;
2026-07-23 10:11:24 +00:00
const callback1 = React . useCallback ( ( ( ) = > {
2026-07-20 16:05:17 +00:00
// CreateGeneratorClosureLongIndex (0x67)
let closure_0 = onError ( tmp ) ;
return function ( ) {
return callback ( . . . arguments ) ;
} ;
2026-07-23 10:11:24 +00:00
} ) ( ) , items1 ) ;
2026-07-20 16:05:17 +00:00
const items2 = [ tmp11 , onRejectSuccess , onError ] ;
2026-07-23 10:11:24 +00:00
const callback2 = React . useCallback ( ( ( ) = > {
2026-07-20 16:05:17 +00:00
// CreateGeneratorClosureLongIndex (0x67)
let closure_0 = onError ( tmp ) ;
return function ( ) {
return callback ( . . . arguments ) ;
} ;
2026-07-23 10:11:24 +00:00
} ) ( ) , items2 ) ;
2026-07-20 16:05:17 +00:00
const items3 = [ callback , tmp11 , user ] ;
const items4 = [ callback ] ;
2026-07-23 10:11:24 +00:00
const callback3 = React . useCallback ( ( ( ) = > {
2026-07-20 16:05:17 +00:00
// CreateGeneratorClosureLongIndex (0x67)
let closure_0 = onError ( tmp ) ;
return function ( arg0 ) {
return callback ( . . . arguments ) ;
} ;
2026-07-23 10:11:24 +00:00
} ) ( ) , items3 ) ;
let obj = { } ;
2026-07-20 16:05:17 +00:00
const callback4 = React . useCallback ( ( channel ) = > {
2026-07-23 10:11:24 +00:00
let closure_0 = channel ;
let closure_1 = arg1 ;
let closure_2 = arg2 ;
2026-07-20 16:05:17 +00:00
function onConfirm ( setting ) {
if ( arg1 ) {
2026-07-23 10:11:24 +00:00
const NonSpamRetrainingOptIn = user ( onRejectSuccess [ 13 ] ) . NonSpamRetrainingOptIn ;
2026-07-20 16:05:17 +00:00
NonSpamRetrainingOptIn . updateSetting ( setting ) ;
}
let tmp4 = setting ;
if ( setting ) {
2026-07-23 10:11:24 +00:00
tmp4 = null != closure_1 ;
2026-07-20 16:05:17 +00:00
}
if ( tmp4 ) {
2026-07-23 10:11:24 +00:00
let obj = user ( onRejectSuccess [ 14 ] ) ;
const result = obj . submitHamReportForFirstDM ( closure_1 ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
outer1_10 ( user . id ) ;
obj = { action : outer2_7.ACCEPT_HAM_CONFIRMATION_PROMPT , channel_id : user.id , is_dont_show_again_checked : arg1 , non_spam_retraining_opt_in : setting } ;
onAcceptSuccess ( onRejectSuccess [ 11 ] ) . track ( constants . MESSAGE_REQUEST_ACTION , obj ) ;
if ( null != callback ) {
callback ( ) ;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
let NonSpamRetrainingOptIn = user ( onRejectSuccess [ 13 ] ) . NonSpamRetrainingOptIn ;
2026-07-20 16:05:17 +00:00
const setting = NonSpamRetrainingOptIn . getSetting ( ) ;
if ( null == setting ) {
let obj = user ( onRejectSuccess [ 12 ] ) ;
obj = {
channel ,
onConfirm ,
onCancel() {
2026-07-23 10:11:24 +00:00
let obj = onAcceptSuccess ( onRejectSuccess [ 11 ] ) ;
obj = { action : outer2_7.DISMISS_HAM_CONFIRMATION_PROMPT , channel_id : user.id } ;
obj . track ( constants . MESSAGE_REQUEST_ACTION , obj ) ;
2026-07-20 16:05:17 +00:00
}
} ;
2026-07-23 10:11:24 +00:00
let result = obj . onMarkAsNotSpamConfirmationModal ( obj ) ;
2026-07-20 16:05:17 +00:00
} else {
onConfirm ( setting ) ;
}
} , items4 ) ;
if ( tmp ) {
callback = callback3 ;
}
obj . acceptMessageRequest = callback ;
obj . rejectMessageRequest = callback1 ;
obj . rejectAll = callback2 ;
obj . markAsNotSpam = callback4 ;
obj . isAcceptLoading = first ;
obj . isRejectLoading = tmp5 ;
obj . isUserProfileLoading = tmp7 ;
obj . isOptimisticAccepted = tmp9 ;
obj . isOptimisticRejected = tmp10 [ 0 ] ;
return obj ;
} ;