package com.sistemasolton.itranvias.home.presentation.stops;

import androidx.compose.material3.MenuKt;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;
import androidx.core.view.MotionEventCompat;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelKt;
import com.sistemasolton.itranvias.home.data.local.entity.StopHistoryEntity;
import com.sistemasolton.itranvias.home.data.remote.dto.infodto.ActualizacionDto;
import com.sistemasolton.itranvias.home.data.remote.dto.infodto.ITranviasDto;
import com.sistemasolton.itranvias.home.data.remote.dto.infodto.InfoDto;
import com.sistemasolton.itranvias.home.data.remote.dto.infodto.ParadaDto;
import com.sistemasolton.itranvias.home.domain.usecase.AddStopToHistoryUseCase;
import com.sistemasolton.itranvias.home.domain.usecase.GetInfoLocalUseCase;
import com.sistemasolton.itranvias.home.domain.usecase.GetInfoUseCase;
import com.sistemasolton.itranvias.home.domain.usecase.GetRecentStopsUseCase;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.FlowCollector;

/* JADX INFO: compiled from: StopsViewModel.kt */
/* JADX INFO: loaded from: classes2.dex */
@Metadata(d1 = {"\u0000<\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\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\u0003\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0006\b\u0007\u0018\u00002\u00020\u0001B'\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\t¢\u0006\u0004\b\n\u0010\u000bJ\b\u0010\u0015\u001a\u00020\u0016H\u0002J\u0006\u0010\u0017\u001a\u00020\u0016J\u000e\u0010\u0018\u001a\u00020\u00162\u0006\u0010\u0019\u001a\u00020\u001aJ\b\u0010\u001b\u001a\u00020\u0016H\u0002J\u000e\u0010\u001c\u001a\u00020\u00162\u0006\u0010\u001d\u001a\u00020\u001aJ\u0006\u0010\u001e\u001a\u00020\u0016J\u0006\u0010\u001f\u001a\u00020\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R+\u0010\u000e\u001a\u00020\r2\u0006\u0010\f\u001a\u00020\r8F@BX\u0086\u008e\u0002¢\u0006\u0012\n\u0004\b\u0013\u0010\u0014\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012¨\u0006 "}, d2 = {"Lcom/sistemasolton/itranvias/home/presentation/stops/StopsViewModel;", "Landroidx/lifecycle/ViewModel;", "getInfoUseCase", "Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoUseCase;", "getLocalInfoUseCase", "Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoLocalUseCase;", "addStopToHistoryUseCase", "Lcom/sistemasolton/itranvias/home/domain/usecase/AddStopToHistoryUseCase;", "getRecentStopsUseCase", "Lcom/sistemasolton/itranvias/home/domain/usecase/GetRecentStopsUseCase;", "<init>", "(Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoUseCase;Lcom/sistemasolton/itranvias/home/domain/usecase/GetInfoLocalUseCase;Lcom/sistemasolton/itranvias/home/domain/usecase/AddStopToHistoryUseCase;Lcom/sistemasolton/itranvias/home/domain/usecase/GetRecentStopsUseCase;)V", "<set-?>", "Lcom/sistemasolton/itranvias/home/presentation/stops/StopsState;", "state", "getState", "()Lcom/sistemasolton/itranvias/home/presentation/stops/StopsState;", "setState", "(Lcom/sistemasolton/itranvias/home/presentation/stops/StopsState;)V", "state$delegate", "Landroidx/compose/runtime/MutableState;", "loadLocalInfo", "", "loadInfo", "addStopToHistory", "code", "", "observeHistory", "onStopInputChange", "newValue", "onInvalidStopCode", "onSearchClicked", "composeApp_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
public final class StopsViewModel extends ViewModel {
    public static final int $stable = 8;
    private final AddStopToHistoryUseCase addStopToHistoryUseCase;
    private final GetInfoUseCase getInfoUseCase;
    private final GetInfoLocalUseCase getLocalInfoUseCase;
    private final GetRecentStopsUseCase getRecentStopsUseCase;

    /* JADX INFO: renamed from: state$delegate, reason: from kotlin metadata */
    private final MutableState state;

    public StopsViewModel(GetInfoUseCase getInfoUseCase, GetInfoLocalUseCase getLocalInfoUseCase, AddStopToHistoryUseCase addStopToHistoryUseCase, GetRecentStopsUseCase getRecentStopsUseCase) {
        Intrinsics.checkNotNullParameter(getInfoUseCase, "getInfoUseCase");
        Intrinsics.checkNotNullParameter(getLocalInfoUseCase, "getLocalInfoUseCase");
        Intrinsics.checkNotNullParameter(addStopToHistoryUseCase, "addStopToHistoryUseCase");
        Intrinsics.checkNotNullParameter(getRecentStopsUseCase, "getRecentStopsUseCase");
        this.getInfoUseCase = getInfoUseCase;
        this.getLocalInfoUseCase = getLocalInfoUseCase;
        this.addStopToHistoryUseCase = addStopToHistoryUseCase;
        this.getRecentStopsUseCase = getRecentStopsUseCase;
        this.state = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(new StopsState(false, false, null, null, null, null, false, 127, null), null, 2, null);
        loadLocalInfo();
        observeHistory();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void setState(StopsState stopsState) {
        this.state.setValue(stopsState);
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final StopsState getState() {
        return (StopsState) this.state.getValue();
    }

    /* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$loadLocalInfo$1, reason: invalid class name and case insensitive filesystem */
    /* JADX INFO: compiled from: StopsViewModel.kt */
    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\n"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 1, 0}, xi = 48)
    @DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$loadLocalInfo$1", f = "StopsViewModel.kt", i = {}, l = {32}, m = "invokeSuspend", n = {}, s = {})
    static final class C06531 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
        int label;

        C06531(Continuation<? super C06531> continuation) {
            super(2, continuation);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
            return StopsViewModel.this.new C06531(continuation);
        }

        @Override // kotlin.jvm.functions.Function2
        public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
            return ((C06531) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) throws Throwable {
            Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
            int i = this.label;
            if (i == 0) {
                ResultKt.throwOnFailure(obj);
                Flow<InfoDto> flowInvoke = StopsViewModel.this.getLocalInfoUseCase.invoke();
                final StopsViewModel stopsViewModel = StopsViewModel.this;
                this.label = 1;
                if (flowInvoke.collect(new FlowCollector() { // from class: com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel.loadLocalInfo.1.1
                    @Override // kotlinx.coroutines.flow.FlowCollector
                    public /* bridge */ /* synthetic */ Object emit(Object obj2, Continuation continuation) {
                        return emit((InfoDto) obj2, (Continuation<? super Unit>) continuation);
                    }

                    public final Object emit(InfoDto infoDto, Continuation<? super Unit> continuation) {
                        StopsViewModel stopsViewModel2 = stopsViewModel;
                        stopsViewModel2.setState(StopsState.copy$default(stopsViewModel2.getState(), false, false, null, infoDto, null, null, false, 116, null));
                        return Unit.INSTANCE;
                    }
                }, this) == coroutine_suspended) {
                    return coroutine_suspended;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ResultKt.throwOnFailure(obj);
            }
            return Unit.INSTANCE;
        }
    }

    private final void loadLocalInfo() {
        BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new C06531(null), 3, null);
    }

    /* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$loadInfo$1, reason: invalid class name and case insensitive filesystem */
    /* JADX INFO: compiled from: StopsViewModel.kt */
    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\n"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 1, 0}, xi = 48)
    @DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$loadInfo$1", f = "StopsViewModel.kt", i = {}, l = {MotionEventCompat.AXIS_GENERIC_11}, m = "invokeSuspend", n = {}, s = {})
    static final class C06521 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
        int label;

        C06521(Continuation<? super C06521> continuation) {
            super(2, continuation);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
            return StopsViewModel.this.new C06521(continuation);
        }

        @Override // kotlin.jvm.functions.Function2
        public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
            return ((C06521) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) throws Throwable {
            Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
            int i = this.label;
            try {
                if (i == 0) {
                    ResultKt.throwOnFailure(obj);
                    StopsViewModel stopsViewModel = StopsViewModel.this;
                    stopsViewModel.setState(StopsState.copy$default(stopsViewModel.getState(), true, false, null, null, null, null, false, 124, null));
                    this.label = 1;
                    obj = GetInfoUseCase.invoke$default(StopsViewModel.this.getInfoUseCase, null, this, 1, null);
                    if (obj == coroutine_suspended) {
                        return coroutine_suspended;
                    }
                } else {
                    if (i != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    ResultKt.throwOnFailure(obj);
                }
                InfoDto infoDto = (InfoDto) obj;
                StopsViewModel stopsViewModel2 = StopsViewModel.this;
                stopsViewModel2.setState(StopsState.copy$default(stopsViewModel2.getState(), false, false, null, infoDto, null, null, false, 118, null));
            } catch (Exception e) {
                System.out.println((Object) ("❌ Error al cargar info: " + e.getMessage()));
                e.printStackTrace();
                StopsViewModel stopsViewModel3 = StopsViewModel.this;
                stopsViewModel3.setState(StopsState.copy$default(stopsViewModel3.getState(), false, true, e.getMessage(), null, null, null, false, MenuKt.InTransitionDuration, null));
            }
            return Unit.INSTANCE;
        }
    }

    public final void loadInfo() {
        BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new C06521(null), 3, null);
    }

    /* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$addStopToHistory$1, reason: invalid class name */
    /* JADX INFO: compiled from: StopsViewModel.kt */
    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\n"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 1, 0}, xi = 48)
    @DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$addStopToHistory$1", f = "StopsViewModel.kt", i = {}, l = {54}, m = "invokeSuspend", n = {}, s = {})
    static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
        final /* synthetic */ String $code;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        AnonymousClass1(String str, Continuation<? super AnonymousClass1> continuation) {
            super(2, continuation);
            this.$code = str;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
            return StopsViewModel.this.new AnonymousClass1(this.$code, continuation);
        }

        @Override // kotlin.jvm.functions.Function2
        public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
            return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) throws Throwable {
            Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
            int i = this.label;
            if (i == 0) {
                ResultKt.throwOnFailure(obj);
                this.label = 1;
                if (StopsViewModel.this.addStopToHistoryUseCase.invoke(this.$code, this) == coroutine_suspended) {
                    return coroutine_suspended;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ResultKt.throwOnFailure(obj);
            }
            return Unit.INSTANCE;
        }
    }

    public final void addStopToHistory(String code) {
        Intrinsics.checkNotNullParameter(code, "code");
        BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new AnonymousClass1(code, null), 3, null);
    }

    /* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$observeHistory$1, reason: invalid class name and case insensitive filesystem */
    /* JADX INFO: compiled from: StopsViewModel.kt */
    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\n"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 1, 0}, xi = 48)
    @DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$observeHistory$1", f = "StopsViewModel.kt", i = {}, l = {60}, m = "invokeSuspend", n = {}, s = {})
    static final class C06541 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
        int label;

        C06541(Continuation<? super C06541> continuation) {
            super(2, continuation);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
            return StopsViewModel.this.new C06541(continuation);
        }

        @Override // kotlin.jvm.functions.Function2
        public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
            return ((C06541) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) throws Throwable {
            Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
            int i = this.label;
            if (i == 0) {
                ResultKt.throwOnFailure(obj);
                Flow<List<StopHistoryEntity>> flowInvoke = StopsViewModel.this.getRecentStopsUseCase.invoke();
                final StopsViewModel stopsViewModel = StopsViewModel.this;
                this.label = 1;
                if (flowInvoke.collect(new FlowCollector() { // from class: com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel.observeHistory.1.1
                    @Override // kotlinx.coroutines.flow.FlowCollector
                    public /* bridge */ /* synthetic */ Object emit(Object obj2, Continuation continuation) {
                        return emit((List<StopHistoryEntity>) obj2, (Continuation<? super Unit>) continuation);
                    }

                    public final Object emit(List<StopHistoryEntity> list, Continuation<? super Unit> continuation) {
                        StopsViewModel stopsViewModel2 = stopsViewModel;
                        StopsState state = stopsViewModel2.getState();
                        List<StopHistoryEntity> list2 = list;
                        ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list2, 10));
                        Iterator<T> it = list2.iterator();
                        while (it.hasNext()) {
                            arrayList.add(((StopHistoryEntity) it.next()).getStopCode());
                        }
                        stopsViewModel2.setState(StopsState.copy$default(state, false, false, null, null, arrayList, null, false, 111, null));
                        return Unit.INSTANCE;
                    }
                }, this) == coroutine_suspended) {
                    return coroutine_suspended;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ResultKt.throwOnFailure(obj);
            }
            return Unit.INSTANCE;
        }
    }

    private final void observeHistory() {
        BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new C06541(null), 3, null);
    }

    public final void onStopInputChange(String newValue) {
        Intrinsics.checkNotNullParameter(newValue, "newValue");
        setState(StopsState.copy$default(getState(), false, false, null, null, null, newValue, false, 31, null));
    }

    public final void onInvalidStopCode() {
        setState(StopsState.copy$default(getState(), false, false, null, null, null, null, true, 63, null));
    }

    public final void onSearchClicked() {
        InfoDto infoDto;
        ITranviasDto iTranvias;
        ActualizacionDto actualizacion;
        List<ParadaDto> paradas;
        String string = StringsKt.trim((CharSequence) getState().getStopInput()).toString();
        Integer intOrNull = StringsKt.toIntOrNull(string);
        if (intOrNull != null && (infoDto = getState().getInfoDto()) != null && (iTranvias = infoDto.getITranvias()) != null && (actualizacion = iTranvias.getActualizacion()) != null && (paradas = actualizacion.getParadas()) != null) {
            List<ParadaDto> list = paradas;
            if (!(list instanceof Collection) || !list.isEmpty()) {
                Iterator<T> it = list.iterator();
                while (it.hasNext()) {
                    int id = ((ParadaDto) it.next()).getId();
                    if (intOrNull != null && id == intOrNull.intValue()) {
                        BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(this), null, null, new C06551(string, null), 3, null);
                        setState(StopsState.copy$default(getState(), false, false, null, null, null, null, false, 63, null));
                        return;
                    }
                }
            }
        }
        onInvalidStopCode();
    }

    /* JADX INFO: renamed from: com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$onSearchClicked$1, reason: invalid class name and case insensitive filesystem */
    /* JADX INFO: compiled from: StopsViewModel.kt */
    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\n"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 1, 0}, xi = 48)
    @DebugMetadata(c = "com.sistemasolton.itranvias.home.presentation.stops.StopsViewModel$onSearchClicked$1", f = "StopsViewModel.kt", i = {}, l = {86}, m = "invokeSuspend", n = {}, s = {})
    static final class C06551 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
        final /* synthetic */ String $stopCode;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C06551(String str, Continuation<? super C06551> continuation) {
            super(2, continuation);
            this.$stopCode = str;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
            return StopsViewModel.this.new C06551(this.$stopCode, continuation);
        }

        @Override // kotlin.jvm.functions.Function2
        public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
            return ((C06551) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) throws Throwable {
            Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
            int i = this.label;
            if (i == 0) {
                ResultKt.throwOnFailure(obj);
                this.label = 1;
                if (StopsViewModel.this.addStopToHistoryUseCase.invoke(this.$stopCode, this) == coroutine_suspended) {
                    return coroutine_suspended;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                ResultKt.throwOnFailure(obj);
            }
            return Unit.INSTANCE;
        }
    }
}