package y;

import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.util.concurrent.CancellationException;
import y0.s3;
import y0.y3;

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

    /* renamed from: m, reason: collision with root package name */
    public static final int f51055m = 8;

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

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

    /* renamed from: c, reason: collision with root package name */
    private final String f51058c;

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

    /* renamed from: e, reason: collision with root package name */
    private final y0.q1 f51060e;

    /* renamed from: f, reason: collision with root package name */
    private final y0.q1 f51061f;

    /* renamed from: g, reason: collision with root package name */
    private final y0 f51062g;

    /* renamed from: h, reason: collision with root package name */
    private final f1 f51063h;

    /* renamed from: i, reason: collision with root package name */
    private final q f51064i;

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

    /* renamed from: k, reason: collision with root package name */
    private q f51066k;

    /* renamed from: l, reason: collision with root package name */
    private q f51067l;

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

        /* renamed from: p, reason: collision with root package name */
        Object f51068p;

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

        /* renamed from: r, reason: collision with root package name */
        int f51070r;

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

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

        /* renamed from: v, reason: collision with root package name */
        final /* synthetic */ long f51074v;

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

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

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

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

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

            /* renamed from: s, reason: collision with root package name */
            final /* synthetic */ kotlin.jvm.internal.k0 f51079s;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C1026a(a aVar, k kVar, dn.l lVar, kotlin.jvm.internal.k0 k0Var) {
                super(1);
                this.f51076p = aVar;
                this.f51077q = kVar;
                this.f51078r = lVar;
                this.f51079s = k0Var;
            }

            public final void a(h hVar) {
                k1.o(hVar, this.f51076p.j());
                Object h10 = this.f51076p.h(hVar.e());
                if (kotlin.jvm.internal.t.b(h10, hVar.e())) {
                    dn.l lVar = this.f51078r;
                    if (lVar != null) {
                        lVar.invoke(this.f51076p);
                        return;
                    }
                    return;
                }
                this.f51076p.j().x(h10);
                this.f51077q.x(h10);
                dn.l lVar2 = this.f51078r;
                if (lVar2 != null) {
                    lVar2.invoke(this.f51076p);
                }
                hVar.a();
                this.f51079s.f26193p = true;
            }

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C1025a(Object obj, d dVar, long j10, dn.l lVar, vm.d dVar2) {
            super(1, dVar2);
            this.f51072t = obj;
            this.f51073u = dVar;
            this.f51074v = j10;
            this.f51075w = lVar;
        }

        @Override // dn.l
        /* renamed from: b, reason: merged with bridge method [inline-methods] */
        public final Object invoke(vm.d dVar) {
            return ((C1025a) create(dVar)).invokeSuspend(rm.n0.f34904a);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(vm.d dVar) {
            return new C1025a(this.f51072t, this.f51073u, this.f51074v, this.f51075w, dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            k kVar;
            kotlin.jvm.internal.k0 k0Var;
            f10 = wm.d.f();
            int i10 = this.f51070r;
            try {
                if (i10 == 0) {
                    rm.y.b(obj);
                    a.this.j().y((q) a.this.l().a().invoke(this.f51072t));
                    a.this.r(this.f51073u.g());
                    a.this.q(true);
                    k h10 = l.h(a.this.j(), null, null, 0L, Long.MIN_VALUE, false, 23, null);
                    kotlin.jvm.internal.k0 k0Var2 = new kotlin.jvm.internal.k0();
                    d dVar = this.f51073u;
                    long j10 = this.f51074v;
                    C1026a c1026a = new C1026a(a.this, h10, this.f51075w, k0Var2);
                    this.f51068p = h10;
                    this.f51069q = k0Var2;
                    this.f51070r = 1;
                    if (k1.c(h10, dVar, j10, c1026a, this) == f10) {
                        return f10;
                    }
                    kVar = h10;
                    k0Var = k0Var2;
                } else {
                    if (i10 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    k0Var = (kotlin.jvm.internal.k0) this.f51069q;
                    kVar = (k) this.f51068p;
                    rm.y.b(obj);
                }
                e eVar = k0Var.f26193p ? e.BoundReached : e.Finished;
                a.this.i();
                return new g(kVar, eVar);
            } catch (CancellationException e10) {
                a.this.i();
                throw e10;
            }
        }
    }

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

        /* renamed from: p, reason: collision with root package name */
        int f51080p;

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(Object obj, vm.d dVar) {
            super(1, dVar);
            this.f51082r = obj;
        }

        @Override // dn.l
        /* renamed from: b, reason: merged with bridge method [inline-methods] */
        public final Object invoke(vm.d dVar) {
            return ((b) create(dVar)).invokeSuspend(rm.n0.f34904a);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(vm.d dVar) {
            return new b(this.f51082r, dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            wm.d.f();
            if (this.f51080p != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            rm.y.b(obj);
            a.this.i();
            Object h10 = a.this.h(this.f51082r);
            a.this.j().x(h10);
            a.this.r(h10);
            return rm.n0.f34904a;
        }
    }

    public a(Object obj, q1 q1Var, Object obj2, String str) {
        y0.q1 d10;
        y0.q1 d11;
        q e10;
        q i10;
        this.f51056a = q1Var;
        this.f51057b = obj2;
        this.f51058c = str;
        this.f51059d = new k(q1Var, obj, null, 0L, 0L, false, 60, null);
        d10 = s3.d(Boolean.FALSE, null, 2, null);
        this.f51060e = d10;
        d11 = s3.d(obj, null, 2, null);
        this.f51061f = d11;
        this.f51062g = new y0();
        this.f51063h = new f1(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, obj2, 3, null);
        q o10 = o();
        if (o10 instanceof m) {
            e10 = y.b.c();
        } else if (o10 instanceof n) {
            e10 = y.b.d();
        } else {
            e10 = o10 instanceof o ? y.b.e() : y.b.f();
        }
        kotlin.jvm.internal.t.e(e10, "null cannot be cast to non-null type V of androidx.compose.animation.core.Animatable");
        this.f51064i = e10;
        q o11 = o();
        if (o11 instanceof m) {
            i10 = y.b.g();
        } else if (o11 instanceof n) {
            i10 = y.b.h();
        } else {
            i10 = o11 instanceof o ? y.b.i() : y.b.j();
        }
        kotlin.jvm.internal.t.e(i10, "null cannot be cast to non-null type V of androidx.compose.animation.core.Animatable");
        this.f51065j = i10;
        this.f51066k = e10;
        this.f51067l = i10;
    }

    public static /* synthetic */ Object f(a aVar, Object obj, i iVar, Object obj2, dn.l lVar, vm.d dVar, int i10, Object obj3) {
        if ((i10 & 2) != 0) {
            iVar = aVar.f51063h;
        }
        i iVar2 = iVar;
        if ((i10 & 4) != 0) {
            obj2 = aVar.n();
        }
        Object obj4 = obj2;
        if ((i10 & 8) != 0) {
            lVar = null;
        }
        return aVar.e(obj, iVar2, obj4, lVar, dVar);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final Object h(Object obj) {
        float j10;
        if (kotlin.jvm.internal.t.b(this.f51066k, this.f51064i) && kotlin.jvm.internal.t.b(this.f51067l, this.f51065j)) {
            return obj;
        }
        q qVar = (q) this.f51056a.a().invoke(obj);
        int b10 = qVar.b();
        boolean z10 = false;
        for (int i10 = 0; i10 < b10; i10++) {
            if (qVar.a(i10) < this.f51066k.a(i10) || qVar.a(i10) > this.f51067l.a(i10)) {
                j10 = jn.o.j(qVar.a(i10), this.f51066k.a(i10), this.f51067l.a(i10));
                qVar.e(i10, j10);
                z10 = true;
            }
        }
        return z10 ? this.f51056a.b().invoke(qVar) : obj;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void i() {
        k kVar = this.f51059d;
        kVar.s().d();
        kVar.v(Long.MIN_VALUE);
        q(false);
    }

    private final Object p(d dVar, Object obj, dn.l lVar, vm.d dVar2) {
        return y0.e(this.f51062g, null, new C1025a(obj, dVar, this.f51059d.m(), lVar, null), dVar2, 1, null);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void q(boolean z10) {
        this.f51060e.setValue(Boolean.valueOf(z10));
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void r(Object obj) {
        this.f51061f.setValue(obj);
    }

    public final Object e(Object obj, i iVar, Object obj2, dn.l lVar, vm.d dVar) {
        return p(f.a(iVar, this.f51056a, m(), obj, obj2), obj2, lVar, dVar);
    }

    public final y3 g() {
        return this.f51059d;
    }

    public final k j() {
        return this.f51059d;
    }

    public final Object k() {
        return this.f51061f.getValue();
    }

    public final q1 l() {
        return this.f51056a;
    }

    public final Object m() {
        return this.f51059d.getValue();
    }

    public final Object n() {
        return this.f51056a.b().invoke(o());
    }

    public final q o() {
        return this.f51059d.s();
    }

    public final Object s(Object obj, vm.d dVar) {
        Object f10;
        Object e10 = y0.e(this.f51062g, null, new b(obj, null), dVar, 1, null);
        f10 = wm.d.f();
        return e10 == f10 ? e10 : rm.n0.f34904a;
    }

    public /* synthetic */ a(Object obj, q1 q1Var, Object obj2, String str, int i10, kotlin.jvm.internal.k kVar) {
        this(obj, q1Var, (i10 & 4) != 0 ? null : obj2, (i10 & 8) != 0 ? "Animatable" : str);
    }
}
