package h0;

import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import h2.p0;
import java.util.List;
import l1.c;

/* loaded from: classes.dex */
public final class e implements f {

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

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

    /* renamed from: c, reason: collision with root package name */
    private final List f20520c;

    /* renamed from: d, reason: collision with root package name */
    private final long f20521d;

    /* renamed from: e, reason: collision with root package name */
    private final Object f20522e;

    /* renamed from: f, reason: collision with root package name */
    private final c.b f20523f;

    /* renamed from: g, reason: collision with root package name */
    private final c.InterfaceC0608c f20524g;

    /* renamed from: h, reason: collision with root package name */
    private final c3.t f20525h;

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

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

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

    /* renamed from: l, reason: collision with root package name */
    private final int[] f20529l;

    /* renamed from: m, reason: collision with root package name */
    private int f20530m;

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

    public /* synthetic */ e(int i10, int i11, List list, long j10, Object obj, b0.q qVar, c.b bVar, c.InterfaceC0608c interfaceC0608c, c3.t tVar, boolean z10, kotlin.jvm.internal.k kVar) {
        this(i10, i11, list, j10, obj, qVar, bVar, interfaceC0608c, tVar, z10);
    }

    private final int e(p0 p0Var) {
        return this.f20527j ? p0Var.F0() : p0Var.S0();
    }

    private final long f(int i10) {
        int[] iArr = this.f20529l;
        int i11 = i10 * 2;
        return c3.o.a(iArr[i11], iArr[i11 + 1]);
    }

    public final void a(int i10) {
        this.f20530m = b() + i10;
        int length = this.f20529l.length;
        for (int i11 = 0; i11 < length; i11++) {
            boolean z10 = this.f20527j;
            if ((z10 && i11 % 2 == 1) || (!z10 && i11 % 2 == 0)) {
                int[] iArr = this.f20529l;
                iArr[i11] = iArr[i11] + i10;
            }
        }
    }

    @Override // h0.f
    public int b() {
        return this.f20530m;
    }

    public final int c() {
        return this.f20528k;
    }

    public Object d() {
        return this.f20522e;
    }

    public final int g() {
        return this.f20519b;
    }

    @Override // h0.f
    public int getIndex() {
        return this.f20518a;
    }

    public final void h(p0.a aVar) {
        if (!(this.f20531n != Integer.MIN_VALUE)) {
            throw new IllegalArgumentException("position() should be called first".toString());
        }
        int size = this.f20520c.size();
        for (int i10 = 0; i10 < size; i10++) {
            p0 p0Var = (p0) this.f20520c.get(i10);
            long f10 = f(i10);
            if (this.f20526i) {
                f10 = c3.o.a(this.f20527j ? c3.n.h(f10) : (this.f20531n - c3.n.h(f10)) - e(p0Var), this.f20527j ? (this.f20531n - c3.n.i(f10)) - e(p0Var) : c3.n.i(f10));
            }
            long l10 = c3.n.l(f10, this.f20521d);
            if (this.f20527j) {
                p0.a.y(aVar, p0Var, l10, BitmapDescriptorFactory.HUE_RED, null, 6, null);
            } else {
                p0.a.s(aVar, p0Var, l10, BitmapDescriptorFactory.HUE_RED, null, 6, null);
            }
        }
    }

    public final void i(int i10, int i11, int i12) {
        int S0;
        this.f20530m = i10;
        this.f20531n = this.f20527j ? i12 : i11;
        List list = this.f20520c;
        int size = list.size();
        for (int i13 = 0; i13 < size; i13++) {
            p0 p0Var = (p0) list.get(i13);
            int i14 = i13 * 2;
            if (this.f20527j) {
                int[] iArr = this.f20529l;
                c.b bVar = this.f20523f;
                if (bVar == null) {
                    throw new IllegalArgumentException("null horizontalAlignment".toString());
                }
                iArr[i14] = bVar.a(p0Var.S0(), i11, this.f20525h);
                this.f20529l[i14 + 1] = i10;
                S0 = p0Var.F0();
            } else {
                int[] iArr2 = this.f20529l;
                iArr2[i14] = i10;
                int i15 = i14 + 1;
                c.InterfaceC0608c interfaceC0608c = this.f20524g;
                if (interfaceC0608c == null) {
                    throw new IllegalArgumentException("null verticalAlignment".toString());
                }
                iArr2[i15] = interfaceC0608c.a(p0Var.F0(), i12);
                S0 = p0Var.S0();
            }
            i10 += S0;
        }
    }

    private e(int i10, int i11, List list, long j10, Object obj, b0.q qVar, c.b bVar, c.InterfaceC0608c interfaceC0608c, c3.t tVar, boolean z10) {
        this.f20518a = i10;
        this.f20519b = i11;
        this.f20520c = list;
        this.f20521d = j10;
        this.f20522e = obj;
        this.f20523f = bVar;
        this.f20524g = interfaceC0608c;
        this.f20525h = tVar;
        this.f20526i = z10;
        this.f20527j = qVar == b0.q.Vertical;
        int size = list.size();
        int i12 = 0;
        for (int i13 = 0; i13 < size; i13++) {
            p0 p0Var = (p0) list.get(i13);
            i12 = Math.max(i12, !this.f20527j ? p0Var.F0() : p0Var.S0());
        }
        this.f20528k = i12;
        this.f20529l = new int[this.f20520c.size() * 2];
        this.f20531n = Integer.MIN_VALUE;
    }
}
