package com.ss.android.ugc.aweme.compliance.business.agegate;

import X.070;
import X.0HH;
import X.1hK;
import X.2Pr;
import X.2UX;
import X.2ix;
import X.2iy;
import X.2iz;
import X.2nK;
import X.2uR;
import X.2vu;
import X.33P;
import X.36A;
import X.36K;
import X.36L;
import X.36a;
import X.3QU;
import X.3QV;
import X.3Qd;
import X.3c7;
import X.3c9;
import X.3cA;
import X.3cC;
import X.3cI;
import X.3cJ;
import X.3v1;
import X.44L;
import X.44O;
import X.44P;
import X.44R;
import X.44S;
import X.44T;
import X.44V;
import X.44h;
import X.44n;
import X.46a;
import X.4EV;
import X.4EW;
import X.4FQ;
import X.7he;
import X.8QU;
import X.9Y3;
import X.C2675S4x;
import X.C2715S6l;
import X.C2716S6m;
import X.C2725S6v;
import X.C2735S7f;
import X.C2736S7g;
import X.C2738S7i;
import X.C2741S7l;
import X.C2742S7m;
import X.C2744S7o;
import X.C2745S7p;
import X.CbG;
import X.Crj;
import X.IPu;
import X.Jwg;
import X.KIM;
import X.KIR;
import X.Lea;
import X.Lf3;
import X.Ls2;
import X.LsC;
import X.Ltt;
import X.M12;
import X.OcZ;
import X.QHW;
import X.QJt;
import X.Qeg;
import X.S52;
import X.S70;
import X.S71;
import X.S73;
import X.S75;
import X.S78;
import X.S7H;
import X.S7K;
import X.S7T;
import X.S7U;
import X.S7V;
import X.S7W;
import X.S7Y;
import X.S7Z;
import X.S9B;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.text.style.URLSpan;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatTextView;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.abmock.SettingsManager;
import com.bytedance.ies.foundation.fragment.BaseFragment;
import com.bytedance.lighten.loader.SmartImageView;
import com.bytedance.router.SmartRouter;
import com.ss.android.ugc.aweme.base.utils.KeyboardUtils;
import com.ss.android.ugc.aweme.compliance.api.a;
import com.ss.android.ugc.aweme.profile.model.AgeGateHyperlink;
import com.ss.android.ugc.aweme.profile.model.AgeGateNavButton;
import com.ss.android.ugc.aweme.profile.model.User;
import com.ss.android.ugc.aweme.setting.services.LanguageService;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import kotlin.h.b.n;
import kotlin.o.y;
import kotlin.o.z;

public final class AgeGateFragment extends BaseFragment {
    public static final HashSet<Integer> LJ = 8QU.LIZJ(new Integer[]{3008010, 3008008, 3008012, 3008020, 3008026, 3008038});
    public static final String LJFF;
    public static final C2745S7p LJI = new C2745S7p((byte) 0);
    public final Crj LJII = 7he.LIZ(new 44h(this));
    public final Crj LJIIIIZZ = 7he.LIZ(new 44R(this));
    public final Crj LJIIIZ = 7he.LIZ(new 44S(this));
    public final Crj LJIIJ = 7he.LIZ(new 36L(this));
    public final Crj LJIIJJI = 7he.LIZ(new 36K(this));
    public final Crj LJIIL = 7he.LIZ(new 36A(this));
    public SparseArray LJIILIIL;

    private final 44n LIZLLL() {
        return (44n) this.LJIIIIZZ.getValue();
    }

    private final 44O LJII() {
        return (44O) this.LJIIIZ.getValue();
    }

    private final boolean LJIIIIZZ() {
        return ((Boolean) this.LJIIJJI.getValue()).booleanValue();
    }

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

    public final AgeGateViewModel LIZ() {
        return (AgeGateViewModel) this.LJII.getValue();
    }

    public final boolean LIZIZ() {
        return ((Boolean) this.LJIIJ.getValue()).booleanValue();
    }

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

