import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { SettingsPanelLayout } from "./SettingsPanelLayout";
import { useIndexStatus } from "./index/useIndexStatus";
import { IndexStatusCards } from "./index/IndexStatusCards";
import { EmbeddingProviderInfo } from "./index/EmbeddingProviderInfo";
import { QueueErrorsDisplay } from "./index/QueueErrorsDisplay";
import { CollectionWarningsDisplay } from "./index/CollectionWarningsDisplay";
import { RebuildIndexSection } from "./index/RebuildIndexSection";
import { RecentBatchesList } from "./index/RecentBatchesList";
import { LatestEmbeddingsList } from "./index/LatestEmbeddingsList";
import { AdvancedSettings } from "./index/AdvancedSettings";
import { LoadingState } from "../ui/LoadingState";
/**
 * Main Index Overview component that displays index status and rebuild controls
 */
export function IndexOverview() {
    const { state, actions } = useIndexStatus();
    return (_jsxs(SettingsPanelLayout, { contentClassName: "flex flex-col gap-4 select-text", children: [state.error && (_jsx("div", { className: "border-feedback-red bg-feedback-red-light text-feedback-red rounded border p-3 text-sm", children: state.error })), state.isLoading && !state.indexStatus ? (_jsx(LoadingState, { message: null, className: "py-8", spinnerClassName: "text-neutral-grey-50" })) : state.indexStatus ? (_jsxs(_Fragment, { children: [_jsx(IndexStatusCards, { indexStatus: state.indexStatus, onGoToSettings: actions.goToSettings }), !state.operationInProgress &&
                        state.queueStatus &&
                        state.queueStatus.errorCount > 0 &&
                        state.queueStatus.recentErrors &&
                        state.queueStatus.recentErrors.length > 0 && (_jsx(QueueErrorsDisplay, { queueStatus: state.queueStatus, showQueueErrors: state.showQueueErrors, onToggleErrors: () => actions.setShowQueueErrors(!state.showQueueErrors), onRetryFailed: actions.handleRetryFailed, onGoToSettings: actions.goToSettings, isRetryingFailed: state.isRetryingFailed, retryFailedMessage: state.retryFailedMessage })), state.collectionStatus?.recentWarnings &&
                        state.collectionStatus.recentWarnings.length > 0 && (_jsx(CollectionWarningsDisplay, { warnings: state.collectionStatus.recentWarnings })), state.providerInfo && (_jsx(EmbeddingProviderInfo, { providerInfo: state.providerInfo })), _jsx(RebuildIndexSection, { indexStatus: state.indexStatus, collectionStatus: state.collectionStatus, importStatus: state.importStatus, centroidsStatus: state.centroidsStatus, queueStatus: state.queueStatus, providerInfo: state.providerInfo, stagingStats: state.stagingStats, stageResult: state.stageResult, debouncedCurrentItem: state.debouncedCurrentItem, isCollecting: state.isCollecting, isGenerating: state.isGenerating, isFinalizing: state.isFinalizing, isCancellingCollection: state.isCancellingCollection, forceRegenerate: state.forceRegenerate, onRebuild: actions.handleRebuild, onGenerateEmbeddings: actions.handleGenerateEmbeddings, onFinalize: actions.handleFinalize, onStopGeneration: actions.handleStopGeneration, onCancelCollection: actions.handleCancelCollection, onForceRegenerateChange: actions.setForceRegenerate, onClearStaging: actions.clearStaging }), state.indexStatus.batches &&
                        state.indexStatus.batches.length > 0 && (_jsx(RecentBatchesList, { batches: state.indexStatus.batches })), state.indexStatus.latestEmbeddedItems &&
                        state.indexStatus.latestEmbeddedItems.length > 0 && (_jsx(LatestEmbeddingsList, { items: state.indexStatus.latestEmbeddedItems })), _jsx(AdvancedSettings, { kCentroids: state.kCentroids, onKCentroidsChange: actions.setKCentroids, onPopulateCentroids: actions.handlePopulateCentroids, isPopulating: state.isPopulating, centroidsStatus: state.centroidsStatus, onCleanup: actions.handleCleanup, isCleaning: state.isCleaning })] })) : null] }));
}
//# sourceMappingURL=IndexOverview.js.map