package com.bytedance.sdk.openadsdk.core.vt;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.bytedance.sdk.component.ef.wsy;
import com.bytedance.sdk.component.utils.nt;
import com.bytedance.sdk.openadsdk.core.hxv;
import java.util.concurrent.atomic.AtomicBoolean;

/* JADX INFO: loaded from: classes2.dex */
public class hi extends mq {

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    protected final AtomicBoolean f7304ef;
    private Activity gqi;
    private final nt.fm wey;
    protected com.bytedance.sdk.openadsdk.core.vt.fm.ro wu;

    public hi(Context context, com.bytedance.sdk.component.adexpress.ro.dsz dszVar, com.bytedance.sdk.openadsdk.yz.yz.jnr jnrVar, com.bytedance.sdk.openadsdk.core.model.lse lseVar) {
        super(context, dszVar, jnrVar, lseVar);
        this.f7304ef = new AtomicBoolean(false);
        this.wey = new nt.fm() { // from class: com.bytedance.sdk.openadsdk.core.vt.hi.1
            @Override // com.bytedance.sdk.component.utils.nt.fm
            public void fm(Context context2, Intent intent, boolean z10, int i10) {
                hxv hxvVar = ((mq) hi.this).fhx;
                if (hxvVar != null) {
                    hxvVar.yz(i10);
                }
            }
        };
        gqi();
    }

    @Override // com.bytedance.sdk.component.adexpress.jnr.fm
    public void ajl() {
        if (!com.bytedance.sdk.openadsdk.component.reward.lb.wu.ro() || this.jnr == null) {
            return;
        }
        com.bytedance.sdk.component.utils.wey.fm("TTAD.WebViewRender", "refreshWebView: refresh webview by console log ");
        this.jnr.a_("javascript:console.log('init engine');");
    }

    @Override // com.bytedance.sdk.openadsdk.core.vt.mq, com.bytedance.sdk.component.adexpress.jnr.fm
    public void ef() {
        super.ef();
        com.bytedance.sdk.openadsdk.core.vt.fm.ro roVar = this.wu;
        if (roVar != null) {
            roVar.ajl();
        }
    }

    @Override // com.bytedance.sdk.openadsdk.core.vt.mq
    public void fhx() {
        super.fhx();
    }

    @Override // com.bytedance.sdk.component.adexpress.jnr.fm
    public wsy.lb fm() {
        return wsy.lb.ADS_V4;
    }

    @Override // com.bytedance.sdk.openadsdk.core.vt.mq
    public void gof() {
        super.gof();
        com.bytedance.sdk.openadsdk.core.vt.fm.ro roVar = this.wu;
        if (roVar != null) {
            roVar.jnr();
        }
    }

    public void gqi() {
        if (this.f7304ef.get()) {
            return;
        }
        this.f7304ef.set(true);
        com.bytedance.sdk.component.utils.nt.fm(this.wey, ((mq) this).vt);
    }

    @Override // com.bytedance.sdk.openadsdk.core.vt.mq
    public void irt() {
        if (com.bytedance.sdk.openadsdk.core.model.wey.jnr(((mq) this).duv) || com.bytedance.sdk.component.adexpress.fm.ro.ro.ro(((mq) this).dsz) || this.ro == null) {
            super.irt();
            return;
        }
        com.bytedance.sdk.component.adexpress.ro.wsy wsyVar = this.ro;
        StringBuilder sb = new StringBuilder("data null is ");
        sb.append(((mq) this).dsz == null);
        wsyVar.fm(103, sb.toString());
    }

    @Override // com.bytedance.sdk.openadsdk.core.vt.mq
    public void qhl() {
        hxv hxvVar;
        com.bytedance.sdk.component.ef.wsy wsyVar = this.jnr;
        if (wsyVar == null || wsyVar.getWebView() == null || (hxvVar = ((mq) this).fhx) == null) {
            return;
        }
        com.bytedance.sdk.openadsdk.core.vt.fm.ro roVar = new com.bytedance.sdk.openadsdk.core.vt.fm.ro(hxvVar, this.jnr, ((mq) this).duv);
        this.wu = roVar;
        roVar.yz();
        this.wu.ro();
        this.wu.fm(this).fm(this.gqi).fm(((mq) this).onz).fm(this.qhl).fm(((mq) this).ku).fm(((mq) this).dsz).fm(this.irt).fm();
    }

    public void ro(Activity activity) {
        this.gqi = activity;
    }

    @Override // com.bytedance.sdk.openadsdk.core.vt.mq
    public void sds() {
        if (com.bytedance.sdk.openadsdk.component.reward.lb.wu.lb()) {
            com.bytedance.sdk.component.adexpress.jnr.jnr.fm().ro(this.jnr, ((mq) this).fhx);
        } else {
            super.sds();
        }
    }

    public void wey() {
        if (this.f7304ef.get()) {
            this.f7304ef.set(false);
            try {
                com.bytedance.sdk.component.utils.nt.fm(this.wey);
            } catch (Exception unused) {
            }
        }
    }

    @Override // com.bytedance.sdk.openadsdk.core.vt.mq, com.bytedance.sdk.component.adexpress.jnr.fm
    public void wu() {
        super.wu();
        this.wu.lb();
        wey();
    }

    @Override // com.bytedance.sdk.component.adexpress.jnr.fm
    public com.bytedance.sdk.component.ef.wsy fm(Context context, String str) {
        return com.bytedance.sdk.component.adexpress.jnr.jnr.fm().fm(context, str);
    }

    @Override // com.bytedance.sdk.component.adexpress.jnr.fm
    public void ro() {
        if (com.bytedance.sdk.openadsdk.component.reward.lb.wu.lb()) {
            com.bytedance.sdk.component.adexpress.jnr.jnr.fm().ro(this.jnr);
        } else {
            com.bytedance.sdk.component.adexpress.jnr.jnr.fm().fm(this.jnr);
        }
    }

    @Override // com.bytedance.sdk.openadsdk.core.vt.mq, com.bytedance.sdk.component.adexpress.jnr.fm, com.bytedance.sdk.component.adexpress.ro.ku
    public void fm(com.bytedance.sdk.component.adexpress.ro.onz onzVar) {
        super.fm(onzVar);
    }

    @Override // com.bytedance.sdk.component.adexpress.jnr.fm
    public boolean ro(com.bytedance.sdk.component.adexpress.ro.onz onzVar) {
        return onzVar.ro() && TextUtils.equals(onzVar.fhx(), "v4");
    }
}
