import { isNullish } from "remeda";
import { createDimensionContent, createMarkContent } from "./tooltip.js";
import { findAllMeasures } from "../../../../utils/index.js";
import { getTooltipStyle } from "./tooltipStyle.js";
const tooltipPrimary = (spec, context)=>{
    const result = {
        ...spec
    };
    const { advancedVSeed, vseed } = context;
    const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed;
    const baseConfig = advancedVSeed.config[chartType];
    const { tooltip = {
        enable: true
    } } = baseConfig;
    const { enable } = tooltip;
    const foldInfoList = datasetReshapeInfo[0].foldInfoList;
    const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
    result.tooltip = {
        style: getTooltipStyle(tooltip),
        visible: enable,
        mark: {
            title: {
                visible: false
            },
            content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), foldInfoList[0], unfoldInfo)
        },
        dimension: {
            title: {
                visible: true
            },
            content: createDimensionContent(dimensions, measures, foldInfoList[0], unfoldInfo)
        }
    };
    return result;
};
const tooltipSecondary = (spec, context)=>{
    const result = {
        ...spec
    };
    const { advancedVSeed, vseed } = context;
    const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed;
    const baseConfig = advancedVSeed.config[chartType];
    const { tooltip = {
        enable: true
    } } = baseConfig;
    const { enable } = tooltip;
    if (isNullish(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
    const foldInfoList = datasetReshapeInfo[0].foldInfoList;
    const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
    result.tooltip = {
        visible: enable,
        mark: {
            title: {
                visible: false
            },
            content: createMarkContent(encoding.tooltip || [], dimensions, findAllMeasures(vseed.measures), foldInfoList[1], unfoldInfo)
        },
        dimension: {
            title: {
                visible: true
            },
            content: createDimensionContent(dimensions, measures, foldInfoList[1], unfoldInfo)
        }
    };
    return result;
};
export { tooltipPrimary, tooltipSecondary };

//# sourceMappingURL=tooltipDualAxis.js.map