    public final /* synthetic */ void onDestroyView() {
        AgeGateFragment.super.onDestroyView();
        LJI();
    }

    public final void LIZ(String str) {
        if (36a.LIZ(str)) {
            SmartRouter.buildRoute(getContext(), str).open();
        }
    }

    public final void LIZ(boolean z) {
        if (z) {
            C2715S6l s6l = C2716S6m.LJFF;
            s6l.LIZ(s6l.LIZIZ(), -3001, false, (Map<String, String>) s6l.LIZIZ((44L) null));
        }
        1hK activity = getActivity();
        if (activity != null) {
            activity.finish();
        }
    }

    public final void LIZJ() {
        if (LIZLLL().getCanQuit()) {
            LIZ().LJI();
        }
    }

    static {
        String str;
        Covode.recordClassIndex(60607);
        if (46a.LIZ().LIZ) {
            str = "//action/account_deleted";
        } else {
            str = "//account/deleted/alert";
        }
        LJFF = str;
    }

    public final void onDestroy() {
        String str;
        AgeGateFragment.super.onDestroy();
        AgeGateViewModel LIZ = LIZ();
        int i = LIZ.LJFF;
        int i2 = LIZ.LJI;
        int i3 = LIZ.LJII;
        boolean z = LIZ.LJIIIIZZ;
        if (C2716S6m.LIZJ) {
            str = "age_edit_scroll_results";
        } else {
            str = "age_scroll_result";
        }
        2UX r2 = new 2UX();
        r2.LIZ(C2716S6m.LIZIZ);
        DateFormat dateInstance = DateFormat.getDateInstance(3, new Locale(LanguageService.LIZIZ().LIZ(), S9B.LIZ()));
        Objects.requireNonNull(dateInstance, "null cannot be cast to non-null type java.text.SimpleDateFormat");
        String localizedPattern = ((SimpleDateFormat) dateInstance).toLocalizedPattern();
        ArrayList arrayList = new ArrayList();
        HashSet hashSet = new HashSet();
        n.LIZIZ(localizedPattern, "");
        Locale locale = Locale.ROOT;
        n.LIZIZ(locale, "");
        Objects.requireNonNull(localizedPattern, "null cannot be cast to non-null type java.lang.String");
        String lowerCase = localizedPattern.toLowerCase(locale);
        n.LIZIZ(lowerCase, "");
        int length = lowerCase.length();
        for (int i4 = 0; i4 < length; i4++) {
            char charAt = lowerCase.charAt(i4);
            if (!hashSet.contains(Character.valueOf(charAt))) {
                if (charAt == 'd') {
                    arrayList.add("dd");
                } else if (charAt == 'm') {
                    arrayList.add("mm");
                } else if (charAt == 'y') {
                    arrayList.add("yyyy");
                }
                hashSet.add(Character.valueOf(charAt));
            }
        }
        r2.LIZ("default_format", Lea.LIZ(arrayList, "", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (LsC) null, 62));
        r2.LIZ("day", i);
        r2.LIZ("month", i2);
        r2.LIZ("year", i3);
        r2.LIZ("selected_cnt", Math.max(i, Math.max(i2, i3)));
        r2.LIZ("is_submit", z ? 1 : 0);
        2nK.LIZ(str, r2.LIZ);
        2UX r4 = new 2UX();
        r4.LIZ(C2716S6m.LIZIZ);
        r4.LIZ("stay_time", String.valueOf(SystemClock.elapsedRealtime() - C2716S6m.LIZ));
        r4.LIZ("page_show_cost", C2716S6m.LJ);
        2nK.LIZ("age_gate_page", r4.LIZ);
        1hK activity = getActivity();
        if (activity != null) {
            KeyboardUtils.LIZ(activity, 16);
        }
    }

    public final void onCreate(Bundle bundle) {
        LIZ(C2675S4x.LIZ);
        AgeGateFragment.super.onCreate(bundle);
        C2716S6m.LIZ = SystemClock.elapsedRealtime();
    }

