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 _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 ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
function _object_without_properties(source, excluded) {
    if (source == null) return {};
    var target = {}, sourceKeys, key, i;
    if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
        sourceKeys = Reflect.ownKeys(source);
        for(i = 0; i < sourceKeys.length; i++){
            key = sourceKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
        return target;
    }
    target = _object_without_properties_loose(source, excluded);
    if (Object.getOwnPropertySymbols) {
        sourceKeys = Object.getOwnPropertySymbols(source);
        for(i = 0; i < sourceKeys.length; i++){
            key = sourceKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
    }
    return target;
}
function _object_without_properties_loose(source, excluded) {
    if (source == null) return {};
    var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
    for(i = 0; i < sourceKeys.length; i++){
        key = sourceKeys[i];
        if (excluded.indexOf(key) >= 0) continue;
        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
        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);
}
import { ConfigProvider } from "antd";
import classNames from "classnames";
import React, { memo, useContext, useMemo, useState } from "react";
import { BaseMarkdownEditor } from "../MarkdownEditor";
import { BorderBeamAnimation } from "./BorderBeamAnimation";
import { useFileUploadManager } from "./FileUploadManager";
import { useMarkdownInputFieldActions } from "./hooks/useMarkdownInputFieldActions";
import { useMarkdownInputFieldHandlers } from "./hooks/useMarkdownInputFieldHandlers";
import { useMarkdownInputFieldLayout } from "./hooks/useMarkdownInputFieldLayout";
import { useMarkdownInputFieldRefs } from "./hooks/useMarkdownInputFieldRefs";
import { useMarkdownInputFieldState } from "./hooks/useMarkdownInputFieldState";
import { useMarkdownInputFieldStyles } from "./hooks/useMarkdownInputFieldStyles";
import { QuickActions } from "./QuickActions";
import { SkillModeBar } from "./SkillModeBar";
import { useStyle } from "./style";
import { Suggestion } from "./Suggestion";
import TopOperatingArea from "./TopOperatingArea";
import { useAttachmentList, useBeforeTools, useSendActionsNode } from "./utils/renderHelpers";
import { useVoiceInputManager } from "./VoiceInputManager";
/**
 * MarkdownInputField 组件 - Markdown输入字段组件
 *
 * 该组件提供一个功能完整的Markdown输入框，支持实时预览、文件附件、
 * 快捷键发送、自动完成等功能。是聊天应用中的核心输入组件。
 *
 * @component
 * @description Markdown输入字段组件，支持实时预览和文件附件
 * @param {MarkdownInputFieldProps} props - 组件属性
 * @param {string} [props.value] - 输入框的值
 * @param {(value: string) => void} [props.onChange] - 值变化时的回调
 * @param {(value: string) => Promise<void>} [props.onSend] - 发送消息的回调
 * @param {string} [props.placeholder] - 占位符文本
 * @param {string} [props.triggerSendKey='Enter'] - 触发发送的快捷键（Enter 发送，Shift+Enter 换行）
 * @param {boolean} [props.disabled] - 是否禁用
 * @param {boolean} [props.typing] - 是否正在输入
 * @param {AttachmentProps} [props.attachment] - 附件配置
 * @param {string[]} [props.bgColorList] - 背景颜色列表，推荐使用3-4种颜色
 * @param {React.RefObject} [props.inputRef] - 输入框引用
 * @param {MarkdownRenderConfig} [props.markdownRenderConfig] - Markdown渲染配置
 * @param {SuggestionProps} [props.suggestion] - 自动完成配置
 *
 * @example
 * ```tsx
 * <MarkdownInputField
 *   value="# 标题"
 *   onChange={(value) => console.log(value)}
 *   onSend={(value) => Promise.resolve()}
 *   placeholder="请输入Markdown文本..."
 *   triggerSendKey="Enter"
 * />
 * ```
 *
 * @returns {React.ReactElement} 渲染的Markdown输入字段组件
 *
 * @remarks
 * - 支持实时Markdown预览
 * - 支持文件附件上传
 * - 支持快捷键发送消息
 * - 支持自动完成功能
 * - 支持自定义渲染配置
 */ var MarkdownInputFieldComponent = function(_0) {
    var tagInputProps = _0.tagInputProps, markdownProps = _0.markdownProps, _0_borderRadius = _0.borderRadius, borderRadius = _0_borderRadius === void 0 ? 16 : _0_borderRadius, onBlur = _0.onBlur, onFocus = _0.onFocus, _0_isShowTopOperatingArea = _0.isShowTopOperatingArea, isShowTopOperatingArea = _0_isShowTopOperatingArea === void 0 ? false : _0_isShowTopOperatingArea, props = _object_without_properties(_0, [
        "tagInputProps",
        "markdownProps",
        "borderRadius",
        "onBlur",
        "onFocus",
        "isShowTopOperatingArea"
    ]);
    var _ref;
    var _props_style, _props_attachment, _props_enlargeable, _props_refinePrompt, _props_enlargeable1, _props_enlargeable2;
    var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
    var baseCls = getPrefixCls('agentic-md-input-field');
    var _useStyle = useStyle(baseCls, props.disableHoverAnimation), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
    // 状态管理
    var _useMarkdownInputFieldState = useMarkdownInputFieldState({
        value: props.value,
        onChange: props.onChange,
        attachment: props.attachment
    }), isHover = _useMarkdownInputFieldState.isHover, setHover = _useMarkdownInputFieldState.setHover, isLoading = _useMarkdownInputFieldState.isLoading, setIsLoading = _useMarkdownInputFieldState.setIsLoading, isEnlarged = _useMarkdownInputFieldState.isEnlarged, setIsEnlarged = _useMarkdownInputFieldState.setIsEnlarged, value = _useMarkdownInputFieldState.value, setValue = _useMarkdownInputFieldState.setValue, fileMap = _useMarkdownInputFieldState.fileMap, setFileMap = _useMarkdownInputFieldState.setFileMap;
    // 边框光束动画状态
    var _useState = _sliced_to_array(useState(false), 2), isFocused = _useState[0], setIsFocused = _useState[1];
    var _useState1 = _sliced_to_array(useState(false), 2), animationComplete = _useState1[0], setAnimationComplete = _useState1[1];
    // 布局管理
    var _useMarkdownInputFieldLayout = useMarkdownInputFieldLayout(), collapseSendActions = _useMarkdownInputFieldLayout.collapseSendActions, rightPadding = _useMarkdownInputFieldLayout.rightPadding, setRightPadding = _useMarkdownInputFieldLayout.setRightPadding, topRightPadding = _useMarkdownInputFieldLayout.topRightPadding, setTopRightPadding = _useMarkdownInputFieldLayout.setTopRightPadding, quickRightOffset = _useMarkdownInputFieldLayout.quickRightOffset, setQuickRightOffset = _useMarkdownInputFieldLayout.setQuickRightOffset, inputRef = _useMarkdownInputFieldLayout.inputRef;
    // 动作计算
    var _useMarkdownInputFieldActions = useMarkdownInputFieldActions({
        enlargeable: props.enlargeable,
        refinePrompt: props.refinePrompt,
        quickActionRender: props.quickActionRender,
        actionsRender: props.actionsRender,
        toolsRender: props.toolsRender
    }), hasEnlargeAction = _useMarkdownInputFieldActions.hasEnlargeAction, hasRefineAction = _useMarkdownInputFieldActions.hasRefineAction, isMultiRowLayout = _useMarkdownInputFieldActions.isMultiRowLayout, totalActionCount = _useMarkdownInputFieldActions.totalActionCount;
    // 样式计算
    var _useMarkdownInputFieldStyles = useMarkdownInputFieldStyles({
        toolsRender: props.toolsRender,
        maxHeight: props.maxHeight,
        style: props.style,
        attachment: props.attachment,
        isEnlarged: isEnlarged,
        rightPadding: rightPadding,
        topRightPadding: topRightPadding,
        quickRightOffset: quickRightOffset,
        hasEnlargeAction: hasEnlargeAction,
        hasRefineAction: hasRefineAction,
        totalActionCount: totalActionCount,
        isMultiRowLayout: isMultiRowLayout
    }), computedRightPadding = _useMarkdownInputFieldStyles.computedRightPadding, collapsedHeightPx = _useMarkdownInputFieldStyles.collapsedHeightPx, computedMinHeight = _useMarkdownInputFieldStyles.computedMinHeight, enlargedStyle = _useMarkdownInputFieldStyles.enlargedStyle;
    // Refs 管理
    var _useMarkdownInputFieldRefs = useMarkdownInputFieldRefs({
        inputRef: props.inputRef,
        value: props.value
    }, value), markdownEditorRef = _useMarkdownInputFieldRefs.markdownEditorRef, quickActionsRef = _useMarkdownInputFieldRefs.quickActionsRef, actionsRef = _useMarkdownInputFieldRefs.actionsRef, isSendingRef = _useMarkdownInputFieldRefs.isSendingRef;
    // 文件上传管理
    var _useFileUploadManager = useFileUploadManager({
        attachment: props.attachment,
        fileMap: fileMap,
        onFileMapChange: setFileMap
    }), fileUploadDone = _useFileUploadManager.fileUploadDone, supportedFormat = _useFileUploadManager.supportedFormat, uploadImage = _useFileUploadManager.uploadImage, updateAttachmentFiles = _useFileUploadManager.updateAttachmentFiles, handleFileRemoval = _useFileUploadManager.handleFileRemoval, handleFileRetry = _useFileUploadManager.handleFileRetry;
    // 语音输入管理
    var _useVoiceInputManager = useVoiceInputManager({
        voiceRecognizer: props.voiceRecognizer,
        editorRef: markdownEditorRef,
        onValueChange: setValue
    }), recording = _useVoiceInputManager.recording, startRecording = _useVoiceInputManager.startRecording, stopRecording = _useVoiceInputManager.stopRecording;
    // 事件处理
    var _useMarkdownInputFieldHandlers = useMarkdownInputFieldHandlers({
        props: {
            disabled: props.disabled,
            typing: props.typing,
            onChange: props.onChange,
            onSend: props.onSend,
            allowEmptySubmit: props.allowEmptySubmit,
            markdownProps: markdownProps,
            attachment: props.attachment
        },
        markdownEditorRef: markdownEditorRef,
        inputRef: inputRef,
        isSendingRef: isSendingRef,
        isLoading: isLoading,
        setIsLoading: setIsLoading,
        value: value,
        setValue: setValue,
        fileMap: fileMap,
        setFileMap: setFileMap,
        recording: recording,
        stopRecording: stopRecording,
        isEnlarged: isEnlarged,
        setIsEnlarged: setIsEnlarged
    }), handleEnlargeClick = _useMarkdownInputFieldHandlers.handleEnlargeClick, sendMessage = _useMarkdownInputFieldHandlers.sendMessage, handlePaste = _useMarkdownInputFieldHandlers.handlePaste, handleKeyDown = _useMarkdownInputFieldHandlers.handleKeyDown, activeInput = _useMarkdownInputFieldHandlers.activeInput;
    // 渲染辅助
    var attachmentList = useAttachmentList({
        attachment: props.attachment,
        fileMap: fileMap,
        handleFileRemoval: handleFileRemoval,
        handleFileRetry: handleFileRetry,
        updateAttachmentFiles: updateAttachmentFiles
    });
    var beforeTools = useBeforeTools({
        beforeToolsRender: props.beforeToolsRender,
        props: props,
        isHover: isHover,
        isLoading: isLoading
    });
    var sendActionsNode = useSendActionsNode({
        props: {
            attachment: props.attachment,
            voiceRecognizer: props.voiceRecognizer,
            value: value,
            disabled: props.disabled,
            typing: props.typing,
            allowEmptySubmit: props.allowEmptySubmit,
            actionsRender: props.actionsRender,
            toolsRender: props.toolsRender,
            sendButtonProps: props.sendButtonProps
        },
        fileMap: fileMap,
        setFileMap: setFileMap,
        supportedFormat: supportedFormat,
        fileUploadDone: fileUploadDone,
        recording: recording,
        isLoading: isLoading,
        collapseSendActions: collapseSendActions,
        uploadImage: uploadImage,
        startRecording: startRecording,
        stopRecording: stopRecording,
        sendMessage: sendMessage,
        setIsLoading: setIsLoading,
        onStop: props.onStop,
        setRightPadding: setRightPadding,
        baseCls: baseCls,
        hashId: hashId
    });
    // 计算编辑器容器的 maxHeight（用于内部样式）
    var editorMaxHeight = useMemo(function() {
        var _props_maxHeight;
        var _props_style, _props_attachment;
        if (isEnlarged) return 'none';
        var maxHeightValue = (_props_maxHeight = props.maxHeight) !== null && _props_maxHeight !== void 0 ? _props_maxHeight : (_props_style = props.style) === null || _props_style === void 0 ? void 0 : _props_style.maxHeight;
        var base = typeof maxHeightValue === 'number' ? maxHeightValue : maxHeightValue ? parseFloat(String(maxHeightValue)) || 400 : 400;
        var extra = ((_props_attachment = props.attachment) === null || _props_attachment === void 0 ? void 0 : _props_attachment.enable) ? 90 : 0;
        return "min(".concat(base + extra, "px)");
    }, [
        isEnlarged,
        props.maxHeight,
        (_props_style = props.style) === null || _props_style === void 0 ? void 0 : _props_style.maxHeight,
        (_props_attachment = props.attachment) === null || _props_attachment === void 0 ? void 0 : _props_attachment.enable
    ]);
    var _obj, _obj1;
    return wrapSSR(/*#__PURE__*/ React.createElement(React.Fragment, null, isShowTopOperatingArea && /*#__PURE__*/ React.createElement("div", {
        className: classNames("".concat(baseCls, "-top-area"), hashId)
    }, /*#__PURE__*/ React.createElement(TopOperatingArea, {
        targetRef: props.targetRef,
        operationBtnRender: props.operationBtnRender,
        isShowBackTo: props.isShowBackTo
    })), beforeTools ? /*#__PURE__*/ React.createElement("div", {
        className: classNames("".concat(baseCls, "-before-tools"), hashId)
    }, beforeTools) : null, /*#__PURE__*/ React.createElement(Suggestion, {
        tagInputProps: _object_spread({
            enable: true,
            type: 'dropdown'
        }, tagInputProps)
    }, /*#__PURE__*/ React.createElement("div", {
        ref: inputRef,
        className: classNames(baseCls, hashId, props.className, (_obj = {}, _define_property(_obj, "".concat(baseCls, "-disabled"), props.disabled), _define_property(_obj, "".concat(baseCls, "-typing"), false), _define_property(_obj, "".concat(baseCls, "-loading"), isLoading), _define_property(_obj, "".concat(baseCls, "-is-multi-row"), isMultiRowLayout), _define_property(_obj, "".concat(baseCls, "-enlarged"), isEnlarged), _define_property(_obj, "".concat(baseCls, "-focused"), isFocused), _define_property(_obj, "".concat(baseCls, "-has-tools-wrapper"), !!props.toolsRender), _obj)),
        style: _object_spread_props(_object_spread({}, props.style, enlargedStyle), {
            height: isEnlarged ? "".concat((_ref = (_props_enlargeable = props.enlargeable) === null || _props_enlargeable === void 0 ? void 0 : _props_enlargeable.height) !== null && _ref !== void 0 ? _ref : 980, "px") : "min(".concat(collapsedHeightPx, "px,100%)"),
            borderRadius: borderRadius || 12,
            minHeight: computedMinHeight,
            maxHeight: isEnlarged ? 'none' : props.maxHeight !== undefined ? typeof props.maxHeight === 'number' ? "".concat(props.maxHeight, "px") : props.maxHeight : "min(".concat(collapsedHeightPx, "px,100%)")
        }),
        tabIndex: 1,
        onMouseEnter: function() {
            return setHover(true);
        },
        onMouseLeave: function() {
            return setHover(false);
        },
        onKeyDown: handleKeyDown
    }, /*#__PURE__*/ React.createElement(BorderBeamAnimation, {
        isVisible: isFocused && !animationComplete,
        borderRadius: borderRadius || 16,
        onAnimationComplete: function() {
            return setAnimationComplete(true);
        }
    }), /*#__PURE__*/ React.createElement("div", {
        style: {
            display: 'flex',
            flexDirection: 'column',
            borderRadius: !!props.toolsRender ? 0 : 'inherit',
            borderTopLeftRadius: 'inherit',
            borderTopRightRadius: 'inherit',
            maxHeight: editorMaxHeight,
            height: isEnlarged ? '100%' : 'auto',
            flex: 1
        },
        className: classNames("".concat(baseCls, "-editor"), hashId, (_obj1 = {}, _define_property(_obj1, "".concat(baseCls, "-editor-hover"), isHover), _define_property(_obj1, "".concat(baseCls, "-editor-disabled"), props.disabled), _obj1))
    }, /*#__PURE__*/ React.createElement(SkillModeBar, {
        skillMode: props.skillMode,
        onSkillModeOpenChange: props.onSkillModeOpenChange
    }), /*#__PURE__*/ React.createElement("div", {
        className: classNames("".concat(baseCls, "-editor-content"), hashId)
    }, attachmentList, /*#__PURE__*/ React.createElement(BaseMarkdownEditor, _object_spread({
        editorRef: markdownEditorRef,
        leafRender: props.leafRender,
        style: {
            width: '100%',
            flex: 1,
            padding: 0,
            paddingRight: computedRightPadding
        },
        toolBar: {
            enable: false
        },
        floatBar: {
            enable: false
        },
        readonly: isLoading,
        contentStyle: {
            padding: 'var(--padding-3x)'
        },
        textAreaProps: {
            enable: true,
            placeholder: props.placeholder
        },
        tagInputProps: _object_spread({
            enable: true,
            type: 'dropdown'
        }, tagInputProps),
        initValue: props.value,
        onChange: function(value) {
            var _props_onChange;
            // 检查并限制字符数
            if (props.maxLength !== undefined) {
                if (value.length > props.maxLength) {
                    var _props_onChange1, _props_onMaxLengthExceeded, // 更新编辑器内容以反映截断后的值
                    _markdownEditorRef_current_store, _markdownEditorRef_current;
                    var truncatedValue = value.slice(0, props.maxLength);
                    setValue(truncatedValue);
                    (_props_onChange1 = props.onChange) === null || _props_onChange1 === void 0 ? void 0 : _props_onChange1.call(props, truncatedValue);
                    (_props_onMaxLengthExceeded = props.onMaxLengthExceeded) === null || _props_onMaxLengthExceeded === void 0 ? void 0 : _props_onMaxLengthExceeded.call(props, value);
                    (_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : (_markdownEditorRef_current_store = _markdownEditorRef_current.store) === null || _markdownEditorRef_current_store === void 0 ? void 0 : _markdownEditorRef_current_store.setMDContent(truncatedValue);
                    return;
                }
            }
            setValue(value);
            (_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, value);
        },
        onFocus: function(value, schema, e) {
            onFocus === null || onFocus === void 0 ? void 0 : onFocus(value, schema, e);
            activeInput(true);
            setIsFocused(true);
            setAnimationComplete(false);
        },
        onBlur: function(value, schema, e) {
            onBlur === null || onBlur === void 0 ? void 0 : onBlur(value, schema, e);
            activeInput(false);
            setIsFocused(false);
            setAnimationComplete(false);
        },
        onPaste: function(e) {
            handlePaste(e);
        },
        titlePlaceholderContent: props.placeholder,
        toc: false,
        pasteConfig: props.pasteConfig
    }, markdownProps), (props === null || props === void 0 ? void 0 : props.quickActionRender) || ((_props_refinePrompt = props.refinePrompt) === null || _props_refinePrompt === void 0 ? void 0 : _props_refinePrompt.enable) || ((_props_enlargeable1 = props.enlargeable) === null || _props_enlargeable1 === void 0 ? void 0 : _props_enlargeable1.enable) ? /*#__PURE__*/ React.createElement(QuickActions, {
        ref: quickActionsRef,
        value: value,
        fileMap: fileMap,
        onFileMapChange: setFileMap,
        isHover: isHover,
        isLoading: isLoading,
        disabled: props.disabled,
        fileUploadStatus: fileUploadDone ? 'done' : 'uploading',
        refinePrompt: props.refinePrompt,
        editorRef: markdownEditorRef,
        onValueChange: function(text) {
            var _props_onChange;
            setValue(text);
            (_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, text);
        },
        quickActionRender: props.quickActionRender,
        prefixCls: baseCls,
        hashId: hashId,
        enlargeable: !!((_props_enlargeable2 = props.enlargeable) === null || _props_enlargeable2 === void 0 ? void 0 : _props_enlargeable2.enable),
        isEnlarged: isEnlarged,
        onEnlargeClick: handleEnlargeClick,
        onResize: function(width, rightOffset) {
            setTopRightPadding(width);
            setQuickRightOffset(rightOffset);
        }
    }) : null))), props.toolsRender ? /*#__PURE__*/ React.createElement("div", {
        className: classNames("".concat(baseCls, "-tools-wrapper"), hashId)
    }, /*#__PURE__*/ React.createElement("div", {
        ref: actionsRef,
        contentEditable: false,
        className: classNames("".concat(baseCls, "-send-tools"), hashId)
    }, props.toolsRender(_object_spread_props(_object_spread({
        value: value,
        fileMap: fileMap,
        onFileMapChange: setFileMap
    }, props), {
        isHover: isHover,
        isLoading: isLoading,
        fileUploadStatus: fileUploadDone ? 'done' : 'uploading'
    }))), sendActionsNode) : sendActionsNode))));
};
MarkdownInputFieldComponent.displayName = 'MarkdownInputField';
// 使用 React.memo 优化性能，避免不必要的重新渲染
export var MarkdownInputField = /*#__PURE__*/ memo(MarkdownInputFieldComponent);
