"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),x=require("react-router-dom"),m=require("react-i18next"),l=require("lucide-react"),v=require("./businessAnalysisApi-PHrk-59S.js");function p({status:r}){const{t:n}=m.useTranslation("ba"),o={draft:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",analysed:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",specified:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900 dark:text-indigo-300",consolidated:"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300","handed-off":"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300"};return e.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs font-medium ${o[r]||o.draft}`,children:n(`status.${r}`,r)})}function f(){const{t:r}=m.useTranslation("ba"),[n,o]=d.useState(null),[u,g]=d.useState(!0),[h,b]=d.useState(null);d.useEffect(()=>{v.businessAnalysisApi.getManifest().then(o).catch(()=>b("manifest")).finally(()=>g(!1)).catch(()=>{})},[]);const c=d.useMemo(()=>{if(!n?.analyses)return[];const s=new Map;for(const t of n.analyses){const i=s.get(t.appCode);i?(i.entries.push(t),t.updatedAt>i.latestUpdate&&(i.latestUpdate=t.updatedAt)):s.set(t.appCode,{appCode:t.appCode,appName:t.appName,entries:[t],latestUpdate:t.updatedAt})}return Array.from(s.values()).sort((t,i)=>i.latestUpdate.localeCompare(t.latestUpdate))},[n]);return u?e.jsxs("div",{className:"space-y-4 animate-pulse",children:[e.jsx("div",{className:"h-8 bg-[var(--bg-tertiary)] rounded w-64"}),e.jsx("div",{className:"h-4 bg-[var(--bg-tertiary)] rounded w-96"}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mt-8",children:[1,2].map(s=>e.jsx("div",{className:"h-48 bg-[var(--bg-tertiary)] rounded-xl"},`card-${s}`))})]}):e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold mb-4 flex items-center gap-3",children:[e.jsx(l.BarChart3,{className:"w-8 h-8 text-[var(--color-primary-600)]"}),r("index.title")]}),e.jsx("p",{className:"text-lg text-[var(--text-secondary)]",children:r("index.subtitle")})]}),h||c.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx(l.AlertCircle,{className:"w-12 h-12 text-[var(--text-tertiary)] mx-auto mb-4"}),e.jsx("p",{className:"text-lg text-[var(--text-secondary)] mb-2",children:r("index.noData")}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)]",children:r("index.noDataHint")})]}):e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:c.map(s=>{const t=s.entries.find(a=>!a.moduleCode),i=s.entries.filter(a=>a.moduleCode);return e.jsxs("div",{className:"card p-6 hover:shadow-lg transition-shadow",children:[e.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-violet-500 to-purple-600 flex items-center justify-center",children:e.jsx(l.BarChart3,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-[var(--text-primary)] truncate",children:s.appName}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:t?.featureDescription})]}),t&&e.jsx(p,{status:t.status})]}),i.length>0&&e.jsx("div",{className:"space-y-2 mb-4",children:i.map(a=>e.jsxs(x.Link,{to:`/system/docs/ba/${a.appCode}/${a.moduleCode}`,className:"flex items-center gap-2 px-3 py-2 rounded-lg hover:bg-[var(--bg-hover)] transition-colors group",children:[e.jsx(l.FileText,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("span",{className:"text-sm text-[var(--text-primary)] flex-1",children:a.moduleName||a.moduleCode}),e.jsx(p,{status:a.status}),e.jsx(l.ArrowRight,{className:"w-3 h-3 text-[var(--text-tertiary)] opacity-0 group-hover:opacity-100 transition-opacity"})]},`${a.appCode}-${a.moduleCode}`))}),e.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-[var(--border-color)]",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--text-tertiary)]",children:[e.jsx(l.Clock,{className:"w-3 h-3"}),new Date(s.latestUpdate).toLocaleDateString()]}),t&&e.jsxs(x.Link,{to:`/system/docs/ba/${s.appCode}`,className:"text-sm text-[var(--color-primary-600)] hover:underline flex items-center gap-1",children:[r("index.version")," ",t.version,e.jsx(l.ArrowRight,{className:"w-3 h-3"})]})]})]},s.appCode)})})]})}exports.BaIndexPage=f;
//# sourceMappingURL=BaIndexPage-Df6ld4jp.js.map
