package com.google.android.material.textfield;

import android.R;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
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.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.AppCompatTextView;
import androidx.appcompat.widget.f0;
import androidx.appcompat.widget.v0;
import androidx.core.view.s0;
import androidx.core.view.u;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.material.internal.CheckableImageButton;
import com.google.android.material.internal.o;
import com.google.android.material.internal.q;
import java.util.Iterator;
import java.util.LinkedHashSet;
import lj.k;
import u5.p;
import vi.k;
import vi.l;

/* loaded from: classes3.dex */
public class TextInputLayout extends LinearLayout {
    private static final int X0 = k.f39900o;
    boolean A;
    private View.OnLongClickListener A0;
    private int B;
    private View.OnLongClickListener B0;
    private boolean C;
    private final CheckableImageButton C0;
    private TextView D;
    private ColorStateList D0;
    private int E;
    private PorterDuff.Mode E0;
    private int F;
    private ColorStateList F0;
    private CharSequence G;
    private ColorStateList G0;
    private boolean H;
    private int H0;
    private TextView I;
    private int I0;
    private ColorStateList J;
    private int J0;
    private int K;
    private ColorStateList K0;
    private u5.d L;
    private int L0;
    private u5.d M;
    private int M0;
    private ColorStateList N;
    private int N0;
    private ColorStateList O;
    private int O0;
    private CharSequence P;
    private int P0;
    private final TextView Q;
    private boolean Q0;
    private boolean R;
    final com.google.android.material.internal.b R0;
    private CharSequence S;
    private boolean S0;
    private boolean T;
    private boolean T0;
    private lj.g U;
    private ValueAnimator U0;
    private lj.g V;
    private boolean V0;
    private lj.g W;
    private boolean W0;

    /* renamed from: a0, reason: collision with root package name */
    private lj.k f13597a0;

    /* renamed from: b0, reason: collision with root package name */
    private boolean f13598b0;

    /* renamed from: c0, reason: collision with root package name */
    private final int f13599c0;

    /* renamed from: d0, reason: collision with root package name */
    private int f13600d0;

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

    /* renamed from: f0, reason: collision with root package name */
    private int f13602f0;

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

    /* renamed from: h0, reason: collision with root package name */
    private int f13604h0;

    /* renamed from: i0, reason: collision with root package name */
    private int f13605i0;

    /* renamed from: j0, reason: collision with root package name */
    private int f13606j0;

    /* renamed from: k0, reason: collision with root package name */
    private final Rect f13607k0;

    /* renamed from: l0, reason: collision with root package name */
    private final Rect f13608l0;

    /* renamed from: m0, reason: collision with root package name */
    private final RectF f13609m0;

    /* renamed from: n0, reason: collision with root package name */
    private Typeface f13610n0;

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

    /* renamed from: p, reason: collision with root package name */
    private final FrameLayout f13612p;

    /* renamed from: p0, reason: collision with root package name */
    private int f13613p0;

    /* renamed from: q, reason: collision with root package name */
    private final j f13614q;

    /* renamed from: q0, reason: collision with root package name */
    private final LinkedHashSet f13615q0;

    /* renamed from: r, reason: collision with root package name */
    private final LinearLayout f13616r;

    /* renamed from: r0, reason: collision with root package name */
    private int f13617r0;

    /* renamed from: s, reason: collision with root package name */
    private final FrameLayout f13618s;

    /* renamed from: s0, reason: collision with root package name */
    private final SparseArray f13619s0;

    /* renamed from: t, reason: collision with root package name */
    EditText f13620t;

    /* renamed from: t0, reason: collision with root package name */
    private final CheckableImageButton f13621t0;

    /* renamed from: u, reason: collision with root package name */
    private CharSequence f13622u;

    /* renamed from: u0, reason: collision with root package name */
    private final LinkedHashSet f13623u0;

    /* renamed from: v, reason: collision with root package name */
    private int f13624v;

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

    /* renamed from: w, reason: collision with root package name */
    private int f13626w;

    /* renamed from: w0, reason: collision with root package name */
    private PorterDuff.Mode f13627w0;

    /* renamed from: x, reason: collision with root package name */
    private int f13628x;

    /* renamed from: x0, reason: collision with root package name */
    private Drawable f13629x0;

    /* renamed from: y, reason: collision with root package name */
    private int f13630y;

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

    /* renamed from: z, reason: collision with root package name */
    private final com.google.android.material.textfield.g f13632z;

    /* renamed from: z0, reason: collision with root package name */
    private Drawable f13633z0;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public class a implements TextWatcher {
        a() {
        }

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

        @Override // android.text.TextWatcher
        public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
        }

