CheetahGram v8.5.4版本的 MD5 值为:3d14e79cc242c314d3933620ff3ab030

以下内容为反编译后的 y5.java 源代码,内容仅作参考


package org.telegram.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.StateListAnimator;
import android.animation.TimeInterpolator;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.graphics.Canvas;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.InputFilter;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.PasswordTransformationMethod;
import android.text.style.ClickableSpan;
import android.util.Base64;
import android.util.Property;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import co.cheetah.gram.R;
import com.google.firebase.analytics.FirebaseAnalytics;
import j$.util.Comparator$CC;
import j$.util.function.Function;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.PServices;
import org.telegram.messenger.SRPHelper;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.p110.ah5;
import org.telegram.messenger.p110.bh5;
import org.telegram.messenger.p110.bk6;
import org.telegram.messenger.p110.ch5;
import org.telegram.messenger.p110.cs1;
import org.telegram.messenger.p110.di5;
import org.telegram.messenger.p110.eh5;
import org.telegram.messenger.p110.ek7;
import org.telegram.messenger.p110.ey5;
import org.telegram.messenger.p110.f27;
import org.telegram.messenger.p110.fh5;
import org.telegram.messenger.p110.g52;
import org.telegram.messenger.p110.gh5;
import org.telegram.messenger.p110.gi0;
import org.telegram.messenger.p110.ha4;
import org.telegram.messenger.p110.hc5;
import org.telegram.messenger.p110.hh5;
import org.telegram.messenger.p110.i95;
import org.telegram.messenger.p110.ie5;
import org.telegram.messenger.p110.ih5;
import org.telegram.messenger.p110.ji0;
import org.telegram.messenger.p110.jj0;
import org.telegram.messenger.p110.ke4;
import org.telegram.messenger.p110.kh5;
import org.telegram.messenger.p110.lh5;
import org.telegram.messenger.p110.mh5;
import org.telegram.messenger.p110.mw5;
import org.telegram.messenger.p110.nh5;
import org.telegram.messenger.p110.o9;
import org.telegram.messenger.p110.oa4;
import org.telegram.messenger.p110.oa5;
import org.telegram.messenger.p110.oh5;
import org.telegram.messenger.p110.ov5;
import org.telegram.messenger.p110.ow5;
import org.telegram.messenger.p110.pg0;
import org.telegram.messenger.p110.ph5;
import org.telegram.messenger.p110.px5;
import org.telegram.messenger.p110.pz4;
import org.telegram.messenger.p110.qc5;
import org.telegram.messenger.p110.qh5;
import org.telegram.messenger.p110.rh5;
import org.telegram.messenger.p110.rp0;
import org.telegram.messenger.p110.sh5;
import org.telegram.messenger.p110.st4;
import org.telegram.messenger.p110.t27;
import org.telegram.messenger.p110.te5;
import org.telegram.messenger.p110.u27;
import org.telegram.messenger.p110.ue5;
import org.telegram.messenger.p110.ug5;
import org.telegram.messenger.p110.uh6;
import org.telegram.messenger.p110.uw3;
import org.telegram.messenger.p110.v27;
import org.telegram.messenger.p110.vg5;
import org.telegram.messenger.p110.vn7;
import org.telegram.messenger.p110.vq5;
import org.telegram.messenger.p110.wd5;
import org.telegram.messenger.p110.wg5;
import org.telegram.messenger.p110.wv1;
import org.telegram.messenger.p110.ww5;
import org.telegram.messenger.p110.x12;
import org.telegram.messenger.p110.xa5;
import org.telegram.messenger.p110.xg5;
import org.telegram.messenger.p110.yg5;
import org.telegram.messenger.p110.zg5;
import org.telegram.messenger.p110.zw5;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.ui.ActionBar.a;
import org.telegram.ui.ActionBar.a0;
import org.telegram.ui.ActionBar.i;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RadialProgressView;
import org.telegram.ui.Components.v3;
import org.telegram.ui.l3;
import org.telegram.ui.y5;
import uk.co.chrisjenx.calligraphy.BuildConfig;

@SuppressLint({"HardwareIds"})
public class y5 extends org.telegram.ui.ActionBar.k {
    private boolean A;
    private boolean B;
    private int G;
    private int H;
    private AnimatorSet[] I;
    private org.telegram.ui.ActionBar.d J;
    boolean Q;
    private org.telegram.ui.ActionBar.d R;
    private ha4 S;
    private AnimatorSet T;
    private rp0 U;
    private ImageView V;
    private FrameLayout W;
    private RadialProgressView X;
    private int Y;
    private boolean[] Z;
    private org.telegram.ui.ActionBar.i a0;
    private boolean b0;
    private px5 c0;
    private int q;
    private pz4[] r;
    private boolean s;
    private Dialog t;
    private Dialog u;
    private ArrayList<String> v;
    private ArrayList<String> w;
    private boolean x;
    private boolean y;
    private boolean z;

    class a extends a.h {
        final Context a;

        a(Context context) {
            this.a = context;
        }

        @Override
        public void b(int i) {
            if (i == 1) {
                y5.this.b3();
                return;
            }
            if (i == 200) {
                com.viewbadger.helperlib.Services.a.reLoad();
                Toast.makeText(this.a, LocaleController.getString("updating_proxy", R.string.updating_proxy), 0).show();
            } else if (i == 201) {
                y5.this.S0(new oa4());
            } else if (i == -1 && y5.this.x0()) {
                y5.this.D();
            }
        }
    }

    class b extends FrameLayout {
        b(Context context) {
            super(context);
        }

