package androidx.lifecycle;

import D.C0135f;
import J0.B0;
import android.os.Bundle;
import java.util.Arrays;
import java.util.Map;
import n2.C2616g;
import n2.InterfaceC2615f;

/* JADX INFO: loaded from: classes.dex */
public final class Y implements InterfaceC2615f {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final C2616g f12144a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Bundle f12146c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final w4.p f12147d;

    public Y(C2616g savedStateRegistry, j0 j0Var) {
        kotlin.jvm.internal.o.h(savedStateRegistry, "savedStateRegistry");
        this.f12144a = savedStateRegistry;
        this.f12147d = m1.g.k(new C0135f(j0Var, 26));
    }

    @Override // n2.InterfaceC2615f
    public final Bundle a() {
        Bundle bundleM = e4.C.m((w4.k[]) Arrays.copyOf(new w4.k[0], 0));
        Bundle bundle = this.f12146c;
        if (bundle != null) {
            bundleM.putAll(bundle);
        }
        for (Map.Entry<String, U> entry : ((SavedStateHandlesVM) this.f12147d.getValue()).getHandles().entrySet()) {
            String key = entry.getKey();
            Bundle bundleA = ((B0) entry.getValue().f12136b.f6542a).a();
            if (!bundleA.isEmpty()) {
                m1.g.m(bundleM, key, bundleA);
            }
        }
        this.f12145b = false;
        return bundleM;
    }

    public final void b() {
        if (this.f12145b) {
            return;
        }
        Bundle bundleA = this.f12144a.a("androidx.lifecycle.internal.SavedStateHandlesProvider");
        Bundle bundleM = e4.C.m((w4.k[]) Arrays.copyOf(new w4.k[0], 0));
        Bundle bundle = this.f12146c;
        if (bundle != null) {
            bundleM.putAll(bundle);
        }
        if (bundleA != null) {
            bundleM.putAll(bundleA);
        }
        this.f12146c = bundleM;
        this.f12145b = true;
    }
}
