package y0;

import android.content.Context;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.OverScroller;
import androidx.annotation.Nullable;
import androidx.core.view.s1;
import e.s0;
import java.util.Arrays;
import java.util.WeakHashMap;

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

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public static final g f36677x = new g(0);

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public float[] f36681d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public float[] f36682e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public float[] f36683f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public float[] f36684g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public int[] f36685h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public int[] f36686i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public int[] f36687j;

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

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public VelocityTracker f36689l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final float f36690m;

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

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

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

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

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final OverScroller f36695r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final com.bumptech.glide.h f36696s;

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

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

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final ViewGroup f36699v;

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

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final s0 f36700w = new s0(this, 6);

    public h(Context context, ViewGroup viewGroup, com.bumptech.glide.h hVar) {
        if (viewGroup == null) {
            throw new IllegalArgumentException("Parent view may not be null");
        }
        if (hVar == null) {
            throw new IllegalArgumentException("Callback may not be null");
        }
        this.f36699v = viewGroup;
        this.f36696s = hVar;
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        int i10 = (int) ((context.getResources().getDisplayMetrics().density * 20.0f) + 0.5f);
        this.f36693p = i10;
        this.f36692o = i10;
        this.f36679b = viewConfiguration.getScaledTouchSlop();
        this.f36690m = viewConfiguration.getScaledMaximumFlingVelocity();
        this.f36691n = viewConfiguration.getScaledMinimumFlingVelocity();
        this.f36695r = new OverScroller(context, f36677x);
    }

    public static h i(ViewGroup viewGroup, float f10, com.bumptech.glide.h hVar) {
        h hVar2 = new h(viewGroup.getContext(), viewGroup, hVar);
        hVar2.f36679b = (int) ((1.0f / f10) * hVar2.f36679b);
        return hVar2;
    }

    public final void a() {
        b();
        if (this.f36678a == 2) {
            OverScroller overScroller = this.f36695r;
            overScroller.getCurrX();
            overScroller.getCurrY();
            overScroller.abortAnimation();
            this.f36696s.w(this.f36697t, overScroller.getCurrX(), overScroller.getCurrY());
        }
        p(0);
    }

    public final void b() {
        this.f36680c = -1;
        float[] fArr = this.f36681d;
        if (fArr != null) {
            Arrays.fill(fArr, 0.0f);
            Arrays.fill(this.f36682e, 0.0f);
            Arrays.fill(this.f36683f, 0.0f);
            Arrays.fill(this.f36684g, 0.0f);
            Arrays.fill(this.f36685h, 0);
            Arrays.fill(this.f36686i, 0);
            Arrays.fill(this.f36687j, 0);
            this.f36688k = 0;
        }
        VelocityTracker velocityTracker = this.f36689l;
        if (velocityTracker != null) {
            velocityTracker.recycle();
            this.f36689l = null;
        }
    }

    public final void c(int i10, View view) {
        ViewParent parent = view.getParent();
        ViewGroup viewGroup = this.f36699v;
        if (parent != viewGroup) {
            throw new IllegalArgumentException("captureChildView: parameter must be a descendant of the ViewDragHelper's tracked parent view (" + viewGroup + ")");
        }
        this.f36697t = view;
        this.f36680c = i10;
        this.f36696s.u(view, i10);
        p(1);
    }

    public final boolean d(float f10, int i10, float f11, int i11) {
        float fAbs = Math.abs(f10);
        float fAbs2 = Math.abs(f11);
        if ((this.f36685h[i10] & i11) != i11 || (this.f36694q & i11) == 0 || (this.f36687j[i10] & i11) == i11 || (this.f36686i[i10] & i11) == i11) {
            return false;
        }
        int i12 = this.f36679b;
        if (fAbs <= i12 && fAbs2 <= i12) {
            return false;
        }
        if (fAbs < fAbs2 * 0.5f) {
            this.f36696s.getClass();
        }
        return (this.f36686i[i10] & i11) == 0 && fAbs > ((float) this.f36679b);
    }

    public final boolean e(float f10, float f11, View view) {
        if (view == null) {
            return false;
        }
        com.bumptech.glide.h hVar = this.f36696s;
        boolean z10 = hVar.n(view) > 0;
        boolean z11 = hVar.o() > 0;
        if (!z10 || !z11) {
            return z10 ? Math.abs(f10) > ((float) this.f36679b) : z11 && Math.abs(f11) > ((float) this.f36679b);
        }
        float f12 = (f11 * f11) + (f10 * f10);
        int i10 = this.f36679b;
        return f12 > ((float) (i10 * i10));
    }

    public final void f(int i10) {
        float[] fArr = this.f36681d;
        if (fArr != null) {
            int i11 = this.f36688k;
            int i12 = 1 << i10;
            if ((i11 & i12) != 0) {
                fArr[i10] = 0.0f;
                this.f36682e[i10] = 0.0f;
                this.f36683f[i10] = 0.0f;
                this.f36684g[i10] = 0.0f;
                this.f36685h[i10] = 0;
                this.f36686i[i10] = 0;
                this.f36687j[i10] = 0;
                this.f36688k = (~i12) & i11;
            }
        }
    }

    @Nullable
    public View findTopChildUnder(int i10, int i11) {
        ViewGroup viewGroup = this.f36699v;
        for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
            this.f36696s.getClass();
            View childAt = viewGroup.getChildAt(childCount);
            if (i10 >= childAt.getLeft() && i10 < childAt.getRight() && i11 >= childAt.getTop() && i11 < childAt.getBottom()) {
                return childAt;
            }
        }
        return null;
    }

    public final int g(int i10, int i11, int i12) {
        if (i10 == 0) {
            return 0;
        }
        float width = this.f36699v.getWidth() / 2;
        float fSin = (((float) Math.sin((Math.min(1.0f, Math.abs(i10) / r0) - 0.5f) * 0.47123894f)) * width) + width;
        int iAbs = Math.abs(i11);
        return Math.min(iAbs > 0 ? Math.round(Math.abs(fSin / iAbs) * 1000.0f) * 4 : (int) (((Math.abs(i10) / i12) + 1.0f) * 256.0f), 600);
    }

    @Nullable
    public View getCapturedView() {
        return this.f36697t;
    }

    public final boolean h() {
        if (this.f36678a == 2) {
            OverScroller overScroller = this.f36695r;
            boolean zComputeScrollOffset = overScroller.computeScrollOffset();
            int currX = overScroller.getCurrX();
            int currY = overScroller.getCurrY();
            int left = currX - this.f36697t.getLeft();
            int top = currY - this.f36697t.getTop();
            if (left != 0) {
                View view = this.f36697t;
                WeakHashMap weakHashMap = s1.f1815a;
                view.offsetLeftAndRight(left);
            }
            if (top != 0) {
                View view2 = this.f36697t;
                WeakHashMap weakHashMap2 = s1.f1815a;
                view2.offsetTopAndBottom(top);
            }
            if (left != 0 || top != 0) {
                this.f36696s.w(this.f36697t, currX, currY);
            }
            if (zComputeScrollOffset && currX == overScroller.getFinalX() && currY == overScroller.getFinalY()) {
                overScroller.abortAnimation();
            } else if (!zComputeScrollOffset) {
            }
            this.f36699v.post(this.f36700w);
        }
        return this.f36678a == 2;
    }

    public boolean isViewUnder(@Nullable View view, int i10, int i11) {
        return view != null && i10 >= view.getLeft() && i10 < view.getRight() && i11 >= view.getTop() && i11 < view.getBottom();
    }

    public final boolean j(int i10, int i11, int i12, int i13) {
        float f10;
        float f11;
        float f12;
        float f13;
        int left = this.f36697t.getLeft();
        int top = this.f36697t.getTop();
        int i14 = i10 - left;
        int i15 = i11 - top;
        OverScroller overScroller = this.f36695r;
        int i16 = 0;
        if (i14 == 0 && i15 == 0) {
            overScroller.abortAnimation();
            p(0);
            return false;
        }
        View view = this.f36697t;
        int i17 = (int) this.f36691n;
        int i18 = (int) this.f36690m;
        int iAbs = Math.abs(i12);
        if (iAbs < i17) {
            i12 = 0;
        } else if (iAbs > i18) {
            i12 = i12 > 0 ? i18 : -i18;
        }
        int i19 = (int) this.f36691n;
        int iAbs2 = Math.abs(i13);
        if (iAbs2 < i19) {
            i13 = i16;
        } else if (iAbs2 > i18) {
            if (i13 > 0) {
                i13 = i18;
            } else {
                i16 = -i18;
                i13 = i16;
            }
        }
        int iAbs3 = Math.abs(i14);
        int iAbs4 = Math.abs(i15);
        int iAbs5 = Math.abs(i12);
        int iAbs6 = Math.abs(i13);
        int i20 = iAbs5 + iAbs6;
        int i21 = iAbs3 + iAbs4;
        if (i12 != 0) {
            f10 = iAbs5;
            f11 = i20;
        } else {
            f10 = iAbs3;
            f11 = i21;
        }
        float f14 = f10 / f11;
        if (i13 != 0) {
            f12 = iAbs6;
            f13 = i20;
        } else {
            f12 = iAbs4;
            f13 = i21;
        }
        float f15 = f12 / f13;
        com.bumptech.glide.h hVar = this.f36696s;
        overScroller.startScroll(left, top, i14, i15, (int) ((g(i15, i13, hVar.o()) * f15) + (g(i14, i12, hVar.n(view)) * f14)));
        p(2);
        return true;
    }

    public final void k(MotionEvent motionEvent) {
        int actionMasked = motionEvent.getActionMasked();
        int actionIndex = motionEvent.getActionIndex();
        if (actionMasked == 0) {
            b();
        }
        if (this.f36689l == null) {
            this.f36689l = VelocityTracker.obtain();
        }
        this.f36689l.addMovement(motionEvent);
        int i10 = 0;
        com.bumptech.glide.h hVar = this.f36696s;
        if (actionMasked == 0) {
            float x10 = motionEvent.getX();
            float y10 = motionEvent.getY();
            int pointerId = motionEvent.getPointerId(0);
            View viewFindTopChildUnder = findTopChildUnder((int) x10, (int) y10);
            n(x10, y10, pointerId);
            t(pointerId, viewFindTopChildUnder);
            if ((this.f36685h[pointerId] & this.f36694q) != 0) {
                hVar.t(pointerId);
                return;
            }
            return;
        }
        if (actionMasked == 1) {
            if (this.f36678a == 1) {
                l();
            }
            b();
            return;
        }
        if (actionMasked != 2) {
            if (actionMasked == 3) {
                if (this.f36678a == 1) {
                    this.f36698u = true;
                    hVar.x(0.0f, 0.0f, this.f36697t);
                    this.f36698u = false;
                    if (this.f36678a == 1) {
                        p(0);
                    }
                }
                b();
                return;
            }
            if (actionMasked == 5) {
                int pointerId2 = motionEvent.getPointerId(actionIndex);
                float x11 = motionEvent.getX(actionIndex);
                float y11 = motionEvent.getY(actionIndex);
                n(x11, y11, pointerId2);
                if (this.f36678a == 0) {
                    t(pointerId2, findTopChildUnder((int) x11, (int) y11));
                    if ((this.f36685h[pointerId2] & this.f36694q) != 0) {
                        hVar.t(pointerId2);
                        return;
                    }
                    return;
                }
                if (isViewUnder(this.f36697t, (int) x11, (int) y11)) {
                    t(pointerId2, this.f36697t);
                    return;
                }
                return;
            }
            if (actionMasked != 6) {
                return;
            }
            int pointerId3 = motionEvent.getPointerId(actionIndex);
            if (this.f36678a == 1 && pointerId3 == this.f36680c) {
                int pointerCount = motionEvent.getPointerCount();
                while (true) {
                    if (i10 >= pointerCount) {
                        break;
                    }
                    int pointerId4 = motionEvent.getPointerId(i10);
                    if (pointerId4 != this.f36680c) {
                        View viewFindTopChildUnder2 = findTopChildUnder((int) motionEvent.getX(i10), (int) motionEvent.getY(i10));
                        View view = this.f36697t;
                        if (viewFindTopChildUnder2 == view && t(pointerId4, view)) {
                            if (this.f36680c == -1) {
                                break;
                            }
                        }
                    }
                    i10++;
                }
                l();
            }
            f(pointerId3);
            return;
        }
        if (this.f36678a != 1) {
            int pointerCount2 = motionEvent.getPointerCount();
            while (i10 < pointerCount2) {
                int pointerId5 = motionEvent.getPointerId(i10);
                if ((this.f36688k & (1 << pointerId5)) != 0) {
                    float x12 = motionEvent.getX(i10);
                    float y12 = motionEvent.getY(i10);
                    float f10 = x12 - this.f36681d[pointerId5];
                    float f11 = y12 - this.f36682e[pointerId5];
                    m(f10, f11, pointerId5);
                    if (this.f36678a != 1) {
                        View viewFindTopChildUnder3 = findTopChildUnder((int) x12, (int) y12);
                        if (e(f10, f11, viewFindTopChildUnder3) && t(pointerId5, viewFindTopChildUnder3)) {
                            break;
                        }
                    } else {
                        break;
                    }
                }
                i10++;
            }
            o(motionEvent);
            return;
        }
        int i11 = this.f36680c;
        if ((this.f36688k & (1 << i11)) != 0) {
            int iFindPointerIndex = motionEvent.findPointerIndex(i11);
            float x13 = motionEvent.getX(iFindPointerIndex);
            float y13 = motionEvent.getY(iFindPointerIndex);
            float[] fArr = this.f36683f;
            int i12 = this.f36680c;
            int i13 = (int) (x13 - fArr[i12]);
            int i14 = (int) (y13 - this.f36684g[i12]);
            int left = this.f36697t.getLeft() + i13;
            int top = this.f36697t.getTop() + i14;
            int left2 = this.f36697t.getLeft();
            int top2 = this.f36697t.getTop();
            if (i13 != 0) {
                left = hVar.j(this.f36697t, left);
                WeakHashMap weakHashMap = s1.f1815a;
                this.f36697t.offsetLeftAndRight(left - left2);
            }
            if (i14 != 0) {
                top = hVar.k(this.f36697t, top);
                WeakHashMap weakHashMap2 = s1.f1815a;
                this.f36697t.offsetTopAndBottom(top - top2);
            }
            if (i13 != 0 || i14 != 0) {
                hVar.w(this.f36697t, left, top);
            }
            o(motionEvent);
        }
    }

    public final void l() {
        VelocityTracker velocityTracker = this.f36689l;
        float f10 = this.f36690m;
        velocityTracker.computeCurrentVelocity(1000, f10);
        float xVelocity = this.f36689l.getXVelocity(this.f36680c);
        float f11 = this.f36691n;
        float fAbs = Math.abs(xVelocity);
        float f12 = 0.0f;
        if (fAbs < f11) {
            xVelocity = 0.0f;
        } else if (fAbs > f10) {
            xVelocity = xVelocity > 0.0f ? f10 : -f10;
        }
        float yVelocity = this.f36689l.getYVelocity(this.f36680c);
        float f13 = this.f36691n;
        float fAbs2 = Math.abs(yVelocity);
        if (fAbs2 >= f13) {
            if (fAbs2 > f10) {
                if (yVelocity <= 0.0f) {
                    f10 = -f10;
                }
                f12 = f10;
            } else {
                f12 = yVelocity;
            }
        }
        this.f36698u = true;
        this.f36696s.x(xVelocity, f12, this.f36697t);
        this.f36698u = false;
        if (this.f36678a == 1) {
            p(0);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v11 */
    /* JADX WARN: Type inference failed for: r0v12 */
    /* JADX WARN: Type inference failed for: r0v13 */
    /* JADX WARN: Type inference failed for: r0v14 */
    /* JADX WARN: Type inference failed for: r0v15 */
    /* JADX WARN: Type inference failed for: r0v16 */
    /* JADX WARN: Type inference failed for: r0v2 */
    /* JADX WARN: Type inference failed for: r0v3 */
    /* JADX WARN: Type inference failed for: r0v4, types: [int] */
    /* JADX WARN: Type inference failed for: r3v3, types: [com.bumptech.glide.h] */
    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$UnknownArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    public final void m(float f10, float f11, int i10) {
        boolean zD = d(f10, i10, f11, 1);
        ?? r02 = zD;
        if (d(f11, i10, f10, 4)) {
            r02 = (zD ? 1 : 0) | 4;
        }
        ?? r03 = r02;
        if (d(f10, i10, f11, 2)) {
            r03 = (r02 == true ? 1 : 0) | 2;
        }
        ?? r04 = r03;
        if (d(f11, i10, f10, 8)) {
            r04 = (r03 == true ? 1 : 0) | 8;
        }
        if (r04 != 0) {
            int[] iArr = this.f36686i;
            iArr[i10] = iArr[i10] | r04;
            this.f36696s.s(r04, i10);
        }
    }

    public final void n(float f10, float f11, int i10) {
        float[] fArr = this.f36681d;
        if (fArr == null || fArr.length <= i10) {
            int i11 = i10 + 1;
            float[] fArr2 = new float[i11];
            float[] fArr3 = new float[i11];
            float[] fArr4 = new float[i11];
            float[] fArr5 = new float[i11];
            int[] iArr = new int[i11];
            int[] iArr2 = new int[i11];
            int[] iArr3 = new int[i11];
            if (fArr != null) {
                System.arraycopy(fArr, 0, fArr2, 0, fArr.length);
                float[] fArr6 = this.f36682e;
                System.arraycopy(fArr6, 0, fArr3, 0, fArr6.length);
                float[] fArr7 = this.f36683f;
                System.arraycopy(fArr7, 0, fArr4, 0, fArr7.length);
                float[] fArr8 = this.f36684g;
                System.arraycopy(fArr8, 0, fArr5, 0, fArr8.length);
                int[] iArr4 = this.f36685h;
                System.arraycopy(iArr4, 0, iArr, 0, iArr4.length);
                int[] iArr5 = this.f36686i;
                System.arraycopy(iArr5, 0, iArr2, 0, iArr5.length);
                int[] iArr6 = this.f36687j;
                System.arraycopy(iArr6, 0, iArr3, 0, iArr6.length);
            }
            this.f36681d = fArr2;
            this.f36682e = fArr3;
            this.f36683f = fArr4;
            this.f36684g = fArr5;
            this.f36685h = iArr;
            this.f36686i = iArr2;
            this.f36687j = iArr3;
        }
        float[] fArr9 = this.f36681d;
        this.f36683f[i10] = f10;
        fArr9[i10] = f10;
        float[] fArr10 = this.f36682e;
        this.f36684g[i10] = f11;
        fArr10[i10] = f11;
        int[] iArr7 = this.f36685h;
        int i12 = (int) f10;
        int i13 = (int) f11;
        ViewGroup viewGroup = this.f36699v;
        int i14 = i12 < viewGroup.getLeft() + this.f36692o ? 1 : 0;
        if (i13 < viewGroup.getTop() + this.f36692o) {
            i14 |= 4;
        }
        if (i12 > viewGroup.getRight() - this.f36692o) {
            i14 |= 2;
        }
        if (i13 > viewGroup.getBottom() - this.f36692o) {
            i14 |= 8;
        }
        iArr7[i10] = i14;
        this.f36688k |= 1 << i10;
    }

    public final void o(MotionEvent motionEvent) {
        int pointerCount = motionEvent.getPointerCount();
        for (int i10 = 0; i10 < pointerCount; i10++) {
            int pointerId = motionEvent.getPointerId(i10);
            if ((this.f36688k & (1 << pointerId)) != 0) {
                float x10 = motionEvent.getX(i10);
                float y10 = motionEvent.getY(i10);
                this.f36683f[pointerId] = x10;
                this.f36684g[pointerId] = y10;
            }
        }
    }

    public final void p(int i10) {
        this.f36699v.removeCallbacks(this.f36700w);
        if (this.f36678a != i10) {
            this.f36678a = i10;
            this.f36696s.v(i10);
            if (this.f36678a == 0) {
                this.f36697t = null;
            }
        }
    }

    public final boolean q(int i10, int i11) {
        if (this.f36698u) {
            return j(i10, i11, (int) this.f36689l.getXVelocity(this.f36680c), (int) this.f36689l.getYVelocity(this.f36680c));
        }
        throw new IllegalStateException("Cannot settleCapturedViewAt outside of a call to Callback#onViewReleased");
    }

    /* JADX WARN: Removed duplicated region for block: B:53:0x00dd  */
    /* JADX WARN: Removed duplicated region for block: B:62:0x00f5  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean r(MotionEvent motionEvent) {
        View viewFindTopChildUnder;
        int actionMasked = motionEvent.getActionMasked();
        int actionIndex = motionEvent.getActionIndex();
        if (actionMasked == 0) {
            b();
        }
        if (this.f36689l == null) {
            this.f36689l = VelocityTracker.obtain();
        }
        this.f36689l.addMovement(motionEvent);
        com.bumptech.glide.h hVar = this.f36696s;
        if (actionMasked == 0) {
            float x10 = motionEvent.getX();
            float y10 = motionEvent.getY();
            int pointerId = motionEvent.getPointerId(0);
            n(x10, y10, pointerId);
            View viewFindTopChildUnder2 = findTopChildUnder((int) x10, (int) y10);
            if (viewFindTopChildUnder2 == this.f36697t && this.f36678a == 2) {
                t(pointerId, viewFindTopChildUnder2);
            }
            if ((this.f36685h[pointerId] & this.f36694q) != 0) {
                hVar.t(pointerId);
            }
        } else if (actionMasked == 1) {
            b();
        } else if (actionMasked != 2) {
            if (actionMasked != 3) {
                if (actionMasked == 5) {
                    int pointerId2 = motionEvent.getPointerId(actionIndex);
                    float x11 = motionEvent.getX(actionIndex);
                    float y11 = motionEvent.getY(actionIndex);
                    n(x11, y11, pointerId2);
                    int i10 = this.f36678a;
                    if (i10 == 0) {
                        if ((this.f36685h[pointerId2] & this.f36694q) != 0) {
                            hVar.t(pointerId2);
                        }
                    } else if (i10 == 2 && (viewFindTopChildUnder = findTopChildUnder((int) x11, (int) y11)) == this.f36697t) {
                        t(pointerId2, viewFindTopChildUnder);
                    }
                } else if (actionMasked == 6) {
                    f(motionEvent.getPointerId(actionIndex));
                }
            }
        } else if (this.f36681d != null && this.f36682e != null) {
            int pointerCount = motionEvent.getPointerCount();
            for (int i11 = 0; i11 < pointerCount; i11++) {
                int pointerId3 = motionEvent.getPointerId(i11);
                if ((this.f36688k & (1 << pointerId3)) != 0) {
                    float x12 = motionEvent.getX(i11);
                    float y12 = motionEvent.getY(i11);
                    float f10 = x12 - this.f36681d[pointerId3];
                    float f11 = y12 - this.f36682e[pointerId3];
                    View viewFindTopChildUnder3 = findTopChildUnder((int) x12, (int) y12);
                    boolean z10 = viewFindTopChildUnder3 != null && e(f10, f11, viewFindTopChildUnder3);
                    if (z10) {
                        int left = viewFindTopChildUnder3.getLeft();
                        int iJ = hVar.j(viewFindTopChildUnder3, ((int) f10) + left);
                        int top = viewFindTopChildUnder3.getTop();
                        int iK = hVar.k(viewFindTopChildUnder3, ((int) f11) + top);
                        int iN = hVar.n(viewFindTopChildUnder3);
                        int iO = hVar.o();
                        if ((iN == 0 || (iN > 0 && iJ == left)) && (iO == 0 || (iO > 0 && iK == top))) {
                            break;
                        }
                        m(f10, f11, pointerId3);
                        if (this.f36678a == 1 || (z10 && t(pointerId3, viewFindTopChildUnder3))) {
                            break;
                        }
                    }
                }
            }
            o(motionEvent);
        }
        return this.f36678a == 1;
    }

    public final boolean s(View view, int i10, int i11) {
        this.f36697t = view;
        this.f36680c = -1;
        boolean zJ = j(i10, i11, 0, 0);
        if (!zJ && this.f36678a == 0 && this.f36697t != null) {
            this.f36697t = null;
        }
        return zJ;
    }

    public final boolean t(int i10, View view) {
        if (view == this.f36697t && this.f36680c == i10) {
            return true;
        }
        if (view == null || !this.f36696s.D(i10, view)) {
            return false;
        }
        this.f36680c = i10;
        c(i10, view);
        return true;
    }
}
