package l0;

import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import h2.p0;
import j2.g;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import l1.i;
import q2.d;
import y0.d4;
import y0.l2;
import y0.x2;

/* loaded from: classes.dex */
public abstract class b {

    /* renamed from: a, reason: collision with root package name */
    private static final rm.v f26728a;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class a implements h2.e0 {

        /* renamed from: a, reason: collision with root package name */
        public static final a f26729a = new a();

        /* renamed from: l0.b$a$a, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        static final class C0582a extends kotlin.jvm.internal.v implements dn.l {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ List f26730p;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0582a(List list) {
                super(1);
                this.f26730p = list;
            }

            public final void a(p0.a aVar) {
                List list = this.f26730p;
                int size = list.size();
                for (int i10 = 0; i10 < size; i10++) {
                    p0.a.l(aVar, (h2.p0) list.get(i10), 0, 0, BitmapDescriptorFactory.HUE_RED, 4, null);
                }
            }

            @Override // dn.l
            public /* bridge */ /* synthetic */ Object invoke(Object obj) {
                a((p0.a) obj);
                return rm.n0.f34904a;
            }
        }

        a() {
        }

        @Override // h2.e0
        public final h2.f0 f(h2.g0 g0Var, List list, long j10) {
            ArrayList arrayList = new ArrayList(list.size());
            int size = list.size();
            for (int i10 = 0; i10 < size; i10++) {
                arrayList.add(((h2.d0) list.get(i10)).Y(j10));
            }
            return h2.g0.j0(g0Var, c3.b.l(j10), c3.b.k(j10), null, new C0582a(arrayList), 4, null);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: l0.b$b, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static final class C0583b extends kotlin.jvm.internal.v implements dn.p {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ q2.d f26731p;

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ List f26732q;

        /* renamed from: r, reason: collision with root package name */
        final /* synthetic */ int f26733r;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C0583b(q2.d dVar, List list, int i10) {
            super(2);
            this.f26731p = dVar;
            this.f26732q = list;
            this.f26733r = i10;
        }

        public final void a(y0.m mVar, int i10) {
            b.a(this.f26731p, this.f26732q, mVar, l2.a(this.f26733r | 1));
        }

        @Override // dn.p
        public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
            a((y0.m) obj, ((Number) obj2).intValue());
            return rm.n0.f34904a;
        }
    }

    static {
        List k10;
        List k11;
        k10 = sm.u.k();
        k11 = sm.u.k();
        f26728a = new rm.v(k10, k11);
    }

    public static final void a(q2.d dVar, List list, y0.m mVar, int i10) {
        int i11;
        y0.m r10 = mVar.r(-1794596951);
        if ((i10 & 6) == 0) {
            i11 = (r10.R(dVar) ? 4 : 2) | i10;
        } else {
            i11 = i10;
        }
        if ((i10 & 48) == 0) {
            i11 |= r10.m(list) ? 32 : 16;
        }
        if ((i11 & 19) == 18 && r10.v()) {
            r10.A();
        } else {
            if (y0.p.H()) {
                y0.p.Q(-1794596951, i11, -1, "androidx.compose.foundation.text.InlineChildren (AnnotatedStringResolveInlineContent.kt:73)");
            }
            int size = list.size();
            int i12 = 0;
            int i13 = 0;
            while (i13 < size) {
                d.c cVar = (d.c) list.get(i13);
                dn.q qVar = (dn.q) cVar.a();
                int b10 = cVar.b();
                int c10 = cVar.c();
                a aVar = a.f26729a;
                i.a aVar2 = l1.i.f27362a;
                int a10 = y0.j.a(r10, i12);
                y0.y D = r10.D();
                l1.i e10 = l1.h.e(r10, aVar2);
                g.a aVar3 = j2.g.f23616d;
                dn.a a11 = aVar3.a();
                if (!(r10.w() instanceof y0.f)) {
                    y0.j.c();
                }
                r10.u();
                if (r10.n()) {
                    r10.o(a11);
                } else {
                    r10.F();
                }
                y0.m a12 = d4.a(r10);
                d4.b(a12, aVar, aVar3.c());
                d4.b(a12, D, aVar3.e());
                dn.p b11 = aVar3.b();
                if (a12.n() || !kotlin.jvm.internal.t.b(a12.f(), Integer.valueOf(a10))) {
                    a12.I(Integer.valueOf(a10));
                    a12.l(Integer.valueOf(a10), b11);
                }
                d4.b(a12, e10, aVar3.d());
                qVar.invoke(dVar.subSequence(b10, c10).j(), r10, 0);
                r10.O();
                i13++;
                i12 = 0;
            }
            if (y0.p.H()) {
                y0.p.P();
            }
        }
        x2 y10 = r10.y();
        if (y10 != null) {
            y10.a(new C0583b(dVar, list, i10));
        }
    }

    public static final boolean b(q2.d dVar) {
        return dVar.o("androidx.compose.foundation.text.inlineContent", 0, dVar.j().length());
    }

    public static final rm.v c(q2.d dVar, Map map) {
        if (map == null || map.isEmpty()) {
            return f26728a;
        }
        List i10 = dVar.i("androidx.compose.foundation.text.inlineContent", 0, dVar.j().length());
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        int size = i10.size();
        for (int i11 = 0; i11 < size; i11++) {
            android.support.v4.media.session.b.a(map.get(((d.c) i10.get(i11)).g()));
        }
        return new rm.v(arrayList, arrayList2);
    }
}
