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

import V.C0629x;
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.w, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC1274w extends AbstractC1253a {
    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, AbstractC1274w> defaultInstanceMap = new ConcurrentHashMap();
    private int memoizedSerializedSize;
    protected f0 unknownFields;

    public AbstractC1274w() {
        this.memoizedHashCode = 0;
        this.memoizedSerializedSize = -1;
        this.unknownFields = f0.f13780f;
    }

    public static void f(AbstractC1274w abstractC1274w) throws C {
        if (!l(abstractC1274w, true)) {
            throw new C(new e0().getMessage());
        }
    }

    public static AbstractC1274w i(Class cls) {
        AbstractC1274w abstractC1274w = defaultInstanceMap.get(cls);
        if (abstractC1274w == null) {
            try {
                Class.forName(cls.getName(), true, cls.getClassLoader());
                abstractC1274w = defaultInstanceMap.get(cls);
            } catch (ClassNotFoundException e6) {
                throw new IllegalStateException("Class initialization cannot fail.", e6);
            }
        }
        if (abstractC1274w != null) {
            return abstractC1274w;
        }
        AbstractC1274w defaultInstanceForType = ((AbstractC1274w) o0.b(cls)).getDefaultInstanceForType();
        if (defaultInstanceForType == null) {
            throw new IllegalStateException();
        }
        defaultInstanceMap.put(cls, defaultInstanceForType);
        return defaultInstanceForType;
    }

    public static Object k(Method method, AbstractC1253a abstractC1253a, Object... objArr) {
        try {
            return method.invoke(abstractC1253a, objArr);
        } catch (IllegalAccessException e6) {
            throw new RuntimeException("Couldn't use Java reflection to implement protocol message reflection.", e6);
        } catch (InvocationTargetException e7) {
            Throwable cause = e7.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 l(AbstractC1274w abstractC1274w, boolean z6) {
        byte bByteValue = ((Byte) abstractC1274w.h(1)).byteValue();
        if (bByteValue == 1) {
            return true;
        }
        if (bByteValue == 0) {
            return false;
        }
        Z z7 = Z.f13759c;
        z7.getClass();
        boolean zC = z7.a(abstractC1274w.getClass()).c(abstractC1274w);
        if (z6) {
            abstractC1274w.h(2);
        }
        return zC;
    }

    public static AbstractC1274w q(AbstractC1274w abstractC1274w, AbstractC1261i abstractC1261i, C1267o c1267o) throws C {
        C1260h c1260h = (C1260h) abstractC1261i;
        C1262j c1262jI = F1.L.i(c1260h.f13788d, c1260h.l(), c1260h.size(), true);
        AbstractC1274w abstractC1274wR = r(abstractC1274w, c1262jI, c1267o);
        c1262jI.c(0);
        f(abstractC1274wR);
        return abstractC1274wR;
    }

    public static AbstractC1274w r(AbstractC1274w abstractC1274w, F1.L l, C1267o c1267o) throws C {
        AbstractC1274w abstractC1274wP = abstractC1274w.p();
        try {
            Z z6 = Z.f13759c;
            z6.getClass();
            c0 c0VarA = z6.a(abstractC1274wP.getClass());
            C0629x c0629x = (C0629x) l.f1379b;
            if (c0629x == null) {
                c0629x = new C0629x(l, (byte) 0);
            }
            c0VarA.e(abstractC1274wP, c0629x, c1267o);
            c0VarA.b(abstractC1274wP);
            return abstractC1274wP;
        } catch (C e6) {
            if (e6.f13716a) {
                throw new C(e6.getMessage(), e6);
            }
            throw e6;
        } catch (e0 e7) {
            throw new C(e7.getMessage());
        } catch (IOException e8) {
            if (e8.getCause() instanceof C) {
                throw ((C) e8.getCause());
            }
            throw new C(e8.getMessage(), e8);
        } catch (RuntimeException e9) {
            if (e9.getCause() instanceof C) {
                throw ((C) e9.getCause());
            }
            throw e9;
        }
    }

    public static void s(Class cls, AbstractC1274w abstractC1274w) {
        abstractC1274w.n();
        defaultInstanceMap.put(cls, abstractC1274w);
    }

    @Override // com.google.crypto.tink.shaded.protobuf.AbstractC1253a
    public final int a(c0 c0Var) {
        int iH;
        int iH2;
        if (m()) {
            if (c0Var == null) {
                Z z6 = Z.f13759c;
                z6.getClass();
                iH2 = z6.a(getClass()).h(this);
            } else {
                iH2 = c0Var.h(this);
            }
            if (iH2 >= 0) {
                return iH2;
            }
            throw new IllegalStateException(Z0.o.l("serialized size must be non-negative, was ", iH2));
        }
        int i6 = this.memoizedSerializedSize;
        if ((i6 & Integer.MAX_VALUE) != Integer.MAX_VALUE) {
            return i6 & Integer.MAX_VALUE;
        }
        if (c0Var == null) {
            Z z7 = Z.f13759c;
            z7.getClass();
            iH = z7.a(getClass()).h(this);
        } else {
            iH = c0Var.h(this);
        }
        t(iH);
        return iH;
    }

    @Override // com.google.crypto.tink.shaded.protobuf.AbstractC1253a
    public final void e(C1264l c1264l) {
        Z z6 = Z.f13759c;
        z6.getClass();
        c0 c0VarA = z6.a(getClass());
        L l = c1264l.f13809h;
        if (l == null) {
            l = new L(c1264l);
        }
        c0VarA.j(this, l);
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        Z z6 = Z.f13759c;
        z6.getClass();
        return z6.a(getClass()).f(this, (AbstractC1274w) obj);
    }

    public final AbstractC1272u g() {
        return (AbstractC1272u) h(5);
    }

    public abstract Object h(int i6);

    public final int hashCode() {
        if (m()) {
            Z z6 = Z.f13759c;
            z6.getClass();
            return z6.a(getClass()).g(this);
        }
        if (this.memoizedHashCode == 0) {
            Z z7 = Z.f13759c;
            z7.getClass();
            this.memoizedHashCode = z7.a(getClass()).g(this);
        }
        return this.memoizedHashCode;
    }

    @Override // com.google.crypto.tink.shaded.protobuf.Q
    /* JADX INFO: renamed from: j, reason: merged with bridge method [inline-methods] */
    public final AbstractC1274w getDefaultInstanceForType() {
        return (AbstractC1274w) h(6);
    }

    public final boolean m() {
        return (this.memoizedSerializedSize & Integer.MIN_VALUE) != 0;
    }

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

    @Override // com.google.crypto.tink.shaded.protobuf.AbstractC1253a
    /* JADX INFO: renamed from: o, reason: merged with bridge method [inline-methods] */
    public final AbstractC1272u c() {
        return (AbstractC1272u) h(5);
    }

    public final AbstractC1274w p() {
        return (AbstractC1274w) h(4);
    }

    public final void t(int i6) {
        if (i6 < 0) {
            throw new IllegalStateException(Z0.o.l("serialized size must be non-negative, was ", i6));
        }
        this.memoizedSerializedSize = (i6 & Integer.MAX_VALUE) | (this.memoizedSerializedSize & Integer.MIN_VALUE);
    }

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

    public final AbstractC1272u u() {
        AbstractC1272u abstractC1272u = (AbstractC1272u) h(5);
        if (!abstractC1272u.f13837a.equals(this)) {
            abstractC1272u.d();
            AbstractC1272u.e(abstractC1272u.f13838b, this);
        }
        return abstractC1272u;
    }
}
