function _array_like_to_array(arr, len) {
    if (len == null || len > arr.length) len = arr.length;
    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
    return arr2;
}
function _array_with_holes(arr) {
    if (Array.isArray(arr)) return arr;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
    try {
        var info = gen[key](arg);
        var value = info.value;
    } catch (error) {
        reject(error);
        return;
    }
    if (info.done) {
        resolve(value);
    } else {
        Promise.resolve(value).then(_next, _throw);
    }
}
function _async_to_generator(fn) {
    return function() {
        var self = this, args = arguments;
        return new Promise(function(resolve, reject) {
            var gen = fn.apply(self, args);
            function _next(value) {
                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
            }
            function _throw(err) {
                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
            }
            _next(undefined);
        });
    };
}
function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _iterable_to_array_limit(arr, i) {
    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;
    var _s, _e;
    try {
        for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
            _arr.push(_s.value);
            if (i && _arr.length === i) break;
        }
    } catch (err) {
        _d = true;
        _e = err;
    } finally{
        try {
            if (!_n && _i["return"] != null) _i["return"]();
        } finally{
            if (_d) throw _e;
        }
    }
    return _arr;
}
function _non_iterable_rest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function _sliced_to_array(arr, i) {
    return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
}
function _unsupported_iterable_to_array(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _array_like_to_array(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
function _ts_generator(thisArg, body) {
    var f, y, t, _ = {
        label: 0,
        sent: function() {
            if (t[0] & 1) throw t[1];
            return t[1];
        },
        trys: [],
        ops: []
    }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
    return d(g, "next", {
        value: verb(0)
    }), d(g, "throw", {
        value: verb(1)
    }), d(g, "return", {
        value: verb(2)
    }), typeof Symbol === "function" && d(g, Symbol.iterator, {
        value: function() {
            return this;
        }
    }), g;
    function verb(n) {
        return function(v) {
            return step([
                n,
                v
            ]);
        };
    }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while(g && (g = 0, op[0] && (_ = 0)), _)try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [
                op[0] & 2,
                t.value
            ];
            switch(op[0]){
                case 0:
                case 1:
                    t = op;
                    break;
                case 4:
                    _.label++;
                    return {
                        value: op[1],
                        done: false
                    };
                case 5:
                    _.label++;
                    y = op[1];
                    op = [
                        0
                    ];
                    continue;
                case 7:
                    op = _.ops.pop();
                    _.trys.pop();
                    continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                        _ = 0;
                        continue;
                    }
                    if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                        _.label = op[1];
                        break;
                    }
                    if (op[0] === 6 && _.label < t[1]) {
                        _.label = t[1];
                        t = op;
                        break;
                    }
                    if (t && _.label < t[2]) {
                        _.label = t[2];
                        _.ops.push(op);
                        break;
                    }
                    if (t[2]) _.ops.pop();
                    _.trys.pop();
                    continue;
            }
            op = body.call(thisArg, _);
        } catch (e) {
            op = [
                6,
                e
            ];
            y = 0;
        } finally{
            f = t = 0;
        }
        if (op[0] & 5) throw op[1];
        return {
            value: op[0] ? op[1] : void 0,
            done: true
        };
    }
}
import { CloseCircleFill, FileCheckFill, WarningFill } from "@sofa-design/icons";
import { Checkbox, ConfigProvider, Divider, Tooltip } from "antd";
import React, { useContext } from "react";
import { useRefFunction } from "../../Hooks/useRefFunction";
import { I18nContext } from "../../I18n";
import { useStyle } from "../style";
import { TaskStatusData } from "../types/HistoryData";
import { formatTime } from "../utils";
import { HistoryActionsBox } from "./HistoryActionsBox";
import { HistoryRunningIcon } from "./HistoryRunningIcon";
var TaskIconMap = function(prefixCls, hashId) {
    return {
        success: /*#__PURE__*/ React.createElement("div", {
            className: "".concat(prefixCls, "-task-icon ").concat(hashId)
        }, /*#__PURE__*/ React.createElement(FileCheckFill, null)),
        error: /*#__PURE__*/ React.createElement("div", {
            className: "".concat(prefixCls, "-task-icon ").concat(hashId)
        }, /*#__PURE__*/ React.createElement(WarningFill, null)),
        cancel: /*#__PURE__*/ React.createElement("div", {
            className: "".concat(prefixCls, "-task-icon ").concat(hashId)
        }, /*#__PURE__*/ React.createElement(CloseCircleFill, null))
    };
};
var FADE_OUT_GRADIENT = 'linear-gradient(to left, transparent, black 20%)';
var getMaskStyle = function(isOverflow) {
    return {
        WebkitMaskImage: isOverflow ? FADE_OUT_GRADIENT : 'none',
        maskImage: isOverflow ? FADE_OUT_GRADIENT : 'none'
    };
};
/**
 * 文本溢出检测的额外滚动偏移量，用于确保文本滚动动画的平滑过渡
 * 当文本滚动到末尾时，这个偏移量会让文本多滚动一段距离，使其看起来更自然
 */ var EXTRA_SCROLL_OFFSET = 100;
