content: package kotlinx.coroutines.flow.internal;
  
  import kotlin.Metadata;
  import kotlin.Unit;
  import kotlin.coroutines.Continuation;
  import kotlin.coroutines.CoroutineContext;
  import kotlin.jvm.functions.Function2;
  import kotlinx.coroutines.Job;
  import kotlinx.coroutines.flow.Flow;
  import kotlinx.coroutines.flow.FlowCollector;
  import kotlinx.coroutines.internal.ScopeCoroutine;
  
  @Metadata(d1 = {"\u0000:\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u001aN\u0010\u0000\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\u0004\b\u0000\u0010\u00022/\b\u0005\u0010\u0003\u001a)\b\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u00020\u0005\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00070\u0006\u0012\u0006\u0012\u0004\u0018\u00010\b0\u0004¢\u0006\u0002\b\tH\bø\u0001\u0000¢\u0006\u0002\u0010\n\u001a\u0018\u0010\u000b\u001a\u00020\u0007*\u0006\u0012\u0002\b\u00030\f2\u0006\u0010\r\u001a\u00020\u000eH\u0001\u001a\u001b\u0010\u000f\u001a\u0004\u0018\u00010\u0010*\u0004\u0018\u00010\u00102\b\u0010\u0011\u001a\u0004\u0018\u00010\u0010H\u0010\u0002\u0004\n\u0002\b\u0019¨\u0006\u0012"}, d2 = {"unsafeFlow", "Lkotlinx/coroutines/flow/Flow;", "T", "block", "Lkotlin/Function2;", "Lkotlinx/coroutines/flow/FlowCollector;", "Lkotlin/coroutines/Continuation;", "", "", "Lkotlin/ExtensionFunctionType;", "(Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;", "checkContext", "Lkotlinx/coroutines/flow/internal/SafeCollector;", "currentContext", "Lkotlin/coroutines/CoroutineContext;", "transitiveCoroutineParent", "Lkotlinx/coroutines/Job;", "collectJob", "kotlinx-coroutines-core"}, k = 2, mv = {1, 6, 0}, xi = 48)
  /* compiled from: SafeCollector.common.kt */
  public final class SafeCollector_commonKt {
      public static final void checkContext(SafeCollector<?> $this$checkContext, CoroutineContext currentContext) {
          if (((Number) currentContext.fold(0, new SafeCollector_commonKt$checkContext$result$1($this$checkContext))).intValue() != $this$checkContext.collectContextSize) {
              throw new IllegalStateException(("Flow invariant is violated:\n\t\tFlow was collected in " + $this$checkContext.collectContext + ",\n\t\tbut emission happened in " + currentContext + ".\n\t\tPlease refer to 'flow' documentation or use 'flowOn' instead").toString());
          }
      }
  
      public static final Job transitiveCoroutineParent(Job $this$transitiveCoroutineParent, Job collectJob) {
          Job job = $this$transitiveCoroutineParent;
          while (job != null) {
              if (job == collectJob || !(job instanceof ScopeCoroutine)) {
                  return job;
              }
              job = ((ScopeCoroutine) job).getParent$kotlinx_coroutines_core();
          }
          return null;
      }
  
      public static final <T> Flow<T> unsafeFlow(Function2<? super FlowCollector<? super T>, ? super Continuation<? super Unit>, ? extends Object> block) {
          return new SafeCollector_commonKt$unsafeFlow$1(block);
      }
  }
  