package androidx.datastore.preferences.protobuf;

import java.io.IOException;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;

/* JADX INFO: renamed from: androidx.datastore.preferences.protobuf.o, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1026o {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final /* synthetic */ int f11423c = 0;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Z f11424a = new Z(16);

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f11425b;

    static {
        new C1026o(0);
    }

    public C1026o() {
    }

    public static void b(C1021j c1021j, y0 y0Var, int i6, Object obj) throws IOException {
        if (y0Var == y0.f11459d) {
            c1021j.L(i6, 3);
            ((AbstractC1012a) obj).b(c1021j);
            c1021j.L(i6, 4);
        }
        c1021j.L(i6, y0Var.f11463b);
        switch (y0Var.ordinal()) {
            case 0:
                c1021j.F(Double.doubleToRawLongBits(((Double) obj).doubleValue()));
                break;
            case 1:
                c1021j.D(Float.floatToRawIntBits(((Float) obj).floatValue()));
                break;
            case 2:
                c1021j.P(((Long) obj).longValue());
                break;
            case 3:
                c1021j.P(((Long) obj).longValue());
                break;
            case 4:
                c1021j.H(((Integer) obj).intValue());
                break;
            case 5:
                c1021j.F(((Long) obj).longValue());
                break;
            case 6:
                c1021j.D(((Integer) obj).intValue());
                break;
            case 7:
                c1021j.x(((Boolean) obj).booleanValue() ? (byte) 1 : (byte) 0);
                break;
            case 8:
                if (!(obj instanceof C1018g)) {
                    c1021j.K((String) obj);
                } else {
                    c1021j.B((C1018g) obj);
                }
                break;
            case 9:
                ((AbstractC1012a) obj).b(c1021j);
                break;
            case 10:
                AbstractC1012a abstractC1012a = (AbstractC1012a) obj;
                c1021j.getClass();
                c1021j.N(((AbstractC1030t) abstractC1012a).a(null));
                abstractC1012a.b(c1021j);
                break;
            case 11:
                if (!(obj instanceof C1018g)) {
                    byte[] bArr = (byte[]) obj;
                    int length = bArr.length;
                    c1021j.N(length);
                    c1021j.y(bArr, 0, length);
                } else {
                    c1021j.B((C1018g) obj);
                }
                break;
            case 12:
                c1021j.N(((Integer) obj).intValue());
                break;
            case 13:
                c1021j.H(((Integer) obj).intValue());
                break;
            case 14:
                c1021j.D(((Integer) obj).intValue());
                break;
            case 15:
                c1021j.F(((Long) obj).longValue());
                break;
            case 16:
                int iIntValue = ((Integer) obj).intValue();
                c1021j.N((iIntValue >> 31) ^ (iIntValue << 1));
                break;
            case 17:
                long jLongValue = ((Long) obj).longValue();
                c1021j.P((jLongValue >> 63) ^ (jLongValue << 1));
                break;
        }
    }

    public final void a() {
        Z z6;
        if (this.f11425b) {
            return;
        }
        int i6 = 0;
        while (true) {
            z6 = this.f11424a;
            if (i6 >= z6.f11356b.size()) {
                break;
            }
            Map.Entry entryC = z6.c(i6);
            if (entryC.getValue() instanceof AbstractC1030t) {
                AbstractC1030t abstractC1030t = (AbstractC1030t) entryC.getValue();
                abstractC1030t.getClass();
                U u6 = U.f11340c;
                u6.getClass();
                u6.a(abstractC1030t.getClass()).b(abstractC1030t);
                abstractC1030t.h();
            }
            i6++;
        }
        if (!z6.f11358d) {
            if (z6.f11356b.size() > 0) {
                z6.c(0).getKey().getClass();
                throw new ClassCastException();
            }
            Iterator it = z6.d().iterator();
            if (it.hasNext()) {
                ((Map.Entry) it.next()).getKey().getClass();
                throw new ClassCastException();
            }
        }
        if (!z6.f11358d) {
            z6.f11357c = z6.f11357c.isEmpty() ? Collections.EMPTY_MAP : Collections.unmodifiableMap(z6.f11357c);
            z6.f11360f = z6.f11360f.isEmpty() ? Collections.EMPTY_MAP : Collections.unmodifiableMap(z6.f11360f);
            z6.f11358d = true;
        }
        this.f11425b = true;
    }

    public final Object clone() {
        C1026o c1026o = new C1026o();
        Z z6 = this.f11424a;
        if (z6.f11356b.size() > 0) {
            Map.Entry entryC = z6.c(0);
            if (entryC.getKey() != null) {
                throw new ClassCastException();
            }
            entryC.getValue();
            throw null;
        }
        Iterator it = z6.d().iterator();
        if (!it.hasNext()) {
            return c1026o;
        }
        Map.Entry entry = (Map.Entry) it.next();
        if (entry.getKey() != null) {
            throw new ClassCastException();
        }
        entry.getValue();
        throw null;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof C1026o) {
            return this.f11424a.equals(((C1026o) obj).f11424a);
        }
        return false;
    }

    public final int hashCode() {
        return this.f11424a.hashCode();
    }

    public C1026o(int i6) {
        a();
        a();
    }
}
