package o;

import android.os.Build;
import android.view.View;
import java.util.List;
import java.util.WeakHashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class NH extends AbstractC2071oh implements Runnable, InterfaceC2904xT, View.OnAttachStateChangeListener {
    public boolean n;

    /* renamed from: o, reason: collision with root package name */
    public int f255o;
    public Kl0 p;
    public final ZQ q;
    public final JV r;
    public final UQ s;
    public final H90 t;

    public NH() {
        super(1);
        ZQ zq = new ZQ(9);
        Rl0.a.getClass();
        zq.m(Ql0.b, new Zl0("caption bar"));
        zq.m(Ql0.c, new Zl0("display cutout"));
        zq.m(Ql0.d, new Zl0("ime"));
        zq.m(Ql0.e, new Zl0("mandatory system gestures"));
        zq.m(Ql0.f, new Zl0("navigation bars"));
        zq.m(Ql0.g, new Zl0("status bars"));
        zq.m(Ql0.h, new Zl0("system gestures"));
        zq.m(Ql0.i, new Zl0("tappable element"));
        zq.m(Ql0.j, new Zl0("waterfall"));
        this.q = zq;
        this.r = new JV(0);
        this.s = new UQ(4);
        this.t = new H90();
    }

    /* JADX WARN: Removed duplicated region for block: B:118:0x031a  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void E(o.Kl0 r34) {
        /*
            Method dump skipped, instructions count: 807
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.NH.E(o.Kl0):void");
    }

    @Override // o.AbstractC2071oh
    public final void d(C2554tl0 c2554tl0) {
        boolean z = false;
        this.n = false;
        int iD = c2554tl0.a.d();
        this.f255o &= ~iD;
        this.p = null;
        Rl0 rl0 = (Rl0) androidx.compose.ui.layout.b.c.b(iD);
        if (rl0 != null) {
            Zl0 zl0 = (Zl0) this.q.g(rl0);
            zl0.c.h(0.0f);
            zl0.e.h(1.0f);
            zl0.d.g(0L);
            zl0.c.h(0.0f);
            zl0.b.setValue(Boolean.FALSE);
            zl0.j = -1L;
            zl0.k = -1L;
            JV jv = this.r;
            jv.h(jv.g() + 1);
            synchronized (AbstractC2884x90.c) {
                C0713aR c0713aR = AbstractC2884x90.j.h;
                if (c0713aR != null) {
                    if (c0713aR.h()) {
                        z = true;
                    }
                }
            }
            if (z) {
                AbstractC2884x90.a();
            }
        }
    }

    @Override // o.AbstractC2071oh
    public final void e() {
        this.n = true;
    }

    @Override // o.AbstractC2071oh
    public final Kl0 f(Kl0 kl0, List list) {
        int size = list.size();
        for (int i = 0; i < size; i++) {
            C2554tl0 c2554tl0 = (C2554tl0) list.get(i);
            Rl0 rl0 = (Rl0) androidx.compose.ui.layout.b.c.b(c2554tl0.a.d());
            if (rl0 != null) {
                Zl0 zl0 = (Zl0) this.q.g(rl0);
                if (((Boolean) zl0.b.getValue()).booleanValue()) {
                    AbstractC2459sl0 abstractC2459sl0 = c2554tl0.a;
                    zl0.c.h(abstractC2459sl0.c());
                    zl0.e.h(abstractC2459sl0.a());
                    zl0.d.g(abstractC2459sl0.b());
                }
            }
        }
        E(kl0);
        return kl0;
    }

    @Override // o.AbstractC2071oh
    public final C3040yr g(C2554tl0 c2554tl0, C3040yr c3040yr) {
        Kl0 kl0 = this.p;
        boolean z = false;
        this.n = false;
        this.p = null;
        if (c2554tl0.a.b() > 0 && kl0 != null) {
            int iD = c2554tl0.a.d();
            this.f255o |= iD;
            Rl0 rl0 = (Rl0) androidx.compose.ui.layout.b.c.b(iD);
            if (rl0 != null) {
                Zl0 zl0 = (Zl0) this.q.g(rl0);
                LH lhG = kl0.a.g(iD);
                long j = (lhG.a << 48) | (lhG.b << 32) | (lhG.c << 16) | lhG.d;
                long j2 = zl0.h;
                if (!AbstractC2539te.B(j, j2)) {
                    zl0.j = j2;
                    zl0.k = j;
                    zl0.b.setValue(Boolean.TRUE);
                    AbstractC2459sl0 abstractC2459sl0 = c2554tl0.a;
                    zl0.c.h(abstractC2459sl0.c());
                    zl0.e.h(abstractC2459sl0.a());
                    zl0.d.g(abstractC2459sl0.b());
                    JV jv = this.r;
                    jv.h(jv.g() + 1);
                    synchronized (AbstractC2884x90.c) {
                        C0713aR c0713aR = AbstractC2884x90.j.h;
                        if (c0713aR != null) {
                            if (c0713aR.h()) {
                                z = true;
                            }
                        }
                    }
                    if (z) {
                        AbstractC2884x90.a();
                        return c3040yr;
                    }
                }
            }
        }
        return c3040yr;
    }

    @Override // o.InterfaceC2904xT
    public final Kl0 i(View view, Kl0 kl0) {
        if (this.n) {
            this.p = kl0;
            if (Build.VERSION.SDK_INT == 30) {
                view.post(this);
                return kl0;
            }
        } else if (this.f255o == 0) {
            E(kl0);
        }
        return kl0;
    }

    @Override // android.view.View.OnAttachStateChangeListener
    public final void onViewAttachedToWindow(View view) {
        Object parent = view.getParent();
        View view2 = parent instanceof View ? (View) parent : null;
        if (view2 != null) {
            view = view2;
        }
        WeakHashMap weakHashMap = Oj0.a;
        Gj0.l(view, this);
        Oj0.o(view, this);
    }

    @Override // android.view.View.OnAttachStateChangeListener
    public final void onViewDetachedFromWindow(View view) {
        Object parent = view.getParent();
        View view2 = parent instanceof View ? (View) parent : null;
        if (view2 != null) {
            view = view2;
        }
        WeakHashMap weakHashMap = Oj0.a;
        Gj0.l(view, null);
        Oj0.o(view, null);
    }

    @Override // java.lang.Runnable
    public final void run() {
        if (this.n) {
            this.f255o = 0;
            this.n = false;
            Kl0 kl0 = this.p;
            if (kl0 != null) {
                E(kl0);
                this.p = null;
            }
        }
    }
}
