package p023h0;

import android.graphics.Insets;
import android.graphics.Rect;
import android.os.Build;
import android.util.Log;
import android.view.DisplayCutout;
import android.view.View;
import android.view.WindowInsets;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import p020g0.C0733c;
import p020g0.C0734d;
import p020g0.C0737f;
import p073z.C1877g;

/* renamed from: h0.q4 */
/* loaded from: classes.dex */
public class C0920q4 {

    /* renamed from: b */
    public static final C0920q4 f2461b;

    /* renamed from: a */
    public final C0932l f2462a;

    /* renamed from: h0.q4$a */
    /* loaded from: classes.dex */
    public static class C0921a {

        /* renamed from: a */
        public static Field f2463a;

        /* renamed from: b */
        public static Field f2464b;

        /* renamed from: c */
        public static Field f2465c;

        /* renamed from: d */
        public static boolean f2466d;

        static {
            String message;
            try {
                Field declaredField = View.class.getDeclaredField("mAttachInfo");
                f2463a = declaredField;
                declaredField.setAccessible(true);
                Class<?> cls = Class.forName("android.view.View$AttachInfo");
                Field declaredField2 = cls.getDeclaredField("mStableInsets");
                f2464b = declaredField2;
                declaredField2.setAccessible(true);
                Field declaredField3 = cls.getDeclaredField("mContentInsets");
                f2465c = declaredField3;
                declaredField3.setAccessible(true);
                f2466d = true;
            } catch (ReflectiveOperationException e) {
                StringBuilder sb = new StringBuilder();
                sb.append("Failed to get visible insets from AttachInfo ");
                message = e.getMessage();
                sb.append(message);
                Log.w("WindowInsetsCompat", sb.toString(), e);
            }
        }

        /* renamed from: a */
        public static C0920q4 m2567a(View view) {
            boolean isAttachedToWindow;
            if (f2466d) {
                isAttachedToWindow = view.isAttachedToWindow();
                if (isAttachedToWindow) {
                    try {
                        Object obj = f2463a.get(view.getRootView());
                        if (obj != null) {
                            Rect rect = (Rect) f2464b.get(obj);
                            Rect rect2 = (Rect) f2465c.get(obj);
                            if (rect != null && rect2 != null) {
                                C0920q4 m2566a = new C0922b().m2565b(C1877g.m141c(rect)).m2564c(C1877g.m141c(rect2)).m2566a();
                                m2566a.m2572r(m2566a);
                                m2566a.m2586d(view.getRootView());
                                return m2566a;
                            }
                        }
                    } catch (IllegalAccessException e) {
                        Log.w("WindowInsetsCompat", "Failed to get insets from AttachInfo. " + e.getMessage(), e);
                    }
                }
            }
            return null;
        }
    }

    /* renamed from: h0.q4$b */
    /* loaded from: classes.dex */
    public static final class C0922b {

        /* renamed from: a */
        public final C0926f f2467a;

        public C0922b() {
            int i = Build.VERSION.SDK_INT;
            this.f2467a = i >= 30 ? new C0925e() : i >= 29 ? new C0924d() : i >= 20 ? new C0923c() : new C0926f();
        }

        public C0922b(C0920q4 c0920q4) {
            int i = Build.VERSION.SDK_INT;
            this.f2467a = i >= 30 ? new C0925e(c0920q4) : i >= 29 ? new C0924d(c0920q4) : i >= 20 ? new C0923c(c0920q4) : new C0926f(c0920q4);
        }

        /* renamed from: a */
        public C0920q4 m2566a() {
            return this.f2467a.mo2561b();
        }

        @Deprecated
        /* renamed from: b */
        public C0922b m2565b(C1877g c1877g) {
            this.f2467a.mo2559d(c1877g);
            return this;
        }

        @Deprecated
        /* renamed from: c */
        public C0922b m2564c(C1877g c1877g) {
            this.f2467a.mo2557f(c1877g);
            return this;
        }
    }

    /* renamed from: h0.q4$c */
    /* loaded from: classes.dex */
    public static class C0923c extends C0926f {

        /* renamed from: e */
        public static Field f2468e = null;

        /* renamed from: f */
        public static boolean f2469f = false;

        /* renamed from: g */
        public static Constructor<WindowInsets> f2470g = null;

        /* renamed from: h */
        public static boolean f2471h = false;

        /* renamed from: c */
        public WindowInsets f2472c;

        /* renamed from: d */
        public C1877g f2473d;

        public C0923c() {
            this.f2472c = m2563h();
        }

        public C0923c(C0920q4 c0920q4) {
            super(c0920q4);
            this.f2472c = c0920q4.m2570t();
        }

