"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatPivotValueLabel = void 0;
const field_1 = require("../../../../../types/field");
const formatting_1 = require("../../../../../utils/formatting");
const formatPivotValueLabel = (pivotReference, fieldsMap) => {
    if (!pivotReference.pivotValues?.[0]) {
        return '';
    }
    const pivotFieldId = pivotReference.pivotValues[0].field;
    const pivotField = fieldsMap[pivotFieldId];
    const pivotValue = pivotReference.pivotValues[0].value;
    if (pivotField && (0, field_1.isField)(pivotField)) {
        return (0, formatting_1.formatItemValue)(pivotField, pivotValue, false, undefined);
    }
    return (0, field_1.friendlyName)(String(pivotValue));
};
exports.formatPivotValueLabel = formatPivotValueLabel;
//# sourceMappingURL=formatPivotValueLabel.js.map