package kotlin.jvm.internal;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/* loaded from: classes3.dex */
public final class i implements kn.d, h {

    /* renamed from: q, reason: collision with root package name */
    public static final a f26185q = new a(null);

    /* renamed from: r, reason: collision with root package name */
    private static final Map f26186r;

    /* renamed from: s, reason: collision with root package name */
    private static final HashMap f26187s;

    /* renamed from: t, reason: collision with root package name */
    private static final HashMap f26188t;

    /* renamed from: u, reason: collision with root package name */
    private static final HashMap f26189u;

    /* renamed from: v, reason: collision with root package name */
    private static final Map f26190v;

    /* renamed from: p, reason: collision with root package name */
    private final Class f26191p;

    /* loaded from: classes3.dex */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(k kVar) {
            this();
        }

        public final String a(Class jClass) {
            String str;
            t.g(jClass, "jClass");
            String str2 = null;
            if (jClass.isAnonymousClass() || jClass.isLocalClass()) {
                return null;
            }
            if (!jClass.isArray()) {
                String str3 = (String) i.f26189u.get(jClass.getName());
                return str3 == null ? jClass.getCanonicalName() : str3;
            }
            Class<?> componentType = jClass.getComponentType();
            if (componentType.isPrimitive() && (str = (String) i.f26189u.get(componentType.getName())) != null) {
                str2 = str + "Array";
            }
            return str2 == null ? "kotlin.Array" : str2;
        }

        /* JADX WARN: Code restructure failed: missing block: B:8:0x003b, code lost:
        
            if (r1 == null) goto L13;
         */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final String b(Class jClass) {
            String str;
            String str2;
            String S0;
            String T0;
            t.g(jClass, "jClass");
            String str3 = null;
            if (jClass.isAnonymousClass()) {
                return null;
            }
            if (jClass.isLocalClass()) {
                String simpleName = jClass.getSimpleName();
                Method enclosingMethod = jClass.getEnclosingMethod();
                if (enclosingMethod != null) {
                    t.d(simpleName);
                    str = kotlin.text.z.T0(simpleName, enclosingMethod.getName() + '$', null, 2, null);
                }
                Constructor<?> enclosingConstructor = jClass.getEnclosingConstructor();
                if (enclosingConstructor == null) {
                    t.d(simpleName);
                    S0 = kotlin.text.z.S0(simpleName, '$', null, 2, null);
                    return S0;
                }
                t.d(simpleName);
                T0 = kotlin.text.z.T0(simpleName, enclosingConstructor.getName() + '$', null, 2, null);
                return T0;
            }
            if (!jClass.isArray()) {
                String str4 = (String) i.f26190v.get(jClass.getName());
                return str4 == null ? jClass.getSimpleName() : str4;
            }
            Class<?> componentType = jClass.getComponentType();
            str = "Array";
            if (componentType.isPrimitive() && (str2 = (String) i.f26190v.get(componentType.getName())) != null) {
                str3 = str2 + "Array";
            }
            if (str3 != null) {
                return str3;
            }
            return str;
        }