        /* renamed from: h */
        private static WindowInsets m2563h() {
            if (!f2469f) {
                try {
                    f2468e = WindowInsets.class.getDeclaredField("CONSUMED");
                } catch (ReflectiveOperationException e) {
                    Log.i("WindowInsetsCompat", "Could not retrieve WindowInsets.CONSUMED field", e);
                }
                f2469f = true;
            }
            Field field = f2468e;
            if (field != null) {
                try {
                    WindowInsets windowInsets = (WindowInsets) field.get(null);
                    if (windowInsets != null) {
                        return new WindowInsets(windowInsets);
                    }
                } catch (ReflectiveOperationException e2) {
                    Log.i("WindowInsetsCompat", "Could not get value from WindowInsets.CONSUMED field", e2);
                }
            }
            if (!f2471h) {
                try {
                    f2470g = WindowInsets.class.getConstructor(Rect.class);
                } catch (ReflectiveOperationException e3) {
                    Log.i("WindowInsetsCompat", "Could not retrieve WindowInsets(Rect) constructor", e3);
                }
                f2471h = true;
            }
            Constructor<WindowInsets> constructor = f2470g;
            if (constructor != null) {
                try {
                    return constructor.newInstance(new Rect());
                } catch (ReflectiveOperationException e4) {
                    Log.i("WindowInsetsCompat", "Could not invoke WindowInsets(Rect) constructor", e4);
                }
            }
            return null;
        }

        @Override // p023h0.C0920q4.C0926f
        /* renamed from: b */
        public C0920q4 mo2561b() {
            m2562a();
            C0920q4 m2569u = C0920q4.m2569u(this.f2472c);
            m2569u.m2574p(this.f2476b);
            m2569u.m2571s(this.f2473d);
            return m2569u;
        }

        @Override // p023h0.C0920q4.C0926f
        /* renamed from: d */
        public void mo2559d(C1877g c1877g) {
            this.f2473d = c1877g;
        }

        @Override // p023h0.C0920q4.C0926f
        /* renamed from: f */
        public void mo2557f(C1877g c1877g) {
            WindowInsets replaceSystemWindowInsets;
            WindowInsets windowInsets = this.f2472c;
            if (windowInsets != null) {
                replaceSystemWindowInsets = windowInsets.replaceSystemWindowInsets(c1877g.f4680a, c1877g.f4681b, c1877g.f4682c, c1877g.f4683d);
                this.f2472c = replaceSystemWindowInsets;
            }
        }
    }

    /* renamed from: h0.q4$d */
    /* loaded from: classes.dex */
    public static class C0924d extends C0926f {

        /* renamed from: c */
        public final WindowInsets.Builder f2474c;

        public C0924d() {
            this.f2474c = new WindowInsets.Builder();
        }

        public C0924d(C0920q4 c0920q4) {
            super(c0920q4);
            WindowInsets m2570t = c0920q4.m2570t();
            this.f2474c = m2570t != null ? new WindowInsets.Builder(m2570t) : new WindowInsets.Builder();
        }

        @Override // p023h0.C0920q4.C0926f
        /* renamed from: b */
        public C0920q4 mo2561b() {
            WindowInsets build;
            m2562a();
            build = this.f2474c.build();
            C0920q4 m2569u = C0920q4.m2569u(build);
            m2569u.m2574p(this.f2476b);
            return m2569u;
        }

        @Override // p023h0.C0920q4.C0926f
        /* renamed from: c */
        public void mo2560c(C1877g c1877g) {
            this.f2474c.setMandatorySystemGestureInsets(c1877g.m139e());
        }

        @Override // p023h0.C0920q4.C0926f
        /* renamed from: d */
        public void mo2559d(C1877g c1877g) {
            this.f2474c.setStableInsets(c1877g.m139e());
        }

        @Override // p023h0.C0920q4.C0926f
        /* renamed from: e */
        public void mo2558e(C1877g c1877g) {
            this.f2474c.setSystemGestureInsets(c1877g.m139e());
        }

        @Override // p023h0.C0920q4.C0926f
        /* renamed from: f */
        public void mo2557f(C1877g c1877g) {
            this.f2474c.setSystemWindowInsets(c1877g.m139e());
        }

        @Override // p023h0.C0920q4.C0926f
        /* renamed from: g */
        public void mo2556g(C1877g c1877g) {
            this.f2474c.setTappableElementInsets(c1877g.m139e());
        }
    }

    /* renamed from: h0.q4$e */
    /* loaded from: classes.dex */
    public static class C0925e extends C0924d {
        public C0925e() {
        }

        public C0925e(C0920q4 c0920q4) {
            super(c0920q4);
        }
    }

