import { unique } from "remeda";
import { MeasureId } from "../../../../../../dataReshape/index.js";
const addColorToEncoding = (dimensions, encoding, isMultiMeasure)=>{
    encoding.color = unique(dimensions.filter((item)=>'color' === item.encoding).map((item)=>item.id));
    const measureId = dimensions.find((item)=>item.id === MeasureId);
    if (isMultiMeasure && measureId && !measureId.encoding) encoding.color.push(MeasureId);
    if (0 === encoding.color.length) encoding.color = [
        MeasureId
    ];
};
const addDefaultColorEncoding = (uniqueDimIds, encoding, isMultiMeasure)=>{
    if (1 === uniqueDimIds.length && uniqueDimIds[0] === MeasureId) encoding.color = uniqueDimIds.slice(0);
    else if (isMultiMeasure) encoding.color = uniqueDimIds.slice(1);
    else encoding.color = uniqueDimIds.slice(1).filter((d)=>d !== MeasureId);
    if (0 === encoding.color.length) encoding.color = [
        MeasureId
    ];
};
export { addColorToEncoding, addDefaultColorEncoding };

//# sourceMappingURL=addColorToEncoding.js.map