'use strict';

var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
var _toObject = require('./_to-object-329a650b.js');
var es6_string_iterator = require('./es6.string.iterator-cc0bbaa4.js');
var _iterDetect = require('./_iter-detect-60b2f026.js');
var core_getIteratorMethod = require('./core.get-iterator-method-f62321d4.js');

var _anInstance = function (it, Constructor, name, forbiddenField) {
  if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
    throw TypeError(name + ': incorrect invocation!');
  } return it;
};

var _forOf = _commonjsHelpers.createCommonjsModule(function (module) {
var BREAK = {};
var RETURN = {};
var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod.core_getIteratorMethod(iterable);
  var f = _toObject._ctx(fn, that, entries ? 2 : 1);
  var index = 0;
  var length, step, iterator, result;
  if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  // fast case for arrays with default iterator
  if (_iterDetect._isArrayIter(iterFn)) for (length = _toObject._toLength(iterable.length); length > index; index++) {
    result = entries ? f(_toObject._anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
    if (result === BREAK || result === RETURN) return result;
  } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
    result = _iterDetect._iterCall(iterator, f, step.value, entries);
    if (result === BREAK || result === RETURN) return result;
  }
};
exports.BREAK = BREAK;
exports.RETURN = RETURN;
});

var _redefineAll = function (target, src, safe) {
  for (var key in src) {
    if (safe && target[key]) target[key] = src[key];
    else _toObject._hide(target, key, src[key]);
  } return target;
};

var SPECIES = es6_string_iterator._wks('species');

var _setSpecies = function (KEY) {
  var C = typeof _toObject._core[KEY] == 'function' ? _toObject._core[KEY] : _toObject._global[KEY];
  if (_toObject._descriptors && C && !C[SPECIES]) _toObject._objectDp.f(C, SPECIES, {
    configurable: true,
    get: function () { return this; }
  });
};

exports._anInstance = _anInstance;
exports._forOf = _forOf;
exports._redefineAll = _redefineAll;
exports._setSpecies = _setSpecies;
