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;

/* renamed from: ᵜʢᵢᵸ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2794 extends AbstractC3740 {

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final Enum[] f10760;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final Class f10761;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final String[] f10762;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final ᵶˉᵹʣ f10763;

    public C2794(Class cls) throws NoSuchFieldException {
        this.f10761 = cls;
        try {
            Enum[] enumArr = (Enum[]) cls.getEnumConstants();
            this.f10760 = enumArr;
            this.f10762 = new String[enumArr.length];
            int i = 0;
            while (true) {
                Enum[] enumArr2 = this.f10760;
                if (i >= enumArr2.length) {
                    this.f10763 = ᵶˉᵹʣ.ˀᵗᵝᵭ(this.f10762);
                    return;
                }
                String strName = enumArr2[i].name();
                String[] strArr = this.f10762;
                Field field = cls.getField(strName);
                Set set = AbstractC4978.f18493;
                InterfaceC1419 interfaceC1419 = (InterfaceC1419) field.getAnnotation(InterfaceC1419.class);
                if (interfaceC1419 != null) {
                    String strName2 = interfaceC1419.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.f10761.getName() + ")";
    }

    @Override // defpackage.AbstractC3740
    /* renamed from: ˇʼʤˎ */
    public final void mo5203(C1639 c1639, Object obj) {
        c1639.m4699(this.f10762[((Enum) obj).ordinal()]);
    }

    @Override // defpackage.AbstractC3740
    /* renamed from: ᵥᵯˎ */
    public final Object mo5205(C4760 c4760) throws EOFException, JsonEncodingException {
        int iMo3268;
        int iM10056 = c4760.f17683;
        if (iM10056 == 0) {
            iM10056 = c4760.m10056();
        }
        if (iM10056 < 8 || iM10056 > 11) {
            iMo3268 = -1;
        } else {
            ᵶˉᵹʣ r3 = this.f10763;
            if (iM10056 == 11) {
                iMo3268 = c4760.m10054(c4760.f17684, r3);
            } else {
                iMo3268 = c4760.f17689.mo3268((C2679) r3.ᵿʗᵝʽ);
                if (iMo3268 != -1) {
                    c4760.f17683 = 0;
                    int[] iArr = c4760.f17691;
                    int i = c4760.f17690 - 1;
                    iArr[i] = iArr[i] + 1;
                } else {
                    String strM10062 = c4760.m10062();
                    int iM10054 = c4760.m10054(strM10062, r3);
                    if (iM10054 == -1) {
                        c4760.f17683 = 11;
                        c4760.f17684 = strM10062;
                        c4760.f17691[c4760.f17690 - 1] = r0[r1] - 1;
                    }
                    iMo3268 = iM10054;
                }
            }
        }
        if (iMo3268 != -1) {
            return this.f10760[iMo3268];
        }
        String strM10050 = c4760.m10050();
        String strM100622 = c4760.m10062();
        throw new JsonDataException("Expected one of " + Arrays.asList(this.f10762) + " but was " + strM100622 + " at path " + strM10050);
    }
}
