@wrongstack/webui 1.0.17 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentRosterView-CV9MW-4M.js → AgentRosterView-Dq8Xa0WK.js} +4 -4
- package/dist/assets/{AnalyticsDashboard-30brLbuz.js → AnalyticsDashboard-DgqJODVI.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-bKVydKg8.js → AudienceMemoryPanel-BVGdDVTT.js} +1 -1
- package/dist/assets/{ChangesView-Cv6svx-V.js → ChangesView-BVyLENBb.js} +1 -1
- package/dist/assets/ChimeraReviewsView-CTuxzgTC.js +1 -0
- package/dist/assets/ChronicleDashboard-BRP7D6RZ.js +1 -0
- package/dist/assets/{CodeEditor-JlvMbECd.js → CodeEditor-k3z3M0NG.js} +1 -1
- package/dist/assets/{CodeMap-4swT3FIw.js → CodeMap-CvHNQZEF.js} +1 -1
- package/dist/assets/{CronJobsPanel-LSpFBceD.js → CronJobsPanel-GTK038V9.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-ZRNNV02b.js → DeadCodeScanPanel-DX4OEuyp.js} +1 -1
- package/dist/assets/{DebugDashboard-DlH0QNPX.js → DebugDashboard-CKp3sa_k.js} +1 -1
- package/dist/assets/{DesignGalleryView-yZgVVEg9.js → DesignGalleryView-DVUTYaP6.js} +1 -1
- package/dist/assets/{GoalView-D1gxZre2.js → GoalView-D8G8e8YG.js} +1 -1
- package/dist/assets/KanbanView-BMXGDqGo.js +3 -0
- package/dist/assets/{MailboxDetailView-C4lEW3f8.js → MailboxDetailView-CylnzTVc.js} +1 -1
- package/dist/assets/{MemoryDrawer-arujfDSW.js → MemoryDrawer-DJ0Y98Z8.js} +1 -1
- package/dist/assets/{MemoryManager-BmQYIRhD.js → MemoryManager-DfcsYPUB.js} +1 -1
- package/dist/assets/{ProcessMonitor-ByW-VKsX.js → ProcessMonitor-BnQ3vJtn.js} +1 -1
- package/dist/assets/{PromptJournalView-0cHPeYXa.js → PromptJournalView-D7k8Yh5a.js} +1 -1
- package/dist/assets/{ProviderTestView-CQlwC6HG.js → ProviderTestView-DSd6kkWT.js} +1 -1
- package/dist/assets/{QueuePanel-DJeK7xCh.js → QueuePanel-79KiyZWD.js} +1 -1
- package/dist/assets/{RefreshDebugView-BfOjHodq.js → RefreshDebugView-s6MyGpPq.js} +1 -1
- package/dist/assets/{RepositoryHistoryView-BYPPu5uv.js → RepositoryHistoryView-CWi_Zo3F.js} +1 -1
- package/dist/assets/RequirementIntakeView-D_Ea20fx.js +1 -0
- package/dist/assets/{SageTabs-Bt2kzPNB.js → SageTabs-D6eTg3ix.js} +2 -2
- package/dist/assets/SddFlowGraph-B-ptkFX6.js +1 -0
- package/dist/assets/SddHub-CSVfLGpr.js +2 -0
- package/dist/assets/{SessionInspectView-BasxJ_5x.js → SessionInspectView-NSpj5WEN.js} +1 -1
- package/dist/assets/{SessionList-C9MRSj_-.js → SessionList-BYRCs1AK.js} +1 -1
- package/dist/assets/{SessionsDashboard-BK95Zp6f.js → SessionsDashboard-mF4PzdKY.js} +1 -1
- package/dist/assets/{SetupScreen-rPKsBa9Z.js → SetupScreen-BUZeJSZi.js} +1 -1
- package/dist/assets/SkillDetailView-B9BFyB1i.js +3 -0
- package/dist/assets/{TechStackView-xVR5dsSn.js → TechStackView-CXJilX0M.js} +2 -2
- package/dist/assets/{TerminalPanel-CBEZTuvV.js → TerminalPanel-CAXevSAa.js} +1 -1
- package/dist/assets/{activity-CInOo57V.js → activity-B3wutYIE.js} +4 -4
- package/dist/assets/activity-Be03cc7g.js +10 -0
- package/dist/assets/activity-CiYZ3y4e.js +10 -0
- package/dist/assets/activity-CmIA2MhR.js +10 -0
- package/dist/assets/activity-Cp5GhldB.js +10 -0
- package/dist/assets/activity-DFCf7l5d.js +10 -0
- package/dist/assets/activity-EbNUY7Ci.js +10 -0
- package/dist/assets/{chat-store-BDVZSmod.js → chat-store-C7InoWAO.js} +1 -1
- package/dist/assets/common-Bjl7V12m.js +1 -0
- package/dist/assets/common-BtyQBZBN.js +1 -0
- package/dist/assets/common-D0QL7rwb.js +1 -0
- package/dist/assets/common-DJRPtYAt.js +1 -0
- package/dist/assets/common-DPPTV3yw.js +1 -0
- package/dist/assets/common-DvjdaRhB.js +1 -0
- package/dist/assets/common-opV6EoLd.js +1 -0
- package/dist/assets/config-store-BbL0WxLE.js +21 -0
- package/dist/assets/{i18n-CvJB4U4z.js → i18n-Dv97urcO.js} +3 -3
- package/dist/assets/index-CON0Nbm4.css +1 -0
- package/dist/assets/index-DX6tHUzs.js +177 -0
- package/dist/assets/roster-ws-Cv_PHlEV.js +1 -0
- package/dist/assets/settings-BCvuzOJ6.js +1 -0
- package/dist/assets/settings-DMPKd-4K.js +1 -0
- package/dist/assets/settings-DxQ2452f.js +1 -0
- package/dist/assets/settings-Dz3StaVx.js +1 -0
- package/dist/assets/settings-EBW1mlXc.js +1 -0
- package/dist/assets/settings-Er2LHp9d.js +1 -0
- package/dist/assets/settings-EzznCDaX.js +1 -0
- package/dist/assets/stores-DXn5tdr7.js +7 -0
- package/dist/assets/ui-store-DxDwFHNK.js +1 -0
- package/dist/assets/{view-navigation-DTs4cSQ6.js → view-navigation-CpIPxhZp.js} +1 -1
- package/dist/components/ChatInput/skill-mention-picker.d.ts +10 -0
- package/dist/components/CustomRosterPanel.d.ts +0 -1
- package/dist/components/KanbanColumnView.d.ts +13 -0
- package/dist/components/OfficeMapCanvas.d.ts +0 -7
- package/dist/components/SettingsPanel/BrainSection.d.ts +1 -1
- package/dist/components/SettingsPanel/JevSection.d.ts +4 -0
- package/dist/components/SettingsPanel/OAuthLoginSection.d.ts +2 -0
- package/dist/components/SettingsPanel/ProviderSection.d.ts +5 -5
- package/dist/components/SettingsPanel/brain-section-options.d.ts +1 -1
- package/dist/components/SettingsPanel/contracts.d.ts +1 -0
- package/dist/components/SettingsPanel/official-servers.d.ts +1 -0
- package/dist/components/SettingsPanel/use-brain-section.d.ts +28 -0
- package/dist/components/SkillDetailView.d.ts +1 -1
- package/dist/components/chronicle-event-detail.d.ts +51 -0
- package/dist/components/context-dashboard-sections.d.ts +79 -0
- package/dist/components/use-office-map-canvas.d.ts +42 -0
- package/dist/components/use-skill-detail.d.ts +177 -0
- package/dist/components/vector-memory-panel/model.d.ts +9 -0
- package/dist/hooks/useProviderModels.d.ts +2 -0
- package/dist/hooks/useWebSocket.d.ts +3 -3
- package/dist/hooks/ws-handlers/brain-handlers.d.ts +18 -0
- package/dist/hooks/ws-handlers/goal-handlers.d.ts +7 -0
- package/dist/hooks/ws-handlers/misc-handlers.d.ts +2 -21
- package/dist/index.html +9 -9
- package/dist/index.js +15586 -12891
- package/dist/lib/auth-operation.d.ts +5 -0
- package/dist/lib/kanban-cleaner.d.ts +1 -1
- package/dist/lib/sdd-theme.d.ts +2 -2
- package/dist/lib/ws-client-actions.d.ts +2 -0
- package/dist/lib/ws-client-domain-methods.d.ts +2 -2
- package/dist/lib/ws-client-echo.d.ts +1 -1
- package/dist/lib/ws-client-session-methods.d.ts +1 -1
- package/dist/lib/ws-client.d.ts +0 -3
- package/dist/stores/council-log-store.d.ts +4 -0
- package/dist/stores/ui-store-types.d.ts +1 -1
- package/dist/types/client-message.d.ts +13 -0
- package/dist/types/jev.d.ts +62 -0
- package/dist/types/runtime.d.ts +5 -3
- package/dist/types/server-message-system.d.ts +4 -0
- package/dist/types/system.d.ts +2 -0
- package/package.json +10 -10
- package/dist/assets/ChimeraReviewsView-DLTrEJDS.js +0 -1
- package/dist/assets/ChronicleDashboard-DhgWbaXj.js +0 -1
- package/dist/assets/KanbanView-Bh0T3p3J.js +0 -3
- package/dist/assets/RequirementIntakeView-CEwUB7VD.js +0 -1
- package/dist/assets/SddFlowGraph-CZSwcAtS.js +0 -1
- package/dist/assets/SddHub-Cc79Ob7A.js +0 -2
- package/dist/assets/SkillDetailView-LkJyIBPb.js +0 -3
- package/dist/assets/activity-CDHIWIPJ.js +0 -10
- package/dist/assets/activity-D6XfckyA.js +0 -10
- package/dist/assets/activity-DapbBEf6.js +0 -10
- package/dist/assets/activity-E8vCWdG2.js +0 -10
- package/dist/assets/activity-e8OIpNGJ.js +0 -10
- package/dist/assets/activity-oTJsNfZu.js +0 -10
- package/dist/assets/common-BXosnbIt.js +0 -1
- package/dist/assets/common-CzfPgMjC.js +0 -1
- package/dist/assets/common-DDDPz7Dv.js +0 -1
- package/dist/assets/common-DYx9oSoC.js +0 -1
- package/dist/assets/common-DZ-05t4z.js +0 -1
- package/dist/assets/common-MjX8fcng.js +0 -1
- package/dist/assets/common-ipsuLC3n.js +0 -1
- package/dist/assets/config-store-mWuYCild.js +0 -22
- package/dist/assets/index-DLjaZSCH.js +0 -177
- package/dist/assets/index-DiX5j910.css +0 -1
- package/dist/assets/roster-ws-BRANim2Y.js +0 -1
- package/dist/assets/settings-B5Jy-ObI.js +0 -1
- package/dist/assets/settings-BXTJJ4n-.js +0 -1
- package/dist/assets/settings-BcXAVecM.js +0 -1
- package/dist/assets/settings-ByPfZHGm.js +0 -1
- package/dist/assets/settings-CCe4iHcn.js +0 -1
- package/dist/assets/settings-D2GLiaDO.js +0 -1
- package/dist/assets/settings-gB9nKL3f.js +0 -1
- package/dist/assets/stores-D5loyGLL.js +0 -7
- package/dist/assets/ui-store-DC3mkswy.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{$n as r,$r as i,Dn as a,Fi as o,Ga as s,Hi as c,Hn as l,Jn as u,Mr as d,Mt as f,Na as p,Wa as m,Wr as h,bi as g,ci as _,cr as ee,gi as v,go as te,ho as y,ja as b,n as ne,nn as x,so as re,sr as S,ur as C,xo as w,yn as ie}from"./vendor-V3ydTHqN.js";import"./i18n-CvJB4U4z.js";import{a as T,c as ae,d as oe,f as se,h as E,m as ce,n as D,o as le,p as ue,r as de,t as fe,u as pe}from"./xyflow-BqDBClm9.js";import{t as O}from"./utils-CKsqCaP8.js";import{i as me,r as he,t as ge}from"./codemap-activity-store-Ha7XbGgq.js";import{S as _e}from"./fonts-DRGbd-AM.js";import{R as ve}from"./index-DLjaZSCH.js";var k=e(t(),1),A=n();function ye({historyFile:e,fileHistory:t,onClose:n}){let{t:r}=w();return(0,A.jsxs)(`div`,{className:`absolute right-0 top-0 z-50 flex h-full w-[390px] max-w-[90%] flex-col border-l bg-card shadow-2xl`,children:[(0,A.jsxs)(`div`,{className:`flex h-12 items-center justify-between border-b px-4`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(y,{className:`h-4 w-4 shrink-0 text-warning`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-[11px] font-semibold`,title:e,children:e})]}),(0,A.jsx)(`button`,{type:`button`,onClick:n,className:`flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,"aria-label":r(`activity:codeMap.closeActivity`),children:(0,A.jsx)(f,{className:`h-3.5 w-3.5`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:t.length===0?(0,A.jsx)(`p`,{className:`py-12 text-center text-[10px] text-muted-foreground`,children:r(`activity:codeMap.noActivityRecordedForThisFile`)}):t.map((e,t)=>(0,A.jsxs)(`div`,{className:`mb-1 flex items-start gap-2 border p-2 text-[10px]`,children:[(0,A.jsx)(`span`,{className:O(`border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/40 text-destructive`:e.type===`read`?`border-info/40 text-info`:`border-warning/40 text-warning`),children:e.type}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(e.timestamp).toLocaleTimeString()}),e.toolName&&(0,A.jsxs)(`div`,{className:`mt-1`,children:[`via `,e.toolName]}),e.agent&&(0,A.jsx)(`div`,{className:`text-muted-foreground`,children:e.agent}),e.summary&&(0,A.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:e.summary}),e.change&&(0,A.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,A.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,A.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.change.before&&(0,A.jsx)(`span`,{className:`ml-1 truncate text-destructive/80`,title:e.change.before,children:e.change.before}),e.change.after&&(0,A.jsxs)(`span`,{className:`truncate text-success/80`,title:e.change.after,children:[`→ `,e.change.after]})]}),(0,A.jsxs)(`div`,{className:`mt-1 flex gap-2 font-mono text-[8px] uppercase text-muted-foreground`,children:[(0,A.jsx)(`span`,{children:e.status??`observed`}),(0,A.jsx)(`span`,{children:e.source??`legacy`}),e.durationMs!==void 0&&(0,A.jsxs)(`span`,{children:[e.durationMs,`ms`]}),e.watcherConfirmed&&(0,A.jsx)(`span`,{className:`text-success`,children:r(`activity:codeMap.fsVerified`)})]})]})]},`${e.timestamp}-${t}`))}),(0,A.jsxs)(`div`,{className:`border-t px-4 py-2 font-mono text-[9px] text-muted-foreground`,children:[t.length,` events · newest first`]})]})}var be=4096,j=new Map;function M(e){let t=j.get(e);if(t!==void 0)return t;let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).toLocaleLowerCase();for(;j.size>=be;){let e=j.keys().next().value;if(e===void 0)break;j.delete(e)}return j.set(e,n),n}function N(e){return e.level===`packages`?`packages`:e.level===`files`?`files:${e.package}`:`symbols:${e.file}`}function xe(e){return e.level===`packages`?`/api/codemap/packages`:e.level===`files`?`/api/codemap/files?package=${encodeURIComponent(e.package)}`:`/api/codemap/symbols?file=${encodeURIComponent(e.file)}`}function Se(e,t,n){let r=new Map(e.nodes.map(e=>[e.id,e])),i=[];for(let a of e.edges){let e=n===`incoming`?a.target===t?a.source:void 0:a.source===t?a.target:void 0;if(!e)continue;let o=r.get(e);o&&i.push({node:o,edge:a})}return i.sort((e,t)=>t.edge.weight-e.edge.weight||e.node.label.localeCompare(t.node.label))}function Ce(e,t){let n=new Set([t]);for(let r of e.edges)r.source===t&&n.add(r.target),r.target===t&&n.add(r.source);return n}function P(e,t){let n=new Map(e.nodes.map(e=>[e.id,0]));for(let r of e.edges)t.has(r.source)&&t.has(r.target)&&(n.set(r.source,(n.get(r.source)??0)+r.weight),r.target!==r.source&&n.set(r.target,(n.get(r.target)??0)+r.weight));return n}function we(e){let t=new Set(e.nodes.map(e=>e.id)),n=P(e,t),r=new Map(e.nodes.map(e=>[e.id,0])),i=new Map;for(let n of e.edges){if(!t.has(n.source)||!t.has(n.target)||n.source===n.target)continue;r.set(n.target,(r.get(n.target)??0)+1);let e=i.get(n.source)??[];e.push(n.target),i.set(n.source,e)}let a=new Map,o=e.nodes.filter(e=>(r.get(e.id)??0)===0).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0)).map(e=>e.id);o.length===0&&e.nodes[0]&&o.push(e.nodes[0].id);for(let e of o)a.set(e,0);let s=new Set,c=0;for(;c<o.length;){let e=o[c++];if(!s.has(e)){s.add(e);for(let t of i.get(e)??[])a.set(t,Math.max(a.get(t)??0,Math.min((a.get(e)??0)+1,7))),r.set(t,(r.get(t)??1)-1),(r.get(t)??0)<=0&&o.push(t)}}let l=e.nodes.filter(e=>!a.has(e.id)).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0));l.forEach((e,t)=>{a.set(e.id,t%Math.min(4,Math.max(1,l.length)))});let u=new Map;for(let t of e.nodes){let e=a.get(t.id)??0,n=u.get(e)??[];n.push(t),u.set(e,n)}for(let e of u.values())e.sort((e,t)=>Number(e.external)-Number(t.external)||(n.get(t.id)??0)-(n.get(e.id)??0)||e.label.localeCompare(t.label));let d=Math.max(1,...[...u.values()].map(e=>e.length))*208,f=[];for(let[e,t]of[...u.entries()].sort(([e],[t])=>e-t)){let n=(d-t.length*208)/2;t.forEach((t,r)=>{f.push({node:t,position:{x:e*386,y:n+r*208}})})}return f}function F(e,t){if(e.nodes.length===0)return[];let n=P(e,new Set(e.nodes.map(e=>e.id))),r=e.nodes.find(e=>e.id===t)??[...e.nodes].sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0))[0],i=Ce(e,r.id);i.delete(r.id);let a=e.nodes.filter(e=>i.has(e.id)),o=e.nodes.filter(e=>e.id!==r.id&&!i.has(e.id)),s=[{node:r,position:{x:0,y:0}}],c=(e,t,n)=>{e.forEach((r,i)=>{let a=n+Math.PI*2*i/Math.max(1,e.length);s.push({node:r,position:{x:Math.cos(a)*t,y:Math.sin(a)*t}})})};c(a,Math.max(330,a.length*34),-Math.PI/2);for(let e=0;e<o.length;e+=18)c(o.slice(e,e+18),620+Math.floor(e/18)*280,-Math.PI/2+.12);return s}function Te(e,t,n){return t===`orbit`?F(e,n):t===`subsystems`?ke(e):we(e)}function Ee(e){return e.subsystem??e.package??`(ungrouped)`}var De=6,Oe=96;function ke(e){if(e.nodes.length===0)return[];let t=P(e,new Set(e.nodes.map(e=>e.id))),n=e=>e.rank??(t.get(e.id)??0)/1e3,r=new Map;for(let t of e.nodes){let e=Ee(t),n=r.get(e);n===void 0?r.set(e,[t]):n.push(t)}let i=[...r.entries()].map(([e,t])=>({name:e,nodes:[...t].sort((e,t)=>n(t)-n(e)||e.label.localeCompare(t.label)),weight:t.reduce((e,t)=>e+n(t),0)})).sort((e,t)=>e.name===`(ungrouped)`?1:t.name===`(ungrouped)`?-1:t.weight-e.weight||e.name.localeCompare(t.name)),a=[],o=0;for(let e of i){e.nodes.forEach((e,t)=>{a.push({node:e,position:{x:t%De*311,y:o+Math.floor(t/De)*208}})});let t=Math.ceil(e.nodes.length/De);o+=t*208+Oe}return a}function Ae(e,t,n){if(e.length<=n)return e;let r=t?e.filter(e=>e.source===t||e.target===t):[],i=e.filter(e=>!t||e.source!==t&&e.target!==t).sort((e,t)=>t.weight-e.weight||e.source.localeCompare(t.source)||e.target.localeCompare(t.target)),a=Math.max(0,n-r.length);return[...r,...i.slice(0,a)]}function je(e,t,n){if(n===`all`)return e;let r=e.nodes;if(e.nodes.length>96){let n=new Map(e.nodes.map(e=>[e.id,e])),i=new Map;for(let t of e.edges)i.set(t.source,(i.get(t.source)??0)+t.weight),i.set(t.target,(i.get(t.target)??0)+t.weight);let a=e.nodes.some(e=>e.rank!==void 0),o=e=>a?e.rank??0:i.get(e.id)??0,s=[...e.nodes].sort((e,t)=>o(t)-o(e)||e.label.localeCompare(t.label)),c=new Set,l=e=>{n.has(e)&&c.size<96&&c.add(e)};if(t&&n.has(t)){l(t);let n=e.edges.filter(e=>e.source===t||e.target===t).sort((e,t)=>t.weight-e.weight);for(let e of n)l(e.source),l(e.target);let r=new Set(c),i=e.edges.filter(e=>r.has(e.source)||r.has(e.target)).sort((e,t)=>t.weight-e.weight);for(let e of i)l(e.source),l(e.target)}else{let e=s.filter(e=>!e.external).slice(0,72),t=s.filter(e=>e.external).slice(0,24);for(let n of[...e,...t])l(n.id)}for(let e of s)l(e.id);r=e.nodes.filter(e=>c.has(e.id))}let i=new Set(r.map(e=>e.id)),a=e.edges.filter(e=>i.has(e.source)&&i.has(e.target));return{nodes:r,edges:Ae(a,t,180)}}var I=[`/src/main/java/`,`/src/main/kotlin/`,`/src/`,`/lib/`,`/internal/`,`/cmd/`,`/pkg/`,`/app/`];function L(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=e.package??``,r=n.startsWith(`@wrongstack/`)?`/packages/${n.slice(12)}/`:n.startsWith(`app:`)?`/apps/${n.slice(4)}/`:void 0;if(!r)return;let i=t.indexOf(r);return i>=0?t.slice(i+r.length):void 0}function R(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=L(e);if(n!==void 0)return n;let r=-1,i=0;for(let e of I){let n=t.lastIndexOf(e);n>r&&(r=n,i=n+e.length)}return r>=0?t.slice(i):t.split(`/`).slice(-3).join(`/`)}function Me(e){if(e.length===0)return``;let t=e.map(e=>e.split(`/`)),n=t[0]??[],r=0;for(;r<n.length-1;){let e=n[r];if(!t.every(t=>t.length-1>r&&t[r]===e))break;r++}return r===0?``:`${n.slice(0,r).join(`/`)}/`}var Ne=new WeakMap;function Pe(e){let t=Ne.get(e);if(t)return t;let n={name:``,path:``,directories:[],files:[]},r=e.filter(e=>e.kind===`file`&&!e.external),i=r.map(L),a=i.every(e=>e!==void 0),o=a?``:Me(r.map(e=>(e.file??e.label).replace(/\\/g,`/`)));for(let[e,t]of r.entries()){let r=(t.file??t.label).replace(/\\/g,`/`),s=i[e],c=(a?s??R(t):o&&r.startsWith(o)?r.slice(o.length):R(t)).split(`/`).filter(Boolean),l=c.pop()??t.label,u=n;for(let e of c){let t=u.path?`${u.path}/${e}`:e,n=u.directories.find(t=>t.name===e);n||(n={name:e,path:t,directories:[],files:[]},u.directories.push(n)),u=n}u.files.push({...t,label:l})}let s=e=>{e.directories.sort((e,t)=>e.name.localeCompare(t.name)),e.files.sort((e,t)=>e.label.localeCompare(t.label)),e.directories.forEach(s)};return s(n),Ne.set(e,n),n}function Fe(e){let t=2166136261,n=e=>{for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)};for(let t of e.nodes)n(t.id);for(let r of e.edges)n(r.source),n(r.target),n(r.refType),t^=r.weight|0,t=Math.imul(t,16777619);return`${e.nodes.length}:${e.edges.length}:${t>>>0}`}function Ie(e,t,n,r){for(e.has(t)&&e.delete(t),e.set(t,n);e.size>r;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function Le(e,t){if(!e||!t)return!1;let n=M(e),r=M(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function Re(e){let t=M(e),n=t.match(/\/packages\/([^/]+)\//);if(n?.[1])return`@wrongstack/${n[1]}`;let r=t.match(/\/apps\/([^/]+)\//);return r?.[1]?`app:${r[1]}`:`(root)`}function ze(e,t){return t.kind===`package`?Re(e.filePath)===(t.package??t.label):Le(e.filePath,t.file)?t.kind!==`symbol`||e.symbol?.id===t.id:!1}function z(e){let t=new Map;for(let n of e){let e=M(n.filePath),r=t.get(e);r?r.push(n):t.set(e,[n])}return t}function Be(e,t){let n=new Map;if(t.length===0||e.length===0)return n;let r=z(t),i=new Map;for(let a of e){let e;if(a.kind===`package`){let n=a.package??a.label,r=i.get(n);r||(r=t.filter(e=>Re(e.filePath)===n),i.set(n,r)),e=r}else if(a.file){let t=M(a.file),n=r.get(t);if(!n){n=[];for(let[e,i]of r)(e.endsWith(`/${t}`)||t.endsWith(`/${e}`))&&n.push(...i)}e=a.kind===`symbol`?n.filter(e=>e.symbol?.id===a.id):n}else e=[];e.length>0&&n.set(a.id,e)}return n}function Ve(e){if(e.length===0)return``;let t=`${e.length}`;for(let n=0;n<e.length;n++){let r=e[n];t+=`|${r.id??``}:${r.toolUseId??``}:${r.filePath}:${r.type}:${r.status??``}:${r.symbol?.id??``}:${r.timestamp}`}return t}function He(e,t){let n=t.filter(t=>t.kind===`symbol`&&!t.external&&Le(t.file,e.filePath));if(n.length===0)return;if(e.line)return[...n].sort((e,t)=>(t.line??0)-(e.line??0)).find(t=>(t.line??0)<=e.line)??n[0];let r=e.summary.toLocaleLowerCase();return n.find(e=>e.label.length>2&&(r.includes(e.label.toLocaleLowerCase())||!!(e.signature&&r.includes(e.signature.toLocaleLowerCase()))))}var B={package:{icon:S,accent:`border-l-primary`,iconStyle:`bg-primary/12 text-primary`},file:{icon:o,accent:`border-l-info`,iconStyle:`bg-info/12 text-info`},symbol:{icon:s,accent:`border-l-success`,iconStyle:`bg-success/12 text-success`}},V=.25;function Ue(e){return e===void 0?`border-l-[3px]`:e>=.6?`border-l-[7px]`:e>=V?`border-l-[5px]`:`border-l-[3px]`}var We={call:`hsl(var(--primary))`,import:`hsl(var(--info))`,type_ref:`hsl(var(--success))`,inherit:`hsl(var(--warning))`,implement:`hsl(var(--destructive))`},Ge={read:`ring-2 ring-info/60 shadow-info/20`,write:`ring-2 ring-warning/70 shadow-warning/30`,edit:`ring-2 ring-warning/80 shadow-warning/40`,delete:`ring-2 ring-destructive/70 shadow-destructive/30`,search:`ring-2 ring-primary/55 shadow-primary/20`,memory:`ring-2 ring-success/60 shadow-success/30`,index:`ring-2 ring-info/50 shadow-info/20`,execute:`ring-2 ring-primary/55 shadow-primary/25`},Ke=[`bg-primary text-primary-foreground`,`bg-info text-info-foreground`,`bg-success text-success-foreground`,`bg-warning text-warning-foreground`,`bg-destructive text-destructive-foreground`];function qe(e){let t=e.trim().split(/[\s:_-]+/).filter(Boolean);return(t.length>1?`${t[0]?.[0]??``}${t[1]?.[0]??``}`:e.slice(0,2)).toLocaleUpperCase()}function Je(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return Ke[Math.abs(t)%Ke.length]??Ke[0]}function Ye(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 82% 58%)`}var Xe=[`/packages/`,`/apps/`,`/crates/`,`/cmd/`,`/internal/`,`/pkg/`,`/src/`];function Ze(e){let t=e.replace(/\\/g,`/`),n=Xe.reduce((e,n)=>Math.max(e,t.lastIndexOf(n)),-1);return n>=0?t.slice(n+1):t.split(`/`).slice(-3).join(`/`)}function H(e){return[e.symbol?.name,e.line?`L${e.line}`:void 0].filter(Boolean).join(` · `)}function Qe({data:e}){let{t}=w(),{graphNode:n,selected:r,dimmed:i,incoming:a,outgoing:o,isActive:s,activityType:u,activeOperations:d}=e,f=B[n.kind],p=f.icon,m=n.kind===`package`||n.kind===`file`&&!!n.file,h=t(n.kind===`package`?`activity:codeMapTree.openFileMap`:`activity:codeMap.openSymbolMap`),g=n.kind===`symbol`?`${n.symbolKind??`symbol`}${n.line?` · L${n.line}`:``}`:n.kind===`file`?R(n):`${n.fileCount??0} files · ${n.symbolCount??0} symbols`;return(0,A.jsxs)(`div`,{className:O(`group relative w-[236px] pointer-events-auto border bg-card text-card-foreground shadow-[0_8px_24px_hsl(var(--shadow-color)/0.08)] transition-[opacity,box-shadow,border-color,background-color]`,f.accent,Ue(n.rank),r&&`border-primary bg-primary/5 shadow-[0_0_0_2px_hsl(var(--primary)/0.18),0_16px_36px_hsl(var(--shadow-color)/0.18)]`,n.external&&`border-dashed bg-muted/75`,i&&`opacity-25 grayscale`,s&&u&&Ge[u]),children:[d.length>0&&(0,A.jsxs)(`div`,{className:`absolute -top-5 left-2 z-20 flex max-w-[210px] items-center gap-1`,children:[d.slice(0,4).map(e=>{let t=e.agentName??e.agent??`External`,n=`${e.sessionId??`none`}:${e.agentId??t}`;return(0,A.jsxs)(`span`,{className:O(`flex h-6 items-center gap-1 border-2 border-background px-1.5 font-mono text-[8px] font-bold shadow-md`,Je(n)),title:`${t} · ${e.type} ${H(e)}`,children:[(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-current`}),qe(t),e.symbol&&(0,A.jsx)(`span`,{className:`max-w-[80px] truncate`,children:e.symbol.name})]},e.id??`${n}:${e.filePath}`)}),d.length>4&&(0,A.jsxs)(`span`,{className:`border bg-card px-1 font-mono text-[8px] shadow`,children:[`+`,d.length-4]})]}),(0,A.jsx)(T,{type:`target`,position:E.Left,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`}),(0,A.jsxs)(`button`,{type:`button`,className:`nodrag nopan block w-full cursor-pointer text-left focus-visible:outline-2 focus-visible:outline-primary`,onClick:t=>{if(t.shiftKey&&n.file){e.onShowHistory(n.file);return}m?e.onOpen(n):e.onSelect(n)},"aria-label":`${n.kind} ${n.label}`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,A.jsx)(`span`,{className:O(`flex h-8 w-8 shrink-0 items-center justify-center border`,f.iconStyle),children:(0,A.jsx)(p,{className:`h-4 w-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[9px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[(0,A.jsx)(`span`,{children:n.kind}),n.external&&(0,A.jsx)(`span`,{className:`border border-border px-1 py-0.5 text-[8px] text-warning`,children:`external`}),n.rank!==void 0&&n.rank>=.6&&(0,A.jsx)(`span`,{className:`border border-primary/40 bg-primary/10 px-1 py-0.5 text-[8px] text-primary`,children:t(`activity:codeMap.hub`)}),n.lang&&(0,A.jsx)(`span`,{className:`ml-auto font-mono normal-case tracking-normal`,children:n.lang})]}),(0,A.jsx)(`div`,{className:`truncate font-mono text-[13px] font-semibold`,title:n.label,children:n.label}),(0,A.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,title:g,children:g}),n.concept&&(0,A.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[9px] leading-snug text-muted-foreground/80`,title:n.concept,children:n.concept})]})]}),n.rank!==void 0&&(0,A.jsx)(`div`,{className:`h-[3px] w-full bg-muted`,title:t(`activity:codeMap.centrality`,{value:Math.round(n.rank*100)}),children:(0,A.jsx)(`div`,{className:`h-full bg-primary/70`,style:{width:`${Math.max(2,Math.round(n.rank*100))}%`}})}),(0,A.jsxs)(`div`,{className:`flex items-center gap-3 border-t bg-muted/30 px-3 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,A.jsxs)(`span`,{title:t(`activity:codeMapVisuals.incomingRelationships`),children:[`← `,a]}),(0,A.jsxs)(`span`,{title:t(`activity:codeMapVisuals.outgoingRelationships`),children:[`→ `,o]}),n.symbolCount!==void 0&&n.kind===`file`&&(0,A.jsxs)(`span`,{className:`ml-auto`,children:[n.symbolCount,` sym`]}),s&&(0,A.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-bold text-warning`,children:[(0,A.jsx)(l,{className:`h-2.5 w-2.5 animate-pulse`}),` LIVE`]})]})]}),(0,A.jsxs)(`div`,{className:`nodrag nopan flex items-center border-t bg-muted/20`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex h-8 cursor-pointer items-center gap-1 px-2 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:t=>{t.stopPropagation(),e.onSelect(n)},"aria-label":`${t(`activity:codeMap.relations`)}: ${n.label}`,"aria-pressed":r,children:[(0,A.jsx)(C,{className:`h-3.5 w-3.5`}),` `,t(`activity:codeMap.relations`)]}),m&&(0,A.jsxs)(`button`,{type:`button`,className:`ml-auto flex h-8 min-w-0 cursor-pointer items-center gap-1 px-2 text-[10px] text-primary hover:bg-primary/10`,onClick:t=>{t.stopPropagation(),e.onOpen(n)},title:h,"aria-label":`Open ${n.label} map`,children:[(0,A.jsx)(c,{className:`h-3.5 w-3.5 shrink-0`}),` `,(0,A.jsx)(`span`,{className:`truncate`,children:h})]}),n.file&&(0,A.jsx)(`button`,{type:`button`,className:`flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:t=>{t.stopPropagation(),e.onShowHistory(n.file)},"aria-label":`${t(`activity:codeMap.activity`)}: ${n.label}`,title:t(`activity:codeMap.activity`),children:(0,A.jsx)(y,{className:`h-3.5 w-3.5`})})]}),(0,A.jsx)(T,{type:`source`,position:E.Right,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`})]})}function U(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function $e(e,t){return e.graphNode===t.graphNode&&e.selected===t.selected&&e.dimmed===t.dimmed&&e.incoming===t.incoming&&e.outgoing===t.outgoing&&e.isActive===t.isActive&&e.activityType===t.activityType&&e.onSelect===t.onSelect&&e.onOpen===t.onOpen&&e.onShowHistory===t.onShowHistory&&U(e.activeOperations,t.activeOperations)}var W={codemap:(0,k.memo)(Qe,(e,t)=>$e(e.data,t.data))},et={nodes:[],edges:[]};function tt(e){return/Authentication required|Unauthorized/i.test(e)}function nt({loading:e,error:t,graph:n,canvasNodeCount:r,flowNodes:i,flowEdges:a,onNodesChange:o,onEdgesChange:s,onNodeClick:c,agentTrailCount:l}){let{t:u}=w();return(0,A.jsxs)(A.Fragment,{children:[e&&(0,A.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-background/75 backdrop-blur-sm`,children:[(0,A.jsx)(d,{className:`h-7 w-7 animate-spin text-primary`}),(0,A.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-widest text-muted-foreground`,children:u(`activity:codeMap.mappingRelationships`)})]}),t&&!e&&(0,A.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,A.jsx)(C,{className:`h-10 w-10 text-destructive`}),(0,A.jsx)(`p`,{className:`font-mono text-sm text-destructive`,children:t}),!tt(t)&&(0,A.jsxs)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:[`The map needs a codebase index. Run`,` `,(0,A.jsx)(`code`,{className:`border bg-muted px-1.5 py-0.5`,children:`codebase-index`}),` `,u(`activity:codeMap.onceThenReopenThisView`)]})]}),!e&&!t&&n.nodes.length===0&&(0,A.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-muted-foreground`,children:[(0,A.jsx)(C,{className:`h-8 w-8 opacity-40`}),(0,A.jsx)(`p`,{className:`text-xs`,children:u(`activity:codeMap.noIndexedNodesAtThisLevel`)})]}),!e&&!t&&n.nodes.length>1&&n.edges.length===0&&(0,A.jsxs)(`div`,{className:`pointer-events-none absolute left-1/2 top-14 z-10 -translate-x-1/2 border border-warning/40 bg-warning/10 px-3 py-2 text-center shadow backdrop-blur`,children:[(0,A.jsx)(`div`,{className:`font-mono text-[9px] font-bold uppercase tracking-wider text-warning`,children:u(`activity:codeMap.noResolvedRelationsInThisScope`)}),(0,A.jsx)(`div`,{className:`mt-0.5 text-[8px] text-muted-foreground`,children:u(`activity:codeMap.theUpgradedIndexWillRebuildAnd`)})]}),!t&&n.nodes.length>0&&(0,A.jsxs)(pe,{nodes:i,edges:a,onNodesChange:o,onEdgesChange:s,onNodeClick:c,nodeTypes:W,nodesConnectable:!1,nodesDraggable:!1,edgesFocusable:!1,elementsSelectable:!1,onlyRenderVisibleElements:!0,minZoom:.08,maxZoom:2.2,proOptions:{hideAttribution:!0},children:[(0,A.jsx)(fe,{variant:D.Dots,gap:r>60?32:22,size:1,color:`hsl(var(--muted-foreground))`,className:`!opacity-25`}),(0,A.jsx)(de,{position:`bottom-left`,showInteractive:!1,className:`!border !border-border !bg-card !shadow-md [&>button]:!border-border [&>button]:!bg-card [&>button]:!fill-foreground`}),r<=48&&(0,A.jsx)(le,{position:`bottom-right`,pannable:!0,zoomable:!0,className:`!h-[112px] !w-[180px] !border !border-border !bg-card !shadow-md`,maskColor:`hsl(var(--background) / 0.72)`,nodeColor:e=>{let t=e.data?.graphNode.kind;return t===`package`?`hsl(var(--primary))`:t===`file`?`hsl(var(--info))`:`hsl(var(--success))`}})]}),(0,A.jsxs)(`div`,{className:`pointer-events-none absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-3 border bg-card/90 px-3 py-1.5 font-mono text-[8px] text-muted-foreground shadow backdrop-blur`,children:[Object.entries(We).map(([e,t])=>(0,A.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(`span`,{className:`h-0.5 w-3`,style:{backgroundColor:t}}),e.replace(`_`,` `)]},e)),(0,A.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,"data-testid":`agent-trail-count`,children:[(0,A.jsx)(`span`,{className:`w-4 border-t-2 border-dashed border-primary`}),`agent trail`,l>0?` ×${l}`:``]})]})]})}function rt({layout:e,canvasMode:t,edgeFilter:n,canvasNodeCount:r,graphNodeCount:i,onLayoutChange:a,onCanvasModeChange:o,onEdgeFilterChange:s}){let{t:c}=w();return(0,A.jsxs)(`div`,{className:`pointer-events-none absolute left-3 right-3 top-3 z-10 flex items-center gap-2`,children:[(0,A.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`layers`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`layers`),children:[(0,A.jsx)(h,{className:`h-3 w-3`}),` `,c(`activity:codeMap.layers`)]}),(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`orbit`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`orbit`),children:[(0,A.jsx)(ee,{className:`h-3 w-3`}),` `,c(`activity:codeMap.relations`)]}),(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-8 items-center gap-1.5 px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`subsystems`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`subsystems`),title:c(`activity:codeMap.groupNodesByTheSubsystemTheyBelongTo`),children:[(0,A.jsx)(m,{className:`h-3 w-3`}),` `,c(`activity:codeMap.subsystems`)]})]}),(0,A.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,A.jsxs)(`button`,{type:`button`,className:O(`h-8 border-r px-2.5 font-mono text-[9px] font-bold`,t===`smart`?`bg-success text-success-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`smart`),title:c(`activity:codeMap.keepTheFullTreeShowTheStrongestRelationsAndSelectedNeighbourhood`),children:[`SMART `,r,`/`,i]}),(0,A.jsx)(`button`,{type:`button`,className:O(`h-8 px-2.5 font-mono text-[9px] font-bold`,t===`all`?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`all`),title:c(`activity:codeMap.renderEveryNodeAndRelationInThisScope`),children:c(`activity:codeMap.all`)})]}),(0,A.jsx)(`div`,{className:`pointer-events-auto ml-auto flex max-w-[60%] overflow-x-auto border bg-card/95 shadow-md backdrop-blur`,children:[`all`,`import`,`call`,`type_ref`,`inherit`,`implement`].map(e=>(0,A.jsx)(`button`,{type:`button`,className:O(`h-8 whitespace-nowrap border-r px-2.5 font-mono text-[9px] last:border-r-0`,n===e?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>s(e),children:e===`all`?`ALL LINKS`:e.replace(`_`,` `).toUpperCase()},e))})]})}function it(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a?a.type===t.type&&a.position.x===t.position.x&&a.position.y===t.position.y&&$e(a.data,t.data)?(e[i]!==a&&(r=!0),a):(r=!0,{...a,...t,measured:a.measured}):(r=!0,t)});return r?i:e}function G(e){return e.data?.renderKey}function at(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a&&G(a)===G(t)?(e[i]!==a&&(r=!0),a):(r=!0,t)});return r?i:e}function ot({scope:e,graph:t,agentPresences:n,edgeWeight:r,connectedNodeCount:a,navigate:o}){let{t:s}=w();return(0,A.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2 border-b bg-card px-4 py-3`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-[220px] items-center gap-3`,children:[(0,A.jsx)(`span`,{className:`flex h-9 w-9 items-center justify-center border border-primary bg-primary/10 text-primary`,children:(0,A.jsx)(C,{className:`h-4 w-4`})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h1`,{className:`font-display text-sm font-semibold tracking-tight`,children:s(`activity:codeMap.codeAtlas`)}),(0,A.jsx)(`p`,{className:`text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:s(`activity:codeMap.architectureIntelligence`)})]})]}),(0,A.jsxs)(`nav`,{className:`order-last flex w-full min-w-0 items-center gap-1 overflow-x-auto border-t pt-2 font-mono text-[11px] [&>button]:shrink-0 [&>svg]:shrink-0`,"aria-label":s(`activity:codeMap.codeMapBreadcrumb`),children:[e.level!==`packages`&&(0,A.jsx)(`button`,{type:`button`,className:`mr-1 flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,onClick:()=>{e.level===`symbols`?o({level:`files`,package:e.package??`(root)`},`file:${e.file}`):o({level:`packages`})},"aria-label":s(`activity:codeMap.back`),children:(0,A.jsx)(re,{className:`h-3.5 w-3.5`})}),(0,A.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 px-1.5 py-1 text-muted-foreground hover:text-foreground`,onClick:()=>o({level:`packages`}),"aria-current":e.level===`packages`?`page`:void 0,children:[(0,A.jsx)(i,{className:`h-3 w-3`}),` workspace`]}),e.level!==`packages`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(b,{className:`h-3 w-3 text-muted-foreground`}),(0,A.jsx)(`button`,{type:`button`,className:`whitespace-nowrap px-1.5 py-1 hover:text-primary`,"aria-current":e.level===`files`?`page`:void 0,onClick:()=>o({level:`files`,package:e.package??`(root)`}),children:e.package??`(root)`})]}),e.level===`symbols`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(b,{className:`h-3 w-3 text-muted-foreground`}),(0,A.jsx)(`span`,{className:`whitespace-nowrap px-1.5 py-1 text-primary`,"aria-current":`page`,title:e.file,children:R({id:``,label:e.file,kind:`file`,file:e.file,package:e.package})})]})]}),(0,A.jsxs)(`div`,{className:`ml-auto hidden items-center gap-5 xl:flex`,children:[(0,A.jsxs)(`div`,{className:O(`flex h-8 items-center gap-2 border px-2.5`,n.length>0?`border-success/50 bg-success/10 text-success`:`text-muted-foreground`),children:[(0,A.jsx)(l,{className:O(`h-3 w-3`,n.length>0&&`animate-pulse`)}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`font-mono text-[10px] font-bold`,children:[n.length,` LIVE`]}),(0,A.jsx)(`div`,{className:`text-[7px] uppercase tracking-wider`,children:`agents`})]})]}),(0,A.jsxs)(`div`,{className:`text-right`,children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.nodes.length}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`nodes`})]}),(0,A.jsxs)(`div`,{className:`text-right`,children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.edges.length}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`links`})]}),(0,A.jsxs)(`div`,{className:`text-right`,children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:r}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`references`})]}),(0,A.jsxs)(`div`,{className:`text-right`,children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:a}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`connected`})]})]})]})}function st({activity:e}){return(0,A.jsx)(`span`,{className:O(`shrink-0 border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/50 bg-destructive/10 text-destructive`:e.type===`read`?`border-info/50 bg-info/10 text-info`:e.type===`search`||e.type===`index`?`border-primary/50 bg-primary/10 text-primary`:`border-warning/50 bg-warning/10 text-warning`),children:e.filePath.startsWith(`(tool:`)?e.toolName:e.type})}function K({activity:e,onLocate:t,showAgent:n=!1}){let{t:r}=w(),i=e.agentName??e.agent??`External process`,a=`${e.sessionId??`none`}:${e.agentId??i}`;return(0,A.jsxs)(`button`,{type:`button`,className:`group flex w-full items-start gap-2 border-b px-3 py-2 text-left last:border-b-0 hover:bg-muted/70`,onClick:()=>!e.filePath.startsWith(`(`)&&t(e),title:`Locate ${e.filePath}`,children:[n&&(0,A.jsx)(`span`,{className:O(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center font-mono text-[8px] font-black`,Je(a)),children:qe(i)}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,A.jsx)(st,{activity:e}),n&&(0,A.jsx)(`span`,{className:`truncate text-[9px] font-semibold`,children:i}),e.status===`active`&&(0,A.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[8px] font-bold text-success`,children:[(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-success`}),` `,r(`activity:codeMap.live`)]}),e.watcherConfirmed&&(0,A.jsx)(ie,{className:`ml-auto h-3 w-3 text-success`,"aria-label":r(`activity:codeMap.filesystemConfirmed`)}),e.attribution===`correlated`&&!e.watcherConfirmed&&(0,A.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-warning`,title:r(`activity:codeMap.correlatedFromTheOnlyActiveTool`),children:r(`activity:codeMap.correlated`)}),e.attribution===`external`&&(0,A.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-destructive`,children:`external`})]}),(0,A.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px] font-semibold`,title:e.filePath,children:Ze(e.filePath)}),(e.symbol||e.line)&&(0,A.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 truncate font-mono text-[8px] text-success`,children:[(0,A.jsx)(x,{className:`h-2.5 w-2.5 shrink-0`}),e.symbol?.name??`line ${e.line}`,e.symbol?.kind&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,e.symbol.kind]})]}),e.change&&(0,A.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,A.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,A.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.durationMs!==void 0&&(0,A.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[e.durationMs,`ms`]})]}),e.summary&&e.summary!==e.toolName&&(0,A.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[8px] leading-3 text-muted-foreground`,children:e.summary})]}),!e.filePath.startsWith(`(`)&&(0,A.jsx)(c,{className:`mt-1 h-3 w-3 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100`})]})}function ct({presences:e,onLocate:t}){let{t:n}=w();return e.length===0?null:(0,A.jsxs)(`section`,{className:`pointer-events-auto absolute left-3 top-14 z-20 w-[304px] border bg-card/95 shadow-xl backdrop-blur`,children:[(0,A.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,A.jsx)(l,{className:`h-3.5 w-3.5 animate-pulse text-success`}),(0,A.jsx)(`h2`,{className:`text-[9px] font-black uppercase tracking-[0.18em]`,children:n(`activity:codeMap.liveAgentOperations`)}),(0,A.jsxs)(`span`,{className:`ml-auto bg-success px-1.5 py-0.5 font-mono text-[8px] font-bold text-success-foreground`,children:[e.length,` ONLINE`]})]}),(0,A.jsx)(`div`,{className:`max-h-[330px] overflow-y-auto`,children:e.map(e=>(0,A.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/35 px-3 py-1.5`,children:[(0,A.jsx)(`span`,{className:O(`flex h-6 w-6 items-center justify-center font-mono text-[8px] font-black`,Je(e.key)),children:qe(e.agentName)}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`truncate text-[9px] font-bold`,children:e.agentName}),(0,A.jsxs)(`div`,{className:`truncate font-mono text-[7px] text-muted-foreground`,children:[`session `,e.sessionId.slice(0,12),` · agent `,e.agentId.slice(0,12)]})]}),(0,A.jsxs)(`span`,{className:`font-mono text-[8px] text-success`,children:[e.operations.length,` op`]})]}),e.operations.map(e=>(0,A.jsx)(K,{activity:e,onLocate:t},e.id??`${e.toolUseId}:${e.filePath}`))]},e.key))})]})}function lt({paused:e,followLive:t,agentFilter:n,agents:i,onTogglePaused:a,onToggleFollow:o,onAgentFilter:s}){let{t:c}=w();return(0,A.jsxs)(`div`,{className:`pointer-events-auto absolute right-3 top-14 z-20 flex h-9 items-center border bg-card/95 shadow-lg backdrop-blur`,children:[(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:o,title:c(`activity:codeMap.automaticallyEnterTheFileFunctionUsedByTheNewestVisibleAgent`),children:[(0,A.jsx)(x,{className:`h-3 w-3`}),` `,c(`activity:codeMap.follow`)]}),(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,e?`bg-warning text-warning-foreground`:`text-success hover:bg-success/10`),onClick:a,title:e?`Resume the live telemetry stream`:`Freeze the current telemetry frame`,children:[e?(0,A.jsx)(u,{className:`h-3 w-3`}):(0,A.jsx)(r,{className:`h-3 w-3`}),e?`Resume`:`Live`]}),(0,A.jsxs)(`label`,{className:`flex h-full items-center gap-1.5 px-2 text-[8px] uppercase text-muted-foreground`,children:[c(`activity:codeMap.agent`),(0,A.jsxs)(`select`,{"aria-label":c(`activity:codeMap.filterCodemapByAgentAndSession`),className:`h-6 max-w-[170px] border bg-background px-1.5 font-mono text-[8px] text-foreground outline-none focus:border-primary`,value:n,onChange:e=>s(e.target.value),children:[(0,A.jsx)(`option`,{value:`all`,children:c(`activity:codeMap.allAgents`)}),i.map(e=>(0,A.jsxs)(`option`,{value:e.key,children:[e.agentName,` · `,e.sessionId.slice(0,10)]},e.key))]})]})]})}function ut({activeOperations:e,recentActivities:t,activityTotalCount:n,onLocate:r}){let{t:i}=w();return(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[e.length>0&&(0,A.jsxs)(`section`,{className:`border-b`,children:[(0,A.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b bg-success/5 px-3`,children:[(0,A.jsx)(l,{className:`h-3 w-3 animate-pulse text-success`}),(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.activeNow`)}),(0,A.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:e.length})]}),e.map(e=>(0,A.jsx)(K,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,A.jsxs)(`section`,{children:[(0,A.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,A.jsx)(y,{className:`h-3 w-3 text-muted-foreground`}),(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.eventStream`)}),(0,A.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] text-muted-foreground`,children:[n,` total`]})]}),t.length>0?t.map((e,t)=>(0,A.jsx)(K,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.timestamp}:${t}`)):(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-7 py-16 text-center`,children:[(0,A.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center border bg-muted text-muted-foreground`,children:(0,A.jsx)(_,{className:`h-5 w-5`})}),(0,A.jsx)(`h3`,{className:`text-xs font-semibold`,children:i(`activity:codeMap.selectANodeOrWaitFor`)}),(0,A.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-muted-foreground`,children:i(`activity:codeMap.relationsAppearOnSelectionToolCalls`)})]})]})]})}function dt({node:e,incomingCount:t,outgoingCount:n,onOpenNode:r,onOpenActivity:i}){let{t:a}=w(),o=B[e.kind].icon;return(0,A.jsxs)(`div`,{className:`border-b bg-muted/25 p-3`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:O(`flex h-8 w-8 items-center justify-center border`,B[e.kind].iconStyle),children:(0,A.jsx)(o,{className:`h-4 w-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`text-[8px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[e.external?`external `:``,e.kind]}),(0,A.jsx)(`div`,{className:`truncate font-mono text-xs font-semibold`,title:e.label,children:e.label})]})]}),(0,A.jsx)(`div`,{className:`break-all font-mono text-[9px] leading-relaxed text-muted-foreground`,children:e.file?R(e):e.package}),e.subsystem&&(0,A.jsx)(`div`,{className:`mt-2 inline-flex items-center gap-1 border border-border px-1.5 py-0.5 text-[8px] uppercase tracking-wider text-muted-foreground`,children:e.subsystem}),e.concept&&(0,A.jsx)(`p`,{className:`mt-2 text-[11px] leading-relaxed text-foreground`,children:e.concept}),e.crux&&(0,A.jsxs)(`div`,{className:`mt-1 font-mono text-[9px] text-muted-foreground`,children:[a(`activity:codeMap.crux`),` L`,e.crux.start,`–L`,e.crux.end]}),e.signature&&(0,A.jsx)(`pre`,{className:`mt-3 overflow-x-auto border bg-background p-2 font-mono text-[9px] leading-relaxed text-foreground`,children:e.signature}),(0,A.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 border`,children:[(0,A.jsx)(q,{value:t,label:a(`activity:codeMap.incoming`),className:`border-r text-info`}),(0,A.jsx)(q,{value:n,label:a(`activity:codeMap.outgoing`),className:`border-r text-primary`}),(0,A.jsx)(q,{value:e.symbolCount??e.fileCount??e.line??`—`,label:e.kind===`package`?`files`:e.kind===`file`?`symbols`:`line`})]}),(0,A.jsx)(`div`,{className:`mt-2 grid grid-cols-1 border`,children:(0,A.jsx)(q,{value:e.rank===void 0?`—`:`${Math.round(e.rank*100)}%`,label:a(`activity:codeMap.centralityLabel`)})}),(0,A.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[e.kind!==`symbol`&&(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 flex-1 items-center justify-center gap-1.5 border bg-foreground text-[9px] font-semibold uppercase tracking-wider text-background hover:opacity-90`,onClick:()=>r(e),children:[(0,A.jsx)(c,{className:`h-3 w-3`}),` Open`,` `,e.kind===`package`?`files`:`symbols`]}),e.file&&(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center justify-center gap-1.5 border px-2 text-[9px] uppercase text-muted-foreground hover:bg-muted`,onClick:()=>i(e.file),children:[(0,A.jsx)(y,{className:`h-3 w-3`}),` `,a(`activity:codeMap.activity`)]})]})]})}function q({value:e,label:t,className:n}){return(0,A.jsxs)(`div`,{className:O(`p-2 text-center`,n),children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:e}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:t})]})}function ft(e){let{t}=w(),{title:n,subtitle:r,items:i,graph:a,selectedId:o,expanded:s,onToggle:c,onSelect:l}=e;return(0,A.jsxs)(`section`,{className:`border-b py-3`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-end justify-between px-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em]`,children:n}),(0,A.jsx)(`p`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:r})]}),(0,A.jsx)(`span`,{className:`border bg-muted px-1.5 py-0.5 font-mono text-[9px]`,children:i.length})]}),i.length===0?(0,A.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-muted-foreground`,children:t(`activity:codeMap.noRelationshipsInThisView`)}):i.map(e=>{let t=`${n}:${e.node.id}`,r=s.has(t),i=[...Se(a,e.node.id,`incoming`),...Se(a,e.node.id,`outgoing`)].filter((e,t,n)=>e.node.id!==o&&n.findIndex(t=>t.node.id===e.node.id)===t).slice(0,8);return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`group flex min-h-9 items-center gap-1 px-2 hover:bg-muted/70`,children:[(0,A.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>i.length>0&&c(t),"aria-label":`${r?`Collapse`:`Expand`} relation ${e.node.label}`,children:i.length>0?r?(0,A.jsx)(p,{className:`h-3 w-3`}):(0,A.jsx)(b,{className:`h-3 w-3`}):(0,A.jsx)(`span`,{className:`h-px w-2 bg-border`})}),(0,A.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 py-1 text-left`,onClick:()=>l(e.node),children:[(0,A.jsx)(`span`,{className:`block truncate font-mono text-[10px] font-semibold`,title:e.node.label,children:e.node.label}),(0,A.jsx)(`span`,{className:`block truncate text-[9px] text-muted-foreground`,children:e.node.package??e.node.symbolKind??e.node.kind})]}),(0,A.jsx)(`span`,{className:`border px-1 py-0.5 font-mono text-[8px] text-muted-foreground`,children:e.edge.refType}),(0,A.jsxs)(`span`,{className:`w-5 text-right font-mono text-[9px] text-muted-foreground`,children:[`×`,e.edge.weight]})]}),r&&i.map(e=>(0,A.jsxs)(`button`,{type:`button`,className:`relative flex h-7 w-full items-center gap-2 border-l border-border pl-11 pr-3 text-left text-[9px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:()=>l(e.node),children:[(0,A.jsx)(`span`,{className:`absolute left-7 top-1/2 h-px w-3 bg-border`}),(0,A.jsx)(_,{className:`h-3 w-3 shrink-0`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.node.label}),(0,A.jsx)(`span`,{className:`ml-auto font-mono opacity-70`,children:e.edge.refType})]},`${t}:${e.node.id}`))]},t)})]})}function pt({selectedNode:e,incoming:t,outgoing:n,filteredGraph:r,expandedRelations:i,activeOperations:a,recentActivities:o,activityTotalCount:s,selectedActivities:c,onClearSelection:u,onOpenNode:d,onOpenActivity:p,onLocateActivity:m,onToggleRelation:h,onSelectNode:g}){let{t:_}=w();return(0,A.jsxs)(`aside`,{className:`flex w-[326px] shrink-0 flex-col border-l bg-card/80`,children:[(0,A.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b px-3`,children:[(0,A.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:_(`activity:codeMap.relationInspector`)}),e&&(0,A.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground`,onClick:u,"aria-label":_(`activity:codeMap.clearSelection`),children:(0,A.jsx)(f,{className:`h-3.5 w-3.5`})})]}),e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,A.jsx)(dt,{node:e,incomingCount:t.length,outgoingCount:n.length,onOpenNode:d,onOpenActivity:p}),c.length>0&&(0,A.jsxs)(`section`,{className:`border-b bg-success/5 py-2`,children:[(0,A.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-3`,children:[(0,A.jsx)(l,{className:`h-3 w-3 animate-pulse text-success`}),(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:_(`activity:codeMap.agentsOnThisNode`)}),(0,A.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:c.length})]}),c.map(e=>(0,A.jsx)(K,{activity:e,onLocate:m,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,A.jsx)(ft,{title:_(`activity:codeMap.incoming`),subtitle:_(`activity:codeMap.whoDependsOnThis`),items:t,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g}),(0,A.jsx)(ft,{title:_(`activity:codeMap.outgoing`),subtitle:_(`activity:codeMap.whatThisDependsOn`),items:n,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g})]}):(0,A.jsx)(ut,{activeOperations:a,recentActivities:o,activityTotalCount:s,onLocate:m})]})}function mt({node:e,onSelect:t,virtual:n}){let r=B[e.kind].icon;return(0,A.jsxs)(`button`,{type:`button`,"data-index":n?.index,ref:n?e=>n.measureElement(e):void 0,className:O(`min-h-8 items-center gap-2 px-3 py-1 text-left hover:bg-muted`,n?`absolute left-0 flex w-full`:`flex w-full`),style:n?{transform:`translateY(${n.start}px)`}:void 0,onClick:()=>t(e),children:[(0,A.jsx)(r,{className:O(`h-3.5 w-3.5 shrink-0`,e.kind===`package`?`text-primary`:e.kind===`file`?`text-info`:`text-success`)}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`span`,{className:`block truncate font-mono text-[10px]`,children:e.label}),(0,A.jsx)(`span`,{className:`block truncate text-[8px] text-muted-foreground`,children:e.file??e.package??e.symbolKind})]}),(0,A.jsx)(`span`,{className:`text-[8px] uppercase text-muted-foreground`,children:e.kind.slice(0,3)})]},e.id)}var ht=80,gt=40;function _t(e,t){if(!e||t.size===0)return!1;let n=M(e);if(t.has(n))return!0;for(let e of t)if(e.endsWith(`/${n}`)||n.endsWith(`/${e}`))return!0;return!1}var J=(0,k.memo)(function e(t){let{t:n}=w(),{directory:r,packageName:i,depth:a,expandedDirectories:u,expandedFiles:f,loadingBranches:m,graphForFile:h,onToggleDirectory:_,onToggleFile:ee,onSelectFile:te,onOpenFile:y,onSelectSymbol:ne,selectedId:x,activeFileNorms:re,activeSymbolIds:S,revealAllKeys:C,onRevealAll:ie}=t,T=`files:${i}:${r.path||`.`}`,ae=C.has(T)?r.files:r.files.slice(0,ht),oe=r.files.length-ae.length;return(0,A.jsxs)(A.Fragment,{children:[r.directories.map(n=>{let r=`${i}:${n.path}`,o=u.has(r);return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:8+a*12},onClick:()=>_(r),children:[o?(0,A.jsx)(p,{className:`h-3 w-3`}):(0,A.jsx)(b,{className:`h-3 w-3`}),o?(0,A.jsx)(g,{className:`h-3.5 w-3.5 text-warning`}):(0,A.jsx)(v,{className:`h-3.5 w-3.5 text-warning`}),(0,A.jsx)(`span`,{className:`truncate`,children:n.name})]}),o&&(0,A.jsx)(e,{...t,directory:n,depth:a+1})]},r)}),ae.map(e=>{let t=f.has(e.file??e.id),r=N({level:`symbols`,file:e.file??e.label}),i=(e.file?h(e.file):void 0)?.nodes.filter(t=>t.kind===`symbol`&&t.file===e.file&&!t.external)??[],u=`symbols:${e.file??e.id}`,g=C.has(u)?i:i.slice(0,gt),_=i.length-g.length,v=_t(e.file,re);return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:O(`group flex h-7 items-center pr-1 text-[11px] hover:bg-muted`,x===e.id&&`bg-primary/10 text-primary`),style:{paddingLeft:8+a*12},children:[(0,A.jsx)(`button`,{type:`button`,className:`flex h-6 w-4 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>ee(e),"aria-label":`${t?`Collapse`:`Expand`} ${e.label}`,children:m.has(r)?(0,A.jsx)(d,{className:`h-3 w-3 animate-spin`}):t?(0,A.jsx)(p,{className:`h-3 w-3`}):(0,A.jsx)(b,{className:`h-3 w-3`})}),(0,A.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>te(e),onDoubleClick:()=>y(e),children:[(0,A.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-info`}),v&&(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 animate-pulse bg-success`,title:n(`activity:codeMap.liveOperation`)}),(0,A.jsx)(`span`,{className:`truncate font-mono`,title:e.file,children:e.label}),(0,A.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.symbolCount??0})]}),(0,A.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>y(e),title:n(`activity:codeMap.openSymbolMap`),"aria-label":`Open ${e.label} map`,children:(0,A.jsx)(c,{className:`h-3 w-3`})})]}),t&&g.map(e=>(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[10px] hover:bg-muted`,x===e.id?`bg-primary/10 text-primary`:`text-muted-foreground`),style:{paddingLeft:38+a*12},onClick:()=>ne(e),children:[(0,A.jsx)(s,{className:`h-3 w-3 shrink-0 text-success`}),S.has(e.id)&&(0,A.jsx)(l,{className:`h-3 w-3 shrink-0 animate-pulse text-success`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.label}),e.line&&(0,A.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] opacity-60`,children:[`:`,e.line]})]},e.id)),t&&_>0&&(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:38+a*12},onClick:()=>ie(u),children:[`Show `,_,` more symbols`]})]},e.id)}),oe>0&&(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:8+a*12},onClick:()=>ie(T),children:[`Show `,oe,` more files`]})]})});function vt({rootGraph:e,search:t,searchInput:n,searchResults:r,virtualizeSearch:i,searchVirtualizer:o,treeScrollRef:s,selectedId:l,expandedPackages:u,expandedDirectories:m,expandedFiles:h,loadingBranches:g,activeFileNorms:_,activeSymbolIds:ee,revealAllKeys:v,packageGraph:te,graphForFile:y,navigate:ne,togglePackage:x,toggleDirectory:re,toggleFile:C,revealAllTree:ie,selectFileFromTree:T,selectSymbolFromTree:ae,selectSearchResult:oe,handleOpenNode:se,onSearchInputChange:E,onSearchChange:ce}){let{t:D}=w();return(0,A.jsxs)(`aside`,{className:`flex w-[286px] shrink-0 flex-col border-r bg-card/70`,children:[(0,A.jsxs)(`div`,{className:`border-b p-3`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,A.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:D(`activity:codeMapTree.codeTree`)}),(0,A.jsxs)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:[e.nodes.length,` roots`]})]}),(0,A.jsxs)(`label`,{className:`flex h-8 items-center gap-2 border bg-background px-2 focus-within:border-primary`,children:[(0,A.jsx)(a,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,A.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent font-mono text-[10px] outline-none placeholder:text-muted-foreground`,value:n,onChange:e=>E(e.target.value),placeholder:D(`activity:codeMapTree.findPackageFileSymbol`)}),n&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>{E(``),ce(``)},"aria-label":D(`activity:codeMapTree.clearSearch`),children:(0,A.jsx)(f,{className:`h-3 w-3 text-muted-foreground`})})]})]}),(0,A.jsx)(`div`,{ref:s,className:`min-h-0 flex-1 overflow-y-auto py-2`,children:t.trim()?(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`px-3 pb-2 text-[9px] text-muted-foreground`,children:[r.length,` loaded-map results`]}),r.length===0?(0,A.jsxs)(`p`,{className:`px-3 py-8 text-center text-[10px] text-muted-foreground`,children:[D(`activity:codeMapTree.noMatchInLoadedBranches`),(0,A.jsx)(`br`,{}),D(`activity:codeMapTree.expandAPackageToSearchIts`)]}):i?(0,A.jsx)(`div`,{style:{height:`${o.getTotalSize()}px`,width:`100%`,position:`relative`},children:o.getVirtualItems().map(e=>{let t=r[e.index];return t?(0,A.jsx)(mt,{node:t,onSelect:oe,virtual:{index:e.index,start:e.start,measureElement:o.measureElement}},t.id):null})}):r.map(e=>(0,A.jsx)(mt,{node:e,onSelect:oe},e.id))]}):e.nodes.map(e=>{let t=e.package??e.label,n=u.has(t),r=N({level:`files`,package:t}),i=te(t),a=i?Pe(i.nodes):void 0;return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:O(`group flex h-8 items-center px-2 hover:bg-muted`,l===e.id&&`bg-primary/10 text-primary`),children:[(0,A.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 items-center justify-center text-muted-foreground`,onClick:()=>x(e),"aria-label":`${n?`Collapse`:`Expand`} ${t}`,children:g.has(r)?(0,A.jsx)(d,{className:`h-3 w-3 animate-spin`}):n?(0,A.jsx)(p,{className:`h-3 w-3`}):(0,A.jsx)(b,{className:`h-3 w-3`})}),(0,A.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>ne({level:`packages`},e.id),onDoubleClick:()=>ne({level:`files`,package:t}),children:[(0,A.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-[10px] font-semibold`,children:e.label}),(0,A.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.fileCount??0})]}),(0,A.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>ne({level:`files`,package:t}),title:D(`activity:codeMapTree.openFileMap`),"aria-label":`Open ${t} map`,children:(0,A.jsx)(c,{className:`h-3 w-3`})})]}),n&&a&&(0,A.jsx)(J,{directory:a,packageName:t,depth:1,expandedDirectories:m,expandedFiles:h,loadingBranches:g,graphForFile:y,onToggleDirectory:re,onToggleFile:C,onSelectFile:T,onOpenFile:se,onSelectSymbol:ae,selectedId:l,activeFileNorms:_,activeSymbolIds:ee,revealAllKeys:v,onRevealAll:ie})]},e.id)})}),(0,A.jsxs)(`div`,{className:`border-t px-3 py-2 text-[9px] leading-relaxed text-muted-foreground`,children:[D(`activity:codeMapTree.clickToFocusDoubleClickTo`),(0,A.jsx)(`br`,{}),D(`activity:codeMapTree.branchesStayOpenWhileTheMap`)]})]})}function yt(){let[e,t]=(0,k.useState)({level:`packages`}),n=N(e),[r,i]=(0,k.useState)(et),[a,o]=(0,k.useState)(!0),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(null),[d,f]=(0,k.useState)(`layers`),[p,m]=(0,k.useState)(`smart`),[h,g]=(0,k.useState)(`all`),[_,ee]=(0,k.useState)(``),[v,y]=(0,k.useState)(``),[b,x]=(0,k.useState)(new Set),[re,S]=(0,k.useState)(new Set),[C,w]=(0,k.useState)(new Set),[ie,T]=(0,k.useState)(new Set),[ae,E]=(0,k.useState)(new Set),[D,le]=(0,k.useState)(new Set),[de,fe]=(0,k.useState)(0),[pe,O]=(0,k.useState)(null),[be,j]=(0,k.useState)(!1),[P,we]=(0,k.useState)(`all`),[F,Ee]=(0,k.useState)(null),[De,Oe]=(0,k.useState)(null),[ke,Ae]=(0,k.useState)(0),I=(0,k.useRef)(new Map),L=(0,k.useRef)(null),R=(0,k.useRef)(null),Me=(0,k.useRef)(``),Ne=(0,k.useRef)(``),z=(0,k.useRef)(null),B=(0,k.useRef)(new Set),{history:V,pulses:Ue,activeOperationsMap:Ge,activityTotalCount:Ke,resolveActivitySymbol:Je,getActivityForFile:Xe,sweepActivity:Ze}=me(te(e=>({history:e.history,pulses:e.pulses,activeOperationsMap:e.activeOperations,activityTotalCount:e.totalCount,resolveActivitySymbol:e.resolveActivitySymbol,getActivityForFile:e.getActivityForFile,sweepActivity:e._sweep}))),H=(0,k.useMemo)(()=>[...Ge.values()].flat(),[Ge]),Qe=(0,k.useMemo)(()=>[...Ue.keys()].map(e=>V.get(e)?.[0]).filter(e=>!!e),[V,Ue]),U=(0,k.useMemo)(()=>{let e=[];for(let t of V.values())e.push(...t.slice(0,16));return e.sort((e,t)=>t.timestamp-e.timestamp).slice(0,16)},[V]),$e=(0,k.useMemo)(()=>he([...H,...U]),[H,U]),W=(0,k.useMemo)(()=>{let e=F??H;return P===`all`?e:e.filter(e=>ge(e)===P)},[H,P,F]),tt=(0,k.useMemo)(()=>{let e=De??U;return P===`all`?e:e.filter(e=>ge(e)===P)},[P,De,U]),G=(0,k.useDeferredValue)(W),st=(0,k.useDeferredValue)(tt),K=(0,k.useDeferredValue)(Qe),ut=(0,k.useMemo)(()=>he(W),[W]),[dt,q,ft]=se([]),[mt,ht,gt]=oe([]),{fitView:_t}=ue(),J=(0,k.useCallback)(async(e,t=!1)=>{let n=N(e),r=I.current.get(n);if(r&&!t)return Ie(I.current,n,r,48),r;let i=await fetch(xe(e),{credentials:`same-origin`});if(!i.ok){if(i.status===401||i.status===403)throw Error(`Authentication required — open this dashboard from its token URL.`);let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();return Ie(I.current,n,a,48),fe(e=>e+1),a},[]);(0,k.useEffect)(()=>{let e=window.setTimeout(()=>y(_),150);return()=>window.clearTimeout(e)},[_]);let yt=ve(e=>e.generation),bt=(0,k.useRef)(0),xt=(0,k.useRef)(null);(0,k.useEffect)(()=>{let t=!1,n=yt>bt.current;return n&&(bt.current=yt,I.current.clear(),fe(e=>e+1),x(new Set),S(new Set),w(new Set),E(new Set)),o(!0),c(null),J(e,n).then(e=>{if(!t){if(i(e),!n){let t=L.current;L.current=null,u(t&&e.nodes.some(e=>e.id===t)?t:null)}o(!1)}}).catch(e=>{t||(c(e instanceof Error?e.message:String(e)),i(et),o(!1))}),()=>{t=!0}},[n,J,yt,e]);let Y=(0,k.useCallback)((e,r)=>{if(L.current=r??null,N(e)===n){u(r??null),L.current=null;return}t(e)},[n]),St=(0,k.useCallback)(async e=>{let t=N(e);if(!(I.current.has(t)||D.has(t))){le(e=>new Set(e).add(t));try{await J(e)}finally{le(e=>{let n=new Set(e);return n.delete(t),n})}}},[J,D]);(0,k.useEffect)(()=>{let e=!1,t=0;for(let n of H){if(t>=2)break;if(n.symbol||!n.toolUseId||n.filePath.startsWith(`(`))continue;let r=n.filePath;B.current.has(r)||(B.current.add(r),t+=1,J({level:`symbols`,file:r}).then(t=>{if(e)return;let i=He(n,t.nodes);i&&Je(n.toolUseId,r,{id:i.id,name:i.label,...i.symbolKind?{kind:i.symbolKind}:{},...i.line?{line:i.line}:{}})}).catch(()=>void 0).finally(()=>{B.current.delete(r)}))}return()=>{e=!0}},[H,J,Je]);let X=(0,k.useMemo)(()=>({nodes:r.nodes,edges:h===`all`?r.edges:r.edges.filter(e=>e.refType===h)}),[r,h]),Z=r.nodes.find(e=>e.id===l),Q=(0,k.useMemo)(()=>je(X,l,p),[p,X,l]),Ct=(0,k.useMemo)(()=>l?Ce(X,l):new Set,[X,l]),{incomingCounts:wt,outgoingCounts:Tt}=(0,k.useMemo)(()=>{let e=new Map,t=new Map;for(let n of X.edges)t.set(n.source,(t.get(n.source)??0)+1),e.set(n.target,(e.get(n.target)??0)+1);return{incomingCounts:e,outgoingCounts:t}},[X]),Et=d===`orbit`?l??void 0:void 0,Dt=(0,k.useMemo)(()=>Te(Q,d,Et),[Q,d,Et]),Ot=(0,k.useMemo)(()=>[n,d,d===`orbit`?l??``:``,Fe(Q)].join(``),[Q,n,d,l]),kt=(0,k.useCallback)(e=>{u(e.id),T(new Set)},[]),$=(0,k.useCallback)(e=>{e.kind===`package`&&Y({level:`files`,package:e.package??e.label}),e.kind===`file`&&e.file&&Y({level:`symbols`,file:e.file,package:e.package})},[Y]),At=(0,k.useCallback)((e,t)=>{let n=t.data;n?.graphNode&&(n.graphNode.kind===`package`||n.graphNode.kind===`file`&&n.graphNode.file?$(n.graphNode):kt(n.graphNode))},[$,kt]),jt=(0,k.useMemo)(()=>[Ve(G),Ve(K),Ve(st)].join(``),[G,K,st]),Mt=(0,k.useMemo)(()=>{let e=new Set;for(let t of W)e.add(M(t.filePath));return e},[W]),Nt=(0,k.useMemo)(()=>{let e=new Set;for(let t of W)t.symbol?.id&&e.add(t.symbol.id);return e},[W]);(0,k.useEffect)(()=>{let e=()=>{let e=Dt.map(({node:e})=>e),t=Be(e,G),n=Be(e,K),r=new Set(t.keys()),i=Dt.map(({node:e,position:r})=>{let i=t.get(e.id)??[],a=i[0]??n.get(e.id)?.[0];return{id:e.id,type:`codemap`,position:r,style:{pointerEvents:`all`},data:{graphNode:e,selected:e.id===l,dimmed:!!l&&!Ct.has(e.id),incoming:wt.get(e.id)??0,outgoing:Tt.get(e.id)??0,isActive:!!a,...a?{activityType:a.type}:{},activeOperations:i,onSelect:kt,onOpen:$,onShowHistory:O}}});q(e=>it(e,i));let a=6,o=Q.edges.map((e,t)=>{let n=!!l&&(e.source===l||e.target===l),i=r.has(e.source)||r.has(e.target),o=i&&(n||a>0);o&&--a;let s=We[e.refType]??`hsl(var(--muted-foreground))`,c=n||i?`smoothstep`:`default`;return{id:`edge:${e.source}:${e.target}:${t}`,source:e.source,target:e.target,type:c,animated:o,label:n?`${e.refType}${e.weight>1?` ×${e.weight}`:``}`:void 0,markerEnd:{type:ce.ArrowClosed,color:s,width:14,height:14},style:{stroke:s,strokeWidth:i?Math.min(2.5+Math.log2(e.weight+1)*.65,5):n?Math.min(1.25+Math.log2(e.weight+1)*.65,4):1,opacity:i?1:l?n?.88:.08:.52},labelStyle:{fontSize:_e(9),fontFamily:`var(--font-mono)`,fill:`hsl(var(--muted-foreground))`},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.92},labelBgPadding:[4,2],zIndex:i?4:n?2:0,data:{renderKey:`${e.refType}:${e.weight}:${l?n?`focused`:`dimmed`:`idle`}:${i?`live`:`still`}:${o?`anim`:`still`}:${c}`}}}),s=new Map,c=new Set(G.map(ge));for(let e of[...st].sort((e,t)=>e.timestamp-t.timestamp)){let t=ge(e),n=s.get(t);n?n.push(e):s.set(t,[e])}let u=[...s.entries()].map(([e,t])=>({agentKey:e,activities:t,live:c.has(e),latest:t[t.length-1]?.timestamp??0})).sort((e,t)=>Number(t.live)-Number(e.live)||t.latest-e.latest).slice(0,4),d=[];for(let{agentKey:e,activities:t,live:n}of u){let r=t.slice(-7).map(e=>({activity:e,node:Q.nodes.find(t=>ze(e,t))})).filter(e=>!!e.node).filter((e,t,n)=>t===0||e.node.id!==n[t-1]?.node.id),i=Ye(e);for(let t=1;t<r.length;t++){let o=r[t-1],s=r[t],c=n&&a>0;c&&--a,d.push({id:`trail:${e}:${o.activity.timestamp}:${s.activity.timestamp}`,source:o.node.id,target:s.node.id,type:`smoothstep`,animated:c,label:t===r.length-1?`${qe(s.activity.agentName??s.activity.agent??`agent`)} TRAIL`:void 0,markerEnd:{type:ce.ArrowClosed,color:i,width:13,height:13},style:{stroke:i,strokeWidth:2.5,strokeDasharray:`7 5`,opacity:.9},labelStyle:{fontSize:_e(8),fontWeight:700,fill:i},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.94},labelBgPadding:[4,2],zIndex:6,data:{renderKey:`${i}:${t===r.length-1?`label`:`plain`}:${n?`live`:`still`}:${c?`anim`:`still`}`}})}}Ae(d.length),ht(e=>at(e,[...o,...d]))},t=Ot,n=Ne.current!==t;Ne.current=t,z.current!==null&&(window.clearTimeout(z.current),z.current=null),n?e():z.current=window.setTimeout(()=>{z.current=null,e()},120);let r;return Me.current!==Ot&&(r=window.setTimeout(()=>{Me.current=Ot;let e=Q.nodes.length>48?0:240;_t({padding:.2,duration:e,maxZoom:1.25})},20)),()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null),r!==void 0&&window.clearTimeout(r)}},[jt,Q,l,G,st,K,Ot,Ct,_t,$,kt,wt,Tt,Dt,ht,q]),(0,k.useEffect)(()=>{let e=window.setInterval(()=>{Ze()},2e3);return()=>window.clearInterval(e)},[Ze]);let Pt=I.current.get(`packages`)??(e.level===`packages`?r:et),Ft=(0,k.useCallback)(e=>I.current.get(N({level:`files`,package:e})),[de]),It=(0,k.useCallback)(e=>I.current.get(N({level:`symbols`,file:e})),[de]),Lt=(0,k.useCallback)(e=>{let t=e.filePath,n=Re(e.filePath),r=`file:${e.filePath}`;for(let i of I.current.values()){let a=i.nodes.find(t=>t.kind===`file`&&!t.external&&Le(t.file,e.filePath));if(a){t=a.file??t,n=a.package??n,r=a.id;break}}if(e.symbol){Y({level:`symbols`,file:t,package:n},e.symbol.id);return}Y({level:`files`,package:n},r)},[Y]);(0,k.useEffect)(()=>{if(!be||F)return;let e=[...W].filter(e=>!e.filePath.startsWith(`(`)).sort((e,t)=>t.timestamp-e.timestamp)[0];if(!e)return;let t=`${e.id??e.toolUseId}:${e.filePath}:${e.symbol?.id??`file`}`;R.current!==t&&(R.current=t,Lt(e))},[W,be,Lt,F]);let Rt=(0,k.useCallback)(()=>{if(F){Ee(null),Oe(null);return}Ee([...H]),Oe([...U])},[H,F,U]),zt=(0,k.useCallback)(e=>{let t=e.package??e.label,n=!b.has(t);x(e=>{let r=new Set(e);return n?r.add(t):r.delete(t),r}),n&&St({level:`files`,package:t}).then(()=>{let e=I.current.get(N({level:`files`,package:t})),n=e?Pe(e.nodes):void 0;n?.directories.length===1&&n.directories[0]&&S(e=>new Set(e).add(`${t}:${n.directories[0].path}`))}).catch(()=>void 0)},[St,b]),Bt=(0,k.useCallback)(e=>{if(!e.file)return;let t=!C.has(e.file);w(n=>{let r=new Set(n);return t?r.add(e.file):r.delete(e.file),r}),t&&St({level:`symbols`,file:e.file,package:e.package}).catch(()=>void 0)},[St,C]),Vt=(0,k.useCallback)(e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Ht=(0,k.useCallback)(e=>{E(t=>new Set(t).add(e))},[]),Ut=(0,k.useCallback)(e=>{Y({level:`files`,package:e.package??`(root)`},e.id)},[Y]),Wt=(0,k.useCallback)(e=>{e.file&&Y({level:`symbols`,file:e.file,package:e.package},e.id)},[Y]),Gt=(0,k.useMemo)(()=>{let e=v.trim().toLocaleLowerCase();if(!e)return[];let t=new Map;for(let n of I.current.values())for(let r of n.nodes)`${r.label} ${r.file??``} ${r.signature??``} ${r.package??``}`.toLocaleLowerCase().includes(e)&&t.set(r.id,r);return[...t.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.label.localeCompare(t.label)).slice(0,80)},[v,de]),Kt=Gt.length>40,qt=ne({count:Gt.length,getScrollElement:()=>xt.current,estimateSize:()=>40,overscan:8,enabled:Kt}),Jt=(0,k.useCallback)(e=>{e.kind===`package`?Y({level:`packages`},e.id):e.kind===`file`?Y({level:`files`,package:e.package??`(root)`},e.id):e.file&&Y({level:`symbols`,file:e.file,package:e.package},e.id)},[Y]),{incoming:Yt,outgoing:Xt}=(0,k.useMemo)(()=>({incoming:Z?Se(X,Z.id,`incoming`):[],outgoing:Z?Se(X,Z.id,`outgoing`):[]}),[X,Z]),{edgeWeight:Zt,connectedNodeCount:Qt}=(0,k.useMemo)(()=>{let e=0,t=new Set;for(let n of X.edges)e+=n.weight,t.add(n.source),t.add(n.target);return{edgeWeight:e,connectedNodeCount:t.size}},[X]),$t=Z?W.filter(e=>ze(e,Z)):[],en=pe?Xe(pe):[];return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,A.jsx)(ot,{scope:e,graph:r,agentPresences:ut,edgeWeight:Zt,connectedNodeCount:Qt,navigate:Y}),(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,A.jsx)(vt,{rootGraph:Pt,search:v,searchInput:_,searchResults:Gt,virtualizeSearch:Kt,searchVirtualizer:qt,treeScrollRef:xt,selectedId:l,expandedPackages:b,expandedDirectories:re,expandedFiles:C,loadingBranches:D,activeFileNorms:Mt,activeSymbolIds:Nt,revealAllKeys:ae,packageGraph:Ft,graphForFile:It,navigate:Y,togglePackage:zt,toggleDirectory:Vt,toggleFile:Bt,revealAllTree:Ht,selectFileFromTree:Ut,selectSymbolFromTree:Wt,selectSearchResult:Jt,handleOpenNode:$,onSearchInputChange:ee,onSearchChange:y}),(0,A.jsxs)(`main`,{className:`relative min-w-0 flex-1 bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/0.055),transparent_38%)]`,children:[(0,A.jsx)(rt,{layout:d,canvasMode:p,edgeFilter:h,canvasNodeCount:Q.nodes.length,graphNodeCount:r.nodes.length,onLayoutChange:f,onCanvasModeChange:m,onEdgeFilterChange:g}),(0,A.jsx)(ct,{presences:ut,onLocate:Lt}),(0,A.jsx)(lt,{paused:F!==null,followLive:be,agentFilter:P,agents:$e,onTogglePaused:Rt,onToggleFollow:()=>{R.current=null,j(e=>!e)},onAgentFilter:e=>{R.current=null,we(e)}}),(0,A.jsx)(nt,{loading:a,error:s,graph:r,canvasNodeCount:Q.nodes.length,flowNodes:dt,flowEdges:mt,onNodesChange:ft,onEdgesChange:gt,onNodeClick:At,agentTrailCount:ke})]}),(0,A.jsx)(pt,{selectedNode:Z,incoming:Yt,outgoing:Xt,filteredGraph:X,expandedRelations:ie,activeOperations:W,recentActivities:tt,activityTotalCount:Ke,selectedActivities:$t,onClearSelection:()=>u(null),onOpenNode:$,onOpenActivity:O,onLocateActivity:Lt,onToggleRelation:e=>T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelectNode:kt})]}),pe&&(0,A.jsx)(ye,{historyFile:pe,fileHistory:en,onClose:()=>O(null)})]})}function bt(){return(0,A.jsx)(ae,{children:(0,A.jsx)(yt,{})})}export{bt as CodeMap};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{$n as r,$r as i,Dn as a,Fi as o,Ga as s,Hi as c,Hn as l,Jn as u,Mr as d,Mt as f,Na as p,Wa as m,Wr as h,bi as g,ci as _,cr as ee,gi as v,go as te,ho as y,ja as b,n as ne,nn as x,so as re,sr as S,ur as C,xo as w,yn as ie}from"./vendor-V3ydTHqN.js";import"./i18n-Dv97urcO.js";import{a as T,c as ae,d as oe,f as se,h as E,m as ce,n as D,o as le,p as ue,r as de,t as fe,u as pe}from"./xyflow-BqDBClm9.js";import{t as O}from"./utils-CKsqCaP8.js";import{i as me,r as he,t as ge}from"./codemap-activity-store-Ha7XbGgq.js";import{S as _e}from"./fonts-DRGbd-AM.js";import{R as ve}from"./index-DX6tHUzs.js";var k=e(t(),1),A=n();function ye({historyFile:e,fileHistory:t,onClose:n}){let{t:r}=w();return(0,A.jsxs)(`div`,{className:`absolute right-0 top-0 z-50 flex h-full w-[390px] max-w-[90%] flex-col border-l bg-card shadow-2xl`,children:[(0,A.jsxs)(`div`,{className:`flex h-12 items-center justify-between border-b px-4`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(y,{className:`h-4 w-4 shrink-0 text-warning`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-[11px] font-semibold`,title:e,children:e})]}),(0,A.jsx)(`button`,{type:`button`,onClick:n,className:`flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,"aria-label":r(`activity:codeMap.closeActivity`),children:(0,A.jsx)(f,{className:`h-3.5 w-3.5`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:t.length===0?(0,A.jsx)(`p`,{className:`py-12 text-center text-[10px] text-muted-foreground`,children:r(`activity:codeMap.noActivityRecordedForThisFile`)}):t.map((e,t)=>(0,A.jsxs)(`div`,{className:`mb-1 flex items-start gap-2 border p-2 text-[10px]`,children:[(0,A.jsx)(`span`,{className:O(`border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/40 text-destructive`:e.type===`read`?`border-info/40 text-info`:`border-warning/40 text-warning`),children:e.type}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(e.timestamp).toLocaleTimeString()}),e.toolName&&(0,A.jsxs)(`div`,{className:`mt-1`,children:[`via `,e.toolName]}),e.agent&&(0,A.jsx)(`div`,{className:`text-muted-foreground`,children:e.agent}),e.summary&&(0,A.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:e.summary}),e.change&&(0,A.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,A.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,A.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.change.before&&(0,A.jsx)(`span`,{className:`ml-1 truncate text-destructive/80`,title:e.change.before,children:e.change.before}),e.change.after&&(0,A.jsxs)(`span`,{className:`truncate text-success/80`,title:e.change.after,children:[`→ `,e.change.after]})]}),(0,A.jsxs)(`div`,{className:`mt-1 flex gap-2 font-mono text-[8px] uppercase text-muted-foreground`,children:[(0,A.jsx)(`span`,{children:e.status??`observed`}),(0,A.jsx)(`span`,{children:e.source??`legacy`}),e.durationMs!==void 0&&(0,A.jsxs)(`span`,{children:[e.durationMs,`ms`]}),e.watcherConfirmed&&(0,A.jsx)(`span`,{className:`text-success`,children:r(`activity:codeMap.fsVerified`)})]})]})]},`${e.timestamp}-${t}`))}),(0,A.jsxs)(`div`,{className:`border-t px-4 py-2 font-mono text-[9px] text-muted-foreground`,children:[t.length,` events · newest first`]})]})}var be=4096,j=new Map;function M(e){let t=j.get(e);if(t!==void 0)return t;let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).toLocaleLowerCase();for(;j.size>=be;){let e=j.keys().next().value;if(e===void 0)break;j.delete(e)}return j.set(e,n),n}function N(e){return e.level===`packages`?`packages`:e.level===`files`?`files:${e.package}`:`symbols:${e.file}`}function xe(e){return e.level===`packages`?`/api/codemap/packages`:e.level===`files`?`/api/codemap/files?package=${encodeURIComponent(e.package)}`:`/api/codemap/symbols?file=${encodeURIComponent(e.file)}`}function Se(e,t,n){let r=new Map(e.nodes.map(e=>[e.id,e])),i=[];for(let a of e.edges){let e=n===`incoming`?a.target===t?a.source:void 0:a.source===t?a.target:void 0;if(!e)continue;let o=r.get(e);o&&i.push({node:o,edge:a})}return i.sort((e,t)=>t.edge.weight-e.edge.weight||e.node.label.localeCompare(t.node.label))}function Ce(e,t){let n=new Set([t]);for(let r of e.edges)r.source===t&&n.add(r.target),r.target===t&&n.add(r.source);return n}function P(e,t){let n=new Map(e.nodes.map(e=>[e.id,0]));for(let r of e.edges)t.has(r.source)&&t.has(r.target)&&(n.set(r.source,(n.get(r.source)??0)+r.weight),r.target!==r.source&&n.set(r.target,(n.get(r.target)??0)+r.weight));return n}function we(e){let t=new Set(e.nodes.map(e=>e.id)),n=P(e,t),r=new Map(e.nodes.map(e=>[e.id,0])),i=new Map;for(let n of e.edges){if(!t.has(n.source)||!t.has(n.target)||n.source===n.target)continue;r.set(n.target,(r.get(n.target)??0)+1);let e=i.get(n.source)??[];e.push(n.target),i.set(n.source,e)}let a=new Map,o=e.nodes.filter(e=>(r.get(e.id)??0)===0).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0)).map(e=>e.id);o.length===0&&e.nodes[0]&&o.push(e.nodes[0].id);for(let e of o)a.set(e,0);let s=new Set,c=0;for(;c<o.length;){let e=o[c++];if(!s.has(e)){s.add(e);for(let t of i.get(e)??[])a.set(t,Math.max(a.get(t)??0,Math.min((a.get(e)??0)+1,7))),r.set(t,(r.get(t)??1)-1),(r.get(t)??0)<=0&&o.push(t)}}let l=e.nodes.filter(e=>!a.has(e.id)).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0));l.forEach((e,t)=>{a.set(e.id,t%Math.min(4,Math.max(1,l.length)))});let u=new Map;for(let t of e.nodes){let e=a.get(t.id)??0,n=u.get(e)??[];n.push(t),u.set(e,n)}for(let e of u.values())e.sort((e,t)=>Number(e.external)-Number(t.external)||(n.get(t.id)??0)-(n.get(e.id)??0)||e.label.localeCompare(t.label));let d=Math.max(1,...[...u.values()].map(e=>e.length))*208,f=[];for(let[e,t]of[...u.entries()].sort(([e],[t])=>e-t)){let n=(d-t.length*208)/2;t.forEach((t,r)=>{f.push({node:t,position:{x:e*386,y:n+r*208}})})}return f}function F(e,t){if(e.nodes.length===0)return[];let n=P(e,new Set(e.nodes.map(e=>e.id))),r=e.nodes.find(e=>e.id===t)??[...e.nodes].sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0))[0],i=Ce(e,r.id);i.delete(r.id);let a=e.nodes.filter(e=>i.has(e.id)),o=e.nodes.filter(e=>e.id!==r.id&&!i.has(e.id)),s=[{node:r,position:{x:0,y:0}}],c=(e,t,n)=>{e.forEach((r,i)=>{let a=n+Math.PI*2*i/Math.max(1,e.length);s.push({node:r,position:{x:Math.cos(a)*t,y:Math.sin(a)*t}})})};c(a,Math.max(330,a.length*34),-Math.PI/2);for(let e=0;e<o.length;e+=18)c(o.slice(e,e+18),620+Math.floor(e/18)*280,-Math.PI/2+.12);return s}function Te(e,t,n){return t===`orbit`?F(e,n):t===`subsystems`?ke(e):we(e)}function Ee(e){return e.subsystem??e.package??`(ungrouped)`}var De=6,Oe=96;function ke(e){if(e.nodes.length===0)return[];let t=P(e,new Set(e.nodes.map(e=>e.id))),n=e=>e.rank??(t.get(e.id)??0)/1e3,r=new Map;for(let t of e.nodes){let e=Ee(t),n=r.get(e);n===void 0?r.set(e,[t]):n.push(t)}let i=[...r.entries()].map(([e,t])=>({name:e,nodes:[...t].sort((e,t)=>n(t)-n(e)||e.label.localeCompare(t.label)),weight:t.reduce((e,t)=>e+n(t),0)})).sort((e,t)=>e.name===`(ungrouped)`?1:t.name===`(ungrouped)`?-1:t.weight-e.weight||e.name.localeCompare(t.name)),a=[],o=0;for(let e of i){e.nodes.forEach((e,t)=>{a.push({node:e,position:{x:t%De*311,y:o+Math.floor(t/De)*208}})});let t=Math.ceil(e.nodes.length/De);o+=t*208+Oe}return a}function Ae(e,t,n){if(e.length<=n)return e;let r=t?e.filter(e=>e.source===t||e.target===t):[],i=e.filter(e=>!t||e.source!==t&&e.target!==t).sort((e,t)=>t.weight-e.weight||e.source.localeCompare(t.source)||e.target.localeCompare(t.target)),a=Math.max(0,n-r.length);return[...r,...i.slice(0,a)]}function je(e,t,n){if(n===`all`)return e;let r=e.nodes;if(e.nodes.length>96){let n=new Map(e.nodes.map(e=>[e.id,e])),i=new Map;for(let t of e.edges)i.set(t.source,(i.get(t.source)??0)+t.weight),i.set(t.target,(i.get(t.target)??0)+t.weight);let a=e.nodes.some(e=>e.rank!==void 0),o=e=>a?e.rank??0:i.get(e.id)??0,s=[...e.nodes].sort((e,t)=>o(t)-o(e)||e.label.localeCompare(t.label)),c=new Set,l=e=>{n.has(e)&&c.size<96&&c.add(e)};if(t&&n.has(t)){l(t);let n=e.edges.filter(e=>e.source===t||e.target===t).sort((e,t)=>t.weight-e.weight);for(let e of n)l(e.source),l(e.target);let r=new Set(c),i=e.edges.filter(e=>r.has(e.source)||r.has(e.target)).sort((e,t)=>t.weight-e.weight);for(let e of i)l(e.source),l(e.target)}else{let e=s.filter(e=>!e.external).slice(0,72),t=s.filter(e=>e.external).slice(0,24);for(let n of[...e,...t])l(n.id)}for(let e of s)l(e.id);r=e.nodes.filter(e=>c.has(e.id))}let i=new Set(r.map(e=>e.id)),a=e.edges.filter(e=>i.has(e.source)&&i.has(e.target));return{nodes:r,edges:Ae(a,t,180)}}var I=[`/src/main/java/`,`/src/main/kotlin/`,`/src/`,`/lib/`,`/internal/`,`/cmd/`,`/pkg/`,`/app/`];function L(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=e.package??``,r=n.startsWith(`@wrongstack/`)?`/packages/${n.slice(12)}/`:n.startsWith(`app:`)?`/apps/${n.slice(4)}/`:void 0;if(!r)return;let i=t.indexOf(r);return i>=0?t.slice(i+r.length):void 0}function R(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=L(e);if(n!==void 0)return n;let r=-1,i=0;for(let e of I){let n=t.lastIndexOf(e);n>r&&(r=n,i=n+e.length)}return r>=0?t.slice(i):t.split(`/`).slice(-3).join(`/`)}function Me(e){if(e.length===0)return``;let t=e.map(e=>e.split(`/`)),n=t[0]??[],r=0;for(;r<n.length-1;){let e=n[r];if(!t.every(t=>t.length-1>r&&t[r]===e))break;r++}return r===0?``:`${n.slice(0,r).join(`/`)}/`}var Ne=new WeakMap;function Pe(e){let t=Ne.get(e);if(t)return t;let n={name:``,path:``,directories:[],files:[]},r=e.filter(e=>e.kind===`file`&&!e.external),i=r.map(L),a=i.every(e=>e!==void 0),o=a?``:Me(r.map(e=>(e.file??e.label).replace(/\\/g,`/`)));for(let[e,t]of r.entries()){let r=(t.file??t.label).replace(/\\/g,`/`),s=i[e],c=(a?s??R(t):o&&r.startsWith(o)?r.slice(o.length):R(t)).split(`/`).filter(Boolean),l=c.pop()??t.label,u=n;for(let e of c){let t=u.path?`${u.path}/${e}`:e,n=u.directories.find(t=>t.name===e);n||(n={name:e,path:t,directories:[],files:[]},u.directories.push(n)),u=n}u.files.push({...t,label:l})}let s=e=>{e.directories.sort((e,t)=>e.name.localeCompare(t.name)),e.files.sort((e,t)=>e.label.localeCompare(t.label)),e.directories.forEach(s)};return s(n),Ne.set(e,n),n}function Fe(e){let t=2166136261,n=e=>{for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)};for(let t of e.nodes)n(t.id);for(let r of e.edges)n(r.source),n(r.target),n(r.refType),t^=r.weight|0,t=Math.imul(t,16777619);return`${e.nodes.length}:${e.edges.length}:${t>>>0}`}function Ie(e,t,n,r){for(e.has(t)&&e.delete(t),e.set(t,n);e.size>r;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function Le(e,t){if(!e||!t)return!1;let n=M(e),r=M(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function Re(e){let t=M(e),n=t.match(/\/packages\/([^/]+)\//);if(n?.[1])return`@wrongstack/${n[1]}`;let r=t.match(/\/apps\/([^/]+)\//);return r?.[1]?`app:${r[1]}`:`(root)`}function ze(e,t){return t.kind===`package`?Re(e.filePath)===(t.package??t.label):Le(e.filePath,t.file)?t.kind!==`symbol`||e.symbol?.id===t.id:!1}function z(e){let t=new Map;for(let n of e){let e=M(n.filePath),r=t.get(e);r?r.push(n):t.set(e,[n])}return t}function Be(e,t){let n=new Map;if(t.length===0||e.length===0)return n;let r=z(t),i=new Map;for(let a of e){let e;if(a.kind===`package`){let n=a.package??a.label,r=i.get(n);r||(r=t.filter(e=>Re(e.filePath)===n),i.set(n,r)),e=r}else if(a.file){let t=M(a.file),n=r.get(t);if(!n){n=[];for(let[e,i]of r)(e.endsWith(`/${t}`)||t.endsWith(`/${e}`))&&n.push(...i)}e=a.kind===`symbol`?n.filter(e=>e.symbol?.id===a.id):n}else e=[];e.length>0&&n.set(a.id,e)}return n}function Ve(e){if(e.length===0)return``;let t=`${e.length}`;for(let n=0;n<e.length;n++){let r=e[n];t+=`|${r.id??``}:${r.toolUseId??``}:${r.filePath}:${r.type}:${r.status??``}:${r.symbol?.id??``}:${r.timestamp}`}return t}function He(e,t){let n=t.filter(t=>t.kind===`symbol`&&!t.external&&Le(t.file,e.filePath));if(n.length===0)return;if(e.line)return[...n].sort((e,t)=>(t.line??0)-(e.line??0)).find(t=>(t.line??0)<=e.line)??n[0];let r=e.summary.toLocaleLowerCase();return n.find(e=>e.label.length>2&&(r.includes(e.label.toLocaleLowerCase())||!!(e.signature&&r.includes(e.signature.toLocaleLowerCase()))))}var B={package:{icon:S,accent:`border-l-primary`,iconStyle:`bg-primary/12 text-primary`},file:{icon:o,accent:`border-l-info`,iconStyle:`bg-info/12 text-info`},symbol:{icon:s,accent:`border-l-success`,iconStyle:`bg-success/12 text-success`}},V=.25;function Ue(e){return e===void 0?`border-l-[3px]`:e>=.6?`border-l-[7px]`:e>=V?`border-l-[5px]`:`border-l-[3px]`}var We={call:`hsl(var(--primary))`,import:`hsl(var(--info))`,type_ref:`hsl(var(--success))`,inherit:`hsl(var(--warning))`,implement:`hsl(var(--destructive))`},Ge={read:`ring-2 ring-info/60 shadow-info/20`,write:`ring-2 ring-warning/70 shadow-warning/30`,edit:`ring-2 ring-warning/80 shadow-warning/40`,delete:`ring-2 ring-destructive/70 shadow-destructive/30`,search:`ring-2 ring-primary/55 shadow-primary/20`,memory:`ring-2 ring-success/60 shadow-success/30`,index:`ring-2 ring-info/50 shadow-info/20`,execute:`ring-2 ring-primary/55 shadow-primary/25`},Ke=[`bg-primary text-primary-foreground`,`bg-info text-info-foreground`,`bg-success text-success-foreground`,`bg-warning text-warning-foreground`,`bg-destructive text-destructive-foreground`];function qe(e){let t=e.trim().split(/[\s:_-]+/).filter(Boolean);return(t.length>1?`${t[0]?.[0]??``}${t[1]?.[0]??``}`:e.slice(0,2)).toLocaleUpperCase()}function Je(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return Ke[Math.abs(t)%Ke.length]??Ke[0]}function Ye(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 82% 58%)`}var Xe=[`/packages/`,`/apps/`,`/crates/`,`/cmd/`,`/internal/`,`/pkg/`,`/src/`];function Ze(e){let t=e.replace(/\\/g,`/`),n=Xe.reduce((e,n)=>Math.max(e,t.lastIndexOf(n)),-1);return n>=0?t.slice(n+1):t.split(`/`).slice(-3).join(`/`)}function H(e){return[e.symbol?.name,e.line?`L${e.line}`:void 0].filter(Boolean).join(` · `)}function Qe({data:e}){let{t}=w(),{graphNode:n,selected:r,dimmed:i,incoming:a,outgoing:o,isActive:s,activityType:u,activeOperations:d}=e,f=B[n.kind],p=f.icon,m=n.kind===`package`||n.kind===`file`&&!!n.file,h=t(n.kind===`package`?`activity:codeMapTree.openFileMap`:`activity:codeMap.openSymbolMap`),g=n.kind===`symbol`?`${n.symbolKind??`symbol`}${n.line?` · L${n.line}`:``}`:n.kind===`file`?R(n):`${n.fileCount??0} files · ${n.symbolCount??0} symbols`;return(0,A.jsxs)(`div`,{className:O(`group relative w-[236px] pointer-events-auto border bg-card text-card-foreground shadow-[0_8px_24px_hsl(var(--shadow-color)/0.08)] transition-[opacity,box-shadow,border-color,background-color]`,f.accent,Ue(n.rank),r&&`border-primary bg-primary/5 shadow-[0_0_0_2px_hsl(var(--primary)/0.18),0_16px_36px_hsl(var(--shadow-color)/0.18)]`,n.external&&`border-dashed bg-muted/75`,i&&`opacity-25 grayscale`,s&&u&&Ge[u]),children:[d.length>0&&(0,A.jsxs)(`div`,{className:`absolute -top-5 left-2 z-20 flex max-w-[210px] items-center gap-1`,children:[d.slice(0,4).map(e=>{let t=e.agentName??e.agent??`External`,n=`${e.sessionId??`none`}:${e.agentId??t}`;return(0,A.jsxs)(`span`,{className:O(`flex h-6 items-center gap-1 border-2 border-background px-1.5 font-mono text-[8px] font-bold shadow-md`,Je(n)),title:`${t} · ${e.type} ${H(e)}`,children:[(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-current`}),qe(t),e.symbol&&(0,A.jsx)(`span`,{className:`max-w-[80px] truncate`,children:e.symbol.name})]},e.id??`${n}:${e.filePath}`)}),d.length>4&&(0,A.jsxs)(`span`,{className:`border bg-card px-1 font-mono text-[8px] shadow`,children:[`+`,d.length-4]})]}),(0,A.jsx)(T,{type:`target`,position:E.Left,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`}),(0,A.jsxs)(`button`,{type:`button`,className:`nodrag nopan block w-full cursor-pointer text-left focus-visible:outline-2 focus-visible:outline-primary`,onClick:t=>{if(t.shiftKey&&n.file){e.onShowHistory(n.file);return}m?e.onOpen(n):e.onSelect(n)},"aria-label":`${n.kind} ${n.label}`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,A.jsx)(`span`,{className:O(`flex h-8 w-8 shrink-0 items-center justify-center border`,f.iconStyle),children:(0,A.jsx)(p,{className:`h-4 w-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[9px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[(0,A.jsx)(`span`,{children:n.kind}),n.external&&(0,A.jsx)(`span`,{className:`border border-border px-1 py-0.5 text-[8px] text-warning`,children:`external`}),n.rank!==void 0&&n.rank>=.6&&(0,A.jsx)(`span`,{className:`border border-primary/40 bg-primary/10 px-1 py-0.5 text-[8px] text-primary`,children:t(`activity:codeMap.hub`)}),n.lang&&(0,A.jsx)(`span`,{className:`ml-auto font-mono normal-case tracking-normal`,children:n.lang})]}),(0,A.jsx)(`div`,{className:`truncate font-mono text-[13px] font-semibold`,title:n.label,children:n.label}),(0,A.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,title:g,children:g}),n.concept&&(0,A.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[9px] leading-snug text-muted-foreground/80`,title:n.concept,children:n.concept})]})]}),n.rank!==void 0&&(0,A.jsx)(`div`,{className:`h-[3px] w-full bg-muted`,title:t(`activity:codeMap.centrality`,{value:Math.round(n.rank*100)}),children:(0,A.jsx)(`div`,{className:`h-full bg-primary/70`,style:{width:`${Math.max(2,Math.round(n.rank*100))}%`}})}),(0,A.jsxs)(`div`,{className:`flex items-center gap-3 border-t bg-muted/30 px-3 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,A.jsxs)(`span`,{title:t(`activity:codeMapVisuals.incomingRelationships`),children:[`← `,a]}),(0,A.jsxs)(`span`,{title:t(`activity:codeMapVisuals.outgoingRelationships`),children:[`→ `,o]}),n.symbolCount!==void 0&&n.kind===`file`&&(0,A.jsxs)(`span`,{className:`ml-auto`,children:[n.symbolCount,` sym`]}),s&&(0,A.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-bold text-warning`,children:[(0,A.jsx)(l,{className:`h-2.5 w-2.5 animate-pulse`}),` LIVE`]})]})]}),(0,A.jsxs)(`div`,{className:`nodrag nopan flex items-center border-t bg-muted/20`,children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex h-8 cursor-pointer items-center gap-1 px-2 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:t=>{t.stopPropagation(),e.onSelect(n)},"aria-label":`${t(`activity:codeMap.relations`)}: ${n.label}`,"aria-pressed":r,children:[(0,A.jsx)(C,{className:`h-3.5 w-3.5`}),` `,t(`activity:codeMap.relations`)]}),m&&(0,A.jsxs)(`button`,{type:`button`,className:`ml-auto flex h-8 min-w-0 cursor-pointer items-center gap-1 px-2 text-[10px] text-primary hover:bg-primary/10`,onClick:t=>{t.stopPropagation(),e.onOpen(n)},title:h,"aria-label":`Open ${n.label} map`,children:[(0,A.jsx)(c,{className:`h-3.5 w-3.5 shrink-0`}),` `,(0,A.jsx)(`span`,{className:`truncate`,children:h})]}),n.file&&(0,A.jsx)(`button`,{type:`button`,className:`flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:t=>{t.stopPropagation(),e.onShowHistory(n.file)},"aria-label":`${t(`activity:codeMap.activity`)}: ${n.label}`,title:t(`activity:codeMap.activity`),children:(0,A.jsx)(y,{className:`h-3.5 w-3.5`})})]}),(0,A.jsx)(T,{type:`source`,position:E.Right,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`})]})}function U(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function $e(e,t){return e.graphNode===t.graphNode&&e.selected===t.selected&&e.dimmed===t.dimmed&&e.incoming===t.incoming&&e.outgoing===t.outgoing&&e.isActive===t.isActive&&e.activityType===t.activityType&&e.onSelect===t.onSelect&&e.onOpen===t.onOpen&&e.onShowHistory===t.onShowHistory&&U(e.activeOperations,t.activeOperations)}var W={codemap:(0,k.memo)(Qe,(e,t)=>$e(e.data,t.data))},et={nodes:[],edges:[]};function tt(e){return/Authentication required|Unauthorized/i.test(e)}function nt({loading:e,error:t,graph:n,canvasNodeCount:r,flowNodes:i,flowEdges:a,onNodesChange:o,onEdgesChange:s,onNodeClick:c,agentTrailCount:l}){let{t:u}=w();return(0,A.jsxs)(A.Fragment,{children:[e&&(0,A.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-background/75 backdrop-blur-sm`,children:[(0,A.jsx)(d,{className:`h-7 w-7 animate-spin text-primary`}),(0,A.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-widest text-muted-foreground`,children:u(`activity:codeMap.mappingRelationships`)})]}),t&&!e&&(0,A.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,A.jsx)(C,{className:`h-10 w-10 text-destructive`}),(0,A.jsx)(`p`,{className:`font-mono text-sm text-destructive`,children:t}),!tt(t)&&(0,A.jsxs)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:[`The map needs a codebase index. Run`,` `,(0,A.jsx)(`code`,{className:`border bg-muted px-1.5 py-0.5`,children:`codebase-index`}),` `,u(`activity:codeMap.onceThenReopenThisView`)]})]}),!e&&!t&&n.nodes.length===0&&(0,A.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-muted-foreground`,children:[(0,A.jsx)(C,{className:`h-8 w-8 opacity-40`}),(0,A.jsx)(`p`,{className:`text-xs`,children:u(`activity:codeMap.noIndexedNodesAtThisLevel`)})]}),!e&&!t&&n.nodes.length>1&&n.edges.length===0&&(0,A.jsxs)(`div`,{className:`pointer-events-none absolute left-1/2 top-14 z-10 -translate-x-1/2 border border-warning/40 bg-warning/10 px-3 py-2 text-center shadow backdrop-blur`,children:[(0,A.jsx)(`div`,{className:`font-mono text-[9px] font-bold uppercase tracking-wider text-warning`,children:u(`activity:codeMap.noResolvedRelationsInThisScope`)}),(0,A.jsx)(`div`,{className:`mt-0.5 text-[8px] text-muted-foreground`,children:u(`activity:codeMap.theUpgradedIndexWillRebuildAnd`)})]}),!t&&n.nodes.length>0&&(0,A.jsxs)(pe,{nodes:i,edges:a,onNodesChange:o,onEdgesChange:s,onNodeClick:c,nodeTypes:W,nodesConnectable:!1,nodesDraggable:!1,edgesFocusable:!1,elementsSelectable:!1,onlyRenderVisibleElements:!0,minZoom:.08,maxZoom:2.2,proOptions:{hideAttribution:!0},children:[(0,A.jsx)(fe,{variant:D.Dots,gap:r>60?32:22,size:1,color:`hsl(var(--muted-foreground))`,className:`!opacity-25`}),(0,A.jsx)(de,{position:`bottom-left`,showInteractive:!1,className:`!border !border-border !bg-card !shadow-md [&>button]:!border-border [&>button]:!bg-card [&>button]:!fill-foreground`}),r<=48&&(0,A.jsx)(le,{position:`bottom-right`,pannable:!0,zoomable:!0,className:`!h-[112px] !w-[180px] !border !border-border !bg-card !shadow-md`,maskColor:`hsl(var(--background) / 0.72)`,nodeColor:e=>{let t=e.data?.graphNode.kind;return t===`package`?`hsl(var(--primary))`:t===`file`?`hsl(var(--info))`:`hsl(var(--success))`}})]}),(0,A.jsxs)(`div`,{className:`pointer-events-none absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-3 border bg-card/90 px-3 py-1.5 font-mono text-[8px] text-muted-foreground shadow backdrop-blur`,children:[Object.entries(We).map(([e,t])=>(0,A.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(`span`,{className:`h-0.5 w-3`,style:{backgroundColor:t}}),e.replace(`_`,` `)]},e)),(0,A.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,"data-testid":`agent-trail-count`,children:[(0,A.jsx)(`span`,{className:`w-4 border-t-2 border-dashed border-primary`}),`agent trail`,l>0?` ×${l}`:``]})]})]})}function rt({layout:e,canvasMode:t,edgeFilter:n,canvasNodeCount:r,graphNodeCount:i,onLayoutChange:a,onCanvasModeChange:o,onEdgeFilterChange:s}){let{t:c}=w();return(0,A.jsxs)(`div`,{className:`pointer-events-none absolute left-3 right-3 top-3 z-10 flex items-center gap-2`,children:[(0,A.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`layers`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`layers`),children:[(0,A.jsx)(h,{className:`h-3 w-3`}),` `,c(`activity:codeMap.layers`)]}),(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`orbit`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`orbit`),children:[(0,A.jsx)(ee,{className:`h-3 w-3`}),` `,c(`activity:codeMap.relations`)]}),(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-8 items-center gap-1.5 px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`subsystems`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`subsystems`),title:c(`activity:codeMap.groupNodesByTheSubsystemTheyBelongTo`),children:[(0,A.jsx)(m,{className:`h-3 w-3`}),` `,c(`activity:codeMap.subsystems`)]})]}),(0,A.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,A.jsxs)(`button`,{type:`button`,className:O(`h-8 border-r px-2.5 font-mono text-[9px] font-bold`,t===`smart`?`bg-success text-success-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`smart`),title:c(`activity:codeMap.keepTheFullTreeShowTheStrongestRelationsAndSelectedNeighbourhood`),children:[`SMART `,r,`/`,i]}),(0,A.jsx)(`button`,{type:`button`,className:O(`h-8 px-2.5 font-mono text-[9px] font-bold`,t===`all`?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`all`),title:c(`activity:codeMap.renderEveryNodeAndRelationInThisScope`),children:c(`activity:codeMap.all`)})]}),(0,A.jsx)(`div`,{className:`pointer-events-auto ml-auto flex max-w-[60%] overflow-x-auto border bg-card/95 shadow-md backdrop-blur`,children:[`all`,`import`,`call`,`type_ref`,`inherit`,`implement`].map(e=>(0,A.jsx)(`button`,{type:`button`,className:O(`h-8 whitespace-nowrap border-r px-2.5 font-mono text-[9px] last:border-r-0`,n===e?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>s(e),children:e===`all`?`ALL LINKS`:e.replace(`_`,` `).toUpperCase()},e))})]})}function it(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a?a.type===t.type&&a.position.x===t.position.x&&a.position.y===t.position.y&&$e(a.data,t.data)?(e[i]!==a&&(r=!0),a):(r=!0,{...a,...t,measured:a.measured}):(r=!0,t)});return r?i:e}function G(e){return e.data?.renderKey}function at(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a&&G(a)===G(t)?(e[i]!==a&&(r=!0),a):(r=!0,t)});return r?i:e}function ot({scope:e,graph:t,agentPresences:n,edgeWeight:r,connectedNodeCount:a,navigate:o}){let{t:s}=w();return(0,A.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2 border-b bg-card px-4 py-3`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-[220px] items-center gap-3`,children:[(0,A.jsx)(`span`,{className:`flex h-9 w-9 items-center justify-center border border-primary bg-primary/10 text-primary`,children:(0,A.jsx)(C,{className:`h-4 w-4`})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h1`,{className:`font-display text-sm font-semibold tracking-tight`,children:s(`activity:codeMap.codeAtlas`)}),(0,A.jsx)(`p`,{className:`text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:s(`activity:codeMap.architectureIntelligence`)})]})]}),(0,A.jsxs)(`nav`,{className:`order-last flex w-full min-w-0 items-center gap-1 overflow-x-auto border-t pt-2 font-mono text-[11px] [&>button]:shrink-0 [&>svg]:shrink-0`,"aria-label":s(`activity:codeMap.codeMapBreadcrumb`),children:[e.level!==`packages`&&(0,A.jsx)(`button`,{type:`button`,className:`mr-1 flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,onClick:()=>{e.level===`symbols`?o({level:`files`,package:e.package??`(root)`},`file:${e.file}`):o({level:`packages`})},"aria-label":s(`activity:codeMap.back`),children:(0,A.jsx)(re,{className:`h-3.5 w-3.5`})}),(0,A.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 px-1.5 py-1 text-muted-foreground hover:text-foreground`,onClick:()=>o({level:`packages`}),"aria-current":e.level===`packages`?`page`:void 0,children:[(0,A.jsx)(i,{className:`h-3 w-3`}),` workspace`]}),e.level!==`packages`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(b,{className:`h-3 w-3 text-muted-foreground`}),(0,A.jsx)(`button`,{type:`button`,className:`whitespace-nowrap px-1.5 py-1 hover:text-primary`,"aria-current":e.level===`files`?`page`:void 0,onClick:()=>o({level:`files`,package:e.package??`(root)`}),children:e.package??`(root)`})]}),e.level===`symbols`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(b,{className:`h-3 w-3 text-muted-foreground`}),(0,A.jsx)(`span`,{className:`whitespace-nowrap px-1.5 py-1 text-primary`,"aria-current":`page`,title:e.file,children:R({id:``,label:e.file,kind:`file`,file:e.file,package:e.package})})]})]}),(0,A.jsxs)(`div`,{className:`ml-auto hidden items-center gap-5 xl:flex`,children:[(0,A.jsxs)(`div`,{className:O(`flex h-8 items-center gap-2 border px-2.5`,n.length>0?`border-success/50 bg-success/10 text-success`:`text-muted-foreground`),children:[(0,A.jsx)(l,{className:O(`h-3 w-3`,n.length>0&&`animate-pulse`)}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`font-mono text-[10px] font-bold`,children:[n.length,` LIVE`]}),(0,A.jsx)(`div`,{className:`text-[7px] uppercase tracking-wider`,children:`agents`})]})]}),(0,A.jsxs)(`div`,{className:`text-right`,children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.nodes.length}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`nodes`})]}),(0,A.jsxs)(`div`,{className:`text-right`,children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.edges.length}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`links`})]}),(0,A.jsxs)(`div`,{className:`text-right`,children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:r}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`references`})]}),(0,A.jsxs)(`div`,{className:`text-right`,children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:a}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`connected`})]})]})]})}function st({activity:e}){return(0,A.jsx)(`span`,{className:O(`shrink-0 border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/50 bg-destructive/10 text-destructive`:e.type===`read`?`border-info/50 bg-info/10 text-info`:e.type===`search`||e.type===`index`?`border-primary/50 bg-primary/10 text-primary`:`border-warning/50 bg-warning/10 text-warning`),children:e.filePath.startsWith(`(tool:`)?e.toolName:e.type})}function K({activity:e,onLocate:t,showAgent:n=!1}){let{t:r}=w(),i=e.agentName??e.agent??`External process`,a=`${e.sessionId??`none`}:${e.agentId??i}`;return(0,A.jsxs)(`button`,{type:`button`,className:`group flex w-full items-start gap-2 border-b px-3 py-2 text-left last:border-b-0 hover:bg-muted/70`,onClick:()=>!e.filePath.startsWith(`(`)&&t(e),title:`Locate ${e.filePath}`,children:[n&&(0,A.jsx)(`span`,{className:O(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center font-mono text-[8px] font-black`,Je(a)),children:qe(i)}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,A.jsx)(st,{activity:e}),n&&(0,A.jsx)(`span`,{className:`truncate text-[9px] font-semibold`,children:i}),e.status===`active`&&(0,A.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[8px] font-bold text-success`,children:[(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-success`}),` `,r(`activity:codeMap.live`)]}),e.watcherConfirmed&&(0,A.jsx)(ie,{className:`ml-auto h-3 w-3 text-success`,"aria-label":r(`activity:codeMap.filesystemConfirmed`)}),e.attribution===`correlated`&&!e.watcherConfirmed&&(0,A.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-warning`,title:r(`activity:codeMap.correlatedFromTheOnlyActiveTool`),children:r(`activity:codeMap.correlated`)}),e.attribution===`external`&&(0,A.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-destructive`,children:`external`})]}),(0,A.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px] font-semibold`,title:e.filePath,children:Ze(e.filePath)}),(e.symbol||e.line)&&(0,A.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 truncate font-mono text-[8px] text-success`,children:[(0,A.jsx)(x,{className:`h-2.5 w-2.5 shrink-0`}),e.symbol?.name??`line ${e.line}`,e.symbol?.kind&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,e.symbol.kind]})]}),e.change&&(0,A.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,A.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,A.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.durationMs!==void 0&&(0,A.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[e.durationMs,`ms`]})]}),e.summary&&e.summary!==e.toolName&&(0,A.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[8px] leading-3 text-muted-foreground`,children:e.summary})]}),!e.filePath.startsWith(`(`)&&(0,A.jsx)(c,{className:`mt-1 h-3 w-3 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100`})]})}function ct({presences:e,onLocate:t}){let{t:n}=w();return e.length===0?null:(0,A.jsxs)(`section`,{className:`pointer-events-auto absolute left-3 top-14 z-20 w-[304px] border bg-card/95 shadow-xl backdrop-blur`,children:[(0,A.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,A.jsx)(l,{className:`h-3.5 w-3.5 animate-pulse text-success`}),(0,A.jsx)(`h2`,{className:`text-[9px] font-black uppercase tracking-[0.18em]`,children:n(`activity:codeMap.liveAgentOperations`)}),(0,A.jsxs)(`span`,{className:`ml-auto bg-success px-1.5 py-0.5 font-mono text-[8px] font-bold text-success-foreground`,children:[e.length,` ONLINE`]})]}),(0,A.jsx)(`div`,{className:`max-h-[330px] overflow-y-auto`,children:e.map(e=>(0,A.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/35 px-3 py-1.5`,children:[(0,A.jsx)(`span`,{className:O(`flex h-6 w-6 items-center justify-center font-mono text-[8px] font-black`,Je(e.key)),children:qe(e.agentName)}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`truncate text-[9px] font-bold`,children:e.agentName}),(0,A.jsxs)(`div`,{className:`truncate font-mono text-[7px] text-muted-foreground`,children:[`session `,e.sessionId.slice(0,12),` · agent `,e.agentId.slice(0,12)]})]}),(0,A.jsxs)(`span`,{className:`font-mono text-[8px] text-success`,children:[e.operations.length,` op`]})]}),e.operations.map(e=>(0,A.jsx)(K,{activity:e,onLocate:t},e.id??`${e.toolUseId}:${e.filePath}`))]},e.key))})]})}function lt({paused:e,followLive:t,agentFilter:n,agents:i,onTogglePaused:a,onToggleFollow:o,onAgentFilter:s}){let{t:c}=w();return(0,A.jsxs)(`div`,{className:`pointer-events-auto absolute right-3 top-14 z-20 flex h-9 items-center border bg-card/95 shadow-lg backdrop-blur`,children:[(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:o,title:c(`activity:codeMap.automaticallyEnterTheFileFunctionUsedByTheNewestVisibleAgent`),children:[(0,A.jsx)(x,{className:`h-3 w-3`}),` `,c(`activity:codeMap.follow`)]}),(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,e?`bg-warning text-warning-foreground`:`text-success hover:bg-success/10`),onClick:a,title:e?`Resume the live telemetry stream`:`Freeze the current telemetry frame`,children:[e?(0,A.jsx)(u,{className:`h-3 w-3`}):(0,A.jsx)(r,{className:`h-3 w-3`}),e?`Resume`:`Live`]}),(0,A.jsxs)(`label`,{className:`flex h-full items-center gap-1.5 px-2 text-[8px] uppercase text-muted-foreground`,children:[c(`activity:codeMap.agent`),(0,A.jsxs)(`select`,{"aria-label":c(`activity:codeMap.filterCodemapByAgentAndSession`),className:`h-6 max-w-[170px] border bg-background px-1.5 font-mono text-[8px] text-foreground outline-none focus:border-primary`,value:n,onChange:e=>s(e.target.value),children:[(0,A.jsx)(`option`,{value:`all`,children:c(`activity:codeMap.allAgents`)}),i.map(e=>(0,A.jsxs)(`option`,{value:e.key,children:[e.agentName,` · `,e.sessionId.slice(0,10)]},e.key))]})]})]})}function ut({activeOperations:e,recentActivities:t,activityTotalCount:n,onLocate:r}){let{t:i}=w();return(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[e.length>0&&(0,A.jsxs)(`section`,{className:`border-b`,children:[(0,A.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b bg-success/5 px-3`,children:[(0,A.jsx)(l,{className:`h-3 w-3 animate-pulse text-success`}),(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.activeNow`)}),(0,A.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:e.length})]}),e.map(e=>(0,A.jsx)(K,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,A.jsxs)(`section`,{children:[(0,A.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,A.jsx)(y,{className:`h-3 w-3 text-muted-foreground`}),(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.eventStream`)}),(0,A.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] text-muted-foreground`,children:[n,` total`]})]}),t.length>0?t.map((e,t)=>(0,A.jsx)(K,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.timestamp}:${t}`)):(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-7 py-16 text-center`,children:[(0,A.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center border bg-muted text-muted-foreground`,children:(0,A.jsx)(_,{className:`h-5 w-5`})}),(0,A.jsx)(`h3`,{className:`text-xs font-semibold`,children:i(`activity:codeMap.selectANodeOrWaitFor`)}),(0,A.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-muted-foreground`,children:i(`activity:codeMap.relationsAppearOnSelectionToolCalls`)})]})]})]})}function dt({node:e,incomingCount:t,outgoingCount:n,onOpenNode:r,onOpenActivity:i}){let{t:a}=w(),o=B[e.kind].icon;return(0,A.jsxs)(`div`,{className:`border-b bg-muted/25 p-3`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:O(`flex h-8 w-8 items-center justify-center border`,B[e.kind].iconStyle),children:(0,A.jsx)(o,{className:`h-4 w-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`text-[8px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[e.external?`external `:``,e.kind]}),(0,A.jsx)(`div`,{className:`truncate font-mono text-xs font-semibold`,title:e.label,children:e.label})]})]}),(0,A.jsx)(`div`,{className:`break-all font-mono text-[9px] leading-relaxed text-muted-foreground`,children:e.file?R(e):e.package}),e.subsystem&&(0,A.jsx)(`div`,{className:`mt-2 inline-flex items-center gap-1 border border-border px-1.5 py-0.5 text-[8px] uppercase tracking-wider text-muted-foreground`,children:e.subsystem}),e.concept&&(0,A.jsx)(`p`,{className:`mt-2 text-[11px] leading-relaxed text-foreground`,children:e.concept}),e.crux&&(0,A.jsxs)(`div`,{className:`mt-1 font-mono text-[9px] text-muted-foreground`,children:[a(`activity:codeMap.crux`),` L`,e.crux.start,`–L`,e.crux.end]}),e.signature&&(0,A.jsx)(`pre`,{className:`mt-3 overflow-x-auto border bg-background p-2 font-mono text-[9px] leading-relaxed text-foreground`,children:e.signature}),(0,A.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 border`,children:[(0,A.jsx)(q,{value:t,label:a(`activity:codeMap.incoming`),className:`border-r text-info`}),(0,A.jsx)(q,{value:n,label:a(`activity:codeMap.outgoing`),className:`border-r text-primary`}),(0,A.jsx)(q,{value:e.symbolCount??e.fileCount??e.line??`—`,label:e.kind===`package`?`files`:e.kind===`file`?`symbols`:`line`})]}),(0,A.jsx)(`div`,{className:`mt-2 grid grid-cols-1 border`,children:(0,A.jsx)(q,{value:e.rank===void 0?`—`:`${Math.round(e.rank*100)}%`,label:a(`activity:codeMap.centralityLabel`)})}),(0,A.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[e.kind!==`symbol`&&(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 flex-1 items-center justify-center gap-1.5 border bg-foreground text-[9px] font-semibold uppercase tracking-wider text-background hover:opacity-90`,onClick:()=>r(e),children:[(0,A.jsx)(c,{className:`h-3 w-3`}),` Open`,` `,e.kind===`package`?`files`:`symbols`]}),e.file&&(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center justify-center gap-1.5 border px-2 text-[9px] uppercase text-muted-foreground hover:bg-muted`,onClick:()=>i(e.file),children:[(0,A.jsx)(y,{className:`h-3 w-3`}),` `,a(`activity:codeMap.activity`)]})]})]})}function q({value:e,label:t,className:n}){return(0,A.jsxs)(`div`,{className:O(`p-2 text-center`,n),children:[(0,A.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:e}),(0,A.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:t})]})}function ft(e){let{t}=w(),{title:n,subtitle:r,items:i,graph:a,selectedId:o,expanded:s,onToggle:c,onSelect:l}=e;return(0,A.jsxs)(`section`,{className:`border-b py-3`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-end justify-between px-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em]`,children:n}),(0,A.jsx)(`p`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:r})]}),(0,A.jsx)(`span`,{className:`border bg-muted px-1.5 py-0.5 font-mono text-[9px]`,children:i.length})]}),i.length===0?(0,A.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-muted-foreground`,children:t(`activity:codeMap.noRelationshipsInThisView`)}):i.map(e=>{let t=`${n}:${e.node.id}`,r=s.has(t),i=[...Se(a,e.node.id,`incoming`),...Se(a,e.node.id,`outgoing`)].filter((e,t,n)=>e.node.id!==o&&n.findIndex(t=>t.node.id===e.node.id)===t).slice(0,8);return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`group flex min-h-9 items-center gap-1 px-2 hover:bg-muted/70`,children:[(0,A.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>i.length>0&&c(t),"aria-label":`${r?`Collapse`:`Expand`} relation ${e.node.label}`,children:i.length>0?r?(0,A.jsx)(p,{className:`h-3 w-3`}):(0,A.jsx)(b,{className:`h-3 w-3`}):(0,A.jsx)(`span`,{className:`h-px w-2 bg-border`})}),(0,A.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 py-1 text-left`,onClick:()=>l(e.node),children:[(0,A.jsx)(`span`,{className:`block truncate font-mono text-[10px] font-semibold`,title:e.node.label,children:e.node.label}),(0,A.jsx)(`span`,{className:`block truncate text-[9px] text-muted-foreground`,children:e.node.package??e.node.symbolKind??e.node.kind})]}),(0,A.jsx)(`span`,{className:`border px-1 py-0.5 font-mono text-[8px] text-muted-foreground`,children:e.edge.refType}),(0,A.jsxs)(`span`,{className:`w-5 text-right font-mono text-[9px] text-muted-foreground`,children:[`×`,e.edge.weight]})]}),r&&i.map(e=>(0,A.jsxs)(`button`,{type:`button`,className:`relative flex h-7 w-full items-center gap-2 border-l border-border pl-11 pr-3 text-left text-[9px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:()=>l(e.node),children:[(0,A.jsx)(`span`,{className:`absolute left-7 top-1/2 h-px w-3 bg-border`}),(0,A.jsx)(_,{className:`h-3 w-3 shrink-0`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.node.label}),(0,A.jsx)(`span`,{className:`ml-auto font-mono opacity-70`,children:e.edge.refType})]},`${t}:${e.node.id}`))]},t)})]})}function pt({selectedNode:e,incoming:t,outgoing:n,filteredGraph:r,expandedRelations:i,activeOperations:a,recentActivities:o,activityTotalCount:s,selectedActivities:c,onClearSelection:u,onOpenNode:d,onOpenActivity:p,onLocateActivity:m,onToggleRelation:h,onSelectNode:g}){let{t:_}=w();return(0,A.jsxs)(`aside`,{className:`flex w-[326px] shrink-0 flex-col border-l bg-card/80`,children:[(0,A.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b px-3`,children:[(0,A.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:_(`activity:codeMap.relationInspector`)}),e&&(0,A.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground`,onClick:u,"aria-label":_(`activity:codeMap.clearSelection`),children:(0,A.jsx)(f,{className:`h-3.5 w-3.5`})})]}),e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,A.jsx)(dt,{node:e,incomingCount:t.length,outgoingCount:n.length,onOpenNode:d,onOpenActivity:p}),c.length>0&&(0,A.jsxs)(`section`,{className:`border-b bg-success/5 py-2`,children:[(0,A.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-3`,children:[(0,A.jsx)(l,{className:`h-3 w-3 animate-pulse text-success`}),(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:_(`activity:codeMap.agentsOnThisNode`)}),(0,A.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:c.length})]}),c.map(e=>(0,A.jsx)(K,{activity:e,onLocate:m,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,A.jsx)(ft,{title:_(`activity:codeMap.incoming`),subtitle:_(`activity:codeMap.whoDependsOnThis`),items:t,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g}),(0,A.jsx)(ft,{title:_(`activity:codeMap.outgoing`),subtitle:_(`activity:codeMap.whatThisDependsOn`),items:n,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g})]}):(0,A.jsx)(ut,{activeOperations:a,recentActivities:o,activityTotalCount:s,onLocate:m})]})}function mt({node:e,onSelect:t,virtual:n}){let r=B[e.kind].icon;return(0,A.jsxs)(`button`,{type:`button`,"data-index":n?.index,ref:n?e=>n.measureElement(e):void 0,className:O(`min-h-8 items-center gap-2 px-3 py-1 text-left hover:bg-muted`,n?`absolute left-0 flex w-full`:`flex w-full`),style:n?{transform:`translateY(${n.start}px)`}:void 0,onClick:()=>t(e),children:[(0,A.jsx)(r,{className:O(`h-3.5 w-3.5 shrink-0`,e.kind===`package`?`text-primary`:e.kind===`file`?`text-info`:`text-success`)}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`span`,{className:`block truncate font-mono text-[10px]`,children:e.label}),(0,A.jsx)(`span`,{className:`block truncate text-[8px] text-muted-foreground`,children:e.file??e.package??e.symbolKind})]}),(0,A.jsx)(`span`,{className:`text-[8px] uppercase text-muted-foreground`,children:e.kind.slice(0,3)})]},e.id)}var ht=80,gt=40;function _t(e,t){if(!e||t.size===0)return!1;let n=M(e);if(t.has(n))return!0;for(let e of t)if(e.endsWith(`/${n}`)||n.endsWith(`/${e}`))return!0;return!1}var J=(0,k.memo)(function e(t){let{t:n}=w(),{directory:r,packageName:i,depth:a,expandedDirectories:u,expandedFiles:f,loadingBranches:m,graphForFile:h,onToggleDirectory:_,onToggleFile:ee,onSelectFile:te,onOpenFile:y,onSelectSymbol:ne,selectedId:x,activeFileNorms:re,activeSymbolIds:S,revealAllKeys:C,onRevealAll:ie}=t,T=`files:${i}:${r.path||`.`}`,ae=C.has(T)?r.files:r.files.slice(0,ht),oe=r.files.length-ae.length;return(0,A.jsxs)(A.Fragment,{children:[r.directories.map(n=>{let r=`${i}:${n.path}`,o=u.has(r);return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:8+a*12},onClick:()=>_(r),children:[o?(0,A.jsx)(p,{className:`h-3 w-3`}):(0,A.jsx)(b,{className:`h-3 w-3`}),o?(0,A.jsx)(g,{className:`h-3.5 w-3.5 text-warning`}):(0,A.jsx)(v,{className:`h-3.5 w-3.5 text-warning`}),(0,A.jsx)(`span`,{className:`truncate`,children:n.name})]}),o&&(0,A.jsx)(e,{...t,directory:n,depth:a+1})]},r)}),ae.map(e=>{let t=f.has(e.file??e.id),r=N({level:`symbols`,file:e.file??e.label}),i=(e.file?h(e.file):void 0)?.nodes.filter(t=>t.kind===`symbol`&&t.file===e.file&&!t.external)??[],u=`symbols:${e.file??e.id}`,g=C.has(u)?i:i.slice(0,gt),_=i.length-g.length,v=_t(e.file,re);return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:O(`group flex h-7 items-center pr-1 text-[11px] hover:bg-muted`,x===e.id&&`bg-primary/10 text-primary`),style:{paddingLeft:8+a*12},children:[(0,A.jsx)(`button`,{type:`button`,className:`flex h-6 w-4 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>ee(e),"aria-label":`${t?`Collapse`:`Expand`} ${e.label}`,children:m.has(r)?(0,A.jsx)(d,{className:`h-3 w-3 animate-spin`}):t?(0,A.jsx)(p,{className:`h-3 w-3`}):(0,A.jsx)(b,{className:`h-3 w-3`})}),(0,A.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>te(e),onDoubleClick:()=>y(e),children:[(0,A.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-info`}),v&&(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 animate-pulse bg-success`,title:n(`activity:codeMap.liveOperation`)}),(0,A.jsx)(`span`,{className:`truncate font-mono`,title:e.file,children:e.label}),(0,A.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.symbolCount??0})]}),(0,A.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>y(e),title:n(`activity:codeMap.openSymbolMap`),"aria-label":`Open ${e.label} map`,children:(0,A.jsx)(c,{className:`h-3 w-3`})})]}),t&&g.map(e=>(0,A.jsxs)(`button`,{type:`button`,className:O(`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[10px] hover:bg-muted`,x===e.id?`bg-primary/10 text-primary`:`text-muted-foreground`),style:{paddingLeft:38+a*12},onClick:()=>ne(e),children:[(0,A.jsx)(s,{className:`h-3 w-3 shrink-0 text-success`}),S.has(e.id)&&(0,A.jsx)(l,{className:`h-3 w-3 shrink-0 animate-pulse text-success`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.label}),e.line&&(0,A.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] opacity-60`,children:[`:`,e.line]})]},e.id)),t&&_>0&&(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:38+a*12},onClick:()=>ie(u),children:[`Show `,_,` more symbols`]})]},e.id)}),oe>0&&(0,A.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:8+a*12},onClick:()=>ie(T),children:[`Show `,oe,` more files`]})]})});function vt({rootGraph:e,search:t,searchInput:n,searchResults:r,virtualizeSearch:i,searchVirtualizer:o,treeScrollRef:s,selectedId:l,expandedPackages:u,expandedDirectories:m,expandedFiles:h,loadingBranches:g,activeFileNorms:_,activeSymbolIds:ee,revealAllKeys:v,packageGraph:te,graphForFile:y,navigate:ne,togglePackage:x,toggleDirectory:re,toggleFile:C,revealAllTree:ie,selectFileFromTree:T,selectSymbolFromTree:ae,selectSearchResult:oe,handleOpenNode:se,onSearchInputChange:E,onSearchChange:ce}){let{t:D}=w();return(0,A.jsxs)(`aside`,{className:`flex w-[286px] shrink-0 flex-col border-r bg-card/70`,children:[(0,A.jsxs)(`div`,{className:`border-b p-3`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,A.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:D(`activity:codeMapTree.codeTree`)}),(0,A.jsxs)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:[e.nodes.length,` roots`]})]}),(0,A.jsxs)(`label`,{className:`flex h-8 items-center gap-2 border bg-background px-2 focus-within:border-primary`,children:[(0,A.jsx)(a,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,A.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent font-mono text-[10px] outline-none placeholder:text-muted-foreground`,value:n,onChange:e=>E(e.target.value),placeholder:D(`activity:codeMapTree.findPackageFileSymbol`)}),n&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>{E(``),ce(``)},"aria-label":D(`activity:codeMapTree.clearSearch`),children:(0,A.jsx)(f,{className:`h-3 w-3 text-muted-foreground`})})]})]}),(0,A.jsx)(`div`,{ref:s,className:`min-h-0 flex-1 overflow-y-auto py-2`,children:t.trim()?(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`px-3 pb-2 text-[9px] text-muted-foreground`,children:[r.length,` loaded-map results`]}),r.length===0?(0,A.jsxs)(`p`,{className:`px-3 py-8 text-center text-[10px] text-muted-foreground`,children:[D(`activity:codeMapTree.noMatchInLoadedBranches`),(0,A.jsx)(`br`,{}),D(`activity:codeMapTree.expandAPackageToSearchIts`)]}):i?(0,A.jsx)(`div`,{style:{height:`${o.getTotalSize()}px`,width:`100%`,position:`relative`},children:o.getVirtualItems().map(e=>{let t=r[e.index];return t?(0,A.jsx)(mt,{node:t,onSelect:oe,virtual:{index:e.index,start:e.start,measureElement:o.measureElement}},t.id):null})}):r.map(e=>(0,A.jsx)(mt,{node:e,onSelect:oe},e.id))]}):e.nodes.map(e=>{let t=e.package??e.label,n=u.has(t),r=N({level:`files`,package:t}),i=te(t),a=i?Pe(i.nodes):void 0;return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:O(`group flex h-8 items-center px-2 hover:bg-muted`,l===e.id&&`bg-primary/10 text-primary`),children:[(0,A.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 items-center justify-center text-muted-foreground`,onClick:()=>x(e),"aria-label":`${n?`Collapse`:`Expand`} ${t}`,children:g.has(r)?(0,A.jsx)(d,{className:`h-3 w-3 animate-spin`}):n?(0,A.jsx)(p,{className:`h-3 w-3`}):(0,A.jsx)(b,{className:`h-3 w-3`})}),(0,A.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>ne({level:`packages`},e.id),onDoubleClick:()=>ne({level:`files`,package:t}),children:[(0,A.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-[10px] font-semibold`,children:e.label}),(0,A.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.fileCount??0})]}),(0,A.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>ne({level:`files`,package:t}),title:D(`activity:codeMapTree.openFileMap`),"aria-label":`Open ${t} map`,children:(0,A.jsx)(c,{className:`h-3 w-3`})})]}),n&&a&&(0,A.jsx)(J,{directory:a,packageName:t,depth:1,expandedDirectories:m,expandedFiles:h,loadingBranches:g,graphForFile:y,onToggleDirectory:re,onToggleFile:C,onSelectFile:T,onOpenFile:se,onSelectSymbol:ae,selectedId:l,activeFileNorms:_,activeSymbolIds:ee,revealAllKeys:v,onRevealAll:ie})]},e.id)})}),(0,A.jsxs)(`div`,{className:`border-t px-3 py-2 text-[9px] leading-relaxed text-muted-foreground`,children:[D(`activity:codeMapTree.clickToFocusDoubleClickTo`),(0,A.jsx)(`br`,{}),D(`activity:codeMapTree.branchesStayOpenWhileTheMap`)]})]})}function yt(){let[e,t]=(0,k.useState)({level:`packages`}),n=N(e),[r,i]=(0,k.useState)(et),[a,o]=(0,k.useState)(!0),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(null),[d,f]=(0,k.useState)(`layers`),[p,m]=(0,k.useState)(`smart`),[h,g]=(0,k.useState)(`all`),[_,ee]=(0,k.useState)(``),[v,y]=(0,k.useState)(``),[b,x]=(0,k.useState)(new Set),[re,S]=(0,k.useState)(new Set),[C,w]=(0,k.useState)(new Set),[ie,T]=(0,k.useState)(new Set),[ae,E]=(0,k.useState)(new Set),[D,le]=(0,k.useState)(new Set),[de,fe]=(0,k.useState)(0),[pe,O]=(0,k.useState)(null),[be,j]=(0,k.useState)(!1),[P,we]=(0,k.useState)(`all`),[F,Ee]=(0,k.useState)(null),[De,Oe]=(0,k.useState)(null),[ke,Ae]=(0,k.useState)(0),I=(0,k.useRef)(new Map),L=(0,k.useRef)(null),R=(0,k.useRef)(null),Me=(0,k.useRef)(``),Ne=(0,k.useRef)(``),z=(0,k.useRef)(null),B=(0,k.useRef)(new Set),{history:V,pulses:Ue,activeOperationsMap:Ge,activityTotalCount:Ke,resolveActivitySymbol:Je,getActivityForFile:Xe,sweepActivity:Ze}=me(te(e=>({history:e.history,pulses:e.pulses,activeOperationsMap:e.activeOperations,activityTotalCount:e.totalCount,resolveActivitySymbol:e.resolveActivitySymbol,getActivityForFile:e.getActivityForFile,sweepActivity:e._sweep}))),H=(0,k.useMemo)(()=>[...Ge.values()].flat(),[Ge]),Qe=(0,k.useMemo)(()=>[...Ue.keys()].map(e=>V.get(e)?.[0]).filter(e=>!!e),[V,Ue]),U=(0,k.useMemo)(()=>{let e=[];for(let t of V.values())e.push(...t.slice(0,16));return e.sort((e,t)=>t.timestamp-e.timestamp).slice(0,16)},[V]),$e=(0,k.useMemo)(()=>he([...H,...U]),[H,U]),W=(0,k.useMemo)(()=>{let e=F??H;return P===`all`?e:e.filter(e=>ge(e)===P)},[H,P,F]),tt=(0,k.useMemo)(()=>{let e=De??U;return P===`all`?e:e.filter(e=>ge(e)===P)},[P,De,U]),G=(0,k.useDeferredValue)(W),st=(0,k.useDeferredValue)(tt),K=(0,k.useDeferredValue)(Qe),ut=(0,k.useMemo)(()=>he(W),[W]),[dt,q,ft]=se([]),[mt,ht,gt]=oe([]),{fitView:_t}=ue(),J=(0,k.useCallback)(async(e,t=!1)=>{let n=N(e),r=I.current.get(n);if(r&&!t)return Ie(I.current,n,r,48),r;let i=await fetch(xe(e),{credentials:`same-origin`});if(!i.ok){if(i.status===401||i.status===403)throw Error(`Authentication required — open this dashboard from its token URL.`);let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();return Ie(I.current,n,a,48),fe(e=>e+1),a},[]);(0,k.useEffect)(()=>{let e=window.setTimeout(()=>y(_),150);return()=>window.clearTimeout(e)},[_]);let yt=ve(e=>e.generation),bt=(0,k.useRef)(0),xt=(0,k.useRef)(null);(0,k.useEffect)(()=>{let t=!1,n=yt>bt.current;return n&&(bt.current=yt,I.current.clear(),fe(e=>e+1),x(new Set),S(new Set),w(new Set),E(new Set)),o(!0),c(null),J(e,n).then(e=>{if(!t){if(i(e),!n){let t=L.current;L.current=null,u(t&&e.nodes.some(e=>e.id===t)?t:null)}o(!1)}}).catch(e=>{t||(c(e instanceof Error?e.message:String(e)),i(et),o(!1))}),()=>{t=!0}},[n,J,yt,e]);let Y=(0,k.useCallback)((e,r)=>{if(L.current=r??null,N(e)===n){u(r??null),L.current=null;return}t(e)},[n]),St=(0,k.useCallback)(async e=>{let t=N(e);if(!(I.current.has(t)||D.has(t))){le(e=>new Set(e).add(t));try{await J(e)}finally{le(e=>{let n=new Set(e);return n.delete(t),n})}}},[J,D]);(0,k.useEffect)(()=>{let e=!1,t=0;for(let n of H){if(t>=2)break;if(n.symbol||!n.toolUseId||n.filePath.startsWith(`(`))continue;let r=n.filePath;B.current.has(r)||(B.current.add(r),t+=1,J({level:`symbols`,file:r}).then(t=>{if(e)return;let i=He(n,t.nodes);i&&Je(n.toolUseId,r,{id:i.id,name:i.label,...i.symbolKind?{kind:i.symbolKind}:{},...i.line?{line:i.line}:{}})}).catch(()=>void 0).finally(()=>{B.current.delete(r)}))}return()=>{e=!0}},[H,J,Je]);let X=(0,k.useMemo)(()=>({nodes:r.nodes,edges:h===`all`?r.edges:r.edges.filter(e=>e.refType===h)}),[r,h]),Z=r.nodes.find(e=>e.id===l),Q=(0,k.useMemo)(()=>je(X,l,p),[p,X,l]),Ct=(0,k.useMemo)(()=>l?Ce(X,l):new Set,[X,l]),{incomingCounts:wt,outgoingCounts:Tt}=(0,k.useMemo)(()=>{let e=new Map,t=new Map;for(let n of X.edges)t.set(n.source,(t.get(n.source)??0)+1),e.set(n.target,(e.get(n.target)??0)+1);return{incomingCounts:e,outgoingCounts:t}},[X]),Et=d===`orbit`?l??void 0:void 0,Dt=(0,k.useMemo)(()=>Te(Q,d,Et),[Q,d,Et]),Ot=(0,k.useMemo)(()=>[n,d,d===`orbit`?l??``:``,Fe(Q)].join(``),[Q,n,d,l]),kt=(0,k.useCallback)(e=>{u(e.id),T(new Set)},[]),$=(0,k.useCallback)(e=>{e.kind===`package`&&Y({level:`files`,package:e.package??e.label}),e.kind===`file`&&e.file&&Y({level:`symbols`,file:e.file,package:e.package})},[Y]),At=(0,k.useCallback)((e,t)=>{let n=t.data;n?.graphNode&&(n.graphNode.kind===`package`||n.graphNode.kind===`file`&&n.graphNode.file?$(n.graphNode):kt(n.graphNode))},[$,kt]),jt=(0,k.useMemo)(()=>[Ve(G),Ve(K),Ve(st)].join(``),[G,K,st]),Mt=(0,k.useMemo)(()=>{let e=new Set;for(let t of W)e.add(M(t.filePath));return e},[W]),Nt=(0,k.useMemo)(()=>{let e=new Set;for(let t of W)t.symbol?.id&&e.add(t.symbol.id);return e},[W]);(0,k.useEffect)(()=>{let e=()=>{let e=Dt.map(({node:e})=>e),t=Be(e,G),n=Be(e,K),r=new Set(t.keys()),i=Dt.map(({node:e,position:r})=>{let i=t.get(e.id)??[],a=i[0]??n.get(e.id)?.[0];return{id:e.id,type:`codemap`,position:r,style:{pointerEvents:`all`},data:{graphNode:e,selected:e.id===l,dimmed:!!l&&!Ct.has(e.id),incoming:wt.get(e.id)??0,outgoing:Tt.get(e.id)??0,isActive:!!a,...a?{activityType:a.type}:{},activeOperations:i,onSelect:kt,onOpen:$,onShowHistory:O}}});q(e=>it(e,i));let a=6,o=Q.edges.map((e,t)=>{let n=!!l&&(e.source===l||e.target===l),i=r.has(e.source)||r.has(e.target),o=i&&(n||a>0);o&&--a;let s=We[e.refType]??`hsl(var(--muted-foreground))`,c=n||i?`smoothstep`:`default`;return{id:`edge:${e.source}:${e.target}:${t}`,source:e.source,target:e.target,type:c,animated:o,label:n?`${e.refType}${e.weight>1?` ×${e.weight}`:``}`:void 0,markerEnd:{type:ce.ArrowClosed,color:s,width:14,height:14},style:{stroke:s,strokeWidth:i?Math.min(2.5+Math.log2(e.weight+1)*.65,5):n?Math.min(1.25+Math.log2(e.weight+1)*.65,4):1,opacity:i?1:l?n?.88:.08:.52},labelStyle:{fontSize:_e(9),fontFamily:`var(--font-mono)`,fill:`hsl(var(--muted-foreground))`},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.92},labelBgPadding:[4,2],zIndex:i?4:n?2:0,data:{renderKey:`${e.refType}:${e.weight}:${l?n?`focused`:`dimmed`:`idle`}:${i?`live`:`still`}:${o?`anim`:`still`}:${c}`}}}),s=new Map,c=new Set(G.map(ge));for(let e of[...st].sort((e,t)=>e.timestamp-t.timestamp)){let t=ge(e),n=s.get(t);n?n.push(e):s.set(t,[e])}let u=[...s.entries()].map(([e,t])=>({agentKey:e,activities:t,live:c.has(e),latest:t[t.length-1]?.timestamp??0})).sort((e,t)=>Number(t.live)-Number(e.live)||t.latest-e.latest).slice(0,4),d=[];for(let{agentKey:e,activities:t,live:n}of u){let r=t.slice(-7).map(e=>({activity:e,node:Q.nodes.find(t=>ze(e,t))})).filter(e=>!!e.node).filter((e,t,n)=>t===0||e.node.id!==n[t-1]?.node.id),i=Ye(e);for(let t=1;t<r.length;t++){let o=r[t-1],s=r[t],c=n&&a>0;c&&--a,d.push({id:`trail:${e}:${o.activity.timestamp}:${s.activity.timestamp}`,source:o.node.id,target:s.node.id,type:`smoothstep`,animated:c,label:t===r.length-1?`${qe(s.activity.agentName??s.activity.agent??`agent`)} TRAIL`:void 0,markerEnd:{type:ce.ArrowClosed,color:i,width:13,height:13},style:{stroke:i,strokeWidth:2.5,strokeDasharray:`7 5`,opacity:.9},labelStyle:{fontSize:_e(8),fontWeight:700,fill:i},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.94},labelBgPadding:[4,2],zIndex:6,data:{renderKey:`${i}:${t===r.length-1?`label`:`plain`}:${n?`live`:`still`}:${c?`anim`:`still`}`}})}}Ae(d.length),ht(e=>at(e,[...o,...d]))},t=Ot,n=Ne.current!==t;Ne.current=t,z.current!==null&&(window.clearTimeout(z.current),z.current=null),n?e():z.current=window.setTimeout(()=>{z.current=null,e()},120);let r;return Me.current!==Ot&&(r=window.setTimeout(()=>{Me.current=Ot;let e=Q.nodes.length>48?0:240;_t({padding:.2,duration:e,maxZoom:1.25})},20)),()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null),r!==void 0&&window.clearTimeout(r)}},[jt,Q,l,G,st,K,Ot,Ct,_t,$,kt,wt,Tt,Dt,ht,q]),(0,k.useEffect)(()=>{let e=window.setInterval(()=>{Ze()},2e3);return()=>window.clearInterval(e)},[Ze]);let Pt=I.current.get(`packages`)??(e.level===`packages`?r:et),Ft=(0,k.useCallback)(e=>I.current.get(N({level:`files`,package:e})),[de]),It=(0,k.useCallback)(e=>I.current.get(N({level:`symbols`,file:e})),[de]),Lt=(0,k.useCallback)(e=>{let t=e.filePath,n=Re(e.filePath),r=`file:${e.filePath}`;for(let i of I.current.values()){let a=i.nodes.find(t=>t.kind===`file`&&!t.external&&Le(t.file,e.filePath));if(a){t=a.file??t,n=a.package??n,r=a.id;break}}if(e.symbol){Y({level:`symbols`,file:t,package:n},e.symbol.id);return}Y({level:`files`,package:n},r)},[Y]);(0,k.useEffect)(()=>{if(!be||F)return;let e=[...W].filter(e=>!e.filePath.startsWith(`(`)).sort((e,t)=>t.timestamp-e.timestamp)[0];if(!e)return;let t=`${e.id??e.toolUseId}:${e.filePath}:${e.symbol?.id??`file`}`;R.current!==t&&(R.current=t,Lt(e))},[W,be,Lt,F]);let Rt=(0,k.useCallback)(()=>{if(F){Ee(null),Oe(null);return}Ee([...H]),Oe([...U])},[H,F,U]),zt=(0,k.useCallback)(e=>{let t=e.package??e.label,n=!b.has(t);x(e=>{let r=new Set(e);return n?r.add(t):r.delete(t),r}),n&&St({level:`files`,package:t}).then(()=>{let e=I.current.get(N({level:`files`,package:t})),n=e?Pe(e.nodes):void 0;n?.directories.length===1&&n.directories[0]&&S(e=>new Set(e).add(`${t}:${n.directories[0].path}`))}).catch(()=>void 0)},[St,b]),Bt=(0,k.useCallback)(e=>{if(!e.file)return;let t=!C.has(e.file);w(n=>{let r=new Set(n);return t?r.add(e.file):r.delete(e.file),r}),t&&St({level:`symbols`,file:e.file,package:e.package}).catch(()=>void 0)},[St,C]),Vt=(0,k.useCallback)(e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Ht=(0,k.useCallback)(e=>{E(t=>new Set(t).add(e))},[]),Ut=(0,k.useCallback)(e=>{Y({level:`files`,package:e.package??`(root)`},e.id)},[Y]),Wt=(0,k.useCallback)(e=>{e.file&&Y({level:`symbols`,file:e.file,package:e.package},e.id)},[Y]),Gt=(0,k.useMemo)(()=>{let e=v.trim().toLocaleLowerCase();if(!e)return[];let t=new Map;for(let n of I.current.values())for(let r of n.nodes)`${r.label} ${r.file??``} ${r.signature??``} ${r.package??``}`.toLocaleLowerCase().includes(e)&&t.set(r.id,r);return[...t.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.label.localeCompare(t.label)).slice(0,80)},[v,de]),Kt=Gt.length>40,qt=ne({count:Gt.length,getScrollElement:()=>xt.current,estimateSize:()=>40,overscan:8,enabled:Kt}),Jt=(0,k.useCallback)(e=>{e.kind===`package`?Y({level:`packages`},e.id):e.kind===`file`?Y({level:`files`,package:e.package??`(root)`},e.id):e.file&&Y({level:`symbols`,file:e.file,package:e.package},e.id)},[Y]),{incoming:Yt,outgoing:Xt}=(0,k.useMemo)(()=>({incoming:Z?Se(X,Z.id,`incoming`):[],outgoing:Z?Se(X,Z.id,`outgoing`):[]}),[X,Z]),{edgeWeight:Zt,connectedNodeCount:Qt}=(0,k.useMemo)(()=>{let e=0,t=new Set;for(let n of X.edges)e+=n.weight,t.add(n.source),t.add(n.target);return{edgeWeight:e,connectedNodeCount:t.size}},[X]),$t=Z?W.filter(e=>ze(e,Z)):[],en=pe?Xe(pe):[];return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,A.jsx)(ot,{scope:e,graph:r,agentPresences:ut,edgeWeight:Zt,connectedNodeCount:Qt,navigate:Y}),(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,A.jsx)(vt,{rootGraph:Pt,search:v,searchInput:_,searchResults:Gt,virtualizeSearch:Kt,searchVirtualizer:qt,treeScrollRef:xt,selectedId:l,expandedPackages:b,expandedDirectories:re,expandedFiles:C,loadingBranches:D,activeFileNorms:Mt,activeSymbolIds:Nt,revealAllKeys:ae,packageGraph:Ft,graphForFile:It,navigate:Y,togglePackage:zt,toggleDirectory:Vt,toggleFile:Bt,revealAllTree:Ht,selectFileFromTree:Ut,selectSymbolFromTree:Wt,selectSearchResult:Jt,handleOpenNode:$,onSearchInputChange:ee,onSearchChange:y}),(0,A.jsxs)(`main`,{className:`relative min-w-0 flex-1 bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/0.055),transparent_38%)]`,children:[(0,A.jsx)(rt,{layout:d,canvasMode:p,edgeFilter:h,canvasNodeCount:Q.nodes.length,graphNodeCount:r.nodes.length,onLayoutChange:f,onCanvasModeChange:m,onEdgeFilterChange:g}),(0,A.jsx)(ct,{presences:ut,onLocate:Lt}),(0,A.jsx)(lt,{paused:F!==null,followLive:be,agentFilter:P,agents:$e,onTogglePaused:Rt,onToggleFollow:()=>{R.current=null,j(e=>!e)},onAgentFilter:e=>{R.current=null,we(e)}}),(0,A.jsx)(nt,{loading:a,error:s,graph:r,canvasNodeCount:Q.nodes.length,flowNodes:dt,flowEdges:mt,onNodesChange:ft,onEdgesChange:gt,onNodeClick:At,agentTrailCount:ke})]}),(0,A.jsx)(pt,{selectedNode:Z,incoming:Yt,outgoing:Xt,filteredGraph:X,expandedRelations:ie,activeOperations:W,recentActivities:tt,activityTotalCount:Ke,selectedActivities:$t,onClearSelection:()=>u(null),onOpenNode:$,onOpenActivity:O,onLocateActivity:Lt,onToggleRelation:e=>T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelectNode:kt})]}),pe&&(0,A.jsx)(ye,{historyFile:pe,fileHistory:en,onClose:()=>O(null)})]})}function bt(){return(0,A.jsx)(ae,{children:(0,A.jsx)(yt,{})})}export{bt as CodeMap};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Fn as r,Sa as i,ua as a,xa as o,xo as s}from"./vendor-V3ydTHqN.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Fn as r,Sa as i,ua as a,xa as o,xo as s}from"./vendor-V3ydTHqN.js";import"./i18n-Dv97urcO.js";import{S as c}from"./stores-DXn5tdr7.js";import{a as l,n as u,o as d,r as f,t as p}from"./dialog-b-Ai37sa.js";import{M as m,_ as h}from"./index-DX6tHUzs.js";var g=e(t(),1),_=n();function v(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${(e/6e4).toFixed(1)}m`:`${(e/36e5).toFixed(1)}h`}function y(e){if(!e)return`—`;let t=new Date(e),n=Date.now(),r=t.getTime()-n,i=Math.abs(r);if(i<6e4)return r>=0?`<1m`:`<1m ago`;if(i<36e5){let e=Math.round(i/6e4);return r>=0?`${e}m`:`${e}m ago`}if(i<864e5){let e=Math.round(i/36e5);return r>=0?`${e}h`:`${e}h ago`}return t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function b({enabled:e,overdue:t}){let{t:n}=s();return e?t?(0,_.jsxs)(h,{variant:`destructive`,className:`gap-1`,children:[(0,_.jsx)(a,{className:`h-3 w-3`}),n(`activity:cronJobs.statusOverdue`)]}):(0,_.jsxs)(h,{variant:`outline`,className:`gap-1 border-success/30 bg-success/10 text-success`,children:[(0,_.jsx)(o,{className:`h-3 w-3`}),n(`activity:cronJobs.statusActive`)]}):(0,_.jsxs)(h,{variant:`secondary`,className:`gap-1`,children:[(0,_.jsx)(i,{className:`h-3 w-3`}),n(`activity:cronJobs.statusDisabled`)]})}function x({open:e,onClose:t}){let{t:n}=s(),i=c(e=>e.snapshot),o=c(e=>e.lastFiredAt);c(e=>e.revision);let h=i?.jobs??[],x=i?.count??0,S=i?.maxConcurrent??0,C=h.filter(e=>e.overdue).length,w=h.filter(e=>e.enabled).length,T=h.reduce((e,t)=>e+t.runCount,0),E=(0,g.useCallback)(e=>{e||t()},[t]);return(0,_.jsx)(p,{open:e,onOpenChange:E,children:(0,_.jsxs)(u,{className:`max-w-3xl max-h-[80vh] flex flex-col`,children:[(0,_.jsxs)(l,{children:[(0,_.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,_.jsx)(r,{className:`h-5 w-5`}),n(`activity:cronJobs.heading`)]}),(0,_.jsx)(f,{children:n(`activity:cronJobs.subtitle`)})]}),x>0&&(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm text-muted-foreground border-b border-border/70 pb-3`,children:[(0,_.jsx)(`span`,{className:`font-medium text-foreground`,children:n(`activity:cronJobs.jobCount`,{count:x})}),(0,_.jsx)(`span`,{className:`text-success`,children:n(`activity:cronJobs.enabledCount`,{count:w})}),C>0&&(0,_.jsx)(`span`,{className:`text-destructive`,children:n(`activity:cronJobs.overdueCount`,{count:C})}),(0,_.jsx)(`span`,{children:n(`activity:cronJobs.totalRuns`,{count:T})}),(0,_.jsx)(`span`,{className:`text-muted-foreground/60`,children:n(`activity:cronJobs.maxConcurrent`,{count:S})})]}),x===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-12 text-muted-foreground`,children:[(0,_.jsx)(a,{className:`h-8 w-8 opacity-40`}),(0,_.jsx)(`p`,{className:`text-sm`,children:n(`activity:cronJobs.emptyTitle`)}),(0,_.jsxs)(`p`,{className:`text-xs`,children:[n(`activity:cronJobs.emptyUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`cron_schedule`}),` `,n(`activity:cronJobs.emptyToAdd`)]})]}),x>0&&(0,_.jsx)(m,{className:`flex-1 -mx-6 px-6`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-border/50 text-left text-xs text-muted-foreground`,children:[(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thStatus`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thName`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thInterval`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium text-right`,children:n(`activity:cronJobs.thRuns`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thNextRun`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thLastRun`)}),(0,_.jsx)(`th`,{className:`pb-2 font-medium`,children:n(`activity:cronJobs.thAction`)})]})}),(0,_.jsx)(`tbody`,{children:h.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-border/30 last:border-0`,children:[(0,_.jsx)(`td`,{className:`py-2.5 pr-3`,children:(0,_.jsx)(b,{enabled:e.enabled,overdue:e.overdue})}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs font-medium max-w-[160px] truncate`,title:e.name,children:e.name}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.intervalMs)}),(0,_.jsxs)(`td`,{className:`py-2.5 pr-3 text-right font-mono text-xs tabular-nums`,children:[e.runCount,o[e.name]&&(0,_.jsx)(`span`,{className:`ml-1 text-success`,title:n(`activity:cronJobs.lastFiredAtTitle`,{time:o[e.name]}),children:`●`})]}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.nextRun)}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.lastRun)}),(0,_.jsx)(`td`,{className:`py-2.5 font-mono text-xs max-w-[200px] truncate text-muted-foreground`,title:e.action,children:e.action})]},e.name))})]})}),x>0&&(0,_.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-3 border-t border-border/70`,children:[n(`activity:cronJobs.footerUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px]`,children:`cron_schedule`}),` `,n(`activity:cronJobs.footerToAdd`),(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px] ml-1`,children:`cron_cancel`}),` `,n(`activity:cronJobs.footerToRemove`)]})]})})}export{x as CronJobsPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{xo as r}from"./vendor-V3ydTHqN.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{xo as r}from"./vendor-V3ydTHqN.js";import"./i18n-Dv97urcO.js";import{S as i}from"./fonts-DRGbd-AM.js";var a=e(t(),1),o=n(),s={0:`P0 Dead Package`,1:`P1 Dead File`,2:`P2 Dead Symbol`},c={0:`hsl(var(--destructive))`,1:`hsl(var(--warning))`,2:`hsl(var(--info))`};async function l(e){let t=await e.text();try{return JSON.parse(t)}catch{let e=t.length>300?`${t.slice(0,300)}…`:t;throw console.warn(JSON.stringify({level:`warn`,event:`deadcode_parse_error`,preview:e,timestamp:new Date().toISOString()})),Error(`The server returned a non-JSON response (possibly an HTML error page). Check that the backend is running and the /api/deadcode/* routes are wired.`)}}function u(){let{t:e}=r(),[t,n]=(0,a.useState)(`idle`),[u,d]=(0,a.useState)(`idle`),[h,g]=(0,a.useState)(null),[_,v]=(0,a.useState)(null),[y,b]=(0,a.useState)(null),x=(0,a.useCallback)(async()=>{n(`scanning`),b(null),g(null),v(null),d(`idle`);try{let e=await fetch(`/api/deadcode/scan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});if(!e.ok){let t=await l(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await l(e);g(t),n(`done`)}catch(e){b(e instanceof Error?e.message:String(e)),n(`error`)}},[]),S=(0,a.useCallback)(async()=>{if(h){d(`generating`),b(null);try{let e=await fetch(`/api/deadcode/action-plan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(h)});if(!e.ok){let t=await l(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await l(e);v(t),d(`ready`)}catch(e){b(e instanceof Error?e.message:String(e)),d(`idle`)}}},[h]),C=(0,a.useCallback)(()=>{if(!_)return;d(`executing`);let e=[`# Dead-Code Cleanup Plan`,``,_.summary,``,`## Files to address (in priority order)`,..._.files.map((e,t)=>`${t+1}. [${s[e.priority]}] ${e.file} — ${e.symbolCount} symbol(s) to remove`+(e.symbols.length>0?`\n Symbols: ${e.symbols.slice(0,5).join(`, `)}${e.symbols.length>5?` and ${e.symbols.length-5} more`:``}`:``))].join(`
|
|
2
2
|
`),t=window.__WS;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify({type:`user.message`,payload:{text:e,action:`send`}})):(navigator.clipboard.writeText(e),b(`Agent not connected. Plan copied to clipboard — paste it into the chat.`)),d(`idle`)},[_]);return(0,o.jsxs)(`div`,{style:{padding:`16px`,fontFamily:`var(--font-sans, system-ui, sans-serif)`,color:`hsl(var(--foreground))`,background:`hsl(var(--background))`},children:[(0,o.jsx)(`h2`,{style:{margin:`0 0 16px`,fontSize:i(18),fontWeight:600,color:`hsl(var(--foreground))`},children:e(`activity:deadCode.deadCodeScan`)}),(0,o.jsx)(`button`,{type:`button`,onClick:x,disabled:t===`scanning`,style:{padding:`8px 16px`,fontSize:i(14),fontWeight:500,background:t===`scanning`?`hsl(var(--muted))`:`hsl(var(--primary))`,color:t===`scanning`?`hsl(var(--muted-foreground))`:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:t===`scanning`?`not-allowed`:`pointer`},children:t===`scanning`?`Scanning…`:`Scan for Dead Code`}),y&&(0,o.jsxs)(`div`,{style:{marginTop:`12px`,padding:`8px 12px`,background:`hsl(var(--destructive) / 0.1)`,color:`hsl(var(--destructive))`,border:`1px solid hsl(var(--destructive) / 0.3)`,borderRadius:`0`,fontSize:i(13)},children:[y,(0,o.jsx)(`button`,{type:`button`,onClick:()=>b(null),style:{marginLeft:`12px`,background:`none`,border:`none`,cursor:`pointer`,fontWeight:600,color:`hsl(var(--destructive))`},children:`✕`})]}),h&&(0,o.jsxs)(`div`,{style:{marginTop:`16px`},children:[(0,o.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,marginBottom:`12px`},children:[(0,o.jsx)(f,{label:e(`activity:deadCode.totalSymbols`),value:h.stats.totalSymbols,token:`info`}),(0,o.jsx)(f,{label:e(`activity:deadCode.alive`),value:h.stats.alive,token:`success`}),(0,o.jsx)(f,{label:e(`activity:deadCode.dead`),value:h.stats.dead,token:`destructive`})]}),h.deadPackages.length>0&&(0,o.jsx)(p,{title:`Dead Packages (${h.deadPackages.length})`,token:`destructive`,children:h.deadPackages.map(e=>(0,o.jsx)(m,{columns:[e.package,e.path,`${e.fileCount} file(s)`]},e.package))}),h.deadFiles.length>0&&(0,o.jsx)(p,{title:`Dead Files (${h.deadFiles.length})`,token:`warning`,children:h.deadFiles.map(e=>(0,o.jsx)(m,{columns:[e.file,`${e.symbolCount} symbol(s)`,e.lang]},e.file))}),h.deadSymbols.length>0&&(0,o.jsxs)(p,{title:`Dead Symbols (${h.deadSymbols.length})`,token:`info`,children:[h.deadSymbols.slice(0,50).map(e=>(0,o.jsx)(m,{columns:[e.name,e.kind,e.file.split(`/`).pop()??e.file,`line ${e.line}`]},`${e.file}:${e.line}:${e.name}`)),h.deadSymbols.length>50&&(0,o.jsxs)(`div`,{style:{padding:`6px 8px`,color:`hsl(var(--muted-foreground))`,fontSize:i(12)},children:[`… and `,h.deadSymbols.length-50,` more`]})]}),t===`done`&&(0,o.jsx)(`button`,{type:`button`,onClick:S,disabled:u===`generating`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:i(14),fontWeight:500,background:u===`generating`?`hsl(var(--muted))`:`hsl(var(--accent))`,color:u===`generating`?`hsl(var(--muted-foreground))`:`hsl(var(--accent-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:u===`generating`?`not-allowed`:`pointer`},children:u===`generating`?`Generating…`:`Generate Action Plan`})]}),_&&(0,o.jsxs)(`div`,{style:{marginTop:`16px`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,padding:`12px`,background:`hsl(var(--card))`},children:[(0,o.jsx)(`h3`,{style:{margin:`0 0 8px`,fontSize:i(15),fontWeight:600,color:`hsl(var(--card-foreground))`},children:e(`activity:deadCode.actionPlan`)}),(0,o.jsx)(`p`,{style:{fontSize:i(13),color:`hsl(var(--muted-foreground))`,margin:`0 0 12px`},children:_.summary}),_.files.map((e,t)=>(0,o.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`8px`,padding:`6px 0`,borderBottom:t<_.files.length-1?`1px solid hsl(var(--border))`:`none`,fontSize:i(13)},children:[(0,o.jsx)(`span`,{style:{background:c[e.priority]??`hsl(var(--muted-foreground))`,color:`hsl(var(--primary-foreground))`,borderRadius:`0`,padding:`2px 6px`,fontSize:i(11),fontWeight:600,whiteSpace:`nowrap`,flexShrink:0},children:s[e.priority]??`P${e.priority}`}),(0,o.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,o.jsx)(`div`,{style:{fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:`hsl(var(--foreground))`},children:e.file}),(0,o.jsxs)(`div`,{style:{color:`hsl(var(--muted-foreground))`,fontSize:i(12)},children:[e.symbolCount,` symbol(s)`,e.symbols.length>0&&` · ${e.symbols.slice(0,2).join(`, `)}${e.symbols.length>2?`…`:``}`]})]})]},e.file)),(0,o.jsx)(`button`,{type:`button`,onClick:C,disabled:u===`executing`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:i(14),fontWeight:500,background:u===`executing`?`hsl(var(--muted))`:`hsl(var(--success))`,color:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:u===`executing`?`not-allowed`:`pointer`},children:u===`executing`?`Sending…`:`Execute Plan via Agent`})]})]})}var d={success:`hsl(var(--success))`,warning:`hsl(var(--warning))`,info:`hsl(var(--info))`,destructive:`hsl(var(--destructive))`,primary:`hsl(var(--primary))`};function f({label:e,value:t,token:n}){let r=d[n];return(0,o.jsxs)(`div`,{style:{flex:1,padding:`10px`,borderRadius:`0`,border:`1px solid hsl(var(--border))`,background:`hsl(var(--card))`,textAlign:`center`},children:[(0,o.jsx)(`div`,{style:{fontSize:i(24),fontWeight:700,color:r},children:t}),(0,o.jsx)(`div`,{style:{fontSize:i(12),color:`hsl(var(--muted-foreground))`,marginTop:`2px`},children:e})]})}function p({title:e,token:t,children:n}){let r=d[t];return(0,o.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,o.jsx)(`h3`,{style:{margin:`0 0 6px`,fontSize:i(14),fontWeight:600,color:r,borderLeft:`3px solid ${r}`,paddingLeft:`8px`},children:e}),(0,o.jsx)(`div`,{style:{border:`1px solid hsl(var(--border))`,borderRadius:`0`,overflow:`hidden`,fontSize:i(13)},children:n})]})}function m({columns:e}){return(0,o.jsx)(`div`,{style:{display:`flex`,gap:`8px`,padding:`5px 8px`,borderBottom:`1px solid hsl(var(--border))`,fontSize:i(13),fontFamily:`var(--font-mono, monospace)`,background:`hsl(var(--card))`,color:`hsl(var(--card-foreground))`},children:e.map((e,t)=>(0,o.jsx)(`span`,{style:{flex:t===0?2:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e},t))})}export{u as DeadCodeScanPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Da as r,La as i,Mi as a,Tn as o,Vn as s,Xt as c,fi as l,ho as u,ua as d,wo as f,xo as p,zi as m}from"./vendor-V3ydTHqN.js";import"./i18n-CvJB4U4z.js";import{y as h}from"./index-DLjaZSCH.js";var g=e(t(),1),_=n();function v({title:e,value:t,subtitle:n,icon:r,color:i=`text-primary`,trend:a}){let{t:o}=p();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${i}`,children:t}),n&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${i}`,children:(0,_.jsx)(r,{className:`w-5 h-5`})})]}),a&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[a===`up`&&(0,_.jsx)(c,{className:`w-3 h-3 text-success`}),a===`down`&&(0,_.jsx)(c,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(a===`up`?`activity:debug.trendUp`:a===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=p(),[t,n]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,C]=(0,g.useState)(!0),[w,T]=(0,g.useState)(2e3),E=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),r=null,i=e.headers.get(`content-type`)??``;if(e.ok&&i.includes(`application/json`)&&(r=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let a=await t.json();n({fileWatcher:r,system:a,lastUpdated:new Date,error:null})}catch(e){n(t=>({...t,error:e instanceof Error?e.message:f.t(`activity:debug.fetchFailed`)}))}finally{C(!1)}},[]);return(0,g.useEffect)(()=>{E();let e=setInterval(E,w);return()=>clearInterval(e)},[E,w]),(0,_.jsx)(`div`,{ref:h(`debug`),className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(i,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:w,onChange:e=>T(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{C(!0),E()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(s,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),t.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(d,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:t.lastUpdated.toLocaleTimeString()})]}),t.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(r,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:t.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(m,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:t.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:o,color:t.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:t.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:a,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:t.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:u,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:t.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:l,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:t.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:c,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:t.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:s,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(t.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:d,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(t.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:i,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(l,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.webuiServerProcess`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.processRamRss`),value:b(t.system?.memoryUsage?.rss??0),subtitle:t.system?`PID ${t.system.pid}`:void 0,icon:o,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(t.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(t.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:i,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debugDash.v8HeapLimit`),value:b(t.system?.heapLimit??0),subtitle:e(`activity:debugDash.oldSpaceCeiling`),icon:l,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.serverUptime`),value:S(t.system?.uptime??0),subtitle:e(`activity:debugDash.sinceProcessStart`),icon:d,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.liveWrongstackProcesses`)]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[980px] text-left text-xs`,children:[(0,_.jsx)(`thead`,{className:`border-b border-border/70 bg-muted/35 text-muted-foreground`,children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.surface`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.memory`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.growthSignal`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.workload`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.hqOfflineQueue`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.resourcesHotspot`)})]})}),(0,_.jsxs)(`tbody`,{children:[(t.system?.processes??[]).map(e=>{let t=[e.workload.messages===void 0?void 0:`${e.workload.messages} msgs`,e.workload.messageEstimatedTokens===void 0?void 0:`${e.workload.messageEstimatedTokens.toLocaleString()} ctx tokens`,e.workload.historyEntries===void 0?void 0:`${e.workload.historyMountedEntries??0}/${e.workload.historyEntries} history mounted`,e.workload.appRenders===void 0?void 0:`${e.workload.appRenders} renders`,e.workload.metricsDroppedObservations?`${e.workload.metricsDroppedObservations} metric drops`:void 0,e.workload.kanbanSyncActive?`kanban sync active`:void 0,e.workload.kanbanSyncPendingBoards?`${e.workload.kanbanSyncPendingBoards} kanban pending`:void 0,e.workload.kanbanSyncFullRescanPending?`kanban full rescan pending`:void 0,e.workload.kanbanSyncRemoteApplyQueued?`${e.workload.kanbanSyncPendingRemoteBoards??0} remote boards queued`:void 0,e.workload.kanbanSyncCoalescedRefreshes?`${e.workload.kanbanSyncCoalescedRefreshes} kanban coalesced`:void 0,e.workload.kanbanSupervisorSnapshots?`${e.workload.kanbanSupervisorSnapshots} supervised boards`:void 0,e.workload.kanbanSupervisorScheduledBoards?`${e.workload.kanbanSupervisorScheduledBoards} supervisor schedules`:void 0].filter(Boolean).join(` · `);return(0,_.jsxs)(`tr`,{className:`border-b border-border/50 align-top last:border-b-0`,children:[(0,_.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-foreground`,children:e.surface}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`PID `,e.pid]}),(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsxs)(`div`,{children:[`RSS `,b(e.memory.rss)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`heap `,b(e.memory.heapUsed),e.memory.retainedHeapUsed===void 0?``:` · retained ${b(e.memory.retainedHeapUsed)}`]}),e.memory.nativeResidual===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`native `,b(e.memory.nativeResidual)]}),e.memory.external===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`external `,b(e.memory.external),e.memory.arrayBuffers===void 0?``:` · buffers ${b(e.memory.arrayBuffers)}`]})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsx)(`div`,{className:e.signal===`stable`?`text-success`:e.signal?`text-warning`:`text-muted-foreground`,children:e.signal??`sampling`}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`heap `,x(e.heapGrowthBytesPerHour)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`RSS `,x(e.rssGrowthBytesPerHour)]})]}),(0,_.jsx)(`td`,{className:`px-3 py-3 text-muted-foreground`,children:t||`—`}),(0,_.jsx)(`td`,{className:`px-3 py-3 tabular-nums`,children:e.hqQueue?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{children:[e.hqQueue.entries,` frames ·`,` `,b(e.hqQueue.bytes),` /`,` `,b(e.hqQueue.maxBytes)]}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.hqQueue.coalescedFrames,` coalesced ·`,` `,e.hqQueue.droppedFrames,` dropped`]}),e.hqSnapshot?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`snapshot`,` `,e.hqSnapshot.inFlight?`in-flight`:e.hqSnapshot.pending?`pending`:e.hqSnapshot.timerScheduled?`scheduled`:`idle`]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`events`,` `,e.hqSnapshot.eventInFlight?`in-flight`:`idle`,` ·`,` `,e.hqSnapshot.pendingEvents,` pending ·`,` `,e.hqSnapshot.coalescedEvents,` coalesced ·`,` `,e.hqSnapshot.droppedEvents,` dropped`]})]}):null]}):(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,_.jsxs)(`td`,{className:`max-w-[360px] px-3 py-3 text-muted-foreground`,children:[(0,_.jsxs)(`div`,{children:[e.resources.active??0,` active`,e.resources.types?` · ${e.resources.types}`:``]}),e.profileTopStack?(0,_.jsxs)(`div`,{className:`mt-1 truncate`,title:e.profileTopStack,children:[e.profileTopStackBytes===void 0?``:`${b(e.profileTopStackBytes)} · `,e.profileTopStack]}):null]})]},e.pid)}),(t.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:e(`activity:debugDash.waitingForHeapFlightRecorderSamples`)})}):null]})]})})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(o,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.codebaseIndexServer`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.connection`),value:t.system?.codebaseIndexServer?.health?.status??t.system?.codebaseIndexServer?.status??`unknown`,subtitle:t.system?.codebaseIndexServer?.pid?`PID ${t.system.codebaseIndexServer.pid} · RTT ${t.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:u,color:t.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:t.system?.codebaseIndexServer?.status===`unresponsive`||t.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexRamRss`),value:b(t.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(t.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(t.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWorkload`),value:`${t.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${t.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${t.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:l,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWatcher`),value:t.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${t.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${t.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:m,color:t.system?.codebaseIndexServer?.health?.server?.watchingExternal?`text-success`:`text-muted-foreground`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:t.fileWatcher,serverPid:t.system?.pid,serverMemory:t.system?.memoryUsage,serverHeapLimit:t.system?.heapLimit,serverUptime:t.system?.uptime,processes:t.system?.processes,codebaseIndexServer:t.system?.codebaseIndexServer},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e===void 0?`—`:`${e>0?`+`:e<0?`−`:``}${b(Math.abs(e))}/h`}function S(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Da as r,La as i,Mi as a,Tn as o,Vn as s,Xt as c,fi as l,ho as u,ua as d,wo as f,xo as p,zi as m}from"./vendor-V3ydTHqN.js";import"./i18n-Dv97urcO.js";import{y as h}from"./index-DX6tHUzs.js";var g=e(t(),1),_=n();function v({title:e,value:t,subtitle:n,icon:r,color:i=`text-primary`,trend:a}){let{t:o}=p();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${i}`,children:t}),n&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${i}`,children:(0,_.jsx)(r,{className:`w-5 h-5`})})]}),a&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[a===`up`&&(0,_.jsx)(c,{className:`w-3 h-3 text-success`}),a===`down`&&(0,_.jsx)(c,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(a===`up`?`activity:debug.trendUp`:a===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=p(),[t,n]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,C]=(0,g.useState)(!0),[w,T]=(0,g.useState)(2e3),E=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),r=null,i=e.headers.get(`content-type`)??``;if(e.ok&&i.includes(`application/json`)&&(r=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let a=await t.json();n({fileWatcher:r,system:a,lastUpdated:new Date,error:null})}catch(e){n(t=>({...t,error:e instanceof Error?e.message:f.t(`activity:debug.fetchFailed`)}))}finally{C(!1)}},[]);return(0,g.useEffect)(()=>{E();let e=setInterval(E,w);return()=>clearInterval(e)},[E,w]),(0,_.jsx)(`div`,{ref:h(`debug`),className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(i,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:w,onChange:e=>T(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{C(!0),E()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(s,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),t.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(d,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:t.lastUpdated.toLocaleTimeString()})]}),t.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(r,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:t.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(m,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:t.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:o,color:t.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:t.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:a,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:t.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:u,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:t.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:l,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:t.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:c,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:t.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:s,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(t.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:d,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(t.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:i,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(l,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.webuiServerProcess`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.processRamRss`),value:b(t.system?.memoryUsage?.rss??0),subtitle:t.system?`PID ${t.system.pid}`:void 0,icon:o,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(t.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(t.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:i,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debugDash.v8HeapLimit`),value:b(t.system?.heapLimit??0),subtitle:e(`activity:debugDash.oldSpaceCeiling`),icon:l,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.serverUptime`),value:S(t.system?.uptime??0),subtitle:e(`activity:debugDash.sinceProcessStart`),icon:d,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.liveWrongstackProcesses`)]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[980px] text-left text-xs`,children:[(0,_.jsx)(`thead`,{className:`border-b border-border/70 bg-muted/35 text-muted-foreground`,children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.surface`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.memory`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.growthSignal`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.workload`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.hqOfflineQueue`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.resourcesHotspot`)})]})}),(0,_.jsxs)(`tbody`,{children:[(t.system?.processes??[]).map(e=>{let t=[e.workload.messages===void 0?void 0:`${e.workload.messages} msgs`,e.workload.messageEstimatedTokens===void 0?void 0:`${e.workload.messageEstimatedTokens.toLocaleString()} ctx tokens`,e.workload.historyEntries===void 0?void 0:`${e.workload.historyMountedEntries??0}/${e.workload.historyEntries} history mounted`,e.workload.appRenders===void 0?void 0:`${e.workload.appRenders} renders`,e.workload.metricsDroppedObservations?`${e.workload.metricsDroppedObservations} metric drops`:void 0,e.workload.kanbanSyncActive?`kanban sync active`:void 0,e.workload.kanbanSyncPendingBoards?`${e.workload.kanbanSyncPendingBoards} kanban pending`:void 0,e.workload.kanbanSyncFullRescanPending?`kanban full rescan pending`:void 0,e.workload.kanbanSyncRemoteApplyQueued?`${e.workload.kanbanSyncPendingRemoteBoards??0} remote boards queued`:void 0,e.workload.kanbanSyncCoalescedRefreshes?`${e.workload.kanbanSyncCoalescedRefreshes} kanban coalesced`:void 0,e.workload.kanbanSupervisorSnapshots?`${e.workload.kanbanSupervisorSnapshots} supervised boards`:void 0,e.workload.kanbanSupervisorScheduledBoards?`${e.workload.kanbanSupervisorScheduledBoards} supervisor schedules`:void 0].filter(Boolean).join(` · `);return(0,_.jsxs)(`tr`,{className:`border-b border-border/50 align-top last:border-b-0`,children:[(0,_.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-foreground`,children:e.surface}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`PID `,e.pid]}),(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsxs)(`div`,{children:[`RSS `,b(e.memory.rss)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`heap `,b(e.memory.heapUsed),e.memory.retainedHeapUsed===void 0?``:` · retained ${b(e.memory.retainedHeapUsed)}`]}),e.memory.nativeResidual===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`native `,b(e.memory.nativeResidual)]}),e.memory.external===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`external `,b(e.memory.external),e.memory.arrayBuffers===void 0?``:` · buffers ${b(e.memory.arrayBuffers)}`]})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsx)(`div`,{className:e.signal===`stable`?`text-success`:e.signal?`text-warning`:`text-muted-foreground`,children:e.signal??`sampling`}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`heap `,x(e.heapGrowthBytesPerHour)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`RSS `,x(e.rssGrowthBytesPerHour)]})]}),(0,_.jsx)(`td`,{className:`px-3 py-3 text-muted-foreground`,children:t||`—`}),(0,_.jsx)(`td`,{className:`px-3 py-3 tabular-nums`,children:e.hqQueue?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{children:[e.hqQueue.entries,` frames ·`,` `,b(e.hqQueue.bytes),` /`,` `,b(e.hqQueue.maxBytes)]}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.hqQueue.coalescedFrames,` coalesced ·`,` `,e.hqQueue.droppedFrames,` dropped`]}),e.hqSnapshot?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`snapshot`,` `,e.hqSnapshot.inFlight?`in-flight`:e.hqSnapshot.pending?`pending`:e.hqSnapshot.timerScheduled?`scheduled`:`idle`]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`events`,` `,e.hqSnapshot.eventInFlight?`in-flight`:`idle`,` ·`,` `,e.hqSnapshot.pendingEvents,` pending ·`,` `,e.hqSnapshot.coalescedEvents,` coalesced ·`,` `,e.hqSnapshot.droppedEvents,` dropped`]})]}):null]}):(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,_.jsxs)(`td`,{className:`max-w-[360px] px-3 py-3 text-muted-foreground`,children:[(0,_.jsxs)(`div`,{children:[e.resources.active??0,` active`,e.resources.types?` · ${e.resources.types}`:``]}),e.profileTopStack?(0,_.jsxs)(`div`,{className:`mt-1 truncate`,title:e.profileTopStack,children:[e.profileTopStackBytes===void 0?``:`${b(e.profileTopStackBytes)} · `,e.profileTopStack]}):null]})]},e.pid)}),(t.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:e(`activity:debugDash.waitingForHeapFlightRecorderSamples`)})}):null]})]})})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(o,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.codebaseIndexServer`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.connection`),value:t.system?.codebaseIndexServer?.health?.status??t.system?.codebaseIndexServer?.status??`unknown`,subtitle:t.system?.codebaseIndexServer?.pid?`PID ${t.system.codebaseIndexServer.pid} · RTT ${t.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:u,color:t.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:t.system?.codebaseIndexServer?.status===`unresponsive`||t.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexRamRss`),value:b(t.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(t.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(t.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWorkload`),value:`${t.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${t.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${t.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:l,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWatcher`),value:t.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${t.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${t.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:m,color:t.system?.codebaseIndexServer?.health?.server?.watchingExternal?`text-success`:`text-muted-foreground`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:t.fileWatcher,serverPid:t.system?.pid,serverMemory:t.system?.memoryUsage,serverHeapLimit:t.system?.heapLimit,serverUptime:t.system?.uptime,processes:t.system?.processes,codebaseIndexServer:t.system?.codebaseIndexServer},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e===void 0?`—`:`${e>0?`+`:e<0?`−`:``}${b(Math.abs(e))}/h`}function S(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{mt as t}from"./config-store-mWuYCild.js";import{i as n,t as r}from"./react-core-wiHys0m2.js";import{Dn as i,Mt as a,Pa as o,or as s,qi as c,wo as l,xo as u,yn as d}from"./vendor-V3ydTHqN.js";import"./i18n-CvJB4U4z.js";import{t as f}from"./utils-CKsqCaP8.js";import{o as p}from"./view-navigation-DTs4cSQ6.js";import{L as m,y as h}from"./index-DLjaZSCH.js";var g=e(n(),1);function _(e,t,n){return e<t?t:e>n?n:e}function v(e){let t=/^oklch\(\s*([^)]+)\)$/i.exec(e.trim());if(!t?.[1])return null;let n=(t[1].split(`/`)[0]??``).trim().split(/\s+/);if(n.length<3||!n[0]||!n[1]||!n[2])return null;let r=n[0].endsWith(`%`)?Number.parseFloat(n[0])/100:Number.parseFloat(n[0]),i=n[1].endsWith(`%`)?Number.parseFloat(n[1])/100*.4:Number.parseFloat(n[1]),a=Number.parseFloat(n[2].replace(/deg$/i,``));return[r,i,a].every(Number.isFinite)?[_(r,0,1),Math.max(0,i),a]:null}function y(e){return _(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,0,1)}function b(e){return Math.round(e*255).toString(16).padStart(2,`0`)}function x(e){let t=v(e);if(!t)return null;let[n,r,i]=t,a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return`#${b(y(m))}${b(y(h))}${b(y(g))}`}function S(e){let t=e.trim(),n=x(t);if(n)return n.toLowerCase();let r=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t);if(r?.[1])return`#${r[1].toLowerCase()}`;let i=/^#([0-9a-f]{3})$/i.exec(t);return i?.[1]?`#${i[1].split(``).map(e=>e+e).join(``).toLowerCase()}`:null}var C=r(),w=[`web`,`react-native`,`flutter`,`swiftui`,`compose`],T=[`primary`,`accent`,`bg`,`surface`,`fg`,`border`];function E(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))e.startsWith(`light.`)?n===`light`&&(r[e.slice(6)]=i):e.startsWith(`dark.`)?n===`dark`&&(r[e.slice(5)]=i):r[e]=i;return r}function D({t:e,label:t}){let{t:n}=u(),r=e.bg??`#fff`,i=e.surface??r,a=e.fg??`#111`,o=e.muted??a,s=e.primary??`#3b82f6`,c=e.accent??s,l=e.border??o,d=e[`radius-md`]??e.radius??`0.5rem`,f=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,p=e[`font-display`]??e.fontDisplay??f,m=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,C.jsxs)(`div`,{style:{background:r,color:a,fontFamily:f},className:`flex min-w-0 flex-col gap-2 overflow-hidden p-3`,children:[(0,C.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide`,style:{color:o},children:t}),(0,C.jsxs)(`div`,{style:{background:i,border:`1px solid ${l}`,borderRadius:d,boxShadow:m},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,C.jsx)(`div`,{style:{fontFamily:p},className:`text-base font-bold leading-tight`,children:n(`activity:designStudio.aaHeading`)}),(0,C.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:o},children:n(`activity:designStudio.theQuickBrownFoxJumpsOver`)}),(0,C.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,C.jsx)(`span`,{style:{background:s,color:r,borderRadius:d},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:n(`activity:designStudio.primary`)}),(0,C.jsx)(`span`,{style:{border:`1px solid ${l}`,color:a,borderRadius:d},className:`shrink-0 px-2 py-1 text-[10px]`,children:n(`activity:designStudio.ghost`)}),(0,C.jsx)(`span`,{style:{background:c,color:r,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:n(`activity:designStudio.badge`)})]}),(0,C.jsx)(`div`,{style:{border:`1px solid ${l}`,borderRadius:d,color:o},className:`text-[10px] px-2 py-1.5 mt-1`,children:n(`activity:designStudio.inputField`)})]})]})}function O({kit:e,overrides:t,onSet:n}){let[r,i]=(0,g.useState)(`light`),{t:a}=u(),o=E(r===`light`?e.light:e.dark,t,r);return(0,C.jsxs)(`div`,{className:`mt-1 rounded-lg border border-border/60 p-2 bg-muted/30`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,C.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:a(`activity:design.colors`)}),(0,C.jsx)(`div`,{className:`ml-auto inline-flex rounded border border-border/60 overflow-hidden`,children:[`light`,`dark`].map(e=>(0,C.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:f(`text-[10px] px-1.5 py-0.5`,r===e?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e},e))})]}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:T.filter(e=>o[e]).map(e=>{let t=S(o[e]??``)??`#000000`;return(0,C.jsxs)(`label`,{className:`flex min-w-[2rem] flex-col items-center gap-0.5`,title:`${e}: ${o[e]}`,children:[(0,C.jsx)(`input`,{type:`color`,value:t,onChange:t=>n(`${r}.${e}`,t.target.value),className:`w-6 h-6 rounded cursor-pointer bg-transparent border border-border/60 p-0`}),(0,C.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e})]},e)})})]})}function k({onTune:e}){let{t}=u(),[n,r]=(0,g.useState)(``),i=({label:t,knob:n,values:r})=>(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:t}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(t=>(0,C.jsx)(`button`,{type:`button`,onClick:()=>e({[n]:t}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-primary hover:text-primary-foreground`,children:t},t))})]});return(0,C.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1.5 rounded-lg border border-border/60 bg-muted/30 p-2`,children:[(0,C.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:t(`activity:designStudio.tune`)}),(0,C.jsx)(i,{label:t(`activity:designStudio.radius`),knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,C.jsx)(i,{label:t(`activity:designStudio.density`),knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,C.jsx)(i,{label:t(`activity:designStudio.motion`),knob:`motion`,values:[`snappy`,`smooth`,`none`]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:t(`activity:designStudio.font`)}),(0,C.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),onKeyDown:t=>{t.key===`Enter`&&n.trim()&&e({font:n.trim()})},placeholder:t(`activity:designStudio.spaceGrotesk`),className:`h-6 min-w-0 flex-1 rounded border border-border/60 bg-background/70 px-1.5 text-[10px]`}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>n.trim()&&e({font:n.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:t(`activity:designStudio.set`)})]})]})}function A({className:e}){let{client:n}=m(),r=t(),{t:_}=u(),[v,y]=(0,g.useState)([]),[b,x]=(0,g.useState)(null),[S,T]=(0,g.useState)({}),[A,j]=(0,g.useState)(`web`),[M,N]=(0,g.useState)(``),[P,F]=(0,g.useState)(null);(0,g.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.payload?.sessionId;return typeof t!=`string`||t.length===0?r!==null:t!==r},t=t=>{if(e(t))return;let n=t.payload;y(n?.kits??[]),x(n?.activeKit??null),T(n?.overrides??{})},i=t=>{if(e(t))return;let n=t.payload;n?.ok&&n.kit&&(x(n.kit),T(n.overrides??{}))},a=t=>{if(e(t))return;let n=t.payload;n?.ok&&n.overrides&&T(n.overrides)},o=t=>{if(e(t))return;let n=t.payload;n?.ok&&n.overrides?(T(n.overrides),F(`Tuned`)):n?.error&&F(`Tune failed: ${n.error}`)},s=t=>{if(e(t))return;let n=t.payload;n?.ok&&n.kit&&(x(n.kit),T(n.overrides??{}),F(`Swapped to ${n.kit}`))},c=t=>{if(e(t))return;let n=t.payload;F(n?.ok?l.t(`activity:design.wrote`,{path:n.path}):l.t(`activity:design.materializeFailed`,{error:n?.error??`error`}))},u=t=>{if(e(t))return;let n=t.payload;if(!n?.ok){F(l.t(`activity:design.verifyError`,{error:n?.error??`error`}));return}let r=Math.round((n.score??1)*100);F(n.violationCount?l.t(`activity:design.verifyOffPalette`,{pct:r,count:n.violationCount,files:n.filesScanned}):l.t(`activity:design.verifyClean`,{files:n.filesScanned}))};return n.on(`design.list`,t),n.on(`design.use`,i),n.on(`design.set`,a),n.on(`design.tune`,o),n.on(`design.swap`,s),n.on(`design.materialize`,c),n.on(`design.verify`,u),n.send({type:`design.list`,payload:n.withSession({})}),()=>{n.off(`design.list`,t),n.off(`design.use`,i),n.off(`design.set`,a),n.off(`design.tune`,o),n.off(`design.swap`,s),n.off(`design.materialize`,c),n.off(`design.verify`,u)}},[n,r]);let I=(0,g.useCallback)(e=>n?.send({type:`design.use`,payload:n.withSession({kit:e,stack:A})}),[n,A]),L=(0,g.useCallback)((e,t)=>{T(n=>({...n,[e]:t})),n?.send({type:`design.set`,payload:n.withSession({overrides:{[e]:t}})})},[n]),R=(0,g.useCallback)(e=>n?.send({type:`design.tune`,payload:n.withSession({tune:e})}),[n]),z=(0,g.useCallback)(()=>{F(l.t(`activity:design.writing`)),n?.send({type:`design.materialize`,payload:n.withSession({stack:A})})},[n,A]),B=(0,g.useCallback)(()=>{F(l.t(`activity:design.scanning`)),n?.send({type:`design.verify`,payload:n.withSession({})})},[n]),V=(0,g.useMemo)(()=>{let e=M.trim().toLowerCase();return[...e?v.filter(t=>t.id.includes(e)||t.name.toLowerCase().includes(e)||t.aesthetic.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))):v].sort((e,t)=>e.name.localeCompare(t.name))},[v,M]);return(0,C.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)]`,e),children:[(0,C.jsx)(`div`,{className:`border-b border-border/60 p-3`,children:(0,C.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-3 shadow-sm`,children:(0,C.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center`,children:[(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,C.jsx)(s,{className:`h-4 w-4`})}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:_(`activity:design.heading`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:_(`activity:design.kitsCount`,{count:V.length})})]})]}),(0,C.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center lg:justify-end`,children:[(0,C.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:max-w-xs`,children:[(0,C.jsx)(i,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,C.jsx)(`input`,{value:M,onChange:e=>N(e.target.value),placeholder:_(`activity:design.searchPlaceholder`),className:`h-9 w-full rounded-md border border-border/70 bg-background/70 pl-8 pr-3 text-sm shadow-sm outline-none transition focus:border-primary/40 focus:ring-2 focus:ring-ring/30`})]}),(0,C.jsx)(`select`,{value:A,onChange:e=>j(e.target.value),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm shadow-sm`,title:_(`activity:design.stackTitle`),children:w.map(e=>(0,C.jsx)(`option`,{value:e,children:e},e))}),P&&(0,C.jsx)(`span`,{className:`min-w-0 truncate rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground sm:max-w-56`,children:P}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>p(`chat`),className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,title:_(`common:action.close`),children:(0,C.jsx)(a,{className:`h-4 w-4`})})]})]})})}),(0,C.jsx)(`div`,{ref:h(`design-gallery`),className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain p-3 sm:p-4`,children:V.length===0?(0,C.jsxs)(`div`,{className:`ws-surface mx-auto mt-8 flex max-w-md flex-col items-center gap-3 rounded-xl p-6 text-center text-muted-foreground`,children:[(0,C.jsx)(s,{className:`h-8 w-8 text-primary/60`}),(0,C.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:_(`activity:design.kitsCount`,{count:0})}),(0,C.jsx)(`p`,{className:`text-xs`,children:_(`activity:design.searchPlaceholder`)})]}):(0,C.jsx)(`div`,{className:`grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(min(100%,20rem),1fr))]`,children:V.map(e=>{let t=b===e.id,n=t?S:{};return(0,C.jsxs)(`div`,{className:f(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card/75 shadow-sm`,t?`border-primary/60 ring-1 ring-primary/30`:`border-border/70`),children:[(0,C.jsxs)(`div`,{className:`grid min-h-[12rem] grid-cols-1 sm:grid-cols-2`,children:[(0,C.jsx)(D,{t:E(e.light,n,`light`),label:_(`activity:designStudio.light`)}),(0,C.jsx)(D,{t:E(e.dark,n,`dark`),label:_(`activity:designStudio.dark`)})]}),(0,C.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 border-t border-border/60 bg-card p-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,C.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e.id}),t&&(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-semibold uppercase text-primary ml-auto`,children:[(0,C.jsx)(o,{className:`w-3 h-3`}),` `,_(`activity:design.active`)]})]}),(0,C.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:e.aesthetic}),(0,C.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>I(e.id),className:f(`rounded-md px-2.5 py-1 text-[11px] font-medium transition`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:_(t?`activity:design.reapply`:`activity:design.use`)}),t&&(0,C.jsxs)(`button`,{type:`button`,onClick:z,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:_(`activity:design.materializeTitle`,{stack:A}),children:[(0,C.jsx)(c,{className:`w-3 h-3`}),` `,_(`activity:design.materialize`)]}),t&&(0,C.jsxs)(`button`,{type:`button`,onClick:B,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:_(`activity:design.verifyTitle`),children:[(0,C.jsx)(d,{className:`w-3 h-3`}),` `,_(`activity:design.verify`)]}),(0,C.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-muted-foreground`,children:e.bestFor})]}),t&&(0,C.jsx)(O,{kit:e,overrides:n,onSet:L}),t&&(0,C.jsx)(k,{onTune:R})]})]},e.id)})})})]})}export{A as DesignGalleryView};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{mt as t}from"./config-store-BbL0WxLE.js";import{i as n,t as r}from"./react-core-wiHys0m2.js";import{Dn as i,Mt as a,Pa as o,or as s,qi as c,wo as l,xo as u,yn as d}from"./vendor-V3ydTHqN.js";import"./i18n-Dv97urcO.js";import{t as f}from"./utils-CKsqCaP8.js";import{o as p}from"./view-navigation-CpIPxhZp.js";import{L as m,y as h}from"./index-DX6tHUzs.js";var g=e(n(),1);function _(e,t,n){return e<t?t:e>n?n:e}function v(e){let t=/^oklch\(\s*([^)]+)\)$/i.exec(e.trim());if(!t?.[1])return null;let n=(t[1].split(`/`)[0]??``).trim().split(/\s+/);if(n.length<3||!n[0]||!n[1]||!n[2])return null;let r=n[0].endsWith(`%`)?Number.parseFloat(n[0])/100:Number.parseFloat(n[0]),i=n[1].endsWith(`%`)?Number.parseFloat(n[1])/100*.4:Number.parseFloat(n[1]),a=Number.parseFloat(n[2].replace(/deg$/i,``));return[r,i,a].every(Number.isFinite)?[_(r,0,1),Math.max(0,i),a]:null}function y(e){return _(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,0,1)}function b(e){return Math.round(e*255).toString(16).padStart(2,`0`)}function x(e){let t=v(e);if(!t)return null;let[n,r,i]=t,a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return`#${b(y(m))}${b(y(h))}${b(y(g))}`}function S(e){let t=e.trim(),n=x(t);if(n)return n.toLowerCase();let r=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t);if(r?.[1])return`#${r[1].toLowerCase()}`;let i=/^#([0-9a-f]{3})$/i.exec(t);return i?.[1]?`#${i[1].split(``).map(e=>e+e).join(``).toLowerCase()}`:null}var C=r(),w=[`web`,`react-native`,`flutter`,`swiftui`,`compose`],T=[`primary`,`accent`,`bg`,`surface`,`fg`,`border`];function E(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))e.startsWith(`light.`)?n===`light`&&(r[e.slice(6)]=i):e.startsWith(`dark.`)?n===`dark`&&(r[e.slice(5)]=i):r[e]=i;return r}function D({t:e,label:t}){let{t:n}=u(),r=e.bg??`#fff`,i=e.surface??r,a=e.fg??`#111`,o=e.muted??a,s=e.primary??`#3b82f6`,c=e.accent??s,l=e.border??o,d=e[`radius-md`]??e.radius??`0.5rem`,f=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,p=e[`font-display`]??e.fontDisplay??f,m=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,C.jsxs)(`div`,{style:{background:r,color:a,fontFamily:f},className:`flex min-w-0 flex-col gap-2 overflow-hidden p-3`,children:[(0,C.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide`,style:{color:o},children:t}),(0,C.jsxs)(`div`,{style:{background:i,border:`1px solid ${l}`,borderRadius:d,boxShadow:m},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,C.jsx)(`div`,{style:{fontFamily:p},className:`text-base font-bold leading-tight`,children:n(`activity:designStudio.aaHeading`)}),(0,C.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:o},children:n(`activity:designStudio.theQuickBrownFoxJumpsOver`)}),(0,C.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,C.jsx)(`span`,{style:{background:s,color:r,borderRadius:d},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:n(`activity:designStudio.primary`)}),(0,C.jsx)(`span`,{style:{border:`1px solid ${l}`,color:a,borderRadius:d},className:`shrink-0 px-2 py-1 text-[10px]`,children:n(`activity:designStudio.ghost`)}),(0,C.jsx)(`span`,{style:{background:c,color:r,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:n(`activity:designStudio.badge`)})]}),(0,C.jsx)(`div`,{style:{border:`1px solid ${l}`,borderRadius:d,color:o},className:`text-[10px] px-2 py-1.5 mt-1`,children:n(`activity:designStudio.inputField`)})]})]})}function O({kit:e,overrides:t,onSet:n}){let[r,i]=(0,g.useState)(`light`),{t:a}=u(),o=E(r===`light`?e.light:e.dark,t,r);return(0,C.jsxs)(`div`,{className:`mt-1 rounded-lg border border-border/60 p-2 bg-muted/30`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,C.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:a(`activity:design.colors`)}),(0,C.jsx)(`div`,{className:`ml-auto inline-flex rounded border border-border/60 overflow-hidden`,children:[`light`,`dark`].map(e=>(0,C.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:f(`text-[10px] px-1.5 py-0.5`,r===e?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e},e))})]}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:T.filter(e=>o[e]).map(e=>{let t=S(o[e]??``)??`#000000`;return(0,C.jsxs)(`label`,{className:`flex min-w-[2rem] flex-col items-center gap-0.5`,title:`${e}: ${o[e]}`,children:[(0,C.jsx)(`input`,{type:`color`,value:t,onChange:t=>n(`${r}.${e}`,t.target.value),className:`w-6 h-6 rounded cursor-pointer bg-transparent border border-border/60 p-0`}),(0,C.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e})]},e)})})]})}function k({onTune:e}){let{t}=u(),[n,r]=(0,g.useState)(``),i=({label:t,knob:n,values:r})=>(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:t}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(t=>(0,C.jsx)(`button`,{type:`button`,onClick:()=>e({[n]:t}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-primary hover:text-primary-foreground`,children:t},t))})]});return(0,C.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1.5 rounded-lg border border-border/60 bg-muted/30 p-2`,children:[(0,C.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:t(`activity:designStudio.tune`)}),(0,C.jsx)(i,{label:t(`activity:designStudio.radius`),knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,C.jsx)(i,{label:t(`activity:designStudio.density`),knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,C.jsx)(i,{label:t(`activity:designStudio.motion`),knob:`motion`,values:[`snappy`,`smooth`,`none`]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:t(`activity:designStudio.font`)}),(0,C.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),onKeyDown:t=>{t.key===`Enter`&&n.trim()&&e({font:n.trim()})},placeholder:t(`activity:designStudio.spaceGrotesk`),className:`h-6 min-w-0 flex-1 rounded border border-border/60 bg-background/70 px-1.5 text-[10px]`}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>n.trim()&&e({font:n.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:t(`activity:designStudio.set`)})]})]})}function A({className:e}){let{client:n}=m(),r=t(),{t:_}=u(),[v,y]=(0,g.useState)([]),[b,x]=(0,g.useState)(null),[S,T]=(0,g.useState)({}),[A,j]=(0,g.useState)(`web`),[M,N]=(0,g.useState)(``),[P,F]=(0,g.useState)(null);(0,g.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.payload?.sessionId;return typeof t!=`string`||t.length===0?r!==null:t!==r},t=t=>{if(e(t))return;let n=t.payload;y(n?.kits??[]),x(n?.activeKit??null),T(n?.overrides??{})},i=t=>{if(e(t))return;let n=t.payload;n?.ok&&n.kit&&(x(n.kit),T(n.overrides??{}))},a=t=>{if(e(t))return;let n=t.payload;n?.ok&&n.overrides&&T(n.overrides)},o=t=>{if(e(t))return;let n=t.payload;n?.ok&&n.overrides?(T(n.overrides),F(`Tuned`)):n?.error&&F(`Tune failed: ${n.error}`)},s=t=>{if(e(t))return;let n=t.payload;n?.ok&&n.kit&&(x(n.kit),T(n.overrides??{}),F(`Swapped to ${n.kit}`))},c=t=>{if(e(t))return;let n=t.payload;F(n?.ok?l.t(`activity:design.wrote`,{path:n.path}):l.t(`activity:design.materializeFailed`,{error:n?.error??`error`}))},u=t=>{if(e(t))return;let n=t.payload;if(!n?.ok){F(l.t(`activity:design.verifyError`,{error:n?.error??`error`}));return}let r=Math.round((n.score??1)*100);F(n.violationCount?l.t(`activity:design.verifyOffPalette`,{pct:r,count:n.violationCount,files:n.filesScanned}):l.t(`activity:design.verifyClean`,{files:n.filesScanned}))};return n.on(`design.list`,t),n.on(`design.use`,i),n.on(`design.set`,a),n.on(`design.tune`,o),n.on(`design.swap`,s),n.on(`design.materialize`,c),n.on(`design.verify`,u),n.send({type:`design.list`,payload:n.withSession({})}),()=>{n.off(`design.list`,t),n.off(`design.use`,i),n.off(`design.set`,a),n.off(`design.tune`,o),n.off(`design.swap`,s),n.off(`design.materialize`,c),n.off(`design.verify`,u)}},[n,r]);let I=(0,g.useCallback)(e=>n?.send({type:`design.use`,payload:n.withSession({kit:e,stack:A})}),[n,A]),L=(0,g.useCallback)((e,t)=>{T(n=>({...n,[e]:t})),n?.send({type:`design.set`,payload:n.withSession({overrides:{[e]:t}})})},[n]),R=(0,g.useCallback)(e=>n?.send({type:`design.tune`,payload:n.withSession({tune:e})}),[n]),z=(0,g.useCallback)(()=>{F(l.t(`activity:design.writing`)),n?.send({type:`design.materialize`,payload:n.withSession({stack:A})})},[n,A]),B=(0,g.useCallback)(()=>{F(l.t(`activity:design.scanning`)),n?.send({type:`design.verify`,payload:n.withSession({})})},[n]),V=(0,g.useMemo)(()=>{let e=M.trim().toLowerCase();return[...e?v.filter(t=>t.id.includes(e)||t.name.toLowerCase().includes(e)||t.aesthetic.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))):v].sort((e,t)=>e.name.localeCompare(t.name))},[v,M]);return(0,C.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)]`,e),children:[(0,C.jsx)(`div`,{className:`border-b border-border/60 p-3`,children:(0,C.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-3 shadow-sm`,children:(0,C.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center`,children:[(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,C.jsx)(s,{className:`h-4 w-4`})}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:_(`activity:design.heading`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:_(`activity:design.kitsCount`,{count:V.length})})]})]}),(0,C.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center lg:justify-end`,children:[(0,C.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:max-w-xs`,children:[(0,C.jsx)(i,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,C.jsx)(`input`,{value:M,onChange:e=>N(e.target.value),placeholder:_(`activity:design.searchPlaceholder`),className:`h-9 w-full rounded-md border border-border/70 bg-background/70 pl-8 pr-3 text-sm shadow-sm outline-none transition focus:border-primary/40 focus:ring-2 focus:ring-ring/30`})]}),(0,C.jsx)(`select`,{value:A,onChange:e=>j(e.target.value),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm shadow-sm`,title:_(`activity:design.stackTitle`),children:w.map(e=>(0,C.jsx)(`option`,{value:e,children:e},e))}),P&&(0,C.jsx)(`span`,{className:`min-w-0 truncate rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground sm:max-w-56`,children:P}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>p(`chat`),className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,title:_(`common:action.close`),children:(0,C.jsx)(a,{className:`h-4 w-4`})})]})]})})}),(0,C.jsx)(`div`,{ref:h(`design-gallery`),className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain p-3 sm:p-4`,children:V.length===0?(0,C.jsxs)(`div`,{className:`ws-surface mx-auto mt-8 flex max-w-md flex-col items-center gap-3 rounded-xl p-6 text-center text-muted-foreground`,children:[(0,C.jsx)(s,{className:`h-8 w-8 text-primary/60`}),(0,C.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:_(`activity:design.kitsCount`,{count:0})}),(0,C.jsx)(`p`,{className:`text-xs`,children:_(`activity:design.searchPlaceholder`)})]}):(0,C.jsx)(`div`,{className:`grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(min(100%,20rem),1fr))]`,children:V.map(e=>{let t=b===e.id,n=t?S:{};return(0,C.jsxs)(`div`,{className:f(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card/75 shadow-sm`,t?`border-primary/60 ring-1 ring-primary/30`:`border-border/70`),children:[(0,C.jsxs)(`div`,{className:`grid min-h-[12rem] grid-cols-1 sm:grid-cols-2`,children:[(0,C.jsx)(D,{t:E(e.light,n,`light`),label:_(`activity:designStudio.light`)}),(0,C.jsx)(D,{t:E(e.dark,n,`dark`),label:_(`activity:designStudio.dark`)})]}),(0,C.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 border-t border-border/60 bg-card p-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,C.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e.id}),t&&(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-semibold uppercase text-primary ml-auto`,children:[(0,C.jsx)(o,{className:`w-3 h-3`}),` `,_(`activity:design.active`)]})]}),(0,C.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:e.aesthetic}),(0,C.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>I(e.id),className:f(`rounded-md px-2.5 py-1 text-[11px] font-medium transition`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:_(t?`activity:design.reapply`:`activity:design.use`)}),t&&(0,C.jsxs)(`button`,{type:`button`,onClick:z,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:_(`activity:design.materializeTitle`,{stack:A}),children:[(0,C.jsx)(c,{className:`w-3 h-3`}),` `,_(`activity:design.materialize`)]}),t&&(0,C.jsxs)(`button`,{type:`button`,onClick:B,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:_(`activity:design.verifyTitle`),children:[(0,C.jsx)(d,{className:`w-3 h-3`}),` `,_(`activity:design.verify`)]}),(0,C.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-muted-foreground`,children:e.bestFor})]}),t&&(0,C.jsx)(O,{kit:e,overrides:n,onSet:L}),t&&(0,C.jsx)(k,{onTune:R})]})]},e.id)})})})]})}export{A as DesignGalleryView};
|