package j2;

import c3.n;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import h2.p0;
import j2.g0;
import java.util.List;
import java.util.Map;

/* loaded from: classes.dex */
public final class l0 {

    /* renamed from: a, reason: collision with root package name */
    private final g0 f23674a;

    /* renamed from: b, reason: collision with root package name */
    private boolean f23675b;

    /* renamed from: d, reason: collision with root package name */
    private boolean f23677d;

    /* renamed from: e, reason: collision with root package name */
    private boolean f23678e;

    /* renamed from: f, reason: collision with root package name */
    private boolean f23679f;

    /* renamed from: g, reason: collision with root package name */
    private boolean f23680g;

    /* renamed from: h, reason: collision with root package name */
    private boolean f23681h;

    /* renamed from: i, reason: collision with root package name */
    private boolean f23682i;

    /* renamed from: j, reason: collision with root package name */
    private int f23683j;

    /* renamed from: k, reason: collision with root package name */
    private int f23684k;

    /* renamed from: l, reason: collision with root package name */
    private boolean f23685l;

    /* renamed from: m, reason: collision with root package name */
    private boolean f23686m;

    /* renamed from: n, reason: collision with root package name */
    private int f23687n;

    /* renamed from: o, reason: collision with root package name */
    private boolean f23688o;

    /* renamed from: p, reason: collision with root package name */
    private boolean f23689p;

    /* renamed from: q, reason: collision with root package name */
    private int f23690q;

    /* renamed from: s, reason: collision with root package name */
    private a f23692s;

    /* renamed from: c, reason: collision with root package name */
    private g0.e f23676c = g0.e.Idle;

    /* renamed from: r, reason: collision with root package name */
    private final b f23691r = new b();

    /* renamed from: t, reason: collision with root package name */
    private long f23693t = c3.c.b(0, 0, 0, 0, 15, null);

    /* renamed from: u, reason: collision with root package name */
    private final dn.a f23694u = new d();

    /* loaded from: classes.dex */
    public final class a extends h2.p0 implements h2.d0, j2.b, t0 {
        private boolean A;
        private c3.b B;
        private float D;
        private dn.l E;
        private v1.c F;
        private boolean G;
        private boolean K;
        private boolean N;
        private boolean O;

        /* renamed from: u, reason: collision with root package name */
        private boolean f23695u;

        /* renamed from: y, reason: collision with root package name */
        private boolean f23699y;

        /* renamed from: z, reason: collision with root package name */
        private boolean f23700z;

        /* renamed from: v, reason: collision with root package name */
        private int f23696v = Api.BaseClientBuilder.API_PRIORITY_OTHER;

        /* renamed from: w, reason: collision with root package name */
        private int f23697w = Api.BaseClientBuilder.API_PRIORITY_OTHER;

        /* renamed from: x, reason: collision with root package name */
        private g0.g f23698x = g0.g.NotUsed;
        private long C = c3.n.f7423b.a();
        private final j2.a H = new o0(this);
        private final a1.b I = new a1.b(new a[16], 0);
        private boolean J = true;
        private boolean L = true;
        private Object M = v1().p();

        /* renamed from: j2.l0$a$a, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        public /* synthetic */ class C0504a {

            /* renamed from: a, reason: collision with root package name */
            public static final /* synthetic */ int[] f23701a;

            /* renamed from: b, reason: collision with root package name */
            public static final /* synthetic */ int[] f23702b;

            static {
                int[] iArr = new int[g0.e.values().length];
                try {
                    iArr[g0.e.LookaheadMeasuring.ordinal()] = 1;
                } catch (NoSuchFieldError unused) {
                }
                try {
                    iArr[g0.e.Measuring.ordinal()] = 2;
                } catch (NoSuchFieldError unused2) {
                }
                try {
                    iArr[g0.e.LayingOut.ordinal()] = 3;
                } catch (NoSuchFieldError unused3) {
                }
                try {
                    iArr[g0.e.LookaheadLayingOut.ordinal()] = 4;
                } catch (NoSuchFieldError unused4) {
                }
                f23701a = iArr;
                int[] iArr2 = new int[g0.g.values().length];
                try {
                    iArr2[g0.g.InMeasureBlock.ordinal()] = 1;
                } catch (NoSuchFieldError unused5) {
                }
                try {
                    iArr2[g0.g.InLayoutBlock.ordinal()] = 2;
                } catch (NoSuchFieldError unused6) {
                }
                f23702b = iArr2;
            }
        }

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

            /* renamed from: q, reason: collision with root package name */
            final /* synthetic */ q0 f23704q;

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ l0 f23705r;

            /* JADX INFO: Access modifiers changed from: package-private */
            /* renamed from: j2.l0$a$b$a, reason: collision with other inner class name */
            /* loaded from: classes.dex */
            public static final class C0505a extends kotlin.jvm.internal.v implements dn.l {

                /* renamed from: p, reason: collision with root package name */
                public static final C0505a f23706p = new C0505a();

                C0505a() {
                    super(1);
                }

                public final void a(j2.b bVar) {
                    bVar.h().t(false);
                }

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

            /* JADX INFO: Access modifiers changed from: package-private */
            /* renamed from: j2.l0$a$b$b, reason: collision with other inner class name */
            /* loaded from: classes.dex */
            public static final class C0506b extends kotlin.jvm.internal.v implements dn.l {

                /* renamed from: p, reason: collision with root package name */
                public static final C0506b f23707p = new C0506b();

                C0506b() {
                    super(1);
                }

                public final void a(j2.b bVar) {
                    bVar.h().q(bVar.h().l());
                }

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            b(q0 q0Var, l0 l0Var) {
                super(0);
                this.f23704q = q0Var;
                this.f23705r = l0Var;
            }

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

            /* renamed from: invoke, reason: collision with other method in class */
            public final void m275invoke() {
                a.this.p1();
                a.this.C(C0505a.f23706p);
                q0 v22 = a.this.I().v2();
                if (v22 != null) {
                    boolean K1 = v22.K1();
                    List H = this.f23705r.f23674a.H();
                    int size = H.size();
                    for (int i10 = 0; i10 < size; i10++) {
                        q0 v23 = ((g0) H.get(i10)).m0().v2();
                        if (v23 != null) {
                            v23.O1(K1);
                        }
                    }
                }
                this.f23704q.A1().i();
                q0 v24 = a.this.I().v2();
                if (v24 != null) {
                    v24.K1();
                    List H2 = this.f23705r.f23674a.H();
                    int size2 = H2.size();
                    for (int i11 = 0; i11 < size2; i11++) {
                        q0 v25 = ((g0) H2.get(i11)).m0().v2();
                        if (v25 != null) {
                            v25.O1(false);
                        }
                    }
                }
                a.this.o1();
                a.this.C(C0506b.f23707p);
            }
        }

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

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ l0 f23708p;

