package com.discord.utilities.textprocessing.node; import android.content.Context; import android.text.SpannableStringBuilder; import android.text.style.BackgroundColorSpan; import android.text.style.CharacterStyle; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; import com.discord.R; import com.discord.api.channel.Channel; import com.discord.simpleast.core.node.Node; import com.discord.utilities.color.ColorCompat; import com.discord.utilities.spans.ClickableSpan; import com.discord.utilities.textprocessing.node.ChannelMentionNode.RenderContext; import d0.z.d.m; import java.util.ArrayList; import java.util.Iterator; import java.util.Map; import kotlin.Unit; import kotlin.jvm.functions.Function1; /* compiled from: ChannelMentionNode.kt */ public final class ChannelMentionNode extends Node { private final long channelId; /* compiled from: ChannelMentionNode.kt */ public interface RenderContext extends BasicRenderContext { Function1 getChannelMentionOnClick(); Map getChannelNames(); } public ChannelMentionNode(long j) { super(null, 1, null); this.channelId = j; } public boolean equals(Object obj) { return (obj instanceof ChannelMentionNode) && ((ChannelMentionNode) obj).channelId == this.channelId; } public final long getChannelId() { return this.channelId; } public void render(SpannableStringBuilder spannableStringBuilder, T t) { String str; m.checkNotNullParameter(spannableStringBuilder, "builder"); m.checkNotNullParameter(t, "renderContext"); Context context = t.getContext(); int length = spannableStringBuilder.length(); ArrayList arrayList = new ArrayList(3); arrayList.add(new StyleSpan(1)); Map channelNames = t.getChannelNames(); if (channelNames == null || (str = channelNames.get(Long.valueOf(this.channelId))) == null) { str = "deleted-channel"; } Function1 channelMentionOnClick = t.getChannelMentionOnClick(); if (channelMentionOnClick != null) { arrayList.add(new ClickableSpan(Integer.valueOf(ColorCompat.getThemedColor(context, (int) R.attr.theme_chat_mention_foreground)), false, null, new ChannelMentionNode$render$1(this, channelMentionOnClick), 4, null)); } else { arrayList.add(new ForegroundColorSpan(ColorCompat.getThemedColor(context, (int) R.attr.theme_chat_mention_foreground))); } arrayList.add(new BackgroundColorSpan(ColorCompat.getThemedColor(context, (int) R.attr.theme_chat_mention_background))); StringBuilder sb = new StringBuilder(); m.checkNotNullParameter(Channel.Companion, "$this$DISPLAY_PREFIX_GUILD"); sb.append("#"); sb.append(str); spannableStringBuilder.append((CharSequence) sb.toString()); Iterator it = arrayList.iterator(); while (it.hasNext()) { spannableStringBuilder.setSpan((CharacterStyle) it.next(), length, spannableStringBuilder.length(), 33); } } /* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.utilities.textprocessing.node.ChannelMentionNode */ /* JADX WARN: Multi-variable type inference failed */ @Override // com.discord.simpleast.core.node.Node public /* bridge */ /* synthetic */ void render(SpannableStringBuilder spannableStringBuilder, Object obj) { render(spannableStringBuilder, (SpannableStringBuilder) ((RenderContext) obj)); } }