"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useChartTooltipState = void 0;
var react_1 = require("react");
var useChartTooltipState = function () {
    var _a = (0, react_1.useState)({ active: false }), tooltipState = _a[0], setTooltipState = _a[1];
    var showTooltip = (0, react_1.useCallback)(function (data, coordinate) {
        setTooltipState({
            active: true,
            label: data.label,
            coordinate: coordinate,
            payload: [{ value: data.value, payload: data, name: data.label }]
        });
    }, []);
    var hideTooltip = (0, react_1.useCallback)(function () {
        setTooltipState(function (state) { return (__assign(__assign({}, state), { active: false })); });
    }, []);
    return { tooltipState: tooltipState, showTooltip: showTooltip, hideTooltip: hideTooltip };
};
exports.useChartTooltipState = useChartTooltipState;
