package androidx.datastore.preferences;

import androidx.datastore.preferences.protobuf.GeneratedMessageLite$MethodToInvoke;
import androidx.datastore.preferences.protobuf.InvalidProtocolBufferException;
import androidx.datastore.preferences.protobuf.MapFieldLite;
import androidx.datastore.preferences.protobuf.UninitializedMessageException;
import androidx.datastore.preferences.protobuf.j;
import androidx.datastore.preferences.protobuf.l;
import androidx.datastore.preferences.protobuf.q;
import androidx.datastore.preferences.protobuf.u0;
import androidx.datastore.preferences.protobuf.v0;
import androidx.datastore.preferences.protobuf.w;
import androidx.datastore.preferences.protobuf.x;
import androidx.datastore.preferences.protobuf.x0;
import androidx.datastore.preferences.protobuf.y;
import androidx.datastore.preferences.protobuf.z0;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class e extends y {
    private static final e DEFAULT_INSTANCE;
    private static volatile u0 PARSER = null;
    public static final int PREFERENCES_FIELD_NUMBER = 1;
    private MapFieldLite<String, i> preferences_ = MapFieldLite.f2025a;

    static {
        e eVar = new e();
        DEFAULT_INSTANCE = eVar;
        y.k(e.class, eVar);
    }

    public static MapFieldLite n(e eVar) {
        if (!eVar.preferences_.b()) {
            eVar.preferences_ = eVar.preferences_.e();
        }
        return eVar.preferences_;
    }

    public static c p() {
        return (c) ((w) DEFAULT_INSTANCE.d(GeneratedMessageLite$MethodToInvoke.f2011e));
    }

    public static e q(FileInputStream fileInputStream) {
        e eVar = DEFAULT_INSTANCE;
        j jVar = new j(fileInputStream);
        q qVarA = q.a();
        y yVarJ = eVar.j();
        try {
            v0 v0Var = v0.f2160c;
            v0Var.getClass();
            z0 z0VarA = v0Var.a(yVarJ.getClass());
            l lVar = jVar.f2104d;
            if (lVar == null) {
                lVar = new l(jVar);
            }
            z0VarA.h(yVarJ, lVar, qVarA);
            z0VarA.b(yVarJ);
            if (y.g(yVarJ, true)) {
                return (e) yVarJ;
            }
            InvalidProtocolBufferException invalidProtocolBufferException = new InvalidProtocolBufferException(new UninitializedMessageException().getMessage());
            invalidProtocolBufferException.g(yVarJ);
            throw invalidProtocolBufferException;
        } catch (InvalidProtocolBufferException e10) {
            e = e10;
            if (e.a()) {
                e = new InvalidProtocolBufferException(e);
            }
            e.g(yVarJ);
            throw e;
        } catch (UninitializedMessageException e11) {
            InvalidProtocolBufferException invalidProtocolBufferException2 = new InvalidProtocolBufferException(e11.getMessage());
            invalidProtocolBufferException2.g(yVarJ);
            throw invalidProtocolBufferException2;
        } catch (IOException e12) {
            if (e12.getCause() instanceof InvalidProtocolBufferException) {
                throw ((InvalidProtocolBufferException) e12.getCause());
            }
            InvalidProtocolBufferException invalidProtocolBufferException3 = new InvalidProtocolBufferException(e12);
            invalidProtocolBufferException3.g(yVarJ);
            throw invalidProtocolBufferException3;
        } catch (RuntimeException e13) {
            if (e13.getCause() instanceof InvalidProtocolBufferException) {
                throw ((InvalidProtocolBufferException) e13.getCause());
            }
            throw e13;
        }
    }

    @Override // androidx.datastore.preferences.protobuf.y
    public final Object d(GeneratedMessageLite$MethodToInvoke generatedMessageLite$MethodToInvoke) {
        switch (generatedMessageLite$MethodToInvoke.ordinal()) {
            case 0:
                return (byte) 1;
            case 1:
                return null;
            case 2:
                return new x0(DEFAULT_INSTANCE, "\u0001\u0001\u0000\u0000\u0001\u0001\u0001\u0001\u0000\u0000\u00012", new Object[]{"preferences_", d.f1994a});
            case 3:
                return new e();
            case 4:
                return new c(DEFAULT_INSTANCE);
            case 5:
                return DEFAULT_INSTANCE;
            case 6:
                u0 xVar = PARSER;
                if (xVar == null) {
                    synchronized (e.class) {
                        try {
                            xVar = PARSER;
                            if (xVar == null) {
                                xVar = new x();
                                PARSER = xVar;
                            }
                        } finally {
                        }
                        break;
                    }
                }
                return xVar;
            default:
                throw new UnsupportedOperationException();
        }
    }

    public final Map o() {
        return Collections.unmodifiableMap(this.preferences_);
    }
}
