package com.discord.widgets.chat.input.emoji; import com.discord.models.domain.emoji.Emoji; import com.discord.models.domain.emoji.ModelEmojiCustom; import com.discord.models.guild.Guild; import com.discord.widgets.chat.input.emoji.WidgetEmojiAdapter; import d0.g0.w; import d0.z.d.m; import d0.z.d.o; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Objects; import kotlin.jvm.functions.Function1; /* compiled from: EmojiPickerViewModel.kt */ public final class EmojiPickerViewModel$Companion$buildEmojiListItems$items$2 extends o implements Function1 { public final /* synthetic */ boolean $allowEmojisToAnimate; public final /* synthetic */ Function1 $getGuild; public final /* synthetic */ String $searchInputLower; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public EmojiPickerViewModel$Companion$buildEmojiListItems$items$2(String str, Function1 function1, boolean z2) { super(1); this.$searchInputLower = str; this.$getGuild = function1; this.$allowEmojisToAnimate = z2; } public final WidgetEmojiAdapter.EmojiItem invoke(Emoji emoji) { String str; Object obj; m.checkNotNullParameter(emoji, "emoji"); List names = emoji.getNames(); m.checkNotNullExpressionValue(names, "emoji.names"); Iterator it = names.iterator(); while (true) { str = null; if (!it.hasNext()) { obj = null; break; } obj = it.next(); String str2 = (String) obj; m.checkNotNullExpressionValue(str2, "name"); Locale locale = Locale.getDefault(); m.checkNotNullExpressionValue(locale, "Locale.getDefault()"); Objects.requireNonNull(str2, "null cannot be cast to non-null type java.lang.String"); String lowerCase = str2.toLowerCase(locale); m.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase(locale)"); if (w.contains$default((CharSequence) lowerCase, (CharSequence) this.$searchInputLower, false, 2, (Object) null)) { break; } } String str3 = (String) obj; if (str3 == null) { return null; } ModelEmojiCustom modelEmojiCustom = (ModelEmojiCustom) (!(emoji instanceof ModelEmojiCustom) ? null : emoji); if (modelEmojiCustom != null) { Guild guild = (Guild) this.$getGuild.invoke(Long.valueOf(modelEmojiCustom.getGuildId())); if (guild != null) { str = guild.getName(); } } return new WidgetEmojiAdapter.EmojiItem(str, emoji, str3, this.$allowEmojisToAnimate); } }