package X6FRs_4.YghfZG_14.PGPF6hQ_2;

import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
/* compiled from: ScrollbarHelper.java */
/* loaded from: classes.dex */
public class Nm6q_10 {
    public static int KQgRr5e_0(RecyclerView.G83uNX_24 g83uNX_24, Xgtqvk_8 xgtqvk_8, View view, View view2, RecyclerView.YghfZG_14 yghfZG_14, boolean z, boolean z2) {
        int max;
        if (yghfZG_14.QxJ9d_1() == 0 || g83uNX_24.KQgRr5e_0() == 0 || view == null || view2 == null) {
            return 0;
        }
        int min = Math.min(yghfZG_14.Xgtqvk_8(view), yghfZG_14.Xgtqvk_8(view2));
        int max2 = Math.max(yghfZG_14.Xgtqvk_8(view), yghfZG_14.Xgtqvk_8(view2));
        if (z2) {
            max = Math.max(0, (g83uNX_24.KQgRr5e_0() - max2) - 1);
        } else {
            max = Math.max(0, min);
        }
        if (z) {
            return Math.round((max * (Math.abs(xgtqvk_8.KQgRr5e_0(view2) - xgtqvk_8.Mqv2r_3(view)) / (Math.abs(yghfZG_14.Xgtqvk_8(view) - yghfZG_14.Xgtqvk_8(view2)) + 1))) + (xgtqvk_8.IFxWkV_5() - xgtqvk_8.Mqv2r_3(view)));
        }
        return max;
    }

    public static int QxJ9d_1(RecyclerView.G83uNX_24 g83uNX_24, Xgtqvk_8 xgtqvk_8, View view, View view2, RecyclerView.YghfZG_14 yghfZG_14, boolean z) {
        if (yghfZG_14.QxJ9d_1() == 0 || g83uNX_24.KQgRr5e_0() == 0 || view == null || view2 == null) {
            return 0;
        }
        if (!z) {
            return g83uNX_24.KQgRr5e_0();
        }
        return (int) (((xgtqvk_8.KQgRr5e_0(view2) - xgtqvk_8.Mqv2r_3(view)) / (Math.abs(yghfZG_14.Xgtqvk_8(view) - yghfZG_14.Xgtqvk_8(view2)) + 1)) * g83uNX_24.KQgRr5e_0());
    }

    public static int KQgRr5e_0(RecyclerView.G83uNX_24 g83uNX_24, Xgtqvk_8 xgtqvk_8, View view, View view2, RecyclerView.YghfZG_14 yghfZG_14, boolean z) {
        if (yghfZG_14.QxJ9d_1() == 0 || g83uNX_24.KQgRr5e_0() == 0 || view == null || view2 == null) {
            return 0;
        }
        if (!z) {
            return Math.abs(yghfZG_14.Xgtqvk_8(view) - yghfZG_14.Xgtqvk_8(view2)) + 1;
        }
        return Math.min(xgtqvk_8.IMuAHx_6(), xgtqvk_8.KQgRr5e_0(view2) - xgtqvk_8.Mqv2r_3(view));
    }
}
