package a.i.b.a;

import a.f.a.a;
import a.f.a.b;
import a.f.b.j;
import a.f.b.k;
import a.i.b.a.c.b.ah;
import a.i.b.a.c.b.az;
import a.i.b.a.c.f.f;
import a.i.b.a.i.e;
import a.k.i;
import a.l;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.ttpic.baseutils.IOUtils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Matcher;

@l(dWo = {1, 1, 13}, dWp = {"\u0000\n\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u0001\"\u0006\b\u0000\u0010\u0002 \u0001H\n¢\u0006\u0002\b\u0003"}, dWq = {"<anonymous>", "Lkotlin/reflect/jvm/internal/impl/descriptors/PropertyDescriptor;", "R", "invoke"})
final class s$e extends k implements a<ah> {
    final /* synthetic */ s AYd;

    s$e(s sVar) {
        this.AYd = sVar;
        super(0);
    }

    public final /* synthetic */ Object invoke() {
        i iVar;
        int i = 0;
        AppMethodBeat.i(118861);
        i iVar2 = this.AYd.AXs;
        String str = this.AYd.name;
        String str2 = this.AYd.signature;
        j.p(str, "name");
        j.p(str2, "signature");
        a.k.k kVar = i.AXf;
        CharSequence charSequence = str2;
        j.p(charSequence, "input");
        Matcher matcher = kVar.BPf.matcher(charSequence);
        j.o(matcher, "nativePattern.matcher(input)");
        if (matcher.matches()) {
            iVar = (i) new a.k.j(matcher, charSequence);
        } else {
            iVar = null;
        }
        Throwable th;
        if (iVar != null) {
            String str3 = (String) iVar.ekN().BOX.ekM().get(1);
            ah SJ = iVar2.SJ(Integer.parseInt(str3));
            if (SJ == null) {
                th = (Throwable) new x("Local property #" + str3 + " not found in " + iVar2.dWH());
                AppMethodBeat.o(118861);
                throw th;
            }
            AppMethodBeat.o(118861);
            return SJ;
        }
        ah ahVar;
        f avX = f.avX(str);
        j.o(avX, "Name.identifier(name)");
        Collection arrayList = new ArrayList();
        for (Object next : iVar2.a(avX)) {
            ahVar = (ah) next;
            ad adVar = ad.AYC;
            if (j.j(ad.c(ahVar).pq(), str2)) {
                arrayList.add(next);
            }
        }
        List list = (List) arrayList;
        if (list.isEmpty()) {
            th = (Throwable) new x("Property '" + str + "' (JVM signature: " + str2 + ") not resolved in " + iVar2);
            AppMethodBeat.o(118861);
            throw th;
        } else if (list.size() != 1) {
            Map linkedHashMap = new LinkedHashMap();
            for (Object next2 : list) {
                az dYf = ((ah) next2).dYf();
                ArrayList arrayList2 = linkedHashMap.get(dYf);
                if (arrayList2 == null) {
                    arrayList2 = new ArrayList();
                    linkedHashMap.put(dYf, arrayList2);
                }
                arrayList2.add(next2);
            }
            Comparator comparator = (Comparator) i.f.AXp;
            j.p(linkedHashMap, "receiver$0");
            j.p(comparator, "comparator");
            TreeMap treeMap = new TreeMap(comparator);
            treeMap.putAll(linkedHashMap);
            Collection values = treeMap.values();
            j.o(values, "properties\n             …                }).values");
            List list2 = (List) a.a.j.g(values);
            if (list2.size() == 1) {
                j.o(list2, "mostVisibleProperties");
                ahVar = (ah) a.a.j.fJ(list2);
                AppMethodBeat.o(118861);
                return ahVar;
            }
            avX = f.avX(str);
            j.o(avX, "Name.identifier(name)");
            String a = a.a.j.a(iVar2.a(avX), IOUtils.LINE_SEPARATOR_UNIX, null, null, 0, null, (b) e.AXo, 30);
            StringBuilder append = new StringBuilder("Property '").append(str).append("' (JVM signature: ").append(str2).append(") not resolved in ").append(iVar2).append(':');
            if (a.length() == 0) {
                i = 1;
            }
            th = (Throwable) new x(append.append(i != 0 ? " no members found" : IOUtils.LINE_SEPARATOR_UNIX.concat(String.valueOf(a))).toString());
            AppMethodBeat.o(118861);
            throw th;
        } else {
            ahVar = (ah) a.a.j.fN(list);
            AppMethodBeat.o(118861);
            return ahVar;
        }
    }
}
