2026-10-03 08:58:59 +00:00
// Module ID: 12550
// Function ID: 12551
2026-09-10 05:38:07 +00:00
// Name: RouteManagerUtils
2026-10-03 08:58:59 +00:00
// Dependencies: [109, 9050, 2055, 2051, 4703, 4507, 2103, 1085, 9051, 3, 4717, 12551, 5568, 1112, 12556, 5093, 5097, 5705, 4736, 584, 5091, 4787, 12557, 2]
2026-07-29 08:29:29 +00:00
// Exports: cleanupRouteManager, extractParamsFromVoiceModalRoute, initializeRouteManagerIfNeeded, popVoiceRoute, transitionToVoiceRoute
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
// Module 12550 (RouteManagerUtils)
2026-09-10 05:38:07 +00:00
import LoggerDefault from "Logger" /* 3 */ ;
2026-10-03 08:58:59 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */ ;
import router_utils from "router_utils" /* 1112 */ ;
import ChannelRecord from "ChannelRecord" /* 2055 */ ;
import RouteUtils from "RouteUtils" /* 4717 */ ;
import flow_Client from "flow/Client" /* 4787 */ ;
import ChannelRTCActionCreatorsDefault from "ChannelRTCActionCreators" /* 5091 */ ;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 5093 */ ;
import PrivateChannelCallUtils from "PrivateChannelCallUtils" /* 5097 */ ;
import SelectedChannelActionCreatorsDefault from "SelectedChannelActionCreators" /* 5568 */ ;
import GuildActionCreatorsDefault from "GuildActionCreators" /* 5705 */ ;
import ChannelCallStore from "ChannelCallStore" /* 9050 */ ;
import ChannelCallConstants from "ChannelCallConstants" /* 9051 */ ;
import _mod12551 from "module_12551" /* 12551 */ ;
import DefaultRouteActionCreators from "DefaultRouteActionCreators" /* 12556 */ ;
import RouteManagerDefault from "RouteManager" /* 12557 */ ;
2026-09-10 05:38:07 +00:00
import _objectWithoutProperties from "_objectWithoutProperties" /* 109 */ ;
2026-10-03 08:58:59 +00:00
import ChannelStore from "ChannelStore" /* 2051 */ ;
import DefaultRouteStore from "DefaultRouteStore" /* 4703 */ ;
import GuildChannelStore from "GuildChannelStore" /* 4507 */ ;
import SelectedChannelStore from "SelectedChannelStore" /* 2103 */ ;
import Constants from "Constants" /* 1085 */ ;
import size from "module_2" /* 2 */ ;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let Routes ;
let unpackModuleId ;
2026-09-10 05:38:07 +00:00
function voiceRouteRewriter ( location ) {
2026-10-03 08:58:59 +00:00
let channelId ;
let obj2 ;
let obj3 ;
let pathname ;
let state ;
const obj = { match : obj2.matchPath ( pathname , obj3 ) , location } ;
2026-09-10 05:38:07 +00:00
( { state , pathname } = location ) ;
2026-10-03 08:58:59 +00:00
obj2 = _mod12551 ;
obj3 = { path : items , strict : false , exact : false } ;
2026-07-20 16:05:17 +00:00
const tmp = extractParams ( obj ) ;
( { channelId , guildId } = tmp ) ;
2026-09-10 05:38:07 +00:00
const tmp2 = _objectWithoutProperties ( tmp , closure_3 ) ;
const channel = ChannelStore . getChannel ( channelId ) ;
2026-07-20 16:05:17 +00:00
let tmp4 = null ;
if ( null != channelId ) {
tmp4 = null ;
if ( null != guildId ) {
let type ;
2026-07-29 08:29:29 +00:00
if ( channel != null ) {
2026-07-20 16:05:17 +00:00
type = channel . type ;
}
if ( type === ChannelTypes . GUILD_VOICE ) {
2026-10-03 08:58:59 +00:00
const obj4 = { channelId , guildId } ;
2026-07-20 16:05:17 +00:00
const merged = Object . assign ( tmp2 ) ;
2026-09-10 05:38:07 +00:00
tmp4 = obj4 ;
2026-07-20 16:05:17 +00:00
} else {
let type1 ;
2026-07-29 08:29:29 +00:00
if ( channel != null ) {
2026-07-20 16:05:17 +00:00
type1 = channel . type ;
}
tmp4 = null ;
}
}
}
if ( null != tmp4 ) {
2026-10-03 08:58:59 +00:00
if ( logger != null ) {
2026-07-20 16:05:17 +00:00
const _JSON = JSON ;
const _HermesInternal = HermesInternal ;
2026-10-03 08:58:59 +00:00
logger . log ( "voiceRouteRewriter: has voiceChannelParams = " + JSON . stringify ( tmp4 ) ) ;
2026-07-20 16:05:17 +00:00
}
const _HermesInternal2 = HermesInternal ;
2026-09-10 05:38:07 +00:00
const combined = "" + DefaultRouteStore . lastNonVoiceRoute + Routes . VOICE_CHAT_CHANNEL_PARTIAL ( tmp4 . guildId , tmp4 . channelId , tmp4 . messageId ) ;
2026-07-29 08:29:29 +00:00
let tmp17 = null ;
2026-09-10 05:38:07 +00:00
if ( combined !== location . pathname ) {
2026-10-03 08:58:59 +00:00
if ( logger != null ) {
2026-07-20 16:05:17 +00:00
const _HermesInternal3 = HermesInternal ;
2026-10-03 08:58:59 +00:00
logger . log ( "voiceRouteRewriter: rewriting route: " + location . pathname + " -> " + combined ) ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp17 = { path : combined , state } ;
2026-09-10 05:38:07 +00:00
const obj6 = { path : combined , state } ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp17 ;
2026-07-20 16:05:17 +00:00
} else {
return null ;
}
}
function saveLastRouteListener ( pathname ) {
2026-10-03 08:58:59 +00:00
const obj = DefaultRouteActionCreators ;
obj . saveLastRoute ( pathname . pathname ) ;
2026-07-20 16:05:17 +00:00
}
function saveLastNonVoiceRouteListener ( pathname ) {
2026-10-03 08:58:59 +00:00
pathname = pathname . pathname ;
const obj = _mod12551 ;
const obj2 = { path : items , strict : false , exact : false } ;
const matchPathResult = obj . matchPath ( pathname , obj2 ) ;
2026-07-20 16:05:17 +00:00
let channelId ;
2026-10-03 08:58:59 +00:00
const getChannel = ChannelStore . getChannel ;
2026-07-29 08:29:29 +00:00
if ( matchPathResult != null ) {
channelId = matchPathResult . params . channelId ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const channel = getChannel ( channelId ) ;
2026-07-20 16:05:17 +00:00
let type ;
2026-07-29 08:29:29 +00:00
if ( channel != null ) {
2026-07-20 16:05:17 +00:00
type = channel . type ;
}
2026-07-29 08:29:29 +00:00
let tmp9 = null ;
2026-07-20 16:05:17 +00:00
if ( type !== ChannelTypes . GUILD_VOICE ) {
let type1 ;
2026-07-29 08:29:29 +00:00
if ( channel != null ) {
2026-07-20 16:05:17 +00:00
type1 = channel . type ;
}
2026-07-29 08:29:29 +00:00
tmp9 = null ;
if ( type1 !== tmp8 . GUILD_STAGE_VOICE ) {
2026-09-10 05:38:07 +00:00
const obj3 = { match : matchPathResult , location : pathname } ;
tmp9 = extractParams ( obj3 ) ;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if ( null != tmp9 ) {
2026-09-10 05:38:07 +00:00
const tmpResult = DefaultRouteActionCreators ;
2026-10-03 08:58:59 +00:00
const result = tmpResult . saveLastNonVoiceRoute ( Routes . CHANNEL ( tmp9 . guildId , tmp9 . channelId ) ) ;
2026-07-20 16:05:17 +00:00
}
}
function updateSelectedChannelListener ( location ) {
2026-10-03 08:58:59 +00:00
let channel2 ;
let channelId ;
let jumpType ;
let messageId ;
let tmp51 ;
let voiceChannelId ;
let voiceChannelId2 ;
let voiceGuildId ;
let voiceGuildId2 ;
let voiceMessageId ;
let voiceMessageId2 ;
const pathname = location . pathname ;
let obj = channel2 ( 12551 ) ;
const obj2 = { path : items , strict : false , exact : false } ;
const matchPathResult = obj . matchPath ( pathname , obj2 ) ;
2026-07-29 08:29:29 +00:00
let params ;
if ( matchPathResult != null ) {
params = matchPathResult . params ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( params == null ) {
params = { } ;
}
2026-10-03 08:58:59 +00:00
const obj3 = { voiceChannelId , voiceGuildId , voiceMessageId } ;
const obj4 = { match : matchPathResult , location } ;
2026-07-29 08:29:29 +00:00
( { voiceChannelId , voiceGuildId , voiceMessageId } = params ) ;
2026-10-03 08:58:59 +00:00
const merged = Object . assign ( extractParams ( obj4 ) ) ;
2026-09-10 05:38:07 +00:00
( { guildId , channelId , messageId , jumpType , voiceChannelId : voiceChannelId2 , voiceGuildId : voiceGuildId2 , voiceMessageId : voiceMessageId2 } = obj3 ) ;
2026-07-29 08:29:29 +00:00
if ( null == voiceChannelId2 ) {
if ( null == voiceGuildId2 ) {
2026-10-03 08:58:59 +00:00
const tmp40 = closure_15 ;
2026-07-29 08:29:29 +00:00
if ( closure_15 != null ) {
2026-07-20 16:05:17 +00:00
const _JSON5 = JSON ;
2026-10-03 08:58:59 +00:00
const verbose2 = tmp40 . verbose ;
2026-07-20 16:05:17 +00:00
const json = JSON . stringify ( location ) ;
const _JSON6 = JSON ;
const _HermesInternal3 = HermesInternal ;
2026-10-03 08:58:59 +00:00
const obj5 = { guildId , channelId , messageId , jumpType , voiceChannelId : voiceChannelId2 , voiceGuildId : voiceGuildId2 , voiceMessageId : voiceMessageId2 } ;
verbose2 ( "UpdateSelectedChannelListener -> no voice route present in " + json + " " + JSON . stringify ( obj5 ) + " " ) ;
2026-07-20 16:05:17 +00:00
}
2026-09-10 05:38:07 +00:00
const channel = ChannelStore . getChannel ( SelectedChannelStore . getLastSelectedChannelId ( ) ) ;
2026-07-29 08:29:29 +00:00
let isGuildVoiceResult ;
if ( channel != null ) {
isGuildVoiceResult = channel . isGuildVoice ( ) ;
}
if ( ! isGuildVoiceResult ) {
let isGuildStageVoiceResult ;
if ( channel != null ) {
isGuildStageVoiceResult = channel . isGuildStageVoice ( ) ;
}
isGuildVoiceResult = isGuildStageVoiceResult ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( isGuildVoiceResult ) {
2026-10-03 08:58:59 +00:00
const popWithKey = ModalActionCreatorsDefault . popWithKey ;
ModalActionCreatorsDefault ;
const tmpResult = channel2 ( 5097 ) ;
popWithKey ( tmpResult . getVoiceChannelKey ( channel . id ) ) ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const obj18 = GuildActionCreatorsDefault ;
const guild = obj18 . selectGuild ( guildId ) ;
const obj6 = { guildId , channelId , messageId , jumpType , skipMessageFetch : tmp5 , opensChannel : tmp51 } ;
tmp51 = null != channelId ;
const selectChannel = SelectedChannelActionCreatorsDefault . selectChannel ;
SelectedChannelActionCreatorsDefault ;
if ( tmp51 ) {
tmp51 = true !== location . navigationReplace || true === location . openChannel ;
2026-09-03 10:05:34 +00:00
}
2026-10-03 08:58:59 +00:00
const channel1 = selectChannel ( obj6 ) ;
2026-07-20 16:05:17 +00:00
}
}
2026-09-10 05:38:07 +00:00
channel2 = ChannelStore . getChannel ( voiceChannelId2 ) ;
2026-07-20 16:05:17 +00:00
let type ;
2026-07-29 08:29:29 +00:00
if ( channel2 != null ) {
2026-07-20 16:05:17 +00:00
type = channel2 . type ;
}
if ( type !== ChannelTypes . GUILD_VOICE ) {
let type1 ;
2026-07-29 08:29:29 +00:00
if ( channel2 != null ) {
2026-07-20 16:05:17 +00:00
type1 = channel2 . type ;
}
2026-07-29 08:29:29 +00:00
if ( type1 !== tmp7 . GUILD_STAGE_VOICE ) {
2026-10-03 08:58:59 +00:00
const tmp54 = closure_15 ;
2026-07-29 08:29:29 +00:00
if ( closure_15 != null ) {
2026-07-20 16:05:17 +00:00
let id ;
2026-10-03 08:58:59 +00:00
const log = tmp54 . log ;
2026-07-29 08:29:29 +00:00
if ( channel2 != null ) {
2026-07-20 16:05:17 +00:00
id = channel2 . id ;
}
const _JSON = JSON ;
const _JSON2 = JSON ;
2026-09-10 05:38:07 +00:00
const obj7 = { guildId , channelId , messageId , jumpType , voiceChannelId : voiceChannelId2 , voiceGuildId : voiceGuildId2 , voiceMessageId : voiceMessageId2 } ;
2026-07-20 16:05:17 +00:00
const json1 = JSON . stringify ( location ) ;
const _HermesInternal = HermesInternal ;
2026-10-03 08:58:59 +00:00
log ( "UpdateSelectedChannelListener -> !!!VERY BAD!!! channel.id " + id + " (voiceChannelId " + voiceChannelId2 + ") is not a voice channel! and yet RouteUtils thinks it is! " + json1 + " " + JSON . stringify ( obj7 ) + " " ) ;
2026-07-20 16:05:17 +00:00
}
}
}
2026-10-03 08:58:59 +00:00
const tmp15 = closure_15 ;
2026-07-29 08:29:29 +00:00
if ( closure_15 != null ) {
2026-07-20 16:05:17 +00:00
const _JSON3 = JSON ;
2026-10-03 08:58:59 +00:00
const verbose = tmp15 . verbose ;
2026-07-20 16:05:17 +00:00
const json2 = JSON . stringify ( location ) ;
const _JSON4 = JSON ;
const _HermesInternal2 = HermesInternal ;
2026-10-03 08:58:59 +00:00
const obj10 = { guildId , channelId , messageId , jumpType , voiceChannelId : voiceChannelId2 , voiceGuildId : voiceGuildId2 , voiceMessageId : voiceMessageId2 } ;
verbose ( "UpdateSelectedChannelListener -> voice route present! " + json2 + " " + JSON . stringify ( obj10 ) + " " ) ;
2026-09-19 06:52:51 +00:00
}
2026-10-03 08:58:59 +00:00
const isGuildStageVoiceResult1 = channel2 . isGuildStageVoice ( ) && SelectedChannelStore . getVoiceChannelId ( ) === channel2 . id ;
2026-09-19 06:52:51 +00:00
if ( isGuildStageVoiceResult1 ) {
2026-10-03 08:58:59 +00:00
const obj8 = GuildActionCreatorsDefault ;
const guild1 = obj8 . selectGuild ( voiceGuildId2 ) ;
const obj11 = { guildId : voiceGuildId2 , channelId : voiceChannelId2 , messageId : voiceMessageId2 , jumpType } ;
const obj9 = SelectedChannelActionCreatorsDefault ;
const channel3 = obj9 . selectChannel ( obj11 ) ;
2026-09-10 05:38:07 +00:00
}
2026-10-03 08:58:59 +00:00
const isModalOpen = channel2 ( 4736 ) . isModalOpen ;
channel2 ( 4736 ) ;
const tmpResult5 = channel2 ( 5097 ) ;
if ( ! isModalOpen ( tmpResult5 . getVoiceChannelKey ( channel2 . id ) ) ) {
const popAboveKey = ModalActionCreatorsDefault . popAboveKey ;
ModalActionCreatorsDefault ;
const tmpResult6 = channel2 ( 5097 ) ;
popAboveKey ( tmpResult6 . getVoiceChannelKey ( channel2 . id ) ) ;
const obj13 = DispatcherDefault ;
obj13 . wait ( ( ) = > {
const obj = PrivateChannelCallUtils ;
obj . openGuildVoiceModal ( channel2 ) ;
2026-07-20 16:05:17 +00:00
} ) ;
}
2026-10-03 08:58:59 +00:00
const tmp26 = channel2 . isGuildVoice ( ) && null != voiceMessageId2 || channel2 . isGuildStageVoice ( ) ;
if ( tmp26 ) {
2026-09-19 06:52:51 +00:00
if ( isGuildStageVoiceResult1 ) {
setVoiceChatDrawerState ( channel2 . id , VoiceChatDrawerState . OPEN ) ;
} else {
2026-10-03 08:58:59 +00:00
const obj14 = DispatcherDefault ;
obj14 . wait ( ( ) = > {
const obj = ChannelRTCActionCreatorsDefault ;
return obj . updateChatOpen ( channel2 . id , true ) ;
} ) ;
2026-09-19 06:52:51 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp32 = null != voiceGuildId2 && null != voiceChannelId2 && null != voiceMessageId2 ;
if ( tmp32 ) {
const obj15 = ChannelRTCActionCreatorsDefault ;
const result = obj15 . jumpToVoiceChannelMessage ( voiceGuildId2 , voiceChannelId2 , voiceMessageId2 , jumpType ) ;
2026-07-20 16:05:17 +00:00
}
}
}
function extractParams ( arg0 ) {
2026-10-03 08:58:59 +00:00
let _location ;
let channelId ;
let match ;
let tmp ;
2026-07-20 16:05:17 +00:00
( { match , location : _location } = arg0 ) ;
if ( null == match ) {
2026-10-03 08:58:59 +00:00
const obj = { guildId : unpackModuleId , channelId : null , messageId : null , jumpType : flow_Client.JumpType.ANIMATED , skipMessageFetch : false } ;
2026-07-20 16:05:17 +00:00
return obj ;
} else {
2026-10-03 08:58:59 +00:00
let ANIMATED ;
2026-07-20 16:05:17 +00:00
const params = match . params ;
( { guildId , channelId } = params ) ;
2026-10-03 08:58:59 +00:00
const messageId = params . messageId ;
if ( _location . jumpType === flow_Client . JumpType . INSTANT ) {
ANIMATED = tmp5 ( 4787 ) . JumpType . INSTANT ;
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
ANIMATED = tmp5 ( 4787 ) . JumpType . ANIMATED ;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
RouteUtils ;
const obj2 = { guildId : unpackModuleId , channelId : tmp , messageId , jumpType : ANIMATED , skipMessageFetch : _location.skipMessageFetch } ;
tmp = null ;
const tmp5Result2 = RouteUtils ;
2026-09-10 05:38:07 +00:00
if ( tmp5Result2 . isValidChannelId ( channelId ) ) {
2026-07-29 08:29:29 +00:00
tmp = channelId ;
2026-07-20 16:05:17 +00:00
}
2026-09-10 05:38:07 +00:00
return obj2 ;
2026-07-20 16:05:17 +00:00
}
}
function logRouteChange ( pathname ) {
2026-08-24 06:08:38 +00:00
logger . log ( "Navigated to: " + pathname . pathname ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let closure_3 = [ "channelId" , "guildId" ] ;
2026-10-03 08:58:59 +00:00
const setVoiceChatDrawerState = ChannelCallStore . setVoiceChatDrawerState ;
let closure_6 = ChannelRecord . isGuildSelectableChannelType ;
( { ME : unpackModuleId , Routes } = Constants ) ;
2026-09-10 05:38:07 +00:00
const ChannelTypes = Constants . ChannelTypes ;
2026-10-03 08:58:59 +00:00
const VoiceChatDrawerState = ChannelCallConstants . VoiceChatDrawerState ;
2026-09-10 05:38:07 +00:00
const tmp3 = new LoggerDefault ( "RouteUtils" ) ;
2026-10-03 08:58:59 +00:00
const logger = tmp3 ;
let c16 = false ;
const CHANNEL = Routes . CHANNEL ;
const RouteParam = RouteUtils . RouteParam ;
2026-07-20 16:05:17 +00:00
const guildIdResult = RouteParam . guildId ( ) ;
2026-10-03 08:58:59 +00:00
const RouteParam2 = RouteUtils . RouteParam ;
const CHANNELResult = CHANNEL ( guildIdResult , RouteParam2 . channelId ( { optional : true } ) , ":messageId?" ) ;
const VOICE_CHAT_CHANNEL_PARTIAL = Routes . VOICE_CHAT_CHANNEL_PARTIAL ;
const RouteParam3 = RouteUtils . RouteParam ;
const guildIdResult1 = RouteParam3 . guildId ( { name : "voiceGuildId" } ) ;
const RouteParam4 = RouteUtils . RouteParam ;
const items = [ "" + CHANNELResult + VOICE_CHAT_CHANNEL_PARTIAL ( guildIdResult1 , RouteParam4 . channelId ( { name : "voiceChannelId" } ) , ":voiceMessageId?" ) , CHANNELResult ] ;
2026-09-10 05:38:07 +00:00
let result = size . fileFinishedImporting ( "modules/routing/native/RouteManagerUtils.tsx" ) ;
2026-07-20 16:05:17 +00:00
export const MAIN_DRAWER_ROUTES = CHANNELResult ;
2026-07-29 08:29:29 +00:00
export const extractParamsFromVoiceModalRoute = function extractParamsFromVoiceModalRoute ( location ) {
2026-10-03 08:58:59 +00:00
let voiceChannelId ;
let voiceGuildId ;
let voiceMessageId ;
const pathname = location . pathname ;
const obj = _mod12551 ;
const obj2 = { path : items , strict : false , exact : false } ;
const matchPathResult = obj . matchPath ( pathname , obj2 ) ;
2026-07-29 08:29:29 +00:00
let params ;
if ( matchPathResult != null ) {
params = matchPathResult . params ;
}
if ( params == null ) {
params = { } ;
}
2026-10-03 08:58:59 +00:00
const obj3 = { voiceChannelId , voiceGuildId , voiceMessageId } ;
const obj4 = { match : matchPathResult , location } ;
2026-07-29 08:29:29 +00:00
( { voiceChannelId , voiceGuildId , voiceMessageId } = params ) ;
2026-10-03 08:58:59 +00:00
const merged = Object . assign ( extractParams ( obj4 ) ) ;
2026-09-10 05:38:07 +00:00
return obj3 ;
2026-07-29 08:29:29 +00:00
} ;
2026-07-20 16:05:17 +00:00
export const popVoiceRoute = function popVoiceRoute ( guildId ) {
2026-10-03 08:58:59 +00:00
let id ;
2026-09-10 05:38:07 +00:00
const lastNonVoiceRoute = DefaultRouteStore . lastNonVoiceRoute ;
2026-08-24 06:08:38 +00:00
logger . log ( "popVoiceRoute: last non-voice route is " + lastNonVoiceRoute ) ;
2026-10-03 08:58:59 +00:00
const obj = { guildId , channelId : null } ;
const selectChannel = SelectedChannelActionCreatorsDefault . selectChannel ;
SelectedChannelActionCreatorsDefault ;
2026-09-10 05:38:07 +00:00
const channel = ChannelStore . getChannel ( SelectedChannelStore . getLastSelectedChannelId ( ) ) ;
2026-07-29 08:29:29 +00:00
let type ;
2026-10-03 08:58:59 +00:00
const obj2 = SelectedChannelStore ;
2026-07-29 08:29:29 +00:00
if ( channel != null ) {
type = channel . type ;
}
if ( null != type ) {
let type1 ;
2026-10-03 08:58:59 +00:00
const tmp6 = closure_6 ;
2026-07-29 08:29:29 +00:00
if ( channel != null ) {
type1 = channel . type ;
}
2026-10-03 08:58:59 +00:00
if ( tmp6 ( type1 ) ) {
id = channel . id ;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
obj . channelId = id ;
const channel1 = selectChannel ( obj ) ;
const obj3 = router_utils ;
obj3 . transitionTo ( lastNonVoiceRoute ) ;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
id = obj2 . getMostRecentSelectedTextChannelId ( guildId ) ;
2026-07-29 08:29:29 +00:00
if ( id == null ) {
2026-09-10 05:38:07 +00:00
const defaultChannel = GuildChannelStore . getDefaultChannel ( guildId ) ;
let id1 ;
2026-07-29 08:29:29 +00:00
if ( defaultChannel != null ) {
2026-09-10 05:38:07 +00:00
id1 = defaultChannel . id ;
2026-07-29 08:29:29 +00:00
}
2026-09-10 05:38:07 +00:00
id = id1 ;
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
} ;
export const transitionToVoiceRoute = function transitionToVoiceRoute ( arg0 , arg1 ) {
2026-09-10 05:38:07 +00:00
const defaultRoute = DefaultRouteStore . defaultRoute ;
2026-10-03 08:58:59 +00:00
const obj = _mod12551 ;
const obj2 = { path : items , strict : false , exact : false } ;
const matchPathResult = obj . matchPath ( defaultRoute , obj2 ) ;
2026-07-20 16:05:17 +00:00
let params ;
2026-07-29 08:29:29 +00:00
if ( matchPathResult != null ) {
params = matchPathResult . params ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( params == null ) {
2026-07-20 16:05:17 +00:00
params = { } ;
}
const voiceChannelId = params . voiceChannelId ;
2026-08-24 06:08:38 +00:00
logger . log ( "transitionToVoiceRoute(<" + arg0 + ">, <" + arg1 + ">), current route " + defaultRoute + " has voiceChannelId " + voiceChannelId ) ;
2026-10-03 08:58:59 +00:00
const obj4 = logger ;
2026-07-20 16:05:17 +00:00
if ( voiceChannelId !== arg1 ) {
2026-09-10 05:38:07 +00:00
const tmpResult = router_utils ;
2026-10-03 08:58:59 +00:00
tmpResult . transitionToGuild ( arg0 , arg1 ) ;
2026-07-20 16:05:17 +00:00
} else {
const _HermesInternal = HermesInternal ;
2026-10-03 08:58:59 +00:00
obj4 . log ( "transitionToVoiceRoute -> " + voiceChannelId + " === " + arg1 + ". staying where we are" ) ;
2026-07-20 16:05:17 +00:00
}
} ;
export { voiceRouteRewriter } ;
export { saveLastRouteListener } ;
export { saveLastNonVoiceRouteListener } ;
export { updateSelectedChannelListener } ;
export { extractParams } ;
export const initializeRouteManagerIfNeeded = function initializeRouteManagerIfNeeded() {
2026-10-03 08:58:59 +00:00
const tmp = c16 ;
if ( ! tmp ) {
const obj = RouteManagerDefault ;
obj . addRouteRewriter ( voiceRouteRewriter ) ;
const obj2 = RouteManagerDefault ;
const result = obj2 . addRouteChangeListener ( saveLastRouteListener ) ;
const obj3 = RouteManagerDefault ;
const result1 = obj3 . addRouteChangeListener ( saveLastNonVoiceRouteListener ) ;
const obj4 = RouteManagerDefault ;
const result2 = obj4 . addRouteChangeListener ( updateSelectedChannelListener ) ;
const obj5 = RouteManagerDefault ;
const result3 = obj5 . addRouteChangeListener ( logRouteChange ) ;
const obj6 = RouteManagerDefault ;
obj6 . initialize ( ) ;
2026-07-23 10:11:24 +00:00
c16 = true ;
2026-07-20 16:05:17 +00:00
}
} ;
export const cleanupRouteManager = function cleanupRouteManager() {
2026-10-03 08:58:59 +00:00
const tmp = c16 ;
if ( tmp ) {
const obj = RouteManagerDefault ;
obj . removeRouteRewriter ( voiceRouteRewriter ) ;
const obj2 = RouteManagerDefault ;
const result = obj2 . removeRouteChangeListener ( saveLastRouteListener ) ;
const obj3 = RouteManagerDefault ;
const result1 = obj3 . removeRouteChangeListener ( saveLastNonVoiceRouteListener ) ;
const obj4 = RouteManagerDefault ;
const result2 = obj4 . removeRouteChangeListener ( updateSelectedChannelListener ) ;
const obj5 = RouteManagerDefault ;
const result3 = obj5 . removeRouteChangeListener ( logRouteChange ) ;
const obj6 = RouteManagerDefault ;
obj6 . cleanup ( ) ;
2026-07-23 10:11:24 +00:00
c16 = false ;
2026-07-20 16:05:17 +00:00
}
} ;