package M;

import android.os.Build;
import android.view.View;
import android.view.WindowInsets;
import java.lang.reflect.Field;
import java.util.Objects;

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final b0 f4101b;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final a0 f4102a;

    static {
        int i = Build.VERSION.SDK_INT;
        if (i >= 34) {
            f4101b = Z.f4094o;
        } else if (i >= 30) {
            f4101b = Y.f4093n;
        } else {
            f4101b = a0.f4096b;
        }
    }

    public b0(WindowInsets windowInsets) {
        int i = Build.VERSION.SDK_INT;
        if (i >= 34) {
            this.f4102a = new Z(this, windowInsets);
            return;
        }
        if (i >= 30) {
            this.f4102a = new Y(this, windowInsets);
            return;
        }
        if (i >= 29) {
            this.f4102a = new X(this, windowInsets);
        } else if (i >= 28) {
            this.f4102a = new V(this, windowInsets);
        } else {
            this.f4102a = new U(this, windowInsets);
        }
    }

    public static F.b b(F.b bVar, int i, int i5, int i8, int i9) {
        int iMax = Math.max(0, bVar.f2229a - i);
        int iMax2 = Math.max(0, bVar.f2230b - i5);
        int iMax3 = Math.max(0, bVar.f2231c - i8);
        int iMax4 = Math.max(0, bVar.f2232d - i9);
        return (iMax == i && iMax2 == i5 && iMax3 == i8 && iMax4 == i9) ? bVar : F.b.a(iMax, iMax2, iMax3, iMax4);
    }

    public static b0 d(WindowInsets windowInsets, View view) {
        windowInsets.getClass();
        b0 b0Var = new b0(windowInsets);
        if (view != null && view.isAttachedToWindow()) {
            Field field = J.f4065a;
            b0 b0VarA = C.a(view);
            a0 a0Var = b0Var.f4102a;
            a0Var.m(b0VarA);
            a0Var.d(view.getRootView());
            a0Var.o(view.getWindowSystemUiVisibility());
        }
        return b0Var;
    }

    public final int a() {
        return this.f4102a.h().f2230b;
    }

    public final WindowInsets c() {
        a0 a0Var = this.f4102a;
        if (a0Var instanceof T) {
            return ((T) a0Var).f4087c;
        }
        return null;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof b0)) {
            return false;
        }
        return Objects.equals(this.f4102a, ((b0) obj).f4102a);
    }

    public final int hashCode() {
        a0 a0Var = this.f4102a;
        if (a0Var == null) {
            return 0;
        }
        return a0Var.hashCode();
    }

    public b0() {
        this.f4102a = new a0(this);
    }
}
