package C3;

import java.util.AbstractMap;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
import java.util.RandomAccess;
import java.util.Set;
import java.util.SortedMap;

/* JADX INFO: renamed from: C3.d, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C0042d extends AbstractMap {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public transient C0040b f1261q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public transient C0052n f1262r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final transient Map f1263s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final /* synthetic */ T f1264t;

    public C0042d(T t6, Map map) {
        this.f1264t = t6;
        this.f1263s = map;
    }

    public final C a(Map.Entry entry) {
        Object key = entry.getKey();
        Collection collection = (Collection) entry.getValue();
        T t6 = this.f1264t;
        t6.getClass();
        List list = (List) collection;
        return new C(key, list instanceof RandomAccess ? new C0046h(t6, key, list, null) : new C0050l(t6, key, list, null));
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final void clear() {
        T t6 = this.f1264t;
        if (this.f1263s == t6.f1219t) {
            t6.b();
            return;
        }
        C0041c c0041c = new C0041c(this);
        while (c0041c.hasNext()) {
            c0041c.next();
            c0041c.remove();
        }
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final boolean containsKey(Object obj) {
        Map map = this.f1263s;
        map.getClass();
        try {
            return map.containsKey(obj);
        } catch (ClassCastException | NullPointerException unused) {
            return false;
        }
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final Set entrySet() {
        C0040b c0040b = this.f1261q;
        if (c0040b != null) {
            return c0040b;
        }
        C0040b c0040b2 = new C0040b(this);
        this.f1261q = c0040b2;
        return c0040b2;
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final boolean equals(Object obj) {
        return this == obj || this.f1263s.equals(obj);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final Object get(Object obj) {
        Object obj2;
        Map map = this.f1263s;
        map.getClass();
        try {
            obj2 = map.get(obj);
        } catch (ClassCastException | NullPointerException unused) {
            obj2 = null;
        }
        Collection collection = (Collection) obj2;
        if (collection == null) {
            return null;
        }
        T t6 = this.f1264t;
        t6.getClass();
        List list = (List) collection;
        return list instanceof RandomAccess ? new C0046h(t6, obj, list, null) : new C0050l(t6, obj, list, null);
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final int hashCode() {
        return this.f1263s.hashCode();
    }

    @Override // java.util.AbstractMap, java.util.Map
    public Set keySet() {
        T t6 = this.f1264t;
        Set set = t6.f1288q;
        if (set != null) {
            return set;
        }
        Map map = t6.f1219t;
        Set c0045g = map instanceof NavigableMap ? new C0045g(t6, (NavigableMap) map) : map instanceof SortedMap ? new C0048j(t6, (SortedMap) map) : new C0043e(t6, map);
        t6.f1288q = c0045g;
        return c0045g;
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final Object remove(Object obj) {
        Collection collection = (Collection) this.f1263s.remove(obj);
        if (collection == null) {
            return null;
        }
        T t6 = this.f1264t;
        Collection collectionC = t6.c();
        collectionC.addAll(collection);
        t6.f1220u -= collection.size();
        collection.clear();
        return collectionC;
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final int size() {
        return this.f1263s.size();
    }

    @Override // java.util.AbstractMap
    public final String toString() {
        return this.f1263s.toString();
    }

    @Override // java.util.AbstractMap, java.util.Map
    public final Collection values() {
        C0052n c0052n = this.f1262r;
        if (c0052n != null) {
            return c0052n;
        }
        C0052n c0052n2 = new C0052n(this);
        this.f1262r = c0052n2;
        return c0052n2;
    }
}