/**
 * 检查自定义操作区域是否有效
 * @param extra - 自定义操作区域内容
 * @returns 是否应该渲染自定义操作区域
 */ var isValidCustomOperation = function(extra) {
    if (!extra) return false;
    if (/*#__PURE__*/ React.isValidElement(extra)) return true;
    if (typeof extra === 'string' && extra.trim()) return true;
    if (Array.isArray(extra) && extra.some(function(item) {
        return isValidCustomOperation(item);
    })) return true;
    return false;
};
/**
 * 自定义 hook，用于检测文本溢出并设置相关样式
 * @param text - 需要检测溢出的文本内容
 * @returns 包含文本溢出状态和 ref 的对象
 */ var useTextOverflow = function(text) {
    var textRef = React.useRef(null);
    var _React_useState = _sliced_to_array(React.useState(false), 2), isTextOverflow = _React_useState[0], setIsTextOverflow = _React_useState[1];
    React.useLayoutEffect(function() {
        var el = textRef.current;
        if (!el) return;
        var isOverflow = el.scrollWidth > el.clientWidth;
        // 仅在 isOverflow 状态变化时更新，避免不必要的渲染
        setIsTextOverflow(function(prev) {
            return prev === isOverflow ? prev : isOverflow;
        });
        el.setAttribute('data-overflow', String(isOverflow));
        if (isOverflow) {
            var scrollDistance = -(el.scrollWidth - el.clientWidth + EXTRA_SCROLL_OFFSET);
            el.style.setProperty('--scroll-width', "".concat(scrollDistance, "px"));
        }
    }, [
        text
    ]); // 仅在文本内容变化时重新计算
    return {
        textRef: textRef,
        isTextOverflow: isTextOverflow
    };
};
/**
 * 单行模式历史记录项组件
 *
 * 用于显示简单的历史记录项，只显示标题和时间，适用于聊天记录等简单内容
 *
 * @param props - 组件属性
 * @param props.item - 历史记录数据项
 * @param props.selectedIds - 当前选中的历史记录ID列表
 * @param props.onSelectionChange - 选择状态变化回调函数
 * @param props.onClick - 点击历史记录项的回调函数
 * @param props.onFavorite - 收藏/取消收藏的回调函数
 * @param props.onDeleteItem - 删除历史记录项的回调函数
 * @param props.agent - 智能代理相关配置和回调
 * @param props.extra - 额外的渲染内容
 *
 * @returns 单行模式的历史记录项组件
 */ var HistoryItemSingle = /*#__PURE__*/ React.memo(function(param) {
    var item = param.item, selectedIds = param.selectedIds, onSelectionChange = param.onSelectionChange, onClick = param.onClick, onFavorite = param.onFavorite, onDeleteItem = param.onDeleteItem, agent = param.agent, extra = param.extra, runningId = param.runningId, customOperationExtra = param.customOperationExtra, itemDateFormatter = param.itemDateFormatter;
    var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
    var prefixCls = getPrefixCls('agentic-chat-history-menu');
    var hashId = useStyle(prefixCls).hashId;
    var displayText = React.useMemo(function() {
        return item.displayTitle || item.sessionTitle;
    }, [
        item.displayTitle,
        item.sessionTitle
    ]);
    var _useTextOverflow = useTextOverflow(displayText), textRef = _useTextOverflow.textRef, isTextOverflow = _useTextOverflow.isTextOverflow;
    var isRunning = React.useMemo(function() {
        return runningId === null || runningId === void 0 ? void 0 : runningId.includes(String(item.id || ''));
    }, [
        runningId,
        item.id
    ]);
    var isSelected = React.useMemo(function() {
        return selectedIds.includes(item.sessionId);
    }, [
        selectedIds,
        item.sessionId
    ]);
    var handleClick = useRefFunction(function(e) {
        e.stopPropagation();
        e.preventDefault();
        onClick(item.sessionId, item);
    });
    /**
     * 处理复选框状态变化事件
     * @param e - 复选框变化事件对象
     */ var handleCheckboxChange = useRefFunction(function(e) {
        e.stopPropagation();
        onSelectionChange(item.sessionId, e.target.checked);
    });
    /**
     * 处理删除历史记录项事件
     */ var handleDelete = useRefFunction(function() {
        return _async_to_generator(function() {
            return _ts_generator(this, function(_state) {
                switch(_state.label){
                    case 0:
                        if (!onDeleteItem) return [
                            3,
                            2
                        ];
                        return [
                            4,
                            onDeleteItem(item.sessionId)
                        ];
                    case 1:
                        _state.sent();
                        _state.label = 2;
                    case 2:
                        return [
                            2
                        ];
                }
            });
        })();
    });
    /**
     * 渲染单行模式的历史记录项
     * @returns 历史记录项组件
     */ return /*#__PURE__*/ React.createElement("div", {
        style: {
            display: 'flex',
            justifyContent: 'space-between',
            gap: 8,
            minWidth: 140,
            alignItems: 'center',
            width: '100%'
        },
        onClick: handleClick
    }, (agent === null || agent === void 0 ? void 0 : agent.onSelectionChange) && /*#__PURE__*/ React.createElement(Checkbox, {
        checked: isSelected,
        onChange: handleCheckboxChange
    }), isRunning && /*#__PURE__*/ React.createElement("div", {
        style: {
            flexShrink: 0,
            display: 'flex',
            alignItems: 'center',
            justifyContent: 'center'
        }
    }, /*#__PURE__*/ React.createElement(HistoryRunningIcon, {
        width: 16,
        height: 16,
        animated: true,
        duration: 2
    })), /*#__PURE__*/ React.createElement("div", {
        style: {
            display: 'flex',
            alignItems: 'center',
            flex: 1,
            minWidth: 0,
            gap: 8
        }
    }, /*#__PURE__*/ React.createElement("div", {
        style: {
            flex: 1,
            minWidth: 0,
            overflow: 'hidden'
        }
    }, /*#__PURE__*/ React.createElement("div", {
        ref: textRef,
        style: _object_spread({
            position: 'relative',
            width: 'calc(100% - 10px)',
            overflow: 'hidden'
        }, getMaskStyle(isTextOverflow))
    }, /*#__PURE__*/ React.createElement(Tooltip, {
        title: isTextOverflow ? displayText : null,
        mouseEnterDelay: 0.3,
        open: isTextOverflow ? undefined : false
    }, /*#__PURE__*/ React.createElement("div", {
        style: {
            whiteSpace: 'nowrap',
            font: isSelected ? 'var(--font-text-h6-base)' : 'var(--font-text-body-base)',
            letterSpacing: 'var(--letter-spacing-body-base, normal)',
            color: 'var(--color-gray-text-default)'
        }
    }, displayText))))), /*#__PURE__*/ React.createElement("div", {
        style: {
            flexShrink: 0,
            display: 'flex',
            alignItems: 'center',
            gap: 4
        }
    }, /*#__PURE__*/ React.createElement(HistoryActionsBox, {
        onDeleteItem: onDeleteItem ? handleDelete : undefined,
        agent: agent,
        item: item,
        onFavorite: onFavorite
    }, itemDateFormatter ? itemDateFormatter(item.gmtCreate) : formatTime(item.gmtCreate)), isValidCustomOperation(customOperationExtra) && /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-extra-actions ").concat(hashId)
    }, customOperationExtra)), extra === null || extra === void 0 ? void 0 : extra(item));
});
HistoryItemSingle.displayName = 'HistoryItemSingle';
/**
 * 多行模式历史记录项组件
 *
 * 用于显示复杂的历史记录项，包含图标、标题、描述和时间，适用于任务记录等复杂内容
 *
 * @param props - 组件属性
 * @param props.item - 历史记录数据项
 * @param props.selectedIds - 当前选中的历史记录ID列表
 * @param props.onSelectionChange - 选择状态变化回调函数
 * @param props.onClick - 点击历史记录项的回调函数
 * @param props.onFavorite - 收藏/取消收藏的回调函数
 * @param props.onDeleteItem - 删除历史记录项的回调函数
 * @param props.agent - 智能代理相关配置和回调
 * @param props.extra - 额外的渲染内容
 * @param props.type - 历史记录类型，影响图标和描述的显示逻辑
 * @param props.customOperationExtra - 自定义操作区域
 *
 * @returns 多行模式的历史记录项组件
 */ var HistoryItemMulti = /*#__PURE__*/ React.memo(function(param) {
    var item = param.item, selectedIds = param.selectedIds, onSelectionChange = param.onSelectionChange, onClick = param.onClick, onFavorite = param.onFavorite, onDeleteItem = param.onDeleteItem, agent = param.agent, extra = param.extra, type = param.type, runningId = param.runningId, customOperationExtra = param.customOperationExtra, itemDateFormatter = param.itemDateFormatter;
    var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
    var prefixCls = getPrefixCls('agentic-chat-history-menu');
    var hashId = useStyle(prefixCls).hashId;
    var displayText = React.useMemo(function() {
        return item.displayTitle || item.sessionTitle;
    }, [
        item.displayTitle,
        item.sessionTitle
    ]);
    var _useTextOverflow = useTextOverflow(displayText), textRef = _useTextOverflow.textRef, isTextOverflow = _useTextOverflow.isTextOverflow;
    var isTask = React.useMemo(function() {
        return type === 'task';
    }, [
        type
    ]);
    var locale = React.useContext(I18nContext).locale;
    var shouldShowIcon = React.useMemo(function() {
        return isTask && (!!item.icon || TaskStatusData.includes(item.status));
    }, [
        isTask,
        item.icon,
        item.status
    ]);
    var shouldShowDescription = React.useMemo(function() {
        return isTask && !!item.description;
    }, [
        isTask,
        item.description
    ]);
    var isRunning = React.useMemo(function() {
        return runningId === null || runningId === void 0 ? void 0 : runningId.includes(String(item.id || ''));
    }, [
        runningId,
        item.id
    ]);
    var isSelected = React.useMemo(function() {
        return selectedIds.includes(item.sessionId);
    }, [
        selectedIds,
        item.sessionId
    ]);
    /**
     * 处理点击事件
     * @param e - 鼠标点击事件对象
     */ var handleClick = useRefFunction(function(e) {
        e.stopPropagation();
        e.preventDefault();
        onClick(item.sessionId, item);
    });
    /**
     * 处理复选框状态变化事件
     * @param e - 复选框变化事件对象
     */ var handleCheckboxChange = useRefFunction(function(e) {
        e.stopPropagation();
        onSelectionChange(item.sessionId, e.target.checked);
    });
    /**
     * 处理删除事件
     */ var handleDelete = useRefFunction(function() {
        return _async_to_generator(function() {
            return _ts_generator(this, function(_state) {
                switch(_state.label){
                    case 0:
                        if (!onDeleteItem) return [
                            3,
                            2
                        ];
                        return [
                            4,
                            onDeleteItem(item.sessionId)
                        ];
                    case 1:
                        _state.sent();
                        _state.label = 2;
                    case 2:
                        return [
                            2
                        ];
                }
            });
        })();
    });
    /**
     * 渲染多行模式的历史记录项
     * @returns 历史记录项组件
     */ return /*#__PURE__*/ React.createElement("div", {
        style: {
            display: 'flex',
            justifyContent: 'space-between',
            gap: 8,
            minWidth: 140,
            alignItems: 'center',
            width: '100%'
        },
        onClick: handleClick
    }, (agent === null || agent === void 0 ? void 0 : agent.onSelectionChange) && /*#__PURE__*/ React.createElement(Checkbox, {
        checked: isSelected,
        onChange: handleCheckboxChange,
        style: {
            marginTop: 4
        }
    }), (shouldShowIcon || isRunning) && /*#__PURE__*/ React.createElement("div", {
        style: {
            flexShrink: 0,
            display: 'flex',
            alignItems: 'center',
            justifyContent: 'center'
        }
    }, isRunning ? /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-task-icon ").concat(hashId)
    }, /*#__PURE__*/ React.createElement(HistoryRunningIcon, {
        width: 16,
        height: 16,
        animated: true,
        duration: 2,
        color: "var(--color-primary-text-secondary)"
    })) : /*#__PURE__*/ React.isValidElement(item.icon) ? item.icon : item.icon ? /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-task-icon ").concat(hashId)
    }, item.icon || (isTask ? TaskIconMap(prefixCls, hashId)[item.status] : '📄')) : TaskIconMap(prefixCls, hashId)[item.status]), /*#__PURE__*/ React.createElement("div", {
        style: {
            display: 'flex',
            alignItems: 'flex-start',
            flex: 1,
            minWidth: 0,
            gap: 8
        }
    }, /*#__PURE__*/ React.createElement("div", {
        style: {
            flex: 1,
            minWidth: 0,
            overflow: 'hidden',
            display: 'flex',
            flexDirection: 'column'
        }
    }, /*#__PURE__*/ React.createElement("div", {
        ref: textRef,
        style: _object_spread({
            position: 'relative',
            maxWidth: 'calc(100% - 10px)',
            overflow: 'hidden'
        }, getMaskStyle(isTextOverflow))
    }, /*#__PURE__*/ React.createElement(Tooltip, {
        title: isTextOverflow ? displayText : null,
        mouseEnterDelay: 0.3,
        open: isTextOverflow ? undefined : false
    }, /*#__PURE__*/ React.createElement("div", {
        style: {
            whiteSpace: 'nowrap',
            font: isSelected ? 'var(--font-text-h6-base)' : 'var(--font-text-body-base)',
            color: 'var(--color-gray-text-default)'
        }
    }, displayText))), shouldShowDescription && (item.description || isTask) && /*#__PURE__*/ React.createElement(Tooltip, {
        open: typeof item.description === 'string' && item.description.length > 20 ? undefined : false,
        title: item.description || (isTask ? (locale === null || locale === void 0 ? void 0 : locale['task.default']) || '任务' : '')
    }, /*#__PURE__*/ React.createElement("div", {
        style: {
            display: 'flex',
            alignItems: 'center',
            font: 'var(--font-text-body-xs)',
            color: 'var(--color-gray-text-secondary)',
            letterSpacing: 'var(--letter-spacing-body-xs, normal)'
        }
    }, /*#__PURE__*/ React.createElement("div", {
        style: {
            flex: 1,
            overflow: 'hidden',
            textOverflow: 'ellipsis',
            whiteSpace: 'nowrap'
        }
    }, item.description || (isTask ? (locale === null || locale === void 0 ? void 0 : locale['task.default']) || '任务' : '')), /*#__PURE__*/ React.createElement(Divider, {
        type: "vertical"
    }), /*#__PURE__*/ React.createElement("span", {
        style: {
            minWidth: 26
        }
    }, itemDateFormatter ? itemDateFormatter(item.gmtCreate) : formatTime(item.gmtCreate)))))), /*#__PURE__*/ React.createElement("div", {
        style: {
            flexShrink: 0,
            display: 'flex',
            alignItems: 'center',
            gap: 4
        }
    }, /*#__PURE__*/ React.createElement(HistoryActionsBox, {
        onDeleteItem: onDeleteItem ? handleDelete : undefined,
        agent: agent,
        item: item,
        onFavorite: onFavorite
    }, itemDateFormatter ? itemDateFormatter(item.gmtCreate) : formatTime(item.gmtCreate)), isValidCustomOperation(customOperationExtra) && /*#__PURE__*/ React.createElement("div", {
        className: "".concat(prefixCls, "-extra-actions ").concat(hashId)
    }, customOperationExtra)), extra === null || extra === void 0 ? void 0 : extra(item));
});
HistoryItemMulti.displayName = 'HistoryItemMulti';
/**
 * 历史记录项组件 - 根据条件选择单行或多行模式
 *
 * 这是一个智能组件，会根据传入的属性自动选择合适的显示模式：
 * - 单行模式：适用于简单的聊天记录，只显示标题和时间
 * - 多行模式：适用于复杂的任务记录，显示图标、标题、描述和时间
 *
 * 自动选择逻辑：
 * - 当 type 为 'task' 时，自动使用多行模式
 * - 当同时存在 icon 和 description 时，自动使用多行模式
 * - 其他情况使用单行模式
 *
 * @param props - 组件属性
 * @param props.item - 历史记录数据项
 * @param props.selectedIds - 当前选中的历史记录ID列表
 * @param props.onSelectionChange - 选择状态变化回调函数
 * @param props.onClick - 点击历史记录项的回调函数
 * @param props.onFavorite - 收藏/取消收藏的回调函数
 * @param props.onDeleteItem - 删除历史记录项的回调函数
 * @param props.agent - 智能代理相关配置和回调
 * @param props.extra - 额外的渲染内容
 * @param props.type - 历史记录类型，影响显示模式的选择
 *
 * @returns 根据条件渲染的单行或多行历史记录项组件
 *
 * @example
 * ```tsx
 * // 单行模式示例
 * <HistoryItem
 *   item={chatItem}
 *   selectedIds={selectedIds}
 *   onSelectionChange={handleSelectionChange}
 *   onClick={handleClick}
 *   type="chat"
 * />
 *
 * // 多行模式示例
 * <HistoryItem
 *   item={taskItem}
 *   selectedIds={selectedIds}
 *   onSelectionChange={handleSelectionChange}
 *   onClick={handleClick}
 *   type="task"
 * />
 * ```
 */ export var HistoryItem = /*#__PURE__*/ React.memo(function(param) {
    var item = param.item, selectedIds = param.selectedIds, onSelectionChange = param.onSelectionChange, onClick = param.onClick, onFavorite = param.onFavorite, onDeleteItem = param.onDeleteItem, agent = param.agent, extra = param.extra, type = param.type, runningId = param.runningId, customOperationExtra = param.customOperationExtra, itemDateFormatter = param.itemDateFormatter;
    var isTask = type === 'task';
    var shouldShowIcon = isTask && (!!item.icon || TaskStatusData.includes(item.status));
    var shouldShowDescription = isTask && !!item.description;
    var isMultiMode = isTask || shouldShowIcon && shouldShowDescription;
    /**
     * 获取组件的属性
     * @returns 组件属性
     */ var props = {
        item: item,
        selectedIds: selectedIds,
        onSelectionChange: onSelectionChange,
        onClick: onClick,
        onFavorite: onFavorite,
        onDeleteItem: onDeleteItem,
        agent: agent,
        extra: extra,
        type: type,
        runningId: runningId,
        customOperationExtra: customOperationExtra,
        itemDateFormatter: itemDateFormatter
    };
    /**
     * 根据模式选择渲染组件
     * @returns 历史记录项组件
     */ return isMultiMode ? /*#__PURE__*/ React.createElement(HistoryItemMulti, props) : /*#__PURE__*/ React.createElement(HistoryItemSingle, props);
});
HistoryItem.displayName = 'HistoryItem';
