package R1;

import androidx.datastore.preferences.protobuf.A;
import androidx.datastore.preferences.protobuf.AbstractC1013b;
import androidx.datastore.preferences.protobuf.AbstractC1030t;
import androidx.datastore.preferences.protobuf.AbstractC1032v;
import androidx.datastore.preferences.protobuf.C1018g;
import androidx.datastore.preferences.protobuf.C1029s;
import androidx.datastore.preferences.protobuf.InterfaceC1031u;
import androidx.datastore.preferences.protobuf.S;
import androidx.datastore.preferences.protobuf.T;
import androidx.datastore.preferences.protobuf.V;
import androidx.datastore.preferences.protobuf.W;
import androidx.datastore.preferences.protobuf.r;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import m1.AbstractC2464a;

/* JADX INFO: loaded from: classes.dex */
public final class g extends AbstractC1030t {
    private static final g DEFAULT_INSTANCE;
    private static volatile S PARSER = null;
    public static final int STRINGS_FIELD_NUMBER = 1;
    private InterfaceC1031u strings_ = V.f11343d;

    static {
        g gVar = new g();
        DEFAULT_INSTANCE = gVar;
        AbstractC1030t.j(g.class, gVar);
    }

    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$PrimitiveArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    public static void l(g gVar, Iterable iterable) {
        InterfaceC1031u interfaceC1031u = gVar.strings_;
        if (!((AbstractC1013b) interfaceC1031u).f11361a) {
            int size = interfaceC1031u.size();
            gVar.strings_ = interfaceC1031u.a(size == 0 ? 10 : size * 2);
        }
        List list = gVar.strings_;
        Charset charset = AbstractC1032v.f11445a;
        iterable.getClass();
        if (iterable instanceof A) {
            List listB = ((A) iterable).b();
            A a6 = (A) list;
            int size2 = list.size();
            for (Object obj : listB) {
                if (obj == null) {
                    String str = "Element at index " + (a6.size() - size2) + " is null.";
                    for (int size3 = a6.size() - 1; size3 >= size2; size3--) {
                        a6.remove(size3);
                    }
                    throw new NullPointerException(str);
                }
                if (obj instanceof C1018g) {
                    a6.i((C1018g) obj);
                } else {
                    a6.add((String) obj);
                }
            }
            return;
        }
        if (iterable instanceof T) {
            list.addAll((Collection) iterable);
            return;
        }
        if ((list instanceof ArrayList) && (iterable instanceof Collection)) {
            ((ArrayList) list).ensureCapacity(((Collection) iterable).size() + list.size());
        }
        int size4 = list.size();
        for (Object obj2 : iterable) {
            if (obj2 == null) {
                String str2 = "Element at index " + (list.size() - size4) + " is null.";
                for (int size5 = list.size() - 1; size5 >= size4; size5--) {
                    list.remove(size5);
                }
                throw new NullPointerException(str2);
            }
            list.add(obj2);
        }
    }

    public static g m() {
        return DEFAULT_INSTANCE;
    }

    public static f o() {
        return (f) ((r) DEFAULT_INSTANCE.c(5));
    }

    @Override // androidx.datastore.preferences.protobuf.AbstractC1030t
    public final Object c(int i6) {
        S c1029s;
        switch (AbstractC2464a.c(i6)) {
            case 0:
                return (byte) 1;
            case 1:
                return null;
            case 2:
                return new W(DEFAULT_INSTANCE, "\u0001\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0001\u0000\u0001\u001a", new Object[]{"strings_"});
            case 3:
                return new g();
            case 4:
                return new f(DEFAULT_INSTANCE);
            case 5:
                return DEFAULT_INSTANCE;
            case 6:
                S s6 = PARSER;
                if (s6 != null) {
                    return s6;
                }
                synchronized (g.class) {
                    try {
                        c1029s = PARSER;
                        if (c1029s == null) {
                            c1029s = new C1029s();
                            PARSER = c1029s;
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                    break;
                }
                return c1029s;
            default:
                throw new UnsupportedOperationException();
        }
    }

    public final InterfaceC1031u n() {
        return this.strings_;
    }
}
