package com.google.android.material.textfield;

import android.R;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStructure;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.widget.a1;
import androidx.appcompat.widget.d0;
import androidx.appcompat.widget.i0;
import androidx.core.view.y;
import c1.k;
import com.google.android.material.internal.CheckableImageButton;
import com.google.android.material.internal.m;
import j0.o;
import java.util.Iterator;
import java.util.LinkedHashSet;

/* JADX INFO: loaded from: classes.dex */
public class TextInputLayout extends LinearLayout {
    private static final int M0 = l0.j.f5450e;
    private j0.d A;
    private int A0;
    private j0.d B;
    private int B0;
    private ColorStateList C;
    private int C0;
    private ColorStateList D;
    private int D0;
    private CharSequence E;
    private int E0;
    private final TextView F;
    private boolean F0;
    private boolean G;
    final com.google.android.material.internal.b G0;
    private CharSequence H;
    private boolean H0;
    private boolean I;
    private boolean I0;
    private c1.g J;
    private ValueAnimator J0;
    private c1.g K;
    private boolean K0;
    private c1.g L;
    private boolean L0;
    private c1.k M;
    private boolean N;
    private final int O;
    private int P;
    private int Q;
    private int R;
    private int S;
    private int T;
    private int U;
    private int V;
    private final Rect W;

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    private final Rect f4189a0;

    /* JADX INFO: renamed from: b0, reason: collision with root package name */
    private final RectF f4190b0;

    /* JADX INFO: renamed from: c0, reason: collision with root package name */
    private Typeface f4191c0;

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    private Drawable f4192d0;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private final FrameLayout f4193e;

    /* JADX INFO: renamed from: e0, reason: collision with root package name */
    private int f4194e0;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private final k f4195f;

    /* JADX INFO: renamed from: f0, reason: collision with root package name */
    private final LinkedHashSet<f> f4196f0;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private final LinearLayout f4197g;

    /* JADX INFO: renamed from: g0, reason: collision with root package name */
    private int f4198g0;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private final FrameLayout f4199h;

    /* JADX INFO: renamed from: h0, reason: collision with root package name */
    private final SparseArray<com.google.android.material.textfield.e> f4200h0;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    EditText f4201i;

    /* JADX INFO: renamed from: i0, reason: collision with root package name */
    private final CheckableImageButton f4202i0;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    private CharSequence f4203j;

    /* JADX INFO: renamed from: j0, reason: collision with root package name */
    private final LinkedHashSet<g> f4204j0;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private int f4205k;

    /* JADX INFO: renamed from: k0, reason: collision with root package name */
    private ColorStateList f4206k0;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    private int f4207l;

    /* JADX INFO: renamed from: l0, reason: collision with root package name */
    private PorterDuff.Mode f4208l0;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    private int f4209m;

    /* JADX INFO: renamed from: m0, reason: collision with root package name */
    private Drawable f4210m0;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    private int f4211n;

    /* JADX INFO: renamed from: n0, reason: collision with root package name */
    private int f4212n0;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    private final com.google.android.material.textfield.g f4213o;

    /* JADX INFO: renamed from: o0, reason: collision with root package name */
    private Drawable f4214o0;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    boolean f4215p;

    /* JADX INFO: renamed from: p0, reason: collision with root package name */
    private View.OnLongClickListener f4216p0;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    private int f4217q;

    /* JADX INFO: renamed from: q0, reason: collision with root package name */
    private View.OnLongClickListener f4218q0;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    private boolean f4219r;

    /* JADX INFO: renamed from: r0, reason: collision with root package name */
    private final CheckableImageButton f4220r0;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    private TextView f4221s;

    /* JADX INFO: renamed from: s0, reason: collision with root package name */
    private ColorStateList f4222s0;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    private int f4223t;

    /* JADX INFO: renamed from: t0, reason: collision with root package name */
    private PorterDuff.Mode f4224t0;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    private int f4225u;

    /* JADX INFO: renamed from: u0, reason: collision with root package name */
    private ColorStateList f4226u0;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    private CharSequence f4227v;

    /* JADX INFO: renamed from: v0, reason: collision with root package name */
    private ColorStateList f4228v0;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    private boolean f4229w;

    /* JADX INFO: renamed from: w0, reason: collision with root package name */
    private int f4230w0;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    private TextView f4231x;

    /* JADX INFO: renamed from: x0, reason: collision with root package name */
    private int f4232x0;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    private ColorStateList f4233y;

    /* JADX INFO: renamed from: y0, reason: collision with root package name */
    private int f4234y0;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    private int f4235z;

    /* JADX INFO: renamed from: z0, reason: collision with root package name */
    private ColorStateList f4236z0;

    class a implements TextWatcher {
        a() {
        }

        @Override // android.text.TextWatcher
        public void afterTextChanged(Editable editable) {
            TextInputLayout.this.w0(!r0.L0);
            TextInputLayout textInputLayout = TextInputLayout.this;
            if (textInputLayout.f4215p) {
                textInputLayout.m0(editable.length());
            }
            if (TextInputLayout.this.f4229w) {
                TextInputLayout.this.A0(editable.length());
            }
        }

        @Override // android.text.TextWatcher
        public void beforeTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
        }

