package yc;

import android.app.Application;
import android.content.Context;
import ca.canadapost.core.data.model.PhoneNumber;
import d9.f;
import java.util.Map;
import sm.p0;
import tp.m0;
import tp.o0;
import tp.u1;

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

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

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

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

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

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

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

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

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

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

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

    /* renamed from: m, reason: collision with root package name */
    private final l8.g f52114m;

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

    /* renamed from: o, reason: collision with root package name */
    private final l8.g f52116o;

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

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public b(g9.h l1AuthRepository, t7.c contextService, d9.f analyticsService) {
        super((Application) r0);
        kotlin.jvm.internal.t.g(l1AuthRepository, "l1AuthRepository");
        kotlin.jvm.internal.t.g(contextService, "contextService");
        kotlin.jvm.internal.t.g(analyticsService, "analyticsService");
        Context a10 = contextService.a();
        kotlin.jvm.internal.t.e(a10, "null cannot be cast to non-null type android.app.Application");
        this.f52104c = l1AuthRepository;
        this.f52105d = analyticsService;
        this.f52106e = new l8.i(contextService);
        this.f52107f = new l8.d();
        PhoneNumber phoneNumber = (PhoneNumber) l1AuthRepository.b().f();
        this.f52108g = phoneNumber;
        this.f52109h = new androidx.lifecycle.f0(phoneNumber != null ? phoneNumber.toString() : null);
        androidx.lifecycle.f0 f0Var = new androidx.lifecycle.f0();
        this.f52110i = f0Var;
        this.f52111j = f0Var;
        l8.g gVar = new l8.g();
        this.f52112k = gVar;
        this.f52113l = gVar;
        l8.g gVar2 = new l8.g();
        this.f52114m = gVar2;
        this.f52115n = gVar2;
        l8.g gVar3 = new l8.g();
        this.f52116o = gVar3;
        this.f52117p = gVar3;
        f.a.c(analyticsService, "L1 - MobileNumberView", null, 2, null);
    }

    private final boolean V(String str) {
        String normalizePhoneNumber = PhoneNumber.INSTANCE.normalizePhoneNumber(String.valueOf(this.f52108g));
        if (str == null) {
            str = "";
        }
        return !kotlin.jvm.internal.t.b(normalizePhoneNumber, r0.normalizePhoneNumber(str));
    }

    private final boolean Z() {
        String str = (String) this.f52109h.f();
        if ((str == null || str.length() == 0) || PhoneNumber.Companion.parsePhoneNumber$default(PhoneNumber.INSTANCE, str, null, 2, null) == null) {
            this.f52110i.q(P().getString(a0.f52088k));
        } else {
            this.f52110i.q(null);
        }
        return this.f52111j.f() == null;
    }

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

    public final androidx.lifecycle.a0 Q() {
        return this.f52115n;
    }

    public final androidx.lifecycle.a0 R() {
        return this.f52117p;
    }

    public final androidx.lifecycle.f0 S() {
        return this.f52109h;
    }

    public final androidx.lifecycle.a0 T() {
        return this.f52111j;
    }

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

    public final void W() {
        this.f52114m.q(Boolean.valueOf(V((String) this.f52109h.f())));
    }

    public final void X() {
        Map e10;
        d9.f fVar = this.f52105d;
        e10 = p0.e(rm.c0.a("e.Var3", "L1 - MobileNumberView"));
        fVar.b("Add_date_of_birth_link_click_Adobe", e10);
        this.f52104c.b().q(null);
        if (this.f52104c.f().f() == null) {
            this.f52116o.s();
        } else {
            this.f52112k.s();
        }
    }

    public final void Y() {
        String str;
        if (Z() && (str = (String) this.f52109h.f()) != null) {
            if (!V(str)) {
                this.f52114m.q(Boolean.FALSE);
            } else {
                this.f52104c.b().q(PhoneNumber.Companion.parsePhoneNumber$default(PhoneNumber.INSTANCE, str, null, 2, null));
                this.f52112k.s();
            }
        }
    }

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

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

    @Override // l8.h
    public u1 u(m0 m0Var, vm.g context, 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.f52106e.u(m0Var, context, start, str, block);
    }
}
