2026-07-24 07:16:23 +00:00
// Module ID: 8233
// Function ID: 64896
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-24 07:16:23 +00:00
// Dependencies: [57, 31, 1838, 8007, 4566, 653, 6753, 8015, 566, 8017, 1327, 1881, 8012, 8220, 6755, 2]
2026-07-20 16:05:17 +00:00
// Exports: executeQuery, getCachedApplicationSection, getCachedCommand, getCachedResults, getChangeKeys, useAccessibleCommandsForApplication, useCachedResults, useCommand, useDiscovery, useQuery
2026-07-24 07:16:23 +00:00
// Module 8233 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray" ;
import result from "result" ;
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose" ;
import _isNativeReflectConstruct from "_isNativeReflectConstruct" ;
import closure_10 from "_isNativeReflectConstruct" ;
import { BuiltInSectionId } from "TRUE_OPTION_NAME" ;
import { NOOP } from "ME" ;
let closure_6 ;
let closure_7 ;
let closure_8 ;
let closure_9 ;
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 findCommandInSection ( found , commandKey ) {
2026-07-23 10:11:24 +00:00
const _require = commandKey ;
2026-07-20 16:05:17 +00:00
if ( null != commandKey ) {
if ( null != found . commands [ commandKey ] ) {
return found . commands [ commandKey ] ;
} else {
const _Object = Object ;
const values = Object . values ( found . commands ) ;
found = values . find ( ( rootCommand ) = > {
rootCommand = rootCommand . rootCommand ;
let id ;
if ( null != rootCommand ) {
id = rootCommand . id ;
}
2026-07-23 10:11:24 +00:00
return id === closure_0 ;
2026-07-20 16:05:17 +00:00
} ) ;
let rootCommand ;
if ( null != found ) {
rootCommand = found . rootCommand ;
}
let command ;
if ( null != rootCommand ) {
2026-07-23 10:11:24 +00:00
let obj = _require ( 6753 ) ;
2026-07-20 16:05:17 +00:00
obj = { rootCommand , command : rootCommand } ;
const application = found . descriptor . application ;
let id ;
if ( null != application ) {
id = application . id ;
}
let str = "" ;
if ( null != id ) {
str = id ;
}
obj . applicationId = str ;
command = obj . buildCommand ( obj ) ;
}
return command ;
}
}
}
2026-07-23 10:11:24 +00:00
function useCommandsForApplication ( isUserInstalled , arg1 , arg2 ) {
let closure_0 = arg1 ;
let closure_1 = arg2 ;
let tmp = callback3 ( true , true ) ;
2026-07-20 16:05:17 +00:00
const dependencyMap = tmp ;
2026-07-23 10:11:24 +00:00
const tmp2 = callback ( isUserInstalled , true , true ) ;
let _slicedToArray = tmp2 ;
2026-07-20 16:05:17 +00:00
let result ;
if ( null != tmp ) {
result = tmp . result ;
}
const items = [ result , , , ] ;
let result1 ;
if ( null != tmp2 ) {
result1 = tmp2 . result ;
}
items [ 1 ] = result1 ;
items [ 2 ] = arg1 ;
items [ 3 ] = arg2 ;
return React . useMemo ( ( ) = > {
const result = tmp . result ;
2026-07-23 10:11:24 +00:00
tmp = undefined ;
2026-07-20 16:05:17 +00:00
if ( null != result ) {
const sections = result . sections ;
if ( null != sections ) {
2026-07-23 10:11:24 +00:00
tmp = sections [ callback ] ;
2026-07-20 16:05:17 +00:00
}
}
const result2 = tmp2 . result ;
let tmp4 ;
if ( null != result2 ) {
const sections2 = result2 . sections ;
if ( null != sections2 ) {
2026-07-23 10:11:24 +00:00
tmp4 = sections2 [ callback ] ;
2026-07-20 16:05:17 +00:00
}
}
const result3 = tmp . result ;
let tmp7 ;
if ( null != result3 ) {
const sections3 = result3 . sections ;
if ( null != sections3 ) {
2026-07-23 10:11:24 +00:00
tmp7 = sections3 [ callback ] ;
2026-07-20 16:05:17 +00:00
}
}
if ( null == tmp7 ) {
const result4 = tmp2 . result ;
let tmp10 ;
if ( null != result4 ) {
2026-07-23 10:11:24 +00:00
tmp10 = result4 . sections [ callback ] ;
2026-07-20 16:05:17 +00:00
}
tmp7 = tmp10 ;
}
let commands ;
if ( null != tmp7 ) {
commands = tmp7 . commands ;
}
if ( null == commands ) {
commands = { } ;
}
const values = Object . values ( commands ) ;
const mapped = values . map ( ( rootCommand ) = > {
let command = rootCommand ;
if ( null != rootCommand . rootCommand ) {
2026-07-23 10:11:24 +00:00
let obj = dependencyMap ( table [ 6 ] ) ;
2026-07-20 16:05:17 +00:00
obj = { } ;
( { rootCommand : obj2.rootCommand , rootCommand : obj2.command , applicationId : obj2.applicationId } = rootCommand ) ;
command = obj . buildCommand ( obj ) ;
}
return command ;
} ) ;
2026-07-23 10:11:24 +00:00
callback = mapped . reduce ( ( arg0 , id ) = > {
2026-07-20 16:05:17 +00:00
arg0 [ id . id ] = id ;
return arg0 ;
} , { } ) ;
2026-07-23 10:11:24 +00:00
let obj = { } ;
2026-07-20 16:05:17 +00:00
let application ;
if ( null != tmp7 ) {
let descriptor = tmp7 . descriptor ;
if ( null != descriptor ) {
application = descriptor . application ;
}
}
obj . application = application ;
2026-07-23 10:11:24 +00:00
const mapped1 = closure_1 . map ( ( arg0 ) = > dependencyMap [ arg0 ] ) ;
2026-07-20 16:05:17 +00:00
obj . commands = mapped1 . filter ( callback ( tmp [ 10 ] ) . isNotNullish ) ;
descriptor = undefined ;
if ( null != tmp7 ) {
descriptor = tmp7 . descriptor ;
}
obj . sectionDescriptor = descriptor ;
obj . isGuildInstalled = null != tmp4 ;
obj . isUserInstalled = null != tmp ;
return obj ;
} , items ) ;
}
function createPlaceholderCommands ( arg0 , type ) {
const items = [ ] ;
for ( let num = 0 ; num < arg0 ; num = num + 1 ) {
let tmp = createPlaceholderCommand ;
let arr = items . push ( createPlaceholderCommand ( num , type ) ) ;
}
return items ;
}
function createPlaceholderCommand ( arg0 , type ) {
2026-07-23 10:11:24 +00:00
const obj = { type , inputType : require ( 6755 ) /* ApplicationCommandSectionType */ . ApplicationCommandInputType . PLACEHOLDER , id : "placeholder-" + arg0 , untranslatedName : "" , displayName : "" , untranslatedDescription : "" , displayDescription : "" , applicationId : "" } ;
2026-07-20 16:05:17 +00:00
obj . section = obj ;
return obj ;
}
2026-07-23 10:11:24 +00:00
( { useContextIndexState : closure_6 , useDiscoveryState : closure_7 , useQueryState : closure_8 , useUserIndexState : closure_9 } = _isNativeReflectConstruct ) ;
let items = [ require ( "PermissionOverwriteType" ) . ApplicationCommandType . CHAT ] ;
let obj = { id : "placeholder-section" , type : require ( "ApplicationCommandSectionType" ) . ApplicationCommandSectionType . APPLICATION , name : "" } ;
let result = require ( "_createForOfIteratorHelperLoose" ) . fileFinishedImporting ( "modules/application_commands/ApplicationCommandQueryApi.tsx" ) ;
2026-07-20 16:05:17 +00:00
export const getCachedCommand = function getCachedCommand ( arg0 , commandKey ) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg2 ;
2026-07-20 16:05:17 +00:00
if ( null == commandKey ) {
let obj = { application : undefined , command : undefined } ;
return obj ;
} else {
const userState = authStore . getUserState ( ) ;
const result2 = userState . result ;
let sections ;
const contextState = authStore . getContextState ( arg0 ) ;
if ( null != result2 ) {
sections = result2 . sections ;
}
if ( null == sections ) {
sections = { } ;
}
const values = Object . values ( sections ) ;
const result = contextState . result ;
let sections1 ;
if ( null != result ) {
sections1 = result . sections ;
}
if ( null == sections1 ) {
sections1 = { } ;
}
const combined = values . concat ( Object . values ( sections1 ) ) ;
if ( null != arg2 ) {
const found = combined . find ( ( descriptor ) = > {
const application = descriptor . descriptor . application ;
let id ;
if ( null != application ) {
id = application . id ;
}
2026-07-23 10:11:24 +00:00
return id === closure_0 ;
2026-07-20 16:05:17 +00:00
} ) ;
if ( null != found ) {
obj = { application : found.descriptor.application , command : findCommandInSection ( found , commandKey ) } ;
return obj ;
}
} else {
const tmp2 = _createForOfIteratorHelperLoose ( combined ) ;
const iter = tmp2 ( ) ;
let iter2 = iter ;
if ( ! iter . done ) {
const value = iter2 . value ;
const tmp4 = findCommandInSection ( value , commandKey ) ;
while ( null == tmp4 ) {
let iter3 = tmp2 ( ) ;
iter2 = iter3 ;
}
const obj1 = { application : value.descriptor.application , command : tmp4 } ;
return obj1 ;
}
}
const obj2 = { application : undefined , command : undefined } ;
return obj2 ;
}
} ;
export const getCachedApplicationSection = function getCachedApplicationSection ( arg0 , CHAT , applicationId ) {
const userState = authStore . getUserState ( ) ;
const contextState = authStore . getContextState ( arg0 ) ;
const result = userState . result ;
let tmp4 ;
const applicationState = authStore . getApplicationState ( applicationId ) ;
if ( null != result ) {
const sections = result . sections ;
if ( null != sections ) {
tmp4 = sections [ applicationId ] ;
}
}
if ( null == tmp4 ) {
const result2 = contextState . result ;
let tmp5 ;
if ( null != result2 ) {
const sections2 = result2 . sections ;
if ( null != sections2 ) {
tmp5 = sections2 [ applicationId ] ;
}
}
tmp4 = tmp5 ;
}
if ( null == tmp4 ) {
const result3 = applicationState . result ;
let tmp6 ;
if ( null != result3 ) {
const sections3 = result3 . sections ;
if ( null != sections3 ) {
tmp6 = sections3 [ applicationId ] ;
}
}
tmp4 = tmp6 ;
}
let descriptor ;
if ( null != tmp4 ) {
descriptor = tmp4 . descriptor ;
}
return descriptor ;
} ;
export const getCachedResults = function getCachedResults ( arg0 , arg1 , text ) {
let obj = { commandTypes : items , text } ;
2026-07-23 10:11:24 +00:00
items = [ arg1 ] ;
2026-07-24 07:16:23 +00:00
obj = { scoreMethod : require ( 8015 ) /* ScoreMethod */ . ScoreMethod . COMMAND_OR_APPLICATION , allowFetch : false } ;
2026-07-20 16:05:17 +00:00
const query = authStore . query ( arg0 , obj , obj ) ;
obj = { commands : query.commands , sections : query.descriptors } ;
return obj ;
} ;
export const getChangeKeys = function getChangeKeys ( arg0 ) {
const userState = authStore . getUserState ( ) ;
const contextState = authStore . getContextState ( arg0 ) ;
let result ;
if ( null != userState ) {
result = userState . result ;
}
const items = [ result , ] ;
let result1 ;
if ( null != contextState ) {
result1 = contextState . result ;
}
items [ 1 ] = result1 ;
return items ;
} ;
export const useCachedResults = function useCachedResults ( arg0 , CHAT , text ) {
2026-07-23 10:11:24 +00:00
let closure_0 = CHAT ;
let items = [ CHAT ] ;
2026-07-20 16:05:17 +00:00
let obj = {
commandTypes : React.useMemo ( ( ) = > {
2026-07-23 10:11:24 +00:00
const items = [ closure_0 ] ;
2026-07-20 16:05:17 +00:00
return items ;
} , items ) ,
text
} ;
2026-07-23 10:11:24 +00:00
const tmp = callback2 ( arg0 , obj , { allowFetch : false } ) ;
2026-07-20 16:05:17 +00:00
obj = { commands : tmp.commands , sections : tmp.descriptors } ;
return obj ;
} ;
export const useDiscovery = function useDiscovery ( options ) {
let context ;
let filters ;
( { context , filters } = options ) ;
options = options . options ;
2026-07-23 10:11:24 +00:00
let guild_id ;
let descriptors ;
let commands ;
let sectionedCommands ;
2026-07-20 16:05:17 +00:00
let loading ;
let first ;
let closure_8 ;
let memo ;
2026-07-23 10:11:24 +00:00
guild_id = null ;
2026-07-20 16:05:17 +00:00
if ( "channel" === context . type ) {
guild_id = context . channel . guild_id ;
}
2026-07-23 10:11:24 +00:00
let obj = filters ( guild_id [ 8 ] ) ;
let items = [ sectionedCommands ] ;
let items1 = [ guild_id ] ;
2026-07-20 16:05:17 +00:00
const stateFromStores = obj . useStateFromStores ( items , ( ) = > sectionedCommands . getGuild ( guild_id ) , items1 ) ;
obj = { } ;
const merged = Object . assign ( options ) ;
obj [ "allowFetch" ] = options . allowFetch ;
const tmp4 = first ( context , stateFromStores , filters , obj ) ;
2026-07-23 10:11:24 +00:00
descriptors = tmp4 . descriptors ;
commands = tmp4 . commands ;
sectionedCommands = tmp4 . sectionedCommands ;
2026-07-20 16:05:17 +00:00
loading = tmp4 . loading ;
2026-07-23 10:11:24 +00:00
const tmp5 = descriptors ( commands . useState ( null ) , 2 ) ;
2026-07-20 16:05:17 +00:00
first = tmp5 [ 0 ] ;
closure_8 = tmp5 [ 1 ] ;
2026-07-23 10:11:24 +00:00
let items2 = [ filters . commandTypes , options . placeholderCount ] ;
memo = commands . useMemo ( ( ) = > {
2026-07-20 16:05:17 +00:00
const placeholderCount = options . placeholderCount ;
let num = 0 ;
if ( null != placeholderCount ) {
num = placeholderCount ;
}
2026-07-23 10:11:24 +00:00
return outer1_19 ( num , filters . commandTypes [ 0 ] ) ;
2026-07-20 16:05:17 +00:00
} , items2 ) ;
2026-07-23 10:11:24 +00:00
let items3 = [ loading , commands , descriptors , sectionedCommands , first , memo ] ;
return commands . useMemo ( ( ) = > {
2026-07-20 16:05:17 +00:00
let obj = {
loading ,
commands ,
activeSections : descriptors ,
commandsByActiveSection : sectionedCommands ,
filteredSectionId : first ,
hasMoreAfter : false ,
placeholders : loading ? memo : [ ] ,
sectionDescriptors : descriptors ,
filterSection ( id ) {
2026-07-23 10:11:24 +00:00
outer1_8 ( id ) ;
2026-07-20 16:05:17 +00:00
} ,
2026-07-23 10:11:24 +00:00
scrollDown : outer1_12
2026-07-20 16:05:17 +00:00
} ;
if ( null == first ) {
if ( ! loading ) {
return obj ;
} else {
2026-07-23 10:11:24 +00:00
first = sectionedCommands [ 0 ] ;
2026-07-20 16:05:17 +00:00
if ( null != first ) {
obj = { section : first.section } ;
const items = [ ] ;
HermesBuiltin . arraySpread ( memo , HermesBuiltin . arraySpread ( first . data , 0 ) ) ;
obj . data = items ;
const items1 = [ obj ] ;
HermesBuiltin . arraySpread ( sectionedCommands . slice ( 1 ) , 1 ) ;
obj . commandsByActiveSection = items1 ;
} else {
2026-07-23 10:11:24 +00:00
const tmp8 = filters ( guild_id [ 9 ] ) . BUILT_IN_SECTIONS [ outer1_11 . BUILT_IN ] ;
2026-07-20 16:05:17 +00:00
const items2 = [ tmp8 ] ;
obj . activeSections = items2 ;
obj = { section : tmp8 , data : memo } ;
const items3 = [ obj ] ;
obj . commandsByActiveSection = items3 ;
}
first = [ ] ;
HermesBuiltin . arraySpread ( memo , HermesBuiltin . arraySpread ( commands , 0 ) ) ;
obj . commands = first ;
}
} else {
2026-07-23 10:11:24 +00:00
const found = sectionedCommands . find ( ( section ) = > section . section . id === outer1_7 ) ;
2026-07-20 16:05:17 +00:00
if ( null != found ) {
const items4 = [ found . section ] ;
let items5 = items4 ;
} else {
items5 = [ ] ;
}
obj . activeSections = items5 ;
if ( null != found ) {
const items6 = [ found ] ;
let items7 = items6 ;
} else {
items7 = [ ] ;
}
obj . commandsByActiveSection = items7 ;
}
} , items3 ) ;
} ;
export const executeQuery = function executeQuery ( arg0 , arg1 , placeholderCount ) {
let commands ;
let descriptors ;
let loading ;
const query = authStore . query ( arg0 , arg1 , placeholderCount ) ;
( { descriptors , commands , loading } = query ) ;
let num = 0 ;
if ( loading ) {
placeholderCount = placeholderCount . placeholderCount ;
num = 0 ;
if ( null != placeholderCount ) {
num = placeholderCount ;
}
}
const tmp2Result = createPlaceholderCommands ( num , arg1 . commandTypes [ 0 ] ) ;
const obj = { } ;
let tmp5 = commands ;
if ( loading ) {
const items = [ ] ;
HermesBuiltin . arraySpread ( tmp2Result , HermesBuiltin . arraySpread ( commands , 0 ) ) ;
tmp5 = items ;
}
obj . commands = tmp5 ;
let tmp11 = descriptors ;
if ( loading ) {
tmp11 = descriptors ;
if ( 0 === descriptors . length ) {
2026-07-24 07:16:23 +00:00
const items1 = [ require ( 8017 ) /* getOptionValue */ . BUILT_IN_SECTIONS [ BuiltInSectionId . BUILT_IN ] ] ;
2026-07-20 16:05:17 +00:00
tmp11 = items1 ;
}
}
obj . sections = tmp11 ;
return obj ;
} ;
export const useQuery = function useQuery ( arg0 , commandTypes , placeholderCount ) {
2026-07-23 10:11:24 +00:00
let closure_0 = commandTypes ;
let closure_1 = placeholderCount ;
let obj = { } ;
2026-07-20 16:05:17 +00:00
const merged = Object . assign ( placeholderCount ) ;
obj [ "allowFetch" ] = true ;
2026-07-23 10:11:24 +00:00
let tmp2 = callback2 ( arg0 , commandTypes , obj ) ;
2026-07-20 16:05:17 +00:00
const descriptors = tmp2 . descriptors ;
const commands = tmp2 . commands ;
const loading = tmp2 . loading ;
2026-07-23 10:11:24 +00:00
let items = [ commandTypes . commandTypes , placeholderCount . placeholderCount ] ;
const memo = loading . useMemo ( ( ) = > {
placeholderCount = placeholderCount . placeholderCount ;
2026-07-20 16:05:17 +00:00
let num = 0 ;
if ( null != placeholderCount ) {
num = placeholderCount ;
}
2026-07-23 10:11:24 +00:00
return outer1_19 ( num , commandTypes . commandTypes [ 0 ] ) ;
2026-07-20 16:05:17 +00:00
} , items ) ;
2026-07-23 10:11:24 +00:00
let items1 = [ loading , commands , descriptors , memo ] ;
return loading . useMemo ( ( ) = > {
2026-07-20 16:05:17 +00:00
const obj = { } ;
if ( loading ) {
const items = [ ] ;
HermesBuiltin . arraySpread ( memo , HermesBuiltin . arraySpread ( tmp , 0 ) ) ;
let tmp2 = items ;
} else {
tmp2 = tmp ;
}
obj . commands = tmp2 ;
if ( loading ) {
if ( 0 === descriptors . length ) {
2026-07-23 10:11:24 +00:00
const items1 = [ commandTypes ( descriptors [ 9 ] ) . BUILT_IN_SECTIONS [ outer1_11 . BUILT_IN ] ] ;
2026-07-20 16:05:17 +00:00
let tmp9 = items1 ;
}
obj . sections = tmp9 ;
2026-07-23 10:11:24 +00:00
obj . scrollDown = outer1_12 ;
2026-07-20 16:05:17 +00:00
return obj ;
}
tmp9 = descriptors ;
} , items1 ) ;
} ;
export const useCommand = function useCommand ( arg0 , commandId ) {
2026-07-23 10:11:24 +00:00
let closure_0 = commandId ;
const tmp = callback3 ( true , true ) ;
2026-07-20 16:05:17 +00:00
const importAll = tmp ;
2026-07-23 10:11:24 +00:00
const tmp2 = callback ( arg0 , true , true ) ;
2026-07-20 16:05:17 +00:00
const dependencyMap = tmp2 ;
const items = [ tmp2 . result , tmp . result , commandId ] ;
return React . useMemo ( ( ) = > {
2026-07-23 10:11:24 +00:00
if ( null != closure_0 ) {
2026-07-20 16:05:17 +00:00
const result2 = tmp . result ;
let sections ;
if ( null != result2 ) {
sections = result2 . sections ;
}
if ( null == sections ) {
sections = { } ;
}
const values = Object . values ( sections ) ;
const result = tmp2 . result ;
let sections1 ;
if ( null != result ) {
sections1 = result . sections ;
}
if ( null == sections1 ) {
sections1 = { } ;
}
2026-07-23 10:11:24 +00:00
const tmp5Result = outer1_15 ( values . concat ( Object . values ( sections1 ) ) ) ;
2026-07-20 16:05:17 +00:00
const iter = tmp5Result ( ) ;
let iter2 = iter ;
if ( ! iter . done ) {
const value = iter2 . value ;
while ( null == value . commands [ closure_0 ] ) {
let iter3 = tmp5Result ( ) ;
iter2 = iter3 ;
}
const obj = { command : value.commands [ closure_0 ] , application : value.descriptor.application } ;
return obj ;
}
2026-07-23 10:11:24 +00:00
const tmp5 = outer1_15 ;
2026-07-20 16:05:17 +00:00
}
return { command : undefined , application : undefined } ;
} , items ) ;
} ;
export { useCommandsForApplication } ;
export const useAccessibleCommandsForApplication = function useAccessibleCommandsForApplication ( channel , arg1 , arg2 ) {
2026-07-23 10:11:24 +00:00
const _require = channel ;
2026-07-20 16:05:17 +00:00
const items = [ channel ] ;
2026-07-23 10:11:24 +00:00
const tmp = useCommandsForApplication ( isUserInstalled . useMemo ( ( ) = > ( { channel : closure_0 , type : "channel" } ) , items ) , arg1 , arg2 ) ;
2026-07-20 16:05:17 +00:00
const commands = tmp . commands ;
const sectionDescriptor = tmp . sectionDescriptor ;
const isGuildInstalled = tmp . isGuildInstalled ;
2026-07-23 10:11:24 +00:00
isUserInstalled = tmp . isUserInstalled ;
let obj = _require ( sectionDescriptor [ 12 ] ) ;
2026-07-20 16:05:17 +00:00
const permissionContext = obj . usePermissionContext ( channel , items ) ;
obj = {
application : tmp.application ,
2026-07-23 10:11:24 +00:00
commands : isUserInstalled.useMemo ( ( ) = > {
if ( null != allowedForChannel ) {
2026-07-20 16:05:17 +00:00
let allowedForUser = null ;
2026-07-23 10:11:24 +00:00
if ( null != allowedForUser . guild_id ) {
2026-07-20 16:05:17 +00:00
let permissions ;
if ( null != sectionDescriptor ) {
permissions = sectionDescriptor . permissions ;
}
allowedForUser = null ;
if ( null != permissions ) {
2026-07-23 10:11:24 +00:00
let obj = commands ( sectionDescriptor [ 13 ] ) ;
allowedForUser = obj . computeAllowedForUser ( sectionDescriptor . permissions , allowedForUser . guild_id , permissionContext . userId , permissionContext . roleIds , permissionContext . isImpersonating ) ;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
allowedForChannel = null ;
if ( null != allowedForUser . guild_id ) {
2026-07-20 16:05:17 +00:00
let permissions1 ;
if ( null != sectionDescriptor ) {
permissions1 = sectionDescriptor . permissions ;
}
allowedForChannel = null ;
if ( null != permissions1 ) {
2026-07-23 10:11:24 +00:00
allowedForChannel = commands ( sectionDescriptor [ 13 ] ) . computeAllowedForChannel ( sectionDescriptor . permissions , allowedForUser , allowedForUser . guild_id ) ;
2026-07-20 16:05:17 +00:00
const obj2 = commands ( sectionDescriptor [ 13 ] ) ;
}
}
2026-07-23 10:11:24 +00:00
return allowedForChannel . filter ( ( arg0 ) = > {
let obj = commands ( sectionDescriptor [ 13 ] ) ;
obj = { applicationAllowedForUser : allowedForUser , applicationAllowedForChannel : allowedForChannel , isGuildInstalled : outer1_3 , isUserInstalled : outer1_4 } ;
2026-07-20 16:05:17 +00:00
let botId ;
2026-07-23 10:11:24 +00:00
if ( null != outer1_2 ) {
botId = outer1_2 . botId ;
2026-07-20 16:05:17 +00:00
}
obj . commandBotId = botId ;
2026-07-23 10:11:24 +00:00
return obj . hasAccess ( arg0 , outer1_5 , obj ) === allowedForUser ( sectionDescriptor [ 13 ] ) . HasAccessResult . ALLOWED ;
2026-07-20 16:05:17 +00:00
} ) ;
}
} , items1 )
} ;
2026-07-23 10:11:24 +00:00
items1 = [ commands , permissionContext , sectionDescriptor , isGuildInstalled , isUserInstalled , channel ] ;
2026-07-20 16:05:17 +00:00
return obj ;
} ;