package A4;

import java.io.Serializable;
import kotlin.jvm.internal.o;

/* JADX INFO: loaded from: classes3.dex */
public final class c implements j, Serializable {

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

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

    public c(h element, j left) {
        o.h(left, "left");
        o.h(element, "element");
        this.f97a = left;
        this.f98b = element;
    }

    public final boolean equals(Object obj) {
        boolean zC;
        if (this == obj) {
            return true;
        }
        if (obj instanceof c) {
            c cVar = (c) obj;
            cVar.getClass();
            int i6 = 2;
            c cVar2 = cVar;
            int i7 = 2;
            while (true) {
                j jVar = cVar2.f97a;
                cVar2 = jVar instanceof c ? (c) jVar : null;
                if (cVar2 == null) {
                    break;
                }
                i7++;
            }
            c cVar3 = this;
            while (true) {
                j jVar2 = cVar3.f97a;
                cVar3 = jVar2 instanceof c ? (c) jVar2 : null;
                if (cVar3 == null) {
                    break;
                }
                i6++;
            }
            if (i7 == i6) {
                c cVar4 = this;
                while (true) {
                    h hVar = cVar4.f98b;
                    if (!o.c(cVar.get(hVar.getKey()), hVar)) {
                        zC = false;
                        break;
                    }
                    j jVar3 = cVar4.f97a;
                    if (!(jVar3 instanceof c)) {
                        o.f(jVar3, "null cannot be cast to non-null type kotlin.coroutines.CoroutineContext.Element");
                        h hVar2 = (h) jVar3;
                        zC = o.c(cVar.get(hVar2.getKey()), hVar2);
                        break;
                    }
                    cVar4 = (c) jVar3;
                }
                if (zC) {
                    return true;
                }
            }
        }
        return false;
    }

    @Override // A4.j
    public final Object fold(Object obj, J4.e eVar) {
        return eVar.invoke(this.f97a.fold(obj, eVar), this.f98b);
    }

    @Override // A4.j
    public final h get(i key) {
        o.h(key, "key");
        c cVar = this;
        while (true) {
            h hVar = cVar.f98b.get(key);
            if (hVar != null) {
                return hVar;
            }
            j jVar = cVar.f97a;
            if (!(jVar instanceof c)) {
                return jVar.get(key);
            }
            cVar = (c) jVar;
        }
    }

    public final int hashCode() {
        return this.f98b.hashCode() + this.f97a.hashCode();
    }

    @Override // A4.j
    public final j minusKey(i key) {
        o.h(key, "key");
        h hVar = this.f98b;
        h hVar2 = hVar.get(key);
        j jVar = this.f97a;
        if (hVar2 != null) {
            return jVar;
        }
        j jVarMinusKey = jVar.minusKey(key);
        return jVarMinusKey == jVar ? this : jVarMinusKey == k.f106a ? hVar : new c(hVar, jVarMinusKey);
    }

    @Override // A4.j
    public final j plus(j context) {
        o.h(context, "context");
        return context == k.f106a ? this : (j) context.fold(this, new b(1));
    }

    public final String toString() {
        return Z0.o.r(new StringBuilder("["), (String) fold("", new b(0)), ']');
    }
}
