content: package kotlinx.coroutines;
  
  import java.util.concurrent.CancellationException;
  import kotlin.Metadata;
  import kotlin.coroutines.Continuation;
  import kotlin.coroutines.CoroutineContext;
  import kotlin.coroutines.intrinsics.IntrinsicsKt;
  import kotlin.coroutines.jvm.internal.DebugProbesKt;
  import kotlin.jvm.functions.Function2;
  import kotlin.jvm.internal.InlineMarker;
  import kotlin.jvm.internal.Intrinsics;
  import kotlinx.coroutines.internal.ContextScope;
  import kotlinx.coroutines.internal.ScopeCoroutine;
  import kotlinx.coroutines.intrinsics.UndispatchedKt;
  import mt.Log1F380D;
  
  @Metadata(d1 = {"\u0000F\n\u0000\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u001a\u000e\u0010\u0006\u001a\u00020\u00022\u0006\u0010\u0007\u001a\u00020\b\u001a\u0006\u0010\t\u001a\u00020\u0002\u001aM\u0010\n\u001a\u0002H\u000b\"\u0004\b\u0000\u0010\u000b2'\u0010\f\u001a#\b\u0001\u0012\u0004\u0012\u00020\u0002\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u000b0\u000e\u0012\u0006\u0012\u0004\u0018\u00010\u000f0\r¢\u0006\u0002\b\u0010H@ø\u0001\u0000\u0002\n\n\b\b\u0001\u0012\u0002\u0010\u0001 \u0001¢\u0006\u0002\u0010\u0011\u001a\u0011\u0010\u0012\u001a\u00020\bHHø\u0001\u0000¢\u0006\u0002\u0010\u0013\u001a\u001e\u0010\u0014\u001a\u00020\u0015*\u00020\u00022\u0006\u0010\u0016\u001a\u00020\u00172\n\b\u0002\u0010\u0018\u001a\u0004\u0018\u00010\u0019\u001a\u001c\u0010\u0014\u001a\u00020\u0015*\u00020\u00022\u0010\b\u0002\u0010\u0018\u001a\n\u0018\u00010\u001aj\u0004\u0018\u0001`\u001b\u001a\n\u0010\u001c\u001a\u00020\u0015*\u00020\u0002\u001a\u0015\u0010\u001d\u001a\u00020\u0002*\u00020\u00022\u0006\u0010\u0007\u001a\u00020\bH\u0002\"\u001b\u0010\u0000\u001a\u00020\u0001*\u00020\u00028F¢\u0006\f\u0012\u0004\b\u0003\u0010\u0004\u001a\u0004\b\u0000\u0010\u0005\u0002\u0004\n\u0002\b\u0019¨\u0006\u001e"}, d2 = {"isActive", "", "Lkotlinx/coroutines/CoroutineScope;", "isActive$annotations", "(Lkotlinx/coroutines/CoroutineScope;)V", "(Lkotlinx/coroutines/CoroutineScope;)Z", "CoroutineScope", "context", "Lkotlin/coroutines/CoroutineContext;", "MainScope", "coroutineScope", "R", "block", "Lkotlin/Function2;", "Lkotlin/coroutines/Continuation;", "", "Lkotlin/ExtensionFunctionType;", "(Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "currentCoroutineContext", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "cancel", "", "message", "", "cause", "", "Ljava/util/concurrent/CancellationException;", "Lkotlinx/coroutines/CancellationException;", "ensureActive", "plus", "kotlinx-coroutines-core"}, k = 2, mv = {1, 6, 0}, xi = 48)
  /* compiled from: 0172 */
  public final class CoroutineScopeKt {
      public static final CoroutineScope CoroutineScope(CoroutineContext context) {
          return new ContextScope(context.get(Job.Key) != null ? context : context.plus(JobKt.Job$default((Job) null, 1, (Object) null)));
      }
  
      public static final CoroutineScope MainScope() {
          return new ContextScope(SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null).plus(Dispatchers.getMain()));
      }
  
      public static final void cancel(CoroutineScope $this$cancel, String message, Throwable cause) {
          cancel($this$cancel, ExceptionsKt.CancellationException(message, cause));
      }
  
      public static final void cancel(CoroutineScope $this$cancel, CancellationException cause) {
          Job job = (Job) $this$cancel.getCoroutineContext().get(Job.Key);
          if (job != null) {
              job.cancel(cause);
              return;
          }
          String stringPlus = Intrinsics.stringPlus("Scope cannot be cancelled because it does not have a job: ", $this$cancel);
          Log1F380D.a((Object) stringPlus);
          throw new IllegalStateException(stringPlus.toString());
      }
  
      public static /* synthetic */ void cancel$default(CoroutineScope coroutineScope, String str, Throwable th, int i, Object obj) {
          if ((i & 2) != 0) {
              th = null;
          }
          cancel(coroutineScope, str, th);
      }
  
      public static /* synthetic */ void cancel$default(CoroutineScope coroutineScope, CancellationException cancellationException, int i, Object obj) {
          if ((i & 1) != 0) {
              cancellationException = null;
          }
          cancel(coroutineScope, cancellationException);
      }
  
      public static final <R> Object coroutineScope(Function2<? super CoroutineScope, ? super Continuation<? super R>, ? extends Object> block, Continuation<? super R> $completion) {
          Continuation<? super R> continuation = $completion;
          ScopeCoroutine scopeCoroutine = new ScopeCoroutine(continuation.getContext(), continuation);
          Object startUndispatchedOrReturn = UndispatchedKt.startUndispatchedOrReturn(scopeCoroutine, scopeCoroutine, block);
          if (startUndispatchedOrReturn == IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
              DebugProbesKt.probeCoroutineSuspended($completion);
          }
          return startUndispatchedOrReturn;
      }
  
      public static final Object currentCoroutineContext(Continuation<? super CoroutineContext> $completion) {
          return $completion.getContext();
      }
  
      /* JADX WARNING: type inference failed for: r0v2, types: [java.lang.Throwable, kotlin.coroutines.Continuation] */
      private static final Object currentCoroutineContext$$forInline(Continuation<? super CoroutineContext> $completion) {
          InlineMarker.mark(3);
          ? r0 = 0;
          r0.getContext();
          throw r0;
      }
  
      public static final void ensureActive(CoroutineScope $this$ensureActive) {
          JobKt.ensureActive($this$ensureActive.getCoroutineContext());
      }
  
      public static final boolean isActive(CoroutineScope $this$isActive) {
          Job job = (Job) $this$isActive.getCoroutineContext().get(Job.Key);
          if (job == null) {
              return true;
          }
          return job.isActive();
      }
  
      public static /* synthetic */ void isActive$annotations(CoroutineScope coroutineScope) {
      }
  
      public static final CoroutineScope plus(CoroutineScope $this$plus, CoroutineContext context) {
          return new ContextScope($this$plus.getCoroutineContext().plus(context));
      }
  }
  