trybeacon 0.1.84 → 0.1.86
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 +15 -15
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/@modal/(.)settings/page.js +1 -1
- package/.next/server/app/@modal/(.)settings/page.js.nft.json +1 -1
- 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.js +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +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 +26 -27
- package/.next/server/app/_not-found.segments/_full.segment.rsc +26 -27
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +15 -16
- 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 +2 -2
- package/.next/server/app/api/plan/annotations/route.js +2 -2
- package/.next/server/app/docs/page.js +1 -1
- package/.next/server/app/docs/page.js.nft.json +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 +29 -30
- package/.next/server/app/docs.segments/@modal/__DEFAULT__.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_full.segment.rsc +29 -30
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +15 -16
- package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
- 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.js +1 -1
- package/.next/server/app/help/page.js.nft.json +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 +38 -39
- package/.next/server/app/help.segments/@modal/__DEFAULT__.segment.rsc +1 -1
- package/.next/server/app/help.segments/_full.segment.rsc +38 -39
- package/.next/server/app/help.segments/_head.segment.rsc +1 -1
- package/.next/server/app/help.segments/_index.segment.rsc +15 -16
- package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
- 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 +27 -29
- 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 +27 -29
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +15 -16
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- 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.js +1 -1
- package/.next/server/app/page.js.nft.json +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.js +1 -1
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +15 -15
- package/.next/server/chunks/2693.js +5 -5
- package/.next/server/chunks/3825.js +1 -1
- package/.next/server/chunks/5509.js +1 -0
- package/.next/server/chunks/7335.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/569-bfdcec83011428d3.js +1 -0
- package/.next/static/chunks/985-430599029183e18e.js +1 -0
- package/.next/static/chunks/app/layout-6af877a2d6717f9e.js +1 -0
- package/.next/static/chunks/app/learn/{page-b1bea0ba5fbf4c80.js → page-18821c98beca638e.js} +1 -1
- package/.next/static/chunks/app/map/{page-bc44aabbc5a3a261.js → page-278aa8f1b90828be.js} +1 -1
- package/.next/static/chunks/app/plan/{page-2be2dee159981532.js → page-6085ec2d97f9c678.js} +2 -2
- package/.next/static/chunks/app/s/[token]/{page-dd148c2090094329.js → page-a00e023f723224c1.js} +1 -1
- package/.next/static/css/ba104bf801b96933.css +1 -0
- package/.next/trace +47 -47
- package/.next/trace-build +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/7999.js +0 -1
- package/.next/server/chunks/9979.js +0 -1
- package/.next/static/chunks/3748-ffd46534ace96c3d.js +0 -1
- package/.next/static/chunks/569-b6c0e292fbfa6038.js +0 -1
- package/.next/static/chunks/app/layout-b78f34d56f9d5aea.js +0 -1
- package/.next/static/css/95077158c5710c9e.css +0 -1
- /package/.next/static/{GCYTD3B9xLkKH9uIwlKD- → DJSoomboyiqKwEIQ7ktag}/_buildManifest.js +0 -0
- /package/.next/static/{GCYTD3B9xLkKH9uIwlKD- → DJSoomboyiqKwEIQ7ktag}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{434:(e,t,r)=>{"use strict";r.d(t,{PlanBar:()=>u});var n=r(95155),a=r(98500),s=r.n(a),i=r(73321),l=r(86272),o=r(32133),d=r(65738),c=r(48484);function u(){let{status:e,discard:t}=(0,c.j)(),r=(0,i.usePathname)();return e.pending&&"/plan"!==r?(0,n.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-14 z-40 flex justify-center px-2",children:(0,n.jsxs)("div",{className:"pointer-events-auto flex max-w-3xl items-center gap-2 rounded-xl border border-emerald-500/30 bg-card/85 px-3 py-1.5 shadow-lg backdrop-blur supports-[backdrop-filter]:bg-card/70",children:[(0,n.jsx)(l.A,{className:"size-3.5 shrink-0 text-emerald-300"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("div",{className:"truncate text-[12px] leading-tight text-foreground",children:[(0,n.jsx)("span",{className:"text-emerald-300/80",children:"Plan ready \xb7 "}),e.description||"(no description)"]}),(0,n.jsxs)("div",{className:"text-[10px] leading-tight text-muted-foreground",children:[e.features," feature(s) \xb7 ",e.tables," table(s) \xb7 ",e.endpoints," ","endpoint(s)"]})]}),(0,n.jsxs)(s(),{href:"/plan",className:"flex shrink-0 items-center gap-1 rounded-md border border-emerald-500/40 bg-emerald-500/15 px-2 py-1 text-[11px] font-semibold text-emerald-300 transition-colors hover:bg-emerald-500/25",title:"Open Plannotator + canvases side by side",children:[(0,n.jsx)(o.A,{className:"size-3"})," Open plan"]}),(0,n.jsxs)("button",{onClick:t,className:"flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-red-500/15 hover:text-red-300",title:"Discard the plan",children:[(0,n.jsx)(d.A,{className:"size-3"})," Discard"]})]})}):null}},4474:(e,t,r)=>{"use strict";r.d(t,{$:()=>o});var n=r(95155),a=r(6539),s=r(18460),i=r(91337);let l=(0,s.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function o({className:e,variant:t="default",size:r="default",...s}){return(0,n.jsx)(a.Button,{"data-slot":"button",className:(0,i.cn)(l({variant:t,size:r,className:e})),...s})}},10436:(e,t,r)=>{"use strict";r.d(t,{TopNav:()=>g});var n=r(95155),a=r(12115),s=r(98500),i=r.n(s),l=r(73321),o=r(82879),d=r(52965);let c=(0,r(30772).A)("folder-git-2",[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);var u=r(26518),m=r(91337),p=r(60292);function h({fallback:e}){let[t,r]=(0,a.useState)([]),[s,i]=(0,a.useState)(null);if((0,a.useEffect)(()=>{let e=!0,t=()=>fetch("/api/workspace").then(e=>e.ok?e.json():null).then(t=>{e&&t&&(r(t.workspaces??[]),i((0,p.fk)()??t.active??null))}).catch(()=>{});t();let n=setInterval(t,5e3);return()=>{e=!1,clearInterval(n)}},[]),0===t.length)return e?(0,n.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:["\xb7 ",e]}):null;async function l(e){i(e),(0,p.aE)(e),await Promise.race([fetch("/api/workspace",{method:"POST",headers:{"content-type":"application/json","x-beacon-workspace":e},body:JSON.stringify({id:e}),signal:AbortSignal.timeout(8e3)}).catch(()=>{}),new Promise(e=>setTimeout(e,2500))]);let t=new URLSearchParams(window.location.search);t.set("ws",e),window.location.href=`${window.location.pathname}?${t.toString()}`}let o=t.find(e=>e.id===s);return(0,n.jsxs)(u.l6,{value:s??"",onValueChange:e=>e&&l(e),children:[(0,n.jsxs)(u.bq,{"data-ws-switcher":"",title:o?.name,className:"h-7 max-w-[180px] gap-1.5 rounded-lg border-border bg-[var(--ink-hover)] px-2 text-xs font-medium transition-colors hover:bg-[var(--ink-active)]",children:[(0,n.jsx)(c,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,n.jsx)(u.yv,{children:()=>o?.name??"Project"})]}),(0,n.jsxs)(u.gC,{align:"start",alignItemWithTrigger:!1,sideOffset:6,className:"min-w-[250px] border border-border bg-popover/95 p-1.5 backdrop-blur-xl",children:[(0,n.jsx)("p",{className:"px-2 pt-1 pb-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Workspace"}),t.map(e=>{var t,r;let a,i=e.id===s;return(0,n.jsx)(u.eb,{value:e.id,className:(0,m.cn)("gap-2.5 rounded-lg py-1.5 pr-8 pl-1.5 transition-colors",i&&"bg-[var(--ink-active)]"),children:(0,n.jsxs)("span",{className:"flex items-center gap-2.5",children:[(0,n.jsx)("span",{className:(0,m.cn)("flex size-7 shrink-0 items-center justify-center rounded-md border",i?"border-sky-400/30 bg-sky-400/10 text-sky-300":"border-border bg-[var(--ink-hover)] text-muted-foreground"),children:(0,n.jsx)(c,{className:"size-3.5"})}),(0,n.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,n.jsx)("span",{className:"truncate text-[13px] font-medium leading-tight text-foreground",children:e.name}),(0,n.jsx)("span",{className:"truncate font-mono text-[10px] leading-tight text-muted-foreground",children:(t=e.path,r=e.name,(a=t.replace(/^\/(Users|home)\/[^/]+/,"~").split("/").filter(Boolean))[a.length-1]===r&&a.pop(),(a.length>3?[a[0],"…",a[a.length-1]]:a).join("/")||"~")})]})]})},e.id)})]})]})}var x=r(81984);let f=[{href:"/plan",label:"Plans"},{href:"/map",label:"Map"},{href:"/learn",label:"Learn"},{href:"/settings",label:"Settings"}];function g({repo:e}){let t=(0,l.usePathname)(),{toggle:r,open:s}=(0,x.b)(),[c,u]=(0,a.useState)(null);return(0,a.useEffect)(()=>{u((0,p.fk)())},[t]),(0,n.jsx)("header",{"data-app-nav":!0,className:"pointer-events-none fixed left-3 top-3 z-30",children:(0,n.jsx)("div",{className:"glass pointer-events-auto flex h-10 items-center gap-1 rounded-full pl-3 pr-1.5",children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsxs)(i(),{href:"/",className:"mr-1 flex items-center gap-2 text-sm font-semibold tracking-tight",children:[(0,n.jsx)(d._,{size:18,className:"text-foreground"}),(0,n.jsx)("span",{className:"hidden lg:inline",children:"Beacon"})]}),(0,n.jsx)("span",{"aria-hidden":!0,className:"mx-1 h-5 w-px bg-border"}),(0,n.jsx)(h,{fallback:e}),(0,n.jsx)("span",{"aria-hidden":!0,className:"mx-1 h-5 w-px bg-border"}),(0,n.jsx)("nav",{className:"flex items-center gap-0.5 text-sm",children:f.map(e=>{let r=t===e.href||t.startsWith(e.href+"/");return(0,n.jsx)(i(),{href:(0,p.Fj)(e.href,c),className:(0,m.cn)("rounded-full px-3 py-1 text-[13px] tracking-tight transition-colors",r?"bg-[var(--ink-active)] text-foreground shadow-[inset_0_1px_0_rgba(255,255,255,0.06)]":"text-muted-foreground hover:bg-[var(--ink-hover)] hover:text-foreground"),children:e.label},e.href)})}),(0,n.jsx)("span",{"aria-hidden":!0,className:"mx-1 h-5 w-px bg-border"}),(0,n.jsx)("button",{type:"button",onClick:r,"aria-pressed":s,"aria-label":"Notes",title:"Notes",className:(0,m.cn)("flex items-center justify-center rounded-full p-1.5 transition-colors",s?"bg-[var(--ink-active)] text-foreground shadow-[inset_0_1px_0_rgba(255,255,255,0.06)]":"text-muted-foreground hover:bg-[var(--ink-hover)] hover:text-foreground"),children:(0,n.jsx)(o.A,{className:"size-4"})})]})})})}},12943:(e,t,r)=>{"use strict";r.d(t,{AppearanceSync:()=>s});var n=r(12115),a=r(35550);function s(){return(0,n.useEffect)(()=>{let e=()=>(0,a.Fc)((0,a.O4)(),(0,a.C3)()),t=window.matchMedia("(prefers-color-scheme: dark)"),r=t=>{(t.key===a.k4||t.key===a.Gq)&&e()};return t.addEventListener("change",e),window.addEventListener("storage",r),e(),()=>{t.removeEventListener("change",e),window.removeEventListener("storage",r)}},[]),null}},26518:(e,t,r)=>{"use strict";r.d(t,{bq:()=>w,eb:()=>z,gC:()=>N,l6:()=>y,yv:()=>j});var n=r(95155);r(12115);var a=r(40595),s=r(41294),i=r(75681),l=r(17314),o=r(37265),d=r(23107),c=r(70826),u=r(67564),m=r(1938),p=r(15433),h=r(5919),x=r(45450),f=r(88988),g=r(91337),b=r(12363),v=r(64577),k=r(94088);let y=a.H;function j({className:e,...t}){return(0,n.jsx)(s.y,{"data-slot":"select-value",className:(0,g.cn)("flex flex-1 text-left",e),...t})}function w({className:e,size:t="default",children:r,...a}){return(0,n.jsxs)(i.b,{"data-slot":"select-trigger","data-size":t,className:(0,g.cn)("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...a,children:[r,(0,n.jsx)(l.w,{render:(0,n.jsx)(b.A,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function N({className:e,children:t,side:r="bottom",sideOffset:a=4,align:s="center",alignOffset:i=0,alignItemWithTrigger:l=!0,...m}){return(0,n.jsx)(o.V,{children:(0,n.jsx)(d.l,{side:r,sideOffset:a,align:s,alignOffset:i,alignItemWithTrigger:l,className:"isolate z-50",children:(0,n.jsxs)(c.t,{"data-slot":"select-content","data-align-trigger":l,className:(0,g.cn)("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...m,children:[(0,n.jsx)(S,{}),(0,n.jsx)(u.B,{children:t}),(0,n.jsx)(A,{})]})})})}function z({className:e,children:t,...r}){return(0,n.jsxs)(m.e,{"data-slot":"select-item",className:(0,g.cn)("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[(0,n.jsx)(p.h,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),(0,n.jsx)(h.h,{render:(0,n.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,n.jsx)(v.A,{className:"pointer-events-none"})})]})}function S({className:e,...t}){return(0,n.jsx)(x.w,{"data-slot":"select-scroll-up-button",className:(0,g.cn)("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,n.jsx)(k.A,{})})}function A({className:e,...t}){return(0,n.jsx)(f.d,{"data-slot":"select-scroll-down-button",className:(0,g.cn)("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,n.jsx)(b.A,{})})}},29510:(e,t,r)=>{"use strict";r.d(t,{UpdateBanner:()=>m});var n=r(95155),a=r(12115);let s=(0,r(30772).A)("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);var i=r(9005),l=r(64577),o=r(99314),d=r(39593);function c(e){if("string"!=typeof e)return null;let t=e.trim().replace(/^v/i,"").match(/^(\d+)(?:\.(\d+))?(?:\.(\d+))?/);return t?[Number(t[1]),Number(t[2]??0),Number(t[3]??0)]:null}let u="beacon:update-dismissed";function m({currentVersion:e}){let[t,r]=(0,a.useState)(null),[p,h]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await fetch(d.kw);if(!n.ok)return;let a=await n.json(),s="string"==typeof a?.version?a.version:"";if(t||!function(e,t){let r=c(e),n=c(t);if(!r||!n)return!1;for(let e=0;e<3;e++){if(r[e]>n[e])return!0;if(r[e]<n[e])break}return!1}(s,e)||localStorage.getItem(u)===s)return;r(s)}catch{}})(),()=>{t=!0}},[e]),!t)return null;let x=async()=>{try{await navigator.clipboard?.writeText(d.EO),h(!0),setTimeout(()=>h(!1),1600)}catch{}};return(0,n.jsx)("div",{className:"pointer-events-none fixed bottom-4 right-4 z-50 flex justify-end",children:(0,n.jsx)("div",{className:"glass pointer-events-auto w-[320px] rounded-xl p-3.5 shadow-xl",children:(0,n.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,n.jsx)(s,{className:"mt-0.5 size-4 shrink-0 text-[#ff7a45]"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("p",{className:"text-[13px] font-semibold tracking-tight text-foreground",children:"New version available"}),(0,n.jsx)("button",{type:"button",onClick:()=>{try{localStorage.setItem(u,t)}catch{}r(null)},"aria-label":"Dismiss",className:"shrink-0 rounded-md p-0.5 text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:(0,n.jsx)(i.A,{className:"size-3.5"})})]}),(0,n.jsxs)("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[e," →"," ",(0,n.jsx)("span",{className:"text-foreground",children:t.replace(/^v/i,"")})," \xb7 update Beacon"]}),(0,n.jsxs)("button",{type:"button",onClick:x,title:"Copy the update command",className:"mt-2.5 flex w-full items-center justify-between gap-2 rounded-lg border border-border bg-black/30 px-2.5 py-1.5 text-left font-mono text-[11px] text-muted-foreground transition-colors hover:border-border hover:text-foreground",children:[(0,n.jsx)("span",{className:"truncate",children:d.EO}),p?(0,n.jsx)(l.A,{className:"size-3.5 shrink-0 text-[#ff7a45]"}):(0,n.jsx)(o.A,{className:"size-3.5 shrink-0"})]})]})]})})})}},35353:e=>{e.exports={style:{fontFamily:"'Geist', 'Geist Fallback'",fontStyle:"normal"},className:"__className_246ccd",variable:"__variable_246ccd"}},35550:(e,t,r)=>{"use strict";r.d(t,{C3:()=>o,Fc:()=>d,Gq:()=>a,O4:()=>l,S1:()=>u,SS:()=>s,Yl:()=>c,k4:()=>n,mn:()=>i});let n="beacon-theme",a="beacon-surface",s="dark",i="glass";function l(){try{var e;return e=localStorage.getItem(n),"light"===e||"dark"===e||"auto"===e?e:s}catch{return s}}function o(){try{var e;return e=localStorage.getItem(a),"glass"===e||"tinted"===e||"solid"===e?e:i}catch{return i}}function d(e,t){var r;if("u"<typeof document)return;let n=document.documentElement,a=(r=!!window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,"auto"===e?r:"dark"===e);n.dataset.theme=a?"dark":"light",n.classList.toggle("dark",a),n.dataset.surface=t}function c(e){try{localStorage.setItem(n,e)}catch{}d(e,o())}function u(e){try{localStorage.setItem(a,e)}catch{}d(l(),e)}},38332:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(30772).A)("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]])},39593:(e,t,r)=>{"use strict";r.d(t,{EO:()=>i,kw:()=>a});var n=r(41463);let a="https://registry.npmjs.org/trybeacon/latest",s=(n.env.NEXT_PUBLIC_BEACON_SITE_URL??"https://www.trybeacon.sh").replace(/\/$/,""),i=`curl -fsSL ${s}/install.sh | sh`},42578:(e,t,r)=>{"use strict";r.d(t,{AskModal:()=>c});var n=r(95155),a=r(12115),s=r(9005),i=r(90467),l=r(4474),o=r(82099),d=r(91337);function c(){let[e,t]=(0,a.useState)(null),[r,c]=(0,a.useState)(new Set),[u,m]=(0,a.useState)(""),[p,h]=(0,a.useState)(!1),x=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=!0,r=async()=>{try{let r=await fetch("/api/ask",{cache:"no-store"});if(!r.ok||!e)return;let{ask:n}=await r.json();if(!e||n&&n.id===x.current)return;t(e=>e?.id===n?.id?e:n)}catch{}};r();let n=setInterval(r,1500);return()=>{e=!1,clearInterval(n)}},[]);let f=e?.id??null,g=(0,a.useRef)(null);f!==g.current&&(g.current=f,r.size&&c(new Set),u&&m(""));let b=(0,a.useCallback)(async r=>{if(e&&!p){h(!0),x.current=e.id,t(null);try{await fetch("/api/ask/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e.id,...r})})}catch{}finally{h(!1)}}},[e,p]);if(!e)return null;if("mirror"===e.mode&&"question"===e.kind&&e.question)return(0,n.jsx)("div",{className:"fixed right-4 bottom-4 z-[70] w-full max-w-sm",children:(0,n.jsxs)(o.b,{className:"rounded-2xl border border-border/60 p-4 shadow-2xl",children:[(0,n.jsxs)("div",{className:"mb-1 flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[0.7rem] font-medium text-muted-foreground",children:e.question.header||"The agent is asking"}),(0,n.jsx)("button",{type:"button",onClick:()=>{x.current=e.id,t(null)},className:"text-muted-foreground transition-colors hover:text-foreground","aria-label":"Dismiss",children:(0,n.jsx)(s.A,{className:"size-4"})})]}),(0,n.jsx)("p",{className:"mb-3 text-sm font-medium text-foreground",children:e.question.question}),(0,n.jsx)("div",{className:"flex flex-col gap-1.5",children:e.question.options.map(e=>(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-background/40 px-3 py-1.5",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:e.label}),e.description&&(0,n.jsx)("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:e.description})]},e.label))}),(0,n.jsx)("p",{className:"mt-3 text-[0.7rem] text-muted-foreground",children:"Answer in your terminal — this is a mirror."})]})});let v=()=>u.trim()&&b({selected:[u.trim()]});return(0,n.jsx)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/40 p-4 backdrop-blur-sm",children:(0,n.jsx)(o.b,{className:"w-full max-w-lg rounded-2xl border border-border/60 p-5 shadow-2xl",children:"question"===e.kind&&e.question?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,n.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[0.7rem] font-medium text-muted-foreground",children:e.question.header||"The agent is asking"}),e.question.multiSelect&&(0,n.jsx)("span",{className:"text-[0.7rem] text-muted-foreground",children:"select all that apply"})]}),(0,n.jsx)("p",{className:"mb-4 text-sm font-medium text-foreground",children:e.question.question}),(0,n.jsx)("div",{className:"flex flex-col gap-2",children:e.question.options.map(t=>{let a=r.has(t.label);return(0,n.jsxs)("button",{type:"button",disabled:p,onClick:()=>{let r;return e.question.multiSelect?(r=t.label,c(e=>{let t=new Set(e);return t.has(r)?t.delete(r):t.add(r),t})):b({selected:[t.label]})},className:(0,d.cn)("rounded-lg border border-border bg-background/40 px-3 py-2 text-left transition-colors hover:bg-muted disabled:opacity-50",a&&"border-primary bg-primary/10"),children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:t.label}),t.description&&(0,n.jsx)("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:t.description})]},t.label)})}),(0,n.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,n.jsx)("input",{value:u,disabled:p,onChange:e=>m(e.target.value),onKeyDown:t=>"Enter"===t.key&&!e.question.multiSelect&&v(),placeholder:"Other…",className:"h-8 flex-1 rounded-lg border border-border bg-background/40 px-2.5 text-sm outline-none focus:border-primary"}),e.question.multiSelect?(0,n.jsx)(l.$,{size:"sm",onClick:()=>{let e=[...r,...u.trim()?[u.trim()]:[]];e.length&&b({selected:e})},disabled:p,children:"Submit"}):(0,n.jsx)(l.$,{size:"icon-sm",variant:"outline",onClick:v,disabled:p||!u.trim(),"aria-label":"Submit other",children:(0,n.jsx)(i.A,{})})]})]}):e.approval?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"mb-1 flex items-center gap-2",children:(0,n.jsxs)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[0.7rem] font-medium text-muted-foreground",children:["Approve ",e.approval.tool]})}),(0,n.jsx)("p",{className:"mb-3 text-sm font-medium text-foreground",children:e.approval.title}),e.approval.preview&&(0,n.jsx)("pre",{className:"mb-4 max-h-64 overflow-auto rounded-lg border border-border bg-background/40 p-3 text-xs whitespace-pre-wrap text-muted-foreground",children:e.approval.preview}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(l.$,{variant:"destructive",onClick:()=>b({decision:"deny"}),disabled:p,children:"Deny"}),(0,n.jsx)(l.$,{onClick:()=>b({decision:"allow"}),disabled:p,children:"Allow"})]})]}):null})})}},48484:(e,t,r)=>{"use strict";r.d(t,{PlanProvider:()=>c,j:()=>u});var n=r(95155),a=r(12115),s=r(73321),i=r(60292),l=r(99979);let o={pending:!1,proposedAt:0,tables:0,endpoints:0,features:0},d=(0,a.createContext)(null);function c({children:e}){let t=(0,s.useRouter)(),[r,u]=(0,a.useState)(o),m=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/plan",{method:"GET",cache:"no-store",headers:(0,i.dh)((0,l.X0)())});if(!e.ok)return;let t=await e.json();u(t)}catch{}},[]);(0,a.useEffect)(()=>{m();let e=setInterval(()=>void m(),4e3);return()=>clearInterval(e)},[m]);let p=(0,a.useCallback)(async()=>{await fetch("/api/plan",{method:"DELETE",headers:(0,i.dh)((0,l.X0)())}).catch(()=>{}),u(o),t.refresh()},[t]),h=(0,a.useCallback)(async()=>{await fetch("/api/plan/approve",{method:"POST",headers:(0,i.dh)((0,l.X0)())}).catch(()=>{}),u(o),t.refresh()},[t]);return(0,n.jsx)(d.Provider,{value:{status:r,discard:p,approvePlan:h,refresh:m},children:e})}function u(){let e=(0,a.useContext)(d);if(!e)throw Error("usePlan must be used inside PlanProvider");return e}},52174:(e,t,r)=>{"use strict";r.d(t,{MainRegion:()=>a});var n=r(95155);function a({children:e}){return(0,n.jsx)("main",{className:"flex flex-1 flex-col",children:e})}},52965:(e,t,r)=>{"use strict";r.d(t,{_:()=>a});var n=r(95155);function a({size:e=18,className:t}){return(0,n.jsxs)("svg",{width:e,height:e,viewBox:"20 22 56 56",fill:"none",className:t,"aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M48 33 L72.5 73 L23.5 73 Z",fill:"none",stroke:"var(--accent-2, #ff7a45)",strokeWidth:7,strokeLinejoin:"round",strokeLinecap:"round"}),(0,n.jsx)("circle",{cx:"48",cy:"29.5",r:"7",fill:"var(--accent-2, #ff7a45)"})]})}},54682:(e,t,r)=>{"use strict";r.d(t,{Gd:()=>x,II:()=>u,Pu:()=>m,Z2:()=>h});var n=r(40054),a=r(82150),s=r(83694),i=r(35580),l=r(56991);let o=s.z.extend({renderMarkdown:(e,t)=>`<u>${t.renderChildren(e)}</u>`}),d=[n.W.configure({underline:!1}),o,a._0,a.L2.configure({nested:!0})],c=[...d,l.eo],u=c,m=d,p=new i.db({extensions:c});function h(e){return p.serialize(function e(t){return"paragraph"===t.type&&(t.content?.length??0)===0?{...t,content:[{type:"text",text:""}]}:Array.isArray(t.content)?{...t,content:t.content.map(e)}:t}(e))}function x(e){return function e(t){if("paragraph"===t.type&&t.content?.length){let e=t.content.every(e=>"text"===e.type),r=t.content.map(e=>e.text??"").join("");if(e&&r.includes("")&&""===r.replace(/\u200B/g,"").trim())return{...t,content:[]}}return Array.isArray(t.content)?{...t,content:t.content.map(e)}:t}(function e(t){if("text"===t.type){let e=(t.marks??[]).find(e=>"link"===e.type&&"string"==typeof e.attrs?.href),r=e?.attrs?.href?(0,l.$w)(e.attrs.href):null;if(r)return{type:"mention",attrs:{kind:r.kind,ref:r.ref,label:(t.text??"").replace(/^@/,"")}}}return Array.isArray(t.content)?{...t,content:t.content.map(e)}:t}(function e(t){if("text"===t.type&&(t.text??"").includes("<u>"))return{type:"__frag",content:function(e){let t,r=e.text??"",n=e.marks??[],a=/<u>([\s\S]*?)<\/u>/g,s=[],i=0;for(;null!==(t=a.exec(r));)t.index>i&&s.push({...e,text:r.slice(i,t.index)}),s.push({type:"text",text:t[1],marks:[...n,{type:"underline"}]}),i=a.lastIndex;return i<r.length&&s.push({...e,text:r.slice(i)}),s.filter(e=>(e.text??"").length>0)}(t)};if(Array.isArray(t.content)){let r=t.content.flatMap(t=>{let r=e(t);return"__frag"===r.type?r.content:[r]});return{...t,content:r}}return t}(p.parse(e))))}},56991:(e,t,r)=>{"use strict";r.d(t,{$w:()=>i,eo:()=>c,tw:()=>u});var n=r(82159),a=r(28794);let s="beacon://";function i(e){if(!e.startsWith(s))return null;let t=e.slice(s.length),r=t.indexOf("/");return r<0?null:{kind:t.slice(0,r),ref:t.slice(r+1)}}let l={kind:{default:null,parseHTML:e=>e.getAttribute("data-kind"),renderHTML:e=>e.kind?{"data-kind":e.kind}:{}},ref:{default:null,parseHTML:e=>e.getAttribute("data-ref"),renderHTML:e=>e.ref?{"data-ref":e.ref}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label")??e.textContent?.replace(/^@/,""),renderHTML:e=>e.label?{"data-label":e.label}:{}}},o=()=>[{tag:"span[data-mention]"}],d=({node:e,HTMLAttributes:t})=>["span",(0,n.KV)({"data-mention":"",class:"beacon-mention"},t),`@${e.attrs.label??""}`],c=n.bP.create({name:"mention",group:"inline",inline:!0,atom:!0,addAttributes:()=>l,parseHTML:o,renderHTML:d,renderMarkdown:e=>{var t,r,n;let a=e.attrs??{};return t=a.kind??"feature",r=a.ref??"",n=a.label??"",`[@${n}](${s}${t}/${r})`}}),u=a.P.extend({name:"mention",addAttributes:()=>l,parseHTML:o,renderHTML:d})},60292:(e,t,r)=>{"use strict";r.d(t,{Bz:()=>n,Fj:()=>l,aE:()=>s,dh:()=>i,fk:()=>a,q0:()=>o});let n="beacon:tab-ws";function a(){var e;let t=new URLSearchParams(window.location.search).get("ws"),r=null;try{t&&sessionStorage.setItem(n,t),r=sessionStorage.getItem(n)}catch{}return e=r,t||e||null}function s(e){try{sessionStorage.setItem(n,e)}catch{}}function i(e){return e?{"x-beacon-workspace":e}:{}}function l(e,t,r){let n=new URLSearchParams;for(let[e,a]of(t&&n.set("ws",t),Object.entries(r??{})))n.set(e,a);let a=n.toString();return a?`${e}?${a}`:e}function o(e,t){if(e.startsWith("/api/"))return!0;try{let r=new URL(e,t);return r.origin===t&&r.pathname.startsWith("/api/")}catch{return!1}}},63494:e=>{e.exports={style:{fontFamily:"'Geist Mono', 'Geist Mono Fallback'",fontStyle:"normal"},className:"__className_c29908",variable:"__variable_c29908"}},66872:()=>{},71886:(e,t,r)=>{"use strict";r.d(t,{NotesDrawer:()=>C});var n=r(95155),a=r(12115),s=r(82879),i=r(2125),l=r(9005),o=r(30772);let d=(0,o.A)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),c=(0,o.A)("pin-off",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);var u=r(65738),m=r(82099),p=r(13439),h=r(95112),x=r(67357);let f=(0,o.A)("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);var g=r(38332),b=r(8143),v=r(58309),k=r(5497),y=r(54682),j=r(93492);function w({value:e,onChange:t}){let r=(0,p.hG)({extensions:y.II,content:e?(0,y.Gd)(e):void 0,immediatelyRender:!1,editorProps:{attributes:{class:"note-prose focus:outline-none"}},onUpdate:({editor:e})=>t((0,y.Z2)(e.getJSON()))});return r?(0,n.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,n.jsx)(N,{editor:r}),(0,n.jsx)(p.$Z,{editor:r,className:"min-h-0 flex-1 overflow-y-auto px-1 py-2 text-[14px] leading-relaxed"})]}):null}function N({editor:e}){(0,j.U)(e);let t=()=>e.chain().focus();return(0,n.jsxs)("div",{className:"flex items-center gap-0.5 border-b border-border pb-2",children:[(0,n.jsx)(j.I,{label:"Bold",active:e.isActive("bold"),onClick:()=>t().toggleBold().run(),children:(0,n.jsx)(h.A,{className:"size-4"})}),(0,n.jsx)(j.I,{label:"Italic",active:e.isActive("italic"),onClick:()=>t().toggleItalic().run(),children:(0,n.jsx)(x.A,{className:"size-4"})}),(0,n.jsx)(j.I,{label:"Underline",active:e.isActive("underline"),onClick:()=>t().toggleUnderline().run(),children:(0,n.jsx)(f,{className:"size-4"})}),(0,n.jsx)(j.I,{label:"Strikethrough",active:e.isActive("strike"),onClick:()=>t().toggleStrike().run(),children:(0,n.jsx)(g.A,{className:"size-4"})}),(0,n.jsx)("span",{"aria-hidden":!0,className:"mx-1 h-5 w-px bg-border"}),(0,n.jsx)(j.I,{label:"Checklist",active:e.isActive("taskList"),onClick:()=>t().toggleTaskList().run(),children:(0,n.jsx)(b.A,{className:"size-4"})}),(0,n.jsx)(j.I,{label:"Bullet list",active:e.isActive("bulletList"),onClick:()=>t().toggleBulletList().run(),children:(0,n.jsx)(v.A,{className:"size-4"})}),(0,n.jsx)(j.I,{label:"Numbered list",active:e.isActive("orderedList"),onClick:()=>t().toggleOrderedList().run(),children:(0,n.jsx)(k.A,{className:"size-4"})})]})}var z=r(81984),S=r(91337);function A(e){return[...e].sort((e,t)=>e.pinned!==t.pinned?Number(t.pinned)-Number(e.pinned):t.updatedAt.localeCompare(e.updatedAt))}function C(){let{open:e,close:t}=(0,z.b)(),[r,o]=(0,a.useState)([]),[p,h]=(0,a.useState)(null),x=(0,a.useRef)({}),f=(0,a.useRef)({}),g=(0,a.useCallback)(e=>{clearTimeout(x.current[e]);let t=f.current[e];t&&(delete f.current[e],fetch(`/api/notes/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}).catch(()=>{}))},[]),b=(0,a.useCallback)((e,t)=>{f.current[e]={...f.current[e],...t},clearTimeout(x.current[e]),x.current[e]=setTimeout(()=>g(e),500)},[g]),v=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/notes",{cache:"no-store"});if(!e.ok)return;let t=await e.json();o(A(t)),h(e=>e??t[0]?.id??null)}catch{}},[]);(0,a.useEffect)(()=>{e?v():Object.keys(f.current).forEach(g)},[e,v,g]);let k=(0,a.useCallback)(async()=>{let e=await fetch("/api/notes",{method:"POST"}).catch(()=>null);if(!e?.ok)return;let t=await e.json();o(e=>A([t,...e])),h(t.id)},[]),y=(0,a.useCallback)(async e=>{clearTimeout(x.current[e]),delete f.current[e],o(t=>{let r=t.filter(t=>t.id!==e);return h(t=>t===e?r[0]?.id??null:t),r}),await fetch(`/api/notes/${e}`,{method:"DELETE"}).catch(()=>{})},[]),j=(0,a.useCallback)((e,t)=>{o(r=>A(r.map(r=>r.id===e?{...r,...t,updatedAt:new Date().toISOString()}:r))),b(e,t)},[b]),N=(0,a.useCallback)(e=>j(e.id,{pinned:!e.pinned}),[j]),C=r.find(e=>e.id===p)??null;return(0,n.jsx)("div",{"aria-hidden":!e,className:(0,S.cn)("fixed inset-y-0 right-0 z-40 flex transition-transform duration-300 ease-out",e?"translate-x-0":"pointer-events-none translate-x-full"),children:(0,n.jsxs)(m.b,{className:"flex h-full w-[420px] flex-col rounded-l-2xl border-l border-border",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2.5",children:[(0,n.jsx)(s.A,{className:"size-4 text-[var(--accent-2,#ff7a45)]"}),(0,n.jsx)("span",{className:"text-sm font-semibold tracking-tight",children:"Notes"}),(0,n.jsx)("span",{className:"ml-auto"}),(0,n.jsx)("button",{type:"button",onClick:k,"aria-label":"New note",title:"New note",className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:(0,n.jsx)(i.A,{className:"size-4"})}),(0,n.jsx)("button",{type:"button",onClick:t,"aria-label":"Close notes",title:"Close",className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",children:(0,n.jsx)(l.A,{className:"size-4"})})]}),(0,n.jsx)("div",{className:"max-h-44 shrink-0 overflow-y-auto border-b border-border p-1.5",children:0===r.length?(0,n.jsxs)("p",{className:"px-2 py-3 text-[13px] text-muted-foreground",children:["No notes yet. Hit ",(0,n.jsx)("span",{className:"text-foreground",children:"+"})," to start one."]}):r.map(e=>(0,n.jsxs)("div",{className:(0,S.cn)("group flex items-center gap-1 rounded-md px-2 py-1.5 text-[13px]",e.id===p?"bg-[var(--ink-active)] text-foreground":"text-muted-foreground hover:bg-[var(--ink-hover)]"),children:[(0,n.jsxs)("button",{type:"button",onClick:()=>h(e.id),className:"min-w-0 flex-1 truncate text-left",children:[e.pinned&&(0,n.jsx)(d,{className:"mr-1 inline size-3 -translate-y-px"}),e.title||"Untitled"]}),(0,n.jsx)("button",{type:"button",onClick:()=>N(e),"aria-label":e.pinned?"Unpin":"Pin",title:e.pinned?"Unpin":"Pin",className:"rounded p-1 opacity-0 transition hover:bg-[var(--ink-hover)] hover:text-foreground group-hover:opacity-100",children:e.pinned?(0,n.jsx)(c,{className:"size-3.5"}):(0,n.jsx)(d,{className:"size-3.5"})}),(0,n.jsx)("button",{type:"button",onClick:()=>y(e.id),"aria-label":"Delete note",title:"Delete",className:"rounded p-1 opacity-0 transition hover:bg-[var(--ink-hover)] hover:text-red-300 group-hover:opacity-100",children:(0,n.jsx)(u.A,{className:"size-3.5"})})]},e.id))}),C?(0,n.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 p-3",children:[(0,n.jsx)("input",{value:C.title,onChange:e=>j(C.id,{title:e.target.value}),placeholder:"Untitled",className:"w-full bg-transparent text-base font-semibold tracking-tight text-foreground placeholder:text-muted-foreground/60 focus:outline-none"}),(0,n.jsx)(w,{value:C.body,onChange:e=>j(C.id,{body:e})},C.id)]}):(0,n.jsxs)("div",{className:"flex flex-1 items-center justify-center p-6 text-center text-[13px] text-muted-foreground",children:["Select a note, or create one. Then ",(0,n.jsx)("span",{className:"px-1 text-foreground",children:"@"}),"-mention it in your terminal to turn it into features."]})]})})}},75893:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,66872,23)),Promise.resolve().then(r.bind(r,52174)),Promise.resolve().then(r.bind(r,42578)),Promise.resolve().then(r.bind(r,81998)),Promise.resolve().then(r.bind(r,81984)),Promise.resolve().then(r.bind(r,71886)),Promise.resolve().then(r.bind(r,434)),Promise.resolve().then(r.bind(r,48484)),Promise.resolve().then(r.bind(r,77242)),Promise.resolve().then(r.bind(r,12943)),Promise.resolve().then(r.bind(r,10436)),Promise.resolve().then(r.bind(r,29510)),Promise.resolve().then(r.t.bind(r,35353,23)),Promise.resolve().then(r.t.bind(r,63494,23))},77242:(e,t,r)=>{"use strict";r.d(t,{TabWorkspace:()=>i});var n=r(12115),a=r(73321),s=r(60292);function i(){let e=(0,a.useRouter)(),t=(0,a.usePathname)();return(0,n.useEffect)(()=>{let e=window.fetch;if(e.__beaconPinned)return;let t=(t,r)=>{try{let n=(0,s.fk)();if(n){let a=window.location.origin;if(t instanceof Request){if((0,s.q0)(t.url,a)&&!t.headers.has("x-beacon-workspace")){let a=new Headers(t.headers);return a.set("x-beacon-workspace",n),e(new Request(t,{headers:a}),r)}}else{let i="string"==typeof t?t:t.href;if((0,s.q0)(i,a)){let a=new Headers(r?.headers);if(!a.has("x-beacon-workspace"))return a.set("x-beacon-workspace",n),e(t,{...r,headers:a})}}}}catch{}return e(t,r)};return t.__beaconPinned=!0,window.fetch=t,()=>{window.fetch=e}},[]),(0,n.useEffect)(()=>{let r=new URLSearchParams(window.location.search).get("ws");if(r){try{sessionStorage.setItem(s.Bz,r)}catch{}return}let n=null;try{n=sessionStorage.getItem(s.Bz)}catch{}if(!n)return;let a=new URLSearchParams(window.location.search);a.set("ws",n),e.replace(`${t}?${a.toString()}`)},[t,e]),null}},81984:(e,t,r)=>{"use strict";r.d(t,{NotesProvider:()=>i,b:()=>l});var n=r(95155),a=r(12115);let s=(0,a.createContext)(null);function i({children:e}){let[t,r]=(0,a.useState)(!1),l=(0,a.useCallback)(()=>r(!0),[]),o=(0,a.useCallback)(()=>r(!1),[]),d=(0,a.useCallback)(()=>r(e=>!e),[]),c=(0,a.useMemo)(()=>({open:t,openDrawer:l,close:o,toggle:d}),[t,l,o,d]);return(0,n.jsx)(s.Provider,{value:c,children:e})}function l(){let e=(0,a.useContext)(s);if(!e)throw Error("useNotes must be used inside NotesProvider");return e}},81998:(e,t,r)=>{"use strict";r.d(t,{LiveRefresh:()=>l});var n=r(12115),a=r(73321);let s={primed:!1,lastV:-1,lastNavSeq:-1};var i=r(60292);function l(){let e=(0,a.useRouter)();return(0,n.useEffect)(()=>{let t=(0,i.fk)(),r=new EventSource(t?`/api/stream?ws=${encodeURIComponent(t)}`:"/api/stream"),n=s;return r.onopen=()=>{n=s},r.onmessage=t=>{var r,a;let s;try{s=JSON.parse(t.data)}catch{e.refresh();return}let{state:i,action:l}=(r=n,a={v:"number"==typeof s.v?s.v:0,navSeq:s.nav?.seq??0,navPath:s.nav?.path??""},r.primed?a.navSeq!==r.lastNavSeq?{state:{primed:!0,lastV:a.v,lastNavSeq:a.navSeq},action:{kind:"push",path:a.navPath}}:a.v!==r.lastV?{state:{...r,lastV:a.v},action:{kind:"refresh"}}:{state:r,action:{kind:"none"}}:{state:{primed:!0,lastV:a.v,lastNavSeq:a.navSeq},action:{kind:"none"}});if(n=i,"refresh"===l.kind)e.refresh();else if("push"===l.kind&&l.path){e.push(l.path);try{window.focus()}catch{}}},()=>r.close()},[e]),(0,n.useEffect)(()=>{let e=(0,i.fk)(),t=()=>{"visible"===document.visibilityState&&document.hasFocus()&&fetch("/api/tab/view",{method:"POST",headers:e?{"x-beacon-workspace":e}:void 0}).catch(()=>{})};t();let r=setInterval(t,3e3);return window.addEventListener("focus",t),document.addEventListener("visibilitychange",t),()=>{clearInterval(r),window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",t)}},[]),null}},82099:(e,t,r)=>{"use strict";r.d(t,{b:()=>s});var n=r(95155);r(12115);var a=r(91337);function s({className:e,children:t,...r}){return(0,n.jsxs)("div",{className:(0,a.cn)("glass relative isolate overflow-hidden",e),...r,children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 -z-10 rounded-[inherit]",style:{background:"radial-gradient(90% 60% at 0% 0%, oklch(1 0 0 / 0.04), transparent 42%)"}}),(0,n.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 -z-10 rounded-[inherit] opacity-[0.035] mix-blend-overlay",style:{backgroundImage:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",backgroundSize:"120px 120px"}}),t]})}},82879:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(30772).A)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]])},90467:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(30772).A)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},91337:(e,t,r)=>{"use strict";r.d(t,{cn:()=>s});var n=r(29722),a=r(622);function s(...e){return(0,a.QP)((0,n.$)(e))}},93492:(e,t,r)=>{"use strict";r.d(t,{I:()=>l,U:()=>i});var n=r(95155),a=r(12115),s=r(91337);function i(e){let[,t]=(0,a.useReducer)(e=>e+1,0);(0,a.useEffect)(()=>{let r=()=>t();return e.on("transaction",r),()=>void e.off("transaction",r)},[e])}function l({label:e,active:t,onClick:r,children:a}){return(0,n.jsx)("button",{type:"button","aria-label":e,"aria-pressed":t,title:e,onMouseDown:e=>e.preventDefault(),onClick:r,className:(0,s.cn)("nodrag nopan rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--ink-hover)] hover:text-foreground",t&&"bg-[var(--ink-active)] text-foreground"),children:a})}},99979:(e,t,r)=>{"use strict";function n(){return new URLSearchParams(window.location.search).get("ws")}function a(){return new URLSearchParams(window.location.search).get("plan")}function s(e){let t=new URLSearchParams,r=n();r&&t.set("ws",r);let s=a();for(let[r,n]of(s&&t.set("plan",s),Object.entries(e??{})))""===n?t.delete(r):t.set(r,n);let i=t.toString();return i?`/plan?${i}`:"/plan"}r.d(t,{X0:()=>n,d8:()=>a,rc:()=>s})}},e=>{e.O(0,[7513,7352,5004,277,8500,4888,2114,5547,8441,3794,7358],()=>e(e.s=75893)),_N_E=e.O()}]);
|
|
@@ -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(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()}]);
|
|
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(30985),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(30985),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,985,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,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()}]);
|
|
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,30985)),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,985,4853,8441,3794,7358],()=>e(e.s=27950)),_N_E=e.O()}]);
|