package androidx.recyclerview.widget;

import android.view.View;

/* JADX INFO: loaded from: classes.dex */
public final class p0 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public w0 f3846a;

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

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

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

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

    public p0() {
        d();
    }

    public final void a() {
        this.f3848c = this.f3849d ? this.f3846a.i() : this.f3846a.k();
    }

    public final void b(int i10, View view) {
        if (this.f3849d) {
            this.f3848c = this.f3846a.m() + this.f3846a.d(view);
        } else {
            this.f3848c = this.f3846a.g(view);
        }
        this.f3847b = i10;
    }

    public final void c(int i10, View view) {
        int iM = this.f3846a.m();
        if (iM >= 0) {
            b(i10, view);
            return;
        }
        this.f3847b = i10;
        if (!this.f3849d) {
            int iG = this.f3846a.g(view);
            int iK = iG - this.f3846a.k();
            this.f3848c = iG;
            if (iK > 0) {
                int i11 = (this.f3846a.i() - Math.min(0, (this.f3846a.i() - iM) - this.f3846a.d(view))) - (this.f3846a.e(view) + iG);
                if (i11 < 0) {
                    this.f3848c -= Math.min(iK, -i11);
                    return;
                }
                return;
            }
            return;
        }
        int i12 = (this.f3846a.i() - iM) - this.f3846a.d(view);
        this.f3848c = this.f3846a.i() - i12;
        if (i12 > 0) {
            int iE = this.f3848c - this.f3846a.e(view);
            int iK2 = this.f3846a.k();
            int iMin = iE - (Math.min(this.f3846a.g(view) - iK2, 0) + iK2);
            if (iMin < 0) {
                this.f3848c = Math.min(i12, -iMin) + this.f3848c;
            }
        }
    }

    public final void d() {
        this.f3847b = -1;
        this.f3848c = Integer.MIN_VALUE;
        this.f3849d = false;
        this.f3850e = false;
    }

    public final String toString() {
        return "AnchorInfo{mPosition=" + this.f3847b + ", mCoordinate=" + this.f3848c + ", mLayoutFromEnd=" + this.f3849d + ", mValid=" + this.f3850e + '}';
    }
}
