trybeacon 0.1.6 → 0.1.8

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.
Files changed (112) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +17 -17
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/.next/server/app/api/code-graph/route.js +1 -1
  24. package/.next/server/app/api/code-graph/route.js.nft.json +1 -1
  25. package/.next/server/app/api/context/feature/route.js +1 -1
  26. package/.next/server/app/api/context/feature/route.js.nft.json +1 -1
  27. package/.next/server/app/api/context/file/route.js +1 -1
  28. package/.next/server/app/api/context/file/route.js.nft.json +1 -1
  29. package/.next/server/app/api/workspace/activate/route.js +1 -1
  30. package/.next/server/app/api/workspace/activate/route.js.nft.json +1 -1
  31. package/.next/server/app/apple-icon.png/route.js +1 -1
  32. package/.next/server/app/apple-icon.png/route.js.nft.json +1 -1
  33. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  34. package/.next/server/app/docs.html +1 -1
  35. package/.next/server/app/docs.rsc +3 -3
  36. package/.next/server/app/docs.segments/_full.segment.rsc +3 -3
  37. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  38. package/.next/server/app/docs.segments/_index.segment.rsc +2 -2
  39. package/.next/server/app/docs.segments/_tree.segment.rsc +3 -3
  40. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +2 -2
  41. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  42. package/.next/server/app/feedback/page_client-reference-manifest.js +1 -1
  43. package/.next/server/app/feedback.html +1 -1
  44. package/.next/server/app/feedback.rsc +2 -2
  45. package/.next/server/app/feedback.segments/_full.segment.rsc +2 -2
  46. package/.next/server/app/feedback.segments/_head.segment.rsc +1 -1
  47. package/.next/server/app/feedback.segments/_index.segment.rsc +2 -2
  48. package/.next/server/app/feedback.segments/_tree.segment.rsc +2 -2
  49. package/.next/server/app/feedback.segments/feedback/__PAGE__.segment.rsc +1 -1
  50. package/.next/server/app/feedback.segments/feedback.segment.rsc +1 -1
  51. package/.next/server/app/help/page_client-reference-manifest.js +1 -1
  52. package/.next/server/app/help.html +1 -1
  53. package/.next/server/app/help.rsc +19 -20
  54. package/.next/server/app/help.segments/_full.segment.rsc +19 -20
  55. package/.next/server/app/help.segments/_head.segment.rsc +1 -1
  56. package/.next/server/app/help.segments/_index.segment.rsc +2 -2
  57. package/.next/server/app/help.segments/_tree.segment.rsc +2 -2
  58. package/.next/server/app/help.segments/help/__PAGE__.segment.rsc +1 -1
  59. package/.next/server/app/help.segments/help.segment.rsc +1 -1
  60. package/.next/server/app/icon.svg/route.js +1 -1
  61. package/.next/server/app/icon.svg/route.js.nft.json +1 -1
  62. package/.next/server/app/index.html +1 -1
  63. package/.next/server/app/index.rsc +4 -4
  64. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  65. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  66. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  67. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  68. package/.next/server/app/index.segments/_tree.segment.rsc +3 -3
  69. package/.next/server/app/map/page.js +2 -2
  70. package/.next/server/app/map/page.js.nft.json +1 -1
  71. package/.next/server/app/map/page_client-reference-manifest.js +1 -1
  72. package/.next/server/app/page.js +1 -1
  73. package/.next/server/app/page_client-reference-manifest.js +1 -1
  74. package/.next/server/app/plan/page.js +2 -2
  75. package/.next/server/app/plan/page.js.nft.json +1 -1
  76. package/.next/server/app/plan/page_client-reference-manifest.js +1 -1
  77. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  78. package/.next/server/app-paths-manifest.json +17 -17
  79. package/.next/server/chunks/1130.js +1 -1
  80. package/.next/server/chunks/1172.js +1 -0
  81. package/.next/server/chunks/1813.js +1 -0
  82. package/.next/server/chunks/{299.js → 29.js} +2 -2
  83. package/.next/server/chunks/2933.js +2 -2
  84. package/.next/server/chunks/3777.js +1 -0
  85. package/.next/server/chunks/4490.js +1 -1
  86. package/.next/server/instrumentation.js +1 -1
  87. package/.next/server/middleware-build-manifest.js +1 -1
  88. package/.next/server/pages/404.html +1 -1
  89. package/.next/server/pages/500.html +1 -1
  90. package/.next/server/server-reference-manifest.js +1 -1
  91. package/.next/server/server-reference-manifest.json +1 -1
  92. package/.next/static/chunks/8319-67498a0aab3f714f.js +1 -0
  93. package/.next/static/chunks/8811-57b200845c2e1f2d.js +1 -0
  94. package/.next/static/chunks/app/map/{page-621463528037d2d0.js → page-7c6a7f7b53bcc669.js} +1 -1
  95. package/.next/static/chunks/app/page-ccb55081f850db63.js +1 -0
  96. package/.next/static/chunks/app/plan/{page-95a91a84bb930fc3.js → page-d281cb104d352713.js} +1 -1
  97. package/.next/static/css/c1d125c7e7e0530c.css +1 -0
  98. package/.next/static/css/e63457bec0b3ee27.css +1 -0
  99. package/.next/trace +37 -37
  100. package/.next/trace-build +1 -1
  101. package/package.json +1 -1
  102. package/.next/server/chunks/3530.js +0 -1
  103. package/.next/server/chunks/389.js +0 -1
  104. package/.next/server/chunks/5592.js +0 -1
  105. package/.next/server/chunks/814.js +0 -1
  106. package/.next/static/chunks/5916-65b61f02167fdaa0.js +0 -1
  107. package/.next/static/chunks/6946-4322e809b92dc543.js +0 -1
  108. package/.next/static/chunks/app/page-e0a78bc449569419.js +0 -1
  109. package/.next/static/css/5f11ad1787eeef64.css +0 -1
  110. package/.next/static/css/fb92764fca78149e.css +0 -1
  111. /package/.next/static/{gRhUG5vdhfWUACit2_jxj → vkXAuKrDgeKgSM-4XYCAy}/_buildManifest.js +0 -0
  112. /package/.next/static/{gRhUG5vdhfWUACit2_jxj → vkXAuKrDgeKgSM-4XYCAy}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8811],{4474:(e,t,s)=>{s.d(t,{$:()=>i});var n=s(95155),a=s(6539),r=s(18460),o=s(91337);let l=(0,r.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 i({className:e,variant:t="default",size:s="default",...r}){return(0,n.jsx)(a.Button,{"data-slot":"button",className:(0,o.cn)(l({variant:t,size:s,className:e})),...r})}},18874:(e,t,s)=>{s.d(t,{F1:()=>l,e6:()=>r,qA:()=>a,ru:()=>o});let n={auth:"#4ea1ff",firms:"#c792ea",search:"#7bd389",storage:"#ffb86b",petitions:"#ff7a45",monitoring:"#f5b942",admin:"#ff6b9d"};function a(e){return e&&n[e]||"#8a8a8a"}let r={GET:"#7bd389",POST:"#4ea1ff",PUT:"#ffb86b",PATCH:"#ffb86b",DELETE:"#ff3860"},o={read:"#4ea1ff",write:"#ffb86b","read-write":"#c792ea"};function l(e,t){let s=new Set([e]);for(let n of t)n.source===e&&s.add(n.target),n.target===e&&s.add(n.source);return s}},26518:(e,t,s)=>{s.d(t,{bq:()=>w,eb:()=>C,gC:()=>k,l6:()=>y,yv:()=>N});var n=s(95155);s(12115);var a=s(40595),r=s(41294),o=s(75681),l=s(17314),i=s(37265),d=s(23107),c=s(70826),u=s(67564),m=s(1938),p=s(15433),x=s(5919),h=s(45450),f=s(88988),g=s(91337),b=s(12363),v=s(64577),j=s(94088);let y=a.H;function N({className:e,...t}){return(0,n.jsx)(r.y,{"data-slot":"select-value",className:(0,g.cn)("flex flex-1 text-left",e),...t})}function w({className:e,size:t="default",children:s,...a}){return(0,n.jsxs)(o.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:[s,(0,n.jsx)(l.w,{render:(0,n.jsx)(b.A,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function k({className:e,children:t,side:s="bottom",sideOffset:a=4,align:r="center",alignOffset:o=0,alignItemWithTrigger:l=!0,...m}){return(0,n.jsx)(i.V,{children:(0,n.jsx)(d.l,{side:s,sideOffset:a,align:r,alignOffset:o,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)(E,{}),(0,n.jsx)(u.B,{children:t}),(0,n.jsx)(S,{})]})})})}function C({className:e,children:t,...s}){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),...s,children:[(0,n.jsx)(p.h,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),(0,n.jsx)(x.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 E({className:e,...t}){return(0,n.jsx)(h.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)(j.A,{})})}function S({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,{})})}},26856:(e,t,s)=>{s.d(t,{DbMapClient:()=>Q});var n=s(95155),a=s(12115),r=s(73321),o=s(81750),l=s(6266);s(53255);var i=s(81499),d=s(51128),c=s(65738),u=s(9005),m=s(2125),p=s(91337),x=s(18874);let h=(0,a.createContext)(null);function f(){let e=(0,a.useContext)(h);if(!e)throw Error("useDbEdit must be used inside DbEditContext");return e}var g=s(95635);let b={danger:"bg-red-500/15 text-red-300",warn:"bg-amber-500/15 text-amber-300"};function v({badges:e,className:t}){return e.length?(0,n.jsx)("span",{className:(0,p.cn)("flex shrink-0 items-center gap-0.5",t),children:e.map(e=>(0,n.jsx)("span",{title:e.title,className:(0,p.cn)("rounded px-1 text-[8px] font-semibold uppercase tracking-wide",b[e.tone]),children:e.label},e.label))}):null}let j=/pass(word)?|token|secret|api[_-]?key|credential|priv(ate)?[_-]?key|hash|salt/i,y=/auth|login|logout|session|token|password|oauth|sso|credential/i,N="nodrag nopan",w=g.x,k="nodrag nopan",C=["GET","POST","PUT","PATCH","DELETE"];var E=s(32133),S=s(82099),A=s(4474);let z=[{id:"claude",label:"Prompt p/ Claude Code",fn:function(e){let t=["Implement this database schema in this project, following its existing stack and conventions:",""];for(let s of e.tables){let e=`Table \`${s.name}\``+(s.domain?` (domain: ${s.domain})`:"")+(s.description?` — ${s.description}`:"");for(let n of(t.push(e),s.columns)){let e=[n.isPk&&"PK",n.isFk&&"FK",!1===n.nullable&&"NOT NULL"].filter(Boolean).join(", ");t.push(` - ${n.name}: ${n.type}`+(e?` [${e}]`:"")+(n.note?` — ${n.note}`:""))}t.push("")}if(e.relations.length){for(let s of(t.push("Foreign keys:"),e.relations))t.push(` - ${s.fromTable}.${s.fromColumn} -> ${s.toTable}.${s.toColumn}`);t.push("")}return t.push("Create the models/migrations using the project's existing ORM and patterns, wire the relationships, and keep table and column names exactly as given."),t.join("\n")}},{id:"dbml",label:"DBML",fn:function(e){let t=[];for(let s of e.tables){for(let e of(t.push(`Table ${s.name} {`),s.columns)){let s=[e.isPk&&"pk",!1===e.nullable&&!e.isPk&&"not null",e.note&&`note: '${e.note.replace(/'/g,"")}'`].filter(Boolean).join(", ");t.push(` ${e.name} ${e.type}`+(s?` [${s}]`:""))}t.push("}","")}for(let s of e.relations)t.push(`Ref: ${s.fromTable}.${s.fromColumn} > ${s.toTable}.${s.toColumn}`);return t.join("\n").trim()}},{id:"sql",label:"SQL DDL",fn:function(e){let t=[];for(let s of e.tables){t.push(`CREATE TABLE ${s.name} (`);let n=s.columns.map(e=>{let t=[` ${e.name} ${e.type}`];return e.isPk?t.push("PRIMARY KEY"):!1===e.nullable&&t.push("NOT NULL"),t.join(" ")}),a=e.relations.filter(e=>e.fromTable===s.name).map(e=>` FOREIGN KEY (${e.fromColumn}) REFERENCES ${e.toTable}(${e.toColumn})`);t.push([...n,...a].join(",\n")),t.push(");","")}return t.join("\n").trim()}}];function T({draftGraph:e}){let[t,s]=(0,a.useState)(null);if(0===e.tables.length)return null;async function r(t){await navigator.clipboard.writeText(t.fn(e)).catch(()=>{}),s(t.id),setTimeout(()=>s(null),1500)}return(0,n.jsxs)("div",{className:"space-y-2 rounded-xl border border-sky-400/20 bg-sky-500/[0.04] p-3",children:[(0,n.jsxs)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-sky-300",children:["Rascunho \xb7 ",e.tables.length," tabelas"]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,n.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"copiar:"}),z.map(e=>(0,n.jsx)(A.$,{size:"sm",variant:"outline",className:"h-6 px-2 text-[11px]",onClick:()=>r(e),children:t===e.id?"✓":e.label},e.id))]})]})}function I({selected:e,tables:t,relations:s,endpoints:a,draftGraph:r,onClose:o,commentsContent:l,commentsCount:i=0,activeTab:d,onTabChange:c,onAddComment:m,topOffset:p}){let x,h,f=new Map(t.map(e=>[e.id,e.name])),g=!!l,b=d??"details",v=e?.kind==="table"?t.find(t=>t.id===e.id)?.name??null:e?.kind==="endpoint"&&(h=a.find(t=>t.id===e.id))?`${h.method} ${h.path}`:null;if(e?.kind==="table"){let r=t.find(t=>t.id===e.id);x=r?(0,n.jsx)(R,{table:r,relations:s,endpoints:a,nameById:f}):null}else if(e?.kind==="endpoint"){let t=a.find(t=>t.id===e.id);x=t?(0,n.jsx)(M,{ep:t,nameById:f}):null}else x=(0,n.jsx)($,{tables:t,relations:s,endpoints:a});return(0,n.jsxs)(S.b,{className:"absolute bottom-3 right-3 z-10 flex w-80 flex-col rounded-2xl",style:{top:p??12},children:[g?(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-1 py-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(D,{active:"details"===b,onClick:()=>c?.("details"),children:"Details"}),(0,n.jsxs)(D,{active:"comments"===b,onClick:()=>c?.("comments"),children:["Comments",i>0&&(0,n.jsx)("span",{className:"ml-1 rounded-full bg-white/10 px-1 text-[9px] font-semibold leading-4",children:i})]})]}),(0,n.jsx)("button",{onClick:o,title:"Close panel",className:"mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,n.jsx)(u.A,{className:"size-4"})})]}):(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-3.5 py-2.5",children:[(0,n.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Panel"}),(0,n.jsx)("button",{onClick:o,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,n.jsx)(u.A,{className:"size-4"})})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:"comments"===b&&g?(0,n.jsx)("div",{className:"p-3",children:l}):(0,n.jsxs)(n.Fragment,{children:[r.tables.length>0&&(0,n.jsx)("div",{className:"border-b border-white/10 p-3.5",children:(0,n.jsx)(T,{draftGraph:r})}),(0,n.jsxs)("div",{className:"p-4",children:[m&&v&&(0,n.jsxs)("button",{type:"button",onClick:()=>m(v),className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-lg border border-white/10 bg-white/[0.03] px-3 py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",children:[(0,n.jsx)(E.A,{className:"size-3.5"}),"Comment on this ",e?.kind==="endpoint"?"endpoint":"table"]}),x]})]})})]})}function D({active:e,onClick:t,children:s}){return(0,n.jsx)("button",{type:"button",onClick:t,className:(0,p.cn)("flex items-center gap-1 rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors",e?"bg-white/10 text-foreground":"text-muted-foreground hover:text-foreground"),children:s})}function R({table:e,relations:t,endpoints:s,nameById:a}){let r=t.filter(t=>t.fromTableId===e.id),o=t.filter(t=>t.toTableId===e.id),l=s.map(t=>({e:t,u:t.tables.find(t=>t.tableId===e.id)})).filter(e=>e.u);return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-xs uppercase tracking-wide",style:{color:(0,x.qA)(e.domain)},children:e.domain??"table"}),(0,n.jsx)("h2",{className:"font-mono text-lg font-semibold",children:e.name}),e.description&&(0,n.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description})]}),(0,n.jsx)(P,{title:`Columns (${e.columns.length})`,children:(0,n.jsx)("ul",{className:"space-y-0.5",children:e.columns.map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-1.5 text-xs",children:[e.isPk?(0,n.jsx)(i.A,{className:"size-3 text-amber-400"}):e.isFk?(0,n.jsx)(d.A,{className:"size-3 text-sky-400"}):(0,n.jsx)("span",{className:"size-3"}),(0,n.jsx)("span",{className:"font-mono",children:e.name}),(0,n.jsxs)("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground",children:[e.type,!e.nullable&&" \xb7NN"]})]},e.name))})}),r.length>0&&(0,n.jsx)(P,{title:"References (FK out)",children:(0,n.jsx)("ul",{className:"space-y-1 text-xs",children:r.map(e=>(0,n.jsxs)("li",{className:"font-mono text-muted-foreground",children:[e.fromColumn," → ",a.get(e.toTableId),".",e.toColumn]},e.id))})}),o.length>0&&(0,n.jsx)(P,{title:"Referenced by (FK in)",children:(0,n.jsx)("ul",{className:"space-y-1 text-xs",children:o.map(e=>(0,n.jsxs)("li",{className:"font-mono text-muted-foreground",children:[a.get(e.fromTableId),".",e.fromColumn]},e.id))})}),l.length>0&&(0,n.jsx)(P,{title:`Used by endpoints (${l.length})`,children:(0,n.jsx)("ul",{className:"space-y-1 text-xs",children:l.map(({e,u:t})=>(0,n.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{style:{color:x.e6[e.method]},className:"font-bold",children:e.method}),(0,n.jsx)("span",{className:"truncate font-mono",children:e.path}),(0,n.jsx)("span",{className:"ml-auto",style:{color:x.ru[t.access]},children:t.access})]},e.id))})})]})}function M({ep:e,nameById:t}){return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[11px] font-bold",style:{background:`${x.e6[e.method]}22`,color:x.e6[e.method]},children:e.method}),(0,n.jsx)("h2",{className:"mt-2 font-mono text-base font-semibold",children:e.path}),e.description&&(0,n.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description})]}),(0,n.jsx)(P,{title:`Tables used (${e.tables.length})`,children:(0,n.jsx)("ul",{className:"space-y-1 text-xs",children:e.tables.map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"font-mono",children:t.get(e.tableId)}),(0,n.jsx)("span",{className:"ml-auto",style:{color:x.ru[e.access]},children:e.access})]},e.tableId))})})]})}function $({tables:e,relations:t,endpoints:s}){return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:"Database"}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Live schema derived from your code. Click a table or endpoint to see details. Drag to rearrange — positions are saved."})]}),(0,n.jsxs)("dl",{className:"grid grid-cols-3 gap-2 text-center",children:[(0,n.jsx)(L,{label:"tables",value:e.length}),(0,n.jsx)(L,{label:"FKs",value:t.length}),(0,n.jsx)(L,{label:"endpoints",value:s.length})]}),(0,n.jsx)(P,{title:"Legend",children:(0,n.jsxs)("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,n.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(i.A,{className:"size-3 text-amber-400"})," primary key"]}),(0,n.jsxs)("li",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(d.A,{className:"size-3 text-sky-400"})," foreign key"]}),(0,n.jsx)("li",{children:"— gray line: FK relation between tables"}),(0,n.jsx)("li",{children:"– – dashed line: endpoint uses table (read/write)"})]})})]})}function P({title:e,children:t}){return(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e}),t]})}function L({label:e,value:t}){return(0,n.jsxs)("div",{className:"rounded-lg border border-white/10 bg-white/[0.03] py-2",children:[(0,n.jsx)("div",{className:"text-lg font-semibold",children:t}),(0,n.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e})]})}var O=s(56614),F=s(62311);let _=new Set(["GET","HEAD","OPTIONS"]),H=e=>e.trim().toLowerCase();var B=s(80846),U=s(17356),X=s(45486),K=s(15330),G=s(60976),Z=s(64577),Y=s(57144);let W={dbTable:function({id:e,data:t,selected:s}){var r;let o,l,h="DRAFT"===t.source,g="added"===t.diffStatus?"#7bd389":"modified"===t.diffStatus?"#ffb86b":"#4ea1ff",b="added"===t.diffStatus?"new":"modified"===t.diffStatus?"changed":"draft",y=t.diffChanges?.length?t.diffChanges.join("\n"):"draft",k=h?g:(0,x.qA)(t.domain),C=(r={domain:t.domain,columns:t.columns},o=[],(l=r.columns.filter(e=>j.test(e.name)).map(e=>e.name)).length&&o.push({label:"secrets",tone:"danger",title:`stores credentials: ${l.join(", ")}`}),r.domain&&/auth/i.test(r.domain)&&o.push({label:"auth",tone:"warn",title:"auth-domain table"}),o),E=f(),[S,A]=(0,a.useState)(t.name),[z,T]=(0,a.useState)(t.columns),[I,D]=(0,a.useState)(!1);(0,a.useEffect)(()=>{A(t.name),T(t.columns)},[t.rev]);let R=e=>e.stopPropagation(),M=t=>{T(t),E.patchTable(e,{columns:t})};return h?(0,n.jsxs)("div",{className:(0,p.cn)("w-[252px] overflow-hidden rounded-md border border-dashed bg-card text-card-foreground shadow-sm",s&&"ring-2 ring-[var(--accent,#f5b942)]"),style:{borderColor:`${g}88`},children:[(0,n.jsx)(w,{}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1.5",style:{background:`${k}1f`},children:[(0,n.jsx)("span",{title:y,className:"inline-block size-1.5 shrink-0 rounded-full",style:{background:g}}),(0,n.jsx)("input",{value:S,onChange:e=>A(e.target.value),onBlur:()=>{let s=S.trim();s&&s!==t.name&&E.patchTable(e,{name:s})},onKeyDown:e=>{R(e),"Enter"===e.key&&e.currentTarget.blur()},placeholder:"table",className:(0,p.cn)(N,"min-w-0 flex-1 bg-transparent font-mono text-sm font-semibold outline-none")}),(0,n.jsx)(v,{badges:C}),(0,n.jsx)("span",{title:y,className:"shrink-0 rounded px-1 text-[9px] uppercase tracking-wide",style:{background:`${g}26`,color:g},children:b}),(0,n.jsx)("button",{type:"button",onClick:t=>{R(t),I?E.deleteTable(e):D(!0)},onBlur:()=>D(!1),title:"Delete table",className:(0,p.cn)(N,"shrink-0 transition-colors",I?"text-red-300":"text-muted-foreground hover:text-red-300"),children:(0,n.jsx)(c.A,{className:"size-3"})})]}),(0,n.jsxs)("div",{className:"divide-y divide-border/40",children:[z.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-1 px-2 py-0.5 text-[11px]",children:[(0,n.jsx)("button",{type:"button",onClick:e=>{R(e),M(z.map((e,s)=>s===t?{...e,isPk:!e.isPk}:e))},title:"Primary key",className:(0,p.cn)(N,"shrink-0",e.isPk?"text-amber-400":"text-muted-foreground/40 hover:text-amber-400"),children:(0,n.jsx)(i.A,{className:"size-3"})}),(0,n.jsx)("button",{type:"button",onClick:e=>{R(e),M(z.map((e,s)=>s===t?{...e,isFk:!e.isFk}:e))},title:"Foreign key",className:(0,p.cn)(N,"shrink-0",e.isFk?"text-sky-400":"text-muted-foreground/40 hover:text-sky-400"),children:(0,n.jsx)(d.A,{className:"size-3"})}),(0,n.jsx)("input",{value:e.name,onChange:e=>T(s=>s.map((s,n)=>n===t?{...s,name:e.target.value}:s)),onBlur:()=>M(z),onKeyDown:R,placeholder:"column",className:(0,p.cn)(N,"min-w-0 flex-1 bg-transparent font-mono outline-none")}),(0,n.jsx)("input",{value:e.type,onChange:e=>T(s=>s.map((s,n)=>n===t?{...s,type:e.target.value}:s)),onBlur:()=>M(z),onKeyDown:R,placeholder:"type",className:(0,p.cn)(N,"w-16 shrink-0 bg-transparent text-right font-mono text-[10px] text-muted-foreground outline-none")}),(0,n.jsx)("button",{type:"button",onClick:e=>{R(e),M(z.filter((e,s)=>s!==t))},title:"Remove column",className:(0,p.cn)(N,"shrink-0 text-muted-foreground/40 hover:text-red-300"),children:(0,n.jsx)(u.A,{className:"size-3"})})]},t)),(0,n.jsxs)("button",{type:"button",onClick:e=>{R(e),M([...z,{name:"",type:"text",isPk:!1,isFk:!1,nullable:!0,note:null}])},className:(0,p.cn)(N,"flex w-full items-center gap-1 px-2 py-1 text-[10px] text-muted-foreground hover:text-foreground"),children:[(0,n.jsx)(m.A,{className:"size-3"})," column"]})]})]}):(0,n.jsxs)("div",{className:(0,p.cn)("w-[232px] overflow-hidden rounded-md border bg-card text-card-foreground shadow-sm",s&&"ring-2 ring-[var(--accent,#f5b942)]"),style:{borderColor:`${k}55`},children:[(0,n.jsx)(w,{}),(0,n.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",style:{background:`${k}1f`},children:[(0,n.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-sm font-semibold",children:["INTROSPECTION"===t.source&&(0,n.jsx)("span",{title:"live — derived from your code",className:"inline-block size-1.5 rounded-full bg-emerald-400"}),t.name]}),(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(v,{badges:C}),t.domain&&(0,n.jsx)("span",{className:"text-[10px] uppercase tracking-wide",style:{color:k},children:t.domain})]})]}),(0,n.jsx)("div",{className:"divide-y divide-border/40",children:t.columns.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1 text-[11px]",children:[e.isPk?(0,n.jsx)(i.A,{className:"size-3 shrink-0 text-amber-400"}):e.isFk?(0,n.jsx)(d.A,{className:"size-3 shrink-0 text-sky-400"}):(0,n.jsx)("span",{className:"size-3 shrink-0"}),(0,n.jsx)("span",{className:(0,p.cn)("font-mono",e.isPk&&"font-semibold"),children:e.name}),(0,n.jsx)("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-foreground",children:e.type})]},e.name))})]})},endpoint:function({id:e,data:t,selected:s}){var r;let o,l=x.e6[t.method]??"#8a8a8a",i="DRAFT"===t.source,d="added"===t.diffStatus?"#7bd389":"modified"===t.diffStatus?"#ffb86b":"#4ea1ff",u="added"===t.diffStatus?"new":"modified"===t.diffStatus?"changed":"draft",m=t.diffChanges?.length?t.diffChanges.join("\n"):"draft",h=(r={method:t.method,domain:t.domain,path:t.path},o=[],/^delete$/i.test(r.method.trim())&&o.push({label:"DELETE",tone:"danger",title:"destructive: deletes data"}),(r.domain&&/auth/i.test(r.domain)||y.test(r.path))&&o.push({label:"auth",tone:"warn",title:"auth-related endpoint"}),o),b=f(),[j,N]=(0,a.useState)(t.path),[w,E]=(0,a.useState)(!1);(0,a.useEffect)(()=>{N(t.path)},[t.rev]);let S=e=>e.stopPropagation();return(0,n.jsxs)("div",{className:(0,p.cn)("group flex w-[240px] items-center gap-2 rounded-md border bg-card px-2.5 py-1.5 text-card-foreground shadow-sm",i?"border-dashed":"border-border",s&&"ring-2 ring-[var(--accent,#f5b942)]"),style:i?{borderColor:`${d}88`,background:`${d}0f`}:void 0,children:[(0,n.jsx)(g.x,{}),"INTROSPECTION"===t.source&&(0,n.jsx)("span",{title:"live — derived from your code",className:"inline-block size-1.5 shrink-0 rounded-full bg-emerald-400"}),i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("select",{value:t.method,onChange:t=>b.patchEndpoint(e,{method:t.target.value}),onPointerDown:S,className:(0,p.cn)(k,"shrink-0 rounded bg-transparent text-[10px] font-bold outline-none"),style:{color:l},title:"Method",children:C.map(e=>(0,n.jsx)("option",{value:e,className:"bg-card text-foreground",children:e},e))}),(0,n.jsx)("input",{value:j,onChange:e=>N(e.target.value),onBlur:()=>{let s=j.trim();s&&s!==t.path&&b.patchEndpoint(e,{path:s})},onKeyDown:e=>{S(e),"Enter"===e.key&&e.currentTarget.blur()},className:(0,p.cn)(k,"min-w-0 flex-1 bg-transparent font-mono text-[11px] outline-none")}),(0,n.jsx)(v,{badges:h}),(0,n.jsx)("span",{title:m,className:"shrink-0 rounded px-1 py-0.5 text-[8px] font-semibold uppercase",style:{background:`${d}26`,color:d},children:u}),(0,n.jsx)("button",{type:"button",onClick:t=>{S(t),w?b.deleteEndpoint(e):E(!0)},onBlur:()=>E(!1),title:"Delete",className:(0,p.cn)(k,"shrink-0 transition-colors",w?"text-red-300":"text-muted-foreground hover:text-red-300"),children:(0,n.jsx)(c.A,{className:"size-3"})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-bold",style:{background:`${l}22`,color:l},children:t.method}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px]",children:t.path}),(0,n.jsx)(v,{badges:h}),(0,n.jsx)("button",{type:"button",onClick:t=>{S(t),w?b.deleteRealEndpoint(e):E(!0)},onBlur:()=>E(!1),title:w?"Click again to delete":"Delete endpoint",className:(0,p.cn)(k,"shrink-0 opacity-0 transition-opacity group-hover:opacity-100",w?"text-red-300 opacity-100":"text-muted-foreground hover:text-red-300"),children:(0,n.jsx)(c.A,{className:"size-3"})})]})]})}},q={deletable:Y.I},V="beacon:db-draft",J={proposedAt:0,status:"pending",tables:[],relations:[],endpoints:[]};function Q({tables:e,relations:t,endpoints:s,draft:i,workspaceId:d,embedded:u=!1,draftRef:m,onEdit:f,controlRef:g,commentsContent:b,commentsCount:v=0,onAddComment:j}){let y=(0,r.useRouter)(),[N,w]=(0,a.useState)(!0),[k,C]=(0,a.useState)(null),[E,S]=(0,a.useState)(null),[A,z]=(0,a.useState)(!1),[T,D]=(0,a.useState)("details"),[R,M]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(g)return g.current={open:()=>{z(!0),D("details")},close:()=>{z(!1),D("details")},openComments:()=>{z(!0),D("comments")}},()=>{g&&(g.current=null)}},[g]);let[$,P]=(0,a.useState)(new Set),[L,Y]=(0,a.useState)(new Set),[ee,et]=(0,a.useState)(new Set),[es,en]=(0,a.useState)(()=>({past:[],present:i??J,future:[],rev:0,edited:!1})),ea=es.present,er=(0,a.useCallback)(e=>{en(t=>{let s=e(t.present);return s===t.present?t:{past:[...t.past,t.present].slice(-100),present:s,future:[],rev:t.rev+1,edited:!0}})},[]),eo=(0,a.useCallback)(e=>{en(t=>{let s=e(t.present);return s===t.present?t:{...t,present:s}})},[]),el=(0,a.useCallback)(()=>en(e=>e.past.length?{past:e.past.slice(0,-1),present:e.past[e.past.length-1],future:[e.present,...e.future],rev:e.rev+1,edited:!0}:e),[]),ei=(0,a.useCallback)(()=>en(e=>e.future.length?{past:[...e.past,e.present],present:e.future[0],future:e.future.slice(1),rev:e.rev+1,edited:!0}:e),[]),ed=(0,a.useCallback)(e=>en(t=>({past:[],present:e,future:[],rev:t.rev+1,edited:!1})),[]),ec=(0,a.useRef)(!1),eu=i?.proposedAt??0;(0,a.useEffect)(()=>{let e=null;if(ec.current)i&&i.proposedAt!==ea.proposedAt?e=i:!i&&(ea.tables.length>0||ea.endpoints.length>0)&&(e=J);else{ec.current=!0;let t=null;try{let e=localStorage.getItem(V);if(e){let s=JSON.parse(e);s.workspaceId===d&&s.doc&&i&&s.doc.proposedAt===i.proposedAt&&(t=s.doc)}}catch{}e=t??i??null}e&&ed(e)},[eu]),(0,a.useEffect)(()=>{try{ea.tables.length>0||ea.endpoints.length>0?localStorage.setItem(V,JSON.stringify({workspaceId:d,doc:ea})):localStorage.removeItem(V)}catch{}},[ea,d]),(0,a.useEffect)(()=>{m&&(m.current=ea)},[m,ea]);let em=(0,a.useRef)(!1);(0,a.useEffect)(()=>{es.edited&&!em.current&&(em.current=!0,f?.())},[es.edited,f]);let ep=(0,a.useMemo)(()=>ea.tables.map(e=>({id:e.id,name:e.name,domain:e.domain,description:e.description,source:"DRAFT",x:e.x,y:e.y,columns:e.columns})),[ea]),ex=(0,a.useMemo)(()=>ea.endpoints.map(e=>({id:e.id,method:e.method,path:e.path,domain:e.domain,description:e.description,source:"DRAFT",x:e.x,y:e.y,tables:e.links.map(e=>({tableId:e.tableId,access:e.access}))})),[ea]),eh=(0,a.useMemo)(()=>[...e,...ep],[e,ep]),ef=(0,a.useMemo)(()=>[...s,...ex],[s,ex]),eg=(0,a.useMemo)(()=>new Map,[]),eb=(0,a.useMemo)(()=>u?function(e,t){let s=new Map(e.map(e=>[H(e.name),e])),n=new Map;for(let e of t){let t=s.get(H(e.name));if(!t){n.set(e.id,{status:"added",changes:["new table"]});continue}let a=function(e,t){let s=new Map(e.map(e=>[H(e.name),e])),n=new Set(t.map(e=>H(e.name))),a=[];for(let e of t){let t=s.get(H(e.name));if(!t){a.push(`+ column ${e.name} (${e.type})`);continue}let n=[];H(t.type)!==H(e.type)&&n.push(`type ${t.type}→${e.type}`),t.isPk!==e.isPk&&n.push(e.isPk?"now PK":"no longer PK"),t.isFk!==e.isFk&&n.push(e.isFk?"now FK":"no longer FK"),t.nullable!==e.nullable&&n.push(e.nullable?"now nullable":"now required"),n.length&&a.push(`~ column ${e.name}: ${n.join(", ")}`)}for(let t of e)n.has(H(t.name))||a.push(`- column ${t.name}`);return a}(t.columns,e.columns);n.set(e.id,{status:a.length?"modified":"unchanged",changes:a})}return n}(e,ep):eg,[u,e,ep,eg]),ev=(0,a.useMemo)(()=>u?function(e,t){let s=e=>`${H(e.method)} ${H(e.path)}`,n=new Set(e.map(s)),a=new Map;for(let e of t)a.set(e.id,n.has(s(e))?{status:"unchanged",changes:[]}:{status:"added",changes:["new endpoint"]});return a}(s,ex):eg,[u,s,ex,eg]),ej=(0,a.useMemo)(()=>[...t,...ea.relations.map(e=>({id:e.id,fromTableId:e.fromTableId,toTableId:e.toTableId,fromColumn:e.fromColumn,toColumn:e.toColumn,label:e.label}))],[t,ea.relations]),ey=(0,a.useMemo)(()=>{let e=new Map;for(let t of ef)for(let s of t.tables)e.set(s.tableId,(e.get(s.tableId)??0)+1);return e},[ef]),eN=(0,a.useMemo)(()=>{let e=new Map;return eh.forEach(t=>e.set(t.id,t.x)),ef.forEach(t=>e.set(t.id,t.x)),e},[eh,ef]),ew=(0,a.useCallback)((e,t)=>(eN.get(e)??0)<=(eN.get(t)??0)?{sourceHandle:"sr",targetHandle:"tl"}:{sourceHandle:"sl",targetHandle:"tr"},[eN]),ek=(0,a.useMemo)(()=>new Set([...ea.tables.map(e=>e.id),...ea.endpoints.map(e=>e.id)]),[ea]),eC=(0,a.useMemo)(()=>new Set(e.map(e=>e.id)),[e]),eE=(0,a.useCallback)(()=>[...eh.map(e=>({id:e.id,type:"dbTable",position:{x:e.x,y:e.y},data:{name:e.name,domain:e.domain,columns:e.columns,usageCount:ey.get(e.id)??0,source:e.source,rev:es.rev,diffStatus:eb.get(e.id)?.status,diffChanges:eb.get(e.id)?.changes}})),...ef.map(e=>({id:e.id,type:"endpoint",position:{x:e.x,y:e.y},data:{method:e.method,path:e.path,domain:e.domain,source:e.source,rev:es.rev,diffStatus:ev.get(e.id)?.status,diffChanges:ev.get(e.id)?.changes}}))],[eh,ef,ey,es.rev,eb,ev]),[eS,eA,ez]=(0,o.ck)(eE());(0,a.useEffect)(()=>{eA(e=>{let t=new Map(e.map(e=>[e.id,e.position]));return eE().map(e=>({...e,position:t.get(e.id)??e.position}))})},[eE,eA]);let eT=(0,a.useCallback)((e,t,s,n)=>{fetch("/api/db/position",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:e,id:t,x:s,y:n})})},[]),eI=(0,a.useCallback)((e,t)=>{let{x:s,y:n}=t.position;ek.has(t.id)?eo(e=>e.tables.some(e=>e.id===t.id)?{...e,tables:e.tables.map(e=>e.id===t.id?{...e,x:s,y:n}:e)}:e.endpoints.some(e=>e.id===t.id)?{...e,endpoints:e.endpoints.map(e=>e.id===t.id?{...e,x:s,y:n}:e)}:e):eT("endpoint"===t.type?"endpoint":"table",t.id,s,n)},[ek,eo,eT]),eD=(0,a.useMemo)(()=>ej.map(e=>({id:`fk-${e.id}`,source:e.fromTableId,target:e.toTableId,...ew(e.fromTableId,e.toTableId),type:"deletable",label:e.label??void 0,markerEnd:{type:l.TG.ArrowClosed,color:"#6b6b6b"},style:{stroke:"#6b6b6b"}})),[ej,ew]),eR=(0,a.useMemo)(()=>ef.flatMap(e=>e.tables.map(t=>{let s=x.ru[t.access]??"#5a5a5a";return{id:`u-${e.id}-${t.tableId}`,source:e.id,target:t.tableId,...ew(e.id,t.tableId),type:"default",markerEnd:{type:l.TG.ArrowClosed,color:s},style:{stroke:s,strokeDasharray:"4 4",opacity:.7}}})),[ef,ew]),eM=(0,a.useMemo)(()=>N?[...eD,...eR]:eD,[eD,eR,N]),e$=(0,a.useMemo)(()=>{if(E){let e=eM.find(e=>e.id===E);return e?new Set([e.source,e.target]):null}return k?(0,x.F1)(k.id,eM):null},[k,E,eM]),eP=(0,a.useMemo)(()=>new Map(eh.map(e=>[e.id,{domain:e.domain,source:e.source}])),[eh]),eL=(0,a.useMemo)(()=>new Map(ef.map(e=>[e.id,{method:e.method,source:e.source}])),[ef]),eO=(0,a.useMemo)(()=>{let e=new Set;if(!N)for(let t of eL.keys())e.add(t);for(let[t,s]of eP)!$.size||s.domain&&$.has(s.domain)||e.add(t),L.size&&!L.has(s.source)&&e.add(t);for(let[t,s]of eL)ee.size&&!ee.has(s.method)&&e.add(t),L.size&&!L.has(s.source)&&e.add(t);return e},[N,eP,eL,$,L,ee]),eF=(0,a.useMemo)(()=>eS.map(e=>{let t=eO.has(e.id);return e$?{...e,hidden:t,style:{...e.style,opacity:e$.has(e.id)?1:.45,transition:"opacity 120ms"}}:t?{...e,hidden:t}:e}),[eS,eO,e$]),e_=(0,a.useMemo)(()=>eM.map(e=>{let t=eO.has(e.source)||eO.has(e.target);return k||E?(E?e.id===E:k&&(e.source===k.id||e.target===k.id))?{...e,hidden:t,zIndex:20,style:{...e.style,opacity:1,strokeWidth:2.5}}:{...e,hidden:t,selectable:!1,label:void 0,markerEnd:void 0,style:{...e.style,opacity:.08}}:t?{...e,hidden:t}:e}),[eM,k,E,eO]),eH=(0,a.useMemo)(()=>Array.from(new Set(eh.map(e=>e.domain).filter(e=>!!e))).sort(),[eh]),eB=(0,a.useMemo)(()=>Array.from(new Set([...eh.map(e=>e.source),...ef.map(e=>e.source)])).sort(),[eh,ef]),eU=(0,a.useMemo)(()=>Array.from(new Set(ef.map(e=>e.method))).sort(),[ef]);function eX(e,t){t(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})}let eK=+!N+$.size+L.size+ee.size,eG=(0,a.useCallback)(()=>{w(!0),P(new Set),Y(new Set),et(new Set)},[]),eZ=(0,a.useCallback)(e=>{let{source:t,target:s}=e;t&&s&&t!==s&&er(e=>{if(!(e.tables.some(e=>e.id===s)||eC.has(s)))return e;let n=e.endpoints.find(e=>e.id===t);return n?n.links.some(e=>e.tableId===s)?e:{...e,endpoints:e.endpoints.map(e=>{var n;return e.id===t?{...e,links:[...e.links,{tableId:s,access:(n=e.method,_.has(n.trim().toUpperCase())?"read":"write")}]}:e})}:e.tables.find(e=>e.id===t)?e.relations.some(e=>e.fromTableId===t&&e.toTableId===s)?e:{...e,relations:[...e.relations,{id:crypto.randomUUID(),fromTableId:t,toTableId:s,fromColumn:"fk",toColumn:"id",label:null}]}:e})},[er,eC]),eY=(0,a.useMemo)(()=>({patchEndpoint:(e,t)=>er(s=>({...s,endpoints:s.endpoints.map(s=>s.id===e?{...s,...t}:s)})),deleteEndpoint:e=>er(t=>({...t,endpoints:t.endpoints.filter(t=>t.id!==e)})),patchTable:(e,t)=>er(s=>({...s,tables:s.tables.map(s=>s.id===e?{...s,...t}:s)})),deleteTable:e=>er(t=>({...t,tables:t.tables.filter(t=>t.id!==e),relations:t.relations.filter(t=>t.fromTableId!==e&&t.toTableId!==e),endpoints:t.endpoints.map(t=>({...t,links:t.links.filter(t=>t.tableId!==e)}))})),deleteRealEndpoint:e=>{fetch(`/api/endpoints/${e}`,{method:"DELETE"}).then(e=>{e.ok&&y.refresh()})}}),[er,y]);(0,a.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey))return;let t=e.target;if(t&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName))return;let s=e.key.toLowerCase();"z"===s?(e.preventDefault(),e.shiftKey?ei():el()):"y"===s&&(e.preventDefault(),ei())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[el,ei]);let eW=(0,a.useCallback)(async()=>{M(!0);try{if((await fetch("/api/draft/approve",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ea)})).ok){try{localStorage.removeItem(V)}catch{}ed(J),y.refresh()}}finally{M(!1)}},[ea,ed,y]),eq=(0,a.useCallback)(async()=>{M(!0);try{await fetch("/api/draft",{method:"DELETE"})}catch{}try{localStorage.removeItem(V)}catch{}ed(J),y.refresh(),M(!1)},[ed,y]),eV=(0,a.useMemo)(()=>{let e;return e=new Map(ea.tables.map(e=>[e.id,e.name])),{tables:ea.tables.map(e=>({name:e.name,domain:e.domain,description:e.description,columns:e.columns.map(e=>({name:e.name,type:e.type,isPk:e.isPk,isFk:e.isFk,nullable:e.nullable,note:e.note}))})),relations:ea.relations.flatMap(t=>{let s=e.get(t.fromTableId),n=e.get(t.toTableId);return s&&n?[{fromTable:s,fromColumn:t.fromColumn,toTable:n,toColumn:t.toColumn,label:t.label}]:[]}),endpoints:ea.endpoints.map(t=>({method:t.method,path:t.path,domain:t.domain,description:t.description,uses:t.links.flatMap(t=>{let s=e.get(t.tableId);return s?[{table:s,access:t.access}]:[]})}))}},[ea]),eJ=ea.tables.length>0||ea.endpoints.length>0,eQ=es.past.length>0,e0=es.future.length>0;return(0,n.jsx)(h.Provider,{value:eY,children:(0,n.jsxs)("div",{className:(0,p.cn)("relative w-full",u?"h-full":"h-screen"),children:[(0,n.jsxs)(o.Gc,{nodes:eF,edges:e_,nodeTypes:W,edgeTypes:q,connectionMode:l.WZ.Loose,connectionLineStyle:{stroke:"var(--accent-2,#ff7a45)",strokeWidth:1.5,strokeDasharray:"4 4"},onNodesChange:ez,onConnect:eZ,onNodeClick:(e,t)=>{let s="endpoint"===t.type?"endpoint":"table";C({id:t.id,kind:s}),S(null),z(!0),D("details")},onEdgeClick:(e,t)=>{S(t.id),C(null)},onPaneClick:()=>{C(null),S(null)},onNodeDragStop:eI,onEdgesDelete:e=>{for(let t of e)if(t.id.startsWith("fk-")){let e=t.id.slice(3);fetch(`/api/db/relations/${e}`,{method:"DELETE"})}},onNodesDelete:e=>{for(let t of e)ek.has(t.id)||("endpoint"===t.type?fetch(`/api/endpoints/${t.id}`,{method:"DELETE"}):"dbTable"===t.type&&fetch(`/api/db/tables/${t.id}`,{method:"DELETE"}))},deleteKeyCode:["Backspace","Delete"],colorMode:"dark",fitView:!0,minZoom:.15,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,n.jsx)(o.VS,{gap:22,color:"#2a2a32"}),(0,n.jsx)(o.H2,{position:"bottom-right",className:"!overflow-hidden !rounded-xl !border !border-white/10 [&_button]:!border-white/10 [&_button]:!bg-card/70 [&_button]:!text-foreground [&_button]:!backdrop-blur"}),!u&&(0,n.jsx)(o.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!rounded-xl !border !border-white/10 !bg-card/50 !backdrop-blur",nodeColor:"#555"}),!u&&(0,n.jsx)(o.Zk,{position:"top-center",className:"glass rounded-full px-1 py-0.5",children:(0,n.jsx)(F.Z,{active:"DATABASE",tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"FILES",label:"Files",href:"/map?view=FILES"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"}]})}),(0,n.jsxs)(o.Zk,{position:"top-right",className:(0,p.cn)("flex items-center gap-1 transition-[margin] duration-200",A&&"!mr-[332px]",u&&"hidden"),children:[(0,n.jsxs)(O.er,{title:"Filters",trigger:(e,t)=>(0,n.jsxs)("button",{type:"button",onClick:t,title:"Filters",className:(0,p.cn)("glass relative flex size-8 items-center justify-center rounded-lg transition-colors",e||eK>0?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,n.jsx)(B.A,{className:"size-4"}),eK>0&&(0,n.jsx)("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-[var(--accent-2,#ff7a45)] px-1 text-[9px] font-semibold text-white",children:eK})]}),children:[(0,n.jsx)(O.r1,{title:"Show",children:(0,n.jsx)(O.vu,{tone:"accent",on:N,onClick:()=>w(e=>!e),children:"endpoints"})}),eH.length>0&&(0,n.jsx)(O.r1,{title:"Domain",children:eH.map(e=>(0,n.jsx)(O.vu,{on:$.has(e),onClick:()=>eX(e,P),children:e},e))}),eU.length>0&&(0,n.jsx)(O.r1,{title:"Method",children:eU.map(e=>(0,n.jsx)(O.vu,{on:ee.has(e),onClick:()=>eX(e,et),children:e},e))}),eB.length>0&&(0,n.jsx)(O.r1,{title:"Source",children:eB.map(e=>(0,n.jsx)(O.vu,{on:L.has(e),onClick:()=>eX(e,Y),children:e.toLowerCase()},e))}),eK>0&&(0,n.jsx)("button",{type:"button",onClick:eG,className:"mt-1 w-full rounded-md border border-white/10 px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:"clear filters"})]}),(0,n.jsx)(O.er,{title:"Legend",trigger:(e,t)=>(0,n.jsx)("button",{type:"button",onClick:t,title:"Legend",className:(0,p.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,n.jsx)(U.A,{className:"size-4"})}),children:(0,n.jsxs)("ul",{className:"space-y-1.5 text-[10.5px] text-muted-foreground",children:[(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-[#6b6b6b]"}),(0,n.jsx)("span",{children:"foreign key \xb7 drag from a table handle"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-6 border-t border-dashed",style:{borderColor:"#4ea1ff"}}),(0,n.jsx)("span",{children:"endpoint read \xb7 GET / POST / etc"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-6 border-t border-dashed",style:{borderColor:"#ffb86b"}}),(0,n.jsx)("span",{children:"endpoint write"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"inline-block rounded border border-dashed border-sky-400/50 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-sky-300",children:"draft"}),(0,n.jsx)("span",{children:"agent-proposed \xb7 approve to persist"})]})]})}),!A&&(0,n.jsx)("button",{onClick:()=>z(!0),title:"Show panel",className:"glass flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground",children:(0,n.jsx)(X.A,{className:"size-4"})})]}),eJ&&(0,n.jsxs)(o.Zk,{position:"bottom-center",className:"glass flex items-center gap-1 rounded-xl p-1.5",children:[(0,n.jsxs)("button",{onClick:el,disabled:!eQ,title:"Undo (⌘Z)",className:"flex items-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground disabled:opacity-30 disabled:hover:bg-transparent",children:[(0,n.jsx)(K.A,{className:"size-3.5"})," undo"]}),(0,n.jsxs)("button",{onClick:ei,disabled:!e0,title:"Redo (⇧⌘Z)",className:"flex items-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground disabled:opacity-30 disabled:hover:bg-transparent",children:[(0,n.jsx)(G.A,{className:"size-3.5"})," redo"]}),!u&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"mx-1 h-4 w-px bg-white/10"}),(0,n.jsxs)("button",{onClick:eq,disabled:R,title:"Discard draft",className:"flex 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 disabled:opacity-40",children:[(0,n.jsx)(c.A,{className:"size-3.5"})," discard"]}),(0,n.jsxs)("button",{onClick:eW,disabled:R,title:"Approve and persist to the schema",className:"flex items-center gap-1 rounded-md 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 disabled:opacity-40",children:[(0,n.jsx)(Z.A,{className:"size-3.5"})," approve draft"]})]})]})]}),A&&(0,n.jsx)(I,{selected:k,tables:eh,relations:ej,endpoints:ef,draftGraph:eV,onClose:()=>{z(!1),D("details")},commentsContent:b,commentsCount:v,activeTab:T,onTabChange:D,onAddComment:j,topOffset:u?64:void 0})]})})}},56614:(e,t,s)=>{s.d(t,{er:()=>o,r1:()=>l,vu:()=>i});var n=s(95155),a=s(12115),r=s(91337);function o({trigger:e,title:t,align:s="right",children:l}){let[i,d]=(0,a.useState)(!1),c=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!i)return;let e=e=>{c.current?.contains(e.target)||d(!1)},t=e=>{"Escape"===e.key&&d(!1)};return window.addEventListener("mousedown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("mousedown",e),window.removeEventListener("keydown",t)}},[i]),(0,n.jsxs)("div",{ref:c,className:"relative",children:[e(i,()=>d(e=>!e)),i&&(0,n.jsxs)("div",{className:(0,r.cn)("glass absolute top-full z-30 mt-1.5 w-64 rounded-xl p-3 shadow-xl","right"===s?"right-0":"left-0"),children:[t&&(0,n.jsx)("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:t}),l]})]})}function l({title:e,children:t}){return(0,n.jsxs)("div",{className:"mb-2.5 last:mb-0",children:[(0,n.jsx)("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/80",children:e}),(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:t})]})}function i({on:e,onClick:t,children:s,tone:a="default"}){return(0,n.jsx)("button",{type:"button",onClick:t,className:(0,r.cn)("rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors",{default:e?"border-foreground/40 bg-white/10 text-foreground":"border-white/10 text-muted-foreground hover:text-foreground",danger:e?"border-red-500/40 bg-red-500/15 text-red-300":"border-white/10 text-muted-foreground hover:text-foreground",accent:e?"border-sky-500/40 bg-sky-500/15 text-sky-300":"border-white/10 text-muted-foreground hover:text-foreground"}[a]),children:s})}},57144:(e,t,s)=>{s.d(t,{I:()=>c});var n=s(95155),a=s(81750),r=s(6266),o=s(65738);function l(e){let{x:t,y:s}=e.internals.positionAbsolute,n=e.measured?.width??0,a=e.measured?.height??0;return{x:t,y:s,w:n,h:a,cx:t+n/2,cy:s+a/2}}function i(e,t){let s=l(e),n=l(t),a=s.w/2||1,r=s.h/2||1,o=(n.cx-s.cx)/(2*a)-(n.cy-s.cy)/(2*r),i=(n.cx-s.cx)/(2*a)+(n.cy-s.cy)/(2*r),d=1/(Math.abs(o)+Math.abs(i)||1);return{x:a*d*(o+i)+s.cx,y:r*d*(-o+i)+s.cy}}function d(e,t){let s=l(e),n=Math.round(t.x),a=Math.round(t.y);return n<=Math.round(s.x)+1?r.yX.Left:n>=Math.round(s.x+s.w)-1?r.yX.Right:a<=Math.round(s.y)+1?r.yX.Top:r.yX.Bottom}function c(e){let t,s,{deleteElements:l}=(0,a.VH)(),c=(0,a.JY)(e.source),u=(0,a.JY)(e.target),m=c&&u?(t=i(c,u),s=i(u,c),{sx:t.x,sy:t.y,tx:s.x,ty:s.y,sourcePos:d(c,t),targetPos:d(u,s)}):null,[p,x,h]=(0,r.Fp)(m?{sourceX:m.sx,sourceY:m.sy,sourcePosition:m.sourcePos,targetX:m.tx,targetY:m.ty,targetPosition:m.targetPos}:{sourceX:e.sourceX,sourceY:e.sourceY,sourcePosition:e.sourcePosition,targetX:e.targetX,targetY:e.targetY,targetPosition:e.targetPosition});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.tE,{id:e.id,path:p,style:e.style,markerEnd:e.markerEnd,interactionWidth:20}),e.label&&(0,n.jsx)(a.rV,{children:(0,n.jsx)("div",{style:{position:"absolute",transform:`translate(-50%, -120%) translate(${x}px, ${h}px)`,fontSize:11,color:"#cfcfcf",background:"#161616",padding:"1px 4px",borderRadius:4,pointerEvents:"none"},children:e.label})}),e.selected&&(0,n.jsx)(a.rV,{children:(0,n.jsx)("div",{className:"nodrag nopan",style:{position:"absolute",transform:`translate(-50%, 0) translate(${x}px, ${h+14}px)`,pointerEvents:"all",zIndex:1e3},children:(0,n.jsx)("button",{type:"button",onMouseDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),l({edges:[{id:e.id}]})},title:"Delete (or press Backspace)",className:"flex size-7 items-center justify-center rounded-full border border-white/20 bg-card/95 text-red-300 shadow-lg backdrop-blur-md transition-colors hover:bg-red-500/25 hover:text-red-200",children:(0,n.jsx)(o.A,{className:"size-3.5"})})})})]})}},60874:(e,t,s)=>{s.d(t,{F8:()=>b,NG:()=>x,QH:()=>h,Vq:()=>g,aM:()=>y,cV:()=>w,kz:()=>j,n$:()=>m,pO:()=>o,vB:()=>v});var n=s(95155),a=s(12115),r=s(91337);function o({markdown:e,className:t,variant:s="reading"}){let l=(0,a.useMemo)(()=>m(e),[e]),i="reading"===s;return(0,n.jsx)("div",{className:(0,r.cn)("min-w-0 [overflow-wrap:anywhere]",i?"mx-auto w-full max-w-[66ch] space-y-4 text-[15px] leading-[1.6]":"space-y-3.5 text-[13px] leading-relaxed",t),children:l.map((e,t)=>(0,n.jsx)(N,{block:e,variant:s},t))})}function l(e){let t=e.trim();return t.includes("|")&&t.includes("-")&&/^[\s|:-]+$/.test(t)}function i(e){return""!==e.trim()&&e.includes("|")}function d(e){let t=e.trim();return t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(e=>e.trim())}function c(e){let t=e.trim(),s=t.startsWith(":"),n=t.endsWith(":");return s&&n?"center":n?"right":s?"left":null}let u=/^\s*```[^\s`]*\s*$/;function m(e){let t=e.split("\n"),s=[],n=[],a=()=>{n.length&&(s.push({kind:"p",text:n.join("\n")}),n=[])},r=null,o=()=>{null!==r&&(s.push({kind:"quote",text:r.join("\n")}),r=null)},m=e=>Math.min(6,Math.floor(e.length/2)),p=null,x=null;for(let e=0;e<t.length;e++){let h=t[e];if(null!==p){u.test(h)?(s.push({kind:"code",text:p.join("\n")}),p=null):p.push(h);continue}let f=h.match(/^>\s?(.*)$/);if(f){a(),x=null,(r??=[]).push(f[1]);continue}if(o(),u.test(h)){a(),x=null,p=[];continue}if(/^\s*$/.test(h)){a(),x=null;continue}let g=h.match(/^#### +(.+)$/);if(g){a(),x=null,s.push({kind:"h4",text:g[1]});continue}let b=h.match(/^### +(.+)$/);if(b){a(),x=null,s.push({kind:"h3",text:b[1]});continue}let v=h.match(/^## +(.+)$/);if(v){a(),x=null,s.push({kind:"h2",text:v[1]});continue}let j=h.match(/^# +(.+)$/);if(j){a(),x=null,s.push({kind:"h1",text:j[1]});continue}if(i(h)&&e+1<t.length&&l(t[e+1])){a(),x=null;let n=[d(h)],r=d(t[e+1]).map(c),o=e+2;for(;o<t.length&&i(t[o])&&!l(t[o]);)n.push(d(t[o])),o++;s.push({kind:"table",text:t.slice(e,o).join("\n"),rows:n,align:r}),e=o-1;continue}let y=h.match(/^(\s*)(\d+)\. +(.+)$/);if(y){a(),s.push({kind:"ol",text:y[3],depth:m(y[1]),marker:y[2]}),x=s.length-1;continue}let N=h.match(/^(\s*)- +(.+)$/);if(N){a(),s.push({kind:"ul",text:N[2],depth:m(N[1])}),x=s.length-1;continue}if(null!==x&&0===n.length){s[x].text+=" "+h.trim();continue}n.push(h)}return a(),o(),null!==p&&s.push({kind:"code",text:p.join("\n")}),s}let p=/("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function x({text:e}){let t=function(e){let t=e.trim();if(!t||"{"!==t[0]&&"["!==t[0])return null;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return null}}(e);return(0,n.jsx)("pre",{className:"overflow-x-auto rounded-lg border border-white/10 bg-white/[0.06] p-3 text-[12px] leading-relaxed",children:(0,n.jsx)("code",{className:"whitespace-pre font-mono [overflow-wrap:normal]",children:t?function(e){let t,s=[],a=0,r=0,o=e=>(0,n.jsx)("span",{className:"text-foreground/45",children:e},r++);for(p.lastIndex=0;null!==(t=p.exec(e));){if(t.index>a&&s.push(o(e.slice(a,t.index))),void 0!==t[1]){let e=void 0!==t[2];s.push((0,n.jsx)("span",{className:e?"text-sky-300":"text-emerald-300/90",children:t[1]},r++)),e&&t[2]&&s.push(o(t[2]))}else void 0!==t[3]?s.push((0,n.jsx)("span",{className:"text-purple-300",children:t[3]},r++)):void 0!==t[4]&&s.push((0,n.jsx)("span",{className:"text-amber-300",children:t[4]},r++));a=p.lastIndex}return a<e.length&&s.push(o(e.slice(a))),s}(t):(0,n.jsx)("span",{className:"text-foreground/85",children:e})})})}function h({block:e}){let t=e.rows??[];if(0===t.length)return null;let[s,...a]=t,o=e.align??[],l=e=>"center"===o[e]?"text-center":"right"===o[e]?"text-right":"text-left";return(0,n.jsx)("div",{className:"overflow-x-auto rounded-lg border border-white/10",children:(0,n.jsxs)("table",{className:"w-full border-collapse text-[13px] [overflow-wrap:normal]",children:[(0,n.jsx)("thead",{children:(0,n.jsx)("tr",{className:"border-b border-white/15 bg-white/[0.04]",children:s.map((e,t)=>(0,n.jsx)("th",{className:(0,r.cn)("whitespace-nowrap px-3 py-1.5 font-semibold text-foreground",l(t)),children:(0,n.jsx)(w,{text:e})},t))})}),(0,n.jsx)("tbody",{children:a.map((e,t)=>(0,n.jsx)("tr",{className:"border-b border-white/5 last:border-0",children:e.map((e,t)=>(0,n.jsx)("td",{className:(0,r.cn)("px-3 py-1.5 align-top text-foreground/90",l(t)),children:(0,n.jsx)(w,{text:e})},t))},t))})]})})}let f=["h1","h2","h3","h4"];function g(e){return f.includes(e)}function b(e){let t=f.indexOf(e);return t<0?0:t}function v(e){return`plan-h-${e}`}function j(e){return e.replace(/[`*]/g,"").trim()}function y(e,t,s,a){let o="reading"===s;switch(e.kind){case"h1":return(0,n.jsx)("h1",{id:a,className:o?"scroll-mt-24 text-xl font-semibold tracking-tight text-foreground":"text-base font-semibold text-foreground",children:t});case"h2":return(0,n.jsx)("h2",{id:a,className:o?"mt-6 scroll-mt-24 border-b border-white/10 pb-1 text-lg font-semibold text-foreground":"mt-3 text-sm font-semibold text-muted-foreground",children:t});case"h3":return(0,n.jsx)("h3",{id:a,className:o?"mt-4 scroll-mt-24 text-base font-semibold text-foreground":"mt-2 text-[13px] font-semibold text-foreground",children:t});case"h4":return(0,n.jsx)("h4",{id:a,className:o?"mt-3 scroll-mt-24 text-sm font-semibold text-muted-foreground":"mt-2 text-[13px] font-semibold text-muted-foreground",children:t});case"ul":case"ol":{let s=e.depth??0;return(0,n.jsxs)("div",{className:(0,r.cn)("flex gap-2",o?"text-foreground/95":"text-foreground/90"),style:{marginLeft:`${.75+1.25*s}rem`},children:[(0,n.jsx)("span",{className:"shrink-0 select-none text-muted-foreground tabular-nums",children:"ol"===e.kind?`${e.marker}.`:"•"}),(0,n.jsx)("span",{className:"min-w-0 flex-1",children:t})]})}case"quote":return(0,n.jsx)("blockquote",{className:(0,r.cn)("whitespace-pre-wrap border-l-2 pl-3 italic",o?"border-white/15 text-foreground/80":"border-white/10 text-foreground/75"),children:t});default:return(0,n.jsx)("p",{className:(0,r.cn)("whitespace-pre-wrap",o?"text-foreground/95":"text-foreground/90"),children:t})}}function N({block:e,variant:t}){return"code"===e.kind?(0,n.jsx)(x,{text:e.text}):"table"===e.kind?(0,n.jsx)(h,{block:e}):(0,n.jsx)(n.Fragment,{children:y(e,(0,n.jsx)(w,{text:e.text}),t)})}function w({text:e}){let t=e.split(/(`[^`]+`|\*\*[\s\S]+?\*\*|\*[^*]+\*)/g);return(0,n.jsx)(n.Fragment,{children:t.map((e,t)=>/^`[^`]+`$/.test(e)?(0,n.jsx)("code",{className:"rounded bg-white/5 px-1 font-mono text-[12px]",children:e.slice(1,-1)},t):/^\*\*[\s\S]+\*\*$/.test(e)?(0,n.jsx)("strong",{className:"font-semibold text-foreground",children:(0,n.jsx)(w,{text:e.slice(2,-2)})},t):/^\*[^*]+\*$/.test(e)?(0,n.jsx)("em",{className:"text-muted-foreground",children:(0,n.jsx)(w,{text:e.slice(1,-1)})},t):(0,n.jsx)("span",{children:e},t))})}},62311:(e,t,s)=>{s.d(t,{Z:()=>m});var n=s(95155),a=s(98500),r=s.n(a),o=s(25640),l=s(83599),i=s(94192),d=s(34306),c=s(91337);let u={ROADMAP:o.A,ARCHITECTURE:l.A,FILES:i.A,DATABASE:d.A};function m({tabs:e,active:t}){return(0,n.jsx)("div",{className:"flex items-center gap-0.5",children:e.map(e=>{let s=e.value===t,a=e.Icon??u[e.value];return(0,n.jsxs)(r(),{href:e.href,className:(0,c.cn)("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[12px] font-medium tracking-tight transition-colors",s?"bg-white/10 text-foreground":"text-muted-foreground/80 hover:bg-white/5 hover:text-foreground"),children:[a?(0,n.jsx)(a,{className:"size-3"}):null,(0,n.jsx)("span",{children:e.label})]},e.value)})})}},70521:(e,t,s)=>{s.d(t,{$v:()=>N,EO:()=>b,Lt:()=>x,Rx:()=>w,Zr:()=>k,ck:()=>j,r7:()=>y,tv:()=>h,wd:()=>v});var n=s(95155);s(12115);var a=s(25381),r=s(7121),o=s(51880),l=s(35176),i=s(11248),d=s(82022),c=s(98758),u=s(45362),m=s(91337),p=s(4474);function x({...e}){return(0,n.jsx)(a.V,{"data-slot":"alert-dialog",...e})}function h({...e}){return(0,n.jsx)(r.t,{"data-slot":"alert-dialog-trigger",...e})}function f({...e}){return(0,n.jsx)(o.Z,{"data-slot":"alert-dialog-portal",...e})}function g({className:e,...t}){return(0,n.jsx)(l.X,{"data-slot":"alert-dialog-overlay",className:(0,m.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function b({className:e,size:t="default",...s}){return(0,n.jsxs)(f,{children:[(0,n.jsx)(g,{}),(0,n.jsx)(i.h,{"data-slot":"alert-dialog-content","data-size":t,className:(0,m.cn)("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm 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),...s})]})}function v({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,m.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function j({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,m.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function y({className:e,...t}){return(0,n.jsx)(d.L,{"data-slot":"alert-dialog-title",className:(0,m.cn)("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function N({className:e,...t}){return(0,n.jsx)(c.r,{"data-slot":"alert-dialog-description",className:(0,m.cn)("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function w({className:e,variant:t,size:s,...a}){return(0,n.jsx)(u.H,{"data-slot":"alert-dialog-action",className:(0,m.cn)(e),render:(0,n.jsx)(p.$,{variant:t,size:s}),...a})}function k({className:e,variant:t="outline",size:s="default",...a}){return(0,n.jsx)(u.H,{"data-slot":"alert-dialog-cancel",className:(0,m.cn)(e),render:(0,n.jsx)(p.$,{variant:t,size:s}),...a})}},74350:(e,t,s)=>{s.d(t,{Cf:()=>g,Es:()=>v,L3:()=>j,c7:()=>b,lG:()=>x,rr:()=>y});var n=s(95155);s(12115);var a=s(17112),r=s(51880),o=s(35176),l=s(11248),i=s(45362),d=s(82022),c=s(98758),u=s(91337),m=s(4474),p=s(9005);function x({...e}){return(0,n.jsx)(a.D,{"data-slot":"dialog",...e})}function h({...e}){return(0,n.jsx)(r.Z,{"data-slot":"dialog-portal",...e})}function f({className:e,...t}){return(0,n.jsx)(o.X,{"data-slot":"dialog-overlay",className:(0,u.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function g({className:e,children:t,showCloseButton:s=!0,...a}){return(0,n.jsxs)(h,{children:[(0,n.jsx)(f,{}),(0,n.jsxs)(l.h,{"data-slot":"dialog-content",className:(0,u.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm 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),...a,children:[t,s&&(0,n.jsxs)(i.H,{"data-slot":"dialog-close",render:(0,n.jsx)(m.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,n.jsx)(p.A,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function b({className:e,...t}){return(0,n.jsx)("div",{"data-slot":"dialog-header",className:(0,u.cn)("flex flex-col gap-2",e),...t})}function v({className:e,showCloseButton:t=!1,children:s,...a}){return(0,n.jsxs)("div",{"data-slot":"dialog-footer",className:(0,u.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...a,children:[s,t&&(0,n.jsx)(i.H,{render:(0,n.jsx)(m.$,{variant:"outline"}),children:"Close"})]})}function j({className:e,...t}){return(0,n.jsx)(d.L,{"data-slot":"dialog-title",className:(0,u.cn)("font-heading text-base leading-none font-medium",e),...t})}function y({className:e,...t}){return(0,n.jsx)(c.r,{"data-slot":"dialog-description",className:(0,u.cn)("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}},82099:(e,t,s)=>{s.d(t,{b:()=>r});var n=s(95155);s(12115);var a=s(91337);function r({className:e,children:t,...s}){return(0,n.jsxs)("div",{className:(0,a.cn)("glass relative isolate overflow-hidden",e),...s,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]})}},91337:(e,t,s)=>{s.d(t,{cn:()=>r});var n=s(29722),a=s(622);function r(...e){return(0,a.QP)((0,n.$)(e))}},95635:(e,t,s)=>{s.d(t,{x:()=>o});var n=s(95155),a=s(81750),r=s(6266);function o(){let e="!h-2 !w-2 !border-0 !bg-zinc-400";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.h7,{type:"target",position:r.yX.Top,id:"tt",className:e}),(0,n.jsx)(a.h7,{type:"source",position:r.yX.Top,id:"st",className:e}),(0,n.jsx)(a.h7,{type:"target",position:r.yX.Right,id:"tr",className:e}),(0,n.jsx)(a.h7,{type:"source",position:r.yX.Right,id:"sr",className:e}),(0,n.jsx)(a.h7,{type:"target",position:r.yX.Bottom,id:"tb",className:e}),(0,n.jsx)(a.h7,{type:"source",position:r.yX.Bottom,id:"sb",className:e}),(0,n.jsx)(a.h7,{type:"target",position:r.yX.Left,id:"tl",className:e}),(0,n.jsx)(a.h7,{type:"source",position:r.yX.Left,id:"sl",className:e})]})}},98378:(e,t,s)=>{s.d(t,{MapClient:()=>ef});var n=s(95155),a=s(12115),r=s(98112),o=s(6266),l=s(81750);s(53255);var i=s(17356),d=s(2125),c=s(15480),u=s(65377),m=s(17494),p=s(80846),x=s(45486),h=s(95635),f=s(65408),g=s(8962),b=s(84824),v=s(5736),j=s(86272),y=s(65738),N=s(40638),w=s(26518);let k=["PENDING","IN_PROGRESS","DONE","BLOCKED","CANCELLED","DEPRIORITIZED"],C=["KEEP","REBUILD","REPLACE","DROP"],E=["IN_PROGRESS","PENDING","BLOCKED","DONE","DEPRIORITIZED","CANCELLED"],S={DONE:{label:"Done",className:"border-emerald-500/30 bg-emerald-500/15 text-emerald-300"},IN_PROGRESS:{label:"In progress",className:"border-sky-500/30 bg-sky-500/15 text-sky-300"},PENDING:{label:"Pending",className:"border-amber-500/30 bg-amber-500/10 text-amber-200"},BLOCKED:{label:"Blocked",className:"border-orange-500/30 bg-orange-500/15 text-orange-300"},CANCELLED:{label:"Cancelled",className:"border-zinc-500/30 bg-zinc-500/10 text-zinc-400 line-through"},DEPRIORITIZED:{label:"Deprioritized",className:"border-zinc-600/40 bg-zinc-600/10 text-zinc-400"},KEEP:{label:"Keep",className:"border-emerald-500/30 bg-emerald-500/15 text-emerald-300"},REBUILD:{label:"Rebuild",className:"border-violet-500/30 bg-violet-500/15 text-violet-300"},REPLACE:{label:"Replace",className:"border-rose-500/30 bg-rose-500/15 text-rose-300"},DROP:{label:"Drop",className:"border-zinc-500/30 bg-zinc-500/10 text-zinc-400 line-through"}},A=["bg-emerald-500/15 text-emerald-300","bg-sky-500/15 text-sky-300","bg-violet-500/15 text-violet-300","bg-amber-500/15 text-amber-200","bg-rose-500/15 text-rose-300","bg-cyan-500/15 text-cyan-300","bg-fuchsia-500/15 text-fuchsia-300","bg-lime-500/15 text-lime-300","bg-orange-500/15 text-orange-300","bg-teal-500/15 text-teal-300","bg-indigo-500/15 text-indigo-300","bg-pink-500/15 text-pink-300"];function z(e){let t=(e??"").trim().toUpperCase();if(!t)return"bg-white/[0.06] text-muted-foreground";let s=0;for(let e=0;e<t.length;e++)s=31*s+t.charCodeAt(e)>>>0;return A[s%A.length]}let T=(0,a.createContext)(null);var I=s(60874),D=s(91337);let R=[{v:0,l:"P0 \xb7 critical"},{v:1,l:"P1 \xb7 high"},{v:2,l:"P2 \xb7 medium"},{v:3,l:"P3 \xb7 low"}],M="nodrag nopan";function $({id:e,data:t,selected:s}){let{categories:r,statuses:o,patch:l,isExpanded:i,toggleExpand:d,openDetailed:c,removeNode:u,editingTitleId:m,onAskAgent:p}=function(){let e=(0,a.useContext)(T);if(!e)throw Error("useNodeEdit must be used inside NodeEditContext");return e}(),k=i(e),[C,E]=(0,a.useState)(!1),[A,P]=(0,a.useState)(!1),[L,O]=(0,a.useState)(t.title),[F,_]=(0,a.useState)(t.cluster??""),[H,B]=(0,a.useState)(t.plain??""),U=0===t.priority,X="CANCELLED"===t.status||"DROP"===t.status,K="DEPRIORITIZED"===t.status,G="DRAFT"===t.source,Z="IN_PROGRESS"===t.status,Y="INIT"===t.source&&"ROADMAP"===t.view,W=e=>e.stopPropagation();return(0,n.jsxs)("div",{className:(0,D.cn)("rounded-lg border bg-card px-2.5 py-2 text-card-foreground shadow-sm transition",k?"w-80":t.isChild?"w-56":"w-64",G?"border-dashed border-sky-400/50 bg-sky-500/[0.06]":Y?"border-dashed border-violet-400/60 bg-violet-500/[0.07] shadow-[0_0_0_1px_rgba(167,139,250,0.18)]":U?"border-[#ff3860]/60 shadow-[0_0_0_1px_rgba(255,56,96,0.15)]":"border-border",Z&&"border-sky-400/60 shadow-[0_0_0_1px_rgba(56,160,255,0.25)]",t.isNext&&"border-emerald-400/70 shadow-[0_0_0_2px_rgba(52,211,153,0.35)]",s&&"ring-2 ring-[var(--accent,#f5b942)]",X&&"opacity-60",K&&"opacity-70 border-dashed"),children:[(0,n.jsx)(h.x,{}),t.isNext&&(0,n.jsx)("div",{className:"mb-1 inline-flex items-center gap-1 rounded bg-emerald-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-emerald-300",children:"work on next"}),(0,n.jsxs)("div",{className:"flex items-start gap-1.5",children:[Z&&(0,n.jsx)("span",{title:"em andamento",className:"mt-1.5 inline-block size-2 shrink-0 animate-pulse rounded-full bg-sky-400"}),t.isCriterion&&!Z&&(0,n.jsx)("span",{title:"Success criterion",className:"mt-1.5 inline-block size-1.5 shrink-0 rounded-full bg-[var(--accent,#f5b942)]"}),(0,n.jsx)("textarea",{rows:1,value:L,autoFocus:m===e,placeholder:"Title…",onFocus:t=>{m===e&&t.currentTarget.select()},onChange:e=>O(e.target.value),onBlur:()=>{let s=L.trim();s&&s!==t.title&&l(e,{title:s},!0)},onKeyDown:e=>{W(e),"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.currentTarget.blur())},className:(0,D.cn)(M,"field-sizing-content w-full resize-none bg-transparent text-sm font-medium leading-snug outline-none placeholder:text-muted-foreground/60",X&&"line-through")}),(0,n.jsx)("button",{type:"button",onClick:t=>{W(t),d(e)},title:k?"Collapse":"Expand",className:(0,D.cn)(M,"mt-0.5 shrink-0 text-muted-foreground hover:text-foreground"),children:k?(0,n.jsx)(f.A,{className:"size-3.5"}):(0,n.jsx)(g.A,{className:"size-3.5"})})]}),((t.signals?.untested??0)>0||t.signals?.auth)&&(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1",children:[(t.signals?.untested??0)>0&&(0,n.jsxs)("span",{title:`${t.signals.untested} of ${t.signals.total} attached file(s) have no test importing them`,className:"flex items-center gap-1 rounded bg-amber-500/15 px-1 text-[9px] font-semibold uppercase tracking-wide text-amber-300",children:[(0,n.jsx)(b.A,{className:"size-2.5"}),t.signals.untested," untested"]}),t.signals?.auth&&(0,n.jsxs)("span",{title:"touches auth-sensitive files",className:"flex items-center gap-1 rounded bg-red-500/15 px-1 text-[9px] font-semibold uppercase tracking-wide text-red-300",children:[(0,n.jsx)(v.A,{className:"size-2.5"})," auth"]})]}),t.role&&(0,n.jsx)("div",{className:(0,D.cn)("mt-0.5 text-[10px] leading-snug text-muted-foreground",!k&&"line-clamp-1"),children:t.role}),(0,n.jsxs)("div",{className:"mt-2 flex items-center gap-1.5",children:["ROADMAP"===t.view?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{title:t.isChild?"Sub-task of a feature":"Feature — top-level roadmap item",className:(0,D.cn)("shrink-0 rounded px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide",t.isChild?"bg-zinc-500/15 text-zinc-300":"bg-sky-500/15 text-sky-300"),children:t.isChild?"sub-task":"feature"}),Y&&(0,n.jsxs)("span",{className:"flex items-center gap-1 rounded bg-violet-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-violet-300",children:[(0,n.jsx)(j.A,{className:"size-2.5"})," IA"]}),(0,n.jsx)("input",{list:`cats-${e}`,value:F,placeholder:"category",onChange:e=>_(e.target.value),onBlur:()=>{let s=F.trim()||null;s!==(t.cluster??null)&&l(e,{cluster:s},!0)},onKeyDown:e=>{W(e),"Enter"===e.key&&e.currentTarget.blur()},className:(0,D.cn)(M,"field-sizing-content min-w-12 max-w-[65%] rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide outline-none focus:brightness-125",z(F))})]}):(0,n.jsxs)(n.Fragment,{children:[t.isChild&&(0,n.jsx)("span",{title:"Sub-component",className:"shrink-0 rounded bg-zinc-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-zinc-300",children:"sub"}),(0,n.jsx)("input",{list:`cats-${e}`,value:F,placeholder:"domain",title:"Architecture domain — the lane this component lives in",onChange:e=>_(e.target.value),onBlur:()=>{let s=F.trim()||null;s!==(t.cluster??null)&&l(e,{cluster:s},!0)},onKeyDown:e=>{W(e),"Enter"===e.key&&e.currentTarget.blur()},className:(0,D.cn)(M,"field-sizing-content min-w-12 max-w-[65%] rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide outline-none focus:brightness-125",z(F))})]}),(0,n.jsx)("datalist",{id:`cats-${e}`,children:r.map(e=>(0,n.jsx)("option",{value:e},e))}),(0,n.jsxs)(w.l6,{value:t.status,onValueChange:t=>l(e,{status:t},!0),children:[(0,n.jsx)(w.bq,{className:(0,D.cn)(M,"ml-auto h-6 shrink-0 gap-1 rounded border px-1.5 py-0 text-[10px] font-medium",S[t.status]?.className??"border-white/10"),children:(0,n.jsx)(w.yv,{children:e=>S[e]?.label??e})}),(0,n.jsx)(w.gC,{alignItemWithTrigger:!1,children:o.map(e=>(0,n.jsx)(w.eb,{value:e,children:S[e]?.label??e},e))})]})]}),k&&(0,n.jsxs)("div",{className:"mt-2 space-y-2 border-t border-white/10 pt-2",children:[A||!H.trim()?(0,n.jsx)("textarea",{autoFocus:A,value:H,placeholder:"Description (markdown)…",onChange:e=>B(e.target.value),onBlur:()=>{P(!1);let s=H.trim()||null;s!==(t.plain??null)&&l(e,{plain:s},!0)},onKeyDown:W,rows:3,className:(0,D.cn)(M,"field-sizing-content max-h-[24rem] min-h-[4.5rem] w-full resize-y rounded bg-white/[0.04] px-1.5 py-1 text-xs outline-none placeholder:text-muted-foreground/50 focus:bg-white/[0.08]")}):(0,n.jsx)("div",{onClick:e=>{W(e),P(!0)},title:"Click to edit",className:"cursor-text rounded bg-white/[0.02] px-1.5 py-1 text-xs hover:bg-white/[0.05]",children:(0,n.jsx)(I.pO,{markdown:H,variant:"compact",className:"text-[12px]"})}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsxs)(w.l6,{value:String(t.priority),onValueChange:t=>l(e,{priority:Number(t)},!0),children:[(0,n.jsx)(w.bq,{className:(0,D.cn)(M,"h-6 gap-1 rounded border-white/10 px-1.5 py-0 text-[10px]"),children:(0,n.jsx)(w.yv,{children:e=>R.find(t=>String(t.v)===e)?.l??e})}),(0,n.jsx)(w.gC,{alignItemWithTrigger:!1,children:R.map(e=>(0,n.jsx)(w.eb,{value:String(e.v),children:e.l},e.v))})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsxs)("button",{type:"button",onClick:t=>{W(t),C?u(e):E(!0)},onBlur:()=>E(!1),title:"Delete node",className:(0,D.cn)(M,"flex items-center gap-1 rounded px-1.5 py-1 text-[10px] transition-colors",C?"bg-red-500/20 text-red-300":"text-muted-foreground hover:bg-white/5 hover:text-red-300"),children:[(0,n.jsx)(y.A,{className:"size-3"}),C&&"Delete?"]}),p&&(0,n.jsxs)("button",{type:"button",onClick:e=>{W(e),p(`feature: ${t.title}`)},title:"Ask the agent a question about this feature (answered in its next round)",className:(0,D.cn)(M,"flex items-center gap-1 rounded px-1.5 py-1 text-[10px] text-sky-300/90 hover:bg-sky-500/15 hover:text-sky-300"),children:[(0,n.jsx)(N.A,{className:"size-3"})," Ask"]}),(0,n.jsxs)("button",{type:"button",onClick:t=>{W(t),c(e)},className:(0,D.cn)(M,"flex items-center gap-1 rounded px-1.5 py-1 text-[10px] text-muted-foreground hover:bg-white/5 hover:text-foreground"),children:[(0,n.jsx)(x.A,{className:"size-3"})," Details"]})]})]})]})]})}var P=s(57144),L=s(73321),O=s(9005),F=s(32133),_=s(82099),H=s(4474),B=s(70521),U=s(74350);function X({className:e,type:t,...s}){return(0,n.jsx)("input",{type:t,"data-slot":"input",className:(0,D.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...s})}function K({className:e,...t}){return(0,n.jsx)("textarea",{"data-slot":"textarea",className:(0,D.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}var G=s(61388);function Z({className:e,...t}){return(0,n.jsx)(G.b,{"data-slot":"label",className:(0,D.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}var Y=s(9339);let W=(0,Y.createServerReference)("4085502f8076ac8b14d776d0935ba24e4bea4253c5",Y.callServer,void 0,Y.findSourceMapURL,"createNodeAction"),q=(0,Y.createServerReference)("605cc0119d2970cbb18ae441cd66e0396a88af8f76",Y.callServer,void 0,Y.findSourceMapURL,"updateNodeAction");function V({open:e,onOpenChange:t,mode:s,view:r,heading:o,nodeId:l,parentId:i,position:d,defaults:c}){let u=(0,L.useRouter)(),[m,p]=(0,a.useState)(c?.title??""),[x,h]=(0,a.useState)(c?.role??""),[f,g]=(0,a.useState)(c?.plain??""),[b,v]=(0,a.useState)(c?.cluster??""),[j,y]=(0,a.useState)(c?.status??("ARCHITECTURE"===r?"REBUILD":"PENDING")),[N,E]=(0,a.useState)(!1),A="ARCHITECTURE"===r?C:k;async function z(){if(m.trim()){E(!0);try{"create"===s?await W({view:r,title:m.trim(),role:x.trim()||null,plain:f.trim()||null,cluster:b.trim()||null,parentId:i??null,status:j,x:d?.x??60,y:d?.y??60}):l&&await q(l,{title:m.trim(),role:x.trim()||null,plain:f.trim()||null,cluster:b.trim()||null,status:j}),t(!1),u.refresh()}finally{E(!1)}}}return(0,n.jsx)(U.lG,{open:e,onOpenChange:t,children:(0,n.jsxs)(U.Cf,{children:[(0,n.jsx)(U.c7,{children:(0,n.jsx)(U.L3,{children:o})}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(Z,{htmlFor:"nf-title",children:"Title"}),(0,n.jsx)(X,{id:"nf-title",value:m,autoFocus:!0,onChange:e=>p(e.target.value)})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(Z,{htmlFor:"nf-role",children:"Role (one line)"}),(0,n.jsx)(X,{id:"nf-role",value:x,onChange:e=>h(e.target.value)})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(Z,{htmlFor:"nf-plain",children:"Description"}),(0,n.jsx)(K,{id:"nf-plain",rows:3,value:f,onChange:e=>g(e.target.value)})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(Z,{children:"Status"}),(0,n.jsxs)(w.l6,{value:j,onValueChange:e=>null!=e&&y(e),children:[(0,n.jsx)(w.bq,{children:(0,n.jsx)(w.yv,{children:e=>S[e]?.label??e})}),(0,n.jsx)(w.gC,{children:A.map(e=>(0,n.jsx)(w.eb,{value:e,children:S[e]?.label??e},e))})]})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)(Z,{htmlFor:"nf-cluster",children:"Cluster / lane"}),(0,n.jsx)(X,{id:"nf-cluster",value:b,onChange:e=>v(e.target.value)})]})]})]}),(0,n.jsxs)(U.Es,{children:[(0,n.jsx)(H.$,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,n.jsx)(H.$,{onClick:z,disabled:N||!m.trim(),children:N?"Saving…":"Save"})]})]})})}let J=(0,Y.createServerReference)("4055544e1ba3bb0f316d2ea39f6e452466d29b665e",Y.callServer,void 0,Y.findSourceMapURL,"acceptSuggestionAction"),Q=(0,Y.createServerReference)("402b83934babae9d78f618e7479484a043c9d56a4e",Y.callServer,void 0,Y.findSourceMapURL,"deleteNodeAction"),ee=(0,Y.createServerReference)("60f37ce4d2e928380a13b9bd3aed7837e5b5fde2e4",Y.callServer,void 0,Y.findSourceMapURL,"setStatusAction"),et=(0,Y.createServerReference)("40f737ef546178b8bf80ba5fb058c4307ab268a7ec",Y.callServer,void 0,Y.findSourceMapURL,"cancelAction"),es=(0,Y.createServerReference)("40b228b9d37242d21338e76620e56aa03e5611e109",Y.callServer,void 0,Y.findSourceMapURL,"deprioritizeAction");function en({view:e,selected:t,allNodes:s,onClose:a,commentsContent:r,commentsCount:o=0,activeTab:l,onTabChange:i,onAddComment:d,topOffset:c}){let u=!!r,m=l??"details";return(0,n.jsxs)(_.b,{className:"absolute bottom-3 right-3 z-10 flex w-80 flex-col rounded-2xl",style:{top:c??12},children:[u?(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-1 py-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(ea,{active:"details"===m,onClick:()=>i?.("details"),children:"Details"}),(0,n.jsxs)(ea,{active:"comments"===m,onClick:()=>i?.("comments"),children:["Comments",o>0&&(0,n.jsx)("span",{className:"ml-1 rounded-full bg-white/10 px-1 text-[9px] font-semibold leading-4",children:o})]})]}),(0,n.jsx)("button",{onClick:a,title:"Close panel",className:"mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,n.jsx)(O.A,{className:"size-4"})})]}):(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-white/10 px-3.5 py-2.5",children:[(0,n.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Details"}),(0,n.jsx)("button",{onClick:a,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,n.jsx)(O.A,{className:"size-4"})})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,n.jsx)("div",{className:"p-3",children:"comments"===m&&u?r:t?(0,n.jsxs)(n.Fragment,{children:[d&&(0,n.jsxs)("button",{type:"button",onClick:()=>d(t.title),className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-lg border border-white/10 bg-white/[0.03] px-3 py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",children:[(0,n.jsx)(F.A,{className:"size-3.5"}),"Comment on this ","ARCHITECTURE"===e?"component":"feature"]}),(0,n.jsx)(er,{node:t,view:e},t.id)]}):(0,n.jsx)(eo,{view:e,nodes:s})})})]})}function ea({active:e,onClick:t,children:s}){return(0,n.jsx)("button",{type:"button",onClick:t,className:(0,D.cn)("flex items-center gap-1 rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors",e?"bg-white/10 text-foreground":"text-muted-foreground hover:text-foreground"),children:s})}function er({node:e,view:t}){var s;let r=(0,L.useRouter)(),[o,l]=(0,a.useTransition)(),[i,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(!1),m="ARCHITECTURE"===t?C:k,p=e=>l(async()=>{await e(),r.refresh()});return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:[(s=e.cluster,s?.trim()||"—"),0===e.priority&&(0,n.jsx)("span",{className:"ml-2 text-[#ff7a90]",children:"\xb7 critical path"})]}),(0,n.jsx)("h2",{className:"mt-1 text-lg font-semibold leading-tight",children:e.title})]}),"INIT"===e.source&&(0,n.jsxs)("div",{className:"rounded-lg border border-violet-400/30 bg-violet-500/[0.06] p-2.5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-violet-300",children:[(0,n.jsx)(j.A,{className:"size-3.5"})," AI suggestion"]}),(0,n.jsx)("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:"Suggested direction surfaced when mapping the repo. Accept to turn it into your own feature, or dismiss."}),(0,n.jsxs)("div",{className:"mt-2 flex gap-1.5",children:[(0,n.jsx)(H.$,{size:"sm",className:"h-7 px-2.5 text-xs",disabled:o,onClick:()=>p(()=>J(e.id)),children:"Accept"}),(0,n.jsx)(H.$,{size:"sm",variant:"outline",className:"h-7 px-2.5 text-xs text-muted-foreground",disabled:o,onClick:()=>p(()=>Q(e.id)),children:"Dismiss"})]})]}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"Status"}),(0,n.jsxs)(w.l6,{value:e.status,onValueChange:t=>null!=t&&p(()=>ee(e.id,t)),children:[(0,n.jsx)(w.bq,{className:"h-8",disabled:o,children:(0,n.jsx)(w.yv,{children:e=>S[e]?.label??e})}),(0,n.jsx)(w.gC,{children:m.map(e=>(0,n.jsx)(w.eb,{value:e,children:S[e]?.label??e},e))})]})]}),e.plain&&(0,n.jsx)("div",{className:"rounded-md border border-white/5 bg-card/40 px-2.5 py-2 text-sm",children:(0,n.jsx)(I.pO,{markdown:e.plain,variant:"compact",className:"text-[12.5px]"})}),e.sourceRef&&(0,n.jsx)("div",{className:"rounded-md border border-border bg-card px-2 py-1.5 font-mono text-xs text-muted-foreground",children:e.sourceRef}),e.files.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("h3",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Files (",e.files.length,")"]}),(0,n.jsx)("ul",{className:"space-y-0.5",children:e.files.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)("button",{onClick:()=>fetch(`/api/open?path=${encodeURIComponent(e)}`).catch(()=>{}),title:`Open ${e} in editor`,className:"block w-full truncate rounded px-1.5 py-0.5 text-left font-mono text-[11px] text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:e})},e))})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-1.5 pt-1",children:[(0,n.jsx)(H.$,{size:"sm",variant:"outline",onClick:()=>d(!0),children:"Edit"}),(0,n.jsx)(H.$,{size:"sm",variant:"outline",onClick:()=>u(!0),children:"+ Sub-node"}),(0,n.jsx)(H.$,{size:"sm",variant:"outline",disabled:o,onClick:()=>p(()=>et(e.id)),children:"Cancel"}),(0,n.jsx)(H.$,{size:"sm",variant:"outline",disabled:o,onClick:()=>p(()=>es(e.id)),children:"Deprioritize"}),(0,n.jsxs)(B.Lt,{children:[(0,n.jsx)(B.tv,{render:(0,n.jsx)(H.$,{size:"sm",variant:"outline",className:"text-red-300",children:"Delete"})}),(0,n.jsxs)(B.EO,{children:[(0,n.jsxs)(B.wd,{children:[(0,n.jsxs)(B.r7,{children:["Delete “",e.title,"”?"]}),(0,n.jsx)(B.$v,{children:"This removes the node and all its sub-nodes. It can’t be undone."})]}),(0,n.jsxs)(B.ck,{children:[(0,n.jsx)(B.Zr,{children:"Cancel"}),(0,n.jsx)(B.Rx,{onClick:()=>p(()=>Q(e.id)),children:"Delete"})]})]})]})]}),i&&(0,n.jsx)(V,{open:!0,onOpenChange:d,mode:"edit",view:t,heading:"Edit node",nodeId:e.id,defaults:{title:e.title,role:e.role,plain:e.plain,status:e.status,cluster:e.cluster}}),c&&(0,n.jsx)(V,{open:!0,onOpenChange:u,mode:"create",view:t,heading:"New sub-node",parentId:e.id,position:{x:e.x,y:e.y+120},defaults:{cluster:e.cluster}})]})}function eo({view:e,nodes:t}){let s=t.filter(e=>0===e.priority).length;return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:"ROADMAP"===e?"Roadmap":"Architecture"}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Click a node for details and actions. Drag to rearrange — positions are saved."})]}),(0,n.jsxs)("dl",{className:"grid grid-cols-2 gap-2 text-center",children:[(0,n.jsx)(el,{label:"nodes",value:t.length}),(0,n.jsx)(el,{label:"critical",value:s})]})]})}function el({label:e,value:t}){return(0,n.jsxs)("div",{className:"rounded-md border border-border bg-card py-2",children:[(0,n.jsx)("div",{className:"text-lg font-semibold",children:t}),(0,n.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e})]})}var ei=s(18874),ed=s(62311),ec=s(56614);let eu=[{value:"cluster",label:"Theme"},{value:"status",label:"Status"},{value:"priority",label:"Priority"}],em=new Set(["title","role","plain","cluster","status","priority"]),ep={roadmapNode:$,archNode:$},ex={deletable:P.I},eh={CONTAINS:{stroke:"#7c7c8a"},DEPENDS:{stroke:"#f5b942",dash:"6 4"},RELATES:{stroke:"#8a8a95",dash:"4 4"},REPLACES:{stroke:"#ff6b9d"}};function ef({view:e,nodes:t,edges:s,workOnNextId:h=null,embedded:f=!1,commentsContent:g,commentsCount:b=0,controlRef:v,onAskAgent:j,onAddComment:y}){let N=(0,a.useMemo)(()=>t.map(e=>({id:e.id,type:"ROADMAP"===e.view?"roadmapNode":"archNode",position:{x:e.x,y:e.y},data:{title:e.title,role:e.role,plain:e.plain,status:e.status,priority:e.priority,cluster:e.cluster,view:e.view,source:e.source,sourceRef:e.sourceRef,isCriterion:e.isCriterion,isChild:null!=e.parentId,parentId:e.parentId,signals:e.signals}})),[t]),w=(0,a.useMemo)(()=>{let e;return e=new Set(t.map(e=>e.id)),[...t.filter(t=>t.parentId&&e.has(t.parentId)).map(e=>({id:`c-${e.id}`,source:e.parentId,sourceHandle:"sb",target:e.id,targetHandle:"tt",type:"smoothstep",style:{stroke:eh.CONTAINS.stroke}})),...s.filter(t=>e.has(t.fromId)&&e.has(t.toId)).map(e=>{let t=eh[e.kind]??eh.RELATES,s="DEPENDS"===e.kind?"depends on":void 0;return{id:e.id,source:e.fromId,sourceHandle:e.sourceHandle??void 0,target:e.toId,targetHandle:e.targetHandle??void 0,label:e.label??s,type:"deletable",markerEnd:{type:o.TG.ArrowClosed,color:t.stroke},style:{stroke:t.stroke,strokeDasharray:t.dash}}})]},[t,s]),[A,z]=(0,a.useState)(N),[I,R]=(0,a.useState)(w),[M,$]=(0,a.useState)(null),[P,L]=(0,a.useState)(null),[O,F]=(0,a.useState)(null),[_,H]=(0,a.useState)(!1),[B,U]=(0,a.useState)("details"),X=(0,a.useRef)(!1),K=(0,a.useRef)("details");(0,a.useEffect)(()=>{X.current=_},[_]),(0,a.useEffect)(()=>{K.current=B},[B]),(0,a.useEffect)(()=>{if(v)return v.current={open:()=>{if(X.current){H(!1),U("details");return}H(!0),U("details")},close:()=>{H(!1),U("details")},openComments:()=>{H(!0),U("comments")}},()=>{v&&(v.current=null)}},[v]);let[G,Z]=(0,a.useState)(new Set),[Y,W]=(0,a.useState)(null),[q,V]=(0,a.useState)(!1),J=(0,a.useRef)(0),Q=(0,a.useRef)(null);(0,a.useEffect)(()=>z(N),[N]),(0,a.useEffect)(()=>R(w),[w]);let ee=(0,a.useCallback)((e,t,s)=>{z(s=>s.map(s=>s.id===e?{...s,data:{...s.data,...t}}:s)),s&&fetch(`/api/nodes/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(Object.fromEntries(Object.entries(t).filter(([e])=>em.has(e))))})},[]),et=(0,a.useMemo)(()=>Array.from(new Set(A.map(e=>e.data.cluster).filter(e=>!!e))).sort(),[A]),es=(0,a.useCallback)(e=>Z(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s}),[]),ea=(0,a.useCallback)(e=>{$(e),H(!0),U("details")},[]),er=(0,a.useCallback)(e=>{z(t=>t.filter(t=>t.id!==e)),$(t=>t===e?null:t),fetch(`/api/nodes/${e}`,{method:"DELETE"})},[]),eo=(0,a.useCallback)(async(t,s)=>{let n=(0,r.sX)(),a="ARCHITECTURE"===e?"REBUILD":"PENDING";z(r=>[...r,{id:n,type:"ROADMAP"===e?"roadmapNode":"archNode",position:{x:t,y:s},data:{title:"New node",role:null,plain:null,status:a,priority:2,cluster:null,view:e,source:"MANUAL",sourceRef:null,isCriterion:!1,isChild:!1,parentId:null}}]),Z(e=>new Set(e).add(n)),W(n),$(n);try{if(!(await fetch("/api/nodes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:n,view:e,title:"New node",status:a,x:t,y:s})})).ok)throw Error("create failed")}catch{z(e=>e.filter(e=>e.id!==n)),Z(e=>{let t=new Set(e);return t.delete(n),t}),W(e=>e===n?null:e),$(e=>e===n?null:e)}},[e]),el=(0,a.useCallback)(()=>{let e=J.current++%8*28;eo(80+e,80+e)},[eo]),eg=(0,a.useMemo)(()=>({view:e,categories:et,statuses:"ARCHITECTURE"===e?C:k,patch:ee,isExpanded:e=>G.has(e),toggleExpand:es,openDetailed:ea,removeNode:er,editingTitleId:Y,onAskAgent:j}),[e,et,ee,G,es,ea,er,Y,j]),[eb,ev]=(0,a.useState)(null),[ej,ey]=(0,a.useState)(""),[eN,ew]=(0,a.useState)(new Set),[ek,eC]=(0,a.useState)(new Set),[eE,eS]=(0,a.useState)(new Set),eA=(0,a.useMemo)(()=>Array.from(new Set(t.map(e=>e.status))),[t]),ez=(0,a.useMemo)(()=>Array.from(new Set(t.map(e=>e.cluster).filter(e=>!!e))).sort(),[t]),eT=(0,a.useMemo)(()=>Array.from(new Set(t.map(e=>e.priority))).sort((e,t)=>e-t),[t]),eI=(0,a.useCallback)(e=>(!eN.size||!!eN.has(e.status))&&(!ek.size||!!e.cluster&&!!ek.has(e.cluster))&&(!eE.size||!!eE.has(e.priority)),[eN,ek,eE]),eD=eN.size+ek.size+eE.size,eR=(0,a.useCallback)(()=>{ew(new Set),eC(new Set),eS(new Set)},[]),eM=(0,a.useMemo)(()=>A.map(e=>({...e,hidden:!eI(e.data)})),[A,eI]),e$=(0,a.useMemo)(()=>new Set(eM.filter(e=>e.hidden).map(e=>e.id)),[eM]),eP=(0,a.useMemo)(()=>I.map(e=>({...e,hidden:e$.has(e.source)||e$.has(e.target)})),[I,e$]),eL=(0,a.useMemo)(()=>{if(P){let e=eP.find(e=>e.id===P);return e?new Set([e.source,e.target]):null}return M?(0,ei.F1)(M,eP.filter(e=>!e.hidden)):null},[M,P,eP]),eO=(0,a.useMemo)(()=>eM.map(e=>{let t=h&&e.id===h?{...e,data:{...e.data,isNext:!0}}:e;return!eL||t.hidden?t:{...t,style:{...t.style,opacity:eL.has(e.id)?1:.45,transition:"opacity 120ms"}}}),[eM,eL,h]),eF=(0,a.useMemo)(()=>{if(!eb||"ROADMAP"!==e)return[];let t=new Map(eO.map(e=>[e.id,e])),s=new Map;for(let e of eO){var n;if(e.hidden)continue;let a=(n=((e.data.parentId?t.get(e.data.parentId):void 0)??e).data,"status"===eb?S[n.status]?.label??n.status:"priority"===eb?`P${n.priority}`:n.cluster?.trim()||"—"),r=e.measured?.width??(e.data.isChild?224:256),o=e.measured?.height??96,l=e.position.x,i=e.position.y,d=s.get(a);d?(d.minX=Math.min(d.minX,l),d.minY=Math.min(d.minY,i),d.maxX=Math.max(d.maxX,l+r),d.maxY=Math.max(d.maxY,i+o)):s.set(a,{label:a,minX:l,minY:i,maxX:l+r,maxY:i+o})}return Array.from(s.values()).map(e=>({label:e.label,x:e.minX-20,y:e.minY-20-26,w:e.maxX-e.minX+40,h:e.maxY-e.minY+40+26}))},[eO,eb,e]),e_=(0,a.useMemo)(()=>{let e=M??O;return P||e?eP.map(t=>t.hidden?t:(P?t.id===P:t.source===e||t.target===e)?{...t,zIndex:20,style:{...t.style,opacity:1,strokeWidth:2.5}}:{...t,selectable:!1,label:void 0,markerEnd:void 0,style:{...t.style,opacity:.06}}):eP.map(e=>e.hidden?e:{...e,label:void 0,style:{...e.style,opacity:.18}})},[eP,M,P,O]),eH=(0,a.useCallback)(e=>z(t=>(0,l._0)(e,t)),[]),eB=(0,a.useCallback)(e=>R(t=>(0,l.zW)(e,t)),[]),eU=(0,a.useCallback)(async e=>{if(!e.source||!e.target||e.source===e.target)return;let t=await fetch("/api/edges",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({fromId:e.source,toId:e.target,kind:"DEPENDS",sourceHandle:e.sourceHandle??null,targetHandle:e.targetHandle??null})});if(!t.ok)return;let s=await t.json(),n=eh.DEPENDS;R(t=>t.some(e=>e.id===s.id)?t:[...t,{id:s.id,source:s.fromId,sourceHandle:e.sourceHandle??void 0,target:s.toId,targetHandle:e.targetHandle??void 0,label:"depends on",type:"deletable",markerEnd:{type:o.TG.ArrowClosed,color:n.stroke},style:{stroke:n.stroke,strokeDasharray:n.dash}}])},[]),eX=(0,a.useCallback)(async(t,s,n)=>{let a=await fetch("/api/nodes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({view:e,title:"New node",parentId:t.id,cluster:t.data.cluster??null,status:"ARCHITECTURE"===e?"REBUILD":"PENDING",x:s,y:n})});if(!a.ok)return;let r=await a.json();z(a=>[...a,{id:r.id,type:"ROADMAP"===e?"roadmapNode":"archNode",position:{x:s,y:n},data:{title:r.title,role:r.role,plain:r.plain,status:r.status,priority:r.priority,cluster:r.cluster,view:r.view,source:r.source,sourceRef:r.sourceRef,isCriterion:!1,isChild:!0,parentId:t.id}}]),R(e=>[...e,{id:`c-${r.id}`,source:t.id,target:r.id,type:"smoothstep",style:{stroke:eh.CONTAINS.stroke}}]),Z(e=>new Set(e).add(r.id)),W(r.id),$(r.id)},[e]),eK=(0,a.useCallback)(async(e,t)=>{if(t.isValid||!t.fromNode||!Q.current)return;let s=e.changedTouches,n=s?.[0]?.clientX??e.clientX,a=s?.[0]?.clientY??e.clientY,{x:r,y:o}=Q.current.screenToFlowPosition({x:n,y:a});await eX(t.fromNode,r,o)},[eX]);(0,a.useEffect)(()=>{if(!q)return;let e=e=>{"Escape"===e.key&&V(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q]);let eG=(0,a.useMemo)(()=>t.find(e=>e.id===M)??null,[t,M]),eZ=(0,a.useCallback)((e,t,s)=>{fetch(`/api/nodes/${e}/position`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({x:t,y:s})})},[]),eY=(0,a.useCallback)(e=>{$(e),L(null);let t=Q.current?.getNode(e);if(!t||!Q.current)return;let s=t.measured?.width??128,n=t.measured?.height??48;Q.current.setCenter(t.position.x+s/2,t.position.y+n/2,{zoom:1.2,duration:600})},[]),eW=(0,a.useCallback)(e=>{let t=function(e,t,s={}){let n=s.colW??320,a=s.rowH??150,r=s.childIndent??24,o=s.laneGap??56,l=s.bandGap??110,i=s.maxCols??4,d=s.maxBandW??6*n,c=new Set(e.map(e=>e.id)),u=e=>!e.parentId||!c.has(e.parentId),m=e.filter(u),p=new Map;for(let t of e){if(u(t))continue;let e=p.get(t.parentId);e?e.push(t):p.set(t.parentId,[t])}let x="status"===t?e=>e.status:"priority"===t?e=>String(e.priority):e=>(e.cluster??"").trim()||"—",h=new Map;for(let e of m){let t=x(e),s=h.get(t);s?s.push(e):h.set(t,[e])}let f=(function(e,t,s){if("status"===e)return[...E];if("priority"===e)return["0","1","2","3"];let n=Array.from(new Set(t.map(s))),a=n.filter(e=>"—"!==e).sort();return n.includes("—")?[...a,"—"]:a})(t,m,x).filter(e=>h.has(e)),g=new Map,b=0,v=0,j=0;for(let e of f){let t=h.get(e),s=Math.max(1,Math.min(i,Math.ceil(Math.sqrt(t.length)))),c=s*n;b>0&&b+c>d&&(b=0,v+=j+l,j=0);let u=Array(s).fill(0);for(let e of t){let t=0;for(let e=1;e<s;e++)u[e]<u[t]&&(t=e);let o=b+t*n,l=v+u[t]*a;g.set(e.id,{x:o,y:l});let i=p.get(e.id)??[];i.forEach((e,t)=>{g.set(e.id,{x:o+r,y:l+(t+1)*a})}),u[t]+=1+i.length}j=Math.max(j,u.reduce((e,t)=>Math.max(e,t),0)*a),b+=c+o}return g}(A.map(e=>({id:e.id,parentId:e.data.parentId??null,cluster:e.data.cluster,status:e.data.status,priority:e.data.priority})),e);z(e=>e.map(e=>{let s=t.get(e.id);return s?{...e,position:s}:e}));let s=Array.from(t,([e,t])=>({id:e,x:t.x,y:t.y}));s.length&&fetch("/api/nodes/positions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({batch:s})}),ev(e),requestAnimationFrame(()=>Q.current?.fitView({duration:600,padding:.2}))},[A]),eq=(0,a.useMemo)(()=>{let e=ej.trim().toLowerCase();return e?A.filter(t=>eI(t.data)&&t.data.title.toLowerCase().includes(e)).slice(0,8):[]},[A,ej,eI]);function eV(e,t){t(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})}return(0,n.jsx)(T.Provider,{value:eg,children:(0,n.jsxs)("div",{className:(0,D.cn)("relative w-full",f?"h-full":"h-screen"),onDragOver:e=>{e.dataTransfer.types.includes("application/beacon-node")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDrop:e=>{if(!e.dataTransfer.getData("application/beacon-node")||!Q.current)return;e.preventDefault();let{x:t,y:s}=Q.current.screenToFlowPosition({x:e.clientX,y:e.clientY});eo(t,s)},children:[(0,n.jsxs)(l.Gc,{nodes:eO,edges:e_,nodeTypes:ep,edgeTypes:ex,connectionMode:o.WZ.Loose,connectionLineStyle:{stroke:"var(--accent-2,#ff7a45)",strokeWidth:1.5,strokeDasharray:"4 4"},onInit:e=>{Q.current=e},onNodesChange:eH,onEdgesChange:eB,onConnect:eU,onConnectEnd:eK,onNodeMouseEnter:(e,t)=>F(t.id),onNodeMouseLeave:()=>F(null),onEdgesDelete:e=>{for(let t of e)t.id.startsWith("c-")||fetch(`/api/edges/${t.id}`,{method:"DELETE"})},onNodesDelete:e=>{for(let t of e)fetch(`/api/nodes/${t.id}`,{method:"DELETE"}),$(e=>e===t.id?null:e)},onNodeClick:(e,t)=>{if(q){if(V(!1),t.data.isChild)return;eX(t,t.position.x+300,t.position.y+60);return}if($(t.id),L(null),U("details"),f){let t=e.target;t?.closest("input, textarea, select, button, [role='combobox']")||H(!0)}},onEdgeClick:(e,t)=>{L(t.id),$(null),U("details")},onPaneClick:()=>{q?V(!1):($(null),L(null))},onNodeDragStop:(e,t)=>eZ(t.id,t.position.x,t.position.y),deleteKeyCode:["Backspace","Delete"],colorMode:"dark",fitView:!0,minZoom:.2,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,n.jsx)(l.VS,{gap:22,color:"#2a2a32"}),eF.length>0&&(0,n.jsx)(l.DX,{children:eF.map(e=>(0,n.jsx)("div",{style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,pointerEvents:"none",zIndex:0},className:"rounded-2xl border border-white/[0.08] bg-white/[0.015]",children:(0,n.jsx)("div",{className:"px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e.label})},e.label))}),(0,n.jsx)(l.H2,{position:"bottom-right",className:"!overflow-hidden !rounded-xl !border !border-white/10 [&_button]:!border-white/10 [&_button]:!bg-card/70 [&_button]:!text-foreground [&_button]:!backdrop-blur"}),(0,n.jsx)(l.Zk,{position:"bottom-right",style:{marginBottom:152},children:(0,n.jsx)(ec.er,{title:"Legend",trigger:(e,t)=>(0,n.jsx)("button",{type:"button",onClick:t,title:"Legend",className:(0,D.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,n.jsx)(i.A,{className:"size-4"})}),children:(0,n.jsxs)("ul",{className:"space-y-1.5 text-[10.5px] text-muted-foreground",children:[(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"inline-block rounded bg-sky-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-sky-300",children:"feature"}),(0,n.jsx)("span",{children:"top-level card \xb7 can have sub-tasks"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"inline-block rounded bg-zinc-500/15 px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-zinc-300",children:"sub-task"}),(0,n.jsx)("span",{children:"child of a feature"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-px w-6 bg-[#33333a]"}),(0,n.jsx)("span",{children:"contains \xb7 drag the bottom handle to empty canvas"})]}),(0,n.jsxs)("li",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":!0,className:"inline-block h-0 w-6 border-t border-dashed",style:{borderColor:"#f5b942"}}),(0,n.jsx)("span",{children:"depends on \xb7 drag between two cards"})]})]})})}),!f&&(0,n.jsx)(l.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!rounded-xl !border !border-white/10 !bg-card/50 !backdrop-blur",nodeColor:e=>e.data?.priority===0?"#ff3860":"#555"}),(0,n.jsxs)(l.Zk,{position:"bottom-center",className:"!mb-4 flex flex-col items-center gap-2",children:[q&&(0,n.jsxs)("div",{className:"glass rounded-full px-3 py-1 text-[11px] text-muted-foreground",children:["Click a ","ARCHITECTURE"===e?"component":"feature"," to attach the"," ","ARCHITECTURE"===e?"sub-component":"sub-task"," \xb7 Esc to cancel"]}),"ROADMAP"===e&&(0,n.jsxs)("div",{className:"glass flex items-center gap-1 rounded-full p-1",children:[(0,n.jsx)("span",{className:"pl-2 pr-0.5 text-[11px] text-muted-foreground",children:"Group by"}),eu.map(e=>(0,n.jsx)("button",{onClick:()=>eW(e.value),title:`Arrange features into lanes by ${e.label.toLowerCase()}`,className:(0,D.cn)("h-7 rounded-full px-2.5 text-[11px] font-medium transition-colors",eb===e.value?"bg-white/[0.12] text-foreground":"text-muted-foreground hover:bg-white/[0.06] hover:text-foreground"),children:e.label},e.value))]}),(0,n.jsxs)("div",{className:"glass flex items-center gap-1 rounded-full p-1",children:[(0,n.jsxs)("button",{onClick:el,draggable:!0,onDragStart:t=>{t.dataTransfer.setData("application/beacon-node",e),t.dataTransfer.effectAllowed="copy"},title:"ARCHITECTURE"===e?"Add component (click, or drag onto the board to place it)":"Add feature (click, or drag onto the board to place it)",className:"flex h-8 cursor-grab items-center gap-1.5 rounded-full px-3 text-[12px] font-medium text-foreground transition-colors hover:bg-white/[0.06] active:cursor-grabbing",children:[(0,n.jsx)(d.A,{className:"size-3.5 text-[var(--accent-2,#ff7a45)]"}),"ARCHITECTURE"===e?"Component":"Feature"]}),(0,n.jsx)("span",{"aria-hidden":!0,className:"mx-0.5 h-5 w-px bg-white/10"}),(0,n.jsxs)("button",{onClick:()=>V(e=>!e),title:"ARCHITECTURE"===e?"Add sub-component (click a component next)":"Add sub-task (click a feature next)",className:(0,D.cn)("flex h-8 items-center gap-1.5 rounded-full px-3 text-[12px] font-medium transition-colors",q?"bg-white/[0.1] text-foreground":"text-muted-foreground hover:bg-white/[0.06] hover:text-foreground"),children:[(0,n.jsx)(c.A,{className:"size-3.5"}),"ARCHITECTURE"===e?"Sub-component":"Sub-task"]})]})]}),!f&&(0,n.jsx)(l.Zk,{position:"top-center",className:"glass rounded-full px-1 py-0.5",children:(0,n.jsx)(ed.Z,{active:e,tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"FILES",label:"Files",href:"/map?view=FILES"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"}]})}),(0,n.jsxs)(l.Zk,{position:"top-right",className:(0,D.cn)("flex items-center gap-1 transition-[margin] duration-200",_&&"!mr-[332px]",f&&"hidden"),children:[(0,n.jsxs)(ec.er,{title:"Search",trigger:(e,t)=>(0,n.jsx)("button",{type:"button",onClick:t,title:"Search features",className:(0,D.cn)("glass flex size-8 items-center justify-center rounded-lg transition-colors",e?"text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,n.jsx)(u.A,{className:"size-4"})}),children:[(0,n.jsx)("input",{autoFocus:!0,value:ej,onChange:e=>ey(e.target.value),placeholder:"Find a feature…",className:"w-full rounded-md border border-white/10 bg-white/[0.04] px-2 py-1 text-[12px] outline-none placeholder:text-muted-foreground/50 focus:bg-white/[0.08]"}),(0,n.jsxs)("div",{className:"mt-2 max-h-64 space-y-0.5 overflow-y-auto",children:[ej.trim()&&0===eq.length&&(0,n.jsx)("div",{className:"px-1 py-1 text-[11px] text-muted-foreground",children:"No matches"}),eq.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>eY(e.id),className:"block w-full truncate rounded-md px-2 py-1 text-left text-[12px] text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:e.data.title},e.id))]})]}),"ROADMAP"===e&&h&&(0,n.jsx)("button",{type:"button",onClick:()=>eY(h),title:"Jump to the next feature to work on",className:"glass flex size-8 items-center justify-center rounded-lg text-emerald-300 transition-colors hover:text-emerald-200",children:(0,n.jsx)(m.A,{className:"size-4"})}),(0,n.jsxs)(ec.er,{title:"Filters",trigger:(e,t)=>(0,n.jsxs)("button",{type:"button",onClick:t,title:"Filters",className:(0,D.cn)("glass relative flex size-8 items-center justify-center rounded-lg transition-colors",e||eD>0?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,n.jsx)(p.A,{className:"size-4"}),eD>0&&(0,n.jsx)("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-[var(--accent-2,#ff7a45)] px-1 text-[9px] font-semibold text-white",children:eD})]}),children:[eA.length>0&&(0,n.jsx)(ec.r1,{title:"Status",children:eA.map(e=>(0,n.jsx)(ec.vu,{on:eN.has(e),onClick:()=>eV(e,ew),children:S[e]?.label??e},e))}),ez.length>0&&(0,n.jsx)(ec.r1,{title:"Cluster",children:ez.map(e=>(0,n.jsx)(ec.vu,{on:ek.has(e),onClick:()=>eV(e,eC),children:e},e))}),eT.length>0&&(0,n.jsx)(ec.r1,{title:"Priority",children:eT.map(e=>(0,n.jsxs)(ec.vu,{on:eE.has(e),onClick:()=>eV(e,eS),children:["P",e]},e))}),eD>0&&(0,n.jsx)("button",{type:"button",onClick:eR,className:"mt-1 w-full rounded-md border border-white/10 px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:"clear filters"})]}),!_&&(0,n.jsx)("button",{onClick:()=>{H(!0),U("details")},title:"Show panel",className:"glass flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground",children:(0,n.jsx)(x.A,{className:"size-4"})})]})]}),_&&(0,n.jsx)(en,{view:e,selected:eG,allNodes:t,onClose:()=>{H(!1),U("details")},commentsContent:g,commentsCount:b,activeTab:B,onTabChange:U,onAddComment:y,topOffset:f?64:void 0})]})})}}}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5823],{15373:(e,t,o)=>{"use strict";o.d(t,{FilesMapClient:()=>w});var s=o(95155),r=o(12115),n=o(81750),l=o(6266),a=o(7679),i=o(98766),d=o(15629),c=o(79176),u=o(74371);o(53255);var p=o(18986),h=o(9005),x=o(25583),m=o(82099),f=o(62311);let b=/(^|\/)tests?\/|\.(test|spec)\.[jt]sx?$/i;var g=o(91337);let y={ts:"#3178c6",js:"#f7df1e",py:"#3776ab",go:"#00add8",rs:"#dea584",swift:"#f05138",java:"#b07219",ruby:"#cc342d",kotlin:"#a97bff",csharp:"#178600",php:"#4f5d95",cpp:"#f34b7d",c:"#555555"},j={file:function({data:e}){var t;let o=!!e.touched,r=e.recency??0,a=e.inDegree??0,i=10+.35*Math.min(a,20),d=o?Math.max(13+4*r,i):i,c={fontSize:`${d}px`,...o?{boxShadow:`0 0 ${6+Math.round(12*r)}px ${1+Math.round(3*r)}px rgba(45,212,191,${(.25+.5*r).toFixed(2)})`,zIndex:10}:{}},u=a>0?` \xb7 imported by ${a}`:"",p=o?`${e.tooltip} \xb7 edited ${e.count??0}\xd7 this session${u}`:e.untested?`${e.tooltip} \xb7 no test imports this file${u}`:`${e.tooltip}${u}`;return(0,s.jsxs)("div",{title:p,style:c,className:(0,g.cn)("relative rounded-md border bg-card/85 px-2 py-0.5 text-[10px] font-medium backdrop-blur transition-[font-size,box-shadow,border-color] duration-300",o?"border-teal-300/80 px-2.5 py-1 font-semibold text-foreground":e.untested?"border-amber-400/60 text-foreground/85":"border-white/10 text-foreground/85",e.isNewest&&"animate-touch-pulse"),children:[(0,s.jsx)(n.h7,{type:"target",position:l.yX.Top,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent"}),e.untested&&(0,s.jsx)("span",{"aria-hidden":!0,className:"absolute -right-1 -top-1 size-1.5 rounded-full bg-amber-400 ring-2 ring-background"}),o&&(e.count??0)>0&&(0,s.jsx)("span",{"aria-hidden":!0,className:"absolute -left-1.5 -top-1.5 flex h-3 min-w-3 items-center justify-center rounded-full bg-teal-400 px-0.5 text-[7px] font-bold text-background ring-1 ring-background",children:e.count}),e.lang&&(0,s.jsx)("span",{"aria-hidden":!0,title:e.lang,className:"absolute -bottom-1 -right-1 size-1.5 rounded-full ring-1 ring-background",style:{backgroundColor:(t=e.lang)&&y[t]||"#9ca3af"}}),e.label,(0,s.jsx)(n.h7,{type:"source",position:l.yX.Bottom,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent"})]})}};function w({files:e,edges:t,touched:o}){let l,y=(0,r.useMemo)(()=>{if(!e.some(e=>0===e.x&&0===e.y)){let t=new Map;for(let o of e)t.set(o.path,{x:o.x,y:o.y});return{positions:t,fresh:!1}}return{positions:function(e,t){let o=e.map(e=>{let t=0!==e.x||0!==e.y,o=e.path.includes("/")?e.path.split("/").pop():e.path;return{id:e.path,x:t?e.x:(Math.random()-.5)*600,y:t?e.y:(Math.random()-.5)*600,fx:t?e.x:void 0,fy:t?e.y:void 0,pinned:t,radius:Math.max(28,(6*o.length+24)/2+8)}}),s=t.filter(e=>e.from!==e.to).map(e=>({source:e.from,target:e.to})),r=(0,a.A)(o).force("link",(0,i.A)(s).id(e=>e.id).distance(130).strength(.45)).force("charge",(0,d.A)().strength(-380).distanceMax(1e3)).force("collide",(0,c.A)().radius(e=>e.radius).strength(1)).force("center",(0,u.A)(0,0).strength(.025)).stop();for(let e=0;e<500;e++)r.tick();let n=new Map;for(let e of o)n.set(e.id,{x:e.x??0,y:e.y??0});return n}(e,t),fresh:!0}},[e,t]),k=(0,r.useMemo)(()=>(function(e,t){var o;let s=new Set;for(let e of t)o=e.from,b.test(o)&&s.add(e.to);let r=new Set;for(let t of e)b.test(t)||s.has(t)||r.add(t);return r})(e.map(e=>e.path),t),[e,t]),v=(0,r.useMemo)(()=>{let e=new Map,t=Object.entries(o??{});if(!t.length)return e;let s=t.map(([,e])=>e.lastAt),r=Math.max(...s),n=Math.min(...s),l=r-n||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-n)/l,isNewest:o===a});return e},[o]),C=v.size>0,S=(0,r.useMemo)(()=>Array.from(v.entries()).map(([e,t])=>({path:e,label:e.slice(e.lastIndexOf("/")+1),count:t.count,recency:t.recency})).sort((e,t)=>t.recency-e.recency),[v]),M=(0,r.useMemo)(()=>e.map(e=>{let t=y.positions.get(e.path)??{x:e.x,y:e.y},o=e.path.lastIndexOf("/"),s=o>=0?e.path.slice(o+1):e.path,r=v.get(e.path);return{id:e.path,type:"file",position:t,data:{label:s,tooltip:e.path,untested:k.has(e.path),inDegree:e.inDegree??0,lang:e.lang??null,touched:!!r,count:r?.count??0,recency:r?.recency??0,isNewest:r?.isNewest??!1}}}),[e,y,k,v]),A=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(!y.fresh||A.current)return;A.current=!0;let t=e.filter(e=>0===e.x&&0===e.y).map(e=>{let t=y.positions.get(e.path);return t?{path:e.path,x:t.x,y:t.y}:null}).filter(e=>null!==e);t.length&&fetch("/api/code-graph/position",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({batch:t})})},[y,e]);let E=(0,r.useMemo)(()=>t.map(e=>({id:`${e.from}|${e.to}`,source:e.from,target:e.to,type:"straight",style:e.circular?{stroke:"#f87171",strokeDasharray:"5 3",strokeWidth:2}:{stroke:"#a1a1aa",strokeWidth:1.5,opacity:.85}})),[t]),[$,z]=(0,r.useState)(M),[O,I]=(0,r.useState)(E),[_,D]=(0,r.useState)(null),[P,R]=(0,r.useState)(null),[T,F]=(0,r.useState)(!1),[L,W]=(0,r.useState)(!1),[Z,B]=(0,r.useState)(!1),[H,U]=(0,r.useState)(!1),V=(0,r.useRef)(null),J=(0,r.useCallback)(e=>{D(e),R(null);let t=V.current?.getNode(e);t&&V.current&&V.current.setCenter(t.position.x+40,t.position.y+12,{zoom:1.4,duration:600})},[]),K=(0,r.useCallback)(()=>{D(null),R(null);let e=!L;if(W(e),B(e),e&&V.current){let e=Array.from(v.keys()).map(e=>({id:e}));e.length&&V.current.fitView({nodes:e,duration:600,padding:.4})}},[L,v]);(0,r.useEffect)(()=>U(!0),[]),(0,r.useEffect)(()=>z(M),[M]),(0,r.useEffect)(()=>I(E),[E]);let X=(0,r.useCallback)(e=>z(t=>(0,n._0)(e,t)),[]),G=(0,r.useCallback)(e=>I(t=>(0,n.zW)(e,t)),[]),q=(0,r.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})})},[]),Q=(0,r.useMemo)(()=>new Set(t.filter(e=>e.circular).map(e=>`${e.from}|${e.to}`)),[t]),Y=(0,r.useMemo)(()=>{let e=new Set;for(let o of t)o.circular&&(e.add(o.from),e.add(o.to));return e},[t]),ee=(0,r.useMemo)(()=>{if(P){let e=O.find(e=>e.id===P);return e?new Set([e.source,e.target]):null}if(_){let e=new Set([_]);for(let o of t)o.from===_&&e.add(o.to),o.to===_&&e.add(o.from);return e}return T?Y:L&&C?new Set(v.keys()):null},[_,P,T,Y,t,O,L,C,v]),et=(0,r.useMemo)(()=>ee?$.map(e=>({...e,style:{...e.style,opacity:ee.has(e.id)?1:.15,transition:"opacity 120ms"}})):$,[$,ee]),eo=(0,r.useMemo)(()=>_||P||T||L?O.map(e=>{let t=!1;return P?t=e.id===P:_?t=e.source===_||e.target===_:T?t=Q.has(e.id):L&&(t=v.has(e.source)&&v.has(e.target)),t?{...e,zIndex:20,style:{...e.style,opacity:1,strokeWidth:2}}:{...e,style:{...e.style,opacity:.05}}}):O,[O,_,P,T,Q,L,v]),es=t.filter(e=>e.circular).length,er=(0,r.useMemo)(()=>_?t.filter(e=>e.from===_).map(e=>e.to):[],[_,t]),en=(0,r.useMemo)(()=>_?t.filter(e=>e.to===_).map(e=>e.from):[],[_,t]),el=null!==_||Z&&C,ea=(0,r.useCallback)(()=>{D(null),B(!1),W(!1)},[]);return H?(0,s.jsxs)("div",{className:"relative h-screen w-full",children:[(0,s.jsxs)(n.Gc,{nodes:et,edges:eo,nodeTypes:j,onNodesChange:X,onEdgesChange:G,onNodeClick:(e,t)=>{D(t.id),R(null)},onEdgeClick:(e,t)=>{R(t.id),D(null)},onPaneClick:()=>{D(null),R(null)},onInit:e=>{V.current=e},onNodeDragStop:(e,t)=>q(t.id,t.position.x,t.position.y),deleteKeyCode:null,colorMode:"dark",fitView:!0,minZoom:.05,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,s.jsx)(n.VS,{gap:22,color:"#2a2a32"}),(0,s.jsx)(n.H2,{position:"bottom-right",className:"!overflow-hidden !rounded-xl !border !border-white/10 [&_button]:!border-white/10 [&_button]:!bg-card/70 [&_button]:!text-foreground [&_button]:!backdrop-blur"}),(0,s.jsx)(n.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!rounded-xl !border !border-white/10 !bg-card/50 !backdrop-blur",nodeColor:()=>"#555"}),(0,s.jsx)(n.Zk,{position:"top-center",className:"glass rounded-full px-1 py-0.5",children:(0,s.jsx)(f.Z,{active:"FILES",tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"FILES",label:"Files",href:"/map?view=FILES"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"}]})}),(0,s.jsxs)(n.Zk,{position:"top-right",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"]}),es>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>{F(e=>!e),D(null),R(null)},title:T?"Show all imports":"Show only files involved in import cycles",className:(0,g.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",T?"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"}}),es," circular"]}),C&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("button",{type:"button",onClick:K,title:L?"Show all files again":"Focus + zoom to the files edited this session",className:(0,g.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",L?"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)(p.A,{className:"size-3"}),v.size," edited"]})})]})]}),el&&(0,s.jsxs)(m.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-white/10 px-3.5 py-2.5",children:[(0,s.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:_?"File":"Edited this session"}),(0,s.jsx)("button",{onClick:ea,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,s.jsx)(h.A,{className:"size-4"})})]}),(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:_?(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)(x.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:_.slice(_.lastIndexOf("/")+1)})]}),(0,s.jsx)("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:_})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(l=v.get(_))?(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 ",l.count,"\xd7"]}):null,k.has(_)&&(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(_)}`).catch(()=>{}),className:"w-full rounded-md border border-white/10 px-2 py-1.5 text-[11px] text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",children:"Open in editor"}),(0,s.jsx)(N,{label:"Imports",paths:er,onPick:J}),(0,s.jsx)(N,{label:"Imported by",paths:en,onPick:J})]}):(0,s.jsx)("ul",{className:"space-y-0.5",children:S.map(e=>(0,s.jsx)("li",{children:(0,s.jsxs)("button",{onClick:()=>J(e.path),title:e.path,className:"flex w-full items-center justify-between gap-2 rounded px-2 py-1 text-left transition-colors hover:bg-white/[0.06]",children:[(0,s.jsx)("span",{className:"truncate text-[11px] text-foreground/90",children:e.label}),(0,s.jsxs)("span",{className:"shrink-0 text-[9px] text-teal-300/80",children:[e.count,"\xd7"]})]})},e.path))})})]})]}):(0,s.jsx)("div",{className:"flex h-screen w-full items-center justify-center text-sm text-muted-foreground",children:"Loading graph…"})}function N({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)("ul",{className:"space-y-0.5",children:t.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)("button",{onClick:()=>o(e),title:e,className:"block w-full truncate rounded px-1.5 py-0.5 text-left font-mono text-[10px] text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:e.slice(e.lastIndexOf("/")+1)})},e))})]}):null}},24791:(e,t,o)=>{Promise.resolve().then(o.bind(o,26856)),Promise.resolve().then(o.bind(o,15373)),Promise.resolve().then(o.bind(o,40153))}},e=>{e.O(0,[2574,3862,8500,4294,766,6946,7028,5916,8441,3794,7358],()=>e(e.s=24791)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5823],{15373:(e,t,o)=>{"use strict";o.d(t,{FilesMapClient:()=>w});var s=o(95155),r=o(12115),n=o(81750),l=o(6266),a=o(7679),i=o(98766),d=o(15629),c=o(79176),u=o(74371);o(53255);var p=o(18986),h=o(9005),x=o(25583),m=o(82099),f=o(62311);let b=/(^|\/)tests?\/|\.(test|spec)\.[jt]sx?$/i;var g=o(91337);let y={ts:"#3178c6",js:"#f7df1e",py:"#3776ab",go:"#00add8",rs:"#dea584",swift:"#f05138",java:"#b07219",ruby:"#cc342d",kotlin:"#a97bff",csharp:"#178600",php:"#4f5d95",cpp:"#f34b7d",c:"#555555"},j={file:function({data:e}){var t;let o=!!e.touched,r=e.recency??0,a=e.inDegree??0,i=10+.35*Math.min(a,20),d=o?Math.max(13+4*r,i):i,c={fontSize:`${d}px`,...o?{boxShadow:`0 0 ${6+Math.round(12*r)}px ${1+Math.round(3*r)}px rgba(45,212,191,${(.25+.5*r).toFixed(2)})`,zIndex:10}:{}},u=a>0?` \xb7 imported by ${a}`:"",p=o?`${e.tooltip} \xb7 edited ${e.count??0}\xd7 this session${u}`:e.untested?`${e.tooltip} \xb7 no test imports this file${u}`:`${e.tooltip}${u}`;return(0,s.jsxs)("div",{title:p,style:c,className:(0,g.cn)("relative rounded-md border bg-card/85 px-2 py-0.5 text-[10px] font-medium backdrop-blur transition-[font-size,box-shadow,border-color] duration-300",o?"border-teal-300/80 px-2.5 py-1 font-semibold text-foreground":e.untested?"border-amber-400/60 text-foreground/85":"border-white/10 text-foreground/85",e.isNewest&&"animate-touch-pulse"),children:[(0,s.jsx)(n.h7,{type:"target",position:l.yX.Top,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent"}),e.untested&&(0,s.jsx)("span",{"aria-hidden":!0,className:"absolute -right-1 -top-1 size-1.5 rounded-full bg-amber-400 ring-2 ring-background"}),o&&(e.count??0)>0&&(0,s.jsx)("span",{"aria-hidden":!0,className:"absolute -left-1.5 -top-1.5 flex h-3 min-w-3 items-center justify-center rounded-full bg-teal-400 px-0.5 text-[7px] font-bold text-background ring-1 ring-background",children:e.count}),e.lang&&(0,s.jsx)("span",{"aria-hidden":!0,title:e.lang,className:"absolute -bottom-1 -right-1 size-1.5 rounded-full ring-1 ring-background",style:{backgroundColor:(t=e.lang)&&y[t]||"#9ca3af"}}),e.label,(0,s.jsx)(n.h7,{type:"source",position:l.yX.Bottom,isConnectable:!1,className:"!h-0 !w-0 !min-w-0 !border-0 !bg-transparent"})]})}};function w({files:e,edges:t,touched:o}){let l,y=(0,r.useMemo)(()=>{if(!e.some(e=>0===e.x&&0===e.y)){let t=new Map;for(let o of e)t.set(o.path,{x:o.x,y:o.y});return{positions:t,fresh:!1}}return{positions:function(e,t){let o=e.map(e=>{let t=0!==e.x||0!==e.y,o=e.path.includes("/")?e.path.split("/").pop():e.path;return{id:e.path,x:t?e.x:(Math.random()-.5)*600,y:t?e.y:(Math.random()-.5)*600,fx:t?e.x:void 0,fy:t?e.y:void 0,pinned:t,radius:Math.max(28,(6*o.length+24)/2+8)}}),s=t.filter(e=>e.from!==e.to).map(e=>({source:e.from,target:e.to})),r=(0,a.A)(o).force("link",(0,i.A)(s).id(e=>e.id).distance(130).strength(.45)).force("charge",(0,d.A)().strength(-380).distanceMax(1e3)).force("collide",(0,c.A)().radius(e=>e.radius).strength(1)).force("center",(0,u.A)(0,0).strength(.025)).stop();for(let e=0;e<500;e++)r.tick();let n=new Map;for(let e of o)n.set(e.id,{x:e.x??0,y:e.y??0});return n}(e,t),fresh:!0}},[e,t]),k=(0,r.useMemo)(()=>(function(e,t){var o;let s=new Set;for(let e of t)o=e.from,b.test(o)&&s.add(e.to);let r=new Set;for(let t of e)b.test(t)||s.has(t)||r.add(t);return r})(e.map(e=>e.path),t),[e,t]),v=(0,r.useMemo)(()=>{let e=new Map,t=Object.entries(o??{});if(!t.length)return e;let s=t.map(([,e])=>e.lastAt),r=Math.max(...s),n=Math.min(...s),l=r-n||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-n)/l,isNewest:o===a});return e},[o]),C=v.size>0,S=(0,r.useMemo)(()=>Array.from(v.entries()).map(([e,t])=>({path:e,label:e.slice(e.lastIndexOf("/")+1),count:t.count,recency:t.recency})).sort((e,t)=>t.recency-e.recency),[v]),M=(0,r.useMemo)(()=>e.map(e=>{let t=y.positions.get(e.path)??{x:e.x,y:e.y},o=e.path.lastIndexOf("/"),s=o>=0?e.path.slice(o+1):e.path,r=v.get(e.path);return{id:e.path,type:"file",position:t,data:{label:s,tooltip:e.path,untested:k.has(e.path),inDegree:e.inDegree??0,lang:e.lang??null,touched:!!r,count:r?.count??0,recency:r?.recency??0,isNewest:r?.isNewest??!1}}}),[e,y,k,v]),A=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(!y.fresh||A.current)return;A.current=!0;let t=e.filter(e=>0===e.x&&0===e.y).map(e=>{let t=y.positions.get(e.path);return t?{path:e.path,x:t.x,y:t.y}:null}).filter(e=>null!==e);t.length&&fetch("/api/code-graph/position",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({batch:t})})},[y,e]);let E=(0,r.useMemo)(()=>t.map(e=>({id:`${e.from}|${e.to}`,source:e.from,target:e.to,type:"straight",style:e.circular?{stroke:"#f87171",strokeDasharray:"5 3",strokeWidth:2}:{stroke:"#a1a1aa",strokeWidth:1.5,opacity:.85}})),[t]),[$,z]=(0,r.useState)(M),[O,I]=(0,r.useState)(E),[_,D]=(0,r.useState)(null),[P,R]=(0,r.useState)(null),[T,F]=(0,r.useState)(!1),[L,W]=(0,r.useState)(!1),[Z,B]=(0,r.useState)(!1),[H,U]=(0,r.useState)(!1),V=(0,r.useRef)(null),J=(0,r.useCallback)(e=>{D(e),R(null);let t=V.current?.getNode(e);t&&V.current&&V.current.setCenter(t.position.x+40,t.position.y+12,{zoom:1.4,duration:600})},[]),K=(0,r.useCallback)(()=>{D(null),R(null);let e=!L;if(W(e),B(e),e&&V.current){let e=Array.from(v.keys()).map(e=>({id:e}));e.length&&V.current.fitView({nodes:e,duration:600,padding:.4})}},[L,v]);(0,r.useEffect)(()=>U(!0),[]),(0,r.useEffect)(()=>z(M),[M]),(0,r.useEffect)(()=>I(E),[E]);let X=(0,r.useCallback)(e=>z(t=>(0,n._0)(e,t)),[]),G=(0,r.useCallback)(e=>I(t=>(0,n.zW)(e,t)),[]),q=(0,r.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})})},[]),Q=(0,r.useMemo)(()=>new Set(t.filter(e=>e.circular).map(e=>`${e.from}|${e.to}`)),[t]),Y=(0,r.useMemo)(()=>{let e=new Set;for(let o of t)o.circular&&(e.add(o.from),e.add(o.to));return e},[t]),ee=(0,r.useMemo)(()=>{if(P){let e=O.find(e=>e.id===P);return e?new Set([e.source,e.target]):null}if(_){let e=new Set([_]);for(let o of t)o.from===_&&e.add(o.to),o.to===_&&e.add(o.from);return e}return T?Y:L&&C?new Set(v.keys()):null},[_,P,T,Y,t,O,L,C,v]),et=(0,r.useMemo)(()=>ee?$.map(e=>({...e,style:{...e.style,opacity:ee.has(e.id)?1:.15,transition:"opacity 120ms"}})):$,[$,ee]),eo=(0,r.useMemo)(()=>_||P||T||L?O.map(e=>{let t=!1;return P?t=e.id===P:_?t=e.source===_||e.target===_:T?t=Q.has(e.id):L&&(t=v.has(e.source)&&v.has(e.target)),t?{...e,zIndex:20,style:{...e.style,opacity:1,strokeWidth:2}}:{...e,style:{...e.style,opacity:.05}}}):O,[O,_,P,T,Q,L,v]),es=t.filter(e=>e.circular).length,er=(0,r.useMemo)(()=>_?t.filter(e=>e.from===_).map(e=>e.to):[],[_,t]),en=(0,r.useMemo)(()=>_?t.filter(e=>e.to===_).map(e=>e.from):[],[_,t]),el=null!==_||Z&&C,ea=(0,r.useCallback)(()=>{D(null),B(!1),W(!1)},[]);return H?(0,s.jsxs)("div",{className:"relative h-screen w-full",children:[(0,s.jsxs)(n.Gc,{nodes:et,edges:eo,nodeTypes:j,onNodesChange:X,onEdgesChange:G,onNodeClick:(e,t)=>{D(t.id),R(null)},onEdgeClick:(e,t)=>{R(t.id),D(null)},onPaneClick:()=>{D(null),R(null)},onInit:e=>{V.current=e},onNodeDragStop:(e,t)=>q(t.id,t.position.x,t.position.y),deleteKeyCode:null,colorMode:"dark",fitView:!0,minZoom:.05,panOnScroll:!0,zoomActivationKeyCode:["Meta","Control"],proOptions:{hideAttribution:!0},children:[(0,s.jsx)(n.VS,{gap:22,color:"#2a2a32"}),(0,s.jsx)(n.H2,{position:"bottom-right",className:"!overflow-hidden !rounded-xl !border !border-white/10 [&_button]:!border-white/10 [&_button]:!bg-card/70 [&_button]:!text-foreground [&_button]:!backdrop-blur"}),(0,s.jsx)(n.of,{pannable:!0,zoomable:!0,position:"bottom-left",style:{width:140,height:90},className:"!rounded-xl !border !border-white/10 !bg-card/50 !backdrop-blur",nodeColor:()=>"#555"}),(0,s.jsx)(n.Zk,{position:"top-center",className:"glass rounded-full px-1 py-0.5",children:(0,s.jsx)(f.Z,{active:"FILES",tabs:[{value:"ROADMAP",label:"Roadmap",href:"/map?view=ROADMAP"},{value:"ARCHITECTURE",label:"Architecture",href:"/map?view=ARCHITECTURE"},{value:"FILES",label:"Files",href:"/map?view=FILES"},{value:"DATABASE",label:"Database",href:"/map?view=DATABASE"}]})}),(0,s.jsxs)(n.Zk,{position:"top-right",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"]}),es>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>{F(e=>!e),D(null),R(null)},title:T?"Show all imports":"Show only files involved in import cycles",className:(0,g.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",T?"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"}}),es," circular"]}),C&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("button",{type:"button",onClick:K,title:L?"Show all files again":"Focus + zoom to the files edited this session",className:(0,g.cn)("flex items-center gap-1.5 rounded-md px-1.5 py-0.5 transition-colors",L?"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)(p.A,{className:"size-3"}),v.size," edited"]})})]})]}),el&&(0,s.jsxs)(m.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-white/10 px-3.5 py-2.5",children:[(0,s.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:_?"File":"Edited this session"}),(0,s.jsx)("button",{onClick:ea,title:"Close panel",className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-white/10 hover:text-foreground",children:(0,s.jsx)(h.A,{className:"size-4"})})]}),(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:_?(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)(x.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:_.slice(_.lastIndexOf("/")+1)})]}),(0,s.jsx)("div",{className:"mt-0.5 break-all font-mono text-[10px] text-muted-foreground",children:_})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(l=v.get(_))?(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 ",l.count,"\xd7"]}):null,k.has(_)&&(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(_)}`).catch(()=>{}),className:"w-full rounded-md border border-white/10 px-2 py-1.5 text-[11px] text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",children:"Open in editor"}),(0,s.jsx)(N,{label:"Imports",paths:er,onPick:J}),(0,s.jsx)(N,{label:"Imported by",paths:en,onPick:J})]}):(0,s.jsx)("ul",{className:"space-y-0.5",children:S.map(e=>(0,s.jsx)("li",{children:(0,s.jsxs)("button",{onClick:()=>J(e.path),title:e.path,className:"flex w-full items-center justify-between gap-2 rounded px-2 py-1 text-left transition-colors hover:bg-white/[0.06]",children:[(0,s.jsx)("span",{className:"truncate text-[11px] text-foreground/90",children:e.label}),(0,s.jsxs)("span",{className:"shrink-0 text-[9px] text-teal-300/80",children:[e.count,"\xd7"]})]})},e.path))})})]})]}):(0,s.jsx)("div",{className:"flex h-screen w-full items-center justify-center text-sm text-muted-foreground",children:"Loading graph…"})}function N({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)("ul",{className:"space-y-0.5",children:t.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)("button",{onClick:()=>o(e),title:e,className:"block w-full truncate rounded px-1.5 py-0.5 text-left font-mono text-[10px] text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",children:e.slice(e.lastIndexOf("/")+1)})},e))})]}):null}},24791:(e,t,o)=>{Promise.resolve().then(o.bind(o,26856)),Promise.resolve().then(o.bind(o,15373)),Promise.resolve().then(o.bind(o,98378))}},e=>{e.O(0,[2574,3862,8500,4294,766,8319,7028,8811,8441,3794,7358],()=>e(e.s=24791)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{30772:(e,s,a)=>{"use strict";a.d(s,{A:()=>i});var l=a(12115),t=a(30907);let n=e=>{let s=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,s,a)=>a?a.toUpperCase():s.toLowerCase());return s.charAt(0).toUpperCase()+s.slice(1)};var r=a(71265);let i=(e,s)=>{let a=(0,l.forwardRef)(({className:a,...i},c)=>(0,l.createElement)(r.default,{ref:c,iconNode:s,className:(0,t.z)(`lucide-${n(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,a),...i}));return a.displayName=n(e),a}},30907:(e,s,a)=>{"use strict";a.d(s,{z:()=>l});let l=(...e)=>e.filter((e,s,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===s).join(" ").trim()},31698:(e,s,a)=>{"use strict";a.d(s,{Landing:()=>N});var l=a(95155),t=a(12115),n=a(98500),r=a.n(n),i=a(81499),c=a(51128),d=a(86272),o=a(64577),m=a(32133),h=a(65738),x=a(99314),p=a(52965),u=a(39593);a(93340);let j=u.EO,w=[{n:"01",title:"Propose",body:(0,l.jsxs)(l.Fragment,{children:["Ask the session in your terminal to plan a feature. It calls"," ",(0,l.jsx)("span",{className:"w-mono text-foreground",children:"beacon_propose_plan"})," and blocks until you decide. No fire-and-forget."]}),code:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"w-signal",children:"›"})," plan: magic-link sign-in"]})},{n:"02",title:"Review",body:"The plan renders as feature nodes, tables, and endpoints. Select any passage to annotate it, mark it for deletion, or edit the boards directly.",code:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"text-foreground",children:"/plan"})," \xb7 2 features \xb7 1 table"]})},{n:"03",title:"Verdict",body:"Approve persists the drafts. Feedback sends your notes back and the agent re-plans. Discard throws it away. Every plan is archived either way.",code:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{style:{color:"#6ee7b7"},children:"✓ approved"})," \xb7 drafts persisted"]})}],b=[{route:"/plan",title:"Review",body:"Split screen: the proposal on the left, live canvases on the right. Every plan archived with your decision and a snapshot of the moment."},{route:"/map",title:"Roadmap",body:"Features, sub-tasks, and dependencies as a graph. Duplicate features get blocked before they exist."},{route:"/db",title:"Database",body:"Proposed tables and endpoints land as drafts, diffed against your live schema: new, changed, or untouched."}],f=[{label:"Reuse first",body:"Beacon blocks duplicate features. Check the map before you create."},{label:"Design data first",body:(0,l.jsxs)(l.Fragment,{children:["Tables and endpoints before code. Review the schema as a draft on"," ",(0,l.jsx)("span",{className:"text-foreground",children:"/db"}),"."]})},{label:"Close every loop",body:"Register finished work so the map stays accurate next session."}];function y(){let e=(0,t.useRef)(null),[s,a]=(0,t.useState)(1);return(0,t.useEffect)(()=>{let s=e.current;if(!s)return;let l=new ResizeObserver(()=>a(Math.min(1,s.clientWidth/620)));return l.observe(s),()=>l.disconnect()},[]),(0,l.jsxs)("div",{className:"bm-window glass",children:[(0,l.jsxs)("div",{className:"bm-tabs",children:[(0,l.jsx)("span",{className:"h-3 w-3 rounded-full",style:{background:"#ff7a45",boxShadow:"0 0 7px rgba(255,122,69,.7)"}}),(0,l.jsx)("span",{className:"h-3 w-3 rounded-full",style:{background:"oklch(1 0 0 / .16)"}}),(0,l.jsx)("span",{className:"h-3 w-3 rounded-full",style:{background:"oklch(1 0 0 / .16)"}}),(0,l.jsx)("span",{className:"bm-tab active ml-2",children:"Roadmap"}),(0,l.jsx)("span",{className:"bm-tab",children:"Database"}),(0,l.jsx)("span",{className:"w-mono ml-auto hidden text-[0.66rem] w-muted min-[400px]:block",children:"/plan \xb7 review"})]}),(0,l.jsx)("div",{className:"bm-canvas",ref:e,style:{aspectRatio:"620 / 392"},children:(0,l.jsxs)("div",{className:"bm-stage",style:{width:620,height:392,transform:`scale(${s})`},children:[(0,l.jsxs)("svg",{className:"bm-edges",width:620,height:392,viewBox:"0 0 620 392","aria-hidden":!0,children:[(0,l.jsx)("path",{className:"bm-edge",style:{animationDelay:"1s"},pathLength:1,d:"M 135 111 C 135 148 165 168 165 210"}),(0,l.jsx)("path",{className:"bm-edge",style:{animationDelay:"1.15s"},pathLength:1,d:"M 244 78 C 300 78 320 150 374 150"}),(0,l.jsx)("path",{className:"bm-edge bm-edge-tail",style:{animationDelay:"1.7s"},pathLength:1,d:"M 596 205 C 596 230 576 242 558 252"})]}),(0,l.jsxs)("div",{className:"bm-node bm-node-draft",style:{left:26,top:38,width:218,animationDelay:".45s"},children:[(0,l.jsx)("div",{className:"bm-title",children:"Magic-link sign-in"}),(0,l.jsx)("div",{className:"bm-role",children:"Email a one-time link, no passwords"}),(0,l.jsxs)("div",{className:"bm-chiprow",children:[(0,l.jsx)("span",{className:"chip chip-sky",children:"feature"}),(0,l.jsx)("span",{className:"chip chip-violet",children:"auth"}),(0,l.jsx)("span",{className:"chip chip-amber",style:{marginLeft:"auto"},children:"Pending"})]})]}),(0,l.jsxs)("div",{className:"bm-node bm-node-draft",style:{left:70,top:210,width:190,animationDelay:".75s"},children:[(0,l.jsx)("div",{className:"bm-title",children:"Issue + verify token"}),(0,l.jsxs)("div",{className:"bm-chiprow",children:[(0,l.jsx)("span",{className:"chip chip-zinc",children:"sub-task"}),(0,l.jsx)("span",{className:"chip chip-amber",style:{marginLeft:"auto"},children:"Pending"})]})]}),(0,l.jsxs)("div",{className:"bm-table",style:{left:374,top:96,width:222,animationDelay:".6s"},children:[(0,l.jsxs)("div",{className:"bm-table-head",children:[(0,l.jsx)("span",{children:"auth_tokens"}),(0,l.jsx)("span",{className:"chip chip-green",children:"new"})]}),(0,l.jsxs)("div",{className:"bm-trow",children:[(0,l.jsx)(i.A,{size:9,style:{color:"#fde68a"}}),(0,l.jsx)("span",{children:"id"}),(0,l.jsx)("span",{className:"t",children:"uuid"})]}),(0,l.jsxs)("div",{className:"bm-trow",children:[(0,l.jsx)("span",{style:{width:9}}),(0,l.jsx)("span",{children:"token_hash"}),(0,l.jsx)("span",{className:"t",children:"text"})]}),(0,l.jsxs)("div",{className:"bm-trow",children:[(0,l.jsx)(c.A,{size:9,style:{color:"#7dd3fc"}}),(0,l.jsx)("span",{children:"user_id"}),(0,l.jsx)("span",{className:"t",children:"→ users"})]}),(0,l.jsxs)("div",{className:"bm-trow",children:[(0,l.jsx)("span",{style:{width:9}}),(0,l.jsx)("span",{children:"expires_at"}),(0,l.jsx)("span",{className:"t",children:"timestamp"})]})]}),(0,l.jsx)("span",{className:"bm-dot",style:{left:135,top:111,animationDelay:"1s"}}),(0,l.jsx)("span",{className:"bm-dot",style:{left:165,top:210,animationDelay:"1.3s"}}),(0,l.jsx)("span",{className:"bm-dot",style:{left:244,top:78,animationDelay:"1.15s"}}),(0,l.jsx)("span",{className:"bm-dot",style:{left:374,top:150,animationDelay:"1.45s"}}),(0,l.jsx)("span",{className:"bm-pin",style:{left:596,top:201,animationDelay:"1.55s"},children:"1"}),(0,l.jsxs)("div",{className:"bm-bubble",style:{left:356,top:252,width:226,animationDelay:"1.85s"},children:[(0,l.jsx)("div",{className:"lab",children:"annotation \xb7 you"}),(0,l.jsx)("div",{className:"txt",children:"Expire links after 15 min, not 24 h."})]}),(0,l.jsxs)("div",{className:"bm-bar",style:{animationDelay:"2.15s"},children:[(0,l.jsx)(d.A,{size:11,style:{color:"#6ee7b7"}}),(0,l.jsx)("span",{className:"ready",children:"plan ready \xb7 waiting for your verdict"}),(0,l.jsxs)("span",{className:"bm-btn bm-btn-approve",children:[(0,l.jsx)(o.A,{size:10})," Approve"]}),(0,l.jsxs)("span",{className:"bm-btn bm-btn-ghost",children:[(0,l.jsx)(m.A,{size:10})," Feedback"]}),(0,l.jsxs)("span",{className:"bm-btn bm-btn-ghost",children:[(0,l.jsx)(h.A,{size:10})," Discard"]})]})]})})]})}function N(){let e=(0,t.useRef)(null),[s,a]=(0,t.useState)(null);(0,t.useEffect)(()=>{let s=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(e.target.classList.add("in"),s.unobserve(e.target))})},{threshold:.12});return e.current?.querySelectorAll(".w-reveal").forEach(e=>s.observe(e)),()=>s.disconnect()},[]);let n=e=>(0,l.jsx)("button",{onClick:()=>{navigator.clipboard?.writeText(j),a(e),setTimeout(()=>a(null),1600)},className:"glass-soft w-hover grid h-8 w-8 shrink-0 place-items-center rounded-md","aria-label":"Copy install command",children:s===e?(0,l.jsx)(o.A,{size:13,style:{color:"#ff7a45"}}):(0,l.jsx)(x.A,{size:13,className:"w-muted"})});return(0,l.jsxs)("div",{className:"welcome",ref:e,children:[(0,l.jsx)("div",{className:"welcome-bg","aria-hidden":!0}),(0,l.jsx)("header",{className:"fixed inset-x-0 top-0 z-50",children:(0,l.jsx)("div",{className:"mx-auto max-w-6xl px-6",children:(0,l.jsxs)("div",{className:"w-load mt-4 glass flex items-center justify-between rounded-full py-2.5 pl-5 pr-3",style:{animationDelay:".05s"},children:[(0,l.jsxs)(r(),{href:"#top",className:"flex items-center gap-2.5",children:[(0,l.jsx)(p._,{size:20,className:"text-foreground"}),(0,l.jsx)("span",{className:"font-semibold tracking-tight",children:"Beacon"})]}),(0,l.jsxs)("nav",{className:"flex items-center gap-6 text-sm w-muted",children:[(0,l.jsx)("a",{href:"#how",className:"transition-colors hover:text-foreground",children:"The loop"}),(0,l.jsx)("a",{href:"#quickstart",className:"hidden transition-colors hover:text-foreground sm:block",children:"Quickstart"}),(0,l.jsx)("a",{href:"/docs",className:"transition-colors hover:text-foreground",children:"Docs"})]})]})})}),(0,l.jsx)("span",{id:"top"}),(0,l.jsxs)("section",{className:"px-6 pb-16 pt-20 md:pt-24",children:[(0,l.jsxs)("div",{className:"mx-auto grid max-w-6xl items-center gap-12 lg:grid-cols-[1fr_1.1fr]",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"w-load glass-soft mb-6 inline-flex items-center gap-2 rounded-full px-3.5 py-1.5",style:{animationDelay:".12s"},children:[(0,l.jsx)("span",{className:"w-live h-1.5 w-1.5 rounded-full",style:{background:"#ff7a45",boxShadow:"0 0 8px #ff7a45"}}),(0,l.jsx)("span",{className:"w-mono w-eyebrow w-muted",children:"Local \xb7 no account \xb7 no API key"})]}),(0,l.jsxs)("h1",{className:"w-load font-semibold text-[clamp(2.2rem,4.6vw,3.4rem)]",style:{letterSpacing:"-0.025em",lineHeight:1.06,animationDelay:".18s"},children:["Give your coding agent ",(0,l.jsx)("span",{className:"w-signal",children:"eyes"})," and hands."]}),(0,l.jsx)("p",{className:"w-load w-muted mt-5 max-w-md text-[1.02rem] leading-relaxed",style:{animationDelay:".26s"},children:"The session in your terminal is the brain. Beacon is where its plans become visible: features, tables, and endpoints on a canvas you annotate, edit, and approve with one click."}),(0,l.jsxs)("div",{className:"w-load mt-8",style:{animationDelay:".34s"},children:[(0,l.jsxs)("div",{className:"glass flex max-w-lg items-center gap-3 rounded-lg py-2.5 pl-4 pr-2",children:[(0,l.jsxs)("code",{className:"w-mono w-scrollbar-none min-w-0 flex-1 overflow-x-auto whitespace-nowrap text-[0.85rem]",children:[(0,l.jsx)("span",{className:"w-signal select-none",children:"$"}),(0,l.jsx)("span",{className:"ml-2",children:j}),(0,l.jsx)("span",{className:"w-caret ml-1 inline-block h-3.5 w-1.5 align-middle",style:{background:"#ff7a45"}})]}),n("hero")]}),(0,l.jsxs)("p",{className:"w-mono w-muted mt-3 text-[0.78rem]",children:["then run ",(0,l.jsx)("span",{className:"text-foreground",children:"beacon"})," inside any repo"]})]})]}),(0,l.jsx)("div",{className:"w-load min-w-0",style:{animationDelay:".3s"},children:(0,l.jsx)(y,{})})]}),(0,l.jsxs)("a",{href:"#how",className:"w-load mx-auto mt-12 flex w-fit flex-col items-center gap-2 w-muted transition-colors hover:text-foreground md:mt-20",style:{animationDelay:".6s"},children:[(0,l.jsx)("span",{className:"w-mono w-eyebrow",children:"The loop"}),(0,l.jsx)("svg",{className:"w-cue",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,l.jsx)("path",{d:"m6 9 6 6 6-6"})})]})]}),(0,l.jsx)("section",{id:"how",className:"px-6 py-16 md:py-24",children:(0,l.jsxs)("div",{className:"mx-auto max-w-5xl",children:[(0,l.jsxs)("div",{className:"w-reveal mb-14 text-center",children:[(0,l.jsx)("p",{className:"w-mono w-eyebrow w-signal mb-4",children:"The loop"}),(0,l.jsx)("h2",{className:"text-[clamp(1.9rem,4vw,2.75rem)] font-semibold tracking-tight",children:"Propose. Review. Verdict. Repeat."}),(0,l.jsx)("div",{className:"w-accent-line mx-auto mt-6 h-px w-40"})]}),(0,l.jsx)("div",{className:"grid gap-10 md:grid-cols-3",children:w.map(e=>(0,l.jsxs)("div",{className:"loop-card w-reveal glass w-hover rounded-lg p-6",children:[(0,l.jsx)("p",{className:"w-mono w-eyebrow w-signal mb-3",children:e.n}),(0,l.jsx)("h3",{className:"mb-2 font-semibold",children:e.title}),(0,l.jsx)("p",{className:"w-muted mb-4 text-[0.92rem] leading-relaxed",children:e.body}),(0,l.jsx)("code",{className:"w-mono glass-soft inline-block rounded-md px-3 py-1.5 text-[0.74rem]",children:e.code})]},e.n))}),(0,l.jsxs)("p",{className:"w-reveal w-mono w-muted mt-10 text-center text-[0.78rem]",children:["feedback sends the agent back to ",(0,l.jsx)("span",{className:"w-signal",children:"01"})," \xb7 approval persists the drafts"]})]})}),(0,l.jsx)("section",{className:"px-6 py-12",children:(0,l.jsxs)("div",{className:"mx-auto max-w-5xl",children:[(0,l.jsxs)("div",{className:"w-reveal mb-12 text-center",children:[(0,l.jsx)("p",{className:"w-mono w-eyebrow w-signal mb-4",children:"The surfaces"}),(0,l.jsx)("h2",{className:"text-[clamp(1.6rem,3.4vw,2.25rem)] font-semibold tracking-tight",children:"Everything the agent plans, drawn"})]}),(0,l.jsx)("div",{className:"grid gap-5 md:grid-cols-3",children:b.map(e=>(0,l.jsxs)("div",{className:"w-reveal glass w-hover rounded-lg p-6",children:[(0,l.jsx)("p",{className:"w-mono mb-1 text-[0.82rem] font-semibold w-signal",children:e.route}),(0,l.jsx)("h3",{className:"mb-2 font-semibold",children:e.title}),(0,l.jsx)("p",{className:"w-muted text-[0.92rem] leading-relaxed",children:e.body})]},e.route))})]})}),(0,l.jsxs)("section",{id:"quickstart",className:"px-6 py-16 md:py-24",children:[(0,l.jsxs)("div",{className:"mx-auto max-w-3xl",children:[(0,l.jsxs)("div",{className:"w-reveal mb-12 text-center",children:[(0,l.jsx)("p",{className:"w-mono w-eyebrow w-signal mb-4",children:"Quickstart"}),(0,l.jsx)("h2",{className:"text-[clamp(1.6rem,3.4vw,2.25rem)] font-semibold tracking-tight",children:"Five lines to your first approved plan"})]}),(0,l.jsxs)("div",{className:"w-reveal glass overflow-hidden rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[(0,l.jsx)("span",{className:"h-3 w-3 rounded-full",style:{background:"#ff7a45",boxShadow:"0 0 7px rgba(255,122,69,.7)"}}),(0,l.jsx)("span",{className:"h-3 w-3 rounded-full",style:{background:"oklch(1 0 0 / .16)"}}),(0,l.jsx)("span",{className:"h-3 w-3 rounded-full",style:{background:"oklch(1 0 0 / .16)"}}),(0,l.jsx)("span",{className:"w-mono ml-2 text-[0.72rem] w-muted",children:"your-repo — terminal"})]}),(0,l.jsxs)("div",{className:"px-5 py-4",children:[(0,l.jsxs)("div",{className:"ql",children:[(0,l.jsxs)("code",{className:"cmd w-scrollbar-none",children:[(0,l.jsx)("span",{className:"w-signal select-none",children:"$ "}),j]}),(0,l.jsx)("span",{className:"note",children:"01 \xb7 one binary, no account"}),n("qs")]}),(0,l.jsxs)("div",{className:"ql",children:[(0,l.jsxs)("code",{className:"cmd",children:[(0,l.jsx)("span",{className:"w-signal select-none",children:"$ "}),"cd your-repo && beacon"]}),(0,l.jsx)("span",{className:"note",children:"02 \xb7 registers the repo, opens the panel"})]}),(0,l.jsxs)("div",{className:"ql",children:[(0,l.jsxs)("code",{className:"cmd",children:[(0,l.jsx)("span",{className:"w-signal select-none",children:"› "}),"/beacon-init"]}),(0,l.jsx)("span",{className:"note",children:"03 \xb7 maps architecture, schema, roadmap"})]}),(0,l.jsxs)("div",{className:"ql",children:[(0,l.jsxs)("code",{className:"cmd",children:[(0,l.jsx)("span",{className:"w-signal select-none",children:"› "}),"plan: magic-link sign-in"]}),(0,l.jsx)("span",{className:"note",children:"04 \xb7 the plan streams onto /plan"})]}),(0,l.jsxs)("div",{className:"ql",children:[(0,l.jsxs)("code",{className:"cmd",children:[(0,l.jsxs)("span",{className:"select-none",style:{color:"#6ee7b7"},children:["✓"," "]}),"approve \xb7 feedback \xb7 discard"]}),(0,l.jsx)("span",{className:"note",children:"05 \xb7 the verdict returns to your session"})]})]})]})]}),(0,l.jsx)("div",{className:"mx-auto mt-16 max-w-5xl",children:(0,l.jsx)("div",{className:"w-reveal glass grid overflow-hidden rounded-lg md:grid-cols-3 md:divide-x md:divide-y-0 divide-y",style:{borderColor:"var(--border)"},children:f.map(e=>(0,l.jsxs)("div",{className:"p-6",style:{borderColor:"oklch(1 0 0 / 0.07)"},children:[(0,l.jsx)("p",{className:"w-mono w-eyebrow w-signal mb-2.5",children:e.label}),(0,l.jsx)("p",{className:"w-muted text-[0.9rem] leading-relaxed",children:e.body})]},e.label))})})]}),(0,l.jsx)("footer",{className:"px-6 pb-12 pt-8",children:(0,l.jsxs)("div",{className:"mx-auto max-w-5xl",children:[(0,l.jsx)("div",{className:"w-accent-line mb-8 h-px w-full opacity-60"}),(0,l.jsxs)("div",{className:"flex flex-col items-center justify-between gap-5 md:flex-row",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,l.jsx)(p._,{size:26,className:"text-foreground"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-semibold leading-tight",children:"Beacon"}),(0,l.jsx)("p",{className:"w-mono w-muted text-[0.72rem]",children:"the visual planning surface for your terminal"})]})]}),(0,l.jsxs)("nav",{className:"flex items-center gap-6 text-sm w-muted",children:[(0,l.jsx)("a",{href:"/docs",className:"transition-colors hover:text-foreground",children:"Docs"}),(0,l.jsx)("a",{href:"#",className:"transition-colors hover:text-foreground",children:"Changelog"})]}),(0,l.jsxs)("p",{className:"w-mono w-muted text-[0.72rem]",children:["Created by"," ",(0,l.jsxs)("a",{href:"https://www.instagram.com/wenzorithelly/",target:"_blank",rel:"noreferrer",className:"w-signal inline-flex items-center gap-1 underline decoration-dotted underline-offset-2 transition-opacity hover:opacity-80",children:[(0,l.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,l.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"5",ry:"5"}),(0,l.jsx)("path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"}),(0,l.jsx)("line",{x1:"17.5",y1:"6.5",x2:"17.51",y2:"6.5"})]}),"Wenzo"]}),(0,l.jsx)("span",{className:"mx-2 opacity-40",children:"\xb7"}),"\xa9 2026 Beacon"]})]})]})})]})}},32133:(e,s,a)=>{"use strict";a.d(s,{A:()=>l});let l=(0,a(30772).A)("message-square-plus",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]])},39593:(e,s,a)=>{"use strict";a.d(s,{EO:()=>r,S2:()=>t,W6:()=>n});var l=a(41463);let t="https://api.github.com/repos/wenzorithelly/beacon/releases/latest",n=(l.env.NEXT_PUBLIC_BEACON_SITE_URL??"https://www.trybeacon.sh").replace(/\/$/,""),r=`curl -fsSL ${n}/install.sh | sh`},51128:(e,s,a)=>{"use strict";a.d(s,{A:()=>l});let l=(0,a(30772).A)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]])},52965:(e,s,a)=>{"use strict";a.d(s,{_:()=>t});var l=a(95155);function t({size:e=18,className:s}){return(0,l.jsxs)("svg",{width:e,height:e,viewBox:"11 1.5 74 74",fill:"none",className:s,"aria-hidden":"true",children:[(0,l.jsx)("defs",{children:(0,l.jsxs)("linearGradient",{id:"beacon-mark-beam",x1:"0",y1:"1",x2:"0",y2:"0",children:[(0,l.jsx)("stop",{offset:"0",stopColor:"#ffb27a",stopOpacity:"0.9"}),(0,l.jsx)("stop",{offset:"0.55",stopColor:"#ff7a45",stopOpacity:"0.3"}),(0,l.jsx)("stop",{offset:"1",stopColor:"#ff7a45",stopOpacity:"0"})]})}),(0,l.jsx)("path",{d:"M48 30 L40 4 L56 4 Z",fill:"url(#beacon-mark-beam)"}),(0,l.jsx)("path",{d:"M48 33 L72.5 73 L23.5 73 Z",fill:"currentColor",stroke:"currentColor",strokeWidth:2.4,strokeLinejoin:"round"}),(0,l.jsx)("circle",{cx:"48",cy:"31",r:"5.2",fill:"var(--accent-2, #ff7a45)",style:{filter:"drop-shadow(0 0 4px var(--accent-2, #ff7a45))"}}),(0,l.jsx)("circle",{cx:"48",cy:"31",r:"2",fill:"#ffd9c2"})]})}},64577:(e,s,a)=>{"use strict";a.d(s,{A:()=>l});let l=(0,a(30772).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},65738:(e,s,a)=>{"use strict";a.d(s,{A:()=>l});let l=(0,a(30772).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},71265:(e,s,a)=>{"use strict";a.d(s,{default:()=>i});var l=a(12115),t={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},n=a(30907);let r=(0,l.createContext)({}),i=(0,l.forwardRef)(({color:e,size:s,strokeWidth:a,absoluteStrokeWidth:i,className:c="",children:d,iconNode:o,...m},h)=>{let{size:x=24,strokeWidth:p=2,absoluteStrokeWidth:u=!1,color:j="currentColor",className:w=""}=(0,l.useContext)(r)??{},b=i??u?24*Number(a??p)/Number(s??x):a??p;return(0,l.createElement)("svg",{ref:h,...t,width:s??x??t.width,height:s??x??t.height,stroke:e??j,strokeWidth:b,className:(0,n.z)("lucide",w,c),...!d&&!(e=>{for(let s in e)if(s.startsWith("aria-")||"role"===s||"title"===s)return!0;return!1})(m)&&{"aria-hidden":"true"},...m},[...o.map(([e,s])=>(0,l.createElement)(e,s)),...Array.isArray(d)?d:[d]])})},72543:(e,s,a)=>{Promise.resolve().then(a.bind(a,31698))},81499:(e,s,a)=>{"use strict";a.d(s,{A:()=>l});let l=(0,a(30772).A)("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]])},86272:(e,s,a)=>{"use strict";a.d(s,{A:()=>l});let l=(0,a(30772).A)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]])},93340:()=>{},99314:(e,s,a)=>{"use strict";a.d(s,{A:()=>l});let l=(0,a(30772).A)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])}},e=>{e.O(0,[1477,8500,8441,3794,7358],()=>e(e.s=72543)),_N_E=e.O()}]);