Rabbit-R1/switch port/java/sources/androidx/compose/ui/focus/FocusTransactionsKt.java
2024-05-21 17:08:36 -04:00

631 lines
33 KiB
Java

package androidx.compose.ui.focus;
import androidx.compose.runtime.collection.MutableVector;
import androidx.compose.ui.Modifier;
import androidx.compose.ui.node.DelegatableNodeKt;
import androidx.compose.ui.node.DelegatingNode;
import androidx.compose.ui.node.LayoutNode;
import androidx.compose.ui.node.NodeChain;
import androidx.compose.ui.node.NodeCoordinator;
import androidx.compose.ui.node.NodeKind;
import androidx.compose.ui.node.ObserverModifierNodeKt;
import androidx.compose.ui.node.Owner;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: FocusTransactions.kt */
@Metadata(d1 = {"\u0000\u001c\n\u0000\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000e\u001a\f\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0000\u001a \u0010\u0003\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\u0004\u001a\u00020\u00012\b\b\u0002\u0010\u0005\u001a\u00020\u0001H\u0002\u001a\u001e\u0010\u0006\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\u0004\u001a\u00020\u00012\u0006\u0010\u0005\u001a\u00020\u0001H\u0000\u001a\f\u0010\u0007\u001a\u00020\u0001*\u00020\u0002H\u0000\u001a\f\u0010\b\u001a\u00020\u0001*\u00020\u0002H\u0002\u001a!\u0010\t\u001a\u00020\n*\u00020\u00022\u0006\u0010\u000b\u001a\u00020\fH\u0000ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\b\r\u0010\u000e\u001a!\u0010\u000f\u001a\u00020\n*\u00020\u00022\u0006\u0010\u000b\u001a\u00020\fH\u0002ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\b\u0010\u0010\u000e\u001a!\u0010\u0011\u001a\u00020\n*\u00020\u00022\u0006\u0010\u000b\u001a\u00020\fH\u0002ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\b\u0012\u0010\u000e\u001a!\u0010\u0013\u001a\u00020\n*\u00020\u00022\u0006\u0010\u000b\u001a\u00020\fH\u0000ø\u0001\u0000ø\u0001\u0001¢\u0006\u0004\b\u0014\u0010\u000e\u001a\f\u0010\u0015\u001a\u00020\u0001*\u00020\u0002H\u0000\u001a\f\u0010\u0016\u001a\u00020\u0001*\u00020\u0002H\u0000\u001a\u0014\u0010\u0017\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0018\u001a\u00020\u0002H\u0002\u001a\f\u0010\u0019\u001a\u00020\u0001*\u00020\u0002H\u0002\u0082\u0002\u000b\n\u0005\\u001e0\u0001\n\u0002\b\u0019¨\u0006\u001a"}, d2 = {"captureFocus", "", "Landroidx/compose/ui/focus/FocusTargetNode;", "clearChildFocus", "forced", "refreshFocusEvents", "clearFocus", "freeFocus", "grantFocus", "performCustomClearFocus", "Landroidx/compose/ui/focus/CustomDestinationResult;", "focusDirection", "Landroidx/compose/ui/focus/FocusDirection;", "performCustomClearFocus-Mxy_nc0", "(Landroidx/compose/ui/focus/FocusTargetNode;I)Landroidx/compose/ui/focus/CustomDestinationResult;", "performCustomEnter", "performCustomEnter-Mxy_nc0", "performCustomExit", "performCustomExit-Mxy_nc0", "performCustomRequestFocus", "performCustomRequestFocus-Mxy_nc0", "performRequestFocus", "requestFocus", "requestFocusForChild", "childNode", "requestFocusForOwner", "ui_release"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class FocusTransactionsKt {
/* compiled from: FocusTransactions.kt */
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
public static final /* synthetic */ int[] $EnumSwitchMapping$1;
static {
int[] iArr = new int[CustomDestinationResult.values().length];
try {
iArr[CustomDestinationResult.None.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[CustomDestinationResult.Redirected.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[CustomDestinationResult.Cancelled.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[CustomDestinationResult.RedirectCancelled.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
$EnumSwitchMapping$0 = iArr;
int[] iArr2 = new int[FocusStateImpl.values().length];
try {
iArr2[FocusStateImpl.Active.ordinal()] = 1;
} catch (NoSuchFieldError unused5) {
}
try {
iArr2[FocusStateImpl.Captured.ordinal()] = 2;
} catch (NoSuchFieldError unused6) {
}
try {
iArr2[FocusStateImpl.ActiveParent.ordinal()] = 3;
} catch (NoSuchFieldError unused7) {
}
try {
iArr2[FocusStateImpl.Inactive.ordinal()] = 4;
} catch (NoSuchFieldError unused8) {
}
$EnumSwitchMapping$1 = iArr2;
}
}
public static final boolean requestFocus(FocusTargetNode focusTargetNode) {
Intrinsics.checkNotNullParameter(focusTargetNode, "<this>");
int i = WhenMappings.$EnumSwitchMapping$0[m2351performCustomRequestFocusMxy_nc0(focusTargetNode, FocusDirection.INSTANCE.m2328getEnterdhqQ8s()).ordinal()];
if (i == 1) {
return performRequestFocus(focusTargetNode);
}
if (i == 2) {
return true;
}
if (i == 3 || i == 4) {
return false;
}
throw new NoWhenBranchMatchedException();
}
public static final boolean performRequestFocus(FocusTargetNode focusTargetNode) {
boolean z;
NodeChain nodes;
Intrinsics.checkNotNullParameter(focusTargetNode, "<this>");
int i = WhenMappings.$EnumSwitchMapping$1[focusTargetNode.getFocusState().ordinal()];
if (i == 1 || i == 2) {
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
return true;
}
Modifier.Node node = null;
if (i == 3) {
z = clearChildFocus$default(focusTargetNode, false, false, 3, null) && grantFocus(focusTargetNode);
if (!z) {
return z;
}
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
return z;
}
if (i == 4) {
FocusTargetNode focusTargetNode2 = focusTargetNode;
int m4091constructorimpl = NodeKind.m4091constructorimpl(1024);
if (!focusTargetNode2.getNode().getIsAttached()) {
throw new IllegalStateException("visitAncestors called on an unattached node".toString());
}
Modifier.Node parent = focusTargetNode2.getNode().getParent();
LayoutNode requireLayoutNode = DelegatableNodeKt.requireLayoutNode(focusTargetNode2);
loop0: while (true) {
if (requireLayoutNode == null) {
break;
}
if ((requireLayoutNode.getNodes().getHead().getAggregateChildKindSet() & m4091constructorimpl) != 0) {
while (parent != null) {
if ((parent.getKindSet() & m4091constructorimpl) != 0) {
MutableVector mutableVector = null;
Modifier.Node node2 = parent;
while (node2 != null) {
if (node2 instanceof FocusTargetNode) {
node = node2;
break loop0;
}
if ((node2.getKindSet() & m4091constructorimpl) != 0 && (node2 instanceof DelegatingNode)) {
int i2 = 0;
for (Modifier.Node delegate = ((DelegatingNode) node2).getDelegate(); delegate != null; delegate = delegate.getChild()) {
if ((delegate.getKindSet() & m4091constructorimpl) != 0) {
i2++;
if (i2 == 1) {
node2 = delegate;
} else {
if (mutableVector == null) {
mutableVector = new MutableVector(new Modifier.Node[16], 0);
}
if (node2 != null) {
if (mutableVector != null) {
mutableVector.add(node2);
}
node2 = null;
}
if (mutableVector != null) {
mutableVector.add(delegate);
}
}
}
}
if (i2 == 1) {
}
}
node2 = DelegatableNodeKt.pop(mutableVector);
}
}
parent = parent.getParent();
}
}
requireLayoutNode = requireLayoutNode.getParent$ui_release();
parent = (requireLayoutNode == null || (nodes = requireLayoutNode.getNodes()) == null) ? null : nodes.getTail();
}
FocusTargetNode focusTargetNode3 = (FocusTargetNode) node;
if (focusTargetNode3 != null) {
return requestFocusForChild(focusTargetNode3, focusTargetNode);
}
z = requestFocusForOwner(focusTargetNode) && grantFocus(focusTargetNode);
if (!z) {
return z;
}
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
return z;
}
throw new NoWhenBranchMatchedException();
}
public static final boolean captureFocus(FocusTargetNode focusTargetNode) {
Intrinsics.checkNotNullParameter(focusTargetNode, "<this>");
int i = WhenMappings.$EnumSwitchMapping$1[focusTargetNode.getFocusState().ordinal()];
if (i == 1) {
focusTargetNode.setFocusState(FocusStateImpl.Captured);
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
return true;
}
if (i == 2) {
return true;
}
if (i == 3 || i == 4) {
return false;
}
throw new NoWhenBranchMatchedException();
}
public static final boolean freeFocus(FocusTargetNode focusTargetNode) {
Intrinsics.checkNotNullParameter(focusTargetNode, "<this>");
int i = WhenMappings.$EnumSwitchMapping$1[focusTargetNode.getFocusState().ordinal()];
if (i == 1) {
return true;
}
if (i == 2) {
focusTargetNode.setFocusState(FocusStateImpl.Active);
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
return true;
}
if (i == 3 || i == 4) {
return false;
}
throw new NoWhenBranchMatchedException();
}
public static /* synthetic */ boolean clearFocus$default(FocusTargetNode focusTargetNode, boolean z, boolean z2, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
return clearFocus(focusTargetNode, z, z2);
}
public static final boolean clearFocus(FocusTargetNode focusTargetNode, boolean z, boolean z2) {
Intrinsics.checkNotNullParameter(focusTargetNode, "<this>");
int i = WhenMappings.$EnumSwitchMapping$1[focusTargetNode.getFocusState().ordinal()];
if (i == 1) {
focusTargetNode.setFocusState(FocusStateImpl.Inactive);
if (z2) {
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
}
} else {
if (i == 2) {
if (!z) {
return z;
}
focusTargetNode.setFocusState(FocusStateImpl.Inactive);
if (!z2) {
return z;
}
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
return z;
}
if (i != 3) {
if (i != 4) {
throw new NoWhenBranchMatchedException();
}
} else {
if (!clearChildFocus(focusTargetNode, z, z2)) {
return false;
}
focusTargetNode.setFocusState(FocusStateImpl.Inactive);
if (z2) {
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
}
}
}
return true;
}
private static final boolean grantFocus(final FocusTargetNode focusTargetNode) {
ObserverModifierNodeKt.observeReads(focusTargetNode, new Function0<Unit>() { // from class: androidx.compose.ui.focus.FocusTransactionsKt$grantFocus$1
/* JADX INFO: Access modifiers changed from: package-private */
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public /* bridge */ /* synthetic */ Unit invoke() {
invoke2();
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2() {
FocusTargetNode.this.fetchFocusProperties$ui_release();
}
});
int i = WhenMappings.$EnumSwitchMapping$1[focusTargetNode.getFocusState().ordinal()];
if (i != 3 && i != 4) {
return true;
}
focusTargetNode.setFocusState(FocusStateImpl.Active);
return true;
}
static /* synthetic */ boolean clearChildFocus$default(FocusTargetNode focusTargetNode, boolean z, boolean z2, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
if ((i & 2) != 0) {
z2 = true;
}
return clearChildFocus(focusTargetNode, z, z2);
}
private static final boolean clearChildFocus(FocusTargetNode focusTargetNode, boolean z, boolean z2) {
FocusTargetNode activeChild = FocusTraversalKt.getActiveChild(focusTargetNode);
if (activeChild != null) {
return clearFocus(activeChild, z, z2);
}
return true;
}
private static final boolean requestFocusForChild(FocusTargetNode focusTargetNode, FocusTargetNode focusTargetNode2) {
Modifier.Node node;
Modifier.Node node2;
NodeChain nodes;
NodeChain nodes2;
FocusTargetNode focusTargetNode3 = focusTargetNode2;
int m4091constructorimpl = NodeKind.m4091constructorimpl(1024);
if (!focusTargetNode3.getNode().getIsAttached()) {
throw new IllegalStateException("visitAncestors called on an unattached node".toString());
}
Modifier.Node parent = focusTargetNode3.getNode().getParent();
LayoutNode requireLayoutNode = DelegatableNodeKt.requireLayoutNode(focusTargetNode3);
loop0: while (true) {
node = null;
if (requireLayoutNode == null) {
node2 = null;
break;
}
if ((requireLayoutNode.getNodes().getHead().getAggregateChildKindSet() & m4091constructorimpl) != 0) {
while (parent != null) {
if ((parent.getKindSet() & m4091constructorimpl) != 0) {
node2 = parent;
MutableVector mutableVector = null;
while (node2 != null) {
if (node2 instanceof FocusTargetNode) {
break loop0;
}
if ((node2.getKindSet() & m4091constructorimpl) != 0 && (node2 instanceof DelegatingNode)) {
int i = 0;
for (Modifier.Node delegate = ((DelegatingNode) node2).getDelegate(); delegate != null; delegate = delegate.getChild()) {
if ((delegate.getKindSet() & m4091constructorimpl) != 0) {
i++;
if (i == 1) {
node2 = delegate;
} else {
if (mutableVector == null) {
mutableVector = new MutableVector(new Modifier.Node[16], 0);
}
if (node2 != null) {
if (mutableVector != null) {
mutableVector.add(node2);
}
node2 = null;
}
if (mutableVector != null) {
mutableVector.add(delegate);
}
}
}
}
if (i == 1) {
}
}
node2 = DelegatableNodeKt.pop(mutableVector);
}
}
parent = parent.getParent();
}
}
requireLayoutNode = requireLayoutNode.getParent$ui_release();
parent = (requireLayoutNode == null || (nodes2 = requireLayoutNode.getNodes()) == null) ? null : nodes2.getTail();
}
if (!Intrinsics.areEqual(node2, focusTargetNode)) {
throw new IllegalStateException("Non child node cannot request focus.".toString());
}
int i2 = WhenMappings.$EnumSwitchMapping$1[focusTargetNode.getFocusState().ordinal()];
if (i2 == 1) {
boolean grantFocus = grantFocus(focusTargetNode2);
if (!grantFocus) {
return grantFocus;
}
focusTargetNode.setFocusState(FocusStateImpl.ActiveParent);
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode2);
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
return grantFocus;
}
if (i2 == 2) {
return false;
}
if (i2 == 3) {
if (FocusTraversalKt.getActiveChild(focusTargetNode) == null) {
throw new IllegalStateException("Required value was null.".toString());
}
boolean z = clearChildFocus$default(focusTargetNode, false, false, 3, null) && grantFocus(focusTargetNode2);
if (z) {
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode2);
}
return z;
}
if (i2 == 4) {
FocusTargetNode focusTargetNode4 = focusTargetNode;
int m4091constructorimpl2 = NodeKind.m4091constructorimpl(1024);
if (!focusTargetNode4.getNode().getIsAttached()) {
throw new IllegalStateException("visitAncestors called on an unattached node".toString());
}
Modifier.Node parent2 = focusTargetNode4.getNode().getParent();
LayoutNode requireLayoutNode2 = DelegatableNodeKt.requireLayoutNode(focusTargetNode4);
loop4: while (true) {
if (requireLayoutNode2 == null) {
break;
}
if ((requireLayoutNode2.getNodes().getHead().getAggregateChildKindSet() & m4091constructorimpl2) != 0) {
while (parent2 != null) {
if ((parent2.getKindSet() & m4091constructorimpl2) != 0) {
Modifier.Node node3 = parent2;
MutableVector mutableVector2 = null;
while (node3 != null) {
if (node3 instanceof FocusTargetNode) {
node = node3;
break loop4;
}
if ((node3.getKindSet() & m4091constructorimpl2) != 0 && (node3 instanceof DelegatingNode)) {
int i3 = 0;
for (Modifier.Node delegate2 = ((DelegatingNode) node3).getDelegate(); delegate2 != null; delegate2 = delegate2.getChild()) {
if ((delegate2.getKindSet() & m4091constructorimpl2) != 0) {
i3++;
if (i3 == 1) {
node3 = delegate2;
} else {
if (mutableVector2 == null) {
mutableVector2 = new MutableVector(new Modifier.Node[16], 0);
}
if (node3 != null) {
if (mutableVector2 != null) {
mutableVector2.add(node3);
}
node3 = null;
}
if (mutableVector2 != null) {
mutableVector2.add(delegate2);
}
}
}
}
if (i3 == 1) {
}
}
node3 = DelegatableNodeKt.pop(mutableVector2);
}
}
parent2 = parent2.getParent();
}
}
requireLayoutNode2 = requireLayoutNode2.getParent$ui_release();
parent2 = (requireLayoutNode2 == null || (nodes = requireLayoutNode2.getNodes()) == null) ? null : nodes.getTail();
}
FocusTargetNode focusTargetNode5 = (FocusTargetNode) node;
if (focusTargetNode5 == null && requestFocusForOwner(focusTargetNode)) {
focusTargetNode.setFocusState(FocusStateImpl.Active);
FocusEventModifierNodeKt.refreshFocusEventNodes(focusTargetNode);
return requestFocusForChild(focusTargetNode, focusTargetNode2);
}
if (focusTargetNode5 == null || !requestFocusForChild(focusTargetNode5, focusTargetNode)) {
return false;
}
boolean requestFocusForChild = requestFocusForChild(focusTargetNode, focusTargetNode2);
if (focusTargetNode.getFocusState() == FocusStateImpl.ActiveParent) {
return requestFocusForChild;
}
throw new IllegalStateException("Check failed.".toString());
}
throw new NoWhenBranchMatchedException();
}
private static final boolean requestFocusForOwner(FocusTargetNode focusTargetNode) {
LayoutNode layoutNode;
Owner owner;
NodeCoordinator coordinator$ui_release = focusTargetNode.getCoordinator();
if (coordinator$ui_release == null || (layoutNode = coordinator$ui_release.getLayoutNode()) == null || (owner = layoutNode.getOwner()) == null) {
throw new IllegalStateException("Owner not initialized.".toString());
}
return owner.requestFocus();
}
/* renamed from: performCustomRequestFocus-Mxy_nc0, reason: not valid java name */
public static final CustomDestinationResult m2351performCustomRequestFocusMxy_nc0(FocusTargetNode performCustomRequestFocus, int i) {
Modifier.Node node;
NodeChain nodes;
Intrinsics.checkNotNullParameter(performCustomRequestFocus, "$this$performCustomRequestFocus");
int i2 = WhenMappings.$EnumSwitchMapping$1[performCustomRequestFocus.getFocusState().ordinal()];
if (i2 == 1 || i2 == 2) {
return CustomDestinationResult.None;
}
if (i2 == 3) {
FocusTargetNode activeChild = FocusTraversalKt.getActiveChild(performCustomRequestFocus);
if (activeChild != null) {
return m2348performCustomClearFocusMxy_nc0(activeChild, i);
}
throw new IllegalStateException("Required value was null.".toString());
}
if (i2 == 4) {
FocusTargetNode focusTargetNode = performCustomRequestFocus;
int m4091constructorimpl = NodeKind.m4091constructorimpl(1024);
if (!focusTargetNode.getNode().getIsAttached()) {
throw new IllegalStateException("visitAncestors called on an unattached node".toString());
}
Modifier.Node parent = focusTargetNode.getNode().getParent();
LayoutNode requireLayoutNode = DelegatableNodeKt.requireLayoutNode(focusTargetNode);
loop0: while (true) {
if (requireLayoutNode == null) {
node = null;
break;
}
if ((requireLayoutNode.getNodes().getHead().getAggregateChildKindSet() & m4091constructorimpl) != 0) {
while (parent != null) {
if ((parent.getKindSet() & m4091constructorimpl) != 0) {
node = parent;
MutableVector mutableVector = null;
while (node != null) {
if (node instanceof FocusTargetNode) {
break loop0;
}
if ((node.getKindSet() & m4091constructorimpl) != 0 && (node instanceof DelegatingNode)) {
int i3 = 0;
for (Modifier.Node delegate = ((DelegatingNode) node).getDelegate(); delegate != null; delegate = delegate.getChild()) {
if ((delegate.getKindSet() & m4091constructorimpl) != 0) {
i3++;
if (i3 == 1) {
node = delegate;
} else {
if (mutableVector == null) {
mutableVector = new MutableVector(new Modifier.Node[16], 0);
}
if (node != null) {
if (mutableVector != null) {
mutableVector.add(node);
}
node = null;
}
if (mutableVector != null) {
mutableVector.add(delegate);
}
}
}
}
if (i3 == 1) {
}
}
node = DelegatableNodeKt.pop(mutableVector);
}
}
parent = parent.getParent();
}
}
requireLayoutNode = requireLayoutNode.getParent$ui_release();
parent = (requireLayoutNode == null || (nodes = requireLayoutNode.getNodes()) == null) ? null : nodes.getTail();
}
FocusTargetNode focusTargetNode2 = (FocusTargetNode) node;
if (focusTargetNode2 == null) {
return CustomDestinationResult.None;
}
int i4 = WhenMappings.$EnumSwitchMapping$1[focusTargetNode2.getFocusState().ordinal()];
if (i4 == 1) {
return m2349performCustomEnterMxy_nc0(focusTargetNode2, i);
}
if (i4 == 2) {
return CustomDestinationResult.Cancelled;
}
if (i4 == 3) {
return m2351performCustomRequestFocusMxy_nc0(focusTargetNode2, i);
}
if (i4 != 4) {
throw new NoWhenBranchMatchedException();
}
CustomDestinationResult m2351performCustomRequestFocusMxy_nc0 = m2351performCustomRequestFocusMxy_nc0(focusTargetNode2, i);
CustomDestinationResult customDestinationResult = m2351performCustomRequestFocusMxy_nc0 != CustomDestinationResult.None ? m2351performCustomRequestFocusMxy_nc0 : null;
return customDestinationResult == null ? m2349performCustomEnterMxy_nc0(focusTargetNode2, i) : customDestinationResult;
}
throw new NoWhenBranchMatchedException();
}
/* renamed from: performCustomClearFocus-Mxy_nc0, reason: not valid java name */
public static final CustomDestinationResult m2348performCustomClearFocusMxy_nc0(FocusTargetNode performCustomClearFocus, int i) {
Intrinsics.checkNotNullParameter(performCustomClearFocus, "$this$performCustomClearFocus");
int i2 = WhenMappings.$EnumSwitchMapping$1[performCustomClearFocus.getFocusState().ordinal()];
if (i2 != 1) {
if (i2 == 2) {
return CustomDestinationResult.Cancelled;
}
if (i2 == 3) {
FocusTargetNode activeChild = FocusTraversalKt.getActiveChild(performCustomClearFocus);
if (activeChild == null) {
throw new IllegalStateException("Required value was null.".toString());
}
CustomDestinationResult m2348performCustomClearFocusMxy_nc0 = m2348performCustomClearFocusMxy_nc0(activeChild, i);
if (m2348performCustomClearFocusMxy_nc0 == CustomDestinationResult.None) {
m2348performCustomClearFocusMxy_nc0 = null;
}
return m2348performCustomClearFocusMxy_nc0 == null ? m2350performCustomExitMxy_nc0(performCustomClearFocus, i) : m2348performCustomClearFocusMxy_nc0;
}
if (i2 != 4) {
throw new NoWhenBranchMatchedException();
}
}
return CustomDestinationResult.None;
}
/* renamed from: performCustomEnter-Mxy_nc0, reason: not valid java name */
private static final CustomDestinationResult m2349performCustomEnterMxy_nc0(FocusTargetNode focusTargetNode, int i) {
if (!focusTargetNode.isProcessingCustomEnter) {
focusTargetNode.isProcessingCustomEnter = true;
try {
FocusRequester invoke = focusTargetNode.fetchFocusProperties$ui_release().getEnter().invoke(FocusDirection.m2316boximpl(i));
if (invoke != FocusRequester.INSTANCE.getDefault()) {
if (invoke == FocusRequester.INSTANCE.getCancel()) {
return CustomDestinationResult.Cancelled;
}
return invoke.focus$ui_release() ? CustomDestinationResult.Redirected : CustomDestinationResult.RedirectCancelled;
}
} finally {
focusTargetNode.isProcessingCustomEnter = false;
}
}
return CustomDestinationResult.None;
}
/* renamed from: performCustomExit-Mxy_nc0, reason: not valid java name */
private static final CustomDestinationResult m2350performCustomExitMxy_nc0(FocusTargetNode focusTargetNode, int i) {
if (!focusTargetNode.isProcessingCustomExit) {
focusTargetNode.isProcessingCustomExit = true;
try {
FocusRequester invoke = focusTargetNode.fetchFocusProperties$ui_release().getExit().invoke(FocusDirection.m2316boximpl(i));
if (invoke != FocusRequester.INSTANCE.getDefault()) {
if (invoke == FocusRequester.INSTANCE.getCancel()) {
return CustomDestinationResult.Cancelled;
}
return invoke.focus$ui_release() ? CustomDestinationResult.Redirected : CustomDestinationResult.RedirectCancelled;
}
} finally {
focusTargetNode.isProcessingCustomExit = false;
}
}
return CustomDestinationResult.None;
}
}