package j2;

import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import j1.k;
import java.util.LinkedHashMap;
import java.util.Map;
import l1.i;

/* loaded from: classes.dex */
public abstract class z0 extends p0 implements h2.d0, h2.s, k1 {

    /* renamed from: a0 */
    public static final e f23839a0 = new e(null);

    /* renamed from: b0 */
    private static final dn.l f23840b0 = d.f23848p;

    /* renamed from: c0 */
    private static final dn.l f23841c0 = c.f23847p;

    /* renamed from: d0 */
    private static final androidx.compose.ui.graphics.d f23842d0 = new androidx.compose.ui.graphics.d();

    /* renamed from: e0 */
    private static final z f23843e0 = new z();

    /* renamed from: f0 */
    private static final float[] f23844f0 = s1.z0.c(null, 1, null);

    /* renamed from: g0 */
    private static final f f23845g0 = new a();

    /* renamed from: h0 */
    private static final f f23846h0 = new b();
    private final g0 E;
    private boolean F;
    private boolean G;
    private z0 H;
    private z0 I;
    private boolean J;
    private boolean K;
    private dn.l L;
    private h2.f0 P;
    private Map Q;
    private float S;
    private r1.e T;
    private z U;
    private boolean X;
    private i1 Y;
    private v1.c Z;
    private c3.d M = w1().K();
    private c3.t N = w1().getLayoutDirection();
    private float O = 0.8f;
    private long R = c3.n.f7423b.a();
    private final dn.p V = new g();
    private final dn.a W = new j();

    /* loaded from: classes.dex */
    public static final class a implements f {
        a() {
        }

        @Override // j2.z0.f
        public int a() {
            return b1.a(16);
        }

        @Override // j2.z0.f
        public boolean b(g0 g0Var) {
            return true;
        }

        /* JADX WARN: Multi-variable type inference failed */
        /* JADX WARN: Type inference failed for: r2v0 */
        /* JADX WARN: Type inference failed for: r2v1 */
        /* JADX WARN: Type inference failed for: r2v10 */
        /* JADX WARN: Type inference failed for: r2v11 */
        /* JADX WARN: Type inference failed for: r2v2 */
        /* JADX WARN: Type inference failed for: r2v3, types: [a1.b] */
        /* JADX WARN: Type inference failed for: r2v4 */
        /* JADX WARN: Type inference failed for: r2v5 */
        /* JADX WARN: Type inference failed for: r2v6, types: [a1.b] */
        /* JADX WARN: Type inference failed for: r2v8 */
        /* JADX WARN: Type inference failed for: r2v9 */
        /* JADX WARN: Type inference failed for: r9v0, types: [l1.i$c] */
        /* JADX WARN: Type inference failed for: r9v1, types: [l1.i$c] */
        /* JADX WARN: Type inference failed for: r9v10 */
        /* JADX WARN: Type inference failed for: r9v11 */
        /* JADX WARN: Type inference failed for: r9v12 */
        /* JADX WARN: Type inference failed for: r9v4 */
        /* JADX WARN: Type inference failed for: r9v5, types: [l1.i$c] */
        /* JADX WARN: Type inference failed for: r9v6, types: [java.lang.Object] */
        /* JADX WARN: Type inference failed for: r9v7 */
        /* JADX WARN: Type inference failed for: r9v8 */
        /* JADX WARN: Type inference failed for: r9v9 */
        @Override // j2.z0.f
        public boolean c(i.c cVar) {
            int a10 = b1.a(16);
            ?? r22 = 0;
            while (cVar != 0) {
                if (!(cVar instanceof p1)) {
                    if (((cVar.J1() & a10) != 0) && (cVar instanceof m)) {
                        i.c i22 = cVar.i2();
                        int i10 = 0;
                        r22 = r22;
                        cVar = cVar;
                        while (i22 != null) {
                            if ((i22.J1() & a10) != 0) {
                                i10++;
                                r22 = r22;
                                if (i10 == 1) {
                                    cVar = i22;
                                } else {
                                    if (r22 == 0) {
                                        r22 = new a1.b(new i.c[16], 0);
                                    }
                                    if (cVar != 0) {
                                        r22.c(cVar);
                                        cVar = 0;
                                    }
                                    r22.c(i22);
                                }
                            }
                            i22 = i22.F1();
                            r22 = r22;
                            cVar = cVar;
                        }
                        if (i10 == 1) {
                        }
                    }
                } else if (((p1) cVar).v0()) {
                    return true;
                }
                cVar = j2.k.g(r22);
            }
            return false;
        }

        @Override // j2.z0.f
        public void d(g0 g0Var, long j10, u uVar, boolean z10, boolean z11) {
            g0Var.x0(j10, uVar, z10, z11);
        }
    }

    /* loaded from: classes.dex */
    public static final class b implements f {
        b() {
        }

        @Override // j2.z0.f
        public int a() {
            return b1.a(8);
        }

        @Override // j2.z0.f
        public boolean b(g0 g0Var) {
            o2.i I = g0Var.I();
            boolean z10 = false;
            if (I != null && I.C()) {
                z10 = true;
            }
            return !z10;
        }

        @Override // j2.z0.f
        public boolean c(i.c cVar) {
            return false;
        }

        @Override // j2.z0.f
        public void d(g0 g0Var, long j10, u uVar, boolean z10, boolean z11) {
            g0Var.z0(j10, uVar, z10, z11);
        }
    }

    /* loaded from: classes.dex */
    static final class c extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: p */
        public static final c f23847p = new c();

        c() {
            super(1);
        }

