package h0;

import java.lang.reflect.InvocationTargetException;

/* JADX INFO: renamed from: h0.H, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1000H {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final q.i f13041b = new q.i(0);

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ P f13042a;

    public C1000H(P p3) {
        this.f13042a = p3;
    }

    public static Class b(ClassLoader classLoader, String str) throws ClassNotFoundException {
        q.i iVar = f13041b;
        q.i iVar2 = (q.i) iVar.get(classLoader);
        if (iVar2 == null) {
            iVar2 = new q.i(0);
            iVar.put(classLoader, iVar2);
        }
        Class cls = (Class) iVar2.get(str);
        if (cls != null) {
            return cls;
        }
        Class<?> cls2 = Class.forName(str, false, classLoader);
        iVar2.put(str, cls2);
        return cls2;
    }

    public static Class c(ClassLoader classLoader, String str) {
        try {
            return b(classLoader, str);
        } catch (ClassCastException e8) {
            throw new A6.b(I1.a.p("Unable to instantiate fragment ", str, ": make sure class is a valid subclass of Fragment"), e8);
        } catch (ClassNotFoundException e9) {
            throw new A6.b(I1.a.p("Unable to instantiate fragment ", str, ": make sure class name exists"), e9);
        }
    }

    public final ComponentCallbacksC1023x a(String str) {
        try {
            return (ComponentCallbacksC1023x) c(this.f13042a.f13088w.f13306u.getClassLoader(), str).getConstructor(null).newInstance(null);
        } catch (IllegalAccessException e8) {
            throw new A6.b(I1.a.p("Unable to instantiate fragment ", str, ": make sure class name exists, is public, and has an empty constructor that is public"), e8);
        } catch (InstantiationException e9) {
            throw new A6.b(I1.a.p("Unable to instantiate fragment ", str, ": make sure class name exists, is public, and has an empty constructor that is public"), e9);
        } catch (NoSuchMethodException e10) {
            throw new A6.b(I1.a.p("Unable to instantiate fragment ", str, ": could not find Fragment constructor"), e10);
        } catch (InvocationTargetException e11) {
            throw new A6.b(I1.a.p("Unable to instantiate fragment ", str, ": calling Fragment constructor caused an exception"), e11);
        }
    }
}
