function colorAdapter(ordinalPipe, linearPipe) {
    return (spec, context)=>{
        const { advancedVSeed, vseed } = context;
        if (isLinearColor(advancedVSeed, vseed)) return linearPipe(spec, context);
        return ordinalPipe(spec, context);
    };
}
const isLinearColor = (advancedVSeed, vseed)=>{
    const { encoding, chartType } = advancedVSeed;
    const measureIdList = (vseed.measures || advancedVSeed.measures).map((measure)=>measure.id);
    const { color = [] } = encoding;
    return 'heatmap' === chartType ? color.length >= 1 && color.every((c)=>measureIdList.includes(c)) : 1 === color.length && measureIdList.includes(color[0]);
};
const getColorMeasureId = (advancedVSeed, vseed)=>{
    if (isLinearColor(advancedVSeed, vseed)) {
        const { encoding } = advancedVSeed;
        const { color } = encoding;
        return color?.[0];
    }
};
export { colorAdapter, getColorMeasureId, isLinearColor };

//# sourceMappingURL=colorAdapter.js.map