    /* renamed from: h0.q4$f */
    /* loaded from: classes.dex */
    public static class C0926f {

        /* renamed from: a */
        public final C0920q4 f2475a;

        /* renamed from: b */
        public C1877g[] f2476b;

        public C0926f() {
            this(new C0920q4((C0920q4) null));
        }

        public C0926f(C0920q4 c0920q4) {
            this.f2475a = c0920q4;
        }

        /* renamed from: a */
        public final void m2562a() {
            C1877g[] c1877gArr = this.f2476b;
            if (c1877gArr != null) {
                C1877g c1877g = c1877gArr[C0933m.m2531a(1)];
                C1877g c1877g2 = this.f2476b[C0933m.m2531a(2)];
                if (c1877g2 == null) {
                    c1877g2 = this.f2475a.m2584f(2);
                }
                if (c1877g == null) {
                    c1877g = this.f2475a.m2584f(1);
                }
                mo2557f(C1877g.m143a(c1877g, c1877g2));
                C1877g c1877g3 = this.f2476b[C0933m.m2531a(16)];
                if (c1877g3 != null) {
                    mo2558e(c1877g3);
                }
                C1877g c1877g4 = this.f2476b[C0933m.m2531a(32)];
                if (c1877g4 != null) {
                    mo2560c(c1877g4);
                }
                C1877g c1877g5 = this.f2476b[C0933m.m2531a(64)];
                if (c1877g5 != null) {
                    mo2556g(c1877g5);
                }
            }
        }

        /* renamed from: b */
        public C0920q4 mo2561b() {
            m2562a();
            return this.f2475a;
        }

        /* renamed from: c */
        public void mo2560c(C1877g c1877g) {
        }

        /* renamed from: d */
        public void mo2559d(C1877g c1877g) {
        }

        /* renamed from: e */
        public void mo2558e(C1877g c1877g) {
        }

        /* renamed from: f */
        public void mo2557f(C1877g c1877g) {
        }

        /* renamed from: g */
        public void mo2556g(C1877g c1877g) {
        }
    }

    /* renamed from: h0.q4$g */
    /* loaded from: classes.dex */
    public static class C0927g extends C0932l {

        /* renamed from: h */
        public static boolean f2477h = false;

        /* renamed from: i */
        public static Method f2478i;

        /* renamed from: j */
        public static Class<?> f2479j;

        /* renamed from: k */
        public static Field f2480k;

        /* renamed from: l */
        public static Field f2481l;

        /* renamed from: c */
        public final WindowInsets f2482c;

        /* renamed from: d */
        public C1877g[] f2483d;

        /* renamed from: e */
        public C1877g f2484e;

        /* renamed from: f */
        public C0920q4 f2485f;

        /* renamed from: g */
        public C1877g f2486g;

        public C0927g(C0920q4 c0920q4, WindowInsets windowInsets) {
            super(c0920q4);
            this.f2484e = null;
            this.f2482c = windowInsets;
        }

        public C0927g(C0920q4 c0920q4, C0927g c0927g) {
            this(c0920q4, new WindowInsets(c0927g.f2482c));
        }

        /* renamed from: t */
        private C1877g m2555t(int i, boolean z) {
            C1877g c1877g = C1877g.f4679e;
            for (int i2 = 1; i2 <= 256; i2 <<= 1) {
                if ((i & i2) != 0) {
                    c1877g = C1877g.m143a(c1877g, m2554u(i2, z));
                }
            }
            return c1877g;
        }

        /* renamed from: v */
        private C1877g m2553v() {
            C0920q4 c0920q4 = this.f2485f;
            return c0920q4 != null ? c0920q4.m2583g() : C1877g.f4679e;
        }

        /* renamed from: w */
        private C1877g m2552w(View view) {
            String message;
            if (Build.VERSION.SDK_INT < 30) {
                if (!f2477h) {
                    m2551x();
                }
                Method method = f2478i;
                if (method != null && f2479j != null && f2480k != null) {
                    try {
                        Object invoke = method.invoke(view, new Object[0]);
                        if (invoke == null) {
                            Log.w("WindowInsetsCompat", "Failed to get visible insets. getViewRootImpl() returned null from the provided view. This means that the view is either not attached or the method has been overridden", new NullPointerException());
                            return null;
                        }
                        Rect rect = (Rect) f2480k.get(f2481l.get(invoke));
                        if (rect != null) {
                            return C1877g.m141c(rect);
                        }
                        return null;
                    } catch (ReflectiveOperationException e) {
                        StringBuilder sb = new StringBuilder();
                        sb.append("Failed to get visible insets. (Reflection error). ");
                        message = e.getMessage();
                        sb.append(message);
                        Log.e("WindowInsetsCompat", sb.toString(), e);
                    }
                }
                return null;
            }
            throw new UnsupportedOperationException("getVisibleInsets() should not be called on API >= 30. Use WindowInsets.isVisible() instead.");
        }

