import { selector } from "../../../../../dataSelector/index.js";
import { isEmpty, isNullish } from "remeda";
const outlierStyle_outlierStyle = (spec, context)=>{
    const { advancedVSeed, vseed } = context;
    const { markStyle, config } = advancedVSeed;
    const { outlierStyle } = markStyle;
    const { chartType } = vseed;
    const theme = config?.[chartType]?.outlierStyle;
    const result = {
        ...spec,
        outlier: {
            style: {
                fill: theme?.pointColor,
                lineWidth: theme?.pointBorderWidth,
                stroke: theme?.pointBorderColor
            }
        }
    };
    if (isNullish(outlierStyle) || isEmpty(outlierStyle)) return result;
    const outlierStyles = Array.isArray(outlierStyle) ? outlierStyle : [
        outlierStyle
    ];
    const customMap = outlierStyles.reduce((result, style, index)=>{
        const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize, pointVisible = true } = style;
        const lineDash = 'dashed' === pointBorderStyle ? [
            5,
            2
        ] : 'dotted' === pointBorderStyle ? [
            2,
            5
        ] : [
            0,
            0
        ];
        return {
            ...result,
            [`custom${index + 1}`]: {
                level: index + 1,
                filter: (datum)=>{
                    if (selector(datum, style.selector)) return true;
                    return false;
                },
                style: {
                    visible: pointVisible,
                    size: pointSize,
                    fill: pointColor,
                    fillOpacity: pointColorOpacity,
                    stroke: pointBorderColor,
                    lineWidth: pointBorderWidth,
                    lineDash: lineDash
                }
            }
        };
    }, {});
    return {
        ...result,
        outlier: {
            ...result.outlier,
            state: {
                ...customMap
            }
        }
    };
};
export { outlierStyle_outlierStyle as outlierStyle };

//# sourceMappingURL=outlierStyle.js.map