package com.ss.android.ugc.aweme.notification.vm;

import X.0Bt;
import X.2Pr;
import X.2cN;
import X.2ce;
import X.2ex;
import X.2ey;
import X.2ez;
import X.2f0;
import X.2f1;
import X.4Dd;
import X.7he;
import X.C0295Crj;
import X.C0436Cwu;
import X.C1884Dgu;
import X.C3104E1k;
import X.C3307E9f;
import X.C3315E9n;
import X.C3373EBt;
import X.C4072Eb6;
import X.C4146EcI;
import X.C5020EqO;
import X.C5116Erw;
import X.E93;
import X.E98;
import X.E99;
import X.E9U;
import X.Ls2;
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.notice.repo.list.bean.BaseNotice;
import com.ss.android.ugc.aweme.notification.api.NotificationApi;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import kotlin.h.b.n;

public class BaseNotificationVM extends 0Bt {
    public static final C3315E9n LJIIIZ = new C3315E9n((byte) 0);
    public final C0295Crj LIZ = 7he.LIZ(2f0.LIZ);
    public final C0295Crj LIZIZ = 7he.LIZ(E9U.LIZ);
    public final C0295Crj LIZJ = 7he.LIZ(2ex.LIZ);
    public final C0295Crj LIZLLL = 7he.LIZ(C1884Dgu.LIZ);
    public final C0295Crj LJ = 7he.LIZ(2ez.LIZ);
    public final C0295Crj LJFF = 7he.LIZ(2ey.LIZ);
    public String LJI = "message";
    public boolean LJII;
    public final C0295Crj LJIIIIZZ = 7he.LIZ(2f1.LIZ);

    static {
        Covode.recordClassIndex(96067);
    }

    private final 2ce<C3307E9f> LIZ() {
        return (2ce) this.LIZIZ.getValue();
    }

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

    public final 2ce<C0436Cwu<Integer, Integer>> LJIIIIZZ() {
        return (2ce) this.LIZJ.getValue();
    }

    public final CopyOnWriteArraySet<String> LJIIIZ() {
        return (CopyOnWriteArraySet) this.LIZLLL.getValue();
    }

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

    public final Set<String> LJIILIIL() {
        return (Set) this.LJFF.getValue();
    }

    public E93 LJIILJJIL() {
        return E93.GONE;
    }

    public final void LJIIL() {
        LJIIIZ().clear();
    }

    public final String LJII() {
        return C3373EBt.LIZ.LIZ(Integer.valueOf(LJI()));
    }

    public final C3307E9f LJIIJJI() {
        return (C3307E9f) LIZ().getValue();
    }

    public void onCleared() {
        BaseNotificationVM.super.onCleared();
        LJFF().LIZ();
    }

    public final int LJI() {
        C3307E9f e9f = (C3307E9f) LIZ().getValue();
        if (e9f != null) {
            return e9f.LIZ;
        }
        return C3104E1k.LIZ.LIZ();
    }

    public final boolean LJIILL() {
        if (LJI() != C3104E1k.LIZ.LIZ() || !C5020EqO.LIZ.LIZJ()) {
            return false;
        }
        return true;
    }

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

    public final void LIZ(C3307E9f e9f) {
        M12.LIZ(e9f);
        int LJI2 = LJI();
        LIZ().setValue(e9f);
        if (LJI2 != LJI()) {
            LJIIIIZZ().setValue(new C0436Cwu(Integer.valueOf(LJI2), Integer.valueOf(LJI())));
        }
    }

    public final void LIZ(int i) {
        if (i == C3104E1k.LIZ.LIZ()) {
            C5116Erw.LIZ(C4072Eb6.Normal, 13, 1000, C3104E1k.LIZ.LIZ(), 3, 44, 84, 26, 37);
            2Pr r1 = 2Pr.LIZ;
            if ((!C4146EcI.LIZ.LIZIZ()) && r1 != null) {
                C5116Erw.LIZLLL(260);
                return;
            }
            return;
        }
        C5116Erw.LIZ(C4072Eb6.Normal, i);
    }

    public final void LIZ(BaseNotice baseNotice) {
        M12.LIZ(baseNotice);
        2cN LIZ2 = NotificationApi.LIZ.LIZ().deleteNotice(baseNotice.nid).LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new E98(baseNotice), new E99(baseNotice));
        n.LIZIZ(LIZ2, "");
        4Dd.LIZ(LIZ2, LJFF());
    }

    public final void LIZ(BaseNotice baseNotice, Ls2<2Pr> ls2) {
        String str;
        M12.LIZ(ls2);
        if (baseNotice != null && (str = baseNotice.nid) != null && str.length() != 0 && !LJIIIZ().contains(baseNotice.nid)) {
            LJIIIZ().add(baseNotice.nid);
            ls2.invoke();
        }
    }
}
