package u0;

import android.content.Context;
import android.graphics.PointF;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import androidx.recyclerview.widget.RecyclerView;

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

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f10289a = -1;

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

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public View f10294f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final P f10295g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public boolean f10296h;
    public final LinearInterpolator i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final DecelerateInterpolator f10297j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public PointF f10298k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final DisplayMetrics f10299l;

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

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public float f10301n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public int f10302o;
    public int p;

    public C1058u(Context context) {
        P p = new P();
        p.f10095d = -1;
        p.f10097f = false;
        p.f10098g = 0;
        p.f10092a = 0;
        p.f10093b = 0;
        p.f10094c = Integer.MIN_VALUE;
        p.f10096e = null;
        this.f10295g = p;
        this.i = new LinearInterpolator();
        this.f10297j = new DecelerateInterpolator();
        this.f10300m = false;
        this.f10302o = 0;
        this.p = 0;
        this.f10299l = context.getResources().getDisplayMetrics();
    }

    public static int a(int i, int i5, int i6, int i7, int i8) {
        if (i8 == -1) {
            return i6 - i;
        }
        if (i8 != 0) {
            if (i8 == 1) {
                return i7 - i5;
            }
            throw new IllegalArgumentException("snap preference should be one of the constants defined in SmoothScroller, starting with SNAP_");
        }
        int i9 = i6 - i;
        if (i9 > 0) {
            return i9;
        }
        int i10 = i7 - i5;
        if (i10 < 0) {
            return i10;
        }
        return 0;
    }

    public int b(View view, int i) {
        AbstractC1035G abstractC1035G = this.f10291c;
        if (abstractC1035G == null || !abstractC1035G.d()) {
            return 0;
        }
        C1036H c1036h = (C1036H) view.getLayoutParams();
        return a((view.getLeft() - ((C1036H) view.getLayoutParams()).f10074b.left) - ((ViewGroup.MarginLayoutParams) c1036h).leftMargin, view.getRight() + ((C1036H) view.getLayoutParams()).f10074b.right + ((ViewGroup.MarginLayoutParams) c1036h).rightMargin, abstractC1035G.B(), abstractC1035G.f10071n - abstractC1035G.C(), i);
    }

    public float c(DisplayMetrics displayMetrics) {
        return 25.0f / displayMetrics.densityDpi;
    }

    public int d(int i) {
        float fAbs = Math.abs(i);
        if (!this.f10300m) {
            this.f10301n = c(this.f10299l);
            this.f10300m = true;
        }
        return (int) Math.ceil(fAbs * this.f10301n);
    }

    public PointF e(int i) {
        Object obj = this.f10291c;
        if (obj instanceof Q) {
            return ((Q) obj).a(i);
        }
        Log.w("RecyclerView", "You should override computeScrollVectorForPosition when the LayoutManager does not implement " + Q.class.getCanonicalName());
        return null;
    }

    /* JADX WARN: Removed duplicated region for block: B:50:0x00f8  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public final void f(int r9, int r10) {
        /*
            Method dump skipped, instruction units count: 277
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: u0.C1058u.f(int, int):void");
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x0015  */
    /* JADX WARN: Removed duplicated region for block: B:18:0x0029  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public void g(android.view.View r8, u0.P r9) {
        /*
            r7 = this;
            android.graphics.PointF r0 = r7.f10298k
            r1 = 1
            r2 = -1
            r3 = 0
            r4 = 0
            if (r0 == 0) goto L15
            float r0 = r0.x
            int r0 = (r0 > r3 ? 1 : (r0 == r3 ? 0 : -1))
            if (r0 != 0) goto Lf
            goto L15
        Lf:
            if (r0 <= 0) goto L13
            r0 = r1
            goto L16
        L13:
            r0 = r2
            goto L16
        L15:
            r0 = r4
        L16:
            int r0 = r7.b(r8, r0)
            android.graphics.PointF r5 = r7.f10298k
            if (r5 == 0) goto L29
            float r5 = r5.y
            int r3 = (r5 > r3 ? 1 : (r5 == r3 ? 0 : -1))
            if (r3 != 0) goto L25
            goto L29
        L25:
            if (r3 <= 0) goto L2a
            r2 = r1
            goto L2a
        L29:
            r2 = r4
        L2a:
            u0.G r3 = r7.f10291c
            if (r3 == 0) goto L6e
            boolean r5 = r3.e()
            if (r5 != 0) goto L35
            goto L6e
        L35:
            android.view.ViewGroup$LayoutParams r4 = r8.getLayoutParams()
            u0.H r4 = (u0.C1036H) r4
            int r5 = r8.getTop()
            android.view.ViewGroup$LayoutParams r6 = r8.getLayoutParams()
            u0.H r6 = (u0.C1036H) r6
            android.graphics.Rect r6 = r6.f10074b
            int r6 = r6.top
            int r5 = r5 - r6
            int r6 = r4.topMargin
            int r5 = r5 - r6
            int r6 = r8.getBottom()
            android.view.ViewGroup$LayoutParams r8 = r8.getLayoutParams()
            u0.H r8 = (u0.C1036H) r8
            android.graphics.Rect r8 = r8.f10074b
            int r8 = r8.bottom
            int r6 = r6 + r8
            int r8 = r4.bottomMargin
            int r6 = r6 + r8
            int r8 = r3.D()
            int r4 = r3.f10072o
            int r3 = r3.A()
            int r4 = r4 - r3
            int r4 = a(r5, r6, r8, r4, r2)
        L6e:
            int r8 = r0 * r0
            int r2 = r4 * r4
            int r2 = r2 + r8
            double r2 = (double) r2
            double r2 = java.lang.Math.sqrt(r2)
            int r8 = (int) r2
            int r8 = r7.d(r8)
            double r2 = (double) r8
            r5 = 4599717252057688074(0x3fd57a786c22680a, double:0.3356)
            double r2 = r2 / r5
            double r2 = java.lang.Math.ceil(r2)
            int r8 = (int) r2
            if (r8 <= 0) goto L99
            int r0 = -r0
            int r2 = -r4
            android.view.animation.DecelerateInterpolator r3 = r7.f10297j
            r9.f10092a = r0
            r9.f10093b = r2
            r9.f10094c = r8
            r9.f10096e = r3
            r9.f10097f = r1
        L99:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: u0.C1058u.g(android.view.View, u0.P):void");
    }

    public final void h() {
        if (this.f10293e) {
            this.f10293e = false;
            this.p = 0;
            this.f10302o = 0;
            this.f10298k = null;
            this.f10290b.f4573m0.f10099a = -1;
            this.f10294f = null;
            this.f10289a = -1;
            this.f10292d = false;
            AbstractC1035G abstractC1035G = this.f10291c;
            if (abstractC1035G.f10063e == this) {
                abstractC1035G.f10063e = null;
            }
            this.f10291c = null;
            this.f10290b = null;
        }
    }
}
