discord-jadx/app/src/main/java/com/discord/widgets/user/search/WidgetGlobalSearchModel.java

1539 lines
70 KiB
Java

package com.discord.widgets.user.search;
import a0.a.a.b;
import androidx.annotation.StringRes;
import c.d.b.a.a;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.discord.api.channel.Channel;
import com.discord.models.guild.Guild;
import com.discord.models.member.GuildMember;
import com.discord.models.presence.Presence;
import com.discord.models.user.User;
import com.discord.stores.StoreChannels;
import com.discord.stores.StoreStream;
import com.discord.utilities.frecency.FrecencyTracker;
import com.discord.utilities.mg_recycler.MGRecyclerDataPayload;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.rx.ObservableWithLeadingEdgeThrottle;
import com.discord.utilities.search.SearchUtils;
import com.discord.utilities.string.StringUtilsKt;
import com.discord.widgets.user.search.WidgetGlobalSearchGuildsModel;
import d0.f0.n;
import d0.f0.q;
import d0.g0.t;
import d0.g0.w;
import d0.g0.y;
import d0.t.n0;
import d0.t.u;
import d0.z.d.m;
import j0.l.e.j;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.sequences.Sequence;
import rx.Observable;
import rx.functions.Func4;
import rx.functions.Func7;
/* compiled from: WidgetGlobalSearchModel.kt */
public final class WidgetGlobalSearchModel {
public static final Companion Companion = new Companion(null);
private static final Function2<Channel, Map<Long, Long>, Boolean> DEFAULT_PERMISSIONS_PREDICATE = WidgetGlobalSearchModel$Companion$DEFAULT_PERMISSIONS_PREDICATE$1.INSTANCE;
private static final Pattern DISCRIMINATOR_PATTERN;
private static final int MAX_RESULTS = 50;
public static final int SEARCH_TYPE_GENERAL = 0;
public static final int SEARCH_TYPE_GUILD = 3;
public static final int SEARCH_TYPE_TEXT_CHANNEL = 2;
public static final int SEARCH_TYPE_USER = 1;
public static final int SEARCH_TYPE_VOICE_CHANNEL = 4;
public static final int TYPE_CHANNEL = 0;
public static final int TYPE_GUILD = 2;
public static final int TYPE_HEADER = -1;
public static final int TYPE_USER = 1;
private final List<ItemDataPayload> data;
private final String filter;
private final List<WidgetGlobalSearchGuildsModel.Item> guildsList;
private final int searchType;
/* compiled from: WidgetGlobalSearchModel.kt */
public static final class ChannelContext {
private final Map<Long, Long> channelPerms;
private final Map<Long, Channel> channels;
private final Map<Long, Channel> channelsPrivate;
private final Map<Long, List<Long>> guildToChannels;
private final Map<Long, Guild> guilds;
private final Set<Long> smallGuildIds;
private final Set<Long> unreadChannelIds;
private final Set<Long> unreadGuildIds;
/* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: java.util.Map<java.lang.Long, ? extends java.util.List<java.lang.Long>> */
/* JADX WARN: Multi-variable type inference failed */
public ChannelContext(Map<Long, Guild> map, Map<Long, Channel> map2, Map<Long, Long> map3, Map<Long, Channel> map4, Map<Long, ? extends List<Long>> map5, Set<Long> set, Set<Long> set2) {
m.checkNotNullParameter(map, "guilds");
m.checkNotNullParameter(map2, "channels");
m.checkNotNullParameter(map3, "channelPerms");
m.checkNotNullParameter(map4, "channelsPrivate");
m.checkNotNullParameter(map5, "guildToChannels");
m.checkNotNullParameter(set, "unreadChannelIds");
m.checkNotNullParameter(set2, "unreadGuildIds");
this.guilds = map;
this.channels = map2;
this.channelPerms = map3;
this.channelsPrivate = map4;
this.guildToChannels = map5;
this.unreadChannelIds = set;
this.unreadGuildIds = set2;
LinkedHashMap linkedHashMap = new LinkedHashMap();
for (Map.Entry<Long, Guild> entry : map.entrySet()) {
if (entry.getValue().getMemberCount() <= 200) {
linkedHashMap.put(entry.getKey(), entry.getValue());
}
}
this.smallGuildIds = linkedHashMap.keySet();
}
/* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: com.discord.widgets.user.search.WidgetGlobalSearchModel$ChannelContext */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ ChannelContext copy$default(ChannelContext channelContext, Map map, Map map2, Map map3, Map map4, Map map5, Set set, Set set2, int i, Object obj) {
if ((i & 1) != 0) {
map = channelContext.guilds;
}
if ((i & 2) != 0) {
map2 = channelContext.channels;
}
if ((i & 4) != 0) {
map3 = channelContext.channelPerms;
}
if ((i & 8) != 0) {
map4 = channelContext.channelsPrivate;
}
if ((i & 16) != 0) {
map5 = channelContext.guildToChannels;
}
if ((i & 32) != 0) {
set = channelContext.unreadChannelIds;
}
if ((i & 64) != 0) {
set2 = channelContext.unreadGuildIds;
}
return channelContext.copy(map, map2, map3, map4, map5, set, set2);
}
public final Map<Long, Guild> component1() {
return this.guilds;
}
public final Map<Long, Channel> component2() {
return this.channels;
}
public final Map<Long, Long> component3() {
return this.channelPerms;
}
public final Map<Long, Channel> component4() {
return this.channelsPrivate;
}
public final Map<Long, List<Long>> component5() {
return this.guildToChannels;
}
public final Set<Long> component6() {
return this.unreadChannelIds;
}
public final Set<Long> component7() {
return this.unreadGuildIds;
}
public final ChannelContext copy(Map<Long, Guild> map, Map<Long, Channel> map2, Map<Long, Long> map3, Map<Long, Channel> map4, Map<Long, ? extends List<Long>> map5, Set<Long> set, Set<Long> set2) {
m.checkNotNullParameter(map, "guilds");
m.checkNotNullParameter(map2, "channels");
m.checkNotNullParameter(map3, "channelPerms");
m.checkNotNullParameter(map4, "channelsPrivate");
m.checkNotNullParameter(map5, "guildToChannels");
m.checkNotNullParameter(set, "unreadChannelIds");
m.checkNotNullParameter(set2, "unreadGuildIds");
return new ChannelContext(map, map2, map3, map4, map5, set, set2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ChannelContext)) {
return false;
}
ChannelContext channelContext = (ChannelContext) obj;
return m.areEqual(this.guilds, channelContext.guilds) && m.areEqual(this.channels, channelContext.channels) && m.areEqual(this.channelPerms, channelContext.channelPerms) && m.areEqual(this.channelsPrivate, channelContext.channelsPrivate) && m.areEqual(this.guildToChannels, channelContext.guildToChannels) && m.areEqual(this.unreadChannelIds, channelContext.unreadChannelIds) && m.areEqual(this.unreadGuildIds, channelContext.unreadGuildIds);
}
public final Map<Long, Long> getChannelPerms() {
return this.channelPerms;
}
public final Map<Long, Channel> getChannels() {
return this.channels;
}
public final Map<Long, Channel> getChannelsPrivate() {
return this.channelsPrivate;
}
public final Map<Long, List<Long>> getGuildToChannels() {
return this.guildToChannels;
}
public final Map<Long, Guild> getGuilds() {
return this.guilds;
}
public final Set<Long> getSmallGuildIds() {
return this.smallGuildIds;
}
public final Set<Long> getUnreadChannelIds() {
return this.unreadChannelIds;
}
public final Set<Long> getUnreadGuildIds() {
return this.unreadGuildIds;
}
public int hashCode() {
Map<Long, Guild> map = this.guilds;
int i = 0;
int hashCode = (map != null ? map.hashCode() : 0) * 31;
Map<Long, Channel> map2 = this.channels;
int hashCode2 = (hashCode + (map2 != null ? map2.hashCode() : 0)) * 31;
Map<Long, Long> map3 = this.channelPerms;
int hashCode3 = (hashCode2 + (map3 != null ? map3.hashCode() : 0)) * 31;
Map<Long, Channel> map4 = this.channelsPrivate;
int hashCode4 = (hashCode3 + (map4 != null ? map4.hashCode() : 0)) * 31;
Map<Long, List<Long>> map5 = this.guildToChannels;
int hashCode5 = (hashCode4 + (map5 != null ? map5.hashCode() : 0)) * 31;
Set<Long> set = this.unreadChannelIds;
int hashCode6 = (hashCode5 + (set != null ? set.hashCode() : 0)) * 31;
Set<Long> set2 = this.unreadGuildIds;
if (set2 != null) {
i = set2.hashCode();
}
return hashCode6 + i;
}
public String toString() {
StringBuilder K = a.K("ChannelContext(guilds=");
K.append(this.guilds);
K.append(", channels=");
K.append(this.channels);
K.append(", channelPerms=");
K.append(this.channelPerms);
K.append(", channelsPrivate=");
K.append(this.channelsPrivate);
K.append(", guildToChannels=");
K.append(this.guildToChannels);
K.append(", unreadChannelIds=");
K.append(this.unreadChannelIds);
K.append(", unreadGuildIds=");
K.append(this.unreadGuildIds);
K.append(")");
return K.toString();
}
}
/* compiled from: WidgetGlobalSearchModel.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
/* JADX DEBUG: Multi-variable search result rejected for r7v0, resolved type: com.discord.widgets.user.search.WidgetGlobalSearchModel$Companion */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ WidgetGlobalSearchModel create$default(Companion companion, SearchContext searchContext, UsersContext usersContext, ChannelContext channelContext, WidgetGlobalSearchGuildsModel widgetGlobalSearchGuildsModel, Function1 function1, Function1 function12, int i, Object obj) {
if ((i & 16) != 0) {
function1 = null;
}
if ((i & 32) != 0) {
function12 = WidgetGlobalSearchModel$Companion$create$1.INSTANCE;
}
return companion.create(searchContext, usersContext, channelContext, widgetGlobalSearchGuildsModel, function1, function12);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARNING: Unknown variable types count: 3 */
private final Observable<WidgetGlobalSearchModel> get(Observable<String> observable, Function2<? super Channel, ? super Map<Long, Long>, Boolean> function2, Function1<? super ItemDataPayload, Boolean> function1, Function1<? super SearchContext, Long> function12) {
j jVar = new j("");
StoreStream.Companion companion = StoreStream.Companion;
Observable<List<Long>> observeRecentSelectedGuildIds = companion.getGuildSelected().observeRecentSelectedGuildIds();
Observable<Long> observeId = companion.getChannelsSelected().observeId();
Observable<Long> observePreviousId = companion.getChannelsSelected().observePreviousId();
Observable<Long> observeSelectedVoiceChannelId = companion.getVoiceChannelSelected().observeSelectedVoiceChannelId();
Observable<Map<Long, Long>> observeRecentMessageIds = companion.getMessagesMostRecent().observeRecentMessageIds();
TimeUnit timeUnit = TimeUnit.SECONDS;
Observable leadingEdgeThrottle = ObservableExtensionsKt.leadingEdgeThrottle(observeRecentMessageIds, 10, timeUnit);
Observable<Map<Long, Integer>> observeMentionCounts = companion.getMentions().observeMentionCounts();
WidgetGlobalSearchModel$Companion$get$partialSearchContextObservable$1 widgetGlobalSearchModel$Companion$get$partialSearchContextObservable$1 = WidgetGlobalSearchModel$Companion$get$partialSearchContextObservable$1.INSTANCE;
if (widgetGlobalSearchModel$Companion$get$partialSearchContextObservable$1 != null) {
widgetGlobalSearchModel$Companion$get$partialSearchContextObservable$1 = new WidgetGlobalSearchModel$sam$rx_functions_Func7$0(widgetGlobalSearchModel$Companion$get$partialSearchContextObservable$1);
}
Observable r = ObservableWithLeadingEdgeThrottle.combineLatest(jVar, observeRecentSelectedGuildIds, observeId, observePreviousId, observeSelectedVoiceChannelId, leadingEdgeThrottle, observeMentionCounts, (Func7) widgetGlobalSearchModel$Companion$get$partialSearchContextObservable$1, 2, timeUnit).r();
WidgetGlobalSearchModel$Companion$get$searchContextObservable$1 widgetGlobalSearchModel$Companion$get$searchContextObservable$1 = WidgetGlobalSearchModel$Companion$get$searchContextObservable$1.INSTANCE;
TimeUnit timeUnit2 = TimeUnit.MILLISECONDS;
Observable r2 = ObservableWithLeadingEdgeThrottle.combineLatest(observable, r, widgetGlobalSearchModel$Companion$get$searchContextObservable$1, 250, timeUnit2).r();
Observable<Map<Long, User>> observeAllUsers = companion.getUsers().observeAllUsers();
Observable<Map<Long, Presence>> observeAllPresences = companion.getPresences().observeAllPresences();
Observable<Map<Long, Integer>> observe = companion.getUserRelationships().observe();
Observable<Map<Long, Map<Long, GuildMember>>> observeComputed = companion.getGuilds().observeComputed();
WidgetGlobalSearchModel$Companion$get$usersContextObservable$1 widgetGlobalSearchModel$Companion$get$usersContextObservable$1 = WidgetGlobalSearchModel$Companion$get$usersContextObservable$1.INSTANCE;
if (widgetGlobalSearchModel$Companion$get$usersContextObservable$1 != null) {
widgetGlobalSearchModel$Companion$get$usersContextObservable$1 = new WidgetGlobalSearchModel$sam$rx_functions_Func4$0(widgetGlobalSearchModel$Companion$get$usersContextObservable$1);
}
Observable r3 = ObservableWithLeadingEdgeThrottle.combineLatest(observeAllUsers, observeAllPresences, observe, observeComputed, (Func4) widgetGlobalSearchModel$Companion$get$usersContextObservable$1, 10, timeUnit).r();
Observable<Map<Long, Guild>> observeGuilds = companion.getGuilds().observeGuilds();
Observable<Map<Long, Channel>> observeGuildAndPrivateChannels = companion.getChannels().observeGuildAndPrivateChannels();
Observable<Map<Long, Long>> observePermissionsForAllChannels = companion.getPermissions().observePermissionsForAllChannels();
Observable<Map<Long, Channel>> observePrivateChannels = companion.getChannels().observePrivateChannels();
Observable observeIds$default = StoreChannels.observeIds$default(companion.getChannels(), false, 1, null);
Observable<Set<Long>> unreadChannelIds = companion.getReadStates().getUnreadChannelIds();
Observable<Set<Long>> unreadGuildIds = companion.getReadStates().getUnreadGuildIds();
WidgetGlobalSearchModel$Companion$get$channelContextObservable$1 widgetGlobalSearchModel$Companion$get$channelContextObservable$1 = WidgetGlobalSearchModel$Companion$get$channelContextObservable$1.INSTANCE;
if (widgetGlobalSearchModel$Companion$get$channelContextObservable$1 != null) {
widgetGlobalSearchModel$Companion$get$channelContextObservable$1 = new WidgetGlobalSearchModel$sam$rx_functions_Func7$0(widgetGlobalSearchModel$Companion$get$channelContextObservable$1);
}
Observable r4 = ObservableWithLeadingEdgeThrottle.combineLatest(observeGuilds, observeGuildAndPrivateChannels, observePermissionsForAllChannels, observePrivateChannels, observeIds$default, unreadChannelIds, unreadGuildIds, (Func7) widgetGlobalSearchModel$Companion$get$channelContextObservable$1, 3, timeUnit).F(new WidgetGlobalSearchModel$Companion$get$channelContextObservable$2(function2)).r();
Observable<WidgetGlobalSearchModel> r5 = ObservableWithLeadingEdgeThrottle.combineLatest(r2, r3, r4, ObservableWithLeadingEdgeThrottle.combineLatest(r2, r4, companion.getUserGuildSettings().observeGuildSettings(), companion.getGuildsSorted().observeOrderedGuilds(), WidgetGlobalSearchModel$Companion$get$guildsListObservable$1.INSTANCE, 5, timeUnit).r(), new j(function1), new j(function12), new WidgetGlobalSearchModel$sam$rx_functions_Func6$0(new WidgetGlobalSearchModel$Companion$get$1(this)), 200, timeUnit2).r();
m.checkNotNullExpressionValue(r5, "ObservableWithLeadingEdg… .distinctUntilChanged()");
return r5;
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.user.search.WidgetGlobalSearchModel$Companion */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ Observable get$default(Companion companion, Observable observable, Function2 function2, Function1 function1, Function1 function12, int i, Object obj) {
if ((i & 4) != 0) {
function1 = null;
}
return companion.get(observable, function2, function1, function12);
}
private final Sequence<User> getDefaultUserSearch(SearchContext searchContext, ChannelContext channelContext, UsersContext usersContext, Set<Long> set) {
Sequence mapNotNull = q.mapNotNull(getRecentChannelIds(searchContext), new WidgetGlobalSearchModel$Companion$getDefaultUserSearch$recentDmUserIds$1(channelContext));
return q.filterNot(q.take(q.mapNotNull(q.distinct(q.plus(q.plus(mapNotNull, (Iterable) set), n.flattenSequenceOfIterable(q.mapNotNull(u.asSequence(channelContext.getSmallGuildIds()), new WidgetGlobalSearchModel$Companion$getDefaultUserSearch$smallGuildUserIds$1(usersContext))))), new WidgetGlobalSearchModel$Companion$getDefaultUserSearch$1(usersContext)), 100), WidgetGlobalSearchModel$Companion$getDefaultUserSearch$2.INSTANCE);
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.user.search.WidgetGlobalSearchModel$Companion */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ Observable getForSend$default(Companion companion, Observable observable, Function1 function1, int i, Object obj) {
if ((i & 2) != 0) {
function1 = null;
}
return companion.getForSend(observable, function1);
}
private final Sequence<Long> getRecentChannelIds(SearchContext searchContext) {
return searchContext.getFrecencyChannels().isEmpty() ^ true ? u.asSequence(searchContext.getFrecencyChannels()) : q.map(q.take(u.asSequence(u.sortedWith(searchContext.getMostRecent().entrySet(), new WidgetGlobalSearchModel$Companion$getRecentChannelIds$$inlined$sortedBy$1())), 50), WidgetGlobalSearchModel$Companion$getRecentChannelIds$2.INSTANCE);
}
public final WidgetGlobalSearchModel create(SearchContext searchContext, UsersContext usersContext, ChannelContext channelContext, WidgetGlobalSearchGuildsModel widgetGlobalSearchGuildsModel, Function1<? super ItemDataPayload, Boolean> function1, Function1<? super SearchContext, Long> function12) {
Set<Long> set;
Sequence sequence;
Sequence sequence2;
m.checkNotNullParameter(searchContext, "searchContext");
m.checkNotNullParameter(usersContext, "usersContext");
m.checkNotNullParameter(channelContext, "channelContext");
m.checkNotNullParameter(widgetGlobalSearchGuildsModel, "widgetGuildsListModel");
m.checkNotNullParameter(function12, "lastChannelIdProvider");
WidgetGlobalSearchModel$Companion$create$2 widgetGlobalSearchModel$Companion$create$2 = new WidgetGlobalSearchModel$Companion$create$2(usersContext, searchContext, channelContext);
WidgetGlobalSearchModel$Companion$create$3 widgetGlobalSearchModel$Companion$create$3 = new WidgetGlobalSearchModel$Companion$create$3(channelContext, searchContext);
WidgetGlobalSearchModel$Companion$create$4 widgetGlobalSearchModel$Companion$create$4 = new WidgetGlobalSearchModel$Companion$create$4(channelContext, widgetGlobalSearchModel$Companion$create$2, searchContext);
int searchType = searchContext.getSearchType();
String sanitizedFilter = searchContext.getSanitizedFilter();
Map<Long, GuildMember> map = usersContext.getMembers().get(u.first((List<? extends Object>) searchContext.getRecentGuildIds()));
if (map == null || (set = map.keySet()) == null) {
set = n0.emptySet();
}
if (searchType != 1) {
if (searchType == 2) {
sequence2 = q.mapNotNull(q.filter(u.asSequence(channelContext.getChannels().values()), WidgetGlobalSearchModel$Companion$create$filteredResults$3.INSTANCE), new WidgetGlobalSearchModel$Companion$create$filteredResults$4(widgetGlobalSearchModel$Companion$create$4, sanitizedFilter));
} else if (searchType == 3) {
sequence2 = q.mapNotNull(u.asSequence(channelContext.getGuilds().values()), new WidgetGlobalSearchModel$Companion$create$filteredResults$2(widgetGlobalSearchModel$Companion$create$3, sanitizedFilter));
} else if (searchType == 4) {
sequence2 = q.sortedWith(q.mapNotNull(q.filter(q.filter(u.asSequence(channelContext.getChannels().values()), WidgetGlobalSearchModel$Companion$create$filteredResults$5.INSTANCE), new WidgetGlobalSearchModel$Companion$create$filteredResults$6(channelContext)), new WidgetGlobalSearchModel$Companion$create$filteredResults$7(widgetGlobalSearchModel$Companion$create$4, sanitizedFilter)), new WidgetGlobalSearchModel$Companion$create$$inlined$sortedBy$1(searchContext));
} else if (t.isBlank(sanitizedFilter)) {
sequence2 = q.mapNotNull(q.filter(q.mapNotNull(u.asSequence(u.union(searchContext.getMentionCounts().keySet(), q.asIterable(getRecentChannelIds(searchContext)))), new WidgetGlobalSearchModel$Companion$create$filteredResults$9(channelContext)), WidgetGlobalSearchModel$Companion$create$filteredResults$10.INSTANCE), new WidgetGlobalSearchModel$Companion$create$filteredResults$11(widgetGlobalSearchModel$Companion$create$4, sanitizedFilter));
} else {
HashSet hashSet = new HashSet();
sequence2 = q.plus(q.mapNotNull(q.filter(u.asSequence(channelContext.getChannels().values()), WidgetGlobalSearchModel$Companion$create$filteredResults$channelResults$1.INSTANCE), new WidgetGlobalSearchModel$Companion$create$filteredResults$channelResults$2(hashSet, widgetGlobalSearchModel$Companion$create$2, usersContext, sanitizedFilter, widgetGlobalSearchModel$Companion$create$4)), q.mapNotNull(q.filterNot(u.asSequence(set), new WidgetGlobalSearchModel$Companion$create$filteredResults$selectedGuildUserResults$1(hashSet)), new WidgetGlobalSearchModel$Companion$create$filteredResults$selectedGuildUserResults$2(widgetGlobalSearchModel$Companion$create$2, usersContext, sanitizedFilter)));
}
sequence = sequence2;
} else {
sequence = q.mapNotNull(t.isBlank(sanitizedFilter) ? getDefaultUserSearch(searchContext, channelContext, usersContext, set) : u.asSequence(usersContext.getUsers().values()), new WidgetGlobalSearchModel$Companion$create$filteredResults$1(widgetGlobalSearchModel$Companion$create$2, sanitizedFilter));
}
if (function1 != null) {
sequence = q.filter(sequence, function1);
}
Sequence take = q.take(q.sortedWith(sequence, new WidgetGlobalSearchModel$Companion$create$$inlined$sortedByDescending$1(searchContext)), 50);
if (searchType == 0 && t.isBlank(searchContext.getFilter())) {
Channel channel = channelContext.getChannels().get(function12.invoke(searchContext));
ItemDataPayload invoke = channel != null ? widgetGlobalSearchModel$Companion$create$4.invoke(channel, "") : null;
return new WidgetGlobalSearchModel(sanitizedFilter, searchType, q.toList(invoke == null ? q.plus(n.sequenceOf(new ItemHeader(2131893902, 0, false, 6, null)), take) : q.plus(q.plus(n.sequenceOf(new ItemHeader(2131892656, 0, false, 6, null), invoke), n.sequenceOf(new ItemHeader(2131893902, 0, false, 6, null))), q.filterNot(take, new WidgetGlobalSearchModel$Companion$create$results$1(channel)))), widgetGlobalSearchGuildsModel.getItems());
}
if (q.firstOrNull(take) != null) {
take = q.plus(n.sequenceOf(new ItemHeader(2131893902, 0, false, 6, null)), take);
}
return new WidgetGlobalSearchModel(sanitizedFilter, searchType, q.toList(take), null, 8, null);
}
public final MatchedResult getEMPTY_MATCH_RESULT() {
return new MatchedResult("", -1, 0);
}
public final Observable<WidgetGlobalSearchModel> getForNav(Observable<String> observable) {
m.checkNotNullParameter(observable, "filterPublisher");
return get$default(this, observable, WidgetGlobalSearchModel.access$getDEFAULT_PERMISSIONS_PREDICATE$cp(), null, WidgetGlobalSearchModel$Companion$getForNav$1.INSTANCE, 4, null);
}
public final Observable<WidgetGlobalSearchModel> getForSend(Observable<String> observable, Function1<? super ItemDataPayload, Boolean> function1) {
m.checkNotNullParameter(observable, "filterPublisher");
return get(observable, WidgetGlobalSearchModel$Companion$getForSend$1.INSTANCE, function1, WidgetGlobalSearchModel$Companion$getForSend$2.INSTANCE);
}
public final MatchedResult toFuzzyMatchedResult(String str, String str2) {
m.checkNotNullParameter(str, "$this$toFuzzyMatchedResult");
m.checkNotNullParameter(str2, "filter");
SearchUtils searchUtils = SearchUtils.INSTANCE;
Locale locale = Locale.ROOT;
m.checkNotNullExpressionValue(locale, "Locale.ROOT");
String lowerCase = str2.toLowerCase(locale);
m.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase(locale)");
m.checkNotNullExpressionValue(locale, "Locale.ROOT");
String lowerCase2 = str.toLowerCase(locale);
m.checkNotNullExpressionValue(lowerCase2, "(this as java.lang.String).toLowerCase(locale)");
if (searchUtils.fuzzyMatch(lowerCase, StringUtilsKt.stripAccents(lowerCase2))) {
return new MatchedResult(str, -1, str2.length());
}
return null;
}
public final MatchedResult toMatchedResult(String str, String str2) {
m.checkNotNullParameter(str, "$this$toMatchedResult");
m.checkNotNullParameter(str2, "filter");
int indexOf$default = w.indexOf$default((CharSequence) str, str2, 0, true, 2, (Object) null);
if (indexOf$default != -1) {
return new MatchedResult(str, indexOf$default, str2.length());
}
return null;
}
}
/* compiled from: WidgetGlobalSearchModel.kt */
public static final class ItemChannel implements ItemDataPayload {
private final Channel channel;
private final Guild guild;
private final String key;
private final MatchedResult matchedResult;
private final int mentions;
private final Channel parentChannel;
private final int type;
private final boolean unread;
public ItemChannel(MatchedResult matchedResult, Channel channel, Channel channel2, Guild guild, int i, boolean z2) {
m.checkNotNullParameter(matchedResult, "matchedResult");
m.checkNotNullParameter(channel, "channel");
this.matchedResult = matchedResult;
this.channel = channel;
this.parentChannel = channel2;
this.guild = guild;
this.mentions = i;
this.unread = z2;
this.key = String.valueOf(getChannel().h());
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ ItemChannel(MatchedResult matchedResult, Channel channel, Channel channel2, Guild guild, int i, boolean z2, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(matchedResult, channel, channel2, guild, (i2 & 16) != 0 ? 0 : i, (i2 & 32) != 0 ? false : z2);
}
public static /* synthetic */ ItemChannel copy$default(ItemChannel itemChannel, MatchedResult matchedResult, Channel channel, Channel channel2, Guild guild, int i, boolean z2, int i2, Object obj) {
if ((i2 & 1) != 0) {
matchedResult = itemChannel.getMatchedResult();
}
if ((i2 & 2) != 0) {
channel = itemChannel.getChannel();
}
if ((i2 & 4) != 0) {
channel2 = itemChannel.parentChannel;
}
if ((i2 & 8) != 0) {
guild = itemChannel.guild;
}
if ((i2 & 16) != 0) {
i = itemChannel.getMentions();
}
if ((i2 & 32) != 0) {
z2 = itemChannel.getUnread();
}
return itemChannel.copy(matchedResult, channel, channel2, guild, i, z2);
}
public final MatchedResult component1() {
return getMatchedResult();
}
public final Channel component2() {
return getChannel();
}
public final Channel component3() {
return this.parentChannel;
}
public final Guild component4() {
return this.guild;
}
public final int component5() {
return getMentions();
}
public final boolean component6() {
return getUnread();
}
public final ItemChannel copy(MatchedResult matchedResult, Channel channel, Channel channel2, Guild guild, int i, boolean z2) {
m.checkNotNullParameter(matchedResult, "matchedResult");
m.checkNotNullParameter(channel, "channel");
return new ItemChannel(matchedResult, channel, channel2, guild, i, z2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ItemChannel)) {
return false;
}
ItemChannel itemChannel = (ItemChannel) obj;
return m.areEqual(getMatchedResult(), itemChannel.getMatchedResult()) && m.areEqual(getChannel(), itemChannel.getChannel()) && m.areEqual(this.parentChannel, itemChannel.parentChannel) && m.areEqual(this.guild, itemChannel.guild) && getMentions() == itemChannel.getMentions() && getUnread() == itemChannel.getUnread();
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public Channel getChannel() {
return this.channel;
}
public final Guild getGuild() {
return this.guild;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return this.key;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public MatchedResult getMatchedResult() {
return this.matchedResult;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public int getMentions() {
return this.mentions;
}
public final Channel getParentChannel() {
return this.parentChannel;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return this.type;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public boolean getUnread() {
return this.unread;
}
public int hashCode() {
MatchedResult matchedResult = getMatchedResult();
int i = 0;
int hashCode = (matchedResult != null ? matchedResult.hashCode() : 0) * 31;
Channel channel = getChannel();
int hashCode2 = (hashCode + (channel != null ? channel.hashCode() : 0)) * 31;
Channel channel2 = this.parentChannel;
int hashCode3 = (hashCode2 + (channel2 != null ? channel2.hashCode() : 0)) * 31;
Guild guild = this.guild;
if (guild != null) {
i = guild.hashCode();
}
int mentions = (getMentions() + ((hashCode3 + i) * 31)) * 31;
boolean unread = getUnread();
if (unread) {
unread = true;
}
int i2 = unread ? 1 : 0;
int i3 = unread ? 1 : 0;
int i4 = unread ? 1 : 0;
return mentions + i2;
}
public String toString() {
String y0 = AnimatableValueParser.y0(getChannel());
return String.valueOf('#') + y0;
}
}
/* compiled from: WidgetGlobalSearchModel.kt */
public interface ItemDataPayload extends MGRecyclerDataPayload {
Channel getChannel();
MatchedResult getMatchedResult();
int getMentions();
boolean getUnread();
}
/* compiled from: WidgetGlobalSearchModel.kt */
public static final class ItemGuild implements ItemDataPayload {
private final Channel channel;
private final Guild guild;
private final String key;
private final MatchedResult matchedResult;
private final int mentions;
private final int type;
private final boolean unread;
public ItemGuild(MatchedResult matchedResult, Guild guild, Channel channel, int i, boolean z2) {
m.checkNotNullParameter(matchedResult, "matchedResult");
m.checkNotNullParameter(guild, "guild");
this.matchedResult = matchedResult;
this.guild = guild;
this.channel = channel;
this.mentions = i;
this.unread = z2;
this.type = 2;
this.key = String.valueOf(guild.getId());
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ ItemGuild(MatchedResult matchedResult, Guild guild, Channel channel, int i, boolean z2, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(matchedResult, guild, (i2 & 4) != 0 ? null : channel, (i2 & 8) != 0 ? 0 : i, (i2 & 16) != 0 ? false : z2);
}
public static /* synthetic */ ItemGuild copy$default(ItemGuild itemGuild, MatchedResult matchedResult, Guild guild, Channel channel, int i, boolean z2, int i2, Object obj) {
if ((i2 & 1) != 0) {
matchedResult = itemGuild.getMatchedResult();
}
if ((i2 & 2) != 0) {
guild = itemGuild.guild;
}
if ((i2 & 4) != 0) {
channel = itemGuild.getChannel();
}
if ((i2 & 8) != 0) {
i = itemGuild.getMentions();
}
if ((i2 & 16) != 0) {
z2 = itemGuild.getUnread();
}
return itemGuild.copy(matchedResult, guild, channel, i, z2);
}
public final MatchedResult component1() {
return getMatchedResult();
}
public final Guild component2() {
return this.guild;
}
public final Channel component3() {
return getChannel();
}
public final int component4() {
return getMentions();
}
public final boolean component5() {
return getUnread();
}
public final ItemGuild copy(MatchedResult matchedResult, Guild guild, Channel channel, int i, boolean z2) {
m.checkNotNullParameter(matchedResult, "matchedResult");
m.checkNotNullParameter(guild, "guild");
return new ItemGuild(matchedResult, guild, channel, i, z2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ItemGuild)) {
return false;
}
ItemGuild itemGuild = (ItemGuild) obj;
return m.areEqual(getMatchedResult(), itemGuild.getMatchedResult()) && m.areEqual(this.guild, itemGuild.guild) && m.areEqual(getChannel(), itemGuild.getChannel()) && getMentions() == itemGuild.getMentions() && getUnread() == itemGuild.getUnread();
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public Channel getChannel() {
return this.channel;
}
public final Guild getGuild() {
return this.guild;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return this.key;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public MatchedResult getMatchedResult() {
return this.matchedResult;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public int getMentions() {
return this.mentions;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return this.type;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public boolean getUnread() {
return this.unread;
}
public int hashCode() {
MatchedResult matchedResult = getMatchedResult();
int i = 0;
int hashCode = (matchedResult != null ? matchedResult.hashCode() : 0) * 31;
Guild guild = this.guild;
int hashCode2 = (hashCode + (guild != null ? guild.hashCode() : 0)) * 31;
Channel channel = getChannel();
if (channel != null) {
i = channel.hashCode();
}
int mentions = (getMentions() + ((hashCode2 + i) * 31)) * 31;
boolean unread = getUnread();
if (unread) {
unread = true;
}
int i2 = unread ? 1 : 0;
int i3 = unread ? 1 : 0;
int i4 = unread ? 1 : 0;
return mentions + i2;
}
public String toString() {
String name = this.guild.getName();
return String.valueOf('*') + name;
}
}
/* compiled from: WidgetGlobalSearchModel.kt */
public static final class ItemHeader implements ItemDataPayload {
private final Channel channel;
private final String key;
private final MatchedResult matchedResult;
private final int mentions;
private final int name;
private final int type;
private final boolean unread;
public ItemHeader(@StringRes int i, int i2, boolean z2) {
this.name = i;
this.mentions = i2;
this.unread = z2;
this.matchedResult = WidgetGlobalSearchModel.Companion.getEMPTY_MATCH_RESULT();
this.type = -1;
this.key = a.j("header", i);
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ ItemHeader(int i, int i2, boolean z2, int i3, DefaultConstructorMarker defaultConstructorMarker) {
this(i, (i3 & 2) != 0 ? 0 : i2, (i3 & 4) != 0 ? false : z2);
}
public static /* synthetic */ ItemHeader copy$default(ItemHeader itemHeader, int i, int i2, boolean z2, int i3, Object obj) {
if ((i3 & 1) != 0) {
i = itemHeader.name;
}
if ((i3 & 2) != 0) {
i2 = itemHeader.getMentions();
}
if ((i3 & 4) != 0) {
z2 = itemHeader.getUnread();
}
return itemHeader.copy(i, i2, z2);
}
public final int component1() {
return this.name;
}
public final int component2() {
return getMentions();
}
public final boolean component3() {
return getUnread();
}
public final ItemHeader copy(@StringRes int i, int i2, boolean z2) {
return new ItemHeader(i, i2, z2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ItemHeader)) {
return false;
}
ItemHeader itemHeader = (ItemHeader) obj;
return this.name == itemHeader.name && getMentions() == itemHeader.getMentions() && getUnread() == itemHeader.getUnread();
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public Channel getChannel() {
return this.channel;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return this.key;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public MatchedResult getMatchedResult() {
return this.matchedResult;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public int getMentions() {
return this.mentions;
}
public final int getName() {
return this.name;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return this.type;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public boolean getUnread() {
return this.unread;
}
public int hashCode() {
int mentions = (getMentions() + (this.name * 31)) * 31;
boolean unread = getUnread();
if (unread) {
unread = true;
}
int i = unread ? 1 : 0;
int i2 = unread ? 1 : 0;
int i3 = unread ? 1 : 0;
return mentions + i;
}
public String toString() {
StringBuilder K = a.K("ItemHeader(name=");
K.append(this.name);
K.append(", mentions=");
K.append(getMentions());
K.append(", unread=");
K.append(getUnread());
K.append(")");
return K.toString();
}
}
/* compiled from: WidgetGlobalSearchModel.kt */
public static final class ItemUser implements ItemDataPayload {
private final List<CharSequence> aliases;
private final Channel channel;
private final boolean isFriend;
private final String key;
private final MatchedResult matchedResult;
private final int mentions;
private final Presence presence;
private final int type;
private final boolean unread;
private final User user;
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.List<? extends java.lang.CharSequence> */
/* JADX WARN: Multi-variable type inference failed */
public ItemUser(MatchedResult matchedResult, User user, List<? extends CharSequence> list, boolean z2, Presence presence, Channel channel, int i, boolean z3) {
m.checkNotNullParameter(matchedResult, "matchedResult");
m.checkNotNullParameter(user, "user");
m.checkNotNullParameter(list, "aliases");
this.matchedResult = matchedResult;
this.user = user;
this.aliases = list;
this.isFriend = z2;
this.presence = presence;
this.channel = channel;
this.mentions = i;
this.unread = z3;
this.type = 1;
this.key = String.valueOf(user.getId());
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ ItemUser(MatchedResult matchedResult, User user, List list, boolean z2, Presence presence, Channel channel, int i, boolean z3, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(matchedResult, user, list, (i2 & 8) != 0 ? false : z2, presence, (i2 & 32) != 0 ? null : channel, (i2 & 64) != 0 ? 0 : i, (i2 & 128) != 0 ? false : z3);
}
public static /* synthetic */ ItemUser copy$default(ItemUser itemUser, MatchedResult matchedResult, User user, List list, boolean z2, Presence presence, Channel channel, int i, boolean z3, int i2, Object obj) {
return itemUser.copy((i2 & 1) != 0 ? itemUser.getMatchedResult() : matchedResult, (i2 & 2) != 0 ? itemUser.user : user, (i2 & 4) != 0 ? itemUser.aliases : list, (i2 & 8) != 0 ? itemUser.isFriend : z2, (i2 & 16) != 0 ? itemUser.presence : presence, (i2 & 32) != 0 ? itemUser.getChannel() : channel, (i2 & 64) != 0 ? itemUser.getMentions() : i, (i2 & 128) != 0 ? itemUser.getUnread() : z3);
}
public final MatchedResult component1() {
return getMatchedResult();
}
public final User component2() {
return this.user;
}
public final List<CharSequence> component3() {
return this.aliases;
}
public final boolean component4() {
return this.isFriend;
}
public final Presence component5() {
return this.presence;
}
public final Channel component6() {
return getChannel();
}
public final int component7() {
return getMentions();
}
public final boolean component8() {
return getUnread();
}
public final ItemUser copy(MatchedResult matchedResult, User user, List<? extends CharSequence> list, boolean z2, Presence presence, Channel channel, int i, boolean z3) {
m.checkNotNullParameter(matchedResult, "matchedResult");
m.checkNotNullParameter(user, "user");
m.checkNotNullParameter(list, "aliases");
return new ItemUser(matchedResult, user, list, z2, presence, channel, i, z3);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ItemUser)) {
return false;
}
ItemUser itemUser = (ItemUser) obj;
return m.areEqual(getMatchedResult(), itemUser.getMatchedResult()) && m.areEqual(this.user, itemUser.user) && m.areEqual(this.aliases, itemUser.aliases) && this.isFriend == itemUser.isFriend && m.areEqual(this.presence, itemUser.presence) && m.areEqual(getChannel(), itemUser.getChannel()) && getMentions() == itemUser.getMentions() && getUnread() == itemUser.getUnread();
}
public final List<CharSequence> getAliases() {
return this.aliases;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public Channel getChannel() {
return this.channel;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload, com.discord.utilities.recycler.DiffKeyProvider
public String getKey() {
return this.key;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public MatchedResult getMatchedResult() {
return this.matchedResult;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public int getMentions() {
return this.mentions;
}
public final Presence getPresence() {
return this.presence;
}
@Override // com.discord.utilities.mg_recycler.MGRecyclerDataPayload
public int getType() {
return this.type;
}
@Override // com.discord.widgets.user.search.WidgetGlobalSearchModel.ItemDataPayload
public boolean getUnread() {
return this.unread;
}
public final User getUser() {
return this.user;
}
public int hashCode() {
MatchedResult matchedResult = getMatchedResult();
int i = 0;
int hashCode = (matchedResult != null ? matchedResult.hashCode() : 0) * 31;
User user = this.user;
int hashCode2 = (hashCode + (user != null ? user.hashCode() : 0)) * 31;
List<CharSequence> list = this.aliases;
int hashCode3 = (hashCode2 + (list != null ? list.hashCode() : 0)) * 31;
boolean z2 = this.isFriend;
int i2 = 1;
if (z2) {
z2 = true;
}
int i3 = z2 ? 1 : 0;
int i4 = z2 ? 1 : 0;
int i5 = z2 ? 1 : 0;
int i6 = (hashCode3 + i3) * 31;
Presence presence = this.presence;
int hashCode4 = (i6 + (presence != null ? presence.hashCode() : 0)) * 31;
Channel channel = getChannel();
if (channel != null) {
i = channel.hashCode();
}
int mentions = (getMentions() + ((hashCode4 + i) * 31)) * 31;
boolean unread = getUnread();
if (!unread) {
i2 = unread;
}
return mentions + i2;
}
public final boolean isFriend() {
return this.isFriend;
}
public String toString() {
StringBuilder H = a.H('@');
H.append(getMatchedResult().getValue());
return H.toString();
}
}
/* compiled from: WidgetGlobalSearchModel.kt */
public static final class MatchedResult {
private final int filterLength;
private final int firstMatchIndex;
private final CharSequence value;
public MatchedResult(CharSequence charSequence, int i, int i2) {
m.checkNotNullParameter(charSequence, "value");
this.value = charSequence;
this.firstMatchIndex = i;
this.filterLength = i2;
}
public static /* synthetic */ MatchedResult copy$default(MatchedResult matchedResult, CharSequence charSequence, int i, int i2, int i3, Object obj) {
if ((i3 & 1) != 0) {
charSequence = matchedResult.value;
}
if ((i3 & 2) != 0) {
i = matchedResult.firstMatchIndex;
}
if ((i3 & 4) != 0) {
i2 = matchedResult.filterLength;
}
return matchedResult.copy(charSequence, i, i2);
}
public final CharSequence component1() {
return this.value;
}
public final int component2() {
return this.firstMatchIndex;
}
public final int component3() {
return this.filterLength;
}
public final MatchedResult copy(CharSequence charSequence, int i, int i2) {
m.checkNotNullParameter(charSequence, "value");
return new MatchedResult(charSequence, i, i2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof MatchedResult)) {
return false;
}
MatchedResult matchedResult = (MatchedResult) obj;
return m.areEqual(this.value, matchedResult.value) && this.firstMatchIndex == matchedResult.firstMatchIndex && this.filterLength == matchedResult.filterLength;
}
public final int getFilterLength() {
return this.filterLength;
}
public final int getFirstMatchIndex() {
return this.firstMatchIndex;
}
public final CharSequence getValue() {
return this.value;
}
public int hashCode() {
CharSequence charSequence = this.value;
return ((((charSequence != null ? charSequence.hashCode() : 0) * 31) + this.firstMatchIndex) * 31) + this.filterLength;
}
public String toString() {
StringBuilder K = a.K("MatchedResult(value=");
K.append(this.value);
K.append(", firstMatchIndex=");
K.append(this.firstMatchIndex);
K.append(", filterLength=");
return a.w(K, this.filterLength, ")");
}
}
/* compiled from: WidgetGlobalSearchModel.kt */
public static final class SearchContext {
private final String filter;
private final Collection<Long> frecencyChannels = FrecencyTracker.getSortedKeys$default(StoreStream.Companion.getChannelsSelected().getFrecency(), 0, 1, null);
private final boolean hasDiscriminator;
private final Map<Long, Integer> mentionCounts;
private final Map<Long, Long> mostRecent;
private final long prevSelectedChannelId;
private final List<Long> recentGuildIds;
private final String sanitizedFilter;
private final int searchType;
private final long selectedChannelId;
private final long selectedVoiceChannelId;
public SearchContext(String str, List<Long> list, long j, long j2, long j3, Map<Long, Long> map, Map<Long, Integer> map2) {
String str2;
m.checkNotNullParameter(str, "filter");
m.checkNotNullParameter(list, "recentGuildIds");
m.checkNotNullParameter(map, "mostRecent");
m.checkNotNullParameter(map2, "mentionCounts");
this.filter = str;
this.recentGuildIds = list;
this.selectedChannelId = j;
this.prevSelectedChannelId = j2;
this.selectedVoiceChannelId = j3;
this.mostRecent = map;
this.mentionCounts = map2;
Character firstOrNull = y.firstOrNull(str);
boolean z2 = false;
int i = (firstOrNull != null && firstOrNull.charValue() == '@') ? 1 : (firstOrNull != null && firstOrNull.charValue() == '#') ? 2 : (firstOrNull != null && firstOrNull.charValue() == '!') ? 4 : (firstOrNull != null && firstOrNull.charValue() == '*') ? 3 : 0;
this.searchType = i;
if (i != 0) {
Objects.requireNonNull(str, "null cannot be cast to non-null type java.lang.String");
str2 = str.substring(1);
m.checkNotNullExpressionValue(str2, "(this as java.lang.String).substring(startIndex)");
} else {
str2 = str;
}
this.sanitizedFilter = str2;
this.hasDiscriminator = (i == 0 || i == 1) ? WidgetGlobalSearchModel.access$getDISCRIMINATOR_PATTERN$cp().matcher(str).find() : z2;
}
public static /* synthetic */ SearchContext copy$default(SearchContext searchContext, String str, List list, long j, long j2, long j3, Map map, Map map2, int i, Object obj) {
return searchContext.copy((i & 1) != 0 ? searchContext.filter : str, (i & 2) != 0 ? searchContext.recentGuildIds : list, (i & 4) != 0 ? searchContext.selectedChannelId : j, (i & 8) != 0 ? searchContext.prevSelectedChannelId : j2, (i & 16) != 0 ? searchContext.selectedVoiceChannelId : j3, (i & 32) != 0 ? searchContext.mostRecent : map, (i & 64) != 0 ? searchContext.mentionCounts : map2);
}
public final String component1() {
return this.filter;
}
public final List<Long> component2() {
return this.recentGuildIds;
}
public final long component3() {
return this.selectedChannelId;
}
public final long component4() {
return this.prevSelectedChannelId;
}
public final long component5() {
return this.selectedVoiceChannelId;
}
public final Map<Long, Long> component6() {
return this.mostRecent;
}
public final Map<Long, Integer> component7() {
return this.mentionCounts;
}
public final SearchContext copy(String str, List<Long> list, long j, long j2, long j3, Map<Long, Long> map, Map<Long, Integer> map2) {
m.checkNotNullParameter(str, "filter");
m.checkNotNullParameter(list, "recentGuildIds");
m.checkNotNullParameter(map, "mostRecent");
m.checkNotNullParameter(map2, "mentionCounts");
return new SearchContext(str, list, j, j2, j3, map, map2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof SearchContext)) {
return false;
}
SearchContext searchContext = (SearchContext) obj;
return m.areEqual(this.filter, searchContext.filter) && m.areEqual(this.recentGuildIds, searchContext.recentGuildIds) && this.selectedChannelId == searchContext.selectedChannelId && this.prevSelectedChannelId == searchContext.prevSelectedChannelId && this.selectedVoiceChannelId == searchContext.selectedVoiceChannelId && m.areEqual(this.mostRecent, searchContext.mostRecent) && m.areEqual(this.mentionCounts, searchContext.mentionCounts);
}
public final String getFilter() {
return this.filter;
}
public final Collection<Long> getFrecencyChannels() {
return this.frecencyChannels;
}
public final boolean getHasDiscriminator() {
return this.hasDiscriminator;
}
public final Map<Long, Integer> getMentionCounts() {
return this.mentionCounts;
}
public final Map<Long, Long> getMostRecent() {
return this.mostRecent;
}
public final long getPrevSelectedChannelId() {
return this.prevSelectedChannelId;
}
public final List<Long> getRecentGuildIds() {
return this.recentGuildIds;
}
public final String getSanitizedFilter() {
return this.sanitizedFilter;
}
public final int getSearchType() {
return this.searchType;
}
public final long getSelectedChannelId() {
return this.selectedChannelId;
}
public final long getSelectedVoiceChannelId() {
return this.selectedVoiceChannelId;
}
public int hashCode() {
String str = this.filter;
int i = 0;
int hashCode = (str != null ? str.hashCode() : 0) * 31;
List<Long> list = this.recentGuildIds;
int a = (b.a(this.selectedVoiceChannelId) + ((b.a(this.prevSelectedChannelId) + ((b.a(this.selectedChannelId) + ((hashCode + (list != null ? list.hashCode() : 0)) * 31)) * 31)) * 31)) * 31;
Map<Long, Long> map = this.mostRecent;
int hashCode2 = (a + (map != null ? map.hashCode() : 0)) * 31;
Map<Long, Integer> map2 = this.mentionCounts;
if (map2 != null) {
i = map2.hashCode();
}
return hashCode2 + i;
}
public String toString() {
StringBuilder K = a.K("SearchContext(filter=");
K.append(this.filter);
K.append(", recentGuildIds=");
K.append(this.recentGuildIds);
K.append(", selectedChannelId=");
K.append(this.selectedChannelId);
K.append(", prevSelectedChannelId=");
K.append(this.prevSelectedChannelId);
K.append(", selectedVoiceChannelId=");
K.append(this.selectedVoiceChannelId);
K.append(", mostRecent=");
K.append(this.mostRecent);
K.append(", mentionCounts=");
return a.E(K, this.mentionCounts, ")");
}
}
/* compiled from: WidgetGlobalSearchModel.kt */
public static final class UsersContext {
private final Map<Long, Map<Long, GuildMember>> members;
private final Map<Long, Presence> presences;
private final Map<Long, Integer> relationships;
private final Map<Long, User> users;
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: java.util.Map<java.lang.Long, ? extends com.discord.models.user.User> */
/* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: java.util.Map<java.lang.Long, ? extends java.util.Map<java.lang.Long, com.discord.models.member.GuildMember>> */
/* JADX WARN: Multi-variable type inference failed */
public UsersContext(Map<Long, ? extends User> map, Map<Long, Presence> map2, Map<Long, Integer> map3, Map<Long, ? extends Map<Long, GuildMember>> map4) {
m.checkNotNullParameter(map, "users");
m.checkNotNullParameter(map2, "presences");
m.checkNotNullParameter(map3, "relationships");
m.checkNotNullParameter(map4, "members");
this.users = map;
this.presences = map2;
this.relationships = map3;
this.members = map4;
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.user.search.WidgetGlobalSearchModel$UsersContext */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ UsersContext copy$default(UsersContext usersContext, Map map, Map map2, Map map3, Map map4, int i, Object obj) {
if ((i & 1) != 0) {
map = usersContext.users;
}
if ((i & 2) != 0) {
map2 = usersContext.presences;
}
if ((i & 4) != 0) {
map3 = usersContext.relationships;
}
if ((i & 8) != 0) {
map4 = usersContext.members;
}
return usersContext.copy(map, map2, map3, map4);
}
public final Map<Long, User> component1() {
return this.users;
}
public final Map<Long, Presence> component2() {
return this.presences;
}
public final Map<Long, Integer> component3() {
return this.relationships;
}
public final Map<Long, Map<Long, GuildMember>> component4() {
return this.members;
}
public final UsersContext copy(Map<Long, ? extends User> map, Map<Long, Presence> map2, Map<Long, Integer> map3, Map<Long, ? extends Map<Long, GuildMember>> map4) {
m.checkNotNullParameter(map, "users");
m.checkNotNullParameter(map2, "presences");
m.checkNotNullParameter(map3, "relationships");
m.checkNotNullParameter(map4, "members");
return new UsersContext(map, map2, map3, map4);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof UsersContext)) {
return false;
}
UsersContext usersContext = (UsersContext) obj;
return m.areEqual(this.users, usersContext.users) && m.areEqual(this.presences, usersContext.presences) && m.areEqual(this.relationships, usersContext.relationships) && m.areEqual(this.members, usersContext.members);
}
public final Map<Long, Map<Long, GuildMember>> getMembers() {
return this.members;
}
public final Map<Long, Presence> getPresences() {
return this.presences;
}
public final Map<Long, Integer> getRelationships() {
return this.relationships;
}
public final Map<Long, User> getUsers() {
return this.users;
}
public int hashCode() {
Map<Long, User> map = this.users;
int i = 0;
int hashCode = (map != null ? map.hashCode() : 0) * 31;
Map<Long, Presence> map2 = this.presences;
int hashCode2 = (hashCode + (map2 != null ? map2.hashCode() : 0)) * 31;
Map<Long, Integer> map3 = this.relationships;
int hashCode3 = (hashCode2 + (map3 != null ? map3.hashCode() : 0)) * 31;
Map<Long, Map<Long, GuildMember>> map4 = this.members;
if (map4 != null) {
i = map4.hashCode();
}
return hashCode3 + i;
}
public String toString() {
StringBuilder K = a.K("UsersContext(users=");
K.append(this.users);
K.append(", presences=");
K.append(this.presences);
K.append(", relationships=");
K.append(this.relationships);
K.append(", members=");
return a.E(K, this.members, ")");
}
}
static {
Pattern compile = Pattern.compile("[^\\s]#\\d{0,4}$", 0);
m.checkNotNullExpressionValue(compile, "java.util.regex.Pattern.compile(this, flags)");
DISCRIMINATOR_PATTERN = compile;
}
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.List<? extends com.discord.widgets.user.search.WidgetGlobalSearchModel$ItemDataPayload> */
/* JADX WARN: Multi-variable type inference failed */
public WidgetGlobalSearchModel(String str, int i, List<? extends ItemDataPayload> list, List<WidgetGlobalSearchGuildsModel.Item> list2) {
m.checkNotNullParameter(str, "filter");
m.checkNotNullParameter(list, "data");
this.filter = str;
this.searchType = i;
this.data = list;
this.guildsList = list2;
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
public /* synthetic */ WidgetGlobalSearchModel(String str, int i, List list, List list2, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(str, i, list, (i2 & 8) != 0 ? null : list2);
}
public static final /* synthetic */ Function2 access$getDEFAULT_PERMISSIONS_PREDICATE$cp() {
return DEFAULT_PERMISSIONS_PREDICATE;
}
public static final /* synthetic */ Pattern access$getDISCRIMINATOR_PATTERN$cp() {
return DISCRIMINATOR_PATTERN;
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.widgets.user.search.WidgetGlobalSearchModel */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ WidgetGlobalSearchModel copy$default(WidgetGlobalSearchModel widgetGlobalSearchModel, String str, int i, List list, List list2, int i2, Object obj) {
if ((i2 & 1) != 0) {
str = widgetGlobalSearchModel.filter;
}
if ((i2 & 2) != 0) {
i = widgetGlobalSearchModel.searchType;
}
if ((i2 & 4) != 0) {
list = widgetGlobalSearchModel.data;
}
if ((i2 & 8) != 0) {
list2 = widgetGlobalSearchModel.guildsList;
}
return widgetGlobalSearchModel.copy(str, i, list, list2);
}
public final String component1() {
return this.filter;
}
public final int component2() {
return this.searchType;
}
public final List<ItemDataPayload> component3() {
return this.data;
}
public final List<WidgetGlobalSearchGuildsModel.Item> component4() {
return this.guildsList;
}
public final WidgetGlobalSearchModel copy(String str, int i, List<? extends ItemDataPayload> list, List<WidgetGlobalSearchGuildsModel.Item> list2) {
m.checkNotNullParameter(str, "filter");
m.checkNotNullParameter(list, "data");
return new WidgetGlobalSearchModel(str, i, list, list2);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof WidgetGlobalSearchModel)) {
return false;
}
WidgetGlobalSearchModel widgetGlobalSearchModel = (WidgetGlobalSearchModel) obj;
return m.areEqual(this.filter, widgetGlobalSearchModel.filter) && this.searchType == widgetGlobalSearchModel.searchType && m.areEqual(this.data, widgetGlobalSearchModel.data) && m.areEqual(this.guildsList, widgetGlobalSearchModel.guildsList);
}
public final List<ItemDataPayload> getData() {
return this.data;
}
public final String getFilter() {
return this.filter;
}
public final List<WidgetGlobalSearchGuildsModel.Item> getGuildsList() {
return this.guildsList;
}
public final int getSearchType() {
return this.searchType;
}
public int hashCode() {
String str = this.filter;
int i = 0;
int hashCode = (((str != null ? str.hashCode() : 0) * 31) + this.searchType) * 31;
List<ItemDataPayload> list = this.data;
int hashCode2 = (hashCode + (list != null ? list.hashCode() : 0)) * 31;
List<WidgetGlobalSearchGuildsModel.Item> list2 = this.guildsList;
if (list2 != null) {
i = list2.hashCode();
}
return hashCode2 + i;
}
public String toString() {
StringBuilder K = a.K("WidgetGlobalSearchModel(filter=");
K.append(this.filter);
K.append(", searchType=");
K.append(this.searchType);
K.append(", data=");
K.append(this.data);
K.append(", guildsList=");
return a.D(K, this.guildsList, ")");
}
}