package hb;

import ca.canadapost.core.data.consumerhome.model.HomeTrackPin;
import ca.canadapost.core.data.consumerhome.model.HomeTrackPinStatus;
import ca.canadapost.core.data.consumerhome.model.LatestEvent;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import dn.p;
import gb.b0;
import java.security.InvalidParameterException;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import l7.n;
import l7.o;
import rm.n0;
import v0.z1;
import y0.l2;
import y0.m;
import y0.x2;

/* loaded from: classes4.dex */
public abstract class d {

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

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ b0 f21456p;

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(b0 b0Var, int i10) {
            super(2);
            this.f21456p = b0Var;
            this.f21457q = i10;
        }

        public final void a(m mVar, int i10) {
            d.a(this.f21456p, mVar, l2.a(this.f21457q | 1));
        }

        @Override // dn.p
        public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
            a((m) obj, ((Number) obj2).intValue());
            return n0.f34904a;
        }
    }

    /* loaded from: classes4.dex */
    public /* synthetic */ class b {

        /* renamed from: a, reason: collision with root package name */
        public static final /* synthetic */ int[] f21458a;

        static {
            int[] iArr = new int[HomeTrackPinStatus.values().length];
            try {
                iArr[HomeTrackPinStatus.INVALID.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[HomeTrackPinStatus.READY_TO_PICKUP.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            f21458a = iArr;
        }
    }

    public static final void a(b0 itemData, m mVar, int i10) {
        int i11;
        m mVar2;
        t.g(itemData, "itemData");
        m r10 = mVar.r(909936236);
        if ((i10 & 14) == 0) {
            i11 = (r10.R(itemData) ? 4 : 2) | i10;
        } else {
            i11 = i10;
        }
        if ((i11 & 11) == 2 && r10.v()) {
            r10.A();
            mVar2 = r10;
        } else {
            if (y0.p.H()) {
                y0.p.Q(909936236, i11, -1, "ca.canadapost.module.consumerhome.landing.items.trackpackageitem.Description (Description.kt:17)");
            }
            String b10 = b(itemData.f());
            if (b10.length() > 0) {
                n.a(c3.h.t(12), o.Vertical, r10, 54);
                n7.a aVar = n7.a.f29827a;
                int i12 = n7.a.f29828b;
                mVar2 = r10;
                z1.b(b10, null, aVar.a(r10, i12).f().c(), 0L, null, null, null, 0L, null, null, 0L, 0, false, 0, 0, null, aVar.c(r10, i12).d(), mVar2, 0, 0, 65530);
            } else {
                mVar2 = r10;
            }
            if (y0.p.H()) {
                y0.p.P();
            }
        }
        x2 y10 = mVar2.y();
        if (y10 != null) {
            y10.a(new a(itemData, i10));
        }
    }

    private static final String b(HomeTrackPin homeTrackPin) {
        LatestEvent latestEvent;
        if (t.b(homeTrackPin.getCanPayOnline(), Boolean.TRUE)) {
            Float customsAmtDue = homeTrackPin.getCustomsAmtDue();
            if ((customsAmtDue != null ? customsAmtDue.floatValue() : 0.0f) > BitmapDescriptorFactory.HUE_RED) {
                Float fundsCollected = homeTrackPin.getFundsCollected();
                if ((fundsCollected != null ? fundsCollected.floatValue() : 0.0f) == BitmapDescriptorFactory.HUE_RED) {
                    return "";
                }
            }
        }
        int i10 = b.f21458a[homeTrackPin.getStatus().ordinal()];
        if (i10 == 1) {
            throw new InvalidParameterException("Shouldn't be in the list.");
        }
        if (i10 == 2 || (latestEvent = homeTrackPin.getLatestEvent()) == null) {
            return "";
        }
        String descriptionEn = w8.m.a() ? latestEvent.getDescriptionEn() : latestEvent.getDescriptionFr();
        return descriptionEn == null ? "" : descriptionEn;
    }
}