        @Override // android.text.TextWatcher
        public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
        }
    }

    /* loaded from: classes3.dex */
    class b implements Runnable {
        b() {
        }

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

    /* loaded from: classes3.dex */
    class c implements Runnable {
        c() {
        }

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

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public class d implements ValueAnimator.AnimatorUpdateListener {
        d() {
        }

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

    /* loaded from: classes3.dex */
    public static class e extends androidx.core.view.a {

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

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

        @Override // androidx.core.view.a
        public void g(View view, t3.h hVar) {
            super.g(view, hVar);
            EditText editText = this.f13638d.getEditText();
            CharSequence text = editText != null ? editText.getText() : null;
            CharSequence hint = this.f13638d.getHint();
            CharSequence error = this.f13638d.getError();
            CharSequence placeholderText = this.f13638d.getPlaceholderText();
            int counterMaxLength = this.f13638d.getCounterMaxLength();
            CharSequence counterOverflowDescription = this.f13638d.getCounterOverflowDescription();
            boolean z10 = !TextUtils.isEmpty(text);
            boolean z11 = !TextUtils.isEmpty(hint);
            boolean z12 = !this.f13638d.N();
            boolean z13 = !TextUtils.isEmpty(error);
            boolean z14 = z13 || !TextUtils.isEmpty(counterOverflowDescription);
            String charSequence = z11 ? hint.toString() : "";
            this.f13638d.f13614q.v(hVar);
            if (z10) {
                hVar.M0(text);
            } else if (!TextUtils.isEmpty(charSequence)) {
                hVar.M0(charSequence);
                if (z12 && placeholderText != null) {
                    hVar.M0(charSequence + ", " + ((Object) placeholderText));
                }
            } else if (placeholderText != null) {
                hVar.M0(placeholderText);
            }
            if (!TextUtils.isEmpty(charSequence)) {
                hVar.t0(charSequence);
                hVar.J0(!z10);
            }
            if (text == null || text.length() != counterMaxLength) {
                counterMaxLength = -1;
            }
            hVar.x0(counterMaxLength);
            if (z14) {
                if (!z13) {
                    error = counterOverflowDescription;
                }
                hVar.p0(error);
            }
            View s10 = this.f13638d.f13632z.s();
            if (s10 != null) {
                hVar.v0(s10);
            }
        }
    }

    /* loaded from: classes3.dex */
    public interface f {
        void a(TextInputLayout textInputLayout);
    }

    /* loaded from: classes3.dex */
    public interface g {
        void a(TextInputLayout textInputLayout, int i10);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public static class h extends z3.a {
        public static final Parcelable.Creator<h> CREATOR = new a();

        /* renamed from: r, reason: collision with root package name */
        CharSequence f13639r;

        /* renamed from: s, reason: collision with root package name */
        boolean f13640s;

        /* renamed from: t, reason: collision with root package name */
        CharSequence f13641t;

        /* renamed from: u, reason: collision with root package name */
        CharSequence f13642u;

        /* renamed from: v, reason: collision with root package name */
        CharSequence f13643v;

        /* loaded from: classes3.dex */
        class a implements Parcelable.ClassLoaderCreator {
            a() {
            }

            @Override // android.os.Parcelable.Creator
            /* 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
            /* 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
            /* renamed from: c, reason: merged with bridge method [inline-methods] */
            public h[] newArray(int i10) {
                return new h[i10];
            }
        }

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

        public String toString() {
            return "TextInputLayout.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " error=" + ((Object) this.f13639r) + " hint=" + ((Object) this.f13641t) + " helperText=" + ((Object) this.f13642u) + " placeholderText=" + ((Object) this.f13643v) + "}";
        }

        @Override // z3.a, android.os.Parcelable
        public void writeToParcel(Parcel parcel, int i10) {
            super.writeToParcel(parcel, i10);
            TextUtils.writeToParcel(this.f13639r, parcel, i10);
            parcel.writeInt(this.f13640s ? 1 : 0);
            TextUtils.writeToParcel(this.f13641t, parcel, i10);
            TextUtils.writeToParcel(this.f13642u, parcel, i10);
            TextUtils.writeToParcel(this.f13643v, parcel, i10);
        }

        h(Parcel parcel, ClassLoader classLoader) {
            super(parcel, classLoader);
            this.f13639r = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.f13640s = parcel.readInt() == 1;
            this.f13641t = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.f13642u = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
            this.f13643v = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
        }
    }

    public TextInputLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, vi.b.T);
    }

    private boolean A() {
        return this.R && !TextUtils.isEmpty(this.S) && (this.U instanceof com.google.android.material.textfield.c);
    }

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

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

    private void B0(boolean z10, boolean z11) {
        int defaultColor = this.K0.getDefaultColor();
        int colorForState = this.K0.getColorForState(new int[]{R.attr.state_hovered, R.attr.state_enabled}, defaultColor);
        int colorForState2 = this.K0.getColorForState(new int[]{R.attr.state_activated, R.attr.state_enabled}, defaultColor);
        if (z10) {
            this.f13605i0 = colorForState2;
        } else if (z11) {
            this.f13605i0 = colorForState;
        } else {
            this.f13605i0 = defaultColor;
        }
    }

    private void C(int i10) {
        Iterator it = this.f13623u0.iterator();
        while (it.hasNext()) {
            ((g) it.next()).a(this, i10);
        }
    }

    private void C0() {
        if (this.f13620t == null) {
            return;
        }
        s0.B0(this.Q, getContext().getResources().getDimensionPixelSize(vi.d.E), this.f13620t.getPaddingTop(), (K() || L()) ? 0 : s0.D(this.f13620t), this.f13620t.getPaddingBottom());
    }

    private void D(Canvas canvas) {
        lj.g gVar;
        if (this.W == null || (gVar = this.V) == null) {
            return;
        }
        gVar.draw(canvas);
        if (this.f13620t.isFocused()) {
            Rect bounds = this.W.getBounds();
            Rect bounds2 = this.V.getBounds();
            float D = this.R0.D();
            int centerX = bounds2.centerX();
            bounds.left = wi.a.c(centerX, bounds2.left, D);
            bounds.right = wi.a.c(centerX, bounds2.right, D);
            this.W.draw(canvas);
        }
    }

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

    private void E(Canvas canvas) {
        if (this.R) {
            this.R0.l(canvas);
        }
    }

    private void F(boolean z10) {
        ValueAnimator valueAnimator = this.U0;
        if (valueAnimator != null && valueAnimator.isRunning()) {
            this.U0.cancel();
        }
        if (z10 && this.T0) {
            k(BitmapDescriptorFactory.HUE_RED);
        } else {
            this.R0.u0(BitmapDescriptorFactory.HUE_RED);
        }
        if (A() && ((com.google.android.material.textfield.c) this.U).h0()) {
            x();
        }
        this.Q0 = true;
        J();
        this.f13614q.i(true);
        D0();
    }

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

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

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

    private void J() {
        TextView textView = this.I;
        if (textView == null || !this.H) {
            return;
        }
        textView.setText((CharSequence) null);
        p.b(this.f13612p, this.M);
        this.I.setVisibility(4);
    }

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

    private boolean P() {
        return this.f13600d0 == 1 && this.f13620t.getMinLines() <= 1;
    }

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

    private void R() {
        if (A()) {
            RectF rectF = this.f13609m0;
            this.R0.o(rectF, this.f13620t.getWidth(), this.f13620t.getGravity());
            n(rectF);
            rectF.offset(-getPaddingLeft(), ((-getPaddingTop()) - (rectF.height() / 2.0f)) + this.f13602f0);
            ((com.google.android.material.textfield.c) this.U).k0(rectF);
        }
    }

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

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

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

    private void Z() {
        if (g0()) {
            s0.q0(this.f13620t, this.U);
        }
    }

    private static void a0(CheckableImageButton checkableImageButton, View.OnLongClickListener onLongClickListener) {
        boolean L = s0.L(checkableImageButton);
        boolean z10 = onLongClickListener != null;
        boolean z11 = L || z10;
        checkableImageButton.setFocusable(z11);
        checkableImageButton.setClickable(L);
        checkableImageButton.setPressable(L);
        checkableImageButton.setLongClickable(z10);
        s0.x0(checkableImageButton, z11 ? 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.C0.getVisibility() == 0 || ((I() && K()) || this.P != null)) && this.f13616r.getMeasuredWidth() > 0;
    }

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

    private boolean g0() {
        EditText editText = this.f13620t;
        return (editText == null || this.U == null || editText.getBackground() != null || this.f13600d0 == 0) ? false : true;
    }

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

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

    private void h0() {
        if (this.I == null || !this.H || TextUtils.isEmpty(this.G)) {
            return;
        }
        this.I.setText(this.G);
        p.b(this.f13612p, this.L);
        this.I.setVisibility(0);
        this.I.bringToFront();
        announceForAccessibility(this.G);
    }

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

    private void i0(boolean z10) {
        if (!z10 || getEndIconDrawable() == null) {
            com.google.android.material.textfield.f.a(this, this.f13621t0, this.f13625v0, this.f13627w0);
            return;
        }
        Drawable mutate = androidx.core.graphics.drawable.a.l(getEndIconDrawable()).mutate();
        androidx.core.graphics.drawable.a.h(mutate, this.f13632z.p());
        this.f13621t0.setImageDrawable(mutate);
    }

    private void j() {
        if (this.f13620t == null || this.f13600d0 != 1) {
            return;
        }
        if (ij.c.j(getContext())) {
            EditText editText = this.f13620t;
            s0.B0(editText, s0.E(editText), getResources().getDimensionPixelSize(vi.d.f39793y), s0.D(this.f13620t), getResources().getDimensionPixelSize(vi.d.f39792x));
        } else if (ij.c.i(getContext())) {
            EditText editText2 = this.f13620t;
            s0.B0(editText2, s0.E(editText2), getResources().getDimensionPixelSize(vi.d.f39791w), s0.D(this.f13620t), getResources().getDimensionPixelSize(vi.d.f39790v));
        }
    }

    private void j0() {
        if (this.f13600d0 == 1) {
            if (ij.c.j(getContext())) {
                this.f13601e0 = getResources().getDimensionPixelSize(vi.d.A);
            } else if (ij.c.i(getContext())) {
                this.f13601e0 = getResources().getDimensionPixelSize(vi.d.f39794z);
            }
        }
    }

    private void k0(Rect rect) {
        lj.g gVar = this.V;
        if (gVar != null) {
            int i10 = rect.bottom;
            gVar.setBounds(rect.left, i10 - this.f13603g0, rect.right, i10);
        }
        lj.g gVar2 = this.W;
        if (gVar2 != null) {
            int i11 = rect.bottom;
            gVar2.setBounds(rect.left, i11 - this.f13604h0, rect.right, i11);
        }
    }

    private void l() {
        lj.g gVar = this.U;
        if (gVar == null) {
            return;
        }
        lj.k C = gVar.C();
        lj.k kVar = this.f13597a0;
        if (C != kVar) {
            this.U.setShapeAppearanceModel(kVar);
            p0();
        }
        if (v()) {
            this.U.a0(this.f13602f0, this.f13605i0);
        }
        int p10 = p();
        this.f13606j0 = p10;
        this.U.W(ColorStateList.valueOf(p10));
        if (this.f13617r0 == 3) {
            this.f13620t.getBackground().invalidateSelf();
        }
        m();
        invalidate();
    }

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

    private void m() {
        if (this.V == null || this.W == null) {
            return;
        }
        if (w()) {
            this.V.W(this.f13620t.isFocused() ? ColorStateList.valueOf(this.H0) : ColorStateList.valueOf(this.f13605i0));
            this.W.W(ColorStateList.valueOf(this.f13605i0));
        }
        invalidate();
    }

    private void n(RectF rectF) {
        float f10 = rectF.left;
        int i10 = this.f13599c0;
        rectF.left = f10 - i10;
        rectF.right += i10;
    }

    private static void n0(Context context, TextView textView, int i10, int i11, boolean z10) {
        textView.setContentDescription(context.getString(z10 ? vi.j.f39862c : vi.j.f39861b, Integer.valueOf(i10), Integer.valueOf(i11)));
    }

    private void o() {
        int i10 = this.f13600d0;
        if (i10 == 0) {
            this.U = null;
            this.V = null;
            this.W = null;
            return;
        }
        if (i10 == 1) {
            this.U = new lj.g(this.f13597a0);
            this.V = new lj.g();
            this.W = new lj.g();
        } else {
            if (i10 != 2) {
                throw new IllegalArgumentException(this.f13600d0 + " is illegal; only @BoxBackgroundMode constants are supported.");
            }
            if (!this.R || (this.U instanceof com.google.android.material.textfield.c)) {
                this.U = new lj.g(this.f13597a0);
            } else {
                this.U = new com.google.android.material.textfield.c(this.f13597a0);
            }
            this.V = null;
            this.W = null;
        }
    }

    private void o0() {
        ColorStateList colorStateList;
        ColorStateList colorStateList2;
        TextView textView = this.D;
        if (textView != null) {
            d0(textView, this.C ? this.E : this.F);
            if (!this.C && (colorStateList2 = this.N) != null) {
                this.D.setTextColor(colorStateList2);
            }
            if (!this.C || (colorStateList = this.O) == null) {
                return;
            }
            this.D.setTextColor(colorStateList);
        }
    }

    private int p() {
        return this.f13600d0 == 1 ? aj.a.g(aj.a.e(this, vi.b.f39735q, 0), this.f13606j0) : this.f13606j0;
    }

    private void p0() {
        if (this.f13617r0 == 3 && this.f13600d0 == 2) {
            ((com.google.android.material.textfield.d) this.f13619s0.get(3)).O((AutoCompleteTextView) this.f13620t);
        }
    }

    private Rect q(Rect rect) {
        if (this.f13620t == null) {
            throw new IllegalStateException();
        }
        Rect rect2 = this.f13608l0;
        boolean e10 = q.e(this);
        rect2.bottom = rect.bottom;
        int i10 = this.f13600d0;
        if (i10 == 1) {
            rect2.left = G(rect.left, e10);
            rect2.top = rect.top + this.f13601e0;
            rect2.right = H(rect.right, e10);
            return rect2;
        }
        if (i10 != 2) {
            rect2.left = G(rect.left, e10);
            rect2.top = getPaddingTop();
            rect2.right = H(rect.right, e10);
            return rect2;
        }
        rect2.left = rect.left + this.f13620t.getPaddingLeft();
        rect2.top = rect.top - u();
        rect2.right = rect.right - this.f13620t.getPaddingRight();
        return rect2;
    }

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

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

    private boolean s0() {
        int max;
        if (this.f13620t == null || this.f13620t.getMeasuredHeight() >= (max = Math.max(this.f13616r.getMeasuredHeight(), this.f13614q.getMeasuredHeight()))) {
            return false;
        }
        this.f13620t.setMinimumHeight(max);
        return true;
    }

    private void setEditText(EditText editText) {
        if (this.f13620t != null) {
            throw new IllegalArgumentException("We already have an EditText, can only have one");
        }
        if (this.f13617r0 != 3 && !(editText instanceof TextInputEditText)) {
            Log.i("TextInputLayout", "EditText added is not a TextInputEditText. Please switch to using that class instead.");
        }
        this.f13620t = editText;
        int i10 = this.f13624v;
        if (i10 != -1) {
            setMinEms(i10);
        } else {
            setMinWidth(this.f13628x);
        }
        int i11 = this.f13626w;
        if (i11 != -1) {
            setMaxEms(i11);
        } else {
            setMaxWidth(this.f13630y);
        }
        Q();
        setTextInputAccessibilityDelegate(new e(this));
        this.R0.H0(this.f13620t.getTypeface());
        this.R0.r0(this.f13620t.getTextSize());
        this.R0.m0(this.f13620t.getLetterSpacing());
        int gravity = this.f13620t.getGravity();
        this.R0.g0((gravity & (-113)) | 48);
        this.R0.q0(gravity);
        this.f13620t.addTextChangedListener(new a());
        if (this.F0 == null) {
            this.F0 = this.f13620t.getHintTextColors();
        }
        if (this.R) {
            if (TextUtils.isEmpty(this.S)) {
                CharSequence hint = this.f13620t.getHint();
                this.f13622u = hint;
                setHint(hint);
                this.f13620t.setHint((CharSequence) null);
            }
            this.T = true;
        }
        if (this.D != null) {
            m0(this.f13620t.getText().length());
        }
        r0();
        this.f13632z.f();
        this.f13614q.bringToFront();
        this.f13616r.bringToFront();
        this.f13618s.bringToFront();
        this.C0.bringToFront();
        B();
        C0();
        if (!isEnabled()) {
            editText.setEnabled(false);
        }
        x0(false, true);
    }

    private void setHintInternal(CharSequence charSequence) {
        if (TextUtils.equals(charSequence, this.S)) {
            return;
        }
        this.S = charSequence;
        this.R0.F0(charSequence);
        if (this.Q0) {
            return;
        }
        R();
    }

    private void setPlaceholderTextEnabled(boolean z10) {
        if (this.H == z10) {
            return;
        }
        if (z10) {
            i();
        } else {
            X();
            this.I = null;
        }
        this.H = z10;
    }

    private Rect t(Rect rect) {
        if (this.f13620t == null) {
            throw new IllegalStateException();
        }
        Rect rect2 = this.f13608l0;
        float B = this.R0.B();
        rect2.left = rect.left + this.f13620t.getCompoundPaddingLeft();
        rect2.top = s(rect, B);
        rect2.right = rect.right - this.f13620t.getCompoundPaddingRight();
        rect2.bottom = r(rect, rect2, B);
        return rect2;
    }

    private void t0() {
        this.f13618s.setVisibility((this.f13621t0.getVisibility() != 0 || L()) ? 8 : 0);
        this.f13616r.setVisibility(K() || L() || !((this.P == null || N()) ? 8 : false) ? 0 : 8);
    }

    private int u() {
        float r10;
        if (!this.R) {
            return 0;
        }
        int i10 = this.f13600d0;
        if (i10 == 0) {
            r10 = this.R0.r();
        } else {
            if (i10 != 2) {
                return 0;
            }
            r10 = this.R0.r() / 2.0f;
        }
        return (int) r10;
    }

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

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

    private void v0() {
        if (this.f13600d0 != 1) {
            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.f13612p.getLayoutParams();
            int u10 = u();
            if (u10 != layoutParams.topMargin) {
                layoutParams.topMargin = u10;
                this.f13612p.requestLayout();
            }
        }
    }

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

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

    private void x0(boolean z10, boolean z11) {
        ColorStateList colorStateList;
        TextView textView;
        boolean isEnabled = isEnabled();
        EditText editText = this.f13620t;
        boolean z12 = (editText == null || TextUtils.isEmpty(editText.getText())) ? false : true;
        EditText editText2 = this.f13620t;
        boolean z13 = editText2 != null && editText2.hasFocus();
        boolean l10 = this.f13632z.l();
        ColorStateList colorStateList2 = this.F0;
        if (colorStateList2 != null) {
            this.R0.f0(colorStateList2);
            this.R0.p0(this.F0);
        }
        if (!isEnabled) {
            ColorStateList colorStateList3 = this.F0;
            int colorForState = colorStateList3 != null ? colorStateList3.getColorForState(new int[]{-16842910}, this.P0) : this.P0;
            this.R0.f0(ColorStateList.valueOf(colorForState));
            this.R0.p0(ColorStateList.valueOf(colorForState));
        } else if (l10) {
            this.R0.f0(this.f13632z.q());
        } else if (this.C && (textView = this.D) != null) {
            this.R0.f0(textView.getTextColors());
        } else if (z13 && (colorStateList = this.G0) != null) {
            this.R0.f0(colorStateList);
        }
        if (z12 || !this.S0 || (isEnabled() && z13)) {
            if (z11 || this.Q0) {
                y(z10);
                return;
            }
            return;
        }
        if (z11 || !this.Q0) {
            F(z10);
        }
    }

    private void y(boolean z10) {
        ValueAnimator valueAnimator = this.U0;
        if (valueAnimator != null && valueAnimator.isRunning()) {
            this.U0.cancel();
        }
        if (z10 && this.T0) {
            k(1.0f);
        } else {
            this.R0.u0(1.0f);
        }
        this.Q0 = false;
        if (A()) {
            R();
        }
        z0();
        this.f13614q.i(false);
        D0();
    }

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

    private u5.d z() {
        u5.d dVar = new u5.d();
        dVar.b0(87L);
        dVar.d0(wi.a.f49477a);
        return dVar;
    }

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

    /* JADX INFO: Access modifiers changed from: package-private */
    public void E0() {
        TextView textView;
        EditText editText;
        EditText editText2;
        if (this.U == null || this.f13600d0 == 0) {
            return;
        }
        boolean z10 = false;
        boolean z11 = isFocused() || ((editText2 = this.f13620t) != null && editText2.hasFocus());
        if (isHovered() || ((editText = this.f13620t) != null && editText.isHovered())) {
            z10 = true;
        }
        if (!isEnabled()) {
            this.f13605i0 = this.P0;
        } else if (this.f13632z.l()) {
            if (this.K0 != null) {
                B0(z11, z10);
            } else {
                this.f13605i0 = this.f13632z.p();
            }
        } else if (!this.C || (textView = this.D) == null) {
            if (z11) {
                this.f13605i0 = this.J0;
            } else if (z10) {
                this.f13605i0 = this.I0;
            } else {
                this.f13605i0 = this.H0;
            }
        } else if (this.K0 != null) {
            B0(z11, z10);
        } else {
            this.f13605i0 = textView.getCurrentTextColor();
        }
        u0();
        V();
        W();
        U();
        if (getEndIconDelegate().d()) {
            i0(this.f13632z.l());
        }
        if (this.f13600d0 == 2) {
            int i10 = this.f13602f0;
            if (z11 && isEnabled()) {
                this.f13602f0 = this.f13604h0;
            } else {
                this.f13602f0 = this.f13603g0;
            }
            if (this.f13602f0 != i10) {
                S();
            }
        }
        if (this.f13600d0 == 1) {
            if (!isEnabled()) {
                this.f13606j0 = this.M0;
            } else if (z10 && !z11) {
                this.f13606j0 = this.O0;
            } else if (z11) {
                this.f13606j0 = this.N0;
            } else {
                this.f13606j0 = this.L0;
            }
        }
        l();
    }

    public boolean K() {
        return this.f13618s.getVisibility() == 0 && this.f13621t0.getVisibility() == 0;
    }

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

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

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

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

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

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

    public void Y(float f10, float f11, float f12, float f13) {
        boolean e10 = q.e(this);
        this.f13598b0 = e10;
        float f14 = e10 ? f11 : f10;
        if (!e10) {
            f10 = f11;
        }
        float f15 = e10 ? f13 : f12;
        if (!e10) {
            f12 = f13;
        }
        lj.g gVar = this.U;
        if (gVar != null && gVar.E() == f14 && this.U.F() == f10 && this.U.s() == f15 && this.U.t() == f12) {
            return;
        }
        this.f13597a0 = this.f13597a0.v().A(f14).E(f10).s(f15).w(f12).m();
        l();
    }

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

    /* JADX INFO: Access modifiers changed from: package-private */
    public void d0(TextView textView, int i10) {
        boolean z10 = true;
        try {
            androidx.core.widget.j.n(textView, i10);
            if (textView.getTextColors().getDefaultColor() != -65281) {
                z10 = false;
            }
        } catch (Exception unused) {
        }
        if (z10) {
            androidx.core.widget.j.n(textView, k.f39887b);
            textView.setTextColor(androidx.core.content.a.getColor(getContext(), vi.c.f39746b));
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    public void dispatchProvideAutofillStructure(ViewStructure viewStructure, int i10) {
        EditText editText = this.f13620t;
        if (editText == null) {
            super.dispatchProvideAutofillStructure(viewStructure, i10);
            return;
        }
        if (this.f13622u != null) {
            boolean z10 = this.T;
            this.T = false;
            CharSequence hint = editText.getHint();
            this.f13620t.setHint(this.f13622u);
            try {
                super.dispatchProvideAutofillStructure(viewStructure, i10);
                return;
            } finally {
                this.f13620t.setHint(hint);
                this.T = z10;
            }
        }
        viewStructure.setAutofillId(getAutofillId());
        onProvideAutofillStructure(viewStructure, i10);
        onProvideAutofillVirtualStructure(viewStructure, i10);
        viewStructure.setChildCount(this.f13612p.getChildCount());
        for (int i11 = 0; i11 < this.f13612p.getChildCount(); i11++) {
            View childAt = this.f13612p.getChildAt(i11);
            ViewStructure newChild = viewStructure.newChild(i11);
            childAt.dispatchProvideAutofillStructure(newChild, i10);
            if (childAt == this.f13620t) {
                newChild.setHint(getHint());
            }
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    protected void dispatchRestoreInstanceState(SparseArray sparseArray) {
        this.W0 = true;
        super.dispatchRestoreInstanceState(sparseArray);
        this.W0 = 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.V0) {
            return;
        }
        this.V0 = true;
        super.drawableStateChanged();
        int[] drawableState = getDrawableState();
        com.google.android.material.internal.b bVar = this.R0;
        boolean E0 = bVar != null ? bVar.E0(drawableState) | false : false;
        if (this.f13620t != null) {
            w0(s0.Q(this) && isEnabled());
        }
        r0();
        E0();
        if (E0) {
            invalidate();
        }
        this.V0 = false;
    }

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

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

    /* JADX INFO: Access modifiers changed from: package-private */
    public lj.g getBoxBackground() {
        int i10 = this.f13600d0;
        if (i10 == 1 || i10 == 2) {
            return this.U;
        }
        throw new IllegalStateException();
    }

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

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

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

    public float getBoxCornerRadiusBottomEnd() {
        return q.e(this) ? this.f13597a0.j().a(this.f13609m0) : this.f13597a0.l().a(this.f13609m0);
    }

    public float getBoxCornerRadiusBottomStart() {
        return q.e(this) ? this.f13597a0.l().a(this.f13609m0) : this.f13597a0.j().a(this.f13609m0);
    }

    public float getBoxCornerRadiusTopEnd() {
        return q.e(this) ? this.f13597a0.r().a(this.f13609m0) : this.f13597a0.t().a(this.f13609m0);
    }

    public float getBoxCornerRadiusTopStart() {
        return q.e(this) ? this.f13597a0.t().a(this.f13609m0) : this.f13597a0.r().a(this.f13609m0);
    }

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

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

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

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

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

    CharSequence getCounterOverflowDescription() {
        TextView textView;
        if (this.A && this.C && (textView = this.D) != null) {
            return textView.getContentDescription();
        }
        return null;
    }

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

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

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

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

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

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

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

    /* JADX INFO: Access modifiers changed from: package-private */
    public CheckableImageButton getEndIconView() {
        return this.f13621t0;
    }

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

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

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

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

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

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

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

    public CharSequence getHint() {
        if (this.R) {
            return this.S;
        }
        return null;
    }

    final float getHintCollapsedTextHeight() {
        return this.R0.r();
    }

    final int getHintCurrentCollapsedTextColor() {
        return this.R0.v();
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    void k(float f10) {
        if (this.R0.D() == f10) {
            return;
        }
        if (this.U0 == null) {
            ValueAnimator valueAnimator = new ValueAnimator();
            this.U0 = valueAnimator;
            valueAnimator.setInterpolator(wi.a.f49478b);
            this.U0.setDuration(167L);
            this.U0.addUpdateListener(new d());
        }
        this.U0.setFloatValues(this.R0.D(), f10);
        this.U0.start();
    }

    void m0(int i10) {
        boolean z10 = this.C;
        int i11 = this.B;
        if (i11 == -1) {
            this.D.setText(String.valueOf(i10));
            this.D.setContentDescription(null);
            this.C = false;
        } else {
            this.C = i10 > i11;
            n0(getContext(), this.D, i10, this.B, this.C);
            if (z10 != this.C) {
                o0();
            }
            this.D.setText(androidx.core.text.a.c().j(getContext().getString(vi.j.f39863d, Integer.valueOf(i10), Integer.valueOf(this.B))));
        }
        if (this.f13620t == null || z10 == this.C) {
            return;
        }
        w0(false);
        E0();
        r0();
    }

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

    @Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
    protected void onLayout(boolean z10, int i10, int i11, int i12, int i13) {
        super.onLayout(z10, i10, i11, i12, i13);
        EditText editText = this.f13620t;
        if (editText != null) {
            Rect rect = this.f13607k0;
            com.google.android.material.internal.c.a(this, editText, rect);
            k0(rect);
            if (this.R) {
                this.R0.r0(this.f13620t.getTextSize());
                int gravity = this.f13620t.getGravity();
                this.R0.g0((gravity & (-113)) | 48);
                this.R0.q0(gravity);
                this.R0.c0(q(rect));
                this.R0.l0(t(rect));
                this.R0.Y();
                if (!A() || this.Q0) {
                    return;
                }
                R();
            }
        }
    }

    @Override // android.widget.LinearLayout, android.view.View
    protected void onMeasure(int i10, int i11) {
        super.onMeasure(i10, i11);
        boolean s02 = s0();
        boolean q02 = q0();
        if (s02 || q02) {
            this.f13620t.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.a());
        setError(hVar.f13639r);
        if (hVar.f13640s) {
            this.f13621t0.post(new b());
        }
        setHint(hVar.f13641t);
        setHelperText(hVar.f13642u);
        setPlaceholderText(hVar.f13643v);
        requestLayout();
    }

    @Override // android.widget.LinearLayout, android.view.View
    public void onRtlPropertiesChanged(int i10) {
        super.onRtlPropertiesChanged(i10);
        boolean z10 = false;
        boolean z11 = i10 == 1;
        boolean z12 = this.f13598b0;
        if (z11 != z12) {
            if (z11 && !z12) {
                z10 = true;
            }
            float a10 = this.f13597a0.r().a(this.f13609m0);
            float a11 = this.f13597a0.t().a(this.f13609m0);
            float a12 = this.f13597a0.j().a(this.f13609m0);
            float a13 = this.f13597a0.l().a(this.f13609m0);
            float f10 = z10 ? a10 : a11;
            if (z10) {
                a10 = a11;
            }
            float f11 = z10 ? a12 : a13;
            if (z10) {
                a12 = a13;
            }
            Y(f10, a10, f11, a12);
        }
    }

    @Override // android.view.View
    public Parcelable onSaveInstanceState() {
        h hVar = new h(super.onSaveInstanceState());
        if (this.f13632z.l()) {
            hVar.f13639r = getError();
        }
        hVar.f13640s = I() && this.f13621t0.isChecked();
        hVar.f13641t = getHint();
        hVar.f13642u = getHelperText();
        hVar.f13643v = getPlaceholderText();
        return hVar;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public boolean q0() {
        boolean z10;
        if (this.f13620t == null) {
            return false;
        }
        boolean z11 = true;
        if (f0()) {
            int measuredWidth = this.f13614q.getMeasuredWidth() - this.f13620t.getPaddingLeft();
            if (this.f13611o0 == null || this.f13613p0 != measuredWidth) {
                ColorDrawable colorDrawable = new ColorDrawable();
                this.f13611o0 = colorDrawable;
                this.f13613p0 = measuredWidth;
                colorDrawable.setBounds(0, 0, measuredWidth, 1);
            }
            Drawable[] a10 = androidx.core.widget.j.a(this.f13620t);
            Drawable drawable = a10[0];
            Drawable drawable2 = this.f13611o0;
            if (drawable != drawable2) {
                androidx.core.widget.j.i(this.f13620t, drawable2, a10[1], a10[2], a10[3]);
                z10 = true;
            }
            z10 = false;
        } else {
            if (this.f13611o0 != null) {
                Drawable[] a11 = androidx.core.widget.j.a(this.f13620t);
                androidx.core.widget.j.i(this.f13620t, null, a11[1], a11[2], a11[3]);
                this.f13611o0 = null;
                z10 = true;
            }
            z10 = false;
        }
        if (e0()) {
            int measuredWidth2 = this.Q.getMeasuredWidth() - this.f13620t.getPaddingRight();
            CheckableImageButton endIconToUpdateDummyDrawable = getEndIconToUpdateDummyDrawable();
            if (endIconToUpdateDummyDrawable != null) {
                measuredWidth2 = measuredWidth2 + endIconToUpdateDummyDrawable.getMeasuredWidth() + u.b((ViewGroup.MarginLayoutParams) endIconToUpdateDummyDrawable.getLayoutParams());
            }
            Drawable[] a12 = androidx.core.widget.j.a(this.f13620t);
            Drawable drawable3 = this.f13629x0;
            if (drawable3 == null || this.f13631y0 == measuredWidth2) {
                if (drawable3 == null) {
                    ColorDrawable colorDrawable2 = new ColorDrawable();
                    this.f13629x0 = colorDrawable2;
                    this.f13631y0 = measuredWidth2;
                    colorDrawable2.setBounds(0, 0, measuredWidth2, 1);
                }
                Drawable drawable4 = a12[2];
                Drawable drawable5 = this.f13629x0;
                if (drawable4 != drawable5) {
                    this.f13633z0 = drawable4;
                    androidx.core.widget.j.i(this.f13620t, a12[0], a12[1], drawable5, a12[3]);
                } else {
                    z11 = z10;
                }
            } else {
                this.f13631y0 = measuredWidth2;
                drawable3.setBounds(0, 0, measuredWidth2, 1);
                androidx.core.widget.j.i(this.f13620t, a12[0], a12[1], this.f13629x0, a12[3]);
            }
        } else {
            if (this.f13629x0 == null) {
                return z10;
            }
            Drawable[] a13 = androidx.core.widget.j.a(this.f13620t);
            if (a13[2] == this.f13629x0) {
                androidx.core.widget.j.i(this.f13620t, a13[0], a13[1], this.f13633z0, a13[3]);
            } else {
                z11 = z10;
            }
            this.f13629x0 = null;
        }
        return z11;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void r0() {
        Drawable background;
        TextView textView;
        EditText editText = this.f13620t;
        if (editText == null || this.f13600d0 != 0 || (background = editText.getBackground()) == null) {
            return;
        }
        if (f0.a(background)) {
            background = background.mutate();
        }
        if (this.f13632z.l()) {
            background.setColorFilter(androidx.appcompat.widget.j.e(this.f13632z.p(), PorterDuff.Mode.SRC_IN));
        } else if (this.C && (textView = this.D) != null) {
            background.setColorFilter(androidx.appcompat.widget.j.e(textView.getCurrentTextColor(), PorterDuff.Mode.SRC_IN));
        } else {
            androidx.core.graphics.drawable.a.a(background);
            this.f13620t.refreshDrawableState();
        }
    }

    public void setBoxBackgroundColor(int i10) {
        if (this.f13606j0 != i10) {
            this.f13606j0 = i10;
            this.L0 = i10;
            this.N0 = i10;
            this.O0 = i10;
            l();
        }
    }

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

    public void setBoxBackgroundColorStateList(ColorStateList colorStateList) {
        int defaultColor = colorStateList.getDefaultColor();
        this.L0 = defaultColor;
        this.f13606j0 = defaultColor;
        this.M0 = colorStateList.getColorForState(new int[]{-16842910}, -1);
        this.N0 = colorStateList.getColorForState(new int[]{R.attr.state_focused, R.attr.state_enabled}, -1);
        this.O0 = colorStateList.getColorForState(new int[]{R.attr.state_hovered, R.attr.state_enabled}, -1);
        l();
    }

    public void setBoxBackgroundMode(int i10) {
        if (i10 == this.f13600d0) {
            return;
        }
        this.f13600d0 = i10;
        if (this.f13620t != null) {
            Q();
        }
    }

    public void setBoxCollapsedPaddingTop(int i10) {
        this.f13601e0 = i10;
    }

    public void setBoxStrokeColor(int i10) {
        if (this.J0 != i10) {
            this.J0 = i10;
            E0();
        }
    }

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

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

    public void setBoxStrokeWidth(int i10) {
        this.f13603g0 = i10;
        E0();
    }

    public void setBoxStrokeWidthFocused(int i10) {
        this.f13604h0 = i10;
        E0();
    }

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

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

    public void setCounterEnabled(boolean z10) {
        if (this.A != z10) {
            if (z10) {
                AppCompatTextView appCompatTextView = new AppCompatTextView(getContext());
                this.D = appCompatTextView;
                appCompatTextView.setId(vi.f.T);
                Typeface typeface = this.f13610n0;
                if (typeface != null) {
                    this.D.setTypeface(typeface);
                }
                this.D.setMaxLines(1);
                this.f13632z.e(this.D, 2);
                u.d((ViewGroup.MarginLayoutParams) this.D.getLayoutParams(), getResources().getDimensionPixelOffset(vi.d.f39781m0));
                o0();
                l0();
            } else {
                this.f13632z.B(this.D, 2);
                this.D = null;
            }
            this.A = z10;
        }
    }

    public void setCounterMaxLength(int i10) {
        if (this.B != i10) {
            if (i10 > 0) {
                this.B = i10;
            } else {
                this.B = -1;
            }
            if (this.A) {
                l0();
            }
        }
    }

    public void setCounterOverflowTextAppearance(int i10) {
        if (this.E != i10) {
            this.E = i10;
            o0();
        }
    }

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

    public void setCounterTextAppearance(int i10) {
        if (this.F != i10) {
            this.F = i10;
            o0();
        }
    }

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

    public void setDefaultHintTextColor(ColorStateList colorStateList) {
        this.F0 = colorStateList;
        this.G0 = colorStateList;
        if (this.f13620t != null) {
            w0(false);
        }
    }

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

    public void setEndIconActivated(boolean z10) {
        this.f13621t0.setActivated(z10);
    }

    public void setEndIconCheckable(boolean z10) {
        this.f13621t0.setCheckable(z10);
    }

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

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

    public void setEndIconMode(int i10) {
        int i11 = this.f13617r0;
        if (i11 == i10) {
            return;
        }
        this.f13617r0 = i10;
        C(i11);
        setEndIconVisible(i10 != 0);
        if (getEndIconDelegate().b(this.f13600d0)) {
            getEndIconDelegate().a();
            com.google.android.material.textfield.f.a(this, this.f13621t0, this.f13625v0, this.f13627w0);
            return;
        }
        throw new IllegalStateException("The current box background mode " + this.f13600d0 + " is not supported by the end icon mode " + i10);
    }

    public void setEndIconOnClickListener(View.OnClickListener onClickListener) {
        b0(this.f13621t0, onClickListener, this.A0);
    }

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

    public void setEndIconTintList(ColorStateList colorStateList) {
        if (this.f13625v0 != colorStateList) {
            this.f13625v0 = colorStateList;
            com.google.android.material.textfield.f.a(this, this.f13621t0, colorStateList, this.f13627w0);
        }
    }

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

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

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

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

    public void setErrorEnabled(boolean z10) {
        this.f13632z.E(z10);
    }

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

    public void setErrorIconOnClickListener(View.OnClickListener onClickListener) {
        b0(this.C0, onClickListener, this.B0);
    }

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

    public void setErrorIconTintList(ColorStateList colorStateList) {
        if (this.D0 != colorStateList) {
            this.D0 = colorStateList;
            com.google.android.material.textfield.f.a(this, this.C0, colorStateList, this.E0);
        }
    }

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

    public void setErrorTextAppearance(int i10) {
        this.f13632z.F(i10);
    }

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

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

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

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

    public void setHelperTextEnabled(boolean z10) {
        this.f13632z.I(z10);
    }

    public void setHelperTextTextAppearance(int i10) {
        this.f13632z.H(i10);
    }

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

    public void setHintAnimationEnabled(boolean z10) {
        this.T0 = z10;
    }

    public void setHintEnabled(boolean z10) {
        if (z10 != this.R) {
            this.R = z10;
            if (z10) {
                CharSequence hint = this.f13620t.getHint();
                if (!TextUtils.isEmpty(hint)) {
                    if (TextUtils.isEmpty(this.S)) {
                        setHint(hint);
                    }
                    this.f13620t.setHint((CharSequence) null);
                }
                this.T = true;
            } else {
                this.T = false;
                if (!TextUtils.isEmpty(this.S) && TextUtils.isEmpty(this.f13620t.getHint())) {
                    this.f13620t.setHint(this.S);
                }
                setHintInternal(null);
            }
            if (this.f13620t != null) {
                v0();
            }
        }
    }

    public void setHintTextAppearance(int i10) {
        this.R0.d0(i10);
        this.G0 = this.R0.p();
        if (this.f13620t != null) {
            w0(false);
            v0();
        }
    }

    public void setHintTextColor(ColorStateList colorStateList) {
        if (this.G0 != colorStateList) {
            if (this.F0 == null) {
                this.R0.f0(colorStateList);
            }
            this.G0 = colorStateList;
            if (this.f13620t != null) {
                w0(false);
            }
        }
    }

    public void setMaxEms(int i10) {
        this.f13626w = i10;
        EditText editText = this.f13620t;
        if (editText == null || i10 == -1) {
            return;
        }
        editText.setMaxEms(i10);
    }

    public void setMaxWidth(int i10) {
        this.f13630y = i10;
        EditText editText = this.f13620t;
        if (editText == null || i10 == -1) {
            return;
        }
        editText.setMaxWidth(i10);
    }

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

    public void setMinEms(int i10) {
        this.f13624v = i10;
        EditText editText = this.f13620t;
        if (editText == null || i10 == -1) {
            return;
        }
        editText.setMinEms(i10);
    }

    public void setMinWidth(int i10) {
        this.f13628x = i10;
        EditText editText = this.f13620t;
        if (editText == null || i10 == -1) {
            return;
        }
        editText.setMinWidth(i10);
    }

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

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

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

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

    @Deprecated
    public void setPasswordVisibilityToggleTintList(ColorStateList colorStateList) {
        this.f13625v0 = colorStateList;
        com.google.android.material.textfield.f.a(this, this.f13621t0, colorStateList, this.f13627w0);
    }

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

    public void setPlaceholderText(CharSequence charSequence) {
        if (this.I == null) {
            AppCompatTextView appCompatTextView = new AppCompatTextView(getContext());
            this.I = appCompatTextView;
            appCompatTextView.setId(vi.f.W);
            s0.x0(this.I, 2);
            u5.d z10 = z();
            this.L = z10;
            z10.h0(67L);
            this.M = z();
            setPlaceholderTextAppearance(this.K);
            setPlaceholderTextColor(this.J);
        }
        if (TextUtils.isEmpty(charSequence)) {
            setPlaceholderTextEnabled(false);
        } else {
            if (!this.H) {
                setPlaceholderTextEnabled(true);
            }
            this.G = charSequence;
        }
        z0();
    }

    public void setPlaceholderTextAppearance(int i10) {
        this.K = i10;
        TextView textView = this.I;
        if (textView != null) {
            androidx.core.widget.j.n(textView, i10);
        }
    }

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

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

    public void setPrefixTextAppearance(int i10) {
        this.f13614q.l(i10);
    }

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

    public void setStartIconCheckable(boolean z10) {
        this.f13614q.n(z10);
    }

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

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

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

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

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

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

    public void setStartIconVisible(boolean z10) {
        this.f13614q.u(z10);
    }

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

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

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

    public void setTextInputAccessibilityDelegate(e eVar) {
        EditText editText = this.f13620t;
        if (editText != null) {
            s0.m0(editText, eVar);
        }
    }

    public void setTypeface(Typeface typeface) {
        if (typeface != this.f13610n0) {
            this.f13610n0 = typeface;
            this.R0.H0(typeface);
            this.f13632z.L(typeface);
            TextView textView = this.D;
            if (textView != null) {
                textView.setTypeface(typeface);
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void w0(boolean z10) {
        x0(z10, false);
    }

    /* JADX WARN: Illegal instructions before constructor call */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r3v50 */
    /* JADX WARN: Type inference failed for: r3v51, types: [boolean, int] */
    /* JADX WARN: Type inference failed for: r3v82 */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public TextInputLayout(Context context, AttributeSet attributeSet, int i10) {
        super(nj.a.c(context, attributeSet, i10, r9), attributeSet, i10);
        int i11;
        ?? r32;
        boolean z10;
        int i12;
        int i13 = X0;
        this.f13624v = -1;
        this.f13626w = -1;
        this.f13628x = -1;
        this.f13630y = -1;
        this.f13632z = new com.google.android.material.textfield.g(this);
        this.f13607k0 = new Rect();
        this.f13608l0 = new Rect();
        this.f13609m0 = new RectF();
        this.f13615q0 = new LinkedHashSet();
        this.f13617r0 = 0;
        SparseArray sparseArray = new SparseArray();
        this.f13619s0 = sparseArray;
        this.f13623u0 = new LinkedHashSet();
        com.google.android.material.internal.b bVar = new com.google.android.material.internal.b(this);
        this.R0 = bVar;
        Context context2 = getContext();
        setOrientation(1);
        setWillNotDraw(false);
        setAddStatesFromChildren(true);
        FrameLayout frameLayout = new FrameLayout(context2);
        this.f13612p = frameLayout;
        FrameLayout frameLayout2 = new FrameLayout(context2);
        this.f13618s = frameLayout2;
        LinearLayout linearLayout = new LinearLayout(context2);
        this.f13616r = linearLayout;
        AppCompatTextView appCompatTextView = new AppCompatTextView(context2);
        this.Q = appCompatTextView;
        linearLayout.setVisibility(8);
        frameLayout2.setVisibility(8);
        appCompatTextView.setVisibility(8);
        LayoutInflater from = LayoutInflater.from(context2);
        int i14 = vi.h.f39840h;
        CheckableImageButton checkableImageButton = (CheckableImageButton) from.inflate(i14, (ViewGroup) linearLayout, false);
        this.C0 = checkableImageButton;
        CheckableImageButton checkableImageButton2 = (CheckableImageButton) from.inflate(i14, (ViewGroup) frameLayout2, false);
        this.f13621t0 = checkableImageButton2;
        frameLayout.setAddStatesFromChildren(true);
        linearLayout.setOrientation(0);
        linearLayout.setLayoutParams(new FrameLayout.LayoutParams(-2, -1, 8388613));
        frameLayout2.setLayoutParams(new FrameLayout.LayoutParams(-2, -1));
        TimeInterpolator timeInterpolator = wi.a.f49477a;
        bVar.G0(timeInterpolator);
        bVar.C0(timeInterpolator);
        bVar.g0(8388659);
        int[] iArr = l.f39950d7;
        int i15 = l.A7;
        int i16 = l.f40160y7;
        int i17 = l.N7;
        int i18 = l.S7;
        int i19 = l.W7;
        v0 i20 = o.i(context2, attributeSet, iArr, i10, i13, i15, i16, i17, i18, i19);
        j jVar = new j(this, i20);
        this.f13614q = jVar;
        this.R = i20.a(l.V7, true);
        setHint(i20.p(l.f40000i7));
        this.T0 = i20.a(l.U7, true);
        this.S0 = i20.a(l.P7, true);
        int i21 = l.f40020k7;
        if (i20.s(i21)) {
            i11 = -1;
            setMinEms(i20.k(i21, -1));
        } else {
            i11 = -1;
            int i22 = l.f39990h7;
            if (i20.s(i22)) {
                setMinWidth(i20.f(i22, -1));
            }
        }
        int i23 = l.f40010j7;
        if (i20.s(i23)) {
            setMaxEms(i20.k(i23, i11));
        } else {
            int i24 = l.f39980g7;
            if (i20.s(i24)) {
                setMaxWidth(i20.f(i24, i11));
            }
        }
        this.f13597a0 = lj.k.e(context2, attributeSet, i10, i13).m();
        this.f13599c0 = context2.getResources().getDimensionPixelOffset(vi.d.f39775j0);
        this.f13601e0 = i20.e(l.f40050n7, 0);
        this.f13603g0 = i20.f(l.f40120u7, context2.getResources().getDimensionPixelSize(vi.d.f39777k0));
        this.f13604h0 = i20.f(l.f40130v7, context2.getResources().getDimensionPixelSize(vi.d.f39779l0));
        this.f13602f0 = this.f13603g0;
        float d10 = i20.d(l.f40090r7, -1.0f);
        float d11 = i20.d(l.f40080q7, -1.0f);
        float d12 = i20.d(l.f40060o7, -1.0f);
        float d13 = i20.d(l.f40070p7, -1.0f);
        k.b v10 = this.f13597a0.v();
        if (d10 >= BitmapDescriptorFactory.HUE_RED) {
            v10.A(d10);
        }
        if (d11 >= BitmapDescriptorFactory.HUE_RED) {
            v10.E(d11);
        }
        if (d12 >= BitmapDescriptorFactory.HUE_RED) {
            v10.w(d12);
        }
        if (d13 >= BitmapDescriptorFactory.HUE_RED) {
            v10.s(d13);
        }
        this.f13597a0 = v10.m();
        ColorStateList b10 = ij.c.b(context2, i20, l.f40030l7);
        if (b10 != null) {
            int defaultColor = b10.getDefaultColor();
            this.L0 = defaultColor;
            this.f13606j0 = defaultColor;
            if (b10.isStateful()) {
                this.M0 = b10.getColorForState(new int[]{-16842910}, -1);
                this.N0 = b10.getColorForState(new int[]{R.attr.state_focused, R.attr.state_enabled}, -1);
                this.O0 = b10.getColorForState(new int[]{R.attr.state_hovered, R.attr.state_enabled}, -1);
            } else {
                this.N0 = this.L0;
                ColorStateList a10 = j.a.a(context2, vi.c.f39752h);
                this.M0 = a10.getColorForState(new int[]{-16842910}, -1);
                this.O0 = a10.getColorForState(new int[]{R.attr.state_hovered}, -1);
            }
        } else {
            this.f13606j0 = 0;
            this.L0 = 0;
            this.M0 = 0;
            this.N0 = 0;
            this.O0 = 0;
        }
        int i25 = l.f39970f7;
        if (i20.s(i25)) {
            ColorStateList c10 = i20.c(i25);
            this.G0 = c10;
            this.F0 = c10;
        }
        int i26 = l.f40100s7;
        ColorStateList b11 = ij.c.b(context2, i20, i26);
        this.J0 = i20.b(i26, 0);
        this.H0 = androidx.core.content.a.getColor(context2, vi.c.f39753i);
        this.P0 = androidx.core.content.a.getColor(context2, vi.c.f39754j);
        this.I0 = androidx.core.content.a.getColor(context2, vi.c.f39755k);
        if (b11 != null) {
            setBoxStrokeColorStateList(b11);
        }
        int i27 = l.f40110t7;
        if (i20.s(i27)) {
            setBoxStrokeErrorColor(ij.c.b(context2, i20, i27));
        }
        if (i20.n(i19, -1) != -1) {
            r32 = 0;
            setHintTextAppearance(i20.n(i19, 0));
        } else {
            r32 = 0;
        }
        int n10 = i20.n(i17, r32);
        CharSequence p10 = i20.p(l.I7);
        boolean a11 = i20.a(l.J7, r32);
        checkableImageButton.setId(vi.f.S);
        if (ij.c.i(context2)) {
            u.d((ViewGroup.MarginLayoutParams) checkableImageButton.getLayoutParams(), r32);
        }
        int i28 = l.L7;
        if (i20.s(i28)) {
            this.D0 = ij.c.b(context2, i20, i28);
        }
        int i29 = l.M7;
        if (i20.s(i29)) {
            this.E0 = q.f(i20.k(i29, -1), null);
        }
        int i30 = l.K7;
        if (i20.s(i30)) {
            setErrorIconDrawable(i20.g(i30));
        }
        checkableImageButton.setContentDescription(getResources().getText(vi.j.f39865f));
        s0.x0(checkableImageButton, 2);
        checkableImageButton.setClickable(false);
        checkableImageButton.setPressable(false);
        checkableImageButton.setFocusable(false);
        int n11 = i20.n(i18, 0);
        boolean a12 = i20.a(l.R7, false);
        CharSequence p11 = i20.p(l.Q7);
        int n12 = i20.n(l.f39961e8, 0);
        CharSequence p12 = i20.p(l.f39951d8);
        int n13 = i20.n(l.f40071p8, 0);
        CharSequence p13 = i20.p(l.f40061o8);
        boolean a13 = i20.a(l.f40140w7, false);
        setCounterMaxLength(i20.k(l.f40150x7, -1));
        this.F = i20.n(i15, 0);
        this.E = i20.n(i16, 0);
        setBoxBackgroundMode(i20.k(l.f40040m7, 0));
        if (ij.c.i(context2)) {
            u.d((ViewGroup.MarginLayoutParams) checkableImageButton2.getLayoutParams(), 0);
        }
        int n14 = i20.n(l.E7, 0);
        sparseArray.append(-1, new com.google.android.material.textfield.b(this, n14));
        sparseArray.append(0, new com.google.android.material.textfield.h(this));
        if (n14 == 0) {
            z10 = a12;
            i12 = i20.n(l.Z7, 0);
        } else {
            z10 = a12;
            i12 = n14;
        }
        sparseArray.append(1, new i(this, i12));
        sparseArray.append(2, new com.google.android.material.textfield.a(this, n14));
        sparseArray.append(3, new com.google.android.material.textfield.d(this, n14));
        int i31 = l.f39921a8;
        if (!i20.s(i31)) {
            int i32 = l.G7;
            if (i20.s(i32)) {
                this.f13625v0 = ij.c.b(context2, i20, i32);
            }
            int i33 = l.H7;
            if (i20.s(i33)) {
                this.f13627w0 = q.f(i20.k(i33, -1), null);
            }
        }
        int i34 = l.F7;
        if (i20.s(i34)) {
            setEndIconMode(i20.k(i34, 0));
            int i35 = l.D7;
            if (i20.s(i35)) {
                setEndIconContentDescription(i20.p(i35));
            }
            setEndIconCheckable(i20.a(l.C7, true));
        } else if (i20.s(i31)) {
            int i36 = l.f39931b8;
            if (i20.s(i36)) {
                this.f13625v0 = ij.c.b(context2, i20, i36);
            }
            int i37 = l.f39941c8;
            if (i20.s(i37)) {
                this.f13627w0 = q.f(i20.k(i37, -1), null);
            }
            setEndIconMode(i20.a(i31, false) ? 1 : 0);
            setEndIconContentDescription(i20.p(l.Y7));
        }
        appCompatTextView.setId(vi.f.Y);
        appCompatTextView.setLayoutParams(new FrameLayout.LayoutParams(-2, -2, 80));
        s0.o0(appCompatTextView, 1);
        setErrorContentDescription(p10);
        setCounterOverflowTextAppearance(this.E);
        setHelperTextTextAppearance(n11);
        setErrorTextAppearance(n10);
        setCounterTextAppearance(this.F);
        setPlaceholderText(p12);
        setPlaceholderTextAppearance(n12);
        setSuffixTextAppearance(n13);
        int i38 = l.O7;
        if (i20.s(i38)) {
            setErrorTextColor(i20.c(i38));
        }
        int i39 = l.T7;
        if (i20.s(i39)) {
            setHelperTextColor(i20.c(i39));
        }
        int i40 = l.X7;
        if (i20.s(i40)) {
            setHintTextColor(i20.c(i40));
        }
        int i41 = l.B7;
        if (i20.s(i41)) {
            setCounterTextColor(i20.c(i41));
        }
        int i42 = l.f40170z7;
        if (i20.s(i42)) {
            setCounterOverflowTextColor(i20.c(i42));
        }
        int i43 = l.f39971f8;
        if (i20.s(i43)) {
            setPlaceholderTextColor(i20.c(i43));
        }
        int i44 = l.f40081q8;
        if (i20.s(i44)) {
            setSuffixTextColor(i20.c(i44));
        }
        setEnabled(i20.a(l.f39960e7, true));
        i20.w();
        s0.x0(this, 2);
        s0.z0(this, 1);
        frameLayout2.addView(checkableImageButton2);
        linearLayout.addView(appCompatTextView);
        linearLayout.addView(checkableImageButton);
        linearLayout.addView(frameLayout2);
        frameLayout.addView(jVar);
        frameLayout.addView(linearLayout);
        addView(frameLayout);
        setHelperTextEnabled(z10);
        setErrorEnabled(a11);
        setCounterEnabled(a13);
        setHelperText(p11);
        setSuffixText(p13);
    }

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

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

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

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

    public void setErrorIconDrawable(Drawable drawable) {
        this.C0.setImageDrawable(drawable);
        u0();
        com.google.android.material.textfield.f.a(this, this.C0, this.D0, this.E0);
    }

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

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

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