package a.i.b.a;

import a.f.b.d;
import a.f.b.j;
import a.i.b.a.c.b.ah;
import a.i.b.a.c.b.ay;
import a.i.b.a.c.b.b;
import a.i.b.a.c.b.b$a;
import a.i.b.a.c.b.n;
import a.i.b.a.c.b.t;
import a.i.b.a.c.f.f;
import a.i.b.a.c.i.e.h;
import a.i.b.a.c.i.e.j$a;
import a.k.k;
import a.k.m;
import a.l;
import a.v;
import a.y;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.sqlitelint.config.SharePluginInfo;
import com.tencent.ttpic.baseutils.IOUtils;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

@l(dWo = {1, 1, 13}, dWp = {"\u0000\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u001e\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010!\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\b\n\n\u0002\u0010\u0011\n\u0002\b\u0005\b \u0018\u0000 ?2\u00020\u0001:\u0003?@AB\u0005¢\u0006\u0002\u0010\u0002J*\u0010\f\u001a\u00020\r2\u0010\u0010\u000e\u001a\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\t0\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0013H\u0002J\u0014\u0010\u0014\u001a\u0006\u0012\u0002\b\u00030\u00152\u0006\u0010\u0016\u001a\u00020\u0017H\u0002J\u001c\u0010\u0018\u001a\b\u0012\u0002\b\u0003\u0018\u00010\u00192\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u001a\u001a\u00020\u0013J\u001c\u0010\u001b\u001a\b\u0012\u0002\b\u0003\u0018\u00010\u00192\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u001a\u001a\u00020\u0013J(\u0010\u001c\u001a\u0004\u0018\u00010\u001d2\u0006\u0010\u001e\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u001f\u001a\u00020\u00132\u0006\u0010\u001a\u001a\u00020\u0013J\u0016\u0010 \u001a\u00020!2\u0006\u0010\u001e\u001a\u00020\u00112\u0006\u0010\"\u001a\u00020\u0011J \u0010#\u001a\u0004\u0018\u00010\u001d2\u0006\u0010\u001e\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u001a\u001a\u00020\u0013J\u0016\u0010$\u001a\u00020\u00172\u0006\u0010\u001e\u001a\u00020\u00112\u0006\u0010\"\u001a\u00020\u0011J\u0016\u0010%\u001a\b\u0012\u0004\u0012\u00020!0\u00042\u0006\u0010\u001e\u001a\u00020&H&J\u0012\u0010'\u001a\u0004\u0018\u00010\u00172\u0006\u0010(\u001a\u00020)H&J\"\u0010*\u001a\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030+0\u00042\u0006\u0010,\u001a\u00020-2\u0006\u0010.\u001a\u00020/H\u0004J\u0016\u00100\u001a\b\u0012\u0004\u0012\u00020\u00170\u00042\u0006\u0010\u001e\u001a\u00020&H&J\u001a\u00101\u001a\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\t022\u0006\u0010\u0010\u001a\u00020\u0011H\u0002J\u0014\u00103\u001a\u0006\u0012\u0002\b\u00030\t2\u0006\u0010\u0010\u001a\u00020\u0011H\u0002J$\u00104\u001a\u0006\u0012\u0002\b\u00030\t2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u00105\u001a\u00020)2\u0006\u00106\u001a\u00020)H\u0002J@\u00107\u001a\u0004\u0018\u00010\u001d*\u0006\u0012\u0002\b\u00030\t2\u0006\u0010\u001e\u001a\u00020\u00112\u0010\u00108\u001a\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\t022\n\u00109\u001a\u0006\u0012\u0002\b\u00030\t2\u0006\u0010\u001a\u001a\u00020\u0013H\u0002J0\u0010:\u001a\b\u0012\u0002\b\u0003\u0018\u00010\u0019*\u0006\u0012\u0002\b\u00030\t2\u0010\u00108\u001a\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\t022\u0006\u0010;\u001a\u00020\u0013H\u0002JE\u0010<\u001a\u0004\u0018\u00010\u001d*\u0006\u0012\u0002\b\u00030\t2\u0006\u0010\u001e\u001a\u00020\u00112\u0010\u00108\u001a\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\t0=2\n\u00109\u001a\u0006\u0012\u0002\b\u00030\t2\u0006\u0010;\u001a\u00020\u0013H\u0002¢\u0006\u0002\u0010>R\u0018\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0006\u0010\u0007R\u0018\u0010\b\u001a\u0006\u0012\u0002\b\u00030\t8TX\u0004¢\u0006\u0006\u001a\u0004\b\n\u0010\u000b¨\u0006B"}, dWq = {"Lkotlin/reflect/jvm/internal/KDeclarationContainerImpl;", "Lkotlin/jvm/internal/ClassBasedDeclarationContainer;", "()V", "constructorDescriptors", "", "Lkotlin/reflect/jvm/internal/impl/descriptors/ConstructorDescriptor;", "getConstructorDescriptors", "()Ljava/util/Collection;", "methodOwner", "Ljava/lang/Class;", "getMethodOwner", "()Ljava/lang/Class;", "addParametersAndMasks", "", "result", "", "desc", "", "isConstructor", "", "createProperty", "Lkotlin/reflect/jvm/internal/KPropertyImpl;", "descriptor", "Lkotlin/reflect/jvm/internal/impl/descriptors/PropertyDescriptor;", "findConstructorBySignature", "Ljava/lang/reflect/Constructor;", "isPublic", "findDefaultConstructor", "findDefaultMethod", "Ljava/lang/reflect/Method;", "name", "isMember", "findFunctionDescriptor", "Lkotlin/reflect/jvm/internal/impl/descriptors/FunctionDescriptor;", "signature", "findMethodBySignature", "findPropertyDescriptor", "getFunctions", "Lkotlin/reflect/jvm/internal/impl/name/Name;", "getLocalProperty", "index", "", "getMembers", "Lkotlin/reflect/jvm/internal/KCallableImpl;", "scope", "Lkotlin/reflect/jvm/internal/impl/resolve/scopes/MemberScope;", "belonginess", "Lkotlin/reflect/jvm/internal/KDeclarationContainerImpl$MemberBelonginess;", "getProperties", "loadParameterTypes", "", "loadReturnType", "parseType", "begin", "end", "lookupMethod", "parameterTypes", "returnType", "tryGetConstructor", "declared", "tryGetMethod", "", "(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Class;Ljava/lang/Class;Z)Ljava/lang/reflect/Method;", "Companion", "Data", "MemberBelonginess", "kotlin-reflect-api"})
public abstract class i implements d {
    private static final Class<?> AXe = Class.forName("a.f.b.g");
    static final k AXf = new k("<v#(\\d+)>");
    public static final a AXg = new a((byte) 0);

