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

import X.0Bt;
import X.0CH;
import X.1hK;
import X.2cN;
import X.2ce;
import X.4Dd;
import X.7he;
import X.A5K;
import X.A5L;
import X.A5M;
import X.A5N;
import X.A5R;
import X.A5U;
import X.A5V;
import X.A5W;
import X.A5X;
import X.A5Y;
import X.C1393AbV;
import X.Crj;
import X.Cwu;
import X.DaU;
import X.M12;
import X.Mjy;
import X.Mk2;
import X.Mk3;
import X.PhE;
import X.PlI;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.arch.widgets.base.DataCenter;
import com.ss.android.ugc.aweme.comment.adapter.LikeLoadMoreCell;
import com.ss.android.ugc.aweme.comment.api.VideoViewerHistoryApiService;
import com.ss.android.ugc.aweme.comment.model.ViewerListResponse;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import kotlin.h.b.n;

public final class VideoViewerListVM extends 0Bt {
    public static final A5R LJ = new A5R((byte) 0);
    public BubbleVideoViewerViewModel LIZ;
    public Aweme LIZIZ;
    public String LIZJ = "";
    public final DaU<Long> LIZLLL;
    public final Crj LJFF = 7he.LIZ(A5Y.LIZ);
    public final Crj LJI = 7he.LIZ(A5X.LIZ);
    public final Crj LJII = 7he.LIZ(A5W.LIZ);
    public final Crj LJIIIIZZ = 7he.LIZ(A5V.LIZ);
    public final Crj LJIIIZ = 7he.LIZ(A5U.LIZ);

    static {
        Covode.recordClassIndex(57654);
    }

    public final Mjy LIZ() {
        return (Mjy) this.LJFF.getValue();
    }

    public final Set<String> LIZLLL() {
        return (Set) this.LJI.getValue();
    }

    public final 2ce<Boolean> LJ() {
        return (2ce) this.LJII.getValue();
    }

    public final Map<String, Long> LJFF() {
        return (Map) this.LJIIIIZZ.getValue();
    }

    public final 2ce<Cwu<String, Long>> LJI() {
        return (2ce) this.LJIIIZ.getValue();
    }

    public final BubbleVideoViewerViewModel LIZIZ() {
        BubbleVideoViewerViewModel bubbleVideoViewerViewModel = this.LIZ;
        if (bubbleVideoViewerViewModel == null) {
            n.LIZ("");
        }
        return bubbleVideoViewerViewModel;
    }

    public final String LIZJ() {
        String aid;
        Aweme aweme = this.LIZIZ;
        if (aweme == null || (aid = aweme.getAid()) == null) {
            return "";
        }
        return aid;
    }

    public final void onCleared() {
        VideoViewerListVM.super.onCleared();
        LIZ().LIZ();
    }

    public VideoViewerListVM() {
        C1393AbV abV = new C1393AbV();
        abV.LIZIZ = true;
        abV.LIZ = 10;
        abV.LIZ(LikeLoadMoreCell.class);
        this.LIZLLL = new A5N(this, abV);
    }

    public final void LIZ(String str) {
        M12.LIZ(str);
        this.LIZJ = str;
    }

    public final void LIZ(1hK r2) {
        if (this.LIZ == null) {
            this.LIZ = new BubbleVideoViewerViewModel(this, r2);
        }
    }

    public static final class BubbleVideoViewerViewModel extends DataCenter {
        public static final A5M LIZJ = new A5M((byte) 0);
        public final ConcurrentHashMap<String, ViewerListResponse> LIZLLL = new ConcurrentHashMap<>();
        public final VideoViewerListVM LJ;

        static {
            Covode.recordClassIndex(57655);
        }

        public BubbleVideoViewerViewModel(VideoViewerListVM videoViewerListVM, 0CH r3) {
            M12.LIZ(videoViewerListVM, r3);
            this.LJ = videoViewerListVM;
            this.LIZ = r3;
        }

        public final void LIZ(String str, long j, int i) {
            boolean z;
            String str2 = str;
            M12.LIZ(str2);
            long j2 = j;
            if (j2 == 0) {
                z = true;
            } else {
                z = false;
            }
            int i2 = i;
            2cN LIZ = VideoViewerHistoryApiService.LIZ.fetchVideoViewerHistory(str2, j2, 30, i2).LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new A5K(this, z, i2, str2), new A5L(this, z, i2, str2));
            n.LIZIZ(LIZ, "");
            4Dd.LIZ(LIZ, this.LJ.LIZ());
        }
    }
}
