package V;

import G0.InterfaceC0279y;
import K.AbstractC0454g0;
import K.S0;
import T0.C0596g;
import T0.C0604o;
import Z0.C0860a;
import Z0.InterfaceC0866g;
import f1.EnumC2022j;
import java.util.List;
import n2.AbstractC2612c;
import o0.C2632c;
import x4.AbstractC3252r;

/* JADX INFO: loaded from: classes.dex */
public final class W {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final C0596g f7007a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final T0.L f7009c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Z0.r f7010d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final r0 f7011e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public long f7012f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final C0596g f7013g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final Z0.y f7014h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final S0 f7015i;

    public W(Z0.y yVar, Z0.r rVar, S0 s02, r0 r0Var) {
        C0596g c0596g = yVar.f9136a;
        T0.L l = s02 != null ? s02.f3742a : null;
        long j4 = yVar.f9137b;
        this.f7007a = c0596g;
        this.f7008b = j4;
        this.f7009c = l;
        this.f7010d = rVar;
        this.f7011e = r0Var;
        this.f7012f = j4;
        this.f7013g = c0596g;
        this.f7014h = yVar;
        this.f7015i = s02;
    }

    public final List a(J4.c cVar) {
        if (!T0.N.c(this.f7012f)) {
            return AbstractC3252r.B(new C0860a("", 0), new Z0.x(T0.N.f(this.f7012f), T0.N.f(this.f7012f)));
        }
        InterfaceC0866g interfaceC0866g = (InterfaceC0866g) cVar.invoke(this);
        if (interfaceC0866g != null) {
            return AbstractC2612c.q(interfaceC0866g);
        }
        return null;
    }

    public final Integer b() {
        T0.L l = this.f7009c;
        if (l == null) {
            return null;
        }
        int iE = T0.N.e(this.f7012f);
        Z0.r rVar = this.f7010d;
        int iB = rVar.b(iE);
        C0604o c0604o = l.f6472b;
        return Integer.valueOf(rVar.a(c0604o.c(c0604o.d(iB), true)));
    }

    public final Integer c() {
        T0.L l = this.f7009c;
        if (l == null) {
            return null;
        }
        int iF = T0.N.f(this.f7012f);
        Z0.r rVar = this.f7010d;
        return Integer.valueOf(rVar.a(l.f(l.f6472b.d(rVar.b(iF)))));
    }

    public final Integer d() {
        int length;
        T0.L l = this.f7009c;
        if (l == null) {
            return null;
        }
        int iR = r();
        while (true) {
            C0596g c0596g = this.f7007a;
            if (iR < c0596g.f6510b.length()) {
                int length2 = this.f7013g.f6510b.length() - 1;
                if (iR <= length2) {
                    length2 = iR;
                }
                long jI = l.i(length2);
                int i6 = T0.N.f6482c;
                int i7 = (int) (jI & 4294967295L);
                if (i7 > iR) {
                    length = this.f7010d.a(i7);
                    break;
                }
                iR++;
            } else {
                length = c0596g.f6510b.length();
                break;
            }
        }
        return Integer.valueOf(length);
    }

    public final Integer e() {
        int iA;
        T0.L l = this.f7009c;
        if (l == null) {
            return null;
        }
        int iR = r();
        while (true) {
            if (iR <= 0) {
                iA = 0;
                break;
            }
            int length = this.f7013g.f6510b.length() - 1;
            if (iR <= length) {
                length = iR;
            }
            long jI = l.i(length);
            int i6 = T0.N.f6482c;
            int i7 = (int) (jI >> 32);
            if (i7 < iR) {
                iA = this.f7010d.a(i7);
                break;
            }
            iR--;
        }
        return Integer.valueOf(iA);
    }

    public final boolean f() {
        T0.L l = this.f7009c;
        return (l != null ? l.g(r()) : null) != EnumC2022j.f16383b;
    }

    public final int g(T0.L l, int i6) {
        int iR = r();
        r0 r0Var = this.f7011e;
        if (r0Var.f7152a == null) {
            r0Var.f7152a = Float.valueOf(l.c(iR).f21787a);
        }
        int iD = l.f6472b.d(iR) + i6;
        if (iD < 0) {
            return 0;
        }
        C0604o c0604o = l.f6472b;
        if (iD >= c0604o.f6537f) {
            return this.f7013g.f6510b.length();
        }
        float fB = c0604o.b(iD) - 1;
        Float f6 = r0Var.f7152a;
        kotlin.jvm.internal.o.e(f6);
        float fFloatValue = f6.floatValue();
        if ((f() && fFloatValue >= l.e(iD)) || (!f() && fFloatValue <= l.d(iD))) {
            return c0604o.c(iD, true);
        }
        return this.f7010d.a(c0604o.g((((long) Float.floatToRawIntBits(f6.floatValue())) << 32) | (((long) Float.floatToRawIntBits(fB)) & 4294967295L)));
    }

