{"version":3,"file":"intersection.mjs","names":[],"sources":["../../src/array/intersection.ts"],"sourcesContent":["/**\n * Creates an array of unique values that are included in all given arrays\n * @param arrays The arrays to process\n * @returns A new array of unique values present in all arrays\n * @example\n * intersection([1, 2, 3], [2, 3, 4]); // [2, 3]\n * intersection([1, 2, 3], [2, 3, 4], [2, 3, 5]); // [2, 3]\n */\nexport function intersection<T>(...arrays: T[][]): T[] {\n  if (arrays.length === 0) {\n    return [];\n  }\n\n  const firstArray = arrays[0];\n  if (!Array.isArray(firstArray)) {\n    return [];\n  }\n\n  // Create sets from all other arrays for efficient lookup\n  const otherSets = arrays.slice(1).map((arr) => new Set(arr));\n\n  const result: T[] = [];\n  const seen = new Set<T>();\n\n  for (const item of firstArray) {\n    // Check if item exists in all other arrays\n    if (otherSets.every((set) => set.has(item)) && !seen.has(item)) {\n      seen.add(item);\n      result.push(item);\n    }\n  }\n\n  return result;\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,aAAgB,GAAG,QAAoB;CACrD,IAAI,OAAO,WAAW,GACpB,OAAO,CAAC;CAGV,MAAM,aAAa,OAAO;CAC1B,IAAI,CAAC,MAAM,QAAQ,UAAU,GAC3B,OAAO,CAAC;CAIV,MAAM,YAAY,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,GAAG,CAAC;CAE3D,MAAM,SAAc,CAAC;CACrB,MAAM,uBAAO,IAAI,IAAO;CAExB,KAAK,MAAM,QAAQ,YAEjB,IAAI,UAAU,OAAO,QAAQ,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,GAAG;EAC9D,KAAK,IAAI,IAAI;EACb,OAAO,KAAK,IAAI;CAClB;CAGF,OAAO;AACT"}