    @l(dWo = {1, 1, 13}, dWp = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006j\u0002\b\u0007j\u0002\b\b¨\u0006\t"}, dWq = {"Lkotlin/reflect/jvm/internal/KDeclarationContainerImpl$MemberBelonginess;", "", "(Ljava/lang/String;I)V", "accept", "", "member", "Lkotlin/reflect/jvm/internal/impl/descriptors/CallableMemberDescriptor;", "DECLARED", "INHERITED", "kotlin-reflect-api"})
    protected enum c {
        DECLARED,
        INHERITED;

        static {
            AppMethodBeat.o(118743);
        }

        public final boolean a(b bVar) {
            AppMethodBeat.i(118744);
            j.p(bVar, "member");
            b$a dYZ = bVar.dYZ();
            j.o(dYZ, "member.kind");
            if (dYZ.dZa() == (((c) this) == DECLARED)) {
                AppMethodBeat.o(118744);
                return true;
            }
            AppMethodBeat.o(118744);
            return false;
        }
    }

    public abstract ah SJ(int i);

    public abstract Collection<ah> a(f fVar);

    public abstract Collection<t> b(f fVar);

    public abstract Collection<a.i.b.a.c.b.k> dWR();

    /* Access modifiers changed, original: protected */
    public Class<?> dXc() {
        Class<?> ba = a.i.b.a.e.b.ba(dWH());
        return ba == null ? dWH() : ba;
    }

    /* Access modifiers changed, original: protected|final */
    public final Collection<e<?>> a(h hVar, c cVar) {
        j.p(hVar, "scope");
        j.p(cVar, "belonginess");
        g gVar = new g(this);
        Collection arrayList = new ArrayList();
        for (a.i.b.a.c.b.l lVar : j$a.a(hVar, null, null, 3)) {
            Object obj;
            if ((lVar instanceof b) && (j.j(((b) lVar).dYf(), ay.Bfd) ^ 1) != 0 && cVar.a((b) lVar)) {
                obj = (e) lVar.a((n) gVar, y.AUy);
            } else {
                obj = null;
            }
            if (obj != null) {
                arrayList.add(obj);
            }
        }
        return a.a.j.m((List) arrayList);
    }

    private final Method a(Class<?> cls, String str, List<? extends Class<?>> list, Class<?> cls2, boolean z) {
        Collection collection = list;
        if (collection == null) {
            throw new v("null cannot be cast to non-null type java.util.Collection<T>");
        }
        Object[] toArray = collection.toArray(new Class[0]);
        if (toArray == null) {
            throw new v("null cannot be cast to non-null type kotlin.Array<T>");
        }
        Method a;
        Class[] clsArr = (Class[]) toArray;
        if (z) {
            a = a((Class) cls, str, clsArr, (Class) cls2, false);
            if (a != null) {
                return a;
            }
            if (cls.isInterface()) {
                a = a(Object.class, str, (List) list, (Class) cls2, z);
                if (a != null) {
                    return a;
                }
            }
        }
        Class cls3;
        while (cls3 != null) {
            a = a(cls3, str, clsArr, (Class) cls2, true);
            if (a != null) {
                return a;
            }
            cls3 = cls3.getSuperclass();
        }
        return null;
    }

    /* JADX WARNING: Removed duplicated region for block: B:29:0x001f A:{SYNTHETIC, EDGE_INSN: B:29:0x001f->B:6:0x001f ?: BREAK  } */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x006c A:{LOOP_END, Catch:{ NoSuchMethodException -> 0x007a }, LOOP:0: B:11:0x003c->B:23:0x006c} */
    private static java.lang.reflect.Method a(java.lang.Class<?> r7, java.lang.String r8, java.lang.Class<?>[] r9, java.lang.Class<?> r10, boolean r11) {
        /*
        r1 = 0;
        r3 = 0;
        if (r11 == 0) goto L_0x0021;
    L_0x0004:
        r0 = r9.length;	 Catch:{ NoSuchMethodException -> 0x007a }
        r0 = java.util.Arrays.copyOf(r9, r0);	 Catch:{ NoSuchMethodException -> 0x007a }
        r0 = (java.lang.Class[]) r0;	 Catch:{ NoSuchMethodException -> 0x007a }
        r0 = r7.getDeclaredMethod(r8, r0);	 Catch:{ NoSuchMethodException -> 0x007a }
    L_0x000f:
        r2 = "result";
        a.f.b.j.o(r0, r2);	 Catch:{ NoSuchMethodException -> 0x007a }
        r2 = r0.getReturnType();	 Catch:{ NoSuchMethodException -> 0x007a }
        r2 = a.f.b.j.j(r2, r10);	 Catch:{ NoSuchMethodException -> 0x007a }
        if (r2 == 0) goto L_0x002d;
    L_0x001f:
        r1 = r0;
    L_0x0020:
        return r1;
    L_0x0021:
        r0 = r9.length;	 Catch:{ NoSuchMethodException -> 0x007a }
        r0 = java.util.Arrays.copyOf(r9, r0);	 Catch:{ NoSuchMethodException -> 0x007a }
        r0 = (java.lang.Class[]) r0;	 Catch:{ NoSuchMethodException -> 0x007a }
        r0 = r7.getMethod(r8, r0);	 Catch:{ NoSuchMethodException -> 0x007a }
        goto L_0x000f;
    L_0x002d:
        if (r11 == 0) goto L_0x0070;
    L_0x002f:
        r0 = r7.getDeclaredMethods();	 Catch:{ NoSuchMethodException -> 0x007a }
        r5 = r0;
    L_0x0034:
        r0 = "allMethods";
        a.f.b.j.o(r5, r0);	 Catch:{ NoSuchMethodException -> 0x007a }
        r6 = r5.length;	 Catch:{ NoSuchMethodException -> 0x007a }
        r4 = r3;
    L_0x003c:
        if (r4 >= r6) goto L_0x0078;
    L_0x003e:
        r0 = r5[r4];	 Catch:{ NoSuchMethodException -> 0x007a }
        r2 = "method";
        a.f.b.j.o(r0, r2);	 Catch:{ NoSuchMethodException -> 0x007a }
        r2 = r0.getName();	 Catch:{ NoSuchMethodException -> 0x007a }
        r2 = a.f.b.j.j(r2, r8);	 Catch:{ NoSuchMethodException -> 0x007a }
        if (r2 == 0) goto L_0x0076;
    L_0x0050:
        r2 = r0.getReturnType();	 Catch:{ NoSuchMethodException -> 0x007a }
        r2 = a.f.b.j.j(r2, r10);	 Catch:{ NoSuchMethodException -> 0x007a }
        if (r2 == 0) goto L_0x0076;
    L_0x005a:
        r2 = r0.getParameterTypes();	 Catch:{ NoSuchMethodException -> 0x007a }
        if (r2 != 0) goto L_0x0063;
    L_0x0060:
        a.f.b.j.dWJ();	 Catch:{ NoSuchMethodException -> 0x007a }
    L_0x0063:
        r2 = java.util.Arrays.equals(r2, r9);	 Catch:{ NoSuchMethodException -> 0x007a }
        if (r2 == 0) goto L_0x0076;
    L_0x0069:
        r2 = 1;
    L_0x006a:
        if (r2 != 0) goto L_0x001f;
    L_0x006c:
        r0 = r4 + 1;
        r4 = r0;
        goto L_0x003c;
    L_0x0070:
        r0 = r7.getMethods();	 Catch:{ NoSuchMethodException -> 0x007a }
        r5 = r0;
        goto L_0x0034;
    L_0x0076:
        r2 = r3;
        goto L_0x006a;
    L_0x0078:
        r0 = r1;
        goto L_0x001f;
    L_0x007a:
        r0 = move-exception;
        goto L_0x0020;
        */
        throw new UnsupportedOperationException("Method not decompiled: a.i.b.a.i.a(java.lang.Class, java.lang.String, java.lang.Class[], java.lang.Class, boolean):java.lang.reflect.Method");
    }

    static Constructor<?> a(Class<?> cls, List<? extends Class<?>> list, boolean z) {
        Collection collection;
        Object[] toArray;
        Class[] clsArr;
        if (z) {
            try {
                collection = list;
                if (collection == null) {
                    throw new v("null cannot be cast to non-null type java.util.Collection<T>");
                }
                toArray = collection.toArray(new Class[0]);
                if (toArray == null) {
                    throw new v("null cannot be cast to non-null type kotlin.Array<T>");
                }
                clsArr = (Class[]) toArray;
                return cls.getDeclaredConstructor((Class[]) Arrays.copyOf(clsArr, clsArr.length));
            } catch (NoSuchMethodException e) {
                return null;
            }
        }
        collection = list;
        if (collection == null) {
            throw new v("null cannot be cast to non-null type java.util.Collection<T>");
        }
        toArray = collection.toArray(new Class[0]);
        if (toArray == null) {
            throw new v("null cannot be cast to non-null type kotlin.Array<T>");
        }
        clsArr = (Class[]) toArray;
        return cls.getConstructor((Class[]) Arrays.copyOf(clsArr, clsArr.length));
    }

    public final Method H(String str, String str2, boolean z) {
        j.p(str, "name");
        j.p(str2, SharePluginInfo.ISSUE_KEY_DESC);
        if (j.j(str, "<init>")) {
            return null;
        }
        return a(dXc(), str, avx(str2), avy(str2), z);
    }

    public final Method d(String str, String str2, boolean z, boolean z2) {
        j.p(str, "name");
        j.p(str2, SharePluginInfo.ISSUE_KEY_DESC);
        if (j.j(str, "<init>")) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        if (z) {
            arrayList.add(dWH());
        }
        c(arrayList, str2, false);
        return a(dXc(), str + "$default", (List) arrayList, avy(str2), z2);
    }

    public final Constructor<?> cu(String str, boolean z) {
        j.p(str, SharePluginInfo.ISSUE_KEY_DESC);
        return a(dWH(), avx(str), !z);
    }

    /* Access modifiers changed, original: final */
    public final void c(List<Class<?>> list, String str, boolean z) {
        List avx = avx(str);
        list.addAll(avx);
        int size = ((avx.size() + 32) - 1) / 32;
        for (int i = 0; i < size; i++) {
            Class cls = Integer.TYPE;
            j.o(cls, "Integer.TYPE");
            list.add(cls);
        }
        Object obj = z ? AXe : Object.class;
        j.o(obj, "if (isConstructor) DEFAU…RKER else Any::class.java");
        list.add(obj);
    }

    private final List<Class<?>> avx(String str) {
        ArrayList arrayList = new ArrayList();
        int i = 1;
        while (true) {
            int i2 = i;
            if (str.charAt(i2) == ')') {
                return arrayList;
            }
            int i3 = i2;
            while (str.charAt(i3) == '[') {
                i3++;
            }
            char charAt = str.charAt(i3);
            if (m.c("VZCBSIFJD", charAt)) {
                i = i3 + 1;
            } else if (charAt == 'L') {
                i = m.a(str, ';', i2, 4) + 1;
            } else {
                throw ((Throwable) new x("Unknown type prefix in the method signature: ".concat(String.valueOf(str))));
            }
            arrayList.add(aA(str, i2, i));
        }
    }

    private final Class<?> aA(String str, int i, int i2) {
        switch (str.charAt(i)) {
            case 'B':
                return Byte.TYPE;
            case 'C':
                return Character.TYPE;
            case 'D':
                return Double.TYPE;
            case 'F':
                return Float.TYPE;
            case 'I':
                return Integer.TYPE;
            case 'J':
                return Long.TYPE;
            case 'L':
                ClassLoader aX = a.i.b.a.e.b.aX(dWH());
                int i3 = i + 1;
                int i4 = i2 - 1;
                if (str == null) {
                    throw new v("null cannot be cast to non-null type java.lang.String");
                }
                String substring = str.substring(i3, i4);
                j.o(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
                Class loadClass = aX.loadClass(m.a(substring, IOUtils.DIR_SEPARATOR_UNIX, '.'));
                j.o(loadClass, "jClass.safeClassLoader.l…d - 1).replace('/', '.'))");
                return loadClass;
            case 'S':
                return Short.TYPE;
            case com.tencent.mm.plugin.appbrand.jsapi.l.c.CTRL_INDEX /*86*/:
                Class<?> cls = Void.TYPE;
                j.o(cls, "Void.TYPE");
                return cls;
            case 'Z':
                return Boolean.TYPE;
            case '[':
                return a.i.b.a.e.b.bd(aA(str, i + 1, i2));
            default:
                throw ((Throwable) new x("Unknown type prefix in the method signature: ".concat(String.valueOf(str))));
        }
    }

    private final Class<?> avy(String str) {
        return aA(str, m.a(str, ')', 0, 6) + 1, str.length());
    }
}
