package i5;

import android.os.Bundle;
import androidx.lifecycle.n;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;

/* loaded from: classes.dex */
public final class e {

    /* renamed from: d, reason: collision with root package name */
    public static final a f22433d = new a(null);

    /* renamed from: a, reason: collision with root package name */
    private final f f22434a;

    /* renamed from: b, reason: collision with root package name */
    private final d f22435b;

    /* renamed from: c, reason: collision with root package name */
    private boolean f22436c;

    /* loaded from: classes.dex */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(k kVar) {
            this();
        }

        public final e a(f owner) {
            t.g(owner, "owner");
            return new e(owner, null);
        }
    }

    public /* synthetic */ e(f fVar, k kVar) {
        this(fVar);
    }

    public static final e a(f fVar) {
        return f22433d.a(fVar);
    }

    public final d b() {
        return this.f22435b;
    }

    public final void c() {
        n lifecycle = this.f22434a.getLifecycle();
        if (!(lifecycle.b() == n.b.INITIALIZED)) {
            throw new IllegalStateException("Restarter must be created only during owner's initialization stage".toString());
        }
        lifecycle.a(new b(this.f22434a));
        this.f22435b.e(lifecycle);
        this.f22436c = true;
    }

    public final void d(Bundle bundle) {
        if (!this.f22436c) {
            c();
        }
        n lifecycle = this.f22434a.getLifecycle();
        if (!lifecycle.b().isAtLeast(n.b.STARTED)) {
            this.f22435b.f(bundle);
            return;
        }
        throw new IllegalStateException(("performRestore cannot be called when owner is " + lifecycle.b()).toString());
    }

    public final void e(Bundle outBundle) {
        t.g(outBundle, "outBundle");
        this.f22435b.g(outBundle);
    }

    private e(f fVar) {
        this.f22434a = fVar;
        this.f22435b = new d();
    }
}
