package androidx.recyclerview.widget;

import android.view.View;

/* loaded from: classes.dex */
class t {

    /* renamed from: a, reason: collision with root package name */
    final b f5476a;

    /* renamed from: b, reason: collision with root package name */
    a f5477b = new a();

    /* loaded from: classes.dex */
    static class a {

        /* renamed from: a, reason: collision with root package name */
        int f5478a = 0;

        /* renamed from: b, reason: collision with root package name */
        int f5479b;

        /* renamed from: c, reason: collision with root package name */
        int f5480c;

        /* renamed from: d, reason: collision with root package name */
        int f5481d;

        /* renamed from: e, reason: collision with root package name */
        int f5482e;

        a() {
        }

        void a(int i10) {
            this.f5478a = i10 | this.f5478a;
        }

        boolean b() {
            int i10 = this.f5478a;
            if ((i10 & 7) != 0 && (i10 & (c(this.f5481d, this.f5479b) << 0)) == 0) {
                return false;
            }
            int i11 = this.f5478a;
            if ((i11 & 112) != 0 && (i11 & (c(this.f5481d, this.f5480c) << 4)) == 0) {
                return false;
            }
            int i12 = this.f5478a;
            if ((i12 & 1792) != 0 && (i12 & (c(this.f5482e, this.f5479b) << 8)) == 0) {
                return false;
            }
            int i13 = this.f5478a;
            return (i13 & 28672) == 0 || ((c(this.f5482e, this.f5480c) << 12) & i13) != 0;
        }

        int c(int i10, int i11) {
            if (i10 > i11) {
                return 1;
            }
            return i10 == i11 ? 2 : 4;
        }

        void d() {
            this.f5478a = 0;
        }

        void e(int i10, int i11, int i12, int i13) {
            this.f5479b = i10;
            this.f5480c = i11;
            this.f5481d = i12;
            this.f5482e = i13;
        }
    }

    /* loaded from: classes.dex */
    interface b {
        View a(int i10);

        int b(View view);

        int c();

        int d();

        int e(View view);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public t(b bVar) {
        this.f5476a = bVar;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public View a(int i10, int i11, int i12, int i13) {
        int c10 = this.f5476a.c();
        int d10 = this.f5476a.d();
        int i14 = i11 > i10 ? 1 : -1;
        View view = null;
        while (i10 != i11) {
            View a10 = this.f5476a.a(i10);
            this.f5477b.e(c10, d10, this.f5476a.b(a10), this.f5476a.e(a10));
            if (i12 != 0) {
                this.f5477b.d();
                this.f5477b.a(i12);
                if (this.f5477b.b()) {
                    return a10;
                }
            }
            if (i13 != 0) {
                this.f5477b.d();
                this.f5477b.a(i13);
                if (this.f5477b.b()) {
                    view = a10;
                }
            }
            i10 += i14;
        }
        return view;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public boolean b(View view, int i10) {
        this.f5477b.e(this.f5476a.c(), this.f5476a.d(), this.f5476a.b(view), this.f5476a.e(view));
        if (i10 == 0) {
            return false;
        }
        this.f5477b.d();
        this.f5477b.a(i10);
        return this.f5477b.b();
    }
}
