ompchamber 0.8.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/static/css/{index.5c0447cefe.css → index.e880517fcd.css} +1 -1
- package/dist/client/static/js/async/g.a06ca3b3e9.js +2 -0
- package/dist/client/static/js/async/{m.0896dab823.js → m.c038c71b9f.js} +2 -2
- package/dist/client/static/js/async/ms.98960af4eb.js +67 -0
- package/dist/client/static/js/async/ms.98960af4eb.js.LICENSE.txt +12 -0
- package/dist/client/static/js/async/ot.84c71b308f.js +2 -0
- package/dist/client/static/js/async/{x4.69ec69c61b.js.LICENSE.txt → ot.84c71b308f.js.LICENSE.txt} +5 -0
- package/dist/client/static/js/{index.dc5f5fabe8.js → index.0de15c5e17.js} +10 -10
- package/package.json +2 -1
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +1 -1
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +1 -1
- package/src/client/components/layout/session-sidebar/SessionList.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/List.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +11 -4
- package/src/client/components/workspace/chat-timeline/QueueList.tsx +18 -14
- package/src/client/components/workspace/chat-timeline/index.tsx +4 -2
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +2 -2
- package/src/client/components/workspace/git-panel/index.tsx +5 -1
- package/src/client/components/workspace/terminal-panel/Header.tsx +51 -19
- package/src/client/components/workspace/terminal-panel/RealtimeXtermView.tsx +86 -282
- package/src/client/components/workspace/terminal-panel/index.tsx +76 -50
- package/src/client/components/workspace/terminal-panel/mount.ts +275 -0
- package/src/client/data/theme/terminal.ts +27 -29
- package/src/client/hooks/chat/omp/session-list.tsx +19 -2
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +1 -1
- package/src/client/hooks/chat/timeline/actions.ts +23 -25
- package/src/client/hooks/chat/timeline/index.ts +12 -20
- package/src/client/hooks/chat/timeline/queue.ts +110 -46
- package/src/client/hooks/workspace/terminal/index.ts +217 -0
- package/src/client/hooks/workspace/terminal/socket.ts +227 -0
- package/src/server/db.server.ts +19 -0
- package/src/server/lib/fs/git-sync.ts +191 -0
- package/src/server/lib/omp/rpc/manager.ts +58 -3
- package/src/server/lib/omp/rpc/session-commands.ts +6 -0
- package/src/server/lib/omp/session/sidebar-data.server.ts +3 -3
- package/src/server/lib/queue/delivery.server.ts +114 -0
- package/src/server/lib/queue/schema-migration.server.ts +50 -0
- package/src/server/lib/queue/store.server.ts +185 -0
- package/src/server/lib/terminal/foreground.ts +73 -0
- package/src/server/lib/terminal/history.test.ts +118 -0
- package/src/server/lib/terminal/history.ts +205 -0
- package/src/server/lib/terminal/runtime.server.ts +338 -0
- package/src/server/lib/terminal/session.server.ts +215 -0
- package/src/server/lib/terminal/shell.test.ts +97 -0
- package/src/server/lib/terminal/shell.ts +103 -0
- package/src/server/routes/fs/git.ts +22 -12
- package/src/server/routes/index.ts +2 -1
- package/src/server/routes/sessions/index.ts +11 -3
- package/src/server/routes/sessions/queue.ts +121 -0
- package/src/server/routes/sessions/session.ts +1 -132
- package/src/server/routes/settings/commands.ts +1 -1
- package/src/server/routes/terminal/index.ts +2 -2
- package/src/server/routes/terminal/run.ts +8 -100
- package/src/server/routes/terminal/sessions.ts +24 -0
- package/src/server/routes/terminal/ws.ts +149 -0
- package/src/shared/lib/chat/omp/agent-events.test.ts +37 -1
- package/src/shared/lib/chat/omp/agent-events.ts +30 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.test.ts +9 -1
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +45 -8
- package/src/shared/lib/omp/session/stream-state.server.ts +2 -3
- package/src/shared/lib/workspace/session-state/store.ts +1 -4
- package/src/shared/lib/workspace/terminal/protocol.ts +222 -0
- package/src/shared/types/omp/agent.ts +12 -0
- package/src/shared/types/terminal.ts +17 -15
- package/src/shared/types/workspace.ts +2 -2
- package/dist/client/static/js/async/g.d1c2fe09aa.js +0 -2
- package/dist/client/static/js/async/x4.69ec69c61b.js +0 -6
- package/src/client/components/workspace/terminal-panel/InputBar.tsx +0 -82
- package/src/client/components/workspace/terminal-panel/LogEntry.tsx +0 -70
- package/src/client/hooks/workspace/terminal-output.ts +0 -66
- package/src/client/hooks/workspace/terminal.ts +0 -283
- package/src/server/lib/fs/terminal-cwd.ts +0 -49
- package/src/server/routes/terminal/stream.ts +0 -100
- /package/dist/client/static/js/async/{g.d1c2fe09aa.js.LICENSE.txt → g.a06ca3b3e9.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{m.0896dab823.js.LICENSE.txt → m.c038c71b9f.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/{index.dc5f5fabe8.js.LICENSE.txt → index.0de15c5e17.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! LICENSE: g.a06ca3b3e9.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["g"],{Wh(e,t,n){n.d(t,{MobileLayoutWrapper:()=>eJ});var i=n("j"),s=n("H"),a=n("s"),l=n("NO"),r=n("y");let o=(0,r.A)({name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]});var c=n("Go"),d=n("r"),p=n("z"),h=n("se"),m=n("oj"),x=n("SS"),f=n("A9"),u=n("FE"),b=n("R2"),g=n("U8");function k(e){let{activeSessionTitle:t,activeSessionId:n,onOpenSessionSidebar:a,onOpenRightSidebar:l,onNewSession:r,onSelectSession:k}=e,{folders:v}=(0,f.k)(),N=(0,u.H)(),[Y,w]=(0,s.J0)(!1),[y,S]=(0,s.J0)(!1),[F,D]=(0,s.J0)(null),C=(0,s.li)(null);(0,m.W)(C,()=>w(!1));let A=(0,s.li)(null);(0,m.W)(A,()=>S(!1)),(0,s.vJ)(()=>{if(!n)return void D(null);let e=!1;return fetch(`/api/telemetry/context?sessionId=${encodeURIComponent(String(n))}`).then(e=>e.ok?e.json():null).then(t=>{e||D(t?.telemetry??null)}).catch(()=>{e||D(null)}),()=>{e=!0}},[n]);let z=(0,s.Kr)(()=>{let e=Date.now(),t=[];for(let n of v)for(let i of n.sessions??[]){if(1===i.is_archived)continue;let s=(0,x.R7)(String(i.id)),a=i.updated_at?Date.parse(i.updated_at):0,l=void 0!==s&&e-s<=6e5?s:a;void 0!==s&&e-s>6e5||t.push({id:i.id,title:i.title,folderName:n.name,modified:l})}return t.sort((e,t)=>t.modified-e.modified).slice(0,10)},[v]),j=t?t.charAt(0).toUpperCase()+t.slice(1):"New session";return(0,i.FD)("header",{className:"flex-shrink-0 bg-canvas border-b border-ink/10 flex items-center justify-between px-3 z-20 titlebar-drag-region select-none",style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px), env(titlebar-area-x, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px), calc(100vw - env(titlebar-area-width, 100vw)))",paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,i.FD)("div",{className:"flex items-center space-x-2 min-w-0 titlebar-no-drag",children:[(0,i.Y)("button",{type:"button",onClick:a,className:"p-1.5 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0",title:"Open Sessions","aria-label":"Open Sessions",children:(0,i.Y)(o,{size:20,strokeWidth:2})}),(0,i.FD)("span",{className:"relative font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:[(0,i.Y)("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-orange-600 to-amber-500 font-extrabold text-[15px] tracking-tighter",children:"OMP"}),(0,i.Y)("span",{className:"ml-[1px] text-ink",children:"Chamber"}),(0,i.Y)("span",{className:"absolute -top-0.5 -right-1.5 flex",children:(0,i.Y)(b.c,{status:N})})]}),(0,i.Y)("span",{className:"text-ink/25 font-light text-xs flex-shrink-0 select-none",children:"/"}),(0,i.FD)("div",{className:"relative min-w-0",ref:C,children:[(0,i.FD)("button",{type:"button",onClick:()=>w(!Y),className:"flex items-center space-x-1 text-xs font-semibold text-ink hover:text-ink/80 transition-colors py-1 max-w-[150px] min-w-0",title:j,children:[(0,i.Y)("span",{className:"truncate",children:j}),(0,i.Y)(c.A,{size:13,className:"text-ink/50 flex-shrink-0"})]}),Y&&(0,i.FD)("div",{className:"fixed z-50 bg-paper border border-ink/15 rounded-xl shadow-lg p-2 text-xs",style:{top:"calc(3.5rem + env(safe-area-inset-top, 0px) + 0.375rem)",left:"max(0.75rem, env(safe-area-inset-left, 0px))",right:"max(0.75rem, env(safe-area-inset-right, 0px))",maxWidth:"18rem",maxHeight:"calc(100dvh - 3.5rem - env(safe-area-inset-top, 0px) - 1.125rem)",overflowY:"auto"},children:[(0,i.FD)("button",{type:"button",onClick:()=>{r(),w(!1)},className:"w-full text-left px-3 py-2 rounded-lg bg-ink text-canvas flex items-center space-x-2 font-medium mb-1.5 active:scale-98",children:[(0,i.Y)(d.A,{size:14}),(0,i.Y)("span",{children:"Start New Session"})]}),(0,i.Y)("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40",children:"Recent Sessions"}),(0,i.Y)("div",{className:"max-h-64 scrollbar-overlay-container scrollbar-overlay-static space-y-0.5",children:0===z.length?(0,i.Y)("div",{className:"px-2.5 py-2 text-ink/40 italic",children:"No sessions yet"}):z.map(e=>(0,i.FD)("button",{type:"button",onClick:()=>{k(e.id),w(!1)},className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between space-x-2 transition-colors ${String(n)===String(e.id)?"bg-ink/10 font-semibold text-ink":"hover:bg-ink/5 text-ink/80"}`,children:[(0,i.FD)("span",{className:"min-w-0 flex flex-col",children:[(0,i.Y)("span",{className:"truncate",children:e.title?e.title.charAt(0).toUpperCase()+e.title.slice(1):"Untitled"}),(0,i.Y)("span",{className:"truncate text-[10px] text-ink/40 font-mono",children:e.folderName})]}),String(n)===String(e.id)&&(0,i.Y)(p.A,{size:12,className:"flex-shrink-0"})]},e.id))})]})]})]}),(0,i.FD)("div",{className:"flex items-center space-x-1 text-ink",children:[(0,i.FD)("div",{className:"relative flex items-center",ref:A,children:[(0,i.Y)("button",{type:"button",onClick:()=>S(!y),className:"w-8 h-8 rounded-lg hover:bg-ink/5 active:bg-ink/10 flex items-center justify-center text-ink transition-colors cursor-pointer",title:"Context usage","aria-label":"Context usage",children:(0,i.Y)("span",{className:"w-4 h-4 rounded-full border-[1.5px] border-ink/60 hover:border-ink transition-colors"})}),y&&(0,i.FD)("div",{className:"absolute top-full right-0 mt-2 w-56 bg-paper border border-ink/20 rounded-xl shadow-xl z-50 p-3 text-xs font-mono",children:[(0,i.FD)("div",{className:"font-semibold text-ink font-sans pb-1.5 border-b border-ink/10 flex items-center justify-between",children:[(0,i.Y)("span",{children:"Context"}),F&&F.messagesCount>0&&(0,i.Y)("span",{className:"w-1.5 h-1.5 rounded-full bg-success"})]}),F&&0!==F.messagesCount?(0,i.FD)("div",{className:"pt-2 space-y-1.5 text-[11px] text-ink/80",children:[(0,i.FD)("div",{className:"flex justify-between gap-2",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Model:"}),(0,i.Y)("span",{className:"truncate",children:F.modelName||"—"})]}),(0,i.FD)("div",{className:"flex justify-between",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Context:"}),(0,i.FD)("span",{children:[(0,g.Rk)(F.contextUsed)??"0"," / ",(0,g.Rk)(F.contextLimit)??"0"," (",F.contextPercent,"%)"]})]}),(0,i.FD)("div",{className:"flex justify-between",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Messages:"}),(0,i.Y)("span",{children:F.messagesCount})]}),(0,i.FD)("div",{className:"flex justify-between",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Cost:"}),(0,i.Y)("span",{children:F.costFormatted})]}),"number"==typeof F.cacheHitAverage&&(0,i.FD)("div",{className:"flex justify-between",children:[(0,i.Y)("span",{className:"text-ink/50",children:"Cache hit:"}),(0,i.FD)("span",{children:[F.cacheHitAverage.toFixed(1),"%"]})]})]}):(0,i.Y)("div",{className:"pt-2 text-[11px] text-ink/50 italic font-sans",children:"Session not started"})]})]}),(0,i.Y)("button",{type:"button",onClick:l,className:"w-8 h-8 rounded-lg hover:bg-ink/5 active:bg-ink/10 flex items-center justify-center text-ink transition-colors cursor-pointer",title:"Right Panel","aria-label":"Open Right Panel",children:(0,i.Y)(h.A,{size:18,strokeWidth:1.8})})]})]})}var v=n("d");function N(e){let{activeSessionId:t,onSelectSession:n,onNewSession:a,onOpenSessionSidebar:l,onOpenRightSidebar:r,appSettings:o={}}=e,{folders:c}=(0,f.k)(),[d,p]=(0,s.J0)(null),h=(0,s.Kr)(()=>{if(!t)return"New session";for(let e of c){let n=e.sessions?.find(e=>String(e.id)===String(t));if(n)return n.title}return null},[t,c]);return(0,i.FD)("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative",children:[(0,i.Y)(k,{activeSessionTitle:d||h||"New session",activeSessionId:t,onOpenSessionSidebar:l,onOpenRightSidebar:r,onNewSession:a,onSelectSession:n}),(0,i.Y)("div",{className:"flex-1 min-h-0",children:(0,i.Y)(v.E,{appSettings:o,onSessionTitle:p,variant:"mobile"})})]})}var Y=n("S");function w(e){let{onClose:t}=e;return(0,i.FD)("div",{className:"border-b border-ink/10 flex items-center justify-between px-3.5 flex-shrink-0 bg-canvas titlebar-drag-region select-none",style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingLeft:"max(0.875rem, env(safe-area-inset-left, 0px), env(titlebar-area-x, 0px))",paddingRight:"max(0.875rem, env(safe-area-inset-right, 0px))",paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,i.FD)("div",{className:"flex items-center space-x-2.5 titlebar-no-drag",children:[(0,i.FD)("span",{className:"font-bold text-sm tracking-tight flex items-center",children:[(0,i.Y)("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-orange-600 to-amber-500 font-extrabold text-[16px] tracking-tighter",children:"OMP"}),(0,i.Y)("span",{className:"ml-[1px] text-ink font-bold text-sm",children:"Chamber"})]}),(0,i.Y)("span",{className:"text-ink/25 text-xs select-none",children:"/"}),(0,i.Y)("span",{className:"text-[11px] font-semibold text-ink/60 uppercase tracking-wider font-mono",children:"Sessions"})]}),(0,i.Y)("button",{type:"button",onClick:t,className:"w-9 h-9 rounded-xl hover:bg-ink/5 active:bg-ink/10 text-ink flex items-center justify-center transition-colors cursor-pointer titlebar-no-drag",title:"Close sidebar","aria-label":"Close sidebar",children:(0,i.Y)(Y.A,{size:19,strokeWidth:2})})]})}var y=n("D"),S=n("O");let F=(0,r.A)({name:"arrow-up-down",size:24,node:[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]});var D=n("p7"),C=n("t3"),A=n("E");function z(e){let{searchQuery:t,sortOption:n,optionsOpen:s,showArchived:a,optionsRef:l,onNewSession:r,onNewWorkspace:o,onScheduler:c,onToggleOptions:h,onSortChange:m,onResetSort:x,onToggleArchived:f,onHideArchived:u,onSearchChange:b,onClearSearch:g}=e;return(0,i.FD)("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-2.5 flex-shrink-0 bg-canvas",children:[(0,i.FD)("div",{className:"flex items-center space-x-2",children:[(0,i.FD)("button",{type:"button",onClick:r,className:"flex-1 h-9.5 flex items-center justify-center space-x-2 px-3.5 rounded-xl bg-ink text-canvas hover:bg-ink/90 active:scale-[0.98] text-xs font-semibold transition-all shadow-xs",children:[(0,i.Y)(d.A,{size:15,strokeWidth:2.4}),(0,i.Y)("span",{children:"New Session"})]}),(0,i.Y)("button",{type:"button",onClick:o,className:"w-9.5 h-9.5 rounded-xl border border-ink/15 bg-paper hover:bg-ink/5 active:scale-95 text-ink/80 hover:text-ink flex items-center justify-center transition-all flex-shrink-0 cursor-pointer shadow-xs",title:"New Workspace","aria-label":"New Workspace",children:(0,i.Y)(y.A,{size:16,strokeWidth:1.8})}),(0,i.Y)("button",{type:"button",onClick:c,className:"w-9.5 h-9.5 rounded-xl border border-ink/15 bg-paper hover:bg-ink/5 active:scale-95 text-ink/80 hover:text-ink flex items-center justify-center transition-all flex-shrink-0 cursor-pointer shadow-xs",title:"Schedule Task","aria-label":"Schedule Task",children:(0,i.Y)(S.A,{size:16,strokeWidth:1.8})}),(0,i.FD)("div",{className:"relative flex-shrink-0",ref:l,children:[(0,i.Y)("button",{type:"button",onClick:h,className:`w-9.5 h-9.5 rounded-xl border active:scale-95 flex items-center justify-center transition-all cursor-pointer shadow-xs ${s||"A-Z"!==n||a?"bg-ink/10 text-ink border-ink/30":"border-ink/15 bg-paper hover:bg-ink/5 text-ink/80 hover:text-ink"}`,title:"Sort & Filter","aria-label":"Sort & Filter",children:(0,i.Y)(F,{size:15,strokeWidth:1.8})}),s&&(0,i.FD)("div",{className:"absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 rounded-xl shadow-xl z-50 p-2 text-xs",children:[(0,i.Y)(A.i,{variant:"mobile",sortOption:n,onSortChange:m}),(0,i.Y)("div",{className:"border-t border-ink/10 my-1.5"}),(0,i.Y)("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40 font-mono",children:"Filter"}),(0,i.FD)("button",{type:"button",onClick:f,className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between transition-colors ${a?"bg-amber-500/15 text-amber-950 font-semibold":"hover:bg-ink/5 text-ink/80"}`,children:[(0,i.FD)("span",{className:"flex items-center space-x-1.5",children:[(0,i.Y)(D.A,{size:13}),(0,i.Y)("span",{children:"Show Archived"})]}),a&&(0,i.Y)(p.A,{size:13})]})]})]})]}),(0,i.FD)("div",{className:"relative flex items-center",children:[(0,i.Y)(C.A,{size:14,className:"absolute left-3 text-ink/40"}),(0,i.Y)("input",{type:"text",value:t,onChange:e=>b(e.currentTarget.value),placeholder:"Search workspaces & sessions...",className:"w-full bg-paper border border-ink/15 rounded-xl pl-8 pr-8 py-2 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),t&&(0,i.Y)("button",{type:"button",onClick:g,className:"absolute right-2.5 text-ink/40 hover:text-ink p-1","aria-label":"Clear search",children:(0,i.Y)(Y.A,{size:13})})]}),(a||"A-Z"!==n)&&(0,i.FD)("div",{className:"flex items-center space-x-1.5 flex-wrap gap-y-1 pt-0.5",children:["A-Z"!==n&&(0,i.FD)("span",{className:"inline-flex items-center space-x-1 bg-ink/5 border border-ink/10 text-ink/80 rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[(0,i.FD)("span",{children:["Sort: ",n.replace("_"," ")]}),(0,i.Y)("button",{type:"button",onClick:x,className:"hover:text-ink ml-0.5",title:"Reset sort",children:(0,i.Y)(Y.A,{size:10})})]}),a&&(0,i.FD)("span",{className:"inline-flex items-center space-x-1 bg-amber-500/15 border border-amber-500/25 text-amber-900 rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[(0,i.Y)(D.A,{size:10}),(0,i.Y)("span",{children:"Archived"}),(0,i.Y)("button",{type:"button",onClick:u,className:"hover:text-amber-950 ml-0.5",title:"Hide archived",children:(0,i.Y)(Y.A,{size:10})})]})]})]})}var j=n("qn"),T=n("vZ"),O=n("Sj"),W=n("Nf"),P=n("t"),R=n("b"),$=n("HZ"),E=n("P6");function J(e){let{session:t,isActive:n,status:s,timeAgo:a,showTreeGlyph:l=!1,onSelect:r,onArchive:o,onRename:c}=e,{isEditing:d,draft:h,setDraft:m,inputRef:x,startRename:f,handleKeyDown:u,handleBlur:b}=(0,E.B)(t.title,c);return d?(0,i.Y)("div",{className:"w-full rounded-lg flex items-center bg-ink/10",children:(0,i.Y)("input",{ref:x,autoFocus:!0,value:h,onChange:e=>m(e.currentTarget.value),onKeyDown:u,onBlur:b,className:"flex-1 min-w-0 mx-2 my-1.5 bg-paper border border-ink/25 rounded px-2 py-1 text-xs text-ink outline-none focus:border-ink/50"})}):(0,i.FD)("div",{className:`w-full rounded-lg flex items-center transition-colors ${n?"bg-ink/10 font-medium text-ink":"hover:bg-ink/5 text-ink/85"}`,children:[(0,i.FD)("button",{type:"button",onClick:r,className:"flex-1 text-left px-3 py-2 flex items-center justify-between min-w-0",children:[(0,i.FD)("div",{className:"flex items-center space-x-1.5 min-w-0 pr-2",children:[(0,i.FD)("span",{className:"w-4 flex-shrink-0 flex items-center justify-center",children:["stream"===s&&(0,i.Y)(P.A,{size:13,className:"text-ink/50 animate-spin"}),("finish"===s||"abort"===s)&&(0,i.Y)(p.A,{size:13,className:"text-ink/50"})]}),l&&(0,i.Y)("span",{className:"text-ink/40 text-xs flex-shrink-0 font-mono",children:">"}),(0,i.Y)("span",{className:"text-xs truncate leading-snug",children:t.title.charAt(0).toUpperCase()+t.title.slice(1)})]}),(0,i.Y)("span",{className:"text-[11px] text-ink/45 font-mono flex-shrink-0 ml-2",children:a??""})]}),c&&(0,i.Y)("button",{type:"button",onClick:f,title:"Rename session",className:"flex-shrink-0 p-2 text-ink/35 hover:text-ink rounded-lg cursor-pointer",children:(0,i.Y)(R.A,{size:14})}),(0,i.Y)("button",{type:"button",onClick:o,title:1===t.is_archived?"Unarchive session":"Archive session",className:"flex-shrink-0 p-2 mr-1 text-ink/35 hover:text-ink rounded-lg cursor-pointer",children:1===t.is_archived?(0,i.Y)($.A,{size:14}):(0,i.Y)(D.A,{size:14})})]})}var M=n("C4"),U=n("NR"),I=n("U"),L=n("A");function H(e){let{folder:t,activeSessionId:n,onSelectSession:a,isExpanded:l,onToggleExpand:r,showArchived:o=!1,sessionStatus:d={}}=e,{visibleCount:p,showMore:h}=(0,U.y)(),{refresh:x}=(0,f.k)(),[u,b]=(0,s.J0)(!1),g=(0,s.li)(null),{confirmDelete:k,requestDelete:v,cancelDelete:N,handlePin:Y,handleDelete:w,handleArchive:y,handleRename:S}=(0,I.C)(t,x);(0,m.W)(g,()=>{b(!1),N()});let F=(t.sessions||[]).filter(e=>o?1===e.is_archived:1!==e.is_archived),D=F.slice(0,p),C=(0,L.x)(t.icon);return(0,i.FD)("div",{className:"mb-4",children:[(0,i.FD)("div",{onClick:r,className:"flex items-center justify-between px-3 py-2 cursor-pointer hover:bg-ink/5 rounded-lg select-none transition-colors",children:[(0,i.FD)("div",{className:"flex items-center space-x-2 min-w-0",children:[t.customIconUrl?(0,i.Y)("img",{src:t.customIconUrl,alt:"",className:"w-[15px] h-[15px] rounded-xs object-contain flex-shrink-0",referrerPolicy:"no-referrer"}):"chat"===t.iconType?(0,i.Y)(j.A,{size:15,className:"text-ink/80 flex-shrink-0"}):(0,i.Y)(C,{size:15,className:"text-ink/80 flex-shrink-0",style:{color:t.accentColor||void 0}}),(0,i.Y)("span",{className:"text-sm font-semibold text-ink truncate",children:t.name})]}),(0,i.FD)("div",{className:"flex items-center space-x-2 text-xs text-ink/60",children:[(0,i.Y)("span",{className:"font-mono text-[11px] text-ink/70",children:F.length}),t.project_path&&(0,i.Y)(T.A,{size:13,className:"text-ink/50 ml-1"}),(0,i.FD)("div",{className:"relative flex items-center",ref:g,onClick:e=>e.stopPropagation(),children:[(0,i.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),b(e=>!e)},className:"p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink",title:"Workspace options","aria-label":`Options for ${t.name}`,children:(0,i.Y)(O.A,{size:15})}),u&&(0,i.Y)("div",{className:"absolute right-0 top-full mt-1 w-48 bg-paper border border-ink/15 rounded-lg shadow-lg z-50 py-1 text-xs",children:(0,i.Y)(M.t,{variant:"mobile",isPinned:t.isPinned,confirmDelete:k,onPin:()=>{Y(),b(!1)},onDelete:()=>{w(),b(!1)},onRequestDelete:v,onCancelDelete:N})})]}),l?(0,i.Y)(c.A,{size:14}):(0,i.Y)(W.A,{size:14})]})]}),l&&(0,i.FD)("div",{className:"mt-0.5 space-y-0.5 pl-2",children:[D.map(e=>(0,i.Y)(J,{session:e,isActive:String(n)===String(e.id),status:d[String(e.id)],timeAgo:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();if(null==e||""===e)return null;let n="number"==typeof e?e:Date.parse(e);if(Number.isNaN(n))return null;let i=Math.round((t-n)/1e3);if(i<45)return"now";let s=Math.round(i/60);if(s<60)return`${s}m`;let a=Math.round(s/60);if(a<24)return`${a}h`;let l=Math.round(a/24);if(l<7)return`${l}d`;let r=Math.round(l/7);if(r<5)return`${r}w`;let o=new Date(n),c=o.getFullYear()===new Date(t).getFullYear(),d=o.getDate(),p=o.toLocaleString("en-US",{month:"short"});return c?`${d} ${p}`:`${d} ${p} ${o.getFullYear()}`}(e.updated_at??e.created_at),onSelect:()=>a(e.id),onArchive:()=>y(e),onRename:String(e.id).startsWith("new-")?void 0:t=>void S(e,t)},e.id)),F.length>p&&(0,i.FD)("button",{type:"button",onClick:h,className:"w-full text-left px-3 py-2 text-xs text-ink/60 hover:text-ink flex items-center space-x-1.5",children:[(0,i.Y)(c.A,{size:12,className:"w-4 flex-shrink-0"}),(0,i.FD)("span",{children:["Show more sessions (",F.length-p,")"]})]})]})]})}var K=n("jo");function B(e){let{folders:t,activeSessionId:n,expandedFolders:s,showArchived:a,sessionStatus:l,isScrolling:r,onScroll:o,onSelectSession:c,onToggleFolder:d}=e;return(0,i.Y)("div",{onScroll:o,className:`flex-1 scrollbar-overlay-container p-3 ${(0,K.p)(r)}`,children:0===t.length?(0,i.Y)("div",{className:"text-center py-12 text-xs text-ink/50 italic",children:"No matching sessions found"}):t.map(e=>(0,i.Y)(H,{folder:e,activeSessionId:n,onSelectSession:c,isExpanded:s[e.id]??!0,onToggleExpand:()=>d(e.id),showArchived:a,sessionStatus:l},e.id))})}var _=n("vB"),Z=n("wU"),G=n("mX"),q=n("P");function V(e){let{onSettings:t,onAbout:n,updateAvailable:s,onUpdateClick:a,onDesktopToggle:l}=e;return(0,i.FD)("div",{className:"px-3 pt-3 border-t border-ink/10 flex items-center justify-between flex-shrink-0 bg-canvas text-xs text-ink/60",style:{paddingBottom:"max(0.75rem, env(safe-area-inset-bottom, 0px))"},children:[(0,i.FD)("div",{className:"flex items-center space-x-3",children:[(0,i.FD)("button",{type:"button",onClick:t,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[(0,i.Y)(_.A,{size:14}),(0,i.Y)("span",{children:"Settings"})]}),(0,i.FD)("button",{type:"button",onClick:n,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[(0,i.Y)(Z.A,{size:14}),(0,i.Y)("span",{children:"About"})]}),l&&(0,i.FD)("button",{type:"button",onClick:l,className:"flex items-center space-x-1 hover:text-ink transition-colors",title:"Switch to desktop view",children:[(0,i.Y)(G.A,{size:14}),(0,i.Y)("span",{children:"Desktop"})]})]}),(0,i.FD)("div",{className:"flex items-center gap-2",children:[(0,i.FD)("span",{className:"font-mono text-[10px] text-ink/40",children:["v",q.rE]}),s&&(0,i.Y)("button",{type:"button",onClick:a,className:"px-2 py-0.5 rounded-full border border-ink/20 text-[10px] font-semibold text-ink hover:border-ink/40",children:"update"})]})]})}var X=n("wu"),Q=n("g"),ee=n("oZ"),et=n("DO"),en=n("z4");let ei=[3,2];function es(){return(0,i.Y)("div",{className:"flex-1 p-3 space-y-4","aria-hidden":"true",children:ei.map((e,t)=>(0,i.FD)("div",{className:"space-y-2",children:[(0,i.FD)("div",{className:"flex items-center gap-2 px-1 py-2",children:[(0,i.Y)("span",{className:"w-4 h-4 rounded-sm animate-pulse bg-ink/10"}),(0,i.Y)("span",{className:"h-3 w-24 rounded animate-pulse bg-ink/10"})]}),Array.from({length:e},(e,t)=>(0,i.FD)("div",{className:"flex items-center gap-2 rounded px-2 py-2",children:[(0,i.Y)("span",{className:"w-4 h-4 rounded-full animate-pulse bg-ink/10"}),(0,i.Y)("span",{className:"h-3 rounded animate-pulse bg-ink/10",style:{width:`${58-t%3*12}%`}})]},t))]},t))})}function ea(e){let{activeSessionId:t,onSelectSession:n,onNewSession:a,onCreateFolder:l,onClose:r,onDesktopToggle:o,appSettings:c={}}=e,{folders:d,initializing:p,searchQuery:h,setSearchQuery:x,showArchived:f,setShowArchived:u,optionsOpen:b,setOptionsOpen:g,sortOption:k,handleSortChange:v,processedFolders:N,sessionStatus:Y,handleSelectSession:y}=(0,en.K)(c,{onSelectSession:n,onAfterSelect:r}),[S,F]=(0,s.J0)({1:!0,2:!0,3:!0}),[D,C]=(0,s.J0)(!1),[A,j]=(0,s.J0)(!1),[T,O]=(0,s.J0)(!1),W=(0,et.M)(),{toasts:P,pushToast:R,dismissToast:$}=(0,ee.Y)(),E=(0,s.li)(null);(0,m.W)(E,()=>g(!1));let{isScrolling:J,handleScroll:M}=(0,K.K)();return(0,s.vJ)(()=>{F(Object.fromEntries(d.map(e=>[e.id,e.isExpanded])))},[d]),(0,i.FD)("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative select-none",children:[(0,i.Y)(w,{onClose:r}),(0,i.Y)(z,{searchQuery:h,sortOption:k,optionsOpen:b,showArchived:f,optionsRef:E,onNewSession:()=>{a(),r()},onNewWorkspace:()=>C(!0),onScheduler:()=>j(!0),onToggleOptions:()=>g(!b),onSortChange:v,onResetSort:()=>v("A-Z"),onToggleArchived:()=>{u(!f),g(!1)},onHideArchived:()=>u(!1),onSearchChange:x,onClearSearch:()=>x("")}),p?(0,i.Y)(es,{}):(0,i.Y)(B,{folders:N,activeSessionId:t,expandedFolders:S,showArchived:f,sessionStatus:Y,isScrolling:J,onScroll:M,onSelectSession:y,onToggleFolder:e=>{F(t=>({...t,[e]:!t[e]}));let t=d.find(t=>t.id===e),n=!(S[e]??t?.isExpanded??!0);fetch(`/api/folders/${e}/toggle`,{method:"POST",body:new URLSearchParams({isExpanded:String(n)})}).then(t=>{if(!t.ok)throw Error(`HTTP ${t.status}`);window.dispatchEvent(new CustomEvent("omp:workspace-updated",{detail:{folderId:e}}))}).catch(e=>{console.error("Failed to save mobile workspace state:",e)})}}),(0,i.Y)(V,{onSettings:()=>window.dispatchEvent(new CustomEvent("omp:open-settings",{detail:{}})),onAbout:()=>O(!0),onDesktopToggle:o,updateAvailable:W.hasUpdate,onUpdateClick:()=>{O(!0),W.check()}}),(0,i.Y)(Q.xV,{isOpen:D,onClose:()=>C(!1),onCreate:l}),(0,i.Y)(Q.Lo,{isOpen:A,onClose:()=>j(!1)}),(0,i.Y)(Q.VT,{isOpen:T,onClose:()=>O(!1),updates:W,onToast:R}),(0,i.Y)(X.y,{toasts:P,onDismiss:$})]})}var el=n("G"),er=n("oE"),eo=n("Asb"),ec=n("N"),ed=n("Oj"),ep=n("lW"),eh=n("SJ"),em=n("nG"),ex=n("so"),ef=n("ET");let eu={context:{title:"Context & Telemetry",label:"Context",icon:(0,i.Y)(er.A,{size:14,className:"flex-shrink-0"})},files:{title:"Files Explorer",label:"Files",icon:(0,i.Y)(eo.A,{size:14,className:"flex-shrink-0"})},search:{title:"Search Workspace",label:"Search",icon:(0,i.Y)(C.A,{size:14,className:"flex-shrink-0"})},git:{title:"GIT",label:"GIT",icon:(0,i.Y)(T.A,{size:14,className:"flex-shrink-0"})},terminal:{title:"Bun Terminal",label:"Terminal",icon:(0,i.Y)(ec.A,{size:14,className:"flex-shrink-0"})},"user-browser":{title:"Browser (Anda)",label:"Browser",icon:(0,i.Y)(ed.A,{size:14,className:"flex-shrink-0"})},browser:{title:"Browser Agent",label:"Agent",icon:(0,i.Y)(ep.A,{size:14,className:"flex-shrink-0"})},usage:{title:"Usage",label:"Usage",icon:(0,i.Y)(eh.A,{size:14,className:"flex-shrink-0"})}};function eb(e){let{enabled:t=!0,rootPath:n,refreshKey:a=0,onRefresh:l,onOpenFile:r,onClose:o}=e,[c,d]=(0,s.J0)("files"),{changes:p}=(0,ex.e)(n,".",a,t,15e3),h=p.length>0;return(0,i.FD)("div",{className:"flex flex-col h-full w-full bg-paper text-ink relative select-none",children:[(0,i.FD)("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas",style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[(0,i.Y)("div",{className:"flex items-center space-x-1.5 overflow-x-auto no-scrollbar py-1",children:ef.G7.map(e=>(0,i.FD)("button",{type:"button",onClick:()=>d(e),className:`relative flex items-center transition-all cursor-pointer ${c===e?"space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold bg-ink text-canvas shadow-sm":"p-2 rounded-lg text-ink/70 hover:bg-ink/5"}`,title:eu[e].title,children:[eu[e].icon,c===e&&(0,i.Y)("span",{className:"git"===e?"tracking-wide":void 0,children:eu[e].label}),"git"===e&&h&&(0,i.Y)("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-info",title:"Uncommitted changes"})]},e))}),(0,i.Y)("button",{type:"button",onClick:o,className:"p-1.5 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 ml-2",title:"Close right sidebar","aria-label":"Close right sidebar",children:(0,i.Y)(Y.A,{size:20,strokeWidth:1.8})})]}),(0,i.Y)("div",{className:"flex-1 min-h-0 overflow-hidden relative",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:t?(0,i.Y)(i.FK,{children:(0,i.FD)(el.tY,{fallback:(0,i.Y)("div",{className:"h-full flex items-center justify-center text-ink/40",children:(0,i.Y)("span",{className:"text-xs font-mono",children:"Loading…"})}),children:["files"===c&&(0,i.Y)(em.gI,{className:"h-full w-full",enabled:t,rootPath:n,refreshKey:a,onRefresh:l,onOpenFile:r}),"search"===c&&(0,i.Y)(em.N1,{className:"h-full w-full",enabled:t,rootPath:n}),"git"===c&&(0,i.Y)(em.nR,{className:"h-full w-full",enabled:t,rootPath:n,refreshKey:a}),"context"===c&&(0,i.Y)(em.ov,{className:"h-full w-full",enabled:t,refreshKey:a,onClose:o}),"terminal"===c&&(0,i.Y)(em.Bz,{className:"h-full w-full",enabled:t,rootPath:n,showHeader:!1}),"user-browser"===c&&(0,i.Y)(em.M,{className:"h-full w-full"}),"browser"===c&&(0,i.Y)(em.XL,{className:"h-full w-full",active:!0}),"usage"===c&&(0,i.Y)(em.WE,{className:"h-full w-full"})]})}):(0,i.Y)("div",{className:"h-full flex items-center justify-center text-ink/40",children:(0,i.Y)("span",{className:"text-xs font-mono",children:"No session selected"})})})]})}var eg=n("E6"),ek=n("vp"),ev=n("uf"),eN=n("Kv"),eY=n("Soe"),ew=n("bH"),ey=n("yh"),eS=n("hj"),eF=n("na"),eD=n("b0"),eC=n("tC"),eA=n("ob");function ez(e){let{fileName:t,isMarkdown:n,isPreview:s,wordWrap:a,copied:l,onClose:r,onTogglePreview:o,onToggleWrap:c,onZoomOut:d,onZoomIn:h,onCopy:m,onDownload:x}=e;return(0,i.FD)("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:{height:"calc(3rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[(0,i.FD)("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[(0,i.Y)("button",{type:"button",onClick:r,className:"p-1.5 rounded-lg hover:bg-ink/10 text-ink transition-colors active:scale-90 flex-shrink-0 cursor-pointer",title:"Close editor","aria-label":"Close editor",children:(0,i.Y)(eN.A,{size:18,strokeWidth:2})}),(0,i.FD)("div",{className:"flex items-center space-x-1.5 truncate",children:[(0,i.Y)(eA.o,{name:t,size:15,className:"flex-shrink-0"}),(0,i.Y)("span",{className:"font-semibold text-xs text-ink truncate",children:t})]})]}),(0,i.FD)("div",{className:"flex items-center space-x-1 text-ink/70 flex-shrink-0",children:[n&&(0,i.Y)("button",{type:"button",onClick:o,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${s?"bg-ink text-canvas":""}`,title:s?"View code":"Preview markdown",children:s?(0,i.Y)(eY.A,{size:15}):(0,i.Y)(ew.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:c,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${a?"text-ink":""}`,title:"Toggle word wrap",children:(0,i.Y)(ey.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:d,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Decrease font size",children:(0,i.Y)(eS.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:h,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Increase font size",children:(0,i.Y)(eF.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:m,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Copy content",children:l?(0,i.Y)(p.A,{size:15,className:"text-success"}):(0,i.Y)(eD.A,{size:15})}),(0,i.Y)("button",{type:"button",onClick:x,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Download file",children:(0,i.Y)(eC.A,{size:15})})]})]})}var ej=n("XY");function eT(e){let{file:t,onClose:n,onFileSaved:a}=e,[l,r]=(0,s.J0)(t.name.endsWith(".md")),[o,c]=(0,s.J0)(12),[d,p]=(0,s.J0)(!0),{isScrolling:h,handleScroll:m}=(0,K.K)(),x=t.name.endsWith(".md"),f=(0,ej.n)(t,{reportLoadError:!0,flushOnUnmount:!0,reportSaveError:!0,downloadMimeType:"text/plain;charset=utf-8",onFileSaved:a}),u=f.content,b=f.language,g=u.split("\n").length;return(0,i.FD)("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col font-mono text-xs select-none",children:[(0,i.Y)(ez,{fileName:t.name,isMarkdown:x,isPreview:l,wordWrap:d,copied:f.copied,onClose:n,onTogglePreview:()=>r(!l),onToggleWrap:()=>p(!d),onZoomOut:()=>c(e=>Math.max(10,e-1)),onZoomIn:()=>c(e=>Math.min(18,e+1)),onCopy:f.copy,onDownload:f.download}),(0,i.Y)("div",{onScroll:m,className:`flex-1 min-h-0 overflow-auto relative bg-paper text-ink select-text ${(0,K.p)(h)}`,children:f.isLoading?(0,i.FD)("div",{className:"flex items-center justify-center h-full text-ink/40 text-xs gap-2",children:[(0,i.Y)(P.A,{size:14,className:"animate-spin"}),(0,i.Y)("span",{children:"Loading file content..."})]}):f.loadError?(0,i.FD)("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[(0,i.Y)(eg.A,{size:20,className:"text-error"}),(0,i.FD)("span",{className:"text-xs text-error font-sans",children:["Could not read ",t.name]}),(0,i.Y)("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:f.loadError})]}):x&&l?(0,i.Y)("div",{className:"p-4 bg-paper text-ink min-h-full font-sans prose prose-sm max-w-none",children:(0,i.Y)(ek.T,{content:u})}):(0,i.Y)(ev.P,{value:u,onValueChange:f.onChange,language:b,wordWrap:d,rootClassName:"flex min-h-full bg-paper",gutterClassName:"w-10 py-3 pr-2 select-none text-right text-[10px] text-ink/30 bg-canvas border-r border-ink/10 font-mono leading-[20px] flex-shrink-0",editorWrapperClassName:"flex-1 p-3 overflow-x-auto min-w-0 bg-paper text-ink code-surface",editorClassName:"focus:outline-none",editorStyle:{fontFamily:"monospace",fontSize:`${o}px`,lineHeight:"20px",backgroundColor:"transparent",minHeight:"100%",color:"var(--theme-ink)"}})}),(0,i.FD)("footer",{className:"bg-canvas border-t border-ink/10 px-3 flex items-center justify-between text-[10px] text-ink/60 flex-shrink-0 font-mono",style:{height:"calc(1.75rem + env(safe-area-inset-bottom, 0px))",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[(0,i.FD)("div",{className:"flex items-center space-x-3",children:[(0,i.FD)("span",{children:[g," lines"]}),(0,i.FD)("span",{children:[u.length," chars"]}),(0,i.Y)("span",{className:"uppercase",children:b})]}),(0,i.FD)("div",{className:"flex items-center space-x-2",children:["saving"===f.saveStatus&&(0,i.FD)(i.FK,{children:[(0,i.Y)(P.A,{size:10,className:"animate-spin"}),(0,i.Y)("span",{children:"Saving…"})]}),"saved"===f.saveStatus&&(0,i.FD)(i.FK,{children:[(0,i.Y)("span",{className:"w-1.5 h-1.5 rounded-full bg-success"}),(0,i.Y)("span",{children:"Saved"})]}),"error"===f.saveStatus&&(0,i.FD)(i.FK,{children:[(0,i.Y)("span",{className:"w-1.5 h-1.5 rounded-full bg-error"}),(0,i.Y)("span",{className:"text-error",children:"Save failed"})]}),"idle"===f.saveStatus&&t.path&&(0,i.Y)("span",{className:"truncate max-w-[140px]",children:t.path})]})]})]})}var eO=n("Xg"),eW=n("LQ");function eP(e){let{diff:t,onClose:n,onFileSaved:s}=e,a=t.path.split("/").pop()||t.path,l=!!t.staged,r=t.status||"M",o=(0,eW.R)(r,l);return(0,i.FD)("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col",children:[(0,i.FD)("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:{height:"calc(3rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[(0,i.FD)("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[(0,i.Y)("button",{type:"button",onClick:n,className:"p-1.5 -ml-1 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0",title:"Back","aria-label":"Close diff",children:(0,i.Y)(eN.A,{size:18,strokeWidth:1.9})}),(0,i.Y)(eA.o,{name:a,size:14,className:"flex-shrink-0"}),(0,i.Y)("span",{className:"font-mono text-xs text-ink font-medium truncate",title:t.path,children:a})]}),(0,i.FD)("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border flex-shrink-0 ${o.badgeBgClass}`,children:[o.charStatus," ",o.label]})]}),(0,i.Y)("div",{className:"flex-1 min-h-0",children:(0,i.Y)(eO.M,{className:"h-full",filePath:t.path,status:r,isStaged:l,root:t.root,repo:t.repo||".",onFileSaved:s})})]})}var eR=n("u"),e$=n("Gb"),eE=n("wm");function eJ(e){let{onDesktopToggle:t,appSettings:n={}}=e,{folders:r}=(0,f.k)(),[o,c]=(0,a.o)(),d=o.get("sessionId"),p=d?Number.isNaN(Number(d))?d:Number(d):null,h=o.get("folderId"),m=h?Number.isNaN(Number(h))?h:Number(h):null,[x,u]=(0,s.J0)("main"),[b,g]=(0,s.J0)(null),[k,v]=(0,s.J0)(null),[Y,w]=(0,s.J0)(0),[y,S]=(0,s.J0)(!1),[F,D]=(0,s.J0)("appearance"),[C,A]=(0,s.J0)(!1),z=(0,s.hb)(()=>w(e=>e+1),[]),{folder:j}=(0,e$.t)(r,p),T=j??(m?r.find(e=>String(e.id)===String(m))??null:null),O=T?.project_path??null,W=!!T;(0,l.sY)("omp:open-file",e=>{if(!e.detail||!e.detail.path)return;let t=e.detail.path.replace(/^\/+/,"");g({name:e.detail.name||t.split("/").pop()||"file",path:t,content:e.detail.content,root:e.detail.root})}),(0,l.sY)("omp:open-diff",e=>{let t=e.detail;t?.file&&v({path:t.file.replace(/^\/+/,""),status:t.status,staged:t.staged,repo:t.repo,root:t.root??O??void 0})}),(0,l.sY)("omp:open-settings",e=>{let t=e.detail;D(t?.category??"appearance"),A(!!t?.autoOpenAdd),S(!0)});let P=e=>{c(t=>(t.set("sessionId",e.toString()),t.has("subagent")&&t.delete("subagent"),t),{replace:!0}),u("main")},R=()=>{let e=(0,eE.l)(r,d,m??void 0);e&&(0,eE.r)(e),c(e=>{let t=e.get("sessionId"),n=new URLSearchParams(e);if(n.set("sessionId",`new-${Date.now()}`),t){let e=r.find(e=>e.sessions?.some(e=>String(e.id)===String(t)));e&&n.set("folderId",e.id.toString())}return n},{replace:!0}),u("main")},$=async e=>{let t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok||!n.success)throw Error(n.error||`HTTP ${t.status}`);window.location.reload()},E=(0,s.hb)(e=>{let t=(e?.path||"").replace(/^\/+/,"");g({name:e?.name||t.split("/").pop()||"file",path:t,content:e?.content,root:e?.root??O??void 0})},[O]);return(0,i.FD)("div",{className:"flex flex-col h-dvh w-screen overflow-hidden bg-canvas text-ink font-sans selection:bg-ink selection:text-canvas relative",children:[(0,i.Y)("div",{className:`flex-1 min-h-0 w-full ${"main"===x?"block":"hidden"}`,children:(0,i.Y)(N,{activeSessionId:p,onSelectSession:P,onNewSession:R,onOpenSessionSidebar:()=>u("session"),onOpenRightSidebar:()=>u("right"),appSettings:n})}),(0,i.Y)("div",{className:`flex-1 min-h-0 w-full ${"session"===x?"block":"hidden"}`,children:(0,i.Y)(ea,{activeSessionId:p,onSelectSession:P,onNewSession:R,onCreateFolder:$,onClose:()=>u("main"),onDesktopToggle:t,appSettings:n})}),"right"===x&&(0,i.Y)("div",{className:"flex-1 min-h-0 w-full",children:(0,i.Y)(eb,{enabled:W,rootPath:O??void 0,refreshKey:Y,onRefresh:z,onOpenFile:E,onClose:()=>u("main")})}),b&&(0,i.Y)(eT,{file:b,onClose:()=>g(null),onFileSaved:z}),k&&(0,i.Y)(eP,{diff:k,onClose:()=>v(null),onFileSaved:z}),(0,i.Y)(eR.b,{isOpen:y,onClose:()=>{S(!1),A(!1)},initialCategory:F,autoOpenAddProvider:C,appSettings:n})]})}},qn(e,t,n){let i=(0,n("y").A)({name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]});n.d(t,{},{A:i})},mX(e,t,n){let i=(0,n("y").A)({name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]});n.d(t,{},{A:i})}}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! LICENSE: m.
|
|
1
|
+
/*! LICENSE: m.c038c71b9f.js.LICENSE.txt */
|
|
2
2
|
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["m"],{ABt(e,t,n){n.d(t,{GitPanel:()=>ea});var s=n("j"),a=n("H"),r=n("X"),i=n("E6"),o=n("DB"),l=n("t"),c=n("hw"),d=n("Wb0"),h=n("S"),p=n("t3");function m(e){let{isGraphMode:t,onToggleMode:n,searchQuery:a,onSearchChange:r,onRefresh:i,onClose:l,isRefreshing:m,totalCommits:f,totalCount:u}=e;return(0,s.FD)("div",{className:"flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none\n pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]",children:[(0,s.FD)("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[(0,s.FD)("div",{className:"flex flex-col min-w-0",children:[(0,s.FD)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,s.Y)("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),(0,s.Y)("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/50 border border-ink/10 whitespace-nowrap",children:u&&u>f?`${f} of ${u}`:`${f} commits`})]}),(0,s.Y)("p",{className:"text-xs text-ink/50 mt-0.5 hidden lg:block",children:"Browse recent commits and inspect changed files."})]}),(0,s.FD)("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[(0,s.FD)("div",{className:"flex items-center bg-ink/5 p-0.5 rounded-lg border border-ink/10 text-xs",children:[(0,s.FD)("button",{type:"button",onClick:()=>n(!1),title:"History view",className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${!t?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:[(0,s.Y)(c.A,{size:13}),(0,s.Y)("span",{className:"hidden lg:inline",children:"History"})]}),(0,s.FD)("button",{type:"button",onClick:()=>n(!0),title:"Graph view",className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${t?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:[(0,s.Y)(o.A,{size:13}),(0,s.Y)("span",{className:"hidden lg:inline",children:"Graph"})]})]}),(0,s.FD)("button",{type:"button",onClick:i,disabled:m,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border border-ink/15 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer text-xs disabled:opacity-40",title:"Refresh commit history",children:[(0,s.Y)(d.A,{size:13,className:m?"animate-spin text-ink":""}),(0,s.Y)("span",{className:"hidden lg:inline",children:"refresh"})]}),(0,s.Y)("button",{type:"button",onClick:l,className:"p-2 -mr-1 rounded-md hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors cursor-pointer",title:"Close modal",children:(0,s.Y)(h.A,{size:16})})]})]}),(0,s.FD)("div",{className:"relative mt-1",children:[(0,s.Y)(p.A,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/40"}),(0,s.Y)("input",{type:"text",value:a,onChange:e=>r(e.currentTarget.value),placeholder:"Filter commits by message, author, or hash...",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),a&&(0,s.Y)("button",{type:"button",onClick:()=>r(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/40 hover:text-ink cursor-pointer",children:(0,s.Y)(h.A,{size:12})})]})]})}let f=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function u(e,t){if(!e||!t)return!1;if(e===t)return!0;let n=Math.min(e.length,t.length);return n>=4&&e.substring(0,n)===t.substring(0,n)}function x(e){let t=new Map,n=[];for(let s of e){if("number"==typeof s.lane){t.set(s.hash,s.lane);continue}let e=n.findIndex(e=>u(e,s.hash)||u(e,s.shortHash));-1===e&&(-1===(e=n.indexOf(null))?(e=n.length,n.push(s.hash)):n[e]=s.hash),t.set(s.hash,e);let a=s.parents&&s.parents[0];if(a?n[e]=a:n[e]=null,s.parents&&s.parents.length>1)for(let e=1;e<s.parents.length;e++){let t=s.parents[e];if(!n.some(e=>u(e,t))){let e=n.indexOf(null);-1===e?n.push(t):n[e]=t}}}return t}function b(e){let{commits:t,nodePositions:n,selectedHash:r,hoveredHash:i,isGraphMode:o,laneWidth:l=18,paddingLeft:c=16,totalHeight:d}=e,h=(0,a.Kr)(()=>{if(!o){let e=new Map;return t.forEach(t=>e.set(t.hash,0)),e}return x(t)},[t,o]),p=(0,a.Kr)(()=>{let e=0;return h.forEach(t=>{t>e&&(e=t)}),e},[h]),m=o?(p+1)*l+2*c:36,u=(0,a.Kr)(()=>{if(!o){let e=[];for(let s=0;s<t.length-1;s++){let a=n[t[s].hash]??60*s+20,r=n[t[s+1].hash]??(s+1)*60+20;e.push({fromHash:t[s].hash,toHash:t[s+1].hash,fromLane:0,toLane:0,fromY:a,toY:r,color:"var(--theme-ink)"})}return e}return function(e,t,n,s){let a=[],r=new Map;for(let i of(e.forEach((e,t)=>{r.set(e.hash,t),e.shortHash&&r.set(e.shortHash,t),e.hash.length>=7&&r.set(e.hash.substring(0,7),t)}),e)){let o=t.get(i.hash)??0,l=n[i.hash]??0,c=f[o%f.length];if(i.parents&&0!==i.parents.length)for(let d of i.parents){let h=r.get(d);if("number"!=typeof h&&d.length>=7&&(h=r.get(d.substring(0,7))),"number"==typeof h){let s=e[h],r=t.get(s.hash)??o,c=n[s.hash]??l+60;a.push({fromHash:i.hash,toHash:s.hash,fromLane:o,toLane:r,fromY:l,toY:c,color:f[o%f.length]})}else a.push({fromHash:i.hash,toHash:"tail-"+i.hash,fromLane:o,toLane:o,fromY:l,toY:Math.max(l+80,s),color:c})}}return a}(t,h,n,d)},[t,h,n,d,o]);return(0,s.Y)("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:m,height:d},children:(0,s.FD)("svg",{className:"w-full h-full overflow-visible",style:{width:m,height:d},children:[(0,s.Y)("defs",{children:(0,s.Y)("filter",{id:"node-glow",x:"-20%",y:"-20%",width:"140%",height:"140%",children:(0,s.Y)("feDropShadow",{dx:"0",dy:"0",stdDeviation:"2",floodOpacity:"0.35"})})}),u.map(e=>{let t=o?c+e.fromLane*l:16,n=o?c+e.toLane*l:16,a=o?e.color:"currentColor",r=o?.95:.25,i=function(e,t,n,s){if(1>Math.abs(e-n))return`M ${e} ${t} L ${n} ${s}`;let a=s-t;return`M ${e} ${t} C ${e} ${t+.45*a}, ${n} ${s-.45*a}, ${n} ${s}`}(t,e.fromY,n,e.toY);return(0,s.Y)("path",{d:i,fill:"none",stroke:a,strokeWidth:o?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:r},`${e.fromHash}->${e.toHash}`)}),t.map(e=>{let t=h.get(e.hash)??0,a=o?c+t*l:16,d=n[e.hash]??20,p=r===e.hash||r===e.shortHash,m=i===e.hash||i===e.shortHash,u=o?f[t%f.length]:"var(--theme-success)";return(0,s.FD)("g",{children:[(p||m)&&(0,s.Y)("circle",{cx:a,cy:d,r:8,fill:u,fillOpacity:p?.35:.2,stroke:u,strokeWidth:1}),(0,s.Y)("circle",{cx:a,cy:d,r:o?4:4.5,fill:o?"var(--theme-paper)":u,stroke:u,strokeWidth:o?2.5:1.5,filter:"url(#node-glow)"}),o&&(0,s.Y)("circle",{cx:a,cy:d,r:1.8,fill:u})]},`node-${e.hash}`)})]})})}var g=n("z"),k=n("b0"),v=n("Go"),y=n("Nf");function w(e){let{commit:t,onAction:n,isBusy:a}=e;return(0,s.FD)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:[(0,s.Y)("button",{type:"button",disabled:a,onClick:e=>{e.stopPropagation(),n("checkout",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"checkout"}),(0,s.Y)("button",{type:"button",disabled:a,onClick:e=>{e.stopPropagation(),n("create_branch_here",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"create branch here"}),(0,s.Y)("button",{type:"button",disabled:a,onClick:e=>{e.stopPropagation(),n("cherry_pick",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"cherry-pick"}),(0,s.Y)("button",{type:"button",disabled:a,onClick:e=>{e.stopPropagation(),n("revert",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"revert"}),(0,s.Y)("button",{type:"button",disabled:a,onClick:e=>{e.stopPropagation(),n("reset",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"reset..."}),(0,s.Y)("button",{type:"button",disabled:a,onClick:e=>{e.stopPropagation(),n("merge",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"merge into current"}),(0,s.Y)("button",{type:"button",disabled:a,onClick:e=>{e.stopPropagation(),n("rebase",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"rebase onto this"})]})}var N=n("Wb"),Y=n("DU"),C=n("Po");function A(e){let{diffText:t,isLoading:n,filePath:r}=e,[i,o]=(0,a.J0)(!1),l=(0,C.w)(),c=(0,a.Kr)(()=>{if(!t)return[];let e=[],n=1,s=1,a=t.split(/\r?\n/);for(let t of a.some(e=>e.startsWith("@@"))?a:[`@@ -0,0 +1,${a.length} @@`,...a.map(e=>e.startsWith("+")||e.startsWith("-")?e:`+${e}`)])if(!(t.startsWith("diff --git")||t.startsWith("index ")||t.startsWith("---")||t.startsWith("+++")||t.startsWith("new file mode")||t.startsWith("deleted file mode")||t.startsWith("similarity index")||t.startsWith("old mode")||t.startsWith("new mode")||t.startsWith("\\ No newline")))if(t.startsWith("@@")){let a=t.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);a&&(n=parseInt(a[1],10),s=parseInt(a[2],10)),e.push({type:"meta",text:t})}else if(t.startsWith("+"))e.push({type:"add",text:t.slice(1),newNum:s++});else if(t.startsWith("-"))e.push({type:"del",text:t.slice(1),oldNum:n++});else{let a=t.startsWith(" ")?t.slice(1):t;e.push({type:"context",text:a,oldNum:n++,newNum:s++})}return e},[t]),d=(0,Y.sQ)(r),h=(0,a.Kr)(()=>{let e=Array(c.length).fill(""),t=-1,n=n=>{if(t<0)return;let s=(0,Y.O9)(c.slice(t,n).map(e=>e.text).join("\n"),d);for(let a=t;a<n;a++)e[a]=s[a-t]??"";t=-1};return c.forEach((e,s)=>{"meta"===e.type?n(s):t<0&&(t=s)}),n(c.length),e},[c,d,l]);return n?(0,s.Y)("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-ink/40 font-mono text-xs flex items-center justify-center",children:"Loading commit diff..."}):t&&0!==c.length?(0,s.FD)("div",{className:"my-2 rounded border border-ink/15 bg-paper overflow-hidden text-[11px] font-mono leading-relaxed shadow-xs text-ink",children:[(0,s.FD)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-canvas border-b border-ink/10 text-ink/70 text-[10.5px]",children:[(0,s.Y)("span",{className:"font-semibold text-meta",children:"Diff preview"}),(0,s.Y)("button",{type:"button",onClick:()=>o(!i),className:"hover:text-ink flex items-center gap-1 cursor-pointer transition-colors",children:i?(0,s.FD)(s.FK,{children:[(0,s.Y)(N.A,{size:12})," Collapse context"]}):(0,s.FD)(s.FK,{children:[(0,s.Y)(v.A,{size:12})," Expand all context"]})})]}),(0,s.Y)("div",{className:"overflow-x-auto max-h-72 select-text",children:(0,s.Y)("div",{className:"w-max min-w-full divide-y divide-ink/[0.04]",children:c.map((e,t)=>{if("meta"===e.type)return(0,s.FD)("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-meta text-[10px] font-semibold",children:[(0,s.Y)("span",{children:"↕"}),(0,s.Y)("span",{children:e.text})]},t);let n="add"===e.type,a="del"===e.type;return(0,s.FD)("div",{className:`flex items-start font-mono ${n?"bg-success/10 hover:bg-success/15":a?"bg-error/10 hover:bg-error/15":"text-ink hover:bg-ink/[0.02]"}`,children:[(0,s.Y)("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${a?"bg-error/15 text-error font-semibold":n?"bg-success/15 text-success/70":"bg-canvas/50 text-ink/40"}`,children:e.oldNum??(n?"+":"")}),(0,s.Y)("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${n?"bg-success/15 text-success font-semibold":a?"bg-error/15 text-error/70":"bg-canvas/50 text-ink/40"}`,children:e.newNum??(a?"-":"")}),(0,s.Y)("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${n?"text-success":a?"text-error":"opacity-0"}`,children:n?"+":a?"-":" "}),(0,s.Y)("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:e.text?(0,s.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:h[t]}}):" "})]},t)})})})]}):(0,s.Y)("div",{className:"my-2 p-3 rounded bg-canvas border border-ink/10 text-ink/40 font-mono text-xs text-center",children:"No diff content available for this file."})}function F(e){let{commit:t,isSelected:n,isGraphMode:r,onSelect:i,onAction:o,onToggleFile:l,isExpandedFile:c,isLoadingFile:d,fileDiffs:h,headerRef:p}=e,[m,f]=(0,a.J0)(!1);return(0,s.Y)("div",{onClick:()=>i(t),className:`border-b border-ink/5 transition-colors cursor-pointer ${n?"bg-ink/[0.03]":"hover:bg-ink/[0.015]"}`,children:(0,s.FD)("div",{className:"py-2.5 pr-4 pl-1 flex flex-col",children:[(0,s.FD)("div",{className:"flex flex-col gap-1",children:[t.refs&&t.refs.length>0&&(0,s.Y)("div",{className:"flex flex-wrap items-center gap-1.5 pb-0.5",children:t.refs.map((e,t)=>{let n=e.includes("stash"),a=e.includes("HEAD")||e.includes("main")||e.includes("master");return(0,s.Y)("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${n?"bg-warning/10 text-warning border-warning/25 font-semibold":a?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-meta border-ink/10 font-medium"}`,children:e},t)})}),(0,s.Y)("div",{ref:p,className:"text-[13px] font-semibold text-ink leading-snug break-words",children:t.message}),(0,s.FD)("div",{className:"flex items-center gap-2 text-[11px] text-ink/50 font-mono flex-wrap",children:[(0,s.Y)("span",{children:t.author}),(0,s.Y)("span",{children:"•"}),(0,s.Y)("span",{children:t.date}),(0,s.Y)("span",{children:"•"}),(0,s.FD)("button",{type:"button",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(t.hash),f(!0),setTimeout(()=>f(!1),2e3)},title:"Copy commit hash",className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[(0,s.Y)("span",{children:t.shortHash}),m?(0,s.Y)(g.A,{size:11,className:"text-success"}):(0,s.Y)(k.A,{size:11})]})]})]}),(n||r)&&(0,s.Y)("div",{className:"mt-2",children:(0,s.Y)(w,{commit:t,onAction:o})}),t.files&&t.files.length>0&&(0,s.Y)("div",{className:"mt-2 flex flex-col gap-1",children:t.files.map((e,n)=>{let a=c(t.hash,e.file),r=`${t.hash}:${e.file}`,i=void 0!==h[r]?h[r]:e.diff,o=d(t.hash,e.file),p="A"===e.status?"text-success font-bold":"D"===e.status?"text-error font-bold":"R"===e.status?"text-meta font-bold":"text-info font-bold";return(0,s.FD)("div",{className:"flex flex-col",children:[(0,s.FD)("div",{onClick:n=>{n.stopPropagation(),l(t.hash,e)},className:"flex items-center gap-2 py-1 px-2 rounded hover:bg-ink/5 text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10",children:[(0,s.Y)("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${p}`,children:e.status||"M"}),(0,s.Y)("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:e.file}),(0,s.FD)("span",{className:"flex items-center gap-1 text-[10.5px] tabular-nums flex-shrink-0 font-medium",children:[(0,s.FD)("span",{className:"text-success",children:["+",e.additions]}),(0,s.Y)("span",{className:"text-ink/30",children:"/"}),(0,s.FD)("span",{className:"text-error",children:["-",e.deletions]})]}),(0,s.Y)("span",{className:"text-ink/40 group-hover:text-ink flex-shrink-0",children:a?(0,s.Y)(v.A,{size:13}):(0,s.Y)(y.A,{size:13})})]}),a&&(0,s.Y)("div",{className:"pl-4 pr-1",children:(0,s.Y)(A,{diffText:i,isLoading:o,filePath:e.file})})]},n)})})]})})}let D=[{hash:"8f8ca583e7162b190f898394e1e3ad81472a1290",shortHash:"8f8ca583",author:"Wijarnako Putra Rajeb",date:"Sep 10, 2026, 12:40 PM",message:"feat(chat): persist composer draft and attachments per session",parents:["6d3bac50"],refs:["HEAD -> main","origin/main"],lane:0,files:[{file:"app/hooks/chat/timeline/index.ts",status:"M",additions:3,deletions:2,diff:`@@ -7,6 +7,7 @@
|
|
3
3
|
import { useChatTimelineActions } from '@/client/hooks/chat/timeline/actions';
|
|
4
4
|
import { useChatTimelineSend } from '@/client/hooks/chat/timeline/send';
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
.env.*
|
|
26
26
|
!.env.example
|
|
27
27
|
.git
|
|
28
|
-
2 unmodified lines`},{file:"docker-compose.yml",status:"M",additions:5,deletions:0}]},{hash:"008cbe0711112222333344445555666677778888",shortHash:"008cbe07",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 01:25 PM",message:"feat(logging): structured timestamped logging across all web flows, bridged to docker logs",parents:["81ad44d5","b3b71ed5"],refs:["origin/feat/whatsapp-notification","feat/whatsapp-notification"],lane:0,files:[{file:"server.ts",status:"M",additions:19,deletions:3}]},{hash:"81ad44d522223333444455556666777788889999",shortHash:"81ad44d5",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 01:07 PM",message:"WIP on main: b3b71ed fix(pbpmd): history modal reads live BOFIS API instead of sqlite cache",parents:["9616fad9"],refs:["refs/stash"],lane:1,files:[{file:"app/routes/api/pb-pmd/$id.history.ts",status:"M",additions:22,deletions:6}]},{hash:"9616fad933334444555566667777888899990000",shortHash:"9616fad9",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 01:07 PM",message:"index on main: b3b71ed fix(pbpmd): history modal reads live BOFIS API instead of sqlite cache",parents:["b3b71ed5"],lane:1,files:[{file:"app/routes/api/pb-pmd/$id.history.ts",status:"M",additions:15,deletions:4}]},{hash:"b3b71ed544445555666677778888999900001111",shortHash:"b3b71ed5",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:55 PM",message:"fix(pbpmd): history modal reads live BOFIS API instead of sqlite cache",parents:["4dc73776"],lane:0,files:[{file:"app/routes/api/pb-pmd/$id.history.ts",status:"M",additions:8,deletions:12}]},{hash:"4dc7377655556666777788889999000011112222",shortHash:"4dc73776",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:50 PM",message:"feat(ui): 13th KPI card TOTAL MANDAYS + gapless 6-col dashboard grid",parents:["acab6465"],lane:0,files:[{file:"app/components/dashboard/KPIGrid.tsx",status:"M",additions:35,deletions:7}]},{hash:"acab646566667777888899990000111122223333",shortHash:"acab6465",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:45 PM",message:"feat(pbpmd): history modal table layout, wider modal, drop edit scenario action",parents:["86a6d6c5"],lane:0,files:[{file:"app/components/pbpmd/HistoryModal.tsx",status:"M",additions:24,deletions:18}]},{hash:"86a6d6c577778888999900001111222233334444",shortHash:"86a6d6c5",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:45 PM",message:"feat(pbpmd): pb history modal reads sqlite cache via /api/pb-pmd/:id/history",parents:["9ffea446"],lane:0,files:[{file:"app/routes/api/pb-pmd/$id.history.ts",status:"M",additions:42,deletions:5}]},{hash:"9ffea44688889999000011112222333344445555",shortHash:"9ffea446",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:45 PM",message:"feat(dashboard): crdApproved threshold shifted 5 minutes from history date_end",parents:[],lane:0,files:[{file:"app/lib/dashboard/calculator.ts",status:"M",additions:12,deletions:2}]}];function M(e){let{output:t,onClose:n,onRefresh:r,onExecuteAction:i,rootPath:o,activeRepo:c}=e;if(!t)return null;let d=t.title.toLowerCase().includes("graph"),[h,p]=(0,a.J0)(d),[f,u]=(0,a.J0)(""),[g,k]=(0,a.J0)(""),[v,y]=(0,a.J0)(!1),{commits:w,hasMore:N,totalCount:Y,isLoadingMore:C,handleLoadMore:A}=function(e){let{output:t,isGraphMode:n,rootPath:s,activeRepo:r}=e,[i,o]=(0,a.J0)(!1),[l,c]=(0,a.J0)(t?.hasMore??t?.data?.length===50),[d,h]=(0,a.J0)(t?.total),p=(0,a.Kr)(()=>{let e=t?.data||[];return 0===e.length?D:e[0]&&"object"==typeof e[0]&&("hash"in e[0]||"shortHash"in e[0])?e.map(e=>({hash:e.hash||e.shortHash||"unknown",shortHash:e.shortHash||(e.hash?e.hash.slice(0,8):"unknown"),author:e.author||"Unknown",date:e.date||e.time||"",message:e.message||"",parents:Array.isArray(e.parents)?e.parents:[],refs:Array.isArray(e.refs)?e.refs:[],files:Array.isArray(e.files)?e.files:[],lane:"number"==typeof e.lane?e.lane:void 0})):D},[t?.data]),[m,f]=(0,a.J0)(p);(0,a.vJ)(()=>{f(p),c(t?.hasMore??t?.data?.length===50),"number"==typeof t?.total&&h(t.total)},[p,t?.hasMore,t?.data?.length,t?.total]);let u=(0,a.hb)(async()=>{if(!i&&l){o(!0);try{let e=new FormData;e.set("actionType",n?"graph":"history"),e.set("limit","50"),e.set("skip",String(m.length)),s&&e.set("root",s),r&&e.set("repo",r);let t=await fetch("/api/fs/git",{method:"POST",body:e}),a=await t.json();if(a.success&&Array.isArray(a.data)){let e=a.data.map(e=>({hash:e.hash||e.shortHash||"unknown",shortHash:e.shortHash||(e.hash?e.hash.slice(0,8):"unknown"),author:e.author||"Unknown",date:e.date||e.time||"",message:e.message||"",parents:Array.isArray(e.parents)?e.parents:[],refs:Array.isArray(e.refs)?e.refs:[],files:Array.isArray(e.files)?e.files:[],lane:"number"==typeof e.lane?e.lane:void 0}));f(t=>{let n=new Set(t.map(e=>e.hash));return[...t,...e.filter(e=>!n.has(e.hash))]}),c(!!(a.hasMore??50===e.length)),"number"==typeof a.total&&h(a.total)}else c(!1)}catch(e){console.error("Failed to load more commits:",e)}finally{o(!1)}}},[i,l,n,m.length,s,r]);return{commits:m,setCommits:f,hasMore:l,totalCount:d,isLoadingMore:i,handleLoadMore:u}}({output:t,isGraphMode:h,rootPath:o,activeRepo:c}),{fileDiffs:M,expandedFiles:S,loadingFiles:j,handleToggleFile:P,handleCommitAction:$}=function(e){let{onExecuteAction:t,rootPath:n,activeRepo:s}=e,[r,i]=(0,a.J0)({}),[o,l]=(0,a.J0)(new Set),[c,d]=(0,a.J0)(new Set),h=(0,a.hb)(async(e,t)=>{let a=`${e}:${t.file}`,c=o.has(a);if(l(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t}),!c&&void 0===r[a]&&!t.diff){d(e=>new Set(e).add(a));try{let r=new FormData;r.set("actionType","commit_diff"),r.set("hash",e),r.set("file",t.file),n&&r.set("root",n),s&&"."!==s&&r.set("repo",s);let o=await fetch("/api/fs/git",{method:"POST",body:r}),l=await o.json();l&&"string"==typeof l.diff?i(e=>({...e,[a]:l.diff})):l&&l.error&&i(e=>({...e,[a]:`// Error: ${l.error}`}))}catch(e){console.error("Failed to load file diff:",e),i(t=>({...t,[a]:`// Error loading diff: ${e?.message||"Network error"}`}))}finally{d(e=>{let t=new Set(e);return t.delete(a),t})}}},[o,r,n,s]);return{fileDiffs:r,expandedFiles:o,loadingFiles:c,handleToggleFile:h,handleCommitAction:(0,a.hb)((e,n)=>{if(t)if("checkout"===e)t("checkout",void 0,{branch:n.hash});else if("create_branch_here"===e){let e=window.prompt(`Create new branch at commit ${n.shortHash}:`,`branch-${n.shortHash}`);e?.trim()&&t("create_branch",void 0,{branch:e.trim()})}else if("cherry_pick"===e)window.confirm(`Cherry-pick commit ${n.shortHash} onto current branch?`)&&t("cherry_pick",void 0,{hash:n.hash});else if("revert"===e)window.confirm(`Revert commit ${n.shortHash}?`)&&t("revert_commit",void 0,{hash:n.hash});else if("reset"===e){let e=window.prompt(`Reset current branch to ${n.shortHash} (soft, mixed, hard):`,"soft");e&&["soft","mixed","hard"].includes(e.toLowerCase())&&t("reset_commit",void 0,{hash:n.hash,mode:e.toLowerCase()})}else"merge"===e?window.confirm(`Merge commit ${n.shortHash} into current branch?`)&&t("merge_commit",void 0,{hash:n.hash}):"rebase"===e&&window.confirm(`Rebase current branch onto commit ${n.shortHash}?`)&&t("rebase_commit",void 0,{hash:n.hash})},[t])}}({onExecuteAction:i,rootPath:o,activeRepo:c});(0,a.vJ)(()=>{w.length>0&&!g&&k(w[0].hash)},[w,g]);let z=(0,a.Kr)(()=>{if(!f.trim())return w;let e=f.toLowerCase().trim();return w.filter(t=>t.message.toLowerCase().includes(e)||t.author.toLowerCase().includes(e)||t.shortHash.toLowerCase().includes(e)||t.hash.toLowerCase().includes(e)||t.refs?.some(t=>t.toLowerCase().includes(e)))},[w,f]),H=(0,a.li)(null),R=(0,a.li)(null),L=(0,a.li)(null),W=(0,a.li)({}),[J,T]=(0,a.J0)({}),[O,E]=(0,a.J0)(800);(0,a.vJ)(()=>{let e=L.current;if(!e||!N||C||f.trim())return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&A()},{root:H.current,threshold:.1});return t.observe(e),()=>t.disconnect()},[N,C,f,A]);let K=(0,a.hb)(()=>{if(!H.current||!R.current)return;let e=H.current.getBoundingClientRect(),t=H.current.scrollTop,n={};z.forEach((s,a)=>{let r=W.current[s.hash];if(r){let a=r.getBoundingClientRect();n[s.hash]=a.top+a.height/2-e.top+t}else n[s.hash]=60*a+20}),T(n),E(Math.max(R.current.offsetHeight,H.current.clientHeight,600))},[z]);(0,a.Nf)(()=>{K();let e=requestAnimationFrame(()=>{K()});return()=>cancelAnimationFrame(e)},[K,z,M,S,h]),(0,a.vJ)(()=>{let e=R.current;if(!e)return;let t=new ResizeObserver(()=>{K()});return t.observe(e),()=>t.disconnect()},[K]);let I=(0,a.Kr)(()=>x(z),[z]),_=(0,a.Kr)(()=>{let e=0;return I.forEach(t=>{t>e&&(e=t)}),e},[I]),B=h?(_+1)*18+32:36,G=async()=>{y(!0),r&&await r(),setTimeout(()=>y(!1),600)};return(0,s.Y)("div",{className:"fixed inset-0 z-50 bg-canvas/80 backdrop-blur-xs flex items-center justify-center p-0 lg:p-5",onClick:n,role:"dialog","aria-modal":"true",children:(0,s.FD)("div",{className:"bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden\n w-full h-full rounded-none border-0\n lg:w-[min(96vw,980px)] lg:h-[88vh] lg:rounded-xl lg:border\n pt-[env(safe-area-inset-top,0px)] lg:pt-0",onClick:e=>e.stopPropagation(),children:[(0,s.Y)(m,{isGraphMode:h,onToggleMode:p,searchQuery:f,onSearchChange:u,onRefresh:G,onClose:n,isRefreshing:v,totalCommits:z.length,totalCount:Y}),(0,s.Y)("div",{ref:H,className:"flex-1 overflow-y-auto scrollbar-overlay-container relative select-text",children:0===z.length?(0,s.Y)("div",{className:"flex flex-col items-center justify-center py-20 text-ink/40 font-mono text-xs",children:"No matching commits found."}):(0,s.FD)("div",{className:"relative min-h-full pb-8",children:[(0,s.Y)(b,{commits:z,nodePositions:J,selectedHash:g,isGraphMode:h,laneWidth:18,paddingLeft:16,totalHeight:O}),(0,s.FD)("div",{ref:R,className:"flex flex-col relative z-20",style:{paddingLeft:`${B}px`},children:[z.map(e=>(0,s.Y)(F,{commit:e,isSelected:g===e.hash,isGraphMode:h,onSelect:e=>k(e.hash),onAction:$,onToggleFile:P,isExpandedFile:(e,t)=>S.has(`${e}:${t}`),isLoadingFile:(e,t)=>j.has(`${e}:${t}`),fileDiffs:M,headerRef:t=>{W.current[e.hash]=t}},e.hash)),(0,s.Y)("div",{ref:L,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:C?(0,s.FD)("div",{className:"flex items-center gap-2 text-xs text-ink/60 font-mono py-2",children:[(0,s.Y)(l.A,{size:14,className:"animate-spin text-info"}),(0,s.Y)("span",{children:"Loading more commits..."})]}):N&&!f.trim()?(0,s.Y)("button",{type:"button",onClick:A,className:"px-3 py-1.5 text-xs font-mono text-ink/70 hover:text-ink bg-ink/5 hover:bg-ink/10 rounded-md border border-ink/10 transition-colors cursor-pointer",children:"Load more commits..."}):z.length>10?(0,s.FD)("div",{className:"text-[11px] font-mono text-ink/40 py-2",children:["End of commit history (",z.length," commits)"]}):null})]})]})})]})})}function S(e){let{children:t,onClose:n,wide:a}=e;return(0,s.Y)("div",{className:"fixed inset-0 z-50 bg-canvas/80 flex items-center justify-center p-4",onClick:n,role:"dialog","aria-modal":"true",children:(0,s.Y)("div",{className:`bg-paper border border-ink/20 rounded-lg shadow-xl flex flex-col overflow-hidden ${a?"w-[min(94vw,680px)] max-h-[82vh]":"w-[min(94vw,420px)] max-h-[80vh]"}`,onClick:e=>e.stopPropagation(),children:t})})}function j(e){let{modal:t,onClose:n,onConfirm:a}=e;return t?(0,s.FD)(S,{onClose:n,children:[(0,s.FD)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[(0,s.Y)(i.A,{size:16,className:"text-error flex-shrink-0"}),(0,s.Y)("h3",{className:"text-sm font-semibold text-ink",children:"Confirm Action"})]}),(0,s.Y)("div",{className:"px-4 py-4 text-xs text-ink/80 leading-relaxed",children:t.message}),(0,s.FD)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[(0,s.Y)("button",{type:"button",onClick:n,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),(0,s.Y)("button",{type:"button",onClick:a,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Confirm"})]})]}):null}function P(e){let{isOpen:t,branchName:n,inputRef:r,onChange:i,onClose:l,onCreate:c}=e;if(!t)return null;let d=(0,a.hb)(()=>{n.trim()&&c()},[n,c]);return(0,s.FD)(S,{onClose:l,children:[(0,s.FD)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[(0,s.Y)(o.A,{size:16,className:"text-ink/60 flex-shrink-0"}),(0,s.Y)("h3",{className:"text-sm font-semibold text-ink",children:"Create New Branch"})]}),(0,s.Y)("div",{className:"px-4 py-4",children:(0,s.Y)("input",{ref:r,type:"text",value:n,onChange:e=>i(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&d(),"Escape"===e.key&&l()},placeholder:"branch-name",className:"w-full bg-canvas border border-ink/20 rounded px-3 py-2 text-xs focus:outline-none focus:border-ink/40 text-ink placeholder-ink/40 transition-colors"})}),(0,s.FD)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[(0,s.Y)("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),(0,s.Y)("button",{type:"button",onClick:d,disabled:!n.trim(),className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Create"})]})]})}function $(e){let{message:t,hasStagedChanges:n,isBusy:a=!1,onChangeMessage:r,onCommit:i}=e,o=n&&t.trim().length>0&&!a;return(0,s.FD)("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[(0,s.Y)("textarea",{value:t,onChange:e=>r(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&o&&(e.preventDefault(),i())},placeholder:"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),(0,s.FD)("button",{type:"button",onClick:i,disabled:!o,title:n?"Commit staged changes":"Stage changes first",className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,s.Y)(g.A,{size:12}),"Commit"]})]})}var z=n("vZ"),H=n("r"),R=n("n"),L=n("Sj"),W=n("y");let J=(0,W.A)({name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]}),T=(0,W.A)({name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]});function O(e){let{branchRef:t,showBranchMenu:n,setShowBranchMenu:a,branch:r,branches:i,remoteBranches:l,onCheckout:d,onOpenBranchPrompt:h,optionsRef:p,showOptions:m,setShowOptions:f,onHistory:u,onGraph:x,viewMode:b,setViewMode:k,isBusy:y=!1,syncCount:w={ahead:0,behind:0},onSync:N}=e;return(0,s.FD)("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[(0,s.FD)("div",{className:"relative",ref:t,children:[(0,s.FD)("button",{onClick:()=>a(!n),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",children:[(0,s.Y)(z.A,{size:12,className:"text-ink/60"}),(0,s.Y)("span",{className:"truncate max-w-[140px]",children:r}),(0,s.Y)(v.A,{size:12,className:"text-ink/40"})]}),n&&(0,s.Y)("div",{className:"absolute top-full left-0 mt-1 w-48 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:(0,s.FD)("div",{className:"max-h-48 scrollbar-overlay-container scrollbar-overlay-static py-1",children:[i.length>0&&(0,s.FD)(s.FK,{children:[(0,s.Y)("div",{className:"px-3 py-1 text-[9px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),i.map(e=>(0,s.FD)("button",{onClick:()=>{d(e),a(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.Y)("span",{className:"truncate",children:e}),r===e&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]},e))]}),l.length>0&&(0,s.FD)(s.FK,{children:[(0,s.Y)("div",{className:"px-3 py-1 text-[9px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),l.map(e=>(0,s.FD)("button",{onClick:()=>{d(e),a(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.Y)("span",{className:"truncate",children:e}),r===e&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]},e))]}),(0,s.Y)("div",{className:"w-full h-px bg-ink/10 my-1"}),(0,s.FD)("button",{onClick:()=>{h(),a(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[(0,s.Y)(H.A,{size:12}),(0,s.Y)("span",{children:"Create new branch..."})]})]})})]}),(0,s.FD)("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:p,children:[(0,s.FD)("button",{type:"button",onClick:N,disabled:y||0===w.ahead&&0===w.behind,title:w.ahead>0&&w.behind>0?`Pull ${w.behind} then push ${w.ahead} commit(s)`:w.ahead>0?`Push ${w.ahead} commit(s)`:w.behind>0?`Pull ${w.behind} commit(s)`:"Up to date",className:"flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,s.Y)(R.A,{size:13}),(0,s.FD)("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",w.ahead," ↓",w.behind]})]}),(0,s.Y)("button",{type:"button",onClick:u,title:"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:(0,s.Y)(c.A,{size:13})}),(0,s.Y)("button",{type:"button",onClick:x,title:"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:(0,s.Y)(o.A,{size:13})}),(0,s.Y)("button",{type:"button",onClick:()=>f(!m),title:"View Options",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:(0,s.Y)(L.A,{size:13})}),m&&(0,s.FD)("div",{className:"absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[(0,s.FD)("button",{type:"button",onClick:()=>{k("flat"),f(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5",children:[(0,s.Y)(J,{size:12,className:"text-ink/60"}),(0,s.Y)("span",{children:"View as List"})]}),"flat"===b&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]}),(0,s.FD)("button",{type:"button",onClick:()=>{k("tree"),f(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5",children:[(0,s.Y)(T,{size:12,className:"text-ink/60"}),(0,s.Y)("span",{children:"View as Tree"})]}),"tree"===b&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]})]})]})]})}var E=n("rm"),K=n("Ir"),I=n("FL");function _(e){let{repoRef:t,showRepoMenu:n,setShowRepoMenu:a,activeRepo:r,repos:i,isLoading:o,rootPath:l,reposScanning:c,onSelectRepo:d,onRefresh:h,onRefreshRepos:m}=e,[f,u]=(0,I.bL)("git.repoQuery",""),x=function(e){if(!e)return"workspace root";let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t.length>0?t[t.length-1]:"workspace root"}(l),b=e=>"."===e?x:e,k=i.filter(e=>!f.trim()||b(e).toLowerCase().includes(f.toLowerCase()));return(0,s.FD)("div",{className:"p-3 border-b border-ink/10 flex items-center justify-between",children:[(0,s.FD)("div",{className:"relative",ref:t,children:[(0,s.FD)("button",{onClick:()=>a(!n),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-xs text-ink/80 font-medium",children:[(0,s.Y)(E.A,{size:12,className:"text-ink/60"}),(0,s.FD)("span",{className:"flex items-center space-x-1 truncate max-w-[150px]",children:[(0,s.Y)("span",{className:"text-ink/50 font-normal uppercase tracking-wider text-[10px]",children:"GIT"}),(0,s.Y)("span",{className:"text-ink/30",children:"•"}),(0,s.Y)("span",{children:"."===r?x:r.split("/").pop()})]}),(0,s.Y)(v.A,{size:12,className:"text-ink/40"})]}),n&&(0,s.FD)("div",{className:"absolute top-full left-0 mt-1 w-52 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[(0,s.FD)("div",{className:"px-2 py-1.5 border-b border-ink/10 flex items-center space-x-1.5",children:[(0,s.Y)(p.A,{size:11,className:"text-ink/40 flex-shrink-0"}),(0,s.Y)("input",{type:"text",value:f,onChange:e=>u(e.currentTarget.value),placeholder:"Search repos...",title:"Search repositories",className:"w-full bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),f&&(0,s.Y)("button",{type:"button",onClick:()=>u(""),title:"Clear search",className:"text-ink/40 hover:text-ink flex-shrink-0",children:"×"}),(0,s.Y)("button",{type:"button",onClick:m,title:"Refresh nested repos",disabled:c,className:"text-ink/40 hover:text-ink flex-shrink-0 transition-colors disabled:opacity-40 disabled:hover:text-ink/40",children:(0,s.Y)(K.A,{size:11,className:c?"animate-spin":""})})]}),(0,s.Y)("div",{className:"max-h-48 scrollbar-overlay-container scrollbar-overlay-static py-1",children:0===k.length?(0,s.Y)("div",{className:"px-3 py-2 text-ink/40 italic",children:"No repos found"}):k.map(e=>(0,s.FD)("button",{onClick:()=>{d(e),a(!1),u("")},title:b(e),className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.Y)("span",{className:"truncate",children:b(e)}),r===e&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]},e))})]})]}),(0,s.Y)("div",{className:"flex space-x-2 text-ink/40",children:(0,s.Y)("button",{type:"button",onClick:h,title:"Refresh",className:"hover:text-ink cursor-pointer inline-flex",children:(0,s.Y)(K.A,{size:14,className:o?"animate-spin":""})})})]})}var B=n("DV"),G=n("I"),V=n("ob"),U=n("LQ");function q(e){let{change:t,isStaged:n,repo:a,rootPath:r,onAction:i}=e,o=(0,U.R)(t.status,n),l=o.charStatus,c=o.colorClass,d=t.file.split("/"),h=d.pop()||t.file,p=d.length>0?d.join("/"):"";return(0,s.FD)("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:n,status:l,repo:a||".",root:r}}))},children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[(0,s.Y)("span",{className:`font-bold font-mono text-[9px] w-3 flex-shrink-0 text-center ${c}`,title:`Status: ${o.label}`,children:l}),(0,s.Y)(V.o,{name:h,size:12,className:"flex-shrink-0"}),(0,s.Y)("span",{className:`truncate ${c}`,title:t.file,children:h}),p&&(0,s.Y)("span",{className:"text-[9px] text-ink/40 truncate ml-1",children:p})]}),(0,s.Y)("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:(0,s.FD)("div",{className:"flex items-center opacity-0 group-hover:opacity-100 space-x-1",children:[!n&&(0,s.FD)(s.FK,{children:[(0,s.Y)("button",{type:"button",onClick:()=>i("revert",t.file),title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:(0,s.Y)(G.A,{size:11})}),(0,s.Y)("button",{type:"button",onClick:()=>i("stage",t.file),title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(H.A,{size:11})})]}),n&&(0,s.Y)("button",{type:"button",onClick:()=>i("unstage",t.file),title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(B.A,{size:11})})]})})]})}function Q(e){let{node:t,isStaged:n,isFolderOpen:a,toggleFolder:r,onAction:i,depth:o=0,repo:l,rootPath:c}=e,d="folder"===t.type,h=!!d&&a(t.id);if(d)return(0,s.FD)("div",{className:"select-none",children:[(0,s.FD)("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[(0,s.Y)("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:h?(0,s.Y)(v.A,{size:12}):(0,s.Y)(y.A,{size:12})}),(0,s.Y)(V.o,{name:t.name,isFolder:!0,isOpen:h,size:13,className:"flex-shrink-0"}),(0,s.Y)("span",{className:"font-medium text-ink truncate",children:t.name}),(0,s.Y)("span",{className:"text-[9px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),(0,s.Y)("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:(0,s.Y)("div",{className:"flex items-center opacity-0 group-hover:opacity-100 space-x-1",children:n?(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),i("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(B.A,{size:11})}):(0,s.FD)(s.FK,{children:[(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),i("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:(0,s.Y)(G.A,{size:11})}),(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),i("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(H.A,{size:11})})]})})})]}),h&&t.children&&t.children.length>0&&(0,s.Y)("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map(e=>(0,s.Y)(Q,{node:e,isStaged:n,isFolderOpen:a,toggleFolder:r,onAction:i,depth:o+1,repo:l,rootPath:c},e.id))})]});let p=t.change,m=(0,U.R)(p?.status||"M",n),f=m.charStatus,u=m.colorClass,x=p?p.file:t.path;return(0,s.FD)("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:x,staged:n,status:f,repo:l||".",root:c}}))},children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[(0,s.Y)("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:(0,s.Y)("span",{className:`font-bold font-mono text-[9px] ${u}`,title:`Status: ${m.label}`,children:f})}),(0,s.Y)(V.o,{name:t.name,size:12,className:"flex-shrink-0"}),(0,s.Y)("span",{className:`truncate ${u}`,title:x,children:t.name})]}),(0,s.Y)("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:(0,s.Y)("div",{className:"flex items-center opacity-0 group-hover:opacity-100 space-x-1",children:n?(0,s.Y)("button",{type:"button",onClick:()=>i("unstage",x),title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(B.A,{size:11})}):(0,s.FD)(s.FK,{children:[(0,s.Y)("button",{type:"button",onClick:()=>i("revert",x),title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:(0,s.Y)(G.A,{size:11})}),(0,s.Y)("button",{type:"button",onClick:()=>i("stage",x),title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(H.A,{size:11})})]})})})]})}function Z(e){let{changes:t,isStaged:n,repo:r,rootPath:i,onAction:o}=e,{tree:l,isFolderOpen:c,toggleFolder:d}=function(e){let{sessionId:t,ready:n,read:s}=(0,I.p0)(),r=(0,a.Kr)(()=>(function(e){let t={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let n of e){let e=n.file.replace(/^[./]+/,""),s=e.endsWith("/"),a=e.replace(/\/$/,"").split("/").filter(Boolean),r=t,i="";for(let e=0;e<a.length;e++){let t=a[e];i=i?`${i}/${t}`:t;let o=e===a.length-1;if(o&&!s)r.children.push({id:i,name:t,path:i,type:"file",change:n,children:[],changeCount:1});else{let e=r.children.find(e=>"folder"===e.type&&e.name===t);e||(e={id:i,name:t,path:i,type:"folder",children:[],changeCount:0,change:o&&s?n:void 0},r.children.push(e)),r=e}}}return!function e(t){if("file"===t.type)return 1;let n=+!!t.change;for(let s of t.children)n+=e(s);return t.changeCount=n,t.children.sort((e,t)=>"folder"===e.type&&"file"===t.type?-1:"file"===e.type&&"folder"===t.type?1:e.name.localeCompare(t.name)),n}(t),t.children})(e),[e]),i=(0,a.Kr)(()=>{let e=new Set;return!function t(n){for(let s of n)"folder"===s.type&&(e.add(s.id),s.children&&s.children.length>0&&t(s.children))}(r),e},[r]),[o,l]=(0,I.bL)("git.expandedFolders",[]),c=(0,a.Kr)(()=>new Set(o),[o]),d=(0,a.li)(null);(0,a.vJ)(()=>{!n||d.current===t||0===i.size||(d.current=t,s("git.expandedFolders",[]).length>0||l(Array.from(i)))},[n,t,i,s,l]);let h=(0,a.hb)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),Array.from(n)})},[l]),p=(0,a.hb)(e=>c.has(e),[c]);return{tree:r,expandedFolders:c,toggleFolder:h,isFolderOpen:p,expandAll:()=>l(Array.from(i)),collapseAll:()=>l([])}}(t);return 0===l.length?null:(0,s.Y)("div",{className:"py-0.5",children:l.map(e=>(0,s.Y)(Q,{node:e,isStaged:n,isFolderOpen:c,toggleFolder:d,onAction:o,repo:r,rootPath:i},e.id))})}function X(e){let{changes:t,isLoading:n,viewMode:a,repo:r,rootPath:i,onAction:o}=e,[l,c]=(0,I.bL)("git.stagedExpanded",!0),[d,h]=(0,I.bL)("git.unstagedExpanded",!0),p=t.filter(e=>{let t=e.status;return t&&" "!==t[0]&&"?"!==t[0]}),m=t.filter(e=>{let t=e.status;return t&&" "!==t[1]&&"?"!==t[1]||"??"===t});return n&&0===t.length?(0,s.Y)("div",{className:"flex-1 scrollbar-overlay-container scrollbar-overlay-static font-mono text-[11px] text-ink/80",children:(0,s.Y)("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})}):0===t.length?(0,s.Y)("div",{className:"flex-1 scrollbar-overlay-container scrollbar-overlay-static font-mono text-[11px] text-ink/80",children:(0,s.Y)("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})}):(0,s.Y)("div",{className:"flex-1 scrollbar-overlay-container scrollbar-overlay-static font-mono text-[11px] text-ink/80",children:(0,s.FD)("div",{className:"py-1",children:[p.length>0&&(0,s.FD)("div",{className:"mb-2",children:[(0,s.FD)("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>c(!l),children:[(0,s.FD)("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[(0,s.Y)("span",{className:"w-3 text-center",children:l?"▾":"▸"}),(0,s.Y)("span",{children:"Staged Changes"}),(0,s.Y)("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[9px] bg-paper",children:p.length})]}),(0,s.Y)("div",{className:"opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),o("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(B.A,{size:12})})})]}),l&&("tree"===a?(0,s.Y)(Z,{changes:p,isStaged:!0,repo:r,rootPath:i,onAction:o}):p.map(e=>(0,s.Y)(q,{change:e,isStaged:!0,repo:r,rootPath:i,onAction:o},e.file+"staged")))]}),m.length>0&&(0,s.FD)("div",{children:[(0,s.FD)("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>h(!d),children:[(0,s.FD)("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[(0,s.Y)("span",{className:"w-3 text-center",children:d?"▾":"▸"}),(0,s.Y)("span",{children:"Changes"}),(0,s.Y)("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[9px] bg-paper",children:m.length})]}),(0,s.FD)("div",{className:"opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),o("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:(0,s.Y)(G.A,{size:12})}),(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),o("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(H.A,{size:12})})]})]}),d&&("tree"===a?(0,s.Y)(Z,{changes:m,isStaged:!1,repo:r,rootPath:i,onAction:o}):m.map(e=>(0,s.Y)(q,{change:e,isStaged:!1,repo:r,rootPath:i,onAction:o},e.file+"unstaged")))]})]})})}var ee=n("wu"),et=n("oZ"),en=n("Af"),es=n("oj");function ea(e){let{className:t="",enabled:n=!0,rootPath:i,refreshKey:o=0}=e,l=(0,r.L)(),c=(0,r.L)(),[d,h,p]=(0,I.bL)("git.activeRepo","."),m=l.data?.activeRepo||d||".",f=e=>{if(!n)return;let t=void 0!==e?e:d,s=new URLSearchParams;i&&s.set("root",i),t&&"."!==t&&s.set("repo",t),s.set("t",String(Date.now())),l.load(`/api/fs/git?${s.toString()}`)},[u,x]=(0,I.bL)("git.commitDraft",""),[b,g]=(0,I.bL)("git.viewMode","flat"),[k,v]=(0,a.J0)(!1),y=(0,a.li)(null),[w,N]=(0,a.J0)(!1),Y=(0,a.li)(null),[C,A]=(0,a.J0)(!1),F=(0,a.li)(null),[D,S]=(0,a.J0)(null),[z,H]=(0,a.J0)(!1),[R,L]=(0,a.J0)(""),W=(0,a.li)(null),[J,T]=(0,a.J0)(null),[E,K]=(0,a.J0)(!1),{toasts:B,pushToast:G,dismissToast:V}=(0,et.Y)(),[U,q]=(0,a.J0)(null),[Q,Z]=(0,a.J0)(!1),[ea,er]=(0,a.J0)(!1);(0,a.vJ)(()=>{K(!0)},[]),(0,a.vJ)(()=>{p&&f(d)},[o,i,n,p]),(0,en.n)(()=>f(d),n&&p),(0,en.w)(()=>f(d),n&&p),(0,a.vJ)(()=>{l.data?.activeRepo&&l.data.activeRepo!==d&&h(l.data.activeRepo)},[l.data?.activeRepo,d,h]),(0,a.vJ)(()=>{l.data?.reposPending&&Z(!0)},[l.data]),(0,a.vJ)(()=>{ea&&l.data&&!l.data.reposPending&&Array.isArray(l.data.repos)&&(q(l.data.repos),er(!1))},[l.data,ea]),(0,a.vJ)(()=>{if(!Q)return;let e=new URLSearchParams({reposOnly:"1"});i&&e.set("root",i);let t=setInterval(async()=>{let t=await fetch(`/api/fs/git?${e.toString()}`).then(e=>e.json()).catch(()=>null);t&&!t.reposPending&&Array.isArray(t.repos)&&(q(t.repos),Z(!1),er(!1),f(d))},1500);return()=>clearInterval(t)},[Q,i,d]),(0,a.vJ)(()=>{z&&W.current&&W.current.focus()},[z]),(0,a.vJ)(()=>{"idle"===c.state&&c.data&&("history"===c.data.type?T({title:"Commit History",data:c.data.data||[]}):"graph"===c.data.type?T({title:"Git Graph",data:c.data.data||[]}):c.data.success?f(m):G(c.data.error||"Git operation failed"))},[c.state,c.data]),(0,es.W)(y,()=>v(!1)),(0,es.W)(Y,()=>N(!1)),(0,es.W)(F,()=>A(!1));let ei=(e,t,n)=>{let s=new FormData;s.append("actionType",e),s.append("repo",m),i&&s.append("root",i),t&&s.append("file",t),n&&Object.entries(n).forEach(e=>{let[t,n]=e;return s.append(t,n)}),c.submit(s,{method:"POST",action:"/api/fs/git"}),"commit"===e&&x("")},eo=l.data?.branch||"main",el=l.data?.branches||["main"],ec=l.data?.remoteBranches||[],ed=U??(l.data?.repos||["."]),eh=l.data?.changes||[],ep="loading"===l.state||"idle"!==c.state,em=eh.filter(e=>{let t=e.status;return t&&" "!==t[0]&&"?"!==t[0]});return n?(0,s.FD)("div",{className:`flex flex-col h-full bg-paper relative ${t}`,children:[E&&(0,s.FD)(s.FK,{children:[(0,s.Y)(j,{modal:D,onClose:()=>S(null),onConfirm:()=>{D&&(ei(D.type,D.file),S(null))}}),(0,s.Y)(P,{isOpen:z,branchName:R,inputRef:W,onChange:L,onClose:()=>{H(!1),L("")},onCreate:()=>{R.trim()&&(ei("create_branch",void 0,{branch:R.trim()}),H(!1),L(""))}}),(0,s.Y)(M,{output:J,onClose:()=>T(null),onRefresh:()=>{J&&ei(J.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(e,t,n)=>ei(e,t,n),rootPath:i,activeRepo:m})]}),(0,s.Y)(ee.y,{toasts:B,onDismiss:V}),(0,s.Y)(_,{repoRef:Y,showRepoMenu:w,setShowRepoMenu:N,activeRepo:m,repos:ed,isLoading:ep,rootPath:i,reposScanning:Q||ea,onSelectRepo:e=>{h(e),f(e)},onRefresh:()=>f(m),onRefreshRepos:()=>{if(!n||Q||ea)return;q(ed),er(!0);let e=new URLSearchParams({rescan:"1"});i&&e.set("root",i),"."!==m&&e.set("repo",m),e.set("t",String(Date.now())),l.load(`/api/fs/git?${e.toString()}`)}}),(0,s.Y)(O,{branchRef:F,showBranchMenu:C,setShowBranchMenu:A,branch:eo,branches:el,remoteBranches:ec,onCheckout:e=>ei("checkout",void 0,{branch:e}),onOpenBranchPrompt:()=>H(!0),optionsRef:y,showOptions:k,setShowOptions:v,onHistory:()=>ei("history"),onGraph:()=>ei("graph"),viewMode:b,setViewMode:g,isBusy:ep,syncCount:l.data?.syncCount,onSync:()=>ei("sync")}),(0,s.Y)($,{message:u,hasStagedChanges:em.length>0,isBusy:ep,onChangeMessage:x,onCommit:()=>ei("commit",void 0,{message:u})}),(0,s.Y)(X,{changes:eh,isLoading:ep,viewMode:b,repo:m,rootPath:i,onAction:(e,t,n)=>{"revert"===e?S({type:e,file:t,message:`Are you sure you want to discard changes in ${t}?`}):"revert_all"===e?S({type:e,message:"Are you sure you want to discard ALL unstaged changes? This cannot be undone."}):ei(e,t,n)}})]}):(0,s.Y)("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:(0,s.Y)("span",{className:"text-xs font-mono",children:"No session selected"})})}},rm(e,t,n){let s=(0,n("y").A)({name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]});n.d(t,{},{A:s})},Wb0(e,t,n){let s=(0,n("y").A)({name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]});n.d(t,{},{A:s})}}]);
|
|
28
|
+
2 unmodified lines`},{file:"docker-compose.yml",status:"M",additions:5,deletions:0}]},{hash:"008cbe0711112222333344445555666677778888",shortHash:"008cbe07",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 01:25 PM",message:"feat(logging): structured timestamped logging across all web flows, bridged to docker logs",parents:["81ad44d5","b3b71ed5"],refs:["origin/feat/whatsapp-notification","feat/whatsapp-notification"],lane:0,files:[{file:"server.ts",status:"M",additions:19,deletions:3}]},{hash:"81ad44d522223333444455556666777788889999",shortHash:"81ad44d5",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 01:07 PM",message:"WIP on main: b3b71ed fix(pbpmd): history modal reads live BOFIS API instead of sqlite cache",parents:["9616fad9"],refs:["refs/stash"],lane:1,files:[{file:"app/routes/api/pb-pmd/$id.history.ts",status:"M",additions:22,deletions:6}]},{hash:"9616fad933334444555566667777888899990000",shortHash:"9616fad9",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 01:07 PM",message:"index on main: b3b71ed fix(pbpmd): history modal reads live BOFIS API instead of sqlite cache",parents:["b3b71ed5"],lane:1,files:[{file:"app/routes/api/pb-pmd/$id.history.ts",status:"M",additions:15,deletions:4}]},{hash:"b3b71ed544445555666677778888999900001111",shortHash:"b3b71ed5",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:55 PM",message:"fix(pbpmd): history modal reads live BOFIS API instead of sqlite cache",parents:["4dc73776"],lane:0,files:[{file:"app/routes/api/pb-pmd/$id.history.ts",status:"M",additions:8,deletions:12}]},{hash:"4dc7377655556666777788889999000011112222",shortHash:"4dc73776",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:50 PM",message:"feat(ui): 13th KPI card TOTAL MANDAYS + gapless 6-col dashboard grid",parents:["acab6465"],lane:0,files:[{file:"app/components/dashboard/KPIGrid.tsx",status:"M",additions:35,deletions:7}]},{hash:"acab646566667777888899990000111122223333",shortHash:"acab6465",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:45 PM",message:"feat(pbpmd): history modal table layout, wider modal, drop edit scenario action",parents:["86a6d6c5"],lane:0,files:[{file:"app/components/pbpmd/HistoryModal.tsx",status:"M",additions:24,deletions:18}]},{hash:"86a6d6c577778888999900001111222233334444",shortHash:"86a6d6c5",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:45 PM",message:"feat(pbpmd): pb history modal reads sqlite cache via /api/pb-pmd/:id/history",parents:["9ffea446"],lane:0,files:[{file:"app/routes/api/pb-pmd/$id.history.ts",status:"M",additions:42,deletions:5}]},{hash:"9ffea44688889999000011112222333344445555",shortHash:"9ffea446",author:"Wijarnako Putra Rajeb",date:"Sep 1, 2026, 12:45 PM",message:"feat(dashboard): crdApproved threshold shifted 5 minutes from history date_end",parents:[],lane:0,files:[{file:"app/lib/dashboard/calculator.ts",status:"M",additions:12,deletions:2}]}];function M(e){let{output:t,onClose:n,onRefresh:r,onExecuteAction:i,rootPath:o,activeRepo:c}=e;if(!t)return null;let d=t.title.toLowerCase().includes("graph"),[h,p]=(0,a.J0)(d),[f,u]=(0,a.J0)(""),[g,k]=(0,a.J0)(""),[v,y]=(0,a.J0)(!1),{commits:w,hasMore:N,totalCount:Y,isLoadingMore:C,handleLoadMore:A}=function(e){let{output:t,isGraphMode:n,rootPath:s,activeRepo:r}=e,[i,o]=(0,a.J0)(!1),[l,c]=(0,a.J0)(t?.hasMore??t?.data?.length===50),[d,h]=(0,a.J0)(t?.total),p=(0,a.Kr)(()=>{let e=t?.data||[];return 0===e.length?D:e[0]&&"object"==typeof e[0]&&("hash"in e[0]||"shortHash"in e[0])?e.map(e=>({hash:e.hash||e.shortHash||"unknown",shortHash:e.shortHash||(e.hash?e.hash.slice(0,8):"unknown"),author:e.author||"Unknown",date:e.date||e.time||"",message:e.message||"",parents:Array.isArray(e.parents)?e.parents:[],refs:Array.isArray(e.refs)?e.refs:[],files:Array.isArray(e.files)?e.files:[],lane:"number"==typeof e.lane?e.lane:void 0})):D},[t?.data]),[m,f]=(0,a.J0)(p);(0,a.vJ)(()=>{f(p),c(t?.hasMore??t?.data?.length===50),"number"==typeof t?.total&&h(t.total)},[p,t?.hasMore,t?.data?.length,t?.total]);let u=(0,a.hb)(async()=>{if(!i&&l){o(!0);try{let e=new FormData;e.set("actionType",n?"graph":"history"),e.set("limit","50"),e.set("skip",String(m.length)),s&&e.set("root",s),r&&e.set("repo",r);let t=await fetch("/api/fs/git",{method:"POST",body:e}),a=await t.json();if(a.success&&Array.isArray(a.data)){let e=a.data.map(e=>({hash:e.hash||e.shortHash||"unknown",shortHash:e.shortHash||(e.hash?e.hash.slice(0,8):"unknown"),author:e.author||"Unknown",date:e.date||e.time||"",message:e.message||"",parents:Array.isArray(e.parents)?e.parents:[],refs:Array.isArray(e.refs)?e.refs:[],files:Array.isArray(e.files)?e.files:[],lane:"number"==typeof e.lane?e.lane:void 0}));f(t=>{let n=new Set(t.map(e=>e.hash));return[...t,...e.filter(e=>!n.has(e.hash))]}),c(!!(a.hasMore??50===e.length)),"number"==typeof a.total&&h(a.total)}else c(!1)}catch(e){console.error("Failed to load more commits:",e)}finally{o(!1)}}},[i,l,n,m.length,s,r]);return{commits:m,setCommits:f,hasMore:l,totalCount:d,isLoadingMore:i,handleLoadMore:u}}({output:t,isGraphMode:h,rootPath:o,activeRepo:c}),{fileDiffs:M,expandedFiles:S,loadingFiles:j,handleToggleFile:P,handleCommitAction:$}=function(e){let{onExecuteAction:t,rootPath:n,activeRepo:s}=e,[r,i]=(0,a.J0)({}),[o,l]=(0,a.J0)(new Set),[c,d]=(0,a.J0)(new Set),h=(0,a.hb)(async(e,t)=>{let a=`${e}:${t.file}`,c=o.has(a);if(l(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t}),!c&&void 0===r[a]&&!t.diff){d(e=>new Set(e).add(a));try{let r=new FormData;r.set("actionType","commit_diff"),r.set("hash",e),r.set("file",t.file),n&&r.set("root",n),s&&"."!==s&&r.set("repo",s);let o=await fetch("/api/fs/git",{method:"POST",body:r}),l=await o.json();l&&"string"==typeof l.diff?i(e=>({...e,[a]:l.diff})):l&&l.error&&i(e=>({...e,[a]:`// Error: ${l.error}`}))}catch(e){console.error("Failed to load file diff:",e),i(t=>({...t,[a]:`// Error loading diff: ${e?.message||"Network error"}`}))}finally{d(e=>{let t=new Set(e);return t.delete(a),t})}}},[o,r,n,s]);return{fileDiffs:r,expandedFiles:o,loadingFiles:c,handleToggleFile:h,handleCommitAction:(0,a.hb)((e,n)=>{if(t)if("checkout"===e)t("checkout",void 0,{branch:n.hash});else if("create_branch_here"===e){let e=window.prompt(`Create new branch at commit ${n.shortHash}:`,`branch-${n.shortHash}`);e?.trim()&&t("create_branch",void 0,{branch:e.trim()})}else if("cherry_pick"===e)window.confirm(`Cherry-pick commit ${n.shortHash} onto current branch?`)&&t("cherry_pick",void 0,{hash:n.hash});else if("revert"===e)window.confirm(`Revert commit ${n.shortHash}?`)&&t("revert_commit",void 0,{hash:n.hash});else if("reset"===e){let e=window.prompt(`Reset current branch to ${n.shortHash} (soft, mixed, hard):`,"soft");e&&["soft","mixed","hard"].includes(e.toLowerCase())&&t("reset_commit",void 0,{hash:n.hash,mode:e.toLowerCase()})}else"merge"===e?window.confirm(`Merge commit ${n.shortHash} into current branch?`)&&t("merge_commit",void 0,{hash:n.hash}):"rebase"===e&&window.confirm(`Rebase current branch onto commit ${n.shortHash}?`)&&t("rebase_commit",void 0,{hash:n.hash})},[t])}}({onExecuteAction:i,rootPath:o,activeRepo:c});(0,a.vJ)(()=>{w.length>0&&!g&&k(w[0].hash)},[w,g]);let z=(0,a.Kr)(()=>{if(!f.trim())return w;let e=f.toLowerCase().trim();return w.filter(t=>t.message.toLowerCase().includes(e)||t.author.toLowerCase().includes(e)||t.shortHash.toLowerCase().includes(e)||t.hash.toLowerCase().includes(e)||t.refs?.some(t=>t.toLowerCase().includes(e)))},[w,f]),H=(0,a.li)(null),R=(0,a.li)(null),L=(0,a.li)(null),W=(0,a.li)({}),[J,T]=(0,a.J0)({}),[O,E]=(0,a.J0)(800);(0,a.vJ)(()=>{let e=L.current;if(!e||!N||C||f.trim())return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&A()},{root:H.current,threshold:.1});return t.observe(e),()=>t.disconnect()},[N,C,f,A]);let K=(0,a.hb)(()=>{if(!H.current||!R.current)return;let e=H.current.getBoundingClientRect(),t=H.current.scrollTop,n={};z.forEach((s,a)=>{let r=W.current[s.hash];if(r){let a=r.getBoundingClientRect();n[s.hash]=a.top+a.height/2-e.top+t}else n[s.hash]=60*a+20}),T(n),E(Math.max(R.current.offsetHeight,H.current.clientHeight,600))},[z]);(0,a.Nf)(()=>{K();let e=requestAnimationFrame(()=>{K()});return()=>cancelAnimationFrame(e)},[K,z,M,S,h]),(0,a.vJ)(()=>{let e=R.current;if(!e)return;let t=new ResizeObserver(()=>{K()});return t.observe(e),()=>t.disconnect()},[K]);let I=(0,a.Kr)(()=>x(z),[z]),_=(0,a.Kr)(()=>{let e=0;return I.forEach(t=>{t>e&&(e=t)}),e},[I]),B=h?(_+1)*18+32:36,G=async()=>{y(!0),r&&await r(),setTimeout(()=>y(!1),600)};return(0,s.Y)("div",{className:"fixed inset-0 z-50 bg-canvas/80 backdrop-blur-xs flex items-center justify-center p-0 lg:p-5",onClick:n,role:"dialog","aria-modal":"true",children:(0,s.FD)("div",{className:"bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden\n w-full h-full rounded-none border-0\n lg:w-[min(96vw,980px)] lg:h-[88vh] lg:rounded-xl lg:border\n pt-[env(safe-area-inset-top,0px)] lg:pt-0",onClick:e=>e.stopPropagation(),children:[(0,s.Y)(m,{isGraphMode:h,onToggleMode:p,searchQuery:f,onSearchChange:u,onRefresh:G,onClose:n,isRefreshing:v,totalCommits:z.length,totalCount:Y}),(0,s.Y)("div",{ref:H,className:"flex-1 overflow-y-auto scrollbar-overlay-container relative select-text",children:0===z.length?(0,s.Y)("div",{className:"flex flex-col items-center justify-center py-20 text-ink/40 font-mono text-xs",children:"No matching commits found."}):(0,s.FD)("div",{className:"relative min-h-full pb-8",children:[(0,s.Y)(b,{commits:z,nodePositions:J,selectedHash:g,isGraphMode:h,laneWidth:18,paddingLeft:16,totalHeight:O}),(0,s.FD)("div",{ref:R,className:"flex flex-col relative z-20",style:{paddingLeft:`${B}px`},children:[z.map(e=>(0,s.Y)(F,{commit:e,isSelected:g===e.hash,isGraphMode:h,onSelect:e=>k(e.hash),onAction:$,onToggleFile:P,isExpandedFile:(e,t)=>S.has(`${e}:${t}`),isLoadingFile:(e,t)=>j.has(`${e}:${t}`),fileDiffs:M,headerRef:t=>{W.current[e.hash]=t}},e.hash)),(0,s.Y)("div",{ref:L,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:C?(0,s.FD)("div",{className:"flex items-center gap-2 text-xs text-ink/60 font-mono py-2",children:[(0,s.Y)(l.A,{size:14,className:"animate-spin text-info"}),(0,s.Y)("span",{children:"Loading more commits..."})]}):N&&!f.trim()?(0,s.Y)("button",{type:"button",onClick:A,className:"px-3 py-1.5 text-xs font-mono text-ink/70 hover:text-ink bg-ink/5 hover:bg-ink/10 rounded-md border border-ink/10 transition-colors cursor-pointer",children:"Load more commits..."}):z.length>10?(0,s.FD)("div",{className:"text-[11px] font-mono text-ink/40 py-2",children:["End of commit history (",z.length," commits)"]}):null})]})]})})]})})}function S(e){let{children:t,onClose:n,wide:a}=e;return(0,s.Y)("div",{className:"fixed inset-0 z-50 bg-canvas/80 flex items-center justify-center p-4",onClick:n,role:"dialog","aria-modal":"true",children:(0,s.Y)("div",{className:`bg-paper border border-ink/20 rounded-lg shadow-xl flex flex-col overflow-hidden ${a?"w-[min(94vw,680px)] max-h-[82vh]":"w-[min(94vw,420px)] max-h-[80vh]"}`,onClick:e=>e.stopPropagation(),children:t})})}function j(e){let{modal:t,onClose:n,onConfirm:a}=e;return t?(0,s.FD)(S,{onClose:n,children:[(0,s.FD)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[(0,s.Y)(i.A,{size:16,className:"text-error flex-shrink-0"}),(0,s.Y)("h3",{className:"text-sm font-semibold text-ink",children:"Confirm Action"})]}),(0,s.Y)("div",{className:"px-4 py-4 text-xs text-ink/80 leading-relaxed",children:t.message}),(0,s.FD)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[(0,s.Y)("button",{type:"button",onClick:n,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),(0,s.Y)("button",{type:"button",onClick:a,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Confirm"})]})]}):null}function P(e){let{isOpen:t,branchName:n,inputRef:r,onChange:i,onClose:l,onCreate:c}=e;if(!t)return null;let d=(0,a.hb)(()=>{n.trim()&&c()},[n,c]);return(0,s.FD)(S,{onClose:l,children:[(0,s.FD)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[(0,s.Y)(o.A,{size:16,className:"text-ink/60 flex-shrink-0"}),(0,s.Y)("h3",{className:"text-sm font-semibold text-ink",children:"Create New Branch"})]}),(0,s.Y)("div",{className:"px-4 py-4",children:(0,s.Y)("input",{ref:r,type:"text",value:n,onChange:e=>i(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&d(),"Escape"===e.key&&l()},placeholder:"branch-name",className:"w-full bg-canvas border border-ink/20 rounded px-3 py-2 text-xs focus:outline-none focus:border-ink/40 text-ink placeholder-ink/40 transition-colors"})}),(0,s.FD)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[(0,s.Y)("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),(0,s.Y)("button",{type:"button",onClick:d,disabled:!n.trim(),className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Create"})]})]})}function $(e){let{message:t,hasStagedChanges:n,isBusy:a=!1,onChangeMessage:r,onCommit:i}=e,o=n&&t.trim().length>0&&!a;return(0,s.FD)("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[(0,s.Y)("textarea",{value:t,onChange:e=>r(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&o&&(e.preventDefault(),i())},placeholder:"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),(0,s.FD)("button",{type:"button",onClick:i,disabled:!o,title:n?"Commit staged changes":"Stage changes first",className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,s.Y)(g.A,{size:12}),"Commit"]})]})}var z=n("vZ"),H=n("r"),R=n("n"),L=n("Sj"),W=n("y");let J=(0,W.A)({name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]}),T=(0,W.A)({name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]});function O(e){let{branchRef:t,showBranchMenu:n,setShowBranchMenu:a,branch:r,branches:i,remoteBranches:l,onCheckout:d,onOpenBranchPrompt:h,optionsRef:p,showOptions:m,setShowOptions:f,onHistory:u,onGraph:x,viewMode:b,setViewMode:k,isBusy:y=!1,syncCount:w={ahead:0,behind:0},onSync:N}=e;return(0,s.FD)("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[(0,s.FD)("div",{className:"relative",ref:t,children:[(0,s.FD)("button",{onClick:()=>a(!n),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",children:[(0,s.Y)(z.A,{size:12,className:"text-ink/60"}),(0,s.Y)("span",{className:"truncate max-w-[140px]",children:r}),(0,s.Y)(v.A,{size:12,className:"text-ink/40"})]}),n&&(0,s.Y)("div",{className:"absolute top-full left-0 mt-1 w-48 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:(0,s.FD)("div",{className:"max-h-48 scrollbar-overlay-container scrollbar-overlay-static py-1",children:[i.length>0&&(0,s.FD)(s.FK,{children:[(0,s.Y)("div",{className:"px-3 py-1 text-[9px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),i.map(e=>(0,s.FD)("button",{onClick:()=>{d(e),a(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.Y)("span",{className:"truncate",children:e}),r===e&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]},e))]}),l.length>0&&(0,s.FD)(s.FK,{children:[(0,s.Y)("div",{className:"px-3 py-1 text-[9px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),l.map(e=>(0,s.FD)("button",{onClick:()=>{d(e),a(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.Y)("span",{className:"truncate",children:e}),r===e&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]},e))]}),(0,s.Y)("div",{className:"w-full h-px bg-ink/10 my-1"}),(0,s.FD)("button",{onClick:()=>{h(),a(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[(0,s.Y)(H.A,{size:12}),(0,s.Y)("span",{children:"Create new branch..."})]})]})})]}),(0,s.FD)("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:p,children:[(0,s.FD)("button",{type:"button",onClick:N,disabled:y,title:w.ahead>0&&w.behind>0?`Pull ${w.behind} then push ${w.ahead} commit(s)`:w.ahead>0?`Push ${w.ahead} commit(s)`:w.behind>0?`Pull ${w.behind} commit(s)`:"Up to date — sync anyway",className:"flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,s.Y)(R.A,{size:13}),(0,s.FD)("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",w.ahead," ↓",w.behind]})]}),(0,s.Y)("button",{type:"button",onClick:u,title:"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:(0,s.Y)(c.A,{size:13})}),(0,s.Y)("button",{type:"button",onClick:x,title:"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:(0,s.Y)(o.A,{size:13})}),(0,s.Y)("button",{type:"button",onClick:()=>f(!m),title:"View Options",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:(0,s.Y)(L.A,{size:13})}),m&&(0,s.FD)("div",{className:"absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[(0,s.FD)("button",{type:"button",onClick:()=>{k("flat"),f(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5",children:[(0,s.Y)(J,{size:12,className:"text-ink/60"}),(0,s.Y)("span",{children:"View as List"})]}),"flat"===b&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]}),(0,s.FD)("button",{type:"button",onClick:()=>{k("tree"),f(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5",children:[(0,s.Y)(T,{size:12,className:"text-ink/60"}),(0,s.Y)("span",{children:"View as Tree"})]}),"tree"===b&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]})]})]})]})}var E=n("rm"),K=n("Ir"),I=n("FL");function _(e){let{repoRef:t,showRepoMenu:n,setShowRepoMenu:a,activeRepo:r,repos:i,isLoading:o,rootPath:l,reposScanning:c,onSelectRepo:d,onRefresh:h,onRefreshRepos:m}=e,[f,u]=(0,I.bL)("git.repoQuery",""),x=function(e){if(!e)return"workspace root";let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t.length>0?t[t.length-1]:"workspace root"}(l),b=e=>"."===e?x:e,k=i.filter(e=>!f.trim()||b(e).toLowerCase().includes(f.toLowerCase()));return(0,s.FD)("div",{className:"p-3 border-b border-ink/10 flex items-center justify-between",children:[(0,s.FD)("div",{className:"relative",ref:t,children:[(0,s.FD)("button",{onClick:()=>a(!n),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-xs text-ink/80 font-medium",children:[(0,s.Y)(E.A,{size:12,className:"text-ink/60"}),(0,s.FD)("span",{className:"flex items-center space-x-1 truncate max-w-[150px]",children:[(0,s.Y)("span",{className:"text-ink/50 font-normal uppercase tracking-wider text-[10px]",children:"GIT"}),(0,s.Y)("span",{className:"text-ink/30",children:"•"}),(0,s.Y)("span",{children:"."===r?x:r.split("/").pop()})]}),(0,s.Y)(v.A,{size:12,className:"text-ink/40"})]}),n&&(0,s.FD)("div",{className:"absolute top-full left-0 mt-1 w-52 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[(0,s.FD)("div",{className:"px-2 py-1.5 border-b border-ink/10 flex items-center space-x-1.5",children:[(0,s.Y)(p.A,{size:11,className:"text-ink/40 flex-shrink-0"}),(0,s.Y)("input",{type:"text",value:f,onChange:e=>u(e.currentTarget.value),placeholder:"Search repos...",title:"Search repositories",className:"w-full bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),f&&(0,s.Y)("button",{type:"button",onClick:()=>u(""),title:"Clear search",className:"text-ink/40 hover:text-ink flex-shrink-0",children:"×"}),(0,s.Y)("button",{type:"button",onClick:m,title:"Refresh nested repos",disabled:c,className:"text-ink/40 hover:text-ink flex-shrink-0 transition-colors disabled:opacity-40 disabled:hover:text-ink/40",children:(0,s.Y)(K.A,{size:11,className:c?"animate-spin":""})})]}),(0,s.Y)("div",{className:"max-h-48 scrollbar-overlay-container scrollbar-overlay-static py-1",children:0===k.length?(0,s.Y)("div",{className:"px-3 py-2 text-ink/40 italic",children:"No repos found"}):k.map(e=>(0,s.FD)("button",{onClick:()=>{d(e),a(!1),u("")},title:b(e),className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,s.Y)("span",{className:"truncate",children:b(e)}),r===e&&(0,s.Y)(g.A,{size:12,className:"text-ink"})]},e))})]})]}),(0,s.Y)("div",{className:"flex space-x-2 text-ink/40",children:(0,s.Y)("button",{type:"button",onClick:h,title:"Refresh",className:"hover:text-ink cursor-pointer inline-flex",children:(0,s.Y)(K.A,{size:14,className:o?"animate-spin":""})})})]})}var B=n("DV"),G=n("I"),V=n("ob"),U=n("LQ");function q(e){let{change:t,isStaged:n,repo:a,rootPath:r,onAction:i}=e,o=(0,U.R)(t.status,n),l=o.charStatus,c=o.colorClass,d=t.file.split("/"),h=d.pop()||t.file,p=d.length>0?d.join("/"):"";return(0,s.FD)("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:n,status:l,repo:a||".",root:r}}))},children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[(0,s.Y)("span",{className:`font-bold font-mono text-[9px] w-3 flex-shrink-0 text-center ${c}`,title:`Status: ${o.label}`,children:l}),(0,s.Y)(V.o,{name:h,size:12,className:"flex-shrink-0"}),(0,s.Y)("span",{className:`truncate ${c}`,title:t.file,children:h}),p&&(0,s.Y)("span",{className:"text-[9px] text-ink/40 truncate ml-1",children:p})]}),(0,s.Y)("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:(0,s.FD)("div",{className:"flex items-center opacity-0 group-hover:opacity-100 space-x-1",children:[!n&&(0,s.FD)(s.FK,{children:[(0,s.Y)("button",{type:"button",onClick:()=>i("revert",t.file),title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:(0,s.Y)(G.A,{size:11})}),(0,s.Y)("button",{type:"button",onClick:()=>i("stage",t.file),title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(H.A,{size:11})})]}),n&&(0,s.Y)("button",{type:"button",onClick:()=>i("unstage",t.file),title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(B.A,{size:11})})]})})]})}function Q(e){let{node:t,isStaged:n,isFolderOpen:a,toggleFolder:r,onAction:i,depth:o=0,repo:l,rootPath:c}=e,d="folder"===t.type,h=!!d&&a(t.id);if(d)return(0,s.FD)("div",{className:"select-none",children:[(0,s.FD)("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[(0,s.Y)("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:h?(0,s.Y)(v.A,{size:12}):(0,s.Y)(y.A,{size:12})}),(0,s.Y)(V.o,{name:t.name,isFolder:!0,isOpen:h,size:13,className:"flex-shrink-0"}),(0,s.Y)("span",{className:"font-medium text-ink truncate",children:t.name}),(0,s.Y)("span",{className:"text-[9px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),(0,s.Y)("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:(0,s.Y)("div",{className:"flex items-center opacity-0 group-hover:opacity-100 space-x-1",children:n?(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),i("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(B.A,{size:11})}):(0,s.FD)(s.FK,{children:[(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),i("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:(0,s.Y)(G.A,{size:11})}),(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),i("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(H.A,{size:11})})]})})})]}),h&&t.children&&t.children.length>0&&(0,s.Y)("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map(e=>(0,s.Y)(Q,{node:e,isStaged:n,isFolderOpen:a,toggleFolder:r,onAction:i,depth:o+1,repo:l,rootPath:c},e.id))})]});let p=t.change,m=(0,U.R)(p?.status||"M",n),f=m.charStatus,u=m.colorClass,x=p?p.file:t.path;return(0,s.FD)("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:x,staged:n,status:f,repo:l||".",root:c}}))},children:[(0,s.FD)("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[(0,s.Y)("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:(0,s.Y)("span",{className:`font-bold font-mono text-[9px] ${u}`,title:`Status: ${m.label}`,children:f})}),(0,s.Y)(V.o,{name:t.name,size:12,className:"flex-shrink-0"}),(0,s.Y)("span",{className:`truncate ${u}`,title:x,children:t.name})]}),(0,s.Y)("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:(0,s.Y)("div",{className:"flex items-center opacity-0 group-hover:opacity-100 space-x-1",children:n?(0,s.Y)("button",{type:"button",onClick:()=>i("unstage",x),title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(B.A,{size:11})}):(0,s.FD)(s.FK,{children:[(0,s.Y)("button",{type:"button",onClick:()=>i("revert",x),title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:(0,s.Y)(G.A,{size:11})}),(0,s.Y)("button",{type:"button",onClick:()=>i("stage",x),title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(H.A,{size:11})})]})})})]})}function Z(e){let{changes:t,isStaged:n,repo:r,rootPath:i,onAction:o}=e,{tree:l,isFolderOpen:c,toggleFolder:d}=function(e){let{sessionId:t,ready:n,read:s}=(0,I.p0)(),r=(0,a.Kr)(()=>(function(e){let t={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let n of e){let e=n.file.replace(/^[./]+/,""),s=e.endsWith("/"),a=e.replace(/\/$/,"").split("/").filter(Boolean),r=t,i="";for(let e=0;e<a.length;e++){let t=a[e];i=i?`${i}/${t}`:t;let o=e===a.length-1;if(o&&!s)r.children.push({id:i,name:t,path:i,type:"file",change:n,children:[],changeCount:1});else{let e=r.children.find(e=>"folder"===e.type&&e.name===t);e||(e={id:i,name:t,path:i,type:"folder",children:[],changeCount:0,change:o&&s?n:void 0},r.children.push(e)),r=e}}}return!function e(t){if("file"===t.type)return 1;let n=+!!t.change;for(let s of t.children)n+=e(s);return t.changeCount=n,t.children.sort((e,t)=>"folder"===e.type&&"file"===t.type?-1:"file"===e.type&&"folder"===t.type?1:e.name.localeCompare(t.name)),n}(t),t.children})(e),[e]),i=(0,a.Kr)(()=>{let e=new Set;return!function t(n){for(let s of n)"folder"===s.type&&(e.add(s.id),s.children&&s.children.length>0&&t(s.children))}(r),e},[r]),[o,l]=(0,I.bL)("git.expandedFolders",[]),c=(0,a.Kr)(()=>new Set(o),[o]),d=(0,a.li)(null);(0,a.vJ)(()=>{!n||d.current===t||0===i.size||(d.current=t,s("git.expandedFolders",[]).length>0||l(Array.from(i)))},[n,t,i,s,l]);let h=(0,a.hb)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),Array.from(n)})},[l]),p=(0,a.hb)(e=>c.has(e),[c]);return{tree:r,expandedFolders:c,toggleFolder:h,isFolderOpen:p,expandAll:()=>l(Array.from(i)),collapseAll:()=>l([])}}(t);return 0===l.length?null:(0,s.Y)("div",{className:"py-0.5",children:l.map(e=>(0,s.Y)(Q,{node:e,isStaged:n,isFolderOpen:c,toggleFolder:d,onAction:o,repo:r,rootPath:i},e.id))})}function X(e){let{changes:t,isLoading:n,viewMode:a,repo:r,rootPath:i,onAction:o}=e,[l,c]=(0,I.bL)("git.stagedExpanded",!0),[d,h]=(0,I.bL)("git.unstagedExpanded",!0),p=t.filter(e=>{let t=e.status;return t&&" "!==t[0]&&"?"!==t[0]}),m=t.filter(e=>{let t=e.status;return t&&" "!==t[1]&&"?"!==t[1]||"??"===t});return n&&0===t.length?(0,s.Y)("div",{className:"flex-1 scrollbar-overlay-container scrollbar-overlay-static font-mono text-[11px] text-ink/80",children:(0,s.Y)("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})}):0===t.length?(0,s.Y)("div",{className:"flex-1 scrollbar-overlay-container scrollbar-overlay-static font-mono text-[11px] text-ink/80",children:(0,s.Y)("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})}):(0,s.Y)("div",{className:"flex-1 scrollbar-overlay-container scrollbar-overlay-static font-mono text-[11px] text-ink/80",children:(0,s.FD)("div",{className:"py-1",children:[p.length>0&&(0,s.FD)("div",{className:"mb-2",children:[(0,s.FD)("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>c(!l),children:[(0,s.FD)("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[(0,s.Y)("span",{className:"w-3 text-center",children:l?"▾":"▸"}),(0,s.Y)("span",{children:"Staged Changes"}),(0,s.Y)("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[9px] bg-paper",children:p.length})]}),(0,s.Y)("div",{className:"opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),o("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(B.A,{size:12})})})]}),l&&("tree"===a?(0,s.Y)(Z,{changes:p,isStaged:!0,repo:r,rootPath:i,onAction:o}):p.map(e=>(0,s.Y)(q,{change:e,isStaged:!0,repo:r,rootPath:i,onAction:o},e.file+"staged")))]}),m.length>0&&(0,s.FD)("div",{children:[(0,s.FD)("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>h(!d),children:[(0,s.FD)("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[(0,s.Y)("span",{className:"w-3 text-center",children:d?"▾":"▸"}),(0,s.Y)("span",{children:"Changes"}),(0,s.Y)("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[9px] bg-paper",children:m.length})]}),(0,s.FD)("div",{className:"opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),o("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:(0,s.Y)(G.A,{size:12})}),(0,s.Y)("button",{type:"button",onClick:e=>{e.stopPropagation(),o("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:(0,s.Y)(H.A,{size:12})})]})]}),d&&("tree"===a?(0,s.Y)(Z,{changes:m,isStaged:!1,repo:r,rootPath:i,onAction:o}):m.map(e=>(0,s.Y)(q,{change:e,isStaged:!1,repo:r,rootPath:i,onAction:o},e.file+"unstaged")))]})]})})}var ee=n("wu"),et=n("oZ"),en=n("Af"),es=n("oj");function ea(e){let{className:t="",enabled:n=!0,rootPath:i,refreshKey:o=0}=e,l=(0,r.L)(),c=(0,r.L)(),[d,h,p]=(0,I.bL)("git.activeRepo","."),m=l.data?.activeRepo||d||".",f=e=>{if(!n)return;let t=void 0!==e?e:d,s=new URLSearchParams;i&&s.set("root",i),t&&"."!==t&&s.set("repo",t),s.set("sync","1"),s.set("t",String(Date.now())),l.load(`/api/fs/git?${s.toString()}`)},[u,x]=(0,I.bL)("git.commitDraft",""),[b,g]=(0,I.bL)("git.viewMode","flat"),[k,v]=(0,a.J0)(!1),y=(0,a.li)(null),[w,N]=(0,a.J0)(!1),Y=(0,a.li)(null),[C,A]=(0,a.J0)(!1),F=(0,a.li)(null),[D,S]=(0,a.J0)(null),[z,H]=(0,a.J0)(!1),[R,L]=(0,a.J0)(""),W=(0,a.li)(null),[J,T]=(0,a.J0)(null),[E,K]=(0,a.J0)(!1),{toasts:B,pushToast:G,dismissToast:V}=(0,et.Y)(),[U,q]=(0,a.J0)(null),[Q,Z]=(0,a.J0)(!1),[ea,er]=(0,a.J0)(!1);(0,a.vJ)(()=>{K(!0)},[]),(0,a.vJ)(()=>{p&&f(d)},[o,i,n,p]),(0,en.n)(()=>f(d),n&&p),(0,en.w)(()=>f(d),n&&p),(0,a.vJ)(()=>{l.data?.activeRepo&&l.data.activeRepo!==d&&h(l.data.activeRepo)},[l.data?.activeRepo,d,h]),(0,a.vJ)(()=>{l.data?.reposPending&&Z(!0)},[l.data]),(0,a.vJ)(()=>{ea&&l.data&&!l.data.reposPending&&Array.isArray(l.data.repos)&&(q(l.data.repos),er(!1))},[l.data,ea]),(0,a.vJ)(()=>{if(!Q)return;let e=new URLSearchParams({reposOnly:"1"});i&&e.set("root",i);let t=setInterval(async()=>{let t=await fetch(`/api/fs/git?${e.toString()}`).then(e=>e.json()).catch(()=>null);t&&!t.reposPending&&Array.isArray(t.repos)&&(q(t.repos),Z(!1),er(!1),f(d))},1500);return()=>clearInterval(t)},[Q,i,d]),(0,a.vJ)(()=>{z&&W.current&&W.current.focus()},[z]),(0,a.vJ)(()=>{"idle"===c.state&&c.data&&("history"===c.data.type?T({title:"Commit History",data:c.data.data||[]}):"graph"===c.data.type?T({title:"Git Graph",data:c.data.data||[]}):c.data.success?f(m):G(c.data.error||"Git operation failed"))},[c.state,c.data]),(0,es.W)(y,()=>v(!1)),(0,es.W)(Y,()=>N(!1)),(0,es.W)(F,()=>A(!1));let ei=(e,t,n)=>{let s=new FormData;s.append("actionType",e),s.append("repo",m),i&&s.append("root",i),t&&s.append("file",t),n&&Object.entries(n).forEach(e=>{let[t,n]=e;return s.append(t,n)}),c.submit(s,{method:"POST",action:"/api/fs/git"}),"commit"===e&&x("")},eo=l.data?.branch||"main",el=l.data?.branches||["main"],ec=l.data?.remoteBranches||[],ed=U??(l.data?.repos||["."]),eh=l.data?.changes||[],ep="loading"===l.state||"idle"!==c.state,em=eh.filter(e=>{let t=e.status;return t&&" "!==t[0]&&"?"!==t[0]});return n?(0,s.FD)("div",{className:`flex flex-col h-full bg-paper relative ${t}`,children:[E&&(0,s.FD)(s.FK,{children:[(0,s.Y)(j,{modal:D,onClose:()=>S(null),onConfirm:()=>{D&&(ei(D.type,D.file),S(null))}}),(0,s.Y)(P,{isOpen:z,branchName:R,inputRef:W,onChange:L,onClose:()=>{H(!1),L("")},onCreate:()=>{R.trim()&&(ei("create_branch",void 0,{branch:R.trim()}),H(!1),L(""))}}),(0,s.Y)(M,{output:J,onClose:()=>T(null),onRefresh:()=>{J&&ei(J.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(e,t,n)=>ei(e,t,n),rootPath:i,activeRepo:m})]}),(0,s.Y)(ee.y,{toasts:B,onDismiss:V}),(0,s.Y)(_,{repoRef:Y,showRepoMenu:w,setShowRepoMenu:N,activeRepo:m,repos:ed,isLoading:ep,rootPath:i,reposScanning:Q||ea,onSelectRepo:e=>{h(e),f(e)},onRefresh:()=>f(m),onRefreshRepos:()=>{if(!n||Q||ea)return;q(ed),er(!0);let e=new URLSearchParams({rescan:"1",sync:"1"});i&&e.set("root",i),"."!==m&&e.set("repo",m),e.set("t",String(Date.now())),l.load(`/api/fs/git?${e.toString()}`)}}),(0,s.Y)(O,{branchRef:F,showBranchMenu:C,setShowBranchMenu:A,branch:eo,branches:el,remoteBranches:ec,onCheckout:e=>ei("checkout",void 0,{branch:e}),onOpenBranchPrompt:()=>H(!0),optionsRef:y,showOptions:k,setShowOptions:v,onHistory:()=>ei("history"),onGraph:()=>ei("graph"),viewMode:b,setViewMode:g,isBusy:ep,syncCount:l.data?.syncCount,onSync:()=>ei("sync")}),(0,s.Y)($,{message:u,hasStagedChanges:em.length>0,isBusy:ep,onChangeMessage:x,onCommit:()=>ei("commit",void 0,{message:u})}),(0,s.Y)(X,{changes:eh,isLoading:ep,viewMode:b,repo:m,rootPath:i,onAction:(e,t,n)=>{"revert"===e?S({type:e,file:t,message:`Are you sure you want to discard changes in ${t}?`}):"revert_all"===e?S({type:e,message:"Are you sure you want to discard ALL unstaged changes? This cannot be undone."}):ei(e,t,n)}})]}):(0,s.Y)("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:(0,s.Y)("span",{className:"text-xs font-mono",children:"No session selected"})})}},rm(e,t,n){let s=(0,n("y").A)({name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]});n.d(t,{},{A:s})},Wb0(e,t,n){let s=(0,n("y").A)({name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]});n.d(t,{},{A:s})}}]);
|