package o;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.a40, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0685a40 implements Z30 {
    public final ZQ a;
    public ZQ b;

    public C0685a40(LinkedHashMap linkedHashMap) {
        ZQ zq;
        if (linkedHashMap == null || linkedHashMap.isEmpty()) {
            zq = null;
        } else {
            zq = new ZQ(linkedHashMap.size());
            for (Map.Entry entry : linkedHashMap.entrySet()) {
                zq.m(entry.getKey(), entry.getValue());
            }
        }
        this.a = zq;
    }

    @Override // o.Z30
    public final Y30 a(String str, NC nc) {
        int length = str.length();
        for (int i = 0; i < length; i++) {
            if (!AbstractC0940cn0.z(str.charAt(i))) {
                ZQ zq = this.b;
                if (zq == null) {
                    long[] jArr = AbstractC3064z40.a;
                    zq = new ZQ();
                    this.b = zq;
                }
                Object objG = zq.g(str);
                if (objG == null) {
                    objG = new ArrayList();
                    zq.m(str, objG);
                }
                ((List) objG).add(nc);
                return new C3126zm0(zq, str, nc, 27);
            }
        }
        throw new IllegalArgumentException("Registered key is empty or blank");
    }

    @Override // o.Z30
    public final boolean b(Object obj) {
        return F3.i(obj);
    }

    @Override // o.Z30
    public final Object c(String str) {
        ZQ zq = this.a;
        List list = zq != null ? (List) zq.k(str) : null;
        if (list == null || list.isEmpty()) {
            return null;
        }
        if (list.size() > 1 && zq != null) {
            List listSubList = list.subList(1, list.size());
            int iF = zq.f(str);
            if (iF < 0) {
                iF = ~iF;
            }
            Object[] objArr = zq.c;
            Object obj = objArr[iF];
            zq.b[iF] = str;
            objArr[iF] = listSubList;
        }
        return list.get(0);
    }
}
