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

import X.0Bt;
import X.1Bn;
import X.2Pr;
import X.2cN;
import X.2ce;
import X.4Dd;
import X.4Dk;
import X.4QO;
import X.4r1;
import X.7AW;
import X.7he;
import X.8pz;
import X.9HM;
import X.A4l;
import X.A4n;
import X.AbV;
import X.AnS;
import X.Ar5;
import X.BaM;
import X.C0295Crj;
import X.C0436Cwu;
import X.C0746D8s;
import X.C0782DAc;
import X.C0786DAg;
import X.C0789DAj;
import X.C0849DCr;
import X.C1481DaP;
import X.C1486DaU;
import X.C1580Dc0;
import X.C1588Dc8;
import X.C1595DcF;
import X.C1930Dhe;
import X.C1953Di1;
import X.C1976DiO;
import X.C1977DiP;
import X.C1978DiQ;
import X.C1979DiR;
import X.C1980DiS;
import X.C1981DiT;
import X.C1983DiV;
import X.C1984DiW;
import X.C1985DiX;
import X.C1987DiZ;
import X.C1990Dic;
import X.C1991Did;
import X.C1992Die;
import X.C1993Dif;
import X.C1994Dig;
import X.C1995Dih;
import X.C2001Din;
import X.C2002Dio;
import X.C2003Dip;
import X.C2004Diq;
import X.C2005Dir;
import X.C2006Dis;
import X.C2007Dit;
import X.C2009Div;
import X.C2020Dj6;
import X.C2024DjA;
import X.C2031DjH;
import X.C4003EZz;
import X.Cv9;
import X.CwZ;
import X.D1H;
import X.DAU;
import X.DBT;
import X.DXK;
import X.Lea;
import X.Lel;
import X.LsD;
import X.M12;
import X.Mjy;
import androidx.lifecycle.LiveData;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.profile.model.User;
import com.ss.android.ugc.aweme.tux.business.powerlist.LoadingFooterCell;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CancellationException;
import kotlin.h.b.n;

public class SocialCardVM extends 0Bt {
    public final Cv9 LIZ;
    public final Mjy LIZIZ = new Mjy();
    public C2006Dis LIZJ;
    public final C2004Diq LIZLLL;
    public final C2009Div LJ;
    public final C1990Dic LJFF;
    public final Map<String, String> LJI;
    public int LJII;
    public int LJIIIIZZ;
    public final Set<String> LJIIIZ;
    public final Set<String> LJIIJ;
    public List<? extends C1481DaP> LJIIJJI;
    public List<? extends C1481DaP> LJIIL;
    public final LiveData<List<C1481DaP>> LJIILIIL;
    public final LiveData<Integer> LJIILJJIL;
    public final 2ce<C0436Cwu<Boolean, Integer>> LJIILL;
    public final LiveData<C0436Cwu<Boolean, Integer>> LJIILLIIL;
    public final LiveData<Integer> LJIIZILJ;
    public final 1Bn<C1983DiV> LJIJ;
    public final LiveData<C1983DiV> LJIJI;
    public final LiveData<Boolean> LJIJJ;
    public final C1995Dih LJIJJLI;
    public final 4Dk LJIL;
    public final C0295Crj LJJ = 7he.LIZ(new C2031DjH(this));
    public final C2024DjA LJJI;
    public final List<D1H> LJJIFFI;
    public AbV LJJII;
    public final C0295Crj LJJIII;
    public List<? extends C1481DaP> LJJIIJ;
    public final List<C1481DaP> LJJIIJZLJL;
    public final 2ce<List<C1481DaP>> LJJIIZ;
    public final 2ce<Integer> LJJIIZI;
    public final 2ce<Integer> LJJIJ;
    public final 2ce<Boolean> LJJIJIIJI;
    public final String LJJIJIIJIL;

    static {
        Covode.recordClassIndex(114853);
    }

    public final C2007Dit LIZ() {
        return (C2007Dit) this.LJJ.getValue();
    }

    public final DXK LIZIZ() {
        return (DXK) this.LJJIII.getValue();
    }

    public final boolean LIZ(User user) {
        if (this.LJIIIZ.contains(user.getUid())) {
            return false;
        }
        Set<String> set = this.LJIIIZ;
        String uid = user.getUid();
        n.LIZIZ(uid, "");
        set.add(uid);
        return true;
    }

