import SetCache from "./_SetCache.js";
import arrayIncludes from "./_arrayIncludes.js";
import cacheHas from "./_cacheHas.js";
var nativeMin = Math.min;
function baseIntersection(arrays, iteratee, comparator) {
  var includes = arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  while (othIndex--) {
    var array = arrays[othIndex];
    maxLength = nativeMin(array.length, maxLength);
    caches[othIndex] = length >= 120 && array.length >= 120 ? new SetCache(othIndex && array) : void 0;
  }
  array = arrays[0];
  var index = -1, seen = caches[0];
  outer:
    while (++index < length && result.length < maxLength) {
      var value = array[index], computed = value;
      value = value !== 0 ? value : 0;
      if (!(seen ? cacheHas(seen, computed) : includes(result, computed))) {
        othIndex = othLength;
        while (--othIndex) {
          var cache = caches[othIndex];
          if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed))) {
            continue outer;
          }
        }
        if (seen) {
          seen.push(computed);
        }
        result.push(value);
      }
    }
  return result;
}
export {
  baseIntersection as default
};
//# sourceMappingURL=_baseIntersection.js.map
