2026-07-28 08:39:19 +00:00
// Module ID: 5162
// Function ID: 44597
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-28 08:39:19 +00:00
// Dependencies: [5026, 3806, 5163, 1327, 5164, 2]
2026-07-20 16:05:17 +00:00
// Exports: buildGuildProfileFromInvite, buildGuildProfileUpdateForServer, buildTopGamesFromServer
2026-07-28 08:39:19 +00:00
// Module 5162 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import { EmojiDisambiguations } from "_isNativeReflectConstruct" ;
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 getEmoji ( guildId ) {
let emojiId ;
let emojiName ;
( { emojiId , emojiName } = guildId ) ;
const value = EmojiDisambiguations . get ( guildId . guildId ) ;
let byId = null ;
if ( null == emojiId ) {
if ( byId == emojiName ) {
return null ;
}
}
if ( byId != emojiId ) {
byId = null ;
if ( tmp6 ) {
byId = value . getById ( emojiId ) ;
}
let byName = byId ;
2026-07-23 10:11:24 +00:00
tmp6 = byId != value ;
2026-07-20 16:05:17 +00:00
} else {
byName = null ;
if ( byId != emojiName ) {
2026-07-28 08:39:19 +00:00
byName = importDefault ( 3806 ) . getByName ( emojiName ) ;
const obj2 = importDefault ( 3806 ) ;
2026-07-20 16:05:17 +00:00
}
}
}
function buildGuildProfileTraitsFromServer ( guildId ) {
let iter3 ;
let position ;
2026-07-28 08:39:19 +00:00
const array = new Array ( require ( 5163 ) /* MAX_TRAITS */ . MAX_TRAITS ) ;
2026-07-20 16:05:17 +00:00
const fillResult = array . fill ( closure_4 ) ;
const tmp2 = _createForOfIteratorHelperLoose ( arg1 ) ;
const iter = tmp2 ( ) ;
let iter2 = iter ;
if ( ! iter . done ) {
do {
let value = iter2 . value ;
let tmp3 = value . position < 0 ;
if ( ! tmp3 ) {
2026-07-23 10:11:24 +00:00
let tmp4 = require ;
let tmp5 = dependencyMap ;
2026-07-28 08:39:19 +00:00
tmp3 = value . position >= require ( 5163 ) /* MAX_TRAITS */ . MAX_TRAITS ;
2026-07-20 16:05:17 +00:00
}
if ( ! tmp3 ) {
let obj = { label : value.label } ;
2026-07-23 10:11:24 +00:00
let tmp6 = getEmoji ;
2026-07-20 16:05:17 +00:00
obj = { guildId } ;
( { emoji_id : obj3.emojiId , emoji_name : obj3.emojiName , position } = value ) ;
2026-07-23 10:11:24 +00:00
let tmp7 = getEmoji ( obj ) ;
2026-07-20 16:05:17 +00:00
let tmp8 ;
if ( null != tmp7 ) {
tmp8 = tmp7 ;
}
obj . emoji = tmp8 ;
fillResult [ position ] = obj ;
let tmp9 = tmp7 ;
}
iter3 = tmp2 ( ) ;
iter2 = iter3 ;
} while ( ! iter3 . done ) ;
}
return fillResult ;
}
function buildGuildProfileFromServer ( profile ) {
let brand_color_primary ;
let features ;
let traits ;
let reduced = { id : profile.id , name : profile.name } ;
const description = profile . description ;
let str = "" ;
if ( null != description ) {
str = description ;
}
reduced . description = str ;
( { icon_hash : obj.icon , custom_banner_hash : obj.customBanner , online_count : obj.onlineCount , member_count : obj.memberCount , brand_color_primary } = profile ) ;
let tmp = null ;
if ( null != brand_color_primary ) {
tmp = null ;
if ( "" !== brand_color_primary ) {
tmp = brand_color_primary ;
}
}
reduced . brandColorPrimary = tmp ;
( { visibility : obj.visibility , traits } = profile ) ;
if ( null == traits ) {
traits = [ ] ;
}
reduced . traits = buildGuildProfileTraitsFromServer ( profile . id , traits ) ;
let game_application_ids = profile . game_application_ids ;
if ( null == game_application_ids ) {
game_application_ids = [ ] ;
}
reduced . gameApplicationIds = game_application_ids ;
const game_activity = profile . game_activity ;
if ( null == game_activity ) {
reduced = { } ;
} else {
const _Object = Object ;
const entries = Object . entries ( game_activity ) ;
reduced = entries . reduce ( ( arg0 , arg1 ) = > {
let tmp ;
let tmp2 ;
[ tmp , tmp2 ] = arg1 ;
arg0 [ tmp ] = { level : tmp2.activity_level , score : tmp2.activity_score } ;
return arg0 ;
} , { } ) ;
}
reduced . gameActivity = reduced ;
( { games : obj.games , features } = profile ) ;
if ( null == features ) {
features = [ ] ;
}
reduced . features = features ;
( { tag : obj.tag , badge : obj.badge , badge_color_primary : obj.badgeColorPrimary , badge_color_secondary : obj.badgeColorSecondary , badge_hash : obj.badgeHash , premium_subscription_count : obj.premiumSubscriberCount , premium_tier : obj.premiumTier } = profile ) ;
return reduced ;
}
let closure_4 = { label : "" } ;
2026-07-23 10:11:24 +00:00
const result = require ( "MAX_TRAITS" ) . fileFinishedImporting ( "modules/guild_profile/GuildProfileBuilders.tsx" ) ;
2026-07-20 16:05:17 +00:00
export { buildGuildProfileFromServer } ;
export const buildGuildProfileUpdateForServer = function buildGuildProfileUpdateForServer ( name ) {
2026-07-23 10:11:24 +00:00
let obj = { } ;
2026-07-20 16:05:17 +00:00
if ( null != name . name ) {
obj . name = name . name ;
}
if ( null != name . description ) {
obj . description = name . description ;
}
if ( undefined !== name . icon ) {
obj . icon = name . icon ;
}
if ( undefined !== name . customBanner ) {
obj . custom_banner = name . customBanner ;
}
if ( null != name . visibility ) {
obj . visibility = name . visibility ;
}
if ( undefined !== name . brandColorPrimary ) {
obj . brand_color_primary = name . brandColorPrimary ;
}
if ( null != name . traits ) {
const traits = name . traits ;
const mapped = traits . map ( ( label , position ) = > {
label = undefined ;
if ( null != label ) {
label = label . label ;
}
let tmp2 = null ;
if ( null != label ) {
tmp2 = null ;
if ( label . label . length > 0 ) {
const obj = { label : label.label , position } ;
const emoji = label . emoji ;
let id ;
if ( null != emoji ) {
id = emoji . id ;
}
obj . emoji_id = id ;
const emoji2 = label . emoji ;
let name ;
if ( null != emoji2 ) {
name = emoji2 . name ;
}
obj . emoji_name = name ;
const emoji3 = label . emoji ;
let animated ;
if ( null != emoji3 ) {
animated = emoji3 . animated ;
}
obj . emoji_animated = animated ;
tmp2 = obj ;
}
}
return tmp2 ;
} ) ;
2026-07-23 10:11:24 +00:00
obj . traits = mapped . filter ( require ( 1327 ) /* isDiscordFrontendDevelopment */ . isNotNullish ) ;
2026-07-20 16:05:17 +00:00
}
if ( null != name . gameApplicationIds ) {
obj . game_application_ids = name . gameApplicationIds ;
}
if ( undefined !== name . tag ) {
obj . tag = name . tag ;
}
if ( undefined !== name . badge ) {
obj . badge = name . badge ;
}
if ( undefined !== name . badgeColorPrimary ) {
obj . badge_color_primary = name . badgeColorPrimary ;
}
if ( undefined !== name . badgeColorSecondary ) {
obj . badge_color_secondary = name . badgeColorSecondary ;
}
return obj ;
} ;
export const buildTopGamesFromServer = function buildTopGamesFromServer ( top_games ) {
return top_games . reduce ( ( arg0 , game_application_id ) = > {
arg0 [ game_application_id . game_application_id ] = { level : game_application_id.activity_level , score : game_application_id.activity_score } ;
return arg0 ;
} , { } ) ;
} ;
export const buildGuildProfileFromInvite = function buildGuildProfileFromInvite ( approximate_presence_count ) {
let description ;
let guild ;
let profile ;
( { guild , profile } = approximate_presence_count ) ;
let tmp = null ;
if ( null != profile ) {
tmp = buildGuildProfileFromServer ( profile ) ;
}
if ( null == tmp ) {
let tmp5 = null ;
if ( null != guild ) {
const obj = { } ;
( { id : obj.id , name : obj.name , description } = guild ) ;
let str = "" ;
if ( null != description ) {
str = description ;
}
obj . description = str ;
( { icon : obj.icon , banner : obj.customBanner , approximate_presence_count } = guild ) ;
if ( null == approximate_presence_count ) {
approximate_presence_count = approximate_presence_count . approximate_presence_count ;
}
let num = 0 ;
if ( null != approximate_presence_count ) {
num = approximate_presence_count ;
}
obj . onlineCount = num ;
let approximate_member_count = guild . approximate_member_count ;
if ( null == approximate_member_count ) {
approximate_member_count = approximate_presence_count . approximate_member_count ;
}
let num2 = 0 ;
if ( null != approximate_member_count ) {
num2 = approximate_member_count ;
}
obj . memberCount = num2 ;
2026-07-28 08:39:19 +00:00
obj . visibility = require ( 5164 ) /* GuildProfileVisibility */ . GuildProfileVisibility . NOT_SPECIFIED ;
2026-07-20 16:05:17 +00:00
obj . traits = [ ] ;
obj . gameApplicationIds = [ ] ;
obj . gameActivity = { } ;
let features = guild . features ;
if ( null == features ) {
features = [ ] ;
}
obj . features = features ;
obj . brandColorPrimary = null ;
obj . tag = null ;
obj . badge = null ;
obj . badgeHash = null ;
obj . badgeColorPrimary = null ;
obj . badgeColorSecondary = null ;
( { premium_subscription_count : obj.premiumSubscriberCount , premium_tier : obj.premiumTier } = guild ) ;
tmp5 = obj ;
}
tmp = tmp5 ;
}
return tmp ;
} ;