2026-07-25 08:10:48 +00:00
// Module ID: 5069
2026-07-27 11:26:19 +00:00
// Function ID: 44020
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-23 10:11:24 +00:00
// Dependencies: [1348, 22, 1327, 566, 2]
2026-07-20 16:05:17 +00:00
// Exports: useFlattenedChannels
2026-07-25 08:10:48 +00:00
// Module 5069 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct" ;
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 ;
}
function getFlattenedChannels ( guildId , set , found , arg3 ) {
let done ;
let flag = arg3 ;
2026-07-23 10:11:24 +00:00
const _require = set ;
2026-07-20 16:05:17 +00:00
const importDefault = found ;
if ( arg3 === undefined ) {
flag = false ;
}
let mutableGuildChannelsForGuild ;
2026-07-23 10:11:24 +00:00
set = undefined ;
let found2 ;
const tmp = importDefault ( flag [ 1 ] ) ;
const values = importDefault ( flag [ 1 ] ) ( mutableGuildChannelsForGuild . getMutableGuildChannelsForGuild ( guildId ) ) . values ( ) ;
const tmpResult = importDefault ( flag [ 1 ] ) ( mutableGuildChannelsForGuild . getMutableGuildChannelsForGuild ( guildId ) ) ;
2026-07-20 16:05:17 +00:00
mutableGuildChannelsForGuild = values . groupBy ( "parent_id" ) . value ( ) ;
const iter = values . groupBy ( "parent_id" ) ;
2026-07-23 10:11:24 +00:00
const mapped = importDefault ( flag [ 1 ] ) ( found ) . map ( ( isCategory ) = > isCategory . isCategory ( ) ? isCategory.id : isCategory.parent_id ) ;
found = mapped . filter ( _require ( flag [ 2 ] ) . isNotNullish ) ;
const arr = importDefault ( flag [ 1 ] ) ( found ) ;
2026-07-20 16:05:17 +00:00
const mapped1 = found . uniq ( ) . map ( ( channelId ) = > channel . getChannel ( channelId ) ) ;
2026-07-23 10:11:24 +00:00
const found1 = mapped1 . filter ( _require ( flag [ 2 ] ) . isNotNullish ) ;
2026-07-20 16:05:17 +00:00
const uniqResult = found . uniq ( ) ;
const valueResult = found1 . sortBy ( "position" ) . value ( ) ;
2026-07-23 10:11:24 +00:00
set = new Set ( valueResult . map ( ( id ) = > id . id ) ) ;
found2 = found . filter ( ( isCategory ) = > {
2026-07-20 16:05:17 +00:00
let isCategoryResult = isCategory . isCategory ( ) ;
if ( ! isCategoryResult ) {
let hasItem = null != isCategory . parent_id ;
if ( hasItem ) {
hasItem = set . has ( isCategory . parent_id ) ;
}
isCategoryResult = hasItem ;
}
return ! isCategoryResult ;
} ) ;
2026-07-23 10:11:24 +00:00
const iter2 = found1 . sortBy ( "position" ) ;
const sortByResult = importDefault ( flag [ 1 ] ) . sortBy ( found2 , ( position ) = > {
2026-07-20 16:05:17 +00:00
position = position . position ;
if ( position . isGuildVocal ( ) ) {
let sum = position + 10000 ;
} else {
sum = position ;
}
return sum ;
} ) ;
2026-07-23 10:11:24 +00:00
found2 = sortByResult ;
2026-07-20 16:05:17 +00:00
function _loop ( value ) {
if ( ! flag ) {
2026-07-23 10:11:24 +00:00
found2 . push ( value ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( value . has ( value . id ) ) {
let found = channel [ value . id ] ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
found = lib . filter ( ( parent_id ) = > parent_id . parent_id === value . id ) ;
2026-07-20 16:05:17 +00:00
}
if ( null == found ) {
found = [ ] ;
}
const items = [
2026-07-23 10:11:24 +00:00
. . . lib ( flag [ 1 ] ) . sortBy ( found , ( position ) = > {
2026-07-20 16:05:17 +00:00
position = position . position ;
if ( position . isGuildVocal ( ) ) {
let sum = position + 10000 ;
} else {
sum = position ;
}
return sum ;
} )
] ;
2026-07-23 10:11:24 +00:00
found2 . push . apply ( items ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const tmp5 = set ( valueResult ) ;
2026-07-20 16:05:17 +00:00
let iter3 = tmp5 ( ) ;
if ( ! iter3 . done ) {
do {
let _loopResult = _loop ( iter3 . value ) ;
let iter4 = tmp5 ( ) ;
iter3 = iter4 ;
done = iter4 . done ;
} while ( ! done ) ;
}
return sortByResult ;
}
2026-07-23 10:11:24 +00:00
const result = require ( "isDiscordFrontendDevelopment" ) . fileFinishedImporting ( "modules/guild_onboarding/useFlattenedChannels.tsx" ) ;
2026-07-20 16:05:17 +00:00
export { getFlattenedChannels } ;
export const useFlattenedChannels = function useFlattenedChannels ( arg0 , arg1 ) {
let flag = arg2 ;
2026-07-23 10:11:24 +00:00
const _require = arg0 ;
let closure_1 = arg1 ;
2026-07-20 16:05:17 +00:00
if ( arg2 === undefined ) {
flag = false ;
}
2026-07-23 10:11:24 +00:00
const items = [ _isNativeReflectConstruct ] ;
return _require ( flag [ 3 ] ) . useStateFromStoresArray ( items , ( ) = > {
const mapped = Array . from ( closure_1 ) . map ( ( channelId ) = > outer2_3 . getChannel ( channelId ) ) ;
return outer1_6 ( callback , closure_1 , mapped . filter ( callback ( flag [ 2 ] ) . isNotNullish ) , flag ) ;
2026-07-20 16:05:17 +00:00
} ) ;
} ;