package b.f.j;

import android.view.DisplayCutout;
import android.view.View;
import android.view.WindowInsets;
import b.f.j.n;
import java.util.Objects;
import java.util.WeakHashMap;

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

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final w f1022a = h.h;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final i f1023b;

    public static class a extends c {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final WindowInsets.Builder f1024b;

        public a() {
            this.f1024b = new WindowInsets.Builder();
        }

        public a(w wVar) {
            WindowInsets windowInsetsF = wVar.f();
            this.f1024b = windowInsetsF != null ? new WindowInsets.Builder(windowInsetsF) : new WindowInsets.Builder();
        }

        public w b() {
            a();
            w wVarG = w.g(this.f1024b.build());
            wVarG.f1023b.k(null);
            return wVarG;
        }

        public void c(b.f.d.b bVar) {
            this.f1024b.setStableInsets(bVar.b());
        }

        public void d(b.f.d.b bVar) {
            this.f1024b.setSystemWindowInsets(bVar.b());
        }
    }

    public static class b extends a {
        public b() {
        }

        public b(w wVar) {
            super(wVar);
        }
    }

    public static class c {

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

        public c() {
            this(new w((w) null));
        }

        public c(w wVar) {
            this.f1025a = wVar;
        }

        public final void a() {
        }
    }

    public static class d extends i {

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public final WindowInsets f1026c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public b.f.d.b f1027d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public w f1028e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public b.f.d.b f1029f;

        public d(w wVar, WindowInsets windowInsets) {
            super(wVar);
            this.f1027d = null;
            this.f1026c = windowInsets;
        }

        @Override // b.f.j.w.i
        public void d(View view) {
            b.f.d.b bVarM = m(view);
            if (bVarM == null) {
                bVarM = b.f.d.b.f922a;
            }
            n(bVarM);
        }

        @Override // b.f.j.w.i
        public boolean equals(Object obj) {
            if (super.equals(obj)) {
                return Objects.equals(this.f1029f, ((d) obj).f1029f);
            }
            return false;
        }

        @Override // b.f.j.w.i
        public final b.f.d.b g() {
            if (this.f1027d == null) {
                this.f1027d = b.f.d.b.a(this.f1026c.getSystemWindowInsetLeft(), this.f1026c.getSystemWindowInsetTop(), this.f1026c.getSystemWindowInsetRight(), this.f1026c.getSystemWindowInsetBottom());
            }
            return this.f1027d;
        }

        @Override // b.f.j.w.i
        public w h(int i, int i2, int i3, int i4) {
            b bVar = new b(w.g(this.f1026c));
            bVar.d(w.e(g(), i, i2, i3, i4));
            bVar.c(w.e(f(), i, i2, i3, i4));
            return bVar.b();
        }

        @Override // b.f.j.w.i
        public boolean j() {
            return this.f1026c.isRound();
        }

        @Override // b.f.j.w.i
        public void k(b.f.d.b[] bVarArr) {
        }

        @Override // b.f.j.w.i
        public void l(w wVar) {
            this.f1028e = wVar;
        }

        public final b.f.d.b m(View view) {
            throw new UnsupportedOperationException("getVisibleInsets() should not be called on API >= 30. Use WindowInsets.isVisible() instead.");
        }

        public void n(b.f.d.b bVar) {
            this.f1029f = bVar;
        }
    }

    public static class e extends d {
        public b.f.d.b g;

        public e(w wVar, WindowInsets windowInsets) {
            super(wVar, windowInsets);
            this.g = null;
        }

        @Override // b.f.j.w.i
        public w b() {
            return w.g(this.f1026c.consumeStableInsets());
        }

        @Override // b.f.j.w.i
        public w c() {
            return w.g(this.f1026c.consumeSystemWindowInsets());
        }

        @Override // b.f.j.w.i
        public final b.f.d.b f() {
            if (this.g == null) {
                this.g = b.f.d.b.a(this.f1026c.getStableInsetLeft(), this.f1026c.getStableInsetTop(), this.f1026c.getStableInsetRight(), this.f1026c.getStableInsetBottom());
            }
            return this.g;
        }

        @Override // b.f.j.w.i
        public boolean i() {
            return this.f1026c.isConsumed();
        }
    }

    public static class f extends e {
        public f(w wVar, WindowInsets windowInsets) {
            super(wVar, windowInsets);
        }

        @Override // b.f.j.w.i
        public w a() {
            return w.g(this.f1026c.consumeDisplayCutout());
        }

        @Override // b.f.j.w.i
        public b.f.j.d e() {
            DisplayCutout displayCutout = this.f1026c.getDisplayCutout();
            if (displayCutout == null) {
                return null;
            }
            return new b.f.j.d(displayCutout);
        }

        @Override // b.f.j.w.d, b.f.j.w.i
        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof f)) {
                return false;
            }
            f fVar = (f) obj;
            return Objects.equals(this.f1026c, fVar.f1026c) && Objects.equals(this.f1029f, fVar.f1029f);
        }

        @Override // b.f.j.w.i
        public int hashCode() {
            return this.f1026c.hashCode();
        }
    }

    public static class g extends f {
        public g(w wVar, WindowInsets windowInsets) {
            super(wVar, windowInsets);
        }

        @Override // b.f.j.w.d, b.f.j.w.i
        public w h(int i, int i2, int i3, int i4) {
            return w.g(this.f1026c.inset(i, i2, i3, i4));
        }
    }

    public static class h extends g {
        public static final w h = w.g(WindowInsets.CONSUMED);

        public h(w wVar, WindowInsets windowInsets) {
            super(wVar, windowInsets);
        }

        @Override // b.f.j.w.d, b.f.j.w.i
        public final void d(View view) {
        }
    }

    public static class i {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        public static final w f1030a = new b().b().f1023b.a().f1023b.b().f1023b.c();

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final w f1031b;

        public i(w wVar) {
            this.f1031b = wVar;
        }

        public w a() {
            return this.f1031b;
        }

        public w b() {
            return this.f1031b;
        }

        public w c() {
            return this.f1031b;
        }

        public void d(View view) {
        }

        public b.f.j.d e() {
            return null;
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof i)) {
                return false;
            }
            i iVar = (i) obj;
            return j() == iVar.j() && i() == iVar.i() && Objects.equals(g(), iVar.g()) && Objects.equals(f(), iVar.f()) && Objects.equals(e(), iVar.e());
        }

        public b.f.d.b f() {
            return b.f.d.b.f922a;
        }

        public b.f.d.b g() {
            return b.f.d.b.f922a;
        }

        public w h(int i, int i2, int i3, int i4) {
            return f1030a;
        }

        public int hashCode() {
            return Objects.hash(Boolean.valueOf(j()), Boolean.valueOf(i()), g(), f(), e());
        }

        public boolean i() {
            return false;
        }

        public boolean j() {
            return false;
        }

        public void k(b.f.d.b[] bVarArr) {
        }

        public void l(w wVar) {
        }
    }

    public w(WindowInsets windowInsets) {
        this.f1023b = new h(this, windowInsets);
    }

    public w(w wVar) {
        this.f1023b = new i(this);
    }

    public static b.f.d.b e(b.f.d.b bVar, int i2, int i3, int i4, int i5) {
        int iMax = Math.max(0, bVar.f923b - i2);
        int iMax2 = Math.max(0, bVar.f924c - i3);
        int iMax3 = Math.max(0, bVar.f925d - i4);
        int iMax4 = Math.max(0, bVar.f926e - i5);
        return (iMax == i2 && iMax2 == i3 && iMax3 == i4 && iMax4 == i5) ? bVar : b.f.d.b.a(iMax, iMax2, iMax3, iMax4);
    }

    public static w g(WindowInsets windowInsets) {
        return h(windowInsets, null);
    }

    public static w h(WindowInsets windowInsets, View view) {
        Objects.requireNonNull(windowInsets);
        w wVar = new w(windowInsets);
        if (view != null && view.isAttachedToWindow()) {
            WeakHashMap<View, s> weakHashMap = n.f1007a;
            wVar.f1023b.l(n.d.a(view));
            wVar.f1023b.d(view.getRootView());
        }
        return wVar;
    }

    @Deprecated
    public int a() {
        return this.f1023b.g().f926e;
    }

    @Deprecated
    public int b() {
        return this.f1023b.g().f923b;
    }

    @Deprecated
    public int c() {
        return this.f1023b.g().f925d;
    }

    @Deprecated
    public int d() {
        return this.f1023b.g().f924c;
    }

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

    public WindowInsets f() {
        i iVar = this.f1023b;
        if (iVar instanceof d) {
            return ((d) iVar).f1026c;
        }
        return null;
    }

    public int hashCode() {
        i iVar = this.f1023b;
        if (iVar == null) {
            return 0;
        }
        return iVar.hashCode();
    }
}
