package R4;

import java.util.Iterator;

/* JADX INFO: loaded from: classes3.dex */
public final class c implements k, d {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final k f6089b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final int f6090c;

    public c(k kVar, int i6, int i7) {
        this.f6088a = i7;
        switch (i7) {
            case 1:
                this.f6089b = kVar;
                this.f6090c = i6;
                if (i6 >= 0) {
                    return;
                }
                throw new IllegalArgumentException(("count must be non-negative, but was " + i6 + '.').toString());
            default:
                this.f6089b = kVar;
                this.f6090c = i6;
                if (i6 >= 0) {
                    return;
                }
                throw new IllegalArgumentException(("count must be non-negative, but was " + i6 + '.').toString());
        }
    }

    @Override // R4.d
    public final k a(int i6) {
        switch (this.f6088a) {
            case 0:
                int i7 = this.f6090c;
                int i8 = i7 + i6;
                return i8 < 0 ? new c(this, i6, 1) : new r(this.f6089b, i7, i8);
            default:
                return i6 >= this.f6090c ? this : new c(this.f6089b, i6, 1);
        }
    }

    @Override // R4.d
    public final k b(int i6) {
        switch (this.f6088a) {
            case 0:
                int i7 = this.f6090c + i6;
                return i7 < 0 ? new c(this, i6, 0) : new c(this.f6089b, i7, 0);
            default:
                int i8 = this.f6090c;
                return i6 >= i8 ? e.f6091a : new r(this.f6089b, i6, i8);
        }
    }

    @Override // R4.k
    public final Iterator iterator() {
        switch (this.f6088a) {
            case 0:
                return new b(this);
            default:
                return new b(this, (byte) 0);
        }
    }
}