    public final void LIZ(C1953Di1 di1) {
        M12.LIZ(di1);
        C1990Dic dic = this.LJFF;
        if (dic != null) {
            dic.LIZ(di1.LIZ);
        }
        List list = (List) this.LJIILIIL.getValue();
        this.LJJIIZI.postValue(list != null ? Integer.valueOf(list.indexOf(di1)) : null);
    }

    public final void LIZ(Integer num, Integer num2) {
        if (num != null) {
            int intValue = num.intValue();
            int i = this.LJII;
            if (intValue >= 0 && i > intValue) {
                this.LJII = num.intValue();
            }
        }
        if (num2 != null) {
            int intValue2 = num2.intValue();
            int i2 = this.LJIIIIZZ;
            if (intValue2 >= 0 && i2 > intValue2 && i2 > 0) {
                this.LJIIIIZZ = num2.intValue();
            }
        }
    }

    public final void LIZ(C1481DaP daP) {
        M12.LIZ(daP);
        if (daP instanceof C1983DiV) {
            C1983DiV diV = (C1983DiV) daP;
            String name = diV.LIZ.name();
            if (!this.LJIIJ.contains(name)) {
                this.LJIIJ.add(name);
                LIZIZ().LIZ(diV.LIZ);
                C1977DiP.LIZ.LIZ(diV.LIZ, this.LJI);
            }
        } else if (daP instanceof C1953Di1) {
            C1953Di1 di1 = (C1953Di1) daP;
            User user = di1.LIZ;
            if (!this.LJIIJ.contains(user.getUid()) && user.isShould_write_impr()) {
                Set<String> set = this.LJIIJ;
                String uid = user.getUid();
                n.LIZIZ(uid, "");
                set.add(uid);
                if (user.isShould_write_impr()) {
                    Ar5.LIZ.LIZ(1, user.getUid());
                }
                AnS.LIZ.LIZIZ(di1.LIZ, this.LJJIIJZLJL.indexOf(daP), this.LJI);
            }
        } else if ((daP instanceof C1987DiZ) && !this.LJIIJ.contains(this.LJJIJIIJIL)) {
            this.LJIIJ.add(this.LJJIJIIJIL);
            AnS.LIZ.LIZ(this.LJI);
        }
    }

    public final void LIZ(C1983DiV diV, String str) {
        C1983DiV diV2 = diV;
        String str2 = str;
        M12.LIZ(diV2, str2);
        C2009Div div = this.LJ;
        boolean z = div != null ? div.LIZIZ : false;
        C2009Div div2 = this.LJ;
        boolean z2 = div2 != null ? div2.LIZJ : false;
        List LJII2 = Lea.LJII(this.LJIIL);
        List LJII3 = Lea.LJII(this.LJJIIJ);
        int indexOf = LJII2.indexOf(diV2);
        int size = LJII2.size();
        if (indexOf >= 0 && size > indexOf) {
            if (!z || !n.LIZ(str2, "click")) {
                LJII2.remove(indexOf);
                C1990Dic dic = this.LJFF;
                if (dic != null) {
                    C1976DiO.LIZ(dic, diV2.LIZ, C1930Dhe.ON_AUTHORIZE, (List) null, str2, 4);
                }
                LIZ(this, (List) null, LJII2, (List) null, false, 13);
                return;
            }
            DBT unused = C0782DAc.LIZ(this.LIZ, (C0746D8s) null, (DAU) null, new C1992Die(this, diV2, LJII2, indexOf, z2, LJII3, str2, (4r1) null), 3);
        }
    }

    public final void LIZ(C1595DcF dcF) {
        C1595DcF dcF2 = dcF;
        M12.LIZ(dcF2);
        DBT unused = C0782DAc.LIZ(this.LIZ, (C0746D8s) null, (DAU) null, new C1993Dif(this, dcF2, this.LIZLLL != null, Lea.LJII(this.LJJIIJ), (4r1) null), 3);
    }

    public final C1486DaU<Integer> LIZJ() {
        AbV abV = this.LJJII;
        if (abV == null) {
            n.LIZ("");
        }
        return new 4QO(this, abV);
    }

