package com.google.android.material.bottomsheet;

import android.os.SystemClock;
import android.view.View;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import kotlinx.coroutines.y;

/* JADX INFO: loaded from: classes2.dex */
public final class c extends com.bumptech.glide.h {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ BottomSheetBehavior f22307a;

    public c(BottomSheetBehavior bottomSheetBehavior) {
        this.f22307a = bottomSheetBehavior;
    }

    @Override // com.bumptech.glide.h
    public final boolean D(int i10, View view) {
        BottomSheetBehavior bottomSheetBehavior = this.f22307a;
        int i11 = bottomSheetBehavior.f22286o0;
        if (i11 == 1 || bottomSheetBehavior.z0) {
            return false;
        }
        if (i11 == 3 && bottomSheetBehavior.f22295x0 == i10) {
            WeakReference<View> weakReference = bottomSheetBehavior.nestedScrollingChildRef;
            View view2 = weakReference != null ? weakReference.get() : null;
            if (view2 != null && view2.canScrollVertically(-1)) {
                return false;
            }
        }
        SystemClock.uptimeMillis();
        Reference reference = bottomSheetBehavior.viewRef;
        return reference != null && reference.get() == view;
    }

    @Override // com.bumptech.glide.h
    public final int j(View view, int i10) {
        return view.getLeft();
    }

    @Override // com.bumptech.glide.h
    public final int k(View view, int i10) {
        return y.h(i10, this.f22307a.D(), o());
    }

    @Override // com.bumptech.glide.h
    public final int o() {
        BottomSheetBehavior bottomSheetBehavior = this.f22307a;
        return bottomSheetBehavior.f22278j0 ? bottomSheetBehavior.f22293v0 : bottomSheetBehavior.f22274h0;
    }

    @Override // com.bumptech.glide.h
    public final void v(int i10) {
        if (i10 == 1) {
            BottomSheetBehavior bottomSheetBehavior = this.f22307a;
            if (bottomSheetBehavior.f22282l0) {
                bottomSheetBehavior.K(1);
            }
        }
    }

    @Override // com.bumptech.glide.h
    public final void w(View view, int i10, int i11) {
        this.f22307a.A(i11);
    }

    /* JADX WARN: Removed duplicated region for block: B:20:0x0049  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x0082  */
    /* JADX WARN: Removed duplicated region for block: B:6:0x000d  */
    @Override // com.bumptech.glide.h
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void x(float f10, float f11, View view) {
        int i10 = 6;
        BottomSheetBehavior bottomSheetBehavior = this.f22307a;
        if (f11 < 0.0f) {
            if (bottomSheetBehavior.f22261b) {
                i10 = 3;
            } else {
                int top = view.getTop();
                SystemClock.uptimeMillis();
                if (top <= bottomSheetBehavior.f22270f0) {
                }
            }
        } else if (bottomSheetBehavior.f22278j0 && bottomSheetBehavior.L(f11, view)) {
            if (Math.abs(f10) >= Math.abs(f11) || f11 <= bottomSheetBehavior.f22265d) {
                if (view.getTop() > (bottomSheetBehavior.D() + bottomSheetBehavior.f22293v0) / 2) {
                    i10 = 5;
                } else if (bottomSheetBehavior.f22261b || Math.abs(view.getTop() - bottomSheetBehavior.D()) < Math.abs(view.getTop() - bottomSheetBehavior.f22270f0)) {
                }
            }
        } else if (f11 == 0.0f || Math.abs(f10) > Math.abs(f11)) {
            int top2 = view.getTop();
            if (!bottomSheetBehavior.f22261b) {
                int i11 = bottomSheetBehavior.f22270f0;
                if (top2 < i11) {
                    if (top2 < Math.abs(top2 - bottomSheetBehavior.f22274h0)) {
                    }
                } else if (Math.abs(top2 - i11) >= Math.abs(top2 - bottomSheetBehavior.f22274h0)) {
                }
            } else if (Math.abs(top2 - bottomSheetBehavior.f22268e0) >= Math.abs(top2 - bottomSheetBehavior.f22274h0)) {
                i10 = 4;
            }
        } else if (!bottomSheetBehavior.f22261b) {
            int top3 = view.getTop();
            if (Math.abs(top3 - bottomSheetBehavior.f22270f0) >= Math.abs(top3 - bottomSheetBehavior.f22274h0)) {
            }
        }
        bottomSheetBehavior.getClass();
        bottomSheetBehavior.M(view, i10, true);
    }
}