        public final void a(z0 z0Var) {
            i1 u22 = z0Var.u2();
            if (u22 != null) {
                u22.invalidate();
            }
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((z0) obj);
            return rm.n0.f34904a;
        }
    }

    /* loaded from: classes.dex */
    static final class d extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: p */
        public static final d f23848p = new d();

        d() {
            super(1);
        }

        public final void a(z0 z0Var) {
            if (z0Var.W()) {
                z zVar = z0Var.U;
                if (zVar == null) {
                    z0.r3(z0Var, false, 1, null);
                    return;
                }
                z0.f23843e0.b(zVar);
                z0.r3(z0Var, false, 1, null);
                if (z0.f23843e0.c(zVar)) {
                    return;
                }
                g0 w12 = z0Var.w1();
                l0 U = w12.U();
                if (U.s() > 0) {
                    if (U.u() || U.v()) {
                        g0.u1(w12, false, 1, null);
                    }
                    U.I().N1();
                }
                j1 n02 = w12.n0();
                if (n02 != null) {
                    n02.v(w12);
                }
            }
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((z0) obj);
            return rm.n0.f34904a;
        }
    }

    /* loaded from: classes.dex */
    public static final class e {
        private e() {
        }

        public /* synthetic */ e(kotlin.jvm.internal.k kVar) {
            this();
        }

        public final f a() {
            return z0.f23845g0;
        }

        public final f b() {
            return z0.f23846h0;
        }
    }

    /* loaded from: classes.dex */
    public interface f {
        int a();

        boolean b(g0 g0Var);

        boolean c(i.c cVar);

        void d(g0 g0Var, long j10, u uVar, boolean z10, boolean z11);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class g extends kotlin.jvm.internal.v implements dn.p {

        /* loaded from: classes.dex */
        public static final class a extends kotlin.jvm.internal.v implements dn.a {

            /* renamed from: p */
            final /* synthetic */ z0 f23850p;

            /* renamed from: q */
            final /* synthetic */ s1.a0 f23851q;

            /* renamed from: r */
            final /* synthetic */ v1.c f23852r;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            a(z0 z0Var, s1.a0 a0Var, v1.c cVar) {
                super(0);
                this.f23850p = z0Var;
                this.f23851q = a0Var;
                this.f23852r = cVar;
            }

            @Override // dn.a
            public /* bridge */ /* synthetic */ Object invoke() {
                m282invoke();
                return rm.n0.f34904a;
            }

            /* renamed from: invoke */
            public final void m282invoke() {
                this.f23850p.k2(this.f23851q, this.f23852r);
            }
        }

        g() {
            super(2);
        }

        public final void a(s1.a0 a0Var, v1.c cVar) {
            if (!z0.this.w1().q()) {
                z0.this.X = true;
            } else {
                z0.this.y2().i(z0.this, z0.f23841c0, new a(z0.this, a0Var, cVar));
                z0.this.X = false;
            }
        }

        @Override // dn.p
        public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
            a((s1.a0) obj, (v1.c) obj2);
            return rm.n0.f34904a;
        }
    }

    /* loaded from: classes.dex */
    public static final class h extends kotlin.jvm.internal.v implements dn.a {

        /* renamed from: q */
        final /* synthetic */ i.c f23854q;

        /* renamed from: r */
        final /* synthetic */ f f23855r;

        /* renamed from: s */
        final /* synthetic */ long f23856s;

        /* renamed from: t */
        final /* synthetic */ u f23857t;

        /* renamed from: u */
        final /* synthetic */ boolean f23858u;

        /* renamed from: v */
        final /* synthetic */ boolean f23859v;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        h(i.c cVar, f fVar, long j10, u uVar, boolean z10, boolean z11) {
            super(0);
            this.f23854q = cVar;
            this.f23855r = fVar;
            this.f23856s = j10;
            this.f23857t = uVar;
            this.f23858u = z10;
            this.f23859v = z11;
        }

        @Override // dn.a
        public /* bridge */ /* synthetic */ Object invoke() {
            m283invoke();
            return rm.n0.f34904a;
        }

        /* renamed from: invoke */
        public final void m283invoke() {
            i.c b10;
            z0 z0Var = z0.this;
            b10 = a1.b(this.f23854q, this.f23855r.a(), b1.a(2));
            z0Var.G2(b10, this.f23855r, this.f23856s, this.f23857t, this.f23858u, this.f23859v);
        }
    }

    /* loaded from: classes.dex */
    public static final class i extends kotlin.jvm.internal.v implements dn.a {

        /* renamed from: q */
        final /* synthetic */ i.c f23861q;

        /* renamed from: r */
        final /* synthetic */ f f23862r;

        /* renamed from: s */
        final /* synthetic */ long f23863s;

        /* renamed from: t */
        final /* synthetic */ u f23864t;

        /* renamed from: u */
        final /* synthetic */ boolean f23865u;

        /* renamed from: v */
        final /* synthetic */ boolean f23866v;

        /* renamed from: w */
        final /* synthetic */ float f23867w;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        i(i.c cVar, f fVar, long j10, u uVar, boolean z10, boolean z11, float f10) {
            super(0);
            this.f23861q = cVar;
            this.f23862r = fVar;
            this.f23863s = j10;
            this.f23864t = uVar;
            this.f23865u = z10;
            this.f23866v = z11;
            this.f23867w = f10;
        }

        @Override // dn.a
        public /* bridge */ /* synthetic */ Object invoke() {
            m284invoke();
            return rm.n0.f34904a;
        }

        /* renamed from: invoke */
        public final void m284invoke() {
            i.c b10;
            z0 z0Var = z0.this;
            b10 = a1.b(this.f23861q, this.f23862r.a(), b1.a(2));
            z0Var.H2(b10, this.f23862r, this.f23863s, this.f23864t, this.f23865u, this.f23866v, this.f23867w);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class j extends kotlin.jvm.internal.v implements dn.a {
        j() {
            super(0);
        }

        @Override // dn.a
        public /* bridge */ /* synthetic */ Object invoke() {
            m285invoke();
            return rm.n0.f34904a;
        }

        /* renamed from: invoke */
        public final void m285invoke() {
            z0 B2 = z0.this.B2();
            if (B2 != null) {
                B2.K2();
            }
        }
    }

    /* loaded from: classes.dex */
    public static final class k extends kotlin.jvm.internal.v implements dn.a {

        /* renamed from: q */
        final /* synthetic */ i.c f23870q;

        /* renamed from: r */
        final /* synthetic */ f f23871r;

        /* renamed from: s */
        final /* synthetic */ long f23872s;

        /* renamed from: t */
        final /* synthetic */ u f23873t;

        /* renamed from: u */
        final /* synthetic */ boolean f23874u;

        /* renamed from: v */
        final /* synthetic */ boolean f23875v;

        /* renamed from: w */
        final /* synthetic */ float f23876w;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        k(i.c cVar, f fVar, long j10, u uVar, boolean z10, boolean z11, float f10) {
            super(0);
            this.f23870q = cVar;
            this.f23871r = fVar;
            this.f23872s = j10;
            this.f23873t = uVar;
            this.f23874u = z10;
            this.f23875v = z11;
            this.f23876w = f10;
        }

        @Override // dn.a
        public /* bridge */ /* synthetic */ Object invoke() {
            m286invoke();
            return rm.n0.f34904a;
        }

        /* renamed from: invoke */
        public final void m286invoke() {
            i.c b10;
            z0 z0Var = z0.this;
            b10 = a1.b(this.f23870q, this.f23871r.a(), b1.a(2));
            z0Var.h3(b10, this.f23871r, this.f23872s, this.f23873t, this.f23874u, this.f23875v, this.f23876w);
        }
    }

    /* loaded from: classes.dex */
    public static final class l extends kotlin.jvm.internal.v implements dn.a {

        /* renamed from: p */
        final /* synthetic */ dn.l f23877p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        l(dn.l lVar) {
            super(0);
            this.f23877p = lVar;
        }

        @Override // dn.a
        public /* bridge */ /* synthetic */ Object invoke() {
            m287invoke();
            return rm.n0.f34904a;
        }

        /* renamed from: invoke */
        public final void m287invoke() {
            this.f23877p.invoke(z0.f23842d0);
            z0.f23842d0.X();
        }
    }

    public z0(g0 g0Var) {
        this.E = g0Var;
    }

    private final boolean D2(int i10) {
        i.c F2 = F2(c1.i(i10));
        return F2 != null && j2.k.e(F2, i10);
    }

    public final i.c F2(boolean z10) {
        i.c z22;
        if (w1().m0() == this) {
            return w1().k0().k();
        }
        if (z10) {
            z0 z0Var = this.I;
            if (z0Var != null && (z22 = z0Var.z2()) != null) {
                return z22.F1();
            }
        } else {
            z0 z0Var2 = this.I;
            if (z0Var2 != null) {
                return z0Var2.z2();
            }
        }
        return null;
    }

    public final void G2(i.c cVar, f fVar, long j10, u uVar, boolean z10, boolean z11) {
        if (cVar == null) {
            J2(fVar, j10, uVar, z10, z11);
        } else {
            uVar.F(cVar, z11, new h(cVar, fVar, j10, uVar, z10, z11));
        }
    }

    public final void H2(i.c cVar, f fVar, long j10, u uVar, boolean z10, boolean z11, float f10) {
        if (cVar == null) {
            J2(fVar, j10, uVar, z10, z11);
        } else {
            uVar.G(cVar, f10, z11, new i(cVar, fVar, j10, uVar, z10, z11, f10));
        }
    }

    private final long N2(long j10) {
        float m10 = r1.g.m(j10);
        float max = Math.max(BitmapDescriptorFactory.HUE_RED, m10 < BitmapDescriptorFactory.HUE_RED ? -m10 : m10 - N0());
        float n10 = r1.g.n(j10);
        return r1.h.a(max, Math.max(BitmapDescriptorFactory.HUE_RED, n10 < BitmapDescriptorFactory.HUE_RED ? -n10 : n10 - I0()));
    }

    private final void W2(long j10, float f10, dn.l lVar, v1.c cVar) {
        if (cVar != null) {
            if (!(lVar == null)) {
                g2.a.a("both ways to create layers shouldn't be used together");
            }
            if (this.Z != cVar) {
                this.Z = null;
                p3(this, null, false, 2, null);
                this.Z = cVar;
            }
            if (this.Y == null) {
                i1 n10 = k0.b(w1()).n(this.V, this.W, cVar);
                n10.i(M0());
                n10.l(j10);
                this.Y = n10;
                w1().B1(true);
                this.W.invoke();
            }
        } else {
            if (this.Z != null) {
                this.Z = null;
                p3(this, null, false, 2, null);
            }
            p3(this, lVar, false, 2, null);
        }
        if (!c3.n.g(F1(), j10)) {
            d3(j10);
            w1().U().I().N1();
            i1 i1Var = this.Y;
            if (i1Var != null) {
                i1Var.l(j10);
            } else {
                z0 z0Var = this.I;
                if (z0Var != null) {
                    z0Var.K2();
                }
            }
            H1(this);
            j1 n02 = w1().n0();
            if (n02 != null) {
                n02.p(w1());
            }
        }
        this.S = f10;
        if (K1()) {
            return;
        }
        p1(A1());
    }

    public static /* synthetic */ void Z2(z0 z0Var, r1.e eVar, boolean z10, boolean z11, int i10, Object obj) {
        if (obj != null) {
            throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: rectInParent");
        }
        if ((i10 & 4) != 0) {
            z11 = false;
        }
        z0Var.Y2(eVar, z10, z11);
    }

    private final void e2(z0 z0Var, r1.e eVar, boolean z10) {
        if (z0Var == this) {
            return;
        }
        z0 z0Var2 = this.I;
        if (z0Var2 != null) {
            z0Var2.e2(z0Var, eVar, z10);
        }
        p2(eVar, z10);
    }

    private final long f2(z0 z0Var, long j10, boolean z10) {
        if (z0Var == this) {
            return j10;
        }
        z0 z0Var2 = this.I;
        return (z0Var2 == null || kotlin.jvm.internal.t.b(z0Var, z0Var2)) ? n2(j10, z10) : n2(z0Var2.f2(z0Var, j10, z10), z10);
    }

    public final void h3(i.c cVar, f fVar, long j10, u uVar, boolean z10, boolean z11, float f10) {
        i.c b10;
        if (cVar == null) {
            J2(fVar, j10, uVar, z10, z11);
        } else if (fVar.c(cVar)) {
            uVar.M(cVar, f10, z11, new k(cVar, fVar, j10, uVar, z10, z11, f10));
        } else {
            b10 = a1.b(cVar, fVar.a(), b1.a(2));
            h3(b10, fVar, j10, uVar, z10, z11, f10);
        }
    }

    private final z0 i3(h2.s sVar) {
        z0 a10;
        h2.b0 b0Var = sVar instanceof h2.b0 ? (h2.b0) sVar : null;
        if (b0Var != null && (a10 = b0Var.a()) != null) {
            return a10;
        }
        kotlin.jvm.internal.t.e(sVar, "null cannot be cast to non-null type androidx.compose.ui.node.NodeCoordinator");
        return (z0) sVar;
    }

    public final void k2(s1.a0 a0Var, v1.c cVar) {
        i.c E2 = E2(b1.a(4));
        if (E2 == null) {
            V2(a0Var, cVar);
        } else {
            w1().c0().h(a0Var, c3.s.d(g()), this, E2, cVar);
        }
    }

    public static /* synthetic */ long k3(z0 z0Var, long j10, boolean z10, int i10, Object obj) {
        if (obj != null) {
            throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: toParentPosition-8S9VItk");
        }
        if ((i10 & 2) != 0) {
            z10 = true;
        }
        return z0Var.j3(j10, z10);
    }

    private final void m3(z0 z0Var, float[] fArr) {
        if (kotlin.jvm.internal.t.b(z0Var, this)) {
            return;
        }
        z0 z0Var2 = this.I;
        kotlin.jvm.internal.t.d(z0Var2);
        z0Var2.m3(z0Var, fArr);
        if (!c3.n.g(F1(), c3.n.f7423b.a())) {
            float[] fArr2 = f23844f0;
            s1.z0.h(fArr2);
            s1.z0.q(fArr2, -c3.n.h(F1()), -c3.n.i(F1()), BitmapDescriptorFactory.HUE_RED, 4, null);
            s1.z0.n(fArr, fArr2);
        }
        i1 i1Var = this.Y;
        if (i1Var != null) {
            i1Var.j(fArr);
        }
    }

    private final void n3(z0 z0Var, float[] fArr) {
        while (!kotlin.jvm.internal.t.b(this, z0Var)) {
            i1 i1Var = this.Y;
            if (i1Var != null) {
                i1Var.b(fArr);
            }
            if (!c3.n.g(this.F1(), c3.n.f7423b.a())) {
                float[] fArr2 = f23844f0;
                s1.z0.h(fArr2);
                s1.z0.q(fArr2, c3.n.h(r0), c3.n.i(r0), BitmapDescriptorFactory.HUE_RED, 4, null);
                s1.z0.n(fArr, fArr2);
            }
            this = this.I;
            kotlin.jvm.internal.t.d(this);
        }
    }

    public static /* synthetic */ long o2(z0 z0Var, long j10, boolean z10, int i10, Object obj) {
        if (obj != null) {
            throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: fromParentPosition-8S9VItk");
        }
        if ((i10 & 2) != 0) {
            z10 = true;
        }
        return z0Var.n2(j10, z10);
    }

    private final void p2(r1.e eVar, boolean z10) {
        float h10 = c3.n.h(F1());
        eVar.i(eVar.b() - h10);
        eVar.j(eVar.c() - h10);
        float i10 = c3.n.i(F1());
        eVar.k(eVar.d() - i10);
        eVar.h(eVar.a() - i10);
        i1 i1Var = this.Y;
        if (i1Var != null) {
            i1Var.k(eVar, true);
            if (this.K && z10) {
                eVar.e(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, c3.r.g(g()), c3.r.f(g()));
                eVar.f();
            }
        }
    }

    public static /* synthetic */ void p3(z0 z0Var, dn.l lVar, boolean z10, int i10, Object obj) {
        if (obj != null) {
            throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: updateLayerBlock");
        }
        if ((i10 & 2) != 0) {
            z10 = false;
        }
        z0Var.o3(lVar, z10);
    }

    private final void q3(boolean z10) {
        j1 n02;
        if (this.Z != null) {
            return;
        }
        i1 i1Var = this.Y;
        if (i1Var == null) {
            if (this.L == null) {
                return;
            }
            g2.a.b("null layer with a non-null layerBlock");
            return;
        }
        dn.l lVar = this.L;
        if (lVar == null) {
            g2.a.c("updateLayerParameters requires a non-null layerBlock");
            throw new rm.k();
        }
        androidx.compose.ui.graphics.d dVar = f23842d0;
        dVar.N();
        dVar.R(w1().K());
        dVar.T(w1().getLayoutDirection());
        dVar.W(c3.s.d(g()));
        y2().i(this, f23840b0, new l(lVar));
        z zVar = this.U;
        if (zVar == null) {
            zVar = new z();
            this.U = zVar;
        }
        zVar.a(dVar);
        i1Var.g(dVar);
        this.K = dVar.q();
        this.O = dVar.h();
        if (!z10 || (n02 = w1().n0()) == null) {
            return;
        }
        n02.p(w1());
    }

    static /* synthetic */ void r3(z0 z0Var, boolean z10, int i10, Object obj) {
        if (obj != null) {
            throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: updateLayerParameters");
        }
        if ((i10 & 1) != 0) {
            z10 = true;
        }
        z0Var.q3(z10);
    }

    public final l1 y2() {
        return k0.b(w1()).getSnapshotObserver();
    }

    @Override // j2.p0
    public h2.f0 A1() {
        h2.f0 f0Var = this.P;
        if (f0Var != null) {
            return f0Var;
        }
        throw new IllegalStateException("Asking for measurement result of unmeasured layout modifier".toString());
    }

    public final z0 A2() {
        return this.H;
    }

    @Override // h2.s
    public long B(h2.s sVar, long j10) {
        return L(sVar, j10, true);
    }

    public final z0 B2() {
        return this.I;
    }

    public final float C2() {
        return this.S;
    }

    @Override // j2.p0
    public p0 D1() {
        return this.I;
    }

    public final i.c E2(int i10) {
        boolean i11 = c1.i(i10);
        i.c z22 = z2();
        if (!i11 && (z22 = z22.L1()) == null) {
            return null;
        }
        for (i.c F2 = F2(i11); F2 != null && (F2.E1() & i10) != 0; F2 = F2.F1()) {
            if ((F2.J1() & i10) != 0) {
                return F2;
            }
            if (F2 == z22) {
                return null;
            }
        }
        return null;
    }

    @Override // j2.p0
    public long F1() {
        return this.R;
    }

    @Override // c3.l
    public float G0() {
        return w1().K().G0();
    }

    public final void I2(f fVar, long j10, u uVar, boolean z10, boolean z11) {
        i.c E2 = E2(fVar.a());
        if (!s3(j10)) {
            if (z10) {
                float h22 = h2(j10, w2());
                if (((Float.isInfinite(h22) || Float.isNaN(h22)) ? false : true) && uVar.I(h22, false)) {
                    H2(E2, fVar, j10, uVar, z10, false, h22);
                    return;
                }
                return;
            }
            return;
        }
        if (E2 == null) {
            J2(fVar, j10, uVar, z10, z11);
            return;
        }
        if (L2(j10)) {
            G2(E2, fVar, j10, uVar, z10, z11);
            return;
        }
        float h23 = !z10 ? Float.POSITIVE_INFINITY : h2(j10, w2());
        if (((Float.isInfinite(h23) || Float.isNaN(h23)) ? false : true) && uVar.I(h23, z11)) {
            H2(E2, fVar, j10, uVar, z10, z11, h23);
        } else {
            h3(E2, fVar, j10, uVar, z10, z11, h23);
        }
    }

    public void J2(f fVar, long j10, u uVar, boolean z10, boolean z11) {
        z0 z0Var = this.H;
        if (z0Var != null) {
            z0Var.I2(fVar, o2(z0Var, j10, false, 2, null), uVar, z10, z11);
        }
    }

    public void K2() {
        i1 i1Var = this.Y;
        if (i1Var != null) {
            i1Var.invalidate();
            return;
        }
        z0 z0Var = this.I;
        if (z0Var != null) {
            z0Var.K2();
        }
    }

    @Override // h2.s
    public long L(h2.s sVar, long j10, boolean z10) {
        if (sVar instanceof h2.b0) {
            ((h2.b0) sVar).a().O2();
            return r1.g.u(sVar.L(this, r1.g.u(j10), z10));
        }
        z0 i32 = i3(sVar);
        i32.O2();
        z0 m22 = m2(i32);
        while (i32 != m22) {
            j10 = i32.j3(j10, z10);
            i32 = i32.I;
            kotlin.jvm.internal.t.d(i32);
        }
        return f2(m22, j10, z10);
    }

    protected final boolean L2(long j10) {
        float m10 = r1.g.m(j10);
        float n10 = r1.g.n(j10);
        return m10 >= BitmapDescriptorFactory.HUE_RED && n10 >= BitmapDescriptorFactory.HUE_RED && m10 < ((float) N0()) && n10 < ((float) I0());
    }

    public final boolean M2() {
        if (this.Y != null && this.O <= BitmapDescriptorFactory.HUE_RED) {
            return true;
        }
        z0 z0Var = this.I;
        if (z0Var != null) {
            return z0Var.M2();
        }
        return false;
    }

    @Override // h2.s
    public boolean N() {
        return z2().O1();
    }

    @Override // j2.p0
    public void N1() {
        v1.c cVar = this.Z;
        if (cVar != null) {
            X0(F1(), this.S, cVar);
        } else {
            V0(F1(), this.S, this.L);
        }
    }

    public final void O2() {
        w1().U().S();
    }

    public void P2() {
        i1 i1Var = this.Y;
        if (i1Var != null) {
            i1Var.invalidate();
        }
    }

    public final void Q2() {
        o3(this.L, true);
        i1 i1Var = this.Y;
        if (i1Var != null) {
            i1Var.invalidate();
        }
    }

    @Override // h2.s
    public void R(float[] fArr) {
        j1 b10 = k0.b(w1());
        n3(i3(h2.t.d(this)), fArr);
        b10.s(fArr);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r3v0 */
    /* JADX WARN: Type inference failed for: r3v1, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r3v10 */
    /* JADX WARN: Type inference failed for: r3v11 */
    /* JADX WARN: Type inference failed for: r3v3 */
    /* JADX WARN: Type inference failed for: r3v4, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r3v5, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r3v6 */
    /* JADX WARN: Type inference failed for: r3v7 */
    /* JADX WARN: Type inference failed for: r3v8 */
    /* JADX WARN: Type inference failed for: r3v9 */
    /* JADX WARN: Type inference failed for: r4v0 */
    /* JADX WARN: Type inference failed for: r4v1 */
    /* JADX WARN: Type inference failed for: r4v10 */
    /* JADX WARN: Type inference failed for: r4v11 */
    /* JADX WARN: Type inference failed for: r4v2 */
    /* JADX WARN: Type inference failed for: r4v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r4v4 */
    /* JADX WARN: Type inference failed for: r4v5 */
    /* JADX WARN: Type inference failed for: r4v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r4v8 */
    /* JADX WARN: Type inference failed for: r4v9 */
    protected void R2(int i10, int i11) {
        z0 z0Var;
        i1 i1Var = this.Y;
        if (i1Var != null) {
            i1Var.i(c3.s.a(i10, i11));
        } else if (w1().q() && (z0Var = this.I) != null) {
            z0Var.K2();
        }
        c1(c3.s.a(i10, i11));
        if (this.L != null) {
            q3(false);
        }
        int a10 = b1.a(4);
        boolean i12 = c1.i(a10);
        i.c z22 = z2();
        if (i12 || (z22 = z22.L1()) != null) {
            for (i.c F2 = F2(i12); F2 != null && (F2.E1() & a10) != 0; F2 = F2.F1()) {
                if ((F2.J1() & a10) != 0) {
                    m mVar = F2;
                    ?? r42 = 0;
                    while (mVar != 0) {
                        if (mVar instanceof r) {
                            ((r) mVar).u0();
                        } else if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                            i.c i22 = mVar.i2();
                            int i13 = 0;
                            mVar = mVar;
                            r42 = r42;
                            while (i22 != null) {
                                if ((i22.J1() & a10) != 0) {
                                    i13++;
                                    r42 = r42;
                                    if (i13 == 1) {
                                        mVar = i22;
                                    } else {
                                        if (r42 == 0) {
                                            r42 = new a1.b(new i.c[16], 0);
                                        }
                                        if (mVar != 0) {
                                            r42.c(mVar);
                                            mVar = 0;
                                        }
                                        r42.c(i22);
                                    }
                                }
                                i22 = i22.F1();
                                mVar = mVar;
                                r42 = r42;
                            }
                            if (i13 == 1) {
                            }
                        }
                        mVar = j2.k.g(r42);
                    }
                }
                if (F2 == z22) {
                    break;
                }
            }
        }
        j1 n02 = w1().n0();
        if (n02 != null) {
            n02.p(w1());
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r8v10 */
    /* JADX WARN: Type inference failed for: r8v11 */
    /* JADX WARN: Type inference failed for: r8v12 */
    /* JADX WARN: Type inference failed for: r8v13 */
    /* JADX WARN: Type inference failed for: r8v14 */
    /* JADX WARN: Type inference failed for: r8v15 */
    /* JADX WARN: Type inference failed for: r8v4 */
    /* JADX WARN: Type inference failed for: r8v5, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r8v7, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r8v8 */
    /* JADX WARN: Type inference failed for: r8v9, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r9v0 */
    /* JADX WARN: Type inference failed for: r9v1 */
    /* JADX WARN: Type inference failed for: r9v10 */
    /* JADX WARN: Type inference failed for: r9v11 */
    /* JADX WARN: Type inference failed for: r9v2, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r9v3 */
    /* JADX WARN: Type inference failed for: r9v4 */
    /* JADX WARN: Type inference failed for: r9v5 */
    /* JADX WARN: Type inference failed for: r9v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r9v8 */
    /* JADX WARN: Type inference failed for: r9v9 */
    public final void S2() {
        i.c L1;
        if (D2(b1.a(128))) {
            k.a aVar = j1.k.f23492e;
            j1.k d10 = aVar.d();
            dn.l h10 = d10 != null ? d10.h() : null;
            j1.k f10 = aVar.f(d10);
            try {
                int a10 = b1.a(128);
                boolean i10 = c1.i(a10);
                if (i10) {
                    L1 = z2();
                } else {
                    L1 = z2().L1();
                    if (L1 == null) {
                        rm.n0 n0Var = rm.n0.f34904a;
                    }
                }
                for (i.c F2 = F2(i10); F2 != null && (F2.E1() & a10) != 0; F2 = F2.F1()) {
                    if ((F2.J1() & a10) != 0) {
                        ?? r92 = 0;
                        m mVar = F2;
                        while (mVar != 0) {
                            if (mVar instanceof a0) {
                                ((a0) mVar).R(M0());
                            } else if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                                i.c i22 = mVar.i2();
                                int i11 = 0;
                                mVar = mVar;
                                r92 = r92;
                                while (i22 != null) {
                                    if ((i22.J1() & a10) != 0) {
                                        i11++;
                                        r92 = r92;
                                        if (i11 == 1) {
                                            mVar = i22;
                                        } else {
                                            if (r92 == 0) {
                                                r92 = new a1.b(new i.c[16], 0);
                                            }
                                            if (mVar != 0) {
                                                r92.c(mVar);
                                                mVar = 0;
                                            }
                                            r92.c(i22);
                                        }
                                    }
                                    i22 = i22.F1();
                                    mVar = mVar;
                                    r92 = r92;
                                }
                                if (i11 == 1) {
                                }
                            }
                            mVar = j2.k.g(r92);
                        }
                    }
                    if (F2 == L1) {
                        break;
                    }
                }
                rm.n0 n0Var2 = rm.n0.f34904a;
            } finally {
                aVar.m(d10, f10, h10);
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r4v0 */
    /* JADX WARN: Type inference failed for: r4v1, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r4v10 */
    /* JADX WARN: Type inference failed for: r4v11 */
    /* JADX WARN: Type inference failed for: r4v3 */
    /* JADX WARN: Type inference failed for: r4v4, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r4v5, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r4v6 */
    /* JADX WARN: Type inference failed for: r4v7 */
    /* JADX WARN: Type inference failed for: r4v8 */
    /* JADX WARN: Type inference failed for: r4v9 */
    /* JADX WARN: Type inference failed for: r5v0 */
    /* JADX WARN: Type inference failed for: r5v1 */
    /* JADX WARN: Type inference failed for: r5v10 */
    /* JADX WARN: Type inference failed for: r5v11 */
    /* JADX WARN: Type inference failed for: r5v2 */
    /* JADX WARN: Type inference failed for: r5v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r5v4 */
    /* JADX WARN: Type inference failed for: r5v5 */
    /* JADX WARN: Type inference failed for: r5v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r5v8 */
    /* JADX WARN: Type inference failed for: r5v9 */
    public final void T2() {
        int a10 = b1.a(128);
        boolean i10 = c1.i(a10);
        i.c z22 = z2();
        if (!i10 && (z22 = z22.L1()) == null) {
            return;
        }
        for (i.c F2 = F2(i10); F2 != null && (F2.E1() & a10) != 0; F2 = F2.F1()) {
            if ((F2.J1() & a10) != 0) {
                m mVar = F2;
                ?? r52 = 0;
                while (mVar != 0) {
                    if (mVar instanceof a0) {
                        ((a0) mVar).M(this);
                    } else if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                        i.c i22 = mVar.i2();
                        int i11 = 0;
                        mVar = mVar;
                        r52 = r52;
                        while (i22 != null) {
                            if ((i22.J1() & a10) != 0) {
                                i11++;
                                r52 = r52;
                                if (i11 == 1) {
                                    mVar = i22;
                                } else {
                                    if (r52 == 0) {
                                        r52 = new a1.b(new i.c[16], 0);
                                    }
                                    if (mVar != 0) {
                                        r52.c(mVar);
                                        mVar = 0;
                                    }
                                    r52.c(i22);
                                }
                            }
                            i22 = i22.F1();
                            mVar = mVar;
                            r52 = r52;
                        }
                        if (i11 == 1) {
                        }
                    }
                    mVar = j2.k.g(r52);
                }
            }
            if (F2 == z22) {
                return;
            }
        }
    }

    public final void U2() {
        this.J = true;
        this.W.invoke();
        a3();
    }

    @Override // h2.p0
    public void V0(long j10, float f10, dn.l lVar) {
        if (!this.F) {
            W2(j10, f10, lVar, null);
            return;
        }
        q0 v22 = v2();
        kotlin.jvm.internal.t.d(v22);
        W2(v22.F1(), f10, lVar, null);
    }

    public abstract void V2(s1.a0 a0Var, v1.c cVar);

    @Override // j2.k1
    public boolean W() {
        return (this.Y == null || this.J || !w1().K0()) ? false : true;
    }

    @Override // h2.p0
    public void X0(long j10, float f10, v1.c cVar) {
        if (!this.F) {
            W2(j10, f10, null, cVar);
            return;
        }
        q0 v22 = v2();
        kotlin.jvm.internal.t.d(v22);
        W2(v22.F1(), f10, null, cVar);
    }

    public final void X2(long j10, float f10, dn.l lVar, v1.c cVar) {
        W2(c3.n.l(j10, E0()), f10, lVar, cVar);
    }

    public final void Y2(r1.e eVar, boolean z10, boolean z11) {
        i1 i1Var = this.Y;
        if (i1Var != null) {
            if (this.K) {
                if (z11) {
                    long w22 = w2();
                    float i10 = r1.m.i(w22) / 2.0f;
                    float g10 = r1.m.g(w22) / 2.0f;
                    eVar.e(-i10, -g10, c3.r.g(g()) + i10, c3.r.f(g()) + g10);
                } else if (z10) {
                    eVar.e(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, c3.r.g(g()), c3.r.f(g()));
                }
                if (eVar.f()) {
                    return;
                }
            }
            i1Var.k(eVar, false);
        }
        float h10 = c3.n.h(F1());
        eVar.i(eVar.b() + h10);
        eVar.j(eVar.c() + h10);
        float i11 = c3.n.i(F1());
        eVar.k(eVar.d() + i11);
        eVar.h(eVar.a() + i11);
    }

    public final void a3() {
        if (this.Y != null) {
            if (this.Z != null) {
                this.Z = null;
            }
            p3(this, null, false, 2, null);
            g0.u1(w1(), false, 1, null);
        }
    }

    public final void b3(boolean z10) {
        this.F = z10;
    }

    public void c3(h2.f0 f0Var) {
        h2.f0 f0Var2 = this.P;
        if (f0Var != f0Var2) {
            this.P = f0Var;
            if (f0Var2 == null || f0Var.getWidth() != f0Var2.getWidth() || f0Var.getHeight() != f0Var2.getHeight()) {
                R2(f0Var.getWidth(), f0Var.getHeight());
            }
            Map map = this.Q;
            if ((!(map == null || map.isEmpty()) || (!f0Var.h().isEmpty())) && !kotlin.jvm.internal.t.b(f0Var.h(), this.Q)) {
                q2().h().m();
                Map map2 = this.Q;
                if (map2 == null) {
                    map2 = new LinkedHashMap();
                    this.Q = map2;
                }
                map2.clear();
                map2.putAll(f0Var.h());
            }
        }
    }

    @Override // h2.s
    public long d0(long j10) {
        if (!N()) {
            g2.a.b("LayoutCoordinate operations are only valid when isAttached is true");
        }
        h2.s d10 = h2.t.d(this);
        return B(d10, r1.g.q(k0.b(w1()).h(j10), h2.t.e(d10)));
    }

    protected void d3(long j10) {
        this.R = j10;
    }

    public final void e3(z0 z0Var) {
        this.H = z0Var;
    }

    @Override // h2.s
    public r1.i f0(h2.s sVar, boolean z10) {
        if (!N()) {
            g2.a.b("LayoutCoordinate operations are only valid when isAttached is true");
        }
        if (!sVar.N()) {
            g2.a.b("LayoutCoordinates " + sVar + " is not attached!");
        }
        z0 i32 = i3(sVar);
        i32.O2();
        z0 m22 = m2(i32);
        r1.e x22 = x2();
        x22.i(BitmapDescriptorFactory.HUE_RED);
        x22.k(BitmapDescriptorFactory.HUE_RED);
        x22.j(c3.r.g(sVar.g()));
        x22.h(c3.r.f(sVar.g()));
        while (i32 != m22) {
            Z2(i32, x22, z10, false, 4, null);
            if (x22.f()) {
                return r1.i.f34323e.a();
            }
            i32 = i32.I;
            kotlin.jvm.internal.t.d(i32);
        }
        e2(m22, x22, z10);
        return r1.f.a(x22);
    }

    public final void f3(z0 z0Var) {
        this.I = z0Var;
    }

    @Override // h2.s
    public final long g() {
        return M0();
    }

    protected final long g2(long j10) {
        return r1.n.a(Math.max(BitmapDescriptorFactory.HUE_RED, (r1.m.i(j10) - N0()) / 2.0f), Math.max(BitmapDescriptorFactory.HUE_RED, (r1.m.g(j10) - I0()) / 2.0f));
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r4v0 */
    /* JADX WARN: Type inference failed for: r4v1, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r4v10 */
    /* JADX WARN: Type inference failed for: r4v11 */
    /* JADX WARN: Type inference failed for: r4v12 */
    /* JADX WARN: Type inference failed for: r4v4 */
    /* JADX WARN: Type inference failed for: r4v5, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r4v6, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r4v7 */
    /* JADX WARN: Type inference failed for: r4v8 */
    /* JADX WARN: Type inference failed for: r4v9 */
    /* JADX WARN: Type inference failed for: r5v0 */
    /* JADX WARN: Type inference failed for: r5v1 */
    /* JADX WARN: Type inference failed for: r5v10 */
    /* JADX WARN: Type inference failed for: r5v11 */
    /* JADX WARN: Type inference failed for: r5v2 */
    /* JADX WARN: Type inference failed for: r5v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r5v4 */
    /* JADX WARN: Type inference failed for: r5v5 */
    /* JADX WARN: Type inference failed for: r5v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r5v8 */
    /* JADX WARN: Type inference failed for: r5v9 */
    public final boolean g3() {
        i.c F2 = F2(c1.i(b1.a(16)));
        if (F2 != null && F2.O1()) {
            int a10 = b1.a(16);
            if (!F2.P0().O1()) {
                g2.a.b("visitLocalDescendants called on an unattached node");
            }
            i.c P0 = F2.P0();
            if ((P0.E1() & a10) != 0) {
                while (P0 != null) {
                    if ((P0.J1() & a10) != 0) {
                        m mVar = P0;
                        ?? r52 = 0;
                        while (mVar != 0) {
                            if (!(mVar instanceof p1)) {
                                if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                                    i.c i22 = mVar.i2();
                                    int i10 = 0;
                                    mVar = mVar;
                                    r52 = r52;
                                    while (i22 != null) {
                                        if ((i22.J1() & a10) != 0) {
                                            i10++;
                                            r52 = r52;
                                            if (i10 == 1) {
                                                mVar = i22;
                                            } else {
                                                if (r52 == 0) {
                                                    r52 = new a1.b(new i.c[16], 0);
                                                }
                                                if (mVar != 0) {
                                                    r52.c(mVar);
                                                    mVar = 0;
                                                }
                                                r52.c(i22);
                                            }
                                        }
                                        i22 = i22.F1();
                                        mVar = mVar;
                                        r52 = r52;
                                    }
                                    if (i10 == 1) {
                                    }
                                }
                            } else if (((p1) mVar).k1()) {
                                return true;
                            }
                            mVar = j2.k.g(r52);
                        }
                    }
                    P0 = P0.F1();
                }
            }
        }
        return false;
    }

    @Override // c3.d
    public float getDensity() {
        return w1().K().getDensity();
    }

    @Override // h2.o
    public c3.t getLayoutDirection() {
        return w1().getLayoutDirection();
    }

    public final float h2(long j10, long j11) {
        if (N0() >= r1.m.i(j11) && I0() >= r1.m.g(j11)) {
            return Float.POSITIVE_INFINITY;
        }
        long g22 = g2(j11);
        float i10 = r1.m.i(g22);
        float g10 = r1.m.g(g22);
        long N2 = N2(j10);
        if ((i10 > BitmapDescriptorFactory.HUE_RED || g10 > BitmapDescriptorFactory.HUE_RED) && r1.g.m(N2) <= i10 && r1.g.n(N2) <= g10) {
            return r1.g.l(N2);
        }
        return Float.POSITIVE_INFINITY;
    }

    @Override // h2.s
    public final h2.s i0() {
        if (!N()) {
            g2.a.b("LayoutCoordinate operations are only valid when isAttached is true");
        }
        O2();
        return w1().m0().I;
    }

    public final void i2(s1.a0 a0Var, v1.c cVar) {
        i1 i1Var = this.Y;
        if (i1Var != null) {
            i1Var.c(a0Var, cVar);
            return;
        }
        float h10 = c3.n.h(F1());
        float i10 = c3.n.i(F1());
        a0Var.d(h10, i10);
        k2(a0Var, cVar);
        a0Var.d(-h10, -i10);
    }

    public final void j2(s1.a0 a0Var, s1.d1 d1Var) {
        a0Var.u(new r1.i(0.5f, 0.5f, c3.r.g(M0()) - 0.5f, c3.r.f(M0()) - 0.5f), d1Var);
    }

    public long j3(long j10, boolean z10) {
        i1 i1Var = this.Y;
        if (i1Var != null) {
            j10 = i1Var.h(j10, false);
        }
        return (z10 || !J1()) ? c3.o.c(j10, F1()) : j10;
    }

    public abstract void l2();

    public final r1.i l3() {
        if (!N()) {
            return r1.i.f34323e.a();
        }
        h2.s d10 = h2.t.d(this);
        r1.e x22 = x2();
        long g22 = g2(w2());
        x22.i(-r1.m.i(g22));
        x22.k(-r1.m.g(g22));
        x22.j(N0() + r1.m.i(g22));
        x22.h(I0() + r1.m.g(g22));
        while (this != d10) {
            this.Y2(x22, false, true);
            if (x22.f()) {
                return r1.i.f34323e.a();
            }
            this = this.I;
            kotlin.jvm.internal.t.d(this);
        }
        return r1.f.a(x22);
    }

    public final z0 m2(z0 z0Var) {
        g0 w12 = z0Var.w1();
        g0 w13 = w1();
        if (w12 == w13) {
            i.c z22 = z0Var.z2();
            i.c z23 = z2();
            int a10 = b1.a(2);
            if (!z23.P0().O1()) {
                g2.a.b("visitLocalAncestors called on an unattached node");
            }
            for (i.c L1 = z23.P0().L1(); L1 != null; L1 = L1.L1()) {
                if ((L1.J1() & a10) != 0 && L1 == z22) {
                    return z0Var;
                }
            }
            return this;
        }
        while (w12.L() > w13.L()) {
            w12 = w12.o0();
            kotlin.jvm.internal.t.d(w12);
        }
        while (w13.L() > w12.L()) {
            w13 = w13.o0();
            kotlin.jvm.internal.t.d(w13);
        }
        while (w12 != w13) {
            w12 = w12.o0();
            w13 = w13.o0();
            if (w12 == null || w13 == null) {
                throw new IllegalArgumentException("layouts are not part of the same hierarchy");
            }
        }
        return w13 == w1() ? this : w12 == z0Var.w1() ? z0Var : w12.P();
    }

    public long n2(long j10, boolean z10) {
        if (z10 || !J1()) {
            j10 = c3.o.b(j10, F1());
        }
        i1 i1Var = this.Y;
        return i1Var != null ? i1Var.h(j10, true) : j10;
    }

    @Override // h2.s
    public void o0(h2.s sVar, float[] fArr) {
        z0 i32 = i3(sVar);
        i32.O2();
        z0 m22 = m2(i32);
        s1.z0.h(fArr);
        i32.n3(m22, fArr);
        m3(m22, fArr);
    }

    public final void o3(dn.l lVar, boolean z10) {
        j1 n02;
        if (!(lVar == null || this.Z == null)) {
            g2.a.a("layerBlock can't be provided when explicitLayer is provided");
        }
        g0 w12 = w1();
        boolean z11 = (!z10 && this.L == lVar && kotlin.jvm.internal.t.b(this.M, w12.K()) && this.N == w12.getLayoutDirection()) ? false : true;
        this.M = w12.K();
        this.N = w12.getLayoutDirection();
        if (!w12.K0() || lVar == null) {
            this.L = null;
            i1 i1Var = this.Y;
            if (i1Var != null) {
                i1Var.d();
                w12.B1(true);
                this.W.invoke();
                if (N() && (n02 = w12.n0()) != null) {
                    n02.p(w12);
                }
            }
            this.Y = null;
            this.X = false;
            return;
        }
        this.L = lVar;
        if (this.Y != null) {
            if (z11) {
                r3(this, false, 1, null);
                return;
            }
            return;
        }
        i1 w10 = j1.w(k0.b(w12), this.V, this.W, null, 4, null);
        w10.i(M0());
        w10.l(F1());
        this.Y = w10;
        r3(this, false, 1, null);
        w12.B1(true);
        this.W.invoke();
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r7v0 */
    /* JADX WARN: Type inference failed for: r7v1, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r7v10 */
    /* JADX WARN: Type inference failed for: r7v11 */
    /* JADX WARN: Type inference failed for: r7v12 */
    /* JADX WARN: Type inference failed for: r7v4 */
    /* JADX WARN: Type inference failed for: r7v5, types: [l1.i$c] */
    /* JADX WARN: Type inference failed for: r7v6, types: [java.lang.Object] */
    /* JADX WARN: Type inference failed for: r7v7 */
    /* JADX WARN: Type inference failed for: r7v8 */
    /* JADX WARN: Type inference failed for: r7v9 */
    /* JADX WARN: Type inference failed for: r8v0 */
    /* JADX WARN: Type inference failed for: r8v1 */
    /* JADX WARN: Type inference failed for: r8v10 */
    /* JADX WARN: Type inference failed for: r8v11 */
    /* JADX WARN: Type inference failed for: r8v2 */
    /* JADX WARN: Type inference failed for: r8v3, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r8v4 */
    /* JADX WARN: Type inference failed for: r8v5 */
    /* JADX WARN: Type inference failed for: r8v6, types: [a1.b] */
    /* JADX WARN: Type inference failed for: r8v8 */
    /* JADX WARN: Type inference failed for: r8v9 */
    @Override // h2.h0, h2.n
    public Object p() {
        if (!w1().k0().q(b1.a(64))) {
            return null;
        }
        z2();
        kotlin.jvm.internal.o0 o0Var = new kotlin.jvm.internal.o0();
        for (i.c o10 = w1().k0().o(); o10 != null; o10 = o10.L1()) {
            if ((b1.a(64) & o10.J1()) != 0) {
                int a10 = b1.a(64);
                ?? r82 = 0;
                m mVar = o10;
                while (mVar != 0) {
                    if (mVar instanceof m1) {
                        o0Var.f26199p = ((m1) mVar).z(w1().K(), o0Var.f26199p);
                    } else if (((mVar.J1() & a10) != 0) && (mVar instanceof m)) {
                        i.c i22 = mVar.i2();
                        int i10 = 0;
                        mVar = mVar;
                        r82 = r82;
                        while (i22 != null) {
                            if ((i22.J1() & a10) != 0) {
                                i10++;
                                r82 = r82;
                                if (i10 == 1) {
                                    mVar = i22;
                                } else {
                                    if (r82 == 0) {
                                        r82 = new a1.b(new i.c[16], 0);
                                    }
                                    if (mVar != 0) {
                                        r82.c(mVar);
                                        mVar = 0;
                                    }
                                    r82.c(i22);
                                }
                            }
                            i22 = i22.F1();
                            mVar = mVar;
                            r82 = r82;
                        }
                        if (i10 == 1) {
                        }
                    }
                    mVar = j2.k.g(r82);
                }
            }
        }
        return o0Var.f26199p;
    }

    public j2.b q2() {
        return w1().U().r();
    }

    @Override // h2.s
    public long r(long j10) {
        if (!N()) {
            g2.a.b("LayoutCoordinate operations are only valid when isAttached is true");
        }
        return B(h2.t.d(this), k0.b(w1()).r(j10));
    }

    @Override // h2.s
    public long r0(long j10) {
        if (!N()) {
            g2.a.b("LayoutCoordinate operations are only valid when isAttached is true");
        }
        O2();
        long j11 = j10;
        while (this != null) {
            j11 = k3(this, j11, false, 2, null);
            this = this.I;
        }
        return j11;
    }

    @Override // j2.p0
    public p0 r1() {
        return this.H;
    }

    public final boolean r2() {
        return this.G;
    }

    public final boolean s2() {
        return this.X;
    }

    public final boolean s3(long j10) {
        if (!r1.h.b(j10)) {
            return false;
        }
        i1 i1Var = this.Y;
        return i1Var == null || !this.K || i1Var.e(j10);
    }

    public final long t2() {
        return P0();
    }

    @Override // j2.p0
    public h2.s u1() {
        return this;
    }

    public final i1 u2() {
        return this.Y;
    }

    @Override // j2.p0
    public boolean v1() {
        return this.P != null;
    }

    public abstract q0 v2();

    @Override // j2.p0
    public g0 w1() {
        return this.E;
    }

    public final long w2() {
        return this.M.l1(w1().s0().e());
    }

    protected final r1.e x2() {
        r1.e eVar = this.T;
        if (eVar != null) {
            return eVar;
        }
        r1.e eVar2 = new r1.e(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED);
        this.T = eVar2;
        return eVar2;
    }

    @Override // h2.s
    public long z(long j10) {
        return k0.b(w1()).e(r0(j10));
    }

    public abstract i.c z2();
}
