package com.ss.android.ugc.aweme.ecommerce.pdp.vh;

import X.070;
import X.0CB;
import X.0CH;
import X.1hK;
import X.3T9;
import X.3Wf;
import X.BJ3;
import X.BTH;
import X.C05;
import X.C5502C1q;
import X.C5886CGk;
import X.C5887CGl;
import X.C5888CGm;
import X.C5890CGo;
import X.C5932CIe;
import X.CG1;
import X.CG2;
import X.CG5;
import X.CG7;
import X.CG9;
import X.CGM;
import X.CGP;
import X.CGQ;
import X.CGR;
import X.CGU;
import X.Crj;
import X.Hzz;
import X.Ltt;
import X.M12;
import X.Mk2;
import X.Mk3;
import X.PgU;
import X.PhE;
import X.PlI;
import X.Qeg;
import android.content.Context;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import com.bytedance.covode.number.Covode;
import com.google.gson.m;
import com.ss.android.ugc.aweme.ecommerce.coupon.repository.api.ClaimVoucherApi;
import com.ss.android.ugc.aweme.ecommerce.coupon.repository.dto.ClaimVoucherRequest;
import com.ss.android.ugc.aweme.ecommerce.coupon.repository.dto.Voucher;
import com.ss.android.ugc.aweme.ecommerce.pdp.IPdpStarter;
import com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import kotlin.h.b.n;

public final class PdpCouponsViewHolder extends AbsFullSpanVH<CGP> implements 3Wf, C5887CGl, C5887CGl {
    public static final SimpleDateFormat LJFF;
    public static final C5886CGk LJI = new C5886CGk((byte) 0);
    public final Crj LJIIIZ;
    public boolean LJIIJ;
    public boolean LJIIJJI;

    public final PdpViewModel LJIILIIL() {
        return (PdpViewModel) this.LJIIIZ.getValue();
    }

