import { useEffect, useImperativeHandle, useRef } from "react";
/**
 * Refs 管理 Hook
 * 管理组件中所有的 refs 和相关逻辑
 */ export var useMarkdownInputFieldRefs = function(props, value) {
    var markdownEditorRef = useRef();
    var quickActionsRef = useRef(null);
    var actionsRef = useRef(null);
    var isSendingRef = useRef(false);
    // 同步外部 value 到编辑器
    useEffect(function() {
        var _markdownEditorRef_current_store, _markdownEditorRef_current;
        if (!markdownEditorRef.current) return;
        (_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(value);
    }, [
        props.value
    ]);
    // 通过 ref 暴露编辑器实例
    useImperativeHandle(props.inputRef, function() {
        return markdownEditorRef.current;
    });
    return {
        markdownEditorRef: markdownEditorRef,
        quickActionsRef: quickActionsRef,
        actionsRef: actionsRef,
        isSendingRef: isSendingRef
    };
};
