"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPieInternalLabelStyle = exports.getPieLabelLineStyle = exports.getPieExternalLabelStyle = exports.getPieSliceStyle = exports.calculateBorderRadiusForSlice = void 0;
const themeColors_1 = require("./themeColors");
/**
 * Calculate border radius based on slice percentage
 * Uses a smooth scaling formula to prevent over-rounding on small slices
 */
const calculateBorderRadiusForSlice = (percent) => {
    const MAX_RADIUS = 4;
    const MIN_RADIUS = 2;
    const THRESHOLD_PERCENT = 2;
    if (percent >= THRESHOLD_PERCENT) {
        return MAX_RADIUS;
    }
    // For smaller slices, scale proportionally to create a smooth curve from MIN_RADIUS to MAX_RADIUS
    const scale = percent / THRESHOLD_PERCENT;
    return MIN_RADIUS + (MAX_RADIUS - MIN_RADIUS) * scale;
};
exports.calculateBorderRadiusForSlice = calculateBorderRadiusForSlice;
/**
 * Get pie slice styling for series-level configuration
 * Note: borderRadius is applied per data point in the frontend
 * to enable dynamic sizing based on slice percentage
 */
const getPieSliceStyle = (isDonut) => isDonut
    ? {
        itemStyle: {
            borderColor: themeColors_1.BACKGROUND,
            borderWidth: 2,
        },
    }
    : {};
exports.getPieSliceStyle = getPieSliceStyle;
/**
 * Get external label styling for pie charts
 */
const getPieExternalLabelStyle = () => ({
    fontSize: 12,
    lineHeight: 18,
    // Rich text styles for different parts of the label
    rich: {
        name: {
            color: themeColors_1.GRAY_6,
            fontWeight: 500,
            fontSize: 12,
            lineHeight: 18,
        },
        value: {
            color: themeColors_1.GRAY_7,
            fontWeight: 600,
            fontSize: 12,
            lineHeight: 18,
        },
    },
});
exports.getPieExternalLabelStyle = getPieExternalLabelStyle;
/**
 * Get label line (connector) styling for pie chart external labels
 */
const getPieLabelLineStyle = () => ({
    lineStyle: {
        color: themeColors_1.GRAY_3,
    },
});
exports.getPieLabelLineStyle = getPieLabelLineStyle;
/**
 * Get internal label styling for pie charts (labels inside slices)
 */
const getPieInternalLabelStyle = () => ({
    fontWeight: 500,
    fontSize: 12,
});
exports.getPieInternalLabelStyle = getPieInternalLabelStyle;
//# sourceMappingURL=pieChartStyles.js.map