package r0;

import java.util.List;
import l0.a1;
import q2.m0;
import w2.p0;
import w2.q0;

/* loaded from: classes.dex */
public final class e0 extends b {

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

    /* renamed from: k, reason: collision with root package name */
    private final a1 f34149k;

    public e0(q0 q0Var, w2.h0 h0Var, a1 a1Var, i0 i0Var) {
        super(q0Var.e(), q0Var.g(), a1Var != null ? a1Var.f() : null, h0Var, i0Var, null);
        this.f34148j = q0Var;
        this.f34149k = a1Var;
    }

    /* JADX WARN: Code restructure failed: missing block: B:6:0x0013, code lost:
    
        if (r2 == null) goto L8;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private final int a0(a1 a1Var, int i10) {
        r1.i a10;
        h2.s c10 = a1Var.c();
        if (c10 != null) {
            h2.s b10 = a1Var.b();
            a10 = b10 != null ? h2.s.b0(b10, c10, false, 2, null) : null;
        }
        a10 = r1.i.f34323e.a();
        r1.i e10 = a1Var.f().e(p().b(m0.i(this.f34148j.g())));
        return p().a(a1Var.f().x(r1.h.a(e10.i(), e10.l() + (r1.m.g(a10.k()) * i10))));
    }

    public final List Y(dn.l lVar) {
        List n10;
        List e10;
        if (!m0.h(u())) {
            n10 = sm.u.n(new w2.a("", 0), new p0(m0.l(u()), m0.l(u())));
            return n10;
        }
        w2.i iVar = (w2.i) lVar.invoke(this);
        if (iVar == null) {
            return null;
        }
        e10 = sm.t.e(iVar);
        return e10;
    }

    public final q0 Z() {
        return q0.d(this.f34148j, e(), u(), null, 4, null);
    }

    public final e0 b0() {
        a1 a1Var;
        if ((w().length() > 0) && (a1Var = this.f34149k) != null) {
            T(a0(a1Var, 1));
        }
        kotlin.jvm.internal.t.e(this, "null cannot be cast to non-null type T of androidx.compose.foundation.text.selection.BaseTextPreparedSelection");
        return this;
    }

    public final e0 c0() {
        a1 a1Var;
        if ((w().length() > 0) && (a1Var = this.f34149k) != null) {
            T(a0(a1Var, -1));
        }
        kotlin.jvm.internal.t.e(this, "null cannot be cast to non-null type T of androidx.compose.foundation.text.selection.BaseTextPreparedSelection");
        return this;
    }
}
