discord-jadx/app/src/main/java/com/discord/widgets/guildscheduledevent/GuildScheduledEventExternal...

143 lines
5.6 KiB
Java

package com.discord.widgets.guildscheduledevent;
import android.content.Context;
import c.d.b.a.a;
import c0.g;
import c0.z.d.m;
import com.discord.models.domain.ModelAuditLogEntry;
import com.discord.simpleast.core.node.Node;
import com.discord.simpleast.core.parser.Parser;
import com.discord.utilities.textprocessing.AstRenderer;
import com.discord.utilities.textprocessing.MessageParseState;
import com.discord.utilities.textprocessing.MessageRenderContext;
import com.discord.widgets.guildscheduledevent.GuildScheduledEventLocationInfo;
import com.facebook.drawee.span.DraweeSpanStringBuilder;
import kotlin.Lazy;
import kotlin.NoWhenBranchMatchedException;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: GuildScheduledEventExternalLocationParser.kt */
public final class GuildScheduledEventExternalLocationParser {
public static final Companion Companion = new Companion(null);
private static final Lazy PARSER$delegate = g.lazy(GuildScheduledEventExternalLocationParser$Companion$PARSER$2.INSTANCE);
private Cache cache = new Cache("", "");
/* compiled from: GuildScheduledEventExternalLocationParser.kt */
public static final class Cache {
private final String location;
private final CharSequence output;
public Cache(String str, CharSequence charSequence) {
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_LOCATION);
m.checkNotNullParameter(charSequence, "output");
this.location = str;
this.output = charSequence;
}
public static /* synthetic */ Cache copy$default(Cache cache, String str, CharSequence charSequence, int i, Object obj) {
if ((i & 1) != 0) {
str = cache.location;
}
if ((i & 2) != 0) {
charSequence = cache.output;
}
return cache.copy(str, charSequence);
}
public final String component1() {
return this.location;
}
public final CharSequence component2() {
return this.output;
}
public final Cache copy(String str, CharSequence charSequence) {
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_LOCATION);
m.checkNotNullParameter(charSequence, "output");
return new Cache(str, charSequence);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Cache)) {
return false;
}
Cache cache = (Cache) obj;
return m.areEqual(this.location, cache.location) && m.areEqual(this.output, cache.output);
}
public final String getLocation() {
return this.location;
}
public final CharSequence getOutput() {
return this.output;
}
public int hashCode() {
String str = this.location;
int i = 0;
int hashCode = (str != null ? str.hashCode() : 0) * 31;
CharSequence charSequence = this.output;
if (charSequence != null) {
i = charSequence.hashCode();
}
return hashCode + i;
}
public String toString() {
StringBuilder O = a.O("Cache(location=");
O.append(this.location);
O.append(", output=");
return a.C(O, this.output, ")");
}
}
/* compiled from: GuildScheduledEventExternalLocationParser.kt */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static final /* synthetic */ Parser access$getPARSER$p(Companion companion) {
return companion.getPARSER();
}
private final Parser<MessageRenderContext, Node<MessageRenderContext>, MessageParseState> getPARSER() {
Lazy access$getPARSER$cp = GuildScheduledEventExternalLocationParser.access$getPARSER$cp();
Companion companion = GuildScheduledEventExternalLocationParser.Companion;
return (Parser) access$getPARSER$cp.getValue();
}
}
public static final /* synthetic */ Lazy access$getPARSER$cp() {
return PARSER$delegate;
}
private final CharSequence parse(Context context, String str) {
if (m.areEqual(this.cache.getLocation(), str)) {
return this.cache.getOutput();
}
DraweeSpanStringBuilder render = AstRenderer.render(Parser.parse$default(Companion.access$getPARSER$p(Companion), str, MessageParseState.Companion.getInitialState(), null, 4, null), new MessageRenderContext(context, 0, false, null, null, null, 0, null, null, 0, 0, null, null, null, 16376, null));
this.cache = new Cache(str, render);
return render;
}
public final CharSequence getTextFromLocation(Context context, GuildScheduledEventLocationInfo guildScheduledEventLocationInfo) {
m.checkNotNullParameter(context, "context");
m.checkNotNullParameter(guildScheduledEventLocationInfo, "locationInfo");
if (guildScheduledEventLocationInfo instanceof GuildScheduledEventLocationInfo.ChannelLocation) {
return guildScheduledEventLocationInfo.getLocationName();
}
if (guildScheduledEventLocationInfo instanceof GuildScheduledEventLocationInfo.ExternalLocation) {
return parse(context, guildScheduledEventLocationInfo.getLocationName());
}
throw new NoWhenBranchMatchedException();
}
}