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

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public final class F extends H {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final Class f10437c = Collections.unmodifiableList(Collections.EMPTY_LIST).getClass();

    public static List d(int i, long j8, Object obj) {
        List list = (List) n0.f10526c.i(j8, obj);
        if (list.isEmpty()) {
            List d8 = list instanceof E ? new D(i) : ((list instanceof X) && (list instanceof InterfaceC0758y)) ? ((InterfaceC0758y) list).q(i) : new ArrayList(i);
            n0.p(obj, j8, d8);
            return d8;
        }
        if (f10437c.isAssignableFrom(list.getClass())) {
            ArrayList arrayList = new ArrayList(list.size() + i);
            arrayList.addAll(list);
            n0.p(obj, j8, arrayList);
            return arrayList;
        }
        if (list instanceof i0) {
            D d9 = new D(list.size() + i);
            d9.addAll((i0) list);
            n0.p(obj, j8, d9);
            return d9;
        }
        if ((list instanceof X) && (list instanceof InterfaceC0758y)) {
            InterfaceC0758y interfaceC0758y = (InterfaceC0758y) list;
            if (!((AbstractC0736b) interfaceC0758y).f10478q) {
                InterfaceC0758y interfaceC0758yQ = interfaceC0758y.q(list.size() + i);
                n0.p(obj, j8, interfaceC0758yQ);
                return interfaceC0758yQ;
            }
        }
        return list;
    }

    @Override // com.google.crypto.tink.shaded.protobuf.H
    public final void a(long j8, Object obj) {
        Object objUnmodifiableList;
        List list = (List) n0.f10526c.i(j8, obj);
        if (list instanceof E) {
            objUnmodifiableList = ((E) list).d();
        } else {
            if (f10437c.isAssignableFrom(list.getClass())) {
                return;
            }
            if ((list instanceof X) && (list instanceof InterfaceC0758y)) {
                AbstractC0736b abstractC0736b = (AbstractC0736b) ((InterfaceC0758y) list);
                if (abstractC0736b.f10478q) {
                    abstractC0736b.f10478q = false;
                    return;
                }
                return;
            }
            objUnmodifiableList = Collections.unmodifiableList(list);
        }
        n0.p(obj, j8, objUnmodifiableList);
    }

    @Override // com.google.crypto.tink.shaded.protobuf.H
    public final void b(Object obj, long j8, Object obj2) {
        List list = (List) n0.f10526c.i(j8, obj2);
        List listD = d(list.size(), j8, obj);
        int size = listD.size();
        int size2 = list.size();
        if (size > 0 && size2 > 0) {
            listD.addAll(list);
        }
        if (size > 0) {
            list = listD;
        }
        n0.p(obj, j8, list);
    }

    @Override // com.google.crypto.tink.shaded.protobuf.H
    public final List c(long j8, Object obj) {
        return d(10, j8, obj);
    }
}
