package androidx.lifecycle;

import android.app.Application;
import p039m1.C1468e;
import p039m1.C1470g;
import p056s0.AbstractC1611a;
import p056s0.C1616d;

/* renamed from: androidx.lifecycle.d0 */
/* loaded from: classes.dex */
public class C0407d0 {

    /* renamed from: a */
    public final C0421g0 f1619a;

    /* renamed from: b */
    public final InterfaceC0411b f1620b;

    /* renamed from: c */
    public final AbstractC1611a f1621c;

    /* renamed from: androidx.lifecycle.d0$a */
    /* loaded from: classes.dex */
    public static class C0408a extends C0412c {

        /* renamed from: c */
        public static final C0409a f1622c = new C0409a(null);

        /* renamed from: d */
        public static final AbstractC1611a.InterfaceC1613b<Application> f1623d = C0409a.C0410a.f1624a;

        /* renamed from: androidx.lifecycle.d0$a$a */
        /* loaded from: classes.dex */
        public static final class C0409a {

            /* renamed from: androidx.lifecycle.d0$a$a$a */
            /* loaded from: classes.dex */
            public static final class C0410a implements AbstractC1611a.InterfaceC1613b<Application> {

                /* renamed from: a */
                public static final C0410a f1624a = new C0410a();
            }

            public C0409a() {
            }

            public /* synthetic */ C0409a(C1468e c1468e) {
                this();
            }
        }
    }

    /* renamed from: androidx.lifecycle.d0$b */
    /* loaded from: classes.dex */
    public interface InterfaceC0411b {
        /* renamed from: a */
        <T extends AbstractC0405c0> T mo693a(Class<T> cls);

        /* renamed from: b */
        <T extends AbstractC0405c0> T mo692b(Class<T> cls, AbstractC1611a abstractC1611a);
    }

    /* renamed from: androidx.lifecycle.d0$c */
    /* loaded from: classes.dex */
    public static class C0412c implements InterfaceC0411b {

        /* renamed from: a */
        public static final C0413a f1625a = new C0413a(null);

        /* renamed from: b */
        public static final AbstractC1611a.InterfaceC1613b<String> f1626b = C0413a.C0414a.f1627a;

        /* renamed from: androidx.lifecycle.d0$c$a */
        /* loaded from: classes.dex */
        public static final class C0413a {

            /* renamed from: androidx.lifecycle.d0$c$a$a */
            /* loaded from: classes.dex */
            public static final class C0414a implements AbstractC1611a.InterfaceC1613b<String> {

                /* renamed from: a */
                public static final C0414a f1627a = new C0414a();
            }

            public C0413a() {
            }

            public /* synthetic */ C0413a(C1468e c1468e) {
                this();
            }
        }
    }

    /* renamed from: androidx.lifecycle.d0$d */
    /* loaded from: classes.dex */
    public static class C0415d {
        /* renamed from: a */
        public void m3718a(AbstractC0405c0 abstractC0405c0) {
            C1470g.m1292e(abstractC0405c0, "viewModel");
        }
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public C0407d0(C0421g0 c0421g0, InterfaceC0411b interfaceC0411b) {
        this(c0421g0, interfaceC0411b, null, 4, null);
        C1470g.m1292e(c0421g0, "store");
        C1470g.m1292e(interfaceC0411b, "factory");
    }

    public C0407d0(C0421g0 c0421g0, InterfaceC0411b interfaceC0411b, AbstractC1611a abstractC1611a) {
        C1470g.m1292e(c0421g0, "store");
        C1470g.m1292e(interfaceC0411b, "factory");
        C1470g.m1292e(abstractC1611a, "defaultCreationExtras");
        this.f1619a = c0421g0;
        this.f1620b = interfaceC0411b;
        this.f1621c = abstractC1611a;
    }

    public /* synthetic */ C0407d0(C0421g0 c0421g0, InterfaceC0411b interfaceC0411b, AbstractC1611a abstractC1611a, int i, C1468e c1468e) {
        this(c0421g0, interfaceC0411b, (i & 4) != 0 ? AbstractC1611a.C1612a.f3735b : abstractC1611a);
    }

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public C0407d0(InterfaceC0423h0 interfaceC0423h0, InterfaceC0411b interfaceC0411b) {
        this(r0, interfaceC0411b, C0419f0.m3708a(interfaceC0423h0));
        C1470g.m1292e(interfaceC0423h0, "owner");
        C1470g.m1292e(interfaceC0411b, "factory");
        C0421g0 mo3701j = interfaceC0423h0.mo3701j();
        C1470g.m1293d(mo3701j, "owner.viewModelStore");
    }

    /* renamed from: a */
    public <T extends AbstractC0405c0> T m3720a(Class<T> cls) {
        C1470g.m1292e(cls, "modelClass");
        String canonicalName = cls.getCanonicalName();
        if (canonicalName != null) {
            return (T) m3719b("androidx.lifecycle.ViewModelProvider.DefaultKey:" + canonicalName, cls);
        }
        throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
    }

    /* renamed from: b */
    public <T extends AbstractC0405c0> T m3719b(String str, Class<T> cls) {
        T t;
        C1470g.m1292e(str, "key");
        C1470g.m1292e(cls, "modelClass");
        T t2 = (T) this.f1619a.m3705b(str);
        if (!cls.isInstance(t2)) {
            C1616d c1616d = new C1616d(this.f1621c);
            c1616d.m791b(C0412c.f1626b, str);
            try {
                t = (T) this.f1620b.mo692b(cls, c1616d);
            } catch (AbstractMethodError unused) {
                t = (T) this.f1620b.mo693a(cls);
            }
            this.f1619a.m3703d(str, t);
            return t;
        }
        InterfaceC0411b interfaceC0411b = this.f1620b;
        C0415d c0415d = interfaceC0411b instanceof C0415d ? (C0415d) interfaceC0411b : null;
        if (c0415d != null) {
            C1470g.m1293d(t2, "viewModel");
            c0415d.m3718a(t2);
        }
        if (t2 != null) {
            return t2;
        }
        throw new NullPointerException("null cannot be cast to non-null type T of androidx.lifecycle.ViewModelProvider.get");
    }
}