package E1;

import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: loaded from: classes.dex */
final class e implements D1.f {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final CharSequence f539a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final int f540b;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final y1.p f542d;

    public static final class a implements Iterator, z1.a {

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

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        private int f545g;

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

        /* JADX INFO: renamed from: x, reason: collision with root package name */
        private kotlin.ranges.i f547x;

        /* JADX INFO: renamed from: y, reason: collision with root package name */
        private int f548y;

        a() {
            int iF = kotlin.ranges.m.f(e.this.f540b, 0, e.this.f539a.length());
            this.f545g = iF;
            this.f546r = iF;
        }

        /* JADX WARN: Removed duplicated region for block: B:9:0x0023  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
            To view partially-correct add '--show-bad-code' argument
        */
        private final void a() {
            /*
                r6 = this;
                int r0 = r6.f546r
                r1 = 0
                if (r0 >= 0) goto Lc
                r6.f544b = r1
                r0 = 0
                r6.f547x = r0
                goto L9e
            Lc:
                E1.e r0 = E1.e.this
                int r0 = E1.e.d(r0)
                r2 = -1
                r3 = 1
                if (r0 <= 0) goto L23
                int r0 = r6.f548y
                int r0 = r0 + r3
                r6.f548y = r0
                E1.e r4 = E1.e.this
                int r4 = E1.e.d(r4)
                if (r0 >= r4) goto L31
            L23:
                int r0 = r6.f546r
                E1.e r4 = E1.e.this
                java.lang.CharSequence r4 = E1.e.c(r4)
                int r4 = r4.length()
                if (r0 <= r4) goto L47
            L31:
                kotlin.ranges.i r0 = new kotlin.ranges.i
                int r1 = r6.f545g
                E1.e r4 = E1.e.this
                java.lang.CharSequence r4 = E1.e.c(r4)
                int r4 = E1.q.I(r4)
                r0.<init>(r1, r4)
                r6.f547x = r0
                r6.f546r = r2
                goto L9c
            L47:
                E1.e r0 = E1.e.this
                y1.p r0 = E1.e.b(r0)
                E1.e r4 = E1.e.this
                java.lang.CharSequence r4 = E1.e.c(r4)
                int r5 = r6.f546r
                java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
                java.lang.Object r0 = r0.invoke(r4, r5)
                n1.k r0 = (n1.k) r0
                if (r0 != 0) goto L77
                kotlin.ranges.i r0 = new kotlin.ranges.i
                int r1 = r6.f545g
                E1.e r4 = E1.e.this
                java.lang.CharSequence r4 = E1.e.c(r4)
                int r4 = E1.q.I(r4)
                r0.<init>(r1, r4)
                r6.f547x = r0
                r6.f546r = r2
                goto L9c
            L77:
                java.lang.Object r2 = r0.a()
                java.lang.Number r2 = (java.lang.Number) r2
                int r2 = r2.intValue()
                java.lang.Object r0 = r0.b()
                java.lang.Number r0 = (java.lang.Number) r0
                int r0 = r0.intValue()
                int r4 = r6.f545g
                kotlin.ranges.i r4 = kotlin.ranges.m.i(r4, r2)
                r6.f547x = r4
                int r2 = r2 + r0
                r6.f545g = r2
                if (r0 != 0) goto L99
                r1 = r3
            L99:
                int r2 = r2 + r1
                r6.f546r = r2
            L9c:
                r6.f544b = r3
            L9e:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: E1.e.a.a():void");
        }

        @Override // java.util.Iterator
        /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
        public kotlin.ranges.i next() {
            if (this.f544b == -1) {
                a();
            }
            if (this.f544b == 0) {
                throw new NoSuchElementException();
            }
            kotlin.ranges.i iVar = this.f547x;
            kotlin.jvm.internal.l.c(iVar, "null cannot be cast to non-null type kotlin.ranges.IntRange");
            this.f547x = null;
            this.f544b = -1;
            return iVar;
        }

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

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

    public e(CharSequence input, int i2, int i3, y1.p getNextMatch) {
        kotlin.jvm.internal.l.e(input, "input");
        kotlin.jvm.internal.l.e(getNextMatch, "getNextMatch");
        this.f539a = input;
        this.f540b = i2;
        this.f541c = i3;
        this.f542d = getNextMatch;
    }

    @Override // D1.f
    public Iterator iterator() {
        return new a();
    }
}