        @Override
        protected void onMeasure(int i, int i2) {
            int dp;
            ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) y5.this.W.getLayoutParams();
            if (org.telegram.ui.Components.s.s() == null || !org.telegram.ui.Components.s.s().y()) {
                dp = AndroidUtilities.dp(14.0f);
            } else {
                super.onMeasure(i, i2);
                dp = (AndroidUtilities.dp(14.0f) + org.telegram.ui.Components.s.s().r().getMeasuredHeight()) - AndroidUtilities.dp(10.0f);
            }
            marginLayoutParams.bottomMargin = dp;
            super.onMeasure(i, i2);
        }
    }

    class c extends ScrollView {
        c(Context context) {
            super(context);
        }

        @Override
        protected void onMeasure(int i, int i2) {
            y5.this.G = View.MeasureSpec.getSize(i2) - AndroidUtilities.dp(30.0f);
            super.onMeasure(i, i2);
        }

        @Override
        public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
            if (y5.this.q == 1 || y5.this.q == 2 || y5.this.q == 4) {
                rect.bottom += AndroidUtilities.dp(40.0f);
            }
            return super.requestChildRectangleOnScreen(view, rect, z);
        }
    }

    class d extends ViewOutlineProvider {
        d(y5 y5Var) {
        }

        @Override
        @SuppressLint({"NewApi"})
        public void getOutline(View view, Outline outline) {
            outline.setOval(0, 0, AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
        }
    }

    public class e extends AnimatorListenerAdapter {
        final boolean a;
        final boolean b;

        e(boolean z, boolean z2) {
            this.a = z;
            this.b = z2;
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            if (y5.this.I[!this.a ? 1 : 0] == null || !y5.this.I[!this.a ? 1 : 0].equals(animator)) {
                return;
            }
            y5.this.I[!this.a ? 1 : 0] = null;
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            if (y5.this.I[!this.a ? 1 : 0] == null || !y5.this.I[!this.a ? 1 : 0].equals(animator) || this.b) {
                return;
            }
            (this.a ? y5.this.W : y5.this.J).setVisibility(8);
        }
    }

    public class f extends AnimatorListenerAdapter {
        final boolean a;
        final boolean b;

        f(boolean z, boolean z2) {
            this.a = z;
            this.b = z2;
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            if (y5.this.T == null || !y5.this.T.equals(animator)) {
                return;
            }
            y5.this.T = null;
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            View contentView;
            if (y5.this.T == null || !y5.this.T.equals(animator)) {
                return;
            }
            if (this.a) {
                if (this.b) {
                    y5.this.V.setVisibility(4);
                    return;
                }
                contentView = y5.this.X;
            } else {
                if (!this.b) {
                    y5.this.U.setVisibility(4);
                    return;
                }
                contentView = y5.this.J.getContentView();
            }
            contentView.setVisibility(4);
        }
    }

    public class g extends AnimatorListenerAdapter {
        final boolean a;
        final pz4 b;

        g(boolean z, pz4 pz4Var) {
            this.a = z;
            this.b = pz4Var;
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            if (y5.this.H == 0 && this.a) {
                y5.this.f3(true, true);
            }
            this.b.setVisibility(8);
            this.b.setX(0.0f);
        }
    }

    public class h extends pz4 {
        private EditTextBoldCursor[] a;
        private TextView b;
        private TextView c;
        private String d;
        private String e;
        private String f;
        private te5 g;
        private Bundle h;
        private boolean i;
        private int j;

        public h(Context context, int i) {
            super(context);
            TextView textView;
            int i2;
            String str;
            EditTextBoldCursor editTextBoldCursor;
            int i3;
            String str2;
            this.j = i;
            setOrientation(1);
            this.a = new EditTextBoldCursor[i == 1 ? 1 : 2];
            TextView textView2 = new TextView(context);
            this.b = textView2;
            textView2.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.b.setTextSize(1, 14.0f);
            this.b.setGravity(LocaleController.isRTL ? 5 : 3);
            this.b.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.b, g52.l(-2, -2, LocaleController.isRTL ? 5 : 3));
            final int i4 = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr = this.a;
                if (i4 >= editTextBoldCursorArr.length) {
                    break;
                }
                editTextBoldCursorArr[i4] = new EditTextBoldCursor(context);
                this.a[i4].setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
                this.a[i4].setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
                this.a[i4].setCursorSize(AndroidUtilities.dp(20.0f));
                this.a[i4].setCursorWidth(1.5f);
                this.a[i4].setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
                this.a[i4].setBackgroundDrawable(org.telegram.ui.ActionBar.w.K0(context, false));
                this.a[i4].setImeOptions(268435461);
                this.a[i4].setTextSize(1, 18.0f);
                this.a[i4].setMaxLines(1);
                this.a[i4].setPadding(0, 0, 0, 0);
                if (i == 0) {
                    this.a[i4].setInputType(129);
                }
                this.a[i4].setTransformationMethod(PasswordTransformationMethod.getInstance());
                this.a[i4].setTypeface(Typeface.DEFAULT);
                this.a[i4].setGravity(LocaleController.isRTL ? 5 : 3);
                addView(this.a[i4], g52.m(-1, 36, 1, 0, i4 == 0 ? 20 : 30, 0, 0));
                this.a[i4].setOnEditorActionListener(new TextView.OnEditorActionListener() {
                    @Override
                    public final boolean onEditorAction(TextView textView3, int i5, KeyEvent keyEvent) {
                        boolean y;
                        y = y5.h.this.y(i4, textView3, i5, keyEvent);
                        return y;
                    }
                });
                EditTextBoldCursor[] editTextBoldCursorArr2 = this.a;
                if (i != 0) {
                    editTextBoldCursor = editTextBoldCursorArr2[i4];
                    i3 = R.string.PasswordHintPlaceholder;
                    str2 = "PasswordHintPlaceholder";
                } else if (i4 == 0) {
                    editTextBoldCursor = editTextBoldCursorArr2[i4];
                    i3 = R.string.PleaseEnterNewFirstPasswordHint;
                    str2 = "PleaseEnterNewFirstPasswordHint";
                } else {
                    editTextBoldCursor = editTextBoldCursorArr2[i4];
                    i3 = R.string.PleaseEnterNewSecondPasswordHint;
                    str2 = "PleaseEnterNewSecondPasswordHint";
                }
                editTextBoldCursor.setHint(LocaleController.getString(str2, i3));
                i4++;
            }
            if (i == 0) {
                textView = this.b;
                i2 = R.string.PleaseEnterNewFirstPasswordLogin;
                str = "PleaseEnterNewFirstPasswordLogin";
            } else {
                textView = this.b;
                i2 = R.string.PasswordHintTextLogin;
                str = "PasswordHintTextLogin";
            }
            textView.setText(LocaleController.getString(str, i2));
            TextView textView3 = new TextView(context);
            this.c = textView3;
            textView3.setGravity((LocaleController.isRTL ? 5 : 3) | 80);
            this.c.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
            this.c.setTextSize(1, 14.0f);
            this.c.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.c.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
            this.c.setText(LocaleController.getString("YourEmailSkip", R.string.YourEmailSkip));
            addView(this.c, g52.m(-2, -2, (LocaleController.isRTL ? 5 : 3) | 80, 0, 6, 0, 14));
            this.c.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    y5.h.this.z(view);
                }
            });
        }

        public void A() {
            EditTextBoldCursor[] editTextBoldCursorArr = this.a;
            if (editTextBoldCursorArr != null) {
                editTextBoldCursorArr[0].requestFocus();
                EditTextBoldCursor[] editTextBoldCursorArr2 = this.a;
                editTextBoldCursorArr2[0].setSelection(editTextBoldCursorArr2[0].length());
            }
        }

        public void B(ov5 ov5Var, i95 i95Var, String str, String str2) {
            if (ov5Var == null) {
                te5 te5Var = (te5) i95Var;
                this.g = te5Var;
                hf.u2(te5Var);
                I(str, str2);
            }
        }

        public void C(final String str, final String str2, final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.h.this.B(ov5Var, i95Var, str, str2);
                }
            });
        }

        public void D(i95 i95Var, DialogInterface dialogInterface, int i) {
            y5.this.Z2((ug5) i95Var);
        }

        public void E(ov5 ov5Var, final String str, final String str2, final i95 i95Var) {
            y5 y5Var;
            String string;
            String str3;
            String str4;
            int i;
            String str5;
            if (ov5Var != null && ("SRP_ID_INVALID".equals(ov5Var.b) || "NEW_SALT_INVALID".equals(ov5Var.b))) {
                ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(new ie5(), new RequestDelegate() {
                    @Override
                    public final void run(i95 i95Var2, ov5 ov5Var2) {
                        y5.h.this.C(str, str2, i95Var2, ov5Var2);
                    }
                }, 8);
                return;
            }
            y5.this.T2(false);
            if (i95Var instanceof t27) {
                i.C0142i c0142i = new i.C0142i(y5.this.c0());
                c0142i.s(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i2) {
                        y5.h.this.D(i95Var, dialogInterface, i2);
                    }
                });
                if (TextUtils.isEmpty(str)) {
                    i = R.string.PasswordReset;
                    str5 = "PasswordReset";
                } else {
                    i = R.string.YourPasswordChangedSuccessText;
                    str5 = "YourPasswordChangedSuccessText";
                }
                c0142i.l(LocaleController.getString(str5, i));
                c0142i.u(LocaleController.getString("TwoStepVerificationTitle", R.string.TwoStepVerificationTitle));
                Dialog o1 = y5.this.o1(c0142i.a());
                if (o1 != null) {
                    o1.setCanceledOnTouchOutside(false);
                    o1.setCancelable(false);
                    return;
                }
                return;
            }
            if (ov5Var != null) {
                this.i = false;
                if (ov5Var.b.startsWith("FLOOD_WAIT")) {
                    int intValue = Utilities.parseInt(ov5Var.b).intValue();
                    if (intValue < 60) {
                        str4 = "Seconds";
                    } else {
                        intValue /= 60;
                        str4 = "Minutes";
                    }
                    String formatPluralString = LocaleController.formatPluralString(str4, intValue);
                    y5Var = y5.this;
                    string = LocaleController.getString("AppName", R.string.AppName);
                    str3 = LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, formatPluralString);
                } else {
                    y5Var = y5.this;
                    string = LocaleController.getString("AppName", R.string.AppName);
                    str3 = ov5Var.b;
                }
                y5Var.V2(string, str3);
            }
        }

        public void F(final String str, final String str2, final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.h.this.E(ov5Var, str, str2, i95Var);
                }
            });
        }

        public void G(final String str, final String str2, gh5 gh5Var) {
            byte[] stringBytes = str != null ? AndroidUtilities.getStringBytes(str) : null;
            RequestDelegate requestDelegate = new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.h.this.F(str, str2, i95Var, ov5Var);
                }
            };
            hc5 hc5Var = this.g.j;
            if (!(hc5Var instanceof bk6)) {
                ov5 ov5Var = new ov5();
                ov5Var.b = "PASSWORD_HASH_INVALID";
                requestDelegate.run(null, ov5Var);
                return;
            }
            if (str != null) {
                gh5Var.c.c = SRPHelper.getVBytes(stringBytes, (bk6) hc5Var);
                if (gh5Var.c.c == null) {
                    ov5 ov5Var2 = new ov5();
                    ov5Var2.b = "ALGO_INVALID";
                    requestDelegate.run(null, ov5Var2);
                }
            }
            ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(gh5Var, requestDelegate, 10);
        }

        private void H(boolean z, int i) {
            if (y5.this.c0() == null) {
                return;
            }
            Vibrator vibrator = (Vibrator) y5.this.c0().getSystemService("vibrator");
            if (vibrator != null) {
                vibrator.vibrate(200L);
            }
            AndroidUtilities.shakeView(this.a[i], 2.0f, 0);
        }

        private void I(final String str, final String str2) {
            final gh5 gh5Var = new gh5();
            gh5Var.b = this.d;
            if (!TextUtils.isEmpty(str)) {
                gh5Var.a |= 1;
                ue5 ue5Var = new ue5();
                gh5Var.c = ue5Var;
                ue5Var.a |= 1;
                ue5Var.d = str2 != null ? str2 : BuildConfig.FLAVOR;
                ue5Var.b = this.g.j;
            }
            Utilities.globalQueue.postRunnable(new Runnable() {
                @Override
                public final void run() {
                    y5.h.this.G(str, str2, gh5Var);
                }
            });
        }

        public boolean y(int i, TextView textView, int i2, KeyEvent keyEvent) {
            if (i == 0) {
                EditTextBoldCursor[] editTextBoldCursorArr = this.a;
                if (editTextBoldCursorArr.length == 2) {
                    editTextBoldCursorArr[1].requestFocus();
                    return true;
                }
            }
            if (i2 != 5) {
                return false;
            }
            f(null);
            return true;
        }

        public void z(View view) {
            if (this.j == 0) {
                I(null, null);
            } else {
                I(this.e, null);
            }
        }

        @Override
        public boolean a() {
            return true;
        }

        @Override
        public boolean b(boolean z) {
            y5.this.T2(true);
            this.h = null;
            this.i = false;
            return true;
        }

        @Override
        public void d() {
            this.i = false;
        }

        @Override
        public void f(String str) {
            if (this.i) {
                return;
            }
            String obj = this.a[0].getText().toString();
            if (obj.length() == 0) {
                H(false, 0);
                return;
            }
            if (this.j != 0) {
                this.i = true;
                y5.this.X2(0);
                I(this.e, obj);
            } else {
                if (!obj.equals(this.a[1].getText().toString())) {
                    H(false, 1);
                    return;
                }
                Bundle bundle = new Bundle();
                bundle.putString("emailCode", this.d);
                bundle.putString("new_password", obj);
                bundle.putString("password", this.f);
                y5.this.e3(10, true, bundle, false);
            }
        }

        @Override
        public void g() {
            super.g();
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.h.this.A();
                }
            }, 100L);
        }

        @Override
        public String getHeaderName() {
            return LocaleController.getString("NewPassword", R.string.NewPassword);
        }

        @Override
        public void h(Bundle bundle) {
            Bundle bundle2 = bundle.getBundle("recoveryview_params" + this.j);
            this.h = bundle2;
            if (bundle2 != null) {
                j(bundle2, true);
            }
        }

        @Override
        public void i(Bundle bundle) {
            if (this.h != null) {
                bundle.putBundle("recoveryview_params" + this.j, this.h);
            }
        }

        @Override
        public void j(Bundle bundle, boolean z) {
            if (bundle == null) {
                return;
            }
            int i = 0;
            while (true) {
                EditTextBoldCursor[] editTextBoldCursorArr = this.a;
                if (i >= editTextBoldCursorArr.length) {
                    break;
                }
                editTextBoldCursorArr[i].setText(BuildConfig.FLAVOR);
                i++;
            }
            this.h = bundle;
            this.d = bundle.getString("emailCode");
            String string = this.h.getString("password");
            this.f = string;
            if (string != null) {
                st4 st4Var = new st4(Utilities.hexToBytes(string));
                te5 a = te5.a(st4Var, st4Var.readInt32(false), false);
                this.g = a;
                hf.u2(a);
            }
            this.e = this.h.getString("new_password");
            AndroidUtilities.showKeyboard(this.a[0]);
            this.a[0].requestFocus();
        }
    }

    public class i extends pz4 {
        private EditTextBoldCursor a;
        private TextView b;
        private TextView c;
        private TextView d;
        private TextView e;
        private Bundle f;
        private boolean g;
        private te5 h;
        private String i;
        private String j;
        private String k;
        private String l;

        public i(Context context) {
            super(context);
            setOrientation(1);
            TextView textView = new TextView(context);
            this.b = textView;
            textView.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.b.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.b.setTextSize(1, 14.0f);
            this.b.setGravity(LocaleController.isRTL ? 5 : 3);
            this.b.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.b.setText(LocaleController.getString("LoginPasswordText", R.string.LoginPasswordText));
            addView(this.b, g52.l(-2, -2, LocaleController.isRTL ? 5 : 3));
            EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
            this.a = editTextBoldCursor;
            editTextBoldCursor.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.a.setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.a.setCursorSize(AndroidUtilities.dp(20.0f));
            this.a.setCursorWidth(1.5f);
            this.a.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.a.setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
            this.a.setBackgroundDrawable(org.telegram.ui.ActionBar.w.K0(context, false));
            this.a.setHint(LocaleController.getString("LoginPassword", R.string.LoginPassword));
            this.a.setImeOptions(268435461);
            this.a.setTextSize(1, 18.0f);
            this.a.setMaxLines(1);
            this.a.setPadding(0, 0, 0, 0);
            this.a.setInputType(129);
            this.a.setTransformationMethod(PasswordTransformationMethod.getInstance());
            this.a.setTypeface(Typeface.DEFAULT);
            this.a.setGravity(LocaleController.isRTL ? 5 : 3);
            addView(this.a, g52.m(-1, 36, 1, 0, 20, 0, 0));
            this.a.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public final boolean onEditorAction(TextView textView2, int i, KeyEvent keyEvent) {
                    boolean I;
                    I = y5.i.this.I(textView2, i, keyEvent);
                    return I;
                }
            });
            TextView textView2 = new TextView(context);
            this.e = textView2;
            textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.e.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
            this.e.setText(LocaleController.getString("ForgotPassword", R.string.ForgotPassword));
            this.e.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.e.setTextSize(1, 14.0f);
            this.e.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.e.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
            addView(this.e, g52.l(-1, -2, (LocaleController.isRTL ? 5 : 3) | 48));
            this.e.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    y5.i.this.M(view);
                }
            });
            TextView textView3 = new TextView(context);
            this.c = textView3;
            textView3.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.c.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteRedText6"));
            this.c.setVisibility(8);
            this.c.setText(LocaleController.getString("ResetMyAccount", R.string.ResetMyAccount));
            this.c.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.c.setTextSize(1, 14.0f);
            this.c.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.c.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
            addView(this.c, g52.m(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 34, 0, 0));
            this.c.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    y5.i.this.Q(view);
                }
            });
            TextView textView4 = new TextView(context);
            this.d = textView4;
            textView4.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.d.setVisibility(8);
            this.d.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.d.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.d.setText(LocaleController.getString("ResetMyAccountText", R.string.ResetMyAccountText));
            this.d.setTextSize(1, 14.0f);
            this.d.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.d, g52.m(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 7, 0, 14));
        }

        public boolean I(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            f(null);
            return true;
        }

        public void J(fh5 fh5Var, DialogInterface dialogInterface, int i) {
            Bundle bundle = new Bundle();
            bundle.putString("email_unconfirmed_pattern", fh5Var.a);
            bundle.putString("password", this.i);
            y5.this.e3(7, true, bundle, false);
        }

        public void K(ov5 ov5Var, i95 i95Var) {
            String str;
            y5.this.T2(false);
            if (ov5Var == null) {
                final fh5 fh5Var = (fh5) i95Var;
                i.C0142i c0142i = new i.C0142i(y5.this.c0());
                c0142i.l(LocaleController.formatString("RestoreEmailSent", R.string.RestoreEmailSent, fh5Var.a));
                c0142i.u(LocaleController.getString("RestoreEmailSentTitle", R.string.RestoreEmailSentTitle));
                c0142i.s(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i) {
                        y5.i.this.J(fh5Var, dialogInterface, i);
                    }
                });
                Dialog o1 = y5.this.o1(c0142i.a());
                if (o1 != null) {
                    o1.setCanceledOnTouchOutside(false);
                    o1.setCancelable(false);
                    return;
                }
                return;
            }
            if (!ov5Var.b.startsWith("FLOOD_WAIT")) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
                return;
            }
            int intValue = Utilities.parseInt(ov5Var.b).intValue();
            if (intValue < 60) {
                str = "Seconds";
            } else {
                intValue /= 60;
                str = "Minutes";
            }
            y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, LocaleController.formatPluralString(str, intValue)));
        }

        public void L(final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.i.this.K(ov5Var, i95Var);
                }
            });
        }

        public void M(View view) {
            if (y5.this.U.getTag() != null) {
                return;
            }
            if (this.h.b) {
                y5.this.X2(0);
                ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(new hh5(), new RequestDelegate() {
                    @Override
                    public final void run(i95 i95Var, ov5 ov5Var) {
                        y5.i.this.L(i95Var, ov5Var);
                    }
                }, 10);
            } else {
                this.d.setVisibility(0);
                this.c.setVisibility(0);
                AndroidUtilities.hideKeyboard(this.a);
                y5.this.V2(LocaleController.getString("RestorePasswordNoEitle", R.string.RestorePasswordNoEmailTitle), LocaleController.getString("RestorePasswordNoEmailText", R.string.RestorePasswordNoEmailText));
            }
        }

        public void N(ov5 ov5Var) {
            y5.this.T2(false);
            if (ov5Var == null) {
                Bundle bundle = new Bundle();
                bundle.putString("phoneFormated", this.j);
                bundle.putString("phoneHash", this.k);
                bundle.putString("code", this.l);
                y5.this.e3(5, true, bundle, false);
                return;
            }
            if (ov5Var.b.equals("2FA_RECENT_CONFIRM")) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ResetAccountCancelledAlert", R.string.ResetAccountCancelledAlert));
                return;
            }
            if (!ov5Var.b.startsWith("2FA_CONFIRM_WAIT_")) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
                return;
            }
            Bundle bundle2 = new Bundle();
            bundle2.putString("phoneFormated", this.j);
            bundle2.putString("phoneHash", this.k);
            bundle2.putString("code", this.l);
            bundle2.putInt("startTime", ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).getCurrentTime());
            bundle2.putInt("waitTime", Utilities.parseInt(ov5Var.b.replace("2FA_CONFIRM_WAIT_", BuildConfig.FLAVOR)).intValue());
            y5.this.e3(8, true, bundle2, false);
        }

        public void O(i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.i.this.N(ov5Var);
                }
            });
        }

        public void P(DialogInterface dialogInterface, int i) {
            y5.this.X2(0);
            wd5 wd5Var = new wd5();
            wd5Var.a = "Forgot password";
            ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(wd5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.i.this.O(i95Var, ov5Var);
                }
            }, 10);
        }

        public void Q(View view) {
            if (y5.this.U.getTag() != null) {
                return;
            }
            i.C0142i c0142i = new i.C0142i(y5.this.c0());
            c0142i.l(LocaleController.getString("ResetMyAccountWarningText", R.string.ResetMyAccountWarningText));
            c0142i.u(LocaleController.getString("ResetMyAccountWarning", R.string.ResetMyAccountWarning));
            c0142i.s(LocaleController.getString("ResetMyAccountWarningReset", R.string.ResetMyAccountWarningReset), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    y5.i.this.P(dialogInterface, i);
                }
            });
            c0142i.n(LocaleController.getString("Cancel", R.string.Cancel), null);
            y5.this.o1(c0142i.a());
        }

        public void R(final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.i.this.W(ov5Var, i95Var);
                }
            });
        }

        public void S(i95 i95Var) {
            y5.this.U2(false, false);
            AndroidUtilities.hideKeyboard(this.a);
            y5.this.Z2((ug5) i95Var);
        }

        public void T(ov5 ov5Var, final i95 i95Var) {
            String str;
            this.g = false;
            if (ov5Var != null && "SRP_ID_INVALID".equals(ov5Var.b)) {
                ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(new ie5(), new RequestDelegate() {
                    @Override
                    public final void run(i95 i95Var2, ov5 ov5Var2) {
                        y5.i.this.R(i95Var2, ov5Var2);
                    }
                }, 8);
                return;
            }
            if (i95Var instanceof ug5) {
                y5.this.f3(false, true);
                postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        y5.i.this.S(i95Var);
                    }
                }, 150L);
                return;
            }
            y5.this.T2(false);
            if (ov5Var.b.equals("PASSWORD_HASH_INVALID")) {
                Y(true);
                return;
            }
            if (!ov5Var.b.startsWith("FLOOD_WAIT")) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
                return;
            }
            int intValue = Utilities.parseInt(ov5Var.b).intValue();
            if (intValue < 60) {
                str = "Seconds";
            } else {
                intValue /= 60;
                str = "Minutes";
            }
            y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, LocaleController.formatPluralString(str, intValue)));
        }

        public void U(final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.i.this.T(ov5Var, i95Var);
                }
            });
        }

        public void V(String str) {
            hc5 hc5Var = this.h.e;
            boolean z = hc5Var instanceof bk6;
            byte[] x = z ? SRPHelper.getX(AndroidUtilities.getStringBytes(str), (bk6) hc5Var) : null;
            xg5 xg5Var = new xg5();
            RequestDelegate requestDelegate = new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.i.this.U(i95Var, ov5Var);
                }
            };
            if (z) {
                te5 te5Var = this.h;
                ey5 startCheck = SRPHelper.startCheck(x, te5Var.g, te5Var.f, (bk6) hc5Var);
                xg5Var.a = startCheck;
                if (startCheck != null) {
                    ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(xg5Var, requestDelegate, 10);
                    return;
                }
                ov5 ov5Var = new ov5();
                ov5Var.b = "PASSWORD_HASH_INVALID";
                requestDelegate.run(null, ov5Var);
            }
        }

        public void W(ov5 ov5Var, i95 i95Var) {
            if (ov5Var == null) {
                this.h = (te5) i95Var;
                f(null);
            }
        }

        public void X() {
            EditTextBoldCursor editTextBoldCursor = this.a;
            if (editTextBoldCursor != null) {
                editTextBoldCursor.requestFocus();
                EditTextBoldCursor editTextBoldCursor2 = this.a;
                editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
                AndroidUtilities.showKeyboard(this.a);
            }
        }

        private void Y(boolean z) {
            if (y5.this.c0() == null) {
                return;
            }
            if (z) {
                this.a.setText(BuildConfig.FLAVOR);
            }
            y5.this.c3(this.b);
        }

        @Override
        public boolean a() {
            return true;
        }

        @Override
        public boolean b(boolean z) {
            this.g = false;
            y5.this.T2(true);
            this.f = null;
            return true;
        }

        @Override
        public void d() {
            this.g = false;
        }

        @Override
        public void f(String str) {
            if (this.g) {
                return;
            }
            final String obj = this.a.getText().toString();
            if (obj.length() == 0) {
                Y(false);
                return;
            }
            this.g = true;
            y5.this.X2(0);
            Utilities.globalQueue.postRunnable(new Runnable() {
                @Override
                public final void run() {
                    y5.i.this.V(obj);
                }
            });
        }

        @Override
        public void g() {
            super.g();
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.i.this.X();
                }
            }, 100L);
        }

        @Override
        public String getHeaderName() {
            return LocaleController.getString("LoginPassword", R.string.LoginPassword);
        }

        @Override
        public void h(Bundle bundle) {
            Bundle bundle2 = bundle.getBundle("passview_params");
            this.f = bundle2;
            if (bundle2 != null) {
                j(bundle2, true);
            }
            String string = bundle.getString("passview_code");
            if (string != null) {
                this.a.setText(string);
            }
        }

        @Override
        public void i(Bundle bundle) {
            String obj = this.a.getText().toString();
            if (obj.length() != 0) {
                bundle.putString("passview_code", obj);
            }
            Bundle bundle2 = this.f;
            if (bundle2 != null) {
                bundle.putBundle("passview_params", bundle2);
            }
        }

        @Override
        public void j(Bundle bundle, boolean z) {
            EditTextBoldCursor editTextBoldCursor;
            String string;
            if (bundle == null) {
                return;
            }
            if (bundle.isEmpty()) {
                this.c.setVisibility(0);
                this.d.setVisibility(0);
                AndroidUtilities.hideKeyboard(this.a);
                return;
            }
            this.c.setVisibility(8);
            this.d.setVisibility(8);
            this.a.setText(BuildConfig.FLAVOR);
            this.f = bundle;
            String string2 = bundle.getString("password");
            this.i = string2;
            if (string2 != null) {
                st4 st4Var = new st4(Utilities.hexToBytes(string2));
                this.h = te5.a(st4Var, st4Var.readInt32(false), false);
            }
            this.j = bundle.getString("phoneFormated");
            this.k = bundle.getString("phoneHash");
            this.l = bundle.getString("code");
            te5 te5Var = this.h;
            if (te5Var == null || TextUtils.isEmpty(te5Var.h)) {
                editTextBoldCursor = this.a;
                string = LocaleController.getString("LoginPassword", R.string.LoginPassword);
            } else {
                editTextBoldCursor = this.a;
                string = this.h.h;
            }
            editTextBoldCursor.setHint(string);
        }
    }

    public class j extends pz4 {
        private EditTextBoldCursor a;
        private TextView b;
        private TextView c;
        private Bundle d;
        private String e;
        private boolean f;

        public j(Context context) {
            super(context);
            setOrientation(1);
            TextView textView = new TextView(context);
            this.b = textView;
            textView.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.b.setTextSize(1, 14.0f);
            this.b.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.b.setGravity(LocaleController.isRTL ? 5 : 3);
            this.b.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.b.setText(LocaleController.getString("RestoreEmailSentInfo", R.string.RestoreEmailSentInfo));
            addView(this.b, g52.l(-2, -2, LocaleController.isRTL ? 5 : 3));
            EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
            this.a = editTextBoldCursor;
            editTextBoldCursor.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.a.setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.a.setCursorSize(AndroidUtilities.dp(20.0f));
            this.a.setCursorWidth(1.5f);
            this.a.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.a.setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
            this.a.setBackgroundDrawable(org.telegram.ui.ActionBar.w.K0(context, false));
            this.a.setHint(LocaleController.getString("PasswordCode", R.string.PasswordCode));
            this.a.setImeOptions(268435461);
            this.a.setTextSize(1, 18.0f);
            this.a.setMaxLines(1);
            this.a.setPadding(0, 0, 0, 0);
            this.a.setInputType(3);
            this.a.setTransformationMethod(PasswordTransformationMethod.getInstance());
            this.a.setTypeface(Typeface.DEFAULT);
            this.a.setGravity(LocaleController.isRTL ? 5 : 3);
            addView(this.a, g52.m(-1, 36, 1, 0, 20, 0, 0));
            this.a.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public final boolean onEditorAction(TextView textView2, int i, KeyEvent keyEvent) {
                    boolean w;
                    w = y5.j.this.w(textView2, i, keyEvent);
                    return w;
                }
            });
            TextView textView2 = new TextView(context);
            this.c = textView2;
            textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 80);
            this.c.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
            this.c.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.c.setTextSize(1, 14.0f);
            this.c.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.c.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
            addView(this.c, g52.m(-2, -2, (LocaleController.isRTL ? 5 : 3) | 80, 0, 0, 0, 14));
            this.c.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    y5.j.this.y(view);
                }
            });
        }

        public void A(final String str, final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.j.this.z(i95Var, str, ov5Var);
                }
            });
        }

        public void B() {
            EditTextBoldCursor editTextBoldCursor = this.a;
            if (editTextBoldCursor != null) {
                editTextBoldCursor.requestFocus();
                EditTextBoldCursor editTextBoldCursor2 = this.a;
                editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
            }
        }

        private void C(boolean z) {
            if (y5.this.c0() == null) {
                return;
            }
            Vibrator vibrator = (Vibrator) y5.this.c0().getSystemService("vibrator");
            if (vibrator != null) {
                vibrator.vibrate(200L);
            }
            if (z) {
                this.a.setText(BuildConfig.FLAVOR);
            }
            AndroidUtilities.shakeView(this.b, 2.0f, 0);
        }

        public boolean w(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            f(null);
            return true;
        }

        public void x(DialogInterface dialogInterface, int i) {
            y5.this.e3(6, true, new Bundle(), true);
        }

        public void y(View view) {
            i.C0142i c0142i = new i.C0142i(y5.this.c0());
            c0142i.l(LocaleController.getString("RestoreEmailTroubleText", R.string.RestoreEmailTroubleText));
            c0142i.u(LocaleController.getString("RestorePasswordNoEmailTitle", R.string.RestorePasswordNoEmailTitle));
            c0142i.s(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    y5.j.this.x(dialogInterface, i);
                }
            });
            Dialog o1 = y5.this.o1(c0142i.a());
            if (o1 != null) {
                o1.setCanceledOnTouchOutside(false);
                o1.setCancelable(false);
            }
        }

        public void z(i95 i95Var, String str, ov5 ov5Var) {
            String str2;
            y5.this.T2(false);
            this.f = false;
            if (i95Var instanceof di5) {
                Bundle bundle = new Bundle();
                bundle.putString("emailCode", str);
                bundle.putString("password", this.e);
                y5.this.e3(9, true, bundle, false);
                return;
            }
            if (ov5Var == null || ov5Var.b.startsWith("CODE_INVALID")) {
                C(true);
                return;
            }
            if (!ov5Var.b.startsWith("FLOOD_WAIT")) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
                return;
            }
            int intValue = Utilities.parseInt(ov5Var.b).intValue();
            if (intValue < 60) {
                str2 = "Seconds";
            } else {
                intValue /= 60;
                str2 = "Minutes";
            }
            y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, LocaleController.formatPluralString(str2, intValue)));
        }

        @Override
        public boolean a() {
            return true;
        }

        @Override
        public boolean b(boolean z) {
            y5.this.T2(true);
            this.d = null;
            this.f = false;
            return true;
        }

        @Override
        public void d() {
            this.f = false;
        }

        @Override
        public void f(String str) {
            if (this.f) {
                return;
            }
            final String obj = this.a.getText().toString();
            if (obj.length() == 0) {
                C(false);
                return;
            }
            this.f = true;
            y5.this.X2(0);
            yg5 yg5Var = new yg5();
            yg5Var.a = obj;
            ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(yg5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.j.this.A(obj, i95Var, ov5Var);
                }
            }, 10);
        }

        @Override
        public void g() {
            super.g();
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.j.this.B();
                }
            }, 100L);
        }

        @Override
        public String getHeaderName() {
            return LocaleController.getString("LoginPassword", R.string.LoginPassword);
        }

        @Override
        public void h(Bundle bundle) {
            Bundle bundle2 = bundle.getBundle("recoveryview_params");
            this.d = bundle2;
            if (bundle2 != null) {
                j(bundle2, true);
            }
            String string = bundle.getString("recoveryview_code");
            if (string != null) {
                this.a.setText(string);
            }
        }

        @Override
        public void i(Bundle bundle) {
            String obj = this.a.getText().toString();
            if (obj != null && obj.length() != 0) {
                bundle.putString("recoveryview_code", obj);
            }
            Bundle bundle2 = this.d;
            if (bundle2 != null) {
                bundle.putBundle("recoveryview_params", bundle2);
            }
        }

        @Override
        public void j(Bundle bundle, boolean z) {
            if (bundle == null) {
                return;
            }
            this.a.setText(BuildConfig.FLAVOR);
            this.d = bundle;
            this.e = bundle.getString("password");
            this.c.setText(LocaleController.formatString("RestoreEmailTrouble", R.string.RestoreEmailTrouble, this.d.getString("email_unconfirmed_pattern")));
            AndroidUtilities.showKeyboard(this.a);
            this.a.requestFocus();
        }
    }

    public class k extends pz4 implements v3.e {
        private EditTextBoldCursor a;
        private EditTextBoldCursor b;
        private org.telegram.messenger.p110.pf c;
        private org.telegram.messenger.p110.xe d;
        private View e;
        private ke4 f;
        private RadialProgressView g;
        private AnimatorSet h;
        private TextView i;
        private TextView j;
        private TextView k;
        private String l;
        private String m;
        private Bundle n;
        private boolean o;
        private RLottieDrawable p;
        private org.telegram.ui.Components.v3 q;
        private oa5 r;
        private oa5 s;

        class a extends org.telegram.messenger.p110.pf {
            a(Context context, y5 y5Var) {
                super(context);
            }

            @Override
            public void invalidate() {
                if (k.this.e != null) {
                    k.this.e.invalidate();
                }
                super.invalidate();
            }

            @Override
            public void invalidate(int i, int i2, int i3, int i4) {
                if (k.this.e != null) {
                    k.this.e.invalidate();
                }
                super.invalidate(i, i2, i3, i4);
            }
        }

        class b extends View {
            final Paint a;

            b(Context context, y5 y5Var, Paint paint) {
                super(context);
                this.a = paint;
            }

            @Override
            protected void onDraw(Canvas canvas) {
                if (k.this.c == null || k.this.g.getVisibility() != 0) {
                    return;
                }
                this.a.setAlpha((int) (k.this.c.getImageReceiver().getCurrentAlpha() * 85.0f * k.this.g.getAlpha()));
                canvas.drawCircle(getMeasuredWidth() / 2.0f, getMeasuredHeight() / 2.0f, getMeasuredWidth() / 2.0f, this.a);
            }
        }

        class c extends ke4 {
            c(Context context, y5 y5Var) {
                super(context);
            }

            @Override
            public void invalidate() {
                super.invalidate();
                k.this.e.invalidate();
            }

            @Override
            public void invalidate(int i, int i2, int i3, int i4) {
                super.invalidate(i, i2, i3, i4);
                k.this.e.invalidate();
            }
        }

        class d extends RadialProgressView {
            d(Context context, y5 y5Var) {
                super(context);
            }

            @Override
            public void setAlpha(float f) {
                super.setAlpha(f);
                k.this.e.invalidate();
            }
        }

        public class e extends AnimatorListenerAdapter {
            final boolean a;

            e(boolean z) {
                this.a = z;
            }

            @Override
            public void onAnimationCancel(Animator animator) {
                k.this.h = null;
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                if (k.this.h == null || k.this.f == null) {
                    return;
                }
                if (this.a) {
                    k.this.f.setVisibility(4);
                } else {
                    k.this.g.setVisibility(4);
                }
                k.this.h = null;
            }
        }

        public class f extends ClickableSpan {
            public f() {
            }

            @Override
            public void onClick(View view) {
                k.this.h0(false);
            }

            @Override
            public void updateDrawState(TextPaint textPaint) {
                super.updateDrawState(textPaint);
                textPaint.setUnderlineText(false);
            }
        }

        public k(Context context) {
            super(context);
            this.o = false;
            setOrientation(1);
            org.telegram.ui.Components.v3 v3Var = new org.telegram.ui.Components.v3(false);
            this.q = v3Var;
            v3Var.E(true);
            this.q.F(false);
            this.q.I(false);
            org.telegram.ui.Components.v3 v3Var2 = this.q;
            v3Var2.a = y5.this;
            v3Var2.C(this);
            TextView textView = new TextView(context);
            this.i = textView;
            textView.setText(LocaleController.getString("RegisterText2", R.string.RegisterText2));
            this.i.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.i.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.i.setGravity(LocaleController.isRTL ? 5 : 3);
            this.i.setTextSize(1, 14.0f);
            addView(this.i, g52.m(-2, -2, LocaleController.isRTL ? 5 : 3, 0, 0, 0, 0));
            FrameLayout frameLayout = new FrameLayout(context);
            addView(frameLayout, g52.h(-1, -2, 0.0f, 21.0f, 0.0f, 0.0f));
            this.d = new org.telegram.messenger.p110.xe();
            a aVar = new a(context, y5.this);
            this.c = aVar;
            aVar.setRoundRadius(AndroidUtilities.dp(32.0f));
            this.d.o(5L, null, null);
            this.c.setImageDrawable(this.d);
            frameLayout.addView(this.c, g52.b(64, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
            Paint paint = new Paint(1);
            paint.setColor(1426063360);
            b bVar = new b(context, y5.this, paint);
            this.e = bVar;
            frameLayout.addView(bVar, g52.b(64, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
            this.e.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    y5.k.this.T(view);
                }
            });
            this.p = new RLottieDrawable(R.raw.camera, "2131558410", AndroidUtilities.dp(60.0f), AndroidUtilities.dp(60.0f), false, null);
            c cVar = new c(context, y5.this);
            this.f = cVar;
            cVar.setScaleType(ImageView.ScaleType.CENTER);
            this.f.setAnimation(this.p);
            this.f.setEnabled(false);
            this.f.setClickable(false);
            this.f.setPadding(AndroidUtilities.dp(2.0f), 0, 0, AndroidUtilities.dp(1.0f));
            frameLayout.addView(this.f, g52.b(64, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
            d dVar = new d(context, y5.this);
            this.g = dVar;
            dVar.setSize(AndroidUtilities.dp(30.0f));
            this.g.setProgressColor(-1);
            frameLayout.addView(this.g, g52.b(64, 64.0f, (LocaleController.isRTL ? 5 : 3) | 48, 0.0f, 16.0f, 0.0f, 0.0f));
            g0(false, false);
            EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
            this.a = editTextBoldCursor;
            editTextBoldCursor.setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
            this.a.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.a.setBackgroundDrawable(org.telegram.ui.ActionBar.w.K0(context, false));
            this.a.setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.a.setCursorSize(AndroidUtilities.dp(20.0f));
            this.a.setCursorWidth(1.5f);
            this.a.setHint(LocaleController.getString("FirstName", R.string.FirstName));
            this.a.setImeOptions(268435461);
            this.a.setTextSize(1, 17.0f);
            this.a.setMaxLines(1);
            this.a.setInputType(8192);
            EditTextBoldCursor editTextBoldCursor2 = this.a;
            boolean z = LocaleController.isRTL;
            frameLayout.addView(editTextBoldCursor2, g52.b(-1, 36.0f, (z ? 5 : 3) | 48, z ? 0.0f : 85.0f, 0.0f, z ? 85.0f : 0.0f, 0.0f));
            this.a.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public final boolean onEditorAction(TextView textView2, int i, KeyEvent keyEvent) {
                    boolean U;
                    U = y5.k.this.U(textView2, i, keyEvent);
                    return U;
                }
            });
            EditTextBoldCursor editTextBoldCursor3 = new EditTextBoldCursor(context);
            this.b = editTextBoldCursor3;
            editTextBoldCursor3.setHint(LocaleController.getString("LastName", R.string.LastName));
            this.b.setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
            this.b.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.b.setBackgroundDrawable(org.telegram.ui.ActionBar.w.K0(context, false));
            this.b.setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.b.setCursorSize(AndroidUtilities.dp(20.0f));
            this.b.setCursorWidth(1.5f);
            this.b.setImeOptions(268435462);
            this.b.setTextSize(1, 17.0f);
            this.b.setMaxLines(1);
            this.b.setInputType(8192);
            EditTextBoldCursor editTextBoldCursor4 = this.b;
            boolean z2 = LocaleController.isRTL;
            frameLayout.addView(editTextBoldCursor4, g52.b(-1, 36.0f, (z2 ? 5 : 3) | 48, z2 ? 0.0f : 85.0f, 51.0f, z2 ? 85.0f : 0.0f, 0.0f));
            this.b.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public final boolean onEditorAction(TextView textView2, int i, KeyEvent keyEvent) {
                    boolean V;
                    V = y5.k.this.V(textView2, i, keyEvent);
                    return V;
                }
            });
            TextView textView2 = new TextView(context);
            this.j = textView2;
            textView2.setText(LocaleController.getString("CancelRegistration", R.string.CancelRegistration));
            this.j.setGravity((LocaleController.isRTL ? 5 : 3) | 1);
            this.j.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
            this.j.setTextSize(1, 14.0f);
            this.j.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.j.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.j.setPadding(0, AndroidUtilities.dp(24.0f), 0, 0);
            this.j.setVisibility(8);
            addView(this.j, g52.m(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 20, 0, 0));
            this.j.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    y5.k.this.W(view);
                }
            });
            FrameLayout frameLayout2 = new FrameLayout(context);
            frameLayout2.setClipToPadding(false);
            frameLayout2.setPadding(0, AndroidUtilities.dp(28.0f), AndroidUtilities.dp(100.0f), AndroidUtilities.dp(16.0f));
            addView(frameLayout2, g52.l(-1, -1, 83));
            TextView textView3 = new TextView(context);
            this.k = textView3;
            textView3.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.k.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
            this.k.setLinkTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteLinkText"));
            this.k.setTextSize(1, 14.0f);
            this.k.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.k.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            vn7.a(this.k);
            frameLayout2.addView(this.k, g52.c(-2, -2, 83));
            String string = LocaleController.getString("TermsOfServiceLogin", R.string.TermsOfServiceLogin);
            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
            int indexOf = string.indexOf(42);
            int lastIndexOf = string.lastIndexOf(42);
            if (indexOf != -1 && lastIndexOf != -1 && indexOf != lastIndexOf) {
                spannableStringBuilder.replace(lastIndexOf, lastIndexOf + 1, (CharSequence) BuildConfig.FLAVOR);
                spannableStringBuilder.replace(indexOf, indexOf + 1, (CharSequence) BuildConfig.FLAVOR);
                spannableStringBuilder.setSpan(new f(), indexOf, lastIndexOf - 1, 33);
            }
            this.k.setText(spannableStringBuilder);
        }

        private void P() {
            this.k.animate().alpha(0.0f).setDuration(150L).setStartDelay(0L).setInterpolator(AndroidUtilities.accelerateInterpolator).start();
        }

        public void Q(qc5 qc5Var, qc5 qc5Var2) {
            oa5 oa5Var = qc5Var.b;
            this.r = oa5Var;
            this.s = qc5Var2.b;
            this.c.f(ImageLocation.getForLocal(oa5Var), "50_50", this.d, null);
        }

        public void R() {
            this.r = null;
            this.s = null;
            g0(false, true);
            this.c.f(null, null, this.d, null);
            this.f.setImageResource(org.telegram.messenger.R.drawable.actions_setphoto);
            this.f.setAnimation(this.p);
            this.p.X(0);
        }

        public void S(DialogInterface dialogInterface) {
            if (this.q.n()) {
                this.p.Y(0, false);
            } else {
                this.p.c0(86);
                this.f.d();
            }
        }

        public void T(View view) {
            this.q.x(this.r != null, new Runnable() {
                @Override
                public final void run() {
                    y5.k.this.R();
                }
            }, new DialogInterface.OnDismissListener() {
                @Override
                public final void onDismiss(DialogInterface dialogInterface) {
                    y5.k.this.S(dialogInterface);
                }
            });
            this.p.X(0);
            this.p.c0(43);
            this.f.d();
        }

        public boolean U(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            this.b.requestFocus();
            return true;
        }

        public boolean V(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 6 && i != 5) {
                return false;
            }
            f(null);
            return true;
        }

        public void W(View view) {
            if (y5.this.U.getTag() != null) {
                return;
            }
            b(false);
        }

        public void X(DialogInterface dialogInterface, int i) {
            b(true);
            y5.this.e3(0, true, null, true);
            P();
        }

        public void Y(i95 i95Var) {
            y5.this.U2(false, false);
            AndroidUtilities.hideKeyboard(((org.telegram.ui.ActionBar.k) y5.this).e.findFocus());
            y5.this.a3((ug5) i95Var, true);
            if (this.s != null) {
                MessagesController.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).uploadAndApplyUserAvatar(this.s);
            }
        }

        public void Z(final i95 i95Var, ov5 ov5Var) {
            y5 y5Var;
            String string;
            int i;
            String str;
            this.o = false;
            if (i95Var instanceof ug5) {
                P();
                y5.this.f3(false, true);
                postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        y5.k.this.Y(i95Var);
                    }
                }, 150L);
                return;
            }
            y5.this.T2(false);
            if (ov5Var.b.contains("PHONE_NUMBER_INVALID")) {
                y5Var = y5.this;
                string = LocaleController.getString("AppName", R.string.AppName);
                i = R.string.InvalidPhoneNumber;
                str = "InvalidPhoneNumber";
            } else if (ov5Var.b.contains("PHONE_CODE_EMPTY") || ov5Var.b.contains("PHONE_CODE_INVALID")) {
                y5Var = y5.this;
                string = LocaleController.getString("AppName", R.string.AppName);
                i = R.string.InvalidCode;
                str = "InvalidCode";
            } else if (ov5Var.b.contains("PHONE_CODE_EXPIRED")) {
                y5Var = y5.this;
                string = LocaleController.getString("AppName", R.string.AppName);
                i = R.string.CodeExpired;
                str = "CodeExpired";
            } else if (ov5Var.b.contains("FIRSTNAME_INVALID")) {
                y5Var = y5.this;
                string = LocaleController.getString("AppName", R.string.AppName);
                i = R.string.InvalidFirstName;
                str = "InvalidFirstName";
            } else {
                if (!ov5Var.b.contains("LASTNAME_INVALID")) {
                    y5.this.V2(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
                    return;
                }
                y5Var = y5.this;
                string = LocaleController.getString("AppName", R.string.AppName);
                i = R.string.InvalidLastName;
                str = "InvalidLastName";
            }
            y5Var.V2(string, LocaleController.getString(str, i));
        }

        public void a0(final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.k.this.Z(i95Var, ov5Var);
                }
            });
        }

        public void b0() {
            EditTextBoldCursor editTextBoldCursor = this.a;
            if (editTextBoldCursor != null) {
                editTextBoldCursor.requestFocus();
                EditTextBoldCursor editTextBoldCursor2 = this.a;
                editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
            }
        }

        public void c0(DialogInterface dialogInterface, int i) {
            y5.this.c0.b = false;
            f(null);
        }

        public void d0(DialogInterface dialogInterface, int i) {
            y5.this.c0.b = false;
            f(null);
        }

        public void e0(DialogInterface dialogInterface, int i) {
            b(true);
            y5.this.e3(0, true, null, true);
        }

        public void f0(DialogInterface dialogInterface, int i) {
            i.C0142i c0142i = new i.C0142i(y5.this.c0());
            c0142i.u(LocaleController.getString("TermsOfService", R.string.TermsOfService));
            c0142i.l(LocaleController.getString("TosDecline", R.string.TosDecline));
            c0142i.s(LocaleController.getString("SignUp", R.string.SignUp), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface2, int i2) {
                    y5.k.this.d0(dialogInterface2, i2);
                }
            });
            c0142i.n(LocaleController.getString("Decline", R.string.Decline), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface2, int i2) {
                    y5.k.this.e0(dialogInterface2, i2);
                }
            });
            y5.this.o1(c0142i.a());
        }

        private void g0(boolean z, boolean z2) {
            if (this.f == null) {
                return;
            }
            AnimatorSet animatorSet = this.h;
            if (animatorSet != null) {
                animatorSet.cancel();
                this.h = null;
            }
            if (z2) {
                this.h = new AnimatorSet();
                if (z) {
                    this.g.setVisibility(0);
                    this.h.playTogether(ObjectAnimator.ofFloat(this.f, (Property<ke4, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.g, (Property<RadialProgressView, Float>) View.ALPHA, 1.0f));
                } else {
                    this.f.setVisibility(0);
                    this.h.playTogether(ObjectAnimator.ofFloat(this.f, (Property<ke4, Float>) View.ALPHA, 1.0f), ObjectAnimator.ofFloat(this.g, (Property<RadialProgressView, Float>) View.ALPHA, 0.0f));
                }
                this.h.setDuration(180L);
                this.h.addListener(new e(z));
                this.h.start();
                return;
            }
            if (z) {
                this.f.setAlpha(1.0f);
                this.f.setVisibility(4);
                this.g.setAlpha(1.0f);
                this.g.setVisibility(0);
                return;
            }
            this.f.setAlpha(1.0f);
            this.f.setVisibility(0);
            this.g.setAlpha(0.0f);
            this.g.setVisibility(4);
        }

        public void h0(boolean z) {
            if (y5.this.c0 == null) {
                return;
            }
            i.C0142i c0142i = new i.C0142i(y5.this.c0());
            c0142i.u(LocaleController.getString("TermsOfService", R.string.TermsOfService));
            if (z) {
                c0142i.s(LocaleController.getString("Accept", R.string.Accept), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i) {
                        y5.k.this.c0(dialogInterface, i);
                    }
                });
                c0142i.n(LocaleController.getString("Decline", R.string.Decline), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i) {
                        y5.k.this.f0(dialogInterface, i);
                    }
                });
            } else {
                c0142i.s(LocaleController.getString("OK", R.string.OK), null);
            }
            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(y5.this.c0.d);
            MessageObject.addEntitiesToText(spannableStringBuilder, y5.this.c0.e, false, false, false, false);
            c0142i.l(spannableStringBuilder);
            y5.this.o1(c0142i.a());
        }

        @Override
        public boolean a() {
            return true;
        }

        @Override
        public boolean b(boolean z) {
            if (z) {
                y5.this.T2(true);
                this.o = false;
                this.n = null;
                return true;
            }
            i.C0142i c0142i = new i.C0142i(y5.this.c0());
            c0142i.u(LocaleController.getString("AppName", R.string.AppName));
            c0142i.l(LocaleController.getString("AreYouSureRegistration", R.string.AreYouSureRegistration));
            c0142i.n(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    y5.k.this.X(dialogInterface, i);
                }
            });
            c0142i.s(LocaleController.getString("Continue", R.string.Continue), null);
            y5.this.o1(c0142i.a());
            return false;
        }

        @Override
        public void c(xa5 xa5Var, xa5 xa5Var2, double d2, String str, final qc5 qc5Var, final qc5 qc5Var2) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.k.this.Q(qc5Var2, qc5Var);
                }
            });
        }

        @Override
        public void d() {
            this.o = false;
        }

        @Override
        public void f(String str) {
            if (this.o) {
                return;
            }
            if (y5.this.c0 != null && y5.this.c0.b) {
                h0(true);
                return;
            }
            if (this.a.length() == 0) {
                y5.this.c3(this.a);
                return;
            }
            this.o = true;
            sh5 sh5Var = new sh5();
            sh5Var.b = this.m;
            sh5Var.a = this.l;
            sh5Var.c = this.a.getText().toString();
            sh5Var.d = this.b.getText().toString();
            y5.this.X2(0);
            ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(sh5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.k.this.a0(i95Var, ov5Var);
                }
            }, 10);
        }

        @Override
        public void g() {
            super.g();
            if (this.k != null) {
                if (y5.this.s) {
                    this.k.setAlpha(1.0f);
                } else {
                    this.k.setAlpha(0.0f);
                    this.k.animate().alpha(1.0f).setDuration(200L).setStartDelay(300L).setInterpolator(AndroidUtilities.decelerateInterpolator).start();
                }
            }
            EditTextBoldCursor editTextBoldCursor = this.a;
            if (editTextBoldCursor != null) {
                editTextBoldCursor.requestFocus();
                EditTextBoldCursor editTextBoldCursor2 = this.a;
                editTextBoldCursor2.setSelection(editTextBoldCursor2.length());
            }
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.k.this.b0();
                }
            }, 100L);
        }

        @Override
        public String getHeaderName() {
            return LocaleController.getString("YourName", R.string.YourName);
        }

        @Override
        public String getInitialSearchString() {
            return wv1.b(this);
        }

        @Override
        public void h(Bundle bundle) {
            byte[] decode;
            Bundle bundle2 = bundle.getBundle("registerview_params");
            this.n = bundle2;
            if (bundle2 != null) {
                j(bundle2, true);
            }
            try {
                String string = bundle.getString("terms");
                if (string != null && (decode = Base64.decode(string, 0)) != null) {
                    st4 st4Var = new st4(decode);
                    y5.this.c0 = px5.a(st4Var, st4Var.readInt32(false), false);
                    st4Var.a();
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
            String string2 = bundle.getString("registerview_first");
            if (string2 != null) {
                this.a.setText(string2);
            }
            String string3 = bundle.getString("registerview_last");
            if (string3 != null) {
                this.b.setText(string3);
            }
        }

        @Override
        public void i(Bundle bundle) {
            String obj = this.a.getText().toString();
            if (obj.length() != 0) {
                bundle.putString("registerview_first", obj);
            }
            String obj2 = this.b.getText().toString();
            if (obj2.length() != 0) {
                bundle.putString("registerview_last", obj2);
            }
            if (y5.this.c0 != null) {
                st4 st4Var = new st4(y5.this.c0.getObjectSize());
                y5.this.c0.serializeToStream(st4Var);
                bundle.putString("terms", Base64.encodeToString(st4Var.d(), 0));
                st4Var.a();
            }
            Bundle bundle2 = this.n;
            if (bundle2 != null) {
                bundle.putBundle("registerview_params", bundle2);
            }
        }

        @Override
        public void j(Bundle bundle, boolean z) {
            if (bundle == null) {
                return;
            }
            this.a.setText(BuildConfig.FLAVOR);
            this.b.setText(BuildConfig.FLAVOR);
            this.l = bundle.getString("phoneFormated");
            this.m = bundle.getString("phoneHash");
            this.n = bundle;
        }

        @Override
        public void k(boolean z) {
            wv1.a(this, z);
        }

        @Override
        public void m(float f2) {
            wv1.c(this, f2);
        }
    }

    public class l extends pz4 {
        private TextView a;
        private TextView b;
        private TextView c;
        private TextView d;
        private Runnable e;
        private Bundle f;
        private String g;
        private String h;
        private String i;
        private int j;
        private int k;

        public class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                if (l.this.e != this) {
                    return;
                }
                l.this.A();
                AndroidUtilities.runOnUIThread(l.this.e, 1000L);
            }
        }

        public l(Context context) {
            super(context);
            setOrientation(1);
            TextView textView = new TextView(context);
            this.a = textView;
            textView.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.a.setTextSize(1, 14.0f);
            this.a.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.a.setGravity(LocaleController.isRTL ? 5 : 3);
            this.a.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.a, g52.l(-2, -2, LocaleController.isRTL ? 5 : 3));
            TextView textView2 = new TextView(context);
            this.d = textView2;
            textView2.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.d.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.d.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.d.setText(LocaleController.getString("ResetAccountStatus", R.string.ResetAccountStatus));
            this.d.setTextSize(1, 14.0f);
            this.d.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.d, g52.m(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 24, 0, 0));
            TextView textView3 = new TextView(context);
            this.c = textView3;
            textView3.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.c.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.c.setTextSize(1, 14.0f);
            this.c.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.c.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.c, g52.m(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 2, 0, 0));
            TextView textView4 = new TextView(context);
            this.b = textView4;
            textView4.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
            this.b.setText(LocaleController.getString("ResetAccountButton", R.string.ResetAccountButton));
            this.b.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.b.setTextSize(1, 14.0f);
            this.b.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.b.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0);
            addView(this.b, g52.m(-2, -2, (LocaleController.isRTL ? 5 : 3) | 48, 0, 7, 0, 0));
            this.b.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    y5.l.this.z(view);
                }
            });
        }

        public void A() {
            TextView textView;
            String str;
            int max = Math.max(0, this.k - (ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).getCurrentTime() - this.j));
            int i = max / 86400;
            int i2 = max - (86400 * i);
            int i3 = i2 / 3600;
            int i4 = (i2 - (i3 * 3600)) / 60;
            int i5 = max % 60;
            if (i != 0) {
                this.c.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("DaysBold", i) + " " + LocaleController.formatPluralString("HoursBold", i3) + " " + LocaleController.formatPluralString("MinutesBold", i4)));
            } else {
                this.c.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("HoursBold", i3) + " " + LocaleController.formatPluralString("MinutesBold", i4) + " " + LocaleController.formatPluralString("SecondsBold", i5)));
            }
            if (max > 0) {
                textView = this.b;
                str = "windowBackgroundWhiteGrayText6";
            } else {
                textView = this.b;
                str = "windowBackgroundWhiteRedText6";
            }
            textView.setTag(str);
            this.b.setTextColor(org.telegram.ui.ActionBar.w.r1(str));
        }

        public void w(ov5 ov5Var) {
            y5.this.T2(false);
            if (ov5Var != null) {
                if (ov5Var.b.equals("2FA_RECENT_CONFIRM")) {
                    y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ResetAccountCancelledAlert", R.string.ResetAccountCancelledAlert));
                    return;
                } else {
                    y5.this.V2(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
                    return;
                }
            }
            Bundle bundle = new Bundle();
            bundle.putString("phoneFormated", this.g);
            bundle.putString("phoneHash", this.h);
            bundle.putString("code", this.i);
            y5.this.e3(5, true, bundle, false);
        }

        public void x(i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.l.this.w(ov5Var);
                }
            });
        }

        public void y(DialogInterface dialogInterface, int i) {
            y5.this.X2(0);
            wd5 wd5Var = new wd5();
            wd5Var.a = "Forgot password";
            ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(wd5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.l.this.x(i95Var, ov5Var);
                }
            }, 10);
        }

        public void z(View view) {
            if (y5.this.U.getTag() == null && Math.abs(ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).getCurrentTime() - this.j) >= this.k) {
                i.C0142i c0142i = new i.C0142i(y5.this.c0());
                c0142i.l(LocaleController.getString("ResetMyAccountWarningText", R.string.ResetMyAccountWarningText));
                c0142i.u(LocaleController.getString("ResetMyAccountWarning", R.string.ResetMyAccountWarning));
                c0142i.s(LocaleController.getString("ResetMyAccountWarningReset", R.string.ResetMyAccountWarningReset), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i) {
                        y5.l.this.y(dialogInterface, i);
                    }
                });
                c0142i.n(LocaleController.getString("Cancel", R.string.Cancel), null);
                y5.this.o1(c0142i.a());
            }
        }

        @Override
        public boolean a() {
            return true;
        }

        @Override
        public boolean b(boolean z) {
            y5.this.T2(true);
            AndroidUtilities.cancelRunOnUIThread(this.e);
            this.e = null;
            this.f = null;
            return true;
        }

        @Override
        public String getHeaderName() {
            return LocaleController.getString("ResetAccount", R.string.ResetAccount);
        }

        @Override
        public void h(Bundle bundle) {
            Bundle bundle2 = bundle.getBundle("resetview_params");
            this.f = bundle2;
            if (bundle2 != null) {
                j(bundle2, true);
            }
        }

        @Override
        public void i(Bundle bundle) {
            Bundle bundle2 = this.f;
            if (bundle2 != null) {
                bundle.putBundle("resetview_params", bundle2);
            }
        }

        @Override
        public void j(Bundle bundle, boolean z) {
            if (bundle == null) {
                return;
            }
            this.f = bundle;
            this.g = bundle.getString("phoneFormated");
            this.h = bundle.getString("phoneHash");
            this.i = bundle.getString("code");
            this.j = bundle.getInt("startTime");
            this.k = bundle.getInt("waitTime");
            this.a.setText(AndroidUtilities.replaceTags(LocaleController.formatString("ResetAccountInfo", R.string.ResetAccountInfo, LocaleController.addNbsp(uw3.d().c("+" + this.g)))));
            A();
            a aVar = new a();
            this.e = aVar;
            AndroidUtilities.runOnUIThread(aVar, 1000L);
        }
    }

    public class m extends pz4 implements NotificationCenter.NotificationCenterDelegate {
        private int A;
        private int B;
        private String G;
        private String H;
        private String I;
        private int J;
        private String a;
        private String b;
        private String c;
        private String d;
        private gi0 e;
        private TextView f;
        private TextView g;
        private ImageView h;
        private ke4 i;
        private TextView j;
        private TextView k;
        private Bundle l;
        private o m;
        private TextView n;
        RLottieDrawable o;
        private Timer p;
        private Timer q;
        private int r;
        private final Object s;
        private int t;
        private int u;
        private double v;
        private double w;
        private boolean x;
        private boolean y;
        private String z;

        class a extends gi0 {
            a(Context context, y5 y5Var) {
                super(context);
            }

            @Override
            protected void c() {
                m.this.f(null);
            }
        }

        class b extends gi0 {
            b(Context context, y5 y5Var) {
                super(context);
            }

            @Override
            protected void c() {
                m.this.f(null);
            }
        }

        class c extends TextView {
            c(m mVar, Context context, y5 y5Var) {
                super(context);
            }

            @Override
            protected void onMeasure(int i, int i2) {
                super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
            }
        }

        class d extends TextView {
            d(m mVar, Context context, y5 y5Var) {
                super(context);
            }

            @Override
            protected void onMeasure(int i, int i2) {
                super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100.0f), Integer.MIN_VALUE));
            }
        }

        public class e extends TimerTask {
            e() {
            }

            public void b() {
                double currentTimeMillis = System.currentTimeMillis();
                double d = m.this.w;
                Double.isNaN(currentTimeMillis);
                m.this.w = currentTimeMillis;
                m.E(m.this, currentTimeMillis - d);
                if (m.this.u <= 1000) {
                    m.this.k.setVisibility(0);
                    m.this.j.setVisibility(8);
                    m.this.a0();
                }
            }

            @Override
            public void run() {
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public final void run() {
                        y5.m.e.this.b();
                    }
                });
            }
        }

        public class f extends TimerTask {
            f() {
            }

            public void d(ov5 ov5Var) {
                m.this.z = ov5Var.b;
            }

            public void e(i95 i95Var, final ov5 ov5Var) {
                if (ov5Var == null || ov5Var.b == null) {
                    return;
                }
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public final void run() {
                        y5.m.f.this.d(ov5Var);
                    }
                });
            }

            public void f() {
                TextView textView;
                int i;
                String str;
                NotificationCenter globalInstance;
                m mVar;
                int i2;
                TextView textView2;
                String formatString;
                double currentTimeMillis = System.currentTimeMillis();
                double d = m.this.v;
                Double.isNaN(currentTimeMillis);
                m.this.v = currentTimeMillis;
                m.M(m.this, currentTimeMillis - d);
                if (m.this.t >= 1000) {
                    int i3 = (m.this.t / 1000) / 60;
                    int i4 = (m.this.t / 1000) - (i3 * 60);
                    if (m.this.B != 4 && m.this.B != 3) {
                        if (m.this.B == 2) {
                            textView2 = m.this.j;
                            formatString = LocaleController.formatString("SmsText", R.string.SmsText, Integer.valueOf(i3), Integer.valueOf(i4));
                        }
                        if (m.this.m != null || m.this.m.a()) {
                            return;
                        }
                        m.this.m.c(m.this.t - 1000);
                        return;
                    }
                    textView2 = m.this.j;
                    formatString = LocaleController.formatString("CallText", R.string.CallText, Integer.valueOf(i3), Integer.valueOf(i4));
                    textView2.setText(formatString);
                    if (m.this.m != null) {
                        return;
                    } else {
                        return;
                    }
                }
                m.this.b0();
                if (m.this.A == 3) {
                    AndroidUtilities.setWaitingForCall(false);
                    globalInstance = NotificationCenter.getGlobalInstance();
                    mVar = m.this;
                    i2 = NotificationCenter.didReceiveCall;
                } else {
                    if (m.this.A != 2 && m.this.A != 4) {
                        return;
                    }
                    if (m.this.B == 4 || m.this.B == 2) {
                        if (m.this.B == 4) {
                            textView = m.this.j;
                            i = R.string.Calling;
                            str = "Calling";
                        } else {
                            textView = m.this.j;
                            i = R.string.SendingSms;
                            str = "SendingSms";
                        }
                        textView.setText(LocaleController.getString(str, i));
                        m.this.Y();
                        ih5 ih5Var = new ih5();
                        ih5Var.a = m.this.c;
                        ih5Var.b = m.this.b;
                        ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(ih5Var, new RequestDelegate() {
                            @Override
                            public final void run(i95 i95Var, ov5 ov5Var) {
                                y5.m.f.this.e(i95Var, ov5Var);
                            }
                        }, 10);
                        return;
                    }
                    if (m.this.B != 3) {
                        return;
                    }
                    AndroidUtilities.setWaitingForSms(false);
                    globalInstance = NotificationCenter.getGlobalInstance();
                    mVar = m.this;
                    i2 = NotificationCenter.didReceiveSmsCode;
                }
                globalInstance.removeObserver(mVar, i2);
                m.this.x = false;
                m.this.a0();
                m.this.m0();
            }

            @Override
            public void run() {
                if (m.this.p == null) {
                    return;
                }
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public final void run() {
                        y5.m.f.this.f();
                    }
                });
            }
        }

        public m(Context context, int i) {
            super(context);
            TextView textView;
            int i2;
            String str;
            int i3;
            int i4;
            int i5;
            int i6;
            int i7;
            int i8;
            TextView textView2;
            int i9;
            float f2;
            int i10;
            float f3;
            int i11;
            float f4;
            float f5;
            float f6;
            View view;
            TextView textView3;
            int i12;
            String str2;
            int i13;
            int i14;
            this.s = new Object();
            this.t = 60000;
            this.u = 15000;
            this.z = BuildConfig.FLAVOR;
            this.G = "*";
            this.H = BuildConfig.FLAVOR;
            this.A = i;
            setOrientation(1);
            TextView textView4 = new TextView(context);
            this.f = textView4;
            textView4.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.f.setTextSize(1, 14.0f);
            this.f.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.f.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            TextView textView5 = new TextView(context);
            this.g = textView5;
            textView5.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.g.setTextSize(1, 18.0f);
            this.g.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.g.setGravity(LocaleController.isRTL ? 5 : 3);
            this.g.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.g.setGravity(49);
            int i15 = this.A;
            if (i15 == 11) {
                this.g.setText(LocaleController.getString("MissedCallDescriptionTitle", R.string.MissedCallDescriptionTitle));
                FrameLayout frameLayout = new FrameLayout(context);
                ImageView imageView = new ImageView(context);
                ImageView imageView2 = new ImageView(context);
                frameLayout.addView(imageView);
                frameLayout.addView(imageView2);
                imageView.setImageResource(org.telegram.messenger.R.drawable.login_arrow1);
                imageView.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteInputFieldActivated"), PorterDuff.Mode.SRC_IN));
                imageView2.setImageResource(org.telegram.messenger.R.drawable.login_phone1);
                imageView2.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"), PorterDuff.Mode.SRC_IN));
                addView(frameLayout, g52.m(64, 64, 1, 0, 0, 0, 0));
                addView(this.g, g52.m(-2, -2, 49, 0, 8, 0, 0));
                TextView textView6 = new TextView(context);
                textView6.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText"));
                textView6.setTextSize(1, 14.0f);
                textView6.setGravity(1);
                textView6.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
                textView6.setText(AndroidUtilities.replaceTags(LocaleController.getString("MissedCallDescriptionSubtitle", R.string.MissedCallDescriptionSubtitle)));
                addView(textView6, g52.m(-1, -2, 49, 36, 16, 36, 0));
                this.e = new a(context, y5.this);
                LinearLayout linearLayout = new LinearLayout(context);
                linearLayout.setOrientation(0);
                TextView textView7 = new TextView(context);
                this.n = textView7;
                textView7.setTextSize(1, 20.0f);
                this.n.setMaxLines(1);
                this.n.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                this.n.setPadding(0, 0, 0, 0);
                this.n.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
                this.n.setGravity(16);
                linearLayout.addView(this.n, g52.m(-2, -1, 16, 0, 0, 4, 0));
                linearLayout.addView(this.e, g52.f(-2, -1));
                i9 = 28;
                addView(linearLayout, g52.m(-2, 34, 1, 0, 28, 0, 0));
                textView2 = new TextView(context);
                textView2.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText"));
                textView2.setTextSize(1, 14.0f);
                textView2.setGravity(1);
                textView2.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
                textView2.setText(AndroidUtilities.replaceTags(LocaleController.getString("MissedCallDescriptionSubtitle2", R.string.MissedCallDescriptionSubtitle2)));
                i3 = -1;
                i4 = -2;
                i5 = 49;
                i6 = 36;
                i7 = 36;
                i8 = 12;
            } else {
                if (i15 == 3) {
                    this.f.setGravity((LocaleController.isRTL ? 5 : 3) | 48);
                    FrameLayout frameLayout2 = new FrameLayout(context);
                    addView(frameLayout2, g52.l(-2, -2, LocaleController.isRTL ? 5 : 3));
                    ImageView imageView3 = new ImageView(context);
                    imageView3.setImageResource(org.telegram.messenger.R.drawable.phone_activate);
                    boolean z = LocaleController.isRTL;
                    if (z) {
                        frameLayout2.addView(imageView3, g52.b(64, 76.0f, 19, 2.0f, 2.0f, 0.0f, 0.0f));
                        View view2 = this.f;
                        i10 = -1;
                        f3 = -2.0f;
                        i11 = LocaleController.isRTL ? 5 : 3;
                        f2 = 82.0f;
                        f4 = 0.0f;
                        f5 = 0.0f;
                        f6 = 0.0f;
                        view = view2;
                    } else {
                        f2 = 0.0f;
                        frameLayout2.addView(this.f, g52.b(-1, -2.0f, z ? 5 : 3, 0.0f, 0.0f, 82.0f, 0.0f));
                        i10 = 64;
                        f3 = 76.0f;
                        i11 = 21;
                        f4 = 2.0f;
                        f5 = 0.0f;
                        f6 = 2.0f;
                        view = imageView3;
                    }
                    frameLayout2.addView(view, g52.b(i10, f3, i11, f2, f4, f5, f6));
                    if (this.A != 11) {
                        b bVar = new b(context, y5.this);
                        this.e = bVar;
                        addView(bVar, g52.l(-2, 42, 1));
                    }
                    if (this.A == 3) {
                        this.e.setVisibility(8);
                    }
                    c cVar = new c(this, context, y5.this);
                    this.j = cVar;
                    cVar.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
                    this.j.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                    this.j.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
                    if (this.A != 3) {
                        this.j.setTextSize(1, 14.0f);
                        View view3 = this.j;
                        if (LocaleController.isRTL) {
                            i13 = -2;
                            i14 = 5;
                        } else {
                            i13 = -2;
                            i14 = 3;
                        }
                        addView(view3, g52.l(i13, i13, i14));
                        this.m = new o(context);
                        this.j.setGravity(LocaleController.isRTL ? 5 : 3);
                        addView(this.m, g52.h(-1, 3, 0.0f, 12.0f, 0.0f, 0.0f));
                    } else {
                        this.j.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
                        this.j.setTextSize(1, 15.0f);
                        this.j.setGravity(49);
                        addView(this.j, g52.l(-2, -2, 49));
                    }
                    d dVar = new d(this, context, y5.this);
                    this.k = dVar;
                    dVar.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
                    this.k.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
                    this.k.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
                    this.k.setTextSize(1, 15.0f);
                    this.k.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                    this.k.setGravity(49);
                    if (this.A != 1) {
                        int i16 = this.B;
                        if (i16 == 3 || i16 == 4 || i16 == 11) {
                            textView3 = this.k;
                            i12 = R.string.DidNotGetTheCodePhone;
                            str2 = "DidNotGetTheCodPhone";
                        } else {
                            textView3 = this.k;
                            i12 = R.string.DidNotGetTheCodeSms;
                            str2 = "DidNotGetTheCodeSms";
                        }
                    } else {
                        textView3 = this.k;
                        i12 = R.string.DidNotGetTheCode;
                        str2 = "DidNotGetTheCode";
                    }
                    textView3.setText(LocaleController.getString(str2, i12));
                    addView(this.k, g52.l(-2, -2, 49));
                    this.k.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public final void onClick(View view4) {
                            y5.m.this.c0(view4);
                        }
                    });
                }
                this.f.setGravity(49);
                FrameLayout frameLayout3 = new FrameLayout(context);
                addView(frameLayout3, g52.l(-2, -2, 49));
                if (this.A == 1) {
                    ImageView imageView4 = new ImageView(context);
                    this.h = imageView4;
                    imageView4.setImageResource(org.telegram.messenger.R.drawable.sms_devices);
                    this.h.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"), PorterDuff.Mode.MULTIPLY));
                    frameLayout3.addView(this.h, g52.b(-2, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
                    ke4 ke4Var = new ke4(context);
                    this.i = ke4Var;
                    ke4Var.setImageResource(org.telegram.messenger.R.drawable.sms_bubble);
                    this.i.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("chats_actionBackground"), PorterDuff.Mode.MULTIPLY));
                    frameLayout3.addView(this.i, g52.b(-2, -2.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
                    textView = this.g;
                    i2 = R.string.SentAppCodeTitle;
                    str = "SentAppCodeTitle";
                } else {
                    this.i = new ke4(context);
                    RLottieDrawable rLottieDrawable = new RLottieDrawable(R.raw.sms_incoming_info, "2131558496", AndroidUtilities.dp(64.0f), AndroidUtilities.dp(64.0f), true, null);
                    this.o = rLottieDrawable;
                    rLottieDrawable.f0("Bubble.**", org.telegram.ui.ActionBar.w.r1("chats_actionBackground"));
                    this.o.f0("Phone.**", org.telegram.ui.ActionBar.w.r1("chats_actionBackground"));
                    this.i.setAnimation(this.o);
                    frameLayout3.addView(this.i, g52.b(64, 64.0f, 51, 0.0f, 0.0f, 0.0f, 0.0f));
                    textView = this.g;
                    i2 = R.string.SentSmsCodeTitle;
                    str = "SentSmsCodeTitle";
                }
                textView.setText(LocaleController.getString(str, i2));
                i3 = -2;
                i4 = -2;
                i5 = 49;
                i6 = 0;
                i7 = 0;
                i8 = 0;
                addView(this.g, g52.m(-2, -2, 49, 0, 18, 0, 0));
                textView2 = this.f;
                i9 = 17;
            }
            addView(textView2, g52.m(i3, i4, i5, i6, i9, i7, i8));
            if (this.A != 11) {
            }
            if (this.A == 3) {
            }
            c cVar2 = new c(this, context, y5.this);
            this.j = cVar2;
            cVar2.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.j.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.j.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            if (this.A != 3) {
            }
            d dVar2 = new d(this, context, y5.this);
            this.k = dVar2;
            dVar2.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlueText4"));
            this.k.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            this.k.setPadding(0, AndroidUtilities.dp(2.0f), 0, AndroidUtilities.dp(10.0f));
            this.k.setTextSize(1, 15.0f);
            this.k.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.k.setGravity(49);
            if (this.A != 1) {
            }
            textView3.setText(LocaleController.getString(str2, i12));
            addView(this.k, g52.l(-2, -2, 49));
            this.k.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view4) {
                    y5.m.this.c0(view4);
                }
            });
        }

        static int E(m mVar, double d2) {
            double d3 = mVar.u;
            Double.isNaN(d3);
            int i = (int) (d3 - d2);
            mVar.u = i;
            return i;
        }

        static int M(m mVar, double d2) {
            double d3 = mVar.t;
            Double.isNaN(d3);
            int i = (int) (d3 - d2);
            mVar.t = i;
            return i;
        }

        public void Y() {
            if (this.q != null) {
                return;
            }
            this.u = 15000;
            this.q = new Timer();
            this.w = System.currentTimeMillis();
            this.q.schedule(new e(), 0L, 1000L);
        }

        private void Z() {
            if (this.p != null) {
                return;
            }
            o oVar = this.m;
            if (oVar != null) {
                oVar.b();
            }
            Timer timer = new Timer();
            this.p = timer;
            timer.schedule(new f(), 0L, 1000L);
        }

        public void a0() {
            try {
                synchronized (this.s) {
                    Timer timer = this.q;
                    if (timer != null) {
                        timer.cancel();
                        this.q = null;
                    }
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }

        public void b0() {
            try {
                synchronized (this.s) {
                    Timer timer = this.p;
                    if (timer != null) {
                        timer.cancel();
                        this.p = null;
                    }
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }

        public void c0(View view) {
            if (this.y) {
                return;
            }
            int i = this.B;
            if (!((i == 4 && this.A == 2) || i == 0)) {
                if (y5.this.U.getTag() != null) {
                    return;
                }
                m0();
                return;
            }
            try {
                PackageInfo packageInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
                String format = String.format(Locale.US, "%s (%d)", packageInfo.versionName, Integer.valueOf(packageInfo.versionCode));
                Intent intent = new Intent("android.intent.action.SENDTO");
                intent.setData(Uri.parse("mailto:"));
                intent.putExtra("android.intent.extra.EMAIL", new String[]{"sms@telegram.org"});
                intent.putExtra("android.intent.extra.SUBJECT", "Android registration/login issue " + format + " " + this.d);
                intent.putExtra("android.intent.extra.TEXT", "Phone: " + this.c + "\nApp version: " + format + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + this.z);
                getContext().startActivity(Intent.createChooser(intent, "Send email..."));
            } catch (Exception unused) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
            }
        }

        public void d0(DialogInterface dialogInterface, int i) {
            b(true);
            y5.this.e3(0, true, null, true);
        }

        public static void e0(i95 i95Var, ov5 ov5Var) {
        }

        public void f0(ov5 ov5Var, i95 i95Var, rh5 rh5Var) {
            this.y = false;
            y5.this.f3(false, true);
            if (ov5Var != null) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
                return;
            }
            te5 te5Var = (te5) i95Var;
            if (!hf.p2(te5Var, true)) {
                org.telegram.ui.Components.b.E4(y5.this.c0(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
                return;
            }
            Bundle bundle = new Bundle();
            st4 st4Var = new st4(te5Var.getObjectSize());
            te5Var.serializeToStream(st4Var);
            bundle.putString("password", Utilities.bytesToHex(st4Var.d()));
            bundle.putString("phoneFormated", this.c);
            bundle.putString("phoneHash", this.b);
            bundle.putString("code", rh5Var.c);
            y5.this.e3(6, true, bundle, false);
        }

        public void g0(final rh5 rh5Var, final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.m.this.f0(ov5Var, i95Var, rh5Var);
                }
            });
        }

        public void h0(ov5 ov5Var, i95 i95Var, final rh5 rh5Var) {
            int i;
            NotificationCenter globalInstance;
            int i2;
            ji0[] ji0VarArr;
            y5 y5Var;
            String string;
            int i3;
            String str;
            int i4;
            boolean z = false;
            if (ov5Var == null) {
                this.y = false;
                y5.this.f3(false, true);
                b0();
                a0();
                if (i95Var instanceof vg5) {
                    px5 px5Var = ((vg5) i95Var).b;
                    if (px5Var != null) {
                        y5.this.c0 = px5Var;
                    }
                    Bundle bundle = new Bundle();
                    bundle.putString("phoneFormated", this.c);
                    bundle.putString("phoneHash", this.b);
                    bundle.putString("code", rh5Var.c);
                    y5.this.e3(5, true, bundle, false);
                } else {
                    y5.this.Z2((ug5) i95Var);
                }
            } else {
                String str2 = ov5Var.b;
                this.z = str2;
                if (!str2.contains("SESSION_PASSWORD_NEEDED")) {
                    this.y = false;
                    y5.this.f3(false, true);
                    int i5 = this.A;
                    if ((i5 == 3 && ((i4 = this.B) == 4 || i4 == 2)) || ((i5 == 2 && ((i = this.B) == 4 || i == 3)) || (i5 == 4 && this.B == 2))) {
                        Z();
                    }
                    int i6 = this.A;
                    if (i6 != 2) {
                        if (i6 == 3) {
                            AndroidUtilities.setWaitingForCall(true);
                            globalInstance = NotificationCenter.getGlobalInstance();
                            i2 = NotificationCenter.didReceiveCall;
                        }
                        this.x = true;
                        if (this.A != 3) {
                            if (ov5Var.b.contains("PHONE_NUMBER_INVALID")) {
                                y5Var = y5.this;
                                string = LocaleController.getString("AppName", R.string.AppName);
                                i3 = R.string.InvalidPhoneNumber;
                                str = "InvalidPhoneNumber";
                            } else if (ov5Var.b.contains("PHONE_CODE_EMPTY") || ov5Var.b.contains("PHONE_CODE_INVALID")) {
                                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidCode", R.string.InvalidCode));
                                int i7 = 0;
                                while (true) {
                                    ji0VarArr = this.e.e;
                                    if (i7 >= ji0VarArr.length) {
                                        break;
                                    }
                                    ji0VarArr[i7].setText(BuildConfig.FLAVOR);
                                    i7++;
                                }
                                ji0VarArr[0].requestFocus();
                            } else if (ov5Var.b.contains("PHONE_CODE_EXPIRED")) {
                                b(true);
                                y5.this.e3(0, true, null, true);
                                y5Var = y5.this;
                                string = LocaleController.getString("AppName", R.string.AppName);
                                i3 = R.string.CodeExpired;
                                str = "CodeExpired";
                            } else if (ov5Var.b.startsWith("FLOOD_WAIT")) {
                                y5Var = y5.this;
                                string = LocaleController.getString("AppName", R.string.AppName);
                                i3 = R.string.FloodWait;
                                str = "FloodWait";
                            } else {
                                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + ov5Var.b);
                            }
                            y5Var.V2(string, LocaleController.getString(str, i3));
                        }
                        if (z && this.A == 3) {
                            AndroidUtilities.endIncomingCall();
                            return;
                        }
                        return;
                    }
                    AndroidUtilities.setWaitingForSms(true);
                    globalInstance = NotificationCenter.getGlobalInstance();
                    i2 = NotificationCenter.didReceiveSmsCode;
                    globalInstance.addObserver(this, i2);
                    this.x = true;
                    if (this.A != 3) {
                    }
                    if (z) {
                        return;
                    } else {
                        return;
                    }
                }
                ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(new ie5(), new RequestDelegate() {
                    @Override
                    public final void run(i95 i95Var2, ov5 ov5Var2) {
                        y5.m.this.g0(rh5Var, i95Var2, ov5Var2);
                    }
                }, 10);
                b0();
                a0();
            }
            z = true;
            if (z) {
            }
        }

        public void i0(final rh5 rh5Var, final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.m.this.h0(ov5Var, i95Var, rh5Var);
                }
            });
        }

        public void j0() {
            ji0[] ji0VarArr = this.e.e;
            if (ji0VarArr != null) {
                for (int length = ji0VarArr.length - 1; length >= 0; length--) {
                    if (length == 0 || this.e.e[length].length() != 0) {
                        this.e.e[length].requestFocus();
                        ji0[] ji0VarArr2 = this.e.e;
                        ji0VarArr2[length].setSelection(ji0VarArr2[length].length());
                        AndroidUtilities.showKeyboard(this.e.e[length]);
                        break;
                    }
                }
            }
            RLottieDrawable rLottieDrawable = this.o;
            if (rLottieDrawable != null) {
                rLottieDrawable.start();
            }
        }

        public void k0(ov5 ov5Var, Bundle bundle, i95 i95Var) {
            y5 y5Var;
            String string;
            int i;
            String str;
            this.y = false;
            if (ov5Var == null) {
                y5.this.L2(bundle, (lh5) i95Var);
            } else {
                String str2 = ov5Var.b;
                if (str2 != null) {
                    if (str2.contains("PHONE_NUMBER_INVALID")) {
                        y5Var = y5.this;
                        string = LocaleController.getString("AppName", R.string.AppName);
                        i = R.string.InvalidPhoneNumber;
                        str = "InvalidPhoneNumber";
                    } else if (ov5Var.b.contains("PHONE_CODE_EMPTY") || ov5Var.b.contains("PHONE_CODE_INVALID")) {
                        y5Var = y5.this;
                        string = LocaleController.getString("AppName", R.string.AppName);
                        i = R.string.InvalidCode;
                        str = "InvalidCode";
                    } else if (ov5Var.b.contains("PHONE_CODE_EXPIRED")) {
                        b(true);
                        y5.this.e3(0, true, null, true);
                        y5Var = y5.this;
                        string = LocaleController.getString("AppName", R.string.AppName);
                        i = R.string.CodeExpired;
                        str = "CodeExpired";
                    } else if (ov5Var.b.startsWith("FLOOD_WAIT")) {
                        y5Var = y5.this;
                        string = LocaleController.getString("AppName", R.string.AppName);
                        i = R.string.FloodWait;
                        str = "FloodWait";
                    } else if (ov5Var.a != -1000) {
                        y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + ov5Var.b);
                    }
                    y5Var.V2(string, LocaleController.getString(str, i));
                }
            }
            y5.this.T2(false);
        }

        public void l0(final Bundle bundle, final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.m.this.k0(ov5Var, bundle, i95Var);
                }
            });
        }

        public void m0() {
            final Bundle bundle = new Bundle();
            bundle.putString("phone", this.a);
            bundle.putString("ephone", this.d);
            bundle.putString("phoneFormated", this.c);
            this.y = true;
            ih5 ih5Var = new ih5();
            ih5Var.a = this.c;
            ih5Var.b = this.b;
            y5.this.X2(ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(ih5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.m.this.l0(bundle, i95Var, ov5Var);
                }
            }, 10));
        }

        @Override
        public boolean a() {
            return true;
        }

        @Override
        public boolean b(boolean z) {
            NotificationCenter globalInstance;
            int i;
            if (!z) {
                i.C0142i c0142i = new i.C0142i(y5.this.c0());
                c0142i.u(LocaleController.getString("AppName", R.string.AppName));
                c0142i.l(LocaleController.getString("StopVerification", R.string.StopVerification));
                c0142i.s(LocaleController.getString("Continue", R.string.Continue), null);
                c0142i.n(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i2) {
                        y5.m.this.d0(dialogInterface, i2);
                    }
                });
                y5.this.o1(c0142i.a());
                return false;
            }
            this.y = false;
            y5.this.T2(true);
            wg5 wg5Var = new wg5();
            wg5Var.a = this.c;
            wg5Var.b = this.b;
            ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(wg5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.m.e0(i95Var, ov5Var);
                }
            }, 10);
            b0();
            a0();
            this.l = null;
            int i2 = this.A;
            if (i2 != 2) {
                if (i2 == 3) {
                    AndroidUtilities.setWaitingForCall(false);
                    globalInstance = NotificationCenter.getGlobalInstance();
                    i = NotificationCenter.didReceiveCall;
                }
                this.x = false;
                return true;
            }
            AndroidUtilities.setWaitingForSms(false);
            globalInstance = NotificationCenter.getGlobalInstance();
            i = NotificationCenter.didReceiveSmsCode;
            globalInstance.removeObserver(this, i);
            this.x = false;
            return true;
        }

        @Override
        public void d() {
            this.y = false;
        }

        @Override
        public void didReceivedNotification(int i, int i2, Object... objArr) {
            String str;
            if (this.x) {
                gi0 gi0Var = this.e;
                if (gi0Var.e == null) {
                    return;
                }
                if (i == NotificationCenter.didReceiveSmsCode) {
                    gi0Var.setText(BuildConfig.FLAVOR + objArr[0]);
                    str = null;
                } else {
                    if (i != NotificationCenter.didReceiveCall) {
                        return;
                    }
                    str = BuildConfig.FLAVOR + objArr[0];
                    if (!AndroidUtilities.checkPhonePattern(this.G, str)) {
                        return;
                    }
                    if (!this.G.equals("*")) {
                        this.I = str;
                        AndroidUtilities.endIncomingCall();
                    }
                }
                f(str);
            }
        }

        @Override
        public void e() {
            NotificationCenter globalInstance;
            int i;
            super.e();
            int i2 = this.A;
            if (i2 != 2) {
                if (i2 == 3) {
                    AndroidUtilities.setWaitingForCall(false);
                    globalInstance = NotificationCenter.getGlobalInstance();
                    i = NotificationCenter.didReceiveCall;
                }
                this.x = false;
                b0();
                a0();
            }
            AndroidUtilities.setWaitingForSms(false);
            globalInstance = NotificationCenter.getGlobalInstance();
            i = NotificationCenter.didReceiveSmsCode;
            globalInstance.removeObserver(this, i);
            this.x = false;
            b0();
            a0();
        }

        @Override
        public void f(String str) {
            NotificationCenter globalInstance;
            int i;
            if (y5.this.q == 11) {
                if (this.y) {
                    return;
                }
            } else if (this.y || y5.this.q < 1 || y5.this.q > 4) {
                return;
            }
            if (str == null) {
                str = this.e.getCode();
            }
            if (TextUtils.isEmpty(str)) {
                y5.this.c3(this.e);
                return;
            }
            this.y = true;
            int i2 = this.A;
            if (i2 != 2) {
                if (i2 == 3) {
                    AndroidUtilities.setWaitingForCall(false);
                    globalInstance = NotificationCenter.getGlobalInstance();
                    i = NotificationCenter.didReceiveCall;
                }
                this.x = false;
                final rh5 rh5Var = new rh5();
                rh5Var.a = this.c;
                rh5Var.c = str;
                rh5Var.b = this.b;
                b0();
                y5.this.Y2(ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(rh5Var, new RequestDelegate() {
                    @Override
                    public final void run(i95 i95Var, ov5 ov5Var) {
                        y5.m.this.i0(rh5Var, i95Var, ov5Var);
                    }
                }, 10), false);
                y5.this.f3(true, true);
            }
            AndroidUtilities.setWaitingForSms(false);
            globalInstance = NotificationCenter.getGlobalInstance();
            i = NotificationCenter.didReceiveSmsCode;
            globalInstance.removeObserver(this, i);
            this.x = false;
            final rh5 rh5Var2 = new rh5();
            rh5Var2.a = this.c;
            rh5Var2.c = str;
            rh5Var2.b = this.b;
            b0();
            y5.this.Y2(ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(rh5Var2, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.m.this.i0(rh5Var2, i95Var, ov5Var);
                }
            }, 10), false);
            y5.this.f3(true, true);
        }

        @Override
        public void g() {
            super.g();
            int i = this.A;
            if (i == 3) {
                return;
            }
            if (i == 1 && org.telegram.messenger.p110.o9.b(o9.f.LOGIN_DIRECT_SMS)) {
                m0();
            }
            RLottieDrawable rLottieDrawable = this.o;
            if (rLottieDrawable != null) {
                rLottieDrawable.X(0);
            }
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.m.this.j0();
                }
            }, 100L);
        }

        @Override
        public String getHeaderName() {
            int i = this.A;
            return (i == 1 || i == 11) ? this.a : LocaleController.getString("YourCode", R.string.YourCode);
        }

        @Override
        public void h(Bundle bundle) {
            Bundle bundle2 = bundle.getBundle("smsview_params_" + this.A);
            this.l = bundle2;
            if (bundle2 != null) {
                j(bundle2, true);
            }
            String string = bundle.getString("catchedPhone");
            if (string != null) {
                this.I = string;
            }
            String string2 = bundle.getString("smsview_code_" + this.A);
            if (string2 != null) {
                gi0 gi0Var = this.e;
                if (gi0Var.e != null) {
                    gi0Var.setText(string2);
                }
            }
            int i = bundle.getInt("time");
            if (i != 0) {
                this.t = i;
            }
            int i2 = bundle.getInt("open");
            if (i2 != 0) {
                this.r = i2;
            }
        }

        @Override
        public void i(Bundle bundle) {
            String code = this.e.getCode();
            if (code.length() != 0) {
                bundle.putString("smsview_code_" + this.A, code);
            }
            String str = this.I;
            if (str != null) {
                bundle.putString("catchedPhone", str);
            }
            if (this.l != null) {
                bundle.putBundle("smsview_params_" + this.A, this.l);
            }
            int i = this.t;
            if (i != 0) {
                bundle.putInt("time", i);
            }
            int i2 = this.r;
            if (i2 != 0) {
                bundle.putInt("open", i2);
            }
        }

        @Override
        public void j(Bundle bundle, boolean z) {
            NotificationCenter globalInstance;
            int i;
            int i2;
            o oVar;
            CharSequence charSequence;
            String formatString;
            int i3;
            int i4;
            String str;
            String string;
            int i5;
            TextView textView;
            String formatString2;
            if (bundle == null) {
                return;
            }
            this.x = true;
            int i6 = this.A;
            if (i6 == 2) {
                AndroidUtilities.setWaitingForSms(true);
                globalInstance = NotificationCenter.getGlobalInstance();
                i = NotificationCenter.didReceiveSmsCode;
            } else {
                if (i6 == 3) {
                    AndroidUtilities.setWaitingForCall(true);
                    globalInstance = NotificationCenter.getGlobalInstance();
                    i = NotificationCenter.didReceiveCall;
                }
                this.l = bundle;
                this.a = bundle.getString("phone");
                this.d = bundle.getString("ephone");
                this.c = bundle.getString("phoneFormated");
                this.b = bundle.getString("phoneHash");
                this.t = bundle.getInt("timeout");
                this.r = (int) (System.currentTimeMillis() / 1000);
                this.B = bundle.getInt("nextType");
                this.G = bundle.getString("pattern");
                this.H = bundle.getString("prefix");
                i2 = bundle.getInt("length");
                this.J = i2;
                if (i2 == 0) {
                    this.J = 5;
                }
                this.e.d(this.J, this.A);
                oVar = this.m;
                if (oVar != null) {
                    oVar.setVisibility(this.B != 0 ? 0 : 8);
                }
                if (this.a != null) {
                    return;
                }
                String c2 = uw3.d().c(this.a);
                int i7 = this.A;
                if (i7 == 1) {
                    formatString = LocaleController.getString("SentAppCode", R.string.SentAppCode);
                } else if (i7 == 2) {
                    formatString = LocaleController.formatString("SentSmsCode", R.string.SentSmsCode, LocaleController.addNbsp(c2));
                } else if (i7 == 3) {
                    formatString = LocaleController.formatString("SentCallCode", R.string.SentCallCode, LocaleController.addNbsp(c2));
                } else {
                    if (i7 != 4) {
                        charSequence = BuildConfig.FLAVOR;
                        this.f.setText(charSequence);
                        if (this.A == 3) {
                            AndroidUtilities.showKeyboard(this.e.e[0]);
                            this.e.e[0].requestFocus();
                        } else {
                            AndroidUtilities.hideKeyboard(this.e.e[0]);
                        }
                        b0();
                        a0();
                        this.v = System.currentTimeMillis();
                        i3 = this.A;
                        if (i3 != 1) {
                            this.k.setVisibility(0);
                            this.j.setVisibility(8);
                        } else {
                            if (i3 == 3 && ((i5 = this.B) == 4 || i5 == 2)) {
                                this.k.setVisibility(8);
                                this.j.setVisibility(0);
                                int i8 = this.B;
                                if (i8 == 4) {
                                    textView = this.j;
                                    formatString2 = LocaleController.formatString("CallText", R.string.CallText, 1, 0);
                                } else {
                                    if (i8 == 2) {
                                        textView = this.j;
                                        formatString2 = LocaleController.formatString("SmsText", R.string.SmsText, 1, 0);
                                    }
                                    r11 = z ? AndroidUtilities.obtainLoginPhoneCall(this.G) : null;
                                    if (r11 == null) {
                                        String str2 = this.I;
                                        if (str2 != null) {
                                            f(str2);
                                        }
                                        Z();
                                    }
                                    f(r11);
                                }
                                textView.setText(formatString2);
                                if (z) {
                                }
                                if (r11 == null) {
                                }
                                f(r11);
                            } else {
                                if (i3 == 2 && ((i4 = this.B) == 4 || i4 == 3)) {
                                    this.j.setText(LocaleController.formatString("CallText", R.string.CallText, 2, 0));
                                    this.k.setVisibility(this.t < 1000 ? 0 : 8);
                                    this.j.setVisibility(this.t >= 1000 ? 0 : 8);
                                    SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
                                    String string2 = sharedPreferences.getString("sms_hash", null);
                                    if (!TextUtils.isEmpty(string2) && (string = sharedPreferences.getString("sms_hash_code", null)) != null) {
                                        if (string.contains(string2 + "|")) {
                                            str = string.substring(string.indexOf(124) + 1);
                                            if (str != null) {
                                                this.e.setCode(str);
                                                f(r11);
                                            }
                                        }
                                    }
                                    str = null;
                                    if (str != null) {
                                    }
                                } else if (i3 == 4 && this.B == 2) {
                                    this.j.setText(LocaleController.formatString("SmsText", R.string.SmsText, 2, 0));
                                    this.k.setVisibility(this.t < 1000 ? 0 : 8);
                                    this.j.setVisibility(this.t >= 1000 ? 0 : 8);
                                } else {
                                    this.j.setVisibility(8);
                                    this.k.setVisibility(8);
                                    Y();
                                }
                                Z();
                            }
                        }
                        if (this.A != 11) {
                            String str3 = this.H;
                            for (int i9 = 0; i9 < this.J; i9++) {
                                str3 = str3 + "0";
                            }
                            String c3 = uw3.d().c("+" + str3);
                            for (int i10 = 0; i10 < this.J; i10++) {
                                int lastIndexOf = c3.lastIndexOf("0");
                                if (lastIndexOf >= 0) {
                                    c3 = c3.substring(0, lastIndexOf);
                                }
                            }
                            this.n.setText(c3.replaceAll("\\)", BuildConfig.FLAVOR).replaceAll("\\(", BuildConfig.FLAVOR));
                            return;
                        }
                        return;
                    }
                    formatString = LocaleController.formatString("SentCallOnly", R.string.SentCallOnly, LocaleController.addNbsp(c2));
                }
                charSequence = AndroidUtilities.replaceTags(formatString);
                this.f.setText(charSequence);
                if (this.A == 3) {
                }
                b0();
                a0();
                this.v = System.currentTimeMillis();
                i3 = this.A;
                if (i3 != 1) {
                }
                if (this.A != 11) {
                }
            }
            globalInstance.addObserver(this, i);
            this.l = bundle;
            this.a = bundle.getString("phone");
            this.d = bundle.getString("ephone");
            this.c = bundle.getString("phoneFormated");
            this.b = bundle.getString("phoneHash");
            this.t = bundle.getInt("timeout");
            this.r = (int) (System.currentTimeMillis() / 1000);
            this.B = bundle.getInt("nextType");
            this.G = bundle.getString("pattern");
            this.H = bundle.getString("prefix");
            i2 = bundle.getInt("length");
            this.J = i2;
            if (i2 == 0) {
            }
            this.e.d(this.J, this.A);
            oVar = this.m;
            if (oVar != null) {
            }
            if (this.a != null) {
            }
        }

        @Override
        protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
            int i5;
            int measuredHeight;
            TextView textView;
            int left;
            TextView textView2;
            super.onLayout(z, i, i2, i3, i4);
            if (this.A == 3 || this.i == null) {
                return;
            }
            int bottom = this.f.getBottom();
            int measuredHeight2 = getMeasuredHeight() - bottom;
            if (this.k.getVisibility() == 0) {
                measuredHeight = this.k.getMeasuredHeight();
                i5 = (measuredHeight2 + bottom) - measuredHeight;
                textView = this.k;
                left = textView.getLeft();
                textView2 = this.k;
            } else {
                if (this.j.getVisibility() != 0) {
                    i5 = measuredHeight2 + bottom;
                    int measuredHeight3 = this.e.getMeasuredHeight();
                    int i6 = (((i5 - bottom) - measuredHeight3) / 2) + bottom;
                    gi0 gi0Var = this.e;
                    gi0Var.layout(gi0Var.getLeft(), i6, this.e.getRight(), measuredHeight3 + i6);
                }
                measuredHeight = this.j.getMeasuredHeight();
                i5 = (measuredHeight2 + bottom) - measuredHeight;
                textView = this.j;
                left = textView.getLeft();
                textView2 = this.j;
            }
            textView.layout(left, i5, textView2.getRight(), measuredHeight + i5);
            int measuredHeight32 = this.e.getMeasuredHeight();
            int i62 = (((i5 - bottom) - measuredHeight32) / 2) + bottom;
            gi0 gi0Var2 = this.e;
            gi0Var2.layout(gi0Var2.getLeft(), i62, this.e.getRight(), measuredHeight32 + i62);
        }

        @Override
        protected void onMeasure(int i, int i2) {
            ke4 ke4Var;
            super.onMeasure(i, i2);
            if (this.A == 3 || (ke4Var = this.i) == null) {
                return;
            }
            int measuredHeight = ke4Var.getMeasuredHeight() + this.g.getMeasuredHeight() + this.f.getMeasuredHeight() + AndroidUtilities.dp(35.0f);
            int dp = AndroidUtilities.dp(80.0f);
            int dp2 = AndroidUtilities.dp(291.0f);
            if (y5.this.G - measuredHeight < dp) {
                setMeasuredDimension(getMeasuredWidth(), measuredHeight + dp);
            } else {
                setMeasuredDimension(getMeasuredWidth(), Math.min(y5.this.G, dp2));
            }
        }
    }

    public class n extends pz4 implements AdapterView.OnItemSelectedListener {
        private EditTextBoldCursor a;
        private cs1 b;
        private TextView c;
        private View d;
        private TextView e;
        private TextView f;
        private TextView g;
        private TextView h;
        private TextView i;
        private TextView j;
        private pg0 k;
        private pg0 l;
        private pg0 m;
        private int n;
        private ArrayList<l3.d> o;
        private HashMap<String, l3.d> p;
        private HashMap<String, String> q;
        private boolean r;
        private boolean s;
        private boolean t;
        private boolean u;
        private boolean v;

        class a implements TextWatcher {
            a(y5 y5Var) {
            }

            @Override
            public void afterTextChanged(Editable editable) {
                String str;
                boolean z;
                if (n.this.s) {
                    return;
                }
                n.this.s = true;
                String h = uw3.h(n.this.a.getText().toString());
                n.this.a.setText(h);
                if (h.length() == 0) {
                    n.this.c.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
                    n.this.b.setHintText((String) null);
                    n.this.n = 1;
                } else {
                    int i = 4;
                    if (h.length() > 4) {
                        while (true) {
                            if (i < 1) {
                                str = null;
                                z = false;
                                break;
                            }
                            String substring = h.substring(0, i);
                            if (((l3.d) n.this.p.get(substring)) != null) {
                                String str2 = h.substring(i) + n.this.b.getText().toString();
                                n.this.a.setText(substring);
                                z = true;
                                str = str2;
                                h = substring;
                                break;
                            }
                            i--;
                        }
                        if (!z) {
                            str = h.substring(1) + n.this.b.getText().toString();
                            EditTextBoldCursor editTextBoldCursor = n.this.a;
                            h = h.substring(0, 1);
                            editTextBoldCursor.setText(h);
                        }
                    } else {
                        str = null;
                        z = false;
                    }
                    l3.d dVar = (l3.d) n.this.p.get(h);
                    if (dVar != null) {
                        if (org.telegram.messenger.p110.o9.b(o9.f.SHOW_PROXY_BUTTON_ATLOGIN)) {
                            if (dVar.a.equalsIgnoreCase("ایران") || dVar.a.equalsIgnoreCase("Iran")) {
                                org.telegram.messenger.p110.o9.a(o9.f.PROXY_SYSTEM_ENABLED, true);
                            } else {
                                org.telegram.messenger.p110.o9.a(o9.f.PROXY_SYSTEM_ENABLED, false);
                            }
                            n.this.m.d(org.telegram.messenger.p110.o9.b(o9.f.PROXY_SYSTEM_ENABLED), true);
                            PServices.check();
                        }
                        n.this.r = true;
                        n.this.c.setText(dVar.a);
                        String str3 = (String) n.this.q.get(h);
                        n.this.b.setHintText(str3 != null ? str3.replace('X', (char) 8211) : null);
                        n.this.n = 0;
                    } else {
                        n.this.c.setText(LocaleController.getString("WrongCountry", R.string.WrongCountry));
                        n.this.b.setHintText((String) null);
                        n.this.n = 2;
                    }
                    if (!z) {
                        n.this.a.setSelection(n.this.a.getText().length());
                    }
                    if (str != null) {
                        n.this.b.requestFocus();
                        n.this.b.setText(str);
                        n.this.b.setSelection(n.this.b.length());
                    }
                }
                n.this.s = false;
            }

            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            }
        }

        class b extends cs1 {
            b(Context context, y5 y5Var) {
                super(context);
            }

            @Override
            public boolean onKeyDown(int i, KeyEvent keyEvent) {
                if (i == 67 && n.this.b.length() == 0) {
                    n.this.a.requestFocus();
                    n.this.a.setSelection(n.this.a.length());
                    n.this.a.dispatchKeyEvent(keyEvent);
                }
                return super.onKeyDown(i, keyEvent);
            }

            @Override
            public boolean onTouchEvent(MotionEvent motionEvent) {
                if (motionEvent.getAction() == 0 && !AndroidUtilities.showKeyboard(this)) {
                    clearFocus();
                    requestFocus();
                }
                return super.onTouchEvent(motionEvent);
            }
        }

        class c implements TextWatcher {
            private int a = -1;
            private int b;

            c(y5 y5Var) {
            }

            @Override
            public void afterTextChanged(Editable editable) {
                int i;
                int i2;
                if (n.this.t) {
                    return;
                }
                int selectionStart = n.this.b.getSelectionStart();
                String obj = n.this.b.getText().toString();
                if (this.a == 3) {
                    obj = obj.substring(0, this.b) + obj.substring(this.b + 1);
                    selectionStart--;
                }
                StringBuilder sb = new StringBuilder(obj.length());
                int i3 = 0;
                while (i3 < obj.length()) {
                    int i4 = i3 + 1;
                    String substring = obj.substring(i3, i4);
                    if ("0123456789".contains(substring)) {
                        sb.append(substring);
                    }
                    i3 = i4;
                }
                n.this.t = true;
                String hintText = n.this.b.getHintText();
                if (hintText != null) {
                    int i5 = 0;
                    while (true) {
                        if (i5 >= sb.length()) {
                            break;
                        }
                        if (i5 < hintText.length()) {
                            if (hintText.charAt(i5) == ' ') {
                                sb.insert(i5, ' ');
                                i5++;
                                if (selectionStart == i5 && (i2 = this.a) != 2 && i2 != 3) {
                                    selectionStart++;
                                }
                            }
                            i5++;
                        } else {
                            sb.insert(i5, ' ');
                            if (selectionStart == i5 + 1 && (i = this.a) != 2 && i != 3) {
                                selectionStart++;
                            }
                        }
                    }
                }
                editable.replace(0, editable.length(), sb);
                if (selectionStart >= 0) {
                    n.this.b.setSelection(Math.min(selectionStart, n.this.b.length()));
                }
                n.this.b.K();
                n.this.t = false;
            }

            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                int i4;
                if (i2 == 0 && i3 == 1) {
                    this.a = 1;
                    return;
                }
                if (i2 != 1 || i3 != 0) {
                    i4 = -1;
                } else {
                    if (charSequence.charAt(i) == ' ' && i > 0) {
                        this.a = 3;
                        this.b = i - 1;
                        return;
                    }
                    i4 = 2;
                }
                this.a = i4;
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            }
        }

        class d implements View.OnClickListener {
            d(y5 y5Var) {
            }

            @Override
            public void onClick(View view) {
                if (y5.this.c0() == null) {
                    return;
                }
                ((pg0) view).d(org.telegram.messenger.p110.o9.m(o9.f.PROXY_SYSTEM_ENABLED), true);
                PServices.check();
            }
        }

        class e implements View.OnClickListener {
            private Toast a;

            e(y5 y5Var) {
            }

            @Override
            public void onClick(View view) {
                org.telegram.ui.Components.b0 D;
                int i;
                int i2;
                String str;
                if (y5.this.c0() == null) {
                    return;
                }
                y5.this.A = !r0.A;
                ((pg0) view).d(y5.this.A, true);
                try {
                    Toast toast = this.a;
                    if (toast != null) {
                        toast.cancel();
                    }
                } catch (Exception e) {
                    FileLog.e(e);
                }
                if (y5.this.A) {
                    D = org.telegram.ui.Components.b0.D((FrameLayout) ((org.telegram.ui.ActionBar.k) y5.this).e, null);
                    i = R.raw.contacts_sync_on;
                    i2 = R.string.SyncContactsOn;
                    str = "SyncContactsOn";
                } else {
                    D = org.telegram.ui.Components.b0.D((FrameLayout) ((org.telegram.ui.ActionBar.k) y5.this).e, null);
                    i = R.raw.contacts_sync_off;
                    i2 = R.string.SyncContactsOff;
                    str = "SyncContactsOff";
                }
                D.z(i, LocaleController.getString(str, i2)).J();
            }
        }

        class f implements x12.a {
            f() {
            }

            @Override
            public void close() {
                org.telegram.messenger.p110.o9.a(o9.f.LANG_SELECTED_ATLOGIN, true);
                if (y5.this.a0 != null) {
                    y5.this.a0.dismiss();
                }
                LaunchActivity launchActivity = LaunchActivity.t0;
                if (launchActivity != null) {
                    launchActivity.y3(true);
                }
            }
        }

        public n(Context context) {
            super(context);
            this.n = 0;
            this.o = new ArrayList<>();
            this.p = new HashMap<>();
            this.q = new HashMap<>();
            this.r = false;
            this.s = false;
            this.t = false;
            this.u = false;
            setOrientation(1);
            TextView textView = new TextView(context);
            this.c = textView;
            textView.setTextSize(1, 18.0f);
            this.c.setPadding(AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f));
            this.c.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.c.setMaxLines(1);
            this.c.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.c.setSingleLine(true);
            this.c.setEllipsize(TextUtils.TruncateAt.END);
            this.c.setGravity((LocaleController.isRTL ? 5 : 3) | 1);
            this.c.setBackground(org.telegram.ui.ActionBar.w.S0(org.telegram.ui.ActionBar.w.r1("listSelectorSDK21"), 7));
            addView(this.c, g52.h(-1, 36, 0.0f, 0.0f, 0.0f, 14.0f));
            this.c.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    y5.n.this.c0(view);
                }
            });
            View view = new View(context);
            this.d = view;
            view.setPadding(AndroidUtilities.dp(12.0f), 0, AndroidUtilities.dp(12.0f), 0);
            this.d.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayLine"));
            addView(this.d, g52.h(-1, 1, 4.0f, -17.5f, 4.0f, 0.0f));
            LinearLayout linearLayout = new LinearLayout(context);
            linearLayout.setOrientation(0);
            addView(linearLayout, g52.h(-1, -2, 0.0f, 20.0f, 0.0f, 0.0f));
            TextView textView2 = new TextView(context);
            this.e = textView2;
            textView2.setText("+");
            this.e.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.e.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.e.setTextSize(1, 18.0f);
            linearLayout.addView(this.e, g52.f(-2, -2));
            EditTextBoldCursor editTextBoldCursor = new EditTextBoldCursor(context);
            this.a = editTextBoldCursor;
            editTextBoldCursor.setInputType(3);
            this.a.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.a.setBackgroundDrawable(org.telegram.ui.ActionBar.w.K0(context, false));
            this.a.setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.a.setCursorSize(AndroidUtilities.dp(20.0f));
            this.a.setCursorWidth(1.5f);
            this.a.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.a.setPadding(AndroidUtilities.dp(10.0f), 0, 0, 0);
            this.a.setTextSize(1, 18.0f);
            this.a.setMaxLines(1);
            this.a.setGravity(19);
            this.a.setImeOptions(268435461);
            this.a.setFilters(new InputFilter[]{new InputFilter.LengthFilter(5)});
            linearLayout.addView(this.a, g52.h(55, 36, -9.0f, 0.0f, 16.0f, 0.0f));
            this.a.addTextChangedListener(new a(y5.this));
            this.a.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public final boolean onEditorAction(TextView textView3, int i, KeyEvent keyEvent) {
                    boolean d0;
                    d0 = y5.n.this.d0(textView3, i, keyEvent);
                    return d0;
                }
            });
            b bVar = new b(context, y5.this);
            this.b = bVar;
            bVar.setInputType(3);
            this.b.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.b.setHintTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteHintText"));
            this.b.setBackgroundDrawable(org.telegram.ui.ActionBar.w.K0(context, false));
            this.b.setPadding(0, 0, 0, 0);
            this.b.setCursorColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            this.b.setCursorSize(AndroidUtilities.dp(20.0f));
            this.b.setCursorWidth(1.5f);
            this.b.setTextSize(1, 18.0f);
            this.b.setMaxLines(1);
            this.b.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.b.setGravity(19);
            this.b.setImeOptions(268435461);
            linearLayout.addView(this.b, g52.a(-1, 36.0f));
            this.b.addTextChangedListener(new c(y5.this));
            this.b.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public final boolean onEditorAction(TextView textView3, int i, KeyEvent keyEvent) {
                    boolean e0;
                    e0 = y5.n.this.e0(textView3, i, keyEvent);
                    return e0;
                }
            });
            TextView textView3 = new TextView(context);
            this.f = textView3;
            textView3.setText(LocaleController.getString("StartText", R.string.StartText));
            this.f.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.f.setTextSize(1, 14.0f);
            this.f.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.f.setGravity(LocaleController.isRTL ? 5 : 3);
            this.f.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.f, g52.m(-2, -2, LocaleController.isRTL ? 5 : 3, 0, 28, 0, 10));
            if (org.telegram.messenger.p110.o9.b(o9.f.SHOW_PROXY_BUTTON_ATLOGIN)) {
                pg0 pg0Var = new pg0(context, 2);
                this.m = pg0Var;
                pg0Var.e(LocaleController.getString("UseSmartProxy", R.string.UseSmartProxy), BuildConfig.FLAVOR, org.telegram.messenger.p110.o9.b(o9.f.PROXY_SYSTEM_ENABLED), false);
                addView(this.m, g52.m(-2, -1, 51, 0, 0, 0, 0));
                this.m.setOnClickListener(new d(y5.this));
            }
            if (org.telegram.messenger.p110.o9.b(o9.f.SHOW_SYNC_CONTACT_ATLOGIN) || y5.this.z) {
                pg0 pg0Var2 = new pg0(context, 2);
                this.k = pg0Var2;
                pg0Var2.e(LocaleController.getString("SyncContacts", R.string.SyncContacts), BuildConfig.FLAVOR, y5.this.A, false);
                addView(this.k, g52.m(-2, -1, 51, 0, 0, 0, 0));
                this.k.setOnClickListener(new e(y5.this));
            }
            if (org.telegram.messenger.p110.o9.b(o9.f.LOGINBUTTON_LOGIN_ENABLED)) {
                FrameLayout frameLayout = new FrameLayout(context);
                TextView textView4 = new TextView(context);
                this.j = textView4;
                textView4.setText(LocaleController.getString("Login", R.string.Login));
                this.j.setGravity(17);
                this.j.setTextColor(-1);
                this.j.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                this.j.setTextSize(1, 14.0f);
                this.j.setBackgroundDrawable(org.telegram.ui.ActionBar.w.Z0(AndroidUtilities.dp(4.0f), org.telegram.ui.ActionBar.w.r1("actionBarDefault"), org.telegram.ui.ActionBar.w.r1("actionBarDefault")));
                this.j.setPadding(AndroidUtilities.dp(34.0f), 0, AndroidUtilities.dp(34.0f), 0);
                frameLayout.addView(this.j, g52.b(-1, 42.0f, 49, 0.0f, 0.0f, 0.0f, 0.0f));
                this.j.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view2) {
                        y5.n.this.f0(view2);
                    }
                });
                ImageView imageView = new ImageView(context);
                imageView.setScaleType(ImageView.ScaleType.CENTER);
                imageView.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("chats_actionIcon"), PorterDuff.Mode.MULTIPLY));
                imageView.setImageResource(org.telegram.messenger.R.drawable.actionbtn_next);
                imageView.setContentDescription(LocaleController.getString("Done", R.string.Done));
                frameLayout.addView(imageView, g52.b(42, 42.0f, 53, 0.0f, 0.0f, 0.0f, 0.0f));
                addView(frameLayout, g52.m(-1, 42, 49, 10, 10, 10, 0));
            }
            TextView textView5 = new TextView(context);
            this.g = textView5;
            textView5.setText(LocaleController.getString("RestartDetailText", R.string.RestartDetailText));
            this.g.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText6"));
            this.g.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.g.setTextSize(1, 14.0f);
            this.g.setGravity(LocaleController.isRTL ? 5 : 3);
            this.g.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
            addView(this.g, g52.m(-1, -2, 51, 10, 50, 10, 0));
            if (org.telegram.messenger.p110.o9.b(o9.f.DEMO_LOGIN_ENABLED)) {
                TextView textView6 = new TextView(context);
                this.i = textView6;
                textView6.setText(LocaleController.getString("DemoLogin", R.string.DemoLogin));
                this.i.setGravity(17);
                this.i.setTextColor(-1);
                this.i.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                this.i.setTextSize(1, 14.0f);
                this.i.setBackgroundDrawable(org.telegram.ui.ActionBar.w.Z0(AndroidUtilities.dp(4.0f), org.telegram.ui.ActionBar.w.r1("actionBarDefault"), org.telegram.ui.ActionBar.w.r1("actionBarDefault")));
                this.i.setPadding(AndroidUtilities.dp(34.0f), 0, AndroidUtilities.dp(34.0f), 0);
                addView(this.i, g52.m(-1, 42, 49, 10, 10, 10, 0));
                this.i.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view2) {
                        y5.n.this.g0(view2);
                    }
                });
            }
            if (org.telegram.messenger.p110.o9.b(o9.f.LOGIN_RESTART_VISIBLE)) {
                TextView textView7 = new TextView(context);
                this.h = textView7;
                textView7.setText(LocaleController.getString("Restart", R.string.Restart));
                this.h.setGravity(17);
                this.h.setTextColor(-1);
                this.h.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                this.h.setTextSize(1, 14.0f);
                this.h.setBackgroundDrawable(org.telegram.ui.ActionBar.w.Z0(AndroidUtilities.dp(4.0f), org.telegram.ui.ActionBar.w.r1("actionBarDefault"), org.telegram.ui.ActionBar.w.r1("actionBarDefault")));
                this.h.setPadding(AndroidUtilities.dp(34.0f), 0, AndroidUtilities.dp(34.0f), 0);
                addView(this.h, g52.m(-1, 42, 49, 10, 10, 10, 0));
                this.h.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view2) {
                        y5.n.h0(view2);
                    }
                });
            }
            if (BuildVars.DEBUG_PRIVATE_VERSION) {
                pg0 pg0Var3 = new pg0(context, 2);
                this.l = pg0Var3;
                pg0Var3.e("Test Backend", BuildConfig.FLAVOR, y5.this.B, false);
                addView(this.l, g52.m(-2, -1, 51, 0, 0, 0, 0));
                this.l.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view2) {
                        y5.n.this.i0(view2);
                    }
                });
            }
            final HashMap hashMap = new HashMap();
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getResources().getAssets().open("countries.txt")));
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    String[] split = readLine.split(";");
                    l3.d dVar = new l3.d();
                    dVar.a = split[2];
                    dVar.b = split[0];
                    dVar.c = split[1];
                    this.o.add(0, dVar);
                    this.p.put(split[0], dVar);
                    if (split.length > 3) {
                        this.q.put(split[0], split[3]);
                    }
                    hashMap.put(split[1], split[2]);
                }
                bufferedReader.close();
            } catch (Exception e2) {
                FileLog.e(e2);
            }
            Collections.sort(this.o, Comparator$CC.comparing(new Function() {
                @Override
                public Function andThen(Function function) {
                    return Function.CC.$default$andThen(this, function);
                }

                @Override
                public final Object apply(Object obj) {
                    String str;
                    str = ((l3.d) obj).a;
                    return str;
                }

                @Override
                public Function compose(Function function) {
                    return Function.CC.$default$compose(this, function);
                }
            }));
            try {
            } catch (Exception e3) {
                FileLog.e(e3);
            }
            y5.this.G().getConnectionsManager().sendRequest(new zw5(), new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.n.this.Z(hashMap, i95Var, ov5Var);
                }
            }, 10);
            if (this.a.length() == 0) {
                this.c.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
                this.b.setHintText((String) null);
                this.n = 1;
            }
            if (this.a.length() != 0) {
                this.b.requestFocus();
                cs1 cs1Var = this.b;
                cs1Var.setSelection(cs1Var.length());
            } else {
                this.a.requestFocus();
            }
            ww5 ww5Var = new ww5();
            ww5Var.a = BuildConfig.FLAVOR;
            y5.this.K().sendRequest(ww5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.n.this.b0(i95Var, ov5Var);
                }
            }, 10);
        }

        public void W() {
            AndroidUtilities.showKeyboard(this.b);
        }

        public void X(l3.d dVar) {
            q0(dVar);
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.n.this.W();
                }
            }, 300L);
            this.b.requestFocus();
            cs1 cs1Var = this.b;
            cs1Var.setSelection(cs1Var.length());
        }

        public void Y(i95 i95Var, HashMap hashMap) {
            if (i95Var == null) {
                return;
            }
            uh6 uh6Var = (uh6) i95Var;
            if (this.a.length() == 0) {
                r0(hashMap, uh6Var.a.toUpperCase());
            }
        }

        public void Z(final HashMap hashMap, final i95 i95Var, ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.n.this.Y(i95Var, hashMap);
                }
            });
        }

        public void a0(ov5 ov5Var, i95 i95Var) {
            if (ov5Var == null) {
                this.o.clear();
                this.p.clear();
                this.q.clear();
                mw5 mw5Var = (mw5) i95Var;
                for (int i = 0; i < mw5Var.a.size(); i++) {
                    ow5 ow5Var = mw5Var.a.get(i);
                    for (int i2 = 0; i2 < ow5Var.f.size(); i2++) {
                        l3.d dVar = new l3.d();
                        dVar.a = ow5Var.d;
                        dVar.b = ow5Var.f.get(i2).b;
                        this.o.add(dVar);
                        this.p.put(ow5Var.f.get(i2).b, dVar);
                        if (ow5Var.f.get(i2).d.size() > 0) {
                            this.q.put(ow5Var.f.get(i2).b, ow5Var.f.get(i2).d.get(0));
                        }
                    }
                }
            }
        }

        public void b0(final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.n.this.a0(ov5Var, i95Var);
                }
            });
        }

        public void c0(View view) {
            l3 l3Var = new l3(true, this.o);
            l3Var.C1(new l3.g() {
                @Override
                public final void a(l3.d dVar) {
                    y5.n.this.X(dVar);
                }
            });
            y5.this.S0(l3Var);
        }

        public boolean d0(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            this.b.requestFocus();
            cs1 cs1Var = this.b;
            cs1Var.setSelection(cs1Var.length());
            return true;
        }

        public boolean e0(TextView textView, int i, KeyEvent keyEvent) {
            if (i != 5) {
                return false;
            }
            f(null);
            return true;
        }

        public void f0(View view) {
            y5.this.b3();
        }

        public void g0(View view) {
            y5.this.T0(new p3(null), true);
        }

        public static void h0(View view) {
            org.telegram.messenger.p110.q9.a(LaunchActivity.t0);
        }

        public void i0(View view) {
            if (y5.this.c0() == null) {
                return;
            }
            y5.this.B = !r0.B;
            ((pg0) view).d(y5.this.B, true);
        }

        public void k0(int i, DialogInterface dialogInterface, int i2) {
            if (UserConfig.selectedAccount != i) {
                ((LaunchActivity) y5.this.c0()).M3(i, false);
            }
            y5.this.D();
        }

        public void l0(ov5 ov5Var, i95 i95Var) {
            this.u = false;
            y5.this.f3(false, true);
            if (ov5Var != null) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
                return;
            }
            te5 te5Var = (te5) i95Var;
            if (!hf.p2(te5Var, true)) {
                org.telegram.ui.Components.b.E4(y5.this.c0(), LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
                return;
            }
            Bundle bundle = new Bundle();
            st4 st4Var = new st4(te5Var.getObjectSize());
            te5Var.serializeToStream(st4Var);
            bundle.putString("password", Utilities.bytesToHex(st4Var.d()));
            y5.this.e3(6, true, bundle, false);
        }

        public void m0(final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.n.this.l0(ov5Var, i95Var);
                }
            });
        }

        public void n0(ov5 ov5Var, Bundle bundle, i95 i95Var, kh5 kh5Var) {
            y5 y5Var;
            String string;
            int i;
            String str;
            String string2;
            this.u = false;
            if (ov5Var == null) {
                y5.this.L2(bundle, (lh5) i95Var);
            } else {
                String str2 = ov5Var.b;
                if (str2 != null) {
                    if (str2.contains("SESSION_PASSWORD_NEEDED")) {
                        ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(new ie5(), new RequestDelegate() {
                            @Override
                            public final void run(i95 i95Var2, ov5 ov5Var2) {
                                y5.n.this.m0(i95Var2, ov5Var2);
                            }
                        }, 10);
                    } else if (ov5Var.b.contains("PHONE_NUMBER_INVALID")) {
                        y5.W2(y5.this, kh5Var.a, false);
                    } else {
                        if (!ov5Var.b.contains("PHONE_PASSWORD_FLOOD")) {
                            if (ov5Var.b.contains("PHONE_NUMBER_FLOOD")) {
                                y5Var = y5.this;
                                string = LocaleController.getString("AppName", R.string.AppName);
                                i = R.string.PhoneNumberFlood;
                                str = "PhoneNumberFlood";
                            } else if (ov5Var.b.contains("PHONE_NUMBER_BANNED")) {
                                y5.W2(y5.this, kh5Var.a, true);
                            } else if (ov5Var.b.contains("PHONE_CODE_EMPTY") || ov5Var.b.contains("PHONE_CODE_INVALID")) {
                                y5Var = y5.this;
                                string = LocaleController.getString("AppName", R.string.AppName);
                                i = R.string.InvalidCode;
                                str = "InvalidCode";
                            } else if (ov5Var.b.contains("PHONE_CODE_EXPIRED")) {
                                y5Var = y5.this;
                                string = LocaleController.getString("AppName", R.string.AppName);
                                i = R.string.CodeExpired;
                                str = "CodeExpired";
                            } else if (!ov5Var.b.startsWith("FLOOD_WAIT")) {
                                if (ov5Var.a != -1000) {
                                    y5.this.V2(LocaleController.getString("AppName", R.string.AppName), ov5Var.b);
                                }
                            }
                            string2 = LocaleController.getString(str, i);
                            y5Var.V2(string, string2);
                        }
                        y5Var = y5.this;
                        string = LocaleController.getString("AppName", R.string.AppName);
                        string2 = LocaleController.getString("FloodWait", R.string.FloodWait);
                        y5Var.V2(string, string2);
                    }
                }
            }
            y5.this.T2(false);
        }

        public void o0(final Bundle bundle, final kh5 kh5Var, final i95 i95Var, final ov5 ov5Var) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.n.this.n0(ov5Var, bundle, i95Var, kh5Var);
                }
            });
        }

        public void p0() {
            View view;
            if (this.b != null) {
                if (y5.this.b0) {
                    this.a.clearFocus();
                    this.b.clearFocus();
                    return;
                }
                if (this.a.length() != 0) {
                    this.b.requestFocus();
                    cs1 cs1Var = this.b;
                    cs1Var.setSelection(cs1Var.length());
                    view = this.b;
                } else {
                    this.a.requestFocus();
                    view = this.a;
                }
                AndroidUtilities.showKeyboard(view);
            }
        }

        private void r0(HashMap<String, String> hashMap, String str) {
            if (hashMap.get(str) == null || this.o == null) {
                return;
            }
            l3.d dVar = null;
            int i = 0;
            while (true) {
                if (i < this.o.size()) {
                    if (this.o.get(i) != null && this.o.get(i).a.equals(str)) {
                        dVar = this.o.get(i);
                        break;
                    }
                    i++;
                } else {
                    break;
                }
            }
            if (dVar != null) {
                this.a.setText(dVar.b);
                this.n = 0;
            }
        }

        public void V() {
            boolean z;
            boolean z2;
            boolean z3;
            if (this.v) {
                return;
            }
            try {
                TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
                if (telephonyManager.getSimState() == 1 || telephonyManager.getPhoneType() == 0) {
                    return;
                }
                int i = Build.VERSION.SDK_INT;
                String str = null;
                if (i >= 23) {
                    z2 = y5.this.c0().checkSelfPermission("android.permission.READ_PHONE_STATE") == 0;
                    if (i >= 26 && y5.this.c0().checkSelfPermission("android.permission.READ_PHONE_NUMBERS") != 0) {
                        z = false;
                        if (y5.this.y && (!z2 || !z)) {
                            y5.this.w.clear();
                            if (!z2) {
                                y5.this.w.add("android.permission.READ_PHONE_STATE");
                            }
                            if (!z) {
                                y5.this.w.add("android.permission.READ_PHONE_NUMBERS");
                            }
                            if (y5.this.w.isEmpty()) {
                                SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
                                if (!globalMainSettings.getBoolean("firstloginshow", true) && !y5.this.c0().shouldShowRequestPermissionRationale("android.permission.READ_PHONE_STATE")) {
                                    y5.this.c0().requestPermissions((String[]) y5.this.w.toArray(new String[0]), 7);
                                    return;
                                }
                                globalMainSettings.edit().putBoolean("firstloginshow", false).commit();
                                i.C0142i c0142i = new i.C0142i(y5.this.c0());
                                c0142i.v(R.raw.incoming_calls, 46, false, org.telegram.ui.ActionBar.w.r1("dialogTopBackground"));
                                c0142i.s(LocaleController.getString("Continue", R.string.Continue), null);
                                c0142i.l(LocaleController.getString("AllowFillNumber", R.string.AllowFillNumber));
                                y5 y5Var = y5.this;
                                y5Var.u = y5Var.o1(c0142i.a());
                                y5.this.b0 = true;
                                return;
                            }
                            return;
                        }
                    }
                    z = true;
                    if (y5.this.y) {
                        y5.this.w.clear();
                        if (!z2) {
                        }
                        if (!z) {
                        }
                        if (y5.this.w.isEmpty()) {
                        }
                    }
                } else {
                    z = true;
                    z2 = true;
                }
                this.v = true;
                if (!y5.this.z && z2 && z) {
                    String h = uw3.h(telephonyManager.getLine1Number());
                    if (TextUtils.isEmpty(h)) {
                        return;
                    }
                    int i2 = 4;
                    if (h.length() > 4) {
                        while (true) {
                            if (i2 < 1) {
                                z3 = false;
                                break;
                            }
                            String substring = h.substring(0, i2);
                            if (this.p.get(substring) != null) {
                                String substring2 = h.substring(i2);
                                this.a.setText(substring);
                                str = substring2;
                                z3 = true;
                                break;
                            }
                            i2--;
                        }
                        if (!z3) {
                            str = h.substring(1);
                            this.a.setText(h.substring(0, 1));
                        }
                    }
                    if (str != null) {
                        this.b.requestFocus();
                        this.b.setText(str);
                        cs1 cs1Var = this.b;
                        cs1Var.setSelection(cs1Var.length());
                    }
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }

        @Override
        public void d() {
            this.u = false;
        }

        @Override
        public void f(String str) {
            boolean z;
            boolean z2;
            boolean z3;
            o9.f fVar;
            vq5 vq5Var;
            int i;
            String str2;
            boolean z4;
            if (y5.this.c0() == null || this.u) {
                return;
            }
            TelephonyManager telephonyManager = (TelephonyManager) ApplicationLoader.applicationContext.getSystemService("phone");
            if (BuildVars.DEBUG_VERSION) {
                FileLog.d("sim status = " + telephonyManager.getSimState());
            }
            int simState = telephonyManager.getSimState();
            boolean z5 = (simState == 1 || simState == 0 || telephonyManager.getPhoneType() == 0 || AndroidUtilities.isAirplaneModeOn()) ? false : true;
            LaunchActivity.t0.q1();
            int i2 = Build.VERSION.SDK_INT;
            if (i2 < 23 || !z5) {
                z = true;
                z2 = true;
                z3 = true;
            } else {
                z = y5.this.c0().checkSelfPermission("android.permission.READ_PHONE_STATE") == 0;
                z2 = y5.this.c0().checkSelfPermission("android.permission.CALL_PHONE") == 0;
                z3 = i2 < 28 || y5.this.c0().checkSelfPermission("android.permission.READ_CALL_LOG") == 0;
                boolean z6 = i2 < 26 || y5.this.c0().checkSelfPermission("android.permission.READ_PHONE_NUMBERS") == 0;
                if (y5.this.x) {
                    y5.this.v.clear();
                    if (!z) {
                        y5.this.v.add("android.permission.READ_PHONE_STATE");
                    }
                    if (!z2) {
                        y5.this.v.add("android.permission.CALL_PHONE");
                    }
                    if (!z3) {
                        y5.this.v.add("android.permission.READ_CALL_LOG");
                    }
                    if (!z6) {
                        y5.this.v.add("android.permission.READ_PHONE_NUMBERS");
                    }
                    if (!y5.this.v.isEmpty()) {
                        SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
                        if (globalMainSettings.getBoolean("firstlogin", true) || y5.this.c0().shouldShowRequestPermissionRationale("android.permission.READ_PHONE_STATE") || y5.this.c0().shouldShowRequestPermissionRationale("android.permission.READ_CALL_LOG")) {
                            globalMainSettings.edit().putBoolean("firstlogin", false).commit();
                            i.C0142i c0142i = new i.C0142i(y5.this.c0());
                            c0142i.s(LocaleController.getString("Contin", R.string.Continue), null);
                            int i3 = R.raw.calls_log;
                            if (!z && (!z2 || !z3)) {
                                i = R.string.AllowReadCallAndLog;
                                str2 = "AllowReadCallAndLog";
                            } else if (z2 && z3) {
                                c0142i.l(LocaleController.getString("AllowReadCall", R.string.AllowReadCall));
                                i3 = R.raw.incoming_calls;
                                c0142i.v(i3, 46, false, org.telegram.ui.ActionBar.w.r1("dialogTopBackground"));
                                y5 y5Var = y5.this;
                                y5Var.t = y5Var.o1(c0142i.a());
                            } else {
                                i = R.string.AllowReadCallLog;
                                str2 = "AllowReadCallLog";
                            }
                            c0142i.l(LocaleController.getString(str2, i));
                            c0142i.v(i3, 46, false, org.telegram.ui.ActionBar.w.r1("dialogTopBackground"));
                            y5 y5Var2 = y5.this;
                            y5Var2.t = y5Var2.o1(c0142i.a());
                        } else {
                            try {
                                y5.this.c0().requestPermissions((String[]) y5.this.v.toArray(new String[0]), 6);
                            } catch (Exception unused) {
                                z4 = false;
                            }
                        }
                        z4 = true;
                        if (z4) {
                            return;
                        }
                    }
                }
            }
            int i4 = this.n;
            if (i4 == 1) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
                return;
            }
            if (i4 == 2 && !BuildVars.DEBUG_VERSION) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("WrongCountry", R.string.WrongCountry));
                return;
            }
            if (this.a.length() == 0) {
                y5.this.V2(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
                return;
            }
            if (this.b.length() == 0) {
                y5.this.c3(this.b);
                return;
            }
            String h = uw3.h(BuildConfig.FLAVOR + ((Object) this.a.getText()) + ((Object) this.b.getText()));
            boolean z7 = BuildVars.DEBUG_PRIVATE_VERSION && y5.this.K().isTestBackend();
            if (z7 != y5.this.B) {
                y5.this.K().switchBackend(false);
                z7 = y5.this.B;
            }
            if (y5.this.c0() instanceof LaunchActivity) {
                for (final int i5 = 0; i5 < 3; i5++) {
                    UserConfig userConfig = UserConfig.getInstance(i5);
                    if (userConfig.isClientActivated() && PhoneNumberUtils.compare(h, userConfig.getCurrentUser().f) && ConnectionsManager.getInstance(i5).isTestBackend() == z7) {
                        i.C0142i c0142i2 = new i.C0142i(y5.this.c0());
                        c0142i2.u(LocaleController.getString("AppName", R.string.AppName));
                        c0142i2.l(LocaleController.getString("AccountAlreadyLoggedIn", R.string.AccountAlreadyLoggedIn));
                        c0142i2.s(LocaleController.getString("AccountSwitch", R.string.AccountSwitch), new DialogInterface.OnClickListener() {
                            @Override
                            public final void onClick(DialogInterface dialogInterface, int i6) {
                                y5.n.this.k0(i5, dialogInterface, i6);
                            }
                        });
                        c0142i2.n(LocaleController.getString("OK", R.string.OK), null);
                        y5.this.o1(c0142i2.a());
                        return;
                    }
                }
            }
            ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).cleanup(false);
            final kh5 kh5Var = new kh5();
            if (org.telegram.messenger.p110.o9.b(o9.f.USE_TELEGRAM_APPID_JUSTFORLOGIN) || org.telegram.messenger.p110.o9.b(o9.f.USE_TELEGRAM_APPID)) {
                kh5Var.c = org.telegram.messenger.p110.o9.k(o9.f.TELEGRAM_APPHASH);
                fVar = o9.f.TELEGRAM_APPID;
            } else if (org.telegram.messenger.p110.o9.b(o9.f.USE_LOGIN_APP_ID_FROM_SERVER)) {
                kh5Var.c = org.telegram.messenger.p110.o9.k(o9.f.SERVER_APP_HASH);
                fVar = o9.f.SERVER_APP_ID;
            } else {
                kh5Var.c = org.telegram.messenger.p110.o9.k(o9.f.APP_HASH);
                fVar = o9.f.APP_ID;
            }
            kh5Var.b = org.telegram.messenger.p110.o9.c(fVar);
            kh5Var.a = h;
            vq5 vq5Var2 = new vq5();
            kh5Var.d = vq5Var2;
            vq5Var2.b = z5 && z && z2 && z3;
            vq5Var2.e = z5 && z;
            vq5Var2.d = ApplicationLoader.hasPlayServices;
            ArrayList<eh5> savedLogOutTokens = MessagesController.getSavedLogOutTokens();
            if (savedLogOutTokens != null) {
                for (int i6 = 0; i6 < savedLogOutTokens.size(); i6++) {
                    vq5 vq5Var3 = kh5Var.d;
                    if (vq5Var3.f == null) {
                        vq5Var3.f = new ArrayList<>();
                    }
                    kh5Var.d.f.add(savedLogOutTokens.get(i6).b);
                }
                MessagesController.saveLogOutTokens(savedLogOutTokens);
            }
            vq5 vq5Var4 = kh5Var.d;
            if (vq5Var4.f != null) {
                vq5Var4.a |= 64;
            }
            SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
            boolean z8 = kh5Var.d.d;
            SharedPreferences.Editor edit = sharedPreferences.edit();
            (z8 ? edit.putString("sms_hash", BuildVars.SMS_HASH) : edit.remove("sms_hash")).commit();
            if (kh5Var.d.b) {
                try {
                    String line1Number = telephonyManager.getLine1Number();
                    if (!TextUtils.isEmpty(line1Number)) {
                        kh5Var.d.c = PhoneNumberUtils.compare(h, line1Number);
                        vq5Var = kh5Var.d;
                    } else if (UserConfig.getActivatedAccountsCount() > 0) {
                        vq5Var = kh5Var.d;
                    } else {
                        kh5Var.d.c = false;
                    }
                    vq5Var.b = false;
                } catch (Exception e2) {
                    kh5Var.d.b = false;
                    FileLog.e(e2);
                }
            }
            final Bundle bundle = new Bundle();
            bundle.putString("phone", "+" + ((Object) this.a.getText()) + " " + ((Object) this.b.getText()));
            try {
                bundle.putString("ephone", "+" + uw3.h(this.a.getText().toString()) + " " + uw3.h(this.b.getText().toString()));
            } catch (Exception e3) {
                FileLog.e(e3);
                bundle.putString("ephone", "+" + h);
            }
            bundle.putString("phoneFormated", h);
            this.u = true;
            y5.this.X2(ConnectionsManager.getInstance(((org.telegram.ui.ActionBar.k) y5.this).d).sendRequest(kh5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    y5.n.this.o0(bundle, kh5Var, i95Var, ov5Var);
                }
            }, 27));
        }

        @Override
        public void g() {
            super.g();
            if (!y5.this.z && !y5.this.Q && org.telegram.messenger.p110.o9.b(o9.f.SHOW_SELECT_LANG_ATFIRSTLOGIN) && org.telegram.messenger.p110.o9.h(o9.f.LANG_SELECTED_ATLOGIN)) {
                y5.this.a0 = new i.C0142i(getContext()).u("Select Language").A(new x12(getContext(), new f())).C();
                y5.this.Q = true;
            }
            V();
            pg0 pg0Var = this.k;
            if (pg0Var != null) {
                pg0Var.d(y5.this.A, false);
            }
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    y5.n.this.p0();
                }
            }, 100L);
        }

        @Override
        public String getHeaderName() {
            return LocaleController.getString("YourPhone", R.string.YourPhone);
        }

        @Override
        public void h(Bundle bundle) {
            String string = bundle.getString("phoneview_code");
            if (string != null) {
                this.a.setText(string);
            }
            String string2 = bundle.getString("phoneview_phone");
            if (string2 != null) {
                this.b.setText(string2);
            }
        }

        @Override
        public void i(Bundle bundle) {
            String obj = this.a.getText().toString();
            if (obj.length() != 0) {
                bundle.putString("phoneview_code", obj);
            }
            String obj2 = this.b.getText().toString();
            if (obj2.length() != 0) {
                bundle.putString("phoneview_phone", obj2);
            }
        }

        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
            if (this.r) {
                this.r = false;
                return;
            }
            this.s = true;
            this.a.setText(this.o.get(i).b);
            this.s = false;
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }

        public void q0(l3.d dVar) {
            if (org.telegram.messenger.p110.o9.b(o9.f.SHOW_PROXY_BUTTON_ATLOGIN)) {
                if (dVar.b.equalsIgnoreCase("ir")) {
                    org.telegram.messenger.p110.o9.a(o9.f.PROXY_SYSTEM_ENABLED, true);
                } else {
                    org.telegram.messenger.p110.o9.a(o9.f.PROXY_SYSTEM_ENABLED, false);
                }
                this.m.d(org.telegram.messenger.p110.o9.b(o9.f.PROXY_SYSTEM_ENABLED), true);
                PServices.check();
            }
            this.s = true;
            String str = dVar.b;
            this.a.setText(str);
            this.c.setText(dVar.a);
            String str2 = this.q.get(str);
            this.b.setHintText(str2 != null ? str2.replace('X', (char) 8211) : null);
            this.n = 0;
            this.s = false;
        }
    }

    public static class o extends View {
        private final Path a;
        private final RectF b;
        private final RectF c;
        private final Paint d;
        private final Paint e;
        private long f;
        private long g;
        private boolean h;
        private float i;

        public o(Context context) {
            super(context);
            this.a = new Path();
            this.b = new RectF();
            this.c = new RectF();
            Paint paint = new Paint(1);
            this.d = paint;
            Paint paint2 = new Paint(1);
            this.e = paint2;
            paint.setColor(org.telegram.ui.ActionBar.w.r1("login_progressInner"));
            paint2.setColor(org.telegram.ui.ActionBar.w.r1("login_progressOuter"));
        }

        public boolean a() {
            return this.h;
        }

        public void b() {
            this.g = 0L;
            this.f = 0L;
            this.h = false;
            invalidate();
        }

        public void c(long j) {
            this.h = true;
            this.g = j;
            this.f = System.currentTimeMillis();
            invalidate();
        }

        @Override
        protected void onDraw(Canvas canvas) {
            float min = this.g > 0 ? Math.min(1.0f, ((float) (System.currentTimeMillis() - this.f)) / ((float) this.g)) : 0.0f;
            canvas.clipPath(this.a);
            RectF rectF = this.c;
            float f = this.i;
            canvas.drawRoundRect(rectF, f, f, this.d);
            RectF rectF2 = this.b;
            rectF2.right = this.c.right * min;
            float f2 = this.i;
            canvas.drawRoundRect(rectF2, f2, f2, this.e);
            boolean z = this.h & (this.g > 0 && min < 1.0f);
            this.h = z;
            if (z) {
                postInvalidateOnAnimation();
            }
        }

        @Override
        protected void onSizeChanged(int i, int i2, int i3, int i4) {
            this.a.rewind();
            float f = i2;
            this.i = f / 2.0f;
            this.c.set(0.0f, 0.0f, i, f);
            this.b.set(this.c);
            Path path = this.a;
            RectF rectF = this.c;
            float f2 = this.i;
            path.addRoundRect(rectF, f2, f2, Path.Direction.CW);
        }
    }

    public y5() {
        this.r = new pz4[12];
        this.v = new ArrayList<>();
        this.w = new ArrayList<>();
        this.x = true;
        this.y = true;
        this.A = true;
        this.B = false;
        this.I = new AnimatorSet[2];
        this.Q = false;
        this.Z = new boolean[]{true, false};
    }

    public y5(int i2) {
        this.r = new pz4[12];
        this.v = new ArrayList<>();
        this.w = new ArrayList<>();
        this.x = true;
        this.y = true;
        this.A = true;
        this.B = false;
        this.I = new AnimatorSet[2];
        this.Q = false;
        this.Z = new boolean[]{true, false};
        this.d = i2;
        this.z = true;
    }

    private void K2() {
        SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0).edit();
        edit.clear();
        edit.commit();
    }

    public void L2(Bundle bundle, lh5 lh5Var) {
        bundle.putString("phoneHash", lh5Var.c);
        u27 u27Var = lh5Var.d;
        if (u27Var instanceof zg5) {
            bundle.putInt("nextType", 4);
        } else if (u27Var instanceof ah5) {
            bundle.putInt("nextType", 3);
        } else if (u27Var instanceof ch5) {
            bundle.putInt("nextType", 2);
        } else if (u27Var instanceof bh5) {
            bundle.putInt("nextType", 11);
        }
        if (lh5Var.b instanceof mh5) {
            bundle.putInt("type", 1);
            bundle.putInt("length", lh5Var.b.a);
            e3(1, true, bundle, false);
            return;
        }
        if (lh5Var.e == 0) {
            lh5Var.e = 60;
        }
        bundle.putInt("timeout", lh5Var.e * 1000);
        v27 v27Var = lh5Var.b;
        if (v27Var instanceof nh5) {
            bundle.putInt("type", 4);
            bundle.putInt("length", lh5Var.b.a);
            e3(4, true, bundle, false);
            return;
        }
        if (v27Var instanceof oh5) {
            bundle.putInt("type", 3);
            bundle.putString("pattern", lh5Var.b.b);
            e3(3, true, bundle, false);
        } else if (v27Var instanceof qh5) {
            bundle.putInt("type", 2);
            bundle.putInt("length", lh5Var.b.a);
            e3(2, true, bundle, false);
        } else if (v27Var instanceof ph5) {
            bundle.putInt("type", 11);
            bundle.putInt("length", lh5Var.b.a);
            bundle.putString("prefix", lh5Var.b.c);
            e3(11, true, bundle, false);
        }
    }

    public void M2(View view) {
        b3();
    }

    public void N2() {
        m mVar;
        RLottieDrawable rLottieDrawable;
        int i2 = 0;
        while (true) {
            pz4[] pz4VarArr = this.r;
            if (i2 >= pz4VarArr.length) {
                return;
            }
            if ((pz4VarArr[i2] instanceof m) && (rLottieDrawable = (mVar = (m) pz4VarArr[i2]).o) != null) {
                rLottieDrawable.f0("Bubble.**", org.telegram.ui.ActionBar.w.r1("chats_actionBackground"));
                mVar.o.f0("Phone.**", org.telegram.ui.ActionBar.w.r1("chats_actionBackground"));
            }
            i2++;
        }
    }

    public static void O2(boolean z, String str, org.telegram.ui.ActionBar.k kVar, DialogInterface dialogInterface, int i2) {
        StringBuilder sb;
        try {
            PackageInfo packageInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
            String format = String.format(Locale.US, "%s (%d)", packageInfo.versionName, Integer.valueOf(packageInfo.versionCode));
            Intent intent = new Intent("android.intent.action.SENDTO");
            intent.setData(Uri.parse("mailto:"));
            String[] strArr = new String[1];
            strArr[0] = z ? "recover@telegram.org" : "login@stel.com";
            intent.putExtra("android.intent.extra.EMAIL", strArr);
            if (z) {
                intent.putExtra("android.intent.extra.SUBJECT", "Banned phone number: " + str);
                sb = new StringBuilder();
                sb.append("I'm trying to use my mobile phone number: ");
                sb.append(str);
                sb.append("\nBut Telegram says it's banned. Please help.\n\nApp version: ");
                sb.append(format);
                sb.append("\nOS version: SDK ");
                sb.append(Build.VERSION.SDK_INT);
                sb.append("\nDevice Name: ");
                sb.append(Build.MANUFACTURER);
                sb.append(Build.MODEL);
                sb.append("\nLocale: ");
                sb.append(Locale.getDefault());
            } else {
                intent.putExtra("android.intent.extra.SUBJECT", "Invalid phone number: " + str);
                sb = new StringBuilder();
                sb.append("I'm trying to use my mobile phone number: ");
                sb.append(str);
                sb.append("\nBut Telegram says it's invalid. Please help.\n\nApp version: ");
                sb.append(format);
                sb.append("\nOS version: SDK ");
                sb.append(Build.VERSION.SDK_INT);
                sb.append("\nDevice Name: ");
                sb.append(Build.MANUFACTURER);
                sb.append(Build.MODEL);
                sb.append("\nLocale: ");
                sb.append(Locale.getDefault());
            }
            intent.putExtra("android.intent.extra.TEXT", sb.toString());
            kVar.c0().startActivity(Intent.createChooser(intent, "Send email..."));
        } catch (Exception unused) {
            i.C0142i c0142i = new i.C0142i(kVar.c0());
            c0142i.u(LocaleController.getString("AppName", R.string.AppName));
            c0142i.l(LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
            c0142i.s(LocaleController.getString("OK", R.string.OK), null);
            kVar.o1(c0142i.a());
        }
    }

    public void P2() {
        this.b0 = false;
    }

    public void Q2(DialogInterface dialogInterface, int i2) {
        this.r[this.q].d();
        T2(true);
    }

    private Bundle R2() {
        if (this.z) {
            return null;
        }
        try {
            Bundle bundle = new Bundle();
            for (Map.Entry<String, ?> entry : ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0).getAll().entrySet()) {
                String key = entry.getKey();
                Object value = entry.getValue();
                String[] split = key.split("_\\|_");
                if (split.length == 1) {
                    if (value instanceof String) {
                        bundle.putString(key, (String) value);
                    } else if (value instanceof Integer) {
                        bundle.putInt(key, ((Integer) value).intValue());
                    }
                } else if (split.length == 2) {
                    Bundle bundle2 = bundle.getBundle(split[0]);
                    if (bundle2 == null) {
                        bundle2 = new Bundle();
                        bundle.putBundle(split[0], bundle2);
                    }
                    if (value instanceof String) {
                        bundle2.putString(split[1], (String) value);
                    } else if (value instanceof Integer) {
                        bundle2.putInt(split[1], ((Integer) value).intValue());
                    }
                }
            }
            return bundle;
        } catch (Exception e2) {
            FileLog.e(e2);
            return null;
        }
    }

    private void S2(boolean z, boolean z2, int i2) {
        p3 p3Var;
        K2();
        if (!(c0() instanceof LaunchActivity)) {
            if (c0() instanceof ExternalActionActivity) {
                ((ExternalActionActivity) c0()).J();
                return;
            }
            return;
        }
        if (this.z) {
            this.z = false;
            ((LaunchActivity) c0()).M3(this.d, false);
            D();
            return;
        }
        if (z && z2) {
            ek7 ek7Var = new ek7(6, null);
            ek7Var.I3(i2);
            p3Var = ek7Var;
        } else {
            Bundle bundle = new Bundle();
            bundle.putBoolean("afterSignup", z);
            p3Var = new p3(bundle);
        }
        T0(p3Var, true);
        NotificationCenter.getInstance(this.d).postNotificationName(NotificationCenter.mainUserInfoChanged, new Object[0]);
    }

    public void T2(boolean z) {
        U2(z, true);
    }

    public void U2(boolean z, boolean z2) {
        if (this.Y != 0) {
            if (z) {
                ConnectionsManager.getInstance(this.d).cancelRequest(this.Y, true);
            }
            this.Y = 0;
        }
        g3(false, z2);
    }

    public void V2(String str, String str2) {
        if (str2 == null || c0() == null) {
            return;
        }
        i.C0142i c0142i = new i.C0142i(c0());
        c0142i.u(str);
        c0142i.l(str2);
        c0142i.s(LocaleController.getString("OK", R.string.OK), null);
        o1(c0142i.a());
    }

    public static void W2(final org.telegram.ui.ActionBar.k kVar, final String str, final boolean z) {
        int i2;
        String str2;
        if (kVar == null || kVar.c0() == null) {
            return;
        }
        i.C0142i c0142i = new i.C0142i(kVar.c0());
        c0142i.u(LocaleController.getString("AppName", R.string.AppName));
        if (z) {
            i2 = R.string.BannedPhoneNumber;
            str2 = "BannedPhoneNumber";
        } else {
            i2 = R.string.InvalidPhoneNumber;
            str2 = "InvalidPhoneNumber";
        }
        c0142i.l(LocaleController.getString(str2, i2));
        c0142i.o(LocaleController.getString("BotHelp", R.string.BotHelp), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i3) {
                org.telegram.ui.y5.O2(z, str, kVar, dialogInterface, i3);
            }
        });
        c0142i.s(LocaleController.getString("OK", R.string.OK), null);
        kVar.o1(c0142i.a());
    }

    public void X2(int i2) {
        Y2(i2, true);
    }

    public void Y2(int i2, boolean z) {
        this.Y = i2;
        g3(true, z);
    }

    public void Z2(ug5 ug5Var) {
        a3(ug5Var, false);
    }

    public void a3(ug5 ug5Var, boolean z) {
        ConnectionsManager.getInstance(this.d).setUserId(ug5Var.e.a);
        UserConfig.getInstance(this.d).clearConfig();
        MessagesController.getInstance(this.d).cleanup();
        UserConfig.getInstance(this.d).syncContacts = this.A;
        UserConfig.getInstance(this.d).setCurrentUser(ug5Var.e);
        UserConfig.getInstance(this.d).saveConfig(true);
        MessagesStorage.getInstance(this.d).cleanup(true);
        ArrayList<f27> arrayList = new ArrayList<>();
        arrayList.add(ug5Var.e);
        MessagesStorage.getInstance(this.d).putUsersAndChats(arrayList, null, true, true);
        MessagesController.getInstance(this.d).putUser(ug5Var.e, false);
        ContactsController.getInstance(this.d).checkAppAccount();
        ConnectionsManager.getInstance(this.d).updateProxy();
        MessagesController.getInstance(this.d).checkPromoInfo(true);
        ConnectionsManager.getInstance(this.d).updateDcSettings();
        Bundle bundle = new Bundle();
        bundle.putString("method", "login");
        FirebaseAnalytics.getInstance(c0()).a("login", bundle);
        S2(z, ug5Var.b, ug5Var.c);
    }

    public void b3() {
        if (this.Z[this.H]) {
            if (this.U.getTag() == null) {
                this.r[this.q].f(null);
                return;
            }
            if (c0() == null) {
                return;
            }
            i.C0142i c0142i = new i.C0142i(c0());
            c0142i.u(LocaleController.getString("AppName", R.string.AppName));
            c0142i.l(LocaleController.getString("StopLoading", R.string.StopLoading));
            c0142i.s(LocaleController.getString("WaitMore", R.string.WaitMore), null);
            c0142i.n(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    org.telegram.ui.y5.this.Q2(dialogInterface, i2);
                }
            });
            o1(c0142i.a());
        }
    }

    public void c3(View view) {
        try {
            Vibrator vibrator = (Vibrator) c0().getSystemService("vibrator");
            if (vibrator != null) {
                vibrator.vibrate(200L);
            }
        } catch (Throwable unused) {
        }
        AndroidUtilities.shakeView(view, 2.0f, 0);
    }

    private void d3(Bundle bundle, SharedPreferences.Editor editor, String str) {
        for (String str2 : bundle.keySet()) {
            Object obj = bundle.get(str2);
            if (obj instanceof String) {
                if (str != null) {
                    str2 = str + "_|_" + str2;
                }
                editor.putString(str2, (String) obj);
            } else if (obj instanceof Integer) {
                if (str != null) {
                    str2 = str + "_|_" + str2;
                }
                editor.putInt(str2, ((Integer) obj).intValue());
            } else if (obj instanceof Bundle) {
                d3((Bundle) obj, editor, str2);
            }
        }
    }

    public void f3(boolean z, boolean z2) {
        AnimatorSet animatorSet;
        ObjectAnimator ofFloat;
        TimeInterpolator timeInterpolator;
        int i2 = this.H;
        boolean z3 = i2 == 0;
        if (this.Z[i2] == z) {
            return;
        }
        AnimatorSet[] animatorSetArr = this.I;
        if (animatorSetArr[i2] != null) {
            if (z2) {
                animatorSetArr[i2].removeAllListeners();
            }
            this.I[this.H].cancel();
        }
        boolean[] zArr = this.Z;
        int i3 = this.H;
        zArr[i3] = z;
        if (!z2) {
            if (z) {
                if (z3) {
                    this.W.setVisibility(0);
                    this.W.setTranslationY(0.0f);
                    return;
                } else {
                    this.J.setVisibility(0);
                    this.J.setScaleX(1.0f);
                    this.J.setScaleY(1.0f);
                    this.J.setAlpha(1.0f);
                    return;
                }
            }
            if (z3) {
                this.W.setVisibility(8);
                this.W.setTranslationY(AndroidUtilities.dpf2(70.0f));
                return;
            } else {
                this.J.setVisibility(8);
                this.J.setScaleX(0.1f);
                this.J.setScaleY(0.1f);
                this.J.setAlpha(0.0f);
                return;
            }
        }
        this.I[i3] = new AnimatorSet();
        if (!z) {
            if (!z3) {
                this.I[this.H].playTogether(ObjectAnimator.ofFloat(this.J, (Property<org.telegram.ui.ActionBar.d, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.J, (Property<org.telegram.ui.ActionBar.d, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.J, (Property<org.telegram.ui.ActionBar.d, Float>) View.ALPHA, 0.0f));
                this.I[this.H].addListener(new e(z3, z));
                int i4 = ImageReceiver.DEFAULT_CROSSFADE_DURATION;
                if (z3) {
                }
                this.I[this.H].setDuration(i4);
                this.I[this.H].setInterpolator(timeInterpolator);
                this.I[this.H].start();
            }
            animatorSet = this.I[this.H];
            ofFloat = ObjectAnimator.ofFloat(this.W, (Property<FrameLayout, Float>) View.TRANSLATION_Y, AndroidUtilities.dpf2(70.0f));
            animatorSet.play(ofFloat);
            this.I[this.H].addListener(new e(z3, z));
            int i42 = ImageReceiver.DEFAULT_CROSSFADE_DURATION;
            if (z3) {
            }
            this.I[this.H].setDuration(i42);
            this.I[this.H].setInterpolator(timeInterpolator);
            this.I[this.H].start();
        }
        if (!z3) {
            this.J.setVisibility(0);
            this.I[this.H].playTogether(ObjectAnimator.ofFloat(this.J, (Property<org.telegram.ui.ActionBar.d, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.J, (Property<org.telegram.ui.ActionBar.d, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.J, (Property<org.telegram.ui.ActionBar.d, Float>) View.ALPHA, 1.0f));
            this.I[this.H].addListener(new e(z3, z));
            int i422 = ImageReceiver.DEFAULT_CROSSFADE_DURATION;
            if (z3) {
            }
            this.I[this.H].setDuration(i422);
            this.I[this.H].setInterpolator(timeInterpolator);
            this.I[this.H].start();
        }
        if (this.W.getVisibility() != 0) {
            this.W.setTranslationY(AndroidUtilities.dpf2(70.0f));
            this.W.setVisibility(0);
        }
        animatorSet = this.I[this.H];
        ofFloat = ObjectAnimator.ofFloat(this.W, (Property<FrameLayout, Float>) View.TRANSLATION_Y, 0.0f);
        animatorSet.play(ofFloat);
        this.I[this.H].addListener(new e(z3, z));
        int i4222 = ImageReceiver.DEFAULT_CROSSFADE_DURATION;
        if (z3) {
            timeInterpolator = null;
        } else if (z) {
            i4222 = 200;
            timeInterpolator = AndroidUtilities.decelerateInterpolator;
        } else {
            timeInterpolator = AndroidUtilities.accelerateInterpolator;
        }
        this.I[this.H].setDuration(i4222);
        this.I[this.H].setInterpolator(timeInterpolator);
        this.I[this.H].start();
    }

    private void g3(boolean z, boolean z2) {
        View contentView;
        AnimatorSet animatorSet = this.T;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        boolean z3 = this.H == 0;
        if (z2) {
            this.T = new AnimatorSet();
            if (z) {
                this.U.setTag(1);
                if (z3) {
                    this.X.setVisibility(0);
                    this.W.setEnabled(false);
                    this.T.playTogether(ObjectAnimator.ofFloat(this.V, (Property<ImageView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.V, (Property<ImageView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.V, (Property<ImageView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.X, (Property<RadialProgressView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.X, (Property<RadialProgressView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.X, (Property<RadialProgressView, Float>) View.ALPHA, 1.0f));
                } else {
                    this.U.setVisibility(0);
                    this.T.playTogether(ObjectAnimator.ofFloat(this.J.getContentView(), (Property<View, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.J.getContentView(), (Property<View, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.J.getContentView(), (Property<View, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.U, (Property<rp0, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.U, (Property<rp0, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.U, (Property<rp0, Float>) View.ALPHA, 1.0f));
                }
            } else {
                this.U.setTag(null);
                if (z3) {
                    this.V.setVisibility(0);
                    this.W.setEnabled(true);
                    this.T.playTogether(ObjectAnimator.ofFloat(this.X, (Property<RadialProgressView, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.X, (Property<RadialProgressView, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.X, (Property<RadialProgressView, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.V, (Property<ImageView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.V, (Property<ImageView, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.V, (Property<ImageView, Float>) View.ALPHA, 1.0f));
                } else {
                    this.J.getContentView().setVisibility(0);
                    this.T.playTogether(ObjectAnimator.ofFloat(this.U, (Property<rp0, Float>) View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.U, (Property<rp0, Float>) View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.U, (Property<rp0, Float>) View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.J.getContentView(), (Property<View, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.J.getContentView(), (Property<View, Float>) View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.J.getContentView(), (Property<View, Float>) View.ALPHA, 1.0f));
                }
            }
            this.T.addListener(new f(z3, z));
            this.T.setDuration(150L);
            this.T.start();
            return;
        }
        if (!z) {
            this.U.setTag(null);
            if (z3) {
                this.X.setVisibility(4);
                this.V.setVisibility(0);
                this.W.setEnabled(true);
                this.X.setScaleX(0.1f);
                this.X.setScaleY(0.1f);
                this.X.setAlpha(0.0f);
                this.V.setScaleX(1.0f);
                this.V.setScaleY(1.0f);
                this.V.setAlpha(1.0f);
                return;
            }
            this.J.getContentView().setVisibility(0);
            this.U.setVisibility(4);
            this.U.setScaleX(0.1f);
            this.U.setScaleY(0.1f);
            this.U.setAlpha(0.0f);
            this.J.getContentView().setScaleX(1.0f);
            this.J.getContentView().setScaleY(1.0f);
            contentView = this.J.getContentView();
        } else {
            if (z3) {
                this.X.setVisibility(0);
                this.V.setVisibility(4);
                this.W.setEnabled(false);
                this.V.setScaleX(0.1f);
                this.V.setScaleY(0.1f);
                this.V.setAlpha(0.0f);
                this.X.setScaleX(1.0f);
                this.X.setScaleY(1.0f);
                this.X.setAlpha(1.0f);
                return;
            }
            this.U.setVisibility(0);
            this.J.getContentView().setVisibility(4);
            this.J.getContentView().setScaleX(0.1f);
            this.J.getContentView().setScaleY(0.1f);
            this.J.getContentView().setAlpha(0.0f);
            this.U.setScaleX(1.0f);
            this.U.setScaleY(1.0f);
            contentView = this.U;
        }
        contentView.setAlpha(1.0f);
    }

    @Override
    public void D0(Dialog dialog) {
        if (Build.VERSION.SDK_INT >= 23) {
            try {
                if (dialog == this.t && !this.v.isEmpty() && c0() != null) {
                    c0().requestPermissions((String[]) this.v.toArray(new String[0]), 6);
                } else {
                    if (dialog != this.u || this.w.isEmpty() || c0() == null) {
                        return;
                    }
                    AndroidUtilities.runOnUIThread(new Runnable() {
                        @Override
                        public final void run() {
                            org.telegram.ui.y5.this.P2();
                        }
                    }, 200L);
                    c0().requestPermissions((String[]) this.w.toArray(new String[0]), 7);
                }
            } catch (Exception unused) {
            }
        }
    }

    @Override
    public void F0() {
        super.F0();
        int i2 = 0;
        while (true) {
            pz4[] pz4VarArr = this.r;
            if (i2 >= pz4VarArr.length) {
                return;
            }
            if (pz4VarArr[i2] != null) {
                pz4VarArr[i2].e();
            }
            i2++;
        }
    }

    @Override
    public void H0() {
        super.H0();
        if (this.z) {
            ConnectionsManager.getInstance(this.d).setAppPaused(true, false);
        }
    }

    @Override
    public void K0(int i2, String[] strArr, int[] iArr) {
        if (i2 == 6) {
            this.x = false;
            int i3 = this.q;
            if (i3 == 0) {
                this.r[i3].f(null);
                return;
            }
            return;
        }
        if (i2 == 7) {
            this.y = false;
            int i4 = this.q;
            if (i4 == 0) {
                ((n) this.r[i4]).V();
            }
        }
    }

    @Override
    public void M0() {
        pz4 pz4Var;
        int i2;
        super.M0();
        if (this.z) {
            ConnectionsManager.getInstance(this.d).setAppPaused(false, false);
        }
        AndroidUtilities.requestAdjustResize(c0(), this.k);
        this.e.requestLayout();
        try {
            int i3 = this.q;
            if (i3 >= 1 && i3 <= 4) {
                pz4[] pz4VarArr = this.r;
                if ((pz4VarArr[i3] instanceof m) && (i2 = ((m) pz4VarArr[i3]).r) != 0 && Math.abs((System.currentTimeMillis() / 1000) - i2) >= 86400) {
                    this.r[this.q].b(true);
                    e3(0, false, null, true);
                }
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        int i4 = this.q;
        if (i4 != 0 || this.b0 || (pz4Var = this.r[i4]) == null) {
            return;
        }
        pz4Var.g();
    }

    @Override
    public void a1(Bundle bundle) {
        try {
            Bundle bundle2 = new Bundle();
            bundle2.putInt("currentViewNum", this.q);
            bundle2.putInt("syncContacts", this.A ? 1 : 0);
            for (int i2 = 0; i2 <= this.q; i2++) {
                pz4 pz4Var = this.r[i2];
                if (pz4Var != null) {
                    pz4Var.i(bundle2);
                }
            }
            SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("logininfo2", 0).edit();
            edit.clear();
            d3(bundle2, edit, null);
            edit.commit();
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void e3(int i2, boolean z, Bundle bundle, boolean z2) {
        boolean z3 = i2 == 0 || i2 == 5 || i2 == 6 || i2 == 7 || i2 == 9 || i2 == 10 || i2 == 11;
        if (z3) {
            if (i2 == 0) {
                this.x = true;
                this.y = true;
            }
            this.H = 1;
            f3(false, z);
            this.H = 0;
            g3(false, false);
            if (!z) {
                f3(true, false);
            }
        } else {
            this.H = 0;
            f3(false, z);
            if (i2 != 8) {
                this.H = 1;
            }
        }
        int i3 = org.telegram.messenger.R.drawable.ic_ab_back;
        if (!z) {
            org.telegram.ui.ActionBar.a aVar = this.g;
            if (!this.r[i2].a() && !this.z) {
                i3 = 0;
            }
            aVar.setBackButtonImage(i3);
            this.r[this.q].setVisibility(8);
            this.q = i2;
            this.r[i2].j(bundle, false);
            this.r[i2].setVisibility(0);
            this.g.setTitle(this.r[i2].getHeaderName());
            h1(this.r[i2].getHeaderName());
            this.r[i2].g();
            return;
        }
        pz4[] pz4VarArr = this.r;
        pz4 pz4Var = pz4VarArr[this.q];
        pz4 pz4Var2 = pz4VarArr[i2];
        this.q = i2;
        org.telegram.ui.ActionBar.a aVar2 = this.g;
        if (!pz4Var2.a() && !this.z) {
            i3 = 0;
        }
        aVar2.setBackButtonImage(i3);
        pz4Var2.j(bundle, false);
        this.g.setTitle(pz4Var2.getHeaderName());
        h1(pz4Var2.getHeaderName());
        pz4Var2.g();
        int i4 = AndroidUtilities.displaySize.x;
        if (z2) {
            i4 = -i4;
        }
        pz4Var2.setX(i4);
        pz4Var2.setVisibility(0);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.addListener(new g(z3, pz4Var));
        Animator[] animatorArr = new Animator[2];
        Property property = View.TRANSLATION_X;
        float[] fArr = new float[1];
        fArr[0] = z2 ? AndroidUtilities.displaySize.x : -AndroidUtilities.displaySize.x;
        animatorArr[0] = ObjectAnimator.ofFloat(pz4Var, (Property<pz4, Float>) property, fArr);
        animatorArr[1] = ObjectAnimator.ofFloat(pz4Var2, (Property<pz4, Float>) View.TRANSLATION_X, 0.0f);
        animatorSet.playTogether(animatorArr);
        animatorSet.setDuration(300L);
        animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
        animatorSet.start();
    }

    @Override
    public ArrayList<org.telegram.ui.ActionBar.a0> i0() {
        int i2 = 0;
        while (true) {
            pz4[] pz4VarArr = this.r;
            if (i2 >= pz4VarArr.length) {
                n nVar = (n) pz4VarArr[0];
                m mVar = (m) pz4VarArr[1];
                m mVar2 = (m) pz4VarArr[2];
                m mVar3 = (m) pz4VarArr[3];
                m mVar4 = (m) pz4VarArr[4];
                k kVar = (k) pz4VarArr[5];
                i iVar = (i) pz4VarArr[6];
                j jVar = (j) pz4VarArr[7];
                l lVar = (l) pz4VarArr[8];
                ArrayList<org.telegram.ui.ActionBar.a0> arrayList = new ArrayList<>();
                a0.a aVar = new a0.a() {
                    @Override
                    public void a(float f2) {
                        aa7.a(this, f2);
                    }

                    @Override
                    public final void b() {
                        org.telegram.ui.y5.this.N2();
                    }
                };
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.e, org.telegram.ui.ActionBar.a0.q, null, null, null, null, "windowBackgroundWhite"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.V, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "chats_actionIcon"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.V, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "chats_actionBackground"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.V, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "chats_actionPressedBackground"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.X, org.telegram.ui.ActionBar.a0.B, null, null, null, null, "chats_actionIcon"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.q, null, null, null, null, "actionBarDefault"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.e, org.telegram.ui.ActionBar.a0.F, null, null, null, null, "actionBarDefault"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.w, null, null, null, null, "actionBarDefaultIcon"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.x, null, null, null, null, "actionBarDefaultTitle"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.y, null, null, null, null, "actionBarDefaultSelector"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.c, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.c, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "listSelectorSDK21"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.d, org.telegram.ui.ActionBar.a0.q, null, null, null, null, "windowBackgroundWhiteGrayLine"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.e, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.a, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.a, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.a, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.b, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.b, org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteHintText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.b, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.b, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(nVar.f, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(iVar.b, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(iVar.a, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(iVar.a, org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteHintText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(iVar.a, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(iVar.a, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(iVar.e, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(iVar.c, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteRedText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(iVar.d, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.i, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.a, org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteHintText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.a, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.a, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.a, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.b, org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteHintText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.b, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.b, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.b, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.j, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.k, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(kVar.k, org.telegram.ui.ActionBar.a0.r, null, null, null, null, "windowBackgroundWhiteLinkText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(jVar.b, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(jVar.a, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(jVar.a, org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteHintText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(jVar.a, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(jVar.a, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(jVar.c, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(lVar.a, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(lVar.d, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(lVar.c, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(lVar.b, org.telegram.ui.ActionBar.a0.s | org.telegram.ui.ActionBar.a0.I, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(lVar.b, org.telegram.ui.ActionBar.a0.s | org.telegram.ui.ActionBar.a0.I, null, null, null, null, "windowBackgroundWhiteRedText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.f, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.g, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                if (mVar.e.e != null) {
                    for (int i3 = 0; i3 < mVar.e.e.length; i3++) {
                        arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.e.e[i3], org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                        arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.e.e[i3], org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                    }
                }
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.j, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.k, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.m, 0, new Class[]{o.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "login_progressInner"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.m, 0, new Class[]{o.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "login_progressOuter"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.h, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar.i, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "chats_actionBackground"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.f, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.g, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                if (mVar2.e.e != null) {
                    for (int i4 = 0; i4 < mVar2.e.e.length; i4++) {
                        arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.e.e[i4], org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                        arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.e.e[i4], org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                    }
                }
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.j, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.k, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.m, 0, new Class[]{o.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "login_progressInner"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.m, 0, new Class[]{o.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "login_progressOuter"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.h, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar2.i, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "chats_actionBackground"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.f, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.g, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                if (mVar3.e.e != null) {
                    for (int i5 = 0; i5 < mVar3.e.e.length; i5++) {
                        arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.e.e[i5], org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                        arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.e.e[i5], org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                    }
                }
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.j, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.k, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.m, 0, new Class[]{o.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "login_progressInner"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.m, 0, new Class[]{o.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "login_progressOuter"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.h, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar3.i, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "chats_actionBackground"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.f, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.g, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                if (mVar4.e.e != null) {
                    for (int i6 = 0; i6 < mVar4.e.e.length; i6++) {
                        arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.e.e[i6], org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                        arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.e.e[i6], org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                    }
                }
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.j, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.k, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.m, 0, new Class[]{o.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "login_progressInner"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.m, 0, new Class[]{o.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "login_progressOuter"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.h, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "windowBackgroundWhiteBlackText"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.i, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "chats_actionBackground"));
                arrayList.add(new org.telegram.ui.ActionBar.a0(mVar4.i, 0, null, null, null, aVar, "chats_actionBackground"));
                for (int i7 = 0; i7 < 2; i7++) {
                    pz4[] pz4VarArr2 = this.r;
                    int i8 = i7 + 9;
                    if (pz4VarArr2[i8] != null) {
                        h hVar = (h) pz4VarArr2[i8];
                        arrayList.add(new org.telegram.ui.ActionBar.a0(hVar.b, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteGrayText6"));
                        for (int i9 = 0; i9 < hVar.a.length; i9++) {
                            arrayList.add(new org.telegram.ui.ActionBar.a0(hVar.a[i9], org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlackText"));
                            arrayList.add(new org.telegram.ui.ActionBar.a0(hVar.a[i9], org.telegram.ui.ActionBar.a0.N, null, null, null, null, "windowBackgroundWhiteHintText"));
                            arrayList.add(new org.telegram.ui.ActionBar.a0(hVar.a[i9], org.telegram.ui.ActionBar.a0.v, null, null, null, null, "windowBackgroundWhiteInputField"));
                            arrayList.add(new org.telegram.ui.ActionBar.a0(hVar.a[i9], org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "windowBackgroundWhiteInputFieldActivated"));
                        }
                        arrayList.add(new org.telegram.ui.ActionBar.a0(hVar.c, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "windowBackgroundWhiteBlueText4"));
                    }
                }
                return arrayList;
            }
            if (pz4VarArr[i2] == null) {
                return new ArrayList<>();
            }
            i2++;
        }
    }

    @Override
    public void w0(int i2, int i3, Intent intent) {
        k kVar = (k) this.r[5];
        if (kVar != null) {
            kVar.q.q(i2, i3, intent);
        }
    }

    @Override
    public boolean x0() {
        pz4 pz4Var;
        int i2 = this.q;
        int i3 = 0;
        if (i2 != 0) {
            int i4 = 6;
            if (i2 != 6) {
                if (i2 != 7 && i2 != 8) {
                    if ((i2 < 1 || i2 > 4) && i2 != 11) {
                        if (i2 == 5) {
                            ((k) this.r[i2]).j.callOnClick();
                        } else {
                            i4 = 9;
                            if (i2 == 9) {
                                this.r[i2].b(true);
                                e3(7, true, null, true);
                            } else if (i2 == 10) {
                                pz4Var = this.r[i2];
                            }
                        }
                    }
                    return false;
                }
                pz4Var = this.r[i2];
                pz4Var.b(true);
                e3(i4, true, null, true);
                return false;
            }
            this.r[i2].b(true);
            e3(0, true, null, true);
            return false;
        }
        while (true) {
            pz4[] pz4VarArr = this.r;
            if (i3 >= pz4VarArr.length) {
                K2();
                return true;
            }
            if (pz4VarArr[i3] != null) {
                pz4VarArr[i3].e();
            }
            i3++;
        }
    }

    @Override
    public View z(Context context) {
        b bVar;
        pz4 pz4Var;
        int i2;
        if (org.telegram.messenger.p110.o9.b(o9.f.LOGOUT_AT_START)) {
            org.telegram.messenger.p110.o9.a(o9.f.LOGED_OUT_AT_START, true);
        }
        this.g.setTitle(LocaleController.getString("AppName", R.string.AppName));
        this.g.setActionBarMenuOnItemClick(new a(context));
        this.H = 0;
        boolean[] zArr = this.Z;
        zArr[0] = true;
        zArr[1] = false;
        org.telegram.ui.ActionBar.b z = this.g.z();
        this.g.setAllowOverlayTitle(true);
        if (org.telegram.messenger.p110.o9.b(o9.f.PROXY_SYSTEM_ENABLED)) {
            z.i(200, R.drawable.ic_refresh_proxy, AndroidUtilities.dp(56.0f));
        }
        ha4 ha4Var = new ha4(context);
        this.S = ha4Var;
        org.telegram.ui.ActionBar.d g2 = z.g(201, ha4Var);
        this.R = g2;
        g2.setContentDescription(LocaleController.getString("ProxySettings", R.string.ProxySettings));
        this.J = z.i(1, org.telegram.messenger.R.drawable.ic_done, AndroidUtilities.dp(56.0f));
        rp0 rp0Var = new rp0(context, 1);
        this.U = rp0Var;
        rp0Var.setAlpha(0.0f);
        this.U.setScaleX(0.1f);
        this.U.setScaleY(0.1f);
        this.U.setVisibility(4);
        this.J.setAlpha(0.0f);
        this.J.setScaleX(0.1f);
        this.J.setScaleY(0.1f);
        this.J.addView(this.U, g52.a(-1, -1.0f));
        this.J.setContentDescription(LocaleController.getString("Done", R.string.Done));
        this.J.setVisibility(this.Z[1] ? 0 : 8);
        b bVar2 = new b(context);
        this.e = bVar2;
        c cVar = new c(context);
        cVar.setFillViewport(true);
        bVar2.addView(cVar, g52.a(-1, -1.0f));
        FrameLayout frameLayout = new FrameLayout(context);
        cVar.addView(frameLayout, g52.s(-1, -2, 51));
        this.r[0] = new n(context);
        this.r[1] = new m(context, 1);
        this.r[2] = new m(context, 2);
        this.r[3] = new m(context, 3);
        this.r[4] = new m(context, 4);
        this.r[5] = new k(context);
        this.r[6] = new i(context);
        this.r[7] = new j(context);
        this.r[8] = new l(context);
        this.r[9] = new h(context, 0);
        this.r[10] = new h(context, 1);
        this.r[11] = new m(context, 11);
        int i3 = 0;
        while (true) {
            pz4[] pz4VarArr = this.r;
            if (i3 >= pz4VarArr.length) {
                break;
            }
            pz4VarArr[i3].setVisibility(i3 == 0 ? 0 : 8);
            frameLayout.addView(this.r[i3], g52.b(-1, -1.0f, 51, AndroidUtilities.isTablet() ? 26.0f : 18.0f, 30.0f, AndroidUtilities.isTablet() ? 26.0f : 18.0f, 0.0f));
            i3++;
        }
        Bundle R2 = R2();
        if (R2 != null) {
            this.q = R2.getInt("currentViewNum", 0);
            this.A = R2.getInt("syncContacts", 1) == 1;
            int i4 = this.q;
            if (i4 < 1 || i4 > 4 ? !(i4 != 6 ? i4 != 7 || ((j) this.r[7]).e != null : ((i) this.r[6]).h != null) : !((i2 = R2.getInt("open")) == 0 || Math.abs((System.currentTimeMillis() / 1000) - i2) < 86400)) {
                this.q = 0;
                K2();
                R2 = null;
            }
        }
        FrameLayout frameLayout2 = new FrameLayout(context);
        this.W = frameLayout2;
        frameLayout2.setVisibility(this.Z[0] ? 0 : 8);
        Drawable Y0 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(56.0f), org.telegram.ui.ActionBar.w.r1("chats_actionBackground"), org.telegram.ui.ActionBar.w.r1("chats_actionPressedBackground"));
        int i5 = Build.VERSION.SDK_INT;
        if (i5 < 21) {
            Drawable mutate = context.getResources().getDrawable(org.telegram.messenger.R.drawable.floating_shadow).mutate();
            mutate.setColorFilter(new PorterDuffColorFilter(com.batch.android.messaging.view.roundimage.b.v, PorterDuff.Mode.MULTIPLY));
            jj0 jj0Var = new jj0(mutate, Y0, 0, 0);
            jj0Var.e(AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
            Y0 = jj0Var;
        }
        this.W.setBackgroundDrawable(Y0);
        if (i5 >= 21) {
            StateListAnimator stateListAnimator = new StateListAnimator();
            bVar = bVar2;
            stateListAnimator.addState(new int[]{android.R.attr.state_pressed}, ObjectAnimator.ofFloat(this.V, "translationZ", AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
            stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(this.V, "translationZ", AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
            this.W.setStateListAnimator(stateListAnimator);
            this.W.setOutlineProvider(new d(this));
        } else {
            bVar = bVar2;
        }
        vn7.a(this.W);
        bVar.addView(this.W, g52.b(i5 >= 21 ? 56 : 60, i5 >= 21 ? 56.0f : 60.0f, 85, 0.0f, 0.0f, 14.0f, 14.0f));
        this.W.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                org.telegram.ui.y5.this.M2(view);
            }
        });
        ImageView imageView = new ImageView(context);
        this.V = imageView;
        imageView.setScaleType(ImageView.ScaleType.CENTER);
        this.V.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("chats_actionIcon"), PorterDuff.Mode.MULTIPLY));
        this.V.setImageResource(org.telegram.messenger.R.drawable.actionbtn_next);
        this.W.setContentDescription(LocaleController.getString("Done", R.string.Done));
        this.W.addView(this.V, g52.a(i5 >= 21 ? 56 : 60, i5 >= 21 ? 56.0f : 60.0f));
        RadialProgressView radialProgressView = new RadialProgressView(context);
        this.X = radialProgressView;
        radialProgressView.setSize(AndroidUtilities.dp(22.0f));
        this.X.setProgressColor(org.telegram.ui.ActionBar.w.r1("chats_actionIcon"));
        this.X.setAlpha(0.0f);
        this.X.setScaleX(0.1f);
        this.X.setScaleY(0.1f);
        this.X.setVisibility(4);
        this.W.addView(this.X, g52.a(-1, -1.0f));
        int i6 = 1;
        if (R2 != null) {
            this.s = true;
        }
        int i7 = 0;
        while (true) {
            pz4[] pz4VarArr2 = this.r;
            if (i7 >= pz4VarArr2.length) {
                this.s = false;
                this.g.setTitle(pz4VarArr2[this.q].getHeaderName());
                org.telegram.messenger.p110.k9.c(context);
                return this.e;
            }
            if (R2 != null) {
                if (i7 < i6 || i7 > 4) {
                    pz4Var = pz4VarArr2[i7];
                } else if (i7 == this.q) {
                    pz4Var = pz4VarArr2[i7];
                }
                pz4Var.h(R2);
            }
            if (this.q == i7) {
                this.g.setBackButtonImage((this.r[i7].a() || this.z) ? org.telegram.messenger.R.drawable.ic_ab_back : 0);
                this.r[i7].setVisibility(0);
                this.r[i7].g();
                this.H = 0;
                i6 = 1;
                if (i7 == 1 || i7 == 2 || i7 == 3 || i7 == 4 || i7 == 8) {
                    f3(false, false);
                } else {
                    f3(true, false);
                }
                if (i7 != 1 && i7 != 2) {
                    if (i7 != 3) {
                    }
                }
                this.H = 1;
            } else {
                i6 = 1;
                this.r[i7].setVisibility(8);
            }
            i7++;
        }
    }
}