package androidx.compose.foundation.text.selection; import androidx.compose.animation.core.Animatable; import androidx.compose.animation.core.AnimationVector2D; import androidx.compose.animation.core.SpringSpec; import androidx.compose.animation.core.TwoWayConverter; import androidx.compose.animation.core.VectorConvertersKt; import androidx.compose.runtime.Composer; import androidx.compose.runtime.ComposerKt; import androidx.compose.runtime.EffectsKt; import androidx.compose.runtime.SnapshotStateKt; import androidx.compose.runtime.State; import androidx.compose.ui.ComposedModifierKt; import androidx.compose.ui.Modifier; import androidx.compose.ui.geometry.Offset; import androidx.compose.ui.geometry.OffsetKt; import kotlin.Metadata; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.Intrinsics; /* compiled from: SelectionMagnifier.kt */ @Metadata(d1 = {"\u0000<\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u001a$\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u00020\n2\f\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\u00020\fH\u0003ø\u0001\u0000¢\u0006\u0002\u0010\r\u001aF\u0010\u000e\u001a\u00020\u000f*\u00020\u000f2\f\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\u00020\f2'\u0010\u0011\u001a#\u0012\u0019\u0012\u0017\u0012\u0004\u0012\u00020\u00020\f¢\u0006\f\b\u0013\u0012\b\b\u0014\u0012\u0004\b\b(\u0015\u0012\u0004\u0012\u00020\u000f0\u0012H\u0000ø\u0001\u0000\"\u0017\u0010\u0000\u001a\b\u0012\u0004\u0012\u00020\u00020\u0001X\u0082\u0004ø\u0001\u0000¢\u0006\u0002\n\u0000\"\u0013\u0010\u0003\u001a\u00020\u0002X\u0082\u0004ø\u0001\u0000¢\u0006\u0004\n\u0002\u0010\u0004\"\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000\"\u001d\u0010\u0007\u001a\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00060\bX\u0082\u0004ø\u0001\u0000¢\u0006\u0002\n\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u0016²\u0006\n\u0010\u0015\u001a\u00020\u0002X\u008a\u0084\u0002²\u0006\n\u0010\u0017\u001a\u00020\u0002X\u008a\u0084\u0002"}, d2 = {"MagnifierSpringSpec", "Landroidx/compose/animation/core/SpringSpec;", "Landroidx/compose/ui/geometry/Offset;", "OffsetDisplacementThreshold", "J", "UnspecifiedAnimationVector2D", "Landroidx/compose/animation/core/AnimationVector2D;", "UnspecifiedSafeOffsetVectorConverter", "Landroidx/compose/animation/core/TwoWayConverter;", "rememberAnimatedMagnifierPosition", "Landroidx/compose/runtime/State;", "targetCalculation", "Lkotlin/Function0;", "(Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State;", "animatedSelectionMagnifier", "Landroidx/compose/ui/Modifier;", "magnifierCenter", "platformMagnifier", "Lkotlin/Function1;", "Lkotlin/ParameterName;", "name", "animatedCenter", "foundation_release", "targetValue"}, k = 2, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public final class SelectionMagnifierKt { private static final SpringSpec MagnifierSpringSpec; private static final long OffsetDisplacementThreshold; private static final AnimationVector2D UnspecifiedAnimationVector2D = new AnimationVector2D(Float.NaN, Float.NaN); private static final TwoWayConverter UnspecifiedSafeOffsetVectorConverter = VectorConvertersKt.TwoWayConverter(new Function1() { // from class: androidx.compose.foundation.text.selection.SelectionMagnifierKt$UnspecifiedSafeOffsetVectorConverter$1 @Override // kotlin.jvm.functions.Function1 public /* bridge */ /* synthetic */ AnimationVector2D invoke(Offset offset) { return m905invokek4lQ0M(offset.getPackedValue()); } /* renamed from: invoke-k-4lQ0M, reason: not valid java name */ public final AnimationVector2D m905invokek4lQ0M(long j) { AnimationVector2D animationVector2D; if (OffsetKt.m2419isSpecifiedk4lQ0M(j)) { return new AnimationVector2D(Offset.m2400getXimpl(j), Offset.m2401getYimpl(j)); } animationVector2D = SelectionMagnifierKt.UnspecifiedAnimationVector2D; return animationVector2D; } }, new Function1() { // from class: androidx.compose.foundation.text.selection.SelectionMagnifierKt$UnspecifiedSafeOffsetVectorConverter$2 @Override // kotlin.jvm.functions.Function1 public /* bridge */ /* synthetic */ Offset invoke(AnimationVector2D animationVector2D) { return Offset.m2389boximpl(m906invoketuRUvjQ(animationVector2D)); } /* renamed from: invoke-tuRUvjQ, reason: not valid java name */ public final long m906invoketuRUvjQ(AnimationVector2D it) { Intrinsics.checkNotNullParameter(it, "it"); return OffsetKt.Offset(it.getV1(), it.getV2()); } }); static { long Offset = OffsetKt.Offset(0.01f, 0.01f); OffsetDisplacementThreshold = Offset; MagnifierSpringSpec = new SpringSpec<>(0.0f, 0.0f, Offset.m2389boximpl(Offset), 3, null); } public static final Modifier animatedSelectionMagnifier(Modifier modifier, Function0 magnifierCenter, Function1, ? extends Modifier> platformMagnifier) { Intrinsics.checkNotNullParameter(modifier, ""); Intrinsics.checkNotNullParameter(magnifierCenter, "magnifierCenter"); Intrinsics.checkNotNullParameter(platformMagnifier, "platformMagnifier"); return ComposedModifierKt.composed$default(modifier, null, new SelectionMagnifierKt$animatedSelectionMagnifier$1(magnifierCenter, platformMagnifier), 1, null); } /* JADX INFO: Access modifiers changed from: private */ public static final State rememberAnimatedMagnifierPosition(Function0 function0, Composer composer, int i) { composer.startReplaceableGroup(-1589795249); ComposerKt.sourceInformation(composer, "C(rememberAnimatedMagnifierPosition)78@3009L46,79@3077L208,83@3290L1186:SelectionMagnifier.kt#eksfi3"); if (ComposerKt.isTraceInProgress()) { ComposerKt.traceEventStart(-1589795249, i, -1, "androidx.compose.foundation.text.selection.rememberAnimatedMagnifierPosition (SelectionMagnifier.kt:75)"); } composer.startReplaceableGroup(-492369756); ComposerKt.sourceInformation(composer, "CC(remember):Composables.kt#9igjgp"); Object rememberedValue = composer.rememberedValue(); if (rememberedValue == Composer.INSTANCE.getEmpty()) { rememberedValue = SnapshotStateKt.derivedStateOf(function0); composer.updateRememberedValue(rememberedValue); } composer.endReplaceableGroup(); State state = (State) rememberedValue; composer.startReplaceableGroup(-492369756); ComposerKt.sourceInformation(composer, "CC(remember):Composables.kt#9igjgp"); Object rememberedValue2 = composer.rememberedValue(); if (rememberedValue2 == Composer.INSTANCE.getEmpty()) { rememberedValue2 = new Animatable(Offset.m2389boximpl(rememberAnimatedMagnifierPosition$lambda$1(state)), UnspecifiedSafeOffsetVectorConverter, Offset.m2389boximpl(OffsetDisplacementThreshold), null, 8, null); composer.updateRememberedValue(rememberedValue2); } composer.endReplaceableGroup(); Animatable animatable = (Animatable) rememberedValue2; EffectsKt.LaunchedEffect(Unit.INSTANCE, new SelectionMagnifierKt$rememberAnimatedMagnifierPosition$1(state, animatable, null), composer, 70); State asState = animatable.asState(); if (ComposerKt.isTraceInProgress()) { ComposerKt.traceEventEnd(); } composer.endReplaceableGroup(); return asState; } /* JADX INFO: Access modifiers changed from: private */ public static final long rememberAnimatedMagnifierPosition$lambda$1(State state) { return state.getValue().getPackedValue(); } }