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

import X.0Bt;
import X.1Bn;
import X.2WS;
import X.2cN;
import X.7he;
import X.C3369SVp;
import X.C3372SVs;
import X.C3376SVw;
import X.Crj;
import X.Ls2;
import X.M12;
import X.OeM;
import X.PgU;
import X.PqJ;
import X.SYM;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.compliance.api.a;
import com.ss.android.ugc.aweme.discover.api.SuggestWordsApi;
import com.ss.android.ugc.aweme.discover.model.suggest.TypeWords;

public final class SuggestWordsViewModel extends 0Bt {
    public final Crj LIZ = 7he.LIZ(C3376SVw.LIZ);
    public 2cN LIZIZ;

    static {
        Covode.recordClassIndex(66029);
    }

    public final 1Bn<OeM<TypeWords>> LIZ() {
        return (1Bn) this.LIZ.getValue();
    }

    public final void onCleared() {
        SuggestWordsViewModel.super.onCleared();
        LIZIZ();
    }

    private final void LIZIZ() {
        2cN r1 = this.LIZIZ;
        if (r1 != null) {
            if (!r1.isDisposed()) {
                r1.dispose();
            }
            this.LIZIZ = null;
        }
    }

    public final void LIZ(SYM sym) {
        M12.LIZ(sym);
        if (!a.LJIILL().LJ()) {
            LIZIZ();
            PgU LIZ2 = 2WS.LIZ(SuggestWordsApi.LIZJ(sym));
            PqJ pqJ = new PqJ(new C3369SVp(this), (Ls2) null, new C3372SVs(this), 2);
            this.LIZIZ = pqJ;
            LIZ2.LIZIZ(pqJ);
        }
    }
}
