package com.vinfast.companion.corecompose.compose;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes15.dex */
@kotlin.Metadata(d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\u001a,\u0010\u0006\u001a\u00020\u00032\b\b\u0002\u0010\u0001\u001a\u00020\u00002\u0011\u0010\u0005\u001a\r\u0012\u0004\u0012\u00020\u00030\u0002¢\u0006\u0002\b\u0004H\u0007¢\u0006\u0004\b\u0006\u0010\u0007\u001a@\u0010\u000b\u001a\u00020\u00032\b\b\u0002\u0010\u0001\u001a\u00020\u00002\b\b\u0002\u0010\t\u001a\u00020\b2\b\b\u0002\u0010\n\u001a\u00020\b2\u0011\u0010\u0005\u001a\r\u0012\u0004\u0012\u00020\u00030\u0002¢\u0006\u0002\b\u0004H\u0007¢\u0006\u0004\b\u000b\u0010\f¨\u0006\u000f²\u0006\f\u0010\r\u001a\u00020\b8\nX\u008a\u0084\u0002²\u0006\f\u0010\u000e\u001a\u00020\b8\nX\u008a\u0084\u0002"}, d2 = {"Landroidx/compose/ui/Modifier;", "modifier", "Lkotlin/Function0;", "", "Landroidx/compose/runtime/Composable;", "content", "h", "(Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V", "Landroidx/compose/ui/graphics/Color;", "topColor", "bottomColor", "l", "(Landroidx/compose/ui/Modifier;JJLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V", "currentTopColor", "currentBottomColor", "core-compose_release"}, k = 2, mv = {2, 2, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
public final class BackgroundKt {
    public static final void h(androidx.compose.ui.Modifier modifier, final kotlin.jvm.functions.Function2 function2, androidx.compose.runtime.Composer composer, final int i, final int i2) {
        androidx.compose.ui.Modifier modifier2;
        int i3;
        final androidx.compose.ui.Modifier modifier3;
        kotlin.jvm.internal.Intrinsics.l(function2, "content");
        androidx.compose.runtime.Composer composerB = composer.B(955435914);
        int i4 = i2 & 1;
        if (i4 != 0) {
            i3 = i | 6;
            modifier2 = modifier;
        } else if ((i & 6) == 0) {
            modifier2 = modifier;
            i3 = (composerB.s(modifier2) ? 4 : 2) | i;
        } else {
            modifier2 = modifier;
            i3 = i;
        }
        if ((i & 48) == 0) {
            i3 |= composerB.P(function2) ? 32 : 16;
        }
        if (composerB.f((i3 & 19) != 18, i3 & 1)) {
            androidx.compose.ui.Modifier modifier4 = i4 != 0 ? androidx.compose.ui.Modifier.c0 : modifier2;
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.q(955435914, i3, -1, "com.vinfast.companion.corecompose.compose.CustomBackground (Background.kt:30)");
            }
            long color = ((com.vinfast.companion.corecompose.ui.theme.BackgroundTheme) composerB.F(com.vinfast.companion.corecompose.ui.theme.BackgroundKt.c())).getColor();
            float tonalElevation = ((com.vinfast.companion.corecompose.ui.theme.BackgroundTheme) composerB.F(com.vinfast.companion.corecompose.ui.theme.BackgroundKt.c())).getTonalElevation();
            androidx.compose.ui.graphics.Color.Companion companion = androidx.compose.ui.graphics.Color.b;
            if (androidx.compose.ui.graphics.Color.p(color, companion.h())) {
                color = companion.g();
            }
            long j = color;
            if (androidx.compose.ui.unit.Dp.i(tonalElevation, androidx.compose.ui.unit.Dp.b.c())) {
                tonalElevation = androidx.compose.ui.unit.Dp.g(0);
            }
            float f = tonalElevation;
            modifier3 = modifier4;
            androidx.compose.material3.SurfaceKt.c(androidx.compose.foundation.layout.SizeKt.f(modifier4, 0.0f, 1, (java.lang.Object) null), (androidx.compose.ui.graphics.Shape) null, j, 0L, f, 0.0f, (androidx.compose.foundation.BorderStroke) null, androidx.compose.runtime.internal.ComposableLambdaKt.e(-1416498331, true, new kotlin.jvm.functions.Function2() { // from class: com.vinfast.companion.corecompose.compose.e
                public final java.lang.Object invoke(java.lang.Object obj, java.lang.Object obj2) {
                    return com.vinfast.companion.corecompose.compose.BackgroundKt.i(function2, (androidx.compose.runtime.Composer) obj, ((java.lang.Integer) obj2).intValue());
                }
            }, composerB, 54), composerB, 12582912, 106);
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.p();
            }
        } else {
            composerB.n();
            modifier3 = modifier2;
        }
        androidx.compose.runtime.ScopeUpdateScope scopeUpdateScopeD = composerB.D();
        if (scopeUpdateScopeD != null) {
            scopeUpdateScopeD.a(new kotlin.jvm.functions.Function2() { // from class: com.vinfast.companion.corecompose.compose.f
                public final java.lang.Object invoke(java.lang.Object obj, java.lang.Object obj2) {
                    return com.vinfast.companion.corecompose.compose.BackgroundKt.k(modifier3, function2, i, i2, (androidx.compose.runtime.Composer) obj, ((java.lang.Integer) obj2).intValue());
                }
            });
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final kotlin.Unit i(final kotlin.jvm.functions.Function2 function2, androidx.compose.runtime.Composer composer, int i) {
        if (composer.f((i & 3) != 2, i & 1)) {
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.q(-1416498331, i, -1, "com.vinfast.companion.corecompose.compose.CustomBackground.<anonymous> (Background.kt:38)");
            }
            androidx.compose.runtime.CompositionLocalKt.c(androidx.compose.material3.SurfaceKt.h().d(androidx.compose.ui.unit.Dp.d(androidx.compose.ui.unit.Dp.g(0))), androidx.compose.runtime.internal.ComposableLambdaKt.e(-127195483, true, new kotlin.jvm.functions.Function2() { // from class: com.vinfast.companion.corecompose.compose.g
                public final java.lang.Object invoke(java.lang.Object obj, java.lang.Object obj2) {
                    return com.vinfast.companion.corecompose.compose.BackgroundKt.j(function2, (androidx.compose.runtime.Composer) obj, ((java.lang.Integer) obj2).intValue());
                }
            }, composer, 54), composer, androidx.compose.runtime.ProvidedValue.i | 48);
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.p();
            }
        } else {
            composer.n();
        }
        return kotlin.Unit.a;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final kotlin.Unit j(kotlin.jvm.functions.Function2 function2, androidx.compose.runtime.Composer composer, int i) {
        if (composer.f((i & 3) != 2, i & 1)) {
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.q(-127195483, i, -1, "com.vinfast.companion.corecompose.compose.CustomBackground.<anonymous>.<anonymous> (Background.kt:39)");
            }
            function2.invoke(composer, 0);
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.p();
            }
        } else {
            composer.n();
        }
        return kotlin.Unit.a;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final kotlin.Unit k(androidx.compose.ui.Modifier modifier, kotlin.jvm.functions.Function2 function2, int i, int i2, androidx.compose.runtime.Composer composer, int i3) {
        h(modifier, function2, composer, androidx.compose.runtime.RecomposeScopeImplKt.a(i | 1), i2);
        return kotlin.Unit.a;
    }

    public static final void l(androidx.compose.ui.Modifier modifier, long j, long j2, final kotlin.jvm.functions.Function2 function2, androidx.compose.runtime.Composer composer, final int i, final int i2) {
        androidx.compose.ui.Modifier modifier2;
        int i3;
        long top;
        long bottom;
        androidx.compose.runtime.Composer composer2;
        final androidx.compose.ui.Modifier modifier3;
        final long j3;
        final long j4;
        androidx.compose.ui.Modifier modifier4;
        kotlin.jvm.internal.Intrinsics.l(function2, "content");
        androidx.compose.runtime.Composer composerB = composer.B(521631912);
        int i4 = i2 & 1;
        if (i4 != 0) {
            i3 = i | 6;
            modifier2 = modifier;
        } else if ((i & 6) == 0) {
            modifier2 = modifier;
            i3 = (composerB.s(modifier2) ? 4 : 2) | i;
        } else {
            modifier2 = modifier;
            i3 = i;
        }
        if ((i & 48) == 0) {
            top = j;
            i3 |= ((i2 & 2) == 0 && composerB.y(top)) ? 32 : 16;
        } else {
            top = j;
        }
        if ((i & 384) == 0) {
            bottom = j2;
            i3 |= ((i2 & 4) == 0 && composerB.y(bottom)) ? 256 : 128;
        } else {
            bottom = j2;
        }
        if ((i & 3072) == 0) {
            i3 |= composerB.P(function2) ? 2048 : 1024;
        }
        if (composerB.f((i3 & 1171) != 1170, i3 & 1)) {
            composerB.Q();
            if ((i & 1) == 0 || composerB.o()) {
                modifier4 = i4 != 0 ? androidx.compose.ui.Modifier.c0 : modifier2;
                if ((i2 & 2) != 0) {
                    top = ((com.vinfast.companion.corecompose.ui.theme.GradientColors) composerB.F(com.vinfast.companion.corecompose.ui.theme.GradientKt.c())).getTop();
                    i3 &= -113;
                }
                if ((i2 & 4) != 0) {
                    bottom = ((com.vinfast.companion.corecompose.ui.theme.GradientColors) composerB.F(com.vinfast.companion.corecompose.ui.theme.GradientKt.c())).getBottom();
                    i3 &= -897;
                }
            } else {
                composerB.n();
                if ((i2 & 2) != 0) {
                    i3 &= -113;
                }
                if ((i2 & 4) != 0) {
                    i3 &= -897;
                }
                modifier4 = modifier2;
            }
            int i5 = i3;
            long j5 = top;
            long j6 = bottom;
            composerB.I();
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.q(521631912, i5, -1, "com.vinfast.companion.corecompose.compose.CustomGradientBackground (Background.kt:50)");
            }
            final androidx.compose.runtime.State stateP = androidx.compose.runtime.SnapshotStateKt.p(androidx.compose.ui.graphics.Color.j(j5), composerB, (i5 >> 3) & 14);
            final androidx.compose.runtime.State stateP2 = androidx.compose.runtime.SnapshotStateKt.p(androidx.compose.ui.graphics.Color.j(j6), composerB, (i5 >> 6) & 14);
            composer2 = composerB;
            androidx.compose.material3.SurfaceKt.c(androidx.compose.foundation.layout.SizeKt.f(modifier4, 0.0f, 1, (java.lang.Object) null), (androidx.compose.ui.graphics.Shape) null, 0L, 0L, 0.0f, 0.0f, (androidx.compose.foundation.BorderStroke) null, androidx.compose.runtime.internal.ComposableLambdaKt.e(544679171, true, new kotlin.jvm.functions.Function2() { // from class: com.vinfast.companion.corecompose.compose.h
                public final java.lang.Object invoke(java.lang.Object obj, java.lang.Object obj2) {
                    return com.vinfast.companion.corecompose.compose.BackgroundKt.o(stateP, stateP2, function2, (androidx.compose.runtime.Composer) obj, ((java.lang.Integer) obj2).intValue());
                }
            }, composerB, 54), composer2, 12582912, 126);
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.p();
            }
            modifier3 = modifier4;
            j3 = j5;
            j4 = j6;
        } else {
            composer2 = composerB;
            composer2.n();
            modifier3 = modifier2;
            j3 = top;
            j4 = bottom;
        }
        androidx.compose.runtime.ScopeUpdateScope scopeUpdateScopeD = composer2.D();
        if (scopeUpdateScopeD != null) {
            scopeUpdateScopeD.a(new kotlin.jvm.functions.Function2() { // from class: com.vinfast.companion.corecompose.compose.i
                public final java.lang.Object invoke(java.lang.Object obj, java.lang.Object obj2) {
                    return com.vinfast.companion.corecompose.compose.BackgroundKt.r(modifier3, j3, j4, function2, i, i2, (androidx.compose.runtime.Composer) obj, ((java.lang.Integer) obj2).intValue());
                }
            });
        }
    }

    private static final long m(androidx.compose.runtime.State state) {
        return ((androidx.compose.ui.graphics.Color) state.getValue()).x();
    }

    private static final long n(androidx.compose.runtime.State state) {
        return ((androidx.compose.ui.graphics.Color) state.getValue()).x();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final kotlin.Unit o(final androidx.compose.runtime.State state, final androidx.compose.runtime.State state2, kotlin.jvm.functions.Function2 function2, androidx.compose.runtime.Composer composer, int i) {
        if (composer.f((i & 3) != 2, i & 1)) {
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.q(544679171, i, -1, "com.vinfast.companion.corecompose.compose.CustomGradientBackground.<anonymous> (Background.kt:57)");
            }
            androidx.compose.ui.Modifier modifierF = androidx.compose.foundation.layout.SizeKt.f(androidx.compose.ui.Modifier.c0, 0.0f, 1, (java.lang.Object) null);
            boolean zS = composer.s(state) | composer.s(state2);
            java.lang.Object objN = composer.N();
            if (zS || objN == androidx.compose.runtime.Composer.a.a()) {
                objN = new kotlin.jvm.functions.Function1() { // from class: com.vinfast.companion.corecompose.compose.j
                    public final java.lang.Object invoke(java.lang.Object obj) {
                        return com.vinfast.companion.corecompose.compose.BackgroundKt.p(state, state2, (androidx.compose.ui.draw.CacheDrawScope) obj);
                    }
                };
                composer.H(objN);
            }
            androidx.compose.ui.Modifier modifierC = androidx.compose.ui.draw.DrawModifierKt.c(modifierF, (kotlin.jvm.functions.Function1) objN);
            androidx.compose.ui.layout.MeasurePolicy measurePolicyI = androidx.compose.foundation.layout.BoxKt.i(androidx.compose.ui.Alignment.a.o(), false);
            int iHashCode = java.lang.Long.hashCode(androidx.compose.runtime.ComposablesKt.b(composer, 0));
            androidx.compose.runtime.CompositionLocalMap compositionLocalMapG = composer.g();
            androidx.compose.ui.Modifier modifierE = androidx.compose.ui.ComposedModifierKt.e(composer, modifierC);
            androidx.compose.ui.node.ComposeUiNode.Companion companion = androidx.compose.ui.node.ComposeUiNode.f0;
            kotlin.jvm.functions.Function0 function0B = companion.b();
            if (composer.C() == null) {
                androidx.compose.runtime.ComposablesKt.d();
            }
            composer.l();
            if (composer.A()) {
                composer.T(function0B);
            } else {
                composer.h();
            }
            androidx.compose.runtime.Composer composerC = androidx.compose.runtime.Updater.c(composer);
            androidx.compose.runtime.Updater.k(composerC, measurePolicyI, companion.d());
            androidx.compose.runtime.Updater.k(composerC, compositionLocalMapG, companion.f());
            kotlin.jvm.functions.Function2 function2C = companion.c();
            if (composerC.A() || !kotlin.jvm.internal.Intrinsics.g(composerC.N(), java.lang.Integer.valueOf(iHashCode))) {
                composerC.H(java.lang.Integer.valueOf(iHashCode));
                composerC.d(java.lang.Integer.valueOf(iHashCode), function2C);
            }
            androidx.compose.runtime.Updater.k(composerC, modifierE, companion.e());
            androidx.compose.foundation.layout.BoxScopeInstance boxScopeInstance = androidx.compose.foundation.layout.BoxScopeInstance.a;
            function2.invoke(composer, 0);
            composer.j();
            if (androidx.compose.runtime.ComposerKt.m()) {
                androidx.compose.runtime.ComposerKt.p();
            }
        } else {
            composer.n();
        }
        return kotlin.Unit.a;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final androidx.compose.ui.draw.DrawResult p(androidx.compose.runtime.State state, androidx.compose.runtime.State state2, androidx.compose.ui.draw.CacheDrawScope cacheDrawScope) {
        kotlin.jvm.internal.Intrinsics.l(cacheDrawScope, "$this$drawWithCache");
        final androidx.compose.ui.graphics.Brush brushF = androidx.compose.ui.graphics.Brush.Companion.f(androidx.compose.ui.graphics.Brush.b, new kotlin.Pair[]{kotlin.TuplesKt.a(java.lang.Float.valueOf(0.0f), androidx.compose.ui.graphics.Color.j(m(state))), kotlin.TuplesKt.a(java.lang.Float.valueOf(1.0f), androidx.compose.ui.graphics.Color.j(n(state2)))}, 0L, 0L, 0, 14, (java.lang.Object) null);
        return cacheDrawScope.s(new kotlin.jvm.functions.Function1() { // from class: com.vinfast.companion.corecompose.compose.k
            public final java.lang.Object invoke(java.lang.Object obj) {
                return com.vinfast.companion.corecompose.compose.BackgroundKt.q(brushF, (androidx.compose.ui.graphics.drawscope.DrawScope) obj);
            }
        });
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final kotlin.Unit q(androidx.compose.ui.graphics.Brush brush, androidx.compose.ui.graphics.drawscope.DrawScope drawScope) {
        kotlin.jvm.internal.Intrinsics.l(drawScope, "$this$onDrawBehind");
        androidx.compose.ui.graphics.drawscope.DrawScope.N0(drawScope, brush, 0L, 0L, 0.0f, (androidx.compose.ui.graphics.drawscope.DrawStyle) null, (androidx.compose.ui.graphics.ColorFilter) null, 0, 126, (java.lang.Object) null);
        return kotlin.Unit.a;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final kotlin.Unit r(androidx.compose.ui.Modifier modifier, long j, long j2, kotlin.jvm.functions.Function2 function2, int i, int i2, androidx.compose.runtime.Composer composer, int i3) {
        l(modifier, j, j2, function2, composer, androidx.compose.runtime.RecomposeScopeImplKt.a(i | 1), i2);
        return kotlin.Unit.a;
    }
}