    public void onCleared() {
        SocialCardVM.super.onCleared();
        this.LJIL.LIZ((CancellationException) null);
        this.LIZIZ.dispose();
    }

    private final void LJ() {
        C1980DiS diS;
        C1990Dic dic = this.LJFF;
        if (dic != null) {
            dic.LIZLLL(this.LJJIIJZLJL.size());
        }
        if (this.LJJIIJZLJL.isEmpty()) {
            this.LJJIJIIJI.postValue(false);
        } else {
            this.LJJIJIIJI.postValue(true);
            if (this.LIZJ != null) {
                C2006Dis dis = this.LIZJ;
                if (dis == null) {
                    n.LIZ("");
                }
                if (dis.LIZ()) {
                    C2024DjA djA = this.LJJI;
                    if (djA != null) {
                        List<C1481DaP> list = this.LJJIIJZLJL;
                        boolean z = djA.LIZ;
                        C2004Diq diq = this.LIZLLL;
                        if (diq == null || (diS = diq.LJFF) == null) {
                            diS = C1980DiS.NORMAL;
                        }
                        list.add(new C1987DiZ(z, diS));
                    }
                    List<D1H> list2 = this.LJJIFFI;
                    if (list2 != null) {
                        for (D1H d1h : list2) {
                            this.LJJIIJZLJL.add(d1h.LIZ);
                        }
                    }
                }
            }
        }
        this.LJJIIZ.postValue(this.LJJIIJZLJL);
    }

    private final void LIZLLL() {
        List<C1983DiV> list;
        boolean z;
        int i;
        int i2;
        Map<C1595DcF, C1981DiT> map;
        Object diX;
        boolean z2;
        DXK LIZIZ2 = LIZIZ();
        boolean z3 = false;
        for (C1595DcF dcF : C1595DcF.values()) {
            Boolean bool = LIZIZ2.LIZLLL.get(dcF);
            if (C1978DiQ.LIZIZ(dcF) || !LIZIZ2.LIZJ(dcF)) {
                z2 = false;
            } else {
                z2 = true;
            }
            if (bool != null && (!n.LIZ(bool, Boolean.valueOf(z2)))) {
                LIZIZ2.LIZLLL.put(dcF, Boolean.valueOf(z2));
                z3 = true;
            }
        }
        if (z3) {
            Iterator<T> it = LIZIZ2.LIZJ.iterator();
            while (it.hasNext()) {
                ((BaM) it.next()).get();
            }
        }
        C2009Div div = this.LJ;
        if (div != null) {
            Set<C1595DcF> keySet = div.LIZ.keySet();
            ArrayList arrayList = new ArrayList();
            for (T next : keySet) {
                Boolean bool2 = LIZIZ().LIZLLL.get(next);
                if (bool2 != null && bool2.booleanValue()) {
                    arrayList.add(next);
                }
            }
            List<C1595DcF> list2 = arrayList;
            ArrayList arrayList2 = new ArrayList(9HM.LIZ(list2, 10));
            for (C1595DcF dcF2 : list2) {
                C1981DiT diT = div.LIZ.get(dcF2);
                if (diT == null) {
                    n.LIZIZ();
                }
                C1981DiT diT2 = diT;
                M12.LIZ(dcF2, diT2);
                int i3 = C1979DiR.LJ[dcF2.ordinal()];
                if (i3 == 1) {
                    diX = new C1985DiX(diT2);
                } else if (i3 == 2) {
                    diX = new C1984DiW(diT2);
                } else {
                    throw new 7AW();
                }
                arrayList2.add(diX);
            }
            list = arrayList2;
        } else {
            list = Lel.INSTANCE;
        }
        ArrayList arrayList3 = new ArrayList(9HM.LIZ(list, 10));
        for (C1983DiV diV : list) {
            arrayList3.add(diV.LIZ);
        }
        if (this.LIZLLL == null) {
            z = true;
        } else {
            z = false;
        }
        LIZ(this, (List) null, list, (List) null, z, 5);
        this.LIZIZ.LIZ();
        2cN LIZLLL2 = C4003EZz.LIZ.LIZ(C1580Dc0.CONTACT).LIZIZ().LIZLLL(new C2002Dio(this));
        n.LIZIZ(LIZLLL2, "");
        4Dd.LIZ(LIZLLL2, this.LIZIZ);
        2cN LIZLLL3 = C4003EZz.LIZ.LIZ(C1580Dc0.FACEBOOK).LIZIZ().LIZLLL(new C2003Dip(this));
        n.LIZIZ(LIZLLL3, "");
        4Dd.LIZ(LIZLLL3, this.LIZIZ);
        C2004Diq diq = this.LIZLLL;
        if (diq != null) {
            int i4 = diq.LIZJ;
            C2009Div div2 = this.LJ;
            if (div2 == null || (map = div2.LIZ) == null) {
                i = 0;
            } else {
                i = map.size();
            }
            int size = (i4 - i) - this.LJIIL.size();
            if (this.LJJI != null) {
                i2 = 1;
            } else {
                i2 = 0;
            }
            int i5 = size - i2;
            this.LIZJ = new C2006Dis(Math.min(i5, diq.LIZIZ), i5, false, (String) null, this.LJIJJLI.LIZ, 25);
        } else {
            this.LIZJ = new C2006Dis(0, 0, false, (String) null, 0, 58);
        }
        this.LJJII = new AbV();
        C2004Diq diq2 = this.LIZLLL;
        if (diq2 != null && diq2.LIZ == C1981DiT.RECTANGLE) {
            AbV abV = this.LJJII;
            if (abV == null) {
                n.LIZ("");
            }
            abV.LIZ(LoadingFooterCell.class);
        }
    }

