package defpackage;

import android.os.Bundle;
import java.util.Arrays;
import java.util.LinkedHashMap;

/* renamed from: ᵱʝ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public abstract class AbstractC4379 {

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static final ˉᵻ f16373 = new ˉᵻ(6);

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static final ᵬˆˀᵣ f16374 = new ᵬˆˀᵣ(6);

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public static final ˊᵿʗ f16372 = new ˊᵿʗ(6);

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public static final C3984 m9362(InterfaceC2827 interfaceC2827) {
        return (C3984) new C0030(interfaceC2827.mo2486(), new ᵤᵞᵝ(0), ᵸᵡˋʧ.ᵯٴᵦ(interfaceC2827)).m1020(AbstractC1641.m4709(C3984.class), "androidx.lifecycle.internal.SavedStateHandlesVM");
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static final C2268 m9363(C0118 c0118) {
        C2268 c2268;
        LinkedHashMap linkedHashMap = c0118.f13546;
        InterfaceC0757 interfaceC0757 = (InterfaceC0757) linkedHashMap.get(f16373);
        Bundle bundle = null;
        if (interfaceC0757 == null) {
            ᵹˉᵞ.ˌᵜᵹᵩ("CreationExtras must have a value by `SAVED_STATE_REGISTRY_OWNER_KEY`");
            return null;
        }
        InterfaceC2827 interfaceC2827 = (InterfaceC2827) linkedHashMap.get(f16374);
        if (interfaceC2827 == null) {
            ᵹˉᵞ.ˌᵜᵹᵩ("CreationExtras must have a value by `VIEW_MODEL_STORE_OWNER_KEY`");
            return null;
        }
        Bundle bundle2 = (Bundle) linkedHashMap.get(f16372);
        String str = (String) linkedHashMap.get(AbstractC0463.f2526);
        if (str == null) {
            ᵹˉᵞ.ˌᵜᵹᵩ("CreationExtras must have a value by `VIEW_MODEL_KEY`");
            return null;
        }
        InterfaceC5099 interfaceC5099M11176 = interfaceC0757.mo2487().m11176();
        C2540 c2540 = interfaceC5099M11176 instanceof C2540 ? (C2540) interfaceC5099M11176 : null;
        if (c2540 == null) {
            ᵹˉᵞ.ᵳٴᵶ("enableSavedStateHandles() wasn't called prior to createSavedStateHandle() call");
            return null;
        }
        C3984 c3984M9362 = m9362(interfaceC2827);
        C2268 c22682 = (C2268) c3984M9362.f15027.get(str);
        if (c22682 != null) {
            return c22682;
        }
        c2540.m6396();
        Bundle bundle3 = c2540.f9901;
        if (bundle3 != null && bundle3.containsKey(str)) {
            Bundle bundle4 = bundle3.getBundle(str);
            if (bundle4 == null) {
                bundle4 = ˉˇʨ.ᵻᵢﹳᵰ((C2836[]) Arrays.copyOf(new C2836[0], 0));
            }
            bundle3.remove(str);
            if (bundle3.isEmpty()) {
                c2540.f9901 = null;
            }
            bundle = bundle4;
        }
        if (bundle != null) {
            bundle2 = bundle;
        }
        if (bundle2 == null) {
            c2268 = new C2268();
        } else {
            bundle2.setClassLoader(C2268.class.getClassLoader());
            C4892 c4892 = new C4892(bundle2.size());
            for (String str2 : bundle2.keySet()) {
                c4892.put(str2, bundle2.get(str2));
            }
            c2268 = new C2268(c4892.m10341());
        }
        c3984M9362.f15027.put(str, c2268);
        return c2268;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static final void m9364(InterfaceC0757 interfaceC0757) {
        EnumC5294 enumC5294 = interfaceC0757.mo2484().f15587;
        if (enumC5294 == EnumC5294.f19809 || enumC5294 == EnumC5294.f19813) {
            if (interfaceC0757.mo2487().m11176() == null) {
                C2540 c2540 = new C2540(interfaceC0757.mo2487(), (InterfaceC2827) interfaceC0757);
                interfaceC0757.mo2487().m11185("androidx.lifecycle.internal.SavedStateHandlesProvider", c2540);
                interfaceC0757.mo2484().m9082(new C3153(4, c2540));
                return;
            }
            return;
        }
        throw new IllegalArgumentException(("Failed to enable `SavedStateHandle` for `" + interfaceC0757 + "`. The `Lifecycle.State` must be `INITIALIZED` or `CREATED`, but was `" + enumC5294 + "`. You must call `enableSavedStateHandles()` before the `Lifecycle.State` moves to `STARTED`.").toString());
    }
}
