package defpackage;

import android.app.Application;
import android.os.Bundle;
import java.lang.reflect.Constructor;
import java.util.LinkedHashMap;

/* renamed from: ᵵﹶ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4764 implements InterfaceC3109 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final C5553 f17706;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final Bundle f17707;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final Application f17708;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final C0869 f17709;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final C4171 f17710;

    public C4764(Application application, InterfaceC0757 interfaceC0757, Bundle bundle) {
        C0869 c0869;
        this.f17706 = interfaceC0757.mo2487();
        this.f17710 = interfaceC0757.mo2484();
        this.f17707 = bundle;
        this.f17708 = application;
        if (application != null) {
            if (C0869.f3959 == null) {
                C0869.f3959 = new C0869(application);
            }
            c0869 = C0869.f3959;
        } else {
            c0869 = new C0869(null);
        }
        this.f17709 = c0869;
    }

    @Override // defpackage.InterfaceC3109
    /* renamed from: ˏᵙ */
    public final AbstractC0481 mo7444(C5563 c5563, C0118 c0118) {
        return mo7446(c5563.f20859, c0118);
    }

    @Override // defpackage.InterfaceC3109
    /* renamed from: ᵥᵯˎ */
    public final AbstractC0481 mo7445(Class cls) {
        String canonicalName = cls.getCanonicalName();
        if (canonicalName != null) {
            return m10071(cls, canonicalName);
        }
        ᵹˉᵞ.ˌᵜᵹᵩ("Local and anonymous classes can not be ViewModels");
        return null;
    }

    @Override // defpackage.InterfaceC3109
    /* renamed from: ᵴᵳ */
    public final AbstractC0481 mo7446(Class cls, C0118 c0118) {
        LinkedHashMap linkedHashMap = c0118.f13546;
        String str = (String) linkedHashMap.get(AbstractC0463.f2526);
        if (str == null) {
            ᵹˉᵞ.ᵳٴᵶ("VIEW_MODEL_KEY must always be provided by ViewModelProvider");
            return null;
        }
        if (linkedHashMap.get(AbstractC4379.f16373) == null || linkedHashMap.get(AbstractC4379.f16374) == null) {
            if (this.f17710 != null) {
                return m10071(cls, str);
            }
            ᵹˉᵞ.ᵳٴᵶ("SAVED_STATE_REGISTRY_OWNER_KEY andVIEW_MODEL_STORE_OWNER_KEY must be provided in the creation extras tosuccessfully create a ViewModel.");
            return null;
        }
        Application application = (Application) linkedHashMap.get(C0869.f3958);
        boolean zIsAssignableFrom = AbstractC0800.class.isAssignableFrom(cls);
        Constructor constructorM2056 = (!zIsAssignableFrom || application == null) ? AbstractC0450.m2056(cls, AbstractC0450.f2507) : AbstractC0450.m2056(cls, AbstractC0450.f2506);
        return constructorM2056 == null ? this.f17709.m2995(cls, c0118) : (!zIsAssignableFrom || application == null) ? AbstractC0450.m2057(cls, constructorM2056, AbstractC4379.m9363(c0118)) : AbstractC0450.m2057(cls, constructorM2056, application, AbstractC4379.m9363(c0118));
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final AbstractC0481 m10071(Class cls, String str) throws NoSuchMethodException, SecurityException {
        C2268 c2268;
        C4171 c4171 = this.f17710;
        if (c4171 == null) {
            C0190.m1432("SavedStateViewModelFactory constructed with empty constructor supports only calls to create(modelClass: Class<T>, extras: CreationExtras).");
            return null;
        }
        boolean zIsAssignableFrom = AbstractC0800.class.isAssignableFrom(cls);
        Application application = this.f17708;
        Constructor constructorM2056 = (!zIsAssignableFrom || application == null) ? AbstractC0450.m2056(cls, AbstractC0450.f2507) : AbstractC0450.m2056(cls, AbstractC0450.f2506);
        if (constructorM2056 == null) {
            if (application != null) {
                return this.f17709.m2994(cls);
            }
            if (ᵤᵞᵝ.ᵴᵳ == null) {
                ᵤᵞᵝ.ᵴᵳ = new ᵤᵞᵝ(11);
            }
            ᵤᵞᵝ.ᵴᵳ.getClass();
            return ᵙᵛᵯ.ᵸˑ(cls);
        }
        C5553 c5553 = this.f17706;
        Bundle bundleM11190 = c5553.m11190(str);
        if (bundleM11190 == null) {
            bundleM11190 = this.f17707;
        }
        if (bundleM11190 == null) {
            c2268 = new C2268();
        } else {
            bundleM11190.setClassLoader(C2268.class.getClassLoader());
            C4892 c4892 = new C4892(bundleM11190.size());
            for (String str2 : bundleM11190.keySet()) {
                c4892.put(str2, bundleM11190.get(str2));
            }
            c2268 = new C2268(c4892.m10341());
        }
        C2189 c2189 = new C2189(str, c2268);
        c2189.m5852(c5553, c4171);
        EnumC5294 enumC5294 = c4171.f15587;
        int i = 1;
        if (enumC5294 == EnumC5294.f19809 || enumC5294.m10953(EnumC5294.f19812)) {
            c5553.m11191();
        } else {
            c4171.m9082(new C1134(c4171, i, c5553));
        }
        AbstractC0481 abstractC0481M2057 = (!zIsAssignableFrom || application == null) ? AbstractC0450.m2057(cls, constructorM2056, c2268) : AbstractC0450.m2057(cls, constructorM2056, application, c2268);
        abstractC0481M2057.m2100("androidx.lifecycle.savedstate.vm.tag", c2189);
        return abstractC0481M2057;
    }
}
