package X6;

import O6.p;
import java.util.Iterator;
import java.util.NoSuchElementException;

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

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

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public int f7239r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public int f7240s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public U6.c f7241t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final /* synthetic */ W6.f f7242u;

    public b(W6.f fVar) {
        this.f7242u = fVar;
        fVar.getClass();
        int i = s7.d.i(0, ((CharSequence) fVar.f7202b).length());
        this.f7239r = i;
        this.f7240s = i;
    }

    public final void a() {
        A6.h hVar;
        int i = this.f7240s;
        if (i < 0) {
            this.f7238q = 0;
            this.f7241t = null;
            return;
        }
        W6.f fVar = this.f7242u;
        fVar.getClass();
        CharSequence charSequence = (CharSequence) fVar.f7202b;
        if (i <= charSequence.length() && (hVar = (A6.h) ((p) fVar.f7203c).k(charSequence, Integer.valueOf(this.f7240s))) != null) {
            int iIntValue = ((Number) hVar.f446q).intValue();
            int iIntValue2 = ((Number) hVar.f447r).intValue();
            this.f7241t = s7.d.H(this.f7239r, iIntValue);
            int i5 = iIntValue + iIntValue2;
            this.f7239r = i5;
            this.f7240s = i5 + (iIntValue2 == 0 ? 1 : 0);
        } else {
            this.f7241t = new U6.c(this.f7239r, e.Q(charSequence), 1);
            this.f7240s = -1;
        }
        this.f7238q = 1;
    }

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

    @Override // java.util.Iterator
    public final Object next() {
        if (this.f7238q == -1) {
            a();
        }
        if (this.f7238q == 0) {
            throw new NoSuchElementException();
        }
        U6.c cVar = this.f7241t;
        P6.g.c(cVar, "null cannot be cast to non-null type kotlin.ranges.IntRange");
        this.f7241t = null;
        this.f7238q = -1;
        return cVar;
    }

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