package zd;

import androidx.lifecycle.a0;
import androidx.lifecycle.f0;
import ca.canadapost.core.data.mymail.model.CampaignName;
import ca.canadapost.core.data.mymail.model.Logo;
import ca.canadapost.core.data.mymail.model.MyMailCommercialDetailsUIModel;
import d9.f;
import java.util.Map;
import kn.l;
import kotlin.jvm.internal.g0;
import kotlin.jvm.internal.p0;
import kotlin.jvm.internal.t;
import l8.g;
import p9.h;
import rm.c0;
import sm.q0;

/* loaded from: classes4.dex */
public final class b extends yd.c {
    static final /* synthetic */ l[] B = {p0.h(new g0(b.class, "doubleClickGuard", "getDoubleClickGuard()Z", 0))};
    private final String A;

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

    /* renamed from: r, reason: collision with root package name */
    private final ca.a f53407r;

    /* renamed from: s, reason: collision with root package name */
    private final MyMailCommercialDetailsUIModel f53408s;

    /* renamed from: t, reason: collision with root package name */
    private final l8.e f53409t;

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

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public b(t7.c contextService, g9.d sessionRepository, fa.a myMailRepository, ka.b userRepository, f analyticsService, h featureFlagRepository, ca.a languageService, MyMailCommercialDetailsUIModel myMailDetailsUIModel) {
        super(contextService, myMailRepository, sessionRepository, userRepository, analyticsService);
        t.g(contextService, "contextService");
        t.g(sessionRepository, "sessionRepository");
        t.g(myMailRepository, "myMailRepository");
        t.g(userRepository, "userRepository");
        t.g(analyticsService, "analyticsService");
        t.g(featureFlagRepository, "featureFlagRepository");
        t.g(languageService, "languageService");
        t.g(myMailDetailsUIModel, "myMailDetailsUIModel");
        this.f53406q = featureFlagRepository;
        this.f53407r = languageService;
        this.f53408s = myMailDetailsUIModel;
        this.f53409t = new l8.e(false, 0L, 3, null);
        f0 f0Var = new f0();
        this.f53410u = f0Var;
        this.f53411v = f0Var;
        g gVar = new g();
        this.f53412w = gVar;
        this.f53413x = gVar;
        g gVar2 = new g();
        this.f53414y = gVar2;
        this.f53415z = gVar2;
        String str = null;
        if (languageService.b()) {
            CampaignName campaignName = myMailDetailsUIModel.getCampaignName();
            if (campaignName != null) {
                str = campaignName.getEn();
            }
        } else {
            CampaignName campaignName2 = myMailDetailsUIModel.getCampaignName();
            if (campaignName2 != null) {
                str = campaignName2.getFr();
            }
        }
        this.A = str;
        m0();
    }

    private final boolean U() {
        return this.f53409t.a(this, B[0]).booleanValue();
    }

    private final void m0() {
        Map p10;
        Map p11;
        String screenRenderAnalyticsURL = this.f53408s.getScreenRenderAnalyticsURL();
        if (screenRenderAnalyticsURL != null) {
            this.f53414y.q(screenRenderAnalyticsURL);
        }
        f0 f0Var = this.f53410u;
        String str = null;
        if (this.f53407r.g()) {
            Logo logo = this.f53408s.getLogo();
            if (logo != null) {
                str = logo.getFr();
            }
        } else {
            Logo logo2 = this.f53408s.getLogo();
            if (logo2 != null) {
                str = logo2.getEn();
            }
        }
        f0Var.q(str);
        if (this.f53406q.d(p9.a.MY_MAIL_ANALYTICS)) {
            f T = T();
            p10 = q0.p(d9.e.f15943f.a("MyMail_Ad_Page"), c0.a("e.Var88", "fullpage_ad | " + this.A + " | consumer | " + this.f53408s.getMailerName()));
            p11 = q0.p(p10, c0.a("s.events", "21"));
            T.c("MyMail_Ad_Page", p11);
        }
    }

    public final a0 i0() {
        return this.f53411v;
    }

    public final a0 j0() {
        return this.f53415z;
    }

    public final MyMailCommercialDetailsUIModel k0() {
        return this.f53408s;
    }

    public final a0 l0() {
        return this.f53413x;
    }

    public final void n0() {
        Map p10;
        Map p11;
        if (U()) {
            return;
        }
        String buttonClickAnalyticsURL = this.f53408s.getButtonClickAnalyticsURL();
        if (buttonClickAnalyticsURL != null) {
            this.f53414y.q(buttonClickAnalyticsURL);
        }
        String buttonRedirectURL = this.f53408s.getButtonRedirectURL();
        if (buttonRedirectURL != null) {
            if (this.f53406q.d(p9.a.MY_MAIL_ANALYTICS)) {
                f T = T();
                p10 = q0.p(d9.e.f15943f.a("MyMail_Ad_Page"), c0.a("e.Var88", "fullpage_ad | " + this.A + " | consumer | " + this.f53408s.getMailerName()));
                p11 = q0.p(p10, c0.a("s.events", "10"));
                T.b("CPC_Remote_Banner_Ad_Click", p11);
            }
            this.f53412w.q(buttonRedirectURL);
        }
    }
}
