package com.ss.android.ugc.aweme.search.preload;

import X.0Gp;
import X.8gI;
import X.9Y3;
import X.C3976LcV;
import X.C4036LdT;
import X.C4051Ldi;
import X.C4052Ldj;
import X.C4056Ldn;
import X.FLu;
import X.IUt;
import X.JvD;
import X.JvE;
import X.M12;
import X.PUt;
import X.SV0;
import X.SYh;
import android.content.Context;
import com.bytedance.covode.number.Covode;

public final class ForecastLoader implements C4052Ldj<C4051Ldi> {
    public static final JvE LIZJ = new JvE((byte) 0);
    public boolean LIZ;
    public C4051Ldi LIZIZ;
    public final int LIZLLL = 4;

    public interface Api {
        public static final C4056Ldn LIZ = C4056Ldn.LIZIZ;

        static {
            Covode.recordClassIndex(104494);
        }

        @IUt(LIZ = "/aweme/v1/search/forecast/")
        @FLu(LIZ = 3)
        0Gp<C3976LcV> fetchSchema(@PUt(LIZ = "keyword") String str, @PUt(LIZ = "count") int i);
    }

    static {
        Covode.recordClassIndex(104493);
    }

    public final void LIZLLL() {
        this.LIZIZ = null;
    }

    public final /* bridge */ /* synthetic */ C4036LdT LIZJ() {
        return this.LIZIZ;
    }

    public final Integer LIZIZ() {
        return Integer.valueOf(this.LIZLLL);
    }

    public final void LIZ(Context context, SV0 sv0) {
        String keyword;
        M12.LIZ((Object) context);
        if (9Y3.LIZ(9Y3.LIZ(), true, "prefetch_lynx_scheme", true)) {
            SYh LIZ2 = 8gI.LIZIZ.LIZ();
            if ((LIZ2 == null || LIZ2.LIZ() == 0) && sv0 != null && (keyword = sv0.getKeyword()) != null && keyword.length() > 0 && !this.LIZ) {
                0Gp<C3976LcV> fetchSchema = C4056Ldn.LIZ.fetchSchema(keyword, 1);
                this.LIZIZ = new C4051Ldi(fetchSchema);
                fetchSchema.LIZ(new JvD(this));
            }
        }
    }
}
