package androidx.lifecycle;

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;

/* JADX INFO: renamed from: androidx.lifecycle.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0497b {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final HashMap f8822a = new HashMap();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final HashMap f8823b;

    public C0497b(HashMap map) {
        this.f8823b = map;
        for (Map.Entry entry : map.entrySet()) {
            EnumC0509n enumC0509n = (EnumC0509n) entry.getValue();
            List arrayList = (List) this.f8822a.get(enumC0509n);
            if (arrayList == null) {
                arrayList = new ArrayList();
                this.f8822a.put(enumC0509n, arrayList);
            }
            arrayList.add((C0498c) entry.getKey());
        }
    }

    public static void a(List list, InterfaceC0516v interfaceC0516v, EnumC0509n enumC0509n, InterfaceC0515u interfaceC0515u) {
        if (list != null) {
            for (int size = list.size() - 1; size >= 0; size--) {
                C0498c c0498c = (C0498c) list.get(size);
                c0498c.getClass();
                try {
                    int i = c0498c.f8824a;
                    Method method = c0498c.f8825b;
                    if (i == 0) {
                        method.invoke(interfaceC0515u, null);
                    } else if (i == 1) {
                        method.invoke(interfaceC0515u, interfaceC0516v);
                    } else if (i == 2) {
                        method.invoke(interfaceC0515u, interfaceC0516v, enumC0509n);
                    }
                } catch (IllegalAccessException e8) {
                    throw new RuntimeException(e8);
                } catch (InvocationTargetException e9) {
                    throw new RuntimeException("Failed to call observer method", e9.getCause());
                }
            }
        }
    }
}