            /* renamed from: q, reason: collision with root package name */
            final /* synthetic */ j1 f23709q;

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ long f23710r;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            c(l0 l0Var, j1 j1Var, long j10) {
                super(0);
                this.f23708p = l0Var;
                this.f23709q = j1Var;
                this.f23710r = j10;
            }

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

            /* renamed from: invoke, reason: collision with other method in class */
            public final void m276invoke() {
                q0 v22;
                p0.a aVar = null;
                if (m0.a(this.f23708p.f23674a)) {
                    z0 B2 = this.f23708p.K().B2();
                    if (B2 != null) {
                        aVar = B2.E1();
                    }
                } else {
                    z0 B22 = this.f23708p.K().B2();
                    if (B22 != null && (v22 = B22.v2()) != null) {
                        aVar = v22.E1();
                    }
                }
                if (aVar == null) {
                    aVar = this.f23709q.getPlacementScope();
                }
                l0 l0Var = this.f23708p;
                long j10 = this.f23710r;
                q0 v23 = l0Var.K().v2();
                kotlin.jvm.internal.t.d(v23);
                p0.a.j(aVar, v23, j10, BitmapDescriptorFactory.HUE_RED, 2, null);
            }
        }

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

            /* renamed from: p, reason: collision with root package name */
            public static final d f23711p = new d();

            d() {
                super(1);
            }

            public final void a(j2.b bVar) {
                bVar.h().u(false);
            }

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

        public a() {
        }

        private final void F1() {
            boolean q10 = q();
            S1(true);
            if (!q10 && l0.this.G()) {
                g0.s1(l0.this.f23674a, true, false, false, 6, null);
            }
            a1.b w02 = l0.this.f23674a.w0();
            int q11 = w02.q();
            if (q11 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    g0 g0Var = (g0) p10[i10];
                    a a02 = g0Var.a0();
                    if (a02 == null) {
                        throw new IllegalArgumentException("Error: Child node's lookahead pass delegate cannot be null when in a lookahead scope.".toString());
                    }
                    if (a02.f23697w != Integer.MAX_VALUE) {
                        a02.F1();
                        g0Var.x1(g0Var);
                    }
                    i10++;
                } while (i10 < q11);
            }
        }

        private final void G1() {
            if (q()) {
                int i10 = 0;
                S1(false);
                a1.b w02 = l0.this.f23674a.w0();
                int q10 = w02.q();
                if (q10 > 0) {
                    Object[] p10 = w02.p();
                    do {
                        a H = ((g0) p10[i10]).U().H();
                        kotlin.jvm.internal.t.d(H);
                        H.G1();
                        i10++;
                    } while (i10 < q10);
                }
            }
        }

