package com.ss.android.ugc.aweme.relation.usercard.vm;

import X.2Pr;
import X.AnK;
import X.AnM;
import X.AnO;
import X.Ar5;
import X.C1371DWt;
import X.C1377DWz;
import X.C1380DXc;
import X.C1590DcA;
import X.C3157E3l;
import X.C3159E3n;
import X.DW9;
import X.DX3;
import X.DX4;
import X.DXC;
import X.DXH;
import X.DXO;
import X.DXP;
import X.DXQ;
import X.E4U;
import X.E4X;
import X.LsC;
import X.M12;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.profile.model.User;
import com.ss.android.ugc.aweme.relation.base.list.cell.BaseCellVM;
import java.util.Map;
import java.util.Set;
import kotlin.h.b.n;

public final class RecUserCellVM extends BaseCellVM<DW9, RelationUserCardListVM> {
    public final C1590DcA recImprReporter = Ar5.LIZ;

    static {
        Covode.recordClassIndex(103554);
    }

    public final E4U getSceneType() {
        return (E4U) ((RelationUserCardListVM) getListVM()).LIZ(DXP.LIZ);
    }

    public final void onCleared() {
        RecUserCellVM.super.onCleared();
        this.recImprReporter.LIZJ();
    }

    private final Map<String, String> getTrackerMap() {
        return C1371DWt.LIZ(((RelationUserCardListVM) getListVM()).LJIILIIL.getTrackerConfig());
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public RecUserCellVM(RelationUserCardListVM relationUserCardListVM) {
        super(relationUserCardListVM);
        M12.LIZ(relationUserCardListVM);
    }

    public final void onClickCover(DW9 dw9) {
        M12.LIZ(dw9);
        ((RelationUserCardListVM) getListVM()).LIZ(new DXO(this, dw9));
    }

    private final void trackRemove(C1380DXc dXc) {
        Map<String, String> trackerMap = getTrackerMap();
        String str = trackerMap.get("enter_from");
        if (str == null) {
            str = "";
        }
        C1380DXc dXc2 = dXc;
        new AnO(str, dXc2, trackerMap.get("enter_method"), trackerMap.get("previous_page"), trackerMap.get("homepage_uid"), Integer.valueOf(dXc2.getImprOrder())).LIZJ();
        postFollowRecommend(trackerMap, dXc2, getSceneType(), C3159E3n.CLOSE);
    }

    public final void trackShow(C1380DXc dXc) {
        Map<String, String> trackerMap = getTrackerMap();
        String str = trackerMap.get("enter_from");
        if (str == null) {
            str = "";
        }
        C1380DXc dXc2 = dXc;
        new AnM(str, dXc2, trackerMap.get("enter_method"), trackerMap.get("previous_page"), trackerMap.get("homepage_uid"), Integer.valueOf(dXc2.getImprOrder())).LIZJ();
        postFollowRecommend(trackerMap, dXc2, getSceneType(), C3159E3n.SHOW);
    }

    public final Map<String, String> onEnterProfile(int i, DW9 dw9) {
        M12.LIZ(dw9);
        Map<String, String> trackerMap = getTrackerMap();
        trackEnterProfile(trackerMap, dw9.LIZ);
        ((RelationUserCardListVM) getListVM()).LIZIZ((LsC<? super C1377DWz, 2Pr>) new DX3(dw9, i));
        return trackerMap;
    }

    private final void trackEnterProfile(Map<String, String> map, C1380DXc dXc) {
        String str = map.get("enter_from");
        if (str == null) {
            str = "";
        }
        C1380DXc dXc2 = dXc;
        new AnK(str, dXc2, map.get("enter_method"), map.get("previous_page"), map.get("homepage_uid"), Integer.valueOf(dXc2.getImprOrder())).LIZJ();
        postFollowRecommend(map, dXc2, getSceneType(), C3159E3n.ENTER_PROFILE);
    }

    public final void remove(int i, DW9 dw9) {
        M12.LIZ(dw9);
        super.remove(i, dw9);
        trackRemove(dw9.LIZ);
        ((RelationUserCardListVM) getListVM()).LIZ(i);
        ((RelationUserCardListVM) getListVM()).LIZIZ((LsC<? super C1377DWz, 2Pr>) new DX4(dw9, i));
    }

    public final void onShow(int i, DW9 dw9) {
        M12.LIZ(dw9);
        super.onShow(i, dw9);
        C1380DXc dXc = dw9.LIZ;
        String uid = dXc.getUid();
        if (!getListVM().LIZ.contains(uid)) {
            Set<String> set = getListVM().LIZ;
            n.LIZIZ(uid, "");
            set.add(uid);
            ((RelationUserCardListVM) getListVM()).LJIILLIIL.LIZIZ();
            ((RelationUserCardListVM) getListVM()).LJIILLIIL.LIZIZ(new DXQ(this, uid, dXc));
            ((RelationUserCardListVM) getListVM()).LIZIZ((LsC<? super C1377DWz, 2Pr>) new DXC(dXc, i));
        }
    }

    public final void onFollowClick(int i, DW9 dw9, E4X e4x) {
        M12.LIZ(dw9, e4x);
        ((RelationUserCardListVM) getListVM()).LIZIZ((LsC<? super C1377DWz, 2Pr>) new DXH(e4x, dw9, i));
    }

    public final void postFollowRecommend(Map<String, String> map, User user, E4U e4u, C3159E3n e3n) {
        C3157E3l e3l = new C3157E3l();
        String str = map.get("enter_from");
        if (str == null) {
            str = "";
        }
        e3l.LIZ(str);
        e3l.LJIILL(map.get("enter_method"));
        e3l.LJIIZILJ(map.get("previous_page"));
        e3l.LJIJJLI(map.get("homepage_uid"));
        e3l.LJIILLIIL(map.get("position"));
        e3l.LIZ = e4u;
        e3l.LIZIZ = e3n;
        e3l.LIZ(user);
        e3l.LJFF();
    }
}
