package com.ss.android.ugc.aweme.homepage.api.interaction;

import X.0Bt;
import X.0CH;
import X.0CM;
import X.1Bn;
import X.2ce;
import X.Aig;
import X.C0436Cwu;
import X.C4942Ep8;
import X.C4945EpB;
import X.C4951EpH;
import X.C5264EuK;
import X.D0R;
import X.M12;
import android.text.TextUtils;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.base.ui.CommonPageFragment;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.List;
import kotlin.h.b.n;

public class BaseScrollSwitchStateManager extends 0Bt {
    public final C4942Ep8 LIZ = new C4942Ep8();
    public final 1Bn<List<Aig>> LIZIZ = new 1Bn<>();
    public final 1Bn<Boolean> LIZJ;
    public final 1Bn<Integer> LIZLLL;
    public final 1Bn<D0R<Integer, Float, Integer>> LJ;
    public final 2ce<C0436Cwu<String, Boolean>> LJFF;
    public final 2ce<String> LJI;
    public final 1Bn<C5264EuK> LJII;
    public 1Bn<Fragment> LJIIIIZZ;
    public String LJIIIZ;
    public WeakReference<Fragment> LJIIJ;
    public final 1Bn<Integer> LJIIJJI;
    public final 1Bn<Integer> LJIIL;
    public final 1Bn<D0R<Integer, Float, Integer>> LJIILIIL;
    public final 1Bn<Boolean> LJIILJJIL;
    public final 1Bn<HashMap<Integer, CommonPageFragment>> LJIILL = new 1Bn<>();
    public final 1Bn<Boolean> LJIILLIIL;
    public final 1Bn<String> LJIIZILJ;
    public final 1Bn<Boolean> LJIJ;
    public final 1Bn<Integer> LJIJI;
    public final 1Bn<C4951EpH> LJIJJ;
    public final 2ce<String> LJIJJLI;

    static {
        Covode.recordClassIndex(83027);
    }

    public final void LIZ(List<? extends Aig> list) {
        M12.LIZ(list);
        this.LIZIZ.setValue(list);
    }

    public final void LIZ(HashMap<Integer, CommonPageFragment> hashMap) {
        M12.LIZ(hashMap);
        this.LJIILL.setValue(hashMap);
    }

    public final boolean LIZ() {
        Object value = this.LJIILLIIL.getValue();
        if (value == null) {
            n.LIZIZ();
        }
        return ((Boolean) value).booleanValue();
    }

    public final void LIZ(boolean z) {
        this.LJIILLIIL.setValue(Boolean.valueOf(z));
    }

    public final int LIZJ() {
        return this.LIZ.getValue().intValue();
    }

    public final String LIZLLL() {
        if (!this.LIZ.LIZ) {
            return "";
        }
        return LIZ(this.LIZ.getValue().intValue());
    }

    public final CommonPageFragment LJ() {
        if (!this.LIZ.LIZ) {
            return null;
        }
        return LIZLLL(this.LIZ.getValue().intValue());
    }

    public final Fragment LJFF() {
        Fragment fragment = (Fragment) this.LJIIIIZZ.getValue();
        if (this.LJIIIIZZ.getValue() == null) {
            return null;
        }
        return fragment;
    }

    public BaseScrollSwitchStateManager() {
        1Bn<Boolean> r3 = new 1Bn<>();
        this.LJIILLIIL = r3;
        1Bn<Boolean> r2 = new 1Bn<>();
        this.LIZJ = r2;
        this.LJIIZILJ = new 1Bn<>();
        1Bn<Boolean> r1 = new 1Bn<>();
        this.LJIJ = r1;
        this.LJIJI = new 1Bn<>();
        this.LIZLLL = new 1Bn<>();
        this.LJ = new 1Bn<>();
        this.LJIJJ = new 1Bn<>();
        this.LJFF = new 2ce<>();
        this.LJI = new 2ce<>();
        this.LJIJJLI = new 2ce<>();
        this.LJII = new 1Bn<>();
        this.LJIIIIZZ = new 1Bn<>();
        this.LJIIJJI = new 1Bn<>();
        this.LJIIL = new 1Bn<>();
        this.LJIILIIL = new 1Bn<>();
        this.LJIILJJIL = new 1Bn<>();
        r3.setValue(true);
        r2.setValue(true);
        r1.setValue(true);
    }

    public final boolean LIZIZ() {
        Object value = this.LJIJ.getValue();
        if (value == null) {
            n.LIZIZ();
        }
        return ((Boolean) value).booleanValue();
    }

    public final void LIZIZ(int i) {
        this.LJIJI.setValue(Integer.valueOf(i));
    }

    public final CommonPageFragment LIZLLL(String str) {
        M12.LIZ(str);
        return LIZLLL(LIZJ(str));
    }

    public final void LIZJ(int i) {
        this.LIZLLL.setValue(Integer.valueOf(i));
    }

    public final void LJI(String str) {
        M12.LIZ(str);
        this.LJIJJLI.setValue(str);
    }

    private CommonPageFragment LIZLLL(int i) {
        if (this.LJIILL.getValue() == null) {
            return null;
        }
        Object value = this.LJIILL.getValue();
        if (value == null) {
            n.LIZIZ();
        }
        if (((HashMap) value).isEmpty()) {
            return null;
        }
        Object value2 = this.LJIILL.getValue();
        if (value2 == null) {
            n.LIZIZ();
        }
        return (CommonPageFragment) ((HashMap) value2).get(Integer.valueOf(i));
    }

