package androidx.lifecycle; import androidx.exifinterface.media.ExifInterface; import androidx.lifecycle.Lifecycle; 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 kotlinx.coroutines.CoroutineScope; import kotlinx.coroutines.channels.ProducerScope; import kotlinx.coroutines.channels.SendChannel; import kotlinx.coroutines.flow.Flow; import kotlinx.coroutines.flow.FlowCollector; /* JADX INFO: Add missing generic type declarations: [T] */ /* compiled from: FlowExt.kt */ @Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u0002H\u00020\u0003H\u008a@"}, d2 = {"", "", ExifInterface.GPS_DIRECTION_TRUE, "Lkotlinx/coroutines/channels/ProducerScope;"}, k = 3, mv = {1, 8, 0}, xi = 48) @DebugMetadata(c = "androidx.lifecycle.FlowExtKt$flowWithLifecycle$1", f = "FlowExt.kt", i = {0}, l = {91}, m = "invokeSuspend", n = {"$this$callbackFlow"}, s = {"L$0"}) /* loaded from: classes2.dex */ final class FlowExtKt$flowWithLifecycle$1 extends SuspendLambda implements Function2, Continuation, Object> { final /* synthetic */ Lifecycle $lifecycle; final /* synthetic */ Lifecycle.State $minActiveState; final /* synthetic */ Flow $this_flowWithLifecycle; private /* synthetic */ Object L$0; int label; /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ /* JADX WARN: Multi-variable type inference failed */ public FlowExtKt$flowWithLifecycle$1(Lifecycle lifecycle, Lifecycle.State state, Flow flow, Continuation continuation) { super(2, continuation); this.$lifecycle = lifecycle; this.$minActiveState = state; this.$this_flowWithLifecycle = flow; } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Continuation create(Object obj, Continuation continuation) { FlowExtKt$flowWithLifecycle$1 flowExtKt$flowWithLifecycle$1 = new FlowExtKt$flowWithLifecycle$1(this.$lifecycle, this.$minActiveState, this.$this_flowWithLifecycle, continuation); flowExtKt$flowWithLifecycle$1.L$0 = obj; return flowExtKt$flowWithLifecycle$1; } @Override // kotlin.jvm.functions.Function2 public final Object invoke(ProducerScope producerScope, Continuation continuation) { return ((FlowExtKt$flowWithLifecycle$1) create(producerScope, continuation)).invokeSuspend(Unit.INSTANCE); } /* JADX INFO: Access modifiers changed from: package-private */ /* compiled from: FlowExt.kt */ @Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\u00020\u0003H\u008a@"}, d2 = {"", "", ExifInterface.GPS_DIRECTION_TRUE, "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 8, 0}, xi = 48) @DebugMetadata(c = "androidx.lifecycle.FlowExtKt$flowWithLifecycle$1$1", f = "FlowExt.kt", i = {}, l = {92}, m = "invokeSuspend", n = {}, s = {}) /* renamed from: androidx.lifecycle.FlowExtKt$flowWithLifecycle$1$1, reason: invalid class name */ /* loaded from: classes2.dex */ public static final class AnonymousClass1 extends SuspendLambda implements Function2, Object> { final /* synthetic */ ProducerScope $$this$callbackFlow; final /* synthetic */ Flow $this_flowWithLifecycle; int label; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ /* JADX WARN: Multi-variable type inference failed */ AnonymousClass1(Flow flow, ProducerScope producerScope, Continuation continuation) { super(2, continuation); this.$this_flowWithLifecycle = flow; this.$$this$callbackFlow = producerScope; } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Continuation create(Object obj, Continuation continuation) { return new AnonymousClass1(this.$this_flowWithLifecycle, this.$$this$callbackFlow, continuation); } @Override // kotlin.jvm.functions.Function2 public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) { return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE); } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Object invokeSuspend(Object obj) { Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED(); int i = this.label; if (i == 0) { ResultKt.throwOnFailure(obj); Flow flow = this.$this_flowWithLifecycle; final ProducerScope producerScope = this.$$this$callbackFlow; this.label = 1; if (flow.collect(new FlowCollector() { // from class: androidx.lifecycle.FlowExtKt.flowWithLifecycle.1.1.1 @Override // kotlinx.coroutines.flow.FlowCollector public final Object emit(T t, Continuation continuation) { Object send = producerScope.send(t, continuation); return send == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? send : 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; } } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Object invokeSuspend(Object obj) { ProducerScope producerScope; Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED(); int i = this.label; if (i == 0) { ResultKt.throwOnFailure(obj); ProducerScope producerScope2 = (ProducerScope) this.L$0; this.L$0 = producerScope2; this.label = 1; if (RepeatOnLifecycleKt.repeatOnLifecycle(this.$lifecycle, this.$minActiveState, new AnonymousClass1(this.$this_flowWithLifecycle, producerScope2, null), this) == coroutine_suspended) { return coroutine_suspended; } producerScope = producerScope2; } else { if (i != 1) { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } producerScope = (ProducerScope) this.L$0; ResultKt.throwOnFailure(obj); } SendChannel.DefaultImpls.close$default(producerScope, null, 1, null); return Unit.INSTANCE; } }