package com.google.crypto.tink.shaded.protobuf;

import androidx.datastore.preferences.protobuf.C0432j;
import d5.AbstractC0844a;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/* JADX INFO: renamed from: com.google.crypto.tink.shaded.protobuf.v, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC0755v extends AbstractC0735a {
    private static final int MEMOIZED_SERIALIZED_SIZE_MASK = Integer.MAX_VALUE;
    private static final int MUTABLE_FLAG_MASK = Integer.MIN_VALUE;
    static final int UNINITIALIZED_HASH_CODE = 0;
    static final int UNINITIALIZED_SERIALIZED_SIZE = Integer.MAX_VALUE;
    private static Map<Object, AbstractC0755v> defaultInstanceMap = new ConcurrentHashMap();
    private int memoizedSerializedSize;
    protected e0 unknownFields;

    public AbstractC0755v() {
        this.memoizedHashCode = 0;
        this.memoizedSerializedSize = -1;
        this.unknownFields = e0.f10486f;
    }

    public static void g(AbstractC0755v abstractC0755v) throws B {
        if (!m(abstractC0755v, true)) {
            throw new B(new d0().getMessage());
        }
    }

    public static AbstractC0755v j(Class cls) {
        AbstractC0755v abstractC0755v = defaultInstanceMap.get(cls);
        if (abstractC0755v == null) {
            try {
                Class.forName(cls.getName(), true, cls.getClassLoader());
                abstractC0755v = defaultInstanceMap.get(cls);
            } catch (ClassNotFoundException e8) {
                throw new IllegalStateException("Class initialization cannot fail.", e8);
            }
        }
        if (abstractC0755v != null) {
            return abstractC0755v;
        }
        AbstractC0755v abstractC0755vC = ((AbstractC0755v) n0.b(cls)).c();
        if (abstractC0755vC == null) {
            throw new IllegalStateException();
        }
        defaultInstanceMap.put(cls, abstractC0755vC);
        return abstractC0755vC;
    }

    public static Object l(Method method, AbstractC0735a abstractC0735a, Object... objArr) {
        try {
            return method.invoke(abstractC0735a, objArr);
        } catch (IllegalAccessException e8) {
            throw new RuntimeException("Couldn't use Java reflection to implement protocol message reflection.", e8);
        } catch (InvocationTargetException e9) {
            Throwable cause = e9.getCause();
            if (cause instanceof RuntimeException) {
                throw ((RuntimeException) cause);
            }
            if (cause instanceof Error) {
                throw ((Error) cause);
            }
            throw new RuntimeException("Unexpected exception thrown by generated accessor method.", cause);
        }
    }

    public static final boolean m(AbstractC0755v abstractC0755v, boolean z8) {
        byte bByteValue = ((Byte) abstractC0755v.i(1)).byteValue();
        if (bByteValue == 1) {
            return true;
        }
        if (bByteValue == 0) {
            return false;
        }
        Y y8 = Y.f10468c;
        y8.getClass();
        boolean zA = y8.a(abstractC0755v.getClass()).a(abstractC0755v);
        if (z8) {
            abstractC0755v.i(2);
        }
        return zA;
    }

    public static AbstractC0755v r(AbstractC0755v abstractC0755v, AbstractC0742h abstractC0742h, C0748n c0748n) throws B {
        C0741g c0741g = (C0741g) abstractC0742h;
        C0743i c0743iH = J3.e.h(c0741g.f10494t, c0741g.h(), c0741g.size(), true);
        AbstractC0755v abstractC0755vS = s(abstractC0755v, c0743iH, c0748n);
        c0743iH.b(0);
        g(abstractC0755vS);
        return abstractC0755vS;
    }

    public static AbstractC0755v s(AbstractC0755v abstractC0755v, J3.e eVar, C0748n c0748n) throws B {
        AbstractC0755v abstractC0755vQ = abstractC0755v.q();
        try {
            Y y8 = Y.f10468c;
            y8.getClass();
            b0 b0VarA = y8.a(abstractC0755vQ.getClass());
            C0432j c0432j = (C0432j) eVar.f3474b;
            if (c0432j == null) {
                c0432j = new C0432j(eVar, (byte) 0);
            }
            b0VarA.j(abstractC0755vQ, c0432j, c0748n);
            b0VarA.d(abstractC0755vQ);
            return abstractC0755vQ;
        } catch (B e8) {
            if (e8.f10424q) {
                throw new B(e8.getMessage(), e8);
            }
            throw e8;
        } catch (d0 e9) {
            throw new B(e9.getMessage());
        } catch (IOException e10) {
            if (e10.getCause() instanceof B) {
                throw ((B) e10.getCause());
            }
            throw new B(e10.getMessage(), e10);
        } catch (RuntimeException e11) {
            if (e11.getCause() instanceof B) {
                throw ((B) e11.getCause());
            }
            throw e11;
        }
    }

    public static void t(Class cls, AbstractC0755v abstractC0755v) {
        abstractC0755v.o();
        defaultInstanceMap.put(cls, abstractC0755v);
    }

    @Override // com.google.crypto.tink.shaded.protobuf.AbstractC0735a
    public final int a(b0 b0Var) {
        int iE;
        int iE2;
        if (n()) {
            if (b0Var == null) {
                Y y8 = Y.f10468c;
                y8.getClass();
                iE2 = y8.a(getClass()).e(this);
            } else {
                iE2 = b0Var.e(this);
            }
            if (iE2 >= 0) {
                return iE2;
            }
            throw new IllegalStateException(AbstractC0844a.j("serialized size must be non-negative, was ", iE2));
        }
        int i = this.memoizedSerializedSize;
        if ((i & Integer.MAX_VALUE) != Integer.MAX_VALUE) {
            return i & Integer.MAX_VALUE;
        }
        if (b0Var == null) {
            Y y9 = Y.f10468c;
            y9.getClass();
            iE = y9.a(getClass()).e(this);
        } else {
            iE = b0Var.e(this);
        }
        u(iE);
        return iE;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        Y y8 = Y.f10468c;
        y8.getClass();
        return y8.a(getClass()).f(this, (AbstractC0755v) obj);
    }

    @Override // com.google.crypto.tink.shaded.protobuf.AbstractC0735a
    public final void f(C0745k c0745k) {
        Y y8 = Y.f10468c;
        y8.getClass();
        b0 b0VarA = y8.a(getClass());
        K k8 = c0745k.f10516h;
        if (k8 == null) {
            k8 = new K(c0745k);
        }
        b0VarA.h(this, k8);
    }

    public final AbstractC0753t h() {
        return (AbstractC0753t) i(5);
    }

    public final int hashCode() {
        if (n()) {
            Y y8 = Y.f10468c;
            y8.getClass();
            return y8.a(getClass()).i(this);
        }
        if (this.memoizedHashCode == 0) {
            Y y9 = Y.f10468c;
            y9.getClass();
            this.memoizedHashCode = y9.a(getClass()).i(this);
        }
        return this.memoizedHashCode;
    }

    public abstract Object i(int i);

    @Override // com.google.crypto.tink.shaded.protobuf.P
    /* JADX INFO: renamed from: k, reason: merged with bridge method [inline-methods] */
    public final AbstractC0755v c() {
        return (AbstractC0755v) i(6);
    }

    public final boolean n() {
        return (this.memoizedSerializedSize & MUTABLE_FLAG_MASK) != 0;
    }

    public final void o() {
        this.memoizedSerializedSize &= Integer.MAX_VALUE;
    }

    @Override // com.google.crypto.tink.shaded.protobuf.AbstractC0735a
    /* JADX INFO: renamed from: p, reason: merged with bridge method [inline-methods] */
    public final AbstractC0753t d() {
        return (AbstractC0753t) i(5);
    }

    public final AbstractC0755v q() {
        return (AbstractC0755v) i(4);
    }

    public final String toString() {
        String string = super.toString();
        char[] cArr = Q.f10447a;
        StringBuilder sb = new StringBuilder();
        sb.append("# ");
        sb.append(string);
        Q.c(this, sb, 0);
        return sb.toString();
    }

    public final void u(int i) {
        if (i < 0) {
            throw new IllegalStateException(AbstractC0844a.j("serialized size must be non-negative, was ", i));
        }
        this.memoizedSerializedSize = (i & Integer.MAX_VALUE) | (this.memoizedSerializedSize & MUTABLE_FLAG_MASK);
    }

    public final AbstractC0753t v() {
        AbstractC0753t abstractC0753t = (AbstractC0753t) i(5);
        if (!abstractC0753t.f10542q.equals(this)) {
            abstractC0753t.h();
            AbstractC0753t.i(abstractC0753t.f10543r, this);
        }
        return abstractC0753t;
    }
}