    public final void LIZ(C4945EpB epB) {
        M12.LIZ(epB);
        this.LIZ.LIZ(epB);
    }

    public final int LIZJ(String str) {
        if (this.LIZIZ.getValue() != null) {
            Object value = this.LIZIZ.getValue();
            if (value == null) {
                n.LIZIZ();
            }
            int size = ((List) value).size();
            for (int i = 0; i < size; i++) {
                Object value2 = this.LIZIZ.getValue();
                if (value2 == null) {
                    n.LIZIZ();
                }
                if (TextUtils.equals(str, ((Aig) ((List) value2).get(i)).LIZIZ)) {
                    return i;
                }
            }
        }
        return 0;
    }

    public final boolean LJ(String str) {
        M12.LIZ(str);
        CommonPageFragment LIZLLL2 = LIZLLL(str);
        if (LIZLLL2 == null || !LIZLLL2.cV_()) {
            return false;
        }
        return true;
    }

    public final void LJFF(String str) {
        M12.LIZ(str);
        this.LJI.setValue(str);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:10:0x0022, code lost:
        if (r0 == null) goto L_0x0024;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final java.lang.String LIZ(int r3) {
        /*
            r2 = this;
            X.1Bn<java.util.List<X.Aig>> r0 = r2.LIZIZ
            java.lang.Object r0 = r0.getValue()
            if (r0 != 0) goto L_0x0010
            r0 = 0
        L_0x0009:
            java.lang.String r1 = ""
            if (r3 < 0) goto L_0x000f
            if (r3 < r0) goto L_0x002e
        L_0x000f:
            return r1
        L_0x0010:
            X.1Bn<java.util.List<X.Aig>> r0 = r2.LIZIZ
            java.lang.Object r0 = r0.getValue()
            java.util.List r0 = (java.util.List) r0
            if (r0 == 0) goto L_0x002c
            int r0 = r0.size()
            java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
            if (r0 != 0) goto L_0x0027
        L_0x0024:
            kotlin.h.b.n.LIZIZ()
        L_0x0027:
            int r0 = r0.intValue()
            goto L_0x0009
        L_0x002c:
            r0 = 0
            goto L_0x0024
        L_0x002e:
            X.1Bn<java.util.List<X.Aig>> r0 = r2.LIZIZ
            java.lang.Object r0 = r0.getValue()
            if (r0 != 0) goto L_0x0039
            kotlin.h.b.n.LIZIZ()
        L_0x0039:
            java.util.List r0 = (java.util.List) r0
            java.lang.Object r0 = r0.get(r3)
            X.Aig r0 = (X.Aig) r0
            java.lang.String r0 = r0.LIZIZ
            kotlin.h.b.n.LIZIZ(r0, r1)
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.homepage.api.interaction.BaseScrollSwitchStateManager.LIZ(int):java.lang.String");
    }

    public final void LIZIZ(boolean z) {
        this.LJIJ.setValue(Boolean.valueOf(z));
    }

    public final void LIZ(C4951EpH epH) {
        M12.LIZ(epH);
        this.LJIJJ.setValue(epH);
    }

    public final void LIZ(C5264EuK euK) {
        M12.LIZ(euK);
        this.LJII.setValue(euK);
    }

    public final boolean LIZIZ(String str) {
        M12.LIZ(str);
        return TextUtils.equals(str, LIZLLL());
    }

    public final void LIZ(String str) {
        M12.LIZ(str);
        this.LIZ.LIZ(LIZJ(str));
    }

    public final void LIZ(0CH r2, 0CM<Boolean> r3) {
        M12.LIZ(r2, r3);
        this.LJIILLIIL.observe(r2, r3);
    }

    public final void LJ(0CH r2, 0CM<C4951EpH> r3) {
        M12.LIZ(r2, r3);
        this.LJIJJ.observe(r2, r3);
    }

    public final void LJFF(0CH r2, 0CM<C5264EuK> r3) {
        M12.LIZ(r2, r3);
        this.LJII.observe(r2, r3);
    }

    public final void LJI(0CH r2, 0CM<Integer> r3) {
        M12.LIZ(r2, r3);
        this.LJIIL.observe(r2, r3);
    }

    public final void LJII(0CH r2, 0CM<Integer> r3) {
        M12.LIZ(r2, r3);
        this.LJIIJJI.observe(r2, r3);
    }

    public final void LIZIZ(0CH r2, 0CM<String> r3) {
        M12.LIZ(r2, r3);
        this.LJIIZILJ.observe(r2, r3);
    }

    public final void LIZIZ(String str, boolean z) {
        M12.LIZ(str);
        this.LJFF.setValue(new C0436Cwu(str, Boolean.valueOf(z)));
    }

    public final void LIZJ(0CH r2, 0CM<Integer> r3) {
        M12.LIZ(r2, r3);
        this.LJIJI.observe(r2, r3);
    }

    public final void LIZLLL(0CH r2, 0CM<Integer> r3) {
        M12.LIZ(r2, r3);
        this.LIZLLL.observe(r2, r3);
    }

    public final void LIZ(String str, boolean z) {
        M12.LIZ(str);
        this.LIZ.LIZ(LIZJ(str), z);
    }

    public final void LIZ(int i, float f, int i2) {
        this.LJ.setValue(new D0R(Integer.valueOf(i), Float.valueOf(f), Integer.valueOf(i2)));
    }
}
