package C0;

import G0.InterfaceC0279y;
import androidx.compose.runtime.collection.MutableVector;
import i0.AbstractC2254r;
import java.util.List;
import n.C2569D;
import n.C2592t;

/* JADX INFO: renamed from: C0.f, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0105f {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f593b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f594c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public boolean f595d;

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final n.J f597f = new n.J();

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final C0115p f598g = new C0115p();

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final C2569D f599h = new C2569D(10);

    public C0105f(InterfaceC0279y interfaceC0279y) {
        this.f592a = interfaceC0279y;
    }

    /* JADX WARN: Removed duplicated region for block: B:28:0x007b  */
    /* JADX WARN: Removed duplicated region for block: B:51:0x00ff  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void a(long j4, boolean z6, List list) {
        C2569D c2569d;
        int i6;
        C0114o c0114o;
        Object obj;
        C0115p c0115p = this.f598g;
        int size = list.size();
        C0115p c0115p2 = c0115p;
        boolean z7 = true;
        int i7 = 0;
        while (true) {
            c2569d = this.f599h;
            if (i7 >= size) {
                break;
            }
            AbstractC2254r abstractC2254r = (AbstractC2254r) list.get(i7);
            if (abstractC2254r.isAttached()) {
                abstractC2254r.setDetachedListener$ui(new C0104e(0, this, abstractC2254r));
                if (z7) {
                    MutableVector mutableVector = c0115p2.f625a;
                    Object[] objArr = mutableVector.content;
                    int size2 = mutableVector.getSize();
                    int i8 = 0;
                    while (true) {
                        if (i8 >= size2) {
                            obj = null;
                            break;
                        }
                        obj = objArr[i8];
                        if (kotlin.jvm.internal.o.c(((C0114o) obj).f617c, abstractC2254r)) {
                            break;
                        } else {
                            i8++;
                        }
                    }
                    c0114o = (C0114o) obj;
                    if (c0114o != null) {
                        c0114o.f623i = true;
                        c0114o.f618d.b(j4);
                        if (z6) {
                            Object objD = c2569d.d(j4);
                            if (objD == null) {
                                objD = new n.J();
                                c2569d.g(j4, objD);
                            }
                            ((n.J) objD).g(c0114o);
                        }
                        c0115p2 = c0114o;
                    } else {
                        z7 = false;
                        c0114o = new C0114o(abstractC2254r);
                        c0114o.f618d.b(j4);
                        if (z6) {
                            Object objD2 = c2569d.d(j4);
                            if (objD2 == null) {
                                objD2 = new n.J();
                                c2569d.g(j4, objD2);
                            }
                            ((n.J) objD2).g(c0114o);
                        }
                        c0115p2.f625a.add(c0114o);
                        c0115p2 = c0114o;
                    }
                } else {
                    c0114o = new C0114o(abstractC2254r);
                    c0114o.f618d.b(j4);
                    if (z6) {
                    }
                    c0115p2.f625a.add(c0114o);
                    c0115p2 = c0114o;
                }
            }
            i7++;
        }
        if (z6) {
            long[] jArr = c2569d.f21320b;
            Object[] objArr2 = c2569d.f21321c;
            long[] jArr2 = c2569d.f21319a;
            int length = jArr2.length - 2;
            if (length >= 0) {
                int i9 = 0;
                while (true) {
                    long j6 = jArr2[i9];
                    if ((((~j6) << 7) & j6 & (-9187201950435737472L)) != -9187201950435737472L) {
                        int i10 = 8;
                        int i11 = 8 - ((~(i9 - length)) >>> 31);
                        int i12 = 0;
                        while (i12 < i11) {
                            if ((255 & j6) < 128) {
                                int i13 = (i9 << 3) + i12;
                                long j7 = jArr[i13];
                                n.J j8 = (n.J) objArr2[i13];
                                i6 = i10;
                                MutableVector mutableVector2 = c0115p.f625a;
                                Object[] objArr3 = mutableVector2.content;
                                int size3 = mutableVector2.getSize();
                                for (int i14 = 0; i14 < size3; i14++) {
                                    ((C0114o) objArr3[i14]).f(j7, j8);
                                }
                            } else {
                                i6 = i10;
                            }
                            j6 >>= i6;
                            i12++;
                            i10 = i6;
                        }
                        if (i11 != i10) {
                            break;
                        } else if (i9 == length) {
                            break;
                        } else {
                            i9++;
                        }
                    }
                }
            }
        }
        c2569d.a();
    }

    public final boolean b(C0109j c0109j, boolean z6) {
        C0115p c0115p = this.f598g;
        if (!c0115p.a((C2592t) c0109j.f607c, this.f592a, c0109j, z6)) {
            return false;
        }
        boolean z7 = true;
        this.f593b = true;
        MutableVector mutableVector = c0115p.f625a;
        Object[] objArr = mutableVector.content;
        int size = mutableVector.getSize();
        boolean z8 = false;
        for (int i6 = 0; i6 < size; i6++) {
            z8 = ((C0114o) objArr[i6]).e(c0109j, z6) || z8;
        }
        Object[] objArr2 = mutableVector.content;
        int size2 = mutableVector.getSize();
        boolean z9 = false;
        for (int i7 = 0; i7 < size2; i7++) {
            z9 = ((C0114o) objArr2[i7]).d(c0109j) || z9;
        }
        c0115p.b(c0109j);
        if (!z9 && !z8) {
            z7 = false;
        }
        this.f593b = false;
        if (this.f596e) {
            this.f596e = false;
            n.J j4 = this.f597f;
            int i8 = j4.f21377b;
            for (int i9 = 0; i9 < i8; i9++) {
                d((AbstractC2254r) j4.b(i9));
            }
            j4.j();
        }
        if (this.f594c) {
            this.f594c = false;
            c();
        }
        if (this.f595d) {
            this.f595d = false;
            c0115p.f625a.clear();
        }
        return z7;
    }

    public final void c() {
        if (this.f593b) {
            this.f594c = true;
            return;
        }
        C0115p c0115p = this.f598g;
        MutableVector mutableVector = c0115p.f625a;
        Object[] objArr = mutableVector.content;
        int size = mutableVector.getSize();
        for (int i6 = 0; i6 < size; i6++) {
            ((C0114o) objArr[i6]).c();
        }
        if (this.f595d) {
            this.f595d = true;
        } else {
            c0115p.f625a.clear();
        }
    }

    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$PrimitiveArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    public final void d(AbstractC2254r abstractC2254r) {
        if (this.f593b) {
            this.f596e = true;
            this.f597f.g(abstractC2254r);
            return;
        }
        C0115p c0115p = this.f598g;
        n.J j4 = c0115p.f626b;
        j4.j();
        j4.g(c0115p);
        while (j4.e()) {
            C0115p c0115p2 = (C0115p) j4.l(j4.f21377b - 1);
            int i6 = 0;
            while (i6 < c0115p2.f625a.getSize()) {
                MutableVector mutableVector = c0115p2.f625a;
                C0114o c0114o = (C0114o) mutableVector.content[i6];
                if (kotlin.jvm.internal.o.c(c0114o.f617c, abstractC2254r)) {
                    mutableVector.remove(c0114o);
                    c0114o.c();
                } else {
                    j4.g(c0114o);
                    i6++;
                }
            }
        }
    }
}
