package h0;

import c0.j;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import h2.f0;
import java.util.List;
import java.util.Map;
import kotlin.jvm.internal.l0;
import rm.n0;
import sm.q0;
import y.k1;

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

    /* renamed from: a */
    private static final float f20498a = c3.h.t(56);

    /* renamed from: b */
    private static final u f20499b;

    /* renamed from: c */
    private static final b f20500c;

    /* loaded from: classes.dex */
    public static final class a implements f0 {

        /* renamed from: a */
        private final int f20501a;

        /* renamed from: b */
        private final int f20502b;

        /* renamed from: c */
        private final Map f20503c;

        a() {
            Map i10;
            i10 = q0.i();
            this.f20503c = i10;
        }

        @Override // h2.f0
        public int getHeight() {
            return this.f20502b;
        }

        @Override // h2.f0
        public int getWidth() {
            return this.f20501a;
        }

        @Override // h2.f0
        public Map h() {
            return this.f20503c;
        }

        @Override // h2.f0
        public void i() {
        }
    }

    /* loaded from: classes.dex */
    public static final class b implements c3.d {

        /* renamed from: p */
        private final float f20504p = 1.0f;

        /* renamed from: q */
        private final float f20505q = 1.0f;

        b() {
        }

        @Override // c3.l
        public float G0() {
            return this.f20505q;
        }

        @Override // c3.d
        public float getDensity() {
            return this.f20504p;
        }
    }

    /* loaded from: classes.dex */
    public static final class c extends kotlin.coroutines.jvm.internal.l implements dn.p {

        /* renamed from: p */
        int f20506p;

        /* renamed from: q */
        private /* synthetic */ Object f20507q;

        /* renamed from: r */
        final /* synthetic */ dn.p f20508r;

        /* renamed from: s */
        final /* synthetic */ int f20509s;

        /* renamed from: t */
        final /* synthetic */ g0.h f20510t;

        /* renamed from: u */
        final /* synthetic */ float f20511u;

        /* renamed from: v */
        final /* synthetic */ y.i f20512v;

        /* loaded from: classes.dex */
        public static final class a extends kotlin.jvm.internal.v implements dn.p {

            /* renamed from: p */
            final /* synthetic */ l0 f20513p;

            /* renamed from: q */
            final /* synthetic */ b0.u f20514q;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            a(l0 l0Var, b0.u uVar) {
                super(2);
                this.f20513p = l0Var;
                this.f20514q = uVar;
            }

            public final void a(float f10, float f11) {
                this.f20513p.f26195p += this.f20514q.a(f10 - this.f20513p.f26195p);
            }

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        c(dn.p pVar, int i10, g0.h hVar, float f10, y.i iVar, vm.d dVar) {
            super(2, dVar);
            this.f20508r = pVar;
            this.f20509s = i10;
            this.f20510t = hVar;
            this.f20511u = f10;
            this.f20512v = iVar;
        }

        @Override // dn.p
        /* renamed from: b */
        public final Object invoke(b0.u uVar, vm.d dVar) {
            return ((c) create(uVar, dVar)).invokeSuspend(n0.f34904a);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            c cVar = new c(this.f20508r, this.f20509s, this.f20510t, this.f20511u, this.f20512v, dVar);
            cVar.f20507q = obj;
            return cVar;
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            f10 = wm.d.f();
            int i10 = this.f20506p;
            if (i10 == 0) {
                rm.y.b(obj);
                b0.u uVar = (b0.u) this.f20507q;
                this.f20508r.invoke(uVar, kotlin.coroutines.jvm.internal.b.c(this.f20509s));
                boolean z10 = this.f20509s > this.f20510t.g();
                int d10 = (this.f20510t.d() - this.f20510t.g()) + 1;
                if (((z10 && this.f20509s > this.f20510t.d()) || (!z10 && this.f20509s < this.f20510t.g())) && Math.abs(this.f20509s - this.f20510t.g()) >= 3) {
                    this.f20510t.c(uVar, z10 ? jn.o.d(this.f20509s - d10, this.f20510t.g()) : jn.o.g(this.f20509s + d10, this.f20510t.g()), 0);
                }
                float f11 = this.f20510t.f(this.f20509s) + this.f20511u;
                l0 l0Var = new l0();
                y.i iVar = this.f20512v;
                a aVar = new a(l0Var, uVar);
                this.f20506p = 1;
                if (k1.e(BitmapDescriptorFactory.HUE_RED, f11, BitmapDescriptorFactory.HUE_RED, iVar, aVar, this, 4, null) == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                rm.y.b(obj);
            }
            return n0.f34904a;
        }
    }

    /* loaded from: classes.dex */
    public static final class d extends kotlin.jvm.internal.v implements dn.a {

        /* renamed from: p */
        final /* synthetic */ int f20515p;

        /* renamed from: q */
        final /* synthetic */ float f20516q;

        /* renamed from: r */
        final /* synthetic */ dn.a f20517r;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        d(int i10, float f10, dn.a aVar) {
            super(0);
            this.f20515p = i10;
            this.f20516q = f10;
            this.f20517r = aVar;
        }

        @Override // dn.a
        /* renamed from: a */
        public final h0.b invoke() {
            return new h0.b(this.f20515p, this.f20516q, this.f20517r);
        }
    }

    static {
        List k10;
        k10 = sm.u.k();
        f20499b = new u(k10, 0, 0, 0, b0.q.Horizontal, 0, 0, false, 0, null, null, BitmapDescriptorFactory.HUE_RED, 0, false, j.a.f7340a, new a(), false, null, null, tp.n0.a(vm.h.f40193p), 393216, null);
        f20500c = new b();
    }

    public static final Object d(g0.h hVar, int i10, float f10, y.i iVar, dn.p pVar, vm.d dVar) {
        Object f11;
        Object b10 = hVar.b(new c(pVar, i10, hVar, f10, iVar, null), dVar);
        f11 = wm.d.f();
        return b10 == f11 ? b10 : n0.f34904a;
    }

    public static final Object e(c0 c0Var, vm.d dVar) {
        Object f10;
        if (c0Var.v() + 1 >= c0Var.F()) {
            return n0.f34904a;
        }
        Object n10 = c0.n(c0Var, c0Var.v() + 1, BitmapDescriptorFactory.HUE_RED, null, dVar, 6, null);
        f10 = wm.d.f();
        return n10 == f10 ? n10 : n0.f34904a;
    }

    public static final Object f(c0 c0Var, vm.d dVar) {
        Object f10;
        if (c0Var.v() - 1 < 0) {
            return n0.f34904a;
        }
        Object n10 = c0.n(c0Var, c0Var.v() - 1, BitmapDescriptorFactory.HUE_RED, null, dVar, 6, null);
        f10 = wm.d.f();
        return n10 == f10 ? n10 : n0.f34904a;
    }

    public static final long g(n nVar, int i10) {
        int k10;
        long e10;
        long l10 = (i10 * (nVar.l() + nVar.k())) + nVar.e() + nVar.b();
        int g10 = nVar.d() == b0.q.Horizontal ? c3.r.g(nVar.a()) : c3.r.f(nVar.a());
        k10 = jn.o.k(nVar.o().a(g10, nVar.k(), nVar.e(), nVar.b(), i10 - 1, i10), 0, g10);
        e10 = jn.o.e(l10 - (g10 - k10), 0L);
        return e10;
    }

    public static final long h(u uVar, int i10) {
        int k10;
        int g10 = uVar.d() == b0.q.Horizontal ? c3.r.g(uVar.a()) : c3.r.f(uVar.a());
        k10 = jn.o.k(uVar.o().a(g10, uVar.k(), uVar.e(), uVar.b(), 0, i10), 0, g10);
        return k10;
    }

    public static final float i() {
        return f20498a;
    }

    public static final u j() {
        return f20499b;
    }

    public static final c0 k(int i10, float f10, dn.a aVar, y0.m mVar, int i11, int i12) {
        if ((i12 & 1) != 0) {
            i10 = 0;
        }
        if ((i12 & 2) != 0) {
            f10 = BitmapDescriptorFactory.HUE_RED;
        }
        if (y0.p.H()) {
            y0.p.Q(-1210768637, i11, -1, "androidx.compose.foundation.pager.rememberPagerState (PagerState.kt:86)");
        }
        Object[] objArr = new Object[0];
        i1.j a10 = h0.b.L.a();
        boolean z10 = ((((i11 & 14) ^ 6) > 4 && mVar.i(i10)) || (i11 & 6) == 4) | ((((i11 & 112) ^ 48) > 32 && mVar.h(f10)) || (i11 & 48) == 32) | ((((i11 & 896) ^ 384) > 256 && mVar.R(aVar)) || (i11 & 384) == 256);
        Object f11 = mVar.f();
        if (z10 || f11 == y0.m.f51621a.a()) {
            f11 = new d(i10, f10, aVar);
            mVar.I(f11);
        }
        h0.b bVar = (h0.b) i1.b.c(objArr, a10, null, (dn.a) f11, mVar, 0, 4);
        bVar.m0().setValue(aVar);
        if (y0.p.H()) {
            y0.p.P();
        }
        return bVar;
    }
}
