maestro-flow 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/conceptual-planning-agent.md +1 -0
- package/.claude/agents/workflow-analyzer.md +114 -114
- package/.claude/agents/workflow-collab-planner.md +144 -144
- package/.claude/agents/workflow-debugger.md +102 -103
- package/.claude/agents/workflow-executor.md +127 -128
- package/.claude/agents/workflow-integration-checker.md +82 -82
- package/.claude/agents/workflow-nyquist-auditor.md +85 -84
- package/.claude/agents/workflow-phase-researcher.md +85 -85
- package/.claude/agents/workflow-plan-checker.md +90 -90
- package/.claude/agents/workflow-planner.md +178 -178
- package/.claude/agents/workflow-roadmapper.md +81 -83
- package/.claude/agents/workflow-verifier.md +119 -119
- package/.claude/commands/learn-retro.md +2 -2
- package/.claude/commands/learn-second-opinion.md +2 -2
- package/.claude/commands/maestro-brainstorm.md +1 -0
- package/.claude/commands/maestro-fork.md +133 -111
- package/.claude/commands/maestro-merge.md +85 -77
- package/.claude/commands/maestro-plan.md +88 -2
- package/.claude/commands/maestro-roadmap.md +113 -2
- package/.claude/commands/maestro.md +1 -0
- package/.claude/commands/quality-business-test.md +5 -5
- package/.claude/commands/quality-debug.md +3 -2
- package/.claude/commands/quality-retrospective.md +6 -4
- package/.claude/commands/quality-review.md +1 -1
- package/.claude/commands/quality-test-gen.md +5 -4
- package/.codex/skills/maestro-brainstorm/SKILL.md +1 -1
- package/.codex/skills/maestro-fork/SKILL.md +98 -68
- package/.codex/skills/maestro-init/SKILL.md +4 -3
- package/.codex/skills/maestro-merge/SKILL.md +69 -62
- package/.codex/skills/maestro-ui-design/SKILL.md +1 -1
- package/.codex/skills/maestro-verify/SKILL.md +12 -12
- package/.codex/skills/manage-learn/SKILL.md +1 -1
- package/.codex/skills/manage-status/SKILL.md +4 -4
- package/.codex/skills/quality-business-test/SKILL.md +2 -2
- package/.codex/skills/quality-integration-test/SKILL.md +1 -1
- package/.codex/skills/quality-retrospective/SKILL.md +7 -7
- package/.codex/skills/quality-review/SKILL.md +2 -2
- package/.codex/skills/quality-test/SKILL.md +2 -2
- package/.codex/skills/quality-test-gen/SKILL.md +1 -1
- package/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/dashboard/dist/assets/{ArtifactsPage-DZNCi6tn.js → ArtifactsPage-CUrrDGgN.js} +1 -1
- package/dashboard/dist/assets/ChatInput-pUOLJIKE.js +49 -0
- package/dashboard/dist/assets/ChatPage-B8Xqkt0v.js +27 -0
- package/dashboard/dist/assets/{CollabPage-B4NAHXS2.js → CollabPage-DIUXeazv.js} +1 -1
- package/dashboard/dist/assets/{ExecutionPanel-CFt4LJyq.js → ExecutionPanel-VmYeADFj.js} +1 -1
- package/dashboard/dist/assets/KanbanPage-DLq8v7hg.js +21 -0
- package/dashboard/dist/assets/{MarkdownRenderer-X4af_WNb.js → MarkdownRenderer-D7AehrnR.js} +1 -1
- package/dashboard/dist/assets/{McpPage-BKfCVIyU.js → McpPage-BY0SjTgw.js} +2 -2
- package/dashboard/dist/assets/{OutputPanel-BlBQFJSW.js → OutputPanel-B-Rjwgmv.js} +1 -1
- package/dashboard/dist/assets/{ProblemsPanel-De3DLvoI.js → ProblemsPanel-GEpF-oi4.js} +1 -1
- package/dashboard/dist/assets/RequirementBoardPage-xs8uDM7I.js +6 -0
- package/dashboard/dist/assets/{RequirementPage-Bllxe2XI.js → RequirementPage-BKDSFwjA.js} +5 -10
- package/dashboard/dist/assets/SpecsPage-DLFb9ZH0.js +36 -0
- package/dashboard/dist/assets/SupervisorPage-SOki_kgz.js +6 -0
- package/dashboard/dist/assets/TeamsPage-BO2kP70F.js +11 -0
- package/dashboard/dist/assets/{TreeBrowser-Q12qobZs.js → TreeBrowser-B9DHdULE.js} +1 -1
- package/dashboard/dist/assets/{WorkflowPage-D_Fzdy3_.js → WorkflowPage-C8hWbYim.js} +1 -1
- package/dashboard/dist/assets/{check-u6fGOwQO.js → check-DJDk3A2a.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-Csu22t58.js → chevron-right-C7bVDreZ.js} +1 -1
- package/dashboard/dist/assets/{circle-CMrkbRNg.js → circle-Qfgy4LB_.js} +1 -1
- package/dashboard/dist/assets/{circle-alert-c3tH1P4z.js → circle-alert-Na1vf6qQ.js} +1 -1
- package/dashboard/dist/assets/{circle-check-gYxxSYuH.js → circle-check-CEGgy3NV.js} +1 -1
- package/dashboard/dist/assets/{circle-check-big-TDSeWstm.js → circle-check-big-3JB8zRYj.js} +1 -1
- package/dashboard/dist/assets/{code-CFN2uX9V.js → code-Ble63Idz.js} +1 -1
- package/dashboard/dist/assets/{columns-3-38xIDlzy.js → columns-3-BUcKlxve.js} +1 -1
- package/dashboard/dist/assets/{download-DC7KkKyP.js → download-CMqkfn8x.js} +1 -1
- package/dashboard/dist/assets/{folder-CWq_lAnf.js → folder-B9ewx9LL.js} +1 -1
- package/dashboard/dist/assets/index-C2Mcb4TJ.js +231 -0
- package/dashboard/dist/assets/index-DyBbPc18.css +1 -0
- package/dashboard/dist/assets/{index-Do71weNR.js → index-JTmGteaT.js} +1 -1
- package/dashboard/dist/assets/{list-CgIP_2A-.js → list-DI8Wn2aT.js} +1 -1
- package/dashboard/dist/assets/loader-B5F6PzFT.js +11 -0
- package/dashboard/dist/assets/{minus-DYoN5UGk.js → minus-Lp_BfctG.js} +1 -1
- package/dashboard/dist/assets/{pen-line-Bh_WKYHm.js → pen-line-Ch7sphzZ.js} +1 -1
- package/dashboard/dist/assets/pencil-_yRMHmGT.js +6 -0
- package/dashboard/dist/assets/{proxy-BKxDAKTj.js → proxy-D72Y8a4Y.js} +1 -1
- package/dashboard/dist/assets/{search-SieXnOgr.js → search-BS6fI6Bg.js} +1 -1
- package/dashboard/dist/assets/{shallow-Bme1JY57.js → shallow-BXasQBvr.js} +1 -1
- package/dashboard/dist/assets/table-CeGlFjlP.js +6 -0
- package/dashboard/dist/assets/{terminal-BB3Xfuv5.js → terminal-BJic2yW-.js} +1 -1
- package/dashboard/dist/assets/{trash-2-C8f4vFFM.js → trash-2-Czz4X8Fb.js} +1 -1
- package/dashboard/dist/assets/{zap-4uwlzVm0.js → zap-C3H0jVFA.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js +16 -1
- package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js +1 -2
- package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.d.ts +1 -1
- package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js +2 -1
- package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/index.js +3 -0
- package/dashboard/dist-server/dashboard/src/server/index.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/collab.js +124 -0
- package/dashboard/dist-server/dashboard/src/server/routes/collab.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.d.ts +10 -0
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js +73 -0
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/shared/collab-types.d.ts +31 -0
- package/dashboard/dist-server/dashboard/src/shared/collab-types.js +28 -0
- package/dashboard/dist-server/dashboard/src/shared/collab-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/constants.js +5 -0
- package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/coordinate-types.d.ts +22 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +12 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.js +12 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/shared/team-types.js +7 -0
- package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +27 -1
- package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
- package/dashboard/dist-server/shared/agent-types.d.ts +4 -0
- package/dashboard/dist-server/src/hooks/constants.d.ts +1 -1
- package/dashboard/dist-server/src/hooks/constants.js +2 -2
- package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
- package/dist/shared/agent-types.d.ts +4 -0
- package/dist/shared/agent-types.d.ts.map +1 -1
- package/dist/src/commands/install-backend.d.ts.map +1 -1
- package/dist/src/commands/install-backend.js +29 -18
- package/dist/src/commands/install-backend.js.map +1 -1
- package/dist/src/hooks/__tests__/statusline-visual-test.js +23 -1
- package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -1
- package/dist/src/hooks/constants.d.ts +1 -1
- package/dist/src/hooks/constants.d.ts.map +1 -1
- package/dist/src/hooks/constants.js +2 -2
- package/dist/src/hooks/constants.js.map +1 -1
- package/dist/src/hooks/skill-context.d.ts +3 -0
- package/dist/src/hooks/skill-context.d.ts.map +1 -1
- package/dist/src/hooks/skill-context.js +95 -9
- package/dist/src/hooks/skill-context.js.map +1 -1
- package/dist/src/hooks/statusline.d.ts.map +1 -1
- package/dist/src/hooks/statusline.js +6 -3
- package/dist/src/hooks/statusline.js.map +1 -1
- package/dist/src/tools/merge-validator.d.ts.map +1 -1
- package/dist/src/tools/merge-validator.js +114 -16
- package/dist/src/tools/merge-validator.js.map +1 -1
- package/package.json +1 -1
- package/shared/agent-types.ts +4 -0
- package/templates/worktree-scope.json +9 -10
- package/templates/worktrees.json +26 -27
- package/workflows/brainstorm.md +10 -1
- package/workflows/debug.md +16 -6
- package/workflows/fork.md +100 -36
- package/workflows/integration-test.md +14 -2
- package/workflows/issue.md +14 -4
- package/workflows/learn.md +19 -5
- package/workflows/maestro.md +1 -0
- package/workflows/merge.md +113 -55
- package/workflows/retrospective.md +61 -22
- package/workflows/review.md +17 -4
- package/workflows/test.md +12 -2
- package/workflows/ui-style.md +9 -2
- package/dashboard/dist/assets/ChatInput-Bvr-FeEq.js +0 -49
- package/dashboard/dist/assets/ChatPage-D9zTkJZo.js +0 -22
- package/dashboard/dist/assets/KanbanPage-C8USth6H.js +0 -21
- package/dashboard/dist/assets/RequirementBoardPage-Bf1trzqs.js +0 -11
- package/dashboard/dist/assets/SpecsPage-9lwxKT27.js +0 -36
- package/dashboard/dist/assets/SupervisorPage-SusdfHFq.js +0 -6
- package/dashboard/dist/assets/TeamsPage-DsuM6OwC.js +0 -6
- package/dashboard/dist/assets/arrow-left-Bqtb2hle.js +0 -6
- package/dashboard/dist/assets/index-DWG-WrzT.js +0 -231
- package/dashboard/dist/assets/index-GUNJodSR.css +0 -1
- package/dashboard/dist/assets/table-llyEtj-7.js +0 -6
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var We=e=>{throw TypeError(e)};var He=(e,t,r)=>t.has(e)||We("Cannot "+r);var ie=(e,t,r)=>(He(e,t,"read from private field"),r?r.call(e):t.get(e)),Ve=(e,t,r)=>t.has(e)?We("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ue=(e,t,r,n)=>(He(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);import{d as kt,k as O,r as f,s as me,j as o,X as Ct,q as W,t as Jt,F as Ke,v as pe,w as zt,M as Qt}from"./index-DWG-WrzT.js";import{C as Ye,M as er}from"./ChatInput-Bvr-FeEq.js";import{T as tr}from"./TreeBrowser-Q12qobZs.js";import"./zap-4uwlzVm0.js";import"./MarkdownRenderer-X4af_WNb.js";import"./chevron-right-Csu22t58.js";import"./terminal-BB3Xfuv5.js";import"./circle-alert-c3tH1P4z.js";import"./search-SieXnOgr.js";import"./folder-CWq_lAnf.js";/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const rr=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],nr=kt("rows-2",rr);/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const or=[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],sr=kt("square-split-horizontal",or);function ar(e){const t=O(n=>n.pendingApprovals),r=f.useMemo(()=>e?Object.values(t).find(n=>n.processId===e)??null:null,[e,t]);f.useEffect(()=>{if(!r)return;function n(a){const i=a.target;if(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.isContentEditable)return;const p=a.key;if(p==="y"||p==="Y"){a.preventDefault(),me({action:"approve",processId:r.processId,requestId:r.id,allow:!0});return}if(p==="Escape"){a.preventDefault(),me({action:"approve",processId:r.processId,requestId:r.id,allow:!1});return}if(p==="a"||p==="A"){a.preventDefault(),me({action:"approve",processId:r.processId,requestId:r.id,allow:!0});return}}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[r])}const Tt=f.createContext(null);function ir({children:e,content:t}){return o.jsx(Tt,{value:t,children:e})}function lr(){return f.useContext(Tt)}const cr={spawning:"var(--color-accent-blue)",running:"var(--color-accent-green, #4caf50)",paused:"var(--color-accent-yellow)",stopping:"var(--color-accent-orange)",stopped:"var(--color-text-tertiary)",error:"var(--color-accent-red, #e53935)"},Ze={spawning:"starting",running:"running",paused:"paused",stopping:"stopping",error:"error"},ur=f.memo(function({tab:t,isActive:r,isFocused:n,processStatus:a,onSelect:i,onClose:p,onDragStart:l,groupId:s}){const u=f.useCallback(()=>{i(t.id)},[i,t.id]),c=f.useCallback(g=>{g.stopPropagation(),p(t.id)},[p,t.id]),h=f.useCallback(g=>{l(t.id,g)},[l,t.id]),d=f.useCallback(g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"},[]),m=a?cr[a]??"var(--color-text-tertiary)":void 0;return o.jsxs("div",{role:"tab","aria-selected":r,tabIndex:r?0:-1,className:`
|
|
12
|
-
group relative flex items-center gap-[var(--spacing-1)] h-[28px]
|
|
13
|
-
min-w-[100px] max-w-[240px] px-[var(--spacing-2)] cursor-pointer
|
|
14
|
-
select-none whitespace-nowrap transition-colors duration-100
|
|
15
|
-
text-[length:var(--font-size-xs)]
|
|
16
|
-
${r?"bg-bg-primary text-text-primary border-b-[2px] border-b-accent-blue":"text-text-tertiary hover:bg-bg-hover border-b-[2px] border-b-transparent"}
|
|
17
|
-
|
|
18
|
-
`,style:{flexShrink:1},onClick:u,onDragStart:h,onDragOver:d,draggable:!0,"data-tab-id":t.id,"data-group-id":s,title:t.title,children:[o.jsx("svg",{className:"shrink-0",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",stroke:m??"var(--color-accent-green)",children:o.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),o.jsx("span",{className:"truncate flex-1 min-w-0",children:t.title}),a&&Ze[a]&&o.jsxs("span",{className:"text-[9px] font-normal shrink-0",style:{color:r?"var(--color-text-tertiary)":"var(--color-text-placeholder)"},children:["· ",Ze[a]]}),o.jsx("button",{className:`
|
|
19
|
-
p-[2px] rounded-[var(--radius-sm)] hover:bg-bg-active transition-opacity shrink-0
|
|
20
|
-
${r?"opacity-100":"opacity-0 group-hover:opacity-100"}
|
|
21
|
-
`,onClick:c,"aria-label":`Close ${t.title}`,tabIndex:-1,children:o.jsx(Ct,{size:12,className:"text-text-tertiary"})})]})}),Xe="application/json",qe="maestro-tab-drag";function Ce(e){return e.type==="leaf"?[e]:[...Ce(e.first),...Ce(e.second)]}const dr=f.memo(function({tabs:t,activeTabId:r,groupId:n,isFocused:a,onTabSelect:i,onTabClose:p}){const{state:l,dispatch:s}=W(),u=O(g=>g.processes),c=f.useRef(null),h=f.useCallback((g,x)=>{const y=t.find(b=>b.id===g);if(!y)return;const v={type:qe,tabId:g,sourceGroupId:n,processId:y.ref};x.dataTransfer.setData(Xe,JSON.stringify(v)),x.dataTransfer.effectAllowed="move"},[t,n]),d=f.useCallback(g=>{g.preventDefault();const x=g.dataTransfer.getData(Xe);if(!x)return;let y;try{y=JSON.parse(x)}catch{return}if(y.type!==qe)return;const v=Ce(l.editorArea).find(w=>w.id===y.sourceGroupId);if(!v)return;const b=v.tabs.find(w=>w.id===y.tabId);b&&(y.sourceGroupId===n?s({type:"SET_ACTIVE_TAB",groupId:n,tabId:y.tabId}):(s({type:"CLOSE_TAB",groupId:y.sourceGroupId,tabId:y.tabId}),s({type:"OPEN_TAB",groupId:n,tab:b})))},[l.editorArea,n,s]),m=f.useCallback(g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"},[]);return o.jsxs("div",{className:"flex items-center h-[var(--size-tabbar-height)] min-h-[var(--size-tabbar-height)] bg-bg-secondary",onDrop:d,onDragOver:m,"data-tab-bar":n,children:[o.jsx("div",{ref:c,className:"flex items-end h-full overflow-x-auto scrollbar-none flex-1 min-w-0",role:"tablist","aria-label":"Open sessions",children:t.map(g=>{const x=g.id===r,y=g.ref?u[g.ref]:void 0,v=y==null?void 0:y.status;return o.jsx(ur,{tab:g,isActive:x,isFocused:a,processStatus:v,onSelect:i,onClose:p,onDragStart:h,groupId:n},g.id)})}),o.jsx(fr,{groupId:n})]})}),pr=[{type:"chat",label:"Chat",color:"var(--color-accent-green)",icon:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},{type:"file",label:"Code",color:"var(--color-accent-blue)",icon:""},{type:"agent",label:"Terminal",color:"var(--color-accent-orange)",icon:""}];let Je=0;function fr({groupId:e}){const[t,r]=f.useState(!1),{dispatch:n}=W(),a=f.useRef(null),[i,p]=f.useState({top:0,left:0}),l=f.useCallback(s=>{Je++;const u={id:`new-${s.type}-${Je}`,type:s.type,title:s.label,ref:""};n({type:"OPEN_TAB",groupId:e,tab:u}),r(!1)},[n,e]);return f.useEffect(()=>{if(t&&a.current){const s=a.current.getBoundingClientRect();p({top:s.bottom+2,left:s.left})}},[t]),o.jsxs("div",{className:"self-center ml-[2px] shrink-0",children:[o.jsx("button",{ref:a,type:"button",onClick:s=>{s.stopPropagation(),r(u=>!u)},className:"w-[22px] h-[22px] rounded-[4px] border-none bg-transparent flex items-center justify-center cursor-pointer transition-all duration-100",style:{color:"var(--color-text-placeholder)"},onMouseEnter:s=>{s.currentTarget.style.backgroundColor="var(--color-bg-hover)",s.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:s=>{t||(s.currentTarget.style.backgroundColor="transparent",s.currentTarget.style.color="var(--color-text-placeholder)")},title:"New tab",children:o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),t&&Jt.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{position:"fixed",inset:0,zIndex:9998},onClick:()=>r(!1)}),o.jsx("div",{style:{position:"fixed",top:i.top,left:i.left,zIndex:9999,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.12)",minWidth:120,overflow:"hidden"},children:pr.map(s=>o.jsxs("button",{type:"button",onClick:()=>l(s),className:"flex items-center gap-[6px] w-full px-[10px] py-[6px] border-none bg-transparent cursor-pointer text-left transition-colors duration-100 text-[11px]",style:{color:"var(--color-text-primary)",fontFamily:"inherit"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent"},children:[o.jsx(hr,{type:s.type,color:s.color}),o.jsx("span",{className:"font-medium",children:s.label})]},s.type))})]}),document.body)]})}function hr({type:e,color:t}){return e==="chat"?o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}):e==="file"?o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"16 18 22 12 16 6"}),o.jsx("polyline",{points:"8 6 2 12 8 18"})]}):o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"4 17 10 11 4 5"}),o.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function Qe(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),r=e%60;return`${t}m ${r}s`}function xr({processId:e}){const t=O(s=>e?s.processThoughts[e]:void 0),r=O(s=>e?s.processStreaming[e]??!1:!1),[n,a]=f.useState(0),i=f.useRef(Date.now());if(f.useEffect(()=>{if(!r&&!(t!=null&&t.subject)){a(0);return}i.current=Date.now(),a(0);const s=setInterval(()=>{a(Math.floor((Date.now()-i.current)/1e3))},1e3);return()=>clearInterval(s)},[r,t==null?void 0:t.subject]),!r&&!(t!=null&&t.subject))return null;const p=()=>{e&&me({action:"stop",processId:e})};if(r&&!(t!=null&&t.subject))return o.jsx("div",{style:et,children:o.jsxs("div",{style:tt,children:[o.jsx(rt,{}),o.jsxs("span",{style:{color:"var(--color-text-secondary)",fontSize:12},children:["Processing...",o.jsxs("span",{style:{marginLeft:6,opacity:.6},children:["(",Qe(n),")"]})]}),o.jsx(nt,{onClick:p})]})});const l=t&&t.description&&t.description!==t.subject;return o.jsx("div",{style:et,children:o.jsxs("div",{style:tt,children:[r&&o.jsx(rt,{}),(t==null?void 0:t.subject)&&o.jsx("span",{style:gr,children:t.subject}),l&&o.jsx("span",{style:{flex:1,fontSize:12,color:"var(--color-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.description}),r&&o.jsxs("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",whiteSpace:"nowrap"},children:["(",Qe(n),")"]}),r&&o.jsx(nt,{onClick:p})]})})}const et={background:"linear-gradient(135deg, var(--color-bg-card) 0%, var(--color-bg-primary) 100%)",borderRadius:10,padding:"8px 12px",margin:"0 16px 4px 16px",border:"1px solid var(--color-border-divider)"},tt={display:"flex",alignItems:"center",gap:8},gr={display:"inline-block",fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:6,backgroundColor:"var(--color-tint-exploring)",color:"var(--color-accent-blue)",whiteSpace:"nowrap"};function rt(){return o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-blue)",strokeWidth:"2.5",strokeLinecap:"round",style:{animation:"spin 1s linear infinite",flexShrink:0},children:[o.jsx("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"}),o.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]})}function nt({onClick:e}){return o.jsx("button",{type:"button",onClick:e,style:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:6,border:"1px solid var(--color-border)",backgroundColor:"var(--color-bg-card)",cursor:"pointer",color:"var(--color-text-tertiary)",flexShrink:0,padding:0,transition:"all 150ms"},onMouseEnter:t=>{const r=t.currentTarget;r.style.borderColor="var(--color-accent-red)",r.style.backgroundColor="var(--color-tint-blocked)",r.style.color="var(--color-accent-red)"},onMouseLeave:t=>{const r=t.currentTarget;r.style.borderColor="var(--color-border)",r.style.backgroundColor="var(--color-bg-card)",r.style.color="var(--color-text-tertiary)"},"aria-label":"Stop process",children:o.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})})}function vr(e){var n;const t=((n=e.split(".").pop())==null?void 0:n.toLowerCase())??"";return{ts:"ts",tsx:"ts",js:"js",jsx:"js",mjs:"js",cjs:"js",json:"json",css:"css",html:"html",md:"md",yaml:"yaml",yml:"yaml",py:"py",rs:"rs",go:"go",sh:"sh",bash:"sh"}[t]??""}function mr(e,t){if(!t||t==="md")return[e];const r=[],n=t==="json"?[[/"(?:[^"\\]|\\.)*"/g,"var(--color-accent-green, #3D9B6F)"],[/\b(true|false|null)\b/g,"var(--color-accent-orange, #D4832E)"],[/\b\d+(?:\.\d+)?\b/g,"var(--color-accent-blue, #4A90D9)"]]:[[/\/\/.*$/gm,"var(--color-text-tertiary)"],[/(['"`])(?:(?!\1|\\).|\\.)*\1/g,"var(--color-accent-green, #3D9B6F)"],[/`[^`]*`/g,"var(--color-accent-green, #3D9B6F)"],[/\b(import|export|from|const|let|var|function|return|if|else|for|while|class|interface|type|extends|implements|new|async|await|try|catch|throw|switch|case|break|default|yield|of|in|as|is|typeof|instanceof|void|null|undefined|true|false|this|super|static|readonly|public|private|protected|abstract|enum|namespace|module|declare|require)\b/g,"var(--color-accent-purple, #8B6BBF)"],[/\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/g,"var(--color-accent-blue, #4A90D9)"],[/\b([a-zA-Z_$]\w*)\s*\(/g,"var(--color-accent-orange, #D4832E)"]],a=[];for(const[s,u]of n){const c=new RegExp(s.source,s.flags);let h;for(;(h=c.exec(e))!==null;)h[1]&&s.source.includes("\\(")?a.push({start:h.index,end:h.index+h[1].length,text:h[1],color:u}):a.push({start:h.index,end:h.index+h[0].length,text:h[0],color:u})}a.sort((s,u)=>s.start-u.start);const i=[];let p=0;for(const s of a)s.start>=p&&(i.push(s),p=s.end);let l=0;for(const s of i)s.start>l&&r.push(e.slice(l,s.start)),r.push({text:s.text,color:s.color}),l=s.end;return l<e.length&&r.push(e.slice(l)),r.length>0?r:[e]}function yr({filePath:e,onClose:t,embedded:r}){const[n,a]=f.useState(null),[i,p]=f.useState(!0),[l,s]=f.useState(null);f.useEffect(()=>{let m=!1;return p(!0),s(null),fetch(`/api/workspace/file?path=${encodeURIComponent(e)}`).then(async g=>{m||(g.ok?a(await g.text()):(s(`Failed to load: ${g.status}`),a(null)))}).catch(()=>{m||s("Failed to fetch file")}).finally(()=>{m||p(!1)}),()=>{m=!0}},[e]);const u=e.split("/").pop()??e,c=vr(e),h=f.useMemo(()=>(n==null?void 0:n.split(`
|
|
22
|
-
`))??[],[n]),d=h.length>0?String(h.length).length:1;return o.jsxs("div",{className:"flex flex-col h-full",children:[!r&&o.jsxs("div",{className:"shrink-0 flex items-center gap-2 px-4 py-2 border-b",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-secondary)"},children:[o.jsx(Ke,{size:13,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),o.jsx("span",{className:"text-[12px] font-medium truncate flex-1",style:{color:"var(--color-text-primary)"},title:e,children:u}),o.jsx("span",{className:"text-[10px] truncate max-w-[200px]",style:{color:"var(--color-text-tertiary)"},children:e}),o.jsx("button",{type:"button",onClick:t,className:"w-6 h-6 rounded flex items-center justify-center transition-colors",style:{color:"var(--color-text-tertiary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--color-bg-hover)",m.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.color="var(--color-text-tertiary)"},"aria-label":"Close file viewer",children:o.jsx(Ct,{size:12,strokeWidth:2})})]}),r&&o.jsxs("div",{className:"shrink-0 flex items-center gap-[6px] px-3 h-[26px] border-b",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-primary)"},children:[o.jsx(Ke,{size:12,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),o.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--color-text-secondary)"},title:e,children:e})]}),o.jsxs("div",{className:"flex-1 overflow-auto",children:[i&&o.jsx("div",{className:"p-4 text-[12px] animate-pulse",style:{color:"var(--color-text-tertiary)"},children:"Loading..."}),l&&o.jsx("div",{className:"p-4 text-[12px]",style:{color:"var(--color-accent-red)"},children:l}),!i&&!l&&n!==null&&o.jsx("div",{className:"m-0 text-[12px] leading-[1.7]",style:{fontFamily:"var(--font-mono)",tabSize:2},children:h.map((m,g)=>o.jsxs("div",{className:"flex hover:bg-bg-hover",style:{minHeight:"1.7em"},children:[o.jsx("span",{className:"shrink-0 select-none text-right pr-[12px] pl-[12px]",style:{color:"var(--color-text-placeholder)",width:`${d+3}ch`,userSelect:"none"},children:g+1}),o.jsx("span",{className:"flex-1 whitespace-pre-wrap break-all pr-4",style:{color:"var(--color-text-primary)"},children:mr(m,c).map((x,y)=>typeof x=="string"?o.jsx("span",{children:x},y):o.jsx("span",{style:{color:x.color},children:x.text},y))})]},g))})]})]})}const br=2;function ze(e,t){if(e.type==="leaf")return e.id===t?0:-1;const r=ze(e.first,t);if(r>=0)return r+1;const n=ze(e.second,t);return n>=0?n+1:-1}function wr({tab:e}){switch(e.type){case"chat":case"agent":return e.ref?o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsx("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:o.jsx(er,{processId:e.ref})}),o.jsx(xr,{processId:e.ref}),o.jsx(Ye,{processId:e.ref})]}):o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center h-full",children:o.jsxs("div",{className:"w-full px-4",style:{maxWidth:"clamp(360px, calc(100% - 32px), 700px)"},children:[o.jsxs("div",{className:"flex flex-col items-center mb-6",children:[o.jsx("h2",{className:"text-[16px] font-semibold mb-[6px]",style:{color:"var(--color-text-secondary)"},children:"Start a new conversation"}),o.jsx("p",{className:"text-[13px]",style:{color:"var(--color-text-tertiary)"},children:"Select an agent, type a message, and press Enter to begin."})]}),o.jsx(Ye,{processId:null})]})});case"file":return e.ref?o.jsx(yr,{filePath:e.ref,onClose:()=>{},embedded:!0}):o.jsx("div",{className:"flex items-center justify-center h-full text-[12px]",style:{color:"var(--color-text-placeholder)"},children:"Open a file from the Explorer sidebar"});default:return o.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[13px]",children:e.title})}}const Sr=f.memo(function({node:t}){const{state:r,dispatch:n}=W(),a=pe(v=>v.focusedGroupId),i=lr(),p=a===t.id,l=t.id==="editor-group-1",s=f.useRef(t.tabs);s.current=t.tabs;const u=f.useRef(t.activeTabId);u.current=t.activeTabId;const c=f.useRef(t.id);c.current=t.id;const h=f.useCallback(v=>{n({type:"SET_ACTIVE_TAB",groupId:t.id,tabId:v});const b=t.tabs.find(w=>w.id===v);(b==null?void 0:b.type)==="chat"&&b.ref&&O.getState().setActiveProcessId(b.ref)},[n,t.id,t.tabs]),d=f.useCallback(v=>{n({type:"CLOSE_TAB",groupId:t.id,tabId:v})},[n,t.id]),m=f.useCallback(()=>{n({type:"SPLIT_GROUP",groupId:t.id,direction:"horizontal"})},[n,t.id]),g=f.useCallback(()=>{n({type:"SPLIT_GROUP",groupId:t.id,direction:"vertical"})},[n,t.id]),x=f.useCallback(()=>{p||n({type:"SET_FOCUSED_GROUP",groupId:t.id})},[n,t.id,p]),y=ze(r.editorArea,t.id)<br;return f.useEffect(()=>{function v(b){const w=s.current,j=u.current,S=c.current;if(b.ctrlKey&&b.key==="Tab"&&!b.shiftKey){if(b.preventDefault(),w.length<2)return;const T=(w.findIndex(I=>I.id===j)+1)%w.length;n({type:"SET_ACTIVE_TAB",groupId:S,tabId:w[T].id});return}if(b.ctrlKey&&b.key==="Tab"&&b.shiftKey){if(b.preventDefault(),w.length<2)return;const T=(w.findIndex(I=>I.id===j)-1+w.length)%w.length;n({type:"SET_ACTIVE_TAB",groupId:S,tabId:w[T].id});return}if(b.ctrlKey&&b.key==="w"){if(b.preventDefault(),!j)return;n({type:"CLOSE_TAB",groupId:S,tabId:j});return}}return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[n]),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden ",onMouseDown:x,"data-editor-group":t.id,children:[o.jsxs("div",{className:"flex items-center shrink-0 h-[28px] border-b border-border bg-bg-secondary",children:[o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(dr,{tabs:t.tabs,activeTabId:t.activeTabId,groupId:t.id,isFocused:p,onTabSelect:h,onTabClose:d})}),y&&o.jsxs("div",{className:"flex items-center gap-[1px] px-1 shrink-0",children:[o.jsx("button",{className:"p-[3px] rounded-[var(--radius-sm)] hover:bg-bg-active text-text-tertiary hover:text-text-secondary transition-colors",onClick:m,title:"Split Right","aria-label":"Split right",children:o.jsx(sr,{size:13})}),o.jsx("button",{className:"p-[3px] rounded-[var(--radius-sm)] hover:bg-bg-active text-text-tertiary hover:text-text-secondary transition-colors",onClick:g,title:"Split Down","aria-label":"Split down",children:o.jsx(nr,{size:13})})]})]}),o.jsx("div",{className:"flex-1 overflow-hidden relative",children:t.tabs.length===0?l&&i?o.jsx("div",{className:"h-full overflow-y-auto",children:i}):o.jsx("div",{className:"flex items-center justify-center h-full text-[12px]",style:{color:"var(--color-text-placeholder)"},children:"Click + to open a new tab"}):t.tabs.map(v=>o.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{display:v.id===t.activeTabId?"flex":"none"},"data-tab-content":v.id,children:o.jsx(wr,{tab:v})},v.id))})]})});function jr(e,t){const r=getComputedStyle(e),n=parseFloat(r.fontSize);return t*n}function kr(e,t){const r=getComputedStyle(e.ownerDocument.body),n=parseFloat(r.fontSize);return t*n}function Cr(e){return e/100*window.innerHeight}function zr(e){return e/100*window.innerWidth}function Tr(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function ce({groupSize:e,panelElement:t,styleProp:r}){let n;const[a,i]=Tr(r);switch(i){case"%":{n=a/100*e;break}case"px":{n=a;break}case"rem":{n=kr(t,a);break}case"em":{n=jr(t,a);break}case"vh":{n=Cr(a);break}case"vw":{n=zr(a);break}}return n}function A(e){return parseFloat(e.toFixed(3))}function oe({group:e}){const{orientation:t,panels:r}=e;return r.reduce((n,a)=>(n+=t==="horizontal"?a.element.offsetWidth:a.element.offsetHeight,n),0)}function Te(e){const{panels:t}=e,r=oe({group:e});return r===0?t.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):t.map(n=>{const{element:a,panelConstraints:i}=n;let p=0;if(i.collapsedSize!==void 0){const c=ce({groupSize:r,panelElement:a,styleProp:i.collapsedSize});p=A(c/r*100)}let l;if(i.defaultSize!==void 0){const c=ce({groupSize:r,panelElement:a,styleProp:i.defaultSize});l=A(c/r*100)}let s=0;if(i.minSize!==void 0){const c=ce({groupSize:r,panelElement:a,styleProp:i.minSize});s=A(c/r*100)}let u=100;if(i.maxSize!==void 0){const c=ce({groupSize:r,panelElement:a,styleProp:i.maxSize});u=A(c/r*100)}return{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:p,collapsible:i.collapsible===!0,defaultSize:l,disabled:i.disabled,minSize:s,maxSize:u,panelId:n.id}})}function N(e,t="Assertion error"){if(!e)throw Error(t)}function Le(e,t){return Array.from(t).sort(e==="horizontal"?Lr:Er)}function Lr(e,t){const r=e.element.offsetLeft-t.element.offsetLeft;return r!==0?r:e.element.offsetWidth-t.element.offsetWidth}function Er(e,t){const r=e.element.offsetTop-t.element.offsetTop;return r!==0?r:e.element.offsetHeight-t.element.offsetHeight}function Lt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Et(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Nr({orientation:e,rects:t,targetRect:r}){const n={x:r.x+r.width/2,y:r.y+r.height/2};let a,i=Number.MAX_VALUE;for(const p of t){const{x:l,y:s}=Et(n,p),u=e==="horizontal"?l:s;u<i&&(i=u,a=p)}return N(a,"No rect found"),a}let ge;function Ir(){return ge===void 0&&(typeof matchMedia=="function"?ge=!!matchMedia("(pointer:coarse)").matches:ge=!1),ge}function Nt(e){const{element:t,orientation:r,panels:n,separators:a}=e,i=Le(r,Array.from(t.children).filter(Lt).map(g=>({element:g}))).map(({element:g})=>g),p=[];let l=!1,s=!1,u=-1,c=-1,h=0,d,m=[];{let g=-1;for(const x of i)x.hasAttribute("data-panel")&&(g++,x.hasAttribute("data-disabled")||(h++,u===-1&&(u=g),c=g))}if(h>1){let g=-1;for(const x of i)if(x.hasAttribute("data-panel")){g++;const y=n.find(v=>v.element===x);if(y){if(d){const v=d.element.getBoundingClientRect(),b=x.getBoundingClientRect();let w;if(s){const j=r==="horizontal"?new DOMRect(v.right,v.top,0,v.height):new DOMRect(v.left,v.bottom,v.width,0),S=r==="horizontal"?new DOMRect(b.left,b.top,0,b.height):new DOMRect(b.left,b.top,b.width,0);switch(m.length){case 0:{w=[j,S];break}case 1:{const C=m[0],T=Nr({orientation:r,rects:[v,b],targetRect:C.element.getBoundingClientRect()});w=[C,T===v?S:j];break}default:{w=m;break}}}else m.length?w=m:w=[r==="horizontal"?new DOMRect(v.right,b.top,b.left-v.right,b.height):new DOMRect(b.left,v.bottom,b.width,b.top-v.bottom)];for(const j of w){let S="width"in j?j:j.element.getBoundingClientRect();const C=Ir()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(S.width<C){const I=C-S.width;S=new DOMRect(S.x-I/2,S.y,S.width+I,S.height)}if(S.height<C){const I=C-S.height;S=new DOMRect(S.x,S.y-I/2,S.width,S.height+I)}const T=g<=u||g>c;!l&&!T&&p.push({group:e,groupSize:oe({group:e}),panels:[d,y],separator:"width"in j?void 0:j,rect:S}),l=!1}}s=!1,d=y,m=[]}}else if(x.hasAttribute("data-separator")){x.ariaDisabled!==null&&(l=!0);const y=a.find(v=>v.element===x);y?m.push(y):(d=void 0,m=[])}else s=!0}return p}var V;class It{constructor(){Ve(this,V,{})}addListener(t,r){const n=ie(this,V)[t];return n===void 0?ie(this,V)[t]=[r]:n.includes(r)||n.push(r),()=>{this.removeListener(t,r)}}emit(t,r){const n=ie(this,V)[t];if(n!==void 0)if(n.length===1)n[0].call(null,r);else{let a=!1,i=null;const p=Array.from(n);for(let l=0;l<p.length;l++){const s=p[l];try{s.call(null,r)}catch(u){i===null&&(a=!0,i=u)}}if(a)throw i}}removeAllListeners(){Ue(this,V,{})}removeListener(t,r){const n=ie(this,V)[t];if(n!==void 0){const a=n.indexOf(r);a>=0&&n.splice(a,1)}}}V=new WeakMap;let F=new Map;const Mt=new It;function Mr(e){F=new Map(F),F.delete(e)}function ot(e,t){for(const[r]of F)if(r.id===e)return r}function U(e,t){for(const[r,n]of F)if(r.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function q(){return F}function De(e,t){return Mt.addListener("groupChange",r=>{r.group.id===e&&t(r)})}function G(e,t){const r=F.get(e);F=new Map(F),F.set(e,t),Mt.emit("groupChange",{group:e,prev:r,next:t})}function Dr(e,t,r){let n,a={x:1/0,y:1/0};for(const i of t){const p=Et(r,i.rect);switch(e){case"horizontal":{p.x<=a.x&&(n=i,a=p);break}case"vertical":{p.y<=a.y&&(n=i,a=p);break}}}return n?{distance:a,hitRegion:n}:void 0}function Rr(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Pr(e,t){if(e===t)throw new Error("Cannot compare node with itself");const r={a:it(e),b:it(t)};let n;for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();N(n,"Stacking order can only be calculated for elements with a common ancestor");const a={a:at(st(r.a)),b:at(st(r.b))};if(a.a===a.b){const i=n.childNodes,p={a:r.a.at(-1),b:r.b.at(-1)};let l=i.length;for(;l--;){const s=i[l];if(s===p.a)return 1;if(s===p.b)return-1}}return Math.sign(a.a-a.b)}const Ar=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Or(e){const t=getComputedStyle(Dt(e)??e).display;return t==="flex"||t==="inline-flex"}function Br(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Or(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Ar.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function st(e){let t=e.length;for(;t--;){const r=e[t];if(N(r,"Missing node"),Br(r))return r}return null}function at(e){return e&&Number(getComputedStyle(e).zIndex)||0}function it(e){const t=[];for(;e;)t.push(e),e=Dt(e);return t}function Dt(e){const{parentNode:t}=e;return Rr(t)?t.host:t}function $r(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Fr({groupElement:e,hitRegion:t,pointerEventTarget:r}){if(!Lt(r)||r.contains(e)||e.contains(r))return!0;if(Pr(r,e)>0){let n=r;for(;n;){if(n.contains(e))return!0;if($r(n.getBoundingClientRect(),t))return!1;n=n.parentElement}}return!0}function Re(e,t){const r=[];return t.forEach((n,a)=>{if(a.disabled)return;const i=Nt(a),p=Dr(a.orientation,i,{x:e.clientX,y:e.clientY});p&&p.distance.x<=0&&p.distance.y<=0&&Fr({groupElement:a.element,hitRegion:p.hitRegion.rect,pointerEventTarget:e.target})&&r.push(p.hitRegion)}),r}function _r(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function P(e,t,r=0){return Math.abs(A(e)-A(t))<=r}function $(e,t){return P(e,t)?0:e>t?1:-1}function te({overrideDisabledPanels:e,panelConstraints:t,prevSize:r,size:n}){const{collapsedSize:a=0,collapsible:i,disabled:p,maxSize:l=100,minSize:s=0}=t;if(p&&!e)return r;if($(n,s)<0)if(i){const u=(a+s)/2;$(n,u)<0?n=a:n=s}else n=s;return n=Math.min(l,n),n=A(n),n}function fe({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:n,prevLayout:a,trigger:i}){if(P(e,0))return t;const p=i==="imperative-api",l=Object.values(t),s=Object.values(a),u=[...l],[c,h]=n;N(c!=null,"Invalid first pivot index"),N(h!=null,"Invalid second pivot index");let d=0;switch(i){case"keyboard":{{const x=e<0?h:c,y=r[x];N(y,`Panel constraints not found for index ${x}`);const{collapsedSize:v=0,collapsible:b,minSize:w=0}=y;if(b){const j=l[x];if(N(j!=null,`Previous layout not found for panel index ${x}`),P(j,v)){const S=w-j;$(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}{const x=e<0?c:h,y=r[x];N(y,`No panel constraints found for index ${x}`);const{collapsedSize:v=0,collapsible:b,minSize:w=0}=y;if(b){const j=l[x];if(N(j!=null,`Previous layout not found for panel index ${x}`),P(j,w)){const S=j-v;$(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}break}default:{const x=e<0?h:c,y=r[x];N(y,`Panel constraints not found for index ${x}`);const v=l[x],{collapsible:b,collapsedSize:w,minSize:j}=y;if(b&&$(v,j)<0)if(e>0){const S=j-w,C=S/2,T=v+e;$(T,j)<0&&(e=$(e,C)<=0?0:S)}else{const S=j-w,C=100-S/2,T=v-e;$(T,j)<0&&(e=$(100+e,C)>0?0:-S)}break}}{const x=e<0?1:-1;let y=e<0?h:c,v=0;for(;;){const w=l[y];N(w!=null,`Previous layout not found for panel index ${y}`);const j=te({overrideDisabledPanels:p,panelConstraints:r[y],prevSize:w,size:100})-w;if(v+=j,y+=x,y<0||y>=r.length)break}const b=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-b:b}{let x=e<0?c:h;for(;x>=0&&x<r.length;){const y=Math.abs(e)-Math.abs(d),v=l[x];N(v!=null,`Previous layout not found for panel index ${x}`);const b=v-y,w=te({overrideDisabledPanels:p,panelConstraints:r[x],prevSize:v,size:b});if(!P(v,w)&&(d+=v-w,u[x]=w,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?x--:x++}}if(_r(s,u))return a;{const x=e<0?h:c,y=l[x];N(y!=null,`Previous layout not found for panel index ${x}`);const v=y+d,b=te({overrideDisabledPanels:p,panelConstraints:r[x],prevSize:y,size:v});if(u[x]=b,!P(b,v)){let w=v-b,j=e<0?h:c;for(;j>=0&&j<r.length;){const S=u[j];N(S!=null,`Previous layout not found for panel index ${j}`);const C=S+w,T=te({overrideDisabledPanels:p,panelConstraints:r[j],prevSize:S,size:C});if(P(S,T)||(w-=T-S,u[j]=T),P(w,0))break;e>0?j--:j++}}}const m=Object.values(u).reduce((x,y)=>y+x,0);if(!P(m,100,.1))return a;const g=Object.keys(a);return u.reduce((x,y,v)=>(x[g[v]]=y,x),{})}function Y(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(t[r]===void 0||$(e[r],t[r])!==0)return!1;return!0}function Z({layout:e,panelConstraints:t}){const r=Object.values(e),n=[...r],a=n.reduce((l,s)=>l+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(l=>`${l}%`).join(", ")}`);if(!P(a,100)&&n.length>0)for(let l=0;l<t.length;l++){const s=n[l];N(s!=null,`No layout data found for index ${l}`);const u=100/a*s;n[l]=u}let i=0;for(let l=0;l<t.length;l++){const s=r[l];N(s!=null,`No layout data found for index ${l}`);const u=n[l];N(u!=null,`No layout data found for index ${l}`);const c=te({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:s,size:u});u!=c&&(i+=u-c,n[l]=c)}if(!P(i,0))for(let l=0;l<t.length;l++){const s=n[l];N(s!=null,`No layout data found for index ${l}`);const u=s+i,c=te({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:s,size:u});if(s!==c&&(i-=c-s,n[l]=c,P(i,0)))break}const p=Object.keys(e);return n.reduce((l,s,u)=>(l[p[u]]=s,l),{})}function Rt({groupId:e,panelId:t}){const r=()=>{const l=q();for(const[s,{defaultLayoutDeferred:u,derivedPanelConstraints:c,layout:h,groupSize:d,separatorToPanels:m}]of l)if(s.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:c,group:s,groupSize:d,layout:h,separatorToPanels:m};throw Error(`Group ${e} not found`)},n=()=>{const l=r().derivedPanelConstraints.find(s=>s.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},a=()=>{const l=r().group.panels.find(s=>s.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},i=()=>{const l=r().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},p=l=>{const s=i();if(l===s)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:c,group:h,groupSize:d,layout:m,separatorToPanels:g}=r(),x=h.panels.findIndex(w=>w.id===t),y=x===h.panels.length-1,v=fe({delta:y?s-l:l-s,initialLayout:m,panelConstraints:c,pivotIndices:y?[x-1,x]:[x,x+1],prevLayout:m,trigger:"imperative-api"}),b=Z({layout:v,panelConstraints:c});Y(m,b)||G(h,{defaultLayoutDeferred:u,derivedPanelConstraints:c,groupSize:d,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:l,collapsedSize:s}=n(),{mutableValues:u}=a(),c=i();l&&c!==s&&(u.expandToSize=c,p(s))},expand:()=>{const{collapsible:l,collapsedSize:s,minSize:u}=n(),{mutableValues:c}=a(),h=i();if(l&&h===s){let d=c.expandToSize??u;d===0&&(d=1),p(d)}},getSize:()=>{const{group:l}=r(),s=i(),{element:u}=a(),c=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:s,inPixels:c}},isCollapsed:()=>{const{collapsible:l,collapsedSize:s}=n(),u=i();return l&&P(s,u)},resize:l=>{const{group:s}=r(),{element:u}=a(),c=oe({group:s}),h=ce({groupSize:c,panelElement:u,styleProp:l}),d=A(h/c*100);p(d)}}}function lt(e){if(e.defaultPrevented)return;const t=q();Re(e,t).forEach(r=>{if(r.separator&&!r.separator.disableDoubleClick){const n=r.panels.find(a=>a.panelConstraints.defaultSize!==void 0);if(n){const a=n.panelConstraints.defaultSize,i=Rt({groupId:r.group.id,panelId:n.id});i&&a!==void 0&&(i.resize(a),e.preventDefault())}}})}function ye(e){const t=q();for(const[r]of t)if(r.separators.some(n=>n.element===e))return r;throw Error("Could not find parent Group for separator element")}function Pt({groupId:e}){const t=()=>{const r=q();for(const[n,a]of r)if(n.id===e)return{group:n,...a};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:r,layout:n}=t();return r?{}:n},setLayout(r){const{defaultLayoutDeferred:n,derivedPanelConstraints:a,group:i,groupSize:p,layout:l,separatorToPanels:s}=t(),u=Z({layout:r,panelConstraints:a});return n?l:(Y(l,u)||G(i,{defaultLayoutDeferred:n,derivedPanelConstraints:a,groupSize:p,layout:u,separatorToPanels:s}),u)}}}function K(e,t){const r=ye(e),n=U(r.id,!0),a=r.separators.find(c=>c.element===e);N(a,"Matching separator not found");const i=n.separatorToPanels.get(a);N(i,"Matching panels not found");const p=i.map(c=>r.panels.indexOf(c)),l=Pt({groupId:r.id}).getLayout(),s=fe({delta:t,initialLayout:l,panelConstraints:n.derivedPanelConstraints,pivotIndices:p,prevLayout:l,trigger:"keyboard"}),u=Z({layout:s,panelConstraints:n.derivedPanelConstraints});Y(l,u)||G(r,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:u,separatorToPanels:n.separatorToPanels})}function ct(e){if(e.defaultPrevented)return;const t=e.currentTarget,r=ye(t);if(!r.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),r.orientation==="vertical"&&K(t,5);break}case"ArrowLeft":{e.preventDefault(),r.orientation==="horizontal"&&K(t,-5);break}case"ArrowRight":{e.preventDefault(),r.orientation==="horizontal"&&K(t,5);break}case"ArrowUp":{e.preventDefault(),r.orientation==="vertical"&&K(t,-5);break}case"End":{e.preventDefault(),K(t,100);break}case"Enter":{e.preventDefault();const n=ye(t),a=U(n.id,!0),{derivedPanelConstraints:i,layout:p,separatorToPanels:l}=a,s=n.separators.find(d=>d.element===t);N(s,"Matching separator not found");const u=l.get(s);N(u,"Matching panels not found");const c=u[0],h=i.find(d=>d.panelId===c.id);if(N(h,"Panel metadata not found"),h.collapsible){const d=p[c.id],m=h.collapsedSize===d?n.mutableState.expandedPanelSizes[c.id]??h.minSize:h.collapsedSize;K(t,m-d)}break}case"F6":{e.preventDefault();const n=ye(t).separators.map(p=>p.element),a=Array.from(n).findIndex(p=>p===e.currentTarget);N(a!==null,"Index not found");const i=e.shiftKey?a>0?a-1:n.length-1:a+1<n.length?a+1:0;n[i].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),K(t,-100);break}}}let re={cursorFlags:0,state:"inactive"};const Pe=new It;function X(){return re}function Gr(e){return Pe.addListener("change",e)}function Wr(e){const t=re,r={...re};r.cursorFlags=e,re=r,Pe.emit("change",{prev:t,next:r})}function ne(e){const t=re;re=e,Pe.emit("change",{prev:t,next:e})}function ut(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=q(),r=Re(e,t),n=new Map;let a=!1;r.forEach(i=>{i.separator&&(a||(a=!0,i.separator.element.focus({preventScroll:!0})));const p=t.get(i.group);p&&n.set(i.group,p.layout)}),ne({cursorFlags:0,hitRegions:r,initialLayoutMap:n,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),r.length&&e.preventDefault()}const Hr=e=>e,Se=()=>{},At=1,Ot=2,Bt=4,$t=8,dt=3,pt=12;let ve;function ft(){return ve===void 0&&(ve=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ve=!0)),ve}function Vr({cursorFlags:e,groups:t,state:r}){let n=0,a=0;switch(r){case"active":case"hover":t.forEach(i=>{if(!i.mutableState.disableCursor)switch(i.orientation){case"horizontal":{n++;break}case"vertical":{a++;break}}})}if(!(n===0&&a===0)){switch(r){case"active":{if(e&&ft()){const i=(e&At)!==0,p=(e&Ot)!==0,l=(e&Bt)!==0,s=(e&$t)!==0;if(i)return l?"se-resize":s?"ne-resize":"e-resize";if(p)return l?"sw-resize":s?"nw-resize":"w-resize";if(l)return"s-resize";if(s)return"n-resize"}break}}return ft()?n>0&&a>0?"move":n>0?"ew-resize":"ns-resize":n>0&&a>0?"grab":n>0?"col-resize":"row-resize"}}const ht=new WeakMap;function Ae(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:r}=ht.get(e)??{};r===void 0&&(r=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(r));const n=X();switch(n.state){case"active":case"hover":{const a=Vr({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(p=>p.group),state:n.state}),i=`*, *:hover {cursor: ${a} !important; }`;if(t===i)return;t=i,a?r.cssRules.length===0?r.insertRule(i):r.replaceSync(i):r.cssRules.length===1&&r.deleteRule(0);break}case"inactive":{t=void 0,r.cssRules.length===1&&r.deleteRule(0);break}}ht.set(e,{prevStyle:t,styleSheet:r})}function Ft({document:e,event:t,hitRegions:r,initialLayoutMap:n,mountedGroups:a,pointerDownAtPoint:i,prevCursorFlags:p}){let l=0;r.forEach(u=>{const{group:c,groupSize:h}=u,{orientation:d,panels:m}=c,{disableCursor:g}=c.mutableState;let x=0;i?d==="horizontal"?x=(t.clientX-i.x)/h*100:x=(t.clientY-i.y)/h*100:d==="horizontal"?x=t.clientX<0?-100:100:x=t.clientY<0?-100:100;const y=n.get(c),v=a.get(c);if(!y||!v)return;const{defaultLayoutDeferred:b,derivedPanelConstraints:w,groupSize:j,layout:S,separatorToPanels:C}=v;if(w&&S&&C){const T=fe({delta:x,initialLayout:y,panelConstraints:w,pivotIndices:u.panels.map(I=>m.indexOf(I)),prevLayout:S,trigger:"mouse-or-touch"});if(Y(T,S)){if(x!==0&&!g)switch(d){case"horizontal":{l|=x<0?At:Ot;break}case"vertical":{l|=x<0?Bt:$t;break}}}else G(u.group,{defaultLayoutDeferred:b,derivedPanelConstraints:w,groupSize:j,layout:T,separatorToPanels:C})}});let s=0;t.movementX===0?s|=p&dt:s|=l&dt,t.movementY===0?s|=p&pt:s|=l&pt,Wr(s),Ae(e)}function xt(e){const t=q(),r=X();switch(r.state){case"active":Ft({document:e.currentTarget,event:e,hitRegions:r.hitRegions,initialLayoutMap:r.initialLayoutMap,mountedGroups:t,prevCursorFlags:r.cursorFlags})}}function gt(e){var n,a;if(e.defaultPrevented)return;const t=X(),r=q();switch(t.state){case"active":{if(e.buttons===0){ne({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(i=>{const p=U(i.group.id,!0);G(i.group,p)});return}for(const i of t.hitRegions)if(i.separator){const{element:p}=i.separator;(n=p.hasPointerCapture)!=null&&n.call(p,e.pointerId)||((a=p.setPointerCapture)==null||a.call(p,e.pointerId))}Ft({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:r,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const i=Re(e,r);i.length===0?t.state!=="inactive"&&ne({cursorFlags:0,state:"inactive"}):ne({cursorFlags:0,hitRegions:i,state:"hover"}),Ae(e.currentTarget);break}}}function vt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(X().state){case"hover":ne({cursorFlags:0,state:"inactive"})}}function mt(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=X();switch(t.state){case"active":ne({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(Ae(e.currentTarget),t.hitRegions.forEach(r=>{const n=U(r.group.id,!0);G(r.group,n)}),e.preventDefault())}}function yt(e){let t=0,r=0;const n={};for(const i of e)if(i.defaultSize!==void 0){t++;const p=A(i.defaultSize);r+=p,n[i.panelId]=p}else n[i.panelId]=void 0;const a=e.length-t;if(a!==0){const i=A((100-r)/a);for(const p of e)p.defaultSize===void 0&&(n[p.panelId]=i)}return n}function Ur(e,t,r){if(!r[0])return;const n=e.panels.find(s=>s.element===t);if(!n||!n.onResize)return;const a=oe({group:e}),i=e.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,p=n.mutableValues.prevSize,l={asPercentage:A(i/a*100),inPixels:i};n.mutableValues.prevSize=l,n.onResize(l,n.id,p)}function Kr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Yr({group:e,nextGroupSize:t,prevGroupSize:r,prevLayout:n}){if(r<=0||t<=0||r===t)return n;let a=0,i=0,p=!1;const l=new Map,s=[];for(const h of e.panels){const d=n[h.id]??0;switch(h.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{p=!0;const m=d/100*r,g=A(m/t*100);l.set(h.id,g),a+=g;break}case"preserve-relative-size":default:{s.push(h.id),i+=d;break}}}if(!p||s.length===0)return n;const u=100-a,c={...n};if(l.forEach((h,d)=>{c[d]=h}),i>0)for(const h of s){const d=n[h]??0;c[h]=A(d/i*u)}else{const h=A(u/s.length);for(const d of s)c[d]=h}return c}function Zr(e,t){const r=e.map(a=>a.id),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r)if(!n.includes(a))return!1;return!0}const ee=new Map;function Xr(e){let t=!0;N(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const r=e.element.ownerDocument.defaultView.ResizeObserver,n=new Set,a=new Set,i=new r(g=>{for(const x of g){const{borderBoxSize:y,target:v}=x;if(v===e.element){if(t){const b=oe({group:e});if(b===0)return;const w=U(e.id);if(!w)return;const j=Te(e),S=w.defaultLayoutDeferred?yt(j):w.layout,C=Yr({group:e,nextGroupSize:b,prevGroupSize:w.groupSize,prevLayout:S}),T=Z({layout:C,panelConstraints:j});if(!w.defaultLayoutDeferred&&Y(w.layout,T)&&Kr(w.derivedPanelConstraints,j)&&w.groupSize===b)return;G(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:j,groupSize:b,layout:T,separatorToPanels:w.separatorToPanels})}}else Ur(e,v,y)}});i.observe(e.element),e.panels.forEach(g=>{N(!n.has(g.id),`Panel ids must be unique; id "${g.id}" was used more than once`),n.add(g.id),g.onResize&&i.observe(g.element)});const p=oe({group:e}),l=Te(e),s=e.panels.map(({id:g})=>g).join(",");let u=e.mutableState.defaultLayout;u&&(Zr(e.panels,u)||(u=void 0));const c=e.mutableState.layouts[s]??u??yt(l),h=Z({layout:c,panelConstraints:l}),d=e.element.ownerDocument;ee.set(d,(ee.get(d)??0)+1);const m=new Map;return Nt(e).forEach(g=>{g.separator&&m.set(g.separator,g.panels)}),G(e,{defaultLayoutDeferred:p===0,derivedPanelConstraints:l,groupSize:p,layout:h,separatorToPanels:m}),e.separators.forEach(g=>{N(!a.has(g.id),`Separator ids must be unique; id "${g.id}" was used more than once`),a.add(g.id),g.element.addEventListener("keydown",ct)}),ee.get(d)===1&&(d.addEventListener("dblclick",lt,!0),d.addEventListener("pointerdown",ut,!0),d.addEventListener("pointerleave",xt),d.addEventListener("pointermove",gt),d.addEventListener("pointerout",vt),d.addEventListener("pointerup",mt,!0)),function(){t=!1,ee.set(d,Math.max(0,(ee.get(d)??0)-1)),Mr(e),e.separators.forEach(g=>{g.element.removeEventListener("keydown",ct)}),ee.get(d)||(d.removeEventListener("dblclick",lt,!0),d.removeEventListener("pointerdown",ut,!0),d.removeEventListener("pointerleave",xt),d.removeEventListener("pointermove",gt),d.removeEventListener("pointerout",vt),d.removeEventListener("pointerup",mt,!0)),i.disconnect()}}function qr(){const[e,t]=f.useState({}),r=f.useCallback(()=>t({}),[]);return[e,r]}function Oe(e){const t=f.useId();return`${e??t}`}const J=typeof window<"u"?f.useLayoutEffect:f.useEffect;function ue(e){const t=f.useRef(e);return J(()=>{t.current=e},[e]),f.useCallback((...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[t])}function Be(...e){return ue(t=>{e.forEach(r=>{if(r)switch(typeof r){case"function":{r(t);break}case"object":{r.current=t;break}}})})}function $e(e){const t=f.useRef({...e});return J(()=>{for(const r in e)t.current[r]=e[r]},[e]),t.current}const _t=f.createContext(null);function Jr(e,t){const r=f.useRef({getLayout:()=>({}),setLayout:Hr});f.useImperativeHandle(t,()=>r.current,[]),J(()=>{Object.assign(r.current,Pt({groupId:e}))})}function Gt({children:e,className:t,defaultLayout:r,disableCursor:n,disabled:a,elementRef:i,groupRef:p,id:l,onLayoutChange:s,onLayoutChanged:u,orientation:c="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:d,...m}){const g=f.useRef({onLayoutChange:{},onLayoutChanged:{}}),x=ue(k=>{Y(g.current.onLayoutChange,k)||(g.current.onLayoutChange=k,s==null||s(k))}),y=ue(k=>{Y(g.current.onLayoutChanged,k)||(g.current.onLayoutChanged=k,u==null||u(k))}),v=Oe(l),b=f.useRef(null),[w,j]=qr(),S=f.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),C=Be(b,i);Jr(v,p);const T=ue((k,z)=>{const D=X(),E=ot(k),R=U(k);if(R){let B=!1;switch(D.state){case"active":{B=D.hitRegions.some(se=>se.group===E);break}}return{flexGrow:R.layout[z]??1,pointerEvents:B?"none":void 0}}if(r!=null&&r[z])return{flexGrow:r==null?void 0:r[z]}}),I=$e({defaultLayout:r,disableCursor:n}),L=f.useMemo(()=>({get disableCursor(){return!!I.disableCursor},getPanelStyles:T,id:v,orientation:c,registerPanel:k=>{const z=S.current;return z.panels=Le(c,[...z.panels,k]),j(),()=>{z.panels=z.panels.filter(D=>D!==k),j()}},registerSeparator:k=>{const z=S.current;return z.separators=Le(c,[...z.separators,k]),j(),()=>{z.separators=z.separators.filter(D=>D!==k),j()}},updatePanelProps:(k,{disabled:z})=>{const D=S.current.panels.find(B=>B.id===k);D&&(D.panelConstraints.disabled=z);const E=ot(v),R=U(v);E&&R&&G(E,{...R,derivedPanelConstraints:Te(E)})},updateSeparatorProps:(k,{disabled:z,disableDoubleClick:D})=>{const E=S.current.separators.find(R=>R.id===k);E&&(E.disabled=z,E.disableDoubleClick=D)}}),[T,v,j,c,I]),M=f.useRef(null);return J(()=>{const k=b.current;if(k===null)return;const z=S.current;let D;if(I.defaultLayout!==void 0&&Object.keys(I.defaultLayout).length===z.panels.length){D={};for(const H of z.panels){const Q=I.defaultLayout[H.id];Q!==void 0&&(D[H.id]=Q)}}const E={disabled:!!a,element:k,id:v,mutableState:{defaultLayout:D,disableCursor:!!I.disableCursor,expandedPanelSizes:S.current.lastExpandedPanelSizes,layouts:S.current.layouts},orientation:c,panels:z.panels,resizeTargetMinimumSize:z.resizeTargetMinimumSize,separators:z.separators};M.current=E;const R=Xr(E),{defaultLayoutDeferred:B,derivedPanelConstraints:se,layout:he}=U(E.id,!0);!B&&se.length>0&&(x(he),y(he));const ae=De(v,H=>{const{defaultLayoutDeferred:Q,derivedPanelConstraints:Ge,layout:xe}=H.next;if(Q||Ge.length===0)return;const Yt=E.panels.map(({id:_})=>_).join(",");E.mutableState.layouts[Yt]=xe,Ge.forEach(_=>{if(_.collapsible){const{layout:we}=H.prev??{};if(we){const Xt=P(_.collapsedSize,xe[_.panelId]),qt=P(_.collapsedSize,we[_.panelId]);Xt&&!qt&&(E.mutableState.expandedPanelSizes[_.panelId]=we[_.panelId])}}});const Zt=X().state!=="active";x(xe),Zt&&y(xe)});return()=>{M.current=null,R(),ae()}},[a,v,y,x,c,w,I]),f.useEffect(()=>{const k=M.current;k&&(k.mutableState.defaultLayout=r,k.mutableState.disableCursor=!!n)}),o.jsx(_t.Provider,{value:L,children:o.jsx("div",{...m,className:t,"data-group":!0,"data-testid":v,id:v,ref:C,style:{height:"100%",width:"100%",overflow:"hidden",...d,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:e})})}Gt.displayName="Group";function Fe(){const e=f.useContext(_t);return N(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Qr(e,t){const{id:r}=Fe(),n=f.useRef({collapse:Se,expand:Se,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Se});f.useImperativeHandle(t,()=>n.current,[]),J(()=>{Object.assign(n.current,Rt({groupId:r,panelId:e}))})}function Ee({children:e,className:t,collapsedSize:r="0%",collapsible:n=!1,defaultSize:a,disabled:i,elementRef:p,groupResizeBehavior:l="preserve-relative-size",id:s,maxSize:u="100%",minSize:c="0%",onResize:h,panelRef:d,style:m,...g}){const x=!!s,y=Oe(s),v=$e({disabled:i}),b=f.useRef(null),w=Be(b,p),{getPanelStyles:j,id:S,orientation:C,registerPanel:T,updatePanelProps:I}=Fe(),L=h!==null,M=ue((E,R,B)=>{h==null||h(E,s,B)});J(()=>{const E=b.current;if(E!==null){const R={element:E,id:y,idIsStable:x,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:L?M:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:r,collapsible:n,defaultSize:a,disabled:v.disabled,maxSize:u,minSize:c}};return T(R)}},[l,r,n,a,L,y,x,u,c,M,T,v]),f.useEffect(()=>{I(y,{disabled:i})},[i,y,I]),Qr(y,d);const k=()=>{const E=j(S,y);if(E)return JSON.stringify(E)},z=f.useSyncExternalStore(E=>De(S,E),k,k);let D;return z?D=JSON.parse(z):a?D={flexGrow:void 0,flexShrink:void 0,flexBasis:a}:D={flexGrow:1},o.jsx("div",{...g,"data-disabled":i||void 0,"data-panel":!0,"data-testid":y,id:y,ref:w,style:{...en,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...D},children:o.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:C==="horizontal"?"pan-y":"pan-x"},children:e})})}Ee.displayName="Panel";const en={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function tn({layout:e,panelConstraints:t,panelId:r,panelIndex:n}){let a,i;const p=e[r],l=t.find(s=>s.panelId===r);if(l){const s=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,c=[n,n+1];i=Z({layout:fe({delta:u-p,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[r],a=Z({layout:fe({delta:s-p,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[r]}return{valueControls:r,valueMax:a,valueMin:i,valueNow:p}}function Wt({children:e,className:t,disabled:r,disableDoubleClick:n,elementRef:a,id:i,style:p,...l}){const s=Oe(i),u=$e({disabled:r,disableDoubleClick:n}),[c,h]=f.useState({}),[d,m]=f.useState("inactive"),[g,x]=f.useState(!1),y=f.useRef(null),v=Be(y,a),{disableCursor:b,id:w,orientation:j,registerSeparator:S,updateSeparatorProps:C}=Fe(),T=j==="horizontal"?"vertical":"horizontal";J(()=>{const M=y.current;if(M!==null){const k={disabled:u.disabled,disableDoubleClick:u.disableDoubleClick,element:M,id:s},z=S(k),D=Gr(R=>{m(R.next.state!=="inactive"&&R.next.hitRegions.some(B=>B.separator===k)?R.next.state:"inactive")}),E=De(w,R=>{const{derivedPanelConstraints:B,layout:se,separatorToPanels:he}=R.next,ae=he.get(k);if(ae){const H=ae[0],Q=ae.indexOf(H);h(tn({layout:se,panelConstraints:B,panelId:H.id,panelIndex:Q}))}});return()=>{D(),E(),z()}}},[w,s,S,u]),f.useEffect(()=>{C(s,{disabled:r,disableDoubleClick:n})},[r,n,s,C]);let I;r&&!b&&(I="not-allowed");let L;if(r)L="disabled";else switch(d){case"active":{L="active";break}default:g?L="focus":L=d}return o.jsx("div",{...l,"aria-controls":c.valueControls,"aria-disabled":r||void 0,"aria-orientation":T,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":L,"data-testid":s,id:s,onBlur:()=>x(!1),onFocus:()=>x(!0),ref:v,role:"separator",style:{flexBasis:"auto",cursor:I,...p,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:r?void 0:0})}Wt.displayName="Separator";const bt=15,rn=f.memo(function({node:t}){const{dispatch:r}=W(),n=Math.round(t.ratio*100),a=100-n,i=f.useCallback(p=>{const l=`${t.id}-first`,s=p[l];if(typeof s=="number"){const u=s/100;Math.abs(u-t.ratio)>.005&&r({type:"RESIZE_GROUP",branchId:t.id,ratio:u})}},[r,t.id,t.ratio]);return o.jsxs(Gt,{orientation:t.direction,id:t.id,className:"h-full",onLayoutChanged:i,children:[o.jsx(Ee,{id:`${t.id}-first`,defaultSize:`${n}%`,minSize:`${bt}%`,className:"overflow-hidden",style:{minWidth:"var(--size-editor-min-width)",minHeight:"var(--size-editor-min-height)"},children:o.jsx(Ne,{node:t.first})}),o.jsx(Wt,{id:`${t.id}-sep`,className:"group relative flex-shrink-0",style:{width:t.direction==="horizontal"?"1px":void 0,height:t.direction==="vertical"?"1px":void 0,backgroundColor:"var(--color-border)",transition:"background-color 150ms ease"},children:o.jsx("div",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:"var(--color-border-focused)",width:t.direction==="horizontal"?"3px":"100%",height:t.direction==="vertical"?"3px":"100%",left:t.direction==="horizontal"?"-1px":"0",top:t.direction==="vertical"?"-1px":"0"}})}),o.jsx(Ee,{id:`${t.id}-second`,defaultSize:`${a}%`,minSize:`${bt}%`,className:"overflow-hidden",style:{minWidth:"var(--size-editor-min-width)",minHeight:"var(--size-editor-min-height)"},children:o.jsx(Ne,{node:t.second})})]})}),Ne=f.memo(function({node:t}){return t.type==="branch"?o.jsx(rn,{node:t}):o.jsx(Sr,{node:t})}),nn={center:"bg-accent-blue/10 border-accent-blue/30",left:"bg-accent-blue/15 border-l-2 border-accent-blue/50",right:"bg-accent-blue/15 border-r-2 border-accent-blue/50",top:"bg-accent-blue/15 border-t-2 border-accent-blue/50",bottom:"bg-accent-blue/15 border-b-2 border-accent-blue/50"},wt={center:"Move to group",left:"Split left",right:"Split right",top:"Split up",bottom:"Split down"},on=f.memo(function({onDrop:t,visible:r}){const[n,a]=f.useState(null),i=f.useRef(null),p=f.useCallback((c,h)=>{var y;const d=(y=i.current)==null?void 0:y.getBoundingClientRect();if(!d)return"center";const m=(c-d.left)/d.width,g=(h-d.top)/d.height,x=.25;return m<x?"left":m>1-x?"right":g<x?"top":g>1-x?"bottom":"center"},[]),l=f.useCallback(c=>{c.preventDefault(),c.dataTransfer.dropEffect="move",a(p(c.clientX,c.clientY))},[p]),s=f.useCallback(()=>{a(null)},[]),u=f.useCallback(c=>{c.preventDefault();const h=p(c.clientX,c.clientY);a(null),t(h)},[p,t]);return r?o.jsx("div",{ref:i,className:"absolute inset-0 z-50",onDragOver:l,onDragLeave:s,onDrop:u,children:o.jsxs("div",{className:"relative w-full h-full",children:[o.jsx(le,{zone:"left",activeZone:n,className:"absolute left-0 top-0 bottom-0 w-[25%]"}),o.jsx(le,{zone:"right",activeZone:n,className:"absolute right-0 top-0 bottom-0 w-[25%]"}),o.jsx(le,{zone:"top",activeZone:n,className:"absolute left-[25%] right-[25%] top-0 h-[25%]"}),o.jsx(le,{zone:"bottom",activeZone:n,className:"absolute left-[25%] right-[25%] bottom-0 h-[25%]"}),o.jsx(le,{zone:"center",activeZone:n,className:"absolute left-[25%] right-[25%] top-[25%] bottom-[25%]"})]})}):null});function le({zone:e,activeZone:t,className:r}){const n=t===e;return o.jsx("div",{className:`${r} transition-all duration-150 ${n?nn[e]:"border border-transparent"}`,"aria-label":wt[e],children:n&&o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx("span",{className:"text-[length:var(--font-size-xs)] text-accent-blue font-[var(--font-weight-medium)] bg-bg-primary/80 px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)]",children:wt[e]})})})}const je=2;function de(e,t){if(e.type==="leaf")return e.id===t?0:-1;const r=de(e.first,t);if(r>=0)return r+1;const n=de(e.second,t);return n>=0?n+1:-1}function Ie(e){return e.type==="leaf"?[e.id]:[...Ie(e.first),...Ie(e.second)]}function sn({children:e}){const{dispatch:t}=W(),r=pe(h=>h.editorArea),n=pe(h=>h.focusedGroupId),a=f.useRef(!1),i=f.useRef(null),[p,l]=f.useState(!1),s=f.useRef(r);s.current=r;const u=f.useRef(n);u.current=n,f.useEffect(()=>{function h(d){const m=s.current,g=u.current;if(d.ctrlKey&&d.key==="\\"&&!d.shiftKey&&!d.altKey){d.preventDefault(),de(m,g)<je&&t({type:"SPLIT_GROUP",groupId:g,direction:"horizontal"});return}if(d.ctrlKey&&d.key==="k"&&!d.shiftKey&&!d.altKey){d.preventDefault(),a.current=!0,i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{a.current=!1},1e3);return}if(a.current&&d.ctrlKey&&d.key==="\\"){d.preventDefault(),a.current=!1,i.current&&(clearTimeout(i.current),i.current=null),de(m,g)<je&&t({type:"SPLIT_GROUP",groupId:g,direction:"vertical"});return}if(a.current&&(d.key==="ArrowRight"||d.key==="ArrowLeft")){d.preventDefault(),a.current=!1,i.current&&(clearTimeout(i.current),i.current=null);const x=Ie(m),y=x.indexOf(g);if(y>=0){const v=d.key==="ArrowRight"?(y+1)%x.length:(y-1+x.length)%x.length;t({type:"SET_FOCUSED_GROUP",groupId:x[v]})}return}}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t]);const c=f.useCallback(h=>{if(l(!1),!h||h==="center")return;const d=h==="left"||h==="right"?"horizontal":"vertical";de(r,n)>=je||t({type:"SPLIT_GROUP",groupId:n,direction:d})},[t,r,n]);return o.jsx(ir,{content:e??null,children:o.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden relative bg-bg-primary",children:[o.jsx(Ne,{node:r}),o.jsx(on,{visible:p,onDrop:c})]})})}function Ht(e){return e.type==="leaf"?e:Ht(e.first)}function be(e){return e.type==="leaf"?[e]:[...be(e.first),...be(e.second)]}function an(){const{dispatch:e}=W(),t=pe(s=>s.editorArea),r=pe(s=>s.focusedGroupId),n=O(s=>s.processes),a=O(s=>s.activeProcessId),i=f.useMemo(()=>{const u=Date.now();return Object.entries(n).filter(([c,h])=>h.status==="running"||h.status==="spawning"||h.status==="paused"||c===a?!0:h.status==="stopped"||h.status==="error"?u-new Date(h.startedAt).getTime()<12e4:!1)},[n,a]),p=f.useRef(new Set);f.useEffect(()=>{const s=be(t),u=new Set(i.map(([d])=>d)),c=new Set;for(const d of s)for(const m of d.tabs)m.ref&&c.add(m.ref);const h=r||Ht(t).id;for(const[d,m]of i){if(!c.has(d)){if(p.current.has(d))continue;const g=zt[m.type]??m.type,x=s.find(y=>y.id===h);if(x){const y=x.tabs.find(v=>v.type==="chat"&&!v.ref);y&&e({type:"CLOSE_TAB",groupId:h,tabId:y.id})}e({type:"OPEN_TAB",groupId:h,tab:{id:`chat-${d}`,type:"chat",title:g,ref:d,icon:Qt}})}p.current.add(d)}for(const d of s)for(const m of d.tabs)m.type==="chat"&&m.ref&&!u.has(m.ref)&&(e({type:"CLOSE_TAB",groupId:d.id,tabId:m.id}),p.current.delete(m.ref))},[i,r,e,t]);const l=f.useRef(a);return f.useEffect(()=>{if(!a||a===l.current){l.current=a;return}l.current=a;const s=`chat-${a}`,u=be(t);for(const c of u)if(c.tabs.some(h=>h.id===s)){c.activeTabId!==s&&e({type:"SET_ACTIVE_TAB",groupId:c.id,tabId:s});break}},[a,t,e]),o.jsx(sn,{})}const Vt=f.createContext({sidebarOpen:!0,setSidebarOpen:()=>{},activeTab:"chat",setActiveTab:()=>{},fileTreeOpen:!1,setFileTreeOpen:()=>{},historyOpen:!1,setHistoryOpen:()=>{}});function ln(){return f.useContext(Vt)}function cn(){const[e,t]=f.useState([]),[r,n]=f.useState(!0),a=f.useCallback(async()=>{n(!0);try{const i=await fetch("/api/workspace?tree=true");i.ok&&t(await i.json())}catch{}finally{n(!1)}},[]);return f.useEffect(()=>{a()},[a]),{tree:e,loading:r,refreshTree:a}}function un(e=15e3){const[t,r]=f.useState(""),[n,a]=f.useState([]),[i,p]=f.useState([]),[l,s]=f.useState([]),[u,c]=f.useState([]),[h,d]=f.useState(!0),[m,g]=f.useState(null),x=f.useRef(!0),y=f.useCallback(async()=>{d(!0),g(null);try{const[v,b]=await Promise.all([fetch("/api/git/status"),fetch("/api/git/log?limit=8")]);if(!x.current)return;if(v.ok){const w=await v.json();w.error?g(w.error):(r(w.branch??""),a(w.staged??[]),p(w.unstaged??[]),s(w.untracked??[]))}else g(`Status fetch failed (${v.status})`);if(b.ok){const w=await b.json();w.error||c(w.commits??[])}}catch(v){x.current&&g(v.message)}finally{x.current&&d(!1)}},[]);return f.useEffect(()=>{x.current=!0,y();const v=setInterval(y,e);return()=>{x.current=!1,clearInterval(v)}},[y,e]),{branch:t,staged:n,unstaged:i,untracked:l,commits:u,loading:h,error:m,refresh:y}}function dn(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/6e4);if(r<1)return"now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}const Ut={chat:{title:"Conversations",path:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},files:{title:"Explorer",path:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"},git:{title:"Source Control",path:""},search:{title:"Search",path:""}};function pn({tab:e}){return e==="git"?o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"18",cy:"18",r:"3"}),o.jsx("circle",{cx:"6",cy:"6",r:"3"}),o.jsx("path",{d:"M13 6h3a2 2 0 0 1 2 2v7"}),o.jsx("line",{x1:"6",y1:"9",x2:"6",y2:"21"})]}):e==="search"?o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"11",cy:"11",r:"8"}),o.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}):o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:Ut[e].path})})}function Me(e){return e.type==="leaf"?[e]:[...Me(e.first),...Me(e.second)]}function fn(){const e=O(c=>c.processes),t=O(c=>c.setActiveProcessId),r=O(c=>c.activeProcessId),[n,a]=f.useState(null),{state:i,dispatch:p}=W(),l=f.useCallback(async c=>{var y;t(c);const h=`chat-${c}`,d=Me(i.editorArea);for(const v of d)if(v.tabs.some(b=>b.id===h)){v.activeTabId!==h&&p({type:"SET_ACTIVE_TAB",groupId:v.id,tabId:h});break}const{entries:m,addEntry:g}=O.getState(),x=m[c];if(!(x&&x.some(v=>v.type==="user_message"||v.type==="assistant_message"))){a(c);try{const v=c.startsWith("cli-history-"),b=v?c.replace("cli-history-",""):c,w=v?`/api/cli-history/${encodeURIComponent(b)}/entries`:`/api/agents/${encodeURIComponent(c)}/entries`,j=await fetch(w);if(j.ok){const S=await j.json(),C=[];for(const L of S){const M={...L,processId:c};if(M.type==="assistant_message"){M.partial=!1;const k=C[C.length-1];if(k&&k.type==="assistant_message"){k.content+=M.content;continue}}if(M.type==="tool_use"&&(M.status==="completed"||M.status==="failed")){const k=C.findLastIndex(z=>z.type==="tool_use"&&z.status==="running");if(k!==-1){const z=C[k];C[k]={...z,status:M.status,result:M.result??z.result,input:z.input&&Object.keys(z.input).length>0?z.input:M.input};continue}}C.push(M)}const T=[];for(let L=0;L<C.length;L++)C[L].type==="token_usage"&&T.push(L);if(T.length>1)for(let L=T.length-2;L>=0;L--)C.splice(T[L],1);if(!C.some(L=>L.type==="user_message")){const L=O.getState().processes[c],M=(y=L==null?void 0:L.config)==null?void 0:y.prompt;if(M){const k={id:`synth-user-${c}`,processId:c,timestamp:L.startedAt,type:"user_message",content:M};C.unshift(k)}}for(const L of C)g(c,L)}}catch{}a(null)}},[t,i.editorArea,p]),{active:s,completed:u}=f.useMemo(()=>{const c=Object.values(e),h=[],d=[];for(const m of c)m.status==="running"||m.status==="spawning"?h.push(m):d.push(m);return h.sort((m,g)=>new Date(g.startedAt).getTime()-new Date(m.startedAt).getTime()),d.sort((m,g)=>new Date(g.startedAt).getTime()-new Date(m.startedAt).getTime()),{active:h,completed:d}},[e]);return s.length===0&&u.length===0?o.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"No conversations yet"}):o.jsxs(o.Fragment,{children:[s.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] px-[6px] pt-[6px] pb-[2px]",style:{color:"var(--color-text-tertiary)"},children:["Active (",s.length,")"]}),s.map(c=>o.jsx(St,{process:c,isActive:c.id===r,loading:n===c.id,onSelect:l},c.id))]}),u.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] px-[6px] pt-[8px] pb-[2px]",style:{color:"var(--color-text-tertiary)"},children:["Completed (",u.length,")"]}),u.map(c=>o.jsx(St,{process:c,isActive:c.id===r,loading:n===c.id,onSelect:l},c.id))]})]})}function St({process:e,isActive:t,loading:r,onSelect:n}){var s,u;const i=e.status==="running"||e.status==="spawning"?"var(--color-accent-green)":e.status==="error"?"var(--color-accent-red, #D05454)":"var(--color-text-placeholder)",p=zt[e.type]??e.type,l=((u=(s=e.config)==null?void 0:s.prompt)==null?void 0:u.slice(0,40))||p;return o.jsxs("button",{type:"button",onClick:()=>n(e.id),className:"flex items-center gap-[7px] w-full rounded-[5px] border-none cursor-pointer transition-all duration-100 text-left",style:{padding:"5px 7px",backgroundColor:t?"var(--color-bg-active)":"transparent",fontFamily:"inherit"},onMouseEnter:c=>{t||(c.currentTarget.style.backgroundColor="var(--color-bg-hover)")},onMouseLeave:c=>{t||(c.currentTarget.style.backgroundColor="transparent")},children:[o.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:i}}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:"var(--color-text-primary)"},children:l}),o.jsxs("div",{className:"text-[9px]",style:{color:"var(--color-text-tertiary)"},children:[dn(e.startedAt)," · ",p.toLowerCase()]})]})]})}function _e(e){return e.type==="leaf"?e:_e(e.first)}function hn(){const{sidebarOpen:e,activeTab:t,setActiveTab:r}=ln(),[n,a]=f.useState(""),i=cn(),{state:p,dispatch:l}=W(),s=f.useCallback(u=>{const c=_e(p.editorArea),h=u.split(/[\\/]/).pop()??u;l({type:"OPEN_TAB",groupId:c.id,tab:{id:`file-${u}`,type:"file",title:h,ref:u}})},[p.editorArea,l]);return o.jsxs("div",{className:"shrink-0 flex flex-col overflow-hidden transition-[width] duration-200",style:{width:e?230:0,backgroundColor:"var(--color-bg-secondary)",borderRight:e?"1px solid var(--color-border)":"none"},children:[o.jsx("div",{className:"flex items-center shrink-0",style:{height:32,padding:"0 4px",borderBottom:"1px solid var(--color-border-divider)"},children:["chat","files","git","search"].map(u=>o.jsx("button",{type:"button",onClick:()=>r(u),title:Ut[u].title,className:"flex items-center justify-center border-none bg-transparent cursor-pointer transition-all duration-100",style:{width:30,height:32,color:t===u?"var(--color-text-primary)":"var(--color-text-tertiary)",borderBottom:t===u?"2px solid var(--color-text-primary)":"2px solid transparent"},onMouseEnter:c=>{t!==u&&(c.currentTarget.style.color="var(--color-text-primary)")},onMouseLeave:c=>{t!==u&&(c.currentTarget.style.color="var(--color-text-tertiary)")},children:o.jsx(pn,{tab:u})},u))}),o.jsx("div",{className:"px-[8px] py-[4px]",children:o.jsxs("div",{className:"relative",children:[o.jsxs("svg",{className:"absolute left-[7px] top-1/2 -translate-y-1/2 pointer-events-none",width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-text-placeholder)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"11",cy:"11",r:"8"}),o.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),o.jsx("input",{type:"text",value:n,onChange:u=>a(u.target.value),placeholder:"Search...",className:"w-full py-[4px] pl-[26px] pr-[7px] text-[11px] rounded-[5px] border outline-none transition-[border-color] duration-100",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-card)",color:"var(--color-text-primary)",fontFamily:"inherit"},onFocus:u=>{u.currentTarget.style.borderColor="var(--color-accent-blue)"},onBlur:u=>{u.currentTarget.style.borderColor="var(--color-border)"}})]})}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-[6px] pb-[8px]",children:[t==="chat"&&o.jsx(fn,{}),t==="files"&&o.jsx(tr,{tree:i.tree,selectedPath:null,onSelectFile:s,loading:i.loading}),t==="git"&&o.jsx(vn,{}),t==="search"&&o.jsx(xn,{searchQuery:n,onSelectFile:s})]})]})}function xn({searchQuery:e,onSelectFile:t}){const[r,n]=f.useState([]),[a,i]=f.useState(0),[p,l]=f.useState(!1),[s,u]=f.useState(new Set),c=f.useRef(null);f.useEffect(()=>{if(c.current&&clearTimeout(c.current),e.length<2){n([]),i(0);return}return l(!0),c.current=setTimeout(async()=>{try{const m=await fetch(`/api/workspace/search?q=${encodeURIComponent(e)}&limit=30`);if(m.ok){const g=await m.json();n(g.results),i(g.total),u(new Set)}}catch{}l(!1)},300),()=>{c.current&&clearTimeout(c.current)}},[e]);const h=f.useMemo(()=>{const m=new Map;for(const g of r){const x=m.get(g.file);x?x.push(g):m.set(g.file,[g])}return m},[r]),d=f.useCallback(m=>{u(g=>{const x=new Set(g);return x.has(m)?x.delete(m):x.add(m),x})},[]);return e.length<2?o.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"Type to search across files"}):p?o.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"Searching..."}):r.length===0?o.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"No results"}):o.jsxs("div",{children:[o.jsxs("div",{className:"text-[9px] px-[6px] py-[2px]",style:{color:"var(--color-text-tertiary)"},children:[a," result",a!==1?"s":""," in ",h.size," file",h.size!==1?"s":""]}),[...h.entries()].map(([m,g])=>o.jsxs("div",{children:[o.jsxs("button",{type:"button",onClick:()=>d(m),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",fontFamily:"inherit"},children:[o.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:s.has(m)?"rotate(0deg)":"rotate(90deg)",transition:"transform 100ms"},children:o.jsx("path",{d:"M2 1l4 3-4 3z"})}),o.jsx(Kt,{}),o.jsx("span",{className:"flex-1 min-w-0 text-[11px] font-medium truncate",style:{color:"var(--color-text-primary)"},children:m}),o.jsx("span",{className:"text-[9px] shrink-0",style:{color:"var(--color-text-tertiary)"},children:g.length})]}),!s.has(m)&&g.map(x=>o.jsxs("button",{type:"button",onClick:()=>t(m),className:"flex items-center gap-[6px] w-full border-none bg-transparent cursor-pointer text-left transition-colors duration-75",style:{padding:"3px 7px 3px 22px",color:"var(--color-text-primary)",fontFamily:"inherit"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent"},children:[o.jsx("span",{className:"text-[10px] shrink-0 font-mono",style:{color:"var(--color-text-tertiary)",minWidth:28,textAlign:"right"},children:x.line}),o.jsx("span",{className:"text-[11px] truncate min-w-0",children:x.text.trim()})]},`${m}:${x.line}`))]},m))]})}const jt={M:{bg:"rgba(201,155,45,0.15)",color:"var(--color-accent-yellow)"},A:{bg:"rgba(61,155,111,0.15)",color:"var(--color-accent-green)"},D:{bg:"rgba(208,84,84,0.15)",color:"var(--color-accent-red)"},R:{bg:"rgba(130,130,200,0.15)",color:"var(--color-accent-blue)"}};function gn({status:e}){const t=jt[e]??jt.M;return o.jsx("span",{className:"text-[9px] font-semibold px-[5px] rounded-[3px] shrink-0",style:{backgroundColor:t.bg,color:t.color},children:e})}function Kt(){return o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",style:{opacity:.6},children:[o.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),o.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function ke({path:e,status:t,onClick:r}){return o.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-[6px] px-[7px] py-[3px] rounded-[4px] cursor-pointer w-full border-none bg-transparent text-left transition-colors duration-75",style:{color:"var(--color-text-primary)",fontFamily:"inherit"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent"},children:[o.jsx(Kt,{}),o.jsx("span",{className:"flex-1 min-w-0 text-[11px] truncate",children:e}),o.jsx(gn,{status:t})]})}function vn(){const e=un(),{state:t,dispatch:r}=W(),[n,a]=f.useState(!0),[i,p]=f.useState(!0),[l,s]=f.useState(!0),u=f.useCallback(d=>{const m=_e(t.editorArea),g=d.split(/[\\/]/).pop()??d;r({type:"OPEN_TAB",groupId:m.id,tab:{id:`file-${d}`,type:"file",title:g,ref:d}})},[t.editorArea,r]);if(e.loading&&!e.branch)return o.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"Loading git status..."});if(e.error&&!e.branch)return o.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-accent-red)"},children:e.error});const c=e.staged.length,h=e.unstaged.length+e.untracked.length;return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-[5px] px-[7px] py-[4px] text-[11px] font-medium",style:{color:"var(--color-text-primary)"},children:[o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-green)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:[o.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),o.jsx("circle",{cx:"18",cy:"6",r:"3"}),o.jsx("circle",{cx:"6",cy:"18",r:"3"}),o.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),o.jsx("span",{className:"flex-1 min-w-0 truncate",children:e.branch||"unknown"}),o.jsx("button",{type:"button",onClick:e.refresh,title:"Refresh",className:"flex items-center justify-center border-none bg-transparent cursor-pointer rounded-[3px] transition-colors duration-75",style:{width:18,height:18,color:"var(--color-text-tertiary)"},onMouseEnter:d=>{d.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:d=>{d.currentTarget.style.color="var(--color-text-tertiary)"},children:o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"23 4 23 10 17 10"}),o.jsx("polyline",{points:"1 20 1 14 7 14"}),o.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})})]}),c>0&&o.jsxs("div",{children:[o.jsxs("button",{type:"button",onClick:()=>a(d=>!d),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",fontFamily:"inherit"},children:[o.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:n?"rotate(90deg)":"rotate(0deg)",transition:"transform 100ms"},children:o.jsx("path",{d:"M2 1l4 3-4 3z"})}),o.jsxs("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em]",style:{color:"var(--color-text-tertiary)"},children:["Staged Changes (",c,")"]})]}),n&&e.staged.map(d=>o.jsx(ke,{path:d.path,status:d.status,onClick:()=>u(d.path)},`staged-${d.path}`))]}),h>0&&o.jsxs("div",{children:[o.jsxs("button",{type:"button",onClick:()=>p(d=>!d),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",fontFamily:"inherit"},children:[o.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:i?"rotate(90deg)":"rotate(0deg)",transition:"transform 100ms"},children:o.jsx("path",{d:"M2 1l4 3-4 3z"})}),o.jsxs("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em]",style:{color:"var(--color-text-tertiary)"},children:["Changes (",h,")"]})]}),i&&o.jsxs(o.Fragment,{children:[e.unstaged.map(d=>o.jsx(ke,{path:d.path,status:d.status,onClick:()=>u(d.path)},`unstaged-${d.path}`)),e.untracked.map(d=>o.jsx(ke,{path:d,status:"A",onClick:()=>u(d)},`untracked-${d}`))]})]}),c===0&&h===0&&o.jsx("div",{className:"px-[7px] py-[10px] text-center text-[10px]",style:{color:"var(--color-text-tertiary)"},children:"No changes detected"}),e.commits.length>0&&o.jsxs("div",{children:[o.jsxs("button",{type:"button",onClick:()=>s(d=>!d),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",marginTop:4,fontFamily:"inherit"},children:[o.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:l?"rotate(90deg)":"rotate(0deg)",transition:"transform 100ms"},children:o.jsx("path",{d:"M2 1l4 3-4 3z"})}),o.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em]",style:{color:"var(--color-text-tertiary)"},children:"Recent Commits"})]}),l&&e.commits.map(d=>o.jsxs("div",{className:"flex items-center gap-[6px] px-[7px] py-[3px] text-[10px]",style:{color:"var(--color-text-primary)",opacity:.7},children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"shrink-0",children:o.jsx("circle",{cx:"6",cy:"6",r:"3",fill:"var(--color-text-tertiary)"})}),o.jsxs("span",{className:"truncate min-w-0",children:[o.jsx("span",{className:"font-mono",style:{color:"var(--color-accent-blue)",marginRight:4},children:d.shortHash}),d.message]})]},d.hash))]})]})}function En(){const e=O(u=>u.activeProcessId),[t,r]=f.useState(!0),[n,a]=f.useState("chat");ar(e);const i=t&&n==="files",p=f.useCallback(u=>{u?(r(!0),a("files")):n==="files"&&r(!1)},[n]),l=t&&n==="chat",s=f.useCallback(u=>{u?(r(!0),a("chat")):n==="chat"&&r(!1)},[n]);return o.jsx(Vt,{value:{sidebarOpen:t,setSidebarOpen:r,activeTab:n,setActiveTab:a,fileTreeOpen:i,setFileTreeOpen:p,historyOpen:l,setHistoryOpen:s},children:o.jsxs("div",{className:"h-full flex min-w-0 overflow-hidden relative",children:[o.jsx(hn,{}),o.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:o.jsx(an,{})})]})})}export{En as ChatPage};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{j as e,u as ee,a as ce,S as L,r as p,b as D,c as O,s as R,L as Pe,g as P,I as $,C as te,d as F,e as K,R as fe,P as be,O as ye,f as je,T as Ne,h as we,i as ke,k as Oe,l as $e,m as de,V as Re,n as Ie}from"./index-DWG-WrzT.js";import{u as G}from"./shallow-Bme1JY57.js";import{S as Me,P as Ke,L as Ue,a as U,T as Fe,D as He,K as We}from"./table-llyEtj-7.js";import{C as Ve}from"./circle-check-big-TDSeWstm.js";import{M as Ye,C as qe}from"./ChatInput-Bvr-FeEq.js";import{D as Ge}from"./download-DC7KkKyP.js";import"./zap-4uwlzVm0.js";import"./MarkdownRenderer-X4af_WNb.js";import"./chevron-right-Csu22t58.js";import"./terminal-BB3Xfuv5.js";import"./circle-alert-c3tH1P4z.js";function Xe({chips:t,active:a,onSelect:r}){return e.jsx("div",{className:"flex items-center gap-[var(--spacing-1-5)] overflow-x-auto shrink-0",children:t.map(n=>{const o=n===a;return e.jsx("button",{type:"button",onClick:()=>r(n),className:["px-[var(--spacing-3)] py-[var(--spacing-1)]","text-[length:var(--font-size-xs)] font-[var(--font-weight-medium)] whitespace-nowrap","transition-all duration-[var(--duration-fast)] ease-[var(--ease-notion)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]",o?"":"hover:text-text-primary"].join(" "),style:o?{borderRadius:"var(--style-chip-radius)",border:"var(--style-chip-border)",backgroundColor:"var(--style-chip-active-bg)",color:"var(--style-chip-active-color)"}:{borderRadius:"var(--style-chip-radius)",border:"var(--style-chip-border)",backgroundColor:"var(--color-bg-card)",color:"var(--color-text-secondary)"},children:n},n)})})}const Qe={pending:"var(--color-tint-pending)",exploring:"var(--color-tint-exploring)",planning:"var(--color-tint-planning)",executing:"var(--color-tint-executing)",verifying:"var(--color-tint-verifying)",testing:"var(--color-tint-testing)",completed:"var(--color-tint-completed)",blocked:"var(--color-tint-blocked)"};function Je({phase:t}){const{t:a}=ee(),r=ce(g=>g.setSelectedPhase),o=ce(g=>g.selectedPhase)===t.phase;function d(){r(o?null:t.phase)}function c(g){(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),d())}const{tasks_completed:i,tasks_total:l,current_wave:x}=t.execution,h=a("kanban.wave");return e.jsx("article",{role:"listitem",children:e.jsxs("div",{role:"button",tabIndex:0,"aria-label":a("kanban.phase_aria",{phase:t.phase,title:t.title,status:t.status,completed:i,total:l}),"aria-pressed":o,onClick:d,onKeyDown:c,className:["rounded-[10px] px-[var(--spacing-4)] py-[var(--spacing-3)] space-y-[var(--spacing-2)] cursor-pointer","transition-all duration-[var(--duration-normal)] ease-[var(--ease-spring)]","hover:shadow-[0_4px_12px_rgba(0,0,0,0.08)] hover:-translate-y-0.5","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]","active:scale-[0.98] active:shadow-sm active:duration-[var(--duration-fast)]",o?"shadow-[inset_0_0_0_2px_var(--color-accent-blue)]":""].join(" "),style:{backgroundColor:Qe[t.status]??"var(--color-tint-pending)"},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Me,{status:t.status,cardVariant:!0}),e.jsxs("span",{className:"text-[length:var(--font-size-xs)] font-mono text-text-tertiary",children:["P-",String(t.phase).padStart(2,"0")]})]}),e.jsx("h4",{className:"text-[length:var(--font-size-base)] font-[var(--font-weight-semibold)] text-text-primary leading-[var(--line-height-tight)]",children:t.title}),t.goal&&e.jsx("p",{className:"text-[length:var(--font-size-sm)] text-text-secondary leading-[var(--line-height-normal)] line-clamp-2",children:t.goal}),l>0&&e.jsx(Ke,{completed:i,total:l,color:L[t.status]}),t.status==="executing"&&x>0&&e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)] text-[length:var(--font-size-xs)] text-status-executing",children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-status-executing animate-pulse motion-reduce:animate-none"}),e.jsxs("span",{children:[h," ",x]})]})]})})}function Ze({issue:t,selected:a,onSelect:r}){const n=Ue[t.priority];function o(d){(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),r())}return e.jsx("article",{role:"listitem",children:e.jsxs("div",{role:"button",tabIndex:0,"aria-label":`${t.identifier}: ${t.title}. Priority: ${U[t.priority]}`,"aria-pressed":a,onClick:r,onKeyDown:o,className:["rounded-[10px] px-[var(--spacing-4)] py-[var(--spacing-3)] space-y-[var(--spacing-2)] cursor-pointer","transition-all duration-[var(--duration-normal)] ease-[var(--ease-spring)]","hover:shadow-[0_4px_12px_rgba(0,0,0,0.08)] hover:-translate-y-0.5","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]","active:scale-[0.98] active:shadow-sm active:duration-[var(--duration-fast)]","bg-bg-card",a?"shadow-[inset_0_0_0_2px_var(--color-accent-blue)]":""].join(" "),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)]",children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:`#${t.state.color}`},"aria-hidden":"true"}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-mono font-[var(--font-weight-medium)] text-text-tertiary",children:t.identifier})]}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-[var(--font-weight-medium)] px-2 py-[var(--spacing-0-5)] rounded-full",style:{backgroundColor:`${n}20`,color:n},children:U[t.priority]})]}),e.jsx("h4",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary leading-snug line-clamp-2",children:t.title}),e.jsxs("div",{className:"flex items-center justify-between gap-[var(--spacing-2)]",children:[e.jsx("div",{className:"flex gap-[var(--spacing-1)] flex-wrap min-w-0",children:t.labels.slice(0,3).map(d=>e.jsx("span",{className:"text-[length:10px] px-1.5 py-0.5 rounded-full truncate max-w-[80px]",style:{backgroundColor:`#${d.color}20`,color:`#${d.color}`},title:d.name,children:d.name},d.id))}),t.assignee&&e.jsx("span",{className:"w-5 h-5 rounded-full bg-bg-hover shrink-0 flex items-center justify-center text-[length:10px] font-[var(--font-weight-semibold)] text-text-secondary",title:t.assignee.displayName,children:t.assignee.displayName.charAt(0).toUpperCase()})]})]})})}const et={bug:"#C46555",feature:"#5B8DB8",improvement:"#9178B5",task:"#A09D97"},tt={urgent:"#C46555",high:"#B89540",medium:"#5B8DB8",low:"#A09D97"},rt=[{value:"claude-code",label:"Claude"},{value:"codex",label:"Codex"},{value:"gemini",label:"Gemini"},{value:"agent-sdk",label:"Agent SDK"}],at={running:{icon:"●",color:"#B89540",animate:!0},queued:{icon:"◷",color:"#5B8DB8"},completed:{icon:"✓",color:"#5A9E78"},failed:{icon:"✕",color:"#C46555"},retrying:{icon:"↻",color:"#B89540",animate:!0}};function st({issue:t,selected:a,onSelect:r,batchMode:n,isChecked:o,onToggleCheck:d}){var z;const c=et[t.type]??"#A09D97",i=tt[t.priority]??"#A09D97",[l,x]=p.useState(!1),[h,g]=p.useState(t.executor??"claude-code"),m=D(j=>j.isIssueRunning(t.id)),y=D(j=>j.openCliPanel),k=O(j=>j.updateIssue),N=(z=t.execution)==null?void 0:z.status,u=N?at[N]:null,b=p.useCallback(j=>{j.stopPropagation(),R({action:"execute:issue",issueId:t.id,executor:h})},[t.id,h]),C=p.useCallback(j=>{j.stopPropagation();const B=j.target.value;g(B),k(t.id,{executor:B})},[t.id,k]),v=p.useCallback(j=>{j.stopPropagation(),d==null||d(t.id)},[t.id,d]),s=p.useCallback(j=>{j.stopPropagation(),y(t.id)},[t.id,y]);function S(j){(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r())}return e.jsx("article",{role:"listitem",children:e.jsxs("div",{role:"button",tabIndex:0,"aria-label":`${t.title}. Type: ${t.type}. Priority: ${t.priority}`,"aria-pressed":a,onClick:r,onKeyDown:S,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),className:["group/card relative rounded-[10px] px-[var(--spacing-4)] py-[var(--spacing-3)] space-y-[var(--spacing-2)] cursor-pointer","transition-all duration-[var(--duration-normal)] ease-[var(--ease-spring)]","hover:shadow-[0_4px_12px_rgba(0,0,0,0.08)] hover:-translate-y-0.5","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]","active:scale-[0.98] active:shadow-sm active:duration-[var(--duration-fast)]","bg-bg-card motion-safe:animate-[card-enter_200ms_ease-out_both]",a?"shadow-[inset_0_0_0_2px_var(--color-accent-blue)]":"shadow-[var(--shadow-sm)]"].join(" "),children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)]",children:[(n||l)&&e.jsx("div",{onClick:v,className:["shrink-0 w-4 h-4 rounded border-[1.5px] flex items-center justify-center text-[9px] transition-all duration-100 cursor-pointer",o?"bg-accent-blue border-accent-blue text-white scale-100":"border-border hover:border-text-secondary"].join(" "),style:o?{backgroundColor:"var(--color-accent-blue)",borderColor:"var(--color-accent-blue)"}:{},children:o&&"✓"}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-[var(--font-weight-medium)] px-2 py-[var(--spacing-0-5)] rounded-full",style:{backgroundColor:`${c}20`,color:c},children:t.type}),t.path&&e.jsx("span",{className:"text-[10px] font-medium px-1.5 py-[var(--spacing-0-5)] rounded-full",style:{backgroundColor:"var(--color-bg-secondary)",color:"var(--color-text-tertiary)",border:"1px solid var(--color-border)"},children:t.path}),t.solution&&e.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-[var(--spacing-0-5)] rounded-full",style:{backgroundColor:"#9178B520",color:"#9178B5"},children:[t.solution.steps.length," steps"]}),t.phase_id!=null&&e.jsxs(Pe,{to:`/workflow?phase=${t.phase_id}`,onClick:j=>j.stopPropagation(),className:"text-[10px] font-medium px-1.5 py-[var(--spacing-0-5)] rounded-full no-underline transition-colors",style:{backgroundColor:"rgba(91, 141, 184, 0.1)",color:"#5B8DB8"},title:`Go to Phase ${t.phase_id}`,children:["P-",String(t.phase_id).padStart(2,"0")]}),u&&e.jsx("span",{className:["text-[length:var(--font-size-xs)] font-[var(--font-weight-medium)]",u.animate?"animate-pulse":""].join(" "),style:{color:u.color},title:`Execution: ${N}`,onClick:m?s:void 0,children:u.icon}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-[var(--font-weight-medium)] px-2 py-[var(--spacing-0-5)] rounded-full ml-auto",style:{backgroundColor:`${i}20`,color:i},children:t.priority})]}),e.jsx("h4",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary leading-snug line-clamp-2",children:t.title}),e.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const j=P(t),B=$[j];return e.jsx("span",{className:"text-[length:10px]",style:{color:B},children:j.replace("_"," ")})})(),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)]",children:[e.jsx("select",{value:h,onChange:C,onClick:j=>j.stopPropagation(),className:["text-[length:10px] bg-transparent border border-border rounded px-1 py-0.5 text-text-secondary cursor-pointer","transition-opacity",l||a?"opacity-100":"opacity-0"].join(" "),"aria-label":"Select executor",children:rt.map(j=>e.jsx("option",{value:j.value,children:j.label},j.value))}),!m&&t.status!=="resolved"&&t.status!=="closed"&&e.jsx("button",{type:"button",onClick:b,className:["w-5 h-5 flex items-center justify-center rounded-[var(--radius-sm)] text-text-tertiary hover:text-accent-blue hover:bg-bg-hover transition-all",l||a?"opacity-100":"opacity-0"].join(" "),"aria-label":"Execute issue",title:"Execute issue",children:e.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"5,3 19,12 5,21"})})}),m&&e.jsx("button",{type:"button",onClick:s,className:"w-5 h-5 flex items-center justify-center rounded-[var(--radius-sm)] text-[#B89540] hover:bg-bg-hover transition-all","aria-label":"View execution output",title:"View execution output",children:e.jsx("svg",{className:"w-3 h-3 animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",strokeLinecap:"round"})})})]})]})]})})}const ot=[{value:"task",label:"Task",color:"#A09D97"},{value:"bug",label:"Bug",color:"#C46555"},{value:"feature",label:"Feature",color:"#5B8DB8"},{value:"improvement",label:"Improve",color:"#9178B5"}],nt=[{value:"urgent",label:"Urgent",color:"#C46555"},{value:"high",label:"High",color:"#B89540"},{value:"medium",label:"Medium",color:"#5B8DB8"},{value:"low",label:"Low",color:"#A09D97"}];function lt({columnId:t,onClose:a,onCreated:r}){const[n,o]=p.useState(""),[d,c]=p.useState("task"),[i,l]=p.useState("medium"),[x,h]=p.useState(!1),g=p.useRef(null),m=p.useRef(null),y=O(u=>u.createIssue);p.useEffect(()=>{requestAnimationFrame(()=>{var u;return(u=g.current)==null?void 0:u.focus()})},[]),p.useEffect(()=>{function u(b){m.current&&!m.current.contains(b.target)&&a()}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);async function k(){const u=n.trim();!u||x||(h(!0),await y({title:u,description:"",type:d,priority:i}),h(!1),o(""),r==null||r(),a())}function N(u){u.key==="Enter"&&!u.shiftKey?(u.preventDefault(),k()):u.key==="Escape"&&(u.preventDefault(),a())}return e.jsxs("div",{ref:m,className:"rounded-[10px] border-2 border-dashed border-accent-blue/40 bg-bg-card px-[var(--spacing-3)] py-[var(--spacing-2-5)] space-y-[var(--spacing-2)] motion-safe:animate-[fade-in_100ms_ease-out]",children:[e.jsx("input",{ref:g,type:"text",value:n,onChange:u=>o(u.target.value),onKeyDown:N,placeholder:"Issue title...",disabled:x,className:"w-full bg-transparent text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary placeholder:text-text-tertiary outline-none"}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx("div",{className:"flex gap-[var(--spacing-0-5)]",children:ot.map(u=>e.jsx("button",{type:"button",onClick:()=>c(u.value),className:["text-[length:10px] font-[var(--font-weight-medium)] px-[var(--spacing-1-5)] py-[1px] rounded-full transition-all duration-[var(--duration-fast)]",d===u.value?"ring-1 ring-current":"opacity-50 hover:opacity-80"].join(" "),style:{backgroundColor:`${u.color}20`,color:u.color},children:u.label},u.value))}),e.jsx("div",{className:"w-px h-3 bg-border-divider"}),e.jsx("div",{className:"flex gap-[var(--spacing-0-5)]",children:nt.map(u=>e.jsx("button",{type:"button",onClick:()=>l(u.value),className:["text-[length:10px] font-[var(--font-weight-medium)] px-[var(--spacing-1-5)] py-[1px] rounded-full transition-all duration-[var(--duration-fast)]",i===u.value?"ring-1 ring-current":"opacity-50 hover:opacity-80"].join(" "),style:{backgroundColor:`${u.color}20`,color:u.color},children:u.label},u.value))})]}),e.jsxs("div",{className:"flex items-center justify-between text-[length:10px] text-text-tertiary",children:[e.jsxs("span",{children:[e.jsx("kbd",{className:"px-1 py-[1px] rounded bg-bg-hover font-mono text-[9px]",children:"Enter"})," create"," ",e.jsx("kbd",{className:"px-1 py-[1px] rounded bg-bg-hover font-mono text-[9px]",children:"Esc"})," cancel"]}),x&&e.jsx("span",{children:"Creating..."})]})]})}function it({columnId:t,title:a,phases:r,color:n,animationDelay:o=0,onSelectPhase:d,linearIssues:c,localIssues:i,selectedItem:l,onSelectItem:x,composingColumnId:h,onStartCompose:g,onStopCompose:m,onIssueCreated:y,batchMode:k,selectedIssueIds:N,onToggleIssueCheck:u}){const{t:b}=ee(),C=b("kanban.no_phases"),v=r.length===0&&(!i||i.length===0)&&(!c||c.length===0);return e.jsxs("section",{className:"group/col flex flex-col min-w-[var(--size-card-min-width)] flex-1 bg-bg-secondary rounded-[var(--radius-lg)] overflow-hidden motion-safe:animate-[column-enter_200ms_ease-out_both]",style:{animationDelay:`${o}ms`},"aria-label":`${a} column, ${r.length} phases`,children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] py-[var(--spacing-2-5)]",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:n},"aria-hidden":"true"}),e.jsx("h3",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-semibold)] text-text-primary",children:a}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary bg-bg-card rounded-full px-[var(--spacing-1-5)] tabular-nums",children:r.length+((i==null?void 0:i.length)??0)+((c==null?void 0:c.length)??0)}),e.jsx("button",{type:"button",onClick:()=>g==null?void 0:g(t),className:"ml-auto w-5 h-5 flex items-center justify-center rounded-[var(--radius-sm)] text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors opacity-0 group-hover/col:opacity-100 focus-visible:opacity-100","aria-label":"Create issue in this column",children:e.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})})]}),e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-2)] px-[var(--spacing-2)] pb-[var(--spacing-2)] overflow-y-auto flex-1",role:"list",children:[h===t&&m&&e.jsx(lt,{columnId:t,onClose:m,onCreated:y}),v?e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-secondary text-center py-[var(--spacing-6)] italic",children:C}):e.jsxs(e.Fragment,{children:[r.map(s=>e.jsx(Je,{phase:s},s.phase)),i&&i.length>0&&e.jsxs(e.Fragment,{children:[r.length>0&&e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] py-[var(--spacing-1)]",children:[e.jsx("div",{className:"flex-1 h-px bg-border-divider"}),e.jsx("span",{className:"text-[length:10px] text-text-tertiary font-[var(--font-weight-medium)] uppercase tracking-wider",children:"Issues"}),e.jsx("div",{className:"flex-1 h-px bg-border-divider"})]}),i.map(s=>e.jsx(st,{issue:s,selected:(l==null?void 0:l.type)==="issue"&&l.issue.id===s.id,onSelect:()=>x==null?void 0:x({type:"issue",issue:s}),batchMode:k,isChecked:N==null?void 0:N.has(s.id),onToggleCheck:u},s.id))]}),c&&c.length>0&&e.jsxs(e.Fragment,{children:[(r.length>0||i&&i.length>0)&&e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] py-[var(--spacing-1)]",children:[e.jsx("div",{className:"flex-1 h-px bg-border-divider"}),e.jsx("span",{className:"text-[length:10px] text-text-tertiary font-[var(--font-weight-medium)] uppercase tracking-wider",children:"Linear"}),e.jsx("div",{className:"flex-1 h-px bg-border-divider"})]}),c.map(s=>e.jsx(Ze,{issue:s,selected:(l==null?void 0:l.type)==="linearIssue"&&l.issue.id===s.id,onSelect:()=>x==null?void 0:x({type:"linearIssue",issue:s})},s.id))]})]})]})]})}const ct={backlog:L.pending,triage:"#C8863A","in-progress":L.executing,review:L.verifying,done:L.completed,deferred:"#8B8685"},dt={backlog:"columns.backlog",triage:"columns.triage","in-progress":"columns.in_progress",review:"columns.review",done:"columns.done",deferred:"columns.deferred"},xt={backlog:"backlog",unstarted:"backlog",started:"in-progress",completed:"done"},pt={open:"backlog",registered:"triage",in_progress:"in-progress",resolved:"review",closed:"done",deferred:"deferred"};function ut(t){var r;const a=new Map;for(const n of te)a.set(n.id,[]);for(const n of t){const o=pt[n.status]??"backlog";(r=a.get(o))==null||r.push(n)}return a}function ht(t){var r;const a=new Map;for(const n of te)a.set(n.id,[]);for(const n of t){const o=xt[n.state.type]??"backlog";(r=a.get(o))==null||r.push(n)}return a}function vt({linearIssues:t,localIssues:a,selectedItem:r,onSelectItem:n,composingColumnId:o,onStartCompose:d,onStopCompose:c,onIssueCreated:i,showDone:l=!0,batchMode:x,selectedIssueIds:h,onToggleIssueCheck:g}){const{t:m}=ee(),y=p.useRef(null),k=p.useCallback(b=>{const C=y.current;if(!C)return;const v=Array.from(C.querySelectorAll('[role="button"][tabindex="0"]')),s=document.activeElement,S=s?v.indexOf(s):-1;let z=-1;b.key==="ArrowDown"||b.key==="ArrowRight"?(b.preventDefault(),z=S<v.length-1?S+1:0):b.key==="ArrowUp"||b.key==="ArrowLeft"?(b.preventDefault(),z=S>0?S-1:v.length-1):b.key==="Home"?(b.preventDefault(),z=0):b.key==="End"&&(b.preventDefault(),z=v.length-1),z>=0&&v[z]&&v[z].focus()},[]);p.useEffect(()=>{const b=y.current;if(b)return b.addEventListener("keydown",k),()=>b.removeEventListener("keydown",k)},[k]);const N=p.useMemo(()=>ht(t??[]),[t]),u=p.useMemo(()=>ut(a??[]),[a]);return e.jsx("div",{ref:y,className:"flex gap-[var(--spacing-3)] h-full overflow-x-auto p-[var(--spacing-3)] scroll-smooth",children:te.filter(b=>l||b.id!=="done").map((b,C)=>e.jsx(it,{columnId:b.id,title:m(dt[b.id]),phases:[],color:ct[b.id]??L.pending,animationDelay:C*50,onSelectPhase:()=>{},linearIssues:N.get(b.id),localIssues:u.get(b.id),selectedItem:r,onSelectItem:n,composingColumnId:o,onStartCompose:d,onStopCompose:c,onIssueCreated:i,batchMode:x,selectedIssueIds:h,onToggleIssueCheck:g},b.id))})}const mt={bug:"#C46555",feature:"#5B8DB8",improvement:"#9178B5",task:"#A09D97"},gt={urgent:"#C46555",high:"#B89540",medium:"#5B8DB8",low:"#A09D97"},ft={open:"Open",registered:"Registered",in_progress:"In Progress",resolved:"Resolved",closed:"Closed",deferred:"Deferred"},T="text-left px-[var(--spacing-3)] py-[var(--spacing-2)] text-[length:var(--font-size-xs)] font-[var(--font-weight-semibold)] text-text-tertiary uppercase tracking-wide";function bt({localIssues:t,linearIssues:a,selectedItem:r,onSelectItem:n}){const o=((t==null?void 0:t.length)??0)>0,d=((a==null?void 0:a.length)??0)>0;return!o&&!d?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"No data available"}):e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-4)] h-full overflow-auto p-[var(--spacing-3)]",children:[o&&e.jsxs("section",{children:[e.jsx(pe,{label:"Issues",count:t.length}),e.jsx("div",{className:"rounded-[var(--radius-lg)] overflow-hidden border border-border-divider",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-bg-secondary",children:[e.jsx("th",{className:`${T} w-[80px]`,children:"Type"}),e.jsx("th",{className:T,children:"Title"}),e.jsx("th",{className:`${T} w-[90px]`,children:"Priority"}),e.jsx("th",{className:`${T} w-[100px]`,children:"Status"})]})}),e.jsx("tbody",{children:t.map((c,i)=>{const l=mt[c.type]??"#A09D97",x=gt[c.priority]??"#A09D97",h=(r==null?void 0:r.type)==="issue"&&r.issue.id===c.id;return e.jsxs("tr",{onClick:()=>n==null?void 0:n({type:"issue",issue:c}),className:xe(i,h),children:[e.jsx("td",{className:"px-[var(--spacing-3)] py-[var(--spacing-2-5)]",children:e.jsx(ue,{label:c.type,color:l})}),e.jsx("td",{className:"px-[var(--spacing-3)] py-[var(--spacing-2-5)] text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary",children:c.title}),e.jsx("td",{className:"px-[var(--spacing-3)] py-[var(--spacing-2-5)]",children:e.jsx(ue,{label:c.priority,color:x})}),e.jsx("td",{className:"px-[var(--spacing-3)] py-[var(--spacing-2-5)] text-[length:var(--font-size-xs)] text-text-secondary whitespace-nowrap",children:ft[c.status]??c.status})]},c.id)})})]})})]}),d&&e.jsxs("section",{children:[e.jsx(pe,{label:"Linear",count:a.length}),e.jsx("div",{className:"rounded-[var(--radius-lg)] overflow-hidden border border-border-divider",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-bg-secondary",children:[e.jsx("th",{className:`${T} w-[80px]`,children:"ID"}),e.jsx("th",{className:T,children:"Title"}),e.jsx("th",{className:`${T} w-[110px]`,children:"State"}),e.jsx("th",{className:`${T} w-[90px]`,children:"Priority"})]})}),e.jsx("tbody",{children:a.map((c,i)=>{const l=(r==null?void 0:r.type)==="linearIssue"&&r.issue.id===c.id;return e.jsxs("tr",{onClick:()=>n==null?void 0:n({type:"linearIssue",issue:c}),className:xe(i,l),children:[e.jsx("td",{className:"px-[var(--spacing-3)] py-[var(--spacing-2-5)] text-[length:var(--font-size-xs)] font-mono text-text-tertiary",children:c.identifier}),e.jsx("td",{className:"px-[var(--spacing-3)] py-[var(--spacing-2-5)] text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary",children:c.title}),e.jsx("td",{className:"px-[var(--spacing-3)] py-[var(--spacing-2-5)] text-[length:var(--font-size-xs)] text-text-secondary",children:c.state.name}),e.jsx("td",{className:"px-[var(--spacing-3)] py-[var(--spacing-2-5)] text-[length:var(--font-size-xs)] text-text-secondary",children:U[c.priority]})]},c.id)})})]})})]})]})}function xe(t,a){return["cursor-pointer transition-colors border-t border-border-divider",a?"bg-[rgba(90,130,200,0.08)]":t%2===0?"bg-bg-primary hover:bg-bg-hover":"bg-[rgba(0,0,0,0.015)] hover:bg-bg-hover"].join(" ")}function pe({label:t,count:a}){return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] mb-[var(--spacing-2)]",children:[e.jsx("h3",{className:"text-[length:var(--font-size-xs)] font-[var(--font-weight-semibold)] uppercase tracking-wider text-text-tertiary",children:t}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary bg-bg-secondary rounded-full px-[var(--spacing-1-5)] tabular-nums",children:a})]})}function ue({label:t,color:a}){return e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-[var(--font-weight-medium)] px-2 py-[var(--spacing-0-5)] rounded-full whitespace-nowrap",style:{backgroundColor:`${a}20`,color:a},children:t})}/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const yt=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],jt=F("inbox",yt),Nt={bug:"#C46555",feature:"#5B8DB8",improvement:"#9178B5",task:"#A09D97"},wt={urgent:"#C46555",high:"#B89540",medium:"#5B8DB8",low:"#A09D97"};function kt({localIssues:t,linearIssues:a,selectedItem:r,onSelectItem:n}){const o=p.useMemo(()=>(t??[]).filter(i=>i.status==="open"||i.status==="registered"||i.status==="in_progress"),[t]),d=p.useMemo(()=>(t??[]).filter(i=>i.status==="resolved"||i.status==="closed"||i.status==="deferred"),[t]),c=((t==null?void 0:t.length)??0)+((a==null?void 0:a.length)??0);return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-4)] px-[var(--spacing-4)] py-[var(--spacing-2-5)] border-b border-border-divider shrink-0 bg-bg-secondary",children:[e.jsx(X,{label:"Issues",value:c,sub:`${o.length} open`,color:L.pending}),e.jsx("div",{className:"w-px h-6 bg-border-divider"}),e.jsx(X,{label:"In Progress",value:(t??[]).filter(i=>i.status==="in_progress").length,sub:"active",color:L.executing}),e.jsx("div",{className:"w-px h-6 bg-border-divider"}),e.jsx(X,{label:"Resolved",value:d.length,sub:"done",color:L.completed})]}),e.jsxs("div",{className:"flex-1 grid grid-cols-[1fr_280px] overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col overflow-hidden border-r border-border-divider",children:[e.jsx(he,{icon:e.jsx(jt,{size:14,strokeWidth:2}),label:"Issue Queue",children:e.jsxs("span",{className:"ml-auto text-[length:var(--font-size-xs)] font-[var(--font-weight-semibold)] px-[var(--spacing-1-5)] py-px rounded-full bg-border-subtle text-text-secondary",children:[o.length," open"]})}),e.jsx("div",{className:"flex-1 overflow-y-auto py-[var(--spacing-1)]",children:o.length===0?e.jsx(Ct,{message:"No open issues"}):o.map(i=>{const l=Nt[i.type]??"#A09D97",x=wt[i.priority]??"#A09D97",h=(r==null?void 0:r.type)==="issue"&&r.issue.id===i.id;return e.jsxs("button",{type:"button",onClick:()=>n==null?void 0:n({type:"issue",issue:i}),className:["flex items-center gap-[var(--spacing-2)] px-[var(--spacing-4)] py-[var(--spacing-2)] w-full text-left transition-colors",h?"bg-[rgba(90,130,200,0.08)]":"hover:bg-bg-hover"].join(" "),children:[e.jsx("span",{className:"text-[length:9px] font-[var(--font-weight-semibold)] px-[6px] py-[2px] rounded-full shrink-0",style:{backgroundColor:`${l}20`,color:l},children:i.type}),e.jsx("span",{className:"flex-1 text-[length:var(--font-size-xs)] text-text-primary line-clamp-1",children:i.title}),e.jsx("span",{className:"text-[length:9px] font-[var(--font-weight-semibold)] px-[6px] py-[2px] rounded-full shrink-0",style:{backgroundColor:`${x}20`,color:x},children:i.priority})]},i.id)})})]}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsx(he,{icon:e.jsx(Ve,{size:14,strokeWidth:2}),label:"Summary"}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-[var(--spacing-4)] py-[var(--spacing-3)] flex flex-col gap-[var(--spacing-4)]",children:[((t==null?void 0:t.length)??0)>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[length:10px] text-text-tertiary uppercase tracking-wider font-[var(--font-weight-semibold)]",children:"Issues"}),e.jsxs("div",{className:"mt-[var(--spacing-2)] flex flex-col gap-[var(--spacing-1-5)]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:"Open"}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-[var(--font-weight-semibold)] text-text-primary tabular-nums",children:o.length})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:"In Progress"}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-[var(--font-weight-semibold)] text-text-primary tabular-nums",children:(t??[]).filter(i=>i.status==="in_progress").length})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:"Resolved"}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-[var(--font-weight-semibold)] text-text-primary tabular-nums",children:d.length})]})]})]}),((a==null?void 0:a.length)??0)>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[length:10px] text-text-tertiary uppercase tracking-wider font-[var(--font-weight-semibold)]",children:"Linear"}),e.jsx("div",{className:"mt-[var(--spacing-2)]",children:e.jsxs("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:[a.length," issues"]})})]})]})]})]})]})}function X({label:t,value:a,sub:r,color:n}){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary",children:t}),e.jsxs("div",{className:"flex items-baseline gap-[var(--spacing-1-5)]",children:[e.jsx("span",{className:"text-[length:var(--font-size-base)] font-[var(--font-weight-semibold)]",style:{color:n},children:a}),e.jsx("span",{className:"text-[length:10px] text-text-tertiary",children:r})]})]})}function he({icon:t,label:a,children:r}){return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-4)] py-[var(--spacing-2-5)] border-b border-border-divider shrink-0",children:[e.jsx("span",{className:"text-text-tertiary",children:t}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-[var(--font-weight-semibold)] uppercase tracking-wider text-text-tertiary",children:a}),r]})}function Ct({message:t}){return e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-tertiary text-center py-[var(--spacing-6)] italic",children:t})}function St({issues:t,onClose:a}){const[r,n]=p.useState(new Set),[o,d]=p.useState(!1),[c,i]=p.useState(null),l=K(m=>m.importIssues);function x(){r.size===t.length?n(new Set):n(new Set(t.map(m=>m.id)))}function h(m){const y=new Set(r);y.has(m)?y.delete(m):y.add(m),n(y)}async function g(){const m=t.filter(y=>r.has(y.id));if(m.length!==0){d(!0);try{const y=await l(m);i(y)}catch(y){i({imported:0,errors:[String(y)]})}finally{d(!1)}}}return e.jsx(fe,{open:!0,onOpenChange:m=>!m&&a(),children:e.jsxs(be,{children:[e.jsx(ye,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"}),e.jsxs(je,{className:ke("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[600px] max-w-[95vw] max-h-[80vh]","rounded-[var(--radius-lg)] border border-border bg-bg-primary shadow-lg","flex flex-col overflow-hidden focus:outline-none"),children:[e.jsxs("div",{className:"flex items-center justify-between px-[var(--spacing-4)] py-[var(--spacing-3)] border-b border-border",children:[e.jsx(Ne,{className:"text-[length:var(--font-size-base)] font-[var(--font-weight-semibold)] text-text-primary",children:"Import from Linear"}),e.jsx(we,{className:"w-7 h-7 flex items-center justify-center rounded-[var(--radius-sm)] text-text-secondary hover:text-text-primary hover:bg-bg-hover",children:e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),c?e.jsxs("div",{className:"p-[var(--spacing-4)] space-y-[var(--spacing-3)]",children:[e.jsxs("p",{className:"text-[length:var(--font-size-sm)] text-text-primary",children:["Imported ",c.imported," issue(s)."]}),c.errors.length>0&&e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-status-blocked",children:c.errors.map((m,y)=>e.jsx("div",{children:m},y))}),e.jsx("button",{type:"button",onClick:a,className:"px-[var(--spacing-3)] py-[var(--spacing-1-5)] rounded-[var(--radius-sm)] bg-accent-blue text-white text-[length:var(--font-size-sm)] hover:opacity-90",children:"Done"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-[var(--spacing-4)] py-[var(--spacing-2)] bg-bg-secondary border-b border-border",children:e.jsxs("p",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:["Linear issues will be mapped: ",e.jsx("span",{className:"font-mono",children:"identifier"})," → title prefix, ",e.jsx("span",{className:"font-mono",children:"priority"})," → local priority, ",e.jsx("span",{className:"font-mono",children:"state.type"})," → local status"]})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:t.length===0?e.jsx("div",{className:"p-[var(--spacing-4)] text-[length:var(--font-size-sm)] text-text-secondary text-center",children:"No Linear issues available"}):e.jsxs("table",{className:"w-full text-[length:var(--font-size-xs)]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-text-tertiary",children:[e.jsx("th",{className:"w-8 p-[var(--spacing-2)]",children:e.jsx("input",{type:"checkbox",checked:r.size===t.length,onChange:x})}),e.jsx("th",{className:"text-left p-[var(--spacing-2)]",children:"Issue"}),e.jsx("th",{className:"text-left p-[var(--spacing-2)]",children:"Status"}),e.jsx("th",{className:"text-left p-[var(--spacing-2)]",children:"Priority"})]})}),e.jsx("tbody",{children:t.map(m=>e.jsxs("tr",{className:"border-b border-border-divider hover:bg-bg-hover cursor-pointer",onClick:()=>h(m.id),children:[e.jsx("td",{className:"p-[var(--spacing-2)]",children:e.jsx("input",{type:"checkbox",checked:r.has(m.id),onChange:()=>h(m.id)})}),e.jsxs("td",{className:"p-[var(--spacing-2)]",children:[e.jsx("span",{className:"font-mono text-text-tertiary",children:m.identifier})," ",e.jsx("span",{className:"text-text-primary",children:m.title})]}),e.jsx("td",{className:"p-[var(--spacing-2)] text-text-secondary",children:m.state.name}),e.jsx("td",{className:"p-[var(--spacing-2)] text-text-secondary",children:U[m.priority]})]},m.id))})]})}),e.jsxs("div",{className:"flex items-center justify-between px-[var(--spacing-4)] py-[var(--spacing-3)] border-t border-border",children:[e.jsxs("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:[r.size," of ",t.length," selected"]}),e.jsxs("div",{className:"flex gap-[var(--spacing-2)]",children:[e.jsx("button",{type:"button",onClick:a,className:"px-[var(--spacing-3)] py-[var(--spacing-1-5)] rounded-[var(--radius-sm)] border border-border text-text-secondary text-[length:var(--font-size-sm)] hover:bg-bg-hover",children:"Cancel"}),e.jsx("button",{type:"button",onClick:()=>void g(),disabled:r.size===0||o,className:"px-[var(--spacing-3)] py-[var(--spacing-1-5)] rounded-[var(--radius-sm)] bg-accent-blue text-white text-[length:var(--font-size-sm)] hover:opacity-90 disabled:opacity-50",children:o?"Importing...":`Import ${r.size} issue(s)`})]})]})]})]})]})})}function zt({teams:t,selectedTeamId:a,onClose:r}){var C;const[n,o]=p.useState(a??((C=t[0])==null?void 0:C.id)??""),[d,c]=p.useState(new Set),[i,l]=p.useState(!1),[x,h]=p.useState(null),g=O(v=>v.issues),m=O(v=>v.fetchIssues),y=K(v=>v.exportIssues),k=K(v=>v.refresh);p.useEffect(()=>{m()},[m]);function N(){d.size===g.length?c(new Set):c(new Set(g.map(v=>v.id)))}function u(v){const s=new Set(d);s.has(v)?s.delete(v):s.add(v),c(s)}async function b(){const v=g.filter(s=>d.has(s.id));if(!(v.length===0||!n)){l(!0);try{const s=await y(v,n);h(s),await k()}catch(s){h({exported:0,errors:[String(s)]})}finally{l(!1)}}}return e.jsx(fe,{open:!0,onOpenChange:v=>!v&&r(),children:e.jsxs(be,{children:[e.jsx(ye,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"}),e.jsxs(je,{className:ke("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[600px] max-w-[95vw] max-h-[80vh]","rounded-[var(--radius-lg)] border border-border bg-bg-primary shadow-lg","flex flex-col overflow-hidden focus:outline-none"),children:[e.jsxs("div",{className:"flex items-center justify-between px-[var(--spacing-4)] py-[var(--spacing-3)] border-b border-border",children:[e.jsx(Ne,{className:"text-[length:var(--font-size-base)] font-[var(--font-weight-semibold)] text-text-primary",children:"Export to Linear"}),e.jsx(we,{className:"w-7 h-7 flex items-center justify-center rounded-[var(--radius-sm)] text-text-secondary hover:text-text-primary hover:bg-bg-hover",children:e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),x?e.jsxs("div",{className:"p-[var(--spacing-4)] space-y-[var(--spacing-3)]",children:[e.jsxs("p",{className:"text-[length:var(--font-size-sm)] text-text-primary",children:["Exported ",x.exported," issue(s) to Linear."]}),x.errors.length>0&&e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-status-blocked",children:x.errors.map((v,s)=>e.jsx("div",{children:v},s))}),e.jsx("button",{type:"button",onClick:r,className:"px-[var(--spacing-3)] py-[var(--spacing-1-5)] rounded-[var(--radius-sm)] bg-accent-blue text-white text-[length:var(--font-size-sm)] hover:opacity-90",children:"Done"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-[var(--spacing-4)] py-[var(--spacing-2)] bg-bg-secondary border-b border-border space-y-[var(--spacing-2)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx("label",{className:"text-[length:var(--font-size-xs)] text-text-secondary shrink-0",children:"Target team:"}),e.jsx("select",{value:n,onChange:v=>o(v.target.value),className:"px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)] border border-border bg-bg-primary text-text-primary text-[length:var(--font-size-xs)]",children:t.map(v=>e.jsxs("option",{value:v.id,children:[v.key," — ",v.name]},v.id))})]}),e.jsxs("p",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:["Local issues will be created in Linear: ",e.jsx("span",{className:"font-mono",children:"title"})," → title, ",e.jsx("span",{className:"font-mono",children:"priority"})," → Linear priority, ",e.jsx("span",{className:"font-mono",children:"description"})," → description"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:g.length===0?e.jsx("div",{className:"p-[var(--spacing-4)] text-[length:var(--font-size-sm)] text-text-secondary text-center",children:"No local issues available"}):e.jsxs("table",{className:"w-full text-[length:var(--font-size-xs)]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-text-tertiary",children:[e.jsx("th",{className:"w-8 p-[var(--spacing-2)]",children:e.jsx("input",{type:"checkbox",checked:d.size===g.length&&g.length>0,onChange:N})}),e.jsx("th",{className:"text-left p-[var(--spacing-2)]",children:"Title"}),e.jsx("th",{className:"text-left p-[var(--spacing-2)]",children:"Status"}),e.jsx("th",{className:"text-left p-[var(--spacing-2)]",children:"Priority"})]})}),e.jsx("tbody",{children:g.map(v=>e.jsxs("tr",{className:"border-b border-border-divider hover:bg-bg-hover cursor-pointer",onClick:()=>u(v.id),children:[e.jsx("td",{className:"p-[var(--spacing-2)]",children:e.jsx("input",{type:"checkbox",checked:d.has(v.id),onChange:()=>u(v.id)})}),e.jsx("td",{className:"p-[var(--spacing-2)] text-text-primary",children:v.title}),e.jsx("td",{className:"p-[var(--spacing-2)] text-text-secondary",children:v.status}),e.jsx("td",{className:"p-[var(--spacing-2)] text-text-secondary",children:v.priority})]},v.id))})]})}),e.jsxs("div",{className:"flex items-center justify-between px-[var(--spacing-4)] py-[var(--spacing-3)] border-t border-border",children:[e.jsxs("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:[d.size," of ",g.length," selected"]}),e.jsxs("div",{className:"flex gap-[var(--spacing-2)]",children:[e.jsx("button",{type:"button",onClick:r,className:"px-[var(--spacing-3)] py-[var(--spacing-1-5)] rounded-[var(--radius-sm)] border border-border text-text-secondary text-[length:var(--font-size-sm)] hover:bg-bg-hover",children:"Cancel"}),e.jsx("button",{type:"button",onClick:()=>void b(),disabled:d.size===0||!n||i,className:"px-[var(--spacing-3)] py-[var(--spacing-1-5)] rounded-[var(--radius-sm)] bg-accent-blue text-white text-[length:var(--font-size-sm)] hover:opacity-90 disabled:opacity-50",children:i?"Exporting...":`Export ${d.size} issue(s)`})]})]})]})]})]})})}/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const _t=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Et=F("layout-dashboard",_t);/**
|
|
12
|
-
* @license lucide-react v0.577.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Lt=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Dt=F("refresh-cw",Lt);/**
|
|
17
|
-
* @license lucide-react v0.577.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Bt=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],At=F("upload",Bt),Tt={"claude-code":"Claude Code",codex:"Codex",gemini:"Gemini",qwen:"Qwen",opencode:"OpenCode"};function Pt(){var k,N;const t=D(u=>u.cliPanelIssueId),a=D(u=>u.closeCliPanel),r=D(u=>u.getSlotForIssue),o=O(u=>u.issues).find(u=>u.id===t),d=t?r(t):void 0,c=(d==null?void 0:d.processId)??((k=o==null?void 0:o.execution)==null?void 0:k.processId)??null,i=Oe(u=>u.processes),l=c?i[c]:void 0,x=p.useCallback(()=>{c&&R({action:"stop",processId:c})},[c]);if(!t||!o)return null;const h=(l==null?void 0:l.status)==="running"||(l==null?void 0:l.status)==="spawning",g=((N=o.execution)==null?void 0:N.status)??"idle",m=(d==null?void 0:d.executor)??o.executor??"claude-code",y=Tt[m]??"Agent";return e.jsxs("div",{className:"flex flex-col h-full border-l border-border-divider bg-bg-primary w-[480px] shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] py-[var(--spacing-2)] border-b border-border-divider shrink-0",children:[e.jsx("h3",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-semibold)] text-text-primary truncate flex-1",children:o.title}),e.jsx("span",{className:"text-[length:10px] font-[var(--font-weight-medium)] px-2 py-[2px] rounded-full bg-bg-hover text-text-secondary shrink-0",children:y}),e.jsx("span",{className:["text-[length:10px] font-[var(--font-weight-medium)] px-2 py-[2px] rounded-full shrink-0",g==="running"?"bg-[#B8954020] text-[#B89540]":g==="completed"?"bg-[#5A9E7820] text-[#5A9E78]":g==="failed"?"bg-[#C4655520] text-[#C46555]":"bg-bg-hover text-text-secondary"].join(" "),children:g}),h&&e.jsx("button",{type:"button",onClick:x,className:"text-[length:var(--font-size-xs)] px-2 py-1 rounded-[var(--radius-sm)] border border-[#C46555] text-[#C46555] hover:bg-[#C4655510] transition-colors shrink-0",children:"Stop"}),e.jsx("button",{type:"button",onClick:a,className:"w-6 h-6 flex items-center justify-center rounded-[var(--radius-sm)] text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors shrink-0","aria-label":"Close panel",children:e.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:e.jsx(Ye,{processId:c})}),e.jsx(qe,{processId:c,executor:m})]})}const Ot=[{value:"claude-code",label:"Claude Code"},{value:"codex",label:"Codex"},{value:"gemini",label:"Gemini"}];function $t(){const t=D(c=>c.selectedIssueIds),a=D(c=>c.clearSelection),[r,n]=p.useState("claude-code"),o=t.size,d=p.useCallback(()=>{o!==0&&(R({action:"execute:batch",issueIds:Array.from(t),executor:r}),a())},[t,r,o,a]);return o===0?null:e.jsxs("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50 flex items-center gap-[var(--spacing-2)] px-[var(--spacing-4)] py-[var(--spacing-2)] rounded-full bg-bg-card border border-border shadow-[0_8px_32px_rgba(0,0,0,0.12)] backdrop-blur-sm",children:[e.jsxs("span",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-semibold)] text-text-primary",children:[o," selected"]}),e.jsx("div",{className:"w-px h-5 bg-border-divider"}),e.jsx("select",{value:r,onChange:c=>n(c.target.value),className:"px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)] border border-border bg-bg-primary text-text-primary text-[length:var(--font-size-xs)] cursor-pointer",children:Ot.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))}),e.jsxs("button",{type:"button",onClick:d,className:"flex items-center gap-[var(--spacing-1)] px-[var(--spacing-3)] py-[var(--spacing-1)] rounded-full bg-accent-blue text-white text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] hover:opacity-90 transition-opacity",children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("polygon",{points:"5,3 19,12 5,21"})}),"Execute"]}),e.jsx("button",{type:"button",onClick:a,className:"w-6 h-6 flex items-center justify-center rounded-full text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors","aria-label":"Clear selection",children:e.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}const Rt={create_issue:{bg:"rgba(91, 141, 184, 0.1)",text:"#5B8DB8"},execute_issue:{bg:"rgba(90, 158, 120, 0.1)",text:"#5A9E78"},analyze_issue:{bg:"rgba(145, 120, 181, 0.1)",text:"#9178B5"},plan_issue:{bg:"rgba(145, 120, 181, 0.1)",text:"#9178B5"},advance_phase:{bg:"rgba(184, 149, 64, 0.1)",text:"#B89540"},flag_blocker:{bg:"rgba(196, 101, 85, 0.1)",text:"#C46555"}};function It(){const t=D(l=>l.recentDecisions),[a,r]=p.useState(new Set),[n,o]=p.useState(!1),d=p.useMemo(()=>{const l=[];for(const x of t)for(const h of x.deferred){const g=`${x.id}-${h.type}-${h.target}`;a.has(g)||l.push({decisionId:x.id,action:h,timestamp:x.timestamp})}return l.slice(-5)},[t,a]),c=p.useCallback(l=>{l.action.type==="execute_issue"&&R({action:"execute:issue",issueId:l.action.target,executor:l.action.executor??"claude-code"}),r(x=>{const h=new Set(x);return h.add(`${l.decisionId}-${l.action.type}-${l.action.target}`),h})},[]),i=p.useCallback(l=>{r(x=>{const h=new Set(x);return h.add(`${l.decisionId}-${l.action.type}-${l.action.target}`),h})},[]);return d.length===0?null:e.jsxs("div",{className:"border-b border-border-divider bg-bg-secondary",children:[e.jsx("div",{className:"flex items-center justify-between px-[var(--spacing-4)] py-[var(--spacing-1-5)]",children:e.jsxs("button",{type:"button",onClick:()=>o(!n),className:"flex items-center gap-[var(--spacing-1-5)] text-[length:var(--font-size-xs)] font-[var(--font-weight-medium)] text-text-secondary hover:text-text-primary transition-colors",children:[e.jsx("span",{className:"inline-block w-[5px] h-[5px] rounded-full bg-accent-blue animate-pulse"}),"Commander Recommendations (",d.length,")",e.jsx("svg",{className:`w-3 h-3 transition-transform duration-150 ${n?"":"rotate-180"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]})}),!n&&e.jsx("div",{className:"flex flex-wrap gap-[var(--spacing-2)] px-[var(--spacing-4)] pb-[var(--spacing-2)]",children:d.map(l=>{const x=Rt[l.action.type]??{bg:"var(--color-bg-secondary)",text:"var(--color-text-secondary)"};return e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] py-[var(--spacing-1-5)] rounded-[var(--radius-md)] text-[length:var(--font-size-xs)]",style:{backgroundColor:x.bg},children:[e.jsx("span",{className:"font-[var(--font-weight-medium)]",style:{color:x.text},children:l.action.type.replace("_"," ")}),e.jsx("span",{className:"text-text-secondary truncate max-w-[200px]",title:l.action.target,children:l.action.target}),l.action.reason&&e.jsxs("span",{className:"text-text-tertiary truncate max-w-[150px]",title:l.action.reason,children:["— ",l.action.reason]}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)] ml-auto",children:[l.action.type==="execute_issue"&&e.jsx("button",{type:"button",onClick:()=>c(l),className:"text-[10px] font-[var(--font-weight-medium)] px-[var(--spacing-2)] py-[var(--spacing-0-5)] rounded-full transition-colors",style:{backgroundColor:"rgba(90, 158, 120, 0.15)",color:"#5A9E78"},children:"Approve"}),e.jsx("button",{type:"button",onClick:()=>i(l),className:"text-[10px] text-text-tertiary hover:text-text-secondary transition-colors px-1",children:"x"})]})]},`${l.decisionId}-${l.action.type}-${l.action.target}`)})})]})}const Ce=[{value:"bug",label:"Bug",color:"#C46555"},{value:"feature",label:"Feature",color:"#5B8DB8"},{value:"improvement",label:"Improve",color:"#9178B5"},{value:"task",label:"Task",color:"#A09D97"}],Se=[{value:"urgent",label:"Urgent",color:"#C46555"},{value:"high",label:"High",color:"#B89540"},{value:"medium",label:"Medium",color:"#5B8DB8"},{value:"low",label:"Low",color:"#A09D97"}];function ve({type:t,setType:a,priority:r,setPriority:n,dark:o}){const d=o?"20":"18",c=o?"35":"28";return e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[Ce.map(i=>e.jsx("button",{type:"button",onClick:()=>a(i.value),className:"text-[10px] font-medium px-2 py-[2px] rounded-full transition-all duration-100",style:{background:`${i.color}${t===i.value?c:d}`,color:i.color,outline:t===i.value?`1.5px solid ${i.color}70`:"none"},children:i.label},i.value)),e.jsx("div",{className:"w-px h-3",style:{backgroundColor:o?"rgba(255,255,255,0.12)":"var(--color-border-divider)"}}),Se.map(i=>e.jsx("button",{type:"button",onClick:()=>n(i.value),className:"text-[10px] font-medium px-2 py-[2px] rounded-full transition-all duration-100",style:{background:`${i.color}${r===i.value?c:d}`,color:i.color,outline:r===i.value?`1.5px solid ${i.color}70`:"none"},children:i.label},i.value))]})}function Mt({open:t,columnId:a,style:r,onClose:n,onCreated:o}){const[d,c]=p.useState(""),[i,l]=p.useState(""),[x,h]=p.useState("task"),[g,m]=p.useState("medium"),[y,k]=p.useState(!1),N=p.useRef(null),u=p.useRef(null),b=O(s=>s.createIssue);p.useEffect(()=>{t&&(c(""),l(""),h("task"),m("medium"),requestAnimationFrame(()=>{var s;return(s=N.current)==null?void 0:s.focus()}))},[t]),p.useEffect(()=>{function s(S){S.key==="Escape"&&n()}return t&&window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,n]);const C=p.useCallback(async()=>{const s=d.trim();!s||y||(k(!0),await b({title:s,description:i.trim(),type:x,priority:g}),k(!1),o==null||o(),n())},[d,i,x,g,y,b,o,n]);function v(s){s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&C()}return t?r===1?e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[13vh]",style:{backgroundColor:"rgba(0,0,0,0.75)",backdropFilter:"blur(3px)"},onClick:n,children:e.jsxs("div",{className:"w-full max-w-[540px] mx-4 rounded-[14px] overflow-hidden motion-safe:animate-[modal-enter_150ms_ease-out_both]",style:{backgroundColor:"#1D1B18",boxShadow:"0 28px 90px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.07)",borderTop:"2.5px solid var(--color-accent-orange)"},onClick:s=>s.stopPropagation(),children:[e.jsx("div",{className:"px-5 pt-5 pb-3",children:e.jsx("input",{ref:N,value:d,onChange:s=>c(s.target.value),onKeyDown:s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),C()),v(s)},placeholder:"What needs to be done?",className:"w-full bg-transparent text-[length:var(--font-size-base)] font-medium outline-none",style:{color:"rgba(255,255,255,0.88)",caretColor:"var(--color-accent-orange)"}})}),e.jsx("div",{className:"px-5 pb-4 pt-3 border-t",style:{borderColor:"rgba(255,255,255,0.07)"},children:e.jsx(ve,{type:x,setType:h,priority:g,setPriority:m,dark:!0})}),e.jsxs("div",{className:"flex items-center justify-between px-5 py-2.5 border-t text-[10px]",style:{borderColor:"rgba(255,255,255,0.07)",color:"rgba(255,255,255,0.3)"},children:[e.jsxs("span",{children:[e.jsx("kbd",{className:"px-1 py-0.5 rounded font-mono text-[9px]",style:{backgroundColor:"rgba(255,255,255,0.08)"},children:"↵"})," ","create · "," ",e.jsx("kbd",{className:"px-1 py-0.5 rounded font-mono text-[9px]",style:{backgroundColor:"rgba(255,255,255,0.08)"},children:"Esc"})," ","cancel"]}),e.jsx("span",{className:"opacity-60",children:a})]})]})}):r===2?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",style:{backgroundColor:"rgba(0,0,0,0.44)"},onClick:n,children:e.jsxs("div",{className:"w-full max-w-[540px] rounded-[var(--radius-xl)] border overflow-hidden motion-safe:animate-[modal-enter_160ms_ease-out_both]",style:{backgroundColor:"var(--color-bg-card)",borderColor:"var(--color-border)",boxShadow:"var(--shadow-lg)"},onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b",style:{borderColor:"var(--color-border-divider)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:"New Issue"}),e.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full capitalize",style:{backgroundColor:"var(--color-bg-secondary)",color:"var(--color-text-tertiary)"},children:a.replace("-"," ")})]}),e.jsx("button",{type:"button",onClick:n,className:"w-6 h-6 flex items-center justify-center rounded text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors",children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[10px] font-semibold uppercase tracking-wider mb-1.5",style:{color:"var(--color-text-tertiary)"},children:["Title ",e.jsx("span",{style:{color:"var(--color-accent-red)"},children:"*"})]}),e.jsx("input",{ref:N,value:d,onChange:s=>c(s.target.value),onKeyDown:v,placeholder:"Issue title...",className:"w-full px-3 py-2 rounded-[var(--radius-default)] border text-[length:var(--font-size-sm)] text-text-primary placeholder:text-text-placeholder bg-transparent outline-none transition-colors",style:{borderColor:"var(--color-border)"},onFocus:s=>{s.target.style.borderColor="var(--color-accent-blue)"},onBlur:s=>{s.target.style.borderColor="var(--color-border)"}})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-wider mb-1.5",style:{color:"var(--color-text-tertiary)"},children:"Description"}),e.jsx("textarea",{ref:u,value:i,onChange:s=>l(s.target.value),onKeyDown:v,placeholder:"Optional description...",rows:3,className:"w-full px-3 py-2 rounded-[var(--radius-default)] border text-[length:var(--font-size-sm)] text-text-primary placeholder:text-text-placeholder bg-transparent outline-none resize-none transition-colors",style:{borderColor:"var(--color-border)"},onFocus:s=>{s.target.style.borderColor="var(--color-accent-blue)"},onBlur:s=>{s.target.style.borderColor="var(--color-border)"}})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--color-text-tertiary)"},children:"Type"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:Ce.map(s=>e.jsx("button",{type:"button",onClick:()=>h(s.value),className:"text-[11px] font-medium px-3 py-1 rounded-[var(--radius-default)] transition-all",style:{background:x===s.value?`${s.color}25`:"var(--color-bg-secondary)",color:x===s.value?s.color:"var(--color-text-secondary)",outline:x===s.value?`1.5px solid ${s.color}55`:"none"},children:s.label},s.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--color-text-tertiary)"},children:"Priority"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:Se.map(s=>e.jsx("button",{type:"button",onClick:()=>m(s.value),className:"text-[11px] font-medium px-3 py-1 rounded-[var(--radius-default)] transition-all",style:{background:g===s.value?`${s.color}25`:"var(--color-bg-secondary)",color:g===s.value?s.color:"var(--color-text-secondary)",outline:g===s.value?`1.5px solid ${s.color}55`:"none"},children:s.label},s.value))})]})]}),e.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-t",style:{borderColor:"var(--color-border-divider)"},children:[e.jsxs("span",{className:"text-[10px]",style:{color:"var(--color-text-tertiary)"},children:[e.jsx("kbd",{className:"px-1 py-0.5 rounded font-mono text-[9px]",style:{backgroundColor:"var(--color-bg-secondary)"},children:"⌘↵"})," ","to create"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:n,className:"px-4 py-1.5 rounded-[var(--radius-default)] text-[length:var(--font-size-xs)] border transition-colors hover:bg-bg-hover",style:{borderColor:"var(--color-border)",color:"var(--color-text-secondary)"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:()=>void C(),disabled:!d.trim()||y,className:"px-4 py-1.5 rounded-[var(--radius-default)] text-[length:var(--font-size-xs)] text-white font-medium transition-all disabled:opacity-40",style:{backgroundColor:"var(--color-accent-orange)"},children:y?"Creating…":"Create Issue"})]})]})]})}):e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backgroundColor:"var(--color-bg-primary)"},onClick:n,children:[e.jsxs("div",{className:"absolute top-5 right-6 flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void C(),disabled:!d.trim()||y,className:"px-4 py-1.5 rounded-[var(--radius-default)] text-[length:var(--font-size-xs)] text-white font-medium transition-all disabled:opacity-40",style:{backgroundColor:"var(--color-accent-orange)"},children:y?"Creating…":"Create"}),e.jsx("button",{type:"button",onClick:n,className:"w-8 h-8 flex items-center justify-center rounded text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsxs("div",{className:"w-full max-w-[720px] px-8 motion-safe:animate-[modal-enter_180ms_ease-out_both]",onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-4",style:{color:"var(--color-text-tertiary)"},children:["New Issue · ",a.replace("-"," ")]}),e.jsx("input",{ref:N,value:d,onChange:s=>c(s.target.value),onKeyDown:s=>{var S;s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),(S=u.current)==null||S.focus()),v(s)},placeholder:"Untitled issue",className:"w-full bg-transparent outline-none mb-5 leading-tight",style:{fontSize:"var(--font-size-2xl)",fontWeight:700,color:"var(--color-text-primary)",caretColor:"var(--color-accent-orange)"}}),e.jsx("textarea",{ref:u,value:i,onChange:s=>l(s.target.value),onKeyDown:v,placeholder:"Add a description… (optional)",rows:7,className:"w-full bg-transparent outline-none resize-none leading-relaxed mb-8",style:{fontSize:"var(--font-size-base)",color:"var(--color-text-secondary)",caretColor:"var(--color-accent-orange)"}}),e.jsxs("div",{className:"flex items-center gap-4 pt-4 border-t flex-wrap",style:{borderColor:"var(--color-border-divider)"},children:[e.jsx(ve,{type:x,setType:h,priority:g,setPriority:m}),e.jsxs("div",{className:"ml-auto text-[10px]",style:{color:"var(--color-text-tertiary)"},children:[e.jsx("kbd",{className:"px-1 py-0.5 rounded font-mono text-[9px]",style:{backgroundColor:"var(--color-bg-secondary)"},children:"⌘↵"})," ","to create"]})]})]})]}):null}const me={high:{color:"#5A9E78",bg:"#5A9E7820"},medium:{color:"#B89540",bg:"#B8954020"},low:{color:"#C46555",bg:"#C4655520"}};function Kt(t){return t>=.7?"high":t>=.4?"medium":"low"}function Ut({analysis:t}){const a=Kt(t.confidence),r=me[a]??me.low;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--color-text-tertiary)"},children:"Root Cause"}),e.jsx("p",{className:"leading-relaxed whitespace-pre-wrap",style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-secondary)"},children:t.root_cause})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--color-text-tertiary)"},children:"Impact"}),e.jsx("p",{className:"leading-relaxed whitespace-pre-wrap",style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-secondary)"},children:t.impact})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--color-text-tertiary)"},children:"Confidence"}),e.jsxs("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full",style:{backgroundColor:r.bg,color:r.color},children:[a," (",Math.round(t.confidence*100),"%)"]})]}),t.related_files.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--color-text-tertiary)"},children:"Related Files"}),e.jsx("ul",{className:"space-y-0.5",children:t.related_files.map((n,o)=>e.jsx("li",{className:"font-mono text-[11px] truncate",style:{color:"var(--color-text-secondary)"},children:n},o))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--color-text-tertiary)"},children:"Suggested Approach"}),e.jsx("p",{className:"leading-relaxed whitespace-pre-wrap",style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-secondary)"},children:t.suggested_approach})]}),e.jsxs("div",{className:"text-[10px] pt-1",style:{color:"var(--color-text-tertiary)"},children:["Analyzed by ",t.analyzed_by," at ",new Date(t.analyzed_at).toLocaleString()]})]})}function Ft({solution:t}){return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left",style:{fontSize:"var(--font-size-xs)"},children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--color-text-tertiary)"},children:[e.jsx("th",{className:"py-1 pr-2 w-6",children:"#"}),e.jsx("th",{className:"py-1 pr-2",children:"Target"}),e.jsx("th",{className:"py-1 pr-2",children:"Description"}),e.jsx("th",{className:"py-1",children:"Verification"})]})}),e.jsx("tbody",{children:t.steps.map((a,r)=>e.jsxs("tr",{className:"border-t",style:{borderColor:"var(--color-border-divider)"},children:[e.jsx("td",{className:"py-1.5 pr-2 font-mono",style:{color:"var(--color-text-tertiary)"},children:r+1}),e.jsx("td",{className:"py-1.5 pr-2 font-mono truncate max-w-[120px]",style:{color:"var(--color-text-secondary)"},title:a.target,children:a.target??"-"}),e.jsx("td",{className:"py-1.5 pr-2",style:{color:"var(--color-text-secondary)"},children:a.description}),e.jsx("td",{className:"py-1.5",style:{color:"var(--color-text-tertiary)"},children:a.verification??"-"})]},r))})]})}),t.context&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--color-text-tertiary)"},children:"Context"}),e.jsx("p",{className:"leading-relaxed whitespace-pre-wrap",style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-secondary)"},children:t.context})]}),t.planned_by&&e.jsxs("div",{className:"text-[10px] pt-1",style:{color:"var(--color-text-tertiary)"},children:["Planned by ",t.planned_by,t.planned_at&&` at ${new Date(t.planned_at).toLocaleString()}`]})]})}const Ht={idle:"#A09D97",queued:"#5B8DB8",running:"#B89540",completed:"#5A9E78",failed:"#C46555",retrying:"#B89540"};function Wt({execution:t}){const a=Ht[t.status]??"#A09D97",r=t.result;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:a}}),e.jsx("span",{className:"text-[11px] font-medium capitalize",style:{color:"var(--color-text-primary)"},children:t.status})]}),r&&e.jsxs(e.Fragment,{children:[r.summary&&e.jsx("p",{className:"leading-relaxed whitespace-pre-wrap",style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-secondary)"},children:r.summary}),e.jsxs("div",{className:"flex flex-wrap gap-3",style:{fontSize:"var(--font-size-xs)"},children:[r.commitHash&&e.jsxs("div",{style:{color:"var(--color-text-secondary)"},children:[e.jsx("span",{style:{color:"var(--color-text-tertiary)"},children:"Commit: "}),e.jsx("span",{className:"font-mono",children:r.commitHash.slice(0,8)})]}),r.prUrl&&e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--color-text-tertiary)"},children:"PR: "}),e.jsx("a",{href:r.prUrl,target:"_blank",rel:"noopener noreferrer",className:"underline",style:{color:"var(--color-accent-blue)"},children:r.prUrl.replace(/^https?:\/\/[^/]+/,"")})]}),r.filesChanged!=null&&e.jsxs("div",{style:{color:"var(--color-text-secondary)"},children:[e.jsx("span",{style:{color:"var(--color-text-tertiary)"},children:"Files: "}),r.filesChanged]})]})]})]})}const Vt={bug:"#C46555",feature:"#5B8DB8",improvement:"#9178B5",task:"#A09D97"},Yt={urgent:"#C46555",high:"#B89540",medium:"#5B8DB8",low:"#A09D97"},qt={idle:"#A09D97",queued:"#5B8DB8",running:"#B89540",completed:"#5A9E78",failed:"#C46555",retrying:"#B89540"};function Q(){return e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function _({label:t,color:a,bg:r}){return e.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full",style:{backgroundColor:r,color:a},children:t})}function w({label:t,children:a}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-1.5",style:{color:"var(--color-text-tertiary)"},children:t}),a]})}const Gt=[{value:"gemini",label:"Gemini"},{value:"qwen",label:"Qwen"}],Xt=[{value:"standard",label:"Standard"},{value:"deep",label:"Deep"}];function Qt({issue:t}){var r;const a=[{label:"Analyze",done:!!t.analysis},{label:"Plan",done:!!t.solution&&t.solution.steps.length>0},{label:"Execute",done:!!((r=t.execution)!=null&&r.result)}];return e.jsx("div",{className:"flex items-center gap-1 mb-2.5",children:a.map((n,o)=>e.jsxs("div",{className:"flex items-center gap-1",children:[o>0&&e.jsx("div",{className:"w-6 h-px",style:{backgroundColor:n.done||a[o-1].done?"var(--color-accent-blue)":"var(--color-border)"}}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex items-center justify-center text-[7px]",style:{backgroundColor:n.done?"var(--color-accent-blue)":"transparent",border:n.done?"none":"1.5px solid var(--color-border)",color:n.done?"white":"var(--color-text-tertiary)"},children:n.done?"✓":""}),e.jsx("span",{className:"text-[9px]",style:{color:n.done?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:n.label})]})]},n.label))})}function J({issue:t}){const a=$e(),[r,n]=p.useState("gemini"),[o,d]=p.useState("standard"),c=P(t);if(c!=="open"&&c!=="analyzing"&&c!=="planned")return null;const i=h=>{R(h),a("/chat")},l=t.solution&&t.solution.steps.length>0?"Execute":t.analysis?"Continue":"Run Pipeline",x=t.analysis?t.solution?{label:"Execute",onClick:()=>i({action:"execute:issue",issueId:t.id})}:{label:"Plan",onClick:()=>i({action:"issue:plan",issueId:t.id,tool:r})}:{label:"Analyze",onClick:()=>i({action:"issue:analyze",issueId:t.id,tool:r,depth:o})};return e.jsxs("div",{children:[e.jsx(Qt,{issue:t}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("select",{value:r,onChange:h=>n(h.target.value),className:"text-[10px] px-1.5 py-1 rounded border cursor-pointer",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-primary)",color:"var(--color-text-tertiary)"},children:Gt.map(h=>e.jsx("option",{value:h.value,children:h.label},h.value))}),e.jsx("select",{value:o,onChange:h=>d(h.target.value),className:"text-[10px] px-1.5 py-1 rounded border cursor-pointer",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-primary)",color:"var(--color-text-tertiary)"},children:Xt.map(h=>e.jsx("option",{value:h.value,children:h.label},h.value))}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{type:"button",onClick:x.onClick,className:"text-[11px] font-medium px-3.5 py-1.5 rounded-md transition-colors hover:opacity-90 border",style:{borderColor:"var(--color-border)",color:"var(--color-text-secondary)",backgroundColor:"transparent"},children:x.label}),e.jsx("button",{type:"button",onClick:()=>i({action:"issue:pipeline",issueId:t.id,tool:r}),className:"text-[11px] font-medium px-3.5 py-1.5 rounded-md transition-colors hover:opacity-90",style:{backgroundColor:"var(--color-accent-blue)",color:"white"},children:l})]})]})}function Z({issue:t}){return e.jsxs(e.Fragment,{children:[t.analysis&&e.jsx(w,{label:"Analysis",children:e.jsx(Ut,{analysis:t.analysis})}),t.solution&&e.jsx(w,{label:"Solution",children:e.jsx(Ft,{solution:t.solution})}),t.execution&&t.execution.result&&e.jsx(w,{label:"Execution Result",children:e.jsx(Wt,{execution:t.execution})})]})}function Jt({issue:t,style:a,onClose:r}){var c,i;const n=Vt[t.type]??"#A09D97",o=Yt[t.priority]??"#A09D97",d=t.execution?qt[t.execution.status]??"#A09D97":"#A09D97";return p.useEffect(()=>{function l(x){x.key==="Escape"&&r()}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[r]),a===1?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[60]",style:{backgroundColor:"rgba(0,0,0,0.22)"},onClick:r}),e.jsxs("div",{className:"fixed right-0 top-0 bottom-0 z-[70] w-[400px] flex flex-col overflow-hidden motion-safe:animate-[slide-in-right_180ms_ease-out_both]",style:{backgroundColor:"var(--color-bg-card)",borderLeft:"1px solid var(--color-border)",boxShadow:"var(--shadow-lg)"},children:[e.jsxs("div",{className:"shrink-0 flex items-center justify-between px-5 py-3 border-b",style:{borderColor:"var(--color-border-divider)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--color-text-tertiary)"},children:t.id.slice(0,14)}),e.jsx(_,{label:t.type,color:n,bg:`${n}20`}),e.jsx(_,{label:t.priority,color:o,bg:`${o}20`})]}),e.jsx("button",{type:"button",onClick:r,className:"w-7 h-7 flex items-center justify-center rounded text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors",children:e.jsx(Q,{})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-5 space-y-5",children:[e.jsx("h2",{className:"font-bold leading-snug",style:{fontSize:"var(--font-size-lg)",color:"var(--color-text-primary)"},children:t.title}),e.jsx(w,{label:"Status",children:(()=>{const l=P(t),x=$[l];return e.jsx("span",{className:"text-[11px] font-medium px-2.5 py-1 rounded-full",style:{backgroundColor:`${x}20`,color:x},children:l.replace("_"," ")})})()}),t.executor&&e.jsx(w,{label:"Executor",children:e.jsx("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-secondary)"},children:t.executor})}),t.description&&e.jsx(w,{label:"Description",children:e.jsx("p",{className:"leading-relaxed whitespace-pre-wrap",style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-secondary)"},children:t.description})}),e.jsx(Z,{issue:t}),t.execution&&t.execution.status!=="idle"&&e.jsx(w,{label:"Execution",children:e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:d}}),e.jsx("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-primary)"},children:t.execution.status}),t.execution.retryCount>0&&e.jsxs("span",{style:{fontSize:"var(--font-size-xs)",color:"var(--color-text-tertiary)"},children:["(x",t.execution.retryCount,")"]})]}),t.execution.lastError&&e.jsx("div",{className:"rounded px-2.5 py-2",style:{fontSize:"var(--font-size-xs)",color:"#C46555",backgroundColor:"#C4655510",border:"1px solid #C4655530"},children:t.execution.lastError})]})}),e.jsx(w,{label:"Activity",children:e.jsxs("div",{className:"space-y-1",style:{fontSize:"var(--font-size-xs)",color:"var(--color-text-secondary)"},children:[e.jsxs("div",{children:["Created ",E(t.created_at)]}),e.jsxs("div",{children:["Updated ",E(t.updated_at)]})]})})]}),e.jsx("div",{className:"shrink-0 px-5 py-3",style:{borderTop:"1px solid var(--color-border-divider)"},children:e.jsx(J,{issue:t})})]})]}):a===2?e.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-6",style:{backgroundColor:"rgba(0,0,0,0.52)"},onClick:r,children:e.jsxs("div",{className:"w-full max-w-[880px] rounded-[var(--radius-xl)] border overflow-hidden flex max-h-[86vh] motion-safe:animate-[modal-enter_180ms_ease-out_both]",style:{backgroundColor:"var(--color-bg-card)",borderColor:"var(--color-border)",boxShadow:"var(--shadow-lg)"},onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden border-r",style:{borderColor:"var(--color-border-divider)"},children:[e.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-3.5 border-b",style:{borderColor:"var(--color-border-divider)"},children:[e.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--color-text-tertiary)"},children:t.id}),e.jsx("button",{type:"button",onClick:r,className:"w-7 h-7 flex items-center justify-center rounded text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors",children:e.jsx(Q,{})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(_,{label:t.type,color:n,bg:`${n}20`}),e.jsx(_,{label:t.priority,color:o,bg:`${o}20`}),(()=>{const l=P(t),x=$[l];return e.jsx(_,{label:l.replace("_"," "),color:x,bg:`${x}20`})})()]}),e.jsx("h2",{className:"font-bold leading-snug mb-5",style:{fontSize:"var(--font-size-xl)",color:"var(--color-text-primary)"},children:t.title}),t.description?e.jsx("p",{className:"leading-relaxed whitespace-pre-wrap",style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-secondary)"},children:t.description}):e.jsx("p",{className:"italic",style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-placeholder)"},children:"No description provided."}),((c=t.execution)==null?void 0:c.lastError)&&e.jsxs("div",{className:"mt-5 rounded-[var(--radius-md)] p-3",style:{backgroundColor:"#C4655510",border:"1px solid #C4655330"},children:[e.jsx("div",{className:"font-semibold mb-1",style:{fontSize:"var(--font-size-xs)",color:"#C46555"},children:"Execution Error"}),e.jsx("div",{className:"whitespace-pre-wrap",style:{fontSize:"var(--font-size-xs)",color:"var(--color-text-secondary)"},children:t.execution.lastError})]}),e.jsx("div",{className:"mt-5 space-y-5",children:e.jsx(Z,{issue:t})})]})]}),e.jsx("div",{className:"shrink-0 px-6 py-3",style:{borderTop:"1px solid var(--color-border-divider)"},children:e.jsx(J,{issue:t})}),e.jsxs("div",{className:"w-[270px] shrink-0 overflow-y-auto px-5 py-5 space-y-5",style:{backgroundColor:"var(--color-bg-secondary)"},children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--color-text-tertiary)"},children:"Properties"}),e.jsx(w,{label:"Type",children:e.jsx(_,{label:t.type,color:n,bg:`${n}25`})}),e.jsx(w,{label:"Priority",children:e.jsx(_,{label:t.priority,color:o,bg:`${o}25`})}),e.jsx(w,{label:"Status",children:(()=>{const l=P(t),x=$[l];return e.jsx("span",{className:"text-[11px] font-medium px-2.5 py-1 rounded-full",style:{backgroundColor:`${x}20`,color:x},children:l.replace("_"," ")})})()}),t.executor&&e.jsx(w,{label:"Executor",children:e.jsx("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-secondary)"},children:t.executor})}),t.execution&&t.execution.status!=="idle"&&e.jsxs(w,{label:"Execution",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d}}),e.jsxs("span",{style:{fontSize:"var(--font-size-xs)",color:"var(--color-text-secondary)"},children:[t.execution.status,t.execution.retryCount>0&&` (x${t.execution.retryCount})`]})]}),t.execution.startedAt&&e.jsxs("div",{style:{fontSize:"10px",color:"var(--color-text-tertiary)"},children:["Started ",E(t.execution.startedAt)]})]}),e.jsxs("div",{className:"pt-3 border-t space-y-3",style:{borderColor:"var(--color-border-divider)"},children:[e.jsx(w,{label:"Created",children:e.jsx("span",{style:{fontSize:"11px",color:"var(--color-text-secondary)"},children:E(t.created_at)})}),e.jsx(w,{label:"Updated",children:e.jsx("span",{style:{fontSize:"11px",color:"var(--color-text-secondary)"},children:E(t.updated_at)})})]})]})]})}):e.jsxs("div",{className:"fixed inset-0 z-[60] flex flex-col motion-safe:animate-[slide-up_220ms_ease-out_both]",style:{backgroundColor:"var(--color-bg-primary)"},children:[e.jsxs("div",{className:"shrink-0 flex items-center justify-between px-6 py-2.5 border-b",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-card)"},children:[e.jsxs("nav",{className:"flex items-center gap-1.5",style:{fontSize:"var(--font-size-xs)",color:"var(--color-text-tertiary)"},children:[e.jsx("span",{children:"Kanban"}),e.jsx("span",{children:"›"}),e.jsx("span",{children:"Issues"}),e.jsx("span",{children:"›"}),e.jsx("span",{className:"font-medium truncate max-w-[360px]",style:{color:"var(--color-text-primary)"},children:t.title})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{label:t.type,color:n,bg:`${n}20`}),e.jsx(_,{label:t.priority,color:o,bg:`${o}20`}),(()=>{const l=P(t),x=$[l];return e.jsx(_,{label:l.replace("_"," "),color:x,bg:`${x}20`})})(),e.jsxs("button",{type:"button",onClick:r,className:"ml-2 flex items-center gap-1.5 px-3 py-1.5 rounded-[var(--radius-default)] border text-text-secondary hover:text-text-primary hover:bg-bg-hover transition-colors",style:{borderColor:"var(--color-border)",fontSize:"var(--font-size-xs)"},children:[e.jsx(Q,{}),"Close"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"flex-1 overflow-y-auto px-12 py-10",children:e.jsxs("div",{className:"max-w-[740px] mx-auto",children:[e.jsx("div",{className:"font-mono mb-4",style:{fontSize:"10px",color:"var(--color-text-tertiary)"},children:t.id}),e.jsx("h1",{className:"font-bold leading-tight mb-6",style:{fontSize:"var(--font-size-2xl)",color:"var(--color-text-primary)"},children:t.title}),t.description?e.jsx("div",{className:"leading-relaxed whitespace-pre-wrap",style:{fontSize:"var(--font-size-base)",color:"var(--color-text-secondary)"},children:t.description}):e.jsx("div",{className:"italic",style:{fontSize:"var(--font-size-base)",color:"var(--color-text-placeholder)"},children:"No description provided."}),((i=t.execution)==null?void 0:i.lastError)&&e.jsxs("div",{className:"mt-8 rounded-[var(--radius-md)] p-5",style:{backgroundColor:"#C4655510",border:"1px solid #C4655330"},children:[e.jsx("div",{className:"font-semibold mb-2",style:{fontSize:"var(--font-size-sm)",color:"#C46555"},children:"Execution Error"}),e.jsx("pre",{className:"whitespace-pre-wrap leading-relaxed",style:{fontSize:"var(--font-size-xs)",color:"var(--color-text-secondary)",fontFamily:"var(--font-mono)"},children:t.execution.lastError})]}),e.jsx("div",{className:"mt-8 space-y-6",children:e.jsx(Z,{issue:t})})]})}),e.jsx("div",{className:"shrink-0 px-12 py-3",style:{borderTop:"1px solid var(--color-border-divider)"},children:e.jsx("div",{className:"max-w-[740px] mx-auto",children:e.jsx(J,{issue:t})})})]}),e.jsxs("div",{className:"w-[280px] shrink-0 border-l overflow-y-auto px-6 py-8 space-y-6",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-secondary)"},children:[e.jsx(w,{label:"Type",children:e.jsx(_,{label:t.type,color:n,bg:`${n}20`})}),e.jsx(w,{label:"Priority",children:e.jsx(_,{label:t.priority,color:o,bg:`${o}20`})}),e.jsx(w,{label:"Status",children:(()=>{const l=P(t),x=$[l];return e.jsx("span",{className:"text-[11px] font-medium px-2.5 py-1 rounded-full",style:{backgroundColor:`${x}20`,color:x},children:l.replace("_"," ")})})()}),t.executor&&e.jsx(w,{label:"Executor",children:e.jsx("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-primary)"},children:t.executor})}),t.execution&&t.execution.status!=="idle"&&e.jsx(w,{label:"Execution",children:e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:d}}),e.jsx("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--color-text-primary)"},children:t.execution.status})]}),t.execution.retryCount>0&&e.jsxs("div",{style:{fontSize:"10px",color:"var(--color-text-tertiary)"},children:[t.execution.retryCount," retry attempt",t.execution.retryCount>1?"s":""]}),t.execution.startedAt&&e.jsxs("div",{style:{fontSize:"10px",color:"var(--color-text-tertiary)"},children:["Started ",E(t.execution.startedAt)]}),t.execution.completedAt&&e.jsxs("div",{style:{fontSize:"10px",color:"var(--color-text-tertiary)"},children:["Completed ",E(t.execution.completedAt)]})]})}),e.jsxs("div",{className:"pt-4 border-t space-y-4",style:{borderColor:"var(--color-border-divider)"},children:[e.jsx(w,{label:"Created",children:e.jsx("span",{style:{fontSize:"11px",color:"var(--color-text-secondary)"},children:E(t.created_at)})}),e.jsx(w,{label:"Updated",children:e.jsx("span",{style:{fontSize:"11px",color:"var(--color-text-secondary)"},children:E(t.updated_at)})})]})]})]})]})}function E(t){const a=Date.now(),r=new Date(t).getTime(),n=a-r;if(n<0)return"just now";const o=Math.floor(n/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const d=Math.floor(o/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}const Zt=["All","Open","Registered","In Progress","Resolved","Deferred"],ge=["kanban","table","center"];function pr(){const[t,a]=p.useState("kanban"),[r,n]=p.useState("All"),[o,d]=p.useState(null),[c,i]=p.useState(!1),[l,x]=p.useState(!1),[h,g]=p.useState(!1),[m,y]=p.useState(null),[k,N]=p.useState(!1),[u,b]=p.useState("backlog"),[C,v]=p.useState(null),s=de(f=>f.createModalStyle),S=de(f=>f.detailModalStyle),{register:z,unregister:j}=p.useContext(Re),{issues:B,fetchIssues:H}=O(G(f=>({issues:f.issues,fetchIssues:f.fetchIssues}))),{selectedIssueIds:re,toggleSelect:ze,cliPanelIssueId:I,supervisorStatus:er}=D(G(f=>({selectedIssueIds:f.selectedIssueIds,toggleSelect:f.toggleSelect,cliPanelIssueId:f.cliPanelIssueId,supervisorStatus:f.supervisorStatus}))),_e=re.size>0,{configured:W,board:V,teams:Y,selectedTeamId:ae,loading:se,checkStatus:oe,fetchTeams:ne,selectTeam:Ee,refresh:Le}=K(G(f=>({configured:f.configured,board:f.board,teams:f.teams,selectedTeamId:f.selectedTeamId,loading:f.loading,checkStatus:f.checkStatus,fetchTeams:f.fetchTeams,selectTeam:f.selectTeam,refresh:f.refresh})));p.useEffect(()=>{H()},[H]),p.useEffect(()=>{oe()},[oe]),p.useEffect(()=>{W&&ne()},[W,ne]);const M=p.useMemo(()=>V?V.columns.flatMap(f=>f.issues):[],[V]),De=o!==null&&!I,le=p.useCallback(f=>{a(ge[f]??"kanban")},[]);p.useEffect(()=>{z({items:[{label:"Kanban",icon:e.jsx(Ie,{size:14}),shortcut:"K"},{label:"Table",icon:e.jsx(Fe,{size:14}),shortcut:"L"},{label:"Center",icon:e.jsx(Et,{size:14}),shortcut:"C"}],activeIndex:ge.indexOf(t),onSwitch:le})},[z,t,le]),p.useEffect(()=>()=>j(),[j]),p.useEffect(()=>{function f(A){A.target instanceof HTMLInputElement||A.target instanceof HTMLTextAreaElement||A.target instanceof HTMLSelectElement||A.key==="c"&&!A.metaKey&&!A.ctrlKey&&(b("backlog"),N(!0))}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[]);function q(f){if(f.type==="issue"){v(f.issue),d(null);return}const A=(o==null?void 0:o.type)===f.type&&f.type==="linearIssue"&&o.issue.id===f.issue.id;d(A?null:f)}function Be(f){b(f),N(!0)}function Ae(){d(null)}function ie(){H()}const Te=(o==null?void 0:o.type)==="linearIssue"?"Linear Issue":"Issue Detail";return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx(It,{}),e.jsx("div",{className:"px-[var(--spacing-4)] py-[var(--spacing-2)] border-b border-border-divider shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-[var(--spacing-3)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx(Xe,{chips:[...Zt],active:r,onSelect:n}),e.jsxs("button",{type:"button",onClick:()=>g(!h),className:["flex items-center gap-[var(--spacing-1)] px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)] text-[length:var(--font-size-xs)] transition-colors",h?"border-accent-blue text-accent-blue bg-[var(--color-accent-blue-10,rgba(90,130,200,0.1))]":"text-text-secondary hover:text-text-primary"].join(" "),style:h?void 0:{border:"var(--style-btn-secondary-border)",background:"var(--style-btn-secondary-bg)"},title:h?"Hide Done column":"Show Done column",children:[e.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Done"]})]}),W&&e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] shrink-0",children:[Y.length>0&&e.jsx("select",{value:ae??"",onChange:f=>Ee(f.target.value),className:"px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)] text-text-primary text-[length:var(--font-size-xs)]",style:{border:"var(--style-btn-secondary-border)",background:"var(--style-btn-secondary-bg)"},children:Y.map(f=>e.jsxs("option",{value:f.id,children:[f.key," — ",f.name]},f.id))}),e.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex items-center gap-[var(--spacing-1)] px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)] text-text-secondary hover:text-text-primary text-[length:var(--font-size-xs)] transition-colors",style:{border:"var(--style-btn-secondary-border)",background:"var(--style-btn-secondary-bg)"},title:"Import from Linear",children:[e.jsx(Ge,{size:12}),e.jsx("span",{children:"Import"})]}),e.jsxs("button",{type:"button",onClick:()=>x(!0),className:"flex items-center gap-[var(--spacing-1)] px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)] text-text-secondary hover:text-text-primary text-[length:var(--font-size-xs)] transition-colors",style:{border:"var(--style-btn-secondary-border)",background:"var(--style-btn-secondary-bg)"},title:"Export to Linear",children:[e.jsx(At,{size:12}),e.jsx("span",{children:"Export"})]}),e.jsx("button",{type:"button",onClick:()=>void Le(),disabled:se,className:"flex items-center justify-center w-7 h-7 rounded-[var(--radius-sm)] text-text-secondary hover:text-text-primary transition-colors disabled:opacity-50",style:{border:"var(--style-btn-secondary-border)",background:"var(--style-btn-secondary-bg)"},title:"Refresh Linear board",children:e.jsx(Dt,{size:12,className:se?"animate-spin":""})})]})]})}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex-1 overflow-auto min-w-0",children:[t==="kanban"&&e.jsx(vt,{linearIssues:M,localIssues:B,selectedItem:o,onSelectItem:q,composingColumnId:m,onStartCompose:Be,onStopCompose:()=>y(null),onIssueCreated:ie,showDone:h,batchMode:_e,selectedIssueIds:re,onToggleIssueCheck:ze}),t==="table"&&e.jsx(bt,{localIssues:B,linearIssues:M,selectedItem:o,onSelectItem:q}),t==="center"&&e.jsx(kt,{localIssues:B,linearIssues:M,selectedItem:o,onSelectItem:q})]}),I&&e.jsx(Pt,{}),!I&&e.jsx(He,{open:De,onClose:Ae,title:Te,children:o&&e.jsx(We,{selectedItem:o})})]}),e.jsx($t,{}),c&&e.jsx(St,{issues:M,onClose:()=>i(!1)}),l&&e.jsx(zt,{teams:Y,selectedTeamId:ae,onClose:()=>x(!1)}),e.jsx(Mt,{open:k,columnId:u,style:s,onClose:()=>N(!1),onCreated:ie}),C&&!I&&e.jsx(Jt,{issue:C,style:S,onClose:()=>v(null)})]})}export{pr as KanbanPage};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{d as g,Z as z,Y as y,j as e,_ as S,c as k,r as d,$ as u}from"./index-DWG-WrzT.js";import{C as f}from"./circle-CMrkbRNg.js";import{M as h}from"./minus-DYoN5UGk.js";import{A as w}from"./arrow-left-Bqtb2hle.js";import{C as j}from"./circle-check-big-TDSeWstm.js";/**
|
|
2
|
-
* @license lucide-react v0.577.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],C=g("circle-x",I);/**
|
|
7
|
-
* @license lucide-react v0.577.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const q=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],N=g("loader",q),p={open:"var(--color-text-tertiary)",registered:"var(--color-accent-blue)",in_progress:"var(--color-accent-blue)",resolved:"var(--color-accent-green)",closed:"var(--color-accent-green)",deferred:"var(--color-text-tertiary)"};function M({status:s}){switch(s){case"resolved":case"closed":return e.jsx(j,{size:14,style:{color:p[s]}});case"in_progress":return e.jsx(N,{size:14,className:"animate-spin",style:{color:p[s]}});case"open":case"registered":return e.jsx(f,{size:14,style:{color:p[s]}});case"deferred":default:return e.jsx(h,{size:14,style:{color:"var(--color-text-tertiary)"}})}}function R({issue:s}){const t={low:"bg-green-500/15 text-green-400",medium:"bg-yellow-500/15 text-yellow-400",high:"bg-orange-500/15 text-orange-400",urgent:"bg-red-500/15 text-red-400"};return e.jsxs("div",{className:"p-[var(--spacing-3)] rounded-[var(--radius-sm)] flex flex-col gap-[var(--spacing-2)]",style:{background:"var(--color-bg-secondary)",border:"1px solid var(--color-border)"},children:[e.jsxs("div",{className:"flex items-start gap-[var(--spacing-2)]",children:[e.jsx(M,{status:s.status}),e.jsx("span",{className:"flex-1 text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:s.title}),e.jsx("span",{className:"shrink-0 text-[length:var(--font-size-xs)] text-text-tertiary",children:s.type})]}),s.description&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] line-clamp-2",style:{color:"var(--color-text-secondary)"},children:s.description}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-[length:var(--font-size-xs)] ${t[s.priority]??""}`,children:s.priority}),e.jsx("span",{className:"text-[length:var(--font-size-xs)]",style:{color:"var(--color-text-secondary)"},children:s.status})]})]})}function b({status:s}){switch(s){case"running":return e.jsx(N,{size:14,className:"animate-spin",style:{color:"var(--color-accent-blue)"}});case"completed":return e.jsx(j,{size:14,style:{color:"var(--color-accent-green)"}});case"failed":return e.jsx(C,{size:14,style:{color:"var(--color-accent-red)"}});case"skipped":return e.jsx(h,{size:14,style:{color:"var(--color-text-tertiary)"}});case"pending":default:return e.jsx(f,{size:14,style:{color:"var(--color-text-tertiary)"}})}}function _({step:s,isSelected:t,onSelect:l}){return e.jsxs("button",{type:"button",onClick:l,className:"w-full flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] py-[var(--spacing-2)] rounded-[var(--radius-sm)] text-left transition-colors",style:{background:t?"var(--color-bg-tertiary)":"transparent"},children:[e.jsx(b,{status:s.status}),e.jsxs("span",{className:"flex-1 text-[length:var(--font-size-sm)] truncate",style:{color:"var(--color-text-primary)"},children:[s.cmd,s.args?` ${s.args}`:""]}),s.summary&&e.jsx("span",{className:"text-[length:var(--font-size-xs)] shrink-0",style:{color:"var(--color-text-secondary)"},children:s.summary})]})}function $({issueIds:s}){const{issues:t,fetchIssues:l,loading:n}=k();d.useEffect(()=>{l()},[l]);const c=d.useMemo(()=>t.filter(a=>s.includes(a.id)),[t,s]),i=d.useMemo(()=>{const a={};for(const o of c)a[o.status]=(a[o.status]??0)+1;return a},[c]);return n&&c.length===0?e.jsx("div",{className:"flex items-center justify-center py-[var(--spacing-8)]",style:{color:"var(--color-text-tertiary)"},children:"Loading issues..."}):e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-4)] p-[var(--spacing-4)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-4)]",children:[e.jsxs("span",{className:"text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:[c.length," Issues"]}),Object.entries(i).map(([a,o])=>e.jsxs("span",{className:"text-[length:var(--font-size-xs)]",style:{color:"var(--color-text-secondary)"},children:[a,": ",o]},a))]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-[var(--spacing-3)]",children:c.map(a=>e.jsx(R,{issue:a},a.id))}),c.length===0&&e.jsx("div",{className:"text-[length:var(--font-size-sm)] text-center py-[var(--spacing-8)]",style:{color:"var(--color-text-tertiary)"},children:"No issues found for this requirement."})]})}function B({sessionId:s}){const t=u(r=>r.session),l=u(r=>r.selectStep);u(r=>r.selectedStepIndex);const[n,c]=d.useState(null),i=(t==null?void 0:t.sessionId)===s,a=i?t.steps:[],o=d.useMemo(()=>n!=null?a.find(r=>r.index===n)??null:null,[a,n]),v=d.useCallback(r=>{c(m=>m===r?null:r),i&&l(r)},[i,l]),x=d.useMemo(()=>{const r={completed:0,running:0,failed:0,pending:0,skipped:0};for(const m of a)r[m.status]=(r[m.status]??0)+1;return r},[a]);return i?e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-[280px] shrink-0 flex flex-col overflow-y-auto",style:{borderRight:"1px solid var(--color-border)"},children:[e.jsxs("div",{className:"px-[var(--spacing-4)] py-[var(--spacing-3)] shrink-0",style:{borderBottom:"1px solid var(--color-border)"},children:[e.jsx("div",{className:"text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:t.chainName??"Session Steps"}),e.jsxs("div",{className:"text-[length:var(--font-size-xs)] mt-[var(--spacing-1)]",style:{color:"var(--color-text-secondary)"},children:["Step ",t.currentStep+1," / ",a.length||"?"," | ",x.completed," done",x.failed>0&&`, ${x.failed} failed`,t.avgQuality!=null&&` | Quality: ${t.avgQuality}`]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-2)]",children:a.map(r=>e.jsx(_,{step:r,isSelected:n===r.index,onSelect:()=>v(r.index)},r.index))})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-4)]",children:o?e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-3)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx(b,{status:o.status}),e.jsx("span",{className:"text-[length:var(--font-size-base)] font-medium",style:{color:"var(--color-text-primary)"},children:o.cmd}),o.args&&e.jsx("span",{className:"text-[length:var(--font-size-sm)]",style:{color:"var(--color-text-secondary)"},children:o.args})]}),o.summary&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] font-medium mb-[var(--spacing-1)]",style:{color:"var(--color-text-secondary)"},children:"Summary"}),e.jsx("div",{className:"text-[length:var(--font-size-sm)] rounded-[var(--radius-sm)] p-[var(--spacing-3)]",style:{color:"var(--color-text-primary)",background:"var(--color-bg-secondary)"},children:o.summary})]}),o.analysis&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] font-medium mb-[var(--spacing-1)]",style:{color:"var(--color-text-secondary)"},children:"Analysis"}),e.jsx("pre",{className:"text-[length:var(--font-size-xs)] rounded-[var(--radius-sm)] p-[var(--spacing-3)] overflow-x-auto whitespace-pre-wrap",style:{color:"var(--color-text-primary)",background:"var(--color-bg-secondary)"},children:o.analysis})]})]}):e.jsx("div",{className:"text-[length:var(--font-size-sm)] text-center py-[var(--spacing-6)]",style:{color:"var(--color-text-tertiary)"},children:"Select a step to view details"})})]}):e.jsx("div",{className:"flex items-center justify-center py-[var(--spacing-8)]",style:{color:"var(--color-text-tertiary)"},children:e.jsxs("span",{className:"text-[length:var(--font-size-sm)]",children:["Coordinate session not active. Session: ",s]})})}function P(){const{id:s}=z(),t=y(r=>r.currentRequirement),l=y(r=>r.committedResult),n=l!=null&&l.requirementId===s,c=n?l.mode:null,i=n?l.issueIds??[]:[],a=n?l.coordinateSessionId??"":"",o=t!=null&&t.id===s,v=o?t.title:`Requirement ${s??""}`,x=o?t.summary:null;return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 flex items-center gap-[var(--spacing-3)] px-[var(--spacing-4)] py-[var(--spacing-3)]",style:{borderBottom:"1px solid var(--color-border)"},children:[e.jsx("a",{href:"/requirement",className:"flex items-center justify-center w-7 h-7 rounded-[var(--radius-sm)] transition-colors",style:{color:"var(--color-text-secondary)"},title:"Back to Requirements",children:e.jsx(w,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-[length:var(--font-size-base)] font-semibold truncate",style:{color:"var(--color-text-primary)"},children:v}),x&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] truncate mt-[var(--spacing-0-5)]",style:{color:"var(--color-text-secondary)"},children:x})]}),c&&e.jsx("span",{className:"shrink-0 px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)] text-[length:var(--font-size-xs)] font-medium",style:{background:c==="issues"?"var(--color-accent-blue)":"var(--color-accent-green)",color:"#fff"},children:c==="issues"?"Issues":"Coordinate"})]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[!c&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--color-text-tertiary)"},children:e.jsx("span",{className:"text-[length:var(--font-size-sm)]",children:"No board data available for this requirement."})}),c==="issues"&&e.jsx($,{issueIds:i}),c==="coordinate"&&e.jsx(B,{sessionId:a})]}),e.jsx(S,{})]})}export{P as RequirementBoardPage};
|