package E1;

import F5.C0115b;
import O1.C0225a;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import androidx.lifecycle.C0518x;
import androidx.lifecycle.EnumC0510o;
import androidx.lifecycle.InterfaceC0505j;
import androidx.lifecycle.InterfaceC0516v;
import androidx.lifecycle.X;
import androidx.lifecycle.Y;
import androidx.lifecycle.Z;
import androidx.lifecycle.a0;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Set;
import r0.C1484c;

/* JADX INFO: renamed from: E1.j, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0103j implements InterfaceC0516v, a0, InterfaceC0505j, U1.e {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final Context f2086q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public A f2087r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final Bundle f2088s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public EnumC0510o f2089t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final v f2090u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final String f2091v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final Bundle f2092w;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public boolean f2095z;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final C0518x f2093x = new C0518x(this);

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final C0225a f2094y = new C0225a(new V1.a(this, new C0115b(3, this)), 15);

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public final A6.k f2084A = new A6.k(new A5.f(7, this));

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public EnumC0510o f2085B = EnumC0510o.f8835r;

    public C0103j(Context context, A a3, Bundle bundle, EnumC0510o enumC0510o, v vVar, String str, Bundle bundle2) {
        this.f2086q = context;
        this.f2087r = a3;
        this.f2088s = bundle;
        this.f2089t = enumC0510o;
        this.f2090u = vVar;
        this.f2091v = str;
        this.f2092w = bundle2;
    }

    @Override // androidx.lifecycle.InterfaceC0516v
    public final O3.e C() {
        return this.f2093x;
    }

    @Override // androidx.lifecycle.InterfaceC0505j
    public final Y H() {
        return (androidx.lifecycle.T) this.f2084A.getValue();
    }

    @Override // androidx.lifecycle.InterfaceC0505j
    public final C1484c a() {
        C1484c c1484c = new C1484c(0);
        Context applicationContext = this.f2086q.getApplicationContext();
        Application application = applicationContext instanceof Application ? (Application) applicationContext : null;
        LinkedHashMap linkedHashMap = c1484c.f16348a;
        if (application != null) {
            linkedHashMap.put(X.f8819e, application);
        }
        linkedHashMap.put(androidx.lifecycle.P.f8797a, this);
        linkedHashMap.put(androidx.lifecycle.P.f8798b, this);
        Bundle bundle = this.f2088s;
        if (bundle != null) {
            linkedHashMap.put(androidx.lifecycle.P.f8799c, bundle);
        }
        return c1484c;
    }

    public final void b(EnumC0510o enumC0510o) {
        P6.g.e(enumC0510o, "maxState");
        this.f2085B = enumC0510o;
        c();
    }

    public final void c() {
        if (!this.f2095z) {
            C0225a c0225a = this.f2094y;
            ((V1.a) c0225a.f5010r).a();
            this.f2095z = true;
            if (this.f2090u != null) {
                androidx.lifecycle.P.e(this);
            }
            c0225a.p(this.f2092w);
        }
        int iOrdinal = this.f2089t.ordinal();
        int iOrdinal2 = this.f2085B.ordinal();
        C0518x c0518x = this.f2093x;
        if (iOrdinal < iOrdinal2) {
            c0518x.J(this.f2089t);
        } else {
            c0518x.J(this.f2085B);
        }
    }

    public final boolean equals(Object obj) {
        Set<String> setKeySet;
        if (obj != null && (obj instanceof C0103j)) {
            C0103j c0103j = (C0103j) obj;
            if (P6.g.a(this.f2091v, c0103j.f2091v) && P6.g.a(this.f2087r, c0103j.f2087r) && P6.g.a(this.f2093x, c0103j.f2093x) && P6.g.a((C0225a) this.f2094y.f5011s, (C0225a) c0103j.f2094y.f5011s)) {
                Bundle bundle = this.f2088s;
                Bundle bundle2 = c0103j.f2088s;
                if (P6.g.a(bundle, bundle2)) {
                    return true;
                }
                if (bundle != null && (setKeySet = bundle.keySet()) != null) {
                    if (setKeySet.isEmpty()) {
                        return true;
                    }
                    for (String str : setKeySet) {
                        if (!P6.g.a(bundle.get(str), bundle2 != null ? bundle2.get(str) : null)) {
                        }
                    }
                    return true;
                }
            }
        }
        return false;
    }

    @Override // U1.e
    public final C0225a h() {
        return (C0225a) this.f2094y.f5011s;
    }

    public final int hashCode() {
        Set<String> setKeySet;
        int iHashCode = this.f2087r.hashCode() + (this.f2091v.hashCode() * 31);
        Bundle bundle = this.f2088s;
        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 ((C0225a) this.f2094y.f5011s).hashCode() + ((this.f2093x.hashCode() + (iHashCode * 31)) * 31);
    }

    @Override // androidx.lifecycle.a0
    public final Z r() {
        if (!this.f2095z) {
            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.f2093x.f8849t == EnumC0510o.f8834q) {
            throw new IllegalStateException("You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.");
        }
        v vVar = this.f2090u;
        if (vVar == null) {
            throw new IllegalStateException("You must call setViewModelStore() on your NavHostController before accessing the ViewModelStore of a navigation graph.");
        }
        String str = this.f2091v;
        P6.g.e(str, "backStackEntryId");
        LinkedHashMap linkedHashMap = vVar.f2135b;
        Z z8 = (Z) linkedHashMap.get(str);
        if (z8 != null) {
            return z8;
        }
        Z z9 = new Z();
        linkedHashMap.put(str, z9);
        return z9;
    }
}
