package androidx.lifecycle;

import T0.C0606q;
import c2.AbstractC1237a;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import y4.C3277e;

/* JADX INFO: loaded from: classes.dex */
public final class U {

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

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

    public U(C3277e c3277e) {
        this.f12135a = new LinkedHashMap();
        this.f12136b = new C0606q(c3277e);
    }

    public final Object a(String str) {
        Object value;
        C0606q c0606q = this.f12136b;
        c0606q.getClass();
        LinkedHashMap linkedHashMap = (LinkedHashMap) c0606q.f6543b;
        LinkedHashMap linkedHashMap2 = (LinkedHashMap) c0606q.f6546e;
        try {
            Y4.H h5 = (Y4.H) linkedHashMap2.get(str);
            if (h5 != null && (value = ((Y4.c0) h5).getValue()) != null) {
                return value;
            }
            return linkedHashMap.get(str);
        } catch (ClassCastException unused) {
            linkedHashMap.remove(str);
            ((LinkedHashMap) c0606q.f6545d).remove(str);
            linkedHashMap2.remove(str);
            return null;
        }
    }

    public final void b(Object obj, String str) {
        if (obj != null) {
            List list = AbstractC1237a.f13420a;
            if (list == null || !list.isEmpty()) {
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    if (((Class) it.next()).isInstance(obj)) {
                    }
                }
            }
            throw new IllegalArgumentException(("Can't put value with type " + obj.getClass() + " into saved state").toString());
        }
        List list2 = AbstractC1237a.f13420a;
        Object obj2 = this.f12135a.get(str);
        F f6 = obj2 instanceof F ? (F) obj2 : null;
        if (f6 != null) {
            f6.h(obj);
        }
        this.f12136b.k(obj, str);
    }

    public U() {
        this.f12135a = new LinkedHashMap();
        this.f12136b = new C0606q(x4.z.f26066a);
    }
}