    private final void LIZ(TextView textView) {
        SpannableStringBuilder valueOf = SpannableStringBuilder.valueOf(textView.getText());
        Object[] spans = valueOf.getSpans(0, valueOf.length(), URLSpan.class);
        n.LIZIZ(spans, "");
        for (Object obj : spans) {
            URLSpan uRLSpan = (URLSpan) obj;
            valueOf.setSpan(new S7Z(uRLSpan, valueOf, this), valueOf.getSpanStart(uRLSpan), valueOf.getSpanEnd(uRLSpan), 17);
            valueOf.setSpan(new Ltt(42), valueOf.getSpanStart(uRLSpan), valueOf.getSpanEnd(uRLSpan), 18);
            valueOf.removeSpan(uRLSpan);
        }
        textView.setText(valueOf);
        textView.setMovementMethod(LinkMovementMethod.getInstance());
    }

    private final SpannableStringBuilder LIZIZ(int i) {
        Integer num;
        int i2;
        Locale locale = Locale.ROOT;
        Resources resources = getResources();
        44T editStatus = LIZLLL().getEditStatus();
        if (editStatus != null) {
            num = editStatus.getDescType();
        } else {
            num = null;
        }
        if (num != null && num.intValue() == 1) {
            i2 = 2131689907;
        } else {
            i2 = 2131689489;
        }
        String quantityString = resources.getQuantityString(i2, i);
        n.LIZIZ(quantityString, "");
        String LIZ = 0HH.LIZ(locale, quantityString, Arrays.copyOf(new Object[]{Integer.valueOf(i)}, 1));
        n.LIZIZ(LIZ, "");
        int LIZ2 = z.LIZ(LIZ, String.valueOf(i), 0, false, 6);
        int length = String.valueOf(i).length() + LIZ2;
        try {
            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(LIZ);
            spannableStringBuilder.setSpan(new ForegroundColorSpan(070.LIZJ(requireContext(), 2131099750)), LIZ2, length, 18);
            spannableStringBuilder.setSpan(new StyleSpan(1), LIZ2, length, 18);
            return spannableStringBuilder;
        } catch (Exception unused) {
            return new SpannableStringBuilder(LIZ);
        }
    }

    private final 3cI LIZ(AgeGateNavButton ageGateNavButton) {
        Integer num;
        if (ageGateNavButton != null) {
            num = ageGateNavButton.getType();
        } else {
            num = null;
        }
        int type = S7K.AgeGateBtnTypeNone.getType();
        if (num != null && num.intValue() == type) {
            return new 3cJ();
        }
        int type2 = S7K.AgeGateBtnTypeBack.getType();
        if (num != null && num.intValue() == type2) {
            return LIZ(2131755170, (Ls2<2Pr>) new C2735S7f(this));
        }
        int type3 = S7K.AgeGateBtnTypeClose.getType();
        if (num != null && num.intValue() == type3) {
            return LIZ(2131755735, (Ls2<2Pr>) new C2736S7g(this));
        }
        int type4 = S7K.AgeGateBtnTypeInfo.getType();
        if (num != null && num.intValue() == type4) {
            return LIZ(2131755448, (Ls2<2Pr>) new S7U(this, ageGateNavButton));
        }
        int type5 = S7K.AgeGateBtnTypeIcon.getType();
        if (num != null && num.intValue() == type5) {
            SmartImageView smartImageView = new SmartImageView(getContext());
            smartImageView.setLayoutParams(new LinearLayout.LayoutParams(-1, -1));
            smartImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
            smartImageView.setImageURI(ageGateNavButton.getIconUrl());
            smartImageView.setOnClickListener(new C2744S7o(this, ageGateNavButton));
            3cJ r0 = new 3cJ();
            r0.LIZ(smartImageView);
            return r0;
        }
        int type6 = S7K.AgeGateBtnTypeText.getType();
        if (num == null || num.intValue() != type6) {
            return null;
        }
        3c9 r1 = new 3c9();
        String content = ageGateNavButton.getContent();
        if (content == null) {
            content = "";
        }
        r1.LIZ(content);
        r1.LIZLLL = true;
        r1.LIZJ = true;
        r1.LIZ(2vu.SECONDARY);
        r1.LIZ(new S7V(this, ageGateNavButton));
        return r1;
    }

