package W6;

import F5.C0115b;
import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: loaded from: classes.dex */
public final class g implements Iterator, Q6.a {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public Object f7204q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public int f7205r = -2;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final /* synthetic */ f f7206s;

    public g(f fVar) {
        this.f7206s = fVar;
    }

    /* JADX WARN: Type inference failed for: r0v2, types: [O6.l, P6.h] */
    public final void a() {
        Object objB;
        int i = this.f7205r;
        f fVar = this.f7206s;
        if (i == -2) {
            objB = ((C0115b) fVar.f7202b).f2531r;
        } else {
            ?? r02 = (P6.h) fVar.f7203c;
            Object obj = this.f7204q;
            P6.g.b(obj);
            objB = r02.b(obj);
        }
        this.f7204q = objB;
        this.f7205r = objB == null ? 0 : 1;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        if (this.f7205r < 0) {
            a();
        }
        return this.f7205r == 1;
    }

    @Override // java.util.Iterator
    public final Object next() {
        if (this.f7205r < 0) {
            a();
        }
        if (this.f7205r == 0) {
            throw new NoSuchElementException();
        }
        Object obj = this.f7204q;
        P6.g.c(obj, "null cannot be cast to non-null type T of kotlin.sequences.GeneratorSequence");
        this.f7205r = -1;
        return obj;
    }

    @Override // java.util.Iterator
    public final void remove() {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }
}
