package o;

import android.animation.ValueAnimator;
import android.os.Build;
import android.view.View;
import android.view.WindowInsets;
import java.util.Objects;
import java.util.WeakHashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.nl0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class ViewOnApplyWindowInsetsListenerC1985nl0 implements View.OnApplyWindowInsetsListener {
    public final AbstractC2071oh a;
    public Kl0 b;

    public ViewOnApplyWindowInsetsListenerC1985nl0(View view, AbstractC2071oh abstractC2071oh) {
        Kl0 kl0B;
        this.a = abstractC2071oh;
        WeakHashMap weakHashMap = Oj0.a;
        Kl0 kl0A = Hj0.a(view);
        if (kl0A != null) {
            int i = Build.VERSION.SDK_INT;
            kl0B = (i >= 34 ? new C3029yl0(kl0A) : i >= 31 ? new C2934xl0(kl0A) : i >= 30 ? new C2839wl0(kl0A) : i >= 29 ? new C2744vl0(kl0A) : new C2649ul0(kl0A)).b();
        } else {
            kl0B = null;
        }
        this.b = kl0B;
    }

    @Override // android.view.View.OnApplyWindowInsetsListener
    public final WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
        int[] iArr;
        boolean z;
        if (!view.isLaidOut()) {
            this.b = Kl0.g(view, windowInsets);
            return C2080ol0.j(view, windowInsets);
        }
        Kl0 kl0G = Kl0.g(view, windowInsets);
        Hl0 hl0 = kl0G.a;
        if (this.b == null) {
            WeakHashMap weakHashMap = Oj0.a;
            this.b = Hj0.a(view);
        }
        if (this.b == null) {
            this.b = kl0G;
            return C2080ol0.j(view, windowInsets);
        }
        AbstractC2071oh abstractC2071ohK = C2080ol0.k(view);
        if (abstractC2071ohK != null && Objects.equals((Kl0) abstractC2071ohK.m, kl0G)) {
            return C2080ol0.j(view, windowInsets);
        }
        int[] iArr2 = new int[1];
        int[] iArr3 = new int[1];
        Kl0 kl0 = this.b;
        int i = 1;
        while (i <= 512) {
            LH lhG = hl0.g(i);
            LH lhG2 = kl0.a.g(i);
            int i2 = lhG.a;
            int i3 = lhG.d;
            int i4 = lhG.c;
            int i5 = lhG.b;
            int i6 = lhG2.a;
            int i7 = lhG2.d;
            int i8 = lhG2.c;
            int i9 = lhG2.b;
            if (i2 > i6 || i5 > i9 || i4 > i8 || i3 > i7) {
                iArr = iArr2;
                z = true;
            } else {
                iArr = iArr2;
                z = false;
            }
            if (z != (i2 < i6 || i5 < i9 || i4 < i8 || i3 < i7)) {
                if (z) {
                    iArr[0] = iArr[0] | i;
                } else {
                    iArr3[0] = iArr3[0] | i;
                }
            }
            i <<= 1;
            iArr2 = iArr;
        }
        int i10 = iArr2[0];
        int i11 = iArr3[0];
        int i12 = i10 | i11;
        if (i12 == 0) {
            this.b = kl0G;
            return C2080ol0.j(view, windowInsets);
        }
        Kl0 kl02 = this.b;
        C2554tl0 c2554tl0 = new C2554tl0(i12, (i10 & 8) != 0 ? C2080ol0.e : (i11 & 8) != 0 ? C2080ol0.f : (i10 & 519) != 0 ? C2080ol0.g : (i11 & 519) != 0 ? C2080ol0.h : null, (i12 & 8) != 0 ? 160L : 250L);
        c2554tl0.a.e(0.0f);
        ValueAnimator duration = ValueAnimator.ofFloat(0.0f, 1.0f).setDuration(c2554tl0.a.b());
        LH lhG3 = hl0.g(i12);
        LH lhG4 = kl02.a.g(i12);
        int iMin = Math.min(lhG3.a, lhG4.a);
        int i13 = lhG3.b;
        int i14 = lhG4.b;
        int iMin2 = Math.min(i13, i14);
        int i15 = lhG3.c;
        int i16 = lhG4.c;
        int iMin3 = Math.min(i15, i16);
        int i17 = lhG3.d;
        int i18 = lhG4.d;
        C3040yr c3040yr = new C3040yr(14, LH.b(iMin, iMin2, iMin3, Math.min(i17, i18)), LH.b(Math.max(lhG3.a, lhG4.a), Math.max(i13, i14), Math.max(i15, i16), Math.max(i17, i18)));
        C2080ol0.g(view, c2554tl0, kl0G, false);
        duration.addUpdateListener(new C1890ml0(c2554tl0, kl0G, kl02, i12, view));
        duration.addListener(new C2165pg0(view, c2554tl0));
        UT.a(view, new RunnableC0266Kg(view, c2554tl0, c3040yr, duration, 1, false));
        this.b = kl0G;
        return C2080ol0.j(view, windowInsets);
    }
}
