package com.discord.widgets.guildscheduledevent; import android.content.Context; import androidx.annotation.MainThread; import c.d.b.a.a; import c0.z.d.m; import c0.z.d.o; import com.discord.api.channel.Channel; import com.discord.api.channel.ChannelUtils; import com.discord.api.guild.GuildFeature; import com.discord.api.guildscheduledevent.GuildScheduledEvent; import com.discord.api.guildscheduledevent.GuildScheduledEventEntityMetadata; import com.discord.api.guildscheduledevent.GuildScheduledEventEntityType; import com.discord.app.AppViewModel; import com.discord.models.guild.Guild; import com.discord.stores.StoreChannels; import com.discord.stores.StoreGuildScheduledEvents; import com.discord.stores.StoreGuilds; import com.discord.stores.StorePermissions; import com.discord.stores.StoreStream; import com.discord.stores.updates.ObservationDeck; import com.discord.stores.updates.ObservationDeckProvider; import com.discord.utilities.guildscheduledevent.GuildScheduledEventTiming; import com.discord.utilities.guildscheduledevent.GuildScheduledEventUtilities; import com.discord.utilities.guildscheduledevent.GuildScheduledEventUtilitiesKt; import com.discord.utilities.rx.ObservableExtensionsKt; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.DefaultConstructorMarker; import rx.Observable; /* compiled from: WidgetGuildScheduledEventLocationSelectViewModel.kt */ public final class WidgetGuildScheduledEventLocationSelectViewModel extends AppViewModel { public static final Companion Companion = new Companion(null); private final StoreChannels channelsStore; private StoreState currentStoreState; private final Long existingGuildScheduledEventId; private final Long initialChannelId; /* compiled from: WidgetGuildScheduledEventLocationSelectViewModel.kt */ /* renamed from: com.discord.widgets.guildscheduledevent.WidgetGuildScheduledEventLocationSelectViewModel$1 reason: invalid class name */ public static final class AnonymousClass1 extends o implements Function1 { public final /* synthetic */ WidgetGuildScheduledEventLocationSelectViewModel this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnonymousClass1(WidgetGuildScheduledEventLocationSelectViewModel widgetGuildScheduledEventLocationSelectViewModel) { super(1); this.this$0 = widgetGuildScheduledEventLocationSelectViewModel; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kotlin.jvm.functions.Function1 public /* bridge */ /* synthetic */ Unit invoke(StoreState storeState) { invoke(storeState); return Unit.a; } public final void invoke(StoreState storeState) { WidgetGuildScheduledEventLocationSelectViewModel widgetGuildScheduledEventLocationSelectViewModel = this.this$0; m.checkNotNullExpressionValue(storeState, "it"); WidgetGuildScheduledEventLocationSelectViewModel.access$handleStoreState(widgetGuildScheduledEventLocationSelectViewModel, storeState); } } /* compiled from: WidgetGuildScheduledEventLocationSelectViewModel.kt */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public static final /* synthetic */ Observable access$observeStores(Companion companion, long j, Long l, StoreGuilds storeGuilds, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuildScheduledEvents storeGuildScheduledEvents) { return companion.observeStores(j, l, storeGuilds, storeChannels, storePermissions, storeGuildScheduledEvents); } private final Observable observeStores(long j, Long l, StoreGuilds storeGuilds, StoreChannels storeChannels, StorePermissions storePermissions, StoreGuildScheduledEvents storeGuildScheduledEvents) { return ObservationDeck.connectRx$default(ObservationDeckProvider.get(), new ObservationDeck.UpdateSource[]{storeChannels, storePermissions}, false, null, null, new WidgetGuildScheduledEventLocationSelectViewModel$Companion$observeStores$1(storeGuilds, j, storeChannels, storePermissions, l, storeGuildScheduledEvents), 14, null); } } /* compiled from: WidgetGuildScheduledEventLocationSelectViewModel.kt */ public static final class StoreState { private final Map channelPermissions; private final Map channels; private final GuildScheduledEvent existingGuildScheduledEvent; private final Guild guild; private final Long guildPermissions; public StoreState(Guild guild, Map map, Map map2, Long l, GuildScheduledEvent guildScheduledEvent) { m.checkNotNullParameter(map, "channels"); m.checkNotNullParameter(map2, "channelPermissions"); this.guild = guild; this.channels = map; this.channelPermissions = map2; this.guildPermissions = l; this.existingGuildScheduledEvent = guildScheduledEvent; } /* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: com.discord.widgets.guildscheduledevent.WidgetGuildScheduledEventLocationSelectViewModel$StoreState */ /* JADX WARN: Multi-variable type inference failed */ public static /* synthetic */ StoreState copy$default(StoreState storeState, Guild guild, Map map, Map map2, Long l, GuildScheduledEvent guildScheduledEvent, int i, Object obj) { if ((i & 1) != 0) { guild = storeState.guild; } if ((i & 2) != 0) { map = storeState.channels; } if ((i & 4) != 0) { map2 = storeState.channelPermissions; } if ((i & 8) != 0) { l = storeState.guildPermissions; } if ((i & 16) != 0) { guildScheduledEvent = storeState.existingGuildScheduledEvent; } return storeState.copy(guild, map, map2, l, guildScheduledEvent); } public final Guild component1() { return this.guild; } public final Map component2() { return this.channels; } public final Map component3() { return this.channelPermissions; } public final Long component4() { return this.guildPermissions; } public final GuildScheduledEvent component5() { return this.existingGuildScheduledEvent; } public final StoreState copy(Guild guild, Map map, Map map2, Long l, GuildScheduledEvent guildScheduledEvent) { m.checkNotNullParameter(map, "channels"); m.checkNotNullParameter(map2, "channelPermissions"); return new StoreState(guild, map, map2, l, guildScheduledEvent); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof StoreState)) { return false; } StoreState storeState = (StoreState) obj; return m.areEqual(this.guild, storeState.guild) && m.areEqual(this.channels, storeState.channels) && m.areEqual(this.channelPermissions, storeState.channelPermissions) && m.areEqual(this.guildPermissions, storeState.guildPermissions) && m.areEqual(this.existingGuildScheduledEvent, storeState.existingGuildScheduledEvent); } public final Map getChannelPermissions() { return this.channelPermissions; } public final Map getChannels() { return this.channels; } public final GuildScheduledEvent getExistingGuildScheduledEvent() { return this.existingGuildScheduledEvent; } public final Guild getGuild() { return this.guild; } public final Long getGuildPermissions() { return this.guildPermissions; } public int hashCode() { Guild guild = this.guild; int i = 0; int hashCode = (guild != null ? guild.hashCode() : 0) * 31; Map map = this.channels; int hashCode2 = (hashCode + (map != null ? map.hashCode() : 0)) * 31; Map map2 = this.channelPermissions; int hashCode3 = (hashCode2 + (map2 != null ? map2.hashCode() : 0)) * 31; Long l = this.guildPermissions; int hashCode4 = (hashCode3 + (l != null ? l.hashCode() : 0)) * 31; GuildScheduledEvent guildScheduledEvent = this.existingGuildScheduledEvent; if (guildScheduledEvent != null) { i = guildScheduledEvent.hashCode(); } return hashCode4 + i; } public String toString() { StringBuilder O = a.O("StoreState(guild="); O.append(this.guild); O.append(", channels="); O.append(this.channels); O.append(", channelPermissions="); O.append(this.channelPermissions); O.append(", guildPermissions="); O.append(this.guildPermissions); O.append(", existingGuildScheduledEvent="); O.append(this.existingGuildScheduledEvent); O.append(")"); return O.toString(); } } /* compiled from: WidgetGuildScheduledEventLocationSelectViewModel.kt */ public static abstract class ViewState { /* compiled from: WidgetGuildScheduledEventLocationSelectViewModel.kt */ public static final class Invalid extends ViewState { public static final Invalid INSTANCE = new Invalid(); private Invalid() { super(null); } } /* compiled from: WidgetGuildScheduledEventLocationSelectViewModel.kt */ public static final class Valid extends ViewState { private final Map availableChannels; private final Set availableStageChannelIds; private final Set availableVoiceChannelIds; private final boolean canChangeChannel; private final boolean canCreateExternalEvent; private final String externalLocation; private final Channel selectedChannel; private final GuildScheduledEventEntityType selectedLocationOption; private final boolean showStageOptionIfUnavailable; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public Valid(GuildScheduledEventEntityType guildScheduledEventEntityType, Channel channel, String str, Map map, Set set, Set set2, boolean z2, boolean z3, boolean z4) { super(null); m.checkNotNullParameter(guildScheduledEventEntityType, "selectedLocationOption"); m.checkNotNullParameter(str, "externalLocation"); m.checkNotNullParameter(map, "availableChannels"); m.checkNotNullParameter(set, "availableVoiceChannelIds"); m.checkNotNullParameter(set2, "availableStageChannelIds"); this.selectedLocationOption = guildScheduledEventEntityType; this.selectedChannel = channel; this.externalLocation = str; this.availableChannels = map; this.availableVoiceChannelIds = set; this.availableStageChannelIds = set2; this.canCreateExternalEvent = z2; this.showStageOptionIfUnavailable = z3; this.canChangeChannel = z4; } public static /* synthetic */ Valid copy$default(Valid valid, GuildScheduledEventEntityType guildScheduledEventEntityType, Channel channel, String str, Map map, Set set, Set set2, boolean z2, boolean z3, boolean z4, int i, Object obj) { return valid.copy((i & 1) != 0 ? valid.selectedLocationOption : guildScheduledEventEntityType, (i & 2) != 0 ? valid.selectedChannel : channel, (i & 4) != 0 ? valid.externalLocation : str, (i & 8) != 0 ? valid.availableChannels : map, (i & 16) != 0 ? valid.availableVoiceChannelIds : set, (i & 32) != 0 ? valid.availableStageChannelIds : set2, (i & 64) != 0 ? valid.canCreateExternalEvent : z2, (i & 128) != 0 ? valid.showStageOptionIfUnavailable : z3, (i & 256) != 0 ? valid.canChangeChannel : z4); } public final GuildScheduledEventEntityType component1() { return this.selectedLocationOption; } public final Channel component2() { return this.selectedChannel; } public final String component3() { return this.externalLocation; } public final Map component4() { return this.availableChannels; } public final Set component5() { return this.availableVoiceChannelIds; } public final Set component6() { return this.availableStageChannelIds; } public final boolean component7() { return this.canCreateExternalEvent; } public final boolean component8() { return this.showStageOptionIfUnavailable; } public final boolean component9() { return this.canChangeChannel; } public final Valid copy(GuildScheduledEventEntityType guildScheduledEventEntityType, Channel channel, String str, Map map, Set set, Set set2, boolean z2, boolean z3, boolean z4) { m.checkNotNullParameter(guildScheduledEventEntityType, "selectedLocationOption"); m.checkNotNullParameter(str, "externalLocation"); m.checkNotNullParameter(map, "availableChannels"); m.checkNotNullParameter(set, "availableVoiceChannelIds"); m.checkNotNullParameter(set2, "availableStageChannelIds"); return new Valid(guildScheduledEventEntityType, channel, str, map, set, set2, z2, z3, z4); } public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Valid)) { return false; } Valid valid = (Valid) obj; return m.areEqual(this.selectedLocationOption, valid.selectedLocationOption) && m.areEqual(this.selectedChannel, valid.selectedChannel) && m.areEqual(this.externalLocation, valid.externalLocation) && m.areEqual(this.availableChannels, valid.availableChannels) && m.areEqual(this.availableVoiceChannelIds, valid.availableVoiceChannelIds) && m.areEqual(this.availableStageChannelIds, valid.availableStageChannelIds) && this.canCreateExternalEvent == valid.canCreateExternalEvent && this.showStageOptionIfUnavailable == valid.showStageOptionIfUnavailable && this.canChangeChannel == valid.canChangeChannel; } public final Map getAvailableChannels() { return this.availableChannels; } public final Set getAvailableStageChannelIds() { return this.availableStageChannelIds; } public final Set getAvailableVoiceChannelIds() { return this.availableVoiceChannelIds; } public final boolean getCanChangeChannel() { return this.canChangeChannel; } public final boolean getCanCreateExternalEvent() { return this.canCreateExternalEvent; } public final String getExternalLocation() { return this.externalLocation; } public final Channel getSelectedChannel() { return this.selectedChannel; } public final GuildScheduledEventEntityType getSelectedLocationOption() { return this.selectedLocationOption; } public final boolean getShowStageOptionIfUnavailable() { return this.showStageOptionIfUnavailable; } public int hashCode() { GuildScheduledEventEntityType guildScheduledEventEntityType = this.selectedLocationOption; int i = 0; int hashCode = (guildScheduledEventEntityType != null ? guildScheduledEventEntityType.hashCode() : 0) * 31; Channel channel = this.selectedChannel; int hashCode2 = (hashCode + (channel != null ? channel.hashCode() : 0)) * 31; String str = this.externalLocation; int hashCode3 = (hashCode2 + (str != null ? str.hashCode() : 0)) * 31; Map map = this.availableChannels; int hashCode4 = (hashCode3 + (map != null ? map.hashCode() : 0)) * 31; Set set = this.availableVoiceChannelIds; int hashCode5 = (hashCode4 + (set != null ? set.hashCode() : 0)) * 31; Set set2 = this.availableStageChannelIds; if (set2 != null) { i = set2.hashCode(); } int i2 = (hashCode5 + i) * 31; boolean z2 = this.canCreateExternalEvent; int i3 = 1; if (z2) { z2 = true; } int i4 = z2 ? 1 : 0; int i5 = z2 ? 1 : 0; int i6 = z2 ? 1 : 0; int i7 = (i2 + i4) * 31; boolean z3 = this.showStageOptionIfUnavailable; if (z3) { z3 = true; } int i8 = z3 ? 1 : 0; int i9 = z3 ? 1 : 0; int i10 = z3 ? 1 : 0; int i11 = (i7 + i8) * 31; boolean z4 = this.canChangeChannel; if (!z4) { i3 = z4 ? 1 : 0; } return i11 + i3; } public String toString() { StringBuilder O = a.O("Valid(selectedLocationOption="); O.append(this.selectedLocationOption); O.append(", selectedChannel="); O.append(this.selectedChannel); O.append(", externalLocation="); O.append(this.externalLocation); O.append(", availableChannels="); O.append(this.availableChannels); O.append(", availableVoiceChannelIds="); O.append(this.availableVoiceChannelIds); O.append(", availableStageChannelIds="); O.append(this.availableStageChannelIds); O.append(", canCreateExternalEvent="); O.append(this.canCreateExternalEvent); O.append(", showStageOptionIfUnavailable="); O.append(this.showStageOptionIfUnavailable); O.append(", canChangeChannel="); return a.K(O, this.canChangeChannel, ")"); } } private ViewState() { } public /* synthetic */ ViewState(DefaultConstructorMarker defaultConstructorMarker) { this(); } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public WidgetGuildScheduledEventLocationSelectViewModel(long j, Long l, Long l2, StoreChannels storeChannels, StoreGuilds storeGuilds, StorePermissions storePermissions, StoreGuildScheduledEvents storeGuildScheduledEvents, Observable observable) { super(null, 1, null); m.checkNotNullParameter(storeChannels, "channelsStore"); m.checkNotNullParameter(storeGuilds, "guildsStore"); m.checkNotNullParameter(storePermissions, "permissionsStore"); m.checkNotNullParameter(storeGuildScheduledEvents, "guildScheduledEventsStore"); m.checkNotNullParameter(observable, "storeStateObservable"); this.initialChannelId = l; this.existingGuildScheduledEventId = l2; this.channelsStore = storeChannels; Observable X = observable.X(i0.p.a.a()); m.checkNotNullExpressionValue(X, "storeStateObservable\n …Schedulers.computation())"); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(X, this, null, 2, null), WidgetGuildScheduledEventLocationSelectViewModel.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new AnonymousClass1(this), 62, (Object) null); } /* JADX WARNING: Illegal instructions before constructor call */ public /* synthetic */ WidgetGuildScheduledEventLocationSelectViewModel(long j, Long l, Long l2, StoreChannels storeChannels, StoreGuilds storeGuilds, StorePermissions storePermissions, StoreGuildScheduledEvents storeGuildScheduledEvents, Observable observable, int i, DefaultConstructorMarker defaultConstructorMarker) { this(j, l, l2, r1, r10, r11, r12, (i & 128) != 0 ? Companion.access$observeStores(Companion, j, l2, r10, r1, r11, r12) : observable); StoreChannels channels = (i & 8) != 0 ? StoreStream.Companion.getChannels() : storeChannels; StoreGuilds guilds = (i & 16) != 0 ? StoreStream.Companion.getGuilds() : storeGuilds; StorePermissions permissions = (i & 32) != 0 ? StoreStream.Companion.getPermissions() : storePermissions; StoreGuildScheduledEvents guildScheduledEvents = (i & 64) != 0 ? StoreStream.Companion.getGuildScheduledEvents() : storeGuildScheduledEvents; } public static final /* synthetic */ void access$handleStoreState(WidgetGuildScheduledEventLocationSelectViewModel widgetGuildScheduledEventLocationSelectViewModel, StoreState storeState) { widgetGuildScheduledEventLocationSelectViewModel.handleStoreState(storeState); } private final GuildScheduledEventEntityType getEntityTypeForChannel(Channel channel) { return channel == null ? GuildScheduledEventEntityType.NONE : ChannelUtils.E(channel) ? GuildScheduledEventEntityType.VOICE : ChannelUtils.z(channel) ? GuildScheduledEventEntityType.STAGE_INSTANCE : GuildScheduledEventEntityType.NONE; } /* JADX WARNING: Removed duplicated region for block: B:34:0x00cd */ /* JADX WARNING: Removed duplicated region for block: B:35:0x00d2 */ /* JADX WARNING: Removed duplicated region for block: B:41:0x00e9 */ /* JADX WARNING: Removed duplicated region for block: B:46:0x00f6 */ /* JADX WARNING: Removed duplicated region for block: B:55:0x010e */ /* JADX WARNING: Removed duplicated region for block: B:60:0x0120 */ /* JADX WARNING: Removed duplicated region for block: B:61:0x0125 */ /* JADX WARNING: Removed duplicated region for block: B:70:0x013e */ /* JADX WARNING: Removed duplicated region for block: B:79:0x0156 */ @MainThread private final void handleStoreState(StoreState storeState) { Long l; GuildScheduledEventEntityType selectedLocationOption; String externalLocation; boolean z2; GuildScheduledEvent existingGuildScheduledEvent; GuildScheduledEventEntityMetadata d; Set features; this.currentStoreState = storeState; ViewState viewState = getViewState(); GuildScheduledEventTiming guildScheduledEventTiming = null; if (!(viewState instanceof ViewState.Valid)) { viewState = null; } ViewState.Valid valid = (ViewState.Valid) viewState; boolean canCreateExternalEvent = GuildScheduledEventUtilities.Companion.canCreateExternalEvent(storeState.getGuildPermissions()); Map channels = storeState.getChannels(); LinkedHashMap linkedHashMap = new LinkedHashMap(); for (Map.Entry entry : channels.entrySet()) { Channel value = entry.getValue(); if (GuildScheduledEventUtilities.Companion.canStartEventInChannel(value, (Long) a.c(value, storeState.getChannelPermissions()))) { linkedHashMap.put(entry.getKey(), entry.getValue()); } } HashSet hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); for (Channel channel : linkedHashMap.values()) { if (ChannelUtils.E(channel)) { hashSet2.add(Long.valueOf(channel.h())); } else if (ChannelUtils.z(channel)) { hashSet.add(Long.valueOf(channel.h())); } } boolean z3 = this.existingGuildScheduledEventId != null; if (valid != null) { Channel selectedChannel = valid.getSelectedChannel(); if (selectedChannel != null) { l = Long.valueOf(selectedChannel.h()); Channel channel2 = (Channel) linkedHashMap.get(l); selectedLocationOption = valid != null ? valid.getSelectedLocationOption() : storeState.getExistingGuildScheduledEvent() != null ? storeState.getExistingGuildScheduledEvent().e() : getEntityTypeForChannel(channel2); if (selectedLocationOption != GuildScheduledEventEntityType.STAGE_INSTANCE && hashSet.isEmpty()) { selectedLocationOption = GuildScheduledEventEntityType.NONE; } else if (selectedLocationOption != GuildScheduledEventEntityType.VOICE && hashSet2.isEmpty()) { selectedLocationOption = GuildScheduledEventEntityType.NONE; } else if (selectedLocationOption == GuildScheduledEventEntityType.EXTERNAL && !canCreateExternalEvent) { selectedLocationOption = GuildScheduledEventEntityType.NONE; } Guild guild = storeState.getGuild(); boolean contains = (guild != null || (features = guild.getFeatures()) == null) ? false : features.contains(GuildFeature.COMMUNITY); externalLocation = valid != null ? valid.getExternalLocation() : (!z3 || l != null || (existingGuildScheduledEvent = storeState.getExistingGuildScheduledEvent()) == null || (d = existingGuildScheduledEvent.d()) == null) ? null : d.a(); if (z3) { GuildScheduledEvent existingGuildScheduledEvent2 = storeState.getExistingGuildScheduledEvent(); if (existingGuildScheduledEvent2 != null) { guildScheduledEventTiming = GuildScheduledEventUtilitiesKt.getEventTiming(existingGuildScheduledEvent2); } if (guildScheduledEventTiming == GuildScheduledEventTiming.LIVE) { z2 = false; if (externalLocation == null) { externalLocation = ""; } updateViewState(new ViewState.Valid(selectedLocationOption, channel2, externalLocation, linkedHashMap, hashSet2, hashSet, canCreateExternalEvent, contains, z2)); } } z2 = true; if (externalLocation == null) { } updateViewState(new ViewState.Valid(selectedLocationOption, channel2, externalLocation, linkedHashMap, hashSet2, hashSet, canCreateExternalEvent, contains, z2)); } } else { if (z3) { GuildScheduledEvent existingGuildScheduledEvent3 = storeState.getExistingGuildScheduledEvent(); if (existingGuildScheduledEvent3 != null) { l = existingGuildScheduledEvent3.b(); } } else { l = this.initialChannelId; } Channel channel2 = (Channel) linkedHashMap.get(l); if (valid != null) { } if (selectedLocationOption != GuildScheduledEventEntityType.STAGE_INSTANCE) { } if (selectedLocationOption != GuildScheduledEventEntityType.VOICE) { } selectedLocationOption = GuildScheduledEventEntityType.NONE; Guild guild = storeState.getGuild(); if (guild != null) { } if (valid != null) { } if (z3) { } z2 = true; if (externalLocation == null) { } updateViewState(new ViewState.Valid(selectedLocationOption, channel2, externalLocation, linkedHashMap, hashSet2, hashSet, canCreateExternalEvent, contains, z2)); } l = null; Channel channel2 = (Channel) linkedHashMap.get(l); if (valid != null) { } if (selectedLocationOption != GuildScheduledEventEntityType.STAGE_INSTANCE) { } if (selectedLocationOption != GuildScheduledEventEntityType.VOICE) { } selectedLocationOption = GuildScheduledEventEntityType.NONE; Guild guild = storeState.getGuild(); if (guild != null) { } if (valid != null) { } if (z3) { } z2 = true; if (externalLocation == null) { } updateViewState(new ViewState.Valid(selectedLocationOption, channel2, externalLocation, linkedHashMap, hashSet2, hashSet, canCreateExternalEvent, contains, z2)); } public final StoreState getCurrentStoreState() { return this.currentStoreState; } public final void selectChannel(long j) { StoreState storeState; Map channels; Channel channel; ViewState viewState = getViewState(); if ((viewState instanceof ViewState.Valid) && (storeState = this.currentStoreState) != null && (channels = storeState.getChannels()) != null && (channel = channels.get(Long.valueOf(j))) != null) { updateViewState(ViewState.Valid.copy$default((ViewState.Valid) viewState, null, channel, null, null, null, null, false, false, false, 509, null)); } } /* JADX DEBUG: Multi-variable search result rejected for r3v4, resolved type: java.lang.Object */ /* JADX DEBUG: Multi-variable search result rejected for r3v6, resolved type: java.lang.Object */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARNING: Removed duplicated region for block: B:21:0x0048 */ /* JADX WARNING: Removed duplicated region for block: B:31:0x0070 */ public final void selectLocationOption(GuildScheduledEventEntityType guildScheduledEventEntityType) { Channel channel; GuildScheduledEventEntityType guildScheduledEventEntityType2; Channel channel2; boolean z2; boolean z3; Map channels; m.checkNotNullParameter(guildScheduledEventEntityType, "locationOption"); ViewState viewState = getViewState(); if (viewState instanceof ViewState.Valid) { ViewState.Valid valid = (ViewState.Valid) viewState; if (guildScheduledEventEntityType != valid.getSelectedLocationOption()) { Long l = this.initialChannelId; Channel channel3 = null; if (l != null) { l.longValue(); StoreState storeState = this.currentStoreState; if (!(storeState == null || (channels = storeState.getChannels()) == null)) { channel = channels.get(this.initialChannelId); guildScheduledEventEntityType2 = GuildScheduledEventEntityType.VOICE; if (!(guildScheduledEventEntityType == guildScheduledEventEntityType2 && channel != null && channel.A() == 2)) { if (guildScheduledEventEntityType != guildScheduledEventEntityType2) { Iterator it = valid.getAvailableChannels().values().iterator(); while (true) { if (!it.hasNext()) { break; } Object next = it.next(); if (((Channel) next).A() == 2) { z3 = true; continue; } else { z3 = false; continue; } if (z3) { channel3 = next; break; } } channel3 = channel3; } else { GuildScheduledEventEntityType guildScheduledEventEntityType3 = GuildScheduledEventEntityType.STAGE_INSTANCE; if (!(guildScheduledEventEntityType == guildScheduledEventEntityType3 && channel != null && channel.A() == 13)) { if (guildScheduledEventEntityType == guildScheduledEventEntityType3) { Iterator it2 = valid.getAvailableChannels().values().iterator(); while (true) { if (!it2.hasNext()) { break; } Object next2 = it2.next(); if (((Channel) next2).A() == 13) { z2 = true; continue; } else { z2 = false; continue; } if (z2) { channel3 = next2; break; } } channel3 = channel3; } } } channel2 = channel3; updateViewState(ViewState.Valid.copy$default(valid, guildScheduledEventEntityType, channel2, "", null, null, null, false, false, false, 504, null)); } channel2 = channel; updateViewState(ViewState.Valid.copy$default(valid, guildScheduledEventEntityType, channel2, "", null, null, null, false, false, false, 504, null)); } } channel = null; guildScheduledEventEntityType2 = GuildScheduledEventEntityType.VOICE; if (guildScheduledEventEntityType != guildScheduledEventEntityType2) { } channel2 = channel3; updateViewState(ViewState.Valid.copy$default(valid, guildScheduledEventEntityType, channel2, "", null, null, null, false, false, false, 504, null)); } } } public final void setCurrentStoreState(StoreState storeState) { this.currentStoreState = storeState; } public final void setExternalLocation(String str) { m.checkNotNullParameter(str, "newExternalLocation"); ViewState viewState = getViewState(); if (viewState instanceof ViewState.Valid) { updateViewState(ViewState.Valid.copy$default((ViewState.Valid) viewState, null, null, str, null, null, null, false, false, false, 507, null)); } } }