package androidx.compose.animation;

import c3.r;
import c3.t;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import dn.l;
import h2.d0;
import h2.f0;
import h2.p0;
import kotlin.jvm.internal.v;
import rm.n0;
import x.n;
import x.o;
import x.s;
import y.f1;
import y.g0;
import y.m1;
import y0.y3;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class b extends o {
    private m1 C;
    private m1.a D;
    private m1.a E;
    private m1.a F;
    private androidx.compose.animation.c G;
    private androidx.compose.animation.e H;
    private dn.a I;
    private n J;
    private boolean K;
    private l1.c N;
    private long L = x.f.a();
    private long M = c3.c.b(0, 0, 0, 0, 15, null);
    private final l O = new i();
    private final l P = new j();

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

        /* renamed from: a, reason: collision with root package name */
        public static final /* synthetic */ int[] f1448a;

        static {
            int[] iArr = new int[x.i.values().length];
            try {
                iArr[x.i.Visible.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[x.i.PreEnter.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                iArr[x.i.PostExit.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            f1448a = iArr;
        }
    }

    /* renamed from: androidx.compose.animation.b$b, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    static final class C0034b extends v implements l {

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C0034b(p0 p0Var) {
            super(1);
            this.f1449p = p0Var;
        }

        public final void a(p0.a aVar) {
            p0.a.h(aVar, this.f1449p, 0, 0, BitmapDescriptorFactory.HUE_RED, 4, null);
        }

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

    /* loaded from: classes.dex */
    static final class c extends v implements l {

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

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

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

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        c(p0 p0Var, long j10, long j11, l lVar) {
            super(1);
            this.f1450p = p0Var;
            this.f1451q = j10;
            this.f1452r = j11;
            this.f1453s = lVar;
        }

        public final void a(p0.a aVar) {
            aVar.u(this.f1450p, c3.n.h(this.f1452r) + c3.n.h(this.f1451q), c3.n.i(this.f1452r) + c3.n.i(this.f1451q), BitmapDescriptorFactory.HUE_RED, this.f1453s);
        }

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

    /* loaded from: classes.dex */
    static final class d extends v implements l {

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        d(p0 p0Var) {
            super(1);
            this.f1454p = p0Var;
        }

        public final void a(p0.a aVar) {
            p0.a.h(aVar, this.f1454p, 0, 0, BitmapDescriptorFactory.HUE_RED, 4, null);
        }

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

    /* loaded from: classes.dex */
    static final class e extends v implements l {

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        e(long j10) {
            super(1);
            this.f1456q = j10;
        }

        public final long a(x.i iVar) {
            return b.this.t2(iVar, this.f1456q);
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            return r.b(a((x.i) obj));
        }
    }

    /* loaded from: classes.dex */
    static final class f extends v implements l {

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

        f() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final g0 invoke(m1.b bVar) {
            f1 f1Var;
            f1Var = androidx.compose.animation.a.f1415c;
            return f1Var;
        }
    }

    /* loaded from: classes.dex */
    static final class g extends v implements l {

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        g(long j10) {
            super(1);
            this.f1459q = j10;
        }

        public final long a(x.i iVar) {
            return b.this.v2(iVar, this.f1459q);
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            return c3.n.b(a((x.i) obj));
        }
    }

    /* loaded from: classes.dex */
    static final class h extends v implements l {

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        h(long j10) {
            super(1);
            this.f1461q = j10;
        }

        public final long a(x.i iVar) {
            return b.this.u2(iVar, this.f1461q);
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            return c3.n.b(a((x.i) obj));
        }
    }

    /* loaded from: classes.dex */
    static final class i extends v implements l {
        i() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final g0 invoke(m1.b bVar) {
            f1 f1Var;
            x.i iVar = x.i.PreEnter;
            x.i iVar2 = x.i.Visible;
            g0 g0Var = null;
            if (bVar.b(iVar, iVar2)) {
                x.g a10 = b.this.i2().b().a();
                if (a10 != null) {
                    g0Var = a10.b();
                }
            } else if (bVar.b(iVar2, x.i.PostExit)) {
                x.g a11 = b.this.j2().b().a();
                if (a11 != null) {
                    g0Var = a11.b();
                }
            } else {
                g0Var = androidx.compose.animation.a.f1416d;
            }
            if (g0Var != null) {
                return g0Var;
            }
            f1Var = androidx.compose.animation.a.f1416d;
            return f1Var;
        }
    }

    /* loaded from: classes.dex */
    static final class j extends v implements l {
        j() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final g0 invoke(m1.b bVar) {
            f1 f1Var;
            f1 f1Var2;
            g0 a10;
            f1 f1Var3;
            g0 a11;
            x.i iVar = x.i.PreEnter;
            x.i iVar2 = x.i.Visible;
            if (bVar.b(iVar, iVar2)) {
                s f10 = b.this.i2().b().f();
                if (f10 != null && (a11 = f10.a()) != null) {
                    return a11;
                }
                f1Var3 = androidx.compose.animation.a.f1415c;
                return f1Var3;
            }
            if (!bVar.b(iVar2, x.i.PostExit)) {
                f1Var = androidx.compose.animation.a.f1415c;
                return f1Var;
            }
            s f11 = b.this.j2().b().f();
            if (f11 != null && (a10 = f11.a()) != null) {
                return a10;
            }
            f1Var2 = androidx.compose.animation.a.f1415c;
            return f1Var2;
        }
    }

    public b(m1 m1Var, m1.a aVar, m1.a aVar2, m1.a aVar3, androidx.compose.animation.c cVar, androidx.compose.animation.e eVar, dn.a aVar4, n nVar) {
        this.C = m1Var;
        this.D = aVar;
        this.E = aVar2;
        this.F = aVar3;
        this.G = cVar;
        this.H = eVar;
        this.I = aVar4;
        this.J = nVar;
    }

    private final void o2(long j10) {
        this.K = true;
        this.M = j10;
    }

    @Override // l1.i.c
    public void R1() {
        super.R1();
        this.K = false;
        this.L = x.f.a();
    }

    @Override // j2.b0
    public f0 h(h2.g0 g0Var, d0 d0Var, long j10) {
        y3 a10;
        y3 a11;
        if (this.C.h() == this.C.o()) {
            this.N = null;
        } else if (this.N == null) {
            l1.c h22 = h2();
            if (h22 == null) {
                h22 = l1.c.f27332a.o();
            }
            this.N = h22;
        }
        if (g0Var.K0()) {
            p0 Y = d0Var.Y(j10);
            long a12 = c3.s.a(Y.S0(), Y.F0());
            this.L = a12;
            o2(j10);
            return h2.g0.j0(g0Var, r.g(a12), r.f(a12), null, new C0034b(Y), 4, null);
        }
        if (!((Boolean) this.I.invoke()).booleanValue()) {
            p0 Y2 = d0Var.Y(j10);
            return h2.g0.j0(g0Var, Y2.S0(), Y2.F0(), null, new d(Y2), 4, null);
        }
        l a13 = this.J.a();
        p0 Y3 = d0Var.Y(j10);
        long a14 = c3.s.a(Y3.S0(), Y3.F0());
        long j11 = x.f.b(this.L) ? this.L : a14;
        m1.a aVar = this.D;
        y3 a15 = aVar != null ? aVar.a(this.O, new e(j11)) : null;
        if (a15 != null) {
            a14 = ((r) a15.getValue()).j();
        }
        long f10 = c3.c.f(j10, a14);
        m1.a aVar2 = this.E;
        long a16 = (aVar2 == null || (a11 = aVar2.a(f.f1457p, new g(j11))) == null) ? c3.n.f7423b.a() : ((c3.n) a11.getValue()).n();
        m1.a aVar3 = this.F;
        long a17 = (aVar3 == null || (a10 = aVar3.a(this.P, new h(j11))) == null) ? c3.n.f7423b.a() : ((c3.n) a10.getValue()).n();
        l1.c cVar = this.N;
        return h2.g0.j0(g0Var, r.g(f10), r.f(f10), null, new c(Y3, c3.n.l(cVar != null ? cVar.a(j11, f10, t.Ltr) : c3.n.f7423b.a(), a17), a16, a13), 4, null);
    }

    public final l1.c h2() {
        l1.c a10;
        if (this.C.m().b(x.i.PreEnter, x.i.Visible)) {
            x.g a11 = this.G.b().a();
            if (a11 == null || (a10 = a11.a()) == null) {
                x.g a12 = this.H.b().a();
                if (a12 != null) {
                    return a12.a();
                }
                return null;
            }
        } else {
            x.g a13 = this.H.b().a();
            if (a13 == null || (a10 = a13.a()) == null) {
                x.g a14 = this.G.b().a();
                if (a14 != null) {
                    return a14.a();
                }
                return null;
            }
        }
        return a10;
    }

    public final androidx.compose.animation.c i2() {
        return this.G;
    }

    public final androidx.compose.animation.e j2() {
        return this.H;
    }

    public final void k2(dn.a aVar) {
        this.I = aVar;
    }

    public final void l2(androidx.compose.animation.c cVar) {
        this.G = cVar;
    }

    public final void m2(androidx.compose.animation.e eVar) {
        this.H = eVar;
    }

    public final void n2(n nVar) {
        this.J = nVar;
    }

    public final void p2(m1.a aVar) {
        this.E = aVar;
    }

    public final void q2(m1.a aVar) {
        this.D = aVar;
    }

    public final void r2(m1.a aVar) {
        this.F = aVar;
    }

    public final void s2(m1 m1Var) {
        this.C = m1Var;
    }

    public final long t2(x.i iVar, long j10) {
        l d10;
        l d11;
        int i10 = a.f1448a[iVar.ordinal()];
        if (i10 == 1) {
            return j10;
        }
        if (i10 == 2) {
            x.g a10 = this.G.b().a();
            return (a10 == null || (d10 = a10.d()) == null) ? j10 : ((r) d10.invoke(r.b(j10))).j();
        }
        if (i10 != 3) {
            throw new rm.t();
        }
        x.g a11 = this.H.b().a();
        return (a11 == null || (d11 = a11.d()) == null) ? j10 : ((r) d11.invoke(r.b(j10))).j();
    }

    public final long u2(x.i iVar, long j10) {
        l b10;
        l b11;
        s f10 = this.G.b().f();
        long a10 = (f10 == null || (b11 = f10.b()) == null) ? c3.n.f7423b.a() : ((c3.n) b11.invoke(r.b(j10))).n();
        s f11 = this.H.b().f();
        long a11 = (f11 == null || (b10 = f11.b()) == null) ? c3.n.f7423b.a() : ((c3.n) b10.invoke(r.b(j10))).n();
        int i10 = a.f1448a[iVar.ordinal()];
        if (i10 == 1) {
            return c3.n.f7423b.a();
        }
        if (i10 == 2) {
            return a10;
        }
        if (i10 == 3) {
            return a11;
        }
        throw new rm.t();
    }

    public final long v2(x.i iVar, long j10) {
        int i10;
        if (this.N != null && h2() != null && !kotlin.jvm.internal.t.b(this.N, h2()) && (i10 = a.f1448a[iVar.ordinal()]) != 1 && i10 != 2) {
            if (i10 != 3) {
                throw new rm.t();
            }
            x.g a10 = this.H.b().a();
            if (a10 == null) {
                return c3.n.f7423b.a();
            }
            long j11 = ((r) a10.d().invoke(r.b(j10))).j();
            l1.c h22 = h2();
            kotlin.jvm.internal.t.d(h22);
            t tVar = t.Ltr;
            long a11 = h22.a(j10, j11, tVar);
            l1.c cVar = this.N;
            kotlin.jvm.internal.t.d(cVar);
            return c3.n.k(a11, cVar.a(j10, j11, tVar));
        }
        return c3.n.f7423b.a();
    }
}
