package com.ss.android.ugc.aweme.shortvideo.eventtrack;

import X.0Bt;
import X.2nK;
import X.3aU;
import X.C0496Fic;
import X.C0503Fij;
import X.NtX;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.common.LogPbBean;
import com.ss.android.ugc.aweme.shortvideo.model.RecommendWordMob;
import com.ss.android.ugc.aweme.video.hashtag.helper.BaseTitleHelper;
import java.util.List;
import kotlin.h.b.n;

public final class HashTagMobHelper extends 0Bt {
    public static final C0496Fic LJI = new C0496Fic((byte) 0);
    public String LIZ;
    public LogPbBean LIZIZ;
    public RecommendWordMob LIZJ;
    public String LIZLLL;
    public BaseTitleHelper LJ;
    public List<? extends C0503Fij> LJFF;
    public boolean LJII;
    public String LJIIIIZZ;

    static {
        Covode.recordClassIndex(110696);
    }

    public final void LIZ() {
        if (this.LIZLLL != null) {
            List<? extends C0503Fij> list = this.LJFF;
            if (list != null && !list.isEmpty()) {
                for (int i = 0; i < list.size(); i++) {
                    C0503Fij fij = (C0503Fij) list.get(i);
                    if (n.LIZ(this.LIZLLL, fij.LIZ.challengeName)) {
                        LIZ("input_sharp", fij, Integer.valueOf(i), "input");
                        return;
                    }
                }
            }
        }
    }

    public final void LIZ(String str) {
        String str2;
        if (n.LIZ(str, "click_tag_button")) {
            this.LJII = true;
        } else if (this.LJII) {
            this.LJII = false;
            return;
        }
        this.LJIIIIZZ = str;
        3aU r2 = new 3aU();
        BaseTitleHelper baseTitleHelper = this.LJ;
        if (baseTitleHelper != null) {
            str2 = baseTitleHelper.LIZJ;
        } else {
            str2 = null;
        }
        r2.LIZ("title", str2);
        r2.LIZ("creation_id", this.LIZ);
        r2.LIZ("enter_method", str);
        2nK.LIZ("show_tag", r2.LIZ());
    }

    public final void LIZ(C0503Fij fij, Integer num) {
        String str;
        if (fij != null && num != null) {
            num.intValue();
            3aU r2 = new 3aU();
            r2.LIZ("enter_method", this.LJIIIIZZ);
            r2.LIZ("tag_id", fij.LIZ.getCid());
            r2.LIZ("tag_source", fij.LJFF);
            r2.LIZ("tag_content", fij.LIZ.challengeName);
            r2.LIZ("rank", String.valueOf(num.intValue()));
            r2.LIZ("creation_id", this.LIZ);
            BaseTitleHelper baseTitleHelper = this.LJ;
            if (baseTitleHelper != null) {
                str = baseTitleHelper.LIZJ;
            } else {
                str = null;
            }
            r2.LIZ("title", str);
            2nK.LIZ("show_tag_words", r2.LIZ());
        }
    }

    public final void LIZIZ(C0503Fij fij, Integer num) {
        String str;
        if (fij != null && num != null) {
            num.intValue();
            String str2 = fij.LIZ.cid;
            3aU r3 = new 3aU();
            r3.LIZ("words_content", fij.LIZ.challengeName);
            r3.LIZ("words_position", String.valueOf(num.intValue()));
            r3.LIZ("words_source", "sug");
            r3.LIZ("search_position", "challenge_create");
            r3.LIZ("raw_query", this.LIZLLL);
            r3.LIZ("rank", "-1");
            RecommendWordMob recommendWordMob = this.LIZJ;
            String str3 = null;
            if (recommendWordMob != null) {
                str = recommendWordMob.getQueryId();
            } else {
                str = null;
            }
            r3.LIZ("query_id", str);
            r3.LIZ("group_id", str2);
            if (this.LIZIZ != null && !fij.LJI) {
                LogPbBean logPbBean = this.LIZIZ;
                if (logPbBean != null) {
                    str3 = logPbBean.getImprId();
                }
            } else {
                str3 = "";
            }
            r3.LIZ("impr_id", str3);
            2nK.LIZ("trending_words_show", r3.LIZ());
        }
    }

    public final void LIZ(String str, C0503Fij fij, Integer num, String str2) {
        String str3;
        if (fij != null && num != null) {
            num.intValue();
            String cid = fij.LIZ.getCid();
            3aU r2 = new 3aU();
            r2.LIZ("enter_method", str);
            String str4 = "";
            if (cid == null) {
                cid = str4;
            }
            r2.LIZ("tag_id", cid);
            if (str2 == null) {
                str2 = fij.LJFF;
            }
            r2.LIZ("tag_source", str2);
            r2.LIZ("tag_content", fij.LIZ.challengeName);
            r2.LIZ("rank", String.valueOf(num.intValue()));
            r2.LIZ("creation_id", this.LIZ);
            BaseTitleHelper baseTitleHelper = this.LJ;
            if (baseTitleHelper != null) {
                str3 = baseTitleHelper.LIZJ;
            } else {
                str3 = null;
            }
            r2.LIZ("title", str3);
            if (this.LIZIZ != null) {
                str4 = NtX.LIZIZ.LIZIZ(this.LIZIZ);
            }
            r2.LIZ("log_pb", str4);
            2nK.LIZ("add_tag", r2.LIZ());
        }
    }
}
