package androidx.compose.foundation.layout;

import h2.d0;
import h2.e0;
import h2.f0;
import h2.g0;
import h2.p0;
import java.util.List;
import kotlin.jvm.internal.m0;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import rm.n0;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class c implements e0 {

    /* renamed from: a, reason: collision with root package name */
    private final l1.c f1813a;

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

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

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

        a() {
            super(1);
        }

        public final void a(p0.a aVar) {
        }

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

    /* loaded from: classes.dex */
    static final class b extends v implements dn.l {

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

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

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

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ int f1819s;

        /* renamed from: t, reason: collision with root package name */
        final /* synthetic */ int f1820t;

        /* renamed from: u, reason: collision with root package name */
        final /* synthetic */ c f1821u;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(p0 p0Var, d0 d0Var, g0 g0Var, int i10, int i11, c cVar) {
            super(1);
            this.f1816p = p0Var;
            this.f1817q = d0Var;
            this.f1818r = g0Var;
            this.f1819s = i10;
            this.f1820t = i11;
            this.f1821u = cVar;
        }

        public final void a(p0.a aVar) {
            androidx.compose.foundation.layout.b.i(aVar, this.f1816p, this.f1817q, this.f1818r.getLayoutDirection(), this.f1819s, this.f1820t, this.f1821u.f1813a);
        }

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

    /* renamed from: androidx.compose.foundation.layout.c$c, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    static final class C0050c extends v implements dn.l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ p0[] f1822p;

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

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

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ m0 f1825s;

        /* renamed from: t, reason: collision with root package name */
        final /* synthetic */ m0 f1826t;

        /* renamed from: u, reason: collision with root package name */
        final /* synthetic */ c f1827u;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C0050c(p0[] p0VarArr, List list, g0 g0Var, m0 m0Var, m0 m0Var2, c cVar) {
            super(1);
            this.f1822p = p0VarArr;
            this.f1823q = list;
            this.f1824r = g0Var;
            this.f1825s = m0Var;
            this.f1826t = m0Var2;
            this.f1827u = cVar;
        }

        public final void a(p0.a aVar) {
            p0[] p0VarArr = this.f1822p;
            List list = this.f1823q;
            g0 g0Var = this.f1824r;
            m0 m0Var = this.f1825s;
            m0 m0Var2 = this.f1826t;
            c cVar = this.f1827u;
            int length = p0VarArr.length;
            int i10 = 0;
            int i11 = 0;
            while (i10 < length) {
                p0 p0Var = p0VarArr[i10];
                t.e(p0Var, "null cannot be cast to non-null type androidx.compose.ui.layout.Placeable");
                androidx.compose.foundation.layout.b.i(aVar, p0Var, (d0) list.get(i11), g0Var.getLayoutDirection(), m0Var.f26197p, m0Var2.f26197p, cVar.f1813a);
                i10++;
                i11++;
            }
        }

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

    public c(l1.c cVar, boolean z10) {
        this.f1813a = cVar;
        this.f1814b = z10;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof c)) {
            return false;
        }
        c cVar = (c) obj;
        return t.b(this.f1813a, cVar.f1813a) && this.f1814b == cVar.f1814b;
    }

    @Override // h2.e0
    public f0 f(g0 g0Var, List list, long j10) {
        boolean g10;
        boolean g11;
        boolean g12;
        int n10;
        int m10;
        p0 Y;
        if (list.isEmpty()) {
            return g0.j0(g0Var, c3.b.n(j10), c3.b.m(j10), null, a.f1815p, 4, null);
        }
        long d10 = this.f1814b ? j10 : c3.b.d(j10, 0, 0, 0, 0, 10, null);
        if (list.size() == 1) {
            d0 d0Var = (d0) list.get(0);
            g12 = androidx.compose.foundation.layout.b.g(d0Var);
            if (g12) {
                n10 = c3.b.n(j10);
                m10 = c3.b.m(j10);
                Y = d0Var.Y(c3.b.f7403b.c(c3.b.n(j10), c3.b.m(j10)));
            } else {
                Y = d0Var.Y(d10);
                n10 = Math.max(c3.b.n(j10), Y.S0());
                m10 = Math.max(c3.b.m(j10), Y.F0());
            }
            int i10 = m10;
            p0 p0Var = Y;
            int i11 = n10;
            return g0.j0(g0Var, i11, i10, null, new b(p0Var, d0Var, g0Var, i11, i10, this), 4, null);
        }
        p0[] p0VarArr = new p0[list.size()];
        m0 m0Var = new m0();
        m0Var.f26197p = c3.b.n(j10);
        m0 m0Var2 = new m0();
        m0Var2.f26197p = c3.b.m(j10);
        int size = list.size();
        boolean z10 = false;
        for (int i12 = 0; i12 < size; i12++) {
            d0 d0Var2 = (d0) list.get(i12);
            g11 = androidx.compose.foundation.layout.b.g(d0Var2);
            if (g11) {
                z10 = true;
            } else {
                p0 Y2 = d0Var2.Y(d10);
                p0VarArr[i12] = Y2;
                m0Var.f26197p = Math.max(m0Var.f26197p, Y2.S0());
                m0Var2.f26197p = Math.max(m0Var2.f26197p, Y2.F0());
            }
        }
        if (z10) {
            int i13 = m0Var.f26197p;
            int i14 = i13 != Integer.MAX_VALUE ? i13 : 0;
            int i15 = m0Var2.f26197p;
            long a10 = c3.c.a(i14, i13, i15 != Integer.MAX_VALUE ? i15 : 0, i15);
            int size2 = list.size();
            for (int i16 = 0; i16 < size2; i16++) {
                d0 d0Var3 = (d0) list.get(i16);
                g10 = androidx.compose.foundation.layout.b.g(d0Var3);
                if (g10) {
                    p0VarArr[i16] = d0Var3.Y(a10);
                }
            }
        }
        return g0.j0(g0Var, m0Var.f26197p, m0Var2.f26197p, null, new C0050c(p0VarArr, list, g0Var, m0Var, m0Var2, this), 4, null);
    }

    public int hashCode() {
        return (this.f1813a.hashCode() * 31) + Boolean.hashCode(this.f1814b);
    }

    public String toString() {
        return "BoxMeasurePolicy(alignment=" + this.f1813a + ", propagateMinConstraints=" + this.f1814b + ')';
    }
}
