package o;

import android.os.Build;
import android.view.textclassifier.TextClassifier;
import android.view.textclassifier.TextSelection;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.oX, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2054oX extends Sb0 implements SC {
    public C2427sR p;
    public C2149pX q;
    public CharSequence r;
    public long s;
    public int t;
    public /* synthetic */ Object u;
    public final /* synthetic */ CharSequence v;
    public final /* synthetic */ long w;
    public final /* synthetic */ C2149pX x;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C2054oX(long j, CharSequence charSequence, InterfaceC0220Im interfaceC0220Im, C2149pX c2149pX) {
        super(2, interfaceC0220Im);
        this.v = charSequence;
        this.w = j;
        this.x = c2149pX;
    }

    @Override // o.SC
    public final Object f(Object obj, Object obj2) {
        return ((C2054oX) l(AbstractC0719aX.l(obj), (InterfaceC0220Im) obj2)).n(Oh0.a);
    }

    @Override // o.AbstractC0728ad
    public final InterfaceC0220Im l(Object obj, InterfaceC0220Im interfaceC0220Im) {
        C2054oX c2054oX = new C2054oX(this.w, this.v, interfaceC0220Im, this.x);
        c2054oX.u = obj;
        return c2054oX;
    }

    @Override // o.AbstractC0728ad
    public final Object n(Object obj) {
        long j;
        C2427sR c2427sR;
        TextSelection textSelectionM;
        CharSequence charSequence;
        C2149pX c2149pX;
        int i = this.t;
        if (i == 0) {
            IJ.H(obj);
            TextClassifier textClassifierL = AbstractC0719aX.l(this.u);
            AbstractC2770w0.C();
            long j2 = this.w;
            int iF = Ue0.f(j2);
            int iE = Ue0.e(j2);
            CharSequence charSequence2 = this.v;
            TextSelection.Request.Builder builderO = AbstractC2770w0.o(charSequence2, iF, iE);
            C2149pX c2149pX2 = this.x;
            TextSelection.Request.Builder defaultLocales = builderO.setDefaultLocales(c2149pX2.b());
            int i2 = Build.VERSION.SDK_INT;
            if (i2 >= 31) {
                defaultLocales.setIncludeTextClassification(true);
            }
            TextSelection textSelectionSuggestSelection = textClassifierL.suggestSelection(defaultLocales.build());
            long jU = AbstractC2378rs0.u(textSelectionSuggestSelection.getSelectionStartIndex(), textSelectionSuggestSelection.getSelectionEndIndex());
            EnumC0091Dn enumC0091Dn = EnumC0091Dn.l;
            if (i2 < 31 || textSelectionSuggestSelection.getTextClassification() == null) {
                this.s = jU;
                this.t = 2;
                if (C2149pX.a(this.x, this.v, jU, textClassifierL, this) != enumC0091Dn) {
                    j = jU;
                }
            } else {
                c2427sR = c2149pX2.e;
                this.u = textSelectionSuggestSelection;
                this.p = c2427sR;
                this.q = c2149pX2;
                this.r = charSequence2;
                this.s = jU;
                this.t = 1;
                if (c2427sR.d(this) != enumC0091Dn) {
                    textSelectionM = textSelectionSuggestSelection;
                    charSequence = charSequence2;
                    c2149pX = c2149pX2;
                    j = jU;
                    c2149pX.g.setValue(new C1207fd0(charSequence, j, textSelectionM.getTextClassification()));
                }
            }
            return enumC0091Dn;
        }
        if (i == 1) {
            j = this.s;
            charSequence = this.r;
            c2149pX = this.q;
            c2427sR = this.p;
            textSelectionM = AbstractC0719aX.m(this.u);
            IJ.H(obj);
            try {
                c2149pX.g.setValue(new C1207fd0(charSequence, j, textSelectionM.getTextClassification()));
            } finally {
                c2427sR.f(null);
            }
        } else {
            if (i != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            j = this.s;
            IJ.H(obj);
        }
        return new Ue0(j);
    }
}