        @Override // android.text.TextWatcher
        public void onTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
        }
    }

    class b implements Runnable {
        b() {
        }

        @Override // java.lang.Runnable
        public void run() {
            TextInputLayout.this.f4202i0.performClick();
            TextInputLayout.this.f4202i0.jumpDrawablesToCurrentState();
        }
    }

    class c implements Runnable {
        c() {
        }

        @Override // java.lang.Runnable
        public void run() {
            TextInputLayout.this.f4201i.requestLayout();
        }
    }

    class d implements ValueAnimator.AnimatorUpdateListener {
        d() {
        }

        @Override // android.animation.ValueAnimator.AnimatorUpdateListener
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            TextInputLayout.this.G0.d0(((Float) valueAnimator.getAnimatedValue()).floatValue());
        }
    }

    public static class e extends androidx.core.view.a {

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        private final TextInputLayout f4241d;

        public e(TextInputLayout textInputLayout) {
            this.f4241d = textInputLayout;
        }

        @Override // androidx.core.view.a
        public void g(View view, androidx.core.view.accessibility.d dVar) {
            View viewS;
            super.g(view, dVar);
            EditText editText = this.f4241d.getEditText();
            CharSequence text = editText != null ? editText.getText() : null;
            CharSequence hint = this.f4241d.getHint();
            CharSequence error = this.f4241d.getError();
            CharSequence placeholderText = this.f4241d.getPlaceholderText();
            int counterMaxLength = this.f4241d.getCounterMaxLength();
            CharSequence counterOverflowDescription = this.f4241d.getCounterOverflowDescription();
            boolean z2 = !TextUtils.isEmpty(text);
            boolean z3 = !TextUtils.isEmpty(hint);
            boolean z4 = !this.f4241d.N();
            boolean z5 = !TextUtils.isEmpty(error);
            boolean z6 = z5 || !TextUtils.isEmpty(counterOverflowDescription);
            String string = z3 ? hint.toString() : "";
            this.f4241d.f4195f.v(dVar);
            if (z2) {
                dVar.s0(text);
            } else if (!TextUtils.isEmpty(string)) {
                dVar.s0(string);
                if (z4 && placeholderText != null) {
                    dVar.s0(string + ", " + ((Object) placeholderText));
                }
            } else if (placeholderText != null) {
                dVar.s0(placeholderText);
            }
            if (!TextUtils.isEmpty(string)) {
                if (Build.VERSION.SDK_INT >= 26) {
                    dVar.g0(string);
                } else {
                    if (z2) {
                        string = ((Object) text) + ", " + string;
                    }
                    dVar.s0(string);
                }
                dVar.p0(!z2);
            }
            if (text == null || text.length() != counterMaxLength) {
                counterMaxLength = -1;
            }
            dVar.i0(counterMaxLength);
            if (z6) {
                if (!z5) {
                    error = counterOverflowDescription;
                }
                dVar.c0(error);
            }
            if (Build.VERSION.SDK_INT < 17 || (viewS = this.f4241d.f4213o.s()) == null) {
                return;
            }
            dVar.h0(viewS);
        }
    }

    public interface f {
        void a(TextInputLayout textInputLayout);
    }

    public interface g {
        void a(TextInputLayout textInputLayout, int i3);
    }

    static class h extends w.a {
        public static final Parcelable.Creator<h> CREATOR = new a();

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        CharSequence f4242g;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        boolean f4243h;

        /* JADX INFO: renamed from: i, reason: collision with root package name */
        CharSequence f4244i;

        /* JADX INFO: renamed from: j, reason: collision with root package name */
        CharSequence f4245j;

        /* JADX INFO: renamed from: k, reason: collision with root package name */
        CharSequence f4246k;

        class a implements Parcelable.ClassLoaderCreator<h> {
            a() {
            }

            @Override // android.os.Parcelable.Creator
            /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
            public h createFromParcel(Parcel parcel) {
                return new h(parcel, null);
            }

            @Override // android.os.Parcelable.ClassLoaderCreator
            /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
            public h createFromParcel(Parcel parcel, ClassLoader classLoader) {
                return new h(parcel, classLoader);
            }

            @Override // android.os.Parcelable.Creator
            /* JADX INFO: renamed from: c, reason: merged with bridge method [inline-methods] */
            public h[] newArray(int i3) {
                return new h[i3];
            }
        }

        h(Parcelable parcelable) {
            super(parcelable);
        }

        public String toString() {
            return "TextInputLayout.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " error=" + ((Object) this.f4242g) + " hint=" + ((Object) this.f4244i) + " helperText=" + ((Object) this.f4245j) + " placeholderText=" + ((Object) this.f4246k) + "}";
        }

        @Override // w.a, android.os.Parcelable
        public void writeToParcel(Parcel parcel, int i3) {
            super.writeToParcel(parcel, i3);
            TextUtils.writeToParcel(this.f4242g, parcel, i3);
            parcel.writeInt(this.f4243h ? 1 : 0);
            TextUtils.writeToParcel(this.f4244i, parcel, i3);
            TextUtils.writeToParcel(this.f4245j, parcel, i3);
            TextUtils.writeToParcel(this.f4246k, parcel, i3);
        }

        h(Parcel parcel, ClassLoader classLoader) {
            super(parcel, classLoader);
            this.f4242g = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.f4243h = parcel.readInt() == 1;
            this.f4244i = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.f4245j = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.f4246k = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
        }
    }

    public TextInputLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, l0.b.F);
    }

    private boolean A() {
        return this.G && !TextUtils.isEmpty(this.H) && (this.J instanceof com.google.android.material.textfield.c);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void A0(int i3) {
        if (i3 != 0 || this.F0) {
            J();
        } else {
            h0();
        }
    }

    private void B() {
        Iterator<f> it = this.f4196f0.iterator();
        while (it.hasNext()) {
            it.next().a(this);
        }
    }

    private void B0(boolean z2, boolean z3) {
        int defaultColor = this.f4236z0.getDefaultColor();
        int colorForState = this.f4236z0.getColorForState(new int[]{R.attr.state_hovered, R.attr.state_enabled}, defaultColor);
        int colorForState2 = this.f4236z0.getColorForState(new int[]{R.attr.state_activated, R.attr.state_enabled}, defaultColor);
        if (z2) {
            this.U = colorForState2;
        } else if (z3) {
            this.U = colorForState;
        } else {
            this.U = defaultColor;
        }
    }

    private void C(int i3) {
        Iterator<g> it = this.f4204j0.iterator();
        while (it.hasNext()) {
            it.next().a(this, i3);
        }
    }

    private void C0() {
        if (this.f4201i == null) {
            return;
        }
        y.E0(this.F, getContext().getResources().getDimensionPixelSize(l0.d.f5371v), this.f4201i.getPaddingTop(), (K() || L()) ? 0 : y.I(this.f4201i), this.f4201i.getPaddingBottom());
    }

    private void D(Canvas canvas) {
        c1.g gVar;
        if (this.L == null || (gVar = this.K) == null) {
            return;
        }
        gVar.draw(canvas);
        if (this.f4201i.isFocused()) {
            Rect bounds = this.L.getBounds();
            Rect bounds2 = this.K.getBounds();
            float fX = this.G0.x();
            int iCenterX = bounds2.centerX();
            bounds.left = m0.a.c(iCenterX, bounds2.left, fX);
            bounds.right = m0.a.c(iCenterX, bounds2.right, fX);
            this.L.draw(canvas);
        }
    }

    private void D0() {
        int visibility = this.F.getVisibility();
        int i3 = (this.E == null || N()) ? 8 : 0;
        if (visibility != i3) {
            getEndIconDelegate().c(i3 == 0);
        }
        t0();
        this.F.setVisibility(i3);
        q0();
    }

    private void E(Canvas canvas) {
        if (this.G) {
            this.G0.l(canvas);
        }
    }

    private void F(boolean z2) {
        ValueAnimator valueAnimator = this.J0;
        if (valueAnimator != null && valueAnimator.isRunning()) {
            this.J0.cancel();
        }
        if (z2 && this.I0) {
            k(0.0f);
        } else {
            this.G0.d0(0.0f);
        }
        if (A() && ((com.google.android.material.textfield.c) this.J).j0()) {
            x();
        }
        this.F0 = true;
        J();
        this.f4195f.i(true);
        D0();
    }

    private int G(int i3, boolean z2) {
        int compoundPaddingLeft = i3 + this.f4201i.getCompoundPaddingLeft();
        return (getPrefixText() == null || z2) ? compoundPaddingLeft : (compoundPaddingLeft - getPrefixTextView().getMeasuredWidth()) + getPrefixTextView().getPaddingLeft();
    }

    private int H(int i3, boolean z2) {
        int compoundPaddingRight = i3 - this.f4201i.getCompoundPaddingRight();
        return (getPrefixText() == null || !z2) ? compoundPaddingRight : compoundPaddingRight + (getPrefixTextView().getMeasuredWidth() - getPrefixTextView().getPaddingRight());
    }

    private boolean I() {
        return this.f4198g0 != 0;
    }

    private void J() {
        TextView textView = this.f4231x;
        if (textView == null || !this.f4229w) {
            return;
        }
        textView.setText((CharSequence) null);
        o.a(this.f4193e, this.B);
        this.f4231x.setVisibility(4);
    }

    private boolean L() {
        return this.f4220r0.getVisibility() == 0;
    }

    private boolean P() {
        return this.P == 1 && (Build.VERSION.SDK_INT < 16 || this.f4201i.getMinLines() <= 1);
    }

    private void Q() {
        o();
        Z();
        E0();
        j0();
        j();
        if (this.P != 0) {
            v0();
        }
    }

    private void R() {
        if (A()) {
            RectF rectF = this.f4190b0;
            this.G0.o(rectF, this.f4201i.getWidth(), this.f4201i.getGravity());
            n(rectF);
            rectF.offset(-getPaddingLeft(), ((-getPaddingTop()) - (rectF.height() / 2.0f)) + this.R);
            ((com.google.android.material.textfield.c) this.J).m0(rectF);
        }
    }

    private void S() {
        if (!A() || this.F0) {
            return;
        }
        x();
        R();
    }

    private static void T(ViewGroup viewGroup, boolean z2) {
        int childCount = viewGroup.getChildCount();
        for (int i3 = 0; i3 < childCount; i3++) {
            View childAt = viewGroup.getChildAt(i3);
            childAt.setEnabled(z2);
            if (childAt instanceof ViewGroup) {
                T((ViewGroup) childAt, z2);
            }
        }
    }

    private void X() {
        TextView textView = this.f4231x;
        if (textView != null) {
            textView.setVisibility(8);
        }
    }

    private void Z() {
        if (g0()) {
            y.v0(this.f4201i, this.J);
        }
    }

    private static void a0(CheckableImageButton checkableImageButton, View.OnLongClickListener onLongClickListener) {
        boolean zQ = y.Q(checkableImageButton);
        boolean z2 = onLongClickListener != null;
        boolean z3 = zQ || z2;
        checkableImageButton.setFocusable(z3);
        checkableImageButton.setClickable(zQ);
        checkableImageButton.setPressable(zQ);
        checkableImageButton.setLongClickable(z2);
        y.B0(checkableImageButton, z3 ? 1 : 2);
    }

    private static void b0(CheckableImageButton checkableImageButton, View.OnClickListener onClickListener, View.OnLongClickListener onLongClickListener) {
        checkableImageButton.setOnClickListener(onClickListener);
        a0(checkableImageButton, onLongClickListener);
    }

    private static void c0(CheckableImageButton checkableImageButton, View.OnLongClickListener onLongClickListener) {
        checkableImageButton.setOnLongClickListener(onLongClickListener);
        a0(checkableImageButton, onLongClickListener);
    }

    private boolean e0() {
        return (this.f4220r0.getVisibility() == 0 || ((I() && K()) || this.E != null)) && this.f4197g.getMeasuredWidth() > 0;
    }

    private boolean f0() {
        return (getStartIconDrawable() != null || (getPrefixText() != null && getPrefixTextView().getVisibility() == 0)) && this.f4195f.getMeasuredWidth() > 0;
    }

    private boolean g0() {
        EditText editText = this.f4201i;
        return (editText == null || this.J == null || editText.getBackground() != null || this.P == 0) ? false : true;
    }

    private com.google.android.material.textfield.e getEndIconDelegate() {
        com.google.android.material.textfield.e eVar = this.f4200h0.get(this.f4198g0);
        return eVar != null ? eVar : this.f4200h0.get(0);
    }

    private CheckableImageButton getEndIconToUpdateDummyDrawable() {
        if (this.f4220r0.getVisibility() == 0) {
            return this.f4220r0;
        }
        if (I() && K()) {
            return this.f4202i0;
        }
        return null;
    }

    private void h0() {
        if (this.f4231x == null || !this.f4229w || TextUtils.isEmpty(this.f4227v)) {
            return;
        }
        this.f4231x.setText(this.f4227v);
        o.a(this.f4193e, this.A);
        this.f4231x.setVisibility(0);
        this.f4231x.bringToFront();
        if (Build.VERSION.SDK_INT >= 16) {
            announceForAccessibility(this.f4227v);
        }
    }

    private void i() {
        TextView textView = this.f4231x;
        if (textView != null) {
            this.f4193e.addView(textView);
            this.f4231x.setVisibility(0);
        }
    }

    private void i0(boolean z2) {
        if (!z2 || getEndIconDrawable() == null) {
            com.google.android.material.textfield.f.a(this, this.f4202i0, this.f4206k0, this.f4208l0);
            return;
        }
        Drawable drawableMutate = androidx.core.graphics.drawable.a.r(getEndIconDrawable()).mutate();
        androidx.core.graphics.drawable.a.n(drawableMutate, this.f4213o.p());
        this.f4202i0.setImageDrawable(drawableMutate);
    }

    private void j() {
        if (this.f4201i == null || this.P != 1) {
            return;
        }
        if (z0.c.h(getContext())) {
            EditText editText = this.f4201i;
            y.E0(editText, y.J(editText), getResources().getDimensionPixelSize(l0.d.f5365p), y.I(this.f4201i), getResources().getDimensionPixelSize(l0.d.f5364o));
        } else if (z0.c.g(getContext())) {
            EditText editText2 = this.f4201i;
            y.E0(editText2, y.J(editText2), getResources().getDimensionPixelSize(l0.d.f5363n), y.I(this.f4201i), getResources().getDimensionPixelSize(l0.d.f5362m));
        }
    }

    private void j0() {
        if (this.P == 1) {
            if (z0.c.h(getContext())) {
                this.Q = getResources().getDimensionPixelSize(l0.d.f5367r);
            } else if (z0.c.g(getContext())) {
                this.Q = getResources().getDimensionPixelSize(l0.d.f5366q);
            }
        }
    }

    private void k0(Rect rect) {
        c1.g gVar = this.K;
        if (gVar != null) {
            int i3 = rect.bottom;
            gVar.setBounds(rect.left, i3 - this.S, rect.right, i3);
        }
        c1.g gVar2 = this.L;
        if (gVar2 != null) {
            int i4 = rect.bottom;
            gVar2.setBounds(rect.left, i4 - this.T, rect.right, i4);
        }
    }

    private void l() {
        c1.g gVar = this.J;
        if (gVar == null) {
            return;
        }
        c1.k kVarD = gVar.D();
        c1.k kVar = this.M;
        if (kVarD != kVar) {
            this.J.setShapeAppearanceModel(kVar);
            p0();
        }
        if (v()) {
            this.J.c0(this.R, this.U);
        }
        int iP = p();
        this.V = iP;
        this.J.X(ColorStateList.valueOf(iP));
        if (this.f4198g0 == 3) {
            this.f4201i.getBackground().invalidateSelf();
        }
        m();
        invalidate();
    }

    private void l0() {
        if (this.f4221s != null) {
            EditText editText = this.f4201i;
            m0(editText == null ? 0 : editText.getText().length());
        }
    }

    private void m() {
        if (this.K == null || this.L == null) {
            return;
        }
        if (w()) {
            this.K.X(this.f4201i.isFocused() ? ColorStateList.valueOf(this.f4230w0) : ColorStateList.valueOf(this.U));
            this.L.X(ColorStateList.valueOf(this.U));
        }
        invalidate();
    }

    private void n(RectF rectF) {
        float f3 = rectF.left;
        int i3 = this.O;
        rectF.left = f3 - i3;
        rectF.right += i3;
    }

    private static void n0(Context context, TextView textView, int i3, int i4, boolean z2) {
        textView.setContentDescription(context.getString(z2 ? l0.i.f5432c : l0.i.f5431b, Integer.valueOf(i3), Integer.valueOf(i4)));
    }

    private void o() {
        int i3 = this.P;
        if (i3 == 0) {
            this.J = null;
            this.K = null;
            this.L = null;
            return;
        }
        if (i3 == 1) {
            this.J = new c1.g(this.M);
            this.K = new c1.g();
            this.L = new c1.g();
        } else {
            if (i3 != 2) {
                throw new IllegalArgumentException(this.P + " is illegal; only @BoxBackgroundMode constants are supported.");
            }
            if (!this.G || (this.J instanceof com.google.android.material.textfield.c)) {
                this.J = new c1.g(this.M);
            } else {
                this.J = new com.google.android.material.textfield.c(this.M);
            }
            this.K = null;
            this.L = null;
        }
    }

    private void o0() {
        ColorStateList colorStateList;
        ColorStateList colorStateList2;
        TextView textView = this.f4221s;
        if (textView != null) {
            d0(textView, this.f4219r ? this.f4223t : this.f4225u);
            if (!this.f4219r && (colorStateList2 = this.C) != null) {
                this.f4221s.setTextColor(colorStateList2);
            }
            if (!this.f4219r || (colorStateList = this.D) == null) {
                return;
            }
            this.f4221s.setTextColor(colorStateList);
        }
    }

    private int p() {
        return this.P == 1 ? r0.a.g(r0.a.e(this, l0.b.f5328k, 0), this.V) : this.V;
    }

    private void p0() {
        if (this.f4198g0 == 3 && this.P == 2) {
            ((com.google.android.material.textfield.d) this.f4200h0.get(3)).O((AutoCompleteTextView) this.f4201i);
        }
    }

    private Rect q(Rect rect) {
        if (this.f4201i == null) {
            throw new IllegalStateException();
        }
        Rect rect2 = this.f4189a0;
        boolean zE = com.google.android.material.internal.o.e(this);
        rect2.bottom = rect.bottom;
        int i3 = this.P;
        if (i3 == 1) {
            rect2.left = G(rect.left, zE);
            rect2.top = rect.top + this.Q;
            rect2.right = H(rect.right, zE);
            return rect2;
        }
        if (i3 != 2) {
            rect2.left = G(rect.left, zE);
            rect2.top = getPaddingTop();
            rect2.right = H(rect.right, zE);
            return rect2;
        }
        rect2.left = rect.left + this.f4201i.getPaddingLeft();
        rect2.top = rect.top - u();
        rect2.right = rect.right - this.f4201i.getPaddingRight();
        return rect2;
    }

    private int r(Rect rect, Rect rect2, float f3) {
        return P() ? (int) (rect2.top + f3) : rect.bottom - this.f4201i.getCompoundPaddingBottom();
    }

    private int s(Rect rect, float f3) {
        return P() ? (int) (rect.centerY() - (f3 / 2.0f)) : rect.top + this.f4201i.getCompoundPaddingTop();
    }

    private boolean s0() {
        int iMax;
        if (this.f4201i == null || this.f4201i.getMeasuredHeight() >= (iMax = Math.max(this.f4197g.getMeasuredHeight(), this.f4195f.getMeasuredHeight()))) {
            return false;
        }
        this.f4201i.setMinimumHeight(iMax);
        return true;
    }

    private void setEditText(EditText editText) {
        if (this.f4201i != null) {
            throw new IllegalArgumentException("We already have an EditText, can only have one");
        }
        if (this.f4198g0 != 3 && !(editText instanceof TextInputEditText)) {
            Log.i("TextInputLayout", "EditText added is not a TextInputEditText. Please switch to using that class instead.");
        }
        this.f4201i = editText;
        int i3 = this.f4205k;
        if (i3 != -1) {
            setMinEms(i3);
        } else {
            setMinWidth(this.f4209m);
        }
        int i4 = this.f4207l;
        if (i4 != -1) {
            setMaxEms(i4);
        } else {
            setMaxWidth(this.f4211n);
        }
        Q();
        setTextInputAccessibilityDelegate(new e(this));
        this.G0.j0(this.f4201i.getTypeface());
        this.G0.b0(this.f4201i.getTextSize());
        if (Build.VERSION.SDK_INT >= 21) {
            this.G0.X(this.f4201i.getLetterSpacing());
        }
        int gravity = this.f4201i.getGravity();
        this.G0.S((gravity & (-113)) | 48);
        this.G0.a0(gravity);
        this.f4201i.addTextChangedListener(new a());
        if (this.f4226u0 == null) {
            this.f4226u0 = this.f4201i.getHintTextColors();
        }
        if (this.G) {
            if (TextUtils.isEmpty(this.H)) {
                CharSequence hint = this.f4201i.getHint();
                this.f4203j = hint;
                setHint(hint);
                this.f4201i.setHint((CharSequence) null);
            }
            this.I = true;
        }
        if (this.f4221s != null) {
            m0(this.f4201i.getText().length());
        }
        r0();
        this.f4213o.f();
        this.f4195f.bringToFront();
        this.f4197g.bringToFront();
        this.f4199h.bringToFront();
        this.f4220r0.bringToFront();
        B();
        C0();
        if (!isEnabled()) {
            editText.setEnabled(false);
        }
        x0(false, true);
    }

    private void setHintInternal(CharSequence charSequence) {
        if (TextUtils.equals(charSequence, this.H)) {
            return;
        }
        this.H = charSequence;
        this.G0.h0(charSequence);
        if (this.F0) {
            return;
        }
        R();
    }

    private void setPlaceholderTextEnabled(boolean z2) {
        if (this.f4229w == z2) {
            return;
        }
        if (z2) {
            i();
        } else {
            X();
            this.f4231x = null;
        }
        this.f4229w = z2;
    }

    private Rect t(Rect rect) {
        if (this.f4201i == null) {
            throw new IllegalStateException();
        }
        Rect rect2 = this.f4189a0;
        float fW = this.G0.w();
        rect2.left = rect.left + this.f4201i.getCompoundPaddingLeft();
        rect2.top = s(rect, fW);
        rect2.right = rect.right - this.f4201i.getCompoundPaddingRight();
        rect2.bottom = r(rect, rect2, fW);
        return rect2;
    }

    private void t0() {
        this.f4199h.setVisibility((this.f4202i0.getVisibility() != 0 || L()) ? 8 : 0);
        this.f4197g.setVisibility(K() || L() || ((this.E == null || N()) ? '\b' : (char) 0) == 0 ? 0 : 8);
    }

    private int u() {
        float fQ;
        if (!this.G) {
            return 0;
        }
        int i3 = this.P;
        if (i3 == 0) {
            fQ = this.G0.q();
        } else {
            if (i3 != 2) {
                return 0;
            }
            fQ = this.G0.q() / 2.0f;
        }
        return (int) fQ;
    }

    private void u0() {
        this.f4220r0.setVisibility(getErrorIconDrawable() != null && this.f4213o.z() && this.f4213o.l() ? 0 : 8);
        t0();
        C0();
        if (I()) {
            return;
        }
        q0();
    }

    private boolean v() {
        return this.P == 2 && w();
    }

    private void v0() {
        if (this.P != 1) {
            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.f4193e.getLayoutParams();
            int iU = u();
            if (iU != layoutParams.topMargin) {
                layoutParams.topMargin = iU;
                this.f4193e.requestLayout();
            }
        }
    }

    private boolean w() {
        return this.R > -1 && this.U != 0;
    }

    private void x() {
        if (A()) {
            ((com.google.android.material.textfield.c) this.J).k0();
        }
    }

    private void x0(boolean z2, boolean z3) {
        ColorStateList colorStateList;
        TextView textView;
        boolean zIsEnabled = isEnabled();
        EditText editText = this.f4201i;
        boolean z4 = (editText == null || TextUtils.isEmpty(editText.getText())) ? false : true;
        EditText editText2 = this.f4201i;
        boolean z5 = editText2 != null && editText2.hasFocus();
        boolean zL = this.f4213o.l();
        ColorStateList colorStateList2 = this.f4226u0;
        if (colorStateList2 != null) {
            this.G0.R(colorStateList2);
            this.G0.Z(this.f4226u0);
        }
        if (!zIsEnabled) {
            ColorStateList colorStateList3 = this.f4226u0;
            int colorForState = colorStateList3 != null ? colorStateList3.getColorForState(new int[]{-16842910}, this.E0) : this.E0;
            this.G0.R(ColorStateList.valueOf(colorForState));
            this.G0.Z(ColorStateList.valueOf(colorForState));
        } else if (zL) {
            this.G0.R(this.f4213o.q());
        } else if (this.f4219r && (textView = this.f4221s) != null) {
            this.G0.R(textView.getTextColors());
        } else if (z5 && (colorStateList = this.f4228v0) != null) {
            this.G0.R(colorStateList);
        }
        if (z4 || !this.H0 || (isEnabled() && z5)) {
            if (z3 || this.F0) {
                y(z2);
                return;
            }
            return;
        }
        if (z3 || !this.F0) {
            F(z2);
        }
    }

    private void y(boolean z2) {
        ValueAnimator valueAnimator = this.J0;
        if (valueAnimator != null && valueAnimator.isRunning()) {
            this.J0.cancel();
        }
        if (z2 && this.I0) {
            k(1.0f);
        } else {
            this.G0.d0(1.0f);
        }
        this.F0 = false;
        if (A()) {
            R();
        }
        z0();
        this.f4195f.i(false);
        D0();
    }

    private void y0() {
        EditText editText;
        if (this.f4231x == null || (editText = this.f4201i) == null) {
            return;
        }
        this.f4231x.setGravity(editText.getGravity());
        this.f4231x.setPadding(this.f4201i.getCompoundPaddingLeft(), this.f4201i.getCompoundPaddingTop(), this.f4201i.getCompoundPaddingRight(), this.f4201i.getCompoundPaddingBottom());
    }

    private j0.d z() {
        j0.d dVar = new j0.d();
        dVar.U(87L);
        dVar.W(m0.a.f5553a);
        return dVar;
    }

    private void z0() {
        EditText editText = this.f4201i;
        A0(editText == null ? 0 : editText.getText().length());
    }

    void E0() {
        TextView textView;
        EditText editText;
        EditText editText2;
        if (this.J == null || this.P == 0) {
            return;
        }
        boolean z2 = false;
        boolean z3 = isFocused() || ((editText2 = this.f4201i) != null && editText2.hasFocus());
        if (isHovered() || ((editText = this.f4201i) != null && editText.isHovered())) {
            z2 = true;
        }
        if (!isEnabled()) {
            this.U = this.E0;
        } else if (this.f4213o.l()) {
            if (this.f4236z0 != null) {
                B0(z3, z2);
            } else {
                this.U = this.f4213o.p();
            }
        } else if (!this.f4219r || (textView = this.f4221s) == null) {
            if (z3) {
                this.U = this.f4234y0;
            } else if (z2) {
                this.U = this.f4232x0;
            } else {
                this.U = this.f4230w0;
            }
        } else if (this.f4236z0 != null) {
            B0(z3, z2);
        } else {
            this.U = textView.getCurrentTextColor();
        }
        u0();
        V();
        W();
        U();
        if (getEndIconDelegate().d()) {
            i0(this.f4213o.l());
        }
        if (this.P == 2) {
            int i3 = this.R;
            if (z3 && isEnabled()) {
                this.R = this.T;
            } else {
                this.R = this.S;
            }
            if (this.R != i3) {
                S();
            }
        }
        if (this.P == 1) {
            if (!isEnabled()) {
                this.V = this.B0;
            } else if (z2 && !z3) {
                this.V = this.D0;
            } else if (z3) {
                this.V = this.C0;
            } else {
                this.V = this.A0;
            }
        }
        l();
    }

    public boolean K() {
        return this.f4199h.getVisibility() == 0 && this.f4202i0.getVisibility() == 0;
    }

    public boolean M() {
        return this.f4213o.A();
    }

    final boolean N() {
        return this.F0;
    }

    public boolean O() {
        return this.I;
    }

    public void U() {
        com.google.android.material.textfield.f.c(this, this.f4202i0, this.f4206k0);
    }

    public void V() {
        com.google.android.material.textfield.f.c(this, this.f4220r0, this.f4222s0);
    }

    public void W() {
        this.f4195f.j();
    }

    public void Y(float f3, float f4, float f5, float f6) {
        boolean zE = com.google.android.material.internal.o.e(this);
        this.N = zE;
        float f7 = zE ? f4 : f3;
        if (!zE) {
            f3 = f4;
        }
        float f8 = zE ? f6 : f5;
        if (!zE) {
            f5 = f6;
        }
        c1.g gVar = this.J;
        if (gVar != null && gVar.G() == f7 && this.J.H() == f3 && this.J.s() == f8 && this.J.t() == f5) {
            return;
        }
        this.M = this.M.v().A(f7).E(f3).s(f8).w(f5).m();
        l();
    }

    @Override // android.view.ViewGroup
    public void addView(View view, int i3, ViewGroup.LayoutParams layoutParams) {
        if (!(view instanceof EditText)) {
            super.addView(view, i3, layoutParams);
            return;
        }
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(layoutParams);
        layoutParams2.gravity = (layoutParams2.gravity & (-113)) | 16;
        this.f4193e.addView(view, layoutParams2);
        this.f4193e.setLayoutParams(layoutParams);
        v0();
        setEditText((EditText) view);
    }

    /* JADX WARN: Removed duplicated region for block: B:9:0x0018  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    void d0(android.widget.TextView r3, int r4) {
        /*
            r2 = this;
            r0 = 1
            androidx.core.widget.j.n(r3, r4)     // Catch: java.lang.Exception -> L1a
            int r4 = android.os.Build.VERSION.SDK_INT     // Catch: java.lang.Exception -> L1a
            r1 = 23
            if (r4 < r1) goto L18
            android.content.res.ColorStateList r4 = r3.getTextColors()     // Catch: java.lang.Exception -> L1a
            int r4 = r4.getDefaultColor()     // Catch: java.lang.Exception -> L1a
            r1 = -65281(0xffffffffffff00ff, float:NaN)
            if (r4 != r1) goto L18
            goto L1a
        L18:
            r4 = 0
            r0 = r4
        L1a:
            if (r0 == 0) goto L2e
            int r4 = l0.j.f5446a
            androidx.core.widget.j.n(r3, r4)
            android.content.Context r2 = r2.getContext()
            int r4 = l0.c.f5344a
            int r2 = androidx.core.content.a.b(r2, r4)
            r3.setTextColor(r2)
        L2e:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.textfield.TextInputLayout.d0(android.widget.TextView, int):void");
    }

    @Override // android.view.ViewGroup, android.view.View
    @TargetApi(26)
    public void dispatchProvideAutofillStructure(ViewStructure viewStructure, int i3) {
        EditText editText = this.f4201i;
        if (editText == null) {
            super.dispatchProvideAutofillStructure(viewStructure, i3);
            return;
        }
        if (this.f4203j != null) {
            boolean z2 = this.I;
            this.I = false;
            CharSequence hint = editText.getHint();
            this.f4201i.setHint(this.f4203j);
            try {
                super.dispatchProvideAutofillStructure(viewStructure, i3);
                return;
            } finally {
                this.f4201i.setHint(hint);
                this.I = z2;
            }
        }
        viewStructure.setAutofillId(getAutofillId());
        onProvideAutofillStructure(viewStructure, i3);
        onProvideAutofillVirtualStructure(viewStructure, i3);
        viewStructure.setChildCount(this.f4193e.getChildCount());
        for (int i4 = 0; i4 < this.f4193e.getChildCount(); i4++) {
            View childAt = this.f4193e.getChildAt(i4);
            ViewStructure viewStructureNewChild = viewStructure.newChild(i4);
            childAt.dispatchProvideAutofillStructure(viewStructureNewChild, i3);
            if (childAt == this.f4201i) {
                viewStructureNewChild.setHint(getHint());
            }
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    protected void dispatchRestoreInstanceState(SparseArray<Parcelable> sparseArray) {
        this.L0 = true;
        super.dispatchRestoreInstanceState(sparseArray);
        this.L0 = false;
    }

    @Override // android.view.View
    public void draw(Canvas canvas) {
        super.draw(canvas);
        E(canvas);
        D(canvas);
    }

    @Override // android.view.ViewGroup, android.view.View
    protected void drawableStateChanged() {
        if (this.K0) {
            return;
        }
        this.K0 = true;
        super.drawableStateChanged();
        int[] drawableState = getDrawableState();
        com.google.android.material.internal.b bVar = this.G0;
        boolean zG0 = bVar != null ? bVar.g0(drawableState) | false : false;
        if (this.f4201i != null) {
            w0(y.V(this) && isEnabled());
        }
        r0();
        E0();
        if (zG0) {
            invalidate();
        }
        this.K0 = false;
    }

    public void g(f fVar) {
        this.f4196f0.add(fVar);
        if (this.f4201i != null) {
            fVar.a(this);
        }
    }

    @Override // android.widget.LinearLayout, android.view.View
    public int getBaseline() {
        EditText editText = this.f4201i;
        return editText != null ? editText.getBaseline() + getPaddingTop() + u() : super.getBaseline();
    }

    c1.g getBoxBackground() {
        int i3 = this.P;
        if (i3 == 1 || i3 == 2) {
            return this.J;
        }
        throw new IllegalStateException();
    }

    public int getBoxBackgroundColor() {
        return this.V;
    }

    public int getBoxBackgroundMode() {
        return this.P;
    }

    public int getBoxCollapsedPaddingTop() {
        return this.Q;
    }

    public float getBoxCornerRadiusBottomEnd() {
        return com.google.android.material.internal.o.e(this) ? this.M.j().a(this.f4190b0) : this.M.l().a(this.f4190b0);
    }

    public float getBoxCornerRadiusBottomStart() {
        return com.google.android.material.internal.o.e(this) ? this.M.l().a(this.f4190b0) : this.M.j().a(this.f4190b0);
    }

    public float getBoxCornerRadiusTopEnd() {
        return com.google.android.material.internal.o.e(this) ? this.M.r().a(this.f4190b0) : this.M.t().a(this.f4190b0);
    }

    public float getBoxCornerRadiusTopStart() {
        return com.google.android.material.internal.o.e(this) ? this.M.t().a(this.f4190b0) : this.M.r().a(this.f4190b0);
    }

    public int getBoxStrokeColor() {
        return this.f4234y0;
    }

    public ColorStateList getBoxStrokeErrorColor() {
        return this.f4236z0;
    }

    public int getBoxStrokeWidth() {
        return this.S;
    }

    public int getBoxStrokeWidthFocused() {
        return this.T;
    }

    public int getCounterMaxLength() {
        return this.f4217q;
    }

    CharSequence getCounterOverflowDescription() {
        TextView textView;
        if (this.f4215p && this.f4219r && (textView = this.f4221s) != null) {
            return textView.getContentDescription();
        }
        return null;
    }

    public ColorStateList getCounterOverflowTextColor() {
        return this.C;
    }

    public ColorStateList getCounterTextColor() {
        return this.C;
    }

    public ColorStateList getDefaultHintTextColor() {
        return this.f4226u0;
    }

    public EditText getEditText() {
        return this.f4201i;
    }

    public CharSequence getEndIconContentDescription() {
        return this.f4202i0.getContentDescription();
    }

    public Drawable getEndIconDrawable() {
        return this.f4202i0.getDrawable();
    }

    public int getEndIconMode() {
        return this.f4198g0;
    }

    CheckableImageButton getEndIconView() {
        return this.f4202i0;
    }

    public CharSequence getError() {
        if (this.f4213o.z()) {
            return this.f4213o.o();
        }
        return null;
    }

    public CharSequence getErrorContentDescription() {
        return this.f4213o.n();
    }

    public int getErrorCurrentTextColors() {
        return this.f4213o.p();
    }

    public Drawable getErrorIconDrawable() {
        return this.f4220r0.getDrawable();
    }

    final int getErrorTextCurrentColor() {
        return this.f4213o.p();
    }

    public CharSequence getHelperText() {
        if (this.f4213o.A()) {
            return this.f4213o.r();
        }
        return null;
    }

    public int getHelperTextCurrentTextColor() {
        return this.f4213o.t();
    }

    public CharSequence getHint() {
        if (this.G) {
            return this.H;
        }
        return null;
    }

    final float getHintCollapsedTextHeight() {
        return this.G0.q();
    }

    final int getHintCurrentCollapsedTextColor() {
        return this.G0.t();
    }

    public ColorStateList getHintTextColor() {
        return this.f4228v0;
    }

    public int getMaxEms() {
        return this.f4207l;
    }

    public int getMaxWidth() {
        return this.f4211n;
    }

    public int getMinEms() {
        return this.f4205k;
    }

    public int getMinWidth() {
        return this.f4209m;
    }

    @Deprecated
    public CharSequence getPasswordVisibilityToggleContentDescription() {
        return this.f4202i0.getContentDescription();
    }

    @Deprecated
    public Drawable getPasswordVisibilityToggleDrawable() {
        return this.f4202i0.getDrawable();
    }

    public CharSequence getPlaceholderText() {
        if (this.f4229w) {
            return this.f4227v;
        }
        return null;
    }

    public int getPlaceholderTextAppearance() {
        return this.f4235z;
    }

    public ColorStateList getPlaceholderTextColor() {
        return this.f4233y;
    }

    public CharSequence getPrefixText() {
        return this.f4195f.a();
    }

    public ColorStateList getPrefixTextColor() {
        return this.f4195f.b();
    }

    public TextView getPrefixTextView() {
        return this.f4195f.c();
    }

    public CharSequence getStartIconContentDescription() {
        return this.f4195f.d();
    }

    public Drawable getStartIconDrawable() {
        return this.f4195f.e();
    }

    public CharSequence getSuffixText() {
        return this.E;
    }

    public ColorStateList getSuffixTextColor() {
        return this.F.getTextColors();
    }

    public TextView getSuffixTextView() {
        return this.F;
    }

    public Typeface getTypeface() {
        return this.f4191c0;
    }

    public void h(g gVar) {
        this.f4204j0.add(gVar);
    }

    void k(float f3) {
        if (this.G0.x() == f3) {
            return;
        }
        if (this.J0 == null) {
            ValueAnimator valueAnimator = new ValueAnimator();
            this.J0 = valueAnimator;
            valueAnimator.setInterpolator(m0.a.f5554b);
            this.J0.setDuration(167L);
            this.J0.addUpdateListener(new d());
        }
        this.J0.setFloatValues(this.G0.x(), f3);
        this.J0.start();
    }

    void m0(int i3) {
        boolean z2 = this.f4219r;
        int i4 = this.f4217q;
        if (i4 == -1) {
            this.f4221s.setText(String.valueOf(i3));
            this.f4221s.setContentDescription(null);
            this.f4219r = false;
        } else {
            this.f4219r = i3 > i4;
            n0(getContext(), this.f4221s, i3, this.f4217q, this.f4219r);
            if (z2 != this.f4219r) {
                o0();
            }
            this.f4221s.setText(androidx.core.text.a.c().j(getContext().getString(l0.i.f5433d, Integer.valueOf(i3), Integer.valueOf(this.f4217q))));
        }
        if (this.f4201i == null || z2 == this.f4219r) {
            return;
        }
        w0(false);
        E0();
        r0();
    }

    @Override // android.view.View
    protected void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        this.G0.H(configuration);
    }

    @Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
    protected void onLayout(boolean z2, int i3, int i4, int i5, int i6) {
        super.onLayout(z2, i3, i4, i5, i6);
        EditText editText = this.f4201i;
        if (editText != null) {
            Rect rect = this.W;
            com.google.android.material.internal.c.a(this, editText, rect);
            k0(rect);
            if (this.G) {
                this.G0.b0(this.f4201i.getTextSize());
                int gravity = this.f4201i.getGravity();
                this.G0.S((gravity & (-113)) | 48);
                this.G0.a0(gravity);
                this.G0.O(q(rect));
                this.G0.W(t(rect));
                this.G0.K();
                if (!A() || this.F0) {
                    return;
                }
                R();
            }
        }
    }

    @Override // android.widget.LinearLayout, android.view.View
    protected void onMeasure(int i3, int i4) {
        super.onMeasure(i3, i4);
        boolean zS0 = s0();
        boolean zQ0 = q0();
        if (zS0 || zQ0) {
            this.f4201i.post(new c());
        }
        y0();
        C0();
    }

    @Override // android.view.View
    protected void onRestoreInstanceState(Parcelable parcelable) {
        if (!(parcelable instanceof h)) {
            super.onRestoreInstanceState(parcelable);
            return;
        }
        h hVar = (h) parcelable;
        super.onRestoreInstanceState(hVar.j());
        setError(hVar.f4242g);
        if (hVar.f4243h) {
            this.f4202i0.post(new b());
        }
        setHint(hVar.f4244i);
        setHelperText(hVar.f4245j);
        setPlaceholderText(hVar.f4246k);
        requestLayout();
    }

    @Override // android.widget.LinearLayout, android.view.View
    public void onRtlPropertiesChanged(int i3) {
        super.onRtlPropertiesChanged(i3);
        boolean z2 = false;
        boolean z3 = i3 == 1;
        boolean z4 = this.N;
        if (z3 != z4) {
            if (z3 && !z4) {
                z2 = true;
            }
            float fA = this.M.r().a(this.f4190b0);
            float fA2 = this.M.t().a(this.f4190b0);
            float fA3 = this.M.j().a(this.f4190b0);
            float fA4 = this.M.l().a(this.f4190b0);
            float f3 = z2 ? fA : fA2;
            if (z2) {
                fA = fA2;
            }
            float f4 = z2 ? fA3 : fA4;
            if (z2) {
                fA3 = fA4;
            }
            Y(f3, fA, f4, fA3);
        }
    }

    @Override // android.view.View
    public Parcelable onSaveInstanceState() {
        h hVar = new h(super.onSaveInstanceState());
        if (this.f4213o.l()) {
            hVar.f4242g = getError();
        }
        hVar.f4243h = I() && this.f4202i0.isChecked();
        hVar.f4244i = getHint();
        hVar.f4245j = getHelperText();
        hVar.f4246k = getPlaceholderText();
        return hVar;
    }

    boolean q0() {
        boolean z2;
        if (this.f4201i == null) {
            return false;
        }
        boolean z3 = true;
        if (f0()) {
            int measuredWidth = this.f4195f.getMeasuredWidth() - this.f4201i.getPaddingLeft();
            if (this.f4192d0 == null || this.f4194e0 != measuredWidth) {
                ColorDrawable colorDrawable = new ColorDrawable();
                this.f4192d0 = colorDrawable;
                this.f4194e0 = measuredWidth;
                colorDrawable.setBounds(0, 0, measuredWidth, 1);
            }
            Drawable[] drawableArrA = androidx.core.widget.j.a(this.f4201i);
            Drawable drawable = drawableArrA[0];
            Drawable drawable2 = this.f4192d0;
            if (drawable != drawable2) {
                androidx.core.widget.j.i(this.f4201i, drawable2, drawableArrA[1], drawableArrA[2], drawableArrA[3]);
                z2 = true;
            }
            z2 = false;
        } else {
            if (this.f4192d0 != null) {
                Drawable[] drawableArrA2 = androidx.core.widget.j.a(this.f4201i);
                androidx.core.widget.j.i(this.f4201i, null, drawableArrA2[1], drawableArrA2[2], drawableArrA2[3]);
                this.f4192d0 = null;
                z2 = true;
            }
            z2 = false;
        }
        if (e0()) {
            int measuredWidth2 = this.F.getMeasuredWidth() - this.f4201i.getPaddingRight();
            CheckableImageButton endIconToUpdateDummyDrawable = getEndIconToUpdateDummyDrawable();
            if (endIconToUpdateDummyDrawable != null) {
                measuredWidth2 = measuredWidth2 + endIconToUpdateDummyDrawable.getMeasuredWidth() + androidx.core.view.h.b((ViewGroup.MarginLayoutParams) endIconToUpdateDummyDrawable.getLayoutParams());
            }
            Drawable[] drawableArrA3 = androidx.core.widget.j.a(this.f4201i);
            Drawable drawable3 = this.f4210m0;
            if (drawable3 == null || this.f4212n0 == measuredWidth2) {
                if (drawable3 == null) {
                    ColorDrawable colorDrawable2 = new ColorDrawable();
                    this.f4210m0 = colorDrawable2;
                    this.f4212n0 = measuredWidth2;
                    colorDrawable2.setBounds(0, 0, measuredWidth2, 1);
                }
                Drawable drawable4 = drawableArrA3[2];
                Drawable drawable5 = this.f4210m0;
                if (drawable4 != drawable5) {
                    this.f4214o0 = drawableArrA3[2];
                    androidx.core.widget.j.i(this.f4201i, drawableArrA3[0], drawableArrA3[1], drawable5, drawableArrA3[3]);
                } else {
                    z3 = z2;
                }
            } else {
                this.f4212n0 = measuredWidth2;
                drawable3.setBounds(0, 0, measuredWidth2, 1);
                androidx.core.widget.j.i(this.f4201i, drawableArrA3[0], drawableArrA3[1], this.f4210m0, drawableArrA3[3]);
            }
        } else {
            if (this.f4210m0 == null) {
                return z2;
            }
            Drawable[] drawableArrA4 = androidx.core.widget.j.a(this.f4201i);
            if (drawableArrA4[2] == this.f4210m0) {
                androidx.core.widget.j.i(this.f4201i, drawableArrA4[0], drawableArrA4[1], this.f4214o0, drawableArrA4[3]);
            } else {
                z3 = z2;
            }
            this.f4210m0 = null;
        }
        return z3;
    }

    void r0() {
        Drawable background;
        TextView textView;
        EditText editText = this.f4201i;
        if (editText == null || this.P != 0 || (background = editText.getBackground()) == null) {
            return;
        }
        if (i0.a(background)) {
            background = background.mutate();
        }
        if (this.f4213o.l()) {
            background.setColorFilter(androidx.appcompat.widget.k.e(this.f4213o.p(), PorterDuff.Mode.SRC_IN));
        } else if (this.f4219r && (textView = this.f4221s) != null) {
            background.setColorFilter(androidx.appcompat.widget.k.e(textView.getCurrentTextColor(), PorterDuff.Mode.SRC_IN));
        } else {
            androidx.core.graphics.drawable.a.c(background);
            this.f4201i.refreshDrawableState();
        }
    }

    public void setBoxBackgroundColor(int i3) {
        if (this.V != i3) {
            this.V = i3;
            this.A0 = i3;
            this.C0 = i3;
            this.D0 = i3;
            l();
        }
    }

    public void setBoxBackgroundColorResource(int i3) {
        setBoxBackgroundColor(androidx.core.content.a.b(getContext(), i3));
    }

    public void setBoxBackgroundColorStateList(ColorStateList colorStateList) {
        int defaultColor = colorStateList.getDefaultColor();
        this.A0 = defaultColor;
        this.V = defaultColor;
        this.B0 = colorStateList.getColorForState(new int[]{-16842910}, -1);
        this.C0 = colorStateList.getColorForState(new int[]{R.attr.state_focused, R.attr.state_enabled}, -1);
        this.D0 = colorStateList.getColorForState(new int[]{R.attr.state_hovered, R.attr.state_enabled}, -1);
        l();
    }

    public void setBoxBackgroundMode(int i3) {
        if (i3 == this.P) {
            return;
        }
        this.P = i3;
        if (this.f4201i != null) {
            Q();
        }
    }

    public void setBoxCollapsedPaddingTop(int i3) {
        this.Q = i3;
    }

    public void setBoxStrokeColor(int i3) {
        if (this.f4234y0 != i3) {
            this.f4234y0 = i3;
            E0();
        }
    }

    public void setBoxStrokeColorStateList(ColorStateList colorStateList) {
        if (colorStateList.isStateful()) {
            this.f4230w0 = colorStateList.getDefaultColor();
            this.E0 = colorStateList.getColorForState(new int[]{-16842910}, -1);
            this.f4232x0 = colorStateList.getColorForState(new int[]{R.attr.state_hovered, R.attr.state_enabled}, -1);
            this.f4234y0 = colorStateList.getColorForState(new int[]{R.attr.state_focused, R.attr.state_enabled}, -1);
        } else if (this.f4234y0 != colorStateList.getDefaultColor()) {
            this.f4234y0 = colorStateList.getDefaultColor();
        }
        E0();
    }

    public void setBoxStrokeErrorColor(ColorStateList colorStateList) {
        if (this.f4236z0 != colorStateList) {
            this.f4236z0 = colorStateList;
            E0();
        }
    }

    public void setBoxStrokeWidth(int i3) {
        this.S = i3;
        E0();
    }

    public void setBoxStrokeWidthFocused(int i3) {
        this.T = i3;
        E0();
    }

    public void setBoxStrokeWidthFocusedResource(int i3) {
        setBoxStrokeWidthFocused(getResources().getDimensionPixelSize(i3));
    }

    public void setBoxStrokeWidthResource(int i3) {
        setBoxStrokeWidth(getResources().getDimensionPixelSize(i3));
    }

    public void setCounterEnabled(boolean z2) {
        if (this.f4215p != z2) {
            if (z2) {
                d0 d0Var = new d0(getContext());
                this.f4221s = d0Var;
                d0Var.setId(l0.f.K);
                Typeface typeface = this.f4191c0;
                if (typeface != null) {
                    this.f4221s.setTypeface(typeface);
                }
                this.f4221s.setMaxLines(1);
                this.f4213o.e(this.f4221s, 2);
                androidx.core.view.h.d((ViewGroup.MarginLayoutParams) this.f4221s.getLayoutParams(), getResources().getDimensionPixelOffset(l0.d.S));
                o0();
                l0();
            } else {
                this.f4213o.B(this.f4221s, 2);
                this.f4221s = null;
            }
            this.f4215p = z2;
        }
    }

    public void setCounterMaxLength(int i3) {
        if (this.f4217q != i3) {
            if (i3 > 0) {
                this.f4217q = i3;
            } else {
                this.f4217q = -1;
            }
            if (this.f4215p) {
                l0();
            }
        }
    }

    public void setCounterOverflowTextAppearance(int i3) {
        if (this.f4223t != i3) {
            this.f4223t = i3;
            o0();
        }
    }

    public void setCounterOverflowTextColor(ColorStateList colorStateList) {
        if (this.D != colorStateList) {
            this.D = colorStateList;
            o0();
        }
    }

    public void setCounterTextAppearance(int i3) {
        if (this.f4225u != i3) {
            this.f4225u = i3;
            o0();
        }
    }

    public void setCounterTextColor(ColorStateList colorStateList) {
        if (this.C != colorStateList) {
            this.C = colorStateList;
            o0();
        }
    }

    public void setDefaultHintTextColor(ColorStateList colorStateList) {
        this.f4226u0 = colorStateList;
        this.f4228v0 = colorStateList;
        if (this.f4201i != null) {
            w0(false);
        }
    }

    @Override // android.view.View
    public void setEnabled(boolean z2) {
        T(this, z2);
        super.setEnabled(z2);
    }

    public void setEndIconActivated(boolean z2) {
        this.f4202i0.setActivated(z2);
    }

    public void setEndIconCheckable(boolean z2) {
        this.f4202i0.setCheckable(z2);
    }

    public void setEndIconContentDescription(int i3) {
        setEndIconContentDescription(i3 != 0 ? getResources().getText(i3) : null);
    }

    public void setEndIconDrawable(int i3) {
        setEndIconDrawable(i3 != 0 ? d.a.b(getContext(), i3) : null);
    }

    public void setEndIconMode(int i3) {
        int i4 = this.f4198g0;
        if (i4 == i3) {
            return;
        }
        this.f4198g0 = i3;
        C(i4);
        setEndIconVisible(i3 != 0);
        if (getEndIconDelegate().b(this.P)) {
            getEndIconDelegate().a();
            com.google.android.material.textfield.f.a(this, this.f4202i0, this.f4206k0, this.f4208l0);
            return;
        }
        throw new IllegalStateException("The current box background mode " + this.P + " is not supported by the end icon mode " + i3);
    }

    public void setEndIconOnClickListener(View.OnClickListener onClickListener) {
        b0(this.f4202i0, onClickListener, this.f4216p0);
    }

    public void setEndIconOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        this.f4216p0 = onLongClickListener;
        c0(this.f4202i0, onLongClickListener);
    }

    public void setEndIconTintList(ColorStateList colorStateList) {
        if (this.f4206k0 != colorStateList) {
            this.f4206k0 = colorStateList;
            com.google.android.material.textfield.f.a(this, this.f4202i0, colorStateList, this.f4208l0);
        }
    }

    public void setEndIconTintMode(PorterDuff.Mode mode) {
        if (this.f4208l0 != mode) {
            this.f4208l0 = mode;
            com.google.android.material.textfield.f.a(this, this.f4202i0, this.f4206k0, mode);
        }
    }

    public void setEndIconVisible(boolean z2) {
        if (K() != z2) {
            this.f4202i0.setVisibility(z2 ? 0 : 8);
            t0();
            C0();
            q0();
        }
    }

    public void setError(CharSequence charSequence) {
        if (!this.f4213o.z()) {
            if (TextUtils.isEmpty(charSequence)) {
                return;
            } else {
                setErrorEnabled(true);
            }
        }
        if (TextUtils.isEmpty(charSequence)) {
            this.f4213o.v();
        } else {
            this.f4213o.O(charSequence);
        }
    }

    public void setErrorContentDescription(CharSequence charSequence) {
        this.f4213o.D(charSequence);
    }

    public void setErrorEnabled(boolean z2) {
        this.f4213o.E(z2);
    }

    public void setErrorIconDrawable(int i3) {
        setErrorIconDrawable(i3 != 0 ? d.a.b(getContext(), i3) : null);
        V();
    }

    public void setErrorIconOnClickListener(View.OnClickListener onClickListener) {
        b0(this.f4220r0, onClickListener, this.f4218q0);
    }

    public void setErrorIconOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        this.f4218q0 = onLongClickListener;
        c0(this.f4220r0, onLongClickListener);
    }

    public void setErrorIconTintList(ColorStateList colorStateList) {
        if (this.f4222s0 != colorStateList) {
            this.f4222s0 = colorStateList;
            com.google.android.material.textfield.f.a(this, this.f4220r0, colorStateList, this.f4224t0);
        }
    }

    public void setErrorIconTintMode(PorterDuff.Mode mode) {
        if (this.f4224t0 != mode) {
            this.f4224t0 = mode;
            com.google.android.material.textfield.f.a(this, this.f4220r0, this.f4222s0, mode);
        }
    }

    public void setErrorTextAppearance(int i3) {
        this.f4213o.F(i3);
    }

    public void setErrorTextColor(ColorStateList colorStateList) {
        this.f4213o.G(colorStateList);
    }

    public void setExpandedHintEnabled(boolean z2) {
        if (this.H0 != z2) {
            this.H0 = z2;
            w0(false);
        }
    }

    public void setHelperText(CharSequence charSequence) {
        if (TextUtils.isEmpty(charSequence)) {
            if (M()) {
                setHelperTextEnabled(false);
            }
        } else {
            if (!M()) {
                setHelperTextEnabled(true);
            }
            this.f4213o.P(charSequence);
        }
    }

    public void setHelperTextColor(ColorStateList colorStateList) {
        this.f4213o.J(colorStateList);
    }

    public void setHelperTextEnabled(boolean z2) {
        this.f4213o.I(z2);
    }

    public void setHelperTextTextAppearance(int i3) {
        this.f4213o.H(i3);
    }

    public void setHint(CharSequence charSequence) {
        if (this.G) {
            setHintInternal(charSequence);
            sendAccessibilityEvent(2048);
        }
    }

    public void setHintAnimationEnabled(boolean z2) {
        this.I0 = z2;
    }

    public void setHintEnabled(boolean z2) {
        if (z2 != this.G) {
            this.G = z2;
            if (z2) {
                CharSequence hint = this.f4201i.getHint();
                if (!TextUtils.isEmpty(hint)) {
                    if (TextUtils.isEmpty(this.H)) {
                        setHint(hint);
                    }
                    this.f4201i.setHint((CharSequence) null);
                }
                this.I = true;
            } else {
                this.I = false;
                if (!TextUtils.isEmpty(this.H) && TextUtils.isEmpty(this.f4201i.getHint())) {
                    this.f4201i.setHint(this.H);
                }
                setHintInternal(null);
            }
            if (this.f4201i != null) {
                v0();
            }
        }
    }

    public void setHintTextAppearance(int i3) {
        this.G0.P(i3);
        this.f4228v0 = this.G0.p();
        if (this.f4201i != null) {
            w0(false);
            v0();
        }
    }

    public void setHintTextColor(ColorStateList colorStateList) {
        if (this.f4228v0 != colorStateList) {
            if (this.f4226u0 == null) {
                this.G0.R(colorStateList);
            }
            this.f4228v0 = colorStateList;
            if (this.f4201i != null) {
                w0(false);
            }
        }
    }

    public void setMaxEms(int i3) {
        this.f4207l = i3;
        EditText editText = this.f4201i;
        if (editText == null || i3 == -1) {
            return;
        }
        editText.setMaxEms(i3);
    }

    public void setMaxWidth(int i3) {
        this.f4211n = i3;
        EditText editText = this.f4201i;
        if (editText == null || i3 == -1) {
            return;
        }
        editText.setMaxWidth(i3);
    }

    public void setMaxWidthResource(int i3) {
        setMaxWidth(getContext().getResources().getDimensionPixelSize(i3));
    }

    public void setMinEms(int i3) {
        this.f4205k = i3;
        EditText editText = this.f4201i;
        if (editText == null || i3 == -1) {
            return;
        }
        editText.setMinEms(i3);
    }

    public void setMinWidth(int i3) {
        this.f4209m = i3;
        EditText editText = this.f4201i;
        if (editText == null || i3 == -1) {
            return;
        }
        editText.setMinWidth(i3);
    }

    public void setMinWidthResource(int i3) {
        setMinWidth(getContext().getResources().getDimensionPixelSize(i3));
    }

    @Deprecated
    public void setPasswordVisibilityToggleContentDescription(int i3) {
        setPasswordVisibilityToggleContentDescription(i3 != 0 ? getResources().getText(i3) : null);
    }

    @Deprecated
    public void setPasswordVisibilityToggleDrawable(int i3) {
        setPasswordVisibilityToggleDrawable(i3 != 0 ? d.a.b(getContext(), i3) : null);
    }

    @Deprecated
    public void setPasswordVisibilityToggleEnabled(boolean z2) {
        if (z2 && this.f4198g0 != 1) {
            setEndIconMode(1);
        } else {
            if (z2) {
                return;
            }
            setEndIconMode(0);
        }
    }

    @Deprecated
    public void setPasswordVisibilityToggleTintList(ColorStateList colorStateList) {
        this.f4206k0 = colorStateList;
        com.google.android.material.textfield.f.a(this, this.f4202i0, colorStateList, this.f4208l0);
    }

    @Deprecated
    public void setPasswordVisibilityToggleTintMode(PorterDuff.Mode mode) {
        this.f4208l0 = mode;
        com.google.android.material.textfield.f.a(this, this.f4202i0, this.f4206k0, mode);
    }

    public void setPlaceholderText(CharSequence charSequence) {
        if (this.f4231x == null) {
            d0 d0Var = new d0(getContext());
            this.f4231x = d0Var;
            d0Var.setId(l0.f.N);
            y.B0(this.f4231x, 2);
            j0.d dVarZ = z();
            this.A = dVarZ;
            dVarZ.Z(67L);
            this.B = z();
            setPlaceholderTextAppearance(this.f4235z);
            setPlaceholderTextColor(this.f4233y);
        }
        if (TextUtils.isEmpty(charSequence)) {
            setPlaceholderTextEnabled(false);
        } else {
            if (!this.f4229w) {
                setPlaceholderTextEnabled(true);
            }
            this.f4227v = charSequence;
        }
        z0();
    }

    public void setPlaceholderTextAppearance(int i3) {
        this.f4235z = i3;
        TextView textView = this.f4231x;
        if (textView != null) {
            androidx.core.widget.j.n(textView, i3);
        }
    }

    public void setPlaceholderTextColor(ColorStateList colorStateList) {
        if (this.f4233y != colorStateList) {
            this.f4233y = colorStateList;
            TextView textView = this.f4231x;
            if (textView == null || colorStateList == null) {
                return;
            }
            textView.setTextColor(colorStateList);
        }
    }

    public void setPrefixText(CharSequence charSequence) {
        this.f4195f.k(charSequence);
    }

    public void setPrefixTextAppearance(int i3) {
        this.f4195f.l(i3);
    }

    public void setPrefixTextColor(ColorStateList colorStateList) {
        this.f4195f.m(colorStateList);
    }

    public void setStartIconCheckable(boolean z2) {
        this.f4195f.n(z2);
    }

    public void setStartIconContentDescription(int i3) {
        setStartIconContentDescription(i3 != 0 ? getResources().getText(i3) : null);
    }

    public void setStartIconDrawable(int i3) {
        setStartIconDrawable(i3 != 0 ? d.a.b(getContext(), i3) : null);
    }

    public void setStartIconOnClickListener(View.OnClickListener onClickListener) {
        this.f4195f.q(onClickListener);
    }

    public void setStartIconOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        this.f4195f.r(onLongClickListener);
    }

    public void setStartIconTintList(ColorStateList colorStateList) {
        this.f4195f.s(colorStateList);
    }

    public void setStartIconTintMode(PorterDuff.Mode mode) {
        this.f4195f.t(mode);
    }

    public void setStartIconVisible(boolean z2) {
        this.f4195f.u(z2);
    }

    public void setSuffixText(CharSequence charSequence) {
        this.E = TextUtils.isEmpty(charSequence) ? null : charSequence;
        this.F.setText(charSequence);
        D0();
    }

    public void setSuffixTextAppearance(int i3) {
        androidx.core.widget.j.n(this.F, i3);
    }

    public void setSuffixTextColor(ColorStateList colorStateList) {
        this.F.setTextColor(colorStateList);
    }

    public void setTextInputAccessibilityDelegate(e eVar) {
        EditText editText = this.f4201i;
        if (editText != null) {
            y.r0(editText, eVar);
        }
    }

    public void setTypeface(Typeface typeface) {
        if (typeface != this.f4191c0) {
            this.f4191c0 = typeface;
            this.G0.j0(typeface);
            this.f4213o.L(typeface);
            TextView textView = this.f4221s;
            if (textView != null) {
                textView.setTypeface(typeface);
            }
        }
    }

    void w0(boolean z2) {
        x0(z2, false);
    }

    /* JADX WARN: Illegal instructions before constructor call */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r3v109 */
    /* JADX WARN: Type inference failed for: r3v49 */
    /* JADX WARN: Type inference failed for: r3v50, types: [boolean, int] */
    public TextInputLayout(Context context, AttributeSet attributeSet, int i3) {
        int i4;
        ?? r3;
        boolean z2;
        int iN;
        int i5 = M0;
        super(e1.a.c(context, attributeSet, i3, i5), attributeSet, i3);
        this.f4205k = -1;
        this.f4207l = -1;
        this.f4209m = -1;
        this.f4211n = -1;
        this.f4213o = new com.google.android.material.textfield.g(this);
        this.W = new Rect();
        this.f4189a0 = new Rect();
        this.f4190b0 = new RectF();
        this.f4196f0 = new LinkedHashSet<>();
        this.f4198g0 = 0;
        SparseArray<com.google.android.material.textfield.e> sparseArray = new SparseArray<>();
        this.f4200h0 = sparseArray;
        this.f4204j0 = new LinkedHashSet<>();
        com.google.android.material.internal.b bVar = new com.google.android.material.internal.b(this);
        this.G0 = bVar;
        Context context2 = getContext();
        setOrientation(1);
        setWillNotDraw(false);
        setAddStatesFromChildren(true);
        FrameLayout frameLayout = new FrameLayout(context2);
        this.f4193e = frameLayout;
        FrameLayout frameLayout2 = new FrameLayout(context2);
        this.f4199h = frameLayout2;
        LinearLayout linearLayout = new LinearLayout(context2);
        this.f4197g = linearLayout;
        d0 d0Var = new d0(context2);
        this.F = d0Var;
        linearLayout.setVisibility(8);
        frameLayout2.setVisibility(8);
        d0Var.setVisibility(8);
        LayoutInflater layoutInflaterFrom = LayoutInflater.from(context2);
        int i6 = l0.h.f5413b;
        CheckableImageButton checkableImageButton = (CheckableImageButton) layoutInflaterFrom.inflate(i6, (ViewGroup) linearLayout, false);
        this.f4220r0 = checkableImageButton;
        CheckableImageButton checkableImageButton2 = (CheckableImageButton) layoutInflaterFrom.inflate(i6, (ViewGroup) frameLayout2, false);
        this.f4202i0 = checkableImageButton2;
        frameLayout.setAddStatesFromChildren(true);
        linearLayout.setOrientation(0);
        linearLayout.setLayoutParams(new FrameLayout.LayoutParams(-2, -1, 8388613));
        frameLayout2.setLayoutParams(new FrameLayout.LayoutParams(-2, -1));
        TimeInterpolator timeInterpolator = m0.a.f5553a;
        bVar.i0(timeInterpolator);
        bVar.f0(timeInterpolator);
        bVar.S(8388659);
        int[] iArr = l0.k.Z2;
        int i7 = l0.k.w3;
        int i8 = l0.k.u3;
        int i9 = l0.k.J3;
        int i10 = l0.k.O3;
        int i11 = l0.k.S3;
        a1 a1VarI = m.i(context2, attributeSet, iArr, i3, i5, i7, i8, i9, i10, i11);
        k kVar = new k(this, a1VarI);
        this.f4195f = kVar;
        this.G = a1VarI.a(l0.k.R3, true);
        setHint(a1VarI.p(l0.k.e3));
        this.I0 = a1VarI.a(l0.k.Q3, true);
        this.H0 = a1VarI.a(l0.k.L3, true);
        int i12 = l0.k.g3;
        if (a1VarI.s(i12)) {
            i4 = -1;
            setMinEms(a1VarI.k(i12, -1));
        } else {
            i4 = -1;
            int i13 = l0.k.d3;
            if (a1VarI.s(i13)) {
                setMinWidth(a1VarI.f(i13, -1));
            }
        }
        int i14 = l0.k.f3;
        if (a1VarI.s(i14)) {
            setMaxEms(a1VarI.k(i14, i4));
        } else {
            int i15 = l0.k.c3;
            if (a1VarI.s(i15)) {
                setMaxWidth(a1VarI.f(i15, i4));
            }
        }
        this.M = c1.k.e(context2, attributeSet, i3, i5).m();
        this.O = context2.getResources().getDimensionPixelOffset(l0.d.P);
        this.Q = a1VarI.e(l0.k.j3, 0);
        this.S = a1VarI.f(l0.k.q3, context2.getResources().getDimensionPixelSize(l0.d.Q));
        this.T = a1VarI.f(l0.k.r3, context2.getResources().getDimensionPixelSize(l0.d.R));
        this.R = this.S;
        float fD = a1VarI.d(l0.k.n3, -1.0f);
        float fD2 = a1VarI.d(l0.k.m3, -1.0f);
        float fD3 = a1VarI.d(l0.k.k3, -1.0f);
        float fD4 = a1VarI.d(l0.k.l3, -1.0f);
        k.b bVarV = this.M.v();
        if (fD >= 0.0f) {
            bVarV.A(fD);
        }
        if (fD2 >= 0.0f) {
            bVarV.E(fD2);
        }
        if (fD3 >= 0.0f) {
            bVarV.w(fD3);
        }
        if (fD4 >= 0.0f) {
            bVarV.s(fD4);
        }
        this.M = bVarV.m();
        ColorStateList colorStateListB = z0.c.b(context2, a1VarI, l0.k.h3);
        if (colorStateListB != null) {
            int defaultColor = colorStateListB.getDefaultColor();
            this.A0 = defaultColor;
            this.V = defaultColor;
            if (colorStateListB.isStateful()) {
                this.B0 = colorStateListB.getColorForState(new int[]{-16842910}, -1);
                this.C0 = colorStateListB.getColorForState(new int[]{R.attr.state_focused, R.attr.state_enabled}, -1);
                this.D0 = colorStateListB.getColorForState(new int[]{R.attr.state_hovered, R.attr.state_enabled}, -1);
            } else {
                this.C0 = this.A0;
                ColorStateList colorStateListA = d.a.a(context2, l0.c.f5346c);
                this.B0 = colorStateListA.getColorForState(new int[]{-16842910}, -1);
                this.D0 = colorStateListA.getColorForState(new int[]{R.attr.state_hovered}, -1);
            }
        } else {
            this.V = 0;
            this.A0 = 0;
            this.B0 = 0;
            this.C0 = 0;
            this.D0 = 0;
        }
        int i16 = l0.k.b3;
        if (a1VarI.s(i16)) {
            ColorStateList colorStateListC = a1VarI.c(i16);
            this.f4228v0 = colorStateListC;
            this.f4226u0 = colorStateListC;
        }
        int i17 = l0.k.o3;
        ColorStateList colorStateListB2 = z0.c.b(context2, a1VarI, i17);
        this.f4234y0 = a1VarI.b(i17, 0);
        this.f4230w0 = androidx.core.content.a.b(context2, l0.c.f5347d);
        this.E0 = androidx.core.content.a.b(context2, l0.c.f5348e);
        this.f4232x0 = androidx.core.content.a.b(context2, l0.c.f5349f);
        if (colorStateListB2 != null) {
            setBoxStrokeColorStateList(colorStateListB2);
        }
        int i18 = l0.k.p3;
        if (a1VarI.s(i18)) {
            setBoxStrokeErrorColor(z0.c.b(context2, a1VarI, i18));
        }
        if (a1VarI.n(i11, -1) != -1) {
            r3 = 0;
            setHintTextAppearance(a1VarI.n(i11, 0));
        } else {
            r3 = 0;
        }
        int iN2 = a1VarI.n(i9, r3);
        CharSequence charSequenceP = a1VarI.p(l0.k.E3);
        boolean zA = a1VarI.a(l0.k.F3, r3);
        checkableImageButton.setId(l0.f.J);
        if (z0.c.g(context2)) {
            androidx.core.view.h.d((ViewGroup.MarginLayoutParams) checkableImageButton.getLayoutParams(), r3);
        }
        int i19 = l0.k.H3;
        if (a1VarI.s(i19)) {
            this.f4222s0 = z0.c.b(context2, a1VarI, i19);
        }
        int i20 = l0.k.I3;
        if (a1VarI.s(i20)) {
            this.f4224t0 = com.google.android.material.internal.o.f(a1VarI.k(i20, -1), null);
        }
        int i21 = l0.k.G3;
        if (a1VarI.s(i21)) {
            setErrorIconDrawable(a1VarI.g(i21));
        }
        checkableImageButton.setContentDescription(getResources().getText(l0.i.f5435f));
        y.B0(checkableImageButton, 2);
        checkableImageButton.setClickable(false);
        checkableImageButton.setPressable(false);
        checkableImageButton.setFocusable(false);
        int iN3 = a1VarI.n(i10, 0);
        boolean zA2 = a1VarI.a(l0.k.N3, false);
        CharSequence charSequenceP2 = a1VarI.p(l0.k.M3);
        int iN4 = a1VarI.n(l0.k.a4, 0);
        CharSequence charSequenceP3 = a1VarI.p(l0.k.Z3);
        int iN5 = a1VarI.n(l0.k.l4, 0);
        CharSequence charSequenceP4 = a1VarI.p(l0.k.k4);
        boolean zA3 = a1VarI.a(l0.k.s3, false);
        setCounterMaxLength(a1VarI.k(l0.k.t3, -1));
        this.f4225u = a1VarI.n(i7, 0);
        this.f4223t = a1VarI.n(i8, 0);
        setBoxBackgroundMode(a1VarI.k(l0.k.i3, 0));
        if (z0.c.g(context2)) {
            androidx.core.view.h.d((ViewGroup.MarginLayoutParams) checkableImageButton2.getLayoutParams(), 0);
        }
        int iN6 = a1VarI.n(l0.k.A3, 0);
        sparseArray.append(-1, new com.google.android.material.textfield.b(this, iN6));
        sparseArray.append(0, new i(this));
        if (iN6 == 0) {
            z2 = zA2;
            iN = a1VarI.n(l0.k.V3, 0);
        } else {
            z2 = zA2;
            iN = iN6;
        }
        sparseArray.append(1, new j(this, iN));
        sparseArray.append(2, new com.google.android.material.textfield.a(this, iN6));
        sparseArray.append(3, new com.google.android.material.textfield.d(this, iN6));
        int i22 = l0.k.W3;
        if (!a1VarI.s(i22)) {
            int i23 = l0.k.C3;
            if (a1VarI.s(i23)) {
                this.f4206k0 = z0.c.b(context2, a1VarI, i23);
            }
            int i24 = l0.k.D3;
            if (a1VarI.s(i24)) {
                this.f4208l0 = com.google.android.material.internal.o.f(a1VarI.k(i24, -1), null);
            }
        }
        int i25 = l0.k.B3;
        if (a1VarI.s(i25)) {
            setEndIconMode(a1VarI.k(i25, 0));
            int i26 = l0.k.z3;
            if (a1VarI.s(i26)) {
                setEndIconContentDescription(a1VarI.p(i26));
            }
            setEndIconCheckable(a1VarI.a(l0.k.y3, true));
        } else if (a1VarI.s(i22)) {
            int i27 = l0.k.X3;
            if (a1VarI.s(i27)) {
                this.f4206k0 = z0.c.b(context2, a1VarI, i27);
            }
            int i28 = l0.k.Y3;
            if (a1VarI.s(i28)) {
                this.f4208l0 = com.google.android.material.internal.o.f(a1VarI.k(i28, -1), null);
            }
            setEndIconMode(a1VarI.a(i22, false) ? 1 : 0);
            setEndIconContentDescription(a1VarI.p(l0.k.U3));
        }
        d0Var.setId(l0.f.P);
        d0Var.setLayoutParams(new FrameLayout.LayoutParams(-2, -2, 80));
        y.t0(d0Var, 1);
        setErrorContentDescription(charSequenceP);
        setCounterOverflowTextAppearance(this.f4223t);
        setHelperTextTextAppearance(iN3);
        setErrorTextAppearance(iN2);
        setCounterTextAppearance(this.f4225u);
        setPlaceholderText(charSequenceP3);
        setPlaceholderTextAppearance(iN4);
        setSuffixTextAppearance(iN5);
        int i29 = l0.k.K3;
        if (a1VarI.s(i29)) {
            setErrorTextColor(a1VarI.c(i29));
        }
        int i30 = l0.k.P3;
        if (a1VarI.s(i30)) {
            setHelperTextColor(a1VarI.c(i30));
        }
        int i31 = l0.k.T3;
        if (a1VarI.s(i31)) {
            setHintTextColor(a1VarI.c(i31));
        }
        int i32 = l0.k.x3;
        if (a1VarI.s(i32)) {
            setCounterTextColor(a1VarI.c(i32));
        }
        int i33 = l0.k.v3;
        if (a1VarI.s(i33)) {
            setCounterOverflowTextColor(a1VarI.c(i33));
        }
        int i34 = l0.k.b4;
        if (a1VarI.s(i34)) {
            setPlaceholderTextColor(a1VarI.c(i34));
        }
        int i35 = l0.k.m4;
        if (a1VarI.s(i35)) {
            setSuffixTextColor(a1VarI.c(i35));
        }
        setEnabled(a1VarI.a(l0.k.a3, true));
        a1VarI.w();
        y.B0(this, 2);
        if (Build.VERSION.SDK_INT >= 26) {
            y.C0(this, 1);
        }
        frameLayout2.addView(checkableImageButton2);
        linearLayout.addView(d0Var);
        linearLayout.addView(checkableImageButton);
        linearLayout.addView(frameLayout2);
        frameLayout.addView(kVar);
        frameLayout.addView(linearLayout);
        addView(frameLayout);
        setHelperTextEnabled(z2);
        setErrorEnabled(zA);
        setCounterEnabled(zA3);
        setHelperText(charSequenceP2);
        setSuffixText(charSequenceP4);
    }

    public void setEndIconContentDescription(CharSequence charSequence) {
        if (getEndIconContentDescription() != charSequence) {
            this.f4202i0.setContentDescription(charSequence);
        }
    }

    public void setEndIconDrawable(Drawable drawable) {
        this.f4202i0.setImageDrawable(drawable);
        if (drawable != null) {
            com.google.android.material.textfield.f.a(this, this.f4202i0, this.f4206k0, this.f4208l0);
            U();
        }
    }

    public void setStartIconContentDescription(CharSequence charSequence) {
        this.f4195f.o(charSequence);
    }

    public void setStartIconDrawable(Drawable drawable) {
        this.f4195f.p(drawable);
    }

    public void setErrorIconDrawable(Drawable drawable) {
        this.f4220r0.setImageDrawable(drawable);
        u0();
        com.google.android.material.textfield.f.a(this, this.f4220r0, this.f4222s0, this.f4224t0);
    }

    @Deprecated
    public void setPasswordVisibilityToggleContentDescription(CharSequence charSequence) {
        this.f4202i0.setContentDescription(charSequence);
    }

    @Deprecated
    public void setPasswordVisibilityToggleDrawable(Drawable drawable) {
        this.f4202i0.setImageDrawable(drawable);
    }

    public void setHint(int i3) {
        setHint(i3 != 0 ? getResources().getText(i3) : null);
    }
}
