package com.discord.widgets.home; import c.d.b.a.a; import com.airbnb.lottie.parser.AnimatableValueParser; import com.discord.api.channel.Channel; import com.discord.api.user.NsfwAllowance; import com.discord.models.domain.ModelUserRelationship; import com.discord.models.presence.Presence; import com.discord.models.user.MeUser; import com.discord.models.user.User; import com.discord.stores.StoreChannelsSelected; import com.discord.stores.StoreStream; import com.discord.stores.StoreThreadsActive; import com.discord.stores.StoreUser; import com.discord.utilities.rx.ObservableWithLeadingEdgeThrottle; import com.discord.widgets.chat.list.CreateThreadsFeatureFlag; import d0.z.d.m; import j0.k.b; import java.util.Map; import java.util.concurrent.TimeUnit; import kotlin.Pair; import rx.Observable; import rx.functions.Func8; /* compiled from: WidgetHomeModel.kt */ public final class WidgetHomeModel$Companion$get$2 implements b, Observable> { public static final WidgetHomeModel$Companion$get$2 INSTANCE = new WidgetHomeModel$Companion$get$2(); /* compiled from: WidgetHomeModel.kt */ /* renamed from: com.discord.widgets.home.WidgetHomeModel$Companion$get$2$1 reason: invalid class name */ public static final class AnonymousClass1 implements Func8, Long, Integer, Map, Map, Channel, Boolean, WidgetHomeModel> { public final /* synthetic */ Channel $channel; public final /* synthetic */ StoreChannelsSelected.ResolvedSelectedChannel $selectedChannel; public AnonymousClass1(Channel channel, StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel) { this.$channel = channel; this.$selectedChannel = resolvedSelectedChannel; } /* JADX WARNING: Removed duplicated region for block: B:30:0x007d */ public final WidgetHomeModel call(MeUser meUser, Map map, Long l, Integer num, Map map2, Map map3, Channel channel, Boolean bool) { boolean z2; User v0; User v02; Long l2; Long l3; Channel channel2 = this.$channel; NsfwAllowance nsfwAllowance = null; if (channel2 != null && AnimatableValueParser.t1(channel2)) { Channel channel3 = this.$channel; if (channel3 != null) { l3 = Long.valueOf(channel3.h()); l2 = l; } else { l2 = l; l3 = null; } if (m.areEqual(l2, l3)) { z2 = true; StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel = this.$selectedChannel; m.checkNotNullExpressionValue(resolvedSelectedChannel, "selectedChannel"); Channel channel4 = this.$channel; Presence presence = (channel4 != null || (v02 = AnimatableValueParser.v0(channel4)) == null) ? null : (Presence) a.c(v02, map); m.checkNotNullExpressionValue(num, "unreadCount"); int intValue = num.intValue(); m.checkNotNullExpressionValue(map2, "userRelationships"); Channel channel5 = this.$channel; boolean isType = ModelUserRelationship.isType(map2.get((channel5 != null || (v0 = AnimatableValueParser.v0(channel5)) == null) ? null : Long.valueOf(v0.getId())), 1); if (meUser != null) { nsfwAllowance = meUser.getNsfwAllowance(); } int size = map3.size(); m.checkNotNullExpressionValue(bool, "threadExperimentEnabled"); return new WidgetHomeModel(resolvedSelectedChannel, channel, presence, intValue, isType, z2, nsfwAllowance, size, bool.booleanValue()); } } z2 = false; StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel = this.$selectedChannel; m.checkNotNullExpressionValue(resolvedSelectedChannel, "selectedChannel"); Channel channel4 = this.$channel; if (channel4 != null) { } m.checkNotNullExpressionValue(num, "unreadCount"); int intValue = num.intValue(); m.checkNotNullExpressionValue(map2, "userRelationships"); Channel channel5 = this.$channel; boolean isType = ModelUserRelationship.isType(map2.get((channel5 != null || (v0 = AnimatableValueParser.v0(channel5)) == null) ? null : Long.valueOf(v0.getId())), 1); if (meUser != null) { } int size = map3.size(); m.checkNotNullExpressionValue(bool, "threadExperimentEnabled"); return new WidgetHomeModel(resolvedSelectedChannel, channel, presence, intValue, isType, z2, nsfwAllowance, size, bool.booleanValue()); } /* 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, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object] */ @Override // rx.functions.Func8 public /* bridge */ /* synthetic */ WidgetHomeModel call(MeUser meUser, Map map, Long l, Integer num, Map map2, Map map3, Channel channel, Boolean bool) { return call(meUser, (Map) map, l, num, (Map) map2, (Map) map3, channel, bool); } } /* 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 // j0.k.b public /* bridge */ /* synthetic */ Observable call(Pair pair) { return call((Pair) pair); } public final Observable call(Pair pair) { Long l; long j; Long component1 = pair.component1(); StoreChannelsSelected.ResolvedSelectedChannel resolvedSelectedChannel = (StoreChannelsSelected.ResolvedSelectedChannel) pair.component2(); Channel maybeChannel = resolvedSelectedChannel.getMaybeChannel(); StoreStream.Companion companion = StoreStream.Companion; Observable observeMe$default = StoreUser.observeMe$default(companion.getUsers(), false, 1, null); Observable> observeAllPresences = companion.getPresences().observeAllPresences(); Observable observeSelectedVoiceChannelId = companion.getVoiceChannelSelected().observeSelectedVoiceChannelId(); Observable observeTotalMentions = companion.getMentions().observeTotalMentions(); Observable> observe = companion.getUserRelationships().observe(); StoreThreadsActive threadsActive = companion.getThreadsActive(); m.checkNotNullExpressionValue(component1, "selectedGuildId"); long longValue = component1.longValue(); if (maybeChannel != null && AnimatableValueParser.B1(maybeChannel)) { j = maybeChannel.r(); } else if (maybeChannel != null) { j = maybeChannel.h(); } else { l = null; return ObservableWithLeadingEdgeThrottle.combineLatest(observeMe$default, observeAllPresences, observeSelectedVoiceChannelId, observeTotalMentions, observe, threadsActive.observeActiveThreadsForChannel(longValue, l), WidgetHomeModel.Companion.getParentChannelObservable(maybeChannel), new CreateThreadsFeatureFlag(null, null, 3, null).observeEnabled(component1.longValue()), new AnonymousClass1(maybeChannel, resolvedSelectedChannel), 350, TimeUnit.MILLISECONDS); } l = Long.valueOf(j); return ObservableWithLeadingEdgeThrottle.combineLatest(observeMe$default, observeAllPresences, observeSelectedVoiceChannelId, observeTotalMentions, observe, threadsActive.observeActiveThreadsForChannel(longValue, l), WidgetHomeModel.Companion.getParentChannelObservable(maybeChannel), new CreateThreadsFeatureFlag(null, null, 3, null).observeEnabled(component1.longValue()), new AnonymousClass1(maybeChannel, resolvedSelectedChannel), 350, TimeUnit.MILLISECONDS); } }