package com.google.protobuf;

import com.google.protobuf.r0;
import com.google.protobuf.u1;
import com.google.protobuf.x;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/* loaded from: classes3.dex */
final class r extends q {

    /* loaded from: classes3.dex */
    static /* synthetic */ class a {

        /* renamed from: a, reason: collision with root package name */
        static final /* synthetic */ int[] f15160a;

        static {
            int[] iArr = new int[u1.b.values().length];
            f15160a = iArr;
            try {
                iArr[u1.b.DOUBLE.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f15160a[u1.b.FLOAT.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f15160a[u1.b.INT64.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                f15160a[u1.b.UINT64.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                f15160a[u1.b.INT32.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                f15160a[u1.b.FIXED64.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                f15160a[u1.b.FIXED32.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                f15160a[u1.b.BOOL.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                f15160a[u1.b.UINT32.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                f15160a[u1.b.SFIXED32.ordinal()] = 10;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                f15160a[u1.b.SFIXED64.ordinal()] = 11;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                f15160a[u1.b.SINT32.ordinal()] = 12;
            } catch (NoSuchFieldError unused12) {
            }
            try {
                f15160a[u1.b.SINT64.ordinal()] = 13;
            } catch (NoSuchFieldError unused13) {
            }
            try {
                f15160a[u1.b.ENUM.ordinal()] = 14;
            } catch (NoSuchFieldError unused14) {
            }
            try {
                f15160a[u1.b.BYTES.ordinal()] = 15;
            } catch (NoSuchFieldError unused15) {
            }
            try {
                f15160a[u1.b.STRING.ordinal()] = 16;
            } catch (NoSuchFieldError unused16) {
            }
            try {
                f15160a[u1.b.GROUP.ordinal()] = 17;
            } catch (NoSuchFieldError unused17) {
            }
            try {
                f15160a[u1.b.MESSAGE.ordinal()] = 18;
            } catch (NoSuchFieldError unused18) {
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public int a(Map.Entry entry) {
        return ((x.c) entry.getKey()).getNumber();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public Object b(p pVar, r0 r0Var, int i10) {
        return pVar.a(r0Var, i10);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public t c(Object obj) {
        android.support.v4.media.session.b.a(obj);
        throw null;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public t d(Object obj) {
        android.support.v4.media.session.b.a(obj);
        throw null;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public boolean e(r0 r0Var) {
        return false;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public void f(Object obj) {
        c(obj).s();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public Object g(Object obj, g1 g1Var, Object obj2, p pVar, t tVar, Object obj3, o1 o1Var) {
        Object valueOf;
        Object h10;
        ArrayList arrayList;
        x.d dVar = (x.d) obj2;
        int d10 = dVar.d();
        if (dVar.f15245d.b() && dVar.f15245d.isPacked()) {
            switch (a.f15160a[dVar.b().ordinal()]) {
                case 1:
                    arrayList = new ArrayList();
                    g1Var.F(arrayList);
                    break;
                case 2:
                    arrayList = new ArrayList();
                    g1Var.A(arrayList);
                    break;
                case 3:
                    arrayList = new ArrayList();
                    g1Var.m(arrayList);
                    break;
                case 4:
                    arrayList = new ArrayList();
                    g1Var.k(arrayList);
                    break;
                case 5:
                    arrayList = new ArrayList();
                    g1Var.o(arrayList);
                    break;
                case 6:
                    arrayList = new ArrayList();
                    g1Var.I(arrayList);
                    break;
                case 7:
                    arrayList = new ArrayList();
                    g1Var.r(arrayList);
                    break;
                case 8:
                    arrayList = new ArrayList();
                    g1Var.u(arrayList);
                    break;
                case 9:
                    arrayList = new ArrayList();
                    g1Var.g(arrayList);
                    break;
                case 10:
                    arrayList = new ArrayList();
                    g1Var.e(arrayList);
                    break;
                case 11:
                    arrayList = new ArrayList();
                    g1Var.n(arrayList);
                    break;
                case 12:
                    arrayList = new ArrayList();
                    g1Var.b(arrayList);
                    break;
                case 13:
                    arrayList = new ArrayList();
                    g1Var.f(arrayList);
                    break;
                case 14:
                    arrayList = new ArrayList();
                    g1Var.p(arrayList);
                    obj3 = j1.z(obj, d10, arrayList, dVar.f15245d.e(), obj3, o1Var);
                    break;
                default:
                    throw new IllegalStateException("Type cannot be packed: " + dVar.f15245d.c());
            }
            tVar.w(dVar.f15245d, arrayList);
        } else {
            if (dVar.b() != u1.b.ENUM) {
                switch (a.f15160a[dVar.b().ordinal()]) {
                    case 1:
                        valueOf = Double.valueOf(g1Var.readDouble());
                        break;
                    case 2:
                        valueOf = Float.valueOf(g1Var.readFloat());
                        break;
                    case 3:
                        valueOf = Long.valueOf(g1Var.G());
                        break;
                    case 4:
                        valueOf = Long.valueOf(g1Var.c());
                        break;
                    case 5:
                        valueOf = Integer.valueOf(g1Var.B());
                        break;
                    case 6:
                        valueOf = Long.valueOf(g1Var.d());
                        break;
                    case 7:
                        valueOf = Integer.valueOf(g1Var.h());
                        break;
                    case 8:
                        valueOf = Boolean.valueOf(g1Var.i());
                        break;
                    case 9:
                        valueOf = Integer.valueOf(g1Var.l());
                        break;
                    case 10:
                        valueOf = Integer.valueOf(g1Var.D());
                        break;
                    case 11:
                        valueOf = Long.valueOf(g1Var.j());
                        break;
                    case 12:
                        valueOf = Integer.valueOf(g1Var.s());
                        break;
                    case 13:
                        valueOf = Long.valueOf(g1Var.t());
                        break;
                    case 14:
                        throw new IllegalStateException("Shouldn't reach here.");
                    case 15:
                        valueOf = g1Var.z();
                        break;
                    case 16:
                        valueOf = g1Var.v();
                        break;
                    case 17:
                        if (!dVar.e()) {
                            Object h11 = tVar.h(dVar.f15245d);
                            if (h11 instanceof x) {
                                h1 d11 = d1.a().d(h11);
                                if (!((x) h11).isMutable()) {
                                    Object f10 = d11.f();
                                    d11.a(f10, h11);
                                    tVar.w(dVar.f15245d, f10);
                                    h11 = f10;
                                }
                                g1Var.L(h11, d11, pVar);
                                return obj3;
                            }
                        }
                        valueOf = g1Var.N(dVar.c().getClass(), pVar);
                        break;
                    case 18:
                        if (!dVar.e()) {
                            Object h12 = tVar.h(dVar.f15245d);
                            if (h12 instanceof x) {
                                h1 d12 = d1.a().d(h12);
                                if (!((x) h12).isMutable()) {
                                    Object f11 = d12.f();
                                    d12.a(f11, h12);
                                    tVar.w(dVar.f15245d, f11);
                                    h12 = f11;
                                }
                                g1Var.O(h12, d12, pVar);
                                return obj3;
                            }
                        }
                        valueOf = g1Var.K(dVar.c().getClass(), pVar);
                        break;
                    default:
                        valueOf = null;
                        break;
                }
            } else {
                int B = g1Var.B();
                if (dVar.f15245d.e().findValueByNumber(B) == null) {
                    return j1.J(obj, d10, B, obj3, o1Var);
                }
                valueOf = Integer.valueOf(B);
            }
            if (dVar.e()) {
                tVar.a(dVar.f15245d, valueOf);
            } else {
                int i10 = a.f15160a[dVar.b().ordinal()];
                if ((i10 == 17 || i10 == 18) && (h10 = tVar.h(dVar.f15245d)) != null) {
                    valueOf = z.h(h10, valueOf);
                }
                tVar.w(dVar.f15245d, valueOf);
            }
        }
        return obj3;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public void h(g1 g1Var, Object obj, p pVar, t tVar) {
        x.d dVar = (x.d) obj;
        tVar.w(dVar.f15245d, g1Var.K(dVar.c().getClass(), pVar));
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public void i(h hVar, Object obj, p pVar, t tVar) {
        x.d dVar = (x.d) obj;
        r0.a newBuilderForType = dVar.c().newBuilderForType();
        i x10 = hVar.x();
        newBuilderForType.mergeFrom(x10, pVar);
        tVar.w(dVar.f15245d, newBuilderForType.buildPartial());
        x10.a(0);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.protobuf.q
    public void j(v1 v1Var, Map.Entry entry) {
        x.c cVar = (x.c) entry.getKey();
        if (!cVar.b()) {
            switch (a.f15160a[cVar.c().ordinal()]) {
                case 1:
                    v1Var.e(cVar.getNumber(), ((Double) entry.getValue()).doubleValue());
                    return;
                case 2:
                    v1Var.A(cVar.getNumber(), ((Float) entry.getValue()).floatValue());
                    return;
                case 3:
                    v1Var.n(cVar.getNumber(), ((Long) entry.getValue()).longValue());
                    return;
                case 4:
                    v1Var.l(cVar.getNumber(), ((Long) entry.getValue()).longValue());
                    return;
                case 5:
                    v1Var.r(cVar.getNumber(), ((Integer) entry.getValue()).intValue());
                    return;
                case 6:
                    v1Var.h(cVar.getNumber(), ((Long) entry.getValue()).longValue());
                    return;
                case 7:
                    v1Var.d(cVar.getNumber(), ((Integer) entry.getValue()).intValue());
                    return;
                case 8:
                    v1Var.o(cVar.getNumber(), ((Boolean) entry.getValue()).booleanValue());
                    return;
                case 9:
                    v1Var.b(cVar.getNumber(), ((Integer) entry.getValue()).intValue());
                    return;
                case 10:
                    v1Var.p(cVar.getNumber(), ((Integer) entry.getValue()).intValue());
                    return;
                case 11:
                    v1Var.u(cVar.getNumber(), ((Long) entry.getValue()).longValue());
                    return;
                case 12:
                    v1Var.H(cVar.getNumber(), ((Integer) entry.getValue()).intValue());
                    return;
                case 13:
                    v1Var.z(cVar.getNumber(), ((Long) entry.getValue()).longValue());
                    return;
                case 14:
                    v1Var.r(cVar.getNumber(), ((Integer) entry.getValue()).intValue());
                    return;
                case 15:
                    v1Var.N(cVar.getNumber(), (h) entry.getValue());
                    return;
                case 16:
                    v1Var.k(cVar.getNumber(), (String) entry.getValue());
                    return;
                case 17:
                    v1Var.M(cVar.getNumber(), entry.getValue(), d1.a().c(entry.getValue().getClass()));
                    return;
                case 18:
                    v1Var.L(cVar.getNumber(), entry.getValue(), d1.a().c(entry.getValue().getClass()));
                    return;
                default:
                    return;
            }
        }
        switch (a.f15160a[cVar.c().ordinal()]) {
            case 1:
                j1.O(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 2:
                j1.S(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 3:
                j1.V(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 4:
                j1.d0(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 5:
                j1.U(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 6:
                j1.R(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 7:
                j1.Q(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 8:
                j1.M(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 9:
                j1.c0(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 10:
                j1.X(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 11:
                j1.Y(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 12:
                j1.Z(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 13:
                j1.a0(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 14:
                j1.U(cVar.getNumber(), (List) entry.getValue(), v1Var, cVar.isPacked());
                return;
            case 15:
                j1.N(cVar.getNumber(), (List) entry.getValue(), v1Var);
                return;
            case 16:
                j1.b0(cVar.getNumber(), (List) entry.getValue(), v1Var);
                return;
            case 17:
                List list = (List) entry.getValue();
                if (list == null || list.isEmpty()) {
                    return;
                }
                j1.T(cVar.getNumber(), (List) entry.getValue(), v1Var, d1.a().c(list.get(0).getClass()));
                return;
            case 18:
                List list2 = (List) entry.getValue();
                if (list2 == null || list2.isEmpty()) {
                    return;
                }
                j1.W(cVar.getNumber(), (List) entry.getValue(), v1Var, d1.a().c(list2.get(0).getClass()));
                return;
            default:
                return;
        }
    }
}