        /* renamed from: x */
        private static void m2551x() {
            String message;
            try {
                f2478i = View.class.getDeclaredMethod("getViewRootImpl", new Class[0]);
                Class<?> cls = Class.forName("android.view.View$AttachInfo");
                f2479j = cls;
                f2480k = cls.getDeclaredField("mVisibleInsets");
                f2481l = Class.forName("android.view.ViewRootImpl").getDeclaredField("mAttachInfo");
                f2480k.setAccessible(true);
                f2481l.setAccessible(true);
            } catch (ReflectiveOperationException e) {
                StringBuilder sb = new StringBuilder();
                sb.append("Failed to get visible insets. (Reflection error). ");
                message = e.getMessage();
                sb.append(message);
                Log.e("WindowInsetsCompat", sb.toString(), e);
            }
            f2477h = true;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: d */
        public void mo2547d(View view) {
            C1877g m2552w = m2552w(view);
            if (m2552w == null) {
                m2552w = C1877g.f4679e;
            }
            mo2534q(m2552w);
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: e */
        public void mo2546e(C0920q4 c0920q4) {
            c0920q4.m2572r(this.f2485f);
            c0920q4.m2573q(this.f2486g);
        }

        @Override // p023h0.C0920q4.C0932l
        public boolean equals(Object obj) {
            if (super.equals(obj)) {
                return C0733c.m3044a(this.f2486g, ((C0927g) obj).f2486g);
            }
            return false;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: g */
        public C1877g mo2544g(int i) {
            return m2555t(i, false);
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: k */
        public final C1877g mo2540k() {
            int systemWindowInsetLeft;
            int systemWindowInsetTop;
            int systemWindowInsetRight;
            int systemWindowInsetBottom;
            if (this.f2484e == null) {
                systemWindowInsetLeft = this.f2482c.getSystemWindowInsetLeft();
                systemWindowInsetTop = this.f2482c.getSystemWindowInsetTop();
                systemWindowInsetRight = this.f2482c.getSystemWindowInsetRight();
                systemWindowInsetBottom = this.f2482c.getSystemWindowInsetBottom();
                this.f2484e = C1877g.m142b(systemWindowInsetLeft, systemWindowInsetTop, systemWindowInsetRight, systemWindowInsetBottom);
            }
            return this.f2484e;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: m */
        public C0920q4 mo2538m(int i, int i2, int i3, int i4) {
            C0922b c0922b = new C0922b(C0920q4.m2569u(this.f2482c));
            c0922b.m2564c(C0920q4.m2577m(mo2540k(), i, i2, i3, i4));
            c0922b.m2565b(C0920q4.m2577m(mo2542i(), i, i2, i3, i4));
            return c0922b.m2566a();
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: o */
        public boolean mo2536o() {
            boolean isRound;
            isRound = this.f2482c.isRound();
            return isRound;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: p */
        public void mo2535p(C1877g[] c1877gArr) {
            this.f2483d = c1877gArr;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: q */
        public void mo2534q(C1877g c1877g) {
            this.f2486g = c1877g;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: r */
        public void mo2533r(C0920q4 c0920q4) {
            this.f2485f = c0920q4;
        }

        /* renamed from: u */
        public C1877g m2554u(int i, boolean z) {
            C1877g m2583g;
            int i2;
            if (i == 1) {
                return z ? C1877g.m142b(0, Math.max(m2553v().f4681b, mo2540k().f4681b), 0, 0) : C1877g.m142b(0, mo2540k().f4681b, 0, 0);
            }
            if (i == 2) {
                if (z) {
                    C1877g m2553v = m2553v();
                    C1877g mo2542i = mo2542i();
                    return C1877g.m142b(Math.max(m2553v.f4680a, mo2542i.f4680a), 0, Math.max(m2553v.f4682c, mo2542i.f4682c), Math.max(m2553v.f4683d, mo2542i.f4683d));
                }
                C1877g mo2540k = mo2540k();
                C0920q4 c0920q4 = this.f2485f;
                m2583g = c0920q4 != null ? c0920q4.m2583g() : null;
                int i3 = mo2540k.f4683d;
                if (m2583g != null) {
                    i3 = Math.min(i3, m2583g.f4683d);
                }
                return C1877g.m142b(mo2540k.f4680a, 0, mo2540k.f4682c, i3);
            } else if (i != 8) {
                if (i != 16) {
                    if (i != 32) {
                        if (i != 64) {
                            if (i != 128) {
                                return C1877g.f4679e;
                            }
                            C0920q4 c0920q42 = this.f2485f;
                            C0914q m2585e = c0920q42 != null ? c0920q42.m2585e() : mo2545f();
                            return m2585e != null ? C1877g.m142b(m2585e.m2603b(), m2585e.m2601d(), m2585e.m2602c(), m2585e.m2604a()) : C1877g.f4679e;
                        }
                        return mo2539l();
                    }
                    return mo2543h();
                }
                return mo2541j();
            } else {
                C1877g[] c1877gArr = this.f2483d;
                m2583g = c1877gArr != null ? c1877gArr[C0933m.m2531a(8)] : null;
                if (m2583g != null) {
                    return m2583g;
                }
                C1877g mo2540k2 = mo2540k();
                C1877g m2553v2 = m2553v();
                int i4 = mo2540k2.f4683d;
                if (i4 > m2553v2.f4683d) {
                    return C1877g.m142b(0, 0, 0, i4);
                }
                C1877g c1877g = this.f2486g;
                return (c1877g == null || c1877g.equals(C1877g.f4679e) || (i2 = this.f2486g.f4683d) <= m2553v2.f4683d) ? C1877g.f4679e : C1877g.m142b(0, 0, 0, i2);
            }
        }
    }

    /* renamed from: h0.q4$h */
    /* loaded from: classes.dex */
    public static class C0928h extends C0927g {

        /* renamed from: m */
        public C1877g f2487m;

        public C0928h(C0920q4 c0920q4, WindowInsets windowInsets) {
            super(c0920q4, windowInsets);
            this.f2487m = null;
        }

        public C0928h(C0920q4 c0920q4, C0928h c0928h) {
            super(c0920q4, c0928h);
            this.f2487m = null;
            this.f2487m = c0928h.f2487m;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: b */
        public C0920q4 mo2549b() {
            WindowInsets consumeStableInsets;
            consumeStableInsets = this.f2482c.consumeStableInsets();
            return C0920q4.m2569u(consumeStableInsets);
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: c */
        public C0920q4 mo2548c() {
            WindowInsets consumeSystemWindowInsets;
            consumeSystemWindowInsets = this.f2482c.consumeSystemWindowInsets();
            return C0920q4.m2569u(consumeSystemWindowInsets);
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: i */
        public final C1877g mo2542i() {
            int stableInsetLeft;
            int stableInsetTop;
            int stableInsetRight;
            int stableInsetBottom;
            if (this.f2487m == null) {
                stableInsetLeft = this.f2482c.getStableInsetLeft();
                stableInsetTop = this.f2482c.getStableInsetTop();
                stableInsetRight = this.f2482c.getStableInsetRight();
                stableInsetBottom = this.f2482c.getStableInsetBottom();
                this.f2487m = C1877g.m142b(stableInsetLeft, stableInsetTop, stableInsetRight, stableInsetBottom);
            }
            return this.f2487m;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: n */
        public boolean mo2537n() {
            boolean isConsumed;
            isConsumed = this.f2482c.isConsumed();
            return isConsumed;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: s */
        public void mo2532s(C1877g c1877g) {
            this.f2487m = c1877g;
        }
    }

    /* renamed from: h0.q4$i */
    /* loaded from: classes.dex */
    public static class C0929i extends C0928h {
        public C0929i(C0920q4 c0920q4, WindowInsets windowInsets) {
            super(c0920q4, windowInsets);
        }

        public C0929i(C0920q4 c0920q4, C0929i c0929i) {
            super(c0920q4, c0929i);
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: a */
        public C0920q4 mo2550a() {
            WindowInsets consumeDisplayCutout;
            consumeDisplayCutout = this.f2482c.consumeDisplayCutout();
            return C0920q4.m2569u(consumeDisplayCutout);
        }

        @Override // p023h0.C0920q4.C0927g, p023h0.C0920q4.C0932l
        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj instanceof C0929i) {
                C0929i c0929i = (C0929i) obj;
                return C0733c.m3044a(this.f2482c, c0929i.f2482c) && C0733c.m3044a(this.f2486g, c0929i.f2486g);
            }
            return false;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: f */
        public C0914q mo2545f() {
            DisplayCutout displayCutout;
            displayCutout = this.f2482c.getDisplayCutout();
            return C0914q.m2600e(displayCutout);
        }

        @Override // p023h0.C0920q4.C0932l
        public int hashCode() {
            int hashCode;
            hashCode = this.f2482c.hashCode();
            return hashCode;
        }
    }

    /* renamed from: h0.q4$j */
    /* loaded from: classes.dex */
    public static class C0930j extends C0929i {

        /* renamed from: n */
        public C1877g f2488n;

        /* renamed from: o */
        public C1877g f2489o;

        /* renamed from: p */
        public C1877g f2490p;

        public C0930j(C0920q4 c0920q4, WindowInsets windowInsets) {
            super(c0920q4, windowInsets);
            this.f2488n = null;
            this.f2489o = null;
            this.f2490p = null;
        }

        public C0930j(C0920q4 c0920q4, C0930j c0930j) {
            super(c0920q4, c0930j);
            this.f2488n = null;
            this.f2489o = null;
            this.f2490p = null;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: h */
        public C1877g mo2543h() {
            Insets mandatorySystemGestureInsets;
            if (this.f2489o == null) {
                mandatorySystemGestureInsets = this.f2482c.getMandatorySystemGestureInsets();
                this.f2489o = C1877g.m140d(mandatorySystemGestureInsets);
            }
            return this.f2489o;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: j */
        public C1877g mo2541j() {
            Insets systemGestureInsets;
            if (this.f2488n == null) {
                systemGestureInsets = this.f2482c.getSystemGestureInsets();
                this.f2488n = C1877g.m140d(systemGestureInsets);
            }
            return this.f2488n;
        }

        @Override // p023h0.C0920q4.C0932l
        /* renamed from: l */
        public C1877g mo2539l() {
            Insets tappableElementInsets;
            if (this.f2490p == null) {
                tappableElementInsets = this.f2482c.getTappableElementInsets();
                this.f2490p = C1877g.m140d(tappableElementInsets);
            }
            return this.f2490p;
        }

        @Override // p023h0.C0920q4.C0927g, p023h0.C0920q4.C0932l
        /* renamed from: m */
        public C0920q4 mo2538m(int i, int i2, int i3, int i4) {
            WindowInsets inset;
            inset = this.f2482c.inset(i, i2, i3, i4);
            return C0920q4.m2569u(inset);
        }

        @Override // p023h0.C0920q4.C0928h, p023h0.C0920q4.C0932l
        /* renamed from: s */
        public void mo2532s(C1877g c1877g) {
        }
    }

    /* renamed from: h0.q4$k */
    /* loaded from: classes.dex */
    public static class C0931k extends C0930j {

        /* renamed from: q */
        public static final C0920q4 f2491q;

        static {
            WindowInsets windowInsets;
            windowInsets = WindowInsets.CONSUMED;
            f2491q = C0920q4.m2569u(windowInsets);
        }

        public C0931k(C0920q4 c0920q4, WindowInsets windowInsets) {
            super(c0920q4, windowInsets);
        }

        public C0931k(C0920q4 c0920q4, C0931k c0931k) {
            super(c0920q4, c0931k);
        }

        @Override // p023h0.C0920q4.C0927g, p023h0.C0920q4.C0932l
        /* renamed from: d */
        public final void mo2547d(View view) {
        }

        @Override // p023h0.C0920q4.C0927g, p023h0.C0920q4.C0932l
        /* renamed from: g */
        public C1877g mo2544g(int i) {
            Insets insets;
            insets = this.f2482c.getInsets(C0934n.m2530a(i));
            return C1877g.m140d(insets);
        }
    }

    /* renamed from: h0.q4$l */
    /* loaded from: classes.dex */
    public static class C0932l {

        /* renamed from: b */
        public static final C0920q4 f2492b = new C0922b().m2566a().m2589a().m2588b().m2587c();

        /* renamed from: a */
        public final C0920q4 f2493a;

        public C0932l(C0920q4 c0920q4) {
            this.f2493a = c0920q4;
        }

        /* renamed from: a */
        public C0920q4 mo2550a() {
            return this.f2493a;
        }

        /* renamed from: b */
        public C0920q4 mo2549b() {
            return this.f2493a;
        }

        /* renamed from: c */
        public C0920q4 mo2548c() {
            return this.f2493a;
        }

        /* renamed from: d */
        public void mo2547d(View view) {
        }

        /* renamed from: e */
        public void mo2546e(C0920q4 c0920q4) {
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj instanceof C0932l) {
                C0932l c0932l = (C0932l) obj;
                return mo2536o() == c0932l.mo2536o() && mo2537n() == c0932l.mo2537n() && C0734d.m3043a(mo2540k(), c0932l.mo2540k()) && C0734d.m3043a(mo2542i(), c0932l.mo2542i()) && C0734d.m3043a(mo2545f(), c0932l.mo2545f());
            }
            return false;
        }

        /* renamed from: f */
        public C0914q mo2545f() {
            return null;
        }

        /* renamed from: g */
        public C1877g mo2544g(int i) {
            return C1877g.f4679e;
        }

        /* renamed from: h */
        public C1877g mo2543h() {
            return mo2540k();
        }

        public int hashCode() {
            return C0734d.m3042b(Boolean.valueOf(mo2536o()), Boolean.valueOf(mo2537n()), mo2540k(), mo2542i(), mo2545f());
        }

        /* renamed from: i */
        public C1877g mo2542i() {
            return C1877g.f4679e;
        }

        /* renamed from: j */
        public C1877g mo2541j() {
            return mo2540k();
        }

        /* renamed from: k */
        public C1877g mo2540k() {
            return C1877g.f4679e;
        }

        /* renamed from: l */
        public C1877g mo2539l() {
            return mo2540k();
        }

        /* renamed from: m */
        public C0920q4 mo2538m(int i, int i2, int i3, int i4) {
            return f2492b;
        }

        /* renamed from: n */
        public boolean mo2537n() {
            return false;
        }

        /* renamed from: o */
        public boolean mo2536o() {
            return false;
        }

        /* renamed from: p */
        public void mo2535p(C1877g[] c1877gArr) {
        }

        /* renamed from: q */
        public void mo2534q(C1877g c1877g) {
        }

        /* renamed from: r */
        public void mo2533r(C0920q4 c0920q4) {
        }

        /* renamed from: s */
        public void mo2532s(C1877g c1877g) {
        }
    }

    /* renamed from: h0.q4$m */
    /* loaded from: classes.dex */
    public static final class C0933m {
        /* renamed from: a */
        public static int m2531a(int i) {
            if (i != 1) {
                if (i != 2) {
                    if (i != 4) {
                        if (i != 8) {
                            if (i != 16) {
                                if (i != 32) {
                                    if (i != 64) {
                                        if (i != 128) {
                                            if (i == 256) {
                                                return 8;
                                            }
                                            throw new IllegalArgumentException("type needs to be >= FIRST and <= LAST, type=" + i);
                                        }
                                        return 7;
                                    }
                                    return 6;
                                }
                                return 5;
                            }
                            return 4;
                        }
                        return 3;
                    }
                    return 2;
                }
                return 1;
            }
            return 0;
        }
    }

    /* renamed from: h0.q4$n */
    /* loaded from: classes.dex */
    public static final class C0934n {
        /* renamed from: a */
        public static int m2530a(int i) {
            int statusBars;
            int i2 = 0;
            for (int i3 = 1; i3 <= 256; i3 <<= 1) {
                if ((i & i3) != 0) {
                    if (i3 == 1) {
                        statusBars = WindowInsets.Type.statusBars();
                    } else if (i3 == 2) {
                        statusBars = WindowInsets.Type.navigationBars();
                    } else if (i3 == 4) {
                        statusBars = WindowInsets.Type.captionBar();
                    } else if (i3 == 8) {
                        statusBars = WindowInsets.Type.ime();
                    } else if (i3 == 16) {
                        statusBars = WindowInsets.Type.systemGestures();
                    } else if (i3 == 32) {
                        statusBars = WindowInsets.Type.mandatorySystemGestures();
                    } else if (i3 == 64) {
                        statusBars = WindowInsets.Type.tappableElement();
                    } else if (i3 == 128) {
                        statusBars = WindowInsets.Type.displayCutout();
                    }
                    i2 |= statusBars;
                }
            }
            return i2;
        }
    }

    static {
        f2461b = Build.VERSION.SDK_INT >= 30 ? C0931k.f2491q : C0932l.f2492b;
    }

    public C0920q4(WindowInsets windowInsets) {
        C0932l c0927g;
        int i = Build.VERSION.SDK_INT;
        if (i >= 30) {
            c0927g = new C0931k(this, windowInsets);
        } else if (i >= 29) {
            c0927g = new C0930j(this, windowInsets);
        } else if (i >= 28) {
            c0927g = new C0929i(this, windowInsets);
        } else if (i >= 21) {
            c0927g = new C0928h(this, windowInsets);
        } else if (i < 20) {
            this.f2462a = new C0932l(this);
            return;
        } else {
            c0927g = new C0927g(this, windowInsets);
        }
        this.f2462a = c0927g;
    }

    public C0920q4(C0920q4 c0920q4) {
        if (c0920q4 == null) {
            this.f2462a = new C0932l(this);
            return;
        }
        C0932l c0932l = c0920q4.f2462a;
        int i = Build.VERSION.SDK_INT;
        this.f2462a = (i < 30 || !(c0932l instanceof C0931k)) ? (i < 29 || !(c0932l instanceof C0930j)) ? (i < 28 || !(c0932l instanceof C0929i)) ? (i < 21 || !(c0932l instanceof C0928h)) ? (i < 20 || !(c0932l instanceof C0927g)) ? new C0932l(this) : new C0927g(this, (C0927g) c0932l) : new C0928h(this, (C0928h) c0932l) : new C0929i(this, (C0929i) c0932l) : new C0930j(this, (C0930j) c0932l) : new C0931k(this, (C0931k) c0932l);
        c0932l.mo2546e(this);
    }

    /* renamed from: m */
    public static C1877g m2577m(C1877g c1877g, int i, int i2, int i3, int i4) {
        int max = Math.max(0, c1877g.f4680a - i);
        int max2 = Math.max(0, c1877g.f4681b - i2);
        int max3 = Math.max(0, c1877g.f4682c - i3);
        int max4 = Math.max(0, c1877g.f4683d - i4);
        return (max == i && max2 == i2 && max3 == i3 && max4 == i4) ? c1877g : C1877g.m142b(max, max2, max3, max4);
    }

    /* renamed from: u */
    public static C0920q4 m2569u(WindowInsets windowInsets) {
        return m2568v(windowInsets, null);
    }

    /* renamed from: v */
    public static C0920q4 m2568v(WindowInsets windowInsets, View view) {
        C0920q4 c0920q4 = new C0920q4((WindowInsets) C0737f.m3033f(windowInsets));
        if (view != null && C0829h1.m2862A(view)) {
            c0920q4.m2572r(C0829h1.m2813u(view));
            c0920q4.m2586d(view.getRootView());
        }
        return c0920q4;
    }

    @Deprecated
    /* renamed from: a */
    public C0920q4 m2589a() {
        return this.f2462a.mo2550a();
    }

    @Deprecated
    /* renamed from: b */
    public C0920q4 m2588b() {
        return this.f2462a.mo2549b();
    }

    @Deprecated
    /* renamed from: c */
    public C0920q4 m2587c() {
        return this.f2462a.mo2548c();
    }

    /* renamed from: d */
    public void m2586d(View view) {
        this.f2462a.mo2547d(view);
    }

    /* renamed from: e */
    public C0914q m2585e() {
        return this.f2462a.mo2545f();
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof C0920q4) {
            return C0734d.m3043a(this.f2462a, ((C0920q4) obj).f2462a);
        }
        return false;
    }

    /* renamed from: f */
    public C1877g m2584f(int i) {
        return this.f2462a.mo2544g(i);
    }

    @Deprecated
    /* renamed from: g */
    public C1877g m2583g() {
        return this.f2462a.mo2542i();
    }

    @Deprecated
    /* renamed from: h */
    public int m2582h() {
        return this.f2462a.mo2540k().f4683d;
    }

    public int hashCode() {
        C0932l c0932l = this.f2462a;
        if (c0932l == null) {
            return 0;
        }
        return c0932l.hashCode();
    }

    @Deprecated
    /* renamed from: i */
    public int m2581i() {
        return this.f2462a.mo2540k().f4680a;
    }

    @Deprecated
    /* renamed from: j */
    public int m2580j() {
        return this.f2462a.mo2540k().f4682c;
    }

    @Deprecated
    /* renamed from: k */
    public int m2579k() {
        return this.f2462a.mo2540k().f4681b;
    }

    /* renamed from: l */
    public C0920q4 m2578l(int i, int i2, int i3, int i4) {
        return this.f2462a.mo2538m(i, i2, i3, i4);
    }

    /* renamed from: n */
    public boolean m2576n() {
        return this.f2462a.mo2537n();
    }

    @Deprecated
    /* renamed from: o */
    public C0920q4 m2575o(int i, int i2, int i3, int i4) {
        return new C0922b(this).m2564c(C1877g.m142b(i, i2, i3, i4)).m2566a();
    }

    /* renamed from: p */
    public void m2574p(C1877g[] c1877gArr) {
        this.f2462a.mo2535p(c1877gArr);
    }

    /* renamed from: q */
    public void m2573q(C1877g c1877g) {
        this.f2462a.mo2534q(c1877g);
    }

    /* renamed from: r */
    public void m2572r(C0920q4 c0920q4) {
        this.f2462a.mo2533r(c0920q4);
    }

    /* renamed from: s */
    public void m2571s(C1877g c1877g) {
        this.f2462a.mo2532s(c1877g);
    }

    /* renamed from: t */
    public WindowInsets m2570t() {
        C0932l c0932l = this.f2462a;
        if (c0932l instanceof C0927g) {
            return ((C0927g) c0932l).f2482c;
        }
        return null;
    }
}