        private final void I1() {
            g0 g0Var = l0.this.f23674a;
            l0 l0Var = l0.this;
            a1.b w02 = g0Var.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    g0 g0Var2 = (g0) p10[i10];
                    if (g0Var2.Z() && g0Var2.h0() == g0.g.InMeasureBlock) {
                        a H = g0Var2.U().H();
                        kotlin.jvm.internal.t.d(H);
                        c3.b z10 = g0Var2.U().z();
                        kotlin.jvm.internal.t.d(z10);
                        if (H.N1(z10.r())) {
                            g0.s1(l0Var.f23674a, false, false, false, 7, null);
                        }
                    }
                    i10++;
                } while (i10 < q10);
            }
        }

        private final void J1() {
            g0.s1(l0.this.f23674a, false, false, false, 7, null);
            g0 o02 = l0.this.f23674a.o0();
            if (o02 == null || l0.this.f23674a.T() != g0.g.NotUsed) {
                return;
            }
            g0 g0Var = l0.this.f23674a;
            int i10 = C0504a.f23701a[o02.X().ordinal()];
            g0Var.D1(i10 != 2 ? i10 != 3 ? o02.T() : g0.g.InLayoutBlock : g0.g.InMeasureBlock);
        }

        private final void M1(long j10, float f10, dn.l lVar, v1.c cVar) {
            if (!(!l0.this.f23674a.L0())) {
                g2.a.a("place is called on a deactivated node");
            }
            l0.this.f23676c = g0.e.LookaheadLayingOut;
            this.f23700z = true;
            this.O = false;
            if (!c3.n.g(j10, this.C)) {
                if (l0.this.D() || l0.this.E()) {
                    l0.this.f23681h = true;
                }
                H1();
            }
            j1 b10 = k0.b(l0.this.f23674a);
            if (l0.this.F() || !q()) {
                l0.this.a0(false);
                h().r(false);
                l1.d(b10.getSnapshotObserver(), l0.this.f23674a, false, new c(l0.this, b10, j10), 2, null);
            } else {
                q0 v22 = l0.this.K().v2();
                kotlin.jvm.internal.t.d(v22);
                v22.a2(j10);
                L1();
            }
            this.C = j10;
            this.D = f10;
            this.E = lVar;
            this.F = cVar;
            l0.this.f23676c = g0.e.Idle;
        }

        private final void T1(g0 g0Var) {
            g0.g gVar;
            g0 o02 = g0Var.o0();
            if (o02 == null) {
                this.f23698x = g0.g.NotUsed;
                return;
            }
            if (!(this.f23698x == g0.g.NotUsed || g0Var.E())) {
                g2.a.b("measure() may not be called multiple times on the same Measurable. If you want to get the content size of the Measurable before calculating the final constraints, please use methods like minIntrinsicWidth()/maxIntrinsicWidth() and minIntrinsicHeight()/maxIntrinsicHeight()");
            }
            int i10 = C0504a.f23701a[o02.X().ordinal()];
            if (i10 == 1 || i10 == 2) {
                gVar = g0.g.InMeasureBlock;
            } else {
                if (i10 != 3 && i10 != 4) {
                    throw new IllegalStateException("Measurable could be only measured from the parent's measure or layout block. Parents state is " + o02.X());
                }
                gVar = g0.g.InLayoutBlock;
            }
            this.f23698x = gVar;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final void o1() {
            a1.b w02 = l0.this.f23674a.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    a H = ((g0) p10[i10]).U().H();
                    kotlin.jvm.internal.t.d(H);
                    int i11 = H.f23696v;
                    int i12 = H.f23697w;
                    if (i11 != i12 && i12 == Integer.MAX_VALUE) {
                        H.G1();
                    }
                    i10++;
                } while (i10 < q10);
            }
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final void p1() {
            int i10 = 0;
            l0.this.f23683j = 0;
            a1.b w02 = l0.this.f23674a.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                do {
                    a H = ((g0) p10[i10]).U().H();
                    kotlin.jvm.internal.t.d(H);
                    H.f23696v = H.f23697w;
                    H.f23697w = Api.BaseClientBuilder.API_PRIORITY_OTHER;
                    if (H.f23698x == g0.g.InLayoutBlock) {
                        H.f23698x = g0.g.NotUsed;
                    }
                    i10++;
                } while (i10 < q10);
            }
        }

        public final boolean A1() {
            return this.f23700z;
        }

        @Override // j2.b
        public void C(dn.l lVar) {
            a1.b w02 = l0.this.f23674a.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    j2.b C = ((g0) p10[i10]).U().C();
                    kotlin.jvm.internal.t.d(C);
                    lVar.invoke(C);
                    i10++;
                } while (i10 < q10);
            }
        }

        public final void D1(boolean z10) {
            g0 g0Var;
            g0 o02 = l0.this.f23674a.o0();
            g0.g T = l0.this.f23674a.T();
            if (o02 == null || T == g0.g.NotUsed) {
                return;
            }
            do {
                g0Var = o02;
                if (g0Var.T() != T) {
                    break;
                } else {
                    o02 = g0Var.o0();
                }
            } while (o02 != null);
            int i10 = C0504a.f23702b[T.ordinal()];
            if (i10 == 1) {
                if (g0Var.b0() != null) {
                    g0.s1(g0Var, z10, false, false, 6, null);
                    return;
                } else {
                    g0.w1(g0Var, z10, false, false, 6, null);
                    return;
                }
            }
            if (i10 != 2) {
                throw new IllegalStateException("Intrinsics isn't used by the parent".toString());
            }
            if (g0Var.b0() != null) {
                g0Var.p1(z10);
            } else {
                g0Var.t1(z10);
            }
        }

        public final void E1() {
            this.L = true;
        }

        public final void H1() {
            a1.b w02;
            int q10;
            if (l0.this.t() <= 0 || (q10 = (w02 = l0.this.f23674a.w0()).q()) <= 0) {
                return;
            }
            Object[] p10 = w02.p();
            int i10 = 0;
            do {
                g0 g0Var = (g0) p10[i10];
                l0 U = g0Var.U();
                if ((U.E() || U.D()) && !U.F()) {
                    g0.q1(g0Var, false, 1, null);
                }
                a H = U.H();
                if (H != null) {
                    H.H1();
                }
                i10++;
            } while (i10 < q10);
        }

        @Override // j2.b
        public z0 I() {
            return l0.this.f23674a.P();
        }

        public final void K1() {
            this.f23697w = Api.BaseClientBuilder.API_PRIORITY_OTHER;
            this.f23696v = Api.BaseClientBuilder.API_PRIORITY_OTHER;
            S1(false);
        }

        public final void L1() {
            this.O = true;
            g0 o02 = l0.this.f23674a.o0();
            if (!q()) {
                F1();
                if (this.f23695u && o02 != null) {
                    g0.q1(o02, false, 1, null);
                }
            }
            if (o02 == null) {
                this.f23697w = 0;
            } else if (!this.f23695u && (o02.X() == g0.e.LayingOut || o02.X() == g0.e.LookaheadLayingOut)) {
                if (!(this.f23697w == Integer.MAX_VALUE)) {
                    g2.a.b("Place was called on a node which was placed already");
                }
                this.f23697w = o02.U().f23683j;
                o02.U().f23683j++;
            }
            n0();
        }

        @Override // j2.b
        public j2.b M() {
            l0 U;
            g0 o02 = l0.this.f23674a.o0();
            if (o02 == null || (U = o02.U()) == null) {
                return null;
            }
            return U.C();
        }

        public final boolean N1(long j10) {
            if (!(!l0.this.f23674a.L0())) {
                g2.a.a("measure is called on a deactivated node");
            }
            g0 o02 = l0.this.f23674a.o0();
            l0.this.f23674a.A1(l0.this.f23674a.E() || (o02 != null && o02.E()));
            if (!l0.this.f23674a.Z()) {
                c3.b bVar = this.B;
                if (bVar == null ? false : c3.b.f(bVar.r(), j10)) {
                    j1 n02 = l0.this.f23674a.n0();
                    if (n02 != null) {
                        n02.z(l0.this.f23674a, true);
                    }
                    l0.this.f23674a.z1();
                    return false;
                }
            }
            this.B = c3.b.a(j10);
            d1(j10);
            h().s(false);
            C(d.f23711p);
            long M0 = this.A ? M0() : c3.s.a(Integer.MIN_VALUE, Integer.MIN_VALUE);
            this.A = true;
            q0 v22 = l0.this.K().v2();
            if (!(v22 != null)) {
                g2.a.b("Lookahead result from lookaheadRemeasure cannot be null");
            }
            l0.this.T(j10);
            c1(c3.s.a(v22.S0(), v22.F0()));
            return (c3.r.g(M0) == v22.S0() && c3.r.f(M0) == v22.F0()) ? false : true;
        }

        public final void O1() {
            g0 o02;
            try {
                this.f23695u = true;
                if (!this.f23700z) {
                    g2.a.b("replace() called on item that was not placed");
                }
                this.O = false;
                boolean q10 = q();
                M1(this.C, BitmapDescriptorFactory.HUE_RED, this.E, this.F);
                if (q10 && !this.O && (o02 = l0.this.f23674a.o0()) != null) {
                    g0.q1(o02, false, 1, null);
                }
            } finally {
                this.f23695u = false;
            }
        }

        public final void P1(boolean z10) {
            this.J = z10;
        }

        public final void Q1(g0.g gVar) {
            this.f23698x = gVar;
        }

        public final void R1(int i10) {
            this.f23697w = i10;
        }

        public void S1(boolean z10) {
            this.G = z10;
        }

        @Override // h2.n
        public int T(int i10) {
            J1();
            q0 v22 = l0.this.K().v2();
            kotlin.jvm.internal.t.d(v22);
            return v22.T(i10);
        }

        public final boolean U1() {
            if (p() == null) {
                q0 v22 = l0.this.K().v2();
                kotlin.jvm.internal.t.d(v22);
                if (v22.p() == null) {
                    return false;
                }
            }
            if (!this.L) {
                return false;
            }
            this.L = false;
            q0 v23 = l0.this.K().v2();
            kotlin.jvm.internal.t.d(v23);
            this.M = v23.p();
            return true;
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // h2.p0
        public void V0(long j10, float f10, dn.l lVar) {
            M1(j10, f10, lVar, null);
        }

        @Override // h2.n
        public int X(int i10) {
            J1();
            q0 v22 = l0.this.K().v2();
            kotlin.jvm.internal.t.d(v22);
            return v22.X(i10);
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // h2.p0
        public void X0(long j10, float f10, v1.c cVar) {
            M1(j10, f10, null, cVar);
        }

        /* JADX WARN: Code restructure failed: missing block: B:10:0x0029, code lost:
        
            if ((r0 != null ? r0.X() : null) == j2.g0.e.LookaheadLayingOut) goto L13;
         */
        @Override // h2.d0
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public h2.p0 Y(long j10) {
            g0 o02 = l0.this.f23674a.o0();
            if ((o02 != null ? o02.X() : null) != g0.e.LookaheadMeasuring) {
                g0 o03 = l0.this.f23674a.o0();
            }
            l0.this.f23675b = false;
            T1(l0.this.f23674a);
            if (l0.this.f23674a.T() == g0.g.NotUsed) {
                l0.this.f23674a.v();
            }
            N1(j10);
            return this;
        }

        @Override // j2.b
        public j2.a h() {
            return this.H;
        }

        @Override // j2.b
        public void n0() {
            this.K = true;
            h().o();
            if (l0.this.F()) {
                I1();
            }
            q0 v22 = I().v2();
            kotlin.jvm.internal.t.d(v22);
            if (l0.this.f23682i || (!this.f23699y && !v22.K1() && l0.this.F())) {
                l0.this.f23681h = false;
                g0.e B = l0.this.B();
                l0.this.f23676c = g0.e.LookaheadLayingOut;
                j1 b10 = k0.b(l0.this.f23674a);
                l0.this.b0(false);
                l1.f(b10.getSnapshotObserver(), l0.this.f23674a, false, new b(v22, l0.this), 2, null);
                l0.this.f23676c = B;
                if (l0.this.E() && v22.K1()) {
                    requestLayout();
                }
                l0.this.f23682i = false;
            }
            if (h().l()) {
                h().q(true);
            }
            if (h().g() && h().k()) {
                h().n();
            }
            this.K = false;
        }

        @Override // h2.h0, h2.n
        public Object p() {
            return this.M;
        }

        @Override // j2.b
        public boolean q() {
            return this.G;
        }

        @Override // j2.t0
        public void q0(boolean z10) {
            q0 v22;
            q0 v23 = l0.this.K().v2();
            if (!kotlin.jvm.internal.t.b(Boolean.valueOf(z10), v23 != null ? Boolean.valueOf(v23.J1()) : null) && (v22 = l0.this.K().v2()) != null) {
                v22.q0(z10);
            }
            this.N = z10;
        }

        public final List q1() {
            l0.this.f23674a.H();
            if (!this.J) {
                return this.I.j();
            }
            g0 g0Var = l0.this.f23674a;
            a1.b bVar = this.I;
            a1.b w02 = g0Var.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    g0 g0Var2 = (g0) p10[i10];
                    if (bVar.q() <= i10) {
                        a H = g0Var2.U().H();
                        kotlin.jvm.internal.t.d(H);
                        bVar.c(H);
                    } else {
                        a H2 = g0Var2.U().H();
                        kotlin.jvm.internal.t.d(H2);
                        bVar.D(i10, H2);
                    }
                    i10++;
                } while (i10 < q10);
            }
            bVar.B(g0Var.H().size(), bVar.q());
            this.J = false;
            return this.I.j();
        }

        public final c3.b r1() {
            return this.B;
        }

        @Override // j2.b
        public void requestLayout() {
            g0.q1(l0.this.f23674a, false, 1, null);
        }

        @Override // h2.n
        public int s(int i10) {
            J1();
            q0 v22 = l0.this.K().v2();
            kotlin.jvm.internal.t.d(v22);
            return v22.s(i10);
        }

        @Override // j2.b
        public void s0() {
            g0.s1(l0.this.f23674a, false, false, false, 7, null);
        }

        @Override // h2.h0
        public int u0(h2.a aVar) {
            g0 o02 = l0.this.f23674a.o0();
            if ((o02 != null ? o02.X() : null) == g0.e.LookaheadMeasuring) {
                h().u(true);
            } else {
                g0 o03 = l0.this.f23674a.o0();
                if ((o03 != null ? o03.X() : null) == g0.e.LookaheadLayingOut) {
                    h().t(true);
                }
            }
            this.f23699y = true;
            q0 v22 = l0.this.K().v2();
            kotlin.jvm.internal.t.d(v22);
            int u02 = v22.u0(aVar);
            this.f23699y = false;
            return u02;
        }

        public final boolean u1() {
            return this.K;
        }

        @Override // h2.n
        public int v0(int i10) {
            J1();
            q0 v22 = l0.this.K().v2();
            kotlin.jvm.internal.t.d(v22);
            return v22.v0(i10);
        }

        public final b v1() {
            return l0.this.I();
        }

        public final g0.g w1() {
            return this.f23698x;
        }

        @Override // j2.b
        public Map x() {
            if (!this.f23699y) {
                if (l0.this.B() == g0.e.LookaheadMeasuring) {
                    h().s(true);
                    if (h().g()) {
                        l0.this.P();
                    }
                } else {
                    h().r(true);
                }
            }
            q0 v22 = I().v2();
            if (v22 != null) {
                v22.O1(true);
            }
            n0();
            q0 v23 = I().v2();
            if (v23 != null) {
                v23.O1(false);
            }
            return h().h();
        }
    }

    /* loaded from: classes.dex */
    public final class b extends h2.p0 implements h2.d0, j2.b, t0 {
        private boolean A;
        private long B;
        private dn.l C;
        private v1.c D;
        private float E;
        private boolean F;
        private Object G;
        private boolean H;
        private boolean I;
        private final j2.a J;
        private final a1.b K;
        private boolean L;
        private boolean M;
        private final dn.a N;
        private float O;
        private boolean P;
        private dn.l Q;
        private v1.c R;
        private long S;
        private float T;
        private final dn.a U;
        private boolean V;
        private boolean W;

        /* renamed from: u, reason: collision with root package name */
        private boolean f23712u;

        /* renamed from: x, reason: collision with root package name */
        private boolean f23715x;

        /* renamed from: y, reason: collision with root package name */
        private boolean f23716y;

        /* renamed from: v, reason: collision with root package name */
        private int f23713v = Api.BaseClientBuilder.API_PRIORITY_OTHER;

        /* renamed from: w, reason: collision with root package name */
        private int f23714w = Api.BaseClientBuilder.API_PRIORITY_OTHER;

        /* renamed from: z, reason: collision with root package name */
        private g0.g f23717z = g0.g.NotUsed;

        /* loaded from: classes.dex */
        public /* synthetic */ class a {

            /* renamed from: a, reason: collision with root package name */
            public static final /* synthetic */ int[] f23718a;

            /* renamed from: b, reason: collision with root package name */
            public static final /* synthetic */ int[] f23719b;

            static {
                int[] iArr = new int[g0.e.values().length];
                try {
                    iArr[g0.e.Measuring.ordinal()] = 1;
                } catch (NoSuchFieldError unused) {
                }
                try {
                    iArr[g0.e.LayingOut.ordinal()] = 2;
                } catch (NoSuchFieldError unused2) {
                }
                f23718a = iArr;
                int[] iArr2 = new int[g0.g.values().length];
                try {
                    iArr2[g0.g.InMeasureBlock.ordinal()] = 1;
                } catch (NoSuchFieldError unused3) {
                }
                try {
                    iArr2[g0.g.InLayoutBlock.ordinal()] = 2;
                } catch (NoSuchFieldError unused4) {
                }
                f23719b = iArr2;
            }
        }

        /* renamed from: j2.l0$b$b, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        static final class C0507b extends kotlin.jvm.internal.v implements dn.a {

            /* JADX INFO: Access modifiers changed from: package-private */
            /* renamed from: j2.l0$b$b$a */
            /* loaded from: classes.dex */
            public static final class a extends kotlin.jvm.internal.v implements dn.l {

                /* renamed from: p, reason: collision with root package name */
                public static final a f23721p = new a();

                a() {
                    super(1);
                }

                public final void a(j2.b bVar) {
                    bVar.h().t(false);
                }

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

            /* JADX INFO: Access modifiers changed from: package-private */
            /* renamed from: j2.l0$b$b$b, reason: collision with other inner class name */
            /* loaded from: classes.dex */
            public static final class C0508b extends kotlin.jvm.internal.v implements dn.l {

                /* renamed from: p, reason: collision with root package name */
                public static final C0508b f23722p = new C0508b();

                C0508b() {
                    super(1);
                }

                public final void a(j2.b bVar) {
                    bVar.h().q(bVar.h().l());
                }

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

            C0507b() {
                super(0);
            }

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

            /* renamed from: invoke, reason: collision with other method in class */
            public final void m277invoke() {
                b.this.v1();
                b.this.C(a.f23721p);
                b.this.I().A1().i();
                b.this.u1();
                b.this.C(C0508b.f23722p);
            }
        }

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

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ l0 f23723p;

            /* renamed from: q, reason: collision with root package name */
            final /* synthetic */ b f23724q;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            c(l0 l0Var, b bVar) {
                super(0);
                this.f23723p = l0Var;
                this.f23724q = bVar;
            }

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

            /* renamed from: invoke, reason: collision with other method in class */
            public final void m278invoke() {
                p0.a placementScope;
                z0 B2 = this.f23723p.K().B2();
                if (B2 == null || (placementScope = B2.E1()) == null) {
                    placementScope = k0.b(this.f23723p.f23674a).getPlacementScope();
                }
                p0.a aVar = placementScope;
                b bVar = this.f23724q;
                l0 l0Var = this.f23723p;
                dn.l lVar = bVar.Q;
                v1.c cVar = bVar.R;
                if (cVar != null) {
                    aVar.x(l0Var.K(), bVar.S, cVar, bVar.T);
                } else if (lVar == null) {
                    aVar.i(l0Var.K(), bVar.S, bVar.T);
                } else {
                    aVar.w(l0Var.K(), bVar.S, bVar.T, lVar);
                }
            }
        }

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

            /* renamed from: p, reason: collision with root package name */
            public static final d f23725p = new d();

            d() {
                super(1);
            }

            public final void a(j2.b bVar) {
                bVar.h().u(false);
            }

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

        public b() {
            n.a aVar = c3.n.f7423b;
            this.B = aVar.a();
            this.F = true;
            this.J = new h0(this);
            this.K = new a1.b(new b[16], 0);
            this.L = true;
            this.N = new C0507b();
            this.S = aVar.a();
            this.U = new c(l0.this, this);
        }

        private final void L1() {
            boolean q10 = q();
            Y1(true);
            g0 g0Var = l0.this.f23674a;
            if (!q10) {
                if (g0Var.e0()) {
                    g0.w1(g0Var, true, false, false, 6, null);
                } else if (g0Var.Z()) {
                    g0.s1(g0Var, true, false, false, 6, null);
                }
            }
            z0 A2 = g0Var.P().A2();
            for (z0 m02 = g0Var.m0(); !kotlin.jvm.internal.t.b(m02, A2) && m02 != null; m02 = m02.A2()) {
                if (m02.s2()) {
                    m02.K2();
                }
            }
            a1.b w02 = g0Var.w0();
            int q11 = w02.q();
            if (q11 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    g0 g0Var2 = (g0) p10[i10];
                    if (g0Var2.p0() != Integer.MAX_VALUE) {
                        g0Var2.d0().L1();
                        g0Var.x1(g0Var2);
                    }
                    i10++;
                } while (i10 < q11);
            }
        }

        private final void M1() {
            if (q()) {
                int i10 = 0;
                Y1(false);
                g0 g0Var = l0.this.f23674a;
                z0 A2 = g0Var.P().A2();
                for (z0 m02 = g0Var.m0(); !kotlin.jvm.internal.t.b(m02, A2) && m02 != null; m02 = m02.A2()) {
                    m02.a3();
                }
                a1.b w02 = l0.this.f23674a.w0();
                int q10 = w02.q();
                if (q10 > 0) {
                    Object[] p10 = w02.p();
                    do {
                        ((g0) p10[i10]).d0().M1();
                        i10++;
                    } while (i10 < q10);
                }
            }
        }

        private final void O1() {
            g0 g0Var = l0.this.f23674a;
            l0 l0Var = l0.this;
            a1.b w02 = g0Var.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    g0 g0Var2 = (g0) p10[i10];
                    if (g0Var2.e0() && g0Var2.g0() == g0.g.InMeasureBlock && g0.l1(g0Var2, null, 1, null)) {
                        g0.w1(l0Var.f23674a, false, false, false, 7, null);
                    }
                    i10++;
                } while (i10 < q10);
            }
        }

        private final void P1() {
            g0.w1(l0.this.f23674a, false, false, false, 7, null);
            g0 o02 = l0.this.f23674a.o0();
            if (o02 == null || l0.this.f23674a.T() != g0.g.NotUsed) {
                return;
            }
            g0 g0Var = l0.this.f23674a;
            int i10 = a.f23718a[o02.X().ordinal()];
            g0Var.D1(i10 != 1 ? i10 != 2 ? o02.T() : g0.g.InLayoutBlock : g0.g.InMeasureBlock);
        }

        private final void S1(long j10, float f10, dn.l lVar, v1.c cVar) {
            if (!(!l0.this.f23674a.L0())) {
                g2.a.a("place is called on a deactivated node");
            }
            l0.this.f23676c = g0.e.LayingOut;
            this.B = j10;
            this.E = f10;
            this.C = lVar;
            this.D = cVar;
            this.f23716y = true;
            this.P = false;
            j1 b10 = k0.b(l0.this.f23674a);
            if (l0.this.A() || !q()) {
                h().r(false);
                l0.this.Y(false);
                this.Q = lVar;
                this.S = j10;
                this.T = f10;
                this.R = cVar;
                b10.getSnapshotObserver().c(l0.this.f23674a, false, this.U);
            } else {
                l0.this.K().X2(j10, f10, lVar, cVar);
                R1();
            }
            l0.this.f23676c = g0.e.Idle;
        }

        private final void T1(long j10, float f10, dn.l lVar, v1.c cVar) {
            p0.a placementScope;
            this.I = true;
            boolean z10 = false;
            if (!c3.n.g(j10, this.B) || this.V) {
                if (l0.this.u() || l0.this.v() || this.V) {
                    l0.this.f23678e = true;
                    this.V = false;
                }
                N1();
            }
            if (m0.a(l0.this.f23674a)) {
                z0 B2 = l0.this.K().B2();
                if (B2 == null || (placementScope = B2.E1()) == null) {
                    placementScope = k0.b(l0.this.f23674a).getPlacementScope();
                }
                p0.a aVar = placementScope;
                l0 l0Var = l0.this;
                a H = l0Var.H();
                kotlin.jvm.internal.t.d(H);
                g0 o02 = l0Var.f23674a.o0();
                if (o02 != null) {
                    o02.U().f23683j = 0;
                }
                H.R1(Api.BaseClientBuilder.API_PRIORITY_OTHER);
                p0.a.h(aVar, H, c3.n.h(j10), c3.n.i(j10), BitmapDescriptorFactory.HUE_RED, 4, null);
            }
            a H2 = l0.this.H();
            if (H2 != null && !H2.A1()) {
                z10 = true;
            }
            if (!(true ^ z10)) {
                g2.a.b("Error: Placement happened before lookahead.");
            }
            S1(j10, f10, lVar, cVar);
        }

        private final void Z1(g0 g0Var) {
            g0.g gVar;
            g0 o02 = g0Var.o0();
            if (o02 == null) {
                this.f23717z = g0.g.NotUsed;
                return;
            }
            if (!(this.f23717z == g0.g.NotUsed || g0Var.E())) {
                g2.a.b("measure() may not be called multiple times on the same Measurable. If you want to get the content size of the Measurable before calculating the final constraints, please use methods like minIntrinsicWidth()/maxIntrinsicWidth() and minIntrinsicHeight()/maxIntrinsicHeight()");
            }
            int i10 = a.f23718a[o02.X().ordinal()];
            if (i10 == 1) {
                gVar = g0.g.InMeasureBlock;
            } else {
                if (i10 != 2) {
                    throw new IllegalStateException("Measurable could be only measured from the parent's measure or layout block. Parents state is " + o02.X());
                }
                gVar = g0.g.InLayoutBlock;
            }
            this.f23717z = gVar;
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final void u1() {
            g0 g0Var = l0.this.f23674a;
            a1.b w02 = g0Var.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    g0 g0Var2 = (g0) p10[i10];
                    if (g0Var2.d0().f23713v != g0Var2.p0()) {
                        g0Var.h1();
                        g0Var.D0();
                        if (g0Var2.p0() == Integer.MAX_VALUE) {
                            g0Var2.d0().M1();
                        }
                    }
                    i10++;
                } while (i10 < q10);
            }
        }

        /* JADX INFO: Access modifiers changed from: private */
        public final void v1() {
            l0.this.f23684k = 0;
            a1.b w02 = l0.this.f23674a.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    b d02 = ((g0) p10[i10]).d0();
                    d02.f23713v = d02.f23714w;
                    d02.f23714w = Api.BaseClientBuilder.API_PRIORITY_OTHER;
                    d02.I = false;
                    if (d02.f23717z == g0.g.InLayoutBlock) {
                        d02.f23717z = g0.g.NotUsed;
                    }
                    i10++;
                } while (i10 < q10);
            }
        }

        public final c3.b A1() {
            if (this.f23715x) {
                return c3.b.a(P0());
            }
            return null;
        }

        @Override // j2.b
        public void C(dn.l lVar) {
            a1.b w02 = l0.this.f23674a.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    lVar.invoke(((g0) p10[i10]).U().r());
                    i10++;
                } while (i10 < q10);
            }
        }

        public final boolean D1() {
            return this.M;
        }

        public final g0.g E1() {
            return this.f23717z;
        }

        public final int F1() {
            return this.f23714w;
        }

        public final float G1() {
            return this.O;
        }

        public final void H1(boolean z10) {
            g0 g0Var;
            g0 o02 = l0.this.f23674a.o0();
            g0.g T = l0.this.f23674a.T();
            if (o02 == null || T == g0.g.NotUsed) {
                return;
            }
            do {
                g0Var = o02;
                if (g0Var.T() != T) {
                    break;
                } else {
                    o02 = g0Var.o0();
                }
            } while (o02 != null);
            int i10 = a.f23719b[T.ordinal()];
            if (i10 == 1) {
                g0.w1(g0Var, z10, false, false, 6, null);
            } else {
                if (i10 != 2) {
                    throw new IllegalStateException("Intrinsics isn't used by the parent".toString());
                }
                g0Var.t1(z10);
            }
        }

        @Override // j2.b
        public z0 I() {
            return l0.this.f23674a.P();
        }

        public final void I1() {
            this.F = true;
        }

        public final boolean J1() {
            return this.I;
        }

        public final void K1() {
            l0.this.f23675b = true;
        }

        @Override // j2.b
        public j2.b M() {
            l0 U;
            g0 o02 = l0.this.f23674a.o0();
            if (o02 == null || (U = o02.U()) == null) {
                return null;
            }
            return U.r();
        }

        public final void N1() {
            a1.b w02;
            int q10;
            if (l0.this.s() <= 0 || (q10 = (w02 = l0.this.f23674a.w0()).q()) <= 0) {
                return;
            }
            Object[] p10 = w02.p();
            int i10 = 0;
            do {
                g0 g0Var = (g0) p10[i10];
                l0 U = g0Var.U();
                if ((U.v() || U.u()) && !U.A()) {
                    g0.u1(g0Var, false, 1, null);
                }
                U.I().N1();
                i10++;
            } while (i10 < q10);
        }

        public final void Q1() {
            this.f23714w = Api.BaseClientBuilder.API_PRIORITY_OTHER;
            this.f23713v = Api.BaseClientBuilder.API_PRIORITY_OTHER;
            Y1(false);
        }

        public final void R1() {
            this.P = true;
            g0 o02 = l0.this.f23674a.o0();
            float C2 = I().C2();
            g0 g0Var = l0.this.f23674a;
            z0 m02 = g0Var.m0();
            z0 P = g0Var.P();
            while (m02 != P) {
                kotlin.jvm.internal.t.e(m02, "null cannot be cast to non-null type androidx.compose.ui.node.LayoutModifierNodeCoordinator");
                c0 c0Var = (c0) m02;
                C2 += c0Var.C2();
                m02 = c0Var.A2();
            }
            if (!(C2 == this.O)) {
                this.O = C2;
                if (o02 != null) {
                    o02.h1();
                }
                if (o02 != null) {
                    o02.D0();
                }
            }
            if (!q()) {
                if (o02 != null) {
                    o02.D0();
                }
                L1();
                if (this.f23712u && o02 != null) {
                    g0.u1(o02, false, 1, null);
                }
            }
            if (o02 == null) {
                this.f23714w = 0;
            } else if (!this.f23712u && o02.X() == g0.e.LayingOut) {
                if (!(this.f23714w == Integer.MAX_VALUE)) {
                    g2.a.b("Place was called on a node which was placed already");
                }
                this.f23714w = o02.U().f23684k;
                o02.U().f23684k++;
            }
            n0();
        }

        @Override // h2.n
        public int T(int i10) {
            P1();
            return l0.this.K().T(i10);
        }

        public final boolean U1(long j10) {
            boolean z10 = true;
            if (!(!l0.this.f23674a.L0())) {
                g2.a.a("measure is called on a deactivated node");
            }
            j1 b10 = k0.b(l0.this.f23674a);
            g0 o02 = l0.this.f23674a.o0();
            l0.this.f23674a.A1(l0.this.f23674a.E() || (o02 != null && o02.E()));
            if (!l0.this.f23674a.e0() && c3.b.f(P0(), j10)) {
                j1.j(b10, l0.this.f23674a, false, 2, null);
                l0.this.f23674a.z1();
                return false;
            }
            h().s(false);
            C(d.f23725p);
            this.f23715x = true;
            long g10 = l0.this.K().g();
            d1(j10);
            l0.this.U(j10);
            if (c3.r.e(l0.this.K().g(), g10) && l0.this.K().S0() == S0() && l0.this.K().F0() == F0()) {
                z10 = false;
            }
            c1(c3.s.a(l0.this.K().S0(), l0.this.K().F0()));
            return z10;
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // h2.p0
        public void V0(long j10, float f10, dn.l lVar) {
            T1(j10, f10, lVar, null);
        }

        public final void V1() {
            g0 o02;
            try {
                this.f23712u = true;
                if (!this.f23716y) {
                    g2.a.b("replace called on unplaced item");
                }
                boolean q10 = q();
                S1(this.B, this.E, this.C, this.D);
                if (q10 && !this.P && (o02 = l0.this.f23674a.o0()) != null) {
                    g0.u1(o02, false, 1, null);
                }
            } finally {
                this.f23712u = false;
            }
        }

        public final void W1(boolean z10) {
            this.L = z10;
        }

        @Override // h2.n
        public int X(int i10) {
            P1();
            return l0.this.K().X(i10);
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // h2.p0
        public void X0(long j10, float f10, v1.c cVar) {
            T1(j10, f10, null, cVar);
        }

        public final void X1(g0.g gVar) {
            this.f23717z = gVar;
        }

        @Override // h2.d0
        public h2.p0 Y(long j10) {
            g0.g T = l0.this.f23674a.T();
            g0.g gVar = g0.g.NotUsed;
            if (T == gVar) {
                l0.this.f23674a.v();
            }
            if (m0.a(l0.this.f23674a)) {
                a H = l0.this.H();
                kotlin.jvm.internal.t.d(H);
                H.Q1(gVar);
                H.Y(j10);
            }
            Z1(l0.this.f23674a);
            U1(j10);
            return this;
        }

        public void Y1(boolean z10) {
            this.H = z10;
        }

        public final boolean a2() {
            if ((p() == null && l0.this.K().p() == null) || !this.F) {
                return false;
            }
            this.F = false;
            this.G = l0.this.K().p();
            return true;
        }

        @Override // j2.b
        public j2.a h() {
            return this.J;
        }

        @Override // j2.b
        public void n0() {
            this.M = true;
            h().o();
            if (l0.this.A()) {
                O1();
            }
            if (l0.this.f23679f || (!this.A && !I().K1() && l0.this.A())) {
                l0.this.f23678e = false;
                g0.e B = l0.this.B();
                l0.this.f23676c = g0.e.LayingOut;
                l0.this.Z(false);
                g0 g0Var = l0.this.f23674a;
                k0.b(g0Var).getSnapshotObserver().e(g0Var, false, this.N);
                l0.this.f23676c = B;
                if (I().K1() && l0.this.v()) {
                    requestLayout();
                }
                l0.this.f23679f = false;
            }
            if (h().l()) {
                h().q(true);
            }
            if (h().g() && h().k()) {
                h().n();
            }
            this.M = false;
        }

        @Override // h2.h0, h2.n
        public Object p() {
            return this.G;
        }

        @Override // j2.b
        public boolean q() {
            return this.H;
        }

        @Override // j2.t0
        public void q0(boolean z10) {
            boolean J1 = l0.this.K().J1();
            if (z10 != J1) {
                l0.this.K().q0(J1);
                this.V = true;
            }
            this.W = z10;
        }

        @Override // j2.b
        public void requestLayout() {
            g0.u1(l0.this.f23674a, false, 1, null);
        }

        @Override // h2.n
        public int s(int i10) {
            P1();
            return l0.this.K().s(i10);
        }

        @Override // j2.b
        public void s0() {
            g0.w1(l0.this.f23674a, false, false, false, 7, null);
        }

        @Override // h2.h0
        public int u0(h2.a aVar) {
            g0 o02 = l0.this.f23674a.o0();
            if ((o02 != null ? o02.X() : null) == g0.e.Measuring) {
                h().u(true);
            } else {
                g0 o03 = l0.this.f23674a.o0();
                if ((o03 != null ? o03.X() : null) == g0.e.LayingOut) {
                    h().t(true);
                }
            }
            this.A = true;
            int u02 = l0.this.K().u0(aVar);
            this.A = false;
            return u02;
        }

        @Override // h2.n
        public int v0(int i10) {
            P1();
            return l0.this.K().v0(i10);
        }

        public final List w1() {
            l0.this.f23674a.K1();
            if (!this.L) {
                return this.K.j();
            }
            g0 g0Var = l0.this.f23674a;
            a1.b bVar = this.K;
            a1.b w02 = g0Var.w0();
            int q10 = w02.q();
            if (q10 > 0) {
                Object[] p10 = w02.p();
                int i10 = 0;
                do {
                    g0 g0Var2 = (g0) p10[i10];
                    if (bVar.q() <= i10) {
                        bVar.c(g0Var2.U().I());
                    } else {
                        bVar.D(i10, g0Var2.U().I());
                    }
                    i10++;
                } while (i10 < q10);
            }
            bVar.B(g0Var.H().size(), bVar.q());
            this.L = false;
            return this.K.j();
        }

        @Override // j2.b
        public Map x() {
            if (!this.A) {
                if (l0.this.B() == g0.e.Measuring) {
                    h().s(true);
                    if (h().g()) {
                        l0.this.O();
                    }
                } else {
                    h().r(true);
                }
            }
            I().O1(true);
            n0();
            I().O1(false);
            return h().h();
        }
    }

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

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ long f23727q;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        c(long j10) {
            super(0);
            this.f23727q = j10;
        }

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

        /* renamed from: invoke, reason: collision with other method in class */
        public final void m279invoke() {
            q0 v22 = l0.this.K().v2();
            kotlin.jvm.internal.t.d(v22);
            v22.Y(this.f23727q);
        }
    }

    /* loaded from: classes.dex */
    static final class d extends kotlin.jvm.internal.v implements dn.a {
        d() {
            super(0);
        }

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

        /* renamed from: invoke, reason: collision with other method in class */
        public final void m280invoke() {
            l0.this.K().Y(l0.this.f23693t);
        }
    }

    public l0(g0 g0Var) {
        this.f23674a = g0Var;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void T(long j10) {
        this.f23676c = g0.e.LookaheadMeasuring;
        this.f23680g = false;
        l1.h(k0.b(this.f23674a).getSnapshotObserver(), this.f23674a, false, new c(j10), 2, null);
        P();
        if (m0.a(this.f23674a)) {
            O();
        } else {
            R();
        }
        this.f23676c = g0.e.Idle;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void U(long j10) {
        g0.e eVar = this.f23676c;
        g0.e eVar2 = g0.e.Idle;
        if (!(eVar == eVar2)) {
            g2.a.b("layout state is not idle before measure starts");
        }
        g0.e eVar3 = g0.e.Measuring;
        this.f23676c = eVar3;
        this.f23677d = false;
        this.f23693t = j10;
        k0.b(this.f23674a).getSnapshotObserver().g(this.f23674a, false, this.f23694u);
        if (this.f23676c == eVar3) {
            O();
            this.f23676c = eVar2;
        }
    }

    public final boolean A() {
        return this.f23678e;
    }

    public final g0.e B() {
        return this.f23676c;
    }

    public final j2.b C() {
        return this.f23692s;
    }

    public final boolean D() {
        return this.f23689p;
    }

    public final boolean E() {
        return this.f23688o;
    }

    public final boolean F() {
        return this.f23681h;
    }

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

    public final a H() {
        return this.f23692s;
    }

    public final b I() {
        return this.f23691r;
    }

    public final boolean J() {
        return this.f23677d;
    }

    public final z0 K() {
        return this.f23674a.k0().n();
    }

    public final int L() {
        return this.f23691r.S0();
    }

    public final void M() {
        this.f23691r.I1();
        a aVar = this.f23692s;
        if (aVar != null) {
            aVar.E1();
        }
    }

    public final void N() {
        this.f23691r.W1(true);
        a aVar = this.f23692s;
        if (aVar != null) {
            aVar.P1(true);
        }
    }

    public final void O() {
        this.f23678e = true;
        this.f23679f = true;
    }

    public final void P() {
        this.f23681h = true;
        this.f23682i = true;
    }

    public final void Q() {
        this.f23680g = true;
    }

    public final void R() {
        this.f23677d = true;
    }

    public final void S() {
        g0.e X = this.f23674a.X();
        if (X == g0.e.LayingOut || X == g0.e.LookaheadLayingOut) {
            if (this.f23691r.D1()) {
                Z(true);
            } else {
                Y(true);
            }
        }
        if (X == g0.e.LookaheadLayingOut) {
            a aVar = this.f23692s;
            boolean z10 = false;
            if (aVar != null && aVar.u1()) {
                z10 = true;
            }
            if (z10) {
                b0(true);
            } else {
                a0(true);
            }
        }
    }

    public final void V() {
        j2.a h10;
        this.f23691r.h().p();
        a aVar = this.f23692s;
        if (aVar == null || (h10 = aVar.h()) == null) {
            return;
        }
        h10.p();
    }

    public final void W(int i10) {
        int i11 = this.f23687n;
        this.f23687n = i10;
        if ((i11 == 0) != (i10 == 0)) {
            g0 o02 = this.f23674a.o0();
            l0 U = o02 != null ? o02.U() : null;
            if (U != null) {
                if (i10 == 0) {
                    U.W(U.f23687n - 1);
                } else {
                    U.W(U.f23687n + 1);
                }
            }
        }
    }

    public final void X(int i10) {
        int i11 = this.f23690q;
        this.f23690q = i10;
        if ((i11 == 0) != (i10 == 0)) {
            g0 o02 = this.f23674a.o0();
            l0 U = o02 != null ? o02.U() : null;
            if (U != null) {
                if (i10 == 0) {
                    U.X(U.f23690q - 1);
                } else {
                    U.X(U.f23690q + 1);
                }
            }
        }
    }

    public final void Y(boolean z10) {
        if (this.f23686m != z10) {
            this.f23686m = z10;
            if (z10 && !this.f23685l) {
                W(this.f23687n + 1);
            } else {
                if (z10 || this.f23685l) {
                    return;
                }
                W(this.f23687n - 1);
            }
        }
    }

    public final void Z(boolean z10) {
        if (this.f23685l != z10) {
            this.f23685l = z10;
            if (z10 && !this.f23686m) {
                W(this.f23687n + 1);
            } else {
                if (z10 || this.f23686m) {
                    return;
                }
                W(this.f23687n - 1);
            }
        }
    }

    public final void a0(boolean z10) {
        if (this.f23689p != z10) {
            this.f23689p = z10;
            if (z10 && !this.f23688o) {
                X(this.f23690q + 1);
            } else {
                if (z10 || this.f23688o) {
                    return;
                }
                X(this.f23690q - 1);
            }
        }
    }

    public final void b0(boolean z10) {
        if (this.f23688o != z10) {
            this.f23688o = z10;
            if (z10 && !this.f23689p) {
                X(this.f23690q + 1);
            } else {
                if (z10 || this.f23689p) {
                    return;
                }
                X(this.f23690q - 1);
            }
        }
    }

    public final void c0() {
        g0 o02;
        if (this.f23691r.a2() && (o02 = this.f23674a.o0()) != null) {
            g0.w1(o02, false, false, false, 7, null);
        }
        a aVar = this.f23692s;
        boolean z10 = false;
        if (aVar != null && aVar.U1()) {
            z10 = true;
        }
        if (z10) {
            if (m0.a(this.f23674a)) {
                g0 o03 = this.f23674a.o0();
                if (o03 != null) {
                    g0.w1(o03, false, false, false, 7, null);
                    return;
                }
                return;
            }
            g0 o04 = this.f23674a.o0();
            if (o04 != null) {
                g0.s1(o04, false, false, false, 7, null);
            }
        }
    }

    public final void q() {
        if (this.f23692s == null) {
            this.f23692s = new a();
        }
    }

    public final j2.b r() {
        return this.f23691r;
    }

    public final int s() {
        return this.f23687n;
    }

    public final int t() {
        return this.f23690q;
    }

    public final boolean u() {
        return this.f23686m;
    }

    public final boolean v() {
        return this.f23685l;
    }

    public final boolean w() {
        return this.f23675b;
    }

    public final int x() {
        return this.f23691r.F0();
    }

    public final c3.b y() {
        return this.f23691r.A1();
    }

    public final c3.b z() {
        a aVar = this.f23692s;
        if (aVar != null) {
            return aVar.r1();
        }
        return null;
    }
}