    public static final /* synthetic */ C2006Dis LIZ(SocialCardVM socialCardVM) {
        C2006Dis dis = socialCardVM.LIZJ;
        if (dis == null) {
            n.LIZ("");
        }
        return dis;
    }

    public final int LIZIZ(C1953Di1 di1) {
        M12.LIZ(di1);
        return this.LJIIJJI.indexOf(di1);
    }

    public final Object LIZIZ(4r1<? super C0436Cwu<? extends A4l<Integer>, ? extends List<? extends C1481DaP>>> r4) {
        C2006Dis dis = this.LIZJ;
        if (dis == null) {
            n.LIZ("");
        }
        if (!dis.LIZ()) {
            return C0782DAc.LIZ(C0849DCr.LIZLLL, new C1991Did(this, (4r1) null), r4);
        }
        if (this.LIZJ == null) {
            n.LIZ("");
        }
        return CwZ.LIZ(A4n.LIZ(A4l.LIZ), this.LJIIJJI);
    }

    public final void LIZIZ(C1481DaP daP) {
        M12.LIZ(daP);
        if (daP instanceof C1983DiV) {
            C1983DiV diV = (C1983DiV) daP;
            LIZIZ().LIZIZ(diV.LIZ);
            C1990Dic dic = this.LJFF;
            if (dic != null) {
                C1976DiO.LIZ(dic, diV.LIZ, C1930Dhe.ON_DELETE, (List) null, (String) null, 12);
            }
            C1977DiP.LIZ.LIZIZ(diV.LIZ, this.LJI);
            LIZ(daP, this.LJIIL, new C2020Dj6(this));
        } else if (daP instanceof C1953Di1) {
            if (LIZ(daP, this.LJIIJJI, new C2001Din(this)) == null) {
                LIZ(daP, this.LJJIIJ, new C2005Dir(this));
            }
            AnS.LIZ.LIZ(((C1953Di1) daP).LIZ, this.LJJIIJZLJL.indexOf(daP), this.LJI);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:11:0x0030  */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x0054  */
    /* JADX WARNING: Removed duplicated region for block: B:25:0x006f A[RETURN] */
    /* JADX WARNING: Removed duplicated region for block: B:7:0x001c  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final java.lang.Object LIZJ(X.4r1<? super java.util.List<? extends com.ss.android.ugc.aweme.profile.model.User>> r7) {
        /*
            r6 = this;
            boolean r0 = r7 instanceof X.C2030DjG
            if (r0 == 0) goto L_0x0068
            r4 = r7
            X.DjG r4 = (X.C2030DjG) r4
            int r0 = r4.label
            r1 = -2147483648(0xffffffff80000000, float:-0.0)
            r0 = r0 & r1
            if (r0 == 0) goto L_0x0068
            int r0 = r4.label
            int r0 = r0 - r1
            r4.label = r0
        L_0x0013:
            java.lang.Object r3 = r4.result
            X.Cof r2 = X.C0213Cof.COROUTINE_SUSPENDED
            int r0 = r4.label
            r1 = 1
            if (r0 == 0) goto L_0x0054
            if (r0 != r1) goto L_0x0071
            java.lang.Object r5 = r4.L$0
            com.ss.android.ugc.aweme.social.widget.card.rec.vm.SocialCardVM r5 = (com.ss.android.ugc.aweme.social.widget.card.rec.vm.SocialCardVM) r5
            X.2th.LIZ(r3)
        L_0x0025:
            com.ss.android.ugc.aweme.friends.model.FriendList r3 = (com.ss.android.ugc.aweme.friends.model.FriendList) r3
            r3.checkValid()
            java.util.List r0 = r3.getFriends()
            if (r0 == 0) goto L_0x006f
            java.util.ArrayList r4 = new java.util.ArrayList
            r4.<init>()
            java.util.Iterator r3 = r0.iterator()
        L_0x0039:
            boolean r0 = r3.hasNext()
            if (r0 == 0) goto L_0x006e
            java.lang.Object r2 = r3.next()
            r1 = r2
            com.ss.android.ugc.aweme.friends.model.Friend r1 = (com.ss.android.ugc.aweme.friends.model.Friend) r1
            boolean r0 = r1 instanceof com.ss.android.ugc.aweme.profile.model.User
            if (r0 == 0) goto L_0x0039
            boolean r0 = r5.LIZ((com.ss.android.ugc.aweme.profile.model.User) r1)
            if (r0 == 0) goto L_0x0039
            r4.add(r2)
            goto L_0x0039
        L_0x0054:
            X.2th.LIZ(r3)
            X.Dit r0 = r6.LIZ()
            r4.L$0 = r6
            r4.label = r1
            java.lang.Object r3 = r0.LIZ(r4)
            if (r3 != r2) goto L_0x0066
            return r2
        L_0x0066:
            r5 = r6
            goto L_0x0025
        L_0x0068:
            X.DjG r4 = new X.DjG
            r4.<init>(r6, r7)
            goto L_0x0013
        L_0x006e:
            return r4
        L_0x006f:
            r0 = 0
            return r0
        L_0x0071:
            java.lang.IllegalStateException r1 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r1.<init>(r0)
            throw r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.social.widget.card.rec.vm.SocialCardVM.LIZJ(X.4r1):java.lang.Object");
    }

    /* JADX WARNING: Removed duplicated region for block: B:12:0x003a  */
    /* JADX WARNING: Removed duplicated region for block: B:15:0x004b  */
    /* JADX WARNING: Removed duplicated region for block: B:7:0x001c  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final java.lang.Object LIZLLL(X.4r1<? super java.util.List<? extends com.ss.android.ugc.aweme.profile.model.User>> r6) {
        /*
            r5 = this;
            boolean r0 = r6 instanceof X.C2029DjF
            if (r0 == 0) goto L_0x0063
            r4 = r6
            X.DjF r4 = (X.C2029DjF) r4
            int r0 = r4.label
            r1 = -2147483648(0xffffffff80000000, float:-0.0)
            r0 = r0 & r1
            if (r0 == 0) goto L_0x0063
            int r0 = r4.label
            int r0 = r0 - r1
            r4.label = r0
        L_0x0013:
            java.lang.Object r1 = r4.result
            X.Cof r3 = X.C0213Cof.COROUTINE_SUSPENDED
            int r0 = r4.label
            r2 = 1
            if (r0 == 0) goto L_0x004b
            if (r0 != r2) goto L_0x006a
            java.lang.Object r4 = r4.L$0
            com.ss.android.ugc.aweme.social.widget.card.rec.vm.SocialCardVM r4 = (com.ss.android.ugc.aweme.social.widget.card.rec.vm.SocialCardVM) r4
            X.2th.LIZ(r1)
        L_0x0025:
            X.An5 r1 = (X.An5) r1
            java.util.List r0 = r1.getRegisterItemList()
            java.util.ArrayList r3 = new java.util.ArrayList
            r3.<init>()
            java.util.Iterator r2 = r0.iterator()
        L_0x0034:
            boolean r0 = r2.hasNext()
            if (r0 == 0) goto L_0x0069
            java.lang.Object r1 = r2.next()
            r0 = r1
            X.Bwy r0 = (X.Bwy) r0
            boolean r0 = r4.LIZ((com.ss.android.ugc.aweme.profile.model.User) r0)
            if (r0 == 0) goto L_0x0034
            r3.add(r1)
            goto L_0x0034
        L_0x004b:
            X.2th.LIZ(r1)
            X.EZz r0 = X.C4003EZz.LIZ
            X.An6 r1 = r0.LIZIZ()
            X.EzC r0 = X.C5566EzC.FOLLOWING_LIST
            r4.L$0 = r5
            r4.label = r2
            java.lang.Object r1 = r1.LIZ(r0, r4)
            if (r1 != r3) goto L_0x0061
            return r3
        L_0x0061:
            r4 = r5
            goto L_0x0025
        L_0x0063:
            X.DjF r4 = new X.DjF
            r4.<init>(r5, r6)
            goto L_0x0013
        L_0x0069:
            return r3
        L_0x006a:
            java.lang.IllegalStateException r1 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r1.<init>(r0)
            throw r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.social.widget.card.rec.vm.SocialCardVM.LIZLLL(X.4r1):java.lang.Object");
    }

    public SocialCardVM(C1995Dih dih) {
        int i;
        M12.LIZ(dih);
        this.LJIJJLI = dih;
        4Dk LIZ2 = C0786DAg.LIZ();
        this.LJIL = LIZ2;
        this.LIZ = C0789DAj.LIZ(8pz.LIZIZ.plus(LIZ2));
        this.LIZLLL = dih.LIZJ;
        C2009Div div = dih.LIZIZ;
        this.LJ = div;
        this.LJJI = dih.LIZLLL;
        this.LJFF = dih.LJFF;
        this.LJJIFFI = dih.LJI;
        this.LJI = dih.LJ;
        this.LJJIII = 7he.LIZ(new C1588Dc8(this));
        if (div != null) {
            i = div.LIZLLL;
        } else {
            i = 0;
        }
        this.LJII = i;
        this.LJIIIZ = new LinkedHashSet();
        this.LJIIJ = new LinkedHashSet();
        this.LJIIJJI = Lel.INSTANCE;
        this.LJIIL = Lel.INSTANCE;
        this.LJJIIJ = Lel.INSTANCE;
        this.LJJIIJZLJL = new ArrayList();
        2ce<List<C1481DaP>> r0 = new 2ce<>();
        this.LJJIIZ = r0;
        this.LJIILIIL = r0;
        2ce<Integer> r02 = new 2ce<>();
        this.LJJIIZI = r02;
        this.LJIILJJIL = r02;
        2ce<C0436Cwu<Boolean, Integer>> r03 = new 2ce<>();
        this.LJIILL = r03;
        this.LJIILLIIL = r03;
        2ce<Integer> r04 = new 2ce<>();
        this.LJJIJ = r04;
        this.LJIIZILJ = r04;
        2ce r05 = new 2ce();
        this.LJIJ = r05;
        this.LJIJI = r05;
        2ce<Boolean> r06 = new 2ce<>();
        this.LJJIJIIJI = r06;
        this.LJIJJ = r06;
        this.LJJIJIIJIL = "invite_cell";
        LIZLLL();
    }

    public final void LIZ(int i) {
        this.LJJIJ.postValue(Integer.valueOf(i));
    }

    public final void LIZ(4r1<? super A4l<Integer>> r5) {
        LIZLLL();
        DBT unused = C0782DAc.LIZ(this.LIZ, (C0746D8s) null, (DAU) null, new C1994Dig(this, r5, (4r1) null), 3);
    }

    /* JADX WARNING: Removed duplicated region for block: B:11:0x0029  */
    /* JADX WARNING: Removed duplicated region for block: B:13:0x002f  */
    /* JADX WARNING: Removed duplicated region for block: B:7:0x001c  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final java.lang.Object LIZ(X.C1595DcF r7, X.4r1<? super java.util.List<? extends com.ss.android.ugc.aweme.profile.model.User>> r8) {
        /*
            r6 = this;
            boolean r0 = r8 instanceof X.C2026DjC
            if (r0 == 0) goto L_0x0050
            r5 = r8
            X.DjC r5 = (X.C2026DjC) r5
            int r0 = r5.label
            r1 = -2147483648(0xffffffff80000000, float:-0.0)
            r0 = r0 & r1
            if (r0 == 0) goto L_0x0050
            int r0 = r5.label
            int r0 = r0 - r1
            r5.label = r0
        L_0x0013:
            java.lang.Object r2 = r5.result
            X.Cof r4 = X.C0213Cof.COROUTINE_SUSPENDED
            int r0 = r5.label
            r3 = 1
            if (r0 == 0) goto L_0x002f
            if (r0 != r3) goto L_0x0056
            java.lang.Object r0 = r5.L$0
            com.ss.android.ugc.aweme.social.widget.card.rec.vm.SocialCardVM r0 = (com.ss.android.ugc.aweme.social.widget.card.rec.vm.SocialCardVM) r0
            X.2th.LIZ(r2)
        L_0x0025:
            X.Dic r1 = r0.LJFF
            if (r1 == 0) goto L_0x002e
            X.Dj9 r0 = X.C2023Dj9.NORMAL
            r1.LIZ((X.C2023Dj9) r0)
        L_0x002e:
            return r2
        L_0x002f:
            X.2th.LIZ(r2)
            X.Dic r1 = r6.LJFF
            if (r1 == 0) goto L_0x003b
            X.Dj9 r0 = X.C2023Dj9.LOADING
            r1.LIZ((X.C2023Dj9) r0)
        L_0x003b:
            X.DB2 r2 = X.C0849DCr.LIZLLL
            X.Dhd r1 = new X.Dhd
            r0 = 0
            r1.<init>(r6, r7, r0)
            r5.L$0 = r6
            r5.label = r3
            java.lang.Object r2 = X.C0782DAc.LIZ(r2, r1, r5)
            if (r2 != r4) goto L_0x004e
            return r4
        L_0x004e:
            r0 = r6
            goto L_0x0025
        L_0x0050:
            X.DjC r5 = new X.DjC
            r5.<init>(r6, r8)
            goto L_0x0013
        L_0x0056:
            java.lang.IllegalStateException r1 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r1.<init>(r0)
            throw r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.social.widget.card.rec.vm.SocialCardVM.LIZ(X.DcF, X.4r1):java.lang.Object");
    }

    private final 2Pr LIZ(C1481DaP daP, List<? extends C1481DaP> list, LsD<? super Integer, ? super List<C1481DaP>, 2Pr> lsD) {
        int indexOf = list.indexOf(daP);
        if (indexOf == -1) {
            return null;
        }
        lsD.invoke(Integer.valueOf(indexOf), Lea.LJII(list));
        return 2Pr.LIZ;
    }

    private final void LIZ(List<? extends C1481DaP> list, List<? extends C1481DaP> list2, List<? extends C1481DaP> list3, boolean z) {
        if (list != null) {
            this.LJIIJJI = Lea.LJIIJJI(list);
        }
        if (list2 != null) {
            this.LJIIL = Lea.LJIIJJI(list2);
        }
        if (list3 != null) {
            this.LJJIIJ = Lea.LJIIJJI(list3);
        }
        ArrayList arrayList = new ArrayList();
        arrayList.addAll(this.LJIIJJI);
        int size = arrayList.size();
        int i = this.LJII;
        if (i >= 0 && size > i) {
            arrayList.addAll(i, this.LJIIL);
        } else {
            arrayList.addAll(this.LJIIL);
        }
        int size2 = arrayList.size();
        int i2 = this.LJIIIIZZ;
        if (i2 >= 0 && size2 > i2) {
            arrayList.addAll(i2, this.LJJIIJ);
        } else {
            arrayList.addAll(this.LJJIIJ);
        }
        this.LJJIIJZLJL.clear();
        this.LJJIIJZLJL.addAll(arrayList);
        if (z) {
            LJ();
        }
    }

    public static /* synthetic */ void LIZ(SocialCardVM socialCardVM, List list, List list2, List list3, boolean z, int i) {
        if ((i & 1) != 0) {
            list = null;
        }
        if ((i & 2) != 0) {
            list2 = null;
        }
        if ((i & 4) != 0) {
            list3 = null;
        }
        if ((i & 8) != 0) {
            z = true;
        }
        socialCardVM.LIZ(list, list2, list3, z);
    }
}