    public final void LIZIZ(String str) {
        if (str == null || y.LIZ(str)) {
            S71 s71 = LIZ().LIZLLL;
            if (s71 != null) {
                s71.LIZIZ();
            }
            1hK activity = getActivity();
            if (activity != null) {
                activity.finish();
                return;
            }
            return;
        }
        2UX r1 = new 2UX();
        r1.LIZ(C2716S6m.LIZIZ);
        2nK.LIZ("age_gate_eligible_popup", r1.LIZ);
        Context requireContext = requireContext();
        n.LIZIZ(requireContext, "");
        4EW r2 = new 4EW(requireContext);
        r2.LIZJ(str);
        3QV.LIZ(r2, new S73(this, str));
        r2.LIZ(false);
        4FQ.LIZ(r2.LIZ().LIZJ());
    }

    public final void LIZ(44L r8) {
        Context context = getContext();
        if (context != null) {
            33P r0 = 4EV.LJ;
            n.LIZIZ(context, "");
            4EW LIZ = r0.LIZ(context);
            String LIZ2 = 0HH.LIZ("%s\n%s", Arrays.copyOf(new Object[]{getString(2131822153), getString(2131822154)}, 2));
            n.LIZIZ(LIZ2, "");
            LIZ.LIZJ(LIZ2);
            3QU.LIZ(LIZ, new S70(this, r8));
            LIZ.LIZ(false);
            4FQ.LIZ(LIZ.LIZ().LIZJ());
        }
        2UX r1 = new 2UX();
        r1.LIZ(C2716S6m.LIZIZ);
        2nK.LIZ("confirm_f_special_age_popup", r1.LIZ);
    }

    private final 3cI LIZ(int i, Ls2<2Pr> ls2) {
        3cA r1 = new 3cA();
        r1.LIZ(i);
        r1.LJ = true;
        r1.LIZ(new C2741S7l(ls2));
        return r1;
    }

    private final SpannableStringBuilder LIZ(String str, String str2) {
        int LIZ = z.LIZ(str, str2, 0, false, 6);
        int length = str2.length() + LIZ;
        try {
            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(str);
            spannableStringBuilder.setSpan(new ForegroundColorSpan(070.LIZJ(requireContext(), 2131099750)), LIZ, length, 18);
            spannableStringBuilder.setSpan(new Ltt(42), LIZ, length, 18);
            return spannableStringBuilder;
        } catch (Exception unused) {
            return new SpannableStringBuilder(str);
        }
    }

