package defpackage;

import com.squareup.moshi.JsonDataException;
import com.squareup.moshi.JsonEncodingException;
import java.io.EOFException;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Set;

/* JADX INFO: renamed from: ᵶᵰᵣ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4846 extends AbstractC3610 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final String[] f18460;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final Enum[] f18461;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final Class f18462;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final C3714 f18463;

    public C4846(Class cls) {
        this.f18462 = cls;
        try {
            Enum[] enumArr = (Enum[]) cls.getEnumConstants();
            this.f18461 = enumArr;
            this.f18460 = new String[enumArr.length];
            int i = 0;
            while (true) {
                Enum[] enumArr2 = this.f18461;
                if (i >= enumArr2.length) {
                    this.f18463 = C3714.m8357(this.f18460);
                    return;
                }
                String strName = enumArr2[i].name();
                String[] strArr = this.f18460;
                Field field = cls.getField(strName);
                Set set = AbstractC4534.f17254;
                InterfaceC2311 interfaceC2311 = (InterfaceC2311) field.getAnnotation(InterfaceC2311.class);
                if (interfaceC2311 != null) {
                    String strName2 = interfaceC2311.name();
                    if (!"\u0000".equals(strName2)) {
                        strName = strName2;
                    }
                }
                strArr[i] = strName;
                i++;
            }
        } catch (NoSuchFieldException e) {
            throw new AssertionError("Missing field in ".concat(cls.getName()), e);
        }
    }

    public final String toString() {
        return "JsonAdapter(" + this.f18462.getName() + ")";
    }

    @Override // defpackage.AbstractC3610
    /* JADX INFO: renamed from: ᵨᵣ */
    public final void mo6475(C3829 c3829, Object obj) {
        c3829.m8538(this.f18460[((Enum) obj).ordinal()]);
    }

    @Override // defpackage.AbstractC3610
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final Object mo6476(C4877 c4877) throws EOFException, JsonEncodingException {
        int iMo5348;
        int iM10142 = c4877.f18586;
        if (iM10142 == 0) {
            iM10142 = c4877.m10142();
        }
        if (iM10142 < 8 || iM10142 > 11) {
            iMo5348 = -1;
        } else {
            C3714 c3714 = this.f18463;
            if (iM10142 == 11) {
                iMo5348 = c4877.m10145(c4877.f18589, c3714);
            } else {
                iMo5348 = c4877.f18593.mo5348((C4135) c3714.f14142);
                if (iMo5348 != -1) {
                    c4877.f18586 = 0;
                    int[] iArr = c4877.f18592;
                    int i = c4877.f18587 - 1;
                    iArr[i] = iArr[i] + 1;
                } else {
                    String strM10133 = c4877.m10133();
                    int iM10145 = c4877.m10145(strM10133, c3714);
                    if (iM10145 == -1) {
                        c4877.f18586 = 11;
                        c4877.f18589 = strM10133;
                        c4877.f18592[c4877.f18587 - 1] = r0[r1] - 1;
                    }
                    iMo5348 = iM10145;
                }
            }
        }
        if (iMo5348 != -1) {
            return this.f18461[iMo5348];
        }
        String strM10131 = c4877.m10131();
        String strM101332 = c4877.m10133();
        throw new JsonDataException("Expected one of " + Arrays.asList(this.f18460) + " but was " + strM101332 + " at path " + strM10131);
    }
}
