package o;

import com.google.android.gms.common.api.Api;
import java.util.List;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Wi, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0579Wi implements InterfaceC2235qO, InterfaceC2777w30 {
    public final InterfaceC0885c9 a;
    public final C0107Ed b;

    public C0579Wi(InterfaceC0885c9 interfaceC0885c9, C0107Ed c0107Ed) {
        this.a = interfaceC0885c9;
        this.b = c0107Ed;
    }

    @Override // o.InterfaceC2235qO
    public final InterfaceC2329rO a(InterfaceC2424sO interfaceC2424sO, List list, long j) {
        return AbstractC1692kh0.G(this, C0634Yl.i(j), C0634Yl.j(j), C0634Yl.g(j), C0634Yl.h(j), interfaceC2424sO.N(this.a.a()), interfaceC2424sO, list, new VW[list.size()], list.size());
    }

    @Override // o.InterfaceC2777w30
    public final int b(VW vw) {
        return vw.l;
    }

    @Override // o.InterfaceC2235qO
    public final int c(InterfaceC2608uI interfaceC2608uI, List list, int i) {
        int iN = interfaceC2608uI.N(this.a.a());
        if (list.isEmpty()) {
            return 0;
        }
        int size = list.size();
        int iMax = 0;
        int i2 = 0;
        float f = 0.0f;
        for (int i3 = 0; i3 < size; i3++) {
            InterfaceC1760lO interfaceC1760lO = (InterfaceC1760lO) list.get(i3);
            float fC = C80.C(C80.z(interfaceC1760lO));
            int iD = interfaceC1760lO.d(i);
            if (fC == 0.0f) {
                i2 += iD;
            } else if (fC > 0.0f) {
                f += fC;
                iMax = Math.max(iMax, Math.round(iD / fC));
            }
        }
        return ((list.size() - 1) * iN) + Math.round(iMax * f) + i2;
    }

    @Override // o.InterfaceC2777w30
    public final long d(int i, int i2, int i3, boolean z) {
        return !z ? AbstractC0842bm.a(0, i3, i, i2) : Co0.s(0, i3, i, i2);
    }

    @Override // o.InterfaceC2777w30
    public final InterfaceC2329rO e(final VW[] vwArr, final InterfaceC2424sO interfaceC2424sO, final int[] iArr, int i, final int i2) {
        return interfaceC2424sO.H(i2, i, C0358Nv.l, new OC() { // from class: o.Vi
            @Override // o.OC
            public final Object g(Object obj) {
                UW uw = (UW) obj;
                VW[] vwArr2 = vwArr;
                int length = vwArr2.length;
                int i3 = 0;
                int i4 = 0;
                while (i3 < length) {
                    VW vw = vwArr2[i3];
                    int i5 = i4 + 1;
                    Object objK = vw.k();
                    C2872x30 c2872x30 = objK instanceof C2872x30 ? (C2872x30) objK : null;
                    EnumC1280gK layoutDirection = interfaceC2424sO.getLayoutDirection();
                    C0144Fo c0144Fo = c2872x30 != null ? c2872x30.c : null;
                    int i6 = i2;
                    UW.g(uw, vw, c0144Fo != null ? c0144Fo.a(i6 - vw.l, layoutDirection) : this.b.a(0, i6 - vw.l, layoutDirection), iArr[i4]);
                    i3++;
                    i4 = i5;
                }
                return Oh0.a;
            }
        });
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof C0579Wi)) {
            return false;
        }
        C0579Wi c0579Wi = (C0579Wi) obj;
        return F3.c(this.a, c0579Wi.a) && this.b.equals(c0579Wi.b);
    }

    @Override // o.InterfaceC2777w30
    public final int f(VW vw) {
        return vw.m;
    }

    @Override // o.InterfaceC2235qO
    public final int g(InterfaceC2608uI interfaceC2608uI, List list, int i) {
        int iN = interfaceC2608uI.N(this.a.a());
        if (list.isEmpty()) {
            return 0;
        }
        int size = list.size();
        int iMax = 0;
        int i2 = 0;
        float f = 0.0f;
        for (int i3 = 0; i3 < size; i3++) {
            InterfaceC1760lO interfaceC1760lO = (InterfaceC1760lO) list.get(i3);
            float fC = C80.C(C80.z(interfaceC1760lO));
            int iV = interfaceC1760lO.V(i);
            if (fC == 0.0f) {
                i2 += iV;
            } else if (fC > 0.0f) {
                f += fC;
                iMax = Math.max(iMax, Math.round(iV / fC));
            }
        }
        return ((list.size() - 1) * iN) + Math.round(iMax * f) + i2;
    }

    @Override // o.InterfaceC2777w30
    public final void h(int i, InterfaceC2424sO interfaceC2424sO, int[] iArr, int[] iArr2) {
        this.a.b(i, interfaceC2424sO, iArr, iArr2);
    }

    public final int hashCode() {
        return Float.hashCode(this.b.a) + (this.a.hashCode() * 31);
    }

    @Override // o.InterfaceC2235qO
    public final int i(InterfaceC2608uI interfaceC2608uI, List list, int i) {
        int iN = interfaceC2608uI.N(this.a.a());
        if (list.isEmpty()) {
            return 0;
        }
        int iMin = Math.min((list.size() - 1) * iN, i);
        int size = list.size();
        int iMax = 0;
        float f = 0.0f;
        for (int i2 = 0; i2 < size; i2++) {
            InterfaceC1760lO interfaceC1760lO = (InterfaceC1760lO) list.get(i2);
            float fC = C80.C(C80.z(interfaceC1760lO));
            if (fC == 0.0f) {
                int iMin2 = Math.min(interfaceC1760lO.d(Api.BaseClientBuilder.API_PRIORITY_OTHER), i == Integer.MAX_VALUE ? Integer.MAX_VALUE : i - iMin);
                iMin += iMin2;
                iMax = Math.max(iMax, interfaceC1760lO.O(iMin2));
            } else if (fC > 0.0f) {
                f += fC;
            }
        }
        int iRound = f == 0.0f ? 0 : i == Integer.MAX_VALUE ? Integer.MAX_VALUE : Math.round(Math.max(i - iMin, 0) / f);
        int size2 = list.size();
        for (int i3 = 0; i3 < size2; i3++) {
            InterfaceC1760lO interfaceC1760lO2 = (InterfaceC1760lO) list.get(i3);
            float fC2 = C80.C(C80.z(interfaceC1760lO2));
            if (fC2 > 0.0f) {
                iMax = Math.max(iMax, interfaceC1760lO2.O(iRound != Integer.MAX_VALUE ? Math.round(iRound * fC2) : Integer.MAX_VALUE));
            }
        }
        return iMax;
    }

    @Override // o.InterfaceC2235qO
    public final int j(InterfaceC2608uI interfaceC2608uI, List list, int i) {
        int iN = interfaceC2608uI.N(this.a.a());
        if (list.isEmpty()) {
            return 0;
        }
        int iMin = Math.min((list.size() - 1) * iN, i);
        int size = list.size();
        int iMax = 0;
        float f = 0.0f;
        for (int i2 = 0; i2 < size; i2++) {
            InterfaceC1760lO interfaceC1760lO = (InterfaceC1760lO) list.get(i2);
            float fC = C80.C(C80.z(interfaceC1760lO));
            if (fC == 0.0f) {
                int iMin2 = Math.min(interfaceC1760lO.d(Api.BaseClientBuilder.API_PRIORITY_OTHER), i == Integer.MAX_VALUE ? Integer.MAX_VALUE : i - iMin);
                iMin += iMin2;
                iMax = Math.max(iMax, interfaceC1760lO.U(iMin2));
            } else if (fC > 0.0f) {
                f += fC;
            }
        }
        int iRound = f == 0.0f ? 0 : i == Integer.MAX_VALUE ? Integer.MAX_VALUE : Math.round(Math.max(i - iMin, 0) / f);
        int size2 = list.size();
        for (int i3 = 0; i3 < size2; i3++) {
            InterfaceC1760lO interfaceC1760lO2 = (InterfaceC1760lO) list.get(i3);
            float fC2 = C80.C(C80.z(interfaceC1760lO2));
            if (fC2 > 0.0f) {
                iMax = Math.max(iMax, interfaceC1760lO2.U(iRound != Integer.MAX_VALUE ? Math.round(iRound * fC2) : Integer.MAX_VALUE));
            }
        }
        return iMax;
    }

    public final String toString() {
        return "ColumnMeasurePolicy(verticalArrangement=" + this.a + ", horizontalAlignment=" + this.b + ')';
    }
}
