package androidx.view;

import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import androidx.lifecycle.ak;
import androidx.lifecycle.an;
import androidx.lifecycle.ap;
import androidx.lifecycle.at;
import androidx.lifecycle.h;
import androidx.lifecycle.k;
import androidx.lifecycle.t;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import defpackage.cr4;
import defpackage.de6;
import defpackage.i85;
import defpackage.ika;
import defpackage.j65;
import defpackage.jka;
import defpackage.kp6;
import defpackage.pj6;
import defpackage.ua8;
import defpackage.v65;
import defpackage.va8;
import defpackage.vx8;
import defpackage.wa8;
import defpackage.wm1;
import defpackage.xja;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Set;
import java.util.UUID;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u00032\u00020\u0004:\u0003\u0005\u0006\u0007¨\u0006\b"}, d2 = {"Landroidx/navigation/NavBackStackEntry;", "Li85;", "Ljka;", "Landroidx/lifecycle/h;", "Lwa8;", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "b", "SavedStateViewModel", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class NavBackStackEntry implements i85, jka, h, wa8 {
    public final Context a;
    public ao b;
    public final Bundle c;
    public k.b d;
    public final pj6 e;
    public final String f;
    public final Bundle i;
    public final t j = new t(this);
    public final va8 k = new va8(this);
    public boolean l;
    public final j65 m;
    public final j65 n;
    public k.b o;
    public final ap p;

    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0002\u0018\u00002\u00020\u0001B\u000f\u0012\u0006\u0010\u0003\u001a\u00020\u0002¢\u0006\u0004\b\u0004\u0010\u0005¨\u0006\u0006"}, d2 = {"Landroidx/navigation/NavBackStackEntry$SavedStateViewModel;", "Lxja;", "Landroidx/lifecycle/ak;", "handle", "<init>", "(Landroidx/lifecycle/ak;)V", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class SavedStateViewModel extends xja {
        public final ak a;

        public SavedStateViewModel(@kp6 ak akVar) {
            cr4.g(akVar, "handle");
            this.a = akVar;
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Landroidx/navigation/NavBackStackEntry$a;", "", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class a {
        public static NavBackStackEntry a(Context context, ao aoVar, Bundle bundle, k.b bVar, pj6 pj6Var) {
            String string = UUID.randomUUID().toString();
            cr4.f(string, "randomUUID().toString()");
            cr4.g(aoVar, "destination");
            cr4.g(bVar, "hostLifecycleState");
            return new NavBackStackEntry(context, aoVar, bundle, bVar, pj6Var, string, null);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Landroidx/navigation/NavBackStackEntry$b;", "Landroidx/lifecycle/a;", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class b extends androidx.lifecycle.a {
        @Override // androidx.lifecycle.a
        public final xja b(String str, Class cls, ak akVar) {
            cr4.g(cls, "modelClass");
            return new SavedStateViewModel(akVar);
        }
    }

    public NavBackStackEntry(Context context, ao aoVar, Bundle bundle, k.b bVar, pj6 pj6Var, String str, Bundle bundle2) {
        this.a = context;
        this.b = aoVar;
        this.c = bundle;
        this.d = bVar;
        this.e = pj6Var;
        this.f = str;
        this.i = bundle2;
        j65 j65VarA = v65.a(new g(this));
        this.m = j65VarA;
        this.n = v65.a(new h(this));
        this.o = k.b.b;
        this.p = (ap) j65VarA.getValue();
    }

    public final Bundle a() {
        Bundle bundle = this.c;
        if (bundle == null) {
            return null;
        }
        return new Bundle(bundle);
    }

    public final void b(k.b bVar) {
        cr4.g(bVar, "maxState");
        this.o = bVar;
        c();
    }

    public final void c() {
        if (!this.l) {
            va8 va8Var = this.k;
            va8Var.a();
            this.l = true;
            if (this.e != null) {
                an.b(this);
            }
            va8Var.b(this.i);
        }
        int iOrdinal = this.d.ordinal();
        int iOrdinal2 = this.o.ordinal();
        t tVar = this.j;
        if (iOrdinal < iOrdinal2) {
            tVar.h(this.d);
        } else {
            tVar.h(this.o);
        }
    }

    public final boolean equals(Object obj) {
        Set<String> setKeySet;
        if (obj != null && (obj instanceof NavBackStackEntry)) {
            NavBackStackEntry navBackStackEntry = (NavBackStackEntry) obj;
            Bundle bundle = navBackStackEntry.c;
            if (cr4.b(this.f, navBackStackEntry.f) && cr4.b(this.b, navBackStackEntry.b) && cr4.b(this.j, navBackStackEntry.j) && cr4.b(this.k.b, navBackStackEntry.k.b)) {
                Bundle bundle2 = this.c;
                if (cr4.b(bundle2, bundle)) {
                    return true;
                }
                if (bundle2 != null && (setKeySet = bundle2.keySet()) != null) {
                    if (setKeySet.isEmpty()) {
                        return true;
                    }
                    for (String str : setKeySet) {
                        if (!cr4.b(bundle2.get(str), bundle != null ? bundle.get(str) : null)) {
                        }
                    }
                    return true;
                }
            }
        }
        return false;
    }

    @Override // androidx.lifecycle.h
    public final wm1 getDefaultViewModelCreationExtras() {
        de6 de6Var = new de6(0);
        Context applicationContext = this.a.getApplicationContext();
        Application application = applicationContext instanceof Application ? (Application) applicationContext : null;
        LinkedHashMap linkedHashMap = de6Var.a;
        if (application != null) {
            linkedHashMap.put(at.a.d, application);
        }
        linkedHashMap.put(an.a, this);
        linkedHashMap.put(an.b, this);
        Bundle bundleA = a();
        if (bundleA != null) {
            linkedHashMap.put(an.c, bundleA);
        }
        return de6Var;
    }

    @Override // androidx.lifecycle.h
    public final at.c getDefaultViewModelProviderFactory() {
        return this.p;
    }

    @Override // defpackage.i85
    public final k getLifecycle() {
        return this.j;
    }

    @Override // defpackage.wa8
    public final ua8 getSavedStateRegistry() {
        return this.k.b;
    }

    @Override // defpackage.jka
    public final ika getViewModelStore() {
        if (!this.l) {
            throw new IllegalStateException("You cannot access the NavBackStackEntry's ViewModels until it is added to the NavController's back stack (i.e., the Lifecycle of the NavBackStackEntry reaches the CREATED state).");
        }
        if (this.j.d == k.b.a) {
            throw new IllegalStateException("You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.");
        }
        pj6 pj6Var = this.e;
        if (pj6Var != null) {
            return pj6Var.a(this.f);
        }
        throw new IllegalStateException("You must call setViewModelStore() on your NavHostController before accessing the ViewModelStore of a navigation graph.");
    }

    public final int hashCode() {
        Set<String> setKeySet;
        int iHashCode = this.b.hashCode() + (this.f.hashCode() * 31);
        Bundle bundle = this.c;
        if (bundle != null && (setKeySet = bundle.keySet()) != null) {
            Iterator<T> it = setKeySet.iterator();
            while (it.hasNext()) {
                int i = iHashCode * 31;
                Object obj = bundle.get((String) it.next());
                iHashCode = i + (obj != null ? obj.hashCode() : 0);
            }
        }
        return this.k.b.hashCode() + ((this.j.hashCode() + (iHashCode * 31)) * 31);
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(NavBackStackEntry.class.getSimpleName());
        sb.append("(" + this.f + ')');
        sb.append(" destination=");
        sb.append(this.b);
        String string = sb.toString();
        cr4.f(string, "sb.toString()");
        return string;
    }
}