    /* JADX WARN: Removed duplicated region for block: B:9:0x0011  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final int h(S0 s02, int i6) {
        C2632c c2632cD0;
        InterfaceC0279y interfaceC0279y = s02.f3743b;
        if (interfaceC0279y == null) {
            c2632cD0 = C2632c.f21786e;
        } else {
            InterfaceC0279y interfaceC0279y2 = s02.f3744c;
            c2632cD0 = interfaceC0279y2 != null ? interfaceC0279y2.d0(interfaceC0279y, true) : null;
            if (c2632cD0 == null) {
            }
        }
        long j4 = this.f7014h.f9137b;
        int i7 = T0.N.f6482c;
        Z0.r rVar = this.f7010d;
        int iB = rVar.b((int) (j4 & 4294967295L));
        T0.L l = s02.f3742a;
        C2632c c2632cC = l.c(iB);
        return rVar.a(l.f6472b.g((((long) Float.floatToRawIntBits((Float.intBitsToFloat((int) (c2632cD0.c() & 4294967295L)) * i6) + c2632cC.f21788b)) & 4294967295L) | (Float.floatToRawIntBits(c2632cC.f21787a) << 32)));
    }

    public final void i() {
        C0596g c0596g = this.f7013g;
        r0 r0Var = this.f7011e;
        r0Var.f7152a = null;
        if (c0596g.f6510b.length() > 0) {
            if (f()) {
                k();
                return;
            }
            r0Var.f7152a = null;
            if (c0596g.f6510b.length() > 0) {
                String str = c0596g.f6510b;
                long j4 = this.f7012f;
                int i6 = T0.N.f6482c;
                int iJ = AbstractC0454g0.j((int) (j4 & 4294967295L), str);
                if (iJ != -1) {
                    q(iJ, iJ);
                }
            }
        }
    }

    public final void j() {
        this.f7011e.f7152a = null;
        C0596g c0596g = this.f7013g;
        if (c0596g.f6510b.length() > 0) {
            int iE = T0.N.e(this.f7012f);
            String str = c0596g.f6510b;
            int iK = AbstractC0454g0.k(str, iE);
            if (iK == T0.N.e(this.f7012f) && iK != str.length()) {
                iK = AbstractC0454g0.k(str, iK + 1);
            }
            q(iK, iK);
        }
    }

    public final void k() {
        this.f7011e.f7152a = null;
        C0596g c0596g = this.f7013g;
        if (c0596g.f6510b.length() > 0) {
            long j4 = this.f7012f;
            int i6 = T0.N.f6482c;
            int iM = AbstractC0454g0.m((int) (j4 & 4294967295L), c0596g.f6510b);
            if (iM != -1) {
                q(iM, iM);
            }
        }
    }

    public final void l() {
        this.f7011e.f7152a = null;
        C0596g c0596g = this.f7013g;
        if (c0596g.f6510b.length() > 0) {
            int iF = T0.N.f(this.f7012f);
            String str = c0596g.f6510b;
            int iL = AbstractC0454g0.l(str, iF);
            if (iL == T0.N.f(this.f7012f) && iL != 0) {
                iL = AbstractC0454g0.l(str, iL - 1);
            }
            q(iL, iL);
        }
    }

    public final void m() {
        C0596g c0596g = this.f7013g;
        r0 r0Var = this.f7011e;
        r0Var.f7152a = null;
        if (c0596g.f6510b.length() > 0) {
            if (!f()) {
                k();
                return;
            }
            r0Var.f7152a = null;
            if (c0596g.f6510b.length() > 0) {
                String str = c0596g.f6510b;
                long j4 = this.f7012f;
                int i6 = T0.N.f6482c;
                int iJ = AbstractC0454g0.j((int) (j4 & 4294967295L), str);
                if (iJ != -1) {
                    q(iJ, iJ);
                }
            }
        }
    }

    public final void n() {
        Integer numB;
        this.f7011e.f7152a = null;
        if (this.f7013g.f6510b.length() <= 0 || (numB = b()) == null) {
            return;
        }
        int iIntValue = numB.intValue();
        q(iIntValue, iIntValue);
    }

    public final void o() {
        Integer numC;
        this.f7011e.f7152a = null;
        if (this.f7013g.f6510b.length() <= 0 || (numC = c()) == null) {
            return;
        }
        int iIntValue = numC.intValue();
        q(iIntValue, iIntValue);
    }

    public final void p() {
        if (this.f7013g.f6510b.length() > 0) {
            int i6 = T0.N.f6482c;
            this.f7012f = android.support.v4.media.session.b.g((int) (this.f7008b >> 32), (int) (this.f7012f & 4294967295L));
        }
    }

    public final void q(int i6, int i7) {
        this.f7012f = android.support.v4.media.session.b.g(i6, i7);
    }

    public final int r() {
        long j4 = this.f7012f;
        int i6 = T0.N.f6482c;
        return this.f7010d.b((int) (j4 & 4294967295L));
    }
}
