package o;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Th, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0500Th {
    public final HashMap a = new HashMap();
    public final HashMap b;

    public C0500Th(HashMap map) {
        this.b = map;
        for (Map.Entry entry : map.entrySet()) {
            UK uk = (UK) entry.getValue();
            List arrayList = (List) this.a.get(uk);
            if (arrayList == null) {
                arrayList = new ArrayList();
                this.a.put(uk, arrayList);
            }
            arrayList.add((C0526Uh) entry.getKey());
        }
    }

    public static void a(List list, InterfaceC0898cL interfaceC0898cL, UK uk, Object obj) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        if (list != null) {
            for (int size = list.size() - 1; size >= 0; size--) {
                C0526Uh c0526Uh = (C0526Uh) list.get(size);
                Method method = c0526Uh.b;
                try {
                    int i = c0526Uh.a;
                    if (i == 0) {
                        method.invoke(obj, null);
                    } else if (i == 1) {
                        method.invoke(obj, interfaceC0898cL);
                    } else if (i == 2) {
                        method.invoke(obj, interfaceC0898cL, uk);
                    }
                } catch (IllegalAccessException e) {
                    throw new RuntimeException(e);
                } catch (InvocationTargetException e2) {
                    throw new RuntimeException("Failed to call observer method", e2.getCause());
                }
            }
        }
    }
}
