package com.ss.android.ugc.aweme.commercialize.views.cards;

import X.0CB;
import X.0CH;
import X.2GO;
import X.6Is;
import X.C0770KGr;
import X.C3376LIx;
import X.FMU;
import X.ISm;
import X.LJ0;
import X.LQ8;
import X.Rc9;
import android.content.Context;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.commercialize.event.AdCardClose;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import com.ss.android.ugc.aweme.feed.model.AwemeRawAd;
import java.util.Map;
import kotlin.h.b.n;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONObject;

public class FormAdCardActionV2 extends AbsAdCardActionV2 implements 6Is, 2GO {
    public boolean LJIIIIZZ;

    static {
        Covode.recordClassIndex(59989);
    }

    public Map<Integer, Object> getSubscriberEventTypes() {
        Map<Integer, Object> subscriberEventTypes = super.getSubscriberEventTypes();
        subscriberEventTypes.put(78, new Rc9(FormAdCardActionV2.class, "onEvent", AdCardClose.class, ThreadMode.POSTING, 0, false));
        return subscriberEventTypes;
    }

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

    public final void LJFF() {
        if (!this.LJIIIIZZ && !LJIIIIZZ()) {
            super.LJFF();
        }
    }

    public final void LJI() {
        super.LJI();
        this.LIZLLL.LIZ("javascript:window.dialogPopUp()");
    }

    public final void LJII() {
        AwemeRawAd awemeRawAd;
        super.LJII();
        if (!this.LJIIIIZZ) {
            Context context = this.LIZIZ;
            Aweme aweme = this.LIZJ;
            FMU fmu = FMU.LIZ;
            C0770KGr kGr = new C0770KGr();
            if (aweme != null) {
                awemeRawAd = aweme.getAwemeRawAd();
            } else {
                awemeRawAd = null;
            }
            kGr.LIZ = awemeRawAd;
            kGr.LIZJ = false;
            JSONObject LIZ = kGr.LIZ();
            n.LIZIZ(LIZ, "");
            fmu.LIZ(context, aweme, "click_cancel", LIZ);
        }
    }

    public final void LJ() {
        super.LJ();
        C3376LIx lIx = new C3376LIx();
        lIx.LIZ("click");
        lIx.LIZIZ("card");
        lIx.LIZ(this.LIZJ);
        LIZ(lIx.LIZ());
        if (LQ8.LIZIZ.LIZ() != null && LQ8.LIZIZ.LIZ().LIZ(this.LIZIZ)) {
            this.LJIIIIZZ = false;
            LJFF();
        } else if (LQ8.LIZIZ.LIZ() != null) {
            LQ8.LIZIZ.LIZ().LJIIIZ(this.LIZJ);
        }
    }

    @ISm
    public void onEvent(AdCardClose adCardClose) {
        this.LJIIIIZZ = false;
        this.LJ.LIZ("ACTION_HALF_WEB_PAGE_COLLAPSE", (Object) null);
    }

    public final void LIZIZ(String str) {
        AwemeRawAd awemeRawAd;
        super.LIZIZ(str);
        Context context = this.LIZIZ;
        Aweme aweme = this.LIZJ;
        FMU fmu = FMU.LIZ;
        C0770KGr kGr = new C0770KGr();
        if (aweme != null) {
            awemeRawAd = aweme.getAwemeRawAd();
        } else {
            awemeRawAd = null;
        }
        kGr.LIZ = awemeRawAd;
        kGr.LIZJ = false;
        JSONObject LIZ = kGr.LIZ();
        n.LIZIZ(LIZ, "");
        fmu.LIZ(context, aweme, "load_fail", LIZ);
    }

    public FormAdCardActionV2(Context context, Aweme aweme, LJ0 lj0) {
        super(context, aweme, lj0);
        this.LJFF = true;
    }
}
