package P;

import L1.Z0;
import android.os.Build;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowInsetsAnimation;
import android.view.WindowInsetsAnimation$Callback;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public final class Y extends WindowInsetsAnimation$Callback {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final V1.f f2413a;

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final HashMap f2416d;

    public Y(V1.f fVar) {
        super(0);
        this.f2416d = new HashMap();
        this.f2413a = fVar;
    }

    public final b0 a(WindowInsetsAnimation windowInsetsAnimation) {
        b0 b0Var = (b0) this.f2416d.get(windowInsetsAnimation);
        if (b0Var == null) {
            b0Var = new b0(0, null, 0L);
            if (Build.VERSION.SDK_INT >= 30) {
                b0Var.f2426a = new Z(windowInsetsAnimation);
            }
            this.f2416d.put(windowInsetsAnimation, b0Var);
        }
        return b0Var;
    }

    public final void onEnd(WindowInsetsAnimation windowInsetsAnimation) {
        V1.f fVar = this.f2413a;
        a(windowInsetsAnimation);
        ((View) fVar.f2987d).setTranslationY(0.0f);
        this.f2416d.remove(windowInsetsAnimation);
    }

    public final void onPrepare(WindowInsetsAnimation windowInsetsAnimation) {
        V1.f fVar = this.f2413a;
        a(windowInsetsAnimation);
        View view = (View) fVar.f2987d;
        int[] iArr = (int[]) fVar.f2988e;
        view.getLocationOnScreen(iArr);
        fVar.f2984a = iArr[1];
    }

    public final WindowInsets onProgress(WindowInsets windowInsets, List list) {
        ArrayList arrayList = this.f2415c;
        if (arrayList == null) {
            ArrayList arrayList2 = new ArrayList(list.size());
            this.f2415c = arrayList2;
            this.f2414b = Collections.unmodifiableList(arrayList2);
        } else {
            arrayList.clear();
        }
        for (int size = list.size() - 1; size >= 0; size--) {
            WindowInsetsAnimation windowInsetsAnimationL = Z0.l(list.get(size));
            b0 b0VarA = a(windowInsetsAnimationL);
            b0VarA.f2426a.d(windowInsetsAnimationL.getFraction());
            this.f2415c.add(b0VarA);
        }
        V1.f fVar = this.f2413a;
        s0 s0VarD = s0.d(null, windowInsets);
        fVar.e(s0VarD, this.f2414b);
        return s0VarD.c();
    }

    public final WindowInsetsAnimation.Bounds onStart(WindowInsetsAnimation windowInsetsAnimation, WindowInsetsAnimation.Bounds bounds) {
        V1.f fVar = this.f2413a;
        a(windowInsetsAnimation);
        G.b bVarC = G.b.c(bounds.getLowerBound());
        G.b bVarC2 = G.b.c(bounds.getUpperBound());
        View view = (View) fVar.f2987d;
        int[] iArr = (int[]) fVar.f2988e;
        view.getLocationOnScreen(iArr);
        int i = fVar.f2984a - iArr[1];
        fVar.f2985b = i;
        view.setTranslationY(i);
        Z0.o();
        return Z0.j(bVarC.d(), bVarC2.d());
    }
}