    public final void LIZ(S7W s7w, Bundle bundle) {
        Integer valueOf;
        Object obj;
        int i;
        Integer descType;
        EditText editText;
        String str;
        Serializable serializable;
        int i2 = C2738S7i.LIZ[s7w.ordinal()];
        String str2 = "";
        if (i2 != 1) {
            Serializable serializable2 = null;
            if (i2 != 2) {
                if (i2 == 3) {
                    C2716S6m.LJFF.LIZ("only_scroll_year", !LIZIZ());
                    S52 s52 = (S52) LIZ(2131362194);
                    if (s52 == null || (str = s52.getText()) == null) {
                        str = str2;
                    }
                    Context requireContext = requireContext();
                    n.LIZIZ(requireContext, str2);
                    4EW r2 = new 4EW(requireContext);
                    r2.LIZ(getString(2131831953));
                    String string = getString(2131831952, new Object[]{str});
                    n.LIZIZ(string, str2);
                    r2.LIZJ(LIZ(string, str));
                    3QV.LIZ(r2, S7Y.LIZ);
                    r2.LIZ(false);
                    4FQ.LIZ(r2.LIZ().LIZJ());
                    Qeg LIZ = LIZ(2131368236);
                    n.LIZIZ(LIZ, str2);
                    LIZ.setVisibility(0);
                } else if (i2 == 4) {
                    if (bundle != null) {
                        serializable = bundle.getSerializable("age_gate_popup_param_model");
                    } else {
                        serializable = null;
                    }
                    if (serializable instanceof IPu) {
                        serializable2 = serializable;
                    }
                    IPu iPu = (IPu) serializable2;
                    if (iPu != null) {
                        Context requireContext2 = requireContext();
                        n.LIZIZ(requireContext2, str2);
                        4EW r1 = new 4EW(requireContext2);
                        String title = iPu.getTitle();
                        if (title != null) {
                            str2 = title;
                        }
                        r1.LIZ(str2);
                        r1.LIZJ(iPu.getDescription());
                        r1.LIZ(false);
                        3QV.LIZ(r1, new KIM(this, iPu, iPu));
                        4FQ.LIZ(r1.LIZ().LIZJ());
                        int type = iPu.getType();
                        2UX r12 = new 2UX();
                        r12.LIZ(C2716S6m.LIZIZ);
                        r12.LIZ("type", type);
                        2nK.LIZ("age_gate_popup_show", r12.LIZ);
                    }
                }
            } else if (bundle != null && (valueOf = Integer.valueOf(bundle.getInt("age_gate_popup_param_age"))) != null) {
                2UX r13 = new 2UX();
                r13.LIZ(C2716S6m.LIZIZ);
                2nK.LIZ("show_age_edit_confirm_popup", r13.LIZ);
                Context requireContext3 = requireContext();
                n.LIZIZ(requireContext3, str2);
                4EW r4 = new 4EW(requireContext3);
                Object[] objArr = new Object[1];
                S52 s522 = (S52) LIZ(2131362194);
                if (s522 == null || (editText = s522.getEditText()) == null || (obj = editText.getText()) == null) {
                    obj = str2;
                }
                objArr[0] = obj;
                r4.LIZ(getString(2131821450, objArr));
                r4.LIZJ(LIZIZ(valueOf.intValue()));
                3QV.LIZ(r4, new C2725S6v(this));
                Context requireContext4 = requireContext();
                n.LIZIZ(requireContext4, str2);
                Qeg qeg = new Qeg(requireContext4, (AttributeSet) null, 0, 6);
                44T editStatus = LIZLLL().getEditStatus();
                if (editStatus == null || (descType = editStatus.getDescType()) == null || descType.intValue() != 1) {
                    i = 2131821449;
                } else {
                    i = 2131834578;
                }
                qeg.setText(getString(i));
                qeg.setTuxFont(41);
                qeg.setTextColor(070.LIZJ(requireContext(), 2131099757));
                qeg.setGravity(17);
                3Qd.LIZ(r4, qeg);
                r4.LIZ(false);
                4FQ.LIZ(r4.LIZ().LIZJ());
            }
        } else {
            C2716S6m.LJFF.LIZ("quit_confirmation", !LIZIZ());
            Context requireContext5 = requireContext();
            n.LIZIZ(requireContext5, str2);
            4EW r14 = new 4EW(requireContext5);
            r14.LIZJ(2131821444);
            r14.LIZLLL(2131821443);
            r14.LIZ(false);
            3QV.LIZ(r14, new S75(this));
            4FQ.LIZ(r14.LIZ().LIZJ());
        }
    }

