package com.ss.android.ugc.aweme.social.widget.card.rec.vm;

import X.0Bt;
import X.0Gp;
import X.2ce;
import X.2nK;
import X.4Dk;
import X.8pz;
import X.AnS;
import X.AnT;
import X.C3072JKd;
import X.C3080JKl;
import X.Cv9;
import X.CwZ;
import X.Cwu;
import X.DAg;
import X.DAj;
import X.E3n;
import X.E4U;
import X.EMR;
import X.EMo;
import X.EMt;
import X.LWw;
import X.M12;
import androidx.lifecycle.LiveData;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.im.service.model.IMUser;
import com.ss.android.ugc.aweme.profile.model.User;
import com.ss.android.ugc.aweme.userservice.UserService;
import com.ss.android.ugc.aweme.userservice.api.IUserService;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CancellationException;
import kotlin.h.b.n;

public final class SelectedCardVM extends 0Bt {
    public String LIZ = "";
    public String LIZIZ = "";
    public E4U LIZJ;
    public boolean LIZLLL;
    public final Cv9 LJ;
    public final IUserService LJFF;
    public final 2ce<List<C3080JKl>> LJI;
    public final LiveData<List<C3080JKl>> LJII;
    public final 2ce<Integer> LJIIIIZZ;
    public final LiveData<Integer> LJIIIZ;
    public final 2ce<List<IMUser>> LJIIJ;
    public final LiveData<List<IMUser>> LJIIJJI;
    public final 2ce<Boolean> LJIIL;
    public final LiveData<Boolean> LJIILIIL;
    public final Set<String> LJIILJJIL;
    public final 4Dk LJIILL;

    static {
        Covode.recordClassIndex(114849);
    }

    public final void onCleared() {
        SelectedCardVM.super.onCleared();
        this.LJIILL.LIZ((CancellationException) null);
    }

    public SelectedCardVM() {
        4Dk LIZ2 = DAg.LIZ();
        this.LJIILL = LIZ2;
        this.LJ = DAj.LIZ(8pz.LIZIZ.plus(LIZ2));
        this.LJFF = UserService.LIZLLL();
        2ce<List<C3080JKl>> r0 = new 2ce<>();
        this.LJI = r0;
        this.LJII = r0;
        2ce<Integer> r02 = new 2ce<>();
        this.LJIIIIZZ = r02;
        this.LJIIIZ = r02;
        2ce<List<IMUser>> r03 = new 2ce<>();
        this.LJIIJ = r03;
        this.LJIIJJI = r03;
        2ce<Boolean> r04 = new 2ce<>();
        this.LJIIL = r04;
        this.LJIILIIL = r04;
        this.LJIILJJIL = new LinkedHashSet();
    }

    public final void LIZIZ(List<? extends User> list) {
        EMo LIZ2 = EMt.LIZ.LIZJ().LIZ("source_default_key", EMR.class);
        if (LIZ2 != null) {
            LIZ2.LIZ(new C3072JKd(list));
        }
    }

    public final void LIZ(List<? extends User> list) {
        for (User user : list) {
            String str = this.LIZ;
            String str2 = this.LIZIZ;
            M12.LIZ(user, str, str2);
            0Gp.LIZ(new AnT(user, str, str2));
            AnS.LIZ.LIZ(user, this.LIZ, this.LIZIZ, E3n.FOLLOW, this.LIZJ);
        }
    }

    public final void LIZ(String str) {
        int i;
        String str2 = this.LIZ;
        List list = (List) this.LJII.getValue();
        if (list != null) {
            i = list.size();
        } else {
            i = 0;
        }
        Integer num = (Integer) this.LJIIIZ.getValue();
        if (num == null) {
            num = 0;
        }
        n.LIZIZ(num, "");
        int intValue = num.intValue();
        M12.LIZ(str2, str);
        2nK.LIZ("send_message_pop_up", LWw.LIZ(new Cwu[]{CwZ.LIZ("enter_from", str2), CwZ.LIZ("action_type", str), CwZ.LIZ("user_show_num", String.valueOf(i)), CwZ.LIZ("user_select_num", String.valueOf(intValue))}));
    }
}
