package com.ss.android.ugc.aweme.ecommerce.sku;

import X.0Bv;
import X.0CH;
import X.0HH;
import X.19u;
import X.1hK;
import X.2Pr;
import X.2cN;
import X.2dd;
import X.2de;
import X.5Am;
import X.5An;
import X.5vY;
import X.5wO;
import X.7he;
import X.9Y3;
import X.B1N;
import X.B8T;
import X.C1835Aid;
import X.C5603C5n;
import X.C5604C5o;
import X.C5605C5p;
import X.C5606C5q;
import X.C5607C5r;
import X.C5609C5t;
import X.C5612C5w;
import X.C5613C5x;
import X.C5942CIo;
import X.C6028CLw;
import X.CYR;
import X.CYW;
import X.Crj;
import X.Cwt;
import X.D1G;
import X.D4t;
import X.DRZ;
import X.DUT;
import X.DUy;
import X.DUz;
import X.DV9;
import X.DVU;
import X.KEM;
import X.LsC;
import X.LsD;
import X.LsE;
import X.LsF;
import X.Lsh;
import X.Lu9;
import X.M12;
import X.PHD;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.Window;
import com.bytedance.covode.number.Covode;
import com.bytedance.jedi.arch.JediViewModel;
import com.bytedance.jedi.arch.lifecycleAwareLazy;
import com.ss.android.ugc.aweme.ecommerce.ab.EComLiveDegradeExperiment;
import com.ss.android.ugc.aweme.ecommerce.common.view.CommerceBottomSheetDialogFragment;
import com.ss.android.ugc.aweme.ecommerce.sku.viewmodel.SkuPanelViewModel;
import com.ss.android.ugc.aweme.ecommerce.util.KeyBoardVisibilityUtil;
import kotlin.h.b.n;

public final class SkuPanelFragment extends CommerceBottomSheetDialogFragment implements B1N<C1835Aid>, 5vY {
    public static final C5612C5w LIZJ = new C5612C5w((byte) 0);
    public final C1835Aid LIZ = new C1835Aid();
    public KeyBoardVisibilityUtil LIZIZ;
    public final lifecycleAwareLazy LIZLLL;
    public final Crj LJ;
    public SparseArray LJIIL;

    static {
        Covode.recordClassIndex(72553);
    }

    private final C5604C5o LJIIIZ() {
        return (C5604C5o) this.LJ.getValue();
    }

    public final View LIZ(int i) {
        if (this.LJIIL == null) {
            this.LJIIL = new SparseArray();
        }
        View view = (View) this.LJIIL.get(i);
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJIIL.put(i, findViewById);
        return findViewById;
    }