    public final void onViewCreated(View view, Bundle bundle) {
        AgeGateNavButton ageGateNavButton;
        AgeGateNavButton ageGateNavButton2;
        boolean z;
        boolean z2;
        int i;
        boolean z3;
        String str;
        User LIZIZ;
        Integer type;
        S52 s52;
        Date LJFF2;
        Calendar calendar;
        Spanned fromHtml;
        Lf3 lf3;
        EditText editText;
        M12.LIZ(view);
        AgeGateFragment.super.onViewCreated(view, bundle);
        AgeGateViewModel LIZ = LIZ();
        boolean LIZIZ2 = LIZIZ();
        boolean LJIIIIZZ2 = LJIIIIZZ();
        44n LIZLLL = LIZLLL();
        M12.LIZ(LIZLLL);
        LIZ.LIZ().LIZ((String) null);
        LIZ.LIZ = LJIIIIZZ2;
        LIZ.LIZIZ = LIZIZ2;
        LIZ.LIZJ = LIZLLL;
        List<AgeGateNavButton> navButtons = LJII().getNavButtons();
        if (navButtons != null) {
            ageGateNavButton = null;
            ageGateNavButton2 = null;
            for (AgeGateNavButton ageGateNavButton3 : navButtons) {
                Integer position = ageGateNavButton3.getPosition();
                int position2 = Jwg.AgeGateBtnPositionLeft.getPosition();
                if (position != null && position.intValue() == position2) {
                    ageGateNavButton = ageGateNavButton3;
                } else {
                    Integer position3 = ageGateNavButton3.getPosition();
                    int position4 = Jwg.AgeGateBtnPositionRight.getPosition();
                    if (position3 != null && position3.intValue() == position4) {
                        ageGateNavButton2 = ageGateNavButton3;
                    }
                }
            }
        } else {
            ageGateNavButton = null;
            ageGateNavButton2 = null;
        }
        3c7 LIZ2 = LIZ(2131362199);
        n.LIZIZ(LIZ2, "");
        LIZ2.setVisibility(0);
        3c7 LIZ3 = LIZ(2131362199);
        2uR r6 = new 2uR();
        3cI[] r5 = new 3cI[1];
        3cA LIZ4 = LIZ(ageGateNavButton);
        if (LIZ4 == null) {
            LIZ4 = new 3cA();
            LIZ4.LIZ(2131755170);
            LIZ4.LJ = LIZLLL().getCanQuit();
            LIZ4.LIZ(new C2742S7m(this));
        }
        r5[0] = LIZ4;
        r6.LIZ(r5);
        3cC r1 = new 3cC();
        String header = LJII().getHeader();
        if (header == null) {
            header = "";
        }
        r1.LIZ(header);
        r6.LIZ(r1);
        3cI[] r52 = new 3cI[1];
        3cA LIZ5 = LIZ(ageGateNavButton2);
        if (LIZ5 == null) {
            LIZ5 = new 3cA();
            LIZ5.LIZ(2131755603);
            LIZ5.LJ = LIZLLL().getShowRightBtn();
            LIZ5.LIZ(new KIR(this));
        }
        r52[0] = LIZ5;
        r6.LIZIZ(r52);
        r6.LIZLLL = false;
        LIZ3.setNavActions(r6);
        String title = LJII().getTitle();
        if (title == null || y.LIZ(title)) {
            z = true;
        } else {
            z = false;
        }
        int i2 = 8;
        if (z) {
            Qeg LIZ6 = LIZ(2131362192);
            n.LIZIZ(LIZ6, "");
            LIZ6.setVisibility(8);
        } else {
            Qeg LIZ7 = LIZ(2131362192);
            n.LIZIZ(LIZ7, "");
            LIZ7.setText(LJII().getTitle());
            Qeg LIZ8 = LIZ(2131362192);
            n.LIZIZ(LIZ8, "");
            LIZ8.setVisibility(0);
        }
        String contentDesc = LJII().getContentDesc();
        if (contentDesc == null || y.LIZ(contentDesc)) {
            z2 = true;
        } else {
            z2 = false;
        }
        if (z2) {
            Qeg LIZ9 = LIZ(2131362191);
            n.LIZIZ(LIZ9, "");
            LIZ9.setVisibility(8);
        } else {
            Qeg LIZ10 = LIZ(2131362191);
            n.LIZIZ(LIZ10, "");
            LIZ10.setText(LJII().getContentDesc());
            Qeg LIZ11 = LIZ(2131362191);
            n.LIZIZ(LIZ11, "");
            LIZ11.setVisibility(0);
        }
        LIZ(2131362191).setTextColor(070.LIZJ(requireContext(), 2131099757));
        if (LJII().getImageUrl() == null) {
            QJt LIZ12 = QHW.LIZ(2131231941);
            LIZ12.LJJIIZ = LIZ(2131362195);
            LIZ12.LIZJ();
        } else {
            String imageUrl = LJII().getImageUrl();
            if (imageUrl == null || !y.LIZ(imageUrl)) {
                String imageUrl2 = LJII().getImageUrl();
                if (imageUrl2 != null && (!y.LIZ(imageUrl2))) {
                    QJt LIZ13 = QHW.LIZ(Uri.parse(LJII().getImageUrl()));
                    LIZ13.LJJIIZ = LIZ(2131362195);
                    LIZ13.LIZJ();
                    SmartImageView LIZ14 = LIZ(2131362195);
                    n.LIZIZ(LIZ14, "");
                    LIZ14.setVisibility(0);
                }
            } else {
                SmartImageView LIZ15 = LIZ(2131362195);
                n.LIZIZ(LIZ15, "");
                LIZ15.setVisibility(8);
            }
        }
        S52 s522 = (S52) LIZ(2131362194);
        if (!(s522 == null || (editText = s522.getEditText()) == null)) {
            editText.setHint(LJII().getInputPlaceHolder());
            editText.setInputType(0);
            editText.setTypeface(Typeface.DEFAULT);
            editText.setEnabled(true);
        }
        S52 s523 = (S52) LIZ(2131362194);
        if (s523 != null) {
            s523.setAutoHideRules(new S7H(this));
        }
        CbG LIZ16 = LIZ(2131362198);
        if (LIZ16 != null) {
            LIZ16.setText(LJII().getNextBtnText());
        }
        Qeg LIZ17 = LIZ(2131368236);
        n.LIZIZ(LIZ17, "");
        if (LIZ().LJIIIZ) {
            i = 0;
        } else {
            i = 8;
        }
        LIZ17.setVisibility(i);
        List hyperLinks = LJII().getHyperLinks();
        if (hyperLinks != null && !hyperLinks.isEmpty()) {
            AppCompatTextView LIZ18 = LIZ(2131362191);
            n.LIZIZ(LIZ18, "");
            String obj = LIZ18.getText().toString();
            List<AgeGateHyperlink> hyperLinks2 = LJII().getHyperLinks();
            if (hyperLinks2 != null) {
                for (AgeGateHyperlink ageGateHyperlink : hyperLinks2) {
                    String ageGateHyperlinkText = ageGateHyperlink.getAgeGateHyperlinkText();
                    if (ageGateHyperlinkText == null) {
                        lf3 = new Lf3("");
                    }
                    obj = lf3.replace(obj, "<a href=\"" + ageGateHyperlink.getAgeGateHyperlinkAction() + "\">" + ageGateHyperlink.getAgeGateHyperlinkText() + "</a>");
                }
            }
            Qeg LIZ19 = LIZ(2131362191);
            n.LIZIZ(LIZ19, "");
            if (Build.VERSION.SDK_INT >= 24) {
                fromHtml = Html.fromHtml(obj, 63);
            } else {
                fromHtml = Html.fromHtml(obj);
            }
            LIZ19.setText(fromHtml);
            Qeg LIZ20 = LIZ(2131362191);
            n.LIZIZ(LIZ20, "");
            LIZ((TextView) LIZ20);
        }
        44V dateConfig = LIZLLL().getDateConfig();
        if (dateConfig != null) {
            try {
                if (36a.LIZ(dateConfig.getBirthday())) {
                    SimpleDateFormat simpleDateFormat = LIZ().LJ;
                    String birthday = dateConfig.getBirthday();
                    if (birthday == null) {
                        n.LIZIZ();
                    }
                    LJFF2 = simpleDateFormat.parse(birthday);
                } else {
                    LJFF2 = LIZ().LJFF();
                }
                LIZ().LJIIJ = LJFF2;
                if (36a.LIZ(dateConfig.getUpperBound())) {
                    calendar = Calendar.getInstance();
                    SimpleDateFormat simpleDateFormat2 = LIZ().LJ;
                    String upperBound = dateConfig.getUpperBound();
                    if (upperBound == null) {
                        n.LIZIZ();
                    }
                    calendar.setTime(simpleDateFormat2.parse(upperBound));
                } else {
                    calendar = null;
                }
                LIZ(2131362193).LIZ(LJFF2, calendar);
            } catch (Exception unused) {
                LIZ(2131362193).LIZ(LIZ().LJFF(), (Calendar) null);
            }
        } else {
            LIZ(2131362193).LIZ(LIZ().LJFF(), (Calendar) null);
        }
        44T editStatus = LIZLLL().getEditStatus();
        if (!(editStatus == null || (type = editStatus.getType()) == null || type.intValue() != 2 || (s52 = (S52) LIZ(2131362194)) == null)) {
            s52.setText(LIZ().LIZLLL());
        }
        S52 s524 = (S52) LIZ(2131362194);
        if (s524 != null) {
            s524.setTextWatcher(LIZ().LJIJ);
        }
        Qeg LIZ21 = LIZ(2131362197);
        if (LIZ21 != null) {
            if (LJII().getAgeIndicatorType() == 44P.DISPLAY) {
                i2 = 0;
            }
            LIZ21.setVisibility(i2);
        }
        OcZ LIZ22 = LIZ(2131362193);
        if (LIZ22 != null) {
            LIZ22.LIZ = LIZ().LJIJI;
        }
        CbG LIZ23 = LIZ(2131362198);
        if (LIZ23 != null) {
            LIZ23.setOnClickListener(LIZ().LJIJJ);
        }
        LIZ().LJIIL.observe(this, new 2iy(this));
        LIZ().LJIILIIL.observe(this, new 2iz(this));
        LIZ().LJIILLIIL.observe(this, new S78(this));
        LIZ().LJIILJJIL.observe(this, new S7T(this));
        LIZ().LJIILL.observe(this, new 2ix(this));
        S71 s71 = LIZ().LIZLLL;
        if (s71 != null) {
            FrameLayout frameLayout = (FrameLayout) LIZ(2131362190);
            n.LIZIZ(frameLayout, "");
            s71.LIZ((ViewGroup) frameLayout);
        }
        1hK activity = getActivity();
        if (activity != null) {
            KeyboardUtils.LIZ(activity, 48);
        }
        boolean LJIIIIZZ3 = LJIIIIZZ();
        AgeGateViewModel LIZ24 = LIZ();
        if (a.LJII().LIZ() == 3v1.US_FTC || ((LIZIZ = LIZ24.LIZIZ()) != null && LIZIZ.getAgeGateAction() == 3v1.US_FTC.getValue())) {
            z3 = true;
        } else {
            z3 = false;
        }
        C2716S6m.LIZIZ = (HashMap) this.LJIIL.getValue();
        C2716S6m.LIZJ = LJIIIIZZ3;
        C2716S6m.LIZLLL = z3;
        C2716S6m.LJ = SystemClock.elapsedRealtime() - C2716S6m.LIZ;
        if (LJIIIIZZ3) {
            str = "show_age_edit_page";
        } else if (z3) {
            str = "f_age_gate_show";
        } else {
            str = "age_gate_show";
        }
        2UX r12 = new 2UX();
        r12.LIZ(C2716S6m.LIZIZ);
        2nK.LIZ(str, r12.LIZ);
        if (9Y3.LIZ(9Y3.LIZ(), true, "rollout_test_ab", false)) {
            2nK.onEventV3("rollout_test_ab");
        }
        if (SettingsManager.LIZ().LIZ("rollout_test_setting", false)) {
            2nK.onEventV3("rollout_test_setting");
        }
    }

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