package com.ss.android.ugc.aweme.discover.ui;

import X.05p;
import X.05s;
import X.070;
import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.0CH;
import X.0EB;
import X.0EF;
import X.0Gp;
import X.0HH;
import X.1hK;
import X.2GD;
import X.2GO;
import X.2HZ;
import X.2Pr;
import X.2ce;
import X.2nK;
import X.2om;
import X.3BB;
import X.3eh;
import X.4HR;
import X.4PU;
import X.4hP;
import X.4q6;
import X.7vm;
import X.878;
import X.8ER;
import X.8QU;
import X.8gI;
import X.A7H;
import X.ARA;
import X.ARD;
import X.ARE;
import X.ARc;
import X.ARe;
import X.AVG;
import X.AVu;
import X.AXR;
import X.AXS;
import X.AXT;
import X.AgT;
import X.AgW;
import X.Agy;
import X.Ah9;
import X.Ahh;
import X.AoK;
import X.AqZ;
import X.B0a;
import X.B7g;
import X.B9I;
import X.BbC;
import X.C0043R1r;
import X.C1069Rc9;
import X.C2553S0f;
import X.C3083SKp;
import X.C3292SSq;
import X.C3302STa;
import X.C3320STs;
import X.C3321STt;
import X.C3345SUr;
import X.C3408SXc;
import X.C3409SXd;
import X.C3411SXf;
import X.C3435SYd;
import X.C3439SYh;
import X.C3441SYj;
import X.C3453SYv;
import X.C3589Sbh;
import X.C3670Sd0;
import X.C3671Sd1;
import X.C3674Sd4;
import X.C3753SeL;
import X.C3865Sg9;
import X.Cb6;
import X.CqM;
import X.Crj;
import X.Csa;
import X.Css;
import X.Csw;
import X.Csy;
import X.Cuh;
import X.Cus;
import X.Cv8;
import X.Cvh;
import X.CwK;
import X.CwU;
import X.CwZ;
import X.Cwc;
import X.Cwf;
import X.Cwu;
import X.D1G;
import X.DzH;
import X.EmU;
import X.Etp;
import X.FjH;
import X.HeD;
import X.ISm;
import X.KDg;
import X.KEM;
import X.LWw;
import X.LaL;
import X.Ldo;
import X.LeC;
import X.Lea;
import X.LsC;
import X.LsD;
import X.LsE;
import X.LsF;
import X.Lsh;
import X.Lut;
import X.M12;
import X.OQR;
import X.OQS;
import X.OQZ;
import X.OQd;
import X.OQf;
import X.Odu;
import X.OeP;
import X.OfH;
import X.OtQ;
import X.OtU;
import X.P1F;
import X.PHD;
import X.Qqr;
import X.Qqu;
import X.Qqx;
import X.Qsl;
import X.SG1;
import X.SG2;
import X.SG7;
import X.SG8;
import X.STZ;
import X.SUD;
import X.SUM;
import X.SV0;
import X.SV5;
import X.SV6;
import X.SW6;
import X.SX0;
import X.SX6;
import X.SXB;
import X.SXD;
import X.SXK;
import X.SXY;
import X.SY7;
import X.SYI;
import X.SYO;
import X.SYW;
import X.SZN;
import X.SZV;
import X.T9P;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bytedance.assem.arch.viewModel.AssemViewModel;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.widgets.NextLiveData;
import com.google.android.material.appbar.AppBarLayout;
import com.ss.android.common.applog.GlobalContext;
import com.ss.android.ugc.aweme.discover.helper.MusicPlayHelper;
import com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig;
import com.ss.android.ugc.aweme.discover.model.GuideSearchWord;
import com.ss.android.ugc.aweme.discover.model.MaskedSearchMobData;
import com.ss.android.ugc.aweme.discover.model.QueryCorrectInfo;
import com.ss.android.ugc.aweme.discover.model.SearchApiResult;
import com.ss.android.ugc.aweme.discover.model.SearchChallengeList;
import com.ss.android.ugc.aweme.discover.model.SearchIntermediateViewModel;
import com.ss.android.ugc.aweme.discover.model.SearchMix;
import com.ss.android.ugc.aweme.discover.model.SearchMusicList;
import com.ss.android.ugc.aweme.discover.model.SearchStateViewModel;
import com.ss.android.ugc.aweme.discover.model.SearchSurveyConfig;
import com.ss.android.ugc.aweme.discover.model.SearchUserList;
import com.ss.android.ugc.aweme.discover.viewmodel.SearchEnterViewModel;
import com.ss.android.ugc.aweme.discover.viewmodel.SearchResultViewModel;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import com.ss.android.ugc.aweme.profile.model.FollowStatus;
import com.ss.android.ugc.aweme.profile.model.FollowStatusEvent;
import com.ss.android.ugc.aweme.search.activity.SearchGlobalViewModel;
import com.ss.android.ugc.aweme.search.model.SearchResultParamProvider;
import com.ss.android.ugc.aweme.search.research.ResearchFilterVM;
import com.ss.android.ugc.aweme.search.survey.SurveyViewModel;
import com.ss.android.ugc.aweme.views.WrapLinearLayoutManager;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONObject;

public abstract class SearchFragment<D> extends SearchBaseFragment implements ARE, 4PU, BbC<D>, Qqu, SUD, 2HZ, 2GO {
    public Lut LIZ;
    public SearchGlobalViewModel LIZIZ;
    public SearchStateViewModel LIZJ;
    public boolean LIZLLL;
    public ViewGroup LJ;
    public Qqr LJIIIZ;
    public Qqx LJIIJ;
    public RecyclerView LJIIJJI;
    public OQZ LJIIL;
    public T9P LJIILIIL;
    public OtQ LJIILJJIL;
    public List<? extends D> LJIILL = new ArrayList();
    public boolean LJIIZILJ;
    public GlobalDoodleConfig LJIJ;
    public boolean LJIJI;
    public SearchIntermediateViewModel LJIJJ;
    public Qsl LJIJJLI;
    public AgW LJJJIL;
    public SV0 LJJJJ;
    public B9I<D> LJJJJI;
    public OfH LJJJJIZL;
    public boolean LJJJJJ = true;
    public SearchStateViewModel LJJJJJL;
    public boolean LJJJJL = true;
    public long LJJJJLI;
    public boolean LJJJJLL;
    public C3753SeL LJJJJZ;
    public QueryCorrectInfo LJJJJZI;
    public boolean LJJJLIIL;
    public long LJJJLL;
    public MusicPlayHelper LJJJLZIJ;
    public SearchEnterViewModel LJJJZ;
    public SurveyViewModel LJJL;
    public final Csa LJJLI;
    public boolean LJJLIIIIJ;
    public final Crj LJJLIIIJ;
    public final Crj LJJLIIIJILLIZJL;
    public boolean LJJLIIIJJI;
    public SparseArray LJJLIIIJJIZ;

    static {
        Covode.recordClassIndex(65507);
    }

    private final B0a LJIIL() {
        return (B0a) this.LJJLIIIJ.getValue();
    }

    public void LIZ(FollowStatus followStatus) {
        M12.LIZ(followStatus);
    }

    public void LIZJ() {
        SparseArray sparseArray = this.LJJLIIIJJIZ;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public void LIZJ(List<? extends D> list, boolean z) {
        M12.LIZ(list);
    }

    public abstract void LJIIIIZZ();

    public abstract void LJIIJJI();

    public boolean LJIJJLI() {
        return true;
    }

    public String LJIL() {
        return null;
    }

    public final ResearchFilterVM LJJIJLIJ() {
        return (ResearchFilterVM) this.LJJLI.getValue();
    }

    public int LJJIL() {
        return 2131561106;
    }

    public final SG1 LJJJ() {
        return (SG1) this.LJJLIIIJILLIZJL.getValue();
    }

    public abstract void bO_();

    public abstract void c_(boolean z);

    public Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(387, new C1069Rc9(SearchFragment.class, "onFeedbackSubmitSuccess", LaL.class, ThreadMode.POSTING, 0, false));
        hashMap.put(388, new C1069Rc9(SearchFragment.class, "onShowResultsEvent", P1F.class, ThreadMode.MAIN, 0, false));
        hashMap.put(389, new C1069Rc9(SearchFragment.class, "onWebViewActivityCloseEvent", KDg.class, ThreadMode.POSTING, 0, false));
        hashMap.put(390, new C1069Rc9(SearchFragment.class, "onSearchAfterLogin", SG7.class, ThreadMode.POSTING, 0, false));
        hashMap.put(55, new C1069Rc9(SearchFragment.class, "onReceiveVideoEvent", Etp.class, ThreadMode.POSTING, 0, false));
        hashMap.put(54, new C1069Rc9(SearchFragment.class, "onFollowStatusUpdate", FollowStatusEvent.class, ThreadMode.POSTING, 0, false));
        return hashMap;
    }

    @ISm
    public final void onWebViewActivityCloseEvent(KDg kDg) {
        M12.LIZ(kDg);
    }

    public final void LIZIZ() {
        LJIILJJIL();
    }

    public final SV0 bx_() {
        return this.LJJI;
    }

    public final void cn_() {
        LJIILJJIL();
    }

    public void LIZ(View view) {
        OtU otU;
        M12.LIZ(view);
        int i = this.LJJIJ;
        if (i == C3320STs.LIZIZ.LIZIZ()) {
            otU = OtU.USER;
        } else if (i == C3320STs.LIZIZ.LIZJ()) {
            otU = OtU.VIDEO;
        } else if (i == C3320STs.LIZIZ.LIZLLL()) {
            otU = OtU.SOUND;
        } else if (i == C3320STs.LIZIZ.LJFF()) {
            otU = OtU.HASHTAG;
        } else if (i == C3320STs.LIZ()) {
            SearchGlobalViewModel searchGlobalViewModel = this.LIZIZ;
            if (searchGlobalViewModel == null || !searchGlobalViewModel.LIZ()) {
                otU = OtU.VIDEO;
            } else {
                otU = OtU.CENTER_LOADING;
            }
        } else {
            otU = OtU.CENTER_LOADING;
        }
        this.LJIILJJIL = new OtQ(view, otU);
        RecyclerView findViewById = view.findViewById(2131367138);
        n.LIZIZ(findViewById, "");
        this.LJIIJJI = findViewById;
        OQZ findViewById2 = view.findViewById(2131370625);
        n.LIZIZ(findViewById2, "");
        OQZ oqz = findViewById2;
        this.LJIIL = oqz;
        if (oqz == null) {
            n.LIZ("");
        }
        oqz.setOnClickListener(new SYO(this));
        View findViewById3 = view.findViewById(2131369416);
        n.LIZIZ(findViewById3, "");
        T9P t9p = (T9P) findViewById3;
        this.LJIILIIL = t9p;
        if (t9p == null) {
            n.LIZ("");
        }
        t9p.setEnabled(false);
        this.LJIJJLI = view.findViewById(2131369883);
        this.LJ = (ViewGroup) view.findViewById(2131364925);
        Context context = getContext();
        if (context == null) {
            n.LIZIZ();
        }
        n.LIZIZ(context, "");
        AgW agW = new AgW(context, (byte) 0);
        RecyclerView recyclerView = this.LJIIJJI;
        if (recyclerView == null) {
            n.LIZ("");
        }
        M12.LIZ(recyclerView);
        recyclerView.LIZ(agW.LJ);
        this.LJJJIL = agW;
        ViewGroup viewGroup = this.LJ;
        if (viewGroup != null) {
            viewGroup.addView(agW);
        }
        ViewGroup viewGroup2 = (ViewGroup) view.findViewById(2131365471);
        if (viewGroup2 != null) {
            Context context2 = getContext();
            if (context2 == null) {
                n.LIZIZ();
            }
            n.LIZIZ(context2, "");
            Qqr qqr = new Qqr(context2, (byte) 0);
            viewGroup2.addView(qqr);
            qqr.setItemClickListener(this);
            this.LJIIIZ = qqr;
        }
    }