    public final void LIZJ() {
        SparseArray sparseArray = this.LJIIL;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final SkuPanelViewModel LJIIIIZZ() {
        return (SkuPanelViewModel) this.LIZLLL.getValue();
    }

    public final String ck_() {
        return "sku";
    }

    public final boolean getUniqueOnlyGlobal() {
        return true;
    }

    public final /* bridge */ /* synthetic */ 0Bv be_() {
        return this.LIZ;
    }

    public final /* bridge */ /* synthetic */ 5An getReceiver() {
        return this;
    }

    public final C5942CIo LJII() {
        return LJIIIZ();
    }

    public final 0CH getLifecycleOwner() {
        5wO.LIZJ(this);
        return this;
    }

    public final DUz getLifecycleOwnerHolder() {
        5wO.LIZ(this);
        return this;
    }

    public final DUy<DVU> getReceiverHolder() {
        5wO.LIZIZ(this);
        return this;
    }

    public final void onStop() {
        SkuPanelFragment.super.onStop();
        LJIIIZ().LIZLLL();
    }

    public final boolean LIZ() {
        return EComLiveDegradeExperiment.LIZ().getPageAnimDegrade();
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.ecommerce.common.view.CommerceBottomSheetDialogFragment, com.ss.android.ugc.aweme.ecommerce.common.view.ECBaseBottomSheetDialogFragment, com.ss.android.ugc.aweme.ecommerce.sku.SkuPanelFragment] */
    public final void onDestroyView() {
        SkuPanelFragment.super.onDestroyView();
        LJIIIZ().LIZJ();
        KeyBoardVisibilityUtil keyBoardVisibilityUtil = this.LIZIZ;
        if (keyBoardVisibilityUtil != null) {
            keyBoardVisibilityUtil.LIZ();
        }
        this.LIZIZ = null;
        LIZJ();
    }

    public SkuPanelFragment() {
        super((byte) 0);
        D1G LIZ2 = KEM.LIZ.LIZ(SkuPanelViewModel.class);
        C5605C5p c5p = new C5605C5p(LIZ2);
        this.LIZLLL = new lifecycleAwareLazy(this, c5p, new C5607C5r(this, c5p, LIZ2, C5606C5q.INSTANCE));
        this.LJ = 7he.LIZ(new C5603C5n(this));
    }

    public final void onStart() {
        SkuPanelFragment.super.onStart();
        try {
            if (9Y3.LIZ(9Y3.LIZ(), true, "ec_multisku_silent_fold", 0) == C5613C5x.LIZ) {
                Dialog dialog = getDialog();
                n.LIZIZ(dialog, "");
                Window window = dialog.getWindow();
                if (window != null) {
                    window.setWindowAnimations(2131886971);
                }
            }
        } catch (Exception e) {
            0HH.LIZ(e);
        }
    }

    public final void LIZ(CYW cyw) {
        M12.LIZ(cyw);
        CYR.LIZ(cyw, new C6028CLw(this));
    }

    public final void onCreate(Bundle bundle) {
        SkuPanelFragment.super.onCreate(bundle);
        LJIIIZ().LIZ();
    }

    public final Dialog onCreateDialog(Bundle bundle) {
        Context context = getContext();
        if (context == null) {
            n.LIZIZ();
        }
        n.LIZIZ(context, "");
        Lu9 c5t = new C5609C5t(context, getTheme());
        c5t.LIZ(LJIIIZ());
        return c5t;
    }

    public final void onSaveInstanceState(Bundle bundle) {
        M12.LIZ(bundle);
        SkuPanelFragment.super.onSaveInstanceState(bundle);
        1hK activity = getActivity();
        if (activity != null) {
            C5604C5o LJIIIZ = LJIIIZ();
            n.LIZIZ(activity, "");
            LJIIIZ.LIZIZ(activity, bundle);
        }
    }

    public final void onActivityCreated(Bundle bundle) {
        ViewParent viewParent;
        View findViewById;
        ViewParent parent;
        SkuPanelFragment.super.onActivityCreated(bundle);
        LJIIIZ().LIZIZ();
        1hK activity = getActivity();
        if (activity != null) {
            C5604C5o LJIIIZ = LJIIIZ();
            n.LIZIZ(activity, "");
            LJIIIZ.LIZ(activity, bundle);
        }
        Context context = getContext();
        View view = null;
        if (!(context instanceof 19u)) {
            context = null;
        }
        19u r3 = (19u) context;
        if (r3 != null) {
            this.LIZIZ = new KeyBoardVisibilityUtil(r3, 2de.LIZ);
        }
        View view2 = getView();
        if (view2 == null || (parent = view2.getParent()) == null) {
            viewParent = null;
        } else {
            viewParent = parent.getParent();
        }
        if (viewParent instanceof View) {
            view = viewParent;
        }
        View view3 = view;
        if (view3 != null && (findViewById = view3.findViewById(2131371474)) != null) {
            findViewById.setOnClickListener(new 2dd(this));
        }
    }

    public final <VM1 extends JediViewModel<S1>, S1 extends 5Am, R> R withState(VM1 vm1, LsC<? super S1, ? extends R> lsC) {
        M12.LIZ(vm1, lsC);
        return 5wO.LIZ(vm1, lsC);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.ecommerce.common.view.ECBaseBottomSheetDialogFragment, com.ss.android.ugc.aweme.ecommerce.sku.SkuPanelFragment] */
    public final void onViewCreated(View view, Bundle bundle) {
        M12.LIZ(view);
        SkuPanelFragment.super.onViewCreated(view, bundle);
        LJIIIZ().LIZ(view);
    }

    public final <S extends 5Am> 2cN subscribe(JediViewModel<S> jediViewModel, DUT<S> dut, LsD<? super DVU, ? super S, 2Pr> lsD) {
        M12.LIZ(jediViewModel, dut, lsD);
        return 5wO.LIZ(this, jediViewModel, dut, lsD);
    }

    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        return LJIIIZ().LIZ(layoutInflater, viewGroup);
    }

    public final <S extends 5Am, A> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, DUT<DRZ<A>> dut, LsD<? super DVU, ? super A, 2Pr> lsD) {
        M12.LIZ(jediViewModel, phd, dut, lsD);
        return 5wO.LIZ(this, jediViewModel, phd, dut, lsD);
    }

    public final <S extends 5Am, A, B> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, DUT<Cwt<A, B>> dut, LsE<? super DVU, ? super A, ? super B, 2Pr> lsE) {
        M12.LIZ(jediViewModel, phd, phd2, dut, lsE);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, dut, lsE);
    }

    public final <S extends 5Am, T> 2cN asyncSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends B8T<? extends T>> phd, DUT<DRZ<B8T<T>>> dut, LsD<? super DVU, ? super Throwable, 2Pr> lsD, LsC<? super DVU, 2Pr> lsC, LsD<? super DVU, ? super T, 2Pr> lsD2) {
        M12.LIZ(jediViewModel, phd, dut);
        return 5wO.LIZ(this, jediViewModel, phd, dut, lsD, lsC, lsD2);
    }

    public final <S extends 5Am, A, B, C> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, DUT<DV9<A, B, C>> dut, LsF<? super DVU, ? super A, ? super B, ? super C, 2Pr> lsF) {
        M12.LIZ(jediViewModel, phd, phd2, phd3, dut, lsF);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, phd3, dut, lsF);
    }

    public final <S extends 5Am, A, B, C, D> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, PHD<S, ? extends D> phd4, DUT<D4t<A, B, C, D>> dut, Lsh<? super DVU, ? super A, ? super B, ? super C, ? super D, 2Pr> lsh) {
        M12.LIZ(jediViewModel, phd, phd2, phd3, phd4, dut, lsh);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, phd3, phd4, dut, lsh);
    }
}
