package androidx.lifecycle; import androidx.lifecycle.Lifecycle; import c.q.a.k.a; import d0.l; import d0.w.g.c; import d0.w.h.a.e; import d0.w.h.a.k; import d0.z.d.m; import kotlin.Unit; import kotlin.coroutines.Continuation; import kotlin.jvm.functions.Function2; import kotlinx.coroutines.CoroutineScope; import kotlinx.coroutines.Job; /* compiled from: PausingDispatcher.kt */ @e(c = "androidx.lifecycle.PausingDispatcherKt$whenStateAtLeast$2", f = "PausingDispatcher.kt", l = {162}, m = "invokeSuspend") public final class PausingDispatcherKt$whenStateAtLeast$2 extends k implements Function2, Object> { public final /* synthetic */ Function2 $block; public final /* synthetic */ Lifecycle.State $minState; public final /* synthetic */ Lifecycle $this_whenStateAtLeast; private /* synthetic */ Object L$0; public int label; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public PausingDispatcherKt$whenStateAtLeast$2(Lifecycle lifecycle, Lifecycle.State state, Function2 function2, Continuation continuation) { super(2, continuation); this.$this_whenStateAtLeast = lifecycle; this.$minState = state; this.$block = function2; } @Override // d0.w.h.a.a public final Continuation create(Object obj, Continuation continuation) { m.checkNotNullParameter(continuation, "completion"); PausingDispatcherKt$whenStateAtLeast$2 pausingDispatcherKt$whenStateAtLeast$2 = new PausingDispatcherKt$whenStateAtLeast$2(this.$this_whenStateAtLeast, this.$minState, this.$block, continuation); pausingDispatcherKt$whenStateAtLeast$2.L$0 = obj; return pausingDispatcherKt$whenStateAtLeast$2; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */ @Override // kotlin.jvm.functions.Function2 public final Object invoke(CoroutineScope coroutineScope, Object obj) { return ((PausingDispatcherKt$whenStateAtLeast$2) create(coroutineScope, (Continuation) obj)).invokeSuspend(Unit.a); } @Override // d0.w.h.a.a public final Object invokeSuspend(Object obj) { Throwable th; LifecycleController lifecycleController; Object coroutine_suspended = c.getCOROUTINE_SUSPENDED(); int i = this.label; if (i == 0) { l.throwOnFailure(obj); Job job = (Job) ((CoroutineScope) this.L$0).getCoroutineContext().get(Job.h); if (job != null) { PausingDispatcher pausingDispatcher = new PausingDispatcher(); LifecycleController lifecycleController2 = new LifecycleController(this.$this_whenStateAtLeast, this.$minState, pausingDispatcher.dispatchQueue, job); try { Function2 function2 = this.$block; this.L$0 = lifecycleController2; this.label = 1; obj = a.i0(pausingDispatcher, function2, this); if (obj == coroutine_suspended) { return coroutine_suspended; } lifecycleController = lifecycleController2; } catch (Throwable th2) { th = th2; lifecycleController = lifecycleController2; lifecycleController.finish(); throw th; } } else { throw new IllegalStateException("when[State] methods should have a parent job".toString()); } } else if (i == 1) { lifecycleController = (LifecycleController) this.L$0; try { l.throwOnFailure(obj); } catch (Throwable th3) { th = th3; } } else { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } lifecycleController.finish(); return obj; } }