package o;

import android.os.Build;
import android.view.KeyEvent;
import android.view.ViewConfiguration;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.i50, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1453i50 extends AbstractC0561Vq implements KJ, P50, InterfaceC0581Wk, LX {
    public OU B;
    public C2304r40 C;
    public boolean D;
    public KQ E;
    public C1210ff F;
    public C1334gt G;
    public boolean H;
    public long I;
    public Wb0 J;
    public C1734l4 K;
    public final JR L;
    public final C0687a50 M;
    public final C3031ym0 N;
    public final C2212q50 O;
    public final C2160pe P;
    public final C1891mm Q;
    public C1825m2 R;
    public C1165f50 S;
    public C0173Gr T;

    public C1453i50(C1734l4 c1734l4, KQ kq, OU ou, InterfaceC1547j50 interfaceC1547j50, boolean z, boolean z2) {
        C2304r40 c2304r40 = androidx.compose.foundation.gestures.a.a;
        this.B = ou;
        this.C = c2304r40;
        this.D = z;
        this.E = kq;
        this.I = 0L;
        this.K = c1734l4;
        JR jr = new JR();
        this.L = jr;
        C0687a50 c0687a50 = new C0687a50();
        c0687a50.z = z;
        H0(c0687a50);
        this.M = c0687a50;
        C3031ym0 c3031ym0 = new C3031ym0(new C0247Jn(5, new WT(androidx.compose.foundation.gestures.a.d)));
        this.N = c3031ym0;
        C2212q50 c2212q50 = new C2212q50(interfaceC1547j50, this.K, c3031ym0, ou, z2, jr, this, new C0667Zs(this, 2));
        this.O = c2212q50;
        C2160pe c2160pe = new C2160pe(z, c2212q50);
        this.P = c2160pe;
        C1891mm c1891mm = new C1891mm(ou, c2212q50, z2);
        H0(c1891mm);
        this.Q = c1891mm;
        H0(new NR(c2160pe, jr));
        H0(new C1556jA(2, null, 4));
        C0341Ne c0341Ne = new C0341Ne();
        c0341Ne.z = c1891mm;
        H0(c0341Ne);
        S1 s1 = new S1(17, this);
        C2031oA c2031oA = new C2031oA();
        c2031oA.z = s1;
        H0(c2031oA);
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final java.lang.Object K0(o.C1453i50 r8, o.AbstractC0298Lm r9) throws java.lang.Throwable {
        /*
            boolean r0 = r9 instanceof o.C0856bt
            if (r0 == 0) goto L13
            r0 = r9
            o.bt r0 = (o.C0856bt) r0
            int r1 = r0.q
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r3 = r1 & r2
            if (r3 == 0) goto L13
            int r1 = r1 - r2
            r0.q = r1
            goto L18
        L13:
            o.bt r0 = new o.bt
            r0.<init>(r8, r9)
        L18:
            java.lang.Object r9 = r0.f464o
            int r1 = r0.q
            r6 = 0
            r2 = 1
            if (r1 == 0) goto L2e
            if (r1 != r2) goto L26
            o.IJ.H(r9)
            goto L49
        L26:
            java.lang.IllegalStateException r8 = new java.lang.IllegalStateException
            java.lang.String r9 = "call to 'resume' before 'invoke' with coroutine"
            r8.<init>(r9)
            throw r8
        L2e:
            o.IJ.H(r9)
            o.gt r9 = r8.G
            if (r9 == 0) goto L4b
            o.KQ r1 = r8.E
            if (r1 == 0) goto L49
            o.ft r3 = new o.ft
            r3.<init>(r9)
            r0.q = r2
            java.lang.Object r9 = r1.a(r3, r0)
            o.Dn r0 = o.EnumC0091Dn.l
            if (r9 != r0) goto L49
            return r0
        L49:
            r8.G = r6
        L4b:
            o.JR r9 = r8.L
            o.Cn r9 = r9.c()
            o.f50 r2 = new o.f50
            r7 = 0
            r4 = 0
            r3 = r8
            r2.<init>(r3, r4, r6, r7)
            r8 = 3
            o.AbstractC1692kh0.C(r9, r6, r2, r8)
            o.Oh0 r8 = o.Oh0.a
            return r8
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C1453i50.K0(o.i50, o.Lm):java.lang.Object");
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final java.lang.Object L0(o.C1453i50 r6, o.C0407Ps r7, o.AbstractC0298Lm r8) {
        /*
            boolean r0 = r8 instanceof o.C0951ct
            if (r0 == 0) goto L13
            r0 = r8
            o.ct r0 = (o.C0951ct) r0
            int r1 = r0.s
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r3 = r1 & r2
            if (r3 == 0) goto L13
            int r1 = r1 - r2
            r0.s = r1
            goto L18
        L13:
            o.ct r0 = new o.ct
            r0.<init>(r6, r8)
        L18:
            java.lang.Object r8 = r0.q
            int r1 = r0.s
            r2 = 2
            r3 = 1
            o.Dn r4 = o.EnumC0091Dn.l
            if (r1 == 0) goto L3c
            if (r1 == r3) goto L36
            if (r1 != r2) goto L2e
            o.gt r7 = r0.p
            o.Ps r0 = r0.f481o
            o.IJ.H(r8)
            goto L6f
        L2e:
            java.lang.IllegalStateException r6 = new java.lang.IllegalStateException
            java.lang.String r7 = "call to 'resume' before 'invoke' with coroutine"
            r6.<init>(r7)
            throw r6
        L36:
            o.Ps r7 = r0.f481o
            o.IJ.H(r8)
            goto L57
        L3c:
            o.IJ.H(r8)
            o.gt r8 = r6.G
            if (r8 == 0) goto L57
            o.KQ r1 = r6.E
            if (r1 == 0) goto L57
            o.ft r5 = new o.ft
            r5.<init>(r8)
            r0.f481o = r7
            r0.s = r3
            java.lang.Object r8 = r1.a(r5, r0)
            if (r8 != r4) goto L57
            goto L6c
        L57:
            o.gt r8 = new o.gt
            r8.<init>()
            o.KQ r1 = r6.E
            if (r1 == 0) goto L71
            r0.f481o = r7
            r0.p = r8
            r0.s = r2
            java.lang.Object r0 = r1.a(r8, r0)
            if (r0 != r4) goto L6d
        L6c:
            return r4
        L6d:
            r0 = r7
            r7 = r8
        L6f:
            r8 = r7
            r7 = r0
        L71:
            r6.G = r8
            long r6 = r7.a
            o.Oh0 r6 = o.Oh0.a
            return r6
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C1453i50.L0(o.i50, o.Ps, o.Lm):java.lang.Object");
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final java.lang.Object M0(o.C1453i50 r8, o.C0433Qs r9, o.AbstractC0298Lm r10) throws java.lang.Throwable {
        /*
            boolean r0 = r10 instanceof o.C1046dt
            if (r0 == 0) goto L13
            r0 = r10
            o.dt r0 = (o.C1046dt) r0
            int r1 = r0.r
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r3 = r1 & r2
            if (r3 == 0) goto L13
            int r1 = r1 - r2
            r0.r = r1
            goto L18
        L13:
            o.dt r0 = new o.dt
            r0.<init>(r8, r10)
        L18:
            java.lang.Object r10 = r0.p
            int r1 = r0.r
            r6 = 0
            r2 = 1
            if (r1 == 0) goto L30
            if (r1 != r2) goto L28
            o.Qs r9 = r0.f499o
            o.IJ.H(r10)
            goto L4d
        L28:
            java.lang.IllegalStateException r8 = new java.lang.IllegalStateException
            java.lang.String r9 = "call to 'resume' before 'invoke' with coroutine"
            r8.<init>(r9)
            throw r8
        L30:
            o.IJ.H(r10)
            o.gt r10 = r8.G
            if (r10 == 0) goto L4f
            o.KQ r1 = r8.E
            if (r1 == 0) goto L4d
            o.ht r3 = new o.ht
            r3.<init>(r10)
            r0.f499o = r9
            r0.r = r2
            java.lang.Object r10 = r1.a(r3, r0)
            o.Dn r0 = o.EnumC0091Dn.l
            if (r10 != r0) goto L4d
            return r0
        L4d:
            r8.G = r6
        L4f:
            long r4 = r9.a
            o.JR r9 = r8.L
            o.Cn r9 = r9.c()
            o.f50 r2 = new o.f50
            r7 = 0
            r3 = r8
            r2.<init>(r3, r4, r6, r7)
            r8 = 3
            o.AbstractC1692kh0.C(r9, r6, r2, r8)
            o.Oh0 r8 = o.Oh0.a
            return r8
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C1453i50.M0(o.i50, o.Qs, o.Lm):java.lang.Object");
    }

    @Override // o.LP
    public final void A0() {
        this.H = false;
        N0();
        this.I = 0L;
    }

    public final void N0() {
        C1334gt c1334gt = this.G;
        if (c1334gt != null) {
            KQ kq = this.E;
            if (kq != null) {
                kq.b(new C1238ft(c1334gt));
            }
            this.G = null;
        }
    }

    @Override // o.KJ
    public final boolean O(KeyEvent keyEvent) {
        long jFloatToRawIntBits;
        int iFloatToRawIntBits;
        if (!this.D) {
            return false;
        }
        if ((!FJ.a(IJ.r(keyEvent), FJ.n) && !FJ.a(AbstractC1155f00.c(keyEvent.getKeyCode()), FJ.m)) || IJ.v(keyEvent) != 2 || keyEvent.isCtrlPressed()) {
            return false;
        }
        OU ou = this.O.d;
        OU ou2 = OU.l;
        C1891mm c1891mm = this.Q;
        if (ou == ou2) {
            int i = (int) (c1891mm.G & 4294967295L);
            float f = FJ.a(AbstractC1155f00.c(keyEvent.getKeyCode()), FJ.m) ? i : -i;
            jFloatToRawIntBits = Float.floatToRawIntBits(0.0f);
            iFloatToRawIntBits = Float.floatToRawIntBits(f);
        } else {
            int i2 = (int) (c1891mm.G >> 32);
            jFloatToRawIntBits = Float.floatToRawIntBits(FJ.a(AbstractC1155f00.c(keyEvent.getKeyCode()), FJ.m) ? i2 : -i2);
            iFloatToRawIntBits = Float.floatToRawIntBits(0.0f);
        }
        AbstractC1692kh0.C(v0(), null, new C1165f50(this, (jFloatToRawIntBits << 32) | (iFloatToRawIntBits & 4294967295L), null, 1), 3);
        return true;
    }

    public final void O0(C1734l4 c1734l4, KQ kq, OU ou, InterfaceC1547j50 interfaceC1547j50, boolean z, boolean z2) {
        boolean z3;
        Wb0 wb0;
        boolean z4 = true;
        boolean z5 = false;
        if (this.D != z) {
            this.P.l = z;
            this.M.z = z;
            z3 = true;
        } else {
            z3 = false;
        }
        C2212q50 c2212q50 = this.O;
        if (!F3.c(c2212q50.a, interfaceC1547j50)) {
            c2212q50.a = interfaceC1547j50;
            z5 = true;
        }
        c2212q50.b = c1734l4;
        if (c2212q50.d != ou) {
            c2212q50.d = ou;
            z5 = true;
        }
        if (c2212q50.e != z2) {
            c2212q50.e = z2;
            z5 = true;
        }
        c2212q50.c = this.N;
        c2212q50.f = this.L;
        C1891mm c1891mm = this.Q;
        c1891mm.z = ou;
        c1891mm.B = z2;
        this.K = c1734l4;
        C2304r40 c2304r40 = androidx.compose.foundation.gestures.a.a;
        OU ou2 = c2212q50.d;
        OU ou3 = OU.l;
        if (ou2 != ou3) {
            ou3 = OU.m;
        }
        this.C = c2304r40;
        if (this.D != z) {
            this.D = z;
            if (!z) {
                N0();
                Wb0 wb02 = this.J;
                if (wb02 != null) {
                    I0(wb02);
                }
                this.J = null;
            }
            z5 = true;
        }
        if (!F3.c(this.E, kq)) {
            N0();
            this.E = kq;
        }
        if (this.B != ou3) {
            this.B = ou3;
        } else {
            z4 = z5;
        }
        if (z4 && (wb0 = this.J) != null) {
            wb0.J0();
        }
        if (z3) {
            this.R = null;
            this.S = null;
            C2887xC.t(this);
        }
    }

    /* JADX WARN: Type inference failed for: r0v0, types: [java.lang.Object, java.util.Collection, java.util.List] */
    /* JADX WARN: Type inference failed for: r3v2, types: [java.lang.Object, java.util.Collection, java.util.List] */
    @Override // o.LX
    public final void Z(CX cx, DX dx, long j) {
        InterfaceC0220Im interfaceC0220Im;
        long j2;
        ?? r0 = cx.a;
        int size = r0.size();
        int i = 0;
        while (true) {
            interfaceC0220Im = null;
            int i2 = 1;
            if (i >= size) {
                break;
            }
            if (((Boolean) this.C.g((IX) r0.get(i))).booleanValue()) {
                if (this.D && this.J == null) {
                    C1639k4 c1639k4 = new C1639k4(i2, this);
                    CX cx2 = Tb0.a;
                    Wb0 wb0 = new Wb0(null, null, c1639k4);
                    H0(wb0);
                    this.J = wb0;
                }
                Wb0 wb02 = this.J;
                if (wb02 != null) {
                    wb02.Z(cx, dx, j);
                }
            } else {
                i++;
            }
        }
        if (this.D) {
            if (dx == DX.l && cx.e == 6) {
                if (this.T == null) {
                    this.T = new C0173Gr(this.O, new OD(8, ViewConfiguration.get(AbstractC0662Zn.F(this).getContext())), new C0528Uj(2, this, C1453i50.class, "onWheelScrollStopped", "onWheelScrollStopped-TH1AsA0(J)V", 4, 1), AbstractC2539te.S(this).I);
                }
                C0173Gr c0173Gr = this.T;
                if (c0173Gr != null) {
                    InterfaceC0065Cn interfaceC0065CnV0 = v0();
                    if (((C2058oa0) c0173Gr.g) == null) {
                        c0173Gr.g = AbstractC1692kh0.C(interfaceC0065CnV0, null, new C2105p(c0173Gr, interfaceC0220Im, 29), 3);
                    }
                }
            }
            C0173Gr c0173Gr2 = this.T;
            if (c0173Gr2 == null || dx != DX.m) {
                return;
            }
            int i3 = cx.e;
            ?? r3 = cx.a;
            if (i3 == 6) {
                int size2 = r3.size();
                for (int i4 = 0; i4 < size2; i4++) {
                    if (((IX) r3.get(i4)).b()) {
                        return;
                    }
                }
                OD od = (OD) c0173Gr2.c;
                InterfaceC2281qr interfaceC2281qr = (InterfaceC2281qr) c0173Gr2.e;
                ViewConfiguration viewConfiguration = (ViewConfiguration) od.m;
                int i5 = Build.VERSION.SDK_INT;
                float f = -(i5 > 26 ? AbstractC1456i7.h(viewConfiguration) : interfaceC2281qr.B(64));
                float f2 = -(i5 > 26 ? AbstractC1456i7.e(viewConfiguration) : interfaceC2281qr.B(64));
                C1765lT c1765lT = new C1765lT(0L);
                int size3 = r3.size();
                int i6 = 0;
                while (true) {
                    j2 = c1765lT.a;
                    if (i6 >= size3) {
                        break;
                    }
                    c1765lT = new C1765lT(C1765lT.e(j2, ((IX) r3.get(i6)).j));
                    i6++;
                }
                long jFloatToRawIntBits = (Float.floatToRawIntBits(Float.intBitsToFloat((int) (j2 >> 32)) * f2) << 32) | (Float.floatToRawIntBits(Float.intBitsToFloat((int) (j2 & 4294967295L)) * f) & 4294967295L);
                C2212q50 c2212q50 = (C2212q50) c0173Gr2.b;
                float fG = c2212q50.g(c2212q50.e(jFloatToRawIntBits));
                if ((fG > 0.0f ? 1 : (fG == 0.0f ? 0 : -1)) == 0 ? false : (fG > 0.0f ? 1 : (fG == 0.0f ? 0 : -1)) > 0 ? c2212q50.a.c() : c2212q50.a.a() ? !(((C1210ff) c0173Gr2.f).p(new C1382hQ(jFloatToRawIntBits, ((IX) AbstractC3117zi.e0(r3)).b, false)) instanceof C1691kh) : c0173Gr2.a) {
                    int size4 = r3.size();
                    for (int i7 = 0; i7 < size4; i7++) {
                        ((IX) r3.get(i7)).a();
                    }
                }
            }
        }
    }

    @Override // o.LX
    public final void a0() {
        Wb0 wb0 = this.J;
        if (wb0 != null) {
            wb0.a0();
        }
    }

    @Override // o.InterfaceC0535Uq, o.LX
    public final void c() {
        a0();
        if (this.y) {
            InterfaceC2281qr interfaceC2281qr = AbstractC2539te.S(this).I;
            C3031ym0 c3031ym0 = this.N;
            c3031ym0.getClass();
            c3031ym0.m = new C0247Jn(5, new WT(interfaceC2281qr));
        }
        C0173Gr c0173Gr = this.T;
        if (c0173Gr != null) {
            c0173Gr.e = AbstractC2539te.S(this).I;
        }
    }

    @Override // o.P50
    public final void d0(N50 n50) {
        if (this.D && (this.R == null || this.S == null)) {
            this.R = new C1825m2(11, this);
            this.S = new C1165f50(this, null);
        }
        C1825m2 c1825m2 = this.R;
        if (c1825m2 != null) {
            DJ[] djArr = Y50.a;
            n50.d(M50.d, new C1726l0(null, c1825m2));
        }
        C1165f50 c1165f50 = this.S;
        if (c1165f50 != null) {
            DJ[] djArr2 = Y50.a;
            n50.d(M50.e, c1165f50);
        }
    }

    @Override // o.KJ
    public final boolean m(KeyEvent keyEvent) {
        return false;
    }

    @Override // o.LP
    public final boolean w0() {
        return false;
    }

    @Override // o.LP
    public final void z0() {
        if (this.y) {
            InterfaceC2281qr interfaceC2281qr = AbstractC2539te.S(this).I;
            C3031ym0 c3031ym0 = this.N;
            c3031ym0.getClass();
            c3031ym0.m = new C0247Jn(5, new WT(interfaceC2281qr));
        }
        C0173Gr c0173Gr = this.T;
        if (c0173Gr != null) {
            c0173Gr.e = AbstractC2539te.S(this).I;
        }
    }
}
