package g0;

import java.util.LinkedHashMap;
import java.util.Map;

/* loaded from: classes.dex */
public final class q {

    /* renamed from: a, reason: collision with root package name */
    private final i1.d f18965a;

    /* renamed from: b, reason: collision with root package name */
    private final dn.a f18966b;

    /* renamed from: c, reason: collision with root package name */
    private final Map f18967c = new LinkedHashMap();

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes.dex */
    public final class a {

        /* renamed from: a, reason: collision with root package name */
        private final Object f18968a;

        /* renamed from: b, reason: collision with root package name */
        private final Object f18969b;

        /* renamed from: c, reason: collision with root package name */
        private int f18970c;

        /* renamed from: d, reason: collision with root package name */
        private dn.p f18971d;

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

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

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

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

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

                /* renamed from: g0.q$a$a$a$a, reason: collision with other inner class name */
                /* loaded from: classes.dex */
                public static final class C0423a implements y0.l0 {

                    /* renamed from: a, reason: collision with root package name */
                    final /* synthetic */ a f18976a;

                    public C0423a(a aVar) {
                        this.f18976a = aVar;
                    }

                    @Override // y0.l0
                    public void a() {
                        this.f18976a.f18971d = null;
                    }
                }

                /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
                C0422a(a aVar) {
                    super(1);
                    this.f18975p = aVar;
                }

                @Override // dn.l
                /* renamed from: a, reason: merged with bridge method [inline-methods] */
                public final y0.l0 invoke(y0.m0 m0Var) {
                    return new C0423a(this.f18975p);
                }
            }

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0421a(q qVar, a aVar) {
                super(2);
                this.f18973p = qVar;
                this.f18974q = aVar;
            }

            public final void a(y0.m mVar, int i10) {
                if ((i10 & 3) == 2 && mVar.v()) {
                    mVar.A();
                    return;
                }
                if (y0.p.H()) {
                    y0.p.Q(1403994769, i10, -1, "androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory.CachedItemContent.createContentLambda.<anonymous> (LazyLayoutItemContentFactory.kt:91)");
                }
                s sVar = (s) this.f18973p.d().invoke();
                int f10 = this.f18974q.f();
                if ((f10 >= sVar.a() || !kotlin.jvm.internal.t.b(sVar.b(f10), this.f18974q.g())) && (f10 = sVar.c(this.f18974q.g())) != -1) {
                    this.f18974q.f18970c = f10;
                }
                int i11 = f10;
                if (i11 != -1) {
                    mVar.S(-660479623);
                    r.a(sVar, r0.a(this.f18973p.f18965a), i11, r0.a(this.f18974q.g()), mVar, 0);
                    mVar.H();
                } else {
                    mVar.S(-660272047);
                    mVar.H();
                }
                Object g10 = this.f18974q.g();
                boolean m10 = mVar.m(this.f18974q);
                a aVar = this.f18974q;
                Object f11 = mVar.f();
                if (m10 || f11 == y0.m.f51621a.a()) {
                    f11 = new C0422a(aVar);
                    mVar.I(f11);
                }
                y0.p0.a(g10, (dn.l) f11, mVar, 0);
                if (y0.p.H()) {
                    y0.p.P();
                }
            }

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

        public a(int i10, Object obj, Object obj2) {
            this.f18968a = obj;
            this.f18969b = obj2;
            this.f18970c = i10;
        }

        private final dn.p c() {
            return g1.c.c(1403994769, true, new C0421a(q.this, this));
        }

        public final dn.p d() {
            dn.p pVar = this.f18971d;
            if (pVar != null) {
                return pVar;
            }
            dn.p c10 = c();
            this.f18971d = c10;
            return c10;
        }

        public final Object e() {
            return this.f18969b;
        }

        public final int f() {
            return this.f18970c;
        }

        public final Object g() {
            return this.f18968a;
        }
    }

    public q(i1.d dVar, dn.a aVar) {
        this.f18965a = dVar;
        this.f18966b = aVar;
    }

    public final dn.p b(int i10, Object obj, Object obj2) {
        a aVar = (a) this.f18967c.get(obj);
        if (aVar != null && aVar.f() == i10 && kotlin.jvm.internal.t.b(aVar.e(), obj2)) {
            return aVar.d();
        }
        a aVar2 = new a(i10, obj, obj2);
        this.f18967c.put(obj, aVar2);
        return aVar2.d();
    }

    public final Object c(Object obj) {
        if (obj == null) {
            return null;
        }
        a aVar = (a) this.f18967c.get(obj);
        if (aVar != null) {
            return aVar.e();
        }
        s sVar = (s) this.f18966b.invoke();
        int c10 = sVar.c(obj);
        if (c10 != -1) {
            return sVar.d(c10);
        }
        return null;
    }

    public final dn.a d() {
        return this.f18966b;
    }
}
