package o2;

import androidx.compose.ui.platform.w1;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/* loaded from: classes.dex */
public final class i implements u, Iterable, en.a {

    /* renamed from: p, reason: collision with root package name */
    private final Map f30586p = new LinkedHashMap();

    /* renamed from: q, reason: collision with root package name */
    private boolean f30587q;

    /* renamed from: r, reason: collision with root package name */
    private boolean f30588r;

    public final Object B(t tVar, dn.a aVar) {
        Object obj = this.f30586p.get(tVar);
        return obj == null ? aVar.invoke() : obj;
    }

    public final boolean C() {
        return this.f30588r;
    }

    public final boolean D() {
        return this.f30587q;
    }

    public final void E(i iVar) {
        for (Map.Entry entry : iVar.f30586p.entrySet()) {
            t tVar = (t) entry.getKey();
            Object value = entry.getValue();
            Object obj = this.f30586p.get(tVar);
            kotlin.jvm.internal.t.e(tVar, "null cannot be cast to non-null type androidx.compose.ui.semantics.SemanticsPropertyKey<kotlin.Any?>");
            Object c10 = tVar.c(obj, value);
            if (c10 != null) {
                this.f30586p.put(tVar, c10);
            }
        }
    }

    public final void F(boolean z10) {
        this.f30588r = z10;
    }

    public final void G(boolean z10) {
        this.f30587q = z10;
    }

    @Override // o2.u
    public void e(t tVar, Object obj) {
        if (!(obj instanceof a) || !i(tVar)) {
            this.f30586p.put(tVar, obj);
            return;
        }
        Object obj2 = this.f30586p.get(tVar);
        kotlin.jvm.internal.t.e(obj2, "null cannot be cast to non-null type androidx.compose.ui.semantics.AccessibilityAction<*>");
        a aVar = (a) obj2;
        Map map = this.f30586p;
        a aVar2 = (a) obj;
        String b10 = aVar2.b();
        if (b10 == null) {
            b10 = aVar.b();
        }
        rm.i a10 = aVar2.a();
        if (a10 == null) {
            a10 = aVar.a();
        }
        map.put(tVar, new a(b10, a10));
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof i)) {
            return false;
        }
        i iVar = (i) obj;
        return kotlin.jvm.internal.t.b(this.f30586p, iVar.f30586p) && this.f30587q == iVar.f30587q && this.f30588r == iVar.f30588r;
    }

    public final void g(i iVar) {
        if (iVar.f30587q) {
            this.f30587q = true;
        }
        if (iVar.f30588r) {
            this.f30588r = true;
        }
        for (Map.Entry entry : iVar.f30586p.entrySet()) {
            t tVar = (t) entry.getKey();
            Object value = entry.getValue();
            if (!this.f30586p.containsKey(tVar)) {
                this.f30586p.put(tVar, value);
            } else if (value instanceof a) {
                Object obj = this.f30586p.get(tVar);
                kotlin.jvm.internal.t.e(obj, "null cannot be cast to non-null type androidx.compose.ui.semantics.AccessibilityAction<*>");
                a aVar = (a) obj;
                Map map = this.f30586p;
                String b10 = aVar.b();
                if (b10 == null) {
                    b10 = ((a) value).b();
                }
                rm.i a10 = aVar.a();
                if (a10 == null) {
                    a10 = ((a) value).a();
                }
                map.put(tVar, new a(b10, a10));
            }
        }
    }

    public int hashCode() {
        return (((this.f30586p.hashCode() * 31) + Boolean.hashCode(this.f30587q)) * 31) + Boolean.hashCode(this.f30588r);
    }

    public final boolean i(t tVar) {
        return this.f30586p.containsKey(tVar);
    }

    @Override // java.lang.Iterable
    public Iterator iterator() {
        return this.f30586p.entrySet().iterator();
    }

    public final boolean m() {
        Set keySet = this.f30586p.keySet();
        if ((keySet instanceof Collection) && keySet.isEmpty()) {
            return false;
        }
        Iterator it = keySet.iterator();
        while (it.hasNext()) {
            if (((t) it.next()).b()) {
                return true;
            }
        }
        return false;
    }

    public final i r() {
        i iVar = new i();
        iVar.f30587q = this.f30587q;
        iVar.f30588r = this.f30588r;
        iVar.f30586p.putAll(this.f30586p);
        return iVar;
    }

    public String toString() {
        StringBuilder sb2 = new StringBuilder();
        String str = "";
        if (this.f30587q) {
            sb2.append("");
            sb2.append("mergeDescendants=true");
            str = ", ";
        }
        if (this.f30588r) {
            sb2.append(str);
            sb2.append("isClearingSemantics=true");
            str = ", ";
        }
        for (Map.Entry entry : this.f30586p.entrySet()) {
            t tVar = (t) entry.getKey();
            Object value = entry.getValue();
            sb2.append(str);
            sb2.append(tVar.a());
            sb2.append(" : ");
            sb2.append(value);
            str = ", ";
        }
        return w1.a(this, null) + "{ " + ((Object) sb2) + " }";
    }

    public final Object x(t tVar) {
        Object obj = this.f30586p.get(tVar);
        if (obj != null) {
            return obj;
        }
        throw new IllegalStateException("Key not present: " + tVar + " - consider getOrElse or getOrNull");
    }

    public final Object z(t tVar, dn.a aVar) {
        Object obj = this.f30586p.get(tVar);
        return obj == null ? aVar.invoke() : obj;
    }
}
