trybeacon 0.1.82 → 0.1.84
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/.claude-plugin/plugin.json +1 -1
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +20 -20
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/@modal/(.)settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/docs.html +1 -1
- package/.next/server/app/docs.rsc +1 -1
- package/.next/server/app/docs.segments/@modal/__DEFAULT__.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/.next/server/app/help.html +1 -1
- package/.next/server/app/help.rsc +1 -1
- package/.next/server/app/help.segments/@modal/__DEFAULT__.segment.rsc +1 -1
- package/.next/server/app/help.segments/_full.segment.rsc +1 -1
- package/.next/server/app/help.segments/_head.segment.rsc +1 -1
- package/.next/server/app/help.segments/_index.segment.rsc +1 -1
- package/.next/server/app/help.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/help.segments/help.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/app/index.segments/@modal/__DEFAULT__.segment.rsc +1 -1
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/learn/page.js +3 -3
- package/.next/server/app/learn/page.js.nft.json +1 -1
- package/.next/server/app/learn/page_client-reference-manifest.js +1 -1
- package/.next/server/app/map/page.js +1 -1
- package/.next/server/app/map/page.js.nft.json +1 -1
- package/.next/server/app/map/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/plan/page.js +2 -2
- package/.next/server/app/plan/page.js.nft.json +1 -1
- package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
- package/.next/server/app/s/[token]/page.js +1 -1
- package/.next/server/app/s/[token]/page.js.nft.json +1 -1
- package/.next/server/app/s/[token]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +20 -20
- package/.next/server/chunks/2933.js +1 -1
- package/.next/server/chunks/9213.js +1 -1
- package/.next/server/chunks/9979.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/3748-ffd46534ace96c3d.js +1 -0
- package/.next/static/chunks/app/learn/{page-c01e1092ca9135e6.js → page-b1bea0ba5fbf4c80.js} +1 -1
- package/.next/static/chunks/app/map/{page-9075091c6ba84c19.js → page-bc44aabbc5a3a261.js} +1 -1
- package/.next/static/chunks/app/plan/{page-6645cae32f5767c2.js → page-2be2dee159981532.js} +2 -2
- package/.next/static/chunks/app/s/[token]/{page-2cf9b4a9b7740e56.js → page-dd148c2090094329.js} +1 -1
- package/.next/trace +47 -47
- package/.next/trace-build +1 -1
- package/dist/bin/remove.js +5 -5
- package/package.json +1 -1
- package/.next/server/chunks/5081.js +0 -1
- package/.next/static/chunks/7437-686839cf9b298bd8.js +0 -1
- /package/.next/static/{32-hn-zWkepUstH6QZVnt → GCYTD3B9xLkKH9uIwlKD-}/_buildManifest.js +0 -0
- /package/.next/static/{32-hn-zWkepUstH6QZVnt → GCYTD3B9xLkKH9uIwlKD-}/_ssgManifest.js +0 -0
|
@@ -4,4 +4,4 @@ ${e.answer??"_(waiting for the agent…)_"}`).join("\n"):"",r=`${e.detail||""}${
|
|
|
4
4
|
::highlight(${b}) { background: color-mix(in srgb, var(--accent-2,#ff7a45) 30%, transparent); }
|
|
5
5
|
::highlight(${k}) { background: color-mix(in srgb, var(--accent-2,#ff7a45) 18%, transparent); }
|
|
6
6
|
::highlight(${j}) { background: color-mix(in srgb, #34d399 16%, transparent); }
|
|
7
|
-
`}),t.map((e,t)=>(0,s.jsx)(S,{block:e,index:t},t))]})}function S({block:e,index:t}){if("code"===e.kind)return(0,s.jsx)(p.NG,{text:e.text});if("table"===e.kind)return(0,s.jsx)(p.QH,{block:e});let n=(0,p.Vq)(e.kind)?`lesson-h-${t}`:void 0;return(0,s.jsx)(s.Fragment,{children:(0,p.aM)(e,(0,s.jsx)(p.cV,{text:e.text}),"reading",n)})}var I=n(67437),q=n(36925);function z({initialLesson:e,repoFiles:t=[]}){let n=(0,a.useRouter)(),[u,x]=(0,r.useState)(e),[m,g]=(0,r.useState)(null),[v,b]=(0,r.useState)([]),[k,j]=(0,r.useState)(null),[y,N]=(0,r.useState)(""),[w,C]=(0,r.useState)(!1),[E,S]=(0,r.useState)(!1),[O,F]=(0,r.useState)(!1),[H,P]=(0,r.useState)(null),[D,_]=(0,r.useState)(null),K=u?.updatedAt??0,U=(0,r.useRef)(K);(0,r.useEffect)(()=>{U.current=K},[K]),(0,r.useEffect)(()=>{let e=()=>void fetch("/api/lesson/presence",{method:"POST",cache:"no-store",headers:(0,h.dh)((0,h.fk)())}).catch(()=>{});e();let t=setInterval(e,5e3);return()=>clearInterval(t)},[]);let V=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/lesson",{cache:"no-store",headers:(0,h.dh)((0,h.fk)())});if(!e.ok)return;let t=(await e.json()).lesson;t&&t.updatedAt>U.current?(x(t),b([]),j(null),N(""),F(!1)):!t&&U.current>0&&x(null)}catch{}},[]);(0,r.useEffect)(()=>{if(H)return;let e=setInterval(()=>void V(),3e3),t=()=>{"visible"===document.visibilityState&&V()};return document.addEventListener("visibilitychange",t),window.addEventListener("focus",t),()=>{clearInterval(e),document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",t)}},[H,V]);let Q=(0,r.useCallback)(()=>{let e=Date.now(),t=(m?.textQuestions??[]).filter(e=>e.question.trim()).map(t=>({id:t.id,anchor:{kind:"text",excerpt:t.excerpt},question:t.question,askedAt:e})),n=v.filter(e=>e.question.trim()).map(t=>({id:t.id,anchor:{kind:"node",nodeId:t.nodeId},question:t.question,askedAt:e}));return[...y.trim()?[{id:`oq-${e}`,anchor:{kind:"overall"},question:y.trim(),askedAt:e}]:[],...n,...t]},[m,v,y]),B=(m?.count??0)+v.filter(e=>e.question.trim()).length+ +!!y.trim(),Y=(0,r.useCallback)(async()=>{if(!E&&0!==B){S(!0);try{(await fetch("/api/lesson/questions",{method:"POST",headers:{"content-type":"application/json",...(0,h.dh)((0,h.fk)())},body:JSON.stringify({questions:Q()})})).ok&&(F(!0),C(!1),j(null))}finally{S(!1)}}},[E,B,Q]),X=(0,r.useCallback)(async()=>{let e=await fetch("/api/lesson/save",{method:"POST",headers:(0,h.dh)((0,h.fk)())});e.ok&&(_((await e.json()).lessonId??u?.id??null),P("saved"))},[u]),W=(0,r.useCallback)(async()=>{await fetch("/api/lesson/close",{method:"POST",headers:(0,h.dh)((0,h.fk)())}).catch(()=>{}),P("closed")},[]),J=(0,r.useCallback)((e,t)=>{b(n=>[...n,{id:`nq-${Date.now()}-${Math.floor(1e6*Math.random())}`,nodeId:e,question:t}])},[]),G=(0,r.useCallback)(e=>{let t=e.replace(/^[^:]+:\s*/,"").trim(),n=u?.nodes.find(e=>e.title===t);n&&j(n.id)},[u]),Z=(0,r.useMemo)(()=>(u?.questions??[]).filter(e=>"text"===e.anchor.kind&&e.answer).map(e=>({excerpt:"text"===e.anchor.kind?e.anchor.excerpt:"",answer:e.answer??""})),[u]),ee=(0,r.useMemo)(()=>(u?.questions??[]).filter(e=>"overall"===e.anchor.kind),[u]),et=(0,r.useMemo)(()=>u?(0,q.I)(u):{nodes:[],edges:[],tableNodes:[]},[u]);if(H)return(0,s.jsx)($,{ended:H,savedId:D,onBrowse:()=>n.push("/learn?view=library")});if(!u)return(0,s.jsx)(L,{});let en=k?u.nodes.find(e=>e.id===k)?.title??"":"";return(0,s.jsx)(p.Ue,{files:t,children:(0,s.jsxs)("div",{className:"relative flex h-screen flex-col",children:[O&&(0,s.jsx)(M,{onDismiss:()=>F(!1)}),(0,s.jsx)("div",{className:"pointer-events-none fixed right-3 top-3 z-30 flex items-center gap-2",children:(0,s.jsxs)("div",{className:"glass pointer-events-auto flex h-10 items-center gap-0.5 rounded-full px-1",children:[(0,s.jsx)("button",{onClick:()=>n.push("/learn?view=library"),title:"Saved lessons",className:"flex size-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:(0,s.jsx)(o.A,{className:"size-3.5"})}),(0,s.jsx)("span",{"aria-hidden":!0,className:"mx-1 h-5 w-px bg-border"}),(0,s.jsxs)("button",{onClick:()=>C(e=>!e),title:"Ask an overall question",className:(0,f.cn)("relative flex size-8 items-center justify-center rounded-full transition-colors",w?"bg-[var(--ink-active)] text-foreground":y.trim()?"text-[var(--accent-2,#ff7a45)]":"text-muted-foreground hover:bg-[var(--ink-hover)] hover:text-foreground"),children:[(0,s.jsx)(l.A,{className:"size-3.5"}),y.trim()&&(0,s.jsx)("span",{className:"absolute -right-0.5 -top-0.5 size-2 rounded-full bg-[var(--accent-2,#ff7a45)]"})]}),(0,s.jsx)("span",{"aria-hidden":!0,className:"mx-1 h-5 w-px bg-border"}),(0,s.jsxs)("button",{onClick:()=>void Y(),disabled:E||0===B,title:0===B?"Highlight text or a node to ask, then send":"Send your questions to the agent",className:(0,f.cn)("flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-semibold transition-colors",0===B?"text-muted-foreground opacity-50":"text-[var(--accent-2,#ff7a45)] hover:bg-[var(--accent-2,#ff7a45)]/15"),children:[(0,s.jsx)(i.A,{className:"size-3"})," Send",B>0?` (${B})`:""]}),(0,s.jsxs)("button",{onClick:()=>void X(),title:"Save this lesson to your library",className:"flex items-center gap-1 rounded-full border border-emerald-500/40 bg-emerald-500/15 px-2.5 py-1 text-[11px] font-semibold text-emerald-300 transition-colors hover:bg-emerald-500/25",children:[(0,s.jsx)(d,{className:"size-3"})," Save"]}),(0,s.jsxs)("button",{onClick:()=>void W(),title:"Close without saving",className:"flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-red-500/15 hover:text-red-300",children:[(0,s.jsx)(c.A,{className:"size-3"})," Close"]})]})}),w&&(0,s.jsx)(T,{label:"Overall question",placeholder:"A question about the whole topic…",value:y,onChange:N,onClose:()=>C(!1)}),k&&(0,s.jsx)(T,{label:`Ask about “${en}”`,placeholder:"Your question about this node…",value:"",submitLabel:"Add question",onSubmit:e=>{J(k,e),j(null)},onClose:()=>j(null)}),(0,s.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,s.jsxs)("div",{className:"relative flex min-w-0 flex-1 flex-col bg-background",style:{width:"50%"},children:[(0,s.jsx)("div",{className:"min-h-0 flex-1",children:(0,s.jsx)(A,{narrative:u.narrative,round:K,answered:Z,onApi:g})}),ee.length>0&&(0,s.jsx)(R,{questions:ee})]}),(0,s.jsx)("div",{className:"w-px shrink-0 bg-border"}),(0,s.jsx)("div",{className:"relative min-w-0 flex-1 bg-background",style:{width:"50%"},children:(0,s.jsx)(I.MapClient,{view:"ARCHITECTURE",nodes:et.nodes,edges:et.edges,tableNodes:et.tableNodes,embedded:!0,readOnly:!0,minimap:!0,staticEdgeLabels:!0,hasFrontend:!1,onAskAgent:G})})]})]})})}function T({label:e,placeholder:t,value:n,submitLabel:a,onChange:o,onSubmit:l,onClose:i}){let[d,u]=(0,r.useState)(n),x=o?n:d;return(0,s.jsxs)("div",{className:"fixed right-3 top-16 z-30 w-80 rounded-xl border border-border bg-card p-3 shadow-xl",children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground [overflow-wrap:anywhere]",children:e}),(0,s.jsx)("button",{onClick:i,title:"Close",className:"rounded p-0.5 text-muted-foreground hover:text-foreground",children:(0,s.jsx)(c.A,{className:"size-3.5"})})]}),(0,s.jsx)("textarea",{autoFocus:!0,value:x,onChange:e=>{let t;return t=e.target.value,o?o(t):u(t)},onKeyDown:e=>{l&&"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),x.trim()&&l(x.trim()))},placeholder:t,rows:3,className:"w-full resize-y rounded border border-border bg-background px-2 py-1.5 text-[12px] leading-snug outline-none focus:border-[var(--accent-2,#ff7a45)]/40"}),l&&(0,s.jsx)("button",{onClick:()=>x.trim()&&l(x.trim()),disabled:!x.trim(),className:"mt-1.5 w-full rounded-md bg-[var(--accent-2,#ff7a45)]/15 px-2 py-1 text-[11px] font-semibold text-[var(--accent-2,#ff7a45)] transition-colors hover:bg-[var(--accent-2,#ff7a45)]/25 disabled:opacity-40",children:a??"Add"})]})}function R({questions:e}){return(0,s.jsxs)("div",{className:"max-h-44 shrink-0 space-y-1.5 overflow-y-auto border-t border-border bg-background/60 px-5 py-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[(0,s.jsx)(l.A,{className:"size-3"}),"Overall Q&A"]}),e.map(e=>(0,s.jsxs)("div",{className:"rounded-md border border-border bg-background/40 p-2",children:[(0,s.jsx)("div",{className:"text-[12px] font-medium text-foreground",children:e.question}),e.answer?(0,s.jsx)("div",{className:"mt-1 text-[12px] leading-relaxed text-foreground/85",children:(0,s.jsx)(p.pO,{markdown:e.answer,variant:"compact"})}):(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-1 text-[11px] text-muted-foreground/70",children:[(0,s.jsx)(u.A,{className:"size-3 animate-spin"})," waiting for the agent…"]})]},e.id))]})}function M({onDismiss:e}){return(0,s.jsxs)("div",{className:"absolute inset-0 z-40 flex flex-col items-center justify-center gap-4 bg-background/95 px-6 text-center backdrop-blur-sm",children:[(0,s.jsx)("div",{className:"flex size-12 items-center justify-center rounded-full bg-[var(--accent-2,#ff7a45)]/15",children:(0,s.jsx)(u.A,{className:"size-6 animate-spin text-[var(--accent-2,#ff7a45)]"})}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Questions sent"}),(0,s.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Your terminal session is answering. The updated lesson will appear here automatically — if the session finished its turn, nudge it in the terminal."})]}),(0,s.jsx)("button",{onClick:e,className:"rounded-full border border-border px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:"Keep reading meanwhile"})]})}function L(){return(0,s.jsxs)("div",{className:"flex h-screen flex-col items-center justify-center gap-3 px-6 text-center",children:[(0,s.jsx)(x.A,{className:"size-8 text-muted-foreground/60"}),(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"No lesson open"}),(0,s.jsxs)("p",{className:"max-w-md text-sm text-muted-foreground",children:["Ask your terminal session to ",(0,s.jsx)("em",{children:"explain"})," or ",(0,s.jsx)("em",{children:"teach"})," you part of the codebase — it opens an interactive lesson here. You highlight text to ask questions; it answers on the board."]})]})}function $({ended:e,savedId:t,onBrowse:n}){return(0,s.jsxs)("div",{className:"flex h-screen flex-col items-center justify-center gap-5 px-6 text-center",children:[(0,s.jsx)("div",{className:(0,f.cn)("flex size-12 items-center justify-center rounded-full","saved"===e?"bg-emerald-500/15":"bg-[var(--ink-active)]"),children:"saved"===e?(0,s.jsx)(m.A,{className:"size-6 text-emerald-300"}):(0,s.jsx)(c.A,{className:"size-6 text-muted-foreground"})}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"saved"===e?"Lesson saved":"Lesson closed"}),(0,s.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:"saved"===e?"It's in your library — reopen it anytime.":"Closed without saving."})]}),(0,s.jsxs)("button",{onClick:n,className:"rounded-full border border-border px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:[(0,s.jsx)(o.A,{className:"mr-1 inline size-3.5"})," ",t?"Browse the library":"Open the library"]})]})}},38096:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(30772).A)("library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]])},38464:(e,t,n)=>{"use strict";n.d(t,{LessonLibraryView:()=>f});var s=n(95155),r=n(12115),a=n(73321),o=n(38096),l=n(40557),i=n(31966),d=n(60292),c=n(51909),u=n(67437),x=n(36925);function m(e){let t=new URLSearchParams,n=(0,d.fk)();for(let[s,r]of(n&&t.set("ws",n),Object.entries(e)))t.set(s,r);return`/learn?${t.toString()}`}function f({lessons:e,selected:t,repoFiles:n=[]}){return t?(0,s.jsx)(p,{lesson:t,repoFiles:n}):(0,s.jsx)(h,{lessons:e})}function h({lessons:e}){let t=(0,a.useRouter)();return(0,s.jsxs)("div",{className:"mx-auto flex h-screen w-full max-w-3xl flex-col px-6 pt-20",children:[(0,s.jsxs)("div",{className:"mb-5 flex items-center justify-between",children:[(0,s.jsxs)("h1",{className:"flex items-center gap-2 text-lg font-semibold text-foreground",children:[(0,s.jsx)(o.A,{className:"size-5 text-[var(--accent-2,#ff7a45)]"})," Lessons"]}),(0,s.jsx)("button",{onClick:()=>t.push(m({})),className:"rounded-full border border-border px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:"Back to current lesson"})]}),0===e.length?(0,s.jsxs)("div",{className:"rounded-lg border border-dashed border-border px-4 py-12 text-center text-sm text-muted-foreground",children:["No saved lessons yet. Ask your terminal session to explain something, then click ",(0,s.jsx)("b",{children:"Save"}),"."]}):(0,s.jsx)("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto pb-6",children:e.map(e=>(0,s.jsxs)("button",{onClick:()=>t.push(m({view:"library",id:e.id})),className:"block w-full rounded-lg border border-border bg-white/[0.02] p-3 text-left transition-colors hover:border-border hover:bg-[var(--ink-hover)]",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-[14px] font-semibold text-foreground",children:[(0,s.jsx)(l.A,{className:"size-4 text-[var(--accent-2,#ff7a45)]"})," ",e.title]}),e.topic&&e.topic!==e.title&&(0,s.jsx)("div",{className:"mt-0.5 truncate text-[12px] text-muted-foreground",children:e.topic}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-muted-foreground/70",children:[e.nodeCount," node",1===e.nodeCount?"":"s"," \xb7 ",e.questionCount," question",1===e.questionCount?"":"s"," \xb7 saved ",new Date(e.updatedAt).toLocaleDateString()]})]},e.id))})]})}function p({lesson:e,repoFiles:t}){let n=(0,a.useRouter)(),o=(0,r.useMemo)(()=>new Map(e.nodes.map(e=>[e.id,e.title])),[e.nodes]),l=(0,r.useMemo)(()=>(0,x.I)(e),[e]);return(0,s.jsx)(c.Ue,{files:t,children:(0,s.jsxs)("div",{className:"relative flex h-screen flex-col",children:[(0,s.jsx)("div",{className:"pointer-events-none fixed right-3 top-3 z-30",children:(0,s.jsxs)("button",{onClick:()=>n.push(m({view:"library"})),className:"glass pointer-events-auto flex h-10 items-center gap-1.5 rounded-full px-3 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:[(0,s.jsx)(i.A,{className:"size-3.5"})," Library"]})}),(0,s.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto bg-background px-5 pb-6 pt-16",style:{width:"50%"},children:[(0,s.jsx)(c.pO,{markdown:e.narrative,variant:"reading"}),e.questions.length>0&&(0,s.jsxs)("div",{className:"mx-auto mt-6 w-full max-w-[66ch] space-y-2",children:[(0,s.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Q&A"}),e.questions.map(e=>(0,s.jsx)(g,{q:e,nodeTitle:"node"===e.anchor.kind?o.get(e.anchor.nodeId):void 0},e.id))]})]}),(0,s.jsx)("div",{className:"w-px shrink-0 bg-border"}),(0,s.jsx)("div",{className:"min-w-0 flex-1 bg-background",style:{width:"50%"},children:(0,s.jsx)(u.MapClient,{view:"ARCHITECTURE",nodes:l.nodes,edges:l.edges,tableNodes:l.tableNodes,embedded:!0,readOnly:!0,minimap:!0,staticEdgeLabels:!0,hasFrontend:!1})})]})]})})}function g({q:e,nodeTitle:t}){let n="overall"===e.anchor.kind?"Overall":"node"===e.anchor.kind?t??"Node":`“${e.anchor.excerpt.slice(0,48)}…”`;return(0,s.jsxs)("div",{className:"rounded-md border border-border bg-background/40 p-2",children:[(0,s.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/80",children:n}),(0,s.jsx)("div",{className:"mt-0.5 text-[12px] font-medium text-foreground",children:e.question}),e.answer&&(0,s.jsx)("div",{className:"mt-1 text-[12px] leading-relaxed text-foreground/85",children:(0,s.jsx)(c.pO,{markdown:e.answer,variant:"compact"})})]})}},40557:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(30772).A)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},73206:(e,t,n)=>{Promise.resolve().then(n.bind(n,37665)),Promise.resolve().then(n.bind(n,38464))}},e=>{e.O(0,[2574,3862,5004,277,8500,4888,2114,1569,5547,8710,6283,6818,7437,1909,8441,3794,7358],()=>e(e.s=73206)),_N_E=e.O()}]);
|
|
7
|
+
`}),t.map((e,t)=>(0,s.jsx)(S,{block:e,index:t},t))]})}function S({block:e,index:t}){if("code"===e.kind)return(0,s.jsx)(p.NG,{text:e.text});if("table"===e.kind)return(0,s.jsx)(p.QH,{block:e});let n=(0,p.Vq)(e.kind)?`lesson-h-${t}`:void 0;return(0,s.jsx)(s.Fragment,{children:(0,p.aM)(e,(0,s.jsx)(p.cV,{text:e.text}),"reading",n)})}var I=n(23748),q=n(36925);function z({initialLesson:e,repoFiles:t=[]}){let n=(0,a.useRouter)(),[u,x]=(0,r.useState)(e),[m,g]=(0,r.useState)(null),[v,b]=(0,r.useState)([]),[k,j]=(0,r.useState)(null),[y,N]=(0,r.useState)(""),[w,C]=(0,r.useState)(!1),[E,S]=(0,r.useState)(!1),[O,F]=(0,r.useState)(!1),[H,P]=(0,r.useState)(null),[D,_]=(0,r.useState)(null),K=u?.updatedAt??0,U=(0,r.useRef)(K);(0,r.useEffect)(()=>{U.current=K},[K]),(0,r.useEffect)(()=>{let e=()=>void fetch("/api/lesson/presence",{method:"POST",cache:"no-store",headers:(0,h.dh)((0,h.fk)())}).catch(()=>{});e();let t=setInterval(e,5e3);return()=>clearInterval(t)},[]);let V=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/lesson",{cache:"no-store",headers:(0,h.dh)((0,h.fk)())});if(!e.ok)return;let t=(await e.json()).lesson;t&&t.updatedAt>U.current?(x(t),b([]),j(null),N(""),F(!1)):!t&&U.current>0&&x(null)}catch{}},[]);(0,r.useEffect)(()=>{if(H)return;let e=setInterval(()=>void V(),3e3),t=()=>{"visible"===document.visibilityState&&V()};return document.addEventListener("visibilitychange",t),window.addEventListener("focus",t),()=>{clearInterval(e),document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",t)}},[H,V]);let Q=(0,r.useCallback)(()=>{let e=Date.now(),t=(m?.textQuestions??[]).filter(e=>e.question.trim()).map(t=>({id:t.id,anchor:{kind:"text",excerpt:t.excerpt},question:t.question,askedAt:e})),n=v.filter(e=>e.question.trim()).map(t=>({id:t.id,anchor:{kind:"node",nodeId:t.nodeId},question:t.question,askedAt:e}));return[...y.trim()?[{id:`oq-${e}`,anchor:{kind:"overall"},question:y.trim(),askedAt:e}]:[],...n,...t]},[m,v,y]),B=(m?.count??0)+v.filter(e=>e.question.trim()).length+ +!!y.trim(),Y=(0,r.useCallback)(async()=>{if(!E&&0!==B){S(!0);try{(await fetch("/api/lesson/questions",{method:"POST",headers:{"content-type":"application/json",...(0,h.dh)((0,h.fk)())},body:JSON.stringify({questions:Q()})})).ok&&(F(!0),C(!1),j(null))}finally{S(!1)}}},[E,B,Q]),X=(0,r.useCallback)(async()=>{let e=await fetch("/api/lesson/save",{method:"POST",headers:(0,h.dh)((0,h.fk)())});e.ok&&(_((await e.json()).lessonId??u?.id??null),P("saved"))},[u]),W=(0,r.useCallback)(async()=>{await fetch("/api/lesson/close",{method:"POST",headers:(0,h.dh)((0,h.fk)())}).catch(()=>{}),P("closed")},[]),J=(0,r.useCallback)((e,t)=>{b(n=>[...n,{id:`nq-${Date.now()}-${Math.floor(1e6*Math.random())}`,nodeId:e,question:t}])},[]),G=(0,r.useCallback)(e=>{let t=e.replace(/^[^:]+:\s*/,"").trim(),n=u?.nodes.find(e=>e.title===t);n&&j(n.id)},[u]),Z=(0,r.useMemo)(()=>(u?.questions??[]).filter(e=>"text"===e.anchor.kind&&e.answer).map(e=>({excerpt:"text"===e.anchor.kind?e.anchor.excerpt:"",answer:e.answer??""})),[u]),ee=(0,r.useMemo)(()=>(u?.questions??[]).filter(e=>"overall"===e.anchor.kind),[u]),et=(0,r.useMemo)(()=>u?(0,q.I)(u):{nodes:[],edges:[],tableNodes:[]},[u]);if(H)return(0,s.jsx)($,{ended:H,savedId:D,onBrowse:()=>n.push("/learn?view=library")});if(!u)return(0,s.jsx)(L,{});let en=k?u.nodes.find(e=>e.id===k)?.title??"":"";return(0,s.jsx)(p.Ue,{files:t,children:(0,s.jsxs)("div",{className:"relative flex h-screen flex-col",children:[O&&(0,s.jsx)(M,{onDismiss:()=>F(!1)}),(0,s.jsx)("div",{className:"pointer-events-none fixed right-3 top-3 z-30 flex items-center gap-2",children:(0,s.jsxs)("div",{className:"glass pointer-events-auto flex h-10 items-center gap-0.5 rounded-full px-1",children:[(0,s.jsx)("button",{onClick:()=>n.push("/learn?view=library"),title:"Saved lessons",className:"flex size-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:(0,s.jsx)(o.A,{className:"size-3.5"})}),(0,s.jsx)("span",{"aria-hidden":!0,className:"mx-1 h-5 w-px bg-border"}),(0,s.jsxs)("button",{onClick:()=>C(e=>!e),title:"Ask an overall question",className:(0,f.cn)("relative flex size-8 items-center justify-center rounded-full transition-colors",w?"bg-[var(--ink-active)] text-foreground":y.trim()?"text-[var(--accent-2,#ff7a45)]":"text-muted-foreground hover:bg-[var(--ink-hover)] hover:text-foreground"),children:[(0,s.jsx)(l.A,{className:"size-3.5"}),y.trim()&&(0,s.jsx)("span",{className:"absolute -right-0.5 -top-0.5 size-2 rounded-full bg-[var(--accent-2,#ff7a45)]"})]}),(0,s.jsx)("span",{"aria-hidden":!0,className:"mx-1 h-5 w-px bg-border"}),(0,s.jsxs)("button",{onClick:()=>void Y(),disabled:E||0===B,title:0===B?"Highlight text or a node to ask, then send":"Send your questions to the agent",className:(0,f.cn)("flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-semibold transition-colors",0===B?"text-muted-foreground opacity-50":"text-[var(--accent-2,#ff7a45)] hover:bg-[var(--accent-2,#ff7a45)]/15"),children:[(0,s.jsx)(i.A,{className:"size-3"})," Send",B>0?` (${B})`:""]}),(0,s.jsxs)("button",{onClick:()=>void X(),title:"Save this lesson to your library",className:"flex items-center gap-1 rounded-full border border-emerald-500/40 bg-emerald-500/15 px-2.5 py-1 text-[11px] font-semibold text-emerald-300 transition-colors hover:bg-emerald-500/25",children:[(0,s.jsx)(d,{className:"size-3"})," Save"]}),(0,s.jsxs)("button",{onClick:()=>void W(),title:"Close without saving",className:"flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-red-500/15 hover:text-red-300",children:[(0,s.jsx)(c.A,{className:"size-3"})," Close"]})]})}),w&&(0,s.jsx)(T,{label:"Overall question",placeholder:"A question about the whole topic…",value:y,onChange:N,onClose:()=>C(!1)}),k&&(0,s.jsx)(T,{label:`Ask about “${en}”`,placeholder:"Your question about this node…",value:"",submitLabel:"Add question",onSubmit:e=>{J(k,e),j(null)},onClose:()=>j(null)}),(0,s.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,s.jsxs)("div",{className:"relative flex min-w-0 flex-1 flex-col bg-background",style:{width:"50%"},children:[(0,s.jsx)("div",{className:"min-h-0 flex-1",children:(0,s.jsx)(A,{narrative:u.narrative,round:K,answered:Z,onApi:g})}),ee.length>0&&(0,s.jsx)(R,{questions:ee})]}),(0,s.jsx)("div",{className:"w-px shrink-0 bg-border"}),(0,s.jsx)("div",{className:"relative min-w-0 flex-1 bg-background",style:{width:"50%"},children:(0,s.jsx)(I.MapClient,{view:"ARCHITECTURE",nodes:et.nodes,edges:et.edges,tableNodes:et.tableNodes,embedded:!0,readOnly:!0,minimap:!0,staticEdgeLabels:!0,hasFrontend:!1,onAskAgent:G})})]})]})})}function T({label:e,placeholder:t,value:n,submitLabel:a,onChange:o,onSubmit:l,onClose:i}){let[d,u]=(0,r.useState)(n),x=o?n:d;return(0,s.jsxs)("div",{className:"fixed right-3 top-16 z-30 w-80 rounded-xl border border-border bg-card p-3 shadow-xl",children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground [overflow-wrap:anywhere]",children:e}),(0,s.jsx)("button",{onClick:i,title:"Close",className:"rounded p-0.5 text-muted-foreground hover:text-foreground",children:(0,s.jsx)(c.A,{className:"size-3.5"})})]}),(0,s.jsx)("textarea",{autoFocus:!0,value:x,onChange:e=>{let t;return t=e.target.value,o?o(t):u(t)},onKeyDown:e=>{l&&"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),x.trim()&&l(x.trim()))},placeholder:t,rows:3,className:"w-full resize-y rounded border border-border bg-background px-2 py-1.5 text-[12px] leading-snug outline-none focus:border-[var(--accent-2,#ff7a45)]/40"}),l&&(0,s.jsx)("button",{onClick:()=>x.trim()&&l(x.trim()),disabled:!x.trim(),className:"mt-1.5 w-full rounded-md bg-[var(--accent-2,#ff7a45)]/15 px-2 py-1 text-[11px] font-semibold text-[var(--accent-2,#ff7a45)] transition-colors hover:bg-[var(--accent-2,#ff7a45)]/25 disabled:opacity-40",children:a??"Add"})]})}function R({questions:e}){return(0,s.jsxs)("div",{className:"max-h-44 shrink-0 space-y-1.5 overflow-y-auto border-t border-border bg-background/60 px-5 py-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[(0,s.jsx)(l.A,{className:"size-3"}),"Overall Q&A"]}),e.map(e=>(0,s.jsxs)("div",{className:"rounded-md border border-border bg-background/40 p-2",children:[(0,s.jsx)("div",{className:"text-[12px] font-medium text-foreground",children:e.question}),e.answer?(0,s.jsx)("div",{className:"mt-1 text-[12px] leading-relaxed text-foreground/85",children:(0,s.jsx)(p.pO,{markdown:e.answer,variant:"compact"})}):(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-1 text-[11px] text-muted-foreground/70",children:[(0,s.jsx)(u.A,{className:"size-3 animate-spin"})," waiting for the agent…"]})]},e.id))]})}function M({onDismiss:e}){return(0,s.jsxs)("div",{className:"absolute inset-0 z-40 flex flex-col items-center justify-center gap-4 bg-background/95 px-6 text-center backdrop-blur-sm",children:[(0,s.jsx)("div",{className:"flex size-12 items-center justify-center rounded-full bg-[var(--accent-2,#ff7a45)]/15",children:(0,s.jsx)(u.A,{className:"size-6 animate-spin text-[var(--accent-2,#ff7a45)]"})}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Questions sent"}),(0,s.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Your terminal session is answering. The updated lesson will appear here automatically — if the session finished its turn, nudge it in the terminal."})]}),(0,s.jsx)("button",{onClick:e,className:"rounded-full border border-border px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:"Keep reading meanwhile"})]})}function L(){return(0,s.jsxs)("div",{className:"flex h-screen flex-col items-center justify-center gap-3 px-6 text-center",children:[(0,s.jsx)(x.A,{className:"size-8 text-muted-foreground/60"}),(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"No lesson open"}),(0,s.jsxs)("p",{className:"max-w-md text-sm text-muted-foreground",children:["Ask your terminal session to ",(0,s.jsx)("em",{children:"explain"})," or ",(0,s.jsx)("em",{children:"teach"})," you part of the codebase — it opens an interactive lesson here. You highlight text to ask questions; it answers on the board."]})]})}function $({ended:e,savedId:t,onBrowse:n}){return(0,s.jsxs)("div",{className:"flex h-screen flex-col items-center justify-center gap-5 px-6 text-center",children:[(0,s.jsx)("div",{className:(0,f.cn)("flex size-12 items-center justify-center rounded-full","saved"===e?"bg-emerald-500/15":"bg-[var(--ink-active)]"),children:"saved"===e?(0,s.jsx)(m.A,{className:"size-6 text-emerald-300"}):(0,s.jsx)(c.A,{className:"size-6 text-muted-foreground"})}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"saved"===e?"Lesson saved":"Lesson closed"}),(0,s.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:"saved"===e?"It's in your library — reopen it anytime.":"Closed without saving."})]}),(0,s.jsxs)("button",{onClick:n,className:"rounded-full border border-border px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:[(0,s.jsx)(o.A,{className:"mr-1 inline size-3.5"})," ",t?"Browse the library":"Open the library"]})]})}},38096:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(30772).A)("library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]])},38464:(e,t,n)=>{"use strict";n.d(t,{LessonLibraryView:()=>f});var s=n(95155),r=n(12115),a=n(73321),o=n(38096),l=n(40557),i=n(31966),d=n(60292),c=n(51909),u=n(23748),x=n(36925);function m(e){let t=new URLSearchParams,n=(0,d.fk)();for(let[s,r]of(n&&t.set("ws",n),Object.entries(e)))t.set(s,r);return`/learn?${t.toString()}`}function f({lessons:e,selected:t,repoFiles:n=[]}){return t?(0,s.jsx)(p,{lesson:t,repoFiles:n}):(0,s.jsx)(h,{lessons:e})}function h({lessons:e}){let t=(0,a.useRouter)();return(0,s.jsxs)("div",{className:"mx-auto flex h-screen w-full max-w-3xl flex-col px-6 pt-20",children:[(0,s.jsxs)("div",{className:"mb-5 flex items-center justify-between",children:[(0,s.jsxs)("h1",{className:"flex items-center gap-2 text-lg font-semibold text-foreground",children:[(0,s.jsx)(o.A,{className:"size-5 text-[var(--accent-2,#ff7a45)]"})," Lessons"]}),(0,s.jsx)("button",{onClick:()=>t.push(m({})),className:"rounded-full border border-border px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:"Back to current lesson"})]}),0===e.length?(0,s.jsxs)("div",{className:"rounded-lg border border-dashed border-border px-4 py-12 text-center text-sm text-muted-foreground",children:["No saved lessons yet. Ask your terminal session to explain something, then click ",(0,s.jsx)("b",{children:"Save"}),"."]}):(0,s.jsx)("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto pb-6",children:e.map(e=>(0,s.jsxs)("button",{onClick:()=>t.push(m({view:"library",id:e.id})),className:"block w-full rounded-lg border border-border bg-white/[0.02] p-3 text-left transition-colors hover:border-border hover:bg-[var(--ink-hover)]",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-[14px] font-semibold text-foreground",children:[(0,s.jsx)(l.A,{className:"size-4 text-[var(--accent-2,#ff7a45)]"})," ",e.title]}),e.topic&&e.topic!==e.title&&(0,s.jsx)("div",{className:"mt-0.5 truncate text-[12px] text-muted-foreground",children:e.topic}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-muted-foreground/70",children:[e.nodeCount," node",1===e.nodeCount?"":"s"," \xb7 ",e.questionCount," question",1===e.questionCount?"":"s"," \xb7 saved ",new Date(e.updatedAt).toLocaleDateString()]})]},e.id))})]})}function p({lesson:e,repoFiles:t}){let n=(0,a.useRouter)(),o=(0,r.useMemo)(()=>new Map(e.nodes.map(e=>[e.id,e.title])),[e.nodes]),l=(0,r.useMemo)(()=>(0,x.I)(e),[e]);return(0,s.jsx)(c.Ue,{files:t,children:(0,s.jsxs)("div",{className:"relative flex h-screen flex-col",children:[(0,s.jsx)("div",{className:"pointer-events-none fixed right-3 top-3 z-30",children:(0,s.jsxs)("button",{onClick:()=>n.push(m({view:"library"})),className:"glass pointer-events-auto flex h-10 items-center gap-1.5 rounded-full px-3 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:[(0,s.jsx)(i.A,{className:"size-3.5"})," Library"]})}),(0,s.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto bg-background px-5 pb-6 pt-16",style:{width:"50%"},children:[(0,s.jsx)(c.pO,{markdown:e.narrative,variant:"reading"}),e.questions.length>0&&(0,s.jsxs)("div",{className:"mx-auto mt-6 w-full max-w-[66ch] space-y-2",children:[(0,s.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Q&A"}),e.questions.map(e=>(0,s.jsx)(g,{q:e,nodeTitle:"node"===e.anchor.kind?o.get(e.anchor.nodeId):void 0},e.id))]})]}),(0,s.jsx)("div",{className:"w-px shrink-0 bg-border"}),(0,s.jsx)("div",{className:"min-w-0 flex-1 bg-background",style:{width:"50%"},children:(0,s.jsx)(u.MapClient,{view:"ARCHITECTURE",nodes:l.nodes,edges:l.edges,tableNodes:l.tableNodes,embedded:!0,readOnly:!0,minimap:!0,staticEdgeLabels:!0,hasFrontend:!1})})]})]})})}function g({q:e,nodeTitle:t}){let n="overall"===e.anchor.kind?"Overall":"node"===e.anchor.kind?t??"Node":`“${e.anchor.excerpt.slice(0,48)}…”`;return(0,s.jsxs)("div",{className:"rounded-md border border-border bg-background/40 p-2",children:[(0,s.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/80",children:n}),(0,s.jsx)("div",{className:"mt-0.5 text-[12px] font-medium text-foreground",children:e.question}),e.answer&&(0,s.jsx)("div",{className:"mt-1 text-[12px] leading-relaxed text-foreground/85",children:(0,s.jsx)(c.pO,{markdown:e.answer,variant:"compact"})})]})}},40557:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});let s=(0,n(30772).A)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},73206:(e,t,n)=>{Promise.resolve().then(n.bind(n,37665)),Promise.resolve().then(n.bind(n,38464))}},e=>{e.O(0,[2574,3862,5004,277,8500,4888,2114,1569,5547,8710,6283,6818,3748,1909,8441,3794,7358],()=>e(e.s=73206)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5823],{27950:(e,t,o)=>{Promise.resolve().then(o.bind(o,44853)),Promise.resolve().then(o.bind(o,62079)),Promise.resolve().then(o.bind(o,67437)),Promise.resolve().then(o.bind(o,77260))},62079:(e,t,o)=>{"use strict";o.d(t,{FilesMapClient:()=>V});var s=o(95155),n=o(12115),r=o(80277),l=o(81750),a=o(6266),i=o(7679),d=o(98766),c=o(15629),u=o(79176),p=o(2982),h=o(64385);o(53255);var f=o(17356),m=o(24413),x=o(18986),g=o(9005),b=o(25583),y=o(82099),j=o(62311),k=o(9991),w=o(47409),v=o(91157),N=o(56895),M=o(16607),S=o(14983);let C=/(^|\/)tests?\/|\.(test|spec)\.[jt]sx?$/i;var A=o(44267),$=o(70947),z=o(98238),E=o(56614),D=o(28161);let I=/\.(py|go|rb|rs|java|php|ex|exs)$/i,R=/(^|\/)(app\/api|pages\/api|migrations|bin)\/|(^|\/)instrumentation\.[^/]+$/,O=e=>e.includes("/")?e.slice(0,e.indexOf("/")):"(root)";function T(e){let t=Math.max(14,.35*e.length),o=new Map;for(let t of e)o.set(t,O(t));for(let e=0;e<6;e++){let e=new Map;for(let t of o.values())e.set(t,(e.get(t)??0)+1);let s=!1;for(let[n,r]of o){if((e.get(r)??0)<=t||!n.startsWith(`${r}/`))continue;let l=n.slice(r.length+1);l.includes("/")&&(o.set(n,`${r}/${l.slice(0,l.indexOf("/"))}`),s=!0)}if(!s)break}return o}var P=o(29523),Z=o(70221),F=o(12410),L=o(91337),_=o(2060);function W(e){return 5+.5*Math.min(e,26)}let B={file:(0,n.memo)(function({data:e}){let t=(0,P.k)(Z.kz),o=!!e.touched,n=e.recency??0,r=e.inDegree??0,i=W(r),d=e.layer??null,c=2*!!d,u=r>0?` \xb7 imported by ${r}`:"",p=d?` \xb7 ${"fullstack"===d?"shared (used by frontend + backend)":D.YG[d].label.toLowerCase()}`:"",h=o?`${e.tooltip} \xb7 edited ${e.count??0}\xd7 this session${u}${p}`:e.untested?`${e.tooltip} \xb7 no test imports this file${u}${p}`:`${e.tooltip}${u}${p}`;return(0,s.jsxs)("div",{title:h,className:"relative flex flex-col items-center",children:[(0,s.jsx)(l.h7,{type:"target",position:a.yX.Top,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent",style:{top:i+c,left:"50%"}}),(0,s.jsx)("span",{"aria-hidden":!0,className:(0,L.cn)("rounded-full",e.isNewest&&"animate-touch-pulse"),style:{padding:c,background:d?(0,D.A6)(d):void 0,boxShadow:o?`0 0 ${8+Math.round(14*n)}px ${2+Math.round(3*n)}px rgba(45,212,191,${(.35+.45*n).toFixed(2)})`:e.untested?"0 0 0 2px rgba(251,191,36,0.65)":"none"},children:(0,s.jsx)("span",{"aria-hidden":!0,className:"block rounded-full",style:{width:2*i,height:2*i,backgroundColor:e.dirColor}})}),o&&(e.count??0)>0&&(0,s.jsx)("span",{"aria-hidden":!0,className:"absolute -right-2 -top-2 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-teal-400 px-0.5 text-[8px] font-bold text-background ring-1 ring-background",children:e.count}),("full"===t||"mid"===t&&r>=4)&&(0,s.jsx)("span",{className:(0,L.cn)("pointer-events-none mt-1 max-w-44 truncate text-[10px] leading-tight",o?"font-semibold text-teal-100":"text-foreground/75"),children:e.label}),(0,s.jsx)(l.h7,{type:"source",position:a.yX.Bottom,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent",style:{top:i+c,bottom:"auto",left:"50%"}})]})})};function U({regions:e,dominant:t}){return(0,s.jsx)(l.DX,{children:e.map(e=>{let o=t.get(e.key);return o&&"fullstack"!==o?(0,s.jsx)("div",{style:{position:"absolute",transform:`translate(${e.x-.15*e.w}px, ${e.y-.15*e.h}px)`,width:1.3*e.w,height:1.3*e.h,pointerEvents:"none",zIndex:0,background:`radial-gradient(closest-side, ${D.ZD[o]} 0%, transparent 72%)`,opacity:.1}},e.key):null})})}function V({files:e,edges:t,touched:o,hasFrontend:a=!1,classificationRoots:O=[]}){let G,X=(0,n.useMemo)(()=>(function(e,t){let o=function(e){if(!e?.length)return[];let t=new Set;for(let o of e){let e=o.trim().replace(/^\/+|\/+$/g,"");e&&t.add(e)}return[...t]}(t);if(!o.length)return T(e);let s=new Map,n=[];for(let t of e){let e=function(e,t){let o=null;for(let s of t)(e===s||e.startsWith(`${s}/`))&&(!o||s.length>o.length)&&(o=s);return o}(t,o);e?s.set(t,function(e,t){if(e===t||!e.startsWith(`${t}/`))return t;let o=e.slice(t.length+1);return o.includes("/")?`${t}/${o.slice(0,o.indexOf("/"))}`:t}(t,e)):n.push(t)}for(let[e,t]of T(n))s.set(e,t);return s})(e.map(e=>e.path),O),[e,O]),q=(0,n.useMemo)(()=>(function(e,t,o){let s=function(e){let t=new Map;for(let o of e.values())t.set(o,(t.get(o)??0)+1);let o=Array.from(t.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])),s=Math.max(1,Math.ceil(Math.sqrt(2.5*o.length))),n=new Map;return o.forEach(([e],t)=>{n.set(e,{x:t%s*1250,y:950*Math.floor(t/s)})}),n}(o),n=e=>s.get(o.get(e)??"(root)"),r=e.map(e=>{let t=function(e){let t=0x811c9dc5;for(let o=0;o<e.length;o++)t=(t^e.charCodeAt(o))*0x1000193>>>0;return{x:(t%10007/10007-.5)*900,y:((t>>>13)%10007/10007-.5)*900}}(e.path),o=n(e.path);return{id:e.path,x:o.x+.5*t.x,y:o.y+.5*t.y,pinned:!1,radius:W(e.inDegree??0)+22}}),l=t.filter(e=>e.from!==e.to).map(e=>({source:e.from,target:e.to})),a=(0,i.A)(r).force("link",(0,d.A)(l).id(e=>e.id).distance(100).strength(e=>{let t="object"==typeof e.source?e.source.id:String(e.source),s="object"==typeof e.target?e.target.id:String(e.target);return o.get(t)===o.get(s)?.5:.02})).force("charge",(0,c.A)().strength(-260).distanceMax(800)).force("collide",(0,u.A)().radius(e=>e.radius).strength(.6)).force("clusterX",(0,p.A)(e=>n(e.id).x).strength(.1)).force("clusterY",(0,h.A)(e=>n(e.id).y).strength(.115)).stop();for(let e=0;e<500;e++)a.tick();let f=new Map;for(let e of r)f.set(e.id,{x:e.x??0,y:e.y??0});return f})(e,t,X),[e,t,X]),J=(0,n.useMemo)(()=>(function(e,t){var o;let s=new Set;for(let e of t)o=e.from,C.test(o)&&s.add(e.to);let n=new Set;for(let t of e)C.test(t)||s.has(t)||n.add(t);return n})(e.map(e=>e.path),t),[e,t]),K=(0,n.useMemo)(()=>a?function(e,t){let o=new Map,s=new Map;for(let e of t){let t=s.get(e.from);t?t.push(e.to):s.set(e.from,[e.to])}let n=new Map;for(let t of e){let e=R.test(t)?"backend":D.An.test(t)?"frontend":I.test(t)?"backend":null;o.set(t,e),e&&n.set(t,e)}let r=e=>{let t=new Set,o=[];for(let[t,s]of n)s===e&&o.push(t);for(;o.length;){let e=o.pop();for(let n of s.get(e)??[])t.has(n)||(t.add(n),o.push(n))}return t},l=r("frontend"),a=r("backend");for(let t of e){if(o.get(t))continue;let e=l.has(t),s=a.has(t);e&&s?o.set(t,"fullstack"):e?o.set(t,"frontend"):s&&o.set(t,"backend")}return o}(e.map(e=>e.path),t):null,[a,e,t]),Q=(0,n.useMemo)(()=>{let e=new Map,t=Object.entries(o??{});if(!t.length)return e;let s=t.map(([,e])=>e.lastAt),n=Math.max(...s),r=Math.min(...s),l=n-r||1,a=t[0][0],i=t[0][1].lastAt;for(let[e,o]of t)o.lastAt>=i&&(a=e,i=o.lastAt);for(let[o,s]of t)e.set(o,{count:s.count,recency:(s.lastAt-r)/l,isNewest:o===a});return e},[o]),Y=Q.size>0,ee=(0,n.useMemo)(()=>Array.from(Q.entries()).map(([e,t])=>({path:e,count:t.count})),[Q]),et=(0,n.useMemo)(()=>e.map(e=>{let t=q.get(e.path)??{x:e.x,y:e.y},o=e.path.lastIndexOf("/"),s=o>=0?e.path.slice(o+1):e.path,n=Q.get(e.path);return{id:e.path,type:"file",position:t,data:{label:s,tooltip:e.path,untested:J.has(e.path),inDegree:e.inDegree??0,dirColor:(0,F.i3)(X.get(e.path)??"(root)"),layer:K?.get(e.path)??null,touched:!!n,count:n?.count??0,recency:n?.recency??0,isNewest:n?.isNewest??!1}}}),[e,q,J,Q,K,X]),eo=(0,n.useMemo)(()=>t.map(e=>({id:`${e.from}|${e.to}`,source:e.from,target:e.to,type:"straight",selectable:!1,focusable:!1,style:{pointerEvents:"none",...e.circular?{stroke:"#f87171",strokeDasharray:"5 3",strokeWidth:1.5,opacity:.6}:{stroke:"#8b8b94",strokeWidth:1,opacity:.3}}})),[t]),[es,en]=(0,n.useState)(et),[er,el]=(0,n.useState)(eo),[ea,ei]=(0,n.useState)(null),[ed,ec]=(0,n.useState)(null),[eu,ep]=(0,n.useState)(null),[eh,ef]=(0,n.useState)(!1),em=(0,_.G)(),[ex,eg]=(0,n.useState)(!1),[eb,ey]=(0,n.useState)(null),[ej,ek]=(0,n.useState)(!1),[ew,ev]=(0,n.useState)(""),[eN,eM]=(0,n.useState)(!1),[eS,eC]=(0,n.useState)("full"),eA=(0,n.useRef)(null),{tool:e$,setTool:ez,flowProps:eE}=(0,r.e)(),eD=(0,n.useCallback)(e=>{ei(e),ep(null);let t=eA.current?.getNode(e);t&&eA.current&&eA.current.setCenter(t.position.x+40,t.position.y+12,{zoom:1.4,duration:600})},[]),eI=(0,n.useCallback)(()=>{ei(null),ep(null);let e=!ex;if(eg(e),ek(e),e&&eA.current){let e=Array.from(Q.keys()).map(e=>({id:e}));e.length&&eA.current.fitView({nodes:e,duration:600,padding:.4})}},[ex,Q]),eR=(0,n.useMemo)(()=>(0,v.b)(e,t,X),[e,t,X]),eO=(0,n.useCallback)(e=>{eA.current&&(e.focusIds.length?eA.current.fitView({nodes:e.focusIds.map(e=>({id:e})),duration:700,padding:.3,maxZoom:1.1}):eA.current.fitView({duration:700,padding:.1}))},[]),eT=(0,N.W)(eR,eO);(0,n.useEffect)(()=>eM(!0),[]),(0,n.useEffect)(()=>en(et),[et]),(0,n.useEffect)(()=>el(eo),[eo]);let eP=(0,n.useCallback)(e=>en(t=>(0,l._0)(e,t)),[]),eZ=(0,n.useCallback)(e=>el(t=>(0,l.zW)(e,t)),[]),eF=(0,n.useCallback)((e,t,o)=>{fetch("/api/code-graph/position",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,x:t,y:o})})},[]),eL=(0,n.useMemo)(()=>new Set(t.filter(e=>e.circular).map(e=>`${e.from}|${e.to}`)),[t]),e_=(0,n.useMemo)(()=>{let e=new Set;for(let o of t)o.circular&&(e.add(o.from),e.add(o.to));return e},[t]),eW=ea??ed,eB=ew.trim().length>0,eU=(0,n.useMemo)(()=>{if(!eB)return null;let t=new Set;for(let o of e)(0,S.Qk)((0,S.zn)(o),ew)&&t.add(o.path);return t},[e,ew,eB]),eV=(0,n.useMemo)(()=>eB?(0,S.r2)(e,ew,e=>(0,S.zn)(e),e=>({id:e.path,label:e.path,sublabel:e.lang??void 0,kind:"file"})):[],[e,ew,eB]),eH=(0,n.useMemo)(()=>{if(eu){let e=er.find(e=>e.id===eu);return e?new Set([e.source,e.target]):null}if(eW){let e=new Set([eW]);for(let o of t)o.from===eW&&e.add(o.to),o.to===eW&&e.add(o.from);return e}return eh?e_:ex&&Y?new Set(Q.keys()):null},[eW,eu,eh,e_,t,er,ex,Y,Q]),eG=eT.focusIds,eX=eG??eU??eH,eq=eU??eG,eJ=(0,n.useMemo)(()=>{if(!eb||!K)return null;let t=new Set;for(let o of e)(0,z.F)(eb,K.get(o.path)??null)||t.add(o.path);return t},[eb,K,e]),eK=(0,n.useMemo)(()=>eX?es.map(e=>{let t=eX.has(e.id);return{...e,zIndex:t&&eq?10:e.zIndex,style:{...e.style,opacity:t?1:.15,boxShadow:t&&eq?S.RU:e.style?.boxShadow,borderRadius:t&&eq?9999:e.style?.borderRadius,transition:"opacity 120ms, box-shadow 120ms"}}}):eJ?es.map(e=>eJ.has(e.id)?{...e,style:{...e.style,opacity:.15,transition:"opacity 120ms"}}:e):es,[es,eX,eq,eJ]),eQ=(0,n.useMemo)(()=>eG?er.map(e=>eG.has(e.source)&&eG.has(e.target)?{...e,style:{...e.style,stroke:"#e4e4e7",opacity:.9,strokeWidth:1.4}}:{...e,style:{...e.style,opacity:.05}}):eU?er.map(e=>eU.has(e.source)&&eU.has(e.target)?{...e,style:{...e.style,stroke:"#e4e4e7",opacity:.95,strokeWidth:1.6}}:{...e,style:{...e.style,opacity:.05}}):eW||eu||eh||ex?er.map(e=>{let t=!1;return eu?t=e.id===eu:eW?t=e.source===eW||e.target===eW:eh?t=eL.has(e.id):ex&&(t=Q.has(e.source)&&Q.has(e.target)),t?{...e,style:{...e.style,stroke:"#e4e4e7",opacity:.95,strokeWidth:1.6}}:{...e,style:{...e.style,opacity:.05}}}):eJ?er.map(e=>eJ.has(e.source)||eJ.has(e.target)?{...e,style:{...e.style,opacity:.05}}:e):er,[er,eW,eu,eh,eL,ex,Q,eU,eJ,eG]),eY=(0,n.useMemo)(()=>{let e=es.map(e=>{let t=W(e.data.inDegree??0);return{id:e.id,group:X.get(e.id)??"(root)",x:e.position.x,y:e.position.y,w:2*t,h:2*t}});return(0,A.S)(e,{pad:60})},[es,X]),e0=(0,n.useMemo)(()=>{let t=new Map;if(!K)return t;let o=new Map;for(let t of e){let e=K.get(t.path);if(!e)continue;let s=X.get(t.path)??"(root)",n=o.get(s)??new Map;n.set(e,(n.get(e)??0)+1),o.set(s,n)}for(let[e,s]of o){let o=null,n=0,r=!1;for(let[e,t]of s)t>n?(o=e,n=t,r=!1):t===n&&(r=!0);t.set(e,r?null:o)}return t},[K,e,X]),e1=(0,n.useMemo)(()=>{let e=new Map;for(let t of X.values())e.set(t,(e.get(t)??0)+1);return Array.from(e.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>({group:e,count:t,color:(0,F.i3)(e)}))},[X]),e5=t.filter(e=>e.circular).length,e2=(0,n.useMemo)(()=>ea?t.filter(e=>e.from===ea).map(e=>e.to):[],[ea,t]),e4=(0,n.useMemo)(()=>ea?t.filter(e=>e.to===ea).map(e=>e.from):[],[ea,t]),e7=null!==ea||ej&&Y,e3=(0,n.useCallback)(()=>{ei(null),ek(!1),eg(!1)},[]);return eN?(0,s.jsxs)("div",{className:"canvas-dots relative h-screen w-full",children:[(0,s.jsxs)(l.Gc,{...eE,nodes:eK,edges:eQ,nodeTypes:B,onNodesChange:eP,onEdgesChange:eZ,onNodeClick:(e,t)=>{ei(t.id),ep(null)},onEdgeClick:(e,t)=>{ep(t.id),ei(null)},onPaneClick:()=>{ei(null),ep(null)},onNodeMouseEnter:(e,t)=>ec(t.id),onNodeMouseLeave:()=>ec(null),onInit:e=>{eA.current=e},onNodeDragStop:(e,t)=>eF(t.id,t.position.x,t.position.y),deleteKeyCode:null,colorMode:em,fitView:!0,fitViewOptions:{padding:.1,minZoom:.18,maxZoom:.9},minZoom:.05,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,s.jsx)($.Z,{regions:"far"===eS?eY:[],tone:"category",lod:eS}),a&&(0,s.jsx)(U,{regions:"far"===eS?[]:eY,dominant:e0}),(0,s.jsx)(P.J,{onLod:eC,thresholds:Z.kz}),(0,s.jsx)(l.H2,{position:"bottom-right",className:"!overflow-hidden !rounded-xl !border !border-border [&_button]:!border-border [&_button]:!bg-card/70 [&_button]:!text-foreground [&_button]:!backdrop-blur"}),(0,s.jsx)(l.Zk,{position:"bottom-left",style:{marginBottom:118},children:(0,s.jsx)(r.H,{tool:e$,onChange:ez})}),(0,s.jsx)(l.Zk,{position:"bottom-right",style:{marginBottom:152},children:(0,s.jsx)(E.er,{title:"Legend",trigger:(e,t)=>(0,s.jsx)("button",{type:"button",onClick:t,title:"Legend",className:(0,L.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,s.jsx)(f.A,{className:"size-4"})}),children:(0,s.jsxs)("ul",{className:"space-y-1.5 text-[10.5px] text-muted-foreground",children:[(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block size-2.5 shrink-0 rounded-full bg-zinc-400"}),(0,s.jsx)("span",{children:"a file \xb7 bigger dot = more files import it"})]}),a&&(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block size-2.5 shrink-0 rounded-full",style:{boxShadow:`inset 0 0 0 2px ${D.ZD.frontend}`}}),(0,s.jsx)("span",{children:"colored ring \xb7 frontend / backend layer"})]}),(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-[#4a4a52]"}),(0,s.jsx)("span",{children:"line \xb7 imports another file"})]}),(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-red-400"}),(0,s.jsx)("span",{children:"red \xb7 part of an import cycle"})]}),(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{"aria-hidden":!0,className:"inline-flex shrink-0 gap-0.5",children:[(0,s.jsx)("span",{className:"inline-block size-2 rounded-full bg-violet-400"}),(0,s.jsx)("span",{className:"inline-block size-2 rounded-full bg-amber-400"})]}),(0,s.jsx)("span",{children:"dot color \xb7 its directory (chips, top-right)"})]})]})})}),(0,s.jsx)(l.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!overflow-hidden !rounded-xl !border !border-border !bg-card/50 !backdrop-blur",nodeColor:()=>"#555"}),eR.length>0&&!eT.active&&(0,s.jsx)(l.Zk,{position:"top-left",className:"!mt-14",children:(0,s.jsxs)("button",{type:"button",onClick:eT.start,title:"Guided, dependency-ordered walkthrough of the codebase",className:"glass flex items-center gap-1.5 rounded-xl px-3 py-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[(0,s.jsx)(m.A,{className:"size-3.5"}),"Start tour"]})}),(0,s.jsx)(l.Zk,{position:"top-right",className:(0,L.cn)("glass rounded-full px-1 py-0.5 transition-[margin] duration-200",e7&&"!mr-[300px]"),children:(0,s.jsx)(j.Z,{active:"FILES",tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"},{value:"FILES",label:"Files",href:"/map?view=FILES"}]})}),(0,s.jsx)(l.Zk,{position:"top-right",className:(0,L.cn)("glass !mt-24 flex max-w-[300px] flex-wrap items-center justify-end gap-x-2.5 gap-y-1 rounded-xl px-3 py-1.5 transition-[margin] duration-200",e7&&"!mr-[300px]"),children:e1.map(t=>(0,s.jsxs)("button",{type:"button",onClick:()=>{let o=e.filter(e=>(X.get(e.path)??"(root)")===t.group).map(e=>({id:e.path}));o.length&&eA.current?.fitView({nodes:o,duration:600,padding:.3,maxZoom:1})},title:`${t.count} files — click to zoom to ${t.group}`,className:"flex items-center gap-1.5 rounded px-1 py-0.5 text-[10px] text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"size-2 shrink-0 rounded-full",style:{backgroundColor:t.color}}),t.group]},t.group))}),(0,s.jsxs)(l.Zk,{position:"top-right",className:(0,L.cn)("!mt-14 flex items-center gap-2 transition-[margin] duration-200",e7&&"!mr-[300px]"),children:[(0,s.jsx)(k.X,{query:ew,onQuery:ev,hits:eV,placeholder:"Find a file…",onPick:e=>{ev(""),eD(e)},onZoomToMatches:()=>{eU?.size&&eA.current?.fitView({nodes:[...eU].map(e=>({id:e})),duration:600,padding:.3})}}),a&&(0,s.jsx)(z.o,{value:eb,onChange:ey,options:["frontend","backend"]}),(0,s.jsxs)("div",{className:"glass flex items-center gap-3 rounded-xl px-3 py-1.5 text-[11px]",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[e.length," files \xb7 ",t.length," imports"]}),e5>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>{ef(e=>!e),ei(null),ep(null)},title:eh?"Show all imports":"Show only files involved in import cycles",className:(0,L.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",eh?"bg-red-500/15 text-red-200 ring-1 ring-red-400/40":"text-red-300 hover:bg-red-500/10"),children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-5 border-t border-dashed",style:{borderColor:"#ef4444"}}),e5," circular"]}),Y&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("button",{type:"button",onClick:eI,title:ex?"Show all files again":"Focus + zoom to the files edited this session",className:(0,L.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",ex?"bg-teal-500/15 text-teal-200 ring-1 ring-teal-400/40":"text-teal-300 hover:bg-teal-500/10"),children:[(0,s.jsx)(x.A,{className:"size-3"}),Q.size," edited"]})})]})]})]}),e7&&(0,s.jsxs)(y.b,{className:"absolute bottom-3 right-3 top-16 z-10 flex w-72 flex-col rounded-2xl",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-3.5 py-2.5",children:[(0,s.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:ea?"File":"Edited this session"}),(0,s.jsx)("button",{onClick:e3,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:(0,s.jsx)(g.A,{className:"size-4"})})]}),(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:ea?(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,s.jsx)(b.A,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,s.jsx)("h2",{className:"break-all text-sm font-semibold leading-tight",children:ea.slice(ea.lastIndexOf("/")+1)})]}),(0,s.jsx)("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:ea})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(G=Q.get(ea))?(0,s.jsxs)("span",{className:"rounded bg-teal-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-teal-300",children:["edited ",G.count,"\xd7"]}):null,J.has(ea)&&(0,s.jsx)("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-amber-300",children:"untested"})]}),(0,s.jsx)("button",{onClick:()=>fetch(`/api/open?path=${encodeURIComponent(ea)}`).catch(()=>{}),className:"w-full rounded-md border border-border px-2 py-1.5 text-[11px] text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:"Open in editor"}),(0,s.jsx)(H,{label:"Imports",paths:e2,onPick:eD}),(0,s.jsx)(H,{label:"Imported by",paths:e4,onPick:eD})]}):(0,s.jsx)(w.h,{files:ee.map(e=>({path:e.path,meta:`${e.count}\xd7`})),emptyLabel:"No files edited this session yet."})})]}),eT.active&&eT.step&&(0,s.jsx)(M.d,{steps:eR,index:eT.index,onPrev:eT.prev,onNext:eT.next,onExit:eT.stop,onGoto:eT.goto})]}):(0,s.jsx)("div",{className:"flex h-screen w-full items-center justify-center text-sm text-muted-foreground",children:"Loading graph…"})}function H({label:e,paths:t,onPick:o}){return t.length?(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[e," (",t.length,")"]}),(0,s.jsx)(w.h,{files:t.map(e=>({path:e})),onSelect:o})]}):null}},77260:(e,t,o)=>{"use strict";o.d(t,{MapTabsShell:()=>a});var s=o(95155),n=o(12115),r=o(75514);let l=["ROADMAP","ARCHITECTURE","DATABASE"];function a({initialView:e,roadmap:t,architecture:o,database:i}){let[d,c]=(0,n.useState)(e),[u,p]=(0,n.useState)(()=>new Set([e])),h=(0,n.useCallback)(e=>{c(e),p(t=>t.has(e)?t:new Set(t).add(e));try{let t=new URL(window.location.href);t.searchParams.set("view",e),window.history.replaceState(window.history.state,"",t)}catch{}},[]),f={ROADMAP:t,ARCHITECTURE:o,DATABASE:i};return(0,s.jsx)(r.no.Provider,{value:{views:r.a4,switchTo:h},children:l.map(e=>u.has(e)?(0,s.jsx)("div",{className:d===e?"contents":"hidden",children:f[e]},e):null)})}}},e=>{e.O(0,[2574,3862,5004,277,8500,4888,2114,1569,5547,8710,6283,4752,6818,7437,4853,8441,3794,7358],()=>e(e.s=27950)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5823],{27950:(e,t,o)=>{Promise.resolve().then(o.bind(o,44853)),Promise.resolve().then(o.bind(o,62079)),Promise.resolve().then(o.bind(o,23748)),Promise.resolve().then(o.bind(o,77260))},62079:(e,t,o)=>{"use strict";o.d(t,{FilesMapClient:()=>V});var s=o(95155),n=o(12115),r=o(80277),l=o(81750),a=o(6266),i=o(7679),d=o(98766),c=o(15629),u=o(79176),p=o(2982),h=o(64385);o(53255);var f=o(17356),m=o(24413),x=o(18986),g=o(9005),b=o(25583),y=o(82099),j=o(62311),k=o(9991),w=o(47409),v=o(91157),N=o(56895),M=o(16607),S=o(14983);let C=/(^|\/)tests?\/|\.(test|spec)\.[jt]sx?$/i;var A=o(44267),$=o(70947),z=o(98238),E=o(56614),D=o(28161);let I=/\.(py|go|rb|rs|java|php|ex|exs)$/i,R=/(^|\/)(app\/api|pages\/api|migrations|bin)\/|(^|\/)instrumentation\.[^/]+$/,O=e=>e.includes("/")?e.slice(0,e.indexOf("/")):"(root)";function T(e){let t=Math.max(14,.35*e.length),o=new Map;for(let t of e)o.set(t,O(t));for(let e=0;e<6;e++){let e=new Map;for(let t of o.values())e.set(t,(e.get(t)??0)+1);let s=!1;for(let[n,r]of o){if((e.get(r)??0)<=t||!n.startsWith(`${r}/`))continue;let l=n.slice(r.length+1);l.includes("/")&&(o.set(n,`${r}/${l.slice(0,l.indexOf("/"))}`),s=!0)}if(!s)break}return o}var P=o(29523),Z=o(70221),F=o(12410),L=o(91337),_=o(2060);function W(e){return 5+.5*Math.min(e,26)}let B={file:(0,n.memo)(function({data:e}){let t=(0,P.k)(Z.kz),o=!!e.touched,n=e.recency??0,r=e.inDegree??0,i=W(r),d=e.layer??null,c=2*!!d,u=r>0?` \xb7 imported by ${r}`:"",p=d?` \xb7 ${"fullstack"===d?"shared (used by frontend + backend)":D.YG[d].label.toLowerCase()}`:"",h=o?`${e.tooltip} \xb7 edited ${e.count??0}\xd7 this session${u}${p}`:e.untested?`${e.tooltip} \xb7 no test imports this file${u}${p}`:`${e.tooltip}${u}${p}`;return(0,s.jsxs)("div",{title:h,className:"relative flex flex-col items-center",children:[(0,s.jsx)(l.h7,{type:"target",position:a.yX.Top,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent",style:{top:i+c,left:"50%"}}),(0,s.jsx)("span",{"aria-hidden":!0,className:(0,L.cn)("rounded-full",e.isNewest&&"animate-touch-pulse"),style:{padding:c,background:d?(0,D.A6)(d):void 0,boxShadow:o?`0 0 ${8+Math.round(14*n)}px ${2+Math.round(3*n)}px rgba(45,212,191,${(.35+.45*n).toFixed(2)})`:e.untested?"0 0 0 2px rgba(251,191,36,0.65)":"none"},children:(0,s.jsx)("span",{"aria-hidden":!0,className:"block rounded-full",style:{width:2*i,height:2*i,backgroundColor:e.dirColor}})}),o&&(e.count??0)>0&&(0,s.jsx)("span",{"aria-hidden":!0,className:"absolute -right-2 -top-2 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-teal-400 px-0.5 text-[8px] font-bold text-background ring-1 ring-background",children:e.count}),("full"===t||"mid"===t&&r>=4)&&(0,s.jsx)("span",{className:(0,L.cn)("pointer-events-none mt-1 max-w-44 truncate text-[10px] leading-tight",o?"font-semibold text-teal-100":"text-foreground/75"),children:e.label}),(0,s.jsx)(l.h7,{type:"source",position:a.yX.Bottom,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent",style:{top:i+c,bottom:"auto",left:"50%"}})]})})};function U({regions:e,dominant:t}){return(0,s.jsx)(l.DX,{children:e.map(e=>{let o=t.get(e.key);return o&&"fullstack"!==o?(0,s.jsx)("div",{style:{position:"absolute",transform:`translate(${e.x-.15*e.w}px, ${e.y-.15*e.h}px)`,width:1.3*e.w,height:1.3*e.h,pointerEvents:"none",zIndex:0,background:`radial-gradient(closest-side, ${D.ZD[o]} 0%, transparent 72%)`,opacity:.1}},e.key):null})})}function V({files:e,edges:t,touched:o,hasFrontend:a=!1,classificationRoots:O=[]}){let G,X=(0,n.useMemo)(()=>(function(e,t){let o=function(e){if(!e?.length)return[];let t=new Set;for(let o of e){let e=o.trim().replace(/^\/+|\/+$/g,"");e&&t.add(e)}return[...t]}(t);if(!o.length)return T(e);let s=new Map,n=[];for(let t of e){let e=function(e,t){let o=null;for(let s of t)(e===s||e.startsWith(`${s}/`))&&(!o||s.length>o.length)&&(o=s);return o}(t,o);e?s.set(t,function(e,t){if(e===t||!e.startsWith(`${t}/`))return t;let o=e.slice(t.length+1);return o.includes("/")?`${t}/${o.slice(0,o.indexOf("/"))}`:t}(t,e)):n.push(t)}for(let[e,t]of T(n))s.set(e,t);return s})(e.map(e=>e.path),O),[e,O]),q=(0,n.useMemo)(()=>(function(e,t,o){let s=function(e){let t=new Map;for(let o of e.values())t.set(o,(t.get(o)??0)+1);let o=Array.from(t.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])),s=Math.max(1,Math.ceil(Math.sqrt(2.5*o.length))),n=new Map;return o.forEach(([e],t)=>{n.set(e,{x:t%s*1250,y:950*Math.floor(t/s)})}),n}(o),n=e=>s.get(o.get(e)??"(root)"),r=e.map(e=>{let t=function(e){let t=0x811c9dc5;for(let o=0;o<e.length;o++)t=(t^e.charCodeAt(o))*0x1000193>>>0;return{x:(t%10007/10007-.5)*900,y:((t>>>13)%10007/10007-.5)*900}}(e.path),o=n(e.path);return{id:e.path,x:o.x+.5*t.x,y:o.y+.5*t.y,pinned:!1,radius:W(e.inDegree??0)+22}}),l=t.filter(e=>e.from!==e.to).map(e=>({source:e.from,target:e.to})),a=(0,i.A)(r).force("link",(0,d.A)(l).id(e=>e.id).distance(100).strength(e=>{let t="object"==typeof e.source?e.source.id:String(e.source),s="object"==typeof e.target?e.target.id:String(e.target);return o.get(t)===o.get(s)?.5:.02})).force("charge",(0,c.A)().strength(-260).distanceMax(800)).force("collide",(0,u.A)().radius(e=>e.radius).strength(.6)).force("clusterX",(0,p.A)(e=>n(e.id).x).strength(.1)).force("clusterY",(0,h.A)(e=>n(e.id).y).strength(.115)).stop();for(let e=0;e<500;e++)a.tick();let f=new Map;for(let e of r)f.set(e.id,{x:e.x??0,y:e.y??0});return f})(e,t,X),[e,t,X]),J=(0,n.useMemo)(()=>(function(e,t){var o;let s=new Set;for(let e of t)o=e.from,C.test(o)&&s.add(e.to);let n=new Set;for(let t of e)C.test(t)||s.has(t)||n.add(t);return n})(e.map(e=>e.path),t),[e,t]),K=(0,n.useMemo)(()=>a?function(e,t){let o=new Map,s=new Map;for(let e of t){let t=s.get(e.from);t?t.push(e.to):s.set(e.from,[e.to])}let n=new Map;for(let t of e){let e=R.test(t)?"backend":D.An.test(t)?"frontend":I.test(t)?"backend":null;o.set(t,e),e&&n.set(t,e)}let r=e=>{let t=new Set,o=[];for(let[t,s]of n)s===e&&o.push(t);for(;o.length;){let e=o.pop();for(let n of s.get(e)??[])t.has(n)||(t.add(n),o.push(n))}return t},l=r("frontend"),a=r("backend");for(let t of e){if(o.get(t))continue;let e=l.has(t),s=a.has(t);e&&s?o.set(t,"fullstack"):e?o.set(t,"frontend"):s&&o.set(t,"backend")}return o}(e.map(e=>e.path),t):null,[a,e,t]),Q=(0,n.useMemo)(()=>{let e=new Map,t=Object.entries(o??{});if(!t.length)return e;let s=t.map(([,e])=>e.lastAt),n=Math.max(...s),r=Math.min(...s),l=n-r||1,a=t[0][0],i=t[0][1].lastAt;for(let[e,o]of t)o.lastAt>=i&&(a=e,i=o.lastAt);for(let[o,s]of t)e.set(o,{count:s.count,recency:(s.lastAt-r)/l,isNewest:o===a});return e},[o]),Y=Q.size>0,ee=(0,n.useMemo)(()=>Array.from(Q.entries()).map(([e,t])=>({path:e,count:t.count})),[Q]),et=(0,n.useMemo)(()=>e.map(e=>{let t=q.get(e.path)??{x:e.x,y:e.y},o=e.path.lastIndexOf("/"),s=o>=0?e.path.slice(o+1):e.path,n=Q.get(e.path);return{id:e.path,type:"file",position:t,data:{label:s,tooltip:e.path,untested:J.has(e.path),inDegree:e.inDegree??0,dirColor:(0,F.i3)(X.get(e.path)??"(root)"),layer:K?.get(e.path)??null,touched:!!n,count:n?.count??0,recency:n?.recency??0,isNewest:n?.isNewest??!1}}}),[e,q,J,Q,K,X]),eo=(0,n.useMemo)(()=>t.map(e=>({id:`${e.from}|${e.to}`,source:e.from,target:e.to,type:"straight",selectable:!1,focusable:!1,style:{pointerEvents:"none",...e.circular?{stroke:"#f87171",strokeDasharray:"5 3",strokeWidth:1.5,opacity:.6}:{stroke:"#8b8b94",strokeWidth:1,opacity:.3}}})),[t]),[es,en]=(0,n.useState)(et),[er,el]=(0,n.useState)(eo),[ea,ei]=(0,n.useState)(null),[ed,ec]=(0,n.useState)(null),[eu,ep]=(0,n.useState)(null),[eh,ef]=(0,n.useState)(!1),em=(0,_.G)(),[ex,eg]=(0,n.useState)(!1),[eb,ey]=(0,n.useState)(null),[ej,ek]=(0,n.useState)(!1),[ew,ev]=(0,n.useState)(""),[eN,eM]=(0,n.useState)(!1),[eS,eC]=(0,n.useState)("full"),eA=(0,n.useRef)(null),{tool:e$,setTool:ez,flowProps:eE}=(0,r.e)(),eD=(0,n.useCallback)(e=>{ei(e),ep(null);let t=eA.current?.getNode(e);t&&eA.current&&eA.current.setCenter(t.position.x+40,t.position.y+12,{zoom:1.4,duration:600})},[]),eI=(0,n.useCallback)(()=>{ei(null),ep(null);let e=!ex;if(eg(e),ek(e),e&&eA.current){let e=Array.from(Q.keys()).map(e=>({id:e}));e.length&&eA.current.fitView({nodes:e,duration:600,padding:.4})}},[ex,Q]),eR=(0,n.useMemo)(()=>(0,v.b)(e,t,X),[e,t,X]),eO=(0,n.useCallback)(e=>{eA.current&&(e.focusIds.length?eA.current.fitView({nodes:e.focusIds.map(e=>({id:e})),duration:700,padding:.3,maxZoom:1.1}):eA.current.fitView({duration:700,padding:.1}))},[]),eT=(0,N.W)(eR,eO);(0,n.useEffect)(()=>eM(!0),[]),(0,n.useEffect)(()=>en(et),[et]),(0,n.useEffect)(()=>el(eo),[eo]);let eP=(0,n.useCallback)(e=>en(t=>(0,l._0)(e,t)),[]),eZ=(0,n.useCallback)(e=>el(t=>(0,l.zW)(e,t)),[]),eF=(0,n.useCallback)((e,t,o)=>{fetch("/api/code-graph/position",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,x:t,y:o})})},[]),eL=(0,n.useMemo)(()=>new Set(t.filter(e=>e.circular).map(e=>`${e.from}|${e.to}`)),[t]),e_=(0,n.useMemo)(()=>{let e=new Set;for(let o of t)o.circular&&(e.add(o.from),e.add(o.to));return e},[t]),eW=ea??ed,eB=ew.trim().length>0,eU=(0,n.useMemo)(()=>{if(!eB)return null;let t=new Set;for(let o of e)(0,S.Qk)((0,S.zn)(o),ew)&&t.add(o.path);return t},[e,ew,eB]),eV=(0,n.useMemo)(()=>eB?(0,S.r2)(e,ew,e=>(0,S.zn)(e),e=>({id:e.path,label:e.path,sublabel:e.lang??void 0,kind:"file"})):[],[e,ew,eB]),eH=(0,n.useMemo)(()=>{if(eu){let e=er.find(e=>e.id===eu);return e?new Set([e.source,e.target]):null}if(eW){let e=new Set([eW]);for(let o of t)o.from===eW&&e.add(o.to),o.to===eW&&e.add(o.from);return e}return eh?e_:ex&&Y?new Set(Q.keys()):null},[eW,eu,eh,e_,t,er,ex,Y,Q]),eG=eT.focusIds,eX=eG??eU??eH,eq=eU??eG,eJ=(0,n.useMemo)(()=>{if(!eb||!K)return null;let t=new Set;for(let o of e)(0,z.F)(eb,K.get(o.path)??null)||t.add(o.path);return t},[eb,K,e]),eK=(0,n.useMemo)(()=>eX?es.map(e=>{let t=eX.has(e.id);return{...e,zIndex:t&&eq?10:e.zIndex,style:{...e.style,opacity:t?1:.15,boxShadow:t&&eq?S.RU:e.style?.boxShadow,borderRadius:t&&eq?9999:e.style?.borderRadius,transition:"opacity 120ms, box-shadow 120ms"}}}):eJ?es.map(e=>eJ.has(e.id)?{...e,style:{...e.style,opacity:.15,transition:"opacity 120ms"}}:e):es,[es,eX,eq,eJ]),eQ=(0,n.useMemo)(()=>eG?er.map(e=>eG.has(e.source)&&eG.has(e.target)?{...e,style:{...e.style,stroke:"#e4e4e7",opacity:.9,strokeWidth:1.4}}:{...e,style:{...e.style,opacity:.05}}):eU?er.map(e=>eU.has(e.source)&&eU.has(e.target)?{...e,style:{...e.style,stroke:"#e4e4e7",opacity:.95,strokeWidth:1.6}}:{...e,style:{...e.style,opacity:.05}}):eW||eu||eh||ex?er.map(e=>{let t=!1;return eu?t=e.id===eu:eW?t=e.source===eW||e.target===eW:eh?t=eL.has(e.id):ex&&(t=Q.has(e.source)&&Q.has(e.target)),t?{...e,style:{...e.style,stroke:"#e4e4e7",opacity:.95,strokeWidth:1.6}}:{...e,style:{...e.style,opacity:.05}}}):eJ?er.map(e=>eJ.has(e.source)||eJ.has(e.target)?{...e,style:{...e.style,opacity:.05}}:e):er,[er,eW,eu,eh,eL,ex,Q,eU,eJ,eG]),eY=(0,n.useMemo)(()=>{let e=es.map(e=>{let t=W(e.data.inDegree??0);return{id:e.id,group:X.get(e.id)??"(root)",x:e.position.x,y:e.position.y,w:2*t,h:2*t}});return(0,A.S)(e,{pad:60})},[es,X]),e0=(0,n.useMemo)(()=>{let t=new Map;if(!K)return t;let o=new Map;for(let t of e){let e=K.get(t.path);if(!e)continue;let s=X.get(t.path)??"(root)",n=o.get(s)??new Map;n.set(e,(n.get(e)??0)+1),o.set(s,n)}for(let[e,s]of o){let o=null,n=0,r=!1;for(let[e,t]of s)t>n?(o=e,n=t,r=!1):t===n&&(r=!0);t.set(e,r?null:o)}return t},[K,e,X]),e1=(0,n.useMemo)(()=>{let e=new Map;for(let t of X.values())e.set(t,(e.get(t)??0)+1);return Array.from(e.entries()).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).map(([e,t])=>({group:e,count:t,color:(0,F.i3)(e)}))},[X]),e5=t.filter(e=>e.circular).length,e2=(0,n.useMemo)(()=>ea?t.filter(e=>e.from===ea).map(e=>e.to):[],[ea,t]),e4=(0,n.useMemo)(()=>ea?t.filter(e=>e.to===ea).map(e=>e.from):[],[ea,t]),e7=null!==ea||ej&&Y,e3=(0,n.useCallback)(()=>{ei(null),ek(!1),eg(!1)},[]);return eN?(0,s.jsxs)("div",{className:"canvas-dots relative h-screen w-full",children:[(0,s.jsxs)(l.Gc,{...eE,nodes:eK,edges:eQ,nodeTypes:B,onNodesChange:eP,onEdgesChange:eZ,onNodeClick:(e,t)=>{ei(t.id),ep(null)},onEdgeClick:(e,t)=>{ep(t.id),ei(null)},onPaneClick:()=>{ei(null),ep(null)},onNodeMouseEnter:(e,t)=>ec(t.id),onNodeMouseLeave:()=>ec(null),onInit:e=>{eA.current=e},onNodeDragStop:(e,t)=>eF(t.id,t.position.x,t.position.y),deleteKeyCode:null,colorMode:em,fitView:!0,fitViewOptions:{padding:.1,minZoom:.18,maxZoom:.9},minZoom:.05,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,s.jsx)($.Z,{regions:"far"===eS?eY:[],tone:"category",lod:eS}),a&&(0,s.jsx)(U,{regions:"far"===eS?[]:eY,dominant:e0}),(0,s.jsx)(P.J,{onLod:eC,thresholds:Z.kz}),(0,s.jsx)(l.H2,{position:"bottom-right",className:"!overflow-hidden !rounded-xl !border !border-border [&_button]:!border-border [&_button]:!bg-card/70 [&_button]:!text-foreground [&_button]:!backdrop-blur"}),(0,s.jsx)(l.Zk,{position:"bottom-left",style:{marginBottom:118},children:(0,s.jsx)(r.H,{tool:e$,onChange:ez})}),(0,s.jsx)(l.Zk,{position:"bottom-right",style:{marginBottom:152},children:(0,s.jsx)(E.er,{title:"Legend",trigger:(e,t)=>(0,s.jsx)("button",{type:"button",onClick:t,title:"Legend",className:(0,L.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,s.jsx)(f.A,{className:"size-4"})}),children:(0,s.jsxs)("ul",{className:"space-y-1.5 text-[10.5px] text-muted-foreground",children:[(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block size-2.5 shrink-0 rounded-full bg-zinc-400"}),(0,s.jsx)("span",{children:"a file \xb7 bigger dot = more files import it"})]}),a&&(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block size-2.5 shrink-0 rounded-full",style:{boxShadow:`inset 0 0 0 2px ${D.ZD.frontend}`}}),(0,s.jsx)("span",{children:"colored ring \xb7 frontend / backend layer"})]}),(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-[#4a4a52]"}),(0,s.jsx)("span",{children:"line \xb7 imports another file"})]}),(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-red-400"}),(0,s.jsx)("span",{children:"red \xb7 part of an import cycle"})]}),(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{"aria-hidden":!0,className:"inline-flex shrink-0 gap-0.5",children:[(0,s.jsx)("span",{className:"inline-block size-2 rounded-full bg-violet-400"}),(0,s.jsx)("span",{className:"inline-block size-2 rounded-full bg-amber-400"})]}),(0,s.jsx)("span",{children:"dot color \xb7 its directory (chips, top-right)"})]})]})})}),(0,s.jsx)(l.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!overflow-hidden !rounded-xl !border !border-border !bg-card/50 !backdrop-blur",nodeColor:()=>"#555"}),eR.length>0&&!eT.active&&(0,s.jsx)(l.Zk,{position:"top-left",className:"!mt-14",children:(0,s.jsxs)("button",{type:"button",onClick:eT.start,title:"Guided, dependency-ordered walkthrough of the codebase",className:"glass flex items-center gap-1.5 rounded-xl px-3 py-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[(0,s.jsx)(m.A,{className:"size-3.5"}),"Start tour"]})}),(0,s.jsx)(l.Zk,{position:"top-right",className:(0,L.cn)("glass rounded-full px-1 py-0.5 transition-[margin] duration-200",e7&&"!mr-[300px]"),children:(0,s.jsx)(j.Z,{active:"FILES",tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"},{value:"FILES",label:"Files",href:"/map?view=FILES"}]})}),(0,s.jsx)(l.Zk,{position:"top-right",className:(0,L.cn)("glass !mt-24 flex max-w-[300px] flex-wrap items-center justify-end gap-x-2.5 gap-y-1 rounded-xl px-3 py-1.5 transition-[margin] duration-200",e7&&"!mr-[300px]"),children:e1.map(t=>(0,s.jsxs)("button",{type:"button",onClick:()=>{let o=e.filter(e=>(X.get(e.path)??"(root)")===t.group).map(e=>({id:e.path}));o.length&&eA.current?.fitView({nodes:o,duration:600,padding:.3,maxZoom:1})},title:`${t.count} files — click to zoom to ${t.group}`,className:"flex items-center gap-1.5 rounded px-1 py-0.5 text-[10px] text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"size-2 shrink-0 rounded-full",style:{backgroundColor:t.color}}),t.group]},t.group))}),(0,s.jsxs)(l.Zk,{position:"top-right",className:(0,L.cn)("!mt-14 flex items-center gap-2 transition-[margin] duration-200",e7&&"!mr-[300px]"),children:[(0,s.jsx)(k.X,{query:ew,onQuery:ev,hits:eV,placeholder:"Find a file…",onPick:e=>{ev(""),eD(e)},onZoomToMatches:()=>{eU?.size&&eA.current?.fitView({nodes:[...eU].map(e=>({id:e})),duration:600,padding:.3})}}),a&&(0,s.jsx)(z.o,{value:eb,onChange:ey,options:["frontend","backend"]}),(0,s.jsxs)("div",{className:"glass flex items-center gap-3 rounded-xl px-3 py-1.5 text-[11px]",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[e.length," files \xb7 ",t.length," imports"]}),e5>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>{ef(e=>!e),ei(null),ep(null)},title:eh?"Show all imports":"Show only files involved in import cycles",className:(0,L.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",eh?"bg-red-500/15 text-red-200 ring-1 ring-red-400/40":"text-red-300 hover:bg-red-500/10"),children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-5 border-t border-dashed",style:{borderColor:"#ef4444"}}),e5," circular"]}),Y&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("button",{type:"button",onClick:eI,title:ex?"Show all files again":"Focus + zoom to the files edited this session",className:(0,L.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",ex?"bg-teal-500/15 text-teal-200 ring-1 ring-teal-400/40":"text-teal-300 hover:bg-teal-500/10"),children:[(0,s.jsx)(x.A,{className:"size-3"}),Q.size," edited"]})})]})]})]}),e7&&(0,s.jsxs)(y.b,{className:"absolute bottom-3 right-3 top-16 z-10 flex w-72 flex-col rounded-2xl",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-3.5 py-2.5",children:[(0,s.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:ea?"File":"Edited this session"}),(0,s.jsx)("button",{onClick:e3,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:(0,s.jsx)(g.A,{className:"size-4"})})]}),(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:ea?(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,s.jsx)(b.A,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,s.jsx)("h2",{className:"break-all text-sm font-semibold leading-tight",children:ea.slice(ea.lastIndexOf("/")+1)})]}),(0,s.jsx)("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:ea})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(G=Q.get(ea))?(0,s.jsxs)("span",{className:"rounded bg-teal-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-teal-300",children:["edited ",G.count,"\xd7"]}):null,J.has(ea)&&(0,s.jsx)("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-amber-300",children:"untested"})]}),(0,s.jsx)("button",{onClick:()=>fetch(`/api/open?path=${encodeURIComponent(ea)}`).catch(()=>{}),className:"w-full rounded-md border border-border px-2 py-1.5 text-[11px] text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:"Open in editor"}),(0,s.jsx)(H,{label:"Imports",paths:e2,onPick:eD}),(0,s.jsx)(H,{label:"Imported by",paths:e4,onPick:eD})]}):(0,s.jsx)(w.h,{files:ee.map(e=>({path:e.path,meta:`${e.count}\xd7`})),emptyLabel:"No files edited this session yet."})})]}),eT.active&&eT.step&&(0,s.jsx)(M.d,{steps:eR,index:eT.index,onPrev:eT.prev,onNext:eT.next,onExit:eT.stop,onGoto:eT.goto})]}):(0,s.jsx)("div",{className:"flex h-screen w-full items-center justify-center text-sm text-muted-foreground",children:"Loading graph…"})}function H({label:e,paths:t,onPick:o}){return t.length?(0,s.jsxs)("div",{children:[(0,s.jsxs)("h3",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[e," (",t.length,")"]}),(0,s.jsx)(w.h,{files:t.map(e=>({path:e})),onSelect:o})]}):null}},77260:(e,t,o)=>{"use strict";o.d(t,{MapTabsShell:()=>a});var s=o(95155),n=o(12115),r=o(75514);let l=["ROADMAP","ARCHITECTURE","DATABASE"];function a({initialView:e,roadmap:t,architecture:o,database:i}){let[d,c]=(0,n.useState)(e),[u,p]=(0,n.useState)(()=>new Set([e])),h=(0,n.useCallback)(e=>{c(e),p(t=>t.has(e)?t:new Set(t).add(e));try{let t=new URL(window.location.href);t.searchParams.set("view",e),window.history.replaceState(window.history.state,"",t)}catch{}},[]),f={ROADMAP:t,ARCHITECTURE:o,DATABASE:i};return(0,s.jsx)(r.no.Provider,{value:{views:r.a4,switchTo:h},children:l.map(e=>u.has(e)?(0,s.jsx)("div",{className:d===e?"contents":"hidden",children:f[e]},e):null)})}}},e=>{e.O(0,[2574,3862,5004,277,8500,4888,2114,1569,5547,8710,6283,4752,6818,3748,4853,8441,3794,7358],()=>e(e.s=27950)),_N_E=e.O()}]);
|