package c0;

import b0.b0;
import b0.u;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import jn.o;
import kotlin.jvm.internal.l0;
import kotlin.jvm.internal.v;
import rm.n0;
import rm.y;
import y.k1;
import y.z;

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

    /* renamed from: a, reason: collision with root package name */
    private static final float f7320a = c3.h.t(400);

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class a extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        float f7321p;

        /* renamed from: q, reason: collision with root package name */
        Object f7322q;

        /* renamed from: r, reason: collision with root package name */
        Object f7323r;

        /* renamed from: s, reason: collision with root package name */
        /* synthetic */ Object f7324s;

        /* renamed from: t, reason: collision with root package name */
        int f7325t;

        a(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f7324s = obj;
            this.f7325t |= Integer.MIN_VALUE;
            return h.f(null, BitmapDescriptorFactory.HUE_RED, null, null, null, this);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class b extends v implements dn.l {

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

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

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

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ dn.l f7329s;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(float f10, l0 l0Var, u uVar, dn.l lVar) {
            super(1);
            this.f7326p = f10;
            this.f7327q = l0Var;
            this.f7328r = uVar;
            this.f7329s = lVar;
        }

        public final void a(y.h hVar) {
            if (Math.abs(((Number) hVar.e()).floatValue()) < Math.abs(this.f7326p)) {
                h.g(hVar, this.f7328r, this.f7329s, ((Number) hVar.e()).floatValue() - this.f7327q.f26195p);
                this.f7327q.f26195p = ((Number) hVar.e()).floatValue();
                return;
            }
            float j10 = h.j(((Number) hVar.e()).floatValue(), this.f7326p);
            h.g(hVar, this.f7328r, this.f7329s, j10 - this.f7327q.f26195p);
            hVar.a();
            this.f7327q.f26195p = j10;
        }

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

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class c extends kotlin.coroutines.jvm.internal.d {

        /* renamed from: p, reason: collision with root package name */
        float f7330p;

        /* renamed from: q, reason: collision with root package name */
        float f7331q;

        /* renamed from: r, reason: collision with root package name */
        Object f7332r;

        /* renamed from: s, reason: collision with root package name */
        Object f7333s;

        /* renamed from: t, reason: collision with root package name */
        /* synthetic */ Object f7334t;

        /* renamed from: u, reason: collision with root package name */
        int f7335u;

        c(vm.d dVar) {
            super(dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            this.f7334t = obj;
            this.f7335u |= Integer.MIN_VALUE;
            return h.h(null, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, null, null, null, this);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static final class d extends v implements dn.l {

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

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

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

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ dn.l f7339s;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        d(float f10, l0 l0Var, u uVar, dn.l lVar) {
            super(1);
            this.f7336p = f10;
            this.f7337q = l0Var;
            this.f7338r = uVar;
            this.f7339s = lVar;
        }

        /* JADX WARN: Code restructure failed: missing block: B:6:0x0041, code lost:
        
            if ((r0 == ((java.lang.Number) r6.e()).floatValue()) == false) goto L9;
         */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final void a(y.h hVar) {
            float j10 = h.j(((Number) hVar.e()).floatValue(), this.f7336p);
            float f10 = j10 - this.f7337q.f26195p;
            float a10 = this.f7338r.a(f10);
            this.f7339s.invoke(Float.valueOf(a10));
            if (Math.abs(f10 - a10) <= 0.5f) {
            }
            hVar.a();
            this.f7337q.f26195p += a10;
        }

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

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Removed duplicated region for block: B:15:0x003b  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0023  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final Object f(u uVar, float f10, y.k kVar, z zVar, dn.l lVar, vm.d dVar) {
        a aVar;
        Object f11;
        int i10;
        l0 l0Var;
        if (dVar instanceof a) {
            aVar = (a) dVar;
            int i11 = aVar.f7325t;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                aVar.f7325t = i11 - Integer.MIN_VALUE;
                Object obj = aVar.f7324s;
                f11 = wm.d.f();
                i10 = aVar.f7325t;
                if (i10 != 0) {
                    y.b(obj);
                    l0 l0Var2 = new l0();
                    boolean z10 = ((Number) kVar.r()).floatValue() == BitmapDescriptorFactory.HUE_RED;
                    b bVar = new b(f10, l0Var2, uVar, lVar);
                    aVar.f7322q = kVar;
                    aVar.f7323r = l0Var2;
                    aVar.f7321p = f10;
                    aVar.f7325t = 1;
                    if (k1.g(kVar, zVar, !z10, bVar, aVar) == f11) {
                        return f11;
                    }
                    l0Var = l0Var2;
                } else {
                    if (i10 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    f10 = aVar.f7321p;
                    l0Var = (l0) aVar.f7323r;
                    kVar = (y.k) aVar.f7322q;
                    y.b(obj);
                }
                return new c0.a(kotlin.coroutines.jvm.internal.b.b(f10 - l0Var.f26195p), kVar);
            }
        }
        aVar = new a(dVar);
        Object obj2 = aVar.f7324s;
        f11 = wm.d.f();
        i10 = aVar.f7325t;
        if (i10 != 0) {
        }
        return new c0.a(kotlin.coroutines.jvm.internal.b.b(f10 - l0Var.f26195p), kVar);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void g(y.h hVar, u uVar, dn.l lVar, float f10) {
        float a10 = uVar.a(f10);
        lVar.invoke(Float.valueOf(a10));
        if (Math.abs(f10 - a10) > 0.5f) {
            hVar.a();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Removed duplicated region for block: B:15:0x0042  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0026  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final Object h(u uVar, float f10, float f11, y.k kVar, y.i iVar, dn.l lVar, vm.d dVar) {
        c cVar;
        Object f12;
        int i10;
        float f13;
        l0 l0Var;
        float f14;
        y.k kVar2;
        if (dVar instanceof c) {
            cVar = (c) dVar;
            int i11 = cVar.f7335u;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                cVar.f7335u = i11 - Integer.MIN_VALUE;
                c cVar2 = cVar;
                Object obj = cVar2.f7334t;
                f12 = wm.d.f();
                i10 = cVar2.f7335u;
                if (i10 != 0) {
                    y.b(obj);
                    l0 l0Var2 = new l0();
                    float floatValue = ((Number) kVar.r()).floatValue();
                    Float b10 = kotlin.coroutines.jvm.internal.b.b(f10);
                    boolean z10 = ((Number) kVar.r()).floatValue() == BitmapDescriptorFactory.HUE_RED;
                    d dVar2 = new d(f11, l0Var2, uVar, lVar);
                    cVar2.f7332r = kVar;
                    cVar2.f7333s = l0Var2;
                    f13 = f10;
                    cVar2.f7330p = f13;
                    cVar2.f7331q = floatValue;
                    cVar2.f7335u = 1;
                    if (k1.i(kVar, b10, iVar, !z10, dVar2, cVar2) == f12) {
                        return f12;
                    }
                    l0Var = l0Var2;
                    f14 = floatValue;
                    kVar2 = kVar;
                } else {
                    if (i10 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    f14 = cVar2.f7331q;
                    float f15 = cVar2.f7330p;
                    l0Var = (l0) cVar2.f7333s;
                    y.k kVar3 = (y.k) cVar2.f7332r;
                    y.b(obj);
                    f13 = f15;
                    kVar2 = kVar3;
                }
                return new c0.a(kotlin.coroutines.jvm.internal.b.b(f13 - l0Var.f26195p), y.l.g(kVar2, BitmapDescriptorFactory.HUE_RED, j(((Number) kVar2.r()).floatValue(), f14), 0L, 0L, false, 29, null));
            }
        }
        cVar = new c(dVar);
        c cVar22 = cVar;
        Object obj2 = cVar22.f7334t;
        f12 = wm.d.f();
        i10 = cVar22.f7335u;
        if (i10 != 0) {
        }
        return new c0.a(kotlin.coroutines.jvm.internal.b.b(f13 - l0Var.f26195p), y.l.g(kVar2, BitmapDescriptorFactory.HUE_RED, j(((Number) kVar2.r()).floatValue(), f14), 0L, 0L, false, 29, null));
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Object i(u uVar, float f10, float f11, c0.b bVar, dn.l lVar, vm.d dVar) {
        return bVar.a(uVar, kotlin.coroutines.jvm.internal.b.b(f10), kotlin.coroutines.jvm.internal.b.b(f11), lVar, dVar);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final float j(float f10, float f11) {
        float c10;
        float f12;
        if (f11 == BitmapDescriptorFactory.HUE_RED) {
            return BitmapDescriptorFactory.HUE_RED;
        }
        if (f11 > BitmapDescriptorFactory.HUE_RED) {
            f12 = o.f(f10, f11);
            return f12;
        }
        c10 = o.c(f10, f11);
        return c10;
    }

    public static final float k() {
        return f7320a;
    }

    public static final b0 l(i iVar, z zVar, y.i iVar2) {
        return new g(iVar, zVar, iVar2);
    }
}
