"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index = require("../_vendor/@legendapp/state/index.cjs");
const coreStore = require("./core-store.cjs");
const messageStore = require("./message-store.cjs");
const streamingStore = require("./streaming-store.cjs");
const concurrencyStore = require("./concurrency-store.cjs");
const combinedComputed$ = index.observable({
  // 是否可以发送消息（基础条件：不在加载中、不在流式传输、有当前聊天）
  canSendMessage: () => {
    const isLoading = coreStore.coreStore$.isLoading.get();
    const isStreaming = streamingStore.streamingStore$.isStreaming.get();
    const currentChat = coreStore.coreStore$.currentChat.get();
    return !isLoading && !isStreaming && currentChat !== null;
  },
  // 是否可以发送新消息（增加并发限制检查）
  canSendNewMessage: () => {
    const canSendMessage = combinedComputed$.canSendMessage.get();
    const canSendConcurrent = concurrencyStore.concurrencyComputed$.canSendNewMessage.get();
    return canSendMessage && canSendConcurrent;
  },
  // 消息列表状态综合信息
  messageListStatus: () => {
    const currentMessages = messageStore.messageComputed$.currentMessages();
    const shouldShowWelcome = messageStore.messageComputed$.shouldShowWelcome();
    const messageStats = messageStore.messageComputed$.messageStats();
    return {
      messages: currentMessages,
      shouldShowWelcome,
      stats: messageStats,
      count: currentMessages.length
    };
  },
  // 整体应用状态汇总
  appStatus: () => {
    const isLoading = coreStore.coreStore$.isLoading.get();
    const error = coreStore.coreStore$.error.get();
    const isStreaming = streamingStore.streamingStore$.isStreaming.get();
    const currentChat = coreStore.coreStore$.currentChat.get();
    return {
      isReady: !isLoading && !error && currentChat !== null,
      hasError: error !== null,
      isLoading,
      isStreaming,
      currentChat
    };
  },
  // 发送按钮状态（接收参数进行动态计算）
  sendButtonState: (inputText, attachmentsCount) => {
    const streamingStatus = streamingStore.streamingComputed$.streamingStatus.get();
    const hasContent = inputText.trim().length > 0 || attachmentsCount > 0;
    return {
      isStreaming: streamingStatus.isStreaming,
      disabled: !streamingStatus.isStreaming && !hasContent,
      // 流式传输中或无内容时禁用
      icon: streamingStatus.isStreaming ? "cancel" : "send",
      // 流式传输中显示取消图标
      addQueue: streamingStatus.isStreaming && hasContent,
      // 流式传输中且有内容时可添加到队列
      hasContent
    };
  }
});
exports.combinedComputed$ = combinedComputed$;
//# sourceMappingURL=combined-store.cjs.map