    public void LIZ(View view, Bundle bundle) {
        M12.LIZ(view);
        LJJJI();
        RecyclerView recyclerView = this.LJIIJJI;
        if (recyclerView == null) {
            n.LIZ("");
        }
        recyclerView.setLayoutManager(LJJIZ());
        LJIIJJI();
        LIZ(new OfH(LJJIJIIJIL()));
        B9I LJJIJIIJIL = LJJIJIIJIL();
        RecyclerView recyclerView2 = this.LJIIJJI;
        if (recyclerView2 == null) {
            n.LIZ("");
        }
        LJJIJIIJIL.setLoaddingTextColor(070.LIZJ(recyclerView2.getContext(), 2131099758));
        LJJIJIIJIL().setLoadMoreListener(this);
        RecyclerView recyclerView3 = this.LJIIJJI;
        if (recyclerView3 == null) {
            n.LIZ("");
        }
        recyclerView3.setAdapter(LJJIJIL());
        RecyclerView recyclerView4 = this.LJIIJJI;
        if (recyclerView4 == null) {
            n.LIZ("");
        }
        recyclerView4.setOverScrollMode(2);
        RecyclerView recyclerView5 = this.LJIIJJI;
        if (recyclerView5 == null) {
            n.LIZ("");
        }
        0EB itemAnimator = recyclerView5.getItemAnimator();
        if (itemAnimator == null) {
            n.LIZIZ();
        }
        n.LIZIZ(itemAnimator, "");
        itemAnimator.LJIIJJI = 0;
        RecyclerView recyclerView6 = this.LJIIJJI;
        if (recyclerView6 == null) {
            n.LIZ("");
        }
        recyclerView6.LIZ(new C3083SKp(this));
        RecyclerView recyclerView7 = this.LJIIJJI;
        if (recyclerView7 == null) {
            n.LIZ("");
        }
        recyclerView7.setClipToPadding(false);
        LJ(false);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:80:0x0109, code lost:
        if (r13 != null) goto L_0x0093;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:82:0x010d, code lost:
        if (r13 != null) goto L_0x009b;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(com.ss.android.ugc.aweme.discover.model.SearchApiResult r13) {
        /*
            r12 = this;
            X.8gI r1 = X.8gI.LIZIZ
            X.1hK r0 = r12.getActivity()
            r2 = 0
            if (r0 == 0) goto L_0x0112
            int r0 = r0.hashCode()
        L_0x000d:
            X.SYh r5 = r1.LIZ(r0)
            if (r5 != 0) goto L_0x0027
            X.R1r r5 = new X.R1r
            r5.<init>()
            X.8gI r1 = X.8gI.LIZIZ
            X.1hK r0 = r12.getActivity()
            if (r0 == 0) goto L_0x0024
            int r2 = r0.hashCode()
        L_0x0024:
            r1.LIZ(r2, r5)
        L_0x0027:
            int r2 = r12.LJJIJ
            X.SYW r1 = new X.SYW
            r1.<init>()
            java.lang.String r4 = ""
            if (r13 == 0) goto L_0x003c
            com.ss.android.ugc.aweme.feed.model.LogPbBean r0 = r13.logPb
            if (r0 == 0) goto L_0x003c
            java.lang.String r0 = r0.getImprId()
            if (r0 != 0) goto L_0x003d
        L_0x003c:
            r0 = r4
        L_0x003d:
            r1.LIZ(r0)
            java.lang.String r0 = r12.LJJII()
            if (r0 != 0) goto L_0x0047
            r0 = r4
        L_0x0047:
            r1.LIZIZ(r0)
            java.lang.String r3 = "normal"
            if (r13 == 0) goto L_0x0058
            com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig r0 = r13.globalDoodleConfig
            if (r0 == 0) goto L_0x0058
            java.lang.String r0 = r0.getTnsBanType()
            if (r0 != 0) goto L_0x0059
        L_0x0058:
            r0 = r3
        L_0x0059:
            r1.LIZJ(r0)
            if (r13 == 0) goto L_0x0068
            com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig r0 = r13.globalDoodleConfig
            if (r0 == 0) goto L_0x0068
            java.lang.String r0 = r0.getUseScenario()
            if (r0 != 0) goto L_0x0069
        L_0x0068:
            r0 = r3
        L_0x0069:
            r1.LIZLLL(r0)
            r5.LIZ(r2, r1)
            X.SSA r0 = X.SS8.LIZIZ
            X.SS8 r5 = r0.LIZ()
            X.LbH r6 = new X.LbH
            java.lang.String r7 = r12.LJJII()
            if (r13 == 0) goto L_0x0087
            com.ss.android.ugc.aweme.feed.model.LogPbBean r0 = r13.logPb
            if (r0 == 0) goto L_0x0087
            java.lang.String r8 = r0.getImprId()
            if (r8 != 0) goto L_0x0088
        L_0x0087:
            r8 = r4
        L_0x0088:
            r2 = 0
            if (r13 == 0) goto L_0x0108
            com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig r0 = r13.globalDoodleConfig
            if (r0 == 0) goto L_0x0108
            java.lang.String r9 = r0.getSearchChannel()
        L_0x0093:
            com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig r0 = r13.globalDoodleConfig
            if (r0 == 0) goto L_0x010c
            java.lang.String r10 = r0.getNewSource()
        L_0x009b:
            com.ss.android.ugc.aweme.base.api.BaseResponse$ServerTimeExtra r0 = r13.extra
            if (r0 == 0) goto L_0x0110
            long r0 = r0.now
            java.lang.Long r11 = java.lang.Long.valueOf(r0)
        L_0x00a5:
            r6.<init>(r7, r8, r9, r10, r11)
            r5.LIZ(r6)
            X.SXK r5 = r12.LJIL
            if (r13 == 0) goto L_0x00b9
            com.ss.android.ugc.aweme.feed.model.LogPbBean r0 = r13.logPb
            if (r0 == 0) goto L_0x00b9
            java.lang.String r0 = r0.getImprId()
            if (r0 != 0) goto L_0x0106
        L_0x00b9:
            r5.setSearchId(r4)
            java.lang.String r0 = r12.LJJII()
            r5.setSearchKeyword(r0)
            java.util.Map r4 = r5.getSearchTrackMap()
            if (r13 == 0) goto L_0x00d3
            com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig r0 = r13.globalDoodleConfig
            if (r0 == 0) goto L_0x00d3
            java.lang.String r1 = r0.getTnsBanType()
            if (r1 != 0) goto L_0x00d4
        L_0x00d3:
            r1 = r3
        L_0x00d4:
            java.lang.String r0 = "tns_ban_type"
            r4.put(r0, r1)
            java.util.Map r1 = r5.getSearchTrackMap()
            if (r13 == 0) goto L_0x00e9
            com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig r0 = r13.globalDoodleConfig
            if (r0 == 0) goto L_0x00e9
            java.lang.String r0 = r0.getUseScenario()
            if (r0 != 0) goto L_0x0104
        L_0x00e9:
            java.lang.String r0 = "use_scenario"
            r1.put(r0, r3)
            if (r13 == 0) goto L_0x00f8
            com.ss.android.ugc.aweme.discover.model.GlobalDoodleConfig r0 = r13.globalDoodleConfig
            if (r0 == 0) goto L_0x00f8
            java.util.List r2 = r0.getFeedbackSurvey()
        L_0x00f8:
            r5.setFeedbackSurvey(r2)
            X.SXK r0 = r12.LJIL
            java.lang.String r0 = r0.getSearchId()
            X.C3610Sc2.LIZIZ = r0
            return
        L_0x0104:
            r3 = r0
            goto L_0x00e9
        L_0x0106:
            r4 = r0
            goto L_0x00b9
        L_0x0108:
            r9 = r2
            if (r13 == 0) goto L_0x010c
            goto L_0x0093
        L_0x010c:
            r10 = r2
            if (r13 == 0) goto L_0x0110
            goto L_0x009b
        L_0x0110:
            r11 = r2
            goto L_0x00a5
        L_0x0112:
            r0 = 0
            goto L_0x000d
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.SearchFragment.LIZ(com.ss.android.ugc.aweme.discover.model.SearchApiResult):void");
    }

    public final void LIZ(String str, String str2, boolean z) {
        M12.LIZ(str, str2);
        if (this.LJJ != null) {
            SV0 sv0 = new SV0();
            sv0.setKeyword(str2);
            sv0.setNeedCorrect(this.LJJIJIIJI);
            if (z) {
                str = null;
            }
            sv0.setGuideSearchBaseWord(str);
            sv0.setSearchFrom(z ? "guide_search_cancel" : "guide_search");
            sv0.setFilterOption(this.LJJIJIIJIL);
            n.LIZIZ(sv0, "");
            sv0.setIndex(this.LJJIJ);
            CqM.LIZ(new C3292SSq(sv0));
            LJIILIIL();
        }
    }

    public final void LIZ(List<GuideSearchWord> list) {
        String str;
        SYW LIZIZ2;
        if (aq_()) {
            SV0 sv0 = this.LJJ;
            if (sv0 == null || !sv0.isGuideSearch()) {
                C3439SYh LIZ2 = 8gI.LIZIZ.LIZ();
                if (LIZ2 == null || (LIZIZ2 = LIZ2.LIZIZ(this.LJJIJ)) == null || (str = LIZIZ2.LIZ) == null) {
                    str = "";
                }
                if (878.LIZ(list)) {
                    Qsl qsl = this.LJIJJLI;
                    if (qsl != null) {
                        qsl.setVisibility(8);
                    }
                    Qqr qqr = this.LJIIIZ;
                    if (qqr != null) {
                        qqr.setVisibility(8);
                    }
                    Qqx qqx = this.LJIIJ;
                    if (qqx != null) {
                        qqx.LIZ(list, LJJII(), C3320STs.LIZ(this.LJJIFFI), str);
                    }
                    this.LIZLLL = false;
                    return;
                }
                if (this.LJIIJ == null && this.LJIIIZ != null) {
                    Qqr qqr2 = this.LJIIIZ;
                    if (qqr2 == null) {
                        n.LIZIZ();
                    }
                    this.LJIIJ = new Qqx(qqr2);
                }
                Qsl qsl2 = this.LJIJJLI;
                if (qsl2 != null) {
                    qsl2.setVisibility(0);
                }
                Qqx qqx2 = this.LJIIJ;
                if (qqx2 != null) {
                    qqx2.LIZ(list, LJJII(), C3320STs.LIZ(this.LJJIFFI), str);
                }
                this.LIZLLL = true;
            }
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:41:0x0094, code lost:
        if (kotlin.h.b.n.LIZ(r0 != null ? r0.getSearchFrom() : null, "guide_search_cancel") != false) goto L_0x0096;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:82:0x013b, code lost:
        if (r8 == null) goto L_0x005a;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void LIZ(boolean r11, boolean r12) {
        /*
            r10 = this;
            boolean r0 = r10.aq_()
            if (r0 == 0) goto L_0x0155
            boolean r0 = r10.getUserVisibleHint()
            if (r0 == 0) goto L_0x0155
            boolean r0 = r10.LJJJJL
            if (r0 == 0) goto L_0x0155
            java.lang.String r0 = r10.LJJII()
            boolean r0 = android.text.TextUtils.isEmpty(r0)
            if (r0 == 0) goto L_0x001e
            r10.LJJJJ()
            return
        L_0x001e:
            boolean r0 = r10.LJJJJJ
            if (r0 == 0) goto L_0x0144
            X.SUa r2 = X.C3328SUa.LIZJ
            int r1 = r10.LJJIJ
            X.SV0 r0 = r10.LJJ
            r2.LIZIZ(r1, r0)
            X.SUb r7 = X.C3329SUb.LIZJ
            int r6 = r10.LJJIJ
            X.SV0 r5 = r10.LJJ
            r4 = 0
            r3 = 0
            if (r5 == 0) goto L_0x0066
            java.util.Map<java.lang.Integer, X.SUX> r1 = X.C3329SUb.LIZ
            int r0 = r5.getId()
            java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
            java.lang.Object r0 = r1.get(r0)
            X.SUX r0 = (X.SUX) r0
            if (r0 != 0) goto L_0x013f
            X.SUX r0 = X.C3329SUb.LIZIZ
            if (r0 == 0) goto L_0x005a
            X.SUX r0 = X.C3329SUb.LIZIZ
            if (r0 != 0) goto L_0x0052
            kotlin.h.b.n.LIZIZ()
        L_0x0052:
            long r0 = r0.LIZLLL
            r8 = 0
            int r2 = (r0 > r8 ? 1 : (r0 == r8 ? 0 : -1))
            if (r2 <= 0) goto L_0x00db
        L_0x005a:
            r0 = 6
            X.SUX r0 = r7.LIZ(r0, r5)
            if (r0 == 0) goto L_0x0064
            r0.LIZ((int) r6)
        L_0x0064:
            X.C3329SUb.LIZIZ = r3
        L_0x0066:
            boolean r0 = X.C3411SXf.LIZLLL
            if (r0 == 0) goto L_0x00bd
            java.lang.String r1 = "click_more_general_list"
            r10.LIZLLL(r1)
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x0076
            r0.setEnterMethod(r1)
        L_0x0076:
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x00bb
            java.lang.String r1 = r0.getSearchFrom()
        L_0x007e:
            java.lang.String r0 = "guide_search"
            boolean r0 = kotlin.h.b.n.LIZ(r1, r0)
            if (r0 != 0) goto L_0x0096
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x00b9
            java.lang.String r1 = r0.getSearchFrom()
        L_0x008e:
            java.lang.String r0 = "guide_search_cancel"
            boolean r0 = kotlin.h.b.n.LIZ(r1, r0)
            if (r0 == 0) goto L_0x009e
        L_0x0096:
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x009e
            X.AVG r3 = r0.getFilterOption()
        L_0x009e:
            r10.LIZ((int) r11, (X.AVG) r3)
            r10.LJJJJJ = r4
            boolean r0 = X.C3411SXf.LIZJ
            if (r0 == 0) goto L_0x00a9
            X.C3411SXf.LIZJ = r4
        L_0x00a9:
            int r1 = r10.LJJIFFI
            int r0 = X.C3320STs.LIZ()
            if (r1 == r0) goto L_0x0155
            X.SUr r1 = X.C3345SUr.LIZJ
            int r0 = r10.LJJIFFI
            r1.LIZ(r0)
            return
        L_0x00b9:
            r1 = r3
            goto L_0x008e
        L_0x00bb:
            r1 = r3
            goto L_0x007e
        L_0x00bd:
            X.SXF r1 = X.SXD.Companion
            r0 = r10
            X.SYI r0 = r1.LIZLLL(r0)
            if (r0 == 0) goto L_0x00ce
            int r1 = r0.getSearchLastShowPageIndex()
            int r0 = r10.LJJIJ
            if (r1 == r0) goto L_0x0076
        L_0x00ce:
            java.lang.String r1 = "switch_tab"
            r10.LIZLLL(r1)
            X.SV0 r0 = r10.LJJ
            if (r0 == 0) goto L_0x0076
            r0.setEnterMethod(r1)
            goto L_0x0076
        L_0x00db:
            java.lang.String r1 = r5.getKeyword()
            X.SUX r0 = X.C3329SUb.LIZIZ
            if (r0 != 0) goto L_0x00e6
            kotlin.h.b.n.LIZIZ()
        L_0x00e6:
            X.SV0 r0 = r0.LJJI
            java.lang.String r0 = r0.getKeyword()
            boolean r0 = kotlin.h.b.n.LIZ(r1, r0)
            if (r0 == 0) goto L_0x005a
            X.SUX r8 = X.C3329SUb.LIZIZ
            java.util.Map<java.lang.Integer, X.SUX> r1 = X.C3329SUb.LIZ
            X.SUX r0 = X.C3329SUb.LIZIZ
            if (r0 != 0) goto L_0x00fd
            kotlin.h.b.n.LIZIZ()
        L_0x00fd:
            X.SV0 r0 = r0.LJJI
            int r0 = r0.getId()
            java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
            r1.remove(r0)
            X.SUX r0 = X.C3329SUb.LIZIZ
            if (r0 != 0) goto L_0x0111
            kotlin.h.b.n.LIZIZ()
        L_0x0111:
            r0.LIZ((int) r6)
            X.SUX r0 = X.C3329SUb.LIZIZ
            if (r0 != 0) goto L_0x011b
            kotlin.h.b.n.LIZIZ()
        L_0x011b:
            r0.LIZ((int) r6)
            java.util.Map<java.lang.Integer, X.SUX> r2 = X.C3329SUb.LIZ
            X.SUX r0 = X.C3329SUb.LIZIZ
            if (r0 != 0) goto L_0x0127
            kotlin.h.b.n.LIZIZ()
        L_0x0127:
            X.SV0 r0 = r0.LJJI
            int r0 = r0.getId()
            java.lang.Integer r1 = java.lang.Integer.valueOf(r0)
            X.SUX r0 = X.C3329SUb.LIZIZ
            if (r0 != 0) goto L_0x0138
            kotlin.h.b.n.LIZIZ()
        L_0x0138:
            r2.put(r1, r0)
            if (r8 != 0) goto L_0x0064
            goto L_0x005a
        L_0x013f:
            r0.LIZ((int) r6)
            goto L_0x0064
        L_0x0144:
            X.SXF r1 = X.SXD.Companion
            X.1hK r0 = r10.getActivity()
            X.SYI r1 = r1.LIZLLL(r0)
            if (r1 == 0) goto L_0x0155
            int r0 = r10.LJJIJ
            r1.setLastShowingPageIndex(r0)
        L_0x0155:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.SearchFragment.LIZ(boolean, boolean):void");
    }

    public void LIZ(SV0 sv0) {
        M12.LIZ(sv0);
        this.LJJJJ = sv0;
        super.LIZ(sv0);
        this.LJJJJJ = true;
        if (!aq_()) {
            Bundle arguments = getArguments();
            if (arguments != null) {
                arguments.putSerializable(SearchBaseFragment.LJJIL, sv0);
                return;
            }
            return;
        }
        LIZIZ(sv0);
        Ldo ldo = SearchResultParamProvider.LIZIZ;
        Context context = getContext();
        if (context == null) {
            n.LIZIZ();
        }
        n.LIZIZ(context, "");
        ldo.LIZ(context, sv0);
        LIZ(false, false);
    }

    public final void LIZ(String str, String str2, String str3, boolean z) {
        String str4;
        SYI globalData;
        M12.LIZ(str, str3);
        if (this.LJIL.isRecentRequestSearchSourceUnknown()) {
            C3453SYv sYv = new C3453SYv();
            sYv.LIZ(str2);
            sYv.LIZIZ(str3);
            SY7 LIZIZ2 = SXD.Companion.LIZIZ((0CH) this);
            if (LIZIZ2 == null || (globalData = LIZIZ2.getGlobalData()) == null || (str4 = globalData.getLaunchSchemaString()) == null) {
                str4 = "";
            }
            sYv.LJIJJ(str4);
            sYv.LJFF();
        }
        if (this.LJJIFFI != C3320STs.LIZ()) {
            C3345SUr.LIZJ.LIZIZ(this.LJJIFFI);
        }
        C3409SXd sXd = new C3409SXd();
        if (n.LIZ(str, "general_search")) {
            str = "general";
        }
        sXd.LIZ = str;
        sXd.LIZIZ = str3;
        sXd.LIZ(this.LJJII);
        sXd.LJIIJ = this.LJJIII;
        SV0 sv0 = this.LJJI;
        SV5 sv5 = null;
        sXd.LJIIJJI = sv0 != null ? sv0.getEnterMethod() : null;
        sXd.LIZLLL = str2;
        sXd.LJFF = z;
        SearchEnterViewModel searchEnterViewModel = this.LJJJZ;
        if (searchEnterViewModel != null) {
            sv5 = searchEnterViewModel.LIZ;
        }
        sXd.LJ = sv5;
        SYI LIZLLL2 = SXD.Companion.LIZLLL(getActivity());
        sXd.LJII = LIZLLL2 != null ? LIZLLL2.getLastShowingPageIndex() : -1;
        sXd.LJI = this.LJJIJ;
        sXd.LJIIIIZZ = this.LJJIIZI;
        sXd.LJIIL = C3411SXf.LIZIZ;
        sXd.LJIILL = this.LJJI;
        sXd.LJIIIZ = C3345SUr.LIZ;
        sXd.LJIILIIL = C3345SUr.LIZJ.LIZJ(this.LJJIFFI);
        sXd.LJIILJJIL = LJIL();
        new C3589Sbh("query_sign").LJFF();
        LIZ(sXd);
        C3345SUr.LIZ = false;
        C3411SXf.LIZIZ = false;
        SYI LIZLLL3 = SXD.Companion.LIZLLL(getActivity());
        if (LIZLLL3 != null) {
            LIZLLL3.setLastShowingPageIndex(this.LJJIJ);
        }
    }

    public void LIZ(List<? extends D> list, boolean z) {
        M12.LIZ(list);
        if (aq_()) {
            LJJJJI();
            LJJIJIIJIL().setShowFooter(true);
            if (!z) {
                LJJIJIIJIL().showLoadMoreEmpty();
            } else {
                LJJIJIIJIL().resetLoadMoreState();
            }
            OQZ oqz = this.LJIIL;
            if (oqz == null) {
                n.LIZ("");
            }
            oqz.LIZLLL();
            GlobalDoodleConfig globalDoodleConfig = this.LJIJ;
            if (n.LIZ(globalDoodleConfig != null ? globalDoodleConfig.getHideResults() : null, true)) {
                this.LJIILL = list;
                LJJIJIIJIL().setData(new ArrayList());
            } else {
                LIZIZ(list);
                List data = LJJIJIIJIL().getData();
                if (this.LJJLIIIIJ || data == null || data.isEmpty()) {
                    LJJIJIIJIL().setData(list);
                    this.LJJLIIIIJ = false;
                } else {
                    LJJIJIIJIL().getData().clear();
                    LJJIJIIJIL().getData().addAll(list);
                }
            }
            LJJJJJL();
            View view = getView();
            if (view == null) {
                n.LIZIZ();
            }
            view.requestLayout();
            c_(true);
        }
    }

    public final void LIZ(Exception exc) {
        M12.LIZ(exc);
        LIZLLL(exc);
    }

    public final void LIZ(QueryCorrectInfo queryCorrectInfo) {
        C3753SeL seL;
        if (aq_()) {
            this.LJJJJZI = queryCorrectInfo;
            if (queryCorrectInfo == null) {
                C3753SeL seL2 = this.LJJJJZ;
                if (seL2 != null) {
                    seL2.setVisibility(8);
                }
                LJJIJIL().LIZIZ(this.LJJJJZ);
                this.LJJJJLL = false;
            } else if (this.LJIJI) {
                LJJIJIL().LIZIZ(this.LJJJJZ);
            } else {
                if (this.LJJJJZ == null) {
                    View view = getView();
                    if (view == null) {
                        n.LIZIZ();
                    }
                    n.LIZIZ(view, "");
                    Context context = view.getContext();
                    if (context == null) {
                        n.LIZIZ();
                    }
                    this.LJJJJZ = new C3753SeL(context);
                }
                C3753SeL seL3 = this.LJJJJZ;
                if (seL3 != null) {
                    seL3.setVisibility(0);
                }
                List LIZIZ2 = LJJIJIL().LIZIZ();
                C3753SeL seL4 = this.LJJJJZ;
                if (seL4 == null) {
                    n.LIZIZ();
                }
                if (!LIZIZ2.contains(seL4)) {
                    LJJIJIL().LIZ(0, this.LJJJJZ);
                }
                C3753SeL seL5 = this.LJJJJZ;
                if (seL5 == null) {
                    n.LIZIZ();
                }
                seL5.LIZ(queryCorrectInfo, LJJII());
                if (!LJIJJLI() && (seL = this.LJJJJZ) != null) {
                    seL.setTopMargin((int) ARA.LIZ(16));
                }
                LJIILL();
                this.LJJJJLL = true;
            }
        }
    }

    public final B0a LJ() {
        return LJIIL();
    }

    public final OeP bz_() {
        return LJJIII();
    }

    public 0CH getActualLifecycleOwner() {
        ARD.LIZIZ(this);
        return this;
    }

    public Cv8 getActualLifecycleOwnerHolder() {
        ARD.LIZ(this);
        return this;
    }

    public 4hP getActualReceiver() {
        ARD.LIZLLL(this);
        return this;
    }

    public Cuh<4hP> getActualReceiverHolder() {
        ARD.LIZJ(this);
        return this;
    }

    public 0CH getHostLifecycleOwner() {
        M12.LIZ(this);
        return null;
    }

    public 0CH getOwnLifecycleOwner() {
        ARD.LJ(this);
        return this;
    }

    public 4hP getReceiverForHostVM() {
        M12.LIZ(this);
        return null;
    }

    public boolean getUniqueOnlyDefault() {
        return ARD.LJFF(this);
    }

    private final void LJIILLIIL() {
        new Handler().post(new C3408SXc(this));
    }

    public void LJFF() {
        if (aq_()) {
            LJJJJ();
            LJJJJJL();
        }
    }

    public final RecyclerView LJJIIJ() {
        RecyclerView recyclerView = this.LJIIJJI;
        if (recyclerView == null) {
            n.LIZ("");
        }
        return recyclerView;
    }

    public final OQZ LJJIIJZLJL() {
        OQZ oqz = this.LJIIL;
        if (oqz == null) {
            n.LIZ("");
        }
        return oqz;
    }

    public final T9P LJJIIZ() {
        T9P t9p = this.LJIILIIL;
        if (t9p == null) {
            n.LIZ("");
        }
        return t9p;
    }

    public final OtQ LJJIIZI() {
        OtQ otQ = this.LJIILJJIL;
        if (otQ == null) {
            n.LIZ("");
        }
        return otQ;
    }

    public final B9I<D> LJJIJIIJIL() {
        B9I<D> b9i = this.LJJJJI;
        if (b9i == null) {
            n.LIZ("");
        }
        return b9i;
    }

    public final OfH LJJIJIL() {
        OfH ofH = this.LJJJJIZL;
        if (ofH == null) {
            n.LIZ("");
        }
        return ofH;
    }

    public final SearchStateViewModel LJJIJL() {
        SearchStateViewModel searchStateViewModel = this.LJJJJJL;
        if (searchStateViewModel == null) {
            n.LIZ("");
        }
        return searchStateViewModel;
    }

    public 0EF LJJIZ() {
        getActivity();
        WrapLinearLayoutManager wrapLinearLayoutManager = new WrapLinearLayoutManager();
        wrapLinearLayoutManager.LIZIZ(1);
        return wrapLinearLayoutManager;
    }

    public final void LJJJJJL() {
        View view = getView();
        if (view != null) {
            view.post(new SUM(this));
        }
    }

    public final boolean LJJJJLI() {
        if (this.LJJJJI != null) {
            return true;
        }
        return false;
    }

    public final void bw_() {
        if (aq_()) {
            LJJIJIIJIL().showLoadMoreLoading();
        }
    }

    public final WeakReference<1hK> by_() {
        return new WeakReference<>(getActivity());
    }

    public void onPause() {
        SearchFragment.super.onPause();
        if (this.LJJJLIIL) {
            LJIILIIL();
        }
    }

    public void onResume() {
        SearchFragment.super.onResume();
        this.LJJJLL = SystemClock.uptimeMillis();
    }

    public void LJIJ() {
        LJJIJIIJIL().setData(this.LJIILL);
        this.LJIILL = new ArrayList();
    }

    public final void LJJJIL() {
        String str;
        SZN szn = new SZN();
        if (C2553S0f.LJIIJ.LIZIZ()) {
            str = "1";
        } else {
            str = "0";
        }
        szn.LIZJ(SZN.LIZIZ, str);
        szn.LJFF();
    }

    public final void LJJJJ() {
        LIZ(LJJJ().LIZ());
        LJ(false);
        LJJJJJL();
    }

    public final boolean LJJJJIZL() {
        String str;
        if (!this.LJIJI) {
            return false;
        }
        GlobalDoodleConfig globalDoodleConfig = this.LJIJ;
        if (globalDoodleConfig != null) {
            str = globalDoodleConfig.getTnsBanType();
        } else {
            str = null;
        }
        if (n.LIZ(str, "Aid")) {
            return true;
        }
        return false;
    }

    public final void bc_() {
        if (aq_()) {
            T9P t9p = this.LJIILIIL;
            if (t9p == null) {
                n.LIZ("");
            }
            if (!t9p.LIZIZ) {
                bO_();
            }
        }
    }

    public void onDestroyView() {
        View view = getView();
        if (view != null) {
            C3670Sd0 sd0 = C3671Sd1.LIZIZ;
            n.LIZIZ(view, "");
            sd0.LIZIZ(view);
        }
        super.onDestroyView();
        EventBus.LIZ().LIZIZ((Object) this);
        LIZJ();
    }

    private void LJIILJJIL() {
        if (this.LJJIJL) {
            if (this.LJIIL != null) {
                OQZ oqz = this.LJIIL;
                if (oqz == null) {
                    n.LIZ("");
                }
                oqz.post(new C3435SYd(this));
            }
            OtQ otQ = this.LJIILJJIL;
            if (otQ == null) {
                n.LIZ("");
            }
            otQ.LIZ();
            return;
        }
        T9P t9p = this.LJIILIIL;
        if (t9p == null) {
            n.LIZ("");
        }
        t9p.setRefreshing(true);
    }

    private void LJIILL() {
        Qsl qsl;
        RecyclerView recyclerView = this.LJIIJJI;
        if (recyclerView == null) {
            n.LIZ("");
        }
        recyclerView.LIZIZ(0);
        if (aq_()) {
            OQZ oqz = this.LJIIL;
            if (oqz == null) {
                n.LIZ("");
            }
            if (!oqz.LJIIJ()) {
                OQZ oqz2 = this.LJIIL;
                if (oqz2 == null) {
                    n.LIZ("");
                }
                if (!oqz2.LJIIJJI() && (qsl = this.LJIJJLI) != null) {
                    qsl.setExpanded(true);
                }
            }
        }
    }

    public final void LJJJI() {
        if (!this.LJJLIIIJJI) {
            OQZ oqz = this.LJIIL;
            if (oqz == null) {
                n.LIZ("");
            }
            Context context = oqz.getContext();
            FjH LIZ2 = FjH.LIZ(context);
            LIZ2.LIZIZ(OQR.LIZ(context));
            LIZ2.LJI = SXY.LIZ.LIZJ();
            LIZ2.LIZ(2131834392, new SZV(this));
            OQZ oqz2 = this.LJIIL;
            if (oqz2 == null) {
                n.LIZ("");
            }
            oqz2.setBuilder(LIZ2);
            this.LJJLIIIJJI = true;
        }
    }

    public final void LJJJJI() {
        LJIILLIIL();
        SearchStateViewModel searchStateViewModel = this.LJJJJJL;
        if (searchStateViewModel == null) {
            n.LIZ("");
        }
        searchStateViewModel.setIsRefreshingData(false);
        if (aq_()) {
            OtQ otQ = this.LJIILJJIL;
            if (otQ == null) {
                n.LIZ("");
            }
            otQ.LIZIZ();
            T9P t9p = this.LJIILIIL;
            if (t9p == null) {
                n.LIZ("");
            }
            t9p.setRefreshing(false);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:14:0x005e  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private final void LJIILIIL() {
        /*
            r6 = this;
            long r4 = android.os.SystemClock.uptimeMillis()
            long r0 = r6.LJJJLL
            long r4 = r4 - r0
            X.SV0 r0 = r6.LJJ
            if (r0 == 0) goto L_0x0069
            int r0 = r0.getIndex()
            java.lang.Integer r2 = java.lang.Integer.valueOf(r0)
        L_0x0013:
            java.lang.String r3 = ""
            if (r2 == 0) goto L_0x0023
            int r1 = r6.LJJIJ
            X.SV0 r0 = r6.LJJ
            if (r0 == 0) goto L_0x0060
            int r0 = r0.getIndex()
            if (r1 != r0) goto L_0x0060
        L_0x0023:
            r2 = r3
        L_0x0024:
            X.SXK r0 = r6.LJIL
            java.lang.String r0 = r0.getSearchId()
            if (r0 != 0) goto L_0x005e
        L_0x002c:
            X.SYf r1 = new X.SYf
            r1.<init>()
            java.lang.String r0 = java.lang.String.valueOf(r4)
            r1.LJIJJ(r0)
            int r0 = r6.LJJIJ
            java.lang.String r0 = X.C3320STs.LIZ((int) r0)
            r1.LJFF(r0)
            r1.LIZ((java.lang.String) r3)
            r1.LIZLLL(r3)
            X.B8V r0 = X.9oY.LIZ
            java.lang.String r0 = r0.LIZ(r3)
            r1.LIZJ(r0)
            r1.LJIJJLI(r2)
            java.lang.String r0 = r6.LJJII()
            r1.LIZIZ((java.lang.String) r0)
            r1.LJFF()
            return
        L_0x005e:
            r3 = r0
            goto L_0x002c
        L_0x0060:
            int r0 = r2.intValue()
            java.lang.String r2 = X.C3320STs.LIZ((int) r0)
            goto L_0x0024
        L_0x0069:
            r2 = 0
            goto L_0x0013
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.SearchFragment.LJIILIIL():void");
    }

    public void LJIIZILJ() {
        LIZ((QueryCorrectInfo) null);
        LIZIZ((SearchApiResult) null);
        LIZ((LeC) null, (String) null);
        if (LJJIJIIJIL().mShowFooter) {
            LJJIJIIJIL().setShowFooter(false);
            LJJIJIIJIL().notifyDataSetChanged();
        }
        LJJIJIIJIL().clearData();
        OQZ oqz = this.LJIIL;
        if (oqz == null) {
            n.LIZ("");
        }
        oqz.LJII();
        SearchStateViewModel searchStateViewModel = this.LJJJJJL;
        if (searchStateViewModel == null) {
            n.LIZ("");
        }
        searchStateViewModel.setIsRefreshingData(false);
        LJ(false);
        3BB r1 = new 3BB(GlobalContext.getContext());
        r1.LIZIZ(2131827476);
        r1.LIZIZ();
    }

    public final String LJJJJJ() {
        String str;
        QueryCorrectInfo queryCorrectInfo;
        QueryCorrectInfo queryCorrectInfo2 = this.LJJJJZI;
        if (queryCorrectInfo2 == null || queryCorrectInfo2.getCorrectedLevel() != 2 || (queryCorrectInfo = this.LJJJJZI) == null || (str = queryCorrectInfo.getCorrectedKeyword()) == null) {
            str = "";
        }
        LJJIII().LIZ(new Odu(LJJII(), str));
        QueryCorrectInfo queryCorrectInfo3 = this.LJJJJZI;
        if (queryCorrectInfo3 == null || queryCorrectInfo3.getCorrectedLevel() != 2) {
            return LJJII();
        }
        QueryCorrectInfo queryCorrectInfo4 = this.LJJJJZI;
        if (queryCorrectInfo4 == null) {
            n.LIZIZ();
        }
        String correctedKeyword = queryCorrectInfo4.getCorrectedKeyword();
        n.LIZIZ(correctedKeyword, "");
        return correctedKeyword;
    }

    public final String LJJJJL() {
        String str;
        String str2;
        SW6 searchCommonModel;
        SV5 sv5 = SearchEnterViewModel.LIZJ.LIZ(getActivity()).LIZ;
        String str3 = "";
        if (sv5 == null || TextUtils.isEmpty(sv5.getEnterSearchFrom()) || (str = sv5.getEnterSearchFrom()) == null) {
            str = str3;
        }
        AqZ aqZ = C3674Sd4.LJIILL;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("enter_from", str);
        1hK activity = getActivity();
        if (activity != null) {
            SV6 LJ2 = SXD.Companion.LJ(activity);
            if (LJ2 == null || (searchCommonModel = LJ2.getSearchCommonModel()) == null || (str2 = searchCommonModel.getEnterFrom()) == null) {
                str2 = str3;
            }
            str3 = str2;
        }
        jSONObject.put("enter_from_x", str3);
        aqZ.LIZ("ref_search_get_search_fragment_enterfrom", jSONObject, 8QU.LIZJ(new String[]{"enter_from"}));
        return str;
    }

    public SearchFragment() {
        Csa csa;
        Csy csy = Csy.LIZ;
        D1G LIZ2 = KEM.LIZ.LIZ(ResearchFilterVM.class);
        AXT axt = new AXT(LIZ2);
        AXS axs = AXS.INSTANCE;
        if (n.LIZ(csy, Csw.LIZ)) {
            csa = new Csa(LIZ2, axt, Css.LIZ, AoK.LIZ(this, true), AoK.LIZ(this, true), A7H.LIZ, axs, AoK.LIZ(this, true), AoK.LIZIZ(this, true));
        } else if (csy != null && !n.LIZ(csy, Csy.LIZ)) {
            throw new IllegalArgumentException("Do not support this scope here.");
        } else {
            csa = new Csa(LIZ2, axt, Css.LIZ, AoK.LIZ(this, false), AoK.LIZ(this, false), A7H.LIZ, axs, AoK.LIZ(this, false), AoK.LIZIZ(this, false));
        }
        this.LJJLI = csa;
        this.LJJLIIIIJ = true;
        this.LJJLIIIJ = 7vm.LIZ(new AXR(this));
        this.LJJLIIIJILLIZJL = 7vm.LIZ(new SG8(this));
    }

    public final void LIZ(GlobalDoodleConfig globalDoodleConfig) {
        this.LJIJ = globalDoodleConfig;
    }

    public static 0Bx LIZ(1hK r2) {
        0Bx LIZ2 = 0By.LIZ(r2, (0Bv) null);
        if (2GD.LIZ) {
            0Bs.LIZ(LIZ2, r2);
        }
        return LIZ2;
    }

    private String LIZ(int i) {
        if (i == 65280) {
            return C3321STt.VIDEO.getTabName();
        }
        if (i != 65514) {
            return "";
        }
        return "lynx";
    }

    public final void LIZIZ(Exception exc) {
        M12.LIZ(exc);
        if (aq_()) {
            LIZLLL(exc);
            LJJJJJL();
        }
    }

    public final void LIZJ(Exception exc) {
        M12.LIZ(exc);
        if (aq_()) {
            LJJJJI();
            LJJIJIIJIL().showLoadMoreError();
        }
    }

    public final void LIZLLL(boolean z) {
        this.LJIJI = z;
        if (!z && (!this.LJIILL.isEmpty())) {
            this.LJIILL = new ArrayList();
        }
    }

    @ISm
    public final void onFollowStatusUpdate(FollowStatusEvent followStatusEvent) {
        M12.LIZ(followStatusEvent);
        if (aq_() && LJJIJIIJIL() != null) {
            LIZ(followStatusEvent.status);
        }
    }

    private void LIZ(C3409SXd sXd) {
        0Gp.LIZ(new SX0(this, sXd));
    }

    private void LIZLLL(Exception exc) {
        M12.LIZ(exc);
        OQS LIZ2 = SG1.LIZ(LJJJ(), (SearchApiResult) null, exc, 1);
        if (LIZ2 != null) {
            LIZ(LIZ2);
            return;
        }
        DzH.LIZ(getContext(), exc, 2131832890);
        LJJJJ();
    }

    public final void LIZJ(SearchApiResult searchApiResult) {
        SearchSurveyConfig surveyConfig;
        SurveyViewModel surveyViewModel;
        NextLiveData<SearchSurveyConfig> nextLiveData;
        SearchSurveyConfig surveyConfig2;
        if (searchApiResult != null) {
            GlobalDoodleConfig globalDoodleConfig = searchApiResult.globalDoodleConfig;
            if (!(globalDoodleConfig == null || (surveyConfig2 = globalDoodleConfig.getSurveyConfig()) == null)) {
                surveyConfig2.getSurveyId();
            }
            GlobalDoodleConfig globalDoodleConfig2 = searchApiResult.globalDoodleConfig;
            if (globalDoodleConfig2 != null && (surveyConfig = globalDoodleConfig2.getSurveyConfig()) != null && (surveyViewModel = this.LJJL) != null && (nextLiveData = surveyViewModel.LIZIZ) != null) {
                nextLiveData.postValue(surveyConfig);
            }
        }
    }

    public final void d_(boolean z) {
        boolean z2;
        if (!z) {
            OQZ oqz = this.LJIIL;
            if (oqz == null) {
                n.LIZ("");
            }
            if (!oqz.LJIIJJI()) {
                OQZ oqz2 = this.LJIIL;
                if (oqz2 == null) {
                    n.LIZ("");
                }
                if (!oqz2.LJIIL()) {
                    OQZ oqz3 = this.LJIIL;
                    if (oqz3 == null) {
                        n.LIZ("");
                    }
                    if (!oqz3.LJIILIIL()) {
                        OQZ oqz4 = this.LJIIL;
                        if (oqz4 == null) {
                            n.LIZ("");
                        }
                        if (!oqz4.LJIIJ()) {
                            z2 = false;
                            this.LJJIJL = z2;
                        }
                    }
                }
            }
        }
        z2 = true;
        this.LJJIJL = z2;
    }

    @ISm
    public final void onFeedbackSubmitSuccess(LaL laL) {
        NextLiveData<Boolean> nextLiveData;
        NextLiveData<Boolean> nextLiveData2;
        M12.LIZ(laL);
        SurveyViewModel surveyViewModel = this.LJJL;
        if (!(surveyViewModel == null || (nextLiveData2 = surveyViewModel.LIZ) == null)) {
            Boolean.valueOf(nextLiveData2.hasObservers());
        }
        SurveyViewModel surveyViewModel2 = this.LJJL;
        if (surveyViewModel2 != null && (nextLiveData = surveyViewModel2.LIZ) != null) {
            nextLiveData.postValue(true);
        }
    }

    @ISm
    public void onReceiveVideoEvent(Etp etp) {
        Integer valueOf;
        Qsl qsl;
        if (etp != null && (valueOf = Integer.valueOf(etp.LIZ)) != null && valueOf.intValue() == 21 && (etp.LIZIZ instanceof Aweme) && etp.LJIILIIL && !this.LIZLLL && (qsl = this.LJIJJLI) != null) {
            qsl.setExpanded(false);
        }
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public void onShowResultsEvent(P1F p1f) {
        Integer num;
        if (p1f != null) {
            String str = p1f.LIZ;
            1hK activity = getActivity();
            if (activity != null) {
                num = Integer.valueOf(activity.hashCode());
            } else {
                num = null;
            }
            if (n.LIZ(str, String.valueOf(num)) && n.LIZ(p1f.LIZIZ, C3320STs.LIZ(this.LJJIJ))) {
                LJIJ();
            }
        }
    }

    public void setUserVisibleHint(boolean z) {
        SearchFragment.super.setUserVisibleHint(z);
        LIZ(true, false);
        if (z) {
            SYI LIZLLL2 = SXD.Companion.LIZLLL(this);
            if (LIZLLL2 != null) {
                LIZLLL2.setSearchLastShowPageIndex(this.LJJIJ);
            }
            C3411SXf.LIZLLL = false;
            SV0 sv0 = this.LJJ;
            if (sv0 != null) {
                sv0.setIndex(this.LJJIJ);
            }
            this.LJJJLL = SystemClock.uptimeMillis();
        }
        if (this.LJJJLIIL && !z) {
            LJIILIIL();
        }
        this.LJJJLIIL = z;
    }

    private boolean LIZLLL(SearchApiResult searchApiResult) {
        if (!(searchApiResult instanceof SearchUserList)) {
            if (searchApiResult instanceof SearchMix) {
                List<Aweme> list = ((SearchMix) searchApiResult).awemeList;
                if (list == null || list.isEmpty()) {
                    return false;
                }
            } else if (searchApiResult instanceof SearchMusicList) {
                List list2 = ((SearchMusicList) searchApiResult).searchMusicList;
                if (list2 == null || list2.isEmpty()) {
                    return false;
                }
            } else if (searchApiResult instanceof SearchChallengeList) {
                return true;
            } else {
                return false;
            }
        }
        return true;
    }

    private final void LJ(boolean z) {
        if (this.LJIJJLI != null) {
            T9P t9p = this.LJIILIIL;
            if (t9p == null) {
                n.LIZ("");
            }
            05s layoutParams = t9p.getLayoutParams();
            if (z) {
                if (layoutParams != null) {
                    layoutParams.LIZ(new AppBarLayout.ScrollingViewBehavior());
                }
                Qsl qsl = this.LJIJJLI;
                if (qsl != null) {
                    qsl.setVisibility(0);
                }
                Qsl qsl2 = this.LJIJJLI;
                if (qsl2 != null) {
                    qsl2.setExpanded(true);
                    return;
                }
                return;
            }
            if (layoutParams != null) {
                layoutParams.LIZ((05p) null);
            }
            Qsl qsl3 = this.LJIJJLI;
            if (qsl3 != null) {
                qsl3.setVisibility(8);
            }
            Qsl qsl4 = this.LJIJJLI;
            if (qsl4 != null) {
                qsl4.setExpanded(false);
            }
        }
    }

    public final void LIZIZ(List<? extends D> list) {
        LeC leC;
        M12.LIZ(list);
        for (T next : list) {
            if ((next instanceof STZ) && (leC = ((STZ) next).LJIIIZ) != null && leC.isQrecVirtualEnable()) {
                String LIZ2 = SXB.LIZJ.LIZ();
                String str = SXB.LIZJ.LIZIZ() + LIZ2;
                SXB.LIZJ.LIZ(LIZ2, true);
                MaskedSearchMobData maskedSearchMobData = SXB.LIZ.get(str);
                if (maskedSearchMobData != null) {
                    List relateSearchList = leC.getRelateSearchList();
                    n.LIZIZ(relateSearchList, "");
                    maskedSearchMobData.setRsWords(relateSearchList);
                }
                MaskedSearchMobData maskedSearchMobData2 = SXB.LIZ.get(str);
                if (maskedSearchMobData2 != null) {
                    maskedSearchMobData2.masked_rs_keywords_time = System.currentTimeMillis();
                }
            }
        }
    }

    public void onCreate(Bundle bundle) {
        SearchFragment.super.onCreate(bundle);
        Bundle arguments = getArguments();
        if (arguments != null) {
            Serializable serializable = arguments.getSerializable(SearchBaseFragment.LJJIL);
            Objects.requireNonNull(serializable, "null cannot be cast to non-null type com.ss.android.ugc.aweme.search.model.SearchResultParam");
            LIZIZ((SV0) serializable);
        }
        1hK activity = getActivity();
        if (activity == null) {
            n.LIZIZ();
        }
        SearchStateViewModel LIZ2 = LIZ(activity).LIZ(SearchStateViewModel.class);
        n.LIZIZ(LIZ2, "");
        SearchStateViewModel searchStateViewModel = LIZ2;
        this.LJJJJJL = searchStateViewModel;
        if (searchStateViewModel == null) {
            n.LIZ("");
        }
        searchStateViewModel.searchState.observe(this, new C3441SYj(this));
        1hK activity2 = getActivity();
        if (activity2 != null) {
            this.LJIJJ = LIZ(activity2).LIZ(SearchIntermediateViewModel.class);
            this.LIZIZ = LIZ(activity2).LIZ(SearchGlobalViewModel.class);
        }
        if (this.LJJIJIIJIL == null) {
            LJIIL().LIZ();
        }
    }

    @ISm
    public void onSearchAfterLogin(SG7 sg7) {
        M12.LIZ(sg7);
        if (sg7.LIZ && aq_()) {
            OQZ oqz = this.LJIIL;
            if (oqz == null) {
                n.LIZ("");
            }
            if (!oqz.LJIIJJI()) {
                OQZ oqz2 = this.LJIIL;
                if (oqz2 == null) {
                    n.LIZ("");
                }
                if (!oqz2.LJIIL()) {
                    OQZ oqz3 = this.LJIIL;
                    if (oqz3 == null) {
                        n.LIZ("");
                    }
                    if (!oqz3.LJIILIIL()) {
                        return;
                    }
                }
            }
            OQZ oqz4 = this.LJIIL;
            if (oqz4 == null) {
                n.LIZ("");
            }
            oqz4.LIZLLL();
            this.LJJJJJ = true;
            LIZ(false, false);
        }
    }

    public void LIZIZ(SV0 sv0) {
        boolean z;
        String str;
        M12.LIZ(sv0);
        this.LJJ = sv0;
        String keyword = sv0.getKeyword();
        n.LIZIZ(keyword, "");
        LIZIZ(keyword);
        String searchFrom = sv0.getSearchFrom();
        n.LIZIZ(searchFrom, "");
        LIZJ(searchFrom);
        this.LJJIJIIJI = sv0.getNeedCorrect();
        String enterMethod = sv0.getEnterMethod();
        if (enterMethod == null || enterMethod.length() == 0) {
            z = true;
        } else {
            z = false;
        }
        if (!z) {
            str = sv0.getEnterMethod();
            n.LIZIZ(str, "");
        } else {
            str = "channel_unknown";
        }
        LIZLLL(str);
        if (n.LIZ(this.LJJIII, "channel_unknown")) {
            this.LJIL.setRecentRequestSearchSourceUnknown(true);
        }
        if (n.LIZ(this.LJJII, "search_sug")) {
            this.LJJIIZI = sv0.getSugType();
        }
        if (4q6.LIZ(sv0.getFromSearchSubtag())) {
            String fromSearchSubtag = sv0.getFromSearchSubtag();
            n.LIZIZ(fromSearchSubtag, "");
            M12.LIZ(fromSearchSubtag);
            this.LJJIIJZLJL = fromSearchSubtag;
        }
        if (4q6.LIZ(sv0.getPreSearchId())) {
            String preSearchId = sv0.getPreSearchId();
            n.LIZIZ(preSearchId, "");
            M12.LIZ(preSearchId);
            this.LJJIIZ = preSearchId;
        }
        1hK activity = getActivity();
        if (activity != null) {
            LIZ(activity).LIZ(SearchResultViewModel.class).LIZ.postValue(sv0);
        }
    }

    public final void LIZJ(boolean z) {
        boolean z2;
        String str;
        ARc aRc;
        AVG avg;
        List list;
        AVG avg2;
        if (!(this.LJJIJIIJIL == null || (avg2 = this.LJJIJIIJIL) == null || avg2.isDefaultOption())) {
            Boolean hasShownResearchFilter = this.LJIL.getHasShownResearchFilter();
            if (hasShownResearchFilter != null) {
                z = hasShownResearchFilter.booleanValue();
            } else {
                z = false;
            }
        }
        if (!z || (list = LJJIJLIJ().LIZLLL) == null || list.isEmpty()) {
            z2 = false;
        } else {
            z2 = true;
        }
        this.LJIL.setHasShownResearchFilter(Boolean.valueOf(z2));
        String str2 = null;
        if (this.LJJIJIIJIL == null || ((avg = this.LJJIJIIJIL) != null && avg.isDefaultResearchOption())) {
            ResearchFilterVM LJJIJLIJ = LJJIJLIJ();
            LJJIJLIJ.LIZ = false;
            LJJIJLIJ.LIZIZ = false;
            LJJIJLIJ.LIZJ = 0;
            List list2 = LJJIJLIJ.LIZLLL;
            if (list2 != null) {
                aRc = (ARc) Lea.LJIIIIZZ(list2);
            } else {
                aRc = null;
            }
            LJJIJLIJ.LIZ(aRc);
            AgW agW = this.LJJJIL;
            if (agW != null) {
                agW.LIZ(0);
            }
        }
        LJ(z2);
        if (z2) {
            SXK LIZJ2 = SXD.Companion.LIZJ(this);
            Cwu[] cwuArr = new Cwu[3];
            if (LIZJ2 != null) {
                str = LIZJ2.getSearchId();
            } else {
                str = null;
            }
            cwuArr[0] = CwZ.LIZ("search_id", str);
            if (LIZJ2 != null) {
                str2 = LIZJ2.getSearchKeyword();
            }
            cwuArr[1] = CwZ.LIZ("search_keyword", str2);
            cwuArr[2] = CwZ.LIZ("enter_from", "general_search");
            2nK.LIZ("filter_exposed_show", LWw.LIZIZ(cwuArr));
        }
    }

    public final void e_(boolean z) {
        AVG avg;
        2ce<Boolean> enableSearchFilter;
        2ce<Boolean> enableSearchFilter2;
        2ce<Boolean> enableSearchFilter3;
        SearchIntermediateViewModel searchIntermediateViewModel;
        2ce<Boolean> showSearchFilterDot;
        boolean z2 = z;
        if (!Ahh.LIZ.LIZ()) {
            Agy LJIIL2 = LJIIL();
            Objects.requireNonNull(LJIIL2, "null cannot be cast to non-null type com.ss.android.ugc.aweme.discover.ui.SearchBottomDialogHelper");
            LJIIL2.LIZ(z2, getActivity(), this.LJJIJ, this.LJJ, this.LJJIJIL);
        }
        if (Ah9.LIZ && LJIJI()) {
            SV0 sv0 = this.LJJ;
            if (sv0 != null) {
                avg = sv0.getFilterOption();
            } else {
                avg = null;
            }
            if (!(avg != null || (searchIntermediateViewModel = this.LJIJJ) == null || (showSearchFilterDot = searchIntermediateViewModel.getShowSearchFilterDot()) == null)) {
                showSearchFilterDot.setValue(false);
            }
            if (!z2) {
                SearchIntermediateViewModel searchIntermediateViewModel2 = this.LJIJJ;
                if (!(searchIntermediateViewModel2 == null || (enableSearchFilter = searchIntermediateViewModel2.getEnableSearchFilter()) == null)) {
                    enableSearchFilter.setValue(false);
                }
                this.LJJIJIL = false;
            } else if (AgT.LIZJ.LIZ(LJIIL().LIZIZ())) {
                SearchIntermediateViewModel searchIntermediateViewModel3 = this.LJIJJ;
                if (!(searchIntermediateViewModel3 == null || (enableSearchFilter3 = searchIntermediateViewModel3.getEnableSearchFilter()) == null)) {
                    enableSearchFilter3.setValue(true);
                }
                this.LJJIJIL = true;
            } else {
                SearchIntermediateViewModel searchIntermediateViewModel4 = this.LJIJJ;
                if (!(searchIntermediateViewModel4 == null || (enableSearchFilter2 = searchIntermediateViewModel4.getEnableSearchFilter()) == null)) {
                    enableSearchFilter2.setValue(false);
                }
                this.LJJIJIL = false;
            }
        }
    }

    public final void LIZ(B9I<D> b9i) {
        M12.LIZ(b9i);
        this.LJJJJI = b9i;
    }

    public final void LIZIZ(SearchApiResult searchApiResult) {
        View view;
        View view2;
        View view3;
        boolean z;
        String str;
        String str2;
        String str3;
        Integer num;
        Map<String, String> searchTrackMap;
        C3302STa sTa;
        List<STZ> list;
        Boolean bool;
        String LIZ2;
        View view4;
        View view5 = null;
        SearchApiResult searchApiResult2 = searchApiResult;
        if (searchApiResult2 == null || searchApiResult2.dynamicHeader == null) {
            OfH LJJIJIL = LJJIJIL();
            Lut lut = this.LIZ;
            if (lut != null) {
                view = lut.itemView;
            } else {
                view = null;
            }
            LJJIJIL.LIZIZ(view);
            Lut lut2 = this.LIZ;
            if (!(lut2 == null || (view2 = lut2.itemView) == null)) {
                view2.setVisibility(8);
            }
            this.LIZ = null;
            if (LJIJJLI()) {
                RecyclerView recyclerView = this.LJIIJJI;
                if (recyclerView == null) {
                    n.LIZ("");
                }
                recyclerView.setPadding(0, (int) HeD.LIZIZ(getContext(), 8.0f), 0, 0);
                return;
            }
            return;
        }
        LeC leC = searchApiResult2.dynamicHeader;
        OfH LJJIJIL2 = LJJIJIL();
        Lut lut3 = this.LIZ;
        if (lut3 != null) {
            view3 = lut3.itemView;
        } else {
            view3 = null;
        }
        LJJIJIL2.LIZIZ(view3);
        Lut lut4 = this.LIZ;
        if (!(lut4 == null || (view4 = lut4.itemView) == null)) {
            view4.setVisibility(8);
        }
        this.LIZ = null;
        n.LIZIZ(leC, "");
        if (!TextUtils.isEmpty(leC.getSchema())) {
            RecyclerView recyclerView2 = this.LJIIJJI;
            if (recyclerView2 == null) {
                n.LIZ("");
            }
            this.LIZ = Lut.LIZLLL.LIZ(recyclerView2);
            C3865Sg9.LIZ.LIZ(Integer.valueOf(hashCode()), this.LIZ);
            if (this.LJJIJ != 0 || !(searchApiResult2 instanceof C3302STa) || (list = sTa.LIZJ) == null || list.isEmpty()) {
                z = LIZLLL(searchApiResult2);
                CharSequence LIZ3 = SX6.LIZLLL.LIZ(this.LJJIJ, getContext());
                str = LIZ3 != null ? String.valueOf(LIZ3) : "";
            } else {
                EmU emU = (sTa = (C3302STa) searchApiResult2).LIZJ.get(0);
                GlobalDoodleConfig globalDoodleConfig = this.LJIJ;
                if (globalDoodleConfig != null) {
                    bool = globalDoodleConfig.getHideResults();
                } else {
                    bool = null;
                }
                if (n.LIZ(bool, true)) {
                    Objects.requireNonNull(emU, "null cannot be cast to non-null type com.ss.android.ugc.aweme.discover.mixfeed.SearchMixFeed");
                    LIZ2 = LIZ(emU.getFeedType());
                } else {
                    Objects.requireNonNull(emU, "null cannot be cast to non-null type com.ss.android.ugc.aweme.discover.mixfeed.SearchMixFeed");
                    LIZ2 = LIZ(emU.getFeedType());
                }
                if (LIZ2.length() <= 0 || !(!n.LIZ(LIZ2, "lynx"))) {
                    str = "";
                    z = false;
                } else {
                    CharSequence LIZ4 = SX6.LIZLLL.LIZ(C3320STs.LIZ(LIZ2), getContext());
                    if (LIZ4 != null) {
                        str = String.valueOf(LIZ4);
                    } else {
                        str = "";
                    }
                    z = true;
                }
            }
            SXK LIZJ2 = SXD.Companion.LIZJ(getActivity());
            if (LIZJ2 != null) {
                str2 = LIZJ2.getSearchId();
            } else {
                str2 = null;
            }
            String LIZ5 = C3320STs.LIZ(this.LJJIJ);
            if (LIZJ2 == null || (searchTrackMap = LIZJ2.getSearchTrackMap()) == null) {
                str3 = null;
            } else {
                str3 = searchTrackMap.get("use_scenario");
            }
            Cwu[] cwuArr = new Cwu[6];
            if (str2 == null) {
                str2 = "";
            }
            cwuArr[0] = CwZ.LIZ("search_id", str2);
            cwuArr[1] = CwZ.LIZ("search_type", LIZ5);
            if (str3 == null) {
                str3 = "";
            }
            cwuArr[2] = CwZ.LIZ("use_scenario", str3);
            1hK activity = getActivity();
            if (activity != null) {
                num = Integer.valueOf(activity.hashCode());
            } else {
                num = null;
            }
            String valueOf = String.valueOf(num);
            if (valueOf == null) {
                valueOf = "";
            }
            cwuArr[3] = CwZ.LIZ("search_page_code", valueOf);
            cwuArr[4] = CwZ.LIZ("needShowTag", Boolean.valueOf(z));
            cwuArr[5] = CwZ.LIZ("tag", str);
            Map LIZ6 = LWw.LIZ(cwuArr);
            Lut lut5 = this.LIZ;
            if (lut5 != null) {
                Lut.LIZ(lut5, leC, (Cb6) null, LIZ6, (8ER) null, 24);
            }
            OfH LJJIJIL3 = LJJIJIL();
            Lut lut6 = this.LIZ;
            if (lut6 != null) {
                view5 = lut6.itemView;
            }
            LJJIJIL3.LIZ(0, view5);
            RecyclerView recyclerView3 = this.LJIIJJI;
            if (recyclerView3 == null) {
                n.LIZ("");
            }
            recyclerView3.setPadding(0, 0, 0, 0);
        }
    }

    public final void LIZ(OQS oqs) {
        M12.LIZ(oqs);
        LJJJJI();
        if (LJJIJIIJIL().mShowFooter) {
            LJJIJIIJIL().setShowFooter(false);
            LJJIJIIJIL().notifyDataSetChanged();
        }
        LJJIJIIJIL().clearData();
        if (!LJJJJIZL()) {
            OQZ oqz = this.LJIIL;
            if (oqz == null) {
                n.LIZ("");
            }
            M12.LIZ(oqz, oqs);
            M12.LIZ(oqs);
            if (oqs.LJIL != SG2.EMPTY.getType() && oqs.LJIJ) {
                OQf LIZIZ2 = oqz.LIZIZ(2);
                Objects.requireNonNull(LIZIZ2, "null cannot be cast to non-null type com.bytedance.ies.dmt.ui.widget.IDmtDefaultView");
                LIZIZ2.setStatus(oqs);
                oqz.LJII();
            } else {
                OQR LIZIZ3 = oqz.LIZIZ(1);
                if (LIZIZ3 instanceof OQf) {
                    LIZIZ3.setStatus(oqs);
                    if (LIZIZ3 instanceof OQR) {
                        LIZIZ3.setDocLayoutParams(new LinearLayout.LayoutParams(-1, -2));
                    }
                }
                if (LIZIZ3 instanceof OQd) {
                    ((OQd) LIZIZ3).setSearchStatusName((SG2) null);
                }
                oqz.LJI();
            }
        } else {
            OQZ oqz2 = this.LJIIL;
            if (oqz2 == null) {
                n.LIZ("");
            } else {
                oqz2.LIZLLL();
            }
        }
        c_(false);
    }

    public final void LIZ(OfH ofH) {
        M12.LIZ(ofH);
        this.LJJJJIZL = ofH;
    }

    public void LIZIZ(List<? extends D> list, boolean z) {
        if (aq_()) {
            if (list == null || list.isEmpty()) {
                z = false;
            }
            LJJJJI();
            if (!z) {
                LJJIJIIJIL().showLoadMoreEmpty();
            } else {
                LJJIJIIJIL().resetLoadMoreState();
            }
            LJJIJIIJIL().setDataAfterLoadMore(list);
        }
    }

    public final void LIZ(0EF r3, int i) {
        M12.LIZ(r3);
        if (r3 instanceof GridLayoutManager) {
            ((LinearLayoutManager) r3).LIZ(i, 0);
        } else if (r3 instanceof LinearLayoutManager) {
            ((LinearLayoutManager) r3).LIZ(i, 0);
        } else {
            r3.LJ(i);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:53:0x00d1, code lost:
        if (r8.isDefaultOption() != false) goto L_0x0009;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void LIZ(int r7, X.AVG r8) {
        /*
            r6 = this;
            X.SV0 r0 = r6.LJJ
            r6.LJJI = r0
            r4 = 0
            if (r8 != 0) goto L_0x00cd
            r6.LJJIJIIJIL = r4
        L_0x0009:
            X.B0a r0 = r6.LJIIL()
            r0.LIZ()
        L_0x0010:
            int r0 = r6.LJJIJ
            java.lang.String r1 = X.C3352SUy.LIZJ(r0)
            X.STt r0 = X.C3321STt.TOP
            java.lang.String r0 = r0.getTabName()
            boolean r0 = android.text.TextUtils.equals(r1, r0)
            if (r0 == 0) goto L_0x0029
            X.SUn r1 = X.C3341SUn.LJFF
            X.SV0 r0 = r6.LJJ
            r1.onEventStart(r0)
        L_0x0029:
            X.SV0 r0 = r6.LJJ
            r1 = 0
            r3 = 1
            if (r0 == 0) goto L_0x004d
            boolean r0 = r0.getIsFilterFromSchema()
            if (r0 != r3) goto L_0x004d
            X.SV0 r0 = r6.LJJ
            if (r0 == 0) goto L_0x00ca
            X.AVG r0 = r0.getFilterOption()
        L_0x003d:
            r6.LJJIJIIJIL = r0
            X.AVG r0 = r6.LJJIJIIJIL
            if (r0 == 0) goto L_0x0046
            r0.setFromSchema(r3)
        L_0x0046:
            X.SV0 r0 = r6.LJJ
            if (r0 == 0) goto L_0x004d
            r0.setIsFilterFromSchema(r1)
        L_0x004d:
            r6.LJIILL()
            com.ss.android.ugc.aweme.discover.helper.MusicPlayHelper r5 = r6.LJJJLZIJ
            if (r5 == 0) goto L_0x00b4
            com.ss.android.ugc.aweme.music.model.Music r0 = r5.LIZIZ
            if (r0 == 0) goto L_0x00b4
            X.2ce r0 = r5.LIZ
            java.lang.Object r0 = r0.getValue()
            if (r0 == 0) goto L_0x00b4
            X.2ce r0 = r5.LIZ
            java.lang.Object r0 = r0.getValue()
            X.Cwu r0 = (X.Cwu) r0
            if (r0 == 0) goto L_0x0077
            java.lang.Object r0 = r0.getFirst()
            java.lang.Number r0 = (java.lang.Number) r0
            int r1 = r0.intValue()
            r0 = 2
            if (r1 == r0) goto L_0x008d
        L_0x0077:
            X.2ce r0 = r5.LIZ
            java.lang.Object r0 = r0.getValue()
            X.Cwu r0 = (X.Cwu) r0
            if (r0 == 0) goto L_0x00b4
            java.lang.Object r0 = r0.getFirst()
            java.lang.Number r0 = (java.lang.Number) r0
            int r0 = r0.intValue()
            if (r0 != r3) goto L_0x00b4
        L_0x008d:
            X.2ce r0 = r5.LIZ
            java.lang.Object r0 = r0.getValue()
            X.Cwu r0 = (X.Cwu) r0
            if (r0 == 0) goto L_0x00c8
            java.lang.Object r2 = r0.getSecond()
        L_0x009b:
            com.ss.android.ugc.aweme.music.model.Music r0 = r5.LIZIZ
            if (r0 == 0) goto L_0x00a7
            long r0 = r0.getId()
            java.lang.Long r4 = java.lang.Long.valueOf(r0)
        L_0x00a7:
            boolean r0 = kotlin.h.b.n.LIZ(r2, r4)
            if (r0 == 0) goto L_0x00b4
            com.ss.android.ugc.aweme.discover.helper.MusicPlayHelper r0 = r6.LJJJLZIJ
            if (r0 == 0) goto L_0x00b4
            r0.LIZ()
        L_0x00b4:
            X.SV0 r0 = r6.LJJ
            if (r0 == 0) goto L_0x00bb
            r0.setFilterOption(r8)
        L_0x00bb:
            long r0 = java.lang.System.currentTimeMillis()
            r6.LJJJJLI = r0
            r6.LJJLIIIIJ = r3
            java.lang.String r0 = X.C3610Sc2.LIZIZ
            X.C3610Sc2.LIZ = r0
            return
        L_0x00c8:
            r2 = r4
            goto L_0x009b
        L_0x00ca:
            r0 = r4
            goto L_0x003d
        L_0x00cd:
            boolean r0 = r8.isDefaultOption()
            if (r0 == 0) goto L_0x0010
            goto L_0x0009
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.SearchFragment.LIZ(int, X.AVG):void");
    }

    public void onViewCreated(View view, Bundle bundle) {
        int i;
        String str;
        int i2;
        int i3;
        M12.LIZ(view);
        SearchFragment.super.onViewCreated(view, bundle);
        LIZ(view);
        LIZ(view, bundle);
        LJIIIIZZ();
        if (this.LJJ != null) {
            SV0 sv0 = this.LJJ;
            if (sv0 == null) {
                n.LIZIZ();
            }
            LIZ(sv0);
        }
        EventBus.LIZ(EventBus.LIZ(), (Object) this);
        1hK activity = getActivity();
        if (activity != null) {
            this.LJJJZ = LIZ(activity).LIZ(SearchEnterViewModel.class);
            this.LJJJLZIJ = LIZ(activity).LIZ(MusicPlayHelper.class);
            this.LJJL = LIZ(activity).LIZ(SurveyViewModel.class);
            8gI r2 = 8gI.LIZIZ;
            1hK activity2 = getActivity();
            if (activity2 != null) {
                i2 = activity2.hashCode();
            } else {
                i2 = 0;
            }
            if (r2.LIZ(i2) == null) {
                8gI r3 = 8gI.LIZIZ;
                1hK activity3 = getActivity();
                if (activity3 != null) {
                    i3 = activity3.hashCode();
                } else {
                    i3 = 0;
                }
                r3.LIZ(i3, new C0043R1r());
            }
        }
        ResearchFilterVM LJJIJLIJ = LJJIJLIJ();
        AgT agT = AgT.LIZJ;
        1hK activity4 = getActivity();
        if (activity4 != null) {
            i = activity4.hashCode();
        } else {
            i = 0;
        }
        LJJIJLIJ.LIZLLL = agT.LIZIZ(i, C3320STs.LIZ(this.LJJIFFI));
        Cus.LIZ(this, LJJIJLIJ(), ARe.LIZ, (Cvh) null, new AVu(this), 6);
        int i4 = this.LJJIJ;
        if (i4 == C3320STs.LIZIZ.LIZIZ()) {
            str = "search_user_list";
        } else if (i4 == C3320STs.LIZIZ.LIZJ()) {
            str = "search_video_list";
        } else if (i4 == C3320STs.LIZIZ.LIZLLL()) {
            str = "search_music_list";
        } else if (i4 == C3320STs.LIZIZ.LJFF()) {
            str = "search_challenge_list";
        } else if (i4 == C3320STs.LIZ()) {
            str = "search_mix_feed_list";
        } else {
            str = "";
        }
        if (!n.LIZ(str, "")) {
            3eh LIZ2 = 2om.LIZIZ.LIZ(str);
            RecyclerView recyclerView = this.LJIIJJI;
            if (recyclerView == null) {
                n.LIZ("");
            }
            LIZ2.LIZ(recyclerView);
        }
        1hK activity5 = getActivity();
        if (activity5 == null) {
            n.LIZIZ();
        }
        this.LIZJ = LIZ(activity5).LIZ(SearchStateViewModel.class);
        if (!LJIJJLI()) {
            RecyclerView recyclerView2 = this.LJIIJJI;
            if (recyclerView2 == null) {
                n.LIZ("");
            }
            recyclerView2.setPadding(0, 0, 0, 0);
        }
        B7g.LIZJ.LIZ(getActivity());
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        if (viewGroup == null) {
            n.LIZIZ();
        }
        View LIZ2 = 0HH.LIZ(layoutInflater.cloneInContext(viewGroup.getContext()), LJJIL(), viewGroup, false);
        if (!SXY.LIZIZ()) {
            n.LIZIZ(LIZ2, "");
            LIZ2.setBackground((Drawable) null);
        }
        return LIZ2;
    }

    public <S extends 4HR> void subscribe(AssemViewModel<S> assemViewModel, Cvh<S> cvh, LsC<? super Throwable, 2Pr> lsC, LsD<? super 4hP, ? super S, 2Pr> lsD) {
        M12.LIZ(assemViewModel, cvh, lsD);
        ARD.LIZ(this, assemViewModel, cvh, lsC, lsD);
    }

    public <S extends 4HR, A> void selectSubscribe(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, Cvh<CwK<A>> cvh, LsC<? super Throwable, 2Pr> lsC, LsD<? super 4hP, ? super A, 2Pr> lsD) {
        M12.LIZ(assemViewModel, phd, cvh, lsD);
        ARD.LIZ(this, assemViewModel, phd, cvh, lsC, lsD);
    }

    public <S extends 4HR, A> void selectSubscribeOnAsync(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, Cvh<CwK<A>> cvh, LsC<? super Throwable, 2Pr> lsC, LsD<? super 4hP, ? super A, 2Pr> lsD) {
        M12.LIZ(assemViewModel, phd, cvh, lsD);
        ARD.LIZIZ(this, assemViewModel, phd, cvh, lsC, lsD);
    }

    public <S extends 4HR, A, B> void selectSubscribe(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, Cvh<CwU<A, B>> cvh, LsC<? super Throwable, 2Pr> lsC, LsE<? super 4hP, ? super A, ? super B, 2Pr> lsE) {
        M12.LIZ(assemViewModel, phd, phd2, cvh, lsE);
        ARD.LIZ(this, assemViewModel, phd, phd2, cvh, lsC, lsE);
    }

    public <S extends 4HR, A, B, C> void selectSubscribe(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, Cvh<Cwc<A, B, C>> cvh, LsC<? super Throwable, 2Pr> lsC, LsF<? super 4hP, ? super A, ? super B, ? super C, 2Pr> lsF) {
        LsF<? super 4hP, ? super A, ? super B, ? super C, 2Pr> lsF2 = lsF;
        AssemViewModel<S> assemViewModel2 = assemViewModel;
        PHD<S, ? extends A> phd4 = phd;
        PHD<S, ? extends B> phd5 = phd2;
        PHD<S, ? extends C> phd6 = phd3;
        Cvh<Cwc<A, B, C>> cvh2 = cvh;
        M12.LIZ(assemViewModel2, phd4, phd5, phd6, cvh2, lsF2);
        ARD.LIZ(this, assemViewModel2, phd4, phd5, phd6, cvh2, lsC, lsF2);
    }

    public <S extends 4HR, A, B, C, D> void selectSubscribe(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, PHD<S, ? extends D> phd4, Cvh<Cwf<A, B, C, D>> cvh, LsC<? super Throwable, 2Pr> lsC, Lsh<? super 4hP, ? super A, ? super B, ? super C, ? super D, 2Pr> lsh) {
        Lsh<? super 4hP, ? super A, ? super B, ? super C, ? super D, 2Pr> lsh2 = lsh;
        AssemViewModel<S> assemViewModel2 = assemViewModel;
        PHD<S, ? extends A> phd5 = phd;
        PHD<S, ? extends B> phd6 = phd2;
        PHD<S, ? extends C> phd7 = phd3;
        PHD<S, ? extends D> phd8 = phd4;
        Cvh<Cwf<A, B, C, D>> cvh2 = cvh;
        M12.LIZ(assemViewModel2, phd5, phd6, phd7, phd8, cvh2, lsh2);
        ARD.LIZ(this, assemViewModel2, phd5, phd6, phd7, phd8, cvh2, lsC, lsh2);
    }
}
