package u1;

import com.revenuecat.purchases.common.Constants;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import m1.AbstractC2464a;
import q.AbstractC2761L;
import v1.AbstractC3095h;
import v1.l;

/* JADX INFO: renamed from: u1.c, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2962c {

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

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final int f24426e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public C2962c f24427f;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public n1.e f24430i;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public HashSet f24422a = null;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public int f24428g = 0;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public int f24429h = Integer.MIN_VALUE;

    public C2962c(d dVar, int i6) {
        this.f24425d = dVar;
        this.f24426e = i6;
    }

    public final void a(C2962c c2962c, int i6) {
        b(c2962c, i6, Integer.MIN_VALUE, false);
    }

    public final boolean b(C2962c c2962c, int i6, int i7, boolean z6) {
        if (c2962c == null) {
            j();
            return true;
        }
        if (!z6 && !i(c2962c)) {
            return false;
        }
        this.f24427f = c2962c;
        if (c2962c.f24422a == null) {
            c2962c.f24422a = new HashSet();
        }
        HashSet hashSet = this.f24427f.f24422a;
        if (hashSet != null) {
            hashSet.add(this);
        }
        this.f24428g = i6;
        this.f24429h = i7;
        return true;
    }

    public final void c(int i6, ArrayList arrayList, l lVar) {
        HashSet hashSet = this.f24422a;
        if (hashSet != null) {
            Iterator it = hashSet.iterator();
            while (it.hasNext()) {
                AbstractC3095h.b(((C2962c) it.next()).f24425d, i6, arrayList, lVar);
            }
        }
    }

    public final int d() {
        if (this.f24424c) {
            return this.f24423b;
        }
        return 0;
    }

    public final int e() {
        C2962c c2962c;
        if (this.f24425d.f24462d0 == 8) {
            return 0;
        }
        int i6 = this.f24429h;
        return (i6 == Integer.MIN_VALUE || (c2962c = this.f24427f) == null || c2962c.f24425d.f24462d0 != 8) ? this.f24428g : i6;
    }

    public final C2962c f() {
        int i6 = this.f24426e;
        int iC = AbstractC2464a.c(i6);
        d dVar = this.f24425d;
        switch (iC) {
            case 0:
            case 5:
            case 6:
            case 7:
            case 8:
                return null;
            case 1:
                return dVar.f24438H;
            case 2:
                return dVar.f24439I;
            case 3:
                return dVar.f24436F;
            case 4:
                return dVar.f24437G;
            default:
                throw new AssertionError(AbstractC2761L.p(i6));
        }
    }

    public final boolean g() {
        HashSet hashSet = this.f24422a;
        if (hashSet == null) {
            return false;
        }
        Iterator it = hashSet.iterator();
        while (it.hasNext()) {
            if (((C2962c) it.next()).f().h()) {
                return true;
            }
        }
        return false;
    }

    public final boolean h() {
        return this.f24427f != null;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Removed duplicated region for block: B:46:0x0063 A[RETURN] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean i(C2962c c2962c) {
        if (c2962c != null) {
            d dVar = c2962c.f24425d;
            int i6 = this.f24426e;
            int i7 = c2962c.f24426e;
            if (i7 != i6) {
                switch (AbstractC2464a.c(i6)) {
                    case 0:
                    case 7:
                    case 8:
                        break;
                    case 1:
                    case 3:
                        boolean z6 = i7 == 2 || i7 == 4;
                        if (!(dVar instanceof h)) {
                            return z6;
                        }
                        if (z6 || i7 == 8) {
                        }
                        break;
                    case 2:
                    case 4:
                        boolean z7 = i7 == 3 || i7 == 5;
                        if (!(dVar instanceof h)) {
                            return z7;
                        }
                        if (z7 || i7 == 9) {
                        }
                        break;
                    case 5:
                        if (i7 == 2 || i7 == 4) {
                        }
                        break;
                    case 6:
                        if (i7 == 6 || i7 == 8 || i7 == 9) {
                        }
                        break;
                    default:
                        throw new AssertionError(AbstractC2761L.p(i6));
                }
            } else if (i6 != 6 || (dVar.f24435E && this.f24425d.f24435E)) {
                return true;
            }
        }
        return false;
    }

    public final void j() {
        HashSet hashSet;
        C2962c c2962c = this.f24427f;
        if (c2962c != null && (hashSet = c2962c.f24422a) != null) {
            hashSet.remove(this);
            if (this.f24427f.f24422a.size() == 0) {
                this.f24427f.f24422a = null;
            }
        }
        this.f24422a = null;
        this.f24427f = null;
        this.f24428g = 0;
        this.f24429h = Integer.MIN_VALUE;
        this.f24424c = false;
        this.f24423b = 0;
    }

    public final void k() {
        n1.e eVar = this.f24430i;
        if (eVar == null) {
            this.f24430i = new n1.e(1);
        } else {
            eVar.c();
        }
    }

    public final void l(int i6) {
        this.f24423b = i6;
        this.f24424c = true;
    }

    public final String toString() {
        return this.f24425d.e0 + Constants.SUBS_ID_BASE_PLAN_ID_SEPARATOR + AbstractC2761L.p(this.f24426e);
    }
}
