package ca.canadapost.module.login.forgotusername;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.lifecycle.c1;
import androidx.lifecycle.d1;
import androidx.lifecycle.e1;
import androidx.lifecycle.g0;
import androidx.lifecycle.u;
import androidx.lifecycle.z0;
import androidx.navigation.fragment.NavHostFragment;
import ca.canadapost.core.data.model.ResultWrapper;
import ca.canadapost.core.data.model.ValidationError;
import ca.canadapost.module.login.forgotusername.ForgotUsernameStep1Fragment;
import ca.canadapost.module.login.forgotusername.b;
import com.google.firebase.messaging.Constants;
import kotlin.Metadata;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import l8.h;
import ld.j;
import ld.k;
import ld.m;
import ld.n;
import od.i0;
import rm.n0;
import rm.q;
import sm.p;
import u7.x;
import u8.g;
import w8.l;
import w8.o;
import w8.p0;
import w8.w;

@Metadata(d1 = {"\u0000 \u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\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\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\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\t\u0018\u00002\u00020\u00012\b\u0012\u0004\u0012\u00020\u00030\u00022\u00020\u00042\u00020\u0005:\u0001.B\u0007¢\u0006\u0004\bV\u0010WJ5\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0007\u001a\u00020\u00062\b\u0010\t\u001a\u0004\u0018\u00010\b2\b\u0010\u000b\u001a\u0004\u0018\u00010\n2\u0006\u0010\r\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u000eH\u0096\u0001J\u0019\u0010\u0017\u001a\u00020\u00162\u0006\u0010\u0013\u001a\u00020\u00122\u0006\u0010\u0015\u001a\u00020\u0014H\u0096\u0001J\u0019\u0010\u001c\u001a\u00020\u00162\u0006\u0010\u0019\u001a\u00020\u00182\u0006\u0010\u001b\u001a\u00020\u001aH\u0096\u0001J\u0019\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u001b\u001a\u00020\u001aH\u0096\u0001J\u0019\u0010 \u001a\u00020\u00162\u0006\u0010\u001f\u001a\u00020\u001e2\u0006\u0010\u0015\u001a\u00020\u0014H\u0096\u0001J\u001b\u0010&\u001a\u00020%2\b\u0010\"\u001a\u0004\u0018\u00010!2\u0006\u0010$\u001a\u00020#H\u0096\u0001J#\u0010)\u001a\u00020%2\u0006\u0010'\u001a\u00020%2\b\u0010(\u001a\u0004\u0018\u00010%2\u0006\u0010$\u001a\u00020#H\u0096\u0001J\u001b\u0010*\u001a\u00020%2\b\u0010\"\u001a\u0004\u0018\u00010!2\u0006\u0010$\u001a\u00020#H\u0096\u0001J\u0019\u0010+\u001a\u00020%2\u0006\u0010'\u001a\u00020%2\u0006\u0010$\u001a\u00020#H\u0096\u0001J\u0011\u0010,\u001a\u00020%2\u0006\u0010$\u001a\u00020#H\u0096\u0001J\u0011\u0010-\u001a\u00020%2\u0006\u0010$\u001a\u00020#H\u0096\u0001J\u0011\u0010.\u001a\u00020%2\u0006\u0010$\u001a\u00020#H\u0096\u0001J\u0019\u00100\u001a\u00020\u00162\u0006\u0010\u001f\u001a\u00020/2\u0006\u0010$\u001a\u00020#H\u0096\u0001J\u0019\u00101\u001a\u00020\u00162\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u001f\u001a\u00020/H\u0096\u0001J\u0011\u00102\u001a\u00020\u00162\u0006\u0010$\u001a\u00020#H\u0096\u0001J\u0019\u00103\u001a\u00020\u00162\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u001f\u001a\u00020/H\u0096\u0001J\u001b\u00105\u001a\u00020\u00162\b\u00104\u001a\u0004\u0018\u00010!2\u0006\u0010$\u001a\u00020#H\u0096\u0001J$\u00106\u001a\u00020\u00102\u0006\u0010\u0007\u001a\u00020\u00062\b\u0010\t\u001a\u0004\u0018\u00010\b2\b\u0010\u000b\u001a\u0004\u0018\u00010\nH\u0016J\u001a\u00108\u001a\u00020\u00162\u0006\u00107\u001a\u00020\u00102\b\u0010\u000b\u001a\u0004\u0018\u00010\nH\u0016R\"\u0010@\u001a\u0002098\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b:\u0010;\u001a\u0004\b<\u0010=\"\u0004\b>\u0010?R\"\u0010H\u001a\u00020A8\u0004@\u0004X\u0085.¢\u0006\u0012\n\u0004\bB\u0010C\u001a\u0004\bD\u0010E\"\u0004\bF\u0010GR\u001b\u0010N\u001a\u00020I8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bJ\u0010K\u001a\u0004\bL\u0010MR\u001b\u0010\u000f\u001a\u00020O8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bP\u0010K\u001a\u0004\bQ\u0010RR\u0014\u0010U\u001a\u00020\u00038\u0016X\u0096\u0005¢\u0006\u0006\u001a\u0004\bS\u0010T¨\u0006X"}, d2 = {"Lca/canadapost/module/login/forgotusername/ForgotUsernameStep1Fragment;", "Lu8/b;", "", "Lod/i0;", "Lw8/p0;", "Lw8/o;", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroidx/lifecycle/u;", "viewLifecycleOwner", "Landroidx/lifecycle/z0;", "viewModel", "Landroid/view/View;", "Q", "Ll8/h;", "spinnerVM", "Landroidx/fragment/app/f;", "fragment", "Lrm/n0;", "K", "Landroid/app/Activity;", "activity", "Ll8/h$b;", "event", "c", "p", "Ll8/c;", Constants.IPC_BUNDLE_KEY_SEND_ERROR, "J", "Lca/canadapost/core/data/model/ValidationError;", "validationError", "Landroid/content/Context;", "context", "", "m", "code", "message", "n", "i", "j", "h", "d", "a", "Lca/canadapost/core/data/model/ResultWrapper$Error;", "e", "l", "o", "g", "valError", "k", "onCreateView", "view", "onViewCreated", "Lo8/o;", "v", "Lo8/o;", "O", "()Lo8/o;", "setTransitionAnimation", "(Lo8/o;)V", "transitionAnimation", "Lsd/h;", "w", "Lsd/h;", "M", "()Lsd/h;", "setForgotUsernameStep1ViewModelFactory", "(Lsd/h;)V", "forgotUsernameStep1ViewModelFactory", "Lld/n;", "x", "Lrm/o;", "N", "()Lld/n;", "sharedViewModel", "Lsd/g;", "y", "P", "()Lsd/g;", "L", "()Lod/i0;", "binding", "<init>", "()V", "login_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class ForgotUsernameStep1Fragment extends u8.b implements p0, o {

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

    /* renamed from: t, reason: collision with root package name */
    private final /* synthetic */ l f10033t = new l();

    /* renamed from: u, reason: collision with root package name */
    private final /* synthetic */ a f10034u = new a();

    /* renamed from: v, reason: collision with root package name and from kotlin metadata */
    public o8.o transitionAnimation;

    /* renamed from: w, reason: collision with root package name and from kotlin metadata */
    protected sd.h forgotUsernameStep1ViewModelFactory;

    /* renamed from: x, reason: collision with root package name and from kotlin metadata */
    private final rm.o sharedViewModel;

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

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public static final class a implements o {
        @Override // w8.o
        public String a(Context context) {
            return o.a.h(this, context);
        }

        public void b(l8.c cVar, androidx.fragment.app.f fVar) {
            o.a.a(this, cVar, fVar);
        }

        @Override // w8.o
        public String d(Context context) {
            return o.a.g(this, context);
        }

        @Override // w8.o
        public void e(ResultWrapper.Error error, Context context) {
            o.a.i(this, error, context);
        }

        @Override // w8.o
        public void g(androidx.fragment.app.f fVar, ResultWrapper.Error error) {
            o.a.l(this, fVar, error);
        }

        @Override // w8.o
        public String h(Context context) {
            return o.a.f(this, context);
        }

        @Override // w8.o
        public String i(ValidationError validationError, Context context) {
            return o.a.d(this, validationError, context);
        }

        @Override // w8.o
        public String j(String str, Context context) {
            return o.a.e(this, str, context);
        }

        @Override // w8.o
        public void k(ValidationError validationError, Context context) {
            o.a.m(this, validationError, context);
        }

        @Override // w8.o
        public void l(androidx.fragment.app.f fVar, ResultWrapper.Error error) {
            o.a.j(this, fVar, error);
        }

        @Override // w8.o
        public String m(ValidationError validationError, Context context) {
            String[] strArr;
            boolean N;
            t.g(context, "context");
            strArr = ca.canadapost.module.login.forgotusername.b.f10063a;
            String code = validationError != null ? validationError.getCode() : null;
            if (code == null) {
                code = "";
            }
            N = p.N(strArr, code);
            if (!N) {
                return o.a.b(this, validationError, context);
            }
            String string = context.getString(m.G);
            t.d(string);
            return string;
        }

        @Override // w8.o
        public String n(String str, String str2, Context context) {
            return o.a.c(this, str, str2, context);
        }

        @Override // w8.o
        public void o(Context context) {
            o.a.k(this, context);
        }
    }

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

        public final void a(Boolean bool) {
            ForgotUsernameStep1Fragment.this.C();
            Bundle bundle = new Bundle();
            t.d(bool);
            bundle.putBoolean("IsTwoSVEnrolled", bool.booleanValue());
            w.c(NavHostFragment.INSTANCE.a(ForgotUsernameStep1Fragment.this), j.f27932r, bundle, ForgotUsernameStep1Fragment.this.O().c());
        }

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

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

        public final void a(n0 n0Var) {
            g.a aVar = u8.g.f36993k;
            Context requireContext = ForgotUsernameStep1Fragment.this.requireContext();
            String string = ForgotUsernameStep1Fragment.this.getString(m.f28011u0);
            t.f(string, "getString(...)");
            aVar.j(requireContext, string, ForgotUsernameStep1Fragment.this.getString(m.f28013v0)).x(ForgotUsernameStep1Fragment.this.requireContext());
        }

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

    /* loaded from: classes4.dex */
    static final class d extends v implements dn.a {
        d() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final e1 invoke() {
            return NavHostFragment.INSTANCE.a(ForgotUsernameStep1Fragment.this).y(j.N);
        }
    }

    /* 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 f10042p;

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

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final d1 invoke() {
            d1 viewModelStore = ((e1) this.f10042p.invoke()).getViewModelStore();
            t.f(viewModelStore, "ownerProducer().viewModelStore");
            return viewModelStore;
        }
    }

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

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

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

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

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final c1.c invoke() {
            Object invoke = this.f10043p.invoke();
            androidx.lifecycle.l lVar = invoke instanceof androidx.lifecycle.l ? (androidx.lifecycle.l) invoke : null;
            c1.c defaultViewModelProviderFactory = lVar != null ? lVar.getDefaultViewModelProviderFactory() : null;
            if (defaultViewModelProviderFactory == null) {
                defaultViewModelProviderFactory = this.f10044q.getDefaultViewModelProviderFactory();
            }
            t.f(defaultViewModelProviderFactory, "(ownerProducer() as? Has…tViewModelProviderFactory");
            return defaultViewModelProviderFactory;
        }
    }

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

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

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

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

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

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

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

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

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

            public a(ForgotUsernameStep1Fragment forgotUsernameStep1Fragment) {
                this.f10048b = forgotUsernameStep1Fragment;
            }

            @Override // androidx.lifecycle.c1.c
            public z0 a(Class modelClass) {
                t.g(modelClass, "modelClass");
                sd.g a10 = this.f10048b.M().a(this.f10048b.N());
                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 h(dn.a aVar, ForgotUsernameStep1Fragment forgotUsernameStep1Fragment) {
            super(0);
            this.f10046p = aVar;
            this.f10047q = forgotUsernameStep1Fragment;
        }

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

    public ForgotUsernameStep1Fragment() {
        rm.o a10;
        d dVar = new d();
        this.sharedViewModel = androidx.fragment.app.p0.a(this, kotlin.jvm.internal.p0.b(n.class), new e(dVar), new f(dVar, this));
        a10 = q.a(new h(new g(this), this));
        this.viewModel = a10;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final n N() {
        return (n) this.sharedViewModel.getValue();
    }

    private final sd.g P() {
        return (sd.g) this.viewModel.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void R(ForgotUsernameStep1Fragment this$0, String str) {
        t.g(this$0, "this$0");
        this$0.L().A.A.setError(str);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void S(ForgotUsernameStep1Fragment this$0, String str) {
        t.g(this$0, "this$0");
        this$0.L().A.B.setError(str);
    }

    public void J(l8.c error, androidx.fragment.app.f fragment) {
        t.g(error, "error");
        t.g(fragment, "fragment");
        this.f10034u.b(error, fragment);
    }

    public void K(l8.h spinnerVM, androidx.fragment.app.f fragment) {
        t.g(spinnerVM, "spinnerVM");
        t.g(fragment, "fragment");
        this.f10033t.b(spinnerVM, fragment);
    }

    public i0 L() {
        return (i0) this.f10032s.b();
    }

    protected final sd.h M() {
        sd.h hVar = this.forgotUsernameStep1ViewModelFactory;
        if (hVar != null) {
            return hVar;
        }
        t.y("forgotUsernameStep1ViewModelFactory");
        return null;
    }

    public final o8.o O() {
        o8.o oVar = this.transitionAnimation;
        if (oVar != null) {
            return oVar;
        }
        t.y("transitionAnimation");
        return null;
    }

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

    @Override // w8.o
    public String a(Context context) {
        t.g(context, "context");
        return this.f10034u.a(context);
    }

    @Override // w8.p0
    public void c(Activity activity, h.b event) {
        t.g(activity, "activity");
        t.g(event, "event");
        this.f10033t.c(activity, event);
    }

    @Override // w8.o
    public String d(Context context) {
        t.g(context, "context");
        return this.f10034u.d(context);
    }

    @Override // w8.o
    public void e(ResultWrapper.Error error, Context context) {
        t.g(error, "error");
        t.g(context, "context");
        this.f10034u.e(error, context);
    }

    @Override // w8.o
    public void g(androidx.fragment.app.f fragment, ResultWrapper.Error error) {
        t.g(fragment, "fragment");
        t.g(error, "error");
        this.f10034u.g(fragment, error);
    }

    @Override // w8.o
    public String h(Context context) {
        t.g(context, "context");
        return this.f10034u.h(context);
    }

    @Override // w8.o
    public String i(ValidationError validationError, Context context) {
        t.g(context, "context");
        return this.f10034u.i(validationError, context);
    }

    @Override // w8.o
    public String j(String code, Context context) {
        t.g(code, "code");
        t.g(context, "context");
        return this.f10034u.j(code, context);
    }

    @Override // w8.o
    public void k(ValidationError validationError, Context context) {
        t.g(context, "context");
        this.f10034u.k(validationError, context);
    }

    @Override // w8.o
    public void l(androidx.fragment.app.f fragment, ResultWrapper.Error error) {
        t.g(fragment, "fragment");
        t.g(error, "error");
        this.f10034u.l(fragment, error);
    }

    @Override // w8.o
    public String m(ValidationError validationError, Context context) {
        t.g(context, "context");
        return this.f10034u.m(validationError, context);
    }

    @Override // w8.o
    public String n(String code, String message, Context context) {
        t.g(code, "code");
        t.g(context, "context");
        return this.f10034u.n(code, message, context);
    }

    @Override // w8.o
    public void o(Context context) {
        t.g(context, "context");
        this.f10034u.o(context);
    }

    @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 Q(inflater, container, savedInstanceState, viewLifecycleOwner, P());
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        androidx.fragment.app.k activity = getActivity();
        if (activity != null) {
            activity.setTitle(getString(m.f27974c));
        }
        J(P(), this);
        K(P(), this);
        P().V().j(getViewLifecycleOwner(), new g0() { // from class: sd.e
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                ForgotUsernameStep1Fragment.R(ForgotUsernameStep1Fragment.this, (String) obj);
            }
        });
        P().Y().j(getViewLifecycleOwner(), new g0() { // from class: sd.f
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                ForgotUsernameStep1Fragment.S(ForgotUsernameStep1Fragment.this, (String) obj);
            }
        });
        P().W().j(getViewLifecycleOwner(), new b.a(new b()));
        P().Z().j(getViewLifecycleOwner(), new b.a(new c()));
    }

    @Override // w8.p0
    public void p(androidx.fragment.app.f fragment, h.b event) {
        t.g(fragment, "fragment");
        t.g(event, "event");
        this.f10033t.p(fragment, event);
    }
}
