package vb;

import android.app.Application;
import android.content.Context;
import androidx.lifecycle.a0;
import androidx.lifecycle.f0;
import ca.canadapost.core.data.auth.model.ProofingState;
import ca.canadapost.core.data.profile.model.AMSPrerequisitesResponse;
import d9.f;
import g9.i;
import java.util.ArrayList;
import kn.l;
import kotlin.jvm.internal.g0;
import kotlin.jvm.internal.p0;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import l8.e;
import l8.g;
import rm.n0;

/* loaded from: classes4.dex */
public final class b extends androidx.lifecycle.b {

    /* renamed from: n, reason: collision with root package name */
    static final /* synthetic */ l[] f39399n = {p0.h(new g0(b.class, "doubleClickGuard", "getDoubleClickGuard()Z", 0))};

    /* renamed from: o, reason: collision with root package name */
    public static final int f39400o = 8;

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

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

    /* renamed from: e, reason: collision with root package name */
    private final i f39403e;

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

    /* renamed from: g, reason: collision with root package name */
    private final f0 f39405g;

    /* renamed from: h, reason: collision with root package name */
    private final a0 f39406h;

    /* renamed from: i, reason: collision with root package name */
    private final g f39407i;

    /* renamed from: j, reason: collision with root package name */
    private final a0 f39408j;

    /* renamed from: k, reason: collision with root package name */
    private final g f39409k;

    /* renamed from: l, reason: collision with root package name */
    private final a0 f39410l;

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

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public static final class a extends v implements dn.a {

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(AMSPrerequisitesResponse aMSPrerequisitesResponse) {
            super(0);
            this.f39413q = aMSPrerequisitesResponse;
        }

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

        /* renamed from: invoke, reason: collision with other method in class */
        public final void m448invoke() {
            Integer valueOf;
            if (b.this.Z()) {
                return;
            }
            AMSPrerequisitesResponse aMSPrerequisitesResponse = this.f39413q;
            boolean b10 = aMSPrerequisitesResponse != null ? t.b(aMSPrerequisitesResponse.getL1AuthStatus(), Boolean.TRUE) : false;
            ProofingState proofingState = (ProofingState) b.this.f39403e.c().f();
            boolean isL2Authenticated = proofingState != null ? proofingState.isL2Authenticated() : false;
            g gVar = b.this.f39407i;
            if (!b10 && !isL2Authenticated) {
                valueOf = Integer.valueOf(ob.i.P);
            } else {
                b.this.d0("accountinfo_name_clickforfullname");
                valueOf = Integer.valueOf(ob.i.Q);
            }
            gVar.q(valueOf);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: vb.b$b, reason: collision with other inner class name */
    /* loaded from: classes4.dex */
    public static final class C0934b extends v implements dn.a {
        C0934b() {
            super(0);
        }

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

        /* renamed from: invoke, reason: collision with other method in class */
        public final void m449invoke() {
            if (b.this.Z()) {
                return;
            }
            b.this.d0("accountinfo_name_clickforalternatenames");
            b.this.f39409k.s();
        }
    }

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public b(f analyticsService, t7.c contextService, ka.b userProfileRepository, i l2Repository) {
        super((Application) r8);
        t.g(analyticsService, "analyticsService");
        t.g(contextService, "contextService");
        t.g(userProfileRepository, "userProfileRepository");
        t.g(l2Repository, "l2Repository");
        Context a10 = contextService.a();
        t.e(a10, "null cannot be cast to non-null type android.app.Application");
        this.f39401c = analyticsService;
        this.f39402d = userProfileRepository;
        this.f39403e = l2Repository;
        this.f39404f = new e(false, 0L, 3, null);
        f0 f0Var = new f0();
        this.f39405g = f0Var;
        this.f39406h = f0Var;
        g gVar = new g();
        this.f39407i = gVar;
        this.f39408j = gVar;
        g gVar2 = new g();
        this.f39409k = gVar2;
        this.f39410l = gVar2;
        androidx.lifecycle.g0 g0Var = new androidx.lifecycle.g0() { // from class: vb.a
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                b.W(b.this, (AMSPrerequisitesResponse) obj);
            }
        };
        this.f39411m = g0Var;
        f.a.c(analyticsService, "Accountsetting_name_updatescreen", null, 2, null);
        Y(this, null, 1, null);
        userProfileRepository.J().k(g0Var);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void W(b this$0, AMSPrerequisitesResponse aMSPrerequisitesResponse) {
        t.g(this$0, "this$0");
        this$0.X(aMSPrerequisitesResponse);
    }

    private final void X(AMSPrerequisitesResponse aMSPrerequisitesResponse) {
        ArrayList arrayList = new ArrayList();
        Context applicationContext = P().getApplicationContext();
        String string = applicationContext.getString(ob.l.f31351v2);
        t.f(string, "getString(...)");
        String string2 = applicationContext.getString(ob.l.f31346u2);
        t.f(string2, "getString(...)");
        arrayList.add(new d(string, string2));
        String string3 = applicationContext.getString(ob.l.f31341t2);
        t.f(string3, "getString(...)");
        arrayList.add(new pb.c(string3, null, 0, false, false, false, new a(aMSPrerequisitesResponse), 62, null));
        if (aMSPrerequisitesResponse != null ? t.b(aMSPrerequisitesResponse.getStatus(), Boolean.TRUE) : false) {
            String string4 = applicationContext.getString(ob.l.f31331r2);
            t.f(string4, "getString(...)");
            String string5 = applicationContext.getString(ob.l.f31326q2);
            t.f(string5, "getString(...)");
            arrayList.add(new d(string4, string5));
            String string6 = applicationContext.getString(ob.l.f31321p2);
            t.f(string6, "getString(...)");
            arrayList.add(new pb.c(string6, null, 0, false, false, false, new C0934b(), 62, null));
        }
        this.f39405g.q(arrayList);
    }

    static /* synthetic */ void Y(b bVar, AMSPrerequisitesResponse aMSPrerequisitesResponse, int i10, Object obj) {
        if ((i10 & 1) != 0) {
            aMSPrerequisitesResponse = null;
        }
        bVar.X(aMSPrerequisitesResponse);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final boolean Z() {
        return this.f39404f.a(this, f39399n[0]).booleanValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void d0(String str) {
        this.f39401c.b(str, d9.e.f15943f.a("Accountsetting_name_updatescreen"));
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // androidx.lifecycle.z0
    public void O() {
        this.f39402d.J().o(this.f39411m);
        super.O();
    }

    public final a0 a0() {
        return this.f39406h;
    }

    public final a0 b0() {
        return this.f39410l;
    }

    public final a0 c0() {
        return this.f39408j;
    }
}
