package ca.canadapost.module.login.linkemail;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.activity.p;
import androidx.lifecycle.c1;
import androidx.lifecycle.e1;
import androidx.lifecycle.g0;
import androidx.lifecycle.u;
import androidx.lifecycle.z0;
import com.google.android.gms.common.Scopes;
import dn.l;
import kotlin.Metadata;
import kotlin.jvm.internal.n;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import ld.k;
import rm.n0;
import rm.o;
import rm.q;
import u7.x;

@Metadata(d1 = {"\u0000[\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\b\u0007*\u0001$\u0018\u00002\u00020\u00012\b\u0012\u0004\u0012\u00020\u00030\u0002B\u0007¢\u0006\u0004\b(\u0010)J5\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0005\u001a\u00020\u00042\b\u0010\u0007\u001a\u0004\u0018\u00010\u00062\b\u0010\t\u001a\u0004\u0018\u00010\b2\u0006\u0010\u000b\u001a\u00020\n2\u0006\u0010\r\u001a\u00020\fH\u0096\u0001J$\u0010\u0010\u001a\u00020\u000e2\u0006\u0010\u0005\u001a\u00020\u00042\b\u0010\u0007\u001a\u0004\u0018\u00010\u00062\b\u0010\t\u001a\u0004\u0018\u00010\bH\u0016J\u001a\u0010\u0013\u001a\u00020\u00122\u0006\u0010\u0011\u001a\u00020\u000e2\b\u0010\t\u001a\u0004\u0018\u00010\bH\u0016J\b\u0010\u0015\u001a\u00020\u0014H\u0016J\b\u0010\u0016\u001a\u00020\u0012H\u0016R\"\u0010\u001e\u001a\u00020\u00178\u0004@\u0004X\u0085.¢\u0006\u0012\n\u0004\b\u0018\u0010\u0019\u001a\u0004\b\u001a\u0010\u001b\"\u0004\b\u001c\u0010\u001dR\u001b\u0010\r\u001a\u00020\u001f8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b \u0010!\u001a\u0004\b\"\u0010#R\u0014\u0010'\u001a\u00020$8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b%\u0010&¨\u0006*"}, d2 = {"Lca/canadapost/module/login/linkemail/LinkEmailClaimEmailSuccessFragment;", "Lu8/b;", "", "Lod/o0;", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroidx/lifecycle/u;", "viewLifecycleOwner", "Landroidx/lifecycle/z0;", "viewModel", "Landroid/view/View;", "J", "onCreateView", "view", "Lrm/n0;", "onViewCreated", "", "E", "onResume", "Lvd/b;", "t", "Lvd/b;", "H", "()Lvd/b;", "setLinkEmailClaimEmailSuccessViewModelFactory", "(Lvd/b;)V", "linkEmailClaimEmailSuccessViewModelFactory", "Lvd/a;", "u", "Lrm/o;", "I", "()Lvd/a;", "ca/canadapost/module/login/linkemail/LinkEmailClaimEmailSuccessFragment$a", "v", "Lca/canadapost/module/login/linkemail/LinkEmailClaimEmailSuccessFragment$a;", "onBackPressedCallback", "<init>", "()V", "login_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class LinkEmailClaimEmailSuccessFragment extends u8.b {

    /* renamed from: s, reason: collision with root package name */
    private final /* synthetic */ x f10065s = new x(k.f27961u);

    /* renamed from: t, reason: collision with root package name and from kotlin metadata */
    protected vd.b linkEmailClaimEmailSuccessViewModelFactory;

    /* renamed from: u, reason: collision with root package name and from kotlin metadata */
    private final o viewModel;

    /* renamed from: v, reason: collision with root package name and from kotlin metadata */
    private final a onBackPressedCallback;

    /* loaded from: classes4.dex */
    public static final class a extends p {
        a() {
            super(true);
        }

        @Override // androidx.activity.p
        public void d() {
            LinkEmailClaimEmailSuccessFragment.this.I().X();
            j(false);
        }
    }

    /* loaded from: classes4.dex */
    static final class b extends v implements l {
        b() {
            super(1);
        }

        public final void a(n0 n0Var) {
            LinkEmailClaimEmailSuccessFragment.this.requireActivity().finish();
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((n0) obj);
            return n0.f34904a;
        }
    }

    /* loaded from: classes4.dex */
    static final class c implements g0, n {

        /* renamed from: a, reason: collision with root package name */
        private final /* synthetic */ l f10071a;

        c(l function) {
            t.g(function, "function");
            this.f10071a = function;
        }

        @Override // kotlin.jvm.internal.n
        public final rm.i b() {
            return this.f10071a;
        }

        @Override // androidx.lifecycle.g0
        public final /* synthetic */ void d(Object obj) {
            this.f10071a.invoke(obj);
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof g0) && (obj instanceof n)) {
                return t.b(b(), ((n) obj).b());
            }
            return false;
        }

        public final int hashCode() {
            return b().hashCode();
        }
    }

    /* loaded from: classes4.dex */
    public static final class d extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ androidx.fragment.app.f f10072p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public d(androidx.fragment.app.f fVar) {
            super(0);
            this.f10072p = fVar;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final androidx.fragment.app.f invoke() {
            return this.f10072p;
        }
    }

    /* loaded from: classes4.dex */
    public static final class e extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ dn.a f10073p;

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ LinkEmailClaimEmailSuccessFragment f10074q;

        /* loaded from: classes4.dex */
        public static final class a implements c1.c {

            /* renamed from: b, reason: collision with root package name */
            final /* synthetic */ LinkEmailClaimEmailSuccessFragment f10075b;

            public a(LinkEmailClaimEmailSuccessFragment linkEmailClaimEmailSuccessFragment) {
                this.f10075b = linkEmailClaimEmailSuccessFragment;
            }

            @Override // androidx.lifecycle.c1.c
            public z0 a(Class modelClass) {
                t.g(modelClass, "modelClass");
                vd.b H = this.f10075b.H();
                Bundle arguments = this.f10075b.getArguments();
                vd.a a10 = H.a(arguments != null ? arguments.getString(Scopes.EMAIL, null) : null);
                t.e(a10, "null cannot be cast to non-null type U of ca.canadapost.core.common.utils.KotlinExtensionsKt.viewModels.<no name provided>.invoke.<no name provided>.create");
                return a10;
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public e(dn.a aVar, LinkEmailClaimEmailSuccessFragment linkEmailClaimEmailSuccessFragment) {
            super(0);
            this.f10073p = aVar;
            this.f10074q = linkEmailClaimEmailSuccessFragment;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final z0 invoke() {
            return new c1((e1) this.f10073p.invoke(), new a(this.f10074q)).a(vd.a.class);
        }
    }

    public LinkEmailClaimEmailSuccessFragment() {
        o a10;
        a10 = q.a(new e(new d(this), this));
        this.viewModel = a10;
        this.onBackPressedCallback = new a();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final vd.a I() {
        return (vd.a) this.viewModel.getValue();
    }

    @Override // u8.b
    public boolean E() {
        I().X();
        return true;
    }

    protected final vd.b H() {
        vd.b bVar = this.linkEmailClaimEmailSuccessViewModelFactory;
        if (bVar != null) {
            return bVar;
        }
        t.y("linkEmailClaimEmailSuccessViewModelFactory");
        return null;
    }

    public View J(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, u viewLifecycleOwner, z0 viewModel) {
        t.g(inflater, "inflater");
        t.g(viewLifecycleOwner, "viewLifecycleOwner");
        t.g(viewModel, "viewModel");
        return this.f10065s.c(inflater, container, savedInstanceState, viewLifecycleOwner, viewModel);
    }

    @Override // androidx.fragment.app.f
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        t.g(inflater, "inflater");
        u viewLifecycleOwner = getViewLifecycleOwner();
        t.f(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        return J(inflater, container, savedInstanceState, viewLifecycleOwner, I());
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onResume() {
        super.onResume();
        if (I().V().getBoolean("one_to_one_duplicate_email_flow", true)) {
            return;
        }
        requireActivity().finish();
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        androidx.activity.q onBackPressedDispatcher;
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        I().T().j(getViewLifecycleOwner(), new c(new b()));
        androidx.fragment.app.k activity = getActivity();
        if (activity == null || (onBackPressedDispatcher = activity.getOnBackPressedDispatcher()) == null) {
            return;
        }
        u viewLifecycleOwner = getViewLifecycleOwner();
        t.f(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        onBackPressedDispatcher.i(viewLifecycleOwner, this.onBackPressedCallback);
    }
}
