import React from 'react';
import { SearchHistory } from "./SearchHistory";
import { SuggestWords } from "./SuggestWords";
import { HotWords } from "./HotWords";

/**
 * LookupAuxiliary 组件
 * 辅助信息层：搜索历史、联想词、热门搜索
 */
export var LookupAuxiliary = function LookupAuxiliary(props) {
  var keyword = props.keyword,
    showHistory = props.showHistory,
    _props$history = props.history,
    history = _props$history === void 0 ? [] : _props$history,
    showSuggestions = props.showSuggestions,
    _props$suggestions = props.suggestions,
    suggestions = _props$suggestions === void 0 ? [] : _props$suggestions,
    showHotWords = props.showHotWords,
    _props$hotWords = props.hotWords,
    hotWords = _props$hotWords === void 0 ? [] : _props$hotWords,
    onSelect = props.onSelect,
    onRemoveHistory = props.onRemoveHistory,
    onClearHistory = props.onClearHistory,
    historyRender = props.historyRender,
    suggestionsRender = props.suggestionsRender,
    hotWordsRender = props.hotWordsRender,
    className = props.className,
    style = props.style;

  // 判断是否有任何辅助信息需要显示
  var hasHistory = showHistory && history.length > 0;
  var hasSuggestions = showSuggestions && suggestions.length > 0 && keyword;
  var hasHotWords = showHotWords && hotWords.length > 0 && !keyword;
  var hasAnyContent = hasHistory || hasSuggestions || hasHotWords;

  // 如果没有任何内容，不显示
  if (!hasAnyContent) {
    return null;
  }
  return /*#__PURE__*/React.createElement("div", {
    className: "pisell-lookup-auxiliary ".concat(className || ''),
    style: style
  }, hasHistory && /*#__PURE__*/React.createElement(SearchHistory, {
    history: history,
    onSelect: onSelect,
    onRemove: onRemoveHistory,
    onClear: onClearHistory,
    render: historyRender
  }), hasSuggestions && /*#__PURE__*/React.createElement(SuggestWords, {
    suggestions: suggestions,
    onSelect: onSelect,
    render: suggestionsRender
  }), hasHotWords && /*#__PURE__*/React.createElement(HotWords, {
    hotWords: hotWords,
    onSelect: onSelect,
    render: hotWordsRender
  }));
};
LookupAuxiliary.displayName = 'LookupAuxiliary';