package o;

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 */
/* loaded from: classes.dex */
public final class Kl0 {
    public static final Kl0 b;
    public final Hl0 a;

    static {
        int i = Build.VERSION.SDK_INT;
        if (i >= 34) {
            b = Gl0.s;
        } else if (i >= 30) {
            b = El0.r;
        } else {
            b = Hl0.b;
        }
    }

    public Kl0(WindowInsets windowInsets) {
        int i = Build.VERSION.SDK_INT;
        if (i >= 34) {
            this.a = new Gl0(this, windowInsets);
            return;
        }
        if (i >= 31) {
            this.a = new Fl0(this, windowInsets);
            return;
        }
        if (i >= 30) {
            this.a = new El0(this, windowInsets);
            return;
        }
        if (i >= 29) {
            this.a = new Dl0(this, windowInsets);
        } else if (i >= 28) {
            this.a = new Cl0(this, windowInsets);
        } else {
            this.a = new Bl0(this, windowInsets);
        }
    }

    public static LH e(LH lh, int i, int i2, int i3, int i4) {
        int iMax = Math.max(0, lh.a - i);
        int iMax2 = Math.max(0, lh.b - i2);
        int iMax3 = Math.max(0, lh.c - i3);
        int iMax4 = Math.max(0, lh.d - i4);
        return (iMax == i && iMax2 == i2 && iMax3 == i3 && iMax4 == i4) ? lh : LH.b(iMax, iMax2, iMax3, iMax4);
    }

    public static Kl0 g(View view, WindowInsets windowInsets) {
        windowInsets.getClass();
        Kl0 kl0 = new Kl0(windowInsets);
        if (view != null && view.isAttachedToWindow()) {
            WeakHashMap weakHashMap = Oj0.a;
            Kl0 kl0A = Hj0.a(view);
            Hl0 hl0 = kl0.a;
            hl0.t(kl0A);
            hl0.d(view.getRootView());
            hl0.v(view.getWindowSystemUiVisibility());
        }
        return kl0;
    }

    public final int a() {
        return this.a.l().d;
    }

    public final int b() {
        return this.a.l().a;
    }

    public final int c() {
        return this.a.l().c;
    }

    public final int d() {
        return this.a.l().b;
    }

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

    public final WindowInsets f() {
        Hl0 hl0 = this.a;
        if (hl0 instanceof Al0) {
            return ((Al0) hl0).c;
        }
        return null;
    }

    public final int hashCode() {
        Hl0 hl0 = this.a;
        if (hl0 == null) {
            return 0;
        }
        return hl0.hashCode();
    }

    public Kl0(Kl0 kl0) {
        if (kl0 != null) {
            Hl0 hl0 = kl0.a;
            int i = Build.VERSION.SDK_INT;
            if (i >= 34 && (hl0 instanceof Gl0)) {
                this.a = new Gl0(this, (Gl0) hl0);
            } else if (i >= 31 && (hl0 instanceof Fl0)) {
                this.a = new Fl0(this, (Fl0) hl0);
            } else if (i >= 30 && (hl0 instanceof El0)) {
                this.a = new El0(this, (El0) hl0);
            } else if (i >= 29 && (hl0 instanceof Dl0)) {
                this.a = new Dl0(this, (Dl0) hl0);
            } else if (i >= 28 && (hl0 instanceof Cl0)) {
                this.a = new Cl0(this, (Cl0) hl0);
            } else if (hl0 instanceof Bl0) {
                this.a = new Bl0(this, (Bl0) hl0);
            } else if (hl0 instanceof Al0) {
                this.a = new Al0(this, (Al0) hl0);
            } else {
                this.a = new Hl0(this);
            }
            hl0.e(this);
            return;
        }
        this.a = new Hl0(this);
    }
}
