package p402.p420;

import java.util.Iterator;
import java.util.NoSuchElementException;
import kotlin.TypeCastException;
import p402.C6541;
import p402.InterfaceC6540;
import p402.p411.p412.InterfaceC6618;
import p402.p411.p413.C6635;
import p402.p411.p413.p414.InterfaceC6650;
import p402.p417.C6662;
import p402.p417.C6664;
import p402.p419.InterfaceC6684;

/* JADX INFO: renamed from: ގ.ޔ.ؠ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
@InterfaceC6540
public final class C6690 implements InterfaceC6684<C6662> {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final CharSequence f19441;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final int f19442;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final int f19443;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final InterfaceC6618<CharSequence, Integer, C6541<Integer, Integer>> f19444;

    /* JADX INFO: renamed from: ގ.ޔ.ؠ$֏, reason: contains not printable characters */
    public static final class C6691 implements Iterator<C6662>, InterfaceC6650 {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public int f19445 = -1;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public int f19446;

        /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
        public int f19447;

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public C6662 f19448;

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public int f19449;

        public C6691() {
            int iM9842 = C6664.m9842(C6690.this.f19442, 0, C6690.this.f19441.length());
            this.f19446 = iM9842;
            this.f19447 = iM9842;
        }

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

        @Override // java.util.Iterator
        public C6662 next() {
            if (this.f19445 == -1) {
                m9850();
            }
            if (this.f19445 == 0) {
                throw new NoSuchElementException();
            }
            C6662 c6662 = this.f19448;
            if (c6662 == null) {
                throw new TypeCastException("null cannot be cast to non-null type kotlin.ranges.IntRange");
            }
            this.f19448 = null;
            this.f19445 = -1;
            return c6662;
        }

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

        /* JADX WARN: Removed duplicated region for block: B:11:0x0027  */
        /* JADX WARN: Removed duplicated region for block: B:9:0x001b  */
        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final void m9850() {
            if (this.f19447 < 0) {
                this.f19445 = 0;
                this.f19448 = null;
                return;
            }
            int i = C6690.this.f19443;
            if (i > 0) {
                int i2 = this.f19449 + 1;
                this.f19449 = i2;
                if (i2 < i) {
                    if (this.f19447 > C6690.this.f19441.length()) {
                        this.f19448 = new C6662(this.f19446, C6703.m9855(C6690.this.f19441));
                        this.f19447 = -1;
                    } else {
                        C6690 c6690 = C6690.this;
                        C6541<Integer, Integer> c6541Mo838 = c6690.f19444.mo838(c6690.f19441, Integer.valueOf(this.f19447));
                        if (c6541Mo838 == null) {
                            this.f19448 = new C6662(this.f19446, C6703.m9855(C6690.this.f19441));
                            this.f19447 = -1;
                        } else {
                            int iIntValue = c6541Mo838.f19316.intValue();
                            int iIntValue2 = c6541Mo838.f19317.intValue();
                            this.f19448 = C6664.m9846(this.f19446, iIntValue);
                            int i3 = iIntValue + iIntValue2;
                            this.f19446 = i3;
                            this.f19447 = i3 + (iIntValue2 == 0 ? 1 : 0);
                        }
                    }
                }
            }
            this.f19445 = 1;
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public C6690(CharSequence charSequence, int i, int i2, InterfaceC6618<? super CharSequence, ? super Integer, C6541<Integer, Integer>> interfaceC6618) {
        if (charSequence == null) {
            C6635.m9824("input");
            throw null;
        }
        if (interfaceC6618 == 0) {
            C6635.m9824("getNextMatch");
            throw null;
        }
        this.f19441 = charSequence;
        this.f19442 = i;
        this.f19443 = i2;
        this.f19444 = interfaceC6618;
    }

    @Override // p402.p419.InterfaceC6684
    public Iterator<C6662> iterator() {
        return new C6691();
    }
}
