import { FoldXMeasureId } from "../../../../../dataReshape/index.js";
const pivotColumnDimensions = (spec, context)=>{
    const result = {
        ...spec
    };
    const { advancedVSeed } = context;
    const dimensions = advancedVSeed.dimensions;
    const measures = advancedVSeed.measures ?? [];
    if (!dimensions) return result;
    const columnDimensions = dimensions.filter((dim)=>'column' === dim.encoding);
    const columns = columnDimensions.map((dim)=>{
        const baseConfig = {
            dimensionKey: dim.id,
            title: dim.alias ?? dim.id
        };
        if (dim.id === FoldXMeasureId) baseConfig.headerFormat = (title)=>{
            const measure = measures.find((m)=>m.id === title);
            return measure ? measure.alias ?? measure.id : title;
        };
        return baseConfig;
    });
    return {
        ...result,
        columns: columns
    };
};
export { pivotColumnDimensions };

//# sourceMappingURL=pivotColumnDimensions.js.map