package d.e.a.t;

import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/* JADX INFO: compiled from: ReflectionObjectHandler.java */
/* JADX INFO: loaded from: classes.dex */
public class h extends c {
    public static final d.e.a.v.d[] a = new d.e.a.v.d[0];

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final d[] f2534b = new d[0];

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final Method f2535c;

    static {
        try {
            f2535c = Map.class.getMethod("get", Object.class);
        } catch (NoSuchMethodException e2) {
            throw new AssertionError(e2);
        }
    }

    public static Object i(c cVar, int i2, d.e.a.v.d[] dVarArr, List<Object> list) throws d.e.a.v.a {
        Object objA = cVar.a(list.get(i2));
        if (dVarArr != null) {
            for (d.e.a.v.d dVar : dVarArr) {
                objA = cVar.a(dVar.a(c.f(objA)));
            }
        }
        return objA;
    }

    @Override // d.e.a.t.c
    public d.e.a.v.d b(String str, List<Object> list) {
        String strSubstring;
        int size = list.size();
        ArrayList arrayList = new ArrayList(size);
        arrayList.add(new d.e.a.t.j.b(size));
        int i2 = 1;
        int i3 = size - 1;
        d.e.a.v.d dVarH = null;
        while (true) {
            if (i3 < 0) {
                break;
            }
            Object objA = list.get(i3);
            if (objA != null) {
                arrayList.add(new d.e.a.t.j.a(i3, objA));
                dVarH = h(i3, null, arrayList, objA, str);
                if (dVarH != null) {
                    break;
                }
                String str2 = str;
                ArrayList arrayList2 = null;
                while (true) {
                    int iIndexOf = str2.indexOf(46);
                    if (iIndexOf == -1) {
                        strSubstring = str2;
                        break;
                    }
                    String strSubstring2 = str2.substring(0, iIndexOf);
                    strSubstring = str2.substring(iIndexOf + 1);
                    arrayList.add(new d.e.a.t.j.c(strSubstring2, i3, objA));
                    ArrayList arrayList3 = new ArrayList(i2);
                    arrayList3.add(new d.e.a.t.j.a(0, a(objA)));
                    dVarH = h(0, null, arrayList3, objA, strSubstring2);
                    if (arrayList2 == null) {
                        arrayList2 = new ArrayList();
                    }
                    if (dVarH == null) {
                        arrayList.add(new d.e.a.t.j.f(this, i3, arrayList2, arrayList3));
                        break;
                    }
                    arrayList2.add(dVarH);
                    try {
                        objA = a(((i) dVarH).a(c.f(a(objA))));
                        if (objA == null) {
                            arrayList.add(new d.e.a.t.j.f(this, i3, arrayList2, Collections.singletonList(new d.e.a.t.j.e())));
                            break;
                        }
                        str2 = strSubstring;
                        i2 = 1;
                    } catch (d.e.a.v.a e2) {
                        throw new AssertionError(e2);
                    }
                }
                Object obj = objA;
                if (arrayList2 != null) {
                    arrayList.add(new d.e.a.t.j.f(this, i3, arrayList2, Collections.singletonList(new d.e.a.t.j.a(0, obj))));
                }
                dVarH = h(i3, arrayList2 == null ? null : (d.e.a.v.d[]) arrayList2.toArray(a), arrayList, obj, strSubstring);
                if (dVarH != null) {
                    break;
                }
                if (arrayList2 != null) {
                    dVarH = new g(strSubstring, (d[]) arrayList.toArray(f2534b));
                    break;
                }
            }
            i3--;
            i2 = 1;
        }
        return dVarH == null ? new g(str, (d[]) arrayList.toArray(f2534b)) : dVarH;
    }

    public d.e.a.v.d g(int i2, d.e.a.v.d[] dVarArr, List<? extends d> list, AccessibleObject accessibleObject, Object[] objArr) {
        return new i(i2, dVarArr, (d[]) list.toArray(f2534b), accessibleObject, objArr, this);
    }

    public d.e.a.v.d h(int i2, d.e.a.v.d[] dVarArr, List<d> list, Object obj, String str) {
        Object objA = a(obj);
        if (objA == null) {
            return null;
        }
        if (!(objA instanceof Map)) {
            AccessibleObject accessibleObjectC = c(objA.getClass(), str);
            if (accessibleObjectC == null) {
                return null;
            }
            return g(i2, dVarArr, list, accessibleObjectC, new Object[0]);
        }
        if (((Map) objA).containsKey(str)) {
            list.add(new d.e.a.t.j.d(this, i2, str, true, dVarArr));
            return g(i2, dVarArr, list, f2535c, new Object[]{str});
        }
        list.add(new d.e.a.t.j.d(this, i2, str, false, dVarArr));
        return null;
    }
}