        public final boolean c(Object obj, Class jClass) {
            t.g(jClass, "jClass");
            Map map = i.f26186r;
            t.e(map, "null cannot be cast to non-null type kotlin.collections.Map<K of kotlin.collections.MapsKt__MapsKt.get, V of kotlin.collections.MapsKt__MapsKt.get>");
            Integer num = (Integer) map.get(jClass);
            if (num != null) {
                return v0.k(obj, num.intValue());
            }
            if (jClass.isPrimitive()) {
                jClass = cn.a.c(cn.a.e(jClass));
            }
            return jClass.isInstance(obj);
        }
    }

    static {
        List n10;
        int v10;
        Map s10;
        int d10;
        String W0;
        String W02;
        n10 = sm.u.n(dn.a.class, dn.l.class, dn.p.class, dn.q.class, dn.r.class, dn.s.class, dn.t.class, dn.u.class, dn.v.class, dn.w.class, dn.b.class, dn.c.class, dn.d.class, dn.e.class, dn.f.class, dn.g.class, dn.h.class, dn.i.class, dn.j.class, dn.k.class, dn.m.class, dn.n.class, dn.o.class);
        List list = n10;
        v10 = sm.v.v(list, 10);
        ArrayList arrayList = new ArrayList(v10);
        int i10 = 0;
        for (Object obj : list) {
            int i11 = i10 + 1;
            if (i10 < 0) {
                sm.u.u();
            }
            arrayList.add(rm.c0.a((Class) obj, Integer.valueOf(i10)));
            i10 = i11;
        }
        s10 = sm.q0.s(arrayList);
        f26186r = s10;
        HashMap hashMap = new HashMap();
        hashMap.put("boolean", "kotlin.Boolean");
        hashMap.put("char", "kotlin.Char");
        hashMap.put("byte", "kotlin.Byte");
        hashMap.put("short", "kotlin.Short");
        hashMap.put("int", "kotlin.Int");
        hashMap.put("float", "kotlin.Float");
        hashMap.put("long", "kotlin.Long");
        hashMap.put("double", "kotlin.Double");
        f26187s = hashMap;
        HashMap hashMap2 = new HashMap();
        hashMap2.put("java.lang.Boolean", "kotlin.Boolean");
        hashMap2.put("java.lang.Character", "kotlin.Char");
        hashMap2.put("java.lang.Byte", "kotlin.Byte");
        hashMap2.put("java.lang.Short", "kotlin.Short");
        hashMap2.put("java.lang.Integer", "kotlin.Int");
        hashMap2.put("java.lang.Float", "kotlin.Float");
        hashMap2.put("java.lang.Long", "kotlin.Long");
        hashMap2.put("java.lang.Double", "kotlin.Double");
        f26188t = hashMap2;
        HashMap hashMap3 = new HashMap();
        hashMap3.put("java.lang.Object", "kotlin.Any");
        hashMap3.put("java.lang.String", "kotlin.String");
        hashMap3.put("java.lang.CharSequence", "kotlin.CharSequence");
        hashMap3.put("java.lang.Throwable", "kotlin.Throwable");
        hashMap3.put("java.lang.Cloneable", "kotlin.Cloneable");
        hashMap3.put("java.lang.Number", "kotlin.Number");
        hashMap3.put("java.lang.Comparable", "kotlin.Comparable");
        hashMap3.put("java.lang.Enum", "kotlin.Enum");
        hashMap3.put("java.lang.annotation.Annotation", "kotlin.Annotation");
        hashMap3.put("java.lang.Iterable", "kotlin.collections.Iterable");
        hashMap3.put("java.util.Iterator", "kotlin.collections.Iterator");
        hashMap3.put("java.util.Collection", "kotlin.collections.Collection");
        hashMap3.put("java.util.List", "kotlin.collections.List");
        hashMap3.put("java.util.Set", "kotlin.collections.Set");
        hashMap3.put("java.util.ListIterator", "kotlin.collections.ListIterator");
        hashMap3.put("java.util.Map", "kotlin.collections.Map");
        hashMap3.put("java.util.Map$Entry", "kotlin.collections.Map.Entry");
        hashMap3.put("kotlin.jvm.internal.StringCompanionObject", "kotlin.String.Companion");
        hashMap3.put("kotlin.jvm.internal.EnumCompanionObject", "kotlin.Enum.Companion");
        hashMap3.putAll(hashMap);
        hashMap3.putAll(hashMap2);
        Collection<String> values = hashMap.values();
        t.f(values, "<get-values>(...)");
        for (String str : values) {
            StringBuilder sb2 = new StringBuilder();
            sb2.append("kotlin.jvm.internal.");
            t.d(str);
            W02 = kotlin.text.z.W0(str, '.', null, 2, null);
            sb2.append(W02);
            sb2.append("CompanionObject");
            rm.v a10 = rm.c0.a(sb2.toString(), str + ".Companion");
            hashMap3.put(a10.c(), a10.d());
        }
        for (Map.Entry entry : f26186r.entrySet()) {
            hashMap3.put(((Class) entry.getKey()).getName(), "kotlin.Function" + ((Number) entry.getValue()).intValue());
        }
        f26189u = hashMap3;
        d10 = sm.p0.d(hashMap3.size());
        LinkedHashMap linkedHashMap = new LinkedHashMap(d10);
        for (Map.Entry entry2 : hashMap3.entrySet()) {
            Object key = entry2.getKey();
            W0 = kotlin.text.z.W0((String) entry2.getValue(), '.', null, 2, null);
            linkedHashMap.put(key, W0);
        }
        f26190v = linkedHashMap;
    }

    public i(Class jClass) {
        t.g(jClass, "jClass");
        this.f26191p = jClass;
    }

    private final Void r() {
        throw new cn.b();
    }

    @Override // kn.d
    public String d() {
        return f26185q.a(e());
    }

    @Override // kotlin.jvm.internal.h
    public Class e() {
        return this.f26191p;
    }

    public boolean equals(Object obj) {
        return (obj instanceof i) && t.b(cn.a.c(this), cn.a.c((kn.d) obj));
    }

    @Override // kn.d
    public Collection h() {
        r();
        throw new rm.k();
    }

    public int hashCode() {
        return cn.a.c(this).hashCode();
    }

    @Override // kn.d
    public String i() {
        return f26185q.b(e());
    }

    @Override // kn.d
    public boolean n(Object obj) {
        return f26185q.c(obj, e());
    }

    public String toString() {
        return e().toString() + " (Kotlin reflection is not available)";
    }
}
