(function (_, kotlin_kotlin) {
  'use strict';
  //region block: imports
  var constructor = (class IteratorYieldResult {
    static [Symbol.hasInstance](instance) {
        return instance && (typeof instance === 'object') && (instance.done === false)
    }
    }.prototype).constructor;
  var iterator = kotlin_kotlin.$_$.w6;
  var CoroutineImpl = kotlin_kotlin.$_$.a5;
  var Unit_getInstance = kotlin_kotlin.$_$.p2;
  var protoOf = kotlin_kotlin.$_$.f6;
  var THROW_CCE = kotlin_kotlin.$_$.x8;
  var SequenceScope = kotlin_kotlin.$_$.v6;
  var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.l4;
  var classMeta = kotlin_kotlin.$_$.m5;
  var setMetadataFor = kotlin_kotlin.$_$.g6;
  var VOID = kotlin_kotlin.$_$.d;
  var SuspendFunction1 = kotlin_kotlin.$_$.b5;
  //endregion
  //region block: pre-declaration
  setMetadataFor(iteratorFor$slambda, 'iteratorFor$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]);
  //endregion
  function iteratorFor(source) {
    // Inline function 'js.iterable.JsIterator.iterator' call
    var this_0 = source[Symbol.iterator]();
    return iteratorFor_0(this_0);
  }
  function iteratorFor_0(source) {
    return iterator(iteratorFor$slambda_0(source, null));
  }
  function iteratorFor$slambda($source, resultContinuation) {
    this.$source_1 = $source;
    CoroutineImpl.call(this, resultContinuation);
  }
  protoOf(iteratorFor$slambda).invoke_5icac5_k$ = function ($this$iterator, $completion) {
    var tmp = this.create_f6q6qh_k$($this$iterator, $completion);
    tmp.set_result_xj64lm_k$(Unit_getInstance());
    tmp.set_exception_px07aa_k$(null);
    return tmp.doResume_5yljmg_k$();
  };
  protoOf(iteratorFor$slambda).invoke_qns8j1_k$ = function (p1, $completion) {
    return this.invoke_5icac5_k$(p1 instanceof SequenceScope ? p1 : THROW_CCE(), $completion);
  };
  protoOf(iteratorFor$slambda).doResume_5yljmg_k$ = function () {
    var suspendResult = this.get_result_iyg5d2_k$();
    $sm: do
      try {
        var tmp = this.get_state_iypx7s_k$();
        switch (tmp) {
          case 0:
            this.set_exceptionState_fex74n_k$(5);
            this.set_state_rjd8d0_k$(1);
            continue $sm;
          case 1:
            var tmp_0 = this;
            var tmp_1 = this.$source_1.next();
            tmp_0.tmp0_elvis_lhs0__1 = tmp_1 instanceof constructor ? tmp_1 : null;
            if (this.tmp0_elvis_lhs0__1 == null) {
              this.set_state_rjd8d0_k$(4);
              var tmp_2 = this;
              continue $sm;
            } else {
              this.WHEN_RESULT1__1 = this.tmp0_elvis_lhs0__1;
              this.set_state_rjd8d0_k$(2);
              continue $sm;
            }

          case 2:
            this.result2__1 = this.WHEN_RESULT1__1;
            this.set_state_rjd8d0_k$(3);
            suspendResult = this.$this$iterator_1.yield_3xhcex_k$(this.result2__1.value, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 3:
            this.set_state_rjd8d0_k$(1);
            continue $sm;
          case 4:
            return Unit_getInstance();
          case 5:
            throw this.get_exception_x0n6w6_k$();
        }
      } catch ($p) {
        var e = $p;
        if (this.get_exceptionState_wflpxn_k$() === 5) {
          throw e;
        } else {
          this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$());
          this.set_exception_px07aa_k$(e);
        }
      }
     while (true);
  };
  protoOf(iteratorFor$slambda).create_f6q6qh_k$ = function ($this$iterator, completion) {
    var i = new iteratorFor$slambda(this.$source_1, completion);
    i.$this$iterator_1 = $this$iterator;
    return i;
  };
  protoOf(iteratorFor$slambda).create_wyq9v6_k$ = function (value, completion) {
    return this.create_f6q6qh_k$(value instanceof SequenceScope ? value : THROW_CCE(), completion);
  };
  function iteratorFor$slambda_0($source, resultContinuation) {
    var i = new iteratorFor$slambda($source, resultContinuation);
    var l = function ($this$iterator, $completion) {
      return i.invoke_5icac5_k$($this$iterator, $completion);
    };
    l.$arity = 1;
    return l;
  }
  function toUint8Array(_this__u8e3s4) {
    // Inline function 'js.typedarrays.asInt8Array' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var array = _this__u8e3s4;
    return new Uint8Array(array.buffer, array.byteOffset, array.length);
  }
  function asInt8Array(_this__u8e3s4) {
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    return _this__u8e3s4;
  }
  return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js')));

//# sourceMappingURL=kotlin-js.js.map
