2026-10-01 06:55:13 +00:00
// Module ID: 12510
// Function ID: 12511
2026-09-10 05:38:07 +00:00
// Name: RouteManagerUtils
2026-10-01 06:55:13 +00:00
// Dependencies: [109, 9022, 2048, 2044, 4688, 4496, 2098, 1074, 9023, 3, 4702, 12511, 5909, 1101, 12516, 5048, 5052, 6018, 4721, 573, 5046, 4772, 12517, 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-01 06:55:13 +00:00
// Module 12510 (RouteManagerUtils)
2026-09-10 05:38:07 +00:00
import LoggerDefault from "Logger" /* 3 */ ;
import DispatcherDefault from "Dispatcher" /* 573 */ ;
2026-09-15 14:23:42 +00:00
import router_utils from "router_utils" /* 1101 */ ;
2026-10-01 06:55:13 +00:00
import RouteUtils from "RouteUtils" /* 4702 */ ;
import Client from "Client" /* 4772 */ ;
import ChannelRTCActionCreatorsDefault from "ChannelRTCActionCreators" /* 5046 */ ;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 5048 */ ;
import PrivateChannelCallUtils from "PrivateChannelCallUtils" /* 5052 */ ;
import SelectedChannelActionCreatorsDefault from "SelectedChannelActionCreators" /* 5909 */ ;
import GuildActionCreatorsDefault from "GuildActionCreators" /* 6018 */ ;
import MemoryRouter from "MemoryRouter" /* 12511 */ ;
import DefaultRouteActionCreators from "DefaultRouteActionCreators" /* 12516 */ ;
import RouteManagerDefault from "RouteManager" /* 12517 */ ;
2026-09-10 05:38:07 +00:00
import _objectWithoutProperties from "_objectWithoutProperties" /* 109 */ ;
2026-10-01 06:55:13 +00:00
import ChannelStore from "ChannelStore" /* 2044 */ ;
import DefaultRouteStore from "DefaultRouteStore" /* 4688 */ ;
import GuildChannelStore from "GuildChannelStore" /* 4496 */ ;
import SelectedChannelStore from "SelectedChannelStore" /* 2098 */ ;
2026-07-23 10:11:24 +00:00
2026-09-10 05:38:07 +00:00
require = fn ;
function voiceRouteRewriter ( location ) {
const obj = { match : MemoryRouter.matchPath ( pathname , { path : items , strict : false , exact : false } ) , location } ;
( { state , pathname } = location ) ;
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-09-10 05:38:07 +00:00
const obj4 = { } ;
2026-07-20 16:05:17 +00:00
const merged = Object . assign ( tmp2 ) ;
2026-09-10 05:38:07 +00:00
obj4 . channelId = channelId ;
obj4 . guildId = guildId ;
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-07-29 08:29:29 +00:00
if ( closure_15 != null ) {
2026-07-20 16:05:17 +00:00
const _JSON = JSON ;
const _HermesInternal = HermesInternal ;
2026-07-29 08:29:29 +00:00
obj5 . 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-07-29 08:29:29 +00:00
if ( obj5 != null ) {
2026-07-20 16:05:17 +00:00
const _HermesInternal3 = HermesInternal ;
2026-09-10 05:38:07 +00:00
obj5 . log ( "voiceRouteRewriter: rewriting route: " + location . pathname + " -> " + combined ) ;
2026-07-20 16:05:17 +00:00
}
2026-09-10 05:38:07 +00:00
const obj6 = { path : combined , state } ;
tmp17 = obj6 ;
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 ;
}
2026-09-10 05:38:07 +00:00
const obj3 = { path : items , strict : false , exact : false } ;
2026-07-20 16:05:17 +00:00
}
function saveLastRouteListener ( pathname ) {
2026-09-10 05:38:07 +00:00
DefaultRouteActionCreators . saveLastRoute ( pathname . pathname ) ;
2026-07-20 16:05:17 +00:00
}
function saveLastNonVoiceRouteListener ( pathname ) {
2026-09-10 05:38:07 +00:00
const matchPathResult = MemoryRouter . matchPath ( pathname . pathname , { path : items , strict : false , exact : false } ) ;
2026-07-20 16:05:17 +00:00
let channelId ;
2026-07-29 08:29:29 +00:00
if ( matchPathResult != null ) {
channelId = matchPathResult . params . channelId ;
2026-07-20 16:05:17 +00:00
}
2026-09-10 05:38:07 +00:00
const channel = ChannelStore . 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 result = DefaultRouteActionCreators . saveLastNonVoiceRoute ( Routes . CHANNEL ( tmp9 . guildId , tmp9 . channelId ) ) ;
const tmpResult = DefaultRouteActionCreators ;
2026-07-20 16:05:17 +00:00
}
}
function updateSelectedChannelListener ( location ) {
2026-10-01 06:55:13 +00:00
const matchPathResult = channel2 ( 12511 ) . matchPath ( location . pathname , { path : items , strict : false , exact : false } ) ;
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-09-10 05:38:07 +00:00
const obj3 = { } ;
2026-07-29 08:29:29 +00:00
( { voiceChannelId , voiceGuildId , voiceMessageId } = params ) ;
const merged = Object . assign ( extractParams ( { match : matchPathResult , location } ) ) ;
2026-09-10 05:38:07 +00:00
obj3 . voiceChannelId = voiceChannelId ;
obj3 . voiceGuildId = voiceGuildId ;
obj3 . voiceMessageId = voiceMessageId ;
( { 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 ) {
if ( closure_15 != null ) {
2026-07-20 16:05:17 +00:00
const _JSON5 = JSON ;
const json = JSON . stringify ( location ) ;
const _JSON6 = JSON ;
2026-09-10 05:38:07 +00:00
const obj5 = { guildId , channelId , messageId , jumpType , voiceChannelId : voiceChannelId2 , voiceGuildId : voiceGuildId2 , voiceMessageId : voiceMessageId2 } ;
2026-07-20 16:05:17 +00:00
const _HermesInternal3 = HermesInternal ;
2026-09-21 06:29:48 +00:00
obj19 . verbose ( "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-09-21 06:29:48 +00:00
const obj21 = ModalActionCreatorsDefault ;
2026-10-01 06:55:13 +00:00
obj21 . popWithKey ( tmp ( 5052 ) . getVoiceChannelKey ( channel . id ) ) ;
const tmpResult = tmp ( 5052 ) ;
2026-07-20 16:05:17 +00:00
}
2026-09-10 05:38:07 +00:00
const guild = GuildActionCreatorsDefault . selectGuild ( guildId ) ;
2026-09-21 06:29:48 +00:00
obj19 = closure_15 ;
2026-09-10 05:38:07 +00:00
const obj6 = { guildId , channelId , messageId , jumpType , skipMessageFetch : tmp5 , opensChannel : null } ;
2026-09-21 06:29:48 +00:00
let tmp45 = null != channelId ;
if ( tmp45 ) {
tmp45 = true !== location . navigationReplace || true === location . openChannel ;
const tmp46 = true !== location . navigationReplace || true === location . openChannel ;
2026-09-03 10:05:34 +00:00
}
2026-09-21 06:29:48 +00:00
obj6 . opensChannel = tmp45 ;
2026-09-10 05:38:07 +00:00
const channel1 = SelectedChannelActionCreatorsDefault . 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 ) {
if ( closure_15 != null ) {
2026-07-20 16:05:17 +00:00
let id ;
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-09-21 06:29:48 +00:00
obj26 . 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-09-21 06:29:48 +00:00
obj26 = closure_15 ;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if ( closure_15 != null ) {
2026-07-20 16:05:17 +00:00
const _JSON3 = JSON ;
const json2 = JSON . stringify ( location ) ;
const _JSON4 = JSON ;
2026-09-21 06:29:48 +00:00
const obj11 = { guildId , channelId , messageId , jumpType , voiceChannelId : voiceChannelId2 , voiceGuildId : voiceGuildId2 , voiceMessageId : voiceMessageId2 } ;
2026-07-20 16:05:17 +00:00
const _HermesInternal2 = HermesInternal ;
2026-09-21 06:29:48 +00:00
obj8 . verbose ( "UpdateSelectedChannelListener -> voice route present! " + json2 + " " + JSON . stringify ( obj11 ) + " " ) ;
2026-07-20 16:05:17 +00:00
}
2026-09-19 06:52:51 +00:00
let isGuildStageVoiceResult1 = channel2 . isGuildStageVoice ( ) ;
if ( isGuildStageVoiceResult1 ) {
isGuildStageVoiceResult1 = SelectedChannelStore . getVoiceChannelId ( ) === channel2 . id ;
}
if ( isGuildStageVoiceResult1 ) {
2026-09-10 05:38:07 +00:00
const guild1 = GuildActionCreatorsDefault . selectGuild ( voiceGuildId2 ) ;
const obj12 = { guildId : voiceGuildId2 , channelId : voiceChannelId2 , messageId : voiceMessageId2 , jumpType } ;
const channel3 = SelectedChannelActionCreatorsDefault . selectChannel ( obj12 ) ;
}
2026-10-01 06:55:13 +00:00
const obj = channel2 ( 12511 ) ;
2026-09-19 06:52:51 +00:00
const obj2 = { path : items , strict : false , exact : false } ;
const obj4 = { match : matchPathResult , location } ;
obj8 = closure_15 ;
2026-10-01 06:55:13 +00:00
const tmpResult4 = channel2 ( 4721 ) ;
2026-09-19 06:52:51 +00:00
if ( ! tmpResult4 . isModalOpen ( tmpResult5 . getVoiceChannelKey ( channel2 . id ) ) ) {
2026-09-21 06:29:48 +00:00
const obj14 = ModalActionCreatorsDefault ;
2026-10-01 06:55:13 +00:00
obj14 . popAboveKey ( tmp ( 5052 ) . getVoiceChannelKey ( channel2 . id ) ) ;
const tmpResult6 = tmp ( 5052 ) ;
2026-09-10 05:38:07 +00:00
DispatcherDefault . wait ( ( ) = > {
PrivateChannelCallUtils . openGuildVoiceModal ( channel2 ) ;
2026-07-20 16:05:17 +00:00
} ) ;
}
2026-10-01 06:55:13 +00:00
tmpResult5 = channel2 ( 5052 ) ;
2026-09-21 06:29:48 +00:00
if ( tmp23 ) {
2026-09-19 06:52:51 +00:00
if ( isGuildStageVoiceResult1 ) {
setVoiceChatDrawerState ( channel2 . id , VoiceChatDrawerState . OPEN ) ;
} else {
DispatcherDefault . wait ( ( ) = > ChannelRTCActionCreatorsDefault . updateChatOpen ( channel2 . id , true ) ) ;
}
2026-09-21 06:29:48 +00:00
if ( tmp29 ) {
const obj18 = ChannelRTCActionCreatorsDefault ;
const result = obj18 . jumpToVoiceChannelMessage ( voiceGuildId2 , voiceChannelId2 , voiceMessageId2 , jumpType ) ;
2026-07-20 16:05:17 +00:00
}
2026-09-21 06:29:48 +00:00
tmp29 = null != voiceGuildId2 && null != voiceChannelId2 && null != voiceMessageId2 ;
2026-07-20 16:05:17 +00:00
}
}
function extractParams ( arg0 ) {
( { match , location : _location } = arg0 ) ;
if ( null == match ) {
2026-09-10 05:38:07 +00:00
const obj = { guildId , channelId : null , messageId : null , jumpType : Client.JumpType.ANIMATED , skipMessageFetch : false } ;
2026-07-20 16:05:17 +00:00
return obj ;
} else {
const params = match . params ;
( { guildId , channelId } = params ) ;
2026-09-10 05:38:07 +00:00
if ( _location . jumpType === Client . JumpType . INSTANT ) {
2026-10-01 06:55:13 +00:00
let ANIMATED = tmp5 ( 4772 ) . JumpType . INSTANT ;
2026-07-20 16:05:17 +00:00
} else {
2026-10-01 06:55:13 +00:00
ANIMATED = tmp5 ( 4772 ) . JumpType . ANIMATED ;
2026-07-20 16:05:17 +00:00
}
2026-09-10 05:38:07 +00:00
const obj2 = { guildId , channelId : null , messageId : null , jumpType : null , skipMessageFetch : null } ;
const tmp5Result = RouteUtils ;
2026-07-29 08:29:29 +00:00
let tmp = null ;
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
obj2 . channelId = tmp ;
obj2 . messageId = params . messageId ;
obj2 . jumpType = ANIMATED ;
obj2 . skipMessageFetch = _location . skipMessageFetch ;
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-01 06:55:13 +00:00
const setVoiceChatDrawerState = fn ( 9022 ) . setVoiceChatDrawerState ;
let closure_6 = fn ( 2048 ) . isGuildSelectableChannelType ;
2026-09-10 05:38:07 +00:00
const Constants = fn ( 1074 ) ;
( { ME : closure_11 , Routes } = Constants ) ;
const ChannelTypes = Constants . ChannelTypes ;
2026-10-01 06:55:13 +00:00
const VoiceChatDrawerState = fn ( 9023 ) . VoiceChatDrawerState ;
2026-09-10 05:38:07 +00:00
const logger = new LoggerDefault ( "RouteUtils" ) ;
2026-07-23 10:11:24 +00:00
let c16 = false ;
2026-10-01 06:55:13 +00:00
const RouteParam = fn ( 4702 ) . RouteParam ;
2026-09-10 05:38:07 +00:00
const tmp3 = new LoggerDefault ( "RouteUtils" ) ;
2026-10-01 06:55:13 +00:00
const RouteParam2 = fn ( 4702 ) . RouteParam ;
2026-07-20 16:05:17 +00:00
const CHANNELResult = Routes . CHANNEL ( RouteParam . guildId ( ) , RouteParam2 . channelId ( { optional : true } ) , ":messageId?" ) ;
2026-10-01 06:55:13 +00:00
const RouteParam3 = fn ( 4702 ) . RouteParam ;
2026-07-20 16:05:17 +00:00
const guildIdResult = RouteParam . guildId ( ) ;
2026-10-01 06:55:13 +00:00
const RouteParam4 = fn ( 4702 ) . RouteParam ;
2026-07-20 16:05:17 +00:00
const items = [ "" + CHANNELResult + Routes . VOICE_CHAT_CHANNEL_PARTIAL ( RouteParam3 . guildId ( { name : "voiceGuildId" } ) , RouteParam4 . channelId ( { name : "voiceChannelId" } ) , ":voiceMessageId?" ) , CHANNELResult ] ;
2026-09-10 05:38:07 +00:00
const size = fn ( 2 ) ;
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-09-10 05:38:07 +00:00
const matchPathResult = MemoryRouter . matchPath ( location . pathname , { path : items , strict : false , exact : false } ) ;
2026-07-29 08:29:29 +00:00
let params ;
if ( matchPathResult != null ) {
params = matchPathResult . params ;
}
if ( params == null ) {
params = { } ;
}
2026-09-10 05:38:07 +00:00
const obj3 = { } ;
2026-07-29 08:29:29 +00:00
( { voiceChannelId , voiceGuildId , voiceMessageId } = params ) ;
const merged = Object . assign ( extractParams ( { match : matchPathResult , location } ) ) ;
2026-09-10 05:38:07 +00:00
obj3 . voiceChannelId = voiceChannelId ;
obj3 . voiceGuildId = voiceGuildId ;
obj3 . voiceMessageId = voiceMessageId ;
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-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-09-10 05:38:07 +00:00
const obj2 = { guildId , channelId : null } ;
const channel = ChannelStore . getChannel ( SelectedChannelStore . getLastSelectedChannelId ( ) ) ;
2026-07-29 08:29:29 +00:00
let type ;
if ( channel != null ) {
type = channel . type ;
}
if ( null != type ) {
let type1 ;
if ( channel != null ) {
type1 = channel . type ;
}
if ( closure_6 ( type1 ) ) {
let id = channel . id ;
}
2026-09-10 05:38:07 +00:00
obj2 . channelId = id ;
const channel1 = obj . selectChannel ( obj2 ) ;
router_utils . transitionTo ( lastNonVoiceRoute ) ;
2026-07-29 08:29:29 +00:00
}
2026-09-10 05:38:07 +00:00
id = SelectedChannelStore . 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 ;
const matchPathResult = MemoryRouter . matchPath ( defaultRoute , { path : items , strict : false , exact : false } ) ;
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-07-20 16:05:17 +00:00
if ( voiceChannelId !== arg1 ) {
2026-09-10 05:38:07 +00:00
router_utils . transitionToGuild ( arg0 , arg1 ) ;
const tmpResult = router_utils ;
2026-07-20 16:05:17 +00:00
} else {
const _HermesInternal = HermesInternal ;
2026-08-24 06:08:38 +00:00
logger . 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-07-23 10:11:24 +00:00
if ( ! c16 ) {
2026-09-10 05:38:07 +00:00
RouteManagerDefault . addRouteRewriter ( voiceRouteRewriter ) ;
const result = RouteManagerDefault . addRouteChangeListener ( saveLastRouteListener ) ;
const result1 = RouteManagerDefault . addRouteChangeListener ( saveLastNonVoiceRouteListener ) ;
const result2 = RouteManagerDefault . addRouteChangeListener ( updateSelectedChannelListener ) ;
const result3 = RouteManagerDefault . addRouteChangeListener ( logRouteChange ) ;
RouteManagerDefault . 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-07-23 10:11:24 +00:00
if ( c16 ) {
2026-09-10 05:38:07 +00:00
RouteManagerDefault . removeRouteRewriter ( voiceRouteRewriter ) ;
const result = RouteManagerDefault . removeRouteChangeListener ( saveLastRouteListener ) ;
const result1 = RouteManagerDefault . removeRouteChangeListener ( saveLastNonVoiceRouteListener ) ;
const result2 = RouteManagerDefault . removeRouteChangeListener ( updateSelectedChannelListener ) ;
const result3 = RouteManagerDefault . removeRouteChangeListener ( logRouteChange ) ;
RouteManagerDefault . cleanup ( ) ;
2026-07-23 10:11:24 +00:00
c16 = false ;
2026-07-20 16:05:17 +00:00
}
} ;