2026-07-25 08:10:48 +00:00
// Module ID: 1915
// Function ID: 21596
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-25 08:10:48 +00:00
// Dependencies: [1388, 1912, 483, 665, 1914, 2]
2026-07-20 16:05:17 +00:00
// Exports: fromSerializedPartition, fromSyncOperation, isGuildRoleRecord, toSerializedPartition
2026-07-25 08:10:48 +00:00
// Module 1915 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import constructInPlace from "constructInPlace" ;
import { GuildRoleRecordTypeTag } from "GuildRoleRecordTypeTag" ;
let closure_3 ;
let closure_4 ;
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 fromServerArray ( id , roles ) {
let done ;
const obj = { } ;
const tmp = _createForOfIteratorHelperLoose ( roles ) ;
let iter = tmp ( ) ;
if ( ! iter . done ) {
do {
let value = iter . value ;
2026-07-23 10:11:24 +00:00
let tmp2 = fromServer ;
obj [ value . id ] = fromServer ( id , value ) ;
2026-07-20 16:05:17 +00:00
let iter2 = tmp ( ) ;
iter = iter2 ;
done = iter2 . done ;
} while ( ! done ) ;
}
return obj ;
}
function fromServer ( guildId , id ) {
let flags ;
let managed ;
2026-07-23 10:11:24 +00:00
const obj = { id : id.id , name : id.name , guildId , permissions : importAll ( 483 ) . deserialize ( id . permissions ) } ;
2026-07-20 16:05:17 +00:00
( { mentionable : obj.mentionable , position : obj.position , color : obj.color } = id ) ;
let int2hexResult = null ;
if ( 0 !== id . color ) {
2026-07-23 10:11:24 +00:00
int2hexResult = require ( 665 ) /* pad2 */ . int2hex ( id . color ) ;
const obj3 = require ( 665 ) /* pad2 */ ;
2026-07-20 16:05:17 +00:00
}
obj . colorString = int2hexResult ;
const colors = id . colors ;
let tmp5 = null ;
if ( null != colors ) {
tmp5 = colors ;
}
obj . colors = tmp5 ;
let result = null ;
if ( null != id . colors ) {
2026-07-25 08:10:48 +00:00
result = require ( 1914 ) /* extractColorStringsFromServerColors */ . extractColorStringsFromServerColors ( id . colors ) ;
const obj4 = require ( 1914 ) /* extractColorStringsFromServerColors */ ;
2026-07-20 16:05:17 +00:00
}
obj . colorStrings = result ;
( { hoist : obj.hoist , managed } = id ) ;
obj . managed = null != managed && managed ;
let tags = id . tags ;
if ( null == tags ) {
tags = { } ;
}
obj . tags = tags ;
( { icon : obj.icon , unicode_emoji : obj.unicodeEmoji , flags } = id ) ;
let num3 = 0 ;
if ( null != flags ) {
num3 = flags ;
}
obj . flags = num3 ;
const description = id . description ;
let tmp9 = null ;
if ( null != description ) {
tmp9 = description ;
}
obj . description = tmp9 ;
obj . version = id . version ;
return constructGuildRoleInPlace ( obj ) ;
}
function constructGuildRoleInPlace ( arg0 ) {
return callback ( GuildRoleRecordTypeTag , arg0 ) ;
}
function fromSerialized ( guildId , id ) {
let flags ;
let managed ;
2026-07-23 10:11:24 +00:00
const obj = { id : id.id , name : id.name , guildId , permissions : importAll ( 483 ) . deserialize ( id . permissions ) } ;
2026-07-20 16:05:17 +00:00
( { mentionable : obj.mentionable , position : obj.position , color : obj.color } = id ) ;
let int2hexResult = null ;
if ( null != id . color ) {
int2hexResult = null ;
if ( 0 !== id . color ) {
2026-07-23 10:11:24 +00:00
int2hexResult = require ( 665 ) /* pad2 */ . int2hex ( id . color ) ;
const obj3 = require ( 665 ) /* pad2 */ ;
2026-07-20 16:05:17 +00:00
}
}
obj . colorString = int2hexResult ;
const colors = id . colors ;
let tmp5 = null ;
if ( null != colors ) {
tmp5 = colors ;
}
obj . colors = tmp5 ;
let result = null ;
if ( null != id . colors ) {
2026-07-25 08:10:48 +00:00
result = require ( 1914 ) /* extractColorStringsFromServerColors */ . extractColorStringsFromServerColors ( id . colors ) ;
const obj4 = require ( 1914 ) /* extractColorStringsFromServerColors */ ;
2026-07-20 16:05:17 +00:00
}
obj . colorStrings = result ;
( { hoist : obj.hoist , managed } = id ) ;
obj . managed = null != managed && managed ;
let tags = id . tags ;
if ( null == tags ) {
tags = { } ;
}
obj . tags = tags ;
( { icon : obj.icon , unicodeEmoji : obj.unicodeEmoji , flags } = id ) ;
let num4 = 0 ;
if ( null != flags ) {
num4 = flags ;
}
obj . flags = num4 ;
const description = id . description ;
let tmp9 = null ;
if ( null != description ) {
tmp9 = description ;
}
obj . description = tmp9 ;
obj . version = id . version ;
return constructGuildRoleInPlace ( obj ) ;
}
2026-07-23 10:11:24 +00:00
( { constructInPlace : closure_3 , objectIsPlainRecordOfType : closure_4 } = constructInPlace ) ;
let result = require ( "fromHexReverseArray" ) . fileFinishedImporting ( "utils/GuildRoleRecordUtils.tsx" ) ;
2026-07-20 16:05:17 +00:00
export const isGuildRoleRecord = function isGuildRoleRecord ( arg0 ) {
return callback2 ( GuildRoleRecordTypeTag , arg0 ) ;
} ;
export { fromServerArray } ;
export { fromServer } ;
export { constructGuildRoleInPlace } ;
export { fromSerialized } ;
export const fromSyncOperation = function fromSyncOperation ( id , roles , partition ) {
let done ;
let done2 ;
if ( "full_sync" === roles . op ) {
return fromServerArray ( id , roles . items ) ;
} else {
const obj = { } ;
const merged = Object . assign ( partition ) ;
2026-07-23 10:11:24 +00:00
const tmp11 = _createForOfIteratorHelperLoose ( roles . deletes ) ;
let iter2 = tmp11 ( ) ;
2026-07-20 16:05:17 +00:00
if ( ! iter2 . done ) {
do {
let value = iter2 . value ;
2026-07-23 10:11:24 +00:00
delete tmp [ tmp2 ] ;
let iter = tmp11 ( ) ;
2026-07-20 16:05:17 +00:00
iter2 = iter ;
done = iter . done ;
} while ( ! done ) ;
}
2026-07-23 10:11:24 +00:00
const tmp4 = _createForOfIteratorHelperLoose ( roles . writes ) ;
let iter3 = tmp4 ( ) ;
2026-07-20 16:05:17 +00:00
if ( ! iter3 . done ) {
do {
value = iter3 . value ;
2026-07-23 10:11:24 +00:00
let tmp5 = fromServer ;
obj [ value . id ] = fromServer ( id , value ) ;
let iter4 = tmp4 ( ) ;
2026-07-20 16:05:17 +00:00
iter3 = iter4 ;
done2 = iter4 . done ;
} while ( ! done2 ) ;
}
return obj ;
}
} ;
export const fromSerializedPartition = function fromSerializedPartition ( id , roles ) {
const obj = { } ;
for ( const key10006 in arg1 ) {
let tmp = key10006 ;
2026-07-23 10:11:24 +00:00
let tmp2 = fromSerialized ;
obj [ key10006 ] = fromSerialized ( arg0 , arg1 [ key10006 ] ) ;
continue ;
2026-07-20 16:05:17 +00:00
}
return obj ;
} ;
export const toSerializedPartition = function toSerializedPartition ( unsafeMutableRoles ) {
let obj = { } ;
for ( const key10005 in arg0 ) {
let tmp = key10005 ;
let tmp2 = arg0 [ key10005 ] ;
obj = { } ;
let tmp3 = obj ;
let tmp4 = tmp2 ;
let merged = Object . assign ( tmp2 ) ;
let str = tmp2 . permissions ;
obj [ "permissions" ] = str . toString ( ) ;
obj [ key10005 ] = obj ;
2026-07-23 10:11:24 +00:00
continue ;
2026-07-20 16:05:17 +00:00
}
return obj ;
} ;