package com.bytedance.android.livesdk.feed.viewmodel;

import X.0UK;
import X.0Uf;
import X.0Un;
import X.0cE;
import X.1Bn;
import X.C3728Gwz;
import X.C3748GxJ;
import X.C3749GxK;
import X.C3761GxW;
import X.C3763GxY;
import X.C3764GxZ;
import X.C3765Gxa;
import X.C3766Gxb;
import X.C3767Gxc;
import X.C3771Gxg;
import X.C3785Gxu;
import X.C3797Gy6;
import X.C3798Gy7;
import X.C3819GyS;
import X.C3820GyT;
import X.C3821GyU;
import X.C3822GyV;
import X.C3825GyY;
import X.Mk2;
import X.Mk3;
import android.text.TextUtils;
import com.bytedance.android.live.base.model.ImageModel;
import com.bytedance.android.live.core.paging.viewmodel.PagingViewModel;
import com.bytedance.android.livesdk.feed.feed.FeedDataKey;
import com.bytedance.android.livesdk.feed.repository.BaseFeedRepository;
import com.bytedance.android.livesdk.model.FeedItem;
import com.bytedance.covode.number.Covode;
import java.util.List;

public class BaseFeedDataViewModel extends PagingViewModel<FeedItem> {
    public C3728Gwz LIZ;
    public 1Bn<Integer> LJIIIIZZ = new 1Bn<>();
    public 1Bn<0Uf> LJIIIZ = new 1Bn<>();
    public 1Bn<Integer> LJIIJ = new 1Bn<>();
    public 1Bn<Integer> LJIIJJI = new 1Bn<>();
    public 1Bn<List<ImageModel>> LJIIL = new 1Bn<>();
    public 1Bn<C3748GxJ> LJIILIIL = new 1Bn<>();
    public 1Bn<C3748GxJ> LJIILJJIL = new 1Bn<>();
    public 0cE<FeedItem> LJIILL;
    public String LJIILLIIL;
    public int LJIIZILJ;
    public int LJIJ;
    public String LJIJI;
    public FeedDataKey LJIJJ;
    public 1Bn<0Un> LJIJJLI = new 1Bn<>();
    public C3797Gy6<0cE<FeedItem>, C3761GxW> LJIL;
    public C3761GxW LJJ;
    public C3825GyY LJJI;
    public long LJJIFFI;

    static {
        Covode.recordClassIndex(16216);
    }

    public boolean LJI() {
        return false;
    }

    public String LIZLLL() {
        return this.LJIILLIIL;
    }

    public final FeedDataKey LJ() {
        if (this.LJIJJ == null) {
            this.LJIJJ = LJFF();
        }
        return this.LJIJJ;
    }

    public FeedDataKey LJFF() {
        return FeedDataKey.LIZ(this.LJIJI, LIZLLL(), this.LJJIFFI);
    }

    public final boolean LIZ() {
        boolean LIZ2 = BaseFeedDataViewModel.super.LIZ();
        if (LIZ2) {
            this.LJIIIIZZ.setValue(0);
            0UK.LJII.LIZLLL();
        }
        return LIZ2;
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.bytedance.android.live.core.paging.viewmodel.PagingViewModel, com.bytedance.android.livesdk.util.rxutils.RxViewModel, com.bytedance.android.livesdk.feed.viewmodel.BaseFeedDataViewModel] */
    public void LIZJ() {
        try {
            C3797Gy6<0cE<FeedItem>, C3761GxW> LIZ2 = this.LIZ.LIZ(LIZLLL());
            this.LJIL = LIZ2;
            this.LJIILL = (0cE) LIZ2.LIZ;
            C3761GxW gxW = (C3761GxW) this.LJIL.LIZIZ;
            this.LJJ = gxW;
            gxW.LIZ.observeForever(new C3763GxY(this));
            this.LJJ.LIZIZ.observeForever(new C3764GxZ(this));
            LIZ(this.LJIILL);
            this.LJIILJJIL.observeForever(new C3749GxK(this));
            LIZ(this.LIZ.LIZ().LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new C3785Gxu(this), C3819GyS.LIZ));
            LIZ(this.LIZ.LIZIZ().LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new C3765Gxa(this), C3820GyT.LIZ));
            C3728Gwz gwz = this.LIZ;
            if (gwz instanceof BaseFeedRepository) {
                LIZ(((BaseFeedRepository) gwz).LIZJ.LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new C3766Gxb(this), C3821GyU.LIZ));
                LIZ(((BaseFeedRepository) this.LIZ).LIZLLL.LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new C3767Gxc(this), C3822GyV.LIZ));
            }
        } catch (Exception unused) {
        }
    }

    public final boolean LIZ(String str) {
        this.LIZ.LIZ(str, (String) null);
        LIZIZ(str);
        return LIZ();
    }

    public final void LIZIZ(String str) {
        if (!TextUtils.isEmpty(str) && !TextUtils.equals(str, "enter_auto") && !TextUtils.equals(str, "detail_loadmore") && this.LJJI.LIZ()) {
            Integer num = (Integer) this.LJIIJ.getValue();
            if (num == null) {
                this.LJIIJ.setValue(1);
            } else {
                this.LJIIJ.setValue(Integer.valueOf(num.intValue() + 1));
            }
        }
    }

    public BaseFeedDataViewModel(C3728Gwz gwz, C3798Gy7 gy7, C3825GyY gyY) {
        this.LIZ = gwz;
        if (gy7 != null) {
            this.LJIILLIIL = gy7.LIZ();
            this.LJIIZILJ = 10;
            this.LJIJ = gy7.LIZJ();
            this.LJIJI = gy7.LIZIZ();
            this.LJJI = gyY;
            this.LJJIFFI = 0;
            this.LIZ.LIZ((C3771Gxg) new C3771Gxg() {
                static {
                    Covode.recordClassIndex(16217);
                }

                public final FeedDataKey LIZ() {
                    return BaseFeedDataViewModel.this.LJ();
                }

                public final int LIZIZ() {
                    return BaseFeedDataViewModel.this.LJIIZILJ;
                }

                public final int LIZJ() {
                    return BaseFeedDataViewModel.this.LJIJ;
                }
            });
        }
    }
}
