package we;

import android.app.Application;
import android.content.Context;
import androidx.lifecycle.a1;
import ca.canadapost.core.data.auth.model.RegistrationAccountDetails;
import ca.canadapost.core.data.model.Event;
import ca.canadapost.core.data.model.RepositoryError;
import ca.canadapost.core.data.model.ResultWrapper;
import java.util.LinkedHashMap;
import l8.h;
import tp.u1;

/* loaded from: classes4.dex */
public final class v0 extends androidx.lifecycle.b implements l8.h, l8.c {

    /* renamed from: c, reason: collision with root package name */
    private final g9.k f49331c;

    /* renamed from: d, reason: collision with root package name */
    private final d9.f f49332d;

    /* renamed from: e, reason: collision with root package name */
    private final g9.k f49333e;

    /* renamed from: f, reason: collision with root package name */
    private final ja.d f49334f;

    /* renamed from: g, reason: collision with root package name */
    private final /* synthetic */ l8.i f49335g;

    /* renamed from: h, reason: collision with root package name */
    private final /* synthetic */ l8.d f49336h;

    /* renamed from: i, reason: collision with root package name */
    private final androidx.lifecycle.f0 f49337i;

    /* renamed from: j, reason: collision with root package name */
    private final androidx.lifecycle.a0 f49338j;

    /* renamed from: k, reason: collision with root package name */
    private final androidx.lifecycle.f0 f49339k;

    /* renamed from: l, reason: collision with root package name */
    private final androidx.lifecycle.a0 f49340l;

    /* renamed from: m, reason: collision with root package name */
    private final androidx.lifecycle.f0 f49341m;

    /* renamed from: n, reason: collision with root package name */
    private final androidx.lifecycle.a0 f49342n;

    /* renamed from: o, reason: collision with root package name */
    private final androidx.lifecycle.a0 f49343o;

    /* loaded from: classes4.dex */
    static final class a extends kotlin.jvm.internal.v implements dn.l {

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

        a() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final String invoke(RegistrationAccountDetails registrationAccountDetails) {
            return registrationAccountDetails != null ? registrationAccountDetails.getEmail() : "";
        }
    }

    /* loaded from: classes4.dex */
    static final class b extends kotlin.coroutines.jvm.internal.l implements dn.p {

        /* renamed from: p, reason: collision with root package name */
        int f49345p;

        b(vm.d dVar) {
            super(2, dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            return new b(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            f10 = wm.d.f();
            int i10 = this.f49345p;
            if (i10 == 0) {
                rm.y.b(obj);
                g9.k kVar = v0.this.f49331c;
                this.f49345p = 1;
                obj = kVar.g(this);
                if (obj == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                rm.y.b(obj);
            }
            ResultWrapper.Error error = (ResultWrapper.Error) obj;
            if (error != null) {
                if (error.getError() == RepositoryError.NoNetworkError) {
                    v0.this.W(new ResultWrapper.Error(error.getException(), error.getMessage(), error.getError(), null, 8, null), true);
                }
                v0.this.f49341m.q(new Event(kotlin.coroutines.jvm.internal.b.a(true)));
            } else {
                v0.this.f49332d.b("SSO_verify_new_email_request_Adobe", d9.e.f15943f.a("User-Registration-VerifyEmail"));
                v0.this.f49339k.q(new Event(kotlin.coroutines.jvm.internal.b.a(true)));
            }
            return rm.n0.f34904a;
        }

        @Override // dn.p
        public final Object invoke(tp.m0 m0Var, vm.d dVar) {
            return ((b) create(m0Var, dVar)).invokeSuspend(rm.n0.f34904a);
        }
    }

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public v0(t7.c contextService, g9.k repository, d9.f analyticsService, g9.k registrationRepository, ja.d sharedPreferencesService) {
        super((Application) r0);
        kotlin.jvm.internal.t.g(contextService, "contextService");
        kotlin.jvm.internal.t.g(repository, "repository");
        kotlin.jvm.internal.t.g(analyticsService, "analyticsService");
        kotlin.jvm.internal.t.g(registrationRepository, "registrationRepository");
        kotlin.jvm.internal.t.g(sharedPreferencesService, "sharedPreferencesService");
        Context a10 = contextService.a();
        kotlin.jvm.internal.t.e(a10, "null cannot be cast to non-null type android.app.Application");
        this.f49331c = repository;
        this.f49332d = analyticsService;
        this.f49333e = registrationRepository;
        this.f49334f = sharedPreferencesService;
        this.f49335g = new l8.i(contextService);
        this.f49336h = new l8.d();
        Boolean bool = Boolean.FALSE;
        androidx.lifecycle.f0 f0Var = new androidx.lifecycle.f0(new Event(bool));
        this.f49337i = f0Var;
        this.f49338j = f0Var;
        androidx.lifecycle.f0 f0Var2 = new androidx.lifecycle.f0(new Event(bool));
        this.f49339k = f0Var2;
        this.f49340l = f0Var2;
        androidx.lifecycle.f0 f0Var3 = new androidx.lifecycle.f0(new Event(bool));
        this.f49341m = f0Var3;
        this.f49342n = f0Var3;
        this.f49343o = androidx.lifecycle.y0.a(repository.d(), a.f49344p);
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        String str = (String) registrationRepository.j().f();
        str = str == null ? "" : str;
        kotlin.jvm.internal.t.d(str);
        linkedHashMap.put("e.Var106", str);
        String str2 = (String) registrationRepository.e().f();
        str2 = str2 == null ? "" : str2;
        kotlin.jvm.internal.t.d(str2);
        linkedHashMap.put("e.Var107", str2);
        String str3 = (String) registrationRepository.p().f();
        String str4 = str3 != null ? str3 : "";
        kotlin.jvm.internal.t.d(str4);
        linkedHashMap.put("e.Var108", str4);
        analyticsService.c("User-Registration-VerifyEmail", linkedHashMap);
    }

    @Override // l8.h
    public androidx.lifecycle.a0 J() {
        return this.f49335g.J();
    }

    public final androidx.lifecycle.a0 U() {
        return this.f49343o;
    }

    public final androidx.lifecycle.a0 V() {
        return this.f49338j;
    }

    public void W(ResultWrapper.Error error, boolean z10) {
        kotlin.jvm.internal.t.g(error, "error");
        this.f49336h.a(error, z10);
    }

    public final androidx.lifecycle.a0 X() {
        return this.f49340l;
    }

    public final androidx.lifecycle.a0 Y() {
        return this.f49342n;
    }

    public final void Z() {
        h.a.a(this, a1.a(this), null, null, null, new b(null), 7, null);
    }

    public final void a0() {
        this.f49334f.putBoolean("welcome_screen_is_shown", true);
    }

    public final void b0() {
        this.f49337i.q(new Event(Boolean.TRUE));
    }

    @Override // l8.c
    public androidx.lifecycle.a0 o() {
        return this.f49336h.o();
    }

    @Override // l8.c
    public androidx.lifecycle.a0 t() {
        return this.f49336h.t();
    }

    @Override // l8.h
    public u1 u(tp.m0 m0Var, vm.g context, tp.o0 start, String str, dn.p block) {
        kotlin.jvm.internal.t.g(m0Var, "<this>");
        kotlin.jvm.internal.t.g(context, "context");
        kotlin.jvm.internal.t.g(start, "start");
        kotlin.jvm.internal.t.g(block, "block");
        return this.f49335g.u(m0Var, context, start, str, block);
    }
}
