package com.discord.utilities.channel; import androidx.annotation.DrawableRes; import com.discord.api.channel.Channel; import com.discord.api.permission.PermissionOverwrite; import com.discord.utilities.PermissionOverwriteUtilsKt; import com.discord.utilities.channel.GuildChannelIconType; import d0.z.d.m; import java.util.Iterator; import java.util.List; import kotlin.NoWhenBranchMatchedException; /* compiled from: GuildChannelIconUtils.kt */ public final class GuildChannelIconUtilsKt { public static final GuildChannelIconType getChannelType(Channel channel) { boolean z2; boolean z3; if (channel == null) { return GuildChannelIconType.Text.INSTANCE; } int A = channel.A(); Object obj = null; if (A != 5) { switch (A) { case 10: return channel.o() ? GuildChannelIconType.NSFW.Thread.INSTANCE : GuildChannelIconType.Thread.INSTANCE; case 11: return channel.o() ? GuildChannelIconType.NSFW.Thread.INSTANCE : GuildChannelIconType.Thread.INSTANCE; case 12: return GuildChannelIconType.Locked.Thread.INSTANCE; default: if (channel.o()) { return GuildChannelIconType.NSFW.Text.INSTANCE; } List s2 = channel.s(); if (s2 != null) { Iterator it = s2.iterator(); while (true) { if (it.hasNext()) { Object next = it.next(); if (((PermissionOverwrite) next).e() == channel.f()) { z3 = true; continue; } else { z3 = false; continue; } if (z3) { obj = next; } } } PermissionOverwrite permissionOverwrite = (PermissionOverwrite) obj; if (permissionOverwrite != null && PermissionOverwriteUtilsKt.denies(permissionOverwrite, 1024)) { return GuildChannelIconType.Locked.Text.INSTANCE; } } return GuildChannelIconType.Text.INSTANCE; } } else if (channel.o()) { return GuildChannelIconType.NSFW.Announcements.INSTANCE; } else { List s3 = channel.s(); if (s3 != null) { Iterator it2 = s3.iterator(); while (true) { if (!it2.hasNext()) { break; } Object next2 = it2.next(); if (((PermissionOverwrite) next2).e() == channel.f()) { z2 = true; continue; } else { z2 = false; continue; } if (z2) { obj = next2; break; } } PermissionOverwrite permissionOverwrite2 = (PermissionOverwrite) obj; if (permissionOverwrite2 != null && PermissionOverwriteUtilsKt.denies(permissionOverwrite2, 1024)) { return GuildChannelIconType.Locked.Announcements.INSTANCE; } } return GuildChannelIconType.Announcements.INSTANCE; } } public static final int guildChannelIcon(Channel channel) { return mapGuildChannelTypeToIcon(getChannelType(channel)); } @DrawableRes public static final int mapGuildChannelTypeToIcon(GuildChannelIconType guildChannelIconType) { m.checkNotNullParameter(guildChannelIconType, "guildChannelIconType"); if (m.areEqual(guildChannelIconType, GuildChannelIconType.Text.INSTANCE)) { return 2131231489; } if (guildChannelIconType instanceof GuildChannelIconType.Thread) { return 2131231999; } if (guildChannelIconType instanceof GuildChannelIconType.Announcements) { return 2131231474; } if (guildChannelIconType instanceof GuildChannelIconType.NSFW.Text) { return 2131231494; } if (guildChannelIconType instanceof GuildChannelIconType.NSFW.Announcements) { return 2131231477; } if (guildChannelIconType instanceof GuildChannelIconType.NSFW.Thread) { return 2131232001; } if (guildChannelIconType instanceof GuildChannelIconType.Locked.Text) { return 2131231493; } if (guildChannelIconType instanceof GuildChannelIconType.Locked.Announcements) { return 2131231476; } if (guildChannelIconType instanceof GuildChannelIconType.Locked.Thread) { return 2131232000; } throw new NoWhenBranchMatchedException(); } }