    public final void onStateChanged(0CH r1, 0CB r2) {
        super.onStateChanged(r1, r2);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:4:0x0027, code lost:
        r1 = r0.getTrackParams();
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(java.lang.String r15, java.lang.String r16, java.lang.String r17) {
        /*
            r14 = this;
            r2 = r14
            android.view.View r0 = r2.itemView
            java.lang.String r1 = ""
            kotlin.h.b.n.LIZIZ(r0, r1)
            android.content.Context r0 = r0.getContext()
            boolean r0 = r0 instanceof X.1hK
            if (r0 == 0) goto L_0x007b
            X.By4 r3 = X.C5051BtP.LIZ
            android.view.View r0 = r2.itemView
            kotlin.h.b.n.LIZIZ(r0, r1)
            android.content.Context r4 = r0.getContext()
            kotlin.h.b.n.LIZIZ(r4, r1)
            com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel r0 = r14.LJIILIIL()
            com.ss.android.ugc.aweme.ecommerce.pdp.IPdpStarter$PdpEnterParam r0 = r0.LIZ
            r12 = 0
            if (r0 == 0) goto L_0x0080
            java.util.HashMap r1 = r0.getTrackParams()
            if (r1 == 0) goto L_0x0080
            java.lang.String r0 = "entrance_info"
            java.lang.Object r6 = r1.get(r0)
        L_0x0033:
            boolean r0 = r6 instanceof java.lang.String
            if (r0 == 0) goto L_0x007e
            java.lang.String r6 = (java.lang.String) r6
        L_0x0039:
            com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel r0 = r14.LJIILIIL()
            com.ss.android.ugc.aweme.ecommerce.pdp.IPdpStarter$PdpEnterParam r0 = r0.LIZ
            if (r0 == 0) goto L_0x007c
            java.util.HashMap r7 = r0.getTrackParams()
        L_0x0045:
            X.CTK r1 = com.ss.android.ugc.aweme.ecommerce.pdp.IPdpStarter.LIZ
            com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel r0 = r14.LJIILIIL()
            com.ss.android.ugc.aweme.ecommerce.pdp.IPdpStarter$PdpEnterParam r0 = r0.LIZ
            int r0 = r1.LIZ((com.ss.android.ugc.aweme.ecommerce.pdp.IPdpStarter.PdpEnterParam) r0)
            java.lang.String r10 = java.lang.String.valueOf(r0)
            com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel r0 = r14.LJIILIIL()
            boolean r0 = r0.LIZIZ
            java.lang.Boolean r11 = java.lang.Boolean.valueOf(r0)
            com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel r0 = r14.LJIILIIL()
            com.ss.android.ugc.aweme.ecommerce.pdp.IPdpStarter$PdpEnterParam r0 = r0.LIZ
            if (r0 == 0) goto L_0x006b
            java.lang.String r12 = r0.getSourceInfo()
        L_0x006b:
            com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel r0 = r14.LJIILIIL()
            java.lang.String r13 = r0.LJIJI()
            r8 = r16
            r9 = r17
            r5 = r15
            r3.LIZ(r4, r5, r6, r7, r8, r9, r10, r11, r12, r13)
        L_0x007b:
            return
        L_0x007c:
            r7 = r12
            goto L_0x0045
        L_0x007e:
            r6 = r12
            goto L_0x0039
        L_0x0080:
            r6 = r12
            goto L_0x0033
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ecommerce.pdp.vh.PdpCouponsViewHolder.LIZ(java.lang.String, java.lang.String, java.lang.String):void");
    }

    public final void LJIIIZ() {
        PdpCouponsViewHolder.super.LJIIIZ();
        LJIILIIL().LIZIZ((3Wf) this);
    }

    static {
        Covode.recordClassIndex(71574);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss", Locale.ENGLISH);
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
        LJFF = simpleDateFormat;
    }

    private final CGQ LIZ(CGP cgp) {
        if (cgp.LIZLLL.size() == 1) {
            return CGQ.SHOW_ONE_COUPONS;
        }
        if (cgp.LIZLLL.size() > 1) {
            return CGQ.SHOW_MULTI_COUPONS;
        }
        return CGQ.HIDE_ITEM;
    }

    /* JADX WARNING: Illegal instructions before constructor call */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public PdpCouponsViewHolder(android.view.ViewGroup r4) {
        /*
            r3 = this;
            X.M12.LIZ(r4)
            android.content.Context r2 = r4.getContext()
            r1 = 2131559113(0x7f0d02c9, float:1.874356E38)
            r0 = 0
            android.view.View r1 = X.C6489CbV.LIZ(r2, r1, r4, r0)
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZIZ(r1, r0)
            r3.<init>(r1)
            java.lang.Class<com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel> r1 = com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel.class
            X.KEN r0 = X.KEM.LIZ
            X.D1G r1 = r0.LIZ(r1)
            X.BHU r0 = new X.BHU
            r0.<init>(r3, r1, r1)
            X.Crj r0 = X.7he.LIZ(r0)
            r3.LJIIIZ = r0
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ecommerce.pdp.vh.PdpCouponsViewHolder.<init>(android.view.ViewGroup):void");
    }

    private final CGR LIZIZ(Voucher voucher) {
        String voucherID = voucher.getVoucherID();
        if (voucherID == null || voucherID.length() == 0) {
            return CGR.CLAIM;
        }
        String vapSchema = voucher.getVapSchema();
        if (vapSchema == null || vapSchema.length() == 0) {
            return CGR.CLAIMED;
        }
        return CGR.USE;
    }

    private final SpannableStringBuilder LIZ(Voucher voucher) {
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(voucher.getDiscountText() + " ");
        String thresholdText = voucher.getThresholdText();
        if (thresholdText != null) {
            SpannableString spannableString = new SpannableString(thresholdText);
            spannableString.setSpan(new Ltt(92), 0, thresholdText.length(), 34);
            spannableStringBuilder.append(spannableString);
        }
        spannableStringBuilder.setSpan(new ForegroundColorSpan(070.LIZJ(Hzz.LIZJ.LIZ(), 2131099750)), 0, spannableStringBuilder.length(), 34);
        return spannableStringBuilder;
    }

    private final Voucher LIZJ(CG7 cg7) {
        boolean z;
        List<Voucher> list = ((CGP) LJIIJJI()).LIZLLL;
        if (list == null || list.isEmpty()) {
            z = true;
        } else {
            z = false;
        }
        if (z) {
            return null;
        }
        View view = this.itemView;
        n.LIZIZ(view, "");
        if (n.LIZ(cg7, view.findViewById(2131368202))) {
            return ((CGP) LJIIJJI()).LIZLLL.get(0);
        }
        View view2 = this.itemView;
        n.LIZIZ(view2, "");
        if (!n.LIZ(cg7, view2.findViewById(2131367019))) {
            View view3 = this.itemView;
            n.LIZIZ(view3, "");
            if (!n.LIZ(cg7, view3.findViewById(2131369588)) || ((CGP) LJIIJJI()).LIZLLL.size() <= 1) {
                return null;
            }
            return ((CGP) LJIIJJI()).LIZLLL.get(1);
        } else if (((CGP) LJIIJJI()).LIZLLL.size() > 1) {
            return ((CGP) LJIIJJI()).LIZLLL.get(0);
        } else {
            return null;
        }
    }

    public final void LIZIZ(CG7 cg7) {
        String str;
        int i;
        String sourceInfo;
        HashMap<String, Object> trackParams;
        M12.LIZ(cg7);
        Voucher LIZJ = LIZJ(cg7);
        if (LIZJ != null) {
            int i2 = CGM.LJFF[LIZIZ(LIZJ).ordinal()];
            String str2 = "";
            if (i2 == 1) {
                int indexOf = ((CGP) LJIIJJI()).LIZLLL.indexOf(LIZJ);
                CG9 cg9 = LJIILIIL().LJJ;
                if (cg9 != null) {
                    cg9.LIZIZ(LIZJ, "claim_button", indexOf + 1);
                }
                PdpViewModel LJIILIIL = LJIILIIL();
                View view = this.itemView;
                n.LIZIZ(view, str2);
                Context context = view.getContext();
                n.LIZIZ(context, str2);
                M12.LIZ(LIZJ, context);
                ClaimVoucherRequest claimVoucherRequest = new ClaimVoucherRequest(LIZJ.getVoucherTypeID(), 1, Integer.valueOf(IPdpStarter.LIZ.LIZ(LJIILIIL.LIZ)));
                M12.LIZ(claimVoucherRequest);
                PgU LIZ = ((ClaimVoucherApi) CGU.LIZ.LIZ(ClaimVoucherApi.class)).claimVoucher(claimVoucherRequest).LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZ(Mk2.LIZ(Mk3.LIZ));
                n.LIZIZ(LIZ, str2);
                LIZ.LIZIZ(new C5932CIe(LJIILIIL, context, LIZJ, indexOf + 1));
            } else if (i2 == 2) {
                CG9 cg92 = LJIILIIL().LJJ;
                if (cg92 != null) {
                    M12.LIZ(LIZJ);
                    C5890CGo cGo = new C5890CGo();
                    CG1 cg1 = CG1.LIZ;
                    cg1.LIZ(cg1.LIZ(LIZJ), cGo, cg92.LIZ);
                    cGo.LIZJ("discounts_module");
                    cGo.LIZ("use_coupon");
                    cGo.LIZIZ("use");
                    cGo.LJIIJ.put("subsequent_page", "add_on_item");
                    cGo.LIZ(Integer.valueOf(((CGP) LJIIJJI()).LIZLLL.indexOf(LIZJ) + 1));
                    cGo.LIZLLL();
                }
                String vapSchema = LIZJ.getVapSchema();
                if (LIZJ.getFullVapSchema() == null || !LJIILIIL().LIZIZ) {
                    str = "73%";
                    i = 0;
                } else {
                    vapSchema = LIZJ.getFullVapSchema();
                    str = "100%";
                    i = 1;
                }
                if (vapSchema != null) {
                    3T9 r4 = 3T9.LIZ;
                    View view2 = this.itemView;
                    n.LIZIZ(view2, str2);
                    Context context2 = view2.getContext();
                    n.LIZIZ(context2, str2);
                    LinkedHashMap linkedHashMap = new LinkedHashMap();
                    linkedHashMap.put("use_new_container", 1);
                    linkedHashMap.put("height", str);
                    linkedHashMap.put("hide_nav_bar", Integer.valueOf(i));
                    linkedHashMap.put("discount_text", LIZJ.getDiscountText());
                    String thresholdText = LIZJ.getThresholdText();
                    if (thresholdText == null) {
                        thresholdText = str2;
                    }
                    linkedHashMap.put("threshold_text", thresholdText);
                    String validTimeText = LIZJ.getValidTimeText();
                    if (validTimeText != null) {
                        str2 = validTimeText;
                    }
                    linkedHashMap.put("valid_time_text", str2);
                    linkedHashMap.put("voucher_type_id", LIZJ.getVoucherTypeID());
                    LinkedHashMap linkedHashMap2 = new LinkedHashMap();
                    IPdpStarter.PdpEnterParam pdpEnterParam = LJIILIIL().LIZ;
                    if (!(pdpEnterParam == null || (trackParams = pdpEnterParam.getTrackParams()) == null)) {
                        linkedHashMap2.putAll(trackParams);
                    }
                    IPdpStarter.PdpEnterParam pdpEnterParam2 = LJIILIIL().LIZ;
                    if (!(pdpEnterParam2 == null || (sourceInfo = pdpEnterParam2.getSourceInfo()) == null)) {
                        linkedHashMap2.put("source_info", sourceInfo);
                    }
                    linkedHashMap2.put("from_type", 1);
                    linkedHashMap2.put("page_type", 1);
                    linkedHashMap2.put("previous_page", "product_detail");
                    linkedHashMap.put("trackParams", linkedHashMap2);
                    3T9.LIZ(r4, context2, vapSchema, linkedHashMap).open();
                }
            }
        }
    }

    public final void LIZ(long j) {
        int i = CGM.LJ[LIZ((CGP) LJIIJJI()).ordinal()];
        if (i == 1) {
            View view = this.itemView;
            n.LIZIZ(view, "");
            CG7 cg7 = (CG7) view.findViewById(2131368202);
            n.LIZIZ(cg7, "");
            if (LIZ(j, ((CGP) LJIIJJI()).LIZLLL.get(0), cg7)) {
                LJIILIIL().LIZIZ((3Wf) this);
            }
        } else if (i == 2) {
            if (this.LJIIJ) {
                View view2 = this.itemView;
                n.LIZIZ(view2, "");
                CG7 cg72 = (CG7) view2.findViewById(2131367019);
                n.LIZIZ(cg72, "");
                if (LIZ(j, ((CGP) LJIIJJI()).LIZLLL.get(0), cg72)) {
                    this.LJIIJ = false;
                }
            }
            if (this.LJIIJJI) {
                View view3 = this.itemView;
                n.LIZIZ(view3, "");
                CG7 cg73 = (CG7) view3.findViewById(2131369588);
                n.LIZIZ(cg73, "");
                if (LIZ(j, ((CGP) LJIIJJI()).LIZLLL.get(1), cg73)) {
                    this.LJIIJJI = false;
                }
            }
            if (!this.LJIIJ && !this.LJIIJJI) {
                LJIILIIL().LIZIZ((3Wf) this);
            }
        }
    }

    public final void LIZ(CG7 cg7) {
        M12.LIZ(cg7);
        Voucher LIZJ = LIZJ(cg7);
        if (LIZJ != null) {
            CG9 cg9 = LJIILIIL().LJJ;
            if (cg9 != null) {
                cg9.LIZIZ(LIZJ, "coupons", ((CGP) LJIIJJI()).LIZLLL.indexOf(LIZJ) + 1);
            }
            View view = this.itemView;
            n.LIZIZ(view, "");
            if (view.getContext() instanceof 1hK) {
                String str = ((CGP) LJIIJJI()).LIZIZ;
                m mVar = new m();
                mVar.LIZ("voucher_type_id", LIZJ.getVoucherTypeID());
                String jVar = mVar.toString();
                n.LIZIZ(jVar, "");
                LIZ(str, jVar, "coupon");
            }
        }
    }

    /* JADX WARNING: type inference failed for: r0v7, types: [X.CG5, android.view.View$OnClickListener] */
    public final /* synthetic */ void LIZ(Object obj) {
        String str;
        CGP cgp = (CGP) obj;
        M12.LIZ(cgp);
        CG9 cg9 = LJIILIIL().LJJ;
        if (cg9 != null) {
            List<Voucher> list = cgp.LIZLLL;
            if (!cg9.LJJIJLIJ) {
                cg9.LJJIJLIJ = true;
                CG2 LIZ = CG1.LIZ.LIZ(list);
                C5888CGm cGm = new C5888CGm();
                cGm.LIZ(cg9.LIZ);
                String str2 = LIZ.LIZIZ;
                if (str2 == null || str2.length() == 0) {
                    cGm.LIZJ(0);
                } else {
                    Integer num = null;
                    CG1.LIZ.LIZ(LIZ, cGm, (Map<String, ? extends Object>) null);
                    if (list != null) {
                        num = Integer.valueOf(list.size());
                    }
                    cGm.LIZJ(num);
                }
                cGm.LIZLLL();
            }
        }
        LJIILIIL().LIZIZ((3Wf) this);
        this.LJIIJ = false;
        this.LJIIJJI = false;
        View view = this.itemView;
        n.LIZIZ(view, "");
        Qeg findViewById = view.findViewById(2131371242);
        n.LIZIZ(findViewById, "");
        findViewById.setText(cgp.LIZ);
        View view2 = this.itemView;
        n.LIZIZ(view2, "");
        Qeg findViewById2 = view2.findViewById(2131364109);
        n.LIZIZ(findViewById2, "");
        findViewById2.setText(cgp.LIZJ);
        View view3 = this.itemView;
        n.LIZIZ(view3, "");
        LinearLayout linearLayout = (LinearLayout) view3.findViewById(2131363808);
        n.LIZIZ(linearLayout, "");
        linearLayout.setOnClickListener(new CG5(this));
        int i = CGM.LIZ[LIZ(cgp).ordinal()];
        if (i != 1) {
            String str3 = "0";
            if (i == 2) {
                Voucher voucher = cgp.LIZLLL.get(0);
                View view4 = this.itemView;
                n.LIZIZ(view4, "");
                CG7 cg7 = (CG7) view4.findViewById(2131368202);
                n.LIZIZ(cg7, "");
                C5502C1q.LIZ((View) cg7, true);
                View view5 = this.itemView;
                n.LIZIZ(view5, "");
                HorizontalScrollView horizontalScrollView = (HorizontalScrollView) view5.findViewById(2131367760);
                n.LIZIZ(horizontalScrollView, "");
                C5502C1q.LIZ((View) horizontalScrollView, false);
                View view6 = this.itemView;
                n.LIZIZ(view6, "");
                ((CG7) view6.findViewById(2131368202)).setClickListener(this);
                int i2 = CGM.LIZIZ[LIZIZ(voucher).ordinal()];
                if (i2 == 1) {
                    str3 = "1";
                } else if (i2 == 2) {
                    str3 = "2";
                }
                CG9 cg92 = LJIILIIL().LJJ;
                if (cg92 != null) {
                    cg92.LIZ(voucher, str3, 1);
                }
                View view7 = this.itemView;
                n.LIZIZ(view7, "");
                CG7 cg72 = (CG7) view7.findViewById(2131368202);
                n.LIZIZ(cg72, "");
                LIZ(voucher, cg72, 1);
            } else if (i == 3) {
                List<Voucher> list2 = cgp.LIZLLL;
                View view8 = this.itemView;
                n.LIZIZ(view8, "");
                CG7 cg73 = (CG7) view8.findViewById(2131368202);
                n.LIZIZ(cg73, "");
                C5502C1q.LIZ((View) cg73, false);
                View view9 = this.itemView;
                n.LIZIZ(view9, "");
                HorizontalScrollView horizontalScrollView2 = (HorizontalScrollView) view9.findViewById(2131367760);
                n.LIZIZ(horizontalScrollView2, "");
                C5502C1q.LIZ((View) horizontalScrollView2, true);
                View view10 = this.itemView;
                n.LIZIZ(view10, "");
                ((CG7) view10.findViewById(2131367019)).setClickListener(this);
                View view11 = this.itemView;
                n.LIZIZ(view11, "");
                ((CG7) view11.findViewById(2131369588)).setClickListener(this);
                int i3 = CGM.LIZJ[LIZIZ(list2.get(0)).ordinal()];
                if (i3 == 1) {
                    str = "1";
                } else if (i3 != 2) {
                    str = str3;
                } else {
                    str = "2";
                }
                CG9 cg93 = LJIILIIL().LJJ;
                if (cg93 != null) {
                    cg93.LIZ(list2.get(0), str, 1);
                }
                int i4 = CGM.LIZLLL[LIZIZ(list2.get(1)).ordinal()];
                if (i4 == 1) {
                    str3 = "1";
                } else if (i4 == 2) {
                    str3 = "2";
                }
                CG9 cg94 = LJIILIIL().LJJ;
                if (cg94 != null) {
                    cg94.LIZ(list2.get(1), str3, 2);
                }
                View view12 = this.itemView;
                n.LIZIZ(view12, "");
                CG7 cg74 = (CG7) view12.findViewById(2131367019);
                n.LIZIZ(cg74, "");
                LIZ(list2.get(0), cg74, 1);
                View view13 = this.itemView;
                n.LIZIZ(view13, "");
                CG7 cg75 = (CG7) view13.findViewById(2131369588);
                n.LIZIZ(cg75, "");
                LIZ(list2.get(1), cg75, 2);
            }
        } else {
            View view14 = this.itemView;
            n.LIZIZ(view14, "");
            CG7 cg76 = (CG7) view14.findViewById(2131368202);
            n.LIZIZ(cg76, "");
            C5502C1q.LIZ((View) cg76, false);
            View view15 = this.itemView;
            n.LIZIZ(view15, "");
            HorizontalScrollView horizontalScrollView3 = (HorizontalScrollView) view15.findViewById(2131367760);
            n.LIZIZ(horizontalScrollView3, "");
            C5502C1q.LIZ((View) horizontalScrollView3, false);
        }
        BJ3 bj3 = BTH.LIZLLL;
        View view16 = this.itemView;
        n.LIZIZ(view16, "");
        bj3.LIZ(view16, false);
    }

    private final boolean LIZ(Voucher voucher, long j) {
        Long usableEndTime;
        Integer validTimeTextStyle = voucher.getValidTimeTextStyle();
        if (!(validTimeTextStyle == null || validTimeTextStyle.intValue() != 1 || (usableEndTime = voucher.getUsableEndTime()) == null)) {
            long longValue = (usableEndTime.longValue() * 1000) - j;
            if (0 <= longValue && 86400000 >= longValue) {
                return true;
            }
        }
        return false;
    }

    private final void LIZ(Voucher voucher, CG7 cg7, int i) {
        CG9 cg9;
        CGR LIZIZ = LIZIZ(voucher);
        String str = "";
        if (C05.LIZ.LIZ()) {
            int costType = voucher.getCostType();
            String buttonText = voucher.getButtonText();
            if (buttonText == null) {
                buttonText = str;
            }
            cg7.LIZ(costType, LIZIZ, buttonText);
            cg7.setDiscountText(LIZ(voucher));
            cg7.setBgImageVisibility(8);
        } else {
            String buttonText2 = voucher.getButtonText();
            if (buttonText2 == null) {
                buttonText2 = str;
            }
            cg7.LIZ(1, LIZIZ, buttonText2);
            cg7.setDiscountText(voucher.getDiscountText() + " " + voucher.getThresholdText());
        }
        long currentTimeMillis = System.currentTimeMillis();
        if (LIZ(voucher, currentTimeMillis)) {
            LIZ(currentTimeMillis, voucher, cg7);
            LJIILIIL().LIZ((3Wf) this);
            if (i == 1) {
                this.LJIIJ = true;
            } else if (i == 2) {
                this.LJIIJJI = true;
            }
        } else {
            String validTimeText = voucher.getValidTimeText();
            if (validTimeText != null) {
                str = validTimeText;
            }
            cg7.setDiscountTime(str);
        }
        if (LIZIZ == CGR.USE && (cg9 = LJIILIIL().LJJ) != null) {
            cg9.LIZ(voucher, i);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:13:0x0040, code lost:
        if (86400000 < r6) goto L_0x0029;
     */
    /* JADX WARNING: Removed duplicated region for block: B:8:0x002d  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private final boolean LIZ(long r9, com.ss.android.ugc.aweme.ecommerce.coupon.repository.dto.Voucher r11, X.CG7 r12) {
        /*
            r8 = this;
            java.lang.Long r0 = r11.getUsableEndTime()
            r3 = 0
            if (r0 == 0) goto L_0x0043
            long r6 = r0.longValue()
            r0 = 1000(0x3e8, double:4.94E-321)
            long r6 = r6 * r0
            long r6 = r6 - r9
            r4 = 0
            int r0 = (r6 > r4 ? 1 : (r6 == r4 ? 0 : -1))
            if (r0 >= 0) goto L_0x0036
            r6 = 0
        L_0x0017:
            java.text.SimpleDateFormat r1 = LJFF
            java.lang.Long r0 = java.lang.Long.valueOf(r6)
            java.lang.String r1 = r1.format(r0)
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZIZ(r1, r0)
            r12.setDiscountTime(r1)
        L_0x0029:
            int r0 = (r6 > r4 ? 1 : (r6 == r4 ? 0 : -1))
            if (r0 != 0) goto L_0x0043
            com.ss.android.ugc.aweme.ecommerce.pdp.PdpViewModel r1 = r8.LJIILIIL()
            r0 = 1
            r1.LIZ((boolean) r3, (boolean) r0, (boolean) r0)
            return r0
        L_0x0036:
            r1 = 86400000(0x5265c00, double:4.2687272E-316)
            int r0 = (r4 > r6 ? 1 : (r4 == r6 ? 0 : -1))
            if (r0 <= 0) goto L_0x003e
            goto L_0x0029
        L_0x003e:
            int r0 = (r1 > r6 ? 1 : (r1 == r6 ? 0 : -1))
            if (r0 < 0) goto L_0x0029
            goto L_0x0017
        L_0x0043:
            return r3
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.ecommerce.pdp.vh.PdpCouponsViewHolder.LIZ(long, com.ss.android.ugc.aweme.ecommerce.coupon.repository.dto.Voucher, X.CG7):boolean");
    }
}
