package androidx.datastore.preferences.protobuf;

import com.google.protobuf.L0;
import java.util.AbstractMap;
import java.util.Iterator;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class e0 implements Iterator {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f11374a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f11375b = -1;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f11376c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Iterator f11377d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ AbstractMap f11378e;

    public /* synthetic */ e0(AbstractMap abstractMap, int i6) {
        this.f11374a = i6;
        this.f11378e = abstractMap;
    }

    public final Iterator a() {
        switch (this.f11374a) {
            case 0:
                if (this.f11377d == null) {
                    this.f11377d = ((Z) this.f11378e).f11357c.entrySet().iterator();
                }
                break;
            default:
                if (this.f11377d == null) {
                    this.f11377d = ((L0) this.f11378e).f14213c.entrySet().iterator();
                }
                break;
        }
        return this.f11377d;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        switch (this.f11374a) {
            case 0:
                int i6 = this.f11375b + 1;
                Z z6 = (Z) this.f11378e;
                if (i6 >= z6.f11356b.size()) {
                    if (z6.f11357c.isEmpty() || !a().hasNext()) {
                    }
                }
                break;
            default:
                int i7 = this.f11375b + 1;
                L0 l02 = (L0) this.f11378e;
                if (i7 >= l02.f14212b.size()) {
                    if (l02.f14213c.isEmpty() || !a().hasNext()) {
                    }
                }
                break;
        }
        return true;
    }

    @Override // java.util.Iterator
    public final Object next() {
        switch (this.f11374a) {
            case 0:
                this.f11376c = true;
                int i6 = this.f11375b + 1;
                this.f11375b = i6;
                Z z6 = (Z) this.f11378e;
                if (i6 >= z6.f11356b.size()) {
                }
                break;
            default:
                this.f11376c = true;
                int i7 = this.f11375b + 1;
                this.f11375b = i7;
                L0 l02 = (L0) this.f11378e;
                if (i7 >= l02.f14212b.size()) {
                }
                break;
        }
        return (Map.Entry) a().next();
    }

    @Override // java.util.Iterator
    public final void remove() {
        AbstractMap abstractMap = this.f11378e;
        switch (this.f11374a) {
            case 0:
                if (!this.f11376c) {
                    throw new IllegalStateException("remove() was called before next()");
                }
                this.f11376c = false;
                int i6 = Z.f11354j;
                Z z6 = (Z) abstractMap;
                z6.b();
                if (this.f11375b >= z6.f11356b.size()) {
                    a().remove();
                    return;
                }
                int i7 = this.f11375b;
                this.f11375b = i7 - 1;
                z6.h(i7);
                return;
            default:
                if (!this.f11376c) {
                    throw new IllegalStateException("remove() was called before next()");
                }
                this.f11376c = false;
                int i8 = L0.f14210j;
                L0 l02 = (L0) abstractMap;
                l02.b();
                if (this.f11375b >= l02.f14212b.size()) {
                    a().remove();
                    return;
                }
                int i9 = this.f11375b;
                this.f11375b = i9 - 1;
                l02.h(i9);
                return;
        }
    }
}
