package com.ss.android.ugc.aweme.main.assems;

import X.1hK;
import X.2Gx;
import X.4Cy;
import X.86q;
import X.C4525EiP;
import X.C4824EnE;
import X.C4825EnF;
import X.C4833EnN;
import X.C4834EnO;
import X.C4835EnP;
import X.C4836EnQ;
import X.C4840EnU;
import X.CuL;
import X.EMX;
import X.LeS;
import X.M12;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.bytedance.hox.Hox;
import com.bytedance.tiktok.homepage.mainfragment.HomeTabAbility;
import java.util.List;
import kotlin.h.b.n;

public final class HoxAssem extends C4836EnQ implements C4840EnU {
    static {
        Covode.recordClassIndex(91683);
    }

    public final void LJIILLIIL() {
        super.LJIILLIIL();
        HomeTabAbility LIZIZ = EMX.LIZIZ(EMX.LIZ((CuL) this), HomeTabAbility.class);
        if (LIZIZ != null) {
            LIZIZ.LIZIZ(this);
        }
    }

    public final void LIZ(Bundle bundle) {
        long uptimeMillis = SystemClock.uptimeMillis();
        super.LIZ(bundle);
        2Gx.LIZ.post(new C4835EnP(this));
        4Cy.LIZ(getClass().getCanonicalName(), SystemClock.uptimeMillis() - uptimeMillis, "ON_CREATE_WITH_BUNDLE", (String) null);
    }

    private final boolean LIZ(List<? extends C4525EiP> list, String str) {
        for (C4525EiP LJ : list) {
            if (TextUtils.equals(LJ.LJ(), str)) {
                return true;
            }
        }
        return false;
    }

    public final void LIZ(List<? extends C4525EiP> list, List<? extends C4525EiP> list2) {
        boolean z;
        String str;
        M12.LIZ(list, list2);
        1hK LIZJ = EMX.LIZJ(this);
        if (LIZJ != null) {
            C4825EnF LJ = Hox.LJ.LIZ(LIZJ).LJ("HOME");
            if (!(LJ instanceof C4824EnE)) {
                LJ = null;
            }
            C4824EnE enE = (C4824EnE) LJ;
            if (enE != null) {
                int i = 0;
                if (list.size() != list2.size()) {
                    z = true;
                } else {
                    z = false;
                }
                for (C4525EiP eiP : list) {
                    if (!(eiP instanceof C4825EnF)) {
                        eiP = null;
                    }
                    C4825EnF enF = (C4825EnF) eiP;
                    if (enF != null && !LIZ(list2, enF.LJ())) {
                        M12.LIZ(enF);
                        if (enE.LJ.contains(enF)) {
                            C4825EnF enF2 = enE.LIZJ;
                            if (enF2 != null) {
                                str = enF2.LJ();
                            } else {
                                str = null;
                            }
                            if (n.LIZ(str, enF.LJ())) {
                                enE.LIZJ = null;
                            }
                            enF.LJFF = null;
                            enE.LJ.remove(enF);
                        }
                        z = true;
                    }
                }
                int i2 = 0;
                for (T next : list2) {
                    int i3 = i2 + 1;
                    if (i2 < 0) {
                        LeS.LIZIZ();
                    }
                    C4525EiP eiP2 = (C4525EiP) next;
                    if (!LIZ(list, eiP2.LJ())) {
                        if (!(eiP2 instanceof C4825EnF)) {
                            eiP2 = null;
                        }
                        C4825EnF enF3 = (C4825EnF) eiP2;
                        if (enF3 != null) {
                            enE.LIZ(enF3);
                        }
                        z = true;
                    }
                    i2 = i3;
                }
                if (!z) {
                    if (list2.size() == list.size()) {
                        int size = list2.size();
                        while (i < size) {
                            if (!TextUtils.equals(((C4525EiP) list2.get(i)).LJ(), ((C4525EiP) list.get(i)).LJ())) {
                                i++;
                            }
                        }
                        return;
                    }
                    return;
                }
                C4833EnN enN = new C4833EnN(this, list2);
                M12.LIZ(enN);
                List<C4825EnF> list3 = enE.LJ;
                if (list3.size() > 1) {
                    86q.LIZ(list3, new C4834EnO(enN));
                }
                Hox LIZ = Hox.LJ.LIZ(LIZJ);
                LIZ.LIZ.clear();
                LIZ.LIZJ.clear();
            }
        }
    }
}
