import { MeasureId } from "../../../../../dataReshape/index.js";
import { findAllMeasures } from "../../../../utils/measures/find.js";
const pivotRows = (spec, context)=>{
    const { advancedVSeed } = context;
    const dimensions = advancedVSeed.dimensionTree;
    const { encoding } = advancedVSeed;
    const rows = dimensions.filter((item)=>encoding.row?.includes(item.id));
    const allMeasures = findAllMeasures(advancedVSeed.measureTree);
    return {
        ...spec,
        rows: rows.map((item)=>{
            const res = {
                dimensionKey: item.id,
                title: item.alias || item.id,
                width: 'auto'
            };
            if (item.id === MeasureId) res.headerFormat = (measureId)=>{
                const measure = allMeasures.find((m)=>m.id === measureId);
                return measure?.alias ?? measureId;
            };
            return res;
        })
    };
};
export { pivotRows };

//# sourceMappingURL=pivotRows.js.map