package k5;

import d3.C1943z0;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import x4.AbstractC3250p;

/* JADX INFO: renamed from: k5.w, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes3.dex */
public final class C2434w implements g5.a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f20104a = 1;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final Object f20105b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Object f20106c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Object f20107d;

    public C2434w(String str, Object objectInstance) {
        kotlin.jvm.internal.o.h(objectInstance, "objectInstance");
        this.f20105b = objectInstance;
        this.f20106c = x4.y.f26065a;
        this.f20107d = m1.g.j(w4.i.f25466b, new C1943z0(8, str, this));
    }

    @Override // g5.a
    public final Object deserialize(j5.c decoder) {
        switch (this.f20104a) {
            case 0:
                kotlin.jvm.internal.o.h(decoder, "decoder");
                int iD = decoder.D(getDescriptor());
                Enum[] enumArr = (Enum[]) this.f20105b;
                if (iD >= 0 && iD < enumArr.length) {
                    return enumArr[iD];
                }
                throw new g5.f(iD + " is not among valid " + getDescriptor().a() + " enum values, values size is " + enumArr.length);
            default:
                kotlin.jvm.internal.o.h(decoder, "decoder");
                i5.g descriptor = getDescriptor();
                j5.a aVarB = decoder.b(descriptor);
                int iK = aVarB.k(getDescriptor());
                if (iK != -1) {
                    throw new g5.f(Z0.o.l("Unexpected index ", iK));
                }
                aVarB.c(descriptor);
                return this.f20105b;
        }
    }

    /* JADX WARN: Type inference failed for: r0v5, types: [java.lang.Object, w4.h] */
    @Override // g5.a
    public final i5.g getDescriptor() {
        switch (this.f20104a) {
            case 0:
                return (i5.g) ((w4.p) this.f20107d).getValue();
            default:
                return (i5.g) this.f20107d.getValue();
        }
    }

    @Override // g5.a
    public final void serialize(j5.d encoder, Object value) {
        switch (this.f20104a) {
            case 0:
                Enum value2 = (Enum) value;
                kotlin.jvm.internal.o.h(encoder, "encoder");
                kotlin.jvm.internal.o.h(value2, "value");
                Enum[] enumArr = (Enum[]) this.f20105b;
                int iP = AbstractC3250p.P(enumArr, value2);
                if (iP != -1) {
                    encoder.x(getDescriptor(), iP);
                    return;
                }
                StringBuilder sb = new StringBuilder();
                sb.append(value2);
                sb.append(" is not a valid enum ");
                sb.append(getDescriptor().a());
                sb.append(", must be one of ");
                String string = Arrays.toString(enumArr);
                kotlin.jvm.internal.o.g(string, "toString(...)");
                sb.append(string);
                throw new g5.f(sb.toString());
            default:
                kotlin.jvm.internal.o.h(encoder, "encoder");
                kotlin.jvm.internal.o.h(value, "value");
                encoder.b(getDescriptor()).c(getDescriptor());
                return;
        }
    }

    public String toString() {
        switch (this.f20104a) {
            case 0:
                return "kotlinx.serialization.internal.EnumSerializer<" + getDescriptor().a() + '>';
            default:
                return super.toString();
        }
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public C2434w(String str, Object objectInstance, Annotation[] annotationArr) {
        this(str, objectInstance);
        kotlin.jvm.internal.o.h(objectInstance, "objectInstance");
        this.f20106c = AbstractC3250p.r(annotationArr);
    }

    public C2434w(String str, Enum[] values) {
        kotlin.jvm.internal.o.h(values, "values");
        this.f20105b = values;
        this.f20107d = m1.g.k(new C1943z0(7, this, str));
    }
}
