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

import androidx.compose.runtime.MutableState;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.maps.android.compose.CameraPositionState;
import com.sistemasolton.itranvias.home.data.remote.dto.mapasdto.ParadaMapaDto;
import java.util.List;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
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 kotlinx.coroutines.CoroutineScope;

/* JADX INFO: compiled from: LineDetailScreen.android.kt */
/* JADX INFO: loaded from: classes2.dex */
@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.linedetail.LineDetailScreen_androidKt$GoogleMapsLine$2$1", f = "LineDetailScreen.android.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
final class LineDetailScreen_androidKt$GoogleMapsLine$2$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
    final /* synthetic */ CameraPositionState $cameraPositionState;
    final /* synthetic */ MutableState<Integer> $mapHeight$delegate;
    final /* synthetic */ MutableState<Integer> $mapWidth$delegate;
    final /* synthetic */ List<ParadaMapaDto> $paradas;
    final /* synthetic */ List<Punto> $recorrido;
    int label;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    LineDetailScreen_androidKt$GoogleMapsLine$2$1(List<ParadaMapaDto> list, List<Punto> list2, CameraPositionState cameraPositionState, MutableState<Integer> mutableState, MutableState<Integer> mutableState2, Continuation<? super LineDetailScreen_androidKt$GoogleMapsLine$2$1> continuation) {
        super(2, continuation);
        this.$paradas = list;
        this.$recorrido = list2;
        this.$cameraPositionState = cameraPositionState;
        this.$mapWidth$delegate = mutableState;
        this.$mapHeight$delegate = mutableState2;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
        return new LineDetailScreen_androidKt$GoogleMapsLine$2$1(this.$paradas, this.$recorrido, this.$cameraPositionState, this.$mapWidth$delegate, this.$mapHeight$delegate, continuation);
    }

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

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) throws Throwable {
        IntrinsicsKt.getCOROUTINE_SUSPENDED();
        if (this.label == 0) {
            ResultKt.throwOnFailure(obj);
            if (LineDetailScreen_androidKt.GoogleMapsLine$lambda$2(this.$mapWidth$delegate) > 0 && LineDetailScreen_androidKt.GoogleMapsLine$lambda$5(this.$mapHeight$delegate) > 0) {
                LatLngBounds.Builder builder = LatLngBounds.builder();
                Intrinsics.checkNotNullExpressionValue(builder, "builder(...)");
                for (ParadaMapaDto paradaMapaDto : this.$paradas) {
                    builder.include(new LatLng(paradaMapaDto.getPosy(), paradaMapaDto.getPosx()));
                }
                for (Punto punto : this.$recorrido) {
                    builder.include(new LatLng(punto.getPosY(), punto.getPosX()));
                }
                LatLngBounds latLngBoundsBuild = builder.build();
                Intrinsics.checkNotNullExpressionValue(latLngBoundsBuild, "build(...)");
                CameraPositionState cameraPositionState = this.$cameraPositionState;
                CameraUpdate cameraUpdateNewLatLngBounds = CameraUpdateFactory.newLatLngBounds(latLngBoundsBuild, 100);
                Intrinsics.checkNotNullExpressionValue(cameraUpdateNewLatLngBounds, "newLatLngBounds(...)");
                cameraPositionState.move(cameraUpdateNewLatLngBounds);
            }
            return Unit.INSTANCE;
        }
        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
    }
}