import React, { useContext } from "react";
import AnimationText from "../AnimationText";
import { StreamingAnimationContext } from "../StreamingAnimationContext";
/**
 * 段落级流式淡入包装：仅当 streaming + 末块 + 未显式关闭段落动画时启用 AnimationText。
 *
 * 提到模块级是为了：在 buildEditorAlignedComponents 重建时（props 抖动），React 不会
 * 把它当作新组件类型 → 子树不会被卸载重挂，避免动画/输入态丢失。
 */ var StreamAnimWrapComponent = function StreamAnimWrapComponent(param) {
    var streaming = param.streaming, streamingParagraphAnimation = param.streamingParagraphAnimation, children = param.children;
    var _ref;
    var ctx = useContext(StreamingAnimationContext);
    var animateBlock = (_ref = ctx === null || ctx === void 0 ? void 0 : ctx.animateBlock) !== null && _ref !== void 0 ? _ref : true;
    var allow = !!streaming && animateBlock && streamingParagraphAnimation !== false;
    if (!allow) return /*#__PURE__*/ React.createElement(React.Fragment, null, children);
    return /*#__PURE__*/ React.createElement(AnimationText, null, children);
};
StreamAnimWrapComponent.displayName = 'StreamAnimWrap';
export var StreamAnimWrap = /*#__PURE__*/ React.memo(StreamAnimWrapComponent);
