package u0;

import android.view.View;

/* JADX INFO: renamed from: u0.q, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1055q {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public b0.g f10266a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f10267b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f10268c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public boolean f10269d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public boolean f10270e;

    public C1055q() {
        d();
    }

    public final void a() {
        this.f10268c = this.f10269d ? this.f10266a.g() : this.f10266a.k();
    }

    public final void b(int i, View view) {
        if (this.f10269d) {
            int iB = this.f10266a.b(view);
            b0.g gVar = this.f10266a;
            this.f10268c = (Integer.MIN_VALUE == gVar.f4632a ? 0 : gVar.l() - gVar.f4632a) + iB;
        } else {
            this.f10268c = this.f10266a.e(view);
        }
        this.f10267b = i;
    }

    public final void c(int i, View view) {
        b0.g gVar = this.f10266a;
        int iL = Integer.MIN_VALUE == gVar.f4632a ? 0 : gVar.l() - gVar.f4632a;
        if (iL >= 0) {
            b(i, view);
            return;
        }
        this.f10267b = i;
        if (!this.f10269d) {
            int iE = this.f10266a.e(view);
            int iK = iE - this.f10266a.k();
            this.f10268c = iE;
            if (iK > 0) {
                int iG = (this.f10266a.g() - Math.min(0, (this.f10266a.g() - iL) - this.f10266a.b(view))) - (this.f10266a.c(view) + iE);
                if (iG < 0) {
                    this.f10268c -= Math.min(iK, -iG);
                    return;
                }
                return;
            }
            return;
        }
        int iG2 = (this.f10266a.g() - iL) - this.f10266a.b(view);
        this.f10268c = this.f10266a.g() - iG2;
        if (iG2 > 0) {
            int iC = this.f10268c - this.f10266a.c(view);
            int iK2 = this.f10266a.k();
            int iMin = iC - (Math.min(this.f10266a.e(view) - iK2, 0) + iK2);
            if (iMin < 0) {
                this.f10268c = Math.min(iG2, -iMin) + this.f10268c;
            }
        }
    }

    public final void d() {
        this.f10267b = -1;
        this.f10268c = Integer.MIN_VALUE;
        this.f10269d = false;
        this.f10270e = false;
    }

    public final String toString() {
        return "AnchorInfo{mPosition=" + this.f10267b + ", mCoordinate=" + this.f10268c + ", mLayoutFromEnd=" + this.f10269d + ", mValid=" + this.f10270e + '}';
    }
}
